diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 7e7c3a5b92c..00000000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "packages/unofficial"] - path = packages/unofficial - url = https://github.com/OpenELEC/unofficial-addons.git diff --git a/CHANGELOG b/CHANGELOG index 3dfe1cf988c..3b125f32485 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,13 +1,13 @@ -OpenELEC CHANGELOG +LibreELEC CHANGELOG ================== To view recent changes/commits to the project (master branch) please visit: -https://github.com/OpenELEC/OpenELEC.tv/commits/master +https://github.com/LibreELEC/LibreELEC.tv/commits/master To compare commits between versions use a formatted URL like: -https://github.com/OpenELEC/OpenELEC.tv/compare/3.2.3...3.2.4 +https://github.com/LibreELEC/LibreELEC.tv/compare/3.2.3...3.2.4 If you have questions on differences between releases please ask them in the -OpenELEC website forums or IRC support channel. +LibreELEC website forums or IRC support channel. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 573c43fca2b..06fefb4ba6e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,20 +1,20 @@ -### Questions about OpenELEC? +### Questions about LibreELEC? -To get your questions answered, please ask in the OpenELEC [Forum], on IRC: -\#openelec on freenode.net, or [webchat]. +To get your questions answered, please ask in the LibreELEC [Forum], on IRC: +\#libreelec on freenode.net, or [webchat]. Do not open an issue. ### Issue Reports **BEFORE you report a bug make sure you got the latest testing version of -OpenELEC. Your bug might be already fixed.** +LibreELEC. Your bug might be already fixed.** -If you are at all unsure whether it's a bug in OpenELEC or a problem with -something else, post in the OpenELEC [Forum] instead. If it turns out that it is +If you are at all unsure whether it's a bug in LibreELEC or a problem with +something else, post in the LibreELEC [Forum] instead. If it turns out that it is a bug, an issue can always be opened later. -If you are sure that it's a bug in OpenELEC and you have not found a [similar issue], open a new [issue] +If you are sure that it's a bug in LibreELEC and you have not found a [similar issue], open a new [issue] and try to answer the following questions: - What did you do? - What did you expect to happen? @@ -23,21 +23,21 @@ and try to answer the following questions: **It is also importent to provide logs for debugging. A zip file can be found in the [logfiles] samba share, this will contain all the logs needed.** -Make sure to specify which version of OpenELEC you are using. -- OpenELEC version -- OpenELEC build -- OpenELEC arch +Make sure to specify which version of LibreELEC you are using. +- LibreELEC version +- LibreELEC build +- LibreELEC arch Please don't paste log messages in the issue reports or issue comments - use [sprunge.us](http://sprunge.us) instead. Feature requests are great, but they usually end up lying around the issue tracker indefinitely. Sending a pull request is a much better way of getting a -particular feature into OpenELEC. +particular feature into LibreELEC. Please dont ask us to add 3rdparty drivers unless you are the maintainer/developer of the driver, we have no manpower to support a non-mainlined kernel driver for your hardware. -However, OpenELEC comes with minimal set of kernel drivers enabled, if you are sure that your hardware +However, LibreELEC comes with minimal set of kernel drivers enabled, if you are sure that your hardware is supported in mainline kernel, feel free to send us a Pull Request to enable it in our kernel defconfigs. We are always happy to support known-working hardware. @@ -66,11 +66,11 @@ Please follow this process; it's the best way to get your work included in the p ```bash # clone your fork of the repo into the current directory in terminal - git clone git@github.com:/OpenELEC.tv.git + git clone git@github.com:/LibreELEC.tv.git # navigate to the newly cloned directory - cd OpenELEC.tv + cd LibreELEC.tv # assign the original repo to a remote called "upstream" - git remote add upstream https://github.com/OpenELEC/OpenELEC.tv.git + git remote add upstream https://github.com/LibreELEC/LibreELEC.tv.git ``` - If you cloned a while ago, get the latest changes from upstream: @@ -104,8 +104,8 @@ Please follow this process; it's the best way to get your work included in the p - [Open a Pull Request](https://help.github.com/articles/using-pull-requests) with a clear title and description. -[Forum]: http://openelec.tv/forum -[issue]: https://github.com/OpenELEC/OpenELEC.tv/issues -[webchat]: http://openelec.tv/support/chat -[logfiles]: http://wiki.openelec.tv/index.php?title=OpenELEC_FAQ#Support_Logs -[similar issue]: https://github.com/OpenELEC/OpenELEC.tv/search?&ref=cmdform&type=Issues +[Forum]: http://libreelec.tv/forum +[issue]: https://github.com/LibreELEC/LibreELEC.tv/issues +[webchat]: http://libreelec.tv/support/chat +[logfiles]: http://wiki.libreelec.tv/index.php?title=LibreELEC_FAQ#Support_Logs +[similar issue]: https://github.com/LibreELEC/LibreELEC.tv/search?&ref=cmdform&type=Issues diff --git a/README.md b/README.md index 5dbd76c1a58..e9bf1d6836a 100644 --- a/README.md +++ b/README.md @@ -1,80 +1,29 @@ -[OpenELEC](http://www.openelec.tv) +# LibreELEC +[SliceOS] -# OpenELEC - Open Embedded Linux Entertainment Center +This is a build system to create the SliceOS build for the Slice media player. To build you need to run: -OpenELEC runs [Kodi](http://kodi.tv), an award-winning free and open source (GPL) software media -player and entertainment hub for digital media. For more info see http://kodi.tv . -The base system has been designed and built from the ground up to be as -efficient as possible – consuming only tiny disk and memory footprints and -providing cutting edge hardware support to deliver a set-top box experience. +``` +ARCH=arm PROJECT=Slice DISTRO=Slice make +``` +This will then build the targets for the Slice distribution. To install the build it should be possible to achieve this using standard update mechanism for OpenELEC (copy the SYSTEM SYSTEM.md5 KERNEL KERNEL.md5 into the updates share). -**Source code** +[LibreELEC](http://www.libreelec.tv) -* https://github.com/OpenELEC/OpenELEC.tv +LibreELEC is a 'Just enough OS' Linux distribution for running the award-winning [Kodi](http://kodi.tv) software on popular mediacentre hardware. LibreELEC is a conservative fork of the popular [OpenELEC](http://openelec.tv) project with a stronger focus on pre-release testing and post-release change management. Further information on the project can be found on the [LibreELEC website](https://libreelec.tv). -**Installation** +**Issues & Support** -* Please read the instructions in our wiki (http://wiki.openelec.tv/index.php?title=Installation) on how to install. +Please report issues via the [LibreELEC forum: Bug Reports](http://forum.libreelec.tv/forum-35.html). Please ask support questions in the [LibreELEC forum: Help & Support](http://forum.libreelec.tv/forum-3.html) or ask a member of project staff in the #libreelec IRC channel on Freenode. -**License** - -* OpenELEC is released under [GPLv2](http://www.gnu.org/licenses/gpl-2.0.html). Please refer to the "licenses" folder and - source code for clarification on upstream licensing. - -**Copyright** - -* Since OpenELEC includes code from many up stream projects it includes many - copyright owners. OpenELEC makes NO claim of copyright on any upstream code. - However all OpenELEC authored code is copyright openelec.tv. - For a complete copyright list checkout the source code to examine the headers. - Unless expressly stated otherwise all code submitted DIRECTLY to the OpenELEC - project (in any form) is licensed under [GPLv2](http://www.gnu.org/licenses/gpl-2.0.html) and the Copyright is donated to - openelec.tv. - This allows the project to stay manageable in the long term by giving us the - freedom to maintain the code as part of the whole without the management - overhead of preserving contact with every submitter ever e.g. move to GPLv3. - You are absolutely free to retain copyright. To retain copyright simply add a - copyright header to every submitted code page. - If you are submitting code that is not your own work it is the submitters - responsibility to place a header stating the copyright. - -**Features** +**Donations** -* System size ~ 90 - 170MB -* Minimal hardware requirements -* Ultra fast boot -* Simple configuration via Kodi itself -* Plug and Play external storage +Contributions towards current project funding goals can be sent via PayPal to donations@libreelec.tv -**Software** - -* Kodi HTPC software – View/Manage all your media. -* Samba server – File transfer from any PC client -* SSH server – Remote console access for debugging -* IR/Bluetooth Remote Control - -**Notes** - -* SSH login details are user: “root” password: “openelec”. - SSH allows command line access to your openelec.tv machine for configuration - and file transfer. Linux/Mac clients can natively use SSH, while Windows - users might want to try PuTTY for their terminal access. -* $HOME is mounted on /storage (the second ext4 partition on the drive). - All data transfered to the machine will go here, the rest of the system is - read-only with the exception of /var (containing runtime configuration data). -* Manual update/downgrade procedure is as follows: - Copy the snapshot (.tar) to the 'Update' network share (or /storage/.update) on - your openelec machine. Your system will automatically upgrade during the - next reboot. -* Automatic mounting of filesystems is supported. Devices such as USB Flash - sticks can be plugged into a running machine and will be mounted to /media, - showing up in Kodi’s GUI. -* Comments and questions are more than welcome, help is even better and patches - are absolutely perfect!! +**License** -**Questions/Support** +LibreELEC original code is released under [GPLv2](http://www.gnu.org/licenses/gpl-2.0.html). -* Forums on [http://openelec.tv](http://openelec.tv) -* IRC chatroom **#openelec** on Freenode +**Copyright** -**Happy OpenELEC'ing** +As LibreELEC includes code from many upstream projects it includes many copyright owners. LibreELEC makes NO claim of copyright on any upstream code. However all original LibreELEC authored code is copyright LibreELEC.tv. For a complete copyright list please checkout the source code to examine license headers. Unless expressly stated otherwise all code submitted to the LibreELEC project (in any form) is licensed under [GPLv2](http://www.gnu.org/licenses/gpl-2.0.html) and copyright is donated to LibreELEC.tv. This approach allows the project to stay manageable in the long term by giving us freedom to maintain the code as part of the whole without the management overhead of preserving contact with every submitter, e.g. GPLv3. You are absolutely free to retain copyright. To retain copyright simply add a copyright header to each submitted code page. If you submit code that is not your own work it is your responsibility to place a header stating the copyright. diff --git a/config/addon/xbmc.python.module.xml b/config/addon/xbmc.python.module.xml index bf92c7d1c2d..9fb497c03c0 100644 --- a/config/addon/xbmc.python.module.xml +++ b/config/addon/xbmc.python.module.xml @@ -4,7 +4,7 @@ version="@ADDON_VERSION@" provider-name="@PROVIDER_NAME@"> - + @REQUIRES@ diff --git a/config/addon/xbmc.python.script.xml b/config/addon/xbmc.python.script.xml index 1e91c01f806..132e36d8874 100644 --- a/config/addon/xbmc.python.script.xml +++ b/config/addon/xbmc.python.script.xml @@ -4,7 +4,7 @@ version="@ADDON_VERSION@" provider-name="@PROVIDER_NAME@"> - + @REQUIRES@ diff --git a/config/addon/xbmc.service.pluginsource.xml b/config/addon/xbmc.service.pluginsource.xml new file mode 100644 index 00000000000..754a131cdb8 --- /dev/null +++ b/config/addon/xbmc.service.pluginsource.xml @@ -0,0 +1,26 @@ + + + + + +@REQUIRES@ + + + @PKG_ADDON_PROVIDES@ + + + + + @PKG_SHORTDESC@ + +@PKG_LONGDESC@ + + +@PKG_DISCLAIMER@ + + all + + diff --git a/config/addon/xbmc.service.xml b/config/addon/xbmc.service.xml index 73dc0db2d21..7e706f6af4a 100644 --- a/config/addon/xbmc.service.xml +++ b/config/addon/xbmc.service.xml @@ -4,7 +4,7 @@ version="@ADDON_VERSION@" provider-name="@PROVIDER_NAME@"> - + @REQUIRES@ diff --git a/config/arch.aarch64 b/config/arch.aarch64 index bafee892fc3..f80ab571229 100644 --- a/config/arch.aarch64 +++ b/config/arch.aarch64 @@ -4,27 +4,13 @@ fi # TARGET_CPU: -# arm2 arm250 arm3 arm6 arm60 arm600 arm610 arm620 arm7 arm7m arm7d -# arm7dm arm7di arm7dmi arm70 arm700 arm700i arm710 arm710c arm7100 -# arm720 arm7500 arm7500fe arm7tdmi arm7tdmi-s arm710t arm720t -# arm740t strongarm strongarm110 strongarm1100 strongarm1110 arm8 -# arm810 arm9 arm9e arm920 arm920t arm922t arm946e-s arm966e-s -# arm968e-s arm926ej-s arm940t arm9tdmi arm10tdmi arm1020t -# arm1026ej-s arm10e arm1020e arm1022e arm1136j-s arm1136jf-s -# mpcore mpcorenovfp arm1156t2-s arm1156t2f-s arm1176jz-s -# arm1176jzf-s generic-armv7-a cortex-a5 cortex-a7 cortex-a8 -# cortex-a9 cortex-a12 cortex-a15 cortex-a17 cortex-a53 -# cortex-a57 cortex-a72 cortex-r4 cortex-r4f cortex-r5 cortex-r7 -# cortex-m7 cortex-m4 cortex-m3 cortex-m1 cortex-m0 cortex-m0plus -# cortex-m1.small-multiply cortex-m0.small-multiply -# cortex-m0plus.small-multiply exynos-m1 qdf24xx marvell-pj4 -# xscale iwmmxt iwmmxt2 ep9312 fa526 fa626 fa606te fa626te fmp626 -# fa726te xgene1 cortex-a15.cortex-a7 cortex-a17.cortex-a7 -# cortex-a57.cortex-a53 cortex-a72.cortex-a53 +# generic cortex-a35 cortex-a53 cortex-a57 cortex-a72 +# exynos-m1 qdf24xx thunderx xgene1 cortex-a57.cortex-a53 +# cortex-a72.cortex-a53 # determine architecture's family case $TARGET_CPU in - cortex-a53) + generic|cortex-a35|cortex-a53|cortex-a57|cortex-a72|exynos-m1|qdf24xx|thunderx|xgene1|cortex-a57.cortex-a53|cortex-a72.cortex-a53) TARGET_SUBARCH=aarch64 TARGET_VARIANT=armv8-a TARGET_ABI=eabi @@ -34,7 +20,7 @@ ;; esac - TARGET_GCC_ARCH=$(echo $TARGET_SUBARCH | sed -e "s,-,,") + TARGET_GCC_ARCH=${TARGET_SUBARCH/-} TARGET_KERNEL_ARCH=arm64 # setup ARCH specific *FLAGS diff --git a/config/arch.arm b/config/arch.arm index a80b42e0134..9c56274b210 100644 --- a/config/arch.arm +++ b/config/arch.arm @@ -31,7 +31,7 @@ TARGET_FPU_FLAGS="-mfloat-abi=$TARGET_FLOAT -mfpu=$TARGET_FPU" SIMD_SUPPORT="no" ;; - cortex-a7|cortex-a15) + cortex-a7|cortex-a15|cortex-a15.cortex-a7|cortex-a17.cortex-a7) TARGET_SUBARCH=armv7ve TARGET_ABI=eabi TARGET_EXTRA_FLAGS="-mcpu=$TARGET_CPU" @@ -47,7 +47,7 @@ ;; esac - TARGET_GCC_ARCH=$(echo $TARGET_SUBARCH | sed -e "s,-,,") + TARGET_GCC_ARCH=${TARGET_SUBARCH/-} TARGET_KERNEL_ARCH=arm # setup ARCH specific *FLAGS diff --git a/config/functions b/config/functions index 3449d585909..1c0983231fb 100644 --- a/config/functions +++ b/config/functions @@ -60,10 +60,10 @@ setup_toolchain() { } kernel_path() { - if [ -e $HOME/.openelec/projects/$PROJECT/packages/linux/package.mk ]; then - . $HOME/.openelec/projects/$PROJECT/packages/linux/package.mk - elif [ -e $HOME/.openelec/packages/linux/package.mk ]; then - . $HOME/.openelec/packages/linux/package.mk + if [ -e $HOME/.libreelec/projects/$PROJECT/packages/linux/package.mk ]; then + . $HOME/.libreelec/projects/$PROJECT/packages/linux/package.mk + elif [ -e $HOME/.libreelec/packages/linux/package.mk ]; then + . $HOME/.libreelec/packages/linux/package.mk elif [ -e $ROOT/projects/$PROJECT/packages/linux/package.mk ]; then . $ROOT/projects/$PROJECT/packages/linux/package.mk else @@ -74,10 +74,10 @@ kernel_path() { } kernel_version() { - if [ -e $HOME/.openelec/projects/$PROJECT/packages/linux/package.mk ]; then - . $HOME/.openelec/projects/$PROJECT/packages/linux/package.mk - elif [ -e $HOME/.openelec/packages/linux/package.mk ]; then - . $HOME/.openelec/packages/linux/package.mk + if [ -e $HOME/.libreelec/projects/$PROJECT/packages/linux/package.mk ]; then + . $HOME/.libreelec/projects/$PROJECT/packages/linux/package.mk + elif [ -e $HOME/.libreelec/packages/linux/package.mk ]; then + . $HOME/.libreelec/packages/linux/package.mk elif [ -e $ROOT/projects/$PROJECT/packages/linux/package.mk ]; then . $ROOT/projects/$PROJECT/packages/linux/package.mk else @@ -95,11 +95,11 @@ get_module_dir() { # get package's build dir get_build_dir() { if [ ! -z $1 ] ; then - local _PKG_DIR=$(find $HOME/.openelec/projects/$PROJECT/packages -name $1 2>/dev/null) + local _PKG_DIR=$(find $HOME/.libreelec/projects/$PROJECT/packages -name $1 2>/dev/null) if [ -d "$_PKG_DIR" -a -f $_PKG_DIR/package.mk ] ; then . $_PKG_DIR/package.mk else - local _PKG_DIR=$(find $HOME/.openelec/packages -name $1 2>/dev/null) + local _PKG_DIR=$(find $HOME/.libreelec/packages -name $1 2>/dev/null) if [ -d "$_PKG_DIR" -a -f $_PKG_DIR/package.mk ] ; then . $_PKG_DIR/package.mk else @@ -273,27 +273,28 @@ dashes="===========================" check_config() { dashes="===========================" - if [ ! -d $PROJECT_DIR/$PROJECT -a ! -d $HOME/.openelec/projects/$PROJECT ]; then + if [ ! -d $PROJECT_DIR/$PROJECT -a ! -d $HOME/.libreelec/projects/$PROJECT ]; then check_project="$check_project\n $dashes$dashes$dashes" check_project="$check_project\n ERROR: Project not found, use a valid project or create a new config" check_project="$check_project\n $dashes$dashes$dashes" check_project="$check_project\n\n Valid projects:" - for projects in $PROJECT_DIR/* $HOME/.openelec/projects/*; do + for projects in $PROJECT_DIR/* $HOME/.libreelec/projects/*; do check_project="$check_project\n - $(basename $projects)" done echo -e $check_project exit 1 fi - if [ ! -f $PROJECT_DIR/$PROJECT/linux/linux.$TARGET_ARCH.conf -a ! -f $HOME/.openelec/projects/$PROJECT/linux/linux.$TARGET_ARCH.conf ]; then + if [ ! -f $PROJECT_DIR/$PROJECT/linux/linux.$TARGET_ARCH.conf -a ! -f $HOME/.libreelec/projects/$PROJECT/linux/linux.$TARGET_ARCH.conf ] && + ! ls $PROJECT_DIR/$PROJECT/linux/*/linux.$TARGET_ARCH.conf &>/dev/null; then check_arch="$check_arch\n $dashes$dashes$dashes" check_arch="$check_arch\n ERROR: Architecture not found, use a valid Architecture" check_arch="$check_arch\n for your project or create a new config" check_arch="$check_arch\n $dashes$dashes$dashes" check_arch="$check_arch\n\n Valid Architectures for your project: $PROJECT" - for arch in $PROJECT_DIR/$PROJECT/linux/*.conf $HOME/.openelec/projects/$PROJECT/linux/*.conf; do + for arch in $PROJECT_DIR/$PROJECT/linux/*.conf $HOME/.libreelec/projects/$PROJECT/linux/*.conf $PROJECT_DIR/$PROJECT/linux/*/linux.$TARGET_ARCH.conf; do check_arch="$check_arch\n - $(basename $arch | cut -f2 -d".")" done echo -e $check_arch @@ -393,6 +394,7 @@ show_config() { config_message="$config_message\n - SAMBA mounting support:\t\t $SAMBA_SUPPORT" config_message="$config_message\n - SAMBA server support:\t\t $SAMBA_SERVER" config_message="$config_message\n - SFTP server support:\t\t\t $SFTP_SERVER" + config_message="$config_message\n - OpenVPN support:\t\t\t $OPENVPN_SUPPORT" # OS configuration @@ -428,7 +430,6 @@ show_config() { config_message="$config_message\n $dashes$dashes" config_message="$config_message\n - Kodi version:\t\t\t $MEDIACENTER" - config_message="$config_message\n - Kodi include language files:\t\t $KODI_LANGUAGE_ADDONS" config_message="$config_message\n - Kodi nonfree support:\t\t $KODI_NONFREE_SUPPORT" config_message="$config_message\n - Kodi Blu-Ray support:\t\t $KODI_BLURAY_SUPPORT" if [ "$KODI_BLURAY_SUPPORT" = "yes" ] ; then @@ -462,3 +463,15 @@ show_config() { echo -e "$config_message" } + +# strip +debug_strip() { + if [ ! "$DEBUG" = yes ]; then + $STRIP `find $* -type f -executable 2>/dev/null` 2>/dev/null || : + fi +} + +# Use distribution functions if any +if [ -f "distributions/$DISTRO/config/functions" ]; then + . distributions/$DISTRO/config/functions +fi diff --git a/config/graphic b/config/graphic index 50421bd7e03..69d30a48f10 100644 --- a/config/graphic +++ b/config/graphic @@ -12,7 +12,7 @@ fi get_graphicdrivers() { if [ "$GRAPHIC_DRIVERS" = "all" ]; then - GRAPHIC_DRIVERS="i915 i965 r200 r300 r600 nvidia" + GRAPHIC_DRIVERS="i915 i965 r200 r300 r600 nvidia vmware virtualbox" fi for drv in $GRAPHIC_DRIVERS; do @@ -70,5 +70,17 @@ get_graphicdrivers() { VDPAU_SUPPORT="yes" fi + if [ "$drv" = "virtualbox" ]; then + DRI_DRIVERS="$DRI_DRIVERS,swrast" + XORG_DRIVERS="$XORG_DRIVERS virtualbox" + fi + + if [ "$drv" = "vmware" ]; then + DRI_DRIVERS="$DRI_DRIVERS,swrast" + GALLIUM_DRIVERS="$GALLIUM_DRIVERS,svga" + XORG_DRIVERS="$XORG_DRIVERS vmware" +# LLVM_SUPPORT="yes" + fi + done } diff --git a/config/noobs/marketing/slides/A.png b/config/noobs/marketing/slides/A.png index c78193fd6a5..0925fbdff8a 100644 Binary files a/config/noobs/marketing/slides/A.png and b/config/noobs/marketing/slides/A.png differ diff --git a/config/noobs/marketing/slides/B.png b/config/noobs/marketing/slides/B.png index 2bb42c2c977..b9266a9f2b6 100644 Binary files a/config/noobs/marketing/slides/B.png and b/config/noobs/marketing/slides/B.png differ diff --git a/config/noobs/marketing/slides/C.png b/config/noobs/marketing/slides/C.png index b5cce6ca954..2882069a801 100644 Binary files a/config/noobs/marketing/slides/C.png and b/config/noobs/marketing/slides/C.png differ diff --git a/config/noobs/marketing/slides/D.png b/config/noobs/marketing/slides/D.png index d954fb4941a..f06b06993a1 100644 Binary files a/config/noobs/marketing/slides/D.png and b/config/noobs/marketing/slides/D.png differ diff --git a/config/noobs/marketing/slides/E.png b/config/noobs/marketing/slides/E.png index 3c106edd9e7..a993980af42 100644 Binary files a/config/noobs/marketing/slides/E.png and b/config/noobs/marketing/slides/E.png differ diff --git a/config/noobs/marketing/slides/noobs.psd b/config/noobs/marketing/slides/noobs.psd new file mode 100644 index 00000000000..2e1e7eb69e9 Binary files /dev/null and b/config/noobs/marketing/slides/noobs.psd differ diff --git a/config/noobs/marketing/slides/slides.xcf b/config/noobs/marketing/slides/slides.xcf deleted file mode 100644 index 2767251e38e..00000000000 Binary files a/config/noobs/marketing/slides/slides.xcf and /dev/null differ diff --git a/config/noobs/marketing/slides_vga/A.png b/config/noobs/marketing/slides_vga/A.png index b7e7670efa1..40b96b3a69d 100644 Binary files a/config/noobs/marketing/slides_vga/A.png and b/config/noobs/marketing/slides_vga/A.png differ diff --git a/config/noobs/marketing/slides_vga/B.png b/config/noobs/marketing/slides_vga/B.png index 9c879f1e86b..d6657d3f5b2 100644 Binary files a/config/noobs/marketing/slides_vga/B.png and b/config/noobs/marketing/slides_vga/B.png differ diff --git a/config/noobs/marketing/slides_vga/C.png b/config/noobs/marketing/slides_vga/C.png index 2f637759bd0..ae61c976a56 100644 Binary files a/config/noobs/marketing/slides_vga/C.png and b/config/noobs/marketing/slides_vga/C.png differ diff --git a/config/noobs/marketing/slides_vga/D.png b/config/noobs/marketing/slides_vga/D.png index d0d46ff5dda..50110992c15 100644 Binary files a/config/noobs/marketing/slides_vga/D.png and b/config/noobs/marketing/slides_vga/D.png differ diff --git a/config/noobs/marketing/slides_vga/E.png b/config/noobs/marketing/slides_vga/E.png index fdc79db48d9..c06548a09c3 100644 Binary files a/config/noobs/marketing/slides_vga/E.png and b/config/noobs/marketing/slides_vga/E.png differ diff --git a/config/noobs/marketing/slides_vga/noobs_vga.psd b/config/noobs/marketing/slides_vga/noobs_vga.psd new file mode 100644 index 00000000000..22820db05a1 Binary files /dev/null and b/config/noobs/marketing/slides_vga/noobs_vga.psd differ diff --git a/config/noobs/marketing/slides_vga/slides_vga.xcf b/config/noobs/marketing/slides_vga/slides_vga.xcf deleted file mode 100644 index 65d59e13f45..00000000000 Binary files a/config/noobs/marketing/slides_vga/slides_vga.xcf and /dev/null differ diff --git a/config/noobs/os.json b/config/noobs/os.json index 321969778ec..fe3ebd04ace 100644 --- a/config/noobs/os.json +++ b/config/noobs/os.json @@ -1,6 +1,6 @@ { "name": "@DISTRONAME@_@PROJECT@", - "version": "@OPENELEC_VERSION@", + "version": "@LIBREELEC_VERSION@", "release_date": "@RELEASE_DATE@", "kernel": "@KERNEL_VERSION@", "description": "@DESCRIPTION@", diff --git a/config/noobs/partition_setup.sh b/config/noobs/partition_setup.sh index 3e9f465af15..35a6e7373ce 100755 --- a/config/noobs/partition_setup.sh +++ b/config/noobs/partition_setup.sh @@ -17,34 +17,32 @@ # along with OpenELEC. If not, see . ################################################################################ -MOUNTPOINT="/tmp/OpenELEC-System" +MOUNTPOINT="/tmp/LibreELEC-System" md5sumCheck() { ( cd $MOUNTPOINT echo "checking MD5: $1" md5sum -c $1.md5 if [ "$?" = "1" ]; then - echo "######################################################" - echo "# #" - echo "# OpenELEC failed md5 check - Installation will quit #" - echo "# #" - echo "# Your original download was probably corrupt. #" - echo "# Please visit www.openelec.tv and get another copy #" - echo "# #" - echo "######################################################" + echo "#######################################################" + echo "# #" + echo "# LibreELEC failed md5 check - Installation will quit #" + echo "# #" + echo "# Your original download was probably corrupt. #" + echo "# Please visit libreelec.tv and get another copy #" + echo "# #" + echo "#######################################################" exit 1 fi rm -rf $1.md5 ) } -if [ -z $part1 -o -z $part2 -o -z $id1 -o -z $id2 ]; then - echo "error: part1, part2, id1 or id2 not specified" +if [ -z $part1 -o -z $id1 ]; then + echo "error: part1 or id1 not specified" echo "actual values:" echo "part1:" $part1 - echo "part2:" $part2 echo "id1 :" $id1 - echo "id2 :" $id2 exit 1 fi @@ -60,7 +58,11 @@ fi # create bootloader configuration echo "creating bootloader configuration..." - echo "boot=$id1 disk=$id2 quiet" > $MOUNTPOINT/cmdline.txt + echo "boot=$part1 disk=LABEL=SETTINGS quiet" > $MOUNTPOINT/cmdline.txt + cat /mnt/licenses.txt >> $MOUNTPOINT/config.txt + sed -i $MOUNTPOINT/config.txt -e s/MPEG2_LICENSE/decode_MPG2/ + sed -i $MOUNTPOINT/config.txt -e s/VC1_LICENSE/decode_WVC1/ + cp $MOUNTPOINT/dt-blob.bin.bak $MOUNTPOINT/dt-blob.bin # cleanup mountpoint umount $MOUNTPOINT diff --git a/config/noobs/partitions.json b/config/noobs/partitions.json index 95e0deb71d5..494cd0f2f05 100644 --- a/config/noobs/partitions.json +++ b/config/noobs/partitions.json @@ -3,17 +3,9 @@ { "label": "@DISTRONAME@_@PROJECT@_System", "filesystem_type": "FAT", - "partition_size_nominal": 512, + "partition_size_nominal": @SYSTEM_SIZE@, "want_maximised": false, - "uncompressed_tarball_size": 120, - "mkfs_options": "" - }, - { - "label": "@DISTRONAME@_@PROJECT@_Storage", - "filesystem_type": "ext4", - "partition_size_nominal": 512, - "want_maximised": true, - "uncompressed_tarball_size": 10, + "uncompressed_tarball_size": @TARBALL_SIZE@, "mkfs_options": "" } ] diff --git a/config/optimize b/config/optimize index 81d9566726d..a7bf24b5fe4 100644 --- a/config/optimize +++ b/config/optimize @@ -24,7 +24,7 @@ if [ "$DEBUG" = yes ]; then else TARGET_CFLAGS="$TARGET_CFLAGS -fomit-frame-pointer" TARGET_CXXFLAGS="$TARGET_CXXFLAGS -fomit-frame-pointer" - TARGET_LDFLAGS="$TARGET_LDFLAGS -s" + TARGET_LDFLAGS="$TARGET_LDFLAGS" fi TARGET_CPPFLAGS= diff --git a/config/options b/config/options index fcf47761f32..0dc30945475 100644 --- a/config/options +++ b/config/options @@ -2,9 +2,9 @@ export LC_ALL=C # determines DISTRO, if not forced by user -# default is OpenELEC +# default is LibreELEC if [ -z "$DISTRO" ]; then - DISTRO="OpenELEC" + DISTRO="LibreELEC" else DISTRO="$DISTRO" fi @@ -82,21 +82,21 @@ fi CCACHE_CACHE_SIZE="30G" # install devtools on development builds - if [ "$OPENELEC_VERSION" = "devel" ]; then + if [ "$LIBREELEC_VERSION" = "devel" ]; then DEVTOOLS=yes fi # read options from $HOME if available - if [ -f "$HOME/.openelec/options" ]; then - . $HOME/.openelec/options + if [ -f "$HOME/.libreelec/options" ]; then + . $HOME/.libreelec/options fi - if [ -f "$HOME/.openelec/projects/$PROJECT/options" ]; then - . $HOME/.openelec/projects/$PROJECT/options + if [ -f "$HOME/.libreelec/projects/$PROJECT/options" ]; then + . $HOME/.libreelec/projects/$PROJECT/options fi # read distro options from $HOME if available - if [ -f "$HOME/.openelec/options.$DISTRO" ]; then - . $HOME/.openelec/options.$DISTRO + if [ -f "$HOME/.libreelec/options.$DISTRO" ]; then + . $HOME/.libreelec/options.$DISTRO fi # overwrite OEM_SUPPORT via commandline diff --git a/config/path b/config/path index 59270310be3..7d160d4e1dc 100644 --- a/config/path +++ b/config/path @@ -17,11 +17,11 @@ set -e fi HOST_NAME=`$LOCAL_CC -dumpmachine` -TARGET_NAME=$TARGET_GCC_ARCH-openelec-linux-gnu${TARGET_ABI} +TARGET_NAME=$TARGET_GCC_ARCH-libreelec-linux-gnu${TARGET_ABI} -BUILD=$BUILD_BASE.$DISTRONAME-$PROJECT.$TARGET_ARCH-$OPENELEC_VERSION -if [ "$OPENELEC_VERSION" = "devel" ] ; then - BUILD=$BUILD_BASE.$DISTRONAME-$PROJECT.$TARGET_ARCH-$OS_VERSION-$OPENELEC_VERSION +BUILD=$BUILD_BASE.$DISTRONAME-$PROJECT.$TARGET_ARCH-$LIBREELEC_VERSION +if [ "$LIBREELEC_VERSION" = "devel" ] ; then + BUILD=$BUILD_BASE.$DISTRONAME-$PROJECT.$TARGET_ARCH-$OS_VERSION-$LIBREELEC_VERSION fi if [ -n "$BUILD_SUFFIX" ]; then @@ -61,6 +61,8 @@ SED="sed -i" PKG_LICENSE="unknown" PKG_SITE="" PKG_URL="" + PKG_SOURCE_NAME="" + PKG_SOURCE_DIR="" PKG_DEPENDS_TARGET="" PKG_DEPENDS_HOST="" PKG_DEPENDS_INIT="" @@ -78,7 +80,7 @@ SED="sed -i" PKG_DIR="" # check project folder for a package in home dir - for DIR in $(find $HOME/.openelec/projects/$PROJECT/packages -type d -name $_PKG_ROOT_NAME 2>/dev/null); do + for DIR in $(find $HOME/.libreelec/projects/$PROJECT/packages -type d -name $_PKG_ROOT_NAME 2>/dev/null); do if [ -r "$DIR/package.mk" ]; then # found first, set $PKG_DIR PKG_DIR="$DIR" @@ -95,7 +97,7 @@ SED="sed -i" done # check for a package in home dir if not found already - for DIR in $(find $HOME/.openelec/packages -type d -name $_PKG_ROOT_NAME 2>/dev/null); do + for DIR in $(find $HOME/.libreelec/packages -type d -name $_PKG_ROOT_NAME 2>/dev/null); do if [ -r "$DIR/package.mk" ]; then # found first, set $PKG_DIR PKG_DIR="$DIR" @@ -156,6 +158,38 @@ SED="sed -i" [ -z $PKG_SECTION ] && PKG_ADDON_ID="$PKG_NAME" || PKG_ADDON_ID="`echo $PKG_SECTION | sed 's,/,.,g'`.$PKG_NAME" fi + # Automatically set PKG_SOURCE_NAME unless it is already defined. + # PKG_SOURCE_NAME will be automatically set to a name based on + # the $PKG_NAME-$PKG_VERSION convention. + # + # Any $PKG_URL that references more than a single url will abort + # the build as these are no longer supported - use mkpkg instead. + if [ -n "$PKG_URL" -a -z "$PKG_SOURCE_NAME" ]; then + if [[ $PKG_URL =~ .*\ .* ]]; then + echo "Error - packages with multiple urls are no longer supported, use mkpkg:" + echo "$PKG_URL" + exit 1 + fi + PKG_SOURCE_NAME="$(basename "$PKG_URL")" + case $PKG_SOURCE_NAME in + ${PKG_NAME}-${PKG_VERSION}.*) + PKG_SOURCE_NAME=$PKG_SOURCE_NAME + ;; + *.tar | *.tbz | *.tgz | *.txz | *.7z | *.zip) + PKG_SOURCE_NAME=${PKG_NAME}-${PKG_VERSION}.${PKG_SOURCE_NAME##*\.} + ;; + *.tar.bz2 | *.tar.gz | *.tar.xz) + PKG_SOURCE_NAME=${PKG_NAME}-${PKG_VERSION}.tar.${PKG_SOURCE_NAME##*\.} + ;; + *.diff | *.patch | *.diff.bz2 | *.patch.bz2 | patch-*.bz2 | *.diff.gz | *.patch.gz | patch-*.gz) + PKG_SOURCE_NAME=$PKG_SOURCE_NAME + ;; + *) + PKG_SOURCE_NAME=${PKG_NAME}-${PKG_VERSION}.${PKG_SOURCE_NAME##*\.} + ;; + esac + fi + PKG_BUILD="$BUILD/${PKG_NAME}-${PKG_VERSION}" XORG_PATH_DRI=/usr/lib/dri @@ -165,8 +199,6 @@ XORG_PATH_RGB=/usr/lib/X11/rgb XORG_PATH_MODULES=/usr/lib/xorg/modules XORG_PATH_DRIVERS=/usr/lib/xorg/modules/drivers -SSL_CERTIFICATES="/etc/ssl" - TOOLCHAIN_LANGUAGES=c [ "$TOOLCHAIN_CXX" = yes ] && TOOLCHAIN_LANGUAGES=${TOOLCHAIN_LANGUAGES},c++ @@ -207,7 +239,7 @@ HOST_PKG_CONFIG_LIBDIR="$ROOT/$TOOLCHAIN/lib/pkgconfig:$ROOT/$TOOLCHAIN/share/pk HOST_PKG_CONFIG_SYSROOT_DIR="" if [ -z "$CCACHE_DIR" ]; then - export CCACHE_DIR=$HOME/.ccache-openelec + export CCACHE_DIR=$HOME/.ccache-libreelec fi export MAKEFLAGS=-j$CONCURRENCY_MAKE_LEVEL export PKG_CONFIG=$ROOT/$TOOLCHAIN/bin/pkg-config diff --git a/config/version b/config/version index f7d24d96c7a..d8201c33bfa 100644 --- a/config/version +++ b/config/version @@ -1,9 +1,9 @@ # VERSION: set full version, use "devel" for development version - OPENELEC_VERSION="devel" + LIBREELEC_VERSION="devel" # OS_VERSION: OS Version - OS_VERSION="7.0" + OS_VERSION="8.0" # ADDON_VERSION: Addon version - ADDON_VERSION="7.0" + ADDON_VERSION="8.0" diff --git a/distributions/LibreELEC/LibreELEC.png b/distributions/LibreELEC/LibreELEC.png new file mode 100644 index 00000000000..3646b20e80e Binary files /dev/null and b/distributions/LibreELEC/LibreELEC.png differ diff --git a/distributions/LibreELEC/LibreELEC_40x40.png b/distributions/LibreELEC/LibreELEC_40x40.png new file mode 100644 index 00000000000..503f2e15fcd Binary files /dev/null and b/distributions/LibreELEC/LibreELEC_40x40.png differ diff --git a/distributions/LibreELEC/options b/distributions/LibreELEC/options new file mode 100644 index 00000000000..e98cfc8b370 --- /dev/null +++ b/distributions/LibreELEC/options @@ -0,0 +1,208 @@ +# Name of the Distro to build (full name, without special characters) + DISTRONAME="LibreELEC" + +# short project description + DESCRIPTION="LibreELEC is a fast and user-friendly Kodi Entertainment Center distribution." + +# Welcome Message for e.g. SSH Server (up to 5 Lines) + GREETING0="##############################################" + GREETING1="# LibreELEC #" + GREETING2="# http://libreelec.tv #" + GREETING3="##############################################" + GREETING4="" + +# Root password to integrate in the target system + ROOT_PASSWORD="libreelec" + +# Install glibc locales to the build (yes / no) + GLIBC_LOCALES="yes" + +# Mediacenter to use (kodi / no) + MEDIACENTER="kodi" + +# Skins to install (Estuary) +# Space separated list is supported, +# e.g. SKINS="Estuary" + SKINS="Estuary" + +# Default Skin (Estuary) + SKIN_DEFAULT="Estuary" + +# install extra subtitle Fonts for KODI (yes / no) + KODI_EXTRA_FONTS="yes" + +# build and install PulseAudio support (yes / no) + PULSEAUDIO_SUPPORT="yes" + +# build and install espeak support (yes / no) + ESPEAK_SUPPORT="yes" + +# build and install with non-free support +# (RAR compression support in KODI) (yes / no) + KODI_NONFREE_SUPPORT="yes" + +# build and install with BluRay support (yes / no) + KODI_BLURAY_SUPPORT="yes" + +# build and install with BD+ support +# (BD+ decryption support in KODI) (yes / no) + BLURAY_BDPLUS_SUPPORT="yes" + +# build and install with AACS support +# (BD decryption support in KODI) (yes / no) + BLURAY_AACS_SUPPORT="yes" + +# build and install with DVDCSS support +# (DVD decryption support in KODI) (yes / no) + KODI_DVDCSS_SUPPORT="yes" + +# additional drivers to install: +# for a list of additinoal drivers see packages/linux-drivers +# Space separated list is supported, +# e.g. ADDITIONAL_DRIVERS="DRIVER1 DRIVER2" + ADDITIONAL_DRIVERS="RTL8192CU RTL8192DU RTL8192EU RTL8188EU RTL8812AU" + +# build and install bluetooth support (yes / no) + BLUETOOTH_SUPPORT="yes" + +# build and install with KODI webfrontend (yes / no) + KODI_WEBSERVER_SUPPORT="yes" + +# build and install Avahi (Zeroconf) daemon (yes / no) + AVAHI_DAEMON="yes" + +# build with UPnP support (yes / no) + KODI_UPNP_SUPPORT="yes" + +# build with MySQL support (yes / no) + KODI_MYSQL_SUPPORT="yes" + +# build xbmc with sshlib support (yes / no) + KODI_SSHLIB_SUPPORT="yes" + +# build xbmc with optical drive support (yes / no) + KODI_OPTICAL_SUPPORT="yes" + +# build with AirPlay support (stream videos from iDevices to KODI) (yes / no) + KODI_AIRPLAY_SUPPORT="yes" + +# build with AirTunes support (stream music from iDevices to KODI) (yes / no) + KODI_AIRTUNES_SUPPORT="yes" + +# build with libnfs support (mounting nfs shares with KODI) (yes / no) + KODI_NFS_SUPPORT="yes" + +# build with Samba Client support (mounting SAMBA shares with KODI) (yes / no) + KODI_SAMBA_SUPPORT="yes" + +# build with NFS support (mounting nfs shares via the OS) (yes / no) + NFS_SUPPORT="yes" + +# build with Samba Client support (mounting samba shares via the OS) (yes / no) + SAMBA_SUPPORT="yes" + +# build and install Samba Server (yes / no) + SAMBA_SERVER="yes" + +# build and install SFTP Server (yes / no) + SFTP_SERVER="yes" + +# build and install OpenVPN support (yes / no) + OPENVPN_SUPPORT="yes" + +# build and install diskmounter support (udevil) +# this service provide auto mounting support for external drives in the +# mediacenter also automount internally drives at boottime via udev (yes / no) + UDEVIL="yes" + +# build and install exFAT fuse support (yes / no) + EXFAT="yes" + +# build and install NTFS-3G fuse support (yes / no) + NTFS3G="yes" + +# build and install hfs filesystem utilities (yes / no) + HFSTOOLS="yes" + +# Windowmanager to use (ratpoison / fluxbox / none) + WINDOWMANAGER="fluxbox" + +# Xorg Graphic drivers to use (all / i915,i965,r200,r300,r600,nvidia) +# Space separated list is supported, +# e.g. GRAPHIC_DRIVERS="i915 i965 r300 r600 radeonsi nvidia" + GRAPHIC_DRIVERS="r300 r600 radeonsi i915 i965 nvidia nvidia-legacy" + +# build and install remote support (yes / no) + REMOTE_SUPPORT="yes" + +# build and install ATV IR remote support (yes / no) + ATVCLIENT_SUPPORT="yes" + +# build and install IRServer IR/LCD support (yes / no) + IRSERVER_SUPPORT="yes" + +# build and install Joystick support (yes / no) + JOYSTICK_SUPPORT="yes" + +# build and install CEC adapter support (yes / no) + CEC_SUPPORT="yes" + +# build and install iSCSI support - iscsistart (yes / no) + ISCSI_SUPPORT="yes" + +# LCD driver to Use - Possible drivers are ( Comma seperated: +# bayrad,CFontz,CFontz633,CFontzPacket,curses,CwLnx,dm140, +# ea65,EyeboxOne,g15,glcd,glcdlib,glk,hd44780,i2500vfd, +# icp_a106,imon,imonlcd,IOWarrior,irman,irtrans, +# joy,lb216,lcdm001,lcterm,lirc,lis,MD8800,mdm166a, +# ms6931,mtc_s16209x,MtxOrb,mx5000,NoritakeVFD, +# picolcd,pyramid,sed1330,sed1520,serialPOS, +# serialVFD,shuttleVFD,sli,stv5730,SureElec,svga,vlsys_m428 +# 'all' compiles all drivers; +# 'all,!xxx,!yyy' de-selects previously selected drivers +# "none" for disable LCD support + LCD_DRIVER="irtrans,imon,imonlcd,mdm166a,MtxOrb,lis,dm140,hd44780,CFontz,SureElec,vlsys_m428,serialVFD,shuttleVFD" + +# Support for partitioning and formating disks in initramfs (yes / no) +# This adds support for parted and mkfs.ext3/4 to initramfs for OEM usage + INITRAMFS_PARTED_SUPPORT="no" + +# build with swap support (yes / no) + SWAP_SUPPORT="no" + +# swap support enabled per default (yes / no) + SWAP_ENABLED_DEFAULT="no" + +# swapfile size if SWAP_SUPPORT=yes in MB + SWAPFILESIZE="256" + +# build with installer (yes / no) + INSTALLER_SUPPORT="yes" + +# Testpackages for development (yes / no) + TESTING="no" + +# OEM packages for OEM's (yes / no) + OEM_SUPPORT="no" + +# build and install nano text editor (yes / no) + NANO_EDITOR="yes" + +# cron support (yes / no) + CRON_SUPPORT="yes" + +# Distribution Specific source location + DISTRO_MIRROR="http://sources.libreelec.tv/mirror" + DISTRO_SRC="http://sources.libreelec.tv/$LIBREELEC_VERSION" + +# Addon Server Url + ADDON_SERVER_URL="http://addons.libreelec.tv" + +# set the addon dirs + ADDON_PATH="$ADDON_VERSION/$PROJECT/$TARGET_ARCH" + ADDON_URL="$ADDON_SERVER_URL/$ADDON_PATH" + +# Default size of system partition, in MB, eg. 512 + SYSTEM_SIZE=512 +# Default system partition offset, in sectors, eg. 2048 + SYSTEM_PART_START=2048 diff --git a/distributions/LibreELEC/splash/splash-1080.png b/distributions/LibreELEC/splash/splash-1080.png new file mode 100644 index 00000000000..7823713e17c Binary files /dev/null and b/distributions/LibreELEC/splash/splash-1080.png differ diff --git a/distributions/LibreELEC/splash/splash-1200.png b/distributions/LibreELEC/splash/splash-1200.png new file mode 100644 index 00000000000..fbce8432932 Binary files /dev/null and b/distributions/LibreELEC/splash/splash-1200.png differ diff --git a/distributions/LibreELEC/splash/splash-2160.png b/distributions/LibreELEC/splash/splash-2160.png new file mode 100644 index 00000000000..63ab150257f Binary files /dev/null and b/distributions/LibreELEC/splash/splash-2160.png differ diff --git a/distributions/LibreELEC/splash/splash-720.png b/distributions/LibreELEC/splash/splash-720.png new file mode 100644 index 00000000000..d213ad87101 Binary files /dev/null and b/distributions/LibreELEC/splash/splash-720.png differ diff --git a/distributions/LibreELEC/splash/splash-768.png b/distributions/LibreELEC/splash/splash-768.png new file mode 100644 index 00000000000..47a07721be3 Binary files /dev/null and b/distributions/LibreELEC/splash/splash-768.png differ diff --git a/distributions/OpenELEC/OpenELEC.png b/distributions/OpenELEC/OpenELEC.png deleted file mode 100644 index 6a448a0a20d..00000000000 Binary files a/distributions/OpenELEC/OpenELEC.png and /dev/null differ diff --git a/distributions/OpenELEC/splash/splash-1024.png b/distributions/OpenELEC/splash/splash-1024.png deleted file mode 100644 index 1bc7efd8fa0..00000000000 Binary files a/distributions/OpenELEC/splash/splash-1024.png and /dev/null differ diff --git a/distributions/OpenELEC/splash/splash-full.png b/distributions/OpenELEC/splash/splash-full.png deleted file mode 100644 index e7330e728e8..00000000000 Binary files a/distributions/OpenELEC/splash/splash-full.png and /dev/null differ diff --git a/distributions/Slice/Slice.png b/distributions/Slice/Slice.png new file mode 100644 index 00000000000..643978b011f Binary files /dev/null and b/distributions/Slice/Slice.png differ diff --git a/distributions/Slice/config/config.txt b/distributions/Slice/config/config.txt new file mode 100644 index 00000000000..4ad659784e2 --- /dev/null +++ b/distributions/Slice/config/config.txt @@ -0,0 +1,112 @@ +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) +# Inspired and partly copied from: +# http://youresuchageek.blogspot.fr/2012/09/howto-raspberry-pi-openelec-on.html +# +# OpenELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# OpenELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with OpenELEC. If not, see . +################################################################################ +# Bootloader configuration - config.txt +################################################################################ + +################################################################################ +# Memory (System/GPU configuration ) +################################################################################ + +# default GPU memory split (do not change if you do not know what you are doing) + gpu_mem=128 + +# SDRAM size based GPU memory split, uncomment and setup to override 'gpu_mem' + gpu_mem_256=112 + gpu_mem_512=160 + gpu_mem_1024=256 + +################################################################################ +# Overclocking settings +# WARNING: Do not change/enable if you do not know what you are doing! +# The System may become unstable or you can have data corruption or +# you can loose your warranty if you set wrong settings +# +# please read: http://elinux.org/RPi_config.txt#Overclocking_configuration +################################################################################ + +# Overclock mode settings. +# +# default recommended values are: arm_freq | core_freq | sdram_freq | over_voltage +# no overclocking : 700 | 250 | 400 | 0 +# mode 'Modest' : 800 | 300 | 400 | 0 +# mode 'Medium' : 900 | 333 | 450 | 2 +# mode 'High' : 950 | 450 | 450 | 6 +# mode 'Turbo' : 1000 | 500 | 500 | 6 + +arm_freq=900 +core_freq=300 +sdram_freq=450 +over_voltage=4 + +# set to 'force_turbo=1' to disable dynamic overclocking (you can lose your warranty!) +force_turbo=1 + +# If you have any data corruption using Turbo Mode and overclocking +# try with this setting uncommented +# If this still fails, try to use Medium mode without "over_voltage=2" +# If it ultimately keeps failing, forget about this until it gets fixed +# Use a more conservative mode that will works fine in any cases: +# initial_turbo=30 + +################################################################################ +# Overscan settings +################################################################################ + +# Make display smaller to stop text spilling off the screen +# see also http://www.raspberrypi.org/phpBB3/viewtopic.php?f=67&t=15700 +# overscan_scale=1 +# disable_overscan=1 + +# Adapt overscan values to your needs +# overscan_left=57 +# overscan_right=59 +# overscan_top=20 +# overscan_bottom=20 + +################################################################################ +# various settings see also: http://elinux.org/RPi_config.txt +################################################################################ + +# Force HDMI even if unplugged or powered off +hdmi_force_hotplug=1 + +# Doesn't sent initial active source message. +# Avoids bringing CEC (enabled TV) out of standby and channel switch when +# rebooting. + hdmi_ignore_cec_init=1 + +################################################################################ +# License keys to enable GPU hardware decoding for various codecs +# to obtain keys visit the shop at http://www.raspberrypi.com +################################################################################ + +# decode_MPG2=0x00000000 +# decode_WVC1=0x00000000 +# decode_DTS=0x00000000 +# decode_DDP=0x00000000 + +################################################################################ +# End of default configuration +# all values below this line were inserted from config.txt.bk (your old config) +# and can be merged with the above values +################################################################################ + +dtoverlay=slice +dtoverlay=ws2812 diff --git a/distributions/Slice/config/dt-blob.dts b/distributions/Slice/config/dt-blob.dts new file mode 100644 index 00000000000..afbafdbdfe7 --- /dev/null +++ b/distributions/Slice/config/dt-blob.dts @@ -0,0 +1,102 @@ +/dts-v1/; + +/ { + videocore { + + pins_cm { + + pin_config { + + pin@default { + polarity = "active_high"; + termination = "pull_down"; + startup_state = "inactive"; + function = "input"; + }; // pin + + // BANK 0 // + pin@p0 { function = "input"; termination = "pull_up"; }; // NOT USED (DEFAULT STATE) + pin@p1 { function = "input"; termination = "pull_up"; }; // NOT USED (DEFAULT STATE) + pin@p2 { function = "input"; termination = "pull_up"; }; // NOT USED (DEFAULT STATE) + pin@p3 { function = "input"; termination = "pull_up"; }; // NOT USED (DEFAULT STATE) + pin@p4 { function = "input"; termination = "pull_up"; }; // NOT USED (DEFAULT STATE) + pin@p5 { function = "input"; termination = "pull_up"; }; // NOT USED (DEFAULT STATE) + pin@p6 { function = "input"; termination = "pull_up"; }; // NOT USED (DEFAULT STATE) + pin@p7 { function = "input"; termination = "pull_up"; }; // NOT USED (DEFAULT STATE) + pin@p8 { function = "input"; termination = "pull_up"; }; // NOT USED (DEFAULT STATE) + pin@p9 { function = "input"; termination = "pull_down"; }; // NOT USED (DEFAULT STATE) + pin@p10 { function = "input"; termination = "pull_down"; }; // NOT USED (DEFAULT STATE) + pin@p11 { function = "input"; termination = "pull_down"; }; // NOT USED (DEFAULT STATE) + pin@p12 { function = "input"; termination = "pull_down"; }; // NOT USED (DEFAULT STATE) + pin@p13 { function = "input"; termination = "pull_down"; }; // NOT USED (DEFAULT STATE) + pin@p14 { function = "uart0"; termination = "no_pulling"; }; // UART0_TX + pin@p15 { function = "uart0"; termination = "pull_up"; }; // UART0_RX + pin@p16 { function = "input"; termination = "pull_down"; }; // NOT USED (DEFAULT STATE) + pin@p17 { function = "input"; termination = "pull_down"; }; // NOT USED (DEFAULT STATE) + pin@p18 { function = "input"; termination = "pull_down"; }; // NOT USED (DEFAULT STATE) + pin@p19 { function = "input"; termination = "pull_down"; }; // NOT USED (DEFAULT STATE) + pin@p20 { function = "input"; termination = "pull_down"; }; // NOT USED (DEFAULT STATE) + pin@p21 { function = "input"; termination = "pull_down"; }; // NOT USED (DEFAULT STATE) + pin@p22 { function = "input"; termination = "pull_down"; }; // NOT USED (DEFAULT STATE) + pin@p23 { function = "input"; termination = "pull_down"; }; // NOT USED (DEFAULT STATE) + pin@p24 { function = "input"; termination = "pull_down"; }; // NOT USED (DEFAULT STATE) + pin@p25 { function = "input"; termination = "pull_down"; }; // NOT USED (DEFAULT STATE) + pin@p26 { function = "input"; termination = "pull_down"; }; // NOT USED (DEFAULT STATE) + pin@p27 { function = "input"; termination = "pull_down"; }; // NOT USED (DEFAULT STATE) + + // BANK 1 // + pin@p28 { function = "pcm"; termination = "no_pulling"; }; // PCM_CLK + pin@p29 { function = "pcm"; termination = "no_pulling"; }; // PCM_FS + pin@p30 { function = "pcm"; termination = "no_pulling"; }; // PCM_DIN + pin@p31 { function = "pcm"; termination = "no_pulling"; }; // PCM_DOUT + pin@p32 { function = "gp_clk"; termination = "no_pulling"; }; // PCM_MCLK (GPCLK0) + pin@p33 { function = "output"; termination = "no_pulling"; polarity = "active_low"; startup_state = "inactive"; }; // AUD_RST_N + pin@p34 { function = "input"; termination = "pull_up"; }; // NOT USED + pin@p35 { function = "output"; termination = "no_pulling"; polarity = "active_high"; startup_state = "active"; }; // USB_ON + pin@p36 { function = "input"; termination = "no_pulling"; }; // RTC_IRQ + pin@p37 { function = "input"; termination = "no_pulling"; }; // IR_RX + pin@p38 { function = "output"; termination = "no_pulling"; polarity = "active_high"; startup_state = "inactive"; }; // STBY_LED + pin@p39 { function = "output"; termination = "no_pulling"; polarity = "active_high"; startup_state = "inactive"; }; // DISK_OFF + pin@p40 { function = "pwm"; termination = "no_pulling"; }; // LED_PWM + pin@p41 { function = "output"; termination = "no_pulling"; }; // LAN_RUN + pin@p42 { function = "gp_clk"; termination = "no_pulling"; }; // ETH_CLK (GPCLK1) + pin@p43 { function = "output"; termination = "pull_down"; polarity = "active_high"; startup_state = "inactive"; }; // LEDS_ON + pin@p44 { function = "i2c1"; termination = "no_pulling"; }; // SDA1 + pin@p45 { function = "i2c1"; termination = "no_pulling"; }; // SCL1 + + // BANK 2 // + pin@p46 { function = "input"; termination = "no_pulling"; drive_strength_mA = <8>; polarity = "active_high"; }; // HPD_N + pin@p47 { function = "output"; termination = "no_pulling"; drive_strength_mA = <8>; polarity = "active_low"; startup_state = "active"; }; // EMMC_DISABLE_N CONTROL + pin@p48 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = <8>; }; // SD CLK + pin@p49 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = <8>; }; // SD CMD + pin@p50 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = <8>; }; // SD D0 + pin@p51 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = <8>; }; // SD D1 + pin@p52 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = <8>; }; // SD D2 + pin@p53 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = <8>; }; // SD D3 + + }; // pin_config + + pin_defines { + pin_define@HDMI_CONTROL_ATTACHED { type = "internal"; number = <46>; }; // HPD_N on GPIO46 + pin_define@LAN_RUN { type = "internal"; number = <41>; }; // LAN_RUN + }; // pin_defines + + }; // pins_cm + + clock_routing { + vco@PLLA { freq = <1806336000>; }; // 1.806336GHz + chan@APER { div = <2>; }; + clock@GPCLK0 { pll = "PLLA"; chan = "APER"; }; + clock@H264 { pll = "PLLC"; chan = "CCORE0"; }; + clock@ISP { pll = "PLLC"; chan = "CCORE0"; }; + clock@V3D { pll = "PLLC"; chan = "CCORE0"; }; + }; // clock_routing + + clock_setup { + clock@PWM { freq = < 2400000>; }; // LEDS PWM CLOCK + clock@GPCLK0 { freq = <12288000>; }; // PCM_MCLK + clock@GPCLK1 { freq = <25000000>; }; // ETH_CLK + }; // clock_setup + + }; // videocore +}; diff --git a/distributions/Slice/noobs/marketing/slides/A.png b/distributions/Slice/noobs/marketing/slides/A.png new file mode 100644 index 00000000000..02e9181873f Binary files /dev/null and b/distributions/Slice/noobs/marketing/slides/A.png differ diff --git a/distributions/Slice/noobs/marketing/slides/B.png b/distributions/Slice/noobs/marketing/slides/B.png new file mode 100644 index 00000000000..5c6da5ec727 Binary files /dev/null and b/distributions/Slice/noobs/marketing/slides/B.png differ diff --git a/distributions/Slice/noobs/marketing/slides/C.png b/distributions/Slice/noobs/marketing/slides/C.png new file mode 100644 index 00000000000..564fb5bc8d9 Binary files /dev/null and b/distributions/Slice/noobs/marketing/slides/C.png differ diff --git a/distributions/Slice/noobs/marketing/slides/D.png b/distributions/Slice/noobs/marketing/slides/D.png new file mode 100644 index 00000000000..68ff3faa811 Binary files /dev/null and b/distributions/Slice/noobs/marketing/slides/D.png differ diff --git a/distributions/Slice/noobs/marketing/slides/E.png b/distributions/Slice/noobs/marketing/slides/E.png new file mode 100644 index 00000000000..5ae8e886dd7 Binary files /dev/null and b/distributions/Slice/noobs/marketing/slides/E.png differ diff --git a/distributions/Slice/noobs/marketing/slides/F.png b/distributions/Slice/noobs/marketing/slides/F.png new file mode 100644 index 00000000000..72761c03cf6 Binary files /dev/null and b/distributions/Slice/noobs/marketing/slides/F.png differ diff --git a/distributions/Slice/noobs/marketing/slides_vga/A.png b/distributions/Slice/noobs/marketing/slides_vga/A.png new file mode 100644 index 00000000000..00ed01776b9 Binary files /dev/null and b/distributions/Slice/noobs/marketing/slides_vga/A.png differ diff --git a/distributions/Slice/noobs/marketing/slides_vga/B.png b/distributions/Slice/noobs/marketing/slides_vga/B.png new file mode 100644 index 00000000000..aef23107df2 Binary files /dev/null and b/distributions/Slice/noobs/marketing/slides_vga/B.png differ diff --git a/distributions/Slice/noobs/marketing/slides_vga/C.png b/distributions/Slice/noobs/marketing/slides_vga/C.png new file mode 100644 index 00000000000..88c003cad05 Binary files /dev/null and b/distributions/Slice/noobs/marketing/slides_vga/C.png differ diff --git a/distributions/Slice/noobs/marketing/slides_vga/D.png b/distributions/Slice/noobs/marketing/slides_vga/D.png new file mode 100644 index 00000000000..db5dcaed821 Binary files /dev/null and b/distributions/Slice/noobs/marketing/slides_vga/D.png differ diff --git a/distributions/Slice/noobs/marketing/slides_vga/E.png b/distributions/Slice/noobs/marketing/slides_vga/E.png new file mode 100644 index 00000000000..7c11507a641 Binary files /dev/null and b/distributions/Slice/noobs/marketing/slides_vga/E.png differ diff --git a/distributions/Slice/noobs/marketing/slides_vga/F.png b/distributions/Slice/noobs/marketing/slides_vga/F.png new file mode 100644 index 00000000000..a716ed2d4c1 Binary files /dev/null and b/distributions/Slice/noobs/marketing/slides_vga/F.png differ diff --git a/distributions/OpenELEC/options b/distributions/Slice/options similarity index 88% rename from distributions/OpenELEC/options rename to distributions/Slice/options index 298f1e69a45..961a4b03419 100644 --- a/distributions/OpenELEC/options +++ b/distributions/Slice/options @@ -1,13 +1,13 @@ # Name of the Distro to build (full name, without special characters) - DISTRONAME="OpenELEC" + DISTRONAME="Slice" # short project description - DESCRIPTION="OpenELEC is a fast and user-friendly Kodi Entertainment Center distribution." + DESCRIPTION="Slice is a distribution of Kodi based on the LibreELEC.tv" # Welcome Message for e.g. SSH Server (up to 5 Lines) GREETING0="##############################################" - GREETING1="# OpenELEC #" - GREETING2="# http://openelec.tv #" + GREETING1="# LibreELEC #" + GREETING2="# http://libreelec.tv #" GREETING3="##############################################" GREETING4="" @@ -23,10 +23,10 @@ # Skins to install (Confluence) # Space separated list is supported, # e.g. SKINS="Confluence" - SKINS="Confluence" + SKINS="Estuary" # Default Skin (Confluence) - SKIN_DEFAULT="Confluence" + SKIN_DEFAULT="Estuary" # install extra subtitle Fonts for KODI (yes / no) KODI_EXTRA_FONTS="yes" @@ -60,7 +60,7 @@ # for a list of additinoal drivers see packages/linux-drivers # Space separated list is supported, # e.g. ADDITIONAL_DRIVERS="DRIVER1 DRIVER2" - ADDITIONAL_DRIVERS="RTL8192CU RTL8192DU RTL8192EU RTL8188EU RTL8812AU dvbhdhomerun" + ADDITIONAL_DRIVERS="RTL8192CU RTL8192DU RTL8192EU RTL8188EU RTL8812AU" # build and install bluetooth support (yes / no) BLUETOOTH_SUPPORT="yes" @@ -110,6 +110,9 @@ # build and install SFTP Server (yes / no) SFTP_SERVER="yes" +# build and install OpenVPN support (yes / no) + OPENVPN_SUPPORT="yes" + # build and install diskmounter support (udevil) # this service provide auto mounting support for external drives in the # mediacenter also automount internally drives at boottime via udev (yes / no) @@ -192,12 +195,18 @@ CRON_SUPPORT="yes" # Distribution Specific source location - DISTRO_MIRROR="http://sources.openelec.tv/mirror" - DISTRO_SRC="http://sources.openelec.tv/$OPENELEC_VERSION" + DISTRO_MIRROR="http://sources.libreelec.tv/mirror" + DISTRO_SRC="http://sources.libreelec.tv/$LIBREELEC_VERSION" # Addon Server Url - ADDON_SERVER_URL="http://addons.openelec.tv" + ADDON_SERVER_URL="http://addons.libreelec.tv" # set the addon dirs - ADDON_PATH="$ADDON_VERSION/$PROJECT/$TARGET_ARCH" + ADDON_PATH="$ADDON_VERSION/RPi/$TARGET_ARCH" ADDON_URL="$ADDON_SERVER_URL/$ADDON_PATH" + +# Default size of system partition, in MB, eg. 512 + SYSTEM_SIZE=512 +# Default system partition offset, in sectors, eg. 2048 + SYSTEM_PART_START=2048 + diff --git a/distributions/Slice/splash/splash-1024.png b/distributions/Slice/splash/splash-1024.png new file mode 100644 index 00000000000..a40ba0e9eaf Binary files /dev/null and b/distributions/Slice/splash/splash-1024.png differ diff --git a/distributions/Slice/splash/splash-full.png b/distributions/Slice/splash/splash-full.png new file mode 100644 index 00000000000..78e1d7c2be8 Binary files /dev/null and b/distributions/Slice/splash/splash-full.png differ diff --git a/distributions/Slice2/Slice.png b/distributions/Slice2/Slice.png new file mode 100644 index 00000000000..643978b011f Binary files /dev/null and b/distributions/Slice2/Slice.png differ diff --git a/distributions/Slice2/config/config.txt b/distributions/Slice2/config/config.txt new file mode 100644 index 00000000000..f7479f42feb --- /dev/null +++ b/distributions/Slice2/config/config.txt @@ -0,0 +1,106 @@ +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) +# Inspired and partly copied from: +# http://youresuchageek.blogspot.fr/2012/09/howto-raspberry-pi-openelec-on.html +# +# OpenELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# OpenELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with OpenELEC. If not, see . +################################################################################ +# Bootloader configuration - config.txt +################################################################################ + +################################################################################ +# Memory (System/GPU configuration ) +################################################################################ + +################################################################################ +# Overclocking settings +# WARNING: Do not change/enable if you do not know what you are doing! +# The System may become unstable or you can have data corruption or +# you can loose your warranty if you set wrong settings +# +# please read: http://elinux.org/RPi_config.txt#Overclocking_configuration +################################################################################ + +# Overclock mode settings. +# +# default recommended values are: arm_freq | core_freq | sdram_freq | over_voltage +# no overclocking : 700 | 250 | 400 | 0 +# mode 'Modest' : 800 | 300 | 400 | 0 +# mode 'Medium' : 900 | 333 | 450 | 2 +# mode 'High' : 950 | 450 | 450 | 6 +# mode 'Turbo' : 1000 | 500 | 500 | 6 + +#arm_freq=900 +#core_freq=300 +#sdram_freq=450 +#over_voltage=4 + +# set to 'force_turbo=1' to disable dynamic overclocking (you can lose your warranty!) +#force_turbo=1 + +# If you have any data corruption using Turbo Mode and overclocking +# try with this setting uncommented +# If this still fails, try to use Medium mode without "over_voltage=2" +# If it ultimately keeps failing, forget about this until it gets fixed +# Use a more conservative mode that will works fine in any cases: +# initial_turbo=30 + +################################################################################ +# Overscan settings +################################################################################ + +# Make display smaller to stop text spilling off the screen +# see also http://www.raspberrypi.org/phpBB3/viewtopic.php?f=67&t=15700 +# overscan_scale=1 +# disable_overscan=1 + +# Adapt overscan values to your needs +# overscan_left=57 +# overscan_right=59 +# overscan_top=20 +# overscan_bottom=20 + +################################################################################ +# various settings see also: http://elinux.org/RPi_config.txt +################################################################################ + +# Force HDMI even if unplugged or powered off +hdmi_force_hotplug=1 + +# Doesn't sent initial active source message. +# Avoids bringing CEC (enabled TV) out of standby and channel switch when +# rebooting. + hdmi_ignore_cec_init=1 + +################################################################################ +# License keys to enable GPU hardware decoding for various codecs +# to obtain keys visit the shop at http://www.raspberrypi.com +################################################################################ + +# decode_MPG2=0x00000000 +# decode_WVC1=0x00000000 +# decode_DTS=0x00000000 +# decode_DDP=0x00000000 + +################################################################################ +# End of default configuration +# all values below this line were inserted from config.txt.bk (your old config) +# and can be merged with the above values +################################################################################ + +dtoverlay=slice +dtoverlay=ws2812 +dtoverlay=mmc + diff --git a/distributions/Slice2/config/dt-blob.dts b/distributions/Slice2/config/dt-blob.dts new file mode 100644 index 00000000000..24f1aa8ff93 --- /dev/null +++ b/distributions/Slice2/config/dt-blob.dts @@ -0,0 +1,108 @@ +/dts-v1/; + +/ { + videocore { + + pins_cm3 { + + pin_config { + + pin@default { + polarity = "active_high"; + termination = "pull_down"; + startup_state = "inactive"; + function = "input"; + }; // pin + + // BANK 0 // + pin@p0 { function = "input"; termination = "pull_up"; }; // NOT USED (DEFAULT STATE) + pin@p1 { function = "input"; termination = "pull_up"; }; // NOT USED (DEFAULT STATE) + pin@p2 { function = "input"; termination = "pull_up"; }; // NOT USED (DEFAULT STATE) + pin@p3 { function = "input"; termination = "pull_up"; }; // NOT USED (DEFAULT STATE) + pin@p4 { function = "input"; termination = "pull_up"; }; // NOT USED (DEFAULT STATE) + pin@p5 { function = "input"; termination = "pull_up"; }; // NOT USED (DEFAULT STATE) + pin@p6 { function = "input"; termination = "pull_up"; }; // NOT USED (DEFAULT STATE) + pin@p7 { function = "input"; termination = "pull_up"; }; // NOT USED (DEFAULT STATE) + pin@p8 { function = "input"; termination = "pull_up"; }; // NOT USED (DEFAULT STATE) + pin@p9 { function = "input"; termination = "pull_down"; }; // NOT USED (DEFAULT STATE) + pin@p10 { function = "input"; termination = "pull_down"; }; // NOT USED (DEFAULT STATE) + pin@p11 { function = "input"; termination = "pull_down"; }; // NOT USED (DEFAULT STATE) + pin@p12 { function = "input"; termination = "pull_down"; }; // NOT USED (DEFAULT STATE) + pin@p13 { function = "input"; termination = "pull_down"; }; // NOT USED (DEFAULT STATE) + pin@p14 { function = "uart0"; termination = "no_pulling"; }; // UART0_TX + pin@p15 { function = "uart0"; termination = "pull_up"; }; // UART0_RX + pin@p16 { function = "input"; termination = "pull_down"; }; // NOT USED (DEFAULT STATE) + pin@p17 { function = "input"; termination = "pull_down"; }; // NOT USED (DEFAULT STATE) + pin@p18 { function = "input"; termination = "pull_down"; }; // NOT USED (DEFAULT STATE) + pin@p19 { function = "input"; termination = "pull_down"; }; // NOT USED (DEFAULT STATE) + pin@p20 { function = "input"; termination = "pull_down"; }; // NOT USED (DEFAULT STATE) + pin@p21 { function = "input"; termination = "pull_down"; }; // NOT USED (DEFAULT STATE) + pin@p22 { function = "input"; termination = "pull_down"; }; // NOT USED (DEFAULT STATE) + pin@p23 { function = "input"; termination = "pull_down"; }; // NOT USED (DEFAULT STATE) + pin@p24 { function = "input"; termination = "pull_down"; }; // NOT USED (DEFAULT STATE) + pin@p25 { function = "input"; termination = "pull_down"; }; // NOT USED (DEFAULT STATE) + pin@p26 { function = "input"; termination = "pull_down"; }; // NOT USED (DEFAULT STATE) + pin@p27 { function = "input"; termination = "pull_down"; }; // NOT USED (DEFAULT STATE) + + // BANK 1 // + pin@p28 { function = "pcm"; termination = "no_pulling"; }; // PCM_CLK + pin@p29 { function = "pcm"; termination = "no_pulling"; }; // PCM_FS + pin@p30 { function = "pcm"; termination = "no_pulling"; }; // PCM_DIN + pin@p31 { function = "pcm"; termination = "no_pulling"; }; // PCM_DOUT + pin@p32 { function = "gp_clk"; termination = "no_pulling"; }; // PCM_MCLK (GPCLK0) + pin@p33 { function = "output"; termination = "no_pulling"; polarity = "active_low"; startup_state = "inactive"; }; // AUD_RST_N + pin@p34 { function = "input"; termination = "pull_up"; }; // NOT USED + pin@p35 { function = "output"; termination = "no_pulling"; polarity = "active_high"; startup_state = "active"; }; // USB_ON + pin@p36 { function = "input"; termination = "no_pulling"; }; // RTC_IRQ + pin@p37 { function = "input"; termination = "no_pulling"; }; // IR_RX + pin@p38 { function = "output"; termination = "no_pulling"; polarity = "active_high"; startup_state = "inactive"; }; // STBY_LED + pin@p39 { function = "output"; termination = "no_pulling"; polarity = "active_high"; startup_state = "inactive"; }; // DISK_OFF + pin@p40 { function = "pwm"; termination = "no_pulling"; }; // LED_PWM + pin@p41 { function = "output"; termination = "no_pulling"; }; // LAN_RUN + pin@p42 { function = "gp_clk"; termination = "no_pulling"; }; // ETH_CLK (GPCLK1) + pin@p43 { function = "output"; termination = "pull_down"; polarity = "active_high"; startup_state = "inactive"; }; // LEDS_ON + pin@p44 { function = "i2c1"; termination = "no_pulling"; }; // SDA1 + pin@p45 { function = "i2c1"; termination = "no_pulling"; }; // SCL1 + + // BANK 2 // + pin@p46 { function = "input"; termination = "pull_up"; }; // SMPS_SCL + pin@p47 { function = "input"; termination = "pull_up"; }; // SMPS_SDA + pin@p48 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = <8>; }; // SD CLK + pin@p49 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = <8>; }; // SD CMD + pin@p50 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = <8>; }; // SD D0 + pin@p51 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = <8>; }; // SD D1 + pin@p52 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = <8>; }; // SD D2 + pin@p53 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = <8>; }; // SD D3 + pin@p128 { function = "input"; termination = "no_pulling"; polarity = "active_low"; }; // Hotplug + pin@p129 { function = "output"; termination = "no_pulling"; polarity = "active_low"; }; // EMMC_ENABLE_N + + + }; // pin_config + + pin_defines { + pin_define@HDMI_CONTROL_ATTACHED { type = "external"; number = <0>; }; // HPD_N on external gpio + pin_define@LAN_RUN { type = "internal"; number = <41>; }; // LAN_RUN + pin_define@EMMC_ENABLE { type = "external"; number = <1>; }; + pin_define@SMPS_SDA { type = "internal"; number = <46>; }; + pin_define@SMPS_SCL { type = "internal"; number = <47>; }; + }; // pin_defines + + }; // pins_cm + + clock_routing { + vco@PLLA { freq = <1806336000>; }; // 1.806336GHz + chan@APER { div = <2>; }; + clock@GPCLK0 { pll = "PLLA"; chan = "APER"; }; + clock@H264 { pll = "PLLC"; chan = "CCORE0"; }; + clock@ISP { pll = "PLLC"; chan = "CCORE0"; }; + clock@V3D { pll = "PLLC"; chan = "CCORE0"; }; + }; // clock_routing + + clock_setup { + clock@PWM { freq = < 2400000>; }; // LEDS PWM CLOCK + clock@GPCLK0 { freq = <12288000>; }; // PCM_MCLK + clock@GPCLK1 { freq = <25000000>; }; // ETH_CLK + }; // clock_setup + + }; // videocore +}; diff --git a/distributions/Slice2/noobs/marketing/slides/A.png b/distributions/Slice2/noobs/marketing/slides/A.png new file mode 100644 index 00000000000..02e9181873f Binary files /dev/null and b/distributions/Slice2/noobs/marketing/slides/A.png differ diff --git a/distributions/Slice2/noobs/marketing/slides/B.png b/distributions/Slice2/noobs/marketing/slides/B.png new file mode 100644 index 00000000000..5c6da5ec727 Binary files /dev/null and b/distributions/Slice2/noobs/marketing/slides/B.png differ diff --git a/distributions/Slice2/noobs/marketing/slides/C.png b/distributions/Slice2/noobs/marketing/slides/C.png new file mode 100644 index 00000000000..564fb5bc8d9 Binary files /dev/null and b/distributions/Slice2/noobs/marketing/slides/C.png differ diff --git a/distributions/Slice2/noobs/marketing/slides/D.png b/distributions/Slice2/noobs/marketing/slides/D.png new file mode 100644 index 00000000000..68ff3faa811 Binary files /dev/null and b/distributions/Slice2/noobs/marketing/slides/D.png differ diff --git a/distributions/Slice2/noobs/marketing/slides/E.png b/distributions/Slice2/noobs/marketing/slides/E.png new file mode 100644 index 00000000000..5ae8e886dd7 Binary files /dev/null and b/distributions/Slice2/noobs/marketing/slides/E.png differ diff --git a/distributions/Slice2/noobs/marketing/slides/F.png b/distributions/Slice2/noobs/marketing/slides/F.png new file mode 100644 index 00000000000..72761c03cf6 Binary files /dev/null and b/distributions/Slice2/noobs/marketing/slides/F.png differ diff --git a/distributions/Slice2/noobs/marketing/slides_vga/A.png b/distributions/Slice2/noobs/marketing/slides_vga/A.png new file mode 100644 index 00000000000..00ed01776b9 Binary files /dev/null and b/distributions/Slice2/noobs/marketing/slides_vga/A.png differ diff --git a/distributions/Slice2/noobs/marketing/slides_vga/B.png b/distributions/Slice2/noobs/marketing/slides_vga/B.png new file mode 100644 index 00000000000..aef23107df2 Binary files /dev/null and b/distributions/Slice2/noobs/marketing/slides_vga/B.png differ diff --git a/distributions/Slice2/noobs/marketing/slides_vga/C.png b/distributions/Slice2/noobs/marketing/slides_vga/C.png new file mode 100644 index 00000000000..88c003cad05 Binary files /dev/null and b/distributions/Slice2/noobs/marketing/slides_vga/C.png differ diff --git a/distributions/Slice2/noobs/marketing/slides_vga/D.png b/distributions/Slice2/noobs/marketing/slides_vga/D.png new file mode 100644 index 00000000000..db5dcaed821 Binary files /dev/null and b/distributions/Slice2/noobs/marketing/slides_vga/D.png differ diff --git a/distributions/Slice2/noobs/marketing/slides_vga/E.png b/distributions/Slice2/noobs/marketing/slides_vga/E.png new file mode 100644 index 00000000000..7c11507a641 Binary files /dev/null and b/distributions/Slice2/noobs/marketing/slides_vga/E.png differ diff --git a/distributions/Slice2/noobs/marketing/slides_vga/F.png b/distributions/Slice2/noobs/marketing/slides_vga/F.png new file mode 100644 index 00000000000..a716ed2d4c1 Binary files /dev/null and b/distributions/Slice2/noobs/marketing/slides_vga/F.png differ diff --git a/distributions/Slice2/options b/distributions/Slice2/options new file mode 100644 index 00000000000..961a4b03419 --- /dev/null +++ b/distributions/Slice2/options @@ -0,0 +1,212 @@ +# Name of the Distro to build (full name, without special characters) + DISTRONAME="Slice" + +# short project description + DESCRIPTION="Slice is a distribution of Kodi based on the LibreELEC.tv" + +# Welcome Message for e.g. SSH Server (up to 5 Lines) + GREETING0="##############################################" + GREETING1="# LibreELEC #" + GREETING2="# http://libreelec.tv #" + GREETING3="##############################################" + GREETING4="" + +# Root password to integrate in the target system + ROOT_PASSWORD="openelec" + +# Install glibc locales to the build (yes / no) + GLIBC_LOCALES="yes" + +# Mediacenter to use (kodi / no) + MEDIACENTER="kodi" + +# Skins to install (Confluence) +# Space separated list is supported, +# e.g. SKINS="Confluence" + SKINS="Estuary" + +# Default Skin (Confluence) + SKIN_DEFAULT="Estuary" + +# install extra subtitle Fonts for KODI (yes / no) + KODI_EXTRA_FONTS="yes" + +# build and install PulseAudio support (yes / no) + PULSEAUDIO_SUPPORT="yes" + +# build and install espeak support (yes / no) + ESPEAK_SUPPORT="yes" + +# build and install with non-free support +# (RAR compression support in KODI) (yes / no) + KODI_NONFREE_SUPPORT="yes" + +# build and install with BluRay support (yes / no) + KODI_BLURAY_SUPPORT="yes" + +# build and install with BD+ support +# (BD+ decryption support in KODI) (yes / no) + BLURAY_BDPLUS_SUPPORT="yes" + +# build and install with AACS support +# (BD decryption support in KODI) (yes / no) + BLURAY_AACS_SUPPORT="yes" + +# build and install with DVDCSS support +# (DVD decryption support in KODI) (yes / no) + KODI_DVDCSS_SUPPORT="yes" + +# additional drivers to install: +# for a list of additinoal drivers see packages/linux-drivers +# Space separated list is supported, +# e.g. ADDITIONAL_DRIVERS="DRIVER1 DRIVER2" + ADDITIONAL_DRIVERS="RTL8192CU RTL8192DU RTL8192EU RTL8188EU RTL8812AU" + +# build and install bluetooth support (yes / no) + BLUETOOTH_SUPPORT="yes" + +# build and install with KODI webfrontend (yes / no) + KODI_WEBSERVER_SUPPORT="yes" + +# build and install Avahi (Zeroconf) daemon (yes / no) + AVAHI_DAEMON="yes" + +# build with UPnP support (yes / no) + KODI_UPNP_SUPPORT="yes" + +# build with MySQL support (yes / no) + KODI_MYSQL_SUPPORT="yes" + +# build xbmc with sshlib support (yes / no) + KODI_SSHLIB_SUPPORT="yes" + +# build xbmc with optical drive support (yes / no) + KODI_OPTICAL_SUPPORT="yes" + +# build with AirPlay support (stream videos from iDevices to KODI) (yes / no) + KODI_AIRPLAY_SUPPORT="yes" + +# build with AirTunes support (stream music from iDevices to KODI) (yes / no) + KODI_AIRTUNES_SUPPORT="yes" + +# build with libnfs support (mounting nfs shares with KODI) (yes / no) + KODI_NFS_SUPPORT="yes" + +# build with Samba Client support (mounting SAMBA shares with KODI) (yes / no) + KODI_SAMBA_SUPPORT="yes" + +# include initial language addons for Kodi (yes / no) + KODI_LANGUAGE_ADDONS="yes" + +# build with NFS support (mounting nfs shares via the OS) (yes / no) + NFS_SUPPORT="yes" + +# build with Samba Client support (mounting samba shares via the OS) (yes / no) + SAMBA_SUPPORT="yes" + +# build and install Samba Server (yes / no) + SAMBA_SERVER="yes" + +# build and install SFTP Server (yes / no) + SFTP_SERVER="yes" + +# build and install OpenVPN support (yes / no) + OPENVPN_SUPPORT="yes" + +# build and install diskmounter support (udevil) +# this service provide auto mounting support for external drives in the +# mediacenter also automount internally drives at boottime via udev (yes / no) + UDEVIL="yes" + +# build and install exFAT fuse support (yes / no) + EXFAT="yes" + +# build and install NTFS-3G fuse support (yes / no) + NTFS3G="yes" + +# build and install hfs filesystem utilities (yes / no) + HFSTOOLS="yes" + +# Windowmanager to use (ratpoison / fluxbox / none) + WINDOWMANAGER="fluxbox" + +# Xorg Graphic drivers to use (all / i915,i965,r200,r300,r600,nvidia) +# Space separated list is supported, +# e.g. GRAPHIC_DRIVERS="i915 i965 r300 r600 radeonsi nvidia" + GRAPHIC_DRIVERS="r300 r600 radeonsi i915 i965 nvidia nvidia-legacy" + +# build and install remote support (yes / no) + REMOTE_SUPPORT="yes" + +# build and install ATV IR remote support (yes / no) + ATVCLIENT_SUPPORT="yes" + +# build and install IRServer IR/LCD support (yes / no) + IRSERVER_SUPPORT="yes" + +# build and install Joystick support (yes / no) + JOYSTICK_SUPPORT="yes" + +# build and install CEC adapter support (yes / no) + CEC_SUPPORT="yes" + +# build and install iSCSI support - iscsistart (yes / no) + ISCSI_SUPPORT="yes" + +# LCD driver to Use - Possible drivers are ( Comma seperated: +# bayrad,CFontz,CFontz633,CFontzPacket,curses,CwLnx,dm140, +# ea65,EyeboxOne,g15,glcd,glcdlib,glk,hd44780,i2500vfd, +# icp_a106,imon,imonlcd,IOWarrior,irman,irtrans, +# joy,lb216,lcdm001,lcterm,lirc,lis,MD8800,mdm166a, +# ms6931,mtc_s16209x,MtxOrb,mx5000,NoritakeVFD, +# picolcd,pyramid,sed1330,sed1520,serialPOS, +# serialVFD,shuttleVFD,sli,stv5730,SureElec,svga,vlsys_m428 +# 'all' compiles all drivers; +# 'all,!xxx,!yyy' de-selects previously selected drivers +# "none" for disable LCD support + LCD_DRIVER="irtrans,imon,imonlcd,mdm166a,MtxOrb,lis,dm140,hd44780,CFontz,SureElec,vlsys_m428,serialVFD,shuttleVFD" + +# Support for partitioning and formating disks in initramfs (yes / no) +# This adds support for parted and mkfs.ext3/4 to initramfs for OEM usage + INITRAMFS_PARTED_SUPPORT="no" + +# build with swap support (yes / no) + SWAP_SUPPORT="no" + +# swap support enabled per default (yes / no) + SWAP_ENABLED_DEFAULT="no" + +# swapfile size if SWAP_SUPPORT=yes in MB + SWAPFILESIZE="256" + +# build with installer (yes / no) + INSTALLER_SUPPORT="yes" + +# Testpackages for development (yes / no) + TESTING="no" + +# OEM packages for OEM's (yes / no) + OEM_SUPPORT="no" + +# build and install nano text editor (yes / no) + NANO_EDITOR="yes" + +# cron support (yes / no) + CRON_SUPPORT="yes" + +# Distribution Specific source location + DISTRO_MIRROR="http://sources.libreelec.tv/mirror" + DISTRO_SRC="http://sources.libreelec.tv/$LIBREELEC_VERSION" + +# Addon Server Url + ADDON_SERVER_URL="http://addons.libreelec.tv" + +# set the addon dirs + ADDON_PATH="$ADDON_VERSION/RPi/$TARGET_ARCH" + ADDON_URL="$ADDON_SERVER_URL/$ADDON_PATH" + +# Default size of system partition, in MB, eg. 512 + SYSTEM_SIZE=512 +# Default system partition offset, in sectors, eg. 2048 + SYSTEM_PART_START=2048 + diff --git a/distributions/Slice2/splash/splash-1024.png b/distributions/Slice2/splash/splash-1024.png new file mode 100644 index 00000000000..a40ba0e9eaf Binary files /dev/null and b/distributions/Slice2/splash/splash-1024.png differ diff --git a/distributions/Slice2/splash/splash-full.png b/distributions/Slice2/splash/splash-full.png new file mode 100644 index 00000000000..78e1d7c2be8 Binary files /dev/null and b/distributions/Slice2/splash/splash-full.png differ diff --git a/packages/addons/addon-depends/atk/package.mk b/packages/addons/addon-depends/atk/package.mk new file mode 100644 index 00000000000..ed8bf1274c7 --- /dev/null +++ b/packages/addons/addon-depends/atk/package.mk @@ -0,0 +1,42 @@ +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) +# +# This Program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This Program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with OpenELEC.tv; see the file COPYING. If not, write to +# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. +# http://www.gnu.org/copyleft/gpl.html +################################################################################ + +PKG_NAME="atk" +PKG_VERSION="2.20.0" +PKG_REV="1" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="http://library.gnome.org/devel/atk/" +PKG_URL="http://ftp.gnome.org/pub/gnome/sources/$PKG_NAME/2.20/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_DEPENDS_TARGET="toolchain glib" +PKG_PRIORITY="optional" +PKG_SECTION="accessibility" +PKG_SHORTDESC="ATK - Accessibility Toolkit" +PKG_LONGDESC="ATK provides the set of accessibility interfaces that are implemented by other toolkits and applications. Using the ATK interfaces, accessibility tools have full access to view and control running applications." +PKG_IS_ADDON="no" + +PKG_AUTORECONF="yes" + +PKG_CONFIGURE_OPTS_TARGET="--enable-static --disable-shared \ + --disable-rebuilds --disable-glibtest" + +pre_configure_target() { + export CFLAGS="$CFLAGS -fPIC" +} diff --git a/packages/addons/addon-depends/atk/patches/atk-meh.patch b/packages/addons/addon-depends/atk/patches/atk-meh.patch new file mode 100644 index 00000000000..1fa31a93d95 --- /dev/null +++ b/packages/addons/addon-depends/atk/patches/atk-meh.patch @@ -0,0 +1,347 @@ +diff -Naur atk-2.20.0/atk/atkobject.c atk-2.20.0.patch/atk/atkobject.c +--- atk-2.20.0/atk/atkobject.c 2016-02-15 12:29:12.000000000 +0100 ++++ atk-2.20.0.patch/atk/atkobject.c 2016-03-26 01:10:01.058238623 +0100 +@@ -26,7 +26,6 @@ + #include + + #include "atk.h" +-#include "atkmarshal.h" + #include "atkprivate.h" + + /** +@@ -610,27 +609,6 @@ + G_TYPE_POINTER); + + /** +- * AtkObject::state-change: +- * @atkobject: the object which received the signal. +- * @arg1: The name of the state which has changed +- * @arg2: A boolean which indicates whether the state has been set or unset. +- * +- * The "state-change" signal is emitted when an object's state +- * changes. The detail value identifies the state type which has +- * changed. +- */ +- atk_object_signals[STATE_CHANGE] = +- g_signal_new ("state_change", +- G_TYPE_FROM_CLASS (klass), +- G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED, +- G_STRUCT_OFFSET (AtkObjectClass, state_change), +- (GSignalAccumulator) NULL, NULL, +- atk_marshal_VOID__STRING_BOOLEAN, +- G_TYPE_NONE, 2, +- G_TYPE_STRING, +- G_TYPE_BOOLEAN); +- +- /** + * AtkObject::visible-data-changed: + * @atkobject: the object which received the signal. + * +diff -Naur atk-2.20.0/atk/atktable.c atk-2.20.0.patch/atk/atktable.c +--- atk-2.20.0/atk/atktable.c 2016-02-15 12:29:12.000000000 +0100 ++++ atk-2.20.0.patch/atk/atktable.c 2016-03-26 01:11:35.242363570 +0100 +@@ -20,7 +20,6 @@ + #include "config.h" + + #include "atktable.h" +-#include "atkmarshal.h" + + /** + * SECTION:atktable +@@ -102,78 +101,6 @@ + if (!initialized) + { + /** +- * AtkTable::row-inserted: +- * @atktable: the object which received the signal. +- * @arg1: The index of the first row inserted. +- * @arg2: The number of rows inserted. +- * +- * The "row-inserted" signal is emitted by an object which +- * implements the AtkTable interface when a row is inserted. +- */ +- atk_table_signals[ROW_INSERTED] = +- g_signal_new ("row_inserted", +- ATK_TYPE_TABLE, +- G_SIGNAL_RUN_LAST, +- G_STRUCT_OFFSET (AtkTableIface, row_inserted), +- (GSignalAccumulator) NULL, NULL, +- atk_marshal_VOID__INT_INT, +- G_TYPE_NONE, +- 2, G_TYPE_INT, G_TYPE_INT); +- /** +- * AtkTable::column-inserted: +- * @atktable: the object which received the signal. +- * @arg1: The index of the column inserted. +- * @arg2: The number of colums inserted. +- * +- * The "column-inserted" signal is emitted by an object which +- * implements the AtkTable interface when a column is inserted. +- */ +- atk_table_signals[COLUMN_INSERTED] = +- g_signal_new ("column_inserted", +- ATK_TYPE_TABLE, +- G_SIGNAL_RUN_LAST, +- G_STRUCT_OFFSET (AtkTableIface, column_inserted), +- (GSignalAccumulator) NULL, NULL, +- atk_marshal_VOID__INT_INT, +- G_TYPE_NONE, +- 2, G_TYPE_INT, G_TYPE_INT); +- /** +- * AtkTable::row-deleted: +- * @atktable: the object which received the signal. +- * @arg1: The index of the first row deleted. +- * @arg2: The number of rows deleted. +- * +- * The "row-deleted" signal is emitted by an object which +- * implements the AtkTable interface when a row is deleted. +- */ +- atk_table_signals[ROW_DELETED] = +- g_signal_new ("row_deleted", +- ATK_TYPE_TABLE, +- G_SIGNAL_RUN_LAST, +- G_STRUCT_OFFSET (AtkTableIface, row_deleted), +- (GSignalAccumulator) NULL, NULL, +- atk_marshal_VOID__INT_INT, +- G_TYPE_NONE, +- 2, G_TYPE_INT, G_TYPE_INT); +- /** +- * AtkTable::column-deleted: +- * @atktable: the object which received the signal. +- * @arg1: The index of the first column deleted. +- * @arg2: The number of columns deleted. +- * +- * The "column-deleted" signal is emitted by an object which +- * implements the AtkTable interface when a column is deleted. +- */ +- atk_table_signals[COLUMN_DELETED] = +- g_signal_new ("column_deleted", +- ATK_TYPE_TABLE, +- G_SIGNAL_RUN_LAST, +- G_STRUCT_OFFSET (AtkTableIface, column_deleted), +- (GSignalAccumulator) NULL, NULL, +- atk_marshal_VOID__INT_INT, +- G_TYPE_NONE, +- 2, G_TYPE_INT, G_TYPE_INT); +- /** + * AtkTable::row-reordered: + * @atktable: the object which received the signal. + * +diff -Naur atk-2.20.0/atk/atktext.c atk-2.20.0.patch/atk/atktext.c +--- atk-2.20.0/atk/atktext.c 2016-02-15 12:29:12.000000000 +0100 ++++ atk-2.20.0.patch/atk/atktext.c 2016-03-26 01:12:57.099480029 +0100 +@@ -20,7 +20,6 @@ + #include "config.h" + + #include "atk.h" +-#include "atkmarshal.h" + + #include + +@@ -190,75 +189,6 @@ + class->get_bounded_ranges = atk_text_real_get_bounded_ranges; + + /** +- * AtkText::text-changed: +- * @atktext: the object which received the signal. +- * @arg1: The position (character offset) of the insertion or deletion. +- * @arg2: The length (in characters) of text inserted or deleted. +- * +- * The "text-changed" signal is emitted when the text of the +- * object which implements the AtkText interface changes, This +- * signal will have a detail which is either "insert" or +- * "delete" which identifies whether the text change was an +- * insertion or a deletion. +- * +- * Deprecated: 2.9.4: Use #AtkObject::text-insert or +- * #AtkObject::text-remove instead. +- */ +- atk_text_signals[TEXT_CHANGED] = +- g_signal_new ("text_changed", +- ATK_TYPE_TEXT, +- G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED, +- G_STRUCT_OFFSET (AtkTextIface, text_changed), +- (GSignalAccumulator) NULL, NULL, +- atk_marshal_VOID__INT_INT, +- G_TYPE_NONE, +- 2, G_TYPE_INT, G_TYPE_INT); +- +- /** +- * AtkText::text-insert: +- * @atktext: the object which received the signal. +- * @arg1: The position (character offset) of the insertion. +- * @arg2: The length (in characters) of text inserted. +- * @arg3: The new text inserted +- * +- * The "text-insert" signal is emitted when a new text is +- * inserted. If the signal was not triggered by the user +- * (e.g. typing or pasting text), the "system" detail should be +- * included. +- */ +- atk_text_signals[TEXT_INSERT] = +- g_signal_new ("text_insert", +- ATK_TYPE_TEXT, +- G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED, +- 0, +- (GSignalAccumulator) NULL, NULL, +- atk_marshal_VOID__INT_INT_STRING, +- G_TYPE_NONE, +- 3, G_TYPE_INT, G_TYPE_INT, G_TYPE_STRING); +- +- /** +- * AtkText::text-remove: +- * @atktext: the object which received the signal. +- * @arg1: The position (character offset) of the removal. +- * @arg2: The length (in characters) of text removed. +- * @arg3: The old text removed +- * +- * The "text-remove" signal is emitted when a new text is +- * removed. If the signal was not triggered by the user +- * (e.g. typing or pasting text), the "system" detail should be +- * included. +- */ +- atk_text_signals[TEXT_REMOVE] = +- g_signal_new ("text_remove", +- ATK_TYPE_TEXT, +- G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED, +- 0, +- (GSignalAccumulator) NULL, NULL, +- atk_marshal_VOID__INT_INT_STRING, +- G_TYPE_NONE, +- 3, G_TYPE_INT, G_TYPE_INT, G_TYPE_STRING); +- +- /** + * AtkText::text-caret-moved: + * @atktext: the object which received the signal. + * @arg1: The new position of the text caret. +diff -Naur atk-2.20.0/atk/atkutil.c atk-2.20.0.patch/atk/atkutil.c +--- atk-2.20.0/atk/atkutil.c 2016-02-15 12:29:12.000000000 +0100 ++++ atk-2.20.0.patch/atk/atkutil.c 2016-03-26 01:13:04.481490538 +0100 +@@ -20,7 +20,6 @@ + #include "config.h" + + #include "atkutil.h" +-#include "atkmarshal.c" + + /** + * SECTION:atkutil +diff -Naur atk-2.20.0/atk/atkvalue.c atk-2.20.0.patch/atk/atkvalue.c +--- atk-2.20.0/atk/atkvalue.c 2016-02-15 12:29:12.000000000 +0100 ++++ atk-2.20.0.patch/atk/atkvalue.c 2016-03-26 01:18:03.268897883 +0100 +@@ -23,7 +23,6 @@ + #include + + #include "atkvalue.h" +-#include "atkmarshal.h" + #include "atk-enum-types.h" + #include "atkprivate.h" + +@@ -322,42 +321,6 @@ + atk_value_base_init (AtkValueIface *class) + { + static gboolean initialized = FALSE; +- if (!initialized) +- { +- /** +- * AtkValue::value-changed: +- * @atkvalue: the object on which the signal was emitted. +- * @value: the new value in a numerical form. +- * @text: human readable text alternative (also called +- * description) of this object. NULL if not available. +- * +- * The 'value-changed' signal is emitted when the current value +- * that represent the object changes. @value is the numerical +- * representation of this new value. @text is the human +- * readable text alternative of @value, and can be NULL if it is +- * not available. Note that if there is a textual description +- * associated with the new numeric value, that description +- * should be included regardless of whether or not it has also +- * changed. +- * +- * Example: a password meter whose value changes as the user +- * types their new password. Appropiate value text would be +- * "weak", "acceptable" and "strong". +- * +- * Since: 2.12 +- */ +- atk_value_signals[VALUE_CHANGED] = +- g_signal_new ("value_changed", +- ATK_TYPE_VALUE, +- G_SIGNAL_RUN_LAST, +- 0, +- (GSignalAccumulator) NULL, NULL, +- atk_marshal_VOID__DOUBLE_STRING, +- G_TYPE_NONE, +- 2, G_TYPE_DOUBLE, G_TYPE_STRING); +- +- initialized = TRUE; +- } + } + + /** +diff -Naur atk-2.20.0/atk/atkwindow.c atk-2.20.0.patch/atk/atkwindow.c +--- atk-2.20.0/atk/atkwindow.c 2016-02-15 12:29:12.000000000 +0100 ++++ atk-2.20.0.patch/atk/atkwindow.c 2016-03-26 01:13:13.448503294 +0100 +@@ -20,7 +20,6 @@ + #include "config.h" + + #include "atkwindow.h" +-#include "atkmarshal.h" + + /** + * SECTION:atkwindow +diff -Naur atk-2.20.0/atk/Makefile.am atk-2.20.0.patch/atk/Makefile.am +--- atk-2.20.0/atk/Makefile.am 2016-02-15 12:29:12.000000000 +0100 ++++ atk-2.20.0.patch/atk/Makefile.am 2016-03-26 01:08:29.075118340 +0100 +@@ -115,50 +115,7 @@ + + # ---------- Handle built sources ---------- + +-BUILT_SOURCES = atkmarshal.h atkmarshal.c atk-enum-types.h atk-enum-types.c +- +-atkmarshal.h: stamp-atkmarshal.h +- @true +-stamp-atkmarshal.h: @REBUILD@ atkmarshal.list +- $(AM_V_GEN) $(GLIB_GENMARSHAL) --prefix=atk_marshal $(srcdir)/atkmarshal.list --header >> xgen-gmh \ +- && (cmp -s xgen-gmh atkmarshal.h || cp xgen-gmh atkmarshal.h) \ +- && rm -f xgen-gmh xgen-gmh~ \ +- && echo timestamp > $(@F) +- +-atkmarshal.c: stamp-atkmarshal.c +- @true +-stamp-atkmarshal.c: @REBUILD@ atkmarshal.list +- $(AM_V_GEN) $(GLIB_GENMARSHAL) --prefix=atk_marshal $(srcdir)/atkmarshal.list --body >> xgen-gmc \ +- && (cmp -s xgen-gmc atkmarshal.c || cp xgen-gmc atkmarshal.c) \ +- && rm -f xgen-gmc xgen-gmc~ \ +- && echo timestamp > $(@F) +- +-atk-enum-types.h: s-enum-types-h +- @true +-s-enum-types-h: @REBUILD@ $(atk_headers) Makefile +- $(AM_V_GEN) ( cd $(srcdir) && $(GLIB_MKENUMS) \ +- --fhead "#if defined(ATK_DISABLE_SINGLE_INCLUDES) && !defined (__ATK_H_INSIDE__) && !defined (ATK_COMPILATION)\n#error \"Only can be included directly.\"\n#endif\n\n#ifndef __ATK_ENUM_TYPES_H__\n#define __ATK_ENUM_TYPES_H__\n\n#include \n#include \n\nG_BEGIN_DECLS\n" \ +- --fprod "/* enumerations from \"@filename@\" */\n" \ +- --vhead "ATK_AVAILABLE_IN_ALL\nGType @enum_name@_get_type (void);\n#define ATK_TYPE_@ENUMSHORT@ (@enum_name@_get_type())\n" \ +- --ftail "G_END_DECLS\n\n#endif /* __ATK_ENUM_TYPES_H__ */" \ +- $(atk_headers) ) > tmp-atk-enum-types.h \ +- && (cmp -s tmp-atk-enum-types.h atk-enum-types.h || cp tmp-atk-enum-types.h atk-enum-types.h ) \ +- && rm -f tmp-atk-enum-types.h \ +- && echo timestamp > $(@F) +- +-atk-enum-types.c: s-enum-types-c +- @true +-s-enum-types-c: @REBUILD@ $(atk_headers) Makefile +- $(AM_V_GEN) ( cd $(srcdir) && $(GLIB_MKENUMS) \ +- --fhead "#include \"config.h\"\n\n#include " \ +- --fprod "\n/* enumerations from \"@filename@\" */" \ +- --vhead "GType\n@enum_name@_get_type (void)\n{\n static GType etype = 0;\n if (etype == 0) {\n static const G@Type@Value values[] = {" \ +- --vprod " { @VALUENAME@, \"@VALUENAME@\", \"@valuenick@\" }," \ +- --vtail " { 0, NULL, NULL }\n };\n etype = g_@type@_register_static (\"@EnumName@\", values);\n }\n return etype;\n}\n" \ +- $(atk_headers) ) > tmp-atk-enum-types.c \ +- && (cmp -s tmp-atk-enum-types.c atk-enum-types.c || cp tmp-atk-enum-types.c atk-enum-types.c ) \ +- && rm -f tmp-atk-enum-types.c \ +- && echo timestamp > $(@F) ++BUILT_SOURCES = atk-enum-types.h atk-enum-types.c + + + if HAVE_INTROSPECTION diff --git a/packages/addons/addon-depends/containerd/package.mk b/packages/addons/addon-depends/containerd/package.mk new file mode 100644 index 00000000000..89457efdd04 --- /dev/null +++ b/packages/addons/addon-depends/containerd/package.mk @@ -0,0 +1,77 @@ +################################################################################ +# This file is part of LibreELEC - https://libreelec.tv +# Copyright (C) 2009-2016 Lukas Rusak (lrusak@libreelec.tv) +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +PKG_NAME="containerd" +PKG_VERSION="9dc2b32" +PKG_REV="1" +PKG_ARCH="any" +PKG_LICENSE="APL" +PKG_SITE="https://containerd.tools/" +PKG_URL="https://github.com/docker/containerd/archive/${PKG_VERSION}.tar.gz" +PKG_DEPENDS_HOST="toolchain go" +PKG_PRIORITY="optional" +PKG_SECTION="system" +PKG_SHORTDESC="containerd is a daemon to control runC" +PKG_LONGDESC="containerd is a daemon to control runC, built for performance and density. containerd leverages runC's advanced features such as seccomp and user namespace support as well as checkpoint and restore for cloning and live migration of containers." + +PKG_IS_ADDON="no" +PKG_AUTORECONF="no" + +pre_make_target() { + case $TARGET_ARCH in + x86_64) + export GOARCH=amd64 + ;; + arm) + export GOARCH=arm + + case $TARGET_CPU in + arm1176jzf-s) + export GOARM=6 + ;; + cortex-a7) + export GOARM=7 + ;; + esac + ;; + esac + + export GOOS=linux + export CGO_ENABLED=1 + export CGO_NO_EMULATION=1 + export CGO_CFLAGS=$CFLAGS + export LDFLAGS="-w -extldflags -static -X github.com/docker/containerd.GitCommit=${PKG_VERSION} -extld $TARGET_CC" + export GOLANG=$ROOT/$TOOLCHAIN/lib/golang/bin/go + export GOPATH=$ROOT/$PKG_BUILD.gopath:$ROOT/$PKG_BUILD/vendor/ + export GOROOT=$ROOT/$TOOLCHAIN/lib/golang + export PATH=$PATH:$GOROOT/bin + + ln -fs $ROOT/$PKG_BUILD $ROOT/$PKG_BUILD/vendor/src/github.com/docker/containerd +} + +make_target() { + mkdir -p bin + $GOLANG build -v -o bin/ctr -a -tags "static_build" -ldflags "$LDFLAGS" ./ctr + $GOLANG build -v -o bin/containerd -a -tags "static_build" -ldflags "$LDFLAGS" ./containerd + $GOLANG build -v -o bin/containerd-shim -a -tags "static_build" -ldflags "$LDFLAGS" ./containerd-shim +} + +makeinstall_target() { + : +} + diff --git a/packages/3rdparty/lib/cxxtools/package.mk b/packages/addons/addon-depends/cxxtools/package.mk similarity index 100% rename from packages/3rdparty/lib/cxxtools/package.mk rename to packages/addons/addon-depends/cxxtools/package.mk diff --git a/packages/3rdparty/lib/cxxtools/patches/cxxtools-2.2-Char_operator_eq_unsigned_int.patch b/packages/addons/addon-depends/cxxtools/patches/cxxtools-2.2-Char_operator_eq_unsigned_int.patch similarity index 100% rename from packages/3rdparty/lib/cxxtools/patches/cxxtools-2.2-Char_operator_eq_unsigned_int.patch rename to packages/addons/addon-depends/cxxtools/patches/cxxtools-2.2-Char_operator_eq_unsigned_int.patch diff --git a/packages/3rdparty/lib/cxxtools/patches/cxxtools-2.2-hdstream_stdio.patch b/packages/addons/addon-depends/cxxtools/patches/cxxtools-2.2-hdstream_stdio.patch similarity index 100% rename from packages/3rdparty/lib/cxxtools/patches/cxxtools-2.2-hdstream_stdio.patch rename to packages/addons/addon-depends/cxxtools/patches/cxxtools-2.2-hdstream_stdio.patch diff --git a/packages/3rdparty/lib/cxxtools/patches/cxxtools-2.2-no_shared_flag.patch b/packages/addons/addon-depends/cxxtools/patches/cxxtools-2.2-no_shared_flag.patch similarity index 100% rename from packages/3rdparty/lib/cxxtools/patches/cxxtools-2.2-no_shared_flag.patch rename to packages/addons/addon-depends/cxxtools/patches/cxxtools-2.2-no_shared_flag.patch diff --git a/packages/3rdparty/lib/cxxtools/patches/cxxtools-crosscompile.patch b/packages/addons/addon-depends/cxxtools/patches/cxxtools-crosscompile.patch similarity index 100% rename from packages/3rdparty/lib/cxxtools/patches/cxxtools-crosscompile.patch rename to packages/addons/addon-depends/cxxtools/patches/cxxtools-crosscompile.patch diff --git a/packages/addons/addon-depends/dvb-tools-depends/depends/bitstream/package.mk b/packages/addons/addon-depends/dvb-tools-depends/depends/bitstream/package.mk new file mode 100644 index 00000000000..2c6940bf5d7 --- /dev/null +++ b/packages/addons/addon-depends/dvb-tools-depends/depends/bitstream/package.mk @@ -0,0 +1,35 @@ +################################################################################ +# This file is part of LibreELEC - http://www.libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +PKG_NAME="bitstream" +PKG_VERSION="1.1" +PKG_REV="1" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="http://www.videolan.org" +PKG_URL="http://download.videolan.org/pub/videolan/${PKG_NAME}/${PKG_VERSION}/${PKG_NAME}-${PKG_VERSION}.tar.bz2" +PKG_DEPENDS_TARGET="toolchain" +PKG_PRIORITY="optional" +PKG_SECTION="multimedia" +PKG_SHORTDESC="biTStream is a set of C headers allowing a simpler access to binary structures such as specified by MPEG, DVB, IETF, etc." +PKG_LONGDESC="biTStream is a set of C headers allowing a simpler access to binary structures such as specified by MPEG, DVB, IETF, etc." + +PKG_IS_ADDON="no" +PKG_AUTORECONF="no" + +PKG_MAKEINSTALL_OPTS_TARGET="PREFIX=/usr" diff --git a/packages/addons/addon-depends/dvb-tools-depends/depends/libev/package.mk b/packages/addons/addon-depends/dvb-tools-depends/depends/libev/package.mk new file mode 100644 index 00000000000..a287632265d --- /dev/null +++ b/packages/addons/addon-depends/dvb-tools-depends/depends/libev/package.mk @@ -0,0 +1,35 @@ +################################################################################ +# This file is part of LibreELEC - http://www.libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +PKG_NAME="libev" +PKG_VERSION="4.22" +PKG_REV="1" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="http://software.schmorp.de/pkg/libev.html" +PKG_URL="http://dist.schmorp.de/libev/${PKG_NAME}-${PKG_VERSION}.tar.gz" +PKG_DEPENDS_TARGET="toolchain" +PKG_PRIORITY="optional" +PKG_SECTION="multimedia" +PKG_SHORTDESC="libev: a full-featured and high-performance event loop" +PKG_LONGDESC="A full-featured and high-performance event loop that is loosely modelled after libevent, but without its limitations and bugs." + +PKG_IS_ADDON="no" +PKG_AUTORECONF="yes" + +PKG_CONFIGURE_OPTS_TARGET="--disable-shared --enable-static" diff --git a/packages/addons/addon-depends/dvb-tools-depends/dvb-apps/package.mk b/packages/addons/addon-depends/dvb-tools-depends/dvb-apps/package.mk new file mode 100644 index 00000000000..1047b0d4236 --- /dev/null +++ b/packages/addons/addon-depends/dvb-tools-depends/dvb-apps/package.mk @@ -0,0 +1,42 @@ +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) +# +# This Program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This Program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with OpenELEC.tv; see the file COPYING. If not, write to +# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. +# http://www.gnu.org/copyleft/gpl.html +################################################################################ + +PKG_NAME="dvb-apps" +PKG_VERSION="3d43b280298c" +PKG_REV="0" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="https://www.linuxtv.org/wiki/index.php/LinuxTV_dvb-apps" +PKG_URL="http://linuxtv.org/hg/dvb-apps/archive/${PKG_VERSION}.tar.bz2" +PKG_DEPENDS_TARGET="toolchain" +PKG_PRIORITY="optional" +PKG_SECTION="tools" +PKG_SHORTDESC="Digitial Video Broadcasting (DVB) applications" +PKG_LONGDESC="Applications and utilities geared towards the initial setup, testing and operation of an DVB device supporting the DVB-S, DVB-C, DVB-T, and ATSC standards." +PKG_AUTORECONF="no" + +make_target() { + make -C lib + make -C util +} + +makeinstall_target() { + : # nop +} diff --git a/packages/addons/addon-depends/dvb-tools-depends/dvb-apps/patches/dvb-apps-10_reorder-includes.patch b/packages/addons/addon-depends/dvb-tools-depends/dvb-apps/patches/dvb-apps-10_reorder-includes.patch new file mode 100644 index 00000000000..40312e93386 --- /dev/null +++ b/packages/addons/addon-depends/dvb-tools-depends/dvb-apps/patches/dvb-apps-10_reorder-includes.patch @@ -0,0 +1,11 @@ +diff -Naur dvb-apps-20090201/util/scan/diseqc.c dvb-apps-20090201a/util/scan/diseqc.c +--- dvb-apps-20090201/util/scan/diseqc.c 2009-02-01 13:57:16.000000000 +0100 ++++ dvb-apps-20090201a/util/scan/diseqc.c 2009-02-14 13:45:42.000000000 +0100 +@@ -1,6 +1,6 @@ ++#include + #include + #include +-#include + + #include "scan.h" + #include "diseqc.h" diff --git a/packages/addons/addon-depends/dvb-tools-depends/dvb-apps/patches/dvb-apps-20_build-static-libs.patch b/packages/addons/addon-depends/dvb-tools-depends/dvb-apps/patches/dvb-apps-20_build-static-libs.patch new file mode 100644 index 00000000000..18d6976e328 --- /dev/null +++ b/packages/addons/addon-depends/dvb-tools-depends/dvb-apps/patches/dvb-apps-20_build-static-libs.patch @@ -0,0 +1,13 @@ +diff --git a/Make.rules b/Make.rules +index e867c3a..b2d8663 100644 +--- a/Make.rules ++++ b/Make.rules +@@ -9,7 +9,7 @@ ifneq ($(lib_name),) + CFLAGS_LIB ?= -fPIC + CFLAGS += $(CFLAGS_LIB) + +-libraries = $(lib_name).so $(lib_name).a ++libraries = $(lib_name).a + + .PHONY: library + diff --git a/packages/addons/addon-depends/dvb-tools-depends/dvb-apps/patches/dvb-apps-30_remove-av7110_loadkeys.patch b/packages/addons/addon-depends/dvb-tools-depends/dvb-apps/patches/dvb-apps-30_remove-av7110_loadkeys.patch new file mode 100644 index 00000000000..b4adc2cdc4d --- /dev/null +++ b/packages/addons/addon-depends/dvb-tools-depends/dvb-apps/patches/dvb-apps-30_remove-av7110_loadkeys.patch @@ -0,0 +1,11 @@ +diff -Naur a/util/Makefile b/util/Makefile +--- a/util/Makefile 2014-03-21 12:26:36.000000000 -0700 ++++ b/util/Makefile 2015-12-21 01:12:10.261957235 -0800 +@@ -4,7 +4,6 @@ + + all clean install: + $(MAKE) -C atsc_epg $@ +- $(MAKE) -C av7110_loadkeys $@ + $(MAKE) -C dib3000-watch $@ + $(MAKE) -C dst-utils $@ + $(MAKE) -C dvbdate $@ diff --git a/packages/addons/addon-depends/dvb-tools-depends/dvb-fe-tool/package.mk b/packages/addons/addon-depends/dvb-tools-depends/dvb-fe-tool/package.mk new file mode 100644 index 00000000000..39161cd61c8 --- /dev/null +++ b/packages/addons/addon-depends/dvb-tools-depends/dvb-fe-tool/package.mk @@ -0,0 +1,63 @@ +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) +# +# This Program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This Program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with OpenELEC.tv; see the file COPYING. If not, write to +# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. +# http://www.gnu.org/copyleft/gpl.html +################################################################################ + +PKG_NAME="dvb-fe-tool" +PKG_VERSION="fa2f7d9" +PKG_REV="1" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="http://linuxtv.org/" +PKG_URL="https://git.linuxtv.org/cgit.cgi/v4l-utils.git/snapshot/$PKG_VERSION.tar.xz" +PKG_SOURCE_DIR="$PKG_VERSION*" +PKG_DEPENDS_TARGET="toolchain" +PKG_PRIORITY="optional" +PKG_SECTION="tools" +PKG_SHORTDESC="dvb-fe-tool: Linux V4L2 and DVB API utilities and v4l libraries (libv4l)." +PKG_LONGDESC="Linux V4L2 and DVB API utilities and v4l libraries (libv4l)." +PKG_AUTORECONF="yes" + +PKG_CONFIGURE_OPTS_TARGET="--disable-nls \ + --disable-rpath \ + --disable-libdvbv5 \ + --disable-libv4l \ + --disable-v4l-utils \ + --disable-qv4l2 \ + --without-jpeg \ + --without-libiconv-prefix \ + --without-libintl-prefix" + +post_patch() { + mkdir -p $ROOT/$PKG_BUILD/build-aux/ + touch $ROOT/$PKG_BUILD/build-aux/config.rpath + touch $ROOT/$PKG_BUILD/libdvbv5-po/Makefile.in.in + touch $ROOT/$PKG_BUILD/v4l-utils-po/Makefile.in.in +} + +make_target() { + cd $ROOT/$PKG_BUILD/.$TARGET_NAME/lib/libdvbv5 + make CFLAGS="$TARGET_CFLAGS" + + cd $ROOT/$PKG_BUILD/.$TARGET_NAME/utils/dvb + make CFLAGS="$TARGET_CFLAGS" +} + +makeinstall_target() { + : # nop +} diff --git a/packages/addons/addon-depends/dvb-tools-depends/dvblast/package.mk b/packages/addons/addon-depends/dvb-tools-depends/dvblast/package.mk new file mode 100644 index 00000000000..28f4f13cf47 --- /dev/null +++ b/packages/addons/addon-depends/dvb-tools-depends/dvblast/package.mk @@ -0,0 +1,43 @@ +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) +# +# This Program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This Program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with OpenELEC.tv; see the file COPYING. If not, write to +# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. +# http://www.gnu.org/copyleft/gpl.html +################################################################################ + +PKG_NAME="dvblast" +PKG_VERSION="3.0" +PKG_REV="1" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="http://www.videolan.org" +PKG_URL="http://downloads.videolan.org/pub/videolan/dvblast/${PKG_VERSION}/dvblast-${PKG_VERSION}.tar.bz2" +PKG_DEPENDS_TARGET="toolchain bitstream libev" +PKG_PRIORITY="optional" +PKG_SECTION="tools" +PKG_SHORTDESC="DVBlast is a simple and powerful MPEG-2/TS demux and streaming application" +PKG_LONGDESC="DVBlast is a simple and powerful MPEG-2/TS demux and streaming application" +PKG_AUTORECONF="no" + +MAKEFLAGS="V=1" + +pre_configure_target() { + export LDFLAGS="$LDFLAGS -lm" +} + +makeinstall_target() { + : # nop +} diff --git a/packages/addons/addon-depends/dvb-tools-depends/dvblast/patches/dvblast-ldflags.patch b/packages/addons/addon-depends/dvb-tools-depends/dvblast/patches/dvblast-ldflags.patch new file mode 100644 index 00000000000..9ad9e2080b6 --- /dev/null +++ b/packages/addons/addon-depends/dvb-tools-depends/dvblast/patches/dvblast-ldflags.patch @@ -0,0 +1,17 @@ +diff -Naur dvblast-3.0/Makefile dvblast-3.0.patch/Makefile +--- dvblast-3.0/Makefile 2015-10-05 17:51:14.000000000 +0200 ++++ dvblast-3.0.patch/Makefile 2016-03-26 22:54:59.953303040 +0100 +@@ -55,11 +55,11 @@ + + dvblast: $(OBJ_DVBLAST) + @echo "LINK $@" +- $(Q)$(CROSS)$(CC) -o $@ $(OBJ_DVBLAST) $(LDLIBS_DVBLAST) $(LDLIBS) ++ $(Q)$(CROSS)$(CC) -o $@ $(OBJ_DVBLAST) $(LDFLAGS) $(LDLIBS_DVBLAST) $(LDLIBS) + + dvblastctl: $(OBJ_DVBLASTCTL) + @echo "LINK $@" +- $(Q)$(CROSS)$(CC) -o $@ $(OBJ_DVBLASTCTL) $(LDLIBS) ++ $(Q)$(CROSS)$(CC) -o $@ $(OBJ_DVBLASTCTL) $(LDFLAGS) $(LDLIBS) + + clean: + @echo "CLEAN $(CLEAN_OBJS)" diff --git a/packages/devel/enca/package.mk b/packages/addons/addon-depends/enca/package.mk similarity index 100% rename from packages/devel/enca/package.mk rename to packages/addons/addon-depends/enca/package.mk diff --git a/packages/addons/addon-depends/enet/package.mk b/packages/addons/addon-depends/enet/package.mk new file mode 100644 index 00000000000..8bacd38418e --- /dev/null +++ b/packages/addons/addon-depends/enet/package.mk @@ -0,0 +1,39 @@ +################################################################################ +# This file is part of LibreELEC - https://libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +PKG_NAME="enet" +PKG_VERSION="1.3.13" +PKG_REV="1" +PKG_ARCH="any" +PKG_LICENSE="" +PKG_SITE="" +PKG_URL="http://enet.bespin.org/download/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain" +PKG_PRIORITY="optional" +PKG_SECTION="network" +PKG_SHORTDESC="ENet's purpose is to provide a relatively thin, simple and robust network communication layer on top of UDP (User Datagram Protocol)" +PKG_LONGDESC="ENet's purpose is to provide a relatively thin, simple and robust network communication layer on top of UDP (User Datagram Protocol)" + +PKG_IS_ADDON="no" +PKG_AUTORECONF="yes" + +PKG_CONFIGURE_OPTS_TARGET="--enable-static --disable-shared" + +post_makeinstall_target() { + rm -r $INSTALL +} diff --git a/packages/addons/addon-depends/faad2/package.mk b/packages/addons/addon-depends/faad2/package.mk new file mode 100644 index 00000000000..b418cb8c4ab --- /dev/null +++ b/packages/addons/addon-depends/faad2/package.mk @@ -0,0 +1,47 @@ +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) +# +# OpenELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# OpenELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with OpenELEC. If not, see . +################################################################################ + +PKG_NAME="faad2" +PKG_VERSION="2.7" +PKG_REV="1" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="http://www.audiocoding.com/" +PKG_URL="$SOURCEFORGE_SRC/faac/faad2-src/$PKG_NAME-$PKG_VERSION/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain" +PKG_PRIORITY="optional" +PKG_SECTION="audio" +PKG_SHORTDESC="faad: An MPEG-4 AAC decoder" +PKG_LONGDESC="The FAAD project includes the AAC decoder FAAD2. It supports several MPEG-4 object types (LC, Main, LTP, HE AAC, PS) and file formats (ADTS AAC, raw AAC, MP4), multichannel and gapless decoding as well as MP4 metadata tags. The codecs are compatible with standard-compliant audio applications using one or more of these profiles." + +PKG_IS_ADDON="no" +PKG_AUTORECONF="yes" + +PKG_MAINTAINER="Team LibreELEC (addons@libreelec.tv)" + +# package specific configure options +PKG_CONFIGURE_OPTS_TARGET="--enable-static \ + --disable-shared \ + --without-xmms \ + --without-drm \ + --without-mpeg4ip \ + --with-gnu-ld" + +post_makeinstall_target() { + rm -rf $INSTALL/usr/bin +} diff --git a/packages/addons/addon-depends/faad2/patches/faad2-2.7-automake_1.13.patch b/packages/addons/addon-depends/faad2/patches/faad2-2.7-automake_1.13.patch new file mode 100644 index 00000000000..56724f3f142 --- /dev/null +++ b/packages/addons/addon-depends/faad2/patches/faad2-2.7-automake_1.13.patch @@ -0,0 +1,12 @@ +diff -Naur faad2-2.7-old/configure.in faad2-2.7-new/configure.in +--- faad2-2.7-old/configure.in 2009-02-04 16:51:03.000000000 -0800 ++++ faad2-2.7-new/configure.in 2012-12-30 14:58:33.000000000 -0800 +@@ -25,7 +25,7 @@ + AC_PROG_MAKE_SET + AC_CHECK_PROGS(RPMBUILD, rpmbuild, rpm) + +-AM_CONFIG_HEADER(config.h) ++AC_CONFIG_HEADERS(config.h) + + AC_ARG_WITH(xmms,[ --with-xmms compile XMMS-1 plugin], + WITHXMMS=$withval, WITHXMMS=no) diff --git a/packages/addons/addon-depends/faad2/patches/faad2-2.7-mp4ff_shared.patch b/packages/addons/addon-depends/faad2/patches/faad2-2.7-mp4ff_shared.patch new file mode 100644 index 00000000000..fb97e81e9ca --- /dev/null +++ b/packages/addons/addon-depends/faad2/patches/faad2-2.7-mp4ff_shared.patch @@ -0,0 +1,28 @@ +diff -Naur faad2-2.7-old/common/mp4ff/Makefile.am faad2-2.7-new/common/mp4ff/Makefile.am +--- faad2-2.7-old/common/mp4ff/Makefile.am 2009-02-06 06:24:21.000000000 -0800 ++++ faad2-2.7-new/common/mp4ff/Makefile.am 2009-02-11 05:36:14.000000000 -0800 +@@ -1,7 +1,7 @@ +-lib_LIBRARIES = libmp4ff.a +-include_HEADERS = mp4ff.h mp4ffint.h ++lib_LTLIBRARIES = libmp4ff.la ++include_HEADERS = mp4ff.h mp4ffint.h mp4ff_int_types.h + +-libmp4ff_a_CFLAGS = -DUSE_TAGGING=1 ++libmp4ff_la_CFLAGS = -DUSE_TAGGING=1 + +-libmp4ff_a_SOURCES = mp4ff.c mp4atom.c mp4meta.c mp4sample.c mp4util.c \ +- mp4tagupdate.c mp4ff.h mp4ffint.h mp4ff_int_types.h ++libmp4ff_la_SOURCES = mp4ff.c mp4atom.c mp4meta.c mp4sample.c mp4util.c \ ++ mp4tagupdate.c mp4ff.h mp4ffint.h mp4ff_int_types.h +diff -Naur faad2-2.7-old/frontend/Makefile.am faad2-2.7-new/frontend/Makefile.am +--- faad2-2.7-old/frontend/Makefile.am 2009-02-06 08:03:37.000000000 -0800 ++++ faad2-2.7-new/frontend/Makefile.am 2009-02-11 05:35:52.000000000 -0800 +@@ -5,7 +5,7 @@ + -I$(top_srcdir)/common/mp4ff + + faad_LDADD = $(top_builddir)/libfaad/libfaad.la \ +- $(top_builddir)/common/mp4ff/libmp4ff.a ++ $(top_builddir)/common/mp4ff/libmp4ff.la + + faad_SOURCES = main.c \ + audio.c audio.h \ diff --git a/packages/addons/addon-depends/gdk-pixbuf/config/gdk-pixbuf.loaders b/packages/addons/addon-depends/gdk-pixbuf/config/gdk-pixbuf.loaders new file mode 100644 index 00000000000..87a9bb58a60 --- /dev/null +++ b/packages/addons/addon-depends/gdk-pixbuf/config/gdk-pixbuf.loaders @@ -0,0 +1,132 @@ +# GdkPixbuf Image Loader Modules file +# Automatically generated file, do not edit +# Created by gdk-pixbuf-query-loaders from gdk-pixbuf-2.21.5 +# +# LoaderDir = /usr/lib/gdk-pixbuf-2.0/2.10.0/loaders +# +"/usr/lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-ani.so" +"ani" 4 "gdk-pixbuf" "The ANI image format" "LGPL" +"application/x-navi-animation" "" +"ani" "" +"RIFF ACON" " xxxx " 100 + +"/usr/lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-bmp.so" +"bmp" 5 "gdk-pixbuf" "The BMP image format" "LGPL" +"image/bmp" "image/x-bmp" "image/x-MS-bmp" "" +"bmp" "" +"BM" "" 100 + +"/usr/lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-gif.so" +"gif" 4 "gdk-pixbuf" "The GIF image format" "LGPL" +"image/gif" "" +"gif" "" +"GIF8" "" 100 + +"/usr/lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-icns.so" +"icns" 4 "gdk-pixbuf" "The ICNS image format" "GPL" +"image/x-icns" "" +"icns" "" +"icns" "" 100 + +"/usr/lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-ico.so" +"ico" 5 "gdk-pixbuf" "The ICO image format" "LGPL" +"image/x-icon" "image/x-ico" "image/x-win-bitmap" "" +"ico" "cur" "" +" \001 " "zz znz" 100 +" \002 " "zz znz" 100 + +"/usr/lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-jasper.so" +"jpeg2000" 4 "gdk-pixbuf" "The JPEG 2000 image format" "LGPL" +"image/jp2" "image/jpeg2000" "image/jpx" "" +"jp2" "jpc" "jpx" "j2k" "jpf" "" +" jP" "!!!! " 100 +"\377O\377Q" "" 100 + +"/usr/lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-jpeg.so" +"jpeg" 5 "gdk-pixbuf" "The JPEG image format" "LGPL" +"image/jpeg" "" +"jpeg" "jpe" "jpg" "" +"\377\330" "" 100 + +"/usr/lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-pcx.so" +"pcx" 4 "gdk-pixbuf" "The PCX image format" "LGPL" +"image/x-pcx" "" +"pcx" "" +"\n \001" "" 100 +"\n\002\001" "" 100 +"\n\003\001" "" 100 +"\n\004\001" "" 100 +"\n\005\001" "" 100 + +"/usr/lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-png.so" +"png" 5 "gdk-pixbuf" "The PNG image format" "LGPL" +"image/png" "" +"png" "" +"\211PNG\r\n\032\n" "" 100 + +"/usr/lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-pnm.so" +"pnm" 4 "gdk-pixbuf" "The PNM/PBM/PGM/PPM image format family" "LGPL" +"image/x-portable-anymap" "image/x-portable-bitmap" "image/x-portable-graymap" "image/x-portable-pixmap" "" +"pnm" "pbm" "pgm" "ppm" "" +"P1" "" 100 +"P2" "" 100 +"P3" "" 100 +"P4" "" 100 +"P5" "" 100 +"P6" "" 100 + +"/usr/lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-qtif.so" +"qtif" 4 "gdk-pixbuf" "The QTIF image format" "LGPL" +"image/x-quicktime" "image/qtif" "" +"qtif" "qif" "" +"abcdidsc" "xxxx " 100 +"abcdidat" "xxxx " 100 + +"/usr/lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-ras.so" +"ras" 4 "gdk-pixbuf" "The Sun raster image format" "LGPL" +"image/x-cmu-raster" "image/x-sun-raster" "" +"ras" "" +"Y\246j\225" "" 100 + +"/usr/lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-tga.so" +"tga" 4 "gdk-pixbuf" "The Targa image format" "LGPL" +"image/x-tga" "" +"tga" "targa" "" +" \001\001" "x " 100 +" \001\t" "x " 100 +" \002" "xz " 99 +" \003" "xz " 100 +" \n" "xz " 100 +" \013" "xz " 100 + +"/usr/lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-tiff.so" +"tiff" 1 "gdk-pixbuf" "The TIFF image format" "LGPL" +"image/tiff" "" +"tiff" "tif" "" +"MM *" " z " 100 +"II* " " z" 100 +"II* \020 CR\002 " " z zzz z" 0 + +"/usr/lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-wbmp.so" +"wbmp" 4 "gdk-pixbuf" "The WBMP image format" "LGPL" +"image/vnd.wap.wbmp" "" +"wbmp" "" +" " "zz" 1 +" `" "z " 1 +" @" "z " 1 +" " "z " 1 + +"/usr/lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-xbm.so" +"xbm" 4 "gdk-pixbuf" "The XBM image format" "LGPL" +"image/x-xbitmap" "" +"xbm" "" +"#define " "" 100 +"/*" "" 50 + +"/usr/lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-xpm.so" +"xpm" 4 "gdk-pixbuf" "The XPM image format" "LGPL" +"image/x-xpixmap" "" +"xpm" "" +"/* XPM */" "" 100 + + diff --git a/packages/addons/addon-depends/gdk-pixbuf/package.mk b/packages/addons/addon-depends/gdk-pixbuf/package.mk new file mode 100644 index 00000000000..29734284a32 --- /dev/null +++ b/packages/addons/addon-depends/gdk-pixbuf/package.mk @@ -0,0 +1,44 @@ +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) +# +# This Program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This Program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with OpenELEC.tv; see the file COPYING. If not, write to +# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. +# http://www.gnu.org/copyleft/gpl.html +################################################################################ + +PKG_NAME="gdk-pixbuf" +PKG_VERSION="2.34.0" +PKG_REV="1" +PKG_ARCH="any" +PKG_LICENSE="OSS" +PKG_SITE="http://www.gtk.org/" +PKG_URL="http://ftp.acc.umu.se/pub/gnome/sources/gdk-pixbuf/2.34/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_DEPENDS_TARGET="toolchain glib libjpeg-turbo libpng jasper tiff" +PKG_PRIORITY="optional" +PKG_SECTION="x11/toolkits" +PKG_SHORTDESC="gdk-pixbuf: a GNOME library for image loading and manipulation." +PKG_LONGDESC="gdk-pixbuf (GdkPixbuf) is a GNOME library for image loading and manipulation. The GdkPixbuf documentation contains both the programmer's guide and the API reference." +PKG_IS_ADDON="no" +PKG_AUTORECONF="yes" + +PKG_CONFIGURE_OPTS_TARGET="gio_can_sniff=yes \ + --disable-gtk-doc \ + --disable-gtk-doc-html \ + --disable-gtk-doc-pdf \ + --disable-man \ + --with-libpng \ + --with-libjpeg \ + --with-libtiff \ + --with-libjasper" diff --git a/packages/addons/addon-depends/gdk-pixbuf/patches/gdk-pixbuf-01_meh.patch b/packages/addons/addon-depends/gdk-pixbuf/patches/gdk-pixbuf-01_meh.patch new file mode 100644 index 00000000000..d43ca77418f --- /dev/null +++ b/packages/addons/addon-depends/gdk-pixbuf/patches/gdk-pixbuf-01_meh.patch @@ -0,0 +1,58 @@ +diff --git a/gdk-pixbuf/Makefile.am b/gdk-pixbuf/Makefile.am +index 8319b49..8f27c5c 100644 +--- a/gdk-pixbuf/Makefile.am ++++ b/gdk-pixbuf/Makefile.am +@@ -617,51 +617,21 @@ MAINTAINERCLEANFILES = \ + # + # gdk-pixbuf-enum-types.h + # +-gdk-pixbuf-enum-types.h: s-enum-types-h ++gdk-pixbuf-enum-types.h: + @true + +-s-enum-types-h: @REBUILD@ $(gdk_pixbuf_headers) gdk-pixbuf-enum-types.h.template +- $(AM_V_GEN)( cd $(srcdir) && $(GLIB_MKENUMS) --template gdk-pixbuf-enum-types.h.template \ +- $(gdk_pixbuf_headers) ) > tmp-gdk-pixbuf-enum-types.h \ +- && (cmp -s tmp-gdk-pixbuf-enum-types.h gdk-pixbuf-enum-types.h || cp tmp-gdk-pixbuf-enum-types.h gdk-pixbuf-enum-types.h ) \ +- && rm -f tmp-gdk-pixbuf-enum-types.h \ +- && echo timestamp > $(@F) +- + CLEANFILES += tmp-gdk-pixbuf-enum-types.h + MAINTAINERCLEANFILES += s-enum-types-h + + # +-# gdk-pixbuf-enum-types.c +-# +-gdk-pixbuf-enum-types.c: @REBUILD@ $(gdk_pixbuf_headers) gdk-pixbuf-enum-types.c.template +- $(AM_V_GEN)(cd $(srcdir) && $(GLIB_MKENUMS) --template gdk-pixbuf-enum-types.c.template \ +- $(gdk_pixbuf_headers)) > gdk-pixbuf-enum-types.c +- +-# + # gdk-pixbuf-marshal.h + # +-gdk-pixbuf-marshal.h: @REBUILD@ stamp-gdk-pixbuf-marshal.h ++gdk-pixbuf-marshal.h: + @true + +-stamp-gdk-pixbuf-marshal.h: @REBUILD@ $(srcdir)/gdk-pixbuf-marshal.list +- $(AM_V_GEN)echo "#if !defined(GDK_PIXBUF_DISABLE_DEPRECATED) || defined(GDK_PIXBUF_COMPILATION)" > xgen-gmh \ +- && $(GLIB_GENMARSHAL) --prefix=_gdk_pixbuf_marshal $(srcdir)/gdk-pixbuf-marshal.list --header >> xgen-gmh \ +- && echo "#endif /* !GDK_PIXBUF_DISABLE_DEPRECATED || GDK_PIXBUF_COMPILATION */" >> xgen-gmh \ +- && (cmp -s xgen-gmh gdk-pixbuf-marshal.h || cp xgen-gmh gdk-pixbuf-marshal.h) \ +- && rm -f xgen-gmh xgen-gmh~ \ +- && echo timestamp > $(@F) +- + CLEANFILES += xgen-gmh + MAINTAINERCLEANFILES += stamp-gdk-pixbuf-marshal.h + +-# +-# gdk-pixbuf-marshal.c +-# +-$(srcdir)/gdk-pixbuf-marshal.c: @REBUILD@ $(srcdir)/gdk-pixbuf-marshal.list +- $(AM_V_GEN)(echo -e "#include \n" | $(GLIB_GENMARSHAL) --prefix=_gdk_pixbuf_marshal $(srcdir)/gdk-pixbuf-marshal.list --body ) >> xgen-gmc \ +- && cp xgen-gmc gdk-pixbuf-marshal.c \ +- && rm -f xgen-gmc xgen-gmc~ +- + CLEANFILES += xgen-gmc + + # if srcdir!=builddir, clean out maintainer-clean files from builddir diff --git a/packages/addons/addon-depends/go/package.mk b/packages/addons/addon-depends/go/package.mk new file mode 100644 index 00000000000..5ced502db98 --- /dev/null +++ b/packages/addons/addon-depends/go/package.mk @@ -0,0 +1,60 @@ +################################################################################ +# This file is part of LibreELEC - https://libreelec.tv +# Copyright (C) 2009-2016 Lukas Rusak (lrusak@libreelec.tv) +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +PKG_NAME="go" +PKG_VERSION="1.6.2" +PKG_REV="1" +PKG_ARCH="any" +PKG_LICENSE="BSD" +PKG_SITE="https://golang.org" +PKG_URL="https://github.com/golang/go/archive/${PKG_NAME}${PKG_VERSION}.tar.gz" +PKG_SOURCE_DIR="${PKG_NAME}-${PKG_NAME}${PKG_VERSION}" +PKG_DEPENDS_HOST="toolchain" +PKG_PRIORITY="optional" +PKG_SECTION="system" +PKG_SHORTDESC="Go is an open source programming language that makes it easy to build simple, reliable, and efficient software." +PKG_LONGDESC="Go is an open source programming language that makes it easy to build simple, reliable, and efficient software." + +PKG_IS_ADDON="no" +PKG_AUTORECONF="no" + +#################################################################### +# On Fedora `dnf install golang` will install go to /usr/lib/golang +# +# On Ubuntu you need to install golang manually, similar to: +# $ wget https://storage.googleapis.com/golang/go1.6.linux-amd64.tar.gz +# $ tar xf go1.6.linux-amd64.tar.gz -C /opt/ +# $ ln -s /opt/go /usr/lib/golang +#################################################################### + +configure_host() { + export GOOS=linux + export GOROOT_FINAL=$ROOT/$TOOLCHAIN/lib/golang + export GOROOT_BOOTSTRAP=/usr/lib/golang + export GOARCH=amd64 +} + +make_host() { + cd $ROOT/$PKG_BUILD/src + bash make.bash --no-banner +} + +makeinstall_host() { + mkdir -p $ROOT/$TOOLCHAIN/lib/golang + cp -av $ROOT/$PKG_BUILD/* $ROOT/$TOOLCHAIN/lib/golang/ +} diff --git a/packages/addons/addon-depends/go/patches/go-0001-add-ca-cert-location.patch b/packages/addons/addon-depends/go/patches/go-0001-add-ca-cert-location.patch new file mode 100644 index 00000000000..39ca1a380f9 --- /dev/null +++ b/packages/addons/addon-depends/go/patches/go-0001-add-ca-cert-location.patch @@ -0,0 +1,11 @@ +diff -Naur a/src/crypto/x509/root_unix.go b/src/crypto/x509/root_unix.go +--- a/src/crypto/x509/root_unix.go 2016-04-19 16:27:35.000000000 -0700 ++++ b/src/crypto/x509/root_unix.go 2016-04-22 01:21:02.884977461 -0700 +@@ -13,6 +13,7 @@ + var certDirectories = []string{ + "/etc/ssl/certs", // SLES10/SLES11, https://golang.org/issue/12139 + "/system/etc/security/cacerts", // Android ++ "/etc/ssl", // LibreELEC + } + + func (c *Certificate) systemVerify(opts *VerifyOptions) (chains [][]*Certificate, err error) { diff --git a/packages/addons/addon-depends/gtk+/package.mk b/packages/addons/addon-depends/gtk+/package.mk new file mode 100644 index 00000000000..195c2c4c2b2 --- /dev/null +++ b/packages/addons/addon-depends/gtk+/package.mk @@ -0,0 +1,57 @@ +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) +# +# This Program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This Program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with OpenELEC.tv; see the file COPYING. If not, write to +# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. +# http://www.gnu.org/copyleft/gpl.html +################################################################################ + +PKG_NAME="gtk+" +PKG_VERSION="2.24.30" +PKG_REV="1" +PKG_ARCH="any" +PKG_LICENSE="OSS" +PKG_SITE="http://www.gtk.org/" +PKG_URL="http://ftp.gnome.org/pub/gnome/sources/gtk+/2.24/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_DEPENDS_TARGET="toolchain atk libX11 libXrandr libXi glib pango cairo gdk-pixbuf" +PKG_PRIORITY="optional" +PKG_SECTION="x11/toolkits" +PKG_SHORTDESC="gtk+: The Gimp ToolKit (GTK)" +PKG_LONGDESC="This is GTK+. GTK+, which stands for the Gimp ToolKit, is a library for creating graphical user interfaces for the X Window System. It is designed to be small, efficient, and flexible. GTK+ is written in C with a very object-oriented approach." +PKG_IS_ADDON="no" + +PKG_AUTORECONF="yes" + +PKG_CONFIGURE_OPTS_TARGET="ac_cv_path_GLIB_GENMARSHAL=$ROOT/$TOOLCHAIN/bin/glib-genmarshal \ + --disable-glibtest \ + --enable-modules \ + --enable-explicit-deps=no \ + --disable-debug \ + --enable-shm \ + --disable-cups \ + --disable-papi \ + --enable-xkb \ + --disable-xinerama \ + --disable-gtk-doc-html \ + --with-xinput" + +make_target() { + make SRC_SUBDIRS="gdk gtk modules" + $MAKEINSTALL SRC_SUBDIRS="gdk gtk modules" +} + +makeinstall_target() { + make install DESTDIR=$INSTALL SRC_SUBDIRS="gdk gtk modules" +} diff --git a/packages/addons/addon-depends/gtk+/patches/gtk+-01_no-gtk-doc.patch b/packages/addons/addon-depends/gtk+/patches/gtk+-01_no-gtk-doc.patch new file mode 100644 index 00000000000..b264b45dbc8 --- /dev/null +++ b/packages/addons/addon-depends/gtk+/patches/gtk+-01_no-gtk-doc.patch @@ -0,0 +1,64 @@ +From fca2ac06da064b133101f215efd5fbd738fb3ef9 Mon Sep 17 00:00:00 2001 +From: Stefan Saraev +Date: Thu, 27 Mar 2014 14:26:27 +0200 +Subject: [PATCH] no gtk-doc + +--- + Makefile.am | 3 +-- + configure.ac | 12 ------------ + 2 files changed, 1 insertions(+), 14 deletions(-) + +diff --git a/Makefile.am b/Makefile.am +index 8e3a2f1..35e94d2 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -2,7 +2,7 @@ + include $(top_srcdir)/Makefile.decl + + SRC_SUBDIRS = gdk gtk modules demos tests perf +-SUBDIRS = po po-properties $(SRC_SUBDIRS) docs m4macros build ++SUBDIRS = po po-properties $(SRC_SUBDIRS) m4macros build + + # require automake 1.4 + AUTOMAKE_OPTIONS = 1.7 +@@ -136,7 +136,6 @@ MAINTAINERCLEANFILES = \ + $(srcdir)/mkinstalldirs \ + $(srcdir)/omf.make \ + $(srcdir)/xmldocs.make \ +- $(srcdir)/gtk-doc.make \ + $(srcdir)/ChangeLog \ + `find "$(srcdir)" -type f -name Makefile.in -print` + +diff --git a/configure.ac b/configure.ac +index 245a87f..f6ede8a 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -1594,8 +1594,6 @@ GOBJECT_INTROSPECTION_CHECK([0.9.3]) + # Checks for gtk-doc and docbook-tools + ################################################## + +-GTK_DOC_CHECK([1.11]) +- + AC_CHECK_PROG(DB2HTML, db2html, true, false) + AM_CONDITIONAL(HAVE_DOCBOOK, $DB2HTML) + +@@ -1727,16 +1725,6 @@ demos/Makefile + demos/gtk-demo/Makefile + demos/gtk-demo/geninclude.pl + tests/Makefile +-docs/Makefile +-docs/reference/Makefile +-docs/reference/gdk/Makefile +-docs/reference/gdk/version.xml +-docs/reference/gtk/Makefile +-docs/reference/gtk/version.xml +-docs/reference/libgail-util/Makefile +-docs/faq/Makefile +-docs/tools/Makefile +-docs/tutorial/Makefile + build/Makefile + build/win32/Makefile + build/win32/vs9/Makefile +-- +1.7.2.5 + diff --git a/packages/addons/addon-depends/gtk+/patches/gtk+-02_meh-glib.patch b/packages/addons/addon-depends/gtk+/patches/gtk+-02_meh-glib.patch new file mode 100644 index 00000000000..7ea8a7f0c44 --- /dev/null +++ b/packages/addons/addon-depends/gtk+/patches/gtk+-02_meh-glib.patch @@ -0,0 +1,34 @@ +From 3cb23c7b05be36e130bd1930dad3382ce8c08c51 Mon Sep 17 00:00:00 2001 +From: Stefan Saraev +Date: Sun, 26 Oct 2014 00:26:09 +0300 +Subject: [PATCH] meh glib + +--- + gdk/Makefile.am | 4 ++-- + 1 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/gdk/Makefile.am b/gdk/Makefile.am +index c880f6e..7661530 100644 +--- a/gdk/Makefile.am ++++ b/gdk/Makefile.am +@@ -307,7 +307,7 @@ lib_LTLIBRARIES = $(gdktargetlib) + + EXTRA_LTLIBRARIES = libgdk-x11-2.0.la libgdk-win32-2.0.la libgdk-quartz-2.0.la libgdk-directfb-2.0.la + +-MAINTAINERCLEANFILES = $(gdk_built_sources) stamp-gdkenumtypes.h ++MAINTAINERCLEANFILES = $(gdk_built_sources) + EXTRA_DIST += $(gdk_built_sources) + EXTRA_HEADERS = + +@@ -333,7 +333,7 @@ BUILT_SOURCES = \ + $(gdk_built_sources) \ + gdkconfig.h + +-gdkenumtypes.h: stamp-gdkenumtypes.h ++gdkenumtypes.h: + @true + stamp-gdkenumtypes.h: @REBUILD@ $(gdk_public_h_sources) gdkenumtypes.h.template + ( cd $(srcdir) && $(GLIB_MKENUMS) --template gdkenumtypes.h.template \ +-- +1.7.2.5 + diff --git a/packages/addons/addon-depends/harfbuzz/package.mk b/packages/addons/addon-depends/harfbuzz/package.mk new file mode 100644 index 00000000000..ebc2a48cdc4 --- /dev/null +++ b/packages/addons/addon-depends/harfbuzz/package.mk @@ -0,0 +1,38 @@ +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) +# +# This Program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This Program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with OpenELEC.tv; see the file COPYING. If not, write to +# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. +# http://www.gnu.org/copyleft/gpl.html +################################################################################ + +PKG_NAME="harfbuzz" +PKG_VERSION="1.2.5" +PKG_REV="1" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="http://www.freedesktop.org/wiki/Software/HarfBuzz" +PKG_URL="http://www.freedesktop.org/software/harfbuzz/release/$PKG_NAME-$PKG_VERSION.tar.bz2" +PKG_DEPENDS_TARGET="toolchain glib freetype cairo" +PKG_PRIORITY="optional" +PKG_SECTION="x11/toolkits" +PKG_SHORTDESC="harfbuzz: an OpenType text shaping engine." +PKG_LONGDESC="HarfBuzz is an OpenType text shaping engine." +PKG_IS_ADDON="no" +PKG_AUTORECONF="yes" + +PKG_MAINTAINER="none" + +PKG_CONFIGURE_OPTS_TARGET="--with-icu=no" diff --git a/packages/graphics/jasper/package.mk b/packages/addons/addon-depends/jasper/package.mk similarity index 100% rename from packages/graphics/jasper/package.mk rename to packages/addons/addon-depends/jasper/package.mk diff --git a/packages/graphics/jasper/patches/jasper-1.900.1-security_fixes-2.patch b/packages/addons/addon-depends/jasper/patches/jasper-1.900.1-security_fixes-2.patch similarity index 100% rename from packages/graphics/jasper/patches/jasper-1.900.1-security_fixes-2.patch rename to packages/addons/addon-depends/jasper/patches/jasper-1.900.1-security_fixes-2.patch diff --git a/packages/addons/addon-depends/libXScrnSaver/package.mk b/packages/addons/addon-depends/libXScrnSaver/package.mk new file mode 100644 index 00000000000..e7ed9de9d30 --- /dev/null +++ b/packages/addons/addon-depends/libXScrnSaver/package.mk @@ -0,0 +1,35 @@ +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) +# +# OpenELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# OpenELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with OpenELEC. If not, see . +################################################################################ + +PKG_NAME="libXScrnSaver" +PKG_VERSION="1.2.2" +PKG_REV="1" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="http://xorg.freedesktop.org/" +PKG_URL="http://xorg.freedesktop.org/releases/individual/lib/$PKG_NAME-$PKG_VERSION.tar.bz2" +PKG_DEPENDS_TARGET="toolchain scrnsaverproto" +PKG_PRIORITY="optional" +PKG_SECTION="x11/lib" +PKG_SHORTDESC="" +PKG_LONGDESC="" + +PKG_IS_ADDON="no" +PKG_AUTORECONF="yes" + +PKG_CONFIGURE_OPTS_TARGET="--enable-static --disable-shared --enable-malloc0returnsnull" diff --git a/packages/addons/addon-depends/libXcursor/package.mk b/packages/addons/addon-depends/libXcursor/package.mk new file mode 100644 index 00000000000..8509afd34e4 --- /dev/null +++ b/packages/addons/addon-depends/libXcursor/package.mk @@ -0,0 +1,37 @@ +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) +# +# This Program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This Program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with OpenELEC.tv; see the file COPYING. If not, write to +# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. +# http://www.gnu.org/copyleft/gpl.html +################################################################################ + +PKG_NAME="libXcursor" +PKG_VERSION="1.1.14" +PKG_REV="1" +PKG_ARCH="any" +PKG_LICENSE="OSS" +PKG_SITE="http://www.X.org" +PKG_URL="http://xorg.freedesktop.org/archive/individual/lib/$PKG_NAME-$PKG_VERSION.tar.bz2" +PKG_DEPENDS_TARGET="toolchain libX11 libXfixes libXrender" +PKG_PRIORITY="optional" +PKG_SECTION="x11/lib" +PKG_SHORTDESC="libXcursor: X Cursor Library" +PKG_LONGDESC="X11 Cursor management library" + +PKG_IS_ADDON="no" +PKG_AUTORECONF="yes" + +PKG_CONFIGURE_OPTS_TARGET="--disable-shared --enable-static" diff --git a/packages/addons/addon-depends/libXft/package.mk b/packages/addons/addon-depends/libXft/package.mk new file mode 100644 index 00000000000..52b06c58a3f --- /dev/null +++ b/packages/addons/addon-depends/libXft/package.mk @@ -0,0 +1,35 @@ +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) +# +# OpenELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# OpenELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with OpenELEC. If not, see . +################################################################################ + +PKG_NAME="libXft" +PKG_VERSION="2.3.2" +PKG_REV="1" +PKG_ARCH="any" +PKG_LICENSE="OSS" +PKG_SITE="http://www.X.org" +PKG_URL="http://xorg.freedesktop.org/archive/individual/lib/$PKG_NAME-$PKG_VERSION.tar.bz2" +PKG_DEPENDS_TARGET="toolchain util-macros xproto libXrender fontconfig freetype" +PKG_PRIORITY="optional" +PKG_SECTION="x11/lib" +PKG_SHORTDESC="libxft: X FreeType library" +PKG_LONGDESC="X FreeType library" + +PKG_IS_ADDON="no" +PKG_AUTORECONF="yes" + +PKG_CONFIGURE_OPTS_TARGET="--enable-static --disable-shared" diff --git a/packages/addons/addon-depends/libconfig/package.mk b/packages/addons/addon-depends/libconfig/package.mk new file mode 100644 index 00000000000..0f2db98b352 --- /dev/null +++ b/packages/addons/addon-depends/libconfig/package.mk @@ -0,0 +1,38 @@ +################################################################################# +# This file is part of LibreELEC - https://libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +PKG_NAME="libconfig" +PKG_VERSION="1.5" +PKG_REV="1" +PKG_ARCH="any" +PKG_LICENSE="LGPL" +PKG_SITE="http://hyperrealm.com/libconfig/libconfig.html" +PKG_URL="https://github.com/hyperrealm/libconfig/archive/v$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain" +PKG_PRIORITY="optional" +PKG_SECTION="lib" +PKG_SHORTDESC="C/C++ Configuration File Library" +PKG_LONGDESC="C/C++ Configuration File Library" + +PKG_IS_ADDON="no" +PKG_AUTORECONF="yes" + +PKG_CONFIGURE_OPTS_TARGET="--enable-static \ + --disable-shared \ + --disable-examples \ + --with-sysroot=$SYSROOT_PREFIX" diff --git a/packages/addons/addon-depends/libconfig/patches/libconfig-0001_fix-include.patch b/packages/addons/addon-depends/libconfig/patches/libconfig-0001_fix-include.patch new file mode 100644 index 00000000000..79b0a2e00f6 --- /dev/null +++ b/packages/addons/addon-depends/libconfig/patches/libconfig-0001_fix-include.patch @@ -0,0 +1,12 @@ +diff -Naur a/tests/Makefile.am b/tests/Makefile.am +--- a/tests/Makefile.am 2014-03-04 03:04:17.000000000 +0100 ++++ b/tests/Makefile.am 2016-01-22 21:22:38.742833399 +0100 +@@ -3,7 +3,7 @@ + + libconfig_tests_SOURCES = tests.c + +-libconfig_tests_CPPFLAGS = -I$(top_srcdir)/tinytest -I../lib ++libconfig_tests_CPPFLAGS = -I$(top_srcdir)/tinytest -I$(top_srcdir)/lib + + libconfig_tests_LDADD = -L$(top_builddir)/tinytest -ltinytest \ + -L$(top_builddir)/lib/.libs -lconfig diff --git a/packages/multimedia/libdvbcsa/package.mk b/packages/addons/addon-depends/libdvbcsa/package.mk similarity index 65% rename from packages/multimedia/libdvbcsa/package.mk rename to packages/addons/addon-depends/libdvbcsa/package.mk index a011149db27..16ec77f1748 100644 --- a/packages/multimedia/libdvbcsa/package.mk +++ b/packages/addons/addon-depends/libdvbcsa/package.mk @@ -17,12 +17,13 @@ ################################################################################ PKG_NAME="libdvbcsa" -PKG_VERSION="1.1.0" +PKG_VERSION="f988715" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="LGPL" PKG_SITE="http://www.videolan.org/developers/libdvbcsa.html" -PKG_URL="http://download.videolan.org/pub/videolan/libdvbcsa/${PKG_VERSION}/libdvbcsa-${PKG_VERSION}.tar.gz" +PKG_SITE="https://github.com/glenvt18/libdvbcsa/" +PKG_URL="https://github.com/glenvt18/libdvbcsa/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain" PKG_PRIORITY="optional" PKG_SECTION="lib" @@ -33,3 +34,23 @@ PKG_IS_ADDON="no" PKG_AUTORECONF="yes" PKG_CONFIGURE_OPTS_TARGET="--disable-shared --enable-static --with-sysroot=$SYSROOT_PREFIX" + +if echo "$TARGET_FPU" | grep -q '^neon'; then + PKG_CONFIGURE_OPTS_TARGET="$PKG_CONFIGURE_OPTS_TARGET --enable-neon" +elif [ "$TARGET_ARCH" = x86_64 ]; then + if echo "$PROJECT_CFLAGS" | grep -q '\-mssse3'; then + PKG_CONFIGURE_OPTS_TARGET="$PKG_CONFIGURE_OPTS_TARGET --enable-ssse3" + elif echo "$PROJECT_CFLAGS" | grep -q '\-msse2'; then + PKG_CONFIGURE_OPTS_TARGET="$PKG_CONFIGURE_OPTS_TARGET --enable-sse2" + else + PKG_CONFIGURE_OPTS_TARGET="$PKG_CONFIGURE_OPTS_TARGET --enable-uint64" + fi +fi + +pre_configure_target() { +# libdvbcsa is a bit faster without LTO, and tests will fail with gcc-5.x + strip_lto + + export CFLAGS="$CFLAGS -fPIC" +} + diff --git a/packages/multimedia/libmpeg2/package.mk b/packages/addons/addon-depends/libexif/package.mk similarity index 62% rename from packages/multimedia/libmpeg2/package.mk rename to packages/addons/addon-depends/libexif/package.mk index d52ec85ccea..9c0ef0e5551 100644 --- a/packages/multimedia/libmpeg2/package.mk +++ b/packages/addons/addon-depends/libexif/package.mk @@ -1,6 +1,6 @@ ################################################################################ # This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) # # OpenELEC is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -16,25 +16,18 @@ # along with OpenELEC. If not, see . ################################################################################ -PKG_NAME="libmpeg2" -PKG_VERSION="0.5.1" +PKG_NAME="libexif" +PKG_VERSION="0.6.21" PKG_REV="1" PKG_ARCH="any" -PKG_LICENSE="GPL" -PKG_SITE="http://libmpeg2.sourceforge.net/" -PKG_URL="http://libmpeg2.sourceforge.net/files/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_LICENSE="LGPL" +PKG_SITE="http://sourceforge.net/projects/libexif" +PKG_URL="http://downloads.sf.net/sourceforge/$PKG_NAME/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS_TARGET="toolchain" PKG_PRIORITY="optional" -PKG_SECTION="multimedia" -PKG_SHORTDESC="libmpeg2: The MPEG Library - version 2" -PKG_LONGDESC="The MPEG Library is a collection of C routines to decode MPEG-1 and MPEG-2 movies and dither them in a variety of colour schemes." -PKG_IS_ADDON="no" +PKG_SECTION="lib" +PKG_SHORTDESC="A library to parse an EXIF file and read the data from those tags" +PKG_LONGDESC="A library to parse an EXIF file and read the data from those tags" +PKG_IS_ADDON="no" PKG_AUTORECONF="yes" - -PKG_CONFIGURE_OPTS_TARGET="--disable-sdl --without-x" - -post_makeinstall_target() { - rm -rf $INSTALL/usr/bin -} - diff --git a/packages/addons/addon-depends/libiconv/package.mk b/packages/addons/addon-depends/libiconv/package.mk new file mode 100644 index 00000000000..b8f658c0e7c --- /dev/null +++ b/packages/addons/addon-depends/libiconv/package.mk @@ -0,0 +1,45 @@ +################################################################################ +# This file is part of LibreELEC - https://LibreELEC.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +PKG_NAME="libiconv" +PKG_VERSION="1.14" +PKG_REV="1" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="https://savannah.gnu.org/projects/libiconv/" +PKG_URL="http://ftp.gnu.org/pub/gnu/libiconv/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain" +PKG_PRIORITY="optional" +PKG_SECTION="devel" +PKG_SHORTDESC="Libiconv converts from one character encoding to another through Unicode conversion." +PKG_LONGDESC="Libiconv converts from one character encoding to another through Unicode conversion." + +PKG_IS_ADDON="no" +PKG_AUTORECONF="no" + +PKG_CONFIGURE_OPTS_TARGET="--host=$TARGET_NAME \ + --build=$HOST_NAME \ + --prefix=/usr \ + --includedir=/usr/include/iconv \ + --libdir=/usr/lib/iconv \ + --sysconfdir=/etc \ + --enable-static \ + --disable-shared \ + --disable-nls \ + --disable-extra-encodings \ + --with-gnu-ld" diff --git a/packages/addons/addon-depends/libiconv/patches/libiconv-glibc-fix-2.16.patch b/packages/addons/addon-depends/libiconv/patches/libiconv-glibc-fix-2.16.patch new file mode 100644 index 00000000000..e89c25ef96f --- /dev/null +++ b/packages/addons/addon-depends/libiconv/patches/libiconv-glibc-fix-2.16.patch @@ -0,0 +1,16 @@ +from +http://www.itkb.ro/kb/linux/patch-libiconv-pentru-glibc-216 + +--- a/srclib/stdio.in.h.orig 2011-08-07 16:42:06.000000000 +0300 ++++ b/srclib/stdio.in.h 2013-01-10 15:53:03.000000000 +0200 +@@ -695,7 +695,9 @@ + /* It is very rare that the developer ever has full control of stdin, + so any use of gets warrants an unconditional warning. Assume it is + always declared, since it is required by C89. */ +-_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead"); ++#if defined(__GLIBC__) && !defined(__UCLIBC__) && !__GLIBC_PREREQ(2, 16) ++ _GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead"); ++#endif + #endif + + diff --git a/packages/addons/addon-depends/libid3tag/package.mk b/packages/addons/addon-depends/libid3tag/package.mk new file mode 100644 index 00000000000..d261f6a893e --- /dev/null +++ b/packages/addons/addon-depends/libid3tag/package.mk @@ -0,0 +1,39 @@ +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) +# +# This Program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This Program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with OpenELEC.tv; see the file COPYING. If not, write to +# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. +# http://www.gnu.org/copyleft/gpl.html +################################################################################ + +PKG_NAME="libid3tag" +PKG_VERSION="0.15.1b" +PKG_REV="1" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="http://www.mars.org/home/rob/proj/mpeg/" +PKG_URL="$SOURCEFORGE_SRC/mad/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain zlib" +PKG_PRIORITY="optional" +PKG_SECTION="audio" +PKG_SHORTDESC="library for id3 tagging" +PKG_LONGDESC="library for id3 tagging" +PKG_IS_ADDON="no" + +PKG_AUTORECONF="yes" + +PKG_MAINTAINER="Lukas Sabota (LTsmooth42@gmail.com)" + +PKG_CONFIGURE_OPTS_TARGET="--enable-static --disable-shared" diff --git a/packages/addons/addon-depends/libmad/package.mk b/packages/addons/addon-depends/libmad/package.mk new file mode 100644 index 00000000000..338709635bb --- /dev/null +++ b/packages/addons/addon-depends/libmad/package.mk @@ -0,0 +1,56 @@ +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) +# +# OpenELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# OpenELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with OpenELEC. If not, see . +################################################################################ + +PKG_NAME="libmad" +PKG_VERSION="0.15.1b" +PKG_REV="1" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="http://www.mars.org/home/rob/proj/mpeg/" +PKG_URL="$SOURCEFORGE_SRC/mad/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain" +PKG_PRIORITY="optional" +PKG_SECTION="audio" +PKG_SHORTDESC="libmad: MPEG Audio Decoder" +PKG_LONGDESC="MAD is a high-quality MPEG audio decoder. It currently supports MPEG-1 and the MPEG-2 extension to Lower Sampling Frequencies, as well as the so-called MPEG 2.5 format. All three audio layers (Layer I, Layer II, and Layer III a.k.a. MP3) are fully implemented." + +PKG_IS_ADDON="no" +PKG_AUTORECONF="yes" + +# package specific configure options +PKG_CONFIGURE_OPTS_TARGET="--enable-static --disable-shared" +if [ "$TARGET_ARCH" = "x86_64" ] ; then + PKG_CONFIGURE_OPTS_TARGET="$PKG_CONFIGURE_OPTS_TARGET --enable-accuracy --enable-fpm=64bit" +fi + +post_makeinstall_target() { + mkdir -p $SYSROOT_PREFIX/usr/lib/pkgconfig + cat > $SYSROOT_PREFIX/usr/lib/pkgconfig/mad.pc << "EOF" +prefix=/usr +exec_prefix=${prefix} +libdir=${exec_prefix}/lib +includedir=${prefix}/include + +Name: mad +Description: MPEG audio decoder +Requires: +Version: 0.15.1b +Libs: -L${libdir} -lmad +Cflags: -I${includedir} +EOF +} diff --git a/packages/addons/addon-depends/libmad/patches/libmad-0.15.1b-automake_1.13.patch b/packages/addons/addon-depends/libmad/patches/libmad-0.15.1b-automake_1.13.patch new file mode 100644 index 00000000000..270ff8156bc --- /dev/null +++ b/packages/addons/addon-depends/libmad/patches/libmad-0.15.1b-automake_1.13.patch @@ -0,0 +1,12 @@ +diff -Naur libmad-0.15.1b-old/configure.ac libmad-0.15.1b-new/configure.ac +--- libmad-0.15.1b-old/configure.ac 2004-01-23 01:41:32.000000000 -0800 ++++ libmad-0.15.1b-new/configure.ac 2012-12-30 15:14:37.000000000 -0800 +@@ -28,7 +28,7 @@ + + AM_INIT_AUTOMAKE + +-AM_CONFIG_HEADER([config.h]) ++AC_CONFIG_HEADERS([config.h]) + + dnl System type. + diff --git a/packages/addons/addon-depends/libmad/patches/libmad-0.15.1b-cflags-O2.patch b/packages/addons/addon-depends/libmad/patches/libmad-0.15.1b-cflags-O2.patch new file mode 100644 index 00000000000..61b4b13bd73 --- /dev/null +++ b/packages/addons/addon-depends/libmad/patches/libmad-0.15.1b-cflags-O2.patch @@ -0,0 +1,12 @@ +diff -Naur libmad-0.15.1b-orig/configure.ac libmad-0.15.1b/configure.ac +--- libmad-0.15.1b-orig/configure.ac 2007-07-01 12:58:13.000000000 -0600 ++++ libmad-0.15.1b/configure.ac 2007-07-01 12:59:13.000000000 -0600 +@@ -105,7 +105,7 @@ + shift + ;; + -O2) +- optimize="-O" ++ optimize="-O2" + shift + ;; + -fomit-frame-pointer) diff --git a/packages/addons/addon-depends/libmad/patches/libmad-0.15.1b-cflags.patch b/packages/addons/addon-depends/libmad/patches/libmad-0.15.1b-cflags.patch new file mode 100644 index 00000000000..2ec44e34456 --- /dev/null +++ b/packages/addons/addon-depends/libmad/patches/libmad-0.15.1b-cflags.patch @@ -0,0 +1,146 @@ +diff -Naur libmad-0.15.1b-orig/configure.ac libmad-0.15.1b/configure.ac +--- libmad-0.15.1b-orig/configure.ac 2007-06-30 20:22:31.000000000 -0600 ++++ libmad-0.15.1b/configure.ac 2007-06-30 20:25:31.000000000 -0600 +@@ -122,74 +122,74 @@ + esac + done + +-if test "$GCC" = yes +-then +- if test -z "$arch" +- then +- case "$host" in +- i386-*) ;; +- i?86-*) arch="-march=i486" ;; +- arm*-empeg-*) arch="-march=armv4 -mtune=strongarm1100" ;; +- armv4*-*) arch="-march=armv4 -mtune=strongarm" ;; +- powerpc-*) ;; +- mips*-agenda-*) arch="-mcpu=vr4100" ;; +- mips*-luxsonor-*) arch="-mips1 -mcpu=r3000 -Wa,-m4010" ;; +- esac +- fi +- +- case "$optimize" in +- -O|"-O "*) +- optimize="-O" +- optimize="$optimize -fforce-mem" +- optimize="$optimize -fforce-addr" +- : #x optimize="$optimize -finline-functions" +- : #- optimize="$optimize -fstrength-reduce" +- optimize="$optimize -fthread-jumps" +- optimize="$optimize -fcse-follow-jumps" +- optimize="$optimize -fcse-skip-blocks" +- : #x optimize="$optimize -frerun-cse-after-loop" +- : #x optimize="$optimize -frerun-loop-opt" +- : #x optimize="$optimize -fgcse" +- optimize="$optimize -fexpensive-optimizations" +- optimize="$optimize -fregmove" +- : #* optimize="$optimize -fdelayed-branch" +- : #x optimize="$optimize -fschedule-insns" +- optimize="$optimize -fschedule-insns2" +- : #? optimize="$optimize -ffunction-sections" +- : #? optimize="$optimize -fcaller-saves" +- : #> optimize="$optimize -funroll-loops" +- : #> optimize="$optimize -funroll-all-loops" +- : #x optimize="$optimize -fmove-all-movables" +- : #x optimize="$optimize -freduce-all-givs" +- : #? optimize="$optimize -fstrict-aliasing" +- : #* optimize="$optimize -fstructure-noalias" +- +- case "$host" in +- arm*-*) +- optimize="$optimize -fstrength-reduce" +- ;; +- mips*-*) +- optimize="$optimize -fstrength-reduce" +- optimize="$optimize -finline-functions" +- ;; +- i?86-*) +- optimize="$optimize -fstrength-reduce" +- ;; +- powerpc-apple-*) +- # this triggers an internal compiler error with gcc2 +- : #optimize="$optimize -fstrength-reduce" +- +- # this is really only beneficial with gcc3 +- : #optimize="$optimize -finline-functions" +- ;; +- *) +- # this sometimes provokes bugs in gcc 2.95.2 +- : #optimize="$optimize -fstrength-reduce" +- ;; +- esac +- ;; +- esac +-fi ++#if test "$GCC" = yes ++#then ++# if test -z "$arch" ++# then ++# case "$host" in ++# i386-*) ;; ++# i?86-*) arch="-march=i486" ;; ++# arm*-empeg-*) arch="-march=armv4 -mtune=strongarm1100" ;; ++# armv4*-*) arch="-march=armv4 -mtune=strongarm" ;; ++# powerpc-*) ;; ++# mips*-agenda-*) arch="-mcpu=vr4100" ;; ++# mips*-luxsonor-*) arch="-mips1 -mcpu=r3000 -Wa,-m4010" ;; ++# esac ++# fi ++# ++# case "$optimize" in ++# -O|"-O "*) ++# optimize="-O" ++# optimize="$optimize -fforce-mem" ++# optimize="$optimize -fforce-addr" ++# : #x optimize="$optimize -finline-functions" ++# : #- optimize="$optimize -fstrength-reduce" ++# optimize="$optimize -fthread-jumps" ++# optimize="$optimize -fcse-follow-jumps" ++# optimize="$optimize -fcse-skip-blocks" ++# : #x optimize="$optimize -frerun-cse-after-loop" ++# : #x optimize="$optimize -frerun-loop-opt" ++# : #x optimize="$optimize -fgcse" ++# optimize="$optimize -fexpensive-optimizations" ++# optimize="$optimize -fregmove" ++# : #* optimize="$optimize -fdelayed-branch" ++# : #x optimize="$optimize -fschedule-insns" ++# optimize="$optimize -fschedule-insns2" ++# : #? optimize="$optimize -ffunction-sections" ++# : #? optimize="$optimize -fcaller-saves" ++# : #> optimize="$optimize -funroll-loops" ++# : #> optimize="$optimize -funroll-all-loops" ++# : #x optimize="$optimize -fmove-all-movables" ++# : #x optimize="$optimize -freduce-all-givs" ++# : #? optimize="$optimize -fstrict-aliasing" ++# : #* optimize="$optimize -fstructure-noalias" ++# ++# case "$host" in ++# arm*-*) ++# optimize="$optimize -fstrength-reduce" ++# ;; ++# mips*-*) ++# optimize="$optimize -fstrength-reduce" ++# optimize="$optimize -finline-functions" ++# ;; ++# i?86-*) ++# optimize="$optimize -fstrength-reduce" ++# ;; ++# powerpc-apple-*) ++# # this triggers an internal compiler error with gcc2 ++# : #optimize="$optimize -fstrength-reduce" ++# ++# # this is really only beneficial with gcc3 ++# : #optimize="$optimize -finline-functions" ++# ;; ++# *) ++# # this sometimes provokes bugs in gcc 2.95.2 ++# : #optimize="$optimize -fstrength-reduce" ++# ;; ++# esac ++# ;; ++# esac ++#fi + + case "$host" in + mips*-agenda-*) diff --git a/packages/mediacenter/kodi-language-addons/package.mk b/packages/addons/addon-depends/libva-vdpau-driver/package.mk similarity index 68% rename from packages/mediacenter/kodi-language-addons/package.mk rename to packages/addons/addon-depends/libva-vdpau-driver/package.mk index 0862ac7f859..613285ee402 100644 --- a/packages/mediacenter/kodi-language-addons/package.mk +++ b/packages/addons/addon-depends/libva-vdpau-driver/package.mk @@ -16,27 +16,22 @@ # along with OpenELEC. If not, see . ################################################################################ -PKG_NAME="kodi-language-addons" -PKG_VERSION="ce9947c" +PKG_NAME="libva-vdpau-driver" +PKG_VERSION="0.7.4" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" -PKG_SITE="https://github.com/xbmc/repo-resources" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" -PKG_DEPENDS_TARGET="toolchain" +PKG_SITE="http://freedesktop.org/wiki/Software/vaapi" +PKG_URL="http://freedesktop.org/software/vaapi/releases/$PKG_NAME/$PKG_NAME-$PKG_VERSION.tar.bz2" +PKG_DEPENDS_TARGET="toolchain libva libvdpau mesa" PKG_PRIORITY="optional" -PKG_SECTION="mediacenter" -PKG_SHORTDESC="kodi language add-ons" -PKG_LONGDESC="kodi language add-ons" +PKG_SECTION="graphics" +PKG_SHORTDESC="VDPAU backend for VA API" +PKG_LONGDESC="VDPAU backend for VA API" -PKG_AUTORECONF="no" PKG_IS_ADDON="no" +PKG_AUTORECONF="yes" -make_target() { - : -} - -makeinstall_target() { - mkdir -p $INSTALL/usr/share/kodi/addons/ - cp -PR $ROOT/$PKG_BUILD/* $INSTALL/usr/share/kodi/addons/ +post_makeinstall_target() { + rm -rf $INSTALL/usr/lib/va/s3g_drv_video.so } diff --git a/packages/addons/addon-depends/libva-vdpau-driver/patches/libva-vdpau-driver-0001_drop-formats.patch b/packages/addons/addon-depends/libva-vdpau-driver/patches/libva-vdpau-driver-0001_drop-formats.patch new file mode 100644 index 00000000000..74caee3483d --- /dev/null +++ b/packages/addons/addon-depends/libva-vdpau-driver/patches/libva-vdpau-driver-0001_drop-formats.patch @@ -0,0 +1,29 @@ +>From fda3706eb74ba5ad874853969f3df3e372739c8d Mon Sep 17 00:00:00 2001 +From: "Xiang, Haihao" +Date: Fri, 21 Jun 2013 12:55:30 +0800 +Subject: [PATCH] VAEncH264VUIBufferType and VAEncH264SEIBufferType are + dropped from VA API + +The driver doesn't use them indeed + +Signed-off-by: Xiang, Haihao +--- + src/vdpau_dump.c | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/src/vdpau_dump.c b/src/vdpau_dump.c +index 899888b..610e7cd 100644 +--- a/src/vdpau_dump.c ++++ b/src/vdpau_dump.c +@@ -59,8 +59,6 @@ const char *string_of_VABufferType(VABufferType type) + _(VAEncSequenceParameterBufferType); + _(VAEncPictureParameterBufferType); + _(VAEncSliceParameterBufferType); +- _(VAEncH264VUIBufferType); +- _(VAEncH264SEIBufferType); + #endif + #if VA_CHECK_VERSION(0,31,1) + _(VAQMatrixBufferType); +-- +1.7.9.5 + diff --git a/packages/addons/addon-depends/libva-vdpau-driver/patches/libva-vdpau-driver-0002_glext-missing-definition.patch b/packages/addons/addon-depends/libva-vdpau-driver/patches/libva-vdpau-driver-0002_glext-missing-definition.patch new file mode 100644 index 00000000000..b56d2683430 --- /dev/null +++ b/packages/addons/addon-depends/libva-vdpau-driver/patches/libva-vdpau-driver-0002_glext-missing-definition.patch @@ -0,0 +1,16 @@ +--- a/src/utils_glx.h~ 2012-10-05 16:02:58.000000000 +0100 ++++ b/src/utils_glx.h 2012-10-19 08:44:12.469642440 +0100 +@@ -48,6 +48,13 @@ + typedef void (*PFNGLXRELEASETEXIMAGEEXTPROC)(Display *, GLXDrawable, int); + #endif + ++#if GL_GLEXT_VERSION >= 85 ++/* XXX: PFNGLMULTITEXCOORD2FPROC got out of the GL_VERSION_1_3_DEPRECATED ++ block and is not defined if GL_VERSION_1_3 is defined in ++ Redefine the type here as an interim solution */ ++typedef void (*PFNGLMULTITEXCOORD2FPROC) (GLenum target, GLfloat s, GLfloat t); ++#endif ++ + #ifndef GL_FRAMEBUFFER_BINDING + #define GL_FRAMEBUFFER_BINDING GL_FRAMEBUFFER_BINDING_EXT + #endif diff --git a/packages/addons/addon-depends/libva-vdpau-driver/patches/libva-vdpau-driver-0003_libvdpau-0.8.patch b/packages/addons/addon-depends/libva-vdpau-driver/patches/libva-vdpau-driver-0003_libvdpau-0.8.patch new file mode 100644 index 00000000000..ab3a4799863 --- /dev/null +++ b/packages/addons/addon-depends/libva-vdpau-driver/patches/libva-vdpau-driver-0003_libvdpau-0.8.patch @@ -0,0 +1,11 @@ +--- a/src/vdpau_decode.c ++++ b/src/vdpau_decode.c +@@ -1289,7 +1289,7 @@ + driver_data, + obj_context->vdp_decoder, + obj_surface->vdp_surface, +- (VdpPictureInfo)&obj_context->vdp_picture_info, ++ (VdpPictureInfo *)&obj_context->vdp_picture_info, + obj_context->vdp_bitstream_buffers_count, + obj_context->vdp_bitstream_buffers + ); diff --git a/packages/addons/addon-depends/libvncserver/package.mk b/packages/addons/addon-depends/libvncserver/package.mk new file mode 100644 index 00000000000..fb858e52fdd --- /dev/null +++ b/packages/addons/addon-depends/libvncserver/package.mk @@ -0,0 +1,47 @@ +################################################################################ +# This file is part of LibreELEC - https://libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +PKG_NAME="libvncserver" +PKG_VERSION="0.9.10" +PKG_REV="0" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="https://libvnc.github.io/" +PKG_URL="https://github.com/LibVNC/libvncserver/archive/LibVNCServer-$PKG_VERSION.tar.gz" +PKG_SOURCE_DIR="libvncserver-LibVNCServer-$PKG_VERSION" +PKG_DEPENDS_TARGET="toolchain libjpeg-turbo libpng" +PKG_SECTION="libs" +PKG_PRIORITY="optional" +PKG_SHORTDESC="LibVNCServer/LibVNCClient are cross-platform C libraries that allow you to easily implement VNC server or client functionality in your program." +PKG_LONGDESC="LibVNCServer/LibVNCClient are cross-platform C libraries that allow you to easily implement VNC server or client functionality in your program." + +PKG_IS_ADDON="no" + +PKG_AUTORECONF="yes" + +PKG_MAINTAINER="Lukas Rusak (lrusak at irc.freenode.net)" + +PKG_CONFIGURE_OPTS_TARGET="--disable-shared \ + --enable-static \ + --with-sysroot=$SYSROOT_PREFIX \ + --with-jpeg \ + --with-png \ + --without-sdl \ + --without-gcrypt \ + --without-client-gcrypt \ + --without-gnutls" diff --git a/packages/3rdparty/lib/libzip/package.mk b/packages/addons/addon-depends/libzip/package.mk similarity index 100% rename from packages/3rdparty/lib/libzip/package.mk rename to packages/addons/addon-depends/libzip/package.mk diff --git a/packages/addons/addon-depends/moonlight-common-c/package.mk b/packages/addons/addon-depends/moonlight-common-c/package.mk new file mode 100644 index 00000000000..f8f506266ff --- /dev/null +++ b/packages/addons/addon-depends/moonlight-common-c/package.mk @@ -0,0 +1,41 @@ +################################################################################ +# This file is part of LibreELEC - https://libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +PKG_NAME="moonlight-common-c" +PKG_VERSION="a6d9ab0" +PKG_REV="1" +PKG_ARCH="any" +PKG_LICENSE="GPLv3" +PKG_SITE="https://github.com/irtimmer/moonlight-common-c" +PKG_URL="https://github.com/irtimmer/moonlight-common-c/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain" +PKG_PRIORITY="optional" +PKG_SECTION="" +PKG_SHORTDESC="Shared C code for the implementation of Nvidia's GameStream protocol" +PKG_LONGDESC="Shared C code for the implementation of Nvidia's GameStream protocol" + +PKG_IS_ADDON="no" +PKG_AUTORECONF="no" + +make_target() { + : +} + +makeinstall_target() { + : +} diff --git a/packages/addons/addon-depends/moonlight-embedded/package.mk b/packages/addons/addon-depends/moonlight-embedded/package.mk new file mode 100644 index 00000000000..3f9ac4b1ef4 --- /dev/null +++ b/packages/addons/addon-depends/moonlight-embedded/package.mk @@ -0,0 +1,59 @@ +################################################################################ +# This file is part of LibreELEC - https://libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +PKG_NAME="moonlight-embedded" +PKG_VERSION="2.2.0" +PKG_REV="1" +PKG_ARCH="any" +PKG_LICENSE="GPLv3" +PKG_SITE="https://github.com/irtimmer/moonlight-embedded" +PKG_URL="https://github.com/irtimmer/moonlight-embedded/archive/v$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain curl libcec pulseaudio ffmpeg systemd alsa-lib moonlight-common-c libevdev enet opus" +PKG_PRIORITY="optional" +PKG_SECTION="" +PKG_SHORTDESC="Gamestream client for embedded systems" +PKG_LONGDESC="Moonlight Embedded is an open source implementation of NVIDIA's GameStream, as used by the NVIDIA Shield, but built for Linux" + +PKG_IS_ADDON="no" +PKG_AUTORECONF="no" + +if [ "$KODIPLAYER_DRIVER" = "bcm2835-driver" ]; then + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET bcm2835-driver" +elif [ "$KODIPLAYER_DRIVER" = "libfslvpuwrap" ]; then + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET imx-gpu-viv" +elif [ "$KODIPLAYER_DRIVER" = "libamcodec" ]; then + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET libamcodec" +elif [ "$DISPLAYSERVER" = "x11" ]; then + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET libvdpau SDL2 ffmpeg libxcb" +fi + +pre_build_target() { + cp -a $(get_build_dir moonlight-common-c)/* $ROOT/$PKG_BUILD/third_party/moonlight-common-c +} + +configure_target() { + cmake -DCMAKE_TOOLCHAIN_FILE=$CMAKE_CONF \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DCMAKE_INSTALL_LIBDIR=/usr/lib \ + -DCMAKE_PREFIX_PATH=$SYSROOT_PREFIX/usr \ + .. +} + +makeinstall_target() { + : +} diff --git a/packages/addons/addon-depends/moonlight-embedded/patches/moonlight-embedded-0001-link-against-libm.patch b/packages/addons/addon-depends/moonlight-embedded/patches/moonlight-embedded-0001-link-against-libm.patch new file mode 100644 index 00000000000..51800817149 --- /dev/null +++ b/packages/addons/addon-depends/moonlight-embedded/patches/moonlight-embedded-0001-link-against-libm.patch @@ -0,0 +1,12 @@ +diff -Naur a/CMakeLists.txt b/CMakeLists.txt +--- a/CMakeLists.txt 2016-04-03 05:34:15.000000000 -0700 ++++ b/CMakeLists.txt 2016-05-04 14:33:19.840052271 -0700 +@@ -139,7 +139,7 @@ + + set_property(TARGET moonlight PROPERTY COMPILE_DEFINITIONS ${MOONLIGHT_DEFINITIONS}) + target_include_directories(moonlight PRIVATE ${GAMESTREAM_INCLUDE_DIR} ${MOONLIGHT_COMMON_INCLUDE_DIR} ${OPUS_INCLUDE_DIRS} ${EVDEV_INCLUDE_DIRS} ${UDEV_INCLUDE_DIRS}) +-target_link_libraries(moonlight ${EVDEV_LIBRARIES} ${ALSA_LIBRARY} ${OPUS_LIBRARY} ${UDEV_LIBRARIES} ${CMAKE_DL_LIBS}) ++target_link_libraries(moonlight ${EVDEV_LIBRARIES} ${ALSA_LIBRARY} ${OPUS_LIBRARY} ${UDEV_LIBRARIES} ${CMAKE_DL_LIBS} m) + + add_subdirectory(docs) + diff --git a/packages/addons/addon-depends/multimedia-tools-depends/depends/libmediainfo/package.mk b/packages/addons/addon-depends/multimedia-tools-depends/depends/libmediainfo/package.mk new file mode 100644 index 00000000000..2477963f9a4 --- /dev/null +++ b/packages/addons/addon-depends/multimedia-tools-depends/depends/libmediainfo/package.mk @@ -0,0 +1,59 @@ +################################################################################ +# This file is part of LibreELEC - http://www.libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +PKG_NAME="libmediainfo" +PKG_VERSION="0.7.83" +PKG_REV="1" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="http://mediaarea.net/en/MediaInfo/Download/Source" +PKG_URL="http://mediaarea.net/download/source/libmediainfo/$PKG_VERSION/libmediainfo_$PKG_VERSION.tar.bz2" +PKG_SOURCE_DIR="MediaInfoLib" +PKG_DEPENDS_TARGET="toolchain libzen zlib" +PKG_PRIORITY="optional" +PKG_SECTION="multimedia" +PKG_SHORTDESC="MediaInfo is a convenient unified display of the most relevant technical and tag data for video and audio files" +PKG_LONGDESC="MediaInfo is a convenient unified display of the most relevant technical and tag data for video and audio files" +PKG_IS_ADDON="no" +PKG_AUTORECONF="no" + + +make_target() { + cd Project/GNU/Library + do_autoreconf + ./configure \ + --host=$TARGET_NAME \ + --build=$HOST_NAME \ + --enable-static \ + --disable-shared \ + --prefix=/usr \ + --enable-visibility \ + --disable-libcurl \ + --disable-libmms + make +} + +post_makeinstall_target() { + mkdir -p $SYSROOT_PREFIX/usr/include/MediaInfo + cp -aP ../../../Source/MediaInfo/* $SYSROOT_PREFIX/usr/include/MediaInfo + for i in Archive Audio Duplicate Export Image Multiple Reader Tag Text Video ; do + mkdir -p $SYSROOT_PREFIX/usr/include/MediaInfo/$i/ + cp -aP ../../../Source/MediaInfo/$i/*.h $SYSROOT_PREFIX/usr/include/MediaInfo/$i/ + done + cp -P libmediainfo-config $ROOT/$TOOLCHAIN/bin +} diff --git a/packages/addons/addon-depends/multimedia-tools-depends/depends/libzen/package.mk b/packages/addons/addon-depends/multimedia-tools-depends/depends/libzen/package.mk new file mode 100644 index 00000000000..1fad136eda9 --- /dev/null +++ b/packages/addons/addon-depends/multimedia-tools-depends/depends/libzen/package.mk @@ -0,0 +1,56 @@ +################################################################################ +# This file is part of LibreELEC - http://www.libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +PKG_NAME="libzen" +PKG_VERSION="0.4.33" +PKG_REV="1" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="http://mediaarea.net/en/MediaInfo/" +PKG_URL="http://mediaarea.net/download/source/libzen/$PKG_VERSION/libzen_$PKG_VERSION.tar.bz2" +PKG_SOURCE_DIR="ZenLib" +PKG_DEPENDS_TARGET="toolchain" +PKG_PRIORITY="optional" +PKG_SECTION="multimedia" +PKG_SHORTDESC="MediaInfo is a convenient unified display of the most relevant technical and tag data for video and audio files" +PKG_LONGDESC="MediaInfo is a convenient unified display of the most relevant technical and tag data for video and audio files" +PKG_IS_ADDON="no" +PKG_AUTORECONF="no" + +make_target() { + cd Project/GNU/Library + do_autoreconf + ./configure \ + --host=$TARGET_NAME \ + --build=$HOST_NAME \ + --enable-static \ + --disable-shared \ + --prefix=/usr + + make +} + +post_makeinstall_target() { + mkdir -p $SYSROOT_PREFIX/usr/include/ZenLib + cp -aP ../../../Source/ZenLib/*.h $SYSROOT_PREFIX/usr/include/ZenLib + for i in HTTP_Client Format/Html Format/Http ; do + mkdir -p $SYSROOT_PREFIX/usr/include/ZenLib/$i/ + cp -aP ../../../Source/ZenLib/$i/*.h $SYSROOT_PREFIX/usr/include/ZenLib/$i/ + done + cp -P libzen-config $ROOT/$TOOLCHAIN/bin +} diff --git a/packages/addons/addon-depends/multimedia-tools-depends/mediainfo/package.mk b/packages/addons/addon-depends/multimedia-tools-depends/mediainfo/package.mk new file mode 100644 index 00000000000..4a4e023d942 --- /dev/null +++ b/packages/addons/addon-depends/multimedia-tools-depends/mediainfo/package.mk @@ -0,0 +1,47 @@ +################################################################################ +# This file is part of LibreELEC - http://www.libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +PKG_NAME="mediainfo" +PKG_VERSION="0.7.83" +PKG_REV="1" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="http://mediaarea.net/en/MediaInfo/Download/Source" +PKG_URL="http://mediaarea.net/download/source/mediainfo/$PKG_VERSION/mediainfo_$PKG_VERSION.tar.bz2" +PKG_SOURCE_DIR="MediaInfo" +PKG_DEPENDS_TARGET="toolchain libmediainfo" +PKG_PRIORITY="optional" +PKG_SECTION="tools" +PKG_SHORTDESC="MediaInfo is a convenient unified display of the most relevant technical and tag data for video and audio files" +PKG_LONGDESC="MediaInfo is a convenient unified display of the most relevant technical and tag data for video and audio files" +PKG_AUTORECONF="no" + +make_target() { + cd Project/GNU/CLI + do_autoreconf + echo $PATH + ./configure \ + --host=$TARGET_NAME \ + --build=$HOST_NAME \ + --prefix=/usr + make +} + +makeinstall_target() { + : # nop +} diff --git a/packages/addons/addon-depends/multimedia-tools-depends/mesa-demos/package.mk b/packages/addons/addon-depends/multimedia-tools-depends/mesa-demos/package.mk new file mode 100644 index 00000000000..39cfeaa03f6 --- /dev/null +++ b/packages/addons/addon-depends/multimedia-tools-depends/mesa-demos/package.mk @@ -0,0 +1,37 @@ +################################################################################ +# This file is part of LibreELEC - http://www.libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +PKG_NAME="mesa-demos" +PKG_VERSION="8.3.0" +PKG_REV="0" +PKG_ARCH="i386 x86_64" +PKG_LICENSE="OSS" +PKG_SITE="http://www.mesa3d.org/" +PKG_URL="ftp://ftp.freedesktop.org/pub/mesa/demos/$PKG_VERSION/$PKG_NAME-$PKG_VERSION.tar.bz2" +PKG_DEPENDS_TARGET="toolchain libX11 mesa glu glew" +PKG_PRIORITY="optional" +PKG_SECTION="tools" +PKG_SHORTDESC="mesa-demos: Mesa 3D demos" +PKG_LONGDESC="Mesa 3D demos - installed are the well known glxinfo and glxgears." +PKG_AUTORECONF="yes" + +PKG_CONFIGURE_OPTS_TARGET="--without-glut" + +makeinstall_target() { + : # nop +} diff --git a/packages/addons/addon-depends/multimedia-tools-depends/mpg123/package.mk b/packages/addons/addon-depends/multimedia-tools-depends/mpg123/package.mk new file mode 100644 index 00000000000..3a99f9cb8fa --- /dev/null +++ b/packages/addons/addon-depends/multimedia-tools-depends/mpg123/package.mk @@ -0,0 +1,35 @@ +################################################################################ +# This file is part of LibreELEC - https://libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +PKG_NAME="mpg123" +PKG_VERSION="1.23.4" +PKG_REV="0" +PKG_ARCH="any" +PKG_LICENSE="LGPLv2" +PKG_SITE="http://www.mpg123.org/" +PKG_URL="http://netcologne.dl.sourceforge.net/project/$PKG_NAME/$PKG_NAME/$PKG_VERSION/$PKG_NAME-$PKG_VERSION.tar.bz2" +PKG_DEPENDS_TARGET="toolchain alsa-lib SDL2" +PKG_SECTION="tools" +PKG_PRIORITY="optional" +PKG_SHORTDESC="mpg123" +PKG_LONGDESC="A fast MP3 Player" + +PKG_IS_ADDON="no" +PKG_AUTORECONF="yes" + +PKG_CONFIGURE_OPTS_TARGET="--disable-shared --enable-static" diff --git a/packages/addons/addon-depends/multimedia-tools-depends/opencaster/package.mk b/packages/addons/addon-depends/multimedia-tools-depends/opencaster/package.mk new file mode 100644 index 00000000000..0a2a2969f99 --- /dev/null +++ b/packages/addons/addon-depends/multimedia-tools-depends/opencaster/package.mk @@ -0,0 +1,35 @@ +################################################################################ +# This file is part of LibreELEC - http://www.libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +PKG_NAME="opencaster" +PKG_VERSION="3.2.2" +PKG_REV="0" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="http://www.avalpa.com/the-key-values/15-free-software/33-opencaster" +PKG_URL="http://ftp.de.debian.org/debian/pool/main/o/opencaster/opencaster_${PKG_VERSION}+dfsg.orig.tar.gz" +PKG_DEPENDS_TARGET="toolchain" +PKG_PRIORITY="optional" +PKG_SECTION="tools" +PKG_SHORTDESC="MPEG2 transport stream data generator and packet manipulator" +PKG_LONGDESC="OpenCaster is a free and open source MPEG2 transport stream data generator and packet manipulator" +PKG_AUTORECONF="no" + +pre_makeinstall_target() { + mkdir -p $ROOT/$PKG_BUILD/.install_pkg +} diff --git a/packages/addons/addon-depends/multimedia-tools-depends/opencaster/patches/opencaster-01_crosscompile.patch b/packages/addons/addon-depends/multimedia-tools-depends/opencaster/patches/opencaster-01_crosscompile.patch new file mode 100644 index 00000000000..7e7854de5f4 --- /dev/null +++ b/packages/addons/addon-depends/multimedia-tools-depends/opencaster/patches/opencaster-01_crosscompile.patch @@ -0,0 +1,504 @@ +diff --git a/libs/sectioncrc/Makefile b/libs/sectioncrc/Makefile +index 87e4627..ad8a0e5 100755 +--- a/libs/sectioncrc/Makefile ++++ b/libs/sectioncrc/Makefile +@@ -1,4 +1,3 @@ +-C = gcc + CFLAGS = -g -MD -Wall -I. -I../../include + + OBJ = sectioncrc.o +diff --git a/tools/dsmcc-receive/Makefile b/tools/dsmcc-receive/Makefile +index 891a50c..ee2d82e 100644 +--- a/tools/dsmcc-receive/Makefile ++++ b/tools/dsmcc-receive/Makefile +@@ -1,4 +1,3 @@ +-C = gcc + CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) + LDFLAGS += -lc -lz + +diff --git a/tools/eitsecactualtoanother/Makefile b/tools/eitsecactualtoanother/Makefile +index be3a790..723c857 100644 +--- a/tools/eitsecactualtoanother/Makefile ++++ b/tools/eitsecactualtoanother/Makefile +@@ -1,4 +1,3 @@ +-C = gcc + CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) + LDFLAGS += -lc + +diff --git a/tools/eitsecfilter/Makefile b/tools/eitsecfilter/Makefile +index f4e5fc4..cc94b71 100644 +--- a/tools/eitsecfilter/Makefile ++++ b/tools/eitsecfilter/Makefile +@@ -1,4 +1,3 @@ +-C = gcc + CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) + LDFLAGS += -lc + +diff --git a/tools/eitsecmapper/Makefile b/tools/eitsecmapper/Makefile +index 9c6ce8f..29dbc39 100644 +--- a/tools/eitsecmapper/Makefile ++++ b/tools/eitsecmapper/Makefile +@@ -1,4 +1,3 @@ +-C = gcc + CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) + LDFLAGS += -lc + +diff --git a/tools/esaudio2pes/Makefile b/tools/esaudio2pes/Makefile +index 349b187..607f0a3 100644 +--- a/tools/esaudio2pes/Makefile ++++ b/tools/esaudio2pes/Makefile +@@ -1,4 +1,3 @@ +-C = gcc + CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) + LDFLAGS += -lc + +diff --git a/tools/esaudioinfo/Makefile b/tools/esaudioinfo/Makefile +index 2c014b2..69a38a0 100644 +--- a/tools/esaudioinfo/Makefile ++++ b/tools/esaudioinfo/Makefile +@@ -1,4 +1,3 @@ +-C = gcc + CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) + LDFLAGS += -lc + +diff --git a/tools/esvideompeg2info/Makefile b/tools/esvideompeg2info/Makefile +index aaa8065..ac91058 100644 +--- a/tools/esvideompeg2info/Makefile ++++ b/tools/esvideompeg2info/Makefile +@@ -1,4 +1,3 @@ +-C = gcc + CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) + LDFLAGS += -lc + +diff --git a/tools/esvideompeg2pes/Makefile b/tools/esvideompeg2pes/Makefile +index a905e7b..7020503 100644 +--- a/tools/esvideompeg2pes/Makefile ++++ b/tools/esvideompeg2pes/Makefile +@@ -1,4 +1,3 @@ +-C = gcc + CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) + LDFLAGS += -lc + +diff --git a/tools/i13942ts/Makefile b/tools/i13942ts/Makefile +index 72e4b2d..0c020f8 100644 +--- a/tools/i13942ts/Makefile ++++ b/tools/i13942ts/Makefile +@@ -1,4 +1,3 @@ +-C = gcc + CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) + + OBJS = i13942ts.o +diff --git a/tools/ip2sec/Makefile b/tools/ip2sec/Makefile +index 3a90c82..7580ca3 100644 +--- a/tools/ip2sec/Makefile ++++ b/tools/ip2sec/Makefile +@@ -1,4 +1,3 @@ +-CC = gcc + CFLAGS += -g -O2 -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) + LDFLAGS += -lpcap + +diff --git a/tools/m2ts2cbrts/Makefile b/tools/m2ts2cbrts/Makefile +index a2ed89f..778efb8 100644 +--- a/tools/m2ts2cbrts/Makefile ++++ b/tools/m2ts2cbrts/Makefile +@@ -1,4 +1,3 @@ +-C = gcc + CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) + LDFLAGS += -lc + +diff --git a/tools/mpe2sec/Makefile b/tools/mpe2sec/Makefile +index 5c29efd..55cbe4d 100644 +--- a/tools/mpe2sec/Makefile ++++ b/tools/mpe2sec/Makefile +@@ -1,4 +1,3 @@ +-CC = gcc + CFLAGS += -g -O2 -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) + + OBJS = mpe.o sectioncrc.o +diff --git a/tools/mpeg2videovbv/Makefile b/tools/mpeg2videovbv/Makefile +index 8635e67..4074c93 100644 +--- a/tools/mpeg2videovbv/Makefile ++++ b/tools/mpeg2videovbv/Makefile +@@ -1,4 +1,3 @@ +-C = gcc + CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) + LDFLAGS += -lc + +diff --git a/tools/oddparity/Makefile b/tools/oddparity/Makefile +index 7970590..6839a36 100644 +--- a/tools/oddparity/Makefile ++++ b/tools/oddparity/Makefile +@@ -1,4 +1,3 @@ +-C = gcc + CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) + LDFLAGS += -lc + +diff --git a/tools/pes2es/Makefile b/tools/pes2es/Makefile +index a598df9..c3e803f 100644 +--- a/tools/pes2es/Makefile ++++ b/tools/pes2es/Makefile +@@ -1,4 +1,3 @@ +-C = gcc + CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) + LDFLAGS += -lc + +diff --git a/tools/pes2txt/Makefile b/tools/pes2txt/Makefile +index d65922e..50057a1 100644 +--- a/tools/pes2txt/Makefile ++++ b/tools/pes2txt/Makefile +@@ -1,4 +1,3 @@ +-C = gcc + CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) + LDFLAGS += -lc + +diff --git a/tools/pesaudio2ts/Makefile b/tools/pesaudio2ts/Makefile +index 6fec027..ab75796 100644 +--- a/tools/pesaudio2ts/Makefile ++++ b/tools/pesaudio2ts/Makefile +@@ -1,4 +1,3 @@ +-C = gcc + CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) + LDFLAGS += -lc + +diff --git a/tools/pesdata2ts/Makefile b/tools/pesdata2ts/Makefile +index 3e180f7..d541485 100644 +--- a/tools/pesdata2ts/Makefile ++++ b/tools/pesdata2ts/Makefile +@@ -1,4 +1,3 @@ +-C = gcc + CFLAGS += -g -MD -Wall -I. -I../../include $(CPPFLAGS) + LDFLAGS += -lc + +diff --git a/tools/pesinfo/Makefile b/tools/pesinfo/Makefile +index 5c9cbb3..3ffc1d7 100644 +--- a/tools/pesinfo/Makefile ++++ b/tools/pesinfo/Makefile +@@ -1,4 +1,3 @@ +-C = gcc + CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) + LDFLAGS += -lc + +diff --git a/tools/pesvideo2ts/Makefile b/tools/pesvideo2ts/Makefile +index a8de20e..a2ebab0 100644 +--- a/tools/pesvideo2ts/Makefile ++++ b/tools/pesvideo2ts/Makefile +@@ -1,4 +1,3 @@ +-C = gcc + CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) + LDFLAGS += -lc + +diff --git a/tools/sec2ts/Makefile b/tools/sec2ts/Makefile +index 0607bcf..df22126 100644 +--- a/tools/sec2ts/Makefile ++++ b/tools/sec2ts/Makefile +@@ -1,4 +1,3 @@ +-C = gcc + CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) + LDFLAGS += -lc + +diff --git a/tools/ts2m2ts/Makefile b/tools/ts2m2ts/Makefile +index b70c018..28104fd 100644 +--- a/tools/ts2m2ts/Makefile ++++ b/tools/ts2m2ts/Makefile +@@ -1,4 +1,3 @@ +-C = gcc + CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) + LDFLAGS += -lc + +diff --git a/tools/ts2pes/Makefile b/tools/ts2pes/Makefile +index 61301f4..349c29e 100644 +--- a/tools/ts2pes/Makefile ++++ b/tools/ts2pes/Makefile +@@ -1,4 +1,3 @@ +-C = gcc + CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) + LDFLAGS += -lc + +diff --git a/tools/ts2sec/Makefile b/tools/ts2sec/Makefile +index ebbe4be..baad160 100644 +--- a/tools/ts2sec/Makefile ++++ b/tools/ts2sec/Makefile +@@ -1,4 +1,3 @@ +-C = gcc + CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) + LDFLAGS += -lc + +diff --git a/tools/tscbrmuxer/Makefile b/tools/tscbrmuxer/Makefile +index aa93c07..38cd632 100644 +--- a/tools/tscbrmuxer/Makefile ++++ b/tools/tscbrmuxer/Makefile +@@ -1,4 +1,3 @@ +-C = gcc + CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) + LDFLAGS += -lc + +diff --git a/tools/tsccc/Makefile b/tools/tsccc/Makefile +index 44340fb..85ec0f8 100755 +--- a/tools/tsccc/Makefile ++++ b/tools/tsccc/Makefile +@@ -1,4 +1,3 @@ +-C = gcc + CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) + LDFLAGS += -lc + +diff --git a/tools/tscrypt/Makefile b/tools/tscrypt/Makefile +index 3ce49f5..9cec259 100644 +--- a/tools/tscrypt/Makefile ++++ b/tools/tscrypt/Makefile +@@ -1,4 +1,3 @@ +-CC = gcc + CFLAGS += -g -O2 -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) + LDFLAGS += -ldvbcsa + +diff --git a/tools/tsdiscont/Makefile b/tools/tsdiscont/Makefile +index bed498e..78329c1 100644 +--- a/tools/tsdiscont/Makefile ++++ b/tools/tsdiscont/Makefile +@@ -1,4 +1,3 @@ +-C = gcc + CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) + LDFLAGS += -lc + +diff --git a/tools/tsdoubleoutput/Makefile b/tools/tsdoubleoutput/Makefile +index e35c8a2..e8927fe 100644 +--- a/tools/tsdoubleoutput/Makefile ++++ b/tools/tsdoubleoutput/Makefile +@@ -1,4 +1,3 @@ +-C = gcc + CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) + LDFLAGS += -lc + +diff --git a/tools/tsfilter/Makefile b/tools/tsfilter/Makefile +index 5e8a3fc..9397197 100755 +--- a/tools/tsfilter/Makefile ++++ b/tools/tsfilter/Makefile +@@ -1,4 +1,3 @@ +-C = gcc + CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) + LDFLAGS += -lc + +diff --git a/tools/tsfixcc/Makefile b/tools/tsfixcc/Makefile +index cdf93ae..ebd894f 100755 +--- a/tools/tsfixcc/Makefile ++++ b/tools/tsfixcc/Makefile +@@ -1,4 +1,3 @@ +-C = gcc + CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) + LDFLAGS += -lc + +diff --git a/tools/tsinputswitch/Makefile b/tools/tsinputswitch/Makefile +index 5b2f205..3a08c7a 100644 +--- a/tools/tsinputswitch/Makefile ++++ b/tools/tsinputswitch/Makefile +@@ -1,4 +1,3 @@ +-C = gcc + CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) + LDFLAGS += -lc + +diff --git a/tools/tsloop/Makefile b/tools/tsloop/Makefile +index 0781c2c..71dc3c6 100755 +--- a/tools/tsloop/Makefile ++++ b/tools/tsloop/Makefile +@@ -1,4 +1,3 @@ +-C = gcc + CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) + LDFLAGS += -lc + +diff --git a/tools/tsmask/Makefile b/tools/tsmask/Makefile +index afe3fe8..914a1ef 100755 +--- a/tools/tsmask/Makefile ++++ b/tools/tsmask/Makefile +@@ -1,4 +1,3 @@ +-C = gcc + CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) + LDFLAGS += -lc + +diff --git a/tools/tsmodder/Makefile b/tools/tsmodder/Makefile +index 72a4fde..2199b8a 100644 +--- a/tools/tsmodder/Makefile ++++ b/tools/tsmodder/Makefile +@@ -1,4 +1,3 @@ +-C = gcc + CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) + LDFLAGS += -lc + +diff --git a/tools/tsnullfiller/Makefile b/tools/tsnullfiller/Makefile +index fd7bf5a..3b6898f 100644 +--- a/tools/tsnullfiller/Makefile ++++ b/tools/tsnullfiller/Makefile +@@ -1,4 +1,3 @@ +-C = gcc + CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) + LDFLAGS += -lc + +diff --git a/tools/tsnullshaper/Makefile b/tools/tsnullshaper/Makefile +index 2071129..3b89b7e 100644 +--- a/tools/tsnullshaper/Makefile ++++ b/tools/tsnullshaper/Makefile +@@ -1,4 +1,3 @@ +-C = gcc + CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) + LDFLAGS += -lc -lrt + +diff --git a/tools/tsororts/Makefile b/tools/tsororts/Makefile +index 408c924..0687c55 100644 +--- a/tools/tsororts/Makefile ++++ b/tools/tsororts/Makefile +@@ -1,4 +1,3 @@ +-C = gcc + CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) + LDFLAGS += -lc + +diff --git a/tools/tsorts/Makefile b/tools/tsorts/Makefile +index 1b4d287..96db276 100644 +--- a/tools/tsorts/Makefile ++++ b/tools/tsorts/Makefile +@@ -1,4 +1,3 @@ +-C = gcc + CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) + LDFLAGS += -lc + +diff --git a/tools/tsoutputswitch/Makefile b/tools/tsoutputswitch/Makefile +index c2d0b09..6abfddb 100644 +--- a/tools/tsoutputswitch/Makefile ++++ b/tools/tsoutputswitch/Makefile +@@ -1,4 +1,3 @@ +-C = gcc + CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) + LDFLAGS += -lc + +diff --git a/tools/tspcrmeasure/Makefile b/tools/tspcrmeasure/Makefile +index 819a25e..f39efd3 100644 +--- a/tools/tspcrmeasure/Makefile ++++ b/tools/tspcrmeasure/Makefile +@@ -1,4 +1,3 @@ +-C = gcc + CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) + LDFLAGS += -lc + +diff --git a/tools/tspcrrestamp/Makefile b/tools/tspcrrestamp/Makefile +index 3f05709..43f37b4 100644 +--- a/tools/tspcrrestamp/Makefile ++++ b/tools/tspcrrestamp/Makefile +@@ -1,4 +1,3 @@ +-C = gcc + CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) + LDFLAGS += -lc + +diff --git a/tools/tspcrstamp/Makefile b/tools/tspcrstamp/Makefile +index 5520ef3..6c050bc 100644 +--- a/tools/tspcrstamp/Makefile ++++ b/tools/tspcrstamp/Makefile +@@ -1,4 +1,3 @@ +-C = gcc + CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) + LDFLAGS += -lc + +diff --git a/tools/tspidmapper/Makefile b/tools/tspidmapper/Makefile +index c02853a..f237a77 100644 +--- a/tools/tspidmapper/Makefile ++++ b/tools/tspidmapper/Makefile +@@ -1,4 +1,3 @@ +-C = gcc + CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) + LDFLAGS += -lc + +diff --git a/tools/tsstamp/Makefile b/tools/tsstamp/Makefile +index 80393fe..f288f09 100644 +--- a/tools/tsstamp/Makefile ++++ b/tools/tsstamp/Makefile +@@ -1,4 +1,3 @@ +-C = gcc + CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) + LDFLAGS += -lc + +diff --git a/tools/tstcpreceive/Makefile b/tools/tstcpreceive/Makefile +index 4f1cac7..ebbba5f 100644 +--- a/tools/tstcpreceive/Makefile ++++ b/tools/tstcpreceive/Makefile +@@ -1,4 +1,3 @@ +-C = gcc + CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) + LDFLAGS += -lc + +diff --git a/tools/tstcpsend/Makefile b/tools/tstcpsend/Makefile +index 8894859..fb8a573 100644 +--- a/tools/tstcpsend/Makefile ++++ b/tools/tstcpsend/Makefile +@@ -1,4 +1,3 @@ +-C = gcc + CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) + LDFLAGS += -lc -lrt + +diff --git a/tools/tstdt/Makefile b/tools/tstdt/Makefile +index 1873adb..c5eb23d 100644 +--- a/tools/tstdt/Makefile ++++ b/tools/tstdt/Makefile +@@ -1,4 +1,3 @@ +-C = gcc + CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) + LDFLAGS += -lc + +diff --git a/tools/tstimedwrite/Makefile b/tools/tstimedwrite/Makefile +index 3ad1432..7a34191 100644 +--- a/tools/tstimedwrite/Makefile ++++ b/tools/tstimedwrite/Makefile +@@ -1,4 +1,3 @@ +-C = gcc + CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) + LDFLAGS += -lc -lrt + +diff --git a/tools/tstimeout/Makefile b/tools/tstimeout/Makefile +index 0dbc314..c37b97e 100644 +--- a/tools/tstimeout/Makefile ++++ b/tools/tstimeout/Makefile +@@ -1,4 +1,3 @@ +-C = gcc + CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) + LDFLAGS += -lc + +diff --git a/tools/tsudpreceive/Makefile b/tools/tsudpreceive/Makefile +index 2e08cee..3a6c3cb 100644 +--- a/tools/tsudpreceive/Makefile ++++ b/tools/tsudpreceive/Makefile +@@ -1,4 +1,3 @@ +-C = gcc + CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) + LDFLAGS += -lc + +diff --git a/tools/tsudpsend/Makefile b/tools/tsudpsend/Makefile +index 0d55bd4..bd6f39e 100644 +--- a/tools/tsudpsend/Makefile ++++ b/tools/tsudpsend/Makefile +@@ -1,4 +1,3 @@ +-C = gcc + CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) + LDFLAGS += -lc -lrt + +diff --git a/tools/tsvbr2cbr/Makefile b/tools/tsvbr2cbr/Makefile +index 01cc992..65d670c 100644 +--- a/tools/tsvbr2cbr/Makefile ++++ b/tools/tsvbr2cbr/Makefile +@@ -1,4 +1,3 @@ +-C = gcc + CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) + LDFLAGS += -lc + +diff --git a/tools/txt2pes/Makefile b/tools/txt2pes/Makefile +index f506da7..55f0d5e 100644 +--- a/tools/txt2pes/Makefile ++++ b/tools/txt2pes/Makefile +@@ -1,4 +1,3 @@ +-C = gcc + CFLAGS += -g -MD -Wall -I. -I../../include $(CPPFLAGS) + LDFLAGS += -lc + +diff --git a/tools/zpipe/Makefile b/tools/zpipe/Makefile +index 5997129..707647d 100644 +--- a/tools/zpipe/Makefile ++++ b/tools/zpipe/Makefile +@@ -1,4 +1,3 @@ +-CC = gcc + CFLAGS += -g -O2 -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) + LDFLAGS += -lz + diff --git a/packages/addons/addon-depends/multimedia-tools-depends/opencaster/patches/opencaster-02_headers.patch b/packages/addons/addon-depends/multimedia-tools-depends/opencaster/patches/opencaster-02_headers.patch new file mode 100644 index 00000000000..3535c6087f6 --- /dev/null +++ b/packages/addons/addon-depends/multimedia-tools-depends/opencaster/patches/opencaster-02_headers.patch @@ -0,0 +1,13 @@ +diff --git a/tools/mpe2sec/mpe.c b/tools/mpe2sec/mpe.c +index 18417af..3b71f64 100644 +--- a/tools/mpe2sec/mpe.c ++++ b/tools/mpe2sec/mpe.c +@@ -12,7 +12,7 @@ + #include + #include + +-#include ++#include + + #include "sectioncrc.h" + diff --git a/packages/addons/addon-depends/multimedia-tools-depends/opencaster/patches/opencaster-03_dont-build-dvbobjects.patch b/packages/addons/addon-depends/multimedia-tools-depends/opencaster/patches/opencaster-03_dont-build-dvbobjects.patch new file mode 100644 index 00000000000..1c1e0c5a47f --- /dev/null +++ b/packages/addons/addon-depends/multimedia-tools-depends/opencaster/patches/opencaster-03_dont-build-dvbobjects.patch @@ -0,0 +1,10 @@ +diff --git a/libs/Makefile b/libs/Makefile +index 23d951b..c442057 100755 +--- a/libs/Makefile ++++ b/libs/Makefile +@@ -1,4 +1,4 @@ +-SUBDIRS = sectioncrc dvbobjects ++SUBDIRS = sectioncrc + + subdirs: $(SUBDIRS) + $(SUBDIRS): diff --git a/packages/addons/addon-depends/multimedia-tools-depends/squeezelite/package.mk b/packages/addons/addon-depends/multimedia-tools-depends/squeezelite/package.mk new file mode 100644 index 00000000000..ff96989a38a --- /dev/null +++ b/packages/addons/addon-depends/multimedia-tools-depends/squeezelite/package.mk @@ -0,0 +1,43 @@ +################################################################################ +# This file is part of LibreELEC - https://libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +PKG_NAME="squeezelite" +PKG_VERSION="94bffda" +PKG_REV="0" +PKG_ARCH="any" +PKG_LICENSE="GPLv3" +PKG_SITE="https://github.com/ralph-irving/squeezelite" +PKG_URL="https://github.com/ralph-irving/squeezelite/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain faad2 ffmpeg flac lirc libmad libvorbis mpg123 soxr" +PKG_SECTION="tools" +PKG_PRIORITY="optional" +PKG_SHORTDESC="squeezelite" +PKG_LONGDESC="A client for the Logitech Media Server" + +PKG_IS_ADDON="no" +PKG_AUTORECONF="no" + +pre_make_target() { + OPTS="-DDSD -DIR -DFFMPEG -DRESAMPLE -DVISEXPORT -DIR" + CFLAGS="$CFLAGS $OPTS" + LDFLAGS="$LDFLAGS -lasound -lpthread -lm -lrt" +} + +makeinstall_target() { + : +} diff --git a/packages/addons/addon-depends/multimedia-tools-depends/tsdecrypt/package.mk b/packages/addons/addon-depends/multimedia-tools-depends/tsdecrypt/package.mk new file mode 100644 index 00000000000..9a8c574dd61 --- /dev/null +++ b/packages/addons/addon-depends/multimedia-tools-depends/tsdecrypt/package.mk @@ -0,0 +1,37 @@ +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) +# +# This Program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This Program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with OpenELEC.tv; see the file COPYING. If not, write to +# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. +# http://www.gnu.org/copyleft/gpl.html +################################################################################ + +PKG_NAME="tsdecrypt" +PKG_VERSION="10.0" +PKG_REV="0" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="http://georgi.unixsol.org/programs/tsdecrypt" +PKG_URL="http://georgi.unixsol.org/programs/tsdecrypt/${PKG_NAME}-${PKG_VERSION}.tar.bz2" +PKG_DEPENDS_TARGET="toolchain libdvbcsa" +PKG_PRIORITY="optional" +PKG_SECTION="tools" +PKG_SHORTDESC="tsdecrypt" +PKG_LONGDESC="tsdecrypt reads incoming mpeg transport stream over UDP/RTP and then decrypts it using libdvbcsa/ffdecsa and keys obtained from OSCAM or similar cam server" +PKG_AUTORECONF="no" + +makeinstall_target() { + : # nop +} diff --git a/packages/addons/addon-depends/multimedia-tools-depends/tsdecrypt/patches/tsdecrypt-makefile.patch b/packages/addons/addon-depends/multimedia-tools-depends/tsdecrypt/patches/tsdecrypt-makefile.patch new file mode 100644 index 00000000000..979cd7eff5f --- /dev/null +++ b/packages/addons/addon-depends/multimedia-tools-depends/tsdecrypt/patches/tsdecrypt-makefile.patch @@ -0,0 +1,29 @@ +diff -Naur tsdecrypt-10.0/libfuncs/Makefile tsdecrypt-10.0.patch/libfuncs/Makefile +--- tsdecrypt-10.0/libfuncs/Makefile 2013-09-12 12:53:27.000000000 +0200 ++++ tsdecrypt-10.0.patch/libfuncs/Makefile 2014-07-20 12:23:54.900762191 +0200 +@@ -1,5 +1,4 @@ +-CC = $(CROSS)$(TARGET)gcc +-LINK = $(CROSS)$(TARGET)ld -o ++LINK = $(LD) -o + MKDEP = $(CC) -M -o $*.d $< + + LIBRARY_LINK_OPTS = -L. -r +diff -Naur tsdecrypt-10.0/libtsfuncs/Makefile tsdecrypt-10.0.patch/libtsfuncs/Makefile +--- tsdecrypt-10.0/libtsfuncs/Makefile 2013-09-12 12:53:30.000000000 +0200 ++++ tsdecrypt-10.0.patch/libtsfuncs/Makefile 2014-07-20 12:23:54.901762318 +0200 +@@ -1,5 +1,4 @@ +-CC = $(CROSS)$(TARGET)gcc +-LINK = $(CROSS)$(TARGET)ld -o ++LINK = $(LD) -o + MKDEP = $(CC) -M -o $*.d $< + + LIBRARY_LINK_OPTS = -L. -r +diff -Naur tsdecrypt-10.0/Makefile tsdecrypt-10.0.patch/Makefile +--- tsdecrypt-10.0/Makefile 2013-09-12 12:53:16.000000000 +0200 ++++ tsdecrypt-10.0.patch/Makefile 2014-07-20 12:24:11.303809770 +0200 +@@ -1,5 +1,3 @@ +-CC = $(CROSS)$(TARGET)cc +-STRIP = $(CROSS)$(TARGET)strip + MKDEP = $(CC) -MP -MM -o $*.d $< + RM = rm -f + MV = mv -f diff --git a/packages/addons/addon-depends/multimedia-tools-depends/tstools/package.mk b/packages/addons/addon-depends/multimedia-tools-depends/tstools/package.mk new file mode 100644 index 00000000000..f152bb8a674 --- /dev/null +++ b/packages/addons/addon-depends/multimedia-tools-depends/tstools/package.mk @@ -0,0 +1,41 @@ +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) +# +# This Program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This Program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with OpenELEC.tv; see the file COPYING. If not, write to +# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. +# http://www.gnu.org/copyleft/gpl.html +################################################################################ + +PKG_NAME="tstools" +PKG_VERSION="1.11" +PKG_REV="0" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="http://tstools.berlios.de/" +PKG_URL="$SOURCEFORGE_SRC/project/tstools.berlios/tstools-1_11.tgz" +PKG_DEPENDS_TARGET="toolchain" +PKG_PRIORITY="optional" +PKG_SECTION="tools" +PKG_SHORTDESC="command line tools for working with MPEG data" +PKG_LONGDESC="This is a set of cross-platform command line tools for working with MPEG data." +PKG_AUTORECONF="no" + +make_target() { + make -j1 CROSS_COMPILE=$TARGET_PREFIX +} + +makeinstall_target() { + : # nop +} diff --git a/packages/addons/addon-depends/network-tools-depends/bwm-ng/package.mk b/packages/addons/addon-depends/network-tools-depends/bwm-ng/package.mk new file mode 100644 index 00000000000..89f26254a84 --- /dev/null +++ b/packages/addons/addon-depends/network-tools-depends/bwm-ng/package.mk @@ -0,0 +1,47 @@ +################################################################################ +# This file is part of LibreELEC - http://www.libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +PKG_NAME="bwm-ng" +PKG_VERSION="0.6.1" +PKG_REV="0" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="http://www.gropp.org/?id=projects&sub=bwm-ng" +PKG_URL="http://www.gropp.org/bwm-ng/bwm-ng-$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain netbsd-curses libstatgrab" +PKG_PRIORITY="optional" +PKG_SECTION="network/analyzer" +PKG_SHORTDESC="bwm-ng: small and simple console-based live network and disk io bandwidth monitor" +PKG_LONGDESC="Bandwidth Monitor NG is a small and simple console-based live network and disk io bandwidth monitor for Linux, BSD, Solaris, Mac OS X and others." +PKG_AUTORECONF="yes" + +PKG_CONFIGURE_OPTS_TARGET="--with-libstatgrab \ + --with-time \ + --with-getifaddrs \ + --with-sysctl \ + --with-sysctldisk \ + --with-procnetdev \ + --with-partitions" + +pre_configure_target() { + export LIBS="-ltermcap" +} + +makeinstall_target() { + : # nop +} diff --git a/packages/addons/addon-depends/network-tools-depends/depends/libpcap/package.mk b/packages/addons/addon-depends/network-tools-depends/depends/libpcap/package.mk new file mode 100644 index 00000000000..a7f38b3dc4d --- /dev/null +++ b/packages/addons/addon-depends/network-tools-depends/depends/libpcap/package.mk @@ -0,0 +1,51 @@ +################################################################################ +# This file is part of LibreELEC - http://www.libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +PKG_NAME="libpcap" +PKG_VERSION="1.7.4" +PKG_REV="1" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="http://www.tcpdump.org/" +PKG_URL="http://www.tcpdump.org/release/libpcap-${PKG_VERSION}.tar.gz" +PKG_DEPENDS_TARGET="toolchain" +PKG_PRIORITY="optional" +PKG_SECTION="devel" +PKG_SHORTDESC="system interface for user-level packet capture" +PKG_LONGDESC="libpcap (Packet CAPture) provides a portable framework for low-level network monitoring. Applications include network statistics collection, security monitoring, network debugging, etc." +PKG_AUTORECONF="yes" + +PKG_CONFIGURE_OPTS_TARGET="LIBS=-lpthread \ + ac_cv_header_libusb_1_0_libusb_h=no \ + --disable-shared \ + --with-pcap=linux \ + --disable-bluetooth \ + --disable-can \ + --without-libnl \ + --disable-dbus \ + --disable-canusb" + +pre_configure_target() { +# When cross-compiling, configure can't set linux version +# forcing it + sed -i -e 's/ac_cv_linux_vers=unknown/ac_cv_linux_vers=2/' ../configure +} + +post_makeinstall_target() { + rm -rf $INSTALL/usr/bin +} diff --git a/packages/addons/addon-depends/network-tools-depends/depends/libpcap/patches/libpcap-crosscompiling.patch b/packages/addons/addon-depends/network-tools-depends/depends/libpcap/patches/libpcap-crosscompiling.patch new file mode 100644 index 00000000000..2ad1214c45a --- /dev/null +++ b/packages/addons/addon-depends/network-tools-depends/depends/libpcap/patches/libpcap-crosscompiling.patch @@ -0,0 +1,12 @@ +diff -Naur libpcap-1.7.4/configure.in libpcap-1.7.4.patch/configure.in +--- libpcap-1.7.4/configure.in 2015-04-22 22:19:15.000000000 +0200 ++++ libpcap-1.7.4.patch/configure.in 2016-03-26 10:36:25.193757606 +0100 +@@ -456,7 +456,7 @@ + if test x$with_libnl != xno ; then + have_any_nl="no" + +- incdir=-I/usr/include/libnl3 ++# incdir=-I/usr/include/libnl3 + libnldir= + if test x$withval != x ; then + libnldir=-L${withval}/lib/.libs diff --git a/packages/addons/addon-depends/network-tools-depends/depends/libstatgrab/package.mk b/packages/addons/addon-depends/network-tools-depends/depends/libstatgrab/package.mk new file mode 100644 index 00000000000..e54ef83ced8 --- /dev/null +++ b/packages/addons/addon-depends/network-tools-depends/depends/libstatgrab/package.mk @@ -0,0 +1,38 @@ +################################################################################ +# This file is part of LibreELEC - http://www.libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +PKG_NAME="libstatgrab" +PKG_VERSION="0.91" +PKG_REV="1" +PKG_SITE="http://www.i-scream.org/libstatgrab/" +PKG_URL="http://ftp.i-scream.org/pub/i-scream/libstatgrab/libstatgrab-$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain" +PKG_PRIORITY=optional +PKG_SECTION=libs +PKG_SHORTDESC="provides cross platform access to statistics about the system on which it's run" +PKG_LONGDESC="libstatgrab is a library that provides cross platform access to statistics about the system on which it's run. It's written in C and presents a selection of useful interfaces which can be used to access key system statistics. The current list of statistics includes CPU usage, memory utilisation, disk usage, process counts, network traffic, disk I/O, and more." +PKG_AUTORECONF="yes" + +PKG_CONFIGURE_OPTS_TARGET="ac_cv_func_malloc_0_nonnull=yes \ + --enable-static \ + --disable-shared \ + --disable-saidar \ + --disable-examples \ + --disable-manpages \ + --disable-setuid-binaries \ + --disable-setgid-binaries" diff --git a/packages/addons/addon-depends/network-tools-depends/iftop/package.mk b/packages/addons/addon-depends/network-tools-depends/iftop/package.mk new file mode 100644 index 00000000000..c41d16037dd --- /dev/null +++ b/packages/addons/addon-depends/network-tools-depends/iftop/package.mk @@ -0,0 +1,45 @@ +################################################################################ +# This file is part of LibreELEC - http://www.libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +PKG_NAME="iftop" +PKG_VERSION="1.0pre4" +PKG_REV="0" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="http://htop.sourceforge.net/" +PKG_URL="http://www.ex-parrot.com/pdw/iftop/download/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain netbsd-curses libpcap libnl" +PKG_PRIORITY="optional" +PKG_SECTION="network/analyzer" +PKG_SHORTDESC="iftop: display bandwidth usage on an interface" +PKG_LONGDESC="iftop does for network usage what top(1) does for CPU usage. It listens to network traffic on a named interface and displays a table of current bandwidth usage by pairs of hosts. Handy for answering the question 'why is our ADSL link so slow?'." +PKG_AUTORECONF="yes" + +pre_build_target() { + mkdir -p $PKG_BUILD/.$TARGET_NAME + cp -RP $PKG_BUILD/* $PKG_BUILD/.$TARGET_NAME +} + +pre_configure_target() { + export CFLAGS="$CFLAGS -I$SYSROOT_PREFIX/usr/include/pcap" + export LIBS="-lpcap -lnl-3 -lnl-genl-3 -lncurses -ltermcap" +} + +makeinstall_target() { + : # nop +} diff --git a/packages/addons/addon-depends/network-tools-depends/iftop/patches/iftop-boo.patch b/packages/addons/addon-depends/network-tools-depends/iftop/patches/iftop-boo.patch new file mode 100644 index 00000000000..e3622aef540 --- /dev/null +++ b/packages/addons/addon-depends/network-tools-depends/iftop/patches/iftop-boo.patch @@ -0,0 +1,73 @@ +diff --git a/configure.ac b/configure.ac +index 671241e..b6fece6 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -294,42 +294,6 @@ if test x$libpcap_prefix = x ; then + libpcap_prefix="/usr /usr/local /opt /software" + fi + +-AC_MSG_CHECKING([where to find pcap.h]) +-foundpcaph=0 +-oldCPPFLAGS=$CPPFLAGS +-for test_prefix in "" $libpcap_prefix ; do +- for x in "" /pcap ; do +- if test x$test_prefix != x ; then +- CPPFLAGS="$oldCPPFLAGS -I$test_prefix/include$x" +- fi +- AC_TRY_CPP([ +-#include +- ], [ +- AC_MSG_RESULT([$test_prefix/include$x]) +- foundpcaph=1 +- break +- ]) +- done +- if test $foundpcaph = 1 ; then +- break +- fi +-done +- +-if test $foundpcaph = 0 ; then +- AC_MSG_RESULT([no idea]) +- AC_MSG_ERROR([can't find pcap.h +- You're not going to get very far without libpcap.]) +-else +- dnl assume that -lpcap is under $test_prefix/lib +- if test x$test_prefix != x ; then +- LDFLAGS="$LDFLAGS -L$test_prefix/lib" +- fi +- AC_CHECK_LIB(pcap, pcap_open_live, , [ +- AC_MSG_ERROR([can't find libpcap +- You're not going to get very far without libpcap.]) +- ]) +-fi +- + foundpcap=0 + AC_CHECK_HEADERS([pcap.h pcap/pcap.h], [ + foundpcap=1 +diff --git a/edline.c b/edline.c +index 75f1a5a..aed80cf 100644 +--- a/edline.c ++++ b/edline.c +@@ -7,7 +7,7 @@ + static const char rcsid[] = "$Id: edline.c,v 1.2 2002/11/04 12:27:35 chris Exp $"; + + #include +-#include ++#include + #include + + #include "iftop.h" +diff --git a/iftop.c b/iftop.c +index a090dcf..5851c86 100644 +--- a/iftop.c ++++ b/iftop.c +@@ -23,7 +23,7 @@ + #endif + + #include +-#include ++#include + #include + #include + #include diff --git a/packages/addons/addon-depends/network-tools-depends/iperf/package.mk b/packages/addons/addon-depends/network-tools-depends/iperf/package.mk new file mode 100644 index 00000000000..bee0a212342 --- /dev/null +++ b/packages/addons/addon-depends/network-tools-depends/iperf/package.mk @@ -0,0 +1,37 @@ +################################################################################ +# This file is part of LibreELEC - http://www.libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +PKG_NAME="iperf" +PKG_VERSION="3.1.2" +PKG_REV="2" +PKG_ARCH="any" +PKG_LICENSE="OSS" +PKG_SITE="https://iperf.fr/" +PKG_URL="https://iperf.fr/download/source/$PKG_NAME-$PKG_VERSION-source.tar.gz" +PKG_DEPENDS_TARGET="toolchain" +PKG_PRIORITY="optional" +PKG_SECTION="network/testing" +PKG_SHORTDESC="iperf: A modern alternative for measuring maximum TCP and UDP bandwidth performance" +PKG_LONGDESC="Iperf was developed by NLANR/DAST as a modern alternative for measuring maximum TCP and UDP bandwidth performance. Iperf allows the tuning of various parameters and UDP characteristics. Iperf reports bandwidth, delay jitter, datagram loss." +PKG_AUTORECONF="yes" + +PKG_CONFIGURE_OPTS_TARGET="--enable-static --disable-shared" + +makeinstall_target() { + : # nop +} diff --git a/packages/addons/addon-depends/network-tools-depends/iperf/patches/iperf-0001_fix-build-with-gcc5.patch b/packages/addons/addon-depends/network-tools-depends/iperf/patches/iperf-0001_fix-build-with-gcc5.patch new file mode 100644 index 00000000000..85c7f78cc02 --- /dev/null +++ b/packages/addons/addon-depends/network-tools-depends/iperf/patches/iperf-0001_fix-build-with-gcc5.patch @@ -0,0 +1,27 @@ +diff -Naur a/Makefile.am b/Makefile.am +--- a/Makefile.am 2015-10-16 19:01:09.000000000 +0200 ++++ b/Makefile.am 2016-01-06 21:22:34.118008794 +0100 +@@ -1 +1,8 @@ ++README: README.md ++ fgrep -v "[Build Status]" $< \ ++ | markdown \ ++ | html2text -style pretty -nobs \ ++ | sed -e 's:>:>:g' \ ++ > $@.tmp ++ + SUBDIRS = src examples +diff -Naur a/src/Makefile.am b/src/Makefile.am +--- a/src/Makefile.am 2015-10-16 19:01:09.000000000 +0200 ++++ b/src/Makefile.am 2016-01-06 21:26:12.352336266 +0100 +@@ -49,9 +49,9 @@ + iperf3_profile_SOURCES = main.c \ + $(libiperf_la_SOURCES) + +-iperf3_profile_CFLAGS = -pg -g ++iperf3_profile_CFLAGS = -g + iperf3_profile_LDADD = libiperf.la +-iperf3_profile_LDFLAGS = -pg -g ++iperf3_profile_LDFLAGS = -g + + # Specify the sources and various flags for the test cases + t_timer_SOURCES = t_timer.c diff --git a/packages/addons/addon-depends/network-tools-depends/irssi/package.mk b/packages/addons/addon-depends/network-tools-depends/irssi/package.mk new file mode 100644 index 00000000000..3c5b1dfc241 --- /dev/null +++ b/packages/addons/addon-depends/network-tools-depends/irssi/package.mk @@ -0,0 +1,51 @@ +################################################################################ +# This file is part of LibreELEC - http://www.libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +PKG_NAME="irssi" +PKG_VERSION="0.8.19" +PKG_REV="1" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="http://www.irssi.org/" +PKG_URL="https://github.com/irssi-import/irssi/releases/download/$PKG_VERSION/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain glib netbsd-curses libressl" +PKG_PRIORITY="optional" +PKG_SECTION="tools" +PKG_SHORTDESC="IRC client" +PKG_LONGDESC="Irssi is a terminal based IRC client for UNIX systems" +PKG_AUTORECONF="yes" + +PKG_CONFIGURE_OPTS_TARGET="--with-sysroot=$SYSROOT_PREFIX \ + --enable-ssl \ + --disable-glibtest \ + --without-socks \ + --with-textui \ + --without-bot \ + --without-proxy \ + --with-gc \ + --without-perl \ + --without-sco" + +pre_configure_target() { + export CFLAGS="$CFLAGS -I$ROOT/$PKG_BUILD" + export LIBS="-ltermcap" +} + +makeinstall_target() { + : # nop +} diff --git a/packages/addons/addon-depends/network-tools-depends/iw/package.mk b/packages/addons/addon-depends/network-tools-depends/iw/package.mk new file mode 100644 index 00000000000..9b519194f5b --- /dev/null +++ b/packages/addons/addon-depends/network-tools-depends/iw/package.mk @@ -0,0 +1,41 @@ +################################################################################ +# This file is part of LibreELEC - http://www.libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +PKG_NAME="iw" +PKG_VERSION="4.3" +PKG_REV="1" +PKG_ARCH="any" +PKG_LICENSE="PUBLIC_DOMAIN" +PKG_SITE="http://wireless.kernel.org/en/users/Documentation/iw" +PKG_URL="https://www.kernel.org/pub/software/network/$PKG_NAME/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_DEPENDS_TARGET="toolchain libnl" +PKG_PRIORITY="optional" +PKG_SECTION="tools" +PKG_SHORTDESC="iw is a new nl80211 based CLI configuration utility for wireless devices" +PKG_LONGDESC="iw is a new nl80211 based CLI configuration utility for wireless devices. It supports all new drivers that have been added to the kernel recently." + +pre_configure_target() { + # iw fails at runtime with lto enabled + strip_lto + + export LDFLAGS="$LDFLAGS -pthread" +} + +makeinstall_target() { + : # meh +} diff --git a/packages/addons/addon-depends/network-tools-depends/lftp/package.mk b/packages/addons/addon-depends/network-tools-depends/lftp/package.mk new file mode 100644 index 00000000000..6a97cd13cdf --- /dev/null +++ b/packages/addons/addon-depends/network-tools-depends/lftp/package.mk @@ -0,0 +1,42 @@ +################################################################################ +# This file is part of LibreELEC - http://www.libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +PKG_NAME="lftp" +PKG_VERSION="4.6.5" +PKG_REV="1" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="http://lftp.yar.ru/" +PKG_URL="http://lftp.yar.ru/ftp/${PKG_NAME}-${PKG_VERSION}.tar.gz" +PKG_DEPENDS_TARGET="toolchain readline libressl zlib" +PKG_PRIORITY="optional" +PKG_SECTION="tools" +PKG_SHORTDESC="ftp client" +PKG_LONGDESC="LFTP is a sophisticated ftp/http client, and a file transfer program supporting a number of network protocols" +PKG_AUTORECONF="yes" + +PKG_CONFIGURE_OPTS_TARGET="--disable-nls --with-gnu-ld --without-gnutls --with-openssl" + +makeinstall_target() { + : # nop +} + +pre_configure_target() { + # fails to build with gcc 4.9 + lto + strip_lto +} diff --git a/packages/addons/addon-depends/network-tools-depends/ncftp/package.mk b/packages/addons/addon-depends/network-tools-depends/ncftp/package.mk new file mode 100644 index 00000000000..e6ab8f62865 --- /dev/null +++ b/packages/addons/addon-depends/network-tools-depends/ncftp/package.mk @@ -0,0 +1,50 @@ +################################################################################ +# This file is part of LibreELEC - http://www.libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +PKG_NAME="ncftp" +PKG_VERSION="3.2.5" +PKG_REV="0" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="http://www.ncftp.com/ncftp/" +PKG_URL="ftp://ftp.ncftp.com/ncftp/ncftp-${PKG_VERSION}-src.tar.bz2" +PKG_DEPENDS_TARGET="toolchain" +PKG_PRIORITY="optional" +PKG_SECTION="tools" +PKG_SHORTDESC="NcFTP Client (also known as just NcFTP) is a set of FREE application programs implementing the File Transfer Protocol (FTP)." +PKG_LONGDESC="NcFTP Client (also known as just NcFTP) is a set of FREE application programs implementing the File Transfer Protocol (FTP)." +PKG_AUTORECONF="no" + +PKG_CONFIGURE_OPTS_TARGET="ac_cv_header_librtmp_rtmp_h=yes \ + --enable-readline \ + --disable-universal \ + --disable-ccdv \ + --without-curses" + +pre_configure_target() { + export CFLAGS="$CFLAGS -I../" +} + +pre_build_target() { + mkdir -p $PKG_BUILD/.$TARGET_NAME + cp -RP $PKG_BUILD/* $PKG_BUILD/.$TARGET_NAME +} + +makeinstall_target() { + : # nop +} diff --git a/packages/addons/addon-depends/network-tools-depends/ngrep/package.mk b/packages/addons/addon-depends/network-tools-depends/ngrep/package.mk new file mode 100644 index 00000000000..6709983ad78 --- /dev/null +++ b/packages/addons/addon-depends/network-tools-depends/ngrep/package.mk @@ -0,0 +1,43 @@ +################################################################################ +# This file is part of LibreELEC - http://www.libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +PKG_NAME="ngrep" +PKG_VERSION="1.45" +PKG_REV="0" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="http://ngrep.sourceforge.net/" +PKG_URL="http://prdownloads.sourceforge.net/ngrep/ngrep-${PKG_VERSION}.tar.bz2" +PKG_DEPENDS_TARGET="toolchain libpcap" +PKG_PRIORITY="optional" +PKG_SECTION="network/analyzer" +PKG_SHORTDESC="ngrep - network grep" +PKG_LONGDESC="ngrep - network grep" +PKG_DISCLAIMER="this is an unofficial addon. please don't ask for support in openelec forum / irc channel" +PKG_AUTORECONF="yes" + +PKG_CONFIGURE_OPTS_TARGET="--with-pcap-includes=$SYSROOT_PREFIX/usr/include --disable-dropprivs" + +pre_build_target() { + mkdir -p $PKG_BUILD/.$TARGET_NAME + cp -RP $PKG_BUILD/* $PKG_BUILD/.$TARGET_NAME +} + +makeinstall_target() { + : # nop +} diff --git a/packages/addons/addon-depends/network-tools-depends/nmap/package.mk b/packages/addons/addon-depends/network-tools-depends/nmap/package.mk new file mode 100644 index 00000000000..f9dc4a82280 --- /dev/null +++ b/packages/addons/addon-depends/network-tools-depends/nmap/package.mk @@ -0,0 +1,51 @@ +################################################################################ +# This file is part of LibreELEC - http://www.libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +PKG_NAME="nmap" +PKG_VERSION="7.11" +PKG_REV="1" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="http://nmap.org/" +PKG_URL="http://nmap.org/dist/${PKG_NAME}-${PKG_VERSION}.tgz" +PKG_DEPENDS_TARGET="toolchain" +PKG_PRIORITY="optional" +PKG_SECTION="tools" +PKG_SHORTDESC="network tool" +PKG_LONGDESC="Free Security Scanned for Network" +PKG_AUTORECONF="no" + +PKG_CONFIGURE_OPTS_TARGET="--enable-static \ + --with-pcap=linux \ + --with-libpcap=included \ + --with-libpcre=included \ + --with-libdnet=included \ + --with-liblua=included \ + --with-liblinear=included" + +pre_configure_target() { +# nmap fails to build in subdirs + cd $ROOT/$PKG_BUILD + rm -rf .$TARGET_NAME + + export CPPFLAGS="$CPPFLAGS -Iliblua" +} + +makeinstall_target() { + : # nop +} diff --git a/packages/addons/addon-depends/network-tools-depends/rsync/package.mk b/packages/addons/addon-depends/network-tools-depends/rsync/package.mk new file mode 100644 index 00000000000..1cb76a1a7d8 --- /dev/null +++ b/packages/addons/addon-depends/network-tools-depends/rsync/package.mk @@ -0,0 +1,39 @@ +################################################################################ +# This file is part of LibreELEC - http://www.libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +PKG_NAME="rsync" +PKG_VERSION="3.1.2" +PKG_REV="1" +PKG_ARCH="any" +PKG_LICENSE="OSS" +PKG_SITE="http://www.samba.org/ftp/rsync/rsync.html" +PKG_URL="https://download.samba.org/pub/rsync/src/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain" +PKG_PRIORITY="optional" +PKG_SECTION="network/backup" +PKG_SHORTDESC="rsync: A replacement for rcp that has many more features" +PKG_LONGDESC="Rsync uses an own 'rsync' algorithm which provides a very fast method for bringing remote files into sync. It does this by sending just the differences in the files across the link, without requiring that both sets of files are present at one of the ends of the link beforehand. At first glance this may seem impossible because the calculation of diffs between two files normally requires local access to both files." +PKG_AUTORECONF="no" + +PKG_CONFIGURE_OPTS_TARGET="--disable-acl-support \ + --disable-xattr-support \ + --with-included-popt" + +makeinstall_target() { + : # nop +} diff --git a/packages/addons/addon-depends/network-tools-depends/sshfs/package.mk b/packages/addons/addon-depends/network-tools-depends/sshfs/package.mk new file mode 100644 index 00000000000..f7765b23aa1 --- /dev/null +++ b/packages/addons/addon-depends/network-tools-depends/sshfs/package.mk @@ -0,0 +1,35 @@ +################################################################################ +# This file is part of LibreELEC - http://www.libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +PKG_NAME="sshfs" +PKG_VERSION="2.7" +PKG_REV="1" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/libfuse/sshfs" +PKG_URL="https://github.com/libfuse/sshfs/releases/download/sshfs-$PKG_VERSION/sshfs-$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain fuse glib" +PKG_PRIORITY="optional" +PKG_SECTION="tools" +PKG_SHORTDESC="sshfs: a filesystem client based on the SSH File Transfer Protocol" +PKG_LONGDESC="This is a filesystem client based on the SSH File Transfer Protocol. Since most SSH servers already support this protocol it is very easy to set up: i.e. on the server side there's nothing to do. On the client side mounting the filesystem is as easy as logging into the server with ssh." +PKG_AUTORECONF="no" + +makeinstall_target() { + : # nop +} diff --git a/packages/addons/addon-depends/network-tools-depends/tcpdump/package.mk b/packages/addons/addon-depends/network-tools-depends/tcpdump/package.mk new file mode 100644 index 00000000000..213ef979130 --- /dev/null +++ b/packages/addons/addon-depends/network-tools-depends/tcpdump/package.mk @@ -0,0 +1,47 @@ +################################################################################ +# This file is part of LibreELEC - http://www.libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +PKG_NAME="tcpdump" +PKG_VERSION="4.7.4" +PKG_REV="1" +PKG_ARCH="any" +PKG_SITE="http://www.tcpdump.org/" +PKG_URL="http://www.tcpdump.org/release/tcpdump-${PKG_VERSION}.tar.gz" +PKG_DEPENDS_TARGET="toolchain libpcap" +PKG_PRIORITY=optional +PKG_SECTION="network/analyzer" +PKG_SHORTDESC="powerful tool for network monitoring and data acquisition" +PKG_LONGDESC="This program allows you to dump the traffic on a network. tcpdump is able to examine IPv4, ICMPv4, IPv6, ICMPv6, UDP, TCP, SNMP, AFS BGP, RIP, PIM, DVMRP, IGMP, SMB, OSPF, NFS and many other packet types." +PKG_AUTORECONF="yes" + +PKG_CONFIGURE_OPTS_TARGET="--with-pcap=linux --with-crypto=no --disable-ipv6" + +pre_configure_target() { + # When cross-compiling, configure can't set linux version + # forcing it + sed -i -e 's/ac_cv_linux_vers=unknown/ac_cv_linux_vers=2/' ../configure +} + +pre_build_target() { + # discard native system includes + sed -i "s%-I/usr/include%%g" Makefile +} + +makeinstall_target() { + : # nop +} diff --git a/packages/addons/addon-depends/network-tools-depends/udpxy/package.mk b/packages/addons/addon-depends/network-tools-depends/udpxy/package.mk new file mode 100644 index 00000000000..4d839984e8f --- /dev/null +++ b/packages/addons/addon-depends/network-tools-depends/udpxy/package.mk @@ -0,0 +1,41 @@ +################################################################################ +# This file is part of LibreELEC - http://www.libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +PKG_NAME="udpxy" +PKG_VERSION="1.0.23-0" +PKG_REV="0" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="http://www.udpxy.com/download-en.html" +PKG_URL="$SOURCEFORGE_SRC/project/udpxy/udpxy/Chipmunk-1.0/${PKG_NAME}.${PKG_VERSION}-prod.tar.gz" +PKG_DEPENDS_TARGET="toolchain" +PKG_PRIORITY="optional" +PKG_SECTION="tools" +PKG_SHORTDESC="udpxy is a UDP-to-HTTP multicast traffic relay daemon" +PKG_LONGDESC="udpxy is a UDP-to-HTTP multicast traffic relay daemon" +PKG_DISCLAIMER="this is an unofficial addon. please don't ask for support in openelec forum / irc channel" +PKG_AUTORECONF="no" + +pre_configure_target() { + # fails to build with gcc 4.9 + lto + strip_lto +} + +makeinstall_target() { + : # nop +} diff --git a/packages/addons/addon-depends/network-tools-depends/wireless_tools/package.mk b/packages/addons/addon-depends/network-tools-depends/wireless_tools/package.mk new file mode 100644 index 00000000000..a2622bfda26 --- /dev/null +++ b/packages/addons/addon-depends/network-tools-depends/wireless_tools/package.mk @@ -0,0 +1,46 @@ +################################################################################ +# This file is part of LibreELEC - http://www.libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +PKG_NAME="wireless_tools" +PKG_VERSION="29" +PKG_REV="0" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/Tools.html" +PKG_URL="http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/$PKG_NAME.$PKG_VERSION.tar.gz" +PKG_SOURCE_DIR="${PKG_NAME}.${PKG_VERSION}" +PKG_DEPENDS_TARGET="toolchain" +PKG_PRIORITY="optional" +PKG_SECTION="debug/tools" +PKG_SHORTDESC="wireless-tools: tools allowing to manipulate the Wireless Extensions" +PKG_LONGDESC="The Wireless Tools (WT) is a set of tools allowing to manipulate the Wireless Extensions. They use a textual interface and are rather crude, but aim to support the full Wireless Extension. There are many other tools you can use with Wireless Extensions, however Wireless Tools is the reference implementation." +PKG_AUTORECONF="no" + +pre_configure_Target() { + # wireless_tools fails to build on some systems with LTO enabled + strip_lto +} + +make_target() { + make PREFIX=/usr CC="$CC" AR="$AR" \ + CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" iwmulticall +} + +makeinstall_target() { + : # nop +} diff --git a/packages/addons/addon-depends/ninja/package.mk b/packages/addons/addon-depends/ninja/package.mk new file mode 100644 index 00000000000..e9d39d5e3f0 --- /dev/null +++ b/packages/addons/addon-depends/ninja/package.mk @@ -0,0 +1,44 @@ +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) +# +# OpenELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# OpenELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with OpenELEC. If not, see . +################################################################################ + +PKG_NAME="ninja" +PKG_VERSION="1.6.0" +PKG_REV="1" +PKG_ARCH="any" +PKG_LICENSE="Apache" +PKG_SITE="http://martine.github.io/ninja/" +PKG_URL="https://github.com/ninja-build/ninja/archive/v$PKG_VERSION.tar.gz" +PKG_PRIORITY="optional" +PKG_SECTION="devel" +PKG_SHORTDESC="Small build system with a focus on speed" +PKG_LONGDESC="Small build system with a focus on speed" + +PKG_IS_ADDON="no" +PKG_AUTORECONF="no" + +configure_host() { + : +} + +make_host() { + python2 configure.py --bootstrap +} + +makeinstall_host() { + cp ninja $ROOT/$TOOLCHAIN/bin/ +} diff --git a/packages/addons/addon-depends/nspr/package.mk b/packages/addons/addon-depends/nspr/package.mk new file mode 100644 index 00000000000..e5fbc50231d --- /dev/null +++ b/packages/addons/addon-depends/nspr/package.mk @@ -0,0 +1,48 @@ +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) +# +# This Program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This Program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with OpenELEC.tv; see the file COPYING. If not, write to +# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. +# http://www.gnu.org/copyleft/gpl.html +################################################################################ + +PKG_NAME="nspr" +PKG_VERSION="4.12" +PKG_REV="2" +PKG_ARCH="any" +PKG_LICENSE="Mozilla Public License" +PKG_SITE="http://www.linuxfromscratch.org/blfs/view/svn/general/nspr.html" +PKG_DEPENDS_TARGET="toolchain nss:host" +PKG_PRIORITY="optional" +PKG_SECTION="security" +PKG_SHORTDESC="Netscape Portable Runtime (NSPR) provides a platform-neutral API for system level and libc like functions" +PKG_LONGDESC="Netscape Portable Runtime (NSPR) provides a platform-neutral API for system level and libc like functions" +PKG_IS_ADDON="no" +PKG_AUTORECONF="no" + +MAKEFLAGS=-j1 + +if [ "$TARGET_ARCH" = "x86_64" ] ; then + TARGET_USE_64="--enable-64bit" +fi + +PKG_CONFIGURE_OPTS_TARGET="--with-pthreads $TARGET_USE_64" +PKG_MAKE_OPTS_TARGET="NSINSTALL=$ROOT/$TOOLCHAIN/bin/nsinstall" +PKG_MAKEINSTALL_OPTS_TARGET="NSINSTALL=$ROOT/$TOOLCHAIN/bin/nsinstall" + +configure_target() { + cd $(get_build_dir nss)/nspr + ./configure --with-pthreads $TARGET_USE_64 $TARGET_CONFIGURE_OPTS +} diff --git a/packages/addons/addon-depends/nss/package.mk b/packages/addons/addon-depends/nss/package.mk new file mode 100644 index 00000000000..cf876f56057 --- /dev/null +++ b/packages/addons/addon-depends/nss/package.mk @@ -0,0 +1,78 @@ +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) +# +# This Program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This Program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with OpenELEC.tv; see the file COPYING. If not, write to +# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. +# http://www.gnu.org/copyleft/gpl.html +################################################################################ + +PKG_NAME="nss" +PKG_VERSION="3.22.3" +PKG_REV="2" +PKG_ARCH="any" +PKG_LICENSE="Mozilla Public License" +PKG_SITE="http://ftp.mozilla.org/" +PKG_URL="http://ftp.mozilla.org/pub/security/nss/releases/NSS_3_22_3_RTM/src/nss-3.22.3-with-nspr-4.12.tar.gz" +PKG_DEPENDS_TARGET="toolchain nss:host nspr" +PKG_PRIORITY="optional" +PKG_SECTION="security" +PKG_SHORTDESC="The Network Security Services (NSS) package is a set of libraries designed to support cross-platform development of security-enabled client and server applications" +PKG_LONGDESC="The Network Security Services (NSS) package is a set of libraries designed to support cross-platform development of security-enabled client and server applications" +PKG_IS_ADDON="no" +PKG_AUTORECONF="no" + +MAKEFLAGS=-j1 + +make_host() { + cd $ROOT/$PKG_BUILD/nss + + [ "$TARGET_ARCH" = "x86_64" ] && export USE_64=1 + + make -C coreconf/nsinstall +} + +makeinstall_host() { + cp $ROOT/$PKG_BUILD/nss/coreconf/nsinstall/*/nsinstall $ROOT/$TOOLCHAIN/bin +} + +post_makeinstall_host() { + rm -rf $ROOT/$PKG_BUILD/nss/coreconf/nsinstall/Linux* +} + +make_target() { + cd $ROOT/$PKG_BUILD/nss + + [ "$TARGET_ARCH" = "x86_64" ] && TARGET_USE_64="USE_64=1" + + make BUILD_OPT=1 $TARGET_USE_64 \ + NSPR_INCLUDE_DIR=$SYSROOT_PREFIX/usr/include/nspr \ + USE_SYSTEM_ZLIB=1 ZLIB_LIBS=-lz \ + OS_TEST=$TARGET_ARCH \ + NSS_TESTS="dummy" \ + NSINSTALL=$ROOT/$TOOLCHAIN/bin/nsinstall \ + CPU_ARCH_TAG=$TARGET_ARCH \ + CC=$TARGET_CC LDFLAGS="$LDFLAGS -L$SYSROOT_PREFIX/usr/lib" \ + V=1 +} + +makeinstall_target() { + cd $ROOT/$PKG_BUILD + $STRIP dist/Linux*/lib/*.so + cp -L dist/Linux*/lib/*.so $SYSROOT_PREFIX/usr/lib + cp -L dist/Linux*/lib/libcrmf.a $SYSROOT_PREFIX/usr/lib + mkdir -p $SYSROOT_PREFIX/usr/include/nss + cp -RL dist/{public,private}/nss/* $SYSROOT_PREFIX/usr/include/nss + cp -L dist/Linux*/lib/pkgconfig/nss.pc $SYSROOT_PREFIX/usr/lib/pkgconfig +} diff --git a/packages/addons/addon-depends/nss/patches/nss-01_crosscompile.patch b/packages/addons/addon-depends/nss/patches/nss-01_crosscompile.patch new file mode 100644 index 00000000000..d8abfd5bdf6 --- /dev/null +++ b/packages/addons/addon-depends/nss/patches/nss-01_crosscompile.patch @@ -0,0 +1,27 @@ +diff --git a/nss/cmd/shlibsign/Makefile b/nss/cmd/shlibsign/Makefile +index 83f90fa..177feee 100644 +--- a/nss/cmd/shlibsign/Makefile ++++ b/nss/cmd/shlibsign/Makefile +@@ -95,5 +95,3 @@ else + endif + endif + +-libs install :: $(CHECKLOC) +- +diff --git a/nss/coreconf/Linux.mk b/nss/coreconf/Linux.mk +index a586e5e..e815b72 100644 +--- a/nss/coreconf/Linux.mk ++++ b/nss/coreconf/Linux.mk +@@ -16,12 +16,6 @@ ifeq ($(USE_PTHREADS),1) + IMPL_STRATEGY = _PTH + endif + +-CC = gcc +-CCC = g++ +-RANLIB = ranlib +- +-DEFAULT_COMPILER = gcc +- + ifeq ($(OS_TARGET),Android) + ifndef ANDROID_NDK + $(error Must set ANDROID_NDK to the path to the android NDK first) diff --git a/packages/addons/addon-depends/nss/patches/nss-02_3.15.5-standalone-1.patch b/packages/addons/addon-depends/nss/patches/nss-02_3.15.5-standalone-1.patch new file mode 100644 index 00000000000..815e634fa7e --- /dev/null +++ b/packages/addons/addon-depends/nss/patches/nss-02_3.15.5-standalone-1.patch @@ -0,0 +1,241 @@ +Submitted By: Armin K. +Date: 2013-07-02 +Initial Package Version: 3.15 +Upstream Status: Not applicable +Origin: Based on dj's original patch, rediffed and modified for 3.15 +Description: Adds auto-generated nss.pc and nss-config script, and allows + building without nspr in the source tree. + +--- a/nss/config/Makefile 1970-01-01 01:00:00.000000000 +0100 ++++ b/nss/config/Makefile 2013-07-02 14:53:56.684750636 +0200 +@@ -0,0 +1,40 @@ ++CORE_DEPTH = .. ++DEPTH = .. ++ ++include $(CORE_DEPTH)/coreconf/config.mk ++ ++NSS_MAJOR_VERSION = `grep "NSS_VMAJOR" ../lib/nss/nss.h | awk '{print $$3}'` ++NSS_MINOR_VERSION = `grep "NSS_VMINOR" ../lib/nss/nss.h | awk '{print $$3}'` ++NSS_PATCH_VERSION = `grep "NSS_VPATCH" ../lib/nss/nss.h | awk '{print $$3}'` ++PREFIX = /usr ++ ++all: export libs ++ ++export: ++ # Create the nss.pc file ++ mkdir -p $(DIST)/lib/pkgconfig ++ sed -e "s,@prefix@,$(PREFIX)," \ ++ -e "s,@exec_prefix@,\$${prefix}," \ ++ -e "s,@libdir@,\$${prefix}/lib," \ ++ -e "s,@includedir@,\$${prefix}/include/nss," \ ++ -e "s,@NSS_MAJOR_VERSION@,$(NSS_MAJOR_VERSION),g" \ ++ -e "s,@NSS_MINOR_VERSION@,$(NSS_MINOR_VERSION)," \ ++ -e "s,@NSS_PATCH_VERSION@,$(NSS_PATCH_VERSION)," \ ++ nss.pc.in > nss.pc ++ chmod 0644 nss.pc ++ ln -sf ../../../../nss/config/nss.pc $(DIST)/lib/pkgconfig ++ ++ # Create the nss-config script ++ mkdir -p $(DIST)/bin ++ sed -e "s,@prefix@,$(PREFIX)," \ ++ -e "s,@NSS_MAJOR_VERSION@,$(NSS_MAJOR_VERSION)," \ ++ -e "s,@NSS_MINOR_VERSION@,$(NSS_MINOR_VERSION)," \ ++ -e "s,@NSS_PATCH_VERSION@,$(NSS_PATCH_VERSION)," \ ++ nss-config.in > nss-config ++ chmod 0755 nss-config ++ ln -sf ../../../nss/config/nss-config $(DIST)/bin ++ ++libs: ++ ++dummy: all export libs ++ +--- a/nss/config/nss-config.in 1970-01-01 01:00:00.000000000 +0100 ++++ b/nss/config/nss-config.in 2013-07-02 14:52:58.328084334 +0200 +@@ -0,0 +1,153 @@ ++#!/bin/sh ++ ++prefix=@prefix@ ++ ++major_version=@NSS_MAJOR_VERSION@ ++minor_version=@NSS_MINOR_VERSION@ ++patch_version=@NSS_PATCH_VERSION@ ++ ++usage() ++{ ++ cat <&2 ++fi ++ ++lib_nss=yes ++lib_nssutil=yes ++lib_smime=yes ++lib_ssl=yes ++lib_softokn=yes ++ ++while test $# -gt 0; do ++ case "$1" in ++ -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;; ++ *) optarg= ;; ++ esac ++ ++ case $1 in ++ --prefix=*) ++ prefix=$optarg ++ ;; ++ --prefix) ++ echo_prefix=yes ++ ;; ++ --exec-prefix=*) ++ exec_prefix=$optarg ++ ;; ++ --exec-prefix) ++ echo_exec_prefix=yes ++ ;; ++ --includedir=*) ++ includedir=$optarg ++ ;; ++ --includedir) ++ echo_includedir=yes ++ ;; ++ --libdir=*) ++ libdir=$optarg ++ ;; ++ --libdir) ++ echo_libdir=yes ++ ;; ++ --version) ++ echo ${major_version}.${minor_version}.${patch_version} ++ ;; ++ --cflags) ++ echo_cflags=yes ++ ;; ++ --libs) ++ echo_libs=yes ++ ;; ++ nss) ++ lib_nss=yes ++ ;; ++ nssutil) ++ lib_nssutil=yes ++ ;; ++ smime) ++ lib_smime=yes ++ ;; ++ ssl) ++ lib_ssl=yes ++ ;; ++ softokn) ++ lib_softokn=yes ++ ;; ++ *) ++ usage 1 1>&2 ++ ;; ++ esac ++ shift ++done ++ ++# Set variables that may be dependent upon other variables ++if test -z "$exec_prefix"; then ++ exec_prefix=`pkg-config --variable=exec_prefix nss` ++fi ++if test -z "$includedir"; then ++ includedir=`pkg-config --variable=includedir nss` ++fi ++if test -z "$libdir"; then ++ libdir=`pkg-config --variable=libdir nss` ++fi ++ ++if test "$echo_prefix" = "yes"; then ++ echo $prefix ++fi ++ ++if test "$echo_exec_prefix" = "yes"; then ++ echo $exec_prefix ++fi ++ ++if test "$echo_includedir" = "yes"; then ++ echo $includedir ++fi ++ ++if test "$echo_libdir" = "yes"; then ++ echo $libdir ++fi ++ ++if test "$echo_cflags" = "yes"; then ++ echo -I$includedir ++fi ++ ++if test "$echo_libs" = "yes"; then ++ libdirs="-L$libdir" ++ if test -n "$lib_nss"; then ++ libdirs="$libdirs -lnss${major_version}" ++ fi ++ if test -n "$lib_nssutil"; then ++ libdirs="$libdirs -lnssutil${major_version}" ++ fi ++ if test -n "$lib_smime"; then ++ libdirs="$libdirs -lsmime${major_version}" ++ fi ++ if test -n "$lib_ssl"; then ++ libdirs="$libdirs -lssl${major_version}" ++ fi ++ if test -n "$lib_softokn"; then ++ libdirs="$libdirs -lsoftokn${major_version}" ++ fi ++ echo $libdirs ++fi ++ +--- a/nss/config/nss.pc.in 1970-01-01 01:00:00.000000000 +0100 ++++ b/nss/config/nss.pc.in 2013-07-02 14:52:58.328084334 +0200 +@@ -0,0 +1,12 @@ ++prefix=@prefix@ ++exec_prefix=@exec_prefix@ ++libdir=@libdir@ ++includedir=@includedir@ ++ ++Name: NSS ++Description: Network Security Services ++Version: @NSS_MAJOR_VERSION@.@NSS_MINOR_VERSION@.@NSS_PATCH_VERSION@ ++Requires: nspr >= 4.8 ++Libs: -L@libdir@ -lnss@NSS_MAJOR_VERSION@ -lnssutil@NSS_MAJOR_VERSION@ -lsmime@NSS_MAJOR_VERSION@ -lssl@NSS_MAJOR_VERSION@ -lsoftokn@NSS_MAJOR_VERSION@ ++Cflags: -I${includedir} ++ +--- a/nss/Makefile 2013-05-28 23:43:24.000000000 +0200 ++++ b/nss/Makefile 2013-07-02 14:52:58.328084334 +0200 +@@ -44,7 +44,7 @@ + # (7) Execute "local" rules. (OPTIONAL). # + ####################################################################### + +-nss_build_all: build_nspr all ++nss_build_all: all + + nss_clean_all: clobber_nspr clobber + +--- a/nss/manifest.mn 2013-05-28 23:43:24.000000000 +0200 ++++ b/nss/manifest.mn 2013-07-02 14:52:58.331417666 +0200 +@@ -10,4 +10,4 @@ + + RELEASE = nss + +-DIRS = coreconf lib cmd external_tests ++DIRS = coreconf lib cmd config diff --git a/packages/addons/addon-depends/opus/package.mk b/packages/addons/addon-depends/opus/package.mk new file mode 100644 index 00000000000..fc7a7cc500a --- /dev/null +++ b/packages/addons/addon-depends/opus/package.mk @@ -0,0 +1,43 @@ +################################################################################ +# This file is part of LibreELEC - https://libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +PKG_NAME="opus" +PKG_VERSION="1.1.2" +PKG_REV="1" +PKG_ARCH="any" +PKG_LICENSE="BSD" +PKG_SITE="http://www.opus-codec.org" +PKG_URL="http://downloads.us.xiph.org/releases/$PKG_NAME/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain" +PKG_PRIORITY="optional" +PKG_SECTION="audio" +PKG_SHORTDESC="Codec designed for interactive speech and audio transmission over the Internet" +PKG_LONGDESC="Codec designed for interactive speech and audio transmission over the Internet" + +PKG_IS_ADDON="no" +PKG_AUTORECONF="yes" + +if [ "$TARGET_ARCH" = "arm" ]; then + FIXED_POINT="--enable-fixed-point" +else + FIXED_POINT="--disable-fixed-point" +fi + +PKG_CONFIGURE_OPTS_TARGET="--enable-static \ + --disable-shared \ + $FIXED_POINT" diff --git a/packages/addons/addon-depends/pango/config/pango.modules b/packages/addons/addon-depends/pango/config/pango.modules new file mode 100644 index 00000000000..2494e6cc12f --- /dev/null +++ b/packages/addons/addon-depends/pango/config/pango.modules @@ -0,0 +1,18 @@ +# Pango Modules file +# Automatically generated file, do not edit +# +# ModulesPath = /usr/lib/pango/1.8.0/modules +# +/usr/lib/pango/1.8.0/modules/pango-arabic-lang.so ArabicScriptEngineLang PangoEngineLang PangoRenderNone arabic:* +/usr/lib/pango/1.8.0/modules/pango-basic-fc.so BasicScriptEngineFc PangoEngineShape PangoRenderFc common: +/usr/lib/pango/1.8.0/modules/pango-indic-lang.so devaIndicScriptEngineLang PangoEngineLang PangoRenderNone devanagari:* +/usr/lib/pango/1.8.0/modules/pango-indic-lang.so bengIndicScriptEngineLang PangoEngineLang PangoRenderNone bengali:* +/usr/lib/pango/1.8.0/modules/pango-indic-lang.so guruIndicScriptEngineLang PangoEngineLang PangoRenderNone gurmukhi:* +/usr/lib/pango/1.8.0/modules/pango-indic-lang.so gujrIndicScriptEngineLang PangoEngineLang PangoRenderNone gujarati:* +/usr/lib/pango/1.8.0/modules/pango-indic-lang.so oryaIndicScriptEngineLang PangoEngineLang PangoRenderNone oriya:* +/usr/lib/pango/1.8.0/modules/pango-indic-lang.so tamlIndicScriptEngineLang PangoEngineLang PangoRenderNone tamil:* +/usr/lib/pango/1.8.0/modules/pango-indic-lang.so teluIndicScriptEngineLang PangoEngineLang PangoRenderNone telugu:* +/usr/lib/pango/1.8.0/modules/pango-indic-lang.so kndaIndicScriptEngineLang PangoEngineLang PangoRenderNone kannada:* +/usr/lib/pango/1.8.0/modules/pango-indic-lang.so mlymIndicScriptEngineLang PangoEngineLang PangoRenderNone malayalam:* +/usr/lib/pango/1.8.0/modules/pango-indic-lang.so sinhIndicScriptEngineLang PangoEngineLang PangoRenderNone sinhala:* + diff --git a/packages/addons/addon-depends/pango/config/pangorc b/packages/addons/addon-depends/pango/config/pangorc new file mode 100644 index 00000000000..d37ff990adc --- /dev/null +++ b/packages/addons/addon-depends/pango/config/pangorc @@ -0,0 +1,6 @@ +[Pango] +ModuleFiles = /etc/pango/pango.modules +ModulesPath = /usr/lib/pango/1.8.0/modules + +[PangoX] +AliasFiles = /etc/pango/pangox.aliases diff --git a/packages/addons/addon-depends/pango/package.mk b/packages/addons/addon-depends/pango/package.mk new file mode 100644 index 00000000000..19f3bccff0c --- /dev/null +++ b/packages/addons/addon-depends/pango/package.mk @@ -0,0 +1,40 @@ +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) +# +# This Program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This Program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with OpenELEC.tv; see the file COPYING. If not, write to +# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. +# http://www.gnu.org/copyleft/gpl.html +################################################################################ + +PKG_NAME="pango" +PKG_VERSION="1.40.1" +PKG_REV="1" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="http://www.pango.org/" +PKG_URL="http://ftp.gnome.org/pub/gnome/sources/pango/1.40/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_DEPENDS_TARGET="toolchain glib cairo freetype fontconfig libX11 libXft harfbuzz" +PKG_PRIORITY="optional" +PKG_SECTION="x11/toolkits" +PKG_SHORTDESC="pango: Library for layout and rendering of internationalized text" +PKG_LONGDESC="The goal of the Pango project is to provide an open-source framework for the layout and rendering of internationalized text. Pango is an offshoot of the GTK+ and GNOME projects, and the initial focus is operation in those environments, however there is nothing fundamentally GTK+ or GNOME specific about Pango. Pango uses Unicode for all of its encoding, and will eventually support output in all the worlds major languages." +PKG_IS_ADDON="no" +PKG_AUTORECONF="yes" + +PKG_CONFIGURE_OPTS_TARGET="--disable-doc-cross-references \ + --disable-gtk-doc \ + --disable-man \ + --enable-debug=no \ + --with-xft" diff --git a/packages/addons/addon-depends/pango/patches/pango-01_no-gtk-doc.patch b/packages/addons/addon-depends/pango/patches/pango-01_no-gtk-doc.patch new file mode 100644 index 00000000000..1a583b84067 --- /dev/null +++ b/packages/addons/addon-depends/pango/patches/pango-01_no-gtk-doc.patch @@ -0,0 +1,46 @@ +diff -Naur pango-1.38.1/configure.ac pango-1.38.1.patch/configure.ac +--- pango-1.38.1/configure.ac 2015-10-12 21:13:25.000000000 +0200 ++++ pango-1.38.1.patch/configure.ac 2015-11-14 23:14:05.714344868 +0100 +@@ -483,15 +483,6 @@ + dnl *** Checks for gtk-doc *** + dnl ************************** + +-if $have_cairo ; then : ; else +- if test x$enable_gtk_doc = xyes ; then +- AC_MSG_WARN([Cairo not present, disabling doc building]) +- enable_gtk_doc=no +- fi +-fi +- +-GTK_DOC_CHECK([1.15], [--flavour no-tmpl]) +- + AC_ARG_ENABLE(doc-cross-references, + AC_HELP_STRING([--disable-doc-cross-references], + [cross reference glib and cairo symbols @<:@default=yes@:>@]), +@@ -606,7 +597,6 @@ + pango/pangoxft.rc + pango-view/Makefile + examples/Makefile +-docs/Makefile + docs/version.xml + tools/Makefile + tests/Makefile +diff -Naur pango-1.38.1/Makefile.am pango-1.38.1.patch/Makefile.am +--- pango-1.38.1/Makefile.am 2015-04-15 19:37:43.000000000 +0200 ++++ pango-1.38.1.patch/Makefile.am 2015-11-14 23:05:52.738361176 +0100 +@@ -1,6 +1,6 @@ + ## Process this file with automake to create Makefile.in. + +-SUBDIRS= pango pango-view examples docs tools tests build ++SUBDIRS= pango pango-view examples tools tests build + + EXTRA_DIST = \ + autogen.sh \ +@@ -38,7 +38,6 @@ + $(srcdir)/INSTALL \ + $(srcdir)/omf.make \ + $(srcdir)/xmldocs.make \ +- $(srcdir)/gtk-doc.make \ + $(srcdir)/ChangeLog + + ### ChangeLog generation diff --git a/packages/addons/addon-depends/pango/patches/pango-02_meh.patch b/packages/addons/addon-depends/pango/patches/pango-02_meh.patch new file mode 100644 index 00000000000..dc7b25d4e5f --- /dev/null +++ b/packages/addons/addon-depends/pango/patches/pango-02_meh.patch @@ -0,0 +1,79 @@ +diff -Naur pango-1.38.1/Makefile.am pango-1.38.1.patch/Makefile.am +--- pango-1.38.1/Makefile.am 2015-11-14 23:05:52.000000000 +0100 ++++ pango-1.38.1.patch/Makefile.am 2015-11-14 23:19:07.548943525 +0100 +@@ -1,6 +1,6 @@ + ## Process this file with automake to create Makefile.in. + +-SUBDIRS= pango pango-view examples tools tests build ++SUBDIRS= pango build + + EXTRA_DIST = \ + autogen.sh \ +diff -Naur pango-1.38.1/pango/Makefile.am pango-1.38.1.patch/pango/Makefile.am +--- pango-1.38.1/pango/Makefile.am 2015-09-01 00:47:11.000000000 +0200 ++++ pango-1.38.1.patch/pango/Makefile.am 2015-11-14 23:21:14.081145117 +0100 +@@ -31,7 +31,7 @@ + $(LIBTHAI_CFLAGS) \ + $(X_CFLAGS) + +-BUILT_SOURCES = pango-enum-types.h pango-enum-types.c pango-features.h ++BUILT_SOURCES = pango-features.h + + pangoincludedir=$(includedir)/pango-1.0/pango + +@@ -127,22 +127,6 @@ + pango-features.h \ + pango-enum-types.h + +-pango-enum-types.h: s-enum-types-h +-s-enum-types-h: $(pango_headers) Makefile.am pango-enum-types.h.template +- $(AM_V_GEN) ( cd $(srcdir) && $(GLIB_MKENUMS) \ +- --template pango-enum-types.h.template \ +- $(pango_headers) ) > pango-enum-types.h.tmp \ +- && mv pango-enum-types.h.tmp pango-enum-types.h \ +- && echo timestamp > $@ +- +-pango-enum-types.c: s-enum-types-c +-s-enum-types-c: $(pango_headers) Makefile.am pango-enum-types.c.template +- $(AM_V_GEN) ( cd $(srcdir) && $(GLIB_MKENUMS) \ +- --template pango-enum-types.c.template \ +- $(pango_headers) ) > pango-enum-types.c.tmp \ +- && mv pango-enum-types.c.tmp pango-enum-types.c \ +- && echo timestamp > $@ +- + pango-features.h: + $(AM_V_GEN) cd $(top_builddir) && ./config.status pango/pango-features.h + +diff -Naur pango-1.38.1/pango/pango-context.c pango-1.38.1.patch/pango/pango-context.c +--- pango-1.38.1/pango/pango-context.c 2015-09-13 17:05:39.000000000 +0200 ++++ pango-1.38.1.patch/pango/pango-context.c 2015-11-14 23:22:57.512225981 +0100 +@@ -38,6 +38,7 @@ + + #include "pango-engine-private.h" + #include "pango-script-private.h" ++#include "pango-enum-types.h" + + /** + * PangoContext: +diff -Naur pango-1.38.1/pango/pangofc-font.c pango-1.38.1.patch/pango/pangofc-font.c +--- pango-1.38.1/pango/pangofc-font.c 2015-04-15 19:37:43.000000000 +0200 ++++ pango-1.38.1.patch/pango/pangofc-font.c 2015-11-14 23:23:49.840316980 +0100 +@@ -45,6 +45,7 @@ + #include "pango-engine.h" + #include "pango-layout.h" + #include "pango-impl-utils.h" ++#include "pango-enum-types.h" + + #include + +diff -Naur pango-1.38.1/pango/pango-layout.c pango-1.38.1.patch/pango/pango-layout.c +--- pango-1.38.1/pango/pango-layout.c 2015-09-01 18:20:54.000000000 +0200 ++++ pango-1.38.1.patch/pango/pango-layout.c 2015-11-14 23:23:19.280262638 +0100 +@@ -77,6 +77,7 @@ + #include + + #include "pango-layout-private.h" ++#include "pango-enum-types.h" + + + typedef struct _Extents Extents; diff --git a/packages/addons/addon-depends/pcsc-lite/package.mk b/packages/addons/addon-depends/pcsc-lite/package.mk new file mode 100644 index 00000000000..2c6ab65bf65 --- /dev/null +++ b/packages/addons/addon-depends/pcsc-lite/package.mk @@ -0,0 +1,39 @@ +################################################################################ +# This file is part of LibreELEC - https://LibreELEC.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +PKG_NAME="pcsc-lite" +PKG_VERSION="1.8.16" +PKG_REV="0" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="http://pcsclite.alioth.debian.org/pcsclite.html" +PKG_URL="https://alioth.debian.org/frs/download.php/file/4164/${PKG_NAME}-${PKG_VERSION}.tar.bz2" +PKG_DEPENDS_TARGET="toolchain libusb" +PKG_PRIORITY="optional" +PKG_SECTION="service/system" +PKG_SHORTDESC="Middleware to access a smart card using SCard API (PC/SC)" +PKG_LONGDESC="Middleware to access a smart card using SCard API (PC/SC)" + +PKG_IS_ADDON="no" +PKG_AUTORECONF="yes" + +PKG_CONFIGURE_OPTS_TARGET="--disable-shared \ + --enable-static \ + --disable-libudev \ + --enable-libusb \ + --enable-usbdropdir=/storage/.kodi/addons/service.system.pcscd-addon/drivers" diff --git a/packages/addons/addon-depends/protobuf/package.mk b/packages/addons/addon-depends/protobuf/package.mk new file mode 100644 index 00000000000..f493136fac4 --- /dev/null +++ b/packages/addons/addon-depends/protobuf/package.mk @@ -0,0 +1,42 @@ +################################################################################ +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +################################################################################ + +PKG_NAME="protobuf" +PKG_VERSION="2.6.1" +PKG_REV="1" +PKG_ARCH="any" +PKG_LICENSE="OSS" +PKG_SITE="https://developers.google.com/protocol-buffers/" +PKG_URL="https://github.com/google/$PKG_NAME/releases/download/v$PKG_VERSION/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_DEPENDS_HOST="toolchain zlib" +PKG_DEPENDS_TARGET="toolchain zlib protobuf:host" +PKG_PRIORITY="optional" +PKG_SECTION="devel" +PKG_SHORTDESC="protobuf: Protocol Buffers - Google's data interchange format" +PKG_LONGDESC="protobuf: Protocol Buffers - Google's data interchange format" + +PKG_IS_ADDON="no" +PKG_AUTORECONF="yes" + +PKG_CONFIGURE_OPTS_HOST="--enable-static --disable-shared" +PKG_CONFIGURE_OPTS_TARGET="--disable-shared --enable-static --with-protoc=$ROOT/$TOOLCHAIN/bin/protoc" + +post_makeinstall_target() { + rm -rf $INSTALL/usr/bin + + # HACK: we have protoc in $TOOLCHAIN/bin but it seems + # the one from sysroot prefix is picked when building hyperion. remove it! + rm -f $SYSROOT_PREFIX/usr/bin/protoc +} diff --git a/packages/addons/addon-depends/protobuf/patches/01_pr1333.patch b/packages/addons/addon-depends/protobuf/patches/01_pr1333.patch new file mode 100644 index 00000000000..6318ec66b9c --- /dev/null +++ b/packages/addons/addon-depends/protobuf/patches/01_pr1333.patch @@ -0,0 +1,923 @@ +From cab5eae3e0dc8cc13d06b8d94bf4759d14e1c20e Mon Sep 17 00:00:00 2001 +From: john hood +Date: Fri, 18 Mar 2016 23:56:51 +0000 +Subject: [PATCH] Replace ancient m4/acx_pthread.m4 with m4/ax_pthread.m4 + +--- + configure.ac | 5 +- + m4/acx_pthread.m4 | 397 -------------------------------------------- + m4/ax_pthread.m4 | 485 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 487 insertions(+), 400 deletions(-) + delete mode 100644 m4/acx_pthread.m4 + create mode 100644 m4/ax_pthread.m4 + +diff --git a/configure.ac b/configure.ac +index 33a6c64..dc39ee6 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -149,9 +149,8 @@ AS_IF([test "$with_protoc" != "no"], [ + ]) + AM_CONDITIONAL([USE_EXTERNAL_PROTOC], [test "$with_protoc" != "no"]) + +-ACX_PTHREAD +-AM_CONDITIONAL([HAVE_PTHREAD], [test "x$acx_pthread_ok" = "xyes"]) +- ++AX_PTHREAD ++AM_CONDITIONAL([HAVE_PTHREAD], [test "x$ax_pthread_ok" = "xyes"]) + # We still keep this for improving pbconfig.h for unsupported platforms. + AC_CXX_STL_HASH + +diff --git a/m4/acx_pthread.m4 b/m4/acx_pthread.m4 +deleted file mode 100644 +index 89d42c7..0000000 +--- a/m4/acx_pthread.m4 ++++ /dev/null +@@ -1,397 +0,0 @@ +-# This was retrieved from +-# http://svn.0pointer.de/viewvc/trunk/common/acx_pthread.m4?revision=1277&root=avahi +-# See also (perhaps for new versions?) +-# http://svn.0pointer.de/viewvc/trunk/common/acx_pthread.m4?root=avahi +-# +-# We've rewritten the inconsistency check code (from avahi), to work +-# more broadly. In particular, it no longer assumes ld accepts -zdefs. +-# This caused a restructing of the code, but the functionality has only +-# changed a little. +- +-dnl @synopsis ACX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) +-dnl +-dnl @summary figure out how to build C programs using POSIX threads +-dnl +-dnl This macro figures out how to build C programs using POSIX threads. +-dnl It sets the PTHREAD_LIBS output variable to the threads library and +-dnl linker flags, and the PTHREAD_CFLAGS output variable to any special +-dnl C compiler flags that are needed. (The user can also force certain +-dnl compiler flags/libs to be tested by setting these environment +-dnl variables.) +-dnl +-dnl Also sets PTHREAD_CC to any special C compiler that is needed for +-dnl multi-threaded programs (defaults to the value of CC otherwise). +-dnl (This is necessary on AIX to use the special cc_r compiler alias.) +-dnl +-dnl NOTE: You are assumed to not only compile your program with these +-dnl flags, but also link it with them as well. e.g. you should link +-dnl with $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS +-dnl $LIBS +-dnl +-dnl If you are only building threads programs, you may wish to use +-dnl these variables in your default LIBS, CFLAGS, and CC: +-dnl +-dnl LIBS="$PTHREAD_LIBS $LIBS" +-dnl CFLAGS="$CFLAGS $PTHREAD_CFLAGS" +-dnl CC="$PTHREAD_CC" +-dnl +-dnl In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute +-dnl constant has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to +-dnl that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX). +-dnl +-dnl ACTION-IF-FOUND is a list of shell commands to run if a threads +-dnl library is found, and ACTION-IF-NOT-FOUND is a list of commands to +-dnl run it if it is not found. If ACTION-IF-FOUND is not specified, the +-dnl default action will define HAVE_PTHREAD. +-dnl +-dnl Please let the authors know if this macro fails on any platform, or +-dnl if you have any other suggestions or comments. This macro was based +-dnl on work by SGJ on autoconf scripts for FFTW (www.fftw.org) (with +-dnl help from M. Frigo), as well as ac_pthread and hb_pthread macros +-dnl posted by Alejandro Forero Cuervo to the autoconf macro repository. +-dnl We are also grateful for the helpful feedback of numerous users. +-dnl +-dnl @category InstalledPackages +-dnl @author Steven G. Johnson +-dnl @version 2006-05-29 +-dnl @license GPLWithACException +-dnl +-dnl Checks for GCC shared/pthread inconsistency based on work by +-dnl Marcin Owsiany +- +- +-AC_DEFUN([ACX_PTHREAD], [ +-AC_REQUIRE([AC_CANONICAL_HOST]) +-AC_LANG_SAVE +-AC_LANG_C +-acx_pthread_ok=no +- +-# We used to check for pthread.h first, but this fails if pthread.h +-# requires special compiler flags (e.g. on True64 or Sequent). +-# It gets checked for in the link test anyway. +- +-# First of all, check if the user has set any of the PTHREAD_LIBS, +-# etcetera environment variables, and if threads linking works using +-# them: +-if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then +- save_CFLAGS="$CFLAGS" +- CFLAGS="$CFLAGS $PTHREAD_CFLAGS" +- save_LIBS="$LIBS" +- LIBS="$PTHREAD_LIBS $LIBS" +- AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS]) +- AC_TRY_LINK_FUNC(pthread_join, acx_pthread_ok=yes) +- AC_MSG_RESULT($acx_pthread_ok) +- if test x"$acx_pthread_ok" = xno; then +- PTHREAD_LIBS="" +- PTHREAD_CFLAGS="" +- fi +- LIBS="$save_LIBS" +- CFLAGS="$save_CFLAGS" +-fi +- +-# We must check for the threads library under a number of different +-# names; the ordering is very important because some systems +-# (e.g. DEC) have both -lpthread and -lpthreads, where one of the +-# libraries is broken (non-POSIX). +- +-# Create a list of thread flags to try. Items starting with a "-" are +-# C compiler flags, and other items are library names, except for "none" +-# which indicates that we try without any flags at all, and "pthread-config" +-# which is a program returning the flags for the Pth emulation library. +- +-acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config" +- +-# The ordering *is* (sometimes) important. Some notes on the +-# individual items follow: +- +-# pthreads: AIX (must check this before -lpthread) +-# none: in case threads are in libc; should be tried before -Kthread and +-# other compiler flags to prevent continual compiler warnings +-# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h) +-# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) +-# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread) +-# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads) +-# -pthreads: Solaris/gcc +-# -mthreads: Mingw32/gcc, Lynx/gcc +-# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it +-# doesn't hurt to check since this sometimes defines pthreads too; +-# also defines -D_REENTRANT) +-# ... -mt is also the pthreads flag for HP/aCC +-# pthread: Linux, etcetera +-# --thread-safe: KAI C++ +-# pthread-config: use pthread-config program (for GNU Pth library) +- +-case "${host_cpu}-${host_os}" in +- *solaris*) +- +- # On Solaris (at least, for some versions), libc contains stubbed +- # (non-functional) versions of the pthreads routines, so link-based +- # tests will erroneously succeed. (We need to link with -pthreads/-mt/ +- # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather +- # a function called by this macro, so we could check for that, but +- # who knows whether they'll stub that too in a future libc.) So, +- # we'll just look for -pthreads and -lpthread first: +- +- acx_pthread_flags="-pthreads pthread -mt -pthread $acx_pthread_flags" +- ;; +-esac +- +-if test x"$acx_pthread_ok" = xno; then +-for flag in $acx_pthread_flags; do +- +- case $flag in +- none) +- AC_MSG_CHECKING([whether pthreads work without any flags]) +- ;; +- +- -*) +- AC_MSG_CHECKING([whether pthreads work with $flag]) +- PTHREAD_CFLAGS="$flag" +- ;; +- +- pthread-config) +- AC_CHECK_PROG(acx_pthread_config, pthread-config, yes, no) +- if test x"$acx_pthread_config" = xno; then continue; fi +- PTHREAD_CFLAGS="`pthread-config --cflags`" +- PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`" +- ;; +- +- *) +- AC_MSG_CHECKING([for the pthreads library -l$flag]) +- PTHREAD_LIBS="-l$flag" +- ;; +- esac +- +- save_LIBS="$LIBS" +- save_CFLAGS="$CFLAGS" +- LIBS="$PTHREAD_LIBS $LIBS" +- CFLAGS="$CFLAGS $PTHREAD_CFLAGS" +- +- # Check for various functions. We must include pthread.h, +- # since some functions may be macros. (On the Sequent, we +- # need a special flag -Kthread to make this header compile.) +- # We check for pthread_join because it is in -lpthread on IRIX +- # while pthread_create is in libc. We check for pthread_attr_init +- # due to DEC craziness with -lpthreads. We check for +- # pthread_cleanup_push because it is one of the few pthread +- # functions on Solaris that doesn't have a non-functional libc stub. +- # We try pthread_create on general principles. +- AC_TRY_LINK([#include ], +- [pthread_t th; pthread_join(th, 0); +- pthread_attr_init(0); pthread_cleanup_push(0, 0); +- pthread_create(0,0,0,0); pthread_cleanup_pop(0); ], +- [acx_pthread_ok=yes]) +- +- LIBS="$save_LIBS" +- CFLAGS="$save_CFLAGS" +- +- AC_MSG_RESULT($acx_pthread_ok) +- if test "x$acx_pthread_ok" = xyes; then +- break; +- fi +- +- PTHREAD_LIBS="" +- PTHREAD_CFLAGS="" +-done +-fi +- +-# Various other checks: +-if test "x$acx_pthread_ok" = xyes; then +- save_LIBS="$LIBS" +- LIBS="$PTHREAD_LIBS $LIBS" +- save_CFLAGS="$CFLAGS" +- CFLAGS="$CFLAGS $PTHREAD_CFLAGS" +- +- # Detect AIX lossage: JOINABLE attribute is called UNDETACHED. +- AC_MSG_CHECKING([for joinable pthread attribute]) +- attr_name=unknown +- for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do +- AC_TRY_LINK([#include ], [int attr=$attr; return attr;], +- [attr_name=$attr; break]) +- done +- AC_MSG_RESULT($attr_name) +- if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then +- AC_DEFINE_UNQUOTED(PTHREAD_CREATE_JOINABLE, $attr_name, +- [Define to necessary symbol if this constant +- uses a non-standard name on your system.]) +- fi +- +- AC_MSG_CHECKING([if more special flags are required for pthreads]) +- flag=no +- case "${host_cpu}-${host_os}" in +- *-aix* | *-freebsd* | *-darwin*) flag="-D_THREAD_SAFE";; +- *solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";; +- esac +- AC_MSG_RESULT(${flag}) +- if test "x$flag" != xno; then +- PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS" +- fi +- +- LIBS="$save_LIBS" +- CFLAGS="$save_CFLAGS" +- # More AIX lossage: must compile with xlc_r or cc_r +- if test x"$GCC" != xyes; then +- AC_CHECK_PROGS(PTHREAD_CC, xlc_r cc_r, ${CC}) +- else +- PTHREAD_CC=$CC +- fi +- +- # The next part tries to detect GCC inconsistency with -shared on some +- # architectures and systems. The problem is that in certain +- # configurations, when -shared is specified, GCC "forgets" to +- # internally use various flags which are still necessary. +- +- # +- # Prepare the flags +- # +- save_CFLAGS="$CFLAGS" +- save_LIBS="$LIBS" +- save_CC="$CC" +- +- # Try with the flags determined by the earlier checks. +- # +- # -Wl,-z,defs forces link-time symbol resolution, so that the +- # linking checks with -shared actually have any value +- # +- # FIXME: -fPIC is required for -shared on many architectures, +- # so we specify it here, but the right way would probably be to +- # properly detect whether it is actually required. +- CFLAGS="-shared -fPIC -Wl,-z,defs $CFLAGS $PTHREAD_CFLAGS" +- LIBS="$PTHREAD_LIBS $LIBS" +- CC="$PTHREAD_CC" +- +- # In order not to create several levels of indentation, we test +- # the value of "$done" until we find the cure or run out of ideas. +- done="no" +- +- # First, make sure the CFLAGS we added are actually accepted by our +- # compiler. If not (and OS X's ld, for instance, does not accept -z), +- # then we can't do this test. +- if test x"$done" = xno; then +- AC_MSG_CHECKING([whether to check for GCC pthread/shared inconsistencies]) +- AC_TRY_LINK(,, , [done=yes]) +- +- if test "x$done" = xyes ; then +- AC_MSG_RESULT([no]) +- else +- AC_MSG_RESULT([yes]) +- fi +- fi +- +- if test x"$done" = xno; then +- AC_MSG_CHECKING([whether -pthread is sufficient with -shared]) +- AC_TRY_LINK([#include ], +- [pthread_t th; pthread_join(th, 0); +- pthread_attr_init(0); pthread_cleanup_push(0, 0); +- pthread_create(0,0,0,0); pthread_cleanup_pop(0); ], +- [done=yes]) +- +- if test "x$done" = xyes; then +- AC_MSG_RESULT([yes]) +- else +- AC_MSG_RESULT([no]) +- fi +- fi +- +- # +- # Linux gcc on some architectures such as mips/mipsel forgets +- # about -lpthread +- # +- if test x"$done" = xno; then +- AC_MSG_CHECKING([whether -lpthread fixes that]) +- LIBS="-lpthread $PTHREAD_LIBS $save_LIBS" +- AC_TRY_LINK([#include ], +- [pthread_t th; pthread_join(th, 0); +- pthread_attr_init(0); pthread_cleanup_push(0, 0); +- pthread_create(0,0,0,0); pthread_cleanup_pop(0); ], +- [done=yes]) +- +- if test "x$done" = xyes; then +- AC_MSG_RESULT([yes]) +- PTHREAD_LIBS="-lpthread $PTHREAD_LIBS" +- else +- AC_MSG_RESULT([no]) +- fi +- fi +- # +- # FreeBSD 4.10 gcc forgets to use -lc_r instead of -lc +- # +- if test x"$done" = xno; then +- AC_MSG_CHECKING([whether -lc_r fixes that]) +- LIBS="-lc_r $PTHREAD_LIBS $save_LIBS" +- AC_TRY_LINK([#include ], +- [pthread_t th; pthread_join(th, 0); +- pthread_attr_init(0); pthread_cleanup_push(0, 0); +- pthread_create(0,0,0,0); pthread_cleanup_pop(0); ], +- [done=yes]) +- +- if test "x$done" = xyes; then +- AC_MSG_RESULT([yes]) +- PTHREAD_LIBS="-lc_r $PTHREAD_LIBS" +- else +- AC_MSG_RESULT([no]) +- fi +- fi +- if test x"$done" = xno; then +- # OK, we have run out of ideas +- AC_MSG_WARN([Impossible to determine how to use pthreads with shared libraries]) +- +- # so it's not safe to assume that we may use pthreads +- acx_pthread_ok=no +- fi +- +- AC_MSG_CHECKING([whether what we have so far is sufficient with -nostdlib]) +- CFLAGS="-nostdlib $CFLAGS" +- # we need c with nostdlib +- LIBS="$LIBS -lc" +- AC_TRY_LINK([#include ], +- [pthread_t th; pthread_join(th, 0); +- pthread_attr_init(0); pthread_cleanup_push(0, 0); +- pthread_create(0,0,0,0); pthread_cleanup_pop(0); ], +- [done=yes],[done=no]) +- +- if test "x$done" = xyes; then +- AC_MSG_RESULT([yes]) +- else +- AC_MSG_RESULT([no]) +- fi +- +- if test x"$done" = xno; then +- AC_MSG_CHECKING([whether -lpthread saves the day]) +- LIBS="-lpthread $LIBS" +- AC_TRY_LINK([#include ], +- [pthread_t th; pthread_join(th, 0); +- pthread_attr_init(0); pthread_cleanup_push(0, 0); +- pthread_create(0,0,0,0); pthread_cleanup_pop(0); ], +- [done=yes],[done=no]) +- +- if test "x$done" = xyes; then +- AC_MSG_RESULT([yes]) +- PTHREAD_LIBS="$PTHREAD_LIBS -lpthread" +- else +- AC_MSG_RESULT([no]) +- AC_MSG_WARN([Impossible to determine how to use pthreads with shared libraries and -nostdlib]) +- fi +- fi +- +- CFLAGS="$save_CFLAGS" +- LIBS="$save_LIBS" +- CC="$save_CC" +-else +- PTHREAD_CC="$CC" +-fi +- +-AC_SUBST(PTHREAD_LIBS) +-AC_SUBST(PTHREAD_CFLAGS) +-AC_SUBST(PTHREAD_CC) +- +-# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: +-if test x"$acx_pthread_ok" = xyes; then +- ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1]) +- : +-else +- acx_pthread_ok=no +- $2 +-fi +-AC_LANG_RESTORE +-])dnl ACX_PTHREAD +diff --git a/m4/ax_pthread.m4 b/m4/ax_pthread.m4 +new file mode 100644 +index 0000000..d218d1a +--- /dev/null ++++ b/m4/ax_pthread.m4 +@@ -0,0 +1,485 @@ ++# =========================================================================== ++# http://www.gnu.org/software/autoconf-archive/ax_pthread.html ++# =========================================================================== ++# ++# SYNOPSIS ++# ++# AX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) ++# ++# DESCRIPTION ++# ++# This macro figures out how to build C programs using POSIX threads. It ++# sets the PTHREAD_LIBS output variable to the threads library and linker ++# flags, and the PTHREAD_CFLAGS output variable to any special C compiler ++# flags that are needed. (The user can also force certain compiler ++# flags/libs to be tested by setting these environment variables.) ++# ++# Also sets PTHREAD_CC to any special C compiler that is needed for ++# multi-threaded programs (defaults to the value of CC otherwise). (This ++# is necessary on AIX to use the special cc_r compiler alias.) ++# ++# NOTE: You are assumed to not only compile your program with these flags, ++# but also to link with them as well. For example, you might link with ++# $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS ++# ++# If you are only building threaded programs, you may wish to use these ++# variables in your default LIBS, CFLAGS, and CC: ++# ++# LIBS="$PTHREAD_LIBS $LIBS" ++# CFLAGS="$CFLAGS $PTHREAD_CFLAGS" ++# CC="$PTHREAD_CC" ++# ++# In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute constant ++# has a nonstandard name, this macro defines PTHREAD_CREATE_JOINABLE to ++# that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX). ++# ++# Also HAVE_PTHREAD_PRIO_INHERIT is defined if pthread is found and the ++# PTHREAD_PRIO_INHERIT symbol is defined when compiling with ++# PTHREAD_CFLAGS. ++# ++# ACTION-IF-FOUND is a list of shell commands to run if a threads library ++# is found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it ++# is not found. If ACTION-IF-FOUND is not specified, the default action ++# will define HAVE_PTHREAD. ++# ++# Please let the authors know if this macro fails on any platform, or if ++# you have any other suggestions or comments. This macro was based on work ++# by SGJ on autoconf scripts for FFTW (http://www.fftw.org/) (with help ++# from M. Frigo), as well as ac_pthread and hb_pthread macros posted by ++# Alejandro Forero Cuervo to the autoconf macro repository. We are also ++# grateful for the helpful feedback of numerous users. ++# ++# Updated for Autoconf 2.68 by Daniel Richard G. ++# ++# LICENSE ++# ++# Copyright (c) 2008 Steven G. Johnson ++# Copyright (c) 2011 Daniel Richard G. ++# ++# This program is free software: you can redistribute it and/or modify it ++# under the terms of the GNU General Public License as published by the ++# Free Software Foundation, either version 3 of the License, or (at your ++# option) any later version. ++# ++# This program is distributed in the hope that it will be useful, but ++# WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General ++# Public License for more details. ++# ++# You should have received a copy of the GNU General Public License along ++# with this program. If not, see . ++# ++# As a special exception, the respective Autoconf Macro's copyright owner ++# gives unlimited permission to copy, distribute and modify the configure ++# scripts that are the output of Autoconf when processing the Macro. You ++# need not follow the terms of the GNU General Public License when using ++# or distributing such scripts, even though portions of the text of the ++# Macro appear in them. The GNU General Public License (GPL) does govern ++# all other use of the material that constitutes the Autoconf Macro. ++# ++# This special exception to the GPL applies to versions of the Autoconf ++# Macro released by the Autoconf Archive. When you make and distribute a ++# modified version of the Autoconf Macro, you may extend this special ++# exception to the GPL to apply to your modified version as well. ++ ++#serial 22 ++ ++AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD]) ++AC_DEFUN([AX_PTHREAD], [ ++AC_REQUIRE([AC_CANONICAL_HOST]) ++AC_REQUIRE([AC_PROG_CC]) ++AC_REQUIRE([AC_PROG_SED]) ++AC_LANG_PUSH([C]) ++ax_pthread_ok=no ++ ++# We used to check for pthread.h first, but this fails if pthread.h ++# requires special compiler flags (e.g. on Tru64 or Sequent). ++# It gets checked for in the link test anyway. ++ ++# First of all, check if the user has set any of the PTHREAD_LIBS, ++# etcetera environment variables, and if threads linking works using ++# them: ++if test "x$PTHREAD_CFLAGS$PTHREAD_LIBS" != "x"; then ++ ax_pthread_save_CC="$CC" ++ ax_pthread_save_CFLAGS="$CFLAGS" ++ ax_pthread_save_LIBS="$LIBS" ++ AS_IF([test "x$PTHREAD_CC" != "x"], [CC="$PTHREAD_CC"]) ++ CFLAGS="$CFLAGS $PTHREAD_CFLAGS" ++ LIBS="$PTHREAD_LIBS $LIBS" ++ AC_MSG_CHECKING([for pthread_join using $CC $PTHREAD_CFLAGS $PTHREAD_LIBS]) ++ AC_LINK_IFELSE([AC_LANG_CALL([], [pthread_join])], [ax_pthread_ok=yes]) ++ AC_MSG_RESULT([$ax_pthread_ok]) ++ if test "x$ax_pthread_ok" = "xno"; then ++ PTHREAD_LIBS="" ++ PTHREAD_CFLAGS="" ++ fi ++ CC="$ax_pthread_save_CC" ++ CFLAGS="$ax_pthread_save_CFLAGS" ++ LIBS="$ax_pthread_save_LIBS" ++fi ++ ++# We must check for the threads library under a number of different ++# names; the ordering is very important because some systems ++# (e.g. DEC) have both -lpthread and -lpthreads, where one of the ++# libraries is broken (non-POSIX). ++ ++# Create a list of thread flags to try. Items starting with a "-" are ++# C compiler flags, and other items are library names, except for "none" ++# which indicates that we try without any flags at all, and "pthread-config" ++# which is a program returning the flags for the Pth emulation library. ++ ++ax_pthread_flags="pthreads none -Kthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config" ++ ++# The ordering *is* (sometimes) important. Some notes on the ++# individual items follow: ++ ++# pthreads: AIX (must check this before -lpthread) ++# none: in case threads are in libc; should be tried before -Kthread and ++# other compiler flags to prevent continual compiler warnings ++# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h) ++# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads), Tru64 ++# (Note: HP C rejects this with "bad form for `-t' option") ++# -pthreads: Solaris/gcc (Note: HP C also rejects) ++# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it ++# doesn't hurt to check since this sometimes defines pthreads and ++# -D_REENTRANT too), HP C (must be checked before -lpthread, which ++# is present but should not be used directly; and before -mthreads, ++# because the compiler interprets this as "-mt" + "-hreads") ++# -mthreads: Mingw32/gcc, Lynx/gcc ++# pthread: Linux, etcetera ++# --thread-safe: KAI C++ ++# pthread-config: use pthread-config program (for GNU Pth library) ++ ++case $host_os in ++ ++ freebsd*) ++ ++ # -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) ++ # lthread: LinuxThreads port on FreeBSD (also preferred to -pthread) ++ ++ ax_pthread_flags="-kthread lthread $ax_pthread_flags" ++ ;; ++ ++ hpux*) ++ ++ # From the cc(1) man page: "[-mt] Sets various -D flags to enable ++ # multi-threading and also sets -lpthread." ++ ++ ax_pthread_flags="-mt -pthread pthread $ax_pthread_flags" ++ ;; ++ ++ openedition*) ++ ++ # IBM z/OS requires a feature-test macro to be defined in order to ++ # enable POSIX threads at all, so give the user a hint if this is ++ # not set. (We don't define these ourselves, as they can affect ++ # other portions of the system API in unpredictable ways.) ++ ++ AC_EGREP_CPP([AX_PTHREAD_ZOS_MISSING], ++ [ ++# if !defined(_OPEN_THREADS) && !defined(_UNIX03_THREADS) ++ AX_PTHREAD_ZOS_MISSING ++# endif ++ ], ++ [AC_MSG_WARN([IBM z/OS requires -D_OPEN_THREADS or -D_UNIX03_THREADS to enable pthreads support.])]) ++ ;; ++ ++ solaris*) ++ ++ # On Solaris (at least, for some versions), libc contains stubbed ++ # (non-functional) versions of the pthreads routines, so link-based ++ # tests will erroneously succeed. (N.B.: The stubs are missing ++ # pthread_cleanup_push, or rather a function called by this macro, ++ # so we could check for that, but who knows whether they'll stub ++ # that too in a future libc.) So we'll check first for the ++ # standard Solaris way of linking pthreads (-mt -lpthread). ++ ++ ax_pthread_flags="-mt,pthread pthread $ax_pthread_flags" ++ ;; ++esac ++ ++# GCC generally uses -pthread, or -pthreads on some platforms (e.g. SPARC) ++ ++AS_IF([test "x$GCC" = "xyes"], ++ [ax_pthread_flags="-pthread -pthreads $ax_pthread_flags"]) ++ ++# The presence of a feature test macro requesting re-entrant function ++# definitions is, on some systems, a strong hint that pthreads support is ++# correctly enabled ++ ++case $host_os in ++ darwin* | hpux* | linux* | osf* | solaris*) ++ ax_pthread_check_macro="_REENTRANT" ++ ;; ++ ++ aix* | freebsd*) ++ ax_pthread_check_macro="_THREAD_SAFE" ++ ;; ++ ++ *) ++ ax_pthread_check_macro="--" ++ ;; ++esac ++AS_IF([test "x$ax_pthread_check_macro" = "x--"], ++ [ax_pthread_check_cond=0], ++ [ax_pthread_check_cond="!defined($ax_pthread_check_macro)"]) ++ ++# Are we compiling with Clang? ++ ++AC_CACHE_CHECK([whether $CC is Clang], ++ [ax_cv_PTHREAD_CLANG], ++ [ax_cv_PTHREAD_CLANG=no ++ # Note that Autoconf sets GCC=yes for Clang as well as GCC ++ if test "x$GCC" = "xyes"; then ++ AC_EGREP_CPP([AX_PTHREAD_CC_IS_CLANG], ++ [/* Note: Clang 2.7 lacks __clang_[a-z]+__ */ ++# if defined(__clang__) && defined(__llvm__) ++ AX_PTHREAD_CC_IS_CLANG ++# endif ++ ], ++ [ax_cv_PTHREAD_CLANG=yes]) ++ fi ++ ]) ++ax_pthread_clang="$ax_cv_PTHREAD_CLANG" ++ ++ax_pthread_clang_warning=no ++ ++# Clang needs special handling, because older versions handle the -pthread ++# option in a rather... idiosyncratic way ++ ++if test "x$ax_pthread_clang" = "xyes"; then ++ ++ # Clang takes -pthread; it has never supported any other flag ++ ++ # (Note 1: This will need to be revisited if a system that Clang ++ # supports has POSIX threads in a separate library. This tends not ++ # to be the way of modern systems, but it's conceivable.) ++ ++ # (Note 2: On some systems, notably Darwin, -pthread is not needed ++ # to get POSIX threads support; the API is always present and ++ # active. We could reasonably leave PTHREAD_CFLAGS empty. But ++ # -pthread does define _REENTRANT, and while the Darwin headers ++ # ignore this macro, third-party headers might not.) ++ ++ PTHREAD_CFLAGS="-pthread" ++ PTHREAD_LIBS= ++ ++ ax_pthread_ok=yes ++ ++ # However, older versions of Clang make a point of warning the user ++ # that, in an invocation where only linking and no compilation is ++ # taking place, the -pthread option has no effect ("argument unused ++ # during compilation"). They expect -pthread to be passed in only ++ # when source code is being compiled. ++ # ++ # Problem is, this is at odds with the way Automake and most other ++ # C build frameworks function, which is that the same flags used in ++ # compilation (CFLAGS) are also used in linking. Many systems ++ # supported by AX_PTHREAD require exactly this for POSIX threads ++ # support, and in fact it is often not straightforward to specify a ++ # flag that is used only in the compilation phase and not in ++ # linking. Such a scenario is extremely rare in practice. ++ # ++ # Even though use of the -pthread flag in linking would only print ++ # a warning, this can be a nuisance for well-run software projects ++ # that build with -Werror. So if the active version of Clang has ++ # this misfeature, we search for an option to squash it. ++ ++ AC_CACHE_CHECK([whether Clang needs flag to prevent "argument unused" warning when linking with -pthread], ++ [ax_cv_PTHREAD_CLANG_NO_WARN_FLAG], ++ [ax_cv_PTHREAD_CLANG_NO_WARN_FLAG=unknown ++ # Create an alternate version of $ac_link that compiles and ++ # links in two steps (.c -> .o, .o -> exe) instead of one ++ # (.c -> exe), because the warning occurs only in the second ++ # step ++ ax_pthread_save_ac_link="$ac_link" ++ ax_pthread_sed='s/conftest\.\$ac_ext/conftest.$ac_objext/g' ++ ax_pthread_link_step=`$as_echo "$ac_link" | sed "$ax_pthread_sed"` ++ ax_pthread_2step_ac_link="($ac_compile) && (echo ==== >&5) && ($ax_pthread_link_step)" ++ ax_pthread_save_CFLAGS="$CFLAGS" ++ for ax_pthread_try in '' -Qunused-arguments -Wno-unused-command-line-argument unknown; do ++ AS_IF([test "x$ax_pthread_try" = "xunknown"], [break]) ++ CFLAGS="-Werror -Wunknown-warning-option $ax_pthread_try -pthread $ax_pthread_save_CFLAGS" ++ ac_link="$ax_pthread_save_ac_link" ++ AC_LINK_IFELSE([AC_LANG_SOURCE([[int main(void){return 0;}]])], ++ [ac_link="$ax_pthread_2step_ac_link" ++ AC_LINK_IFELSE([AC_LANG_SOURCE([[int main(void){return 0;}]])], ++ [break]) ++ ]) ++ done ++ ac_link="$ax_pthread_save_ac_link" ++ CFLAGS="$ax_pthread_save_CFLAGS" ++ AS_IF([test "x$ax_pthread_try" = "x"], [ax_pthread_try=no]) ++ ax_cv_PTHREAD_CLANG_NO_WARN_FLAG="$ax_pthread_try" ++ ]) ++ ++ case "$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG" in ++ no | unknown) ;; ++ *) PTHREAD_CFLAGS="$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG $PTHREAD_CFLAGS" ;; ++ esac ++ ++fi # $ax_pthread_clang = yes ++ ++if test "x$ax_pthread_ok" = "xno"; then ++for ax_pthread_try_flag in $ax_pthread_flags; do ++ ++ case $ax_pthread_try_flag in ++ none) ++ AC_MSG_CHECKING([whether pthreads work without any flags]) ++ ;; ++ ++ -mt,pthread) ++ AC_MSG_CHECKING([whether pthreads work with -mt -lpthread]) ++ PTHREAD_CFLAGS="-mt" ++ PTHREAD_LIBS="-lpthread" ++ ;; ++ ++ -*) ++ AC_MSG_CHECKING([whether pthreads work with $ax_pthread_try_flag]) ++ PTHREAD_CFLAGS="$ax_pthread_try_flag" ++ ;; ++ ++ pthread-config) ++ AC_CHECK_PROG([ax_pthread_config], [pthread-config], [yes], [no]) ++ AS_IF([test "x$ax_pthread_config" = "xno"], [continue]) ++ PTHREAD_CFLAGS="`pthread-config --cflags`" ++ PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`" ++ ;; ++ ++ *) ++ AC_MSG_CHECKING([for the pthreads library -l$ax_pthread_try_flag]) ++ PTHREAD_LIBS="-l$ax_pthread_try_flag" ++ ;; ++ esac ++ ++ ax_pthread_save_CFLAGS="$CFLAGS" ++ ax_pthread_save_LIBS="$LIBS" ++ CFLAGS="$CFLAGS $PTHREAD_CFLAGS" ++ LIBS="$PTHREAD_LIBS $LIBS" ++ ++ # Check for various functions. We must include pthread.h, ++ # since some functions may be macros. (On the Sequent, we ++ # need a special flag -Kthread to make this header compile.) ++ # We check for pthread_join because it is in -lpthread on IRIX ++ # while pthread_create is in libc. We check for pthread_attr_init ++ # due to DEC craziness with -lpthreads. We check for ++ # pthread_cleanup_push because it is one of the few pthread ++ # functions on Solaris that doesn't have a non-functional libc stub. ++ # We try pthread_create on general principles. ++ ++ AC_LINK_IFELSE([AC_LANG_PROGRAM([#include ++# if $ax_pthread_check_cond ++# error "$ax_pthread_check_macro must be defined" ++# endif ++ static void routine(void *a) { a = 0; } ++ static void *start_routine(void *a) { return a; }], ++ [pthread_t th; pthread_attr_t attr; ++ pthread_create(&th, 0, start_routine, 0); ++ pthread_join(th, 0); ++ pthread_attr_init(&attr); ++ pthread_cleanup_push(routine, 0); ++ pthread_cleanup_pop(0) /* ; */])], ++ [ax_pthread_ok=yes], ++ []) ++ ++ CFLAGS="$ax_pthread_save_CFLAGS" ++ LIBS="$ax_pthread_save_LIBS" ++ ++ AC_MSG_RESULT([$ax_pthread_ok]) ++ AS_IF([test "x$ax_pthread_ok" = "xyes"], [break]) ++ ++ PTHREAD_LIBS="" ++ PTHREAD_CFLAGS="" ++done ++fi ++ ++# Various other checks: ++if test "x$ax_pthread_ok" = "xyes"; then ++ ax_pthread_save_CFLAGS="$CFLAGS" ++ ax_pthread_save_LIBS="$LIBS" ++ CFLAGS="$CFLAGS $PTHREAD_CFLAGS" ++ LIBS="$PTHREAD_LIBS $LIBS" ++ ++ # Detect AIX lossage: JOINABLE attribute is called UNDETACHED. ++ AC_CACHE_CHECK([for joinable pthread attribute], ++ [ax_cv_PTHREAD_JOINABLE_ATTR], ++ [ax_cv_PTHREAD_JOINABLE_ATTR=unknown ++ for ax_pthread_attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do ++ AC_LINK_IFELSE([AC_LANG_PROGRAM([#include ], ++ [int attr = $ax_pthread_attr; return attr /* ; */])], ++ [ax_cv_PTHREAD_JOINABLE_ATTR=$ax_pthread_attr; break], ++ []) ++ done ++ ]) ++ AS_IF([test "x$ax_cv_PTHREAD_JOINABLE_ATTR" != "xunknown" && \ ++ test "x$ax_cv_PTHREAD_JOINABLE_ATTR" != "xPTHREAD_CREATE_JOINABLE" && \ ++ test "x$ax_pthread_joinable_attr_defined" != "xyes"], ++ [AC_DEFINE_UNQUOTED([PTHREAD_CREATE_JOINABLE], ++ [$ax_cv_PTHREAD_JOINABLE_ATTR], ++ [Define to necessary symbol if this constant ++ uses a non-standard name on your system.]) ++ ax_pthread_joinable_attr_defined=yes ++ ]) ++ ++ AC_CACHE_CHECK([whether more special flags are required for pthreads], ++ [ax_cv_PTHREAD_SPECIAL_FLAGS], ++ [ax_cv_PTHREAD_SPECIAL_FLAGS=no ++ case $host_os in ++ solaris*) ++ ax_cv_PTHREAD_SPECIAL_FLAGS="-D_POSIX_PTHREAD_SEMANTICS" ++ ;; ++ esac ++ ]) ++ AS_IF([test "x$ax_cv_PTHREAD_SPECIAL_FLAGS" != "xno" && \ ++ test "x$ax_pthread_special_flags_added" != "xyes"], ++ [PTHREAD_CFLAGS="$ax_cv_PTHREAD_SPECIAL_FLAGS $PTHREAD_CFLAGS" ++ ax_pthread_special_flags_added=yes]) ++ ++ AC_CACHE_CHECK([for PTHREAD_PRIO_INHERIT], ++ [ax_cv_PTHREAD_PRIO_INHERIT], ++ [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]], ++ [[int i = PTHREAD_PRIO_INHERIT;]])], ++ [ax_cv_PTHREAD_PRIO_INHERIT=yes], ++ [ax_cv_PTHREAD_PRIO_INHERIT=no]) ++ ]) ++ AS_IF([test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes" && \ ++ test "x$ax_pthread_prio_inherit_defined" != "xyes"], ++ [AC_DEFINE([HAVE_PTHREAD_PRIO_INHERIT], [1], [Have PTHREAD_PRIO_INHERIT.]) ++ ax_pthread_prio_inherit_defined=yes ++ ]) ++ ++ CFLAGS="$ax_pthread_save_CFLAGS" ++ LIBS="$ax_pthread_save_LIBS" ++ ++ # More AIX lossage: compile with *_r variant ++ if test "x$GCC" != "xyes"; then ++ case $host_os in ++ aix*) ++ AS_CASE(["x/$CC"], ++ [x*/c89|x*/c89_128|x*/c99|x*/c99_128|x*/cc|x*/cc128|x*/xlc|x*/xlc_v6|x*/xlc128|x*/xlc128_v6], ++ [#handle absolute path differently from PATH based program lookup ++ AS_CASE(["x$CC"], ++ [x/*], ++ [AS_IF([AS_EXECUTABLE_P([${CC}_r])],[PTHREAD_CC="${CC}_r"])], ++ [AC_CHECK_PROGS([PTHREAD_CC],[${CC}_r],[$CC])])]) ++ ;; ++ esac ++ fi ++fi ++ ++test -n "$PTHREAD_CC" || PTHREAD_CC="$CC" ++ ++AC_SUBST([PTHREAD_LIBS]) ++AC_SUBST([PTHREAD_CFLAGS]) ++AC_SUBST([PTHREAD_CC]) ++ ++# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: ++if test "x$ax_pthread_ok" = "xyes"; then ++ ifelse([$1],,[AC_DEFINE([HAVE_PTHREAD],[1],[Define if you have POSIX threads libraries and header files.])],[$1]) ++ : ++else ++ ax_pthread_ok=no ++ $2 ++fi ++AC_LANG_POP ++])dnl AX_PTHREAD diff --git a/packages/addons/addon-depends/qt/package.mk b/packages/addons/addon-depends/qt/package.mk new file mode 100644 index 00000000000..07f0d33813f --- /dev/null +++ b/packages/addons/addon-depends/qt/package.mk @@ -0,0 +1,107 @@ +################################################################################ +# This file is part of LibreELEC - https://libreelec.tv +# Copyright (C) 2009-2016 Lukas Rusak (lrusak@libreelec.tv) +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +PKG_NAME="qt" +PKG_VERSION="4.8.7" +PKG_LICENSE="OSS" +PKG_SITE="http://qt-project.org" +PKG_URL="https://www.mirrorservice.org/sites/download.qt-project.org/official_releases/qt/4.8/${PKG_VERSION}/qt-everywhere-opensource-src-${PKG_VERSION}.tar.gz" +PKG_SOURCE_DIR="qt-everywhere-opensource-src-${PKG_VERSION}" +PKG_DEPENDS_TARGET="toolchain Python zlib:host zlib" +PKG_SHORTDESC="Qt GUI toolkit" +PKG_LONGDESC="Qt GUI toolkit" + +QMAKE_CONF_DIR="mkspecs/qws/linux-openelec-g++" +QMAKE_CONF="${QMAKE_CONF_DIR}/qmake.conf" + + +PKG_CONFIGURE_OPTS_TARGET="-prefix /usr \ + -hostprefix $SYSROOT_PREFIX \ + -xplatform qws/linux-openelec-g++ \ + -make libs \ + -force-pkg-config \ + -release \ + -opensource -confirm-license \ + -static \ + -fast \ + -no-accessibility \ + -no-sql-mysql -no-sql-sqlite \ + -no-qt3support \ + -no-xmlpatterns \ + -no-multimedia \ + -no-audio-backend \ + -no-phonon -no-phonon-backend \ + -no-svg \ + -no-webkit \ + -no-javascript-jit \ + -no-script \ + -no-scripttools \ + -no-declarative -no-declarative-debug \ + -no-neon \ + -system-zlib \ + -no-gif \ + -no-libtiff \ + -no-libpng \ + -no-libmng \ + -no-libjpeg \ + -no-openssl \ + -no-rpath \ + -silent \ + -optimized-qmake \ + -no-nis \ + -no-cups \ + -no-pch \ + -no-dbus \ + -reduce-relocations \ + -reduce-exports \ + -no-separate-debug-info \ + -no-fontconfig \ + -no-glib \ + -embedded $TARGET_ARCH" + +configure_target() { + cd .. + mkdir -p $QMAKE_CONF_DIR + echo "include(../../common/linux.conf)" > $QMAKE_CONF + echo "include(../../common/gcc-base-unix.conf)" >> $QMAKE_CONF + echo "include(../../common/g++-unix.conf)" >> $QMAKE_CONF + echo "include(../../common/qws.conf)" >> $QMAKE_CONF + echo "QMAKE_CC = $CC" >> $QMAKE_CONF + echo "QMAKE_CXX = $CXX" >> $QMAKE_CONF + echo "QMAKE_LINK = $CXX" >> $QMAKE_CONF + echo "QMAKE_LINK_SHLIB = $CXX" >> $QMAKE_CONF + echo "QMAKE_AR = $AR cqs" >> $QMAKE_CONF + echo "QMAKE_OBJCOPY = $OBJCOPY" >> $QMAKE_CONF + echo "QMAKE_STRIP = $STRIP" >> $QMAKE_CONF + echo "QMAKE_CFLAGS = $CFLAGS" >> $QMAKE_CONF + echo "QMAKE_CXXFLAGS = $CXXFLAGS" >> $QMAKE_CONF + echo "QMAKE_LFLAGS = $LDFLAGS" >> $QMAKE_CONF + echo "load(qt_config)" >> $QMAKE_CONF + echo '#include "../../linux-g++/qplatformdefs.h"' >> $QMAKE_CONF_DIR/qplatformdefs.h + + CC="" CXX="" LD="" RANLIB="" AR="" AS="" CPPFLAGS="" CFLAGS="" LDFLAGS="" CXXFLAGS="" \ + PKG_CONFIG_SYSROOT_DIR="$SYSROOT_PREFIX" \ + PKG_CONFIG="$ROOT/$TOOLCHAIN/bin/pkg-config" \ + PKG_CONFIG_PATH="$SYSROOT_PREFIX/usr/lib/pkgconfig" \ + ./configure $PKG_CONFIGURE_OPTS_TARGET +} + +post_makeinstall_target() { + mkdir -p $ROOT/$TOOLCHAIN/bin + cp -P $ROOT/$PKG_BUILD/bin/qmake $ROOT/$TOOLCHAIN/bin +} diff --git a/packages/addons/addon-depends/rpi-tools-depends/Adafruit_Python_GPIO/package.mk b/packages/addons/addon-depends/rpi-tools-depends/Adafruit_Python_GPIO/package.mk new file mode 100644 index 00000000000..6f689df253a --- /dev/null +++ b/packages/addons/addon-depends/rpi-tools-depends/Adafruit_Python_GPIO/package.mk @@ -0,0 +1,39 @@ +################################################################################ +# This file is part of LibreELEC - https://libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +PKG_NAME="Adafruit_Python_GPIO" +PKG_VERSION="fdf0fca" +PKG_REV="1" +PKG_ARCH="arm" +PKG_LICENSE="MIT" +PKG_SITE="https://github.com/adafruit/${PKG_NAME}" +PKG_URL="https://github.com/adafruit/${PKG_NAME}/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain Python distutilscross:host" +PKG_PRIORITY="optional" +PKG_SECTION="python" +PKG_SHORTDESC="Adafruit Python GPIO Library" +PKG_LONGDESC="Library to provide a cross-platform GPIO interface on the Raspberry Pi and Beaglebone Black using the RPi.GPIO and Adafruit_BBIO librarie" +PKG_AUTORECONF="no" + +make_target() { + : # nop +} + +makeinstall_target() { + : # nop +} diff --git a/packages/addons/addon-depends/rpi-tools-depends/Adafruit_Python_LED_Backpack/package.mk b/packages/addons/addon-depends/rpi-tools-depends/Adafruit_Python_LED_Backpack/package.mk new file mode 100644 index 00000000000..df080380bd2 --- /dev/null +++ b/packages/addons/addon-depends/rpi-tools-depends/Adafruit_Python_LED_Backpack/package.mk @@ -0,0 +1,39 @@ +################################################################################ +# This file is part of LibreELEC - https://libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +PKG_NAME="Adafruit_Python_LED_Backpack" +PKG_VERSION="d3bd401" +PKG_REV="1" +PKG_ARCH="arm" +PKG_LICENSE="MIT" +PKG_SITE="https://github.com/adafruit/${PKG_NAME}" +PKG_URL="https://github.com/adafruit/${PKG_NAME}/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain Python distutilscross:host" +PKG_PRIORITY="optional" +PKG_SECTION="python" +PKG_SHORTDESC="Python library for controlling LED backpack displays." +PKG_LONGDESC="Python library for controlling LED backpack displays such as 8x8 matrices, bar graphs, and 7/14-segment displays on a Raspberry Pi or BeagleBone Black." +PKG_AUTORECONF="no" + +make_target() { + : # nop +} + +makeinstall_target() { + : # nop +} diff --git a/packages/addons/addon-depends/rpi-tools-depends/Adafruit_Python_PureIO/package.mk b/packages/addons/addon-depends/rpi-tools-depends/Adafruit_Python_PureIO/package.mk new file mode 100644 index 00000000000..e97cd6daf9b --- /dev/null +++ b/packages/addons/addon-depends/rpi-tools-depends/Adafruit_Python_PureIO/package.mk @@ -0,0 +1,39 @@ +################################################################################ +# This file is part of LibreELEC - https://libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +PKG_NAME="Adafruit_Python_PureIO" +PKG_VERSION="a29d95a" +PKG_REV="1" +PKG_ARCH="arm" +PKG_LICENSE="MIT" +PKG_SITE="https://github.com/adafruit/${PKG_NAME}" +PKG_URL="https://github.com/adafruit/${PKG_NAME}/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain Python distutilscross:host" +PKG_PRIORITY="optional" +PKG_SECTION="python" +PKG_SHORTDESC="Pure python access to Linux IO including I2C and SPI." +PKG_LONGDESC="Pure python access to Linux IO including I2C and SPI. Drop in replacement for smbus and spidev modules." +PKG_AUTORECONF="no" + +make_target() { + : # nop +} + +makeinstall_target() { + : # nop +} diff --git a/packages/addons/addon-depends/rpi-tools-depends/RPi.GPIO/package.mk b/packages/addons/addon-depends/rpi-tools-depends/RPi.GPIO/package.mk new file mode 100644 index 00000000000..015cfc4e2cd --- /dev/null +++ b/packages/addons/addon-depends/rpi-tools-depends/RPi.GPIO/package.mk @@ -0,0 +1,45 @@ +################################################################################ +# This file is part of LibreELEC - https://libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +PKG_NAME="RPi.GPIO" +PKG_VERSION="0.6.2" +PKG_REV="1" +PKG_ARCH="arm" +PKG_LICENSE="MIT" +PKG_SITE="http://sourceforge.net/p/raspberry-gpio-python/" +PKG_URL="https://pypi.python.org/packages/source/R/RPi.GPIO/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain Python distutilscross:host" +PKG_PRIORITY="optional" +PKG_SECTION="python" +PKG_SHORTDESC="A module to control Raspberry Pi GPIO channels" +PKG_LONGDESC="A module to control Raspberry Pi GPIO channels" +PKG_AUTORECONF="no" + +pre_configure_target() { + export PYTHONXCPREFIX="$SYSROOT_PREFIX/usr" + export LDSHARED="$CC -shared" + export CPPFLAGS="$TARGET_CPPFLAGS -I${SYSROOT_PREFIX}/usr/include/python2.7" +} + +make_target() { + python setup.py build +} + +makeinstall_target() { + : # nop +} diff --git a/packages/addons/addon-depends/rpi-tools-depends/gpiozero/package.mk b/packages/addons/addon-depends/rpi-tools-depends/gpiozero/package.mk new file mode 100644 index 00000000000..9137560ebfd --- /dev/null +++ b/packages/addons/addon-depends/rpi-tools-depends/gpiozero/package.mk @@ -0,0 +1,39 @@ +################################################################################ +# This file is part of LibreELEC - https://libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +PKG_NAME="gpiozero" +PKG_VERSION="1.2.0" +PKG_REV="1" +PKG_ARCH="arm" +PKG_LICENSE="BSD" +PKG_SITE="https://github.com/RPi-Distro/python-gpiozero" +PKG_URL="https://pypi.python.org/packages/source/g/$PKG_NAME/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain" +PKG_PRIORITY="optional" +PKG_SECTION="python" +PKG_SHORTDESC="A simple interface to everyday GPIO components used with Raspberry Pi" +PKG_LONGDESC="A simple interface to everyday GPIO components used with Raspberry Pi" +PKG_AUTORECONF="no" + +make_target() { + : # nop +} + +makeinstall_target() { + : # nop +} diff --git a/packages/addons/addon-depends/rpi-tools-depends/picamera/package.mk b/packages/addons/addon-depends/rpi-tools-depends/picamera/package.mk new file mode 100644 index 00000000000..076893149d5 --- /dev/null +++ b/packages/addons/addon-depends/rpi-tools-depends/picamera/package.mk @@ -0,0 +1,39 @@ +################################################################################ +# This file is part of LibreELEC - https://libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +PKG_NAME="picamera" +PKG_VERSION="1.10" +PKG_REV="1" +PKG_ARCH="arm" +PKG_LICENSE="BSD" +PKG_SITE="https://github.com/waveform80/picamera" +PKG_URL="https://pypi.python.org/packages/source/p/picamera/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain Python distutilscross:host bcm2835-driver" +PKG_PRIORITY="optional" +PKG_SECTION="python" +PKG_SHORTDESC="A python and shell interface for the Raspberry Pi camera module" +PKG_LONGDESC="A python and shell interface for the Raspberry Pi camera module" +PKG_AUTORECONF="no" + +make_target() { + : # nop +} + +makeinstall_target() { + : # nop +} diff --git a/packages/addons/addon-depends/runc/package.mk b/packages/addons/addon-depends/runc/package.mk new file mode 100644 index 00000000000..0a5cfd7db19 --- /dev/null +++ b/packages/addons/addon-depends/runc/package.mk @@ -0,0 +1,74 @@ +################################################################################ +# This file is part of LibreELEC - https://libreelec.tv +# Copyright (C) 2009-2016 Lukas Rusak (lrusak@libreelec.tv) +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +PKG_NAME="runc" +PKG_VERSION="baf6536" +PKG_REV="1" +PKG_ARCH="any" +PKG_LICENSE="APL" +PKG_SITE="https://github.com/opencontainers/runc" +PKG_URL="https://github.com/opencontainers/runc/archive/${PKG_VERSION}.tar.gz" +PKG_DEPENDS_HOST="toolchain go" +PKG_PRIORITY="optional" +PKG_SECTION="system" +PKG_SHORTDESC="runc is a CLI tool for spawning and running containers according to the OCI specification" +PKG_LONGDESC="runc is a CLI tool for spawning and running containers according to the OCI specification" + +PKG_IS_ADDON="no" +PKG_AUTORECONF="no" + +pre_make_target() { + case $TARGET_ARCH in + x86_64) + export GOARCH=amd64 + ;; + arm) + export GOARCH=arm + + case $TARGET_CPU in + arm1176jzf-s) + export GOARM=6 + ;; + cortex-a7) + export GOARM=7 + ;; + esac + ;; + esac + + export GOOS=linux + export CGO_ENABLED=1 + export CGO_NO_EMULATION=1 + export CGO_CFLAGS=$CFLAGS + export LDFLAGS="-w -extldflags -static -X main.gitCommit=${PKG_VERSION} -extld $TARGET_CC" + export GOLANG=$ROOT/$TOOLCHAIN/lib/golang/bin/go + export GOPATH=$ROOT/$PKG_BUILD.gopath:$ROOT/$PKG_BUILD/Godeps/_workspace/ + export GOROOT=$ROOT/$TOOLCHAIN/lib/golang + export PATH=$PATH:$GOROOT/bin + + ln -fs $ROOT/$PKG_BUILD $ROOT/$PKG_BUILD/Godeps/_workspace/src/github.com/opencontainers/runc +} + +make_target() { + mkdir -p bin + $GOLANG build -v -o bin/runc -a -tags "cgo static_build" -ldflags "$LDFLAGS" ./ +} + +makeinstall_target() { + : +} diff --git a/packages/mediacenter/libsquish/package.mk b/packages/addons/addon-depends/scrnsaverproto/package.mk similarity index 69% rename from packages/mediacenter/libsquish/package.mk rename to packages/addons/addon-depends/scrnsaverproto/package.mk index 43823d84cf8..58b46ea142a 100644 --- a/packages/mediacenter/libsquish/package.mk +++ b/packages/addons/addon-depends/scrnsaverproto/package.mk @@ -1,6 +1,6 @@ ################################################################################ # This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2014 Stefan Saraev (stefan@sarae.va) +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) # # OpenELEC is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -16,21 +16,18 @@ # along with OpenELEC. If not, see . ################################################################################ -PKG_NAME="libsquish" -PKG_VERSION="1.10-openelec" +PKG_NAME="scrnsaverproto" +PKG_VERSION="1.2.2" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" -PKG_SITE="" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.gz" -PKG_DEPENDS_HOST="toolchain" +PKG_SITE="http://xorg.freedesktop.org/" +PKG_URL="http://xorg.freedesktop.org/releases/individual/proto/$PKG_NAME-$PKG_VERSION.tar.bz2" +PKG_DEPENDS_TARGET="toolchain" PKG_PRIORITY="optional" -PKG_SECTION="" -PKG_SHORTDESC="libsquish" -PKG_LONGDESC="libsquish" +PKG_SECTION="x11/proto" +PKG_SHORTDESC="" +PKG_LONGDESC="" PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -PKG_MAKE_OPTS_TARGET="PREFIX=/usr INSTALL_DIR=$SYSROOT_PREFIX/usr" -PKG_MAKEINSTALL_OPTS_TARGET="$PKG_MAKE_OPTS_TARGET" +PKG_AUTORECONF="yes" diff --git a/packages/addons/addon-depends/system-tools-depends/autossh/package.mk b/packages/addons/addon-depends/system-tools-depends/autossh/package.mk new file mode 100644 index 00000000000..4f3729ca97c --- /dev/null +++ b/packages/addons/addon-depends/system-tools-depends/autossh/package.mk @@ -0,0 +1,42 @@ +################################################################################ +# This file is part of LibreELEC - http://www.libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +PKG_NAME="autossh" +PKG_VERSION="1.4e" +PKG_REV="1" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="http://www.harding.motd.ca/" +PKG_URL="http://www.harding.motd.ca/autossh/${PKG_NAME}-${PKG_VERSION}.tgz" +PKG_DEPENDS_TARGET="toolchain" +PKG_PRIORITY="optional" +PKG_SECTION="tools" +PKG_SHORTDESC="ssh tool" +PKG_LONGDESC="SSH tool to keep alive tunnels" +PKG_AUTORECONF="yes" + +PKG_CONFIGURE_OPTS_TARGET="ac_cv_func_malloc_0_nonnull=yes \ + ac_cv_func_realloc_0_nonnull=yes" + +pre_configure_target() { + export CFLAGS="$CFLAGS -I." +} + +makeinstall_target() { + : # nop +} diff --git a/packages/addons/addon-depends/system-tools-depends/depends/efivar/package.mk b/packages/addons/addon-depends/system-tools-depends/depends/efivar/package.mk new file mode 100644 index 00000000000..2479479c716 --- /dev/null +++ b/packages/addons/addon-depends/system-tools-depends/depends/efivar/package.mk @@ -0,0 +1,55 @@ +################################################################################ +# This file is part of LibreELEC - http://www.libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +PKG_NAME="efivar" +PKG_VERSION="70e63d4" # 0.15 # Todo: later versions with buildproblems +PKG_REV="0" +PKG_ARCH="x86_64" +PKG_LICENSE="LGPL" +PKG_SITE="https://github.com/vathpela/efivar" +PKG_URL="https://github.com/vathpela/efivar-devel/archive/$PKG_VERSION.tar.gz" +PKG_SOURCE_DIR="efivar-devel-$PKG_VERSION*" +PKG_DEPENDS_TARGET="toolchain efivar:host" +PKG_PRIORITY="optional" +PKG_SECTION="tools" +PKG_SHORTDESC="evivar: maniulate EFI Variables" +PKG_LONGDESC="Tools and library to manipulate EFI variables." +PKG_AUTORECONF="no" + +make_host() { + make -C src/ makeguids +} + +make_target() { + strip_lto + make -C src/ libefivar.a efivar-guids.h efivar.h +} + +makeinstall_host() { + : # noop +} + +makeinstall_target() { + mkdir -p $SYSROOT_PREFIX/usr/lib + cp -P src/libefivar.a $SYSROOT_PREFIX/usr/lib/ + + mkdir -p $SYSROOT_PREFIX/usr/include/efivar + cp -P src/efivar.h $SYSROOT_PREFIX/usr/include/efivar + cp -P src/efivar-guids.h $SYSROOT_PREFIX/usr/include/efivar +} + diff --git a/packages/addons/addon-depends/system-tools-depends/depends/efivar/patches/efivar-makeguids-allocate-fix.patch b/packages/addons/addon-depends/system-tools-depends/depends/efivar/patches/efivar-makeguids-allocate-fix.patch new file mode 100644 index 00000000000..e6716c923b3 --- /dev/null +++ b/packages/addons/addon-depends/system-tools-depends/depends/efivar/patches/efivar-makeguids-allocate-fix.patch @@ -0,0 +1,32 @@ +fix for + +./makeguids guids.txt guids.bin names.bin guid-symbols.S efivar-guids.h +makeguids: malloc.c:2395: sysmalloc: Assertion `(old_top == initial_top (av) && old_size == 0) || ((unsigned long) (old_size) >= MINSIZE && prev_inuse (old_top) && ((unsigned long) old_end & (pagesize - 1)) == 0)' failed. + +--- a/src/makeguids.c 2014-10-15 06:48:49.000000000 -0700 ++++ b/src/makeguids.c 2016-05-05 05:40:35.964612900 -0700 +@@ -99,10 +99,8 @@ + if (rc < 0) + err(1, "makeguids: could not read \"%s\"", argv[1]); + +- /* strictly speaking, this *has* to be too large. */ +- struct guidname *outbuf = calloc(inlen, sizeof (char)); +- if (!outbuf) +- err(1, "makeguids"); ++ /* reallocate later to required size */ ++ struct guidname *outbuf = NULL; + + char *guidstr = inbuf; + unsigned int line; +@@ -133,6 +131,11 @@ + err(1, "makeguids: \"%s\": 4 invalid data on line %d", + argv[1], line); + ++ outbuf = realloc(outbuf, line * sizeof (struct guidname)); ++ if (!outbuf) ++ err(1, "makeguids"); ++ ++ bzero(&outbuf[line-1], sizeof (struct guidname)); + memcpy(&outbuf[line-1].guid, &guid, sizeof(guid)); + strcpy(outbuf[line-1].symbol, "efi_guid_"); + strncat(outbuf[line-1].symbol, symbol, diff --git a/packages/addons/addon-depends/system-tools-depends/depends/libmtp/package.mk b/packages/addons/addon-depends/system-tools-depends/depends/libmtp/package.mk new file mode 100644 index 00000000000..a2f1b015dac --- /dev/null +++ b/packages/addons/addon-depends/system-tools-depends/depends/libmtp/package.mk @@ -0,0 +1,36 @@ +################################################################################ +# This file is part of LibreELEC - http://www.libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +PKG_NAME="libmtp" +PKG_VERSION="1.1.11" +PKG_REV="3" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="http://libmtp.sourceforge.net/" +PKG_URL="$SOURCEFORGE_SRC/project/$PKG_NAME/$PKG_NAME/$PKG_VERSION/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain libusb" +PKG_SECTION="libs" +PKG_PRIORITY="optional" +PKG_SHORTDESC="MTP library" +PKG_LONGDESC="libmtp is an Initiator implementation of the Media Transfer Protocol (MTP) in the form of a library suitable primarily for POSIX compliant operating systems. We implement MTP Basic, the stuff proposed for standardization." +PKG_AUTORECONF="yes" + +PKG_CONFIGURE_OPTS_TARGET="ac_cv_func_malloc_0_nonnull=yes \ + --disable-shared \ + --enable-static \ + --disable-mtpz" diff --git a/packages/addons/addon-depends/system-tools-depends/depends/libmtp/patches/libmtp-0001-dont-execute-compiled-tools.patch b/packages/addons/addon-depends/system-tools-depends/depends/libmtp/patches/libmtp-0001-dont-execute-compiled-tools.patch new file mode 100644 index 00000000000..639b72f018f --- /dev/null +++ b/packages/addons/addon-depends/system-tools-depends/depends/libmtp/patches/libmtp-0001-dont-execute-compiled-tools.patch @@ -0,0 +1,99 @@ +diff -Naur a/Makefile.am b/Makefile.am +--- a/Makefile.am 2015-10-07 00:43:15.000000000 -0700 ++++ b/Makefile.am 2016-04-22 14:16:07.656866841 -0700 +@@ -11,21 +11,6 @@ + if USE_LINUX + udevrulesdir=@UDEV@/rules.d + hwdbdir=@UDEV@/hwdb.d +-udevrules_DATA=@UDEV_RULES@ +-hwdb_DATA=69-libmtp.hwdb +-noinst_DATA=libmtp.usermap libmtp.fdi +- +-libmtp.usermap: util/mtp-hotplug +- util/mtp-hotplug > libmtp.usermap +- +-@UDEV_RULES@: util/mtp-hotplug +- util/mtp-hotplug -u -p"@UDEV@" @UDEV_GROUP@ @UDEV_MODE@ > @UDEV_RULES@ +- +-libmtp.fdi: util/mtp-hotplug +- util/mtp-hotplug -H > libmtp.fdi +- +-$(hwdb_DATA): util/mtp-hotplug +- util/mtp-hotplug -w > $(hwdb_DATA) + + CLEANFILES = libmtp.usermap @UDEV_RULES@ libmtp.fdi libmtp.hwdb + endif +diff -Naur a/Makefile.in b/Makefile.in +--- a/Makefile.in 2016-02-10 12:17:34.000000000 -0800 ++++ b/Makefile.in 2016-04-22 14:14:22.638794537 -0700 +@@ -161,7 +161,7 @@ + } + am__installdirs = "$(DESTDIR)$(hwdbdir)" "$(DESTDIR)$(pkgconfigdir)" \ + "$(DESTDIR)$(udevrulesdir)" +-DATA = $(hwdb_DATA) $(noinst_DATA) $(pkgconfig_DATA) $(udevrules_DATA) ++DATA = $(pkgconfig_DATA) + RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive + am__recursive_targets = \ +@@ -452,21 +452,8 @@ + + distclean-libtool: + -rm -f libtool config.lt +-install-hwdbDATA: $(hwdb_DATA) +- @$(NORMAL_INSTALL) +- @list='$(hwdb_DATA)'; test -n "$(hwdbdir)" || list=; \ +- if test -n "$$list"; then \ +- echo " $(MKDIR_P) '$(DESTDIR)$(hwdbdir)'"; \ +- $(MKDIR_P) "$(DESTDIR)$(hwdbdir)" || exit 1; \ +- fi; \ +- for p in $$list; do \ +- if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ +- echo "$$d$$p"; \ +- done | $(am__base_list) | \ +- while read files; do \ +- echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(hwdbdir)'"; \ +- $(INSTALL_DATA) $$files "$(DESTDIR)$(hwdbdir)" || exit $$?; \ +- done ++install-hwdbDATA: ++ echo nope + + uninstall-hwdbDATA: + @$(NORMAL_UNINSTALL) +@@ -871,7 +858,7 @@ + + info-am: + +-install-data-am: install-hwdbDATA install-pkgconfigDATA \ ++install-data-am: install-pkgconfigDATA \ + install-udevrulesDATA + + install-dvi: install-dvi-recursive +@@ -932,7 +919,7 @@ + distdir distuninstallcheck dvi dvi-am html html-am info \ + info-am install install-am install-data install-data-am \ + install-dvi install-dvi-am install-exec install-exec-am \ +- install-html install-html-am install-hwdbDATA install-info \ ++ install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-pkgconfigDATA install-ps install-ps-am install-strip \ + install-udevrulesDATA installcheck installcheck-am installdirs \ +@@ -944,19 +931,6 @@ + + .PRECIOUS: Makefile + +- +-@USE_LINUX_TRUE@libmtp.usermap: util/mtp-hotplug +-@USE_LINUX_TRUE@ util/mtp-hotplug > libmtp.usermap +- +-@USE_LINUX_TRUE@@UDEV_RULES@: util/mtp-hotplug +-@USE_LINUX_TRUE@ util/mtp-hotplug -u -p"@UDEV@" @UDEV_GROUP@ @UDEV_MODE@ > @UDEV_RULES@ +- +-@USE_LINUX_TRUE@libmtp.fdi: util/mtp-hotplug +-@USE_LINUX_TRUE@ util/mtp-hotplug -H > libmtp.fdi +- +-@USE_LINUX_TRUE@$(hwdb_DATA): util/mtp-hotplug +-@USE_LINUX_TRUE@ util/mtp-hotplug -w > $(hwdb_DATA) +- + # Tell versions [3.59,3.63) of GNU make to not export all variables. + # Otherwise a system limit (for SysV at least) may be exceeded. + .NOEXPORT: diff --git a/packages/addons/addon-depends/system-tools-depends/diffutils/package.mk b/packages/addons/addon-depends/system-tools-depends/diffutils/package.mk new file mode 100644 index 00000000000..0cd1e59fcc5 --- /dev/null +++ b/packages/addons/addon-depends/system-tools-depends/diffutils/package.mk @@ -0,0 +1,40 @@ +################################################################################ +# This file is part of LibreELEC - http://www.libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +PKG_NAME="diffutils" +PKG_VERSION="3.3" +PKG_REV="0" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="http://www.gnu.org/software/diffutils/" +PKG_URL="ftp://ftp.gnu.org/gnu/diffutils/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_DEPENDS_TARGET="toolchain" +PKG_PRIORITY="optional" +PKG_SECTION="tools" +PKG_SHORTDESC="GNU Diffutils" +PKG_LONGDESC="GNU Diffutils is a package of several programs related to finding differences between files." +PKG_AUTORECONF="yes" + +PKG_CONFIGURE_OPTS_TARGET="--disable-nls \ + --without-libsigsegv-prefix \ + --without-libiconv-prefix \ + --without-libintl-prefix" + +makeinstall_target() { + : # nop +} diff --git a/packages/addons/addon-depends/system-tools-depends/dtach/package.mk b/packages/addons/addon-depends/system-tools-depends/dtach/package.mk new file mode 100644 index 00000000000..6a846302e2e --- /dev/null +++ b/packages/addons/addon-depends/system-tools-depends/dtach/package.mk @@ -0,0 +1,37 @@ +################################################################################ +# This file is part of LibreELEC - http://www.libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +PKG_NAME="dtach" +PKG_VERSION="0.8" +PKG_REV="0" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="http://dtach.sourceforge.net" +PKG_URL="http://download.sourceforge.net/$PKG_NAME/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain" +PKG_PRIORITY="optional" +PKG_SECTION="tools" +PKG_SHORTDESC="dtach - A program that emulates the detach feature of screen" +PKG_LONGDESC="dtach - A program that emulates the detach feature of screen" +PKG_AUTORECONF="no" + +PKG_CONFIGURE_OPTS_TARGET="--disable-nls" + +makeinstall_target() { + : # nop +} diff --git a/packages/addons/addon-depends/system-tools-depends/efibootmgr/package.mk b/packages/addons/addon-depends/system-tools-depends/efibootmgr/package.mk new file mode 100644 index 00000000000..4b87daebf79 --- /dev/null +++ b/packages/addons/addon-depends/system-tools-depends/efibootmgr/package.mk @@ -0,0 +1,42 @@ +################################################################################ +# This file is part of LibreELEC - http://www.libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +PKG_NAME="efibootmgr" +PKG_VERSION="95f7a63" # 0.8.0 +PKG_REV="1" +PKG_ARCH="x86_64" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/vathpela/efibootmgr" +PKG_URL="https://github.com/vathpela/efibootmgr-devel/archive/$PKG_VERSION.tar.gz" +PKG_SOURCE_DIR="efibootmgr-devel-$PKG_VERSION*" +PKG_DEPENDS_TARGET="toolchain efivar pciutils zlib" +PKG_PRIORITY="optional" +PKG_SECTION="tools" +PKG_SHORTDESC="EFI Boot Manager" +PKG_LONGDESC="This is a Linux user-space application to modify the Intel Extensible Firmware Interface (EFI) Boot Manager configuration. This application can create and destroy boot entries, change the boot order, change the next running boot option, and more." +PKG_AUTORECONF="no" + +pre_make_target() { + strip_lto + export EXTRA_CFLAGS="$CFLAGS -I$SYSROOT_PREFIX/usr/include -I$SYSROOT_PREFIX/usr/include/efivar -fgnu89-inline" + export LDFLAGS="$LDFLAGS -L$SYSROOT_PREFIX/usr/lib -ludev -ldl" +} + +makeinstall_target() { + : # nop +} diff --git a/packages/addons/addon-depends/system-tools-depends/efibootmgr/patches/efibootmgr-kernel-4.4.patch b/packages/addons/addon-depends/system-tools-depends/efibootmgr/patches/efibootmgr-kernel-4.4.patch new file mode 100644 index 00000000000..f6f75037d77 --- /dev/null +++ b/packages/addons/addon-depends/system-tools-depends/efibootmgr/patches/efibootmgr-kernel-4.4.patch @@ -0,0 +1,12 @@ +diff -Naur efibootmgr-ceb177a/src/lib/scsi_ioctls.c efibootmgr-ceb177a.patch/src/lib/scsi_ioctls.c +--- efibootmgr-ceb177a/src/lib/scsi_ioctls.c 2014-10-21 22:17:27.000000000 +0200 ++++ efibootmgr-ceb177a.patch/src/lib/scsi_ioctls.c 2016-03-26 13:49:59.119669675 +0100 +@@ -24,7 +24,7 @@ + #include + #include + #include +-#include ++#include + #include "scsi_ioctls.h" + + int diff --git a/packages/addons/addon-depends/system-tools-depends/evtest/package.mk b/packages/addons/addon-depends/system-tools-depends/evtest/package.mk new file mode 100644 index 00000000000..c482001ed14 --- /dev/null +++ b/packages/addons/addon-depends/system-tools-depends/evtest/package.mk @@ -0,0 +1,35 @@ +################################################################################ +# This file is part of LibreELEC - http://www.libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +PKG_NAME="evtest" +PKG_VERSION="1.33" +PKG_REV="0" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="http://cgit.freedesktop.org/evtest/" +PKG_URL="http://cgit.freedesktop.org/evtest/snapshot/$PKG_NAME-$PKG_VERSION.tar.bz2" +PKG_DEPENDS_TARGET="toolchain libxml2" +PKG_PRIORITY="optional" +PKG_SECTION="debug/tools" +PKG_SHORTDESC="evtest: Simple tool for input event debugging." +PKG_LONGDESC="evtest is a simple tool for input event debugging." +PKG_AUTORECONF="yes" + +makeinstall_target() { + : # nop +} diff --git a/packages/addons/addon-depends/system-tools-depends/fdupes/package.mk b/packages/addons/addon-depends/system-tools-depends/fdupes/package.mk new file mode 100644 index 00000000000..babba7dedb6 --- /dev/null +++ b/packages/addons/addon-depends/system-tools-depends/fdupes/package.mk @@ -0,0 +1,35 @@ +################################################################################ +# This file is part of LibreELEC - http://www.libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +PKG_NAME="fdupes" +PKG_VERSION="1.51" +PKG_REV="0" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="http://premium.caribe.net/~adrian2/fdupes.html" +PKG_URL="https://fdupes.googlecode.com/files/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain" +PKG_PRIORITY="optional" +PKG_SECTION="tools" +PKG_SHORTDESC="FDUPES is a program for identifying or deleting duplicate files residing within specified directories" +PKG_LONGDESC="FDUPES is a program for identifying or deleting duplicate files residing within specified directories" +PKG_AUTORECONF="no" + +makeinstall_target() { + : # nop +} diff --git a/packages/addons/addon-depends/system-tools-depends/fdupes/patches/fdupes-01-crosscompile.patch b/packages/addons/addon-depends/system-tools-depends/fdupes/patches/fdupes-01-crosscompile.patch new file mode 100644 index 00000000000..e9f780d796e --- /dev/null +++ b/packages/addons/addon-depends/system-tools-depends/fdupes/patches/fdupes-01-crosscompile.patch @@ -0,0 +1,12 @@ +diff --git a/Makefile b/Makefile +index 1d5e41a..6dc6da4 100644 +--- a/Makefile ++++ b/Makefile +@@ -71,7 +71,6 @@ MKDIR = mkdir -p + # + # Make Configuration + # +-CC = gcc + COMPILER_OPTIONS = -Wall -O -g + + CFLAGS= $(COMPILER_OPTIONS) -I. -DVERSION=\"$(VERSION)\" $(EXTERNAL_MD5) $(EXPERIMENTAL_RBTREE) $(OMIT_GETOPT_LONG) diff --git a/packages/addons/addon-depends/system-tools-depends/file/package.mk b/packages/addons/addon-depends/system-tools-depends/file/package.mk new file mode 100644 index 00000000000..69b2c1daf5b --- /dev/null +++ b/packages/addons/addon-depends/system-tools-depends/file/package.mk @@ -0,0 +1,39 @@ +################################################################################ +# This file is part of LibreELEC - http://www.libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +PKG_NAME="file" +PKG_VERSION="5.25" +PKG_REV="1" +PKG_ARCH="any" +PKG_LICENSE="BSD" +PKG_SITE="http://www.darwinsys.com/file/" +PKG_URL="ftp://ftp.astron.com/pub/file/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_DEPENDS_HOST="ccache:host" +PKG_DEPENDS_TARGET="toolchain zlib file:host" +PKG_PRIORITY="optional" +PKG_SECTION="tools" +PKG_SHORTDESC="file: File type identification utility" +PKG_LONGDESC="These are the sources to Darwin's file(1) utility and master magic(4) file, now maintained by Christos Zoulas. The file(1) utility is used to determine the types of various files." +PKG_AUTORECONF="yes" + +PKG_CONFIGURE_OPTS_HOST="--enable-fsect-man5 --enable-static --disable-shared" +PKG_CONFIGURE_OPTS_TARGET="--enable-fsect-man5 --enable-static --disable-shared" + +makeinstall_target() { + : # meh +} diff --git a/packages/addons/addon-depends/system-tools-depends/file/patches/file-fix-segfault-in-magic_close.patch b/packages/addons/addon-depends/system-tools-depends/file/patches/file-fix-segfault-in-magic_close.patch new file mode 100644 index 00000000000..25b0f1bb217 --- /dev/null +++ b/packages/addons/addon-depends/system-tools-depends/file/patches/file-fix-segfault-in-magic_close.patch @@ -0,0 +1,17 @@ +diff --git a/src/apprentice.c b/src/apprentice.c +index 961e83d..b7d500c 100644 +--- a/src/apprentice.c ++++ b/src/apprentice.c +@@ -348,11 +348,9 @@ apprentice_1(struct magic_set *ms, const char *fn, int action) + protected void + file_ms_free(struct magic_set *ms) + { +- size_t i; + if (ms == NULL) + return; +- for (i = 0; i < MAGIC_SETS; i++) +- mlist_free(ms->mlist[i]); ++ mlist_free(ms->mlist[0]); + free(ms->o.pbuf); + free(ms->o.buf); + free(ms->c.li); diff --git a/packages/addons/addon-depends/system-tools-depends/file/patches/file-move-magic.mgc-to-addon-data.patch b/packages/addons/addon-depends/system-tools-depends/file/patches/file-move-magic.mgc-to-addon-data.patch new file mode 100644 index 00000000000..d0a72d76122 --- /dev/null +++ b/packages/addons/addon-depends/system-tools-depends/file/patches/file-move-magic.mgc-to-addon-data.patch @@ -0,0 +1,25 @@ +From 1191268f518d298c8617a4a74644ee1bb627f614 Mon Sep 17 00:00:00 2001 +From: Stefan Saraev +Date: Mon, 25 Aug 2014 15:35:14 +0300 +Subject: [PATCH] move magic.mgc to addon/data + +--- + src/magic.c | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/src/magic.c b/src/magic.c +index e4bd12b..59c1456 100644 +--- a/src/magic.c ++++ b/src/magic.c +@@ -100,7 +100,7 @@ get_default_magic(void) + if ((home = getenv("HOME")) == NULL) + return MAGIC; + +- if (asprintf(&hmagicpath, "%s/.magic.mgc", home) < 0) ++ if (asprintf(&hmagicpath, "%s/.kodi/addons/virtual.system-tools/data/magic.mgc", home) < 0) + return MAGIC; + if (stat(hmagicpath, &st) == -1) { + free(hmagicpath); +-- +1.7.2.5 + diff --git a/packages/addons/addon-depends/system-tools-depends/file/patches/file-zip.patch b/packages/addons/addon-depends/system-tools-depends/file/patches/file-zip.patch new file mode 100644 index 00000000000..f16e3126e96 --- /dev/null +++ b/packages/addons/addon-depends/system-tools-depends/file/patches/file-zip.patch @@ -0,0 +1,26 @@ +From e990dc53f658cb67ec7b33c32e0bc24e65801792 Mon Sep 17 00:00:00 2001 +From: Christos Zoulas +Date: Sat, 14 May 2011 15:04:15 +0000 +Subject: [PATCH] small archive + +--- + magic/Magdir/archive | 5 ++++- + 1 files changed, 4 insertions(+), 1 deletions(-) + +diff --git a/magic/Magdir/archive b/magic/Magdir/archive +index e84c8e3..5ad1ce3 100644 +--- a/magic/Magdir/archive ++++ b/magic/Magdir/archive +@@ -654,6 +654,9 @@ + >>>>78 string -template Template + !:mime application/vnd.oasis.opendocument.image-template + ++>26 byte x Zip archive data ++ ++ + # StarView Metafile + # From Pierre Ducroquet + 0 string VCLMTF StarView MetaFile +-- +1.7.4.1 + diff --git a/packages/addons/addon-depends/system-tools-depends/getscancodes/package.mk b/packages/addons/addon-depends/system-tools-depends/getscancodes/package.mk new file mode 100644 index 00000000000..d0be6b805b4 --- /dev/null +++ b/packages/addons/addon-depends/system-tools-depends/getscancodes/package.mk @@ -0,0 +1,36 @@ +################################################################################ +# This file is part of LibreELEC - http://www.libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +PKG_NAME="getscancodes" +PKG_VERSION="1.0" +PKG_REV="0" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="http://keytouch.sourceforge.net" +PKG_URL="$SOURCEFORGE_SRC/keytouch/getscancodes-${PKG_VERSION}.tar.gz" +PKG_SOURCE_DIR="$PKG_NAME" +PKG_DEPENDS_TARGET="toolchain" +PKG_PRIORITY="optional" +PKG_SECTION="tools" +PKG_SHORTDESC="Shows the scancode of the pressed or released key" +PKG_LONGDESC="Shows the scancode of the pressed or released key" +PKG_AUTORECONF="no" + +makeinstall_target() { + : # nop +} diff --git a/packages/addons/addon-depends/system-tools-depends/getscancodes/patches/getscancodes-crosscompile.patch b/packages/addons/addon-depends/system-tools-depends/getscancodes/patches/getscancodes-crosscompile.patch new file mode 100644 index 00000000000..a830cbd1e34 --- /dev/null +++ b/packages/addons/addon-depends/system-tools-depends/getscancodes/patches/getscancodes-crosscompile.patch @@ -0,0 +1,24 @@ +From 06c160f28cceb32be4c8fcead3f33691a2469464 Mon Sep 17 00:00:00 2001 +From: Stefan Saraev +Date: Thu, 21 Nov 2013 23:29:07 +0200 +Subject: [PATCH] crosscompile + +--- + Makefile | 1 - + 1 files changed, 0 insertions(+), 1 deletions(-) + +diff --git a/Makefile b/Makefile +index 86ab501..355fb3d 100644 +--- a/Makefile ++++ b/Makefile +@@ -2,7 +2,6 @@ TARGET = getscancodes + SOURCES = getscancodes.c + + CFLAGS=-O2 -Wall +-CC=gcc + + OBJECTS=$(SOURCES:.c=.o) + +-- +1.7.2.5 + diff --git a/packages/addons/addon-depends/system-tools-depends/hd-idle/package.mk b/packages/addons/addon-depends/system-tools-depends/hd-idle/package.mk new file mode 100644 index 00000000000..fcd6e4a387d --- /dev/null +++ b/packages/addons/addon-depends/system-tools-depends/hd-idle/package.mk @@ -0,0 +1,32 @@ +################################################################################ +# This file is part of LibreELEC - http://www.libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +PKG_NAME="hd-idle" +PKG_VERSION="1.04" +PKG_REV="0" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="http://hd-idle.sourceforge.net/" +PKG_URL="http://downloads.sourceforge.net/project/hd-idle/${PKG_NAME}-${PKG_VERSION}.tgz" +PKG_SOURCE_DIR="$PKG_NAME" +PKG_DEPENDS_TARGET="toolchain" +PKG_PRIORITY="optional" +PKG_SECTION="tools" +PKG_SHORTDESC="hd-idle is a [Linux] utility program for spinning-down external disks after a period of idle time." +PKG_LONGDESC="hd-idle is a utility program for spinning-down external disks after a period of idle time. Since most external IDE disk enclosures don't support setting the IDE idle timer, a program like hd-idle is required to spin down idle disks automatically." +PKG_AUTORECONF="no" diff --git a/packages/addons/addon-depends/system-tools-depends/hd-idle/patches/hd-idle-makefile.patch b/packages/addons/addon-depends/system-tools-depends/hd-idle/patches/hd-idle-makefile.patch new file mode 100644 index 00000000000..5c23437d5b5 --- /dev/null +++ b/packages/addons/addon-depends/system-tools-depends/hd-idle/patches/hd-idle-makefile.patch @@ -0,0 +1,15 @@ +diff --git a/Makefile b/Makefile +index 130afd8..480032e 100644 +--- a/Makefile ++++ b/Makefile +@@ -43,8 +43,8 @@ clean: + rm -f $(OBJS) $(TARGET) + + install: $(TARGET) +- install -D -g root -o root $(TARGET) $(TARGET_DIR)/sbin/$(TARGET) +- install -D -g root -o root $(TARGET).1 $(TARGET_DIR)/share/man/man1/$(TARGET).1 ++ install -D $(TARGET) $(TARGET_DIR)/sbin/$(TARGET) ++ install -D $(TARGET).1 $(TARGET_DIR)/share/man/man1/$(TARGET).1 + + hd-idle.o: hd-idle.c + diff --git a/packages/addons/addon-depends/system-tools-depends/hddtemp/package.mk b/packages/addons/addon-depends/system-tools-depends/hddtemp/package.mk new file mode 100644 index 00000000000..887df2055af --- /dev/null +++ b/packages/addons/addon-depends/system-tools-depends/hddtemp/package.mk @@ -0,0 +1,38 @@ +################################################################################ +# This file is part of LibreELEC - http://www.libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +PKG_NAME="hddtemp" +PKG_VERSION="0.3-beta15" +PKG_REV="0" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="http://www.guzu.net/linux/hddtemp.php" +PKG_URL="http://download.savannah.gnu.org/releases/hddtemp/$PKG_NAME-$PKG_VERSION.tar.bz2" +PKG_DEPENDS_TARGET="toolchain" +PKG_PRIORITY="optional" +PKG_SECTION="debug/tools" +PKG_SHORTDESC="hddtemp: tool that reports hard drive temperature" +PKG_LONGDESC="hddtemp is a small utility (daemonizable) that gives you the temperature of your hard drive by reading S.M.A.R.T. informations (for drives that support this feature)." +PKG_AUTORECONF="no" + +PKG_CONFIGURE_OPTS_TARGET="--with-db-path=/storage/.kodi/addons/virtual.system-tools/data/hddtemp.db" + +makeinstall_target() { + : # nop +} + diff --git a/packages/addons/addon-depends/system-tools-depends/hddtemp/patches/hddtemp-0.3-beta15-52.patch b/packages/addons/addon-depends/system-tools-depends/hddtemp/patches/hddtemp-0.3-beta15-52.patch new file mode 100644 index 00000000000..9397c86b677 --- /dev/null +++ b/packages/addons/addon-depends/system-tools-depends/hddtemp/patches/hddtemp-0.3-beta15-52.patch @@ -0,0 +1,7539 @@ +--- hddtemp-0.3-beta15.orig/README ++++ hddtemp-0.3-beta15/README +@@ -28,10 +28,7 @@ + INFORMATION + =========== + hddtemp accesses to the SATA disks via ATA pass-through commands (defined in +-T10/04-262r7). At the time of writing (kernel 2.6.11-rc5 has just been +-released), kernels doesn't have support for ATA pass-through. You have to +-update the libata driver with a newer version that could be found on: +-http://www.kernel.org/pub/linux/kernel/people/jgarzik/libata/ ++T10/04-262r7). Only kernel >= 2.6.16 have this support. + + In daemon mode, hddtemp doesn't allow too much query at a time. If the interval + between two query is inferior to 1 minute, hddtemp will give the previous value +--- hddtemp-0.3-beta15.orig/debian/rules ++++ hddtemp-0.3-beta15/debian/rules +@@ -0,0 +1,110 @@ ++#!/usr/bin/make -f ++# Sample debian/rules that uses debhelper. ++# GNU copyright 1997 to 1999 by Joey Hess. ++ ++# Uncomment this to turn on verbose mode. ++#export DH_VERBOSE=1 ++ ++# These are used for cross-compiling and for saving the configure script ++# from having to guess our platform (since we know it already) ++DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) ++DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) ++ ++# Get flags from dpkg-buildflags ++CFLAGS = $(shell dpkg-buildflags --get CFLAGS) ++CPPFLAGS = $(shell dpkg-buildflags --get CPPFLAGS) ++LDFLAGS = $(shell dpkg-buildflags --get LDFLAGS) ++ ++ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) ++ INSTALL_PROGRAM += -s ++endif ++ ++config.status: configure ++ dh_testdir ++ ++ -test -r /usr/share/misc/config.sub && \ ++ cp -f /usr/share/misc/config.sub config.sub ++ -test -r /usr/share/misc/config.guess && \ ++ cp -f /usr/share/misc/config.guess config.guess ++ ++ CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" \ ++ ./configure --host=$(DEB_HOST_GNU_TYPE) \ ++ --build=$(DEB_BUILD_GNU_TYPE) \ ++ --prefix=/usr \ ++ --mandir=\$${prefix}/share/man \ ++ --infodir=\$${prefix}/share/info \ ++ --with-db-path=/etc/hddtemp.db ++ ++build: build-arch build-indep ++ ++build-arch: build-arch-stamp ++build-arch-stamp: config.status ++ dh_testdir ++ $(MAKE) ++ touch build-stamp ++ ++build-indep: ++ ++clean: debian-clean ++ dh_clean ++ ++debian-clean: ++ dh_testdir ++ dh_testroot ++ [ ! -f Makefile ] || $(MAKE) distclean ++ rm -f po/*.gmo po/stamp-po ++ -rm -f *-stamp ++ -rm -f config.sub config.guess ++ ++install: build ++ dh_testdir ++ dh_testroot ++ dh_clean -k ++ dh_installdirs ++ ++ # Add here commands to install the package into debian/hddtemp. ++ $(MAKE) install DESTDIR=$(CURDIR)/debian/hddtemp ++ ++ install -p -o root -g root -m 644 $(CURDIR)/debian/hddtemp.db \ ++ $(CURDIR)/debian/hddtemp/etc/hddtemp.db ++ ++ cp -a $(CURDIR)/contribs $(CURDIR)/debian/hddtemp/usr/share/doc/hddtemp ++ rm -f $(CURDIR)/debian/hddtemp/usr/share/doc/hddtemp/Makefile* ++ ++# Build architecture-independent files here. ++binary-indep: build install ++# We have nothing to do by default. ++ ++# Build architecture-dependent files here. ++binary-arch: build install ++ dh_testdir ++ dh_testroot ++ dh_installdebconf ++ dh_installdocs ++ dh_installexamples ++ dh_installmenu ++ dh_installlogcheck ++# dh_installlogrotate ++# dh_installemacsen ++# dh_installpam ++# dh_installmime ++ dh_installinit ++ dh_installcron ++ dh_installman ++ dh_installinfo ++ dh_installchangelogs ChangeLog ++ dh_link ++ dh_strip ++ dh_compress ++ dh_fixperms ++# dh_makeshlibs ++ dh_installdeb ++# dh_perl ++ dh_shlibdeps ++ dh_gencontrol ++ dh_md5sums ++ dh_builddeb ++ ++binary: binary-indep binary-arch ++.PHONY: build build-arch build-indep clean binary-indep binary-arch binary install ++ +--- hddtemp-0.3-beta15.orig/debian/docs ++++ hddtemp-0.3-beta15/debian/docs +@@ -0,0 +1,2 @@ ++README ++TODO +--- hddtemp-0.3-beta15.orig/debian/postrm ++++ hddtemp-0.3-beta15/debian/postrm +@@ -0,0 +1,28 @@ ++#! /bin/sh ++# postrm script for hddtemp ++set -e ++ ++conffile="/etc/default/hddtemp" ++ ++case "$1" in ++ purge) ++ rm -f $conffile ++ ;; ++ remove) ++ rm -f /usr/bin/hddtemp ++ rm -f /usr/share/man/man1/hddtemp.1.gz ++ ;; ++ upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) ++ ;; ++ *) ++ echo "postrm called with unknown argument \`$1'" >&2 ++ exit 1 ++ ;; ++esac ++ ++# dh_installdeb will replace this with shell code automatically ++# generated by other debhelper scripts. ++ ++#DEBHELPER# ++ ++exit 0 +--- hddtemp-0.3-beta15.orig/debian/changelog ++++ hddtemp-0.3-beta15/debian/changelog +@@ -0,0 +1,1289 @@ ++hddtemp (0.3-beta15-52) unstable; urgency=low ++ ++ * Decrease hddtemp/daemon priority to medium from high (closes: ++ bug#680877). ++ * Bumped Standards-Version to 3.9.3. ++ ++ -- Aurelien Jarno Mon, 09 Jul 2012 08:12:30 +0200 ++ ++hddtemp (0.3-beta15-51) unstable; urgency=low ++ ++ * init script: also probe for double letter drives (closes: bug#646724). ++ ++ -- Aurelien Jarno Sun, 30 Oct 2011 20:21:06 +0100 ++ ++hddtemp (0.3-beta15-50) unstable; urgency=low ++ ++ * Convert hddtemp.db to UTF-8 (closes: bug#640899). ++ * Don't restart on reload in init.d (closes: bug#643610). ++ * Add a status option in init.d (closes: bug#643611). ++ ++ -- Aurelien Jarno Sun, 09 Oct 2011 20:16:06 +0200 ++ ++hddtemp (0.3-beta15-49) unstable; urgency=low ++ ++ * Added Slovak debconf templates. Thanks to Slavko (closes: bug#634519). ++ * Fix a few typo in translation and enable German translation. Thanks to ++ Ville Skyttä for tha patch. ++ * Add build-arch and build-indep targets. ++ ++ -- Aurelien Jarno Tue, 30 Aug 2011 16:32:45 +0200 ++ ++hddtemp (0.3-beta15-48) unstable; urgency=low ++ ++ * Fix backtrace support on i386. ++ * Add backtrace support on amd64. ++ ++ -- Aurelien Jarno Sun, 05 Jun 2011 00:18:46 +0200 ++ ++hddtemp (0.3-beta15-47) unstable; urgency=low ++ ++ * Fix reading model on SATA big-endian (closes: #602307). ++ * Updated Arabic debconf templates, thanks to Ossama Khaya (closes: ++ bug#596177). ++ * Updated Swedish debconf template, thanks to Joe Hansen (closes: ++ bug#603109). ++ * Update Dutch debconf translation, thanks to Jeroen Schot (closes: ++ bug#628757). ++ * Bumped Standards-Version to 3.9.2 (no changes). ++ ++ -- Aurelien Jarno Sat, 04 Jun 2011 21:36:32 +0200 ++ ++hddtemp (0.3-beta15-46) unstable; urgency=low ++ ++ * Don't probe /dev/sg? by default (closes: bug#531849). ++ * Add initial German translation, by Helge Kreutzmann (closes: #503710). ++ * Fix a typo in the help message (closes: #503711). ++ * Correctly zero-terminate long product ID strings (closes: #517981). ++ * Bumped Standards-Version to 3.8.4 (no changes). ++ ++ -- Aurelien Jarno Sun, 07 Feb 2010 20:24:49 +0100 ++ ++hddtemp (0.3-beta15-45) unstable; urgency=low ++ ++ * Updated Swedish debconf templates. Thanks to Martin Bagge (closes: ++ bug#491768). ++ * Improve init script, by Cristian Ionescu-Idbohrn (closes: bug#486235). ++ * Mention /etc/init.d/hddtemp and /etc/default/hddtemp in README.Debian ++ (closes: bug#482982). ++ * Bumped Standards-Version to 3.8.0 (no changes). ++ ++ -- Aurelien Jarno Sun, 27 Jul 2008 09:44:06 +0200 ++ ++hddtemp (0.3-beta15-44) unstable; urgency=low ++ ++ * Updated Japanese debconf templates. Thanks to Kenshi Muto (closes: ++ bug#483504). ++ ++ -- Aurelien Jarno Mon, 02 Jun 2008 10:30:58 +0200 ++ ++hddtemp (0.3-beta15-43) unstable; urgency=low ++ ++ * Don't wake up SATA drives if not asked (closes: #479840). ++ ++ -- Aurelien Jarno Sat, 10 May 2008 13:24:18 +0200 ++ ++hddtemp (0.3-beta15-42) unstable; urgency=low ++ ++ * Use minus instead of hyphenin manpage. ++ ++ -- Aurelien Jarno Sun, 02 Mar 2008 19:14:14 +0100 ++ ++hddtemp (0.3-beta15-41) unstable; urgency=low ++ ++ * Fixed LSB header in init script (closes: bug#466281). ++ ++ -- Aurelien Jarno Sun, 17 Feb 2008 18:22:21 +0100 ++ ++hddtemp (0.3-beta15-40) unstable; urgency=low ++ ++ * Added Basque debconf templates. Thanks to Piarres Beobide (closes: ++ bug#465731). ++ ++ -- Aurelien Jarno Fri, 15 Feb 2008 21:59:07 +0100 ++ ++hddtemp (0.3-beta15-39) unstable; urgency=low ++ ++ [ Aurelien Jarno ] ++ * Bumped Standards-Version to 3.7.3 (no changes). ++ ++ [ Christian Perrier ] ++ * Debconf templates and debian/control reviewed by the debian-l10n- ++ english team as part of the Smith review project. Closes: #462483 ++ * [Debconf translation updates] ++ * Norwegian Bokmål. Closes: #462799 ++ * German. Closes: #462843 ++ * Galician. Closes: #462988 ++ * Spanish. Closes: #463898 ++ * Finnish. Closes: #463943 ++ * Czech. Closes: #464224 ++ * Russian. Closes: #464566 ++ * Italian. Closes: #465069 ++ * Portuguese. Closes: #465135 ++ * Vietnamese. Closes: #465534 ++ * French. Closes: #465650 ++ ++ -- Aurelien Jarno Wed, 13 Feb 2008 23:43:53 +0100 ++ ++hddtemp (0.3-beta15-38) unstable; urgency=low ++ ++ * Fix typo in hddtemp manpage (closes: bug#444242). ++ ++ -- Aurelien Jarno Tue, 11 Dec 2007 15:17:16 +0100 ++ ++hddtemp (0.3-beta15-37) unstable; urgency=low ++ ++ * Updated Czech debconf templates. Thanks to Miroslav Kure (closes: ++ bug#413322). ++ * Added Galician debconf templates. Thanks to Jacobo Tarrio (closes: ++ bug#412198). ++ * Clean po/stamp-po to make sure the .gmo files are regenerated (closes: ++ bug#441708). ++ * Updated Portuguese translation, thanks to Rui Branco (closes: ++ bug#418281). ++ * Updated Vietnamese debconf translation. Thanks to Clytie Siddall (closes: ++ bug#427039). ++ * Fixed man page formatting error (closes: bug#439074). ++ * Fix a segfault when using --unit and --numeric (closes: bug#412368). ++ * Exit with error code != 0 in case of error (closes: bug#423509). ++ ++ -- Aurelien Jarno Wed, 12 Sep 2007 11:36:05 +0200 ++ ++hddtemp (0.3-beta15-36) unstable; urgency=low ++ ++ * Fix the init script, trying to kill not running daemon on shutdown ++ (closes: #411645). ++ ++ -- Aurelien Jarno Tue, 20 Feb 2007 22:04:01 +0100 ++ ++hddtemp (0.3-beta15-35) unstable; urgency=low ++ ++ * Updated Portuguese translation, thanks to Miguel Figueire (closes: ++ bug#409491). ++ ++ -- Aurelien Jarno Tue, 20 Feb 2007 08:22:22 +0100 ++ ++hddtemp (0.3-beta15-34) unstable; urgency=low ++ ++ * Relax SATA magic checkings (closes: #404310) ++ * Updated Swedish debconf template. Thanks to Daniel Nylander (closes: ++ bug#398788). ++ * /etc/default/hddtemp: changed SYSLOG into RUN_SYSLOG and fixed the ++ comments (closes: bug#401978). ++ ++ -- Aurelien Jarno Fri, 19 Jan 2007 00:38:27 +0100 ++ ++hddtemp (0.3-beta15-33) unstable; urgency=medium ++ ++ * Update the description (closes: #401428). ++ ++ -- Aurelien Jarno Mon, 4 Dec 2006 06:04:38 +0100 ++ ++hddtemp (0.3-beta15-32) unstable; urgency=low ++ ++ * Updated German debconf template. Thanks to Erik Schanze (closes: ++ bug#397209). ++ ++ -- Aurelien Jarno Mon, 27 Nov 2006 14:42:32 +0100 ++ ++hddtemp (0.3-beta15-31) unstable; urgency=low ++ ++ * Remove the suggest on gkrellm-hddtemp (closes: bug#398938). ++ * Updated Swedish debconf template. Thanks to Daniel Nylander (closes: ++ bug#398788). ++ * Added Swedish translation. Thanks to Daniel Nylander (closes: ++ bug#398787). ++ * Added and LSB header to the init script. ++ ++ -- Aurelien Jarno Mon, 27 Nov 2006 12:14:49 +0100 ++ ++hddtemp (0.3-beta15-30) unstable; urgency=medium ++ ++ * Remove a space in the printed temperature when a disk is not present ++ in hddtemp.db. ++ ++ -- Aurelien Jarno Thu, 19 Oct 2006 14:50:09 +0200 ++ ++hddtemp (0.3-beta15-29) unstable; urgency=medium ++ ++ * Also consider field 194 as a temperature in Celsius if the disk ++ is not present in hddtemp.db in daemon mode (closes: bug#391870). ++ ++ -- Aurelien Jarno Mon, 9 Oct 2006 16:42:47 +0200 ++ ++hddtemp (0.3-beta15-28) unstable; urgency=medium ++ ++ * Always consider field 194 as a temperature in Celsius if the disk ++ is not present in hddtemp.db (closes: bug#387102, #386943, #389290, ++ #387403, #389309, #387544) ++ * Updated Czech debconf template. Thanks to Miroslav Jezbera (closes: ++ bug#389244). ++ * Set urgency to medium as I really want to get this version in etch ++ (and not bother with roughly one bug report per week). ++ ++ -- Aurelien Jarno Wed, 4 Oct 2006 01:53:51 +0200 ++ ++hddtemp (0.3-beta15-27) unstable; urgency=low ++ ++ * Depends on lsb-base (>= 3.0-3) (closes: bug#386859). ++ * Added support for Western Digital WD2000JD (closes: bug#385604). ++ * Added support for Seagate NL35 SATA (closes: bug#385187). ++ * Added support for ST3160811AS (closes: bug#385335). ++ * Added support for WD400BB-00DKA0 (closes: bug#386857). ++ ++ -- Aurelien Jarno Mon, 11 Sep 2006 00:13:15 +0200 ++ ++hddtemp (0.3-beta15-26) unstable; urgency=low ++ ++ * Added support for SAMSUNG HD160JJ. ++ ++ -- Aurelien Jarno Sat, 26 Aug 2006 22:29:13 +0200 ++ ++hddtemp (0.3-beta15-25) unstable; urgency=low ++ ++ * Added support for WD1200JD-00FYB0 (closes: bug#383692). ++ ++ -- Aurelien Jarno Sun, 20 Aug 2006 15:00:15 +0200 ++ ++hddtemp (0.3-beta15-24) unstable; urgency=low ++ ++ * Updated Spanish debconf template. Thanks to Carlos Valdivia Yagüe (closes: ++ bug#383374:). ++ ++ -- Aurelien Jarno Thu, 17 Aug 2006 10:25:43 +0200 ++ ++hddtemp (0.3-beta15-23) unstable; urgency=low ++ ++ * Added support for WDC WD3200SD-01KNB0 (closes: bug#382449). ++ * Added support for ST3400633 (closes: bug#382546). ++ * Added various Seagate 7200.10 drives, patch by Petr Vandrovec (closes: ++ bug#382490). ++ ++ -- Aurelien Jarno Fri, 11 Aug 2006 21:46:40 +0200 ++ ++hddtemp (0.3-beta15-22) unstable; urgency=low ++ ++ * Added support for ST3320620AS (closes: bug#382300). ++ ++ -- Aurelien Jarno Thu, 10 Aug 2006 11:24:58 +0200 ++ ++hddtemp (0.3-beta15-21) unstable; urgency=low ++ ++ * Added support for Toshiba MK1032GSX (closes: bug#382130). ++ ++ -- Aurelien Jarno Wed, 9 Aug 2006 19:27:36 +0200 ++ ++hddtemp (0.3-beta15-20) unstable; urgency=low ++ ++ * Added support for Maxtor 6V300F0 (closes: bug#382071). ++ * Added support for Seagate ST98823AS (closes: bug#382009). ++ ++ -- Aurelien Jarno Tue, 8 Aug 2006 18:28:24 +0200 ++ ++hddtemp (0.3-beta15-19) unstable; urgency=low ++ ++ * Added support for ST3250624AS (closes: bug#381837). ++ * Added support for WDC WD3200KS-00PFB0 (closes: bug#381837). ++ ++ -- Aurelien Jarno Mon, 7 Aug 2006 23:38:39 +0200 ++ ++hddtemp (0.3-beta15-18) unstable; urgency=low ++ ++ * Added support for MHV2060AH. ++ ++ -- Aurelien Jarno Sat, 5 Aug 2006 21:19:56 +0200 ++ ++hddtemp (0.3-beta15-17) unstable; urgency=low ++ ++ * Added support for WDC WD1500ADFD-00NLR0 (closes: bug#381403). ++ ++ -- Aurelien Jarno Sat, 5 Aug 2006 17:00:30 +0200 ++ ++hddtemp (0.3-beta15-16) unstable; urgency=low ++ ++ * Updated Japanese debconf template. Thanks to Kenshi Muto (closes: ++ bug#379945). ++ * Added support for ST3808110AS and ST3160812AS (closes: bug#380478). ++ * Added support for ST3160812A (closes: bug#379701). ++ ++ -- Aurelien Jarno Sun, 30 Jul 2006 22:54:13 +0200 ++ ++hddtemp (0.3-beta15-15) unstable; urgency=low ++ ++ * Added support for WDC WD2500JD-75HBB0 (closes: bug#379024). ++ ++ -- Aurelien Jarno Thu, 20 Jul 2006 21:47:04 +0200 ++ ++hddtemp (0.3-beta15-14) unstable; urgency=low ++ ++ * Use lsb init-functions in init script. Thanks to Benjamin Leipold for the ++ patch (closes: bug#378118). ++ ++ -- Aurelien Jarno Fri, 14 Jul 2006 15:08:39 +0200 ++ ++hddtemp (0.3-beta15-13) unstable; urgency=low ++ ++ * Added support for Toshiba MK8032GSX (Closes: #375486). ++ * Update the minimum kernel version (2.6.16) necessary to support ++ SATA in README. ++ * Print all warning/messages to stderr. ++ * Applied patch by Andras Korn (Closes: #374796) to allow the hddtemp ++ daemon to stay in the foreground. ++ ++ -- Aurelien Jarno Thu, 29 Jun 2006 15:11:47 +0200 ++ ++hddtemp (0.3-beta15-12) unstable; urgency=low ++ ++ * Added Dutch debconf translation, thanks to Kurt De Bree (closes: ++ bug#370072). ++ ++ -- Aurelien Jarno Sat, 3 Jun 2006 19:45:21 +0200 ++ ++hddtemp (0.3-beta15-11) unstable; urgency=low ++ ++ * Updated Danish debconf template. Thanks to Claus Hindsgaul (closes: ++ bug#368045). ++ ++ -- Aurelien Jarno Fri, 19 May 2006 17:25:32 +0000 ++ ++hddtemp (0.3-beta15-10) unstable; urgency=low ++ ++ * Updated French debconf translation, thanks to Jean-Luc Coulon (closes: ++ bug#367540). ++ ++ -- Aurelien Jarno Tue, 16 May 2006 21:42:39 +0200 ++ ++hddtemp (0.3-beta15-9) unstable; urgency=low ++ ++ * debian/templates: Changed How often into in interval. (closes: bug#367382). ++ * debian/templates: fixed the templates to make lintian happy. ++ ++ -- Aurelien Jarno Mon, 15 May 2006 20:21:49 +0200 ++ ++hddtemp (0.3-beta15-8) unstable; urgency=low ++ ++ * Added support for SAMSUNG HD300LJ (closes: bug#367250). ++ ++ -- Aurelien Jarno Sun, 14 May 2006 20:08:31 +0200 ++ ++hddtemp (0.3-beta15-7) unstable; urgency=low ++ ++ * Added support for HDS722516VLSA80 (closes: bug#366742). ++ ++ -- Aurelien Jarno Thu, 11 May 2006 05:46:24 +0200 ++ ++hddtemp (0.3-beta15-6) unstable; urgency=low ++ ++ * Added support for FUJITSU MHV2100BH (closes: bug#366388). ++ ++ -- Aurelien Jarno Wed, 10 May 2006 06:29:54 +0200 ++ ++hddtemp (0.3-beta15-5) unstable; urgency=low ++ ++ * Added support for WDC WD740GD-00FLA1 (closes: bug#366021). ++ * Bumped Standards-Version to 3.7.2 (no changes). ++ ++ -- Aurelien Jarno Thu, 4 May 2006 18:38:15 +0200 ++ ++hddtemp (0.3-beta15-4) unstable; urgency=low ++ ++ * Fix a crash in daemon (syslog) mode when the hard disk is not known ++ (closes: bug#365605). ++ * Added support for WD1200JB-00REA0. ++ ++ -- Aurelien Jarno Wed, 3 May 2006 20:27:11 +0200 ++ ++hddtemp (0.3-beta15-3) unstable; urgency=low ++ ++ * Added support for WDC WD800JD-75JNC0 (closes: bug#365359). ++ * Added support for WDC WD2500KS and WDC WD2500YD. ++ ++ -- Aurelien Jarno Tue, 2 May 2006 21:49:37 +0200 ++ ++hddtemp (0.3-beta15-2) unstable; urgency=low ++ ++ * Updated database for Maxtors MaxLineIII series drives (closes: ++ bug#365011). ++ ++ -- Aurelien Jarno Thu, 27 Apr 2006 14:45:22 +0200 ++ ++hddtemp (0.3-beta15-1) unstable; urgency=low ++ ++ * New upstream version. ++ ++ -- Aurelien Jarno Thu, 27 Apr 2006 05:25:06 +0200 ++ ++hddtemp (0.3-beta14-12) unstable; urgency=low ++ ++ * Added Portuguese translation, thanks to Miguel Figueire (closes: ++ bug#361505). ++ ++ -- Aurelien Jarno Tue, 11 Apr 2006 00:38:51 +0200 ++ ++hddtemp (0.3-beta14-11) unstable; urgency=low ++ ++ * Added support for WDC WD2500PD-00FZB1, WDC WD2500SD-01KCB0, WDC ++ WD1200JD-00HBC0 and WDC WD4000YR-01PLB0 (closes: bug#357804). ++ ++ -- Aurelien Jarno Sat, 25 Mar 2006 20:29:42 +0100 ++ ++hddtemp (0.3-beta14-10) unstable; urgency=low ++ ++ * Use F for fahrenheit. ++ * Added support for Hitachi DK23EA-20B (closes: bug#355763). ++ ++ -- Aurelien Jarno Sat, 18 Mar 2006 11:39:20 +0100 ++ ++hddtemp (0.3-beta14-9) unstable; urgency=low ++ ++ * Update hddtemp.db (closes: bug#355469). ++ ++ -- Aurelien Jarno Mon, 6 Mar 2006 00:40:35 +0100 ++ ++hddtemp (0.3-beta14-8) unstable; urgency=low ++ ++ * Don't flood syslog if the system clock wraps (closes: bug#354260). ++ ++ -- Aurelien Jarno Fri, 24 Feb 2006 21:32:36 +0100 ++ ++hddtemp (0.3-beta14-7) unstable; urgency=low ++ ++ * Correctly initialize the structure dsk. ++ ++ -- Aurelien Jarno Sat, 4 Feb 2006 22:01:07 +0100 ++ ++hddtemp (0.3-beta14-6) unstable; urgency=low ++ ++ * Added support for TOSHIBA MK4026GAX. ++ ++ -- Aurelien Jarno Sun, 11 Dec 2005 21:13:06 +0100 ++ ++hddtemp (0.3-beta14-5) unstable; urgency=low ++ ++ * Added Swedish translation of hddtemp. Thanks to Daniel Nylander (close: ++ bug#337117). ++ ++ -- Aurelien Jarno Thu, 3 Nov 2005 01:56:26 +0100 ++ ++hddtemp (0.3-beta14-4) unstable; urgency=low ++ ++ * Fixed the package device patch. ++ ++ -- Aurelien Jarno Thu, 27 Oct 2005 03:18:43 +0200 ++ ++hddtemp (0.3-beta14-3) unstable; urgency=low ++ ++ * Don't try to read temperature from packet devices drives (closes: ++ bug#316750, bug#335571). ++ * Verify the response length when calling modesense (closes: ++ bug#278345). ++ ++ -- Aurelien Jarno Thu, 27 Oct 2005 01:02:21 +0200 ++ ++hddtemp (0.3-beta14-2) unstable; urgency=low ++ ++ * Added Swedish debconf translation. Thanks to Daniel Nylander (closes: ++ bug#333713). ++ ++ -- Aurelien Jarno Fri, 14 Oct 2005 11:22:05 +0200 ++ ++hddtemp (0.3-beta14-1) unstable; urgency=low ++ ++ * New upstream version. ++ ++ -- Aurelien Jarno Wed, 21 Sep 2005 14:48:43 +0200 ++ ++hddtemp (0.3-beta13-23) unstable; urgency=low ++ ++ * Added SAMSUNG SP2014N disk to the database. ++ ++ -- Aurelien Jarno Wed, 14 Sep 2005 11:27:22 +0200 ++ ++hddtemp (0.3-beta13-22) unstable; urgency=low ++ ++ * Updated hddtemp.db (closes: bug#326180, bug#326181). ++ ++ -- Aurelien Jarno Tue, 6 Sep 2005 03:51:29 +0200 ++ ++hddtemp (0.3-beta13-21) unstable; urgency=low ++ ++ * Added TOSHIBA MK4026GAX disk to the database (closes: bug#325702). ++ ++ -- Aurelien Jarno Wed, 31 Aug 2005 11:16:55 +0200 ++ ++hddtemp (0.3-beta13-20) unstable; urgency=low ++ ++ * Added Arabic debconf translation. Thanks to Mohammed Adnène Trojette ++ (closes: bug#320766). ++ ++ -- Aurelien Jarno Mon, 1 Aug 2005 15:40:56 +0200 ++ ++hddtemp (0.3-beta13-19) unstable; urgency=low ++ ++ * Fixed DISKS_NOPROBE when no other disks are detected. ++ * Added a logcheck rule to ignore sleeping drives (closes: bug#316613). ++ * Bumped Standards-Version to 3.6.2 (no changes). ++ ++ -- Aurelien Jarno Wed, 6 Jul 2005 19:15:16 +0200 ++ ++hddtemp (0.3-beta13-18) unstable; urgency=low ++ ++ * Added DISKS_NOPROBE option to the /etc/default/hddtemp (closes: ++ bug#316270). ++ ++ -- Aurelien Jarno Wed, 29 Jun 2005 22:13:53 +0200 ++ ++hddtemp (0.3-beta13-17) unstable; urgency=low ++ ++ * Updated database. ++ * Added support for Western Digital Caviar WD800BB (closes: bug#312247). ++ ++ -- Aurelien Jarno Thu, 9 Jun 2005 23:16:25 +0200 ++ ++hddtemp (0.3-beta13-16) unstable; urgency=low ++ ++ * Updated Vietnamese debconf translation. Thanks to Clytie Siddall (closes: ++ bug#311893). ++ * Fixed a typo in the debconf template. Thanks to Clytie Siddall (closes: ++ bug#311894). ++ ++ -- Aurelien Jarno Sat, 4 Jun 2005 17:03:31 +0200 ++ ++hddtemp (0.3-beta13-15) unstable; urgency=low ++ ++ * Updated German debconf translation. Thanks to Erik Schanze (closes: ++ bug#311716). ++ ++ -- Aurelien Jarno Fri, 3 Jun 2005 00:41:00 +0200 ++ ++hddtemp (0.3-beta13-14) unstable; urgency=low ++ ++ * Added SV4012H to the database. ++ ++ -- Aurelien Jarno Tue, 24 May 2005 00:54:01 +0200 ++ ++hddtemp (0.3-beta13-13) unstable; urgency=low ++ ++ * Added WD800BB-00JHA0 to the database (closes: bug#310301). ++ ++ -- Aurelien Jarno Mon, 23 May 2005 01:08:43 +0200 ++ ++hddtemp (0.3-beta13-12) unstable; urgency=low ++ ++ * Added HDS722512VLAT80 to the database (closes: bug#309011). ++ * Added Vietnamese debconf translation. Thanks to Clytie Siddall (closes: ++ bug#309451). ++ ++ -- Aurelien Jarno Mon, 16 May 2005 16:58:00 +0200 ++ ++hddtemp (0.3-beta13-11) unstable; urgency=low ++ ++ * Added WD2500JB-55GVA0 to the database (closes: bug#307673). ++ ++ -- Aurelien Jarno Wed, 4 May 2005 23:47:12 +0200 ++ ++hddtemp (0.3-beta13-10) unstable; urgency=high ++ ++ * Daemonization fixed (closes: bug#307113). ++ * Added HDS722525VLSA80 to the database (closes: bug#306691). ++ ++ -- Aurelien Jarno Mon, 2 May 2005 01:01:54 +0200 ++ ++hddtemp (0.3-beta13-9) unstable; urgency=low ++ ++ * Remove /etc/logcheck.ignore.workstation/hddtemp in postinst. ++ ++ -- Aurelien Jarno Fri, 22 Apr 2005 18:35:58 +0200 ++ ++hddtemp (0.3-beta13-8) unstable; urgency=low ++ ++ * Really applied Danish debconf template (closes: bug#302353). ++ * Updated Czech debconf template. Thanks to Miroslav Jezbera (closes: ++ bug#304716). ++ * Updated French debconf template. Thanks to Jean-Luc Coulon (closes: ++ bug#303061). ++ * Added WD2000JB-32EVA0 to hddtemp.deb (closes: bug#302760). ++ * Fixed logcheck ignore files (closes: bug#304110). ++ ++ -- Aurelien Jarno Fri, 15 Apr 2005 06:26:34 +0200 ++ ++hddtemp (0.3-beta13-7) unstable; urgency=low ++ ++ * Updated Danish debconf template. Thanks to Claus Hindsgaul (closes: ++ bug#302353). ++ ++ -- Aurelien Jarno Fri, 15 Apr 2005 06:15:19 +0200 ++ ++hddtemp (0.3-beta13-6) unstable; urgency=low ++ ++ * Updated Japanese debconf template. Thanks to Kenshi Muto (closes: ++ bug#302322). ++ ++ -- Aurelien Jarno Thu, 31 Mar 2005 12:26:56 +0200 ++ ++hddtemp (0.3-beta13-5) unstable; urgency=low ++ ++ * Fixed French debconf template. ++ ++ -- Aurelien Jarno Wed, 30 Mar 2005 22:59:34 +0200 ++ ++hddtemp (0.3-beta13-4) unstable; urgency=low ++ ++ * debian/templates: s/gkrellm-hdtemp/gkrellm/g (closes: bug#302178). ++ ++ -- Aurelien Jarno Wed, 30 Mar 2005 15:21:10 +0200 ++ ++hddtemp (0.3-beta13-3) unstable; urgency=medium ++ ++ * Don't listen on socket if only syslog is choosen in debconf. Thanks to ++ Mario Holbe for the patch (closes: bug#302065). ++ ++ -- Aurelien Jarno Wed, 30 Mar 2005 01:25:04 +0200 ++ ++hddtemp (0.3-beta13-2) unstable; urgency=medium ++ ++ * Try to detect cdrom drives using the ide-scsi driver (closes: ++ bug#302061). ++ ++ -- Aurelien Jarno Wed, 30 Mar 2005 00:38:49 +0200 ++ ++hddtemp (0.3-beta13-1) unstable; urgency=medium ++ ++ * New upstream version which contains the same code as in the previous ++ Debian package. ++ * Use SG_IO only when available (closes: bug#300679). ++ * Added syslog option in debconf (closes: bug#300332). ++ * Fixed the manpage (closes: bug#300332). ++ * Only disable SCSI exceptions if they are already enabled (closes: ++ bug#278345). ++ ++ -- Aurelien Jarno Tue, 29 Mar 2005 15:56:03 +0200 ++ ++hddtemp (0.3-beta12-16) unstable; urgency=low ++ ++ * Verify SATA magics in the ATA pass through subroutine. ++ ++ -- Aurelien Jarno Sun, 27 Feb 2005 16:51:48 +0100 ++ ++hddtemp (0.3-beta12-15) unstable; urgency=low ++ ++ * Change the way SATA disks are detected, so that there is no more ++ SCSI errors with SCSI disks. ++ * Print SCSI disks name in a smarter way. ++ * Updated database. ++ ++ -- Aurelien Jarno Fri, 25 Feb 2005 22:59:36 +0100 ++ ++hddtemp (0.3-beta12-14) unstable; urgency=low ++ ++ * Converted SCSI subroutines to SG_IO (closes: bug#235422, bug#275612, ++ bug#292205). ++ * Added support for SATA (closes: bug#227409). A kernel patch for ++ SATA is still need (see /usr/share/doc/hddtemp/README). ++ ++ -- Aurelien Jarno Fri, 25 Feb 2005 02:16:57 +0100 ++ ++hddtemp (0.3-beta12-13) unstable; urgency=low ++ ++ * Don't display an error message if /proc/sys/dev/cdrom/info doesn't ++ exist (systems without CDROM drives) (closes: bug#295814). ++ ++ -- Aurelien Jarno Fri, 18 Feb 2005 12:42:18 +0100 ++ ++hddtemp (0.3-beta12-12) unstable; urgency=low ++ ++ * Added Hitachi Deskstar 7K80 40G and 80GB disks. ++ ++ -- Aurelien Jarno Sun, 6 Feb 2005 17:49:15 +0100 ++ ++hddtemp (0.3-beta12-11) unstable; urgency=low ++ ++ * Uses /proc/sys/dev/cdrom/info instead of hardcoded paths to detect CDROM ++ drives (closes: bug#293542). ++ ++ -- Aurelien Jarno Fri, 4 Feb 2005 11:15:37 +0100 ++ ++hddtemp (0.3-beta12-10) unstable; urgency=low ++ ++ * Added a README.Debian to explain why the init script could not found ++ some disks. ++ ++ -- Aurelien Jarno Tue, 25 Jan 2005 16:46:53 +0100 ++ ++hddtemp (0.3-beta12-9) unstable; urgency=low ++ ++ * Updated Brasilian translation. Thanks to Tiago Bortoletto Vaz (closes: ++ bug#283832). ++ ++ -- Aurelien Jarno Wed, 1 Dec 2004 21:40:42 +0100 ++ ++hddtemp (0.3-beta12-8) unstable; urgency=low ++ ++ * Updated hddtemp.db. ++ * Added MHT2060AH drive (closes: bug#280805). ++ ++ -- Aurelien Jarno Wed, 1 Dec 2004 19:19:37 +0100 ++ ++hddtemp (0.3-beta12-7) unstable; urgency=low ++ ++ * Updated German debconf translation. Thanks to Erik Schanze (closes: ++ bug#282280). ++ ++ -- Aurelien Jarno Sun, 21 Nov 2004 16:22:41 +0100 ++ ++hddtemp (0.3-beta12-6) unstable; urgency=low ++ ++ * Don't abord the script if /dev/cdrom doesn't exists. ++ ++ -- Aurelien Jarno Mon, 25 Oct 2004 14:46:42 +0000 ++ ++hddtemp (0.3-beta12-5) unstable; urgency=low ++ ++ * Added a patch to allow temperatures to be logged to syslog (closes: ++ bug#271508). ++ * Added hddtemp-all.sh to contribs. Thanks to Javier Fernández-Sanguino ++ Peña (closes: bug#276444). ++ * /etc/init.d/hddtemp: skip CD and DVD drives. ++ ++ -- Aurelien Jarno Sun, 24 Oct 2004 17:30:34 +0200 ++ ++hddtemp (0.3-beta12-4) unstable; urgency=low ++ ++ * Print "done." in the init script when stopping hddtemp (closes: ++ bug#275952). ++ * Updated hddtemp.db with the latest available version. ++ ++ -- Aurelien Jarno Tue, 12 Oct 2004 10:10:01 +0100 ++ ++hddtemp (0.3-beta12-3) unstable; urgency=medium ++ ++ * Added support for WDC 200GB SE (closes: bug#275105). ++ ++ -- Aurelien Jarno Thu, 7 Oct 2004 21:01:15 +0200 ++ ++hddtemp (0.3-beta12-2) unstable; urgency=low ++ ++ * Added support for Maxtor MaXLine Plus II 250GB (closes: bug#274596). ++ * Added support for Travelstar 5K80 series (closes: bug#274671). ++ * Removed init message when the daemon is disabled. ++ ++ -- Aurelien Jarno Sun, 3 Oct 2004 19:40:23 +0200 ++ ++hddtemp (0.3-beta12-1) unstable; urgency=low ++ ++ * New upstream version. ++ ++ -- Aurelien Jarno Sat, 2 Oct 2004 01:47:19 +0200 ++ ++hddtemp (0.3-beta11-17) unstable; urgency=low ++ ++ * Detect sleeping drives in the init script (closes: bug#269462). ++ ++ -- Aurelien Jarno Wed, 1 Sep 2004 18:49:35 +0200 ++ ++hddtemp (0.3-beta11-16) unstable; urgency=low ++ ++ * Added support for Samsung SpinPoint PL40 serie. ++ * Added support for Western Digital 250GB Special Edition 8MB (closes: ++ bug#269342). ++ * Added support for Maxtor DiamondMax Plus 40 drives (closes: ++ bug#269346). ++ ++ -- Aurelien Jarno Wed, 1 Sep 2004 11:29:55 +0200 ++ ++hddtemp (0.3-beta11-15) unstable; urgency=low ++ ++ * Added Danish debconf translation. Thanks to Claus Hindsgaul (closes: ++ bug#267551). ++ * Added support for Western Digital 160GB Special Edition 8MB (closes: ++ bug#267492). ++ ++ -- Aurelien Jarno Tue, 31 Aug 2004 11:23:43 +0200 ++ ++hddtemp (0.3-beta11-14) unstable; urgency=medium ++ ++ * Let the kernel decide if we can access the device or not (closes: ++ bug#262742). ++ * Added an option to wake-up the driver if need (closes: #255308). ++ * Added IPv6 support. ++ ++ -- Aurelien Jarno Mon, 16 Aug 2004 15:36:00 +0200 ++ ++hddtemp (0.3-beta11-13) unstable; urgency=low ++ ++ * Added Czech debconf translation. Thanks to Miroslav Jezbera (closes: ++ bug#261284). ++ ++ -- Aurelien Jarno Sat, 31 Jul 2004 16:18:17 +0200 ++ ++hddtemp (0.3-beta11-12) unstable; urgency=low ++ ++ * Fixed manpage installation (closes: bug#258048, #258101). ++ ++ -- Aurelien Jarno Thu, 8 Jul 2004 02:08:00 +0200 ++ ++hddtemp (0.3-beta11-11) unstable; urgency=low ++ ++ * Print WARNING messages on stderr (closes: bug#254940). ++ ++ -- Aurelien Jarno Fri, 18 Jun 2004 00:17:08 +0200 ++ ++hddtemp (0.3-beta11-10) unstable; urgency=low ++ ++ * If a debconf answer is empty, ignore it (closes: bug#247026). ++ ++ -- Aurelien Jarno Tue, 4 May 2004 01:48:26 +0200 ++ ++hddtemp (0.3-beta11-9) unstable; urgency=low ++ ++ * The "Welcome to the 10 new EU members" release. ++ * Added --retry parameter when calling start-stop-daemon (closes: ++ bug#246028). ++ ++ -- Aurelien Jarno Sat, 1 May 2004 00:49:45 +0200 ++ ++hddtemp (0.3-beta11-8) unstable; urgency=low ++ ++ * Added support for Samsung P80 SATA drives (closes: bug#243464). ++ ++ -- Aurelien Jarno Tue, 13 Apr 2004 17:34:30 +0200 ++ ++hddtemp (0.3-beta11-7) unstable; urgency=low ++ ++ * Added support for Hitachi Deskstar 7K250 (closes: bug#241493). ++ ++ -- Aurelien Jarno Sun, 11 Apr 2004 16:37:51 +0200 ++ ++hddtemp (0.3-beta11-6) unstable; urgency=low ++ ++ * Added support for Western Digital WD1600JB-00FUA0 disk (closes: ++ bug#237983). ++ ++ -- Aurelien Jarno Tue, 16 Mar 2004 13:14:19 +0100 ++ ++hddtemp (0.3-beta11-5) unstable; urgency=low ++ ++ * Minor changes to debian/postinst script. ++ ++ -- Aurelien Jarno Sun, 8 Feb 2004 00:27:59 +0100 ++ ++hddtemp (0.3-beta11-4) unstable; urgency=low ++ ++ * Updated description (closes: bug#230507). ++ ++ -- Aurelien Jarno Sun, 1 Feb 2004 17:37:58 +0100 ++ ++hddtemp (0.3-beta11-3) unstable; urgency=low ++ ++ * Don't include asm headers on architectures that don't support ++ backtracing. ++ ++ -- Aurelien Jarno Sun, 25 Jan 2004 21:57:49 +0100 ++ ++hddtemp (0.3-beta11-2) unstable; urgency=low ++ ++ * Included upstream ChangeLog (closes: bug#226329). ++ ++ -- Aurelien Jarno Tue, 6 Jan 2004 03:16:37 +0100 ++ ++hddtemp (0.3-beta11-1) unstable; urgency=low ++ ++ * New upstream version. ++ * Updated the database to version 03C. ++ ++ -- Aurelien Jarno Fri, 2 Jan 2004 10:05:21 +0100 ++ ++hddtemp (0.3-beta10-2) unstable; urgency=low ++ ++ * Disable backtracing on non-i386 architectures. ++ ++ -- Aurelien Jarno Mon, 15 Dec 2003 09:19:48 +0100 ++ ++hddtemp (0.3-beta10-1) unstable; urgency=low ++ ++ * New upstream version. ++ * Updated debian/copyright. ++ ++ -- Aurelien Jarno Mon, 15 Dec 2003 08:24:37 +0100 ++ ++hddtemp (0.3-beta9-2) unstable; urgency=low ++ ++ * Moved ja.po in the right directory. ++ ++ -- Aurelien Jarno Fri, 12 Dec 2003 09:31:19 +0100 ++ ++hddtemp (0.3-beta9-1) unstable; urgency=low ++ ++ * New upstream version. ++ * Updated the database to version 03B. ++ ++ -- Aurelien Jarno Fri, 12 Dec 2003 09:21:16 +0100 ++ ++hddtemp (0.3-beta8-7) unstable; urgency=low ++ ++ * Added po debconf translations. Thanks to Kenshi Muto. (closes: ++ bug#211954) ++ ++ -- Aurelien Jarno Sun, 21 Sep 2003 14:03:19 +0200 ++ ++hddtemp (0.3-beta8-6) unstable; urgency=low ++ ++ * Remove the link to /usr/sbin/hddtemp in /usr/bin when removing the ++ package (closes: bug#210609). ++ * Updated Policy standard compliance to 3.6.1 (no changes). ++ ++ -- Aurelien Jarno Fri, 12 Sep 2003 16:06:56 +0200 ++ ++hddtemp (0.3-beta8-5) unstable; urgency=low ++ ++ * Removed the single-quoting around the -s parameter in the init script ++ (closes: bug#208542). ++ ++ -- Aurelien Jarno Wed, 3 Sep 2003 19:02:24 +0200 ++ ++hddtemp (0.3-beta8-4) unstable; urgency=medium ++ ++ * Don't modify the config file in the config script (closes: bug#203583). ++ * Urgency set to medium as the bug breaks upgrade. ++ * The init script also stop manually started daemons. ++ * Added a small patch to make sure hddtemp could not be started in daemon ++ mode by a normal user even if it is SUID root. ++ ++ -- Aurelien Jarno Tue, 2 Sep 2003 14:52:03 +0200 ++ ++hddtemp (0.3-beta8-3) unstable; urgency=low ++ ++ * Don't strip the comments from the config file when installing the ++ package. ++ ++ -- Aurelien Jarno Mon, 1 Sep 2003 18:51:33 +0200 ++ ++hddtemp (0.3-beta8-2) unstable; urgency=low ++ ++ * Fixed a typo in the manpage. Thanks to Carlos Valdivia Yagüe. (Closes: ++ bug#205947). ++ ++ -- Aurelien Jarno Tue, 19 Aug 2003 09:19:04 +0200 ++ ++hddtemp (0.3-beta8-1) unstable; urgency=low ++ ++ * New upstream version. ++ * Recoded the changelog in UTF-8. ++ ++ -- Aurelien Jarno Tue, 12 Aug 2003 01:14:19 +0200 ++ ++hddtemp (0.3-beta7-6) unstable; urgency=low ++ ++ * Fixed config and postinst scripts (closes: bug#203583). ++ ++ -- Aurelien Jarno Tue, 5 Aug 2003 09:16:11 +0200 ++ ++hddtemp (0.3-beta7-5) unstable; urgency=low ++ ++ * Fixed a typo in /etc/init.d/hddtemp (closes: bug#203441). ++ ++ -- Aurelien Jarno Wed, 30 Jul 2003 06:29:45 +0200 ++ ++hddtemp (0.3-beta7-4) unstable; urgency=low ++ ++ * Changed the DAEMON parameter in /etc/default/hddtemp to RUN_DAEMON ++ (closes: bug#203107). ++ * Updated the database to version 036. ++ * Updated Policy standard compliance to 3.6.0. ++ ++ -- Aurelien Jarno Mon, 28 Jul 2003 02:32:00 +0200 ++ ++hddtemp (0.3-beta7-3) unstable; urgency=low ++ ++ * Updated es debconf translations. Thanks to Carlos Valdivia Yagüe. ++ (closes: bug#198450). ++ * Updated the database to version 033. ++ ++ -- Aurelien Jarno Tue, 24 Jun 2003 01:12:00 +0200 ++ ++hddtemp (0.3-beta7-2) unstable; urgency=low ++ ++ * Updated fr debconf translations. Thanks to Michel Grentzin. ++ (closes: bug#198155) ++ * Added pt_BR debconf translations. Thanks to Andre Luis Lopes. ++ (closes: bug#198350) ++ ++ -- Aurelien Jarno Sun, 22 Jun 2003 02:55:59 +0200 ++ ++hddtemp (0.3-beta7-1) unstable; urgency=low ++ ++ * New upstream version with i18n support. ++ ++ -- Aurelien Jarno Mon, 16 Jun 2003 22:54:25 +0200 ++ ++hddtemp (0.3-beta6-9) unstable; urgency=low ++ ++ * Updated the database to version 032. ++ * Unmark some untranslatable strings in the master templates file. (closes: ++ bug#197642). ++ ++ -- Aurelien Jarno Mon, 16 Jun 2003 19:32:07 +0200 ++ ++hddtemp (0.3-beta6-8) unstable; urgency=low ++ ++ * Updated the database to version 030. ++ * Updated fr debconf translations. Thanks to Michel Grentzin. ++ (closes: bug#196765) ++ ++ -- Aurelien Jarno Mon, 9 Jun 2003 20:37:46 +0200 ++ ++hddtemp (0.3-beta6-7) unstable; urgency=low ++ ++ * Changed priority for debconf questions to more reasonable values. ++ * Updated the database to version 02F. ++ * Updated Policy standard compliance to 3.5.10. ++ ++ -- Aurelien Jarno Thu, 22 May 2003 23:43:24 +0200 ++ ++hddtemp (0.3-beta6-6) unstable; urgency=low ++ ++ * Don't mark /etc/default/hddtemp as a conffile, handle it entirely ++ in maintainer scripts (closes: bug#193466). ++ * Pass --ok-nodo argument to start-stop-daemon in init script when ++ stopping hddtemp (closes: bug#193622). ++ ++ -- Aurelien Jarno Sun, 18 May 2003 13:09:48 +0200 ++ ++hddtemp (0.3-beta6-5) unstable; urgency=low ++ ++ * Updated the database to version 02E. ++ * Don't save the fact that the daemon is running or not in debconf, but ++ rather in /etc/default/hddemp. ++ ++ -- Aurelien Jarno Sun, 11 May 2003 15:06:47 +0200 ++ ++hddtemp (0.3-beta6-4) unstable; urgency=low ++ ++ * Updated the upstream project homepage in debian/copyright (closes: ++ bug#190960). ++ ++ -- Aurelien Jarno Sun, 27 Apr 2003 17:46:53 +0200 ++ ++hddtemp (0.3-beta6-3) unstable; urgency=low ++ ++ * Updated the upstream project homepage in the description (closes: ++ bug#190929). ++ * Updated the database to version 02B. ++ ++ -- Aurelien Jarno Sun, 27 Apr 2003 11:40:14 +0200 ++ ++hddtemp (0.3-beta6-2) unstable; urgency=low ++ ++ * Added port and separator options to /etc/default/hddtemp. ++ * Added -l option to the manpage. ++ ++ -- Aurelien Jarno Thu, 3 Apr 2003 09:44:58 +0200 ++ ++hddtemp (0.3-beta6-1) unstable; urgency=low ++ ++ * New upstream version. ++ * Updated database. ++ * Updated Policy standard compliance to 3.5.9. ++ ++ -- Aurelien Jarno Wed, 2 Apr 2003 22:54:01 +0200 ++ ++hddtemp (0.3-beta5-1) unstable; urgency=low ++ ++ * New upstream version. ++ * Updated database. ++ * Added an option to listen on a specific interface (closes: bug#186062). ++ * Changed name displayed by /etc/init.d/hddtemp (closes: bug#187041). ++ ++ -- Aurelien Jarno Tue, 1 Apr 2003 02:24:53 +0200 ++ ++hddtemp (0.3-beta4-2) unstable; urgency=low ++ ++ * The "I have uploaded the wrong version" release. ++ * Fixed a bug in i18n.c. (closes: bug#185328). ++ ++ -- Aurelien Jarno Tue, 18 Mar 2003 20:32:03 +0100 ++ ++hddtemp (0.3-beta4-1) unstable; urgency=low ++ ++ * New upstream version. ++ * Updated database. ++ * Improved /etc/init.d/hddtemp and added a config file in ++ /etc/default (Closes: bug#183843). Thanks to Greg Miller. ++ * Fixed a bug in i18n.c. ++ * Added homepage and author to the description. ++ * Debconf templates are now managed with po-debconf. ++ * Uses debian/compat instead of DH_COMPAT. ++ ++ -- Aurelien Jarno Mon, 17 Mar 2003 00:29:12 +0100 ++ ++hddtemp (0.3-beta3-3) unstable; urgency=low ++ ++ * Added patch to allow local port reuse in TIME_WAIT. ++ ++ -- Aurelien Jarno Sat, 25 Jan 2003 01:43:21 +0100 ++ ++hddtemp (0.3-beta3-2) unstable; urgency=low ++ ++ * Don't fail at postinst stage if daemon failed to start. (closes: ++ bug#177660) ++ ++ -- Aurelien Jarno Fri, 24 Jan 2003 21:21:41 +0100 ++ ++hddtemp (0.3-beta3-1) unstable; urgency=low ++ ++ * New upstream version including all the previous patches plus some fixes. ++ * Updated database. ++ ++ -- Aurelien Jarno Sun, 19 Jan 2003 21:27:30 +0100 ++ ++hddtemp (0.3-beta2-4) unstable; urgency=low ++ ++ * Added patch from Julien Blache to fix a lot of spelling mistakes. ++ Thanks ! ++ ++ -- Aurelien Jarno Sun, 19 Jan 2003 09:55:47 +0100 ++ ++hddtemp (0.3-beta2-3) unstable; urgency=low ++ ++ * Added an option to print only the temperature. Thanks to Julien Blache ++ for the patch. (closes: bug#176395) ++ * Fixed some warnings introduced by gcc-3.2. ++ ++ -- Aurelien Jarno Sun, 12 Jan 2003 12:30:49 +0100 ++ ++hddtemp (0.3-beta2-2) unstable; urgency=low ++ ++ * Merged hddtemp and hddtemp-daemon and added a debconf question ++ because the package was refused by the ftpmaster. ++ ++ -- Aurelien Jarno Wed, 8 Jan 2003 21:48:09 +0100 ++ ++hddtemp (0.3-beta2-1) unstable; urgency=low ++ ++ * New beta version. ++ * Added daemon mode init script to the new package hddtemp-daemon. ++ * Updated Policy standard compliance to 3.5.8. ++ ++ -- Aurelien Jarno Sat, 4 Jan 2003 10:04:16 +0100 ++ ++hddtemp (0.2-18) unstable; urgency=low ++ ++ * Updated database (version 021). ++ ++ -- Aurelien Jarno Sat, 28 Dec 2002 16:59:39 -0500 ++ ++hddtemp (0.2-17) unstable; urgency=low ++ ++ * Fixed copyright file. ++ * Removed debian/conffiles, this is handled by dh_installdeb automatically ; ++ otherwise we end up with each conffile being listed twice... ++ ++ -- Aurelien Jarno Tue, 17 Dec 2002 01:39:02 +0100 ++ ++hddtemp (0.2-16) unstable; urgency=low ++ ++ * Updated database (version 01f). ++ ++ -- Aurelien Jarno Tue, 17 Dec 2002 00:40:07 +0100 ++ ++hddtemp (0.2-15) unstable; urgency=low ++ ++ * Updated database (version 01D). ++ * Added disk model IC35L040AVVN07-0 (closes: bug#172117). Thanks to Henrique ++ de Moraes Holschuh. ++ ++ -- Aurelien Jarno Sat, 7 Dec 2002 16:47:41 +0100 ++ ++hddtemp (0.2-14) unstable; urgency=low ++ ++ * Corrected a bug affecting the display of the degree sign. ++ ++ -- Aurelien Jarno Thu, 26 Sep 2002 01:29:10 +0200 ++ ++hddtemp (0.2-13) unstable; urgency=low ++ ++ * Added support for other encodings than iso-8859-1. (closes:bug#158106) ++ * debian/hddtemp.1: corrected description of -f option. ++ ++ -- Aurelien Jarno Wed, 25 Sep 2002 14:26:20 +0200 ++ ++hddtemp (0.2-12) unstable; urgency=low ++ ++ * Updated database. ++ * Updated Policy standard compliance to 3.5.7 ++ ++ -- Aurelien Jarno Wed, 11 Sep 2002 14:21:49 +0200 ++ ++hddtemp (0.2-11) unstable; urgency=low ++ ++ * Updated database. ++ ++ -- Aurelien Jarno Wed, 14 Aug 2002 23:01:31 +0200 ++ ++hddtemp (0.2-10) unstable; urgency=low ++ ++ * Updated database. (closes: bug#149313) ++ ++ -- Aurelien Jarno Sat, 15 Jun 2002 00:00:48 +0200 ++ ++hddtemp (0.2-9) unstable; urgency=low ++ ++ * Corrected a bug affecting the display of the degree sign on some systems. ++ (closes: bug#147136, #147138) ++ ++ -- Aurelien Jarno Tue, 11 Jun 2002 19:34:03 +0200 ++ ++hddtemp (0.2-8) unstable; urgency=low ++ ++ * Corrected debconf template. (closes: bug#148146) ++ * Updated HDD database. ++ ++ -- Aurelien Jarno Sat, 25 May 2002 17:11:16 +0200 ++ ++hddtemp (0.2-7) unstable; urgency=low ++ ++ * Corrected the man page. ++ ++ -- Aurelien Jarno Sun, 19 May 2002 23:54:39 +0200 ++ ++hddtemp (0.2-6) unstable; urgency=low ++ ++ * Updated HDD database. ++ ++ -- Aurelien Jarno Sat, 18 May 2002 13:33:02 +0200 ++ ++hddtemp (0.2-5) unstable; urgency=low ++ ++ * Updated HDD database. ++ * Updated the man page. ++ ++ -- Aurelien Jarno Mon, 13 May 2002 06:40:08 +0200 ++ ++hddtemp (0.2-4) unstable; urgency=low ++ ++ * Moved /usr/share/hddtemp/hddtemp.db to /etc/hddtemp.db as conffile. ++ (closes: bug#146738) ++ ++ -- Aurelien Jarno Sun, 12 May 2002 19:50:23 +0200 ++ ++hddtemp (0.2-3) unstable; urgency=low ++ ++ * Added de debconf translations. ++ * Updated HDD database. ++ ++ -- Aurelien Jarno Sun, 12 May 2002 17:15:28 +0200 ++ ++hddtemp (0.2-2) unstable; urgency=low ++ ++ * Fixed typos and erroneous statement in description. (closes: bug#146551) ++ * Fixed manpage. (closes: bug#146554) ++ * A symlink to /usr/bin is made when installing hddtemp SUID root. ++ ++ -- Aurelien Jarno Sat, 11 May 2002 15:54:42 +0200 ++ ++hddtemp (0.2-1) unstable; urgency=low ++ ++ * Initial Release. (closes: bug#145611) ++ ++ -- Aurelien Jarno Thu, 9 May 2002 14:50:35 +0200 ++ +--- hddtemp-0.3-beta15.orig/debian/templates ++++ hddtemp-0.3-beta15/debian/templates +@@ -0,0 +1,63 @@ ++# These templates have been reviewed by the debian-l10n-english ++# team ++# ++# If modifications/additions/rewording are needed, please ask ++# debian-l10n-english@lists.debian.org for advice. ++# ++# Even minor modifications require translation updates and such ++# changes should be coordinated with translators and reviewers. ++ ++Template: hddtemp/SUID_bit ++Type: boolean ++Default: false ++_Description: Should /usr/sbin/hddtemp be installed SUID root? ++ You have the option of installing hddtemp with the SUID bit set, ++ allowing it to be run (reporting hard drive temperatures) by regular ++ users and not only the superuser. ++ . ++ This could potentially allow hddtemp to be used during an attack ++ against the computer's security. If in doubt, do not choose this option. ++ . ++ This setting can be modified later by running 'dpkg-reconfigure hddtemp'. ++ ++Template: hddtemp/syslog ++Type: string ++Default: 0 ++_Description: Interval between hard drive temperature checks: ++ The temperature of the hard drive(s) can be logged by hddtemp via ++ the generic system logging interface. ++ . ++ Please enter a value in seconds corresponding to the interval between ++ two checks. To disable this feature, enter 0. ++ ++Template: hddtemp/daemon ++Type: boolean ++Default: false ++_Description: Should the hddtemp daemon be started at boot? ++ The hddtemp program can be run as a daemon, listening on port 7634 ++ for incoming connections. It is used by some software such as gkrellm to get ++ the temperature of hard drives. ++ . ++ You have the option of starting the hddtemp daemon automatically on ++ system boot. If in doubt, it is suggested to not start it ++ automatically on boot. ++ . ++ This setting can be modified later by running 'dpkg-reconfigure hddtemp'. ++ ++Template: hddtemp/interface ++Type: string ++Default: 127.0.0.1 ++_Description: Interface to listen on: ++ The hddtemp program can listen for incoming connections on a specific ++ interface, or on all interfaces. ++ . ++ To listen on a specific interface, enter the IP address of that interface ++ (choosing 127.0.0.1 will accept local connections only). To listen on all interfaces, ++ enter 0.0.0.0. ++ ++Template: hddtemp/port ++Type: string ++Default: 7634 ++_Description: Port to listen on: ++ By default, hddtemp listens for incoming connections on port 7634. This ++ can be changed for another port number. +--- hddtemp-0.3-beta15.orig/debian/dirs ++++ hddtemp-0.3-beta15/debian/dirs +@@ -0,0 +1,3 @@ ++etc/init.d ++etc/default ++usr/share/doc/hddtemp +--- hddtemp-0.3-beta15.orig/debian/copyright ++++ hddtemp-0.3-beta15/debian/copyright +@@ -0,0 +1,26 @@ ++This package was debianized by Aurelien Jarno on ++Wed, 8 May 2002 01:40:30 +0200. ++ ++It was downloaded from http://www.guzu.net/linux/hddtemp.php ++ ++Upstream Author: Emmanuel Varagnat ++ ++Copyright: 2002, 2003 Emmanuel Varagnat ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 2 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License with ++ the Debian GNU/Linux distribution in file /usr/share/common-licenses/GPL; ++ if not, write to the Free Software Foundation, Inc., 51 Franklin St, ++ Fifth Floor, Boston, MA 02110-1301 USA ++ ++ On Debian systems, the complete text of the GNU General Public ++ License, version 2, can be found in /usr/share/common-licenses/GPL-2. +--- hddtemp-0.3-beta15.orig/debian/logcheck.ignore.server ++++ hddtemp-0.3-beta15/debian/logcheck.ignore.server +@@ -0,0 +1,2 @@ ++^\w{3} [ :0-9]{11} [._[:alnum:]-]+ hddtemp\[[0-9]+\]: /dev/([hs]d[a-z]|sg[0-9]): .*: [0-9]+ [CF]$ ++^\w{3} [ :0-9]{11} [._[:alnum:]-]+ hddtemp\[[0-9]+\]: /dev/([hs]d[a-z]|sg[0-9]): .*: drive is sleeping$ +--- hddtemp-0.3-beta15.orig/debian/config ++++ hddtemp-0.3-beta15/debian/config +@@ -0,0 +1,51 @@ ++#!/bin/sh ++# hddtemp package configuration script ++ ++set -e ++ ++conffile="/etc/default/hddtemp" ++ ++get_config_file() ++{ ++ config_field=$1 ++ db_field=$2 ++ ++ if [ -f "$conffile" ] ; then ++ VALUE="$(grep "^[ ]*$config_field" $conffile | sed -e "s/^$config_field *= *\"\(.*\)\"/\1/g")" ++ if [ -n "$VALUE" ] ; then ++ db_set $db_field "$VALUE" ++ fi ++ fi ++} ++ ++# Source debconf library -- we have a Depends line ++# to make sure it is there... ++. /usr/share/debconf/confmodule ++db_version 2.0 ++ ++if [ "$1" = configure -o "$1" = reconfigure ] ; then ++ db_input medium hddtemp/SUID_bit || true ++ ++ get_config_file SYSLOG hddtemp/syslog ++ db_input medium hddtemp/syslog || true ++ ++ get_config_file DAEMON hddtemp/daemon ++ get_config_file RUN_DAEMON hddtemp/daemon ++ db_input medium hddtemp/daemon || true ++ ++ db_go ++ ++ db_get hddtemp/daemon ++ ++ if [ "$RET" = "true" ] ; then ++ get_config_file INTERFACE hddtemp/interface ++ db_input medium hddtemp/interface || true ++ ++ get_config_file PORT hddtemp/port ++ db_input medium hddtemp/port || true ++ ++ db_go ++ fi ++fi ++ ++exit 0 +--- hddtemp-0.3-beta15.orig/debian/postinst ++++ hddtemp-0.3-beta15/debian/postinst +@@ -0,0 +1,146 @@ ++#!/bin/sh ++# postinst script for hddtemp ++set -e ++ ++conffile="/etc/default/hddtemp" ++ ++update_config_file() ++{ ++ db_field=$1 ++ config_field=$2 ++ ++ RET=false ++ db_get $db_field ++ if [ -n "$RET" ] ; then ++ if grep -q "^$config_field" $conffile ; then ++ # keep any admin changes, while replacing the variable content ++ sed "s/^[ ]*$config_field=\".*\"/$config_field=\"$RET\"/" < $conffile > $conffile.new && ++ mv $conffile.new $conffile ++ else ++ echo "$config_field=\"$RET\"" >> $conffile ++ fi ++ fi ++} ++ ++# Source debconf library -- we have a Depends line ++# to make sure it is there... ++. /usr/share/debconf/confmodule ++db_version 2.0 ++ ++case "$1" in ++ configure) ++ if [ -f $conffile ] ; then ++ sed -i -e 's/^[ ]*DAEMON/RUN_DAEMON/g' \ ++ -e 's/^[ ]*SYSLOG/RUN_SYSLOG/g' \ ++ -e 's/^# Master system-wide hddtemp switch.*/# hddtemp network daemon switch. If set to true, hddtemp will listen/' \ ++ -e 's/^# set to true. STOP THE SERVICE.*/# for incoming connections./' \ ++ -e 's/^# Logging period.*temperatures.$/# Logging period (in seconds) for the temperatures. If set to a value\n# different than 0, hddtemp will run as a daemon periodically logging\n# the temperatures through syslog/' \ ++ $conffile ++ if ! grep -q RUN_SYSLOG $conffile ; then ++ cat << EOF >> $conffile ++ ++# Logging period (in seconds) for the temperatures. If set to a value ++# different than 0, hddtemp will run as a daemon periodically logging ++# the temperatures through syslog ++RUN_SYSLOG="0" ++EOF ++ fi ++ if ! grep -q OPTIONS $conffile ; then ++ cat << EOF >> $conffile ++ ++# Other options to pass to hddtemp ++OPTIONS="" ++EOF ++ fi ++ if ! grep -q DISKS_NOPROBE $conffile ; then ++ cat << EOF >> $conffile ++ ++# List of devices you want to use with hddtemp, but that would not be ++# probed for a working sensor. ++DISKS_NOPROBE="" ++EOF ++ fi ++ else ++ cat << EOF > $conffile ++# Defaults for hddtemp initscript (/etc/init.d/hddtemp) ++# This is a POSIX shell fragment ++ ++# [automatically edited by postinst, do not change line format ] ++ ++# hddtemp network daemon switch. If set to true, hddtemp will listen ++# for incoming connections. ++RUN_DAEMON="true" ++ ++# List of devices you want to use with hddtemp. If none specified, ++# hddtemp will probe standard devices. ++#DISKS="/dev/hda" ++ ++# List of devices you want to use with hddtemp, but that would not be ++# probed for a working sensor. ++DISKS_NOPROBE="" ++ ++# IP address of the interface on which you want hddtemp to be bound ++# on. If none specified, goes to 127.0.0.1. Use 0.0.0.0 to bind hddtemp ++# on all interfaces. ++INTERFACE="127.0.0.1" ++ ++# Port number on which you want hddtemp to listen on. If none specified, ++# the port 7634 is used. ++PORT="7634" ++ ++# Database file to use. If none specified, /etc/hddtemp.db is used. ++#DATABASE="/etc/hddtemp.db" ++ ++# Separator to use between fields. The default separator is '|'. ++#SEPARATOR="|" ++ ++# Logging period (in seconds) for the temperatures. If set to a value ++# different than 0, hddtemp will run as a daemon periodically logging ++# the temperatures through syslog ++RUN_SYSLOG="0" ++ ++# Other options to pass to hddtemp ++OPTIONS="" ++EOF ++ fi ++ ++ update_config_file hddtemp/daemon RUN_DAEMON ++ update_config_file hddtemp/syslog RUN_SYSLOG ++ update_config_file hddtemp/interface INTERFACE ++ update_config_file hddtemp/port PORT ++ ++ if ! dpkg-statoverride --list /usr/sbin/hddtemp 1>/dev/null 2>&1; then ++ # check if we are installing suid or not ++ RET=false ++ db_get hddtemp/SUID_bit ++ if [ "$RET" = "true" ]; then ++ chmod 4755 /usr/sbin/hddtemp ++ ln -sf /usr/sbin/hddtemp /usr/bin/hddtemp ++ ln -sf ../man8/hddtemp.8.gz /usr/share/man/man1/hddtemp.1.gz ++ else ++ chmod 0755 /usr/sbin/hddtemp ++ rm -f /usr/bin/hddtemp ++ rm -f /usr/share/man/man8/hddtemp.1.gz ++ fi ++ fi ++ ++ db_stop ++ ++ rm -f /etc/logcheck/ignore.d.workstation/hddtemp ++ ;; ++ abort-upgrade|abort-remove|abort-deconfigure) ++ ;; ++ ++ *) ++ echo "postinst called with unknown argument \`$1'" >&2 ++ exit 1 ++ ;; ++esac ++ ++ ++# dh_installdeb will replace this with shell code automatically ++# generated by other debhelper scripts. ++ ++#DEBHELPER# ++ ++exit 0 +--- hddtemp-0.3-beta15.orig/debian/control ++++ hddtemp-0.3-beta15/debian/control +@@ -0,0 +1,17 @@ ++Source: hddtemp ++Section: utils ++Priority: extra ++Maintainer: Aurelien Jarno ++Build-Depends: debhelper (>> 5), autotools-dev, gettext (>> 0.10.1) ++Standards-Version: 3.9.3 ++Homepage: http://www.guzu.net/linux/hddtemp.php ++ ++Package: hddtemp ++Architecture: any ++Depends: ${shlibs:Depends}, ${misc:Depends}, lsb-base (>= 3.0-3) ++Suggests: ksensors ++Conflicts: ksensors (<< 0.7-8), gkrellm-hddtemp (<< 0.1-9) ++Description: hard drive temperature monitoring utility ++ The hddtemp program monitors and reports the temperature of PATA, SATA ++ or SCSI hard drives by reading Self-Monitoring Analysis and Reporting ++ Technology (S.M.A.R.T.) information on drives that support this feature. +--- hddtemp-0.3-beta15.orig/debian/init ++++ hddtemp-0.3-beta15/debian/init +@@ -0,0 +1,100 @@ ++#!/bin/sh ++# ++# skeleton example file to build /etc/init.d/ scripts. ++# This file should be used to construct scripts for /etc/init.d. ++# ++# Written by Miquel van Smoorenburg . ++# Modified for Debian GNU/Linux ++# by Ian Murdock . ++# ++# Version: @(#)skeleton 1.8 03-Mar-1998 miquels@cistron.nl ++# ++ ++### BEGIN INIT INFO ++# Provides: hddtemp ++# Required-Start: $remote_fs $syslog $network ++# Required-Stop: $remote_fs $syslog $network ++# Default-Start: 2 3 4 5 ++# Default-Stop: 0 1 6 ++# Short-Description: disk temperature monitoring daemon ++# Description: hddtemp is a disk temperature monitoring daemon ++### END INIT INFO ++ ++PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin ++NAME=hddtemp ++DAEMON=/usr/sbin/$NAME ++DESC="disk temperature monitoring daemon" ++ ++DISKS="/dev/hd[a-z] /dev/hd[a-z][a-z]" ++DISKS="$DISKS /dev/sd[a-z] /dev/sd[a-z][a-z]" ++DISKS="$DISKS /dev/sr[a-z] /dev/sr[a-z][a-z]" ++INTERFACE="0.0.0.0" ++PORT="7634" ++SEPARATOR="|" ++RUN_SYSLOG="0" ++ ++# Reads config file (will override defaults above) ++[ -r /etc/default/hddtemp ] && . /etc/default/hddtemp ++ ++if [ -n "$RUN_SYSLOG" ] && [ "$RUN_SYSLOG" != "0" ] ; then ++ SYSLOG_ARG="-S $RUN_SYSLOG" ++fi ++ ++if [ "$RUN_DAEMON" = "true" ] || [ "$RUN_DAEMON" = "yes" ] ; then ++ DAEMON_ARG="-d -l $INTERFACE -p $PORT -s $SEPARATOR" ++fi ++ ++[ -x "$DAEMON" ] || exit 0 ++ ++. /lib/lsb/init-functions ++ ++case "$1" in ++ start) ++ # master switch ++ if [ -n "$DAEMON_ARG" ] || [ -n "$SYSLOG_ARG" ] ; then ++ log_daemon_msg "Starting $DESC" "$NAME:" ++ CDROMS_LIST=$(sed -ne 's/^drive name:\t\+\(.*\)$/ \/dev\/\1/p' /proc/sys/dev/cdrom/info 2>/dev/null) || : ++ CDROMS_LIST="$CDROMS_LIST $(grep -sl '^ide-scsi ' /proc/ide/hd*/driver | awk -F / '{ print "/dev/"$4 }')" ++ for disk in $DISKS ; do ++ echo $CDROMS_LIST | grep -wq $disk && continue ++ echo $DISKS_NOPROBE | grep -wq $disk && continue ++ if $DAEMON -wn $OPTIONS $disk 2>/dev/null | grep -q '^[0-9]\+$' ; then ++ DISKS_LIST="$DISKS_LIST $disk"; ++ fi ++ done ++ if [ -n "$DISKS_LIST" ] || [ -n "$DISKS_NOPROBE" ] ; then ++ start-stop-daemon --start --quiet --exec $DAEMON -- $DAEMON_ARG $SYSLOG_ARG $OPTIONS $DISKS_NOPROBE $DISKS_LIST ++ ret=$? ++ log_progress_msg "$DISKS_NOPROBE$DISKS_LIST" ++ log_end_msg $ret ++ else ++ log_progress_msg "no disks with monitoring capability were found." ++ log_end_msg 0 ++ fi ++ fi ++ ;; ++ stop) ++ # master switch ++ if [ "$RUN_DAEMON" = "true" ] || [ "$RUN_DAEMON" = "yes" ] || [ "$RUN_SYSLOG" != "0" ] ; then ++ log_daemon_msg "Stopping $DESC" "$NAME" ++ start-stop-daemon --stop --oknodo --exec $DAEMON --retry 30 ++ log_end_msg $? ++ fi ++ ;; ++ force-reload|reload) ++ exit 3 ++ ;; ++ restart) ++ $0 stop && $0 start ++ ;; ++ status) ++ status_of_proc $DAEMON $NAME ++ exit $? ++ ;; ++ *) ++ echo "Usage: /etc/init.d/$NAME {start|stop|restart|status}" >&2 ++ exit 1 ++ ;; ++esac ++ ++exit 0 +--- hddtemp-0.3-beta15.orig/debian/compat ++++ hddtemp-0.3-beta15/debian/compat +@@ -0,0 +1 @@ ++5 +--- hddtemp-0.3-beta15.orig/debian/README.Debian ++++ hddtemp-0.3-beta15/debian/README.Debian +@@ -0,0 +1,14 @@ ++README.Debian for hddtemp ++------------------------- ++ ++This package include an init script (/etc/init.d/hddtemp) to run hddtemp ++in daemon mode. To enable and configure it, either use ++'dpkg-reconfigure hddtemp' or edit /etc/default/hddtemp. ++ ++By default and when enable, the init script tries to find all disk that ++support SMART. If you get an error such as 'no disks with monitoring ++capability were found' or if an hard disk is not monitored, try to run ++'hddtemp /dev/xxx', with /dev/xxx being you hard disk device. You will ++see an explanation about why it fails. ++ ++ -- Aurelien Jarno Sun, 27 Jul 2008 09:34:39 +0200 +--- hddtemp-0.3-beta15.orig/debian/hddtemp.db ++++ hddtemp-0.3-beta15/debian/hddtemp.db +@@ -0,0 +1,169 @@ ++# ++# Insert a regular expression for support of the model or the serie of your hard drive. ++# If you don't know what to put in the second field, put the number ++# that appears most often for your brand :o) ++# A value of zero meens that we know that the drive doesn't have ++# a temperature sensor (you can set the unit to C or F). ++# ++############################################################################ ++# The following list was found at (http://www.almico.com/forumharddisks.php) ++# If your drive is in the list send me a mail. ++# ++# Manufacturer Model Size Notes ++# FUJITSU FUJITSU MPF3102AH 10.0GB ++# FUJITSU FUJITSU MPG3204AH E 20.0GB ++# FUJITSU FUJITSU MPG3307AT 30.0GB ++# FUJITSU FUJITSU MPG3409AH 40.0GB ++# FUJITSU FUJITSU MPG3409AH EF 40.0GB ++# HITACHI HITACHI_DK23CA-10 9.8GB ++# HITACHI HITACHI_DK23CA-15 14.7GB ++# SAMSUNG SAMSUNG SV3012H 29.4GB ++# SEAGATE ST310210A 10.0GB ++# SEAGATE ST310211A 9.8GB ++# SEAGATE ST310215A 10.0GB ++# SEAGATE ST315320A 14.9GB ++# SEAGATE ST320410A 19.6GB ++# SEAGATE ST320413A 19.6GB ++# SEAGATE ST320420A 19.9GB ++# SEAGATE ST330610A 29.3GB ++# SEAGATE ST330620A 29.3GB ++# SEAGATE ST330621A 29.3GB ++# SEAGATE ST330630A 29.9GB ++# SEAGATE ST340016A 39.1GB ++# SEAGATE ST340810ACE 39.1GB ++# SEAGATE ST380020ACE 78.2GB ++# WESTERN DIGITAL WDC AC210200D 10.0GB ++# WESTERN DIGITAL WDC AC29100D 8.9GB ++# WESTERN DIGITAL WDC AC420400D 19.9GB ++# WESTERN DIGITAL WDC WD102AA 10.0GB ++# ++################################################# ++ ++######################################## ++############# ExcelStor drives ++######################################## ++# "ExcelStor Technology CT215" ??? ? "ExcelStor CT215" ++ ++ ++######################################## ++############# Fujitsu drives ++######################################## ++"FUJITSU MHM2100AT" 0 C "Fujitsu MHM2100AT" ++ ++ ++######################################## ++############# Hitachi drives ++######################################## ++"HITACHI_DK228A-65" 0 C "Hitachi DK228A-65" ++ ++ ++######################################## ++############# IBM drives ++######################################## ++ ++# DJSA serie is using F0h command to report temperature and also have ++# SMART capabilties but it was reported not to work. ++# "DJSA-2(30|32|10|20|05)" 0 C "IBM Travelstar 20GN, 32GH, 30GT series" ++ ++"IBM-DARA-212000" 0 C "IBM Travelstar 12GN" ++"IBM-DTTA-35*" 0 C "IBM Deskstar 16GP serie" ++ ++# according to specifications they do not seems to have sensor ++# but I prefer waiting for a report ++#"IBM-DTTA-37*" 0 C "IBM Deskstar 14GXP serie" ++ ++"IBM-DJNA-35.*" 231 C "IBM Deskstar 25 GP serie" ++"IBM-DJNA-37.*" 231 C "IBM Deskstar 22 GXP serie" ++"IBM-DHEA-(34330|36480)" 0 C "IBM Deskstar 5 serie" ++"IBM-DHEA-(34331|36481|38451)" 0 C "IBM Deskstar 8 serie" ++"IBM-DPTA-37.*" 231 C "IBM Deskstar 34GXP serie" ++"IBM-DPTA-35.*" 231 C "IBM Deskstar 37GP serie" ++ ++ ++######################################## ++############# Maxtor drives ++######################################## ++#"Maxtor 2B0[012][04568]H1" ??? C "Maxtor Fireball 541DX" ++# which one must I trust ? ++#"Maxtor 4D040H2" 9 C "Maxtor DiamondMax D540X-4D" ++#"Maxtor 4D040H2" 0 C "Maxtor 4D040H2" ++#"Maxtor 4D080H4" 12 C "Maxtor DiamondMax D540X-4D" ++#"Maxtor 4D060H3" 12 C "Maxtor DiamondMax D540X-4D" ++#"Maxtor 4D080H4" 9 C "Maxtor DiamondMax D540X-4D" ++"Maxtor 5(1024|1369|2049|2732|3073|4098)U(2|3|4|6|8)" 0 C "Maxtor DiamondMax Plus 40" ++"Maxtor 5T0[24]0H[24]" 0 C "Maxtor DiamondMax Plus 60" ++"Maxtor 94098U8" 11 C "Maxtor DiamondMax 40 94098U8" ++ ++ ++######################################## ++############# Quantum drives ++######################################## ++"QUANTUM FIREBALLP AS40.0" 0 C "Quantum Fireball AS40" ++"QUANTUM FIREBALL CX10.2A" 0 C "Quantum Fireball CX10.2A" ++#"QUANTUM FIREBALLlct10 20" 4 C "Quantum Fireball CT10 20GB" ++# I suspect the QUANTUM FIREBALL_TM2110A to have a sensor in field 9... ++# "QUANTUM FIREBALL_TM2110A" 9 C "Quantum Fireball TM2110A" ++ ++ ++######################################## ++############# Samsung drives ++######################################## ++# somenone reported a problem with the SP8004H which reports a temperature ++# 10°C below the ambient temperature ++"SAMSUNG SW0434A" 0 C "Samsung SW0434A" ++"SAMSUNG SV0432A" 0 C "Samsung SV0432A" ++"SAMSUNG SV3002H" 0 C "Samsung SpinPoint V30 serie" ++#"SAMSUNG SV(0221|0602|0813|1204)H" 9 C "Samsung SpinPoint V60 serie" ++ ++ ++######################################## ++############# Seagate drives ++######################################## ++"Seagate Technology 1275MB - ST31276A" 0 C "Seagate ST31276A" ++"ST3412A" 0 C "Seagate ST3412A" ++"ST38641A" 0 C "Seagate ST38641A" ++"ST310210A" 0 C "Seagate ST310210A" ++"ST310220A" 0 C "Seagate ST310220A" ++# SEAGATE ST313021A 13.0GB ++"ST313021A" 0 C "Seagate U8 ST313021A" ++"ST310240A" 0 C "Seagate Medalist 10240 Ultra ATA-3" ++"ST320423A" 0 C "Seagate U10 20423, Ultra ATA/66" ++ ++ ++######################################## ++############# TOSHIBA Laptops ++######################################## ++"MK4313MAT" 220 C "Toshiba MK4313MAT" ++"TOSHIBA MK1517GAP" 0 C "Toshiba MK1517GAP" ++"TOSHIBA MK2018GAS" 226 F "Toshiba MK2018GAS" ++ ++"TOSHIBA MK3017GAP" 0 C "Toshiba MK3017GAP" ++ ++#"TOSHIBA MK4019GAX" 222 C "Toshiba MK4019GAX" ++ ++ ++######################################## ++############# Western Digital drives ++######################################## ++# WDC AC310100B and WDC AC2850F are reported not working ++# no more informations were given ++"WDC AC22000L" 0 C "Western Digital Caviar AC22000" ++"WDC AC420400D" 231 C "Western Digital Caviar AC420400D" ++"WDC AC418000D" 231 C "Western Digital AC418000D" ++"WDC WD135BA" 231 C "Western Digital WD135BA" ++ ++"WDC WD100EB-00BHF0" 0 C "Western Digital 100EB-00BHF0" ++"WDC WD200BB-00AUA1" 0 C "Western Digital Caviar WD200BB" ++#"WDC WD200BB-60DGA0" 0 C "Western Digital Caviar WD200BB" ++"WDC WD300BB-00CAA0" 0 C "Western Digital WD300BB" ++"WDC WD400BB-00CAA0" 0 C "Western Digital 400BB-00CAA0" ++#"WDC WD400BB-00GFA0" 0 C "" ++"WDC WD400BB-(18CA|00DE)A0" 0 C "Western Digital Caviar WD400BB" ++"WDC WD400EB-00CPF0" 0 C "Western Digital 400EB-00CPF0" ++"WDC WD600BB-32BSA0" 0 C "Western Digital 600BB-32BSA0" ++"WDC WD800BB-00CAA1" 0 C "Western Digital WD800BB-00CAA1" ++"WDC WD800JB-00CRA1" 0 C "Western Digital Caviar WD800JB" ++ ++# not sure for next ++# "WDC WD1200JB-00CRA1" 9 C "Western Digital 1200JB-00CRA1" ++# "WDC WD273BA" 9 C "Western Digital WD273BA" +--- hddtemp-0.3-beta15.orig/debian/po/cs.po ++++ hddtemp-0.3-beta15/debian/po/cs.po +@@ -0,0 +1,159 @@ ++# ++# Translators, if you are not familiar with the PO format, gettext ++# documentation is worth reading, especially sections dedicated to ++# this format, e.g. by running: ++# info -n '(gettext)PO Files' ++# info -n '(gettext)Header Entry' ++# ++# Some information specific to po-debconf are available at ++# /usr/share/doc/po-debconf/README-trans ++# or http://www.debian.org/intl/l10n/po-debconf/README-trans ++# ++# Developers do not need to manually edit POT or PO files. ++# ++msgid "" ++msgstr "" ++"Project-Id-Version: hddtemp\n" ++"Report-Msgid-Bugs-To: hddtemp@packages.debian.org\n" ++"POT-Creation-Date: 2008-01-25 22:35+0100\n" ++"PO-Revision-Date: 2008-02-05 21:54+0100\n" ++"Last-Translator: Miroslav Kure \n" ++"Language-Team: Czech \n" ++"MIME-Version: 1.0\n" ++"Content-Type: text/plain; charset=UTF-8\n" ++"Content-Transfer-Encoding: 8bit\n" ++ ++#. Type: boolean ++#. Description ++#: ../templates:2001 ++msgid "Should /usr/sbin/hddtemp be installed SUID root?" ++msgstr "Má se /usr/sbin/hddtemp nainstalovat jako SUID root?" ++ ++#. Type: boolean ++#. Description ++#: ../templates:2001 ++msgid "" ++"You have the option of installing hddtemp with the SUID bit set, allowing it " ++"to be run (reporting hard drive temperatures) by regular users and not only " ++"the superuser." ++msgstr "" ++"Máte možnost nainstalovat hddtemp s nastaveným SUID bitem, což znamená, že " ++"jej kromě správce budou moci spouštět i běžní uživatelé (a zjišťovat teplotu " ++"pevného disku)." ++ ++#. Type: boolean ++#. Description ++#: ../templates:2001 ++msgid "" ++"This could potentially allow hddtemp to be used during an attack against the " ++"computer's security. If in doubt, do not choose this option." ++msgstr "" ++"Takto nastavený hddtemp může být potenciálně využit ke kompromitování " ++"počítače. Pokud si nejste jisti, pak je lepší tuto možnost zamítnout." ++ ++#. Type: boolean ++#. Description ++#. Type: boolean ++#. Description ++#: ../templates:2001 ../templates:4001 ++msgid "" ++"This setting can be modified later by running 'dpkg-reconfigure hddtemp'." ++msgstr "Změníte-li později názor, stačí spustit „dpkg-reconfigure hddtemp“." ++ ++#. Type: string ++#. Description ++#: ../templates:3001 ++msgid "Interval between hard drive temperature checks:" ++msgstr "Interval mezi kontrolami teploty pevného disku:" ++ ++#. Type: string ++#. Description ++#: ../templates:3001 ++msgid "" ++"The temperature of the hard drive(s) can be logged by hddtemp via the " ++"generic system logging interface." ++msgstr "" ++"hddtemp může zaznamenávat teplotu pevného disku (pevných disků) přes obecné " ++"logovací rozhraní systému." ++ ++#. Type: string ++#. Description ++#: ../templates:3001 ++msgid "" ++"Please enter a value in seconds corresponding to the interval between two " ++"checks. To disable this feature, enter 0." ++msgstr "" ++"Zadejte počet sekund odpovídající době mezi po sobě jdoucími měřeními. Pro " ++"zakázání této vlastnosti jednoduše zadejte 0." ++ ++#. Type: boolean ++#. Description ++#: ../templates:4001 ++msgid "Should the hddtemp daemon be started at boot?" ++msgstr "Má se daemon hddtemp spouštět při startu počítače?" ++ ++#. Type: boolean ++#. Description ++#: ../templates:4001 ++msgid "" ++"The hddtemp program can be run as a daemon, listening on port 7634 for " ++"incoming connections. It is used by some software such as gkrellm to get the " ++"temperature of hard drives." ++msgstr "" ++"Program hddtemp může běžet jako daemon a čekat na portu 7634 na příchozí " ++"spojení. Takto může být využíván programy typu gkrellm pro zjištění aktuální " ++"teploty pevných disků." ++ ++#. Type: boolean ++#. Description ++#: ../templates:4001 ++msgid "" ++"You have the option of starting the hddtemp daemon automatically on system " ++"boot. If in doubt, it is suggested to not start it automatically on boot." ++msgstr "" ++"Máte možnost spouštět daemona hddtemp automaticky při startu systému. Pokud " ++"si nejste jisti, pak jej raději při startu systému nespouštějte." ++ ++#. Type: string ++#. Description ++#: ../templates:5001 ++msgid "Interface to listen on:" ++msgstr "Rozhraní, na kterém naslouchat:" ++ ++#. Type: string ++#. Description ++#: ../templates:5001 ++msgid "" ++"The hddtemp program can listen for incoming connections on a specific " ++"interface, or on all interfaces." ++msgstr "" ++"Program hddtemp může očekávat příchozí spojení na konkrétním rozhraní nebo " ++"na všech rozhraních." ++ ++#. Type: string ++#. Description ++#: ../templates:5001 ++msgid "" ++"To listen on a specific interface, enter the IP address of that interface " ++"(choosing 127.0.0.1 will accept local connections only). To listen on all " ++"interfaces, enter 0.0.0.0." ++msgstr "" ++"Aby poslouchal na konkrétním rozhraní, zadejte IP adresu daného rozhraní " ++"(127.0.0.1 znamená, že bude přijímat pouze lokální spojení). Pokud chcete, " ++"aby poslouchal na všech rozhraních, zadejte 0.0.0.0." ++ ++#. Type: string ++#. Description ++#: ../templates:6001 ++msgid "Port to listen on:" ++msgstr "Port, na kterém naslouchat:" ++ ++#. Type: string ++#. Description ++#: ../templates:6001 ++msgid "" ++"By default, hddtemp listens for incoming connections on port 7634. This can " ++"be changed for another port number." ++msgstr "" ++"hddtemp standardně očekává příchozí spojení na portu 7634. Pokud vám tento " ++"port nevyhovuje, můžete zadat jiný." +--- hddtemp-0.3-beta15.orig/debian/po/fr.po ++++ hddtemp-0.3-beta15/debian/po/fr.po +@@ -0,0 +1,159 @@ ++# Translation of hddtemp debconf templates to French ++# Copyright (C) 2008 Christian Perrier ++# This file is distributed under the same license as the hddtemp package. ++# ++# Michel Grentzinger , 2003. ++# Jean-Luc Coulon (f5ibh) ++# Christian Perrier , 2008. ++msgid "" ++msgstr "" ++"Project-Id-Version: \n" ++"Report-Msgid-Bugs-To: hddtemp@packages.debian.org\n" ++"POT-Creation-Date: 2008-01-25 22:35+0100\n" ++"PO-Revision-Date: 2008-02-10 12:20+0100\n" ++"Last-Translator: Christian Perrier \n" ++"Language-Team: French \n" ++"MIME-Version: 1.0\n" ++"Content-Type: text/plain; charset=UTF-8\n" ++"Content-Transfer-Encoding: 8bit\n" ++"X-Generator: KBabel 1.11.4\n" ++ ++#. Type: boolean ++#. Description ++#: ../templates:2001 ++msgid "Should /usr/sbin/hddtemp be installed SUID root?" ++msgstr "Faut-il exécuter hddtemp avec les privilèges du superutilisateur ?" ++ ++#. Type: boolean ++#. Description ++#: ../templates:2001 ++msgid "" ++"You have the option of installing hddtemp with the SUID bit set, allowing it " ++"to be run (reporting hard drive temperatures) by regular users and not only " ++"the superuser." ++msgstr "" ++"Il est possible d'installer hddtemp avec le bit « setuid » positionné, ce qui " ++"lui permet d'être exécuté (et donc d'indiquer la température des disques " ++"durs) par les utilisateurs non privilégiés et pas seulement le " ++"superutilisateur." ++ ++#. Type: boolean ++#. Description ++#: ../templates:2001 ++msgid "" ++"This could potentially allow hddtemp to be used during an attack against the " ++"computer's security. If in doubt, do not choose this option." ++msgstr "" ++"Cela peut théoriquement permettre d'utiliser hddtemp pour une attaque visant " ++"à compromettre la sécurité du système. Dans le doute, il est conseillé ne de " ++"pas activer cette option." ++ ++#. Type: boolean ++#. Description ++#. Type: boolean ++#. Description ++#: ../templates:2001 ../templates:4001 ++msgid "" ++"This setting can be modified later by running 'dpkg-reconfigure hddtemp'." ++msgstr "" ++"Ce choix peut être modifié ultérieurement avec la commande « dpkg-reconfigure " ++"hddtemp »." ++ ++#. Type: string ++#. Description ++#: ../templates:3001 ++msgid "Interval between hard drive temperature checks:" ++msgstr "Intervalle entre deux contrôles de température :" ++ ++#. Type: string ++#. Description ++#: ../templates:3001 ++msgid "" ++"The temperature of the hard drive(s) can be logged by hddtemp via the " ++"generic system logging interface." ++msgstr "" ++"La température des disques durs peut être enregistrée par hddtemp et " ++"restituée par l'interface standard de journalisation du système." ++ ++#. Type: string ++#. Description ++#: ../templates:3001 ++msgid "" ++"Please enter a value in seconds corresponding to the interval between two " ++"checks. To disable this feature, enter 0." ++msgstr "" ++"Veuillez choisir l'intervalle en secondes entre deux mesures. Indiquez 0 " ++"pour désactiver cette fonctionnalité." ++ ++#. Type: boolean ++#. Description ++#: ../templates:4001 ++msgid "Should the hddtemp daemon be started at boot?" ++msgstr "Faut-il lancer automatiquement le démon hddtemp au démarrage ?" ++ ++#. Type: boolean ++#. Description ++#: ../templates:4001 ++msgid "" ++"The hddtemp program can be run as a daemon, listening on port 7634 for " ++"incoming connections. It is used by some software such as gkrellm to get the " ++"temperature of hard drives." ++msgstr "" ++"Le programme hddtemp peut être lancé en tant que démon, à l'écoute sur le " ++"port 7634. Ce démon est utilisé par certains logiciels tel que gkrellm pour " ++"obtenir la température des disques durs." ++ ++#. Type: boolean ++#. Description ++#: ../templates:4001 ++msgid "" ++"You have the option of starting the hddtemp daemon automatically on system " ++"boot. If in doubt, it is suggested to not start it automatically on boot." ++msgstr "" ++"Ce démon peut être lancé automatiquement au démarrage de l'ordinateur. Dans " ++"le doute, il est suggéré de ne pas activer cette option." ++ ++#. Type: string ++#. Description ++#: ../templates:5001 ++msgid "Interface to listen on:" ++msgstr "Interface où hddtemp sera à l'écoute :" ++ ++#. Type: string ++#. Description ++#: ../templates:5001 ++msgid "" ++"The hddtemp program can listen for incoming connections on a specific " ++"interface, or on all interfaces." ++msgstr "" ++"Le programme hddtemp peut être à l'écoute de connexions entrantes sur une " ++"interface spécifique ou sur toutes les interfaces." ++ ++#. Type: string ++#. Description ++#: ../templates:5001 ++msgid "" ++"To listen on a specific interface, enter the IP address of that interface " ++"(choosing 127.0.0.1 will accept local connections only). To listen on all " ++"interfaces, enter 0.0.0.0." ++msgstr "" ++"Pour écouter sur une interface spécifique, indiquez l'adresse IP de cette " ++"interface (en choisissant 127.0.0.1, seules les connexions locales seront " ++"acceptées). Pour écouter sur toutes les interfaces, saisissez simplement " ++"0.0.0.0." ++ ++#. Type: string ++#. Description ++#: ../templates:6001 ++msgid "Port to listen on:" ++msgstr "Port sur lequel hddtemp sera à l'écoute :" ++ ++#. Type: string ++#. Description ++#: ../templates:6001 ++msgid "" ++"By default, hddtemp listens for incoming connections on port 7634. This can " ++"be changed for another port number." ++msgstr "" ++"Par défaut, hddtemp attend les connexions entrantes sur le port 7634. Ce " ++"port peut être modifié si nécessaire." +--- hddtemp-0.3-beta15.orig/debian/po/vi.po ++++ hddtemp-0.3-beta15/debian/po/vi.po +@@ -0,0 +1,154 @@ ++# Vietnamese Translation for hddtemp. ++# Copyright © 2008 Free Software Foundation, Inc. ++# Clytie Siddall , 2005-2008. ++# ++msgid "" ++msgstr "" ++"Project-Id-Version: hddtemp_0.3-beta15-36\n" ++"Report-Msgid-Bugs-To: hddtemp@packages.debian.org\n" ++"POT-Creation-Date: 2008-01-25 22:35+0100\n" ++"PO-Revision-Date: 2008-02-13 21:06+1030\n" ++"Last-Translator: Clytie Siddall \n" ++"Language-Team: Vietnamese \n" ++"MIME-Version: 1.0\n" ++"Content-Type: text/plain; charset=utf-8\n" ++"Content-Transfer-Encoding: 8bit\n" ++"Plural-Forms: nplurals=1; plural=0;\n" ++"X-Generator: LocFactoryEditor 1.7b3\n" ++ ++#. Type: boolean ++#. Description ++#: ../templates:2001 ++msgid "Should /usr/sbin/hddtemp be installed SUID root?" ++msgstr "Có nên cài đặt SUID root « /usr/sbin/hddtemp » không?" ++ ++#. Type: boolean ++#. Description ++#: ../templates:2001 ++msgid "" ++"You have the option of installing hddtemp with the SUID bit set, allowing it " ++"to be run (reporting hard drive temperatures) by regular users and not only " ++"the superuser." ++msgstr "" ++"Bạn có tùy chọn cài đặt phần mềm hddtemp với bit SUID đã đặt, do đó cho phép " ++"nó được chạy bởi các người dùng bình thường, không phải chỉ siêu người dùng." ++ ++#. Type: boolean ++#. Description ++#: ../templates:2001 ++msgid "" ++"This could potentially allow hddtemp to be used during an attack against the " ++"computer's security. If in doubt, do not choose this option." ++msgstr "" ++"Tuy nhiên, đặt bit SUID cũng có thể cho phép người hiểm độc dùng hddtemp khi " ++"tấn công bảo mật của máy tính này. Vì vậy nếu bạn chưa chắc chắn, đừng bật " ++"tùy chọn này." ++ ++#. Type: boolean ++#. Description ++#. Type: boolean ++#. Description ++#: ../templates:2001 ../templates:4001 ++msgid "" ++"This setting can be modified later by running 'dpkg-reconfigure hddtemp'." ++msgstr "" ++"Cũng có thể sửa đổi thiết lập này về sau, bằng cách chạy lệnh cấu hình lại « " ++"dpkg-reconfigure hddtemp »." ++ ++#. Type: string ++#. Description ++#: ../templates:3001 ++msgid "Interval between hard drive temperature checks:" ++msgstr "Khoảng giữa hai lần kiểm tra nhiệt độ của đĩa cứng:" ++ ++#. Type: string ++#. Description ++#: ../templates:3001 ++msgid "" ++"The temperature of the hard drive(s) can be logged by hddtemp via the " ++"generic system logging interface." ++msgstr "" ++"Nhiệt độ của những đĩa cứng có thể được ghi lưu bởi hddtemp thông qua giao " ++"diện ghi lưu hệ thống chung." ++ ++#. Type: string ++#. Description ++#: ../templates:3001 ++msgid "" ++"Please enter a value in seconds corresponding to the interval between two " ++"checks. To disable this feature, enter 0." ++msgstr "" ++"Hãy nhập một giá trị theo giây mà tương ứng với khoảng thời gian giữa hai " ++"lần kiểm tra. Để tắt tính năng này, chỉ đơn giản nhập số 0 ở đây." ++ ++#. Type: boolean ++#. Description ++#: ../templates:4001 ++msgid "Should the hddtemp daemon be started at boot?" ++msgstr "Có nên khởi chạy trình nền hddtemp khi khởi động hệ thống không?" ++ ++#. Type: boolean ++#. Description ++#: ../templates:4001 ++msgid "" ++"The hddtemp program can be run as a daemon, listening on port 7634 for " ++"incoming connections. It is used by some software such as gkrellm to get the " ++"temperature of hard drives." ++msgstr "" ++"Chương trình hddtemp cũng có thể chạy dưới dạng trình nền (daemon), lắng " ++"nghe trên cổng 7634 tìm kết nối gửi đến. Trình nền này được dùng bởi một số " ++"phần mềm (v.d. gkrellm) để lấy nhiệt độ của các đĩa cứng." ++ ++#. Type: boolean ++#. Description ++#: ../templates:4001 ++msgid "" ++"You have the option of starting the hddtemp daemon automatically on system " ++"boot. If in doubt, it is suggested to not start it automatically on boot." ++msgstr "" ++"Tùy chọn bạn có thể tự động khởi chạy trình nền hddtemp khi khởi động hệ " ++"thống. Chưa chắc chắc thì khuyên bạn không bật tùy chọn này." ++ ++#. Type: string ++#. Description ++#: ../templates:5001 ++msgid "Interface to listen on:" ++msgstr "Giao diện trên đó cần lắng nghe:" ++ ++#. Type: string ++#. Description ++#: ../templates:5001 ++msgid "" ++"The hddtemp program can listen for incoming connections on a specific " ++"interface, or on all interfaces." ++msgstr "" ++"Chương trình hddtemp có thể lắng nghe kết nối gửi đến trên một giao diện dứt " ++"khoát, hoặc trên mọi giao diện." ++ ++#. Type: string ++#. Description ++#: ../templates:5001 ++msgid "" ++"To listen on a specific interface, enter the IP address of that interface " ++"(choosing 127.0.0.1 will accept local connections only). To listen on all " ++"interfaces, enter 0.0.0.0." ++msgstr "" ++"Để lắng nghe trên một giao diện cụ thể, hãy nhập địa chỉ IP của giao diện đó " ++"(giá trị « 127.0.0.0 » sẽ chỉ chấp nhận kết nối cục bộ). Để lắng nghe trên " ++"mọi giao diện, chỉ đơn giản hãy nhập địa chỉ « 0.0.0.0 »." ++ ++#. Type: string ++#. Description ++#: ../templates:6001 ++msgid "Port to listen on:" ++msgstr "Cổng trên đó cần lắng nghe:" ++ ++#. Type: string ++#. Description ++#: ../templates:6001 ++msgid "" ++"By default, hddtemp listens for incoming connections on port 7634. This can " ++"be changed for another port number." ++msgstr "" ++"Mặc định là hddtemp lắng nghe kết nối gửi đến trên cổng 7634. Cũng có thể " ++"thay đổi nó thành một cổng khác." +--- hddtemp-0.3-beta15.orig/debian/po/pt_BR.po ++++ hddtemp-0.3-beta15/debian/po/pt_BR.po +@@ -0,0 +1,205 @@ ++# ++# Translators, if you are not familiar with the PO format, gettext ++# documentation is worth reading, especially sections dedicated to ++# this format, e.g. by running: ++# info -n '(gettext)PO Files' ++# info -n '(gettext)Header Entry' ++# ++# Some information specific to po-debconf are available at ++# /usr/share/doc/po-debconf/README-trans ++# or http://www.debian.org/intl/l10n/po-debconf/README-trans ++# ++# Developers do not need to manually edit POT or PO files. ++# ++msgid "" ++msgstr "" ++"Project-Id-Version: hddtemp_0.3-beta7-1\n" ++"Report-Msgid-Bugs-To: hddtemp@packages.debian.org\n" ++"POT-Creation-Date: 2008-01-25 22:35+0100\n" ++"PO-Revision-Date: 2007-12-11 15:33+0100\n" ++"Last-Translator: Tiago Bortoletto Vaz \n" ++"Language-Team: Debian-BR Project \n" ++"MIME-Version: 1.0\n" ++"Content-Type: text/plain; charset=ISO-8859-1\n" ++"Content-Transfer-Encoding: 8bit\n" ++ ++#. Type: boolean ++#. Description ++#: ../templates:2001 ++#, fuzzy ++#| msgid "Do you want /usr/sbin/hddtemp to be installed SUID root?" ++msgid "Should /usr/sbin/hddtemp be installed SUID root?" ++msgstr "Deseja que o /usr/sbin/hddtemp seja instalado SUID root ?" ++ ++#. Type: boolean ++#. Description ++#: ../templates:2001 ++msgid "" ++"You have the option of installing hddtemp with the SUID bit set, allowing it " ++"to be run (reporting hard drive temperatures) by regular users and not only " ++"the superuser." ++msgstr "" ++ ++#. Type: boolean ++#. Description ++#: ../templates:2001 ++msgid "" ++"This could potentially allow hddtemp to be used during an attack against the " ++"computer's security. If in doubt, do not choose this option." ++msgstr "" ++ ++#. Type: boolean ++#. Description ++#. Type: boolean ++#. Description ++#: ../templates:2001 ../templates:4001 ++msgid "" ++"This setting can be modified later by running 'dpkg-reconfigure hddtemp'." ++msgstr "" ++ ++#. Type: string ++#. Description ++#: ../templates:3001 ++msgid "Interval between hard drive temperature checks:" ++msgstr "" ++ ++#. Type: string ++#. Description ++#: ../templates:3001 ++msgid "" ++"The temperature of the hard drive(s) can be logged by hddtemp via the " ++"generic system logging interface." ++msgstr "" ++ ++#. Type: string ++#. Description ++#: ../templates:3001 ++msgid "" ++"Please enter a value in seconds corresponding to the interval between two " ++"checks. To disable this feature, enter 0." ++msgstr "" ++ ++#. Type: boolean ++#. Description ++#: ../templates:4001 ++#, fuzzy ++#| msgid "Do you want to start the hddtemp daemon on startup?" ++msgid "Should the hddtemp daemon be started at boot?" ++msgstr "Deseja iniciar o daemon hddtemp na inicializao do sistema ?" ++ ++#. Type: boolean ++#. Description ++#: ../templates:4001 ++#, fuzzy ++#| msgid "" ++#| "hddtemp can be run as a daemon, listening on port 7634 for incoming " ++#| "connections. It is used some by software such as gkrellm to get the " ++#| "temperature of the hard drives." ++msgid "" ++"The hddtemp program can be run as a daemon, listening on port 7634 for " ++"incoming connections. It is used by some software such as gkrellm to get the " ++"temperature of hard drives." ++msgstr "" ++"O hddtemp pode ser executado com um daemon, ouvindo na porta 7634 por " ++"conexes entrantes. O mesmo usado por alguns softwares como o gkrellm-" ++"hddtemp para obter a temperatura dos discos rgidos." ++ ++#. Type: boolean ++#. Description ++#: ../templates:4001 ++#, fuzzy ++msgid "" ++"You have the option of starting the hddtemp daemon automatically on system " ++"boot. If in doubt, it is suggested to not start it automatically on boot." ++msgstr "" ++"Voc tem a opo de iniciar o daemon hddtemp automaticamente na " ++"inicializao de seu computador. Caso esteja em dvida, sugerido que voc " ++"no inicie o hddtemp automaticamente na inicializao de seu computador. " ++"Caso voc mude de idia posteriormente voc poder executar o comando 'dpkg-" ++"reconfigure hddtemp' para mudar essa configurao." ++ ++#. Type: string ++#. Description ++#: ../templates:5001 ++msgid "Interface to listen on:" ++msgstr "" ++ ++#. Type: string ++#. Description ++#: ../templates:5001 ++#, fuzzy ++#| msgid "" ++#| "hddtemp can listen for incoming connections on a specific interface, or " ++#| "on all interfaces." ++msgid "" ++"The hddtemp program can listen for incoming connections on a specific " ++"interface, or on all interfaces." ++msgstr "" ++"O hddtemp pode ouvir por conexes entrantes em uma interface especfica ou " ++"em todas as interfaces." ++ ++#. Type: string ++#. Description ++#: ../templates:5001 ++#, fuzzy ++#| msgid "" ++#| "To listen on a specific interface, enter the IP address of that " ++#| "interface (127.0.0.1 which is the default value corresponds to the lo " ++#| "interface). To listen on all interfaces, simply enter 0.0.0.0." ++msgid "" ++"To listen on a specific interface, enter the IP address of that interface " ++"(choosing 127.0.0.1 will accept local connections only). To listen on all " ++"interfaces, enter 0.0.0.0." ++msgstr "" ++"Para ouvir em uma interface especfica, informe o endereo IP da interface " ++"em questo (o endereo padro 127.0.0.1 corresponde a interface lo). Para " ++"ouvir e todas as interfaces, simplesmente informe o endereo 0.0.0.0 ." ++ ++#. Type: string ++#. Description ++#: ../templates:6001 ++msgid "Port to listen on:" ++msgstr "" ++ ++#. Type: string ++#. Description ++#: ../templates:6001 ++#, fuzzy ++#| msgid "" ++#| "By default, hddtemp listen for incoming connections on port 7634. However " ++#| "if you don't find this port appropriate, you can enter an other one." ++msgid "" ++"By default, hddtemp listens for incoming connections on port 7634. This can " ++"be changed for another port number." ++msgstr "" ++"Por padro, o hddtemp escuta por conexes entrantes na porta 7634. Porm " ++"caso voc ache que essa no seja a porta apropriada, voc pode informar uma " ++"outra porta." ++ ++#~ msgid "You have the option of installing hddtemp with the SUID bit set." ++#~ msgstr "Voc tem a opo de instalar o hddtemp com o bit de SUID ligado." ++ ++#~ msgid "" ++#~ "If you make hddtemp SUID, unprivileged users of your systems will be able " ++#~ "to run it. This could, however, potentially allow hddtemp to be used " ++#~ "during a security attack on your computer. If in doubt, it is suggested " ++#~ "to install it without SUID. If you later change your mind, you can run: " ++#~ "'dpkg-reconfigure hddtemp'." ++#~ msgstr "" ++#~ "Caso voc permita que o hdddtemp seja instalado com o bit de SUID ligado, " ++#~ "usurios no privilegiados de seu sistema sero capazes de execut-lo. " ++#~ "Isso pode, porm, potencialmente permitir que o hddtemp seja usado " ++#~ "durante um ataque contra a segurana de seu computador. Caso esteja em " ++#~ "dvida, sugerido que vc instale o hddtemp sem o bit de SUID ligado. " ++#~ "Caso voc mude de idia posteriormente, voc poder executar o comando " ++#~ "'dpkg-reconfigure hddtemp' para mudar essa suaconfigurao." ++ ++#, fuzzy ++#~ msgid "At which interval do you want to log the temperatures?" ++#~ msgstr "Em qual interface voc deseja que o hddtemp escute ?" ++ ++#~ msgid "On which interface do you want hddtemp to listen on?" ++#~ msgstr "Em qual interface voc deseja que o hddtemp escute ?" ++ ++#~ msgid "On which port do you want hddtemp to listen on?" ++#~ msgstr "Em qual porta voc deseja que o hddtemp escute ?" +--- hddtemp-0.3-beta15.orig/debian/po/ru.po ++++ hddtemp-0.3-beta15/debian/po/ru.po +@@ -0,0 +1,156 @@ ++# translation of ru.po to Russian ++# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER ++# This file is distributed under the same license as the PACKAGE package. ++# ++# Yuri Kozlov , 2008. ++msgid "" ++msgstr "" ++"Project-Id-Version: 0.3-beta15-39\n" ++"Report-Msgid-Bugs-To: hddtemp@packages.debian.org\n" ++"POT-Creation-Date: 2008-01-25 22:35+0100\n" ++"PO-Revision-Date: 2008-01-27 19:15+0300\n" ++"Last-Translator: Yuri Kozlov \n" ++"Language-Team: Russian \n" ++"MIME-Version: 1.0\n" ++"Content-Type: text/plain; charset=UTF-8\n" ++"Content-Transfer-Encoding: 8bit\n" ++"X-Generator: KBabel 1.11.4\n" ++"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%" ++"10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" ++ ++#. Type: boolean ++#. Description ++#: ../templates:2001 ++msgid "Should /usr/sbin/hddtemp be installed SUID root?" ++msgstr "Установить /usr/sbin/hddtemp как SUID root?" ++ ++#. Type: boolean ++#. Description ++#: ../templates:2001 ++msgid "" ++"You have the option of installing hddtemp with the SUID bit set, allowing it " ++"to be run (reporting hard drive temperatures) by regular users and not only " ++"the superuser." ++msgstr "" ++"Вы можете выбрать установку hddtemp с включённым SUID битом, чтобы её можно " ++"было запускать простым пользователям (для получения температур жёстких " ++"дисков), а не только суперпользователю." ++ ++#. Type: boolean ++#. Description ++#: ../templates:2001 ++msgid "" ++"This could potentially allow hddtemp to be used during an attack against the " ++"computer's security. If in doubt, do not choose this option." ++msgstr "" ++"Потенциально, это может позволить использовать hddtemp для нарушения " ++"компьютерной безопасности. Если не уверены, ответьте отрицательно." ++ ++#. Type: boolean ++#. Description ++#. Type: boolean ++#. Description ++#: ../templates:2001 ../templates:4001 ++msgid "" ++"This setting can be modified later by running 'dpkg-reconfigure hddtemp'." ++msgstr "" ++"Эту настройку можно позже изменить запустив 'dpkg-reconfigure hddtemp'." ++ ++#. Type: string ++#. Description ++#: ../templates:3001 ++msgid "Interval between hard drive temperature checks:" ++msgstr "Интервал между проверками температуры жёсткого диска:" ++ ++#. Type: string ++#. Description ++#: ../templates:3001 ++msgid "" ++"The temperature of the hard drive(s) can be logged by hddtemp via the " ++"generic system logging interface." ++msgstr "" ++"Температура жёсткого диска(ов) может быть протоколироваться hddtemp с " ++"помощью стандартного системного интерфейса протоколирования." ++ ++#. Type: string ++#. Description ++#: ../templates:3001 ++msgid "" ++"Please enter a value in seconds corresponding to the interval between two " ++"checks. To disable this feature, enter 0." ++msgstr "" ++"Введите значение интервала в секундах между проверками. Для выключения " ++"проверок введите 0." ++ ++#. Type: boolean ++#. Description ++#: ../templates:4001 ++msgid "Should the hddtemp daemon be started at boot?" ++msgstr "Запускать сервис hddtemp при старте компьютера?" ++ ++#. Type: boolean ++#. Description ++#: ../templates:4001 ++msgid "" ++"The hddtemp program can be run as a daemon, listening on port 7634 for " ++"incoming connections. It is used by some software such as gkrellm to get the " ++"temperature of hard drives." ++msgstr "" ++"Программа hddtemp может работать в виде сервиса, принимая запросы на порту " ++"7634. Это используется некоторым ПО, например gkrellm, для получения " ++"температуры жёстких дисков." ++ ++#. Type: boolean ++#. Description ++#: ../templates:4001 ++msgid "" ++"You have the option of starting the hddtemp daemon automatically on system " ++"boot. If in doubt, it is suggested to not start it automatically on boot." ++msgstr "" ++"Сейчас вы можете включить автоматический запуск сервиса hddtemp во время " ++"загрузки системы. Если не уверены, выберите не запускать эту программу во " ++"время загрузки." ++ ++#. Type: string ++#. Description ++#: ../templates:5001 ++msgid "Interface to listen on:" ++msgstr "Интерфейс приёма запросов:" ++ ++#. Type: string ++#. Description ++#: ../templates:5001 ++msgid "" ++"The hddtemp program can listen for incoming connections on a specific " ++"interface, or on all interfaces." ++msgstr "" ++"Программа hddtemp может принимать входящие запросы на определённом " ++"интерфейсе или со всех интерфейсов." ++ ++#. Type: string ++#. Description ++#: ../templates:5001 ++msgid "" ++"To listen on a specific interface, enter the IP address of that interface " ++"(choosing 127.0.0.1 will accept local connections only). To listen on all " ++"interfaces, enter 0.0.0.0." ++msgstr "" ++"Для приёма на конкретном интерфейса введите IP-адрес этого интерфейса (ввод " ++"127.0.0.1 обеспечит приём только локальных запросов). Для приёма запросов со " ++"всех интерфейсов, введите 0.0.0.0." ++ ++#. Type: string ++#. Description ++#: ../templates:6001 ++msgid "Port to listen on:" ++msgstr "Порт приёма запросов:" ++ ++#. Type: string ++#. Description ++#: ../templates:6001 ++msgid "" ++"By default, hddtemp listens for incoming connections on port 7634. This can " ++"be changed for another port number." ++msgstr "" ++"По умолчанию, hddtemp принимает входящие запросы с порта 7634. Здесь можно " ++"задать другой номер порта." +--- hddtemp-0.3-beta15.orig/debian/po/sv.po ++++ hddtemp-0.3-beta15/debian/po/sv.po +@@ -0,0 +1,127 @@ ++# Translators, if you are not familiar with the PO format, gettext ++# documentation is worth reading, especially sections dedicated to ++# this format, e.g. by running: ++# info -n '(gettext)PO Files' ++# info -n '(gettext)Header Entry' ++# Some information specific to po-debconf are available at ++# /usr/share/doc/po-debconf/README-trans ++# or http://www.debian.org/intl/l10n/po-debconf/README-trans ++# Developers do not need to manually edit POT or PO files. ++# , fuzzy ++# ++# ++msgid "" ++msgstr "" ++"Project-Id-Version: hddtemp 0.3-beta14-1\n" ++"Report-Msgid-Bugs-To: hddtemp@packages.debian.org\n" ++"POT-Creation-Date: 2008-01-25 22:35+0100\n" ++"PO-Revision-Date: 2008-07-27 09:49+0200\n" ++"Last-Translator: Martin Bagge \n" ++"Language-Team: Swedish \n" ++"MIME-Version: 1.0\n" ++"Content-Type: text/plain; charset=iso-8859-1\n" ++"Content-Transfer-Encoding: 8bit\n" ++ ++#. Type: boolean ++#. Description ++#: ../templates:2001 ++msgid "Should /usr/sbin/hddtemp be installed SUID root?" ++msgstr "Vill du att /usr/sbin/hddtemp ska installeras som SUID root?" ++ ++#. Type: boolean ++#. Description ++#: ../templates:2001 ++msgid "You have the option of installing hddtemp with the SUID bit set, allowing it to be run (reporting hard drive temperatures) by regular users and not only the superuser." ++msgstr "Du kan installera hddtemp med SUID, d kan programmet kras av vanliga anvndare och inte bara superanvndare." ++ ++#. Type: boolean ++#. Description ++#: ../templates:2001 ++msgid "This could potentially allow hddtemp to be used during an attack against the computer's security. If in doubt, do not choose this option." ++msgstr "Detta kan bidra till att intrng kan genomfras om det skulle finnas fel i hddtemp som ngon nyttjar fr att skaffa otillten tkomst. Om du r minsta osker ska du inte aktivera detta alternativ." ++ ++#. Type: boolean ++#. Description ++#. Type: boolean ++#. Description ++#: ../templates:2001 ++#: ../templates:4001 ++msgid "This setting can be modified later by running 'dpkg-reconfigure hddtemp'." ++msgstr "Denna instllning kan ndras senare genom att kra 'dpkg-reconfige hddtemp'" ++ ++#. Type: string ++#. Description ++#: ../templates:3001 ++msgid "Interval between hard drive temperature checks:" ++msgstr "Intervall mellan temperaturmtningar:" ++ ++#. Type: string ++#. Description ++#: ../templates:3001 ++msgid "The temperature of the hard drive(s) can be logged by hddtemp via the generic system logging interface." ++msgstr "Temperaturen fr hrddisken/hrddiskarna kan loggas i det vanliga loggningssystemet." ++ ++#. Type: string ++#. Description ++#: ../templates:3001 ++msgid "Please enter a value in seconds corresponding to the interval between two checks. To disable this feature, enter 0." ++msgstr "Ange ett vrde i sekunder som anger intervallen mellan tv mtningar. Fr att inaktivera den hr funktionen, ange 0 som vrde." ++ ++#. Type: boolean ++#. Description ++#: ../templates:4001 ++msgid "Should the hddtemp daemon be started at boot?" ++msgstr "Vill du starta hddtemp-tjnsten nr systemet startas upp?" ++ ++#. Type: boolean ++#. Description ++#: ../templates:4001 ++msgid "The hddtemp program can be run as a daemon, listening on port 7634 for incoming connections. It is used by some software such as gkrellm to get the temperature of hard drives." ++msgstr "hddtemp kan kras som en tjnst som lyssnar p port 7634 efter inkommande anslutningar. Den anvnds av programvara ssom gkrellm fr att lsa av temperaturen p hrddiskarna." ++ ++#. Type: boolean ++#. Description ++#: ../templates:4001 ++msgid "You have the option of starting the hddtemp daemon automatically on system boot. If in doubt, it is suggested to not start it automatically on boot." ++msgstr "Du har alternativet att starta hddtemp-tjnsten automatiskt nr datorn startas upp. Om du r osker freslr jag att du inte startar den automatiskt vid uppstarten." ++ ++#. Type: string ++#. Description ++#: ../templates:5001 ++msgid "Interface to listen on:" ++msgstr "Grnssnitt att lyssna p:" ++ ++#. Type: string ++#. Description ++#: ../templates:5001 ++msgid "The hddtemp program can listen for incoming connections on a specific interface, or on all interfaces." ++msgstr "hddtemp kan lyssna efter inkommande anslutningar p specifika ntverksgrnssnitt eller p grnssnitt." ++ ++#. Type: string ++#. Description ++#: ../templates:5001 ++msgid "" ++"To listen on a specific interface, enter the IP address of that interface " ++"(choosing 127.0.0.1 will accept local connections only). To listen on all " ++"interfaces, enter 0.0.0.0." ++msgstr "" ++"Fr att lyssna p ett specifik ntverkgrnssnitt, ange IP-adressen p det " ++"grnssnittet (127.0.0.1, vilket r standardvrdet fr grnssnittet lo). Fr " ++"att lyssna p alla, ange 0.0.0.0." ++ ++#. Type: string ++#. Description ++#: ../templates:6001 ++msgid "Port to listen on:" ++msgstr "Port att lyssna p:" ++ ++#. Type: string ++#. Description ++#: ../templates:6001 ++msgid "" ++"By default, hddtemp listens for incoming connections on port 7634. This can " ++"be changed for another port number." ++msgstr "" ++"Som standard lyssnar hddtemp efter inkommande anslutningar p port 7634. Om " ++"du anser att denna port inte r lmplig kan du ange en annan port hr." ++ +--- hddtemp-0.3-beta15.orig/debian/po/da.po ++++ hddtemp-0.3-beta15/debian/po/da.po +@@ -0,0 +1,158 @@ ++# Danish translation hddtemp. ++# Copyright (C) 2010 hddtemp & nedenstående oversættere. ++# This file is distributed under the same license as the hddtemp package. ++# Claus Hindsgaul , 2004, 2005. ++# Claus Hindsgaul , 2006. ++# Joe Hansen (joedalton2@yahoo.dk), 2010. ++# ++msgid "" ++msgstr "" ++"Project-Id-Version: hddtemp\n" ++"Report-Msgid-Bugs-To: hddtemp@packages.debian.org\n" ++"POT-Creation-Date: 2008-01-25 22:35+0100\n" ++"PO-Revision-Date: 2010-11-10 12:42+0000\n" ++"Last-Translator: Joe Hansen \n" ++"Language-Team: Danish \n" ++"MIME-Version: 1.0\n" ++"Content-Type: text/plain; charset=UTF-8\n" ++"Content-Transfer-Encoding: 8bit\n" ++"Plural-Forms: nplurals=2; plural=(n != 1);\n" ++ ++#. Type: boolean ++#. Description ++#: ../templates:2001 ++msgid "Should /usr/sbin/hddtemp be installed SUID root?" ++msgstr "Skal /usr/sbin/hddtemp installeres SUID root?" ++ ++#. Type: boolean ++#. Description ++#: ../templates:2001 ++msgid "" ++"You have the option of installing hddtemp with the SUID bit set, allowing it " ++"to be run (reporting hard drive temperatures) by regular users and not only " ++"the superuser." ++msgstr "" ++"Du har muligheden for at installere hddtemp med sættet SUID bit, og tillade " ++"den at blive kørt (rapportering af temperaturer for harddiske) af normale " ++"brugere og ikke kun superbrugeren." ++ ++#. Type: boolean ++#. Description ++#: ../templates:2001 ++msgid "" ++"This could potentially allow hddtemp to be used during an attack against the " ++"computer's security. If in doubt, do not choose this option." ++msgstr "" ++"Dette kan potentielt tillade hddtemp at blive brugt under et angreb mod " ++"computerens sikkerhed. Hvis du er i tvivl, så vælg ikke denne indstilling." ++ ++#. Type: boolean ++#. Description ++#. Type: boolean ++#. Description ++#: ../templates:2001 ../templates:4001 ++msgid "" ++"This setting can be modified later by running 'dpkg-reconfigure hddtemp'." ++msgstr "" ++"Denne indstilling kan ændres senere ved at køre »dpkg-reconfigure hddtemp«." ++ ++#. Type: string ++#. Description ++#: ../templates:3001 ++msgid "Interval between hard drive temperature checks:" ++msgstr "Tidsrum mellem to tjek af temperaturen på harddisken:" ++ ++#. Type: string ++#. Description ++#: ../templates:3001 ++msgid "" ++"The temperature of the hard drive(s) can be logged by hddtemp via the " ++"generic system logging interface." ++msgstr "" ++"Temperaturen på harddiskene kan logges af hddtemp via den generiske " ++"grænseflade til systemlogning." ++ ++#. Type: string ++#. Description ++#: ../templates:3001 ++msgid "" ++"Please enter a value in seconds corresponding to the interval between two " ++"checks. To disable this feature, enter 0." ++msgstr "" ++"Indtast venligst en værdi i sekunder, der angiver intervallet mellem to tjek. " ++"Du kan deaktivere denne funktion ved at skrive 0." ++ ++#. Type: boolean ++#. Description ++#: ../templates:4001 ++msgid "Should the hddtemp daemon be started at boot?" ++msgstr "Skal hddtemp-dæmonen igangsættes ved opstart?" ++ ++#. Type: boolean ++#. Description ++#: ../templates:4001 ++msgid "" ++"The hddtemp program can be run as a daemon, listening on port 7634 for " ++"incoming connections. It is used by some software such as gkrellm to get the " ++"temperature of hard drives." ++msgstr "" ++"Programmet hddtemp kan køres som en dæmon, der lytter på port 7634 efter " ++"indkommende forbindelser. Programmet bruges af bestemte programmer såsom " ++"gkrellm til at hente harddiskenes temperaturer." ++ ++#. Type: boolean ++#. Description ++#: ../templates:4001 ++msgid "" ++"You have the option of starting the hddtemp daemon automatically on system " ++"boot. If in doubt, it is suggested to not start it automatically on boot." ++msgstr "" ++"Du har mulighed for at igangsætte hddtemp-dæmonen automatisk under opstart. " ++"Hvis du er i tvivl, foreslås det, at du ikke igangsætter den automatisk under " ++"opstarten." ++ ++#. Type: string ++#. Description ++#: ../templates:5001 ++msgid "Interface to listen on:" ++msgstr "Netkort, der skal lyttes på:" ++ ++#. Type: string ++#. Description ++#: ../templates:5001 ++msgid "" ++"The hddtemp program can listen for incoming connections on a specific " ++"interface, or on all interfaces." ++msgstr "" ++"Programmet hddtemp kan lytte efter indkommende forbindelser på et bestemt " ++"netkort eller på alle netkort." ++ ++#. Type: string ++#. Description ++#: ../templates:5001 ++msgid "" ++"To listen on a specific interface, enter the IP address of that interface " ++"(choosing 127.0.0.1 will accept local connections only). To listen on all " ++"interfaces, enter 0.0.0.0." ++msgstr "" ++"For at lytte til et bestemt netkort, skal du angive IP-adressen på dette " ++"(valg af 127.0.0.1 vil kun acceptere lokale forbindelser). For at " ++"lytte på alle netkort indtastes 0.0.0.0." ++ ++#. Type: string ++#. Description ++#: ../templates:6001 ++msgid "Port to listen on:" ++msgstr "Port, der skal lyttes på:" ++ ++#. Type: string ++#. Description ++#: ../templates:6001 ++msgid "" ++"By default, hddtemp listens for incoming connections on port 7634. This can " ++"be changed for another port number." ++msgstr "" ++"Som udgangspunkt vil hddtemp lytte efter indkommende forbindelser på port " ++"7634. Dette kan ændres til et andet nummer." ++ ++ +--- hddtemp-0.3-beta15.orig/debian/po/pt.po ++++ hddtemp-0.3-beta15/debian/po/pt.po +@@ -0,0 +1,158 @@ ++# translation of pt.po to portugues ++# Portuguese translation for hddtemp ++# Copyright (C) 2006, 2007, 2008 Free Software Foundation, Inc. ++# This file is distributed under the same license as the hddtemp package. ++# ++# Miguel Figueiredo , 2006, 2007. ++# Bruno Queiros , 2007. ++# Bruno Queiros , 2008. ++msgid "" ++msgstr "" ++"Project-Id-Version: pt\n" ++"Report-Msgid-Bugs-To: hddtemp@packages.debian.org\n" ++"POT-Creation-Date: 2008-01-25 22:35+0100\n" ++"PO-Revision-Date: 2008-02-10 19:48+0000\n" ++"Last-Translator: Bruno Queiros \n" ++"Language-Team: portugues \n" ++"MIME-Version: 1.0\n" ++"Content-Type: text/plain; charset=UTF-8\n" ++"Content-Transfer-Encoding: 8bit\n" ++"X-Generator: KBabel 1.11.4\n" ++ ++#. Type: boolean ++#. Description ++#: ../templates:2001 ++msgid "Should /usr/sbin/hddtemp be installed SUID root?" ++msgstr "Deve o /usr/sbin/hddtemp ser instalado com SUID root?" ++ ++#. Type: boolean ++#. Description ++#: ../templates:2001 ++msgid "" ++"You have the option of installing hddtemp with the SUID bit set, allowing it " ++"to be run (reporting hard drive temperatures) by regular users and not only " ++"the superuser." ++msgstr "" ++"Você tem a opção de instalar o hddtemp com o SUID, permitindo-o ser " ++"executado (relatar temperaturas do disco rigido) por utilizadores normais e " ++"não apenas pelo super utilizador." ++ ++#. Type: boolean ++#. Description ++#: ../templates:2001 ++msgid "" ++"This could potentially allow hddtemp to be used during an attack against the " ++"computer's security. If in doubt, do not choose this option." ++msgstr "" ++"Isto pode potencialmente permitir que o hddtemp seja utilizado num ataque " ++"contra a segurança do computador. Em caso de dúvida, não escolha esta opção." ++ ++#. Type: boolean ++#. Description ++#. Type: boolean ++#. Description ++#: ../templates:2001 ../templates:4001 ++msgid "" ++"This setting can be modified later by running 'dpkg-reconfigure hddtemp'." ++msgstr "" ++"Esta opção pode ser modificada mais tarde executando 'dpkg-reconfigure " ++"hddtemp'." ++ ++#. Type: string ++#. Description ++#: ../templates:3001 ++msgid "Interval between hard drive temperature checks:" ++msgstr "Intervalo entre verificações da temperatura do disco rigido:" ++ ++#. Type: string ++#. Description ++#: ../templates:3001 ++msgid "" ++"The temperature of the hard drive(s) can be logged by hddtemp via the " ++"generic system logging interface." ++msgstr "" ++"A temperatura do(s) disco(s) rígido(s) podem ser guardados pelo hddtemp " ++"através da interface genérica do sistema para guardar registos." ++ ++#. Type: string ++#. Description ++#: ../templates:3001 ++msgid "" ++"Please enter a value in seconds corresponding to the interval between two " ++"checks. To disable this feature, enter 0." ++msgstr "" ++"Por favor introduza um valor em segundos correspondendo ao intervalo entre " ++"duas verificações. Para desactivar esta opção, introduza 0." ++ ++#. Type: boolean ++#. Description ++#: ../templates:4001 ++msgid "Should the hddtemp daemon be started at boot?" ++msgstr "Deseja iniciar o daemon hddtemp no arranque?" ++ ++#. Type: boolean ++#. Description ++#: ../templates:4001 ++msgid "" ++"The hddtemp program can be run as a daemon, listening on port 7634 for " ++"incoming connections. It is used by some software such as gkrellm to get the " ++"temperature of hard drives." ++msgstr "" ++"O programa hddtemp pode ser executado como um daemon, à escuta na porta " ++"7634. É utilizada por alguns programas como o gkrellm para obter a " ++"temperatura dos discos rígidos." ++ ++#. Type: boolean ++#. Description ++#: ../templates:4001 ++msgid "" ++"You have the option of starting the hddtemp daemon automatically on system " ++"boot. If in doubt, it is suggested to not start it automatically on boot." ++msgstr "" ++"Você tem a opção de executar o daemon hddtemp automaticamente no arranque do " ++"sistema. Se estiver em dúvida, é sugerido que não o inicie automaticamente " ++"no arranque." ++ ++#. Type: string ++#. Description ++#: ../templates:5001 ++msgid "Interface to listen on:" ++msgstr "Interface para utilizar na escuta:" ++ ++#. Type: string ++#. Description ++#: ../templates:5001 ++msgid "" ++"The hddtemp program can listen for incoming connections on a specific " ++"interface, or on all interfaces." ++msgstr "" ++"O programa hddtemp pode escutar por ligações de entrada numa interface " ++"específica, ou em todas as interfaces." ++ ++#. Type: string ++#. Description ++#: ../templates:5001 ++msgid "" ++"To listen on a specific interface, enter the IP address of that interface " ++"(choosing 127.0.0.1 will accept local connections only). To listen on all " ++"interfaces, enter 0.0.0.0." ++msgstr "" ++"Para escutar numa interface específica, introduza o endereço IP dessa " ++"interface (escolhendo 127.0.0.1 irá aceitar apenas ligações locais). Para " ++"escutar em todas as interfaces, introduza 0.0.0.0." ++ ++#. Type: string ++#. Description ++#: ../templates:6001 ++msgid "Port to listen on:" ++msgstr "Porta a utilizar na escuta:" ++ ++#. Type: string ++#. Description ++#: ../templates:6001 ++msgid "" ++"By default, hddtemp listens for incoming connections on port 7634. This can " ++"be changed for another port number." ++msgstr "" ++"O hddtemp escuta por ligações de entrada na porta 7634 por pré-definição. " ++"Isto pode ser alterado para outra porta." +--- hddtemp-0.3-beta15.orig/debian/po/eu.po ++++ hddtemp-0.3-beta15/debian/po/eu.po +@@ -0,0 +1,111 @@ ++# SOME DESCRIPTIVE TITLE. ++# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER ++# This file is distributed under the same license as the PACKAGE package. ++# Piarres Beobide , 2008. ++ ++ ++msgid "" ++msgstr "" ++"Project-Id-Version: hddtemp-debconf\n" ++"Report-Msgid-Bugs-To: hddtemp@packages.debian.org\n" ++"POT-Creation-Date: 2008-01-25 22:35+0100\n" ++"PO-Revision-Date: 2008-02-14 12:11+0100\n" ++"Last-Translator: Piarres Beobide \n" ++"Language-Team: Euskara \n" ++"MIME-Version: 1.0\n" ++"Content-Type: text/plain; charset=utf-8\n" ++"Content-Transfer-Encoding: 8bit\n" ++ ++#. Type: boolean ++#. Description ++#: ../templates:2001 ++msgid "Should /usr/sbin/hddtemp be installed SUID root?" ++msgstr "/usr/sbin/hddtemp SUID bit-a gaiturik duela instalatu behar da?" ++ ++#. Type: boolean ++#. Description ++#: ../templates:2001 ++msgid "You have the option of installing hddtemp with the SUID bit set, allowing it to be run (reporting hard drive temperatures) by regular users and not only the superuser." ++msgstr "Zuk hddtemp SUID bit-a ezarria duela instalatzeko aukera duzu supererabiltzaileak bakarrik beharrean erabiltzaile arrunti exekutatzeko (disko gogor tenperaturak erreportatzeko) baimena emanez." ++ ++#. Type: boolean ++#. Description ++#: ../templates:2001 ++msgid "This could potentially allow hddtemp to be used during an attack against the computer's security. If in doubt, do not choose this option." ++msgstr "Honek ordenagailuari eraso batetan hddtemp erabiltzeko aukera ematen du. Zalantzarik baduzu ez hautatu aukera hau." ++ ++#. Type: boolean ++#. Description ++#. Type: boolean ++#. Description ++#: ../templates:2001 ++#: ../templates:4001 ++msgid "This setting can be modified later by running 'dpkg-reconfigure hddtemp'." ++msgstr "Ezarpen hau beranduago aldatu daiteke 'dpkg-reconfigure hddtemp' abiaraziz." ++ ++#. Type: string ++#. Description ++#: ../templates:3001 ++msgid "Interval between hard drive temperature checks:" ++msgstr "Disko gogor tenperatura arakatzeen arteko denbora tartea:" ++ ++#. Type: string ++#. Description ++#: ../templates:3001 ++msgid "The temperature of the hard drive(s) can be logged by hddtemp via the generic system logging interface." ++msgstr "Hddtemp-ek disko gorren tenperatura sistemako erregistro interfaze orokorraren bidez erregistratu dezake." ++ ++#. Type: string ++#. Description ++#: ../templates:3001 ++msgid "Please enter a value in seconds corresponding to the interval between two checks. To disable this feature, enter 0." ++msgstr "Mesedez idatzi bi arakatzeen arteko denbora tartea segunduetan. Ezaugarri hau ezgaitzeko 0 ezarri." ++ ++#. Type: boolean ++#. Description ++#: ../templates:4001 ++msgid "Should the hddtemp daemon be started at boot?" ++msgstr "Hddtemp deabrua sistema abiaraztean abiarazi behar al da?" ++ ++#. Type: boolean ++#. Description ++#: ../templates:4001 ++msgid "The hddtemp program can be run as a daemon, listening on port 7634 for incoming connections. It is used by some software such as gkrellm to get the temperature of hard drives." ++msgstr "Hddtemp programa deabru bat bezala erabili daiteke, sarrera konexioak 7624 atakan entzungo ditu. Hau gkrellm bezalako zenbait softwarek disko gogorren tenperatura eskuratzeko erabiltzen dute." ++ ++#. Type: boolean ++#. Description ++#: ../templates:4001 ++msgid "You have the option of starting the hddtemp daemon automatically on system boot. If in doubt, it is suggested to not start it automatically on boot." ++msgstr "Zuk hddtemp deabrua sistema abiaraztean automatikoki abiarazteko aukera duzu. Zalantzarik baduzu abioan ez automatikoki abiaraztea gomendatzen da." ++ ++#. Type: string ++#. Description ++#: ../templates:5001 ++msgid "Interface to listen on:" ++msgstr "Entzungo den interfazea:" ++ ++#. Type: string ++#. Description ++#: ../templates:5001 ++msgid "The hddtemp program can listen for incoming connections on a specific interface, or on all interfaces." ++msgstr "Hddtemp programak sarrera konexioak interfaze zehatz batetan bakarrik edo guztietan entzuteko aukera du." ++ ++#. Type: string ++#. Description ++#: ../templates:5001 ++msgid "To listen on a specific interface, enter the IP address of that interface (choosing 127.0.0.1 will accept local connections only). To listen on all interfaces, enter 0.0.0.0." ++msgstr "Interfaze zehatz batetan entzuteko, idatzi interfaze horren IP helbidea (127.0.0.1 ipiniaz konexioa lokalak bakarrik onartuko dira). Interfaze guztietan entzuteko , 0.0.0.0 idatzi." ++ ++#. Type: string ++#. Description ++#: ../templates:6001 ++msgid "Port to listen on:" ++msgstr "Entzuteko ataka:" ++ ++#. Type: string ++#. Description ++#: ../templates:6001 ++msgid "By default, hddtemp listens for incoming connections on port 7634. This can be changed for another port number." ++msgstr "Lehenetspen modura hddtemp-ek sarrera konexioak 7634 atakan entzungo ditu. Auker ahonen bidez betste ataka bat ezartzeko auekra dago." ++ +--- hddtemp-0.3-beta15.orig/debian/po/it.po ++++ hddtemp-0.3-beta15/debian/po/it.po +@@ -0,0 +1,155 @@ ++# Italian translation of the hddtemp debconf template ++# This file is distributed under the same license as the hddtemp package ++# Copyright (C) 2008 Free Software Foundation, Inc. ++# Luca Monducci , 2008. ++# ++msgid "" ++msgstr "" ++"Project-Id-Version: hddtemp 0.3\n" ++"Report-Msgid-Bugs-To: hddtemp@packages.debian.org\n" ++"POT-Creation-Date: 2008-01-25 22:35+0100\n" ++"PO-Revision-Date: 2008-02-09 21:52+0100\n" ++"Last-Translator: Luca Monducci \n" ++"Language-Team: Italian \n" ++"MIME-Version: 1.0\n" ++"Content-Type: text/plain; charset=UTF-8\n" ++"Content-Transfer-Encoding: 8bit\n" ++ ++#. Type: boolean ++#. Description ++#: ../templates:2001 ++msgid "Should /usr/sbin/hddtemp be installed SUID root?" ++msgstr "Installare /usr/sbin/hddtemp con il SUID root?" ++ ++#. Type: boolean ++#. Description ++#: ../templates:2001 ++msgid "" ++"You have the option of installing hddtemp with the SUID bit set, allowing it " ++"to be run (reporting hard drive temperatures) by regular users and not only " ++"the superuser." ++msgstr "" ++"È possibile installare hddtemp con il bit SUID attivo, questo consente a un " ++"utente normale, e non solo al superuser, di eseguire il programma " ++"(riportando le temperature dei dischi)." ++ ++#. Type: boolean ++#. Description ++#: ../templates:2001 ++msgid "" ++"This could potentially allow hddtemp to be used during an attack against the " ++"computer's security. If in doubt, do not choose this option." ++msgstr "" ++"Questo potrebbe permettere l'uso di hddtemp durante un attacco alla " ++"sicurezza del sistema. In caso di dubbi, non attivare questa opzione." ++ ++#. Type: boolean ++#. Description ++#. Type: boolean ++#. Description ++#: ../templates:2001 ../templates:4001 ++msgid "" ++"This setting can be modified later by running 'dpkg-reconfigure hddtemp'." ++msgstr "" ++"In seguito, per modificare questa impostazione si può usare \"dpkg-" ++"reconfigure hddtemp\"." ++ ++#. Type: string ++#. Description ++#: ../templates:3001 ++msgid "Interval between hard drive temperature checks:" ++msgstr "Intervallo fra due controlli della temperatura dei dischi:" ++ ++#. Type: string ++#. Description ++#: ../templates:3001 ++msgid "" ++"The temperature of the hard drive(s) can be logged by hddtemp via the " ++"generic system logging interface." ++msgstr "" ++"La temperatura dei dischi può essere registrata da hddtemp tramite " ++"l'interfaccia generica offerta dal log di sistema." ++ ++#. Type: string ++#. Description ++#: ../templates:3001 ++msgid "" ++"Please enter a value in seconds corresponding to the interval between two " ++"checks. To disable this feature, enter 0." ++msgstr "" ++"Inserire il valore in secondi corrispondente all'intervallo fra due " ++"controlli. Per non utilizzare questa funzionalità inserire 0." ++ ++#. Type: boolean ++#. Description ++#: ../templates:4001 ++msgid "Should the hddtemp daemon be started at boot?" ++msgstr "Far partire il demone hddtemp all'avvio del sistema?" ++ ++#. Type: boolean ++#. Description ++#: ../templates:4001 ++msgid "" ++"The hddtemp program can be run as a daemon, listening on port 7634 for " ++"incoming connections. It is used by some software such as gkrellm to get the " ++"temperature of hard drives." ++msgstr "" ++"Il programma hddtemp può essere avviato come un demone in ascolto di " ++"connessioni in arrivo sulla porta 7634. Viene usato da programmi come " ++"gkrellm per recuperare la temperatura dei dischi fissi." ++ ++#. Type: boolean ++#. Description ++#: ../templates:4001 ++msgid "" ++"You have the option of starting the hddtemp daemon automatically on system " ++"boot. If in doubt, it is suggested to not start it automatically on boot." ++msgstr "" ++"È possibile far partire automaticamente il demone hddtemp all'avvio del " ++"sistema. In caso di dubbi, si suggerisce di non far partire il demone " ++"all'avvio." ++ ++#. Type: string ++#. Description ++#: ../templates:5001 ++msgid "Interface to listen on:" ++msgstr "Interfaccia su cui ascoltare:" ++ ++#. Type: string ++#. Description ++#: ../templates:5001 ++msgid "" ++"The hddtemp program can listen for incoming connections on a specific " ++"interface, or on all interfaces." ++msgstr "" ++"Il programma hddtemp può mettersi in ascolto di connessioni in arrivo su una " ++"particolare interfaccia oppure su tutte." ++ ++#. Type: string ++#. Description ++#: ../templates:5001 ++msgid "" ++"To listen on a specific interface, enter the IP address of that interface " ++"(choosing 127.0.0.1 will accept local connections only). To listen on all " ++"interfaces, enter 0.0.0.0." ++msgstr "" ++"Per ascoltare su una specifica interfaccia, inserire l'indirizzo IP di tale " ++"interfaccia (con 127.0.0.1 saranno accettate solo connesioni locali). Per " ++"ascoltare su tutte le interfacce inserire 0.0.0.0." ++ ++#. Type: string ++#. Description ++#: ../templates:6001 ++msgid "Port to listen on:" ++msgstr "Porta su cui ascoltare:" ++ ++#. Type: string ++#. Description ++#: ../templates:6001 ++msgid "" ++"By default, hddtemp listens for incoming connections on port 7634. This can " ++"be changed for another port number." ++msgstr "" ++"Con la configurazione predefinita hddtemp si mette in ascolto di connessioni " ++"in arrivo sulla porta 7634. È possibile cambiare questo valore con un altro " ++"numero di porta." +--- hddtemp-0.3-beta15.orig/debian/po/de.po ++++ hddtemp-0.3-beta15/debian/po/de.po +@@ -0,0 +1,164 @@ ++# translation of hddtemp_0.3-beta15-39_de.po to German ++# ++# Translators, if you are not familiar with the PO format, gettext ++# documentation is worth reading, especially sections dedicated to ++# this format, e.g. by running: ++# info -n '(gettext)PO Files' ++# info -n '(gettext)Header Entry' ++# Some information specific to po-debconf are available at ++# /usr/share/doc/po-debconf/README-trans ++# or http://www.debian.org/intl/l10n/po-debconf/README-trans# ++# Developers do not need to manually edit POT or PO files. ++# ++# Erik Schanze , 2004-2008. ++msgid "" ++msgstr "" ++"Project-Id-Version: hddtemp_0.3-beta15-39_de\n" ++"Report-Msgid-Bugs-To: hddtemp@packages.debian.org\n" ++"POT-Creation-Date: 2008-01-25 22:35+0100\n" ++"PO-Revision-Date: 2008-01-27 21:18+0100\n" ++"Last-Translator: Erik Schanze \n" ++"Language-Team: German \n" ++"MIME-Version: 1.0\n" ++"Content-Type: text/plain; charset=UTF-8\n" ++"Content-Transfer-Encoding: 8bit\n" ++"X-Generator: KBabel 1.11.4\n" ++"Plural-Forms: nplurals=2; plural=(n != 1);\n" ++ ++#. Type: boolean ++#. Description ++#: ../templates:2001 ++msgid "Should /usr/sbin/hddtemp be installed SUID root?" ++msgstr "Soll /usr/sbin/hddtemp mit Root-Rechten ausgestattet werden?" ++ ++#. Type: boolean ++#. Description ++#: ../templates:2001 ++msgid "" ++"You have the option of installing hddtemp with the SUID bit set, allowing it " ++"to be run (reporting hard drive temperatures) by regular users and not only " ++"the superuser." ++msgstr "" ++"Sie haben die Möglichkeit, Hddtemp bei der Installation mit Root-Rechten " ++"auszustatten. Damit kann es von jedem normalen Benutzer (und nicht nur von " ++"Root) gestartet werden, um die Festplattentemperatur zu melden." ++ ++#. Type: boolean ++#. Description ++#: ../templates:2001 ++msgid "" ++"This could potentially allow hddtemp to be used during an attack against the " ++"computer's security. If in doubt, do not choose this option." ++msgstr "" ++"Dadurch könnte es aber möglich sein, die Sicherheit des Rechners " ++"anzugreifen. Wenn Sie sich nicht sicher sind, lehnen Sie hier ab." ++ ++#. Type: boolean ++#. Description ++#. Type: boolean ++#. Description ++#: ../templates:2001 ../templates:4001 ++msgid "" ++"This setting can be modified later by running 'dpkg-reconfigure hddtemp'." ++msgstr "" ++"Diese Einstellung kann später durch den Befehl 'dpkg-reconfigure hddtemp' " ++"geändert werden." ++ ++#. Type: string ++#. Description ++#: ../templates:3001 ++msgid "Interval between hard drive temperature checks:" ++msgstr "Zeitraum zwischen den Überprüfungen der Festplattentemperatur:" ++ ++#. Type: string ++#. Description ++#: ../templates:3001 ++msgid "" ++"The temperature of the hard drive(s) can be logged by hddtemp via the " ++"generic system logging interface." ++msgstr "" ++"Die Temperatur der Festplatte(n) kann von Hddtemp mittels der allgemeinen " ++"System-Protokollierschnittstelle fortlaufend gespeichert werden." ++ ++#. Type: string ++#. Description ++#: ../templates:3001 ++msgid "" ++"Please enter a value in seconds corresponding to the interval between two " ++"checks. To disable this feature, enter 0." ++msgstr "" ++"Bitte geben Sie die Zeitspanne zwischen zwei Überprüfungen in Sekunden ein. " ++"Um diese Funktion abzuschalten, geben Sie 0 ein." ++ ++#. Type: boolean ++#. Description ++#: ../templates:4001 ++msgid "Should the hddtemp daemon be started at boot?" ++msgstr "Den Hddtemp-Dienst beim Hochfahren des Systems starten?" ++ ++#. Type: boolean ++#. Description ++#: ../templates:4001 ++msgid "" ++"The hddtemp program can be run as a daemon, listening on port 7634 for " ++"incoming connections. It is used by some software such as gkrellm to get the " ++"temperature of hard drives." ++msgstr "" ++"Hddtemp kann als Dienst betrieben werden und wartet am Port 7634 auf " ++"ankommende Verbindungen. Das wird von einigen Programmen wie Gkrellm " ++"genutzt, um die Temperatur der Festplatten abzufragen." ++ ++#. Type: boolean ++#. Description ++#: ../templates:4001 ++msgid "" ++"You have the option of starting the hddtemp daemon automatically on system " ++"boot. If in doubt, it is suggested to not start it automatically on boot." ++msgstr "" ++"Sie haben die Möglichkeit, den Dienst Hddtemp beim Hochfahren des Systems " ++"automatisch zu starten. Wenn Sie sich nicht sicher sind, starten Sie den " ++"Dienst nicht automatisch beim Hochfahren." ++ ++#. Type: string ++#. Description ++#: ../templates:5001 ++msgid "Interface to listen on:" ++msgstr "Schnittstelle, an der auf Anfragen gewartet wird:" ++ ++#. Type: string ++#. Description ++#: ../templates:5001 ++msgid "" ++"The hddtemp program can listen for incoming connections on a specific " ++"interface, or on all interfaces." ++msgstr "" ++"Hddtemp kann an einer speziellen oder an allen Schnittstelle auf ankommende " ++"Verbindungen warten." ++ ++#. Type: string ++#. Description ++#: ../templates:5001 ++msgid "" ++"To listen on a specific interface, enter the IP address of that interface " ++"(choosing 127.0.0.1 will accept local connections only). To listen on all " ++"interfaces, enter 0.0.0.0." ++msgstr "" ++"Um an einer einzelnen Schnittstelle auf Anfragen zu warten, geben Sie deren " ++"IP-Adresse ein (Falls Sie 127.0.0.1 wählen, sind nur lokale Verbindungen " ++"erlaubt). Um alle Schnittstellen zu verwenden, geben Sie 0.0.0.0 ein." ++ ++#. Type: string ++#. Description ++#: ../templates:6001 ++msgid "Port to listen on:" ++msgstr "Port, an dem auf Anfragen gewartet wird:" ++ ++#. Type: string ++#. Description ++#: ../templates:6001 ++msgid "" ++"By default, hddtemp listens for incoming connections on port 7634. This can " ++"be changed for another port number." ++msgstr "" ++"Normalerweise wartet Hddtemp am Port 7634 auf ankommende Verbindungen. Sie " ++"können auch eine andere Port-Nummer eingeben." +--- hddtemp-0.3-beta15.orig/debian/po/gl.po ++++ hddtemp-0.3-beta15/debian/po/gl.po +@@ -0,0 +1,176 @@ ++# Galician translation of hddtemp's debconf templates ++# This file is distributed under the same license as the hddtemp package. ++# Jacobo Tarrio , 2007, 2008. ++# ++msgid "" ++msgstr "" ++"Project-Id-Version: hddtemp\n" ++"Report-Msgid-Bugs-To: hddtemp@packages.debian.org\n" ++"POT-Creation-Date: 2008-01-25 22:35+0100\n" ++"PO-Revision-Date: 2008-01-28 19:08+0000\n" ++"Last-Translator: Jacobo Tarrio \n" ++"Language-Team: Galician \n" ++"MIME-Version: 1.0\n" ++"Content-Type: text/plain; charset=UTF-8\n" ++"Content-Transfer-Encoding: 8bit\n" ++ ++#. Type: boolean ++#. Description ++#: ../templates:2001 ++msgid "Should /usr/sbin/hddtemp be installed SUID root?" ++msgstr "¿Quere instalar /usr/sbin/hddtemp con \"setuid\" root?" ++ ++#. Type: boolean ++#. Description ++#: ../templates:2001 ++msgid "" ++"You have the option of installing hddtemp with the SUID bit set, allowing it " ++"to be run (reporting hard drive temperatures) by regular users and not only " ++"the superuser." ++msgstr "" ++"Ten a posibilidade de instalar hddtemp co bit SUID establecido, o que o " ++"permite executar (para que informe da temperatura dos discos duros) por " ++"parte de usuarios normais, e non só o administrador." ++ ++#. Type: boolean ++#. Description ++#: ../templates:2001 ++msgid "" ++"This could potentially allow hddtemp to be used during an attack against the " ++"computer's security. If in doubt, do not choose this option." ++msgstr "" ++"Con isto é posible que se empregue hddtemp durante un ataque contra a " ++"seguridade do ordenador. Se non está seguro, non escolla esta opción." ++ ++#. Type: boolean ++#. Description ++#. Type: boolean ++#. Description ++#: ../templates:2001 ../templates:4001 ++msgid "" ++"This setting can be modified later by running 'dpkg-reconfigure hddtemp'." ++msgstr "" ++"Esta elección pódese cambiar a posteriori executando \"dpkg-reconfigure " ++"hddtemp\"." ++ ++#. Type: string ++#. Description ++#: ../templates:3001 ++msgid "Interval between hard drive temperature checks:" ++msgstr "Intervalo entre comprobacións da temperatura do disco duro:" ++ ++#. Type: string ++#. Description ++#: ../templates:3001 ++msgid "" ++"The temperature of the hard drive(s) can be logged by hddtemp via the " ++"generic system logging interface." ++msgstr "" ++"O programa hddtemp pode manter un rexistro da temperatura do(s) disco(s) duro" ++"(s) empregando a interface xenérica de rexistro do sistema." ++ ++#. Type: string ++#. Description ++#: ../templates:3001 ++msgid "" ++"Please enter a value in seconds corresponding to the interval between two " ++"checks. To disable this feature, enter 0." ++msgstr "" ++"Introduza un valor en segundos correspondente ao intervalo entre " ++"comprobacións. Para desactivar esta característica, introduza un 0." ++ ++#. Type: boolean ++#. Description ++#: ../templates:4001 ++msgid "Should the hddtemp daemon be started at boot?" ++msgstr "¿Quere iniciar o servizo de hddtemp co sistema?" ++ ++#. Type: boolean ++#. Description ++#: ../templates:4001 ++msgid "" ++"The hddtemp program can be run as a daemon, listening on port 7634 for " ++"incoming connections. It is used by some software such as gkrellm to get the " ++"temperature of hard drives." ++msgstr "" ++"Pódese executar o programa hddtemp coma un servizo que espera conexións " ++"entrantes no porto 7634. Emprégao algún software coma gkrellm para obter a " ++"temperatura dos discos duros." ++ ++#. Type: boolean ++#. Description ++#: ../templates:4001 ++msgid "" ++"You have the option of starting the hddtemp daemon automatically on system " ++"boot. If in doubt, it is suggested to not start it automatically on boot." ++msgstr "" ++"Ten a posibilidade de arrincar o servizo hddtemp automaticamente ao iniciar " ++"o sistema. Se ten dúbidas, suxírese que non o arrinque automaticamente ao " ++"iniciar o sistema." ++ ++#. Type: string ++#. Description ++#: ../templates:5001 ++msgid "Interface to listen on:" ++msgstr "Interface na que escoitar:" ++ ++#. Type: string ++#. Description ++#: ../templates:5001 ++msgid "" ++"The hddtemp program can listen for incoming connections on a specific " ++"interface, or on all interfaces." ++msgstr "" ++"O programa hddtemp pode esperar conexións entrantes nunha interface " ++"determinada ou en tódalas interfaces." ++ ++#. Type: string ++#. Description ++#: ../templates:5001 ++msgid "" ++"To listen on a specific interface, enter the IP address of that interface " ++"(choosing 127.0.0.1 will accept local connections only). To listen on all " ++"interfaces, enter 0.0.0.0." ++msgstr "" ++"Para escoitar nunha interface determinada, introduza o enderezo IP desa " ++"interface (se escolle 127.0.0.1 hanse aceptar só conexións locais). Para " ++"escoitar en tódalas interfaces, introduza 0.0.0.0." ++ ++#. Type: string ++#. Description ++#: ../templates:6001 ++msgid "Port to listen on:" ++msgstr "Porto no que escoitar:" ++ ++#. Type: string ++#. Description ++#: ../templates:6001 ++msgid "" ++"By default, hddtemp listens for incoming connections on port 7634. This can " ++"be changed for another port number." ++msgstr "" ++"Por defecto, hddtemp espera conexións entrantes no porto 7634. Pódese " ++"cambiar por outro porto." ++ ++#~ msgid "You have the option of installing hddtemp with the SUID bit set." ++#~ msgstr "Ten a posibilidade de instalar hddtemp co bit SUID activado." ++ ++#~ msgid "" ++#~ "If you make hddtemp SUID, unprivileged users of your systems will be able " ++#~ "to run it. This could, however, potentially allow hddtemp to be used " ++#~ "during a security attack on your computer. If in doubt, it is suggested " ++#~ "to install it without SUID. If you later change your mind, you can run: " ++#~ "'dpkg-reconfigure hddtemp'." ++#~ msgstr "" ++#~ "Se lle pon o bit SUID a hddtemp, os usuarios sen privilexios dos seus " ++#~ "sistemas han poder executalo. Nembargantes, isto pode permitir que se " ++#~ "empregue hddtemp durante un ataque á seguridade do seu ordenador. Se ten " ++#~ "dúbidas, é mellor que o instale sen SUID. Se cambia de opinión máis " ++#~ "adiante, pode executar \"dpkg-reconfigure hddtemp\"." ++ ++#~ msgid "" ++#~ "hddtemp can periodically log the temperature of the hard drive(s) via the " ++#~ "SYSLOG interface." ++#~ msgstr "" ++#~ "hddtemp pode rexistrar periodicamente a temperatura das unidades de disco " ++#~ "mediante a interface SYSLOG." +--- hddtemp-0.3-beta15.orig/debian/po/ar.po ++++ hddtemp-0.3-beta15/debian/po/ar.po +@@ -0,0 +1,209 @@ ++# translation of ar.po to ++# ++# Translators, if you are not familiar with the PO format, gettext ++# documentation is worth reading, especially sections dedicated to ++# this format, e.g. by running: ++# info -n '(gettext)PO Files' ++# info -n '(gettext)Header Entry' ++# Some information specific to po-debconf are available at ++# /usr/share/doc/po-debconf/README-trans ++# or http://www.debian.org/intl/l10n/po-debconf/README-trans# ++# Developers do not need to manually edit POT or PO files. ++# ++# Ossama M. Khayat, 2005. ++# Ossama M. Khayat , 2010. ++msgid "" ++msgstr "" ++"Project-Id-Version: hddtemp_0.3-beta13-19\n" ++"Report-Msgid-Bugs-To: hddtemp@packages.debian.org\n" ++"POT-Creation-Date: 2008-01-25 22:35+0100\n" ++"PO-Revision-Date: 2010-09-09 04:48+0300\n" ++"Last-Translator: Ossama M. Khayat \n" ++"Language-Team: Arabic \n" ++"MIME-Version: 1.0\n" ++"Content-Type: text/plain; charset=UTF-8\n" ++"Content-Transfer-Encoding: 8bit\n" ++"X-Generator: Lokalize 1.0\n" ++"Plural-Forms: nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 " ++"&& n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5;\n" ++ ++#. Type: boolean ++#. Description ++#: ../templates:2001 ++#| msgid "Do you want /usr/sbin/hddtemp to be installed SUID root?" ++msgid "Should /usr/sbin/hddtemp be installed SUID root?" ++msgstr "هل يجب تثبيت /usr/sbin/hddtemp مع صلاحية SUID للمستخدم root؟" ++ ++#. Type: boolean ++#. Description ++#: ../templates:2001 ++msgid "" ++"You have the option of installing hddtemp with the SUID bit set, allowing it " ++"to be run (reporting hard drive temperatures) by regular users and not only " ++"the superuser." ++msgstr "" ++"لديك خيار تثبيت hddtemp مع صلاحية SUID، مما يسمح" ++"للمستخدمين العاديين تشغيله (تقرير درجات حرارة القرص الصلب) وليس فقط " ++"المستخدم الخارق." ++ ++#. Type: boolean ++#. Description ++#: ../templates:2001 ++msgid "" ++"This could potentially allow hddtemp to be used during an attack against the " ++"computer's security. If in doubt, do not choose this option." ++msgstr "" ++"قد يتسبب هذا باستخدام hddtemp أثناء الهجوم على" ++"أمن الجهاز. إن كنت في شك، لا تنتق هذا الخيار." ++ ++#. Type: boolean ++#. Description ++#. Type: boolean ++#. Description ++#: ../templates:2001 ../templates:4001 ++msgid "" ++"This setting can be modified later by running 'dpkg-reconfigure hddtemp'." ++msgstr "يمكن تعديل هذا الإعداد لاحقاً بتنفيذ الأمر 'dpkg-reconfigure hddtemp'." ++ ++#. Type: string ++#. Description ++#: ../templates:3001 ++msgid "Interval between hard drive temperature checks:" ++msgstr "الفاصل الزمني للتحقق من حرارة القرص الصلب:" ++ ++#. Type: string ++#. Description ++#: ../templates:3001 ++msgid "" ++"The temperature of the hard drive(s) can be logged by hddtemp via the " ++"generic system logging interface." ++msgstr "" ++"يستطيع hddtemp تسجيل حرارة الأقراص الصلبة عبر " ++"واجهة سجلات النظام الاعتيادية." ++ ++#. Type: string ++#. Description ++#: ../templates:3001 ++#| msgid "" ++#| "Please enter a value in seconds corresponding to the interval between two " ++#| "checks. To disable this feature, simply enter 0." ++msgid "" ++"Please enter a value in seconds corresponding to the interval between two " ++"checks. To disable this feature, enter 0." ++msgstr "" ++"الرجاء إدخال قيمة بالثواني تحدد الفاصل الزمني بين كل " ++"عملية. لتعطيل هذه الميزة، أدخل 0." ++ ++#. Type: boolean ++#. Description ++#: ../templates:4001 ++#| msgid "Do you want to start the hddtemp daemon on startup?" ++msgid "Should the hddtemp daemon be started at boot?" ++msgstr "هل تريد تشغيل عفريت hddtemp عند الإقلاع؟" ++ ++#. Type: boolean ++#. Description ++#: ../templates:4001 ++#| msgid "" ++#| "hddtemp can be run as a daemon, listening on port 7634 for incoming " ++#| "connections. It is used some by software such as gkrellm to get the " ++#| "temperature of the hard drives." ++msgid "" ++"The hddtemp program can be run as a daemon, listening on port 7634 for " ++"incoming connections. It is used by some software such as gkrellm to get the " ++"temperature of hard drives." ++msgstr "" ++"يمكن تشغيل برنامج hddtemp كعفريت، يُصغي للمنفذ 7634 لأي" ++"اتصالات واردة. يُستخدم البرنامج من قبل بعض البرامج الأخرى مثل gkrellm " ++"لمراقبة " ++"درجة حرارة الأقراص الصلبة." ++ ++#. Type: boolean ++#. Description ++#: ../templates:4001 ++#| msgid "" ++#| "You have the option of starting the hddtemp daemon automatically on the " ++#| "computer startup. If in doubt, it is suggested to not start it " ++#| "automatically on startup. If you later change your mind, you can run: " ++#| "'dpkg-reconfigure hddtemp'." ++msgid "" ++"You have the option of starting the hddtemp daemon automatically on system " ++"boot. If in doubt, it is suggested to not start it automatically on boot." ++msgstr "" ++"لديك خيار تشغيل عفريت hddtemp آلياً عند إقلاع " ++"النظام. إن كنت في شك، يقترح عدم تشغيله آلياً عند الإقلاع." ++ ++#. Type: string ++#. Description ++#: ../templates:5001 ++msgid "Interface to listen on:" ++msgstr "الواجهة التي يصغي إليها:" ++ ++#. Type: string ++#. Description ++#: ../templates:5001 ++#| msgid "" ++#| "hddtemp can listen for incoming connections on a specific interface, or " ++#| "on all interfaces." ++msgid "" ++"The hddtemp program can listen for incoming connections on a specific " ++"interface, or on all interfaces." ++msgstr "" ++"يستطيع برنامج hddtemp الإصغاء للاتصالات الواردة على واجهة " ++"محددة، أو جميع الواجهات." ++ ++#. Type: string ++#. Description ++#: ../templates:5001 ++#| msgid "" ++#| "To listen on a specific interface, enter the IP address of that " ++#| "interface (127.0.0.1 which is the default value corresponds to the lo " ++#| "interface). To listen on all interfaces, simply enter 0.0.0.0." ++msgid "" ++"To listen on a specific interface, enter the IP address of that interface " ++"(choosing 127.0.0.1 will accept local connections only). To listen on all " ++"interfaces, enter 0.0.0.0." ++msgstr "" ++"للإصغاء إلى واجهة محددة، أدخل عنوان IP لتلك الواجهة " ++"(اختيار 127.0.0.1 سوف يستقبل الاتصالات المحلية فقط). للإصغاء لجميع " ++"الواجهات، أدخل القيمة 0.0.0.0." ++ ++#. Type: string ++#. Description ++#: ../templates:6001 ++msgid "Port to listen on:" ++msgstr "المنفذ الذي يصغي إليه:" ++ ++#. Type: string ++#. Description ++#: ../templates:6001 ++#| msgid "" ++#| "By default, hddtemp listen for incoming connections on port 7634. However " ++#| "if you don't find this port appropriate, you can enter an other one." ++msgid "" ++"By default, hddtemp listens for incoming connections on port 7634. This can " ++"be changed for another port number." ++msgstr "" ++"بشكل افتراضي، يستمع hddtemp للاتصالات الواردة على المنفذ 7634. ويمكن" ++"تغيير هذا الرقم إلى آخر." ++ ++#~ msgid "You have the option of installing hddtemp with the SUID bit set." ++#~ msgstr "لديك خيار تثبيت hddtemp بتعيين بت SUID." ++ ++#~ msgid "" ++#~ "If you make hddtemp SUID, unprivileged users of your systems will be able " ++#~ "to run it. This could, however, potentially allow hddtemp to be used " ++#~ "during a security attack on your computer. If in doubt, it is suggested " ++#~ "to install it without SUID. If you later change your mind, you can run: " ++#~ "'dpkg-reconfigure hddtemp'." ++#~ msgstr "" ++#~ "إن قمت بتعيين hddtemp SUID، فسيستطيع المستخدمين الغير مخولين لنظامك " ++#~ "تشغيله. قد يتسبب هذا على أي حال بالسماح باستخدام hddtemp أثناء الهجوم " ++#~ "الأمني على حاسبك. إن كنت في شك، أقترح تثبيته دون تعيين SUID. إن بدلت رأيك " ++#~ "لاحقاً، يمكنك تشغيل: 'dpkg-reconfigure hddtemp'." ++ ++#~ msgid "" ++#~ "hddtemp can periodically log the temperature of the hard drive(s) via the " ++#~ "SYSLOG interface." ++#~ msgstr "" ++#~ "يستطيع hddtemp تسجيل حرارة الأقراص الصلبة بشكل دوري عبر واجهة SYSLOG." +--- hddtemp-0.3-beta15.orig/debian/po/ja.po ++++ hddtemp-0.3-beta15/debian/po/ja.po +@@ -0,0 +1,138 @@ ++# ++# Translators, if you are not familiar with the PO format, gettext ++# documentation is worth reading, especially sections dedicated to ++# this format, e.g. by running: ++# info -n '(gettext)PO Files' ++# info -n '(gettext)Header Entry' ++# ++# Some information specific to po-debconf are available at ++# /usr/share/doc/po-debconf/README-trans ++# or http://www.debian.org/intl/l10n/po-debconf/README-trans ++# ++# Developers do not need to manually edit POT or PO files. ++# ++msgid "" ++msgstr "" ++"Project-Id-Version: hddtemp\n" ++"Report-Msgid-Bugs-To: hddtemp@packages.debian.org\n" ++"POT-Creation-Date: 2008-01-25 22:35+0100\n" ++"PO-Revision-Date: 2008-05-29 13:50+0900\n" ++"Last-Translator: Kenshi Muto \n" ++"Language-Team: Japanese \n" ++"MIME-Version: 1.0\n" ++"Content-Type: text/plain; charset=UTF-8\n" ++"Content-Transfer-Encoding: 8bit\n" ++ ++#. Type: boolean ++#. Description ++#: ../templates:2001 ++msgid "Should /usr/sbin/hddtemp be installed SUID root?" ++msgstr "/usr/sbin/hddtemp を SUID root でインストールしますか?" ++ ++#. Type: boolean ++#. Description ++#: ../templates:2001 ++msgid "" ++"You have the option of installing hddtemp with the SUID bit set, allowing it " ++"to be run (reporting hard drive temperatures) by regular users and not only " ++"the superuser." ++msgstr "SUID ビットを設定して hddtemp をインストールするかどうかを選択します。これは、スーパーユーザだけでなく一般ユーザでも (ハードドライブの温度の報告を) 実行することを許可することになります。" ++ ++#. Type: boolean ++#. Description ++#: ../templates:2001 ++msgid "" ++"This could potentially allow hddtemp to be used during an attack against the " ++"computer's security. If in doubt, do not choose this option." ++msgstr "これは潜在的にはコンピュータのセキュリティに対する攻撃に使われる可能性を hddtemp に許すことになります。疑わしければ、「いいえ」と答えてください。" ++ ++#. Type: boolean ++#. Description ++#. Type: boolean ++#. Description ++#: ../templates:2001 ../templates:4001 ++msgid "" ++"This setting can be modified later by running 'dpkg-reconfigure hddtemp'." ++msgstr "この設定はあとで 'dpkg-reconfigure hddtemp' を実行することで変更できます。" ++ ++#. Type: string ++#. Description ++#: ../templates:3001 ++msgid "Interval between hard drive temperature checks:" ++msgstr "ハードドライブの温度チェックの間隔インターバル:" ++ ++#. Type: string ++#. Description ++#: ../templates:3001 ++msgid "" ++"The temperature of the hard drive(s) can be logged by hddtemp via the " ++"generic system logging interface." ++msgstr "hddtemp でハードドライブの温度を一般的なシステムロギングインターフェイスを通して記録できます。" ++ ++#. Type: string ++#. Description ++#: ../templates:3001 ++msgid "" ++"Please enter a value in seconds corresponding to the interval between two " ++"checks. To disable this feature, enter 0." ++msgstr "2つのチェックの間のインターバルに相当する秒数を入力してください。この機能を無効にするには、0 と入力してください。" ++ ++#. Type: boolean ++#. Description ++#: ../templates:4001 ++msgid "Should the hddtemp daemon be started at boot?" ++msgstr "起動時に hddtemp デーモンを開始しますか?" ++ ++#. Type: boolean ++#. Description ++#: ../templates:4001 ++msgid "" ++"The hddtemp program can be run as a daemon, listening on port 7634 for " ++"incoming connections. It is used by some software such as gkrellm to get the " ++"temperature of hard drives." ++msgstr "hddtemp プログラムは、入力接続のためのポート 7634 をリスンするデーモンとして実行できます。ハードドライブの温度を得るために、gkrellm のようないくつかのソフトウェアによって使われます。" ++ ++#. Type: boolean ++#. Description ++#: ../templates:4001 ++msgid "" ++"You have the option of starting the hddtemp daemon automatically on system " ++"boot. If in doubt, it is suggested to not start it automatically on boot." ++msgstr "コンピュータの起動時に hddtemp デーモンを自動的に開始する選択肢です。疑わしいのであれば、起動時に自動的には開始しないことを提案します。" ++ ++#. Type: string ++#. Description ++#: ../templates:5001 ++msgid "Interface to listen on:" ++msgstr "リスンするインターフェイス:" ++ ++#. Type: string ++#. Description ++#: ../templates:5001 ++msgid "" ++"The hddtemp program can listen for incoming connections on a specific " ++"interface, or on all interfaces." ++msgstr "hddtemp プログラムは、特定のインターフェイスまたはすべてのインターフェイスの入力接続をリスンできます。" ++ ++#. Type: string ++#. Description ++#: ../templates:5001 ++msgid "" ++"To listen on a specific interface, enter the IP address of that interface " ++"(choosing 127.0.0.1 will accept local connections only). To listen on all " ++"interfaces, enter 0.0.0.0." ++msgstr "特定のインターフェイスをリスンするには、インターフェイスの IP アドレスを入力してください (127.0.0.1 を選ぶと、ローカルの接続のみを許可するようになります)。すべてのインターフェイスをリスンするには、0.0.0.0 と入力してください。" ++ ++#. Type: string ++#. Description ++#: ../templates:6001 ++msgid "Port to listen on:" ++msgstr "リスンするポート:" ++ ++#. Type: string ++#. Description ++#: ../templates:6001 ++msgid "" ++"By default, hddtemp listens for incoming connections on port 7634. This can " ++"be changed for another port number." ++msgstr "デフォルトでは、hddtemp はポート 7634 で入力接続をリスンします。これは別のポート番号に変更できます。" +--- hddtemp-0.3-beta15.orig/debian/po/fi.po ++++ hddtemp-0.3-beta15/debian/po/fi.po +@@ -0,0 +1,151 @@ ++msgid "" ++msgstr "" ++"Project-Id-Version: hddtemp\n" ++"Report-Msgid-Bugs-To: hddtemp@packages.debian.org\n" ++"POT-Creation-Date: 2008-01-25 22:35+0100\n" ++"PO-Revision-Date: 2008-02-04 12:18+0200\n" ++"Last-Translator: Esko Arajärvi \n" ++"Language-Team: Finnish \n" ++"MIME-Version: 1.0\n" ++"Content-Type: text/plain; charset=UTF-8\n" ++"Content-Transfer-Encoding: 8bit\n" ++"X-Poedit-Language: Finnish\n" ++"X-Poedit-Country: FINLAND\n" ++ ++#. Type: boolean ++#. Description ++#: ../templates:2001 ++msgid "Should /usr/sbin/hddtemp be installed SUID root?" ++msgstr "Tulisiko /usr/sbin/hddtemp asentaa asetuksella SUID root?" ++ ++#. Type: boolean ++#. Description ++#: ../templates:2001 ++msgid "" ++"You have the option of installing hddtemp with the SUID bit set, allowing it " ++"to be run (reporting hard drive temperatures) by regular users and not only " ++"the superuser." ++msgstr "" ++"Ohjelma hddtemp voidaan asentaa SUID-bitti asetettuna, jolloin pääkäyttäjien " ++"lisäksi myös tavalliset käyttäjät voivat ajaa ohjelman (saaden tietää " ++"kovalevyjen lämpötilat)." ++ ++#. Type: boolean ++#. Description ++#: ../templates:2001 ++msgid "" ++"This could potentially allow hddtemp to be used during an attack against the " ++"computer's security. If in doubt, do not choose this option." ++msgstr "" ++"Tämä saattaa mahdollistaa hddtempin käytön tietoturvahyökkäyksessä konetta " ++"vastaan. Jos olet epävarma, älä valitse tätä vaihtoehtoa." ++ ++#. Type: boolean ++#. Description ++#. Type: boolean ++#. Description ++#: ../templates:2001 ../templates:4001 ++msgid "" ++"This setting can be modified later by running 'dpkg-reconfigure hddtemp'." ++msgstr "" ++"Tätä asetusta voidaan myöhemmin muuttaa ajamalla komento ”dpkg-reconfigure " ++"hddtemp”." ++ ++#. Type: string ++#. Description ++#: ../templates:3001 ++msgid "Interval between hard drive temperature checks:" ++msgstr "Aikaväli kovalevyjen lämpötilojen tarkistusten välillä:" ++ ++#. Type: string ++#. Description ++#: ../templates:3001 ++msgid "" ++"The temperature of the hard drive(s) can be logged by hddtemp via the " ++"generic system logging interface." ++msgstr "" ++"Kovalevyjen lämpötilat voidaan kirjoittaa yleiseen järjestelmälokiin " ++"hddtempin toimesta." ++ ++#. Type: string ++#. Description ++#: ../templates:3001 ++msgid "" ++"Please enter a value in seconds corresponding to the interval between two " ++"checks. To disable this feature, enter 0." ++msgstr "" ++"Anna tarkistusten välinen aika sekunneissa. Syötä 0 poistaaksesi tämän " ++"ominaisuuden käytöstä." ++ ++#. Type: boolean ++#. Description ++#: ../templates:4001 ++msgid "Should the hddtemp daemon be started at boot?" ++msgstr "Tulisiko hddtemp-taustaohjelma käynnistää käynnistettäessä tietokone?" ++ ++#. Type: boolean ++#. Description ++#: ../templates:4001 ++msgid "" ++"The hddtemp program can be run as a daemon, listening on port 7634 for " ++"incoming connections. It is used by some software such as gkrellm to get the " ++"temperature of hard drives." ++msgstr "" ++"Ohjelma hddtemp voidaan ajaa taustaohjelmana, joka kuuntelee yhteydenottoja " ++"portissa 7634. Jotkin ohjelmat, kuten gkrellm, käyttävät tätä hakeakseen " ++"kovalevyjen lämpötilat." ++ ++#. Type: boolean ++#. Description ++#: ../templates:4001 ++msgid "" ++"You have the option of starting the hddtemp daemon automatically on system " ++"boot. If in doubt, it is suggested to not start it automatically on boot." ++msgstr "" ++"hddtemp-taustaohjelma voidaan käynnistää automaattisesti käynnistettäessä " ++"järjestelmä. Jos olet epävarma, ohjelmaa ei suositella käynnistettäväksi " ++"automaattisesti." ++ ++#. Type: string ++#. Description ++#: ../templates:5001 ++msgid "Interface to listen on:" ++msgstr "Kuunneltavat liitynnät:" ++ ++#. Type: string ++#. Description ++#: ../templates:5001 ++msgid "" ++"The hddtemp program can listen for incoming connections on a specific " ++"interface, or on all interfaces." ++msgstr "" ++"Ohjelma hddtemp voi kuunnella yhteydenottoja tietystä liitynnästä tai " ++"kaikista liitynnöistä." ++ ++#. Type: string ++#. Description ++#: ../templates:5001 ++msgid "" ++"To listen on a specific interface, enter the IP address of that interface " ++"(choosing 127.0.0.1 will accept local connections only). To listen on all " ++"interfaces, enter 0.0.0.0." ++msgstr "" ++"Voit määrittää tietyn liitynnän antamalla sen IP-osoitteen (asetus 127.0.0.1 " ++"hyväksyy vain paikalliset yhteydet). Kaikki liitynnät määritetään " ++"asetuksella 0.0.0.0." ++ ++#. Type: string ++#. Description ++#: ../templates:6001 ++msgid "Port to listen on:" ++msgstr "Kuunneltava portti:" ++ ++#. Type: string ++#. Description ++#: ../templates:6001 ++msgid "" ++"By default, hddtemp listens for incoming connections on port 7634. This can " ++"be changed for another port number." ++msgstr "" ++"Oletuksena hddtemp kuuntelee yhteydenottoja portissa 7634. Tämä portin " ++"numero voidaan vaihtaa." +--- hddtemp-0.3-beta15.orig/debian/po/templates.pot ++++ hddtemp-0.3-beta15/debian/po/templates.pot +@@ -0,0 +1,131 @@ ++# SOME DESCRIPTIVE TITLE. ++# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER ++# This file is distributed under the same license as the PACKAGE package. ++# FIRST AUTHOR , YEAR. ++# ++#, fuzzy ++msgid "" ++msgstr "" ++"Project-Id-Version: PACKAGE VERSION\n" ++"Report-Msgid-Bugs-To: hddtemp@packages.debian.org\n" ++"POT-Creation-Date: 2008-01-25 22:35+0100\n" ++"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" ++"Last-Translator: FULL NAME \n" ++"Language-Team: LANGUAGE \n" ++"MIME-Version: 1.0\n" ++"Content-Type: text/plain; charset=CHARSET\n" ++"Content-Transfer-Encoding: 8bit\n" ++ ++#. Type: boolean ++#. Description ++#: ../templates:2001 ++msgid "Should /usr/sbin/hddtemp be installed SUID root?" ++msgstr "" ++ ++#. Type: boolean ++#. Description ++#: ../templates:2001 ++msgid "" ++"You have the option of installing hddtemp with the SUID bit set, allowing it " ++"to be run (reporting hard drive temperatures) by regular users and not only " ++"the superuser." ++msgstr "" ++ ++#. Type: boolean ++#. Description ++#: ../templates:2001 ++msgid "" ++"This could potentially allow hddtemp to be used during an attack against the " ++"computer's security. If in doubt, do not choose this option." ++msgstr "" ++ ++#. Type: boolean ++#. Description ++#. Type: boolean ++#. Description ++#: ../templates:2001 ../templates:4001 ++msgid "" ++"This setting can be modified later by running 'dpkg-reconfigure hddtemp'." ++msgstr "" ++ ++#. Type: string ++#. Description ++#: ../templates:3001 ++msgid "Interval between hard drive temperature checks:" ++msgstr "" ++ ++#. Type: string ++#. Description ++#: ../templates:3001 ++msgid "" ++"The temperature of the hard drive(s) can be logged by hddtemp via the " ++"generic system logging interface." ++msgstr "" ++ ++#. Type: string ++#. Description ++#: ../templates:3001 ++msgid "" ++"Please enter a value in seconds corresponding to the interval between two " ++"checks. To disable this feature, enter 0." ++msgstr "" ++ ++#. Type: boolean ++#. Description ++#: ../templates:4001 ++msgid "Should the hddtemp daemon be started at boot?" ++msgstr "" ++ ++#. Type: boolean ++#. Description ++#: ../templates:4001 ++msgid "" ++"The hddtemp program can be run as a daemon, listening on port 7634 for " ++"incoming connections. It is used by some software such as gkrellm to get the " ++"temperature of hard drives." ++msgstr "" ++ ++#. Type: boolean ++#. Description ++#: ../templates:4001 ++msgid "" ++"You have the option of starting the hddtemp daemon automatically on system " ++"boot. If in doubt, it is suggested to not start it automatically on boot." ++msgstr "" ++ ++#. Type: string ++#. Description ++#: ../templates:5001 ++msgid "Interface to listen on:" ++msgstr "" ++ ++#. Type: string ++#. Description ++#: ../templates:5001 ++msgid "" ++"The hddtemp program can listen for incoming connections on a specific " ++"interface, or on all interfaces." ++msgstr "" ++ ++#. Type: string ++#. Description ++#: ../templates:5001 ++msgid "" ++"To listen on a specific interface, enter the IP address of that interface " ++"(choosing 127.0.0.1 will accept local connections only). To listen on all " ++"interfaces, enter 0.0.0.0." ++msgstr "" ++ ++#. Type: string ++#. Description ++#: ../templates:6001 ++msgid "Port to listen on:" ++msgstr "" ++ ++#. Type: string ++#. Description ++#: ../templates:6001 ++msgid "" ++"By default, hddtemp listens for incoming connections on port 7634. This can " ++"be changed for another port number." ++msgstr "" +--- hddtemp-0.3-beta15.orig/debian/po/es.po ++++ hddtemp-0.3-beta15/debian/po/es.po +@@ -0,0 +1,172 @@ ++# hddtemp debconf translation to spanish ++# Copyright (C) 2003, 2006, 2008 Software in the Public Interest ++# This file is distributed under the same license as the hddtemp package. ++# ++# Changes: ++# - Initial translation ++# Carlos Valdivia Yagüe , 2003 ++# - Revisions: ++# Carlos Valdivia Yagüe , 2006, 2008 ++# ++# Translators, if you are not familiar with the PO format, gettext ++# documentation is worth reading, especially sections dedicated to ++# this format, e.g. by running: ++# info -n '(gettext)PO Files' ++# info -n '(gettext)Header Entry' ++# ++# Some information specific to po-debconf are available at ++# /usr/share/doc/po-debconf/README-trans ++# or http://www.debian.org/intl/l10n/po-debconf/README-trans ++# ++# Developers do not need to manually edit POT or PO files. ++# ++msgid "" ++msgstr "" ++"Project-Id-Version: hddtemp 0.3-beta15-39:\n" ++"Report-Msgid-Bugs-To: hddtemp@packages.debian.org\n" ++"POT-Creation-Date: 2008-01-25 22:35+0100\n" ++"PO-Revision-Date: 2008-01-31 16:50+0100\n" ++"Last-Translator: Carlos Valdivia Yagüe \n" ++"Language-Team: Debian L10n Spanish \n" ++"MIME-Version: 1.0\n" ++"Content-Type: text/plain; charset=UTF-8\n" ++"Content-Transfer-Encoding: 8bit\n" ++ ++#. Type: boolean ++#. Description ++#: ../templates:2001 ++msgid "Should /usr/sbin/hddtemp be installed SUID root?" ++msgstr "¿Desea instalar «/usr/sbin/hddtemp» con el bit SUID root?" ++ ++#. Type: boolean ++#. Description ++#: ../templates:2001 ++msgid "" ++"You have the option of installing hddtemp with the SUID bit set, allowing it " ++"to be run (reporting hard drive temperatures) by regular users and not only " ++"the superuser." ++msgstr "" ++"Puede instalar hddtemp con el bit SUID activado, permitiendo así su " ++"ejecución (informando de la temperatura de los discos duros) por parte de " ++"usuarios normales y no sólo del superusuario." ++ ++#. Type: boolean ++#. Description ++#: ../templates:2001 ++msgid "" ++"This could potentially allow hddtemp to be used during an attack against the " ++"computer's security. If in doubt, do not choose this option." ++msgstr "" ++"Esto podría permitir que se utilizara hddtemp para comprometer la seguridad " ++"del sistema durante un ataque. Si está en duda, se recomienda que no active " ++"el bit SUID." ++ ++#. Type: boolean ++#. Description ++#. Type: boolean ++#. Description ++#: ../templates:2001 ../templates:4001 ++msgid "" ++"This setting can be modified later by running 'dpkg-reconfigure hddtemp'." ++msgstr "" ++"Esta elección puede modificarse posteriormente ejecutando «dpkg-reconfigure " ++"hddtemp»." ++ ++#. Type: string ++#. Description ++#: ../templates:3001 ++msgid "Interval between hard drive temperature checks:" ++msgstr "Período entre dos comprobaciones de temperatura:" ++ ++#. Type: string ++#. Description ++#: ../templates:3001 ++msgid "" ++"The temperature of the hard drive(s) can be logged by hddtemp via the " ++"generic system logging interface." ++msgstr "" ++"La temperatura del disco o discos duros puede ser registrada por hddtemp " ++"mediante la interfaz de registro genérica del sistema." ++ ++#. Type: string ++#. Description ++#: ../templates:3001 ++msgid "" ++"Please enter a value in seconds corresponding to the interval between two " ++"checks. To disable this feature, enter 0." ++msgstr "" ++"Introduzca un valor en segundos para el período entre dos comprobaciones " ++"sucesivas. Para desactivar esta característica, introduzca 0." ++ ++#. Type: boolean ++#. Description ++#: ../templates:4001 ++msgid "Should the hddtemp daemon be started at boot?" ++msgstr "¿Desea iniciar el demonio de hddtemp en el arranque del sistema?" ++ ++#. Type: boolean ++#. Description ++#: ../templates:4001 ++msgid "" ++"The hddtemp program can be run as a daemon, listening on port 7634 for " ++"incoming connections. It is used by some software such as gkrellm to get the " ++"temperature of hard drives." ++msgstr "" ++"hddtemp puede ejecutarse en modo demonio, escuchando conexiones entrantes en " ++"el puerto 7634. Algunos programas, como gkrellm, lo utilizan para obtener la " ++"temperatura de los discos duros." ++ ++#. Type: boolean ++#. Description ++#: ../templates:4001 ++msgid "" ++"You have the option of starting the hddtemp daemon automatically on system " ++"boot. If in doubt, it is suggested to not start it automatically on boot." ++msgstr "" ++"Puede iniciar el demonio de hddtemp automáticamente cada vez que arranque el " ++"sistema. Si está en duda, se recomienda que no lo inicie automáticamente al " ++"arrancar." ++ ++#. Type: string ++#. Description ++#: ../templates:5001 ++msgid "Interface to listen on:" ++msgstr "Interfaz en la que escuchar:" ++ ++#. Type: string ++#. Description ++#: ../templates:5001 ++msgid "" ++"The hddtemp program can listen for incoming connections on a specific " ++"interface, or on all interfaces." ++msgstr "" ++"hddtemp puede escuchar conexiones entrantes en una interfaz concreta, o bien " ++"en todas." ++ ++#. Type: string ++#. Description ++#: ../templates:5001 ++msgid "" ++"To listen on a specific interface, enter the IP address of that interface " ++"(choosing 127.0.0.1 will accept local connections only). To listen on all " ++"interfaces, enter 0.0.0.0." ++msgstr "" ++"Para escuchar en una interfaz determinada, introduzca la dirección IP de " ++"dicha interfaz (si elige 127.0.0.1 sólo se aceptarán conexiones locales). " ++"Para escuchar en todas las interfaces, introduzca 0.0.0.0." ++ ++#. Type: string ++#. Description ++#: ../templates:6001 ++msgid "Port to listen on:" ++msgstr "Puerto en el que escuchar:" ++ ++#. Type: string ++#. Description ++#: ../templates:6001 ++msgid "" ++"By default, hddtemp listens for incoming connections on port 7634. This can " ++"be changed for another port number." ++msgstr "" ++"De manera predeterminada hddtemp escucha en el puerto 7634, pero puede " ++"cambiarlo por otro." +--- hddtemp-0.3-beta15.orig/debian/po/sk.po ++++ hddtemp-0.3-beta15/debian/po/sk.po +@@ -0,0 +1,155 @@ ++# Slovak translations for hddtemp package ++# Slovenské preklady pre balík hddtemp. ++# Copyright (C) 2011 THE hddtemp'S COPYRIGHT HOLDER ++# This file is distributed under the same license as the hddtemp package. ++# Automatically generated, 2011. ++# Slavko , 2011. ++# ++msgid "" ++msgstr "" ++"Project-Id-Version: hddtemp 0.3-beta15-48\n" ++"Report-Msgid-Bugs-To: hddtemp@packages.debian.org\n" ++"POT-Creation-Date: 2008-01-25 22:35+0100\n" ++"PO-Revision-Date: 2011-08-30 16:30+0200\n" ++"Last-Translator: Slavko \n" ++"Language-Team: Slovak \n" ++"MIME-Version: 1.0\n" ++"Content-Type: text/plain; charset=UTF-8\n" ++"Content-Transfer-Encoding: 8bit\n" ++"Language: sk\n" ++"Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n" ++ ++#. Type: boolean ++#. Description ++#: ../templates:2001 ++msgid "Should /usr/sbin/hddtemp be installed SUID root?" ++msgstr "Má byť /usr/sbin/hddtemp nainštalovaný s SUID root?" ++ ++#. Type: boolean ++#. Description ++#: ../templates:2001 ++msgid "" ++"You have the option of installing hddtemp with the SUID bit set, allowing it " ++"to be run (reporting hard drive temperatures) by regular users and not only " ++"the superuser." ++msgstr "" ++"Môžete si zvoliť inštaláciu hddtemp s nastaveným bitom SUID, ktorý dovoľuje " ++"jeho spustenie (hlásenie stavu teploty pevných diskov) obyčajným " ++"používateľom a nie len super-používateľovi." ++ ++#. Type: boolean ++#. Description ++#: ../templates:2001 ++msgid "" ++"This could potentially allow hddtemp to be used during an attack against the " ++"computer's security. If in doubt, do not choose this option." ++msgstr "" ++"Toto môže potenciálne umožniť, aby bol hddtemp použitý počas útoku na " ++"bezpečnosť počítača. Ak si nie ste istý, nevyberajte túto možnosť." ++ ++#. Type: boolean ++#. Description ++#. Type: boolean ++#. Description ++#: ../templates:2001 ../templates:4001 ++msgid "" ++"This setting can be modified later by running 'dpkg-reconfigure hddtemp'." ++msgstr "Môžete to zmeniť aj neskôr, spustením „dpkg-reconfigure hddtemp”." ++ ++#. Type: string ++#. Description ++#: ../templates:3001 ++msgid "Interval between hard drive temperature checks:" ++msgstr "Interval medzi kontrolami teploty pevného disku:" ++ ++#. Type: string ++#. Description ++#: ../templates:3001 ++msgid "" ++"The temperature of the hard drive(s) can be logged by hddtemp via the " ++"generic system logging interface." ++msgstr "" ++"Teplota pevného disko(ov) môže hddtemp zaznamenávať pomocou spoločného " ++"rozhrania systémových záznamov." ++ ++#. Type: string ++#. Description ++#: ../templates:3001 ++msgid "" ++"Please enter a value in seconds corresponding to the interval between two " ++"checks. To disable this feature, enter 0." ++msgstr "" ++"Prosím, zadajte hodnotu v sekundách, ktorá zodpovedá intervalu medzi dvomi " ++"meraniami. Na zakázanie tejto funkcie zadajte 0." ++ ++#. Type: boolean ++#. Description ++#: ../templates:4001 ++msgid "Should the hddtemp daemon be started at boot?" ++msgstr "Má byť démon hddtemp spustený pri zavedení systému?" ++ ++#. Type: boolean ++#. Description ++#: ../templates:4001 ++msgid "" ++"The hddtemp program can be run as a daemon, listening on port 7634 for " ++"incoming connections. It is used by some software such as gkrellm to get the " ++"temperature of hard drives." ++msgstr "" ++"Program hddtemp môže byť spustený ako démon, načúvajúci príchodzím spojeniam " ++"na porte 7634. Je to používané niektorými programami, napr. gkrellm, na " ++"získanie teploty pevných diskov." ++ ++#. Type: boolean ++#. Description ++#: ../templates:4001 ++msgid "" ++"You have the option of starting the hddtemp daemon automatically on system " ++"boot. If in doubt, it is suggested to not start it automatically on boot." ++msgstr "" ++"Môžete si zvoliť automatické spúšťanie démona hddtemp pri zavedení systému. " ++"Ak si nie ste istý, odporúčame nespúšťať ho automaticky pri azvedení." ++ ++#. Type: string ++#. Description ++#: ../templates:5001 ++msgid "Interface to listen on:" ++msgstr "Rozhranie, na ktorom načúvať:" ++ ++#. Type: string ++#. Description ++#: ../templates:5001 ++msgid "" ++"The hddtemp program can listen for incoming connections on a specific " ++"interface, or on all interfaces." ++msgstr "" ++"Program hddtemp môže očakávať príchodzie spojenia na zadanom rozhraní alebo " ++"na všetkých rozhraniach." ++ ++#. Type: string ++#. Description ++#: ../templates:5001 ++msgid "" ++"To listen on a specific interface, enter the IP address of that interface " ++"(choosing 127.0.0.1 will accept local connections only). To listen on all " ++"interfaces, enter 0.0.0.0." ++msgstr "" ++"Aby načúval na zadanom rozhraní, zadajte IP adresu daného rozhrania (zadaním " ++"127.0.0.1 budú prijímané len lokálne spojenia). Na načúvanie na všetkých " ++"rozhraniach, zadajte 0.0.0.0." ++ ++#. Type: string ++#. Description ++#: ../templates:6001 ++msgid "Port to listen on:" ++msgstr "Port, na ktorom načúvať:" ++ ++#. Type: string ++#. Description ++#: ../templates:6001 ++msgid "" ++"By default, hddtemp listens for incoming connections on port 7634. This can " ++"be changed for another port number." ++msgstr "" ++"Predvolene hddtemp očakáva príchodzie spojenia na porte 7634. Môžete to " ++"zmeniť na akékoľvek iné číslo portu." +--- hddtemp-0.3-beta15.orig/debian/po/POTFILES.in ++++ hddtemp-0.3-beta15/debian/po/POTFILES.in +@@ -0,0 +1 @@ ++[type: gettext/rfc822deb] templates +--- hddtemp-0.3-beta15.orig/debian/po/nl.po ++++ hddtemp-0.3-beta15/debian/po/nl.po +@@ -0,0 +1,159 @@ ++# Dutch translation of hddtemp debconf templates. ++# Copyright (C) 2006-2011 THE PACKAGE'S COPYRIGHT HOLDER ++# This file is distributed under the same license as the hddtemp package. ++# Kurt De Bree , 2006. ++# Jeroen Schot , 2011. ++# ++msgid "" ++msgstr "" ++"Project-Id-Version: hddtemp 3.3-beta15-46\n" ++"Report-Msgid-Bugs-To: hddtemp@packages.debian.org\n" ++"POT-Creation-Date: 2008-01-25 22:35+0100\n" ++"PO-Revision-Date: 2011-06-01 08:31+0200\n" ++"Last-Translator: Jeroen Schot \n" ++"Language-Team: Debian l10n Dutch \n" ++"Language: nl\n" ++"MIME-Version: 1.0\n" ++"Content-Type: text/plain; charset=UTF-8\n" ++"Content-Transfer-Encoding: 8bit\n" ++ ++#. Type: boolean ++#. Description ++#: ../templates:2001 ++msgid "Should /usr/sbin/hddtemp be installed SUID root?" ++msgstr "Wilt u /usr/sbin/hddtemp als SUID root installeren?" ++ ++#. Type: boolean ++#. Description ++#: ../templates:2001 ++msgid "" ++"You have the option of installing hddtemp with the SUID bit set, allowing it " ++"to be run (reporting hard drive temperatures) by regular users and not only " ++"the superuser." ++msgstr "" ++"U heeft de keuze om hddtemp te installeren met de SUID-bit ingesteld. Dit " ++"zorgt ervoor dat het kan worden uitgevoerd (en hardeschijf-temperatuur " ++"meldt) door gewone gebruikers en niet enkel de beheerder." ++ ++#. Type: boolean ++#. Description ++#: ../templates:2001 ++msgid "" ++"This could potentially allow hddtemp to be used during an attack against the " ++"computer's security. If in doubt, do not choose this option." ++msgstr "" ++"Hierdoor zou hddtemp mogelijk gebruikt kunnen worden bij aan aanval om de " ++"beveiling van de computer te omzeilen. Als u twijfelt, kies dan niet voor " ++"deze optie." ++ ++#. Type: boolean ++#. Description ++#. Type: boolean ++#. Description ++#: ../templates:2001 ../templates:4001 ++msgid "" ++"This setting can be modified later by running 'dpkg-reconfigure hddtemp'." ++msgstr "" ++"Deze instelling kan later worden gewijzigd door 'dpkg-reconfigure hddtemp' " ++"uit te voeren." ++ ++#. Type: string ++#. Description ++#: ../templates:3001 ++msgid "Interval between hard drive temperature checks:" ++msgstr "Interval tussen controles van de hardeschijf-temperatuur:" ++ ++#. Type: string ++#. Description ++#: ../templates:3001 ++msgid "" ++"The temperature of the hard drive(s) can be logged by hddtemp via the " ++"generic system logging interface." ++msgstr "" ++"De temperatuur van de harde schijven kan worden bijgehouden via de algemene " ++"systeemloginterface." ++ ++#. Type: string ++#. Description ++#: ../templates:3001 ++msgid "" ++"Please enter a value in seconds corresponding to the interval between two " ++"checks. To disable this feature, enter 0." ++msgstr "" ++"Geef een waarde (in seconden) overeenkomend met de interval tussen twee " ++"controles. '0' schakelt deze functie uit." ++ ++#. Type: boolean ++#. Description ++#: ../templates:4001 ++msgid "Should the hddtemp daemon be started at boot?" ++msgstr "" ++"Wilt u dat hddtemp-achtergronddienst wordt gestart bij de systeemstart?" ++ ++#. Type: boolean ++#. Description ++#: ../templates:4001 ++msgid "" ++"The hddtemp program can be run as a daemon, listening on port 7634 for " ++"incoming connections. It is used by some software such as gkrellm to get the " ++"temperature of hard drives." ++msgstr "" ++"Het hddtemp-programma kan worden uitgevoerd als achtergronddienst, " ++"luisterend naar inkomende verbindingen op poort 7634. Dit wordt gebruikt " ++"door sommige toepassingen zoals gkrellm om de temperatuur van de harde " ++"schijven op te halen." ++ ++#. Type: boolean ++#. Description ++#: ../templates:4001 ++msgid "" ++"You have the option of starting the hddtemp daemon automatically on system " ++"boot. If in doubt, it is suggested to not start it automatically on boot." ++msgstr "" ++"U heeft de optie om de hddtemp-achtergronddienst automatisch op te starten " ++"bij de systeemstart. Bij twijfel wordt aangeraden om de dienst niet " ++"automatisch op te starten." ++ ++#. Type: string ++#. Description ++#: ../templates:5001 ++msgid "Interface to listen on:" ++msgstr "De interface waarop hddtemp moet luisteren:" ++ ++#. Type: string ++#. Description ++#: ../templates:5001 ++msgid "" ++"The hddtemp program can listen for incoming connections on a specific " ++"interface, or on all interfaces." ++msgstr "" ++"Het hddtemp-programma kan naar inkomende verbindingen luisteren op één " ++"specifieke interface, of op alle interfaces." ++ ++#. Type: string ++#. Description ++#: ../templates:5001 ++msgid "" ++"To listen on a specific interface, enter the IP address of that interface " ++"(choosing 127.0.0.1 will accept local connections only). To listen on all " ++"interfaces, enter 0.0.0.0." ++msgstr "" ++"Om op één specifieke interface te luisteren, voer het IP-addres van deze " ++"interface in (als u 127.0.0.1 kiest zullen alleen lokale verbindingen worden " ++"geaccepeert). Om op alle interfaces te luisteren, voer 0.0.0.0. in." ++ ++#. Type: string ++#. Description ++#: ../templates:6001 ++msgid "Port to listen on:" ++msgstr "De poort waarop hddtemp moet luisteren:" ++ ++#. Type: string ++#. Description ++#: ../templates:6001 ++msgid "" ++"By default, hddtemp listens for incoming connections on port 7634. This can " ++"be changed for another port number." ++msgstr "" ++"Standaard luistert hddtemp naar inkomende verbindingen op poort 7634. Dit " ++"kan veranderd worden in een ander poortnummer." +--- hddtemp-0.3-beta15.orig/debian/po/nb.po ++++ hddtemp-0.3-beta15/debian/po/nb.po +@@ -0,0 +1,152 @@ ++# translation of hddtemp_nb.po to Norwegian Bokmål ++# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER ++# This file is distributed under the same license as the PACKAGE package. ++# ++# Bjørn Steensrud , 2008. ++msgid "" ++msgstr "" ++"Project-Id-Version: hddtemp_nb\n" ++"Report-Msgid-Bugs-To: hddtemp@packages.debian.org\n" ++"POT-Creation-Date: 2008-01-25 22:35+0100\n" ++"PO-Revision-Date: 2008-01-27 17:39+0100\n" ++"Last-Translator: Bjørn Steensrud \n" ++"Language-Team: Norwegian Bokmål \n" ++"MIME-Version: 1.0\n" ++"Content-Type: text/plain; charset=UTF-8\n" ++"Content-Transfer-Encoding: 8bit\n" ++"X-Generator: KBabel 1.11.4\n" ++ ++#. Type: boolean ++#. Description ++#: ../templates:2001 ++msgid "Should /usr/sbin/hddtemp be installed SUID root?" ++msgstr "Skal /usr/sbin/hddtemp installeres med SUID root?" ++ ++#. Type: boolean ++#. Description ++#: ../templates:2001 ++msgid "" ++"You have the option of installing hddtemp with the SUID bit set, allowing it " ++"to be run (reporting hard drive temperatures) by regular users and not only " ++"the superuser." ++msgstr "" ++"Du kan installere hddtemp med SUID-biten satt, slik at vanlige brukere og " ++"ikke bare superbrukeren kan kjøre det for å undersøke temperatur på " ++"harddisken(e)." ++ ++#. Type: boolean ++#. Description ++#: ../templates:2001 ++msgid "" ++"This could potentially allow hddtemp to be used during an attack against the " ++"computer's security. If in doubt, do not choose this option." ++msgstr "" ++"Dette kan kanskje tillate at hddtemp blir brukt i et angrep mot systemets " ++"sikkerhet. Er du i tvil, så ikke velg dette." ++ ++#. Type: boolean ++#. Description ++#. Type: boolean ++#. Description ++#: ../templates:2001 ../templates:4001 ++msgid "" ++"This setting can be modified later by running 'dpkg-reconfigure hddtemp'." ++msgstr "" ++"Denne innstillingen kan endres senere ved å kjøre «dpkg-reconfigure hddtemp»." ++ ++#. Type: string ++#. Description ++#: ../templates:3001 ++msgid "Interval between hard drive temperature checks:" ++msgstr "Intervall mellom sjekker på disktemperaturen:" ++ ++#. Type: string ++#. Description ++#: ../templates:3001 ++msgid "" ++"The temperature of the hard drive(s) can be logged by hddtemp via the " ++"generic system logging interface." ++msgstr "" ++"hddtemp kan logge disken(e)s temperatur via systemets eget log-grensesnitt." ++ ++#. Type: string ++#. Description ++#: ../templates:3001 ++msgid "" ++"Please enter a value in seconds corresponding to the interval between two " ++"checks. To disable this feature, enter 0." ++msgstr "" ++"Oppgi en verdi i sekunder som tilsvarer intervallet mellom to sjekker. Dette " ++"blir slått av hvis verdien er 0." ++ ++#. Type: boolean ++#. Description ++#: ../templates:4001 ++msgid "Should the hddtemp daemon be started at boot?" ++msgstr "Skal hddtemp-daemonen startes ved oppstart?" ++ ++#. Type: boolean ++#. Description ++#: ../templates:4001 ++msgid "" ++"The hddtemp program can be run as a daemon, listening on port 7634 for " ++"incoming connections. It is used by some software such as gkrellm to get the " ++"temperature of hard drives." ++msgstr "" ++"hddtemp-programmet kan kjøres som en daemon som lytter på port 7634. Dette " ++"brukes av noen programmer slik som gkrellm for å finne temperaturen på " ++"harddisker." ++ ++#. Type: boolean ++#. Description ++#: ../templates:4001 ++msgid "" ++"You have the option of starting the hddtemp daemon automatically on system " ++"boot. If in doubt, it is suggested to not start it automatically on boot." ++msgstr "" ++"Du kan velge å starte hddtemp-daemonen automatisk når systemet starter opp. " ++"Er du i tvil, foreslår vi at den ikke startes automatisk ved oppstart." ++ ++#. Type: string ++#. Description ++#: ../templates:5001 ++msgid "Interface to listen on:" ++msgstr "Grensesnitt det skal lyttes på:" ++ ++#. Type: string ++#. Description ++#: ../templates:5001 ++msgid "" ++"The hddtemp program can listen for incoming connections on a specific " ++"interface, or on all interfaces." ++msgstr "" ++"hddtemp-programmet kan lytte etter inkommende tilkoblinger på et bestemt " ++"grensesnitt, eller alle grensesnitt." ++ ++#. Type: string ++#. Description ++#: ../templates:5001 ++msgid "" ++"To listen on a specific interface, enter the IP address of that interface " ++"(choosing 127.0.0.1 will accept local connections only). To listen on all " ++"interfaces, enter 0.0.0.0." ++msgstr "" ++"Oppgi grensesnittets IP-adresse for å lytte på det grensesnittet. (127.0.0.1 " ++"godtar bare lokale tilkoblinger). Oppgi 0.0.0.0 for å lytte på alle " ++"grensesnitt." ++ ++#. Type: string ++#. Description ++#: ../templates:6001 ++msgid "Port to listen on:" ++msgstr "Port å lytte på:" ++ ++#. Type: string ++#. Description ++#: ../templates:6001 ++msgid "" ++"By default, hddtemp listens for incoming connections on port 7634. This can " ++"be changed for another port number." ++msgstr "" ++"Standardporten der hddtemp lytter etter innkommende tilkoblinger er port " ++"7634. Dette kan endres til et annet portnummer." +--- hddtemp-0.3-beta15.orig/doc/hddtemp.8 ++++ hddtemp-0.3-beta15/doc/hddtemp.8 +@@ -58,6 +58,10 @@ + .B \-f, \-\-file=\fIfile\fI + Specify the database file to use. + .TP ++.B \-F, \-\-foreground ++Don't fork into the background even in daemon mode. This is useful ++when running under a process supervisor. ++.TP + .B \-l, \-\-listen=\fIaddr\fR + Listen on a specific address. \fIaddr\fR is a string containing a + host name or a numeric host address string. The numeric host address +@@ -80,6 +84,9 @@ + .B \-q, \-\-quiet + Don't check if the drive is supported. + .TP ++.B \-u, \-\-unit=\fIC|F\fR ++Force output temperature either in Celsius or Fahrenheit. ++.TP + .B \-v, \-\-version + Display hddtemp version number. + .TP +@@ -96,7 +103,7 @@ + .SH "DRIVE DATABASE" + If you know your drive has a temperature sensor but it is being + reported unsupported, tell me which model and which manufacturer it +-is, and/or just add a new entry in /usr/share/misc/hddtemp.db. Each ++is, and/or just add a new entry in /etc/hddtemp.db. Each + line of hddtemp.db is either a comment, a blank line or a line + containing: + .TP +@@ -112,7 +119,7 @@ + Feedback is welcome (see the REPORT section below). + + .SH "TCP/IP DAEMON MODE" +-Exemple of type forcing: ++Example of type forcing: + .PP + # hddtemp SATA:/dev/sda PATA:/dev/hda + .PP +@@ -120,7 +127,7 @@ + .B hddtemp + in daemon mode, start it like this: + .PP +-# hddtemp -d /dev/hd[abcd] ++# hddtemp \-d /dev/hd[abcd] + .PP + .PP + and use +@@ -165,8 +172,8 @@ + investigation they do not. But fields 194 (which is the standard + field for temperature) and 231 are good candidates. + .PP +-Then, you can send me a report with outputs from `hddtemp --debug ...', +-`smartctl' or `hdparm -i ...', and/or add an entry in hddtemp.db ++Then, you can send me a report with outputs from `hddtemp \-\-debug ...', ++`smartctl' or `hdparm \-i ...', and/or add an entry in hddtemp.db + yourself. + + .SH "BUGS" +@@ -183,5 +190,5 @@ + .PP + Emmanuel Varagnat (hddtemp@guzu.net). + .PP +-This manual page was originaly written by Aurelien Jarno , ++This manual page was originally written by Aurelien Jarno , + for the Debian GNU/Linux system (but may be used by others). +--- hddtemp-0.3-beta15.orig/po/fr.po ++++ hddtemp-0.3-beta15/po/fr.po +@@ -7,9 +7,9 @@ + msgid "" + msgstr "" + "Project-Id-Version: fr\n" +-"Report-Msgid-Bugs-To: hddtemp@guzu.net\n" +-"POT-Creation-Date: 2005-02-25 22:43+0100\n" +-"PO-Revision-Date: 2003-06-03 00:58GMT+1\n" ++"Report-Msgid-Bugs-To: \n" ++"POT-Creation-Date: 2006-06-29 16:24+0200\n" ++"PO-Revision-Date: 2011-08-30 16:38+0200\n" + "Last-Translator: Aurelien Jarno \n" + "Language-Team: FRANCAIS \n" + "MIME-Version: 1.0\n" +@@ -17,23 +17,7 @@ + "Content-Transfer-Encoding: 8bit\n" + "X-Generator: KBabel 1.0.1\n" + +-#: src/hddtemp.c:112 +-#, c-format +-msgid "" +-"\n" +-"Regexp%s| Value | Description\n" +-"------%s---------------------\n" +-msgstr "" +-"\n" +-"Regexp%s| Valeur | Description\n" +-"------%s----------------------\n" +- +-#: src/hddtemp.c:118 +-#, c-format +-msgid "%s%s| %5d | %s\n" +-msgstr "%s%s| %5d | %s\n" +- +-#: src/hddtemp.c:161 ++#: src/hddtemp.c:156 + #, c-format + msgid "" + "\n" +@@ -46,7 +30,7 @@ + "Modle: %s\n" + "\n" + +-#: src/hddtemp.c:188 ++#: src/hddtemp.c:189 + #, c-format + msgid "" + "WARNING: Drive %s doesn't seem to have a temperature sensor.\n" +@@ -60,75 +44,60 @@ + "net).\n" + "ATTENTION : Voir les options --help, --debug et --drivebase.\n" + +-#: src/hddtemp.c:192 ++#: src/hddtemp.c:197 + #, c-format + msgid "%s: %s: no sensor\n" + msgstr "%s: %s : pas de capteur\n" + +-#: src/hddtemp.c:197 +-#, c-format +-msgid "" +-"WARNING: Drive %s doesn't appear in the database of supported drives\n" +-"WARNING: But using a common value, it reports something.\n" +-"WARNING: Note that the temperature shown could be wrong.\n" +-"WARNING: See --help, --debug and --drivebase options.\n" +-"WARNING: And don't forget you can add your drive to hddtemp.db\n" +-msgstr "" +-"ATTENTION : Le lecteur %s n'apparait pas dans la base de donnes des " +-"lecteurs supports\n" +-"ATTENTION : Mais en utilisant une valeur courante, il renvoie quelque " +-"chose.\n" +-"ATTENTION : Notez que la temprature renvoye peut tre errone.\n" +-"ATTENTION : Voir les options --help, --debug et --drivebase.\n" +-"ATTENTION : Et n'oubliez pas d'ajouter votre lecteur au fichier hddtemp.db\n" +- +-#: src/hddtemp.c:202 ++#: src/hddtemp.c:211 + #, c-format + msgid "%s: %s: %d%sC or %sF\n" + msgstr "%s: %s : %d%sC ou %sF\n" + +-#: src/hddtemp.c:214 ++#: src/hddtemp.c:235 + #, c-format + msgid "%s: %s: drive is sleeping\n" + msgstr "%s: %s : le lecteur est en veille\n" + +-#: src/hddtemp.c:217 ++#: src/hddtemp.c:242 + #, c-format +-msgid "%s: %s: known drive, but it doesn't have a temperature sensor.\n" ++msgid "%s: %s: drive supported, but it doesn't have a temperature sensor.\n" + msgstr "" + "%s: %s: lecteur connu, mais il ne possde pas de capteur de temprature.\n" + +-#: src/hddtemp.c:220 ++#: src/hddtemp.c:246 + #, c-format + msgid "ERROR: %s: %s: unknown returned status\n" + msgstr "ERREUR : %s : %s : status inconnu\n" + +-#: src/hddtemp.c:235 ++#: src/hddtemp.c:261 + #, c-format + msgid "" + "\n" + "If one of the field value seems to match the temperature, be sure to read\n" +-"the hddtemp man page before sending me a report (section REPORT). Thanks.\n" ++"the hddtemp man page before sending a report (section REPORT). Thanks.\n" + msgstr "" + +-#: src/hddtemp.c:308 ++#: src/hddtemp.c:338 + #, c-format + msgid "ERROR: invalid separator.\n" + msgstr "ERREUR : sparateur invalide.\n" + +-#: src/hddtemp.c:319 ++#: src/hddtemp.c:349 + #, c-format + msgid "ERROR: invalid port number.\n" + msgstr "ERREUR : numro de port invalide.\n" + +-#: src/hddtemp.c:329 +-#, fuzzy, c-format ++#: src/hddtemp.c:371 ++#, c-format + msgid "" +-" Usage: hddtemp [OPTIONS] DISK1 [DISK2]...\n" ++" Usage: hddtemp [OPTIONS] [TYPE:]DISK1 [[TYPE:]DISK2]...\n" + "\n" + " hddtemp displays the temperature of drives supplied in argument.\n" + " Drives must support S.M.A.R.T.\n" + "\n" ++" TYPE could be SATA, PATA or SCSI. If omitted hddtemp will try to guess.\n" ++"\n" + " -b --drivebase : display database file content that allow hddtemp to\n" + " recognize supported drives.\n" + " -D --debug : display various S.M.A.R.T. fields and their values.\n" +@@ -138,6 +107,7 @@ + " -d --daemon : run hddtemp in TCP/IP daemon mode (port %d by " + "default.)\n" + " -f --file=FILE : specify database file to use.\n" ++" -F --foreground : don't daemonize, stay in foreground.\n" + " -l --listen=addr : listen on a specific interface (in TCP/IP daemon " + "mode).\n" + " -n --numeric : print only the temperature.\n" +@@ -145,6 +115,8 @@ + " -s --separator=C : separator to use between fields (in TCP/IP daemon " + "mode).\n" + " -S --syslog=s : log temperature to syslog every s seconds.\n" ++" -u --unit=[C|F] : force output temperature either in Celsius or " ++"Fahrenheit.\n" + " -q --quiet : do not check if the drive is supported.\n" + " -v --version : display hddtemp version number.\n" + " -w --wake-up : wake-up the drive if need.\n" +@@ -153,11 +125,14 @@ + "\n" + "Report bugs or new drives to .\n" + msgstr "" +-" Utilisation: hddtemp [OPTIONS] DISQUE1 [DISQUE2]...\n" ++" Utilisation: hddtemp [OPTIONS] [TYPE:]DISQUE1 [[TYPE:]DISQUE2]...\n" + "\n" + " hddtemp affiche la temprature des lecteurs passs en argument.\n" + " Les lecteurs doivent avoir le support S.M.A.R.T.\n" + "\n" ++" TYPE peut tre SATA, PATA ou SCSI. Si le type est omis, hddtemp essaiera\n" ++" de le deviner.\n" ++"\n" + " -b --drivebase : affiche le contenu du fichier de base de donne " + "qui \n" + " permet hddtemp de reconnatre les lecteurs " +@@ -172,6 +147,7 @@ + "dfaut).\n" + " -f --file=FILE : specifie le fichier utiliser comme base de " + "donnes.\n" ++" -F --foreground : ne pas dmoniser, rester au premier plan.\n" + " -l --listen=addr : coute sur une interface spcifique (en mode dmon " + "TCP/IP).\n" + " -n --numeric : affiche seulement la temprature.\n" +@@ -180,6 +156,8 @@ + "dmon TCP/IP).\n" + " -S --syslog=s : enregistre la temprature dans syslog tous les s " + "secondes.\n" ++" -u --unit=[C|F] : affiche la temprature en degrs Celsius ou " ++"Fahrenheit.\n" + " -q --quiet : ne vrifie pas si le lecteur est support.\n" + " -v --version : affiche la version de hddtemp.\n" + " -w --wake-up : rveiller le lecteur si ncessaire.\n" +@@ -188,62 +166,95 @@ + "\n" + "Report bugs or new drives to .\n" + +-#: src/hddtemp.c:522 ++#: src/hddtemp.c:402 + #, c-format + msgid "hddtemp version %s\n" + msgstr "hddtemp version %s\n" + +-#: src/hddtemp.c:547 ++#: src/hddtemp.c:418 + #, c-format + msgid "ERROR: invalid interval.\n" + msgstr "ERREUR : intervalle invalide.\n" + +-#: src/hddtemp.c:547 ++#: src/hddtemp.c:438 ++#, c-format + msgid "Too few arguments: you must specify one drive, at least.\n" + msgstr "Trop peu d'arguments : vous devez spcifier au moins un lecteur.\n" + +-#: src/hddtemp.c:557 ++#: src/hddtemp.c:448 ++#, c-format + msgid "ERROR: can't use --debug and --daemon or --syslog options together.\n" + msgstr "" + "ERREUR: impossible d'utiliser les options --debug et --daemon ou --syslog en " + "mme temps.\n" + +-#: src/hddtemp.c:583 ++#: src/hddtemp.c:505 + #, c-format + msgid "ERROR: %s: can't determine bus type (or this bus type is unknown)\n" + msgstr "" + "ERREUR: %s: impossible de dterminer le type de bus (ou ce type de bus est " + "inconnu)\n" + +-#: src/ata.c:66 src/scsi.c:68 ++#: src/ata.c:66 src/scsi.c:64 + msgid "unknown" + msgstr "inconnu" + +-#: src/ata.c:98 ++#: src/ata.c:85 src/ata.c:104 src/scsi.c:91 + #, c-format +-msgid "field(%d)\t = %d\n" +-msgstr "champ(%d)\t = %d\n" +- +-#: src/ata.c:167 + msgid "S.M.A.R.T. not available" + msgstr "S.M.A.R.T. non disponible" + +-#: src/db.c:180 ++#: src/db.c:115 ++#, c-format ++msgid "" ++"\n" ++"Regexp%s| Value | Description\n" ++"------%s---------------------\n" ++msgstr "" ++"\n" ++"Regexp%s| Valeur | Description\n" ++"------%s----------------------\n" ++ ++#: src/db.c:121 ++#, c-format ++msgid "%s%s| %5d | %s\n" ++msgstr "%s%s| %5d | %s\n" ++ ++#: src/db.c:236 + #, c-format + msgid "hddtemp: can't open %1$s: %2$s\n" + msgstr "hddtemp: ne peut ouvrir %1$s: %2$s\n" + +-#: src/db.c:194 ++#: src/db.c:250 + #, c-format + msgid "ERROR: syntax error at line %1$d in %2$s\n" + msgstr "ERREUR: erreur de syntaxe la ligne %1$d: %2$s\n" + +-#: src/db.c:201 ++#: src/db.c:257 + #, c-format + msgid " ERROR: line exceed %1$d characters in %2$s.\n" + msgstr " ERREUR: ligne excdant %1$d caractres dans %2$s.\n" + +-#: src/scsi.c:112 src/scsi.c:130 ++#: src/scsi.c:111 src/scsi.c:129 + #, c-format + msgid "log sense failed : %s" + msgstr "echec de 'log sense' : %s " ++ ++#~ msgid "" ++#~ "WARNING: Drive %s doesn't appear in the database of supported drives\n" ++#~ "WARNING: But using a common value, it reports something.\n" ++#~ "WARNING: Note that the temperature shown could be wrong.\n" ++#~ "WARNING: See --help, --debug and --drivebase options.\n" ++#~ "WARNING: And don't forget you can add your drive to hddtemp.db\n" ++#~ msgstr "" ++#~ "ATTENTION : Le lecteur %s n'apparait pas dans la base de donnes des " ++#~ "lecteurs supports\n" ++#~ "ATTENTION : Mais en utilisant une valeur courante, il renvoie quelque " ++#~ "chose.\n" ++#~ "ATTENTION : Notez que la temprature renvoye peut tre errone.\n" ++#~ "ATTENTION : Voir les options --help, --debug et --drivebase.\n" ++#~ "ATTENTION : Et n'oubliez pas d'ajouter votre lecteur au fichier hddtemp." ++#~ "db\n" ++ ++#~ msgid "field(%d)\t = %d\n" ++#~ msgstr "champ(%d)\t = %d\n" +--- hddtemp-0.3-beta15.orig/po/ru.po ++++ hddtemp-0.3-beta15/po/ru.po +@@ -6,8 +6,8 @@ + msgid "" + msgstr "" + "Project-Id-Version: hddtemp 0.3-beta3\n" +-"Report-Msgid-Bugs-To: hddtemp@guzu.net\n" +-"POT-Creation-Date: 2005-02-25 22:43+0100\n" ++"Report-Msgid-Bugs-To: \n" ++"POT-Creation-Date: 2006-06-29 16:24+0200\n" + "PO-Revision-Date: 2003-03-08 16:42+0300\n" + "Last-Translator: Michael Shigorin \n" + "Language-Team: Russian \n" +@@ -15,23 +15,7 @@ + "Content-Type: text/plain; charset=koi8-r\n" + "Content-Transfer-Encoding: 8bit\n" + +-#: src/hddtemp.c:112 +-#, c-format +-msgid "" +-"\n" +-"Regexp%s| Value | Description\n" +-"------%s---------------------\n" +-msgstr "" +-"\n" +-"%s| . | \n" +-"------%s---------------------\n" +- +-#: src/hddtemp.c:118 +-#, c-format +-msgid "%s%s| %5d | %s\n" +-msgstr "" +- +-#: src/hddtemp.c:161 ++#: src/hddtemp.c:156 + #, c-format + msgid "" + "\n" +@@ -40,7 +24,7 @@ + "\n" + msgstr "" + +-#: src/hddtemp.c:188 ++#: src/hddtemp.c:189 + #, c-format + msgid "" + "WARNING: Drive %s doesn't seem to have a temperature sensor.\n" +@@ -53,72 +37,59 @@ + ": , , hddtemp@guzu.net\n" + ": (. --help, --debug --drivebase).\n" + +-#: src/hddtemp.c:192 ++#: src/hddtemp.c:197 + #, c-format + msgid "%s: %s: no sensor\n" + msgstr "%s: %s: \n" + +-#: src/hddtemp.c:197 +-#, c-format +-msgid "" +-"WARNING: Drive %s doesn't appear in the database of supported drives\n" +-"WARNING: But using a common value, it reports something.\n" +-"WARNING: Note that the temperature shown could be wrong.\n" +-"WARNING: See --help, --debug and --drivebase options.\n" +-"WARNING: And don't forget you can add your drive to hddtemp.db\n" +-msgstr "" +-": %s .\n" +-": - .\n" +-": , .\n" +-": . --help, --debug --drivebase.\n" +-": , hddtemp.db\n" +- +-#: src/hddtemp.c:202 ++#: src/hddtemp.c:211 + #, c-format + msgid "%s: %s: %d%sC or %sF\n" + msgstr "%s: %s: %d%sC %sF\n" + +-#: src/hddtemp.c:214 ++#: src/hddtemp.c:235 + #, c-format + msgid "%s: %s: drive is sleeping\n" + msgstr "%s: %s: \n" + +-#: src/hddtemp.c:217 +-#, c-format +-msgid "%s: %s: known drive, but it doesn't have a temperature sensor.\n" ++#: src/hddtemp.c:242 ++#, fuzzy, c-format ++msgid "%s: %s: drive supported, but it doesn't have a temperature sensor.\n" + msgstr "%s: %s: , .\n" + +-#: src/hddtemp.c:220 ++#: src/hddtemp.c:246 + #, c-format + msgid "ERROR: %s: %s: unknown returned status\n" + msgstr ": %s: %s: \n" + +-#: src/hddtemp.c:235 ++#: src/hddtemp.c:261 + #, c-format + msgid "" + "\n" + "If one of the field value seems to match the temperature, be sure to read\n" +-"the hddtemp man page before sending me a report (section REPORT). Thanks.\n" ++"the hddtemp man page before sending a report (section REPORT). Thanks.\n" + msgstr "" + +-#: src/hddtemp.c:308 ++#: src/hddtemp.c:338 + #, c-format + msgid "ERROR: invalid separator.\n" + msgstr ": .\n" + +-#: src/hddtemp.c:319 ++#: src/hddtemp.c:349 + #, c-format + msgid "ERROR: invalid port number.\n" + msgstr ": .\n" + +-#: src/hddtemp.c:329 ++#: src/hddtemp.c:371 + #, fuzzy, c-format + msgid "" +-" Usage: hddtemp [OPTIONS] DISK1 [DISK2]...\n" ++" Usage: hddtemp [OPTIONS] [TYPE:]DISK1 [[TYPE:]DISK2]...\n" + "\n" + " hddtemp displays the temperature of drives supplied in argument.\n" + " Drives must support S.M.A.R.T.\n" + "\n" ++" TYPE could be SATA, PATA or SCSI. If omitted hddtemp will try to guess.\n" ++"\n" + " -b --drivebase : display database file content that allow hddtemp to\n" + " recognize supported drives.\n" + " -D --debug : display various S.M.A.R.T. fields and their values.\n" +@@ -128,6 +99,7 @@ + " -d --daemon : run hddtemp in TCP/IP daemon mode (port %d by " + "default.)\n" + " -f --file=FILE : specify database file to use.\n" ++" -F --foreground : don't daemonize, stay in foreground.\n" + " -l --listen=addr : listen on a specific interface (in TCP/IP daemon " + "mode).\n" + " -n --numeric : print only the temperature.\n" +@@ -135,6 +107,8 @@ + " -s --separator=C : separator to use between fields (in TCP/IP daemon " + "mode).\n" + " -S --syslog=s : log temperature to syslog every s seconds.\n" ++" -u --unit=[C|F] : force output temperature either in Celsius or " ++"Fahrenheit.\n" + " -q --quiet : do not check if the drive is supported.\n" + " -v --version : display hddtemp version number.\n" + " -w --wake-up : wake-up the drive if need.\n" +@@ -168,59 +142,90 @@ + "\n" + " .\n" + +-#: src/hddtemp.c:522 ++#: src/hddtemp.c:402 + #, c-format + msgid "hddtemp version %s\n" + msgstr " hddtemp: %s\n" + +-#: src/hddtemp.c:547 ++#: src/hddtemp.c:418 + #, fuzzy, c-format + msgid "ERROR: invalid interval.\n" + msgstr ": .\n" + +-#: src/hddtemp.c:547 ++#: src/hddtemp.c:438 ++#, c-format + msgid "Too few arguments: you must specify one drive, at least.\n" + msgstr "" + +-#: src/hddtemp.c:557 +-#, fuzzy ++#: src/hddtemp.c:448 ++#, fuzzy, c-format + msgid "ERROR: can't use --debug and --daemon or --syslog options together.\n" + msgstr ": --debug --daemon .\n" + +-#: src/hddtemp.c:583 ++#: src/hddtemp.c:505 + #, c-format + msgid "ERROR: %s: can't determine bus type (or this bus type is unknown)\n" + msgstr ": %s: \n" + +-#: src/ata.c:66 src/scsi.c:68 ++#: src/ata.c:66 src/scsi.c:64 + msgid "unknown" + msgstr "." + +-#: src/ata.c:98 ++#: src/ata.c:85 src/ata.c:104 src/scsi.c:91 + #, c-format +-msgid "field(%d)\t = %d\n" +-msgstr "(%d)\t = %d\n" +- +-#: src/ata.c:167 + msgid "S.M.A.R.T. not available" + msgstr "S.M.A.R.T. " + +-#: src/db.c:180 ++#: src/db.c:115 ++#, c-format ++msgid "" ++"\n" ++"Regexp%s| Value | Description\n" ++"------%s---------------------\n" ++msgstr "" ++"\n" ++"%s| . | \n" ++"------%s---------------------\n" ++ ++#: src/db.c:121 ++#, c-format ++msgid "%s%s| %5d | %s\n" ++msgstr "" ++ ++#: src/db.c:236 + #, c-format + msgid "hddtemp: can't open %1$s: %2$s\n" + msgstr "hddtemp: %1$s: %2$s\n" + +-#: src/db.c:194 ++#: src/db.c:250 + #, c-format + msgid "ERROR: syntax error at line %1$d in %2$s\n" + msgstr " %1$d %2$s\n" + +-#: src/db.c:201 ++#: src/db.c:257 + #, c-format + msgid " ERROR: line exceed %1$d characters in %2$s.\n" + msgstr ": %1$d %2$s.\n" + +-#: src/scsi.c:112 src/scsi.c:130 ++#: src/scsi.c:111 src/scsi.c:129 + #, c-format + msgid "log sense failed : %s" + msgstr "" ++ ++#~ msgid "" ++#~ "WARNING: Drive %s doesn't appear in the database of supported drives\n" ++#~ "WARNING: But using a common value, it reports something.\n" ++#~ "WARNING: Note that the temperature shown could be wrong.\n" ++#~ "WARNING: See --help, --debug and --drivebase options.\n" ++#~ "WARNING: And don't forget you can add your drive to hddtemp.db\n" ++#~ msgstr "" ++#~ ": %s .\n" ++#~ ": - " ++#~ ".\n" ++#~ ": , " ++#~ ".\n" ++#~ ": . --help, --debug --drivebase.\n" ++#~ ": , hddtemp.db\n" ++ ++#~ msgid "field(%d)\t = %d\n" ++#~ msgstr "(%d)\t = %d\n" +--- hddtemp-0.3-beta15.orig/po/sv.po ++++ hddtemp-0.3-beta15/po/sv.po +@@ -6,8 +6,8 @@ + msgid "" + msgstr "" + "Project-Id-Version: hddtemp 0.3-beta14-4\n" +-"Report-Msgid-Bugs-To: hddtemp@guzu.net\n" +-"POT-Creation-Date: 2005-02-25 22:43+0100\n" ++"Report-Msgid-Bugs-To: \n" ++"POT-Creation-Date: 2006-06-29 16:24+0200\n" + "PO-Revision-Date: 2005-11-02 19:03+0100\n" + "Last-Translator: Daniel Nylander \n" + "Language-Team: Swedish \n" +@@ -17,23 +17,7 @@ + "X-Poedit-Language: swe\n" + "X-Poedit-Country: swe\n" + +-#: src/hddtemp.c:112 +-#, c-format +-msgid "" +-"\n" +-"Regexp%s| Value | Description\n" +-"------%s---------------------\n" +-msgstr "" +-"\n" +-"Regexp%s| Vrde | Beskrivning\n" +-"------%s---------------------\n" +- +-#: src/hddtemp.c:118 +-#, c-format +-msgid "%s%s| %5d | %s\n" +-msgstr "%s%s| %5d | %s\n" +- +-#: src/hddtemp.c:161 ++#: src/hddtemp.c:156 + #, c-format + msgid "" + "\n" +@@ -46,7 +30,7 @@ + "Modell: %s\n" + "\n" + +-#: src/hddtemp.c:188 ++#: src/hddtemp.c:189 + #, c-format + msgid "" + "WARNING: Drive %s doesn't seem to have a temperature sensor.\n" +@@ -60,76 +44,63 @@ + "net).\n" + "VARNING: Se --help, --debug och --drivebase flaggorna.\n" + +-#: src/hddtemp.c:192 ++#: src/hddtemp.c:197 + #, c-format + msgid "%s: %s: no sensor\n" + msgstr "%s: %s: ingen sensor\n" + +-#: src/hddtemp.c:197 +-#, c-format +-msgid "" +-"WARNING: Drive %s doesn't appear in the database of supported drives\n" +-"WARNING: But using a common value, it reports something.\n" +-"WARNING: Note that the temperature shown could be wrong.\n" +-"WARNING: See --help, --debug and --drivebase options.\n" +-"WARNING: And don't forget you can add your drive to hddtemp.db\n" +-msgstr "" +-"VARNING: Disken %s verkar inte finnas i databasen ver diskar som stds\n" +-"VARNING: Men anvnder man ett vanligt vrde rapporterar den ngot.\n" +-"VARNING: Notera att temperaturen som visas kan vara felaktig.\n" +-"VARNING: Se --help, --debug och --drivebase flaggorna.\n" +-"VARNING: Och glm inte att du kan lgga till din disk till hddtemp.db\n" +- +-#: src/hddtemp.c:202 ++#: src/hddtemp.c:211 + #, c-format + msgid "%s: %s: %d%sC or %sF\n" + msgstr "%s: %s: %d%sC eller %sF\n" + +-#: src/hddtemp.c:214 ++#: src/hddtemp.c:235 + #, c-format + msgid "%s: %s: drive is sleeping\n" + msgstr "%s: %s: disken sover\n" + +-#: src/hddtemp.c:217 +-#, c-format +-msgid "%s: %s: known drive, but it doesn't have a temperature sensor.\n" ++#: src/hddtemp.c:242 ++#, fuzzy, c-format ++msgid "%s: %s: drive supported, but it doesn't have a temperature sensor.\n" + msgstr "%s: %s: knd disk men den har ingen temperatursensor.\n" + +-#: src/hddtemp.c:220 ++#: src/hddtemp.c:246 + #, c-format + msgid "ERROR: %s: %s: unknown returned status\n" + msgstr "FEL: %s: %s: oknd returnerad status\n" + +-#: src/hddtemp.c:235 +-#, c-format ++#: src/hddtemp.c:261 ++#, fuzzy, c-format + msgid "" + "\n" + "If one of the field value seems to match the temperature, be sure to read\n" +-"the hddtemp man page before sending me a report (section REPORT). Thanks.\n" ++"the hddtemp man page before sending a report (section REPORT). Thanks.\n" + msgstr "" + "\n" + "Om ett av fltvrdena verkar matcha temperaturen, var sker p att du\n" + "lst manualsidan fr hddtemp fre du skickar en rapport till mig (sektionen\n" + "REPORT). Tack.\n" + +-#: src/hddtemp.c:308 ++#: src/hddtemp.c:338 + #, c-format + msgid "ERROR: invalid separator.\n" + msgstr "FEL: ogiltig separator.\n" + +-#: src/hddtemp.c:319 ++#: src/hddtemp.c:349 + #, c-format + msgid "ERROR: invalid port number.\n" + msgstr "FEL: ogiltigt portnummer.\n" + +-#: src/hddtemp.c:329 +-#, c-format ++#: src/hddtemp.c:371 ++#, fuzzy, c-format + msgid "" +-" Usage: hddtemp [OPTIONS] DISK1 [DISK2]...\n" ++" Usage: hddtemp [OPTIONS] [TYPE:]DISK1 [[TYPE:]DISK2]...\n" + "\n" + " hddtemp displays the temperature of drives supplied in argument.\n" + " Drives must support S.M.A.R.T.\n" + "\n" ++" TYPE could be SATA, PATA or SCSI. If omitted hddtemp will try to guess.\n" ++"\n" + " -b --drivebase : display database file content that allow hddtemp to\n" + " recognize supported drives.\n" + " -D --debug : display various S.M.A.R.T. fields and their values.\n" +@@ -139,6 +110,7 @@ + " -d --daemon : run hddtemp in TCP/IP daemon mode (port %d by " + "default.)\n" + " -f --file=FILE : specify database file to use.\n" ++" -F --foreground : don't daemonize, stay in foreground.\n" + " -l --listen=addr : listen on a specific interface (in TCP/IP daemon " + "mode).\n" + " -n --numeric : print only the temperature.\n" +@@ -146,6 +118,8 @@ + " -s --separator=C : separator to use between fields (in TCP/IP daemon " + "mode).\n" + " -S --syslog=s : log temperature to syslog every s seconds.\n" ++" -u --unit=[C|F] : force output temperature either in Celsius or " ++"Fahrenheit.\n" + " -q --quiet : do not check if the drive is supported.\n" + " -v --version : display hddtemp version number.\n" + " -w --wake-up : wake-up the drive if need.\n" +@@ -184,61 +158,91 @@ + "\n" + "Rapportera buggar eller nya hrddiskar till .\n" + +-#: src/hddtemp.c:522 ++#: src/hddtemp.c:402 + #, c-format + msgid "hddtemp version %s\n" + msgstr "hddtemp version %s\n" + +-#: src/hddtemp.c:547 ++#: src/hddtemp.c:418 + #, c-format + msgid "ERROR: invalid interval.\n" + msgstr "FEL: ogiltigt intervall.\n" + +-#: src/hddtemp.c:547 ++#: src/hddtemp.c:438 ++#, c-format + msgid "Too few arguments: you must specify one drive, at least.\n" + msgstr "Fr f argument: du mste specificera tminstone en disk.\n" + +-#: src/hddtemp.c:557 ++#: src/hddtemp.c:448 ++#, c-format + msgid "ERROR: can't use --debug and --daemon or --syslog options together.\n" + msgstr "" + "FEL: kan inte anvnda --debug och --daemon eller --syslog flaggorna " + "tillsammans.\n" + +-#: src/hddtemp.c:583 ++#: src/hddtemp.c:505 + #, c-format + msgid "ERROR: %s: can't determine bus type (or this bus type is unknown)\n" + msgstr "" + "FEL: %s: kan inte faststlla busstyp (eller s r denna busstyp oknd)\n" + +-#: src/ata.c:66 src/scsi.c:68 ++#: src/ata.c:66 src/scsi.c:64 + msgid "unknown" + msgstr "oknd" + +-#: src/ata.c:98 ++#: src/ata.c:85 src/ata.c:104 src/scsi.c:91 + #, c-format +-msgid "field(%d)\t = %d\n" +-msgstr "flt(%d)\t = %d\n" +- +-#: src/ata.c:167 + msgid "S.M.A.R.T. not available" + msgstr "S.M.A.R.T. r inte tillgnglig" + +-#: src/db.c:180 ++#: src/db.c:115 ++#, c-format ++msgid "" ++"\n" ++"Regexp%s| Value | Description\n" ++"------%s---------------------\n" ++msgstr "" ++"\n" ++"Regexp%s| Vrde | Beskrivning\n" ++"------%s---------------------\n" ++ ++#: src/db.c:121 ++#, c-format ++msgid "%s%s| %5d | %s\n" ++msgstr "%s%s| %5d | %s\n" ++ ++#: src/db.c:236 + #, c-format + msgid "hddtemp: can't open %1$s: %2$s\n" + msgstr "hddtemp: kan inte ppna %1$s: %2$s\n" + +-#: src/db.c:194 ++#: src/db.c:250 + #, c-format + msgid "ERROR: syntax error at line %1$d in %2$s\n" + msgstr "FEL: syntaxfel p rad %1$d i %2$s\n" + +-#: src/db.c:201 ++#: src/db.c:257 + #, c-format + msgid " ERROR: line exceed %1$d characters in %2$s.\n" + msgstr " FEL: raden verstiger %1$d tecken i %2$s.\n" + +-#: src/scsi.c:112 src/scsi.c:130 ++#: src/scsi.c:111 src/scsi.c:129 + #, c-format + msgid "log sense failed : %s" + msgstr "igenknning av logg misslyckades : %s" ++ ++#~ msgid "" ++#~ "WARNING: Drive %s doesn't appear in the database of supported drives\n" ++#~ "WARNING: But using a common value, it reports something.\n" ++#~ "WARNING: Note that the temperature shown could be wrong.\n" ++#~ "WARNING: See --help, --debug and --drivebase options.\n" ++#~ "WARNING: And don't forget you can add your drive to hddtemp.db\n" ++#~ msgstr "" ++#~ "VARNING: Disken %s verkar inte finnas i databasen ver diskar som stds\n" ++#~ "VARNING: Men anvnder man ett vanligt vrde rapporterar den ngot.\n" ++#~ "VARNING: Notera att temperaturen som visas kan vara felaktig.\n" ++#~ "VARNING: Se --help, --debug och --drivebase flaggorna.\n" ++#~ "VARNING: Och glm inte att du kan lgga till din disk till hddtemp.db\n" ++ ++#~ msgid "field(%d)\t = %d\n" ++#~ msgstr "flt(%d)\t = %d\n" +--- hddtemp-0.3-beta15.orig/po/pt.po ++++ hddtemp-0.3-beta15/po/pt.po +@@ -7,7 +7,7 @@ + msgstr "" + "Project-Id-Version: hddtemp 0.3-beta14\n" + "Report-Msgid-Bugs-To: \n" +-"POT-Creation-Date: 2005-02-25 22:43+0100\n" ++"POT-Creation-Date: 2006-06-29 16:24+0200\n" + "PO-Revision-Date: 2006-03-29 23:22+0000\n" + "Last-Translator: Miguel Figueiredo \n" + "Language-Team: Portuguese \n" +@@ -15,23 +15,7 @@ + "Content-Type: text/plain; charset=UTF-8\n" + "Content-Transfer-Encoding: 8bit\n" + +-#: src/hddtemp.c:112 +-#, c-format +-msgid "" +-"\n" +-"Regexp%s| Value | Description\n" +-"------%s---------------------\n" +-msgstr "" +-"\n" +-"Regexp%s| Valor | Descrição\n" +-"------%s-------------------\n" +- +-#: src/hddtemp.c:118 +-#, c-format +-msgid "%s%s| %5d | %s\n" +-msgstr "%s%s| %5d | %s\n" +- +-#: src/hddtemp.c:161 ++#: src/hddtemp.c:156 + #, c-format + msgid "" + "\n" +@@ -44,7 +28,7 @@ + "Modelo: %s\n" + "\n" + +-#: src/hddtemp.c:188 ++#: src/hddtemp.c:189 + #, c-format + msgid "" + "WARNING: Drive %s doesn't seem to have a temperature sensor.\n" +@@ -54,79 +38,68 @@ + msgstr "" + "AVISO: O disco %s não parece ter um sensor de temperatura.\n" + "AVISO: Isto não significa que não tem nenhum.\n" +-"AVISO: Se tem a certeza que tem um, por favor contacte-me (hddtemp@guzu.net).\n" ++"AVISO: Se tem a certeza que tem um, por favor contacte-me (hddtemp@guzu." ++"net).\n" + "AVISO: Veja as opções --help, --debug e --drivebase.\n" + +-#: src/hddtemp.c:192 ++#: src/hddtemp.c:197 + #, c-format + msgid "%s: %s: no sensor\n" + msgstr "%s: %s: sem sensor\n" + +-#: src/hddtemp.c:197 +-#, c-format +-msgid "" +-"WARNING: Drive %s doesn't appear in the database of supported drives\n" +-"WARNING: But using a common value, it reports something.\n" +-"WARNING: Note that the temperature shown could be wrong.\n" +-"WARNING: See --help, --debug and --drivebase options.\n" +-"WARNING: And don't forget you can add your drive to hddtemp.db\n" +-msgstr "" +-"AVISO: O disco %s não parece estar na base de dados de discos suportados\n" +-"AVISO: Mas ao utilizar um valor usual, relata alguma coisa.\n" +-"AVISO: Note que a temperatura mostrada pode estar errada.\n" +-"AVISO: Veja as opções --help, --debug e --frivebase.\n" +-"AVISO: E não se esqueça de adicionar o seu disco a hddtemp.db\n" +- +-#: src/hddtemp.c:202 ++#: src/hddtemp.c:211 + #, c-format + msgid "%s: %s: %d%sC or %sF\n" + msgstr "%s: %s: %d%sC ou %sF\n" + +-#: src/hddtemp.c:214 ++#: src/hddtemp.c:235 + #, c-format + msgid "%s: %s: drive is sleeping\n" + msgstr "%s: %s: o disco está adormecido\n" + +-#: src/hddtemp.c:217 +-#, c-format +-msgid "%s: %s: known drive, but it doesn't have a temperature sensor.\n" ++#: src/hddtemp.c:242 ++#, fuzzy, c-format ++msgid "%s: %s: drive supported, but it doesn't have a temperature sensor.\n" + msgstr "%s: %s: disco conhecido, mas não tem um sensor de temperatura.\n" + +-#: src/hddtemp.c:220 ++#: src/hddtemp.c:246 + #, c-format + msgid "ERROR: %s: %s: unknown returned status\n" + msgstr "ERRO: %s: %s: estado devolvido desconhecido\n" + +-#: src/hddtemp.c:235 +-#, c-format ++#: src/hddtemp.c:261 ++#, fuzzy, c-format + msgid "" + "\n" + "If one of the field value seems to match the temperature, be sure to read\n" +-"the hddtemp man page before sending me a report (section REPORT). Thanks.\n" ++"the hddtemp man page before sending a report (section REPORT). Thanks.\n" + msgstr "" + "\n" +-"Se um dos campos de valores parecer coincidir com a temperatura, assegure-se\n" ++"Se um dos campos de valores parecer coincidir com a temperatura, assegure-" ++"se\n" + "que lê a página do manual hddtemp antes de me enviar um relatório (secção\n" + "REPORT). Obrigado.\n" + +-#: src/hddtemp.c:308 ++#: src/hddtemp.c:338 + #, c-format + msgid "ERROR: invalid separator.\n" + msgstr "ERRO: separador inválido.\n" + +-#: src/hddtemp.c:319 ++#: src/hddtemp.c:349 + #, c-format + msgid "ERROR: invalid port number.\n" + msgstr "ERRO: número de port inválido\n" + +-#: src/hddtemp.c:329 +-#, c-format ++#: src/hddtemp.c:371 ++#, fuzzy, c-format + msgid "" +-" Usage: hddtemp [OPTIONS] DISK1 [DISK2]...\n" ++" Usage: hddtemp [OPTIONS] [TYPE:]DISK1 [[TYPE:]DISK2]...\n" + "\n" + " hddtemp displays the temperature of drives supplied in argument.\n" + " Drives must support S.M.A.R.T.\n" + "\n" ++" TYPE could be SATA, PATA or SCSI. If omitted hddtemp will try to guess.\n" ++"\n" + " -b --drivebase : display database file content that allow hddtemp to\n" + " recognize supported drives.\n" + " -D --debug : display various S.M.A.R.T. fields and their values.\n" +@@ -136,6 +109,7 @@ + " -d --daemon : run hddtemp in TCP/IP daemon mode (port %d by " + "default.)\n" + " -f --file=FILE : specify database file to use.\n" ++" -F --foreground : don't daemonize, stay in foreground.\n" + " -l --listen=addr : listen on a specific interface (in TCP/IP daemon " + "mode).\n" + " -n --numeric : print only the temperature.\n" +@@ -143,6 +117,8 @@ + " -s --separator=C : separator to use between fields (in TCP/IP daemon " + "mode).\n" + " -S --syslog=s : log temperature to syslog every s seconds.\n" ++" -u --unit=[C|F] : force output temperature either in Celsius or " ++"Fahrenheit.\n" + " -q --quiet : do not check if the drive is supported.\n" + " -v --version : display hddtemp version number.\n" + " -w --wake-up : wake-up the drive if need.\n" +@@ -156,19 +132,23 @@ + " hddtemp mostra a temperatura dos discos indicados no argumento.\n" + " Os discos têm de suportar S.M.A.R.T.\n" + "\n" +-" -b --drivebase : mostrar o conteúdo do ficheiro de base de dados que\n" ++" -b\t --drivebase : mostrar o conteúdo do ficheiro de base de dados que\n" + " permite ao hddtemp reconhecer os discos suportados.\n" +-" -D --debug : mostrar vários campos S.M.A.R.T. e os seus valores.\n" +-" Útil para encontrar um valor que pareça coincidir com " +-" a temperatura e/ou para me enviar um relatório.\n" ++" -D\t --debug : mostrar vários campos S.M.A.R.T. e os seus valores.\n" ++" Útil para encontrar um valor que pareça coincidir " ++"com a temperatura e/ou para me enviar um relatório.\n" + " (feito para cada disco indicado).\n" +-" -d --daemon : correr o hddtemp no modo daemon TCP/IP\n (porto %d por omissão.)\n" ++" -d --daemon : correr o hddtemp no modo daemon TCP/IP\n" ++" (porto %d por omissão.)\n" + " -f --file=FILE : especificar o ficheiro de base de dados a utilizar.\n" +-" -l --listen=addr : escutar um interface específico (no modo daemon TCP/IP).\n" ++" -l --listen=addr : escutar um interface específico (no modo daemon TCP/" ++"IP).\n" + " -n --numeric : escrever apenas a temperatura.\n" + " -p --port=# : port para escutar (no modo daemon TCP/IP).\n" +-" -s --separator=C : separador a utilizar entre campos (no modo daemon TCP/IP).\n" +-" -S --syslog=s : registar a temperatura para o syslog a cada s segundos.\n" ++" -s --separator=C : separador a utilizar entre campos (no modo daemon " ++"TCP/IP).\n" ++" -S --syslog=s : registar a temperatura para o syslog a cada s " ++"segundos.\n" + " -q --quiet : não verificar se o disco é suportado.\n" + " -v --version : mostrar o número da versão do hddtemp.\n" + " -w --wake-up : acordar o disco se necessário.\n" +@@ -177,58 +157,93 @@ + "\n" + "Relatar bugs ou novos discos para .\n" + +-#: src/hddtemp.c:522 ++#: src/hddtemp.c:402 + #, c-format + msgid "hddtemp version %s\n" + msgstr "hddtemp versão %s\n" + +-#: src/hddtemp.c:547 ++#: src/hddtemp.c:418 + #, c-format + msgid "ERROR: invalid interval.\n" + msgstr "ERRO: intervalo inválido.\n" + +-#: src/hddtemp.c:547 ++#: src/hddtemp.c:438 ++#, c-format + msgid "Too few arguments: you must specify one drive, at least.\n" +-msgstr "Número de argumentos insuficiente: tem de especificar pelo menos um disco.\n" ++msgstr "" ++"Número de argumentos insuficiente: tem de especificar pelo menos um disco.\n" + +-#: src/hddtemp.c:557 ++#: src/hddtemp.c:448 ++#, c-format + msgid "ERROR: can't use --debug and --daemon or --syslog options together.\n" +-msgstr "ERRO: não pode utilizar em conjunto as opções --debug e --daemon ou --syslog.\n" ++msgstr "" ++"ERRO: não pode utilizar em conjunto as opções --debug e --daemon ou --" ++"syslog.\n" + +-#: src/hddtemp.c:583 ++#: src/hddtemp.c:505 + #, c-format + msgid "ERROR: %s: can't determine bus type (or this bus type is unknown)\n" +-msgstr "ERRO: %s: não é possível determinar o tipo do bus (ou este tipo de bus é desconhecido)\n" ++msgstr "" ++"ERRO: %s: não é possível determinar o tipo do bus (ou este tipo de bus é " ++"desconhecido)\n" + +-#: src/ata.c:66 src/scsi.c:68 ++#: src/ata.c:66 src/scsi.c:64 + msgid "unknown" + msgstr "desconhecido" + +-#: src/ata.c:98 ++#: src/ata.c:85 src/ata.c:104 src/scsi.c:91 + #, c-format +-msgid "field(%d)\t = %d\n" +-msgstr "campo(%d)\t = %d\n" +- +-#: src/ata.c:167 + msgid "S.M.A.R.T. not available" + msgstr "S.M.A.R.T. não está disponível" + +-#: src/db.c:180 ++#: src/db.c:115 ++#, c-format ++msgid "" ++"\n" ++"Regexp%s| Value | Description\n" ++"------%s---------------------\n" ++msgstr "" ++"\n" ++"Regexp%s| Valor | Descrição\n" ++"------%s-------------------\n" ++ ++#: src/db.c:121 ++#, c-format ++msgid "%s%s| %5d | %s\n" ++msgstr "%s%s| %5d | %s\n" ++ ++#: src/db.c:236 + #, c-format + msgid "hddtemp: can't open %1$s: %2$s\n" + msgstr "hddtemp: não pode abrir %1$s: %2$s\n" + +-#: src/db.c:194 ++#: src/db.c:250 + #, c-format + msgid "ERROR: syntax error at line %1$d in %2$s\n" + msgstr "ERRO: erro de sintaxe na linha %1$d em %2$s\n" + +-#: src/db.c:201 ++#: src/db.c:257 + #, c-format + msgid " ERROR: line exceed %1$d characters in %2$s.\n" + msgstr " ERRO: a linha execedeu %1$d caracteres em %2$s.\n" + +-#: src/scsi.c:112 src/scsi.c:130 ++#: src/scsi.c:111 src/scsi.c:129 + #, c-format + msgid "log sense failed : %s" + msgstr "detecção de log falhou: %s" ++ ++#~ msgid "" ++#~ "WARNING: Drive %s doesn't appear in the database of supported drives\n" ++#~ "WARNING: But using a common value, it reports something.\n" ++#~ "WARNING: Note that the temperature shown could be wrong.\n" ++#~ "WARNING: See --help, --debug and --drivebase options.\n" ++#~ "WARNING: And don't forget you can add your drive to hddtemp.db\n" ++#~ msgstr "" ++#~ "AVISO: O disco %s não parece estar na base de dados de discos suportados\n" ++#~ "AVISO: Mas ao utilizar um valor usual, relata alguma coisa.\n" ++#~ "AVISO: Note que a temperatura mostrada pode estar errada.\n" ++#~ "AVISO: Veja as opções --help, --debug e --frivebase.\n" ++#~ "AVISO: E não se esqueça de adicionar o seu disco a hddtemp.db\n" ++ ++#~ msgid "field(%d)\t = %d\n" ++#~ msgstr "campo(%d)\t = %d\n" +--- hddtemp-0.3-beta15.orig/po/de.po ++++ hddtemp-0.3-beta15/po/de.po +@@ -0,0 +1,250 @@ ++# German translation of hddtemp. ++# Copyright (C) 2008 Free Software Foundation, Inc. ++# This file is distributed under the same license as the hddtemp package. ++# Vinzenz Vietzke , 2008. ++# , ++# ++# ++msgid "" ++msgstr "" ++"Project-Id-Version: hddtemp 0.3-beta15-44\n" ++"Report-Msgid-Bugs-To: hddtemp@packages.debian.org\n" ++"POT-Creation-Date: 2006-06-29 16:24+0200\n" ++"PO-Revision-Date: 2011-08-30 16:40+0200\n" ++"Last-Translator: Vinzenz Vietzke \n" ++"Language-Team: \n" ++"MIME-Version: 1.0\n" ++"Content-Type: text/plain; charset=UTF-8\n" ++"Content-Transfer-Encoding: 8bit" ++ ++#: src/hddtemp.c:156 ++#, c-format ++msgid "" ++"\n" ++"================= hddtemp %s ==================\n" ++"Model: %s\n" ++"\n" ++msgstr "" ++"\n" ++"================= hddtemp %s ==================\n" ++"Modell: %s\n" ++"\n" ++ ++#: src/hddtemp.c:189 ++#, c-format ++msgid "" ++"WARNING: Drive %s doesn't seem to have a temperature sensor.\n" ++"WARNING: This doesn't mean it hasn't got one.\n" ++"WARNING: If you are sure it has one, please contact me (hddtemp@guzu." ++"net).\n" ++"WARNING: See --help, --debug and --drivebase options.\n" ++msgstr "" ++"WARNUNG: Laufwerk %s scheint keinen Temperatur-Sensor zu haben.\n" ++"WARNUNG: Das bedeutet nicht, dass es keinen besitzt.\n" ++"WARNUNG: Falls Sie sicher sind, dass es einen besitzt, kontaktieren Sie " ++"mich bitte (hddtemp@guzu.net).\n" ++"WARNUNG: Siehe Optionen --help, --debug und --drivebase.\n" ++ ++#: src/hddtemp.c:197 ++#, c-format ++msgid "%s: %s: no sensor\n" ++msgstr "%s: %s: kein Sensor\n" ++ ++#: src/hddtemp.c:211 ++#, c-format ++msgid "%s: %s: %d%sC or %sF\n" ++msgstr "%s: %s: %d%s°C oder %s°F\n" ++ ++#: src/hddtemp.c:235 ++#, c-format ++msgid "%s: %s: drive is sleeping\n" ++msgstr "%s: %s: Laufwerk schläft\n" ++ ++#: src/hddtemp.c:242 ++#, c-format ++msgid "%s: %s: drive supported, but it doesn't have a temperature sensor.\n" ++msgstr "" ++"%s: %s: Laufwerk unterstützt, aber es hat keinen Temperatur-Sensor.\n" ++ ++#: src/hddtemp.c:246 ++#, c-format ++msgid "ERROR: %s: %s: unknown returned status\n" ++msgstr "FEHLER: %s: %s: zurückgegebener Status unbekannt\n" ++ ++#: src/hddtemp.c:261 ++#, c-format ++msgid "" ++"\n" ++"If one of the field value seems to match the temperature, be sure to read\n" ++"the hddtemp man page before sending a report (section REPORT). Thanks.\n" ++msgstr "" ++"\n" ++"Falls einer der Feldwerte der Temperatur zu entsprechen scheint, stellen " ++"Sie\n" ++"sicher, die hddtemp-Handbuchseite gelesen zu haben, bevor Sie einen " ++"Bericht\n" ++"senden (Abschnitt BERICHT). Danke.\n" ++ ++#: src/hddtemp.c:338 ++#, c-format ++msgid "ERROR: invalid separator.\n" ++msgstr "FEHLER: ungültiges Trennzeichen.\n" ++ ++#: src/hddtemp.c:349 ++#, c-format ++msgid "ERROR: invalid port number.\n" ++msgstr "FEHLER: ungültige Portnummer.\n" ++ ++#: src/hddtemp.c:371 ++#, c-format ++msgid "" ++" Usage: hddtemp [OPTIONS] [TYPE:]DISK1 [[TYPE:]DISK2]...\n" ++"\n" ++" hddtemp displays the temperature of drives supplied in argument.\n" ++" Drives must support S.M.A.R.T.\n" ++"\n" ++" TYPE could be SATA, PATA or SCSI. If omitted hddtemp will try to guess.\n" ++"\n" ++" -b --drivebase : display database file content that allow hddtemp " ++"to\n" ++" recognize supported drives.\n" ++" -D --debug : display various S.M.A.R.T. fields and their " ++"values.\n" ++" Useful to find a value that seems to match the\n" ++" temperature and/or to send me a report.\n" ++" (done for every drive supplied).\n" ++" -d --daemon : run hddtemp in TCP/IP daemon mode (port %d by " ++"default.)\n" ++" -f --file=FILE : specify database file to use.\n" ++" -F --foreground : don't daemonize, stay in foreground.\n" ++" -l --listen=addr : listen on a specific interface (in TCP/IP daemon " ++"mode).\n" ++" -n --numeric : print only the temperature.\n" ++" -p --port=# : port to listen to (in TCP/IP daemon mode).\n" ++" -s --separator=C : separator to use between fields (in TCP/IP daemon " ++"mode).\n" ++" -S --syslog=s : log temperature to syslog every s seconds.\n" ++" -u --unit=[C|F] : force output temperature either in Celsius or " ++"Fahrenheit.\n" ++" -q --quiet : do not check if the drive is supported.\n" ++" -v --version : display hddtemp version number.\n" ++" -w --wake-up : wake-up the drive if need.\n" ++" -4 : listen on IPv4 sockets only.\n" ++" -6 : listen on IPv6 sockets only.\n" ++"\n" ++"Report bugs or new drives to .\n" ++msgstr "" ++" Verwendung: hddtemp [OPTIONEN] [TYP:]LAUFWERK1 [[TYP:]LAUFWERK2]...\n" ++"\n" ++" hddtemp zeigt die Temperatur der via Argument angegeben Laufwerke.\n" ++" Laufwerke müssen S.M.A.R.T. unterstützen.\n" ++"\n" ++" TYP kann SATA, PATA oder SCSI sein. Falls ausgelassen, wird hddtemp \n" ++" versuchen, diesen zu erraten.\n" ++"\n" ++" -b --drivebase : Datenbank-Datei-Inhalt anzeigen, der hddtemp " ++"erlaubt\n" ++" unterstützte Laufwerke zu erkennen.\n" ++" -D --debug : verschiedene S.M.A.R.T.-Felder und deren Werte " ++"anzeigen.\n" ++" Nützlich, um Werte zu finden, die der Temperatur " ++"entsprechen\n" ++" und/oder um mir einen Bericht zu senden.\n" ++" (bereits erledigt für jedes bereitgestellte " ++"Laufwerk).\n" ++" -d --daemon : hddtemp im TCP/IP-Daemon-Modus ausführen " ++"(Standardmäßig Port %d)\n" ++" -f --file=DATEI : zu verwendende Datenbank-Datei festlegen.\n" ++" -F --foreground : nicht daemonisieren, im Vordergrund bleiben.\n" ++" -l --listen=addr : auf einer bestimmten Schnittstelle auf Anfragen " ++"warten (im TCP/IP-Daemon-Modus).\n" ++" -n --numeric : nur die Temperatur ausgeben.\n" ++" -p --port=# : Port, auf dem auf Anfragen gewartet werden soll " ++"(im TCP/IP-Daemon-Modus).\n" ++" -s --separator=C : Trennzeichen zur Verwendung zwischen Feldern (im " ++"TCP/IP-Daemon-Modus).\n" ++" -S --syslog=s : Temperatur alle s Sekunden in das syslog " ++"eintragen.\n" ++" -u --unit=[C|F] : Ausgabe der Temperatur entweder in Celsius oder " ++"Fahrenheit erzwingen.\n" ++" -q --quiet : nicht prüfen, ob das Laufwerk unterstützt wird.\n" ++" -v --version : Versionsnummer von hddtemp anzeigen.\n" ++" -w --wake-up : Laufwerk bei Bedarf aufwecken.\n" ++" -4 : nur auf IPv4-Sockets auf Anfragen warten.\n" ++" -6 : nur auf IPv6-Sockets auf Anfragen warten.\n" ++"\n" ++"Fehler oder neue Laufwerke an melden.\n" ++ ++#: src/hddtemp.c:402 ++#, c-format ++msgid "hddtemp version %s\n" ++msgstr "hddtemp Version %s\n" ++ ++#: src/hddtemp.c:418 ++#, c-format ++msgid "ERROR: invalid interval.\n" ++msgstr "FEHLER: ungültiges Intervall.\n" ++ ++#: src/hddtemp.c:438 ++#, c-format ++msgid "Too few arguments: you must specify one drive, at least.\n" ++msgstr "Zu wenige Argumente: Sie müssen mindestens ein Laufwerk angeben.\n" ++ ++#: src/hddtemp.c:448 ++#, c-format ++msgid "ERROR: can't use --debug and --daemon or --syslog options together.\n" ++msgstr "" ++"FEHLER: kann Optionen --debug und --daemon oder --syslog nicht zusammen " ++"verwenden.\n" ++ ++#: src/hddtemp.c:505 ++#, c-format ++msgid "ERROR: %s: can't determine bus type (or this bus type is unknown)\n" ++msgstr "" ++"FEHLER: %s: kann Bus-Typ nicht ermitteln (oder dieser Bus-Typ ist " ++"unbekannt)\n" ++ ++#: src/ata.c:66 src/scsi.c:64 ++msgid "unknown" ++msgstr "unbekannt" ++ ++#: src/ata.c:85 src/ata.c:104 src/scsi.c:91 ++#, c-format ++msgid "S.M.A.R.T. not available" ++msgstr "S.M.A.R.T. nicht verfügbar" ++ ++#: src/db.c:115 ++#, c-format ++msgid "" ++"\n" ++"Regexp%s| Value | Description\n" ++"------%s---------------------\n" ++msgstr "" ++"\n" ++"Regexp%s| Wert | Beschreibung\n" ++"------%s---------------------\n" ++ ++#: src/db.c:121 ++#, c-format ++msgid "%s%s| %5d | %s\n" ++msgstr "%s%s| %5d | %s\n" ++ ++#: src/db.c:236 ++#, c-format ++msgid "hddtemp: can't open %1$s: %2$s\n" ++msgstr "hddtemp: kann %1$s nicht öffnen: %2$s\n" ++ ++#: src/db.c:250 ++#, c-format ++msgid "ERROR: syntax error at line %1$d in %2$s\n" ++msgstr "FEHLER: Syntaxfehler in Zeile %1$d in %2$s\n" ++ ++#: src/db.c:257 ++#, c-format ++msgid " ERROR: line exceed %1$d characters in %2$s.\n" ++msgstr " FEHLER: Zeile überschreitet %1$d Zeichen in %2$s.\n" ++ ++#: src/scsi.c:111 src/scsi.c:129 ++#, c-format ++msgid "log sense failed : %s" ++msgstr "Protokoll-Erkennung fehlgeschlagen : %s" +--- hddtemp-0.3-beta15.orig/po/LINGUAS ++++ hddtemp-0.3-beta15/po/LINGUAS +@@ -1,2 +1,2 @@ + # Set of available languages. +-fr pt ru sv ++de fr pt ru sv +--- hddtemp-0.3-beta15.orig/po/hddtemp.pot ++++ hddtemp-0.3-beta15/po/hddtemp.pot +@@ -1,35 +1,22 @@ +- +-# Copyright (C) 2006 Free Software Foundation, Inc. +-# This file is distributed under the same license as the 'hddtemp' package. +-# Emmanuel VARAGNAT , 2006. ++# SOME DESCRIPTIVE TITLE. ++# Copyright (C) YEAR Free Software Foundation, Inc. ++# This file is distributed under the same license as the PACKAGE package. ++# FIRST AUTHOR , YEAR. + # + #, fuzzy + msgid "" + msgstr "" + "Project-Id-Version: PACKAGE VERSION\n" +-"Report-Msgid-Bugs-To: hddtemp@guzu.net\n" +-"POT-Creation-Date: 2005-02-25 22:43+0100\n" ++"Report-Msgid-Bugs-To: \n" ++"POT-Creation-Date: 2006-06-29 16:24+0200\n" + "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +-"Last-Translator: Emmanuel Varagnat \n" ++"Last-Translator: FULL NAME \n" + "Language-Team: LANGUAGE \n" + "MIME-Version: 1.0\n" + "Content-Type: text/plain; charset=CHARSET\n" + "Content-Transfer-Encoding: 8bit\n" + +-#: src/hddtemp.c:112 +-#, c-format +-msgid "" +-"\n" +-"Regexp%s| Value | Description\n" +-"------%s---------------------\n" +-msgstr "" +- +-#: src/hddtemp.c:118 +-#, c-format +-msgid "%s%s| %5d | %s\n" +-msgstr "" +- +-#: src/hddtemp.c:161 ++#: src/hddtemp.c:156 + #, c-format + msgid "" + "\n" +@@ -38,7 +25,7 @@ + "\n" + msgstr "" + +-#: src/hddtemp.c:188 ++#: src/hddtemp.c:189 + #, c-format + msgid "" + "WARNING: Drive %s doesn't seem to have a temperature sensor.\n" +@@ -47,67 +34,59 @@ + "WARNING: See --help, --debug and --drivebase options.\n" + msgstr "" + +-#: src/hddtemp.c:192 +-#, c-format +-msgid "%s: %s: no sensor\n" +-msgstr "" +- + #: src/hddtemp.c:197 + #, c-format +-msgid "" +-"WARNING: Drive %s doesn't appear in the database of supported drives\n" +-"WARNING: But using a common value, it reports something.\n" +-"WARNING: Note that the temperature shown could be wrong.\n" +-"WARNING: See --help, --debug and --drivebase options.\n" +-"WARNING: And don't forget you can add your drive to hddtemp.db\n" ++msgid "%s: %s: no sensor\n" + msgstr "" + +-#: src/hddtemp.c:202 ++#: src/hddtemp.c:211 + #, c-format + msgid "%s: %s: %d%sC or %sF\n" + msgstr "" + +-#: src/hddtemp.c:214 ++#: src/hddtemp.c:235 + #, c-format + msgid "%s: %s: drive is sleeping\n" + msgstr "" + +-#: src/hddtemp.c:217 ++#: src/hddtemp.c:242 + #, c-format +-msgid "%s: %s: known drive, but it doesn't have a temperature sensor.\n" ++msgid "%s: %s: drive supported, but it doesn't have a temperature sensor.\n" + msgstr "" + +-#: src/hddtemp.c:220 ++#: src/hddtemp.c:246 + #, c-format + msgid "ERROR: %s: %s: unknown returned status\n" + msgstr "" + +-#: src/hddtemp.c:235 ++#: src/hddtemp.c:261 + #, c-format + msgid "" + "\n" + "If one of the field value seems to match the temperature, be sure to read\n" +-"the hddtemp man page before sending me a report (section REPORT). Thanks.\n" ++"the hddtemp man page before sending a report (section REPORT). Thanks.\n" + msgstr "" + +-#: src/hddtemp.c:308 ++#: src/hddtemp.c:338 + #, c-format + msgid "ERROR: invalid separator.\n" + msgstr "" + +-#: src/hddtemp.c:319 ++#: src/hddtemp.c:349 + #, c-format + msgid "ERROR: invalid port number.\n" + msgstr "" + +-#: src/hddtemp.c:329 ++#: src/hddtemp.c:371 + #, c-format + msgid "" +-" Usage: hddtemp [OPTIONS] DISK1 [DISK2]...\n" ++" Usage: hddtemp [OPTIONS] [TYPE:]DISK1 [[TYPE:]DISK2]...\n" + "\n" + " hddtemp displays the temperature of drives supplied in argument.\n" + " Drives must support S.M.A.R.T.\n" + "\n" ++" TYPE could be SATA, PATA or SCSI. If omitted hddtemp will try to guess.\n" ++"\n" + " -b --drivebase : display database file content that allow hddtemp to\n" + " recognize supported drives.\n" + " -D --debug : display various S.M.A.R.T. fields and their values.\n" +@@ -117,6 +96,7 @@ + " -d --daemon : run hddtemp in TCP/IP daemon mode (port %d by " + "default.)\n" + " -f --file=FILE : specify database file to use.\n" ++" -F --foreground : don't daemonize, stay in foreground.\n" + " -l --listen=addr : listen on a specific interface (in TCP/IP daemon " + "mode).\n" + " -n --numeric : print only the temperature.\n" +@@ -124,6 +104,8 @@ + " -s --separator=C : separator to use between fields (in TCP/IP daemon " + "mode).\n" + " -S --syslog=s : log temperature to syslog every s seconds.\n" ++" -u --unit=[C|F] : force output temperature either in Celsius or " ++"Fahrenheit.\n" + " -q --quiet : do not check if the drive is supported.\n" + " -v --version : display hddtemp version number.\n" + " -w --wake-up : wake-up the drive if need.\n" +@@ -133,58 +115,69 @@ + "Report bugs or new drives to .\n" + msgstr "" + +-#: src/hddtemp.c:522 ++#: src/hddtemp.c:402 + #, c-format + msgid "hddtemp version %s\n" + msgstr "" + +-#: src/hddtemp.c:547 ++#: src/hddtemp.c:418 + #, c-format + msgid "ERROR: invalid interval.\n" + msgstr "" + +-#: src/hddtemp.c:547 ++#: src/hddtemp.c:438 ++#, c-format + msgid "Too few arguments: you must specify one drive, at least.\n" + msgstr "" + +-#: src/hddtemp.c:557 ++#: src/hddtemp.c:448 ++#, c-format + msgid "ERROR: can't use --debug and --daemon or --syslog options together.\n" + msgstr "" + +-#: src/hddtemp.c:583 ++#: src/hddtemp.c:505 + #, c-format + msgid "ERROR: %s: can't determine bus type (or this bus type is unknown)\n" + msgstr "" + +-#: src/ata.c:66 src/scsi.c:68 ++#: src/ata.c:66 src/scsi.c:64 + msgid "unknown" + msgstr "" + +-#: src/ata.c:98 ++#: src/ata.c:85 src/ata.c:104 src/scsi.c:91 + #, c-format +-msgid "field(%d)\t = %d\n" ++msgid "S.M.A.R.T. not available" + msgstr "" + +-#: src/ata.c:167 +-msgid "S.M.A.R.T. not available" ++#: src/db.c:115 ++#, c-format ++msgid "" ++"\n" ++"Regexp%s| Value | Description\n" ++"------%s---------------------\n" ++msgstr "" ++ ++#: src/db.c:121 ++#, c-format ++msgid "%s%s| %5d | %s\n" + msgstr "" + +-#: src/db.c:180 ++#: src/db.c:236 + #, c-format + msgid "hddtemp: can't open %1$s: %2$s\n" + msgstr "" + +-#: src/db.c:194 ++#: src/db.c:250 + #, c-format + msgid "ERROR: syntax error at line %1$d in %2$s\n" + msgstr "" + +-#: src/db.c:201 ++#: src/db.c:257 + #, c-format + msgid " ERROR: line exceed %1$d characters in %2$s.\n" + msgstr "" + +-#: src/scsi.c:112 src/scsi.c:130 ++#: src/scsi.c:111 src/scsi.c:129 + #, c-format + msgid "log sense failed : %s" + msgstr "" +--- hddtemp-0.3-beta15.orig/src/sata.c ++++ hddtemp-0.3-beta15/src/sata.c +@@ -118,11 +118,22 @@ + int i; + u16 * p; + +- if(dsk->db_entry && dsk->db_entry->attribute_id == 0) { ++ if(dsk->db_entry->attribute_id == 0) { + close(dsk->fd); + dsk->fd = -1; + return GETTEMP_NOSENSOR; + } ++ ++ switch(ata_get_powermode(dsk->fd)) { ++ case PWM_STANDBY: ++ case PWM_SLEEPING: ++ if (!wakeup) ++ return GETTEMP_DRIVE_SLEEP; ++ case PWM_UNKNOWN: ++ case PWM_ACTIVE: /* active or idle */ ++ default: ++ break; ++ } + + /* get SMART values */ + if(sata_enable_smart(dsk->fd) != 0) { +@@ -154,24 +165,15 @@ + } + + /* temperature */ +- if(dsk->db_entry && dsk->db_entry->attribute_id > 0) +- field = sata_search_temperature(values, dsk->db_entry->attribute_id); +- else +- field = sata_search_temperature(values, DEFAULT_ATTRIBUTE_ID); ++ field = sata_search_temperature(values, dsk->db_entry->attribute_id); + + if(field) + dsk->value = *(field+3); + + if(dsk->db_entry && dsk->value != -1) + return GETTEMP_KNOWN; +- else { +- if(dsk->value != -1) { +- return GETTEMP_GUESS; +- } +- else { +- return GETTEMP_UNKNOWN; +- } +- } ++ else ++ return GETTEMP_UNKNOWN; + + /* never reached */ + } +--- hddtemp-0.3-beta15.orig/src/satacmds.c ++++ hddtemp-0.3-beta15/src/satacmds.c +@@ -39,7 +39,7 @@ + #include + #include + #include +-#include ++#include + + // Application specific includes + #include "satacmds.h" +@@ -80,8 +80,8 @@ + + ret = scsi_SG_IO(device, cdb, sizeof(cdb), buffer, cmd[3] * 512, sense, sizeof(sense), dxfer_direction); + +- /* Verify SATA magics */ +- if (sense[0] != 0x72 || sense[7] != 0x0e || sense[9] != 0x0e || sense[10] != 0x00) ++ /* Verify SATA magic */ ++ if (sense[0] != 0x72) + return 1; + else + return ret; +@@ -95,10 +95,10 @@ + p = s; + end = &s[bytecount & ~1]; /* bytecount must be even */ + +- /* convert from big-endian to host byte order */ ++ /* convert from big-endian to string order */ + for (p = end ; p != s;) { + unsigned short *pp = (unsigned short *) (p -= 2); +- *pp = ntohs(*pp); ++ *pp = bswap_16(*pp); + } + + /* strip leading blanks */ +--- hddtemp-0.3-beta15.orig/src/backtrace.c ++++ hddtemp-0.3-beta15/src/backtrace.c +@@ -16,9 +16,10 @@ + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + ++#define _GNU_SOURCE + #include + +-#if defined(__i386__) && defined(__GLIBC__) ++#if (defined(__i386__) || defined(__x86_64__)) && defined(__GLIBC__) + + #include + +@@ -31,8 +32,12 @@ + #include + #include + +-#define __USE_GNU + #include ++#if defined(__i386__) ++# define REG_IP REG_EIP ++#elif defined(__x86_64__) ++# define REG_IP REG_RIP ++#endif + + #define MAX_BTSIZE 64 + +@@ -42,7 +47,6 @@ + static char **messages = NULL; + static size_t btsize = 0; + static size_t i; +- static unsigned int old_eip, old_ebp; + static char *strerr = "???"; + static FILE *fstrm; + +@@ -61,10 +65,10 @@ + SIC_CASE(SEGV_MAPERR); + SIC_CASE(SEGV_ACCERR); + } +- fprintf(fstrm, "=== SEGFAULT (%s) : invalid access to %p, in 0x%08x\n", ++ fprintf(fstrm, "=== SEGFAULT (%s) : invalid access to %p, in %p\n", + strerr, + ist->si_addr, +- puc->uc_mcontext.gregs[REG_EIP]); ++ (void*)puc->uc_mcontext.gregs[REG_IP]); + break; + case SIGILL: + switch(ist->si_code) { +@@ -77,10 +81,10 @@ + SIC_CASE(ILL_COPROC); + SIC_CASE(ILL_BADSTK); + } +- fprintf(fstrm, "=== ILLEGAL INSTR (%s) : invalid access to %p, in 0x%08x\n", ++ fprintf(fstrm, "=== ILLEGAL INSTR (%s) : invalid access to %p, in %p\n", + strerr, + ist->si_addr, +- puc->uc_mcontext.gregs[REG_EIP]); ++ (void*)puc->uc_mcontext.gregs[REG_IP]); + break; + case SIGBUS: + switch(ist->si_code) { +@@ -88,10 +92,10 @@ + SIC_CASE(BUS_ADRERR); + SIC_CASE(BUS_OBJERR); + } +- fprintf(fstrm, "=== BUS ERROR (%p) : invalid access to %p, in 0x%08x\n", ++ fprintf(fstrm, "=== BUS ERROR (%p) : invalid access to %p, in %p\n", + strerr, + ist->si_addr, +- puc->uc_mcontext.gregs[REG_EIP]); ++ (void*)puc->uc_mcontext.gregs[REG_IP]); + break; + } + fflush(fstrm); +@@ -101,7 +105,7 @@ + /* + old_eip = *(unsigned int*)((void*)&n-4); + old_ebp = *(unsigned int*)((void*)&n-8); +- *(unsigned int*)((void*)&n-4) = puc->uc_mcontext.gregs[REG_EIP]; ++ *(unsigned int*)((void*)&n-4) = puc->uc_mcontext.gregs[REG_IP]; + *(unsigned int*)((void*)&n-8) = puc->uc_mcontext.gregs[REG_EBP]; + + btsize = backtrace(btinfo, MAX_BTSIZE); +@@ -111,14 +115,14 @@ + */ + + btsize = backtrace(btinfo, MAX_BTSIZE); +- btinfo[1] = (void*) puc->uc_mcontext.gregs[REG_EIP]; ++ btinfo[1] = (void*) puc->uc_mcontext.gregs[REG_IP]; + + messages = backtrace_symbols(btinfo, btsize); + + for(i = 1; + i < btsize; + i++) +- fprintf(fstrm, "[%d] #%d: %s\n", getpid(), i, messages[i]); ++ fprintf(fstrm, "[%d] #%zu: %s\n", getpid(), i, messages[i]); + fflush(fstrm); + fclose(fstrm); + +--- hddtemp-0.3-beta15.orig/src/daemon.c ++++ hddtemp-0.3-beta15/src/daemon.c +@@ -163,19 +163,16 @@ + + switch(dsk->ret) { + case GETTEMP_NOT_APPLICABLE: +- n = snprintf(msg, sizeof(msg), "%s%c%s%c%s%c%c", ++ n = snprintf(msg, sizeof(msg), "%s%c%s%cNA%c*", + dsk->drive, separator, + dsk->model, separator, +- "NA", separator, +- '*'); ++ separator); + break; +- case GETTEMP_GUESS: + case GETTEMP_UNKNOWN: +- n = snprintf(msg, sizeof(msg), "%s%c%s%c%s%c%c", ++ n = snprintf(msg, sizeof(msg), "%s%c%s%cUNK%c*", + dsk->drive, separator, +- dsk->model, separator, +- "UNK", separator, +- '*'); ++ dsk->model, separator, ++ separator); + break; + case GETTEMP_KNOWN: + n = snprintf(msg, sizeof(msg), "%s%c%s%c%d%c%c", +@@ -185,26 +182,23 @@ + get_unit(dsk)); + break; + case GETTEMP_NOSENSOR: +- n = snprintf(msg, sizeof(msg), "%s%c%s%c%s%c%c", ++ n = snprintf(msg, sizeof(msg), "%s%c%s%cNOS%c*", + dsk->drive, separator, + dsk->model, separator, +- "NOS", separator, +- '*'); ++ separator); + break; + case GETTEMP_DRIVE_SLEEP: +- n = snprintf(msg, sizeof(msg), "%s%c%s%c%s%c%c", ++ n = snprintf(msg, sizeof(msg), "%s%c%s%cSLP%c*", + dsk->drive, separator, + dsk->model, separator, +- "SLP", separator, +- '*'); ++ separator); + break; + case GETTEMP_ERROR: + default: +- n = snprintf(msg, sizeof(msg), "%s%c%s%c%s%c%c", ++ n = snprintf(msg, sizeof(msg), "%s%c%s%cERR%c*", + dsk->drive, separator, + (dsk->model) ? dsk->model : "???", separator, +- "ERR", separator, +- '*'); ++ separator); + break; + } + write(cfd,&separator, 1); +@@ -222,14 +216,11 @@ + for(dsk = ldisks; dsk; dsk = dsk->next) { + switch(dsk->ret) { + case GETTEMP_KNOWN: +- case GETTEMP_GUESS: +- value_to_unit(dsk); +- + syslog(LOG_INFO, "%s: %s: %d %c", + dsk->drive, + dsk->model, +- dsk->value, +- dsk->db_entry->unit); ++ value_to_unit(dsk), ++ get_unit(dsk)); + break; + case GETTEMP_DRIVE_SLEEP: + syslog(LOG_WARNING, _("%s: %s: drive is sleeping"), +@@ -270,28 +261,30 @@ + fd_set deffds; + time_t next_time; + +- switch(fork()) { +- case -1: +- perror("fork"); +- exit(2); +- break; +- case 0: +- break; +- default: +- exit(0); +- } +- +- setsid(); +- +- switch(fork()) { +- case -1: +- perror("fork"); +- exit(2); +- break; +- case 0: +- break; +- default: +- exit(0); ++if (!foreground) { ++ switch(fork()) { ++ case -1: ++ perror("fork"); ++ exit(2); ++ break; ++ case 0: ++ break; ++ default: ++ exit(0); ++ } ++ ++ setsid(); ++ ++ switch(fork()) { ++ case -1: ++ perror("fork"); ++ exit(2); ++ break; ++ case 0: ++ break; ++ default: ++ exit(0); ++ } + } + chdir("/"); + umask(0); +--- hddtemp-0.3-beta15.orig/src/hddtemp.c ++++ hddtemp-0.3-beta15/src/hddtemp.c +@@ -75,7 +75,7 @@ + char separator = SEPARATOR; + + struct bustype * bus[BUS_TYPE_MAX]; +-int tcp_daemon, debug, quiet, numeric, wakeup, af_hint; ++int tcp_daemon, debug, quiet, numeric, wakeup, foreground, af_hint; + + static enum { DEFAULT, CELSIUS, FAHRENHEIT } unit; + +@@ -194,23 +194,7 @@ + if (numeric && quiet) + printf("0\n"); + else +- printf(_("%s: %s: no sensor\n"), dsk->drive, dsk->model); +- +- break; +- case GETTEMP_GUESS: +- +- if(!quiet) +- fprintf(stderr, +- _("WARNING: Drive %s doesn't appear in the database of supported drives\n" +- "WARNING: But using a common value, it reports something.\n" +- "WARNING: Note that the temperature shown could be wrong.\n" +- "WARNING: See --help, --debug and --drivebase options.\n" +- "WARNING: And don't forget you can add your drive to hddtemp.db\n"), dsk->drive); +- +- if (! numeric) +- printf(_("%s: %s: %d%sC or %sF\n"), dsk->drive, dsk->model, dsk->value, degree, degree); +- else +- printf("%d\n", value_to_unit(dsk)); ++ fprintf(stderr, _("%s: %s: no sensor\n"), dsk->drive, dsk->model); + + break; + case GETTEMP_KNOWN: +@@ -232,14 +216,14 @@ + if (numeric && quiet) + printf("0\n"); + else +- printf(_("%s: %s: drive is sleeping\n"), dsk->drive, dsk->model); ++ fprintf(stderr, _("%s: %s: drive is sleeping\n"), dsk->drive, dsk->model); + + break; + case GETTEMP_NOSENSOR: + if (numeric && quiet) + printf("0\n"); + else +- printf(_("%s: %s: drive supported, but it doesn't have a temperature sensor.\n"), dsk->drive, dsk->model); ++ fprintf(stderr, _("%s: %s: drive supported, but it doesn't have a temperature sensor.\n"), dsk->drive, dsk->model); + + break; + default: +@@ -268,8 +252,9 @@ + + int main(int argc, char* argv[]) { + int i, c, lindex = 0, db_loaded = 0; ++ int ret = 0; + int show_db; +- struct disk * ldisks; ++ struct disk * ldisks; + + backtrace_sigsegv(); + backtrace_sigill(); +@@ -279,7 +264,7 @@ + bindtextdomain (PACKAGE, LOCALEDIR); + textdomain (PACKAGE); + +- show_db = debug = numeric = quiet = wakeup = af_hint = syslog_interval = 0; ++ show_db = debug = numeric = quiet = wakeup = af_hint = syslog_interval = foreground = 0; + unit = DEFAULT; + portnum = PORT_NUMBER; + listen_addr = NULL; +@@ -294,6 +279,7 @@ + {"drivebase", 0, NULL, 'b'}, + {"debug", 0, NULL, 'D'}, + {"file", 1, NULL, 'f'}, ++ {"foreground", 0, NULL, 'F'}, + {"listen", 1, NULL, 'l'}, + {"version", 0, NULL, 'v'}, + {"port", 1, NULL, 'p'}, +@@ -305,7 +291,7 @@ + {0, 0, 0, 0} + }; + +- c = getopt_long (argc, argv, "bDdf:l:hp:qs:u:vnw46S:", long_options, &lindex); ++ c = getopt_long (argc, argv, "bDdf:l:hp:qs:u:vnw46FS:", long_options, &lindex); + if (c == -1) + break; + +@@ -382,12 +368,13 @@ + " (done for every drive supplied).\n" + " -d --daemon : run hddtemp in TCP/IP daemon mode (port %d by default.)\n" + " -f --file=FILE : specify database file to use.\n" ++ " -F --foreground : don't daemonize, stay in foreground.\n" + " -l --listen=addr : listen on a specific interface (in TCP/IP daemon mode).\n" + " -n --numeric : print only the temperature.\n" + " -p --port=# : port to listen to (in TCP/IP daemon mode).\n" + " -s --separator=C : separator to use between fields (in TCP/IP daemon mode).\n" + " -S --syslog=s : log temperature to syslog every s seconds.\n" +- " -u --unit=[C|F] : force output temperature either in Celius or Fahrenheit.\n" ++ " -u --unit=[C|F] : force output temperature either in Celsius or Fahrenheit.\n" + " -q --quiet : do not check if the drive is supported.\n" + " -v --version : display hddtemp version number.\n" + " -w --wake-up : wake-up the drive if need.\n" +@@ -418,6 +405,9 @@ + } + } + break; ++ case 'F': ++ foreground = 1; ++ break; + default: + exit(1); + } +@@ -489,6 +479,7 @@ + if( (dsk->fd = open(dsk->drive, O_RDONLY | O_NONBLOCK)) < 0) { + snprintf(dsk->errormsg, MAX_ERRORMSG_SIZE, "open: %s\n", strerror(errno)); + dsk->type = ERROR; ++ ret = 1; + continue; + } + +@@ -501,6 +492,7 @@ + + ldisks = dsk->next; + free(dsk); ++ ret = 1; + continue; + } + +@@ -514,11 +506,17 @@ + db_loaded = 1; + } + ++ dsk->db_entry = (struct harddrive_entry *)malloc(sizeof(struct harddrive_entry)); + dbe = is_a_supported_drive(dsk->model); +- if(dbe) { +- dsk->db_entry = (struct harddrive_entry *)malloc(sizeof(struct harddrive_entry)); ++ if(dbe) + memcpy(dsk->db_entry, dbe, sizeof(struct harddrive_entry)); +- } ++ else { ++ dsk->db_entry->regexp = ""; ++ dsk->db_entry->description = ""; ++ dsk->db_entry->attribute_id = DEFAULT_ATTRIBUTE_ID; ++ dsk->db_entry->unit = 'C'; ++ dsk->db_entry->next = NULL; ++ } + } + } + +@@ -530,5 +528,5 @@ + do_direct_mode(ldisks); + } + +- return 0; ++ return ret; + } +--- hddtemp-0.3-beta15.orig/src/ata.c ++++ hddtemp-0.3-beta15/src/ata.c +@@ -75,7 +75,7 @@ + int i; + u16 * p; + +- if(dsk->db_entry && dsk->db_entry->attribute_id == 0) { ++ if(dsk->db_entry->attribute_id == 0) { + close(dsk->fd); + dsk->fd = -1; + return GETTEMP_NOSENSOR; +@@ -140,24 +140,15 @@ + */ + + /* temperature */ +- if(dsk->db_entry && dsk->db_entry->attribute_id > 0) +- field = ata_search_temperature(values, dsk->db_entry->attribute_id); +- else +- field = ata_search_temperature(values, DEFAULT_ATTRIBUTE_ID); ++ field = ata_search_temperature(values, dsk->db_entry->attribute_id); + + if(field) + dsk->value = *(field+3); + +- if(dsk->db_entry && dsk->value != -1) ++ if(dsk->value != -1) + return GETTEMP_KNOWN; +- else { +- if(dsk->value != -1) { +- return GETTEMP_GUESS; +- } +- else { +- return GETTEMP_UNKNOWN; +- } +- } ++ else ++ return GETTEMP_UNKNOWN; + + /* never reached */ + } +--- hddtemp-0.3-beta15.orig/src/hddtemp.h ++++ hddtemp-0.3-beta15/src/hddtemp.h +@@ -39,8 +39,6 @@ + GETTEMP_ERROR, /* Error */ + GETTEMP_NOT_APPLICABLE, /* */ + GETTEMP_UNKNOWN, /* Drive is not in database */ +- GETTEMP_GUESS, /* Not in database, but something was guessed, user must +- check that the temperature returned is correct */ + GETTEMP_KNOWN, /* Drive appear in database */ + GETTEMP_NOSENSOR, /* Drive appear in database but is known to have no sensor */ + GETTEMP_DRIVE_SLEEP /* Drive is sleeping */ +@@ -78,7 +76,7 @@ + + extern struct bustype * bus[BUS_TYPE_MAX]; + extern char errormsg[MAX_ERRORMSG_SIZE]; +-extern int tcp_daemon, debug, quiet, wakeup, af_hint; ++extern int tcp_daemon, debug, quiet, wakeup, af_hint, foreground; + extern char separator; + extern long portnum, syslog_interval; + extern char * listen_addr; +--- hddtemp-0.3-beta15.orig/src/scsicmds.c ++++ hddtemp-0.3-beta15/src/scsicmds.c +@@ -147,6 +147,7 @@ + return 1; + else { + scsi_fixstring(buffer + 8, 24); ++ buffer[32] = 0; + return 0; + } + } diff --git a/packages/addons/addon-depends/system-tools-depends/hid_mapper/package.mk b/packages/addons/addon-depends/system-tools-depends/hid_mapper/package.mk new file mode 100644 index 00000000000..206ef0c9293 --- /dev/null +++ b/packages/addons/addon-depends/system-tools-depends/hid_mapper/package.mk @@ -0,0 +1,36 @@ +################################################################################ +# This file is part of LibreELEC - http://www.libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +PKG_NAME="hid_mapper" +PKG_VERSION="0" +PKG_REV="0" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="" +PKG_URL="http://www.coldsource.net/hid_mapper.tar.gz" +PKG_SOURCE_DIR="${PKG_NAME}_beta" +PKG_DEPENDS_TARGET="toolchain" +PKG_PRIORITY="optional" +PKG_SECTION="tools" +PKG_SHORTDESC="generic HID mapper" +PKG_LONGDESC="generic HID mapper" +PKG_AUTORECONF="no" + +makeinstall_target() { + : # nope +} diff --git a/packages/addons/addon-depends/system-tools-depends/hid_mapper/patches/hid_mapper-01_crosscompile.patch b/packages/addons/addon-depends/system-tools-depends/hid_mapper/patches/hid_mapper-01_crosscompile.patch new file mode 100644 index 00000000000..9843d7b94c7 --- /dev/null +++ b/packages/addons/addon-depends/system-tools-depends/hid_mapper/patches/hid_mapper-01_crosscompile.patch @@ -0,0 +1,21 @@ +diff --git a/Makefile b/Makefile +index f98abbd..9d1d524 100755 +--- a/Makefile ++++ b/Makefile +@@ -9,13 +9,13 @@ EXEC=hid_mapper + VERSION=1.0 + + all: $(OBJS) +- g++ $(LDFLAGS) $(OBJS) -o $(EXEC) ++ ${CXX} $(LDFLAGS) $(OBJS) -o $(EXEC) + + %.o: %.cpp +- g++ -c $(CPPFLAGS) $< ++ ${CXX} -c $(CPPFLAGS) $< + + %.o: %.c +- gcc -c $(CFLAGS) $< ++ ${CC} -c $(CFLAGS) $< + + deb: + cp $(EXEC) package/usr/bin diff --git a/packages/addons/addon-depends/system-tools-depends/hid_mapper/patches/hid_mapper-02_include-sys-time.patch b/packages/addons/addon-depends/system-tools-depends/hid_mapper/patches/hid_mapper-02_include-sys-time.patch new file mode 100644 index 00000000000..2dba3d84ac6 --- /dev/null +++ b/packages/addons/addon-depends/system-tools-depends/hid_mapper/patches/hid_mapper-02_include-sys-time.patch @@ -0,0 +1,12 @@ +diff --git a/hid.c b/hid.c +index 2830b58..a652222 100644 +--- a/hid.c ++++ b/hid.c +@@ -22,6 +22,7 @@ + #include + #include + #include ++#include + + #define SYSFS_HIDRAW_CLASS_PATH "/sys/class/hidraw" + diff --git a/packages/addons/addon-depends/system-tools-depends/hid_mapper/patches/hid_mapper-03_fix-parser.patch b/packages/addons/addon-depends/system-tools-depends/hid_mapper/patches/hid_mapper-03_fix-parser.patch new file mode 100644 index 00000000000..84130e692cc --- /dev/null +++ b/packages/addons/addon-depends/system-tools-depends/hid_mapper/patches/hid_mapper-03_fix-parser.patch @@ -0,0 +1,16 @@ +diff --git a/MapReader.cpp b/MapReader.cpp +index e64b636..bd1ab68 100644 +--- a/MapReader.cpp ++++ b/MapReader.cpp +@@ -98,7 +98,10 @@ void MapReader::LoadMap(const char *filename,EventMapping *map) + + i = 0; + while(i. +################################################################################ + +PKG_NAME="i2c-tools" +PKG_VERSION="3.1.2" +PKG_REV="0" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="http://www.lm-sensors.org/wiki/I2CTools" +PKG_URL="http://fossies.org/linux/misc/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain Python distutilscross:host" +PKG_PRIORITY="optional" +PKG_SECTION="debug/tools" +PKG_SHORTDESC="i2c-tools: bus probing tool, eeprom decoding/programming and SMBus python interface" +PKG_LONGDESC="The i2c-tools package contains a heterogeneous set of I2C tools for Linux: a bus probing tool, a chip dumper, register-level SMBus access helpers, EEPROM decoding scripts, EEPROM programming tools, and a python module for SMBus access." +PKG_AUTORECONF="no" + +pre_make_target() { + export PYTHONXCPREFIX="$SYSROOT_PREFIX/usr" + export LDSHARED="$CC -shared" +} + +make_target() { + make EXTRA="py-smbus" \ + CC="$TARGET_CC" \ + AR="$TARGET_AR" \ + CFLAGS="$TARGET_CFLAGS" \ + CPPFLAGS="$TARGET_CPPFLAGS -I${SYSROOT_PREFIX}/usr/include/python2.7" +} + +makeinstall_target() { + : # nop +} diff --git a/packages/addons/addon-depends/system-tools-depends/jq/package.mk b/packages/addons/addon-depends/system-tools-depends/jq/package.mk new file mode 100644 index 00000000000..b691ef83dba --- /dev/null +++ b/packages/addons/addon-depends/system-tools-depends/jq/package.mk @@ -0,0 +1,38 @@ +################################################################################ +# This file is part of LibreELEC - http://www.libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +PKG_NAME="jq" +PKG_VERSION="1.5" +PKG_REV="0" +PKG_ARCH="any" +PKG_LICENSE="MIT" +PKG_SITE="http://stedolan.github.io/jq/" +PKG_URL="http://github.com/stedolan/jq/releases/download/$PKG_NAME-$PKG_VERSION/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain" +PKG_PRIORITY="optional" +PKG_SECTION="tools" +PKG_SHORTDESC="jq is a command-line JSON processor" +PKG_LONGDESC="jq is like sed for JSON data – you can use it to slice and filter and map and transform structured data with the same ease that sed, awk, grep and friends let you play with text." + +PKG_CONFIGURE_OPTS_TARGET="--disable-shared \ + --enable-static \ + --disable-maintainer-mode" + +makeinstall_target() { + : # nop +} diff --git a/packages/addons/addon-depends/system-tools-depends/lm_sensors/package.mk b/packages/addons/addon-depends/system-tools-depends/lm_sensors/package.mk new file mode 100644 index 00000000000..34acbf1b876 --- /dev/null +++ b/packages/addons/addon-depends/system-tools-depends/lm_sensors/package.mk @@ -0,0 +1,43 @@ +################################################################################ +# This file is part of LibreELEC - http://www.libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +PKG_NAME="lm_sensors" +PKG_VERSION="3.4.0" +PKG_REV="1" +PKG_ARCH="arm x86_64" +PKG_LICENSE="GPL" +PKG_SITE="http://secure.netroedge.com/~lm78/" +PKG_URL="http://ftp.gwdg.de/pub/linux/misc/lm-sensors/$PKG_NAME-$PKG_VERSION.tar.bz2" +PKG_DEPENDS_TARGET="toolchain" +PKG_PRIORITY="optional" +PKG_SECTION="tools" +PKG_SHORTDESC="lm_sensors: Hardware monitoring via the SMBus" +PKG_LONGDESC="lm_sensors is a package to get data from the SMB (System Management Bus - an i2c bus) on modern mainboards. It consists of kernel modules and users space tools to get stuff like cpu / mb temperature, voltages, fan speed..." + +# TODO: PKG_MAKE_OPTS_TARGET + ETCDIR=/storage/.kodi/addons/tools.lm_sensors/data if one wants sensor3.conf.. +PKG_MAKE_OPTS_TARGET="PREFIX=/usr CC=$TARGET_CC AR=$TARGET_AR" +PKG_MAKEINSTALL_OPTS_TARGET="PREFIX=/usr" + +pre_make_target() { + export CFLAGS="$TARGET_CFLAGS" + export CPPFLAGS="$TARGET_CPPFLAGS" +} + +makeinstall_target() { + : # meh +} diff --git a/packages/addons/addon-depends/system-tools-depends/lm_sensors/patches/lm_sensors-01_link-static.patch b/packages/addons/addon-depends/system-tools-depends/lm_sensors/patches/lm_sensors-01_link-static.patch new file mode 100644 index 00000000000..8535cbb4fa1 --- /dev/null +++ b/packages/addons/addon-depends/system-tools-depends/lm_sensors/patches/lm_sensors-01_link-static.patch @@ -0,0 +1,25 @@ +From 0b2b2e26bbae3d06580080a66a85e5e0d90ea9f6 Mon Sep 17 00:00:00 2001 +From: Stefan Saraev +Date: Sun, 10 Aug 2014 14:21:19 +0300 +Subject: [PATCH] link static + +--- + prog/sensors/Module.mk | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/prog/sensors/Module.mk b/prog/sensors/Module.mk +index b656441..ad59874 100644 +--- a/prog/sensors/Module.mk ++++ b/prog/sensors/Module.mk +@@ -40,7 +40,7 @@ REMOVESENSORSMAN := $(patsubst $(MODULE_DIR)/%,$(DESTDIR)$(PROGSENSORSMAN1DIR)/% + LIBICONV := $(shell if /sbin/ldconfig -p | grep -q '/libiconv\.so$$' ; then echo \-liconv; else echo; fi) + + $(PROGSENSORSTARGETS): $(PROGSENSORSSOURCES:.c=.ro) lib/$(LIBSHBASENAME) +- $(CC) $(EXLDFLAGS) -o $@ $(PROGSENSORSSOURCES:.c=.ro) $(LIBICONV) -Llib -lsensors ++ $(CC) $(EXLDFLAGS) -o $@ $(PROGSENSORSSOURCES:.c=.ro) $(LIBICONV) -Llib -Wl,-Bstatic -lsensors -Wl,-Bdynamic -lm + + all-prog-sensors: $(PROGSENSORSTARGETS) + user :: all-prog-sensors +-- +1.7.2.5 + diff --git a/packages/addons/addon-depends/system-tools-depends/lshw/package.mk b/packages/addons/addon-depends/system-tools-depends/lshw/package.mk new file mode 100644 index 00000000000..6ef05b9c4da --- /dev/null +++ b/packages/addons/addon-depends/system-tools-depends/lshw/package.mk @@ -0,0 +1,39 @@ +################################################################################ +# This file is part of LibreELEC - http://www.libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +PKG_NAME="lshw" +PKG_VERSION="B.02.17" +PKG_REV="0" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="http://ezix.org/project/wiki/HardwareLiSter" +PKG_URL="http://ezix.org/software/files/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain" +PKG_PRIORITY="optional" +PKG_SECTION="tools" +PKG_SHORTDESC="lshw (Hardware Lister)" +PKG_LONGDESC="lshw (Hardware Lister) is a small tool to provide detailed information on the hardware configuration of the machine." +PKG_AUTORECONF="no" + +make_target() { + make CXX=$CXX -C src/ +} + +makeinstall_target() { + : # nop +} diff --git a/packages/addons/addon-depends/system-tools-depends/mrxvt/package.mk b/packages/addons/addon-depends/system-tools-depends/mrxvt/package.mk new file mode 100644 index 00000000000..d53167c0fc8 --- /dev/null +++ b/packages/addons/addon-depends/system-tools-depends/mrxvt/package.mk @@ -0,0 +1,71 @@ +################################################################################ +# This file is part of LibreELEC - http://www.libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +PKG_NAME="mrxvt" +PKG_VERSION="0.5.4" +PKG_REV="0" +PKG_ARCH="i386 x86_64" +PKG_LICENSE="GPL" +PKG_SITE="http://materm.sourceforge.net/" +PKG_URL="$SOURCEFORGE_SRC/materm/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain libX11" +PKG_PRIORITY="optional" +PKG_SECTION="tools" +PKG_SHORTDESC="mrxvt: Lightweight Xterm replacement" +PKG_LONGDESC="Mrxvt (previously named as materm) is a lightweight and powerful multi-tabbed X terminal emulator based on the popular rxvt and aterm. It implements many useful features seen in some modern X terminal emulators, like gnome-terminal and konsole, but keep to be lightweight and independent from the GNOME and KDE desktop environment." +PKG_AUTORECONF="yes" + + +PKG_CONFIGURE_OPTS_TARGET="ac_cv_func_setpgrp_void=no \ + --enable-minimal \ + --disable-frills \ + --enable-keepscrolling \ + --disable-selectionscrolling \ + --enable-mousewheel \ + --disable-mouseslipwheel \ + --enable-rxvt-scroll \ + --disable-half-shadow \ + --enable-lastlog \ + --enable-sessionmgr \ + --enable-linespace \ + --enable-24bits \ + --enable-256colors \ + --enable-cursor-blink \ + --enable-pointer-blank \ + --disable-text-shadow \ + --disable-menubar \ + --disable-transparency \ + --disable-tinting \ + --disable-xrender \ + --disable-xpm \ + --disable-jpeg \ + --disable-png \ + --disable-xft \ + --enable-ttygid \ + --enable-backspace-key \ + --enable-delete-key \ + --disable-resources \ + --disable-swapscreen \ + --disable-use-fifo \ + --disable-greek \ + --disable-xim \ + --disable-utempter" + +makeinstall_target() { + : # nop +} diff --git a/packages/addons/addon-depends/system-tools-depends/mtpfs/package.mk b/packages/addons/addon-depends/system-tools-depends/mtpfs/package.mk new file mode 100644 index 00000000000..4d38757647b --- /dev/null +++ b/packages/addons/addon-depends/system-tools-depends/mtpfs/package.mk @@ -0,0 +1,43 @@ +################################################################################ +# This file is part of LibreELEC - http://www.libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +PKG_NAME="mtpfs" +PKG_VERSION="1.1" +PKG_REV="1" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="http://www.adebenham.com/mtpfs/" +PKG_URL="http://www.adebenham.com/files/mtp/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain fuse libmtp glib" +PKG_PRIORITY="optional" +PKG_SECTION="tools" +PKG_SHORTDESC="MTPfs is a FUSE filesystem that supports reading and writing from any MTP device" +PKG_LONGDESC="MTPfs is a FUSE filesystem that supports reading and writing from any MTP device" +PKG_AUTORECONF="yes" + +PKG_CONFIGURE_OPTS_TARGET="--disable-mad" + +# TODO: mtpfs runs host utils while building, fix and set PKG_ARCH="any" + +pre_configure_target() { + export LIBS="-lusb-1.0 -ludev" +} + +makeinstall_target() { + : # nop +} diff --git a/packages/addons/addon-depends/system-tools-depends/p7zip/package.mk b/packages/addons/addon-depends/system-tools-depends/p7zip/package.mk new file mode 100644 index 00000000000..47d962c11d1 --- /dev/null +++ b/packages/addons/addon-depends/system-tools-depends/p7zip/package.mk @@ -0,0 +1,40 @@ +################################################################################ +# This file is part of LibreELEC - http://www.libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +PKG_NAME="p7zip" +PKG_VERSION="15.14" +PKG_REV="1" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="http://p7zip.sourceforge.net/" +PKG_URL="http://downloads.sourceforge.net/project/p7zip/p7zip/${PKG_VERSION}/p7zip_${PKG_VERSION}_src_all.tar.bz2" +PKG_SOURCE_DIR="${PKG_NAME}_${PKG_VERSION}" +PKG_DEPENDS_TARGET="toolchain" +PKG_PRIORITY="optional" +PKG_SECTION="tools" +PKG_SHORTDESC="p7zip is a port of 7za.exe for POSIX systems like Unix" +PKG_LONGDESC="p7zip is a port of 7za.exe for POSIX systems like Unix" +PKG_AUTORECONF="no" + +make_target() { + make TARGET_CXX=$TARGET_CXX TARGET_CC=$TARGET_CC 7z 7za +} + +makeinstall_target() { + : # nop +} diff --git a/packages/addons/addon-depends/system-tools-depends/p7zip/patches/p7zip-crosscompile.patch b/packages/addons/addon-depends/system-tools-depends/p7zip/patches/p7zip-crosscompile.patch new file mode 100644 index 00000000000..5e022073bd3 --- /dev/null +++ b/packages/addons/addon-depends/system-tools-depends/p7zip/patches/p7zip-crosscompile.patch @@ -0,0 +1,14 @@ +diff -Naur p7zip_15.14/makefile.machine p7zip_15.14.patch/makefile.machine +--- p7zip_15.14/makefile.machine 2016-03-13 18:30:21.000000000 +0100 ++++ p7zip_15.14.patch/makefile.machine 2016-03-27 03:17:45.348285607 +0200 +@@ -10,8 +10,8 @@ + -D_7ZIP_LARGE_PAGES \ + $(LOCAL_FLAGS) + +-CXX=g++ +-CC=gcc ++CXX=$(TARGET_CXX) ++CC=$(TARGET_CC) + CC_SHARED=-fPIC + LINK_SHARED=-fPIC -shared + diff --git a/packages/addons/addon-depends/system-tools-depends/patch/package.mk b/packages/addons/addon-depends/system-tools-depends/patch/package.mk new file mode 100644 index 00000000000..00f8894349a --- /dev/null +++ b/packages/addons/addon-depends/system-tools-depends/patch/package.mk @@ -0,0 +1,37 @@ +################################################################################ +# This file is part of LibreELEC - http://www.libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +PKG_NAME="patch" +PKG_VERSION="2.7.5" +PKG_REV="1" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="http://savannah.gnu.org/projects/patch/" +PKG_URL="ftp://ftp.gnu.org/gnu/patch/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_DEPENDS_TARGET="toolchain" +PKG_PRIORITY="optional" +PKG_SECTION="tools" +PKG_SHORTDESC="GNU patch" +PKG_LONGDESC="Patch takes a patch file containing a difference listing produced by the diff program and applies those differences to one or more original files, producing patched versions" +PKG_AUTORECONF="yes" + +PKG_CONFIGURE_OPTS_TARGET="--disable-xattr" + +makeinstall_target() { + : # nop +} diff --git a/packages/addons/addon-depends/system-tools-depends/pv/package.mk b/packages/addons/addon-depends/system-tools-depends/pv/package.mk new file mode 100644 index 00000000000..1708b98e993 --- /dev/null +++ b/packages/addons/addon-depends/system-tools-depends/pv/package.mk @@ -0,0 +1,37 @@ +################################################################################ +# This file is part of LibreELEC - http://www.libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +PKG_NAME="pv" +PKG_VERSION="1.6.0" +PKG_REV="0" +PKG_ARCH="any" +PKG_LICENSE="GNU" +PKG_SITE="http://www.ivarch.com/programs/pv.shtml" +PKG_URL="http://www.ivarch.com/programs/sources/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain" +PKG_SECTION="tools" +PKG_PRIORITY="optional" +PKG_SHORTDESC="Pipe Viewer is a terminal-based tool for monitoring the progress of data through a pipeline" +PKG_LONGDESC="Pipe Viwer can be inserted into any normal pipeline between two processes to give a visual indication of how quickly data is passing through, how long it has taken, how near to completion it is, and an estimate of how long it will be until completion." +PKG_AUTORECONF="no" + +PKG_CONFIGURE_OPTS_TARGET="--enable-static-nls" + +makeinstall_target() { + : # nop +} diff --git a/packages/addons/addon-depends/system-tools-depends/screen/package.mk b/packages/addons/addon-depends/system-tools-depends/screen/package.mk new file mode 100644 index 00000000000..d37adf12f6f --- /dev/null +++ b/packages/addons/addon-depends/system-tools-depends/screen/package.mk @@ -0,0 +1,49 @@ +################################################################################ +# This file is part of LibreELEC - http://www.libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +PKG_NAME="screen" +PKG_VERSION="4.3.1" +PKG_REV="1" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="http://www.gnu.org/software/screen/" +PKG_URL="http://ftp.gnu.org/gnu/screen/screen-${PKG_VERSION}.tar.gz" +PKG_DEPENDS_TARGET="toolchain netbsd-curses" +PKG_PRIORITY="optional" +PKG_SECTION="shell/console" +PKG_SHORTDESC="terminal multiplexor with VT100/ANSI terminal emulation" +PKG_LONGDESC="screen is a terminal multiplexor that runs several separate "screens" on a single physical character-based terminal. Each virtual terminal emulates a DEC VT100 plus several ANSI X3.64 and ISO 2022 functions. Screen sessions can be detached and resumed later on a different terminal." +PKG_AUTORECONF="no" + +PKG_CONFIGURE_OPTS_TARGET="ac_cv_header_utempter_h=no \ + --disable-pam \ + --disable-use-locale \ + --disable-telnet \ + --disable-socket-dir" + +pre_configure_target() { + export LDFLAGS=`echo $LDFLAGS | sed -e "s|-Wl,--as-needed||"` + +# screen fails to build in subdirs + cd $ROOT/$PKG_BUILD + rm -rf .$TARGET_NAME +} + +makeinstall_target() { + : # nop +} diff --git a/packages/addons/addon-depends/system-tools-depends/screen/patches/screen-cross-compile.patch b/packages/addons/addon-depends/system-tools-depends/screen/patches/screen-cross-compile.patch new file mode 100644 index 00000000000..b4bc30797c9 --- /dev/null +++ b/packages/addons/addon-depends/system-tools-depends/screen/patches/screen-cross-compile.patch @@ -0,0 +1,64 @@ +--- a/configure ++++ b/configure +@@ -414,7 +414,7 @@ as_fn_error () + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 +- as_fn_exit $as_status ++ # as_fn_exit $as_status + } # as_fn_error + + if expr a : '\(a\)' >/dev/null 2>&1 && +@@ -5941,8 +5941,6 @@ else + fi + rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +-test -f /lib/libsec.a || test -f /usr/lib/libsec.a && LIBS="$LIBS -lsec" +-test -f /lib/libshadow.a || test -f /usr/lib/libshadow.a && LIBS="$LIBS -lshadow" + oldlibs="$LIBS" + LIBS="$LIBS -lsun" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking IRIX sun library..." >&5 +@@ -7023,7 +7021,7 @@ as_fn_error () + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 +- as_fn_exit $as_status ++ # as_fn_exit $as_status + } # as_fn_error + + +--- a/pty.c ++++ b/pty.c +@@ -39,9 +39,9 @@ + #endif + + /* for solaris 2.1, Unixware (SVR4.2) and possibly others */ +-#ifdef HAVE_STROPTS_H +-# include +-#endif ++//#ifdef HAVE_STROPTS_H ++//# include ++//#endif + + #if defined(sun) && defined(LOCKPTY) && !defined(TIOCEXCL) + # include +--- a/sched.h ++++ b/sched.h +@@ -27,6 +27,11 @@ + * $Id$ GNU + */ + ++#ifndef __SCHED_H ++#define __SCHED_H ++ ++#include ++ + struct event + { + struct event *next; +@@ -46,3 +51,5 @@ struct event + #define EV_READ 1 + #define EV_WRITE 2 + #define EV_ALWAYS 3 ++ ++#endif diff --git a/packages/addons/addon-depends/system-tools-depends/screen/patches/screen-dont_link_against_libelf.patch b/packages/addons/addon-depends/system-tools-depends/screen/patches/screen-dont_link_against_libelf.patch new file mode 100644 index 00000000000..496246a3ec4 --- /dev/null +++ b/packages/addons/addon-depends/system-tools-depends/screen/patches/screen-dont_link_against_libelf.patch @@ -0,0 +1,22 @@ +diff -Naur screen-4.3.1/configure screen-4.3.1.patch/configure +--- screen-4.3.1/configure 2015-06-28 23:42:40.000000000 +0200 ++++ screen-4.3.1.patch/configure 2016-03-26 17:52:12.807054501 +0100 +@@ -4156,7 +4156,6 @@ + + + oldlibs="$LIBS" +-LIBS="$LIBS -lelf" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking SVR4..." >&5 + $as_echo "$as_me: checking SVR4..." >&6;} + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +diff -Naur screen-4.3.1/configure.ac screen-4.3.1.patch/configure.ac +--- screen-4.3.1/configure.ac 2015-06-28 23:22:55.000000000 +0200 ++++ screen-4.3.1.patch/configure.ac 2016-03-26 17:52:03.538036990 +0100 +@@ -203,7 +203,6 @@ + ], LIBS="$LIBS -lsocket -linet";seqptx=1) + + oldlibs="$LIBS" +-LIBS="$LIBS -lelf" + AC_CHECKING(SVR4) + AC_TRY_LINK([#include + ],, diff --git a/packages/addons/addon-depends/system-tools-depends/strace/package.mk b/packages/addons/addon-depends/system-tools-depends/strace/package.mk new file mode 100644 index 00000000000..f419f9712c5 --- /dev/null +++ b/packages/addons/addon-depends/system-tools-depends/strace/package.mk @@ -0,0 +1,35 @@ +################################################################################ +# This file is part of LibreELEC - http://www.libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +PKG_NAME="strace" +PKG_VERSION="4.11" +PKG_REV="1" +PKG_ARCH="any" +PKG_LICENSE="BSD" +PKG_SITE="http://sourceforge.net/projects/strace/" +PKG_URL="$SOURCEFORGE_SRC/strace/strace/$PKG_VERSION/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_DEPENDS_TARGET="toolchain" +PKG_PRIORITY="optional" +PKG_SECTION="tools" +PKG_SHORTDESC="strace: Trace system calls and signals" +PKG_LONGDESC="In the simplest case strace runs the specified command until it exits. It intercepts and records the system calls which are called by a process and the signals which are received by a process. The name of each system call, its arguments and its return value are printed on standard error or to the file specified with the -o option." +PKG_AUTORECONF="yes" + +makeinstall_target() { + : # nothing to do here +} diff --git a/packages/addons/addon-depends/system-tools-depends/strace/patches/strace-4.8-autoreconf.patch b/packages/addons/addon-depends/system-tools-depends/strace/patches/strace-4.8-autoreconf.patch new file mode 100644 index 00000000000..bf7efa09c6e --- /dev/null +++ b/packages/addons/addon-depends/system-tools-depends/strace/patches/strace-4.8-autoreconf.patch @@ -0,0 +1,13 @@ +diff -Naur strace-4.8/configure.ac strace-4.8.patch/configure.ac +--- strace-4.8/configure.ac 2013-05-04 21:51:57.000000000 +0200 ++++ strace-4.8.patch/configure.ac 2013-09-04 03:30:12.478057723 +0200 +@@ -1,8 +1,6 @@ + dnl Process this file with autoconf to create configure. Use autoreconf. + AC_PREREQ(2.57) +-AC_INIT([strace], +- m4_esyscmd([./git-version-gen .tarball-version]), +- [strace-devel@lists.sourceforge.net]) ++AC_INIT([strace],[4.8]) + AC_CONFIG_SRCDIR([strace.c]) + AC_CONFIG_AUX_DIR([.]) + AC_CONFIG_HEADERS([config.h]) diff --git a/packages/addons/addon-depends/system-tools-depends/unrar/package.mk b/packages/addons/addon-depends/system-tools-depends/unrar/package.mk new file mode 100644 index 00000000000..e2a12a38952 --- /dev/null +++ b/packages/addons/addon-depends/system-tools-depends/unrar/package.mk @@ -0,0 +1,45 @@ +################################################################################ +# This file is part of LibreELEC - http://www.libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +PKG_NAME="unrar" +PKG_VERSION="5.3.11" +PKG_REV="1" +PKG_ARCH="any" +PKG_LICENSE="free" +PKG_SITE="http://www.rarlab.com" +PKG_URL="http://www.rarlab.com/rar/unrarsrc-$PKG_VERSION.tar.gz" +PKG_SOURCE_DIR="${PKG_NAME}" +PKG_DEPENDS_TARGET="toolchain" +PKG_PRIORITY="optional" +PKG_SECTION="tools" +PKG_SHORTDESC="unrar: Extract, test and view RAR archives" +PKG_LONGDESC="Unrar is a package to handle files compressed in the RAR format. Due to strange licensing issues this package can only view, test and extract files in a given archive, but not pack files. But since we have far more advanced open-source compression utils it should be enough to extract the content when you get a RAR archive." +PKG_AUTORECONF="no" + +make_target() { + make CXX="$TARGET_CXX" \ + CXXFLAGS="$TARGET_CXXFLAGS" \ + RANLIB="$TARGET_RANLIB" \ + AR="$TARGET_AR" \ + STRIP="$TARGET_STRIP" \ + -f makefile +} + +makeinstall_target() { + : # nop +} diff --git a/packages/addons/addon-depends/system-tools-depends/usb-modeswitch/package.mk b/packages/addons/addon-depends/system-tools-depends/usb-modeswitch/package.mk new file mode 100644 index 00000000000..629ccc53e5d --- /dev/null +++ b/packages/addons/addon-depends/system-tools-depends/usb-modeswitch/package.mk @@ -0,0 +1,35 @@ +################################################################################ +# This file is part of LibreELEC - http://www.libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +PKG_NAME="usb-modeswitch" +PKG_VERSION="2.3.0" +PKG_REV="1" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="http://www.draisberghof.de/usb_modeswitch/" +PKG_URL="http://www.draisberghof.de/usb_modeswitch/${PKG_NAME}-${PKG_VERSION}.tar.bz2" +PKG_DEPENDS_TARGET="toolchain libusb" +PKG_PRIORITY="optional" +PKG_SECTION="tools" +PKG_SHORTDESC="USB_ModeSwitch - Handling Mode-Switching USB Devices on Linux" +PKG_LONGDESC="USB_ModeSwitch - Handling Mode-Switching USB Devices on Linux" +PKG_AUTORECONF="no" + +makeinstall_target() { + : # nop +} diff --git a/packages/3rdparty/web/tntnet/package.mk b/packages/addons/addon-depends/tntnet/package.mk similarity index 100% rename from packages/3rdparty/web/tntnet/package.mk rename to packages/addons/addon-depends/tntnet/package.mk diff --git a/packages/3rdparty/web/tntnet/patches/tntnet-2.2-fix_gcc47.patch b/packages/addons/addon-depends/tntnet/patches/tntnet-2.2-fix_gcc47.patch similarity index 100% rename from packages/3rdparty/web/tntnet/patches/tntnet-2.2-fix_gcc47.patch rename to packages/addons/addon-depends/tntnet/patches/tntnet-2.2-fix_gcc47.patch diff --git a/packages/3rdparty/web/tntnet/patches/tntnet-pkgconfig-support.patch b/packages/addons/addon-depends/tntnet/patches/tntnet-pkgconfig-support.patch similarity index 100% rename from packages/3rdparty/web/tntnet/patches/tntnet-pkgconfig-support.patch rename to packages/addons/addon-depends/tntnet/patches/tntnet-pkgconfig-support.patch diff --git a/packages/multimedia/vdr-dummydevice/package.mk b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-dummydevice/package.mk similarity index 91% rename from packages/multimedia/vdr-dummydevice/package.mk rename to packages/addons/addon-depends/vdr-plugins/vdr-plugin-dummydevice/package.mk index 236a02d8ade..1e8b6c414e4 100644 --- a/packages/multimedia/vdr-dummydevice/package.mk +++ b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-dummydevice/package.mk @@ -16,13 +16,13 @@ # along with OpenELEC. If not, see . ################################################################################ -PKG_NAME="vdr-dummydevice" +PKG_NAME="vdr-plugin-dummydevice" PKG_VERSION="2.0.0" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.vdr-wiki.de/wiki/index.php/Dummydevice-plugin" -PKG_URL="$DISTRO_MIRROR/$PKG_NAME/$PKG_NAME-$PKG_VERSION.tgz" +PKG_URL="http://phivdr.dyndns.org/vdr/vdr-dummydevice/${PKG_NAME/-plugin/}-$PKG_VERSION.tgz" PKG_SOURCE_DIR="dummydevice-${PKG_VERSION}" PKG_DEPENDS_TARGET="toolchain vdr" PKG_PRIORITY="optional" @@ -47,7 +47,7 @@ make_target() { post_make_target() { VDR_DIR=$(get_build_dir vdr) VDR_APIVERSION=`sed -ne '/define APIVERSION/s/^.*"\(.*\)".*$/\1/p' $VDR_DIR/config.h` - LIB_NAME=lib${PKG_NAME} + LIB_NAME=lib${PKG_NAME/-plugin/} cp --remove-destination ${LIB_NAME}.so ${LIB_NAME}.so.${VDR_APIVERSION} $STRIP libvdr-*.so* diff --git a/packages/multimedia/vdr-plugin-dvbapi/package.mk b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-dvbapi/package.mk similarity index 94% rename from packages/multimedia/vdr-plugin-dvbapi/package.mk rename to packages/addons/addon-depends/vdr-plugins/vdr-plugin-dvbapi/package.mk index 7540a00997d..c2975c79a7b 100644 --- a/packages/multimedia/vdr-plugin-dvbapi/package.mk +++ b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-dvbapi/package.mk @@ -17,12 +17,12 @@ ################################################################################ PKG_NAME="vdr-plugin-dvbapi" -PKG_VERSION="31f409d" +PKG_VERSION="c76c24e" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="https://github.com/manio/vdr-plugin-dvbapi" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_URL="https://github.com/manio/vdr-plugin-dvbapi/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain vdr libdvbcsa" PKG_PRIORITY="optional" PKG_SECTION="multimedia" diff --git a/packages/multimedia/vdr-plugin-dvbapi/patches/vdr-plugin-dvbapi-01_crosscompiling.patch b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-dvbapi/patches/vdr-plugin-dvbapi-01_crosscompiling.patch similarity index 100% rename from packages/multimedia/vdr-plugin-dvbapi/patches/vdr-plugin-dvbapi-01_crosscompiling.patch rename to packages/addons/addon-depends/vdr-plugins/vdr-plugin-dvbapi/patches/vdr-plugin-dvbapi-01_crosscompiling.patch diff --git a/packages/multimedia/vdr-plugin-dvbapi/patches/vdr-plugin-dvbapi-02_disable-network-mode-on-new-installs.patch b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-dvbapi/patches/vdr-plugin-dvbapi-02_disable-network-mode-on-new-installs.patch similarity index 100% rename from packages/multimedia/vdr-plugin-dvbapi/patches/vdr-plugin-dvbapi-02_disable-network-mode-on-new-installs.patch rename to packages/addons/addon-depends/vdr-plugins/vdr-plugin-dvbapi/patches/vdr-plugin-dvbapi-02_disable-network-mode-on-new-installs.patch diff --git a/packages/multimedia/vdr-plugin-eepg/package.mk b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-eepg/package.mk similarity index 94% rename from packages/multimedia/vdr-plugin-eepg/package.mk rename to packages/addons/addon-depends/vdr-plugins/vdr-plugin-eepg/package.mk index e6397283810..ad1c3723bf4 100644 --- a/packages/multimedia/vdr-plugin-eepg/package.mk +++ b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-eepg/package.mk @@ -22,7 +22,7 @@ PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://projects.vdr-developer.org/projects/plg-eepg" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_URL="http://projects.vdr-developer.org/git/vdr-plugin-eepg.git/snapshot/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS_TARGET="toolchain vdr" PKG_PRIORITY="optional" PKG_SECTION="multimedia" diff --git a/packages/multimedia/vdr-plugin-epgfixer/package.mk b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-epgfixer/package.mk similarity index 94% rename from packages/multimedia/vdr-plugin-epgfixer/package.mk rename to packages/addons/addon-depends/vdr-plugins/vdr-plugin-epgfixer/package.mk index e64e5beb18e..7cf8b030d5f 100644 --- a/packages/multimedia/vdr-plugin-epgfixer/package.mk +++ b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-epgfixer/package.mk @@ -22,7 +22,7 @@ PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://projects.vdr-developer.org/projects/plg-epgfixer" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_URL="http://projects.vdr-developer.org/git/vdr-plugin-epgfixer.git/snapshot/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS_TARGET="toolchain vdr pcre" PKG_PRIORITY="optional" PKG_SECTION="multimedia" diff --git a/packages/multimedia/vdr-plugin-epgfixer/patches/vdr-plugin-epgfixer-pkgconfig.patch b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-epgfixer/patches/vdr-plugin-epgfixer-pkgconfig.patch similarity index 100% rename from packages/multimedia/vdr-plugin-epgfixer/patches/vdr-plugin-epgfixer-pkgconfig.patch rename to packages/addons/addon-depends/vdr-plugins/vdr-plugin-epgfixer/patches/vdr-plugin-epgfixer-pkgconfig.patch diff --git a/packages/multimedia/vdr-epgsearch/package.mk b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-epgsearch/package.mk similarity index 92% rename from packages/multimedia/vdr-epgsearch/package.mk rename to packages/addons/addon-depends/vdr-plugins/vdr-plugin-epgsearch/package.mk index f5d870fca24..0ab255346c2 100644 --- a/packages/multimedia/vdr-epgsearch/package.mk +++ b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-epgsearch/package.mk @@ -16,13 +16,13 @@ # along with OpenELEC. If not, see . ################################################################################ -PKG_NAME="vdr-epgsearch" +PKG_NAME="vdr-plugin-epgsearch" PKG_VERSION="0b09f90" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://winni.vdr-developer.org/epgsearch/" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_URL="https://projects.vdr-developer.org/git/vdr-plugin-epgsearch.git/snapshot/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS_TARGET="toolchain vdr" PKG_PRIORITY="optional" PKG_SECTION="multimedia" diff --git a/packages/multimedia/vdr-epgsearch/patches/vdr-epgsearch-01-pkgconfig.patch b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-epgsearch/patches/vdr-plugin-epgsearch-01-pkgconfig.patch similarity index 100% rename from packages/multimedia/vdr-epgsearch/patches/vdr-epgsearch-01-pkgconfig.patch rename to packages/addons/addon-depends/vdr-plugins/vdr-plugin-epgsearch/patches/vdr-plugin-epgsearch-01-pkgconfig.patch diff --git a/packages/multimedia/vdr-epgsearch/patches/vdr-epgsearch-02_don-t-build-unused-plugins.patch b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-epgsearch/patches/vdr-plugin-epgsearch-02_don-t-build-unused-plugins.patch similarity index 100% rename from packages/multimedia/vdr-epgsearch/patches/vdr-epgsearch-02_don-t-build-unused-plugins.patch rename to packages/addons/addon-depends/vdr-plugins/vdr-plugin-epgsearch/patches/vdr-plugin-epgsearch-02_don-t-build-unused-plugins.patch diff --git a/packages/multimedia/vdr-iptv/package.mk b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-iptv/package.mk similarity index 94% rename from packages/multimedia/vdr-iptv/package.mk rename to packages/addons/addon-depends/vdr-plugins/vdr-plugin-iptv/package.mk index 38a0ec0fb0e..57da7cf7683 100644 --- a/packages/multimedia/vdr-iptv/package.mk +++ b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-iptv/package.mk @@ -16,13 +16,13 @@ # along with OpenELEC. If not, see . ################################################################################ -PKG_NAME="vdr-iptv" +PKG_NAME="vdr-plugin-iptv" PKG_VERSION="2.2.1" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.saunalahti.fi/~rahrenbe/vdr/iptv/" -PKG_URL="http://www.saunalahti.fi/~rahrenbe/vdr/iptv/files/$PKG_NAME-$PKG_VERSION.tgz" +PKG_URL="http://www.saunalahti.fi/~rahrenbe/vdr/iptv/files/${PKG_NAME/-plugin/}-$PKG_VERSION.tgz" PKG_SOURCE_DIR="iptv-${PKG_VERSION}" PKG_DEPENDS_TARGET="toolchain vdr curl" PKG_PRIORITY="optional" diff --git a/packages/multimedia/vdr-iptv/patches/vdr-iptv-pkgconfig.patch b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-iptv/patches/vdr-plugin-iptv-pkgconfig.patch similarity index 100% rename from packages/multimedia/vdr-iptv/patches/vdr-iptv-pkgconfig.patch rename to packages/addons/addon-depends/vdr-plugins/vdr-plugin-iptv/patches/vdr-plugin-iptv-pkgconfig.patch diff --git a/packages/multimedia/vdr-live/package.mk b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-live/package.mk similarity index 90% rename from packages/multimedia/vdr-live/package.mk rename to packages/addons/addon-depends/vdr-plugins/vdr-plugin-live/package.mk index 269bbc35ada..ee6a9367282 100644 --- a/packages/multimedia/vdr-live/package.mk +++ b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-live/package.mk @@ -16,13 +16,13 @@ # along with OpenELEC. If not, see . ################################################################################ -PKG_NAME="vdr-live" +PKG_NAME="vdr-plugin-live" PKG_VERSION="0.3.0" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://live.vdr-developer.org/en/index.php" -PKG_URL="http://live.vdr-developer.org/downloads/${PKG_NAME}-${PKG_VERSION}.tar.gz" +PKG_URL="http://live.vdr-developer.org/downloads/${PKG_NAME/-plugin/}-${PKG_VERSION}.tar.gz" PKG_SOURCE_DIR="live-${PKG_VERSION}" PKG_DEPENDS_TARGET="toolchain vdr tntnet pcre:host pcre" PKG_PRIORITY="optional" @@ -36,7 +36,7 @@ PKG_AUTORECONF="no" pre_configure_target() { export CFLAGS="$CFLAGS -fPIC" export CXXFLAGS="$CXXFLAGS -fPIC" - export LDFLAGS="$LDFLAGS -fPIC" + export LDFLAGS="$LDFLAGS -fPIC -L$SYSROOT_PREFIX/usr/lib/iconv" } pre_make_target() { diff --git a/packages/multimedia/vdr-live/patches/vdr-live-0.3.0-04_tntnet-2.2-1.patch b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-live/patches/vdr-plugin-live-0.3.0-04_tntnet-2.2-1.patch similarity index 100% rename from packages/multimedia/vdr-live/patches/vdr-live-0.3.0-04_tntnet-2.2-1.patch rename to packages/addons/addon-depends/vdr-plugins/vdr-plugin-live/patches/vdr-plugin-live-0.3.0-04_tntnet-2.2-1.patch diff --git a/packages/multimedia/vdr-live/patches/vdr-live-0.3.0-04_tntnet-2.2-2.patch b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-live/patches/vdr-plugin-live-0.3.0-04_tntnet-2.2-2.patch similarity index 100% rename from packages/multimedia/vdr-live/patches/vdr-live-0.3.0-04_tntnet-2.2-2.patch rename to packages/addons/addon-depends/vdr-plugins/vdr-plugin-live/patches/vdr-plugin-live-0.3.0-04_tntnet-2.2-2.patch diff --git a/packages/multimedia/vdr-live/patches/vdr-live-0.3.0-05_vdr-2.1.2-buildfix.patch b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-live/patches/vdr-plugin-live-0.3.0-05_vdr-2.1.2-buildfix.patch similarity index 100% rename from packages/multimedia/vdr-live/patches/vdr-live-0.3.0-05_vdr-2.1.2-buildfix.patch rename to packages/addons/addon-depends/vdr-plugins/vdr-plugin-live/patches/vdr-plugin-live-0.3.0-05_vdr-2.1.2-buildfix.patch diff --git a/packages/multimedia/vdr-live/patches/vdr-live-0.3.0-06_dont-build-i18n.patch b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-live/patches/vdr-plugin-live-0.3.0-06_dont-build-i18n.patch similarity index 100% rename from packages/multimedia/vdr-live/patches/vdr-live-0.3.0-06_dont-build-i18n.patch rename to packages/addons/addon-depends/vdr-plugins/vdr-plugin-live/patches/vdr-plugin-live-0.3.0-06_dont-build-i18n.patch diff --git a/packages/multimedia/vdr-live/patches/vdr-live-pkgconfig.patch b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-live/patches/vdr-plugin-live-pkgconfig.patch similarity index 100% rename from packages/multimedia/vdr-live/patches/vdr-live-pkgconfig.patch rename to packages/addons/addon-depends/vdr-plugins/vdr-plugin-live/patches/vdr-plugin-live-pkgconfig.patch diff --git a/packages/multimedia/vdr-plugin-restfulapi/package.mk b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-restfulapi/package.mk similarity index 97% rename from packages/multimedia/vdr-plugin-restfulapi/package.mk rename to packages/addons/addon-depends/vdr-plugins/vdr-plugin-restfulapi/package.mk index c1fc0a24a2d..47dedc2ed1d 100644 --- a/packages/multimedia/vdr-plugin-restfulapi/package.mk +++ b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-restfulapi/package.mk @@ -23,7 +23,7 @@ PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="https://github.com/yavdr/vdr-plugin-restfulapi" PKG_URL="https://github.com/yavdr/${PKG_NAME}/releases/download/2.6.0/${PKG_NAME}-${PKG_VERSION}.tar.gz" -PKG_DEPENDS_TARGET="toolchain vdr cxxtools vdr-wirbelscan" +PKG_DEPENDS_TARGET="toolchain vdr cxxtools vdr-plugin-wirbelscan" PKG_PRIORITY="optional" PKG_SECTION="multimedia" PKG_SHORTDESC="vdr-plugin-restfulapi: the restful API for the VDR/" diff --git a/packages/multimedia/vdr-plugin-restfulapi/patches/vdr-plugin-restfulapi-pkgconfig.patch b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-restfulapi/patches/vdr-plugin-restfulapi-pkgconfig.patch similarity index 100% rename from packages/multimedia/vdr-plugin-restfulapi/patches/vdr-plugin-restfulapi-pkgconfig.patch rename to packages/addons/addon-depends/vdr-plugins/vdr-plugin-restfulapi/patches/vdr-plugin-restfulapi-pkgconfig.patch diff --git a/packages/multimedia/vdr-satip/package.mk b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-satip/package.mk similarity index 87% rename from packages/multimedia/vdr-satip/package.mk rename to packages/addons/addon-depends/vdr-plugins/vdr-plugin-satip/package.mk index abf54608bd7..aeb84a9e6f4 100644 --- a/packages/multimedia/vdr-satip/package.mk +++ b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-satip/package.mk @@ -16,19 +16,18 @@ # along with OpenELEC. If not, see . ################################################################################ -PKG_NAME="vdr-satip" -PKG_VERSION="2.2.3" +PKG_NAME="vdr-plugin-satip" +PKG_VERSION="18c9b79" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.saunalahti.fi/~rahrenbe/vdr/satip/" -PKG_URL="http://www.saunalahti.fi/~rahrenbe/vdr/satip/files/$PKG_NAME-$PKG_VERSION.tgz" -PKG_SOURCE_DIR="satip-${PKG_VERSION}" +PKG_URL="https://github.com/rofafor/vdr-plugin-satip/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain vdr curl tinyxml" PKG_PRIORITY="optional" PKG_SECTION="multimedia" -PKG_SHORTDESC="vdr-satip: SAT>IP plugin for VDR" -PKG_LONGDESC="vdr-satip is a SAT>IP plugin for VDR" +PKG_SHORTDESC="VDR-satip: SAT>IP plugin for VDR" +PKG_LONGDESC="This is an SAT>IP plugin for the Video Disk Recorder (VDR)." PKG_IS_ADDON="no" PKG_AUTORECONF="no" diff --git a/packages/multimedia/vdr-satip/patches/vdr-satip-01-pkgconfig.patch b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-satip/patches/vdr-plugin-satip-01-pkgconfig.patch similarity index 100% rename from packages/multimedia/vdr-satip/patches/vdr-satip-01-pkgconfig.patch rename to packages/addons/addon-depends/vdr-plugins/vdr-plugin-satip/patches/vdr-plugin-satip-01-pkgconfig.patch diff --git a/packages/multimedia/vdr-plugin-streamdev/package.mk b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-streamdev/package.mk similarity index 94% rename from packages/multimedia/vdr-plugin-streamdev/package.mk rename to packages/addons/addon-depends/vdr-plugins/vdr-plugin-streamdev/package.mk index 8c7d37480e1..4dec9081946 100644 --- a/packages/multimedia/vdr-plugin-streamdev/package.mk +++ b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-streamdev/package.mk @@ -22,7 +22,7 @@ PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://projects.vdr-developer.org/projects/plg-streamdev" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_URL="https://projects.vdr-developer.org/git/vdr-plugin-streamdev.git/snapshot/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS_TARGET="toolchain vdr libressl" PKG_PRIORITY="optional" PKG_SECTION="multimedia" diff --git a/packages/multimedia/vdr-plugin-vnsiserver/package.mk b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-vnsiserver/package.mk similarity index 94% rename from packages/multimedia/vdr-plugin-vnsiserver/package.mk rename to packages/addons/addon-depends/vdr-plugins/vdr-plugin-vnsiserver/package.mk index b3ca42248f9..33a5ee3aca9 100644 --- a/packages/multimedia/vdr-plugin-vnsiserver/package.mk +++ b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-vnsiserver/package.mk @@ -17,12 +17,12 @@ ################################################################################ PKG_NAME="vdr-plugin-vnsiserver" -PKG_VERSION="00b5779" +PKG_VERSION="c63d8e8" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="https://github.com/FernetMenta/vdr-plugin-vnsiserver" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_URL="https://github.com/FernetMenta/vdr-plugin-vnsiserver/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain vdr" PKG_PRIORITY="optional" PKG_SECTION="multimedia" diff --git a/packages/multimedia/vdr-wirbelscan/package.mk b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-wirbelscan/package.mk similarity index 92% rename from packages/multimedia/vdr-wirbelscan/package.mk rename to packages/addons/addon-depends/vdr-plugins/vdr-plugin-wirbelscan/package.mk index f158d8ba042..dd4b1f92e21 100644 --- a/packages/multimedia/vdr-wirbelscan/package.mk +++ b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-wirbelscan/package.mk @@ -16,13 +16,13 @@ # along with OpenELEC. If not, see . ################################################################################ -PKG_NAME="vdr-wirbelscan" +PKG_NAME="vdr-plugin-wirbelscan" PKG_VERSION="0.0.9" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://wirbel.htpc-forum.de/wirbelscan/index2.html" -PKG_URL="http://wirbel.htpc-forum.de/wirbelscan/$PKG_NAME-$PKG_VERSION.tgz" +PKG_URL="http://wirbel.htpc-forum.de/wirbelscan/${PKG_NAME/-plugin/}-$PKG_VERSION.tgz" PKG_SOURCE_DIR="wirbelscan-${PKG_VERSION}" PKG_DEPENDS_TARGET="toolchain vdr" PKG_PRIORITY="optional" diff --git a/packages/multimedia/vdr-wirbelscan/patches/vdr-wirbelscan-01_fix-dvbs-scan.patch b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-wirbelscan/patches/vdr-plugin-wirbelscan-01_fix-dvbs-scan.patch similarity index 100% rename from packages/multimedia/vdr-wirbelscan/patches/vdr-wirbelscan-01_fix-dvbs-scan.patch rename to packages/addons/addon-depends/vdr-plugins/vdr-plugin-wirbelscan/patches/vdr-plugin-wirbelscan-01_fix-dvbs-scan.patch diff --git a/packages/multimedia/vdr-wirbelscan/patches/vdr-wirbelscan-02_fix-wirbelscancontrol.patch b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-wirbelscan/patches/vdr-plugin-wirbelscan-02_fix-wirbelscancontrol.patch similarity index 100% rename from packages/multimedia/vdr-wirbelscan/patches/vdr-wirbelscan-02_fix-wirbelscancontrol.patch rename to packages/addons/addon-depends/vdr-plugins/vdr-plugin-wirbelscan/patches/vdr-plugin-wirbelscan-02_fix-wirbelscancontrol.patch diff --git a/packages/multimedia/vdr-wirbelscancontrol/package.mk b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-wirbelscancontrol/package.mk similarity index 86% rename from packages/multimedia/vdr-wirbelscancontrol/package.mk rename to packages/addons/addon-depends/vdr-plugins/vdr-plugin-wirbelscancontrol/package.mk index 009ffeb568e..5d6458f27dc 100644 --- a/packages/multimedia/vdr-wirbelscancontrol/package.mk +++ b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-wirbelscancontrol/package.mk @@ -16,15 +16,15 @@ # along with OpenELEC. If not, see . ################################################################################ -PKG_NAME="vdr-wirbelscancontrol" +PKG_NAME="vdr-plugin-wirbelscancontrol" PKG_VERSION="0.0.2" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://wirbel.htpc-forum.de/wirbelscancontrol/index2.html" -PKG_URL="http://wirbel.htpc-forum.de/wirbelscancontrol/$PKG_NAME-$PKG_VERSION.tgz" +PKG_URL="http://wirbel.htpc-forum.de/wirbelscancontrol/${PKG_NAME/-plugin/}-$PKG_VERSION.tgz" PKG_SOURCE_DIR="wirbelscancontrol-${PKG_VERSION}" -PKG_DEPENDS_TARGET="toolchain vdr vdr-wirbelscan" +PKG_DEPENDS_TARGET="toolchain vdr vdr-plugin-wirbelscan" PKG_PRIORITY="optional" PKG_SECTION="multimedia" PKG_SHORTDESC="TV" @@ -41,7 +41,7 @@ pre_configure_target() { } pre_build_target() { - WIRBELSCAN_DIR=$(get_build_dir vdr-wirbelscan) + WIRBELSCAN_DIR=$(get_build_dir vdr-plugin-wirbelscan) ln -sf $WIRBELSCAN_DIR/wirbelscan_services.h $PKG_BUILD } diff --git a/packages/multimedia/vdr-wirbelscancontrol/patches/vdr-wirbelscancontrol-01-dont-build-i18n.patch b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-wirbelscancontrol/patches/vdr-plugin-wirbelscancontrol-01-dont-build-i18n.patch similarity index 100% rename from packages/multimedia/vdr-wirbelscancontrol/patches/vdr-wirbelscancontrol-01-dont-build-i18n.patch rename to packages/addons/addon-depends/vdr-plugins/vdr-plugin-wirbelscancontrol/patches/vdr-plugin-wirbelscancontrol-01-dont-build-i18n.patch diff --git a/packages/multimedia/vdr-plugin-xmltv2vdr/package.mk b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-xmltv2vdr/package.mk similarity index 97% rename from packages/multimedia/vdr-plugin-xmltv2vdr/package.mk rename to packages/addons/addon-depends/vdr-plugins/vdr-plugin-xmltv2vdr/package.mk index c2c11d01b9d..eae3457e414 100644 --- a/packages/multimedia/vdr-plugin-xmltv2vdr/package.mk +++ b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-xmltv2vdr/package.mk @@ -37,6 +37,7 @@ pre_configure_target() { export CFLAGS="$CFLAGS -fPIC" export CXXFLAGS="$CXXFLAGS -fPIC" export LDFLAGS="$LDFLAGS -fPIC" + export LIBS="-L$SYSROOT_PREFIX/usr/lib/iconv" } make_target() { diff --git a/packages/multimedia/vdr-plugin-xmltv2vdr/patches/vdr-plugin-xmltv2vdr-01_dont-build-i18n.patch b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-xmltv2vdr/patches/vdr-plugin-xmltv2vdr-01_dont-build-i18n.patch similarity index 100% rename from packages/multimedia/vdr-plugin-xmltv2vdr/patches/vdr-plugin-xmltv2vdr-01_dont-build-i18n.patch rename to packages/addons/addon-depends/vdr-plugins/vdr-plugin-xmltv2vdr/patches/vdr-plugin-xmltv2vdr-01_dont-build-i18n.patch diff --git a/packages/multimedia/vdr/package.mk b/packages/addons/addon-depends/vdr/package.mk similarity index 90% rename from packages/multimedia/vdr/package.mk rename to packages/addons/addon-depends/vdr/package.mk index 53b425ba595..b04dbf0bf90 100644 --- a/packages/multimedia/vdr/package.mk +++ b/packages/addons/addon-depends/vdr/package.mk @@ -24,7 +24,7 @@ PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.tvdr.de" PKG_URL="ftp://ftp.tvdr.de/vdr/$PKG_NAME-$PKG_VERSION.tar.bz2" -PKG_DEPENDS_TARGET="toolchain fontconfig freetype libcap libjpeg-turbo bzip2" +PKG_DEPENDS_TARGET="toolchain fontconfig freetype libcap libiconv libjpeg-turbo bzip2" PKG_PRIORITY="optional" PKG_SECTION="multimedia" PKG_SHORTDESC="vdr: A powerful DVB TV application" @@ -38,7 +38,7 @@ post_unpack() { } pre_configure_target() { - export LDFLAGS=$(echo $LDFLAGS | sed -e "s|-Wl,--as-needed||") + export LDFLAGS="$(echo $LDFLAGS | sed -e "s|-Wl,--as-needed||") -L$SYSROOT_PREFIX/usr/lib/iconv" } pre_make_target() { @@ -48,7 +48,7 @@ pre_make_target() { VIDEODIR = /storage/videos CONFDIR = /storage/.config/vdr LOCDIR = /usr/share/locale - + LIBS += -liconv NO_KBD=yes VDR_USER=root EOF diff --git a/packages/multimedia/vdr/patches/vdr-01_disable_ca_updates.patch b/packages/addons/addon-depends/vdr/patches/vdr-01_disable_ca_updates.patch similarity index 100% rename from packages/multimedia/vdr/patches/vdr-01_disable_ca_updates.patch rename to packages/addons/addon-depends/vdr/patches/vdr-01_disable_ca_updates.patch diff --git a/packages/multimedia/vdr/patches/vdr-10_decrease-channels.conf-autosave-delay.patch b/packages/addons/addon-depends/vdr/patches/vdr-10_decrease-channels.conf-autosave-delay.patch similarity index 100% rename from packages/multimedia/vdr/patches/vdr-10_decrease-channels.conf-autosave-delay.patch rename to packages/addons/addon-depends/vdr/patches/vdr-10_decrease-channels.conf-autosave-delay.patch diff --git a/packages/addons/browser/chromium/changelog.txt b/packages/addons/browser/chromium/changelog.txt new file mode 100644 index 00000000000..9d4e5652473 --- /dev/null +++ b/packages/addons/browser/chromium/changelog.txt @@ -0,0 +1,5 @@ +7.0.101 +- update to version 50.0.2661.75 + +7.0.100 +- initial LibreELEC release diff --git a/packages/addons/browser/chromium/config/Xdefaults b/packages/addons/browser/chromium/config/Xdefaults new file mode 100644 index 00000000000..95307ee3dbd --- /dev/null +++ b/packages/addons/browser/chromium/config/Xdefaults @@ -0,0 +1 @@ +Xft.dpi: 96 diff --git a/packages/addons/browser/chromium/config/pango.modules b/packages/addons/browser/chromium/config/pango.modules new file mode 100644 index 00000000000..3a7ae71db4a --- /dev/null +++ b/packages/addons/browser/chromium/config/pango.modules @@ -0,0 +1,13 @@ +/storage/.kodi/addons/browser.chromium/pango-modules/pango-arabic-lang.so ArabicScriptEngineLang PangoEngineLang PangoRenderNone arabic:* +/storage/.kodi/addons/browser.chromium/pango-modules/pango-basic-fc.so BasicScriptEngineFc PangoEngineShape PangoRenderFc common: +/storage/.kodi/addons/browser.chromium/pango-modules/pango-indic-lang.so devaIndicScriptEngineLang PangoEngineLang PangoRenderNone devanagari:* +/storage/.kodi/addons/browser.chromium/pango-modules/pango-indic-lang.so bengIndicScriptEngineLang PangoEngineLang PangoRenderNone bengali:* +/storage/.kodi/addons/browser.chromium/pango-modules/pango-indic-lang.so guruIndicScriptEngineLang PangoEngineLang PangoRenderNone gurmukhi:* +/storage/.kodi/addons/browser.chromium/pango-modules/pango-indic-lang.so gujrIndicScriptEngineLang PangoEngineLang PangoRenderNone gujarati:* +/storage/.kodi/addons/browser.chromium/pango-modules/pango-indic-lang.so oryaIndicScriptEngineLang PangoEngineLang PangoRenderNone oriya:* +/storage/.kodi/addons/browser.chromium/pango-modules/pango-indic-lang.so tamlIndicScriptEngineLang PangoEngineLang PangoRenderNone tamil:* +/storage/.kodi/addons/browser.chromium/pango-modules/pango-indic-lang.so teluIndicScriptEngineLang PangoEngineLang PangoRenderNone telugu:* +/storage/.kodi/addons/browser.chromium/pango-modules/pango-indic-lang.so kndaIndicScriptEngineLang PangoEngineLang PangoRenderNone kannada:* +/storage/.kodi/addons/browser.chromium/pango-modules/pango-indic-lang.so mlymIndicScriptEngineLang PangoEngineLang PangoRenderNone malayalam:* +/storage/.kodi/addons/browser.chromium/pango-modules/pango-indic-lang.so sinhIndicScriptEngineLang PangoEngineLang PangoRenderNone sinhala:* + diff --git a/packages/addons/browser/chromium/config/pangorc b/packages/addons/browser/chromium/config/pangorc new file mode 100644 index 00000000000..e7a942d7127 --- /dev/null +++ b/packages/addons/browser/chromium/config/pangorc @@ -0,0 +1,10 @@ +# +# pangorc file for uninstalled operation. If pango-viewer is run with +# this file in the current directory it will set it as PANGO_RC_FILE +# + +[Pango] +ModuleFiles = /storage/.kodi/addons/browser.chromium/config/pango.modules + +[PangoX] +AliasFiles = /storage/.kodi/addons/browser.chromium/config/pangx.aliases diff --git a/packages/addons/browser/chromium/config/pixbuf.loaders.cache b/packages/addons/browser/chromium/config/pixbuf.loaders.cache new file mode 100644 index 00000000000..62ef3707da8 --- /dev/null +++ b/packages/addons/browser/chromium/config/pixbuf.loaders.cache @@ -0,0 +1,125 @@ +"/storage/.kodi/addons/browser.chromium/gdk-pixbuf-modules/libpixbufloader-jpeg.so" +"jpeg" 5 "gdk-pixbuf" "The JPEG image format" "LGPL" +"image/jpeg" "" +"jpeg" "jpe" "jpg" "" +"\377\330" "" 100 + +"/storage/.kodi/addons/browser.chromium/gdk-pixbuf-modules/libpixbufloader-ani.so" +"ani" 4 "gdk-pixbuf" "The ANI image format" "LGPL" +"application/x-navi-animation" "" +"ani" "" +"RIFF ACON" " xxxx " 100 + +"/storage/.kodi/addons/browser.chromium/gdk-pixbuf-modules/libpixbufloader-ico.so" +"ico" 5 "gdk-pixbuf" "The ICO image format" "LGPL" +"image/x-icon" "image/x-ico" "image/x-win-bitmap" "" +"ico" "cur" "" +" \001 " "zz znz" 100 +" \002 " "zz znz" 100 + +"/storage/.kodi/addons/browser.chromium/gdk-pixbuf-modules/libpixbufloader-ras.so" +"ras" 4 "gdk-pixbuf" "The Sun raster image format" "LGPL" +"image/x-cmu-raster" "image/x-sun-raster" "" +"ras" "" +"Y\246j\225" "" 100 + +"/storage/.kodi/addons/browser.chromium/gdk-pixbuf-modules/libpixbufloader-jasper.so" +"jpeg2000" 4 "gdk-pixbuf" "The JPEG 2000 image format" "LGPL" +"image/jp2" "image/jpeg2000" "image/jpx" "" +"jp2" "jpc" "jpx" "j2k" "jpf" "" +" jP" "!!!! " 100 +"\377O\377Q" "" 100 + +"/storage/.kodi/addons/browser.chromium/gdk-pixbuf-modules/libpixbufloader-wbmp.so" +"wbmp" 4 "gdk-pixbuf" "The WBMP image format" "LGPL" +"image/vnd.wap.wbmp" "" +"wbmp" "" +" " "zz" 1 +" `" "z " 1 +" @" "z " 1 +" " "z " 1 + +"/storage/.kodi/addons/browser.chromium/gdk-pixbuf-modules/libpixbufloader-png.so" +"png" 5 "gdk-pixbuf" "The PNG image format" "LGPL" +"image/png" "" +"png" "" +"\211PNG\r\n\032\n" "" 100 + +"/storage/.kodi/addons/browser.chromium/gdk-pixbuf-modules/libpixbufloader-pcx.so" +"pcx" 4 "gdk-pixbuf" "The PCX image format" "LGPL" +"image/x-pcx" "" +"pcx" "" +"\n \001" "" 100 +"\n\002\001" "" 100 +"\n\003\001" "" 100 +"\n\004\001" "" 100 +"\n\005\001" "" 100 + +"/storage/.kodi/addons/browser.chromium/gdk-pixbuf-modules/libpixbufloader-qtif.so" +"qtif" 4 "gdk-pixbuf" "The QTIF image format" "LGPL" +"image/x-quicktime" "image/qtif" "" +"qtif" "qif" "" +"abcdidsc" "xxxx " 100 +"abcdidat" "xxxx " 100 + +"/storage/.kodi/addons/browser.chromium/gdk-pixbuf-modules/libpixbufloader-tiff.so" +"tiff" 5 "gdk-pixbuf" "The TIFF image format" "LGPL" +"image/tiff" "" +"tiff" "tif" "" +"MM *" " z " 100 +"II* " " z" 100 +"II* \020 CR\002 " " z zzz z" 0 + +"/storage/.kodi/addons/browser.chromium/gdk-pixbuf-modules/libpixbufloader-icns.so" +"icns" 4 "gdk-pixbuf" "The ICNS image format" "GPL" +"image/x-icns" "" +"icns" "" +"icns" "" 100 + +"/storage/.kodi/addons/browser.chromium/gdk-pixbuf-modules/libpixbufloader-tga.so" +"tga" 4 "gdk-pixbuf" "The Targa image format" "LGPL" +"image/x-tga" "" +"tga" "targa" "" +" \001\001" "x " 100 +" \001\t" "x " 100 +" \002" "xz " 99 +" \003" "xz " 100 +" \n" "xz " 100 +" \v" "xz " 100 + +"/storage/.kodi/addons/browser.chromium/gdk-pixbuf-modules/libpixbufloader-bmp.so" +"bmp" 5 "gdk-pixbuf" "The BMP image format" "LGPL" +"image/bmp" "image/x-bmp" "image/x-MS-bmp" "" +"bmp" "" +"BM" "" 100 + +"/storage/.kodi/addons/browser.chromium/gdk-pixbuf-modules/libpixbufloader-xbm.so" +"xbm" 4 "gdk-pixbuf" "The XBM image format" "LGPL" +"image/x-xbitmap" "" +"xbm" "" +"#define " "" 100 +"/*" "" 50 + +"/storage/.kodi/addons/browser.chromium/gdk-pixbuf-modules/libpixbufloader-xpm.so" +"xpm" 4 "gdk-pixbuf" "The XPM image format" "LGPL" +"image/x-xpixmap" "" +"xpm" "" +"/* XPM */" "" 100 + +"/storage/.kodi/addons/browser.chromium/gdk-pixbuf-modules/libpixbufloader-pnm.so" +"pnm" 4 "gdk-pixbuf" "The PNM/PBM/PGM/PPM image format family" "LGPL" +"image/x-portable-anymap" "image/x-portable-bitmap" "image/x-portable-graymap" "image/x-portable-pixmap" "" +"pnm" "pbm" "pgm" "ppm" "" +"P1" "" 100 +"P2" "" 100 +"P3" "" 100 +"P4" "" 100 +"P5" "" 100 +"P6" "" 100 + +"/storage/.kodi/addons/browser.chromium/gdk-pixbuf-modules/libpixbufloader-gif.so" +"gif" 4 "gdk-pixbuf" "The GIF image format" "LGPL" +"image/gif" "" +"gif" "" +"GIF8" "" 100 + diff --git a/packages/addons/browser/chromium/icon/icon.png b/packages/addons/browser/chromium/icon/icon.png new file mode 100644 index 00000000000..033fb10f711 Binary files /dev/null and b/packages/addons/browser/chromium/icon/icon.png differ diff --git a/packages/addons/browser/chromium/package.mk b/packages/addons/browser/chromium/package.mk new file mode 100644 index 00000000000..c87032b216e --- /dev/null +++ b/packages/addons/browser/chromium/package.mk @@ -0,0 +1,174 @@ +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) +# +# This Program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This Program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with OpenELEC.tv; see the file COPYING. If not, write to +# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. +# http://www.gnu.org/copyleft/gpl.html +################################################################################ + +PKG_NAME="chromium" +PKG_VERSION="50.0.2661.75" +PKG_REV="101" +PKG_ARCH="x86_64" +PKG_LICENSE="Mixed" +PKG_SITE="http://www.chromium.org/Home" +PKG_URL="https://commondatastorage.googleapis.com/chromium-browser-official/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_DEPENDS_TARGET="toolchain pciutils dbus libXcomposite libXcursor libXtst alsa-lib bzip2 yasm nss libXScrnSaver libexif ninja:host libpng harfbuzz atk gtk+ libva-vdpau-driver" +PKG_PRIORITY="optional" +PKG_SECTION="browser" +PKG_SHORTDESC="Chromium Browser: the open-source web browser from Google" +PKG_LONGDESC="Chromium Browser: the open-source web browser from Google" +PKG_AUTORECONF="no" + +PKG_IS_ADDON="yes" +PKG_ADDON_NAME="Chromium" +PKG_ADDON_TYPE="xbmc.python.script" +PKG_ADDON_PROVIDES="executable" +PKG_ADDON_REPOVERSION="8.0" + +pre_make_target() { + export MAKEFLAGS="-j4" + + strip_lto + + # https://groups.google.com/a/chromium.org/d/topic/chromium-packagers/9JX1N2nf4PU/discussion + touch chrome/test/data/webui/i18n_process_css_test.html +} + +make_target() { + # CFLAGS are passed through release_extra_cflags below + export -n CFLAGS CXXFLAGS + + export LDFLAGS="$LDFLAGS -ludev" + + # Google API keys (see http://www.chromium.org/developers/how-tos/api-keys) + # Note: These are for OpenELEC use ONLY. For your own distribution, please + # get your own set of keys. + + _google_api_key=AIzaSyAQ6L9vt9cnN4nM0weaa6Y38K4eyPvtKgI + _google_default_client_id=740889307901-4bkm4e0udppnp1lradko85qsbnmkfq3b.apps.googleusercontent.com + _google_default_client_secret=9TJlhL661hvShQub4cWhANXa + + local _chromium_conf=( + -Dgoogle_api_key=$_google_api_key + -Dgoogle_default_client_id=$_google_default_client_id + -Dgoogle_default_client_secret=$_google_default_client_secret + -Dtarget_arch=x64 + -Dfastbuild=2 + -Dwerror= + -Dclang=0 + -Dpython_ver=2.7 + -Dlinux_link_gsettings=0 + -Dlinux_strip_binary=1 + -Dlinux_use_bundled_binutils=0 + -Dlinux_use_bundled_gold=0 + -Dlinux_use_gold_flags=0 + -Dicu_use_data_file_flag=1 + -Dlogging_like_official_build=1 + -Dtracing_like_official_build=1 + -Dfieldtrial_testing_like_official_build=1 + -Dremove_webcore_debug_symbols=1 + -Drelease_extra_cflags="$CFLAGS" + -Dlibspeechd_h_prefix=speech-dispatcher/ + -Dffmpeg_branding=Chrome + -Dproprietary_codecs=1 + -Duse_system_bzip2=1 + -Duse_system_flac=0 + -Duse_system_ffmpeg=0 + -Duse_system_harfbuzz=1 + -Duse_system_icu=0 + -Duse_system_libevent=0 + -Duse_system_libjpeg=1 + -Duse_system_libpng=1 + -Duse_system_libvpx=0 + -Duse_system_libxml=0 + -Duse_system_snappy=0 + -Duse_system_xdg_utils=0 + -Duse_system_yasm=1 + -Duse_system_zlib=0 + -Duse_mojo=0 + -Duse_gconf=0 + -Duse_gnome_keyring=0 + -Duse_pulseaudio=0 + -Duse_kerberos=0 + -Duse_cups=0 + -Denable_hangout_services_extension=1 + -Ddisable_fatal_linker_warnings=1 + -Dsysroot=$SYSROOT_PREFIX + -Ddisable_glibc=1 + -Denable_widevine=1 + -Ddisable_nacl=1 + -Ddisable_pnacl=1) + + ./build/linux/unbundle/replace_gyp_files.py "${_chromium_conf[@]}" + ./build/gyp_chromium --depth=. "${_chromium_conf[@]}" + + ninja -C out/Release chrome chrome_sandbox +} + +makeinstall_target() { + : +} + +addon() { + mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/bin + cp -P $PKG_BUILD/out/Release/chrome $ADDON_BUILD/$PKG_ADDON_ID/bin/chromium.bin + cp -P $PKG_BUILD/out/Release/chrome_sandbox $ADDON_BUILD/$PKG_ADDON_ID/bin/chrome-sandbox + cp -P $PKG_BUILD/out/Release/{*.pak,*.dat,*.bin,libwidevinecdmadapter.so} $ADDON_BUILD/$PKG_ADDON_ID/bin + cp -PR $PKG_BUILD/out/Release/locales $ADDON_BUILD/$PKG_ADDON_ID/bin/ + + $STRIP $ADDON_BUILD/$PKG_ADDON_ID/bin/chromium.bin + $STRIP $ADDON_BUILD/$PKG_ADDON_ID/bin/chrome-sandbox + + # config + mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/config + cp -P $PKG_DIR/config/* $ADDON_BUILD/$PKG_ADDON_ID/config + + mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/lib + + # pango + cp -PL $(get_build_dir pango)/.install_pkg/usr/lib/libpangocairo-1.0.so.0 $ADDON_BUILD/$PKG_ADDON_ID/lib + cp -PL $(get_build_dir pango)/.install_pkg/usr/lib/libpango-1.0.so.0 $ADDON_BUILD/$PKG_ADDON_ID/lib + cp -PL $(get_build_dir pango)/.install_pkg/usr/lib/libpangoft2-1.0.so.0 $ADDON_BUILD/$PKG_ADDON_ID/lib + + # cairo + cp -PL $(get_build_dir cairo)/.install_pkg/usr/lib/libcairo.so.2 $ADDON_BUILD/$PKG_ADDON_ID/lib + + # gtk + cp -PL $(get_build_dir gtk+)/.install_pkg/usr/lib/libgdk-x11-2.0.so.0 $ADDON_BUILD/$PKG_ADDON_ID/lib + cp -PL $(get_build_dir gtk+)/.install_pkg/usr/lib/libgtk-x11-2.0.so.0 $ADDON_BUILD/$PKG_ADDON_ID/lib + + # harfbuzz + cp -PL $(get_build_dir harfbuzz)/.install_pkg/usr/lib/libharfbuzz.so.0 $ADDON_BUILD/$PKG_ADDON_ID/lib + + # gdk-pixbuf + cp -PL $(get_build_dir gdk-pixbuf)/.install_pkg/usr/lib/libgdk_pixbuf-2.0.so.0 $ADDON_BUILD/$PKG_ADDON_ID/lib + + # pixbuf loaders + mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/gdk-pixbuf-modules + cp -PL $(get_build_dir gdk-pixbuf)/.install_pkg/usr/lib/gdk-pixbuf-2.0/2.10.0/loaders/* $ADDON_BUILD/$PKG_ADDON_ID/gdk-pixbuf-modules + + # nss + cp -PL $(get_build_dir nss)/dist/Linux*OPT.OBJ/lib/*.so $ADDON_BUILD/$PKG_ADDON_ID/lib + + # nspr + cp -PL $(get_build_dir nspr)/.install_pkg/usr/lib/*.so $ADDON_BUILD/$PKG_ADDON_ID/lib + + # libexif + cp -PL $(get_build_dir libexif)/.install_pkg/usr/lib/* $ADDON_BUILD/$PKG_ADDON_ID/lib + + # libva-vdpau-driver + cp -PL $(get_build_dir libva-vdpau-driver)/.install_pkg/usr/lib/va/*.so $ADDON_BUILD/$PKG_ADDON_ID/lib +} diff --git a/packages/addons/browser/chromium/patches/chromium-0001_widevine.patch b/packages/addons/browser/chromium/patches/chromium-0001_widevine.patch new file mode 100644 index 00000000000..eb06138905e --- /dev/null +++ b/packages/addons/browser/chromium/patches/chromium-0001_widevine.patch @@ -0,0 +1,53 @@ +diff -upr chromium-48.0.2564.82.orig/chrome/common/chrome_content_client.cc chromium-48.0.2564.82/chrome/common/chrome_content_client.cc +--- chromium-48.0.2564.82.orig/chrome/common/chrome_content_client.cc 2016-01-20 22:01:20.000000000 +0200 ++++ chromium-48.0.2564.82/chrome/common/chrome_content_client.cc 2016-01-21 20:02:02.788936626 +0200 +@@ -158,7 +158,12 @@ void ComputeBuiltInPlugins(std::vector*create_vda_function)(); + if (!video_decode_accelerator_ || + !video_decode_accelerator_->Initialize(config, this)) + continue; + ++ VLOG(1) << "Initialization successful."; ++ + if (video_decode_accelerator_->CanDecodeOnIOThread()) { + filter_ = new MessageFilter(this, host_route_id_); + stub_->channel()->AddFilter(filter_.get()); +@@ -346,7 +351,9 @@ void GpuVideoDecodeAccelerator::BindImag + scoped_ptr + GpuVideoDecodeAccelerator::CreateVaapiVDA() { + scoped_ptr decoder; +-#if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) ++ VLOG(1) << "About to create new VAAPI video decode accelerator."; ++#if (defined(OS_CHROMEOS) || defined(OS_LINUX)) && defined(ARCH_CPU_X86_FAMILY) ++ VLOG(1) << "Creating new VAAPI video decode accelerator."; + decoder.reset(new VaapiVideoDecodeAccelerator( + make_context_current_, base::Bind(&GpuVideoDecodeAccelerator::BindImage, + base::Unretained(this)))); +Index: dev.wily/content/content_common.gypi +=================================================================== +--- dev.wily.orig/content/content_common.gypi ++++ dev.wily/content/content_common.gypi +@@ -856,7 +856,7 @@ + }, + ], + }], +- ['chromeos==1', { ++ ['chromeos==1 or desktop_linux==1', { + 'sources': [ + 'common/gpu/media/accelerated_video_decoder.h', + 'common/gpu/media/h264_decoder.cc', +@@ -908,7 +908,7 @@ + 'common/gpu/media/tegra_v4l2_device.h', + ], + }], +- ['target_arch != "arm" and chromeos == 1', { ++ ['target_arch != "arm" and (chromeos == 1 or desktop_linux == 1)', { + 'dependencies': [ + '../media/media.gyp:media', + '../third_party/libyuv/libyuv.gyp:libyuv', +Index: dev.wily/content/content_gpu.gypi +=================================================================== +--- dev.wily.orig/content/content_gpu.gypi ++++ dev.wily/content/content_gpu.gypi +@@ -36,7 +36,7 @@ + ], + }, + }], +- ['target_arch!="arm" and chromeos == 1', { ++ ['target_arch!="arm" and (chromeos == 1 or desktop_linux == 1)', { + 'include_dirs': [ + '<(DEPTH)/third_party/libva', + ], +Index: dev.wily/content/content_tests.gypi +=================================================================== +--- dev.wily.orig/content/content_tests.gypi ++++ dev.wily/content/content_tests.gypi +@@ -1719,7 +1719,7 @@ + }, + ] + }], +- ['chromeos==1 and target_arch != "arm"', { ++ ['(chromeos==1 or desktop_linux==1) and target_arch != "arm"', { + 'targets': [ + { + 'target_name': 'vaapi_jpeg_decoder_unittest', +Index: dev.wily/content/public/common/content_switches.cc +=================================================================== +--- dev.wily.orig/content/public/common/content_switches.cc ++++ dev.wily/content/public/common/content_switches.cc +@@ -926,7 +926,9 @@ const char kDisableWebAudio[] + #if defined(OS_CHROMEOS) + // Disables panel fitting (used for mirror mode). + const char kDisablePanelFitting[] = "disable-panel-fitting"; ++#endif + ++#if defined(OS_CHROMEOS) || defined(OS_LINUX) + // Disables VA-API accelerated video encode. + const char kDisableVaapiAcceleratedVideoEncode[] = + "disable-vaapi-accelerated-video-encode"; +Index: dev.wily/content/public/common/content_switches.h +=================================================================== +--- dev.wily.orig/content/public/common/content_switches.h ++++ dev.wily/content/public/common/content_switches.h +@@ -272,6 +272,8 @@ CONTENT_EXPORT extern const char kDisabl + + #if defined(OS_CHROMEOS) + CONTENT_EXPORT extern const char kDisablePanelFitting[]; ++#endif ++#if defined(OS_CHROMEOS) || defined(OS_LINUX) + CONTENT_EXPORT extern const char kDisableVaapiAcceleratedVideoEncode[]; + #endif + +Index: dev.wily/media/media.gyp +=================================================================== +--- dev.wily.orig/media/media.gyp ++++ dev.wily/media/media.gyp +@@ -756,7 +756,7 @@ + ], + }], + # For VaapiVideoEncodeAccelerator. +- ['target_arch != "arm" and chromeos == 1', { ++ ['target_arch != "arm" and (chromeos == 1 or desktop_linux == 1)', { + 'sources': [ + 'filters/h264_bitstream_buffer.cc', + 'filters/h264_bitstream_buffer.h', +@@ -1359,7 +1359,7 @@ + 'player_android', + ], + }], +- ['target_arch != "arm" and chromeos == 1 and use_x11 == 1', { ++ ['target_arch != "arm" and (chromeos == 1 or desktop_linux == 1) and use_x11 == 1', { + 'sources': [ + 'filters/h264_bitstream_buffer_unittest.cc', + ], +Index: dev.wily/gpu/config/software_rendering_list_json.cc +=================================================================== +--- dev.wily.orig/gpu/config/software_rendering_list_json.cc ++++ dev.wily/gpu/config/software_rendering_list_json.cc +@@ -481,17 +481,6 @@ const char kSoftwareRenderingListJson[] + ] + }, + { +- "id": 48, +- "description": "Accelerated video decode is unavailable on Linux", +- "cr_bugs": [137247], +- "os": { +- "type": "linux" +- }, +- "features": [ +- "accelerated_video_decode" +- ] +- }, +- { + "id": 49, + "description": "NVidia GeForce GT 650M can cause the system to hang with flash 3D", + "cr_bugs": [140175], +@@ -1042,6 +1042,11 @@ + }, + { + "os": { ++ "type": "linux" ++ } ++ }, ++ { ++ "os": { + "type": "android" + }, + "gl_renderer": ".*Google.*" +Index: dev.wily/content/common/sandbox_linux/bpf_gpu_policy_linux.cc +=================================================================== +--- dev.wily.orig/content/common/sandbox_linux/bpf_gpu_policy_linux.cc ++++ dev.wily/content/common/sandbox_linux/bpf_gpu_policy_linux.cc +@@ -21,6 +21,8 @@ + #include "base/logging.h" + #include "base/memory/scoped_ptr.h" + #include "build/build_config.h" ++// Auto-generated for dlopen libva libraries ++#include "content/common/gpu/media/va_stubs.h" + #include "content/common/sandbox_linux/sandbox_bpf_base_policy_linux.h" + #include "content/common/sandbox_linux/sandbox_seccomp_bpf_linux.h" + #include "content/common/set_process_title.h" +@@ -31,6 +33,8 @@ + #include "sandbox/linux/syscall_broker/broker_file_permission.h" + #include "sandbox/linux/syscall_broker/broker_process.h" + #include "sandbox/linux/system_headers/linux_syscalls.h" ++#include "third_party/libva/va/va.h" ++#include "third_party/libva/va/va_x11.h" + + using sandbox::arch_seccomp_data; + using sandbox::bpf_dsl::Allow; +@@ -40,6 +44,11 @@ using sandbox::syscall_broker::BrokerFil + using sandbox::syscall_broker::BrokerProcess; + using sandbox::SyscallSets; + ++using content_common_gpu_media::kModuleVa; ++using content_common_gpu_media::kModuleVa_x11; ++using content_common_gpu_media::InitializeStubs; ++using content_common_gpu_media::StubPathMap; ++ + namespace content { + + namespace { +@@ -94,7 +103,7 @@ inline bool UseLibV4L2() { + + bool IsAcceleratedVaapiVideoEncodeEnabled() { + bool accelerated_encode_enabled = false; +-#if defined(OS_CHROMEOS) ++#if defined(OS_CHROMEOS) || defined(OS_LINUX) + const base::CommandLine& command_line = + *base::CommandLine::ForCurrentProcess(); + accelerated_encode_enabled = +@@ -299,27 +299,41 @@ + // inside the sandbox, so preload them now. + if (IsAcceleratedVaapiVideoEncodeEnabled() || + IsAcceleratedVideoDecodeEnabled()) { +- const char* I965DrvVideoPath = NULL; +- const char* I965HybridDrvVideoPath = NULL; ++ VLOG(1) << "Attempting to enable hardware video acceleration."; ++ StubPathMap paths; ++ paths[kModuleVa].push_back("libva.so.1"); ++ paths[kModuleVa_x11].push_back("libva-x11.so.1"); ++ if (!InitializeStubs(paths)) { ++ VLOG(1) << "Failed to initialize stubs"; ++ return false; ++ } + +- if (IsArchitectureX86_64()) { +- I965DrvVideoPath = "/usr/lib64/va/drivers/i965_drv_video.so"; +- I965HybridDrvVideoPath = "/usr/lib64/va/drivers/hybrid_drv_video.so"; +- } else if (IsArchitectureI386()) { +- I965DrvVideoPath = "/usr/lib/va/drivers/i965_drv_video.so"; ++ // libva drivers won't get loaded even above two libraries get dlopened. ++ // Thus, libva calls will fail after post sandbox stage. ++ // ++ // To get the va driver loaded before sandboxing, upstream simply dlopen ++ // the hard-coded va driver path because ChromeOS is the only platform ++ // that Google want to support libva. ++ // ++ // While generic linux distros ship va driver as anywhere they want. ++ // Fortunately, the va driver will be loadded when vaInitialize() get ++ // called. ++ // So the following code is to call vaInitialize() before sandboxing. ++ Display* x_display = XOpenDisplay(NULL); ++ VADisplay va_display = vaGetDisplay(x_display); ++ if (!vaDisplayIsValid(va_display)) { ++ VLOG(1) << "Failed to call vaGetDisplay()"; ++ return false; + } + +- dlopen(I965DrvVideoPath, RTLD_NOW|RTLD_GLOBAL|RTLD_NODELETE); +- if (I965HybridDrvVideoPath) +- dlopen(I965HybridDrvVideoPath, RTLD_NOW|RTLD_GLOBAL|RTLD_NODELETE); +- dlopen("libva.so.1", RTLD_NOW|RTLD_GLOBAL|RTLD_NODELETE); +-#if defined(USE_OZONE) +- dlopen("libva-drm.so.1", RTLD_NOW|RTLD_GLOBAL|RTLD_NODELETE); +-#elif defined(USE_X11) +- dlopen("libva-x11.so.1", RTLD_NOW|RTLD_GLOBAL|RTLD_NODELETE); +-#endif +- } +- } ++ int major_version, minor_version; ++ if (vaInitialize(va_display, &major_version, &minor_version) ++ != VA_STATUS_SUCCESS) { ++ VLOG(1) << "Failed to call vaInitialize()"; ++ return false; ++ } ++ } // end of IsAcceleratedVaapiVideoEncodeEnabled() || IsAcceleratedVideoDecodeEnabled() ++ } // end of IsArchitectureX86_64() || IsArchitectureI386() + + return true; + } +Index: dev.wily/chrome/browser/about_flags.cc +=================================================================== +--- dev.wily.orig/chrome/browser/about_flags.cc ++++ dev.wily/chrome/browser/about_flags.cc +@@ -854,7 +854,7 @@ + "disable-accelerated-video-decode", + IDS_FLAGS_ACCELERATED_VIDEO_DECODE_NAME, + IDS_FLAGS_ACCELERATED_VIDEO_DECODE_DESCRIPTION, +- kOsMac | kOsWin | kOsCrOS, ++ kOsAll, + SINGLE_DISABLE_VALUE_TYPE(switches::kDisableAcceleratedVideoDecode), + }, + #if defined(USE_ASH) +Index: dev.wily/content/common/gpu/media/vaapi_wrapper.cc +=================================================================== +--- dev.wily.orig/content/common/gpu/media/vaapi_wrapper.cc ++++ dev.wily/content/common/gpu/media/vaapi_wrapper.cc +@@ -146,7 +146,7 @@ scoped_ptr VaapiWrapper::C + VAProfile va_profile, + const base::Closure& report_error_to_uma_cb) { + if (!profile_infos_.Get().IsProfileSupported(mode, va_profile)) { +- DVLOG(1) << "Unsupported va_profile: " << va_profile; ++ VLOG(1) << "Unsupported va_profile: " << va_profile; + return nullptr; + } + +@@ -305,15 +305,17 @@ VaapiWrapper::GetSupportedProfileInfosFo + bool VaapiWrapper::VaInitialize(const base::Closure& report_error_to_uma_cb) { + static bool vaapi_functions_initialized = PostSandboxInitialization(); + if (!vaapi_functions_initialized) { +- bool running_on_chromeos = false; +-#if defined(OS_CHROMEOS) ++ bool error_level_logging = false; ++#if defined(OS_LINUX) ++ error_level_logging = true; ++#elif defined(OS_CHROMEOS) + // When chrome runs on linux with chromeos=1, do not log error message + // without VAAPI libraries. +- running_on_chromeos = base::SysInfo::IsRunningOnChromeOS(); ++ error_level_logging = base::SysInfo::IsRunningOnChromeOS(); + #endif + static const char kErrorMsg[] = "Failed to initialize VAAPI libs"; +- if (running_on_chromeos) +- LOG(ERROR) << kErrorMsg; ++ if (error_level_logging) ++ VLOG(1) << kErrorMsg; + else + DVLOG(1) << kErrorMsg; + return false; +@@ -384,7 +386,7 @@ bool VaapiWrapper::IsEntrypointSupported + if (std::find(supported_entrypoints.begin(), + supported_entrypoints.end(), + entrypoint) == supported_entrypoints.end()) { +- DVLOG(1) << "Unsupported entrypoint"; ++ VLOG(1) << "Unsupported entrypoint"; + return false; + } + return true; +@@ -408,8 +410,8 @@ bool VaapiWrapper::AreAttribsSupported_L + if (attribs[i].type != required_attribs[i].type || + (attribs[i].value & required_attribs[i].value) != + required_attribs[i].value) { +- DVLOG(1) << "Unsupported value " << required_attribs[i].value +- << " for attribute type " << required_attribs[i].type; ++ VLOG(1) << "Unsupported value " << required_attribs[i].value ++ << " for attribute type " << required_attribs[i].type; + return false; + } + } +@@ -427,46 +427,7 @@ + VAEntrypoint entrypoint, + std::vector& required_attribs, + gfx::Size* resolution) { +- va_lock_->AssertAcquired(); +- VAConfigID va_config_id; +- VAStatus va_res = vaCreateConfig( +- va_display_, +- va_profile, +- entrypoint, +- &required_attribs[0], +- required_attribs.size(), +- &va_config_id); +- VA_SUCCESS_OR_RETURN(va_res, "vaCreateConfig failed", false); +- +- // Calls vaQuerySurfaceAttributes twice. The first time is to get the number +- // of attributes to prepare the space and the second time is to get all +- // attributes. +- unsigned int num_attribs; +- va_res = vaQuerySurfaceAttributes( +- va_display_, va_config_id, nullptr, &num_attribs); +- VA_SUCCESS_OR_RETURN(va_res, "vaQuerySurfaceAttributes failed", false); +- if (!num_attribs) +- return false; +- +- std::vector attrib_list( +- base::checked_cast(num_attribs)); +- +- va_res = vaQuerySurfaceAttributes( +- va_display_, va_config_id, &attrib_list[0], &num_attribs); +- VA_SUCCESS_OR_RETURN(va_res, "vaQuerySurfaceAttributes failed", false); +- +- resolution->SetSize(0, 0); +- for (const auto& attrib : attrib_list) { +- if (attrib.type == VASurfaceAttribMaxWidth) +- resolution->set_width(attrib.value.value.i); +- else if (attrib.type == VASurfaceAttribMaxHeight) +- resolution->set_height(attrib.value.value.i); +- } +- if (resolution->IsEmpty()) { +- LOG(ERROR) << "Codec resolution " << resolution->ToString() +- << " cannot be zero."; +- return false; +- } ++ resolution->SetSize(1920, 1088); + return true; + } + +Index: dev.wily/content/common/gpu/media/vaapi_video_decode_accelerator.cc +=================================================================== +--- dev.wily.orig/content/common/gpu/media/vaapi_video_decode_accelerator.cc ++++ dev.wily/content/common/gpu/media/vaapi_video_decode_accelerator.cc +@@ -269,17 +269,17 @@ bool VaapiVideoDecodeAccelerator::Initia + + base::AutoLock auto_lock(lock_); + DCHECK_EQ(state_, kUninitialized); +- DVLOG(2) << "Initializing VAVDA, profile: " << profile; ++ VLOG(1) << "Initializing VAVDA, profile: " << profile; + + #if defined(USE_X11) + if (gfx::GetGLImplementation() != gfx::kGLImplementationDesktopGL) { +- DVLOG(1) << "HW video decode acceleration not available without " ++ VLOG(1) << "HW video decode acceleration not available without " + "DesktopGL (GLX)."; + return false; + } + #elif defined(USE_OZONE) + if (gfx::GetGLImplementation() != gfx::kGLImplementationEGLGLES2) { +- DVLOG(1) << "HW video decode acceleration not available without " ++ VLOG(1) << "HW video decode acceleration not available without " + << "EGLGLES2."; + return false; + } +@@ -289,7 +289,7 @@ bool VaapiVideoDecodeAccelerator::Initia + VaapiWrapper::kDecode, profile, base::Bind(&ReportToUMA, VAAPI_ERROR)); + + if (!vaapi_wrapper_.get()) { +- DVLOG(1) << "Failed initializing VAAPI for profile " << profile; ++ VLOG(1) << "Failed initializing VAAPI for profile " << profile; + return false; + } + +@@ -302,7 +302,7 @@ bool VaapiVideoDecodeAccelerator::Initia + vp8_accelerator_.reset(new VaapiVP8Accelerator(this, vaapi_wrapper_.get())); + decoder_.reset(new VP8Decoder(vp8_accelerator_.get())); + } else { +- DLOG(ERROR) << "Unsupported profile " << profile; ++ VLOG(1) << "Unsupported profile " << profile; + return false; + } + +Index: dev.wily/content/gpu/gpu_main.cc +=================================================================== +--- dev.wily.orig/content/gpu/gpu_main.cc ++++ dev.wily/content/gpu/gpu_main.cc +@@ -66,7 +66,7 @@ + #include "content/common/sandbox_mac.h" + #endif + +-#if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) ++#if (defined(OS_CHROMEOS) || defined(OS_LINUX)) && defined(ARCH_CPU_X86_FAMILY) + #include "content/common/gpu/media/vaapi_wrapper.h" + #endif + +@@ -227,7 +227,7 @@ int GpuMain(const MainFunctionParams& pa + GetGpuInfoFromCommandLine(gpu_info, command_line); + gpu_info.in_process_gpu = false; + +-#if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) ++#if (defined(OS_CHROMEOS) || defined(OS_LINUX)) && defined(ARCH_CPU_X86_FAMILY) + VaapiWrapper::PreSandboxInitialization(); + #endif + +Index: dev.wily/content/common/gpu/client/command_buffer_proxy_impl.cc +=================================================================== +--- dev.wily.orig/content/common/gpu/client/command_buffer_proxy_impl.cc ++++ dev.wily/content/common/gpu/client/command_buffer_proxy_impl.cc +@@ -561,8 +561,10 @@ bool CommandBufferProxyImpl::ProduceFron + + scoped_ptr + CommandBufferProxyImpl::CreateVideoDecoder() { ++ TRACE_EVENT0("gpu", "CommandBufferProxyImpl::CreateVideoDecoder"); + if (!channel_) + return scoped_ptr(); ++ VLOG(1) << "About to create GpuVideoDecodeAcceleratorHost."; + return scoped_ptr( + new GpuVideoDecodeAcceleratorHost(channel_, this)); + } diff --git a/tools/mkpkg/mkpkg_adsp.biquad.filters b/packages/addons/browser/chromium/source/bin/chromium old mode 100755 new mode 100644 similarity index 54% rename from tools/mkpkg/mkpkg_adsp.biquad.filters rename to packages/addons/browser/chromium/source/bin/chromium index 33dfbd3971a..07ee1956626 --- a/tools/mkpkg/mkpkg_adsp.biquad.filters +++ b/packages/addons/browser/chromium/source/bin/chromium @@ -1,7 +1,7 @@ #!/bin/sh ################################################################################ # This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) # # OpenELEC is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -17,25 +17,17 @@ # along with OpenELEC. If not, see . ################################################################################ -echo "getting sources..." - if [ ! -d adsp.biquad.filters.git ]; then - git clone https://github.com/kodi-adsp/adsp.biquad.filters.git adsp.biquad.filters.git - fi +# make sure we use "own" gtk/pango/nss/etc +export LD_LIBRARY_PATH=/storage/.kodi/addons/browser.chromium/lib - cd adsp.biquad.filters.git - git pull - GIT_REV=`git log -n1 --format=%h` - cd .. +# configure pango/pixbuf +export PANGO_RC_FILE=/storage/.kodi/addons/browser.chromium/config/pangorc +export GDK_PIXBUF_MODULE_FILE=/storage/.kodi/addons/browser.chromium/config/pixbuf.loaders.cache -echo "copying sources..." - rm -rf adsp.biquad.filters-$GIT_REV - cp -R adsp.biquad.filters.git adsp.biquad.filters-$GIT_REV +# font rendering in gtk widgets is brokeen with nvidia blob. use our Xdefaults +export XENVIRONMENT=/storage/.kodi/addons/browser.chromium/config/Xdefaults -echo "cleaning sources..." - rm -rf adsp.biquad.filters-$GIT_REV/.git - -echo "packing sources..." - tar cvJf adsp.biquad.filters-$GIT_REV.tar.xz adsp.biquad.filters-$GIT_REV - -echo "remove temporary sourcedir..." - rm -rf adsp.biquad.filters-$GIT_REV +# start chromium +LD_PRELOAD=/usr/lib/libGL.so /storage/.kodi/addons/browser.chromium/bin/chromium.bin \ + --user-data-dir=/storage/.kodi/userdata/addon_data/browser.chromium/profile \ + --test-type $@ diff --git a/packages/addons/browser/chromium/source/default.py b/packages/addons/browser/chromium/source/default.py new file mode 100644 index 00000000000..b4e16086f6d --- /dev/null +++ b/packages/addons/browser/chromium/source/default.py @@ -0,0 +1,195 @@ +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) +# +# This Program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This Program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with OpenELEC.tv; see the file COPYING. If not, write to +# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. +# http://www.gnu.org/copyleft/gpl.html +################################################################################ + +import os +import sys +import time +import xbmcaddon +import subprocess +from xml.dom.minidom import parse + +sys.path.append('/usr/share/kodi/addons/service.libreelec.settings') + +import oe + +__addon__ = xbmcaddon.Addon(); +__path__ = os.path.join(__addon__.getAddonInfo('path'), 'bin') + '/' + +pauseXBMC = __addon__.getSetting("PAUSE_XBMC") + +# widevine and flash stuff +__url__ = 'https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb' +__file__ = __url__.split('/')[-1] +__tar__ = 'data.tar.xz' +__tmp__ = '/tmp/widevine/' +__lib__ = 'opt/google/chrome/libwidevinecdm.so' +__flash__ = 'opt/google/chrome/PepperFlash/libpepflashplayer.so' + +def download(): + try: + if not os.path.isdir(__tmp__): + os.mkdir(__tmp__) + if not os.path.exists(__tmp__ + __file__): + oe.download_file(__url__, __tmp__ + __file__) + except Exception, e: + oe.notify('Chromium', 'Could not download file') + +def install_flash(): + try: + download() + oe.notify('Chromium', 'Extracting libpepflashplayer.so') + if not os.path.isdir(__tmp__ + __tar__): + oe.execute('cd ' + __tmp__ + ' && ar -x ' + __file__) + oe.execute('tar xf ' + __tmp__ + __tar__ + ' -C ' + __tmp__ + ' ./' + __flash__) + if not os.path.isdir(__path__ + 'PepperFlash'): + os.mkdir(__path__ + 'PepperFlash') + oe.copy_file(__tmp__ + __flash__, __path__ + 'PepperFlash/' + __flash__.split('/')[-1]) + oe.notify('Chromium', 'Installation of libpepflashplayer.so succeeded') + except Exception, e: + oe.notify('Chromium', 'Installation of libpepflashplayer.so failed') + +def install_widevine(): + try: + download() + oe.notify('Chromium', 'Extracting libwidevinecdm.so') + if not os.path.isdir(__tmp__ + __tar__): + oe.execute('cd ' + __tmp__ + ' && ar -x ' + __file__) + oe.execute('tar xf ' + __tmp__ + __tar__ + ' -C ' + __tmp__ + ' ./' + __lib__) + oe.copy_file(__tmp__ + __lib__, __path__ + __lib__.split('/')[-1]) + oe.notify('Chromium', 'Installation of libwidevinecdm.so succeeded') + except Exception, e: + oe.notify('Chromium', 'Installation of libwidevinecdm.so failed') + +def pauseXbmc(): + if pauseXBMC == "true": + xbmc.executebuiltin("PlayerControl(Stop)") + xbmc.audioSuspend() + xbmc.enableNavSounds(False) + +def resumeXbmc(): + if pauseXBMC == "true": + xbmc.audioResume() + xbmc.enableNavSounds(True) + +def startChromium(args): + oe.execute('chmod +x ' + __path__ + 'chromium') + oe.execute('chmod +x ' + __path__ + 'chromium.bin') + oe.execute('chmod 4755 ' + __path__ + 'chrome-sandbox') + + try: + window_mode = { + 'maximized': '--start-maximized', + 'kiosk': '--kiosk', + 'none': '', + } + + raster_mode = { + 'default': '', + 'off': '--disable-accelerated-2d-canvas --disable-gpu-compositing', + 'force': '--enable-gpu-rasterization --enable-accelerated-2d-canvas --ignore-gpu-blacklist', + } + + new_env = os.environ.copy() + vaapi_mode = __addon__.getSetting('VAAPI_MODE') + gpu_accel_mode = '' + if vaapi_mode == 'intel': + new_env['LIBVA_DRIVERS_PATH'] = '/usr/lib/va' + new_env['LIBVA_DRIVER_NAME'] = 'i965' + elif vaapi_mode == 'amd': + new_env['LIBVA_DRIVERS_PATH'] = os.path.join(__addon__.getAddonInfo('path'), 'lib') + new_env['LIBVA_DRIVER_NAME'] = 'vdpau' + elif vaapi_mode == 'nvidia': + new_env['LIBVA_DRIVERS_PATH'] = os.path.join(__addon__.getAddonInfo('path'), 'lib') + new_env['LIBVA_DRIVER_NAME'] = 'vdpau' + gpu_accel_mode = '--allow-no-sandbox-job --disable-gpu-sandbox' + else: + new_env['LIBGL_ALWAYS_SOFTWARE'] = '1' + + flash_plugin = '' + if os.path.exists(__path__ + 'PepperFlash/libpepflashplayer.so'): + flash_plugin = '--ppapi-flash-path=' + __path__ + 'PepperFlash/libpepflashplayer.so' + + if __addon__.getSetting('USE_CUST_AUDIODEVICE') == 'true': + alsa_device = __addon__.getSetting('CUST_AUDIODEVICE_STR') + else: + alsa_device = getAudioDevice() + alsa_param = '' + if not alsa_device == None and not alsa_device == '': + alsa_param = '--alsa-output-device=' + alsa_device + + chrome_params = window_mode.get(__addon__.getSetting('WINDOW_MODE')) + ' ' + \ + raster_mode.get(__addon__.getSetting('RASTER_MODE')) + ' ' + \ + flash_plugin + ' ' + \ + gpu_accel_mode + ' ' + \ + alsa_param + ' ' + \ + args + ' ' + \ + __addon__.getSetting('HOMEPAGE') + subprocess.call(__path__ + 'chromium ' + chrome_params, shell=True, env=new_env) + except Exception, e: + oe.dbg_log('chromium', unicode(e)) + +def isRuning(pname): + tmp = os.popen("ps -Af").read() + pcount = tmp.count(pname) + if pcount > 0: + return True + return False + +def getAudioDevice(): + try: + dom = parse("/storage/.kodi/userdata/guisettings.xml") + audiooutput=dom.getElementsByTagName('audiooutput') + for node in audiooutput: + dev = node.getElementsByTagName('audiodevice')[0].childNodes[0].nodeValue + if dev.startswith("ALSA:"): + dev = dev.split("ALSA:")[1] + if dev == "@": + return None + if dev.startswith("@:"): + dev = dev.split("@:")[1] + else: + # not ALSA + return None + except: + return None + if dev.startswith("CARD="): + dev = "plughw:" + dev + return dev + +if (not __addon__.getSetting("firstrun")): + __addon__.setSetting("firstrun", "1") + __addon__.openSettings() + +try: + args = ' '.join(sys.argv[1:]) +except: + args = "" + +if args == 'widevine': + install_widevine() +elif args == 'flash': + install_flash() +else: + if not isRuning('chromium.bin'): + pauseXbmc() + startChromium(args) + while isRuning('chromium.bin'): + time.sleep(1) + resumeXbmc() diff --git a/packages/addons/browser/chromium/source/resources/language/English/strings.xml b/packages/addons/browser/chromium/source/resources/language/English/strings.xml new file mode 100644 index 00000000000..8add108e03b --- /dev/null +++ b/packages/addons/browser/chromium/source/resources/language/English/strings.xml @@ -0,0 +1,16 @@ + + + General + Actions + Chromium Configuration + Stop Kodi Player and Suspend AudioEngine + HW Acceleration Mode + Rasterization Mode + Window Mode + Default Homepage + Use Custom Audio Device + Audio Device + Chromium Actions + Install libwidevinecdm.so (Netflix Support) + Install libpepflashplayer.so (Flash Player Support) + diff --git a/packages/addons/browser/chromium/source/resources/settings.xml b/packages/addons/browser/chromium/source/resources/settings.xml new file mode 100644 index 00000000000..65fc47d8cd6 --- /dev/null +++ b/packages/addons/browser/chromium/source/resources/settings.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/packages/addons/driver/hdhomerun/changelog.txt b/packages/addons/driver/hdhomerun/changelog.txt index 9c8816a4cdf..750a04886d6 100644 --- a/packages/addons/driver/hdhomerun/changelog.txt +++ b/packages/addons/driver/hdhomerun/changelog.txt @@ -1,56 +1,8 @@ -7.0.0 - rebuild for OpenELEC-7.0 -6.0.0 - rebuild for OpenELEC-6.0 -4.3.2 - allow running scripts from addon settings -4.3.1 - rebuild for addon api bump -4.3.0 - rebuild for addon api bump -4.1.2 - clean up -4.1.0 - rebuild for addon api bump -4.0.1 - rebuild -4.0.0 - rebuild for OpenELEC-4.0 -3.1.6 - rebuild -3.1.5 - get tuner id with command 'hdhomerun_config discover' and - set number of tuners manually -3.1.4 - get tuner id from /var/log/messages -3.1.3 - fixed parsing dvbhdhomerun.log file with timestamp -3.1.2 - new addon settings option to enable suspend/resume driver actions - new addon settings option to enable logging -3.1.1 - rebuild for OpenELEC-3.2 -3.0.5 - rebuild -3.0.4 - fixed "bad substitution" error with busybox/ash -3.0.3 - improved python script for modifying tuners -3.0.2 - added addon settings for - modifying tuner type (DVB-C, DVB-T, ATSC) - setting delays -3.0.1 - bump addon version - binary files are stored with OpenELEC image - addon is used to start userspace program -2.1.3 - bump addon version for new kernel -2.1.2 - dvbhdhomerun upgraded to 0.0.10 -2.1.1 - rebuild for addon version 2.1 -2.0.1 - starting userspace DVB drivers from Tvheadend/VDR -2.0.0 - initial version of HDHomeRun driver +8.0.100 +- Update for LibreELEC 8.0 + +7.0.101 +- added proper icon and description + +7.0.100 +- initial LibreELEC version \ No newline at end of file diff --git a/packages/addons/driver/hdhomerun/icon/icon.png b/packages/addons/driver/hdhomerun/icon/icon.png index af1fddcd3e7..e47da25fcca 100644 Binary files a/packages/addons/driver/hdhomerun/icon/icon.png and b/packages/addons/driver/hdhomerun/icon/icon.png differ diff --git a/packages/addons/driver/hdhomerun/package.mk b/packages/addons/driver/hdhomerun/package.mk index 8ab66131837..0123478c3af 100644 --- a/packages/addons/driver/hdhomerun/package.mk +++ b/packages/addons/driver/hdhomerun/package.mk @@ -18,7 +18,7 @@ PKG_NAME="hdhomerun" PKG_VERSION="7.0" -PKG_REV="0" +PKG_REV="100" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.silicondust.com/products/hdhomerun/dvbt/" @@ -26,13 +26,14 @@ PKG_URL="" PKG_DEPENDS_TARGET="toolchain" PKG_PRIORITY="optional" PKG_SECTION="driver/dvb" -PKG_SHORTDESC="A linux DVB driver for the HDHomeRun (http://www.silicondust.com)." -PKG_LONGDESC="A linux DVB driver for the HDHomeRun (http://www.silicondust.com)." -PKG_AUTORECONF="no" +PKG_SHORTDESC="HDHomeRun: a Linux driver to add support for HDHomeRun from silicondust.com" +PKG_LONGDESC="Install this to add support for HDHomeRun devices." + PKG_IS_ADDON="yes" +PKG_ADDON_NAME="HDHomeRun" PKG_ADDON_TYPE="xbmc.python.script" -PKG_ADDON_PROVIDES="" -PKG_ADDON_REPOVERSION="7.0" +PKG_AUTORECONF="no" +PKG_ADDON_REPOVERSION="8.0" make_target() { : # nothing to do here diff --git a/packages/addons/driver/hdhomerun/source/resources/lib/functions.py b/packages/addons/driver/hdhomerun/source/resources/lib/functions.py index 0f1cea3d311..2904cc4acd4 100644 --- a/packages/addons/driver/hdhomerun/source/resources/lib/functions.py +++ b/packages/addons/driver/hdhomerun/source/resources/lib/functions.py @@ -64,7 +64,7 @@ def get_devices_hdhomerun(): return tuners """ -openelec:~ # hdhomerun_config discover +libreelec:~ # hdhomerun_config discover hdhomerun device 12345678 found at 192.168.0.3 """ diff --git a/packages/addons/driver/imon-mce/changelog.txt b/packages/addons/driver/imon-mce/changelog.txt index 0629e270046..750a04886d6 100644 --- a/packages/addons/driver/imon-mce/changelog.txt +++ b/packages/addons/driver/imon-mce/changelog.txt @@ -1,38 +1,8 @@ -7.0.0 - rebuild for OpenELEC-7.0 +8.0.100 +- Update for LibreELEC 8.0 -6.0.0 - rebuild for OpenELEC-6.0 +7.0.101 +- added proper icon and description -4.3.1 - fix keymaps path - -4.3.0 - rebuild for addon api bump - -4.1.0 - rebuild for addon api bump - -4.0.1 - rebuild - -4.0.0 - rebuild for OpenELEC-4.0 - -3.1.1 - rebuild for OpenELEC-3.2 - -3.0.1 -- bump addon version - -2.1.1 -- update for addon version 2.1 - -2.0.0 -- prepare for OpenELEC-2.0 release - -1.90.1 -- depends on xbmc.python API 2.0 - -1.90.0 -- initial version imon-mce +7.0.100 +- initial LibreELEC version \ No newline at end of file diff --git a/packages/addons/driver/imon-mce/icon/icon.png b/packages/addons/driver/imon-mce/icon/icon.png index ee39e2a0790..c4ce213ed1e 100644 Binary files a/packages/addons/driver/imon-mce/icon/icon.png and b/packages/addons/driver/imon-mce/icon/icon.png differ diff --git a/packages/addons/driver/imon-mce/package.mk b/packages/addons/driver/imon-mce/package.mk index f5c5f3ce190..62be9393401 100644 --- a/packages/addons/driver/imon-mce/package.mk +++ b/packages/addons/driver/imon-mce/package.mk @@ -18,23 +18,22 @@ PKG_NAME="imon-mce" PKG_VERSION="7.0" -PKG_REV="0" +PKG_REV="100" PKG_ARCH="any" PKG_LICENSE="OSS" -PKG_SITE="http://www.openelec.tv" +PKG_SITE="https://libreelec.tv" PKG_URL="" PKG_DEPENDS_TARGET="toolchain" PKG_PRIORITY="optional" PKG_SECTION="driver/remote" -PKG_SHORTDESC="imon-mce: a driver to add support for MCE remotes to the imon driver" -PKG_LONGDESC="imon-mce is a driver to add support for MCE remotes to the imon driver. To readd imon remote support uninstall or disable this addon again." +PKG_SHORTDESC="iMON-MCE: a Linux driver to add support for MCE remotes to the iMON driver" +PKG_LONGDESC="Install this to add support for iMon MCE remote controls." PKG_IS_ADDON="yes" +PKG_ADDON_NAME="iMON-MCE" PKG_ADDON_TYPE="xbmc.service" -PKG_ADDON_PROVIDES="" -PKG_ADDON_REPOVERSION="7.0" - PKG_AUTORECONF="no" +PKG_ADDON_REPOVERSION="8.0" make_target() { : # nothing to do here diff --git a/packages/addons/driver/imon-mce/source/default.py b/packages/addons/driver/imon-mce/source/default.py index d1cacce58cf..e1d46ceee1e 100644 --- a/packages/addons/driver/imon-mce/source/default.py +++ b/packages/addons/driver/imon-mce/source/default.py @@ -21,8 +21,8 @@ import xbmcaddon __scriptname__ = "IMON MCE Remote driver" -__author__ = "OpenELEC" -__url__ = "http://www.openelec.tv" +__author__ = "LibreELEC" +__url__ = "https://libreelec.tv" __settings__ = xbmcaddon.Addon(id='driver.remote.imon-mce') __cwd__ = __settings__.getAddonInfo('path') __path__ = xbmc.translatePath( os.path.join( __cwd__, 'bin', "imon-mce.service") ) diff --git a/packages/addons/driver/sundtek-mediatv/changelog.txt b/packages/addons/driver/sundtek-mediatv/changelog.txt index c2dfa5b6060..2fd4cac8279 100644 --- a/packages/addons/driver/sundtek-mediatv/changelog.txt +++ b/packages/addons/driver/sundtek-mediatv/changelog.txt @@ -1,70 +1,11 @@ -7.0.0 - rebuild for OpenELEC-7.0 -6.0.1 - update driver for new devices support -6.0.0 - rebuild for OpenELEC-6.0 -4.3.4 - fixed xbmc/kodi rebranding error - some fixes -4.3.3 - addon transformed to service addon - new addon settings option to enable to check for new driver at boot -4.3.2 - new addon settings option to enable to update driver from web with latest version -4.3.1 - update driver -4.3.0 - rebuild for addon api bump -4.1.5 - dont touch /storage/.profile -4.1.4 - enable hw pid filter by default -4.1.3 - include driver bin/libs -4.1.2 - clean up. sorry. no analog tv anymore. -4.1.1 - clean up -4.1.0 - rebuild for addon api bump -4.0.1 - rebuild -4.0.0 - rebuild for OpenELEC-4.0 -3.1.3 - rebuild -3.1.2 - new addon settings option to enable suspend/resume driver actions -3.1.1 - rebuild for OpenELEC-3.2 -3.0.6 - rebuild -3.0.5 - fixed "bad substitution" error with busybox/ash -3.0.4 - improved python script for modifying tuners -3.0.3 - added addon settings for modifying tuner type (DVB-C, DVB-T) -3.0.2 - added addon settings - enable HW PID filter (enabled for RPi by default) - enable IR receiver - allow sharing local tuner over network - use network tuners - sundtek's binaries are downloaded on first run - automatically download new version of the binaries if available - added preload library to .profile (to run mediaclient, w_scan, ... from console) -2.1.4 - support for Raspberry Pi -2.1.3 - support for network tuner -2.1.2 - support for multiple Sundtek tuners - support for working with other tuners (kernel drivers) -2.1.1 - update to addon version 2.1 -2.0.5 - starting userspace DVB drivers from Tvheadend/VDR -1.90.0 - initial version of Sundtek MediaTV DVB driver +8.0.101 +- system wait-for-online preference is now respected + +8.0.100 +- Update for LibreELEC 8.0 + +7.0.101 +- added proper icon and description + +7.0.100 +- initial LibreELEC version \ No newline at end of file diff --git a/packages/addons/driver/sundtek-mediatv/icon/icon.png b/packages/addons/driver/sundtek-mediatv/icon/icon.png index eb4144b290d..f0eba7bd466 100644 Binary files a/packages/addons/driver/sundtek-mediatv/icon/icon.png and b/packages/addons/driver/sundtek-mediatv/icon/icon.png differ diff --git a/packages/addons/driver/sundtek-mediatv/package.mk b/packages/addons/driver/sundtek-mediatv/package.mk index e476057fea4..1d725be5489 100644 --- a/packages/addons/driver/sundtek-mediatv/package.mk +++ b/packages/addons/driver/sundtek-mediatv/package.mk @@ -18,7 +18,7 @@ PKG_NAME="sundtek-mediatv" PKG_VERSION="7.0" -PKG_REV="0" +PKG_REV="101" PKG_ARCH="any" PKG_LICENSE="nonfree" PKG_SITE="http://support.sundtek.com/" @@ -26,13 +26,14 @@ PKG_URL="" PKG_DEPENDS_TARGET="" PKG_PRIORITY="optional" PKG_SECTION="driver/dvb" -PKG_SHORTDESC="Sundtek USB Stick DVB userspace driver" -PKG_LONGDESC="Driver for Sundtek MediaTV Pro (DVB-C, DVB-T, AnalogTV, Composite, S-Video, FM-Radio USB Stick) and Sundtek SkyTV Ultimate (DVB-S/S2 USB)." +PKG_SHORTDESC="Sundtek MediaTV: a Linux driver to add support for SUNDTEK USB DVB devices" +PKG_LONGDESC="Install this to add support for SundTek USB DVB devices." + PKG_IS_ADDON="yes" +PKG_ADDON_NAME="Sundtek MediaTV" PKG_ADDON_TYPE="xbmc.service" -PKG_ADDON_PROVIDES="" PKG_AUTORECONF="no" -PKG_ADDON_REPOVERSION="7.0" +PKG_ADDON_REPOVERSION="8.0" make_target() { mkdir -p $ROOT/$PKG_BUILD @@ -45,6 +46,9 @@ make_target() { arm) INSTALLER_URL="http://sundtek.de/media/netinst/armsysvhf/installer.tar.gz" ;; + aarch64) + INSTALLER_URL="http://sundtek.de/media/netinst/arm64/installer.tar.gz" + ;; esac wget -O installer.tar.gz $INSTALLER_URL diff --git a/packages/addons/driver/sundtek-mediatv/source/system.d/driver.dvb.sundtek-mediatv.service b/packages/addons/driver/sundtek-mediatv/source/system.d/driver.dvb.sundtek-mediatv.service index 4f6c142d1a7..40997eee8ea 100644 --- a/packages/addons/driver/sundtek-mediatv/source/system.d/driver.dvb.sundtek-mediatv.service +++ b/packages/addons/driver/sundtek-mediatv/source/system.d/driver.dvb.sundtek-mediatv.service @@ -1,6 +1,7 @@ [Unit] Description=Sundtek driver service -After=network.target +After=network-online.service +Requires=network-online.service [Service] Type=oneshot diff --git a/packages/addons/repository/repository.unofficial.addon.pro/changelog.txt b/packages/addons/repository/repository.unofficial.addon.pro/changelog.txt deleted file mode 100644 index a5854dc0ec9..00000000000 --- a/packages/addons/repository/repository.unofficial.addon.pro/changelog.txt +++ /dev/null @@ -1,36 +0,0 @@ -7.0.1 -- change minimum kodi version to allow using with beta/rc release - -7.0.0 -- rebuild for OpenELEC-7.0 -- change warning text - -6.0.1 -- update repo minversion for kodi 15 - -6.0.0 -- rebuild for OpenELEC-6.0 - -4.3.3 -- rebuild - -4.3.2 -- rebuild for addon api bump - -4.1.2 -- fix typo in repository name - -4.1.1 -- bump - -4.1.0 -- rebuild for addon api bump - -4.0.0 -- rebuild for OpenELEC-4.0 - -1.0.1 -- use generic/i386 addons for atv - -1.0.0 -- initial release diff --git a/packages/addons/repository/repository.unofficial.addon.pro/icon/icon.png b/packages/addons/repository/repository.unofficial.addon.pro/icon/icon.png deleted file mode 100644 index 1147ae1d37a..00000000000 Binary files a/packages/addons/repository/repository.unofficial.addon.pro/icon/icon.png and /dev/null differ diff --git a/packages/addons/repository/repository.unofficial.addon.pro/sources/addon.xml b/packages/addons/repository/repository.unofficial.addon.pro/sources/addon.xml deleted file mode 100644 index 4b2661642e3..00000000000 --- a/packages/addons/repository/repository.unofficial.addon.pro/sources/addon.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - http://unofficial.addon.pro/addons/7.0/@PROJECT@/@ARCH@/addons.xml - http://unofficial.addon.pro/addons/7.0/@PROJECT@/@ARCH@/addons.xml.md5 - http://unofficial.addon.pro/addons/7.0/@PROJECT@/@ARCH@ - - - - OpenELEC Add-ons (unofficial) - The OpenELEC unofficial repository contains community provided add-ons. These add-ons are not supported by OpenELEC staff. Please check the OpenELEC or Kodi forums for community support threads and ask the add-on author to submit fixes via GitHub. - Add-ons in this repository are not maintained or supported by OpenELEC staff. - all - - diff --git a/packages/addons/script/moonlight/icon/icon.png b/packages/addons/script/moonlight/icon/icon.png new file mode 100644 index 00000000000..3a4bb5533c3 Binary files /dev/null and b/packages/addons/script/moonlight/icon/icon.png differ diff --git a/packages/addons/script/moonlight/package.mk b/packages/addons/script/moonlight/package.mk new file mode 100644 index 00000000000..443e2bd13c7 --- /dev/null +++ b/packages/addons/script/moonlight/package.mk @@ -0,0 +1,78 @@ +################################################################################ +# This file is part of LibreELEC - https://libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +PKG_NAME="moonlight" +PKG_VERSION="c371ff8" +PKG_REV="101" +PKG_ARCH="any" +PKG_LICENSE="GPLv2" +PKG_SITE="https://github.com/dead/moonlight-openelec-rpi2" +PKG_URL="https://github.com/dead/moonlight-openelec-rpi2/archive/$PKG_VERSION.tar.gz" +PKG_SOURCE_DIR="moonlight-openelec-rpi2-$PKG_VERSION*" +PKG_DEPENDS_TARGET="toolchain moonlight-embedded" +PKG_PRIORITY="optional" +PKG_SECTION="script" +PKG_SHORTDESC="Moonlight-embedded Addon for LibreELEC" +PKG_LONGDESC="Moonlight-embedded Addon for LibreELEC" +PKG_AUTORECONF="no" + +PKG_IS_ADDON="yes" +PKG_ADDON_REPOVERSION="8.0" +PKG_ADDON_TYPE="xbmc.service.pluginsource" +PKG_ADDON_PROVIDES="executable" +PKG_ADDON_NAME="Moonlight" +PKG_MAINTAINER="dead (gustavobenn@hotmail.com)" + +make_target() { + : +} + +makeinstall_target() { + : +} + +addon() { + mkdir -p $ADDON_BUILD/$PKG_ADDON_ID + cp -PR $ROOT/$PKG_BUILD/script.moonlight/* $ADDON_BUILD/$PKG_ADDON_ID + + # let's use our addon.xml instead + rm $ADDON_BUILD/$PKG_ADDON_ID/addon.xml + + mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/bin + cp -P $(get_build_dir moonlight-embedded)/.$TARGET_NAME/moonlight $ADDON_BUILD/$PKG_ADDON_ID/bin + + mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/lib + cp -P $(get_build_dir moonlight-embedded)/.$TARGET_NAME/libgamestream/libgamestream.so* $ADDON_BUILD/$PKG_ADDON_ID/lib + cp -P $(get_build_dir moonlight-embedded)/.$TARGET_NAME/libgamestream/libmoonlight-common.so* $ADDON_BUILD/$PKG_ADDON_ID/lib + + if [ "$KODIPLAYER_DRIVER" = "bcm2835-driver" ]; then + cp -P $(get_build_dir moonlight-embedded)/.$TARGET_NAME/libmoonlight-pi.so $ADDON_BUILD/$PKG_ADDON_ID/lib + elif [ "$KODIPLAYER_DRIVER" = "libfslvpuwrap" ]; then + cp -P $(get_build_dir moonlight-embedded)/.$TARGET_NAME/libmoonlight-imx.so $ADDON_BUILD/$PKG_ADDON_ID/lib + elif [ "$KODIPLAYER_DRIVER" = "libamcodec" ]; then + cp -P $(get_build_dir moonlight-embedded)/.$TARGET_NAME/libmoonlight-aml.so $ADDON_BUILD/$PKG_ADDON_ID/lib + fi + + cp -P $(get_build_dir libevdev)/.install_pkg/usr/lib/libevdev.so* $ADDON_BUILD/$PKG_ADDON_ID/lib + + mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/etc + cp -P $(get_build_dir moonlight-embedded)/moonlight.conf $ADDON_BUILD/$PKG_ADDON_ID/etc + + mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/share/moonlight + cp -PR $(get_build_dir moonlight-embedded)/mappings $ADDON_BUILD/$PKG_ADDON_ID/share/moonlight +} diff --git a/packages/addons/script/script.config.vdr/package.mk b/packages/addons/script/script.config.vdr/package.mk index 32f58009127..8bf0fe4f5c6 100644 --- a/packages/addons/script/script.config.vdr/package.mk +++ b/packages/addons/script/script.config.vdr/package.mk @@ -17,12 +17,12 @@ ################################################################################ PKG_NAME="script.config.vdr" -PKG_VERSION="1.0.8" -PKG_REV="0" +PKG_VERSION="1.1.3" +PKG_REV="100" PKG_ARCH="any" PKG_LICENSE="OSS" -PKG_SITE="http://www.openelec.tv" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_SITE="https://libreelec.tv" +PKG_URL="https://github.com/LibreELEC/script.config.vdr/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="" PKG_PRIORITY="optional" PKG_SECTION="" @@ -31,10 +31,8 @@ PKG_LONGDESC="script.config.vdr" PKG_IS_ADDON="yes" PKG_ADDON_TYPE="dummy" -PKG_ADDON_PROVIDES="" -PKG_ADDON_REPOVERSION="7.0" - PKG_AUTORECONF="no" +PKG_ADDON_REPOVERSION="8.0" make_target() { : # nothing to do here diff --git a/packages/addons/service/boblightd/changelog.txt b/packages/addons/service/boblightd/changelog.txt new file mode 100644 index 00000000000..750a04886d6 --- /dev/null +++ b/packages/addons/service/boblightd/changelog.txt @@ -0,0 +1,8 @@ +8.0.100 +- Update for LibreELEC 8.0 + +7.0.101 +- added proper icon and description + +7.0.100 +- initial LibreELEC version \ No newline at end of file diff --git a/packages/addons/service/multimedia/boblightd/config/boblight.X11.sample b/packages/addons/service/boblightd/config/boblight.X11.sample similarity index 100% rename from packages/addons/service/multimedia/boblightd/config/boblight.X11.sample rename to packages/addons/service/boblightd/config/boblight.X11.sample diff --git a/packages/addons/service/multimedia/boblightd/config/boblight.conf b/packages/addons/service/boblightd/config/boblight.conf similarity index 100% rename from packages/addons/service/multimedia/boblightd/config/boblight.conf rename to packages/addons/service/boblightd/config/boblight.conf diff --git a/packages/addons/service/boblightd/icon/icon.png b/packages/addons/service/boblightd/icon/icon.png new file mode 100644 index 00000000000..88d55701c72 Binary files /dev/null and b/packages/addons/service/boblightd/icon/icon.png differ diff --git a/packages/addons/service/multimedia/boblightd/package.mk b/packages/addons/service/boblightd/package.mk similarity index 88% rename from packages/addons/service/multimedia/boblightd/package.mk rename to packages/addons/service/boblightd/package.mk index 6f19742aa6d..d16a9f7b0ba 100644 --- a/packages/addons/service/multimedia/boblightd/package.mk +++ b/packages/addons/service/boblightd/package.mk @@ -18,7 +18,7 @@ PKG_NAME="boblightd" PKG_VERSION="478" -PKG_REV="0" +PKG_REV="100" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://code.google.com/p/boblight" @@ -26,15 +26,14 @@ PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" PKG_DEPENDS_TARGET="toolchain libusb" PKG_PRIORITY="optional" PKG_SECTION="service/multimedia" -PKG_SHORTDESC="boblightd: an ambilight controller." -PKG_LONGDESC="Boblight's main purpose is to create light effects from an external input, such as a video stream.\n\nSee this thread on the Openelec forums for howto and demonstration: http://bit.ly/oe-boblight" +PKG_SHORTDESC="Boblight: an AmbiLight controller" +PKG_LONGDESC="Boblight($PKG_VERSION) is an opensource AmbiLight implementation." PKG_IS_ADDON="yes" +PKG_ADDON_NAME="Boblight" PKG_ADDON_TYPE="xbmc.service" -PKG_ADDON_PROVIDES="" -PKG_ADDON_REPOVERSION="7.0" - PKG_AUTORECONF="yes" +PKG_ADDON_REPOVERSION="8.0" if [ "$DISPLAYSERVER" = "x11" ] ; then PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET libX11 libXext libXrender" diff --git a/packages/addons/service/multimedia/boblightd/patches/boblightd-2.0.5-add_aml_client.patch b/packages/addons/service/boblightd/patches/boblightd-2.0.5-add_aml_client.patch similarity index 100% rename from packages/addons/service/multimedia/boblightd/patches/boblightd-2.0.5-add_aml_client.patch rename to packages/addons/service/boblightd/patches/boblightd-2.0.5-add_aml_client.patch diff --git a/packages/addons/service/multimedia/boblightd/patches/boblightd-2.0.5-getopt-includes.patch b/packages/addons/service/boblightd/patches/boblightd-2.0.5-getopt-includes.patch similarity index 100% rename from packages/addons/service/multimedia/boblightd/patches/boblightd-2.0.5-getopt-includes.patch rename to packages/addons/service/boblightd/patches/boblightd-2.0.5-getopt-includes.patch diff --git a/packages/addons/service/multimedia/boblightd/source/bin/boblightd.start b/packages/addons/service/boblightd/source/bin/boblightd.start similarity index 100% rename from packages/addons/service/multimedia/boblightd/source/bin/boblightd.start rename to packages/addons/service/boblightd/source/bin/boblightd.start diff --git a/packages/addons/service/multimedia/boblightd/source/default.py b/packages/addons/service/boblightd/source/default.py similarity index 100% rename from packages/addons/service/multimedia/boblightd/source/default.py rename to packages/addons/service/boblightd/source/default.py diff --git a/packages/addons/service/multimedia/boblightd/source/sleep.d/boblightd.power b/packages/addons/service/boblightd/source/sleep.d/boblightd.power similarity index 100% rename from packages/addons/service/multimedia/boblightd/source/sleep.d/boblightd.power rename to packages/addons/service/boblightd/source/sleep.d/boblightd.power diff --git a/packages/addons/service/multimedia/boblightd/source/system.d/service.multimedia.boblightd.service b/packages/addons/service/boblightd/source/system.d/service.multimedia.boblightd.service similarity index 100% rename from packages/addons/service/multimedia/boblightd/source/system.d/service.multimedia.boblightd.service rename to packages/addons/service/boblightd/source/system.d/service.multimedia.boblightd.service diff --git a/packages/addons/service/dispmanx_vnc/changelog.txt b/packages/addons/service/dispmanx_vnc/changelog.txt new file mode 100644 index 00000000000..e9c3327be42 --- /dev/null +++ b/packages/addons/service/dispmanx_vnc/changelog.txt @@ -0,0 +1,5 @@ +8.0.101 +- Move settings to Kodi + +8.0.100 +- Initial addon diff --git a/packages/addons/service/dispmanx_vnc/icon/icon.png b/packages/addons/service/dispmanx_vnc/icon/icon.png new file mode 100644 index 00000000000..8838fdf0cfd Binary files /dev/null and b/packages/addons/service/dispmanx_vnc/icon/icon.png differ diff --git a/packages/addons/service/dispmanx_vnc/package.mk b/packages/addons/service/dispmanx_vnc/package.mk new file mode 100644 index 00000000000..eb9ce7b039e --- /dev/null +++ b/packages/addons/service/dispmanx_vnc/package.mk @@ -0,0 +1,51 @@ +################################################################################ +# This file is part of LibreELEC - https://libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +PKG_NAME="dispmanx_vnc" +PKG_VERSION="78e6673" +PKG_REV="101" +PKG_ARCH="arm" +PKG_ADDON_PROJECTS="RPi RPi2" +PKG_LICENSE="OSS" +PKG_SITE="https://github.com/patrikolausson/dispmanx_vnc" +PKG_URL="https://github.com/patrikolausson/dispmanx_vnc/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain libvncserver bcm2835-bootloader libconfig" +PKG_PRIORITY="optional" +PKG_SECTION="service/system" +PKG_SHORTDESC="VNC Server for Raspberry Pi" +PKG_LONGDESC="VNC Server for Raspberry Pi using dispmanx" +PKG_AUTORECONF="no" + +PKG_IS_ADDON="yes" +PKG_ADDON_NAME="Raspberry Pi VNC" +PKG_ADDON_TYPE="xbmc.service" +PKG_ADDON_REPOVERSION="8.0" +PKG_MAINTAINER="Anton Voyl (awiouy at gmail dot com)" + +pre_make_target() { + export SYSROOT_PREFIX +} + +makeinstall_target() { + : # nop +} + +addon() { + mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/bin + cp -p $PKG_BUILD/dispmanx_vncserver $ADDON_BUILD/$PKG_ADDON_ID/bin +} diff --git a/packages/addons/service/dispmanx_vnc/patches/dispmanx_vnc-0001_fix-cross-compile.patch b/packages/addons/service/dispmanx_vnc/patches/dispmanx_vnc-0001_fix-cross-compile.patch new file mode 100644 index 00000000000..344c283d616 --- /dev/null +++ b/packages/addons/service/dispmanx_vnc/patches/dispmanx_vnc-0001_fix-cross-compile.patch @@ -0,0 +1,20 @@ +diff -Naur a/Makefile b/Makefile +--- a/Makefile 2016-01-22 20:52:21.000000000 +0100 ++++ b/Makefile 2016-01-22 21:29:34.601124600 +0100 +@@ -1,9 +1,11 @@ +-CXX = g++ +-CXXFLAGS = -Wall -std=c++11 -O3 -DHAVE_LIBBCM_HOST -DUSE_EXTERNAL_LIBBCM_HOST -DUSE_VCHIQ_ARM ++CXX ?= g++ ++CXXFLAGS += -Wall -std=c++11 -O3 -DHAVE_LIBBCM_HOST -DUSE_EXTERNAL_LIBBCM_HOST -DUSE_VCHIQ_ARM + +-INCLUDES = -I/opt/vc/include/ -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux +-LIB_PATHS = -L/opt/vc/lib/ +-LIBS = -lGLESv2 -lEGL -lopenmaxil -lbcm_host -lvcos -lvchiq_arm -lpthread -lrt -lvncserver -lconfig++ ++SYSROOT_PREFIX ?= ++ ++INCLUDES = -I$(SYSROOT_PREFIX)/usr/include/ -I$(SYSROOT_PREFIX)/usr/include/interface/vcos/pthreads -I$(SYSROOT_PREFIX)/usr/include/interface/vmcs_host/linux ++LIB_PATHS = -L$(SYSROOT_PREFIX)/usr/lib/ ++LIBS = -lGLESv2 -lEGL -lopenmaxil -lbcm_host -lvcos -lvchiq_arm -lpthread -lrt -lconfig++ -lz -lssl -lcrypto -lresolv -lvncserver -ljpeg -lpng16 + + SOURCES = main.cpp \ + UFile.cpp \ diff --git a/packages/addons/service/dispmanx_vnc/source/bin/dispmanx_vncserver-service b/packages/addons/service/dispmanx_vnc/source/bin/dispmanx_vncserver-service new file mode 100755 index 00000000000..4b0d232a340 --- /dev/null +++ b/packages/addons/service/dispmanx_vnc/source/bin/dispmanx_vncserver-service @@ -0,0 +1,55 @@ +#!/bin/sh +################################################################################ +# This file is part of LibreELEC - https://libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ +. /etc/profile +oe_setup_addon service.system.dispmanx_vnc + +if [ -f "$ADDON_HOME/dispmanx_vncserver.conf" ]; then + rm "$ADDON_HOME/dispmanx_vncserver.conf" +fi + +options="-p $vnc_port -s $vnc_screen -t $vnc_framerate" +if [ "$vnc_relative" == "true" ] +then + options="$options -r" +else + options="$options -a" +fi +if [ "$vnc_unsafe" == "true" ] +then + options="$options -u" +fi +if [ "$vnc_fullscreen" == "true" ] +then + options="$options -f" +fi +if [ "$vnc_multithreaded" == "true" ] +then + options="$options -m" +fi +if [ ! -z "$vnc_password" ] +then + options="$options -P $vnc_password" +fi +if [ "$vnc_downscale" == "true" ] +then + options="$options -d" +fi + +#/bin/sleep 10 +dispmanx_vncserver $options diff --git a/packages/addons/service/dispmanx_vnc/source/default.py b/packages/addons/service/dispmanx_vnc/source/default.py new file mode 100644 index 00000000000..0a5065ba275 --- /dev/null +++ b/packages/addons/service/dispmanx_vnc/source/default.py @@ -0,0 +1,36 @@ +################################################################################ +# This file is part of LibreELEC - https://libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +import subprocess +import xbmc +import xbmcaddon + + +class Monitor(xbmc.Monitor): + + def __init__(self, *args, **kwargs): + xbmc.Monitor.__init__(self) + self.id = xbmcaddon.Addon().getAddonInfo('id') + + def onSettingsChanged(self): + subprocess.call(['systemctl', 'restart', self.id]) + + +if __name__ == "__main__": + Monitor().waitForAbort() + diff --git a/packages/addons/service/dispmanx_vnc/source/resources/language/English/strings.po b/packages/addons/service/dispmanx_vnc/source/resources/language/English/strings.po new file mode 100644 index 00000000000..328e1a184f2 --- /dev/null +++ b/packages/addons/service/dispmanx_vnc/source/resources/language/English/strings.po @@ -0,0 +1,46 @@ +# Kodi Media Center language file +# Addon Name: dispmanx_vnc +# Addon id: service.system.dispmanx_vnc +# Addon Provider: awiouy at gmail dot com +msgid "" +msgstr "" + +msgctxt "#30000" +msgid "Configuration" +msgstr "" + +msgctxt "#30001" +msgid "relative" +msgstr "" + +msgctxt "#30002" +msgid "port" +msgstr "" + +msgctxt "#30003" +msgid "screen" +msgstr "" + +msgctxt "#30004" +msgid "unsafe" +msgstr "" + +msgctxt "#30005" +msgid "fullscreen" +msgstr "" + +msgctxt "#30006" +msgid "multi-threaded" +msgstr "" + +msgctxt "#30007" +msgid "password" +msgstr "" + +msgctxt "#30008" +msgid "frame-rate" +msgstr "" + +msgctxt "#30009" +msgid "downscale" +msgstr "" diff --git a/packages/addons/service/dispmanx_vnc/source/resources/settings.xml b/packages/addons/service/dispmanx_vnc/source/resources/settings.xml new file mode 100644 index 00000000000..9953e7bc728 --- /dev/null +++ b/packages/addons/service/dispmanx_vnc/source/resources/settings.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/packages/addons/service/dispmanx_vnc/source/settings-default.xml b/packages/addons/service/dispmanx_vnc/source/settings-default.xml new file mode 100644 index 00000000000..cb68e2b7635 --- /dev/null +++ b/packages/addons/service/dispmanx_vnc/source/settings-default.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/packages/addons/service/dispmanx_vnc/source/system.d/service.system.dispmanx_vnc.service b/packages/addons/service/dispmanx_vnc/source/system.d/service.system.dispmanx_vnc.service new file mode 100644 index 00000000000..70e616d79a7 --- /dev/null +++ b/packages/addons/service/dispmanx_vnc/source/system.d/service.system.dispmanx_vnc.service @@ -0,0 +1,13 @@ +[Unit] +Description=dispmanx_vnc +After=kodi.service + +[Service] +ExecStart=/bin/sh /storage/.kodi/addons/service.system.dispmanx_vnc/bin/dispmanx_vncserver-service +TimeoutStopSec=1 +Restart=always +RestartSec=2 +StartLimitInterval=0 + +[Install] +WantedBy=kodi.target diff --git a/packages/addons/service/docker/changelog.txt b/packages/addons/service/docker/changelog.txt new file mode 100644 index 00000000000..efa8d8a6314 --- /dev/null +++ b/packages/addons/service/docker/changelog.txt @@ -0,0 +1,18 @@ +8.0.104 +- Update to docker 1.11.2 + +8.0.103 +- Allow using kodi notifications based on Docker events API + +8.0.102 +- Update to docker 1.11.1 + +8.0.101 +- Update to golang 1.6.2 +- Update to docker 1.11.0 + +8.0.100 +- Update for LibreELEC 8.0 + +7.0.100 +- Initial release diff --git a/packages/addons/service/docker/icon/icon.png b/packages/addons/service/docker/icon/icon.png new file mode 100644 index 00000000000..c9f07eb63bb Binary files /dev/null and b/packages/addons/service/docker/icon/icon.png differ diff --git a/packages/addons/service/docker/package.mk b/packages/addons/service/docker/package.mk new file mode 100644 index 00000000000..91805a97db0 --- /dev/null +++ b/packages/addons/service/docker/package.mk @@ -0,0 +1,103 @@ +################################################################################ +# This file is part of LibreELEC - https://libreelec.tv +# Copyright (C) 2009-2016 Lukas Rusak (lrusak@libreelec.tv) +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +PKG_NAME="docker" +PKG_VERSION="1.11.2" +PKG_REV="104" +PKG_ARCH="any" +PKG_ADDON_PROJECTS="Generic RPi RPi2" +PKG_LICENSE="ASL" +PKG_SITE="http://www.docker.com/" +PKG_URL="https://github.com/docker/docker/archive/v${PKG_VERSION}.tar.gz" +PKG_DEPENDS_TARGET="toolchain sqlite go:host containerd runc" +PKG_PRIORITY="optional" +PKG_SECTION="service/system" +PKG_SHORTDESC="Docker is an open-source engine that automates the deployment of any application as a lightweight, portable, self-sufficient container that will run virtually anywhere." +PKG_LONGDESC="Docker containers can encapsulate any payload, and will run consistently on and between virtually any server. The same container that a developer builds and tests on a laptop will run at scale, in production*, on VMs, bare-metal servers, OpenStack clusters, public instances, or combinations of the above." +PKG_AUTORECONF="no" + +PKG_IS_ADDON="yes" +PKG_ADDON_NAME="Docker" +PKG_ADDON_TYPE="xbmc.service" +PKG_ADDON_REPOVERSION="8.0" + +configure_target() { + export DOCKER_BUILDTAGS="daemon \ + autogen \ + exclude_graphdriver_devicemapper \ + exclude_graphdriver_aufs \ + exclude_graphdriver_btrfs" + + case $TARGET_ARCH in + x86_64) + export GOARCH=amd64 + ;; + arm) + export GOARCH=arm + + case $TARGET_CPU in + arm1176jzf-s) + export GOARM=6 + ;; + cortex-a7) + export GOARM=7 + ;; + esac + ;; + esac + + export GOOS=linux + export CGO_ENABLED=1 + export CGO_NO_EMULATION=1 + export CGO_CFLAGS=$CFLAGS + export LDFLAGS="-w -linkmode external -extldflags -Wl,--unresolved-symbols=ignore-in-shared-libs -extld $TARGET_CC" + export GOLANG=$ROOT/$TOOLCHAIN/lib/golang/bin/go + export GOPATH=$ROOT/$PKG_BUILD/.gopath:$ROOT/$PKG_BUILD/vendor + export GOROOT=$ROOT/$TOOLCHAIN/lib/golang + export PATH=$PATH:$GOROOT/bin + + ln -fs $ROOT/$PKG_BUILD $ROOT/$PKG_BUILD/vendor/src/github.com/docker/docker + + # used for docker version + export GITCOMMIT=$PKG_VERSION + export VERSION=$PKG_VERSION + export BUILDTIME="$(date --utc)" + bash ./hack/make/.go-autogen +} + +make_target() { + mkdir -p bin + $GOLANG build -v -o bin/docker -a -tags "$DOCKER_BUILDTAGS" -ldflags "$LDFLAGS" ./docker +} + +makeinstall_target() { + : +} + +addon() { + mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/bin + cp -P $ROOT/$PKG_BUILD/bin/docker $ADDON_BUILD/$PKG_ADDON_ID/bin + + # containerd + cp -P $(get_build_dir containerd)/bin/containerd $ADDON_BUILD/$PKG_ADDON_ID/bin/docker-containerd + cp -P $(get_build_dir containerd)/bin/containerd-shim $ADDON_BUILD/$PKG_ADDON_ID/bin/docker-containerd-shim + cp -P $(get_build_dir containerd)/bin/ctr $ADDON_BUILD/$PKG_ADDON_ID/bin/docker-containerd-ctr + + # runc + cp -P $(get_build_dir runc)/bin/runc $ADDON_BUILD/$PKG_ADDON_ID/bin/docker-runc +} diff --git a/packages/addons/service/docker/patches/docker-001-use-addon-storage-location.patch b/packages/addons/service/docker/patches/docker-001-use-addon-storage-location.patch new file mode 100644 index 00000000000..4b80760c1b2 --- /dev/null +++ b/packages/addons/service/docker/patches/docker-001-use-addon-storage-location.patch @@ -0,0 +1,266 @@ +# Created with +# find . -name "*.go" -print | xargs sed -i 's/\/etc\/docker/\/storage\/.kodi\/userdata\/addon_data\/service.system.docker\/config/g' + +diff -Naur a/docker/daemon_unix.go b/docker/daemon_unix.go +--- a/docker/daemon_unix.go 2016-04-25 20:35:31.000000000 -0700 ++++ b/docker/daemon_unix.go 2016-05-02 12:19:20.461479163 -0700 +@@ -16,7 +16,7 @@ + "github.com/docker/docker/pkg/system" + ) + +-const defaultDaemonConfigFile = "/etc/docker/daemon.json" ++const defaultDaemonConfigFile = "/storage/.kodi/userdata/addon_data/service.system.docker/config/daemon.json" + + func setPlatformServerConfig(serverConfig *apiserver.Config, daemonCfg *daemon.Config) *apiserver.Config { + serverConfig.EnableCors = daemonCfg.EnableCors +@@ -49,7 +49,7 @@ + } + + func getDaemonConfDir() string { +- return "/etc/docker" ++ return "/storage/.kodi/userdata/addon_data/service.system.docker/config" + } + + // setupConfigReloadTrap configures the USR2 signal to reload the configuration. +diff -Naur a/integration-cli/docker_cli_authz_unix_test.go b/integration-cli/docker_cli_authz_unix_test.go +--- a/integration-cli/docker_cli_authz_unix_test.go 2016-04-25 20:35:31.000000000 -0700 ++++ b/integration-cli/docker_cli_authz_unix_test.go 2016-05-02 12:19:20.291477565 -0700 +@@ -134,10 +134,10 @@ + w.Write(b) + }) + +- err := os.MkdirAll("/etc/docker/plugins", 0755) ++ err := os.MkdirAll("/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins", 0755) + c.Assert(err, checker.IsNil) + +- fileName := fmt.Sprintf("/etc/docker/plugins/%s.spec", testAuthZPlugin) ++ fileName := fmt.Sprintf("/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins/%s.spec", testAuthZPlugin) + err = ioutil.WriteFile(fileName, []byte(s.server.URL), 0644) + c.Assert(err, checker.IsNil) + } +@@ -186,7 +186,7 @@ + + s.server.Close() + +- err := os.RemoveAll("/etc/docker/plugins") ++ err := os.RemoveAll("/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins") + c.Assert(err, checker.IsNil) + } + +diff -Naur a/integration-cli/docker_cli_daemon_test.go b/integration-cli/docker_cli_daemon_test.go +--- a/integration-cli/docker_cli_daemon_test.go 2016-04-25 20:35:31.000000000 -0700 ++++ b/integration-cli/docker_cli_daemon_test.go 2016-05-02 12:19:20.356478174 -0700 +@@ -512,13 +512,13 @@ + + func (s *DockerDaemonSuite) TestDaemonKeyGeneration(c *check.C) { + // TODO: skip or update for Windows daemon +- os.Remove("/etc/docker/key.json") ++ os.Remove("/storage/.kodi/userdata/addon_data/service.system.docker/config/key.json") + if err := s.d.Start(); err != nil { + c.Fatalf("Could not start daemon: %v", err) + } + s.d.Stop() + +- k, err := libtrust.LoadKeyFile("/etc/docker/key.json") ++ k, err := libtrust.LoadKeyFile("/storage/.kodi/userdata/addon_data/service.system.docker/config/key.json") + if err != nil { + c.Fatalf("Error opening key file") + } +@@ -531,7 +531,7 @@ + + func (s *DockerDaemonSuite) TestDaemonKeyMigration(c *check.C) { + // TODO: skip or update for Windows daemon +- os.Remove("/etc/docker/key.json") ++ os.Remove("/storage/.kodi/userdata/addon_data/service.system.docker/config/key.json") + k1, err := libtrust.GenerateECP256PrivateKey() + if err != nil { + c.Fatalf("Error generating private key: %s", err) +@@ -548,7 +548,7 @@ + } + s.d.Stop() + +- k2, err := libtrust.LoadKeyFile("/etc/docker/key.json") ++ k2, err := libtrust.LoadKeyFile("/storage/.kodi/userdata/addon_data/service.system.docker/config/key.json") + if err != nil { + c.Fatalf("Error opening key file") + } +@@ -1296,7 +1296,7 @@ + Y string `json:"y"` + } + +- os.Remove("/etc/docker/key.json") ++ os.Remove("/storage/.kodi/userdata/addon_data/service.system.docker/config/key.json") + if err := s.d.Start(); err != nil { + c.Fatalf("Failed to start daemon: %v", err) + } +@@ -1306,7 +1306,7 @@ + } + + config := &Config{} +- bytes, err := ioutil.ReadFile("/etc/docker/key.json") ++ bytes, err := ioutil.ReadFile("/storage/.kodi/userdata/addon_data/service.system.docker/config/key.json") + if err != nil { + c.Fatalf("Error reading key.json file: %s", err) + } +@@ -1326,11 +1326,11 @@ + } + + // write back +- if err := ioutil.WriteFile("/etc/docker/key.json", newBytes, 0400); err != nil { ++ if err := ioutil.WriteFile("/storage/.kodi/userdata/addon_data/service.system.docker/config/key.json", newBytes, 0400); err != nil { + c.Fatalf("Error ioutil.WriteFile: %s", err) + } + +- defer os.Remove("/etc/docker/key.json") ++ defer os.Remove("/storage/.kodi/userdata/addon_data/service.system.docker/config/key.json") + + if err := s.d.Start(); err == nil { + c.Fatalf("It should not be successful to start daemon with wrong key: %v", err) +diff -Naur a/integration-cli/docker_cli_external_graphdriver_unix_test.go b/integration-cli/docker_cli_external_graphdriver_unix_test.go +--- a/integration-cli/docker_cli_external_graphdriver_unix_test.go 2016-04-25 20:35:31.000000000 -0700 ++++ b/integration-cli/docker_cli_external_graphdriver_unix_test.go 2016-05-02 12:19:20.382478419 -0700 +@@ -306,10 +306,10 @@ + respond(w, &graphDriverResponse{Size: size}) + }) + +- err = os.MkdirAll("/etc/docker/plugins", 0755) +- c.Assert(err, check.IsNil, check.Commentf("error creating /etc/docker/plugins")) ++ err = os.MkdirAll("/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins", 0755) ++ c.Assert(err, check.IsNil, check.Commentf("error creating /storage/.kodi/userdata/addon_data/service.system.docker/config/plugins")) + +- specFile := "/etc/docker/plugins/" + name + "." + ext ++ specFile := "/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins/" + name + "." + ext + err = ioutil.WriteFile(specFile, b, 0644) + c.Assert(err, check.IsNil, check.Commentf("error writing to %s", specFile)) + } +@@ -318,8 +318,8 @@ + s.server.Close() + s.jserver.Close() + +- err := os.RemoveAll("/etc/docker/plugins") +- c.Assert(err, check.IsNil, check.Commentf("error removing /etc/docker/plugins")) ++ err := os.RemoveAll("/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins") ++ c.Assert(err, check.IsNil, check.Commentf("error removing /storage/.kodi/userdata/addon_data/service.system.docker/config/plugins")) + } + + func (s *DockerExternalGraphdriverSuite) TestExternalGraphDriver(c *check.C) { +diff -Naur a/integration-cli/docker_cli_network_unix_test.go b/integration-cli/docker_cli_network_unix_test.go +--- a/integration-cli/docker_cli_network_unix_test.go 2016-04-25 20:35:31.000000000 -0700 ++++ b/integration-cli/docker_cli_network_unix_test.go 2016-05-02 12:19:20.380478400 -0700 +@@ -200,14 +200,14 @@ + } + }) + +- err := os.MkdirAll("/etc/docker/plugins", 0755) ++ err := os.MkdirAll("/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins", 0755) + c.Assert(err, checker.IsNil) + +- fileName := fmt.Sprintf("/etc/docker/plugins/%s.spec", netDrv) ++ fileName := fmt.Sprintf("/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins/%s.spec", netDrv) + err = ioutil.WriteFile(fileName, []byte(url), 0644) + c.Assert(err, checker.IsNil) + +- ipamFileName := fmt.Sprintf("/etc/docker/plugins/%s.spec", ipamDrv) ++ ipamFileName := fmt.Sprintf("/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins/%s.spec", ipamDrv) + err = ioutil.WriteFile(ipamFileName, []byte(url), 0644) + c.Assert(err, checker.IsNil) + } +@@ -219,7 +219,7 @@ + + s.server.Close() + +- err := os.RemoveAll("/etc/docker/plugins") ++ err := os.RemoveAll("/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins") + c.Assert(err, checker.IsNil) + } + +diff -Naur a/integration-cli/docker_cli_start_volume_driver_unix_test.go b/integration-cli/docker_cli_start_volume_driver_unix_test.go +--- a/integration-cli/docker_cli_start_volume_driver_unix_test.go 2016-04-25 20:35:31.000000000 -0700 ++++ b/integration-cli/docker_cli_start_volume_driver_unix_test.go 2016-05-02 12:19:20.387478466 -0700 +@@ -216,17 +216,17 @@ + send(w, nil) + }) + +- err := os.MkdirAll("/etc/docker/plugins", 0755) ++ err := os.MkdirAll("/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins", 0755) + c.Assert(err, checker.IsNil) + +- err = ioutil.WriteFile("/etc/docker/plugins/test-external-volume-driver.spec", []byte(s.server.URL), 0644) ++ err = ioutil.WriteFile("/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins/test-external-volume-driver.spec", []byte(s.server.URL), 0644) + c.Assert(err, checker.IsNil) + } + + func (s *DockerExternalVolumeSuite) TearDownSuite(c *check.C) { + s.server.Close() + +- err := os.RemoveAll("/etc/docker/plugins") ++ err := os.RemoveAll("/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins") + c.Assert(err, checker.IsNil) + } + +@@ -311,7 +311,7 @@ + + // Make sure a request to use a down driver doesn't block other requests + func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverLookupNotBlocked(c *check.C) { +- specPath := "/etc/docker/plugins/down-driver.spec" ++ specPath := "/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins/down-driver.spec" + err := ioutil.WriteFile(specPath, []byte("tcp://127.0.0.7:9999"), 0644) + c.Assert(err, check.IsNil) + defer os.RemoveAll(specPath) +@@ -350,7 +350,7 @@ + err := s.d.StartWithBusybox() + c.Assert(err, checker.IsNil) + +- specPath := "/etc/docker/plugins/test-external-volume-driver-retry.spec" ++ specPath := "/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins/test-external-volume-driver-retry.spec" + os.RemoveAll(specPath) + defer os.RemoveAll(specPath) + +diff -Naur a/pkg/plugins/discovery.go b/pkg/plugins/discovery.go +--- a/pkg/plugins/discovery.go 2016-04-25 20:35:31.000000000 -0700 ++++ b/pkg/plugins/discovery.go 2016-05-02 12:19:20.540479907 -0700 +@@ -16,7 +16,7 @@ + // ErrNotFound plugin not found + ErrNotFound = errors.New("plugin not found") + socketsPath = "/run/docker/plugins" +- specsPaths = []string{"/etc/docker/plugins", "/usr/lib/docker/plugins"} ++ specsPaths = []string{"/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins", "/usr/lib/docker/plugins"} + ) + + // localRegistry defines a registry that is local (using unix socket). +diff -Naur a/pkg/plugins/plugins.go b/pkg/plugins/plugins.go +--- a/pkg/plugins/plugins.go 2016-04-25 20:35:31.000000000 -0700 ++++ b/pkg/plugins/plugins.go 2016-05-02 12:19:20.539479898 -0700 +@@ -4,7 +4,7 @@ + // Docker discovers plugins by looking for them in the plugin directory whenever + // a user or container tries to use one by name. UNIX domain socket files must + // be located under /run/docker/plugins, whereas spec files can be located +-// either under /etc/docker/plugins or /usr/lib/docker/plugins. This is handled ++// either under /storage/.kodi/userdata/addon_data/service.system.docker/config/plugins or /usr/lib/docker/plugins. This is handled + // by the Registry interface, which lets you list all plugins or get a plugin by + // its name if it exists. + // +diff -Naur a/registry/config_unix.go b/registry/config_unix.go +--- a/registry/config_unix.go 2016-04-25 20:35:31.000000000 -0700 ++++ b/registry/config_unix.go 2016-05-02 12:19:20.502479549 -0700 +@@ -4,7 +4,7 @@ + + var ( + // CertsDir is the directory where certificates are stored +- CertsDir = "/etc/docker/certs.d" ++ CertsDir = "/storage/.kodi/userdata/addon_data/service.system.docker/config/certs.d" + ) + + // cleanPath is used to ensure that a directory name is valid on the target +diff -Naur a/registry/endpoint_v1.go b/registry/endpoint_v1.go +--- a/registry/endpoint_v1.go 2016-04-25 20:35:31.000000000 -0700 ++++ b/registry/endpoint_v1.go 2016-05-02 12:19:20.501479540 -0700 +@@ -49,7 +49,7 @@ + if endpoint.IsSecure { + // If registry is secure and HTTPS failed, show user the error and tell them about `--insecure-registry` + // in case that's what they need. DO NOT accept unknown CA certificates, and DO NOT fallback to HTTP. +- return fmt.Errorf("invalid registry endpoint %s: %v. If this private registry supports only HTTP or HTTPS with an unknown CA certificate, please add `--insecure-registry %s` to the daemon's arguments. In the case of HTTPS, if you have access to the registry's CA certificate, no need for the flag; simply place the CA certificate at /etc/docker/certs.d/%s/ca.crt", endpoint, err, endpoint.URL.Host, endpoint.URL.Host) ++ return fmt.Errorf("invalid registry endpoint %s: %v. If this private registry supports only HTTP or HTTPS with an unknown CA certificate, please add `--insecure-registry %s` to the daemon's arguments. In the case of HTTPS, if you have access to the registry's CA certificate, no need for the flag; simply place the CA certificate at /storage/.kodi/userdata/addon_data/service.system.docker/config/certs.d/%s/ca.crt", endpoint, err, endpoint.URL.Host, endpoint.URL.Host) + } + + // If registry is insecure and HTTPS failed, fallback to HTTP. diff --git a/packages/addons/service/docker/source/bin/docker-config b/packages/addons/service/docker/source/bin/docker-config new file mode 100755 index 00000000000..703240f28a0 --- /dev/null +++ b/packages/addons/service/docker/source/bin/docker-config @@ -0,0 +1,37 @@ +#!/bin/sh +################################################################################ +# This file is part of LibreELEC - https://libreelec.tv +# Copyright (C) 2009-2016 Lukas Rusak (lrusak@libreelec.tv) +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +ADDON_DIR="/storage/.kodi/addons/service.system.docker" +ADDON_HOME_DIR="/storage/.kodi/userdata/addon_data/service.system.docker" + +if [ ! -d "$ADDON_HOME_DIR/config" ]; then + mkdir -p $ADDON_HOME_DIR/config +fi + +if [ ! -f "$ADDON_HOME_DIR/config/docker.conf" ]; then + cp $ADDON_DIR/config/docker.conf $ADDON_HOME_DIR/config/docker.conf +fi + +if [ ! -d "$ADDON_HOME_DIR/docker" ]; then + mkdir -p $ADDON_HOME_DIR/docker +fi + +if [ ! -d /var/lib/docker ]; then + ln -sf $ADDON_HOME_DIR/docker /var/lib/docker +fi diff --git a/packages/addons/service/docker/source/config/docker.conf b/packages/addons/service/docker/source/config/docker.conf new file mode 100644 index 00000000000..36908b53d72 --- /dev/null +++ b/packages/addons/service/docker/source/config/docker.conf @@ -0,0 +1,2 @@ +DOCKER_DAEMON_OPTS="--graph=/storage/.kodi/userdata/addon_data/service.system.docker/docker" +DOCKER_STORAGE_OPTS="--storage-driver=overlay" diff --git a/packages/addons/service/docker/source/default.py b/packages/addons/service/docker/source/default.py new file mode 100644 index 00000000000..7a9a0b2f97f --- /dev/null +++ b/packages/addons/service/docker/source/default.py @@ -0,0 +1,342 @@ +################################################################################ +# This file is part of LibreELEC - https://libreelec.tv +# Copyright (C) 2009-2016 Lukas Rusak (lrusak@libreelec.tv) +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +import os +import subprocess +import sys +import threading +import time +import xbmc +import xbmcaddon +import xbmcgui + +sys.path.append('/usr/share/kodi/addons/service.libreelec.settings') +import oe + +__author__ = 'lrusak' +__addon__ = xbmcaddon.Addon() +__path__ = __addon__.getAddonInfo('path') +__service__ = __path__ + '/systemd/' + __addon__.getAddonInfo('id') + '.service' +__servicename__ = __addon__.getAddonInfo('id') + '.service' +__socket__ = __path__ + '/systemd/' + __addon__.getAddonInfo('id') + '.socket' +__socketname__ = __addon__.getAddonInfo('id') + '.socket' + +sys.path.append(__path__ + '/lib') +import dockermon + +# docker events for api 1.23 (docker version 1.11.x) +# https://docs.docker.com/engine/reference/api/docker_remote_api_v1.23/#monitor-docker-s-events + +docker_events = { + 'container': { + 'string': 30030, + 'event': { + 'attach': { + 'string': 30031, + 'enabled': '', + }, + 'commit': { + 'string': 30032, + 'enabled': '', + }, + 'copy': { + 'string': 30033, + 'enabled': '', + }, + 'create': { + 'string': 30034, + 'enabled': '', + }, + 'destroy': { + 'string': 30035, + 'enabled': '', + }, + 'die': { + 'string': 30036, + 'enabled': '', + }, + 'exec_create': { + 'string': 30037, + 'enabled': '', + }, + 'exec_start': { + 'string': 30038, + 'enabled': '', + }, + 'export': { + 'string': 30039, + 'enabled': '', + }, + 'kill': { + 'string': 30040, + 'enabled': True, + }, + 'oom': { + 'string': 30041, + 'enabled': True, + }, + 'pause': { + 'string': 30042, + 'enabled': '', + }, + 'rename': { + 'string': 30043, + 'enabled': '', + }, + 'resize': { + 'string': 30044, + 'enabled': '', + }, + 'restart': { + 'string': 30045, + 'enabled': '', + }, + 'start': { + 'string': 30046, + 'enabled': True, + }, + 'stop': { + 'string': 30047, + 'enabled': True, + }, + 'top': { + 'string': 30048, + 'enabled': '', + }, + 'unpause': { + 'string': 30049, + 'enabled': '', + }, + 'update': { + 'string': 30050, + 'enabled': '', + }, + }, + }, + 'image': { + 'string': 30060, + 'event': { + 'delete': { + 'string': 30061, + 'enabled': '', + }, + 'import': { + 'string': 30062, + 'enabled': '', + }, + 'pull': { + 'string': 30063, + 'enabled': True, + }, + 'push': { + 'string': 30064, + 'enabled': '', + }, + 'tag': { + 'string': 30065, + 'enabled': '', + }, + 'untag': { + 'string': 30066, + 'enabled': '', + }, + }, + }, + 'volume': { + 'string': 30070, + 'event': { + 'create': { + 'string': 30071, + 'enabled': '', + }, + 'mount': { + 'string': 30072, + 'enabled': '', + }, + 'unmount': { + 'string': 30073, + 'enabled': '', + }, + 'destroy': { + 'string': 30074, + 'enabled': '', + }, + }, + }, + 'network': { + 'string': 30080, + 'event': { + 'create': { + 'string': 30081, + 'enabled': '', + }, + 'connect': { + 'string': 30082, + 'enabled': '', + }, + 'disconnect': { + 'string': 30083, + 'enabled': '', + }, + 'destroy': { + 'string': 30084, + 'enabled': '', + }, + }, + }, + } + +def print_notification(json_data): + event_string = docker_events[json_data['Type']]['event'][json_data['Action']]['string'] + if __addon__.getSetting('notifications') is '0': # default + if docker_events[json_data['Type']]['event'][json_data['Action']]['enabled']: + try: + message = unicode(' '.join([__addon__.getLocalizedString(30010), + json_data['Actor']['Attributes']['name'], + '|', + __addon__.getLocalizedString(30012), + __addon__.getLocalizedString(event_string)])) + except KeyError as e: + message = unicode(' '.join([__addon__.getLocalizedString(30011), + json_data['Type'], + '|', + __addon__.getLocalizedString(30012), + __addon__.getLocalizedString(event_string)])) + + elif __addon__.getSetting('notifications') is '1': # all + try: + message = unicode(' '.join([__addon__.getLocalizedString(30010), + json_data['Actor']['Attributes']['name'], + '|', + __addon__.getLocalizedString(30012), + __addon__.getLocalizedString(event_string)])) + except KeyError as e: + message = unicode(' '.join([__addon__.getLocalizedString(30011), + json_data['Type'], + '|', + __addon__.getLocalizedString(30012), + __addon__.getLocalizedString(event_string)])) + + elif __addon__.getSetting('notifications') is '2': # none + pass + + elif __addon__.getSetting('notifications') is '3': # custom + if __addon__.getSetting(json_data['Action']) == 'true': + try: + message = unicode(' '.join([__addon__.getLocalizedString(30010), + json_data['Actor']['Attributes']['name'], + '|', + __addon__.getLocalizedString(30012), + __addon__.getLocalizedString(event_string)])) + except KeyError as e: + message = unicode(' '.join([__addon__.getLocalizedString(30011), + json_data['Type'], + '|', + __addon__.getLocalizedString(30012), + __addon__.getLocalizedString(event_string)])) + + dialog = xbmcgui.Dialog() + try: + if message is not '': + length = int(__addon__.getSetting('notification_length')) * 1000 + dialog.notification('Docker', message, '/storage/.kodi/addons/service.system.docker/icon.png', length) + xbmc.log('## service.system.docker ## ' + unicode(message)) + except NameError as e: + pass + +class dockermonThread(threading.Thread): + + def __init__(self): + threading.Thread.__init__(self) + self._is_running = True + + def run(self): + while self._is_running: + dockermon.watch(print_notification) + + def stop(self): + self._is_running = False + +class Main(object): + + def __init__(self, *args, **kwargs): + + monitor = DockerMonitor(self) + + if not Docker().is_active(): + if not Docker().is_enabled(): + Docker().enable() + Docker().start() + + while not monitor.abortRequested(): + if monitor.waitForAbort(): + # we don't want to stop or disable docker while it's installed + pass + +class Docker(object): + + def enable(self): + self.execute('systemctl enable ' + __service__) + self.execute('systemctl enable ' + __socket__) + + def disable(self): + self.execute('systemctl disable ' + __servicename__) + self.execute('systemctl disable ' + __socketname__) + + def is_enabled(self): + if self.execute('systemctl is-enabled ' + __servicename__, get_result=1).strip('\n') == 'enabled': + return True + else: + return False + + def start(self): + self.execute('systemctl start ' + __servicename__) + + def stop(self): + self.execute('systemctl stop ' + __servicename__) + + def is_active(self): + if self.execute('systemctl is-active ' + __servicename__, get_result=1).strip('\n') == 'active': + return True + else: + return False + + def execute(self, command_line, get_result=0): + result = oe.execute(command_line, get_result=get_result) + if get_result: + return result + + def restart(self): + if self.is_active(): + self.stop() + self.start() + +class DockerMonitor(xbmc.Monitor): + + def __init__(self, *args, **kwargs): + xbmc.Monitor.__init__(self) + + def onSettingsChanged(self): + pass + +if ( __name__ == "__main__" ): + dockermonThread().start() + Main() + + del DockerMonitor + dockermonThread().stop() diff --git a/packages/addons/service/docker/source/examples/couchpotato.service b/packages/addons/service/docker/source/examples/couchpotato.service new file mode 100644 index 00000000000..3fd8b371f5a --- /dev/null +++ b/packages/addons/service/docker/source/examples/couchpotato.service @@ -0,0 +1,22 @@ +[Unit] +Description=%p container +Requires=service.system.docker.service +After=service.system.docker.service + +[Service] +Restart=always +RestartSec=10s +TimeoutStartSec=0 +ExecStartPre=-/bin/sh -c "mkdir -p /storage/%p/config /storage/%p/data" +ExecStart=/storage/.kodi/addons/service.system.docker/bin/docker run \ + --rm \ + --name=%p \ + --hostname=libreelec-%p \ + --volume=/storage/%p/config:/config \ + --volume=/storage/%p/data:/data \ + --publish=5050:5050 \ + timhaak/%p +ExecStop=/storage/.kodi/addons/service.system.docker/bin/docker stop %p + +[Install] +WantedBy=multi-user.target diff --git a/packages/addons/service/docker/source/examples/mysql.service b/packages/addons/service/docker/source/examples/mysql.service new file mode 100644 index 00000000000..77b0667ed1f --- /dev/null +++ b/packages/addons/service/docker/source/examples/mysql.service @@ -0,0 +1,26 @@ +[Unit] +Description=%p container +Requires=service.system.docker.service +After=service.system.docker.service +Befora=kodi.service + +[Service] +Restart=always +RestartSec=10s +TimeoutStartSec=0 +ExecStartPre=-/bin/sh -c "mkdir -p /storage/%p/config /storage/%p/data" +ExecStart=/storage/.kodi/addons/service.system.docker/bin/docker run \ + --rm \ + --name=%p \ + --hostname=libreelec-%p \ + --volume=/storage/%p/config/:/etc/mysql/conf.d \ + --volume=/storage/%p/data:/var/lib/mysql \ + --publish=3306:3306 \ + --env=MYSQL_ROOT_PASSWORD=libreelec \ + --env=MYSQL_USER=kodi \ + --env=MYSQL_PASSWORD=kodi \ + %p +ExecStop=/storage/.kodi/addons/service.system.docker/bin/docker stop %p + +[Install] +WantedBy=multi-user.target diff --git a/packages/addons/service/docker/source/examples/sabnzbd.service b/packages/addons/service/docker/source/examples/sabnzbd.service new file mode 100644 index 00000000000..e85e4da1b7a --- /dev/null +++ b/packages/addons/service/docker/source/examples/sabnzbd.service @@ -0,0 +1,22 @@ +[Unit] +Description=%p container +Requires=service.system.docker.service +After=service.system.docker.service + +[Service] +Restart=always +RestartSec=10s +TimeoutStartSec=0 +ExecStartPre=-/bin/sh -c "mkdir -p /storage/%p/config /storage/%p/data" +ExecStart=/storage/.kodi/addons/service.system.docker/bin/docker run \ + --rm \ + --name=%p \ + --hostname=libreelec-%p \ + --volume=/storage/%p/config:/config \ + --volume=/storage/%p/data:/data \ + --publish=8080:8080 \ + timhaak/%p +ExecStop=/storage/.kodi/addons/service.system.docker/bin/docker stop %p + +[Install] +WantedBy=multi-user.target diff --git a/packages/addons/service/docker/source/examples/sickbeard.service b/packages/addons/service/docker/source/examples/sickbeard.service new file mode 100644 index 00000000000..573342bb92c --- /dev/null +++ b/packages/addons/service/docker/source/examples/sickbeard.service @@ -0,0 +1,22 @@ +[Unit] +Description=%p container +Requires=service.system.docker.service +After=service.system.docker.service + +[Service] +Restart=always +RestartSec=10s +TimeoutStartSec=0 +ExecStartPre=-/bin/sh -c "mkdir -p /storage/%p/config /storage/%p/data" +ExecStart=/storage/.kodi/addons/service.system.docker/bin/docker run \ + --rm \ + --name=%p \ + --hostname=libreelec-%p \ + --volume=/storage/%p/config:/config \ + --volume=/storage/%p/data:/data \ + --publish=8081:8081 \ + timhaak/%p +ExecStop=/storage/.kodi/addons/service.system.docker/bin/docker stop %p + +[Install] +WantedBy=multi-user.target diff --git a/packages/addons/service/docker/source/examples/transmission.service b/packages/addons/service/docker/source/examples/transmission.service new file mode 100644 index 00000000000..7a248c6934f --- /dev/null +++ b/packages/addons/service/docker/source/examples/transmission.service @@ -0,0 +1,24 @@ +[Unit] +Description=%p container +Requires=service.system.docker.service +After=service.system.docker.service + +[Service] +Restart=always +RestartSec=10s +TimeoutStartSec=0 +ExecStartPre=-/bin/sh -c "mkdir -p /storage/%p/watch /storage/%p/downloads /storage/%p/incomplete /storage/%p/config" +ExecStart=/storage/.kodi/addons/service.system.docker/bin/docker run \ + --rm \ + --name=%p \ + --hostname=libreelec-%p \ + --volume=/storage/%p/watch:/watch \ + --volume=/storage/%p/downloads:/downloads \ + --volume=/storage/%p/incomplete:/incomplete \ + --volume=/storage/%p/config:/config \ + --publish=9091:9091 \ + timhaak/%p +ExecStop=/storage/.kodi/addons/service.system.docker/bin/docker stop %p + +[Install] +WantedBy=multi-user.target diff --git a/packages/addons/service/docker/source/examples/var-lib-docker.mount b/packages/addons/service/docker/source/examples/var-lib-docker.mount new file mode 100644 index 00000000000..6744e125c31 --- /dev/null +++ b/packages/addons/service/docker/source/examples/var-lib-docker.mount @@ -0,0 +1,14 @@ +[Unit] +Description=Docker loopback mount +Requires=local-fs.target +Before=service.system.docker.service + +[Mount] +What=/storage/btrfs-loop.img +Where=/var/lib/docker + +Options=loop,compress=lzo +Type=btrfs + +[Install] +WantedBy=multi-user.target diff --git a/packages/addons/service/docker/source/lib/dockermon.py b/packages/addons/service/docker/source/lib/dockermon.py new file mode 100755 index 00000000000..e66e1025deb --- /dev/null +++ b/packages/addons/service/docker/source/lib/dockermon.py @@ -0,0 +1,153 @@ +#!/usr/bin/env python +"""docker monitor using docker /events HTTP streaming API""" +"""https://github.com/CyberInt/dockermon""" + +from contextlib import closing +from functools import partial +from socket import socket, AF_UNIX +from subprocess import Popen, PIPE +from sys import stdout, version_info +import json +import shlex + +if version_info[:2] < (3, 0): + from httplib import OK as HTTP_OK + from urlparse import urlparse +else: + from http.client import OK as HTTP_OK + from urllib.parse import urlparse + +__version__ = '0.2.2' +# buffer size must be 256 or lower otherwise events won't show in realtime +bufsize = 256 +default_sock_url = 'ipc:///var/run/docker.sock' + + +class DockermonError(Exception): + pass + + +def read_http_header(sock): + """Read HTTP header from socket, return header and rest of data.""" + buf = [] + hdr_end = '\r\n\r\n' + + while True: + buf.append(sock.recv(bufsize).decode('utf-8')) + data = ''.join(buf) + i = data.find(hdr_end) + if i == -1: + continue + return data[:i], data[i + len(hdr_end):] + + +def header_status(header): + """Parse HTTP status line, return status (int) and reason.""" + status_line = header[:header.find('\r')] + # 'HTTP/1.1 200 OK' -> (200, 'OK') + fields = status_line.split(None, 2) + return int(fields[1]), fields[2] + + +def connect(url): + """Connect to UNIX or TCP socket. + + url can be either tcp://:port or ipc:// + """ + url = urlparse(url) + if url.scheme == 'tcp': + sock = socket() + netloc = tuple(url.netloc.rsplit(':', 1)) + hostname = socket.gethostname() + elif url.scheme == 'ipc': + sock = socket(AF_UNIX) + netloc = url.path + hostname = 'localhost' + else: + raise ValueError('unknown socket type: %s' % url.scheme) + + sock.connect(netloc) + return sock, hostname + + +def watch(callback, url=default_sock_url): + """Watch docker events. Will call callback with each new event (dict). + + url can be either tcp://:port or ipc:// + """ + sock, hostname = connect(url) + request = 'GET /events HTTP/1.1\nHost: %s\n\n' % hostname + request = request.encode('utf-8') + + with closing(sock): + sock.sendall(request) + header, payload = read_http_header(sock) + status, reason = header_status(header) + if status != HTTP_OK: + raise DockermonError('bad HTTP status: %s %s' % (status, reason)) + + # Messages are \r\n\r\n + buf = [payload] + while True: + chunk = sock.recv(bufsize) + if not chunk: + raise EOFError('socket closed') + buf.append(chunk.decode('utf-8')) + data = ''.join(buf) + i = data.find('\r\n') + if i == -1: + continue + + size = int(data[:i], 16) + start = i + 2 # Skip initial \r\n + + if len(data) < start + size + 2: + continue + payload = data[start:start+size] + callback(json.loads(payload)) + buf = [data[start+size+2:]] # Skip \r\n suffix + + +def print_callback(msg): + """Print callback, prints message to stdout as JSON in one line.""" + json.dump(msg, stdout) + stdout.write('\n') + stdout.flush() + + +def prog_callback(prog, msg): + """Program callback, calls prog with message in stdin""" + pipe = Popen(prog, stdin=PIPE) + data = json.dumps(msg) + pipe.stdin.write(data.encode('utf-8')) + pipe.stdin.close() + + +if __name__ == '__main__': + from argparse import ArgumentParser + + parser = ArgumentParser(description=__doc__) + parser.add_argument('--prog', default=None, + help='program to call (e.g. "jq --unbuffered .")') + parser.add_argument( + '--socket-url', default=default_sock_url, + help='socket url (ipc:///path/to/sock or tcp:///host:port)') + parser.add_argument( + '--version', help='print version and exit', + action='store_true', default=False) + args = parser.parse_args() + + if args.version: + print('dockermon %s' % __version__) + raise SystemExit + + if args.prog: + prog = shlex.split(args.prog) + callback = partial(prog_callback, prog) + else: + callback = print_callback + + try: + watch(callback, args.socket_url) + except (KeyboardInterrupt, EOFError): + pass diff --git a/packages/addons/service/docker/source/resources/language/English/strings.po b/packages/addons/service/docker/source/resources/language/English/strings.po new file mode 100644 index 00000000000..b5a0a465e93 --- /dev/null +++ b/packages/addons/service/docker/source/resources/language/English/strings.po @@ -0,0 +1,197 @@ +# Kodi Media Center language file +# Addon Name: docker +# Addon id: service.system.docker +msgid "" +msgstr "" + +msgctxt "#30000" +msgid "Settings" +msgstr "" + +msgctxt "#30001" +msgid "Notifications" +msgstr "" + +msgctxt "#30002" +msgid "Default" +msgstr "" + +msgctxt "#30003" +msgid "All" +msgstr "" + +msgctxt "#30004" +msgid "Off" +msgstr "" + +msgctxt "#30005" +msgid "Custom" +msgstr "" + +msgctxt "#30006" +msgid "Notification Length (Seconds)" +msgstr "" + +msgctxt "#30010" +msgid "Name:" +msgstr "" + +msgctxt "#30011" +msgid "Type:" +msgstr "" + +msgctxt "#30012" +msgid "Action:" +msgstr "" + +msgctxt "#30030" +msgid "Container" +msgstr "" + +msgctxt "#30031" +msgid "attach" +msgstr "" + +msgctxt "#30032" +msgid "commit" +msgstr "" + +msgctxt "#30033" +msgid "copy" +msgstr "" + +msgctxt "#30034" +msgid "create" +msgstr "" + +msgctxt "#30035" +msgid "destroy" +msgstr "" + +msgctxt "#30036" +msgid "die" +msgstr "" + +msgctxt "#30037" +msgid "exec_create" +msgstr "" + +msgctxt "#30038" +msgid "exec_start" +msgstr "" + +msgctxt "#30039" +msgid "export" +msgstr "" + +msgctxt "#30040" +msgid "kill" +msgstr "" + +msgctxt "#30041" +msgid "out of memory" +msgstr "" + +msgctxt "#30042" +msgid "pause" +msgstr "" + +msgctxt "#30043" +msgid "rename" +msgstr "" + +msgctxt "#30044" +msgid "resize" +msgstr "" + +msgctxt "#30045" +msgid "restart" +msgstr "" + +msgctxt "#30046" +msgid "start" +msgstr "" + +msgctxt "#30047" +msgid "stop" +msgstr "" + +msgctxt "#30048" +msgid "top" +msgstr "" + +msgctxt "#30049" +msgid "unpause" +msgstr "" + +msgctxt "#30050" +msgid "update" +msgstr "" + +msgctxt "#30060" +msgid "Image" +msgstr "" + +msgctxt "#30061" +msgid "delete" +msgstr "" + +msgctxt "#30062" +msgid "import" +msgstr "" + +msgctxt "#30063" +msgid "pull" +msgstr "" + +msgctxt "#30064" +msgid "push" +msgstr "" + +msgctxt "#30065" +msgid "tag" +msgstr "" + +msgctxt "#30066" +msgid "untag" +msgstr "" + +msgctxt "#30070" +msgid "Volume" +msgstr "" + +msgctxt "#30071" +msgid "create" +msgstr "" + +msgctxt "#30072" +msgid "mount" +msgstr "" + +msgctxt "#30073" +msgid "unmount" +msgstr "" + +msgctxt "#30074" +msgid "destroy" +msgstr "" + +msgctxt "#30080" +msgid "Network" +msgstr "" + +msgctxt "#30081" +msgid "create" +msgstr "" + +msgctxt "#30082" +msgid "connect" +msgstr "" + +msgctxt "#30083" +msgid "disconnect" +msgstr "" + +msgctxt "#30084" +msgid "destroy" +msgstr "" diff --git a/packages/addons/service/docker/source/resources/settings.xml b/packages/addons/service/docker/source/resources/settings.xml new file mode 100644 index 00000000000..1e2211f13de --- /dev/null +++ b/packages/addons/service/docker/source/resources/settings.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/packages/addons/service/docker/source/systemd/service.system.docker.service b/packages/addons/service/docker/source/systemd/service.system.docker.service new file mode 100644 index 00000000000..285c7a6fdf9 --- /dev/null +++ b/packages/addons/service/docker/source/systemd/service.system.docker.service @@ -0,0 +1,20 @@ +[Unit] +Description=Docker Application Container Engine +Documentation=https://docs.docker.com +After=network.target docker.socket +Requires=docker.socket + +[Service] +Type=notify +Environment=PATH=/bin:/sbin:/usr/bin:/usr/sbin:/storage/.kodi/addons/service.system.docker/bin +ExecStartPre=/storage/.kodi/addons/service.system.docker/bin/docker-config +EnvironmentFile=-/storage/.kodi/userdata/addon_data/service.system.docker/config/docker.conf +ExecStart=/storage/.kodi/addons/service.system.docker/bin/docker daemon -H fd:// $DOCKER_DAEMON_OPTS $DOCKER_STORAGE_OPTS +MountFlags=slave +LimitNOFILE=1048576 +LimitNPROC=1048576 +LimitCORE=infinity + +[Install] +WantedBy=multi-user.target +Alias=docker.service diff --git a/packages/addons/service/docker/source/systemd/service.system.docker.socket b/packages/addons/service/docker/source/systemd/service.system.docker.socket new file mode 100644 index 00000000000..578b38bc982 --- /dev/null +++ b/packages/addons/service/docker/source/systemd/service.system.docker.socket @@ -0,0 +1,13 @@ +[Unit] +Description=Docker Socket for the API +PartOf=docker.service + +[Socket] +ListenStream=/var/run/docker.sock +SocketMode=0660 +SocketUser=root +SocketGroup=root + +[Install] +WantedBy=sockets.target +Alias=docker.socket diff --git a/packages/addons/service/hyperion/changelog.txt b/packages/addons/service/hyperion/changelog.txt new file mode 100644 index 00000000000..fd12f9d050f --- /dev/null +++ b/packages/addons/service/hyperion/changelog.txt @@ -0,0 +1,8 @@ +8.0.100 +- Update for LibreELEC 8.0 + +7.0.101 +- Add protobuf/V4L2 support + +7.0.100 +- initial LibreELEC version diff --git a/packages/addons/service/hyperion/icon/icon.png b/packages/addons/service/hyperion/icon/icon.png new file mode 100644 index 00000000000..c9e07286e19 Binary files /dev/null and b/packages/addons/service/hyperion/icon/icon.png differ diff --git a/packages/addons/service/hyperion/package.mk b/packages/addons/service/hyperion/package.mk new file mode 100644 index 00000000000..c755ff4b9c8 --- /dev/null +++ b/packages/addons/service/hyperion/package.mk @@ -0,0 +1,103 @@ +################################################################################ +# This file is part of LibreELEC - https://libreelec.tv +# Copyright (C) 2009-2016 Lukas Rusak (lrusak@libreelec.tv) +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +PKG_NAME="hyperion" +PKG_VERSION="f64b6eb" +PKG_REV="100" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/tvdzwan/hyperion" +PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_DEPENDS_TARGET="toolchain Python libusb qt protobuf" +PKG_SECTION="service" +PKG_SHORTDESC="Hyperion: an AmbiLight controller" +PKG_LONGDESC="Hyperion($PKG_VERSION) is an modern opensource AmbiLight implementation." + +PKG_IS_ADDON="yes" +PKG_ADDON_NAME="Hyperion" +PKG_ADDON_TYPE="xbmc.service" +PKG_ADDON_REPOVERSION="8.0" + +AMLOGIC_SUPPORT="-DENABLE_AMLOGIC=0" +DISPMANX_SUPPORT="-DENABLE_DISPMANX=0" +FB_SUPPORT="-DENABLE_FB=1" +X11_SUPPORT="-DENABLE_X11=0" + +if [ "$KODIPLAYER_DRIVER" = "libamcodec" ]; then + AMLOGIC_SUPPORT="-DENABLE_AMLOGIC=1" +elif [ "$KODIPLAYER_DRIVER" = "bcm2835-driver" ]; then + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET bcm2835-driver" + DISPMANX_SUPPORT="-DENABLE_DISPMANX=1" + FB_SUPPORT="-DENABLE_FB=0" +elif [ "$DISPLAYSERVER" = "x11" ]; then + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET xorg-server" + X11_SUPPORT="-DENABLE_X11=1" +fi + +configure_target() { + echo "" > ../cmake/FindGitVersion.cmake + cmake -DCMAKE_TOOLCHAIN_FILE=$CMAKE_CONF \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DCMAKE_PREFIX_PATH=$SYSROOT_PREFIX/usr \ + -DQT_QMAKE_EXECUTABLE=$ROOT/$TOOLCHAIN/bin/qmake \ + -DHYPERION_VERSION_ID="$PKG_VERSION" \ + $AMLOGIC_SUPPORT \ + $DISPMANX_SUPPORT \ + $FB_SUPPORT \ + -DENABLE_OSX=0 \ + -DENABLE_PROTOBUF=1 \ + -DENABLE_SPIDEV=1 \ + -DENABLE_TINKERFORGE=0 \ + -DENABLE_V4L2=1 \ + -DENABLE_WS2812BPWM=0 \ + -DENABLE_WS281XPWM=1 \ + $X11_SUPPORT \ + -DENABLE_QT5=0 \ + -DENABLE_TESTS=0 \ + -Wno-dev \ + .. +} + +makeinstall_target() { + : # nothing to do here +} + +addon() { + mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/bin + cp $PKG_BUILD/.$TARGET_NAME/bin/hyperiond $ADDON_BUILD/$PKG_ADDON_ID/bin + cp $PKG_BUILD/.$TARGET_NAME/bin/hyperion-remote $ADDON_BUILD/$PKG_ADDON_ID/bin + cp $PKG_BUILD/.$TARGET_NAME/bin/hyperion-v4l2 $ADDON_BUILD/$PKG_ADDON_ID/bin + + if [ "$KODIPLAYER_DRIVER" = "libamcodec" ]; then + cp $PKG_BUILD/.$TARGET_NAME/bin/hyperion-aml $ADDON_BUILD/$PKG_ADDON_ID/bin + cp $PKG_BUILD/.$TARGET_NAME/bin/hyperion-framebuffer $ADDON_BUILD/$PKG_ADDON_ID/bin + elif [ "$KODIPLAYER_DRIVER" = "bcm2835-driver" ]; then + cp $PKG_BUILD/.$TARGET_NAME/bin/hyperion-dispmanx $ADDON_BUILD/$PKG_ADDON_ID/bin + elif [ "$DISPLAYSERVER" = "x11" ]; then + cp $PKG_BUILD/.$TARGET_NAME/bin/hyperion-x11 $ADDON_BUILD/$PKG_ADDON_ID/bin + fi + + mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/config + cp -P $PKG_BUILD/config/hyperion.config.json $ADDON_BUILD/$PKG_ADDON_ID/config/hyperion.config.json.sample + sed -i -e "s,/opt/hyperion/effects,/storage/.kodi/addons/service.hyperion/effects,g" \ + $ADDON_BUILD/$PKG_ADDON_ID/config/hyperion.config.json.sample + + mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/effects + cp -PR $PKG_BUILD/effects/* $ADDON_BUILD/$PKG_ADDON_ID/effects + + debug_strip $ADDON_BUILD/$PKG_ADDON_ID/bin +} diff --git a/packages/addons/service/hyperion/patches/hyperion-0001-Use-protobuf-from-pkg-config.patch b/packages/addons/service/hyperion/patches/hyperion-0001-Use-protobuf-from-pkg-config.patch new file mode 100644 index 00000000000..1b5184b0d5b --- /dev/null +++ b/packages/addons/service/hyperion/patches/hyperion-0001-Use-protobuf-from-pkg-config.patch @@ -0,0 +1,44 @@ +From 0ce04b692b7c3e4414c46402c389215f7b0aac48 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Mon, 6 Apr 2015 21:47:41 +0200 +Subject: [PATCH] Use protobuf from pkg-config + +--- + dependencies/CMakeLists.txt | 20 ++------------------ + 1 file changed, 2 insertions(+), 18 deletions(-) + +diff --git a/dependencies/CMakeLists.txt b/dependencies/CMakeLists.txt +index 17747bd..4406d01 100644 +--- a/dependencies/CMakeLists.txt ++++ b/dependencies/CMakeLists.txt +@@ -5,25 +5,9 @@ add_subdirectory(build/serial) + add_subdirectory(build/tinkerforge) + + if(ENABLE_PROTOBUF) +- set(BUILD_SHARED_LIBS OFF CACHE BOOL "Build shared protobuf library") +- add_subdirectory(external/protobuf) ++ find_package(Protobuf REQUIRED) ++ include_directories(${PROTOBUF_INCLUDE_DIRS}) + +- if(CMAKE_CROSSCOMPILING) +- # when crosscompiling import the protoc executable targets from a file generated by a native build +- option(IMPORT_PROTOC "Protoc export file (protoc_export.cmake) from a native build" "IMPORT_PROTOC-FILE_NOT_FOUND") +- include(${IMPORT_PROTOC}) +- else() +- # export the protoc compiler so it can be used when cross compiling +- export(TARGETS protoc_compiler FILE "${CMAKE_BINARY_DIR}/protoc_export.cmake") +- endif() +- +- # define the include for the protobuf library at the parent scope +- set(PROTOBUF_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/external/protobuf/src") +- set(PROTOBUF_INCLUDE_DIRS ${PROTOBUF_INCLUDE_DIRS} PARENT_SCOPE) +- +- # define the protoc executable at the parent scope +- get_property(PROTOBUF_PROTOC_EXECUTABLE TARGET protoc_compiler PROPERTY LOCATION) +- set(PROTOBUF_PROTOC_EXECUTABLE ${PROTOBUF_PROTOC_EXECUTABLE} PARENT_SCOPE) + message(STATUS "Using protobuf compiler: " ${PROTOBUF_PROTOC_EXECUTABLE}) + + #============================================================================= +-- +2.3.4 + diff --git a/packages/addons/service/hyperion/patches/hyperion-01_std-isnan.patch b/packages/addons/service/hyperion/patches/hyperion-01_std-isnan.patch new file mode 100644 index 00000000000..44e06c17b88 --- /dev/null +++ b/packages/addons/service/hyperion/patches/hyperion-01_std-isnan.patch @@ -0,0 +1,17 @@ +diff --git a/libsrc/leddevice/LedDevicePhilipsHue.cpp b/libsrc/leddevice/LedDevicePhilipsHue.cpp +index 332176a..81f421b 100755 +--- a/libsrc/leddevice/LedDevicePhilipsHue.cpp ++++ b/libsrc/leddevice/LedDevicePhilipsHue.cpp +@@ -105,10 +105,10 @@ CiColor PhilipsHueLight::rgbToCiColor(float red, float green, float blue) { + // Convert to x,y space. + float cx = X / (X + Y + Z); + float cy = Y / (X + Y + Z); +- if (isnan(cx)) { ++ if (std::isnan(cx)) { + cx = 0.0f; + } +- if (isnan(cy)) { ++ if (std::isnan(cy)) { + cy = 0.0f; + } + // Brightness is simply Y in the XYZ space. diff --git a/packages/addons/service/hyperion/source/bin/hyperiond.start b/packages/addons/service/hyperion/source/bin/hyperiond.start new file mode 100644 index 00000000000..4bf8f1e4e4c --- /dev/null +++ b/packages/addons/service/hyperion/source/bin/hyperiond.start @@ -0,0 +1,24 @@ +#!/bin/sh +################################################################################ +# This file is part of LibreELEC - https://libreelec.tv +# Copyright (C) 2009-2016 Lukas Rusak (lrusak@libreelec.tv) +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +. /etc/profile + +oe_setup_addon service.hyperion + +exec hyperiond $ADDON_HOME/hyperion.config.json diff --git a/packages/addons/service/hyperion/source/default.py b/packages/addons/service/hyperion/source/default.py new file mode 100644 index 00000000000..42949532556 --- /dev/null +++ b/packages/addons/service/hyperion/source/default.py @@ -0,0 +1,22 @@ +################################################################################ +# This file is part of LibreELEC - https://libreelec.tv +# Copyright (C) 2009-2016 Lukas Rusak (lrusak@libreelec.tv) +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +import xbmc + +monitor = xbmc.Monitor() +monitor.waitForAbort() diff --git a/packages/addons/service/hyperion/source/system.d/service.hyperion.service b/packages/addons/service/hyperion/source/system.d/service.hyperion.service new file mode 100644 index 00000000000..64f875e9808 --- /dev/null +++ b/packages/addons/service/hyperion/source/system.d/service.hyperion.service @@ -0,0 +1,14 @@ +[Unit] +Description=Hyperion service +After=graphical.target +ConditionPathExists=/storage/.kodi/userdata/addon_data/service.hyperion/hyperion.config.json + +[Service] +ExecStart=/bin/sh -c "exec sh /storage/.kodi/addons/service.hyperion/bin/hyperiond.start" +TimeoutStopSec=2 +Restart=always +RestartSec=10 +StartLimitInterval=0 + +[Install] +WantedBy=default.target diff --git a/packages/addons/service/inadyn/changelog.txt b/packages/addons/service/inadyn/changelog.txt new file mode 100644 index 00000000000..9455e1f3c8a --- /dev/null +++ b/packages/addons/service/inadyn/changelog.txt @@ -0,0 +1,2 @@ +8.0.100 +- Initial addon diff --git a/packages/addons/service/inadyn/icon/icon.png b/packages/addons/service/inadyn/icon/icon.png new file mode 100644 index 00000000000..2e393545448 Binary files /dev/null and b/packages/addons/service/inadyn/icon/icon.png differ diff --git a/packages/addons/service/inadyn/package.mk b/packages/addons/service/inadyn/package.mk new file mode 100644 index 00000000000..9963bdef5b9 --- /dev/null +++ b/packages/addons/service/inadyn/package.mk @@ -0,0 +1,54 @@ +################################################################################ +# This file is part of LibreELEC - https://libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +PKG_NAME="inadyn" +PKG_VERSION="1.99.15" +PKG_REV="100" +PKG_ARCH="any" +PKG_LICENSE="GPLv2" +PKG_SITE="http://troglobit.com/inadyn.html" +PKG_URL="ftp://troglobit.com/$PKG_NAME/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_DEPENDS_TARGET="toolchain libressl" +PKG_PRIORITY="optional" +PKG_SECTION="service/system" +PKG_SHORTDESC="Inadyn, a small and simple DDNS client" +PKG_LONGDESC="Inadyn is a small and simple DDNS client with HTTPS support. It is commonly available in many GNU/Linux distributions, used in off-the-shelf routers and Internet gateways to automate the task of keeping your DNS record up to date with any IP address changes from your ISP. It can also be used in installations with redundant (backup) connections to the Internet." +PKG_MAINTAINER="Anton Voyl (awiouy at gmail.com)" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="xbmc.service" +PKG_ADDON_PROVIDES="" +PKG_ADDON_REPOVERSION="8.0" + +PKG_AUTORECONF="yes" +PKG_CONFIGURE_OPTS_TARGET="--enable-openssl" # --sysconfdir is ineffective + +pre_configure_target() { + # inadyn fails to build in subdirs + cd $ROOT/$PKG_BUILD + rm -rf .$TARGET_NAME +} + +makeinstall_target() { + : +} + +addon() { + mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/bin + cp $PKG_BUILD/src/inadyn $ADDON_BUILD/$PKG_ADDON_ID/bin +} diff --git a/packages/addons/service/inadyn/source/bin/inadyn-service b/packages/addons/service/inadyn/source/bin/inadyn-service new file mode 100644 index 00000000000..669ab29f937 --- /dev/null +++ b/packages/addons/service/inadyn/source/bin/inadyn-service @@ -0,0 +1,43 @@ +#!/bin/sh +################################################################################ +# This file is part of LibreELEC - https://libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +. /etc/profile +oe_setup_addon service.system.inadyn + +config="$ADDON_HOME/inadyn.conf" + +options="-b" +if [ "$inadyn_S" == "inadyn.conf" ] +then + if [ -f "$config" ] && [ -s "$config" ] + then + options="$options -F $config" + else + exit 0 + fi +else + options="$options -S $inadyn_S -u $inadyn_u -p $inadyn_p -a $inadyn_a" + if [ "$inadyn_s" == "true" ] + then + options="$options -s" + fi +fi + +inadyn $options + diff --git a/packages/addons/service/inadyn/source/default.py b/packages/addons/service/inadyn/source/default.py new file mode 100644 index 00000000000..0a5065ba275 --- /dev/null +++ b/packages/addons/service/inadyn/source/default.py @@ -0,0 +1,36 @@ +################################################################################ +# This file is part of LibreELEC - https://libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +import subprocess +import xbmc +import xbmcaddon + + +class Monitor(xbmc.Monitor): + + def __init__(self, *args, **kwargs): + xbmc.Monitor.__init__(self) + self.id = xbmcaddon.Addon().getAddonInfo('id') + + def onSettingsChanged(self): + subprocess.call(['systemctl', 'restart', self.id]) + + +if __name__ == "__main__": + Monitor().waitForAbort() + diff --git a/packages/addons/service/inadyn/source/resources/language/English/strings.po b/packages/addons/service/inadyn/source/resources/language/English/strings.po new file mode 100644 index 00000000000..16a02364e8c --- /dev/null +++ b/packages/addons/service/inadyn/source/resources/language/English/strings.po @@ -0,0 +1,30 @@ +# Kodi Media Center language file +# Addon Name: syncthing +# Addon id: service.system.inadyn +# Addon Provider: awiouy at gmail dot com +msgid "" +msgstr "" + +msgctxt "#30000" +msgid "Configuration" +msgstr "" + +msgctxt "#30001" +msgid "Provider" +msgstr "" + +msgctxt "#30002" +msgid "Username" +msgstr "" + +msgctxt "#30003" +msgid "Password" +msgstr "" + +msgctxt "#30004" +msgid "Alias" +msgstr "" + +msgctxt "#30005" +msgid "SSL" +msgstr "" diff --git a/packages/addons/service/inadyn/source/resources/settings.xml b/packages/addons/service/inadyn/source/resources/settings.xml new file mode 100644 index 00000000000..8ae445241db --- /dev/null +++ b/packages/addons/service/inadyn/source/resources/settings.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/packages/addons/service/inadyn/source/settings-default.xml b/packages/addons/service/inadyn/source/settings-default.xml new file mode 100644 index 00000000000..17b76dcb0f5 --- /dev/null +++ b/packages/addons/service/inadyn/source/settings-default.xml @@ -0,0 +1,4 @@ + + + + diff --git a/packages/addons/service/inadyn/source/system.d/service.system.inadyn.service b/packages/addons/service/inadyn/source/system.d/service.system.inadyn.service new file mode 100644 index 00000000000..b5207906b20 --- /dev/null +++ b/packages/addons/service/inadyn/source/system.d/service.system.inadyn.service @@ -0,0 +1,12 @@ +[Unit] +Description=inadyn +After=network-online.target +Requires=network-online.target + +[Service] +Type=forking +ExecStart=/bin/sh /storage/.kodi/addons/service.system.inadyn/bin/inadyn-service +Restart=on-failure + +[Install] +WantedBy=kodi.target diff --git a/packages/addons/service/mpd/changelog.txt b/packages/addons/service/mpd/changelog.txt new file mode 100644 index 00000000000..f449da0b54b --- /dev/null +++ b/packages/addons/service/mpd/changelog.txt @@ -0,0 +1,5 @@ +8.0.101 +- rebuild for libogg + +8.0.100 +- initial LibreELEC version diff --git a/packages/addons/service/mpd/icon/icon.png b/packages/addons/service/mpd/icon/icon.png new file mode 100644 index 00000000000..3927473b32c Binary files /dev/null and b/packages/addons/service/mpd/icon/icon.png differ diff --git a/packages/addons/service/mpd/package.mk b/packages/addons/service/mpd/package.mk new file mode 100644 index 00000000000..04a83114862 --- /dev/null +++ b/packages/addons/service/mpd/package.mk @@ -0,0 +1,99 @@ +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) +# +# This Program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This Program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with OpenELEC.tv; see the file COPYING. If not, write to +# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. +# http://www.gnu.org/copyleft/gpl.html +################################################################################ + +PKG_NAME="mpd" +PKG_VERSION="0.19.15" +PKG_REV="101" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="https://www.musicpd.org" +PKG_URL="http://www.musicpd.org/download/${PKG_NAME}/${PKG_VERSION%.*}/${PKG_NAME}-${PKG_VERSION}.tar.xz" +PKG_DEPENDS_TARGET="toolchain boost glib ffmpeg libmad libogg flac faad2 curl alsa-lib yajl libid3tag lame" +PKG_PRIORITY="optional" +PKG_SECTION="service.multimedia" +PKG_SHORTDESC="Music Player Daemon (MPD): a free and open Music Player Server" +PKG_LONGDESC="Music Player Daemon ($PKG_VERSION) is a flexible and powerful server-side application for playing music" +PKG_AUTORECONF="yes" + +PKG_IS_ADDON="yes" +PKG_ADDON_NAME="Music Player Daemon (MPD)" +PKG_ADDON_TYPE="xbmc.service" +PKG_ADDON_PROVIDES="" +PKG_ADDON_REPOVERSION="8.0" + +pre_configure_target() { + export LDFLAGS="$LDFLAGS -ldl -logg" +} + +PKG_CONFIGURE_OPTS_TARGET="--enable-alsa \ + --disable-roar \ + --disable-ao \ + --disable-audiofile \ + --disable-bzip2 \ + --disable-cdio-paranoia \ + --enable-curl \ + --disable-smbclient \ + --disable-soup \ + --disable-debug \ + --disable-documentation \ + --disable-ffado \ + --enable-ffmpeg \ + --disable-fluidsynth \ + --disable-gme \ + --enable-httpd-output \ + --enable-id3 \ + --disable-jack \ + --disable-lastfm \ + --disable-despotify \ + --disable-soundcloud \ + --enable-lame-encoder \ + --disable-libwrap \ + --disable-lsr \ + --enable-mad \ + --disable-mikmod\ + --disable-mms \ + --disable-modplug \ + --disable-mpg123 \ + --disable-mvp \ + --disable-openal \ + --disable-oss \ + --disable-pipe-output \ + --disable-pulse \ + --disable-recorder-output \ + --disable-sidplay \ + --disable-shout \ + --disable-sndfile \ + --disable-solaris-output \ + --disable-sqlite \ + --disable-systemd-daemon \ + --disable-test \ + --disable-twolame-encoder \ + --disable-zzip \ + --with-zeroconf=no \ + --disable-icu" + +makeinstall_target() { + : # nop +} + +addon() { + mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/bin + cp -P $PKG_BUILD/.$TARGET_NAME/src/mpd $ADDON_BUILD/$PKG_ADDON_ID/bin +} diff --git a/packages/addons/service/mpd/source/bin/mpd.start b/packages/addons/service/mpd/source/bin/mpd.start new file mode 100755 index 00000000000..d6a7bc36f17 --- /dev/null +++ b/packages/addons/service/mpd/source/bin/mpd.start @@ -0,0 +1,41 @@ +#!/bin/sh + +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) +# +# This Program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This Program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with OpenELEC.tv; see the file COPYING. If not, write to the +# Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. +# http://www.gnu.org/copyleft/gpl.html +################################################################################ + +. /etc/profile + +oe_setup_addon service.multimedia.mpd + +mkdir -p $ADDON_HOME/config +mkdir -p $ADDON_HOME/log +mkdir -p $ADDON_HOME/playlists +mkdir -p $ADDON_HOME/music +touch $ADDON_HOME/log/mpd.log +touch $ADDON_HOME/mpd.db +touch $ADDON_HOME/state + +chmod a+x $ADDON_DIR/bin/* + +if [ ! -f "$ADDON_HOME/config/mpd.conf" ]; then + cp $ADDON_DIR/config/mpd.conf $ADDON_HOME/config/mpd.conf +fi + +exec mpd --no-daemon $ADDON_HOME/config/mpd.conf > /dev/null 2>&1 diff --git a/packages/addons/service/mpd/source/config/mpd.conf b/packages/addons/service/mpd/source/config/mpd.conf new file mode 100644 index 00000000000..195784d693c --- /dev/null +++ b/packages/addons/service/mpd/source/config/mpd.conf @@ -0,0 +1,453 @@ +# An example configuration file for MPD +# See the mpd.conf man page for a more detailed description of each parameter. + + +# Files and directories ####################################################### +# +# This setting controls the top directory which MPD will search to discover the +# available audio files and add them to the daemon's online database. This +# setting defaults to the XDG directory, otherwise the music directory will be +# be disabled and audio files will only be accepted over ipc socket (using +# file:// protocol) or streaming files over an accepted protocol. +# +music_directory "/storage/music" +# +# This setting sets the MPD internal playlist directory. The purpose of this +# directory is storage for playlists created by MPD. The server will use +# playlist files not created by the server but only if they are in the MPD +# format. This setting defaults to playlist saving being disabled. +# +playlist_directory "/storage/.kodi/userdata/addon_data/service.multimedia.mpd/playlists" +# +# This setting sets the location of the MPD database. This file is used to +# load the database at server start up and store the database while the +# server is not up. This setting defaults to disabled which will allow +# MPD to accept files over ipc socket (using file:// protocol) or streaming +# files over an accepted protocol. +# +db_file "/storage/.kodi/userdata/addon_data/service.multimedia.mpd/mpd.db" +# +# These settings are the locations for the daemon log files for the daemon. +# These logs are great for troubleshooting, depending on your log_level +# settings. +# +# The special value "syslog" makes MPD use the local syslog daemon. This +# setting defaults to logging to syslog, otherwise logging is disabled. +# +log_file "/storage/.kodi/userdata/addon_data/service.multimedia.mpd/log/mpd.log" +# +# This setting sets the location of the file which stores the process ID +# for use of mpd --kill and some init scripts. This setting is disabled by +# default and the pid file will not be stored. +# +pid_file "/var/run/mpd.pid" +# +# This setting sets the location of the file which contains information about +# most variables to get MPD back into the same general shape it was in before +# it was brought down. This setting is disabled by default and the server +# state will be reset on server start up. +# +state_file "/storage/.kodi/userdata/addon_data/service.multimedia.mpd/state" +# +# The location of the sticker database. This is a database which +# manages dynamic information attached to songs. +# +#sticker_file "/storage/.mpd/sticker.sql" +# +############################################################################### + + +# General music daemon options ################################################ +# +# This setting specifies the user that MPD will run as. MPD should never run as +# root and you may use this setting to make MPD change its user ID after +# initialization. This setting is disabled by default and MPD is run as the +# current user. +# +#user "mpd" +# +# This setting specifies the group that MPD will run as. If not specified +# primary group of user specified with "user" setting will be used (if set). +# This is useful if MPD needs to be a member of group such as "audio" to +# have permission to use sound card. +# +#group "nogroup" +# +# This setting sets the address for the daemon to listen on. Careful attention +# should be paid if this is assigned to anything other then the default, any. +# This setting can deny access to control of the daemon. +# +# For network +#bind_to_address "any" +# +# And for Unix Socket +#bind_to_address "/storage/.mpd/socket" +# +# This setting is the TCP port that is desired for the daemon to get assigned +# to. +# +#port "6600" +# +# This setting controls the type of information which is logged. Available +# setting arguments are "default", "secure" or "verbose". The "verbose" setting +# argument is recommended for troubleshooting, though can quickly stretch +# available resources on limited hardware storage. +# +#log_level "default" +# +# If you have a problem with your MP3s ending abruptly it is recommended that +# you set this argument to "no" to attempt to fix the problem. If this solves +# the problem, it is highly recommended to fix the MP3 files with vbrfix +# (available from ), at which +# point gapless MP3 playback can be enabled. +# +#gapless_mp3_playback "yes" +# +# Setting "restore_paused" to "yes" puts MPD into pause mode instead +# of starting playback after startup. +# +#restore_paused "no" +# +# This setting enables MPD to create playlists in a format usable by other +# music players. +# +#save_absolute_paths_in_playlists "no" +# +# This setting defines a list of tag types that will be extracted during the +# audio file discovery process. Optionally, 'comment' can be added to this +# list. +# +#metadata_to_use "artist,album,title,track,name,genre,date,composer,performer,disc" +# +# This setting enables automatic update of MPD's database when files in +# music_directory are changed. +# +#auto_update "yes" +# +# Limit the depth of the directories being watched, 0 means only watch +# the music directory itself. There is no limit by default. +# +#auto_update_depth "3" +# +############################################################################### + + +# Symbolic link behavior ###################################################### +# +# If this setting is set to "yes", MPD will discover audio files by following +# symbolic links outside of the configured music_directory. +# +#follow_outside_symlinks "yes" +# +# If this setting is set to "yes", MPD will discover audio files by following +# symbolic links inside of the configured music_directory. +# +#follow_inside_symlinks "yes" +# +############################################################################### + + +# Zeroconf / Avahi Service Discovery ########################################## +# +# If this setting is set to "yes", service information will be published with +# Zeroconf / Avahi. +# +#zeroconf_enabled "yes" +# +# The argument to this setting will be the Zeroconf / Avahi unique name for +# this MPD server on the network. +# +#zeroconf_name "Music Player" +# +############################################################################### + + +# Permissions ################################################################# +# +# If this setting is set, MPD will require password authorization. The password +# can setting can be specified multiple times for different password profiles. +# +#password "password@read,add,control,admin" +# +# This setting specifies the permissions a user has who has not yet logged in. +# +#default_permissions "read,add,control,admin" +# +############################################################################### + + +# Input ####################################################################### +# + +#input { +# plugin "curl" +# proxy "proxy.isp.com:8080" +# proxy_user "user" +# proxy_password "password" +#} + +# +############################################################################### + +############################################################################### +############################################################################### +# +# A BIG FAT WARNING +# +# This may block your xbmc audio. It might also play no audio at all, +# if streamsilence is enabled and you try to use the very same device. +# +############################################################################### +############################################################################### + +# Audio Output ################################################################ +# +# MPD supports various audio output types, as well as playing through multiple +# audio outputs at the same time, through multiple audio_output settings +# blocks. Setting this block is optional, though the server will only attempt +# autodetection for one sound card. +# +# See for examples of +# other audio outputs. +# +# An example of an ALSA output: +# +##audio_output { +## type "alsa" +## name "ALSA Device" +### device "hw:0,0" # optional +#### format "44100:16:2" # optional +#### mixer_type "hardware" # optional +#### mixer_device "default" # optional +#### mixer_control "PCM" # optional +#### mixer_index "0" # optional +##} +# +# An example of an OSS output: +# +#audio_output { +# type "oss" +# name "My OSS Device" +## device "/dev/dsp" # optional +## format "44100:16:2" # optional +## mixer_type "hardware" # optional +## mixer_device "/dev/mixer" # optional +## mixer_control "PCM" # optional +#} +# +# An example of a shout output (for streaming to Icecast): +# +#audio_output { +# type "shout" +# encoding "ogg" # optional +# name "My Shout Stream" +# host "localhost" +# port "8000" +# mount "/mpd.ogg" +# password "hackme" +# quality "5.0" +# bitrate "128" +# format "44100:16:1" +## protocol "icecast2" # optional +## user "source" # optional +## description "My Stream Description" # optional +## url "http://example.com" # optional +## genre "jazz" # optional +## public "no" # optional +## timeout "2" # optional +## mixer_type "software" # optional +#} +# +# An example of a recorder output: +# +#audio_output { +# type "recorder" +# name "My recorder" +# encoder "vorbis" # optional, vorbis or lame +# path "/var/lib/mpd/recorder/mpd.ogg" +## quality "5.0" # do not define if bitrate is defined +# bitrate "128" # do not define if quality is defined +# format "44100:16:1" +#} +# +# An example of a httpd output (built-in HTTP streaming server): +# +#audio_output { +## type "httpd" +# name "My HTTP Stream" +# encoder "vorbis" # optional, vorbis or lame +# port "8000" +# bind_to_address "0.0.0.0" # optional, IPv4 or IPv6 +# quality "5.0" # do not define if bitrate is defined +# bitrate "320" # do not define if quality is defined +# format "44100:16:1" +# max_clients "0" # optional 0=no limit +#} +# +# An example of a pulseaudio output (streaming to a remote pulseaudio server) +# +#audio_output { +# type "pulse" +# name "My Pulse Output" +## server "remote_server" # optional +## sink "remote_server_sink" # optional +#} +# +## Example "pipe" output: +# +#audio_output { +# type "pipe" +# name "my pipe" +# command "aplay -f cd 2>/dev/null" +## Or if you're want to use AudioCompress +# command "AudioCompress -m | aplay -f cd 2>/dev/null" +## Or to send raw PCM stream through PCM: +# command "nc example.org 8765" +# format "44100:16:2" +#} +# +## An example of a null output (for no audio output): +# +audio_output { + type "null" + name "My Null Output" + mixer_type "none" # optional +} +# +# This setting will change all decoded audio to be converted to the specified +# format before being passed to the audio outputs. By default, this setting is +# disabled. +# +#audio_output_format "44100:16:2" +# +# If MPD has been compiled with libsamplerate support, this setting specifies +# the sample rate converter to use. Possible values can be found in the +# mpd.conf man page or the libsamplerate documentation. By default, this is +# setting is disabled. +# +#samplerate_converter "Fastest Sinc Interpolator" +# +############################################################################### + + +# Normalization automatic volume adjustments ################################## +# +# This setting specifies the type of ReplayGain to use. This setting can have +# the argument "off", "album" or "track". See +# for more details. This setting is off by default. +# +#replaygain "album" +# +# This setting sets the pre-amp used for files that have ReplayGain tags. By +# default this setting is disabled. +# +#replaygain_preamp "0" +# +# This setting enables on-the-fly normalization volume adjustment. This will +# result in the volume of all playing audio to be adjusted so the output has +# equal "loudness". This setting is disabled by default. +# +#volume_normalization "no" +# +############################################################################### + + +# MPD Internal Buffering ###################################################### +# +# This setting adjusts the size of internal decoded audio buffering. Changing +# this may have undesired effects. Don't change this if you don't know what you +# are doing. +# +#audio_buffer_size "2048" +# +# This setting controls the percentage of the buffer which is filled before +# beginning to play. Increasing this reduces the chance of audio file skipping, +# at the cost of increased time prior to audio playback. +# +#buffer_before_play "10%" +# +############################################################################### + + +# Resource Limitations ######################################################## +# +# These settings are various limitations to prevent MPD from using too many +# resources. Generally, these settings should be minimized to prevent security +# risks, depending on the operating resources. +# +#connection_timeout "60" +#max_connections "10" +#max_playlist_length "16384" +#max_command_list_size "2048" +#max_output_buffer_size "8192" +# +############################################################################### + +# Client TCP keep alive ####################################################### +# +# For clients connected by TCP on supported platforms. +# Allows detection of dangling connections due to clients disappearing from +# the network without closing their connections. +# +# This is not usually necessary but can be useful in cases such as wifi connectected +# clients that go in and out of network range or turn off wifi without closing their +# connections. Combined with low max_connections this can soon cause clients to not +# be able to connect. +# +# +# Enable tcp keepalive on new client connections (default is "no") +# +#tcp_keep_alive "no" +# +# Time in seconds since the last communication on the connection and before +# the keepalive probing is started. (default is 7200 seconds) +#tcp_keep_alive_idle "7200" +# +# Interval in seconds between keepalive probes, once a probe started. +# (default is 75 seconds) +#tcp_keep_alive_interval "75" +# +# Number of failed probes before the connection is pronounced dead and +# the connection is closed. (default is 9 times) +#tcp_keep_alive_count "9" +# +############################################################################### + +# Character Encoding ########################################################## +# +# If file or directory names do not display correctly for your locale then you +# may need to modify this setting. +# +#filesystem_charset "UTF-8" +# +# This setting controls the encoding that ID3v1 tags should be converted from. +# +#id3v1_encoding "ISO-8859-1" +# +############################################################################### + + +# SIDPlay decoder ############################################################# +# +# songlength_database: +# Location of your songlengths file, as distributed with the HVSC. +# The sidplay plugin checks this for matching MD5 fingerprints. +# See http://www.c64.org/HVSC/DOCUMENTS/Songlengths.faq +# +# default_songlength: +# This is the default playing time in seconds for songs not in the +# songlength database, or in case you're not using a database. +# A value of 0 means play indefinitely. +# +# filter: +# Turns the SID filter emulation on or off. +# +#decoder { +# plugin "sidplay" +# songlength_database "/media/C64Music/DOCUMENTS/Songlengths.txt" +# default_songlength "120" +# filter "true" +#} +# +############################################################################### + diff --git a/packages/addons/service/mpd/source/default.py b/packages/addons/service/mpd/source/default.py new file mode 100644 index 00000000000..6f814651a27 --- /dev/null +++ b/packages/addons/service/mpd/source/default.py @@ -0,0 +1,19 @@ +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) +# +# This Program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This Program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with OpenELEC.tv; see the file COPYING. If not, write to +# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. +# http://www.gnu.org/copyleft/gpl.html +################################################################################ diff --git a/packages/addons/service/mpd/source/resources/language/English/strings.xml b/packages/addons/service/mpd/source/resources/language/English/strings.xml new file mode 100644 index 00000000000..d388c262c17 --- /dev/null +++ b/packages/addons/service/mpd/source/resources/language/English/strings.xml @@ -0,0 +1,5 @@ + + + General + Restart on suspend / resume + diff --git a/packages/addons/service/mpd/source/resources/settings.xml b/packages/addons/service/mpd/source/resources/settings.xml new file mode 100644 index 00000000000..ae2693c874a --- /dev/null +++ b/packages/addons/service/mpd/source/resources/settings.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/packages/addons/service/mpd/source/settings-default.xml b/packages/addons/service/mpd/source/settings-default.xml new file mode 100644 index 00000000000..f5afe2c7990 --- /dev/null +++ b/packages/addons/service/mpd/source/settings-default.xml @@ -0,0 +1,3 @@ + + + diff --git a/packages/addons/service/mpd/source/sleep.d/mpd.power b/packages/addons/service/mpd/source/sleep.d/mpd.power new file mode 100644 index 00000000000..1ba5ab37c66 --- /dev/null +++ b/packages/addons/service/mpd/source/sleep.d/mpd.power @@ -0,0 +1,42 @@ +#!/bin/sh + +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) +# +# This Program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This Program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with OpenELEC.tv; see the file COPYING. If not, write to +# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. +# http://www.gnu.org/copyleft/gpl.html +################################################################################ + +. /etc/profile + +oe_setup_addon service.multimedia.mpd + +SERVICE="service.multimedia.mpd" + +if [ "$RESTART_ON_RESUME" == "true" ] ; then + case "$1" in + pre) + if systemctl is-active "$SERVICE" &>/dev/null ; then + systemctl stop "$SERVICE" + fi + ;; + post) + if systemctl is-enabled "$SERVICE" &>/dev/null ; then + systemctl start "$SERVICE" + fi + ;; + esac +fi diff --git a/packages/addons/service/mpd/source/system.d/service.multimedia.mpd.service b/packages/addons/service/mpd/source/system.d/service.multimedia.mpd.service new file mode 100644 index 00000000000..147cd72129a --- /dev/null +++ b/packages/addons/service/mpd/source/system.d/service.multimedia.mpd.service @@ -0,0 +1,13 @@ +[Unit] +Description=mpd +After=graphical.target + +[Service] +ExecStart=/bin/sh -c "exec sh /storage/.kodi/addons/service.multimedia.mpd/bin/mpd.start" +TimeoutStopSec=1 +Restart=always +RestartSec=2 +StartLimitInterval=0 + +[Install] +WantedBy=kodi.target diff --git a/packages/addons/service/multimedia/boblightd/changelog.txt b/packages/addons/service/multimedia/boblightd/changelog.txt deleted file mode 100644 index b3388907e86..00000000000 --- a/packages/addons/service/multimedia/boblightd/changelog.txt +++ /dev/null @@ -1,77 +0,0 @@ -7.0.0 -- rebuild for OpenELEC-7.0 - -6.0.0 -- rebuild for OpenELEC-6.0 - -4.3.5 -- added boblight-aml - -4.3.4 -- update to kodi - -4.3.0 -- rebuild for addon api bump - -4.1.2 -- rebuild for xlib changes - -4.1.1 -- update to boblightd-478 - -4.1.0 -- convert to systemd service -- rebuild for addon api bump - -4.0.1 -- rebuild - -4.0.0 -- rebuild for OpenELEC-4.0 - -3.1.3 -- update to boblightd-474 - -3.1.2 -- rebuild - -3.1.1 -- rebuild for OpenELEC-3.2 - -3.0.4 -- update to boblightd-467 - -3.0.3 -- update to boblightd-465 - -3.0.2 -- depends on libGLU - -3.0.1 -- bump addon version -- make OpenGL and X11 support optional - -2.1.3 -- update to boblightd-449 - -2.1.2 -- rebuild - -2.1.1 -- update to addon version 2.1 - -2.0.5 -- add possibilty to start / stop addon from addon manager with enable / disable -- restart boblightd on sleep / resume - -2.0.4 -- Fixed so that boblightd will not start if it's already running - -2.0.3 -- Removed LD_LIBRARY_PATH dependencies - -2.0.2 -- Renamed to boblightd to avoid conflicts - -2.0.1 -- initial version boblight diff --git a/packages/addons/service/multimedia/boblightd/icon/icon.png b/packages/addons/service/multimedia/boblightd/icon/icon.png deleted file mode 100644 index addb90382cf..00000000000 Binary files a/packages/addons/service/multimedia/boblightd/icon/icon.png and /dev/null differ diff --git a/packages/addons/service/multimedia/vdr-addon/changelog.txt b/packages/addons/service/multimedia/vdr-addon/changelog.txt deleted file mode 100644 index 72c20fd957d..00000000000 --- a/packages/addons/service/multimedia/vdr-addon/changelog.txt +++ /dev/null @@ -1,303 +0,0 @@ -7.0.2 -- update to vdr-plugin-restfulapi-0.2.6.0 -- update to vdr-plugin-vnsiserver-00b5779 -- update to vdr-satip-b755dbf - -7.0.1 -- update to vdr-plugin-xmltv2vdr-b48e0bec -- update to vdr-plugin-streamdev-fc52e92 -- update to vdr-plugin-restfulapi-0.2.5.6 -- update to vdr-epgsearch-0b09f90 -- update to vdr-plugin-dvbapi-31f409d -- update to vdr-plugin-vnsiserver-d96f211 -- update to vdr-satip-9d5f7cc - -7.0.0 -- rebuild for OpenELEC-7.0 - -6.0.1 -- update to vdr-plugin-dvbapi-0489e01 -- update to vdr-plugin-vnsiserver-a7b0670 -- update to vdr-satip-2.2.2 -- update to vdr-iptv-2.2.1 - -6.0.0 -- rebuild for OpenELEC-6.0 -- remove plugin 'control' -- remove plugin 'xvdr' -- update to vdr-plugin-vnsiserver-36e2b61 - -4.3.11 -- update to vdr-plugin-restfulapi-0.2.1.4 - -4.3.10 -- disable dvbapi network mode - -4.3.9 -- update to vdr-2.2.0 -- update to vdr-iptv-2.2.0 -- update to vdr-satip-2.2.0 -- update to vdr-plugin-dvbapi-c0c7fa2 -- update to vdr-plugin-eepg-9cd9a75 -- update to vdr-plugin-vnsiserver-9529e6d -- update to vdr-plugin-streamdev-84c6f6b - -4.3.8 -- update to vdr-2.1.10 -- update to vdr-plugin-restfulapi-0.2.1.1 -- update to vdr-plugin-vnsiserver-f2175ba - -4.3.7 -- update to vdr-2.1.8 -- update to vdr-plugin-vnsiserver-b887bc8 -- update to vdr-wirbelscan-0.0.9 - -4.3.6 -- update to vdr-satip-1.0.2 -- update to vdr-2.1.7 - -4.3.5 -- add plugin 'vdr-plugin-restfulapi' -- update to vdr-plugin-xvdr-b300fc3 - -4.3.4 -- update to vdr-plugin-vnsiserver-a48edf1 -- update to vdr-plugin-dvbapi-36a6b1d - -4.3.3 -- add plugin 'vdr-plugin-epgfixer' -- update to vdr-satip-1.0.1 - -4.3.2 -- update to kodi - -4.3.1 -- update to vdr-plugin-vnsiserver-a7cb405 -- update to vdr-plugin-dvbapi-2617a7f - -4.3.0 -- rebuild for addon api bump - -4.1.7 -- add option to override epg charset -- update to vdr-plugin-vnsiserver-7d4aa81 -- update to vdr-satip-0.3.3 -- update to vdr-plugin-eepg-d7dc614 -- update to vdr-plugin-dvbapi-bdcad3f -- update to vdr-iptv-2.1.3 - -4.1.6 -- update to vdr-2.1.6 -- add plugin 'vdr-dummydevice' -- add plugin 'vdr-satip' -- remove plugin: 'sc' -- update to vdr-iptv-2.1.2 -- update to vdr-plugin-xvdr-7f49bfa -- update to vdr-plugin-vnsiserver-a3f7ac5 -- update to vdr-plugin-dvbapi-bf11f9e - -4.1.5 -- fix issues with "wait for frontend init". thanks @sraue - -4.1.4 -- add plugin 'vdr-plugin-eepg' -- update to vdr-plugin-xvdr-4a9d95e -- update to vdr-plugin-dvbapi-a9b738e - -4.1.3 -- update to vdr-2.1.5 -- update to vdr-iptv-2.1.0 -- update to vdr-plugin-vnsiserver-e5f02b6 -- update to vdr-plugin-dvbapi-a3b4a5a -- update to vdr-plugin-xvdr-7d6ebb7 - -4.1.2 -- update to vdr-2.1.3 -- update to vdr-iptv-2.0.1 -- update to vdr-plugin-dvbapi-4d9de95 -- update to vdr-plugin-streamdev-40704cd -- update to vdr-plugin-vnsiserver-9021115 -- update to vdr-epgsearch-29c174a - -4.1.1 -- rebuild to fix curl/gnutls/ssl - -4.1.0 -- convert to systemd service -- rebuild for addon api bump - -4.0.3 -- update to vdr-plugin-vnsiserver-e2e6804 (vnsi5) - -4.0.2 -- update to vdr-2.1.2 -- update to vdr-plugin-streamdev-a9c2adb -- add option to run external reccmd (noad) - -4.0.1 -- update to vdr-2.1.1 -- remove rotorng. dish positioner is now implemented in vdr - -4.0.0 -- update to vdr-2.0.3 -- update to vdr-plugin-vnsiserver-cd5023b -- update to vdr-plugin-xvdr-6249892 -- remove dvbsddevice / dvbhddevice - -3.1.4 -- vdr-plugin-dvbapi: switch to libdvbcsa - -3.1.3 -- rebuild - -3.1.2 -- fix unloading multiple modules on suspend - -3.1.1 -- rebuild for OpenELEC-3.2 - -3.0.11 -- fix epg/live charset issue - -3.0.10 -- improve suspend/resume - -3.0.9 -- rebuild - -3.0.8 -- vdr-plugin-xmltv2vdr: use VDR_CACHE_DIR for epg.db -- use own /var/run/vdr tmpfs mount - -3.0.7 -- update to vdr-plugin-xmltv2vdr-30903cc0 -- cleanup epgsources handling -- * support for multiple epgsources -- * support user defined epgsources -- fixed epgsearch plugin not working without streamdev-server -- vdr-addon: update to vdr-plugin-xvdr-33afe59 - -3.0.6 -- fix startup error in vnsiserver / 32bit - -3.0.5 -- updated to vdr-2.0.1 -- remove dynamite plugin -- update to vdr-epgsearch-e2de927 -- update to vdr-iptv-2.0.0 -- update to vdr-plugin-streamdev-329129d -- update to vdr-live-0.3.0 -- update to vdr-plugin-dvbapi-555272d -- update to vdr-plugin-xmltv2vdr-90c023f6 -- update to vdr-plugin-xvdr-935a294 -- update to rotorng-0.3.1 -- added dvbsddevice plugin -- added dvbhddevice plugin - -3.0.4 -- update to vdr-1.1.33 -- update to vdr-plugin-dvbapi-cd93752 -- update to vdr-plugin-streamdev-f58086a -- update to vdr-epgsearch-0fc4817 -- remove text2skin plugin -- remove xinelib plugin - -3.0.3 -- update to vdr-sc-620 -- update to vdr-plugin-xvdr-c43033c -- update to vdr-plugin-vnsiserver-e3cd383 -- update to vdr-plugin-streamdev-9135cde -- update to vdr-plugin-dvbapi-e87e15f -- update to vdr-dynamite-914af24 - -3.0.2 -- update to vdr-plugin-xmltv2vdr-8be374e -- update to vdr-plugin-xvdr-c2fa08a -- added vdr-plugin-vnsiserver - -3.0.1 -- bump addon version - -2.1.8 -- rebuild due to some static libs in latest git - -2.1.7 -- update to vdr-plugin-streamdev-6a47e20 -- update to vdr-sc-613 - -2.1.6 -- update to vdr-plugin-dvbapi-e3200c8 -- added vdr-xmltv2vdr plugin -- added xineliboutput plugin -- added text2skin plugin -- preparation for xine based VDR frontend as separate addon - -2.1.5 -- fixed rotorng -- added wirbelscancontrol plugin - -2.1.4 -- added live plugin -- added rotorng plugin -- added control plugin -- added epgsearch plugin -- update to vdr-iptv-0.5.2 -- update to vdr-plugin-streamdev-8719007 -- update to vdr-plugin-xvdr-b62ccbd - -2.1.3 -- adjust for fontconfig 2.9.0 -- update patchset -- suspend/resume fixes - -2.1.2 -- update to vdr-1.7.27 -- update to vdr-dynamite-10d78a8 -- update to vdr-sc-605 - -2.1.1 -- rebuild for addon version 2.1 -- update to vdr-plugin-dvbapi-9bef03f - -2.0.9 -- modules to remove on sleep now configurable via settings ui -- enabled plugins now configurable via settings ui - -2.0.8 -- update to vdr-1.7.25 -- update to vdr-plugin-xvdr-c98852f -- add streamdev-client / server plugin -- update to vdr-iptv-0.5.0 -- move w_scan in a own addon - -2.0.7 -- add possibilty to start / stop addon from addon manager with enable / disable - -2.0.6 -- enable unloading/loading dvb modules on suspend/resume - -2.0.5 -- update to vdr-1.7.24 -- sc now works without the need to disable dynamite plugin - -2.0.4 -- start userspace DVB drivers before VDR - -2.0.3 -- update to vdr-plugin-xvdr-0ac808a -- rebuild for libiconv changes -- update to vdr-plugin-dvbapi-b0194c8 -- update to w_scan-20120112 - -2.0.2 -- update to vdr-plugin-xvdr-ec9b759 -- update to vdr-plugin-dvbapi-dad660a -- update to vdr-dynamite-27d7bed -- add plugin 'vdr-iptv' - -2.0.1 -- rename vdr-dvbapi-plugin to vdr-plugin-dvbapi -- update to vdr-plugin-dvbapi-68e043a - -2.0.0 -- initial version vdr-1.7.22 diff --git a/packages/addons/service/multimedia/vdr-addon/icon/icon.png b/packages/addons/service/multimedia/vdr-addon/icon/icon.png deleted file mode 100644 index 759e481b68d..00000000000 Binary files a/packages/addons/service/multimedia/vdr-addon/icon/icon.png and /dev/null differ diff --git a/packages/addons/service/oscam/changelog.txt b/packages/addons/service/oscam/changelog.txt new file mode 100644 index 00000000000..66eb55913e9 --- /dev/null +++ b/packages/addons/service/oscam/changelog.txt @@ -0,0 +1,9 @@ +8.0.101 +- Update OSCam to 11233 +- fix the WeTek_Play problems + +8.0.100 +- Update for LibreELEC 8.0 + +7.0.100 +- initial LibreELEC version \ No newline at end of file diff --git a/packages/addons/service/oscam/icon/icon.png b/packages/addons/service/oscam/icon/icon.png new file mode 100644 index 00000000000..3055c46ebd4 Binary files /dev/null and b/packages/addons/service/oscam/icon/icon.png differ diff --git a/packages/addons/service/oscam/package.mk b/packages/addons/service/oscam/package.mk new file mode 100644 index 00000000000..a6fabf6f744 --- /dev/null +++ b/packages/addons/service/oscam/package.mk @@ -0,0 +1,66 @@ +################################################################################ +# This file is part of LibreELEC - https://LibreELEC.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +PKG_NAME="oscam" +PKG_VERSION="c677c6e" +PKG_VERSION_NUMBER="11233" +PKG_REV="101" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="http://www.streamboard.tv/oscam/wiki" +PKG_URL="http://repo.or.cz/oscam.git/snapshot/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain pcsc-lite" +PKG_PRIORITY="optional" +PKG_SECTION="service.softcam" +PKG_SHORTDESC="OSCam: an Open Source Conditional Access Modul" +PKG_LONGDESC="OSCam($PKG_VERSION_NUMBER) is a software to be used to decrypt digital television channels, as an alternative for a conditional access module." + +PKG_IS_ADDON="yes" +PKG_ADDON_NAME="OSCam" +PKG_ADDON_TYPE="xbmc.service" +PKG_AUTORECONF="no" +PKG_ADDON_REPOVERSION="8.0" + +pre_unpack() { +export OSCAM_ADDON_VERSION="$PKG_VERSION_NUMBER" +} + +configure_target() { + cmake -DCMAKE_TOOLCHAIN_FILE=$CMAKE_CONF \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DLIBUSBDIR=$SYSROOT_PREFIX/usr \ + -DWITH_SSL=0 \ + -DHAVE_LIBCRYPTO=0 \ + -DHAVE_DVBAPI=1 -DWITH_STAPI=0 \ + -DWEBIF=1 \ + -DWITH_DEBUG=0 \ + -DOPTIONAL_INCLUDE_DIR=$SYSROOT_PREFIX/usr/include \ + -DSTATIC_LIBUSB=1 \ + -DCLOCKFIX=0 \ + .. +} + +makeinstall_target() { + : # nop +} + +addon() { + mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/bin + cp -P $PKG_BUILD/.$TARGET_NAME/oscam $ADDON_BUILD/$PKG_ADDON_ID/bin + cp -P $PKG_BUILD/.$TARGET_NAME/utils/list_smargo $ADDON_BUILD/$PKG_ADDON_ID/bin +} diff --git a/packages/addons/service/oscam/patches/oscam-01-revision.patch b/packages/addons/service/oscam/patches/oscam-01-revision.patch new file mode 100644 index 00000000000..201666456ee --- /dev/null +++ b/packages/addons/service/oscam/patches/oscam-01-revision.patch @@ -0,0 +1,13 @@ +diff --git a/config.sh b/config.sh +index 7653731..a6b2ea8 100755 +--- a/config.sh ++++ b/config.sh +@@ -687,7 +687,7 @@ do + break + ;; + '-r'|'--oscam-revision') +- (svnversion -n . 2>/dev/null || printf 0) | sed 's/.*://; s/[^0-9]*$//; s/^$/0/' ++ echo "$OSCAM_ADDON_VERSION" + break + ;; + '-O'|'--detect-osx-sdk-version') diff --git a/packages/addons/service/oscam/patches/oscam-02-link-with-ludev.patch b/packages/addons/service/oscam/patches/oscam-02-link-with-ludev.patch new file mode 100644 index 00000000000..ff16f494da4 --- /dev/null +++ b/packages/addons/service/oscam/patches/oscam-02-link-with-ludev.patch @@ -0,0 +1,28 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 3ebd781..2966e65 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -474,7 +474,7 @@ add_library (${csoscam} STATIC ${csoscam_srcs} ${csoscam_hdrs}) + + set (exe_name "oscam") + add_executable (${exe_name} ${exe_srcs} ${exe_hdrs}) +-target_link_libraries (${exe_name} ${csoscam} ${csmodules} ${csreaders} csctapi cscrypt minilzo) ++target_link_libraries (${exe_name} ${csoscam} ${csmodules} ${csreaders} csctapi cscrypt minilzo udev) + if(HAVE_LIBRT AND HAVE_LIBUSB) + if (LIBUSBDIR) + set (libusb_link "imp_libusb") +diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt +index 6790913..a603d3e 100644 +--- a/utils/CMakeLists.txt ++++ b/utils/CMakeLists.txt +@@ -12,7 +12,7 @@ file (GLOB all_srcs ${exe_srcs}) + + set (util_name "list_smargo") + add_executable (${util_name} ${exe_srcs} ${exe_hdrs}) +-target_link_libraries (${util_name} ${libusb_link} ${rt_link} ${setupapi_link} ${ole32_link} ${shell32_link} ${pthread_link} ${dl_link}) ++target_link_libraries (${util_name} ${libusb_link} ${rt_link} ${setupapi_link} ${ole32_link} ${shell32_link} ${pthread_link} ${dl_link} udev) + #----------------------- printout resume ----------------------------- + + message (STATUS "Utils: operating system: ${OSCamOperatingSystem}") +-- +1.7.2.5 diff --git a/packages/addons/service/oscam/patches/oscam-03-pcsc-pthread.patch b/packages/addons/service/oscam/patches/oscam-03-pcsc-pthread.patch new file mode 100644 index 00000000000..4eeee551116 --- /dev/null +++ b/packages/addons/service/oscam/patches/oscam-03-pcsc-pthread.patch @@ -0,0 +1,12 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index cd52430..b01b9fc 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -530,6 +530,7 @@ if (HAVE_PCSC) + if (NOT OSCamOperatingSystem MATCHES "Mac OS X") + if (NOT OSCamOperatingSystem MATCHES "Windows/Cygwin") + target_link_libraries (${exe_name} pcsclite) ++ target_link_libraries (${exe_name} pthread) + endif (NOT OSCamOperatingSystem MATCHES "Windows/Cygwin") + endif (NOT OSCamOperatingSystem MATCHES "Mac OS X") + endif (HAVE_PCSC) diff --git a/packages/addons/service/oscam/source/bin/oscam.start b/packages/addons/service/oscam/source/bin/oscam.start new file mode 100755 index 00000000000..23ae9d2beef --- /dev/null +++ b/packages/addons/service/oscam/source/bin/oscam.start @@ -0,0 +1,63 @@ +#!/bin/sh + +################################################################################ +# This file is part of LibreELEC - https://LibreELEC.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +. /etc/profile + +oe_setup_addon service.softcam.oscam + +mkdir -p $ADDON_HOME/config +mkdir -p $ADDON_HOME/log + +for config_name in \ + oscam.ac oscam.cert oscam.dvbapi oscam.guess oscam.ird oscam.provid \ + oscam.server oscam.services oscam.srvid oscam.tiers oscam.user +do + [ ! -f $ADDON_HOME/config/$config_name ] && touch $ADDON_HOME/config/$config_name +done + +if [ ! -f "$ADDON_HOME/config/oscam.conf" ]; then + cp $ADDON_DIR/oscam-default.conf $ADDON_HOME/config/oscam.conf +fi + +find $ADDON_DIR/bin -maxdepth 1 -type f ! -perm 0755 -exec chmod 0755 \{\} \; + +if [ "$WORKAROUND_SLEEP" == "true" ] ; then + sleep $WORKAROUND_SLEEP_TIME +fi + +# start userspace DVB driver/addon +for driver_dvb in $(find /storage/.kodi/addons/driver.dvb.*/bin/userspace-driver.sh -type f 2>/dev/null); do + driver_dvb_name=$(echo $driver_dvb | awk 'BEGIN {FS="/"} {printf("%s", $5)}') + logger -t OSCAM "### Loading userspace DVB driver: $driver_dvb_name ###" + # use ". " because of variable export + . $driver_dvb +done + +if [ "$WAIT_FOR_FEINIT" == "true" ] ; then + while [ true ] ; do + if [ -e /dev/dvb/adapter$((NUM_ADAPTERS-1))/frontend0 ] ; then + break + fi + sleep 1 + done +fi + +exec oscam -c $ADDON_HOME/config > /dev/null 2>&1 + diff --git a/packages/addons/service/oscam/source/default.py b/packages/addons/service/oscam/source/default.py new file mode 100644 index 00000000000..c6dfcce9f2c --- /dev/null +++ b/packages/addons/service/oscam/source/default.py @@ -0,0 +1,17 @@ +################################################################################ +# This file is part of LibreELEC - https://LibreELEC.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ diff --git a/packages/addons/service/oscam/source/oscam-default.conf b/packages/addons/service/oscam/source/oscam-default.conf new file mode 100644 index 00000000000..ac5da7844c3 --- /dev/null +++ b/packages/addons/service/oscam/source/oscam-default.conf @@ -0,0 +1,27 @@ +# oscam.conf generated automatically by Streamboard OSCAM 1.00-unstable_svn build #0 +# Read more: http://streamboard.gmc.to/svn/oscam/trunk/Distribution/doc/txt/oscam.conf.txt + +[global] +usrfile = /storage/.kodi/userdata/addon_data/service.softcam.oscam/log/oscamuser.log +logfile = /storage/.kodi/userdata/addon_data/service.softcam.oscam/log/oscam.log +cwlogdir = /storage/.kodi/userdata/addon_data/service.softcam.oscam/log/cw +nice = -1 +saveinithistory = 1 + +[monitor] +port = 988 +aulow = 120 +hideclient_to = 15 +monlevel = 1 +appendchaninfo = 0 + +[webif] +httpport = 8888 +httpuser = oscam +httppwd = oscam +httpallowed = 0.0.0.0-255.255.255.255 + +[dvbapi] +enabled = 1 +pmt_mode = 4 +boxtype = pc diff --git a/packages/addons/service/oscam/source/resources/language/English/strings.xml b/packages/addons/service/oscam/source/resources/language/English/strings.xml new file mode 100644 index 00000000000..adb080f372a --- /dev/null +++ b/packages/addons/service/oscam/source/resources/language/English/strings.xml @@ -0,0 +1,10 @@ + + + General + Restart on suspend / resume + DVBAPI + Delay the start of OSCam + time (s) + Wait for frontend initialization + Number of adapters to wait for + diff --git a/packages/addons/service/oscam/source/resources/settings.xml b/packages/addons/service/oscam/source/resources/settings.xml new file mode 100644 index 00000000000..669656f8c9f --- /dev/null +++ b/packages/addons/service/oscam/source/resources/settings.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/packages/addons/service/oscam/source/settings-default.xml b/packages/addons/service/oscam/source/settings-default.xml new file mode 100644 index 00000000000..25b504631df --- /dev/null +++ b/packages/addons/service/oscam/source/settings-default.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/packages/addons/service/oscam/source/sleep.d/oscam.power b/packages/addons/service/oscam/source/sleep.d/oscam.power new file mode 100644 index 00000000000..550f8840723 --- /dev/null +++ b/packages/addons/service/oscam/source/sleep.d/oscam.power @@ -0,0 +1,40 @@ +#!/bin/sh + +################################################################################ +# This file is part of LibreELEC - https://LibreELEC.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +. /etc/profile + +oe_setup_addon service.softcam.oscam + +SERVICE="service.softcam.oscam.service" + +if [ "$RESTART_ON_RESUME" == "true" ] ; then + case "$1" in + pre) + if systemctl is-active "$SERVICE" &>/dev/null ; then + systemctl stop "$SERVICE" + fi + ;; + post) + if systemctl is-enabled "$SERVICE" &>/dev/null ; then + systemctl start "$SERVICE" + fi + ;; + esac +fi diff --git a/packages/addons/service/oscam/source/system.d/service.softcam.oscam.service b/packages/addons/service/oscam/source/system.d/service.softcam.oscam.service new file mode 100644 index 00000000000..9791e2d9b59 --- /dev/null +++ b/packages/addons/service/oscam/source/system.d/service.softcam.oscam.service @@ -0,0 +1,14 @@ +[Unit] +Description=OSCam +After=network-online.service +Requires=network-online.service + +[Service] +ExecStart=/bin/sh -c "exec sh /storage/.kodi/addons/service.softcam.oscam/bin/oscam.start" +TimeoutStopSec=1 +Restart=always +RestartSec=2 +StartLimitInterval=0 + +[Install] +WantedBy=kodi.target diff --git a/packages/addons/service/syncthing/changelog.txt b/packages/addons/service/syncthing/changelog.txt new file mode 100644 index 00000000000..edb8383d02f --- /dev/null +++ b/packages/addons/service/syncthing/changelog.txt @@ -0,0 +1,8 @@ +8.0.102 +- Enable automatic upgrades + +8.0.101 +- Update to version 0.12.24 + +8.0.100 +- Initial addon diff --git a/packages/addons/service/syncthing/icon/icon.png b/packages/addons/service/syncthing/icon/icon.png new file mode 100644 index 00000000000..c473dd9e4a7 Binary files /dev/null and b/packages/addons/service/syncthing/icon/icon.png differ diff --git a/packages/addons/service/syncthing/package.mk b/packages/addons/service/syncthing/package.mk new file mode 100644 index 00000000000..3e6ba93b0e3 --- /dev/null +++ b/packages/addons/service/syncthing/package.mk @@ -0,0 +1,90 @@ +################################################################################ +# This file is part of LibreELEC - https://libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +PKG_NAME="syncthing" +PKG_VERSION="0.12.24" +PKG_REV="102" +PKG_ARCH="any" +PKG_LICENSE="MPLv2" +PKG_SITE="https://syncthing.net/" +PKG_URL="https://github.com/syncthing/syncthing/archive/v${PKG_VERSION}.tar.gz" +PKG_DEPENDS_TARGET="toolchain go:host" +PKG_PRIORITY="optional" +PKG_SECTION="service/system" + +PKG_SHORTDESC="Open Source Continuous File Synchronization" +PKG_LONGDESC="Syncthing replaces proprietary sync and cloud services with something open, trustworthy and decentralized. Your data is your data alone and you deserve to choose where it is stored, if it is shared with some third party and how it's transmitted over the Internet." +PKG_MAINTAINER="Anton Voyl (awiouy at gmail dot com)" +PKG_ADDON_REPOVERSION="8.0" + +PKG_IS_ADDON="yes" +PKG_ADDON_NAME="Syncthing" +PKG_ADDON_TYPE="xbmc.service" +PKG_ADDON_PROVIDES="" +PKG_AUTORECONF="no" + +configure_target() { + + case $TARGET_ARCH in + x86_64) + export GOARCH=amd64 + ;; + aarch64) + export GOARCH=arm64 + ;; + arm) + export GOARCH=arm + case $TARGET_CPU in + arm1176jzf-s) + export GOARM=6 + ;; + cortex-a7|cortex-a9) + export GOARM=7 + ;; + esac + ;; + esac + + export GOOS=linux + export CGO_ENABLED=1 + export CGO_NO_EMULATION=1 + export CGO_CFLAGS=$CFLAGS + export LDFLAGS="-w -linkmode external -extldflags -Wl,--unresolved-symbols=ignore-in-shared-libs -extld $TARGET_CC -X main.Version=v$PKG_VERSION" + export GOLANG=$ROOT/$TOOLCHAIN/lib/golang/bin/go + export GOPATH=$ROOT/$PKG_BUILD:$ROOT/$PKG_BUILD/Godeps/_workspace + export GOROOT=$ROOT/$TOOLCHAIN/lib/golang + export PATH=$PATH:$GOROOT/bin + + mkdir -p $ROOT/$PKG_BUILD $ROOT/$PKG_BUILD/src/github.com/syncthing + ln -fs $ROOT/$PKG_BUILD $ROOT/$PKG_BUILD/src/github.com/syncthing/syncthing + +} + +make_target() { + mkdir -p bin + $GOLANG build -v -o bin/syncthing -a -ldflags "$LDFLAGS" ./cmd/syncthing +} + +makeinstall_target() { + : +} + +addon() { + mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/bin + cp -P $ROOT/$PKG_BUILD/bin/syncthing $ADDON_BUILD/$PKG_ADDON_ID/bin +} diff --git a/packages/addons/service/syncthing/source/bin/syncthing-service b/packages/addons/service/syncthing/source/bin/syncthing-service new file mode 100644 index 00000000000..45812d867ec --- /dev/null +++ b/packages/addons/service/syncthing/source/bin/syncthing-service @@ -0,0 +1,31 @@ +#!/bin/sh +################################################################################ +# This file is part of LibreELEC - https://libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +. /etc/profile +oe_setup_addon service.system.syncthing + +chmod +x $ADDON_DIR/bin/* + +STNODEFAULTFOLDER="y" syncthing -home=$ADDON_HOME \ + -gui-address="$gui_address" \ + -logflags=0 \ + -no-browser \ + -no-restart \ + & + diff --git a/packages/addons/service/syncthing/source/default.py b/packages/addons/service/syncthing/source/default.py new file mode 100644 index 00000000000..3999a0eb31e --- /dev/null +++ b/packages/addons/service/syncthing/source/default.py @@ -0,0 +1,35 @@ +################################################################################ +# This file is part of LibreELEC - https://libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +import subprocess +import xbmc +import xbmcaddon + + +class Monitor(xbmc.Monitor): + + def __init__(self, *args, **kwargs): + xbmc.Monitor.__init__(self) + self.id = xbmcaddon.Addon().getAddonInfo('id') + + def onSettingsChanged(self): + subprocess.call(['systemctl', 'restart', self.id]) + + +if __name__ == "__main__": + Monitor().waitForAbort() diff --git a/packages/addons/service/syncthing/source/resources/language/English/strings.po b/packages/addons/service/syncthing/source/resources/language/English/strings.po new file mode 100644 index 00000000000..2c7084c08f7 --- /dev/null +++ b/packages/addons/service/syncthing/source/resources/language/English/strings.po @@ -0,0 +1,14 @@ +# Kodi Media Center language file +# Addon Name: syncthing +# Addon id: service.system.syncthing +# Addon Provider: awiouy at gmail dot com +msgid "" +msgstr "" + +msgctxt "#30000" +msgid "GUI Address" +msgstr "" + +msgctxt "#30001" +msgid "GUI Address" +msgstr "" diff --git a/packages/addons/service/syncthing/source/resources/settings.xml b/packages/addons/service/syncthing/source/resources/settings.xml new file mode 100644 index 00000000000..442a8507d88 --- /dev/null +++ b/packages/addons/service/syncthing/source/resources/settings.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/packages/addons/service/syncthing/source/settings-default.xml b/packages/addons/service/syncthing/source/settings-default.xml new file mode 100644 index 00000000000..c36bbd0391d --- /dev/null +++ b/packages/addons/service/syncthing/source/settings-default.xml @@ -0,0 +1,3 @@ + + + diff --git a/packages/addons/service/syncthing/source/system.d/service.system.syncthing.service b/packages/addons/service/syncthing/source/system.d/service.system.syncthing.service new file mode 100644 index 00000000000..8e8839fef3c --- /dev/null +++ b/packages/addons/service/syncthing/source/system.d/service.system.syncthing.service @@ -0,0 +1,16 @@ +[Unit] +Description=Syncthing - Open Source Continuous File Synchronization +Documentation=http://docs.syncthing.net/ +After=network.target +Requires=network.target + +[Service] +Type=forking +ExecStart=/bin/sh /storage/.kodi/addons/service.system.syncthing/bin/syncthing-service +Restart=on-failure +SuccessExitStatus=3 4 +RestartForceExitStatus=3 4 + +[Install] +WantedBy=kodi.target + diff --git a/packages/addons/service/tinc/changelog.txt b/packages/addons/service/tinc/changelog.txt new file mode 100755 index 00000000000..954056c4fea --- /dev/null +++ b/packages/addons/service/tinc/changelog.txt @@ -0,0 +1,5 @@ +8.0.101 +- Bump to tinc-1.1pre14 + +8.0.100 +- Initial addon diff --git a/packages/addons/service/tinc/icon/icon.png b/packages/addons/service/tinc/icon/icon.png new file mode 100644 index 00000000000..112b784f83a Binary files /dev/null and b/packages/addons/service/tinc/icon/icon.png differ diff --git a/packages/addons/service/tinc/package.mk b/packages/addons/service/tinc/package.mk new file mode 100644 index 00000000000..03c3af42e95 --- /dev/null +++ b/packages/addons/service/tinc/package.mk @@ -0,0 +1,59 @@ +################################################################################ +# This file is part of LibreELEC - https://libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +PKG_NAME="tinc" +PKG_VERSION="1.1pre14" +PKG_REV="101" +PKG_ARCH="any" +PKG_LICENSE="GPLv2" +PKG_SITE="http://www.tinc-vpn.org/" +PKG_URL="${PKG_SITE}/packages/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain libressl lzo" +PKG_PRIORITY="optional" +PKG_SECTION="service/system" +PKG_SHORTDESC="tinc Virtual Private Network Daemon" +PKG_LONGDESC="tinc is a virtual private network (VPN) daemon that uses tunnelling and encryption to create a secure private network between hosts on the Internet. Because the VPN appears to the IP level network code as a normal network device, there is no need to adapt any existing software. This allows VPN sites to share information with each other over the Internet without exposing any information to others." + +PKG_AUTORECONF="yes" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="xbmc.service" +PKG_ADDON_PROVIDES="" +PKG_ADDON_REPOVERSION="8.0" +PKG_MAINTAINER="Anton Voyl (awiouy at gmail dot com)" + +PKG_CONFIGURE_OPTS_TARGET="--disable-curses \ + --disable-readline \ + --sysconfdir=/storage/.cache" + +pre_configure_target() { + # tinc fails to build in subdirs + cd $ROOT/$PKG_BUILD + rm -rf .$TARGET_NAME +} + +makeinstall_target() { + : +} + +addon() { + mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/bin + cp $PKG_BUILD/src/tinc \ + $PKG_BUILD/src/tincd \ + $ADDON_BUILD/$PKG_ADDON_ID/bin +} diff --git a/packages/addons/service/tinc/source/bin/subnet-up b/packages/addons/service/tinc/source/bin/subnet-up new file mode 100755 index 00000000000..1a5cbdf504d --- /dev/null +++ b/packages/addons/service/tinc/source/bin/subnet-up @@ -0,0 +1,18 @@ +#!/bin/sh +. /etc/profile +oe_setup_addon service.system.tinc + +case "$SUBNET" in + ??:??:??:??:??:??) + : + ;; + *) + if [ "$NAME" == "$NODE" ] + then + ip addr replace "$SUBNET/$tinc_mask" dev "$INTERFACE" + elif [ "$tinc_mask" == "32" ] + then + ip route replace "$SUBNET" dev "$INTERFACE" + fi + ;; +esac diff --git a/packages/addons/service/tinc/source/bin/tinc-service b/packages/addons/service/tinc/source/bin/tinc-service new file mode 100644 index 00000000000..0901a543318 --- /dev/null +++ b/packages/addons/service/tinc/source/bin/tinc-service @@ -0,0 +1,81 @@ +#!/bin/sh +################################################################################ +# This file is part of LibreELEC - https://libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +. /etc/profile +oe_setup_addon service.system.tinc + +config="$ADDON_HOME/.config" +dev="vmnetz" +host="$ADDON_HOME/Host" +hosts="$ADDON_HOME/Hosts" + +rm -rf "$host" +rm -f "$hosts" + +if [ -z "$tinc_name" ] +then + rm -rf "$config" + exit 0 +fi + +read_name="$(tinc -c $config get name)" + +if [ "$read_name" != "$tinc_name" ] +then + rm -rf "$config" + tinc -c "$config" init "$tinc_name" +fi + +mkdir -p "$host" +ln -s "$config/hosts/$tinc_name" "$host/$tinc_name" +ln -nsf "$config/hosts" "$hosts" + +for var in address port subnet +do + eval "tinc_var=\$tinc_$var" + if [ -z "$tinc_var" ] + then + tinc -c "$config" del "$var" + else + tinc -c "$config" set "$var" "$tinc_var" + fi +done + +cp "$ADDON_DIR/bin/subnet-up" \ + "$ADDON_DIR/bin/tinc-up" \ + "$config" + +case "$tinc_subnets" in + "default") + subnets="" + ;; + "strict subnets") + subnets="-o StrictSubnets=yes" + ;; + "tunnel server") + subnets="-o TunnelServer=yes" + ;; +esac + +tincd -c "$config" \ + -n "$dev" \ + -o AutoConnect=yes \ + -o LocalDiscovery=yes \ + -o mode="$tinc_mode" \ + $subnets diff --git a/packages/addons/service/tinc/source/bin/tinc-up b/packages/addons/service/tinc/source/bin/tinc-up new file mode 100755 index 00000000000..396cfd071c0 --- /dev/null +++ b/packages/addons/service/tinc/source/bin/tinc-up @@ -0,0 +1,2 @@ +#!/bin/sh +ip link set up dev "$INTERFACE" diff --git a/packages/addons/service/tinc/source/default.py b/packages/addons/service/tinc/source/default.py new file mode 100644 index 00000000000..c7cb3a4f326 --- /dev/null +++ b/packages/addons/service/tinc/source/default.py @@ -0,0 +1,88 @@ +################################################################################ +# This file is part of LibreELEC - https://libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ +import os.path +import random +import socket +import struct +import subprocess +import urllib2 +import xbmc +import xbmcaddon + + +ADDON = xbmcaddon.Addon() +ID = ADDON.getAddonInfo('id') +PATH = ADDON.getAddonInfo('path') +TINC = os.path.join(PATH, 'bin', 'tinc') + +def run_code(cmd, *argv): + return subprocess.call(cmd.format(*argv).split()) + +def run_lines(cmd, *argv): + try: + return subprocess.check_output(cmd.format(*argv).split()).splitlines() + except subprocess.CalledProcessError: + return [] + + +class Monitor(xbmc.Monitor): + + def __init__(self, *args, **kwargs): + xbmc.Monitor.__init__(self) + + def onSettingsChanged(self): + run_code('systemctl restart {}'.format(ID)) + + +if __name__ == '__main__': + for network in run_lines('{} network', TINC): + run_code('{} -n {} start', TINC, network) + + if ADDON.getSetting('tinc_wizard') == 'true': + try: + ip = urllib2.urlopen('http://ip.42.pl/raw').read() + address = socket.gethostbyaddr(ip)[0] + ADDON.setSetting('tinc_address', address) + except: + pass + + network, mask = '10.0.0.0/8'.split('/') + mask = 2 ** (32 - int(mask)) - 1 + network = struct.unpack('!L', socket.inet_aton(network))[0] & -mask + ip = network + random.randint(1, mask - 1) + name = format(ip, '08x') + subnet = socket.inet_ntoa(struct.pack('!L', ip)) + ADDON.setSetting('tinc_name', name) + ADDON.setSetting('tinc_subnet', subnet) + + port = int(ADDON.getSetting('tinc_port')) + s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + try: + s.bind(('', port)) + s.close() + except socket.error: + s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + s.bind(('', 0)) + a, port = s.getsockname() + s.close() + ADDON.setSetting('tinc_port', str(port)) + + ADDON.setSetting('tinc_wizard', 'false') + run_code('systemctl restart {}'.format(ID)) + + Monitor().waitForAbort() diff --git a/packages/addons/service/tinc/source/resources/language/English/strings.po b/packages/addons/service/tinc/source/resources/language/English/strings.po new file mode 100644 index 00000000000..82efcf4fdf7 --- /dev/null +++ b/packages/addons/service/tinc/source/resources/language/English/strings.po @@ -0,0 +1,70 @@ +# Kodi Media Center language file +# Addon Name: tinc +# Addon id: service.system.tinc +# Addon Provider: awiouy at gmail dot com +msgid "" +msgstr "" + +msgctxt "#30000" +msgid "Configuration" +msgstr "" + +msgctxt "#30001" +msgid "Virtual Private Network" +msgstr "" + +msgctxt "#30002" +msgid "Name" +msgstr "" + +msgctxt "#30003" +msgid "Subnet" +msgstr "" + +msgctxt "#30004" +msgid "Mask" +msgstr "" + +msgctxt "#30005" +msgid "Mode" +msgstr "" + +msgctxt "#30006" +msgid "Subnet Discovery" +msgstr "" + +msgctxt "#30007" +msgid "Public Network" +msgstr "" + +msgctxt "#30008" +msgid "Address" +msgstr "" + +msgctxt "#30009" +msgid "Port" +msgstr "" + +msgctxt "#30010" +msgid "Instructions" +msgstr "" + +msgctxt "#30011" +msgid "1. Configure local node (see tinc-vpn.org/documentation-1.1)" +msgstr "" + +msgctxt "#30012" +msgid "2. Enable port forwarding on your router (see e.g. portforward.com)" +msgstr "" + +msgctxt "#30013" +msgid "3. Distribute local host file from userdata/addon_data/service.system.tinc/Host" +msgstr "" + +msgctxt "#30014" +msgid "4. Collect remote host files in userdata/addon_data/service.system.tinc/Hosts" +msgstr "" + +msgctxt "#30015" +msgid "5. Restart tinc to load remote host files" +msgstr "" diff --git a/packages/addons/service/tinc/source/resources/settings.xml b/packages/addons/service/tinc/source/resources/settings.xml new file mode 100644 index 00000000000..c9919ea0acc --- /dev/null +++ b/packages/addons/service/tinc/source/resources/settings.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/addons/service/tinc/source/settings-default.xml b/packages/addons/service/tinc/source/settings-default.xml new file mode 100644 index 00000000000..38d2d1c812f --- /dev/null +++ b/packages/addons/service/tinc/source/settings-default.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/packages/addons/service/tinc/source/system.d/service.system.tinc.service b/packages/addons/service/tinc/source/system.d/service.system.tinc.service new file mode 100644 index 00000000000..59f6f7f1255 --- /dev/null +++ b/packages/addons/service/tinc/source/system.d/service.system.tinc.service @@ -0,0 +1,13 @@ +[Unit] +Description=tinc for LibreELEC +Documentation=http://tinc-vpn.org/docs/ +After=network-online.target +Requires=network-online.target + +[Service] +Type=forking +ExecStart=/bin/sh /storage/.kodi/addons/service.system.tinc/bin/tinc-service +Restart=on-failure + +[Install] +WantedBy=kodi.target diff --git a/packages/addons/service/tvheadend/changelog.txt b/packages/addons/service/tvheadend/changelog.txt new file mode 100644 index 00000000000..363dacc988e --- /dev/null +++ b/packages/addons/service/tvheadend/changelog.txt @@ -0,0 +1,10 @@ +8.0.100 +- Update for LibreELEC 8.0 + +7.0.101 +- update tvheadend to 4.0.9-4 +- startup logic fix +- added proper icon and description + +7.0.100 +- initial LibreELEC version \ No newline at end of file diff --git a/packages/addons/service/tvheadend/icon/icon.png b/packages/addons/service/tvheadend/icon/icon.png new file mode 100644 index 00000000000..46c140ad4bc Binary files /dev/null and b/packages/addons/service/tvheadend/icon/icon.png differ diff --git a/packages/addons/service/tvheadend/package.mk b/packages/addons/service/tvheadend/package.mk new file mode 100644 index 00000000000..80a82da57f6 --- /dev/null +++ b/packages/addons/service/tvheadend/package.mk @@ -0,0 +1,81 @@ +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# +# OpenELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# OpenELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with OpenELEC. If not, see . +################################################################################ + +PKG_NAME="tvheadend" +PKG_VERSION="ac9e47d" +PKG_VERSION_NUMBER="4.0.9" +PKG_REV="100" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="http://www.tvheadend.org" +PKG_URL="https://github.com/tvheadend/tvheadend/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain curl libdvbcsa libiconv libressl Python:host" +PKG_PRIORITY="optional" +PKG_SECTION="service.multimedia" +PKG_SHORTDESC="Tvheadend: a TV streaming server for Linux" +PKG_LONGDESC="Tvheadend($PKG_VERSION_NUMBER): is a TV streaming server for Linux supporting DVB-S/S2, DVB-C, DVB-T/T2, IPTV, SAT>IP and ATSC" + +PKG_IS_ADDON="yes" +PKG_ADDON_NAME="Tvheadend 4.0" +PKG_ADDON_TYPE="xbmc.service" +PKG_AUTORECONF="no" +PKG_ADDON_REPOVERSION="8.0" + +PKG_CONFIGURE_OPTS_TARGET="--prefix=/usr \ + --arch=$TARGET_ARCH \ + --cpu=$TARGET_CPU \ + --cc=$TARGET_CC \ + --enable-hdhomerun_client \ + --enable-hdhomerun_static \ + --disable-avahi \ + --disable-libav \ + --enable-inotify \ + --enable-epoll \ + --disable-uriparser \ + --enable-tvhcsa \ + --enable-bundle \ + --enable-dvbcsa \ + --disable-dbus_1 \ + --python=$ROOT/$TOOLCHAIN/bin/python" + +post_unpack() { + sed -e 's/VER="0.0.0~unknown"/VER="'$PKG_VERSION_NUMBER' ~ LibreELEC Tvh-addon v'$PKG_ADDON_REPOVERSION'.'$PKG_REV'"/g' -i $PKG_BUILD/support/version +} + +pre_configure_target() { +# fails to build in subdirs + cd $ROOT/$PKG_BUILD + rm -rf .$TARGET_NAME + + export CROSS_COMPILE=$TARGET_PREFIX + export CFLAGS="$CFLAGS -I$SYSROOT_PREFIX/usr/include/iconv -L$SYSROOT_PREFIX/usr/lib/iconv" +} + +post_make_target() { + $CC -O -fbuiltin -fomit-frame-pointer -fPIC -shared -o capmt_ca.so src/extra/capmt_ca.c -ldl +} + +makeinstall_target() { + : # nothing to do here +} + +addon() { + mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/bin + cp -P $PKG_BUILD/build.linux/tvheadend $ADDON_BUILD/$PKG_ADDON_ID/bin + cp -P $PKG_BUILD/capmt_ca.so $ADDON_BUILD/$PKG_ADDON_ID/bin +} diff --git a/packages/addons/service/tvheadend/patches/tvheadend-remove-Werror.patch b/packages/addons/service/tvheadend/patches/tvheadend-remove-Werror.patch new file mode 100644 index 00000000000..142fe05e940 --- /dev/null +++ b/packages/addons/service/tvheadend/patches/tvheadend-remove-Werror.patch @@ -0,0 +1,15 @@ +diff --git a/Makefile b/Makefile +index ddcc47e..0087a6c 100644 +--- a/Makefile ++++ b/Makefile +@@ -28,7 +28,7 @@ PROG := $(BUILDDIR)/tvheadend + # + + CFLAGS += -g -O2 -Wunused-result +-CFLAGS += -Wall -Werror -Wwrite-strings -Wno-deprecated-declarations ++CFLAGS += -Wall -Wwrite-strings -Wno-deprecated-declarations + CFLAGS += -Wmissing-prototypes + CFLAGS += -fms-extensions -funsigned-char -fno-strict-aliasing + CFLAGS += -D_FILE_OFFSET_BITS=64 +-- +1.7.2.5 diff --git a/packages/addons/service/tvheadend/source/bin/tv_grab_file b/packages/addons/service/tvheadend/source/bin/tv_grab_file new file mode 100755 index 00000000000..027ee869cdf --- /dev/null +++ b/packages/addons/service/tvheadend/source/bin/tv_grab_file @@ -0,0 +1,69 @@ +#!/bin/sh + +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# +# OpenELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# OpenELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with OpenELEC. If not, see . +################################################################################ + +if [ $# -lt 1 ] +then + . /etc/profile + + ADDON_HOME="$HOME/.kodi/userdata/addon_data/service.multimedia.tvheadend" + ADDON_SETTINGS="$ADDON_HOME/settings.xml" + XMLTV_TYPE=`grep XMLTV_TYPE $ADDON_SETTINGS | awk '{print $3 }' | sed -e "s,value=,," -e "s,\",,g"` + XMLTV_LOCATION_FILE=`grep XMLTV_LOCATION_FILE $ADDON_SETTINGS | awk '{print $3 }' | sed -e "s,value=,," -e "s,\",,g"` + XMLTV_LOCATION_WEB=`grep XMLTV_LOCATION_WEB $ADDON_SETTINGS | awk '{print $3 }' | sed -e "s,value=,," -e "s,\",,g"` + XMLTV_LOCATION_SCRIPT=`grep XMLTV_LOCATION_SCRIPT $ADDON_SETTINGS | awk '{print $3 }' | sed -e "s,value=,," -e "s,\",,g"` + + if [ "$XMLTV_TYPE" = "FILE" ]; then + cat "$XMLTV_LOCATION_FILE" + exit 0 + elif [ "$XMLTV_TYPE" = "SCRIPT" ]; then + if [ -e "$XMLTV_LOCATION_SCRIPT" ] ; then + exec "$XMLTV_LOCATION_SCRIPT" + fi + elif [ "$XMLTV_TYPE" = "WEB" ]; then + wget -qO - "$XMLTV_LOCATION_WEB" + exit 0 + fi +fi + +dflag= +vflag= +cflag= + +for a in "$@" +do +[ "$a" = "-d" -o "$a" = "--description" ] && dflag=1 +[ "$a" = "-v" -o "$a" = "--version" ] && vflag=1 +[ "$a" = "-c" -o "$a" = "--capabilities" ] && cflag=1 +done + +if [ -n "$dflag" ] +then +echo "tv_grab_file is a simple grabber that can be configured through the addon settings from Kodi" +fi + +if [ -n "$vflag" ] +then +echo "1.0" +fi + +if [ -n "$cflag" ] +then +echo "baseline" +fi diff --git a/packages/addons/service/tvheadend/source/bin/tvheadend.start b/packages/addons/service/tvheadend/source/bin/tvheadend.start new file mode 100755 index 00000000000..d36fafa07c0 --- /dev/null +++ b/packages/addons/service/tvheadend/source/bin/tvheadend.start @@ -0,0 +1,93 @@ +#!/bin/sh + +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# +# OpenELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# OpenELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with OpenELEC. If not, see . +################################################################################ + +. /etc/profile + +oe_setup_addon service.multimedia.tvheadend + +ADDON_SETTINGS="$ADDON_HOME/settings.xml" +XMLTV_FILE="$ADDON_DIR/bin/tv_grab_file" +XMLTV_SETTINGS_DIR="$ADDON_HOME/xmltv" +XMLTV_SETTINGS_FILE="$XMLTV_SETTINGS_DIR/config" +DVR_SETTINGS_DIR="$ADDON_HOME/dvr" +DVR_SETTINGS_FILE="$DVR_SETTINGS_DIR/config" +DVR_DIR="$HOME/recordings" +TIMESHIFT_SETTINGS_DIR="$ADDON_HOME/timeshift" +TIMESHIFT_SETTINGS_FILE="$TIMESHIFT_SETTINGS_DIR/config" +TIMESHIFT_DIR="$ADDON_HOME/cache/timeshift" + +chmod a+x $ADDON_DIR/bin/* + +if [ "$WORKAROUND_SLEEP" == "true" ] ; then + sleep $WORKAROUND_SLEEP_TIME +fi + +if [ ! -f "$XMLTV_SETTINGS_FILE" ]; then + mkdir -p $XMLTV_SETTINGS_DIR + if [ -f $ADDON_DIR/xmltv-config ]; then + cp $ADDON_DIR/xmltv-config $XMLTV_SETTINGS_FILE + fi +fi + +if [ ! -f "$DVR_SETTINGS_FILE" ]; then + mkdir -p $DVR_DIR + mkdir -p $DVR_SETTINGS_DIR + if [ -f $ADDON_DIR/dvr-config ]; then + cp $ADDON_DIR/dvr-config $DVR_SETTINGS_FILE + fi +fi + +if [ ! -f "$TIMESHIFT_SETTINGS_FILE" ]; then + mkdir -p $TIMESHIFT_DIR + mkdir -p $TIMESHIFT_SETTINGS_DIR + if [ -f $ADDON_DIR/timeshift-config ]; then + cp $ADDON_DIR/timeshift-config $TIMESHIFT_SETTINGS_FILE + fi +fi + +if [ "$DEBUG" = "yes" ]; then + TVHEADEND_ARG="-B -C -s -u root -g video -c $ADDON_HOME" +else + TVHEADEND_ARG="-B -C -u root -g video -c $ADDON_HOME" +fi + +# start userspace DVB driver/addon +for driver_dvb in $(find /storage/.kodi/addons/driver.dvb.*/bin/userspace-driver.sh -type f 2>/dev/null); do + driver_dvb_name=$(echo $driver_dvb | awk 'BEGIN {FS="/"} {printf("%s", $5)}') + logger -t Tvheadend "### Loading userspace DVB driver: $driver_dvb_name ###" + # use ". " because of variable export + . $driver_dvb +done + +if [ "$WAIT_FOR_FEINIT" == "true" ] ; then + while [ true ] ; do + if [ -e /dev/dvb/adapter$((NUM_ADAPTERS-1))/frontend0 ] ; then + break + fi + sleep 1 + done +fi + +if [ "$PRELOAD_CAPMT_CA" == "true" ] ; then + logger -t Tvheadend "### Preloading capmt_ca.so library ###" + LD_PRELOAD="$ADDON_DIR/bin/capmt_ca.so $LD_PRELOAD" exec $ADDON_DIR/bin/tvheadend $TVHEADEND_ARG &>$ADDON_LOG_FILE +else + exec $ADDON_DIR/bin/tvheadend $TVHEADEND_ARG &>$ADDON_LOG_FILE +fi diff --git a/tools/mkpkg/mkpkg_arm-mem b/packages/addons/service/tvheadend/source/default.py old mode 100755 new mode 100644 similarity index 64% rename from tools/mkpkg/mkpkg_arm-mem rename to packages/addons/service/tvheadend/source/default.py index 1863783214e..56d184d880f --- a/tools/mkpkg/mkpkg_arm-mem +++ b/packages/addons/service/tvheadend/source/default.py @@ -1,4 +1,3 @@ -#!/bin/sh ################################################################################ # This file is part of OpenELEC - http://www.openelec.tv # Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) @@ -16,26 +15,3 @@ # You should have received a copy of the GNU General Public License # along with OpenELEC. If not, see . ################################################################################ - -echo "getting sources..." - if [ ! -d arm-mem.git ]; then - git clone git://github.com/bavison/arm-mem.git -b master arm-mem.git - fi - - cd arm-mem.git - git pull - GIT_REV=`git log -n1 --format=%h` - cd .. - -echo "copying sources..." - rm -rf arm-mem-$GIT_REV - cp -R arm-mem.git arm-mem-$GIT_REV - -echo "cleaning sources..." - rm -rf arm-mem-$GIT_REV/.git - -echo "packing sources..." - tar cvJf arm-mem-$GIT_REV.tar.xz arm-mem-$GIT_REV - -echo "remove temporary sourcedir..." - rm -rf arm-mem-$GIT_REV diff --git a/packages/addons/service/tvheadend/source/dvr-config b/packages/addons/service/tvheadend/source/dvr-config new file mode 100644 index 00000000000..26b820aaa4a --- /dev/null +++ b/packages/addons/service/tvheadend/source/dvr-config @@ -0,0 +1,15 @@ +{ + "storage": "/storage/recordings", + "retention-days": 31, + "pre-extra-time": 0, + "post-extra-time": 0, + "day-dir": 0, + "channel-dir": 0, + "channel-in-title": 0, + "date-in-title": 0, + "time-in-title": 0, + "whitespace-in-title": 0, + "title-dir": 0, + "episode-in-title": 0, + "tag-files": 1 +} diff --git a/packages/addons/service/tvheadend/source/resources/language/English/strings.xml b/packages/addons/service/tvheadend/source/resources/language/English/strings.xml new file mode 100644 index 00000000000..cb11c7d0a06 --- /dev/null +++ b/packages/addons/service/tvheadend/source/resources/language/English/strings.xml @@ -0,0 +1,20 @@ + + + + + XMLTV + DVB + XMLTV configuration + XMLTV source type + XMLTV File location + XMLTV Web location + XMLTV Script location + DVB Configuration + Unload DVB mudules before suspend + Wait for frontend initialization + Number of adapters to wait for + Preload capmt_ca.so library + Delay the start of Tvheadend + time (s) + + diff --git a/packages/addons/service/tvheadend/source/resources/settings.xml b/packages/addons/service/tvheadend/source/resources/settings.xml new file mode 100644 index 00000000000..910ac2418fd --- /dev/null +++ b/packages/addons/service/tvheadend/source/resources/settings.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/addons/service/tvheadend/source/settings-default.xml b/packages/addons/service/tvheadend/source/settings-default.xml new file mode 100644 index 00000000000..0f47b8e2321 --- /dev/null +++ b/packages/addons/service/tvheadend/source/settings-default.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/tools/mkpkg/mkpkg_asplib b/packages/addons/service/tvheadend/source/sleep.d/tvheadend.power similarity index 65% rename from tools/mkpkg/mkpkg_asplib rename to packages/addons/service/tvheadend/source/sleep.d/tvheadend.power index f9fae72830a..50c83aea18a 100755 --- a/tools/mkpkg/mkpkg_asplib +++ b/packages/addons/service/tvheadend/source/sleep.d/tvheadend.power @@ -1,4 +1,5 @@ #!/bin/sh + ################################################################################ # This file is part of OpenELEC - http://www.openelec.tv # Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) @@ -17,25 +18,27 @@ # along with OpenELEC. If not, see . ################################################################################ -echo "getting sources..." - if [ ! -d asplib.git ]; then - git clone https://github.com/AchimTuran/asplib.git asplib.git - fi - - cd asplib.git - git pull - GIT_REV=`git log -n1 --format=%h` - cd .. - -echo "copying sources..." - rm -rf asplib-$GIT_REV - cp -R asplib.git asplib-$GIT_REV +. /etc/profile -echo "cleaning sources..." - rm -rf asplib-$GIT_REV/.git +oe_setup_addon service.multimedia.tvheadend -echo "packing sources..." - tar cvJf asplib-$GIT_REV.tar.xz asplib-$GIT_REV +SERVICE="service.multimedia.tvheadend" -echo "remove temporary sourcedir..." - rm -rf asplib-$GIT_REV +case "$1" in + pre) + if systemctl is-active "$SERVICE" &>/dev/null ; then + systemctl stop "$SERVICE" + for module in $REMOVE_MODULES ; do + rmmod $module + done + fi + ;; + post) + if systemctl is-enabled "$SERVICE" &>/dev/null ; then + for module in $REMOVE_MODULES ; do + modprobe $module + done + systemctl start "$SERVICE" + fi + ;; +esac diff --git a/packages/addons/service/tvheadend/source/system.d/service.multimedia.tvheadend.service b/packages/addons/service/tvheadend/source/system.d/service.multimedia.tvheadend.service new file mode 100644 index 00000000000..615d46f01af --- /dev/null +++ b/packages/addons/service/tvheadend/source/system.d/service.multimedia.tvheadend.service @@ -0,0 +1,14 @@ +[Unit] +Description=TVHeadend Service +After=network-online.service +Requires=network-online.service + +[Service] +ExecStart=/bin/sh -c "exec sh /storage/.kodi/addons/service.multimedia.tvheadend/bin/tvheadend.start" +TimeoutStopSec=2 +Restart=always +RestartSec=2 +StartLimitInterval=0 + +[Install] +WantedBy=kodi.target diff --git a/packages/addons/service/tvheadend/source/timeshift-config b/packages/addons/service/tvheadend/source/timeshift-config new file mode 100644 index 00000000000..ab43e9660cd --- /dev/null +++ b/packages/addons/service/tvheadend/source/timeshift-config @@ -0,0 +1,9 @@ +{ + "enabled": 0, + "ondemand": 0, + "path": "/storage/.kodi/userdata/addon_data/service.multimedia.tvheadend/cache/timeshift", + "unlimited_period": 0, + "max_period": 3600, + "unlimited_size": 0, + "max_size": 1024 +} diff --git a/packages/addons/service/tvheadend/source/xmltv-config b/packages/addons/service/tvheadend/source/xmltv-config new file mode 100644 index 00000000000..7da27e36e05 --- /dev/null +++ b/packages/addons/service/tvheadend/source/xmltv-config @@ -0,0 +1,14 @@ +{ + "grabbers": [ + { + "path": "/storage/.kodi/addons/service.multimedia.tvheadend/bin/tv_grab_file", + "description": "tv_grag_file is a simple grabber that just read the ~/.xmltv/tv_grab_file.xmltv file", + "version": "0.1\n", + "mtime": 1318774706, + "capabilities": 1 + } + ], + "grab-interval": 12, + "grab-enabled": 1, + "current-grabber": "/storage/.kodi/addons/service.multimedia.tvheadend/bin/tv_grab_file" +} diff --git a/packages/addons/service/tvheadend42/changelog.txt b/packages/addons/service/tvheadend42/changelog.txt new file mode 100644 index 00000000000..5472e5b599e --- /dev/null +++ b/packages/addons/service/tvheadend42/changelog.txt @@ -0,0 +1,7 @@ +8.0.102 +- Update for LibreELEC 8.0 +- Update to Tvheadend 4.1.1945 +- fix the XMLTV import script + +7.0.100 +- initial LibreELEC version \ No newline at end of file diff --git a/packages/addons/service/tvheadend42/icon/icon.png b/packages/addons/service/tvheadend42/icon/icon.png new file mode 100644 index 00000000000..846eb14b182 Binary files /dev/null and b/packages/addons/service/tvheadend42/icon/icon.png differ diff --git a/packages/addons/service/tvheadend42/package.mk b/packages/addons/service/tvheadend42/package.mk new file mode 100644 index 00000000000..710722ca810 --- /dev/null +++ b/packages/addons/service/tvheadend42/package.mk @@ -0,0 +1,105 @@ +################################################################################ +# This file is part of LibreELEC - https://LibreELEC.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +PKG_NAME="tvheadend42" +PKG_VERSION="5374573" +PKG_VERSION_NUMBER="4.1.1945" +PKG_REV="102" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="http://www.tvheadend.org" +PKG_URL="https://github.com/tvheadend/tvheadend/archive/$PKG_VERSION.tar.gz" +PKG_SOURCE_DIR="tvheadend-${PKG_VERSION}*" +PKG_DEPENDS_TARGET="toolchain curl libdvbcsa libiconv libressl Python:host yasm" +PKG_PRIORITY="optional" +PKG_SECTION="service" +PKG_SHORTDESC="Tvheadend: a TV streaming server for Linux" +PKG_LONGDESC="Tvheadend($PKG_VERSION_NUMBER): is a TV streaming server for Linux supporting DVB-S/S2, DVB-C, DVB-T/T2, IPTV, SAT>IP, ATSC and ISDB-T" + +PKG_IS_ADDON="yes" +PKG_ADDON_NAME="Tvheadend 4.2" +PKG_ADDON_TYPE="xbmc.service" +PKG_AUTORECONF="no" +PKG_ADDON_REPOVERSION="8.0" + +# transcoding only for generic +if [ "$TARGET_ARCH" = x86_64 ]; then + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET libva-intel-driver" + TVH_TRANSCODING="--enable-ffmpeg_static --enable-libav --enable-libfdkaac --disable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --disable-qsv" +else + TVH_TRANSCODING="--disable-ffmpeg_static --disable-libav" +fi + +PKG_CONFIGURE_OPTS_TARGET="--prefix=/usr \ + --arch=$TARGET_ARCH \ + --cpu=$TARGET_CPU \ + --cc=$TARGET_CC \ + --disable-avahi \ + --enable-bundle \ + --disable-dbus_1 \ + --enable-dvbcsa \ + --disable-dvben50221 \ + --enable-hdhomerun_client \ + --enable-hdhomerun_static \ + --enable-epoll \ + --enable-inotify \ + --disable-nvenc \ + --disable-uriparser \ + $TVH_TRANSCODING \ + --enable-tvhcsa \ + --nowerror \ + --python=$ROOT/$TOOLCHAIN/bin/python" + +post_unpack() { + sed -e 's/VER="0.0.0~unknown"/VER="'$PKG_VERSION_NUMBER' ~ LibreELEC Tvh-addon v'$PKG_ADDON_REPOVERSION'.'$PKG_REV'"/g' -i $PKG_BUILD/support/version +} + +pre_configure_target() { +# fails to build in subdirs + cd $ROOT/$PKG_BUILD + rm -rf .$TARGET_NAME + +# transcoding + if [ "$TARGET_ARCH" = x86_64 ]; then + export AS=$ROOT/$TOOLCHAIN/bin/yasm + fi + + export CROSS_COMPILE=$TARGET_PREFIX + export CFLAGS="$CFLAGS -I$SYSROOT_PREFIX/usr/include/iconv -L$SYSROOT_PREFIX/usr/lib/iconv" +} + +# transcoding link tvheadend with g++ +if [ "$TARGET_ARCH" = x86_64 ]; then + pre_make_target() { + export CXX=$TARGET_CXX + } +fi + +post_make_target() { + $CC -O -fbuiltin -fomit-frame-pointer -fPIC -shared -o capmt_ca.so src/extra/capmt_ca.c -ldl +} + +makeinstall_target() { + : # nothing to do here +} + +addon() { + mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/bin + cp -P $PKG_BUILD/build.linux/tvheadend $ADDON_BUILD/$PKG_ADDON_ID/bin + cp -P $PKG_BUILD/capmt_ca.so $ADDON_BUILD/$PKG_ADDON_ID/bin +} diff --git a/packages/addons/service/tvheadend42/patches/tvheadend42-01_makefile.patch b/packages/addons/service/tvheadend42/patches/tvheadend42-01_makefile.patch new file mode 100644 index 00000000000..710d1b91fe7 --- /dev/null +++ b/packages/addons/service/tvheadend42/patches/tvheadend42-01_makefile.patch @@ -0,0 +1,89 @@ +From: Team LibreELEC - https://LibreELEC.tv +Subject: adjust Tvheadend ffmpeg build to work with LibreELEC (transcoding) 06.04.2016 + +--- + +diff --git a/Makefile b/Makefile +--- a/Makefile ++++ b/Makefile +@@ -91,50 +91,65 @@ FFMPEG_CONFIG := \ + PKG_CONFIG_LIBDIR=$(FFMPEG_LIBDIR)/pkgconfig $(PKG_CONFIG) \ + --define-variable=prefix=$(FFMPEG_PREFIX) --static + ++CFLAGS += -I${FFMPEG_PREFIX}/include ++LDFLAGS += ${FFMPEG_LIBDIR}/libavfilter.a ++LDFLAGS += ${FFMPEG_LIBDIR}/libswresample.a ++LDFLAGS += ${FFMPEG_LIBDIR}/libavresample.a ++LDFLAGS += ${FFMPEG_LIBDIR}/libswscale.a ++LDFLAGS += ${FFMPEG_LIBDIR}/libavformat.a ++LDFLAGS += ${FFMPEG_LIBDIR}/libavcodec.a ++LDFLAGS += ${FFMPEG_LIBDIR}/libavutil.a ++ + ifeq ($(CONFIG_LIBX264_STATIC),yes) + FFMPEG_DEPS += libx264 ++LDFLAGS += ${FFMPEG_LIBDIR}/libx264.a + endif + + ifeq ($(CONFIG_LIBX265_STATIC),yes) + FFMPEG_DEPS += libx265 ++LDFLAGS += ${FFMPEG_LIBDIR}/libx265.a + endif + + ifeq ($(CONFIG_LIBVPX_STATIC),yes) + FFMPEG_DEPS += libvpx ++LDFLAGS += ${FFMPEG_LIBDIR}/libvpx.a + endif + + ifeq ($(CONFIG_LIBOGG_STATIC),yes) + FFMPEG_DEPS += libogg ++LDFLAGS += ${FFMPEG_LIBDIR}/libogg.a + endif + + ifeq ($(CONFIG_LIBTHEORA_STATIC),yes) + FFMPEG_DEPS += libtheoraenc libtheoradec libtheora ++LDFLAGS += ${FFMPEG_LIBDIR}/libtheora.a ++LDFLAGS += ${FFMPEG_LIBDIR}/libtheoradec.a ++LDFLAGS += ${FFMPEG_LIBDIR}/libtheoraenc.a + endif + + ifeq ($(CONFIG_LIBVORBIS_STATIC),yes) + FFMPEG_DEPS += libvorbisfile libvorbisenc libvorbis ++LDFLAGS += ${FFMPEG_LIBDIR}/libvorbis.a ++LDFLAGS += ${FFMPEG_LIBDIR}/libvorbisenc.a ++LDFLAGS += ${FFMPEG_LIBDIR}/libvorbisfile.a + endif + + ifeq ($(CONFIG_LIBFDKAAC_STATIC),yes) + FFMPEG_DEPS += libfdk-aac ++LDFLAGS += ${FFMPEG_LIBDIR}/libfdk-aac.a + endif + + ifeq ($(CONFIG_LIBMFX_STATIC),yes) + FFMPEG_DEPS += libmfx ++LDFLAGS += ${FFMPEG_LIBDIR}/libmfx.a + endif + +-LDFLAGS += $(foreach lib,$(FFMPEG_LIBS),$(FFMPEG_LIBDIR)/$(lib).a) +-LDFLAGS += $(foreach lib,$(FFMPEG_DEPS),$(FFMPEG_LIBDIR)/$(lib).a) +- + else # !FFMPEG_STATIC + + FFMPEG_CONFIG := $(PKG_CONFIG) + + endif # FFMPEG_STATIC + +-CFLAGS += `$(FFMPEG_CONFIG) --cflags $(FFMPEG_LIBS)` +-LDFLAGS += `$(FFMPEG_CONFIG) --libs $(FFMPEG_LIBS)` +- + endif + + # LIBAV ######################################################################## +@@ -606,7 +606,7 @@ + + # Binary + ${PROG}: .config.mk make_webui $(OBJS) +- $(pCC) -o $@ $(OBJS) $(CFLAGS) $(LDFLAGS) ++ $(CXX) -o $@ $(OBJS) $(CFLAGS) $(LDFLAGS) + + # Object + ${BUILDDIR}/%.o: %.c diff --git a/packages/addons/service/tvheadend42/patches/tvheadend42-02_makefile_ffmpeg.patch b/packages/addons/service/tvheadend42/patches/tvheadend42-02_makefile_ffmpeg.patch new file mode 100644 index 00000000000..1f4db67b52b --- /dev/null +++ b/packages/addons/service/tvheadend42/patches/tvheadend42-02_makefile_ffmpeg.patch @@ -0,0 +1,82 @@ +From: Team LibreELEC - https://LibreELEC.tv +Subject: adjust Tvheadend ffmpeg build to work with LibreELEC (transcoding) 06.04.2016 + +--- + +diff --git a/Makefile.ffmpeg b/Makefile.ffmpeg +--- a/Makefile.ffmpeg ++++ b/Makefile.ffmpeg +@@ -24,6 +24,9 @@ + FFMPEG_TARGET := x86-linux-gcc + endif + ++FFMPEG_HOST := $(ARCH)-libreelec-linux-gnu ++FFMPEG_TARGET := $(ARCH)-libreelec-linux-gnu ++ + unexport CFLAGS + unexport LDFLAGS + +@@ -135,7 +141,7 @@ + + $(LIB_ROOT)/$(YASM)/.tvh_build: \ + $(LIB_ROOT)/$(YASM)/.tvh_download +- cd $(LIB_ROOT)/$(YASM) && $(CONFIGURE) ++ cd $(LIB_ROOT)/$(YASM) && $(CONFIGURE) CC=$(HOST_CC) + DESTDIR=$(EBUILDIR) \ + $(MAKE) -C $(LIB_ROOT)/$(YASM) install + @touch $@ +@@ -224,6 +226,7 @@ + cd $(LIB_ROOT)/$(LIBX265)/build/linux && cmake -G "Unix Makefiles" \ + -DCMAKE_INSTALL_PREFIX="/ffmpeg" \ + -DENABLE_SHARED:BOOL=OFF \ ++ -DEXTRA_LINK_FLAGS="-ldl" \ + ../../source + DESTDIR=$(EBUILDIR) \ + $(MAKE) -C $(LIB_ROOT)/$(LIBX265)/build/linux install +@@ -257,7 +260,7 @@ + ifeq (yes,$(CONFIG_LIBVPX_STATIC)) + + ifneq (,$(FFMPEG_TARGET)) +-LIBVPX_TARGET := --target=$(FFMPEG_TARGET) ++LIBVPX_TARGET := --target=generic-gnu + endif + + $(LIB_ROOT)/$(LIBVPX)/.tvh_download: +@@ -268,7 +271,7 @@ + $(LIB_ROOT)/$(LIBVPX)/.tvh_build: \ + $(LIB_ROOT)/$(YASM)/.tvh_build \ + $(LIB_ROOT)/$(LIBVPX)/.tvh_download +- cd $(LIB_ROOT)/$(LIBVPX) && $(CONFIGURE) \ ++ cd $(LIB_ROOT)/$(LIBVPX) && CROSS=$(FFMPEG_TARGET)- $(CONFIGURE) \ + --disable-examples \ + --disable-docs \ + --disable-unit-tests \ +@@ -342,7 +345,8 @@ + $(LIB_ROOT)/$(LIBOGG)/.tvh_build \ + $(LIB_ROOT)/$(LIBTHEORA)/.tvh_download + cd $(LIB_ROOT)/$(LIBTHEORA) && $(CONFIGURE) \ +- --with-ogg=$(EPREFIX) \ ++ OGG_CFLAGS=-I$(EPREFIX)/include \ ++ OGG_LIBS=-L$(EPREFIX)/lib \ + --disable-examples \ + $(LIBTHEORA_HOST) + DESTDIR=$(EBUILDIR) \ +@@ -387,7 +391,8 @@ + $(LIB_ROOT)/$(LIBOGG)/.tvh_build \ + $(LIB_ROOT)/$(LIBVORBIS)/.tvh_download + cd $(LIB_ROOT)/$(LIBVORBIS) && $(CONFIGURE) \ +- --with-ogg=$(EPREFIX) ++ OGG_CFLAGS=-I$(EPREFIX)/include \ ++ OGG_LIBS=-L$(EPREFIX)/lib + DESTDIR=$(EBUILDIR) \ + $(MAKE) -C $(LIB_ROOT)/$(LIBVORBIS) install + @touch $@ +@@ -538,6 +543,8 @@ + $(LIB_ROOT)/$(LIBMFX)/.tvh_build \ + $(LIB_ROOT)/$(FFMPEG)/.tvh_download + cd $(LIB_ROOT)/$(FFMPEG) && $(CONFIGURE) \ ++ --cc=$(FFMPEG_HOST)-gcc \ ++ --cxx=$(FFMPEG_HOST)-g++ \ + --disable-all \ + --enable-gpl \ + --extra-cflags="$(ECFLAGS)" \ diff --git a/packages/addons/service/tvheadend42/source/bin/tv_grab_file b/packages/addons/service/tvheadend42/source/bin/tv_grab_file new file mode 100755 index 00000000000..906d3a66ef3 --- /dev/null +++ b/packages/addons/service/tvheadend42/source/bin/tv_grab_file @@ -0,0 +1,69 @@ +#!/bin/sh + +################################################################################ +# This file is part of LibreELEC - https://LibreELEC.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +if [ $# -lt 1 ] +then + . /etc/profile + + ADDON_HOME="$HOME/.kodi/userdata/addon_data/service.tvheadend42" + ADDON_SETTINGS="$ADDON_HOME/settings.xml" + XMLTV_TYPE=`grep XMLTV_TYPE $ADDON_SETTINGS | awk '{print $3 }' | sed -e "s,value=,," -e "s,\",,g"` + XMLTV_LOCATION_FILE=`grep XMLTV_LOCATION_FILE $ADDON_SETTINGS | awk '{print $3 }' | sed -e "s,value=,," -e "s,\",,g"` + XMLTV_LOCATION_WEB=`grep XMLTV_LOCATION_WEB $ADDON_SETTINGS | awk '{print $3 }' | sed -e "s,value=,," -e "s,\",,g"` + XMLTV_LOCATION_SCRIPT=`grep XMLTV_LOCATION_SCRIPT $ADDON_SETTINGS | awk '{print $3 }' | sed -e "s,value=,," -e "s,\",,g"` + + if [ "$XMLTV_TYPE" = "FILE" ]; then + cat "$XMLTV_LOCATION_FILE" + exit 0 + elif [ "$XMLTV_TYPE" = "SCRIPT" ]; then + if [ -e "$XMLTV_LOCATION_SCRIPT" ] ; then + exec "$XMLTV_LOCATION_SCRIPT" + fi + elif [ "$XMLTV_TYPE" = "WEB" ]; then + wget -qO - "$XMLTV_LOCATION_WEB" + exit 0 + fi +fi + +dflag= +vflag= +cflag= + +for a in "$@" +do + [ "$a" = "-d" -o "$a" = "--description" ] && dflag=1 + [ "$a" = "-v" -o "$a" = "--version" ] && vflag=1 + [ "$a" = "-c" -o "$a" = "--capabilities" ] && cflag=1 +done + +if [ -n "$dflag" ] +then + echo "tv_grab_file is a simple grabber that can be configured through the addon settings from Kodi" +fi + +if [ -n "$vflag" ] +then + echo "1.0" +fi + +if [ -n "$cflag" ] +then + echo "baseline" +fi diff --git a/packages/addons/service/tvheadend42/source/bin/tvheadend42.start b/packages/addons/service/tvheadend42/source/bin/tvheadend42.start new file mode 100755 index 00000000000..5a5067c04b5 --- /dev/null +++ b/packages/addons/service/tvheadend42/source/bin/tvheadend42.start @@ -0,0 +1,107 @@ +#!/bin/sh + +################################################################################ +# This file is part of LibreELEC - https://LibreELEC.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +. /etc/profile + +oe_setup_addon service.tvheadend42 + +ADDON_SETTINGS="$ADDON_HOME/settings.xml" + +DVR_SETTINGS_DIR="$ADDON_HOME/dvr/config" +DVR_SETTINGS_FILE="$DVR_SETTINGS_DIR/8d0f5b7ae354d956d7fe5db25f5d0d24" + +EPGGRAB_SETTINGS_DIR="$ADDON_HOME/epggrab" +EPGGRAB_SETTINGS_FILE="$EPGGRAB_SETTINGS_DIR/config" + +TIMESHIFT_SETTINGS_DIR="$ADDON_HOME/timeshift" +TIMESHIFT_SETTINGS_FILE="$TIMESHIFT_SETTINGS_DIR/config" + +TVH_SETTINGS_DIR="$ADDON_HOME" +TVH_SETTINGS_FILE="$TVH_SETTINGS_DIR/config" + +XMLTV_SETTINGS_DIR="$ADDON_HOME/xmltv" +XMLTV_SETTINGS_FILE="$XMLTV_SETTINGS_DIR/config" + +TIMESHIFT_DIR="$ADDON_HOME/cache/timeshift" +XMLTV_FILE="$ADDON_DIR/bin/tv_grab_file" + +chmod a+x $ADDON_DIR/bin/* + +# copy config files to userdata +if [ ! -f "$DVR_SETTINGS_FILE" ]; then + mkdir -p $DVR_SETTINGS_DIR + cp $ADDON_DIR/defaults/dvr/config/8d0f5b7ae354d956d7fe5db25f5d0d24 $DVR_SETTINGS_FILE +fi + +if [ ! -f "$EPGGRAB_SETTINGS_FILE" ]; then + mkdir -p $EPGGRAB_SETTINGS_DIR + cp $ADDON_DIR/defaults/epggrab/config $EPGGRAB_SETTINGS_FILE +fi + +if [ ! -f "$TIMESHIFT_SETTINGS_FILE" ]; then + mkdir -p $TIMESHIFT_DIR + mkdir -p $TIMESHIFT_SETTINGS_DIR + cp $ADDON_DIR/defaults/timeshift/config $TIMESHIFT_SETTINGS_FILE +fi + +if [ ! -f "$TVH_SETTINGS_FILE" ]; then + mkdir -p $TVH_SETTINGS_DIR + cp $ADDON_DIR/defaults/config $TVH_SETTINGS_FILE +fi + +if [ ! -f "$XMLTV_SETTINGS_FILE" ]; then + mkdir -p $XMLTV_SETTINGS_DIR + cp $ADDON_DIR/defaults/xmltv/config $XMLTV_SETTINGS_FILE +fi + +# options +if [ "$WORKAROUND_SLEEP" == "true" ] ; then + sleep $WORKAROUND_SLEEP_TIME +fi + +if [ "$DEBUG" = "yes" ]; then + TVHEADEND_ARG="-B -C -s -u root -g video -c $ADDON_HOME" +else + TVHEADEND_ARG="-B -C -u root -g video -c $ADDON_HOME" +fi + +# start userspace DVB driver/addon +for driver_dvb in $(find /storage/.kodi/addons/driver.dvb.*/bin/userspace-driver.sh -type f 2>/dev/null); do + driver_dvb_name=$(echo $driver_dvb | awk 'BEGIN {FS="/"} {printf("%s", $5)}') + logger -t Tvheadend "### Loading userspace DVB driver: $driver_dvb_name ###" + # use ". " because of variable export + . $driver_dvb +done + +if [ "$WAIT_FOR_FEINIT" == "true" ] ; then + while [ true ] ; do + if [ -e /dev/dvb/adapter$((NUM_ADAPTERS-1))/frontend0 ] ; then + break + fi + sleep 1 + done +fi + +if [ "$PRELOAD_CAPMT_CA" == "true" ] ; then + logger -t Tvheadend "### Preloading capmt_ca.so library ###" + LD_PRELOAD="$ADDON_DIR/bin/capmt_ca.so $LD_PRELOAD" exec $ADDON_DIR/bin/tvheadend $TVHEADEND_ARG &>$ADDON_LOG_FILE +else + exec $ADDON_DIR/bin/tvheadend $TVHEADEND_ARG &>$ADDON_LOG_FILE +fi diff --git a/packages/addons/service/tvheadend42/source/default.py b/packages/addons/service/tvheadend42/source/default.py new file mode 100644 index 00000000000..c6dfcce9f2c --- /dev/null +++ b/packages/addons/service/tvheadend42/source/default.py @@ -0,0 +1,17 @@ +################################################################################ +# This file is part of LibreELEC - https://LibreELEC.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ diff --git a/packages/addons/service/tvheadend42/source/defaults/config b/packages/addons/service/tvheadend42/source/defaults/config new file mode 100644 index 00000000000..4d6fa4c747a --- /dev/null +++ b/packages/addons/service/tvheadend42/source/defaults/config @@ -0,0 +1,12 @@ +{ + "uilevel": 1, + "uilevel_nochange": false, + "ui_quicktips": true, + "cookie_expires": 14, + "epg_compress": true, + "prefer_picon": true, + "chiconpath": "file:///storage/picons/tvh/%C.png", + "chiconscheme": 2, + "piconpath": "file:///storage/picons/vdr/", + "piconscheme": 1 +} diff --git a/packages/addons/service/tvheadend42/source/defaults/dvr/config/8d0f5b7ae354d956d7fe5db25f5d0d24 b/packages/addons/service/tvheadend42/source/defaults/dvr/config/8d0f5b7ae354d956d7fe5db25f5d0d24 new file mode 100644 index 00000000000..26b820aaa4a --- /dev/null +++ b/packages/addons/service/tvheadend42/source/defaults/dvr/config/8d0f5b7ae354d956d7fe5db25f5d0d24 @@ -0,0 +1,15 @@ +{ + "storage": "/storage/recordings", + "retention-days": 31, + "pre-extra-time": 0, + "post-extra-time": 0, + "day-dir": 0, + "channel-dir": 0, + "channel-in-title": 0, + "date-in-title": 0, + "time-in-title": 0, + "whitespace-in-title": 0, + "title-dir": 0, + "episode-in-title": 0, + "tag-files": 1 +} diff --git a/packages/addons/service/tvheadend42/source/defaults/epggrab/config b/packages/addons/service/tvheadend42/source/defaults/epggrab/config new file mode 100644 index 00000000000..35c5f70d5e5 --- /dev/null +++ b/packages/addons/service/tvheadend42/source/defaults/epggrab/config @@ -0,0 +1,16 @@ +{ + "channel_rename": true, + "channel_renumber": false, + "channel_reicon": false, + "epgdb_periodicsave": 2, + "ota_initial": true, + "modules": { + "eit": { + "class": "epggrab_mod_ota", + "name": "EIT: DVB Grabber", + "type": "Over-the-air", + "enabled": true, + "priority": 1 + } + } +} diff --git a/packages/addons/service/tvheadend42/source/defaults/timeshift/config b/packages/addons/service/tvheadend42/source/defaults/timeshift/config new file mode 100644 index 00000000000..1ac8f3f1168 --- /dev/null +++ b/packages/addons/service/tvheadend42/source/defaults/timeshift/config @@ -0,0 +1,9 @@ +{ + "enabled": 0, + "ondemand": 0, + "path": "/storage/.kodi/userdata/addon_data/service.tvheadend42/cache/timeshift", + "unlimited_period": 0, + "max_period": 3600, + "unlimited_size": 0, + "max_size": 3072 +} diff --git a/packages/addons/service/tvheadend42/source/defaults/xmltv/config b/packages/addons/service/tvheadend42/source/defaults/xmltv/config new file mode 100644 index 00000000000..8093bd35314 --- /dev/null +++ b/packages/addons/service/tvheadend42/source/defaults/xmltv/config @@ -0,0 +1,14 @@ +{ + "grabbers": [ + { + "path": "/storage/.kodi/addons/service.tvheadend42/bin/tv_grab_file", + "description": "tv_grag_file is a simple grabber that just read the ~/.xmltv/tv_grab_file.xmltv file", + "version": "0.1\n", + "mtime": 1318774706, + "capabilities": 1 + } + ], + "grab-interval": 12, + "grab-enabled": 1, + "current-grabber": "/storage/.kodi/addons/service.tvheadend42/bin/tv_grab_file" +} diff --git a/packages/addons/service/tvheadend42/source/resources/language/English/strings.xml b/packages/addons/service/tvheadend42/source/resources/language/English/strings.xml new file mode 100644 index 00000000000..fc94d15dfd6 --- /dev/null +++ b/packages/addons/service/tvheadend42/source/resources/language/English/strings.xml @@ -0,0 +1,18 @@ + + + + XMLTV + DVB + XMLTV configuration + XMLTV source type + XMLTV File location + XMLTV Web location + XMLTV Script location + DVB Configuration + Unload DVB mudules before suspend + Wait for frontend initialization + Number of adapters to wait for + Preload capmt_ca.so library + Delay the start of Tvheadend + time (s) + diff --git a/packages/addons/service/tvheadend42/source/resources/settings.xml b/packages/addons/service/tvheadend42/source/resources/settings.xml new file mode 100644 index 00000000000..6f6ddc37b49 --- /dev/null +++ b/packages/addons/service/tvheadend42/source/resources/settings.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/addons/service/tvheadend42/source/settings-default.xml b/packages/addons/service/tvheadend42/source/settings-default.xml new file mode 100644 index 00000000000..0f47b8e2321 --- /dev/null +++ b/packages/addons/service/tvheadend42/source/settings-default.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/packages/addons/service/tvheadend42/source/sleep.d/tvheadend.power b/packages/addons/service/tvheadend42/source/sleep.d/tvheadend.power new file mode 100755 index 00000000000..ca66f083ffa --- /dev/null +++ b/packages/addons/service/tvheadend42/source/sleep.d/tvheadend.power @@ -0,0 +1,44 @@ +#!/bin/sh + +################################################################################ +# This file is part of LibreELEC - https://LibreELEC.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +. /etc/profile + +oe_setup_addon service.tvheadend42 + +SERVICE="service.tvheadend42" + +case "$1" in + pre) + if systemctl is-active "$SERVICE" &>/dev/null ; then + systemctl stop "$SERVICE" + for module in $REMOVE_MODULES ; do + rmmod $module + done + fi + ;; + post) + if systemctl is-enabled "$SERVICE" &>/dev/null ; then + for module in $REMOVE_MODULES ; do + modprobe $module + done + systemctl start "$SERVICE" + fi + ;; +esac diff --git a/packages/addons/service/tvheadend42/source/system.d/service.tvheadend42.service b/packages/addons/service/tvheadend42/source/system.d/service.tvheadend42.service new file mode 100644 index 00000000000..e92c783ee80 --- /dev/null +++ b/packages/addons/service/tvheadend42/source/system.d/service.tvheadend42.service @@ -0,0 +1,14 @@ +[Unit] +Description=TVHeadend42 Service +After=network-online.service +Requires=network-online.service + +[Service] +ExecStart=/bin/sh -c "exec sh /storage/.kodi/addons/service.tvheadend42/bin/tvheadend42.start" +TimeoutStopSec=2 +Restart=always +RestartSec=2 +StartLimitInterval=0 + +[Install] +WantedBy=kodi.target diff --git a/packages/addons/service/vdr-addon/changelog.txt b/packages/addons/service/vdr-addon/changelog.txt new file mode 100644 index 00000000000..750a04886d6 --- /dev/null +++ b/packages/addons/service/vdr-addon/changelog.txt @@ -0,0 +1,8 @@ +8.0.100 +- Update for LibreELEC 8.0 + +7.0.101 +- added proper icon and description + +7.0.100 +- initial LibreELEC version \ No newline at end of file diff --git a/packages/addons/service/vdr-addon/icon/icon.png b/packages/addons/service/vdr-addon/icon/icon.png new file mode 100644 index 00000000000..51a0aaceba8 Binary files /dev/null and b/packages/addons/service/vdr-addon/icon/icon.png differ diff --git a/packages/addons/service/multimedia/vdr-addon/package.mk b/packages/addons/service/vdr-addon/package.mk similarity index 77% rename from packages/addons/service/multimedia/vdr-addon/package.mk rename to packages/addons/service/vdr-addon/package.mk index 5fd8dc5e253..ad865529818 100644 --- a/packages/addons/service/multimedia/vdr-addon/package.mk +++ b/packages/addons/service/vdr-addon/package.mk @@ -19,23 +19,23 @@ PKG_NAME="vdr-addon" PKG_VERSION="7.0" -PKG_REV="2" +PKG_REV="100" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.openelec.tv" PKG_URL="" -PKG_DEPENDS_TARGET="toolchain attr libcap vdr vdr-plugin-vnsiserver vdr-iptv vdr-wirbelscan vdr-wirbelscancontrol vdr-plugin-dvbapi vdr-plugin-streamdev vdr-live vdr-epgsearch vdr-plugin-xmltv2vdr vdr-plugin-eepg vdr-dummydevice vdr-satip vdr-plugin-epgfixer vdr-plugin-restfulapi" +PKG_DEPENDS_TARGET="toolchain vdr vdr-plugin-dummydevice vdr-plugin-dvbapi vdr-plugin-eepg vdr-plugin-epgfixer vdr-plugin-epgsearch vdr-plugin-iptv vdr-plugin-live vdr-plugin-restfulapi vdr-plugin-satip vdr-plugin-streamdev vdr-plugin-vnsiserver vdr-plugin-wirbelscan vdr-plugin-wirbelscancontrol vdr-plugin-xmltv2vdr" PKG_PRIORITY="optional" PKG_SECTION="service.multimedia" -PKG_SHORTDESC="vdr: A powerful DVB TV application" -PKG_LONGDESC="This project describes how to build your own digital satellite receiver and video disk recorder. It is based mainly on the DVB-S digital satellite receiver card, which used to be available from Fujitsu Siemens and the driver software developed by the LinuxTV project." -PKG_AUTORECONF="no" +PKG_SHORTDESC="VDR: a TV streaming server for Linux" +PKG_LONGDESC="VDR(2.2.0) is a TV streaming server for Linux supporting DVB-S/S2, DVB-C, DVB-T/T2, IPTV and SAT>IP" + PKG_IS_ADDON="yes" +PKG_ADDON_NAME="VDR PVR Backend" PKG_ADDON_TYPE="xbmc.service" -PKG_ADDON_PROVIDES="" +PKG_AUTORECONF="no" +PKG_ADDON_REPOVERSION="8.0" PKG_ADDON_REQUIRES="pvr.vdr.vnsi:0.0.0 script.config.vdr:0.0.0" -PKG_ADDON_NAME="VDR PVR Backend" -PKG_ADDON_REPOVERSION="7.0" make_target() { : # nothing to do here @@ -47,7 +47,7 @@ makeinstall_target() { addon() { VDR_DIR="$(get_build_dir vdr)" - VDR_LIVE_DIR="$(get_build_dir vdr-live)" + VDR_PLUGIN_LIVE_DIR="$(get_build_dir vdr-plugin-live)" VDR_PLUGIN_VNSISERVER_DIR="$(get_build_dir vdr-plugin-vnsiserver)" VDR_PLUGIN_STREAMVEV_DIR="$(get_build_dir vdr-plugin-streamdev)" VDR_PLUGIN_XMLTV2VDR="$(get_build_dir vdr-plugin-xmltv2vdr)" @@ -66,7 +66,7 @@ addon() { mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/config/plugins/epgsearch mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/res/plugins/live - cp -PR $VDR_LIVE_DIR/live/* $ADDON_BUILD/$PKG_ADDON_ID/res/plugins/live + cp -PR $VDR_PLUGIN_LIVE_DIR/live/* $ADDON_BUILD/$PKG_ADDON_ID/res/plugins/live mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/config/plugins @@ -75,18 +75,18 @@ addon() { mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/plugin cp -PR $VDR_PLUGIN_VNSISERVER_DIR/libvdr*.so.* $ADDON_BUILD/$PKG_ADDON_ID/plugin - cp -PR $(get_build_dir vdr-iptv)/libvdr*.so.* $ADDON_BUILD/$PKG_ADDON_ID/plugin - cp -PR $(get_build_dir vdr-wirbelscan)/libvdr*.so.* $ADDON_BUILD/$PKG_ADDON_ID/plugin - cp -PR $(get_build_dir vdr-wirbelscancontrol)/libvdr*.so.* $ADDON_BUILD/$PKG_ADDON_ID/plugin + cp -PR $(get_build_dir vdr-plugin-iptv)/libvdr*.so.* $ADDON_BUILD/$PKG_ADDON_ID/plugin + cp -PR $(get_build_dir vdr-plugin-wirbelscan)/libvdr*.so.* $ADDON_BUILD/$PKG_ADDON_ID/plugin + cp -PR $(get_build_dir vdr-plugin-wirbelscancontrol)/libvdr*.so.* $ADDON_BUILD/$PKG_ADDON_ID/plugin cp -PR $(get_build_dir vdr-plugin-dvbapi)/libvdr*.so.* $ADDON_BUILD/$PKG_ADDON_ID/plugin cp -PR $(get_build_dir vdr-plugin-eepg)/libvdr*.so.* $ADDON_BUILD/$PKG_ADDON_ID/plugin cp -PR $VDR_PLUGIN_STREAMVEV_DIR/server/libvdr*.so.* $ADDON_BUILD/$PKG_ADDON_ID/plugin cp -PR $VDR_PLUGIN_STREAMVEV_DIR/client/libvdr*.so.* $ADDON_BUILD/$PKG_ADDON_ID/plugin - cp -PR $VDR_LIVE_DIR/libvdr*.so.* $ADDON_BUILD/$PKG_ADDON_ID/plugin - cp -PR $(get_build_dir vdr-epgsearch)/libvdr*.so.* $ADDON_BUILD/$PKG_ADDON_ID/plugin + cp -PR $VDR_PLUGIN_LIVE_DIR/libvdr*.so.* $ADDON_BUILD/$PKG_ADDON_ID/plugin + cp -PR $(get_build_dir vdr-plugin-epgsearch)/libvdr*.so.* $ADDON_BUILD/$PKG_ADDON_ID/plugin cp -PR $VDR_PLUGIN_XMLTV2VDR/libvdr*.so.* $ADDON_BUILD/$PKG_ADDON_ID/plugin - cp -PR $(get_build_dir vdr-dummydevice)/libvdr*.so.* $ADDON_BUILD/$PKG_ADDON_ID/plugin - cp -PR $(get_build_dir vdr-satip)/libvdr*.so.* $ADDON_BUILD/$PKG_ADDON_ID/plugin + cp -PR $(get_build_dir vdr-plugin-dummydevice)/libvdr*.so.* $ADDON_BUILD/$PKG_ADDON_ID/plugin + cp -PR $(get_build_dir vdr-plugin-satip)/libvdr*.so.* $ADDON_BUILD/$PKG_ADDON_ID/plugin cp -PR $VDR_PLUGIN_EPGFIXER_DIR/libvdr*.so.* $ADDON_BUILD/$PKG_ADDON_ID/plugin cp -PR $VDR_PLUGIN_RESTFULAPI_DIR/libvdr*.so.* $ADDON_BUILD/$PKG_ADDON_ID/plugin diff --git a/packages/addons/service/multimedia/vdr-addon/source/bin/vdr.start b/packages/addons/service/vdr-addon/source/bin/vdr.start similarity index 100% rename from packages/addons/service/multimedia/vdr-addon/source/bin/vdr.start rename to packages/addons/service/vdr-addon/source/bin/vdr.start diff --git a/packages/addons/service/multimedia/vdr-addon/source/default.py b/packages/addons/service/vdr-addon/source/default.py similarity index 100% rename from packages/addons/service/multimedia/vdr-addon/source/default.py rename to packages/addons/service/vdr-addon/source/default.py diff --git a/packages/addons/service/multimedia/vdr-addon/source/resources/language/English/strings.xml b/packages/addons/service/vdr-addon/source/resources/language/English/strings.xml similarity index 100% rename from packages/addons/service/multimedia/vdr-addon/source/resources/language/English/strings.xml rename to packages/addons/service/vdr-addon/source/resources/language/English/strings.xml diff --git a/packages/addons/service/multimedia/vdr-addon/source/resources/settings.xml b/packages/addons/service/vdr-addon/source/resources/settings.xml similarity index 100% rename from packages/addons/service/multimedia/vdr-addon/source/resources/settings.xml rename to packages/addons/service/vdr-addon/source/resources/settings.xml diff --git a/packages/addons/service/multimedia/vdr-addon/source/settings-default.xml b/packages/addons/service/vdr-addon/source/settings-default.xml similarity index 100% rename from packages/addons/service/multimedia/vdr-addon/source/settings-default.xml rename to packages/addons/service/vdr-addon/source/settings-default.xml diff --git a/packages/addons/service/multimedia/vdr-addon/source/sleep.d/vdr.power b/packages/addons/service/vdr-addon/source/sleep.d/vdr.power similarity index 100% rename from packages/addons/service/multimedia/vdr-addon/source/sleep.d/vdr.power rename to packages/addons/service/vdr-addon/source/sleep.d/vdr.power diff --git a/packages/addons/service/multimedia/vdr-addon/source/system.d/service.multimedia.vdr-addon.service b/packages/addons/service/vdr-addon/source/system.d/service.multimedia.vdr-addon.service similarity index 100% rename from packages/addons/service/multimedia/vdr-addon/source/system.d/service.multimedia.vdr-addon.service rename to packages/addons/service/vdr-addon/source/system.d/service.multimedia.vdr-addon.service diff --git a/packages/addons/tools/dvb-tools/changelog.txt b/packages/addons/tools/dvb-tools/changelog.txt new file mode 100644 index 00000000000..f6abfd17470 --- /dev/null +++ b/packages/addons/tools/dvb-tools/changelog.txt @@ -0,0 +1,2 @@ +8.0.100 +- Initial Release diff --git a/packages/addons/tools/dvb-tools/icon/icon.png b/packages/addons/tools/dvb-tools/icon/icon.png new file mode 100644 index 00000000000..00401cefd85 Binary files /dev/null and b/packages/addons/tools/dvb-tools/icon/icon.png differ diff --git a/packages/addons/tools/dvb-tools/package.mk b/packages/addons/tools/dvb-tools/package.mk new file mode 100644 index 00000000000..f81b70cecf7 --- /dev/null +++ b/packages/addons/tools/dvb-tools/package.mk @@ -0,0 +1,69 @@ +################################################################################ +# This file is part of LibreELEC - http://www.libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +PKG_NAME="dvb-tools" +PKG_VERSION="" +PKG_REV="100" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="" +PKG_URL="" +PKG_DEPENDS_TARGET="toolchain" +PKG_PRIORITY="optional" +PKG_SECTION="virtual" +PKG_SHORTDESC="A bundle of dvb tools and programs" +PKG_LONGDESC="This bundle currently includes dvb-apps, dvb-fe-tool and dvblast." + +PKG_IS_ADDON="yes" +PKG_ADDON_NAME="DVB Tools" +PKG_ADDON_TYPE="xbmc.python.script" +PKG_ADDON_PROVIDES="" +PKG_ADDON_REPOVERSION="8.0" + +PKG_AUTORECONF="no" + +PKG_DEPENDS_TARGET="toolchain \ + dvb-apps \ + dvb-fe-tool \ + dvblast" + +addon() { + mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/lib/ + + mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/bin/ + # dvb-apps + cp -P $(get_build_dir dvb-apps)/util/dvbdate/dvbdate $ADDON_BUILD/$PKG_ADDON_ID/bin + cp -P $(get_build_dir dvb-apps)/util/dvbnet/dvbnet $ADDON_BUILD/$PKG_ADDON_ID/bin + cp -P $(get_build_dir dvb-apps)/util/dvbscan/dvbscan $ADDON_BUILD/$PKG_ADDON_ID/bin + cp -P $(get_build_dir dvb-apps)/util/dvbtraffic/dvbtraffic $ADDON_BUILD/$PKG_ADDON_ID/bin + cp -P $(get_build_dir dvb-apps)/util/femon/femon $ADDON_BUILD/$PKG_ADDON_ID/bin + cp -P $(get_build_dir dvb-apps)/util/scan/scan $ADDON_BUILD/$PKG_ADDON_ID/bin + cp -P $(get_build_dir dvb-apps)/util/szap/azap $ADDON_BUILD/$PKG_ADDON_ID/bin + cp -P $(get_build_dir dvb-apps)/util/szap/czap $ADDON_BUILD/$PKG_ADDON_ID/bin + cp -P $(get_build_dir dvb-apps)/util/szap/szap $ADDON_BUILD/$PKG_ADDON_ID/bin + cp -P $(get_build_dir dvb-apps)/util/szap/tzap $ADDON_BUILD/$PKG_ADDON_ID/bin + cp -P $(get_build_dir dvb-apps)/util/zap/zap $ADDON_BUILD/$PKG_ADDON_ID/bin + + # dvb-de-tool + cp -P $(get_build_dir dvb-fe-tool)/.$TARGET_NAME/utils/dvb/dvb-fe-tool $ADDON_BUILD/$PKG_ADDON_ID/bin + + # dvblast + cp -P $(get_build_dir dvblast)/dvblast $ADDON_BUILD/$PKG_ADDON_ID/bin + + debug_strip $ADDON_BUILD/$PKG_ADDON_ID/bin +} diff --git a/packages/addons/tools/dvb-tools/source/default.py b/packages/addons/tools/dvb-tools/source/default.py new file mode 100644 index 00000000000..67e12970fe8 --- /dev/null +++ b/packages/addons/tools/dvb-tools/source/default.py @@ -0,0 +1,22 @@ +################################################################################ +# This file is part of LibreELEC - http://www.libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +import xbmcgui + +dialog = xbmcgui.Dialog() +dialog.ok('', 'This is a console-only addon') diff --git a/packages/addons/tools/multimedia-tools/changelog.txt b/packages/addons/tools/multimedia-tools/changelog.txt new file mode 100644 index 00000000000..bf11a262476 --- /dev/null +++ b/packages/addons/tools/multimedia-tools/changelog.txt @@ -0,0 +1,5 @@ +8.0.101 +- Add mpg123 and squeezelite + +8.0.100 +- Initial Release diff --git a/packages/addons/tools/multimedia-tools/icon/icon.png b/packages/addons/tools/multimedia-tools/icon/icon.png new file mode 100644 index 00000000000..86ae5d644de Binary files /dev/null and b/packages/addons/tools/multimedia-tools/icon/icon.png differ diff --git a/packages/addons/tools/multimedia-tools/package.mk b/packages/addons/tools/multimedia-tools/package.mk new file mode 100644 index 00000000000..d5b5a0c1406 --- /dev/null +++ b/packages/addons/tools/multimedia-tools/package.mk @@ -0,0 +1,75 @@ +################################################################################ +# This file is part of LibreELEC - http://www.libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +PKG_NAME="multimedia-tools" +PKG_VERSION="" +PKG_REV="101" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="" +PKG_URL="" +PKG_DEPENDS_TARGET="toolchain" +PKG_PRIORITY="optional" +PKG_SECTION="virtual" +PKG_SHORTDESC="A bundle of multimedia tools and programs" +PKG_LONGDESC="This bundle currently includes mediainfo, mesa-demos, mpg123, opencaster, squeezelite, tsdecrypt and tstools." + +PKG_IS_ADDON="yes" +PKG_ADDON_NAME="Multimedia Tools" +PKG_ADDON_TYPE="xbmc.python.script" +PKG_ADDON_PROVIDES="" +PKG_ADDON_REPOVERSION="8.0" + +PKG_AUTORECONF="no" + +PKG_DEPENDS_TARGET="toolchain \ + mediainfo \ + mesa-demos \ + mpg123 \ + opencaster \ + squeezelite \ + tsdecrypt \ + tstools" + +addon() { + mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/bin/ + # mediainfo + cp -P $(get_build_dir mediainfo)/Project/GNU/CLI/mediainfo $ADDON_BUILD/$PKG_ADDON_ID/bin + + # mesa-demos + cp -P $(get_build_dir mesa-demos)/.$TARGET_NAME/src/xdemos/glxdemo $ADDON_BUILD/$PKG_ADDON_ID/bin 2>/dev/null || : + cp -P $(get_build_dir mesa-demos)/.$TARGET_NAME/src/xdemos/glxgears $ADDON_BUILD/$PKG_ADDON_ID/bin 2>/dev/null || : + cp -P $(get_build_dir mesa-demos)/.$TARGET_NAME/src/xdemos/glxinfo $ADDON_BUILD/$PKG_ADDON_ID/bin 2>/dev/null || : + + # mpg123 + cp -P $(get_build_dir mpg123)/.install_pkg/usr/bin/* $ADDON_BUILD/$PKG_ADDON_ID/bin/ + + # opencaster + cp -P $(get_build_dir opencaster)/.install_pkg/* $ADDON_BUILD/$PKG_ADDON_ID/bin/ + + # squeezelite + cp -P $(get_build_dir squeezelite)/squeezelite $ADDON_BUILD/$PKG_ADDON_ID/bin/ + + # tsdecrypt + cp -P $(get_build_dir tsdecrypt)/tsdecrypt $ADDON_BUILD/$PKG_ADDON_ID/bin + + # tstools + cp -P $(get_build_dir tstools)/bin/* $ADDON_BUILD/$PKG_ADDON_ID/bin/ + + debug_strip $ADDON_BUILD/$PKG_ADDON_ID/bin +} diff --git a/packages/addons/tools/multimedia-tools/source/default.py b/packages/addons/tools/multimedia-tools/source/default.py new file mode 100644 index 00000000000..67e12970fe8 --- /dev/null +++ b/packages/addons/tools/multimedia-tools/source/default.py @@ -0,0 +1,22 @@ +################################################################################ +# This file is part of LibreELEC - http://www.libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +import xbmcgui + +dialog = xbmcgui.Dialog() +dialog.ok('', 'This is a console-only addon') diff --git a/packages/addons/tools/network-tools/changelog.txt b/packages/addons/tools/network-tools/changelog.txt new file mode 100644 index 00000000000..f6abfd17470 --- /dev/null +++ b/packages/addons/tools/network-tools/changelog.txt @@ -0,0 +1,2 @@ +8.0.100 +- Initial Release diff --git a/packages/addons/tools/network-tools/icon/icon.png b/packages/addons/tools/network-tools/icon/icon.png new file mode 100644 index 00000000000..5de6f7bf774 Binary files /dev/null and b/packages/addons/tools/network-tools/icon/icon.png differ diff --git a/packages/addons/tools/network-tools/package.mk b/packages/addons/tools/network-tools/package.mk new file mode 100644 index 00000000000..92adda76174 --- /dev/null +++ b/packages/addons/tools/network-tools/package.mk @@ -0,0 +1,111 @@ +################################################################################ +# This file is part of LibreELEC - http://www.libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +PKG_NAME="network-tools" +PKG_VERSION="" +PKG_REV="100" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="" +PKG_URL="" +PKG_DEPENDS_TARGET="toolchain" +PKG_PRIORITY="optional" +PKG_SECTION="virtual" +PKG_SHORTDESC="A bundle of network tools and programs" +PKG_LONGDESC="This bundle currently includes bwm-ng, iftop, iperf, irssi, iw, lftp, ncftp, ngrep, nmap, rsync, sshfs, tcpdump, udpxy and wireless_tools." + +PKG_IS_ADDON="yes" +PKG_ADDON_NAME="Network Tools" +PKG_ADDON_TYPE="xbmc.python.script" +PKG_ADDON_PROVIDES="" +PKG_ADDON_REPOVERSION="8.0" + +PKG_AUTORECONF="no" + +PKG_DEPENDS_TARGET="toolchain \ + bwm-ng \ + iftop \ + iperf \ + irssi \ + iw \ + lftp \ + ncftp \ + ngrep \ + nmap \ + rsync \ + sshfs \ + tcpdump \ + udpxy \ + wireless_tools" + +addon() { + mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/bin/ + # bwm-ng + cp -P $(get_build_dir bwm-ng)/.$TARGET_NAME/src/bwm-ng $ADDON_BUILD/$PKG_ADDON_ID/bin + + # iftop + cp -P $(get_build_dir iftop)/.$TARGET_NAME/iftop $ADDON_BUILD/$PKG_ADDON_ID/bin + + # iperf + cp -P $(get_build_dir iperf)/.$TARGET_NAME/src/iperf3 $ADDON_BUILD/$PKG_ADDON_ID/bin + ln -s iperf3 $ADDON_BUILD/$PKG_ADDON_ID/bin/iperf + + # irssi + cp -P $(get_build_dir irssi)/.$TARGET_NAME/src/fe-text/irssi $ADDON_BUILD/$PKG_ADDON_ID/bin + + # iw + cp -P $(get_build_dir iw)/iw $ADDON_BUILD/$PKG_ADDON_ID/bin + + # lftp + cp -P $(get_build_dir lftp)/.$TARGET_NAME/src/lftp $ADDON_BUILD/$PKG_ADDON_ID/bin + + # ncftp + cp -P $(get_build_dir ncftp)/.$TARGET_NAME/bin/ncftp $ADDON_BUILD/$PKG_ADDON_ID/bin + cp -P $(get_build_dir ncftp)/.$TARGET_NAME/bin/ncftpbatch $ADDON_BUILD/$PKG_ADDON_ID/bin + cp -P $(get_build_dir ncftp)/.$TARGET_NAME/bin/ncftpget $ADDON_BUILD/$PKG_ADDON_ID/bin + cp -P $(get_build_dir ncftp)/.$TARGET_NAME/bin/ncftpls $ADDON_BUILD/$PKG_ADDON_ID/bin + cp -P $(get_build_dir ncftp)/.$TARGET_NAME/bin/ncftpput $ADDON_BUILD/$PKG_ADDON_ID/bin + + # ngrep + cp -P $(get_build_dir ngrep)/.$TARGET_NAME/ngrep $ADDON_BUILD/$PKG_ADDON_ID/bin + + # nmap + cp -P $(get_build_dir nmap)/nmap $ADDON_BUILD/$PKG_ADDON_ID/bin + + # rsync + cp -P $(get_build_dir rsync)/.$TARGET_NAME/rsync $ADDON_BUILD/$PKG_ADDON_ID/bin + + # sshfs + cp -P $(get_build_dir sshfs)/.$TARGET_NAME/sshfs $ADDON_BUILD/$PKG_ADDON_ID/bin + + # tcpdump + cp -P $(get_build_dir tcpdump)/.$TARGET_NAME/tcpdump $ADDON_BUILD/$PKG_ADDON_ID/bin + + # udpxy + cp -P $(get_build_dir udpxy)/udpxy $ADDON_BUILD/$PKG_ADDON_ID/bin/ + + # wireless_tools + cp -P $(get_build_dir wireless_tools)/iwmulticall $ADDON_BUILD/$PKG_ADDON_ID/bin + ln -s iwmulticall $ADDON_BUILD/$PKG_ADDON_ID/bin/iwconfig + ln -s iwmulticall $ADDON_BUILD/$PKG_ADDON_ID/bin/iwgetid + ln -s iwmulticall $ADDON_BUILD/$PKG_ADDON_ID/bin/iwlist + ln -s iwmulticall $ADDON_BUILD/$PKG_ADDON_ID/bin/iwspy + ln -s iwmulticall $ADDON_BUILD/$PKG_ADDON_ID/bin/iwpriv + + debug_strip $ADDON_BUILD/$PKG_ADDON_ID/bin +} diff --git a/packages/addons/tools/network-tools/source/default.py b/packages/addons/tools/network-tools/source/default.py new file mode 100644 index 00000000000..67e12970fe8 --- /dev/null +++ b/packages/addons/tools/network-tools/source/default.py @@ -0,0 +1,22 @@ +################################################################################ +# This file is part of LibreELEC - http://www.libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +import xbmcgui + +dialog = xbmcgui.Dialog() +dialog.ok('', 'This is a console-only addon') diff --git a/packages/addons/tools/rpi-tools/changelog.txt b/packages/addons/tools/rpi-tools/changelog.txt new file mode 100644 index 00000000000..f6abfd17470 --- /dev/null +++ b/packages/addons/tools/rpi-tools/changelog.txt @@ -0,0 +1,2 @@ +8.0.100 +- Initial Release diff --git a/packages/addons/tools/rpi-tools/icon/icon.png b/packages/addons/tools/rpi-tools/icon/icon.png new file mode 100644 index 00000000000..5c2453be5d9 Binary files /dev/null and b/packages/addons/tools/rpi-tools/icon/icon.png differ diff --git a/packages/addons/tools/rpi-tools/package.mk b/packages/addons/tools/rpi-tools/package.mk new file mode 100644 index 00000000000..5c69e8c22d0 --- /dev/null +++ b/packages/addons/tools/rpi-tools/package.mk @@ -0,0 +1,57 @@ +################################################################################ +# This file is part of LibreELEC - https://libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +PKG_NAME="rpi-tools" +PKG_VERSION="" +PKG_REV="101" +PKG_ARCH="arm" +PKG_LICENSE="GPL" +PKG_SITE="" +PKG_URL="" +PKG_DEPENDS_TARGET="toolchain RPi.GPIO picamera gpiozero Adafruit_Python_LED_Backpack Adafruit_Python_GPIO Adafruit_Python_PureIO" +PKG_PRIORITY="optional" +PKG_SECTION="virtual" +PKG_SHORTDESC="A bundle of tools and programs for use on the Raspberry Pi" +PKG_LONGDESC="This bundle currently includes RPi.GPIO, picamera, gpiozero and same Adafruit (LED-Backpack, GPIO, PureIO) python modules" +PKG_DISCAIMER="Raspberry Pi is a trademark of the Raspberry Pi Foundation http://www.raspberrypi.org" + +PKG_IS_ADDON="yes" +PKG_ADDON_NAME="Raspberry Pi Tools" +PKG_ADDON_TYPE="xbmc.python.module" +PKG_ADDON_PROVIDES="" +PKG_ADDON_PROJECTS="RPi RPi2" +PKG_ADDON_REPOVERSION="8.0" + +PKG_AUTORECONF="no" + +addon() { + mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/lib/RPi/ + cp -PR $(get_build_dir RPi.GPIO)/build/lib.linux-*/RPi/* $ADDON_BUILD/$PKG_ADDON_ID/lib/RPi + cp -PR $(get_build_dir picamera)/picamera $ADDON_BUILD/$PKG_ADDON_ID/lib/ + cp -PR $(get_build_dir gpiozero)/gpiozero $ADDON_BUILD/$PKG_ADDON_ID/lib/ + cp -PR $(get_build_dir Adafruit_Python_PureIO)/Adafruit_PureIO $ADDON_BUILD/$PKG_ADDON_ID/lib/ + cp -PR $(get_build_dir Adafruit_Python_GPIO)/Adafruit_GPIO $ADDON_BUILD/$PKG_ADDON_ID/lib/ + cp -PR $(get_build_dir Adafruit_Python_LED_Backpack)/Adafruit_LED_Backpack $ADDON_BUILD/$PKG_ADDON_ID/lib/ + + BCM2835_DIR="$(get_build_dir bcm2835-driver)" + mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/bin/ + cp -P $BCM2835_DIR/hardfp/opt/vc/bin/raspistill $ADDON_BUILD/$PKG_ADDON_ID/bin + cp -P $BCM2835_DIR/hardfp/opt/vc/bin/raspiyuv $ADDON_BUILD/$PKG_ADDON_ID/bin + cp -P $BCM2835_DIR/hardfp/opt/vc/bin/raspivid $ADDON_BUILD/$PKG_ADDON_ID/bin + cp -P $BCM2835_DIR/hardfp/opt/vc/bin/raspividyuv $ADDON_BUILD/$PKG_ADDON_ID/bin +} diff --git a/packages/addons/tools/rpi-tools/source/default.py b/packages/addons/tools/rpi-tools/source/default.py new file mode 100644 index 00000000000..880a1960756 --- /dev/null +++ b/packages/addons/tools/rpi-tools/source/default.py @@ -0,0 +1,22 @@ +################################################################################ +# This file is part of LibreELEC - https://libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +import xbmcgui + +dialog = xbmcgui.Dialog() +dialog.ok('', 'This is a console-only addon') diff --git a/packages/addons/tools/system-tools/changelog.txt b/packages/addons/tools/system-tools/changelog.txt new file mode 100644 index 00000000000..f6abfd17470 --- /dev/null +++ b/packages/addons/tools/system-tools/changelog.txt @@ -0,0 +1,2 @@ +8.0.100 +- Initial Release diff --git a/packages/addons/tools/system-tools/icon/icon.png b/packages/addons/tools/system-tools/icon/icon.png new file mode 100644 index 00000000000..ad8880181be Binary files /dev/null and b/packages/addons/tools/system-tools/icon/icon.png differ diff --git a/packages/addons/tools/system-tools/package.mk b/packages/addons/tools/system-tools/package.mk new file mode 100644 index 00000000000..52a29102ebc --- /dev/null +++ b/packages/addons/tools/system-tools/package.mk @@ -0,0 +1,154 @@ +################################################################################ +# This file is part of LibreELEC - http://www.libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +PKG_NAME="system-tools" +PKG_VERSION="" +PKG_REV="100" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="" +PKG_URL="" +PKG_DEPENDS_TARGET="toolchain" +PKG_PRIORITY="optional" +PKG_SECTION="virtual" +PKG_SHORTDESC="A bundle of system tools and programs" +PKG_LONGDESC="This bundle currently includes autossh, diffutils, dtach, efibootmgr, evtest, fdupes, file, getscancodes, hddtemp, hd-idle, hid_mapper, i2c-tools, jq, lm_sensors, lshw, mrxvt, mtpfs, p7zip, patch, pv, screen, strace, unrar and usb-modeswitch." + +PKG_IS_ADDON="yes" +PKG_ADDON_NAME="System Tools" +PKG_ADDON_TYPE="xbmc.python.script" +PKG_ADDON_PROVIDES="" +PKG_ADDON_REPOVERSION="8.0" + +PKG_AUTORECONF="no" + +PKG_DEPENDS_TARGET="toolchain \ + autossh \ + diffutils \ + dtach \ + efibootmgr \ + evtest \ + fdupes \ + file \ + getscancodes \ + hddtemp \ + hd-idle \ + hid_mapper \ + i2c-tools \ + jq \ + lm_sensors \ + lshw \ + mrxvt \ + mtpfs \ + p7zip \ + patch \ + pv \ + screen \ + strace \ + unrar \ + usb-modeswitch" + +addon() { + mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/lib/ + mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/data/ + mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/bin/ + # autossh + cp -P $(get_build_dir autossh)/.$TARGET_NAME/autossh $ADDON_BUILD/$PKG_ADDON_ID/bin + + # diffutils + cp -P $(get_build_dir diffutils)/.$TARGET_NAME/src/cmp $ADDON_BUILD/$PKG_ADDON_ID/bin + cp -P $(get_build_dir diffutils)/.$TARGET_NAME/src/diff $ADDON_BUILD/$PKG_ADDON_ID/bin + cp -P $(get_build_dir diffutils)/.$TARGET_NAME/src/diff3 $ADDON_BUILD/$PKG_ADDON_ID/bin + cp -P $(get_build_dir diffutils)/.$TARGET_NAME/src/sdiff $ADDON_BUILD/$PKG_ADDON_ID/bin + + # dtach + cp -P $(get_build_dir dtach)/.$TARGET_NAME/dtach $ADDON_BUILD/$PKG_ADDON_ID/bin + + # efibootmgr + cp -P $(get_build_dir efibootmgr)/src/efibootmgr/efibootmgr $ADDON_BUILD/$PKG_ADDON_ID/bin 2>/dev/null || : + + # evtest + cp -P $(get_build_dir evtest)/.$TARGET_NAME/evtest $ADDON_BUILD/$PKG_ADDON_ID/bin + + # fdupes + cp -P $(get_build_dir fdupes)/fdupes $ADDON_BUILD/$PKG_ADDON_ID/bin + + # file + cp -P $(get_build_dir file)/.$TARGET_NAME/src/file $ADDON_BUILD/$PKG_ADDON_ID/bin + cp -P $(get_build_dir file)/.$TARGET_NAME/magic/magic.mgc $ADDON_BUILD/$PKG_ADDON_ID/data + + # getscancodes + cp -P $(get_build_dir getscancodes)/getscancodes $ADDON_BUILD/$PKG_ADDON_ID/bin + + # hddtemp + cp -P $(get_build_dir hddtemp)/.$TARGET_NAME/src/hddtemp $ADDON_BUILD/$PKG_ADDON_ID/bin + + # hd-idle + cp -P $(get_build_dir hd-idle)/hd-idle $ADDON_BUILD/$PKG_ADDON_ID/bin + + # hid_mapper + cp -P $(get_build_dir hid_mapper)/hid_mapper $ADDON_BUILD/$PKG_ADDON_ID/bin + + # i2c-tools + cp -P $(get_build_dir i2c-tools)/tools/i2cdetect $ADDON_BUILD/$PKG_ADDON_ID/bin + cp -P $(get_build_dir i2c-tools)/tools/i2cdump $ADDON_BUILD/$PKG_ADDON_ID/bin + cp -P $(get_build_dir i2c-tools)/tools/i2cget $ADDON_BUILD/$PKG_ADDON_ID/bin + cp -P $(get_build_dir i2c-tools)/tools/i2cset $ADDON_BUILD/$PKG_ADDON_ID/bin + cp -P $(get_build_dir i2c-tools)/py-smbus/build/lib.linux-*/smbus.so $ADDON_BUILD/$PKG_ADDON_ID/lib + + # jq + cp -P $(get_build_dir jq)/.$TARGET_NAME/jq $ADDON_BUILD/$PKG_ADDON_ID/bin + + # lm_sensors + cp -P $(get_build_dir lm_sensors)/prog/sensors/sensors $ADDON_BUILD/$PKG_ADDON_ID/bin 2>/dev/null || : + + # lshw + cp -P $(get_build_dir lshw)/src/lshw $ADDON_BUILD/$PKG_ADDON_ID/bin + + # mrxvt + cp -P $(get_build_dir mrxvt)/.$TARGET_NAME/src/mrxvt $ADDON_BUILD/$PKG_ADDON_ID/bin 2>/dev/null || : + + # mtpfs + cp -P $(get_build_dir mtpfs)/.$TARGET_NAME/mtpfs $ADDON_BUILD/$PKG_ADDON_ID/bin/ + + # p7zip + cp -P $(get_build_dir p7zip)/bin/7z.so $ADDON_BUILD/$PKG_ADDON_ID/bin + cp -PR $(get_build_dir p7zip)/bin/Codecs $ADDON_BUILD/$PKG_ADDON_ID/bin + cp -P $(get_build_dir p7zip)/bin/7z $ADDON_BUILD/$PKG_ADDON_ID/bin + cp -P $(get_build_dir p7zip)/bin/7za $ADDON_BUILD/$PKG_ADDON_ID/bin + + # patch + cp -P $(get_build_dir patch)/.$TARGET_NAME/src/patch $ADDON_BUILD/$PKG_ADDON_ID/bin + + # pv + cp -P $(get_build_dir pv)/.$TARGET_NAME/pv $ADDON_BUILD/$PKG_ADDON_ID/bin + + # screen + cp -P $(get_build_dir screen)/screen $ADDON_BUILD/$PKG_ADDON_ID/bin + + # strace + cp -P $(get_build_dir strace)/.$TARGET_NAME/strace $ADDON_BUILD/$PKG_ADDON_ID/bin + + # unrar + cp -P $(get_build_dir unrar)/unrar $ADDON_BUILD/$PKG_ADDON_ID/bin + + # usb-modeswitch + cp -P $(get_build_dir usb-modeswitch)/usb_modeswitch $ADDON_BUILD/$PKG_ADDON_ID/bin + + debug_strip $ADDON_BUILD/$PKG_ADDON_ID/bin +} diff --git a/packages/addons/tools/system-tools/source/default.py b/packages/addons/tools/system-tools/source/default.py new file mode 100644 index 00000000000..67e12970fe8 --- /dev/null +++ b/packages/addons/tools/system-tools/source/default.py @@ -0,0 +1,22 @@ +################################################################################ +# This file is part of LibreELEC - http://www.libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +import xbmcgui + +dialog = xbmcgui.Dialog() +dialog.ok('', 'This is a console-only addon') diff --git a/packages/audio/alsa-lib/package.mk b/packages/audio/alsa-lib/package.mk index 0a73d7263cb..8d9a277ef3f 100644 --- a/packages/audio/alsa-lib/package.mk +++ b/packages/audio/alsa-lib/package.mk @@ -17,7 +17,7 @@ ################################################################################ PKG_NAME="alsa-lib" -PKG_VERSION="1.1.0" +PKG_VERSION="1.1.1" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" diff --git a/packages/audio/alsa-utils/package.mk b/packages/audio/alsa-utils/package.mk index d034793ef02..e3868442ed8 100644 --- a/packages/audio/alsa-utils/package.mk +++ b/packages/audio/alsa-utils/package.mk @@ -17,7 +17,7 @@ ################################################################################ PKG_NAME="alsa-utils" -PKG_VERSION="1.1.0" +PKG_VERSION="1.1.1" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" diff --git a/packages/audio/asplib/package.mk b/packages/audio/asplib/package.mk index 3059d68ca1f..e3cc4524922 100644 --- a/packages/audio/asplib/package.mk +++ b/packages/audio/asplib/package.mk @@ -17,12 +17,12 @@ ################################################################################ PKG_NAME="asplib" -PKG_VERSION="2fac1bf" +PKG_VERSION="da66f51" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="https://github.com/AchimTuran/asplib" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_URL="https://github.com/AchimTuran/asplib/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain" PKG_PRIORITY="optional" PKG_SECTION="audio" diff --git a/packages/audio/asplib/patches/asplib-cmake.patch b/packages/audio/asplib/patches/asplib-cmake.patch index 8782cf72e68..d4f5556b97a 100644 --- a/packages/audio/asplib/patches/asplib-cmake.patch +++ b/packages/audio/asplib/patches/asplib-cmake.patch @@ -1,20 +1,21 @@ diff -Naur a/CMakeLists.txt b/CMakeLists.txt ---- a/CMakeLists.txt 2016-01-12 22:24:43.000000000 +0100 -+++ b/CMakeLists.txt 2016-01-12 22:47:16.624139358 +0100 -@@ -1,64 +1,17 @@ +--- a/CMakeLists.txt 2016-03-09 15:16:52.000000000 -0800 ++++ b/CMakeLists.txt 2016-03-30 22:45:01.502582518 -0700 +@@ -1,46 +1,15 @@ project(asplib) cmake_minimum_required(VERSION 2.6) -enable_language(CXX) -- + -set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}) - --include(UseMultiArch.cmake) +-include(cmake/UseMultiArch.cmake) + include(cmake/asplib_helpers.cmake) set(asplib_NAME asplib) set(asplib_DESCRIPTION "asplib (Achim's Signal Processing LIBrary), is a small and lightweight C++ library for digital signal processing.") --set(asplib_VERSION_MAJOR ${APP_VERSION_MAJOR}) --set(asplib_VERSION_MINOR ${APP_VERSION_MINOR}) +-set(asplib_VERSION_MAJOR 0) +-set(asplib_VERSION_MINOR 2) -set(asplib_VERSION_PATCH 0) - -if(NOT WIN32) @@ -27,111 +28,65 @@ diff -Naur a/CMakeLists.txt b/CMakeLists.txt - -if(CMAKE_SYSTEM_NAME MATCHES "Windows") - set(CMAKE_CXX_FLAGS "-DTARGET_WINDOWS") +- # Enable the orginization of projects with folders +- set_property(GLOBAL PROPERTY USE_FOLDERS ON) -endif() - --#set(asplib_INCLUDE_DIRS ${TINYXML_INCLUDE_DIR} "${CMAKE_INSTALL_PREFIX}/include/kodi") --#set(asplib_LIBRARIES ${CMAKE_THREAD_LIBS_INIT} ${TINYXML_LIBRARIES}) -- -if (NOT WIN32) - add_definitions(-fPIC -g -O2) -endif() - --include_directories(${PROJECT_SOURCE_DIR} -- ${PROJECT_SOURCE_DIR}/Biquads) +-set(asplib_INCLUDE_DIRS ${PROJECT_SOURCE_DIR} +- ${PROJECT_SOURCE_DIR}/Biquads +- ${CMAKE_INSTALL_PREFIX}/include/asplib) +- +-include_directories(${asplib_INCLUDE_DIRS}) --set(SOURCES asplib_utils/computeDeviceInfo/cpuInfo.cpp -- Biquads/Biquad_Native/asplib_Biquad_Native.cpp -+set(SOURCES Biquads/Biquad_Native/asplib_Biquad_Native.cpp + set(SOURCES Biquads/Biquad_Native/asplib_Biquad_Native.cpp Biquads/apslib_BiquadFactory.cpp) +- ++ + set(HEADERS interfaces/asplib_IBaseBiquad.h + Biquads/apslib_BiquadFactory.h + Biquads/Biquad_Native/asplib_Biquad_Native.h +@@ -54,35 +23,13 @@ + asplib_utils/os/linux/linux_definitions.h + asplib_utils/os/raspberry_pi/raspberry_pi_definitions.h + asplib_utils/os/windows/windows_definitions.h) +- +-asplib_source_group("${SOURCES}") +-asplib_source_group("${HEADERS}") --set(HEADERS interfaces/asplib_IBaseBiquad.h -- asplib_utils/constants_typedefs/asplib_constants.h -- asplib_utils/constants_typedefs/asplib_typedefs.h -- asplib_utils/os/asplib_base_os.h -- asplib_utils/os/windows/windows_definitions.h -- asplib_utils/os/linux/linux_definitions.h -- asplib_utils/computeDeviceInfo/cpuInfo_types.h -- asplib_utils/computeDeviceInfo/cpuInfo.h -- Biquads/apslib_BiquadFactory.h -- Biquads/Biquad_Native/asplib_Biquad_Native.h) -- -- --#include_directories(${TINYXML_INCLUDE_DIR} ${KODI_INCLUDE_DIR}) -- --add_library(asplib ${SOURCES} ${PLAT_SOURCES}) +-add_library(asplib ${SOURCES} ${HEADERS}) -target_link_libraries(asplib ${asplib_LIBRARIES}) --#set_target_properties(asplib PROPERTIES VERSION ${asplib_VERSION_MAJOR}.${asplib_VERSION_MINOR}.${asplib_VERSION_PATCH} --# SOVERSION ${asplib_VERSION_MAJOR}.0) -+add_library(asplib STATIC ${SOURCES}) +-set_target_properties(asplib PROPERTIES VERSION ${asplib_VERSION_MAJOR}.${asplib_VERSION_MINOR}.${asplib_VERSION_PATCH} +- SOVERSION ${asplib_VERSION_MAJOR}.0) ++asplib_install_with_folder("${HEADERS}" ${CMAKE_INSTALL_PREFIX}/include/asplib) + ++add_library(asplib STATIC ${SOURCES} ${HEADERS}) -install(TARGETS asplib DESTINATION ${CMAKE_INSTALL_LIBDIR}) +include_directories(${PROJECT_SOURCE_DIR} + ${PROJECT_SOURCE_DIR}/Biquads) - install(DIRECTORY ${PROJECT_SOURCE_DIR}/interfaces/ DESTINATION ${CMAKE_INSTALL_PREFIX}/include/asplib/interfaces - FILES_MATCHING PATTERN "*.h") -@@ -66,8 +19,6 @@ - FILES_MATCHING PATTERN "*.h") - install(DIRECTORY ${PROJECT_SOURCE_DIR}/asplib_utils/os/ DESTINATION ${CMAKE_INSTALL_PREFIX}/include/asplib/asplib_utils/os/ - FILES_MATCHING PATTERN "*.h") --install(DIRECTORY ${PROJECT_SOURCE_DIR}/asplib_utils/os/windows/ DESTINATION ${CMAKE_INSTALL_PREFIX}/include/asplib/asplib_utils/os/windows/ -- FILES_MATCHING PATTERN "*.h") - install(DIRECTORY ${PROJECT_SOURCE_DIR}/asplib_utils/os/linux/ DESTINATION ${CMAKE_INSTALL_PREFIX}/include/asplib/asplib_utils/os/linux/ - FILES_MATCHING PATTERN "*.h") - install(DIRECTORY ${PROJECT_SOURCE_DIR}/asplib_utils/computeDeviceInfo/ DESTINATION ${CMAKE_INSTALL_PREFIX}/include/asplib/asplib_utils/computeDeviceInfo/ -@@ -77,54 +28,4 @@ - install(DIRECTORY ${PROJECT_SOURCE_DIR}/Biquads/Biquad_Native/ DESTINATION ${CMAKE_INSTALL_PREFIX}/include/asplib/Biquads/Biquad_Native/ - FILES_MATCHING PATTERN "*.h") - -- --# install(FILES interfaces/asplib_IBaseBiquad.h -- # asplib_utils/constants_typedefs/asplib_constants.h -- # asplib_utils/constants_typedefs/asplib_typedefs.h -- -- # DESTINATION include/asplib/asplib_utils/constants_typedefs/) -- -- # asplib_utils/os/asplib_base_os.h -- # asplib_utils/os/windows/windows_definitions.h -- # asplib_utils/os/linux/linux_definitions.h -- # utils/computeDeviceInfo/cpuInfo_types.h -- # utils/computeDeviceInfo/cpuInfo.h -- # Biquads/apslib_BiquadFactory.h -- # Biquads/Biquad_Native/asplib_Biquad_Native.h -- # ) -- --# install(FILES interfaces/asplib_IBaseBiquad.h -- # DESTINATION include/asplib/interfaces) --# install(FILES constants_typedefs/asplib_constants.h -- # constants_typedefs/asplib_typedefs.h -- # DESTINATION include/asplib/constants_typedefs) --# install(FILES utils/computeDeviceInfo/cpuInfo_types.h -- # utils/computeDeviceInfo/cpuInfo.h -- # DESTINATION include/asplib/utils) --# install(FILES Biquads/apslib_BiquadFactory.h -- # Biquads/Biquad_Native/asplib_Biquad_Native.h -- # DESTINATION include/asplib/Biquads) ++install(TARGETS asplib DESTINATION ${CMAKE_INSTALL_PREFIX}/lib) + asplib_install_with_folder("${HEADERS}" ${CMAKE_INSTALL_PREFIX}/include/asplib) - --#install(FILES ${HEADERS} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/asplib) -- --#IF(NOT WIN32) +-IF(NOT WIN32) - # Pkgconfig -- #include(PkgConfigHandler.cmake) -- #configure_pc_file(kodiutilities kodiutilities.pc.in -- # kodiutilities.pc -- # ${CMAKE_INSTALL_PREFIX} -- # ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR} -- # ${CMAKE_INSTALL_PREFIX}/include) +- include(cmake/PkgConfigHandler.cmake) +- configure_pc_file(asplib asplib.pc.in +- asplib.pc +- ${CMAKE_INSTALL_PREFIX} +- ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR} +- ${CMAKE_INSTALL_PREFIX}/include) - --# install(FILES ${CMAKE_BINARY_DIR}/kodiutilities.pc --# DESTINATION ${CMAKE_INSTALL_LIBDIR_NOARCH}/pkgconfig) --#ENDIF(NOT WIN32) +- install(FILES ${CMAKE_BINARY_DIR}/asplib.pc +- DESTINATION ${CMAKE_INSTALL_LIBDIR_NOARCH}/pkgconfig) +-ENDIF(NOT WIN32) - -# config mode --#configure_file (kodiutilities-config.cmake.in --# kodiutilities-config.cmake @ONLY) --#install(FILES ${CMAKE_BINARY_DIR}/kodiutilities-config.cmake --# DESTINATION ${CMAKE_INSTALL_LIBDIR_NOARCH}/kodiutilities) -- --# Quell warnings with in-tree builds --#set(KODI_BUILD_DIR ${KODI_BUILD_DIR}) -+install(TARGETS asplib DESTINATION ${CMAKE_INSTALL_PREFIX}/lib) +-configure_file(asplib-config.cmake.in +- asplib-config.cmake @ONLY) +-install(FILES ${CMAKE_BINARY_DIR}/asplib-config.cmake +- DESTINATION ${CMAKE_INSTALL_LIBDIR_NOARCH}/asplib) diff --git a/packages/audio/espeak/package.mk b/packages/audio/espeak/package.mk index 45622936e17..497641e2846 100644 --- a/packages/audio/espeak/package.mk +++ b/packages/audio/espeak/package.mk @@ -22,7 +22,7 @@ PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://espeak.sourceforge.net/" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.zip" +PKG_URL="http://sourceforge.net/projects/espeak/files/espeak/espeak-1.48/$PKG_NAME-$PKG_VERSION.zip" PKG_DEPENDS_TARGET="toolchain" PKG_PRIORITY="optional" PKG_SECTION="audio" diff --git a/packages/audio/libogg/package.mk b/packages/audio/libogg/package.mk index 1b2dceae4cc..af6e68cb37e 100644 --- a/packages/audio/libogg/package.mk +++ b/packages/audio/libogg/package.mk @@ -31,3 +31,5 @@ PKG_LONGDESC="Libogg contains necessary functionality to create, decode, and wor PKG_IS_ADDON="no" PKG_AUTORECONF="yes" + +PKG_CONFIGURE_OPTS_TARGET="--enable-static --disable-shared" diff --git a/packages/audio/libsndfile/package.mk b/packages/audio/libsndfile/package.mk index d450171ae20..93c5cc8e76a 100644 --- a/packages/audio/libsndfile/package.mk +++ b/packages/audio/libsndfile/package.mk @@ -17,13 +17,13 @@ ################################################################################ PKG_NAME="libsndfile" -PKG_VERSION="1.0.25" +PKG_VERSION="1.0.26" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="LGPL" PKG_SITE="http://www.mega-nerd.com/libsndfile/" PKG_URL="http://www.mega-nerd.com/$PKG_NAME/files/$PKG_NAME-$PKG_VERSION.tar.gz" -PKG_DEPENDS_TARGET="toolchain alsa-lib flac libvorbis libogg" +PKG_DEPENDS_TARGET="toolchain alsa-lib" PKG_PRIORITY="optional" PKG_SECTION="audio" PKG_SHORTDESC="libsndfile: A library for accessing various audio file formats" @@ -37,7 +37,7 @@ PKG_CONFIGURE_OPTS_TARGET="--enable-static --disable-shared \ --disable-silent-rules \ --disable-sqlite \ --enable-alsa \ - --enable-external-libs \ + --disable-external-libs \ --disable-experimental \ --disable-test-coverage \ --enable-largefile \ diff --git a/packages/audio/libsndfile/patches/libsndfile-1.0.25-configure.patch b/packages/audio/libsndfile/patches/libsndfile-1.0.25-configure.patch deleted file mode 100644 index ece79a7d2bd..00000000000 --- a/packages/audio/libsndfile/patches/libsndfile-1.0.25-configure.patch +++ /dev/null @@ -1,25 +0,0 @@ -diff -Naur libsndfile-1.0.25-old/configure.ac libsndfile-1.0.25-new/configure.ac ---- libsndfile-1.0.25-old/configure.ac 2011-07-13 01:59:57.000000000 -0700 -+++ libsndfile-1.0.25-new/configure.ac 2011-07-13 17:04:14.000000000 -0700 -@@ -18,9 +18,6 @@ - AM_INIT_AUTOMAKE($PACKAGE_NAME,$PACKAGE_VERSION) - AM_SILENT_RULES([yes]) - --dnl Add parameters for aclocal --AC_SUBST(ACLOCAL_AMFLAGS, "-I M4") -- - AC_LANG([C]) - - AC_PROG_CC -diff -Naur libsndfile-1.0.25-old/Makefile.am libsndfile-1.0.25-new/Makefile.am ---- libsndfile-1.0.25-old/Makefile.am 2011-07-07 02:47:24.000000000 -0700 -+++ libsndfile-1.0.25-new/Makefile.am 2011-07-13 17:04:14.000000000 -0700 -@@ -2,6 +2,8 @@ - - DISTCHECK_CONFIGURE_FLAGS = --enable-gcc-werror - -+ACLOCAL_AMFLAGS = -I M4 -+ - if BUILD_OCTAVE_MOD - octave_dir = Octave - endif diff --git a/packages/audio/libvorbis/package.mk b/packages/audio/libvorbis/package.mk index b5309ae0a5d..12d18666da3 100644 --- a/packages/audio/libvorbis/package.mk +++ b/packages/audio/libvorbis/package.mk @@ -33,4 +33,8 @@ PKG_IS_ADDON="no" PKG_AUTORECONF="yes" # package specific configure options -PKG_CONFIGURE_OPTS_TARGET="--with-ogg=$SYSROOT_PREFIX/usr --disable-oggtest --disable-docs --disable-examples" +PKG_CONFIGURE_OPTS_TARGET="--enable-static --disable-shared \ + --with-ogg=$SYSROOT_PREFIX/usr \ + --disable-oggtest \ + --disable-docs \ + --disable-examples" diff --git a/packages/audio/pulseaudio/package.mk b/packages/audio/pulseaudio/package.mk index 5aadd9e07d2..5e2841d7c6e 100644 --- a/packages/audio/pulseaudio/package.mk +++ b/packages/audio/pulseaudio/package.mk @@ -48,11 +48,18 @@ else PULSEAUDIO_AVAHI="--disable-avahi" fi +if [ "$TARGET_FPU" = "neon" -o "$TARGET_FPU" = "neon-fp16" -o "$TARGET_FPU" = "neon-vfpv4" ]; then + PULSEAUDIO_NEON="--enable-neon-opt" +else + PULSEAUDIO_NEON="--disable-neon-opt" +fi + # package specific configure options PKG_CONFIGURE_OPTS_TARGET="--disable-silent-rules \ --disable-nls \ --enable-largefile \ --disable-rpath \ + $PULSEAUDIO_NEON \ --disable-x11 \ --disable-tests \ --disable-samplerate \ diff --git a/packages/compress/bzip2/package.mk b/packages/compress/bzip2/package.mk index 1483b89802a..2fa7bdc6a45 100644 --- a/packages/compress/bzip2/package.mk +++ b/packages/compress/bzip2/package.mk @@ -23,6 +23,7 @@ PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.bzip.org" PKG_URL="http://www.bzip.org/$PKG_VERSION/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_DEPENDS_HOST="toolchain" PKG_DEPENDS_TARGET="toolchain" PKG_PRIORITY="optional" PKG_SECTION="compress" @@ -32,7 +33,27 @@ PKG_LONGDESC="bzip2 is a freely available, patent free (see below), high-quality PKG_IS_ADDON="no" PKG_AUTORECONF="no" +pre_build_host() { + mkdir -p $ROOT/$PKG_BUILD/.$HOST_NAME + cp -r $ROOT/$PKG_BUILD/* $ROOT/$PKG_BUILD/.$HOST_NAME +} + +make_host() { + cd $ROOT/$PKG_BUILD/.$HOST_NAME + make -f Makefile-libbz2_so CC=$HOST_CC CFLAGS="$CFLAGS -fPIC -DPIC" +} + +makeinstall_host() { + make install PREFIX=$ROOT/$TOOLCHAIN +} + +pre_build_target() { + mkdir -p $ROOT/$PKG_BUILD/.$TARGET_NAME + cp -r $ROOT/$PKG_BUILD/* $ROOT/$PKG_BUILD/.$TARGET_NAME +} + pre_make_target() { + cd $ROOT/$PKG_BUILD/.$TARGET_NAME sed -e "s,ln -s (lib.*),ln -snf \$$1; ln -snf libbz2.so.$PKG_VERSION libbz2.so,g" -i Makefile-libbz2_so } diff --git a/packages/compress/zlib/package.mk b/packages/compress/zlib/package.mk index 3c3f86e5165..dade2b01d41 100644 --- a/packages/compress/zlib/package.mk +++ b/packages/compress/zlib/package.mk @@ -22,7 +22,7 @@ PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="OSS" PKG_SITE="http://www.zlib.net" -PKG_URL="$DISTRO_MIRROR/zlib/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_URL="http://zlib.net/$PKG_NAME-$PKG_VERSION.tar.xz" PKG_DEPENDS_TARGET="toolchain" PKG_DEPENDS_HOST="" PKG_PRIORITY="optional" diff --git a/packages/databases/mysql/package.mk b/packages/databases/mysql/package.mk index af26f3861b2..c4e54e4f586 100644 --- a/packages/databases/mysql/package.mk +++ b/packages/databases/mysql/package.mk @@ -1,100 +1,110 @@ ################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# This file is part of LibreELEC - https://libreelec.tv +# Copyright (C) 2016 Team LibreELEC # -# OpenELEC is free software: you can redistribute it and/or modify +# LibreELEC is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 2 of the License, or # (at your option) any later version. # -# OpenELEC is distributed in the hope that it will be useful, +# LibreELEC is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . +# along with LibreELEC. If not, see . ################################################################################ PKG_NAME="mysql" -PKG_VERSION="5.1.73" +PKG_VERSION="5.7.12" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="LGPL" PKG_SITE="http://www.mysql.com" -PKG_URL="http://ftp.gwdg.de/pub/misc/$PKG_NAME/Downloads/MySQL-5.1/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_URL="http://ftp.gwdg.de/pub/misc/$PKG_NAME/Downloads/MySQL-5.7/$PKG_NAME-$PKG_VERSION.tar.gz" PKG_DEPENDS_HOST="zlib:host" -PKG_DEPENDS_TARGET="toolchain zlib ncurses libressl mysql:host" +PKG_DEPENDS_TARGET="toolchain zlib netbsd-curses libressl boost mysql:host" PKG_PRIORITY="optional" PKG_SECTION="database" PKG_SHORTDESC="mysql: A database server" PKG_LONGDESC="MySQL is a SQL (Structured Query Language) database server. SQL is the most popular database language in the world. MySQL is a client server implementation that consists of a server daemon mysqld and many different client programs/libraries." PKG_IS_ADDON="no" -PKG_AUTORECONF="yes" +PKG_AUTORECONF="no" -TARGET_CFLAGS="$TARGET_CFLAGS -fPIC -DPIC -I$SYSROOT_PREFIX/usr/include/ncurses" +post_unpack() { + sed -i 's|OPENSSL_MAJOR_VERSION STREQUAL "1"|OPENSSL_MAJOR_VERSION STREQUAL "2"|' $ROOT/$PKG_BUILD/cmake/ssl.cmake + sed -i 's|GET_TARGET_PROPERTY(LIBMYSQL_OS_OUTPUT_NAME libmysql OUTPUT_NAME)|SET(LIBMYSQL_OS_OUTPUT_NAME "mysqlclient")|' $ROOT/$PKG_BUILD/scripts/CMakeLists.txt + sed -i "s|COMMAND comp_err|COMMAND $ROOT/$TOOLCHAIN/bin/comp_err|" $ROOT/$PKG_BUILD/extra/CMakeLists.txt + sed -i "s|COMMAND comp_sql|COMMAND $ROOT/$TOOLCHAIN/bin/comp_sql|" $ROOT/$PKG_BUILD/scripts/CMakeLists.txt + sed -i "s|COMMAND gen_lex_hash|COMMAND $ROOT/$TOOLCHAIN/bin/gen_lex_hash|" $ROOT/$PKG_BUILD/sql/CMakeLists.txt -PKG_CONFIGURE_OPTS_HOST="--with-zlib-dir=$ROOT/$TOOLCHAIN" + sed -i '/^IF(NOT BOOST_MINOR_VERSION.*$/,/^ENDIF()$/d' $ROOT/$PKG_BUILD/cmake/boost.cmake +} -PKG_CONFIGURE_OPTS_TARGET="ac_cv_c_stack_direction=-1 \ - ac_cv_sys_restartable_syscalls=yes \ - --localstatedir=/storage/.mysql \ - --with-unix-socket-path=/var/tmp/mysql.socket \ - --with-tcp-port=3306 \ - --enable-static \ - --with-ssl=$SYSROOT_PREFIX/usr/lib \ - --disable-shared \ - --with-low-memory \ - --enable-largefile \ - --with-big-tables \ - --with-mysqld-user=mysqld \ - --with-extra-charsets=all \ - --with-pthread \ - --with-named-thread-libs=-lpthread \ - --enable-thread-safe-client \ - --enable-assembler \ - --enable-local-infile \ - --without-debug \ - --without-docs \ - --without-man \ - --with-readline \ - --without-libwrap \ - --without-pstack \ - --without-server \ - --without-embedded-server \ - --without-libedit \ - --with-query-cache \ - --without-plugin-partition \ - --without-plugin-daemon_example \ - --without-plugin-ftexample \ - --without-plugin-archive \ - --without-plugin-blackhole \ - --without-plugin-example \ - --without-plugin-federated \ - --without-plugin-ibmdb2i \ - --without-plugin-innobase \ - --without-plugin-innodb_plugin \ - --without-plugin-ndbcluster" +configure_host() { + cmake -DCMAKE_PREFIX_PATH=$ROOT/$TOOLCHAIN/ \ + -DCMAKE_BUILD_TYPE=Release \ + -DWITHOUT_SERVER=OFF \ + -DWITH_EMBEDDED_SERVER=OFF \ + -DWITH_INNOBASE_STORAGE_ENGINE=OFF \ + -DWITH_PARTITION_STORAGE_ENGINE=OFF \ + -DWITH_PERFSCHEMA_STORAGE_ENGINE=OFF \ + -DWITH_EXTRA_CHARSETS=none \ + -DWITH_EDITLINE=bundled \ + -DWITH_LIBEVENT=bundled \ + -DDOWNLOAD_BOOST=0 \ + -DLOCAL_BOOST_DIR=$(get_build_dir boost) \ + -DWITH_UNIT_TESTS=OFF \ + -DWITH_ZLIB=bundled \ + .. +} make_host() { - make -C include my_config.h - make -C mysys libmysys.a - make -C strings libmystrings.a - make -C dbug factorial - make -C vio libvio.a - make -C dbug libdbug.a - make -C regex libregex.a - make -C sql gen_lex_hash - make -C scripts comp_sql - make -C extra comp_err + make comp_err + make gen_lex_hash + make comp_sql +} + +post_make_host() { + # needed so the binary isn't built for target + cp scripts/comp_sql ../scripts/comp_sql } makeinstall_host() { - cp -PR dbug/factorial $ROOT/$TOOLCHAIN/bin/mysql-factorial - cp -PR sql/gen_lex_hash $ROOT/$TOOLCHAIN/bin/mysql-gen_lex_hash - cp -PR scripts/comp_sql $ROOT/$TOOLCHAIN/bin/mysql-comp_sql - cp -PR extra/comp_err $ROOT/$TOOLCHAIN/bin/mysql-comp_err + cp -P extra/comp_err $ROOT/$TOOLCHAIN/bin + cp -P sql/gen_lex_hash $ROOT/$TOOLCHAIN/bin + cp -P scripts/comp_sql $ROOT/$TOOLCHAIN/bin +} + +configure_target() { + cmake -DCMAKE_TOOLCHAIN_FILE=$CMAKE_CONF \ + -DCMAKE_PREFIX_PATH=$SYSROOT_PREFIX/usr \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DINSTALL_INCLUDEDIR=include/mysql \ + -DCMAKE_BUILD_TYPE=Release \ + -DFEATURE_SET=classic \ + -DDISABLE_SHARED=ON \ + -DENABLE_DTRACE=OFF \ + -DWITH_EMBEDDED_SERVER=OFF \ + -DWITH_INNOBASE_STORAGE_ENGINE=OFF \ + -DWITH_PARTITION_STORAGE_ENGINE=OFF \ + -DWITH_PERFSCHEMA_STORAGE_ENGINE=OFF \ + -DWITH_EXTRA_CHARSETS=all \ + -DWITH_UNIT_TESTS=OFF \ + -DWITHOUT_SERVER=ON \ + -DWITH_EDITLINE=bundled \ + -DWITH_LIBEVENT=bundled \ + -DWITH_ZLIB=system \ + -DWITH_SSL=$SYSROOT_PREFIX/usr \ + -DDOWNLOAD_BOOST=0 \ + -DLOCAL_BOOST_DIR=$(get_build_dir boost) \ + -DSTACK_DIRECTION=1 \ + -DHAVE_LLVM_LIBCPP=1 \ + -DCMAKE_C_FLAGS="-fPIC ${CFLAGS} -fno-strict-aliasing -DBIG_JOINS=1 -fomit-frame-pointer -fno-delete-null-pointer-checks" \ + -DCMAKE_CXX_FLAGS="-fPIC ${CXXFLAGS} -fno-strict-aliasing -DBIG_JOINS=1 -felide-constructors -fno-delete-null-pointer-checks" \ + .. } post_makeinstall_target() { @@ -102,13 +112,6 @@ post_makeinstall_target() { sed -i "s|pkglibdir=.*|pkglibdir=\'$SYSROOT_PREFIX/usr/lib/mysql\'|" scripts/mysql_config cp scripts/mysql_config $SYSROOT_PREFIX/usr/bin ln -sf $SYSROOT_PREFIX/usr/bin/mysql_config $ROOT/$TOOLCHAIN/bin/mysql_config - - for i in `ls -d $SYSROOT_PREFIX/usr/lib/mysql/*.a`; do - ln -v -sf $i $SYSROOT_PREFIX/usr/lib - done - - rm -rf $INSTALL/usr/bin - rm -rf $INSTALL/usr/mysql-test - rm -rf $INSTALL/usr/share/mysql - rm -rf $INSTALL/usr/sql-bench + + rm -rf $INSTALL } diff --git a/packages/databases/mysql/patches/mysql-0001-link-against-termcap.patch b/packages/databases/mysql/patches/mysql-0001-link-against-termcap.patch new file mode 100644 index 00000000000..033763f9d67 --- /dev/null +++ b/packages/databases/mysql/patches/mysql-0001-link-against-termcap.patch @@ -0,0 +1,12 @@ +diff -Naur a/client/CMakeLists.txt b/client/CMakeLists.txt +--- a/client/CMakeLists.txt 2016-03-28 11:06:12.000000000 -0700 ++++ b/client/CMakeLists.txt 2016-05-19 02:34:38.828457442 -0700 +@@ -44,7 +44,7 @@ + MYSQL_ADD_EXECUTABLE(mysql completion_hash.cc mysql.cc readline.cc ../sql-common/sql_string.cc) + TARGET_LINK_LIBRARIES(mysql mysqlclient) + IF(UNIX) +- TARGET_LINK_LIBRARIES(mysql ${EDITLINE_LIBRARY}) ++ TARGET_LINK_LIBRARIES(mysql ${EDITLINE_LIBRARY} termcap) + ENDIF(UNIX) + + IF(NOT WITHOUT_SERVER) diff --git a/packages/databases/mysql/patches/mysql-010_crosscompiling.patch b/packages/databases/mysql/patches/mysql-010_crosscompiling.patch deleted file mode 100644 index b6c3e068a10..00000000000 --- a/packages/databases/mysql/patches/mysql-010_crosscompiling.patch +++ /dev/null @@ -1,128 +0,0 @@ -diff -Naur mysql-5.1.38/dbug/Makefile.am mysql-5.1.38.patch/dbug/Makefile.am ---- mysql-5.1.38/dbug/Makefile.am 2009-08-21 14:09:22.000000000 +0200 -+++ mysql-5.1.38.patch/dbug/Makefile.am 2009-09-10 02:57:59.000000000 +0200 -@@ -44,19 +44,19 @@ - -groff -mm user.r > $@ - - output1.r: factorial -- ./factorial 1 2 3 4 5 | cat > $@ -+ mysql-factorial 1 2 3 4 5 | cat > $@ - - output2.r: factorial -- ./factorial -\#t:o 2 3 | cat >$@ -+ mysql-factorial -\#t:o 2 3 | cat >$@ - - output3.r: factorial -- ./factorial -\#d:t:o 3 | cat >$@ -+ mysql-factorial -\#d:t:o 3 | cat >$@ - - output4.r: factorial -- ./factorial -\#d,result:o 4 | cat >$@ -+ mysql-factorial -\#d,result:o 4 | cat >$@ - - output5.r: factorial -- ./factorial -\#d:f,factorial:F:L:o 3 | cat >$@ -+ mysql-factorial -\#d:f,factorial:F:L:o 3 | cat >$@ - .c.r: - @RM@ -f $@ - @SED@ -e 's!\\!\\\\!g' $< > $@ -diff -Naur mysql-5.1.38/dbug/Makefile.in mysql-5.1.38.patch/dbug/Makefile.in ---- mysql-5.1.38/dbug/Makefile.in 2009-08-21 14:17:15.000000000 +0200 -+++ mysql-5.1.38.patch/dbug/Makefile.in 2009-09-10 02:58:14.000000000 +0200 -@@ -746,19 +746,19 @@ - -groff -mm user.r > $@ - - output1.r: factorial -- ./factorial 1 2 3 4 5 | cat > $@ -+ mysql-factorial 1 2 3 4 5 | cat > $@ - - output2.r: factorial -- ./factorial -\#t:o 2 3 | cat >$@ -+ mysql-factorial -\#t:o 2 3 | cat >$@ - - output3.r: factorial -- ./factorial -\#d:t:o 3 | cat >$@ -+ mysql-factorial -\#d:t:o 3 | cat >$@ - - output4.r: factorial -- ./factorial -\#d,result:o 4 | cat >$@ -+ mysql-factorial -\#d,result:o 4 | cat >$@ - - output5.r: factorial -- ./factorial -\#d:f,factorial:F:L:o 3 | cat >$@ -+ mysql-factorial -\#d:f,factorial:F:L:o 3 | cat >$@ - .c.r: - @RM@ -f $@ - @SED@ -e 's!\\!\\\\!g' $< > $@ -diff -Naur mysql-5.1.38/extra/Makefile.am mysql-5.1.38.patch/extra/Makefile.am ---- mysql-5.1.38/extra/Makefile.am 2009-08-21 14:09:23.000000000 +0200 -+++ mysql-5.1.38.patch/extra/Makefile.am 2009-09-10 02:53:50.000000000 +0200 -@@ -32,7 +32,7 @@ - $(top_builddir)/include/mysqld_error.h: comp_err.c \ - $(top_srcdir)/sql/share/errmsg.txt - $(MAKE) $(AM_MAKEFLAGS) comp_err$(EXEEXT) -- $(top_builddir)/extra/comp_err$(EXEEXT) \ -+ mysql-comp_err$(EXEEXT) \ - --charset=$(top_srcdir)/sql/share/charsets \ - --out-dir=$(top_builddir)/sql/share/ \ - --header_file=$(top_builddir)/include/mysqld_error.h \ -diff -Naur mysql-5.1.38/extra/Makefile.in mysql-5.1.38.patch/extra/Makefile.in ---- mysql-5.1.38/extra/Makefile.in 2009-08-21 14:17:16.000000000 +0200 -+++ mysql-5.1.38.patch/extra/Makefile.in 2009-09-10 02:53:16.000000000 +0200 -@@ -936,7 +936,7 @@ - $(top_builddir)/include/mysqld_error.h: comp_err.c \ - $(top_srcdir)/sql/share/errmsg.txt - $(MAKE) $(AM_MAKEFLAGS) comp_err$(EXEEXT) -- $(top_builddir)/extra/comp_err$(EXEEXT) \ -+ mysql-comp_err$(EXEEXT) \ - --charset=$(top_srcdir)/sql/share/charsets \ - --out-dir=$(top_builddir)/sql/share/ \ - --header_file=$(top_builddir)/include/mysqld_error.h \ -diff -Naur mysql-5.1.38/scripts/Makefile.am mysql-5.1.38.patch/scripts/Makefile.am ---- mysql-5.1.38/scripts/Makefile.am 2009-08-21 14:11:26.000000000 +0200 -+++ mysql-5.1.38.patch/scripts/Makefile.am 2009-09-10 02:57:01.000000000 +0200 -@@ -121,7 +121,7 @@ - mysql_fix_privilege_tables_sql.c: comp_sql.c mysql_fix_privilege_tables.sql - $(MAKE) $(AM_MAKEFLAGS) comp_sql$(EXEEXT) - sleep 2 -- $(top_builddir)/scripts/comp_sql$(EXEEXT) \ -+ mysql-comp_sql$(EXEEXT) \ - mysql_fix_privilege_tables \ - $(top_srcdir)/scripts/mysql_fix_privilege_tables.sql $@ - -diff -Naur mysql-5.1.38/scripts/Makefile.in mysql-5.1.38.patch/scripts/Makefile.in ---- mysql-5.1.38/scripts/Makefile.in 2009-08-21 14:17:23.000000000 +0200 -+++ mysql-5.1.38.patch/scripts/Makefile.in 2009-09-10 02:57:11.000000000 +0200 -@@ -802,7 +802,7 @@ - mysql_fix_privilege_tables_sql.c: comp_sql.c mysql_fix_privilege_tables.sql - $(MAKE) $(AM_MAKEFLAGS) comp_sql$(EXEEXT) - sleep 2 -- $(top_builddir)/scripts/comp_sql$(EXEEXT) \ -+ mysql-comp_sql$(EXEEXT) \ - mysql_fix_privilege_tables \ - $(top_srcdir)/scripts/mysql_fix_privilege_tables.sql $@ - -diff -Naur mysql-5.1.38/sql/Makefile.am mysql-5.1.38.patch/sql/Makefile.am ---- mysql-5.1.38/sql/Makefile.am 2009-08-21 14:12:24.000000000 +0200 -+++ mysql-5.1.38.patch/sql/Makefile.am 2009-09-10 02:55:09.000000000 +0200 -@@ -174,7 +174,7 @@ - # this avoid the rebuild of the built files in a source dist - lex_hash.h: gen_lex_hash.cc lex.h - $(MAKE) $(AM_MAKEFLAGS) gen_lex_hash$(EXEEXT) -- ./gen_lex_hash$(EXEEXT) > $@-t -+ mysql-gen_lex_hash$(EXEEXT) > $@-t - $(MV) $@-t $@ - - # For testing of udf_example.so -diff -Naur mysql-5.1.38/sql/Makefile.in mysql-5.1.38.patch/sql/Makefile.in ---- mysql-5.1.38/sql/Makefile.in 2009-08-21 14:17:25.000000000 +0200 -+++ mysql-5.1.38.patch/sql/Makefile.in 2009-09-10 02:55:22.000000000 +0200 -@@ -1302,7 +1302,7 @@ - # this avoid the rebuild of the built files in a source dist - lex_hash.h: gen_lex_hash.cc lex.h - $(MAKE) $(AM_MAKEFLAGS) gen_lex_hash$(EXEEXT) -- ./gen_lex_hash$(EXEEXT) > $@-t -+ mysql-gen_lex_hash$(EXEEXT) > $@-t - $(MV) $@-t $@ - - # We might have some stuff not built in this build, but that we want to install diff --git a/packages/databases/mysql/patches/mysql-011_mysql_config-dont-include-LDFLAGS-in-libs-output.patch b/packages/databases/mysql/patches/mysql-011_mysql_config-dont-include-LDFLAGS-in-libs-output.patch deleted file mode 100644 index db13465d263..00000000000 --- a/packages/databases/mysql/patches/mysql-011_mysql_config-dont-include-LDFLAGS-in-libs-output.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 161d55d84441bd3b66eba9eafd85782eeb168cdd Mon Sep 17 00:00:00 2001 -From: Stefan Saraev -Date: Fri, 28 Mar 2014 13:12:50 +0200 -Subject: [PATCH] mysql_config: dont include LDFLAGS in --libs output - ---- - scripts/mysql_config.sh | 6 +++--- - 1 files changed, 3 insertions(+), 3 deletions(-) - -diff --git a/scripts/mysql_config.sh b/scripts/mysql_config.sh -index 7dc9beb..eb188b6 100644 ---- a/scripts/mysql_config.sh -+++ b/scripts/mysql_config.sh -@@ -105,10 +105,10 @@ fi - - # Create options - # We intentionally add a space to the beginning and end of lib strings, simplifies replace later --libs=" $ldflags -L$pkglibdir -lmysqlclient @ZLIB_DEPS@ @NON_THREADED_LIBS@" -+libs=" -L$pkglibdir -lmysqlclient @ZLIB_DEPS@ @NON_THREADED_LIBS@" - libs="$libs @openssl_libs@ @STATIC_NSS_FLAGS@ " --libs_r=" $ldflags -L$pkglibdir -lmysqlclient_r @ZLIB_DEPS@ @LIBS@ @openssl_libs@ " --embedded_libs=" $ldflags -L$pkglibdir -lmysqld @LIBDL@ @ZLIB_DEPS@ @LIBS@ @WRAPLIBS@ @innodb_system_libs@ @openssl_libs@ " -+libs_r=" -L$pkglibdir -lmysqlclient_r @ZLIB_DEPS@ @LIBS@ @openssl_libs@ " -+embedded_libs=" -L$pkglibdir -lmysqld @LIBDL@ @ZLIB_DEPS@ @LIBS@ @WRAPLIBS@ @innodb_system_libs@ @openssl_libs@ " - - if [ -r "$pkglibdir/libmygcc.a" ]; then - # When linking against the static library with a different version of GCC --- -1.7.2.5 - diff --git a/packages/databases/sqlite/package.mk b/packages/databases/sqlite/package.mk index 0f4722917c5..54c72fc8d1d 100644 --- a/packages/databases/sqlite/package.mk +++ b/packages/databases/sqlite/package.mk @@ -17,7 +17,7 @@ ################################################################################ PKG_NAME="sqlite" -PKG_VERSION="autoconf-3110100" +PKG_VERSION="autoconf-3120200" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="PublicDomain" diff --git a/packages/debug/gdb/package.mk b/packages/debug/gdb/package.mk index 3438f881d0d..ab7743b43df 100644 --- a/packages/debug/gdb/package.mk +++ b/packages/debug/gdb/package.mk @@ -23,7 +23,7 @@ PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.gnu.org/software/gdb/" PKG_URL="http://ftp.gnu.org/gnu/gdb/$PKG_NAME-$PKG_VERSION.tar.xz" -PKG_DEPENDS_TARGET="toolchain zlib ncurses expat" +PKG_DEPENDS_TARGET="toolchain zlib netbsd-curses expat" PKG_PRIORITY="optional" PKG_SECTION="debug" PKG_SHORTDESC="gdb: The GNU Debugger" diff --git a/packages/devel/arm-mem/package.mk b/packages/devel/arm-mem/package.mk index 59360647f03..24b1b0b24dd 100644 --- a/packages/devel/arm-mem/package.mk +++ b/packages/devel/arm-mem/package.mk @@ -17,14 +17,14 @@ ################################################################################ PKG_NAME="arm-mem" -PKG_VERSION="4418bb4" +PKG_VERSION="3aee5f4" PKG_REV="1" PKG_ARCH="arm" PKG_LICENSE="GPL" PKG_SITE="https://github.com/bavison/arm-mem" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_URL="https://github.com/bavison/arm-mem/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain" -PKG_DEPENDS_INIT="toolchain" +PKG_DEPENDS_INIT="toolchain arm-mem" PKG_PRIORITY="optional" PKG_SECTION="devel" PKG_SHORTDESC="arm-mem: ARM-accelerated versions of selected functions from string.h" @@ -33,16 +33,11 @@ PKG_LONGDESC="arm-mem is a ARM-accelerated versions of selected functions from s PKG_IS_ADDON="no" PKG_AUTORECONF="no" -if [ "$TARGET_CPU" = "arm1176jzf-s" ]; then - ARMMEM_SO=libarmmem.so -elif [ "$TARGET_CPU" = "cortex-a7" ]; then - ARMMEM_SO=libarmmem-a7.so -fi - -PKG_MAKE_OPTS_TARGET="$ARMMEM_SO" +PKG_MAKE_OPTS_TARGET="libarmmem.so" pre_make_target() { export CROSS_COMPILE=$TARGET_PREFIX + export CFLAGS="$CFLAGS -fPIC" } make_init() { @@ -51,17 +46,17 @@ make_init() { makeinstall_target() { mkdir -p $INSTALL/lib - cp -P $ARMMEM_SO $INSTALL/lib + cp -P libarmmem.so $INSTALL/lib mkdir -p $INSTALL/etc - echo "/lib/$ARMMEM_SO" >> $INSTALL/etc/ld.so.preload + echo "/lib/libarmmem.so" >> $INSTALL/etc/ld.so.preload } makeinstall_init() { mkdir -p $INSTALL/lib - cp -P $ARMMEM_SO $INSTALL/lib + cp -P libarmmem.so $INSTALL/lib mkdir -p $INSTALL/etc - echo "/lib/$ARMMEM_SO" >> $INSTALL/etc/ld.so.preload + echo "/lib/libarmmem.so" >> $INSTALL/etc/ld.so.preload } diff --git a/packages/devel/boost/package.mk b/packages/devel/boost/package.mk index 0ba7d5f8dd3..9e90bccba68 100644 --- a/packages/devel/boost/package.mk +++ b/packages/devel/boost/package.mk @@ -22,7 +22,7 @@ PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="OSS" PKG_SITE="http://www.boost.org/" -PKG_URL="$SOURCEFORGE_SRC/boost/boost/1.56.0/${PKG_NAME}_${PKG_VERSION}.tar.bz2" +PKG_URL="$SOURCEFORGE_SRC/boost/boost/1.60.0/${PKG_NAME}_${PKG_VERSION}.tar.bz2" PKG_SOURCE_DIR="${PKG_NAME}_${PKG_VERSION}" PKG_DEPENDS_HOST="" PKG_DEPENDS_TARGET="toolchain boost:host Python:host zlib bzip2" diff --git a/packages/devel/ccache/package.mk b/packages/devel/ccache/package.mk index 4c0bf82fcb9..7f1a16a5831 100644 --- a/packages/devel/ccache/package.mk +++ b/packages/devel/ccache/package.mk @@ -17,7 +17,7 @@ ################################################################################ PKG_NAME="ccache" -PKG_VERSION="3.2.3" +PKG_VERSION="3.2.5" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" diff --git a/packages/devel/cmake/package.mk b/packages/devel/cmake/package.mk index fac69ee2827..01b92286d32 100644 --- a/packages/devel/cmake/package.mk +++ b/packages/devel/cmake/package.mk @@ -17,13 +17,13 @@ ################################################################################ PKG_NAME="cmake" -PKG_VERSION="3.4.3" +PKG_VERSION="3.5.2" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="BSD" PKG_SITE="http://www.cmake.org/" -PKG_URL="http://www.cmake.org/files/v3.4/$PKG_NAME-$PKG_VERSION.tar.gz" -PKG_DEPENDS_HOST="ccache:host" +PKG_URL="http://www.cmake.org/files/v3.5/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_DEPENDS_HOST="ccache:host libressl:host" PKG_PRIORITY="optional" PKG_SECTION="toolchain/devel" PKG_SHORTDESC="cmake: A cross-platform, open-source make system" @@ -39,6 +39,7 @@ configure_host() { -DCMAKE_C_FLAGS="-O2 -Wall -pipe -Wno-format-security" \ -DCMAKE_CXX_FLAGS="-O2 -Wall -pipe -Wno-format-security" \ -DCMAKE_EXE_LINKER_FLAGS="$HOST_LDFLAGS" \ + -DCMAKE_USE_OPENSSL=ON \ -DBUILD_CursesDialog=0 } diff --git a/packages/devel/configtools/package.mk b/packages/devel/configtools/package.mk new file mode 100644 index 00000000000..0ae46b77783 --- /dev/null +++ b/packages/devel/configtools/package.mk @@ -0,0 +1,34 @@ +################################################################################ +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +################################################################################ + +PKG_NAME="configtools" +PKG_VERSION="706fbe5" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="http://git.savannah.gnu.org/cgit/config.git" +PKG_URL="http://git.savannah.gnu.org/cgit/config.git/snapshot/$PKG_VERSION.tar.xz" +PKG_SOURCE_DIR="$PKG_VERSION*" +PKG_DEPENDS_HOST="" +PKG_SHORTDESC="configtools" +PKG_LONGDESC="configtools" + +make_host() { + : +} + +makeinstall_host() { + mkdir -p $ROOT/$TOOLCHAIN/configtools + cp config.* $ROOT/$TOOLCHAIN/configtools +} diff --git a/packages/devel/crossguid/package.mk b/packages/devel/crossguid/package.mk index 5d80b256db4..415b8e1920c 100644 --- a/packages/devel/crossguid/package.mk +++ b/packages/devel/crossguid/package.mk @@ -22,7 +22,7 @@ PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="https://github.com/graeme-hill/crossguid" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_URL="https://github.com/graeme-hill/crossguid/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain" PKG_PRIORITY="optional" PKG_SECTION="devel" diff --git a/packages/devel/flex/patches/flex-001-plex.malloc.patch b/packages/devel/flex/patches/flex-001-plex.malloc.patch new file mode 100644 index 00000000000..54422ab7b5b --- /dev/null +++ b/packages/devel/flex/patches/flex-001-plex.malloc.patch @@ -0,0 +1,15 @@ +--- a/configure.ac 2015-02-10 15:21:25.466408144 +0100 ++++ b/configure.ac.new 2015-02-10 15:21:08.070408144 +0100 +@@ -106,9 +106,9 @@ + + AC_FUNC_ALLOCA + AC_FUNC_FORK +-AC_FUNC_MALLOC +-AC_FUNC_REALLOC +-AC_CHECK_FUNCS([dup2 isascii memset pow regcomp setlocale strchr strtol]) ++# AC_FUNC_MALLOC ++# AC_FUNC_REALLOC ++AC_CHECK_FUNCS([malloc realloc dup2 isascii memset pow regcomp setlocale strchr strtol]) + + AC_CONFIG_FILES( + Makefile diff --git a/packages/devel/glib/package.mk b/packages/devel/glib/package.mk index 005bf0cab0a..3e69553c6c4 100644 --- a/packages/devel/glib/package.mk +++ b/packages/devel/glib/package.mk @@ -23,7 +23,8 @@ PKG_ARCH="any" PKG_LICENSE="LGPL" PKG_SITE="http://www.gtk.org/" PKG_URL="http://ftp.gnome.org/pub/gnome/sources/glib/2.46/$PKG_NAME-$PKG_VERSION.tar.xz" -PKG_DEPENDS_TARGET="toolchain zlib libffi pcre Python:host" +PKG_DEPENDS_TARGET="toolchain zlib libffi Python:host" +PKG_DEPENDS_HOST="libffi:host" PKG_PRIORITY="optional" PKG_SECTION="devel" PKG_SHORTDESC="glib: C support library" @@ -52,7 +53,7 @@ PKG_CONFIGURE_OPTS_TARGET="ac_cv_func_mmap_fixed_mapped=yes \ --enable-Bsymbolic \ --with-gnu-ld \ --with-threads=posix \ - --with-pcre=system" + --with-pcre=internal" post_makeinstall_target() { mkdir -p $SYSROOT_PREFIX/usr/lib/pkgconfig diff --git a/packages/devel/glibc/package.mk b/packages/devel/glibc/package.mk index 0666a3eeb49..021073377c2 100644 --- a/packages/devel/glibc/package.mk +++ b/packages/devel/glibc/package.mk @@ -34,6 +34,8 @@ PKG_IS_ADDON="no" PKG_AUTORECONF="no" PKG_CONFIGURE_OPTS_TARGET="BASH_SHELL=/bin/sh \ + ac_cv_path_PERL= \ + ac_cv_prog_MAKEINFO= \ --libexecdir=/usr/lib/glibc \ --cache-file=config.cache \ --disable-profile \ @@ -97,12 +99,9 @@ pre_configure_target() { unset LD_LIBRARY_PATH -# set some CFLAGS we need + # set some CFLAGS we need export CFLAGS="$CFLAGS -g -fno-stack-protector -fgnu89-inline" -# dont build parallel - export MAKEFLAGS=-j1 - export BUILD_CC=$HOST_CC export OBJDUMP_FOR_HOST=objdump diff --git a/packages/devel/json-c/package.mk b/packages/devel/json-c/package.mk index 9de67ce682f..0285bb0f195 100644 --- a/packages/devel/json-c/package.mk +++ b/packages/devel/json-c/package.mk @@ -18,12 +18,12 @@ ################################################################################ PKG_NAME="json-c" -PKG_VERSION="0645020" +PKG_VERSION="537f8bc" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="https://github.com/json-c/json-c/wiki" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_URL="https://github.com/json-c/json-c/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain" PKG_PRIORITY="optional" PKG_SECTION="accessibility" diff --git a/packages/devel/libcap/package.mk b/packages/devel/libcap/package.mk index 54a6ce3bfde..8b049e925f4 100644 --- a/packages/devel/libcap/package.mk +++ b/packages/devel/libcap/package.mk @@ -18,14 +18,14 @@ ################################################################################ PKG_NAME="libcap" -PKG_VERSION="2.24" +PKG_VERSION="2.25" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="" PKG_URL="http://www.kernel.org/pub/linux/libs/security/linux-privs/libcap2/$PKG_NAME-$PKG_VERSION.tar.xz" PKG_DEPENDS_HOST="ccache:host" -PKG_DEPENDS_TARGET="toolchain attr" +PKG_DEPENDS_TARGET="toolchain" PKG_PRIORITY="optional" PKG_SECTION="devel" PKG_SHORTDESC="libcap: A library for getting and setting POSIX.1e capabilities" @@ -50,7 +50,7 @@ make_host() { CFLAGS="$HOST_CFLAGS" \ BUILD_CC=$HOST_CC \ BUILD_CFLAGS="$HOST_CFLAGS -I$ROOT/$PKG_BUILD/libcap/include" \ - PAM_CAP=no LIBATTR=no \ + PAM_CAP=no \ lib=/lib \ -C libcap libcap.pc libcap.a } diff --git a/packages/devel/libcec/package.mk b/packages/devel/libcec/package.mk index 2e3327581d4..6d849645acf 100644 --- a/packages/devel/libcec/package.mk +++ b/packages/devel/libcec/package.mk @@ -17,14 +17,13 @@ ################################################################################ PKG_NAME="libcec" -PKG_VERSION="3.0.1" +PKG_VERSION="6d68d21" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://libcec.pulse-eight.com/" -PKG_URL="https://github.com/Pulse-Eight/libcec/archive/$PKG_NAME-$PKG_VERSION.tar.gz" -PKG_SOURCE_DIR="$PKG_NAME-$PKG_NAME-$PKG_VERSION" -PKG_DEPENDS_TARGET="toolchain systemd lockdev platform" +PKG_URL="https://github.com/Pulse-Eight/libcec/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain systemd lockdev p8-platform" PKG_PRIORITY="optional" PKG_SECTION="system" PKG_SHORTDESC="libCEC is an open-source dual licensed library designed for communicating with the Pulse-Eight USB - CEC Adaptor" @@ -44,9 +43,13 @@ else fi if [ "$KODIPLAYER_DRIVER" = "libamcodec" ]; then - EXTRA_CMAKE_OPTS="$EXTRA_CMAKE_OPTS -DHAVE_AMLOGIC_API=1" + if [ "$PROJECT" = "Odroid_C2" ]; then + EXTRA_CMAKE_OPTS="$EXTRA_CMAKE_OPTS -DHAVE_AOCEC_API=1" + else + EXTRA_CMAKE_OPTS="$EXTRA_CMAKE_OPTS -DHAVE_AMLOGIC_API=1" + fi else - EXTRA_CMAKE_OPTS="$EXTRA_CMAKE_OPTS -DHAVE_AMLOGIC_API=0" + EXTRA_CMAKE_OPTS="$EXTRA_CMAKE_OPTS -DHAVE_AOCEC_API=0 -DHAVE_AMLOGIC_API=0" fi configure_target() { @@ -71,5 +74,7 @@ configure_target() { } post_makeinstall_target() { - mv $INSTALL/usr/lib/python2.7/dist-packages $INSTALL/usr/lib/python2.7/site-packages + if [ -d $INSTALL/usr/lib/python2.7/dist-packages ]; then + mv $INSTALL/usr/lib/python2.7/dist-packages $INSTALL/usr/lib/python2.7/site-packages + fi } diff --git a/packages/devel/libcec/patches/libcec-01-add-repeating-keypress.patch b/packages/devel/libcec/patches/libcec-01-add-repeating-keypress.patch deleted file mode 100644 index 8366a696562..00000000000 --- a/packages/devel/libcec/patches/libcec-01-add-repeating-keypress.patch +++ /dev/null @@ -1,859 +0,0 @@ -From ec982e9800ae312972d306b67779215a2add6cde Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Fri, 24 Oct 2014 13:45:21 +0100 -Subject: [PATCH 1/6] Make released key polling wait for exact time until key - gets released - ---- - src/libcec/CECClient.cpp | 16 ++++++++++++++-- - src/libcec/CECClient.h | 2 +- - src/libcec/CECProcessor.cpp | 8 +++++--- - src/libcec/LibCEC.cpp | 10 ++++++++-- - src/libcec/LibCEC.h | 4 +++- - 5 files changed, 31 insertions(+), 9 deletions(-) - -diff --git a/src/libcec/CECClient.cpp b/src/libcec/CECClient.cpp -index 35c2d3e..e307c0e 100644 ---- a/src/libcec/CECClient.cpp -+++ b/src/libcec/CECClient.cpp -@@ -1067,7 +1067,7 @@ void CCECClient::SetCurrentButton(const cec_user_control_code iButtonCode) - AddKey(key); - } - --void CCECClient::CheckKeypressTimeout(void) -+uint16_t CCECClient::CheckKeypressTimeout(void) - { - cec_keypress key; - -@@ -1091,12 +1091,24 @@ void CCECClient::CheckKeypressTimeout(void) - } - else - { -- return; -+ // time when this keypress will be released and we'd like to be called again -+ unsigned int timeout = CEC_PROCESSOR_SIGNAL_WAIT_TIME; -+ if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && m_iCurrentButton == comboKey && iTimeoutMs > 0) -+ timeout = iTimeoutMs - (iNow - m_buttontime) + 1; -+ else if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && m_iCurrentButton != comboKey) -+ timeout = CEC_BUTTON_TIMEOUT - (iNow - m_buttontime) + 1; -+ if (timeout > CEC_PROCESSOR_SIGNAL_WAIT_TIME) -+ { -+ LIB_CEC->AddLog(CEC_LOG_ERROR, "Unexpected timeout: %d (%.3f %.3f %.3f) k:%02x", timeout, iNow*1e-3, m_buttontime*1e-3, CEC_BUTTON_TIMEOUT*1e-3, m_iCurrentButton); -+ timeout = CEC_PROCESSOR_SIGNAL_WAIT_TIME; -+ } -+ return timeout; - } - } - - LIB_CEC->AddLog(CEC_LOG_DEBUG, "key auto-released: %s (%1x)", ToString(key.keycode), key.keycode); - QueueAddKey(key); -+ return CEC_PROCESSOR_SIGNAL_WAIT_TIME; - } - - bool CCECClient::EnableCallbacks(void *cbParam, ICECCallbacks *callbacks) -diff --git a/src/libcec/CECClient.h b/src/libcec/CECClient.h -index 12f8a3b..c9ce5e3 100644 ---- a/src/libcec/CECClient.h -+++ b/src/libcec/CECClient.h -@@ -272,7 +272,7 @@ namespace CEC - virtual void AddKey(bool bSendComboKey = false); - virtual void AddKey(const cec_keypress &key); - virtual void SetCurrentButton(const cec_user_control_code iButtonCode); -- virtual void CheckKeypressTimeout(void); -+ virtual uint16_t CheckKeypressTimeout(void); - virtual void SourceActivated(const cec_logical_address logicalAddress); - virtual void SourceDeactivated(const cec_logical_address logicalAddress); - -diff --git a/src/libcec/CECProcessor.cpp b/src/libcec/CECProcessor.cpp -index 99f71aa..604b950 100644 ---- a/src/libcec/CECProcessor.cpp -+++ b/src/libcec/CECProcessor.cpp -@@ -52,7 +52,6 @@ - using namespace CEC; - using namespace PLATFORM; - --#define CEC_PROCESSOR_SIGNAL_WAIT_TIME 1000 - #define ACTIVE_SOURCE_CHECK_INTERVAL 500 - #define TV_PRESENT_CHECK_INTERVAL 30000 - -@@ -260,6 +259,7 @@ bool CCECProcessor::OnCommandReceived(const cec_command &command) - - void *CCECProcessor::Process(void) - { -+ uint16_t timeout = CEC_PROCESSOR_SIGNAL_WAIT_TIME; - m_libcec->AddLog(CEC_LOG_DEBUG, "processor thread started"); - - if (!m_connCheck) -@@ -274,13 +274,13 @@ void *CCECProcessor::Process(void) - while (!IsStopped() && m_communication->IsOpen()) - { - // wait for a new incoming command, and process it -- if (m_inBuffer.Pop(command, CEC_PROCESSOR_SIGNAL_WAIT_TIME)) -+ if (m_inBuffer.Pop(command, timeout)) - ProcessCommand(command); - - if (CECInitialised() && !IsStopped()) - { - // check clients for keypress timeouts -- m_libcec->CheckKeypressTimeout(); -+ timeout = m_libcec->CheckKeypressTimeout(); - - // check if we need to replace handlers - ReplaceHandlers(); -@@ -311,6 +311,8 @@ void *CCECProcessor::Process(void) - tvPresentCheck.Init(TV_PRESENT_CHECK_INTERVAL); - } - } -+ else -+ timeout = CEC_PROCESSOR_SIGNAL_WAIT_TIME; - } - - return NULL; -diff --git a/src/libcec/LibCEC.cpp b/src/libcec/LibCEC.cpp -index af36b79..5ccb8dd 100644 ---- a/src/libcec/LibCEC.cpp -+++ b/src/libcec/LibCEC.cpp -@@ -361,11 +361,17 @@ bool CLibCEC::IsValidPhysicalAddress(uint16_t iPhysicalAddress) - iPhysicalAddress <= CEC_MAX_PHYSICAL_ADDRESS; - } - --void CLibCEC::CheckKeypressTimeout(void) -+uint16_t CLibCEC::CheckKeypressTimeout(void) - { -+ uint16_t timeout = CEC_PROCESSOR_SIGNAL_WAIT_TIME; - // check all clients - for (std::vector::iterator it = m_clients.begin(); it != m_clients.end(); it++) -- (*it)->CheckKeypressTimeout(); -+ { -+ uint16_t t = (*it)->CheckKeypressTimeout(); -+ if (t < timeout) -+ timeout = t; -+ } -+ return timeout; - } - - void CLibCEC::AddLog(const cec_log_level level, const char *strFormat, ...) -diff --git a/src/libcec/LibCEC.h b/src/libcec/LibCEC.h -index 6d9a229..d9d1e7b 100644 ---- a/src/libcec/LibCEC.h -+++ b/src/libcec/LibCEC.h -@@ -39,6 +39,8 @@ - #include "CECTypeUtils.h" - #include - -+#define CEC_PROCESSOR_SIGNAL_WAIT_TIME 1000 -+ - namespace CEC - { - class CAdapterCommunication; -@@ -125,7 +127,7 @@ namespace CEC - - void AddLog(const cec_log_level level, const char *strFormat, ...); - void AddCommand(const cec_command &command); -- void CheckKeypressTimeout(void); -+ uint16_t CheckKeypressTimeout(void); - void Alert(const libcec_alert type, const libcec_parameter ¶m); - - static bool IsValidPhysicalAddress(uint16_t iPhysicalAddress); --- -1.9.1 - - -From 41f0f3ec9ac136da3565c96fd5a7075499f3938d Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Fri, 24 Oct 2014 13:51:34 +0100 -Subject: [PATCH 2/6] Keep track of time since initial button press and last - button update - ---- - src/libcec/CECClient.cpp | 44 +++++++++++++++++++++++++++----------------- - src/libcec/CECClient.h | 3 ++- - 2 files changed, 29 insertions(+), 18 deletions(-) - -diff --git a/src/libcec/CECClient.cpp b/src/libcec/CECClient.cpp -index e307c0e..e7935b9 100644 ---- a/src/libcec/CECClient.cpp -+++ b/src/libcec/CECClient.cpp -@@ -54,7 +54,8 @@ CCECClient::CCECClient(CCECProcessor *processor, const libcec_configuration &con - m_bInitialised(false), - m_bRegistered(false), - m_iCurrentButton(CEC_USER_CONTROL_CODE_UNKNOWN), -- m_buttontime(0), -+ m_initialButtontime(0), -+ m_updateButtontime(0), - m_iPreventForwardingPowerOffCommand(0), - m_iLastKeypressTime(0) - { -@@ -981,9 +982,10 @@ void CCECClient::AddKey(bool bSendComboKey /* = false */) - CLockObject lock(m_mutex); - if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN) - { -- key.duration = (unsigned int) (GetTimeMs() - m_buttontime); -+ unsigned int duration = (unsigned int) (GetTimeMs() - m_updateButtontime); -+ key.duration = (unsigned int) (GetTimeMs() - m_initialButtontime); - -- if (key.duration > m_configuration.iComboKeyTimeoutMs || -+ if (duration > m_configuration.iComboKeyTimeoutMs || - m_configuration.iComboKeyTimeoutMs == 0 || - m_iCurrentButton != m_configuration.comboKey || - bSendComboKey) -@@ -991,14 +993,15 @@ void CCECClient::AddKey(bool bSendComboKey /* = false */) - key.keycode = m_iCurrentButton; - - m_iCurrentButton = CEC_USER_CONTROL_CODE_UNKNOWN; -- m_buttontime = 0; -+ m_initialButtontime = 0; -+ m_updateButtontime = 0; - } - } - } - - if (key.keycode != CEC_USER_CONTROL_CODE_UNKNOWN) - { -- LIB_CEC->AddLog(CEC_LOG_DEBUG, "key released: %s (%1x)", ToString(key.keycode), key.keycode); -+ LIB_CEC->AddLog(CEC_LOG_DEBUG, "key released: %s (%1x) D:%dms", ToString(key.keycode), key.keycode, key.duration); - QueueAddKey(key); - } - } -@@ -1012,7 +1015,7 @@ void CCECClient::AddKey(const cec_keypress &key) - AddKey(); - return; - } -- -+ bool isrepeat = false; - cec_keypress transmitKey(key); - cec_user_control_code comboKey(m_configuration.clientVersion >= LIBCEC_VERSION_TO_UINT(2, 0, 5) ? - m_configuration.comboKey : CEC_USER_CONTROL_CODE_STOP); -@@ -1035,22 +1038,27 @@ void CCECClient::AddKey(const cec_keypress &key) - AddKey(true); - } - -+ LIB_CEC->AddLog(CEC_LOG_DEBUG, "key pressed: %s (%1x) current(%lx) duration(%d)", ToString(transmitKey.keycode), transmitKey.keycode, m_iCurrentButton, key.duration); -+ - if (m_iCurrentButton == key.keycode) - { -- m_buttontime = GetTimeMs(); -+ m_updateButtontime = GetTimeMs(); -+ isrepeat = true; - } - else - { -- AddKey(); -+ if (m_iCurrentButton != transmitKey.keycode) -+ AddKey(); - if (key.duration == 0) - { - m_iCurrentButton = transmitKey.keycode; -- m_buttontime = m_iCurrentButton == CEC_USER_CONTROL_CODE_UNKNOWN || key.duration > 0 ? 0 : GetTimeMs(); -+ m_initialButtontime = m_iCurrentButton == CEC_USER_CONTROL_CODE_UNKNOWN || key.duration > 0 ? 0 : GetTimeMs(); -+ m_updateButtontime = m_initialButtontime; - } - } - } - -- if (key.keycode != comboKey || key.duration > 0) -+ if (!isrepeat && (key.keycode != comboKey || key.duration > 0)) - { - LIB_CEC->AddLog(CEC_LOG_DEBUG, "key pressed: %s (%1x)", ToString(transmitKey.keycode), transmitKey.keycode); - QueueAddKey(transmitKey); -@@ -1074,32 +1082,34 @@ uint16_t CCECClient::CheckKeypressTimeout(void) - { - CLockObject lock(m_mutex); - uint64_t iNow = GetTimeMs(); -+ LIB_CEC->AddLog(CEC_LOG_DEBUG, "%s T:%.3f", __FUNCTION__, iNow*1e-3); - cec_user_control_code comboKey(m_configuration.clientVersion >= LIBCEC_VERSION_TO_UINT(2, 0, 5) ? - m_configuration.comboKey : CEC_USER_CONTROL_CODE_STOP); - uint32_t iTimeoutMs(m_configuration.clientVersion >= LIBCEC_VERSION_TO_UINT(2, 0, 5) ? - m_configuration.iComboKeyTimeoutMs : CEC_DEFAULT_COMBO_TIMEOUT_MS); - - if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && -- ((m_iCurrentButton == comboKey && iTimeoutMs > 0 && iNow - m_buttontime > iTimeoutMs) || -- (m_iCurrentButton != comboKey && iNow - m_buttontime > CEC_BUTTON_TIMEOUT))) -+ ((m_iCurrentButton == comboKey && iTimeoutMs > 0 && iNow - m_updateButtontime > iTimeoutMs) || -+ (m_iCurrentButton != comboKey && iNow - m_updateButtontime > CEC_BUTTON_TIMEOUT))) - { -- key.duration = (unsigned int) (iNow - m_buttontime); -+ key.duration = (unsigned int) (iNow - m_initialButtontime); - key.keycode = m_iCurrentButton; - - m_iCurrentButton = CEC_USER_CONTROL_CODE_UNKNOWN; -- m_buttontime = 0; -+ m_initialButtontime = 0; -+ m_updateButtontime = 0; - } - else - { - // time when this keypress will be released and we'd like to be called again - unsigned int timeout = CEC_PROCESSOR_SIGNAL_WAIT_TIME; - if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && m_iCurrentButton == comboKey && iTimeoutMs > 0) -- timeout = iTimeoutMs - (iNow - m_buttontime) + 1; -+ timeout = iTimeoutMs - (iNow - m_updateButtontime) + 1; - else if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && m_iCurrentButton != comboKey) -- timeout = CEC_BUTTON_TIMEOUT - (iNow - m_buttontime) + 1; -+ timeout = CEC_BUTTON_TIMEOUT - (iNow - m_updateButtontime) + 1; - if (timeout > CEC_PROCESSOR_SIGNAL_WAIT_TIME) - { -- LIB_CEC->AddLog(CEC_LOG_ERROR, "Unexpected timeout: %d (%.3f %.3f %.3f) k:%02x", timeout, iNow*1e-3, m_buttontime*1e-3, CEC_BUTTON_TIMEOUT*1e-3, m_iCurrentButton); -+ LIB_CEC->AddLog(CEC_LOG_ERROR, "Unexpected timeout: %d (%.3f %.3f %.3f) k:%02x", timeout, iNow*1e-3, m_updateButtontime*1e-3, CEC_BUTTON_TIMEOUT*1e-3, m_iCurrentButton); - timeout = CEC_PROCESSOR_SIGNAL_WAIT_TIME; - } - return timeout; -diff --git a/src/libcec/CECClient.h b/src/libcec/CECClient.h -index c9ce5e3..611c68b 100644 ---- a/src/libcec/CECClient.h -+++ b/src/libcec/CECClient.h -@@ -404,7 +404,8 @@ namespace CEC - PLATFORM::CMutex m_mutex; /**< mutex for changes to this instance */ - PLATFORM::CMutex m_cbMutex; /**< mutex that is held when doing anything with callbacks */ - cec_user_control_code m_iCurrentButton; /**< the control code of the button that's currently held down (if any) */ -- int64_t m_buttontime; /**< the timestamp when the button was pressed (in seconds since epoch), or 0 if none was pressed. */ -+ int64_t m_initialButtontime; /**< the timestamp when the button was initially pressed (in seconds since epoch), or 0 if none was pressed. */ -+ int64_t m_updateButtontime; /**< the timestamp when the button was updated (in seconds since epoch), or 0 if none was pressed. */ - int64_t m_iPreventForwardingPowerOffCommand; /**< prevent forwarding standby commands until this time */ - int64_t m_iLastKeypressTime; /**< last time a key press was sent to the client */ - cec_keypress m_lastKeypress; /**< the last key press that was sent to the client */ --- -1.9.1 - - -From 273ead6980b69eddf98810eb1eb33d94a7d74fce Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Tue, 28 Oct 2014 00:09:18 +0000 -Subject: [PATCH 3/6] Support repeating button presses with configurable repeat - rate - ---- - include/cectypes.h | 6 ++ - src/libcec/CECClient.cpp | 100 +++++++++++++++++++---- - src/libcec/CECClient.h | 6 +- - src/libcec/implementations/CECCommandHandler.cpp | 2 +- - 4 files changed, 96 insertions(+), 18 deletions(-) - -diff --git a/include/cectypes.h b/include/cectypes.h -index acff259..8f098ef 100644 ---- a/include/cectypes.h -+++ b/include/cectypes.h -@@ -1493,6 +1493,8 @@ struct libcec_configuration - XXX changed meaning in 2.2.0 to not break binary compatibility. next major (3.0) release will fix it in a nicer way */ - cec_user_control_code comboKey; /*!< key code that initiates combo keys. defaults to CEC_USER_CONTROL_CODE_F1_BLUE. CEC_USER_CONTROL_CODE_UNKNOWN to disable. added in 2.0.5 */ - uint32_t iComboKeyTimeoutMs; /*!< timeout until the combo key is sent as normal keypress */ -+ uint32_t iButtonRepeatRateMs; /*!< rate at which buttons autorepeat. 0 means rely on CEC device */ -+ uint32_t iButtonReleaseDelayMs;/*!< duration after last update until a button is considered released */ - - #ifdef __cplusplus - libcec_configuration(void) { Clear(); } -@@ -1527,6 +1529,8 @@ struct libcec_configuration - cecVersion == other.cecVersion && - adapterType == other.adapterType && - iDoubleTapTimeout50Ms == other.iDoubleTapTimeout50Ms && -+ iButtonRepeatRateMs == other.iButtonRepeatRateMs && -+ iButtonReleaseDelayMs == other.iButtonReleaseDelayMs && - (other.clientVersion <= LIBCEC_VERSION_TO_UINT(2, 0, 4) || comboKey == other.comboKey) && - (other.clientVersion <= LIBCEC_VERSION_TO_UINT(2, 0, 4) || iComboKeyTimeoutMs == other.iComboKeyTimeoutMs) && - (other.clientVersion < LIBCEC_VERSION_TO_UINT(2, 1, 0) || bPowerOnScreensaver == other.bPowerOnScreensaver)); -@@ -1567,6 +1571,8 @@ struct libcec_configuration - iDoubleTapTimeout50Ms = CEC_DOUBLE_TAP_TIMEOUT_50_MS; - comboKey = CEC_USER_CONTROL_CODE_STOP; - iComboKeyTimeoutMs = CEC_DEFAULT_COMBO_TIMEOUT_MS; -+ iButtonRepeatRateMs = 0; -+ iButtonReleaseDelayMs = CEC_BUTTON_TIMEOUT; - - memset(strDeviceName, 0, 13); - deviceTypes.Clear(); -diff --git a/src/libcec/CECClient.cpp b/src/libcec/CECClient.cpp -index e7935b9..598628d 100644 ---- a/src/libcec/CECClient.cpp -+++ b/src/libcec/CECClient.cpp -@@ -56,6 +56,10 @@ CCECClient::CCECClient(CCECProcessor *processor, const libcec_configuration &con - m_iCurrentButton(CEC_USER_CONTROL_CODE_UNKNOWN), - m_initialButtontime(0), - m_updateButtontime(0), -+ m_repeatButtontime(0), -+ m_releaseButtontime(0), -+ m_pressedButtoncount(0), -+ m_releasedButtoncount(0), - m_iPreventForwardingPowerOffCommand(0), - m_iLastKeypressTime(0) - { -@@ -851,6 +855,9 @@ bool CCECClient::GetCurrentConfiguration(libcec_configuration &configuration) - configuration.bMonitorOnly = m_configuration.bMonitorOnly; - configuration.cecVersion = m_configuration.cecVersion; - configuration.adapterType = m_configuration.adapterType; -+ configuration.iDoubleTapTimeout50Ms = m_configuration.iDoubleTapTimeout50Ms; -+ configuration.iButtonRepeatRateMs = m_configuration.iButtonRepeatRateMs; -+ configuration.iButtonReleaseDelayMs = m_configuration.iButtonReleaseDelayMs; - - return true; - } -@@ -894,6 +901,9 @@ bool CCECClient::SetConfiguration(const libcec_configuration &configuration) - m_configuration.cecVersion = configuration.cecVersion; - m_configuration.adapterType = configuration.adapterType; - m_configuration.iDoubleTapTimeout50Ms = configuration.iDoubleTapTimeout50Ms; -+ m_configuration.iButtonRepeatRateMs = configuration.iButtonRepeatRateMs; -+ m_configuration.iButtonReleaseDelayMs = configuration.iButtonReleaseDelayMs; -+ - m_configuration.deviceTypes.Add(configuration.deviceTypes[0]); - - if (m_configuration.clientVersion >= LIBCEC_VERSION_TO_UINT(2, 0, 5)) -@@ -950,6 +960,7 @@ bool CCECClient::SetConfiguration(const libcec_configuration &configuration) - primary->ActivateSource(); - } - -+ LIB_CEC->AddLog(CEC_LOG_DEBUG, "%s: %d:%d:%d", __FUNCTION__, DoubleTapTimeoutMS(), m_configuration.iButtonRepeatRateMs, m_configuration.iButtonReleaseDelayMs); - return true; - } - -@@ -973,11 +984,15 @@ void CCECClient::AddCommand(const cec_command &command) - } - } - --void CCECClient::AddKey(bool bSendComboKey /* = false */) -+void CCECClient::AddKey(bool bSendComboKey /* = false */, bool bButtonRelease /* = false */) - { - cec_keypress key; - key.keycode = CEC_USER_CONTROL_CODE_UNKNOWN; - -+ // we ignore button releases when supporting repeating keys -+ if (bButtonRelease && m_configuration.iButtonRepeatRateMs && m_configuration.iButtonReleaseDelayMs) -+ return; -+ - { - CLockObject lock(m_mutex); - if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN) -@@ -995,6 +1010,10 @@ void CCECClient::AddKey(bool bSendComboKey /* = false */) - m_iCurrentButton = CEC_USER_CONTROL_CODE_UNKNOWN; - m_initialButtontime = 0; - m_updateButtontime = 0; -+ m_repeatButtontime = 0; -+ m_releaseButtontime = 0; -+ m_pressedButtoncount = 0; -+ m_releasedButtoncount = 0; - } - } - } -@@ -1012,6 +1031,7 @@ void CCECClient::AddKey(const cec_keypress &key) - key.keycode < CEC_USER_CONTROL_CODE_SELECT) - { - // send back the previous key if there is one -+ LIB_CEC->AddLog(CEC_LOG_DEBUG, "Unexpected key %s (%1x) D:%dms", ToString(key.keycode), key.keycode, key.duration); - AddKey(); - return; - } -@@ -1035,7 +1055,10 @@ void CCECClient::AddKey(const cec_keypress &key) - transmitKey.keycode = CEC_USER_CONTROL_CODE_DOT; - // default, send back the previous key - else -+ { -+ LIB_CEC->AddLog(CEC_LOG_DEBUG, "Combo key %s (%1x) D%dms:", ToString(key.keycode), key.keycode, key.duration); - AddKey(true); -+ } - } - - LIB_CEC->AddLog(CEC_LOG_DEBUG, "key pressed: %s (%1x) current(%lx) duration(%d)", ToString(transmitKey.keycode), transmitKey.keycode, m_iCurrentButton, key.duration); -@@ -1043,17 +1066,44 @@ void CCECClient::AddKey(const cec_keypress &key) - if (m_iCurrentButton == key.keycode) - { - m_updateButtontime = GetTimeMs(); -- isrepeat = true; -+ m_releaseButtontime = m_updateButtontime + (m_configuration.iButtonReleaseDelayMs ? m_configuration.iButtonReleaseDelayMs : CEC_BUTTON_TIMEOUT); -+ // want to have seen some updated before considering a repeat -+ if (m_configuration.iButtonRepeatRateMs) -+ { -+ if (!m_repeatButtontime && m_pressedButtoncount > 1) -+ m_repeatButtontime = m_initialButtontime + DoubleTapTimeoutMS(); -+ isrepeat = true; -+ } -+ m_pressedButtoncount++; - } - else - { - if (m_iCurrentButton != transmitKey.keycode) -+ { -+ LIB_CEC->AddLog(CEC_LOG_DEBUG, "Changed key %s (%1x) D:%dms cur:%lx", ToString(transmitKey.keycode), transmitKey.keycode, transmitKey.duration, m_iCurrentButton); - AddKey(); -+ } - if (key.duration == 0) - { - m_iCurrentButton = transmitKey.keycode; -- m_initialButtontime = m_iCurrentButton == CEC_USER_CONTROL_CODE_UNKNOWN || key.duration > 0 ? 0 : GetTimeMs(); -- m_updateButtontime = m_initialButtontime; -+ if (m_iCurrentButton == CEC_USER_CONTROL_CODE_UNKNOWN) -+ { -+ m_initialButtontime = 0; -+ m_updateButtontime = 0; -+ m_repeatButtontime = 0; -+ m_releaseButtontime = 0; -+ m_pressedButtoncount = 0; -+ m_releasedButtoncount = 0; -+ } -+ else -+ { -+ m_initialButtontime = GetTimeMs(); -+ m_updateButtontime = m_initialButtontime; -+ m_repeatButtontime = 0; // set this on next update -+ m_releaseButtontime = m_initialButtontime + (m_configuration.iButtonReleaseDelayMs ? m_configuration.iButtonReleaseDelayMs : CEC_BUTTON_TIMEOUT); -+ m_pressedButtoncount = 1; -+ m_releasedButtoncount = 0; -+ } - } - } - } -@@ -1072,12 +1122,16 @@ void CCECClient::SetCurrentButton(const cec_user_control_code iButtonCode) - key.duration = 0; - key.keycode = iButtonCode; - -+ LIB_CEC->AddLog(CEC_LOG_DEBUG, "SetCurrentButton %s (%1x) D:%dms cur:%lx", ToString(key.keycode), key.keycode, key.duration); - AddKey(key); - } - - uint16_t CCECClient::CheckKeypressTimeout(void) - { -+ // time when we'd like to be called again -+ unsigned int timeout = CEC_PROCESSOR_SIGNAL_WAIT_TIME; - cec_keypress key; -+ key.keycode = CEC_USER_CONTROL_CODE_UNKNOWN; - - { - CLockObject lock(m_mutex); -@@ -1089,8 +1143,8 @@ uint16_t CCECClient::CheckKeypressTimeout(void) - m_configuration.iComboKeyTimeoutMs : CEC_DEFAULT_COMBO_TIMEOUT_MS); - - if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && -- ((m_iCurrentButton == comboKey && iTimeoutMs > 0 && iNow - m_updateButtontime > iTimeoutMs) || -- (m_iCurrentButton != comboKey && iNow - m_updateButtontime > CEC_BUTTON_TIMEOUT))) -+ ((m_iCurrentButton == comboKey && iTimeoutMs > 0 && iNow - m_updateButtontime >= iTimeoutMs) || -+ (m_iCurrentButton != comboKey && m_releaseButtontime && iNow >= (uint64_t)m_releaseButtontime))) - { - key.duration = (unsigned int) (iNow - m_initialButtontime); - key.keycode = m_iCurrentButton; -@@ -1098,27 +1152,41 @@ uint16_t CCECClient::CheckKeypressTimeout(void) - m_iCurrentButton = CEC_USER_CONTROL_CODE_UNKNOWN; - m_initialButtontime = 0; - m_updateButtontime = 0; -+ m_repeatButtontime = 0; -+ m_releaseButtontime = 0; -+ m_pressedButtoncount = 0; -+ m_releasedButtoncount = 0; -+ } -+ else if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && -+ (m_iCurrentButton != comboKey && m_repeatButtontime && iNow >= (uint64_t)m_repeatButtontime)) -+ { -+ key.duration = 0; -+ key.keycode = m_iCurrentButton; -+ m_repeatButtontime = iNow + m_configuration.iButtonRepeatRateMs; -+ timeout = std::min((uint64_t)timeout, m_repeatButtontime - iNow); - } - else - { -- // time when this keypress will be released and we'd like to be called again -- unsigned int timeout = CEC_PROCESSOR_SIGNAL_WAIT_TIME; - if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && m_iCurrentButton == comboKey && iTimeoutMs > 0) -- timeout = iTimeoutMs - (iNow - m_updateButtontime) + 1; -- else if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && m_iCurrentButton != comboKey) -- timeout = CEC_BUTTON_TIMEOUT - (iNow - m_updateButtontime) + 1; -+ timeout = std::min((uint64_t)timeout, m_updateButtontime - iNow + iTimeoutMs); -+ if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && m_iCurrentButton != comboKey && m_releaseButtontime) -+ timeout = std::min((uint64_t)timeout, m_releaseButtontime - iNow); -+ if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && m_iCurrentButton != comboKey && m_repeatButtontime) -+ timeout = std::min((uint64_t)timeout, m_repeatButtontime - iNow); - if (timeout > CEC_PROCESSOR_SIGNAL_WAIT_TIME) - { -- LIB_CEC->AddLog(CEC_LOG_ERROR, "Unexpected timeout: %d (%.3f %.3f %.3f) k:%02x", timeout, iNow*1e-3, m_updateButtontime*1e-3, CEC_BUTTON_TIMEOUT*1e-3, m_iCurrentButton); -+ LIB_CEC->AddLog(CEC_LOG_ERROR, "Unexpected timeout: %d (%.3f %.3f %.3f) k:%02x", timeout, iNow*1e-3, m_updateButtontime*1e-3, m_releaseButtontime*1e-3, m_iCurrentButton); - timeout = CEC_PROCESSOR_SIGNAL_WAIT_TIME; - } -- return timeout; - } -+ LIB_CEC->AddLog(CEC_LOG_DEBUG, "key %s: %s (%1x) timeout:%dms (rel:%d,rep:%d,prs:%d,rel:%d)", key.keycode == CEC_USER_CONTROL_CODE_UNKNOWN ? "idle" : key.duration ? "released" : "repeated", -+ ToString(m_iCurrentButton), m_iCurrentButton, timeout, (int)(m_releaseButtontime ? m_releaseButtontime - iNow : 0), (int)(m_repeatButtontime ? m_repeatButtontime - iNow : 0), m_pressedButtoncount, m_releasedButtoncount); - } - -- LIB_CEC->AddLog(CEC_LOG_DEBUG, "key auto-released: %s (%1x)", ToString(key.keycode), key.keycode); -- QueueAddKey(key); -- return CEC_PROCESSOR_SIGNAL_WAIT_TIME; -+ if (key.keycode != CEC_USER_CONTROL_CODE_UNKNOWN) -+ QueueAddKey(key); -+ -+ return timeout; - } - - bool CCECClient::EnableCallbacks(void *cbParam, ICECCallbacks *callbacks) -diff --git a/src/libcec/CECClient.h b/src/libcec/CECClient.h -index 611c68b..adeb5af 100644 ---- a/src/libcec/CECClient.h -+++ b/src/libcec/CECClient.h -@@ -269,7 +269,7 @@ namespace CEC - // callbacks - virtual void Alert(const libcec_alert type, const libcec_parameter ¶m) { QueueAlert(type, param); } - virtual void AddLog(const cec_log_message &message) { QueueAddLog(message); } -- virtual void AddKey(bool bSendComboKey = false); -+ virtual void AddKey(bool bSendComboKey = false, bool bButtonRelease = false); - virtual void AddKey(const cec_keypress &key); - virtual void SetCurrentButton(const cec_user_control_code iButtonCode); - virtual uint16_t CheckKeypressTimeout(void); -@@ -406,6 +406,10 @@ namespace CEC - cec_user_control_code m_iCurrentButton; /**< the control code of the button that's currently held down (if any) */ - int64_t m_initialButtontime; /**< the timestamp when the button was initially pressed (in seconds since epoch), or 0 if none was pressed. */ - int64_t m_updateButtontime; /**< the timestamp when the button was updated (in seconds since epoch), or 0 if none was pressed. */ -+ int64_t m_repeatButtontime; /**< the timestamp when the button will next repeat (in seconds since epoch), or 0 if repeat is disabled. */ -+ int64_t m_releaseButtontime; /**< the timestamp when the button will be released (in seconds since epoch), or 0 if none was pressed. */ -+ int32_t m_pressedButtoncount; /**< the number of times a button released message has been seen for this press. */ -+ int32_t m_releasedButtoncount; /**< the number of times a button pressed message has been seen for this press. */ - int64_t m_iPreventForwardingPowerOffCommand; /**< prevent forwarding standby commands until this time */ - int64_t m_iLastKeypressTime; /**< last time a key press was sent to the client */ - cec_keypress m_lastKeypress; /**< the last key press that was sent to the client */ -diff --git a/src/libcec/implementations/CECCommandHandler.cpp b/src/libcec/implementations/CECCommandHandler.cpp -index 6d6244e..d64186f 100644 ---- a/src/libcec/implementations/CECCommandHandler.cpp -+++ b/src/libcec/implementations/CECCommandHandler.cpp -@@ -770,7 +770,7 @@ int CCECCommandHandler::HandleUserControlRelease(const cec_command &command) - - CECClientPtr client = m_processor->GetClient(command.destination); - if (client) -- client->AddKey(); -+ client->AddKey(false, true); - - return COMMAND_HANDLED; - } --- -1.9.1 - - -From 3336d0827f7fd159430f3431642b07090c06c869 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Tue, 28 Oct 2014 01:21:35 +0000 -Subject: [PATCH 4/6] Skip double press removal. It is handled through other - means. - ---- - src/libcec/CECClient.cpp | 18 +----------------- - src/libcec/CECClient.h | 2 -- - 2 files changed, 1 insertion(+), 19 deletions(-) - -diff --git a/src/libcec/CECClient.cpp b/src/libcec/CECClient.cpp -index 598628d..dccd874 100644 ---- a/src/libcec/CECClient.cpp -+++ b/src/libcec/CECClient.cpp -@@ -60,11 +60,8 @@ CCECClient::CCECClient(CCECProcessor *processor, const libcec_configuration &con - m_releaseButtontime(0), - m_pressedButtoncount(0), - m_releasedButtoncount(0), -- m_iPreventForwardingPowerOffCommand(0), -- m_iLastKeypressTime(0) -+ m_iPreventForwardingPowerOffCommand(0) - { -- m_lastKeypress.keycode = CEC_USER_CONTROL_CODE_UNKNOWN; -- m_lastKeypress.duration = 0; - m_configuration.Clear(); - // set the initial configuration - SetConfiguration(configuration); -@@ -1647,20 +1644,7 @@ void CCECClient::CallbackAddKey(const cec_keypress &key) - { - CLockObject lock(m_cbMutex); - if (m_configuration.callbacks && m_configuration.callbacks->CBCecKeyPress) -- { -- // prevent double taps -- int64_t now = GetTimeMs(); -- if (m_lastKeypress.keycode != key.keycode || -- key.duration > 0 || -- now - m_iLastKeypressTime >= DoubleTapTimeoutMS()) -- { -- // no double tap -- if (key.duration == 0) -- m_iLastKeypressTime = now; -- m_lastKeypress = key; - m_configuration.callbacks->CBCecKeyPress(m_configuration.callbackParam, key); -- } -- } - } - - void CCECClient::CallbackAddLog(const cec_log_message &message) -diff --git a/src/libcec/CECClient.h b/src/libcec/CECClient.h -index adeb5af..43a713b 100644 ---- a/src/libcec/CECClient.h -+++ b/src/libcec/CECClient.h -@@ -411,8 +411,6 @@ namespace CEC - int32_t m_pressedButtoncount; /**< the number of times a button released message has been seen for this press. */ - int32_t m_releasedButtoncount; /**< the number of times a button pressed message has been seen for this press. */ - int64_t m_iPreventForwardingPowerOffCommand; /**< prevent forwarding standby commands until this time */ -- int64_t m_iLastKeypressTime; /**< last time a key press was sent to the client */ -- cec_keypress m_lastKeypress; /**< the last key press that was sent to the client */ - PLATFORM::SyncedBuffer m_callbackCalls; - }; - } --- -1.9.1 - - -From 0dd0234f620a546bfa843172648383f83d88088c Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Mon, 3 Nov 2014 23:28:04 +0000 -Subject: [PATCH 5/6] Pass through duration on all button repeats - ---- - src/libcec/CECClient.cpp | 34 ++++++++++++++++++++++++---------- - 1 file changed, 24 insertions(+), 10 deletions(-) - -diff --git a/src/libcec/CECClient.cpp b/src/libcec/CECClient.cpp -index dccd874..1946148 100644 ---- a/src/libcec/CECClient.cpp -+++ b/src/libcec/CECClient.cpp -@@ -986,10 +986,6 @@ void CCECClient::AddKey(bool bSendComboKey /* = false */, bool bButtonRelease /* - cec_keypress key; - key.keycode = CEC_USER_CONTROL_CODE_UNKNOWN; - -- // we ignore button releases when supporting repeating keys -- if (bButtonRelease && m_configuration.iButtonRepeatRateMs && m_configuration.iButtonReleaseDelayMs) -- return; -- - { - CLockObject lock(m_mutex); - if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN) -@@ -1015,6 +1011,10 @@ void CCECClient::AddKey(bool bSendComboKey /* = false */, bool bButtonRelease /* - } - } - -+ // we don't forward releases when supporting repeating keys -+ if (bButtonRelease && m_configuration.iButtonRepeatRateMs) -+ return; -+ - if (key.keycode != CEC_USER_CONTROL_CODE_UNKNOWN) - { - LIB_CEC->AddLog(CEC_LOG_DEBUG, "key released: %s (%1x) D:%dms", ToString(key.keycode), key.keycode, key.duration); -@@ -1107,7 +1107,7 @@ void CCECClient::AddKey(const cec_keypress &key) - - if (!isrepeat && (key.keycode != comboKey || key.duration > 0)) - { -- LIB_CEC->AddLog(CEC_LOG_DEBUG, "key pressed: %s (%1x)", ToString(transmitKey.keycode), transmitKey.keycode); -+ LIB_CEC->AddLog(CEC_LOG_DEBUG, "key pressed: %s (%1x, %d)", ToString(transmitKey.keycode), transmitKey.keycode, transmitKey.duration); - QueueAddKey(transmitKey); - } - } -@@ -1129,6 +1129,7 @@ uint16_t CCECClient::CheckKeypressTimeout(void) - unsigned int timeout = CEC_PROCESSOR_SIGNAL_WAIT_TIME; - cec_keypress key; - key.keycode = CEC_USER_CONTROL_CODE_UNKNOWN; -+ key.duration = 0; - - { - CLockObject lock(m_mutex); -@@ -1140,8 +1141,7 @@ uint16_t CCECClient::CheckKeypressTimeout(void) - m_configuration.iComboKeyTimeoutMs : CEC_DEFAULT_COMBO_TIMEOUT_MS); - - if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && -- ((m_iCurrentButton == comboKey && iTimeoutMs > 0 && iNow - m_updateButtontime >= iTimeoutMs) || -- (m_iCurrentButton != comboKey && m_releaseButtontime && iNow >= (uint64_t)m_releaseButtontime))) -+ m_iCurrentButton == comboKey && iTimeoutMs > 0 && iNow - m_updateButtontime >= iTimeoutMs) - { - key.duration = (unsigned int) (iNow - m_initialButtontime); - key.keycode = m_iCurrentButton; -@@ -1155,9 +1155,23 @@ uint16_t CCECClient::CheckKeypressTimeout(void) - m_releasedButtoncount = 0; - } - else if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && -+ m_iCurrentButton != comboKey && m_releaseButtontime && iNow >= (uint64_t)m_releaseButtontime) -+ { -+ key.duration = (unsigned int) (iNow - m_initialButtontime); -+ key.keycode = CEC_USER_CONTROL_CODE_UNKNOWN; -+ -+ m_iCurrentButton = CEC_USER_CONTROL_CODE_UNKNOWN; -+ m_initialButtontime = 0; -+ m_updateButtontime = 0; -+ m_repeatButtontime = 0; -+ m_releaseButtontime = 0; -+ m_pressedButtoncount = 0; -+ m_releasedButtoncount = 0; -+ } -+ else if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && - (m_iCurrentButton != comboKey && m_repeatButtontime && iNow >= (uint64_t)m_repeatButtontime)) - { -- key.duration = 0; -+ key.duration = (unsigned int) (iNow - m_initialButtontime); - key.keycode = m_iCurrentButton; - m_repeatButtontime = iNow + m_configuration.iButtonRepeatRateMs; - timeout = std::min((uint64_t)timeout, m_repeatButtontime - iNow); -@@ -1176,8 +1190,8 @@ uint16_t CCECClient::CheckKeypressTimeout(void) - timeout = CEC_PROCESSOR_SIGNAL_WAIT_TIME; - } - } -- LIB_CEC->AddLog(CEC_LOG_DEBUG, "key %s: %s (%1x) timeout:%dms (rel:%d,rep:%d,prs:%d,rel:%d)", key.keycode == CEC_USER_CONTROL_CODE_UNKNOWN ? "idle" : key.duration ? "released" : "repeated", -- ToString(m_iCurrentButton), m_iCurrentButton, timeout, (int)(m_releaseButtontime ? m_releaseButtontime - iNow : 0), (int)(m_repeatButtontime ? m_repeatButtontime - iNow : 0), m_pressedButtoncount, m_releasedButtoncount); -+ LIB_CEC->AddLog(CEC_LOG_DEBUG, "Key %s: %s (duration:%d) (%1x) timeout:%dms (rel:%d,rep:%d,prs:%d,rel:%d)", ToString(m_iCurrentButton), key.keycode == CEC_USER_CONTROL_CODE_UNKNOWN ? "idle" : m_repeatButtontime ? "repeated" : "released", key.duration, -+ m_iCurrentButton, timeout, (int)(m_releaseButtontime ? m_releaseButtontime - iNow : 0), (int)(m_repeatButtontime ? m_repeatButtontime - iNow : 0), m_pressedButtoncount, m_releasedButtoncount); - } - - if (key.keycode != CEC_USER_CONTROL_CODE_UNKNOWN) --- -1.9.1 - - -From 1ea01f59d8186d4d53af41961aaccbbc11651115 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Wed, 5 Nov 2014 21:04:25 +0000 -Subject: [PATCH 6/6] squash: Fix for stop needing to be pressed twice - ---- - src/libcec/CECClient.cpp | 17 ++++++++--------- - 1 file changed, 8 insertions(+), 9 deletions(-) - -diff --git a/src/libcec/CECClient.cpp b/src/libcec/CECClient.cpp -index 1946148..f4f114b 100644 ---- a/src/libcec/CECClient.cpp -+++ b/src/libcec/CECClient.cpp -@@ -1131,6 +1131,8 @@ uint16_t CCECClient::CheckKeypressTimeout(void) - key.keycode = CEC_USER_CONTROL_CODE_UNKNOWN; - key.duration = 0; - -+ if (m_iCurrentButton == CEC_USER_CONTROL_CODE_UNKNOWN) -+ return timeout; - { - CLockObject lock(m_mutex); - uint64_t iNow = GetTimeMs(); -@@ -1140,8 +1142,7 @@ uint16_t CCECClient::CheckKeypressTimeout(void) - uint32_t iTimeoutMs(m_configuration.clientVersion >= LIBCEC_VERSION_TO_UINT(2, 0, 5) ? - m_configuration.iComboKeyTimeoutMs : CEC_DEFAULT_COMBO_TIMEOUT_MS); - -- if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && -- m_iCurrentButton == comboKey && iTimeoutMs > 0 && iNow - m_updateButtontime >= iTimeoutMs) -+ if (m_iCurrentButton == comboKey && iTimeoutMs > 0 && iNow - m_updateButtontime >= iTimeoutMs) - { - key.duration = (unsigned int) (iNow - m_initialButtontime); - key.keycode = m_iCurrentButton; -@@ -1154,8 +1155,7 @@ uint16_t CCECClient::CheckKeypressTimeout(void) - m_pressedButtoncount = 0; - m_releasedButtoncount = 0; - } -- else if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && -- m_iCurrentButton != comboKey && m_releaseButtontime && iNow >= (uint64_t)m_releaseButtontime) -+ else if (m_iCurrentButton != comboKey && m_releaseButtontime && iNow >= (uint64_t)m_releaseButtontime) - { - key.duration = (unsigned int) (iNow - m_initialButtontime); - key.keycode = CEC_USER_CONTROL_CODE_UNKNOWN; -@@ -1168,8 +1168,7 @@ uint16_t CCECClient::CheckKeypressTimeout(void) - m_pressedButtoncount = 0; - m_releasedButtoncount = 0; - } -- else if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && -- (m_iCurrentButton != comboKey && m_repeatButtontime && iNow >= (uint64_t)m_repeatButtontime)) -+ else if (m_iCurrentButton != comboKey && m_repeatButtontime && iNow >= (uint64_t)m_repeatButtontime) - { - key.duration = (unsigned int) (iNow - m_initialButtontime); - key.keycode = m_iCurrentButton; -@@ -1178,11 +1177,11 @@ uint16_t CCECClient::CheckKeypressTimeout(void) - } - else - { -- if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && m_iCurrentButton == comboKey && iTimeoutMs > 0) -+ if (m_iCurrentButton == comboKey && iTimeoutMs > 0) - timeout = std::min((uint64_t)timeout, m_updateButtontime - iNow + iTimeoutMs); -- if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && m_iCurrentButton != comboKey && m_releaseButtontime) -+ if (m_iCurrentButton != comboKey && m_releaseButtontime) - timeout = std::min((uint64_t)timeout, m_releaseButtontime - iNow); -- if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && m_iCurrentButton != comboKey && m_repeatButtontime) -+ if (m_iCurrentButton != comboKey && m_repeatButtontime) - timeout = std::min((uint64_t)timeout, m_repeatButtontime - iNow); - if (timeout > CEC_PROCESSOR_SIGNAL_WAIT_TIME) - { --- -1.9.1 - diff --git a/packages/devel/libcec/patches/libcec-02-fix-crash-on-some-systems.patch b/packages/devel/libcec/patches/libcec-02-fix-crash-on-some-systems.patch deleted file mode 100644 index a5bc6b29c46..00000000000 --- a/packages/devel/libcec/patches/libcec-02-fix-crash-on-some-systems.patch +++ /dev/null @@ -1,18 +0,0 @@ -# see upstream commit, https://github.com/Pulse-Eight/libcec/commit/678739a0d8aa5897fa1906a8fdeeb67b83f7d1e9 - -diff -Naur a/src/libcec/platform/drm/drm-edid.cpp b/src/libcec/platform/drm/drm-edid.cpp ---- a/src/libcec/platform/drm/drm-edid.cpp 2015-07-03 10:20:49.000000000 -0700 -+++ b/src/libcec/platform/drm/drm-edid.cpp 2015-11-10 13:09:14.902629922 -0800 -@@ -51,6 +51,12 @@ - - DIR *dir = opendir(baseDir.c_str()); - -+ // DRM subfolder may not exist on some systems -+ if (dir == NULL) -+ { -+ return iPA; -+ } -+ - struct dirent *entry = readdir(dir); - std::string enablededid; - std::string line; diff --git a/packages/devel/libcec/patches/libcec-PR208.patch b/packages/devel/libcec/patches/libcec-PR208.patch new file mode 100644 index 00000000000..3dc5adf022e --- /dev/null +++ b/packages/devel/libcec/patches/libcec-PR208.patch @@ -0,0 +1,38 @@ +From f70c4d76e1d9c0219a3927b6b66090b7575e7933 Mon Sep 17 00:00:00 2001 +From: Gerald Dachs +Date: Thu, 17 Mar 2016 12:12:51 +0100 +Subject: [PATCH] use system audio mode request instead of power on to start + AVR reliable + +--- + src/libcec/devices/CECBusDevice.cpp | 13 +++++++++---- + 1 file changed, 9 insertions(+), 4 deletions(-) + +diff --git a/src/libcec/devices/CECBusDevice.cpp b/src/libcec/devices/CECBusDevice.cpp +index 55939d1..e2d5ea3 100644 +--- a/src/libcec/devices/CECBusDevice.cpp ++++ b/src/libcec/devices/CECBusDevice.cpp +@@ -1025,14 +1025,19 @@ bool CCECBusDevice::ActivateSource(uint64_t iDelay /* = 0 */) + bool bReturn(true); + if (iDelay == 0) + { +- /** some AVRs fail to be powered up by the TV when it powers up. power up the AVR explicitly */ ++ /** send system audio mode request if AVR exists */ + if (m_iLogicalAddress != CECDEVICE_AUDIOSYSTEM) + { + CCECBusDevice* audioSystem(m_processor->GetDevice(CECDEVICE_AUDIOSYSTEM)); +- if (audioSystem && audioSystem->IsPresent() && audioSystem->GetPowerStatus(m_iLogicalAddress) != CEC_POWER_STATUS_ON) ++ if (audioSystem && audioSystem->IsPresent()) + { +- LIB_CEC->AddLog(CEC_LOG_DEBUG, "powering up the AVR"); +- audioSystem->PowerOn(m_iLogicalAddress); ++ cec_command command; ++ ++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "sending system audio mode request for '%s'", ToString(m_iLogicalAddress)); ++ cec_command::Format(command, m_iLogicalAddress, CECDEVICE_AUDIOSYSTEM, CEC_OPCODE_SYSTEM_AUDIO_MODE_REQUEST); ++ command.parameters.PushBack((uint8_t) ((m_iPhysicalAddress >> 8) & 0xFF)); ++ command.parameters.PushBack((uint8_t) (m_iPhysicalAddress & 0xFF)); ++ bReturn = m_handler->Transmit(command, false, false); + } + } + diff --git a/packages/devel/mpc/package.mk b/packages/devel/mpc/package.mk index afd6595c0a7..f9e3de6de0d 100644 --- a/packages/devel/mpc/package.mk +++ b/packages/devel/mpc/package.mk @@ -22,7 +22,7 @@ PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="LGPL" PKG_SITE="http://www.multiprecision.org" -PKG_URL="http://www.multiprecision.org/mpc/download/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_URL="http://ftp.gnu.org/gnu/mpc/$PKG_NAME-$PKG_VERSION.tar.gz" PKG_DEPENDS_HOST="ccache:host gmp:host mpfr:host" PKG_PRIORITY="optional" PKG_SECTION="devel" diff --git a/packages/devel/mpfr/package.mk b/packages/devel/mpfr/package.mk index 366ecdc714d..399643ba826 100644 --- a/packages/devel/mpfr/package.mk +++ b/packages/devel/mpfr/package.mk @@ -17,7 +17,7 @@ ################################################################################ PKG_NAME="mpfr" -PKG_VERSION="3.1.3" +PKG_VERSION="3.1.4" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="LGPL" diff --git a/packages/devel/ncurses/package.mk b/packages/devel/ncurses/package.mk deleted file mode 100644 index 5b0b12340b2..00000000000 --- a/packages/devel/ncurses/package.mk +++ /dev/null @@ -1,89 +0,0 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 2 of the License, or -# (at your option) any later version. -# -# OpenELEC is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ - -PKG_NAME="ncurses" -PKG_VERSION="5.9" -PKG_REV="1" -PKG_ARCH="any" -PKG_LICENSE="MIT" -PKG_SITE="http://www.gnu.org/software/ncurses/" -PKG_URL="http://ftp.gnu.org/pub/gnu/ncurses/$PKG_NAME-$PKG_VERSION.tar.gz" -PKG_DEPENDS_TARGET="toolchain zlib" -PKG_PRIORITY="optional" -PKG_SECTION="devel" -PKG_SHORTDESC="ncurses: The ncurses (new curses) library" -PKG_LONGDESC="The ncurses (new curses) library is a free software emulation of curses in System V Release 4.0, and more. It uses terminfo format, supports pads and color and multiple highlights and forms characters and function-key mapping, and has all the other SYSV-curses enhancements over BSD curses." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -PKG_CONFIGURE_OPTS_TARGET="--without-ada \ - --without-cxx \ - --without-cxx-binding \ - --disable-db-install \ - --without-manpages \ - --without-progs \ - --without-tests \ - --with-curses-h \ - --without-shared \ - --with-normal \ - --without-debug \ - --without-profile \ - --without-termlib \ - --without-ticlib \ - --without-gpm \ - --without-dbmalloc \ - --without-dmalloc \ - --disable-rpath \ - --disable-overwrite \ - --disable-database \ - --with-fallbacks=linux,screen,xterm,xterm-color \ - --disable-big-core \ - --enable-termcap \ - --enable-getcap \ - --enable-getcap-cache \ - --enable-symlinks \ - --disable-bsdpad \ - --without-rcs-ids \ - --enable-ext-funcs \ - --disable-const \ - --enable-no-padding \ - --disable-sigwinch \ - --disable-tcap-names \ - --without-develop \ - --disable-hard-tabs \ - --disable-xmc-glitch \ - --disable-hashmap \ - --disable-safe-sprintf \ - --disable-scroll-hints \ - --disable-widec \ - --disable-echo \ - --disable-warnings \ - --disable-home-terminfo \ - --disable-assertions" - -pre_configure_target() { - # causes some segmentation fault's (dialog) when compiled with gcc's link time optimization. - strip_lto -} - -post_makeinstall_target() { - cp misc/ncurses-config $ROOT/$TOOLCHAIN/bin - chmod +x $ROOT/$TOOLCHAIN/bin/ncurses-config - $SED "s:\(['=\" ]\)/usr:\\1$SYSROOT_PREFIX/usr:g" $ROOT/$TOOLCHAIN/bin/ncurses-config -} diff --git a/packages/devel/ncurses/patches/ncurses-20140308-20140323.patch b/packages/devel/ncurses/patches/ncurses-20140308-20140323.patch deleted file mode 100644 index 2506bf31a6d..00000000000 --- a/packages/devel/ncurses/patches/ncurses-20140308-20140323.patch +++ /dev/null @@ -1,204827 +0,0 @@ -diff -Naur ncurses-5.9/aclocal.m4 ncurses-5.9.patch/aclocal.m4 ---- ncurses-5.9/aclocal.m4 2011-04-01 01:35:38.000000000 +0200 -+++ ncurses-5.9.patch/aclocal.m4 2014-09-01 16:33:22.236791923 +0200 -@@ -1,5 +1,5 @@ - dnl*************************************************************************** --dnl Copyright (c) 1998-2010,2011 Free Software Foundation, Inc. * -+dnl Copyright (c) 1998-2013,2014 Free Software Foundation, Inc. * - dnl * - dnl Permission is hereby granted, free of charge, to any person obtaining a * - dnl copy of this software and associated documentation files (the * -@@ -28,7 +28,7 @@ - dnl - dnl Author: Thomas E. Dickey 1995-on - dnl --dnl $Id: aclocal.m4,v 1.553 2011/03/31 23:35:38 tom Exp $ -+dnl $Id: aclocal.m4,v 1.686 2014/02/10 00:37:02 tom Exp $ - dnl Macros used in NCURSES auto-configuration script. - dnl - dnl These macros are maintained separately from NCURSES. The copyright on -@@ -62,7 +62,33 @@ - fi - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_ADA_INCLUDE_DIRS version: 6 updated: 2010/02/26 19:52:07 -+dnl CF_ACVERSION_CHECK version: 4 updated: 2013/03/04 19:52:56 -+dnl ------------------ -+dnl Conditionally generate script according to whether we're using a given autoconf. -+dnl -+dnl $1 = version to compare against -+dnl $2 = code to use if AC_ACVERSION is at least as high as $1. -+dnl $3 = code to use if AC_ACVERSION is older than $1. -+define([CF_ACVERSION_CHECK], -+[ -+ifdef([AC_ACVERSION], ,[m4_copy([m4_PACKAGE_VERSION],[AC_ACVERSION])])dnl -+ifdef([m4_version_compare], -+[m4_if(m4_version_compare(m4_defn([AC_ACVERSION]), [$1]), -1, [$3], [$2])], -+[CF_ACVERSION_COMPARE( -+AC_PREREQ_CANON(AC_PREREQ_SPLIT([$1])), -+AC_PREREQ_CANON(AC_PREREQ_SPLIT(AC_ACVERSION)), AC_ACVERSION, [$2], [$3])])])dnl -+dnl --------------------------------------------------------------------------- -+dnl CF_ACVERSION_COMPARE version: 3 updated: 2012/10/03 18:39:53 -+dnl -------------------- -+dnl CF_ACVERSION_COMPARE(MAJOR1, MINOR1, TERNARY1, -+dnl MAJOR2, MINOR2, TERNARY2, -+dnl PRINTABLE2, not FOUND, FOUND) -+define([CF_ACVERSION_COMPARE], -+[ifelse(builtin([eval], [$2 < $5]), 1, -+[ifelse([$8], , ,[$8])], -+[ifelse([$9], , ,[$9])])])dnl -+dnl --------------------------------------------------------------------------- -+dnl CF_ADA_INCLUDE_DIRS version: 8 updated: 2013/10/14 04:24:07 - dnl ------------------- - dnl Construct the list of include-options for the C programs in the Ada95 - dnl binding. -@@ -76,7 +102,7 @@ - ACPPFLAGS="$ACPPFLAGS -I\${includedir}" - elif test "$includedir" != "/usr/include"; then - if test "$includedir" = '${prefix}/include' ; then -- if test $prefix != /usr ; then -+ if test x$prefix != x/usr ; then - ACPPFLAGS="$ACPPFLAGS -I\${includedir}" - fi - else -@@ -291,7 +317,7 @@ - dnl $2 = variable to update (default $LIBS) - AC_DEFUN([CF_ADD_LIBS],[ifelse($2,,LIBS,[$2])="$1 [$]ifelse($2,,LIBS,[$2])"])dnl - dnl --------------------------------------------------------------------------- --dnl CF_ADD_SUBDIR_PATH version: 3 updated: 2010/07/03 20:58:12 -+dnl CF_ADD_SUBDIR_PATH version: 4 updated: 2013/10/08 17:47:05 - dnl ------------------ - dnl Append to a search-list for a nonstandard header/lib-file - dnl $1 = the variable to return as result -@@ -301,9 +327,9 @@ - dnl $5 = a directory that we do not want $4 to match - AC_DEFUN([CF_ADD_SUBDIR_PATH], - [ --test "$4" != "$5" && \ -+test "x$4" != "x$5" && \ - test -d "$4" && \ --ifelse([$5],NONE,,[(test $5 = NONE || test "$4" != "$5") &&]) { -+ifelse([$5],NONE,,[(test -z "$5" || test x$5 = xNONE || test "x$4" != "x$5") &&]) { - test -n "$verbose" && echo " ... testing for $3-directories under $4" - test -d $4/$3 && $1="[$]$1 $4/$3" - test -d $4/$3/$2 && $1="[$]$1 $4/$3/$2" -@@ -313,76 +339,6 @@ - } - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_ANSI_CC_CHECK version: 10 updated: 2010/10/23 15:52:32 --dnl ---------------- --dnl This is adapted from the macros 'fp_PROG_CC_STDC' and 'fp_C_PROTOTYPES' --dnl in the sharutils 4.2 distribution. --AC_DEFUN([CF_ANSI_CC_CHECK], --[ --AC_CACHE_CHECK(for ${CC:-cc} option to accept ANSI C, cf_cv_ansi_cc,[ --cf_cv_ansi_cc=no --cf_save_CFLAGS="$CFLAGS" --cf_save_CPPFLAGS="$CPPFLAGS" --# Don't try gcc -ansi; that turns off useful extensions and --# breaks some systems' header files. --# AIX -qlanglvl=ansi --# Ultrix and OSF/1 -std1 --# HP-UX -Aa -D_HPUX_SOURCE --# SVR4 -Xc --# UnixWare 1.2 (cannot use -Xc, since ANSI/POSIX clashes) --for cf_arg in "-DCC_HAS_PROTOS" \ -- "" \ -- -qlanglvl=ansi \ -- -std1 \ -- -Ae \ -- "-Aa -D_HPUX_SOURCE" \ -- -Xc --do -- CF_ADD_CFLAGS($cf_arg) -- AC_TRY_COMPILE( --[ --#ifndef CC_HAS_PROTOS --#if !defined(__STDC__) || (__STDC__ != 1) --choke me --#endif --#endif --],[ -- int test (int i, double x); -- struct s1 {int (*f) (int a);}; -- struct s2 {int (*f) (double a);};], -- [cf_cv_ansi_cc="$cf_arg"; break]) --done --CFLAGS="$cf_save_CFLAGS" --CPPFLAGS="$cf_save_CPPFLAGS" --]) -- --if test "$cf_cv_ansi_cc" != "no"; then --if test ".$cf_cv_ansi_cc" != ".-DCC_HAS_PROTOS"; then -- CF_ADD_CFLAGS($cf_cv_ansi_cc) --else -- AC_DEFINE(CC_HAS_PROTOS) --fi --fi --])dnl --dnl --------------------------------------------------------------------------- --dnl CF_ANSI_CC_REQD version: 4 updated: 2008/03/23 14:48:54 --dnl --------------- --dnl For programs that must use an ANSI compiler, obtain compiler options that --dnl will make it recognize prototypes. We'll do preprocessor checks in other --dnl macros, since tools such as unproto can fake prototypes, but only part of --dnl the preprocessor. --AC_DEFUN([CF_ANSI_CC_REQD], --[AC_REQUIRE([CF_ANSI_CC_CHECK]) --if test "$cf_cv_ansi_cc" = "no"; then -- AC_MSG_ERROR( --[Your compiler does not appear to recognize prototypes. --You have the following choices: -- a. adjust your compiler options -- b. get an up-to-date compiler -- c. use a wrapper such as unproto]) --fi --])dnl --dnl --------------------------------------------------------------------------- - dnl CF_ARG_DISABLE version: 3 updated: 1999/03/30 17:24:31 - dnl -------------- - dnl Allow user to disable a normally-on option. -@@ -465,7 +421,7 @@ - AC_SUBST(ARFLAGS) - ]) - dnl --------------------------------------------------------------------------- --dnl CF_AWK_BIG_PRINTF version: 3 updated: 2008/12/27 12:30:03 -+dnl CF_AWK_BIG_PRINTF version: 4 updated: 2011/10/30 17:09:50 - dnl ----------------- - dnl Check if awk can handle big strings using printf. Some older versions of - dnl awk choke on large strings passed via "%s". -@@ -479,8 +435,8 @@ - eval $2=no - ;; - *) #(vi -- if ( ${AWK} 'BEGIN { xx = "x"; while (length(xx) < $1) { xx = xx "x"; }; printf("%s\n", xx); }' \ -- | $AWK '{ printf "%d\n", length([$]0); }' | $AWK 'BEGIN { eqls=0; recs=0; } { recs++; if ([$]0 == 12000) eqls++; } END { if (recs != 1 || eqls != 1) exit 1; }' 2>/dev/null >/dev/null ) ; then -+ if ( ${AWK} 'BEGIN { xx = "x"; while (length(xx) < $1) { xx = xx "x"; }; printf("%s\n", xx); }' 2>/dev/null \ -+ | $AWK '{ printf "%d\n", length([$]0); }' 2>/dev/null | $AWK 'BEGIN { eqls=0; recs=0; } { recs++; if ([$]0 == 12000) eqls++; } END { if (recs != 1 || eqls != 1) exit 1; }' 2>/dev/null >/dev/null ) ; then - eval $2=yes - else - eval $2=no -@@ -536,7 +492,7 @@ - fi - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_BOOL_SIZE version: 12 updated: 2006/12/16 12:33:30 -+dnl CF_BOOL_SIZE version: 13 updated: 2013/04/13 18:03:21 - dnl ------------ - dnl Test for the size of 'bool' in the configured C++ compiler (e.g., a type). - dnl Don't bother looking for bool.h, since it's been deprecated. -@@ -570,7 +526,7 @@ - - #endif - --main() -+int main() - { - FILE *fp = fopen("cf_test.out", "w"); - if (fp != 0) { -@@ -604,7 +560,7 @@ - fi - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_BUILD_CC version: 6 updated: 2006/10/14 15:23:15 -+dnl CF_BUILD_CC version: 7 updated: 2012/10/06 15:31:55 - dnl ----------- - dnl If we're cross-compiling, allow the user to override the tools and their - dnl options. The configure script is oriented toward identifying the host -@@ -614,7 +570,8 @@ - dnl $1 = default for $CPPFLAGS - dnl $2 = default for $LIBS - AC_DEFUN([CF_BUILD_CC],[ --AC_REQUIRE([CF_PROG_EXT]) -+CF_ACVERSION_CHECK(2.52,, -+ [AC_REQUIRE([CF_PROG_EXT])]) - if test "$cross_compiling" = yes ; then - - # defaults that we might want to override -@@ -695,7 +652,33 @@ - AC_SUBST(BUILD_OBJEXT) - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_CFG_DEFAULTS version: 7 updated: 2005/09/24 16:15:00 -+dnl CF_CC_ENV_FLAGS version: 1 updated: 2012/10/03 05:25:49 -+dnl --------------- -+dnl Check for user's environment-breakage by stuffing CFLAGS/CPPFLAGS content -+dnl into CC. This will not help with broken scripts that wrap the compiler with -+dnl options, but eliminates a more common category of user confusion. -+AC_DEFUN([CF_CC_ENV_FLAGS], -+[ -+# This should have been defined by AC_PROG_CC -+: ${CC:=cc} -+ -+AC_MSG_CHECKING(\$CC variable) -+case "$CC" in #(vi -+*[[\ \ ]]-[[IUD]]*) -+ AC_MSG_RESULT(broken) -+ AC_MSG_WARN(your environment misuses the CC variable to hold CFLAGS/CPPFLAGS options) -+ # humor him... -+ cf_flags=`echo "$CC" | sed -e 's/^[[^ ]]*[[ ]]//'` -+ CC=`echo "$CC" | sed -e 's/[[ ]].*//'` -+ CF_ADD_CFLAGS($cf_flags) -+ ;; -+*) -+ AC_MSG_RESULT(ok) -+ ;; -+esac -+])dnl -+dnl --------------------------------------------------------------------------- -+dnl CF_CFG_DEFAULTS version: 10 updated: 2013/09/07 13:54:05 - dnl --------------- - dnl Determine the default configuration into which we'll install ncurses. This - dnl can be overridden by the user's command-line options. There's two items to -@@ -713,7 +696,7 @@ - if test "x$prefix" = "xNONE" ; then - case "$cf_cv_system_name" in - # non-vendor systems don't have a conflict -- openbsd*|freebsd*|linux*|cygwin*|k*bsd*-gnu) -+ openbsd*|freebsd*|mirbsd*|linux*|cygwin*|msys*|k*bsd*-gnu|mingw*) - prefix=/usr - ;; - *) prefix=$ac_default_prefix -@@ -749,30 +732,51 @@ - fi - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_CGETENT version: 3 updated: 2000/08/12 23:18:52 -+dnl CF_CGETENT version: 5 updated: 2012/10/06 17:56:13 - dnl ---------- - dnl Check if the terminal-capability database functions are available. If not, - dnl ncurses has a much-reduced version. - AC_DEFUN([CF_CGETENT],[ --AC_MSG_CHECKING(for terminal-capability database functions) --AC_CACHE_VAL(cf_cv_cgetent,[ -+AC_CACHE_CHECK(for terminal-capability database functions,cf_cv_cgetent,[ - AC_TRY_LINK([ - #include ],[ - char temp[128]; - char *buf = temp; - char *db_array = temp; -- cgetent(&buf, /* int *, */ &db_array, "vt100"); -+ cgetent(&buf, &db_array, "vt100"); - cgetcap(buf, "tc", '='); - cgetmatch(buf, "tc"); - ], - [cf_cv_cgetent=yes], - [cf_cv_cgetent=no]) - ]) --AC_MSG_RESULT($cf_cv_cgetent) --test "$cf_cv_cgetent" = yes && AC_DEFINE(HAVE_BSD_CGETENT) -+ -+if test "$cf_cv_cgetent" = yes -+then -+ AC_DEFINE(HAVE_BSD_CGETENT,1,[Define to 1 if we have BSD cgetent]) -+AC_CACHE_CHECK(if cgetent uses const parameter,cf_cv_cgetent_const,[ -+AC_TRY_LINK([ -+#include ],[ -+ char temp[128]; -+ char *buf = temp; -+#ifndef _NETBSD_SOURCE /* given, since April 2004 in stdlib.h */ -+ const char *db_array = temp; -+ cgetent(&buf, &db_array, "vt100"); -+#endif -+ cgetcap(buf, "tc", '='); -+ cgetmatch(buf, "tc"); -+ ], -+ [cf_cv_cgetent_const=yes], -+ [cf_cv_cgetent_const=no]) -+]) -+ if test "$cf_cv_cgetent_const" = yes -+ then -+ AC_DEFINE_UNQUOTED(CGETENT_CONST,const,[Define to const if needed for some BSD cgetent variations]) -+ fi -+fi - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_CHECK_CACHE version: 11 updated: 2008/03/23 14:45:59 -+dnl CF_CHECK_CACHE version: 12 updated: 2012/10/02 20:55:03 - dnl -------------- - dnl Check if we're accidentally using a cache from a different machine. - dnl Derive the system name, as a check for reusing the autoconf cache. -@@ -795,7 +799,7 @@ - system_name="`(hostname) 2>/dev/null`" - fi - fi --test -n "$system_name" && AC_DEFINE_UNQUOTED(SYSTEM_NAME,"$system_name") -+test -n "$system_name" && AC_DEFINE_UNQUOTED(SYSTEM_NAME,"$system_name",[Define to the system name.]) - AC_CACHE_VAL(cf_cv_system_name,[cf_cv_system_name="$system_name"]) - - test -z "$system_name" && system_name="$cf_cv_system_name" -@@ -908,7 +912,82 @@ - fi - ])])dnl - dnl --------------------------------------------------------------------------- --dnl CF_CPP_PARAM_INIT version: 4 updated: 2001/04/07 22:31:18 -+dnl CF_CHECK_LIBTOOL_VERSION version: 1 updated: 2013/04/06 18:03:09 -+dnl ------------------------ -+dnl Show the version of libtool -+dnl -+dnl Save the version in a cache variable - this is not entirely a good thing, -+dnl but the version string from libtool is very ugly, and for bug reports it -+dnl might be useful to have the original string. -+AC_DEFUN([CF_CHECK_LIBTOOL_VERSION],[ -+if test -n "$LIBTOOL" && test "$LIBTOOL" != none -+then -+ AC_MSG_CHECKING(version of $LIBTOOL) -+ CF_LIBTOOL_VERSION -+ AC_MSG_RESULT($cf_cv_libtool_version) -+ if test -z "$cf_cv_libtool_version" ; then -+ AC_MSG_ERROR(This is not GNU libtool) -+ fi -+else -+ AC_MSG_ERROR(GNU libtool has not been found) -+fi -+])dnl -+dnl --------------------------------------------------------------------------- -+dnl CF_CHECK_WCHAR_H version: 1 updated: 2011/10/29 15:01:05 -+dnl ---------------- -+dnl Check if wchar.h can be used, i.e., without defining _XOPEN_SOURCE_EXTENDED -+AC_DEFUN([CF_CHECK_WCHAR_H],[ -+AC_CACHE_CHECK(if wchar.h can be used as is,cf_cv_wchar_h_okay,[ -+AC_TRY_COMPILE( -+[ -+#include -+#include -+],[ -+ wint_t foo = 0; -+ int bar = iswpunct(foo)], -+ [cf_cv_wchar_h_okay=yes], -+ [cf_cv_wchar_h_okay=no])]) -+ -+if test $cf_cv_wchar_h_okay = no -+then -+ CF_PREDEFINE(_XOPEN_SOURCE_EXTENDED) -+fi -+])dnl -+dnl --------------------------------------------------------------------------- -+dnl CF_CLANG_COMPILER version: 2 updated: 2013/11/19 19:23:35 -+dnl ----------------- -+dnl Check if the given compiler is really clang. clang's C driver defines -+dnl __GNUC__ (fooling the configure script into setting $GCC to yes) but does -+dnl not ignore some gcc options. -+dnl -+dnl This macro should be run "soon" after AC_PROG_CC or AC_PROG_CPLUSPLUS, to -+dnl ensure that it is not mistaken for gcc/g++. It is normally invoked from -+dnl the wrappers for gcc and g++ warnings. -+dnl -+dnl $1 = GCC (default) or GXX -+dnl $2 = CLANG_COMPILER (default) -+dnl $3 = CFLAGS (default) or CXXFLAGS -+AC_DEFUN([CF_CLANG_COMPILER],[ -+ifelse([$2],,CLANG_COMPILER,[$2])=no -+ -+if test "$ifelse([$1],,[$1],GCC)" = yes ; then -+ AC_MSG_CHECKING(if this is really Clang ifelse([$1],GXX,C++,C) compiler) -+ cf_save_CFLAGS="$ifelse([$3],,CFLAGS,[$3])" -+ ifelse([$3],,CFLAGS,[$3])="$ifelse([$3],,CFLAGS,[$3]) -Qunused-arguments" -+ AC_TRY_COMPILE([],[ -+#ifdef __clang__ -+#else -+make an error -+#endif -+],[ifelse([$2],,CLANG_COMPILER,[$2])=yes -+cf_save_CFLAGS="$cf_save_CFLAGS -Qunused-arguments" -+],[]) -+ ifelse([$3],,CFLAGS,[$3])="$cf_save_CFLAGS" -+ AC_MSG_RESULT($ifelse([$2],,CLANG_COMPILER,[$2])) -+fi -+]) -+dnl --------------------------------------------------------------------------- -+dnl CF_CPP_PARAM_INIT version: 6 updated: 2012/10/06 17:56:13 - dnl ----------------- - dnl Check if the C++ compiler accepts duplicate parameter initialization. This - dnl is a late feature for the standard and is not in some recent compilers -@@ -932,7 +1011,7 @@ - { - value = x; - } --void main() { } -+int main() { } - ], - [cf_cv_cpp_param_init=yes], - [cf_cv_cpp_param_init=no], -@@ -940,10 +1019,10 @@ - AC_LANG_RESTORE - ]) - fi --test "$cf_cv_cpp_param_init" = yes && AC_DEFINE(CPP_HAS_PARAM_INIT) -+test "$cf_cv_cpp_param_init" = yes && AC_DEFINE(CPP_HAS_PARAM_INIT,1,[Define to 1 if C++ has parameter initialization]) - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_CPP_STATIC_CAST version: 1 updated: 2005/07/23 16:52:43 -+dnl CF_CPP_STATIC_CAST version: 3 updated: 2013/04/13 18:03:21 - dnl ------------------ - dnl Check if the C++ compiler accepts static_cast in generics. This appears to - dnl not be supported in g++ before 3.0 -@@ -965,7 +1044,7 @@ - int begin_x = 0) - { - } -- -+ NCursesPanel(); - ~NCursesPanel(); - }; - -@@ -996,10 +1075,58 @@ - - fi - --test "$cf_cv_cpp_static_cast" = yes && AC_DEFINE(CPP_HAS_STATIC_CAST) -+test "$cf_cv_cpp_static_cast" = yes && AC_DEFINE(CPP_HAS_STATIC_CAST,1,[Define to 1 if C++ has static_cast]) -+])dnl -+dnl --------------------------------------------------------------------------- -+dnl CF_CXX_AR_FLAGS version: 1 updated: 2011/10/29 08:35:34 -+dnl --------------- -+dnl Setup special archiver flags for given compilers. -+AC_DEFUN([CF_CXX_AR_FLAGS],[ -+ CXX_AR='$(AR)' -+ CXX_ARFLAGS='$(ARFLAGS)' -+ case $cf_cv_system_name in #(vi -+ irix*) #(vi -+ if test "$GXX" != yes ; then -+ CXX_AR='$(CXX)' -+ CXX_ARFLAGS='-ar -o' -+ fi -+ ;; -+ sco3.2v5*) #(vi -+ CXXLDFLAGS="-u main" -+ ;; -+ solaris2*) -+ if test "$GXX" != yes ; then -+ CXX_AR='$(CXX)' -+ CXX_ARFLAGS='-xar -o' -+ fi -+ ;; -+ esac -+ AC_SUBST(CXXLDFLAGS) -+ AC_SUBST(CXX_AR) -+ AC_SUBST(CXX_ARFLAGS) - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_C_INLINE version: 3 updated: 2010/05/01 15:14:41 -+dnl CF_CXX_IOSTREAM_NAMESPACE version: 2 updated: 2012/10/06 17:56:13 -+dnl ------------------------- -+dnl For c++, check if iostream uses "std::" namespace. -+AC_DEFUN([CF_CXX_IOSTREAM_NAMESPACE],[ -+AC_CHECK_HEADERS(iostream) -+if test x"$ac_cv_header_iostream" = xyes ; then -+ AC_MSG_CHECKING(if iostream uses std-namespace) -+ AC_TRY_COMPILE([ -+#include -+using std::endl; -+using std::cerr;],[ -+cerr << "testing" << endl; -+],[cf_iostream_namespace=yes],[cf_iostream_namespace=no]) -+ AC_MSG_RESULT($cf_iostream_namespace) -+ if test "$cf_iostream_namespace" = yes ; then -+ AC_DEFINE(IOSTREAM_NAMESPACE,1,[Define to 1 if C++ has namespace iostream]) -+ fi -+fi -+])dnl -+dnl --------------------------------------------------------------------------- -+dnl CF_C_INLINE version: 4 updated: 2012/06/16 14:55:39 - dnl ----------- - dnl Check if the C compiler supports "inline". - dnl $1 is the name of a shell variable to set if inline is supported -@@ -1012,6 +1139,9 @@ - if test "$INTEL_COMPILER" = yes - then - : -+ elif test "$CLANG_COMPILER" = yes -+ then -+ : - elif test "$GCC" = yes - then - AC_CACHE_CHECK(if $CC supports options to tune inlining,cf_cv_gcc_inline,[ -@@ -1057,7 +1187,44 @@ - AC_SUBST(DIRS_TO_MAKE) - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_DISABLE_LEAKS version: 6 updated: 2010/07/23 04:14:32 -+dnl CF_DISABLE_ECHO version: 12 updated: 2012/10/06 16:30:28 -+dnl --------------- -+dnl You can always use "make -n" to see the actual options, but it's hard to -+dnl pick out/analyze warning messages when the compile-line is long. -+dnl -+dnl Sets: -+dnl ECHO_LT - symbol to control if libtool is verbose -+dnl ECHO_LD - symbol to prefix "cc -o" lines -+dnl RULE_CC - symbol to put before implicit "cc -c" lines (e.g., .c.o) -+dnl SHOW_CC - symbol to put before explicit "cc -c" lines -+dnl ECHO_CC - symbol to put before any "cc" line -+dnl -+AC_DEFUN([CF_DISABLE_ECHO],[ -+AC_MSG_CHECKING(if you want to see long compiling messages) -+CF_ARG_DISABLE(echo, -+ [ --disable-echo do not display "compiling" commands], -+ [ -+ ECHO_LT='--silent' -+ ECHO_LD='@echo linking [$]@;' -+ RULE_CC='@echo compiling [$]<' -+ SHOW_CC='@echo compiling [$]@' -+ ECHO_CC='@' -+],[ -+ ECHO_LT='' -+ ECHO_LD='' -+ RULE_CC='' -+ SHOW_CC='' -+ ECHO_CC='' -+]) -+AC_MSG_RESULT($enableval) -+AC_SUBST(ECHO_LT) -+AC_SUBST(ECHO_LD) -+AC_SUBST(RULE_CC) -+AC_SUBST(SHOW_CC) -+AC_SUBST(ECHO_CC) -+])dnl -+dnl --------------------------------------------------------------------------- -+dnl CF_DISABLE_LEAKS version: 7 updated: 2012/10/02 20:55:03 - dnl ---------------- - dnl Combine no-leak checks with the libraries or tools that are used for the - dnl checks. -@@ -1075,8 +1242,8 @@ - AC_MSG_RESULT($with_no_leaks) - - if test "$with_no_leaks" = yes ; then -- AC_DEFINE(NO_LEAKS) -- AC_DEFINE(YY_NO_LEAKS) -+ AC_DEFINE(NO_LEAKS,1,[Define to 1 if you want to perform memory-leak testing.]) -+ AC_DEFINE(YY_NO_LEAKS,1,[Define to 1 if you want to perform memory-leak testing.]) - fi - ])dnl - dnl --------------------------------------------------------------------------- -@@ -1123,6 +1290,30 @@ - fi - ]) - dnl --------------------------------------------------------------------------- -+dnl CF_ENABLE_PC_FILES version: 9 updated: 2012/08/04 13:59:54 -+dnl ------------------ -+dnl This is the "--enable-pc-files" option, which is available if there is a -+dnl pkg-config configuration on the local machine. -+AC_DEFUN([CF_ENABLE_PC_FILES],[ -+AC_REQUIRE([CF_PKG_CONFIG]) -+AC_REQUIRE([CF_WITH_PKG_CONFIG_LIBDIR]) -+ -+if test "$PKG_CONFIG" != none ; then -+ AC_MSG_CHECKING(if we should install .pc files for $PKG_CONFIG) -+ AC_ARG_ENABLE(pc-files, -+ [ --enable-pc-files generate and install .pc files for pkg-config], -+ [enable_pc_files=$enableval], -+ [enable_pc_files=no]) -+ AC_MSG_RESULT($enable_pc_files) -+ if test "$enable_pc_files" != no -+ then -+ CF_PATH_SYNTAX(PKG_CONFIG_LIBDIR) -+ fi -+else -+ enable_pc_files=no -+fi -+])dnl -+dnl --------------------------------------------------------------------------- - dnl CF_ENABLE_RPATH version: 2 updated: 2010/03/27 18:39:42 - dnl --------------- - dnl Check if the rpath option should be used, setting cache variable -@@ -1137,6 +1328,37 @@ - AC_MSG_RESULT($cf_cv_enable_rpath) - ])dnl - dnl --------------------------------------------------------------------------- -+dnl CF_ENABLE_STRING_HACKS version: 3 updated: 2013/01/26 16:26:12 -+dnl ---------------------- -+dnl On a few platforms, the compiler and/or loader nags with untruthful -+dnl comments stating that "most" uses of strcat/strcpy/sprintf are incorrect, -+dnl and implying that most uses of the recommended alternatives are correct. -+dnl -+dnl Factually speaking, no one has actually counted the number of uses of these -+dnl functions versus the total of incorrect uses. Samples of a few thousand -+dnl instances are meaningless compared to the hundreds of millions of lines of -+dnl existing C code. -+dnl -+dnl strlcat/strlcpy are (as of 2012) non-standard, and are available on some -+dnl platforms, in implementations of varying quality. Likewise, snprintf is -+dnl standard - but evolved through phases, and older implementations are likely -+dnl to yield surprising results, as documented in manpages on various systems. -+AC_DEFUN([CF_ENABLE_STRING_HACKS], -+[ -+AC_MSG_CHECKING(if you want to work around bogus compiler/loader warnings) -+AC_ARG_ENABLE(string-hacks, -+ [ --enable-string-hacks work around bogus compiler/loader warnings], -+ [with_string_hacks=$enableval], -+ [with_string_hacks=no]) -+AC_MSG_RESULT($with_string_hacks) -+ -+if test "x$with_string_hacks" = "xyes"; then -+ AC_DEFINE(USE_STRING_HACKS,1,[Define to 1 to work around bogus compiler/loader warnings]) -+ AC_MSG_WARN(enabling string-hacks to work around bogus compiler/loader warnings) -+ AC_CHECK_FUNCS( strlcat strlcpy snprintf ) -+fi -+])dnl -+dnl --------------------------------------------------------------------------- - dnl CF_ERRNO version: 5 updated: 1997/11/30 12:44:39 - dnl -------- - dnl Check if 'errno' is declared in -@@ -1145,7 +1367,7 @@ - CF_CHECK_ERRNO(errno) - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_ETIP_DEFINES version: 3 updated: 2003/03/22 19:13:43 -+dnl CF_ETIP_DEFINES version: 5 updated: 2012/02/18 17:51:07 - dnl --------------- - dnl Test for conflicting definitions of exception in gcc 2.8.0, etc., between - dnl math.h and builtin.h, only for ncurses -@@ -1154,11 +1376,17 @@ - AC_MSG_CHECKING(for special defines needed for etip.h) - cf_save_CXXFLAGS="$CXXFLAGS" - cf_result="none" -+ -+# etip.h includes ncurses.h which includes ncurses_dll.h -+# But ncurses_dll.h is generated - fix here. -+test -d include || mkdir include -+test -f include/ncurses_dll.h || sed -e 's/@NCURSES_WRAP_PREFIX@/'$NCURSES_WRAP_PREFIX'/g' ${srcdir}/include/ncurses_dll.h.in >include/ncurses_dll.h -+ - for cf_math in "" MATH_H - do - for cf_excp in "" MATH_EXCEPTION - do -- CXXFLAGS="$cf_save_CXXFLAGS -I${srcdir}/c++ -I${srcdir}/menu -I${srcdir}/include" -+ CXXFLAGS="$cf_save_CXXFLAGS -I${srcdir}/c++ -I${srcdir}/menu -Iinclude -I${srcdir}/include" - test -n "$cf_math" && CXXFLAGS="$CXXFLAGS -DETIP_NEEDS_${cf_math}" - test -n "$cf_excp" && CXXFLAGS="$CXXFLAGS -DETIP_NEEDS_${cf_excp}" - AC_TRY_COMPILE([ -@@ -1167,7 +1395,7 @@ - test -n "$cf_math" && AC_DEFINE_UNQUOTED(ETIP_NEEDS_${cf_math}) - test -n "$cf_excp" && AC_DEFINE_UNQUOTED(ETIP_NEEDS_${cf_excp}) - cf_result="$cf_math $cf_excp" -- break -+ break 2 - ],[]) - done - done -@@ -1305,7 +1533,35 @@ - fi - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_FUNC_DLSYM version: 2 updated: 2010/05/29 16:31:02 -+dnl CF_FIXUP_ADAFLAGS version: 1 updated: 2012/03/31 18:48:10 -+dnl ----------------- -+dnl make ADAFLAGS consistent with CFLAGS -+AC_DEFUN([CF_FIXUP_ADAFLAGS],[ -+ AC_MSG_CHECKING(optimization options for ADAFLAGS) -+ case "$CFLAGS" in -+ *-g*) -+ CF_ADD_ADAFLAGS(-g) -+ ;; -+ esac -+ case "$CFLAGS" in -+ *-O*) -+ cf_O_flag=`echo "$CFLAGS" |sed -e 's/^.*-O/-O/' -e 's/[[ ]].*//'` -+ CF_ADD_ADAFLAGS($cf_O_flag) -+ ;; -+ esac -+ AC_MSG_RESULT($ADAFLAGS) -+])dnl -+dnl --------------------------------------------------------------------------- -+dnl CF_FORGET_TOOL version: 1 updated: 2013/04/06 18:03:09 -+dnl -------------- -+dnl Forget that we saw the given tool. -+AC_DEFUN([CF_FORGET_TOOL],[ -+unset ac_cv_prog_ac_ct_$1 -+unset ac_ct_$1 -+unset $1 -+])dnl -+dnl --------------------------------------------------------------------------- -+dnl CF_FUNC_DLSYM version: 3 updated: 2012/10/06 11:17:15 - dnl ------------- - dnl Test for dlsym() and related functions, as well as libdl. - dnl -@@ -1332,7 +1588,7 @@ - dlclose(obj); - } - }],[ -- AC_DEFINE(HAVE_LIBDL)],[ -+ AC_DEFINE(HAVE_LIBDL,1,[Define to 1 if we have dl library])],[ - AC_MSG_ERROR(Cannot link test program for libdl)]) - AC_MSG_RESULT(ok) - else -@@ -1340,7 +1596,7 @@ - fi - ]) - dnl --------------------------------------------------------------------------- --dnl CF_FUNC_MEMMOVE version: 7 updated: 2006/12/16 12:33:30 -+dnl CF_FUNC_MEMMOVE version: 8 updated: 2012/10/04 20:12:20 - dnl --------------- - dnl Check for memmove, or a bcopy that can handle overlapping copy. If neither - dnl is found, add our own version of memmove to the list of objects. -@@ -1365,13 +1621,13 @@ - ]) - ],[cf_cv_good_bcopy=no]) - if test "$cf_cv_good_bcopy" = yes ; then -- AC_DEFINE(USE_OK_BCOPY) -+ AC_DEFINE(USE_OK_BCOPY,1,[Define to 1 to use bcopy when memmove is unavailable]) - else -- AC_DEFINE(USE_MY_MEMMOVE) -+ AC_DEFINE(USE_MY_MEMMOVE,1,[Define to 1 to use replacement function when memmove is unavailable]) - fi - ])])dnl - dnl --------------------------------------------------------------------------- --dnl CF_FUNC_NANOSLEEP version: 3 updated: 2006/12/16 12:33:30 -+dnl CF_FUNC_NANOSLEEP version: 4 updated: 2012/10/06 17:56:13 - dnl ----------------- - dnl Check for existence of workable nanosleep() function. Some systems, e.g., - dnl AIX 4.x, provide a non-working version. -@@ -1402,7 +1658,7 @@ - [cf_cv_func_nanosleep=no], - [cf_cv_func_nanosleep=unknown])]) - --test "$cf_cv_func_nanosleep" = "yes" && AC_DEFINE(HAVE_NANOSLEEP) -+test "$cf_cv_func_nanosleep" = "yes" && AC_DEFINE(HAVE_NANOSLEEP,1,[Define to 1 if we have nanosleep()]) - ]) - dnl --------------------------------------------------------------------------- - dnl CF_FUNC_OPENPTY version: 3 updated: 2010/05/29 16:31:02 -@@ -1433,14 +1689,17 @@ - ]) - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_FUNC_POLL version: 4 updated: 2006/12/16 12:33:30 -+dnl CF_FUNC_POLL version: 8 updated: 2012/10/04 05:24:07 - dnl ------------ - dnl See if the poll function really works. Some platforms have poll(), but - dnl it does not work for terminals or files. - AC_DEFUN([CF_FUNC_POLL],[ - AC_CACHE_CHECK(if poll really works,cf_cv_working_poll,[ - AC_TRY_RUN([ -+#include - #include -+#include -+#include - #ifdef HAVE_POLL_H - #include - #else -@@ -1450,19 +1709,42 @@ - struct pollfd myfds; - int ret; - -- myfds.fd = 0; -+ /* check for Darwin bug with respect to "devices" */ -+ myfds.fd = open("/dev/null", 1); /* O_WRONLY */ -+ if (myfds.fd < 0) -+ myfds.fd = 0; - myfds.events = POLLIN; -+ myfds.revents = 0; - - ret = poll(&myfds, 1, 100); -- ${cf_cv_main_return:-return}(ret != 0); -+ -+ if (ret < 0 || (myfds.revents & POLLNVAL)) { -+ ret = -1; -+ } else { -+ int fd = 0; -+ if (!isatty(fd)) { -+ fd = open("/dev/tty", 2); /* O_RDWR */ -+ } -+ -+ if (fd >= 0) { -+ /* also check with standard input */ -+ myfds.fd = fd; -+ myfds.events = POLLIN; -+ myfds.revents = 0; -+ ret = poll(&myfds, 1, 100); -+ } else { -+ ret = -1; -+ } -+ } -+ ${cf_cv_main_return:-return}(ret < 0); - }], - [cf_cv_working_poll=yes], - [cf_cv_working_poll=no], - [cf_cv_working_poll=unknown])]) --test "$cf_cv_working_poll" = "yes" && AC_DEFINE(HAVE_WORKING_POLL) -+test "$cf_cv_working_poll" = "yes" && AC_DEFINE(HAVE_WORKING_POLL,1,[Define to 1 if the poll function seems to work]) - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_FUNC_TERMIOS version: 2 updated: 2000/07/22 23:37:24 -+dnl CF_FUNC_TERMIOS version: 3 updated: 2012/10/06 17:56:13 - dnl --------------- - dnl Some old/broken variations define tcgetattr() only as a macro in - dnl termio(s).h -@@ -1488,10 +1770,10 @@ - tcgetattr(1, &foo);], - [cf_cv_have_tcgetattr=yes], - [cf_cv_have_tcgetattr=no])]) --test "$cf_cv_have_tcgetattr" = yes && AC_DEFINE(HAVE_TCGETATTR) -+test "$cf_cv_have_tcgetattr" = yes && AC_DEFINE(HAVE_TCGETATTR,1,[Define to 1 if we have tcgetattr]) - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_FUNC_VSSCANF version: 3 updated: 2001/12/19 00:50:10 -+dnl CF_FUNC_VSSCANF version: 4 updated: 2012/10/06 17:56:13 - dnl --------------- - dnl Check for vsscanf() function, which is in c9x but generally not in earlier - dnl versions of C. It is in the GNU C library, and can often be simulated by -@@ -1529,14 +1811,14 @@ - cf_cv_func_vsscanf=no])])])]) - - case $cf_cv_func_vsscanf in #(vi --vsscanf) AC_DEFINE(HAVE_VSSCANF);; #(vi --vfscanf) AC_DEFINE(HAVE_VFSCANF);; #(vi --_doscan) AC_DEFINE(HAVE__DOSCAN);; -+vsscanf) AC_DEFINE(HAVE_VSSCANF,1,[Define to 1 if we have vsscanf]);; #(vi -+vfscanf) AC_DEFINE(HAVE_VFSCANF,1,[Define to 1 if we have vfscanf]);; #(vi -+_doscan) AC_DEFINE(HAVE__DOSCAN,1,[Define to 1 if we have _doscan]);; - esac - - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_GCC_ATTRIBUTES version: 14 updated: 2010/10/23 15:52:32 -+dnl CF_GCC_ATTRIBUTES version: 16 updated: 2012/10/02 20:55:03 - dnl ----------------- - dnl Test for availability of useful gcc __attribute__ directives to quiet - dnl compiler warnings. Though useful, not all are supported -- and contrary -@@ -1614,27 +1896,27 @@ - test -n "$verbose" && AC_MSG_RESULT(... $cf_attribute) - cat conftest.h >>confdefs.h - case $cf_attribute in #(vi -+ noreturn) #(vi -+ AC_DEFINE_UNQUOTED(GCC_NORETURN,$cf_directive,[Define to noreturn-attribute for gcc]) -+ ;; - printf) #(vi -- if test "$cf_printf_attribute" = no ; then -- cat >>confdefs.h <>confdefs.h <>confdefs.h <>confdefs.h < conftest.$ac_ext <], -+[int x = optind; char *y = optarg], -+[cf_cv_getopt_header=$cf_header -+ break]) -+done -+]) -+if test $cf_cv_getopt_header != none ; then -+ AC_DEFINE(HAVE_GETOPT_HEADER,1,[Define to 1 if we need to include getopt.h]) -+fi -+])dnl -+dnl --------------------------------------------------------------------------- - dnl CF_GNAT_GENERICS version: 2 updated: 2011/03/23 20:24:41 - dnl ---------------- - AC_DEFUN([CF_GNAT_GENERICS], -@@ -1828,7 +2145,7 @@ - AC_SUBST(PRAGMA_UNREF) - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_GNAT_PROJECTS version: 2 updated: 2011/03/23 20:24:41 -+dnl CF_GNAT_PROJECTS version: 4 updated: 2013/09/07 14:05:46 - dnl ---------------- - dnl GNAT projects are configured with ".gpr" project files. - dnl GNAT libraries are a further development, using the project feature. -@@ -1845,7 +2162,7 @@ - ;; - *) - case $cf_cv_system_name in #(vi -- cygwin*) #(vi -+ cygwin*|msys*) #(vi - ;; - *) - mkdir conftest.src conftest.bin conftest.lib -@@ -2040,7 +2357,7 @@ - rm -rf conftest* *~conftest* - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_GNAT_VERSION version: 17 updated: 2011/03/23 20:24:41 -+dnl CF_GNAT_VERSION version: 18 updated: 2012/01/21 19:28:10 - dnl --------------- - dnl Verify version of GNAT. - AC_DEFUN([CF_GNAT_VERSION], -@@ -2052,7 +2369,7 @@ - AC_MSG_RESULT($cf_gnat_version) - - case $cf_gnat_version in #(vi --3.1[[1-9]]*|3.[[2-9]]*|[[4-9]].*) #(vi -+3.1[[1-9]]*|3.[[2-9]]*|[[4-9]].*|20[[0-9]][[0-9]]) #(vi - cf_cv_prog_gnat_correct=yes - ;; - *) -@@ -2092,7 +2409,7 @@ - test "$cf_cv_gnu_source" = yes && CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_GPP_LIBRARY version: 10 updated: 2010/05/29 16:31:02 -+dnl CF_GPP_LIBRARY version: 11 updated: 2012/10/06 17:56:13 - dnl -------------- - dnl If we're trying to use g++, test if libg++ is installed (a rather common - dnl problem :-). If we have the compiler but no library, we'll be able to -@@ -2119,9 +2436,9 @@ - [cf_cxx_library=yes - CF_ADD_LIB($cf_gpp_libname,CXXLIBS) - if test "$cf_gpp_libname" = cpp ; then -- AC_DEFINE(HAVE_GPP_BUILTIN_H) -+ AC_DEFINE(HAVE_GPP_BUILTIN_H,1,[Define to 1 if we have gpp builtin.h]) - else -- AC_DEFINE(HAVE_GXX_BUILTIN_H) -+ AC_DEFINE(HAVE_GXX_BUILTIN_H,1,[Define to 1 if we have g++ builtin.h]) - fi], - [AC_TRY_LINK([ - #include -@@ -2129,28 +2446,28 @@ - [two_arg_error_handler_t foo2 = lib_error_handler], - [cf_cxx_library=yes - CF_ADD_LIB($cf_gpp_libname,CXXLIBS) -- AC_DEFINE(HAVE_BUILTIN_H)], -+ AC_DEFINE(HAVE_BUILTIN_H,1,[Define to 1 if we have builtin.h])], - [cf_cxx_library=no])]) - LIBS="$cf_save" - AC_MSG_RESULT($cf_cxx_library) - fi - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_GXX_VERSION version: 6 updated: 2010/10/23 15:44:18 -+dnl CF_GXX_VERSION version: 7 updated: 2012/06/16 14:55:39 - dnl -------------- - dnl Check for version of g++ - AC_DEFUN([CF_GXX_VERSION],[ - AC_REQUIRE([AC_PROG_CPP]) - GXX_VERSION=none - if test "$GXX" = yes; then -- AC_MSG_CHECKING(version of g++) -+ AC_MSG_CHECKING(version of ${CXX:-g++}) - GXX_VERSION="`${CXX:-g++} --version| sed -e '2,$d' -e 's/^.*(GCC) //' -e 's/^[[^0-9.]]*//' -e 's/[[^0-9.]].*//'`" - test -z "$GXX_VERSION" && GXX_VERSION=unknown - AC_MSG_RESULT($GXX_VERSION) - fi - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_GXX_WARNINGS version: 6 updated: 2010/08/14 18:25:37 -+dnl CF_GXX_WARNINGS version: 8 updated: 2013/11/16 14:27:53 - dnl --------------- - dnl Check if the compiler supports useful warning options. - dnl -@@ -2173,6 +2490,7 @@ - [ - - CF_INTEL_COMPILER(GXX,INTEL_CPLUSPLUS,CXXFLAGS) -+CF_CLANG_COMPILER(GXX,CLANG_CPLUSPLUS,CXXFLAGS) - - AC_REQUIRE([CF_GXX_VERSION]) - -@@ -2238,16 +2556,17 @@ - for cf_opt in \ - Wabi \ - fabi-version=0 \ -+ Wextra \ -+ Wignored-qualifiers \ -+ Wlogical-op \ - Woverloaded-virtual \ - Wsign-promo \ - Wsynth \ - Wold-style-cast \ - Wcast-align \ - Wcast-qual \ -- Wmissing-prototypes \ - Wpointer-arith \ - Wshadow \ -- Wstrict-prototypes \ - Wundef $cf_gxx_extra_warnings $1 - do - CXXFLAGS="$cf_save_CXXFLAGS $EXTRA_CXXFLAGS -Werror -$cf_opt" -@@ -2464,7 +2783,7 @@ - [AC_DIVERT_HELP([$1])dnl - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_INCLUDE_DIRS version: 6 updated: 2009/01/06 19:37:40 -+dnl CF_INCLUDE_DIRS version: 8 updated: 2013/10/12 16:45:09 - dnl --------------- - dnl Construct the list of include-options according to whether we're building - dnl in the source directory or using '--srcdir=DIR' option. If we're building -@@ -2472,25 +2791,25 @@ - dnl since that usually breaks gcc's shadow-includes. - AC_DEFUN([CF_INCLUDE_DIRS], - [ --CPPFLAGS="$CPPFLAGS -I. -I../include" --if test "$srcdir" != "."; then -- CPPFLAGS="$CPPFLAGS -I\${srcdir}/../include" --fi - if test "$GCC" != yes; then -- CPPFLAGS="$CPPFLAGS -I\${includedir}" -+ CPPFLAGS="-I\${includedir} $CPPFLAGS" - elif test "$includedir" != "/usr/include"; then - if test "$includedir" = '${prefix}/include' ; then -- if test $prefix != /usr ; then -- CPPFLAGS="$CPPFLAGS -I\${includedir}" -+ if test x$prefix != x/usr ; then -+ CPPFLAGS="-I\${includedir} $CPPFLAGS" - fi - else -- CPPFLAGS="$CPPFLAGS -I\${includedir}" -+ CPPFLAGS="-I\${includedir} $CPPFLAGS" - fi - fi -+if test "$srcdir" != "."; then -+ CPPFLAGS="-I\${srcdir}/../include $CPPFLAGS" -+fi -+CPPFLAGS="-I. -I../include $CPPFLAGS" - AC_SUBST(CPPFLAGS) - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_INTEL_COMPILER version: 4 updated: 2010/05/26 05:38:42 -+dnl CF_INTEL_COMPILER version: 5 updated: 2013/02/10 10:41:05 - dnl ----------------- - dnl Check if the given compiler is really the Intel compiler for Linux. It - dnl tries to imitate gcc, but does not return an error when it finds a mismatch -@@ -2504,6 +2823,7 @@ - dnl $2 = INTEL_COMPILER (default) or INTEL_CPLUSPLUS - dnl $3 = CFLAGS (default) or CXXFLAGS - AC_DEFUN([CF_INTEL_COMPILER],[ -+AC_REQUIRE([AC_CANONICAL_HOST]) - ifelse([$2],,INTEL_COMPILER,[$2])=no - - if test "$ifelse([$1],,[$1],GCC)" = yes ; then -@@ -2527,7 +2847,7 @@ - fi - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_ISASCII version: 3 updated: 2000/08/12 23:18:52 -+dnl CF_ISASCII version: 4 updated: 2012/10/06 17:56:13 - dnl ---------- - dnl Check if we have either a function or macro for 'isascii()'. - AC_DEFUN([CF_ISASCII], -@@ -2539,10 +2859,10 @@ - [cf_cv_have_isascii=no]) - ])dnl - AC_MSG_RESULT($cf_cv_have_isascii) --test "$cf_cv_have_isascii" = yes && AC_DEFINE(HAVE_ISASCII) -+test "$cf_cv_have_isascii" = yes && AC_DEFINE(HAVE_ISASCII,1,[Define to 1 if we have isascii()]) - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_LARGEFILE version: 7 updated: 2007/06/02 11:58:50 -+dnl CF_LARGEFILE version: 8 updated: 2012/10/06 08:57:51 - dnl ------------ - dnl Add checks for large file support. - AC_DEFUN([CF_LARGEFILE],[ -@@ -2576,12 +2896,12 @@ - [cf_cv_struct_dirent64=yes], - [cf_cv_struct_dirent64=no]) - ]) -- test "$cf_cv_struct_dirent64" = yes && AC_DEFINE(HAVE_STRUCT_DIRENT64) -+ test "$cf_cv_struct_dirent64" = yes && AC_DEFINE(HAVE_STRUCT_DIRENT64,1,[Define to 1 if we have struct dirent64]) - fi - ]) - ]) - dnl --------------------------------------------------------------------------- --dnl CF_LDFLAGS_STATIC version: 8 updated: 2010/10/23 14:39:56 -+dnl CF_LDFLAGS_STATIC version: 10 updated: 2011/09/24 12:51:48 - dnl ----------------- - dnl Check for compiler/linker flags used to temporarily force usage of static - dnl libraries. This depends on the compiler and platform. Use this to help -@@ -2602,7 +2922,7 @@ - esac - else - case $cf_cv_system_name in #( -- aix[[456]]*) #( from ld manpage -+ aix[[4-7]]*) #( from ld manpage - LDFLAGS_STATIC=-bstatic - LDFLAGS_SHARED=-bdynamic - ;; -@@ -2652,7 +2972,17 @@ - int cf_ldflags_static(FILE *fp); - ],[ - return cf_ldflags_static(stdin); --],[cf_ldflags_static=yes],[cf_ldflags_static=no]) -+],[ -+ # some linkers simply ignore the -dynamic -+ case x`file conftest$ac_exeext 2>/dev/null` in #(vi -+ *static*) # (vi -+ cf_ldflags_static=no -+ ;; -+ *) -+ cf_ldflags_static=yes -+ ;; -+ esac -+],[cf_ldflags_static=no]) - - rm -f libconftest.* - LIBS="$cf_save_LIBS" -@@ -2673,7 +3003,7 @@ - AC_SUBST(LDFLAGS_SHARED) - ]) - dnl --------------------------------------------------------------------------- --dnl CF_LD_RPATH_OPT version: 3 updated: 2010/06/02 05:03:05 -+dnl CF_LD_RPATH_OPT version: 5 updated: 2011/07/17 14:48:41 - dnl --------------- - dnl For the given system and compiler, find the compiler flags to pass to the - dnl loader to use the "rpath" feature. -@@ -2694,10 +3024,10 @@ - linux*|gnu*|k*bsd*-gnu) #(vi - LD_RPATH_OPT="-Wl,-rpath," - ;; --openbsd[[2-9]].*) #(vi -+openbsd[[2-9]].*|mirbsd*) #(vi - LD_RPATH_OPT="-Wl,-rpath," - ;; --freebsd*) #(vi -+dragonfly*|freebsd*) #(vi - LD_RPATH_OPT="-rpath " - ;; - netbsd*) #(vi -@@ -2756,11 +3086,23 @@ - $1="$cf_library_path_list [$]$1" - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_LIB_PREFIX version: 8 updated: 2008/09/13 11:34:16 -+dnl CF_LIBTOOL_VERSION version: 1 updated: 2013/04/06 18:03:09 -+dnl ------------------ -+AC_DEFUN([CF_LIBTOOL_VERSION],[ -+if test -n "$LIBTOOL" && test "$LIBTOOL" != none -+then -+ cf_cv_libtool_version=`$LIBTOOL --version 2>&1 | sed -e '/^$/d' |sed -e '2,$d' -e 's/([[^)]]*)//g' -e 's/^[[^1-9]]*//' -e 's/[[^0-9.]].*//'` -+else -+ cf_cv_libtool_version= -+fi -+test -z "$cf_cv_libtool_version" && unset cf_cv_libtool_version -+])dnl -+dnl --------------------------------------------------------------------------- -+dnl CF_LIB_PREFIX version: 9 updated: 2012/01/21 19:28:10 - dnl ------------- - dnl Compute the library-prefix for the given host system - dnl $1 = variable to set --AC_DEFUN([CF_LIB_PREFIX], -+define([CF_LIB_PREFIX], - [ - case $cf_cv_system_name in #(vi - OS/2*|os2*) #(vi -@@ -2773,11 +3115,11 @@ - AC_SUBST(LIB_PREFIX) - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_LIB_RULES version: 61 updated: 2010/10/23 16:10:30 -+dnl CF_LIB_RULES version: 74 updated: 2013/09/07 13:54:05 - dnl ------------ - dnl Append definitions and rules for the given models to the subdirectory - dnl Makefiles, and the recursion rule for the top-level Makefile. If the --dnl subdirectory is a library-source directory, modify the LIBS_TO_MAKE list in -+dnl subdirectory is a library-source directory, modify the Libs_To_Make list in - dnl the corresponding makefile to list the models that we'll generate. - dnl - dnl For shared libraries, make a list of symbolic links to construct when -@@ -2786,15 +3128,19 @@ - dnl lib.so -> - dnl lib.so. -> - dnl lib.so.. -+dnl -+dnl Note: Libs_To_Make is mixed case, since it is not a pure autoconf variable. - AC_DEFUN([CF_LIB_RULES], - [ --CF_LIB_PREFIX(cf_prefix) -+cf_prefix=$LIB_PREFIX - AC_REQUIRE([CF_SUBST_NCURSES_VERSION]) - --if test $cf_cv_shlib_version = cygdll ; then -+case $cf_cv_shlib_version in #(vi -+cygdll|msysdll|mingw) - TINFO_NAME=$TINFO_ARG_SUFFIX - TINFO_SUFFIX=.dll --fi -+ ;; -+esac - - if test -n "$TINFO_SUFFIX" ; then - case $TINFO_SUFFIX in -@@ -2820,79 +3166,78 @@ - elif test -f $srcdir/$cf_dir/modules; then - - SHARED_LIB= -- LIBS_TO_MAKE= -+ Libs_To_Make= - for cf_item in $cf_LIST_MODELS - do - CF_LIB_SUFFIX($cf_item,cf_suffix,cf_depsuf) -+ cf_libname=$cf_dir -+ test "$cf_dir" = c++ && cf_libname=ncurses++ - if test $cf_item = shared ; then -- if test "$cf_cv_do_symlinks" = yes ; then -- case "$cf_cv_shlib_version" in #(vi -- rel) #(vi -- case "$cf_cv_system_name" in #(vi -- darwin*) -- case .${LIB_SUFFIX} in -- .tw*) -- cf_suffix=`echo $cf_suffix | sed 's/^tw//'` -- cf_suffix=tw'.${REL_VERSION}'"$cf_suffix" -- ;; -- .t*) -- cf_suffix=`echo $cf_suffix | sed 's/^t//'` -- cf_suffix=t'.${REL_VERSION}'"$cf_suffix" -- ;; -- .w*) -- cf_suffix=`echo $cf_suffix | sed 's/^w//'` -- cf_suffix=w'.${REL_VERSION}'"$cf_suffix" -+ if test -n "${LIB_SUFFIX}" -+ then -+ cf_shared_suffix=`echo "$cf_suffix" | sed 's/^'"${LIB_SUFFIX}"'//'` -+ else -+ cf_shared_suffix="$cf_suffix" -+ fi -+ if test "$cf_cv_do_symlinks" = yes ; then -+ cf_version_name= -+ -+ case "$cf_cv_shlib_version" in #(vi -+ rel) #(vi -+ cf_version_name=REL_VERSION - ;; -- *) -- cf_suffix='.${REL_VERSION}'"$cf_suffix" -+ abi) -+ cf_version_name=ABI_VERSION - ;; - esac -- ;; #(vi -- *) cf_suffix="$cf_suffix"'.${REL_VERSION}' ;; -- esac -+ -+ if test -n "$cf_version_name" -+ then -+ case "$cf_cv_system_name" in #(vi -+ darwin*) -+ # "w", etc? -+ cf_suffix="${LIB_SUFFIX}"'.${'$cf_version_name'}'"$cf_shared_suffix" -+ ;; #(vi -+ *) -+ cf_suffix="$cf_suffix"'.${'$cf_version_name'}' -+ ;; -+ esac -+ fi -+ if test -n "${LIB_SUFFIX}" -+ then -+ cf_shared_suffix=`echo "$cf_suffix" | sed 's/^'"${LIB_SUFFIX}"'//'` -+ else -+ cf_shared_suffix="$cf_suffix" -+ fi -+ fi -+ # cygwin needs import library, and has unique naming convention -+ # use autodetected ${cf_prefix} for import lib and static lib, but -+ # use 'cyg' prefix for shared lib. -+ case $cf_cv_shlib_version in #(vi -+ cygdll) #(vi -+ cf_cygsuf=`echo "$cf_suffix" | sed -e 's/\.dll/\${ABI_VERSION}.dll/'` -+ Libs_To_Make="$Libs_To_Make ../lib/cyg${cf_libname}${cf_cygsuf}" -+ continue - ;; -- abi) -- case "$cf_cv_system_name" in #(vi -- darwin*) -- case .${LIB_SUFFIX} in -- .tw*) -- cf_suffix=`echo $cf_suffix | sed 's/^tw//'` -- cf_suffix=tw'.${ABI_VERSION}'"$cf_suffix" -- ;; -- .t*) -- cf_suffix=`echo $cf_suffix | sed 's/^t//'` -- cf_suffix=t'.${ABI_VERSION}'"$cf_suffix" -- ;; -- .w*) -- cf_suffix=`echo $cf_suffix | sed 's/^w//'` -- cf_suffix=w'.${ABI_VERSION}'"$cf_suffix" -- ;; -- *) -- cf_suffix='.${ABI_VERSION}'"$cf_suffix" -- ;; -- esac -- ;; #(vi -- *) cf_suffix="$cf_suffix"'.${ABI_VERSION}' ;; -- esac -+ msysdll) #(vi -+ cf_cygsuf=`echo "$cf_suffix" | sed -e 's/\.dll/\${ABI_VERSION}.dll/'` -+ Libs_To_Make="$Libs_To_Make ../lib/msys-${cf_libname}${cf_cygsuf}" -+ continue -+ ;; -+ mingw) -+ cf_cygsuf=`echo "$cf_suffix" | sed -e 's/\.dll/\${ABI_VERSION}.dll/'` -+ Libs_To_Make="$Libs_To_Make ../lib/lib${cf_libname}${cf_cygsuf}" -+ continue - ;; - esac - fi -- # cygwin needs import library, and has unique naming convention -- # use autodetected ${cf_prefix} for import lib and static lib, but -- # use 'cyg' prefix for shared lib. -- if test $cf_cv_shlib_version = cygdll ; then -- cf_cygsuf=`echo "$cf_suffix" | sed -e 's/\.dll/\${ABI_VERSION}.dll/'` -- LIBS_TO_MAKE="$LIBS_TO_MAKE ../lib/cyg${cf_dir}${cf_cygsuf}" -- continue -- fi -- fi -- LIBS_TO_MAKE="$LIBS_TO_MAKE ../lib/${cf_prefix}${cf_dir}${cf_suffix}" -+ Libs_To_Make="$Libs_To_Make ../lib/${cf_prefix}${cf_libname}${cf_suffix}" - done - - if test $cf_dir = ncurses ; then - cf_subsets="$LIB_SUBSETS" - cf_r_parts="$cf_subsets" -- cf_liblist="$LIBS_TO_MAKE" -+ cf_liblist="$Libs_To_Make" - - while test -n "$cf_r_parts" - do -@@ -2912,7 +3257,7 @@ - ;; - esac - if test -n "$cf_item"; then -- LIBS_TO_MAKE="$cf_item $LIBS_TO_MAKE" -+ Libs_To_Make="$cf_item $Libs_To_Make" - fi - else - break -@@ -2922,13 +3267,40 @@ - cf_subsets=`echo "$LIB_SUBSETS" | sed -e 's/^termlib.* //'` - fi - -- sed -e "s%@LIBS_TO_MAKE@%$LIBS_TO_MAKE%" \ -+ if test $cf_dir = c++; then -+ if test "x$with_shared_cxx" != xyes && test -n "$cf_shared_suffix"; then -+ cf_list= -+ for cf_item in $Libs_To_Make -+ do -+ case $cf_item in -+ *.a) -+ ;; -+ *) -+ cf_item=`echo "$cf_item" | sed -e "s,"$cf_shared_suffix",.a,"` -+ ;; -+ esac -+ for cf_test in $cf_list -+ do -+ if test "$cf_test" = "$cf_item" -+ then -+ cf_LIST_MODELS=`echo "$cf_LIST_MODELS" | sed -e 's/normal//'` -+ cf_item= -+ break -+ fi -+ done -+ test -n "$cf_item" && cf_list="$cf_list $cf_item" -+ done -+ Libs_To_Make="$cf_list" -+ fi -+ fi -+ -+ sed -e "s%@Libs_To_Make@%$Libs_To_Make%" \ - -e "s%@SHARED_LIB@%$SHARED_LIB%" \ - $cf_dir/Makefile >$cf_dir/Makefile.out - mv $cf_dir/Makefile.out $cf_dir/Makefile - - $AWK -f $srcdir/mk-0th.awk \ -- libname="${cf_dir}${LIB_SUFFIX}" subsets="$LIB_SUBSETS" \ -+ libname="${cf_dir}${LIB_SUFFIX}" subsets="$LIB_SUBSETS" ticlib="$TICS_LIB_SUFFIX" termlib="$TINFO_LIB_SUFFIX" \ - $srcdir/$cf_dir/modules >>$cf_dir/Makefile - - for cf_subset in $cf_subsets -@@ -2936,8 +3308,23 @@ - cf_subdirs= - for cf_item in $cf_LIST_MODELS - do -+ - echo "Appending rules for ${cf_item} model (${cf_dir}: ${cf_subset})" - CF_UPPER(cf_ITEM,$cf_item) -+ -+ CXX_MODEL=$cf_ITEM -+ if test "$CXX_MODEL" = SHARED; then -+ case $cf_cv_shlib_version in #(vi -+ cygdll|msysdll|mingw) #(vi -+ test "x$with_shared_cxx" = xno && CF_VERBOSE(overriding CXX_MODEL to SHARED) -+ with_shared_cxx=yes -+ ;; -+ *) -+ test "x$with_shared_cxx" = xno && CXX_MODEL=NORMAL -+ ;; -+ esac -+ fi -+ - CF_LIB_SUFFIX($cf_item,cf_suffix,cf_depsuf) - CF_OBJ_SUBDIR($cf_item,cf_subdir) - -@@ -2955,6 +3342,8 @@ - cf_libname=$TICS_LIB_SUFFIX - ;; - esac -+ elif test $cf_dir = c++ ; then -+ cf_libname=ncurses++$LIB_SUFFIX - else - cf_libname=${cf_libname}$LIB_SUFFIX - fi -@@ -3006,10 +3395,12 @@ - name=${cf_libname}${cf_dir_suffix} \ - traces=$LIB_TRACING \ - MODEL=$cf_ITEM \ -+ CXX_MODEL=$CXX_MODEL \ - model=$cf_subdir \ - prefix=$cf_prefix \ - suffix=$cf_suffix \ - subset=$cf_subset \ -+ driver=$cf_cv_term_driver \ - SymLink="$LN_S" \ - TermlibRoot=$TINFO_NAME \ - TermlibSuffix=$TINFO_SUFFIX \ -@@ -3048,7 +3439,7 @@ - done - fi - -- echo ' cd '$cf_dir' && ${MAKE} ${CF_MFLAGS} [$]@' >>Makefile -+ echo ' cd '$cf_dir' && ${MAKE} ${TOP_MFLAGS} [$]@' >>Makefile - done - - for cf_dir in $SRC_SUBDIRS -@@ -3063,7 +3454,7 @@ - echo 'libs \' >> Makefile - echo 'install.libs \' >> Makefile - echo 'uninstall.libs ::' >> Makefile -- echo ' cd '$cf_dir' && ${MAKE} ${CF_MFLAGS} [$]@' >> Makefile -+ echo ' cd '$cf_dir' && ${MAKE} ${TOP_MFLAGS} [$]@' >> Makefile - ;; - esac - fi -@@ -3086,7 +3477,7 @@ - uninstall.libs \\ - install.$cf_dir \\ - uninstall.$cf_dir :: -- cd $cf_dir && \${MAKE} \${CF_MFLAGS} \[$]@ -+ cd $cf_dir && \${MAKE} \${TOP_MFLAGS} \[$]@ - CF_EOF - elif test -f $srcdir/$cf_dir/headers; then - cat >> Makefile <> Makefile <> Makefile <>$cf_man_alias <<-CF_EOF2 - s,@DATADIR@,\$datadir,g -- s,@TERMINFO@,\$TERMINFO,g -- s,@NCURSES_MAJOR@,\$NCURSES_MAJOR,g -- s,@NCURSES_MINOR@,\$NCURSES_MINOR,g -- s,@NCURSES_PATCH@,\$NCURSES_PATCH,g -- s,@NCURSES_OSPEED@,\$NCURSES_OSPEED,g -+ s,@TERMINFO@,\${TERMINFO:="no default value"},g -+ s,@TERMINFO_DIRS@,\${TERMINFO_DIRS:="no default value"},g -+ s,@NCURSES_MAJOR@,\${NCURSES_MAJOR:="no default value"},g -+ s,@NCURSES_MINOR@,\${NCURSES_MINOR:="no default value"},g -+ s,@NCURSES_PATCH@,\${NCURSES_PATCH:="no default value"},g -+ s,@NCURSES_OSPEED@,\${NCURSES_OSPEED:="no default value"},g - CF_EOF - ifelse($1,,,[ - for cf_name in $1 -@@ -3949,7 +4333,9 @@ - - if test "$MANPAGE_ALIASES" != no ; then - cat >>$cf_edit_man <>$cf_edit_man <\$TMP.out -+ mv \$TMP.out \$TMP -+CF_EOF -+fi -+ - if test $with_curses_h != yes ; then - cat >>$cf_edit_man <\$TMP.out -@@ -4154,7 +4547,7 @@ - fi - ]) - dnl --------------------------------------------------------------------------- --dnl CF_MIXEDCASE_FILENAMES version: 3 updated: 2003/09/20 17:07:55 -+dnl CF_MIXEDCASE_FILENAMES version: 6 updated: 2013/10/08 17:47:05 - dnl ---------------------- - dnl Check if the file-system supports mixed-case filenames. If we're able to - dnl create a lowercase name and see it as uppercase, it doesn't support that. -@@ -4163,7 +4556,7 @@ - AC_CACHE_CHECK(if filesystem supports mixed-case filenames,cf_cv_mixedcase,[ - if test "$cross_compiling" = yes ; then - case $target_alias in #(vi -- *-os2-emx*|*-msdosdjgpp*|*-cygwin*|*-mingw32*|*-uwin*) #(vi -+ *-os2-emx*|*-msdosdjgpp*|*-cygwin*|*-msys*|*-mingw*|*-uwin*) #(vi - cf_cv_mixedcase=no - ;; - *) -@@ -4181,10 +4574,10 @@ - rm -f conftest CONFTEST - fi - ]) --test "$cf_cv_mixedcase" = yes && AC_DEFINE(MIXEDCASE_FILENAMES) -+test "$cf_cv_mixedcase" = yes && AC_DEFINE(MIXEDCASE_FILENAMES,1,[Define to 1 if filesystem supports mixed-case filenames.]) - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_MKSTEMP version: 7 updated: 2010/08/14 18:25:37 -+dnl CF_MKSTEMP version: 9 updated: 2012/10/03 04:34:49 - dnl ---------- - dnl Check for a working mkstemp. This creates two files, checks that they are - dnl successfully created and distinct (AmigaOS apparently fails on the last). -@@ -4226,11 +4619,13 @@ - } - ],[cf_cv_func_mkstemp=yes - ],[cf_cv_func_mkstemp=no --],[AC_CHECK_FUNC(mkstemp) --]) -+],[cf_cv_func_mkstemp=maybe]) - ]) -+if test "x$cf_cv_func_mkstemp" = xmaybe ; then -+ AC_CHECK_FUNC(mkstemp) -+fi - if test "x$cf_cv_func_mkstemp" = xyes || test "x$ac_cv_func_mkstemp" = xyes ; then -- AC_DEFINE(HAVE_MKSTEMP) -+ AC_DEFINE(HAVE_MKSTEMP,1,[Define to 1 if mkstemp() is available and working.]) - fi - ])dnl - dnl --------------------------------------------------------------------------- -@@ -4258,14 +4653,14 @@ - fi - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_NO_LEAKS_OPTION version: 4 updated: 2006/12/16 14:24:05 -+dnl CF_NO_LEAKS_OPTION version: 5 updated: 2012/10/02 20:55:03 - dnl ------------------ - dnl see CF_WITH_NO_LEAKS - AC_DEFUN([CF_NO_LEAKS_OPTION],[ - AC_MSG_CHECKING(if you want to use $1 for testing) - AC_ARG_WITH($1, - [$2], -- [AC_DEFINE($3)ifelse([$4],,[ -+ [AC_DEFINE_UNQUOTED($3,1,"Define to 1 if you want to use $1 for testing.")ifelse([$4],,[ - $4 - ]) - : ${with_cflags:=-g} -@@ -4306,7 +4701,7 @@ - fi - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_OBJ_SUBDIR version: 4 updated: 2002/02/23 20:38:31 -+dnl CF_OBJ_SUBDIR version: 6 updated: 2013/09/07 14:06:10 - dnl ------------- - dnl Compute the object-directory name from the given model name - AC_DEFUN([CF_OBJ_SUBDIR], -@@ -4318,7 +4713,7 @@ - profile) $2='obj_p' ;; - shared) - case $cf_cv_system_name in #(vi -- cygwin) #(vi -+ cygwin|msys) #(vi - $2='objects' ;; - *) - $2='obj_s' ;; -@@ -4326,20 +4721,23 @@ - esac - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_PATHSEP version: 5 updated: 2010/05/26 05:38:42 -+dnl CF_PATHSEP version: 6 updated: 2012/09/29 18:38:12 - dnl ---------- --dnl Provide a value for the $PATH and similar separator -+dnl Provide a value for the $PATH and similar separator (or amend the value -+dnl as provided in autoconf 2.5x). - AC_DEFUN([CF_PATHSEP], - [ -+ AC_MSG_CHECKING(for PATH separator) - case $cf_cv_system_name in - os2*) PATH_SEPARATOR=';' ;; -- *) PATH_SEPARATOR=':' ;; -+ *) ${PATH_SEPARATOR:=':'} ;; - esac - ifelse([$1],,,[$1=$PATH_SEPARATOR]) - AC_SUBST(PATH_SEPARATOR) -+ AC_MSG_RESULT($PATH_SEPARATOR) - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_PATH_SYNTAX version: 13 updated: 2010/05/26 05:38:42 -+dnl CF_PATH_SYNTAX version: 14 updated: 2012/06/19 20:58:54 - dnl -------------- - dnl Check the argument to see that it looks like a pathname. Rewrite it if it - dnl begins with one of the prefix/exec_prefix variables, and then again if the -@@ -4359,7 +4757,7 @@ - ;; - .[[a-zA-Z]]:[[\\/]]*) #(vi OS/2 EMX - ;; --.\[$]{*prefix}*) #(vi -+.\[$]{*prefix}*|.\[$]{*dir}*) #(vi - eval $1="[$]$1" - case ".[$]$1" in #(vi - .NONE/*) -@@ -4376,7 +4774,7 @@ - esac - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_PKG_CONFIG version: 4 updated: 2011/02/18 20:26:24 -+dnl CF_PKG_CONFIG version: 7 updated: 2011/04/29 04:53:22 - dnl ------------- - dnl Check for the package-config program, unless disabled by command-line. - AC_DEFUN([CF_PKG_CONFIG], -@@ -4393,7 +4791,9 @@ - PKG_CONFIG=none - ;; - yes) #(vi -- AC_PATH_TOOL(PKG_CONFIG, pkg-config, none) -+ CF_ACVERSION_CHECK(2.52, -+ [AC_PATH_TOOL(PKG_CONFIG, pkg-config, none)], -+ [AC_PATH_PROG(PKG_CONFIG, pkg-config, none)]) - ;; - *) - PKG_CONFIG=$withval -@@ -4554,6 +4954,19 @@ - test -z "$AWK" && AC_MSG_ERROR(No awk program found) - ])dnl - dnl --------------------------------------------------------------------------- -+dnl CF_PROG_CC version: 3 updated: 2012/10/06 15:31:55 -+dnl ---------- -+dnl standard check for CC, plus followup sanity checks -+dnl $1 = optional parameter to pass to AC_PROG_CC to specify compiler name -+AC_DEFUN([CF_PROG_CC],[ -+ifelse($1,,[AC_PROG_CC],[AC_PROG_CC($1)]) -+CF_GCC_VERSION -+CF_ACVERSION_CHECK(2.52, -+ [AC_PROG_CC_STDC], -+ [CF_ANSI_CC_REQD]) -+CF_CC_ENV_FLAGS -+])dnl -+dnl --------------------------------------------------------------------------- - dnl CF_PROG_CC_C_O version: 3 updated: 2010/08/14 18:25:37 - dnl -------------- - dnl Analogous to AC_PROG_CC_C_O, but more useful: tests only $CC, ensures that -@@ -4593,31 +5006,6 @@ - fi - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_PROG_CC_U_D version: 1 updated: 2005/07/14 16:59:30 --dnl -------------- --dnl Check if C (preprocessor) -U and -D options are processed in the order --dnl given rather than by type of option. Some compilers insist on apply all --dnl of the -U options after all of the -D options. Others allow mixing them, --dnl and may predefine symbols that conflict with those we define. --AC_DEFUN([CF_PROG_CC_U_D], --[ --AC_CACHE_CHECK(if $CC -U and -D options work together,cf_cv_cc_u_d_options,[ -- cf_save_CPPFLAGS="$CPPFLAGS" -- CPPFLAGS="-UU_D_OPTIONS -DU_D_OPTIONS -DD_U_OPTIONS -UD_U_OPTIONS" -- AC_TRY_COMPILE([],[ --#ifndef U_D_OPTIONS --make an undefined-error --#endif --#ifdef D_U_OPTIONS --make a defined-error --#endif -- ],[ -- cf_cv_cc_u_d_options=yes],[ -- cf_cv_cc_u_d_options=no]) -- CPPFLAGS="$cf_save_CPPFLAGS" --]) --])dnl --dnl --------------------------------------------------------------------------- - dnl CF_PROG_EGREP version: 1 updated: 2006/09/16 11:40:59 - dnl ------------- - dnl AC_PROG_EGREP was introduced in autoconf 2.53. -@@ -4633,32 +5021,7 @@ - test -z "$EGREP" && AC_MSG_ERROR(No egrep program found) - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_PROG_EXT version: 10 updated: 2004/01/03 19:28:18 --dnl ----------- --dnl Compute $PROG_EXT, used for non-Unix ports, such as OS/2 EMX. --AC_DEFUN([CF_PROG_EXT], --[ --AC_REQUIRE([CF_CHECK_CACHE]) --case $cf_cv_system_name in --os2*) -- CFLAGS="$CFLAGS -Zmt" -- CPPFLAGS="$CPPFLAGS -D__ST_MT_ERRNO__" -- CXXFLAGS="$CXXFLAGS -Zmt" -- # autoconf's macro sets -Zexe and suffix both, which conflict:w -- LDFLAGS="$LDFLAGS -Zmt -Zcrtdll" -- ac_cv_exeext=.exe -- ;; --esac -- --AC_EXEEXT --AC_OBJEXT -- --PROG_EXT="$EXEEXT" --AC_SUBST(PROG_EXT) --test -n "$PROG_EXT" && AC_DEFINE_UNQUOTED(PROG_EXT,"$PROG_EXT") --])dnl --dnl --------------------------------------------------------------------------- --dnl CF_PROG_GNAT version: 1 updated: 2010/06/19 15:22:18 -+dnl CF_PROG_GNAT version: 2 updated: 2011/10/22 14:01:47 - dnl ------------ - dnl Check for gnatmake, ensure that it is complete. - AC_DEFUN([CF_PROG_GNAT],[ -@@ -4666,6 +5029,7 @@ - AC_CHECK_PROG(gnat_exists, $cf_ada_make, yes, no) - if test "$ac_cv_prog_gnat_exists" = no; then - cf_ada_make= -+ cf_cv_prog_gnat_correct=no - else - CF_GNAT_VERSION - AC_CHECK_PROG(M4_exists, m4, yes, no) -@@ -4709,7 +5073,7 @@ - esac - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_PROG_LDCONFIG version: 2 updated: 2008/12/13 14:08:40 -+dnl CF_PROG_LDCONFIG version: 3 updated: 2011/06/04 20:09:13 - dnl ---------------- - dnl Check for ldconfig, needed to fixup shared libraries that would be built - dnl and then used in the install. -@@ -4718,7 +5082,7 @@ - LDCONFIG=: - else - case "$cf_cv_system_name" in #(vi --dragonfly*|freebsd*) #(vi -+dragonfly*|mirbsd*|freebsd*) #(vi - test -z "$LDCONFIG" && LDCONFIG="/sbin/ldconfig -R" - ;; - *) LDPATH=$PATH:/sbin:/usr/sbin -@@ -4759,7 +5123,7 @@ - test "$cf_prog_ln_sf" = yes && LN_S="$LN_S -f" - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_REGEX version: 8 updated: 2010/08/07 14:09:44 -+dnl CF_REGEX version: 10 updated: 2012/10/04 20:12:20 - dnl -------- - dnl Attempt to determine if we've got one of the flavors of regular-expression - dnl code that we can support. -@@ -4771,7 +5135,7 @@ - cf_regex_libs="regex re" - case $host_os in #(vi - mingw*) -- cf_regex_libs="regex.dll $cf_regex_libs" -+ cf_regex_libs="gnurx $cf_regex_libs" - ;; - esac - -@@ -4833,9 +5197,9 @@ - - case $cf_cv_regex_hdrs in #(vi - no) AC_MSG_WARN(no regular expression header found) ;; #(vi -- regex.h) AC_DEFINE(HAVE_REGEX_H_FUNCS) ;; #(vi -- regexp.h) AC_DEFINE(HAVE_REGEXP_H_FUNCS) ;; #(vi -- regexpr.h) AC_DEFINE(HAVE_REGEXPR_H_FUNCS) ;; -+ regex.h) AC_DEFINE(HAVE_REGEX_H_FUNCS,1,[Define to 1 to include regex.h for regular expressions]) ;; #(vi -+ regexp.h) AC_DEFINE(HAVE_REGEXP_H_FUNCS,1,[Define to 1 to include regexp.h for regular expressions]) ;; #(vi -+ regexpr.h) AC_DEFINE(HAVE_REGEXPR_H_FUNCS,1,[Define to 1 to include regexpr.h for regular expressions]) ;; - esac - ])dnl - dnl --------------------------------------------------------------------------- -@@ -4869,7 +5233,7 @@ - $1=`echo "$2" | sed -e 's/-l$3[[ ]]//g' -e 's/-l$3[$]//'` - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_RPATH_HACK version: 9 updated: 2011/02/13 13:31:33 -+dnl CF_RPATH_HACK version: 11 updated: 2013/09/01 13:02:00 - dnl ------------- - AC_DEFUN([CF_RPATH_HACK], - [ -@@ -4886,8 +5250,8 @@ - - AC_TRY_LINK([#include ], - [printf("Hello");], -- [cf_rpath_oops=`$cf_ldd_prog conftest$ac_exeext | fgrep ' not found' | sed -e 's% =>.*$%%' |sort -u` -- cf_rpath_list=`$cf_ldd_prog conftest$ac_exeext | fgrep / | sed -e 's%^.*[[ ]]/%/%' -e 's%/[[^/]][[^/]]*$%%' |sort -u`]) -+ [cf_rpath_oops=`$cf_ldd_prog conftest$ac_exeext | fgrep ' not found' | sed -e 's% =>.*$%%' |sort | uniq` -+ cf_rpath_list=`$cf_ldd_prog conftest$ac_exeext | fgrep / | sed -e 's%^.*[[ ]]/%/%' -e 's%/[[^/]][[^/]]*$%%' |sort | uniq`]) - - # If we passed the link-test, but get a "not found" on a given library, - # this could be due to inept reconfiguration of gcc to make it only -@@ -4920,6 +5284,8 @@ - CF_RPATH_HACK_2(LIBS) - - CF_VERBOSE(...checked EXTRA_LDFLAGS $EXTRA_LDFLAGS) -+else -+ AC_MSG_RESULT(no) - fi - AC_SUBST(EXTRA_LDFLAGS) - ])dnl -@@ -4984,18 +5350,19 @@ - AC_SUBST(EXTRA_LDFLAGS) - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_SHARED_OPTS version: 64 updated: 2010/06/05 16:51:16 -+dnl CF_SHARED_OPTS version: 84 updated: 2013/11/03 06:26:10 - dnl -------------- - dnl -------------- - dnl Attempt to determine the appropriate CC/LD options for creating a shared - dnl library. - dnl --dnl Note: ${LOCAL_LDFLAGS} is used to link executables that will run within the --dnl build-tree, i.e., by making use of the libraries that are compiled in ../lib --dnl We avoid compiling-in a ../lib path for the shared library since that can --dnl lead to unexpected results at runtime. --dnl ${LOCAL_LDFLAGS2} has the same intention but assumes that the shared libraries --dnl are compiled in ../../lib -+dnl Notes: -+dnl a) ${LOCAL_LDFLAGS} is used to link executables that will run within -+dnl the build-tree, i.e., by making use of the libraries that are compiled in -+dnl $rel_builddir/lib We avoid compiling-in a $rel_builddir/lib path for the -+dnl shared library since that can lead to unexpected results at runtime. -+dnl b) ${LOCAL_LDFLAGS2} has the same intention but assumes that the shared -+dnl libraries are compiled in ../../lib - dnl - dnl The variable 'cf_cv_do_symlinks' is used to control whether we configure - dnl to install symbolic links to the rel/abi versions of shared libraries. -@@ -5010,12 +5377,19 @@ - dnl Some loaders leave 'so_locations' lying around. It's nice to clean up. - AC_DEFUN([CF_SHARED_OPTS], - [ -- AC_REQUIRE([CF_SUBST_NCURSES_VERSION]) - AC_REQUIRE([CF_LD_RPATH_OPT]) -+ RM_SHARED_OPTS= - LOCAL_LDFLAGS= - LOCAL_LDFLAGS2= - LD_SHARED_OPTS= - INSTALL_LIB="-m 644" -+ : ${rel_builddir:=.} -+ -+ shlibdir=$libdir -+ AC_SUBST(shlibdir) -+ -+ MAKE_DLLS="#" -+ AC_SUBST(MAKE_DLLS) - - cf_cv_do_symlinks=no - cf_ld_rpath_opt= -@@ -5040,6 +5414,7 @@ - AC_MSG_RESULT($cf_cv_shlib_version) - - cf_cv_rm_so_locs=no -+ cf_try_cflags= - - # Some less-capable ports of gcc support only -fpic - CC_SHARED_OPTS= -@@ -5059,10 +5434,14 @@ - cf_cv_shlib_version_infix=no - - case $cf_cv_system_name in #(vi -- aix[[56]]*) #(vi -+ aix4.[3-9]*|aix[[5-7]]*) #(vi - if test "$GCC" = yes; then - CC_SHARED_OPTS= -- MK_SHARED_LIB='$(CC) -shared' -+ MK_SHARED_LIB='${CC} -shared -Wl,-brtl -Wl,-blibpath:${RPATH_LIST}:/usr/lib -o [$]@' -+ else -+ # CC_SHARED_OPTS='-qpic=large -G' -+ # perhaps "-bM:SRE -bnoentry -bexpall" -+ MK_SHARED_LIB='${CC} -G -Wl,-brtl -Wl,-blibpath:${RPATH_LIST}:/usr/lib -o [$]@' - fi - ;; - beos*) #(vi -@@ -5070,9 +5449,12 @@ - ;; - cygwin*) #(vi - CC_SHARED_OPTS= -- MK_SHARED_LIB='sh ../mk_shared_lib.sh [$]@ [$]{CC} [$]{CFLAGS}' -+ MK_SHARED_LIB='sh '$rel_builddir'/mk_shared_lib.sh [$]@ [$]{CC} [$]{CFLAGS}' -+ RM_SHARED_OPTS="$RM_SHARED_OPTS $rel_builddir/mk_shared_lib.sh *.dll.a" - cf_cv_shlib_version=cygdll - cf_cv_shlib_version_infix=cygdll -+ shlibdir=$bindir -+ MAKE_DLLS= - cat >mk_shared_lib.sh <<-CF_EOF - #!/bin/sh - SHARED_LIB=\[$]1 -@@ -5083,12 +5465,34 @@ - ** SHARED_LIB \[$]SHARED_LIB - ** IMPORT_LIB \[$]IMPORT_LIB - EOF -- exec \[$]* -shared -Wl,--out-implib=../lib/\[$]{IMPORT_LIB} -Wl,--export-all-symbols -o ../lib/\[$]{SHARED_LIB} -+ exec \[$]* -shared -Wl,--out-implib=\[$]{IMPORT_LIB} -Wl,--export-all-symbols -o \[$]{SHARED_LIB} -+CF_EOF -+ chmod +x mk_shared_lib.sh -+ ;; -+ msys*) #(vi -+ CC_SHARED_OPTS= -+ MK_SHARED_LIB='sh '$rel_builddir'/mk_shared_lib.sh [$]@ [$]{CC} [$]{CFLAGS}' -+ RM_SHARED_OPTS="$RM_SHARED_OPTS $rel_builddir/mk_shared_lib.sh *.dll.a" -+ cf_cv_shlib_version=msysdll -+ cf_cv_shlib_version_infix=msysdll -+ shlibdir=$bindir -+ MAKE_DLLS= -+ cat >mk_shared_lib.sh <<-CF_EOF -+ #!/bin/sh -+ SHARED_LIB=\[$]1 -+ IMPORT_LIB=\`echo "\[$]1" | sed -e 's/msys-/lib/' -e 's/[[0-9]]*\.dll[$]/.dll.a/'\` -+ shift -+ cat <<-EOF -+ Linking shared library -+ ** SHARED_LIB \[$]SHARED_LIB -+ ** IMPORT_LIB \[$]IMPORT_LIB -+EOF -+ exec \[$]* -shared -Wl,--out-implib=\[$]{IMPORT_LIB} -Wl,--export-all-symbols -o \[$]{SHARED_LIB} - CF_EOF - chmod +x mk_shared_lib.sh - ;; - darwin*) #(vi -- EXTRA_CFLAGS="-no-cpp-precomp" -+ cf_try_cflags="no-cpp-precomp" - CC_SHARED_OPTS="-dynamic" - MK_SHARED_LIB='${CC} ${CFLAGS} -dynamiclib -install_name ${libdir}/`basename $[@]` -compatibility_version ${ABI_VERSION} -current_version ${ABI_VERSION} -o $[@]' - test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=abi -@@ -5102,6 +5506,14 @@ - LDFLAGS="$LDFLAGS -Wl,-search_paths_first" - fi - ;; -+ hpux[[7-8]]*) #(vi -+ # HP-UX 8.07 ld lacks "+b" option used for libdir search-list -+ if test "$GCC" != yes; then -+ CC_SHARED_OPTS='+Z' -+ fi -+ MK_SHARED_LIB='${LD} -b -o $[@]' -+ INSTALL_LIB="-m 555" -+ ;; - hpux*) #(vi - # (tested with gcc 2.7.2 -- I don't have c89) - if test "$GCC" = yes; then -@@ -5115,9 +5527,19 @@ - # readonly to exploit a quirk in the memory manager. - INSTALL_LIB="-m 555" - ;; -+ interix*) -+ test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel -+ if test "$cf_cv_shlib_version" = rel; then -+ cf_shared_soname='`basename $@ .${REL_VERSION}`.${ABI_VERSION}' -+ else -+ cf_shared_soname='`basename $@`' -+ fi -+ CC_SHARED_OPTS= -+ MK_SHARED_LIB='${CC} -shared -Wl,-rpath,${RPATH_LIST} -Wl,-h,'$cf_shared_soname' -o $@' -+ ;; - irix*) #(vi - if test "$cf_cv_enable_rpath" = yes ; then -- EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${libdir} $EXTRA_LDFLAGS" -+ EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS" - fi - # tested with IRIX 5.2 and 'cc'. - if test "$GCC" != yes; then -@@ -5134,18 +5556,45 @@ - LOCAL_LDFLAGS2="$LOCAL_LDFLAGS" - fi - if test "$cf_cv_enable_rpath" = yes ; then -- EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${libdir} $EXTRA_LDFLAGS" -+ EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS" - fi - CF_SHARED_SONAME - MK_SHARED_LIB='${CC} ${CFLAGS} -shared -Wl,-soname,'$cf_cv_shared_soname',-stats,-lc -o $[@]' - ;; -- openbsd[[2-9]].*) #(vi -+ mingw*) #(vi -+ cf_cv_shlib_version=mingw -+ cf_cv_shlib_version_infix=mingw -+ shlibdir=$bindir -+ MAKE_DLLS= -+ if test "$DFT_LWR_MODEL" = "shared" ; then -+ LOCAL_LDFLAGS="-Wl,--enable-auto-import" -+ LOCAL_LDFLAGS2="$LOCAL_LDFLAGS" -+ EXTRA_LDFLAGS="-Wl,--enable-auto-import $EXTRA_LDFLAGS" -+ fi -+ CC_SHARED_OPTS= -+ MK_SHARED_LIB='sh '$rel_builddir'/mk_shared_lib.sh [$]@ [$]{CC} [$]{CFLAGS}' -+ RM_SHARED_OPTS="$RM_SHARED_OPTS $rel_builddir/mk_shared_lib.sh *.dll.a" -+ cat >mk_shared_lib.sh <<-CF_EOF -+ #!/bin/sh -+ SHARED_LIB=\[$]1 -+ IMPORT_LIB=\`echo "\[$]1" | sed -e 's/[[0-9]]*\.dll[$]/.dll.a/'\` -+ shift -+ cat <<-EOF -+ Linking shared library -+ ** SHARED_LIB \[$]SHARED_LIB -+ ** IMPORT_LIB \[$]IMPORT_LIB -+EOF -+ exec \[$]* -shared -Wl,--enable-auto-import,--out-implib=\[$]{IMPORT_LIB} -Wl,--export-all-symbols -o \[$]{SHARED_LIB} -+CF_EOF -+ chmod +x mk_shared_lib.sh -+ ;; -+ openbsd[[2-9]].*|mirbsd*) #(vi - if test "$DFT_LWR_MODEL" = "shared" ; then - LOCAL_LDFLAGS="${LD_RPATH_OPT}\$(LOCAL_LIBDIR)" - LOCAL_LDFLAGS2="$LOCAL_LDFLAGS" - fi - if test "$cf_cv_enable_rpath" = yes ; then -- EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${libdir} $EXTRA_LDFLAGS" -+ EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS" - fi - CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC" - CF_SHARED_SONAME -@@ -5156,12 +5605,12 @@ - MK_SHARED_LIB='${LD} -Bshareable -o $[@]' - test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel - ;; -- freebsd*) #(vi -+ dragonfly*|freebsd*) #(vi - CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC" - if test "$DFT_LWR_MODEL" = "shared" && test "$cf_cv_enable_rpath" = yes ; then - LOCAL_LDFLAGS="${cf_ld_rpath_opt}\$(LOCAL_LIBDIR)" -- LOCAL_LDFLAGS2="${cf_ld_rpath_opt}\${libdir} $LOCAL_LDFLAGS" -- EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${libdir} $EXTRA_LDFLAGS" -+ LOCAL_LDFLAGS2="${cf_ld_rpath_opt}\${RPATH_LIST} $LOCAL_LDFLAGS" -+ EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS" - fi - CF_SHARED_SONAME - MK_SHARED_LIB='${LD} -shared -Bshareable -soname=`basename $[@]` -o $[@]' -@@ -5171,7 +5620,7 @@ - if test "$DFT_LWR_MODEL" = "shared" && test "$cf_cv_enable_rpath" = yes ; then - LOCAL_LDFLAGS="${cf_ld_rpath_opt}\$(LOCAL_LIBDIR)" - LOCAL_LDFLAGS2="$LOCAL_LDFLAGS" -- EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${libdir} $EXTRA_LDFLAGS" -+ EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS" - if test "$cf_cv_shlib_version" = auto; then - if test -f /usr/libexec/ld.elf_so; then - cf_cv_shlib_version=abi -@@ -5182,7 +5631,7 @@ - CF_SHARED_SONAME - MK_SHARED_LIB='${CC} ${CFLAGS} -shared -Wl,-soname,'$cf_cv_shared_soname' -o $[@]' - else -- MK_SHARED_LIB='${LD} -shared -Bshareable -o $[@]' -+ MK_SHARED_LIB='${CC} -Wl,-shared -Wl,-Bshareable -o $[@]' - fi - ;; - osf*|mls+*) #(vi -@@ -5276,20 +5725,57 @@ - ;; - esac - -- if test -n "$cf_ld_rpath_opt" ; then -- MK_SHARED_LIB="$MK_SHARED_LIB $cf_ld_rpath_opt\${libdir}" -+ if test -n "$cf_try_cflags" -+ then -+cat > conftest.$ac_ext < -+int main(int argc, char *argv[[]]) -+{ -+ printf("hello\n"); -+ return (argv[[argc-1]] == 0) ; -+} -+EOF -+ cf_save_CFLAGS="$CFLAGS" -+ for cf_opt in $cf_try_cflags -+ do -+ CFLAGS="$cf_save_CFLAGS -$cf_opt" -+ AC_MSG_CHECKING(if CFLAGS option -$cf_opt works) -+ if AC_TRY_EVAL(ac_compile); then -+ AC_MSG_RESULT(yes) -+ cf_save_CFLAGS="$CFLAGS" -+ else -+ AC_MSG_RESULT(no) -+ fi -+ done -+ CFLAGS="$cf_save_CFLAGS" - fi - -+ -+ # RPATH_LIST is a colon-separated list of directories -+ test -n "$cf_ld_rpath_opt" && MK_SHARED_LIB="$MK_SHARED_LIB $cf_ld_rpath_opt\${RPATH_LIST}" -+ test -z "$RPATH_LIST" && RPATH_LIST="\${libdir}" -+ -+ test $cf_cv_rm_so_locs = yes && RM_SHARED_OPTS="$RM_SHARED_OPTS so_locations" -+ -+ CF_VERBOSE(CC_SHARED_OPTS: $CC_SHARED_OPTS) -+ CF_VERBOSE(MK_SHARED_LIB: $MK_SHARED_LIB) -+ - AC_SUBST(CC_SHARED_OPTS) - AC_SUBST(LD_RPATH_OPT) - AC_SUBST(LD_SHARED_OPTS) - AC_SUBST(MK_SHARED_LIB) -+ AC_SUBST(RM_SHARED_OPTS) -+ - AC_SUBST(LINK_PROGS) - AC_SUBST(LINK_TESTS) -+ - AC_SUBST(EXTRA_LDFLAGS) - AC_SUBST(LOCAL_LDFLAGS) - AC_SUBST(LOCAL_LDFLAGS2) -+ - AC_SUBST(INSTALL_LIB) -+ AC_SUBST(RPATH_LIST) - ])dnl - dnl --------------------------------------------------------------------------- - dnl CF_SHARED_SONAME version: 3 updated: 2008/09/08 18:34:43 -@@ -5369,7 +5855,7 @@ - fi - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_SIG_ATOMIC_T version: 2 updated: 2005/09/18 17:27:12 -+dnl CF_SIG_ATOMIC_T version: 3 updated: 2012/10/04 20:12:20 - dnl --------------- - dnl signal handler, but there are some gcc depedencies in that recommendation. - dnl Try anyway. -@@ -5401,10 +5887,10 @@ - done - ]) - AC_MSG_RESULT($cf_cv_sig_atomic_t) --test "$cf_cv_sig_atomic_t" != no && AC_DEFINE_UNQUOTED(SIG_ATOMIC_T, $cf_cv_sig_atomic_t) -+test "$cf_cv_sig_atomic_t" != no && AC_DEFINE_UNQUOTED(SIG_ATOMIC_T, $cf_cv_sig_atomic_t,[Define to signal global datatype]) - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_SIZECHANGE version: 8 updated: 2000/11/04 12:22:16 -+dnl CF_SIZECHANGE version: 9 updated: 2012/10/06 11:17:15 - dnl ------------- - dnl Check for definitions & structures needed for window size-changing - dnl FIXME: check that this works with "snake" (HP-UX 10.x) -@@ -5465,7 +5951,7 @@ - done - ]) - if test "$cf_cv_sizechange" != no ; then -- AC_DEFINE(HAVE_SIZECHANGE) -+ AC_DEFINE(HAVE_SIZECHANGE,1,[Define to 1 if sizechar declarations are provided]) - case $cf_cv_sizechange in #(vi - NEED*) - AC_DEFINE_UNQUOTED($cf_cv_sizechange ) -@@ -5474,7 +5960,7 @@ - fi - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_SRC_MODULES version: 21 updated: 2010/09/04 17:37:40 -+dnl CF_SRC_MODULES version: 27 updated: 2013/08/03 18:18:08 - dnl -------------- - dnl For each parameter, test if the source-directory exists, and if it contains - dnl a 'modules' file. If so, add to the list $cf_cv_src_modules which we'll -@@ -5497,6 +5983,7 @@ - TEST_ARG2="-l${LIB_NAME}${DFT_ARG_SUFFIX} $TEST_ARG2" - fi - -+PC_MODULES_TO_MAKE="ncurses${DFT_ARG_SUFFIX}" - cf_cv_src_modules= - for cf_dir in $1 - do -@@ -5535,6 +6022,7 @@ - TEST_ARGS="-l${cf_dir}${DFT_ARG_SUFFIX} $TEST_ARGS" - TEST_ARG2="-l${cf_dir}${DFT_ARG_SUFFIX} $TEST_ARG2" - fi -+ PC_MODULES_TO_MAKE="${PC_MODULES_TO_MAKE} ${cf_dir}${DFT_ARG_SUFFIX}" - fi - fi - done -@@ -5561,11 +6049,21 @@ - if test "x$cf_with_tests" != "xno" ; then - SRC_SUBDIRS="$SRC_SUBDIRS test" - fi --test -z "$MAKE_TERMINFO" && SRC_SUBDIRS="$SRC_SUBDIRS misc" --test "$cf_with_cxx_binding" != no && SRC_SUBDIRS="$SRC_SUBDIRS c++" -+if test "x$cf_with_db_install" = xyes; then -+ test -z "$MAKE_TERMINFO" && SRC_SUBDIRS="$SRC_SUBDIRS misc" -+fi -+if test "$cf_with_cxx_binding" != no; then -+ PC_MODULES_TO_MAKE="${PC_MODULES_TO_MAKE} ncurses++${DFT_ARG_SUFFIX}" -+ SRC_SUBDIRS="$SRC_SUBDIRS c++" -+fi -+ -+test "x$with_termlib" != xno && PC_MODULES_TO_MAKE="$PC_MODULES_TO_MAKE $TINFO_ARG_SUFFIX" -+test "x$with_ticlib" != xno && PC_MODULES_TO_MAKE="$PC_MODULES_TO_MAKE $TICS_ARG_SUFFIX" -+ -+AC_SUBST(PC_MODULES_TO_MAKE) - - ADA_SUBDIRS= --if test "$cf_cv_prog_gnat_correct" = yes && test -f $srcdir/Ada95/Makefile.in; then -+if test "x$cf_with_ada" = "xyes" && test "x$cf_cv_prog_gnat_correct" = xyes && test -f $srcdir/Ada95/Makefile.in; then - SRC_SUBDIRS="$SRC_SUBDIRS Ada95" - ADA_SUBDIRS="gen src" - if test "x$cf_with_tests" != "xno" ; then -@@ -5624,13 +6122,13 @@ - AC_DEFUN([CF_STRIP_G_OPT], - [$1=`echo ${$1} | sed -e 's%-g %%' -e 's%-g$%%'`])dnl - dnl --------------------------------------------------------------------------- --dnl CF_STRUCT_SIGACTION version: 3 updated: 2000/08/12 23:18:52 -+dnl CF_STRUCT_SIGACTION version: 5 updated: 2012/10/06 17:56:13 - dnl ------------------- - dnl Check if we need _POSIX_SOURCE defined to use struct sigaction. We'll only - dnl do this if we've found the sigaction function. --dnl --dnl If needed, define SVR4_ACTION. - AC_DEFUN([CF_STRUCT_SIGACTION],[ -+AC_REQUIRE([CF_XOPEN_SOURCE]) -+ - if test "$ac_cv_func_sigaction" = yes; then - AC_MSG_CHECKING(whether sigaction needs _POSIX_SOURCE) - AC_TRY_COMPILE([ -@@ -5645,22 +6143,24 @@ - #include ], - [struct sigaction act], - [sigact_bad=yes -- AC_DEFINE(SVR4_ACTION)], -+ AC_DEFINE(_POSIX_SOURCE,1,[Define to 1 if we must define _POSIX_SOURCE])], - [sigact_bad=unknown])]) - AC_MSG_RESULT($sigact_bad) - fi - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_STRUCT_TERMIOS version: 5 updated: 2000/11/04 12:22:46 -+dnl CF_STRUCT_TERMIOS version: 7 updated: 2012/10/06 17:56:13 - dnl ----------------- - dnl Some machines require _POSIX_SOURCE to completely define struct termios. --dnl If so, define SVR4_TERMIO - AC_DEFUN([CF_STRUCT_TERMIOS],[ -+AC_REQUIRE([CF_XOPEN_SOURCE]) -+ - AC_CHECK_HEADERS( \ - termio.h \ - termios.h \ - unistd.h \ - ) -+ - if test "$ISC" = yes ; then - AC_CHECK_HEADERS( sys/termio.h ) - fi -@@ -5680,7 +6180,7 @@ - #include ], - [struct termios foo; int x = foo.c_iflag], - termios_bad=unknown, -- termios_bad=yes AC_DEFINE(SVR4_TERMIO)) -+ termios_bad=yes AC_DEFINE(_POSIX_SOURCE,1,[Define to 1 if we must define _POSIX_SOURCE])) - ]) - AC_MSG_RESULT($termios_bad) - fi -@@ -5704,23 +6204,6 @@ - CF_ADD_SUBDIR_PATH($1,$2,$3,[$]HOME,$prefix) - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_SUBST version: 4 updated: 2006/06/17 12:33:03 --dnl -------- --dnl Shorthand macro for substituting things that the user may override --dnl with an environment variable. --dnl --dnl $1 = long/descriptive name --dnl $2 = environment variable --dnl $3 = default value --AC_DEFUN([CF_SUBST], --[AC_CACHE_VAL(cf_cv_subst_$2,[ --AC_MSG_CHECKING(for $1 (symbol $2)) --CF_SUBST_IF([-z "[$]$2"], [$2], [$3]) --cf_cv_subst_$2=[$]$2 --AC_MSG_RESULT([$]$2) --]) --])dnl --dnl --------------------------------------------------------------------------- - dnl CF_SUBST_IF version: 2 updated: 2006/06/17 12:33:03 - dnl ----------- - dnl Shorthand macro for substituting things that the user may override -@@ -5766,7 +6249,7 @@ - AC_SUBST(cf_cv_type_of_bool)dnl - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_SYS_TIME_SELECT version: 4 updated: 2000/10/04 09:18:40 -+dnl CF_SYS_TIME_SELECT version: 5 updated: 2012/10/04 05:24:07 - dnl ------------------ - dnl Check if we can include with ; this breaks on - dnl older SCO configurations. -@@ -5786,19 +6269,58 @@ - [cf_cv_sys_time_select=no]) - ]) - AC_MSG_RESULT($cf_cv_sys_time_select) --test "$cf_cv_sys_time_select" = yes && AC_DEFINE(HAVE_SYS_TIME_SELECT) -+test "$cf_cv_sys_time_select" = yes && AC_DEFINE(HAVE_SYS_TIME_SELECT,1,[Define to 1 if we can include with ]) - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_TOP_BUILDDIR version: 1 updated: 2006/10/15 16:33:23 -+dnl CF_TOP_BUILDDIR version: 2 updated: 2013/07/27 17:38:32 - dnl --------------- - dnl Define a top_builddir symbol, for applications that need an absolute path. - AC_DEFUN([CF_TOP_BUILDDIR], - [ --top_builddir=`pwd` -+top_builddir=ifelse($1,,`pwd`,$1) - AC_SUBST(top_builddir) - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_TYPEOF_CHTYPE version: 8 updated: 2006/12/16 12:33:30 -+dnl CF_TRY_XOPEN_SOURCE version: 1 updated: 2011/10/30 17:09:50 -+dnl ------------------- -+dnl If _XOPEN_SOURCE is not defined in the compile environment, check if we -+dnl can define it successfully. -+AC_DEFUN([CF_TRY_XOPEN_SOURCE],[ -+AC_CACHE_CHECK(if we should define _XOPEN_SOURCE,cf_cv_xopen_source,[ -+ AC_TRY_COMPILE([ -+#include -+#include -+#include -+],[ -+#ifndef _XOPEN_SOURCE -+make an error -+#endif], -+ [cf_cv_xopen_source=no], -+ [cf_save="$CPPFLAGS" -+ CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" -+ AC_TRY_COMPILE([ -+#include -+#include -+#include -+],[ -+#ifdef _XOPEN_SOURCE -+make an error -+#endif], -+ [cf_cv_xopen_source=no], -+ [cf_cv_xopen_source=$cf_XOPEN_SOURCE]) -+ CPPFLAGS="$cf_save" -+ ]) -+]) -+ -+if test "$cf_cv_xopen_source" != no ; then -+ CF_REMOVE_DEFINE(CFLAGS,$CFLAGS,_XOPEN_SOURCE) -+ CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,_XOPEN_SOURCE) -+ cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source" -+ CF_ADD_CFLAGS($cf_temp_xopen_source) -+fi -+]) -+dnl --------------------------------------------------------------------------- -+dnl CF_TYPEOF_CHTYPE version: 9 updated: 2012/10/06 17:56:13 - dnl ---------------- - dnl Determine the type we should use for chtype (and attr_t, which is treated - dnl as the same thing). We want around 32 bits, so on most machines want a -@@ -5847,10 +6369,10 @@ - AC_MSG_RESULT($cf_cv_typeof_chtype) - - AC_SUBST(cf_cv_typeof_chtype) --AC_DEFINE_UNQUOTED(TYPEOF_CHTYPE,$cf_cv_typeof_chtype) -+AC_DEFINE_UNQUOTED(TYPEOF_CHTYPE,$cf_cv_typeof_chtype,[Define to actual type if needed for chtype]) - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_TYPE_SIGACTION version: 3 updated: 2000/08/12 23:18:52 -+dnl CF_TYPE_SIGACTION version: 4 updated: 2012/10/06 17:56:13 - dnl ----------------- - dnl - AC_DEFUN([CF_TYPE_SIGACTION], -@@ -5863,7 +6385,7 @@ - [cf_cv_type_sigaction=yes], - [cf_cv_type_sigaction=no])]) - AC_MSG_RESULT($cf_cv_type_sigaction) --test "$cf_cv_type_sigaction" = yes && AC_DEFINE(HAVE_TYPE_SIGACTION) -+test "$cf_cv_type_sigaction" = yes && AC_DEFINE(HAVE_TYPE_SIGACTION,1,[Define to 1 if we have the sigaction_t type]) - ])dnl - dnl --------------------------------------------------------------------------- - dnl CF_UNSIGNED_LITERALS version: 2 updated: 1998/02/07 22:10:16 -@@ -5890,7 +6412,7 @@ - $1=`echo "$2" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_UTF8_LIB version: 7 updated: 2010/06/20 09:24:28 -+dnl CF_UTF8_LIB version: 8 updated: 2012/10/06 08:57:51 - dnl ----------- - dnl Check for multibyte support, and if not found, utf8 compatibility library - AC_DEFUN([CF_UTF8_LIB], -@@ -5909,14 +6431,14 @@ - # HAVE_LIBUTF8_H is used by ncurses if curses.h is shared between - # ncurses/ncursesw: - if test "$cf_cv_utf8_lib" = "add-on" ; then -- AC_DEFINE(HAVE_LIBUTF8_H) -+ AC_DEFINE(HAVE_LIBUTF8_H,1,[Define to 1 if we should include libutf8.h]) - CF_ADD_INCDIR($cf_cv_header_path_utf8) - CF_ADD_LIBDIR($cf_cv_library_path_utf8) - CF_ADD_LIBS($cf_cv_library_file_utf8) - fi - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_VA_COPY version: 2 updated: 2010/03/04 05:37:29 -+dnl CF_VA_COPY version: 3 updated: 2012/10/06 11:17:15 - dnl ---------- - dnl check for va_copy, part of stdarg.h - dnl Also, workaround for glibc's __va_copy, by checking for both. -@@ -5931,7 +6453,7 @@ - cf_cv_have_va_copy=yes, - cf_cv_have_va_copy=no)]) - --test "$cf_cv_have_va_copy" = yes && AC_DEFINE(HAVE_VA_COPY) -+test "$cf_cv_have_va_copy" = yes && AC_DEFINE(HAVE_VA_COPY,1,[Define to 1 if we have va_copy]) - - AC_CACHE_CHECK(for __va_copy, cf_cv_have___va_copy,[ - AC_TRY_LINK([ -@@ -5943,7 +6465,7 @@ - cf_cv_have___va_copy=yes, - cf_cv_have___va_copy=no)]) - --test "$cf_cv_have___va_copy" = yes && AC_DEFINE(HAVE___VA_COPY) -+test "$cf_cv_have___va_copy" = yes && AC_DEFINE(HAVE___VA_COPY,1,[Define to 1 if we have __va_copy]) - ]) - dnl --------------------------------------------------------------------------- - dnl CF_VERBOSE version: 3 updated: 2007/07/29 09:55:12 -@@ -5954,7 +6476,7 @@ - CF_MSG_LOG([$1]) - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_WCHAR_TYPE version: 3 updated: 2010/05/26 16:44:57 -+dnl CF_WCHAR_TYPE version: 4 updated: 2012/10/06 16:39:58 - dnl ------------- - dnl Check if type wide-character type $1 is declared, and if so, which header - dnl file is needed. The second parameter is used to set a shell variable when -@@ -5986,7 +6508,7 @@ - [cf_cv_$1=unknown])])]) - - if test "$cf_cv_$1" = yes ; then -- AC_DEFINE(NEED_WCHAR_H) -+ AC_DEFINE(NEED_WCHAR_H,1,[Define to 1 if we must include wchar.h]) - NEED_WCHAR_H=1 - fi - -@@ -6149,7 +6671,7 @@ - fi - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_WITH_GPM version: 7 updated: 2008/03/23 14:48:54 -+dnl CF_WITH_GPM version: 8 updated: 2012/10/06 17:56:13 - dnl ----------- - dnl - dnl The option parameter (if neither yes/no) is assumed to be the name of -@@ -6165,10 +6687,10 @@ - - if test "$with_gpm" != no ; then - AC_CHECK_HEADER(gpm.h,[ -- AC_DEFINE(HAVE_GPM_H) -+ AC_DEFINE(HAVE_GPM_H,1,[Define to 1 if we have gpm.h header]) - if test "$with_gpm" != yes && test "$with_gpm" != maybe ; then - CF_VERBOSE(assuming we really have GPM library) -- AC_DEFINE(HAVE_LIBGPM) -+ AC_DEFINE(HAVE_LIBGPM,1,[Define to 1 if we have the gpm library]) - else - AC_CHECK_LIB(gpm,Gpm_Open,[:],[ - AC_MSG_ERROR(Cannot link with GPM library) -@@ -6182,7 +6704,7 @@ - fi - ]) - dnl --------------------------------------------------------------------------- --dnl CF_WITH_LIBTOOL version: 26 updated: 2010/10/23 15:55:24 -+dnl CF_WITH_LIBTOOL version: 30 updated: 2013/09/07 13:54:05 - dnl --------------- - dnl Provide a configure option to incorporate libtool. Define several useful - dnl symbols for the makefile rules. -@@ -6252,13 +6774,20 @@ - CF_PATH_SYNTAX(with_libtool) - LIBTOOL=$with_libtool - else -- AC_PATH_PROG(LIBTOOL,libtool) -+ AC_CHECK_TOOLS(LIBTOOL,[libtool glibtool],none) -+ CF_LIBTOOL_VERSION -+ if test -z "$cf_cv_libtool_version" && test "$LIBTOOL" = libtool -+ then -+ CF_FORGET_TOOL(LIBTOOL) -+ AC_CHECK_TOOLS(LIBTOOL,[glibtool],none) -+ CF_LIBTOOL_VERSION -+ fi - fi - if test -z "$LIBTOOL" ; then - AC_MSG_ERROR(Cannot find libtool) - fi - ])dnl -- LIB_CREATE='${LIBTOOL} --mode=link ${CC} -rpath ${DESTDIR}${libdir} ${LIBTOOL_VERSION} `cut -f1 ${srcdir}/VERSION` ${LIBTOOL_OPTS} ${LT_UNDEF} -o' -+ LIB_CREATE='${LIBTOOL} --mode=link ${CC} -rpath ${DESTDIR}${libdir} ${LIBTOOL_VERSION} `cut -f1 ${srcdir}/VERSION` ${LIBTOOL_OPTS} ${LT_UNDEF} $(LIBS) -o' - LIB_OBJECT='${OBJECTS:.o=.lo}' - LIB_SUFFIX=.la - LIB_CLEAN='${LIBTOOL} --mode=clean' -@@ -6268,22 +6797,12 @@ - LIB_UNINSTALL='${LIBTOOL} --mode=uninstall' - LIB_PREP=: - -- # Show the version of libtool -- AC_MSG_CHECKING(version of libtool) -- -- # Save the version in a cache variable - this is not entirely a good -- # thing, but the version string from libtool is very ugly, and for -- # bug reports it might be useful to have the original string. "(" -- cf_cv_libtool_version=`$LIBTOOL --version 2>&1 | sed -e '/^$/d' |sed -e '2,$d' -e 's/([[^)]]*)//g' -e 's/^[[^1-9]]*//' -e 's/[[^0-9.]].*//'` -- AC_MSG_RESULT($cf_cv_libtool_version) -- if test -z "$cf_cv_libtool_version" ; then -- AC_MSG_ERROR(This is not GNU libtool) -- fi -+ CF_CHECK_LIBTOOL_VERSION - - # special hack to add -no-undefined (which libtool should do for itself) - LT_UNDEF= - case "$cf_cv_system_name" in #(vi -- cygwin*|mingw32*|uwin*|aix[[456]]) #(vi -+ cygwin*|msys*|mingw32*|uwin*|aix[[4-7]]) #(vi - LT_UNDEF=-no-undefined - ;; - esac -@@ -6323,7 +6842,33 @@ - - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_WITH_PATH version: 10 updated: 2010/10/23 15:44:18 -+dnl CF_WITH_LIB_PREFIX version: 1 updated: 2012/01/21 19:28:10 -+dnl ------------------ -+dnl Allow the library-prefix to be overridden. OS/2 EMX originally had no -+dnl "lib" prefix, e.g., because it used the dll naming convention. -+dnl -+dnl $1 = variable to set -+AC_DEFUN([CF_WITH_LIB_PREFIX], -+[ -+AC_MSG_CHECKING(if you want to have a library-prefix) -+AC_ARG_WITH(lib-prefix, -+ [ --with-lib-prefix override library-prefix], -+ [with_lib_prefix=$withval], -+ [with_lib_prefix=auto]) -+AC_MSG_RESULT($with_lib_prefix) -+ -+if test $with_lib_prefix = auto -+then -+ CF_LIB_PREFIX($1) -+elif test $with_lib_prefix = no -+then -+ LIB_PREFIX= -+else -+ LIB_PREFIX=$with_lib_prefix -+fi -+])dnl -+dnl --------------------------------------------------------------------------- -+dnl CF_WITH_PATH version: 11 updated: 2012/09/29 15:04:19 - dnl ------------ - dnl Wrapper for AC_ARG_WITH to ensure that user supplies a pathname, not just - dnl defaulting to yes/no. -@@ -6340,11 +6885,11 @@ - if ifelse([$5],,true,[test -n "$5"]) ; then - CF_PATH_SYNTAX(withval) - fi --$3="$withval" -+eval $3="$withval" - AC_SUBST($3)dnl - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_WITH_PATHLIST version: 7 updated: 2010/10/23 16:10:30 -+dnl CF_WITH_PATHLIST version: 9 updated: 2012/10/18 05:05:24 - dnl ---------------- - dnl Process an option specifying a list of colon-separated paths. - dnl -@@ -6365,7 +6910,7 @@ - for cf_src_path in $withval - do - CF_PATH_SYNTAX(cf_src_path) -- test -n "$cf_dst_path" && cf_dst_path="${cf_dst_path}:" -+ test -n "$cf_dst_path" && cf_dst_path="${cf_dst_path}$PATH_SEPARATOR" - cf_dst_path="${cf_dst_path}${cf_src_path}" - done - IFS="$ac_save_ifs" -@@ -6381,12 +6926,65 @@ - cf_dst_path=`echo "$cf_dst_path" | sed -e 's/\\\\/\\\\\\\\/g'` - ]) - --eval '$3="$cf_dst_path"' -+# This may use the prefix/exec_prefix symbols which will only yield "NONE" -+# so we have to check/work around. We do prefer the result of "eval"... -+eval cf_dst_eval="$cf_dst_path" -+case "x$cf_dst_eval" in #(vi -+xNONE*) #(vi -+ $3=$cf_dst_path -+ ;; -+*) -+ $3="$cf_dst_eval" -+ ;; -+esac - AC_SUBST($3)dnl - - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_WITH_PTHREAD version: 3 updated: 2010/05/29 16:31:02 -+dnl CF_WITH_PKG_CONFIG_LIBDIR version: 2 updated: 2011/12/10 18:58:47 -+dnl ------------------------- -+dnl Allow the choice of the pkg-config library directory to be overridden. -+AC_DEFUN([CF_WITH_PKG_CONFIG_LIBDIR],[ -+if test "$PKG_CONFIG" != none ; then -+ AC_MSG_CHECKING(for $PKG_CONFIG library directory) -+ AC_ARG_WITH(pkg-config-libdir, -+ [ --with-pkg-config-libdir=XXX use given directory for installing pc-files], -+ [PKG_CONFIG_LIBDIR=$withval], -+ [PKG_CONFIG_LIBDIR=yes]) -+ -+ case x$PKG_CONFIG_LIBDIR in #(vi -+ x/*) #(vi -+ ;; -+ xyes) #(vi -+ # look for the library directory using the same prefix as the executable -+ cf_path=`echo "$PKG_CONFIG" | sed -e 's,/[[^/]]*/[[^/]]*$,,'` -+ case x`(arch) 2>/dev/null` in #(vi -+ *64) #(vi -+ for cf_config in $cf_path/share $cf_path/lib64 $cf_path/lib32 $cf_path/lib -+ do -+ if test -d $cf_config/pkgconfig -+ then -+ PKG_CONFIG_LIBDIR=$cf_config/pkgconfig -+ break -+ fi -+ done -+ ;; -+ *) -+ PKG_CONFIG_LIBDIR=$cf_path/lib/pkgconfig -+ ;; -+ esac -+ ;; -+ *) -+ ;; -+ esac -+ -+ AC_MSG_RESULT($PKG_CONFIG_LIBDIR) -+fi -+ -+AC_SUBST(PKG_CONFIG_LIBDIR) -+])dnl -+dnl --------------------------------------------------------------------------- -+dnl CF_WITH_PTHREAD version: 6 updated: 2012/10/06 17:41:51 - dnl --------------- - dnl Check for POSIX thread library. - AC_DEFUN([CF_WITH_PTHREAD], -@@ -6400,25 +6998,30 @@ - - if test "$with_pthread" != no ; then - AC_CHECK_HEADER(pthread.h,[ -- AC_DEFINE(HAVE_PTHREADS_H) -+ AC_DEFINE(HAVE_PTHREADS_H,1,[Define to 1 if we have pthreads.h header]) - -- AC_MSG_CHECKING(if we can link with the pthread library) -- cf_save_LIBS="$LIBS" -- CF_ADD_LIB(pthread) -- AC_TRY_LINK([ -+ for cf_lib_pthread in pthread c_r -+ do -+ AC_MSG_CHECKING(if we can link with the $cf_lib_pthread library) -+ cf_save_LIBS="$LIBS" -+ CF_ADD_LIB($cf_lib_pthread) -+ AC_TRY_LINK([ - #include - ],[ -- int rc = pthread_create(0,0,0,0); -+ int rc = pthread_create(0,0,0,0); -+ int r2 = pthread_mutexattr_settype(0, 0); - ],[with_pthread=yes],[with_pthread=no]) -- LIBS="$cf_save_LIBS" -- AC_MSG_RESULT($with_pthread) -+ LIBS="$cf_save_LIBS" -+ AC_MSG_RESULT($with_pthread) -+ test "$with_pthread" = yes && break -+ done - -- if test "$with_pthread" = yes ; then -- CF_ADD_LIB(pthread) -- AC_DEFINE(HAVE_LIBPTHREADS) -- else -- AC_MSG_ERROR(Cannot link with pthread library) -- fi -+ if test "$with_pthread" = yes ; then -+ CF_ADD_LIB($cf_lib_pthread) -+ AC_DEFINE(HAVE_LIBPTHREADS,1,[Define to 1 if we have pthreads library]) -+ else -+ AC_MSG_ERROR(Cannot link with pthread library) -+ fi - ]) - fi - ]) -@@ -6448,7 +7051,7 @@ - ]) - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_WITH_SYSMOUSE version: 2 updated: 2003/03/22 19:13:43 -+dnl CF_WITH_SYSMOUSE version: 3 updated: 2012/10/06 17:56:13 - dnl ---------------- - dnl If we can compile with sysmouse, make it available unless it is not wanted. - AC_DEFUN([CF_WITH_SYSMOUSE],[ -@@ -6474,10 +7077,30 @@ - ],[cf_with_sysmouse=yes],[cf_with_sysmouse=no]) - fi - AC_MSG_RESULT($cf_with_sysmouse) --test "$cf_with_sysmouse" = yes && AC_DEFINE(USE_SYSMOUSE) -+test "$cf_with_sysmouse" = yes && AC_DEFINE(USE_SYSMOUSE,1,[Define to 1 if we can/should use the sysmouse interface]) - fi - ])dnl - dnl --------------------------------------------------------------------------- -+dnl CF_WITH_SYSTYPE version: 1 updated: 2013/01/26 16:26:12 -+dnl --------------- -+dnl For testing, override the derived host system-type which is used to decide -+dnl things such as the linker commands used to build shared libraries. This is -+dnl normally chosen automatically based on the type of system which you are -+dnl building on. We use it for testing the configure script. -+dnl -+dnl This is different from the --host option: it is used only for testing parts -+dnl of the configure script which would not be reachable with --host since that -+dnl relies on the build environment being real, rather than mocked up. -+AC_DEFUN([CF_WITH_SYSTYPE],[ -+CF_CHECK_CACHE([AC_CANONICAL_SYSTEM]) -+AC_ARG_WITH(system-type, -+ [ --with-system-type=XXX test: override derived host system-type], -+[AC_MSG_WARN(overriding system type to $withval) -+ cf_cv_system_name=$withval -+ host_os=$withval -+]) -+])dnl -+dnl --------------------------------------------------------------------------- - dnl CF_WITH_VALGRIND version: 1 updated: 2006/12/14 18:00:21 - dnl ---------------- - AC_DEFUN([CF_WITH_VALGRIND],[ -@@ -6486,7 +7109,7 @@ - [USE_VALGRIND]) - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_XOPEN_SOURCE version: 35 updated: 2011/02/20 20:37:37 -+dnl CF_XOPEN_SOURCE version: 46 updated: 2014/02/09 19:30:15 - dnl --------------- - dnl Try to get _XOPEN_SOURCE defined properly that we can use POSIX functions, - dnl or adapt to the vendor's definitions to get equivalent functionality, -@@ -6496,16 +7119,17 @@ - dnl $1 is the nominal value for _XOPEN_SOURCE - dnl $2 is the nominal value for _POSIX_C_SOURCE - AC_DEFUN([CF_XOPEN_SOURCE],[ -+AC_REQUIRE([AC_CANONICAL_HOST]) - - cf_XOPEN_SOURCE=ifelse([$1],,500,[$1]) - cf_POSIX_C_SOURCE=ifelse([$2],,199506L,[$2]) - cf_xopen_source= - - case $host_os in #(vi --aix[[456]]*) #(vi -+aix[[4-7]]*) #(vi - cf_xopen_source="-D_ALL_SOURCE" - ;; --cygwin) #(vi -+cygwin|msys) #(vi - cf_XOPEN_SOURCE=600 - ;; - darwin[[0-8]].*) #(vi -@@ -6513,6 +7137,7 @@ - ;; - darwin*) #(vi - cf_xopen_source="-D_DARWIN_C_SOURCE" -+ cf_XOPEN_SOURCE= - ;; - freebsd*|dragonfly*) #(vi - # 5.x headers associate -@@ -6530,15 +7155,23 @@ - ;; - irix[[56]].*) #(vi - cf_xopen_source="-D_SGI_SOURCE" -+ cf_XOPEN_SOURCE= - ;; - linux*|gnu*|mint*|k*bsd*-gnu) #(vi - CF_GNU_SOURCE - ;; - mirbsd*) #(vi -- # setting _XOPEN_SOURCE or _POSIX_SOURCE breaks -+ # setting _XOPEN_SOURCE or _POSIX_SOURCE breaks and other headers which use u_int / u_short types -+ cf_XOPEN_SOURCE= -+ CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE) - ;; - netbsd*) #(vi -- # setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw -+ cf_xopen_source="-D_NETBSD_SOURCE" # setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw -+ ;; -+openbsd[[4-9]]*) #(vi -+ # setting _XOPEN_SOURCE lower than 500 breaks g++ compile with wchar.h, needed for ncursesw -+ cf_xopen_source="-D_BSD_SOURCE" -+ cf_XOPEN_SOURCE=600 - ;; - openbsd*) #(vi - # setting _XOPEN_SOURCE breaks xterm on OpenBSD 2.8, is not needed for ncursesw -@@ -6552,36 +7185,12 @@ - sco*) #(vi - # setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer - ;; --solaris2.1[[0-9]]) #(vi -- cf_xopen_source="-D__EXTENSIONS__ -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" -- ;; --solaris2.[[1-9]]) #(vi -+solaris2.*) #(vi - cf_xopen_source="-D__EXTENSIONS__" -+ cf_cv_xopen_source=broken - ;; - *) -- AC_CACHE_CHECK(if we should define _XOPEN_SOURCE,cf_cv_xopen_source,[ -- AC_TRY_COMPILE([#include ],[ --#ifndef _XOPEN_SOURCE --make an error --#endif], -- [cf_cv_xopen_source=no], -- [cf_save="$CPPFLAGS" -- CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" -- AC_TRY_COMPILE([#include ],[ --#ifdef _XOPEN_SOURCE --make an error --#endif], -- [cf_cv_xopen_source=no], -- [cf_cv_xopen_source=$cf_XOPEN_SOURCE]) -- CPPFLAGS="$cf_save" -- ]) --]) -- if test "$cf_cv_xopen_source" != no ; then -- CF_REMOVE_DEFINE(CFLAGS,$CFLAGS,_XOPEN_SOURCE) -- CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,_XOPEN_SOURCE) -- cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source" -- CF_ADD_CFLAGS($cf_temp_xopen_source) -- fi -+ CF_TRY_XOPEN_SOURCE - CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE) - ;; - esac -@@ -6589,4 +7198,33 @@ - if test -n "$cf_xopen_source" ; then - CF_ADD_CFLAGS($cf_xopen_source) - fi -+ -+dnl In anything but the default case, we may have system-specific setting -+dnl which is still not guaranteed to provide all of the entrypoints that -+dnl _XOPEN_SOURCE would yield. -+if test -n "$cf_XOPEN_SOURCE" && test -z "$cf_cv_xopen_source" ; then -+ AC_MSG_CHECKING(if _XOPEN_SOURCE really is set) -+ AC_TRY_COMPILE([#include ],[ -+#ifndef _XOPEN_SOURCE -+make an error -+#endif], -+ [cf_XOPEN_SOURCE_set=yes], -+ [cf_XOPEN_SOURCE_set=no]) -+ AC_MSG_RESULT($cf_XOPEN_SOURCE_set) -+ if test $cf_XOPEN_SOURCE_set = yes -+ then -+ AC_TRY_COMPILE([#include ],[ -+#if (_XOPEN_SOURCE - 0) < $cf_XOPEN_SOURCE -+make an error -+#endif], -+ [cf_XOPEN_SOURCE_set_ok=yes], -+ [cf_XOPEN_SOURCE_set_ok=no]) -+ if test $cf_XOPEN_SOURCE_set_ok = no -+ then -+ AC_MSG_WARN(_XOPEN_SOURCE is lower than requested) -+ fi -+ else -+ CF_TRY_XOPEN_SOURCE -+ fi -+fi - ]) -diff -Naur ncurses-5.9/Ada95/aclocal.m4 ncurses-5.9.patch/Ada95/aclocal.m4 ---- ncurses-5.9/Ada95/aclocal.m4 2011-04-01 01:32:36.000000000 +0200 -+++ ncurses-5.9.patch/Ada95/aclocal.m4 2014-09-01 16:33:22.212791881 +0200 -@@ -1,5 +1,5 @@ - dnl*************************************************************************** --dnl Copyright (c) 2010,2011 Free Software Foundation, Inc. * -+dnl Copyright (c) 2010-2013,2014 Free Software Foundation, Inc. * - dnl * - dnl Permission is hereby granted, free of charge, to any person obtaining a * - dnl copy of this software and associated documentation files (the * -@@ -28,7 +28,7 @@ - dnl - dnl Author: Thomas E. Dickey - dnl --dnl $Id: aclocal.m4,v 1.24 2011/03/31 23:32:36 tom Exp $ -+dnl $Id: aclocal.m4,v 1.78 2014/02/10 00:41:59 tom Exp $ - dnl Macros used in NCURSES Ada95 auto-configuration script. - dnl - dnl These macros are maintained separately from NCURSES. The copyright on -@@ -39,7 +39,33 @@ - dnl - dnl --------------------------------------------------------------------------- - dnl --------------------------------------------------------------------------- --dnl CF_ADA_INCLUDE_DIRS version: 6 updated: 2010/02/26 19:52:07 -+dnl CF_ACVERSION_CHECK version: 4 updated: 2013/03/04 19:52:56 -+dnl ------------------ -+dnl Conditionally generate script according to whether we're using a given autoconf. -+dnl -+dnl $1 = version to compare against -+dnl $2 = code to use if AC_ACVERSION is at least as high as $1. -+dnl $3 = code to use if AC_ACVERSION is older than $1. -+define([CF_ACVERSION_CHECK], -+[ -+ifdef([AC_ACVERSION], ,[m4_copy([m4_PACKAGE_VERSION],[AC_ACVERSION])])dnl -+ifdef([m4_version_compare], -+[m4_if(m4_version_compare(m4_defn([AC_ACVERSION]), [$1]), -1, [$3], [$2])], -+[CF_ACVERSION_COMPARE( -+AC_PREREQ_CANON(AC_PREREQ_SPLIT([$1])), -+AC_PREREQ_CANON(AC_PREREQ_SPLIT(AC_ACVERSION)), AC_ACVERSION, [$2], [$3])])])dnl -+dnl --------------------------------------------------------------------------- -+dnl CF_ACVERSION_COMPARE version: 3 updated: 2012/10/03 18:39:53 -+dnl -------------------- -+dnl CF_ACVERSION_COMPARE(MAJOR1, MINOR1, TERNARY1, -+dnl MAJOR2, MINOR2, TERNARY2, -+dnl PRINTABLE2, not FOUND, FOUND) -+define([CF_ACVERSION_COMPARE], -+[ifelse(builtin([eval], [$2 < $5]), 1, -+[ifelse([$8], , ,[$8])], -+[ifelse([$9], , ,[$9])])])dnl -+dnl --------------------------------------------------------------------------- -+dnl CF_ADA_INCLUDE_DIRS version: 8 updated: 2013/10/14 04:24:07 - dnl ------------------- - dnl Construct the list of include-options for the C programs in the Ada95 - dnl binding. -@@ -53,7 +79,7 @@ - ACPPFLAGS="$ACPPFLAGS -I\${includedir}" - elif test "$includedir" != "/usr/include"; then - if test "$includedir" = '${prefix}/include' ; then -- if test $prefix != /usr ; then -+ if test x$prefix != x/usr ; then - ACPPFLAGS="$ACPPFLAGS -I\${includedir}" - fi - else -@@ -268,7 +294,7 @@ - dnl $2 = variable to update (default $LIBS) - AC_DEFUN([CF_ADD_LIBS],[ifelse($2,,LIBS,[$2])="$1 [$]ifelse($2,,LIBS,[$2])"])dnl - dnl --------------------------------------------------------------------------- --dnl CF_ADD_SUBDIR_PATH version: 3 updated: 2010/07/03 20:58:12 -+dnl CF_ADD_SUBDIR_PATH version: 4 updated: 2013/10/08 17:47:05 - dnl ------------------ - dnl Append to a search-list for a nonstandard header/lib-file - dnl $1 = the variable to return as result -@@ -278,9 +304,9 @@ - dnl $5 = a directory that we do not want $4 to match - AC_DEFUN([CF_ADD_SUBDIR_PATH], - [ --test "$4" != "$5" && \ -+test "x$4" != "x$5" && \ - test -d "$4" && \ --ifelse([$5],NONE,,[(test $5 = NONE || test "$4" != "$5") &&]) { -+ifelse([$5],NONE,,[(test -z "$5" || test x$5 = xNONE || test "x$4" != "x$5") &&]) { - test -n "$verbose" && echo " ... testing for $3-directories under $4" - test -d $4/$3 && $1="[$]$1 $4/$3" - test -d $4/$3/$2 && $1="[$]$1 $4/$3/$2" -@@ -290,75 +316,34 @@ - } - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_ANSI_CC_CHECK version: 10 updated: 2010/10/23 15:52:32 --dnl ---------------- --dnl This is adapted from the macros 'fp_PROG_CC_STDC' and 'fp_C_PROTOTYPES' --dnl in the sharutils 4.2 distribution. --AC_DEFUN([CF_ANSI_CC_CHECK], --[ --AC_CACHE_CHECK(for ${CC:-cc} option to accept ANSI C, cf_cv_ansi_cc,[ --cf_cv_ansi_cc=no --cf_save_CFLAGS="$CFLAGS" --cf_save_CPPFLAGS="$CPPFLAGS" --# Don't try gcc -ansi; that turns off useful extensions and --# breaks some systems' header files. --# AIX -qlanglvl=ansi --# Ultrix and OSF/1 -std1 --# HP-UX -Aa -D_HPUX_SOURCE --# SVR4 -Xc --# UnixWare 1.2 (cannot use -Xc, since ANSI/POSIX clashes) --for cf_arg in "-DCC_HAS_PROTOS" \ -- "" \ -- -qlanglvl=ansi \ -- -std1 \ -- -Ae \ -- "-Aa -D_HPUX_SOURCE" \ -- -Xc --do -- CF_ADD_CFLAGS($cf_arg) -- AC_TRY_COMPILE( --[ --#ifndef CC_HAS_PROTOS --#if !defined(__STDC__) || (__STDC__ != 1) --choke me --#endif --#endif --],[ -- int test (int i, double x); -- struct s1 {int (*f) (int a);}; -- struct s2 {int (*f) (double a);};], -- [cf_cv_ansi_cc="$cf_arg"; break]) --done --CFLAGS="$cf_save_CFLAGS" --CPPFLAGS="$cf_save_CPPFLAGS" --]) -- --if test "$cf_cv_ansi_cc" != "no"; then --if test ".$cf_cv_ansi_cc" != ".-DCC_HAS_PROTOS"; then -- CF_ADD_CFLAGS($cf_cv_ansi_cc) --else -- AC_DEFINE(CC_HAS_PROTOS) --fi --fi --])dnl -+dnl CF_ARG_DISABLE version: 3 updated: 1999/03/30 17:24:31 -+dnl -------------- -+dnl Allow user to disable a normally-on option. -+AC_DEFUN([CF_ARG_DISABLE], -+[CF_ARG_OPTION($1,[$2],[$3],[$4],yes)])dnl - dnl --------------------------------------------------------------------------- --dnl CF_ANSI_CC_REQD version: 4 updated: 2008/03/23 14:48:54 --dnl --------------- --dnl For programs that must use an ANSI compiler, obtain compiler options that --dnl will make it recognize prototypes. We'll do preprocessor checks in other --dnl macros, since tools such as unproto can fake prototypes, but only part of --dnl the preprocessor. --AC_DEFUN([CF_ANSI_CC_REQD], --[AC_REQUIRE([CF_ANSI_CC_CHECK]) --if test "$cf_cv_ansi_cc" = "no"; then -- AC_MSG_ERROR( --[Your compiler does not appear to recognize prototypes. --You have the following choices: -- a. adjust your compiler options -- b. get an up-to-date compiler -- c. use a wrapper such as unproto]) --fi -+dnl CF_ARG_OPTION version: 4 updated: 2010/05/26 05:38:42 -+dnl ------------- -+dnl Restricted form of AC_ARG_ENABLE that ensures user doesn't give bogus -+dnl values. -+dnl -+dnl Parameters: -+dnl $1 = option name -+dnl $2 = help-string -+dnl $3 = action to perform if option is not default -+dnl $4 = action if perform if option is default -+dnl $5 = default option value (either 'yes' or 'no') -+AC_DEFUN([CF_ARG_OPTION], -+[AC_ARG_ENABLE([$1],[$2],[test "$enableval" != ifelse([$5],no,yes,no) && enableval=ifelse([$5],no,no,yes) -+ if test "$enableval" != "$5" ; then -+ifelse([$3],,[ :]dnl -+,[ $3]) ifelse([$4],,,[ -+ else -+ $4]) -+ fi],[enableval=$5 ifelse([$4],,,[ -+ $4 - ])dnl -+ ])])dnl - dnl --------------------------------------------------------------------------- - dnl CF_AR_FLAGS version: 5 updated: 2010/05/20 20:24:29 - dnl ----------- -@@ -413,7 +398,7 @@ - AC_SUBST(ARFLAGS) - ]) - dnl --------------------------------------------------------------------------- --dnl CF_BUILD_CC version: 6 updated: 2006/10/14 15:23:15 -+dnl CF_BUILD_CC version: 7 updated: 2012/10/06 15:31:55 - dnl ----------- - dnl If we're cross-compiling, allow the user to override the tools and their - dnl options. The configure script is oriented toward identifying the host -@@ -423,7 +408,8 @@ - dnl $1 = default for $CPPFLAGS - dnl $2 = default for $LIBS - AC_DEFUN([CF_BUILD_CC],[ --AC_REQUIRE([CF_PROG_EXT]) -+CF_ACVERSION_CHECK(2.52,, -+ [AC_REQUIRE([CF_PROG_EXT])]) - if test "$cross_compiling" = yes ; then - - # defaults that we might want to override -@@ -504,7 +490,33 @@ - AC_SUBST(BUILD_OBJEXT) - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_CFG_DEFAULTS version: 7 updated: 2005/09/24 16:15:00 -+dnl CF_CC_ENV_FLAGS version: 1 updated: 2012/10/03 05:25:49 -+dnl --------------- -+dnl Check for user's environment-breakage by stuffing CFLAGS/CPPFLAGS content -+dnl into CC. This will not help with broken scripts that wrap the compiler with -+dnl options, but eliminates a more common category of user confusion. -+AC_DEFUN([CF_CC_ENV_FLAGS], -+[ -+# This should have been defined by AC_PROG_CC -+: ${CC:=cc} -+ -+AC_MSG_CHECKING(\$CC variable) -+case "$CC" in #(vi -+*[[\ \ ]]-[[IUD]]*) -+ AC_MSG_RESULT(broken) -+ AC_MSG_WARN(your environment misuses the CC variable to hold CFLAGS/CPPFLAGS options) -+ # humor him... -+ cf_flags=`echo "$CC" | sed -e 's/^[[^ ]]*[[ ]]//'` -+ CC=`echo "$CC" | sed -e 's/[[ ]].*//'` -+ CF_ADD_CFLAGS($cf_flags) -+ ;; -+*) -+ AC_MSG_RESULT(ok) -+ ;; -+esac -+])dnl -+dnl --------------------------------------------------------------------------- -+dnl CF_CFG_DEFAULTS version: 10 updated: 2013/09/07 13:54:05 - dnl --------------- - dnl Determine the default configuration into which we'll install ncurses. This - dnl can be overridden by the user's command-line options. There's two items to -@@ -522,7 +534,7 @@ - if test "x$prefix" = "xNONE" ; then - case "$cf_cv_system_name" in - # non-vendor systems don't have a conflict -- openbsd*|freebsd*|linux*|cygwin*|k*bsd*-gnu) -+ openbsd*|freebsd*|mirbsd*|linux*|cygwin*|msys*|k*bsd*-gnu|mingw*) - prefix=/usr - ;; - *) prefix=$ac_default_prefix -@@ -558,7 +570,7 @@ - fi - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_CHECK_CACHE version: 11 updated: 2008/03/23 14:45:59 -+dnl CF_CHECK_CACHE version: 12 updated: 2012/10/02 20:55:03 - dnl -------------- - dnl Check if we're accidentally using a cache from a different machine. - dnl Derive the system name, as a check for reusing the autoconf cache. -@@ -581,7 +593,7 @@ - system_name="`(hostname) 2>/dev/null`" - fi - fi --test -n "$system_name" && AC_DEFINE_UNQUOTED(SYSTEM_NAME,"$system_name") -+test -n "$system_name" && AC_DEFINE_UNQUOTED(SYSTEM_NAME,"$system_name",[Define to the system name.]) - AC_CACHE_VAL(cf_cv_system_name,[cf_cv_system_name="$system_name"]) - - test -z "$system_name" && system_name="$cf_cv_system_name" -@@ -593,7 +605,40 @@ - fi - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_CURSES_HEADER version: 2 updated: 2010/04/28 06:02:16 -+dnl CF_CLANG_COMPILER version: 2 updated: 2013/11/19 19:23:35 -+dnl ----------------- -+dnl Check if the given compiler is really clang. clang's C driver defines -+dnl __GNUC__ (fooling the configure script into setting $GCC to yes) but does -+dnl not ignore some gcc options. -+dnl -+dnl This macro should be run "soon" after AC_PROG_CC or AC_PROG_CPLUSPLUS, to -+dnl ensure that it is not mistaken for gcc/g++. It is normally invoked from -+dnl the wrappers for gcc and g++ warnings. -+dnl -+dnl $1 = GCC (default) or GXX -+dnl $2 = CLANG_COMPILER (default) -+dnl $3 = CFLAGS (default) or CXXFLAGS -+AC_DEFUN([CF_CLANG_COMPILER],[ -+ifelse([$2],,CLANG_COMPILER,[$2])=no -+ -+if test "$ifelse([$1],,[$1],GCC)" = yes ; then -+ AC_MSG_CHECKING(if this is really Clang ifelse([$1],GXX,C++,C) compiler) -+ cf_save_CFLAGS="$ifelse([$3],,CFLAGS,[$3])" -+ ifelse([$3],,CFLAGS,[$3])="$ifelse([$3],,CFLAGS,[$3]) -Qunused-arguments" -+ AC_TRY_COMPILE([],[ -+#ifdef __clang__ -+#else -+make an error -+#endif -+],[ifelse([$2],,CLANG_COMPILER,[$2])=yes -+cf_save_CFLAGS="$cf_save_CFLAGS -Qunused-arguments" -+],[]) -+ ifelse([$3],,CFLAGS,[$3])="$cf_save_CFLAGS" -+ AC_MSG_RESULT($ifelse([$2],,CLANG_COMPILER,[$2])) -+fi -+]) -+dnl --------------------------------------------------------------------------- -+dnl CF_CURSES_HEADER version: 3 updated: 2011/05/01 19:47:45 - dnl ---------------- - dnl Find a "curses" header file, e.g,. "curses.h", or one of the more common - dnl variations of ncurses' installs. -@@ -603,10 +648,10 @@ - AC_CACHE_CHECK(if we have identified curses headers,cf_cv_ncurses_header,[ - cf_cv_ncurses_header=none - for cf_header in ifelse($1,,,[ \ -- $1/curses.h \ -- $1/ncurses.h]) \ -- curses.h \ -- ncurses.h ifelse($1,,[ncurses/curses.h ncurses/ncurses.h]) -+ $1/ncurses.h \ -+ $1/curses.h]) \ -+ ncurses.h \ -+ curses.h ifelse($1,,[ncurses/ncurses.h ncurses/curses.h]) - do - AC_TRY_COMPILE([#include <${cf_header}>], - [initscr(); tgoto("?", 0,0)], -@@ -627,6 +672,67 @@ - dnl "dirname" is not portable, so we fake it with a shell script. - AC_DEFUN([CF_DIRNAME],[$1=`echo $2 | sed -e 's%/[[^/]]*$%%'`])dnl - dnl --------------------------------------------------------------------------- -+dnl CF_DISABLE_ECHO version: 12 updated: 2012/10/06 16:30:28 -+dnl --------------- -+dnl You can always use "make -n" to see the actual options, but it's hard to -+dnl pick out/analyze warning messages when the compile-line is long. -+dnl -+dnl Sets: -+dnl ECHO_LT - symbol to control if libtool is verbose -+dnl ECHO_LD - symbol to prefix "cc -o" lines -+dnl RULE_CC - symbol to put before implicit "cc -c" lines (e.g., .c.o) -+dnl SHOW_CC - symbol to put before explicit "cc -c" lines -+dnl ECHO_CC - symbol to put before any "cc" line -+dnl -+AC_DEFUN([CF_DISABLE_ECHO],[ -+AC_MSG_CHECKING(if you want to see long compiling messages) -+CF_ARG_DISABLE(echo, -+ [ --disable-echo do not display "compiling" commands], -+ [ -+ ECHO_LT='--silent' -+ ECHO_LD='@echo linking [$]@;' -+ RULE_CC='@echo compiling [$]<' -+ SHOW_CC='@echo compiling [$]@' -+ ECHO_CC='@' -+],[ -+ ECHO_LT='' -+ ECHO_LD='' -+ RULE_CC='' -+ SHOW_CC='' -+ ECHO_CC='' -+]) -+AC_MSG_RESULT($enableval) -+AC_SUBST(ECHO_LT) -+AC_SUBST(ECHO_LD) -+AC_SUBST(RULE_CC) -+AC_SUBST(SHOW_CC) -+AC_SUBST(ECHO_CC) -+])dnl -+dnl --------------------------------------------------------------------------- -+dnl CF_ENABLE_PC_FILES version: 9 updated: 2012/08/04 13:59:54 -+dnl ------------------ -+dnl This is the "--enable-pc-files" option, which is available if there is a -+dnl pkg-config configuration on the local machine. -+AC_DEFUN([CF_ENABLE_PC_FILES],[ -+AC_REQUIRE([CF_PKG_CONFIG]) -+AC_REQUIRE([CF_WITH_PKG_CONFIG_LIBDIR]) -+ -+if test "$PKG_CONFIG" != none ; then -+ AC_MSG_CHECKING(if we should install .pc files for $PKG_CONFIG) -+ AC_ARG_ENABLE(pc-files, -+ [ --enable-pc-files generate and install .pc files for pkg-config], -+ [enable_pc_files=$enableval], -+ [enable_pc_files=no]) -+ AC_MSG_RESULT($enable_pc_files) -+ if test "$enable_pc_files" != no -+ then -+ CF_PATH_SYNTAX(PKG_CONFIG_LIBDIR) -+ fi -+else -+ enable_pc_files=no -+fi -+])dnl -+dnl --------------------------------------------------------------------------- - dnl CF_FIND_LIBRARY version: 9 updated: 2008/03/23 14:48:54 - dnl --------------- - dnl Look for a non-standard library, given parameters for AC_TRY_LINK. We -@@ -807,7 +913,26 @@ - fi - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_GCC_ATTRIBUTES version: 14 updated: 2010/10/23 15:52:32 -+dnl CF_FIXUP_ADAFLAGS version: 1 updated: 2012/03/31 18:48:10 -+dnl ----------------- -+dnl make ADAFLAGS consistent with CFLAGS -+AC_DEFUN([CF_FIXUP_ADAFLAGS],[ -+ AC_MSG_CHECKING(optimization options for ADAFLAGS) -+ case "$CFLAGS" in -+ *-g*) -+ CF_ADD_ADAFLAGS(-g) -+ ;; -+ esac -+ case "$CFLAGS" in -+ *-O*) -+ cf_O_flag=`echo "$CFLAGS" |sed -e 's/^.*-O/-O/' -e 's/[[ ]].*//'` -+ CF_ADD_ADAFLAGS($cf_O_flag) -+ ;; -+ esac -+ AC_MSG_RESULT($ADAFLAGS) -+])dnl -+dnl --------------------------------------------------------------------------- -+dnl CF_GCC_ATTRIBUTES version: 16 updated: 2012/10/02 20:55:03 - dnl ----------------- - dnl Test for availability of useful gcc __attribute__ directives to quiet - dnl compiler warnings. Though useful, not all are supported -- and contrary -@@ -885,27 +1010,27 @@ - test -n "$verbose" && AC_MSG_RESULT(... $cf_attribute) - cat conftest.h >>confdefs.h - case $cf_attribute in #(vi -+ noreturn) #(vi -+ AC_DEFINE_UNQUOTED(GCC_NORETURN,$cf_directive,[Define to noreturn-attribute for gcc]) -+ ;; - printf) #(vi -- if test "$cf_printf_attribute" = no ; then -- cat >>confdefs.h <>confdefs.h <>confdefs.h <>confdefs.h < conftest.$ac_ext <conftest.$ac_ext </dev/null | sed -e 's,^.*/,,' -e 's, .*$,,' | fgrep lib$3.` -- test -z "$cf_cv_$3_soname" && cf_cv_$3_soname=unknown -- fi -- fi --rm -rf conftest* --LIBS="$cf_save_LIBS" --fi --]) --]) --dnl --------------------------------------------------------------------------- --dnl CF_LIB_SUFFIX version: 16 updated: 2008/12/27 12:30:03 -+dnl CF_LIB_SUFFIX version: 22 updated: 2013/09/07 13:54:05 - dnl ------------- - dnl Compute the library file-suffix from the given model name - dnl $1 = model name -@@ -1664,31 +1765,26 @@ - dnl The variable $LIB_SUFFIX, if set, prepends the variable to set. - AC_DEFUN([CF_LIB_SUFFIX], - [ -- AC_REQUIRE([CF_SUBST_NCURSES_VERSION]) -- case $1 in #(vi -- libtool) #(vi -+ case X$1 in #(vi -+ Xlibtool) #(vi - $2='.la' - $3=[$]$2 - ;; -- normal) #(vi -- $2='.a' -- $3=[$]$2 -- ;; -- debug) #(vi -+ Xdebug) #(vi - $2='_g.a' - $3=[$]$2 - ;; -- profile) #(vi -+ Xprofile) #(vi - $2='_p.a' - $3=[$]$2 - ;; -- shared) #(vi -+ Xshared) #(vi - case $cf_cv_system_name in -- aix[[56]]*) #(vi -+ aix[[5-7]]*) #(vi - $2='.a' - $3=[$]$2 - ;; -- cygwin*) #(vi -+ cygwin*|msys*|mingw*) #(vi - $2='.dll' - $3='.dll.a' - ;; -@@ -1708,10 +1804,16 @@ - ;; - esac - ;; -- *) $2='.so' -+ *) #(vi -+ $2='.so' - $3=[$]$2 - ;; - esac -+ ;; -+ *) -+ $2='.a' -+ $3=[$]$2 -+ ;; - esac - test -n "$LIB_SUFFIX" && $2="${LIB_SUFFIX}[$]{$2}" - test -n "$LIB_SUFFIX" && $3="${LIB_SUFFIX}[$]{$3}" -@@ -1735,7 +1837,7 @@ - test -n "$LIB_SUFFIX" && $2="${LIB_SUFFIX}[$]{$2}" - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_LINK_DATAONLY version: 9 updated: 2009/01/01 20:21:38 -+dnl CF_LINK_DATAONLY version: 10 updated: 2012/10/06 17:41:51 - dnl ---------------- - dnl Some systems have a non-ANSI linker that doesn't pull in modules that have - dnl only data (i.e., no functions), for example NeXT. On those systems we'll -@@ -1792,81 +1894,12 @@ - AC_MSG_RESULT($cf_cv_link_dataonly) - - if test "$cf_cv_link_dataonly" = no ; then -- AC_DEFINE(BROKEN_LINKER) -+ AC_DEFINE(BROKEN_LINKER,1,[if data-only library module does not link]) - BROKEN_LINKER=1 - fi - - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_LINK_FUNCS version: 7 updated: 2006/12/16 12:33:30 --dnl ------------- --dnl Most Unix systems have both link and symlink, a few don't have symlink. --dnl A few non-Unix systems implement symlink, but not link. --dnl A few non-systems implement neither (or have nonfunctional versions). --AC_DEFUN([CF_LINK_FUNCS], --[ --AC_CHECK_FUNCS( \ -- remove \ -- unlink ) -- --if test "$cross_compiling" = yes ; then -- AC_CHECK_FUNCS( \ -- link \ -- symlink ) --else -- AC_CACHE_CHECK(if link/symlink functions work,cf_cv_link_funcs,[ -- cf_cv_link_funcs= -- for cf_func in link symlink ; do -- AC_TRY_RUN([ --#include --#include --#ifdef HAVE_UNISTD_H --#include --#endif --int main() --{ -- int fail = 0; -- char *src = "config.log"; -- char *dst = "conftest.chk"; -- struct stat src_sb; -- struct stat dst_sb; -- -- stat(src, &src_sb); -- fail = ($cf_func("config.log", "conftest.chk") < 0) -- || (stat(dst, &dst_sb) < 0) -- || (dst_sb.st_mtime != src_sb.st_mtime); --#ifdef HAVE_UNLINK -- unlink(dst); --#else -- remove(dst); --#endif -- ${cf_cv_main_return:-return} (fail); --} -- ],[ -- cf_cv_link_funcs="$cf_cv_link_funcs $cf_func" -- eval 'ac_cv_func_'$cf_func'=yes'],[ -- eval 'ac_cv_func_'$cf_func'=no'],[ -- eval 'ac_cv_func_'$cf_func'=error']) -- done -- test -z "$cf_cv_link_funcs" && cf_cv_link_funcs=no -- ]) -- test "$ac_cv_func_link" = yes && AC_DEFINE(HAVE_LINK) -- test "$ac_cv_func_symlink" = yes && AC_DEFINE(HAVE_SYMLINK) --fi --])dnl --dnl --------------------------------------------------------------------------- --dnl CF_MAIN_RETURN version: 1 updated: 2006/12/10 09:51:54 --dnl -------------- --dnl Check if a return from main to the shell actually returns the same exit --dnl code. This is true for almost any POSIX environment. --dnl --dnl Some very old environments did not flush stdout, etc., on an exit. That --dnl would be a useful case to test for also. --AC_DEFUN([CF_MAIN_RETURN], --[ --cf_cv_main_return=return --])dnl --dnl --------------------------------------------------------------------------- - dnl CF_MAKEFLAGS version: 14 updated: 2011/03/31 19:29:46 - dnl ------------ - dnl Some 'make' programs support ${MAKEFLAGS}, some ${MFLAGS}, to pass 'make' -@@ -1944,7 +1977,7 @@ - AC_SUBST(MAKE_LOWER_TAGS) - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_MIXEDCASE_FILENAMES version: 3 updated: 2003/09/20 17:07:55 -+dnl CF_MIXEDCASE_FILENAMES version: 6 updated: 2013/10/08 17:47:05 - dnl ---------------------- - dnl Check if the file-system supports mixed-case filenames. If we're able to - dnl create a lowercase name and see it as uppercase, it doesn't support that. -@@ -1953,7 +1986,7 @@ - AC_CACHE_CHECK(if filesystem supports mixed-case filenames,cf_cv_mixedcase,[ - if test "$cross_compiling" = yes ; then - case $target_alias in #(vi -- *-os2-emx*|*-msdosdjgpp*|*-cygwin*|*-mingw32*|*-uwin*) #(vi -+ *-os2-emx*|*-msdosdjgpp*|*-cygwin*|*-msys*|*-mingw*|*-uwin*) #(vi - cf_cv_mixedcase=no - ;; - *) -@@ -1971,10 +2004,10 @@ - rm -f conftest CONFTEST - fi - ]) --test "$cf_cv_mixedcase" = yes && AC_DEFINE(MIXEDCASE_FILENAMES) -+test "$cf_cv_mixedcase" = yes && AC_DEFINE(MIXEDCASE_FILENAMES,1,[Define to 1 if filesystem supports mixed-case filenames.]) - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_MKSTEMP version: 7 updated: 2010/08/14 18:25:37 -+dnl CF_MKSTEMP version: 9 updated: 2012/10/03 04:34:49 - dnl ---------- - dnl Check for a working mkstemp. This creates two files, checks that they are - dnl successfully created and distinct (AmigaOS apparently fails on the last). -@@ -2016,11 +2049,13 @@ - } - ],[cf_cv_func_mkstemp=yes - ],[cf_cv_func_mkstemp=no --],[AC_CHECK_FUNC(mkstemp) --]) -+],[cf_cv_func_mkstemp=maybe]) - ]) -+if test "x$cf_cv_func_mkstemp" = xmaybe ; then -+ AC_CHECK_FUNC(mkstemp) -+fi - if test "x$cf_cv_func_mkstemp" = xyes || test "x$ac_cv_func_mkstemp" = xyes ; then -- AC_DEFINE(HAVE_MKSTEMP) -+ AC_DEFINE(HAVE_MKSTEMP,1,[Define to 1 if mkstemp() is available and working.]) - fi - ])dnl - dnl --------------------------------------------------------------------------- -@@ -2141,7 +2176,7 @@ - ,[$1=no]) - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_NCURSES_CONFIG version: 8 updated: 2010/07/08 05:17:30 -+dnl CF_NCURSES_CONFIG version: 10 updated: 2012/10/06 08:57:51 - dnl ----------------- - dnl Tie together the configure-script macros for ncurses. - dnl Prefer the "-config" script from ncurses 6.x, to simplify analysis. -@@ -2153,7 +2188,10 @@ - cf_ncuconfig_root=ifelse($1,,ncurses,$1) - - echo "Looking for ${cf_ncuconfig_root}-config" --AC_PATH_PROGS(NCURSES_CONFIG,${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config,none) -+ -+CF_ACVERSION_CHECK(2.52, -+ [AC_CHECK_TOOLS(NCURSES_CONFIG, ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config, none)], -+ [AC_PATH_PROGS(NCURSES_CONFIG, ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config, none)]) - - if test "$NCURSES_CONFIG" != none ; then - -@@ -2164,7 +2202,7 @@ - CF_CURSES_HEADER(ifelse($1,,ncurses,$1)) - - dnl like CF_NCURSES_CPPFLAGS --AC_DEFINE(NCURSES) -+AC_DEFINE(NCURSES,1,[Define to 1 if we are using ncurses headers/libraries]) - - dnl like CF_NCURSES_LIBS - CF_UPPER(cf_nculib_ROOT,HAVE_LIB$cf_ncuconfig_root) -@@ -2181,7 +2219,7 @@ - fi - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_NCURSES_CPPFLAGS version: 20 updated: 2010/11/20 17:02:38 -+dnl CF_NCURSES_CPPFLAGS version: 21 updated: 2012/10/06 08:57:51 - dnl ------------------- - dnl Look for the SVr4 curses clone 'ncurses' in the standard places, adjusting - dnl the CPPFLAGS variable so we can include its header. -@@ -2227,12 +2265,12 @@ - CF_TERM_HEADER - - # some applications need this, but should check for NCURSES_VERSION --AC_DEFINE(NCURSES) -+AC_DEFINE(NCURSES,1,[Define to 1 if we are using ncurses headers/libraries]) - - CF_NCURSES_VERSION - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_NCURSES_HEADER version: 2 updated: 2008/03/23 14:48:54 -+dnl CF_NCURSES_HEADER version: 3 updated: 2012/10/06 08:57:51 - dnl ----------------- - dnl Find a "curses" header file, e.g,. "curses.h", or one of the more common - dnl variations of ncurses' installs. -@@ -2283,16 +2321,16 @@ - - case $cf_cv_ncurses_header in # (vi - *ncurses.h) -- AC_DEFINE(HAVE_NCURSES_H) -+ AC_DEFINE(HAVE_NCURSES_H,1,[Define to 1 if we have ncurses.h]) - ;; - esac - - case $cf_cv_ncurses_header in # (vi - ncurses/curses.h|ncurses/ncurses.h) -- AC_DEFINE(HAVE_NCURSES_NCURSES_H) -+ AC_DEFINE(HAVE_NCURSES_NCURSES_H,1,[Define to 1 if we have ncurses/ncurses.h]) - ;; - ncursesw/curses.h|ncursesw/ncurses.h) -- AC_DEFINE(HAVE_NCURSESW_NCURSES_H) -+ AC_DEFINE(HAVE_NCURSESW_NCURSES_H,1,[Define to 1 if we have ncursesw/ncurses.h]) - ;; - esac - -@@ -2366,7 +2404,7 @@ - AC_DEFINE_UNQUOTED($cf_nculib_ROOT) - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_NCURSES_VERSION version: 13 updated: 2010/10/23 15:54:49 -+dnl CF_NCURSES_VERSION version: 14 updated: 2012/10/06 08:57:51 - dnl ------------------ - dnl Check for the version of ncurses, to aid in reporting bugs, etc. - dnl Call CF_CURSES_CPPFLAGS first, or CF_NCURSES_CPPFLAGS. We don't use -@@ -2425,58 +2463,10 @@ - ]) - rm -f $cf_tempfile - ]) --test "$cf_cv_ncurses_version" = no || AC_DEFINE(NCURSES) --])dnl --dnl --------------------------------------------------------------------------- --dnl CF_NO_LEAKS_OPTION version: 4 updated: 2006/12/16 14:24:05 --dnl ------------------ --dnl see CF_WITH_NO_LEAKS --AC_DEFUN([CF_NO_LEAKS_OPTION],[ --AC_MSG_CHECKING(if you want to use $1 for testing) --AC_ARG_WITH($1, -- [$2], -- [AC_DEFINE($3)ifelse([$4],,[ -- $4 --]) -- : ${with_cflags:=-g} -- : ${with_no_leaks:=yes} -- with_$1=yes], -- [with_$1=]) --AC_MSG_RESULT(${with_$1:-no}) -- --case .$with_cflags in #(vi --.*-g*) -- case .$CFLAGS in #(vi -- .*-g*) #(vi -- ;; -- *) -- CF_ADD_CFLAGS([-g]) -- ;; -- esac -- ;; --esac --])dnl --dnl --------------------------------------------------------------------------- --dnl CF_NUMBER_SYNTAX version: 1 updated: 2003/09/20 18:12:49 --dnl ---------------- --dnl Check if the given variable is a number. If not, report an error. --dnl $1 is the variable --dnl $2 is the message --AC_DEFUN([CF_NUMBER_SYNTAX],[ --if test -n "$1" ; then -- case $1 in #(vi -- [[0-9]]*) #(vi -- ;; -- *) -- AC_MSG_ERROR($2 is not a number: $1) -- ;; -- esac --else -- AC_MSG_ERROR($2 value is empty) --fi -+test "$cf_cv_ncurses_version" = no || AC_DEFINE(NCURSES,1,[Define to 1 if we are using ncurses headers/libraries]) - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_OBJ_SUBDIR version: 4 updated: 2002/02/23 20:38:31 -+dnl CF_OBJ_SUBDIR version: 6 updated: 2013/09/07 14:06:10 - dnl ------------- - dnl Compute the object-directory name from the given model name - AC_DEFUN([CF_OBJ_SUBDIR], -@@ -2488,7 +2478,7 @@ - profile) $2='obj_p' ;; - shared) - case $cf_cv_system_name in #(vi -- cygwin) #(vi -+ cygwin|msys) #(vi - $2='objects' ;; - *) - $2='obj_s' ;; -@@ -2496,20 +2486,23 @@ - esac - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_PATHSEP version: 5 updated: 2010/05/26 05:38:42 -+dnl CF_PATHSEP version: 6 updated: 2012/09/29 18:38:12 - dnl ---------- --dnl Provide a value for the $PATH and similar separator -+dnl Provide a value for the $PATH and similar separator (or amend the value -+dnl as provided in autoconf 2.5x). - AC_DEFUN([CF_PATHSEP], - [ -+ AC_MSG_CHECKING(for PATH separator) - case $cf_cv_system_name in - os2*) PATH_SEPARATOR=';' ;; -- *) PATH_SEPARATOR=':' ;; -+ *) ${PATH_SEPARATOR:=':'} ;; - esac - ifelse([$1],,,[$1=$PATH_SEPARATOR]) - AC_SUBST(PATH_SEPARATOR) -+ AC_MSG_RESULT($PATH_SEPARATOR) - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_PATH_SYNTAX version: 13 updated: 2010/05/26 05:38:42 -+dnl CF_PATH_SYNTAX version: 14 updated: 2012/06/19 20:58:54 - dnl -------------- - dnl Check the argument to see that it looks like a pathname. Rewrite it if it - dnl begins with one of the prefix/exec_prefix variables, and then again if the -@@ -2529,7 +2522,7 @@ - ;; - .[[a-zA-Z]]:[[\\/]]*) #(vi OS/2 EMX - ;; --.\[$]{*prefix}*) #(vi -+.\[$]{*prefix}*|.\[$]{*dir}*) #(vi - eval $1="[$]$1" - case ".[$]$1" in #(vi - .NONE/*) -@@ -2546,7 +2539,7 @@ - esac - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_PKG_CONFIG version: 4 updated: 2011/02/18 20:26:24 -+dnl CF_PKG_CONFIG version: 7 updated: 2011/04/29 04:53:22 - dnl ------------- - dnl Check for the package-config program, unless disabled by command-line. - AC_DEFUN([CF_PKG_CONFIG], -@@ -2563,7 +2556,9 @@ - PKG_CONFIG=none - ;; - yes) #(vi -- AC_PATH_TOOL(PKG_CONFIG, pkg-config, none) -+ CF_ACVERSION_CHECK(2.52, -+ [AC_PATH_TOOL(PKG_CONFIG, pkg-config, none)], -+ [AC_PATH_PROG(PKG_CONFIG, pkg-config, none)]) - ;; - *) - PKG_CONFIG=$withval -@@ -2667,6 +2662,19 @@ - test -z "$AWK" && AC_MSG_ERROR(No awk program found) - ])dnl - dnl --------------------------------------------------------------------------- -+dnl CF_PROG_CC version: 3 updated: 2012/10/06 15:31:55 -+dnl ---------- -+dnl standard check for CC, plus followup sanity checks -+dnl $1 = optional parameter to pass to AC_PROG_CC to specify compiler name -+AC_DEFUN([CF_PROG_CC],[ -+ifelse($1,,[AC_PROG_CC],[AC_PROG_CC($1)]) -+CF_GCC_VERSION -+CF_ACVERSION_CHECK(2.52, -+ [AC_PROG_CC_STDC], -+ [CF_ANSI_CC_REQD]) -+CF_CC_ENV_FLAGS -+])dnl -+dnl --------------------------------------------------------------------------- - dnl CF_PROG_CC_C_O version: 3 updated: 2010/08/14 18:25:37 - dnl -------------- - dnl Analogous to AC_PROG_CC_C_O, but more useful: tests only $CC, ensures that -@@ -2721,7 +2729,7 @@ - test -z "$EGREP" && AC_MSG_ERROR(No egrep program found) - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_PROG_EXT version: 10 updated: 2004/01/03 19:28:18 -+dnl CF_PROG_EXT version: 11 updated: 2012/10/06 08:57:51 - dnl ----------- - dnl Compute $PROG_EXT, used for non-Unix ports, such as OS/2 EMX. - AC_DEFUN([CF_PROG_EXT], -@@ -2743,10 +2751,10 @@ - - PROG_EXT="$EXEEXT" - AC_SUBST(PROG_EXT) --test -n "$PROG_EXT" && AC_DEFINE_UNQUOTED(PROG_EXT,"$PROG_EXT") -+test -n "$PROG_EXT" && AC_DEFINE_UNQUOTED(PROG_EXT,"$PROG_EXT",[Define to the program extension (normally blank)]) - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_PROG_GNAT version: 1 updated: 2010/06/19 15:22:18 -+dnl CF_PROG_GNAT version: 2 updated: 2011/10/22 14:01:47 - dnl ------------ - dnl Check for gnatmake, ensure that it is complete. - AC_DEFUN([CF_PROG_GNAT],[ -@@ -2754,6 +2762,7 @@ - AC_CHECK_PROG(gnat_exists, $cf_ada_make, yes, no) - if test "$ac_cv_prog_gnat_exists" = no; then - cf_ada_make= -+ cf_cv_prog_gnat_correct=no - else - CF_GNAT_VERSION - AC_CHECK_PROG(M4_exists, m4, yes, no) -@@ -2831,18 +2840,19 @@ - $1=`echo "$2" | sed -e 's/-l$3[[ ]]//g' -e 's/-l$3[$]//'` - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_SHARED_OPTS version: 64 updated: 2010/06/05 16:51:16 -+dnl CF_SHARED_OPTS version: 84 updated: 2013/11/03 06:26:10 - dnl -------------- - dnl -------------- - dnl Attempt to determine the appropriate CC/LD options for creating a shared - dnl library. - dnl --dnl Note: ${LOCAL_LDFLAGS} is used to link executables that will run within the --dnl build-tree, i.e., by making use of the libraries that are compiled in ../lib --dnl We avoid compiling-in a ../lib path for the shared library since that can --dnl lead to unexpected results at runtime. --dnl ${LOCAL_LDFLAGS2} has the same intention but assumes that the shared libraries --dnl are compiled in ../../lib -+dnl Notes: -+dnl a) ${LOCAL_LDFLAGS} is used to link executables that will run within -+dnl the build-tree, i.e., by making use of the libraries that are compiled in -+dnl $rel_builddir/lib We avoid compiling-in a $rel_builddir/lib path for the -+dnl shared library since that can lead to unexpected results at runtime. -+dnl b) ${LOCAL_LDFLAGS2} has the same intention but assumes that the shared -+dnl libraries are compiled in ../../lib - dnl - dnl The variable 'cf_cv_do_symlinks' is used to control whether we configure - dnl to install symbolic links to the rel/abi versions of shared libraries. -@@ -2857,12 +2867,19 @@ - dnl Some loaders leave 'so_locations' lying around. It's nice to clean up. - AC_DEFUN([CF_SHARED_OPTS], - [ -- AC_REQUIRE([CF_SUBST_NCURSES_VERSION]) - AC_REQUIRE([CF_LD_RPATH_OPT]) -+ RM_SHARED_OPTS= - LOCAL_LDFLAGS= - LOCAL_LDFLAGS2= - LD_SHARED_OPTS= - INSTALL_LIB="-m 644" -+ : ${rel_builddir:=.} -+ -+ shlibdir=$libdir -+ AC_SUBST(shlibdir) -+ -+ MAKE_DLLS="#" -+ AC_SUBST(MAKE_DLLS) - - cf_cv_do_symlinks=no - cf_ld_rpath_opt= -@@ -2887,6 +2904,7 @@ - AC_MSG_RESULT($cf_cv_shlib_version) - - cf_cv_rm_so_locs=no -+ cf_try_cflags= - - # Some less-capable ports of gcc support only -fpic - CC_SHARED_OPTS= -@@ -2906,10 +2924,14 @@ - cf_cv_shlib_version_infix=no - - case $cf_cv_system_name in #(vi -- aix[[56]]*) #(vi -+ aix4.[3-9]*|aix[[5-7]]*) #(vi - if test "$GCC" = yes; then - CC_SHARED_OPTS= -- MK_SHARED_LIB='$(CC) -shared' -+ MK_SHARED_LIB='${CC} -shared -Wl,-brtl -Wl,-blibpath:${RPATH_LIST}:/usr/lib -o [$]@' -+ else -+ # CC_SHARED_OPTS='-qpic=large -G' -+ # perhaps "-bM:SRE -bnoentry -bexpall" -+ MK_SHARED_LIB='${CC} -G -Wl,-brtl -Wl,-blibpath:${RPATH_LIST}:/usr/lib -o [$]@' - fi - ;; - beos*) #(vi -@@ -2917,9 +2939,12 @@ - ;; - cygwin*) #(vi - CC_SHARED_OPTS= -- MK_SHARED_LIB='sh ../mk_shared_lib.sh [$]@ [$]{CC} [$]{CFLAGS}' -+ MK_SHARED_LIB='sh '$rel_builddir'/mk_shared_lib.sh [$]@ [$]{CC} [$]{CFLAGS}' -+ RM_SHARED_OPTS="$RM_SHARED_OPTS $rel_builddir/mk_shared_lib.sh *.dll.a" - cf_cv_shlib_version=cygdll - cf_cv_shlib_version_infix=cygdll -+ shlibdir=$bindir -+ MAKE_DLLS= - cat >mk_shared_lib.sh <<-CF_EOF - #!/bin/sh - SHARED_LIB=\[$]1 -@@ -2930,12 +2955,34 @@ - ** SHARED_LIB \[$]SHARED_LIB - ** IMPORT_LIB \[$]IMPORT_LIB - EOF -- exec \[$]* -shared -Wl,--out-implib=../lib/\[$]{IMPORT_LIB} -Wl,--export-all-symbols -o ../lib/\[$]{SHARED_LIB} -+ exec \[$]* -shared -Wl,--out-implib=\[$]{IMPORT_LIB} -Wl,--export-all-symbols -o \[$]{SHARED_LIB} -+CF_EOF -+ chmod +x mk_shared_lib.sh -+ ;; -+ msys*) #(vi -+ CC_SHARED_OPTS= -+ MK_SHARED_LIB='sh '$rel_builddir'/mk_shared_lib.sh [$]@ [$]{CC} [$]{CFLAGS}' -+ RM_SHARED_OPTS="$RM_SHARED_OPTS $rel_builddir/mk_shared_lib.sh *.dll.a" -+ cf_cv_shlib_version=msysdll -+ cf_cv_shlib_version_infix=msysdll -+ shlibdir=$bindir -+ MAKE_DLLS= -+ cat >mk_shared_lib.sh <<-CF_EOF -+ #!/bin/sh -+ SHARED_LIB=\[$]1 -+ IMPORT_LIB=\`echo "\[$]1" | sed -e 's/msys-/lib/' -e 's/[[0-9]]*\.dll[$]/.dll.a/'\` -+ shift -+ cat <<-EOF -+ Linking shared library -+ ** SHARED_LIB \[$]SHARED_LIB -+ ** IMPORT_LIB \[$]IMPORT_LIB -+EOF -+ exec \[$]* -shared -Wl,--out-implib=\[$]{IMPORT_LIB} -Wl,--export-all-symbols -o \[$]{SHARED_LIB} - CF_EOF - chmod +x mk_shared_lib.sh - ;; - darwin*) #(vi -- EXTRA_CFLAGS="-no-cpp-precomp" -+ cf_try_cflags="no-cpp-precomp" - CC_SHARED_OPTS="-dynamic" - MK_SHARED_LIB='${CC} ${CFLAGS} -dynamiclib -install_name ${libdir}/`basename $[@]` -compatibility_version ${ABI_VERSION} -current_version ${ABI_VERSION} -o $[@]' - test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=abi -@@ -2949,6 +2996,14 @@ - LDFLAGS="$LDFLAGS -Wl,-search_paths_first" - fi - ;; -+ hpux[[7-8]]*) #(vi -+ # HP-UX 8.07 ld lacks "+b" option used for libdir search-list -+ if test "$GCC" != yes; then -+ CC_SHARED_OPTS='+Z' -+ fi -+ MK_SHARED_LIB='${LD} -b -o $[@]' -+ INSTALL_LIB="-m 555" -+ ;; - hpux*) #(vi - # (tested with gcc 2.7.2 -- I don't have c89) - if test "$GCC" = yes; then -@@ -2962,9 +3017,19 @@ - # readonly to exploit a quirk in the memory manager. - INSTALL_LIB="-m 555" - ;; -+ interix*) -+ test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel -+ if test "$cf_cv_shlib_version" = rel; then -+ cf_shared_soname='`basename $@ .${REL_VERSION}`.${ABI_VERSION}' -+ else -+ cf_shared_soname='`basename $@`' -+ fi -+ CC_SHARED_OPTS= -+ MK_SHARED_LIB='${CC} -shared -Wl,-rpath,${RPATH_LIST} -Wl,-h,'$cf_shared_soname' -o $@' -+ ;; - irix*) #(vi - if test "$cf_cv_enable_rpath" = yes ; then -- EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${libdir} $EXTRA_LDFLAGS" -+ EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS" - fi - # tested with IRIX 5.2 and 'cc'. - if test "$GCC" != yes; then -@@ -2981,18 +3046,45 @@ - LOCAL_LDFLAGS2="$LOCAL_LDFLAGS" - fi - if test "$cf_cv_enable_rpath" = yes ; then -- EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${libdir} $EXTRA_LDFLAGS" -+ EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS" - fi - CF_SHARED_SONAME - MK_SHARED_LIB='${CC} ${CFLAGS} -shared -Wl,-soname,'$cf_cv_shared_soname',-stats,-lc -o $[@]' - ;; -- openbsd[[2-9]].*) #(vi -+ mingw*) #(vi -+ cf_cv_shlib_version=mingw -+ cf_cv_shlib_version_infix=mingw -+ shlibdir=$bindir -+ MAKE_DLLS= -+ if test "$DFT_LWR_MODEL" = "shared" ; then -+ LOCAL_LDFLAGS="-Wl,--enable-auto-import" -+ LOCAL_LDFLAGS2="$LOCAL_LDFLAGS" -+ EXTRA_LDFLAGS="-Wl,--enable-auto-import $EXTRA_LDFLAGS" -+ fi -+ CC_SHARED_OPTS= -+ MK_SHARED_LIB='sh '$rel_builddir'/mk_shared_lib.sh [$]@ [$]{CC} [$]{CFLAGS}' -+ RM_SHARED_OPTS="$RM_SHARED_OPTS $rel_builddir/mk_shared_lib.sh *.dll.a" -+ cat >mk_shared_lib.sh <<-CF_EOF -+ #!/bin/sh -+ SHARED_LIB=\[$]1 -+ IMPORT_LIB=\`echo "\[$]1" | sed -e 's/[[0-9]]*\.dll[$]/.dll.a/'\` -+ shift -+ cat <<-EOF -+ Linking shared library -+ ** SHARED_LIB \[$]SHARED_LIB -+ ** IMPORT_LIB \[$]IMPORT_LIB -+EOF -+ exec \[$]* -shared -Wl,--enable-auto-import,--out-implib=\[$]{IMPORT_LIB} -Wl,--export-all-symbols -o \[$]{SHARED_LIB} -+CF_EOF -+ chmod +x mk_shared_lib.sh -+ ;; -+ openbsd[[2-9]].*|mirbsd*) #(vi - if test "$DFT_LWR_MODEL" = "shared" ; then - LOCAL_LDFLAGS="${LD_RPATH_OPT}\$(LOCAL_LIBDIR)" - LOCAL_LDFLAGS2="$LOCAL_LDFLAGS" - fi - if test "$cf_cv_enable_rpath" = yes ; then -- EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${libdir} $EXTRA_LDFLAGS" -+ EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS" - fi - CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC" - CF_SHARED_SONAME -@@ -3003,12 +3095,12 @@ - MK_SHARED_LIB='${LD} -Bshareable -o $[@]' - test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel - ;; -- freebsd*) #(vi -+ dragonfly*|freebsd*) #(vi - CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC" - if test "$DFT_LWR_MODEL" = "shared" && test "$cf_cv_enable_rpath" = yes ; then - LOCAL_LDFLAGS="${cf_ld_rpath_opt}\$(LOCAL_LIBDIR)" -- LOCAL_LDFLAGS2="${cf_ld_rpath_opt}\${libdir} $LOCAL_LDFLAGS" -- EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${libdir} $EXTRA_LDFLAGS" -+ LOCAL_LDFLAGS2="${cf_ld_rpath_opt}\${RPATH_LIST} $LOCAL_LDFLAGS" -+ EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS" - fi - CF_SHARED_SONAME - MK_SHARED_LIB='${LD} -shared -Bshareable -soname=`basename $[@]` -o $[@]' -@@ -3018,7 +3110,7 @@ - if test "$DFT_LWR_MODEL" = "shared" && test "$cf_cv_enable_rpath" = yes ; then - LOCAL_LDFLAGS="${cf_ld_rpath_opt}\$(LOCAL_LIBDIR)" - LOCAL_LDFLAGS2="$LOCAL_LDFLAGS" -- EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${libdir} $EXTRA_LDFLAGS" -+ EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS" - if test "$cf_cv_shlib_version" = auto; then - if test -f /usr/libexec/ld.elf_so; then - cf_cv_shlib_version=abi -@@ -3029,7 +3121,7 @@ - CF_SHARED_SONAME - MK_SHARED_LIB='${CC} ${CFLAGS} -shared -Wl,-soname,'$cf_cv_shared_soname' -o $[@]' - else -- MK_SHARED_LIB='${LD} -shared -Bshareable -o $[@]' -+ MK_SHARED_LIB='${CC} -Wl,-shared -Wl,-Bshareable -o $[@]' - fi - ;; - osf*|mls+*) #(vi -@@ -3123,20 +3215,57 @@ - ;; - esac - -- if test -n "$cf_ld_rpath_opt" ; then -- MK_SHARED_LIB="$MK_SHARED_LIB $cf_ld_rpath_opt\${libdir}" -+ if test -n "$cf_try_cflags" -+ then -+cat > conftest.$ac_ext < -+int main(int argc, char *argv[[]]) -+{ -+ printf("hello\n"); -+ return (argv[[argc-1]] == 0) ; -+} -+EOF -+ cf_save_CFLAGS="$CFLAGS" -+ for cf_opt in $cf_try_cflags -+ do -+ CFLAGS="$cf_save_CFLAGS -$cf_opt" -+ AC_MSG_CHECKING(if CFLAGS option -$cf_opt works) -+ if AC_TRY_EVAL(ac_compile); then -+ AC_MSG_RESULT(yes) -+ cf_save_CFLAGS="$CFLAGS" -+ else -+ AC_MSG_RESULT(no) -+ fi -+ done -+ CFLAGS="$cf_save_CFLAGS" - fi - -+ -+ # RPATH_LIST is a colon-separated list of directories -+ test -n "$cf_ld_rpath_opt" && MK_SHARED_LIB="$MK_SHARED_LIB $cf_ld_rpath_opt\${RPATH_LIST}" -+ test -z "$RPATH_LIST" && RPATH_LIST="\${libdir}" -+ -+ test $cf_cv_rm_so_locs = yes && RM_SHARED_OPTS="$RM_SHARED_OPTS so_locations" -+ -+ CF_VERBOSE(CC_SHARED_OPTS: $CC_SHARED_OPTS) -+ CF_VERBOSE(MK_SHARED_LIB: $MK_SHARED_LIB) -+ - AC_SUBST(CC_SHARED_OPTS) - AC_SUBST(LD_RPATH_OPT) - AC_SUBST(LD_SHARED_OPTS) - AC_SUBST(MK_SHARED_LIB) -+ AC_SUBST(RM_SHARED_OPTS) -+ - AC_SUBST(LINK_PROGS) - AC_SUBST(LINK_TESTS) -+ - AC_SUBST(EXTRA_LDFLAGS) - AC_SUBST(LOCAL_LDFLAGS) - AC_SUBST(LOCAL_LDFLAGS2) -+ - AC_SUBST(INSTALL_LIB) -+ AC_SUBST(RPATH_LIST) - ])dnl - dnl --------------------------------------------------------------------------- - dnl CF_SHARED_SONAME version: 3 updated: 2008/09/08 18:34:43 -@@ -3180,24 +3309,7 @@ - CF_ADD_SUBDIR_PATH($1,$2,$3,[$]HOME,$prefix) - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_SUBST version: 4 updated: 2006/06/17 12:33:03 --dnl -------- --dnl Shorthand macro for substituting things that the user may override --dnl with an environment variable. --dnl --dnl $1 = long/descriptive name --dnl $2 = environment variable --dnl $3 = default value --AC_DEFUN([CF_SUBST], --[AC_CACHE_VAL(cf_cv_subst_$2,[ --AC_MSG_CHECKING(for $1 (symbol $2)) --CF_SUBST_IF([-z "[$]$2"], [$2], [$3]) --cf_cv_subst_$2=[$]$2 --AC_MSG_RESULT([$]$2) --]) --])dnl --dnl --------------------------------------------------------------------------- --dnl CF_TERM_HEADER version: 2 updated: 2010/10/23 15:54:49 -+dnl CF_TERM_HEADER version: 3 updated: 2012/10/06 08:57:51 - dnl -------------- - dnl Look for term.h, which is part of X/Open curses. It defines the interface - dnl to terminfo database. Usually it is in the same include-path as curses.h, -@@ -3230,29 +3342,68 @@ - - case $cf_cv_term_header in # (vi - *term.h) -- AC_DEFINE(HAVE_TERM_H) -+ AC_DEFINE(HAVE_TERM_H,1,[Define to 1 if we have term.h]) - ;; - esac - - case $cf_cv_term_header in # (vi - ncurses/term.h) #(vi -- AC_DEFINE(HAVE_NCURSES_TERM_H) -+ AC_DEFINE(HAVE_NCURSES_TERM_H,1,[Define to 1 if we have ncurses/term.h]) - ;; - ncursesw/term.h) -- AC_DEFINE(HAVE_NCURSESW_TERM_H) -+ AC_DEFINE(HAVE_NCURSESW_TERM_H,1,[Define to 1 if we have ncursesw/term.h]) - ;; - esac - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_TOP_BUILDDIR version: 1 updated: 2006/10/15 16:33:23 -+dnl CF_TOP_BUILDDIR version: 2 updated: 2013/07/27 17:38:32 - dnl --------------- - dnl Define a top_builddir symbol, for applications that need an absolute path. - AC_DEFUN([CF_TOP_BUILDDIR], - [ --top_builddir=`pwd` -+top_builddir=ifelse($1,,`pwd`,$1) - AC_SUBST(top_builddir) - ])dnl - dnl --------------------------------------------------------------------------- -+dnl CF_TRY_XOPEN_SOURCE version: 1 updated: 2011/10/30 17:09:50 -+dnl ------------------- -+dnl If _XOPEN_SOURCE is not defined in the compile environment, check if we -+dnl can define it successfully. -+AC_DEFUN([CF_TRY_XOPEN_SOURCE],[ -+AC_CACHE_CHECK(if we should define _XOPEN_SOURCE,cf_cv_xopen_source,[ -+ AC_TRY_COMPILE([ -+#include -+#include -+#include -+],[ -+#ifndef _XOPEN_SOURCE -+make an error -+#endif], -+ [cf_cv_xopen_source=no], -+ [cf_save="$CPPFLAGS" -+ CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" -+ AC_TRY_COMPILE([ -+#include -+#include -+#include -+],[ -+#ifdef _XOPEN_SOURCE -+make an error -+#endif], -+ [cf_cv_xopen_source=no], -+ [cf_cv_xopen_source=$cf_XOPEN_SOURCE]) -+ CPPFLAGS="$cf_save" -+ ]) -+]) -+ -+if test "$cf_cv_xopen_source" != no ; then -+ CF_REMOVE_DEFINE(CFLAGS,$CFLAGS,_XOPEN_SOURCE) -+ CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,_XOPEN_SOURCE) -+ cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source" -+ CF_ADD_CFLAGS($cf_temp_xopen_source) -+fi -+]) -+dnl --------------------------------------------------------------------------- - dnl CF_UPPER version: 5 updated: 2001/01/29 23:40:59 - dnl -------- - dnl Make an uppercase version of a variable -@@ -3262,7 +3413,7 @@ - $1=`echo "$2" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_UTF8_LIB version: 7 updated: 2010/06/20 09:24:28 -+dnl CF_UTF8_LIB version: 8 updated: 2012/10/06 08:57:51 - dnl ----------- - dnl Check for multibyte support, and if not found, utf8 compatibility library - AC_DEFUN([CF_UTF8_LIB], -@@ -3281,7 +3432,7 @@ - # HAVE_LIBUTF8_H is used by ncurses if curses.h is shared between - # ncurses/ncursesw: - if test "$cf_cv_utf8_lib" = "add-on" ; then -- AC_DEFINE(HAVE_LIBUTF8_H) -+ AC_DEFINE(HAVE_LIBUTF8_H,1,[Define to 1 if we should include libutf8.h]) - CF_ADD_INCDIR($cf_cv_header_path_utf8) - CF_ADD_LIBDIR($cf_cv_library_path_utf8) - CF_ADD_LIBS($cf_cv_library_file_utf8) -@@ -3415,7 +3566,33 @@ - fi - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_WITH_PATH version: 10 updated: 2010/10/23 15:44:18 -+dnl CF_WITH_LIB_PREFIX version: 1 updated: 2012/01/21 19:28:10 -+dnl ------------------ -+dnl Allow the library-prefix to be overridden. OS/2 EMX originally had no -+dnl "lib" prefix, e.g., because it used the dll naming convention. -+dnl -+dnl $1 = variable to set -+AC_DEFUN([CF_WITH_LIB_PREFIX], -+[ -+AC_MSG_CHECKING(if you want to have a library-prefix) -+AC_ARG_WITH(lib-prefix, -+ [ --with-lib-prefix override library-prefix], -+ [with_lib_prefix=$withval], -+ [with_lib_prefix=auto]) -+AC_MSG_RESULT($with_lib_prefix) -+ -+if test $with_lib_prefix = auto -+then -+ CF_LIB_PREFIX($1) -+elif test $with_lib_prefix = no -+then -+ LIB_PREFIX= -+else -+ LIB_PREFIX=$with_lib_prefix -+fi -+])dnl -+dnl --------------------------------------------------------------------------- -+dnl CF_WITH_PATH version: 11 updated: 2012/09/29 15:04:19 - dnl ------------ - dnl Wrapper for AC_ARG_WITH to ensure that user supplies a pathname, not just - dnl defaulting to yes/no. -@@ -3432,11 +3609,54 @@ - if ifelse([$5],,true,[test -n "$5"]) ; then - CF_PATH_SYNTAX(withval) - fi --$3="$withval" -+eval $3="$withval" - AC_SUBST($3)dnl - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_WITH_PTHREAD version: 3 updated: 2010/05/29 16:31:02 -+dnl CF_WITH_PKG_CONFIG_LIBDIR version: 2 updated: 2011/12/10 18:58:47 -+dnl ------------------------- -+dnl Allow the choice of the pkg-config library directory to be overridden. -+AC_DEFUN([CF_WITH_PKG_CONFIG_LIBDIR],[ -+if test "$PKG_CONFIG" != none ; then -+ AC_MSG_CHECKING(for $PKG_CONFIG library directory) -+ AC_ARG_WITH(pkg-config-libdir, -+ [ --with-pkg-config-libdir=XXX use given directory for installing pc-files], -+ [PKG_CONFIG_LIBDIR=$withval], -+ [PKG_CONFIG_LIBDIR=yes]) -+ -+ case x$PKG_CONFIG_LIBDIR in #(vi -+ x/*) #(vi -+ ;; -+ xyes) #(vi -+ # look for the library directory using the same prefix as the executable -+ cf_path=`echo "$PKG_CONFIG" | sed -e 's,/[[^/]]*/[[^/]]*$,,'` -+ case x`(arch) 2>/dev/null` in #(vi -+ *64) #(vi -+ for cf_config in $cf_path/share $cf_path/lib64 $cf_path/lib32 $cf_path/lib -+ do -+ if test -d $cf_config/pkgconfig -+ then -+ PKG_CONFIG_LIBDIR=$cf_config/pkgconfig -+ break -+ fi -+ done -+ ;; -+ *) -+ PKG_CONFIG_LIBDIR=$cf_path/lib/pkgconfig -+ ;; -+ esac -+ ;; -+ *) -+ ;; -+ esac -+ -+ AC_MSG_RESULT($PKG_CONFIG_LIBDIR) -+fi -+ -+AC_SUBST(PKG_CONFIG_LIBDIR) -+])dnl -+dnl --------------------------------------------------------------------------- -+dnl CF_WITH_PTHREAD version: 6 updated: 2012/10/06 17:41:51 - dnl --------------- - dnl Check for POSIX thread library. - AC_DEFUN([CF_WITH_PTHREAD], -@@ -3450,30 +3670,55 @@ - - if test "$with_pthread" != no ; then - AC_CHECK_HEADER(pthread.h,[ -- AC_DEFINE(HAVE_PTHREADS_H) -+ AC_DEFINE(HAVE_PTHREADS_H,1,[Define to 1 if we have pthreads.h header]) - -- AC_MSG_CHECKING(if we can link with the pthread library) -- cf_save_LIBS="$LIBS" -- CF_ADD_LIB(pthread) -- AC_TRY_LINK([ -+ for cf_lib_pthread in pthread c_r -+ do -+ AC_MSG_CHECKING(if we can link with the $cf_lib_pthread library) -+ cf_save_LIBS="$LIBS" -+ CF_ADD_LIB($cf_lib_pthread) -+ AC_TRY_LINK([ - #include - ],[ -- int rc = pthread_create(0,0,0,0); -+ int rc = pthread_create(0,0,0,0); -+ int r2 = pthread_mutexattr_settype(0, 0); - ],[with_pthread=yes],[with_pthread=no]) -- LIBS="$cf_save_LIBS" -- AC_MSG_RESULT($with_pthread) -+ LIBS="$cf_save_LIBS" -+ AC_MSG_RESULT($with_pthread) -+ test "$with_pthread" = yes && break -+ done - -- if test "$with_pthread" = yes ; then -- CF_ADD_LIB(pthread) -- AC_DEFINE(HAVE_LIBPTHREADS) -- else -- AC_MSG_ERROR(Cannot link with pthread library) -- fi -+ if test "$with_pthread" = yes ; then -+ CF_ADD_LIB($cf_lib_pthread) -+ AC_DEFINE(HAVE_LIBPTHREADS,1,[Define to 1 if we have pthreads library]) -+ else -+ AC_MSG_ERROR(Cannot link with pthread library) -+ fi - ]) - fi - ]) - dnl --------------------------------------------------------------------------- --dnl CF_XOPEN_SOURCE version: 35 updated: 2011/02/20 20:37:37 -+dnl CF_WITH_SYSTYPE version: 1 updated: 2013/01/26 16:26:12 -+dnl --------------- -+dnl For testing, override the derived host system-type which is used to decide -+dnl things such as the linker commands used to build shared libraries. This is -+dnl normally chosen automatically based on the type of system which you are -+dnl building on. We use it for testing the configure script. -+dnl -+dnl This is different from the --host option: it is used only for testing parts -+dnl of the configure script which would not be reachable with --host since that -+dnl relies on the build environment being real, rather than mocked up. -+AC_DEFUN([CF_WITH_SYSTYPE],[ -+CF_CHECK_CACHE([AC_CANONICAL_SYSTEM]) -+AC_ARG_WITH(system-type, -+ [ --with-system-type=XXX test: override derived host system-type], -+[AC_MSG_WARN(overriding system type to $withval) -+ cf_cv_system_name=$withval -+ host_os=$withval -+]) -+])dnl -+dnl --------------------------------------------------------------------------- -+dnl CF_XOPEN_SOURCE version: 46 updated: 2014/02/09 19:30:15 - dnl --------------- - dnl Try to get _XOPEN_SOURCE defined properly that we can use POSIX functions, - dnl or adapt to the vendor's definitions to get equivalent functionality, -@@ -3483,16 +3728,17 @@ - dnl $1 is the nominal value for _XOPEN_SOURCE - dnl $2 is the nominal value for _POSIX_C_SOURCE - AC_DEFUN([CF_XOPEN_SOURCE],[ -+AC_REQUIRE([AC_CANONICAL_HOST]) - - cf_XOPEN_SOURCE=ifelse([$1],,500,[$1]) - cf_POSIX_C_SOURCE=ifelse([$2],,199506L,[$2]) - cf_xopen_source= - - case $host_os in #(vi --aix[[456]]*) #(vi -+aix[[4-7]]*) #(vi - cf_xopen_source="-D_ALL_SOURCE" - ;; --cygwin) #(vi -+cygwin|msys) #(vi - cf_XOPEN_SOURCE=600 - ;; - darwin[[0-8]].*) #(vi -@@ -3500,6 +3746,7 @@ - ;; - darwin*) #(vi - cf_xopen_source="-D_DARWIN_C_SOURCE" -+ cf_XOPEN_SOURCE= - ;; - freebsd*|dragonfly*) #(vi - # 5.x headers associate -@@ -3517,15 +3764,23 @@ - ;; - irix[[56]].*) #(vi - cf_xopen_source="-D_SGI_SOURCE" -+ cf_XOPEN_SOURCE= - ;; - linux*|gnu*|mint*|k*bsd*-gnu) #(vi - CF_GNU_SOURCE - ;; - mirbsd*) #(vi -- # setting _XOPEN_SOURCE or _POSIX_SOURCE breaks -+ # setting _XOPEN_SOURCE or _POSIX_SOURCE breaks and other headers which use u_int / u_short types -+ cf_XOPEN_SOURCE= -+ CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE) - ;; - netbsd*) #(vi -- # setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw -+ cf_xopen_source="-D_NETBSD_SOURCE" # setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw -+ ;; -+openbsd[[4-9]]*) #(vi -+ # setting _XOPEN_SOURCE lower than 500 breaks g++ compile with wchar.h, needed for ncursesw -+ cf_xopen_source="-D_BSD_SOURCE" -+ cf_XOPEN_SOURCE=600 - ;; - openbsd*) #(vi - # setting _XOPEN_SOURCE breaks xterm on OpenBSD 2.8, is not needed for ncursesw -@@ -3539,36 +3794,12 @@ - sco*) #(vi - # setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer - ;; --solaris2.1[[0-9]]) #(vi -- cf_xopen_source="-D__EXTENSIONS__ -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" -- ;; --solaris2.[[1-9]]) #(vi -+solaris2.*) #(vi - cf_xopen_source="-D__EXTENSIONS__" -+ cf_cv_xopen_source=broken - ;; - *) -- AC_CACHE_CHECK(if we should define _XOPEN_SOURCE,cf_cv_xopen_source,[ -- AC_TRY_COMPILE([#include ],[ --#ifndef _XOPEN_SOURCE --make an error --#endif], -- [cf_cv_xopen_source=no], -- [cf_save="$CPPFLAGS" -- CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" -- AC_TRY_COMPILE([#include ],[ --#ifdef _XOPEN_SOURCE --make an error --#endif], -- [cf_cv_xopen_source=no], -- [cf_cv_xopen_source=$cf_XOPEN_SOURCE]) -- CPPFLAGS="$cf_save" -- ]) --]) -- if test "$cf_cv_xopen_source" != no ; then -- CF_REMOVE_DEFINE(CFLAGS,$CFLAGS,_XOPEN_SOURCE) -- CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,_XOPEN_SOURCE) -- cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source" -- CF_ADD_CFLAGS($cf_temp_xopen_source) -- fi -+ CF_TRY_XOPEN_SOURCE - CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE) - ;; - esac -@@ -3576,4 +3807,33 @@ - if test -n "$cf_xopen_source" ; then - CF_ADD_CFLAGS($cf_xopen_source) - fi -+ -+dnl In anything but the default case, we may have system-specific setting -+dnl which is still not guaranteed to provide all of the entrypoints that -+dnl _XOPEN_SOURCE would yield. -+if test -n "$cf_XOPEN_SOURCE" && test -z "$cf_cv_xopen_source" ; then -+ AC_MSG_CHECKING(if _XOPEN_SOURCE really is set) -+ AC_TRY_COMPILE([#include ],[ -+#ifndef _XOPEN_SOURCE -+make an error -+#endif], -+ [cf_XOPEN_SOURCE_set=yes], -+ [cf_XOPEN_SOURCE_set=no]) -+ AC_MSG_RESULT($cf_XOPEN_SOURCE_set) -+ if test $cf_XOPEN_SOURCE_set = yes -+ then -+ AC_TRY_COMPILE([#include ],[ -+#if (_XOPEN_SOURCE - 0) < $cf_XOPEN_SOURCE -+make an error -+#endif], -+ [cf_XOPEN_SOURCE_set_ok=yes], -+ [cf_XOPEN_SOURCE_set_ok=no]) -+ if test $cf_XOPEN_SOURCE_set_ok = no -+ then -+ AC_MSG_WARN(_XOPEN_SOURCE is lower than requested) -+ fi -+ else -+ CF_TRY_XOPEN_SOURCE -+ fi -+fi - ]) -diff -Naur ncurses-5.9/Ada95/configure ncurses-5.9.patch/Ada95/configure ---- ncurses-5.9/Ada95/configure 2011-04-01 01:34:47.000000000 +0200 -+++ ncurses-5.9.patch/Ada95/configure 2014-09-01 16:33:22.222791900 +0200 -@@ -1,7 +1,7 @@ - #! /bin/sh --# From configure.in Revision: 1.30 . -+# From configure.in Revision: 1.49 . - # Guess values for system-dependent variables and create Makefiles. --# Generated by Autoconf 2.52.20101002. -+# Generated by Autoconf 2.52.20121002. - # - # Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 - # Free Software Foundation, Inc. -@@ -135,15 +135,16 @@ - bindir='${exec_prefix}/bin' - sbindir='${exec_prefix}/sbin' - libexecdir='${exec_prefix}/libexec' --datadir='${prefix}/share' -+datarootdir='${prefix}/share' -+datadir='${datarootdir}' - sysconfdir='${prefix}/etc' - sharedstatedir='${prefix}/com' - localstatedir='${prefix}/var' - libdir='${exec_prefix}/lib' - includedir='${prefix}/include' - oldincludedir='/usr/include' --infodir='${prefix}/info' --mandir='${prefix}/man' -+infodir='${datarootdir}/info' -+mandir='${datarootdir}/man' - - # Identity of this package. - PACKAGE_NAME= -@@ -194,6 +195,13 @@ - | --da=*) - datadir=$ac_optarg ;; - -+ -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ -+ | --dataroo | --dataro | --datar) -+ ac_prev=datarootdir ;; -+ -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ -+ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) -+ datarootdir=$ac_optarg ;; -+ - -disable-* | --disable-*) - ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` - # Reject names that are not valid shell variable names. -@@ -469,7 +477,7 @@ - done - - # Be sure to have absolute paths. --for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ -+for ac_var in bindir sbindir libexecdir datarootdir datadir sysconfdir sharedstatedir \ - localstatedir libdir includedir oldincludedir infodir mandir - do - eval ac_val=$`echo $ac_var` -@@ -606,15 +614,16 @@ - --bindir=DIR user executables [EPREFIX/bin] - --sbindir=DIR system admin executables [EPREFIX/sbin] - --libexecdir=DIR program executables [EPREFIX/libexec] -- --datadir=DIR read-only architecture-independent data [PREFIX/share] -+ --datarootdir=DIR read-only architecture-independent data [PREFIX/share] -+ --datadir=DIR read-only architecture-independent data [DATAROOTDIR] - --sysconfdir=DIR read-only single-machine data [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] - --localstatedir=DIR modifiable single-machine data [PREFIX/var] - --libdir=DIR object code libraries [EPREFIX/lib] - --includedir=DIR C header files [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc [/usr/include] -- --infodir=DIR info documentation [PREFIX/info] -- --mandir=DIR man documentation [PREFIX/man] -+ --infodir=DIR info documentation [DATAROOTDIR/info] -+ --mandir=DIR man documentation [DATAROOTDIR/man] - EOF - - cat <<\EOF -@@ -645,6 +654,7 @@ - - --with-system-type=XXX test: override derived host system-type - --with-pkg-config{=path} enable/disable use of pkg-config -+ --with-pkg-config-libdir=XXX use given directory for installing pc-files - --enable-pc-files generate and install .pc files for pkg-config - --without-tests suppress build with test-programs - --enable-mixed-case tic should assume mixed-case filenames -@@ -660,6 +670,7 @@ - --with-shared generate shared C-objects (needed for --with-ada-sharedlib) - --enable-widec compile with wide-char/UTF-8 code - --with-curses-dir=DIR directory in which (n)curses is installed -+ --with-lib-prefix override library-prefix - --with-shlib-version=X Specify rel or abi version for shared libs - --enable-rpath-link link sample programs with rpath option - Fine-Tuning Your Configuration: -@@ -677,7 +688,7 @@ - --enable-reentrant compile with experimental reentrant code - --with-wrap-prefix=XXX override prefix used for public variables - Testing/development Options: -- --enable-echo build: display "compiling" commands (default) -+ --disable-echo do not display "compiling" commands - --enable-warnings build: turn on GCC compiler warnings - --enable-assertions test: turn on generation of assertion code - --enable-expanded test: generate functions for certain macros -@@ -757,7 +768,7 @@ - running configure, to aid debugging if configure makes a mistake. - - It was created by $as_me, which was --generated by GNU Autoconf 2.52.20101002. Invocation command line was -+generated by GNU Autoconf 2.52.20121002. Invocation command line was - - $ $0 $@ - -@@ -881,7 +892,7 @@ - fi - for ac_site_file in $CONFIG_SITE; do - if test -r "$ac_site_file"; then -- { echo "$as_me:884: loading site script $ac_site_file" >&5 -+ { echo "$as_me:895: loading site script $ac_site_file" >&5 - echo "$as_me: loading site script $ac_site_file" >&6;} - cat "$ac_site_file" >&5 - . "$ac_site_file" -@@ -892,7 +903,7 @@ - # Some versions of bash will fail to source /dev/null (special - # files actually), so we avoid doing that. - if test -f "$cache_file"; then -- { echo "$as_me:895: loading cache $cache_file" >&5 -+ { echo "$as_me:906: loading cache $cache_file" >&5 - echo "$as_me: loading cache $cache_file" >&6;} - case $cache_file in - [\\/]* | ?:[\\/]* ) . $cache_file;; -@@ -900,7 +911,7 @@ - esac - fi - else -- { echo "$as_me:903: creating cache $cache_file" >&5 -+ { echo "$as_me:914: creating cache $cache_file" >&5 - echo "$as_me: creating cache $cache_file" >&6;} - >$cache_file - fi -@@ -916,21 +927,21 @@ - eval ac_new_val="\$ac_env_${ac_var}_value" - case $ac_old_set,$ac_new_set in - set,) -- { echo "$as_me:919: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 -+ { echo "$as_me:930: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 - echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,set) -- { echo "$as_me:923: error: \`$ac_var' was not set in the previous run" >&5 -+ { echo "$as_me:934: error: \`$ac_var' was not set in the previous run" >&5 - echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,);; - *) - if test "x$ac_old_val" != "x$ac_new_val"; then -- { echo "$as_me:929: error: \`$ac_var' has changed since the previous run:" >&5 -+ { echo "$as_me:940: error: \`$ac_var' has changed since the previous run:" >&5 - echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} -- { echo "$as_me:931: former value: $ac_old_val" >&5 -+ { echo "$as_me:942: former value: $ac_old_val" >&5 - echo "$as_me: former value: $ac_old_val" >&2;} -- { echo "$as_me:933: current value: $ac_new_val" >&5 -+ { echo "$as_me:944: current value: $ac_new_val" >&5 - echo "$as_me: current value: $ac_new_val" >&2;} - ac_cache_corrupted=: - fi;; -@@ -949,9 +960,9 @@ - fi - done - if $ac_cache_corrupted; then -- { echo "$as_me:952: error: changes in the environment can compromise the build" >&5 -+ { echo "$as_me:963: error: changes in the environment can compromise the build" >&5 - echo "$as_me: error: changes in the environment can compromise the build" >&2;} -- { { echo "$as_me:954: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 -+ { { echo "$as_me:965: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 - echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} - { (exit 1); exit 1; }; } - fi -@@ -972,10 +983,10 @@ - echo "#! $SHELL" >conftest.sh - echo "exit 0" >>conftest.sh - chmod +x conftest.sh --if { (echo "$as_me:975: PATH=\".;.\"; conftest.sh") >&5 -+if { (echo "$as_me:986: PATH=\".;.\"; conftest.sh") >&5 - (PATH=".;."; conftest.sh) 2>&5 - ac_status=$? -- echo "$as_me:978: \$? = $ac_status" >&5 -+ echo "$as_me:989: \$? = $ac_status" >&5 - (exit $ac_status); }; then - ac_path_separator=';' - else -@@ -1005,7 +1016,7 @@ - fi - done - if test -z "$ac_aux_dir"; then -- { { echo "$as_me:1008: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 -+ { { echo "$as_me:1019: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 - echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;} - { (exit 1); exit 1; }; } - fi -@@ -1015,11 +1026,11 @@ - - # Make sure we can run config.sub. - $ac_config_sub sun4 >/dev/null 2>&1 || -- { { echo "$as_me:1018: error: cannot run $ac_config_sub" >&5 -+ { { echo "$as_me:1029: error: cannot run $ac_config_sub" >&5 - echo "$as_me: error: cannot run $ac_config_sub" >&2;} - { (exit 1); exit 1; }; } - --echo "$as_me:1022: checking build system type" >&5 -+echo "$as_me:1033: checking build system type" >&5 - echo $ECHO_N "checking build system type... $ECHO_C" >&6 - if test "${ac_cv_build+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -1028,23 +1039,23 @@ - test -z "$ac_cv_build_alias" && - ac_cv_build_alias=`$ac_config_guess` - test -z "$ac_cv_build_alias" && -- { { echo "$as_me:1031: error: cannot guess build type; you must specify one" >&5 -+ { { echo "$as_me:1042: error: cannot guess build type; you must specify one" >&5 - echo "$as_me: error: cannot guess build type; you must specify one" >&2;} - { (exit 1); exit 1; }; } - ac_cv_build=`$ac_config_sub $ac_cv_build_alias` || -- { { echo "$as_me:1035: error: $ac_config_sub $ac_cv_build_alias failed." >&5 -+ { { echo "$as_me:1046: error: $ac_config_sub $ac_cv_build_alias failed." >&5 - echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed." >&2;} - { (exit 1); exit 1; }; } - - fi --echo "$as_me:1040: result: $ac_cv_build" >&5 -+echo "$as_me:1051: result: $ac_cv_build" >&5 - echo "${ECHO_T}$ac_cv_build" >&6 - build=$ac_cv_build - build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` - build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` - build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` - --echo "$as_me:1047: checking host system type" >&5 -+echo "$as_me:1058: checking host system type" >&5 - echo $ECHO_N "checking host system type... $ECHO_C" >&6 - if test "${ac_cv_host+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -1053,12 +1064,12 @@ - test -z "$ac_cv_host_alias" && - ac_cv_host_alias=$ac_cv_build_alias - ac_cv_host=`$ac_config_sub $ac_cv_host_alias` || -- { { echo "$as_me:1056: error: $ac_config_sub $ac_cv_host_alias failed" >&5 -+ { { echo "$as_me:1067: error: $ac_config_sub $ac_cv_host_alias failed" >&5 - echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;} - { (exit 1); exit 1; }; } - - fi --echo "$as_me:1061: result: $ac_cv_host" >&5 -+echo "$as_me:1072: result: $ac_cv_host" >&5 - echo "${ECHO_T}$ac_cv_host" >&6 - host=$ac_cv_host - host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -@@ -1066,7 +1077,7 @@ - host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` - - if test -f $srcdir/config.guess || test -f $ac_aux_dir/config.guess ; then -- echo "$as_me:1069: checking target system type" >&5 -+ echo "$as_me:1080: checking target system type" >&5 - echo $ECHO_N "checking target system type... $ECHO_C" >&6 - if test "${ac_cv_target+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -1075,12 +1086,12 @@ - test "x$ac_cv_target_alias" = "x" && - ac_cv_target_alias=$ac_cv_host_alias - ac_cv_target=`$ac_config_sub $ac_cv_target_alias` || -- { { echo "$as_me:1078: error: $ac_config_sub $ac_cv_target_alias failed" >&5 -+ { { echo "$as_me:1089: error: $ac_config_sub $ac_cv_target_alias failed" >&5 - echo "$as_me: error: $ac_config_sub $ac_cv_target_alias failed" >&2;} - { (exit 1); exit 1; }; } - - fi --echo "$as_me:1083: result: $ac_cv_target" >&5 -+echo "$as_me:1094: result: $ac_cv_target" >&5 - echo "${ECHO_T}$ac_cv_target" >&6 - target=$ac_cv_target - target_cpu=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -@@ -1100,7 +1111,8 @@ - system_name="`(hostname) 2>/dev/null`" - fi - fi --test -n "$system_name" && cat >>confdefs.h <>confdefs.h <&5 -+test -n "$cf_cv_system_name" && echo "$as_me:1126: result: Configuring for $cf_cv_system_name" >&5 - echo "${ECHO_T}Configuring for $cf_cv_system_name" >&6 - - if test ".$system_name" != ".$cf_cv_system_name" ; then -- echo "$as_me:1118: result: Cached system name ($system_name) does not agree with actual ($cf_cv_system_name)" >&5 -+ echo "$as_me:1130: result: Cached system name ($system_name) does not agree with actual ($cf_cv_system_name)" >&5 - echo "${ECHO_T}Cached system name ($system_name) does not agree with actual ($cf_cv_system_name)" >&6 -- { { echo "$as_me:1120: error: \"Please remove config.cache and try again.\"" >&5 -+ { { echo "$as_me:1132: error: \"Please remove config.cache and try again.\"" >&5 - echo "$as_me: error: \"Please remove config.cache and try again.\"" >&2;} - { (exit 1); exit 1; }; } - fi -@@ -1125,9 +1137,11 @@ - # Check whether --with-system-type or --without-system-type was given. - if test "${with_system_type+set}" = set; then - withval="$with_system_type" -- { echo "$as_me:1128: WARNING: overriding system type to $withval" >&5 -+ { echo "$as_me:1140: WARNING: overriding system type to $withval" >&5 - echo "$as_me: WARNING: overriding system type to $withval" >&2;} -- cf_cv_system_name=$withval -+ cf_cv_system_name=$withval -+ host_os=$withval -+ - fi; - - ### Save the given $CFLAGS to allow user-override. -@@ -1135,23 +1149,23 @@ - - ### Default install-location - --echo "$as_me:1138: checking for prefix" >&5 -+echo "$as_me:1152: checking for prefix" >&5 - echo $ECHO_N "checking for prefix... $ECHO_C" >&6 - if test "x$prefix" = "xNONE" ; then - case "$cf_cv_system_name" in - # non-vendor systems don't have a conflict -- openbsd*|freebsd*|linux*|cygwin*|k*bsd*-gnu) -+ openbsd*|freebsd*|mirbsd*|linux*|cygwin*|msys*|k*bsd*-gnu|mingw*) - prefix=/usr - ;; - *) prefix=$ac_default_prefix - ;; - esac - fi --echo "$as_me:1150: result: $prefix" >&5 -+echo "$as_me:1164: result: $prefix" >&5 - echo "${ECHO_T}$prefix" >&6 - - if test "x$prefix" = "xNONE" ; then --echo "$as_me:1154: checking for default include-directory" >&5 -+echo "$as_me:1168: checking for default include-directory" >&5 - echo $ECHO_N "checking for default include-directory... $ECHO_C" >&6 - test -n "$verbose" && echo 1>&6 - for cf_symbol in \ -@@ -1174,11 +1188,12 @@ - fi - test -n "$verbose" && echo " tested $cf_dir" 1>&6 - done --echo "$as_me:1177: result: $includedir" >&5 -+echo "$as_me:1191: result: $includedir" >&5 - echo "${ECHO_T}$includedir" >&6 - fi - - ### Checks for programs. -+ - ac_ext=c - ac_cpp='$CPP $CPPFLAGS' - ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -@@ -1186,213 +1201,11 @@ - ac_compiler_gnu=$ac_cv_c_compiler_gnu - ac_main_return=return - if test -n "$ac_tool_prefix"; then -- # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. --set dummy ${ac_tool_prefix}gcc; ac_word=$2 --echo "$as_me:1191: checking for $ac_word" >&5 --echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 --if test "${ac_cv_prog_CC+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 --else -- if test -n "$CC"; then -- ac_cv_prog_CC="$CC" # Let the user override the test. --else -- ac_save_IFS=$IFS; IFS=$ac_path_separator --ac_dummy="$PATH" --for ac_dir in $ac_dummy; do -- IFS=$ac_save_IFS -- test -z "$ac_dir" && ac_dir=. -- $as_executable_p "$ac_dir/$ac_word" || continue --ac_cv_prog_CC="${ac_tool_prefix}gcc" --echo "$as_me:1206: found $ac_dir/$ac_word" >&5 --break --done -- --fi --fi --CC=$ac_cv_prog_CC --if test -n "$CC"; then -- echo "$as_me:1214: result: $CC" >&5 --echo "${ECHO_T}$CC" >&6 --else -- echo "$as_me:1217: result: no" >&5 --echo "${ECHO_T}no" >&6 --fi -- --fi --if test -z "$ac_cv_prog_CC"; then -- ac_ct_CC=$CC -- # Extract the first word of "gcc", so it can be a program name with args. --set dummy gcc; ac_word=$2 --echo "$as_me:1226: checking for $ac_word" >&5 --echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 --if test "${ac_cv_prog_ac_ct_CC+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 --else -- if test -n "$ac_ct_CC"; then -- ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. --else -- ac_save_IFS=$IFS; IFS=$ac_path_separator --ac_dummy="$PATH" --for ac_dir in $ac_dummy; do -- IFS=$ac_save_IFS -- test -z "$ac_dir" && ac_dir=. -- $as_executable_p "$ac_dir/$ac_word" || continue --ac_cv_prog_ac_ct_CC="gcc" --echo "$as_me:1241: found $ac_dir/$ac_word" >&5 --break --done -- --fi --fi --ac_ct_CC=$ac_cv_prog_ac_ct_CC --if test -n "$ac_ct_CC"; then -- echo "$as_me:1249: result: $ac_ct_CC" >&5 --echo "${ECHO_T}$ac_ct_CC" >&6 --else -- echo "$as_me:1252: result: no" >&5 --echo "${ECHO_T}no" >&6 --fi -- -- CC=$ac_ct_CC --else -- CC="$ac_cv_prog_CC" --fi -- --if test -z "$CC"; then -- if test -n "$ac_tool_prefix"; then -- # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. --set dummy ${ac_tool_prefix}cc; ac_word=$2 --echo "$as_me:1265: checking for $ac_word" >&5 --echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 --if test "${ac_cv_prog_CC+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 --else -- if test -n "$CC"; then -- ac_cv_prog_CC="$CC" # Let the user override the test. --else -- ac_save_IFS=$IFS; IFS=$ac_path_separator --ac_dummy="$PATH" --for ac_dir in $ac_dummy; do -- IFS=$ac_save_IFS -- test -z "$ac_dir" && ac_dir=. -- $as_executable_p "$ac_dir/$ac_word" || continue --ac_cv_prog_CC="${ac_tool_prefix}cc" --echo "$as_me:1280: found $ac_dir/$ac_word" >&5 --break --done -- --fi --fi --CC=$ac_cv_prog_CC --if test -n "$CC"; then -- echo "$as_me:1288: result: $CC" >&5 --echo "${ECHO_T}$CC" >&6 --else -- echo "$as_me:1291: result: no" >&5 --echo "${ECHO_T}no" >&6 --fi -- --fi --if test -z "$ac_cv_prog_CC"; then -- ac_ct_CC=$CC -- # Extract the first word of "cc", so it can be a program name with args. --set dummy cc; ac_word=$2 --echo "$as_me:1300: checking for $ac_word" >&5 --echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 --if test "${ac_cv_prog_ac_ct_CC+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 --else -- if test -n "$ac_ct_CC"; then -- ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. --else -- ac_save_IFS=$IFS; IFS=$ac_path_separator --ac_dummy="$PATH" --for ac_dir in $ac_dummy; do -- IFS=$ac_save_IFS -- test -z "$ac_dir" && ac_dir=. -- $as_executable_p "$ac_dir/$ac_word" || continue --ac_cv_prog_ac_ct_CC="cc" --echo "$as_me:1315: found $ac_dir/$ac_word" >&5 --break --done -- --fi --fi --ac_ct_CC=$ac_cv_prog_ac_ct_CC --if test -n "$ac_ct_CC"; then -- echo "$as_me:1323: result: $ac_ct_CC" >&5 --echo "${ECHO_T}$ac_ct_CC" >&6 --else -- echo "$as_me:1326: result: no" >&5 --echo "${ECHO_T}no" >&6 --fi -- -- CC=$ac_ct_CC --else -- CC="$ac_cv_prog_CC" --fi -- --fi --if test -z "$CC"; then -- # Extract the first word of "cc", so it can be a program name with args. --set dummy cc; ac_word=$2 --echo "$as_me:1339: checking for $ac_word" >&5 --echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 --if test "${ac_cv_prog_CC+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 --else -- if test -n "$CC"; then -- ac_cv_prog_CC="$CC" # Let the user override the test. --else -- ac_prog_rejected=no -- ac_save_IFS=$IFS; IFS=$ac_path_separator --ac_dummy="$PATH" --for ac_dir in $ac_dummy; do -- IFS=$ac_save_IFS -- test -z "$ac_dir" && ac_dir=. -- $as_executable_p "$ac_dir/$ac_word" || continue --if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then -- ac_prog_rejected=yes -- continue --fi --ac_cv_prog_CC="cc" --echo "$as_me:1359: found $ac_dir/$ac_word" >&5 --break --done -- --if test $ac_prog_rejected = yes; then -- # We found a bogon in the path, so make sure we never use it. -- set dummy $ac_cv_prog_CC -- shift -- if test $# != 0; then -- # We chose a different compiler from the bogus one. -- # However, it has the same basename, so the bogon will be chosen -- # first if we set CC to just the basename; use the full file name. -- shift -- set dummy "$ac_dir/$ac_word" ${1+"$@"} -- shift -- ac_cv_prog_CC="$@" -- fi --fi --fi --fi --CC=$ac_cv_prog_CC --if test -n "$CC"; then -- echo "$as_me:1381: result: $CC" >&5 --echo "${ECHO_T}$CC" >&6 --else -- echo "$as_me:1384: result: no" >&5 --echo "${ECHO_T}no" >&6 --fi -- --fi --if test -z "$CC"; then -- if test -n "$ac_tool_prefix"; then -- for ac_prog in cl -+ for ac_prog in gnatgcc gcc cc - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. - set dummy $ac_tool_prefix$ac_prog; ac_word=$2 --echo "$as_me:1395: checking for $ac_word" >&5 -+echo "$as_me:1208: checking for $ac_word" >&5 - echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 - if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -1407,7 +1220,7 @@ - test -z "$ac_dir" && ac_dir=. - $as_executable_p "$ac_dir/$ac_word" || continue - ac_cv_prog_CC="$ac_tool_prefix$ac_prog" --echo "$as_me:1410: found $ac_dir/$ac_word" >&5 -+echo "$as_me:1223: found $ac_dir/$ac_word" >&5 - break - done - -@@ -1415,10 +1228,10 @@ - fi - CC=$ac_cv_prog_CC - if test -n "$CC"; then -- echo "$as_me:1418: result: $CC" >&5 -+ echo "$as_me:1231: result: $CC" >&5 - echo "${ECHO_T}$CC" >&6 - else -- echo "$as_me:1421: result: no" >&5 -+ echo "$as_me:1234: result: no" >&5 - echo "${ECHO_T}no" >&6 - fi - -@@ -1427,11 +1240,11 @@ - fi - if test -z "$CC"; then - ac_ct_CC=$CC -- for ac_prog in cl -+ for ac_prog in gnatgcc gcc cc - do - # Extract the first word of "$ac_prog", so it can be a program name with args. - set dummy $ac_prog; ac_word=$2 --echo "$as_me:1434: checking for $ac_word" >&5 -+echo "$as_me:1247: checking for $ac_word" >&5 - echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 - if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -1446,7 +1259,7 @@ - test -z "$ac_dir" && ac_dir=. - $as_executable_p "$ac_dir/$ac_word" || continue - ac_cv_prog_ac_ct_CC="$ac_prog" --echo "$as_me:1449: found $ac_dir/$ac_word" >&5 -+echo "$as_me:1262: found $ac_dir/$ac_word" >&5 - break - done - -@@ -1454,10 +1267,10 @@ - fi - ac_ct_CC=$ac_cv_prog_ac_ct_CC - if test -n "$ac_ct_CC"; then -- echo "$as_me:1457: result: $ac_ct_CC" >&5 -+ echo "$as_me:1270: result: $ac_ct_CC" >&5 - echo "${ECHO_T}$ac_ct_CC" >&6 - else -- echo "$as_me:1460: result: no" >&5 -+ echo "$as_me:1273: result: no" >&5 - echo "${ECHO_T}no" >&6 - fi - -@@ -1467,34 +1280,32 @@ - CC=$ac_ct_CC - fi - --fi -- --test -z "$CC" && { { echo "$as_me:1472: error: no acceptable cc found in \$PATH" >&5 -+test -z "$CC" && { { echo "$as_me:1283: error: no acceptable cc found in \$PATH" >&5 - echo "$as_me: error: no acceptable cc found in \$PATH" >&2;} - { (exit 1); exit 1; }; } - - # Provide some information about the compiler. --echo "$as_me:1477:" \ -+echo "$as_me:1288:" \ - "checking for C compiler version" >&5 - ac_compiler=`set X $ac_compile; echo $2` --{ (eval echo "$as_me:1480: \"$ac_compiler --version &5\"") >&5 -+{ (eval echo "$as_me:1291: \"$ac_compiler --version &5\"") >&5 - (eval $ac_compiler --version &5) 2>&5 - ac_status=$? -- echo "$as_me:1483: \$? = $ac_status" >&5 -+ echo "$as_me:1294: \$? = $ac_status" >&5 - (exit $ac_status); } --{ (eval echo "$as_me:1485: \"$ac_compiler -v &5\"") >&5 -+{ (eval echo "$as_me:1296: \"$ac_compiler -v &5\"") >&5 - (eval $ac_compiler -v &5) 2>&5 - ac_status=$? -- echo "$as_me:1488: \$? = $ac_status" >&5 -+ echo "$as_me:1299: \$? = $ac_status" >&5 - (exit $ac_status); } --{ (eval echo "$as_me:1490: \"$ac_compiler -V &5\"") >&5 -+{ (eval echo "$as_me:1301: \"$ac_compiler -V &5\"") >&5 - (eval $ac_compiler -V &5) 2>&5 - ac_status=$? -- echo "$as_me:1493: \$? = $ac_status" >&5 -+ echo "$as_me:1304: \$? = $ac_status" >&5 - (exit $ac_status); } - - cat >conftest.$ac_ext <<_ACEOF --#line 1497 "configure" -+#line 1308 "configure" - #include "confdefs.h" - - int -@@ -1510,13 +1321,13 @@ - # Try to create an executable without -o first, disregard a.out. - # It will help us diagnose broken compilers, and finding out an intuition - # of exeext. --echo "$as_me:1513: checking for C compiler default output" >&5 -+echo "$as_me:1324: checking for C compiler default output" >&5 - echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6 - ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` --if { (eval echo "$as_me:1516: \"$ac_link_default\"") >&5 -+if { (eval echo "$as_me:1327: \"$ac_link_default\"") >&5 - (eval $ac_link_default) 2>&5 - ac_status=$? -- echo "$as_me:1519: \$? = $ac_status" >&5 -+ echo "$as_me:1330: \$? = $ac_status" >&5 - (exit $ac_status); }; then - # Find the output, starting from the most likely. This scheme is - # not robust to junk in `.', hence go to wildcards (a.*) only as a last -@@ -1539,34 +1350,34 @@ - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --{ { echo "$as_me:1542: error: C compiler cannot create executables" >&5 -+{ { echo "$as_me:1353: error: C compiler cannot create executables" >&5 - echo "$as_me: error: C compiler cannot create executables" >&2;} - { (exit 77); exit 77; }; } - fi - - ac_exeext=$ac_cv_exeext --echo "$as_me:1548: result: $ac_file" >&5 -+echo "$as_me:1359: result: $ac_file" >&5 - echo "${ECHO_T}$ac_file" >&6 - - # Check the compiler produces executables we can run. If not, either - # the compiler is broken, or we cross compile. --echo "$as_me:1553: checking whether the C compiler works" >&5 -+echo "$as_me:1364: checking whether the C compiler works" >&5 - echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 - # FIXME: These cross compiler hacks should be removed for Autoconf 3.0 - # If not cross compiling, check that we can run a simple program. - if test "$cross_compiling" != yes; then - if { ac_try='./$ac_file' -- { (eval echo "$as_me:1559: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:1370: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:1562: \$? = $ac_status" >&5 -+ echo "$as_me:1373: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cross_compiling=no - else - if test "$cross_compiling" = maybe; then - cross_compiling=yes - else -- { { echo "$as_me:1569: error: cannot run C compiled programs. -+ { { echo "$as_me:1380: error: cannot run C compiled programs. - If you meant to cross compile, use \`--host'." >&5 - echo "$as_me: error: cannot run C compiled programs. - If you meant to cross compile, use \`--host'." >&2;} -@@ -1574,24 +1385,24 @@ - fi - fi - fi --echo "$as_me:1577: result: yes" >&5 -+echo "$as_me:1388: result: yes" >&5 - echo "${ECHO_T}yes" >&6 - - rm -f a.out a.exe conftest$ac_cv_exeext - ac_clean_files=$ac_clean_files_save - # Check the compiler produces executables we can run. If not, either - # the compiler is broken, or we cross compile. --echo "$as_me:1584: checking whether we are cross compiling" >&5 -+echo "$as_me:1395: checking whether we are cross compiling" >&5 - echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 --echo "$as_me:1586: result: $cross_compiling" >&5 -+echo "$as_me:1397: result: $cross_compiling" >&5 - echo "${ECHO_T}$cross_compiling" >&6 - --echo "$as_me:1589: checking for executable suffix" >&5 -+echo "$as_me:1400: checking for executable suffix" >&5 - echo $ECHO_N "checking for executable suffix... $ECHO_C" >&6 --if { (eval echo "$as_me:1591: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:1402: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:1594: \$? = $ac_status" >&5 -+ echo "$as_me:1405: \$? = $ac_status" >&5 - (exit $ac_status); }; then - # If both `conftest.exe' and `conftest' are `present' (well, observable) - # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will -@@ -1607,25 +1418,25 @@ - esac - done - else -- { { echo "$as_me:1610: error: cannot compute EXEEXT: cannot compile and link" >&5 -+ { { echo "$as_me:1421: error: cannot compute EXEEXT: cannot compile and link" >&5 - echo "$as_me: error: cannot compute EXEEXT: cannot compile and link" >&2;} - { (exit 1); exit 1; }; } - fi - - rm -f conftest$ac_cv_exeext --echo "$as_me:1616: result: $ac_cv_exeext" >&5 -+echo "$as_me:1427: result: $ac_cv_exeext" >&5 - echo "${ECHO_T}$ac_cv_exeext" >&6 - - rm -f conftest.$ac_ext - EXEEXT=$ac_cv_exeext - ac_exeext=$EXEEXT --echo "$as_me:1622: checking for object suffix" >&5 -+echo "$as_me:1433: checking for object suffix" >&5 - echo $ECHO_N "checking for object suffix... $ECHO_C" >&6 - if test "${ac_cv_objext+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - cat >conftest.$ac_ext <<_ACEOF --#line 1628 "configure" -+#line 1439 "configure" - #include "confdefs.h" - - int -@@ -1637,10 +1448,10 @@ - } - _ACEOF - rm -f conftest.o conftest.obj --if { (eval echo "$as_me:1640: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:1451: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:1643: \$? = $ac_status" >&5 -+ echo "$as_me:1454: \$? = $ac_status" >&5 - (exit $ac_status); }; then - for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do - case $ac_file in -@@ -1652,24 +1463,24 @@ - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --{ { echo "$as_me:1655: error: cannot compute OBJEXT: cannot compile" >&5 -+{ { echo "$as_me:1466: error: cannot compute OBJEXT: cannot compile" >&5 - echo "$as_me: error: cannot compute OBJEXT: cannot compile" >&2;} - { (exit 1); exit 1; }; } - fi - - rm -f conftest.$ac_cv_objext conftest.$ac_ext - fi --echo "$as_me:1662: result: $ac_cv_objext" >&5 -+echo "$as_me:1473: result: $ac_cv_objext" >&5 - echo "${ECHO_T}$ac_cv_objext" >&6 - OBJEXT=$ac_cv_objext - ac_objext=$OBJEXT --echo "$as_me:1666: checking whether we are using the GNU C compiler" >&5 -+echo "$as_me:1477: checking whether we are using the GNU C compiler" >&5 - echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 - if test "${ac_cv_c_compiler_gnu+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - cat >conftest.$ac_ext <<_ACEOF --#line 1672 "configure" -+#line 1483 "configure" - #include "confdefs.h" - - int -@@ -1684,16 +1495,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:1687: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:1498: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:1690: \$? = $ac_status" >&5 -+ echo "$as_me:1501: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:1693: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:1504: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:1696: \$? = $ac_status" >&5 -+ echo "$as_me:1507: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_compiler_gnu=yes - else -@@ -1705,19 +1516,19 @@ - ac_cv_c_compiler_gnu=$ac_compiler_gnu - - fi --echo "$as_me:1708: result: $ac_cv_c_compiler_gnu" >&5 -+echo "$as_me:1519: result: $ac_cv_c_compiler_gnu" >&5 - echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 - GCC=`test $ac_compiler_gnu = yes && echo yes` - ac_test_CFLAGS=${CFLAGS+set} - ac_save_CFLAGS=$CFLAGS - CFLAGS="-g" --echo "$as_me:1714: checking whether $CC accepts -g" >&5 -+echo "$as_me:1525: checking whether $CC accepts -g" >&5 - echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 - if test "${ac_cv_prog_cc_g+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - cat >conftest.$ac_ext <<_ACEOF --#line 1720 "configure" -+#line 1531 "configure" - #include "confdefs.h" - - int -@@ -1729,16 +1540,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:1732: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:1543: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:1735: \$? = $ac_status" >&5 -+ echo "$as_me:1546: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:1738: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:1549: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:1741: \$? = $ac_status" >&5 -+ echo "$as_me:1552: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_prog_cc_g=yes - else -@@ -1748,7 +1559,7 @@ - fi - rm -f conftest.$ac_objext conftest.$ac_ext - fi --echo "$as_me:1751: result: $ac_cv_prog_cc_g" >&5 -+echo "$as_me:1562: result: $ac_cv_prog_cc_g" >&5 - echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 - if test "$ac_test_CFLAGS" = set; then - CFLAGS=$ac_save_CFLAGS -@@ -1775,16 +1586,16 @@ - #endif - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:1778: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:1589: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:1781: \$? = $ac_status" >&5 -+ echo "$as_me:1592: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:1784: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:1595: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:1787: \$? = $ac_status" >&5 -+ echo "$as_me:1598: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - for ac_declaration in \ - ''\ -@@ -1796,7 +1607,7 @@ - 'void exit (int);' - do - cat >conftest.$ac_ext <<_ACEOF --#line 1799 "configure" -+#line 1610 "configure" - #include "confdefs.h" - #include - $ac_declaration -@@ -1809,16 +1620,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:1812: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:1623: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:1815: \$? = $ac_status" >&5 -+ echo "$as_me:1626: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:1818: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:1629: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:1821: \$? = $ac_status" >&5 -+ echo "$as_me:1632: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : - else -@@ -1828,7 +1639,7 @@ - fi - rm -f conftest.$ac_objext conftest.$ac_ext - cat >conftest.$ac_ext <<_ACEOF --#line 1831 "configure" -+#line 1642 "configure" - #include "confdefs.h" - $ac_declaration - int -@@ -1840,16 +1651,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:1843: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:1654: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:1846: \$? = $ac_status" >&5 -+ echo "$as_me:1657: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:1849: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:1660: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:1852: \$? = $ac_status" >&5 -+ echo "$as_me:1663: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - break - else -@@ -1879,68 +1690,259 @@ - - GCC_VERSION=none - if test "$GCC" = yes ; then -- echo "$as_me:1882: checking version of $CC" >&5 -+ echo "$as_me:1693: checking version of $CC" >&5 - echo $ECHO_N "checking version of $CC... $ECHO_C" >&6 -- GCC_VERSION="`${CC} --version 2>/dev/null | sed -e '2,$d' -e 's/^.*(GCC) //' -e 's/^[^0-9.]*//' -e 's/[^0-9.].*//'`" -+ GCC_VERSION="`${CC} --version 2>/dev/null | sed -e '2,$d' -e 's/^.*(GCC[^)]*) //' -e 's/^.*(Debian[^)]*) //' -e 's/^[^0-9.]*//' -e 's/[^0-9.].*//'`" - test -z "$GCC_VERSION" && GCC_VERSION=unknown -- echo "$as_me:1886: result: $GCC_VERSION" >&5 -+ echo "$as_me:1697: result: $GCC_VERSION" >&5 - echo "${ECHO_T}$GCC_VERSION" >&6 - fi - --ac_ext=c --ac_cpp='$CPP $CPPFLAGS' --ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' --ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' --ac_compiler_gnu=$ac_cv_c_compiler_gnu --ac_main_return=return --echo "$as_me:1896: checking how to run the C preprocessor" >&5 --echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 --# On Suns, sometimes $CPP names a directory. --if test -n "$CPP" && test -d "$CPP"; then -- CPP= --fi --if test -z "$CPP"; then -- if test "${ac_cv_prog_CPP+set}" = set; then -+echo "$as_me:1701: checking for $CC option to accept ANSI C" >&5 -+echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 -+if test "${ac_cv_prog_cc_stdc+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else -- # Double quotes because CPP needs to be expanded -- for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" -- do -- ac_preproc_ok=false --for ac_c_preproc_warn_flag in '' yes --do -- # Use a header file that comes with gcc, so configuring glibc -- # with a fresh cross-compiler works. -- # On the NeXT, cc -E runs the code through the compiler's parser, -- # not just through cpp. "Syntax error" is here to catch this case. -- cat >conftest.$ac_ext <<_ACEOF --#line 1917 "configure" -+ ac_cv_prog_cc_stdc=no -+ac_save_CC=$CC -+cat >conftest.$ac_ext <<_ACEOF -+#line 1709 "configure" - #include "confdefs.h" --#include -- Syntax error -+#include -+#include -+#include -+#include -+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ -+struct buf { int x; }; -+FILE * (*rcsopen) (struct buf *, struct stat *, int); -+static char *e (p, i) -+ char **p; -+ int i; -+{ -+ return p[i]; -+} -+static char *f (char * (*g) (char **, int), char **p, ...) -+{ -+ char *s; -+ va_list v; -+ va_start (v,p); -+ s = g (p, va_arg (v,int)); -+ va_end (v); -+ return s; -+} -+int test (int i, double x); -+struct s1 {int (*f) (int a);}; -+struct s2 {int (*f) (double a);}; -+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); -+int argc; -+char **argv; -+int -+main () -+{ -+return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; -+ ; -+ return 0; -+} - _ACEOF --if { (eval echo "$as_me:1922: \"$ac_cpp conftest.$ac_ext\"") >&5 -- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 -+# Don't try gcc -ansi; that turns off useful extensions and -+# breaks some systems' header files. -+# AIX -qlanglvl=ansi -+# Ultrix and OSF/1 -std1 -+# HP-UX 10.20 and later -Ae -+# HP-UX older versions -Aa -D_HPUX_SOURCE -+# SVR4 -Xc -D__EXTENSIONS__ -+for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" -+do -+ CC="$ac_save_CC $ac_arg" -+ rm -f conftest.$ac_objext -+if { (eval echo "$as_me:1758: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>&5 - ac_status=$? -- egrep -v '^ *\+' conftest.er1 >conftest.err -- rm -f conftest.er1 -- cat conftest.err >&5 -- echo "$as_me:1928: \$? = $ac_status" >&5 -- (exit $ac_status); } >/dev/null; then -- if test -s conftest.err; then -- ac_cpp_err=$ac_c_preproc_warn_flag -- else -- ac_cpp_err= -- fi --else -- ac_cpp_err=yes --fi --if test -z "$ac_cpp_err"; then -- : -+ echo "$as_me:1761: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:1764: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:1767: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ ac_cv_prog_cc_stdc=$ac_arg -+break - else - echo "$as_me: failed program was:" >&5 -- cat conftest.$ac_ext >&5 -- # Broken: fails on valid input. -+cat conftest.$ac_ext >&5 -+fi -+rm -f conftest.$ac_objext -+done -+rm -f conftest.$ac_ext conftest.$ac_objext -+CC=$ac_save_CC -+ -+fi -+ -+case "x$ac_cv_prog_cc_stdc" in -+ x|xno) -+ echo "$as_me:1784: result: none needed" >&5 -+echo "${ECHO_T}none needed" >&6 ;; -+ *) -+ echo "$as_me:1787: result: $ac_cv_prog_cc_stdc" >&5 -+echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 -+ CC="$CC $ac_cv_prog_cc_stdc" ;; -+esac -+ -+# This should have been defined by AC_PROG_CC -+: ${CC:=cc} -+ -+echo "$as_me:1795: checking \$CC variable" >&5 -+echo $ECHO_N "checking \$CC variable... $ECHO_C" >&6 -+case "$CC" in #(vi -+*[\ \ ]-[IUD]*) -+ echo "$as_me:1799: result: broken" >&5 -+echo "${ECHO_T}broken" >&6 -+ { echo "$as_me:1801: WARNING: your environment misuses the CC variable to hold CFLAGS/CPPFLAGS options" >&5 -+echo "$as_me: WARNING: your environment misuses the CC variable to hold CFLAGS/CPPFLAGS options" >&2;} -+ # humor him... -+ cf_flags=`echo "$CC" | sed -e 's/^[^ ]*[ ]//'` -+ CC=`echo "$CC" | sed -e 's/[ ].*//'` -+ -+cf_fix_cppflags=no -+cf_new_cflags= -+cf_new_cppflags= -+cf_new_extra_cppflags= -+ -+for cf_add_cflags in $cf_flags -+do -+case $cf_fix_cppflags in -+no) -+ case $cf_add_cflags in #(vi -+ -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi -+ case $cf_add_cflags in -+ -D*) -+ cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` -+ -+ test "${cf_add_cflags}" != "${cf_tst_cflags}" \ -+ && test -z "${cf_tst_cflags}" \ -+ && cf_fix_cppflags=yes -+ -+ if test $cf_fix_cppflags = yes ; then -+ cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -+ continue -+ elif test "${cf_tst_cflags}" = "\"'" ; then -+ cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -+ continue -+ fi -+ ;; -+ esac -+ case "$CPPFLAGS" in -+ *$cf_add_cflags) #(vi -+ ;; -+ *) #(vi -+ case $cf_add_cflags in #(vi -+ -D*) -+ cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` -+ -+CPPFLAGS=`echo "$CPPFLAGS" | \ -+ sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ -+ -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` -+ -+ ;; -+ esac -+ cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" -+ ;; -+ esac -+ ;; -+ *) -+ cf_new_cflags="$cf_new_cflags $cf_add_cflags" -+ ;; -+ esac -+ ;; -+yes) -+ cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -+ -+ cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` -+ -+ test "${cf_add_cflags}" != "${cf_tst_cflags}" \ -+ && test -z "${cf_tst_cflags}" \ -+ && cf_fix_cppflags=no -+ ;; -+esac -+done -+ -+if test -n "$cf_new_cflags" ; then -+ -+ CFLAGS="$CFLAGS $cf_new_cflags" -+fi -+ -+if test -n "$cf_new_cppflags" ; then -+ -+ CPPFLAGS="$CPPFLAGS $cf_new_cppflags" -+fi -+ -+if test -n "$cf_new_extra_cppflags" ; then -+ -+ EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" -+fi -+ -+ ;; -+*) -+ echo "$as_me:1887: result: ok" >&5 -+echo "${ECHO_T}ok" >&6 -+ ;; -+esac -+ -+ac_ext=c -+ac_cpp='$CPP $CPPFLAGS' -+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -+ac_compiler_gnu=$ac_cv_c_compiler_gnu -+ac_main_return=return -+echo "$as_me:1898: checking how to run the C preprocessor" >&5 -+echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 -+# On Suns, sometimes $CPP names a directory. -+if test -n "$CPP" && test -d "$CPP"; then -+ CPP= -+fi -+if test -z "$CPP"; then -+ if test "${ac_cv_prog_CPP+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ # Double quotes because CPP needs to be expanded -+ for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" -+ do -+ ac_preproc_ok=false -+for ac_c_preproc_warn_flag in '' yes -+do -+ # Use a header file that comes with gcc, so configuring glibc -+ # with a fresh cross-compiler works. -+ # On the NeXT, cc -E runs the code through the compiler's parser, -+ # not just through cpp. "Syntax error" is here to catch this case. -+ cat >conftest.$ac_ext <<_ACEOF -+#line 1919 "configure" -+#include "confdefs.h" -+#include -+ Syntax error -+_ACEOF -+if { (eval echo "$as_me:1924: \"$ac_cpp conftest.$ac_ext\"") >&5 -+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 -+ ac_status=$? -+ egrep -v '^ *\+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 -+ echo "$as_me:1930: \$? = $ac_status" >&5 -+ (exit $ac_status); } >/dev/null; then -+ if test -s conftest.err; then -+ ac_cpp_err=$ac_c_preproc_warn_flag -+ else -+ ac_cpp_err= -+ fi -+else -+ ac_cpp_err=yes -+fi -+if test -z "$ac_cpp_err"; then -+ : -+else -+ echo "$as_me: failed program was:" >&5 -+ cat conftest.$ac_ext >&5 -+ # Broken: fails on valid input. - continue - fi - rm -f conftest.err conftest.$ac_ext -@@ -1948,17 +1950,17 @@ - # OK, works on sane cases. Now check whether non-existent headers - # can be detected and how. - cat >conftest.$ac_ext <<_ACEOF --#line 1951 "configure" -+#line 1953 "configure" - #include "confdefs.h" - #include - _ACEOF --if { (eval echo "$as_me:1955: \"$ac_cpp conftest.$ac_ext\"") >&5 -+if { (eval echo "$as_me:1957: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 -- echo "$as_me:1961: \$? = $ac_status" >&5 -+ echo "$as_me:1963: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag -@@ -1995,7 +1997,7 @@ - else - ac_cv_prog_CPP=$CPP - fi --echo "$as_me:1998: result: $CPP" >&5 -+echo "$as_me:2000: result: $CPP" >&5 - echo "${ECHO_T}$CPP" >&6 - ac_preproc_ok=false - for ac_c_preproc_warn_flag in '' yes -@@ -2005,18 +2007,18 @@ - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat >conftest.$ac_ext <<_ACEOF --#line 2008 "configure" -+#line 2010 "configure" - #include "confdefs.h" - #include - Syntax error - _ACEOF --if { (eval echo "$as_me:2013: \"$ac_cpp conftest.$ac_ext\"") >&5 -+if { (eval echo "$as_me:2015: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 -- echo "$as_me:2019: \$? = $ac_status" >&5 -+ echo "$as_me:2021: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag -@@ -2039,17 +2041,17 @@ - # OK, works on sane cases. Now check whether non-existent headers - # can be detected and how. - cat >conftest.$ac_ext <<_ACEOF --#line 2042 "configure" -+#line 2044 "configure" - #include "confdefs.h" - #include - _ACEOF --if { (eval echo "$as_me:2046: \"$ac_cpp conftest.$ac_ext\"") >&5 -+if { (eval echo "$as_me:2048: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 -- echo "$as_me:2052: \$? = $ac_status" >&5 -+ echo "$as_me:2054: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag -@@ -2077,7 +2079,7 @@ - if $ac_preproc_ok; then - : - else -- { { echo "$as_me:2080: error: C preprocessor \"$CPP\" fails sanity check" >&5 -+ { { echo "$as_me:2082: error: C preprocessor \"$CPP\" fails sanity check" >&5 - echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check" >&2;} - { (exit 1); exit 1; }; } - fi -@@ -2090,14 +2092,14 @@ - ac_main_return=return - - if test $ac_cv_c_compiler_gnu = yes; then -- echo "$as_me:2093: checking whether $CC needs -traditional" >&5 -+ echo "$as_me:2095: checking whether $CC needs -traditional" >&5 - echo $ECHO_N "checking whether $CC needs -traditional... $ECHO_C" >&6 - if test "${ac_cv_prog_gcc_traditional+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - ac_pattern="Autoconf.*'x'" - cat >conftest.$ac_ext <<_ACEOF --#line 2100 "configure" -+#line 2102 "configure" - #include "confdefs.h" - #include - int Autoconf = TIOCGETP; -@@ -2112,7 +2114,7 @@ - - if test $ac_cv_prog_gcc_traditional = no; then - cat >conftest.$ac_ext <<_ACEOF --#line 2115 "configure" -+#line 2117 "configure" - #include "confdefs.h" - #include - int Autoconf = TCGETA; -@@ -2125,14 +2127,14 @@ - - fi - fi --echo "$as_me:2128: result: $ac_cv_prog_gcc_traditional" >&5 -+echo "$as_me:2130: result: $ac_cv_prog_gcc_traditional" >&5 - echo "${ECHO_T}$ac_cv_prog_gcc_traditional" >&6 - if test $ac_cv_prog_gcc_traditional = yes; then - CC="$CC -traditional" - fi - fi - --echo "$as_me:2135: checking whether $CC understands -c and -o together" >&5 -+echo "$as_me:2137: checking whether $CC understands -c and -o together" >&5 - echo $ECHO_N "checking whether $CC understands -c and -o together... $ECHO_C" >&6 - if test "${cf_cv_prog_CC_c_o+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -2148,15 +2150,15 @@ - # We do the test twice because some compilers refuse to overwrite an - # existing .o file with -o, though they will create one. - ac_try='$CC -c conftest.$ac_ext -o conftest2.$ac_objext >&5' --if { (eval echo "$as_me:2151: \"$ac_try\"") >&5 -+if { (eval echo "$as_me:2153: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:2154: \$? = $ac_status" >&5 -+ echo "$as_me:2156: \$? = $ac_status" >&5 - (exit $ac_status); } && -- test -f conftest2.$ac_objext && { (eval echo "$as_me:2156: \"$ac_try\"") >&5 -+ test -f conftest2.$ac_objext && { (eval echo "$as_me:2158: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:2159: \$? = $ac_status" >&5 -+ echo "$as_me:2161: \$? = $ac_status" >&5 - (exit $ac_status); }; - then - eval cf_cv_prog_CC_c_o=yes -@@ -2167,307 +2169,13 @@ - - fi - if test $cf_cv_prog_CC_c_o = yes; then -- echo "$as_me:2170: result: yes" >&5 -+ echo "$as_me:2172: result: yes" >&5 - echo "${ECHO_T}yes" >&6 - else -- echo "$as_me:2173: result: no" >&5 -+ echo "$as_me:2175: result: no" >&5 - echo "${ECHO_T}no" >&6 - fi - --echo "$as_me:2177: checking for POSIXized ISC" >&5 --echo $ECHO_N "checking for POSIXized ISC... $ECHO_C" >&6 --if test -d /etc/conf/kconfig.d && -- grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1 --then -- echo "$as_me:2182: result: yes" >&5 --echo "${ECHO_T}yes" >&6 -- ISC=yes # If later tests want to check for ISC. -- --cat >>confdefs.h <<\EOF --#define _POSIX_SOURCE 1 --EOF -- -- if test "$GCC" = yes; then -- CC="$CC -posix" -- else -- CC="$CC -Xp" -- fi --else -- echo "$as_me:2196: result: no" >&5 --echo "${ECHO_T}no" >&6 -- ISC= --fi -- --echo "$as_me:2201: checking for ${CC:-cc} option to accept ANSI C" >&5 --echo $ECHO_N "checking for ${CC:-cc} option to accept ANSI C... $ECHO_C" >&6 --if test "${cf_cv_ansi_cc+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 --else -- --cf_cv_ansi_cc=no --cf_save_CFLAGS="$CFLAGS" --cf_save_CPPFLAGS="$CPPFLAGS" --# Don't try gcc -ansi; that turns off useful extensions and --# breaks some systems' header files. --# AIX -qlanglvl=ansi --# Ultrix and OSF/1 -std1 --# HP-UX -Aa -D_HPUX_SOURCE --# SVR4 -Xc --# UnixWare 1.2 (cannot use -Xc, since ANSI/POSIX clashes) --for cf_arg in "-DCC_HAS_PROTOS" \ -- "" \ -- -qlanglvl=ansi \ -- -std1 \ -- -Ae \ -- "-Aa -D_HPUX_SOURCE" \ -- -Xc --do -- --cf_fix_cppflags=no --cf_new_cflags= --cf_new_cppflags= --cf_new_extra_cppflags= -- --for cf_add_cflags in $cf_arg --do --case $cf_fix_cppflags in --no) -- case $cf_add_cflags in #(vi -- -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi -- case $cf_add_cflags in -- -D*) -- cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` -- -- test "${cf_add_cflags}" != "${cf_tst_cflags}" \ -- && test -z "${cf_tst_cflags}" \ -- && cf_fix_cppflags=yes -- -- if test $cf_fix_cppflags = yes ; then -- cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -- continue -- elif test "${cf_tst_cflags}" = "\"'" ; then -- cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -- continue -- fi -- ;; -- esac -- case "$CPPFLAGS" in -- *$cf_add_cflags) #(vi -- ;; -- *) #(vi -- case $cf_add_cflags in #(vi -- -D*) -- cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` -- --CPPFLAGS=`echo "$CPPFLAGS" | \ -- sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ -- -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` -- -- ;; -- esac -- cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" -- ;; -- esac -- ;; -- *) -- cf_new_cflags="$cf_new_cflags $cf_add_cflags" -- ;; -- esac -- ;; --yes) -- cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -- -- cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` -- -- test "${cf_add_cflags}" != "${cf_tst_cflags}" \ -- && test -z "${cf_tst_cflags}" \ -- && cf_fix_cppflags=no -- ;; --esac --done -- --if test -n "$cf_new_cflags" ; then -- -- CFLAGS="$CFLAGS $cf_new_cflags" --fi -- --if test -n "$cf_new_cppflags" ; then -- -- CPPFLAGS="$CPPFLAGS $cf_new_cppflags" --fi -- --if test -n "$cf_new_extra_cppflags" ; then -- -- EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" --fi -- -- cat >conftest.$ac_ext <<_ACEOF --#line 2305 "configure" --#include "confdefs.h" -- --#ifndef CC_HAS_PROTOS --#if !defined(__STDC__) || (__STDC__ != 1) --choke me --#endif --#endif -- --int --main () --{ -- -- int test (int i, double x); -- struct s1 {int (*f) (int a);}; -- struct s2 {int (*f) (double a);}; -- ; -- return 0; --} --_ACEOF --rm -f conftest.$ac_objext --if { (eval echo "$as_me:2326: \"$ac_compile\"") >&5 -- (eval $ac_compile) 2>&5 -- ac_status=$? -- echo "$as_me:2329: \$? = $ac_status" >&5 -- (exit $ac_status); } && -- { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:2332: \"$ac_try\"") >&5 -- (eval $ac_try) 2>&5 -- ac_status=$? -- echo "$as_me:2335: \$? = $ac_status" >&5 -- (exit $ac_status); }; }; then -- cf_cv_ansi_cc="$cf_arg"; break --else -- echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 --fi --rm -f conftest.$ac_objext conftest.$ac_ext --done --CFLAGS="$cf_save_CFLAGS" --CPPFLAGS="$cf_save_CPPFLAGS" -- --fi --echo "$as_me:2348: result: $cf_cv_ansi_cc" >&5 --echo "${ECHO_T}$cf_cv_ansi_cc" >&6 -- --if test "$cf_cv_ansi_cc" != "no"; then --if test ".$cf_cv_ansi_cc" != ".-DCC_HAS_PROTOS"; then -- --cf_fix_cppflags=no --cf_new_cflags= --cf_new_cppflags= --cf_new_extra_cppflags= -- --for cf_add_cflags in $cf_cv_ansi_cc --do --case $cf_fix_cppflags in --no) -- case $cf_add_cflags in #(vi -- -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi -- case $cf_add_cflags in -- -D*) -- cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` -- -- test "${cf_add_cflags}" != "${cf_tst_cflags}" \ -- && test -z "${cf_tst_cflags}" \ -- && cf_fix_cppflags=yes -- -- if test $cf_fix_cppflags = yes ; then -- cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -- continue -- elif test "${cf_tst_cflags}" = "\"'" ; then -- cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -- continue -- fi -- ;; -- esac -- case "$CPPFLAGS" in -- *$cf_add_cflags) #(vi -- ;; -- *) #(vi -- case $cf_add_cflags in #(vi -- -D*) -- cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` -- --CPPFLAGS=`echo "$CPPFLAGS" | \ -- sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ -- -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` -- -- ;; -- esac -- cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" -- ;; -- esac -- ;; -- *) -- cf_new_cflags="$cf_new_cflags $cf_add_cflags" -- ;; -- esac -- ;; --yes) -- cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -- -- cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` -- -- test "${cf_add_cflags}" != "${cf_tst_cflags}" \ -- && test -z "${cf_tst_cflags}" \ -- && cf_fix_cppflags=no -- ;; --esac --done -- --if test -n "$cf_new_cflags" ; then -- -- CFLAGS="$CFLAGS $cf_new_cflags" --fi -- --if test -n "$cf_new_cppflags" ; then -- -- CPPFLAGS="$CPPFLAGS $cf_new_cppflags" --fi -- --if test -n "$cf_new_extra_cppflags" ; then -- -- EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" --fi -- --else -- cat >>confdefs.h <<\EOF --#define CC_HAS_PROTOS 1 --EOF -- --fi --fi -- --if test "$cf_cv_ansi_cc" = "no"; then -- { { echo "$as_me:2441: error: Your compiler does not appear to recognize prototypes. --You have the following choices: -- a. adjust your compiler options -- b. get an up-to-date compiler -- c. use a wrapper such as unproto" >&5 --echo "$as_me: error: Your compiler does not appear to recognize prototypes. --You have the following choices: -- a. adjust your compiler options -- b. get an up-to-date compiler -- c. use a wrapper such as unproto" >&2;} -- { (exit 1); exit 1; }; } --fi -- --case $cf_cv_system_name in --os2*) -- CFLAGS="$CFLAGS -Zmt" -- CPPFLAGS="$CPPFLAGS -D__ST_MT_ERRNO__" -- CXXFLAGS="$CXXFLAGS -Zmt" -- # autoconf's macro sets -Zexe and suffix both, which conflict:w -- LDFLAGS="$LDFLAGS -Zmt -Zcrtdll" -- ac_cv_exeext=.exe -- ;; --esac -- --PROG_EXT="$EXEEXT" -- --test -n "$PROG_EXT" && cat >>confdefs.h <&5 -+echo "$as_me:2196: checking for $ac_word" >&5 - echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 - if test "${ac_cv_prog_AWK+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -2500,7 +2208,7 @@ - test -z "$ac_dir" && ac_dir=. - $as_executable_p "$ac_dir/$ac_word" || continue - ac_cv_prog_AWK="$ac_prog" --echo "$as_me:2503: found $ac_dir/$ac_word" >&5 -+echo "$as_me:2211: found $ac_dir/$ac_word" >&5 - break - done - -@@ -2508,21 +2216,21 @@ - fi - AWK=$ac_cv_prog_AWK - if test -n "$AWK"; then -- echo "$as_me:2511: result: $AWK" >&5 -+ echo "$as_me:2219: result: $AWK" >&5 - echo "${ECHO_T}$AWK" >&6 - else -- echo "$as_me:2514: result: no" >&5 -+ echo "$as_me:2222: result: no" >&5 - echo "${ECHO_T}no" >&6 - fi - - test -n "$AWK" && break - done - --test -z "$AWK" && { { echo "$as_me:2521: error: No awk program found" >&5 -+test -z "$AWK" && { { echo "$as_me:2229: error: No awk program found" >&5 - echo "$as_me: error: No awk program found" >&2;} - { (exit 1); exit 1; }; } - --echo "$as_me:2525: checking for egrep" >&5 -+echo "$as_me:2233: checking for egrep" >&5 - echo $ECHO_N "checking for egrep... $ECHO_C" >&6 - if test "${ac_cv_prog_egrep+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -2532,11 +2240,11 @@ - else ac_cv_prog_egrep='egrep' - fi - fi --echo "$as_me:2535: result: $ac_cv_prog_egrep" >&5 -+echo "$as_me:2243: result: $ac_cv_prog_egrep" >&5 - echo "${ECHO_T}$ac_cv_prog_egrep" >&6 - EGREP=$ac_cv_prog_egrep - --test -z "$EGREP" && { { echo "$as_me:2539: error: No egrep program found" >&5 -+test -z "$EGREP" && { { echo "$as_me:2247: error: No egrep program found" >&5 - echo "$as_me: error: No egrep program found" >&2;} - { (exit 1); exit 1; }; } - -@@ -2552,7 +2260,7 @@ - # AFS /usr/afsws/bin/install, which mishandles nonexistent args - # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" - # ./install, which can be erroneously created by make from ./install.sh. --echo "$as_me:2555: checking for a BSD compatible install" >&5 -+echo "$as_me:2263: checking for a BSD compatible install" >&5 - echo $ECHO_N "checking for a BSD compatible install... $ECHO_C" >&6 - if test -z "$INSTALL"; then - if test "${ac_cv_path_install+set}" = set; then -@@ -2601,7 +2309,7 @@ - INSTALL=$ac_install_sh - fi - fi --echo "$as_me:2604: result: $INSTALL" >&5 -+echo "$as_me:2312: result: $INSTALL" >&5 - echo "${ECHO_T}$INSTALL" >&6 - - # Use test -z because SunOS4 sh mishandles braces in ${var-val}. -@@ -2612,18 +2320,18 @@ - - test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' - --echo "$as_me:2615: checking whether ln -s works" >&5 -+echo "$as_me:2323: checking whether ln -s works" >&5 - echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6 - LN_S=$as_ln_s - if test "$LN_S" = "ln -s"; then -- echo "$as_me:2619: result: yes" >&5 -+ echo "$as_me:2327: result: yes" >&5 - echo "${ECHO_T}yes" >&6 - else -- echo "$as_me:2622: result: no, using $LN_S" >&5 -+ echo "$as_me:2330: result: no, using $LN_S" >&5 - echo "${ECHO_T}no, using $LN_S" >&6 - fi - --echo "$as_me:2626: checking if $LN_S -f options work" >&5 -+echo "$as_me:2334: checking if $LN_S -f options work" >&5 - echo $ECHO_N "checking if $LN_S -f options work... $ECHO_C" >&6 - - rm -f conf$$.src conf$$dst -@@ -2635,12 +2343,12 @@ - cf_prog_ln_sf=no - fi - rm -f conf$$.dst conf$$src --echo "$as_me:2638: result: $cf_prog_ln_sf" >&5 -+echo "$as_me:2346: result: $cf_prog_ln_sf" >&5 - echo "${ECHO_T}$cf_prog_ln_sf" >&6 - - test "$cf_prog_ln_sf" = yes && LN_S="$LN_S -f" - --echo "$as_me:2643: checking for long file names" >&5 -+echo "$as_me:2351: checking for long file names" >&5 - echo $ECHO_N "checking for long file names... $ECHO_C" >&6 - if test "${ac_cv_sys_long_file_names+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -2679,7 +2387,7 @@ - rm -rf $ac_xdir 2>/dev/null - done - fi --echo "$as_me:2682: result: $ac_cv_sys_long_file_names" >&5 -+echo "$as_me:2390: result: $ac_cv_sys_long_file_names" >&5 - echo "${ECHO_T}$ac_cv_sys_long_file_names" >&6 - if test $ac_cv_sys_long_file_names = yes; then - -@@ -2691,7 +2399,7 @@ - - # if we find pkg-config, check if we should install the ".pc" files. - --echo "$as_me:2694: checking if you want to use pkg-config" >&5 -+echo "$as_me:2402: checking if you want to use pkg-config" >&5 - echo $ECHO_N "checking if you want to use pkg-config... $ECHO_C" >&6 - - # Check whether --with-pkg-config or --without-pkg-config was given. -@@ -2701,7 +2409,7 @@ - else - cf_pkg_config=yes - fi; --echo "$as_me:2704: result: $cf_pkg_config" >&5 -+echo "$as_me:2412: result: $cf_pkg_config" >&5 - echo "${ECHO_T}$cf_pkg_config" >&6 - - case $cf_pkg_config in #(vi -@@ -2709,10 +2417,11 @@ - PKG_CONFIG=none - ;; - yes) #(vi -- if test -n "$ac_tool_prefix"; then -+ -+if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. - set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 --echo "$as_me:2715: checking for $ac_word" >&5 -+echo "$as_me:2424: checking for $ac_word" >&5 - echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 - if test "${ac_cv_path_PKG_CONFIG+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -2729,7 +2438,7 @@ - test -z "$ac_dir" && ac_dir=. - if $as_executable_p "$ac_dir/$ac_word"; then - ac_cv_path_PKG_CONFIG="$ac_dir/$ac_word" -- echo "$as_me:2732: found $ac_dir/$ac_word" >&5 -+ echo "$as_me:2441: found $ac_dir/$ac_word" >&5 - break - fi - done -@@ -2740,10 +2449,10 @@ - PKG_CONFIG=$ac_cv_path_PKG_CONFIG - - if test -n "$PKG_CONFIG"; then -- echo "$as_me:2743: result: $PKG_CONFIG" >&5 -+ echo "$as_me:2452: result: $PKG_CONFIG" >&5 - echo "${ECHO_T}$PKG_CONFIG" >&6 - else -- echo "$as_me:2746: result: no" >&5 -+ echo "$as_me:2455: result: no" >&5 - echo "${ECHO_T}no" >&6 - fi - -@@ -2752,7 +2461,7 @@ - ac_pt_PKG_CONFIG=$PKG_CONFIG - # Extract the first word of "pkg-config", so it can be a program name with args. - set dummy pkg-config; ac_word=$2 --echo "$as_me:2755: checking for $ac_word" >&5 -+echo "$as_me:2464: checking for $ac_word" >&5 - echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 - if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -2769,7 +2478,7 @@ - test -z "$ac_dir" && ac_dir=. - if $as_executable_p "$ac_dir/$ac_word"; then - ac_cv_path_ac_pt_PKG_CONFIG="$ac_dir/$ac_word" -- echo "$as_me:2772: found $ac_dir/$ac_word" >&5 -+ echo "$as_me:2481: found $ac_dir/$ac_word" >&5 - break - fi - done -@@ -2781,10 +2490,10 @@ - ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG - - if test -n "$ac_pt_PKG_CONFIG"; then -- echo "$as_me:2784: result: $ac_pt_PKG_CONFIG" >&5 -+ echo "$as_me:2493: result: $ac_pt_PKG_CONFIG" >&5 - echo "${ECHO_T}$ac_pt_PKG_CONFIG" >&6 - else -- echo "$as_me:2787: result: no" >&5 -+ echo "$as_me:2496: result: no" >&5 - echo "${ECHO_T}no" >&6 - fi - -@@ -2815,7 +2524,7 @@ - ;; - .[a-zA-Z]:[\\/]*) #(vi OS/2 EMX - ;; --.\${*prefix}*) #(vi -+.\${*prefix}*|.\${*dir}*) #(vi - eval PKG_CONFIG="$PKG_CONFIG" - case ".$PKG_CONFIG" in #(vi - .NONE/*) -@@ -2827,7 +2536,7 @@ - PKG_CONFIG=`echo $PKG_CONFIG | sed -e s%NONE%$cf_path_syntax%` - ;; - *) -- { { echo "$as_me:2830: error: expected a pathname, not \"$PKG_CONFIG\"" >&5 -+ { { echo "$as_me:2539: error: expected a pathname, not \"$PKG_CONFIG\"" >&5 - echo "$as_me: error: expected a pathname, not \"$PKG_CONFIG\"" >&2;} - { (exit 1); exit 1; }; } - ;; -@@ -2836,15 +2545,50 @@ - fi - - if test "$PKG_CONFIG" != none ; then -- echo "$as_me:2839: checking if we should install .pc files for $PKG_CONFIG" >&5 --echo $ECHO_N "checking if we should install .pc files for $PKG_CONFIG... $ECHO_C" >&6 -+ echo "$as_me:2548: checking for $PKG_CONFIG library directory" >&5 -+echo $ECHO_N "checking for $PKG_CONFIG library directory... $ECHO_C" >&6 - -- # Leave this as something that can be overridden in the environment. -- if test -z "$PKG_CONFIG_LIBDIR" ; then -- PKG_CONFIG_LIBDIR=`echo "$PKG_CONFIG" | sed -e 's,/[^/]*/[^/]*$,,'`/lib/pkgconfig -- fi -- PKG_CONFIG_LIBDIR=`echo "$PKG_CONFIG_LIBDIR" | sed -e 's/^://' -e 's/:.*//'` -- if test -n "$PKG_CONFIG_LIBDIR" && test -d "$PKG_CONFIG_LIBDIR" ; then -+# Check whether --with-pkg-config-libdir or --without-pkg-config-libdir was given. -+if test "${with_pkg_config_libdir+set}" = set; then -+ withval="$with_pkg_config_libdir" -+ PKG_CONFIG_LIBDIR=$withval -+else -+ PKG_CONFIG_LIBDIR=yes -+fi; -+ -+ case x$PKG_CONFIG_LIBDIR in #(vi -+ x/*) #(vi -+ ;; -+ xyes) #(vi -+ # look for the library directory using the same prefix as the executable -+ cf_path=`echo "$PKG_CONFIG" | sed -e 's,/[^/]*/[^/]*$,,'` -+ case x`(arch) 2>/dev/null` in #(vi -+ *64) #(vi -+ for cf_config in $cf_path/share $cf_path/lib64 $cf_path/lib32 $cf_path/lib -+ do -+ if test -d $cf_config/pkgconfig -+ then -+ PKG_CONFIG_LIBDIR=$cf_config/pkgconfig -+ break -+ fi -+ done -+ ;; -+ *) -+ PKG_CONFIG_LIBDIR=$cf_path/lib/pkgconfig -+ ;; -+ esac -+ ;; -+ *) -+ ;; -+ esac -+ -+ echo "$as_me:2585: result: $PKG_CONFIG_LIBDIR" >&5 -+echo "${ECHO_T}$PKG_CONFIG_LIBDIR" >&6 -+fi -+ -+if test "$PKG_CONFIG" != none ; then -+ echo "$as_me:2590: checking if we should install .pc files for $PKG_CONFIG" >&5 -+echo $ECHO_N "checking if we should install .pc files for $PKG_CONFIG... $ECHO_C" >&6 - - # Check whether --enable-pc-files or --disable-pc-files was given. - if test "${enable_pc_files+set}" = set; then -@@ -2853,18 +2597,48 @@ - else - enable_pc_files=no - fi; -- echo "$as_me:2856: result: $enable_pc_files" >&5 -+ echo "$as_me:2600: result: $enable_pc_files" >&5 - echo "${ECHO_T}$enable_pc_files" >&6 -- else -- echo "$as_me:2859: result: no" >&5 --echo "${ECHO_T}no" >&6 -- { echo "$as_me:2861: WARNING: did not find library $PKG_CONFIG_LIBDIR" >&5 --echo "$as_me: WARNING: did not find library $PKG_CONFIG_LIBDIR" >&2;} -- enable_pc_files=no -+ if test "$enable_pc_files" != no -+ then -+ -+if test "x$prefix" != xNONE; then -+ cf_path_syntax="$prefix" -+else -+ cf_path_syntax="$ac_default_prefix" -+fi -+ -+case ".$PKG_CONFIG_LIBDIR" in #(vi -+.\$\(*\)*|.\'*\'*) #(vi -+ ;; -+..|./*|.\\*) #(vi -+ ;; -+.[a-zA-Z]:[\\/]*) #(vi OS/2 EMX -+ ;; -+.\${*prefix}*|.\${*dir}*) #(vi -+ eval PKG_CONFIG_LIBDIR="$PKG_CONFIG_LIBDIR" -+ case ".$PKG_CONFIG_LIBDIR" in #(vi -+ .NONE/*) -+ PKG_CONFIG_LIBDIR=`echo $PKG_CONFIG_LIBDIR | sed -e s%NONE%$cf_path_syntax%` -+ ;; -+ esac -+ ;; #(vi -+.no|.NONE/*) -+ PKG_CONFIG_LIBDIR=`echo $PKG_CONFIG_LIBDIR | sed -e s%NONE%$cf_path_syntax%` -+ ;; -+*) -+ { { echo "$as_me:2630: error: expected a pathname, not \"$PKG_CONFIG_LIBDIR\"" >&5 -+echo "$as_me: error: expected a pathname, not \"$PKG_CONFIG_LIBDIR\"" >&2;} -+ { (exit 1); exit 1; }; } -+ ;; -+esac -+ - fi -+else -+ enable_pc_files=no - fi - --echo "$as_me:2867: checking if you want to build test-programs" >&5 -+echo "$as_me:2641: checking if you want to build test-programs" >&5 - echo $ECHO_N "checking if you want to build test-programs... $ECHO_C" >&6 - - # Check whether --with-tests or --without-tests was given. -@@ -2874,10 +2648,10 @@ - else - cf_with_tests=yes - fi; --echo "$as_me:2877: result: $cf_with_tests" >&5 -+echo "$as_me:2651: result: $cf_with_tests" >&5 - echo "${ECHO_T}$cf_with_tests" >&6 - --echo "$as_me:2880: checking if we should assume mixed-case filenames" >&5 -+echo "$as_me:2654: checking if we should assume mixed-case filenames" >&5 - echo $ECHO_N "checking if we should assume mixed-case filenames... $ECHO_C" >&6 - - # Check whether --enable-mixed-case or --disable-mixed-case was given. -@@ -2887,11 +2661,11 @@ - else - enable_mixedcase=auto - fi; --echo "$as_me:2890: result: $enable_mixedcase" >&5 -+echo "$as_me:2664: result: $enable_mixedcase" >&5 - echo "${ECHO_T}$enable_mixedcase" >&6 - if test "$enable_mixedcase" = "auto" ; then - --echo "$as_me:2894: checking if filesystem supports mixed-case filenames" >&5 -+echo "$as_me:2668: checking if filesystem supports mixed-case filenames" >&5 - echo $ECHO_N "checking if filesystem supports mixed-case filenames... $ECHO_C" >&6 - if test "${cf_cv_mixedcase+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -2899,7 +2673,7 @@ - - if test "$cross_compiling" = yes ; then - case $target_alias in #(vi -- *-os2-emx*|*-msdosdjgpp*|*-cygwin*|*-mingw32*|*-uwin*) #(vi -+ *-os2-emx*|*-msdosdjgpp*|*-cygwin*|*-msys*|*-mingw*|*-uwin*) #(vi - cf_cv_mixedcase=no - ;; - *) -@@ -2918,9 +2692,10 @@ - fi - - fi --echo "$as_me:2921: result: $cf_cv_mixedcase" >&5 -+echo "$as_me:2695: result: $cf_cv_mixedcase" >&5 - echo "${ECHO_T}$cf_cv_mixedcase" >&6 --test "$cf_cv_mixedcase" = yes && cat >>confdefs.h <<\EOF -+test "$cf_cv_mixedcase" = yes && -+cat >>confdefs.h <<\EOF - #define MIXEDCASE_FILENAMES 1 - EOF - -@@ -2935,7 +2710,7 @@ - fi - - # do this after mixed-case option (tags/TAGS is not as important as tic). --echo "$as_me:2938: checking whether ${MAKE-make} sets \${MAKE}" >&5 -+echo "$as_me:2713: checking whether ${MAKE-make} sets \${MAKE}" >&5 - echo $ECHO_N "checking whether ${MAKE-make} sets \${MAKE}... $ECHO_C" >&6 - set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,./+-,__p_,'` - if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then -@@ -2955,11 +2730,11 @@ - rm -f conftest.make - fi - if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then -- echo "$as_me:2958: result: yes" >&5 -+ echo "$as_me:2733: result: yes" >&5 - echo "${ECHO_T}yes" >&6 - SET_MAKE= - else -- echo "$as_me:2962: result: no" >&5 -+ echo "$as_me:2737: result: no" >&5 - echo "${ECHO_T}no" >&6 - SET_MAKE="MAKE=${MAKE-make}" - fi -@@ -2968,7 +2743,7 @@ - do - # Extract the first word of "$ac_prog", so it can be a program name with args. - set dummy $ac_prog; ac_word=$2 --echo "$as_me:2971: checking for $ac_word" >&5 -+echo "$as_me:2746: checking for $ac_word" >&5 - echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 - if test "${ac_cv_prog_CTAGS+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -2983,7 +2758,7 @@ - test -z "$ac_dir" && ac_dir=. - $as_executable_p "$ac_dir/$ac_word" || continue - ac_cv_prog_CTAGS="$ac_prog" --echo "$as_me:2986: found $ac_dir/$ac_word" >&5 -+echo "$as_me:2761: found $ac_dir/$ac_word" >&5 - break - done - -@@ -2991,10 +2766,10 @@ - fi - CTAGS=$ac_cv_prog_CTAGS - if test -n "$CTAGS"; then -- echo "$as_me:2994: result: $CTAGS" >&5 -+ echo "$as_me:2769: result: $CTAGS" >&5 - echo "${ECHO_T}$CTAGS" >&6 - else -- echo "$as_me:2997: result: no" >&5 -+ echo "$as_me:2772: result: no" >&5 - echo "${ECHO_T}no" >&6 - fi - -@@ -3005,7 +2780,7 @@ - do - # Extract the first word of "$ac_prog", so it can be a program name with args. - set dummy $ac_prog; ac_word=$2 --echo "$as_me:3008: checking for $ac_word" >&5 -+echo "$as_me:2783: checking for $ac_word" >&5 - echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 - if test "${ac_cv_prog_ETAGS+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -3020,7 +2795,7 @@ - test -z "$ac_dir" && ac_dir=. - $as_executable_p "$ac_dir/$ac_word" || continue - ac_cv_prog_ETAGS="$ac_prog" --echo "$as_me:3023: found $ac_dir/$ac_word" >&5 -+echo "$as_me:2798: found $ac_dir/$ac_word" >&5 - break - done - -@@ -3028,10 +2803,10 @@ - fi - ETAGS=$ac_cv_prog_ETAGS - if test -n "$ETAGS"; then -- echo "$as_me:3031: result: $ETAGS" >&5 -+ echo "$as_me:2806: result: $ETAGS" >&5 - echo "${ECHO_T}$ETAGS" >&6 - else -- echo "$as_me:3034: result: no" >&5 -+ echo "$as_me:2809: result: no" >&5 - echo "${ECHO_T}no" >&6 - fi - -@@ -3040,7 +2815,7 @@ - - # Extract the first word of "${CTAGS:-ctags}", so it can be a program name with args. - set dummy ${CTAGS:-ctags}; ac_word=$2 --echo "$as_me:3043: checking for $ac_word" >&5 -+echo "$as_me:2818: checking for $ac_word" >&5 - echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 - if test "${ac_cv_prog_MAKE_LOWER_TAGS+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -3055,7 +2830,7 @@ - test -z "$ac_dir" && ac_dir=. - $as_executable_p "$ac_dir/$ac_word" || continue - ac_cv_prog_MAKE_LOWER_TAGS="yes" --echo "$as_me:3058: found $ac_dir/$ac_word" >&5 -+echo "$as_me:2833: found $ac_dir/$ac_word" >&5 - break - done - -@@ -3064,17 +2839,17 @@ - fi - MAKE_LOWER_TAGS=$ac_cv_prog_MAKE_LOWER_TAGS - if test -n "$MAKE_LOWER_TAGS"; then -- echo "$as_me:3067: result: $MAKE_LOWER_TAGS" >&5 -+ echo "$as_me:2842: result: $MAKE_LOWER_TAGS" >&5 - echo "${ECHO_T}$MAKE_LOWER_TAGS" >&6 - else -- echo "$as_me:3070: result: no" >&5 -+ echo "$as_me:2845: result: no" >&5 - echo "${ECHO_T}no" >&6 - fi - - if test "$cf_cv_mixedcase" = yes ; then - # Extract the first word of "${ETAGS:-etags}", so it can be a program name with args. - set dummy ${ETAGS:-etags}; ac_word=$2 --echo "$as_me:3077: checking for $ac_word" >&5 -+echo "$as_me:2852: checking for $ac_word" >&5 - echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 - if test "${ac_cv_prog_MAKE_UPPER_TAGS+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -3089,7 +2864,7 @@ - test -z "$ac_dir" && ac_dir=. - $as_executable_p "$ac_dir/$ac_word" || continue - ac_cv_prog_MAKE_UPPER_TAGS="yes" --echo "$as_me:3092: found $ac_dir/$ac_word" >&5 -+echo "$as_me:2867: found $ac_dir/$ac_word" >&5 - break - done - -@@ -3098,10 +2873,10 @@ - fi - MAKE_UPPER_TAGS=$ac_cv_prog_MAKE_UPPER_TAGS - if test -n "$MAKE_UPPER_TAGS"; then -- echo "$as_me:3101: result: $MAKE_UPPER_TAGS" >&5 -+ echo "$as_me:2876: result: $MAKE_UPPER_TAGS" >&5 - echo "${ECHO_T}$MAKE_UPPER_TAGS" >&6 - else -- echo "$as_me:3104: result: no" >&5 -+ echo "$as_me:2879: result: no" >&5 - echo "${ECHO_T}no" >&6 - fi - -@@ -3121,7 +2896,7 @@ - MAKE_LOWER_TAGS="#" - fi - --echo "$as_me:3124: checking for makeflags variable" >&5 -+echo "$as_me:2899: checking for makeflags variable" >&5 - echo $ECHO_N "checking for makeflags variable... $ECHO_C" >&6 - if test "${cf_cv_makeflags+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -3155,13 +2930,13 @@ - rm -f cf_makeflags.tmp - - fi --echo "$as_me:3158: result: $cf_cv_makeflags" >&5 -+echo "$as_me:2933: result: $cf_cv_makeflags" >&5 - echo "${ECHO_T}$cf_cv_makeflags" >&6 - - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. - set dummy ${ac_tool_prefix}ranlib; ac_word=$2 --echo "$as_me:3164: checking for $ac_word" >&5 -+echo "$as_me:2939: checking for $ac_word" >&5 - echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 - if test "${ac_cv_prog_RANLIB+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -3176,7 +2951,7 @@ - test -z "$ac_dir" && ac_dir=. - $as_executable_p "$ac_dir/$ac_word" || continue - ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" --echo "$as_me:3179: found $ac_dir/$ac_word" >&5 -+echo "$as_me:2954: found $ac_dir/$ac_word" >&5 - break - done - -@@ -3184,10 +2959,10 @@ - fi - RANLIB=$ac_cv_prog_RANLIB - if test -n "$RANLIB"; then -- echo "$as_me:3187: result: $RANLIB" >&5 -+ echo "$as_me:2962: result: $RANLIB" >&5 - echo "${ECHO_T}$RANLIB" >&6 - else -- echo "$as_me:3190: result: no" >&5 -+ echo "$as_me:2965: result: no" >&5 - echo "${ECHO_T}no" >&6 - fi - -@@ -3196,7 +2971,7 @@ - ac_ct_RANLIB=$RANLIB - # Extract the first word of "ranlib", so it can be a program name with args. - set dummy ranlib; ac_word=$2 --echo "$as_me:3199: checking for $ac_word" >&5 -+echo "$as_me:2974: checking for $ac_word" >&5 - echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 - if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -3211,7 +2986,7 @@ - test -z "$ac_dir" && ac_dir=. - $as_executable_p "$ac_dir/$ac_word" || continue - ac_cv_prog_ac_ct_RANLIB="ranlib" --echo "$as_me:3214: found $ac_dir/$ac_word" >&5 -+echo "$as_me:2989: found $ac_dir/$ac_word" >&5 - break - done - -@@ -3220,10 +2995,10 @@ - fi - ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB - if test -n "$ac_ct_RANLIB"; then -- echo "$as_me:3223: result: $ac_ct_RANLIB" >&5 -+ echo "$as_me:2998: result: $ac_ct_RANLIB" >&5 - echo "${ECHO_T}$ac_ct_RANLIB" >&6 - else -- echo "$as_me:3226: result: no" >&5 -+ echo "$as_me:3001: result: no" >&5 - echo "${ECHO_T}no" >&6 - fi - -@@ -3235,7 +3010,7 @@ - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}ld", so it can be a program name with args. - set dummy ${ac_tool_prefix}ld; ac_word=$2 --echo "$as_me:3238: checking for $ac_word" >&5 -+echo "$as_me:3013: checking for $ac_word" >&5 - echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 - if test "${ac_cv_prog_LD+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -3250,7 +3025,7 @@ - test -z "$ac_dir" && ac_dir=. - $as_executable_p "$ac_dir/$ac_word" || continue - ac_cv_prog_LD="${ac_tool_prefix}ld" --echo "$as_me:3253: found $ac_dir/$ac_word" >&5 -+echo "$as_me:3028: found $ac_dir/$ac_word" >&5 - break - done - -@@ -3258,10 +3033,10 @@ - fi - LD=$ac_cv_prog_LD - if test -n "$LD"; then -- echo "$as_me:3261: result: $LD" >&5 -+ echo "$as_me:3036: result: $LD" >&5 - echo "${ECHO_T}$LD" >&6 - else -- echo "$as_me:3264: result: no" >&5 -+ echo "$as_me:3039: result: no" >&5 - echo "${ECHO_T}no" >&6 - fi - -@@ -3270,7 +3045,7 @@ - ac_ct_LD=$LD - # Extract the first word of "ld", so it can be a program name with args. - set dummy ld; ac_word=$2 --echo "$as_me:3273: checking for $ac_word" >&5 -+echo "$as_me:3048: checking for $ac_word" >&5 - echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 - if test "${ac_cv_prog_ac_ct_LD+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -3285,7 +3060,7 @@ - test -z "$ac_dir" && ac_dir=. - $as_executable_p "$ac_dir/$ac_word" || continue - ac_cv_prog_ac_ct_LD="ld" --echo "$as_me:3288: found $ac_dir/$ac_word" >&5 -+echo "$as_me:3063: found $ac_dir/$ac_word" >&5 - break - done - -@@ -3294,10 +3069,10 @@ - fi - ac_ct_LD=$ac_cv_prog_ac_ct_LD - if test -n "$ac_ct_LD"; then -- echo "$as_me:3297: result: $ac_ct_LD" >&5 -+ echo "$as_me:3072: result: $ac_ct_LD" >&5 - echo "${ECHO_T}$ac_ct_LD" >&6 - else -- echo "$as_me:3300: result: no" >&5 -+ echo "$as_me:3075: result: no" >&5 - echo "${ECHO_T}no" >&6 - fi - -@@ -3309,7 +3084,7 @@ - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. - set dummy ${ac_tool_prefix}ar; ac_word=$2 --echo "$as_me:3312: checking for $ac_word" >&5 -+echo "$as_me:3087: checking for $ac_word" >&5 - echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 - if test "${ac_cv_prog_AR+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -3324,7 +3099,7 @@ - test -z "$ac_dir" && ac_dir=. - $as_executable_p "$ac_dir/$ac_word" || continue - ac_cv_prog_AR="${ac_tool_prefix}ar" --echo "$as_me:3327: found $ac_dir/$ac_word" >&5 -+echo "$as_me:3102: found $ac_dir/$ac_word" >&5 - break - done - -@@ -3332,10 +3107,10 @@ - fi - AR=$ac_cv_prog_AR - if test -n "$AR"; then -- echo "$as_me:3335: result: $AR" >&5 -+ echo "$as_me:3110: result: $AR" >&5 - echo "${ECHO_T}$AR" >&6 - else -- echo "$as_me:3338: result: no" >&5 -+ echo "$as_me:3113: result: no" >&5 - echo "${ECHO_T}no" >&6 - fi - -@@ -3344,7 +3119,7 @@ - ac_ct_AR=$AR - # Extract the first word of "ar", so it can be a program name with args. - set dummy ar; ac_word=$2 --echo "$as_me:3347: checking for $ac_word" >&5 -+echo "$as_me:3122: checking for $ac_word" >&5 - echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 - if test "${ac_cv_prog_ac_ct_AR+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -3359,7 +3134,7 @@ - test -z "$ac_dir" && ac_dir=. - $as_executable_p "$ac_dir/$ac_word" || continue - ac_cv_prog_ac_ct_AR="ar" --echo "$as_me:3362: found $ac_dir/$ac_word" >&5 -+echo "$as_me:3137: found $ac_dir/$ac_word" >&5 - break - done - -@@ -3368,10 +3143,10 @@ - fi - ac_ct_AR=$ac_cv_prog_ac_ct_AR - if test -n "$ac_ct_AR"; then -- echo "$as_me:3371: result: $ac_ct_AR" >&5 -+ echo "$as_me:3146: result: $ac_ct_AR" >&5 - echo "${ECHO_T}$ac_ct_AR" >&6 - else -- echo "$as_me:3374: result: no" >&5 -+ echo "$as_me:3149: result: no" >&5 - echo "${ECHO_T}no" >&6 - fi - -@@ -3383,7 +3158,7 @@ - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. - set dummy ${ac_tool_prefix}ar; ac_word=$2 --echo "$as_me:3386: checking for $ac_word" >&5 -+echo "$as_me:3161: checking for $ac_word" >&5 - echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 - if test "${ac_cv_prog_AR+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -3398,7 +3173,7 @@ - test -z "$ac_dir" && ac_dir=. - $as_executable_p "$ac_dir/$ac_word" || continue - ac_cv_prog_AR="${ac_tool_prefix}ar" --echo "$as_me:3401: found $ac_dir/$ac_word" >&5 -+echo "$as_me:3176: found $ac_dir/$ac_word" >&5 - break - done - -@@ -3406,10 +3181,10 @@ - fi - AR=$ac_cv_prog_AR - if test -n "$AR"; then -- echo "$as_me:3409: result: $AR" >&5 -+ echo "$as_me:3184: result: $AR" >&5 - echo "${ECHO_T}$AR" >&6 - else -- echo "$as_me:3412: result: no" >&5 -+ echo "$as_me:3187: result: no" >&5 - echo "${ECHO_T}no" >&6 - fi - -@@ -3418,7 +3193,7 @@ - ac_ct_AR=$AR - # Extract the first word of "ar", so it can be a program name with args. - set dummy ar; ac_word=$2 --echo "$as_me:3421: checking for $ac_word" >&5 -+echo "$as_me:3196: checking for $ac_word" >&5 - echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 - if test "${ac_cv_prog_ac_ct_AR+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -3433,7 +3208,7 @@ - test -z "$ac_dir" && ac_dir=. - $as_executable_p "$ac_dir/$ac_word" || continue - ac_cv_prog_ac_ct_AR="ar" --echo "$as_me:3436: found $ac_dir/$ac_word" >&5 -+echo "$as_me:3211: found $ac_dir/$ac_word" >&5 - break - done - -@@ -3442,10 +3217,10 @@ - fi - ac_ct_AR=$ac_cv_prog_ac_ct_AR - if test -n "$ac_ct_AR"; then -- echo "$as_me:3445: result: $ac_ct_AR" >&5 -+ echo "$as_me:3220: result: $ac_ct_AR" >&5 - echo "${ECHO_T}$ac_ct_AR" >&6 - else -- echo "$as_me:3448: result: no" >&5 -+ echo "$as_me:3223: result: no" >&5 - echo "${ECHO_T}no" >&6 - fi - -@@ -3454,7 +3229,7 @@ - AR="$ac_cv_prog_AR" - fi - --echo "$as_me:3457: checking for options to update archives" >&5 -+echo "$as_me:3232: checking for options to update archives" >&5 - echo $ECHO_N "checking for options to update archives... $ECHO_C" >&6 - if test "${cf_cv_ar_flags+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -3477,13 +3252,13 @@ - rm -f conftest.a - - cat >conftest.$ac_ext <&5 -+ if { (eval echo "$as_me:3258: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:3486: \$? = $ac_status" >&5 -+ echo "$as_me:3261: \$? = $ac_status" >&5 - (exit $ac_status); } ; then - echo "$AR $ARFLAGS $cf_ar_flags conftest.a conftest.$ac_cv_objext" >&5 - $AR $ARFLAGS $cf_ar_flags conftest.a conftest.$ac_cv_objext 2>&5 1>/dev/null -@@ -3494,7 +3269,7 @@ - else - test -n "$verbose" && echo " cannot compile test-program" 1>&6 - --echo "${as_me:-configure}:3497: testing cannot compile test-program ..." 1>&5 -+echo "${as_me:-configure}:3272: testing cannot compile test-program ..." 1>&5 - - break - fi -@@ -3502,7 +3277,7 @@ - rm -f conftest.a conftest.$ac_ext conftest.$ac_cv_objext - - fi --echo "$as_me:3505: result: $cf_cv_ar_flags" >&5 -+echo "$as_me:3280: result: $cf_cv_ar_flags" >&5 - echo "${ECHO_T}$cf_cv_ar_flags" >&6 - - if test -n "$ARFLAGS" ; then -@@ -3513,7 +3288,17 @@ - ARFLAGS=$cf_cv_ar_flags - fi - --echo "$as_me:3516: checking if you have specified an install-prefix" >&5 -+ echo "$as_me:3291: checking for PATH separator" >&5 -+echo $ECHO_N "checking for PATH separator... $ECHO_C" >&6 -+ case $cf_cv_system_name in -+ os2*) PATH_SEPARATOR=';' ;; -+ *) ${PATH_SEPARATOR:=':'} ;; -+ esac -+ -+ echo "$as_me:3298: result: $PATH_SEPARATOR" >&5 -+echo "${ECHO_T}$PATH_SEPARATOR" >&6 -+ -+echo "$as_me:3301: checking if you have specified an install-prefix" >&5 - echo $ECHO_N "checking if you have specified an install-prefix... $ECHO_C" >&6 - - # Check whether --with-install-prefix or --without-install-prefix was given. -@@ -3526,7 +3311,7 @@ - ;; - esac - fi; --echo "$as_me:3529: result: $DESTDIR" >&5 -+echo "$as_me:3314: result: $DESTDIR" >&5 - echo "${ECHO_T}$DESTDIR" >&6 - - ############################################################################### -@@ -3554,7 +3339,7 @@ - do - # Extract the first word of "$ac_prog", so it can be a program name with args. - set dummy $ac_prog; ac_word=$2 --echo "$as_me:3557: checking for $ac_word" >&5 -+echo "$as_me:3342: checking for $ac_word" >&5 - echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 - if test "${ac_cv_prog_BUILD_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -3569,7 +3354,7 @@ - test -z "$ac_dir" && ac_dir=. - $as_executable_p "$ac_dir/$ac_word" || continue - ac_cv_prog_BUILD_CC="$ac_prog" --echo "$as_me:3572: found $ac_dir/$ac_word" >&5 -+echo "$as_me:3357: found $ac_dir/$ac_word" >&5 - break - done - -@@ -3577,10 +3362,10 @@ - fi - BUILD_CC=$ac_cv_prog_BUILD_CC - if test -n "$BUILD_CC"; then -- echo "$as_me:3580: result: $BUILD_CC" >&5 -+ echo "$as_me:3365: result: $BUILD_CC" >&5 - echo "${ECHO_T}$BUILD_CC" >&6 - else -- echo "$as_me:3583: result: no" >&5 -+ echo "$as_me:3368: result: no" >&5 - echo "${ECHO_T}no" >&6 - fi - -@@ -3588,12 +3373,12 @@ - done - - fi; -- echo "$as_me:3591: checking for native build C compiler" >&5 -+ echo "$as_me:3376: checking for native build C compiler" >&5 - echo $ECHO_N "checking for native build C compiler... $ECHO_C" >&6 -- echo "$as_me:3593: result: $BUILD_CC" >&5 -+ echo "$as_me:3378: result: $BUILD_CC" >&5 - echo "${ECHO_T}$BUILD_CC" >&6 - -- echo "$as_me:3596: checking for native build C preprocessor" >&5 -+ echo "$as_me:3381: checking for native build C preprocessor" >&5 - echo $ECHO_N "checking for native build C preprocessor... $ECHO_C" >&6 - - # Check whether --with-build-cpp or --without-build-cpp was given. -@@ -3603,10 +3388,10 @@ - else - BUILD_CPP='${BUILD_CC} -E' - fi; -- echo "$as_me:3606: result: $BUILD_CPP" >&5 -+ echo "$as_me:3391: result: $BUILD_CPP" >&5 - echo "${ECHO_T}$BUILD_CPP" >&6 - -- echo "$as_me:3609: checking for native build C flags" >&5 -+ echo "$as_me:3394: checking for native build C flags" >&5 - echo $ECHO_N "checking for native build C flags... $ECHO_C" >&6 - - # Check whether --with-build-cflags or --without-build-cflags was given. -@@ -3614,10 +3399,10 @@ - withval="$with_build_cflags" - BUILD_CFLAGS="$withval" - fi; -- echo "$as_me:3617: result: $BUILD_CFLAGS" >&5 -+ echo "$as_me:3402: result: $BUILD_CFLAGS" >&5 - echo "${ECHO_T}$BUILD_CFLAGS" >&6 - -- echo "$as_me:3620: checking for native build C preprocessor-flags" >&5 -+ echo "$as_me:3405: checking for native build C preprocessor-flags" >&5 - echo $ECHO_N "checking for native build C preprocessor-flags... $ECHO_C" >&6 - - # Check whether --with-build-cppflags or --without-build-cppflags was given. -@@ -3625,10 +3410,10 @@ - withval="$with_build_cppflags" - BUILD_CPPFLAGS="$withval" - fi; -- echo "$as_me:3628: result: $BUILD_CPPFLAGS" >&5 -+ echo "$as_me:3413: result: $BUILD_CPPFLAGS" >&5 - echo "${ECHO_T}$BUILD_CPPFLAGS" >&6 - -- echo "$as_me:3631: checking for native build linker-flags" >&5 -+ echo "$as_me:3416: checking for native build linker-flags" >&5 - echo $ECHO_N "checking for native build linker-flags... $ECHO_C" >&6 - - # Check whether --with-build-ldflags or --without-build-ldflags was given. -@@ -3636,10 +3421,10 @@ - withval="$with_build_ldflags" - BUILD_LDFLAGS="$withval" - fi; -- echo "$as_me:3639: result: $BUILD_LDFLAGS" >&5 -+ echo "$as_me:3424: result: $BUILD_LDFLAGS" >&5 - echo "${ECHO_T}$BUILD_LDFLAGS" >&6 - -- echo "$as_me:3642: checking for native build linker-libraries" >&5 -+ echo "$as_me:3427: checking for native build linker-libraries" >&5 - echo $ECHO_N "checking for native build linker-libraries... $ECHO_C" >&6 - - # Check whether --with-build-libs or --without-build-libs was given. -@@ -3647,7 +3432,7 @@ - withval="$with_build_libs" - BUILD_LIBS="$withval" - fi; -- echo "$as_me:3650: result: $BUILD_LIBS" >&5 -+ echo "$as_me:3435: result: $BUILD_LIBS" >&5 - echo "${ECHO_T}$BUILD_LIBS" >&6 - - # this assumes we're on Unix. -@@ -3657,7 +3442,7 @@ - : ${BUILD_CC:='${CC}'} - - if ( test "$BUILD_CC" = "$CC" || test "$BUILD_CC" = '${CC}' ) ; then -- { { echo "$as_me:3660: error: Cross-build requires two compilers. -+ { { echo "$as_me:3445: error: Cross-build requires two compilers. - Use --with-build-cc to specify the native compiler." >&5 - echo "$as_me: error: Cross-build requires two compilers. - Use --with-build-cc to specify the native compiler." >&2;} -@@ -3682,7 +3467,7 @@ - ### shared, for example. - cf_list_models="" - --echo "$as_me:3685: checking if you want to build shared C-objects" >&5 -+echo "$as_me:3470: checking if you want to build shared C-objects" >&5 - echo $ECHO_N "checking if you want to build shared C-objects... $ECHO_C" >&6 - - # Check whether --with-shared or --without-shared was given. -@@ -3692,27 +3477,27 @@ - else - with_shared=no - fi; --echo "$as_me:3695: result: $with_shared" >&5 -+echo "$as_me:3480: result: $with_shared" >&5 - echo "${ECHO_T}$with_shared" >&6 - test "$with_shared" = "yes" && cf_list_models="$cf_list_models shared" - --echo "$as_me:3699: checking for specified models" >&5 -+echo "$as_me:3484: checking for specified models" >&5 - echo $ECHO_N "checking for specified models... $ECHO_C" >&6 - test -z "$cf_list_models" && cf_list_models=normal --echo "$as_me:3702: result: $cf_list_models" >&5 -+echo "$as_me:3487: result: $cf_list_models" >&5 - echo "${ECHO_T}$cf_list_models" >&6 - - ### Use the first model as the default, and save its suffix for use in building - ### up test-applications. --echo "$as_me:3707: checking for default model" >&5 -+echo "$as_me:3492: checking for default model" >&5 - echo $ECHO_N "checking for default model... $ECHO_C" >&6 - DFT_LWR_MODEL=`echo "$cf_list_models" | $AWK '{print $1}'` --echo "$as_me:3710: result: $DFT_LWR_MODEL" >&5 -+echo "$as_me:3495: result: $DFT_LWR_MODEL" >&5 - echo "${ECHO_T}$DFT_LWR_MODEL" >&6 - - DFT_UPR_MODEL=`echo "$DFT_LWR_MODEL" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` - --echo "$as_me:3715: checking for specific curses-directory" >&5 -+echo "$as_me:3500: checking for specific curses-directory" >&5 - echo $ECHO_N "checking for specific curses-directory... $ECHO_C" >&6 - - # Check whether --with-curses-dir or --without-curses-dir was given. -@@ -3722,7 +3507,7 @@ - else - cf_cv_curses_dir=no - fi; --echo "$as_me:3725: result: $cf_cv_curses_dir" >&5 -+echo "$as_me:3510: result: $cf_cv_curses_dir" >&5 - echo "${ECHO_T}$cf_cv_curses_dir" >&6 - - if ( test -n "$cf_cv_curses_dir" && test "$cf_cv_curses_dir" != "no" ) -@@ -3741,7 +3526,7 @@ - ;; - .[a-zA-Z]:[\\/]*) #(vi OS/2 EMX - ;; --.\${*prefix}*) #(vi -+.\${*prefix}*|.\${*dir}*) #(vi - eval withval="$withval" - case ".$withval" in #(vi - .NONE/*) -@@ -3753,7 +3538,7 @@ - withval=`echo $withval | sed -e s%NONE%$cf_path_syntax%` - ;; - *) -- { { echo "$as_me:3756: error: expected a pathname, not \"$withval\"" >&5 -+ { { echo "$as_me:3541: error: expected a pathname, not \"$withval\"" >&5 - echo "$as_me: error: expected a pathname, not \"$withval\"" >&2;} - { (exit 1); exit 1; }; } - ;; -@@ -3786,7 +3571,7 @@ - cf_save_CPPFLAGS=$CPPFLAGS - CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" - cat >conftest.$ac_ext <<_ACEOF --#line 3789 "configure" -+#line 3574 "configure" - #include "confdefs.h" - #include - int -@@ -3798,16 +3583,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:3801: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:3586: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:3804: \$? = $ac_status" >&5 -+ echo "$as_me:3589: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:3807: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:3592: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:3810: \$? = $ac_status" >&5 -+ echo "$as_me:3595: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : - else -@@ -3824,7 +3609,7 @@ - if test "$cf_have_incdir" = no ; then - test -n "$verbose" && echo " adding $cf_add_incdir to include-path" 1>&6 - --echo "${as_me:-configure}:3827: testing adding $cf_add_incdir to include-path ..." 1>&5 -+echo "${as_me:-configure}:3612: testing adding $cf_add_incdir to include-path ..." 1>&5 - - CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" - -@@ -3858,7 +3643,7 @@ - if test "$cf_have_libdir" = no ; then - test -n "$verbose" && echo " adding $cf_add_libdir to library-path" 1>&6 - --echo "${as_me:-configure}:3861: testing adding $cf_add_libdir to library-path ..." 1>&5 -+echo "${as_me:-configure}:3646: testing adding $cf_add_libdir to library-path ..." 1>&5 - - LDFLAGS="-L$cf_add_libdir $LDFLAGS" - fi -@@ -3869,7 +3654,7 @@ - fi - fi - --echo "$as_me:3872: checking if you want wide-character code" >&5 -+echo "$as_me:3657: checking if you want wide-character code" >&5 - echo $ECHO_N "checking if you want wide-character code... $ECHO_C" >&6 - - # Check whether --enable-widec or --disable-widec was given. -@@ -3879,11 +3664,11 @@ - else - with_widec=no - fi; --echo "$as_me:3882: result: $with_widec" >&5 -+echo "$as_me:3667: result: $with_widec" >&5 - echo "${ECHO_T}$with_widec" >&6 - if test "$with_widec" = yes ; then - --echo "$as_me:3886: checking for multibyte character support" >&5 -+echo "$as_me:3671: checking for multibyte character support" >&5 - echo $ECHO_N "checking for multibyte character support... $ECHO_C" >&6 - if test "${cf_cv_utf8_lib+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -3891,7 +3676,7 @@ - - cf_save_LIBS="$LIBS" - cat >conftest.$ac_ext <<_ACEOF --#line 3894 "configure" -+#line 3679 "configure" - #include "confdefs.h" - - #include -@@ -3904,16 +3689,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:3907: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:3692: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:3910: \$? = $ac_status" >&5 -+ echo "$as_me:3695: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:3913: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:3698: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:3916: \$? = $ac_status" >&5 -+ echo "$as_me:3701: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_cv_utf8_lib=yes - else -@@ -3925,12 +3710,12 @@ - cf_cv_header_path_utf8= - cf_cv_library_path_utf8= - --echo "${as_me:-configure}:3928: testing Starting FIND_LINKAGE(utf8,) ..." 1>&5 -+echo "${as_me:-configure}:3713: testing Starting FIND_LINKAGE(utf8,) ..." 1>&5 - - cf_save_LIBS="$LIBS" - - cat >conftest.$ac_ext <<_ACEOF --#line 3933 "configure" -+#line 3718 "configure" - #include "confdefs.h" - - #include -@@ -3943,16 +3728,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:3946: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:3731: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:3949: \$? = $ac_status" >&5 -+ echo "$as_me:3734: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:3952: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:3737: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:3955: \$? = $ac_status" >&5 -+ echo "$as_me:3740: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - - cf_cv_find_linkage_utf8=yes -@@ -3966,7 +3751,7 @@ - LIBS="-lutf8 $cf_save_LIBS" - - cat >conftest.$ac_ext <<_ACEOF --#line 3969 "configure" -+#line 3754 "configure" - #include "confdefs.h" - - #include -@@ -3979,16 +3764,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:3982: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:3767: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:3985: \$? = $ac_status" >&5 -+ echo "$as_me:3770: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:3988: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:3773: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:3991: \$? = $ac_status" >&5 -+ echo "$as_me:3776: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - - cf_cv_find_linkage_utf8=yes -@@ -4005,9 +3790,9 @@ - - test -n "$verbose" && echo " find linkage for utf8 library" 1>&6 - --echo "${as_me:-configure}:4008: testing find linkage for utf8 library ..." 1>&5 -+echo "${as_me:-configure}:3793: testing find linkage for utf8 library ..." 1>&5 - --echo "${as_me:-configure}:4010: testing Searching for headers in FIND_LINKAGE(utf8,) ..." 1>&5 -+echo "${as_me:-configure}:3795: testing Searching for headers in FIND_LINKAGE(utf8,) ..." 1>&5 - - cf_save_CPPFLAGS="$CPPFLAGS" - cf_test_CPPFLAGS="$CPPFLAGS" -@@ -4023,7 +3808,7 @@ - -I*) - cf_header_path=`echo ".$cf_header_path" |sed -e 's/^...//' -e 's,/include$,,'` - --test "$cf_header_path" != "NONE" && \ -+test "x$cf_header_path" != "xNONE" && \ - test -d "$cf_header_path" && \ - { - test -n "$verbose" && echo " ... testing for include-directories under $cf_header_path" -@@ -4044,9 +3829,9 @@ - - cf_search= - --test "/usr" != "$prefix" && \ -+test "x/usr" != "x$prefix" && \ - test -d "/usr" && \ --(test $prefix = NONE || test "/usr" != "$prefix") && { -+(test -z "$prefix" || test x$prefix = xNONE || test "x/usr" != "x$prefix") && { - test -n "$verbose" && echo " ... testing for include-directories under /usr" - test -d /usr/include && cf_search="$cf_search /usr/include" - test -d /usr/include/utf8 && cf_search="$cf_search /usr/include/utf8" -@@ -4055,7 +3840,7 @@ - test -d /usr/utf8/include/utf8 && cf_search="$cf_search /usr/utf8/include/utf8" - } - --test "$prefix" != "NONE" && \ -+test "x$prefix" != "xNONE" && \ - test -d "$prefix" && \ - { - test -n "$verbose" && echo " ... testing for include-directories under $prefix" -@@ -4066,9 +3851,9 @@ - test -d $prefix/utf8/include/utf8 && cf_search="$cf_search $prefix/utf8/include/utf8" - } - --test "/usr/local" != "$prefix" && \ -+test "x/usr/local" != "x$prefix" && \ - test -d "/usr/local" && \ --(test $prefix = NONE || test "/usr/local" != "$prefix") && { -+(test -z "$prefix" || test x$prefix = xNONE || test "x/usr/local" != "x$prefix") && { - test -n "$verbose" && echo " ... testing for include-directories under /usr/local" - test -d /usr/local/include && cf_search="$cf_search /usr/local/include" - test -d /usr/local/include/utf8 && cf_search="$cf_search /usr/local/include/utf8" -@@ -4077,9 +3862,9 @@ - test -d /usr/local/utf8/include/utf8 && cf_search="$cf_search /usr/local/utf8/include/utf8" - } - --test "/opt" != "$prefix" && \ -+test "x/opt" != "x$prefix" && \ - test -d "/opt" && \ --(test $prefix = NONE || test "/opt" != "$prefix") && { -+(test -z "$prefix" || test x$prefix = xNONE || test "x/opt" != "x$prefix") && { - test -n "$verbose" && echo " ... testing for include-directories under /opt" - test -d /opt/include && cf_search="$cf_search /opt/include" - test -d /opt/include/utf8 && cf_search="$cf_search /opt/include/utf8" -@@ -4088,9 +3873,9 @@ - test -d /opt/utf8/include/utf8 && cf_search="$cf_search /opt/utf8/include/utf8" - } - --test "$HOME" != "$prefix" && \ -+test "x$HOME" != "x$prefix" && \ - test -d "$HOME" && \ --(test $prefix = NONE || test "$HOME" != "$prefix") && { -+(test -z "$prefix" || test x$prefix = xNONE || test "x$HOME" != "x$prefix") && { - test -n "$verbose" && echo " ... testing for include-directories under $HOME" - test -d $HOME/include && cf_search="$cf_search $HOME/include" - test -d $HOME/include/utf8 && cf_search="$cf_search $HOME/include/utf8" -@@ -4120,11 +3905,11 @@ - if test -d $cf_cv_header_path_utf8 ; then - test -n "$verbose" && echo " ... testing $cf_cv_header_path_utf8" 1>&6 - --echo "${as_me:-configure}:4123: testing ... testing $cf_cv_header_path_utf8 ..." 1>&5 -+echo "${as_me:-configure}:3908: testing ... testing $cf_cv_header_path_utf8 ..." 1>&5 - - CPPFLAGS="$cf_save_CPPFLAGS -I$cf_cv_header_path_utf8" - cat >conftest.$ac_ext <<_ACEOF --#line 4127 "configure" -+#line 3912 "configure" - #include "confdefs.h" - - #include -@@ -4137,21 +3922,21 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:4140: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:3925: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:4143: \$? = $ac_status" >&5 -+ echo "$as_me:3928: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:4146: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:3931: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:4149: \$? = $ac_status" >&5 -+ echo "$as_me:3934: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - - test -n "$verbose" && echo " ... found utf8 headers in $cf_cv_header_path_utf8" 1>&6 - --echo "${as_me:-configure}:4154: testing ... found utf8 headers in $cf_cv_header_path_utf8 ..." 1>&5 -+echo "${as_me:-configure}:3939: testing ... found utf8 headers in $cf_cv_header_path_utf8 ..." 1>&5 - - cf_cv_find_linkage_utf8=maybe - cf_test_CPPFLAGS="$CPPFLAGS" -@@ -4169,7 +3954,7 @@ - - if test "$cf_cv_find_linkage_utf8" = maybe ; then - --echo "${as_me:-configure}:4172: testing Searching for utf8 library in FIND_LINKAGE(utf8,) ..." 1>&5 -+echo "${as_me:-configure}:3957: testing Searching for utf8 library in FIND_LINKAGE(utf8,) ..." 1>&5 - - cf_save_LIBS="$LIBS" - cf_save_LDFLAGS="$LDFLAGS" -@@ -4185,7 +3970,7 @@ - -L*) - cf_library_path=`echo ".$cf_library_path" |sed -e 's/^...//' -e 's,/lib$,,'` - --test "$cf_library_path" != "NONE" && \ -+test "x$cf_library_path" != "xNONE" && \ - test -d "$cf_library_path" && \ - { - test -n "$verbose" && echo " ... testing for lib-directories under $cf_library_path" -@@ -4204,9 +3989,9 @@ - - cf_search= - --test "/usr" != "$prefix" && \ -+test "x/usr" != "x$prefix" && \ - test -d "/usr" && \ --(test $prefix = NONE || test "/usr" != "$prefix") && { -+(test -z "$prefix" || test x$prefix = xNONE || test "x/usr" != "x$prefix") && { - test -n "$verbose" && echo " ... testing for lib-directories under /usr" - test -d /usr/lib && cf_search="$cf_search /usr/lib" - test -d /usr/lib/utf8 && cf_search="$cf_search /usr/lib/utf8" -@@ -4215,7 +4000,7 @@ - test -d /usr/utf8/lib/utf8 && cf_search="$cf_search /usr/utf8/lib/utf8" - } - --test "$prefix" != "NONE" && \ -+test "x$prefix" != "xNONE" && \ - test -d "$prefix" && \ - { - test -n "$verbose" && echo " ... testing for lib-directories under $prefix" -@@ -4226,9 +4011,9 @@ - test -d $prefix/utf8/lib/utf8 && cf_search="$cf_search $prefix/utf8/lib/utf8" - } - --test "/usr/local" != "$prefix" && \ -+test "x/usr/local" != "x$prefix" && \ - test -d "/usr/local" && \ --(test $prefix = NONE || test "/usr/local" != "$prefix") && { -+(test -z "$prefix" || test x$prefix = xNONE || test "x/usr/local" != "x$prefix") && { - test -n "$verbose" && echo " ... testing for lib-directories under /usr/local" - test -d /usr/local/lib && cf_search="$cf_search /usr/local/lib" - test -d /usr/local/lib/utf8 && cf_search="$cf_search /usr/local/lib/utf8" -@@ -4237,9 +4022,9 @@ - test -d /usr/local/utf8/lib/utf8 && cf_search="$cf_search /usr/local/utf8/lib/utf8" - } - --test "/opt" != "$prefix" && \ -+test "x/opt" != "x$prefix" && \ - test -d "/opt" && \ --(test $prefix = NONE || test "/opt" != "$prefix") && { -+(test -z "$prefix" || test x$prefix = xNONE || test "x/opt" != "x$prefix") && { - test -n "$verbose" && echo " ... testing for lib-directories under /opt" - test -d /opt/lib && cf_search="$cf_search /opt/lib" - test -d /opt/lib/utf8 && cf_search="$cf_search /opt/lib/utf8" -@@ -4248,9 +4033,9 @@ - test -d /opt/utf8/lib/utf8 && cf_search="$cf_search /opt/utf8/lib/utf8" - } - --test "$HOME" != "$prefix" && \ -+test "x$HOME" != "x$prefix" && \ - test -d "$HOME" && \ --(test $prefix = NONE || test "$HOME" != "$prefix") && { -+(test -z "$prefix" || test x$prefix = xNONE || test "x$HOME" != "x$prefix") && { - test -n "$verbose" && echo " ... testing for lib-directories under $HOME" - test -d $HOME/lib && cf_search="$cf_search $HOME/lib" - test -d $HOME/lib/utf8 && cf_search="$cf_search $HOME/lib/utf8" -@@ -4266,13 +4051,13 @@ - if test -d $cf_cv_library_path_utf8 ; then - test -n "$verbose" && echo " ... testing $cf_cv_library_path_utf8" 1>&6 - --echo "${as_me:-configure}:4269: testing ... testing $cf_cv_library_path_utf8 ..." 1>&5 -+echo "${as_me:-configure}:4054: testing ... testing $cf_cv_library_path_utf8 ..." 1>&5 - - CPPFLAGS="$cf_test_CPPFLAGS" - LIBS="-lutf8 $cf_save_LIBS" - LDFLAGS="$cf_save_LDFLAGS -L$cf_cv_library_path_utf8" - cat >conftest.$ac_ext <<_ACEOF --#line 4275 "configure" -+#line 4060 "configure" - #include "confdefs.h" - - #include -@@ -4285,21 +4070,21 @@ - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:4288: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:4073: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:4291: \$? = $ac_status" >&5 -+ echo "$as_me:4076: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:4294: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:4079: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:4297: \$? = $ac_status" >&5 -+ echo "$as_me:4082: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - - test -n "$verbose" && echo " ... found utf8 library in $cf_cv_library_path_utf8" 1>&6 - --echo "${as_me:-configure}:4302: testing ... found utf8 library in $cf_cv_library_path_utf8 ..." 1>&5 -+echo "${as_me:-configure}:4087: testing ... found utf8 library in $cf_cv_library_path_utf8 ..." 1>&5 - - cf_cv_find_linkage_utf8=yes - cf_cv_library_file_utf8="-lutf8" -@@ -4341,13 +4126,14 @@ - fi - rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - fi --echo "$as_me:4344: result: $cf_cv_utf8_lib" >&5 -+echo "$as_me:4129: result: $cf_cv_utf8_lib" >&5 - echo "${ECHO_T}$cf_cv_utf8_lib" >&6 - - # HAVE_LIBUTF8_H is used by ncurses if curses.h is shared between - # ncurses/ncursesw: - if test "$cf_cv_utf8_lib" = "add-on" ; then -- cat >>confdefs.h <<\EOF -+ -+cat >>confdefs.h <<\EOF - #define HAVE_LIBUTF8_H 1 - EOF - -@@ -4375,7 +4161,7 @@ - cf_save_CPPFLAGS=$CPPFLAGS - CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" - cat >conftest.$ac_ext <<_ACEOF --#line 4378 "configure" -+#line 4164 "configure" - #include "confdefs.h" - #include - int -@@ -4387,16 +4173,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:4390: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:4176: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:4393: \$? = $ac_status" >&5 -+ echo "$as_me:4179: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:4396: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:4182: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:4399: \$? = $ac_status" >&5 -+ echo "$as_me:4185: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : - else -@@ -4413,7 +4199,7 @@ - if test "$cf_have_incdir" = no ; then - test -n "$verbose" && echo " adding $cf_add_incdir to include-path" 1>&6 - --echo "${as_me:-configure}:4416: testing adding $cf_add_incdir to include-path ..." 1>&5 -+echo "${as_me:-configure}:4202: testing adding $cf_add_incdir to include-path ..." 1>&5 - - CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" - -@@ -4447,7 +4233,7 @@ - if test "$cf_have_libdir" = no ; then - test -n "$verbose" && echo " adding $cf_add_libdir to library-path" 1>&6 - --echo "${as_me:-configure}:4450: testing adding $cf_add_libdir to library-path ..." 1>&5 -+echo "${as_me:-configure}:4236: testing adding $cf_add_libdir to library-path ..." 1>&5 - - LDFLAGS="-L$cf_add_libdir $LDFLAGS" - fi -@@ -4461,48 +4247,87 @@ - cf_ncuconfig_root=ncursesw - - echo "Looking for ${cf_ncuconfig_root}-config" --for ac_prog in ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config -+ -+if test -n "$ac_tool_prefix"; then -+ for ac_prog in ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config -+ do -+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -+set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -+echo "$as_me:4256: checking for $ac_word" >&5 -+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -+if test "${ac_cv_prog_NCURSES_CONFIG+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ if test -n "$NCURSES_CONFIG"; then -+ ac_cv_prog_NCURSES_CONFIG="$NCURSES_CONFIG" # Let the user override the test. -+else -+ ac_save_IFS=$IFS; IFS=$ac_path_separator -+ac_dummy="$PATH" -+for ac_dir in $ac_dummy; do -+ IFS=$ac_save_IFS -+ test -z "$ac_dir" && ac_dir=. -+ $as_executable_p "$ac_dir/$ac_word" || continue -+ac_cv_prog_NCURSES_CONFIG="$ac_tool_prefix$ac_prog" -+echo "$as_me:4271: found $ac_dir/$ac_word" >&5 -+break -+done -+ -+fi -+fi -+NCURSES_CONFIG=$ac_cv_prog_NCURSES_CONFIG -+if test -n "$NCURSES_CONFIG"; then -+ echo "$as_me:4279: result: $NCURSES_CONFIG" >&5 -+echo "${ECHO_T}$NCURSES_CONFIG" >&6 -+else -+ echo "$as_me:4282: result: no" >&5 -+echo "${ECHO_T}no" >&6 -+fi -+ -+ test -n "$NCURSES_CONFIG" && break -+ done -+fi -+if test -z "$NCURSES_CONFIG"; then -+ ac_ct_NCURSES_CONFIG=$NCURSES_CONFIG -+ for ac_prog in ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config - do - # Extract the first word of "$ac_prog", so it can be a program name with args. - set dummy $ac_prog; ac_word=$2 --echo "$as_me:4468: checking for $ac_word" >&5 -+echo "$as_me:4295: checking for $ac_word" >&5 - echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 --if test "${ac_cv_path_NCURSES_CONFIG+set}" = set; then -+if test "${ac_cv_prog_ac_ct_NCURSES_CONFIG+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else -- case $NCURSES_CONFIG in -- [\\/]* | ?:[\\/]*) -- ac_cv_path_NCURSES_CONFIG="$NCURSES_CONFIG" # Let the user override the test with a path. -- ;; -- *) -+ if test -n "$ac_ct_NCURSES_CONFIG"; then -+ ac_cv_prog_ac_ct_NCURSES_CONFIG="$ac_ct_NCURSES_CONFIG" # Let the user override the test. -+else - ac_save_IFS=$IFS; IFS=$ac_path_separator - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - IFS=$ac_save_IFS - test -z "$ac_dir" && ac_dir=. -- if $as_executable_p "$ac_dir/$ac_word"; then -- ac_cv_path_NCURSES_CONFIG="$ac_dir/$ac_word" -- echo "$as_me:4485: found $ac_dir/$ac_word" >&5 -- break --fi -+ $as_executable_p "$ac_dir/$ac_word" || continue -+ac_cv_prog_ac_ct_NCURSES_CONFIG="$ac_prog" -+echo "$as_me:4310: found $ac_dir/$ac_word" >&5 -+break - done - -- ;; --esac - fi --NCURSES_CONFIG=$ac_cv_path_NCURSES_CONFIG -- --if test -n "$NCURSES_CONFIG"; then -- echo "$as_me:4496: result: $NCURSES_CONFIG" >&5 --echo "${ECHO_T}$NCURSES_CONFIG" >&6 -+fi -+ac_ct_NCURSES_CONFIG=$ac_cv_prog_ac_ct_NCURSES_CONFIG -+if test -n "$ac_ct_NCURSES_CONFIG"; then -+ echo "$as_me:4318: result: $ac_ct_NCURSES_CONFIG" >&5 -+echo "${ECHO_T}$ac_ct_NCURSES_CONFIG" >&6 - else -- echo "$as_me:4499: result: no" >&5 -+ echo "$as_me:4321: result: no" >&5 - echo "${ECHO_T}no" >&6 - fi - -- test -n "$NCURSES_CONFIG" && break -+ test -n "$ac_ct_NCURSES_CONFIG" && break - done --test -n "$NCURSES_CONFIG" || NCURSES_CONFIG="none" -+test -n "$ac_ct_NCURSES_CONFIG" || ac_ct_NCURSES_CONFIG="none" -+ -+ NCURSES_CONFIG=$ac_ct_NCURSES_CONFIG -+fi - - if test "$NCURSES_CONFIG" != none ; then - -@@ -4511,7 +4336,7 @@ - - # even with config script, some packages use no-override for curses.h - --echo "$as_me:4514: checking if we have identified curses headers" >&5 -+echo "$as_me:4339: checking if we have identified curses headers" >&5 - echo $ECHO_N "checking if we have identified curses headers... $ECHO_C" >&6 - if test "${cf_cv_ncurses_header+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -4519,13 +4344,13 @@ - - cf_cv_ncurses_header=none - for cf_header in \ -- ncursesw/curses.h \ -- ncursesw/ncurses.h \ -- curses.h \ -- ncurses.h -+ ncursesw/ncurses.h \ -+ ncursesw/curses.h \ -+ ncurses.h \ -+ curses.h - do - cat >conftest.$ac_ext <<_ACEOF --#line 4528 "configure" -+#line 4353 "configure" - #include "confdefs.h" - #include <${cf_header}> - int -@@ -4537,16 +4362,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:4540: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:4365: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:4543: \$? = $ac_status" >&5 -+ echo "$as_me:4368: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:4546: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:4371: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:4549: \$? = $ac_status" >&5 -+ echo "$as_me:4374: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_cv_ncurses_header=$cf_header; break - else -@@ -4557,11 +4382,11 @@ - done - - fi --echo "$as_me:4560: result: $cf_cv_ncurses_header" >&5 -+echo "$as_me:4385: result: $cf_cv_ncurses_header" >&5 - echo "${ECHO_T}$cf_cv_ncurses_header" >&6 - - if test "$cf_cv_ncurses_header" = none ; then -- { { echo "$as_me:4564: error: No curses header-files found" >&5 -+ { { echo "$as_me:4389: error: No curses header-files found" >&5 - echo "$as_me: error: No curses header-files found" >&2;} - { (exit 1); exit 1; }; } - fi -@@ -4571,23 +4396,23 @@ - for ac_header in $cf_cv_ncurses_header - do - as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` --echo "$as_me:4574: checking for $ac_header" >&5 -+echo "$as_me:4399: checking for $ac_header" >&5 - echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 - if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - cat >conftest.$ac_ext <<_ACEOF --#line 4580 "configure" -+#line 4405 "configure" - #include "confdefs.h" - #include <$ac_header> - _ACEOF --if { (eval echo "$as_me:4584: \"$ac_cpp conftest.$ac_ext\"") >&5 -+if { (eval echo "$as_me:4409: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 -- echo "$as_me:4590: \$? = $ac_status" >&5 -+ echo "$as_me:4415: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag -@@ -4606,7 +4431,7 @@ - fi - rm -f conftest.err conftest.$ac_ext - fi --echo "$as_me:4609: result: `eval echo '${'$as_ac_Header'}'`" >&5 -+echo "$as_me:4434: result: `eval echo '${'$as_ac_Header'}'`" >&5 - echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 - if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <conftest.$ac_ext <<_ACEOF --#line 4662 "configure" -+#line 4487 "configure" - #include "confdefs.h" - #include - int -@@ -4671,16 +4496,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:4674: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:4499: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:4677: \$? = $ac_status" >&5 -+ echo "$as_me:4502: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:4680: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:4505: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:4683: \$? = $ac_status" >&5 -+ echo "$as_me:4508: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : - else -@@ -4697,7 +4522,7 @@ - if test "$cf_have_incdir" = no ; then - test -n "$verbose" && echo " adding $cf_add_incdir to include-path" 1>&6 - --echo "${as_me:-configure}:4700: testing adding $cf_add_incdir to include-path ..." 1>&5 -+echo "${as_me:-configure}:4525: testing adding $cf_add_incdir to include-path ..." 1>&5 - - CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" - -@@ -4714,7 +4539,7 @@ - - } - --echo "$as_me:4717: checking for $cf_ncuhdr_root header in include-path" >&5 -+echo "$as_me:4542: checking for $cf_ncuhdr_root header in include-path" >&5 - echo $ECHO_N "checking for $cf_ncuhdr_root header in include-path... $ECHO_C" >&6 - if test "${cf_cv_ncurses_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -4726,7 +4551,7 @@ - do - - cat >conftest.$ac_ext <<_ACEOF --#line 4729 "configure" -+#line 4554 "configure" - #include "confdefs.h" - - #define _XOPEN_SOURCE_EXTENDED -@@ -4758,16 +4583,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:4761: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:4586: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:4764: \$? = $ac_status" >&5 -+ echo "$as_me:4589: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:4767: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:4592: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:4770: \$? = $ac_status" >&5 -+ echo "$as_me:4595: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_cv_ncurses_h=$cf_header - -@@ -4782,14 +4607,14 @@ - done - - fi --echo "$as_me:4785: result: $cf_cv_ncurses_h" >&5 -+echo "$as_me:4610: result: $cf_cv_ncurses_h" >&5 - echo "${ECHO_T}$cf_cv_ncurses_h" >&6 - - if test "$cf_cv_ncurses_h" != no ; then - cf_cv_ncurses_header=$cf_cv_ncurses_h - else - --echo "$as_me:4792: checking for $cf_ncuhdr_root include-path" >&5 -+echo "$as_me:4617: checking for $cf_ncuhdr_root include-path" >&5 - echo $ECHO_N "checking for $cf_ncuhdr_root include-path... $ECHO_C" >&6 - if test "${cf_cv_ncurses_h2+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -4808,7 +4633,7 @@ - -I*) - cf_header_path=`echo ".$cf_header_path" |sed -e 's/^...//' -e 's,/include$,,'` - --test "$cf_header_path" != "NONE" && \ -+test "x$cf_header_path" != "xNONE" && \ - test -d "$cf_header_path" && \ - { - test -n "$verbose" && echo " ... testing for include-directories under $cf_header_path" -@@ -4829,9 +4654,9 @@ - - cf_search= - --test "/usr" != "$prefix" && \ -+test "x/usr" != "x$prefix" && \ - test -d "/usr" && \ --(test $prefix = NONE || test "/usr" != "$prefix") && { -+(test -z "$prefix" || test x$prefix = xNONE || test "x/usr" != "x$prefix") && { - test -n "$verbose" && echo " ... testing for include-directories under /usr" - test -d /usr/include && cf_search="$cf_search /usr/include" - test -d /usr/include/$cf_ncuhdr_root && cf_search="$cf_search /usr/include/$cf_ncuhdr_root" -@@ -4840,7 +4665,7 @@ - test -d /usr/$cf_ncuhdr_root/include/$cf_ncuhdr_root && cf_search="$cf_search /usr/$cf_ncuhdr_root/include/$cf_ncuhdr_root" - } - --test "$prefix" != "NONE" && \ -+test "x$prefix" != "xNONE" && \ - test -d "$prefix" && \ - { - test -n "$verbose" && echo " ... testing for include-directories under $prefix" -@@ -4851,9 +4676,9 @@ - test -d $prefix/$cf_ncuhdr_root/include/$cf_ncuhdr_root && cf_search="$cf_search $prefix/$cf_ncuhdr_root/include/$cf_ncuhdr_root" - } - --test "/usr/local" != "$prefix" && \ -+test "x/usr/local" != "x$prefix" && \ - test -d "/usr/local" && \ --(test $prefix = NONE || test "/usr/local" != "$prefix") && { -+(test -z "$prefix" || test x$prefix = xNONE || test "x/usr/local" != "x$prefix") && { - test -n "$verbose" && echo " ... testing for include-directories under /usr/local" - test -d /usr/local/include && cf_search="$cf_search /usr/local/include" - test -d /usr/local/include/$cf_ncuhdr_root && cf_search="$cf_search /usr/local/include/$cf_ncuhdr_root" -@@ -4862,9 +4687,9 @@ - test -d /usr/local/$cf_ncuhdr_root/include/$cf_ncuhdr_root && cf_search="$cf_search /usr/local/$cf_ncuhdr_root/include/$cf_ncuhdr_root" - } - --test "/opt" != "$prefix" && \ -+test "x/opt" != "x$prefix" && \ - test -d "/opt" && \ --(test $prefix = NONE || test "/opt" != "$prefix") && { -+(test -z "$prefix" || test x$prefix = xNONE || test "x/opt" != "x$prefix") && { - test -n "$verbose" && echo " ... testing for include-directories under /opt" - test -d /opt/include && cf_search="$cf_search /opt/include" - test -d /opt/include/$cf_ncuhdr_root && cf_search="$cf_search /opt/include/$cf_ncuhdr_root" -@@ -4873,9 +4698,9 @@ - test -d /opt/$cf_ncuhdr_root/include/$cf_ncuhdr_root && cf_search="$cf_search /opt/$cf_ncuhdr_root/include/$cf_ncuhdr_root" - } - --test "$HOME" != "$prefix" && \ -+test "x$HOME" != "x$prefix" && \ - test -d "$HOME" && \ --(test $prefix = NONE || test "$HOME" != "$prefix") && { -+(test -z "$prefix" || test x$prefix = xNONE || test "x$HOME" != "x$prefix") && { - test -n "$verbose" && echo " ... testing for include-directories under $HOME" - test -d $HOME/include && cf_search="$cf_search $HOME/include" - test -d $HOME/include/$cf_ncuhdr_root && cf_search="$cf_search $HOME/include/$cf_ncuhdr_root" -@@ -4929,7 +4754,7 @@ - cf_save_CPPFLAGS=$CPPFLAGS - CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" - cat >conftest.$ac_ext <<_ACEOF --#line 4932 "configure" -+#line 4757 "configure" - #include "confdefs.h" - #include - int -@@ -4941,16 +4766,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:4944: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:4769: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:4947: \$? = $ac_status" >&5 -+ echo "$as_me:4772: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:4950: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:4775: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:4953: \$? = $ac_status" >&5 -+ echo "$as_me:4778: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : - else -@@ -4967,7 +4792,7 @@ - if test "$cf_have_incdir" = no ; then - test -n "$verbose" && echo " adding $cf_add_incdir to include-path" 1>&6 - --echo "${as_me:-configure}:4970: testing adding $cf_add_incdir to include-path ..." 1>&5 -+echo "${as_me:-configure}:4795: testing adding $cf_add_incdir to include-path ..." 1>&5 - - CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" - -@@ -4988,7 +4813,7 @@ - do - - cat >conftest.$ac_ext <<_ACEOF --#line 4991 "configure" -+#line 4816 "configure" - #include "confdefs.h" - - #include <$cf_header> -@@ -5012,16 +4837,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:5015: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:4840: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:5018: \$? = $ac_status" >&5 -+ echo "$as_me:4843: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:5021: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:4846: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:5024: \$? = $ac_status" >&5 -+ echo "$as_me:4849: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_cv_ncurses_h2=$cf_header - -@@ -5042,12 +4867,12 @@ - CPPFLAGS="$cf_save2_CPPFLAGS" - test "$cf_cv_ncurses_h2" != no && break - done -- test "$cf_cv_ncurses_h2" = no && { { echo "$as_me:5045: error: not found" >&5 -+ test "$cf_cv_ncurses_h2" = no && { { echo "$as_me:4870: error: not found" >&5 - echo "$as_me: error: not found" >&2;} - { (exit 1); exit 1; }; } - - fi --echo "$as_me:5050: result: $cf_cv_ncurses_h2" >&5 -+echo "$as_me:4875: result: $cf_cv_ncurses_h2" >&5 - echo "${ECHO_T}$cf_cv_ncurses_h2" >&6 - - cf_1st_incdir=`echo $cf_cv_ncurses_h2 | sed -e 's%/[^/]*$%%'` -@@ -5080,7 +4905,7 @@ - cf_save_CPPFLAGS=$CPPFLAGS - CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" - cat >conftest.$ac_ext <<_ACEOF --#line 5083 "configure" -+#line 4908 "configure" - #include "confdefs.h" - #include - int -@@ -5092,16 +4917,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:5095: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:4920: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:5098: \$? = $ac_status" >&5 -+ echo "$as_me:4923: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:5101: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:4926: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:5104: \$? = $ac_status" >&5 -+ echo "$as_me:4929: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : - else -@@ -5118,7 +4943,7 @@ - if test "$cf_have_incdir" = no ; then - test -n "$verbose" && echo " adding $cf_add_incdir to include-path" 1>&6 - --echo "${as_me:-configure}:5121: testing adding $cf_add_incdir to include-path ..." 1>&5 -+echo "${as_me:-configure}:4946: testing adding $cf_add_incdir to include-path ..." 1>&5 - - CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" - -@@ -5139,7 +4964,8 @@ - - case $cf_cv_ncurses_header in # (vi - *ncurses.h) -- cat >>confdefs.h <<\EOF -+ -+cat >>confdefs.h <<\EOF - #define HAVE_NCURSES_H 1 - EOF - -@@ -5148,20 +4974,22 @@ - - case $cf_cv_ncurses_header in # (vi - ncurses/curses.h|ncurses/ncurses.h) -- cat >>confdefs.h <<\EOF -+ -+cat >>confdefs.h <<\EOF - #define HAVE_NCURSES_NCURSES_H 1 - EOF - - ;; - ncursesw/curses.h|ncursesw/ncurses.h) -- cat >>confdefs.h <<\EOF -+ -+cat >>confdefs.h <<\EOF - #define HAVE_NCURSESW_NCURSES_H 1 - EOF - - ;; - esac - --echo "$as_me:5164: checking for terminfo header" >&5 -+echo "$as_me:4992: checking for terminfo header" >&5 - echo $ECHO_N "checking for terminfo header... $ECHO_C" >&6 - if test "${cf_cv_term_header+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -5179,7 +5007,7 @@ - for cf_test in $cf_term_header "ncurses/term.h" "ncursesw/term.h" - do - cat >conftest.$ac_ext <<_ACEOF --#line 5182 "configure" -+#line 5010 "configure" - #include "confdefs.h" - #include - #include <${cf_cv_ncurses_header:-curses.h}> -@@ -5194,16 +5022,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:5197: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:5025: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:5200: \$? = $ac_status" >&5 -+ echo "$as_me:5028: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:5203: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:5031: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:5206: \$? = $ac_status" >&5 -+ echo "$as_me:5034: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - - cf_cv_term_header="$cf_test" -@@ -5219,14 +5047,15 @@ - done - - fi --echo "$as_me:5222: result: $cf_cv_term_header" >&5 -+echo "$as_me:5050: result: $cf_cv_term_header" >&5 - echo "${ECHO_T}$cf_cv_term_header" >&6 - - # Set definitions to allow ifdef'ing to accommodate subdirectories - - case $cf_cv_term_header in # (vi - *term.h) -- cat >>confdefs.h <<\EOF -+ -+cat >>confdefs.h <<\EOF - #define HAVE_TERM_H 1 - EOF - -@@ -5235,13 +5064,15 @@ - - case $cf_cv_term_header in # (vi - ncurses/term.h) #(vi -- cat >>confdefs.h <<\EOF -+ -+cat >>confdefs.h <<\EOF - #define HAVE_NCURSES_TERM_H 1 - EOF - - ;; - ncursesw/term.h) -- cat >>confdefs.h <<\EOF -+ -+cat >>confdefs.h <<\EOF - #define HAVE_NCURSESW_TERM_H 1 - EOF - -@@ -5249,11 +5080,12 @@ - esac - - # some applications need this, but should check for NCURSES_VERSION -+ - cat >>confdefs.h <<\EOF - #define NCURSES 1 - EOF - --echo "$as_me:5256: checking for ncurses version" >&5 -+echo "$as_me:5088: checking for ncurses version" >&5 - echo $ECHO_N "checking for ncurses version... $ECHO_C" >&6 - if test "${cf_cv_ncurses_version+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -5279,10 +5111,10 @@ - #endif - EOF - cf_try="$ac_cpp conftest.$ac_ext 2>&5 | grep '^Autoconf ' >conftest.out" -- { (eval echo "$as_me:5282: \"$cf_try\"") >&5 -+ { (eval echo "$as_me:5114: \"$cf_try\"") >&5 - (eval $cf_try) 2>&5 - ac_status=$? -- echo "$as_me:5285: \$? = $ac_status" >&5 -+ echo "$as_me:5117: \$? = $ac_status" >&5 - (exit $ac_status); } - if test -f conftest.out ; then - cf_out=`cat conftest.out | sed -e 's%^Autoconf %%' -e 's%^[^"]*"%%' -e 's%".*%%'` -@@ -5292,7 +5124,7 @@ - - else - cat >conftest.$ac_ext <<_ACEOF --#line 5295 "configure" -+#line 5127 "configure" - #include "confdefs.h" - - #include <${cf_cv_ncurses_header:-curses.h}> -@@ -5317,15 +5149,15 @@ - } - _ACEOF - rm -f conftest$ac_exeext --if { (eval echo "$as_me:5320: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:5152: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:5323: \$? = $ac_status" >&5 -+ echo "$as_me:5155: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' -- { (eval echo "$as_me:5325: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:5157: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:5328: \$? = $ac_status" >&5 -+ echo "$as_me:5160: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - - cf_cv_ncurses_version=`cat $cf_tempfile` -@@ -5339,9 +5171,10 @@ - rm -f $cf_tempfile - - fi --echo "$as_me:5342: result: $cf_cv_ncurses_version" >&5 -+echo "$as_me:5174: result: $cf_cv_ncurses_version" >&5 - echo "${ECHO_T}$cf_cv_ncurses_version" >&6 --test "$cf_cv_ncurses_version" = no || cat >>confdefs.h <<\EOF -+test "$cf_cv_ncurses_version" = no || -+cat >>confdefs.h <<\EOF - #define NCURSES 1 - EOF - -@@ -5351,7 +5184,7 @@ - # to link gpm. - cf_ncurses_LIBS="" - cf_ncurses_SAVE="$LIBS" --echo "$as_me:5354: checking for Gpm_Open in -lgpm" >&5 -+echo "$as_me:5187: checking for Gpm_Open in -lgpm" >&5 - echo $ECHO_N "checking for Gpm_Open in -lgpm... $ECHO_C" >&6 - if test "${ac_cv_lib_gpm_Gpm_Open+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -5359,7 +5192,7 @@ - ac_check_lib_save_LIBS=$LIBS - LIBS="-lgpm $LIBS" - cat >conftest.$ac_ext <<_ACEOF --#line 5362 "configure" -+#line 5195 "configure" - #include "confdefs.h" - - /* Override any gcc2 internal prototype to avoid an error. */ -@@ -5378,16 +5211,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:5381: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:5214: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:5384: \$? = $ac_status" >&5 -+ echo "$as_me:5217: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:5387: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:5220: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:5390: \$? = $ac_status" >&5 -+ echo "$as_me:5223: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_gpm_Gpm_Open=yes - else -@@ -5398,10 +5231,10 @@ - rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - LIBS=$ac_check_lib_save_LIBS - fi --echo "$as_me:5401: result: $ac_cv_lib_gpm_Gpm_Open" >&5 -+echo "$as_me:5234: result: $ac_cv_lib_gpm_Gpm_Open" >&5 - echo "${ECHO_T}$ac_cv_lib_gpm_Gpm_Open" >&6 - if test $ac_cv_lib_gpm_Gpm_Open = yes; then -- echo "$as_me:5404: checking for initscr in -lgpm" >&5 -+ echo "$as_me:5237: checking for initscr in -lgpm" >&5 - echo $ECHO_N "checking for initscr in -lgpm... $ECHO_C" >&6 - if test "${ac_cv_lib_gpm_initscr+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -5409,7 +5242,7 @@ - ac_check_lib_save_LIBS=$LIBS - LIBS="-lgpm $LIBS" - cat >conftest.$ac_ext <<_ACEOF --#line 5412 "configure" -+#line 5245 "configure" - #include "confdefs.h" - - /* Override any gcc2 internal prototype to avoid an error. */ -@@ -5428,16 +5261,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:5431: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:5264: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:5434: \$? = $ac_status" >&5 -+ echo "$as_me:5267: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:5437: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:5270: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:5440: \$? = $ac_status" >&5 -+ echo "$as_me:5273: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_gpm_initscr=yes - else -@@ -5448,7 +5281,7 @@ - rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - LIBS=$ac_check_lib_save_LIBS - fi --echo "$as_me:5451: result: $ac_cv_lib_gpm_initscr" >&5 -+echo "$as_me:5284: result: $ac_cv_lib_gpm_initscr" >&5 - echo "${ECHO_T}$ac_cv_lib_gpm_initscr" >&6 - if test $ac_cv_lib_gpm_initscr = yes; then - LIBS="$cf_ncurses_SAVE" -@@ -5463,7 +5296,7 @@ - # This is only necessary if you are linking against an obsolete - # version of ncurses (but it should do no harm, since it's static). - if test "$cf_nculib_root" = ncurses ; then -- echo "$as_me:5466: checking for tgoto in -lmytinfo" >&5 -+ echo "$as_me:5299: checking for tgoto in -lmytinfo" >&5 - echo $ECHO_N "checking for tgoto in -lmytinfo... $ECHO_C" >&6 - if test "${ac_cv_lib_mytinfo_tgoto+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -5471,7 +5304,7 @@ - ac_check_lib_save_LIBS=$LIBS - LIBS="-lmytinfo $LIBS" - cat >conftest.$ac_ext <<_ACEOF --#line 5474 "configure" -+#line 5307 "configure" - #include "confdefs.h" - - /* Override any gcc2 internal prototype to avoid an error. */ -@@ -5490,16 +5323,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:5493: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:5326: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:5496: \$? = $ac_status" >&5 -+ echo "$as_me:5329: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:5499: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:5332: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:5502: \$? = $ac_status" >&5 -+ echo "$as_me:5335: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_mytinfo_tgoto=yes - else -@@ -5510,7 +5343,7 @@ - rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - LIBS=$ac_check_lib_save_LIBS - fi --echo "$as_me:5513: result: $ac_cv_lib_mytinfo_tgoto" >&5 -+echo "$as_me:5346: result: $ac_cv_lib_mytinfo_tgoto" >&5 - echo "${ECHO_T}$ac_cv_lib_mytinfo_tgoto" >&6 - if test $ac_cv_lib_mytinfo_tgoto = yes; then - cf_ncurses_LIBS="-lmytinfo $cf_ncurses_LIBS" -@@ -5529,13 +5362,13 @@ - - eval 'cf_cv_have_lib_'$cf_nculib_root'=no' - cf_libdir="" -- echo "$as_me:5532: checking for initscr" >&5 -+ echo "$as_me:5365: checking for initscr" >&5 - echo $ECHO_N "checking for initscr... $ECHO_C" >&6 - if test "${ac_cv_func_initscr+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - cat >conftest.$ac_ext <<_ACEOF --#line 5538 "configure" -+#line 5371 "configure" - #include "confdefs.h" - /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char initscr (); below. */ -@@ -5558,7 +5391,7 @@ - #if defined (__stub_initscr) || defined (__stub___initscr) - choke me - #else --f = initscr; -+f = initscr; /* workaround for ICC 12.0.3 */ if (f == 0) return 1; - #endif - - ; -@@ -5566,16 +5399,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:5569: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:5402: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:5572: \$? = $ac_status" >&5 -+ echo "$as_me:5405: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:5575: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:5408: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:5578: \$? = $ac_status" >&5 -+ echo "$as_me:5411: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_func_initscr=yes - else -@@ -5585,18 +5418,18 @@ - fi - rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - fi --echo "$as_me:5588: result: $ac_cv_func_initscr" >&5 -+echo "$as_me:5421: result: $ac_cv_func_initscr" >&5 - echo "${ECHO_T}$ac_cv_func_initscr" >&6 - if test $ac_cv_func_initscr = yes; then - eval 'cf_cv_have_lib_'$cf_nculib_root'=yes' - else - - cf_save_LIBS="$LIBS" -- echo "$as_me:5595: checking for initscr in -l$cf_nculib_root" >&5 -+ echo "$as_me:5428: checking for initscr in -l$cf_nculib_root" >&5 - echo $ECHO_N "checking for initscr in -l$cf_nculib_root... $ECHO_C" >&6 - LIBS="-l$cf_nculib_root $LIBS" - cat >conftest.$ac_ext <<_ACEOF --#line 5599 "configure" -+#line 5432 "configure" - #include "confdefs.h" - #include <${cf_cv_ncurses_header:-curses.h}> - int -@@ -5608,25 +5441,25 @@ - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:5611: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:5444: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:5614: \$? = $ac_status" >&5 -+ echo "$as_me:5447: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:5617: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:5450: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:5620: \$? = $ac_status" >&5 -+ echo "$as_me:5453: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- echo "$as_me:5622: result: yes" >&5 -+ echo "$as_me:5455: result: yes" >&5 - echo "${ECHO_T}yes" >&6 - eval 'cf_cv_have_lib_'$cf_nculib_root'=yes' - - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --echo "$as_me:5629: result: no" >&5 -+echo "$as_me:5462: result: no" >&5 - echo "${ECHO_T}no" >&6 - - cf_search= -@@ -5638,7 +5471,7 @@ - -L*) - cf_library_path=`echo ".$cf_library_path" |sed -e 's/^...//' -e 's,/lib$,,'` - --test "$cf_library_path" != "NONE" && \ -+test "x$cf_library_path" != "xNONE" && \ - test -d "$cf_library_path" && \ - { - test -n "$verbose" && echo " ... testing for lib-directories under $cf_library_path" -@@ -5657,9 +5490,9 @@ - - cf_search= - --test "/usr" != "$prefix" && \ -+test "x/usr" != "x$prefix" && \ - test -d "/usr" && \ --(test $prefix = NONE || test "/usr" != "$prefix") && { -+(test -z "$prefix" || test x$prefix = xNONE || test "x/usr" != "x$prefix") && { - test -n "$verbose" && echo " ... testing for lib-directories under /usr" - test -d /usr/lib && cf_search="$cf_search /usr/lib" - test -d /usr/lib/$cf_nculib_root && cf_search="$cf_search /usr/lib/$cf_nculib_root" -@@ -5668,7 +5501,7 @@ - test -d /usr/$cf_nculib_root/lib/$cf_nculib_root && cf_search="$cf_search /usr/$cf_nculib_root/lib/$cf_nculib_root" - } - --test "$prefix" != "NONE" && \ -+test "x$prefix" != "xNONE" && \ - test -d "$prefix" && \ - { - test -n "$verbose" && echo " ... testing for lib-directories under $prefix" -@@ -5679,9 +5512,9 @@ - test -d $prefix/$cf_nculib_root/lib/$cf_nculib_root && cf_search="$cf_search $prefix/$cf_nculib_root/lib/$cf_nculib_root" - } - --test "/usr/local" != "$prefix" && \ -+test "x/usr/local" != "x$prefix" && \ - test -d "/usr/local" && \ --(test $prefix = NONE || test "/usr/local" != "$prefix") && { -+(test -z "$prefix" || test x$prefix = xNONE || test "x/usr/local" != "x$prefix") && { - test -n "$verbose" && echo " ... testing for lib-directories under /usr/local" - test -d /usr/local/lib && cf_search="$cf_search /usr/local/lib" - test -d /usr/local/lib/$cf_nculib_root && cf_search="$cf_search /usr/local/lib/$cf_nculib_root" -@@ -5690,9 +5523,9 @@ - test -d /usr/local/$cf_nculib_root/lib/$cf_nculib_root && cf_search="$cf_search /usr/local/$cf_nculib_root/lib/$cf_nculib_root" - } - --test "/opt" != "$prefix" && \ -+test "x/opt" != "x$prefix" && \ - test -d "/opt" && \ --(test $prefix = NONE || test "/opt" != "$prefix") && { -+(test -z "$prefix" || test x$prefix = xNONE || test "x/opt" != "x$prefix") && { - test -n "$verbose" && echo " ... testing for lib-directories under /opt" - test -d /opt/lib && cf_search="$cf_search /opt/lib" - test -d /opt/lib/$cf_nculib_root && cf_search="$cf_search /opt/lib/$cf_nculib_root" -@@ -5701,9 +5534,9 @@ - test -d /opt/$cf_nculib_root/lib/$cf_nculib_root && cf_search="$cf_search /opt/$cf_nculib_root/lib/$cf_nculib_root" - } - --test "$HOME" != "$prefix" && \ -+test "x$HOME" != "x$prefix" && \ - test -d "$HOME" && \ --(test $prefix = NONE || test "$HOME" != "$prefix") && { -+(test -z "$prefix" || test x$prefix = xNONE || test "x$HOME" != "x$prefix") && { - test -n "$verbose" && echo " ... testing for lib-directories under $HOME" - test -d $HOME/lib && cf_search="$cf_search $HOME/lib" - test -d $HOME/lib/$cf_nculib_root && cf_search="$cf_search $HOME/lib/$cf_nculib_root" -@@ -5716,11 +5549,11 @@ - - for cf_libdir in $cf_search - do -- echo "$as_me:5719: checking for -l$cf_nculib_root in $cf_libdir" >&5 -+ echo "$as_me:5552: checking for -l$cf_nculib_root in $cf_libdir" >&5 - echo $ECHO_N "checking for -l$cf_nculib_root in $cf_libdir... $ECHO_C" >&6 - LIBS="-L$cf_libdir -l$cf_nculib_root $cf_save_LIBS" - cat >conftest.$ac_ext <<_ACEOF --#line 5723 "configure" -+#line 5556 "configure" - #include "confdefs.h" - #include <${cf_cv_ncurses_header:-curses.h}> - int -@@ -5732,25 +5565,25 @@ - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:5735: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:5568: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:5738: \$? = $ac_status" >&5 -+ echo "$as_me:5571: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:5741: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:5574: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:5744: \$? = $ac_status" >&5 -+ echo "$as_me:5577: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- echo "$as_me:5746: result: yes" >&5 -+ echo "$as_me:5579: result: yes" >&5 - echo "${ECHO_T}yes" >&6 - eval 'cf_cv_have_lib_'$cf_nculib_root'=yes' - break - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --echo "$as_me:5753: result: no" >&5 -+echo "$as_me:5586: result: no" >&5 - echo "${ECHO_T}no" >&6 - LIBS="$cf_save_LIBS" - fi -@@ -5765,7 +5598,7 @@ - eval 'cf_found_library=$cf_cv_have_lib_'$cf_nculib_root - - if test $cf_found_library = no ; then -- { { echo "$as_me:5768: error: Cannot link $cf_nculib_root library" >&5 -+ { { echo "$as_me:5601: error: Cannot link $cf_nculib_root library" >&5 - echo "$as_me: error: Cannot link $cf_nculib_root library" >&2;} - { (exit 1); exit 1; }; } - fi -@@ -5773,7 +5606,7 @@ - fi - - if test -n "$cf_ncurses_LIBS" ; then -- echo "$as_me:5776: checking if we can link $cf_nculib_root without $cf_ncurses_LIBS" >&5 -+ echo "$as_me:5609: checking if we can link $cf_nculib_root without $cf_ncurses_LIBS" >&5 - echo $ECHO_N "checking if we can link $cf_nculib_root without $cf_ncurses_LIBS... $ECHO_C" >&6 - cf_ncurses_SAVE="$LIBS" - for p in $cf_ncurses_LIBS ; do -@@ -5783,7 +5616,7 @@ - fi - done - cat >conftest.$ac_ext <<_ACEOF --#line 5786 "configure" -+#line 5619 "configure" - #include "confdefs.h" - #include <${cf_cv_ncurses_header:-curses.h}> - int -@@ -5795,23 +5628,23 @@ - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:5798: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:5631: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:5801: \$? = $ac_status" >&5 -+ echo "$as_me:5634: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:5804: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:5637: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:5807: \$? = $ac_status" >&5 -+ echo "$as_me:5640: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- echo "$as_me:5809: result: yes" >&5 -+ echo "$as_me:5642: result: yes" >&5 - echo "${ECHO_T}yes" >&6 - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --echo "$as_me:5814: result: no" >&5 -+echo "$as_me:5647: result: no" >&5 - echo "${ECHO_T}no" >&6 - LIBS="$cf_ncurses_SAVE" - fi -@@ -5831,48 +5664,87 @@ - cf_ncuconfig_root=ncurses - - echo "Looking for ${cf_ncuconfig_root}-config" --for ac_prog in ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config -+ -+if test -n "$ac_tool_prefix"; then -+ for ac_prog in ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config -+ do -+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -+set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -+echo "$as_me:5673: checking for $ac_word" >&5 -+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -+if test "${ac_cv_prog_NCURSES_CONFIG+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ if test -n "$NCURSES_CONFIG"; then -+ ac_cv_prog_NCURSES_CONFIG="$NCURSES_CONFIG" # Let the user override the test. -+else -+ ac_save_IFS=$IFS; IFS=$ac_path_separator -+ac_dummy="$PATH" -+for ac_dir in $ac_dummy; do -+ IFS=$ac_save_IFS -+ test -z "$ac_dir" && ac_dir=. -+ $as_executable_p "$ac_dir/$ac_word" || continue -+ac_cv_prog_NCURSES_CONFIG="$ac_tool_prefix$ac_prog" -+echo "$as_me:5688: found $ac_dir/$ac_word" >&5 -+break -+done -+ -+fi -+fi -+NCURSES_CONFIG=$ac_cv_prog_NCURSES_CONFIG -+if test -n "$NCURSES_CONFIG"; then -+ echo "$as_me:5696: result: $NCURSES_CONFIG" >&5 -+echo "${ECHO_T}$NCURSES_CONFIG" >&6 -+else -+ echo "$as_me:5699: result: no" >&5 -+echo "${ECHO_T}no" >&6 -+fi -+ -+ test -n "$NCURSES_CONFIG" && break -+ done -+fi -+if test -z "$NCURSES_CONFIG"; then -+ ac_ct_NCURSES_CONFIG=$NCURSES_CONFIG -+ for ac_prog in ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config - do - # Extract the first word of "$ac_prog", so it can be a program name with args. - set dummy $ac_prog; ac_word=$2 --echo "$as_me:5838: checking for $ac_word" >&5 -+echo "$as_me:5712: checking for $ac_word" >&5 - echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 --if test "${ac_cv_path_NCURSES_CONFIG+set}" = set; then -+if test "${ac_cv_prog_ac_ct_NCURSES_CONFIG+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else -- case $NCURSES_CONFIG in -- [\\/]* | ?:[\\/]*) -- ac_cv_path_NCURSES_CONFIG="$NCURSES_CONFIG" # Let the user override the test with a path. -- ;; -- *) -+ if test -n "$ac_ct_NCURSES_CONFIG"; then -+ ac_cv_prog_ac_ct_NCURSES_CONFIG="$ac_ct_NCURSES_CONFIG" # Let the user override the test. -+else - ac_save_IFS=$IFS; IFS=$ac_path_separator - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - IFS=$ac_save_IFS - test -z "$ac_dir" && ac_dir=. -- if $as_executable_p "$ac_dir/$ac_word"; then -- ac_cv_path_NCURSES_CONFIG="$ac_dir/$ac_word" -- echo "$as_me:5855: found $ac_dir/$ac_word" >&5 -- break --fi -+ $as_executable_p "$ac_dir/$ac_word" || continue -+ac_cv_prog_ac_ct_NCURSES_CONFIG="$ac_prog" -+echo "$as_me:5727: found $ac_dir/$ac_word" >&5 -+break - done - -- ;; --esac - fi --NCURSES_CONFIG=$ac_cv_path_NCURSES_CONFIG -- --if test -n "$NCURSES_CONFIG"; then -- echo "$as_me:5866: result: $NCURSES_CONFIG" >&5 --echo "${ECHO_T}$NCURSES_CONFIG" >&6 -+fi -+ac_ct_NCURSES_CONFIG=$ac_cv_prog_ac_ct_NCURSES_CONFIG -+if test -n "$ac_ct_NCURSES_CONFIG"; then -+ echo "$as_me:5735: result: $ac_ct_NCURSES_CONFIG" >&5 -+echo "${ECHO_T}$ac_ct_NCURSES_CONFIG" >&6 - else -- echo "$as_me:5869: result: no" >&5 -+ echo "$as_me:5738: result: no" >&5 - echo "${ECHO_T}no" >&6 - fi - -- test -n "$NCURSES_CONFIG" && break -+ test -n "$ac_ct_NCURSES_CONFIG" && break - done --test -n "$NCURSES_CONFIG" || NCURSES_CONFIG="none" -+test -n "$ac_ct_NCURSES_CONFIG" || ac_ct_NCURSES_CONFIG="none" -+ -+ NCURSES_CONFIG=$ac_ct_NCURSES_CONFIG -+fi - - if test "$NCURSES_CONFIG" != none ; then - -@@ -5881,7 +5753,7 @@ - - # even with config script, some packages use no-override for curses.h - --echo "$as_me:5884: checking if we have identified curses headers" >&5 -+echo "$as_me:5756: checking if we have identified curses headers" >&5 - echo $ECHO_N "checking if we have identified curses headers... $ECHO_C" >&6 - if test "${cf_cv_ncurses_header+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -5889,13 +5761,13 @@ - - cf_cv_ncurses_header=none - for cf_header in \ -- ncurses/curses.h \ -- ncurses/ncurses.h \ -- curses.h \ -- ncurses.h -+ ncurses/ncurses.h \ -+ ncurses/curses.h \ -+ ncurses.h \ -+ curses.h - do - cat >conftest.$ac_ext <<_ACEOF --#line 5898 "configure" -+#line 5770 "configure" - #include "confdefs.h" - #include <${cf_header}> - int -@@ -5907,16 +5779,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:5910: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:5782: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:5913: \$? = $ac_status" >&5 -+ echo "$as_me:5785: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:5916: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:5788: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:5919: \$? = $ac_status" >&5 -+ echo "$as_me:5791: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_cv_ncurses_header=$cf_header; break - else -@@ -5927,11 +5799,11 @@ - done - - fi --echo "$as_me:5930: result: $cf_cv_ncurses_header" >&5 -+echo "$as_me:5802: result: $cf_cv_ncurses_header" >&5 - echo "${ECHO_T}$cf_cv_ncurses_header" >&6 - - if test "$cf_cv_ncurses_header" = none ; then -- { { echo "$as_me:5934: error: No curses header-files found" >&5 -+ { { echo "$as_me:5806: error: No curses header-files found" >&5 - echo "$as_me: error: No curses header-files found" >&2;} - { (exit 1); exit 1; }; } - fi -@@ -5941,23 +5813,23 @@ - for ac_header in $cf_cv_ncurses_header - do - as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` --echo "$as_me:5944: checking for $ac_header" >&5 -+echo "$as_me:5816: checking for $ac_header" >&5 - echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 - if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - cat >conftest.$ac_ext <<_ACEOF --#line 5950 "configure" -+#line 5822 "configure" - #include "confdefs.h" - #include <$ac_header> - _ACEOF --if { (eval echo "$as_me:5954: \"$ac_cpp conftest.$ac_ext\"") >&5 -+if { (eval echo "$as_me:5826: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 -- echo "$as_me:5960: \$? = $ac_status" >&5 -+ echo "$as_me:5832: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag -@@ -5976,7 +5848,7 @@ - fi - rm -f conftest.err conftest.$ac_ext - fi --echo "$as_me:5979: result: `eval echo '${'$as_ac_Header'}'`" >&5 -+echo "$as_me:5851: result: `eval echo '${'$as_ac_Header'}'`" >&5 - echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 - if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <conftest.$ac_ext <<_ACEOF --#line 6032 "configure" -+#line 5904 "configure" - #include "confdefs.h" - #include - int -@@ -6041,16 +5913,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:6044: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:5916: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:6047: \$? = $ac_status" >&5 -+ echo "$as_me:5919: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:6050: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:5922: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:6053: \$? = $ac_status" >&5 -+ echo "$as_me:5925: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : - else -@@ -6067,7 +5939,7 @@ - if test "$cf_have_incdir" = no ; then - test -n "$verbose" && echo " adding $cf_add_incdir to include-path" 1>&6 - --echo "${as_me:-configure}:6070: testing adding $cf_add_incdir to include-path ..." 1>&5 -+echo "${as_me:-configure}:5942: testing adding $cf_add_incdir to include-path ..." 1>&5 - - CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" - -@@ -6084,7 +5956,7 @@ - - } - --echo "$as_me:6087: checking for $cf_ncuhdr_root header in include-path" >&5 -+echo "$as_me:5959: checking for $cf_ncuhdr_root header in include-path" >&5 - echo $ECHO_N "checking for $cf_ncuhdr_root header in include-path... $ECHO_C" >&6 - if test "${cf_cv_ncurses_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -6096,7 +5968,7 @@ - do - - cat >conftest.$ac_ext <<_ACEOF --#line 6099 "configure" -+#line 5971 "configure" - #include "confdefs.h" - - #include <$cf_header> -@@ -6120,16 +5992,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:6123: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:5995: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:6126: \$? = $ac_status" >&5 -+ echo "$as_me:5998: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:6129: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:6001: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:6132: \$? = $ac_status" >&5 -+ echo "$as_me:6004: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_cv_ncurses_h=$cf_header - -@@ -6144,14 +6016,14 @@ - done - - fi --echo "$as_me:6147: result: $cf_cv_ncurses_h" >&5 -+echo "$as_me:6019: result: $cf_cv_ncurses_h" >&5 - echo "${ECHO_T}$cf_cv_ncurses_h" >&6 - - if test "$cf_cv_ncurses_h" != no ; then - cf_cv_ncurses_header=$cf_cv_ncurses_h - else - --echo "$as_me:6154: checking for $cf_ncuhdr_root include-path" >&5 -+echo "$as_me:6026: checking for $cf_ncuhdr_root include-path" >&5 - echo $ECHO_N "checking for $cf_ncuhdr_root include-path... $ECHO_C" >&6 - if test "${cf_cv_ncurses_h2+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -6170,7 +6042,7 @@ - -I*) - cf_header_path=`echo ".$cf_header_path" |sed -e 's/^...//' -e 's,/include$,,'` - --test "$cf_header_path" != "NONE" && \ -+test "x$cf_header_path" != "xNONE" && \ - test -d "$cf_header_path" && \ - { - test -n "$verbose" && echo " ... testing for include-directories under $cf_header_path" -@@ -6191,9 +6063,9 @@ - - cf_search= - --test "/usr" != "$prefix" && \ -+test "x/usr" != "x$prefix" && \ - test -d "/usr" && \ --(test $prefix = NONE || test "/usr" != "$prefix") && { -+(test -z "$prefix" || test x$prefix = xNONE || test "x/usr" != "x$prefix") && { - test -n "$verbose" && echo " ... testing for include-directories under /usr" - test -d /usr/include && cf_search="$cf_search /usr/include" - test -d /usr/include/$cf_ncuhdr_root && cf_search="$cf_search /usr/include/$cf_ncuhdr_root" -@@ -6202,7 +6074,7 @@ - test -d /usr/$cf_ncuhdr_root/include/$cf_ncuhdr_root && cf_search="$cf_search /usr/$cf_ncuhdr_root/include/$cf_ncuhdr_root" - } - --test "$prefix" != "NONE" && \ -+test "x$prefix" != "xNONE" && \ - test -d "$prefix" && \ - { - test -n "$verbose" && echo " ... testing for include-directories under $prefix" -@@ -6213,9 +6085,9 @@ - test -d $prefix/$cf_ncuhdr_root/include/$cf_ncuhdr_root && cf_search="$cf_search $prefix/$cf_ncuhdr_root/include/$cf_ncuhdr_root" - } - --test "/usr/local" != "$prefix" && \ -+test "x/usr/local" != "x$prefix" && \ - test -d "/usr/local" && \ --(test $prefix = NONE || test "/usr/local" != "$prefix") && { -+(test -z "$prefix" || test x$prefix = xNONE || test "x/usr/local" != "x$prefix") && { - test -n "$verbose" && echo " ... testing for include-directories under /usr/local" - test -d /usr/local/include && cf_search="$cf_search /usr/local/include" - test -d /usr/local/include/$cf_ncuhdr_root && cf_search="$cf_search /usr/local/include/$cf_ncuhdr_root" -@@ -6224,9 +6096,9 @@ - test -d /usr/local/$cf_ncuhdr_root/include/$cf_ncuhdr_root && cf_search="$cf_search /usr/local/$cf_ncuhdr_root/include/$cf_ncuhdr_root" - } - --test "/opt" != "$prefix" && \ -+test "x/opt" != "x$prefix" && \ - test -d "/opt" && \ --(test $prefix = NONE || test "/opt" != "$prefix") && { -+(test -z "$prefix" || test x$prefix = xNONE || test "x/opt" != "x$prefix") && { - test -n "$verbose" && echo " ... testing for include-directories under /opt" - test -d /opt/include && cf_search="$cf_search /opt/include" - test -d /opt/include/$cf_ncuhdr_root && cf_search="$cf_search /opt/include/$cf_ncuhdr_root" -@@ -6235,9 +6107,9 @@ - test -d /opt/$cf_ncuhdr_root/include/$cf_ncuhdr_root && cf_search="$cf_search /opt/$cf_ncuhdr_root/include/$cf_ncuhdr_root" - } - --test "$HOME" != "$prefix" && \ -+test "x$HOME" != "x$prefix" && \ - test -d "$HOME" && \ --(test $prefix = NONE || test "$HOME" != "$prefix") && { -+(test -z "$prefix" || test x$prefix = xNONE || test "x$HOME" != "x$prefix") && { - test -n "$verbose" && echo " ... testing for include-directories under $HOME" - test -d $HOME/include && cf_search="$cf_search $HOME/include" - test -d $HOME/include/$cf_ncuhdr_root && cf_search="$cf_search $HOME/include/$cf_ncuhdr_root" -@@ -6291,7 +6163,7 @@ - cf_save_CPPFLAGS=$CPPFLAGS - CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" - cat >conftest.$ac_ext <<_ACEOF --#line 6294 "configure" -+#line 6166 "configure" - #include "confdefs.h" - #include - int -@@ -6303,16 +6175,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:6306: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:6178: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:6309: \$? = $ac_status" >&5 -+ echo "$as_me:6181: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:6312: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:6184: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:6315: \$? = $ac_status" >&5 -+ echo "$as_me:6187: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : - else -@@ -6329,7 +6201,7 @@ - if test "$cf_have_incdir" = no ; then - test -n "$verbose" && echo " adding $cf_add_incdir to include-path" 1>&6 - --echo "${as_me:-configure}:6332: testing adding $cf_add_incdir to include-path ..." 1>&5 -+echo "${as_me:-configure}:6204: testing adding $cf_add_incdir to include-path ..." 1>&5 - - CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" - -@@ -6350,7 +6222,7 @@ - do - - cat >conftest.$ac_ext <<_ACEOF --#line 6353 "configure" -+#line 6225 "configure" - #include "confdefs.h" - - #include <$cf_header> -@@ -6374,16 +6246,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:6377: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:6249: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:6380: \$? = $ac_status" >&5 -+ echo "$as_me:6252: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:6383: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:6255: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:6386: \$? = $ac_status" >&5 -+ echo "$as_me:6258: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_cv_ncurses_h2=$cf_header - -@@ -6404,12 +6276,12 @@ - CPPFLAGS="$cf_save2_CPPFLAGS" - test "$cf_cv_ncurses_h2" != no && break - done -- test "$cf_cv_ncurses_h2" = no && { { echo "$as_me:6407: error: not found" >&5 -+ test "$cf_cv_ncurses_h2" = no && { { echo "$as_me:6279: error: not found" >&5 - echo "$as_me: error: not found" >&2;} - { (exit 1); exit 1; }; } - - fi --echo "$as_me:6412: result: $cf_cv_ncurses_h2" >&5 -+echo "$as_me:6284: result: $cf_cv_ncurses_h2" >&5 - echo "${ECHO_T}$cf_cv_ncurses_h2" >&6 - - cf_1st_incdir=`echo $cf_cv_ncurses_h2 | sed -e 's%/[^/]*$%%'` -@@ -6442,7 +6314,7 @@ - cf_save_CPPFLAGS=$CPPFLAGS - CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" - cat >conftest.$ac_ext <<_ACEOF --#line 6445 "configure" -+#line 6317 "configure" - #include "confdefs.h" - #include - int -@@ -6454,16 +6326,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:6457: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:6329: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:6460: \$? = $ac_status" >&5 -+ echo "$as_me:6332: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:6463: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:6335: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:6466: \$? = $ac_status" >&5 -+ echo "$as_me:6338: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : - else -@@ -6480,7 +6352,7 @@ - if test "$cf_have_incdir" = no ; then - test -n "$verbose" && echo " adding $cf_add_incdir to include-path" 1>&6 - --echo "${as_me:-configure}:6483: testing adding $cf_add_incdir to include-path ..." 1>&5 -+echo "${as_me:-configure}:6355: testing adding $cf_add_incdir to include-path ..." 1>&5 - - CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" - -@@ -6501,7 +6373,8 @@ - - case $cf_cv_ncurses_header in # (vi - *ncurses.h) -- cat >>confdefs.h <<\EOF -+ -+cat >>confdefs.h <<\EOF - #define HAVE_NCURSES_H 1 - EOF - -@@ -6510,20 +6383,22 @@ - - case $cf_cv_ncurses_header in # (vi - ncurses/curses.h|ncurses/ncurses.h) -- cat >>confdefs.h <<\EOF -+ -+cat >>confdefs.h <<\EOF - #define HAVE_NCURSES_NCURSES_H 1 - EOF - - ;; - ncursesw/curses.h|ncursesw/ncurses.h) -- cat >>confdefs.h <<\EOF -+ -+cat >>confdefs.h <<\EOF - #define HAVE_NCURSESW_NCURSES_H 1 - EOF - - ;; - esac - --echo "$as_me:6526: checking for terminfo header" >&5 -+echo "$as_me:6401: checking for terminfo header" >&5 - echo $ECHO_N "checking for terminfo header... $ECHO_C" >&6 - if test "${cf_cv_term_header+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -6541,7 +6416,7 @@ - for cf_test in $cf_term_header "ncurses/term.h" "ncursesw/term.h" - do - cat >conftest.$ac_ext <<_ACEOF --#line 6544 "configure" -+#line 6419 "configure" - #include "confdefs.h" - #include - #include <${cf_cv_ncurses_header:-curses.h}> -@@ -6556,16 +6431,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:6559: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:6434: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:6562: \$? = $ac_status" >&5 -+ echo "$as_me:6437: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:6565: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:6440: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:6568: \$? = $ac_status" >&5 -+ echo "$as_me:6443: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - - cf_cv_term_header="$cf_test" -@@ -6581,14 +6456,15 @@ - done - - fi --echo "$as_me:6584: result: $cf_cv_term_header" >&5 -+echo "$as_me:6459: result: $cf_cv_term_header" >&5 - echo "${ECHO_T}$cf_cv_term_header" >&6 - - # Set definitions to allow ifdef'ing to accommodate subdirectories - - case $cf_cv_term_header in # (vi - *term.h) -- cat >>confdefs.h <<\EOF -+ -+cat >>confdefs.h <<\EOF - #define HAVE_TERM_H 1 - EOF - -@@ -6597,13 +6473,15 @@ - - case $cf_cv_term_header in # (vi - ncurses/term.h) #(vi -- cat >>confdefs.h <<\EOF -+ -+cat >>confdefs.h <<\EOF - #define HAVE_NCURSES_TERM_H 1 - EOF - - ;; - ncursesw/term.h) -- cat >>confdefs.h <<\EOF -+ -+cat >>confdefs.h <<\EOF - #define HAVE_NCURSESW_TERM_H 1 - EOF - -@@ -6611,11 +6489,12 @@ - esac - - # some applications need this, but should check for NCURSES_VERSION -+ - cat >>confdefs.h <<\EOF - #define NCURSES 1 - EOF - --echo "$as_me:6618: checking for ncurses version" >&5 -+echo "$as_me:6497: checking for ncurses version" >&5 - echo $ECHO_N "checking for ncurses version... $ECHO_C" >&6 - if test "${cf_cv_ncurses_version+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -6641,10 +6520,10 @@ - #endif - EOF - cf_try="$ac_cpp conftest.$ac_ext 2>&5 | grep '^Autoconf ' >conftest.out" -- { (eval echo "$as_me:6644: \"$cf_try\"") >&5 -+ { (eval echo "$as_me:6523: \"$cf_try\"") >&5 - (eval $cf_try) 2>&5 - ac_status=$? -- echo "$as_me:6647: \$? = $ac_status" >&5 -+ echo "$as_me:6526: \$? = $ac_status" >&5 - (exit $ac_status); } - if test -f conftest.out ; then - cf_out=`cat conftest.out | sed -e 's%^Autoconf %%' -e 's%^[^"]*"%%' -e 's%".*%%'` -@@ -6654,7 +6533,7 @@ - - else - cat >conftest.$ac_ext <<_ACEOF --#line 6657 "configure" -+#line 6536 "configure" - #include "confdefs.h" - - #include <${cf_cv_ncurses_header:-curses.h}> -@@ -6679,15 +6558,15 @@ - } - _ACEOF - rm -f conftest$ac_exeext --if { (eval echo "$as_me:6682: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:6561: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:6685: \$? = $ac_status" >&5 -+ echo "$as_me:6564: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' -- { (eval echo "$as_me:6687: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:6566: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:6690: \$? = $ac_status" >&5 -+ echo "$as_me:6569: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - - cf_cv_ncurses_version=`cat $cf_tempfile` -@@ -6701,9 +6580,10 @@ - rm -f $cf_tempfile - - fi --echo "$as_me:6704: result: $cf_cv_ncurses_version" >&5 -+echo "$as_me:6583: result: $cf_cv_ncurses_version" >&5 - echo "${ECHO_T}$cf_cv_ncurses_version" >&6 --test "$cf_cv_ncurses_version" = no || cat >>confdefs.h <<\EOF -+test "$cf_cv_ncurses_version" = no || -+cat >>confdefs.h <<\EOF - #define NCURSES 1 - EOF - -@@ -6713,7 +6593,7 @@ - # to link gpm. - cf_ncurses_LIBS="" - cf_ncurses_SAVE="$LIBS" --echo "$as_me:6716: checking for Gpm_Open in -lgpm" >&5 -+echo "$as_me:6596: checking for Gpm_Open in -lgpm" >&5 - echo $ECHO_N "checking for Gpm_Open in -lgpm... $ECHO_C" >&6 - if test "${ac_cv_lib_gpm_Gpm_Open+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -6721,7 +6601,7 @@ - ac_check_lib_save_LIBS=$LIBS - LIBS="-lgpm $LIBS" - cat >conftest.$ac_ext <<_ACEOF --#line 6724 "configure" -+#line 6604 "configure" - #include "confdefs.h" - - /* Override any gcc2 internal prototype to avoid an error. */ -@@ -6740,16 +6620,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:6743: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:6623: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:6746: \$? = $ac_status" >&5 -+ echo "$as_me:6626: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:6749: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:6629: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:6752: \$? = $ac_status" >&5 -+ echo "$as_me:6632: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_gpm_Gpm_Open=yes - else -@@ -6760,10 +6640,10 @@ - rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - LIBS=$ac_check_lib_save_LIBS - fi --echo "$as_me:6763: result: $ac_cv_lib_gpm_Gpm_Open" >&5 -+echo "$as_me:6643: result: $ac_cv_lib_gpm_Gpm_Open" >&5 - echo "${ECHO_T}$ac_cv_lib_gpm_Gpm_Open" >&6 - if test $ac_cv_lib_gpm_Gpm_Open = yes; then -- echo "$as_me:6766: checking for initscr in -lgpm" >&5 -+ echo "$as_me:6646: checking for initscr in -lgpm" >&5 - echo $ECHO_N "checking for initscr in -lgpm... $ECHO_C" >&6 - if test "${ac_cv_lib_gpm_initscr+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -6771,7 +6651,7 @@ - ac_check_lib_save_LIBS=$LIBS - LIBS="-lgpm $LIBS" - cat >conftest.$ac_ext <<_ACEOF --#line 6774 "configure" -+#line 6654 "configure" - #include "confdefs.h" - - /* Override any gcc2 internal prototype to avoid an error. */ -@@ -6790,16 +6670,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:6793: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:6673: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:6796: \$? = $ac_status" >&5 -+ echo "$as_me:6676: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:6799: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:6679: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:6802: \$? = $ac_status" >&5 -+ echo "$as_me:6682: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_gpm_initscr=yes - else -@@ -6810,7 +6690,7 @@ - rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - LIBS=$ac_check_lib_save_LIBS - fi --echo "$as_me:6813: result: $ac_cv_lib_gpm_initscr" >&5 -+echo "$as_me:6693: result: $ac_cv_lib_gpm_initscr" >&5 - echo "${ECHO_T}$ac_cv_lib_gpm_initscr" >&6 - if test $ac_cv_lib_gpm_initscr = yes; then - LIBS="$cf_ncurses_SAVE" -@@ -6825,7 +6705,7 @@ - # This is only necessary if you are linking against an obsolete - # version of ncurses (but it should do no harm, since it's static). - if test "$cf_nculib_root" = ncurses ; then -- echo "$as_me:6828: checking for tgoto in -lmytinfo" >&5 -+ echo "$as_me:6708: checking for tgoto in -lmytinfo" >&5 - echo $ECHO_N "checking for tgoto in -lmytinfo... $ECHO_C" >&6 - if test "${ac_cv_lib_mytinfo_tgoto+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -6833,7 +6713,7 @@ - ac_check_lib_save_LIBS=$LIBS - LIBS="-lmytinfo $LIBS" - cat >conftest.$ac_ext <<_ACEOF --#line 6836 "configure" -+#line 6716 "configure" - #include "confdefs.h" - - /* Override any gcc2 internal prototype to avoid an error. */ -@@ -6852,16 +6732,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:6855: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:6735: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:6858: \$? = $ac_status" >&5 -+ echo "$as_me:6738: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:6861: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:6741: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:6864: \$? = $ac_status" >&5 -+ echo "$as_me:6744: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_mytinfo_tgoto=yes - else -@@ -6872,7 +6752,7 @@ - rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - LIBS=$ac_check_lib_save_LIBS - fi --echo "$as_me:6875: result: $ac_cv_lib_mytinfo_tgoto" >&5 -+echo "$as_me:6755: result: $ac_cv_lib_mytinfo_tgoto" >&5 - echo "${ECHO_T}$ac_cv_lib_mytinfo_tgoto" >&6 - if test $ac_cv_lib_mytinfo_tgoto = yes; then - cf_ncurses_LIBS="-lmytinfo $cf_ncurses_LIBS" -@@ -6891,13 +6771,13 @@ - - eval 'cf_cv_have_lib_'$cf_nculib_root'=no' - cf_libdir="" -- echo "$as_me:6894: checking for initscr" >&5 -+ echo "$as_me:6774: checking for initscr" >&5 - echo $ECHO_N "checking for initscr... $ECHO_C" >&6 - if test "${ac_cv_func_initscr+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - cat >conftest.$ac_ext <<_ACEOF --#line 6900 "configure" -+#line 6780 "configure" - #include "confdefs.h" - /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char initscr (); below. */ -@@ -6920,7 +6800,7 @@ - #if defined (__stub_initscr) || defined (__stub___initscr) - choke me - #else --f = initscr; -+f = initscr; /* workaround for ICC 12.0.3 */ if (f == 0) return 1; - #endif - - ; -@@ -6928,16 +6808,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:6931: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:6811: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:6934: \$? = $ac_status" >&5 -+ echo "$as_me:6814: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:6937: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:6817: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:6940: \$? = $ac_status" >&5 -+ echo "$as_me:6820: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_func_initscr=yes - else -@@ -6947,18 +6827,18 @@ - fi - rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - fi --echo "$as_me:6950: result: $ac_cv_func_initscr" >&5 -+echo "$as_me:6830: result: $ac_cv_func_initscr" >&5 - echo "${ECHO_T}$ac_cv_func_initscr" >&6 - if test $ac_cv_func_initscr = yes; then - eval 'cf_cv_have_lib_'$cf_nculib_root'=yes' - else - - cf_save_LIBS="$LIBS" -- echo "$as_me:6957: checking for initscr in -l$cf_nculib_root" >&5 -+ echo "$as_me:6837: checking for initscr in -l$cf_nculib_root" >&5 - echo $ECHO_N "checking for initscr in -l$cf_nculib_root... $ECHO_C" >&6 - LIBS="-l$cf_nculib_root $LIBS" - cat >conftest.$ac_ext <<_ACEOF --#line 6961 "configure" -+#line 6841 "configure" - #include "confdefs.h" - #include <${cf_cv_ncurses_header:-curses.h}> - int -@@ -6970,25 +6850,25 @@ - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:6973: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:6853: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:6976: \$? = $ac_status" >&5 -+ echo "$as_me:6856: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:6979: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:6859: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:6982: \$? = $ac_status" >&5 -+ echo "$as_me:6862: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- echo "$as_me:6984: result: yes" >&5 -+ echo "$as_me:6864: result: yes" >&5 - echo "${ECHO_T}yes" >&6 - eval 'cf_cv_have_lib_'$cf_nculib_root'=yes' - - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --echo "$as_me:6991: result: no" >&5 -+echo "$as_me:6871: result: no" >&5 - echo "${ECHO_T}no" >&6 - - cf_search= -@@ -7000,7 +6880,7 @@ - -L*) - cf_library_path=`echo ".$cf_library_path" |sed -e 's/^...//' -e 's,/lib$,,'` - --test "$cf_library_path" != "NONE" && \ -+test "x$cf_library_path" != "xNONE" && \ - test -d "$cf_library_path" && \ - { - test -n "$verbose" && echo " ... testing for lib-directories under $cf_library_path" -@@ -7019,9 +6899,9 @@ - - cf_search= - --test "/usr" != "$prefix" && \ -+test "x/usr" != "x$prefix" && \ - test -d "/usr" && \ --(test $prefix = NONE || test "/usr" != "$prefix") && { -+(test -z "$prefix" || test x$prefix = xNONE || test "x/usr" != "x$prefix") && { - test -n "$verbose" && echo " ... testing for lib-directories under /usr" - test -d /usr/lib && cf_search="$cf_search /usr/lib" - test -d /usr/lib/$cf_nculib_root && cf_search="$cf_search /usr/lib/$cf_nculib_root" -@@ -7030,7 +6910,7 @@ - test -d /usr/$cf_nculib_root/lib/$cf_nculib_root && cf_search="$cf_search /usr/$cf_nculib_root/lib/$cf_nculib_root" - } - --test "$prefix" != "NONE" && \ -+test "x$prefix" != "xNONE" && \ - test -d "$prefix" && \ - { - test -n "$verbose" && echo " ... testing for lib-directories under $prefix" -@@ -7041,9 +6921,9 @@ - test -d $prefix/$cf_nculib_root/lib/$cf_nculib_root && cf_search="$cf_search $prefix/$cf_nculib_root/lib/$cf_nculib_root" - } - --test "/usr/local" != "$prefix" && \ -+test "x/usr/local" != "x$prefix" && \ - test -d "/usr/local" && \ --(test $prefix = NONE || test "/usr/local" != "$prefix") && { -+(test -z "$prefix" || test x$prefix = xNONE || test "x/usr/local" != "x$prefix") && { - test -n "$verbose" && echo " ... testing for lib-directories under /usr/local" - test -d /usr/local/lib && cf_search="$cf_search /usr/local/lib" - test -d /usr/local/lib/$cf_nculib_root && cf_search="$cf_search /usr/local/lib/$cf_nculib_root" -@@ -7052,9 +6932,9 @@ - test -d /usr/local/$cf_nculib_root/lib/$cf_nculib_root && cf_search="$cf_search /usr/local/$cf_nculib_root/lib/$cf_nculib_root" - } - --test "/opt" != "$prefix" && \ -+test "x/opt" != "x$prefix" && \ - test -d "/opt" && \ --(test $prefix = NONE || test "/opt" != "$prefix") && { -+(test -z "$prefix" || test x$prefix = xNONE || test "x/opt" != "x$prefix") && { - test -n "$verbose" && echo " ... testing for lib-directories under /opt" - test -d /opt/lib && cf_search="$cf_search /opt/lib" - test -d /opt/lib/$cf_nculib_root && cf_search="$cf_search /opt/lib/$cf_nculib_root" -@@ -7063,9 +6943,9 @@ - test -d /opt/$cf_nculib_root/lib/$cf_nculib_root && cf_search="$cf_search /opt/$cf_nculib_root/lib/$cf_nculib_root" - } - --test "$HOME" != "$prefix" && \ -+test "x$HOME" != "x$prefix" && \ - test -d "$HOME" && \ --(test $prefix = NONE || test "$HOME" != "$prefix") && { -+(test -z "$prefix" || test x$prefix = xNONE || test "x$HOME" != "x$prefix") && { - test -n "$verbose" && echo " ... testing for lib-directories under $HOME" - test -d $HOME/lib && cf_search="$cf_search $HOME/lib" - test -d $HOME/lib/$cf_nculib_root && cf_search="$cf_search $HOME/lib/$cf_nculib_root" -@@ -7078,11 +6958,11 @@ - - for cf_libdir in $cf_search - do -- echo "$as_me:7081: checking for -l$cf_nculib_root in $cf_libdir" >&5 -+ echo "$as_me:6961: checking for -l$cf_nculib_root in $cf_libdir" >&5 - echo $ECHO_N "checking for -l$cf_nculib_root in $cf_libdir... $ECHO_C" >&6 - LIBS="-L$cf_libdir -l$cf_nculib_root $cf_save_LIBS" - cat >conftest.$ac_ext <<_ACEOF --#line 7085 "configure" -+#line 6965 "configure" - #include "confdefs.h" - #include <${cf_cv_ncurses_header:-curses.h}> - int -@@ -7094,25 +6974,25 @@ - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:7097: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:6977: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:7100: \$? = $ac_status" >&5 -+ echo "$as_me:6980: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:7103: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:6983: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:7106: \$? = $ac_status" >&5 -+ echo "$as_me:6986: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- echo "$as_me:7108: result: yes" >&5 -+ echo "$as_me:6988: result: yes" >&5 - echo "${ECHO_T}yes" >&6 - eval 'cf_cv_have_lib_'$cf_nculib_root'=yes' - break - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --echo "$as_me:7115: result: no" >&5 -+echo "$as_me:6995: result: no" >&5 - echo "${ECHO_T}no" >&6 - LIBS="$cf_save_LIBS" - fi -@@ -7127,7 +7007,7 @@ - eval 'cf_found_library=$cf_cv_have_lib_'$cf_nculib_root - - if test $cf_found_library = no ; then -- { { echo "$as_me:7130: error: Cannot link $cf_nculib_root library" >&5 -+ { { echo "$as_me:7010: error: Cannot link $cf_nculib_root library" >&5 - echo "$as_me: error: Cannot link $cf_nculib_root library" >&2;} - { (exit 1); exit 1; }; } - fi -@@ -7135,7 +7015,7 @@ - fi - - if test -n "$cf_ncurses_LIBS" ; then -- echo "$as_me:7138: checking if we can link $cf_nculib_root without $cf_ncurses_LIBS" >&5 -+ echo "$as_me:7018: checking if we can link $cf_nculib_root without $cf_ncurses_LIBS" >&5 - echo $ECHO_N "checking if we can link $cf_nculib_root without $cf_ncurses_LIBS... $ECHO_C" >&6 - cf_ncurses_SAVE="$LIBS" - for p in $cf_ncurses_LIBS ; do -@@ -7145,7 +7025,7 @@ - fi - done - cat >conftest.$ac_ext <<_ACEOF --#line 7148 "configure" -+#line 7028 "configure" - #include "confdefs.h" - #include <${cf_cv_ncurses_header:-curses.h}> - int -@@ -7157,23 +7037,23 @@ - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:7160: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:7040: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:7163: \$? = $ac_status" >&5 -+ echo "$as_me:7043: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:7166: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:7046: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:7169: \$? = $ac_status" >&5 -+ echo "$as_me:7049: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- echo "$as_me:7171: result: yes" >&5 -+ echo "$as_me:7051: result: yes" >&5 - echo "${ECHO_T}yes" >&6 - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --echo "$as_me:7176: result: no" >&5 -+echo "$as_me:7056: result: no" >&5 - echo "${ECHO_T}no" >&6 - LIBS="$cf_ncurses_SAVE" - fi -@@ -7210,10 +7090,10 @@ - AUTOCONF_$cf_name NCURSES_VERSION_$cf_name - CF_EOF - cf_try="$ac_cpp conftest.$ac_ext 2>&5 | fgrep AUTOCONF_$cf_name >conftest.out" -- { (eval echo "$as_me:7213: \"$cf_try\"") >&5 -+ { (eval echo "$as_me:7093: \"$cf_try\"") >&5 - (eval $cf_try) 2>&5 - ac_status=$? -- echo "$as_me:7216: \$? = $ac_status" >&5 -+ echo "$as_me:7096: \$? = $ac_status" >&5 - (exit $ac_status); } - if test -f conftest.out ; then - cf_result=`cat conftest.out | sed -e "s/^.*AUTOCONF_$cf_name[ ][ ]*//"` -@@ -7231,9 +7111,25 @@ - - cf_cv_timestamp=`date` - --echo "$as_me:7234: result: Configuring NCURSES $cf_cv_rel_version ABI $cf_cv_abi_version ($cf_cv_timestamp)" >&5 -+echo "$as_me:7114: result: Configuring NCURSES $cf_cv_rel_version ABI $cf_cv_abi_version ($cf_cv_timestamp)" >&5 - echo "${ECHO_T}Configuring NCURSES $cf_cv_rel_version ABI $cf_cv_abi_version ($cf_cv_timestamp)" >&6 - -+echo "$as_me:7117: checking if you want to have a library-prefix" >&5 -+echo $ECHO_N "checking if you want to have a library-prefix... $ECHO_C" >&6 -+ -+# Check whether --with-lib-prefix or --without-lib-prefix was given. -+if test "${with_lib_prefix+set}" = set; then -+ withval="$with_lib_prefix" -+ with_lib_prefix=$withval -+else -+ with_lib_prefix=auto -+fi; -+echo "$as_me:7127: result: $with_lib_prefix" >&5 -+echo "${ECHO_T}$with_lib_prefix" >&6 -+ -+if test $with_lib_prefix = auto -+then -+ - case $cf_cv_system_name in #(vi - OS/2*|os2*) #(vi - LIB_PREFIX='' -@@ -7243,7 +7139,12 @@ - esac - cf_prefix=$LIB_PREFIX - --LIB_PREFIX=$cf_prefix -+elif test $with_lib_prefix = no -+then -+ LIB_PREFIX= -+else -+ LIB_PREFIX=$with_lib_prefix -+fi - - LIB_SUFFIX= - -@@ -7254,7 +7155,7 @@ - test -n "$GCC" && test "${ac_cv_prog_cc_g}" != yes && CC_G_OPT='' - fi - --echo "$as_me:7257: checking for default loader flags" >&5 -+echo "$as_me:7158: checking for default loader flags" >&5 - echo $ECHO_N "checking for default loader flags... $ECHO_C" >&6 - case $DFT_LWR_MODEL in - normal) LD_MODEL='' ;; -@@ -7262,11 +7163,11 @@ - profile) LD_MODEL='-pg';; - shared) LD_MODEL='' ;; - esac --echo "$as_me:7265: result: $LD_MODEL" >&5 -+echo "$as_me:7166: result: $LD_MODEL" >&5 - echo "${ECHO_T}$LD_MODEL" >&6 - - LD_RPATH_OPT= --echo "$as_me:7269: checking for an rpath option" >&5 -+echo "$as_me:7170: checking for an rpath option" >&5 - echo $ECHO_N "checking for an rpath option... $ECHO_C" >&6 - case $cf_cv_system_name in #(vi - irix*) #(vi -@@ -7279,10 +7180,10 @@ - linux*|gnu*|k*bsd*-gnu) #(vi - LD_RPATH_OPT="-Wl,-rpath," - ;; --openbsd[2-9].*) #(vi -+openbsd[2-9].*|mirbsd*) #(vi - LD_RPATH_OPT="-Wl,-rpath," - ;; --freebsd*) #(vi -+dragonfly*|freebsd*) #(vi - LD_RPATH_OPT="-rpath " - ;; - netbsd*) #(vi -@@ -7297,17 +7198,17 @@ - *) - ;; - esac --echo "$as_me:7300: result: $LD_RPATH_OPT" >&5 -+echo "$as_me:7201: result: $LD_RPATH_OPT" >&5 - echo "${ECHO_T}$LD_RPATH_OPT" >&6 - - case "x$LD_RPATH_OPT" in #(vi - x-R*) -- echo "$as_me:7305: checking if we need a space after rpath option" >&5 -+ echo "$as_me:7206: checking if we need a space after rpath option" >&5 - echo $ECHO_N "checking if we need a space after rpath option... $ECHO_C" >&6 - cf_save_LIBS="$LIBS" - LIBS="${LD_RPATH_OPT}$libdir $LIBS" - cat >conftest.$ac_ext <<_ACEOF --#line 7310 "configure" -+#line 7211 "configure" - #include "confdefs.h" - - int -@@ -7319,16 +7220,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:7322: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:7223: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:7325: \$? = $ac_status" >&5 -+ echo "$as_me:7226: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:7328: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:7229: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:7331: \$? = $ac_status" >&5 -+ echo "$as_me:7232: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_rpath_space=no - else -@@ -7338,22 +7239,28 @@ - fi - rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - LIBS="$cf_save_LIBS" -- echo "$as_me:7341: result: $cf_rpath_space" >&5 -+ echo "$as_me:7242: result: $cf_rpath_space" >&5 - echo "${ECHO_T}$cf_rpath_space" >&6 - test "$cf_rpath_space" = yes && LD_RPATH_OPT="$LD_RPATH_OPT " - ;; - esac - -+ RM_SHARED_OPTS= - LOCAL_LDFLAGS= - LOCAL_LDFLAGS2= - LD_SHARED_OPTS= - INSTALL_LIB="-m 644" -+ : ${rel_builddir:=.} -+ -+ shlibdir=$libdir -+ -+ MAKE_DLLS="#" - - cf_cv_do_symlinks=no - cf_ld_rpath_opt= - test "$cf_cv_enable_rpath" = yes && cf_ld_rpath_opt="$LD_RPATH_OPT" - -- echo "$as_me:7356: checking if release/abi version should be used for shared libs" >&5 -+ echo "$as_me:7263: checking if release/abi version should be used for shared libs" >&5 - echo $ECHO_N "checking if release/abi version should be used for shared libs... $ECHO_C" >&6 - - # Check whether --with-shlib-version or --without-shlib-version was given. -@@ -7368,7 +7275,7 @@ - cf_cv_shlib_version=$withval - ;; - *) -- { { echo "$as_me:7371: error: option value must be one of: rel, abi, auto or no" >&5 -+ { { echo "$as_me:7278: error: option value must be one of: rel, abi, auto or no" >&5 - echo "$as_me: error: option value must be one of: rel, abi, auto or no" >&2;} - { (exit 1); exit 1; }; } - ;; -@@ -7377,23 +7284,24 @@ - else - cf_cv_shlib_version=auto - fi; -- echo "$as_me:7380: result: $cf_cv_shlib_version" >&5 -+ echo "$as_me:7287: result: $cf_cv_shlib_version" >&5 - echo "${ECHO_T}$cf_cv_shlib_version" >&6 - - cf_cv_rm_so_locs=no -+ cf_try_cflags= - - # Some less-capable ports of gcc support only -fpic - CC_SHARED_OPTS= - if test "$GCC" = yes - then -- echo "$as_me:7389: checking which $CC option to use" >&5 -+ echo "$as_me:7297: checking which $CC option to use" >&5 - echo $ECHO_N "checking which $CC option to use... $ECHO_C" >&6 - cf_save_CFLAGS="$CFLAGS" - for CC_SHARED_OPTS in -fPIC -fpic '' - do - CFLAGS="$cf_save_CFLAGS $CC_SHARED_OPTS" - cat >conftest.$ac_ext <<_ACEOF --#line 7396 "configure" -+#line 7304 "configure" - #include "confdefs.h" - #include - int -@@ -7405,16 +7313,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:7408: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:7316: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:7411: \$? = $ac_status" >&5 -+ echo "$as_me:7319: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:7414: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:7322: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:7417: \$? = $ac_status" >&5 -+ echo "$as_me:7325: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - break - else -@@ -7423,7 +7331,7 @@ - fi - rm -f conftest.$ac_objext conftest.$ac_ext - done -- echo "$as_me:7426: result: $CC_SHARED_OPTS" >&5 -+ echo "$as_me:7334: result: $CC_SHARED_OPTS" >&5 - echo "${ECHO_T}$CC_SHARED_OPTS" >&6 - CFLAGS="$cf_save_CFLAGS" - fi -@@ -7431,10 +7339,14 @@ - cf_cv_shlib_version_infix=no - - case $cf_cv_system_name in #(vi -- aix[56]*) #(vi -+ aix4.3-9*|aix[5-7]*) #(vi - if test "$GCC" = yes; then - CC_SHARED_OPTS= -- MK_SHARED_LIB='$(CC) -shared' -+ MK_SHARED_LIB='${CC} -shared -Wl,-brtl -Wl,-blibpath:${RPATH_LIST}:/usr/lib -o $@' -+ else -+ # CC_SHARED_OPTS='-qpic=large -G' -+ # perhaps "-bM:SRE -bnoentry -bexpall" -+ MK_SHARED_LIB='${CC} -G -Wl,-brtl -Wl,-blibpath:${RPATH_LIST}:/usr/lib -o $@' - fi - ;; - beos*) #(vi -@@ -7442,9 +7354,12 @@ - ;; - cygwin*) #(vi - CC_SHARED_OPTS= -- MK_SHARED_LIB='sh ../mk_shared_lib.sh $@ ${CC} ${CFLAGS}' -+ MK_SHARED_LIB='sh '$rel_builddir'/mk_shared_lib.sh $@ ${CC} ${CFLAGS}' -+ RM_SHARED_OPTS="$RM_SHARED_OPTS $rel_builddir/mk_shared_lib.sh *.dll.a" - cf_cv_shlib_version=cygdll - cf_cv_shlib_version_infix=cygdll -+ shlibdir=$bindir -+ MAKE_DLLS= - cat >mk_shared_lib.sh <<-CF_EOF - #!/bin/sh - SHARED_LIB=\$1 -@@ -7455,17 +7370,39 @@ - ** SHARED_LIB \$SHARED_LIB - ** IMPORT_LIB \$IMPORT_LIB - EOF -- exec \$* -shared -Wl,--out-implib=../lib/\${IMPORT_LIB} -Wl,--export-all-symbols -o ../lib/\${SHARED_LIB} -+ exec \$* -shared -Wl,--out-implib=\${IMPORT_LIB} -Wl,--export-all-symbols -o \${SHARED_LIB} -+CF_EOF -+ chmod +x mk_shared_lib.sh -+ ;; -+ msys*) #(vi -+ CC_SHARED_OPTS= -+ MK_SHARED_LIB='sh '$rel_builddir'/mk_shared_lib.sh $@ ${CC} ${CFLAGS}' -+ RM_SHARED_OPTS="$RM_SHARED_OPTS $rel_builddir/mk_shared_lib.sh *.dll.a" -+ cf_cv_shlib_version=msysdll -+ cf_cv_shlib_version_infix=msysdll -+ shlibdir=$bindir -+ MAKE_DLLS= -+ cat >mk_shared_lib.sh <<-CF_EOF -+ #!/bin/sh -+ SHARED_LIB=\$1 -+ IMPORT_LIB=\`echo "\$1" | sed -e 's/msys-/lib/' -e 's/[0-9]*\.dll$/.dll.a/'\` -+ shift -+ cat <<-EOF -+ Linking shared library -+ ** SHARED_LIB \$SHARED_LIB -+ ** IMPORT_LIB \$IMPORT_LIB -+EOF -+ exec \$* -shared -Wl,--out-implib=\${IMPORT_LIB} -Wl,--export-all-symbols -o \${SHARED_LIB} - CF_EOF - chmod +x mk_shared_lib.sh - ;; - darwin*) #(vi -- EXTRA_CFLAGS="-no-cpp-precomp" -+ cf_try_cflags="no-cpp-precomp" - CC_SHARED_OPTS="-dynamic" - MK_SHARED_LIB='${CC} ${CFLAGS} -dynamiclib -install_name ${libdir}/`basename $@` -compatibility_version ${ABI_VERSION} -current_version ${ABI_VERSION} -o $@' - test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=abi - cf_cv_shlib_version_infix=yes -- echo "$as_me:7468: checking if ld -search_paths_first works" >&5 -+ echo "$as_me:7405: checking if ld -search_paths_first works" >&5 - echo $ECHO_N "checking if ld -search_paths_first works... $ECHO_C" >&6 - if test "${cf_cv_ldflags_search_paths_first+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -7474,7 +7411,7 @@ - cf_save_LDFLAGS=$LDFLAGS - LDFLAGS="$LDFLAGS -Wl,-search_paths_first" - cat >conftest.$ac_ext <<_ACEOF --#line 7477 "configure" -+#line 7414 "configure" - #include "confdefs.h" - - int -@@ -7486,16 +7423,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:7489: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:7426: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:7492: \$? = $ac_status" >&5 -+ echo "$as_me:7429: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:7495: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:7432: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:7498: \$? = $ac_status" >&5 -+ echo "$as_me:7435: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_cv_ldflags_search_paths_first=yes - else -@@ -7506,12 +7443,20 @@ - rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - LDFLAGS=$cf_save_LDFLAGS - fi --echo "$as_me:7509: result: $cf_cv_ldflags_search_paths_first" >&5 -+echo "$as_me:7446: result: $cf_cv_ldflags_search_paths_first" >&5 - echo "${ECHO_T}$cf_cv_ldflags_search_paths_first" >&6 - if test $cf_cv_ldflags_search_paths_first = yes; then - LDFLAGS="$LDFLAGS -Wl,-search_paths_first" - fi - ;; -+ hpux[7-8]*) #(vi -+ # HP-UX 8.07 ld lacks "+b" option used for libdir search-list -+ if test "$GCC" != yes; then -+ CC_SHARED_OPTS='+Z' -+ fi -+ MK_SHARED_LIB='${LD} -b -o $@' -+ INSTALL_LIB="-m 555" -+ ;; - hpux*) #(vi - # (tested with gcc 2.7.2 -- I don't have c89) - if test "$GCC" = yes; then -@@ -7525,9 +7470,19 @@ - # readonly to exploit a quirk in the memory manager. - INSTALL_LIB="-m 555" - ;; -+ interix*) -+ test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel -+ if test "$cf_cv_shlib_version" = rel; then -+ cf_shared_soname='`basename .${REL_VERSION}`.${ABI_VERSION}' -+ else -+ cf_shared_soname='`basename `' -+ fi -+ CC_SHARED_OPTS= -+ MK_SHARED_LIB='${CC} -shared -Wl,-rpath,${RPATH_LIST} -Wl,-h,'$cf_shared_soname' -o ' -+ ;; - irix*) #(vi - if test "$cf_cv_enable_rpath" = yes ; then -- EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${libdir} $EXTRA_LDFLAGS" -+ EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS" - fi - # tested with IRIX 5.2 and 'cc'. - if test "$GCC" != yes; then -@@ -7544,7 +7499,7 @@ - LOCAL_LDFLAGS2="$LOCAL_LDFLAGS" - fi - if test "$cf_cv_enable_rpath" = yes ; then -- EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${libdir} $EXTRA_LDFLAGS" -+ EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS" - fi - - test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel -@@ -7556,13 +7511,40 @@ - - MK_SHARED_LIB='${CC} ${CFLAGS} -shared -Wl,-soname,'$cf_cv_shared_soname',-stats,-lc -o $@' - ;; -- openbsd[2-9].*) #(vi -+ mingw*) #(vi -+ cf_cv_shlib_version=mingw -+ cf_cv_shlib_version_infix=mingw -+ shlibdir=$bindir -+ MAKE_DLLS= -+ if test "$DFT_LWR_MODEL" = "shared" ; then -+ LOCAL_LDFLAGS="-Wl,--enable-auto-import" -+ LOCAL_LDFLAGS2="$LOCAL_LDFLAGS" -+ EXTRA_LDFLAGS="-Wl,--enable-auto-import $EXTRA_LDFLAGS" -+ fi -+ CC_SHARED_OPTS= -+ MK_SHARED_LIB='sh '$rel_builddir'/mk_shared_lib.sh $@ ${CC} ${CFLAGS}' -+ RM_SHARED_OPTS="$RM_SHARED_OPTS $rel_builddir/mk_shared_lib.sh *.dll.a" -+ cat >mk_shared_lib.sh <<-CF_EOF -+ #!/bin/sh -+ SHARED_LIB=\$1 -+ IMPORT_LIB=\`echo "\$1" | sed -e 's/[0-9]*\.dll$/.dll.a/'\` -+ shift -+ cat <<-EOF -+ Linking shared library -+ ** SHARED_LIB \$SHARED_LIB -+ ** IMPORT_LIB \$IMPORT_LIB -+EOF -+ exec \$* -shared -Wl,--enable-auto-import,--out-implib=\${IMPORT_LIB} -Wl,--export-all-symbols -o \${SHARED_LIB} -+CF_EOF -+ chmod +x mk_shared_lib.sh -+ ;; -+ openbsd[2-9].*|mirbsd*) #(vi - if test "$DFT_LWR_MODEL" = "shared" ; then - LOCAL_LDFLAGS="${LD_RPATH_OPT}\$(LOCAL_LIBDIR)" - LOCAL_LDFLAGS2="$LOCAL_LDFLAGS" - fi - if test "$cf_cv_enable_rpath" = yes ; then -- EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${libdir} $EXTRA_LDFLAGS" -+ EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS" - fi - CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC" - -@@ -7580,12 +7562,12 @@ - MK_SHARED_LIB='${LD} -Bshareable -o $@' - test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel - ;; -- freebsd*) #(vi -+ dragonfly*|freebsd*) #(vi - CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC" - if test "$DFT_LWR_MODEL" = "shared" && test "$cf_cv_enable_rpath" = yes ; then - LOCAL_LDFLAGS="${cf_ld_rpath_opt}\$(LOCAL_LIBDIR)" -- LOCAL_LDFLAGS2="${cf_ld_rpath_opt}\${libdir} $LOCAL_LDFLAGS" -- EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${libdir} $EXTRA_LDFLAGS" -+ LOCAL_LDFLAGS2="${cf_ld_rpath_opt}\${RPATH_LIST} $LOCAL_LDFLAGS" -+ EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS" - fi - - test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel -@@ -7602,7 +7584,7 @@ - if test "$DFT_LWR_MODEL" = "shared" && test "$cf_cv_enable_rpath" = yes ; then - LOCAL_LDFLAGS="${cf_ld_rpath_opt}\$(LOCAL_LIBDIR)" - LOCAL_LDFLAGS2="$LOCAL_LDFLAGS" -- EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${libdir} $EXTRA_LDFLAGS" -+ EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS" - if test "$cf_cv_shlib_version" = auto; then - if test -f /usr/libexec/ld.elf_so; then - cf_cv_shlib_version=abi -@@ -7620,7 +7602,7 @@ - - MK_SHARED_LIB='${CC} ${CFLAGS} -shared -Wl,-soname,'$cf_cv_shared_soname' -o $@' - else -- MK_SHARED_LIB='${LD} -shared -Bshareable -o $@' -+ MK_SHARED_LIB='${CC} -Wl,-shared -Wl,-Bshareable -o $@' - fi - ;; - osf*|mls+*) #(vi -@@ -7686,7 +7668,7 @@ - do - CFLAGS="$cf_shared_opts $cf_save_CFLAGS" - cat >conftest.$ac_ext <<_ACEOF --#line 7689 "configure" -+#line 7671 "configure" - #include "confdefs.h" - #include - int -@@ -7698,16 +7680,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:7701: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:7683: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:7704: \$? = $ac_status" >&5 -+ echo "$as_me:7686: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:7707: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:7689: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:7710: \$? = $ac_status" >&5 -+ echo "$as_me:7692: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - break - else -@@ -7744,22 +7726,65 @@ - test "$cf_cv_do_symlinks" = no && cf_cv_do_symlinks=yes - ;; - *) -- { echo "$as_me:7747: WARNING: ignored --with-shlib-version" >&5 -+ { echo "$as_me:7729: WARNING: ignored --with-shlib-version" >&5 - echo "$as_me: WARNING: ignored --with-shlib-version" >&2;} - ;; - esac - ;; - esac - -- if test -n "$cf_ld_rpath_opt" ; then -- MK_SHARED_LIB="$MK_SHARED_LIB $cf_ld_rpath_opt\${libdir}" -+ if test -n "$cf_try_cflags" -+ then -+cat > conftest.$ac_ext < -+int main(int argc, char *argv[]) -+{ -+ printf("hello\n"); -+ return (argv[argc-1] == 0) ; -+} -+EOF -+ cf_save_CFLAGS="$CFLAGS" -+ for cf_opt in $cf_try_cflags -+ do -+ CFLAGS="$cf_save_CFLAGS -$cf_opt" -+ echo "$as_me:7751: checking if CFLAGS option -$cf_opt works" >&5 -+echo $ECHO_N "checking if CFLAGS option -$cf_opt works... $ECHO_C" >&6 -+ if { (eval echo "$as_me:7753: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>&5 -+ ac_status=$? -+ echo "$as_me:7756: \$? = $ac_status" >&5 -+ (exit $ac_status); }; then -+ echo "$as_me:7758: result: yes" >&5 -+echo "${ECHO_T}yes" >&6 -+ cf_save_CFLAGS="$CFLAGS" -+ else -+ echo "$as_me:7762: result: no" >&5 -+echo "${ECHO_T}no" >&6 -+ fi -+ done -+ CFLAGS="$cf_save_CFLAGS" - fi - -+ # RPATH_LIST is a colon-separated list of directories -+ test -n "$cf_ld_rpath_opt" && MK_SHARED_LIB="$MK_SHARED_LIB $cf_ld_rpath_opt\${RPATH_LIST}" -+ test -z "$RPATH_LIST" && RPATH_LIST="\${libdir}" -+ -+ test $cf_cv_rm_so_locs = yes && RM_SHARED_OPTS="$RM_SHARED_OPTS so_locations" -+ -+ test -n "$verbose" && echo " CC_SHARED_OPTS: $CC_SHARED_OPTS" 1>&6 -+ -+echo "${as_me:-configure}:7777: testing CC_SHARED_OPTS: $CC_SHARED_OPTS ..." 1>&5 -+ -+ test -n "$verbose" && echo " MK_SHARED_LIB: $MK_SHARED_LIB" 1>&6 -+ -+echo "${as_me:-configure}:7781: testing MK_SHARED_LIB: $MK_SHARED_LIB ..." 1>&5 -+ - # The test/sample programs in the original tree link using rpath option. - # Make it optional for packagers. - if test -n "$LOCAL_LDFLAGS" - then -- echo "$as_me:7762: checking if you want to link sample programs with rpath option" >&5 -+ echo "$as_me:7787: checking if you want to link sample programs with rpath option" >&5 - echo $ECHO_N "checking if you want to link sample programs with rpath option... $ECHO_C" >&6 - - # Check whether --enable-rpath-link or --disable-rpath-link was given. -@@ -7769,7 +7794,7 @@ - else - with_rpath_link=yes - fi; -- echo "$as_me:7772: result: $with_rpath_link" >&5 -+ echo "$as_me:7797: result: $with_rpath_link" >&5 - echo "${ECHO_T}$with_rpath_link" >&6 - if test "$with_rpath_link" = no - then -@@ -7780,13 +7805,8 @@ - - ############################################################################### - -- case $cf_cv_system_name in -- os2*) PATH_SEPARATOR=';' ;; -- *) PATH_SEPARATOR=':' ;; -- esac -- - ### use option --enable-broken-linker to force on use of broken-linker support --echo "$as_me:7789: checking if you want broken-linker support code" >&5 -+echo "$as_me:7809: checking if you want broken-linker support code" >&5 - echo $ECHO_N "checking if you want broken-linker support code... $ECHO_C" >&6 - - # Check whether --enable-broken_linker or --disable-broken_linker was given. -@@ -7796,7 +7816,7 @@ - else - with_broken_linker=${BROKEN_LINKER:-no} - fi; --echo "$as_me:7799: result: $with_broken_linker" >&5 -+echo "$as_me:7819: result: $with_broken_linker" >&5 - echo "${ECHO_T}$with_broken_linker" >&6 - - BROKEN_LINKER=0 -@@ -7816,7 +7836,7 @@ - BROKEN_LINKER=1 - test -n "$verbose" && echo " cygwin linker is broken anyway" 1>&6 - --echo "${as_me:-configure}:7819: testing cygwin linker is broken anyway ..." 1>&5 -+echo "${as_me:-configure}:7839: testing cygwin linker is broken anyway ..." 1>&5 - - ;; - esac -@@ -7829,10 +7849,10 @@ - cf_xopen_source= - - case $host_os in #(vi --aix[456]*) #(vi -+aix[4-7]*) #(vi - cf_xopen_source="-D_ALL_SOURCE" - ;; --cygwin) #(vi -+cygwin|msys) #(vi - cf_XOPEN_SOURCE=600 - ;; - darwin[0-8].*) #(vi -@@ -7840,6 +7860,7 @@ - ;; - darwin*) #(vi - cf_xopen_source="-D_DARWIN_C_SOURCE" -+ cf_XOPEN_SOURCE= - ;; - freebsd*|dragonfly*) #(vi - # 5.x headers associate -@@ -7857,24 +7878,128 @@ - ;; - irix[56].*) #(vi - cf_xopen_source="-D_SGI_SOURCE" -+ cf_XOPEN_SOURCE= - ;; - linux*|gnu*|mint*|k*bsd*-gnu) #(vi - --echo "$as_me:7863: checking if we must define _GNU_SOURCE" >&5 -+echo "$as_me:7885: checking if we must define _GNU_SOURCE" >&5 - echo $ECHO_N "checking if we must define _GNU_SOURCE... $ECHO_C" >&6 - if test "${cf_cv_gnu_source+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - --cat >conftest.$ac_ext <<_ACEOF --#line 7870 "configure" -+cat >conftest.$ac_ext <<_ACEOF -+#line 7892 "configure" -+#include "confdefs.h" -+#include -+int -+main () -+{ -+ -+#ifndef _XOPEN_SOURCE -+make an error -+#endif -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:7907: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>&5 -+ ac_status=$? -+ echo "$as_me:7910: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:7913: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:7916: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ cf_cv_gnu_source=no -+else -+ echo "$as_me: failed program was:" >&5 -+cat conftest.$ac_ext >&5 -+cf_save="$CPPFLAGS" -+ CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" -+ cat >conftest.$ac_ext <<_ACEOF -+#line 7925 "configure" -+#include "confdefs.h" -+#include -+int -+main () -+{ -+ -+#ifdef _XOPEN_SOURCE -+make an error -+#endif -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:7940: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>&5 -+ ac_status=$? -+ echo "$as_me:7943: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:7946: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:7949: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ cf_cv_gnu_source=no -+else -+ echo "$as_me: failed program was:" >&5 -+cat conftest.$ac_ext >&5 -+cf_cv_gnu_source=yes -+fi -+rm -f conftest.$ac_objext conftest.$ac_ext -+ CPPFLAGS="$cf_save" -+ -+fi -+rm -f conftest.$ac_objext conftest.$ac_ext -+ -+fi -+echo "$as_me:7964: result: $cf_cv_gnu_source" >&5 -+echo "${ECHO_T}$cf_cv_gnu_source" >&6 -+test "$cf_cv_gnu_source" = yes && CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" -+ -+ ;; -+mirbsd*) #(vi -+ # setting _XOPEN_SOURCE or _POSIX_SOURCE breaks and other headers which use u_int / u_short types -+ cf_XOPEN_SOURCE= -+ -+cf_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE -+ -+cf_save_CFLAGS="$CFLAGS" -+cf_save_CPPFLAGS="$CPPFLAGS" -+ -+cf_trim_CFLAGS=`echo "$cf_save_CFLAGS" | \ -+ sed -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \ -+ -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?$//g'` -+ -+cf_trim_CPPFLAGS=`echo "$cf_save_CPPFLAGS" | \ -+ sed -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \ -+ -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?$//g'` -+ -+echo "$as_me:7986: checking if we should define _POSIX_C_SOURCE" >&5 -+echo $ECHO_N "checking if we should define _POSIX_C_SOURCE... $ECHO_C" >&6 -+if test "${cf_cv_posix_c_source+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ -+echo "${as_me:-configure}:7992: testing if the symbol is already defined go no further ..." 1>&5 -+ -+ cat >conftest.$ac_ext <<_ACEOF -+#line 7995 "configure" - #include "confdefs.h" - #include - int - main () - { - --#ifndef _XOPEN_SOURCE -+#ifndef _POSIX_C_SOURCE - make an error - #endif - ; -@@ -7882,32 +8007,87 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:7885: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:8010: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:7888: \$? = $ac_status" >&5 -+ echo "$as_me:8013: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:7891: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:8016: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:7894: \$? = $ac_status" >&5 -+ echo "$as_me:8019: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- cf_cv_gnu_source=no -+ cf_cv_posix_c_source=no - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --cf_save="$CPPFLAGS" -- CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" -+cf_want_posix_source=no -+ case .$cf_POSIX_C_SOURCE in #(vi -+ .[12]??*) #(vi -+ cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" -+ ;; -+ .2) #(vi -+ cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" -+ cf_want_posix_source=yes -+ ;; -+ .*) -+ cf_want_posix_source=yes -+ ;; -+ esac -+ if test "$cf_want_posix_source" = yes ; then -+ cat >conftest.$ac_ext <<_ACEOF -+#line 8040 "configure" -+#include "confdefs.h" -+#include -+int -+main () -+{ -+ -+#ifdef _POSIX_SOURCE -+make an error -+#endif -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:8055: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>&5 -+ ac_status=$? -+ echo "$as_me:8058: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:8061: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:8064: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ : -+else -+ echo "$as_me: failed program was:" >&5 -+cat conftest.$ac_ext >&5 -+cf_cv_posix_c_source="$cf_cv_posix_c_source -D_POSIX_SOURCE" -+fi -+rm -f conftest.$ac_objext conftest.$ac_ext -+ fi -+ -+echo "${as_me:-configure}:8075: testing ifdef from value $cf_POSIX_C_SOURCE ..." 1>&5 -+ -+ CFLAGS="$cf_trim_CFLAGS" -+ CPPFLAGS="$cf_trim_CPPFLAGS $cf_cv_posix_c_source" -+ -+echo "${as_me:-configure}:8080: testing if the second compile does not leave our definition intact error ..." 1>&5 -+ - cat >conftest.$ac_ext <<_ACEOF --#line 7903 "configure" -+#line 8083 "configure" - #include "confdefs.h" - #include - int - main () - { - --#ifdef _XOPEN_SOURCE -+#ifndef _POSIX_C_SOURCE - make an error - #endif - ; -@@ -7915,40 +8095,126 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:7918: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:8098: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:7921: \$? = $ac_status" >&5 -+ echo "$as_me:8101: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:7924: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:8104: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:7927: \$? = $ac_status" >&5 -+ echo "$as_me:8107: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- cf_cv_gnu_source=no -+ : - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --cf_cv_gnu_source=yes -+cf_cv_posix_c_source=no - fi - rm -f conftest.$ac_objext conftest.$ac_ext -- CPPFLAGS="$cf_save" -+ CFLAGS="$cf_save_CFLAGS" -+ CPPFLAGS="$cf_save_CPPFLAGS" - - fi - rm -f conftest.$ac_objext conftest.$ac_ext - - fi --echo "$as_me:7942: result: $cf_cv_gnu_source" >&5 --echo "${ECHO_T}$cf_cv_gnu_source" >&6 --test "$cf_cv_gnu_source" = yes && CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" -+echo "$as_me:8123: result: $cf_cv_posix_c_source" >&5 -+echo "${ECHO_T}$cf_cv_posix_c_source" >&6 -+ -+if test "$cf_cv_posix_c_source" != no ; then -+ CFLAGS="$cf_trim_CFLAGS" -+ CPPFLAGS="$cf_trim_CPPFLAGS" -+ -+cf_fix_cppflags=no -+cf_new_cflags= -+cf_new_cppflags= -+cf_new_extra_cppflags= -+ -+for cf_add_cflags in $cf_cv_posix_c_source -+do -+case $cf_fix_cppflags in -+no) -+ case $cf_add_cflags in #(vi -+ -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi -+ case $cf_add_cflags in -+ -D*) -+ cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` -+ -+ test "${cf_add_cflags}" != "${cf_tst_cflags}" \ -+ && test -z "${cf_tst_cflags}" \ -+ && cf_fix_cppflags=yes -+ -+ if test $cf_fix_cppflags = yes ; then -+ cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -+ continue -+ elif test "${cf_tst_cflags}" = "\"'" ; then -+ cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -+ continue -+ fi -+ ;; -+ esac -+ case "$CPPFLAGS" in -+ *$cf_add_cflags) #(vi -+ ;; -+ *) #(vi -+ case $cf_add_cflags in #(vi -+ -D*) -+ cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` -+ -+CPPFLAGS=`echo "$CPPFLAGS" | \ -+ sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ -+ -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` -+ -+ ;; -+ esac -+ cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" -+ ;; -+ esac -+ ;; -+ *) -+ cf_new_cflags="$cf_new_cflags $cf_add_cflags" -+ ;; -+ esac -+ ;; -+yes) -+ cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" - -+ cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` -+ -+ test "${cf_add_cflags}" != "${cf_tst_cflags}" \ -+ && test -z "${cf_tst_cflags}" \ -+ && cf_fix_cppflags=no - ;; --mirbsd*) #(vi -- # setting _XOPEN_SOURCE or _POSIX_SOURCE breaks -+esac -+done -+ -+if test -n "$cf_new_cflags" ; then -+ -+ CFLAGS="$CFLAGS $cf_new_cflags" -+fi -+ -+if test -n "$cf_new_cppflags" ; then -+ -+ CPPFLAGS="$CPPFLAGS $cf_new_cppflags" -+fi -+ -+if test -n "$cf_new_extra_cppflags" ; then -+ -+ EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" -+fi -+ -+fi -+ - ;; - netbsd*) #(vi -- # setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw -+ cf_xopen_source="-D_NETBSD_SOURCE" # setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw -+ ;; -+openbsd[4-9]*) #(vi -+ # setting _XOPEN_SOURCE lower than 500 breaks g++ compile with wchar.h, needed for ncursesw -+ cf_xopen_source="-D_BSD_SOURCE" -+ cf_XOPEN_SOURCE=600 - ;; - openbsd*) #(vi - # setting _XOPEN_SOURCE breaks xterm on OpenBSD 2.8, is not needed for ncursesw -@@ -7962,23 +8228,26 @@ - sco*) #(vi - # setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer - ;; --solaris2.1[0-9]) #(vi -- cf_xopen_source="-D__EXTENSIONS__ -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" -- ;; --solaris2.[1-9]) #(vi -+solaris2.*) #(vi - cf_xopen_source="-D__EXTENSIONS__" -+ cf_cv_xopen_source=broken - ;; - *) -- echo "$as_me:7972: checking if we should define _XOPEN_SOURCE" >&5 -+ -+echo "$as_me:8237: checking if we should define _XOPEN_SOURCE" >&5 - echo $ECHO_N "checking if we should define _XOPEN_SOURCE... $ECHO_C" >&6 - if test "${cf_cv_xopen_source+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - - cat >conftest.$ac_ext <<_ACEOF --#line 7979 "configure" -+#line 8244 "configure" - #include "confdefs.h" -+ -+#include -+#include - #include -+ - int - main () - { -@@ -7991,16 +8260,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:7994: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:8263: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:7997: \$? = $ac_status" >&5 -+ echo "$as_me:8266: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:8000: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:8269: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:8003: \$? = $ac_status" >&5 -+ echo "$as_me:8272: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_cv_xopen_source=no - else -@@ -8009,9 +8278,13 @@ - cf_save="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" - cat >conftest.$ac_ext <<_ACEOF --#line 8012 "configure" -+#line 8281 "configure" - #include "confdefs.h" -+ -+#include -+#include - #include -+ - int - main () - { -@@ -8024,16 +8297,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:8027: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:8300: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:8030: \$? = $ac_status" >&5 -+ echo "$as_me:8303: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:8033: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:8306: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:8036: \$? = $ac_status" >&5 -+ echo "$as_me:8309: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_cv_xopen_source=no - else -@@ -8048,9 +8321,10 @@ - rm -f conftest.$ac_objext conftest.$ac_ext - - fi --echo "$as_me:8051: result: $cf_cv_xopen_source" >&5 -+echo "$as_me:8324: result: $cf_cv_xopen_source" >&5 - echo "${ECHO_T}$cf_cv_xopen_source" >&6 -- if test "$cf_cv_xopen_source" != no ; then -+ -+if test "$cf_cv_xopen_source" != no ; then - - CFLAGS=`echo "$CFLAGS" | \ - sed -e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \ -@@ -8060,7 +8334,7 @@ - sed -e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \ - -e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ ]*\)\?$//g'` - -- cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source" -+ cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source" - - cf_fix_cppflags=no - cf_new_cflags= -@@ -8140,7 +8414,7 @@ - EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" - fi - -- fi -+fi - - cf_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE - -@@ -8155,16 +8429,16 @@ - sed -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \ - -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?$//g'` - --echo "$as_me:8158: checking if we should define _POSIX_C_SOURCE" >&5 -+echo "$as_me:8432: checking if we should define _POSIX_C_SOURCE" >&5 - echo $ECHO_N "checking if we should define _POSIX_C_SOURCE... $ECHO_C" >&6 - if test "${cf_cv_posix_c_source+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - --echo "${as_me:-configure}:8164: testing if the symbol is already defined go no further ..." 1>&5 -+echo "${as_me:-configure}:8438: testing if the symbol is already defined go no further ..." 1>&5 - - cat >conftest.$ac_ext <<_ACEOF --#line 8167 "configure" -+#line 8441 "configure" - #include "confdefs.h" - #include - int -@@ -8179,16 +8453,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:8182: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:8456: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:8185: \$? = $ac_status" >&5 -+ echo "$as_me:8459: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:8188: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:8462: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:8191: \$? = $ac_status" >&5 -+ echo "$as_me:8465: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_cv_posix_c_source=no - else -@@ -8209,7 +8483,7 @@ - esac - if test "$cf_want_posix_source" = yes ; then - cat >conftest.$ac_ext <<_ACEOF --#line 8212 "configure" -+#line 8486 "configure" - #include "confdefs.h" - #include - int -@@ -8224,16 +8498,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:8227: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:8501: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:8230: \$? = $ac_status" >&5 -+ echo "$as_me:8504: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:8233: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:8507: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:8236: \$? = $ac_status" >&5 -+ echo "$as_me:8510: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : - else -@@ -8244,15 +8518,15 @@ - rm -f conftest.$ac_objext conftest.$ac_ext - fi - --echo "${as_me:-configure}:8247: testing ifdef from value $cf_POSIX_C_SOURCE ..." 1>&5 -+echo "${as_me:-configure}:8521: testing ifdef from value $cf_POSIX_C_SOURCE ..." 1>&5 - - CFLAGS="$cf_trim_CFLAGS" - CPPFLAGS="$cf_trim_CPPFLAGS $cf_cv_posix_c_source" - --echo "${as_me:-configure}:8252: testing if the second compile does not leave our definition intact error ..." 1>&5 -+echo "${as_me:-configure}:8526: testing if the second compile does not leave our definition intact error ..." 1>&5 - - cat >conftest.$ac_ext <<_ACEOF --#line 8255 "configure" -+#line 8529 "configure" - #include "confdefs.h" - #include - int -@@ -8267,16 +8541,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:8270: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:8544: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:8273: \$? = $ac_status" >&5 -+ echo "$as_me:8547: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:8276: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:8550: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:8279: \$? = $ac_status" >&5 -+ echo "$as_me:8553: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : - else -@@ -8289,22 +8563,107 @@ - CPPFLAGS="$cf_save_CPPFLAGS" - - fi --rm -f conftest.$ac_objext conftest.$ac_ext -+rm -f conftest.$ac_objext conftest.$ac_ext -+ -+fi -+echo "$as_me:8569: result: $cf_cv_posix_c_source" >&5 -+echo "${ECHO_T}$cf_cv_posix_c_source" >&6 -+ -+if test "$cf_cv_posix_c_source" != no ; then -+ CFLAGS="$cf_trim_CFLAGS" -+ CPPFLAGS="$cf_trim_CPPFLAGS" -+ -+cf_fix_cppflags=no -+cf_new_cflags= -+cf_new_cppflags= -+cf_new_extra_cppflags= -+ -+for cf_add_cflags in $cf_cv_posix_c_source -+do -+case $cf_fix_cppflags in -+no) -+ case $cf_add_cflags in #(vi -+ -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi -+ case $cf_add_cflags in -+ -D*) -+ cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` -+ -+ test "${cf_add_cflags}" != "${cf_tst_cflags}" \ -+ && test -z "${cf_tst_cflags}" \ -+ && cf_fix_cppflags=yes -+ -+ if test $cf_fix_cppflags = yes ; then -+ cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -+ continue -+ elif test "${cf_tst_cflags}" = "\"'" ; then -+ cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -+ continue -+ fi -+ ;; -+ esac -+ case "$CPPFLAGS" in -+ *$cf_add_cflags) #(vi -+ ;; -+ *) #(vi -+ case $cf_add_cflags in #(vi -+ -D*) -+ cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` -+ -+CPPFLAGS=`echo "$CPPFLAGS" | \ -+ sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ -+ -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` -+ -+ ;; -+ esac -+ cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" -+ ;; -+ esac -+ ;; -+ *) -+ cf_new_cflags="$cf_new_cflags $cf_add_cflags" -+ ;; -+ esac -+ ;; -+yes) -+ cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -+ -+ cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` -+ -+ test "${cf_add_cflags}" != "${cf_tst_cflags}" \ -+ && test -z "${cf_tst_cflags}" \ -+ && cf_fix_cppflags=no -+ ;; -+esac -+done -+ -+if test -n "$cf_new_cflags" ; then -+ -+ CFLAGS="$CFLAGS $cf_new_cflags" -+fi -+ -+if test -n "$cf_new_cppflags" ; then -+ -+ CPPFLAGS="$CPPFLAGS $cf_new_cppflags" -+fi -+ -+if test -n "$cf_new_extra_cppflags" ; then -+ -+ EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" -+fi - - fi --echo "$as_me:8295: result: $cf_cv_posix_c_source" >&5 --echo "${ECHO_T}$cf_cv_posix_c_source" >&6 - --if test "$cf_cv_posix_c_source" != no ; then -- CFLAGS="$cf_trim_CFLAGS" -- CPPFLAGS="$cf_trim_CPPFLAGS" -+ ;; -+esac -+ -+if test -n "$cf_xopen_source" ; then - - cf_fix_cppflags=no - cf_new_cflags= - cf_new_cppflags= - cf_new_extra_cppflags= - --for cf_add_cflags in $cf_cv_posix_c_source -+for cf_add_cflags in $cf_xopen_source - do - case $cf_fix_cppflags in - no) -@@ -8379,17 +8738,196 @@ - - fi - -- ;; --esac -+if test -n "$cf_XOPEN_SOURCE" && test -z "$cf_cv_xopen_source" ; then -+ echo "$as_me:8742: checking if _XOPEN_SOURCE really is set" >&5 -+echo $ECHO_N "checking if _XOPEN_SOURCE really is set... $ECHO_C" >&6 -+ cat >conftest.$ac_ext <<_ACEOF -+#line 8745 "configure" -+#include "confdefs.h" -+#include -+int -+main () -+{ - --if test -n "$cf_xopen_source" ; then -+#ifndef _XOPEN_SOURCE -+make an error -+#endif -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:8760: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>&5 -+ ac_status=$? -+ echo "$as_me:8763: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:8766: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:8769: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ cf_XOPEN_SOURCE_set=yes -+else -+ echo "$as_me: failed program was:" >&5 -+cat conftest.$ac_ext >&5 -+cf_XOPEN_SOURCE_set=no -+fi -+rm -f conftest.$ac_objext conftest.$ac_ext -+ echo "$as_me:8778: result: $cf_XOPEN_SOURCE_set" >&5 -+echo "${ECHO_T}$cf_XOPEN_SOURCE_set" >&6 -+ if test $cf_XOPEN_SOURCE_set = yes -+ then -+ cat >conftest.$ac_ext <<_ACEOF -+#line 8783 "configure" -+#include "confdefs.h" -+#include -+int -+main () -+{ -+ -+#if (_XOPEN_SOURCE - 0) < $cf_XOPEN_SOURCE -+make an error -+#endif -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:8798: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>&5 -+ ac_status=$? -+ echo "$as_me:8801: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:8804: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:8807: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ cf_XOPEN_SOURCE_set_ok=yes -+else -+ echo "$as_me: failed program was:" >&5 -+cat conftest.$ac_ext >&5 -+cf_XOPEN_SOURCE_set_ok=no -+fi -+rm -f conftest.$ac_objext conftest.$ac_ext -+ if test $cf_XOPEN_SOURCE_set_ok = no -+ then -+ { echo "$as_me:8818: WARNING: _XOPEN_SOURCE is lower than requested" >&5 -+echo "$as_me: WARNING: _XOPEN_SOURCE is lower than requested" >&2;} -+ fi -+ else -+ -+echo "$as_me:8823: checking if we should define _XOPEN_SOURCE" >&5 -+echo $ECHO_N "checking if we should define _XOPEN_SOURCE... $ECHO_C" >&6 -+if test "${cf_cv_xopen_source+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ -+ cat >conftest.$ac_ext <<_ACEOF -+#line 8830 "configure" -+#include "confdefs.h" -+ -+#include -+#include -+#include -+ -+int -+main () -+{ -+ -+#ifndef _XOPEN_SOURCE -+make an error -+#endif -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:8849: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>&5 -+ ac_status=$? -+ echo "$as_me:8852: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:8855: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:8858: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ cf_cv_xopen_source=no -+else -+ echo "$as_me: failed program was:" >&5 -+cat conftest.$ac_ext >&5 -+cf_save="$CPPFLAGS" -+ CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" -+ cat >conftest.$ac_ext <<_ACEOF -+#line 8867 "configure" -+#include "confdefs.h" -+ -+#include -+#include -+#include -+ -+int -+main () -+{ -+ -+#ifdef _XOPEN_SOURCE -+make an error -+#endif -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:8886: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>&5 -+ ac_status=$? -+ echo "$as_me:8889: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:8892: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:8895: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ cf_cv_xopen_source=no -+else -+ echo "$as_me: failed program was:" >&5 -+cat conftest.$ac_ext >&5 -+cf_cv_xopen_source=$cf_XOPEN_SOURCE -+fi -+rm -f conftest.$ac_objext conftest.$ac_ext -+ CPPFLAGS="$cf_save" -+ -+fi -+rm -f conftest.$ac_objext conftest.$ac_ext -+ -+fi -+echo "$as_me:8910: result: $cf_cv_xopen_source" >&5 -+echo "${ECHO_T}$cf_cv_xopen_source" >&6 -+ -+if test "$cf_cv_xopen_source" != no ; then -+ -+CFLAGS=`echo "$CFLAGS" | \ -+ sed -e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \ -+ -e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ ]*\)\?$//g'` -+ -+CPPFLAGS=`echo "$CPPFLAGS" | \ -+ sed -e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \ -+ -e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ ]*\)\?$//g'` -+ -+ cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source" - - cf_fix_cppflags=no - cf_new_cflags= - cf_new_cppflags= - cf_new_extra_cppflags= - --for cf_add_cflags in $cf_xopen_source -+for cf_add_cflags in $cf_temp_xopen_source - do - case $cf_fix_cppflags in - no) -@@ -8464,6 +9002,9 @@ - - fi - -+ fi -+fi -+ - # Check whether --enable-largefile or --disable-largefile was given. - if test "${enable_largefile+set}" = set; then - enableval="$enable_largefile" -@@ -8471,7 +9012,7 @@ - fi; - if test "$enable_largefile" != no; then - -- echo "$as_me:8474: checking for special C compiler options needed for large files" >&5 -+ echo "$as_me:9015: checking for special C compiler options needed for large files" >&5 - echo $ECHO_N "checking for special C compiler options needed for large files... $ECHO_C" >&6 - if test "${ac_cv_sys_largefile_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -8483,7 +9024,7 @@ - # IRIX 6.2 and later do not support large files by default, - # so use the C compiler's -n32 option if that helps. - cat >conftest.$ac_ext <<_ACEOF --#line 8486 "configure" -+#line 9027 "configure" - #include "confdefs.h" - #include - /* Check that off_t can represent 2**63 - 1 correctly. -@@ -8503,16 +9044,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:8506: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:9047: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:8509: \$? = $ac_status" >&5 -+ echo "$as_me:9050: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:8512: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:9053: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:8515: \$? = $ac_status" >&5 -+ echo "$as_me:9056: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - break - else -@@ -8522,16 +9063,16 @@ - rm -f conftest.$ac_objext - CC="$CC -n32" - rm -f conftest.$ac_objext --if { (eval echo "$as_me:8525: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:9066: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:8528: \$? = $ac_status" >&5 -+ echo "$as_me:9069: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:8531: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:9072: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:8534: \$? = $ac_status" >&5 -+ echo "$as_me:9075: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_sys_largefile_CC=' -n32'; break - else -@@ -8545,13 +9086,13 @@ - rm -f conftest.$ac_ext - fi - fi --echo "$as_me:8548: result: $ac_cv_sys_largefile_CC" >&5 -+echo "$as_me:9089: result: $ac_cv_sys_largefile_CC" >&5 - echo "${ECHO_T}$ac_cv_sys_largefile_CC" >&6 - if test "$ac_cv_sys_largefile_CC" != no; then - CC=$CC$ac_cv_sys_largefile_CC - fi - -- echo "$as_me:8554: checking for _FILE_OFFSET_BITS value needed for large files" >&5 -+ echo "$as_me:9095: checking for _FILE_OFFSET_BITS value needed for large files" >&5 - echo $ECHO_N "checking for _FILE_OFFSET_BITS value needed for large files... $ECHO_C" >&6 - if test "${ac_cv_sys_file_offset_bits+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -8559,7 +9100,7 @@ - while :; do - ac_cv_sys_file_offset_bits=no - cat >conftest.$ac_ext <<_ACEOF --#line 8562 "configure" -+#line 9103 "configure" - #include "confdefs.h" - #include - /* Check that off_t can represent 2**63 - 1 correctly. -@@ -8579,16 +9120,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:8582: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:9123: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:8585: \$? = $ac_status" >&5 -+ echo "$as_me:9126: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:8588: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:9129: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:8591: \$? = $ac_status" >&5 -+ echo "$as_me:9132: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - break - else -@@ -8597,7 +9138,7 @@ - fi - rm -f conftest.$ac_objext conftest.$ac_ext - cat >conftest.$ac_ext <<_ACEOF --#line 8600 "configure" -+#line 9141 "configure" - #include "confdefs.h" - #define _FILE_OFFSET_BITS 64 - #include -@@ -8618,16 +9159,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:8621: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:9162: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:8624: \$? = $ac_status" >&5 -+ echo "$as_me:9165: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:8627: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:9168: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:8630: \$? = $ac_status" >&5 -+ echo "$as_me:9171: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_sys_file_offset_bits=64; break - else -@@ -8638,7 +9179,7 @@ - break - done - fi --echo "$as_me:8641: result: $ac_cv_sys_file_offset_bits" >&5 -+echo "$as_me:9182: result: $ac_cv_sys_file_offset_bits" >&5 - echo "${ECHO_T}$ac_cv_sys_file_offset_bits" >&6 - if test "$ac_cv_sys_file_offset_bits" != no; then - -@@ -8648,7 +9189,7 @@ - - fi - rm -rf conftest* -- echo "$as_me:8651: checking for _LARGE_FILES value needed for large files" >&5 -+ echo "$as_me:9192: checking for _LARGE_FILES value needed for large files" >&5 - echo $ECHO_N "checking for _LARGE_FILES value needed for large files... $ECHO_C" >&6 - if test "${ac_cv_sys_large_files+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -8656,7 +9197,7 @@ - while :; do - ac_cv_sys_large_files=no - cat >conftest.$ac_ext <<_ACEOF --#line 8659 "configure" -+#line 9200 "configure" - #include "confdefs.h" - #include - /* Check that off_t can represent 2**63 - 1 correctly. -@@ -8676,16 +9217,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:8679: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:9220: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:8682: \$? = $ac_status" >&5 -+ echo "$as_me:9223: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:8685: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:9226: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:8688: \$? = $ac_status" >&5 -+ echo "$as_me:9229: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - break - else -@@ -8694,7 +9235,7 @@ - fi - rm -f conftest.$ac_objext conftest.$ac_ext - cat >conftest.$ac_ext <<_ACEOF --#line 8697 "configure" -+#line 9238 "configure" - #include "confdefs.h" - #define _LARGE_FILES 1 - #include -@@ -8715,16 +9256,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:8718: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:9259: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:8721: \$? = $ac_status" >&5 -+ echo "$as_me:9262: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:8724: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:9265: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:8727: \$? = $ac_status" >&5 -+ echo "$as_me:9268: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_sys_large_files=1; break - else -@@ -8735,7 +9276,7 @@ - break - done - fi --echo "$as_me:8738: result: $ac_cv_sys_large_files" >&5 -+echo "$as_me:9279: result: $ac_cv_sys_large_files" >&5 - echo "${ECHO_T}$ac_cv_sys_large_files" >&6 - if test "$ac_cv_sys_large_files" != no; then - -@@ -8748,7 +9289,7 @@ - fi - - if test "$enable_largefile" != no ; then -- echo "$as_me:8751: checking for _LARGEFILE_SOURCE value needed for large files" >&5 -+ echo "$as_me:9292: checking for _LARGEFILE_SOURCE value needed for large files" >&5 - echo $ECHO_N "checking for _LARGEFILE_SOURCE value needed for large files... $ECHO_C" >&6 - if test "${ac_cv_sys_largefile_source+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -8756,7 +9297,7 @@ - while :; do - ac_cv_sys_largefile_source=no - cat >conftest.$ac_ext <<_ACEOF --#line 8759 "configure" -+#line 9300 "configure" - #include "confdefs.h" - #include - int -@@ -8768,16 +9309,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:8771: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:9312: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:8774: \$? = $ac_status" >&5 -+ echo "$as_me:9315: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:8777: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:9318: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:8780: \$? = $ac_status" >&5 -+ echo "$as_me:9321: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - break - else -@@ -8786,7 +9327,7 @@ - fi - rm -f conftest.$ac_objext conftest.$ac_ext - cat >conftest.$ac_ext <<_ACEOF --#line 8789 "configure" -+#line 9330 "configure" - #include "confdefs.h" - #define _LARGEFILE_SOURCE 1 - #include -@@ -8799,16 +9340,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:8802: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:9343: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:8805: \$? = $ac_status" >&5 -+ echo "$as_me:9346: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:8808: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:9349: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:8811: \$? = $ac_status" >&5 -+ echo "$as_me:9352: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_sys_largefile_source=1; break - else -@@ -8819,7 +9360,7 @@ - break - done - fi --echo "$as_me:8822: result: $ac_cv_sys_largefile_source" >&5 -+echo "$as_me:9363: result: $ac_cv_sys_largefile_source" >&5 - echo "${ECHO_T}$ac_cv_sys_largefile_source" >&6 - if test "$ac_cv_sys_largefile_source" != no; then - -@@ -8833,13 +9374,13 @@ - # We used to try defining _XOPEN_SOURCE=500 too, to work around a bug - # in glibc 2.1.3, but that breaks too many other things. - # If you want fseeko and ftello with glibc, upgrade to a fixed glibc. --echo "$as_me:8836: checking for fseeko" >&5 -+echo "$as_me:9377: checking for fseeko" >&5 - echo $ECHO_N "checking for fseeko... $ECHO_C" >&6 - if test "${ac_cv_func_fseeko+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - cat >conftest.$ac_ext <<_ACEOF --#line 8842 "configure" -+#line 9383 "configure" - #include "confdefs.h" - #include - int -@@ -8851,16 +9392,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:8854: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:9395: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:8857: \$? = $ac_status" >&5 -+ echo "$as_me:9398: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:8860: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:9401: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:8863: \$? = $ac_status" >&5 -+ echo "$as_me:9404: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_func_fseeko=yes - else -@@ -8870,7 +9411,7 @@ - fi - rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - fi --echo "$as_me:8873: result: $ac_cv_func_fseeko" >&5 -+echo "$as_me:9414: result: $ac_cv_func_fseeko" >&5 - echo "${ECHO_T}$ac_cv_func_fseeko" >&6 - if test $ac_cv_func_fseeko = yes; then - -@@ -8891,14 +9432,14 @@ - test "$ac_cv_sys_largefile_source" != no && CPPFLAGS="$CPPFLAGS -D_LARGEFILE_SOURCE " - test "$ac_cv_sys_file_offset_bits" != no && CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits " - -- echo "$as_me:8894: checking whether to use struct dirent64" >&5 -+ echo "$as_me:9435: checking whether to use struct dirent64" >&5 - echo $ECHO_N "checking whether to use struct dirent64... $ECHO_C" >&6 - if test "${cf_cv_struct_dirent64+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - - cat >conftest.$ac_ext <<_ACEOF --#line 8901 "configure" -+#line 9442 "configure" - #include "confdefs.h" - - #include -@@ -8919,16 +9460,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:8922: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:9463: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:8925: \$? = $ac_status" >&5 -+ echo "$as_me:9466: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:8928: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:9469: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:8931: \$? = $ac_status" >&5 -+ echo "$as_me:9472: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_cv_struct_dirent64=yes - else -@@ -8939,16 +9480,17 @@ - rm -f conftest.$ac_objext conftest.$ac_ext - - fi --echo "$as_me:8942: result: $cf_cv_struct_dirent64" >&5 -+echo "$as_me:9483: result: $cf_cv_struct_dirent64" >&5 - echo "${ECHO_T}$cf_cv_struct_dirent64" >&6 -- test "$cf_cv_struct_dirent64" = yes && cat >>confdefs.h <<\EOF -+ test "$cf_cv_struct_dirent64" = yes && -+cat >>confdefs.h <<\EOF - #define HAVE_STRUCT_DIRENT64 1 - EOF - - fi - - ### Enable compiling-in rcs id's --echo "$as_me:8951: checking if RCS identifiers should be compiled-in" >&5 -+echo "$as_me:9493: checking if RCS identifiers should be compiled-in" >&5 - echo $ECHO_N "checking if RCS identifiers should be compiled-in... $ECHO_C" >&6 - - # Check whether --with-rcs-ids or --without-rcs-ids was given. -@@ -8958,16 +9500,17 @@ - else - with_rcs_ids=no - fi; --echo "$as_me:8961: result: $with_rcs_ids" >&5 -+echo "$as_me:9503: result: $with_rcs_ids" >&5 - echo "${ECHO_T}$with_rcs_ids" >&6 --test "$with_rcs_ids" = yes && cat >>confdefs.h <<\EOF -+test "$with_rcs_ids" = yes && -+cat >>confdefs.h <<\EOF - #define USE_RCS_IDS 1 - EOF - - ############################################################################### - - ### Note that some functions (such as const) are normally disabled anyway. --echo "$as_me:8970: checking if you want to build with function extensions" >&5 -+echo "$as_me:9513: checking if you want to build with function extensions" >&5 - echo $ECHO_N "checking if you want to build with function extensions... $ECHO_C" >&6 - - # Check whether --enable-ext-funcs or --disable-ext-funcs was given. -@@ -8977,15 +9520,16 @@ - else - with_ext_funcs=yes - fi; --echo "$as_me:8980: result: $with_ext_funcs" >&5 -+echo "$as_me:9523: result: $with_ext_funcs" >&5 - echo "${ECHO_T}$with_ext_funcs" >&6 - if test "$with_ext_funcs" = yes ; then - NCURSES_EXT_FUNCS=1 -- cat >>confdefs.h <<\EOF -+ -+cat >>confdefs.h <<\EOF - #define HAVE_USE_DEFAULT_COLORS 1 - EOF - -- cat >>confdefs.h <<\EOF -+cat >>confdefs.h <<\EOF - #define NCURSES_EXT_FUNCS 1 - EOF - -@@ -8994,7 +9538,7 @@ - fi - - ### use option --enable-const to turn on use of const beyond that in XSI. --echo "$as_me:8997: checking for extended use of const keyword" >&5 -+echo "$as_me:9541: checking for extended use of const keyword" >&5 - echo $ECHO_N "checking for extended use of const keyword... $ECHO_C" >&6 - - # Check whether --enable-const or --disable-const was given. -@@ -9004,7 +9548,7 @@ - else - with_ext_const=no - fi; --echo "$as_me:9007: result: $with_ext_const" >&5 -+echo "$as_me:9551: result: $with_ext_const" >&5 - echo "${ECHO_T}$with_ext_const" >&6 - NCURSES_CONST='/*nothing*/' - if test "$with_ext_const" = yes ; then -@@ -9014,7 +9558,7 @@ - ############################################################################### - # These options are relatively safe to experiment with. - --echo "$as_me:9017: checking if you want all development code" >&5 -+echo "$as_me:9561: checking if you want all development code" >&5 - echo $ECHO_N "checking if you want all development code... $ECHO_C" >&6 - - # Check whether --with-develop or --without-develop was given. -@@ -9024,7 +9568,7 @@ - else - with_develop=no - fi; --echo "$as_me:9027: result: $with_develop" >&5 -+echo "$as_me:9571: result: $with_develop" >&5 - echo "${ECHO_T}$with_develop" >&6 - - ############################################################################### -@@ -9033,7 +9577,7 @@ - # This is still experimental (20080329), but should ultimately be moved to - # the script-block --with-normal, etc. - --echo "$as_me:9036: checking if you want to link with the pthread library" >&5 -+echo "$as_me:9580: checking if you want to link with the pthread library" >&5 - echo $ECHO_N "checking if you want to link with the pthread library... $ECHO_C" >&6 - - # Check whether --with-pthread or --without-pthread was given. -@@ -9043,27 +9587,27 @@ - else - with_pthread=no - fi; --echo "$as_me:9046: result: $with_pthread" >&5 -+echo "$as_me:9590: result: $with_pthread" >&5 - echo "${ECHO_T}$with_pthread" >&6 - - if test "$with_pthread" != no ; then -- echo "$as_me:9050: checking for pthread.h" >&5 -+ echo "$as_me:9594: checking for pthread.h" >&5 - echo $ECHO_N "checking for pthread.h... $ECHO_C" >&6 - if test "${ac_cv_header_pthread_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - cat >conftest.$ac_ext <<_ACEOF --#line 9056 "configure" -+#line 9600 "configure" - #include "confdefs.h" - #include - _ACEOF --if { (eval echo "$as_me:9060: \"$ac_cpp conftest.$ac_ext\"") >&5 -+if { (eval echo "$as_me:9604: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 -- echo "$as_me:9066: \$? = $ac_status" >&5 -+ echo "$as_me:9610: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag -@@ -9082,20 +9626,22 @@ - fi - rm -f conftest.err conftest.$ac_ext - fi --echo "$as_me:9085: result: $ac_cv_header_pthread_h" >&5 -+echo "$as_me:9629: result: $ac_cv_header_pthread_h" >&5 - echo "${ECHO_T}$ac_cv_header_pthread_h" >&6 - if test $ac_cv_header_pthread_h = yes; then - -- cat >>confdefs.h <<\EOF -+cat >>confdefs.h <<\EOF - #define HAVE_PTHREADS_H 1 - EOF - -- echo "$as_me:9093: checking if we can link with the pthread library" >&5 --echo $ECHO_N "checking if we can link with the pthread library... $ECHO_C" >&6 -- cf_save_LIBS="$LIBS" -- LIBS="-lpthread $LIBS" -- cat >conftest.$ac_ext <<_ACEOF --#line 9098 "configure" -+ for cf_lib_pthread in pthread c_r -+ do -+ echo "$as_me:9639: checking if we can link with the $cf_lib_pthread library" >&5 -+echo $ECHO_N "checking if we can link with the $cf_lib_pthread library... $ECHO_C" >&6 -+ cf_save_LIBS="$LIBS" -+ LIBS="-l$cf_lib_pthread $LIBS" -+ cat >conftest.$ac_ext <<_ACEOF -+#line 9644 "configure" - #include "confdefs.h" - - #include -@@ -9104,23 +9650,24 @@ - main () - { - -- int rc = pthread_create(0,0,0,0); -+ int rc = pthread_create(0,0,0,0); -+ int r2 = pthread_mutexattr_settype(0, 0); - - ; - return 0; - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:9114: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:9661: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:9117: \$? = $ac_status" >&5 -+ echo "$as_me:9664: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:9120: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:9667: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:9123: \$? = $ac_status" >&5 -+ echo "$as_me:9670: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - with_pthread=yes - else -@@ -9129,27 +9676,30 @@ - with_pthread=no - fi - rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -- LIBS="$cf_save_LIBS" -- echo "$as_me:9133: result: $with_pthread" >&5 -+ LIBS="$cf_save_LIBS" -+ echo "$as_me:9680: result: $with_pthread" >&5 - echo "${ECHO_T}$with_pthread" >&6 -+ test "$with_pthread" = yes && break -+ done - -- if test "$with_pthread" = yes ; then -- LIBS="-lpthread $LIBS" -- cat >>confdefs.h <<\EOF -+ if test "$with_pthread" = yes ; then -+ LIBS="-l$cf_lib_pthread $LIBS" -+ -+cat >>confdefs.h <<\EOF - #define HAVE_LIBPTHREADS 1 - EOF - -- else -- { { echo "$as_me:9143: error: Cannot link with pthread library" >&5 -+ else -+ { { echo "$as_me:9693: error: Cannot link with pthread library" >&5 - echo "$as_me: error: Cannot link with pthread library" >&2;} - { (exit 1); exit 1; }; } -- fi -+ fi - - fi - - fi - --echo "$as_me:9152: checking if you want to use weak-symbols for pthreads" >&5 -+echo "$as_me:9702: checking if you want to use weak-symbols for pthreads" >&5 - echo $ECHO_N "checking if you want to use weak-symbols for pthreads... $ECHO_C" >&6 - - # Check whether --enable-weak-symbols or --disable-weak-symbols was given. -@@ -9159,18 +9709,18 @@ - else - use_weak_symbols=no - fi; --echo "$as_me:9162: result: $use_weak_symbols" >&5 -+echo "$as_me:9712: result: $use_weak_symbols" >&5 - echo "${ECHO_T}$use_weak_symbols" >&6 - if test "$use_weak_symbols" = yes ; then - --echo "$as_me:9166: checking if $CC supports weak symbols" >&5 -+echo "$as_me:9716: checking if $CC supports weak symbols" >&5 - echo $ECHO_N "checking if $CC supports weak symbols... $ECHO_C" >&6 - if test "${cf_cv_weak_symbols+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - - cat >conftest.$ac_ext <<_ACEOF --#line 9173 "configure" -+#line 9723 "configure" - #include "confdefs.h" - - #include -@@ -9196,16 +9746,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:9199: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:9749: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:9202: \$? = $ac_status" >&5 -+ echo "$as_me:9752: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:9205: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:9755: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:9208: \$? = $ac_status" >&5 -+ echo "$as_me:9758: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_cv_weak_symbols=yes - else -@@ -9216,7 +9766,7 @@ - rm -f conftest.$ac_objext conftest.$ac_ext - - fi --echo "$as_me:9219: result: $cf_cv_weak_symbols" >&5 -+echo "$as_me:9769: result: $cf_cv_weak_symbols" >&5 - echo "${ECHO_T}$cf_cv_weak_symbols" >&6 - - else -@@ -9224,7 +9774,8 @@ - fi - - if test $cf_cv_weak_symbols = yes ; then -- cat >>confdefs.h <<\EOF -+ -+cat >>confdefs.h <<\EOF - #define USE_WEAK_SYMBOLS 1 - EOF - -@@ -9232,7 +9783,8 @@ - - PTHREAD= - if test "$with_pthread" = "yes" ; then -- cat >>confdefs.h <<\EOF -+ -+cat >>confdefs.h <<\EOF - #define USE_PTHREADS 1 - EOF - -@@ -9243,13 +9795,13 @@ - fi - - # OpenSUSE is installing ncurses6, using reentrant option. --echo "$as_me:9246: checking for _nc_TABSIZE" >&5 -+echo "$as_me:9798: checking for _nc_TABSIZE" >&5 - echo $ECHO_N "checking for _nc_TABSIZE... $ECHO_C" >&6 - if test "${ac_cv_func__nc_TABSIZE+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - cat >conftest.$ac_ext <<_ACEOF --#line 9252 "configure" -+#line 9804 "configure" - #include "confdefs.h" - /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char _nc_TABSIZE (); below. */ -@@ -9272,7 +9824,7 @@ - #if defined (__stub__nc_TABSIZE) || defined (__stub____nc_TABSIZE) - choke me - #else --f = _nc_TABSIZE; -+f = _nc_TABSIZE; /* workaround for ICC 12.0.3 */ if (f == 0) return 1; - #endif - - ; -@@ -9280,16 +9832,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:9283: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:9835: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:9286: \$? = $ac_status" >&5 -+ echo "$as_me:9838: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:9289: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:9841: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:9292: \$? = $ac_status" >&5 -+ echo "$as_me:9844: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_func__nc_TABSIZE=yes - else -@@ -9299,7 +9851,7 @@ - fi - rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - fi --echo "$as_me:9302: result: $ac_cv_func__nc_TABSIZE" >&5 -+echo "$as_me:9854: result: $ac_cv_func__nc_TABSIZE" >&5 - echo "${ECHO_T}$ac_cv_func__nc_TABSIZE" >&6 - if test $ac_cv_func__nc_TABSIZE = yes; then - assume_reentrant=yes -@@ -9311,7 +9863,7 @@ - # opaque outside of that, so there is no --enable-opaque option. We can use - # this option without --with-pthreads, but this will be always set for - # pthreads. --echo "$as_me:9314: checking if you want experimental reentrant code" >&5 -+echo "$as_me:9866: checking if you want experimental reentrant code" >&5 - echo $ECHO_N "checking if you want experimental reentrant code... $ECHO_C" >&6 - - # Check whether --enable-reentrant or --disable-reentrant was given. -@@ -9321,7 +9873,7 @@ - else - with_reentrant=$assume_reentrant - fi; --echo "$as_me:9324: result: $with_reentrant" >&5 -+echo "$as_me:9876: result: $with_reentrant" >&5 - echo "${ECHO_T}$with_reentrant" >&6 - if test "$with_reentrant" = yes ; then - cf_cv_enable_reentrant=1 -@@ -9333,7 +9885,8 @@ - elif test "$assume_reentrant" = no ; then - LIB_SUFFIX="t${LIB_SUFFIX}" - fi -- cat >>confdefs.h <<\EOF -+ -+cat >>confdefs.h <<\EOF - #define USE_REENTRANT 1 - EOF - -@@ -9343,7 +9896,7 @@ - - ### Allow using a different wrap-prefix - if test "$cf_cv_enable_reentrant" != 0 || test "$BROKEN_LINKER" = 1 ; then -- echo "$as_me:9346: checking for prefix used to wrap public variables" >&5 -+ echo "$as_me:9899: checking for prefix used to wrap public variables" >&5 - echo $ECHO_N "checking for prefix used to wrap public variables... $ECHO_C" >&6 - - # Check whether --with-wrap-prefix or --without-wrap-prefix was given. -@@ -9353,7 +9906,7 @@ - else - NCURSES_WRAP_PREFIX=_nc_ - fi; -- echo "$as_me:9356: result: $NCURSES_WRAP_PREFIX" >&5 -+ echo "$as_me:9909: result: $NCURSES_WRAP_PREFIX" >&5 - echo "${ECHO_T}$NCURSES_WRAP_PREFIX" >&6 - else - NCURSES_WRAP_PREFIX=_nc_ -@@ -9366,26 +9919,46 @@ - ############################################################################### - - ### use option --disable-echo to suppress full display compiling commands --echo "$as_me:9369: checking if you want to display full commands during build" >&5 --echo $ECHO_N "checking if you want to display full commands during build... $ECHO_C" >&6 -+ -+echo "$as_me:9923: checking if you want to see long compiling messages" >&5 -+echo $ECHO_N "checking if you want to see long compiling messages... $ECHO_C" >&6 - - # Check whether --enable-echo or --disable-echo was given. - if test "${enable_echo+set}" = set; then - enableval="$enable_echo" -- with_echo=$enableval -+ test "$enableval" != no && enableval=yes -+ if test "$enableval" != "yes" ; then -+ -+ ECHO_LT='--silent' -+ ECHO_LD='@echo linking $@;' -+ RULE_CC='@echo compiling $<' -+ SHOW_CC='@echo compiling $@' -+ ECHO_CC='@' -+ -+ else -+ -+ ECHO_LT='' -+ ECHO_LD='' -+ RULE_CC='' -+ SHOW_CC='' -+ ECHO_CC='' -+ -+ fi - else -- with_echo=yes -+ enableval=yes -+ -+ ECHO_LT='' -+ ECHO_LD='' -+ RULE_CC='' -+ SHOW_CC='' -+ ECHO_CC='' -+ - fi; --if test "$with_echo" = yes; then -- ECHO_LINK= --else -- ECHO_LINK='@ echo linking $@ ... ;' --fi --echo "$as_me:9384: result: $with_echo" >&5 --echo "${ECHO_T}$with_echo" >&6 -+echo "$as_me:9957: result: $enableval" >&5 -+echo "${ECHO_T}$enableval" >&6 - - ### use option --enable-warnings to turn on all gcc warnings --echo "$as_me:9388: checking if you want to see compiler warnings" >&5 -+echo "$as_me:9961: checking if you want to see compiler warnings" >&5 - echo $ECHO_N "checking if you want to see compiler warnings... $ECHO_C" >&6 - - # Check whether --enable-warnings or --disable-warnings was given. -@@ -9393,7 +9966,7 @@ - enableval="$enable_warnings" - with_warnings=$enableval - fi; --echo "$as_me:9396: result: $with_warnings" >&5 -+echo "$as_me:9969: result: $with_warnings" >&5 - echo "${ECHO_T}$with_warnings" >&6 - - if test "x$with_warnings" = "xyes"; then -@@ -9405,12 +9978,12 @@ - if test "$GCC" = yes ; then - case $host_os in - linux*|gnu*) -- echo "$as_me:9408: checking if this is really Intel C compiler" >&5 -+ echo "$as_me:9981: checking if this is really Intel C compiler" >&5 - echo $ECHO_N "checking if this is really Intel C compiler... $ECHO_C" >&6 - cf_save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -no-gcc" - cat >conftest.$ac_ext <<_ACEOF --#line 9413 "configure" -+#line 9986 "configure" - #include "confdefs.h" - - int -@@ -9427,16 +10000,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:9430: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:10003: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:9433: \$? = $ac_status" >&5 -+ echo "$as_me:10006: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:9436: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:10009: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:9439: \$? = $ac_status" >&5 -+ echo "$as_me:10012: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - INTEL_COMPILER=yes - cf_save_CFLAGS="$cf_save_CFLAGS -we147 -no-gcc" -@@ -9447,14 +10020,63 @@ - fi - rm -f conftest.$ac_objext conftest.$ac_ext - CFLAGS="$cf_save_CFLAGS" -- echo "$as_me:9450: result: $INTEL_COMPILER" >&5 -+ echo "$as_me:10023: result: $INTEL_COMPILER" >&5 - echo "${ECHO_T}$INTEL_COMPILER" >&6 - ;; - esac - fi - -+CLANG_COMPILER=no -+ -+if test "$GCC" = yes ; then -+ echo "$as_me:10032: checking if this is really Clang C compiler" >&5 -+echo $ECHO_N "checking if this is really Clang C compiler... $ECHO_C" >&6 -+ cf_save_CFLAGS="$CFLAGS" -+ CFLAGS="$CFLAGS -Qunused-arguments" -+ cat >conftest.$ac_ext <<_ACEOF -+#line 10037 "configure" -+#include "confdefs.h" -+ -+int -+main () -+{ -+ -+#ifdef __clang__ -+#else -+make an error -+#endif -+ -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:10054: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>&5 -+ ac_status=$? -+ echo "$as_me:10057: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:10060: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:10063: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ CLANG_COMPILER=yes -+cf_save_CFLAGS="$cf_save_CFLAGS -Qunused-arguments" -+ -+else -+ echo "$as_me: failed program was:" >&5 -+cat conftest.$ac_ext >&5 -+fi -+rm -f conftest.$ac_objext conftest.$ac_ext -+ CFLAGS="$cf_save_CFLAGS" -+ echo "$as_me:10074: result: $CLANG_COMPILER" >&5 -+echo "${ECHO_T}$CLANG_COMPILER" >&6 -+fi -+ - cat > conftest.$ac_ext <&5 -+ { echo "$as_me:10096: checking for $CC warning options..." >&5 - echo "$as_me: checking for $CC warning options..." >&6;} - cf_save_CFLAGS="$CFLAGS" - EXTRA_CFLAGS="-Wall" -@@ -9487,12 +10109,12 @@ - wd981 - do - CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt" -- if { (eval echo "$as_me:9490: \"$ac_compile\"") >&5 -+ if { (eval echo "$as_me:10112: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:9493: \$? = $ac_status" >&5 -+ echo "$as_me:10115: \$? = $ac_status" >&5 - (exit $ac_status); }; then -- test -n "$verbose" && echo "$as_me:9495: result: ... -$cf_opt" >&5 -+ test -n "$verbose" && echo "$as_me:10117: result: ... -$cf_opt" >&5 - echo "${ECHO_T}... -$cf_opt" >&6 - EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt" - fi -@@ -9501,16 +10123,20 @@ - - elif test "$GCC" = yes - then -- { echo "$as_me:9504: checking for $CC warning options..." >&5 -+ { echo "$as_me:10126: checking for $CC warning options..." >&5 - echo "$as_me: checking for $CC warning options..." >&6;} - cf_save_CFLAGS="$CFLAGS" - EXTRA_CFLAGS= - cf_warn_CONST="" - test "$with_ext_const" = yes && cf_warn_CONST="Wwrite-strings" -+ cf_gcc_warnings="Wignored-qualifiers Wlogical-op Wvarargs" -+ test "x$CLANG_COMPILER" = xyes && cf_gcc_warnings= - for cf_opt in W Wall \ - Wbad-function-cast \ - Wcast-align \ - Wcast-qual \ -+ Wdeclaration-after-statement \ -+ Wextra \ - Winline \ - Wmissing-declarations \ - Wmissing-prototypes \ -@@ -9518,15 +10144,15 @@ - Wpointer-arith \ - Wshadow \ - Wstrict-prototypes \ -- Wundef $cf_warn_CONST Wdeclaration-after-statement Wextra Wno-unknown-pragmas Wswitch-enum -+ Wundef $cf_gcc_warnings $cf_warn_CONST Wno-unknown-pragmas Wswitch-enum - do - CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt" -- if { (eval echo "$as_me:9524: \"$ac_compile\"") >&5 -+ if { (eval echo "$as_me:10150: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:9527: \$? = $ac_status" >&5 -+ echo "$as_me:10153: \$? = $ac_status" >&5 - (exit $ac_status); }; then -- test -n "$verbose" && echo "$as_me:9529: result: ... -$cf_opt" >&5 -+ test -n "$verbose" && echo "$as_me:10155: result: ... -$cf_opt" >&5 - echo "${ECHO_T}... -$cf_opt" >&6 - case $cf_opt in #(vi - Wcast-qual) #(vi -@@ -9537,7 +10163,17 @@ - [34].*) - test -n "$verbose" && echo " feature is broken in gcc $GCC_VERSION" 1>&6 - --echo "${as_me:-configure}:9540: testing feature is broken in gcc $GCC_VERSION ..." 1>&5 -+echo "${as_me:-configure}:10166: testing feature is broken in gcc $GCC_VERSION ..." 1>&5 -+ -+ continue;; -+ esac -+ ;; -+ Wpointer-arith) #(vi -+ case $GCC_VERSION in -+ [12].*) -+ test -n "$verbose" && echo " feature is broken in gcc $GCC_VERSION" 1>&6 -+ -+echo "${as_me:-configure}:10176: testing feature is broken in gcc $GCC_VERSION ..." 1>&5 - - continue;; - esac -@@ -9570,10 +10206,10 @@ - EOF - if test "$GCC" = yes - then -- { echo "$as_me:9573: checking for $CC __attribute__ directives..." >&5 -+ { echo "$as_me:10209: checking for $CC __attribute__ directives..." >&5 - echo "$as_me: checking for $CC __attribute__ directives..." >&6;} - cat > conftest.$ac_ext <&5 -+ if { (eval echo "$as_me:10261: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:9628: \$? = $ac_status" >&5 -+ echo "$as_me:10264: \$? = $ac_status" >&5 - (exit $ac_status); }; then -- test -n "$verbose" && echo "$as_me:9630: result: ... $cf_attribute" >&5 -+ test -n "$verbose" && echo "$as_me:10266: result: ... $cf_attribute" >&5 - echo "${ECHO_T}... $cf_attribute" >&6 - cat conftest.h >>confdefs.h - case $cf_attribute in #(vi -+ noreturn) #(vi -+ -+cat >>confdefs.h <>confdefs.h <>confdefs.h <<\EOF -+#define GCC_PRINTF 1 - EOF -- else -- cat >>confdefs.h <>confdefs.h <>confdefs.h <>confdefs.h <>confdefs.h <<\EOF -+#define GCC_SCANF 1 - EOF -+ - fi -+ -+cat >>confdefs.h <>confdefs.h <&5 -+echo "$as_me:10326: checking if you want to enable runtime assertions" >&5 - echo $ECHO_N "checking if you want to enable runtime assertions... $ECHO_C" >&6 - - # Check whether --enable-assertions or --disable-assertions was given. -@@ -9673,16 +10333,12 @@ - else - with_assertions=no - fi; --echo "$as_me:9676: result: $with_assertions" >&5 -+echo "$as_me:10336: result: $with_assertions" >&5 - echo "${ECHO_T}$with_assertions" >&6 - if test -n "$GCC" - then - if test "$with_assertions" = no - then -- cat >>confdefs.h <<\EOF --#define NDEBUG 1 --EOF -- - CPPFLAGS="$CPPFLAGS -DNDEBUG" - else - -@@ -9692,6 +10348,7 @@ - fi - - ### use option --disable-leaks to suppress "permanent" leaks, for testing -+ - cat >>confdefs.h <<\EOF - #define HAVE_NC_ALLOC_H 1 - EOF -@@ -9701,7 +10358,8 @@ - # Check whether --enable-expanded or --disable-expanded was given. - if test "${enable_expanded+set}" = set; then - enableval="$enable_expanded" -- test "$enableval" = yes && cat >>confdefs.h <<\EOF -+ test "$enableval" = yes && -+cat >>confdefs.h <<\EOF - #define NCURSES_EXPANDED 1 - EOF - -@@ -9712,7 +10370,8 @@ - # Check whether --enable-macros or --disable-macros was given. - if test "${enable_macros+set}" = set; then - enableval="$enable_macros" -- test "$enableval" = no && cat >>confdefs.h <<\EOF -+ test "$enableval" = no && -+cat >>confdefs.h <<\EOF - #define NCURSES_NOMACROS 1 - EOF - -@@ -9727,7 +10386,7 @@ - ;; - esac - --echo "$as_me:9730: checking whether to add trace feature to all models" >&5 -+echo "$as_me:10389: checking whether to add trace feature to all models" >&5 - echo $ECHO_N "checking whether to add trace feature to all models... $ECHO_C" >&6 - - # Check whether --with-trace or --without-trace was given. -@@ -9737,7 +10396,7 @@ - else - cf_with_trace=$cf_all_traces - fi; --echo "$as_me:9740: result: $cf_with_trace" >&5 -+echo "$as_me:10399: result: $cf_with_trace" >&5 - echo "${ECHO_T}$cf_with_trace" >&6 - - if test "$cf_with_trace" = yes ; then -@@ -9830,13 +10489,13 @@ - *mingw32*) #(vi - ;; - *) --echo "$as_me:9833: checking for gettimeofday" >&5 -+echo "$as_me:10492: checking for gettimeofday" >&5 - echo $ECHO_N "checking for gettimeofday... $ECHO_C" >&6 - if test "${ac_cv_func_gettimeofday+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - cat >conftest.$ac_ext <<_ACEOF --#line 9839 "configure" -+#line 10498 "configure" - #include "confdefs.h" - /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char gettimeofday (); below. */ -@@ -9859,7 +10518,7 @@ - #if defined (__stub_gettimeofday) || defined (__stub___gettimeofday) - choke me - #else --f = gettimeofday; -+f = gettimeofday; /* workaround for ICC 12.0.3 */ if (f == 0) return 1; - #endif - - ; -@@ -9867,16 +10526,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:9870: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:10529: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:9873: \$? = $ac_status" >&5 -+ echo "$as_me:10532: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:9876: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:10535: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:9879: \$? = $ac_status" >&5 -+ echo "$as_me:10538: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_func_gettimeofday=yes - else -@@ -9886,7 +10545,7 @@ - fi - rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - fi --echo "$as_me:9889: result: $ac_cv_func_gettimeofday" >&5 -+echo "$as_me:10548: result: $ac_cv_func_gettimeofday" >&5 - echo "${ECHO_T}$ac_cv_func_gettimeofday" >&6 - if test $ac_cv_func_gettimeofday = yes; then - cat >>confdefs.h <<\EOF -@@ -9895,7 +10554,7 @@ - - else - --echo "$as_me:9898: checking for gettimeofday in -lbsd" >&5 -+echo "$as_me:10557: checking for gettimeofday in -lbsd" >&5 - echo $ECHO_N "checking for gettimeofday in -lbsd... $ECHO_C" >&6 - if test "${ac_cv_lib_bsd_gettimeofday+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -9903,7 +10562,7 @@ - ac_check_lib_save_LIBS=$LIBS - LIBS="-lbsd $LIBS" - cat >conftest.$ac_ext <<_ACEOF --#line 9906 "configure" -+#line 10565 "configure" - #include "confdefs.h" - - /* Override any gcc2 internal prototype to avoid an error. */ -@@ -9922,16 +10581,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:9925: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:10584: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:9928: \$? = $ac_status" >&5 -+ echo "$as_me:10587: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:9931: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:10590: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:9934: \$? = $ac_status" >&5 -+ echo "$as_me:10593: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_bsd_gettimeofday=yes - else -@@ -9942,10 +10601,11 @@ - rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - LIBS=$ac_check_lib_save_LIBS - fi --echo "$as_me:9945: result: $ac_cv_lib_bsd_gettimeofday" >&5 -+echo "$as_me:10604: result: $ac_cv_lib_bsd_gettimeofday" >&5 - echo "${ECHO_T}$ac_cv_lib_bsd_gettimeofday" >&6 - if test $ac_cv_lib_bsd_gettimeofday = yes; then -- cat >>confdefs.h <<\EOF -+ -+cat >>confdefs.h <<\EOF - #define HAVE_GETTIMEOFDAY 1 - EOF - -@@ -9957,13 +10617,13 @@ - esac - - ### Checks for header files. --echo "$as_me:9960: checking for ANSI C header files" >&5 -+echo "$as_me:10620: checking for ANSI C header files" >&5 - echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 - if test "${ac_cv_header_stdc+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - cat >conftest.$ac_ext <<_ACEOF --#line 9966 "configure" -+#line 10626 "configure" - #include "confdefs.h" - #include - #include -@@ -9971,13 +10631,13 @@ - #include - - _ACEOF --if { (eval echo "$as_me:9974: \"$ac_cpp conftest.$ac_ext\"") >&5 -+if { (eval echo "$as_me:10634: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 -- echo "$as_me:9980: \$? = $ac_status" >&5 -+ echo "$as_me:10640: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag -@@ -9999,7 +10659,7 @@ - if test $ac_cv_header_stdc = yes; then - # SunOS 4.x string.h does not declare mem*, contrary to ANSI. - cat >conftest.$ac_ext <<_ACEOF --#line 10002 "configure" -+#line 10662 "configure" - #include "confdefs.h" - #include - -@@ -10017,7 +10677,7 @@ - if test $ac_cv_header_stdc = yes; then - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. - cat >conftest.$ac_ext <<_ACEOF --#line 10020 "configure" -+#line 10680 "configure" - #include "confdefs.h" - #include - -@@ -10038,7 +10698,7 @@ - : - else - cat >conftest.$ac_ext <<_ACEOF --#line 10041 "configure" -+#line 10701 "configure" - #include "confdefs.h" - #include - #if ((' ' & 0x0FF) == 0x020) -@@ -10064,15 +10724,15 @@ - } - _ACEOF - rm -f conftest$ac_exeext --if { (eval echo "$as_me:10067: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:10727: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:10070: \$? = $ac_status" >&5 -+ echo "$as_me:10730: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' -- { (eval echo "$as_me:10072: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:10732: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:10075: \$? = $ac_status" >&5 -+ echo "$as_me:10735: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : - else -@@ -10085,7 +10745,7 @@ - fi - fi - fi --echo "$as_me:10088: result: $ac_cv_header_stdc" >&5 -+echo "$as_me:10748: result: $ac_cv_header_stdc" >&5 - echo "${ECHO_T}$ac_cv_header_stdc" >&6 - if test $ac_cv_header_stdc = yes; then - -@@ -10098,13 +10758,13 @@ - ac_header_dirent=no - for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do - as_ac_Header=`echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh` --echo "$as_me:10101: checking for $ac_hdr that defines DIR" >&5 -+echo "$as_me:10761: checking for $ac_hdr that defines DIR" >&5 - echo $ECHO_N "checking for $ac_hdr that defines DIR... $ECHO_C" >&6 - if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - cat >conftest.$ac_ext <<_ACEOF --#line 10107 "configure" -+#line 10767 "configure" - #include "confdefs.h" - #include - #include <$ac_hdr> -@@ -10119,16 +10779,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:10122: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:10782: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:10125: \$? = $ac_status" >&5 -+ echo "$as_me:10785: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:10128: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:10788: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:10131: \$? = $ac_status" >&5 -+ echo "$as_me:10791: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - eval "$as_ac_Header=yes" - else -@@ -10138,7 +10798,7 @@ - fi - rm -f conftest.$ac_objext conftest.$ac_ext - fi --echo "$as_me:10141: result: `eval echo '${'$as_ac_Header'}'`" >&5 -+echo "$as_me:10801: result: `eval echo '${'$as_ac_Header'}'`" >&5 - echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 - if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <&5 -+ echo "$as_me:10814: checking for opendir in -ldir" >&5 - echo $ECHO_N "checking for opendir in -ldir... $ECHO_C" >&6 - if test "${ac_cv_lib_dir_opendir+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -10159,7 +10819,7 @@ - ac_check_lib_save_LIBS=$LIBS - LIBS="-ldir $LIBS" - cat >conftest.$ac_ext <<_ACEOF --#line 10162 "configure" -+#line 10822 "configure" - #include "confdefs.h" - - /* Override any gcc2 internal prototype to avoid an error. */ -@@ -10178,16 +10838,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:10181: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:10841: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:10184: \$? = $ac_status" >&5 -+ echo "$as_me:10844: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:10187: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:10847: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:10190: \$? = $ac_status" >&5 -+ echo "$as_me:10850: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_dir_opendir=yes - else -@@ -10198,14 +10858,14 @@ - rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - LIBS=$ac_check_lib_save_LIBS - fi --echo "$as_me:10201: result: $ac_cv_lib_dir_opendir" >&5 -+echo "$as_me:10861: result: $ac_cv_lib_dir_opendir" >&5 - echo "${ECHO_T}$ac_cv_lib_dir_opendir" >&6 - if test $ac_cv_lib_dir_opendir = yes; then - LIBS="$LIBS -ldir" - fi - - else -- echo "$as_me:10208: checking for opendir in -lx" >&5 -+ echo "$as_me:10868: checking for opendir in -lx" >&5 - echo $ECHO_N "checking for opendir in -lx... $ECHO_C" >&6 - if test "${ac_cv_lib_x_opendir+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -10213,7 +10873,7 @@ - ac_check_lib_save_LIBS=$LIBS - LIBS="-lx $LIBS" - cat >conftest.$ac_ext <<_ACEOF --#line 10216 "configure" -+#line 10876 "configure" - #include "confdefs.h" - - /* Override any gcc2 internal prototype to avoid an error. */ -@@ -10232,16 +10892,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:10235: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:10895: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:10238: \$? = $ac_status" >&5 -+ echo "$as_me:10898: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:10241: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:10901: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:10244: \$? = $ac_status" >&5 -+ echo "$as_me:10904: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_x_opendir=yes - else -@@ -10252,7 +10912,7 @@ - rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - LIBS=$ac_check_lib_save_LIBS - fi --echo "$as_me:10255: result: $ac_cv_lib_x_opendir" >&5 -+echo "$as_me:10915: result: $ac_cv_lib_x_opendir" >&5 - echo "${ECHO_T}$ac_cv_lib_x_opendir" >&6 - if test $ac_cv_lib_x_opendir = yes; then - LIBS="$LIBS -lx" -@@ -10260,13 +10920,13 @@ - - fi - --echo "$as_me:10263: checking whether time.h and sys/time.h may both be included" >&5 -+echo "$as_me:10923: checking whether time.h and sys/time.h may both be included" >&5 - echo $ECHO_N "checking whether time.h and sys/time.h may both be included... $ECHO_C" >&6 - if test "${ac_cv_header_time+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - cat >conftest.$ac_ext <<_ACEOF --#line 10269 "configure" -+#line 10929 "configure" - #include "confdefs.h" - #include - #include -@@ -10282,16 +10942,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:10285: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:10945: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:10288: \$? = $ac_status" >&5 -+ echo "$as_me:10948: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:10291: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:10951: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:10294: \$? = $ac_status" >&5 -+ echo "$as_me:10954: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_header_time=yes - else -@@ -10301,7 +10961,7 @@ - fi - rm -f conftest.$ac_objext conftest.$ac_ext - fi --echo "$as_me:10304: result: $ac_cv_header_time" >&5 -+echo "$as_me:10964: result: $ac_cv_header_time" >&5 - echo "${ECHO_T}$ac_cv_header_time" >&6 - if test $ac_cv_header_time = yes; then - -@@ -10319,104 +10979,13 @@ - ac_compiler_gnu=$ac_cv_c_compiler_gnu - ac_main_return=return - --echo "$as_me:10322: checking for $CC option to accept ANSI C" >&5 --echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 --if test "${ac_cv_prog_cc_stdc+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 --else -- ac_cv_prog_cc_stdc=no --ac_save_CC=$CC --cat >conftest.$ac_ext <<_ACEOF --#line 10330 "configure" --#include "confdefs.h" --#include --#include --#include --#include --/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ --struct buf { int x; }; --FILE * (*rcsopen) (struct buf *, struct stat *, int); --static char *e (p, i) -- char **p; -- int i; --{ -- return p[i]; --} --static char *f (char * (*g) (char **, int), char **p, ...) --{ -- char *s; -- va_list v; -- va_start (v,p); -- s = g (p, va_arg (v,int)); -- va_end (v); -- return s; --} --int test (int i, double x); --struct s1 {int (*f) (int a);}; --struct s2 {int (*f) (double a);}; --int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); --int argc; --char **argv; --int --main () --{ --return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; -- ; -- return 0; --} --_ACEOF --# Don't try gcc -ansi; that turns off useful extensions and --# breaks some systems' header files. --# AIX -qlanglvl=ansi --# Ultrix and OSF/1 -std1 --# HP-UX 10.20 and later -Ae --# HP-UX older versions -Aa -D_HPUX_SOURCE --# SVR4 -Xc -D__EXTENSIONS__ --for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" --do -- CC="$ac_save_CC $ac_arg" -- rm -f conftest.$ac_objext --if { (eval echo "$as_me:10379: \"$ac_compile\"") >&5 -- (eval $ac_compile) 2>&5 -- ac_status=$? -- echo "$as_me:10382: \$? = $ac_status" >&5 -- (exit $ac_status); } && -- { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:10385: \"$ac_try\"") >&5 -- (eval $ac_try) 2>&5 -- ac_status=$? -- echo "$as_me:10388: \$? = $ac_status" >&5 -- (exit $ac_status); }; }; then -- ac_cv_prog_cc_stdc=$ac_arg --break --else -- echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 --fi --rm -f conftest.$ac_objext --done --rm -f conftest.$ac_ext conftest.$ac_objext --CC=$ac_save_CC -- --fi -- --case "x$ac_cv_prog_cc_stdc" in -- x|xno) -- echo "$as_me:10405: result: none needed" >&5 --echo "${ECHO_T}none needed" >&6 ;; -- *) -- echo "$as_me:10408: result: $ac_cv_prog_cc_stdc" >&5 --echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 -- CC="$CC $ac_cv_prog_cc_stdc" ;; --esac -- --echo "$as_me:10413: checking for an ANSI C-conforming const" >&5 -+echo "$as_me:10982: checking for an ANSI C-conforming const" >&5 - echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6 - if test "${ac_cv_c_const+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - cat >conftest.$ac_ext <<_ACEOF --#line 10419 "configure" -+#line 10988 "configure" - #include "confdefs.h" - - int -@@ -10474,16 +11043,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:10477: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:11046: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:10480: \$? = $ac_status" >&5 -+ echo "$as_me:11049: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:10483: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:11052: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:10486: \$? = $ac_status" >&5 -+ echo "$as_me:11055: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_c_const=yes - else -@@ -10493,7 +11062,7 @@ - fi - rm -f conftest.$ac_objext conftest.$ac_ext - fi --echo "$as_me:10496: result: $ac_cv_c_const" >&5 -+echo "$as_me:11065: result: $ac_cv_c_const" >&5 - echo "${ECHO_T}$ac_cv_c_const" >&6 - if test $ac_cv_c_const = no; then - -@@ -10505,7 +11074,7 @@ - - ### Checks for external-data - --echo "$as_me:10508: checking if data-only library module links" >&5 -+echo "$as_me:11077: checking if data-only library module links" >&5 - echo $ECHO_N "checking if data-only library module links... $ECHO_C" >&6 - if test "${cf_cv_link_dataonly+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -10513,20 +11082,20 @@ - - rm -f conftest.a - cat >conftest.$ac_ext <&5 -+ if { (eval echo "$as_me:11088: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:10522: \$? = $ac_status" >&5 -+ echo "$as_me:11091: \$? = $ac_status" >&5 - (exit $ac_status); } ; then - mv conftest.o data.o && \ - ( $AR $ARFLAGS conftest.a data.o ) 2>&5 1>/dev/null - fi - rm -f conftest.$ac_ext data.o - cat >conftest.$ac_ext <&5 -+ if { (eval echo "$as_me:11111: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:10545: \$? = $ac_status" >&5 -+ echo "$as_me:11114: \$? = $ac_status" >&5 - (exit $ac_status); }; then - mv conftest.o func.o && \ - ( $AR $ARFLAGS conftest.a func.o ) 2>&5 1>/dev/null -@@ -10555,7 +11124,7 @@ - cf_cv_link_dataonly=unknown - else - cat >conftest.$ac_ext <<_ACEOF --#line 10558 "configure" -+#line 11127 "configure" - #include "confdefs.h" - - int main() -@@ -10566,15 +11135,15 @@ - - _ACEOF - rm -f conftest$ac_exeext --if { (eval echo "$as_me:10569: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:11138: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:10572: \$? = $ac_status" >&5 -+ echo "$as_me:11141: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' -- { (eval echo "$as_me:10574: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:11143: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:10577: \$? = $ac_status" >&5 -+ echo "$as_me:11146: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_cv_link_dataonly=yes - else -@@ -10589,11 +11158,12 @@ - - fi - --echo "$as_me:10592: result: $cf_cv_link_dataonly" >&5 -+echo "$as_me:11161: result: $cf_cv_link_dataonly" >&5 - echo "${ECHO_T}$cf_cv_link_dataonly" >&6 - - if test "$cf_cv_link_dataonly" = no ; then -- cat >>confdefs.h <<\EOF -+ -+cat >>confdefs.h <<\EOF - #define BROKEN_LINKER 1 - EOF - -@@ -10602,7 +11172,7 @@ - - ### Checks for library functions. - --echo "$as_me:10605: checking for working mkstemp" >&5 -+echo "$as_me:11175: checking for working mkstemp" >&5 - echo $ECHO_N "checking for working mkstemp... $ECHO_C" >&6 - if test "${cf_cv_func_mkstemp+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -10610,68 +11180,10 @@ - - rm -rf conftest* - if test "$cross_compiling" = yes; then -- echo "$as_me:10613: checking for mkstemp" >&5 --echo $ECHO_N "checking for mkstemp... $ECHO_C" >&6 --if test "${ac_cv_func_mkstemp+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 --else -- cat >conftest.$ac_ext <<_ACEOF --#line 10619 "configure" --#include "confdefs.h" --/* System header to define __stub macros and hopefully few prototypes, -- which can conflict with char mkstemp (); below. */ --#include --/* Override any gcc2 internal prototype to avoid an error. */ --#ifdef __cplusplus --extern "C" --#endif --/* We use char because int might match the return type of a gcc2 -- builtin and then its argument prototype would still apply. */ --char mkstemp (); --char (*f) (); -- --int --main () --{ --/* The GNU C library defines this for functions which it implements -- to always fail with ENOSYS. Some functions are actually named -- something starting with __ and the normal name is an alias. */ --#if defined (__stub_mkstemp) || defined (__stub___mkstemp) --choke me --#else --f = mkstemp; --#endif -- -- ; -- return 0; --} --_ACEOF --rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:10650: \"$ac_link\"") >&5 -- (eval $ac_link) 2>&5 -- ac_status=$? -- echo "$as_me:10653: \$? = $ac_status" >&5 -- (exit $ac_status); } && -- { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:10656: \"$ac_try\"") >&5 -- (eval $ac_try) 2>&5 -- ac_status=$? -- echo "$as_me:10659: \$? = $ac_status" >&5 -- (exit $ac_status); }; }; then -- ac_cv_func_mkstemp=yes --else -- echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 --ac_cv_func_mkstemp=no --fi --rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext --fi --echo "$as_me:10669: result: $ac_cv_func_mkstemp" >&5 --echo "${ECHO_T}$ac_cv_func_mkstemp" >&6 -- -+ cf_cv_func_mkstemp=maybe - else - cat >conftest.$ac_ext <<_ACEOF --#line 10674 "configure" -+#line 11186 "configure" - #include "confdefs.h" - - #include -@@ -10709,15 +11221,15 @@ - - _ACEOF - rm -f conftest$ac_exeext --if { (eval echo "$as_me:10712: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:11224: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:10715: \$? = $ac_status" >&5 -+ echo "$as_me:11227: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' -- { (eval echo "$as_me:10717: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:11229: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:10720: \$? = $ac_status" >&5 -+ echo "$as_me:11232: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_cv_func_mkstemp=yes - -@@ -10732,80 +11244,89 @@ - fi - - fi --echo "$as_me:10735: result: $cf_cv_func_mkstemp" >&5 -+echo "$as_me:11247: result: $cf_cv_func_mkstemp" >&5 - echo "${ECHO_T}$cf_cv_func_mkstemp" >&6 --if test "x$cf_cv_func_mkstemp" = xyes || test "x$ac_cv_func_mkstemp" = xyes ; then -- cat >>confdefs.h <<\EOF --#define HAVE_MKSTEMP 1 --EOF -- --fi -- --echo "$as_me:10744: checking return type of signal handlers" >&5 --echo $ECHO_N "checking return type of signal handlers... $ECHO_C" >&6 --if test "${ac_cv_type_signal+set}" = set; then -+if test "x$cf_cv_func_mkstemp" = xmaybe ; then -+ echo "$as_me:11250: checking for mkstemp" >&5 -+echo $ECHO_N "checking for mkstemp... $ECHO_C" >&6 -+if test "${ac_cv_func_mkstemp+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - cat >conftest.$ac_ext <<_ACEOF --#line 10750 "configure" -+#line 11256 "configure" - #include "confdefs.h" --#include --#include --#ifdef signal --# undef signal --#endif -+/* System header to define __stub macros and hopefully few prototypes, -+ which can conflict with char mkstemp (); below. */ -+#include -+/* Override any gcc2 internal prototype to avoid an error. */ - #ifdef __cplusplus --extern "C" void (*signal (int, void (*)(int)))(int); --#else --void (*signal ()) (); -+extern "C" - #endif -+/* We use char because int might match the return type of a gcc2 -+ builtin and then its argument prototype would still apply. */ -+char mkstemp (); -+char (*f) (); - - int - main () - { --int i; -+/* The GNU C library defines this for functions which it implements -+ to always fail with ENOSYS. Some functions are actually named -+ something starting with __ and the normal name is an alias. */ -+#if defined (__stub_mkstemp) || defined (__stub___mkstemp) -+choke me -+#else -+f = mkstemp; /* workaround for ICC 12.0.3 */ if (f == 0) return 1; -+#endif -+ - ; - return 0; - } - _ACEOF --rm -f conftest.$ac_objext --if { (eval echo "$as_me:10772: \"$ac_compile\"") >&5 -- (eval $ac_compile) 2>&5 -+rm -f conftest.$ac_objext conftest$ac_exeext -+if { (eval echo "$as_me:11287: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:10775: \$? = $ac_status" >&5 -+ echo "$as_me:11290: \$? = $ac_status" >&5 - (exit $ac_status); } && -- { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:10778: \"$ac_try\"") >&5 -+ { ac_try='test -s conftest$ac_exeext' -+ { (eval echo "$as_me:11293: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:10781: \$? = $ac_status" >&5 -+ echo "$as_me:11296: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- ac_cv_type_signal=void -+ ac_cv_func_mkstemp=yes - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --ac_cv_type_signal=int -+ac_cv_func_mkstemp=no - fi --rm -f conftest.$ac_objext conftest.$ac_ext -+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -+fi -+echo "$as_me:11306: result: $ac_cv_func_mkstemp" >&5 -+echo "${ECHO_T}$ac_cv_func_mkstemp" >&6 -+ - fi --echo "$as_me:10791: result: $ac_cv_type_signal" >&5 --echo "${ECHO_T}$ac_cv_type_signal" >&6 -+if test "x$cf_cv_func_mkstemp" = xyes || test "x$ac_cv_func_mkstemp" = xyes ; then - --cat >>confdefs.h <>confdefs.h <<\EOF -+#define HAVE_MKSTEMP 1 - EOF - -+fi -+ - if test -z "$cf_user_CFLAGS" && test "$with_no_leaks" = no ; then - CFLAGS=`echo ${CFLAGS} | sed -e 's%-g %%' -e 's%-g$%%'` - CXXFLAGS=`echo ${CXXFLAGS} | sed -e 's%-g %%' -e 's%-g$%%'` - fi - -+cf_with_ada=yes - if test "$cf_with_ada" != "no" ; then - - cf_ada_make=gnatmake - # Extract the first word of "$cf_ada_make", so it can be a program name with args. - set dummy $cf_ada_make; ac_word=$2 --echo "$as_me:10808: checking for $ac_word" >&5 -+echo "$as_me:11329: checking for $ac_word" >&5 - echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 - if test "${ac_cv_prog_gnat_exists+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -10820,7 +11341,7 @@ - test -z "$ac_dir" && ac_dir=. - $as_executable_p "$ac_dir/$ac_word" || continue - ac_cv_prog_gnat_exists="yes" --echo "$as_me:10823: found $ac_dir/$ac_word" >&5 -+echo "$as_me:11344: found $ac_dir/$ac_word" >&5 - break - done - -@@ -10829,31 +11350,32 @@ - fi - gnat_exists=$ac_cv_prog_gnat_exists - if test -n "$gnat_exists"; then -- echo "$as_me:10832: result: $gnat_exists" >&5 -+ echo "$as_me:11353: result: $gnat_exists" >&5 - echo "${ECHO_T}$gnat_exists" >&6 - else -- echo "$as_me:10835: result: no" >&5 -+ echo "$as_me:11356: result: no" >&5 - echo "${ECHO_T}no" >&6 - fi - - if test "$ac_cv_prog_gnat_exists" = no; then - cf_ada_make= -+ cf_cv_prog_gnat_correct=no - else - --echo "$as_me:10843: checking for gnat version" >&5 -+echo "$as_me:11365: checking for gnat version" >&5 - echo $ECHO_N "checking for gnat version... $ECHO_C" >&6 - cf_gnat_version=`${cf_ada_make:-gnatmake} -v 2>&1 | \ - grep '[0-9].[0-9][0-9]*' |\ - sed -e '2,$d' -e 's/[^0-9 \.]//g' -e 's/^[ ]*//' -e 's/ .*//'` --echo "$as_me:10848: result: $cf_gnat_version" >&5 -+echo "$as_me:11370: result: $cf_gnat_version" >&5 - echo "${ECHO_T}$cf_gnat_version" >&6 - - case $cf_gnat_version in #(vi --3.1[1-9]*|3.[2-9]*|[4-9].*) #(vi -+3.1[1-9]*|3.[2-9]*|[4-9].*|20[0-9][0-9]) #(vi - cf_cv_prog_gnat_correct=yes - ;; - *) -- { echo "$as_me:10856: WARNING: Unsupported GNAT version $cf_gnat_version. We require 3.11 or better. Disabling Ada95 binding." >&5 -+ { echo "$as_me:11378: WARNING: Unsupported GNAT version $cf_gnat_version. We require 3.11 or better. Disabling Ada95 binding." >&5 - echo "$as_me: WARNING: Unsupported GNAT version $cf_gnat_version. We require 3.11 or better. Disabling Ada95 binding." >&2;} - cf_cv_prog_gnat_correct=no - ;; -@@ -10861,7 +11383,7 @@ - - # Extract the first word of "m4", so it can be a program name with args. - set dummy m4; ac_word=$2 --echo "$as_me:10864: checking for $ac_word" >&5 -+echo "$as_me:11386: checking for $ac_word" >&5 - echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 - if test "${ac_cv_prog_M4_exists+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -10876,7 +11398,7 @@ - test -z "$ac_dir" && ac_dir=. - $as_executable_p "$ac_dir/$ac_word" || continue - ac_cv_prog_M4_exists="yes" --echo "$as_me:10879: found $ac_dir/$ac_word" >&5 -+echo "$as_me:11401: found $ac_dir/$ac_word" >&5 - break - done - -@@ -10885,10 +11407,10 @@ - fi - M4_exists=$ac_cv_prog_M4_exists - if test -n "$M4_exists"; then -- echo "$as_me:10888: result: $M4_exists" >&5 -+ echo "$as_me:11410: result: $M4_exists" >&5 - echo "${ECHO_T}$M4_exists" >&6 - else -- echo "$as_me:10891: result: no" >&5 -+ echo "$as_me:11413: result: no" >&5 - echo "${ECHO_T}no" >&6 - fi - -@@ -10897,7 +11419,7 @@ - echo Ada95 binding required program m4 not found. Ada95 binding disabled. - fi - if test "$cf_cv_prog_gnat_correct" = yes; then -- echo "$as_me:10900: checking if GNAT works" >&5 -+ echo "$as_me:11422: checking if GNAT works" >&5 - echo $ECHO_N "checking if GNAT works... $ECHO_C" >&6 - - rm -rf conftest* *~conftest* -@@ -10925,30 +11447,34 @@ - fi - rm -rf conftest* *~conftest* - -- echo "$as_me:10928: result: $cf_cv_prog_gnat_correct" >&5 -+ echo "$as_me:11450: result: $cf_cv_prog_gnat_correct" >&5 - echo "${ECHO_T}$cf_cv_prog_gnat_correct" >&6 - fi - fi - - if test "$cf_cv_prog_gnat_correct" = yes; then - -- # make ADAFLAGS consistent with CFLAGS -- case "$CFLAGS" in -- *-g*) -+ echo "$as_me:11457: checking optimization options for ADAFLAGS" >&5 -+echo $ECHO_N "checking optimization options for ADAFLAGS... $ECHO_C" >&6 -+ case "$CFLAGS" in -+ *-g*) - - ADAFLAGS="$ADAFLAGS -g" - -- ;; -- esac -- case "$CFLAGS" in -- *-O*) -+ ;; -+ esac -+ case "$CFLAGS" in -+ *-O*) -+ cf_O_flag=`echo "$CFLAGS" |sed -e 's/^.*-O/-O/' -e 's/[ ].*//'` - -- ADAFLAGS="$ADAFLAGS -O3" -+ ADAFLAGS="$ADAFLAGS $cf_O_flag" - -- ;; -- esac -+ ;; -+ esac -+ echo "$as_me:11474: result: $ADAFLAGS" >&5 -+echo "${ECHO_T}$ADAFLAGS" >&6 - --echo "$as_me:10951: checking if GNAT supports generics" >&5 -+echo "$as_me:11477: checking if GNAT supports generics" >&5 - echo $ECHO_N "checking if GNAT supports generics... $ECHO_C" >&6 - case $cf_gnat_version in #(vi - 3.[1-9]*|[4-9].*) #(vi -@@ -10958,7 +11484,7 @@ - cf_gnat_generics=no - ;; - esac --echo "$as_me:10961: result: $cf_gnat_generics" >&5 -+echo "$as_me:11487: result: $cf_gnat_generics" >&5 - echo "${ECHO_T}$cf_gnat_generics" >&6 - - if test "$cf_gnat_generics" = yes -@@ -10970,7 +11496,7 @@ - cf_generic_objects= - fi - --echo "$as_me:10973: checking if GNAT supports SIGINT" >&5 -+echo "$as_me:11499: checking if GNAT supports SIGINT" >&5 - echo $ECHO_N "checking if GNAT supports SIGINT... $ECHO_C" >&6 - if test "${cf_cv_gnat_sigint+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -11018,7 +11544,7 @@ - rm -rf conftest* *~conftest* - - fi --echo "$as_me:11021: result: $cf_cv_gnat_sigint" >&5 -+echo "$as_me:11547: result: $cf_cv_gnat_sigint" >&5 - echo "${ECHO_T}$cf_cv_gnat_sigint" >&6 - - if test $cf_cv_gnat_sigint = yes ; then -@@ -11027,7 +11553,7 @@ - USE_GNAT_SIGINT="#" - fi - --echo "$as_me:11030: checking if GNAT pragma Unreferenced works" >&5 -+echo "$as_me:11556: checking if GNAT pragma Unreferenced works" >&5 - echo $ECHO_N "checking if GNAT pragma Unreferenced works... $ECHO_C" >&6 - if test "${cf_cv_pragma_unreferenced+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -11058,7 +11584,7 @@ - rm -rf conftest* *~conftest* - - fi --echo "$as_me:11061: result: $cf_cv_pragma_unreferenced" >&5 -+echo "$as_me:11587: result: $cf_cv_pragma_unreferenced" >&5 - echo "${ECHO_T}$cf_cv_pragma_unreferenced" >&6 - - # if the pragma is supported, use it (needed in the Trace code). -@@ -11071,14 +11597,14 @@ - cf_gnat_libraries=no - cf_gnat_projects=no - --echo "$as_me:11074: checking if GNAT supports project files" >&5 -+echo "$as_me:11600: checking if GNAT supports project files" >&5 - echo $ECHO_N "checking if GNAT supports project files... $ECHO_C" >&6 - case $cf_gnat_version in #(vi - 3.[0-9]*) #(vi - ;; - *) - case $cf_cv_system_name in #(vi -- cygwin*) #(vi -+ cygwin*|msys*) #(vi - ;; - *) - mkdir conftest.src conftest.bin conftest.lib -@@ -11139,14 +11665,14 @@ - esac - ;; - esac --echo "$as_me:11142: result: $cf_gnat_projects" >&5 -+echo "$as_me:11668: result: $cf_gnat_projects" >&5 - echo "${ECHO_T}$cf_gnat_projects" >&6 - - if test $cf_gnat_projects = yes - then -- echo "$as_me:11147: checking if GNAT supports libraries" >&5 -+ echo "$as_me:11673: checking if GNAT supports libraries" >&5 - echo $ECHO_N "checking if GNAT supports libraries... $ECHO_C" >&6 -- echo "$as_me:11149: result: $cf_gnat_libraries" >&5 -+ echo "$as_me:11675: result: $cf_gnat_libraries" >&5 - echo "${ECHO_T}$cf_gnat_libraries" >&6 - fi - -@@ -11166,7 +11692,7 @@ - USE_GNAT_LIBRARIES="#" - fi - --echo "$as_me:11169: checking for ada-compiler" >&5 -+echo "$as_me:11695: checking for ada-compiler" >&5 - echo $ECHO_N "checking for ada-compiler... $ECHO_C" >&6 - - # Check whether --with-ada-compiler or --without-ada-compiler was given. -@@ -11177,12 +11703,12 @@ - cf_ada_compiler=gnatmake - fi; - --echo "$as_me:11180: result: $cf_ada_compiler" >&5 -+echo "$as_me:11706: result: $cf_ada_compiler" >&5 - echo "${ECHO_T}$cf_ada_compiler" >&6 - - cf_ada_package=terminal_interface - --echo "$as_me:11185: checking for ada-include" >&5 -+echo "$as_me:11711: checking for ada-include" >&5 - echo $ECHO_N "checking for ada-include... $ECHO_C" >&6 - - # Check whether --with-ada-include or --without-ada-include was given. -@@ -11206,7 +11732,7 @@ - ;; - .[a-zA-Z]:[\\/]*) #(vi OS/2 EMX - ;; --.\${*prefix}*) #(vi -+.\${*prefix}*|.\${*dir}*) #(vi - eval withval="$withval" - case ".$withval" in #(vi - .NONE/*) -@@ -11218,19 +11744,19 @@ - withval=`echo $withval | sed -e s%NONE%$cf_path_syntax%` - ;; - *) -- { { echo "$as_me:11221: error: expected a pathname, not \"$withval\"" >&5 -+ { { echo "$as_me:11747: error: expected a pathname, not \"$withval\"" >&5 - echo "$as_me: error: expected a pathname, not \"$withval\"" >&2;} - { (exit 1); exit 1; }; } - ;; - esac - - fi --ADA_INCLUDE="$withval" -+eval ADA_INCLUDE="$withval" - --echo "$as_me:11230: result: $ADA_INCLUDE" >&5 -+echo "$as_me:11756: result: $ADA_INCLUDE" >&5 - echo "${ECHO_T}$ADA_INCLUDE" >&6 - --echo "$as_me:11233: checking for ada-objects" >&5 -+echo "$as_me:11759: checking for ada-objects" >&5 - echo $ECHO_N "checking for ada-objects... $ECHO_C" >&6 - - # Check whether --with-ada-objects or --without-ada-objects was given. -@@ -11254,7 +11780,7 @@ - ;; - .[a-zA-Z]:[\\/]*) #(vi OS/2 EMX - ;; --.\${*prefix}*) #(vi -+.\${*prefix}*|.\${*dir}*) #(vi - eval withval="$withval" - case ".$withval" in #(vi - .NONE/*) -@@ -11266,19 +11792,19 @@ - withval=`echo $withval | sed -e s%NONE%$cf_path_syntax%` - ;; - *) -- { { echo "$as_me:11269: error: expected a pathname, not \"$withval\"" >&5 -+ { { echo "$as_me:11795: error: expected a pathname, not \"$withval\"" >&5 - echo "$as_me: error: expected a pathname, not \"$withval\"" >&2;} - { (exit 1); exit 1; }; } - ;; - esac - - fi --ADA_OBJECTS="$withval" -+eval ADA_OBJECTS="$withval" - --echo "$as_me:11278: result: $ADA_OBJECTS" >&5 -+echo "$as_me:11804: result: $ADA_OBJECTS" >&5 - echo "${ECHO_T}$ADA_OBJECTS" >&6 - --echo "$as_me:11281: checking if an Ada95 shared-library should be built" >&5 -+echo "$as_me:11807: checking if an Ada95 shared-library should be built" >&5 - echo $ECHO_N "checking if an Ada95 shared-library should be built... $ECHO_C" >&6 - - # Check whether --with-ada-sharedlib or --without-ada-sharedlib was given. -@@ -11288,7 +11814,7 @@ - else - with_ada_sharedlib=no - fi; --echo "$as_me:11291: result: $with_ada_sharedlib" >&5 -+echo "$as_me:11817: result: $with_ada_sharedlib" >&5 - echo "${ECHO_T}$with_ada_sharedlib" >&6 - - ADA_SHAREDLIB='lib$(LIB_NAME).so.1' -@@ -11304,12 +11830,12 @@ - fi - - else -- { { echo "$as_me:11307: error: No usable Ada compiler found" >&5 -+ { { echo "$as_me:11833: error: No usable Ada compiler found" >&5 - echo "$as_me: error: No usable Ada compiler found" >&2;} - { (exit 1); exit 1; }; } - fi - else -- { { echo "$as_me:11312: error: The Ada compiler is needed for this package" >&5 -+ { { echo "$as_me:11838: error: The Ada compiler is needed for this package" >&5 - echo "$as_me: error: The Ada compiler is needed for this package" >&2;} - { (exit 1); exit 1; }; } - fi -@@ -11317,25 +11843,27 @@ - ################################################################################ - - # not needed --TINFO_ARGS2= -+TINFO_LDFLAGS2= -+ -+TINFO_LIBS= - - ### Construct the list of include-directories to be generated - --CPPFLAGS="$CPPFLAGS -I. -I../include" --if test "$srcdir" != "."; then -- CPPFLAGS="$CPPFLAGS -I\${srcdir}/../include" --fi - if test "$GCC" != yes; then -- CPPFLAGS="$CPPFLAGS -I\${includedir}" -+ CPPFLAGS="-I\${includedir} $CPPFLAGS" - elif test "$includedir" != "/usr/include"; then - if test "$includedir" = '${prefix}/include' ; then -- if test $prefix != /usr ; then -- CPPFLAGS="$CPPFLAGS -I\${includedir}" -+ if test x$prefix != x/usr ; then -+ CPPFLAGS="-I\${includedir} $CPPFLAGS" - fi - else -- CPPFLAGS="$CPPFLAGS -I\${includedir}" -+ CPPFLAGS="-I\${includedir} $CPPFLAGS" - fi - fi -+if test "$srcdir" != "."; then -+ CPPFLAGS="-I\${srcdir}/../include $CPPFLAGS" -+fi -+CPPFLAGS="-I. -I../include $CPPFLAGS" - - ACPPFLAGS="-I. -I../include -I../../include $ACPPFLAGS" - if test "$srcdir" != "."; then -@@ -11345,7 +11873,7 @@ - ACPPFLAGS="$ACPPFLAGS -I\${includedir}" - elif test "$includedir" != "/usr/include"; then - if test "$includedir" = '${prefix}/include' ; then -- if test $prefix != /usr ; then -+ if test x$prefix != x/usr ; then - ACPPFLAGS="$ACPPFLAGS -I\${includedir}" - fi - else -@@ -11354,7 +11882,7 @@ - fi - - ### Build up pieces for makefile rules --echo "$as_me:11357: checking default library suffix" >&5 -+echo "$as_me:11885: checking default library suffix" >&5 - echo $ECHO_N "checking default library suffix... $ECHO_C" >&6 - - case $DFT_LWR_MODEL in -@@ -11365,36 +11893,32 @@ - shared) DFT_ARG_SUFFIX='' ;; - esac - test -n "$LIB_SUFFIX" && DFT_ARG_SUFFIX="${LIB_SUFFIX}${DFT_ARG_SUFFIX}" --echo "$as_me:11368: result: $DFT_ARG_SUFFIX" >&5 -+echo "$as_me:11896: result: $DFT_ARG_SUFFIX" >&5 - echo "${ECHO_T}$DFT_ARG_SUFFIX" >&6 - --echo "$as_me:11371: checking default library-dependency suffix" >&5 -+echo "$as_me:11899: checking default library-dependency suffix" >&5 - echo $ECHO_N "checking default library-dependency suffix... $ECHO_C" >&6 - -- case $DFT_LWR_MODEL in #(vi -- libtool) #(vi -+ case X$DFT_LWR_MODEL in #(vi -+ Xlibtool) #(vi - DFT_LIB_SUFFIX='.la' - DFT_DEP_SUFFIX=$DFT_LIB_SUFFIX - ;; -- normal) #(vi -- DFT_LIB_SUFFIX='.a' -- DFT_DEP_SUFFIX=$DFT_LIB_SUFFIX -- ;; -- debug) #(vi -+ Xdebug) #(vi - DFT_LIB_SUFFIX='_g.a' - DFT_DEP_SUFFIX=$DFT_LIB_SUFFIX - ;; -- profile) #(vi -+ Xprofile) #(vi - DFT_LIB_SUFFIX='_p.a' - DFT_DEP_SUFFIX=$DFT_LIB_SUFFIX - ;; -- shared) #(vi -+ Xshared) #(vi - case $cf_cv_system_name in -- aix[56]*) #(vi -+ aix[5-7]*) #(vi - DFT_LIB_SUFFIX='.a' - DFT_DEP_SUFFIX=$DFT_LIB_SUFFIX - ;; -- cygwin*) #(vi -+ cygwin*|msys*|mingw*) #(vi - DFT_LIB_SUFFIX='.dll' - DFT_DEP_SUFFIX='.dll.a' - ;; -@@ -11414,17 +11938,23 @@ - ;; - esac - ;; -- *) DFT_LIB_SUFFIX='.so' -+ *) #(vi -+ DFT_LIB_SUFFIX='.so' - DFT_DEP_SUFFIX=$DFT_LIB_SUFFIX - ;; - esac -+ ;; -+ *) -+ DFT_LIB_SUFFIX='.a' -+ DFT_DEP_SUFFIX=$DFT_LIB_SUFFIX -+ ;; - esac - test -n "$LIB_SUFFIX" && DFT_LIB_SUFFIX="${LIB_SUFFIX}${DFT_LIB_SUFFIX}" - test -n "$LIB_SUFFIX" && DFT_DEP_SUFFIX="${LIB_SUFFIX}${DFT_DEP_SUFFIX}" --echo "$as_me:11424: result: $DFT_DEP_SUFFIX" >&5 -+echo "$as_me:11954: result: $DFT_DEP_SUFFIX" >&5 - echo "${ECHO_T}$DFT_DEP_SUFFIX" >&6 - --echo "$as_me:11427: checking default object directory" >&5 -+echo "$as_me:11957: checking default object directory" >&5 - echo $ECHO_N "checking default object directory... $ECHO_C" >&6 - - case $DFT_LWR_MODEL in -@@ -11434,13 +11964,13 @@ - profile) DFT_OBJ_SUBDIR='obj_p' ;; - shared) - case $cf_cv_system_name in #(vi -- cygwin) #(vi -+ cygwin|msys) #(vi - DFT_OBJ_SUBDIR='objects' ;; - *) - DFT_OBJ_SUBDIR='obj_s' ;; - esac - esac --echo "$as_me:11443: result: $DFT_OBJ_SUBDIR" >&5 -+echo "$as_me:11973: result: $DFT_OBJ_SUBDIR" >&5 - echo "${ECHO_T}$DFT_OBJ_SUBDIR" >&6 - - ### Set up low-level terminfo dependencies for makefiles. -@@ -11450,6 +11980,9 @@ - cygwin*) - # "lib" files have ".dll.a" suffix, "cyg" files have ".dll" - ;; -+ msys*) -+ # "lib" files have ".dll.a" suffix, "msys-" files have ".dll" -+ ;; - esac - fi - -@@ -11656,7 +12189,7 @@ - : ${CONFIG_STATUS=./config.status} - ac_clean_files_save=$ac_clean_files - ac_clean_files="$ac_clean_files $CONFIG_STATUS" --{ echo "$as_me:11659: creating $CONFIG_STATUS" >&5 -+{ echo "$as_me:12192: creating $CONFIG_STATUS" >&5 - echo "$as_me: creating $CONFIG_STATUS" >&6;} - cat >$CONFIG_STATUS <<_ACEOF - #! $SHELL -@@ -11788,7 +12321,7 @@ - cat >>$CONFIG_STATUS <&5 - echo "$as_me: error: ambiguous option: $1 - Try \`$0 --help' for more information." >&2;} -@@ -11851,7 +12384,7 @@ - ac_need_defaults=false;; - - # This is an error. -- -*) { { echo "$as_me:11854: error: unrecognized option: $1 -+ -*) { { echo "$as_me:12387: error: unrecognized option: $1 - Try \`$0 --help' for more information." >&5 - echo "$as_me: error: unrecognized option: $1 - Try \`$0 --help' for more information." >&2;} -@@ -11870,7 +12403,7 @@ - ## Running config.status. ## - ## ----------------------- ## - --This file was extended by $as_me 2.52.20101002, executed with -+This file was extended by $as_me 2.52.20121002, executed with - CONFIG_FILES = $CONFIG_FILES - CONFIG_HEADERS = $CONFIG_HEADERS - CONFIG_LINKS = $CONFIG_LINKS -@@ -11892,8 +12425,8 @@ - AWK="$AWK" - DFT_ARG_SUFFIX="$DFT_ARG_SUFFIX" - DFT_LWR_MODEL="$DFT_LWR_MODEL" --ECHO_LINK="$ECHO_LINK" - LIB_NAME="$LIB_NAME" -+LIB_PREFIX="$LIB_PREFIX" - LIB_SUFFIX="$LIB_SUFFIX" - LN_S="$LN_S" - NCURSES_MAJOR="$NCURSES_MAJOR" -@@ -11922,7 +12455,7 @@ - "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; - "default" ) CONFIG_COMMANDS="$CONFIG_COMMANDS default" ;; - "include/ncurses_cfg.h" ) CONFIG_HEADERS="$CONFIG_HEADERS include/ncurses_cfg.h:include/ncurses_cfg.hin" ;; -- *) { { echo "$as_me:11925: error: invalid argument: $ac_config_target" >&5 -+ *) { { echo "$as_me:12458: error: invalid argument: $ac_config_target" >&5 - echo "$as_me: error: invalid argument: $ac_config_target" >&2;} - { (exit 1); exit 1; }; };; - esac -@@ -11981,6 +12514,7 @@ - s,@bindir@,$bindir,;t t - s,@sbindir@,$sbindir,;t t - s,@libexecdir@,$libexecdir,;t t -+s,@datarootdir@,$datarootdir,;t t - s,@datadir@,$datadir,;t t - s,@sysconfdir@,$sysconfdir,;t t - s,@sharedstatedir@,$sharedstatedir,;t t -@@ -12024,9 +12558,8 @@ - s,@ac_ct_CC@,$ac_ct_CC,;t t - s,@EXEEXT@,$EXEEXT,;t t - s,@OBJEXT@,$OBJEXT,;t t --s,@CPP@,$CPP,;t t - s,@EXTRA_CPPFLAGS@,$EXTRA_CPPFLAGS,;t t --s,@PROG_EXT@,$PROG_EXT,;t t -+s,@CPP@,$CPP,;t t - s,@AWK@,$AWK,;t t - s,@EGREP@,$EGREP,;t t - s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t -@@ -12061,6 +12594,7 @@ - s,@DFT_LWR_MODEL@,$DFT_LWR_MODEL,;t t - s,@DFT_UPR_MODEL@,$DFT_UPR_MODEL,;t t - s,@NCURSES_CONFIG@,$NCURSES_CONFIG,;t t -+s,@ac_ct_NCURSES_CONFIG@,$ac_ct_NCURSES_CONFIG,;t t - s,@NCURSES_MAJOR@,$NCURSES_MAJOR,;t t - s,@NCURSES_MINOR@,$NCURSES_MINOR,;t t - s,@NCURSES_PATCH@,$NCURSES_PATCH,;t t -@@ -12073,23 +12607,31 @@ - s,@LIB_SUFFIX@,$LIB_SUFFIX,;t t - s,@CC_G_OPT@,$CC_G_OPT,;t t - s,@LD_MODEL@,$LD_MODEL,;t t -+s,@shlibdir@,$shlibdir,;t t -+s,@MAKE_DLLS@,$MAKE_DLLS,;t t - s,@CC_SHARED_OPTS@,$CC_SHARED_OPTS,;t t - s,@LD_RPATH_OPT@,$LD_RPATH_OPT,;t t - s,@LD_SHARED_OPTS@,$LD_SHARED_OPTS,;t t - s,@MK_SHARED_LIB@,$MK_SHARED_LIB,;t t -+s,@RM_SHARED_OPTS@,$RM_SHARED_OPTS,;t t - s,@LINK_PROGS@,$LINK_PROGS,;t t - s,@LINK_TESTS@,$LINK_TESTS,;t t - s,@EXTRA_LDFLAGS@,$EXTRA_LDFLAGS,;t t - s,@LOCAL_LDFLAGS@,$LOCAL_LDFLAGS,;t t - s,@LOCAL_LDFLAGS2@,$LOCAL_LDFLAGS2,;t t - s,@INSTALL_LIB@,$INSTALL_LIB,;t t -+s,@RPATH_LIST@,$RPATH_LIST,;t t - s,@BROKEN_LINKER@,$BROKEN_LINKER,;t t - s,@NCURSES_EXT_FUNCS@,$NCURSES_EXT_FUNCS,;t t - s,@NCURSES_CONST@,$NCURSES_CONST,;t t - s,@PTHREAD@,$PTHREAD,;t t - s,@cf_cv_enable_reentrant@,$cf_cv_enable_reentrant,;t t - s,@NCURSES_WRAP_PREFIX@,$NCURSES_WRAP_PREFIX,;t t --s,@ECHO_LINK@,$ECHO_LINK,;t t -+s,@ECHO_LT@,$ECHO_LT,;t t -+s,@ECHO_LD@,$ECHO_LD,;t t -+s,@RULE_CC@,$RULE_CC,;t t -+s,@SHOW_CC@,$SHOW_CC,;t t -+s,@ECHO_CC@,$ECHO_CC,;t t - s,@ADAFLAGS@,$ADAFLAGS,;t t - s,@EXTRA_CFLAGS@,$EXTRA_CFLAGS,;t t - s,@ADA_TRACE@,$ADA_TRACE,;t t -@@ -12109,7 +12651,8 @@ - s,@ADA_OBJECTS@,$ADA_OBJECTS,;t t - s,@ADA_SHAREDLIB@,$ADA_SHAREDLIB,;t t - s,@MAKE_ADA_SHAREDLIB@,$MAKE_ADA_SHAREDLIB,;t t --s,@TINFO_ARGS2@,$TINFO_ARGS2,;t t -+s,@TINFO_LDFLAGS2@,$TINFO_LDFLAGS2,;t t -+s,@TINFO_LIBS@,$TINFO_LIBS,;t t - s,@ACPPFLAGS@,$ACPPFLAGS,;t t - s,@DFT_ARG_SUFFIX@,$DFT_ARG_SUFFIX,;t t - s,@DFT_DEP_SUFFIX@,$DFT_DEP_SUFFIX,;t t -@@ -12237,7 +12780,7 @@ - esac - - if test x"$ac_file" != x-; then -- { echo "$as_me:12240: creating $ac_file" >&5 -+ { echo "$as_me:12783: creating $ac_file" >&5 - echo "$as_me: creating $ac_file" >&6;} - rm -f "$ac_file" - fi -@@ -12255,7 +12798,7 @@ - -) echo $tmp/stdin ;; - [\\/$]*) - # Absolute (can't be DOS-style, as IFS=:) -- test -f "$f" || { { echo "$as_me:12258: error: cannot find input file: $f" >&5 -+ test -f "$f" || { { echo "$as_me:12801: error: cannot find input file: $f" >&5 - echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - echo $f;; -@@ -12268,13 +12811,45 @@ - echo $srcdir/$f - else - # /dev/null tree -- { { echo "$as_me:12271: error: cannot find input file: $f" >&5 -+ { { echo "$as_me:12814: error: cannot find input file: $f" >&5 - echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - fi;; - esac - done` || { (exit 1); exit 1; } - EOF -+cat >>$CONFIG_STATUS <<\EOF -+ ac_warn_datarootdir=no -+ if test x"$ac_file" != x-; then -+ for ac_item in $ac_file_inputs -+ do -+ ac_seen=`grep '@\(datadir\|mandir\|infodir\)@' $ac_item` -+ if test -n "$ac_seen"; then -+ ac_used=`grep '@datarootdir@' $ac_item` -+ if test -z "$ac_used"; then -+ { echo "$as_me:12830: WARNING: datarootdir was used implicitly but not set: -+$ac_seen" >&5 -+echo "$as_me: WARNING: datarootdir was used implicitly but not set: -+$ac_seen" >&2;} -+ ac_warn_datarootdir=yes -+ fi -+ fi -+ ac_seen=`grep '${datarootdir}' $ac_item` -+ if test -n "$ac_seen"; then -+ { echo "$as_me:12839: WARNING: datarootdir was used explicitly but not set: -+$ac_seen" >&5 -+echo "$as_me: WARNING: datarootdir was used explicitly but not set: -+$ac_seen" >&2;} -+ ac_warn_datarootdir=yes -+ fi -+ done -+ fi -+ -+if test "x$ac_warn_datarootdir" = xyes; then -+ ac_sed_cmds="$ac_sed_cmds | sed -e 's,@datarootdir@,\${prefix}/share,g' -e 's,\${datarootdir},\${prefix}/share,g'" -+fi -+ -+EOF - cat >>$CONFIG_STATUS <$tmp/out - rm -f $tmp/stdin - if test x"$ac_file" != x-; then -- mv $tmp/out $ac_file -+ cp $tmp/out $ac_file -+ -+ for ac_name in prefix exec_prefix datarootdir -+ do -+ ac_seen=`fgrep -n '${'$ac_name'[:=].*}' $ac_file` -+ if test -n "$ac_seen"; then -+ ac_init=`egrep '[ ]*'$ac_name'[ ]*=' $ac_file` -+ if test -z "$ac_init"; then -+ ac_seen=`echo "$ac_seen" |sed -e 's,^,'$ac_file':,'` -+ { echo "$as_me:12876: WARNING: Variable $ac_name is used but was not set: -+$ac_seen" >&5 -+echo "$as_me: WARNING: Variable $ac_name is used but was not set: -+$ac_seen" >&2;} -+ fi -+ fi -+ done -+ egrep -n '@[a-z_][a-z_0-9]+@' $ac_file >$tmp/out -+ egrep -n '@[A-Z_][A-Z_0-9]+@' $ac_file >>$tmp/out -+ if test -s $tmp/out; then -+ ac_seen=`sed -e 's,^,'$ac_file':,' < $tmp/out` -+ { echo "$as_me:12887: WARNING: Some variables may not be substituted: -+$ac_seen" >&5 -+echo "$as_me: WARNING: Some variables may not be substituted: -+$ac_seen" >&2;} -+ fi - else - cat $tmp/out -- rm -f $tmp/out - fi -+ rm -f $tmp/out - - done - EOF -@@ -12334,7 +12933,7 @@ - * ) ac_file_in=$ac_file.in ;; - esac - -- test x"$ac_file" != x- && { echo "$as_me:12337: creating $ac_file" >&5 -+ test x"$ac_file" != x- && { echo "$as_me:12936: creating $ac_file" >&5 - echo "$as_me: creating $ac_file" >&6;} - - # First look for the input files in the build tree, otherwise in the -@@ -12345,7 +12944,7 @@ - -) echo $tmp/stdin ;; - [\\/$]*) - # Absolute (can't be DOS-style, as IFS=:) -- test -f "$f" || { { echo "$as_me:12348: error: cannot find input file: $f" >&5 -+ test -f "$f" || { { echo "$as_me:12947: error: cannot find input file: $f" >&5 - echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - echo $f;; -@@ -12358,7 +12957,7 @@ - echo $srcdir/$f - else - # /dev/null tree -- { { echo "$as_me:12361: error: cannot find input file: $f" >&5 -+ { { echo "$as_me:12960: error: cannot find input file: $f" >&5 - echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - fi;; -@@ -12416,7 +13015,7 @@ - rm -f $tmp/in - if test x"$ac_file" != x-; then - if cmp -s $ac_file $tmp/config.h 2>/dev/null; then -- { echo "$as_me:12419: $ac_file is unchanged" >&5 -+ { echo "$as_me:13018: $ac_file is unchanged" >&5 - echo "$as_me: $ac_file is unchanged" >&6;} - else - ac_dir=`$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ -diff -Naur ncurses-5.9/Ada95/configure.in ncurses-5.9.patch/Ada95/configure.in ---- ncurses-5.9/Ada95/configure.in 2011-04-01 00:49:22.000000000 +0200 -+++ ncurses-5.9.patch/Ada95/configure.in 2014-09-01 16:33:22.223791902 +0200 -@@ -1,5 +1,5 @@ - dnl*************************************************************************** --dnl Copyright (c) 2010,2011 Free Software Foundation, Inc. * -+dnl Copyright (c) 2010-2012,2013 Free Software Foundation, Inc. * - dnl * - dnl Permission is hereby granted, free of charge, to any person obtaining a * - dnl copy of this software and associated documentation files (the * -@@ -28,24 +28,20 @@ - dnl - dnl Author: Thomas E. Dickey - dnl --dnl $Id: configure.in,v 1.30 2011/03/31 22:49:22 tom Exp $ -+dnl $Id: configure.in,v 1.49 2013/11/16 20:06:37 tom Exp $ - dnl Process this file with autoconf to produce a configure script. - dnl - dnl See http://invisible-island.net/autoconf/ for additional information. - dnl - dnl --------------------------------------------------------------------------- --AC_PREREQ(2.13.20020210) --AC_REVISION($Revision: 1.30 $) -+AC_PREREQ(2.52.20030208) -+AC_REVISION($Revision: 1.49 $) - AC_INIT(gen/gen.c) - AC_CONFIG_HEADER(include/ncurses_cfg.h:include/ncurses_cfg.hin) - - CF_TOP_BUILDDIR - --CF_CHECK_CACHE([AC_CANONICAL_SYSTEM]) --AC_ARG_WITH(system-type, --[ --with-system-type=XXX test: override derived host system-type], --[AC_MSG_WARN(overriding system type to $withval) -- cf_cv_system_name=$withval]) -+CF_WITH_SYSTYPE - - ### Save the given $CFLAGS to allow user-override. - cf_user_CFLAGS="$CFLAGS" -@@ -54,15 +50,10 @@ - CF_CFG_DEFAULTS - - ### Checks for programs. --AC_PROG_CC --CF_GCC_VERSION -- -+CF_PROG_CC(gnatgcc gcc cc) - AC_PROG_CPP - AC_PROG_GCC_TRADITIONAL - CF_PROG_CC_C_O(CC) --AC_ISC_POSIX --CF_ANSI_CC_REQD --CF_PROG_EXT - - AC_ARG_PROGRAM - -@@ -75,28 +66,8 @@ - - # if we find pkg-config, check if we should install the ".pc" files. - CF_PKG_CONFIG -- --if test "$PKG_CONFIG" != none ; then -- AC_MSG_CHECKING(if we should install .pc files for $PKG_CONFIG) -- -- # Leave this as something that can be overridden in the environment. -- if test -z "$PKG_CONFIG_LIBDIR" ; then -- PKG_CONFIG_LIBDIR=`echo "$PKG_CONFIG" | sed -e 's,/[[^/]]*/[[^/]]*$,,'`/lib/pkgconfig -- fi -- PKG_CONFIG_LIBDIR=`echo "$PKG_CONFIG_LIBDIR" | sed -e 's/^://' -e 's/:.*//'` -- if test -n "$PKG_CONFIG_LIBDIR" && test -d "$PKG_CONFIG_LIBDIR" ; then -- AC_ARG_ENABLE(pc-files, -- [ --enable-pc-files generate and install .pc files for pkg-config], -- [enable_pc_files=$enableval], -- [enable_pc_files=no]) -- AC_MSG_RESULT($enable_pc_files) -- else -- AC_MSG_RESULT(no) -- AC_MSG_WARN(did not find library $PKG_CONFIG_LIBDIR) -- enable_pc_files=no -- fi --fi --AC_SUBST(PKG_CONFIG_LIBDIR) -+CF_WITH_PKG_CONFIG_LIBDIR -+CF_ENABLE_PC_FILES - - AC_MSG_CHECKING(if you want to build test-programs) - AC_ARG_WITH(tests, -@@ -130,6 +101,7 @@ - AC_CHECK_TOOL(LD, ld, ld) - AC_CHECK_TOOL(AR, ar, ar) - CF_AR_FLAGS -+CF_PATHSEP - - dnl Special option for use by system-builders: the install-prefix is used to - dnl adjust the location into which the actual install is done, so that an -@@ -186,9 +158,7 @@ - - CF_NCURSES_ADDON - --CF_LIB_PREFIX(cf_prefix) --LIB_PREFIX=$cf_prefix --AC_SUBST(LIB_PREFIX) -+CF_WITH_LIB_PREFIX(cf_prefix) - - LIB_SUFFIX= - AC_SUBST(LIB_SUFFIX) -@@ -235,8 +205,6 @@ - ############################################################################### - CF_HELP_MESSAGE(Fine-Tuning Your Configuration:) - --CF_PATHSEP -- - ### use option --enable-broken-linker to force on use of broken-linker support - AC_MSG_CHECKING(if you want broken-linker support code) - AC_ARG_ENABLE(broken_linker, -@@ -272,7 +240,7 @@ - [with_rcs_ids=$withval], - [with_rcs_ids=no]) - AC_MSG_RESULT($with_rcs_ids) --test "$with_rcs_ids" = yes && AC_DEFINE(USE_RCS_IDS) -+test "$with_rcs_ids" = yes && AC_DEFINE(USE_RCS_IDS,1,[Define to 1 if RCS identifiers should be compiled-in)]) - - ############################################################################### - CF_HELP_MESSAGE(Extensions:) -@@ -286,8 +254,8 @@ - AC_MSG_RESULT($with_ext_funcs) - if test "$with_ext_funcs" = yes ; then - NCURSES_EXT_FUNCS=1 -- AC_DEFINE(HAVE_USE_DEFAULT_COLORS) -- AC_DEFINE(NCURSES_EXT_FUNCS) -+ AC_DEFINE(HAVE_USE_DEFAULT_COLORS,1,[Define to 1 if we have use_default_colors function]) -+ AC_DEFINE(NCURSES_EXT_FUNCS,1,[Define to 1 if we have ncurses extended functions]) - else - NCURSES_EXT_FUNCS=0 - fi -@@ -337,12 +305,12 @@ - fi - - if test $cf_cv_weak_symbols = yes ; then -- AC_DEFINE(USE_WEAK_SYMBOLS) -+ AC_DEFINE(USE_WEAK_SYMBOLS,1,[Define to 1 to enable weak-symbols for pthreads]) - fi - - PTHREAD= - if test "$with_pthread" = "yes" ; then -- AC_DEFINE(USE_PTHREADS) -+ AC_DEFINE(USE_PTHREADS,1,[Define to 1 to use the pthreads library]) - enable_reentrant=yes - if test $cf_cv_weak_symbols = yes ; then - PTHREAD=-lpthread -@@ -370,7 +338,7 @@ - elif test "$assume_reentrant" = no ; then - LIB_SUFFIX="t${LIB_SUFFIX}" - fi -- AC_DEFINE(USE_REENTRANT) -+ AC_DEFINE(USE_REENTRANT,1,[Define to 1 to compile with experimental reentrant code]) - else - cf_cv_enable_reentrant=0 - fi -@@ -388,24 +356,13 @@ - NCURSES_WRAP_PREFIX=_nc_ - fi - AC_SUBST(NCURSES_WRAP_PREFIX) --AC_DEFINE_UNQUOTED(NCURSES_WRAP_PREFIX,"$NCURSES_WRAP_PREFIX") -+AC_DEFINE_UNQUOTED(NCURSES_WRAP_PREFIX,"$NCURSES_WRAP_PREFIX",[Define to override _nc_ ncurses internal prefix]) - - ############################################################################### - CF_HELP_MESSAGE(Testing/development Options:) - - ### use option --disable-echo to suppress full display compiling commands --AC_MSG_CHECKING(if you want to display full commands during build) --AC_ARG_ENABLE(echo, -- [ --enable-echo build: display "compiling" commands (default)], -- [with_echo=$enableval], -- [with_echo=yes]) --if test "$with_echo" = yes; then -- ECHO_LINK= --else -- ECHO_LINK='@ echo linking $@ ... ;' --fi --AC_MSG_RESULT($with_echo) --AC_SUBST(ECHO_LINK) -+CF_DISABLE_ECHO - - ### use option --enable-warnings to turn on all gcc warnings - AC_MSG_CHECKING(if you want to see compiler warnings) -@@ -416,7 +373,7 @@ - - if test "x$with_warnings" = "xyes"; then - CF_ADD_ADAFLAGS(-gnatg) -- CF_GCC_WARNINGS(Wdeclaration-after-statement Wextra Wno-unknown-pragmas Wswitch-enum) -+ CF_GCC_WARNINGS(Wno-unknown-pragmas Wswitch-enum) - fi - CF_GCC_ATTRIBUTES - -@@ -431,7 +388,6 @@ - then - if test "$with_assertions" = no - then -- AC_DEFINE(NDEBUG) - CPPFLAGS="$CPPFLAGS -DNDEBUG" - else - CF_ADD_ADAFLAGS(-gnata) -@@ -439,17 +395,17 @@ - fi - - ### use option --disable-leaks to suppress "permanent" leaks, for testing --AC_DEFINE(HAVE_NC_ALLOC_H) -+AC_DEFINE(HAVE_NC_ALLOC_H,1,[Define to 1 if we have nc_alloc.h header]) - - ### use option --enable-expanded to generate certain macros as functions - AC_ARG_ENABLE(expanded, - [ --enable-expanded test: generate functions for certain macros], -- [test "$enableval" = yes && AC_DEFINE(NCURSES_EXPANDED)]) -+ [test "$enableval" = yes && AC_DEFINE(NCURSES_EXPANDED,1,[Define to 1 if ncurses macros should be expanded as functions])]) - - ### use option --disable-macros to suppress macros in favor of functions - AC_ARG_ENABLE(macros, - [ --disable-macros test: use functions rather than macros], -- [test "$enableval" = no && AC_DEFINE(NCURSES_NOMACROS)]) -+ [test "$enableval" = no && AC_DEFINE(NCURSES_NOMACROS,1,[Define to 1 if ncurses macros should be expanded as functions])]) - - # Normally we only add trace() to the debug-library. Allow this to be - # extended to all models of the ncurses library: -@@ -485,7 +441,7 @@ - AC_DEFINE(HAVE_GETTIMEOFDAY),[ - - AC_CHECK_LIB(bsd, gettimeofday, -- AC_DEFINE(HAVE_GETTIMEOFDAY) -+ AC_DEFINE(HAVE_GETTIMEOFDAY,1,[Define to 1 if we have gettimeofday]) - LIBS="$LIBS -lbsd")])dnl CLIX: bzero, select, gettimeofday - ;; - esac -@@ -505,8 +461,6 @@ - ### Checks for library functions. - CF_MKSTEMP - --AC_TYPE_SIGNAL -- - dnl We'll do our own -g libraries, unless the user's overridden via $CFLAGS - if test -z "$cf_user_CFLAGS" && test "$with_no_leaks" = no ; then - CF_STRIP_G_OPT(CFLAGS) -@@ -514,24 +468,13 @@ - fi - - CF_HELP_MESSAGE(Ada95 Binding Options:) -- -+cf_with_ada=yes - dnl Check for availability of GNU Ada Translator (GNAT). - dnl At the moment we support no other Ada95 compiler. - if test "$cf_with_ada" != "no" ; then - CF_PROG_GNAT - if test "$cf_cv_prog_gnat_correct" = yes; then -- -- # make ADAFLAGS consistent with CFLAGS -- case "$CFLAGS" in -- *-g*) -- CF_ADD_ADAFLAGS(-g) -- ;; -- esac -- case "$CFLAGS" in -- *-O*) -- CF_ADD_ADAFLAGS(-O3) -- ;; -- esac -+ CF_FIXUP_ADAFLAGS - - CF_GNAT_GENERICS - CF_GNAT_SIGINT -@@ -556,8 +499,10 @@ - ################################################################################ - - # not needed --TINFO_ARGS2= --AC_SUBST(TINFO_ARGS2) -+TINFO_LDFLAGS2= -+AC_SUBST(TINFO_LDFLAGS2) -+TINFO_LIBS= -+AC_SUBST(TINFO_LIBS) - - ### Construct the list of include-directories to be generated - CF_INCLUDE_DIRS -@@ -586,6 +531,9 @@ - cygwin*) - # "lib" files have ".dll.a" suffix, "cyg" files have ".dll" - ;; -+ msys*) -+ # "lib" files have ".dll.a" suffix, "msys-" files have ".dll" -+ ;; - esac - fi - -@@ -594,7 +542,7 @@ - - SUB_MAKEFILES="gen/adacurses${DFT_ARG_SUFFIX}-config:gen/adacurses-config.in" - --AC_DEFINE_UNQUOTED(NCURSES_PATHSEP,'$PATH_SEPARATOR') -+AC_DEFINE_UNQUOTED(NCURSES_PATHSEP,'$PATH_SEPARATOR',[Define to override ':' as the library path-separator]) - - ### Now that we're done running tests, add the compiler-warnings, if any - CF_ADD_CFLAGS($EXTRA_CFLAGS) -@@ -656,8 +604,8 @@ - AWK="$AWK" - DFT_ARG_SUFFIX="$DFT_ARG_SUFFIX" - DFT_LWR_MODEL="$DFT_LWR_MODEL" --ECHO_LINK="$ECHO_LINK" - LIB_NAME="$LIB_NAME" -+LIB_PREFIX="$LIB_PREFIX" - LIB_SUFFIX="$LIB_SUFFIX" - LN_S="$LN_S" - NCURSES_MAJOR="$NCURSES_MAJOR" -diff -Naur ncurses-5.9/Ada95/doc/Makefile.in ncurses-5.9.patch/Ada95/doc/Makefile.in ---- ncurses-5.9/Ada95/doc/Makefile.in 2011-03-26 20:26:17.000000000 +0100 -+++ ncurses-5.9.patch/Ada95/doc/Makefile.in 2014-09-01 16:33:22.223791902 +0200 -@@ -1,4 +1,4 @@ --# $Id: Makefile.in,v 1.2 2011/03/26 19:26:17 tom Exp $ -+# $Id: Makefile.in,v 1.3 2012/08/11 21:31:56 tom Exp $ - ############################################################################## - # Copyright (c) 2011 Free Software Foundation, Inc. # - # # -@@ -38,6 +38,7 @@ - srcdir = @srcdir@ - prefix = @prefix@ - exec_prefix = @exec_prefix@ -+datarootdir = @datarootdir@ - datadir = @datadir@ - mandir = @mandir@ - -diff -Naur ncurses-5.9/Ada95/gen/gen.c ncurses-5.9.patch/Ada95/gen/gen.c ---- ncurses-5.9/Ada95/gen/gen.c 2011-04-01 01:50:24.000000000 +0200 -+++ ncurses-5.9.patch/Ada95/gen/gen.c 2014-09-01 16:33:22.225791905 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998,2010,2011 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2013,2014 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -32,7 +32,7 @@ - - /* - Version Control -- $Id: gen.c,v 1.59 2011/03/31 23:50:24 tom Exp $ -+ $Id: gen.c,v 1.64 2014/02/01 19:52:47 tom Exp $ - --------------------------------------------------------------------------*/ - /* - This program generates various record structures and constants from the -@@ -57,9 +57,14 @@ - #include - #include - --#define UChar(c) ((unsigned char)(c)) -+#undef UCHAR -+#undef UINT -+#define UChar(c) ((UCHAR)(c)) - #define RES_NAME "Reserved" - -+typedef unsigned char UCHAR; -+typedef unsigned int UINT; -+ - static const char *model = ""; - static int little_endian = 0; - -@@ -70,45 +75,43 @@ - } - name_attribute_pair; - --static int --find_pos(char *s, unsigned len, int *low, int *high) --{ -- unsigned int i, j; -- int l = 0; -+static UCHAR -+bit_is_set(const UCHAR * const data, -+ const UINT offset) -+{ -+ const UCHAR byte = data[offset >> 3]; -+ UINT bit; -+ -+ if (little_endian) -+ bit = offset; /* offset */ -+ else /* or */ -+ bit = ~offset; /* 7 - offset */ -+ bit &= 7; /* modulo 8 */ -+ return byte & (UCHAR) (1 << bit); -+} - -- *high = -1; -- *low = (int)(8 * len); -+/* Find lowest and highest used offset in a byte array. */ -+/* Returns 0 if and only if all bits are unset. */ -+static int -+find_pos(const UCHAR * const data, -+ const UINT sizeof_data, -+ UINT * const low, -+ UINT * const high) -+{ -+ const UINT last = (sizeof_data << 3) - 1; -+ UINT offset; -+ -+ for (offset = last; !bit_is_set(data, offset); offset--) -+ if (!offset) /* All bits are 0. */ -+ return 0; -+ *high = offset; - -- for (i = 0; i < len; i++, s++) -+ for (offset = 0; !bit_is_set(data, offset); offset++) - { -- if (*s) -- { -- for (j = 0; j < 8 * sizeof(char); j++) -- -- { -- if (((little_endian && ((*s) & 0x01)) || -- (!little_endian && ((*s) & 0x80)))) -- { -- if (l > *high) -- *high = l; -- if (l < *low) -- *low = l; -- } -- l++; -- if (little_endian) -- { -- *s >>= 1; -- } -- else -- { -- *s = (char)(*s << 1); -- } -- } -- } -- else -- l += 8; - } -- return (*high >= 0 && (*low <= *high)) ? *low : -1; -+ *low = offset; -+ -+ return -1; - } - - /* -@@ -116,63 +119,38 @@ - * record type defined in the binding. - * We are only dealing with record types which are of 32 or 16 - * bit size, i.e. they fit into an (u)int or a (u)short. -+ * Any pair with a 0 attr field will be ignored. - */ - static void - gen_reps( - const name_attribute_pair * nap, /* array of name_attribute_pair records */ - const char *name, /* name of the represented record type */ -- int len, /* size of the record in bytes */ -- int bias) -+ const UINT len, /* size of the record in bytes */ -+ const UINT bias) - { -- const char *unused_name = "Unused"; -- int long_bits = (8 * (int)sizeof(unsigned long)); -- int len_bits = (8 * len); -- int i, j, n, l, cnt = 0, low, high; -+ const UINT len_bits = len << 3; -+ int i, l; -+ UINT low, high; - int width = strlen(RES_NAME) + 3; -- unsigned long a; -- unsigned long mask = 0; - - assert(nap != NULL); - - for (i = 0; nap[i].name != (char *)0; i++) -- { -- cnt++; -- l = (int)strlen(nap[i].name); -- if (l > width) -- width = l; -- } -+ if (nap[i].attr) -+ { -+ l = (int)strlen(nap[i].name); -+ if (l > width) -+ width = l; -+ } - assert(width > 0); - - printf(" type %s is\n", name); - printf(" record\n"); - for (i = 0; nap[i].name != (char *)0; i++) -- { -- mask |= nap[i].attr; -- printf(" %-*s : Boolean;\n", width, nap[i].name); -- } -- -- /* -- * Compute a mask for the unused bits in this target. -- */ -- mask = ~mask; -- /* -- * Bits in the biased area are unused by the target. -- */ -- for (j = 0; j < bias; ++j) -- { -- mask &= (unsigned long)(~(1L << j)); -- } -- /* -- * Bits past the target's size are really unused. -- */ -- for (j = len_bits + bias; j < long_bits; ++j) -- { -- mask &= (unsigned long)(~(1L << j)); -- } -- if (mask != 0) -- { -- printf(" %-*s : Boolean;\n", width, unused_name); -- } -+ if (nap[i].attr) -+ { -+ printf(" %-*s : Boolean;\n", width, nap[i].name); -+ } - printf(" end record;\n"); - printf(" pragma Convention (C, %s);\n\n", name); - -@@ -180,24 +158,16 @@ - printf(" record\n"); - - for (i = 0; nap[i].name != (char *)0; i++) -- { -- a = nap[i].attr; -- l = find_pos((char *)&a, sizeof(a), &low, &high); -- if (l >= 0) -- printf(" %-*s at 0 range %2d .. %2d;\n", width, nap[i].name, -- low - bias, high - bias); -- } -- if (mask != 0) -- { -- l = find_pos((char *)&mask, sizeof(mask), &low, &high); -- if (l >= 0) -- printf(" %-*s at 0 range %2d .. %2d;\n", width, unused_name, -- low - bias, high - bias); -- } -- i = 1; -- n = cnt; -+ if (nap[i].attr) -+ { -+ if (find_pos((const UCHAR *)(&(nap[i].attr)) + bias, len, &low, &high)) -+ printf(" %-*s at 0 range %2d .. %2d;\n", width, nap[i].name, -+ low, high); -+ } - printf(" end record;\n"); -+ printf(" pragma Warnings (Off);"); - printf(" for %s'Size use %d;\n", name, len_bits); -+ printf(" pragma Warnings (On);\n"); - printf(" -- Please note: this rep. clause is generated and may be\n"); - printf(" -- different on your system."); - } -@@ -207,10 +177,9 @@ - { - attr_t x = (attr_t)-1; - attr_t t = x & mask; -- int low, high; -- int l = find_pos((char *)&t, sizeof(t), &low, &high); -+ UINT low, high; - -- if (l >= 0) -+ if (find_pos((const UCHAR *)(&t), sizeof(t), &low, &high)) - printf(" %-5s at 0 range %2d .. %2d;\n", name, low, high); - } - -@@ -231,10 +200,9 @@ - static void - mrep_rep(const char *name, void *rec) - { -- int low, high; -- int l = find_pos((char *)rec, sizeof(MEVENT), &low, &high); -+ UINT low, high; - -- if (l >= 0) -+ if (find_pos((const UCHAR *)rec, sizeof(MEVENT), &low, &high)) - printf(" %-7s at 0 range %3d .. %3d;\n", name, low, high); - } - -@@ -278,54 +246,26 @@ - * 1999-2000), the ifdef's also were needed since the proposed bit-layout - * for wide characters allocated 16-bits for A_CHARTEXT, leaving too few - * bits for a few of the A_xxx symbols. -+ * Some preprocessors are not able to test the values because they -+ * now (2014) contain an explicit cast to chtype, so we avoid ifdef. - */ - static const name_attribute_pair nap[] = - { --#if A_STANDOUT - {"Stand_Out", A_STANDOUT}, --#endif --#if A_UNDERLINE - {"Under_Line", A_UNDERLINE}, --#endif --#if A_REVERSE - {"Reverse_Video", A_REVERSE}, --#endif --#if A_BLINK - {"Blink", A_BLINK}, --#endif --#if A_DIM - {"Dim_Character", A_DIM}, --#endif --#if A_BOLD - {"Bold_Character", A_BOLD}, --#endif --#if A_ALTCHARSET - {"Alternate_Character_Set", A_ALTCHARSET}, --#endif --#if A_INVIS - {"Invisible_Character", A_INVIS}, --#endif --#if A_PROTECT - {"Protected_Character", A_PROTECT}, --#endif --#if A_HORIZONTAL - {"Horizontal", A_HORIZONTAL}, --#endif --#if A_LEFT - {"Left", A_LEFT}, --#endif --#if A_LOW - {"Low", A_LOW}, --#endif --#if A_RIGHT - {"Right", A_RIGHT}, --#endif --#if A_TOP - {"Top", A_TOP}, --#endif --#if A_VERTICAL - {"Vertical", A_VERTICAL}, --#endif - {(char *)0, 0} - }; - chtype attr = A_ATTRIBUTES & ~A_COLOR; -@@ -348,7 +288,9 @@ - } - attr = attr >> 1; - } -- gen_reps(nap, name, (len + 7) / 8, little_endian ? start : 0); -+ gen_reps(nap, name, -+ (UINT) ((len + 7) / 8), -+ (UINT) (little_endian ? start >> 3 : 0)); - } - - static void -@@ -371,7 +313,9 @@ - {"Attributes_And_Colors", TRACE_ATTRS}, - {(char *)0, 0} - }; -- gen_reps(nap, name, sizeof(int), 0); -+ -+ gen_reps(nap, name, sizeof(UINT), -+ little_endian ? 0 : sizeof(nap[0].attr) - sizeof(UINT)); - } - - static void -@@ -399,7 +343,9 @@ - #endif - {(char *)0, 0} - }; -- gen_reps(nap, name, sizeof(int), 0); -+ -+ gen_reps(nap, name, sizeof(Menu_Options), -+ little_endian ? 0 : sizeof(nap[0].attr) - sizeof(Menu_Options)); - } - - static void -@@ -412,7 +358,9 @@ - #endif - {(char *)0, 0} - }; -- gen_reps(nap, name, sizeof(int), 0); -+ -+ gen_reps(nap, name, sizeof(Item_Options), -+ little_endian ? 0 : sizeof(nap[0].attr) - sizeof(Item_Options)); - } - - static void -@@ -428,7 +376,9 @@ - #endif - {(char *)0, 0} - }; -- gen_reps(nap, name, sizeof(int), 0); -+ -+ gen_reps(nap, name, sizeof(Form_Options), -+ little_endian ? 0 : sizeof(nap[0].attr) - sizeof(Form_Options)); - } - - /* -@@ -471,7 +421,9 @@ - #endif - {(char *)0, 0} - }; -- gen_reps(nap, name, sizeof(int), 0); -+ -+ gen_reps(nap, name, sizeof(Field_Options), -+ little_endian ? 0 : sizeof(nap[0].attr) - sizeof(Field_Options)); - } - - /* -diff -Naur ncurses-5.9/Ada95/gen/Makefile.in ncurses-5.9.patch/Ada95/gen/Makefile.in ---- ncurses-5.9/Ada95/gen/Makefile.in 2011-03-27 00:36:30.000000000 +0100 -+++ ncurses-5.9.patch/Ada95/gen/Makefile.in 2014-09-01 16:33:22.224791904 +0200 -@@ -1,5 +1,5 @@ - ############################################################################## --# Copyright (c) 1998-2010,2011 Free Software Foundation, Inc. # -+# Copyright (c) 1998-2011,2012 Free Software Foundation, Inc. # - # # - # Permission is hereby granted, free of charge, to any person obtaining a # - # copy of this software and associated documentation files (the "Software"), # -@@ -28,7 +28,7 @@ - # - # Author: Juergen Pfeifer, 1996 - # --# $Id: Makefile.in,v 1.74 2011/03/26 23:36:30 tom Exp $ -+# $Id: Makefile.in,v 1.77 2012/10/06 18:58:48 tom Exp $ - # - .SUFFIXES: - -@@ -36,7 +36,7 @@ - VPATH = @srcdir@ - THIS = Makefile - --x = @PROG_EXT@ -+x = @EXEEXT@ - - top_srcdir = @top_srcdir@ - DESTDIR = @DESTDIR@ -@@ -73,7 +73,7 @@ - LOCAL_LIBDIR = @top_builddir@/lib - - LINK = $(HOST_CC) --LD_FLAGS = @LD_MODEL@ $(LOCAL_LIBS) @LDFLAGS@ @LIBS@ @LOCAL_LDFLAGS2@ $(LDFLAGS) @TINFO_ARGS2@ -+LD_FLAGS = @LD_MODEL@ $(LOCAL_LIBS) @TINFO_LDFLAGS2@ @LDFLAGS@ @LIBS@ @LOCAL_LDFLAGS2@ $(LDFLAGS) @TINFO_LIBS@ - - RANLIB = @RANLIB@ - -@@ -179,7 +179,7 @@ - -rm -f $(DESTDIR)$(bindir)/$(ADACURSES_CONFIG) - - $(PROG_GENERATE): gen.o -- @ECHO_LINK@ $(LINK) $(CFLAGS_NORMAL) gen.o $(LD_FLAGS) -o $@ -+ @ECHO_LD@ $(LINK) $(CFLAGS_NORMAL) gen.o $(LD_FLAGS) -o $@ - - gen.o: $(srcdir)/gen.c - $(HOST_CC) $(CFLAGS_NORMAL) -c -o $@ $(srcdir)/gen.c -@@ -411,7 +411,7 @@ - @mkdir -p $(HTML_DIR) - cp -p ../src/*.ad[sb] . && chmod +w *.ad[sb] - @USE_OLD_MAKERULES@ ln -sf ../src/*.ali . --@USE_GNAT_PROJECTS@ ln -sf ../static-ali/*.ali . -+@USE_GNAT_PROJECTS@ ln -sf ../static-ali/*.ali . - @echo "Filtering generated files" - @for f in $(GEN_SRC); do \ - h=`basename $$f` ;\ -diff -Naur ncurses-5.9/Ada95/gen/terminal_interface-curses-forms-field_types.ads.m4 ncurses-5.9.patch/Ada95/gen/terminal_interface-curses-forms-field_types.ads.m4 ---- ncurses-5.9/Ada95/gen/terminal_interface-curses-forms-field_types.ads.m4 2011-03-19 00:10:43.000000000 +0100 -+++ ncurses-5.9.patch/Ada95/gen/terminal_interface-curses-forms-field_types.ads.m4 2014-09-01 16:33:22.225791905 +0200 -@@ -38,7 +38,7 @@ - ------------------------------------------------------------------------------ - -- Author: Juergen Pfeifer, 1996 - -- Version Control: ---- $Revision: 1.16 $ -+-- $Revision: 1.17 $ - -- Binding Version 01.00 - ------------------------------------------------------------------------------ - with Interfaces.C; -diff -Naur ncurses-5.9/Ada95/include/ncurses_defs ncurses-5.9.patch/Ada95/include/ncurses_defs ---- ncurses-5.9/Ada95/include/ncurses_defs 2008-11-16 01:19:59.000000000 +0100 -+++ ncurses-5.9.patch/Ada95/include/ncurses_defs 2014-09-01 16:33:22.225791905 +0200 -@@ -1,6 +1,6 @@ --# $Id: ncurses_defs,v 1.41 2008/11/16 00:19:59 juergen Exp $ -+# $Id: ncurses_defs,v 1.44 2013/04/27 19:50:17 tom Exp $ - ############################################################################## --# Copyright (c) 2000-2007,2008 Free Software Foundation, Inc. # -+# Copyright (c) 2000-2012,2013 Free Software Foundation, Inc. # - # # - # Permission is hereby granted, free of charge, to any person obtaining a # - # copy of this software and associated documentation files (the "Software"), # -@@ -33,7 +33,6 @@ - - BROKEN_LINKER - BSD_TPUTS --CC_HAS_PROTOS - CPP_HAS_PARAM_INIT - CURSES_ACS_ARRAY acs_map - CURSES_WACS_ARRAY _nc_wacs -@@ -120,7 +119,6 @@ - HAVE_SIZECHANGE - HAVE_SLK_COLOR - HAVE_SLK_INIT 1 --HAVE_STRDUP - HAVE_STRSTR - HAVE_SYMLINK - HAVE_SYS_BSDTYPES_H -@@ -174,7 +172,6 @@ - NEED_PTEM_H - NO_LEAKS - PURE_TERMINFO --RETSIGTYPE - STDC_HEADERS - SVR4_ACTION - SVR4_TERMIO -diff -Naur ncurses-5.9/Ada95/make-tar.sh ncurses-5.9.patch/Ada95/make-tar.sh ---- ncurses-5.9/Ada95/make-tar.sh 2011-03-26 20:07:38.000000000 +0100 -+++ ncurses-5.9.patch/Ada95/make-tar.sh 2014-09-01 16:33:22.226791906 +0200 -@@ -1,7 +1,7 @@ - #!/bin/sh --# $Id: make-tar.sh,v 1.12 2011/03/26 19:07:38 tom Exp $ -+# $Id: make-tar.sh,v 1.14 2013/10/26 23:10:24 tom Exp $ - ############################################################################## --# Copyright (c) 2010,2011 Free Software Foundation, Inc. # -+# Copyright (c) 2010-2011,2013 Free Software Foundation, Inc. # - # # - # Permission is hereby granted, free of charge, to any person obtaining a # - # copy of this software and associated documentation files (the "Software"), # -@@ -66,11 +66,11 @@ - make_changelog() { - test -f $1 && chmod u+w $1 - cat >$1 < - -+ - - - - -+ "HTML Tidy for Linux (vers 25 March 2009), see www.w3.org"> - - Announcing ncurses @VERSION@ - -@@ -42,12 +42,13 @@ - - - --

Announcing ncurses @VERSION@

The ncurses (new curses) -- library is a free software emulation of curses in System V -- Release 4.0, and more. It uses terminfo format, supports pads and -- color and multiple highlights and forms characters and -- function-key mapping, and has all the other SYSV-curses -- enhancements over BSD curses. -+

Announcing ncurses @VERSION@

-+ -+

The ncurses (new curses) library is a free software emulation -+ of curses in System V Release 4.0, and more. It uses terminfo -+ format, supports pads and color and multiple highlights and forms -+ characters and function-key mapping, and has all the other -+ SYSV-curses enhancements over BSD curses.

- -

In mid-June 1995, the maintainer of 4.4BSD curses declared - that he considered 4.4BSD curses obsolete, and encouraged the -@@ -73,38 +74,50 @@ - It is also available at ftp://invisible-island.net/ncurses/ .

- --

Release Notes

This release is designed to be upward -- compatible from ncurses 5.0 through 5.8; very few applications -- will require recompilation, depending on the platform. These are -- the highlights from the change-log since ncurses 5.8 release. --

-- This is a bug-fix release, correcting a small number of urgent problems -- in the ncurses library from the 5.8 release. --

-- It also improves the Ada95 binding: -+

Release Notes

-+ -+

This release is designed to be upward compatible from ncurses -+ 5.0 through 5.8; very few applications will require -+ recompilation, depending on the platform. These are the -+ highlights from the change-log since ncurses 5.8 release.

-+ -+

This is a bug-fix release, correcting a small number of urgent -+ problems in the ncurses library from the 5.8 release.

-+ -+

It also improves the Ada95 binding:

-+ -
    --
  • fixes a longstanding portability problem with its use of the -- set_field_type -- function. Because that function uses variable-length argument lists, -- its interface with gnat does not work with certain platforms. --
  • improves configurability and portability, particularly when built -- separately from the main ncurses tree. The 5.8 release introduced -- scripts which can be used to construct separate tarballs for the -- Ada95 and ncurses examples. --

    Those were a proof of concept. For the 5.9 release, those -- scripts are augmented with rpm- and dpkg-scripts used in test builds -- against a variety of gnat- and system ncurses versions as old as -- gnat 3.15 and ncurses 5.4 (see snapshots and systems tested -- here. --

  • additional improvements were made for portability of the -- ncurses examples, adding rpm- and dpkg-scripts for test-builds. -- See -- this page -- for snapshots and other information. -+
  • fixes a longstanding portability problem with its use of -+ the set_field_type -+ function. Because that function uses variable-length argument -+ lists, its interface with gnat does not work with certain -+ platforms.
  • -+ -+
  • improves configurability and portability, particularly when -+ built separately from the main ncurses tree. The 5.8 release -+ introduced scripts which can be used to construct separate -+ tarballs for the Ada95 and ncurses examples. -+ -+

    Those were a proof of concept. For the 5.9 release, those -+ scripts are augmented with rpm- and dpkg-scripts used in test -+ builds against a variety of gnat- and system ncurses versions -+ as old as gnat 3.15 and ncurses 5.4 (see snapshots and -+ systems tested here.

    -+
  • -+ -+
  • additional improvements were made for portability of the -+ ncurses examples, adding rpm- and dpkg-scripts for test-builds. -+ See this -+ page for snapshots and other information.
  • -
- --

Features of Ncurses

The ncurses package is fully -- compatible with SVr4 (System V Release 4) curses: -+

Features of Ncurses

-+ -+

The ncurses package is fully compatible with SVr4 (System V -+ Release 4) curses:

- -
    -
  • All 257 of the SVr4 calls have been implemented (and are -@@ -132,8 +145,10 @@ - entries for use with less capable - curses/terminfo versions such - as the HP/UX and AIX ports.
  • --
The ncurses package also has many useful extensions over -- SVr4: -+ -+ -+

The ncurses package also has many useful extensions over -+ SVr4:

- -
    -
  • The API is 8-bit clean and base-level conformant with the -@@ -249,12 +264,14 @@ - interface.
  • -
- --

State of the Package

Numerous bugs present in earlier -- versions have been fixed; the library is far more reliable than -- it used to be. Bounds checking in many `dangerous' entry points -- has been improved. The code is now type-safe according to gcc -- -Wall. The library has been checked for malloc leaks and arena -- corruption by the Purify memory-allocation tester. -+

State of the Package

-+ -+

Numerous bugs present in earlier versions have been fixed; the -+ library is far more reliable than it used to be. Bounds checking -+ in many `dangerous' entry points has been improved. The code is -+ now type-safe according to gcc -Wall. The library has been -+ checked for malloc leaks and arena corruption by the Purify -+ memory-allocation tester.

- -

The ncurses code has been tested with a wide variety of - applications including (versions starting with those noted):

-@@ -321,8 +338,10 @@ - -
newsreader, supporting color, MIME http://www.tin.org/
-- as well as some that use ncurses for the terminfo support -- alone: -+ -+ -+

as well as some that use ncurses for the terminfo support -+ alone:

- -
-
minicom
-@@ -341,15 +360,17 @@ -

The ncurses distribution includes a selection of test programs - (including a few games).

- --

Who's Who and What's What

Zeyd Ben-Halim started it from -- a previous package pcurses, written by Pavel Curtis. Eric S. -- Raymond continued development. Jürgen Pfeifer wrote most of -- the form and menu libraries. Ongoing work is being done by -- Thomas Dickey. -- Thomas Dickey acts as the maintainer for the Free Software -- Foundation, which holds the copyright on ncurses. Contact the -- current maintainers at bug-ncurses@gnu.org. -+

Who's Who and What's What

-+ -+

Zeyd Ben-Halim started it from a previous package pcurses, -+ written by Pavel Curtis. Eric S. Raymond continued development. -+ Jürgen Pfeifer wrote most of the form and menu libraries. -+ Ongoing work is being done by Thomas Dickey. Thomas -+ Dickey acts as the maintainer for the Free Software Foundation, -+ which holds the copyright on ncurses. Contact the current -+ maintainers at bug-ncurses@gnu.org.

- -

To join the ncurses mailing list, please write email to - bug-ncurses-request@gnu.org containing the line:

-@@ -364,6 +385,13 @@ - are made available at ftp://invisible-island.net/ncurses/ .

- -+

There is an archive of the mailing list here:

-+ -+

http://lists.gnu.org/archive/html/bug-ncurses -+ (also https)

-+ -

Future Plans

- -
    -@@ -371,15 +399,19 @@ - support. - -
  • Ports to more systems, including DOS and Windows.
  • --
We need people to help with these projects. If you are -- interested in working on them, please join the ncurses list. -+ -+ -+

We need people to help with these projects. If you are -+ interested in working on them, please join the ncurses list.

-+ -+

Other Related Resources

- --

Other Related Resources

The distribution provides a newer -- version of the terminfo-format terminal description file once -- maintained by Eric -+

The distribution provides a newer version of the -+ terminfo-format terminal description file once maintained by -+ Eric - Raymond . Unlike the older version, the termcap and - terminfo data are provided in the same file, and provides several -- user-definable extensions beyond the X/Open specification. -+ user-definable extensions beyond the X/Open specification.

- -

You can find lots of information on terminal-related topics - not covered in the terminfo file at (COLOR_PAIR(1)) : A_BOLD; - } - - // Attributes to use for menu and forms backgrounds - virtual chtype backgrounds() const { -- return b_Colors ? COLOR_PAIR(2) : A_NORMAL; -+ return b_Colors ? static_cast(COLOR_PAIR(2)) : A_NORMAL; - } - - // Attributes to use for inactive (menu) elements - virtual chtype inactives() const { -- return b_Colors ? (COLOR_PAIR(3)|A_DIM) : A_DIM; -+ return b_Colors ? static_cast(COLOR_PAIR(3)|A_DIM) : A_DIM; - } - - // Attributes to use for (form) labels and SLKs - virtual chtype labels() const { -- return b_Colors ? COLOR_PAIR(4) : A_NORMAL; -+ return b_Colors ? static_cast(COLOR_PAIR(4)) : A_NORMAL; - } - - // Attributes to use for form backgrounds - virtual chtype dialog_backgrounds() const { -- return b_Colors ? COLOR_PAIR(4) : A_NORMAL; -+ return b_Colors ? static_cast(COLOR_PAIR(4)) : A_NORMAL; - } - - // Attributes to use as default for (form) window backgrounds - virtual chtype window_backgrounds() const { -- return b_Colors ? COLOR_PAIR(5) : A_NORMAL; -+ return b_Colors ? static_cast(COLOR_PAIR(5)) : A_NORMAL; - } - - // Attributes to use for the title window - virtual chtype screen_titles() const { -- return b_Colors ? COLOR_PAIR(6) : A_BOLD; -+ return b_Colors ? static_cast(COLOR_PAIR(6)) : A_BOLD; - } - - }; -diff -Naur ncurses-5.9/c++/cursesf.cc ncurses-5.9.patch/c++/cursesf.cc ---- ncurses-5.9/c++/cursesf.cc 2005-08-13 20:09:06.000000000 +0200 -+++ ncurses-5.9.patch/c++/cursesf.cc 2014-09-01 16:33:22.238791926 +0200 -@@ -1,6 +1,6 @@ - // * this is for making emacs happy: -*-Mode: C++;-*- - /**************************************************************************** -- * Copyright (c) 1998-2003,2005 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2005,2011 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -35,7 +35,7 @@ - #include "cursesf.h" - #include "cursesapp.h" - --MODULE_ID("$Id: cursesf.cc,v 1.21 2005/08/13 18:09:06 tom Exp $") -+MODULE_ID("$Id: cursesf.cc,v 1.22 2011/09/17 22:12:10 tom Exp $") - - NCursesFormField::~NCursesFormField () - { -@@ -234,11 +234,13 @@ - void - NCursesForm::On_Field_Init(NCursesFormField& field) - { -+ (void) field; - } - - void - NCursesForm::On_Field_Termination(NCursesFormField& field) - { -+ (void) field; - } - - // call the form driver and do basic error checking. -@@ -260,16 +262,19 @@ - - void NCursesForm::On_Request_Denied(int c) const - { -+ (void) c; - ::beep(); - } - - void NCursesForm::On_Invalid_Field(int c) const - { -+ (void) c; - ::beep(); - } - - void NCursesForm::On_Unknown_Command(int c) const - { -+ (void) c; - ::beep(); - } - -@@ -373,6 +378,7 @@ - // - bool _nc_xx_fld_fcheck(FIELD *f, const void *u) - { -+ (void) f; - NCursesFormField* F = reinterpret_cast(const_cast(u)); - assert(F != 0); - UserDefinedFieldType* udf = reinterpret_cast(F->fieldtype()); -@@ -405,6 +411,7 @@ - - bool _nc_xx_next_choice(FIELD *f, const void *u) - { -+ (void) f; - NCursesFormField* F = reinterpret_cast(const_cast(u)); - assert(F != 0); - UserDefinedFieldType_With_Choice* udf = -@@ -415,6 +422,7 @@ - - bool _nc_xx_prev_choice(FIELD *f, const void *u) - { -+ (void) f; - NCursesFormField* F = reinterpret_cast(const_cast(u)); - assert(F != 0); - UserDefinedFieldType_With_Choice* udf = -diff -Naur ncurses-5.9/c++/cursesf.h ncurses-5.9.patch/c++/cursesf.h ---- ncurses-5.9/c++/cursesf.h 2005-08-13 20:08:24.000000000 +0200 -+++ ncurses-5.9.patch/c++/cursesf.h 2014-09-01 16:33:22.239791928 +0200 -@@ -1,6 +1,6 @@ - // * This makes emacs happy -*-Mode: C++;-*- - /**************************************************************************** -- * Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -31,7 +31,7 @@ - * Author: Juergen Pfeifer, 1997 * - ****************************************************************************/ - --// $Id: cursesf.h,v 1.28 2005/08/13 18:08:24 tom Exp $ -+// $Id: cursesf.h,v 1.31 2012/12/29 21:49:58 tom Exp $ - - #ifndef NCURSES_CURSESF_H_incl - #define NCURSES_CURSESF_H_incl 1 -@@ -61,7 +61,7 @@ - protected: - FIELDTYPE* fieldtype; - -- inline void OnError(int err) const THROWS(NCursesFormException) { -+ inline void OnError(int err) const THROW2(NCursesException const, NCursesFormException) { - if (err!=E_OK) - THROW(new NCursesFormException (err)); - } -@@ -109,7 +109,7 @@ - NCursesFieldType* ftype; // Associated field type - - // Error handler -- inline void OnError (int err) const THROWS(NCursesFormException) { -+ inline void OnError (int err) const THROW2(NCursesException const, NCursesFormException) { - if (err != E_OK) - THROW(new NCursesFormException (err)); - } -@@ -391,7 +391,7 @@ - bool with_frame, - bool autoDeleteFields); - -- inline void OnError (int err) const THROWS(NCursesFormException) { -+ inline void OnError (int err) const THROW2(NCursesException const, NCursesFormException) { - if (err != E_OK) - THROW(new NCursesFormException (err)); - } -@@ -677,7 +677,7 @@ - } - - public: -- NCursesUserForm (NCursesFormField Fields[], -+ NCursesUserForm (NCursesFormField* Fields[], - const T* p_UserData = STATIC_CAST(T*)(0), - bool with_frame=FALSE, - bool autoDelete_Fields=FALSE) -@@ -686,7 +686,7 @@ - set_user (const_cast(p_UserData)); - }; - -- NCursesUserForm (NCursesFormField Fields[], -+ NCursesUserForm (NCursesFormField* Fields[], - int nlines, - int ncols, - int begin_y = 0, -diff -Naur ncurses-5.9/c++/cursesmain.cc ncurses-5.9.patch/c++/cursesmain.cc ---- ncurses-5.9/c++/cursesmain.cc 2007-04-07 19:10:11.000000000 +0200 -+++ ncurses-5.9.patch/c++/cursesmain.cc 2014-09-01 16:33:22.239791928 +0200 -@@ -1,6 +1,6 @@ - // * this is for making emacs happy: -*-Mode: C++;-*- - /**************************************************************************** -- * Copyright (c) 1998-2003,2007 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2007,2013 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -35,13 +35,15 @@ - #include "cursesapp.h" - - #if CPP_HAS_TRY_CATCH && HAVE_IOSTREAM -+#pragma GCC diagnostic ignored "-Weffc++" - #include -+#pragma GCC diagnostic warning "-Weffc++" - #else - #undef CPP_HAS_TRY_CATCH - #define CPP_HAS_TRY_CATCH 0 - #endif - --MODULE_ID("$Id: cursesmain.cc,v 1.14 2007/04/07 17:10:11 tom Exp $") -+MODULE_ID("$Id: cursesmain.cc,v 1.15 2013/09/28 20:56:47 tom Exp $") - - #if HAVE_LOCALE_H - #include -diff -Naur ncurses-5.9/c++/cursesm.cc ncurses-5.9.patch/c++/cursesm.cc ---- ncurses-5.9/c++/cursesm.cc 2005-04-02 22:39:05.000000000 +0200 -+++ ncurses-5.9.patch/c++/cursesm.cc 2014-09-01 16:33:22.239791928 +0200 -@@ -1,6 +1,6 @@ - // * this is for making emacs happy: -*-Mode: C++;-*- - /**************************************************************************** -- * Copyright (c) 1998-2003,2005 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2005,2011 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -35,7 +35,7 @@ - #include "cursesm.h" - #include "cursesapp.h" - --MODULE_ID("$Id: cursesm.cc,v 1.22 2005/04/02 20:39:05 tom Exp $") -+MODULE_ID("$Id: cursesm.cc,v 1.23 2011/09/17 22:11:32 tom Exp $") - - NCursesMenuItem::~NCursesMenuItem() - { -@@ -375,33 +375,39 @@ - void - NCursesMenu::On_Item_Init(NCursesMenuItem& item) - { -+ (void) item; - } - - void - NCursesMenu::On_Item_Termination(NCursesMenuItem& item) - { -+ (void) item; - } - - void - NCursesMenu::On_Request_Denied(int c) const - { -+ (void) c; - ::beep(); - } - - void - NCursesMenu::On_Not_Selectable(int c) const - { -+ (void) c; - ::beep(); - } - - void - NCursesMenu::On_No_Match(int c) const - { -+ (void) c; - ::beep(); - } - - void - NCursesMenu::On_Unknown_Command(int c) const - { -+ (void) c; - ::beep(); - } -diff -Naur ncurses-5.9/c++/cursesm.h ncurses-5.9.patch/c++/cursesm.h ---- ncurses-5.9/c++/cursesm.h 2005-08-13 20:10:36.000000000 +0200 -+++ ncurses-5.9.patch/c++/cursesm.h 2014-09-01 16:33:22.239791928 +0200 -@@ -1,6 +1,6 @@ - // * This makes emacs happy -*-Mode: C++;-*- - /**************************************************************************** -- * Copyright (c) 1998-2003,2005 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -31,7 +31,7 @@ - * Author: Juergen Pfeifer, 1997 * - ****************************************************************************/ - --// $Id: cursesm.h,v 1.25 2005/08/13 18:10:36 tom Exp $ -+// $Id: cursesm.h,v 1.29 2012/12/29 21:48:33 tom Exp $ - - #ifndef NCURSES_CURSESM_H_incl - #define NCURSES_CURSESM_H_incl 1 -@@ -53,7 +53,7 @@ - protected: - ITEM *item; - -- inline void OnError (int err) const THROWS(NCursesMenuException) { -+ inline void OnError (int err) const THROW2(NCursesException const, NCursesMenuException) { - if (err != E_OK) - THROW(new NCursesMenuException (err)); - } -@@ -82,6 +82,7 @@ - NCursesMenuItem(const NCursesMenuItem& rhs) - : item(0) - { -+ (void) rhs; - } - - virtual ~NCursesMenuItem (); -@@ -252,7 +253,7 @@ - bool with_frame, - bool autoDeleteItems); - -- inline void OnError (int err) const THROWS(NCursesMenuException) { -+ inline void OnError (int err) const THROW2(NCursesException const, NCursesMenuException) { - if (err != E_OK) - THROW(new NCursesMenuException (this, err)); - } -@@ -635,7 +636,7 @@ - } - - public: -- NCursesUserMenu (NCursesMenuItem Items[], -+ NCursesUserMenu (NCursesMenuItem* Items[], - const T* p_UserData = STATIC_CAST(T*)(0), - bool with_frame=FALSE, - bool autoDelete_Items=FALSE) -@@ -644,7 +645,7 @@ - set_user (const_cast(p_UserData)); - }; - -- NCursesUserMenu (NCursesMenuItem Items[], -+ NCursesUserMenu (NCursesMenuItem* Items[], - int nlines, - int ncols, - int begin_y = 0, -diff -Naur ncurses-5.9/c++/cursespad.cc ncurses-5.9.patch/c++/cursespad.cc ---- ncurses-5.9/c++/cursespad.cc 2008-08-04 20:59:22.000000000 +0200 -+++ ncurses-5.9.patch/c++/cursespad.cc 2014-09-01 16:33:22.240791930 +0200 -@@ -1,6 +1,6 @@ - // * this is for making emacs happy: -*-Mode: C++;-*- - /**************************************************************************** -- * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -33,10 +33,9 @@ - - #include "internal.h" - --#include - #include - --MODULE_ID("$Id: cursespad.cc,v 1.13 2008/08/04 18:59:22 tom Exp $") -+MODULE_ID("$Id: cursespad.cc,v 1.17 2013/03/30 19:45:36 tom Exp $") - - NCursesPad::NCursesPad(int nlines, int ncols) - : NCursesWindow(), -@@ -220,6 +219,7 @@ - - void NCursesFramedPad::OnOperation(int pad_req) - { -+ (void) pad_req; - NCursesWindow* W = Win(); - NCursesWindow* W2 = getWindow(); - -@@ -228,25 +228,45 @@ - int Height = W->height(); - int i, row, col, h_len, v_len; - -- h_len = (Width*Width + width() - 1)/width(); -- if (h_len==0) -+ int my_width = width(); -+ -+ if (my_width != 0) { -+ h_len = (Width*Width + my_width - 1) / my_width; -+ if (h_len==0) -+ h_len = 1; -+ if (h_len > Width) -+ h_len = Width; -+ } else { - h_len = 1; -- if (h_len > Width) -- h_len = Width; -+ } - -- v_len = (Height*Height + height() - 1)/height(); -- if (v_len==0) -+ int my_height = height(); -+ -+ if (my_height != 0) { -+ v_len = (Height*Height + my_height - 1) / my_height; -+ if (v_len==0) -+ v_len = 1; -+ if (v_len > Height) -+ v_len = Height; -+ } else { - v_len = 1; -- if (v_len > Height) -- v_len = Height; -+ } - -- col = (min_col * Width + width() - 1) / width(); -- if (col + h_len > Width) -- col = Width - h_len; -- -- row = (min_row * Height + height() - 1) / height(); -- if (row + v_len > Height) -- row = Height - v_len; -+ if (my_width != 0) { -+ col = (min_col * Width + my_width - 1) / my_width; -+ if (col + h_len > Width) -+ col = Width - h_len; -+ } else { -+ col = 0; -+ } -+ -+ if (my_height != 0) { -+ row = (min_row * Height + my_height - 1) / my_height; -+ if (row + v_len > Height) -+ row = Height - v_len; -+ } else { -+ row = 0; -+ } - - W2->vline(1,Width+1,Height); - W2->attron(A_REVERSE); -diff -Naur ncurses-5.9/c++/cursesp.h ncurses-5.9.patch/c++/cursesp.h ---- ncurses-5.9/c++/cursesp.h 2008-08-16 19:20:23.000000000 +0200 -+++ ncurses-5.9.patch/c++/cursesp.h 2014-09-01 16:33:22.240791930 +0200 -@@ -1,6 +1,6 @@ - // * This makes emacs happy -*-Mode: C++;-*- - /**************************************************************************** -- * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2008,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -34,7 +34,7 @@ - #ifndef NCURSES_CURSESP_H_incl - #define NCURSES_CURSESP_H_incl 1 - --// $Id: cursesp.h,v 1.29 2008/08/16 17:20:23 tom Exp $ -+// $Id: cursesp.h,v 1.30 2012/12/29 21:50:55 tom Exp $ - - #include - -@@ -86,7 +86,7 @@ - return result; - } - -- void OnError (int err) const THROWS(NCursesPanelException) -+ void OnError (int err) const THROW2(NCursesException const, NCursesPanelException) - { - if (err==ERR) - THROW(new NCursesPanelException (this, err)); -diff -Naur ncurses-5.9/c++/cursesw.cc ncurses-5.9.patch/c++/cursesw.cc ---- ncurses-5.9/c++/cursesw.cc 2009-03-28 22:31:37.000000000 +0100 -+++ ncurses-5.9.patch/c++/cursesw.cc 2014-09-01 16:33:22.240791930 +0200 -@@ -1,6 +1,6 @@ - // * this is for making emacs happy: -*-Mode: C++;-*- - /**************************************************************************** -- * Copyright (c) 2007-2008,2009 Free Software Foundation, Inc. * -+ * Copyright (c) 2007-2012,2014 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -42,7 +42,7 @@ - #include "internal.h" - #include "cursesw.h" - --MODULE_ID("$Id: cursesw.cc,v 1.51 2009/03/28 21:31:37 tom Exp $") -+MODULE_ID("$Id: cursesw.cc,v 1.54 2014/02/01 22:10:42 tom Exp $") - - #define COLORS_NEED_INITIALIZATION -1 - #define COLORS_NOT_INITIALIZED 0 -@@ -192,7 +192,6 @@ - constructing(); - - w = static_cast(0); -- set_keyboard(); - } - - NCursesWindow::NCursesWindow(int nlines, int ncols, int begin_y, int begin_x) -@@ -285,12 +284,14 @@ - NCursesWindow::NCursesWindow(WINDOW *win, int ncols) - : w(0), alloced(FALSE), par(0), subwins(0), sib(0) - { -+ (void) ncols; - initialize(); - w = win; - } - - int _nc_xx_ripoff_init(WINDOW *w, int ncols) - { -+ (void) ncols; - int res = ERR; - - RIPOFFINIT init = *prip++; -@@ -400,16 +401,16 @@ - } - } - --short -+NCURSES_PAIRS_T - NCursesWindow::getPair() const - { -- return static_cast(PAIR_NUMBER(getattrs(w))); -+ return static_cast(PAIR_NUMBER(getattrs(w))); - } - --short -+NCURSES_COLOR_T - NCursesWindow::getcolor(int getback) const - { -- short fore, back; -+ NCURSES_COLOR_T fore, back; - - if (HaveColors()) { - if (::pair_content(getPair(), &fore, &back) == ERR) -@@ -427,27 +428,27 @@ - return (HaveColors()) ? COLORS : 1; - } - --short -+NCURSES_PAIRS_T - NCursesWindow::getcolor() const - { - return (HaveColors()) ? getPair() : 0; - } - - int --NCursesWindow::setpalette(short fore, short back, short pair) -+NCursesWindow::setpalette(NCURSES_COLOR_T fore, NCURSES_COLOR_T back, NCURSES_PAIRS_T pair) - { - return (HaveColors()) ? ::init_pair(pair, fore, back) : OK; - } - - int --NCursesWindow::setpalette(short fore, short back) -+NCursesWindow::setpalette(NCURSES_COLOR_T fore, NCURSES_COLOR_T back) - { - return setpalette(fore, back, getPair()); - } - - - int --NCursesWindow::setcolor(short pair) -+NCursesWindow::setcolor(NCURSES_PAIRS_T pair) - { - if (HaveColors()) { - if ((pair < 1) || (pair > COLOR_PAIRS)) -diff -Naur ncurses-5.9/c++/cursesw.h ncurses-5.9.patch/c++/cursesw.h ---- ncurses-5.9/c++/cursesw.h 2008-01-19 22:09:10.000000000 +0100 -+++ ncurses-5.9.patch/c++/cursesw.h 2014-09-01 16:33:22.241791932 +0200 -@@ -1,7 +1,7 @@ - // * This makes emacs happy -*-Mode: C++;-*- - // vile:cppmode - /**************************************************************************** -- * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2011,2014 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -31,7 +31,7 @@ - #ifndef NCURSES_CURSESW_H_incl - #define NCURSES_CURSESW_H_incl 1 - --// $Id: cursesw.h,v 1.48 2008/01/19 21:09:10 tom Exp $ -+// $Id: cursesw.h,v 1.50 2014/02/01 22:17:37 tom Exp $ - - #include - -@@ -118,7 +118,7 @@ - #endif - - #ifdef chgat --inline int UNDEF(chgat)(int n, attr_t attr, short color, const void *opts) { -+inline int UNDEF(chgat)(int n, attr_t attr, NCURSES_PAIRS_T color, const void *opts) { - return chgat(n, attr, color, opts); } - #undef chgat - #define chgat UNDEF(chgat) -@@ -151,7 +151,7 @@ - #endif - - #ifdef color_set --inline chtype UNDEF(color_set)(short p, void* opts) { return color_set(p, opts); } -+inline chtype UNDEF(color_set)(NCURSES_PAIRS_T p, void* opts) { return color_set(p, opts); } - #undef color_set - #define color_set UNDEF(color_set) - #endif -@@ -361,7 +361,7 @@ - - #ifdef mvchgat - inline int UNDEF(mvchgat)(int y, int x, int n, -- attr_t attr, short color, const void *opts) { -+ attr_t attr, NCURSES_PAIRS_T color, const void *opts) { - return mvchgat(y, x, n, attr, color, opts); } - #undef mvchgat - #define mvchgat UNDEF(mvchgat) -@@ -463,7 +463,7 @@ - - #ifdef mvwchgat - inline int UNDEF(mvwchgat)(WINDOW *win, int y, int x, int n, -- attr_t attr, short color, const void *opts) { -+ attr_t attr, NCURSES_PAIRS_T color, const void *opts) { - return mvwchgat(win, y, x, n, attr, color, opts); } - #undef mvwchgat - #define mvwchgat UNDEF(mvwchgat) -@@ -763,10 +763,10 @@ - - void set_keyboard(); - -- short getcolor(int getback) const; -- short getPair() const; -+ NCURSES_COLOR_T getcolor(int getback) const; -+ NCURSES_PAIRS_T getPair() const; - -- static int setpalette(short fore, short back, short pair); -+ static int setpalette(NCURSES_COLOR_T fore, NCURSES_COLOR_T back, NCURSES_PAIRS_T pair); - static int colorInitialized; - - // This private constructor is only used during the initialization -@@ -896,19 +896,19 @@ - int maxy() const { return getmaxy(w) == ERR ? ERR : getmaxy(w)-1; } - // Largest y coord in window - -- short getcolor() const; -+ NCURSES_PAIRS_T getcolor() const; - // Actual color pair - -- short foreground() const { return getcolor(0); } -+ NCURSES_COLOR_T foreground() const { return getcolor(0); } - // Actual foreground color - -- short background() const { return getcolor(1); } -+ NCURSES_COLOR_T background() const { return getcolor(1); } - // Actual background color - -- int setpalette(short fore, short back); -+ int setpalette(NCURSES_COLOR_T fore, NCURSES_COLOR_T back); - // Set color palette entry - -- int setcolor(short pair); -+ int setcolor(NCURSES_PAIRS_T pair); - // Set actually used palette entry - - // ------------------------------------------------------------------------- -@@ -1107,18 +1107,18 @@ - chtype attrget() { return ::getattrs(w); } - // Get the window attributes; - -- int color_set(short color_pair_number, void* opts=NULL) { -+ int color_set(NCURSES_PAIRS_T color_pair_number, void* opts=NULL) { - return ::wcolor_set(w, color_pair_number, opts); } - // Set the window color attribute; - -- int chgat(int n, attr_t attr, short color, const void *opts=NULL) { -+ int chgat(int n, attr_t attr, NCURSES_PAIRS_T color, const void *opts=NULL) { - return ::wchgat(w, n, attr, color, opts); } - // Change the attributes of the next n characters in the current line. If - // n is negative or greater than the number of remaining characters in the - // line, the attributes will be changed up to the end of the line. - - int chgat(int y, int x, -- int n, attr_t attr, short color, const void *opts=NULL) { -+ int n, attr_t attr, NCURSES_PAIRS_T color, const void *opts=NULL) { - return ::mvwchgat(w, y, x, n, attr, color, opts); } - // Move the cursor to the requested position and then perform chgat() as - // described above. -@@ -1438,16 +1438,19 @@ - // The driver translates the keystroke c into an Pad_Request - - virtual void OnUnknownOperation(int pad_req) { -+ (void) pad_req; - ::beep(); - } - // This is called if the driver returns an unknown op-code - - virtual void OnNavigationError(int pad_req) { -+ (void) pad_req; - ::beep(); - } - // This is called if a navigation request couldn't be satisfied - - virtual void OnOperation(int pad_req) { -+ (void) pad_req; - }; - // OnOperation is called if a Pad_Operation was executed and just before - // the refresh() operation is done. -@@ -1542,11 +1545,15 @@ - } - - void setWindow(NCursesWindow& view, int v_grid = 1, int h_grid = 1) { -+ (void) view; -+ (void) v_grid; -+ (void) h_grid; - err_handler("Operation not allowed"); - } - // Disable this call; the viewport is already defined - - void setSubWindow(NCursesWindow& sub) { -+ (void) sub; - err_handler("Operation not allowed"); - } - // Disable this call; the viewport subwindow is already defined -diff -Naur ncurses-5.9/c++/cursslk.cc ncurses-5.9.patch/c++/cursslk.cc ---- ncurses-5.9/c++/cursslk.cc 2005-08-07 00:12:36.000000000 +0200 -+++ ncurses-5.9.patch/c++/cursslk.cc 2014-09-01 16:33:22.241791932 +0200 -@@ -1,6 +1,6 @@ - // * this is for making emacs happy: -*-Mode: C++;-*- - /**************************************************************************** -- * Copyright (c) 1998-2003,2005 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2005,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -35,14 +35,15 @@ - #include "cursslk.h" - #include "cursesapp.h" - --MODULE_ID("$Id: cursslk.cc,v 1.15 2005/08/06 22:12:36 tom Exp $") -+MODULE_ID("$Id: cursslk.cc,v 1.16 2012/02/23 10:41:56 tom Exp $") - - Soft_Label_Key_Set::Soft_Label_Key& - Soft_Label_Key_Set::Soft_Label_Key::operator=(char *text) - { - delete[] label; -- label = new char[1 + ::strlen(text)]; -- (::strcpy)(label,text); -+ size_t need = 1 + ::strlen(text); -+ label = new char[need]; -+ ::_nc_STRCPY(label,text,need); - return *this; - } - -diff -Naur ncurses-5.9/c++/demo.cc ncurses-5.9.patch/c++/demo.cc ---- ncurses-5.9/c++/demo.cc 2008-12-07 03:07:34.000000000 +0100 -+++ ncurses-5.9.patch/c++/demo.cc 2014-09-01 16:33:22.241791932 +0200 -@@ -1,6 +1,6 @@ - // * This makes emacs happy -*-Mode: C++;-*- - /**************************************************************************** -- * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -35,7 +35,7 @@ - * Demo code for NCursesMenu and NCursesForm written by - * Juergen Pfeifer - * -- * $Id: demo.cc,v 1.39 2008/12/07 02:07:34 juergen Exp $ -+ * $Id: demo.cc,v 1.41 2012/02/23 10:41:56 tom Exp $ - */ - - #include "internal.h" -@@ -220,6 +220,7 @@ - int chk; - protected: - bool field_check(NCursesFormField& f) { -+ (void) f; - return TRUE; - } - bool char_check(int c) { -@@ -319,7 +320,7 @@ - for(int i=1; i <= S->labels(); i++) { - char buf[8]; - assert(i < 100); -- ::sprintf(buf, "Frm%02d", i); -+ ::_nc_SPRINTF(buf, _nc_SLIMIT(sizeof(buf)) "Frm%02d", i); - (*S)[i] = buf; // Text - (*S)[i] = Soft_Label_Key_Set::Soft_Label_Key::Left; // Justification - } -@@ -539,7 +540,7 @@ - for(int i=1; i <= S.labels(); i++) { - char buf[8]; - assert(i < 100); -- ::sprintf(buf, "Key%02d", i); -+ ::_nc_SPRINTF(buf, _nc_SLIMIT(sizeof(buf)) "Key%02d", i); - S[i] = buf; // Text - S[i] = Soft_Label_Key_Set::Soft_Label_Key::Left; // Justification - } -diff -Naur ncurses-5.9/c++/etip.h.in ncurses-5.9.patch/c++/etip.h.in ---- ncurses-5.9/c++/etip.h.in 2008-08-30 21:27:32.000000000 +0200 -+++ ncurses-5.9.patch/c++/etip.h.in 2014-09-01 16:33:22.242791933 +0200 -@@ -1,6 +1,6 @@ - // * This makes emacs happy -*-Mode: C++;-*- - /**************************************************************************** -- * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -31,7 +31,7 @@ - * Author: Juergen Pfeifer, 1997 * - ****************************************************************************/ - --// $Id: etip.h.in,v 1.37 2008/08/30 19:27:32 tom Exp $ -+// $Id: etip.h.in,v 1.39 2012/12/29 21:50:44 tom Exp $ - - #ifndef NCURSES_ETIP_H_incl - #define NCURSES_ETIP_H_incl 1 -@@ -184,7 +184,7 @@ - - NCursesPanelException (const char *msg, int err) : - NCursesException (msg, err), -- p (NULL) -+ p (0) - {}; - - NCursesPanelException (const NCursesPanel* panel, -@@ -196,7 +196,7 @@ - - NCursesPanelException (int err) : - NCursesException ("panel library error", err), -- p (NULL) -+ p (0) - {}; - - NCursesPanelException (const NCursesPanel* panel, -@@ -235,7 +235,7 @@ - - NCursesMenuException (const char *msg, int err) : - NCursesException (msg, err), -- m (NULL) -+ m (0) - {}; - - NCursesMenuException (const NCursesMenu* menu, -@@ -247,7 +247,7 @@ - - NCursesMenuException (int err) : - NCursesException ("menu library error", err), -- m (NULL) -+ m (0) - {}; - - NCursesMenuException (const NCursesMenu* menu, -@@ -286,7 +286,7 @@ - - NCursesFormException (const char *msg, int err) : - NCursesException (msg, err), -- f (NULL) -+ f (0) - {}; - - NCursesFormException (const NCursesForm* form, -@@ -298,7 +298,7 @@ - - NCursesFormException (int err) : - NCursesException ("form library error", err), -- f (NULL) -+ f (0) - {}; - - NCursesFormException (const NCursesForm* form, -@@ -367,11 +367,13 @@ - #define NCURSES_CPP_TRY /* nothing */ - #define NCURSES_CPP_CATCH(e) if (false) - #define THROWS(s) /* nothing */ -+#define THROW2(s,t) /* nothing */ - #elif CPP_HAS_TRY_CATCH - throw *e; - #define NCURSES_CPP_TRY try - #define NCURSES_CPP_CATCH(e) catch(e) - #define THROWS(s) throw(s) -+#define THROW2(s,t) throw(s,t) - #endif - } - -diff -Naur ncurses-5.9/c++/internal.h ncurses-5.9.patch/c++/internal.h ---- ncurses-5.9/c++/internal.h 2008-12-07 03:07:34.000000000 +0100 -+++ ncurses-5.9.patch/c++/internal.h 2014-09-01 16:33:22.242791933 +0200 -@@ -1,6 +1,6 @@ - // * This makes emacs happy -*-Mode: C++;-*- - /**************************************************************************** -- * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2008,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -31,7 +31,7 @@ - * Author: Juergen Pfeifer, 1997 * - ****************************************************************************/ - --// $Id: internal.h,v 1.17 2008/12/07 02:07:34 juergen Exp $ -+// $Id: internal.h,v 1.18 2012/02/23 10:41:56 tom Exp $ - - #ifndef NCURSES_CPLUS_INTERNAL_H - #define NCURSES_CPLUS_INTERNAL_H 1 -@@ -62,4 +62,6 @@ - #define NULL 0 - #endif - -+#include -+ - #endif /* NCURSES_CPLUS_INTERNAL_H */ -diff -Naur ncurses-5.9/c++/Makefile.in ncurses-5.9.patch/c++/Makefile.in ---- ncurses-5.9/c++/Makefile.in 2010-11-27 22:45:27.000000000 +0100 -+++ ncurses-5.9.patch/c++/Makefile.in 2014-09-01 16:33:22.237791925 +0200 -@@ -1,6 +1,6 @@ --# $Id: Makefile.in,v 1.93 2010/11/27 21:45:27 tom Exp $ -+# $Id: Makefile.in,v 1.106 2013/08/04 20:20:45 tom Exp $ - ############################################################################## --# Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. # -+# Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. # - # # - # Permission is hereby granted, free of charge, to any person obtaining a # - # copy of this software and associated documentation files (the "Software"), # -@@ -47,8 +47,12 @@ - srcdir = @srcdir@ - prefix = @prefix@ - exec_prefix = @exec_prefix@ -+bindir = @bindir@ - libdir = @libdir@ - includedir = @includedir@ -+includesubdir = @includesubdir@ -+ -+INCLUDEDIR = $(DESTDIR)$(includedir)$(includesubdir) - - LIBTOOL = @LIBTOOL_CXX@ - LIBTOOL_CLEAN = @LIB_CLEAN@ -@@ -65,6 +69,9 @@ - - AR = @AR@ - ARFLAGS = @ARFLAGS@ -+AWK = @AWK@ -+LD = @LD@ -+LN_S = @LN_S@ - - CXX_AR = @CXX_AR@ - CXX_ARFLAGS = @CXX_ARFLAGS@ -@@ -109,35 +116,41 @@ - LIBNAME_NORMAL = @LIB_PREFIX@$(LIBROOT)@LIB_SUFFIX@.a - LIBNAME = @LIB_PREFIX@$(LIBROOT)@CXX_LIB_SUFFIX@ - --MY_LIBRARY = ../lib/$(LIBNAME) -+LIBRARIES = @Libs_To_Make@ - - LINK_FLAGS = @EXTRA_LDFLAGS@ -L../lib -l$(LIBROOT)@LIB_SUFFIX@ -+RPATH_LIST = @RPATH_LIST@ -+MK_SHARED_LIB = @MK_SHARED_LIB@ - --LINK_LIBTOOL = @EXTRA_LDFLAGS@ -L../lib $(MY_LIBRARY) -+LINK_LIBTOOL = @EXTRA_LDFLAGS@ -L../lib $(LIBRARIES) - LINK_NORMAL = $(LINK_FLAGS) - LINK_DEBUG = $(LINK_FLAGS) - LINK_PROFILE = $(LINK_FLAGS) - LINK_SHARED = $(LINK_FLAGS) - -+# flags for test-programs - TEST_LIBS = @TEST_LIBS@ - TEST_ARGS = @LDFLAGS_STATIC@ @TEST_ARGS@ @LDFLAGS_SHARED@ -- --LDFLAGS = $(TEST_ARGS) @LDFLAGS@ \ -+TEST_LDFLAGS = $(TEST_ARGS) @LDFLAGS@ \ - @LD_MODEL@ $(TEST_LIBS) @LIBS@ @LOCAL_LDFLAGS@ $(CXXLIBS) - --LDFLAGS_LIBTOOL = $(LDFLAGS) $(CFLAGS_LIBTOOL) --LDFLAGS_NORMAL = $(LDFLAGS) $(CFLAGS_NORMAL) --LDFLAGS_DEBUG = $(LDFLAGS) $(CFLAGS_DEBUG) --LDFLAGS_PROFILE = $(LDFLAGS) $(CFLAGS_PROFILE) --LDFLAGS_SHARED = $(LDFLAGS) $(CFLAGS_SHARED) @LD_SHARED_OPTS@ -+LDFLAGS_LIBTOOL = $(TEST_LDFLAGS) $(CFLAGS_LIBTOOL) -+LDFLAGS_NORMAL = $(TEST_LDFLAGS) $(CFLAGS_NORMAL) -+LDFLAGS_DEBUG = $(TEST_LDFLAGS) $(CFLAGS_DEBUG) -+LDFLAGS_PROFILE = $(TEST_LDFLAGS) $(CFLAGS_PROFILE) -+LDFLAGS_SHARED = $(TEST_LDFLAGS) $(CFLAGS_SHARED) @LD_SHARED_OPTS@ - - LDFLAGS_DEFAULT = $(LINK_@DFT_UPR_MODEL@) $(LDFLAGS_@DFT_UPR_MODEL@) - -+# flags for library built by this makefile -+LDFLAGS = $(TEST_ARGS) @LDFLAGS@ \ -+ @LD_MODEL@ $(TEST_LIBS) @LIBS@ $(CXXLIBS) -+ - AUTO_SRC = \ - etip.h - - all \ --libs :: $(AUTO_SRC) $(MY_LIBRARY) -+libs :: $(AUTO_SRC) $(LIBRARIES) - - @MAKE_TESTS@all :: demo$x - -@@ -148,61 +161,16 @@ - tags: - $(CTAGS) *.[h] *.cc - --# Build a conventional library for installing, since a shared library would --# pull in all of the ncurses libraries (panel, menu, form, ncurses) as direct --# dependencies. --LIB_OBJS = \ -- $(MODEL)/cursesf$o \ -- $(MODEL)/cursesm$o \ -- $(MODEL)/cursesw$o \ -- $(MODEL)/cursespad$o \ -- $(MODEL)/cursesp$o \ -- $(MODEL)/cursslk$o \ -- $(MODEL)/cursesapp$o \ -- $(MODEL)/cursesmain$o -- --../lib/$(LIBNAME_NORMAL) : $(LIB_OBJS) -- $(CXX_AR) $(CXX_ARFLAGS) $@ $? -- $(RANLIB) $@ -- --../lib/$(LIBNAME_LIBTOOL) : $(LIB_OBJS) -- cd ../lib && $(LIBTOOL_LINK) $(CXX) $(CXXFLAGS) \ -- -o $(LIBNAME) $(LIB_OBJS:$o=.lo) \ -- -rpath $(INSTALL_PREFIX)$(libdir) \ -- $(LIBTOOL_VERSION) $(NCURSES_MAJOR):$(NCURSES_MINOR) $(LT_UNDEF) $(SHLIB_LIST) -- --OBJS_DEMO = $(MODEL)/demo$o -- --$(MODEL)/demo$o : $(srcdir)/demo.cc \ -- $(cursesf_h) $(cursesm_h) $(cursesapp_h) -- --demo$x: $(OBJS_DEMO) \ -- $(MY_LIBRARY) \ -- @TEST_DEPS@ -- @ECHO_LINK@ $(LINK) -o $@ $(OBJS_DEMO) $(LDFLAGS_DEFAULT) -- --etip.h: $(srcdir)/etip.h.in $(srcdir)/edit_cfg.sh -- cp $(srcdir)/etip.h.in $@ -- sh $(srcdir)/edit_cfg.sh ../include/ncurses_cfg.h $@ -- - $(DESTDIR)$(libdir) : - mkdir -p $@ - --install \ --install.libs:: $(MY_LIBRARY) $(DESTDIR)$(libdir) -- $(LIBTOOL_INSTALL) $(INSTALL_LIB) $(MY_LIBRARY) $(DESTDIR)$(libdir)/$(LIBNAME) -- --uninstall \ --uninstall.libs:: -- -$(LIBTOOL_UNINSTALL) rm -f $(DESTDIR)$(libdir)/$(LIBNAME) -- - mostlyclean :: - -rm -f core tags TAGS *~ *.bak *.i *.ii *.ln *.atac trace - - clean :: mostlyclean - -sh -c "if test -n '$x' ; then $(MAKE) clean x=''; fi" - -rm -rf $(MODEL)/SunWS_cache -- -$(LIBTOOL_CLEAN) rm -f demo$x $(AUTO_SRC) $(MY_LIBRARY) $(LIB_OBJS) $(OBJS_DEMO) -+ -$(LIBTOOL_CLEAN) rm -f demo$x $(AUTO_SRC) $(LIBRARIES) $(OBJS_DEMO) - -rm -rf .libs - - distclean :: clean -@@ -212,8 +180,16 @@ - - ############################################################################### - -+internal_h = $(srcdir)/internal.h \ -+ $(INCDIR)/ncurses_cfg.h \ -+ $(INCDIR)/nc_mingw.h \ -+ $(INCDIR)/nc_string.h -+ -+etip_h = etip.h \ -+ $(INCDIR)/ncurses_dll.h -+ - cursesw_h = $(srcdir)/cursesw.h \ -- etip.h \ -+ $(etip_h) \ - $(INCDIR)/curses.h - - cursesp_h = $(srcdir)/cursesp.h \ -@@ -244,5 +220,26 @@ - cd ../panel && $(MAKE) $@ - - ############################################################################### -+ -+OBJS_DEMO = $(MODEL)/demo$o -+ -+$(MODEL)/demo$o : $(srcdir)/demo.cc \ -+ $(internal_h) \ -+ $(cursesf_h) \ -+ $(cursesm_h) \ -+ $(cursesapp_h) -+ @echo 'compiling demo (obj_s)' -+ @$(LIBTOOL_COMPILE) $(CXX) $(CFLAGS_DEFAULT) -c $(srcdir)/demo.cc -o $@ -+ -+demo$x: $(OBJS_DEMO) \ -+ $(LIBRARIES) \ -+ @TEST_DEPS@ -+ @ECHO_LD@ $(LINK) -o $@ $(OBJS_DEMO) $(LDFLAGS_DEFAULT) -+ -+etip.h: $(srcdir)/etip.h.in $(srcdir)/edit_cfg.sh -+ cp $(srcdir)/etip.h.in $@ -+ sh $(srcdir)/edit_cfg.sh ../include/ncurses_cfg.h $@ -+ -+############################################################################### - # The remainder of this file is automatically generated during configuration - ############################################################################### -diff -Naur ncurses-5.9/c++/modules ncurses-5.9.patch/c++/modules ---- ncurses-5.9/c++/modules 2006-12-24 01:53:08.000000000 +0100 -+++ ncurses-5.9.patch/c++/modules 2014-09-01 16:33:22.242791933 +0200 -@@ -1,7 +1,7 @@ - # Program modules --# $Id: modules,v 1.7 2006/12/24 00:53:08 tom Exp $ -+# $Id: modules,v 1.11 2013/03/30 19:41:11 tom Exp $ - ############################################################################## --# Copyright (c) 1998,2006 Free Software Foundation, Inc. # -+# Copyright (c) 1998-2006,2013 Free Software Foundation, Inc. # - # # - # Permission is hereby granted, free of charge, to any person obtaining a # - # copy of this software and associated documentation files (the "Software"), # -@@ -32,14 +32,13 @@ - # - - @ base --cursesf c++ $(srcdir) $(cursesf_h) $(cursesapp_h) --cursesm c++ $(srcdir) $(cursesm_h) $(cursesapp_h) --cursesp c++ $(srcdir) $(cursesp_h) --cursesw c++ $(srcdir) $(cursesw_h) --cursespad c++ $(srcdir) $(cursesw_h) --cursslk c++ $(srcdir) $(cursslk_h) $(cursesapp_h) --cursesapp c++ $(srcdir) $(cursesapp_h) --cursesmain c++ $(srcdir) $(cursesapp_h) --demo c++ $(srcdir) $(cursesf_h) $(cursesm_h) $(cursesapp_h) -+cursesf c++ $(srcdir) $(internal_h) $(cursesf_h) $(cursesapp_h) -+cursesm c++ $(srcdir) $(internal_h) $(cursesm_h) $(cursesapp_h) -+cursesw c++ $(srcdir) $(internal_h) $(cursesw_h) -+cursespad c++ $(srcdir) $(internal_h) $(cursesw_h) -+cursesp c++ $(srcdir) $(internal_h) $(cursesp_h) -+cursslk c++ $(srcdir) $(internal_h) $(cursesapp_h) -+cursesapp c++ $(srcdir) $(internal_h) $(cursesapp_h) -+cursesmain c++ $(srcdir) $(internal_h) $(cursesapp_h) $(INCDIR)/nc_alloc.h - - # vile:makemode -diff -Naur ncurses-5.9/config.guess ncurses-5.9.patch/config.guess ---- ncurses-5.9/config.guess 2010-09-29 01:11:39.000000000 +0200 -+++ ncurses-5.9.patch/config.guess 2014-09-01 16:33:22.243791935 +0200 -@@ -1,14 +1,12 @@ - #! /bin/sh - # Attempt to guess a canonical system name. --# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, --# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 --# Free Software Foundation, Inc. -+# Copyright 1992-2013 Free Software Foundation, Inc. - --timestamp='2010-09-24' -+timestamp='2013-06-10' - - # This file is free software; you can redistribute it and/or modify it - # under the terms of the GNU General Public License as published by --# the Free Software Foundation; either version 2 of the License, or -+# the Free Software Foundation; either version 3 of the License, or - # (at your option) any later version. - # - # This program is distributed in the hope that it will be useful, but -@@ -17,26 +15,22 @@ - # General Public License for more details. - # - # You should have received a copy of the GNU General Public License --# along with this program; if not, write to the Free Software --# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA --# 02110-1301, USA. -+# along with this program; if not, see . - # - # As a special exception to the GNU General Public License, if you - # distribute this file as part of a program that contains a - # configuration script generated by Autoconf, you may include it under --# the same distribution terms that you use for the rest of that program. -- -- --# Originally written by Per Bothner. Please send patches (context --# diff format) to and include a ChangeLog --# entry. -+# the same distribution terms that you use for the rest of that -+# program. This Exception is an additional permission under section 7 -+# of the GNU General Public License, version 3 ("GPLv3"). - # --# This script attempts to guess a canonical system name similar to --# config.sub. If it succeeds, it prints the system name on stdout, and --# exits with 0. Otherwise, it exits with 1. -+# Originally written by Per Bothner. - # - # You can get the latest version of this script from: - # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD -+# -+# Please send patches with a ChangeLog entry to config-patches@gnu.org. -+ - - me=`echo "$0" | sed -e 's,.*/,,'` - -@@ -56,9 +50,7 @@ - GNU config.guess ($timestamp) - - Originally written by Per Bothner. --Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, --2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free --Software Foundation, Inc. -+Copyright 1992-2013 Free Software Foundation, Inc. - - This is free software; see the source for copying conditions. There is NO - warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." -@@ -92,7 +84,7 @@ - exit 1 - fi - --trap 'exit 1' HUP INT TERM -+trap 'exit 1' 1 2 15 - - # CC_FOR_BUILD -- compiler used by this script. Note that the use of a - # compiler to aid in system detection is discouraged as it requires -@@ -106,7 +98,7 @@ - - set_cc_for_build=' - trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; --trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" HUP INT PIPE TERM ; -+trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; - : ${TMPDIR=/tmp} ; - { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || - { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || -@@ -140,12 +132,33 @@ - UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown - UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown - -+case "${UNAME_SYSTEM}" in -+Linux|GNU|GNU/*) -+ # If the system lacks a compiler, then just pick glibc. -+ # We could probably try harder. -+ LIBC=gnu -+ -+ eval $set_cc_for_build -+ cat <<-EOF > $dummy.c -+ #include -+ #if defined(__UCLIBC__) -+ LIBC=uclibc -+ #elif defined(__dietlibc__) -+ LIBC=dietlibc -+ #else -+ LIBC=gnu -+ #endif -+ EOF -+ eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` -+ ;; -+esac -+ - # Note: order is significant - the case branches are not exclusive. - - case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in - *:NetBSD:*:*) - # NetBSD (nbsd) targets should (where applicable) match one or -- # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, -+ # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, - # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently - # switched to ELF, *-*-netbsd* would select the old - # object file format. This provides both forward -@@ -202,6 +215,10 @@ - # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. - echo "${machine}-${os}${release}" - exit ;; -+ *:Bitrig:*:*) -+ UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` -+ echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE} -+ exit ;; - *:OpenBSD:*:*) - UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` - echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} -@@ -220,10 +237,10 @@ - exit ;; - alpha:OSF1:*:*) - case $UNAME_RELEASE in -- *4.0) -+ *4.0) - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` - ;; -- *5.*) -+ *5.*) - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` - ;; - esac -@@ -270,7 +287,10 @@ - # A Xn.n version is an unreleased experimental baselevel. - # 1.2 uses "1.2" for uname -r. - echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` -- exit ;; -+ # Reset EXIT trap before exiting to avoid spurious non-zero exit code. -+ exitcode=$? -+ trap '' 0 -+ exit $exitcode ;; - Alpha\ *:Windows_NT*:*) - # How do we know it's Interix rather than the generic POSIX subsystem? - # Should we change UNAME_MACHINE based on the output of uname instead -@@ -301,7 +321,7 @@ - arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) - echo arm-acorn-riscix${UNAME_RELEASE} - exit ;; -- arm:riscos:*:*|arm:RISCOS:*:*) -+ arm*:riscos:*:*|arm*:RISCOS:*:*) - echo arm-unknown-riscos - exit ;; - SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) -@@ -326,8 +346,8 @@ - sparc) echo sparc-icl-nx7; exit ;; - esac ;; - s390x:SunOS:*:*) -- echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` -- exit ;; -+ echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` -+ exit ;; - sun4H:SunOS:5.*:*) - echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; -@@ -495,7 +515,7 @@ - else - echo i586-dg-dgux${UNAME_RELEASE} - fi -- exit ;; -+ exit ;; - M88*:DolphinOS:*:*) # DolphinOS (SVR3) - echo m88k-dolphin-sysv3 - exit ;; -@@ -597,50 +617,50 @@ - sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` - sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` - case "${sc_cpu_version}" in -- 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 -- 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 -- 532) # CPU_PA_RISC2_0 -- case "${sc_kernel_bits}" in -- 32) HP_ARCH="hppa2.0n" ;; -- 64) HP_ARCH="hppa2.0w" ;; -+ 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 -+ 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 -+ 532) # CPU_PA_RISC2_0 -+ case "${sc_kernel_bits}" in -+ 32) HP_ARCH="hppa2.0n" ;; -+ 64) HP_ARCH="hppa2.0w" ;; - '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 -- esac ;; -- esac -+ esac ;; -+ esac - fi - if [ "${HP_ARCH}" = "" ]; then - eval $set_cc_for_build -- sed 's/^ //' << EOF >$dummy.c -+ sed 's/^ //' << EOF >$dummy.c -+ -+ #define _HPUX_SOURCE -+ #include -+ #include - -- #define _HPUX_SOURCE -- #include -- #include -- -- int main () -- { -- #if defined(_SC_KERNEL_BITS) -- long bits = sysconf(_SC_KERNEL_BITS); -- #endif -- long cpu = sysconf (_SC_CPU_VERSION); -- -- switch (cpu) -- { -- case CPU_PA_RISC1_0: puts ("hppa1.0"); break; -- case CPU_PA_RISC1_1: puts ("hppa1.1"); break; -- case CPU_PA_RISC2_0: -- #if defined(_SC_KERNEL_BITS) -- switch (bits) -- { -- case 64: puts ("hppa2.0w"); break; -- case 32: puts ("hppa2.0n"); break; -- default: puts ("hppa2.0"); break; -- } break; -- #else /* !defined(_SC_KERNEL_BITS) */ -- puts ("hppa2.0"); break; -- #endif -- default: puts ("hppa1.0"); break; -- } -- exit (0); -- } -+ int main () -+ { -+ #if defined(_SC_KERNEL_BITS) -+ long bits = sysconf(_SC_KERNEL_BITS); -+ #endif -+ long cpu = sysconf (_SC_CPU_VERSION); -+ -+ switch (cpu) -+ { -+ case CPU_PA_RISC1_0: puts ("hppa1.0"); break; -+ case CPU_PA_RISC1_1: puts ("hppa1.1"); break; -+ case CPU_PA_RISC2_0: -+ #if defined(_SC_KERNEL_BITS) -+ switch (bits) -+ { -+ case 64: puts ("hppa2.0w"); break; -+ case 32: puts ("hppa2.0n"); break; -+ default: puts ("hppa2.0"); break; -+ } break; -+ #else /* !defined(_SC_KERNEL_BITS) */ -+ puts ("hppa2.0"); break; -+ #endif -+ default: puts ("hppa1.0"); break; -+ } -+ exit (0); -+ } - EOF - (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` - test -z "$HP_ARCH" && HP_ARCH=hppa -@@ -789,21 +809,26 @@ - echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} - exit ;; - *:FreeBSD:*:*) -- case ${UNAME_MACHINE} in -- pc98) -- echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; -+ UNAME_PROCESSOR=`/usr/bin/uname -p` -+ case ${UNAME_PROCESSOR} in - amd64) - echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; - *) -- echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; -+ echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; - esac - exit ;; - i*:CYGWIN*:*) - echo ${UNAME_MACHINE}-pc-cygwin - exit ;; -+ *:MINGW64*:*) -+ echo ${UNAME_MACHINE}-pc-mingw64 -+ exit ;; - *:MINGW*:*) - echo ${UNAME_MACHINE}-pc-mingw32 - exit ;; -+ i*:MSYS*:*) -+ echo ${UNAME_MACHINE}-pc-msys -+ exit ;; - i*:windows32*:*) - # uname -m includes "-pc" on this system. - echo ${UNAME_MACHINE}-mingw32 -@@ -820,8 +845,8 @@ - echo x86_64-unknown-interix${UNAME_RELEASE} - exit ;; - IA64) -- echo ia64-unknown-interix${UNAME_RELEASE} -- exit ;; -+ echo ia64-unknown-interix${UNAME_RELEASE} -+ exit ;; - esac ;; - [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) - echo i${UNAME_MACHINE}-pc-mks -@@ -849,70 +874,81 @@ - exit ;; - *:GNU:*:*) - # the GNU system -- echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` -+ echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` - exit ;; - *:GNU/*:*:*) - # other systems with GNU libc and userland -- echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu -+ echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} - exit ;; - i*86:Minix:*:*) - echo ${UNAME_MACHINE}-pc-minix - exit ;; -+ aarch64:Linux:*:*) -+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC} -+ exit ;; -+ aarch64_be:Linux:*:*) -+ UNAME_MACHINE=aarch64_be -+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC} -+ exit ;; - alpha:Linux:*:*) - case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in -- EV5) UNAME_MACHINE=alphaev5 ;; -- EV56) UNAME_MACHINE=alphaev56 ;; -- PCA56) UNAME_MACHINE=alphapca56 ;; -- PCA57) UNAME_MACHINE=alphapca56 ;; -- EV6) UNAME_MACHINE=alphaev6 ;; -- EV67) UNAME_MACHINE=alphaev67 ;; -- EV68*) UNAME_MACHINE=alphaev68 ;; -+ EV5) UNAME_MACHINE=alphaev5 ;; -+ EV56) UNAME_MACHINE=alphaev56 ;; -+ PCA56) UNAME_MACHINE=alphapca56 ;; -+ PCA57) UNAME_MACHINE=alphapca56 ;; -+ EV6) UNAME_MACHINE=alphaev6 ;; -+ EV67) UNAME_MACHINE=alphaev67 ;; -+ EV68*) UNAME_MACHINE=alphaev68 ;; - esac - objdump --private-headers /bin/sh | grep -q ld.so.1 -- if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi -- echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} -+ if test "$?" = 0 ; then LIBC="gnulibc1" ; fi -+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC} -+ exit ;; -+ arc:Linux:*:* | arceb:Linux:*:*) -+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - arm*:Linux:*:*) - eval $set_cc_for_build -- if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null | \ -- grep -q __ARM_EABI__ -+ if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ -+ | grep -q __ARM_EABI__ - then -- echo ${UNAME_MACHINE}-unknown-linux-gnu -+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - else -- echo ${UNAME_MACHINE}-unknown-linux-gnueabi -+ if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ -+ | grep -q __ARM_PCS_VFP -+ then -+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi -+ else -+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf -+ fi - fi - exit ;; - avr32*:Linux:*:*) -- echo ${UNAME_MACHINE}-unknown-linux-gnu -+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - cris:Linux:*:*) -- echo cris-axis-linux-gnu -+ echo ${UNAME_MACHINE}-axis-linux-${LIBC} - exit ;; - crisv32:Linux:*:*) -- echo crisv32-axis-linux-gnu -+ echo ${UNAME_MACHINE}-axis-linux-${LIBC} - exit ;; - frv:Linux:*:*) -- echo frv-unknown-linux-gnu -+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC} -+ exit ;; -+ hexagon:Linux:*:*) -+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - i*86:Linux:*:*) -- LIBC=gnu -- eval $set_cc_for_build -- sed 's/^ //' << EOF >$dummy.c -- #ifdef __dietlibc__ -- LIBC=dietlibc -- #endif --EOF -- eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` -- echo "${UNAME_MACHINE}-pc-linux-${LIBC}" -+ echo ${UNAME_MACHINE}-pc-linux-${LIBC} - exit ;; - ia64:Linux:*:*) -- echo ${UNAME_MACHINE}-unknown-linux-gnu -+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - m32r*:Linux:*:*) -- echo ${UNAME_MACHINE}-unknown-linux-gnu -+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - m68*:Linux:*:*) -- echo ${UNAME_MACHINE}-unknown-linux-gnu -+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - mips:Linux:*:* | mips64:Linux:*:*) - eval $set_cc_for_build -@@ -931,54 +967,63 @@ - #endif - EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` -- test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } -+ test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } - ;; -+ or1k:Linux:*:*) -+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC} -+ exit ;; - or32:Linux:*:*) -- echo or32-unknown-linux-gnu -- exit ;; -+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC} -+ exit ;; - padre:Linux:*:*) -- echo sparc-unknown-linux-gnu -+ echo sparc-unknown-linux-${LIBC} - exit ;; - parisc64:Linux:*:* | hppa64:Linux:*:*) -- echo hppa64-unknown-linux-gnu -- exit ;; -+ echo hppa64-unknown-linux-${LIBC} -+ exit ;; - parisc:Linux:*:* | hppa:Linux:*:*) - # Look for CPU level - case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in -- PA7*) echo hppa1.1-unknown-linux-gnu ;; -- PA8*) echo hppa2.0-unknown-linux-gnu ;; -- *) echo hppa-unknown-linux-gnu ;; -+ PA7*) echo hppa1.1-unknown-linux-${LIBC} ;; -+ PA8*) echo hppa2.0-unknown-linux-${LIBC} ;; -+ *) echo hppa-unknown-linux-${LIBC} ;; - esac - exit ;; - ppc64:Linux:*:*) -- echo powerpc64-unknown-linux-gnu -+ echo powerpc64-unknown-linux-${LIBC} - exit ;; - ppc:Linux:*:*) -- echo powerpc-unknown-linux-gnu -+ echo powerpc-unknown-linux-${LIBC} -+ exit ;; -+ ppc64le:Linux:*:*) -+ echo powerpc64le-unknown-linux-${LIBC} -+ exit ;; -+ ppcle:Linux:*:*) -+ echo powerpcle-unknown-linux-${LIBC} - exit ;; - s390:Linux:*:* | s390x:Linux:*:*) -- echo ${UNAME_MACHINE}-ibm-linux -+ echo ${UNAME_MACHINE}-ibm-linux-${LIBC} - exit ;; - sh64*:Linux:*:*) -- echo ${UNAME_MACHINE}-unknown-linux-gnu -+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - sh*:Linux:*:*) -- echo ${UNAME_MACHINE}-unknown-linux-gnu -+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - sparc:Linux:*:* | sparc64:Linux:*:*) -- echo ${UNAME_MACHINE}-unknown-linux-gnu -+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - tile*:Linux:*:*) -- echo ${UNAME_MACHINE}-tilera-linux-gnu -+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - vax:Linux:*:*) -- echo ${UNAME_MACHINE}-dec-linux-gnu -+ echo ${UNAME_MACHINE}-dec-linux-${LIBC} - exit ;; - x86_64:Linux:*:*) -- echo x86_64-unknown-linux-gnu -+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - xtensa*:Linux:*:*) -- echo ${UNAME_MACHINE}-unknown-linux-gnu -+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - i*86:DYNIX/ptx:4*:*) - # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. -@@ -1093,7 +1138,7 @@ - && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; - 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ -- && { echo i486-ncr-sysv4; exit; } ;; -+ && { echo i486-ncr-sysv4; exit; } ;; - NCR*:*:4.2:* | MPRAS*:*:4.2:*) - OS_REL='.3' - test -r /etc/.relid \ -@@ -1136,8 +1181,8 @@ - echo ns32k-sni-sysv - fi - exit ;; -- PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort -- # says -+ PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort -+ # says - echo i586-unisys-sysv4 - exit ;; - *:UNIX_System_V:4*:FTX*) -@@ -1165,9 +1210,9 @@ - exit ;; - R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) - if [ -d /usr/nec ]; then -- echo mips-nec-sysv${UNAME_RELEASE} -+ echo mips-nec-sysv${UNAME_RELEASE} - else -- echo mips-unknown-sysv${UNAME_RELEASE} -+ echo mips-unknown-sysv${UNAME_RELEASE} - fi - exit ;; - BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. -@@ -1182,6 +1227,9 @@ - BePC:Haiku:*:*) # Haiku running on Intel PC compatible. - echo i586-pc-haiku - exit ;; -+ x86_64:Haiku:*:*) -+ echo x86_64-unknown-haiku -+ exit ;; - SX-4:SUPER-UX:*:*) - echo sx4-nec-superux${UNAME_RELEASE} - exit ;; -@@ -1208,26 +1256,28 @@ - exit ;; - *:Darwin:*:*) - UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown -- case $UNAME_PROCESSOR in -- i386) -- eval $set_cc_for_build -- if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then -- if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ -- (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ -- grep IS_64BIT_ARCH >/dev/null -- then -- UNAME_PROCESSOR="x86_64" -- fi -- fi ;; -- unknown) UNAME_PROCESSOR=powerpc ;; -- esac -+ eval $set_cc_for_build -+ if test "$UNAME_PROCESSOR" = unknown ; then -+ UNAME_PROCESSOR=powerpc -+ fi -+ if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then -+ if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ -+ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ -+ grep IS_64BIT_ARCH >/dev/null -+ then -+ case $UNAME_PROCESSOR in -+ i386) UNAME_PROCESSOR=x86_64 ;; -+ powerpc) UNAME_PROCESSOR=powerpc64 ;; -+ esac -+ fi -+ fi - echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} - exit ;; - *:procnto*:*:* | *:QNX:[0123456789]*:*) - UNAME_PROCESSOR=`uname -p` - if test "$UNAME_PROCESSOR" = "x86"; then -- UNAME_PROCESSOR=i386 -- UNAME_MACHINE=pc -+ UNAME_PROCESSOR=i386 -+ UNAME_MACHINE=pc - fi - echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} - exit ;; -@@ -1237,7 +1287,7 @@ - NEO-?:NONSTOP_KERNEL:*:*) - echo neo-tandem-nsk${UNAME_RELEASE} - exit ;; -- NSE-?:NONSTOP_KERNEL:*:*) -+ NSE-*:NONSTOP_KERNEL:*:*) - echo nse-tandem-nsk${UNAME_RELEASE} - exit ;; - NSR-?:NONSTOP_KERNEL:*:*) -@@ -1306,11 +1356,11 @@ - i*86:AROS:*:*) - echo ${UNAME_MACHINE}-pc-aros - exit ;; -+ x86_64:VMkernel:*:*) -+ echo ${UNAME_MACHINE}-unknown-esx -+ exit ;; - esac - --#echo '(No uname command or uname output not recognized.)' 1>&2 --#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 -- - eval $set_cc_for_build - cat >$dummy.c < - printf ("m68k-sony-newsos%s\n", - #ifdef NEWSOS4 -- "4" -+ "4" - #else -- "" -+ "" - #endif -- ); exit (0); -+ ); exit (0); - #endif - #endif - -diff -Naur ncurses-5.9/config.sub ncurses-5.9.patch/config.sub ---- ncurses-5.9/config.sub 2010-09-11 00:25:58.000000000 +0200 -+++ ncurses-5.9.patch/config.sub 2014-09-01 16:33:22.244791936 +0200 -@@ -1,38 +1,31 @@ - #! /bin/sh - # Configuration validation subroutine script. --# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, --# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 --# Free Software Foundation, Inc. -- --timestamp='2010-09-11' -- --# This file is (in principle) common to ALL GNU software. --# The presence of a machine in this file suggests that SOME GNU software --# can handle that machine. It does not imply ALL GNU software can. --# --# This file is free software; you can redistribute it and/or modify --# it under the terms of the GNU General Public License as published by --# the Free Software Foundation; either version 2 of the License, or -+# Copyright 1992-2013 Free Software Foundation, Inc. -+ -+timestamp='2013-10-01' -+ -+# This file is free software; you can redistribute it and/or modify it -+# under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or - # (at your option) any later version. - # --# This program is distributed in the hope that it will be useful, --# but WITHOUT ANY WARRANTY; without even the implied warranty of --# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --# GNU General Public License for more details. -+# This program is distributed in the hope that it will be useful, but -+# WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+# General Public License for more details. - # - # You should have received a copy of the GNU General Public License --# along with this program; if not, write to the Free Software --# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA --# 02110-1301, USA. -+# along with this program; if not, see . - # - # As a special exception to the GNU General Public License, if you - # distribute this file as part of a program that contains a - # configuration script generated by Autoconf, you may include it under --# the same distribution terms that you use for the rest of that program. -+# the same distribution terms that you use for the rest of that -+# program. This Exception is an additional permission under section 7 -+# of the GNU General Public License, version 3 ("GPLv3"). - - --# Please send patches to . Submit a context --# diff and a properly formatted GNU ChangeLog entry. -+# Please send patches with a ChangeLog entry to config-patches@gnu.org. - # - # Configuration subroutine to validate and canonicalize a configuration type. - # Supply the specified configuration type as an argument. -@@ -75,9 +68,7 @@ - version="\ - GNU config.sub ($timestamp) - --Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, --2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free --Software Foundation, Inc. -+Copyright 1992-2013 Free Software Foundation, Inc. - - This is free software; see the source for copying conditions. There is NO - warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." -@@ -125,13 +116,17 @@ - maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` - case $maybe_os in - nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ -- linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ -+ linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ - knetbsd*-gnu* | netbsd*-gnu* | \ - kopensolaris*-gnu* | \ - storm-chaos* | os2-emx* | rtmk-nova*) - os=-$maybe_os - basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` - ;; -+ android-linux) -+ os=-linux-android -+ basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown -+ ;; - *) - basic_machine=`echo $1 | sed 's/-[^-]*$//'` - if [ $basic_machine != $1 ] -@@ -154,7 +149,7 @@ - -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ - -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ - -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -- -apple | -axis | -knuth | -cray | -microblaze) -+ -apple | -axis | -knuth | -cray | -microblaze*) - os= - basic_machine=$1 - ;; -@@ -175,10 +170,10 @@ - os=-chorusos - basic_machine=$1 - ;; -- -chorusrdb) -- os=-chorusrdb -+ -chorusrdb) -+ os=-chorusrdb - basic_machine=$1 -- ;; -+ ;; - -hiux*) - os=-hiuxwe2 - ;; -@@ -223,6 +218,12 @@ - -isc*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; -+ -lynx*178) -+ os=-lynxos178 -+ ;; -+ -lynx*5) -+ os=-lynxos5 -+ ;; - -lynx*) - os=-lynxos - ;; -@@ -247,20 +248,28 @@ - # Some are omitted here because they have special meanings below. - 1750a | 580 \ - | a29k \ -+ | aarch64 | aarch64_be \ - | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ - | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ - | am33_2.0 \ -- | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ -+ | arc | arceb \ -+ | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ -+ | avr | avr32 \ -+ | be32 | be64 \ - | bfin \ -- | c4x | clipper \ -+ | c4x | c8051 | clipper \ - | d10v | d30v | dlx | dsp16xx \ -+ | epiphany \ - | fido | fr30 | frv \ - | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ -+ | hexagon \ - | i370 | i860 | i960 | ia64 \ - | ip2k | iq2000 \ -+ | k1om \ -+ | le32 | le64 \ - | lm32 \ - | m32c | m32r | m32rle | m68000 | m68k | m88k \ -- | maxq | mb | microblaze | mcore | mep | metag \ -+ | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ - | mips | mipsbe | mipseb | mipsel | mipsle \ - | mips16 \ - | mips64 | mips64el \ -@@ -278,30 +287,32 @@ - | mipsisa64r2 | mipsisa64r2el \ - | mipsisa64sb1 | mipsisa64sb1el \ - | mipsisa64sr71k | mipsisa64sr71kel \ -+ | mipsr5900 | mipsr5900el \ - | mipstx39 | mipstx39el \ - | mn10200 | mn10300 \ - | moxie \ - | mt \ - | msp430 \ -- | nds32 | nds32le | nds32be\ -- | nios | nios2 \ -+ | nds32 | nds32le | nds32be \ -+ | nios | nios2 | nios2eb | nios2el \ - | ns16k | ns32k \ -- | or32 \ -+ | open8 \ -+ | or1k | or32 \ - | pdp10 | pdp11 | pj | pjl \ -- | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ -+ | powerpc | powerpc64 | powerpc64le | powerpcle \ - | pyramid \ -- | rx \ -+ | rl78 | rx \ - | score \ - | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ - | sh64 | sh64le \ - | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ - | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ -- | spu | strongarm \ -- | tahoe | thumb | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ -+ | spu \ -+ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ - | ubicom32 \ -- | v850 | v850e \ -+ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ - | we32k \ -- | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ -+ | x86 | xc16x | xstormy16 | xtensa \ - | z8k | z80) - basic_machine=$basic_machine-unknown - ;; -@@ -314,8 +325,7 @@ - c6x) - basic_machine=tic6x-unknown - ;; -- m6811 | m68hc11 | m6812 | m68hc12 | picochip) -- # Motorola 68HC11/12. -+ m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip) - basic_machine=$basic_machine-unknown - os=-none - ;; -@@ -325,12 +335,27 @@ - basic_machine=mt-unknown - ;; - -+ strongarm | thumb | xscale) -+ basic_machine=arm-unknown -+ ;; -+ xgate) -+ basic_machine=$basic_machine-unknown -+ os=-none -+ ;; -+ xscaleeb) -+ basic_machine=armeb-unknown -+ ;; -+ -+ xscaleel) -+ basic_machine=armel-unknown -+ ;; -+ - # We use `pc' rather than `unknown' - # because (1) that's what they normally are, and - # (2) the word "unknown" tends to confuse beginning users. - i*86 | x86_64) -- basic_machine=$basic_machine-pc -- ;; -+ basic_machine=$basic_machine-pc -+ ;; - # Object if more than one company name word. - *-*-*) - echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 -@@ -339,25 +364,31 @@ - # Recognize the basic CPU types with company name. - 580-* \ - | a29k-* \ -+ | aarch64-* | aarch64_be-* \ - | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ - | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ -- | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ -+ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ - | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ - | avr-* | avr32-* \ -+ | be32-* | be64-* \ - | bfin-* | bs2000-* \ - | c[123]* | c30-* | [cjt]90-* | c4x-* \ -- | clipper-* | craynv-* | cydra-* \ -+ | c8051-* | clipper-* | craynv-* | cydra-* \ - | d10v-* | d30v-* | dlx-* \ - | elxsi-* \ - | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ - | h8300-* | h8500-* \ - | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ -+ | hexagon-* \ - | i*86-* | i860-* | i960-* | ia64-* \ - | ip2k-* | iq2000-* \ -+ | k1om-* \ -+ | le32-* | le64-* \ - | lm32-* \ - | m32c-* | m32r-* | m32rle-* \ - | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ -- | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \ -+ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ -+ | microblaze-* | microblazeel-* \ - | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ - | mips16-* \ - | mips64-* | mips64el-* \ -@@ -375,31 +406,34 @@ - | mipsisa64r2-* | mipsisa64r2el-* \ - | mipsisa64sb1-* | mipsisa64sb1el-* \ - | mipsisa64sr71k-* | mipsisa64sr71kel-* \ -+ | mipsr5900-* | mipsr5900el-* \ - | mipstx39-* | mipstx39el-* \ - | mmix-* \ - | mt-* \ - | msp430-* \ - | nds32-* | nds32le-* | nds32be-* \ -- | nios-* | nios2-* \ -+ | nios-* | nios2-* | nios2eb-* | nios2el-* \ - | none-* | np1-* | ns16k-* | ns32k-* \ -+ | open8-* \ - | orion-* \ - | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ -- | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ -+ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ - | pyramid-* \ -- | romp-* | rs6000-* | rx-* \ -+ | rl78-* | romp-* | rs6000-* | rx-* \ - | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ - | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ - | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ - | sparclite-* \ -- | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ -- | tahoe-* | thumb-* \ -+ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ -+ | tahoe-* \ - | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ -- | tile-* | tilegx-* \ -+ | tile*-* \ - | tron-* \ - | ubicom32-* \ -- | v850-* | v850e-* | vax-* \ -+ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ -+ | vax-* \ - | we32k-* \ -- | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ -+ | x86-* | x86_64-* | xc16x-* | xps100-* \ - | xstormy16-* | xtensa*-* \ - | ymp-* \ - | z8k-* | z80-*) -@@ -539,7 +573,7 @@ - basic_machine=craynv-cray - os=-unicosmp - ;; -- cr16) -+ cr16 | cr16-*) - basic_machine=cr16-unknown - os=-elf - ;; -@@ -697,7 +731,6 @@ - i370-ibm* | ibm*) - basic_machine=i370-ibm - ;; --# I'm not sure what "Sysv32" means. Should this be sysv3.2? - i*86v32) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv32 -@@ -755,11 +788,15 @@ - basic_machine=ns32k-utek - os=-sysv - ;; -- microblaze) -+ microblaze*) - basic_machine=microblaze-xilinx - ;; -+ mingw64) -+ basic_machine=x86_64-pc -+ os=-mingw64 -+ ;; - mingw32) -- basic_machine=i386-pc -+ basic_machine=i686-pc - os=-mingw32 - ;; - mingw32ce) -@@ -794,10 +831,18 @@ - ms1-*) - basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` - ;; -+ msys) -+ basic_machine=i686-pc -+ os=-msys -+ ;; - mvs) - basic_machine=i370-ibm - os=-mvs - ;; -+ nacl) -+ basic_machine=le32-unknown -+ os=-nacl -+ ;; - ncr3000) - basic_machine=i486-ncr - os=-sysv4 -@@ -950,9 +995,10 @@ - ;; - power) basic_machine=power-ibm - ;; -- ppc) basic_machine=powerpc-unknown -+ ppc | ppcbe) basic_machine=powerpc-unknown - ;; -- ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` -+ ppc-* | ppcbe-*) -+ basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppcle | powerpclittle | ppc-le | powerpc-little) - basic_machine=powerpcle-unknown -@@ -977,7 +1023,11 @@ - basic_machine=i586-unknown - os=-pw32 - ;; -- rdos) -+ rdos | rdos64) -+ basic_machine=x86_64-pc -+ os=-rdos -+ ;; -+ rdos32) - basic_machine=i386-pc - os=-rdos - ;; -@@ -1046,6 +1096,9 @@ - basic_machine=i860-stratus - os=-sysv4 - ;; -+ strongarm-* | thumb-*) -+ basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` -+ ;; - sun2) - basic_machine=m68000-sun - ;; -@@ -1102,13 +1155,8 @@ - basic_machine=t90-cray - os=-unicos - ;; -- # This must be matched before tile*. -- tilegx*) -- basic_machine=tilegx-unknown -- os=-linux-gnu -- ;; - tile*) -- basic_machine=tile-unknown -+ basic_machine=$basic_machine-unknown - os=-linux-gnu - ;; - tx39) -@@ -1178,6 +1226,9 @@ - xps | xps100) - basic_machine=xps100-honeywell - ;; -+ xscale-* | xscalee[bl]-*) -+ basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` -+ ;; - ymp) - basic_machine=ymp-cray - os=-unicos -@@ -1303,21 +1354,21 @@ - -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ - | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ - | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ -- | -sym* | -kopensolaris* \ -+ | -sym* | -kopensolaris* | -plan9* \ - | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ - | -aos* | -aros* \ - | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ - | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ - | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ -- | -openbsd* | -solidbsd* \ -+ | -bitrig* | -openbsd* | -solidbsd* \ - | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ - | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ - | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ - | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ - | -chorusos* | -chorusrdb* | -cegcc* \ -- | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ -- | -mingw32* | -linux-gnu* | -linux-android* \ -- | -linux-newlib* | -linux-uclibc* \ -+ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ -+ | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ -+ | -linux-newlib* | -linux-musl* | -linux-uclibc* \ - | -uxpv* | -beos* | -mpeix* | -udk* \ - | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ - | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ -@@ -1449,9 +1500,6 @@ - -aros*) - os=-aros - ;; -- -kaos*) -- os=-kaos -- ;; - -zvmoe) - os=-zvmoe - ;; -@@ -1500,6 +1548,12 @@ - c4x-* | tic4x-*) - os=-coff - ;; -+ c8051-*) -+ os=-elf -+ ;; -+ hexagon-*) -+ os=-elf -+ ;; - tic54x-*) - os=-coff - ;; -@@ -1527,9 +1581,6 @@ - ;; - m68000-sun) - os=-sunos3 -- # This also exists in the configure program, but was not the -- # default. -- # os=-sunos4 - ;; - m68*-cisco) - os=-aout -@@ -1543,6 +1594,9 @@ - mips*-*) - os=-elf - ;; -+ or1k-*) -+ os=-elf -+ ;; - or32-*) - os=-coff - ;; -diff -Naur ncurses-5.9/configure ncurses-5.9.patch/configure ---- ncurses-5.9/configure 2011-04-01 01:35:51.000000000 +0200 -+++ ncurses-5.9.patch/configure 2014-09-01 16:34:19.468887101 +0200 -@@ -1,7 +1,7 @@ - #! /bin/sh --# From configure.in Revision: 1.520 . -+# From configure.in Revision: 1.578 . - # Guess values for system-dependent variables and create Makefiles. --# Generated by Autoconf 2.52.20101002. -+# Generated by Autoconf 2.52.20121002. - # - # Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 - # Free Software Foundation, Inc. -@@ -171,15 +171,16 @@ - bindir='${exec_prefix}/bin' - sbindir='${exec_prefix}/sbin' - libexecdir='${exec_prefix}/libexec' --datadir='${prefix}/share' -+datarootdir='${prefix}/share' -+datadir='${datarootdir}' - sysconfdir='${prefix}/etc' - sharedstatedir='${prefix}/com' - localstatedir='${prefix}/var' - libdir='${exec_prefix}/lib' - includedir='${prefix}/include' - oldincludedir='/usr/include' --infodir='${prefix}/info' --mandir='${prefix}/man' -+infodir='${datarootdir}/info' -+mandir='${datarootdir}/man' - - # Identity of this package. - PACKAGE_NAME= -@@ -230,6 +231,13 @@ - | --da=*) - datadir=$ac_optarg ;; - -+ -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ -+ | --dataroo | --dataro | --datar) -+ ac_prev=datarootdir ;; -+ -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ -+ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) -+ datarootdir=$ac_optarg ;; -+ - -disable-* | --disable-*) - ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` - # Reject names that are not valid shell variable names. -@@ -505,7 +513,7 @@ - done - - # Be sure to have absolute paths. --for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ -+for ac_var in bindir sbindir libexecdir datarootdir datadir sysconfdir sharedstatedir \ - localstatedir libdir includedir oldincludedir infodir mandir - do - eval ac_val=$`echo $ac_var` -@@ -654,15 +662,16 @@ - --bindir=DIR user executables [EPREFIX/bin] - --sbindir=DIR system admin executables [EPREFIX/sbin] - --libexecdir=DIR program executables [EPREFIX/libexec] -- --datadir=DIR read-only architecture-independent data [PREFIX/share] -+ --datarootdir=DIR read-only architecture-independent data [PREFIX/share] -+ --datadir=DIR read-only architecture-independent data [DATAROOTDIR] - --sysconfdir=DIR read-only single-machine data [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] - --localstatedir=DIR modifiable single-machine data [PREFIX/var] - --libdir=DIR object code libraries [EPREFIX/lib] - --includedir=DIR C header files [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc [/usr/include] -- --infodir=DIR info documentation [PREFIX/info] -- --mandir=DIR man documentation [PREFIX/man] -+ --infodir=DIR info documentation [DATAROOTDIR/info] -+ --mandir=DIR man documentation [DATAROOTDIR/man] - EOF - - cat <<\EOF -@@ -694,14 +703,16 @@ - --with-rel-version=XXX override derived release version - --with-abi-version=XXX override derived ABI version - --with-system-type=XXX test: override derived host system-type -+ --without-ada suppress check for Ada95, don't build demo - --without-cxx do not adjust ncurses bool to match C++ - --without-cxx-binding do not build C++ binding and demo -- --without-ada suppress check for Ada95, don't build demo -+ --disable-db-install suppress install of terminal database - --without-manpages suppress install of manpages -- --without-progs suppress build with programs (e.g., tic) -- --without-tests suppress build with test-programs -+ --without-progs suppress build/install with programs (e.g., tic) -+ --without-tests suppress build/install with test-programs - --without-curses-h install curses.h as ncurses.h only - --with-pkg-config{=path} enable/disable use of pkg-config -+ --with-pkg-config-libdir=XXX use given directory for installing pc-files - --enable-pc-files generate and install .pc files for pkg-config - --enable-mixed-case tic should assume mixed-case filenames - --with-install-prefix prefixes actual install-location ($DESTDIR) -@@ -719,6 +730,8 @@ - --with-normal generate normal-libraries (default) - --with-debug generate debug-libraries (default) - --with-profile generate profile-libraries -+ --with-cxx-shared generate C++ shared-libraries -+ --with-lib-prefix override library-prefix - --with-termlib generate separate terminfo library - --with-ticlib generate separate tic library - --with-gpm use Alessandro Rubini's GPM library -@@ -735,6 +748,7 @@ - --with-hashed-db specify hashed-database library - --with-fallbacks=XXX specify list of fallback terminal descriptions - --without-xterm-new specify if xterm terminfo should be old version -+ --with-xterm-kbs=XXX specify if xterm backspace sends BS or DEL - --with-terminfo-dirs=XXX specify list of terminfo directories (default: DATADIR/terminfo) - --with-default-terminfo-dir=DIR default terminfo directory (default: DATADIR/terminfo) - --disable-big-core assume machine has little memory -@@ -759,6 +773,7 @@ - --with-ospeed=TYPE override type of ospeed variable - --with-mmask-t=TYPE override type of mmask_t - --with-ccharw-max=XXX override size CCHARW_MAX -+ --with-tparm-arg=TYPE override parameter type of tparm - --with-rcs-ids compile-in RCS identifiers - Options to Specify How Manpages are Installed: - --with-manpage-format specify manpage-format: gzip/compress/BSDI/normal and -@@ -796,8 +811,9 @@ - --disable-scroll-hints compile without scroll-hints code - --enable-wgetch-events compile with experimental wgetch-events code - Testing/development Options: -- --enable-echo build: display "compiling" commands (default) -+ --disable-echo do not display "compiling" commands - --enable-warnings build: turn on GCC compiler warnings -+ --enable-string-hacks work around bogus compiler/loader warnings - --enable-assertions test: turn on generation of assertion code - --with-dmalloc test: use Gray Watson's dmalloc library - --with-dbmalloc test: use Conor Cahill's dbmalloc library -@@ -883,7 +899,7 @@ - running configure, to aid debugging if configure makes a mistake. - - It was created by $as_me, which was --generated by GNU Autoconf 2.52.20101002. Invocation command line was -+generated by GNU Autoconf 2.52.20121002. Invocation command line was - - $ $0 $@ - -@@ -1007,7 +1023,7 @@ - fi - for ac_site_file in $CONFIG_SITE; do - if test -r "$ac_site_file"; then -- { echo "$as_me:1010: loading site script $ac_site_file" >&5 -+ { echo "$as_me:1026: loading site script $ac_site_file" >&5 - echo "$as_me: loading site script $ac_site_file" >&6;} - cat "$ac_site_file" >&5 - . "$ac_site_file" -@@ -1018,7 +1034,7 @@ - # Some versions of bash will fail to source /dev/null (special - # files actually), so we avoid doing that. - if test -f "$cache_file"; then -- { echo "$as_me:1021: loading cache $cache_file" >&5 -+ { echo "$as_me:1037: loading cache $cache_file" >&5 - echo "$as_me: loading cache $cache_file" >&6;} - case $cache_file in - [\\/]* | ?:[\\/]* ) . $cache_file;; -@@ -1026,7 +1042,7 @@ - esac - fi - else -- { echo "$as_me:1029: creating cache $cache_file" >&5 -+ { echo "$as_me:1045: creating cache $cache_file" >&5 - echo "$as_me: creating cache $cache_file" >&6;} - >$cache_file - fi -@@ -1042,21 +1058,21 @@ - eval ac_new_val="\$ac_env_${ac_var}_value" - case $ac_old_set,$ac_new_set in - set,) -- { echo "$as_me:1045: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 -+ { echo "$as_me:1061: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 - echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,set) -- { echo "$as_me:1049: error: \`$ac_var' was not set in the previous run" >&5 -+ { echo "$as_me:1065: error: \`$ac_var' was not set in the previous run" >&5 - echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,);; - *) - if test "x$ac_old_val" != "x$ac_new_val"; then -- { echo "$as_me:1055: error: \`$ac_var' has changed since the previous run:" >&5 -+ { echo "$as_me:1071: error: \`$ac_var' has changed since the previous run:" >&5 - echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} -- { echo "$as_me:1057: former value: $ac_old_val" >&5 -+ { echo "$as_me:1073: former value: $ac_old_val" >&5 - echo "$as_me: former value: $ac_old_val" >&2;} -- { echo "$as_me:1059: current value: $ac_new_val" >&5 -+ { echo "$as_me:1075: current value: $ac_new_val" >&5 - echo "$as_me: current value: $ac_new_val" >&2;} - ac_cache_corrupted=: - fi;; -@@ -1075,9 +1091,9 @@ - fi - done - if $ac_cache_corrupted; then -- { echo "$as_me:1078: error: changes in the environment can compromise the build" >&5 -+ { echo "$as_me:1094: error: changes in the environment can compromise the build" >&5 - echo "$as_me: error: changes in the environment can compromise the build" >&2;} -- { { echo "$as_me:1080: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 -+ { { echo "$as_me:1096: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 - echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} - { (exit 1); exit 1; }; } - fi -@@ -1098,10 +1114,10 @@ - echo "#! $SHELL" >conftest.sh - echo "exit 0" >>conftest.sh - chmod +x conftest.sh --if { (echo "$as_me:1101: PATH=\".;.\"; conftest.sh") >&5 -+if { (echo "$as_me:1117: PATH=\".;.\"; conftest.sh") >&5 - (PATH=".;."; conftest.sh) 2>&5 - ac_status=$? -- echo "$as_me:1104: \$? = $ac_status" >&5 -+ echo "$as_me:1120: \$? = $ac_status" >&5 - (exit $ac_status); }; then - ac_path_separator=';' - else -@@ -1114,7 +1130,7 @@ - - top_builddir=`pwd` - --echo "$as_me:1117: checking for egrep" >&5 -+echo "$as_me:1133: checking for egrep" >&5 - echo $ECHO_N "checking for egrep... $ECHO_C" >&6 - if test "${ac_cv_prog_egrep+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -1124,11 +1140,11 @@ - else ac_cv_prog_egrep='egrep' - fi - fi --echo "$as_me:1127: result: $ac_cv_prog_egrep" >&5 -+echo "$as_me:1143: result: $ac_cv_prog_egrep" >&5 - echo "${ECHO_T}$ac_cv_prog_egrep" >&6 - EGREP=$ac_cv_prog_egrep - --test -z "$EGREP" && { { echo "$as_me:1131: error: No egrep program found" >&5 -+test -z "$EGREP" && { { echo "$as_me:1147: error: No egrep program found" >&5 - echo "$as_me: error: No egrep program found" >&2;} - { (exit 1); exit 1; }; } - -@@ -1138,7 +1154,7 @@ - cf_cv_abi_version=${NCURSES_MAJOR} - cf_cv_rel_version=${NCURSES_MAJOR}.${NCURSES_MINOR} - cf_cv_timestamp=`date` --echo "$as_me:1141: result: Configuring NCURSES $cf_cv_rel_version ABI $cf_cv_abi_version ($cf_cv_timestamp)" >&5 -+echo "$as_me:1157: result: Configuring NCURSES $cf_cv_rel_version ABI $cf_cv_abi_version ($cf_cv_timestamp)" >&5 - echo "${ECHO_T}Configuring NCURSES $cf_cv_rel_version ABI $cf_cv_abi_version ($cf_cv_timestamp)" >&6 - - test -z "$cf_cv_rel_version" && cf_cv_rel_version=0.0 -@@ -1146,7 +1162,7 @@ - # Check whether --with-rel-version or --without-rel-version was given. - if test "${with_rel_version+set}" = set; then - withval="$with_rel_version" -- { echo "$as_me:1149: WARNING: overriding release version $cf_cv_rel_version to $withval" >&5 -+ { echo "$as_me:1165: WARNING: overriding release version $cf_cv_rel_version to $withval" >&5 - echo "$as_me: WARNING: overriding release version $cf_cv_rel_version to $withval" >&2;} - cf_cv_rel_version=$withval - fi; -@@ -1159,13 +1175,13 @@ - [0-9]*) #(vi - ;; - *) -- { { echo "$as_me:1162: error: Release major-version is not a number: $NCURSES_MAJOR" >&5 -+ { { echo "$as_me:1178: error: Release major-version is not a number: $NCURSES_MAJOR" >&5 - echo "$as_me: error: Release major-version is not a number: $NCURSES_MAJOR" >&2;} - { (exit 1); exit 1; }; } - ;; - esac - else -- { { echo "$as_me:1168: error: Release major-version value is empty" >&5 -+ { { echo "$as_me:1184: error: Release major-version value is empty" >&5 - echo "$as_me: error: Release major-version value is empty" >&2;} - { (exit 1); exit 1; }; } - fi -@@ -1175,13 +1191,13 @@ - [0-9]*) #(vi - ;; - *) -- { { echo "$as_me:1178: error: Release minor-version is not a number: $NCURSES_MINOR" >&5 -+ { { echo "$as_me:1194: error: Release minor-version is not a number: $NCURSES_MINOR" >&5 - echo "$as_me: error: Release minor-version is not a number: $NCURSES_MINOR" >&2;} - { (exit 1); exit 1; }; } - ;; - esac - else -- { { echo "$as_me:1184: error: Release minor-version value is empty" >&5 -+ { { echo "$as_me:1200: error: Release minor-version value is empty" >&5 - echo "$as_me: error: Release minor-version value is empty" >&2;} - { (exit 1); exit 1; }; } - fi -@@ -1191,7 +1207,7 @@ - # Check whether --with-abi-version or --without-abi-version was given. - if test "${with_abi_version+set}" = set; then - withval="$with_abi_version" -- { echo "$as_me:1194: WARNING: overriding ABI version $cf_cv_abi_version to $withval" >&5 -+ { echo "$as_me:1210: WARNING: overriding ABI version $cf_cv_abi_version to $withval" >&5 - echo "$as_me: WARNING: overriding ABI version $cf_cv_abi_version to $withval" >&2;} - cf_cv_abi_version=$withval - fi; -@@ -1201,13 +1217,13 @@ - [0-9]*) #(vi - ;; - *) -- { { echo "$as_me:1204: error: ABI version is not a number: $cf_cv_abi_version" >&5 -+ { { echo "$as_me:1220: error: ABI version is not a number: $cf_cv_abi_version" >&5 - echo "$as_me: error: ABI version is not a number: $cf_cv_abi_version" >&2;} - { (exit 1); exit 1; }; } - ;; - esac - else -- { { echo "$as_me:1210: error: ABI version value is empty" >&5 -+ { { echo "$as_me:1226: error: ABI version value is empty" >&5 - echo "$as_me: error: ABI version value is empty" >&2;} - { (exit 1); exit 1; }; } - fi -@@ -1229,7 +1245,7 @@ - fi - done - if test -z "$ac_aux_dir"; then -- { { echo "$as_me:1232: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 -+ { { echo "$as_me:1248: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 - echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;} - { (exit 1); exit 1; }; } - fi -@@ -1239,11 +1255,11 @@ - - # Make sure we can run config.sub. - $ac_config_sub sun4 >/dev/null 2>&1 || -- { { echo "$as_me:1242: error: cannot run $ac_config_sub" >&5 -+ { { echo "$as_me:1258: error: cannot run $ac_config_sub" >&5 - echo "$as_me: error: cannot run $ac_config_sub" >&2;} - { (exit 1); exit 1; }; } - --echo "$as_me:1246: checking build system type" >&5 -+echo "$as_me:1262: checking build system type" >&5 - echo $ECHO_N "checking build system type... $ECHO_C" >&6 - if test "${ac_cv_build+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -1252,23 +1268,23 @@ - test -z "$ac_cv_build_alias" && - ac_cv_build_alias=`$ac_config_guess` - test -z "$ac_cv_build_alias" && -- { { echo "$as_me:1255: error: cannot guess build type; you must specify one" >&5 -+ { { echo "$as_me:1271: error: cannot guess build type; you must specify one" >&5 - echo "$as_me: error: cannot guess build type; you must specify one" >&2;} - { (exit 1); exit 1; }; } - ac_cv_build=`$ac_config_sub $ac_cv_build_alias` || -- { { echo "$as_me:1259: error: $ac_config_sub $ac_cv_build_alias failed." >&5 -+ { { echo "$as_me:1275: error: $ac_config_sub $ac_cv_build_alias failed." >&5 - echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed." >&2;} - { (exit 1); exit 1; }; } - - fi --echo "$as_me:1264: result: $ac_cv_build" >&5 -+echo "$as_me:1280: result: $ac_cv_build" >&5 - echo "${ECHO_T}$ac_cv_build" >&6 - build=$ac_cv_build - build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` - build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` - build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` - --echo "$as_me:1271: checking host system type" >&5 -+echo "$as_me:1287: checking host system type" >&5 - echo $ECHO_N "checking host system type... $ECHO_C" >&6 - if test "${ac_cv_host+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -1277,12 +1293,12 @@ - test -z "$ac_cv_host_alias" && - ac_cv_host_alias=$ac_cv_build_alias - ac_cv_host=`$ac_config_sub $ac_cv_host_alias` || -- { { echo "$as_me:1280: error: $ac_config_sub $ac_cv_host_alias failed" >&5 -+ { { echo "$as_me:1296: error: $ac_config_sub $ac_cv_host_alias failed" >&5 - echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;} - { (exit 1); exit 1; }; } - - fi --echo "$as_me:1285: result: $ac_cv_host" >&5 -+echo "$as_me:1301: result: $ac_cv_host" >&5 - echo "${ECHO_T}$ac_cv_host" >&6 - host=$ac_cv_host - host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -@@ -1290,7 +1306,7 @@ - host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` - - if test -f $srcdir/config.guess || test -f $ac_aux_dir/config.guess ; then -- echo "$as_me:1293: checking target system type" >&5 -+ echo "$as_me:1309: checking target system type" >&5 - echo $ECHO_N "checking target system type... $ECHO_C" >&6 - if test "${ac_cv_target+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -1299,12 +1315,12 @@ - test "x$ac_cv_target_alias" = "x" && - ac_cv_target_alias=$ac_cv_host_alias - ac_cv_target=`$ac_config_sub $ac_cv_target_alias` || -- { { echo "$as_me:1302: error: $ac_config_sub $ac_cv_target_alias failed" >&5 -+ { { echo "$as_me:1318: error: $ac_config_sub $ac_cv_target_alias failed" >&5 - echo "$as_me: error: $ac_config_sub $ac_cv_target_alias failed" >&2;} - { (exit 1); exit 1; }; } - - fi --echo "$as_me:1307: result: $ac_cv_target" >&5 -+echo "$as_me:1323: result: $ac_cv_target" >&5 - echo "${ECHO_T}$ac_cv_target" >&6 - target=$ac_cv_target - target_cpu=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -@@ -1324,7 +1340,8 @@ - system_name="`(hostname) 2>/dev/null`" - fi - fi --test -n "$system_name" && cat >>confdefs.h <>confdefs.h <&5 -+test -n "$cf_cv_system_name" && echo "$as_me:1355: result: Configuring for $cf_cv_system_name" >&5 - echo "${ECHO_T}Configuring for $cf_cv_system_name" >&6 - - if test ".$system_name" != ".$cf_cv_system_name" ; then -- echo "$as_me:1342: result: Cached system name ($system_name) does not agree with actual ($cf_cv_system_name)" >&5 -+ echo "$as_me:1359: result: Cached system name ($system_name) does not agree with actual ($cf_cv_system_name)" >&5 - echo "${ECHO_T}Cached system name ($system_name) does not agree with actual ($cf_cv_system_name)" >&6 -- { { echo "$as_me:1344: error: \"Please remove config.cache and try again.\"" >&5 -+ { { echo "$as_me:1361: error: \"Please remove config.cache and try again.\"" >&5 - echo "$as_me: error: \"Please remove config.cache and try again.\"" >&2;} - { (exit 1); exit 1; }; } - fi -@@ -1349,9 +1366,11 @@ - # Check whether --with-system-type or --without-system-type was given. - if test "${with_system_type+set}" = set; then - withval="$with_system_type" -- { echo "$as_me:1352: WARNING: overriding system type to $withval" >&5 -+ { echo "$as_me:1369: WARNING: overriding system type to $withval" >&5 - echo "$as_me: WARNING: overriding system type to $withval" >&2;} -- cf_cv_system_name=$withval -+ cf_cv_system_name=$withval -+ host_os=$withval -+ - fi; - - ### Save the given $CFLAGS to allow user-override. -@@ -1359,23 +1378,23 @@ - - ### Default install-location - --echo "$as_me:1362: checking for prefix" >&5 -+echo "$as_me:1381: checking for prefix" >&5 - echo $ECHO_N "checking for prefix... $ECHO_C" >&6 - if test "x$prefix" = "xNONE" ; then - case "$cf_cv_system_name" in - # non-vendor systems don't have a conflict -- openbsd*|freebsd*|linux*|cygwin*|k*bsd*-gnu) -+ openbsd*|freebsd*|mirbsd*|linux*|cygwin*|msys*|k*bsd*-gnu|mingw*) - prefix=/usr - ;; - *) prefix=$ac_default_prefix - ;; - esac - fi --echo "$as_me:1374: result: $prefix" >&5 -+echo "$as_me:1393: result: $prefix" >&5 - echo "${ECHO_T}$prefix" >&6 - - if test "x$prefix" = "xNONE" ; then --echo "$as_me:1378: checking for default include-directory" >&5 -+echo "$as_me:1397: checking for default include-directory" >&5 - echo $ECHO_N "checking for default include-directory... $ECHO_C" >&6 - test -n "$verbose" && echo 1>&6 - for cf_symbol in \ -@@ -1398,11 +1417,26 @@ - fi - test -n "$verbose" && echo " tested $cf_dir" 1>&6 - done --echo "$as_me:1401: result: $includedir" >&5 -+echo "$as_me:1420: result: $includedir" >&5 - echo "${ECHO_T}$includedir" >&6 - fi - - ### Checks for programs. -+ -+# Check whether --with-ada or --without-ada was given. -+if test "${with_ada+set}" = set; then -+ withval="$with_ada" -+ cf_with_ada=$withval -+else -+ cf_with_ada=yes -+fi; -+if test "x$cf_with_ada" = xyes -+then -+ cf_PROG_CC="gnatgcc gcc cc" -+else -+ cf_PROG_CC="gcc cc" -+fi -+ - ac_ext=c - ac_cpp='$CPP $CPPFLAGS' - ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -@@ -1410,213 +1444,11 @@ - ac_compiler_gnu=$ac_cv_c_compiler_gnu - ac_main_return=return - if test -n "$ac_tool_prefix"; then -- # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. --set dummy ${ac_tool_prefix}gcc; ac_word=$2 --echo "$as_me:1415: checking for $ac_word" >&5 --echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 --if test "${ac_cv_prog_CC+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 --else -- if test -n "$CC"; then -- ac_cv_prog_CC="$CC" # Let the user override the test. --else -- ac_save_IFS=$IFS; IFS=$ac_path_separator --ac_dummy="$PATH" --for ac_dir in $ac_dummy; do -- IFS=$ac_save_IFS -- test -z "$ac_dir" && ac_dir=. -- $as_executable_p "$ac_dir/$ac_word" || continue --ac_cv_prog_CC="${ac_tool_prefix}gcc" --echo "$as_me:1430: found $ac_dir/$ac_word" >&5 --break --done -- --fi --fi --CC=$ac_cv_prog_CC --if test -n "$CC"; then -- echo "$as_me:1438: result: $CC" >&5 --echo "${ECHO_T}$CC" >&6 --else -- echo "$as_me:1441: result: no" >&5 --echo "${ECHO_T}no" >&6 --fi -- --fi --if test -z "$ac_cv_prog_CC"; then -- ac_ct_CC=$CC -- # Extract the first word of "gcc", so it can be a program name with args. --set dummy gcc; ac_word=$2 --echo "$as_me:1450: checking for $ac_word" >&5 --echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 --if test "${ac_cv_prog_ac_ct_CC+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 --else -- if test -n "$ac_ct_CC"; then -- ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. --else -- ac_save_IFS=$IFS; IFS=$ac_path_separator --ac_dummy="$PATH" --for ac_dir in $ac_dummy; do -- IFS=$ac_save_IFS -- test -z "$ac_dir" && ac_dir=. -- $as_executable_p "$ac_dir/$ac_word" || continue --ac_cv_prog_ac_ct_CC="gcc" --echo "$as_me:1465: found $ac_dir/$ac_word" >&5 --break --done -- --fi --fi --ac_ct_CC=$ac_cv_prog_ac_ct_CC --if test -n "$ac_ct_CC"; then -- echo "$as_me:1473: result: $ac_ct_CC" >&5 --echo "${ECHO_T}$ac_ct_CC" >&6 --else -- echo "$as_me:1476: result: no" >&5 --echo "${ECHO_T}no" >&6 --fi -- -- CC=$ac_ct_CC --else -- CC="$ac_cv_prog_CC" --fi -- --if test -z "$CC"; then -- if test -n "$ac_tool_prefix"; then -- # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. --set dummy ${ac_tool_prefix}cc; ac_word=$2 --echo "$as_me:1489: checking for $ac_word" >&5 --echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 --if test "${ac_cv_prog_CC+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 --else -- if test -n "$CC"; then -- ac_cv_prog_CC="$CC" # Let the user override the test. --else -- ac_save_IFS=$IFS; IFS=$ac_path_separator --ac_dummy="$PATH" --for ac_dir in $ac_dummy; do -- IFS=$ac_save_IFS -- test -z "$ac_dir" && ac_dir=. -- $as_executable_p "$ac_dir/$ac_word" || continue --ac_cv_prog_CC="${ac_tool_prefix}cc" --echo "$as_me:1504: found $ac_dir/$ac_word" >&5 --break --done -- --fi --fi --CC=$ac_cv_prog_CC --if test -n "$CC"; then -- echo "$as_me:1512: result: $CC" >&5 --echo "${ECHO_T}$CC" >&6 --else -- echo "$as_me:1515: result: no" >&5 --echo "${ECHO_T}no" >&6 --fi -- --fi --if test -z "$ac_cv_prog_CC"; then -- ac_ct_CC=$CC -- # Extract the first word of "cc", so it can be a program name with args. --set dummy cc; ac_word=$2 --echo "$as_me:1524: checking for $ac_word" >&5 --echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 --if test "${ac_cv_prog_ac_ct_CC+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 --else -- if test -n "$ac_ct_CC"; then -- ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. --else -- ac_save_IFS=$IFS; IFS=$ac_path_separator --ac_dummy="$PATH" --for ac_dir in $ac_dummy; do -- IFS=$ac_save_IFS -- test -z "$ac_dir" && ac_dir=. -- $as_executable_p "$ac_dir/$ac_word" || continue --ac_cv_prog_ac_ct_CC="cc" --echo "$as_me:1539: found $ac_dir/$ac_word" >&5 --break --done -- --fi --fi --ac_ct_CC=$ac_cv_prog_ac_ct_CC --if test -n "$ac_ct_CC"; then -- echo "$as_me:1547: result: $ac_ct_CC" >&5 --echo "${ECHO_T}$ac_ct_CC" >&6 --else -- echo "$as_me:1550: result: no" >&5 --echo "${ECHO_T}no" >&6 --fi -- -- CC=$ac_ct_CC --else -- CC="$ac_cv_prog_CC" --fi -- --fi --if test -z "$CC"; then -- # Extract the first word of "cc", so it can be a program name with args. --set dummy cc; ac_word=$2 --echo "$as_me:1563: checking for $ac_word" >&5 --echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 --if test "${ac_cv_prog_CC+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 --else -- if test -n "$CC"; then -- ac_cv_prog_CC="$CC" # Let the user override the test. --else -- ac_prog_rejected=no -- ac_save_IFS=$IFS; IFS=$ac_path_separator --ac_dummy="$PATH" --for ac_dir in $ac_dummy; do -- IFS=$ac_save_IFS -- test -z "$ac_dir" && ac_dir=. -- $as_executable_p "$ac_dir/$ac_word" || continue --if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then -- ac_prog_rejected=yes -- continue --fi --ac_cv_prog_CC="cc" --echo "$as_me:1583: found $ac_dir/$ac_word" >&5 --break --done -- --if test $ac_prog_rejected = yes; then -- # We found a bogon in the path, so make sure we never use it. -- set dummy $ac_cv_prog_CC -- shift -- if test $# != 0; then -- # We chose a different compiler from the bogus one. -- # However, it has the same basename, so the bogon will be chosen -- # first if we set CC to just the basename; use the full file name. -- shift -- set dummy "$ac_dir/$ac_word" ${1+"$@"} -- shift -- ac_cv_prog_CC="$@" -- fi --fi --fi --fi --CC=$ac_cv_prog_CC --if test -n "$CC"; then -- echo "$as_me:1605: result: $CC" >&5 --echo "${ECHO_T}$CC" >&6 --else -- echo "$as_me:1608: result: no" >&5 --echo "${ECHO_T}no" >&6 --fi -- --fi --if test -z "$CC"; then -- if test -n "$ac_tool_prefix"; then -- for ac_prog in cl -+ for ac_prog in $cf_PROG_CC - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. - set dummy $ac_tool_prefix$ac_prog; ac_word=$2 --echo "$as_me:1619: checking for $ac_word" >&5 -+echo "$as_me:1451: checking for $ac_word" >&5 - echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 - if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -1631,7 +1463,7 @@ - test -z "$ac_dir" && ac_dir=. - $as_executable_p "$ac_dir/$ac_word" || continue - ac_cv_prog_CC="$ac_tool_prefix$ac_prog" --echo "$as_me:1634: found $ac_dir/$ac_word" >&5 -+echo "$as_me:1466: found $ac_dir/$ac_word" >&5 - break - done - -@@ -1639,10 +1471,10 @@ - fi - CC=$ac_cv_prog_CC - if test -n "$CC"; then -- echo "$as_me:1642: result: $CC" >&5 -+ echo "$as_me:1474: result: $CC" >&5 - echo "${ECHO_T}$CC" >&6 - else -- echo "$as_me:1645: result: no" >&5 -+ echo "$as_me:1477: result: no" >&5 - echo "${ECHO_T}no" >&6 - fi - -@@ -1651,11 +1483,11 @@ - fi - if test -z "$CC"; then - ac_ct_CC=$CC -- for ac_prog in cl -+ for ac_prog in $cf_PROG_CC - do - # Extract the first word of "$ac_prog", so it can be a program name with args. - set dummy $ac_prog; ac_word=$2 --echo "$as_me:1658: checking for $ac_word" >&5 -+echo "$as_me:1490: checking for $ac_word" >&5 - echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 - if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -1670,7 +1502,7 @@ - test -z "$ac_dir" && ac_dir=. - $as_executable_p "$ac_dir/$ac_word" || continue - ac_cv_prog_ac_ct_CC="$ac_prog" --echo "$as_me:1673: found $ac_dir/$ac_word" >&5 -+echo "$as_me:1505: found $ac_dir/$ac_word" >&5 - break - done - -@@ -1678,10 +1510,10 @@ - fi - ac_ct_CC=$ac_cv_prog_ac_ct_CC - if test -n "$ac_ct_CC"; then -- echo "$as_me:1681: result: $ac_ct_CC" >&5 -+ echo "$as_me:1513: result: $ac_ct_CC" >&5 - echo "${ECHO_T}$ac_ct_CC" >&6 - else -- echo "$as_me:1684: result: no" >&5 -+ echo "$as_me:1516: result: no" >&5 - echo "${ECHO_T}no" >&6 - fi - -@@ -1691,34 +1523,32 @@ - CC=$ac_ct_CC - fi - --fi -- --test -z "$CC" && { { echo "$as_me:1696: error: no acceptable cc found in \$PATH" >&5 -+test -z "$CC" && { { echo "$as_me:1526: error: no acceptable cc found in \$PATH" >&5 - echo "$as_me: error: no acceptable cc found in \$PATH" >&2;} - { (exit 1); exit 1; }; } - - # Provide some information about the compiler. --echo "$as_me:1701:" \ -+echo "$as_me:1531:" \ - "checking for C compiler version" >&5 - ac_compiler=`set X $ac_compile; echo $2` --{ (eval echo "$as_me:1704: \"$ac_compiler --version &5\"") >&5 -+{ (eval echo "$as_me:1534: \"$ac_compiler --version &5\"") >&5 - (eval $ac_compiler --version &5) 2>&5 - ac_status=$? -- echo "$as_me:1707: \$? = $ac_status" >&5 -+ echo "$as_me:1537: \$? = $ac_status" >&5 - (exit $ac_status); } --{ (eval echo "$as_me:1709: \"$ac_compiler -v &5\"") >&5 -+{ (eval echo "$as_me:1539: \"$ac_compiler -v &5\"") >&5 - (eval $ac_compiler -v &5) 2>&5 - ac_status=$? -- echo "$as_me:1712: \$? = $ac_status" >&5 -+ echo "$as_me:1542: \$? = $ac_status" >&5 - (exit $ac_status); } --{ (eval echo "$as_me:1714: \"$ac_compiler -V &5\"") >&5 -+{ (eval echo "$as_me:1544: \"$ac_compiler -V &5\"") >&5 - (eval $ac_compiler -V &5) 2>&5 - ac_status=$? -- echo "$as_me:1717: \$? = $ac_status" >&5 -+ echo "$as_me:1547: \$? = $ac_status" >&5 - (exit $ac_status); } - - cat >conftest.$ac_ext <<_ACEOF --#line 1721 "configure" -+#line 1551 "configure" - #include "confdefs.h" - - int -@@ -1734,13 +1564,13 @@ - # Try to create an executable without -o first, disregard a.out. - # It will help us diagnose broken compilers, and finding out an intuition - # of exeext. --echo "$as_me:1737: checking for C compiler default output" >&5 -+echo "$as_me:1567: checking for C compiler default output" >&5 - echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6 - ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` --if { (eval echo "$as_me:1740: \"$ac_link_default\"") >&5 -+if { (eval echo "$as_me:1570: \"$ac_link_default\"") >&5 - (eval $ac_link_default) 2>&5 - ac_status=$? -- echo "$as_me:1743: \$? = $ac_status" >&5 -+ echo "$as_me:1573: \$? = $ac_status" >&5 - (exit $ac_status); }; then - # Find the output, starting from the most likely. This scheme is - # not robust to junk in `.', hence go to wildcards (a.*) only as a last -@@ -1763,34 +1593,34 @@ - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --{ { echo "$as_me:1766: error: C compiler cannot create executables" >&5 -+{ { echo "$as_me:1596: error: C compiler cannot create executables" >&5 - echo "$as_me: error: C compiler cannot create executables" >&2;} - { (exit 77); exit 77; }; } - fi - - ac_exeext=$ac_cv_exeext --echo "$as_me:1772: result: $ac_file" >&5 -+echo "$as_me:1602: result: $ac_file" >&5 - echo "${ECHO_T}$ac_file" >&6 - - # Check the compiler produces executables we can run. If not, either - # the compiler is broken, or we cross compile. --echo "$as_me:1777: checking whether the C compiler works" >&5 -+echo "$as_me:1607: checking whether the C compiler works" >&5 - echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 - # FIXME: These cross compiler hacks should be removed for Autoconf 3.0 - # If not cross compiling, check that we can run a simple program. - if test "$cross_compiling" != yes; then - if { ac_try='./$ac_file' -- { (eval echo "$as_me:1783: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:1613: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:1786: \$? = $ac_status" >&5 -+ echo "$as_me:1616: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cross_compiling=no - else - if test "$cross_compiling" = maybe; then - cross_compiling=yes - else -- { { echo "$as_me:1793: error: cannot run C compiled programs. -+ { { echo "$as_me:1623: error: cannot run C compiled programs. - If you meant to cross compile, use \`--host'." >&5 - echo "$as_me: error: cannot run C compiled programs. - If you meant to cross compile, use \`--host'." >&2;} -@@ -1798,24 +1628,24 @@ - fi - fi - fi --echo "$as_me:1801: result: yes" >&5 -+echo "$as_me:1631: result: yes" >&5 - echo "${ECHO_T}yes" >&6 - - rm -f a.out a.exe conftest$ac_cv_exeext - ac_clean_files=$ac_clean_files_save - # Check the compiler produces executables we can run. If not, either - # the compiler is broken, or we cross compile. --echo "$as_me:1808: checking whether we are cross compiling" >&5 -+echo "$as_me:1638: checking whether we are cross compiling" >&5 - echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 --echo "$as_me:1810: result: $cross_compiling" >&5 -+echo "$as_me:1640: result: $cross_compiling" >&5 - echo "${ECHO_T}$cross_compiling" >&6 - --echo "$as_me:1813: checking for executable suffix" >&5 -+echo "$as_me:1643: checking for executable suffix" >&5 - echo $ECHO_N "checking for executable suffix... $ECHO_C" >&6 --if { (eval echo "$as_me:1815: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:1645: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:1818: \$? = $ac_status" >&5 -+ echo "$as_me:1648: \$? = $ac_status" >&5 - (exit $ac_status); }; then - # If both `conftest.exe' and `conftest' are `present' (well, observable) - # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will -@@ -1831,25 +1661,25 @@ - esac - done - else -- { { echo "$as_me:1834: error: cannot compute EXEEXT: cannot compile and link" >&5 -+ { { echo "$as_me:1664: error: cannot compute EXEEXT: cannot compile and link" >&5 - echo "$as_me: error: cannot compute EXEEXT: cannot compile and link" >&2;} - { (exit 1); exit 1; }; } - fi - - rm -f conftest$ac_cv_exeext --echo "$as_me:1840: result: $ac_cv_exeext" >&5 -+echo "$as_me:1670: result: $ac_cv_exeext" >&5 - echo "${ECHO_T}$ac_cv_exeext" >&6 - - rm -f conftest.$ac_ext - EXEEXT=$ac_cv_exeext - ac_exeext=$EXEEXT --echo "$as_me:1846: checking for object suffix" >&5 -+echo "$as_me:1676: checking for object suffix" >&5 - echo $ECHO_N "checking for object suffix... $ECHO_C" >&6 - if test "${ac_cv_objext+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - cat >conftest.$ac_ext <<_ACEOF --#line 1852 "configure" -+#line 1682 "configure" - #include "confdefs.h" - - int -@@ -1861,10 +1691,10 @@ - } - _ACEOF - rm -f conftest.o conftest.obj --if { (eval echo "$as_me:1864: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:1694: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:1867: \$? = $ac_status" >&5 -+ echo "$as_me:1697: \$? = $ac_status" >&5 - (exit $ac_status); }; then - for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do - case $ac_file in -@@ -1876,24 +1706,24 @@ - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --{ { echo "$as_me:1879: error: cannot compute OBJEXT: cannot compile" >&5 -+{ { echo "$as_me:1709: error: cannot compute OBJEXT: cannot compile" >&5 - echo "$as_me: error: cannot compute OBJEXT: cannot compile" >&2;} - { (exit 1); exit 1; }; } - fi - - rm -f conftest.$ac_cv_objext conftest.$ac_ext - fi --echo "$as_me:1886: result: $ac_cv_objext" >&5 -+echo "$as_me:1716: result: $ac_cv_objext" >&5 - echo "${ECHO_T}$ac_cv_objext" >&6 - OBJEXT=$ac_cv_objext - ac_objext=$OBJEXT --echo "$as_me:1890: checking whether we are using the GNU C compiler" >&5 -+echo "$as_me:1720: checking whether we are using the GNU C compiler" >&5 - echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 - if test "${ac_cv_c_compiler_gnu+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - cat >conftest.$ac_ext <<_ACEOF --#line 1896 "configure" -+#line 1726 "configure" - #include "confdefs.h" - - int -@@ -1908,16 +1738,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:1911: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:1741: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:1914: \$? = $ac_status" >&5 -+ echo "$as_me:1744: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:1917: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:1747: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:1920: \$? = $ac_status" >&5 -+ echo "$as_me:1750: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_compiler_gnu=yes - else -@@ -1929,19 +1759,19 @@ - ac_cv_c_compiler_gnu=$ac_compiler_gnu - - fi --echo "$as_me:1932: result: $ac_cv_c_compiler_gnu" >&5 -+echo "$as_me:1762: result: $ac_cv_c_compiler_gnu" >&5 - echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 - GCC=`test $ac_compiler_gnu = yes && echo yes` - ac_test_CFLAGS=${CFLAGS+set} - ac_save_CFLAGS=$CFLAGS - CFLAGS="-g" --echo "$as_me:1938: checking whether $CC accepts -g" >&5 -+echo "$as_me:1768: checking whether $CC accepts -g" >&5 - echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 - if test "${ac_cv_prog_cc_g+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - cat >conftest.$ac_ext <<_ACEOF --#line 1944 "configure" -+#line 1774 "configure" - #include "confdefs.h" - - int -@@ -1953,16 +1783,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:1956: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:1786: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:1959: \$? = $ac_status" >&5 -+ echo "$as_me:1789: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:1962: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:1792: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:1965: \$? = $ac_status" >&5 -+ echo "$as_me:1795: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_prog_cc_g=yes - else -@@ -1972,7 +1802,7 @@ - fi - rm -f conftest.$ac_objext conftest.$ac_ext - fi --echo "$as_me:1975: result: $ac_cv_prog_cc_g" >&5 -+echo "$as_me:1805: result: $ac_cv_prog_cc_g" >&5 - echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 - if test "$ac_test_CFLAGS" = set; then - CFLAGS=$ac_save_CFLAGS -@@ -1999,16 +1829,16 @@ - #endif - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:2002: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:1832: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:2005: \$? = $ac_status" >&5 -+ echo "$as_me:1835: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:2008: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:1838: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:2011: \$? = $ac_status" >&5 -+ echo "$as_me:1841: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - for ac_declaration in \ - ''\ -@@ -2020,7 +1850,7 @@ - 'void exit (int);' - do - cat >conftest.$ac_ext <<_ACEOF --#line 2023 "configure" -+#line 1853 "configure" - #include "confdefs.h" - #include - $ac_declaration -@@ -2033,16 +1863,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:2036: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:1866: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:2039: \$? = $ac_status" >&5 -+ echo "$as_me:1869: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:2042: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:1872: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:2045: \$? = $ac_status" >&5 -+ echo "$as_me:1875: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : - else -@@ -2052,7 +1882,7 @@ - fi - rm -f conftest.$ac_objext conftest.$ac_ext - cat >conftest.$ac_ext <<_ACEOF --#line 2055 "configure" -+#line 1885 "configure" - #include "confdefs.h" - $ac_declaration - int -@@ -2064,16 +1894,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:2067: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:1897: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:2070: \$? = $ac_status" >&5 -+ echo "$as_me:1900: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:2073: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:1903: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:2076: \$? = $ac_status" >&5 -+ echo "$as_me:1906: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - break - else -@@ -2103,60 +1933,251 @@ - - GCC_VERSION=none - if test "$GCC" = yes ; then -- echo "$as_me:2106: checking version of $CC" >&5 -+ echo "$as_me:1936: checking version of $CC" >&5 - echo $ECHO_N "checking version of $CC... $ECHO_C" >&6 -- GCC_VERSION="`${CC} --version 2>/dev/null | sed -e '2,$d' -e 's/^.*(GCC) //' -e 's/^[^0-9.]*//' -e 's/[^0-9.].*//'`" -+ GCC_VERSION="`${CC} --version 2>/dev/null | sed -e '2,$d' -e 's/^.*(GCC[^)]*) //' -e 's/^.*(Debian[^)]*) //' -e 's/^[^0-9.]*//' -e 's/[^0-9.].*//'`" - test -z "$GCC_VERSION" && GCC_VERSION=unknown -- echo "$as_me:2110: result: $GCC_VERSION" >&5 -+ echo "$as_me:1940: result: $GCC_VERSION" >&5 - echo "${ECHO_T}$GCC_VERSION" >&6 - fi - --ac_ext=c --ac_cpp='$CPP $CPPFLAGS' --ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' --ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' --ac_compiler_gnu=$ac_cv_c_compiler_gnu --ac_main_return=return --echo "$as_me:2120: checking how to run the C preprocessor" >&5 --echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 --# On Suns, sometimes $CPP names a directory. --if test -n "$CPP" && test -d "$CPP"; then -- CPP= --fi --if test -z "$CPP"; then -- if test "${ac_cv_prog_CPP+set}" = set; then -+echo "$as_me:1944: checking for $CC option to accept ANSI C" >&5 -+echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 -+if test "${ac_cv_prog_cc_stdc+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else -- # Double quotes because CPP needs to be expanded -- for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" -- do -- ac_preproc_ok=false --for ac_c_preproc_warn_flag in '' yes --do -- # Use a header file that comes with gcc, so configuring glibc -- # with a fresh cross-compiler works. -- # On the NeXT, cc -E runs the code through the compiler's parser, -- # not just through cpp. "Syntax error" is here to catch this case. -- cat >conftest.$ac_ext <<_ACEOF --#line 2141 "configure" -+ ac_cv_prog_cc_stdc=no -+ac_save_CC=$CC -+cat >conftest.$ac_ext <<_ACEOF -+#line 1952 "configure" - #include "confdefs.h" --#include -- Syntax error -+#include -+#include -+#include -+#include -+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ -+struct buf { int x; }; -+FILE * (*rcsopen) (struct buf *, struct stat *, int); -+static char *e (p, i) -+ char **p; -+ int i; -+{ -+ return p[i]; -+} -+static char *f (char * (*g) (char **, int), char **p, ...) -+{ -+ char *s; -+ va_list v; -+ va_start (v,p); -+ s = g (p, va_arg (v,int)); -+ va_end (v); -+ return s; -+} -+int test (int i, double x); -+struct s1 {int (*f) (int a);}; -+struct s2 {int (*f) (double a);}; -+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); -+int argc; -+char **argv; -+int -+main () -+{ -+return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; -+ ; -+ return 0; -+} - _ACEOF --if { (eval echo "$as_me:2146: \"$ac_cpp conftest.$ac_ext\"") >&5 -- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 -+# Don't try gcc -ansi; that turns off useful extensions and -+# breaks some systems' header files. -+# AIX -qlanglvl=ansi -+# Ultrix and OSF/1 -std1 -+# HP-UX 10.20 and later -Ae -+# HP-UX older versions -Aa -D_HPUX_SOURCE -+# SVR4 -Xc -D__EXTENSIONS__ -+for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" -+do -+ CC="$ac_save_CC $ac_arg" -+ rm -f conftest.$ac_objext -+if { (eval echo "$as_me:2001: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>&5 - ac_status=$? -- egrep -v '^ *\+' conftest.er1 >conftest.err -- rm -f conftest.er1 -- cat conftest.err >&5 -- echo "$as_me:2152: \$? = $ac_status" >&5 -- (exit $ac_status); } >/dev/null; then -- if test -s conftest.err; then -- ac_cpp_err=$ac_c_preproc_warn_flag -- else -- ac_cpp_err= -- fi --else -+ echo "$as_me:2004: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:2007: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:2010: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ ac_cv_prog_cc_stdc=$ac_arg -+break -+else -+ echo "$as_me: failed program was:" >&5 -+cat conftest.$ac_ext >&5 -+fi -+rm -f conftest.$ac_objext -+done -+rm -f conftest.$ac_ext conftest.$ac_objext -+CC=$ac_save_CC -+ -+fi -+ -+case "x$ac_cv_prog_cc_stdc" in -+ x|xno) -+ echo "$as_me:2027: result: none needed" >&5 -+echo "${ECHO_T}none needed" >&6 ;; -+ *) -+ echo "$as_me:2030: result: $ac_cv_prog_cc_stdc" >&5 -+echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 -+ CC="$CC $ac_cv_prog_cc_stdc" ;; -+esac -+ -+# This should have been defined by AC_PROG_CC -+: ${CC:=cc} -+ -+echo "$as_me:2038: checking \$CC variable" >&5 -+echo $ECHO_N "checking \$CC variable... $ECHO_C" >&6 -+case "$CC" in #(vi -+*[\ \ ]-[IUD]*) -+ echo "$as_me:2042: result: broken" >&5 -+echo "${ECHO_T}broken" >&6 -+ { echo "$as_me:2044: WARNING: your environment misuses the CC variable to hold CFLAGS/CPPFLAGS options" >&5 -+echo "$as_me: WARNING: your environment misuses the CC variable to hold CFLAGS/CPPFLAGS options" >&2;} -+ # humor him... -+ cf_flags=`echo "$CC" | sed -e 's/^[^ ]*[ ]//'` -+ CC=`echo "$CC" | sed -e 's/[ ].*//'` -+ -+cf_fix_cppflags=no -+cf_new_cflags= -+cf_new_cppflags= -+cf_new_extra_cppflags= -+ -+for cf_add_cflags in $cf_flags -+do -+case $cf_fix_cppflags in -+no) -+ case $cf_add_cflags in #(vi -+ -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi -+ case $cf_add_cflags in -+ -D*) -+ cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` -+ -+ test "${cf_add_cflags}" != "${cf_tst_cflags}" \ -+ && test -z "${cf_tst_cflags}" \ -+ && cf_fix_cppflags=yes -+ -+ if test $cf_fix_cppflags = yes ; then -+ cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -+ continue -+ elif test "${cf_tst_cflags}" = "\"'" ; then -+ cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -+ continue -+ fi -+ ;; -+ esac -+ case "$CPPFLAGS" in -+ *$cf_add_cflags) #(vi -+ ;; -+ *) #(vi -+ case $cf_add_cflags in #(vi -+ -D*) -+ cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` -+ -+CPPFLAGS=`echo "$CPPFLAGS" | \ -+ sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ -+ -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` -+ -+ ;; -+ esac -+ cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" -+ ;; -+ esac -+ ;; -+ *) -+ cf_new_cflags="$cf_new_cflags $cf_add_cflags" -+ ;; -+ esac -+ ;; -+yes) -+ cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -+ -+ cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` -+ -+ test "${cf_add_cflags}" != "${cf_tst_cflags}" \ -+ && test -z "${cf_tst_cflags}" \ -+ && cf_fix_cppflags=no -+ ;; -+esac -+done -+ -+if test -n "$cf_new_cflags" ; then -+ -+ CFLAGS="$CFLAGS $cf_new_cflags" -+fi -+ -+if test -n "$cf_new_cppflags" ; then -+ -+ CPPFLAGS="$CPPFLAGS $cf_new_cppflags" -+fi -+ -+if test -n "$cf_new_extra_cppflags" ; then -+ -+ EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" -+fi -+ -+ ;; -+*) -+ echo "$as_me:2130: result: ok" >&5 -+echo "${ECHO_T}ok" >&6 -+ ;; -+esac -+ -+ac_ext=c -+ac_cpp='$CPP $CPPFLAGS' -+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -+ac_compiler_gnu=$ac_cv_c_compiler_gnu -+ac_main_return=return -+echo "$as_me:2141: checking how to run the C preprocessor" >&5 -+echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 -+# On Suns, sometimes $CPP names a directory. -+if test -n "$CPP" && test -d "$CPP"; then -+ CPP= -+fi -+if test -z "$CPP"; then -+ if test "${ac_cv_prog_CPP+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ # Double quotes because CPP needs to be expanded -+ for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" -+ do -+ ac_preproc_ok=false -+for ac_c_preproc_warn_flag in '' yes -+do -+ # Use a header file that comes with gcc, so configuring glibc -+ # with a fresh cross-compiler works. -+ # On the NeXT, cc -E runs the code through the compiler's parser, -+ # not just through cpp. "Syntax error" is here to catch this case. -+ cat >conftest.$ac_ext <<_ACEOF -+#line 2162 "configure" -+#include "confdefs.h" -+#include -+ Syntax error -+_ACEOF -+if { (eval echo "$as_me:2167: \"$ac_cpp conftest.$ac_ext\"") >&5 -+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 -+ ac_status=$? -+ egrep -v '^ *\+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 -+ echo "$as_me:2173: \$? = $ac_status" >&5 -+ (exit $ac_status); } >/dev/null; then -+ if test -s conftest.err; then -+ ac_cpp_err=$ac_c_preproc_warn_flag -+ else -+ ac_cpp_err= -+ fi -+else - ac_cpp_err=yes - fi - if test -z "$ac_cpp_err"; then -@@ -2172,17 +2193,17 @@ - # OK, works on sane cases. Now check whether non-existent headers - # can be detected and how. - cat >conftest.$ac_ext <<_ACEOF --#line 2175 "configure" -+#line 2196 "configure" - #include "confdefs.h" - #include - _ACEOF --if { (eval echo "$as_me:2179: \"$ac_cpp conftest.$ac_ext\"") >&5 -+if { (eval echo "$as_me:2200: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 -- echo "$as_me:2185: \$? = $ac_status" >&5 -+ echo "$as_me:2206: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag -@@ -2219,7 +2240,7 @@ - else - ac_cv_prog_CPP=$CPP - fi --echo "$as_me:2222: result: $CPP" >&5 -+echo "$as_me:2243: result: $CPP" >&5 - echo "${ECHO_T}$CPP" >&6 - ac_preproc_ok=false - for ac_c_preproc_warn_flag in '' yes -@@ -2229,18 +2250,18 @@ - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat >conftest.$ac_ext <<_ACEOF --#line 2232 "configure" -+#line 2253 "configure" - #include "confdefs.h" - #include - Syntax error - _ACEOF --if { (eval echo "$as_me:2237: \"$ac_cpp conftest.$ac_ext\"") >&5 -+if { (eval echo "$as_me:2258: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 -- echo "$as_me:2243: \$? = $ac_status" >&5 -+ echo "$as_me:2264: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag -@@ -2263,17 +2284,17 @@ - # OK, works on sane cases. Now check whether non-existent headers - # can be detected and how. - cat >conftest.$ac_ext <<_ACEOF --#line 2266 "configure" -+#line 2287 "configure" - #include "confdefs.h" - #include - _ACEOF --if { (eval echo "$as_me:2270: \"$ac_cpp conftest.$ac_ext\"") >&5 -+if { (eval echo "$as_me:2291: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 -- echo "$as_me:2276: \$? = $ac_status" >&5 -+ echo "$as_me:2297: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag -@@ -2301,7 +2322,7 @@ - if $ac_preproc_ok; then - : - else -- { { echo "$as_me:2304: error: C preprocessor \"$CPP\" fails sanity check" >&5 -+ { { echo "$as_me:2325: error: C preprocessor \"$CPP\" fails sanity check" >&5 - echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check" >&2;} - { (exit 1); exit 1; }; } - fi -@@ -2314,14 +2335,14 @@ - ac_main_return=return - - if test $ac_cv_c_compiler_gnu = yes; then -- echo "$as_me:2317: checking whether $CC needs -traditional" >&5 -+ echo "$as_me:2338: checking whether $CC needs -traditional" >&5 - echo $ECHO_N "checking whether $CC needs -traditional... $ECHO_C" >&6 - if test "${ac_cv_prog_gcc_traditional+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - ac_pattern="Autoconf.*'x'" - cat >conftest.$ac_ext <<_ACEOF --#line 2324 "configure" -+#line 2345 "configure" - #include "confdefs.h" - #include - int Autoconf = TIOCGETP; -@@ -2336,7 +2357,7 @@ - - if test $ac_cv_prog_gcc_traditional = no; then - cat >conftest.$ac_ext <<_ACEOF --#line 2339 "configure" -+#line 2360 "configure" - #include "confdefs.h" - #include - int Autoconf = TCGETA; -@@ -2349,14 +2370,14 @@ - - fi - fi --echo "$as_me:2352: result: $ac_cv_prog_gcc_traditional" >&5 -+echo "$as_me:2373: result: $ac_cv_prog_gcc_traditional" >&5 - echo "${ECHO_T}$ac_cv_prog_gcc_traditional" >&6 - if test $ac_cv_prog_gcc_traditional = yes; then - CC="$CC -traditional" - fi - fi - --echo "$as_me:2359: checking whether $CC understands -c and -o together" >&5 -+echo "$as_me:2380: checking whether $CC understands -c and -o together" >&5 - echo $ECHO_N "checking whether $CC understands -c and -o together... $ECHO_C" >&6 - if test "${cf_cv_prog_CC_c_o+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -2372,15 +2393,15 @@ - # We do the test twice because some compilers refuse to overwrite an - # existing .o file with -o, though they will create one. - ac_try='$CC -c conftest.$ac_ext -o conftest2.$ac_objext >&5' --if { (eval echo "$as_me:2375: \"$ac_try\"") >&5 -+if { (eval echo "$as_me:2396: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:2378: \$? = $ac_status" >&5 -+ echo "$as_me:2399: \$? = $ac_status" >&5 - (exit $ac_status); } && -- test -f conftest2.$ac_objext && { (eval echo "$as_me:2380: \"$ac_try\"") >&5 -+ test -f conftest2.$ac_objext && { (eval echo "$as_me:2401: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:2383: \$? = $ac_status" >&5 -+ echo "$as_me:2404: \$? = $ac_status" >&5 - (exit $ac_status); }; - then - eval cf_cv_prog_CC_c_o=yes -@@ -2391,581 +2412,287 @@ - - fi - if test $cf_cv_prog_CC_c_o = yes; then -- echo "$as_me:2394: result: yes" >&5 -+ echo "$as_me:2415: result: yes" >&5 - echo "${ECHO_T}yes" >&6 - else -- echo "$as_me:2397: result: no" >&5 -+ echo "$as_me:2418: result: no" >&5 - echo "${ECHO_T}no" >&6 - fi - --echo "$as_me:2401: checking for POSIXized ISC" >&5 --echo $ECHO_N "checking for POSIXized ISC... $ECHO_C" >&6 --if test -d /etc/conf/kconfig.d && -- grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1 --then -- echo "$as_me:2406: result: yes" >&5 --echo "${ECHO_T}yes" >&6 -- ISC=yes # If later tests want to check for ISC. -+if test "$cross_compiling" = yes ; then -+ LDCONFIG=: -+else -+case "$cf_cv_system_name" in #(vi -+dragonfly*|mirbsd*|freebsd*) #(vi -+ test -z "$LDCONFIG" && LDCONFIG="/sbin/ldconfig -R" -+ ;; -+*) LDPATH=$PATH:/sbin:/usr/sbin -+ # Extract the first word of "ldconfig", so it can be a program name with args. -+set dummy ldconfig; ac_word=$2 -+echo "$as_me:2432: checking for $ac_word" >&5 -+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -+if test "${ac_cv_path_LDCONFIG+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ case $LDCONFIG in -+ [\\/]* | ?:[\\/]*) -+ ac_cv_path_LDCONFIG="$LDCONFIG" # Let the user override the test with a path. -+ ;; -+ *) -+ ac_save_IFS=$IFS; IFS=$ac_path_separator -+ac_dummy="$LDPATH" -+for ac_dir in $ac_dummy; do -+ IFS=$ac_save_IFS -+ test -z "$ac_dir" && ac_dir=. -+ if $as_executable_p "$ac_dir/$ac_word"; then -+ ac_cv_path_LDCONFIG="$ac_dir/$ac_word" -+ echo "$as_me:2449: found $ac_dir/$ac_word" >&5 -+ break -+fi -+done - --cat >>confdefs.h <<\EOF --#define _POSIX_SOURCE 1 --EOF -+ ;; -+esac -+fi -+LDCONFIG=$ac_cv_path_LDCONFIG - -- if test "$GCC" = yes; then -- CC="$CC -posix" -- else -- CC="$CC -Xp" -- fi -+if test -n "$LDCONFIG"; then -+ echo "$as_me:2460: result: $LDCONFIG" >&5 -+echo "${ECHO_T}$LDCONFIG" >&6 - else -- echo "$as_me:2420: result: no" >&5 -+ echo "$as_me:2463: result: no" >&5 - echo "${ECHO_T}no" >&6 -- ISC= - fi - --echo "$as_me:2425: checking for ${CC:-cc} option to accept ANSI C" >&5 --echo $ECHO_N "checking for ${CC:-cc} option to accept ANSI C... $ECHO_C" >&6 --if test "${cf_cv_ansi_cc+set}" = set; then -+ ;; -+esac -+fi -+ -+echo "$as_me:2471: checking if you want to ensure bool is consistent with C++" >&5 -+echo $ECHO_N "checking if you want to ensure bool is consistent with C++... $ECHO_C" >&6 -+ -+# Check whether --with-cxx or --without-cxx was given. -+if test "${with_cxx+set}" = set; then -+ withval="$with_cxx" -+ cf_with_cxx=$withval -+else -+ cf_with_cxx=yes -+fi; -+echo "$as_me:2481: result: $cf_with_cxx" >&5 -+echo "${ECHO_T}$cf_with_cxx" >&6 -+if test "X$cf_with_cxx" = Xno ; then -+ CXX="" -+ GXX="" -+else -+ # with autoconf 2.13, we can change the error to a warning: -+ ac_ext=cc -+ac_cpp='$CXXCPP $CPPFLAGS' -+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu -+ac_main_return=return -+if test -n "$ac_tool_prefix"; then -+ for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC -+ do -+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -+set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -+echo "$as_me:2499: checking for $ac_word" >&5 -+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -+if test "${ac_cv_prog_CXX+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else -+ if test -n "$CXX"; then -+ ac_cv_prog_CXX="$CXX" # Let the user override the test. -+else -+ ac_save_IFS=$IFS; IFS=$ac_path_separator -+ac_dummy="$PATH" -+for ac_dir in $ac_dummy; do -+ IFS=$ac_save_IFS -+ test -z "$ac_dir" && ac_dir=. -+ $as_executable_p "$ac_dir/$ac_word" || continue -+ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" -+echo "$as_me:2514: found $ac_dir/$ac_word" >&5 -+break -+done - --cf_cv_ansi_cc=no --cf_save_CFLAGS="$CFLAGS" --cf_save_CPPFLAGS="$CPPFLAGS" --# Don't try gcc -ansi; that turns off useful extensions and --# breaks some systems' header files. --# AIX -qlanglvl=ansi --# Ultrix and OSF/1 -std1 --# HP-UX -Aa -D_HPUX_SOURCE --# SVR4 -Xc --# UnixWare 1.2 (cannot use -Xc, since ANSI/POSIX clashes) --for cf_arg in "-DCC_HAS_PROTOS" \ -- "" \ -- -qlanglvl=ansi \ -- -std1 \ -- -Ae \ -- "-Aa -D_HPUX_SOURCE" \ -- -Xc --do -+fi -+fi -+CXX=$ac_cv_prog_CXX -+if test -n "$CXX"; then -+ echo "$as_me:2522: result: $CXX" >&5 -+echo "${ECHO_T}$CXX" >&6 -+else -+ echo "$as_me:2525: result: no" >&5 -+echo "${ECHO_T}no" >&6 -+fi - --cf_fix_cppflags=no --cf_new_cflags= --cf_new_cppflags= --cf_new_extra_cppflags= -- --for cf_add_cflags in $cf_arg -+ test -n "$CXX" && break -+ done -+fi -+if test -z "$CXX"; then -+ ac_ct_CXX=$CXX -+ for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC - do --case $cf_fix_cppflags in --no) -- case $cf_add_cflags in #(vi -- -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi -- case $cf_add_cflags in -- -D*) -- cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` -- -- test "${cf_add_cflags}" != "${cf_tst_cflags}" \ -- && test -z "${cf_tst_cflags}" \ -- && cf_fix_cppflags=yes -- -- if test $cf_fix_cppflags = yes ; then -- cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -- continue -- elif test "${cf_tst_cflags}" = "\"'" ; then -- cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -- continue -- fi -- ;; -- esac -- case "$CPPFLAGS" in -- *$cf_add_cflags) #(vi -- ;; -- *) #(vi -- case $cf_add_cflags in #(vi -- -D*) -- cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` -- --CPPFLAGS=`echo "$CPPFLAGS" | \ -- sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ -- -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` -- -- ;; -- esac -- cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" -- ;; -- esac -- ;; -- *) -- cf_new_cflags="$cf_new_cflags $cf_add_cflags" -- ;; -- esac -- ;; --yes) -- cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -- -- cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` -- -- test "${cf_add_cflags}" != "${cf_tst_cflags}" \ -- && test -z "${cf_tst_cflags}" \ -- && cf_fix_cppflags=no -- ;; --esac -+ # Extract the first word of "$ac_prog", so it can be a program name with args. -+set dummy $ac_prog; ac_word=$2 -+echo "$as_me:2538: checking for $ac_word" >&5 -+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -+if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ if test -n "$ac_ct_CXX"; then -+ ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. -+else -+ ac_save_IFS=$IFS; IFS=$ac_path_separator -+ac_dummy="$PATH" -+for ac_dir in $ac_dummy; do -+ IFS=$ac_save_IFS -+ test -z "$ac_dir" && ac_dir=. -+ $as_executable_p "$ac_dir/$ac_word" || continue -+ac_cv_prog_ac_ct_CXX="$ac_prog" -+echo "$as_me:2553: found $ac_dir/$ac_word" >&5 -+break - done - --if test -n "$cf_new_cflags" ; then -- -- CFLAGS="$CFLAGS $cf_new_cflags" - fi -- --if test -n "$cf_new_cppflags" ; then -- -- CPPFLAGS="$CPPFLAGS $cf_new_cppflags" -+fi -+ac_ct_CXX=$ac_cv_prog_ac_ct_CXX -+if test -n "$ac_ct_CXX"; then -+ echo "$as_me:2561: result: $ac_ct_CXX" >&5 -+echo "${ECHO_T}$ac_ct_CXX" >&6 -+else -+ echo "$as_me:2564: result: no" >&5 -+echo "${ECHO_T}no" >&6 - fi - --if test -n "$cf_new_extra_cppflags" ; then -+ test -n "$ac_ct_CXX" && break -+done -+test -n "$ac_ct_CXX" || ac_ct_CXX="g++" - -- EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" -+ CXX=$ac_ct_CXX - fi - -- cat >conftest.$ac_ext <<_ACEOF --#line 2529 "configure" --#include "confdefs.h" -+# Provide some information about the compiler. -+echo "$as_me:2576:" \ -+ "checking for C++ compiler version" >&5 -+ac_compiler=`set X $ac_compile; echo $2` -+{ (eval echo "$as_me:2579: \"$ac_compiler --version &5\"") >&5 -+ (eval $ac_compiler --version &5) 2>&5 -+ ac_status=$? -+ echo "$as_me:2582: \$? = $ac_status" >&5 -+ (exit $ac_status); } -+{ (eval echo "$as_me:2584: \"$ac_compiler -v &5\"") >&5 -+ (eval $ac_compiler -v &5) 2>&5 -+ ac_status=$? -+ echo "$as_me:2587: \$? = $ac_status" >&5 -+ (exit $ac_status); } -+{ (eval echo "$as_me:2589: \"$ac_compiler -V &5\"") >&5 -+ (eval $ac_compiler -V &5) 2>&5 -+ ac_status=$? -+ echo "$as_me:2592: \$? = $ac_status" >&5 -+ (exit $ac_status); } - --#ifndef CC_HAS_PROTOS --#if !defined(__STDC__) || (__STDC__ != 1) --choke me --#endif --#endif -+echo "$as_me:2595: checking whether we are using the GNU C++ compiler" >&5 -+echo $ECHO_N "checking whether we are using the GNU C++ compiler... $ECHO_C" >&6 -+if test "${ac_cv_cxx_compiler_gnu+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ cat >conftest.$ac_ext <<_ACEOF -+#line 2601 "configure" -+#include "confdefs.h" - - int - main () - { -+#ifndef __GNUC__ -+ choke me -+#endif - -- int test (int i, double x); -- struct s1 {int (*f) (int a);}; -- struct s2 {int (*f) (double a);}; - ; - return 0; - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:2550: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:2616: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:2553: \$? = $ac_status" >&5 -+ echo "$as_me:2619: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:2556: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:2622: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:2559: \$? = $ac_status" >&5 -+ echo "$as_me:2625: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- cf_cv_ansi_cc="$cf_arg"; break -+ ac_compiler_gnu=yes - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 -+ac_compiler_gnu=no - fi - rm -f conftest.$ac_objext conftest.$ac_ext --done --CFLAGS="$cf_save_CFLAGS" --CPPFLAGS="$cf_save_CPPFLAGS" -- --fi --echo "$as_me:2572: result: $cf_cv_ansi_cc" >&5 --echo "${ECHO_T}$cf_cv_ansi_cc" >&6 -- --if test "$cf_cv_ansi_cc" != "no"; then --if test ".$cf_cv_ansi_cc" != ".-DCC_HAS_PROTOS"; then -- --cf_fix_cppflags=no --cf_new_cflags= --cf_new_cppflags= --cf_new_extra_cppflags= -- --for cf_add_cflags in $cf_cv_ansi_cc --do --case $cf_fix_cppflags in --no) -- case $cf_add_cflags in #(vi -- -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi -- case $cf_add_cflags in -- -D*) -- cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` -- -- test "${cf_add_cflags}" != "${cf_tst_cflags}" \ -- && test -z "${cf_tst_cflags}" \ -- && cf_fix_cppflags=yes -- -- if test $cf_fix_cppflags = yes ; then -- cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -- continue -- elif test "${cf_tst_cflags}" = "\"'" ; then -- cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -- continue -- fi -- ;; -- esac -- case "$CPPFLAGS" in -- *$cf_add_cflags) #(vi -- ;; -- *) #(vi -- case $cf_add_cflags in #(vi -- -D*) -- cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` -- --CPPFLAGS=`echo "$CPPFLAGS" | \ -- sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ -- -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` -- -- ;; -- esac -- cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" -- ;; -- esac -- ;; -- *) -- cf_new_cflags="$cf_new_cflags $cf_add_cflags" -- ;; -- esac -- ;; --yes) -- cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -- -- cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` -- -- test "${cf_add_cflags}" != "${cf_tst_cflags}" \ -- && test -z "${cf_tst_cflags}" \ -- && cf_fix_cppflags=no -- ;; --esac --done -- --if test -n "$cf_new_cflags" ; then -- -- CFLAGS="$CFLAGS $cf_new_cflags" --fi -- --if test -n "$cf_new_cppflags" ; then -+ac_cv_cxx_compiler_gnu=$ac_compiler_gnu - -- CPPFLAGS="$CPPFLAGS $cf_new_cppflags" - fi -+echo "$as_me:2637: result: $ac_cv_cxx_compiler_gnu" >&5 -+echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6 -+GXX=`test $ac_compiler_gnu = yes && echo yes` -+ac_test_CXXFLAGS=${CXXFLAGS+set} -+ac_save_CXXFLAGS=$CXXFLAGS -+CXXFLAGS="-g" -+echo "$as_me:2643: checking whether $CXX accepts -g" >&5 -+echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6 -+if test "${ac_cv_prog_cxx_g+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ cat >conftest.$ac_ext <<_ACEOF -+#line 2649 "configure" -+#include "confdefs.h" - --if test -n "$cf_new_extra_cppflags" ; then -- -- EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" --fi -+int -+main () -+{ - -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:2661: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>&5 -+ ac_status=$? -+ echo "$as_me:2664: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:2667: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:2670: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ ac_cv_prog_cxx_g=yes - else -- cat >>confdefs.h <<\EOF --#define CC_HAS_PROTOS 1 --EOF -- -+ echo "$as_me: failed program was:" >&5 -+cat conftest.$ac_ext >&5 -+ac_cv_prog_cxx_g=no - fi -+rm -f conftest.$ac_objext conftest.$ac_ext - fi -- --if test "$cf_cv_ansi_cc" = "no"; then -- { { echo "$as_me:2665: error: Your compiler does not appear to recognize prototypes. --You have the following choices: -- a. adjust your compiler options -- b. get an up-to-date compiler -- c. use a wrapper such as unproto" >&5 --echo "$as_me: error: Your compiler does not appear to recognize prototypes. --You have the following choices: -- a. adjust your compiler options -- b. get an up-to-date compiler -- c. use a wrapper such as unproto" >&2;} -- { (exit 1); exit 1; }; } --fi -- --case $cf_cv_system_name in --os2*) -- CFLAGS="$CFLAGS -Zmt" -- CPPFLAGS="$CPPFLAGS -D__ST_MT_ERRNO__" -- CXXFLAGS="$CXXFLAGS -Zmt" -- # autoconf's macro sets -Zexe and suffix both, which conflict:w -- LDFLAGS="$LDFLAGS -Zmt -Zcrtdll" -- ac_cv_exeext=.exe -- ;; --esac -- --PROG_EXT="$EXEEXT" -- --test -n "$PROG_EXT" && cat >>confdefs.h <&5 --echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 --if test "${ac_cv_path_LDCONFIG+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 --else -- case $LDCONFIG in -- [\\/]* | ?:[\\/]*) -- ac_cv_path_LDCONFIG="$LDCONFIG" # Let the user override the test with a path. -- ;; -- *) -- ac_save_IFS=$IFS; IFS=$ac_path_separator --ac_dummy="$LDPATH" --for ac_dir in $ac_dummy; do -- IFS=$ac_save_IFS -- test -z "$ac_dir" && ac_dir=. -- if $as_executable_p "$ac_dir/$ac_word"; then -- ac_cv_path_LDCONFIG="$ac_dir/$ac_word" -- echo "$as_me:2722: found $ac_dir/$ac_word" >&5 -- break --fi --done -- -- ;; --esac --fi --LDCONFIG=$ac_cv_path_LDCONFIG -- --if test -n "$LDCONFIG"; then -- echo "$as_me:2733: result: $LDCONFIG" >&5 --echo "${ECHO_T}$LDCONFIG" >&6 --else -- echo "$as_me:2736: result: no" >&5 --echo "${ECHO_T}no" >&6 --fi -- -- ;; --esac --fi -- --echo "$as_me:2744: checking if you want to ensure bool is consistent with C++" >&5 --echo $ECHO_N "checking if you want to ensure bool is consistent with C++... $ECHO_C" >&6 -- --# Check whether --with-cxx or --without-cxx was given. --if test "${with_cxx+set}" = set; then -- withval="$with_cxx" -- cf_with_cxx=$withval --else -- cf_with_cxx=yes --fi; --echo "$as_me:2754: result: $cf_with_cxx" >&5 --echo "${ECHO_T}$cf_with_cxx" >&6 --if test "X$cf_with_cxx" = Xno ; then -- CXX="" -- GXX="" --else -- # with autoconf 2.13, we can change the error to a warning: -- ac_ext=cc --ac_cpp='$CXXCPP $CPPFLAGS' --ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' --ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' --ac_compiler_gnu=$ac_cv_cxx_compiler_gnu --ac_main_return=return --if test -n "$ac_tool_prefix"; then -- for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC -- do -- # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. --set dummy $ac_tool_prefix$ac_prog; ac_word=$2 --echo "$as_me:2772: checking for $ac_word" >&5 --echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 --if test "${ac_cv_prog_CXX+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 --else -- if test -n "$CXX"; then -- ac_cv_prog_CXX="$CXX" # Let the user override the test. --else -- ac_save_IFS=$IFS; IFS=$ac_path_separator --ac_dummy="$PATH" --for ac_dir in $ac_dummy; do -- IFS=$ac_save_IFS -- test -z "$ac_dir" && ac_dir=. -- $as_executable_p "$ac_dir/$ac_word" || continue --ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" --echo "$as_me:2787: found $ac_dir/$ac_word" >&5 --break --done -- --fi --fi --CXX=$ac_cv_prog_CXX --if test -n "$CXX"; then -- echo "$as_me:2795: result: $CXX" >&5 --echo "${ECHO_T}$CXX" >&6 --else -- echo "$as_me:2798: result: no" >&5 --echo "${ECHO_T}no" >&6 --fi -- -- test -n "$CXX" && break -- done --fi --if test -z "$CXX"; then -- ac_ct_CXX=$CXX -- for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC --do -- # Extract the first word of "$ac_prog", so it can be a program name with args. --set dummy $ac_prog; ac_word=$2 --echo "$as_me:2811: checking for $ac_word" >&5 --echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 --if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 --else -- if test -n "$ac_ct_CXX"; then -- ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. --else -- ac_save_IFS=$IFS; IFS=$ac_path_separator --ac_dummy="$PATH" --for ac_dir in $ac_dummy; do -- IFS=$ac_save_IFS -- test -z "$ac_dir" && ac_dir=. -- $as_executable_p "$ac_dir/$ac_word" || continue --ac_cv_prog_ac_ct_CXX="$ac_prog" --echo "$as_me:2826: found $ac_dir/$ac_word" >&5 --break --done -- --fi --fi --ac_ct_CXX=$ac_cv_prog_ac_ct_CXX --if test -n "$ac_ct_CXX"; then -- echo "$as_me:2834: result: $ac_ct_CXX" >&5 --echo "${ECHO_T}$ac_ct_CXX" >&6 --else -- echo "$as_me:2837: result: no" >&5 --echo "${ECHO_T}no" >&6 --fi -- -- test -n "$ac_ct_CXX" && break --done --test -n "$ac_ct_CXX" || ac_ct_CXX="g++" -- -- CXX=$ac_ct_CXX --fi -- --# Provide some information about the compiler. --echo "$as_me:2849:" \ -- "checking for C++ compiler version" >&5 --ac_compiler=`set X $ac_compile; echo $2` --{ (eval echo "$as_me:2852: \"$ac_compiler --version &5\"") >&5 -- (eval $ac_compiler --version &5) 2>&5 -- ac_status=$? -- echo "$as_me:2855: \$? = $ac_status" >&5 -- (exit $ac_status); } --{ (eval echo "$as_me:2857: \"$ac_compiler -v &5\"") >&5 -- (eval $ac_compiler -v &5) 2>&5 -- ac_status=$? -- echo "$as_me:2860: \$? = $ac_status" >&5 -- (exit $ac_status); } --{ (eval echo "$as_me:2862: \"$ac_compiler -V &5\"") >&5 -- (eval $ac_compiler -V &5) 2>&5 -- ac_status=$? -- echo "$as_me:2865: \$? = $ac_status" >&5 -- (exit $ac_status); } -- --echo "$as_me:2868: checking whether we are using the GNU C++ compiler" >&5 --echo $ECHO_N "checking whether we are using the GNU C++ compiler... $ECHO_C" >&6 --if test "${ac_cv_cxx_compiler_gnu+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 --else -- cat >conftest.$ac_ext <<_ACEOF --#line 2874 "configure" --#include "confdefs.h" -- --int --main () --{ --#ifndef __GNUC__ -- choke me --#endif -- -- ; -- return 0; --} --_ACEOF --rm -f conftest.$ac_objext --if { (eval echo "$as_me:2889: \"$ac_compile\"") >&5 -- (eval $ac_compile) 2>&5 -- ac_status=$? -- echo "$as_me:2892: \$? = $ac_status" >&5 -- (exit $ac_status); } && -- { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:2895: \"$ac_try\"") >&5 -- (eval $ac_try) 2>&5 -- ac_status=$? -- echo "$as_me:2898: \$? = $ac_status" >&5 -- (exit $ac_status); }; }; then -- ac_compiler_gnu=yes --else -- echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 --ac_compiler_gnu=no --fi --rm -f conftest.$ac_objext conftest.$ac_ext --ac_cv_cxx_compiler_gnu=$ac_compiler_gnu -- --fi --echo "$as_me:2910: result: $ac_cv_cxx_compiler_gnu" >&5 --echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6 --GXX=`test $ac_compiler_gnu = yes && echo yes` --ac_test_CXXFLAGS=${CXXFLAGS+set} --ac_save_CXXFLAGS=$CXXFLAGS --CXXFLAGS="-g" --echo "$as_me:2916: checking whether $CXX accepts -g" >&5 --echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6 --if test "${ac_cv_prog_cxx_g+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 --else -- cat >conftest.$ac_ext <<_ACEOF --#line 2922 "configure" --#include "confdefs.h" -- --int --main () --{ -- -- ; -- return 0; --} --_ACEOF --rm -f conftest.$ac_objext --if { (eval echo "$as_me:2934: \"$ac_compile\"") >&5 -- (eval $ac_compile) 2>&5 -- ac_status=$? -- echo "$as_me:2937: \$? = $ac_status" >&5 -- (exit $ac_status); } && -- { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:2940: \"$ac_try\"") >&5 -- (eval $ac_try) 2>&5 -- ac_status=$? -- echo "$as_me:2943: \$? = $ac_status" >&5 -- (exit $ac_status); }; }; then -- ac_cv_prog_cxx_g=yes --else -- echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 --ac_cv_prog_cxx_g=no --fi --rm -f conftest.$ac_objext conftest.$ac_ext --fi --echo "$as_me:2953: result: $ac_cv_prog_cxx_g" >&5 --echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6 --if test "$ac_test_CXXFLAGS" = set; then -- CXXFLAGS=$ac_save_CXXFLAGS --elif test $ac_cv_prog_cxx_g = yes; then -- if test "$GXX" = yes; then -- CXXFLAGS="-g -O2" -- else -- CXXFLAGS="-g" -- fi --else -- if test "$GXX" = yes; then -- CXXFLAGS="-O2" -- else -- CXXFLAGS= -- fi -+echo "$as_me:2680: result: $ac_cv_prog_cxx_g" >&5 -+echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6 -+if test "$ac_test_CXXFLAGS" = set; then -+ CXXFLAGS=$ac_save_CXXFLAGS -+elif test $ac_cv_prog_cxx_g = yes; then -+ if test "$GXX" = yes; then -+ CXXFLAGS="-g -O2" -+ else -+ CXXFLAGS="-g" -+ fi -+else -+ if test "$GXX" = yes; then -+ CXXFLAGS="-O2" -+ else -+ CXXFLAGS= -+ fi - fi - for ac_declaration in \ - ''\ -@@ -2977,7 +2704,7 @@ - 'void exit (int);' - do - cat >conftest.$ac_ext <<_ACEOF --#line 2980 "configure" -+#line 2707 "configure" - #include "confdefs.h" - #include - $ac_declaration -@@ -2990,16 +2717,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:2993: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:2720: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:2996: \$? = $ac_status" >&5 -+ echo "$as_me:2723: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:2999: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:2726: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:3002: \$? = $ac_status" >&5 -+ echo "$as_me:2729: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : - else -@@ -3009,7 +2736,7 @@ - fi - rm -f conftest.$ac_objext conftest.$ac_ext - cat >conftest.$ac_ext <<_ACEOF --#line 3012 "configure" -+#line 2739 "configure" - #include "confdefs.h" - $ac_declaration - int -@@ -3021,16 +2748,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:3024: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:2751: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:3027: \$? = $ac_status" >&5 -+ echo "$as_me:2754: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:3030: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:2757: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:3033: \$? = $ac_status" >&5 -+ echo "$as_me:2760: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - break - else -@@ -3053,11 +2780,11 @@ - ac_compiler_gnu=$ac_cv_c_compiler_gnu - ac_main_return=return - -- # autoconf 2.5x removed the error - by hardcoding it to g++. -+ # autoconf 2.5x removed the error (hardcoding it to g++, or just blank) - if test "$CXX" = "g++" ; then - # Extract the first word of "g++", so it can be a program name with args. - set dummy g++; ac_word=$2 --echo "$as_me:3060: checking for $ac_word" >&5 -+echo "$as_me:2787: checking for $ac_word" >&5 - echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 - if test "${ac_cv_path_CXX+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -3074,7 +2801,7 @@ - test -z "$ac_dir" && ac_dir=. - if $as_executable_p "$ac_dir/$ac_word"; then - ac_cv_path_CXX="$ac_dir/$ac_word" -- echo "$as_me:3077: found $ac_dir/$ac_word" >&5 -+ echo "$as_me:2804: found $ac_dir/$ac_word" >&5 - break - fi - done -@@ -3085,28 +2812,30 @@ - CXX=$ac_cv_path_CXX - - if test -n "$CXX"; then -- echo "$as_me:3088: result: $CXX" >&5 -+ echo "$as_me:2815: result: $CXX" >&5 - echo "${ECHO_T}$CXX" >&6 - else -- echo "$as_me:3091: result: no" >&5 -+ echo "$as_me:2818: result: no" >&5 - echo "${ECHO_T}no" >&6 - fi - - fi -- if test "$CXX" = "g++" ; then -- { echo "$as_me:3097: WARNING: ignoring hardcoded g++" >&5 --echo "$as_me: WARNING: ignoring hardcoded g++" >&2;} -+ case "x$CXX" in #(vi -+ x|xg++) -+ { echo "$as_me:2825: WARNING: You don't have any C++ compiler, too bad" >&5 -+echo "$as_me: WARNING: You don't have any C++ compiler, too bad" >&2;} - cf_with_cxx=no; CXX=""; GXX=""; -- fi -+ ;; -+ esac - fi - - GXX_VERSION=none - if test "$GXX" = yes; then -- echo "$as_me:3105: checking version of g++" >&5 --echo $ECHO_N "checking version of g++... $ECHO_C" >&6 -+ echo "$as_me:2834: checking version of ${CXX:-g++}" >&5 -+echo $ECHO_N "checking version of ${CXX:-g++}... $ECHO_C" >&6 - GXX_VERSION="`${CXX:-g++} --version| sed -e '2,$d' -e 's/^.*(GCC) //' -e 's/^[^0-9.]*//' -e 's/[^0-9.].*//'`" - test -z "$GXX_VERSION" && GXX_VERSION=unknown -- echo "$as_me:3109: result: $GXX_VERSION" >&5 -+ echo "$as_me:2838: result: $GXX_VERSION" >&5 - echo "${ECHO_T}$GXX_VERSION" >&6 - fi - -@@ -3114,12 +2843,12 @@ - 1*|2.[0-6]*) - # GXX=""; CXX=""; ac_cv_prog_gxx=no - # cf_cxx_library=no -- { echo "$as_me:3117: WARNING: templates do not work" >&5 -+ { echo "$as_me:2846: WARNING: templates do not work" >&5 - echo "$as_me: WARNING: templates do not work" >&2;} - ;; - esac - --echo "$as_me:3122: checking if you want to build C++ binding and demo" >&5 -+echo "$as_me:2851: checking if you want to build C++ binding and demo" >&5 - echo $ECHO_N "checking if you want to build C++ binding and demo... $ECHO_C" >&6 - - # Check whether --with-cxx-binding or --without-cxx-binding was given. -@@ -3129,23 +2858,28 @@ - else - cf_with_cxx_binding=$cf_with_cxx - fi; --echo "$as_me:3132: result: $cf_with_cxx_binding" >&5 -+echo "$as_me:2861: result: $cf_with_cxx_binding" >&5 - echo "${ECHO_T}$cf_with_cxx_binding" >&6 - --echo "$as_me:3135: checking if you want to build with Ada95" >&5 -+echo "$as_me:2864: checking if you want to build with Ada95" >&5 - echo $ECHO_N "checking if you want to build with Ada95... $ECHO_C" >&6 -+echo "$as_me:2866: result: $cf_with_ada" >&5 -+echo "${ECHO_T}$cf_with_ada" >&6 - --# Check whether --with-ada or --without-ada was given. --if test "${with_ada+set}" = set; then -- withval="$with_ada" -- cf_with_ada=$withval -+echo "$as_me:2869: checking if you want to install terminal database" >&5 -+echo $ECHO_N "checking if you want to install terminal database... $ECHO_C" >&6 -+ -+# Check whether --enable-db-install or --disable-db-install was given. -+if test "${enable_db_install+set}" = set; then -+ enableval="$enable_db_install" -+ cf_with_db_install=$enableval - else -- cf_with_ada=yes -+ cf_with_db_install=yes - fi; --echo "$as_me:3145: result: $cf_with_ada" >&5 --echo "${ECHO_T}$cf_with_ada" >&6 -+echo "$as_me:2879: result: $cf_with_db_install" >&5 -+echo "${ECHO_T}$cf_with_db_install" >&6 - --echo "$as_me:3148: checking if you want to install manpages" >&5 -+echo "$as_me:2882: checking if you want to install manpages" >&5 - echo $ECHO_N "checking if you want to install manpages... $ECHO_C" >&6 - - # Check whether --with-manpages or --without-manpages was given. -@@ -3155,10 +2889,10 @@ - else - cf_with_manpages=yes - fi; --echo "$as_me:3158: result: $cf_with_manpages" >&5 -+echo "$as_me:2892: result: $cf_with_manpages" >&5 - echo "${ECHO_T}$cf_with_manpages" >&6 - --echo "$as_me:3161: checking if you want to build programs such as tic" >&5 -+echo "$as_me:2895: checking if you want to build programs such as tic" >&5 - echo $ECHO_N "checking if you want to build programs such as tic... $ECHO_C" >&6 - - # Check whether --with-progs or --without-progs was given. -@@ -3168,10 +2902,10 @@ - else - cf_with_progs=yes - fi; --echo "$as_me:3171: result: $cf_with_progs" >&5 -+echo "$as_me:2905: result: $cf_with_progs" >&5 - echo "${ECHO_T}$cf_with_progs" >&6 - --echo "$as_me:3174: checking if you want to build test-programs" >&5 -+echo "$as_me:2908: checking if you want to build test-programs" >&5 - echo $ECHO_N "checking if you want to build test-programs... $ECHO_C" >&6 - - # Check whether --with-tests or --without-tests was given. -@@ -3181,10 +2915,10 @@ - else - cf_with_tests=yes - fi; --echo "$as_me:3184: result: $cf_with_tests" >&5 -+echo "$as_me:2918: result: $cf_with_tests" >&5 - echo "${ECHO_T}$cf_with_tests" >&6 - --echo "$as_me:3187: checking if you wish to install curses.h" >&5 -+echo "$as_me:2921: checking if you wish to install curses.h" >&5 - echo $ECHO_N "checking if you wish to install curses.h... $ECHO_C" >&6 - - # Check whether --with-curses-h or --without-curses-h was given. -@@ -3194,7 +2928,7 @@ - else - with_curses_h=yes - fi; --echo "$as_me:3197: result: $with_curses_h" >&5 -+echo "$as_me:2931: result: $with_curses_h" >&5 - echo "${ECHO_T}$with_curses_h" >&6 - - modules_to_build="ncurses" -@@ -3220,7 +2954,7 @@ - do - # Extract the first word of "$ac_prog", so it can be a program name with args. - set dummy $ac_prog; ac_word=$2 --echo "$as_me:3223: checking for $ac_word" >&5 -+echo "$as_me:2957: checking for $ac_word" >&5 - echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 - if test "${ac_cv_prog_AWK+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -3235,7 +2969,7 @@ - test -z "$ac_dir" && ac_dir=. - $as_executable_p "$ac_dir/$ac_word" || continue - ac_cv_prog_AWK="$ac_prog" --echo "$as_me:3238: found $ac_dir/$ac_word" >&5 -+echo "$as_me:2972: found $ac_dir/$ac_word" >&5 - break - done - -@@ -3243,21 +2977,21 @@ - fi - AWK=$ac_cv_prog_AWK - if test -n "$AWK"; then -- echo "$as_me:3246: result: $AWK" >&5 -+ echo "$as_me:2980: result: $AWK" >&5 - echo "${ECHO_T}$AWK" >&6 - else -- echo "$as_me:3249: result: no" >&5 -+ echo "$as_me:2983: result: no" >&5 - echo "${ECHO_T}no" >&6 - fi - - test -n "$AWK" && break - done - --test -z "$AWK" && { { echo "$as_me:3256: error: No awk program found" >&5 -+test -z "$AWK" && { { echo "$as_me:2990: error: No awk program found" >&5 - echo "$as_me: error: No awk program found" >&2;} - { (exit 1); exit 1; }; } - --echo "$as_me:3260: checking for egrep" >&5 -+echo "$as_me:2994: checking for egrep" >&5 - echo $ECHO_N "checking for egrep... $ECHO_C" >&6 - if test "${ac_cv_prog_egrep+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -3267,11 +3001,11 @@ - else ac_cv_prog_egrep='egrep' - fi - fi --echo "$as_me:3270: result: $ac_cv_prog_egrep" >&5 -+echo "$as_me:3004: result: $ac_cv_prog_egrep" >&5 - echo "${ECHO_T}$ac_cv_prog_egrep" >&6 - EGREP=$ac_cv_prog_egrep - --test -z "$EGREP" && { { echo "$as_me:3274: error: No egrep program found" >&5 -+test -z "$EGREP" && { { echo "$as_me:3008: error: No egrep program found" >&5 - echo "$as_me: error: No egrep program found" >&2;} - { (exit 1); exit 1; }; } - -@@ -3287,7 +3021,7 @@ - # AFS /usr/afsws/bin/install, which mishandles nonexistent args - # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" - # ./install, which can be erroneously created by make from ./install.sh. --echo "$as_me:3290: checking for a BSD compatible install" >&5 -+echo "$as_me:3024: checking for a BSD compatible install" >&5 - echo $ECHO_N "checking for a BSD compatible install... $ECHO_C" >&6 - if test -z "$INSTALL"; then - if test "${ac_cv_path_install+set}" = set; then -@@ -3336,7 +3070,7 @@ - INSTALL=$ac_install_sh - fi - fi --echo "$as_me:3339: result: $INSTALL" >&5 -+echo "$as_me:3073: result: $INSTALL" >&5 - echo "${ECHO_T}$INSTALL" >&6 - - # Use test -z because SunOS4 sh mishandles braces in ${var-val}. -@@ -3361,7 +3095,7 @@ - do - # Extract the first word of "$ac_prog", so it can be a program name with args. - set dummy $ac_prog; ac_word=$2 --echo "$as_me:3364: checking for $ac_word" >&5 -+echo "$as_me:3098: checking for $ac_word" >&5 - echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 - if test "${ac_cv_prog_LINT+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -3376,7 +3110,7 @@ - test -z "$ac_dir" && ac_dir=. - $as_executable_p "$ac_dir/$ac_word" || continue - ac_cv_prog_LINT="$ac_prog" --echo "$as_me:3379: found $ac_dir/$ac_word" >&5 -+echo "$as_me:3113: found $ac_dir/$ac_word" >&5 - break - done - -@@ -3384,28 +3118,28 @@ - fi - LINT=$ac_cv_prog_LINT - if test -n "$LINT"; then -- echo "$as_me:3387: result: $LINT" >&5 -+ echo "$as_me:3121: result: $LINT" >&5 - echo "${ECHO_T}$LINT" >&6 - else -- echo "$as_me:3390: result: no" >&5 -+ echo "$as_me:3124: result: no" >&5 - echo "${ECHO_T}no" >&6 - fi - - test -n "$LINT" && break - done - --echo "$as_me:3397: checking whether ln -s works" >&5 -+echo "$as_me:3131: checking whether ln -s works" >&5 - echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6 - LN_S=$as_ln_s - if test "$LN_S" = "ln -s"; then -- echo "$as_me:3401: result: yes" >&5 -+ echo "$as_me:3135: result: yes" >&5 - echo "${ECHO_T}yes" >&6 - else -- echo "$as_me:3404: result: no, using $LN_S" >&5 -+ echo "$as_me:3138: result: no, using $LN_S" >&5 - echo "${ECHO_T}no, using $LN_S" >&6 - fi - --echo "$as_me:3408: checking if $LN_S -f options work" >&5 -+echo "$as_me:3142: checking if $LN_S -f options work" >&5 - echo $ECHO_N "checking if $LN_S -f options work... $ECHO_C" >&6 - - rm -f conf$$.src conf$$dst -@@ -3417,12 +3151,12 @@ - cf_prog_ln_sf=no - fi - rm -f conf$$.dst conf$$src --echo "$as_me:3420: result: $cf_prog_ln_sf" >&5 -+echo "$as_me:3154: result: $cf_prog_ln_sf" >&5 - echo "${ECHO_T}$cf_prog_ln_sf" >&6 - - test "$cf_prog_ln_sf" = yes && LN_S="$LN_S -f" - --echo "$as_me:3425: checking for long file names" >&5 -+echo "$as_me:3159: checking for long file names" >&5 - echo $ECHO_N "checking for long file names... $ECHO_C" >&6 - if test "${ac_cv_sys_long_file_names+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -3461,7 +3195,7 @@ - rm -rf $ac_xdir 2>/dev/null - done - fi --echo "$as_me:3464: result: $ac_cv_sys_long_file_names" >&5 -+echo "$as_me:3198: result: $ac_cv_sys_long_file_names" >&5 - echo "${ECHO_T}$ac_cv_sys_long_file_names" >&6 - if test $ac_cv_sys_long_file_names = yes; then - -@@ -3473,7 +3207,7 @@ - - # if we find pkg-config, check if we should install the ".pc" files. - --echo "$as_me:3476: checking if you want to use pkg-config" >&5 -+echo "$as_me:3210: checking if you want to use pkg-config" >&5 - echo $ECHO_N "checking if you want to use pkg-config... $ECHO_C" >&6 - - # Check whether --with-pkg-config or --without-pkg-config was given. -@@ -3483,7 +3217,7 @@ - else - cf_pkg_config=yes - fi; --echo "$as_me:3486: result: $cf_pkg_config" >&5 -+echo "$as_me:3220: result: $cf_pkg_config" >&5 - echo "${ECHO_T}$cf_pkg_config" >&6 - - case $cf_pkg_config in #(vi -@@ -3491,10 +3225,11 @@ - PKG_CONFIG=none - ;; - yes) #(vi -- if test -n "$ac_tool_prefix"; then -+ -+if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. - set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 --echo "$as_me:3497: checking for $ac_word" >&5 -+echo "$as_me:3232: checking for $ac_word" >&5 - echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 - if test "${ac_cv_path_PKG_CONFIG+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -3511,7 +3246,7 @@ - test -z "$ac_dir" && ac_dir=. - if $as_executable_p "$ac_dir/$ac_word"; then - ac_cv_path_PKG_CONFIG="$ac_dir/$ac_word" -- echo "$as_me:3514: found $ac_dir/$ac_word" >&5 -+ echo "$as_me:3249: found $ac_dir/$ac_word" >&5 - break - fi - done -@@ -3522,10 +3257,10 @@ - PKG_CONFIG=$ac_cv_path_PKG_CONFIG - - if test -n "$PKG_CONFIG"; then -- echo "$as_me:3525: result: $PKG_CONFIG" >&5 -+ echo "$as_me:3260: result: $PKG_CONFIG" >&5 - echo "${ECHO_T}$PKG_CONFIG" >&6 - else -- echo "$as_me:3528: result: no" >&5 -+ echo "$as_me:3263: result: no" >&5 - echo "${ECHO_T}no" >&6 - fi - -@@ -3534,7 +3269,7 @@ - ac_pt_PKG_CONFIG=$PKG_CONFIG - # Extract the first word of "pkg-config", so it can be a program name with args. - set dummy pkg-config; ac_word=$2 --echo "$as_me:3537: checking for $ac_word" >&5 -+echo "$as_me:3272: checking for $ac_word" >&5 - echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 - if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -3551,7 +3286,7 @@ - test -z "$ac_dir" && ac_dir=. - if $as_executable_p "$ac_dir/$ac_word"; then - ac_cv_path_ac_pt_PKG_CONFIG="$ac_dir/$ac_word" -- echo "$as_me:3554: found $ac_dir/$ac_word" >&5 -+ echo "$as_me:3289: found $ac_dir/$ac_word" >&5 - break - fi - done -@@ -3563,10 +3298,10 @@ - ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG - - if test -n "$ac_pt_PKG_CONFIG"; then -- echo "$as_me:3566: result: $ac_pt_PKG_CONFIG" >&5 -+ echo "$as_me:3301: result: $ac_pt_PKG_CONFIG" >&5 - echo "${ECHO_T}$ac_pt_PKG_CONFIG" >&6 - else -- echo "$as_me:3569: result: no" >&5 -+ echo "$as_me:3304: result: no" >&5 - echo "${ECHO_T}no" >&6 - fi - -@@ -3597,7 +3332,7 @@ - ;; - .[a-zA-Z]:[\\/]*) #(vi OS/2 EMX - ;; --.\${*prefix}*) #(vi -+.\${*prefix}*|.\${*dir}*) #(vi - eval PKG_CONFIG="$PKG_CONFIG" - case ".$PKG_CONFIG" in #(vi - .NONE/*) -@@ -3609,7 +3344,7 @@ - PKG_CONFIG=`echo $PKG_CONFIG | sed -e s%NONE%$cf_path_syntax%` - ;; - *) -- { { echo "$as_me:3612: error: expected a pathname, not \"$PKG_CONFIG\"" >&5 -+ { { echo "$as_me:3347: error: expected a pathname, not \"$PKG_CONFIG\"" >&5 - echo "$as_me: error: expected a pathname, not \"$PKG_CONFIG\"" >&2;} - { (exit 1); exit 1; }; } - ;; -@@ -3617,16 +3352,51 @@ - - fi - --if test "$PKG_CONFIG" != no ; then -- echo "$as_me:3621: checking if we should install .pc files for $PKG_CONFIG" >&5 --echo $ECHO_N "checking if we should install .pc files for $PKG_CONFIG... $ECHO_C" >&6 -+if test "$PKG_CONFIG" != none ; then -+ echo "$as_me:3356: checking for $PKG_CONFIG library directory" >&5 -+echo $ECHO_N "checking for $PKG_CONFIG library directory... $ECHO_C" >&6 - -- # Leave this as something that can be overridden in the environment. -- if test -z "$PKG_CONFIG_LIBDIR" ; then -- PKG_CONFIG_LIBDIR=`echo "$PKG_CONFIG" | sed -e 's,/[^/]*/[^/]*$,,'`/lib/pkgconfig -- fi -- PKG_CONFIG_LIBDIR=`echo "$PKG_CONFIG_LIBDIR" | sed -e 's/^://' -e 's/:.*//'` -- if test -n "$PKG_CONFIG_LIBDIR" && test -d "$PKG_CONFIG_LIBDIR" ; then -+# Check whether --with-pkg-config-libdir or --without-pkg-config-libdir was given. -+if test "${with_pkg_config_libdir+set}" = set; then -+ withval="$with_pkg_config_libdir" -+ PKG_CONFIG_LIBDIR=$withval -+else -+ PKG_CONFIG_LIBDIR=yes -+fi; -+ -+ case x$PKG_CONFIG_LIBDIR in #(vi -+ x/*) #(vi -+ ;; -+ xyes) #(vi -+ # look for the library directory using the same prefix as the executable -+ cf_path=`echo "$PKG_CONFIG" | sed -e 's,/[^/]*/[^/]*$,,'` -+ case x`(arch) 2>/dev/null` in #(vi -+ *64) #(vi -+ for cf_config in $cf_path/share $cf_path/lib64 $cf_path/lib32 $cf_path/lib -+ do -+ if test -d $cf_config/pkgconfig -+ then -+ PKG_CONFIG_LIBDIR=$cf_config/pkgconfig -+ break -+ fi -+ done -+ ;; -+ *) -+ PKG_CONFIG_LIBDIR=$cf_path/lib/pkgconfig -+ ;; -+ esac -+ ;; -+ *) -+ ;; -+ esac -+ -+ echo "$as_me:3393: result: $PKG_CONFIG_LIBDIR" >&5 -+echo "${ECHO_T}$PKG_CONFIG_LIBDIR" >&6 -+fi -+ -+if test "$PKG_CONFIG" != none ; then -+ echo "$as_me:3398: checking if we should install .pc files for $PKG_CONFIG" >&5 -+echo $ECHO_N "checking if we should install .pc files for $PKG_CONFIG... $ECHO_C" >&6 - - # Check whether --enable-pc-files or --disable-pc-files was given. - if test "${enable_pc_files+set}" = set; then -@@ -3635,18 +3405,48 @@ - else - enable_pc_files=no - fi; -- echo "$as_me:3638: result: $enable_pc_files" >&5 -+ echo "$as_me:3408: result: $enable_pc_files" >&5 - echo "${ECHO_T}$enable_pc_files" >&6 -- else -- echo "$as_me:3641: result: no" >&5 --echo "${ECHO_T}no" >&6 -- { echo "$as_me:3643: WARNING: did not find library $PKG_CONFIG_LIBDIR" >&5 --echo "$as_me: WARNING: did not find library $PKG_CONFIG_LIBDIR" >&2;} -- enable_pc_files=no -+ if test "$enable_pc_files" != no -+ then -+ -+if test "x$prefix" != xNONE; then -+ cf_path_syntax="$prefix" -+else -+ cf_path_syntax="$ac_default_prefix" -+fi -+ -+case ".$PKG_CONFIG_LIBDIR" in #(vi -+.\$\(*\)*|.\'*\'*) #(vi -+ ;; -+..|./*|.\\*) #(vi -+ ;; -+.[a-zA-Z]:[\\/]*) #(vi OS/2 EMX -+ ;; -+.\${*prefix}*|.\${*dir}*) #(vi -+ eval PKG_CONFIG_LIBDIR="$PKG_CONFIG_LIBDIR" -+ case ".$PKG_CONFIG_LIBDIR" in #(vi -+ .NONE/*) -+ PKG_CONFIG_LIBDIR=`echo $PKG_CONFIG_LIBDIR | sed -e s%NONE%$cf_path_syntax%` -+ ;; -+ esac -+ ;; #(vi -+.no|.NONE/*) -+ PKG_CONFIG_LIBDIR=`echo $PKG_CONFIG_LIBDIR | sed -e s%NONE%$cf_path_syntax%` -+ ;; -+*) -+ { { echo "$as_me:3438: error: expected a pathname, not \"$PKG_CONFIG_LIBDIR\"" >&5 -+echo "$as_me: error: expected a pathname, not \"$PKG_CONFIG_LIBDIR\"" >&2;} -+ { (exit 1); exit 1; }; } -+ ;; -+esac -+ - fi -+else -+ enable_pc_files=no - fi - --echo "$as_me:3649: checking if we should assume mixed-case filenames" >&5 -+echo "$as_me:3449: checking if we should assume mixed-case filenames" >&5 - echo $ECHO_N "checking if we should assume mixed-case filenames... $ECHO_C" >&6 - - # Check whether --enable-mixed-case or --disable-mixed-case was given. -@@ -3656,11 +3456,11 @@ - else - enable_mixedcase=auto - fi; --echo "$as_me:3659: result: $enable_mixedcase" >&5 -+echo "$as_me:3459: result: $enable_mixedcase" >&5 - echo "${ECHO_T}$enable_mixedcase" >&6 - if test "$enable_mixedcase" = "auto" ; then - --echo "$as_me:3663: checking if filesystem supports mixed-case filenames" >&5 -+echo "$as_me:3463: checking if filesystem supports mixed-case filenames" >&5 - echo $ECHO_N "checking if filesystem supports mixed-case filenames... $ECHO_C" >&6 - if test "${cf_cv_mixedcase+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -3668,7 +3468,7 @@ - - if test "$cross_compiling" = yes ; then - case $target_alias in #(vi -- *-os2-emx*|*-msdosdjgpp*|*-cygwin*|*-mingw32*|*-uwin*) #(vi -+ *-os2-emx*|*-msdosdjgpp*|*-cygwin*|*-msys*|*-mingw*|*-uwin*) #(vi - cf_cv_mixedcase=no - ;; - *) -@@ -3687,16 +3487,18 @@ - fi - - fi --echo "$as_me:3690: result: $cf_cv_mixedcase" >&5 -+echo "$as_me:3490: result: $cf_cv_mixedcase" >&5 - echo "${ECHO_T}$cf_cv_mixedcase" >&6 --test "$cf_cv_mixedcase" = yes && cat >>confdefs.h <<\EOF -+test "$cf_cv_mixedcase" = yes && -+cat >>confdefs.h <<\EOF - #define MIXEDCASE_FILENAMES 1 - EOF - - else - cf_cv_mixedcase=$enable_mixedcase -- if test "$enable_mixedcase" = "yes" ; then -- cat >>confdefs.h <<\EOF -+ if test "x$enable_mixedcase" = "xyes" ; then -+ -+cat >>confdefs.h <<\EOF - #define MIXEDCASE_FILENAMES 1 - EOF - -@@ -3704,7 +3506,7 @@ - fi - - # do this after mixed-case option (tags/TAGS is not as important as tic). --echo "$as_me:3707: checking whether ${MAKE-make} sets \${MAKE}" >&5 -+echo "$as_me:3509: checking whether ${MAKE-make} sets \${MAKE}" >&5 - echo $ECHO_N "checking whether ${MAKE-make} sets \${MAKE}... $ECHO_C" >&6 - set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,./+-,__p_,'` - if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then -@@ -3724,11 +3526,11 @@ - rm -f conftest.make - fi - if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then -- echo "$as_me:3727: result: yes" >&5 -+ echo "$as_me:3529: result: yes" >&5 - echo "${ECHO_T}yes" >&6 - SET_MAKE= - else -- echo "$as_me:3731: result: no" >&5 -+ echo "$as_me:3533: result: no" >&5 - echo "${ECHO_T}no" >&6 - SET_MAKE="MAKE=${MAKE-make}" - fi -@@ -3737,7 +3539,7 @@ - do - # Extract the first word of "$ac_prog", so it can be a program name with args. - set dummy $ac_prog; ac_word=$2 --echo "$as_me:3740: checking for $ac_word" >&5 -+echo "$as_me:3542: checking for $ac_word" >&5 - echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 - if test "${ac_cv_prog_CTAGS+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -3752,7 +3554,7 @@ - test -z "$ac_dir" && ac_dir=. - $as_executable_p "$ac_dir/$ac_word" || continue - ac_cv_prog_CTAGS="$ac_prog" --echo "$as_me:3755: found $ac_dir/$ac_word" >&5 -+echo "$as_me:3557: found $ac_dir/$ac_word" >&5 - break - done - -@@ -3760,10 +3562,10 @@ - fi - CTAGS=$ac_cv_prog_CTAGS - if test -n "$CTAGS"; then -- echo "$as_me:3763: result: $CTAGS" >&5 -+ echo "$as_me:3565: result: $CTAGS" >&5 - echo "${ECHO_T}$CTAGS" >&6 - else -- echo "$as_me:3766: result: no" >&5 -+ echo "$as_me:3568: result: no" >&5 - echo "${ECHO_T}no" >&6 - fi - -@@ -3774,7 +3576,7 @@ - do - # Extract the first word of "$ac_prog", so it can be a program name with args. - set dummy $ac_prog; ac_word=$2 --echo "$as_me:3777: checking for $ac_word" >&5 -+echo "$as_me:3579: checking for $ac_word" >&5 - echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 - if test "${ac_cv_prog_ETAGS+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -3789,7 +3591,7 @@ - test -z "$ac_dir" && ac_dir=. - $as_executable_p "$ac_dir/$ac_word" || continue - ac_cv_prog_ETAGS="$ac_prog" --echo "$as_me:3792: found $ac_dir/$ac_word" >&5 -+echo "$as_me:3594: found $ac_dir/$ac_word" >&5 - break - done - -@@ -3797,10 +3599,10 @@ - fi - ETAGS=$ac_cv_prog_ETAGS - if test -n "$ETAGS"; then -- echo "$as_me:3800: result: $ETAGS" >&5 -+ echo "$as_me:3602: result: $ETAGS" >&5 - echo "${ECHO_T}$ETAGS" >&6 - else -- echo "$as_me:3803: result: no" >&5 -+ echo "$as_me:3605: result: no" >&5 - echo "${ECHO_T}no" >&6 - fi - -@@ -3809,7 +3611,7 @@ - - # Extract the first word of "${CTAGS:-ctags}", so it can be a program name with args. - set dummy ${CTAGS:-ctags}; ac_word=$2 --echo "$as_me:3812: checking for $ac_word" >&5 -+echo "$as_me:3614: checking for $ac_word" >&5 - echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 - if test "${ac_cv_prog_MAKE_LOWER_TAGS+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -3824,7 +3626,7 @@ - test -z "$ac_dir" && ac_dir=. - $as_executable_p "$ac_dir/$ac_word" || continue - ac_cv_prog_MAKE_LOWER_TAGS="yes" --echo "$as_me:3827: found $ac_dir/$ac_word" >&5 -+echo "$as_me:3629: found $ac_dir/$ac_word" >&5 - break - done - -@@ -3833,17 +3635,17 @@ - fi - MAKE_LOWER_TAGS=$ac_cv_prog_MAKE_LOWER_TAGS - if test -n "$MAKE_LOWER_TAGS"; then -- echo "$as_me:3836: result: $MAKE_LOWER_TAGS" >&5 -+ echo "$as_me:3638: result: $MAKE_LOWER_TAGS" >&5 - echo "${ECHO_T}$MAKE_LOWER_TAGS" >&6 - else -- echo "$as_me:3839: result: no" >&5 -+ echo "$as_me:3641: result: no" >&5 - echo "${ECHO_T}no" >&6 - fi - - if test "$cf_cv_mixedcase" = yes ; then - # Extract the first word of "${ETAGS:-etags}", so it can be a program name with args. - set dummy ${ETAGS:-etags}; ac_word=$2 --echo "$as_me:3846: checking for $ac_word" >&5 -+echo "$as_me:3648: checking for $ac_word" >&5 - echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 - if test "${ac_cv_prog_MAKE_UPPER_TAGS+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -3858,7 +3660,7 @@ - test -z "$ac_dir" && ac_dir=. - $as_executable_p "$ac_dir/$ac_word" || continue - ac_cv_prog_MAKE_UPPER_TAGS="yes" --echo "$as_me:3861: found $ac_dir/$ac_word" >&5 -+echo "$as_me:3663: found $ac_dir/$ac_word" >&5 - break - done - -@@ -3867,10 +3669,10 @@ - fi - MAKE_UPPER_TAGS=$ac_cv_prog_MAKE_UPPER_TAGS - if test -n "$MAKE_UPPER_TAGS"; then -- echo "$as_me:3870: result: $MAKE_UPPER_TAGS" >&5 -+ echo "$as_me:3672: result: $MAKE_UPPER_TAGS" >&5 - echo "${ECHO_T}$MAKE_UPPER_TAGS" >&6 - else -- echo "$as_me:3873: result: no" >&5 -+ echo "$as_me:3675: result: no" >&5 - echo "${ECHO_T}no" >&6 - fi - -@@ -3890,7 +3692,7 @@ - MAKE_LOWER_TAGS="#" - fi - --echo "$as_me:3893: checking for makeflags variable" >&5 -+echo "$as_me:3695: checking for makeflags variable" >&5 - echo $ECHO_N "checking for makeflags variable... $ECHO_C" >&6 - if test "${cf_cv_makeflags+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -3924,13 +3726,13 @@ - rm -f cf_makeflags.tmp - - fi --echo "$as_me:3927: result: $cf_cv_makeflags" >&5 -+echo "$as_me:3729: result: $cf_cv_makeflags" >&5 - echo "${ECHO_T}$cf_cv_makeflags" >&6 - - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. - set dummy ${ac_tool_prefix}ranlib; ac_word=$2 --echo "$as_me:3933: checking for $ac_word" >&5 -+echo "$as_me:3735: checking for $ac_word" >&5 - echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 - if test "${ac_cv_prog_RANLIB+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -3945,7 +3747,7 @@ - test -z "$ac_dir" && ac_dir=. - $as_executable_p "$ac_dir/$ac_word" || continue - ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" --echo "$as_me:3948: found $ac_dir/$ac_word" >&5 -+echo "$as_me:3750: found $ac_dir/$ac_word" >&5 - break - done - -@@ -3953,10 +3755,10 @@ - fi - RANLIB=$ac_cv_prog_RANLIB - if test -n "$RANLIB"; then -- echo "$as_me:3956: result: $RANLIB" >&5 -+ echo "$as_me:3758: result: $RANLIB" >&5 - echo "${ECHO_T}$RANLIB" >&6 - else -- echo "$as_me:3959: result: no" >&5 -+ echo "$as_me:3761: result: no" >&5 - echo "${ECHO_T}no" >&6 - fi - -@@ -3965,7 +3767,7 @@ - ac_ct_RANLIB=$RANLIB - # Extract the first word of "ranlib", so it can be a program name with args. - set dummy ranlib; ac_word=$2 --echo "$as_me:3968: checking for $ac_word" >&5 -+echo "$as_me:3770: checking for $ac_word" >&5 - echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 - if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -3980,7 +3782,7 @@ - test -z "$ac_dir" && ac_dir=. - $as_executable_p "$ac_dir/$ac_word" || continue - ac_cv_prog_ac_ct_RANLIB="ranlib" --echo "$as_me:3983: found $ac_dir/$ac_word" >&5 -+echo "$as_me:3785: found $ac_dir/$ac_word" >&5 - break - done - -@@ -3989,10 +3791,10 @@ - fi - ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB - if test -n "$ac_ct_RANLIB"; then -- echo "$as_me:3992: result: $ac_ct_RANLIB" >&5 -+ echo "$as_me:3794: result: $ac_ct_RANLIB" >&5 - echo "${ECHO_T}$ac_ct_RANLIB" >&6 - else -- echo "$as_me:3995: result: no" >&5 -+ echo "$as_me:3797: result: no" >&5 - echo "${ECHO_T}no" >&6 - fi - -@@ -4004,7 +3806,7 @@ - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}ld", so it can be a program name with args. - set dummy ${ac_tool_prefix}ld; ac_word=$2 --echo "$as_me:4007: checking for $ac_word" >&5 -+echo "$as_me:3809: checking for $ac_word" >&5 - echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 - if test "${ac_cv_prog_LD+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -4019,7 +3821,7 @@ - test -z "$ac_dir" && ac_dir=. - $as_executable_p "$ac_dir/$ac_word" || continue - ac_cv_prog_LD="${ac_tool_prefix}ld" --echo "$as_me:4022: found $ac_dir/$ac_word" >&5 -+echo "$as_me:3824: found $ac_dir/$ac_word" >&5 - break - done - -@@ -4027,10 +3829,10 @@ - fi - LD=$ac_cv_prog_LD - if test -n "$LD"; then -- echo "$as_me:4030: result: $LD" >&5 -+ echo "$as_me:3832: result: $LD" >&5 - echo "${ECHO_T}$LD" >&6 - else -- echo "$as_me:4033: result: no" >&5 -+ echo "$as_me:3835: result: no" >&5 - echo "${ECHO_T}no" >&6 - fi - -@@ -4039,7 +3841,7 @@ - ac_ct_LD=$LD - # Extract the first word of "ld", so it can be a program name with args. - set dummy ld; ac_word=$2 --echo "$as_me:4042: checking for $ac_word" >&5 -+echo "$as_me:3844: checking for $ac_word" >&5 - echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 - if test "${ac_cv_prog_ac_ct_LD+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -4054,7 +3856,7 @@ - test -z "$ac_dir" && ac_dir=. - $as_executable_p "$ac_dir/$ac_word" || continue - ac_cv_prog_ac_ct_LD="ld" --echo "$as_me:4057: found $ac_dir/$ac_word" >&5 -+echo "$as_me:3859: found $ac_dir/$ac_word" >&5 - break - done - -@@ -4063,10 +3865,10 @@ - fi - ac_ct_LD=$ac_cv_prog_ac_ct_LD - if test -n "$ac_ct_LD"; then -- echo "$as_me:4066: result: $ac_ct_LD" >&5 -+ echo "$as_me:3868: result: $ac_ct_LD" >&5 - echo "${ECHO_T}$ac_ct_LD" >&6 - else -- echo "$as_me:4069: result: no" >&5 -+ echo "$as_me:3871: result: no" >&5 - echo "${ECHO_T}no" >&6 - fi - -@@ -4078,7 +3880,7 @@ - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. - set dummy ${ac_tool_prefix}ar; ac_word=$2 --echo "$as_me:4081: checking for $ac_word" >&5 -+echo "$as_me:3883: checking for $ac_word" >&5 - echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 - if test "${ac_cv_prog_AR+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -4093,7 +3895,7 @@ - test -z "$ac_dir" && ac_dir=. - $as_executable_p "$ac_dir/$ac_word" || continue - ac_cv_prog_AR="${ac_tool_prefix}ar" --echo "$as_me:4096: found $ac_dir/$ac_word" >&5 -+echo "$as_me:3898: found $ac_dir/$ac_word" >&5 - break - done - -@@ -4101,10 +3903,10 @@ - fi - AR=$ac_cv_prog_AR - if test -n "$AR"; then -- echo "$as_me:4104: result: $AR" >&5 -+ echo "$as_me:3906: result: $AR" >&5 - echo "${ECHO_T}$AR" >&6 - else -- echo "$as_me:4107: result: no" >&5 -+ echo "$as_me:3909: result: no" >&5 - echo "${ECHO_T}no" >&6 - fi - -@@ -4113,7 +3915,7 @@ - ac_ct_AR=$AR - # Extract the first word of "ar", so it can be a program name with args. - set dummy ar; ac_word=$2 --echo "$as_me:4116: checking for $ac_word" >&5 -+echo "$as_me:3918: checking for $ac_word" >&5 - echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 - if test "${ac_cv_prog_ac_ct_AR+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -4128,7 +3930,7 @@ - test -z "$ac_dir" && ac_dir=. - $as_executable_p "$ac_dir/$ac_word" || continue - ac_cv_prog_ac_ct_AR="ar" --echo "$as_me:4131: found $ac_dir/$ac_word" >&5 -+echo "$as_me:3933: found $ac_dir/$ac_word" >&5 - break - done - -@@ -4137,10 +3939,10 @@ - fi - ac_ct_AR=$ac_cv_prog_ac_ct_AR - if test -n "$ac_ct_AR"; then -- echo "$as_me:4140: result: $ac_ct_AR" >&5 -+ echo "$as_me:3942: result: $ac_ct_AR" >&5 - echo "${ECHO_T}$ac_ct_AR" >&6 - else -- echo "$as_me:4143: result: no" >&5 -+ echo "$as_me:3945: result: no" >&5 - echo "${ECHO_T}no" >&6 - fi - -@@ -4150,9 +3952,83 @@ - fi - - if test -n "$ac_tool_prefix"; then -+ # Extract the first word of "${ac_tool_prefix}nm", so it can be a program name with args. -+set dummy ${ac_tool_prefix}nm; ac_word=$2 -+echo "$as_me:3957: checking for $ac_word" >&5 -+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -+if test "${ac_cv_prog_NM+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ if test -n "$NM"; then -+ ac_cv_prog_NM="$NM" # Let the user override the test. -+else -+ ac_save_IFS=$IFS; IFS=$ac_path_separator -+ac_dummy="$PATH" -+for ac_dir in $ac_dummy; do -+ IFS=$ac_save_IFS -+ test -z "$ac_dir" && ac_dir=. -+ $as_executable_p "$ac_dir/$ac_word" || continue -+ac_cv_prog_NM="${ac_tool_prefix}nm" -+echo "$as_me:3972: found $ac_dir/$ac_word" >&5 -+break -+done -+ -+fi -+fi -+NM=$ac_cv_prog_NM -+if test -n "$NM"; then -+ echo "$as_me:3980: result: $NM" >&5 -+echo "${ECHO_T}$NM" >&6 -+else -+ echo "$as_me:3983: result: no" >&5 -+echo "${ECHO_T}no" >&6 -+fi -+ -+fi -+if test -z "$ac_cv_prog_NM"; then -+ ac_ct_NM=$NM -+ # Extract the first word of "nm", so it can be a program name with args. -+set dummy nm; ac_word=$2 -+echo "$as_me:3992: checking for $ac_word" >&5 -+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -+if test "${ac_cv_prog_ac_ct_NM+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ if test -n "$ac_ct_NM"; then -+ ac_cv_prog_ac_ct_NM="$ac_ct_NM" # Let the user override the test. -+else -+ ac_save_IFS=$IFS; IFS=$ac_path_separator -+ac_dummy="$PATH" -+for ac_dir in $ac_dummy; do -+ IFS=$ac_save_IFS -+ test -z "$ac_dir" && ac_dir=. -+ $as_executable_p "$ac_dir/$ac_word" || continue -+ac_cv_prog_ac_ct_NM="nm" -+echo "$as_me:4007: found $ac_dir/$ac_word" >&5 -+break -+done -+ -+ test -z "$ac_cv_prog_ac_ct_NM" && ac_cv_prog_ac_ct_NM="nm" -+fi -+fi -+ac_ct_NM=$ac_cv_prog_ac_ct_NM -+if test -n "$ac_ct_NM"; then -+ echo "$as_me:4016: result: $ac_ct_NM" >&5 -+echo "${ECHO_T}$ac_ct_NM" >&6 -+else -+ echo "$as_me:4019: result: no" >&5 -+echo "${ECHO_T}no" >&6 -+fi -+ -+ NM=$ac_ct_NM -+else -+ NM="$ac_cv_prog_NM" -+fi -+ -+if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. - set dummy ${ac_tool_prefix}ar; ac_word=$2 --echo "$as_me:4155: checking for $ac_word" >&5 -+echo "$as_me:4031: checking for $ac_word" >&5 - echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 - if test "${ac_cv_prog_AR+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -4167,7 +4043,7 @@ - test -z "$ac_dir" && ac_dir=. - $as_executable_p "$ac_dir/$ac_word" || continue - ac_cv_prog_AR="${ac_tool_prefix}ar" --echo "$as_me:4170: found $ac_dir/$ac_word" >&5 -+echo "$as_me:4046: found $ac_dir/$ac_word" >&5 - break - done - -@@ -4175,10 +4051,10 @@ - fi - AR=$ac_cv_prog_AR - if test -n "$AR"; then -- echo "$as_me:4178: result: $AR" >&5 -+ echo "$as_me:4054: result: $AR" >&5 - echo "${ECHO_T}$AR" >&6 - else -- echo "$as_me:4181: result: no" >&5 -+ echo "$as_me:4057: result: no" >&5 - echo "${ECHO_T}no" >&6 - fi - -@@ -4187,7 +4063,7 @@ - ac_ct_AR=$AR - # Extract the first word of "ar", so it can be a program name with args. - set dummy ar; ac_word=$2 --echo "$as_me:4190: checking for $ac_word" >&5 -+echo "$as_me:4066: checking for $ac_word" >&5 - echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 - if test "${ac_cv_prog_ac_ct_AR+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -4202,7 +4078,7 @@ - test -z "$ac_dir" && ac_dir=. - $as_executable_p "$ac_dir/$ac_word" || continue - ac_cv_prog_ac_ct_AR="ar" --echo "$as_me:4205: found $ac_dir/$ac_word" >&5 -+echo "$as_me:4081: found $ac_dir/$ac_word" >&5 - break - done - -@@ -4211,10 +4087,10 @@ - fi - ac_ct_AR=$ac_cv_prog_ac_ct_AR - if test -n "$ac_ct_AR"; then -- echo "$as_me:4214: result: $ac_ct_AR" >&5 -+ echo "$as_me:4090: result: $ac_ct_AR" >&5 - echo "${ECHO_T}$ac_ct_AR" >&6 - else -- echo "$as_me:4217: result: no" >&5 -+ echo "$as_me:4093: result: no" >&5 - echo "${ECHO_T}no" >&6 - fi - -@@ -4223,7 +4099,7 @@ - AR="$ac_cv_prog_AR" - fi - --echo "$as_me:4226: checking for options to update archives" >&5 -+echo "$as_me:4102: checking for options to update archives" >&5 - echo $ECHO_N "checking for options to update archives... $ECHO_C" >&6 - if test "${cf_cv_ar_flags+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -4246,13 +4122,13 @@ - rm -f conftest.a - - cat >conftest.$ac_ext <&5 -+ if { (eval echo "$as_me:4128: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:4255: \$? = $ac_status" >&5 -+ echo "$as_me:4131: \$? = $ac_status" >&5 - (exit $ac_status); } ; then - echo "$AR $ARFLAGS $cf_ar_flags conftest.a conftest.$ac_cv_objext" >&5 - $AR $ARFLAGS $cf_ar_flags conftest.a conftest.$ac_cv_objext 2>&5 1>/dev/null -@@ -4263,7 +4139,7 @@ - else - test -n "$verbose" && echo " cannot compile test-program" 1>&6 - --echo "${as_me:-configure}:4266: testing cannot compile test-program ..." 1>&5 -+echo "${as_me:-configure}:4142: testing cannot compile test-program ..." 1>&5 - - break - fi -@@ -4271,7 +4147,7 @@ - rm -f conftest.a conftest.$ac_ext conftest.$ac_cv_objext - - fi --echo "$as_me:4274: result: $cf_cv_ar_flags" >&5 -+echo "$as_me:4150: result: $cf_cv_ar_flags" >&5 - echo "${ECHO_T}$cf_cv_ar_flags" >&6 - - if test -n "$ARFLAGS" ; then -@@ -4282,20 +4158,20 @@ - ARFLAGS=$cf_cv_ar_flags - fi - --echo "$as_me:4285: checking if you have specified an install-prefix" >&5 -+echo "$as_me:4161: checking if you have specified an install-prefix" >&5 - echo $ECHO_N "checking if you have specified an install-prefix... $ECHO_C" >&6 - - # Check whether --with-install-prefix or --without-install-prefix was given. - if test "${with_install_prefix+set}" = set; then - withval="$with_install_prefix" -- case "$withval" in #(vi -- yes|no) #(vi -+ case "x$withval" in #(vi -+ xyes|xno) #(vi - ;; - *) DESTDIR="$withval" - ;; - esac - fi; --echo "$as_me:4298: result: $DESTDIR" >&5 -+echo "$as_me:4174: result: $DESTDIR" >&5 - echo "${ECHO_T}$DESTDIR" >&6 - - ############################################################################### -@@ -4323,7 +4199,7 @@ - do - # Extract the first word of "$ac_prog", so it can be a program name with args. - set dummy $ac_prog; ac_word=$2 --echo "$as_me:4326: checking for $ac_word" >&5 -+echo "$as_me:4202: checking for $ac_word" >&5 - echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 - if test "${ac_cv_prog_BUILD_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -4338,7 +4214,7 @@ - test -z "$ac_dir" && ac_dir=. - $as_executable_p "$ac_dir/$ac_word" || continue - ac_cv_prog_BUILD_CC="$ac_prog" --echo "$as_me:4341: found $ac_dir/$ac_word" >&5 -+echo "$as_me:4217: found $ac_dir/$ac_word" >&5 - break - done - -@@ -4346,10 +4222,10 @@ - fi - BUILD_CC=$ac_cv_prog_BUILD_CC - if test -n "$BUILD_CC"; then -- echo "$as_me:4349: result: $BUILD_CC" >&5 -+ echo "$as_me:4225: result: $BUILD_CC" >&5 - echo "${ECHO_T}$BUILD_CC" >&6 - else -- echo "$as_me:4352: result: no" >&5 -+ echo "$as_me:4228: result: no" >&5 - echo "${ECHO_T}no" >&6 - fi - -@@ -4357,12 +4233,12 @@ - done - - fi; -- echo "$as_me:4360: checking for native build C compiler" >&5 -+ echo "$as_me:4236: checking for native build C compiler" >&5 - echo $ECHO_N "checking for native build C compiler... $ECHO_C" >&6 -- echo "$as_me:4362: result: $BUILD_CC" >&5 -+ echo "$as_me:4238: result: $BUILD_CC" >&5 - echo "${ECHO_T}$BUILD_CC" >&6 - -- echo "$as_me:4365: checking for native build C preprocessor" >&5 -+ echo "$as_me:4241: checking for native build C preprocessor" >&5 - echo $ECHO_N "checking for native build C preprocessor... $ECHO_C" >&6 - - # Check whether --with-build-cpp or --without-build-cpp was given. -@@ -4372,10 +4248,10 @@ - else - BUILD_CPP='${BUILD_CC} -E' - fi; -- echo "$as_me:4375: result: $BUILD_CPP" >&5 -+ echo "$as_me:4251: result: $BUILD_CPP" >&5 - echo "${ECHO_T}$BUILD_CPP" >&6 - -- echo "$as_me:4378: checking for native build C flags" >&5 -+ echo "$as_me:4254: checking for native build C flags" >&5 - echo $ECHO_N "checking for native build C flags... $ECHO_C" >&6 - - # Check whether --with-build-cflags or --without-build-cflags was given. -@@ -4383,10 +4259,10 @@ - withval="$with_build_cflags" - BUILD_CFLAGS="$withval" - fi; -- echo "$as_me:4386: result: $BUILD_CFLAGS" >&5 -+ echo "$as_me:4262: result: $BUILD_CFLAGS" >&5 - echo "${ECHO_T}$BUILD_CFLAGS" >&6 - -- echo "$as_me:4389: checking for native build C preprocessor-flags" >&5 -+ echo "$as_me:4265: checking for native build C preprocessor-flags" >&5 - echo $ECHO_N "checking for native build C preprocessor-flags... $ECHO_C" >&6 - - # Check whether --with-build-cppflags or --without-build-cppflags was given. -@@ -4394,10 +4270,10 @@ - withval="$with_build_cppflags" - BUILD_CPPFLAGS="$withval" - fi; -- echo "$as_me:4397: result: $BUILD_CPPFLAGS" >&5 -+ echo "$as_me:4273: result: $BUILD_CPPFLAGS" >&5 - echo "${ECHO_T}$BUILD_CPPFLAGS" >&6 - -- echo "$as_me:4400: checking for native build linker-flags" >&5 -+ echo "$as_me:4276: checking for native build linker-flags" >&5 - echo $ECHO_N "checking for native build linker-flags... $ECHO_C" >&6 - - # Check whether --with-build-ldflags or --without-build-ldflags was given. -@@ -4405,10 +4281,10 @@ - withval="$with_build_ldflags" - BUILD_LDFLAGS="$withval" - fi; -- echo "$as_me:4408: result: $BUILD_LDFLAGS" >&5 -+ echo "$as_me:4284: result: $BUILD_LDFLAGS" >&5 - echo "${ECHO_T}$BUILD_LDFLAGS" >&6 - -- echo "$as_me:4411: checking for native build linker-libraries" >&5 -+ echo "$as_me:4287: checking for native build linker-libraries" >&5 - echo $ECHO_N "checking for native build linker-libraries... $ECHO_C" >&6 - - # Check whether --with-build-libs or --without-build-libs was given. -@@ -4416,7 +4292,7 @@ - withval="$with_build_libs" - BUILD_LIBS="$withval" - fi; -- echo "$as_me:4419: result: $BUILD_LIBS" >&5 -+ echo "$as_me:4295: result: $BUILD_LIBS" >&5 - echo "${ECHO_T}$BUILD_LIBS" >&6 - - # this assumes we're on Unix. -@@ -4426,7 +4302,7 @@ - : ${BUILD_CC:='${CC}'} - - if ( test "$BUILD_CC" = "$CC" || test "$BUILD_CC" = '${CC}' ) ; then -- { { echo "$as_me:4429: error: Cross-build requires two compilers. -+ { { echo "$as_me:4305: error: Cross-build requires two compilers. - Use --with-build-cc to specify the native compiler." >&5 - echo "$as_me: error: Cross-build requires two compilers. - Use --with-build-cc to specify the native compiler." >&2;} -@@ -4451,7 +4327,7 @@ - ### shared, for example. - cf_list_models="" - --echo "$as_me:4454: checking if libtool -version-number should be used" >&5 -+echo "$as_me:4330: checking if libtool -version-number should be used" >&5 - echo $ECHO_N "checking if libtool -version-number should be used... $ECHO_C" >&6 - - # Check whether --enable-libtool-version or --disable-libtool-version was given. -@@ -4468,7 +4344,7 @@ - cf_libtool_version=yes - - fi; --echo "$as_me:4471: result: $cf_libtool_version" >&5 -+echo "$as_me:4347: result: $cf_libtool_version" >&5 - echo "${ECHO_T}$cf_libtool_version" >&6 - - if test "$cf_libtool_version" = yes ; then -@@ -4493,7 +4369,7 @@ - LIB_INSTALL= - LIB_UNINSTALL= - --echo "$as_me:4496: checking if you want to build libraries with libtool" >&5 -+echo "$as_me:4372: checking if you want to build libraries with libtool" >&5 - echo $ECHO_N "checking if you want to build libraries with libtool... $ECHO_C" >&6 - - # Check whether --with-libtool or --without-libtool was given. -@@ -4503,7 +4379,7 @@ - else - with_libtool=no - fi; --echo "$as_me:4506: result: $with_libtool" >&5 -+echo "$as_me:4382: result: $with_libtool" >&5 - echo "${ECHO_T}$with_libtool" >&6 - if test "$with_libtool" != "no"; then - -@@ -4522,7 +4398,7 @@ - ;; - .[a-zA-Z]:[\\/]*) #(vi OS/2 EMX - ;; --.\${*prefix}*) #(vi -+.\${*prefix}*|.\${*dir}*) #(vi - eval with_libtool="$with_libtool" - case ".$with_libtool" in #(vi - .NONE/*) -@@ -4534,7 +4410,7 @@ - with_libtool=`echo $with_libtool | sed -e s%NONE%$cf_path_syntax%` - ;; - *) -- { { echo "$as_me:4537: error: expected a pathname, not \"$with_libtool\"" >&5 -+ { { echo "$as_me:4413: error: expected a pathname, not \"$with_libtool\"" >&5 - echo "$as_me: error: expected a pathname, not \"$with_libtool\"" >&2;} - { (exit 1); exit 1; }; } - ;; -@@ -4542,50 +4418,199 @@ - - LIBTOOL=$with_libtool - else -- # Extract the first word of "libtool", so it can be a program name with args. --set dummy libtool; ac_word=$2 --echo "$as_me:4547: checking for $ac_word" >&5 -+ if test -n "$ac_tool_prefix"; then -+ for ac_prog in libtool glibtool -+ do -+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -+set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -+echo "$as_me:4426: checking for $ac_word" >&5 - echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 --if test "${ac_cv_path_LIBTOOL+set}" = set; then -+if test "${ac_cv_prog_LIBTOOL+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else -- case $LIBTOOL in -- [\\/]* | ?:[\\/]*) -- ac_cv_path_LIBTOOL="$LIBTOOL" # Let the user override the test with a path. -- ;; -- *) -+ if test -n "$LIBTOOL"; then -+ ac_cv_prog_LIBTOOL="$LIBTOOL" # Let the user override the test. -+else - ac_save_IFS=$IFS; IFS=$ac_path_separator - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - IFS=$ac_save_IFS - test -z "$ac_dir" && ac_dir=. -- if $as_executable_p "$ac_dir/$ac_word"; then -- ac_cv_path_LIBTOOL="$ac_dir/$ac_word" -- echo "$as_me:4564: found $ac_dir/$ac_word" >&5 -- break -+ $as_executable_p "$ac_dir/$ac_word" || continue -+ac_cv_prog_LIBTOOL="$ac_tool_prefix$ac_prog" -+echo "$as_me:4441: found $ac_dir/$ac_word" >&5 -+break -+done -+ -+fi -+fi -+LIBTOOL=$ac_cv_prog_LIBTOOL -+if test -n "$LIBTOOL"; then -+ echo "$as_me:4449: result: $LIBTOOL" >&5 -+echo "${ECHO_T}$LIBTOOL" >&6 -+else -+ echo "$as_me:4452: result: no" >&5 -+echo "${ECHO_T}no" >&6 -+fi -+ -+ test -n "$LIBTOOL" && break -+ done -+fi -+if test -z "$LIBTOOL"; then -+ ac_ct_LIBTOOL=$LIBTOOL -+ for ac_prog in libtool glibtool -+do -+ # Extract the first word of "$ac_prog", so it can be a program name with args. -+set dummy $ac_prog; ac_word=$2 -+echo "$as_me:4465: checking for $ac_word" >&5 -+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -+if test "${ac_cv_prog_ac_ct_LIBTOOL+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ if test -n "$ac_ct_LIBTOOL"; then -+ ac_cv_prog_ac_ct_LIBTOOL="$ac_ct_LIBTOOL" # Let the user override the test. -+else -+ ac_save_IFS=$IFS; IFS=$ac_path_separator -+ac_dummy="$PATH" -+for ac_dir in $ac_dummy; do -+ IFS=$ac_save_IFS -+ test -z "$ac_dir" && ac_dir=. -+ $as_executable_p "$ac_dir/$ac_word" || continue -+ac_cv_prog_ac_ct_LIBTOOL="$ac_prog" -+echo "$as_me:4480: found $ac_dir/$ac_word" >&5 -+break -+done -+ -+fi - fi -+ac_ct_LIBTOOL=$ac_cv_prog_ac_ct_LIBTOOL -+if test -n "$ac_ct_LIBTOOL"; then -+ echo "$as_me:4488: result: $ac_ct_LIBTOOL" >&5 -+echo "${ECHO_T}$ac_ct_LIBTOOL" >&6 -+else -+ echo "$as_me:4491: result: no" >&5 -+echo "${ECHO_T}no" >&6 -+fi -+ -+ test -n "$ac_ct_LIBTOOL" && break - done -+test -n "$ac_ct_LIBTOOL" || ac_ct_LIBTOOL="none" - -- ;; --esac -+ LIBTOOL=$ac_ct_LIBTOOL -+fi -+ -+if test -n "$LIBTOOL" && test "$LIBTOOL" != none -+then -+ cf_cv_libtool_version=`$LIBTOOL --version 2>&1 | sed -e '/^$/d' |sed -e '2,$d' -e 's/([^)]*)//g' -e 's/^[^1-9]*//' -e 's/[^0-9.].*//'` -+else -+ cf_cv_libtool_version= - fi --LIBTOOL=$ac_cv_path_LIBTOOL -+test -z "$cf_cv_libtool_version" && unset cf_cv_libtool_version -+ -+ if test -z "$cf_cv_libtool_version" && test "$LIBTOOL" = libtool -+ then -+ -+unset ac_cv_prog_ac_ct_LIBTOOL -+unset ac_ct_LIBTOOL -+unset LIBTOOL -+ -+ if test -n "$ac_tool_prefix"; then -+ for ac_prog in glibtool -+ do -+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -+set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -+echo "$as_me:4522: checking for $ac_word" >&5 -+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -+if test "${ac_cv_prog_LIBTOOL+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ if test -n "$LIBTOOL"; then -+ ac_cv_prog_LIBTOOL="$LIBTOOL" # Let the user override the test. -+else -+ ac_save_IFS=$IFS; IFS=$ac_path_separator -+ac_dummy="$PATH" -+for ac_dir in $ac_dummy; do -+ IFS=$ac_save_IFS -+ test -z "$ac_dir" && ac_dir=. -+ $as_executable_p "$ac_dir/$ac_word" || continue -+ac_cv_prog_LIBTOOL="$ac_tool_prefix$ac_prog" -+echo "$as_me:4537: found $ac_dir/$ac_word" >&5 -+break -+done - -+fi -+fi -+LIBTOOL=$ac_cv_prog_LIBTOOL - if test -n "$LIBTOOL"; then -- echo "$as_me:4575: result: $LIBTOOL" >&5 -+ echo "$as_me:4545: result: $LIBTOOL" >&5 - echo "${ECHO_T}$LIBTOOL" >&6 - else -- echo "$as_me:4578: result: no" >&5 -+ echo "$as_me:4548: result: no" >&5 -+echo "${ECHO_T}no" >&6 -+fi -+ -+ test -n "$LIBTOOL" && break -+ done -+fi -+if test -z "$LIBTOOL"; then -+ ac_ct_LIBTOOL=$LIBTOOL -+ for ac_prog in glibtool -+do -+ # Extract the first word of "$ac_prog", so it can be a program name with args. -+set dummy $ac_prog; ac_word=$2 -+echo "$as_me:4561: checking for $ac_word" >&5 -+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -+if test "${ac_cv_prog_ac_ct_LIBTOOL+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ if test -n "$ac_ct_LIBTOOL"; then -+ ac_cv_prog_ac_ct_LIBTOOL="$ac_ct_LIBTOOL" # Let the user override the test. -+else -+ ac_save_IFS=$IFS; IFS=$ac_path_separator -+ac_dummy="$PATH" -+for ac_dir in $ac_dummy; do -+ IFS=$ac_save_IFS -+ test -z "$ac_dir" && ac_dir=. -+ $as_executable_p "$ac_dir/$ac_word" || continue -+ac_cv_prog_ac_ct_LIBTOOL="$ac_prog" -+echo "$as_me:4576: found $ac_dir/$ac_word" >&5 -+break -+done -+ -+fi -+fi -+ac_ct_LIBTOOL=$ac_cv_prog_ac_ct_LIBTOOL -+if test -n "$ac_ct_LIBTOOL"; then -+ echo "$as_me:4584: result: $ac_ct_LIBTOOL" >&5 -+echo "${ECHO_T}$ac_ct_LIBTOOL" >&6 -+else -+ echo "$as_me:4587: result: no" >&5 - echo "${ECHO_T}no" >&6 - fi - -+ test -n "$ac_ct_LIBTOOL" && break -+done -+test -n "$ac_ct_LIBTOOL" || ac_ct_LIBTOOL="none" -+ -+ LIBTOOL=$ac_ct_LIBTOOL -+fi -+ -+if test -n "$LIBTOOL" && test "$LIBTOOL" != none -+then -+ cf_cv_libtool_version=`$LIBTOOL --version 2>&1 | sed -e '/^$/d' |sed -e '2,$d' -e 's/([^)]*)//g' -e 's/^[^1-9]*//' -e 's/[^0-9.].*//'` -+else -+ cf_cv_libtool_version= -+fi -+test -z "$cf_cv_libtool_version" && unset cf_cv_libtool_version -+ -+ fi - fi - if test -z "$LIBTOOL" ; then -- { { echo "$as_me:4584: error: Cannot find libtool" >&5 -+ { { echo "$as_me:4609: error: Cannot find libtool" >&5 - echo "$as_me: error: Cannot find libtool" >&2;} - { (exit 1); exit 1; }; } - fi -- LIB_CREATE='${LIBTOOL} --mode=link ${CC} -rpath ${DESTDIR}${libdir} ${LIBTOOL_VERSION} `cut -f1 ${srcdir}/VERSION` ${LIBTOOL_OPTS} ${LT_UNDEF} -o' -+ LIB_CREATE='${LIBTOOL} --mode=link ${CC} -rpath ${DESTDIR}${libdir} ${LIBTOOL_VERSION} `cut -f1 ${srcdir}/VERSION` ${LIBTOOL_OPTS} ${LT_UNDEF} $(LIBS) -o' - LIB_OBJECT='${OBJECTS:.o=.lo}' - LIB_SUFFIX=.la - LIB_CLEAN='${LIBTOOL} --mode=clean' -@@ -4595,26 +4620,36 @@ - LIB_UNINSTALL='${LIBTOOL} --mode=uninstall' - LIB_PREP=: - -- # Show the version of libtool -- echo "$as_me:4599: checking version of libtool" >&5 --echo $ECHO_N "checking version of libtool... $ECHO_C" >&6 -- -- # Save the version in a cache variable - this is not entirely a good -- # thing, but the version string from libtool is very ugly, and for -- # bug reports it might be useful to have the original string. "(" -+if test -n "$LIBTOOL" && test "$LIBTOOL" != none -+then -+ echo "$as_me:4625: checking version of $LIBTOOL" >&5 -+echo $ECHO_N "checking version of $LIBTOOL... $ECHO_C" >&6 -+ -+if test -n "$LIBTOOL" && test "$LIBTOOL" != none -+then - cf_cv_libtool_version=`$LIBTOOL --version 2>&1 | sed -e '/^$/d' |sed -e '2,$d' -e 's/([^)]*)//g' -e 's/^[^1-9]*//' -e 's/[^0-9.].*//'` -- echo "$as_me:4606: result: $cf_cv_libtool_version" >&5 -+else -+ cf_cv_libtool_version= -+fi -+test -z "$cf_cv_libtool_version" && unset cf_cv_libtool_version -+ -+ echo "$as_me:4636: result: $cf_cv_libtool_version" >&5 - echo "${ECHO_T}$cf_cv_libtool_version" >&6 - if test -z "$cf_cv_libtool_version" ; then -- { { echo "$as_me:4609: error: This is not GNU libtool" >&5 -+ { { echo "$as_me:4639: error: This is not GNU libtool" >&5 - echo "$as_me: error: This is not GNU libtool" >&2;} - { (exit 1); exit 1; }; } - fi -+else -+ { { echo "$as_me:4644: error: GNU libtool has not been found" >&5 -+echo "$as_me: error: GNU libtool has not been found" >&2;} -+ { (exit 1); exit 1; }; } -+fi - - # special hack to add -no-undefined (which libtool should do for itself) - LT_UNDEF= - case "$cf_cv_system_name" in #(vi -- cygwin*|mingw32*|uwin*|aix[456]) #(vi -+ cygwin*|msys*|mingw32*|uwin*|aix[4-7]) #(vi - LT_UNDEF=-no-undefined - ;; - esac -@@ -4642,7 +4677,7 @@ - - else - --echo "$as_me:4645: checking if you want to build shared libraries" >&5 -+echo "$as_me:4680: checking if you want to build shared libraries" >&5 - echo $ECHO_N "checking if you want to build shared libraries... $ECHO_C" >&6 - - # Check whether --with-shared or --without-shared was given. -@@ -4652,11 +4687,11 @@ - else - with_shared=no - fi; --echo "$as_me:4655: result: $with_shared" >&5 -+echo "$as_me:4690: result: $with_shared" >&5 - echo "${ECHO_T}$with_shared" >&6 --test "$with_shared" = "yes" && cf_list_models="$cf_list_models shared" -+test "x$with_shared" = "xyes" && cf_list_models="$cf_list_models shared" - --echo "$as_me:4659: checking if you want to build static libraries" >&5 -+echo "$as_me:4694: checking if you want to build static libraries" >&5 - echo $ECHO_N "checking if you want to build static libraries... $ECHO_C" >&6 - - # Check whether --with-normal or --without-normal was given. -@@ -4666,11 +4701,11 @@ - else - with_normal=yes - fi; --echo "$as_me:4669: result: $with_normal" >&5 -+echo "$as_me:4704: result: $with_normal" >&5 - echo "${ECHO_T}$with_normal" >&6 --test "$with_normal" = "yes" && cf_list_models="$cf_list_models normal" -+test "x$with_normal" = "xyes" && cf_list_models="$cf_list_models normal" - --echo "$as_me:4673: checking if you want to build debug libraries" >&5 -+echo "$as_me:4708: checking if you want to build debug libraries" >&5 - echo $ECHO_N "checking if you want to build debug libraries... $ECHO_C" >&6 - - # Check whether --with-debug or --without-debug was given. -@@ -4680,11 +4715,11 @@ - else - with_debug=yes - fi; --echo "$as_me:4683: result: $with_debug" >&5 -+echo "$as_me:4718: result: $with_debug" >&5 - echo "${ECHO_T}$with_debug" >&6 --test "$with_debug" = "yes" && cf_list_models="$cf_list_models debug" -+test "x$with_debug" = "xyes" && cf_list_models="$cf_list_models debug" - --echo "$as_me:4687: checking if you want to build profiling libraries" >&5 -+echo "$as_me:4722: checking if you want to build profiling libraries" >&5 - echo $ECHO_N "checking if you want to build profiling libraries... $ECHO_C" >&6 - - # Check whether --with-profile or --without-profile was given. -@@ -4694,27 +4729,44 @@ - else - with_profile=no - fi; --echo "$as_me:4697: result: $with_profile" >&5 -+echo "$as_me:4732: result: $with_profile" >&5 - echo "${ECHO_T}$with_profile" >&6 --test "$with_profile" = "yes" && cf_list_models="$cf_list_models profile" -+test "x$with_profile" = "xyes" && cf_list_models="$cf_list_models profile" -+ -+fi -+ -+if test "X$cf_with_cxx_binding" != Xno; then -+if test "x$with_shared" = "xyes"; then -+echo "$as_me:4740: checking if you want to build C++ shared libraries" >&5 -+echo $ECHO_N "checking if you want to build C++ shared libraries... $ECHO_C" >&6 - -+# Check whether --with-cxx-shared or --without-cxx-shared was given. -+if test "${with_cxx_shared+set}" = set; then -+ withval="$with_cxx_shared" -+ with_shared_cxx=$withval -+else -+ with_shared_cxx=no -+fi; -+echo "$as_me:4750: result: $with_shared_cxx" >&5 -+echo "${ECHO_T}$with_shared_cxx" >&6 -+fi - fi - - ############################################################################### - --echo "$as_me:4705: checking for specified models" >&5 -+echo "$as_me:4757: checking for specified models" >&5 - echo $ECHO_N "checking for specified models... $ECHO_C" >&6 - test -z "$cf_list_models" && cf_list_models=normal - test "$with_libtool" != "no" && cf_list_models=libtool --echo "$as_me:4709: result: $cf_list_models" >&5 -+echo "$as_me:4761: result: $cf_list_models" >&5 - echo "${ECHO_T}$cf_list_models" >&6 - - ### Use the first model as the default, and save its suffix for use in building - ### up test-applications. --echo "$as_me:4714: checking for default model" >&5 -+echo "$as_me:4766: checking for default model" >&5 - echo $ECHO_N "checking for default model... $ECHO_C" >&6 - DFT_LWR_MODEL=`echo "$cf_list_models" | $AWK '{print $1}'` --echo "$as_me:4717: result: $DFT_LWR_MODEL" >&5 -+echo "$as_me:4769: result: $DFT_LWR_MODEL" >&5 - echo "${ECHO_T}$DFT_LWR_MODEL" >&6 - - DFT_UPR_MODEL=`echo "$DFT_LWR_MODEL" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` -@@ -4728,6 +4780,22 @@ - LIB_DIR=../lib - LIB_2ND=../../lib - -+echo "$as_me:4783: checking if you want to have a library-prefix" >&5 -+echo $ECHO_N "checking if you want to have a library-prefix... $ECHO_C" >&6 -+ -+# Check whether --with-lib-prefix or --without-lib-prefix was given. -+if test "${with_lib_prefix+set}" = set; then -+ withval="$with_lib_prefix" -+ with_lib_prefix=$withval -+else -+ with_lib_prefix=auto -+fi; -+echo "$as_me:4793: result: $with_lib_prefix" >&5 -+echo "${ECHO_T}$with_lib_prefix" >&6 -+ -+if test $with_lib_prefix = auto -+then -+ - case $cf_cv_system_name in #(vi - OS/2*|os2*) #(vi - LIB_PREFIX='' -@@ -4737,13 +4805,28 @@ - esac - cf_prefix=$LIB_PREFIX - --LIB_PREFIX=$cf_prefix -+elif test $with_lib_prefix = no -+then -+ LIB_PREFIX= -+else -+ LIB_PREFIX=$with_lib_prefix -+fi - - LIB_SUFFIX= - -+ echo "$as_me:4817: checking for PATH separator" >&5 -+echo $ECHO_N "checking for PATH separator... $ECHO_C" >&6 -+ case $cf_cv_system_name in -+ os2*) PATH_SEPARATOR=';' ;; -+ *) ${PATH_SEPARATOR:=':'} ;; -+ esac -+ -+ echo "$as_me:4824: result: $PATH_SEPARATOR" >&5 -+echo "${ECHO_T}$PATH_SEPARATOR" >&6 -+ - ############################################################################### - --echo "$as_me:4746: checking if you want to build a separate terminfo library" >&5 -+echo "$as_me:4829: checking if you want to build a separate terminfo library" >&5 - echo $ECHO_N "checking if you want to build a separate terminfo library... $ECHO_C" >&6 - - # Check whether --with-termlib or --without-termlib was given. -@@ -4753,10 +4836,10 @@ - else - with_termlib=no - fi; --echo "$as_me:4756: result: $with_termlib" >&5 -+echo "$as_me:4839: result: $with_termlib" >&5 - echo "${ECHO_T}$with_termlib" >&6 - --echo "$as_me:4759: checking if you want to build a separate tic library" >&5 -+echo "$as_me:4842: checking if you want to build a separate tic library" >&5 - echo $ECHO_N "checking if you want to build a separate tic library... $ECHO_C" >&6 - - # Check whether --with-ticlib or --without-ticlib was given. -@@ -4766,13 +4849,13 @@ - else - with_ticlib=no - fi; --echo "$as_me:4769: result: $with_ticlib" >&5 -+echo "$as_me:4852: result: $with_ticlib" >&5 - echo "${ECHO_T}$with_ticlib" >&6 - - ### Checks for special libraries, must be done up-front. - SHLIB_LIST="" - --echo "$as_me:4775: checking if you want to link with the GPM mouse library" >&5 -+echo "$as_me:4858: checking if you want to link with the GPM mouse library" >&5 - echo $ECHO_N "checking if you want to link with the GPM mouse library... $ECHO_C" >&6 - - # Check whether --with-gpm or --without-gpm was given. -@@ -4782,27 +4865,27 @@ - else - with_gpm=maybe - fi; --echo "$as_me:4785: result: $with_gpm" >&5 -+echo "$as_me:4868: result: $with_gpm" >&5 - echo "${ECHO_T}$with_gpm" >&6 - - if test "$with_gpm" != no ; then -- echo "$as_me:4789: checking for gpm.h" >&5 -+ echo "$as_me:4872: checking for gpm.h" >&5 - echo $ECHO_N "checking for gpm.h... $ECHO_C" >&6 - if test "${ac_cv_header_gpm_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - cat >conftest.$ac_ext <<_ACEOF --#line 4795 "configure" -+#line 4878 "configure" - #include "confdefs.h" - #include - _ACEOF --if { (eval echo "$as_me:4799: \"$ac_cpp conftest.$ac_ext\"") >&5 -+if { (eval echo "$as_me:4882: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 -- echo "$as_me:4805: \$? = $ac_status" >&5 -+ echo "$as_me:4888: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag -@@ -4821,25 +4904,25 @@ - fi - rm -f conftest.err conftest.$ac_ext - fi --echo "$as_me:4824: result: $ac_cv_header_gpm_h" >&5 -+echo "$as_me:4907: result: $ac_cv_header_gpm_h" >&5 - echo "${ECHO_T}$ac_cv_header_gpm_h" >&6 - if test $ac_cv_header_gpm_h = yes; then - -- cat >>confdefs.h <<\EOF -+cat >>confdefs.h <<\EOF - #define HAVE_GPM_H 1 - EOF - - if test "$with_gpm" != yes && test "$with_gpm" != maybe ; then - test -n "$verbose" && echo " assuming we really have GPM library" 1>&6 - --echo "${as_me:-configure}:4835: testing assuming we really have GPM library ..." 1>&5 -+echo "${as_me:-configure}:4918: testing assuming we really have GPM library ..." 1>&5 - -- cat >>confdefs.h <<\EOF -+cat >>confdefs.h <<\EOF - #define HAVE_LIBGPM 1 - EOF - - else -- echo "$as_me:4842: checking for Gpm_Open in -lgpm" >&5 -+ echo "$as_me:4925: checking for Gpm_Open in -lgpm" >&5 - echo $ECHO_N "checking for Gpm_Open in -lgpm... $ECHO_C" >&6 - if test "${ac_cv_lib_gpm_Gpm_Open+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -4847,7 +4930,7 @@ - ac_check_lib_save_LIBS=$LIBS - LIBS="-lgpm $LIBS" - cat >conftest.$ac_ext <<_ACEOF --#line 4850 "configure" -+#line 4933 "configure" - #include "confdefs.h" - - /* Override any gcc2 internal prototype to avoid an error. */ -@@ -4866,16 +4949,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:4869: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:4952: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:4872: \$? = $ac_status" >&5 -+ echo "$as_me:4955: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:4875: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:4958: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:4878: \$? = $ac_status" >&5 -+ echo "$as_me:4961: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_gpm_Gpm_Open=yes - else -@@ -4886,13 +4969,13 @@ - rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - LIBS=$ac_check_lib_save_LIBS - fi --echo "$as_me:4889: result: $ac_cv_lib_gpm_Gpm_Open" >&5 -+echo "$as_me:4972: result: $ac_cv_lib_gpm_Gpm_Open" >&5 - echo "${ECHO_T}$ac_cv_lib_gpm_Gpm_Open" >&6 - if test $ac_cv_lib_gpm_Gpm_Open = yes; then - : - else - -- { { echo "$as_me:4895: error: Cannot link with GPM library" >&5 -+ { { echo "$as_me:4978: error: Cannot link with GPM library" >&5 - echo "$as_me: error: Cannot link with GPM library" >&2;} - { (exit 1); exit 1; }; } - fi -@@ -4902,7 +4985,7 @@ - - else - -- test "$with_gpm" != maybe && { echo "$as_me:4905: WARNING: Cannot find GPM header" >&5 -+ test "$with_gpm" != maybe && { echo "$as_me:4988: WARNING: Cannot find GPM header" >&5 - echo "$as_me: WARNING: Cannot find GPM header" >&2;} - with_gpm=no - -@@ -4911,7 +4994,7 @@ - fi - - if test "$with_gpm" != no ; then -- echo "$as_me:4914: checking if you want to load GPM dynamically" >&5 -+ echo "$as_me:4997: checking if you want to load GPM dynamically" >&5 - echo $ECHO_N "checking if you want to load GPM dynamically... $ECHO_C" >&6 - - # Check whether --with-dlsym or --without-dlsym was given. -@@ -4921,18 +5004,18 @@ - else - with_dlsym=yes - fi; -- echo "$as_me:4924: result: $with_dlsym" >&5 -+ echo "$as_me:5007: result: $with_dlsym" >&5 - echo "${ECHO_T}$with_dlsym" >&6 -- if test "$with_dlsym" = yes ; then -+ if test "x$with_dlsym" = xyes ; then - - cf_have_dlsym=no --echo "$as_me:4929: checking for dlsym" >&5 -+echo "$as_me:5012: checking for dlsym" >&5 - echo $ECHO_N "checking for dlsym... $ECHO_C" >&6 - if test "${ac_cv_func_dlsym+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - cat >conftest.$ac_ext <<_ACEOF --#line 4935 "configure" -+#line 5018 "configure" - #include "confdefs.h" - /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char dlsym (); below. */ -@@ -4955,7 +5038,7 @@ - #if defined (__stub_dlsym) || defined (__stub___dlsym) - choke me - #else --f = dlsym; -+f = dlsym; /* workaround for ICC 12.0.3 */ if (f == 0) return 1; - #endif - - ; -@@ -4963,16 +5046,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:4966: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:5049: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:4969: \$? = $ac_status" >&5 -+ echo "$as_me:5052: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:4972: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:5055: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:4975: \$? = $ac_status" >&5 -+ echo "$as_me:5058: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_func_dlsym=yes - else -@@ -4982,14 +5065,14 @@ - fi - rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - fi --echo "$as_me:4985: result: $ac_cv_func_dlsym" >&5 -+echo "$as_me:5068: result: $ac_cv_func_dlsym" >&5 - echo "${ECHO_T}$ac_cv_func_dlsym" >&6 - if test $ac_cv_func_dlsym = yes; then - cf_have_dlsym=yes - else - - cf_have_libdl=no --echo "$as_me:4992: checking for dlsym in -ldl" >&5 -+echo "$as_me:5075: checking for dlsym in -ldl" >&5 - echo $ECHO_N "checking for dlsym in -ldl... $ECHO_C" >&6 - if test "${ac_cv_lib_dl_dlsym+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -4997,7 +5080,7 @@ - ac_check_lib_save_LIBS=$LIBS - LIBS="-ldl $LIBS" - cat >conftest.$ac_ext <<_ACEOF --#line 5000 "configure" -+#line 5083 "configure" - #include "confdefs.h" - - /* Override any gcc2 internal prototype to avoid an error. */ -@@ -5016,16 +5099,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:5019: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:5102: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:5022: \$? = $ac_status" >&5 -+ echo "$as_me:5105: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:5025: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:5108: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:5028: \$? = $ac_status" >&5 -+ echo "$as_me:5111: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_dl_dlsym=yes - else -@@ -5036,7 +5119,7 @@ - rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - LIBS=$ac_check_lib_save_LIBS - fi --echo "$as_me:5039: result: $ac_cv_lib_dl_dlsym" >&5 -+echo "$as_me:5122: result: $ac_cv_lib_dl_dlsym" >&5 - echo "${ECHO_T}$ac_cv_lib_dl_dlsym" >&6 - if test $ac_cv_lib_dl_dlsym = yes; then - -@@ -5049,10 +5132,10 @@ - if test "$cf_have_dlsym" = yes ; then - test "$cf_have_libdl" = yes && LIBS="-ldl $LIBS" - -- echo "$as_me:5052: checking whether able to link to dl*() functions" >&5 -+ echo "$as_me:5135: checking whether able to link to dl*() functions" >&5 - echo $ECHO_N "checking whether able to link to dl*() functions... $ECHO_C" >&6 - cat >conftest.$ac_ext <<_ACEOF --#line 5055 "configure" -+#line 5138 "configure" - #include "confdefs.h" - #include - int -@@ -5070,19 +5153,19 @@ - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:5073: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:5156: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:5076: \$? = $ac_status" >&5 -+ echo "$as_me:5159: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:5079: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:5162: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:5082: \$? = $ac_status" >&5 -+ echo "$as_me:5165: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - -- cat >>confdefs.h <<\EOF -+cat >>confdefs.h <<\EOF - #define HAVE_LIBDL 1 - EOF - -@@ -5090,28 +5173,28 @@ - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 - -- { { echo "$as_me:5093: error: Cannot link test program for libdl" >&5 -+ { { echo "$as_me:5176: error: Cannot link test program for libdl" >&5 - echo "$as_me: error: Cannot link test program for libdl" >&2;} - { (exit 1); exit 1; }; } - fi - rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -- echo "$as_me:5098: result: ok" >&5 -+ echo "$as_me:5181: result: ok" >&5 - echo "${ECHO_T}ok" >&6 - else -- { { echo "$as_me:5101: error: Cannot find dlsym function" >&5 -+ { { echo "$as_me:5184: error: Cannot find dlsym function" >&5 - echo "$as_me: error: Cannot find dlsym function" >&2;} - { (exit 1); exit 1; }; } - fi - -- if test "$with_gpm" != yes ; then -+ if test "x$with_gpm" != xyes ; then - test -n "$verbose" && echo " assuming soname for gpm is $with_gpm" 1>&6 - --echo "${as_me:-configure}:5109: testing assuming soname for gpm is $with_gpm ..." 1>&5 -+echo "${as_me:-configure}:5192: testing assuming soname for gpm is $with_gpm ..." 1>&5 - - cf_cv_gpm_soname="$with_gpm" - else - --echo "$as_me:5114: checking for soname of gpm library" >&5 -+echo "$as_me:5197: checking for soname of gpm library" >&5 - echo $ECHO_N "checking for soname of gpm library... $ECHO_C" >&6 - if test "${cf_cv_gpm_soname+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -5129,15 +5212,15 @@ - CF_EOF - cf_save_LIBS="$LIBS" - LIBS="-lgpm $LIBS" -- if { (eval echo "$as_me:5132: \"$ac_compile\"") >&5 -+ if { (eval echo "$as_me:5215: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:5135: \$? = $ac_status" >&5 -+ echo "$as_me:5218: \$? = $ac_status" >&5 - (exit $ac_status); } ; then -- if { (eval echo "$as_me:5137: \"$ac_link\"") >&5 -+ if { (eval echo "$as_me:5220: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:5140: \$? = $ac_status" >&5 -+ echo "$as_me:5223: \$? = $ac_status" >&5 - (exit $ac_status); } ; then - cf_cv_gpm_soname=`ldd conftest$ac_exeext 2>/dev/null | sed -e 's,^.*/,,' -e 's, .*$,,' | fgrep libgpm.` - test -z "$cf_cv_gpm_soname" && cf_cv_gpm_soname=unknown -@@ -5148,11 +5231,12 @@ - fi - - fi --echo "$as_me:5151: result: $cf_cv_gpm_soname" >&5 -+echo "$as_me:5234: result: $cf_cv_gpm_soname" >&5 - echo "${ECHO_T}$cf_cv_gpm_soname" >&6 - - fi -- test "$cf_cv_gpm_soname" != "unknown" && cat >>confdefs.h <>confdefs.h <>confdefs.h <<\EOF -+ -+cat >>confdefs.h <<\EOF - #define HAVE_LIBGPM 1 - EOF - --echo "$as_me:5168: checking for Gpm_Wgetch in -lgpm" >&5 -+echo "$as_me:5253: checking for Gpm_Wgetch in -lgpm" >&5 - echo $ECHO_N "checking for Gpm_Wgetch in -lgpm... $ECHO_C" >&6 - if test "${ac_cv_lib_gpm_Gpm_Wgetch+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -5173,7 +5258,7 @@ - ac_check_lib_save_LIBS=$LIBS - LIBS="-lgpm $LIBS" - cat >conftest.$ac_ext <<_ACEOF --#line 5176 "configure" -+#line 5261 "configure" - #include "confdefs.h" - - /* Override any gcc2 internal prototype to avoid an error. */ -@@ -5192,16 +5277,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:5195: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:5280: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:5198: \$? = $ac_status" >&5 -+ echo "$as_me:5283: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:5201: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:5286: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:5204: \$? = $ac_status" >&5 -+ echo "$as_me:5289: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_gpm_Gpm_Wgetch=yes - else -@@ -5212,11 +5297,11 @@ - rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - LIBS=$ac_check_lib_save_LIBS - fi --echo "$as_me:5215: result: $ac_cv_lib_gpm_Gpm_Wgetch" >&5 -+echo "$as_me:5300: result: $ac_cv_lib_gpm_Gpm_Wgetch" >&5 - echo "${ECHO_T}$ac_cv_lib_gpm_Gpm_Wgetch" >&6 - if test $ac_cv_lib_gpm_Gpm_Wgetch = yes; then - --echo "$as_me:5219: checking if GPM is weakly bound to curses library" >&5 -+echo "$as_me:5304: checking if GPM is weakly bound to curses library" >&5 - echo $ECHO_N "checking if GPM is weakly bound to curses library... $ECHO_C" >&6 - if test "${cf_cv_check_gpm_wgetch+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -5240,15 +5325,15 @@ - # to rely on the static library, noting that some packagers may not - # include it. - LIBS="-static -lgpm -dynamic $LIBS" -- if { (eval echo "$as_me:5243: \"$ac_compile\"") >&5 -+ if { (eval echo "$as_me:5328: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:5246: \$? = $ac_status" >&5 -+ echo "$as_me:5331: \$? = $ac_status" >&5 - (exit $ac_status); } ; then -- if { (eval echo "$as_me:5248: \"$ac_link\"") >&5 -+ if { (eval echo "$as_me:5333: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:5251: \$? = $ac_status" >&5 -+ echo "$as_me:5336: \$? = $ac_status" >&5 - (exit $ac_status); } ; then - cf_cv_check_gpm_wgetch=`nm conftest$ac_exeext | egrep '\' | egrep '\<[vVwW]\>'` - test -n "$cf_cv_check_gpm_wgetch" && cf_cv_check_gpm_wgetch=yes -@@ -5260,11 +5345,11 @@ - fi - - fi --echo "$as_me:5263: result: $cf_cv_check_gpm_wgetch" >&5 -+echo "$as_me:5348: result: $cf_cv_check_gpm_wgetch" >&5 - echo "${ECHO_T}$cf_cv_check_gpm_wgetch" >&6 - - if test "$cf_cv_check_gpm_wgetch" != yes ; then -- { echo "$as_me:5267: WARNING: GPM library is already linked with curses - read the FAQ" >&5 -+ { echo "$as_me:5352: WARNING: GPM library is already linked with curses - read the FAQ" >&5 - echo "$as_me: WARNING: GPM library is already linked with curses - read the FAQ" >&2;} - fi - -@@ -5274,7 +5359,7 @@ - - # not everyone has "test -c" - if test -c /dev/sysmouse 2>/dev/null ; then --echo "$as_me:5277: checking if you want to use sysmouse" >&5 -+echo "$as_me:5362: checking if you want to use sysmouse" >&5 - echo $ECHO_N "checking if you want to use sysmouse... $ECHO_C" >&6 - - # Check whether --with-sysmouse or --without-sysmouse was given. -@@ -5286,7 +5371,7 @@ - fi; - if test "$cf_with_sysmouse" != no ; then - cat >conftest.$ac_ext <<_ACEOF --#line 5289 "configure" -+#line 5374 "configure" - #include "confdefs.h" - - #include -@@ -5309,16 +5394,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:5312: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:5397: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:5315: \$? = $ac_status" >&5 -+ echo "$as_me:5400: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:5318: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:5403: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:5321: \$? = $ac_status" >&5 -+ echo "$as_me:5406: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_with_sysmouse=yes - else -@@ -5328,9 +5413,10 @@ - fi - rm -f conftest.$ac_objext conftest.$ac_ext - fi --echo "$as_me:5331: result: $cf_with_sysmouse" >&5 -+echo "$as_me:5416: result: $cf_with_sysmouse" >&5 - echo "${ECHO_T}$cf_with_sysmouse" >&6 --test "$cf_with_sysmouse" = yes && cat >>confdefs.h <<\EOF -+test "$cf_with_sysmouse" = yes && -+cat >>confdefs.h <<\EOF - #define USE_SYSMOUSE 1 - EOF - -@@ -5338,15 +5424,15 @@ - - if test X"$CC_G_OPT" = X"" ; then - CC_G_OPT='-g' -- test -n "$GCC" && test "${ac_cv_prog_cc_g}" != yes && CC_G_OPT='' -+ test -n "$GCC" && test "x${ac_cv_prog_cc_g}" != xyes && CC_G_OPT='' - fi - - if test X"$CXX_G_OPT" = X"" ; then - CXX_G_OPT='-g' -- test -n "$GXX" && test "${ac_cv_prog_cxx_g}" != yes && CXX_G_OPT='' -+ test -n "$GXX" && test "x${ac_cv_prog_cxx_g}" != xyes && CXX_G_OPT='' - fi - --echo "$as_me:5349: checking for default loader flags" >&5 -+echo "$as_me:5435: checking for default loader flags" >&5 - echo $ECHO_N "checking for default loader flags... $ECHO_C" >&6 - case $DFT_LWR_MODEL in - libtool) LD_MODEL='' ;; -@@ -5355,13 +5441,13 @@ - profile) LD_MODEL='-pg';; - shared) LD_MODEL='' ;; - esac --echo "$as_me:5358: result: $LD_MODEL" >&5 -+echo "$as_me:5444: result: $LD_MODEL" >&5 - echo "${ECHO_T}$LD_MODEL" >&6 - - case $DFT_LWR_MODEL in - shared) - --echo "$as_me:5364: checking if rpath option should be used" >&5 -+echo "$as_me:5450: checking if rpath option should be used" >&5 - echo $ECHO_N "checking if rpath option should be used... $ECHO_C" >&6 - - # Check whether --enable-rpath or --disable-rpath was given. -@@ -5371,10 +5457,10 @@ - else - cf_cv_enable_rpath=no - fi; --echo "$as_me:5374: result: $cf_cv_enable_rpath" >&5 -+echo "$as_me:5460: result: $cf_cv_enable_rpath" >&5 - echo "${ECHO_T}$cf_cv_enable_rpath" >&6 - --echo "$as_me:5377: checking if shared libraries should be relinked during install" >&5 -+echo "$as_me:5463: checking if shared libraries should be relinked during install" >&5 - echo $ECHO_N "checking if shared libraries should be relinked during install... $ECHO_C" >&6 - - # Check whether --enable-relink or --disable-relink was given. -@@ -5384,13 +5470,16 @@ - else - cf_cv_do_relink=yes - fi; --echo "$as_me:5387: result: $cf_cv_do_relink" >&5 -+echo "$as_me:5473: result: $cf_cv_do_relink" >&5 - echo "${ECHO_T}$cf_cv_do_relink" >&6 - ;; - esac - -+# we will build libraries one-level down. -+rel_builddir=.. -+ - LD_RPATH_OPT= --echo "$as_me:5393: checking for an rpath option" >&5 -+echo "$as_me:5482: checking for an rpath option" >&5 - echo $ECHO_N "checking for an rpath option... $ECHO_C" >&6 - case $cf_cv_system_name in #(vi - irix*) #(vi -@@ -5403,10 +5492,10 @@ - linux*|gnu*|k*bsd*-gnu) #(vi - LD_RPATH_OPT="-Wl,-rpath," - ;; --openbsd[2-9].*) #(vi -+openbsd[2-9].*|mirbsd*) #(vi - LD_RPATH_OPT="-Wl,-rpath," - ;; --freebsd*) #(vi -+dragonfly*|freebsd*) #(vi - LD_RPATH_OPT="-rpath " - ;; - netbsd*) #(vi -@@ -5421,17 +5510,17 @@ - *) - ;; - esac --echo "$as_me:5424: result: $LD_RPATH_OPT" >&5 -+echo "$as_me:5513: result: $LD_RPATH_OPT" >&5 - echo "${ECHO_T}$LD_RPATH_OPT" >&6 - - case "x$LD_RPATH_OPT" in #(vi - x-R*) -- echo "$as_me:5429: checking if we need a space after rpath option" >&5 -+ echo "$as_me:5518: checking if we need a space after rpath option" >&5 - echo $ECHO_N "checking if we need a space after rpath option... $ECHO_C" >&6 - cf_save_LIBS="$LIBS" - LIBS="${LD_RPATH_OPT}$libdir $LIBS" - cat >conftest.$ac_ext <<_ACEOF --#line 5434 "configure" -+#line 5523 "configure" - #include "confdefs.h" - - int -@@ -5443,16 +5532,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:5446: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:5535: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:5449: \$? = $ac_status" >&5 -+ echo "$as_me:5538: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:5452: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:5541: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:5455: \$? = $ac_status" >&5 -+ echo "$as_me:5544: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_rpath_space=no - else -@@ -5462,22 +5551,28 @@ - fi - rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - LIBS="$cf_save_LIBS" -- echo "$as_me:5465: result: $cf_rpath_space" >&5 -+ echo "$as_me:5554: result: $cf_rpath_space" >&5 - echo "${ECHO_T}$cf_rpath_space" >&6 - test "$cf_rpath_space" = yes && LD_RPATH_OPT="$LD_RPATH_OPT " - ;; - esac - -+ RM_SHARED_OPTS= - LOCAL_LDFLAGS= - LOCAL_LDFLAGS2= - LD_SHARED_OPTS= - INSTALL_LIB="-m 644" -+ : ${rel_builddir:=.} -+ -+ shlibdir=$libdir -+ -+ MAKE_DLLS="#" - - cf_cv_do_symlinks=no - cf_ld_rpath_opt= - test "$cf_cv_enable_rpath" = yes && cf_ld_rpath_opt="$LD_RPATH_OPT" - -- echo "$as_me:5480: checking if release/abi version should be used for shared libs" >&5 -+ echo "$as_me:5575: checking if release/abi version should be used for shared libs" >&5 - echo $ECHO_N "checking if release/abi version should be used for shared libs... $ECHO_C" >&6 - - # Check whether --with-shlib-version or --without-shlib-version was given. -@@ -5492,7 +5587,7 @@ - cf_cv_shlib_version=$withval - ;; - *) -- { { echo "$as_me:5495: error: option value must be one of: rel, abi, auto or no" >&5 -+ { { echo "$as_me:5590: error: option value must be one of: rel, abi, auto or no" >&5 - echo "$as_me: error: option value must be one of: rel, abi, auto or no" >&2;} - { (exit 1); exit 1; }; } - ;; -@@ -5501,23 +5596,24 @@ - else - cf_cv_shlib_version=auto - fi; -- echo "$as_me:5504: result: $cf_cv_shlib_version" >&5 -+ echo "$as_me:5599: result: $cf_cv_shlib_version" >&5 - echo "${ECHO_T}$cf_cv_shlib_version" >&6 - - cf_cv_rm_so_locs=no -+ cf_try_cflags= - - # Some less-capable ports of gcc support only -fpic - CC_SHARED_OPTS= - if test "$GCC" = yes - then -- echo "$as_me:5513: checking which $CC option to use" >&5 -+ echo "$as_me:5609: checking which $CC option to use" >&5 - echo $ECHO_N "checking which $CC option to use... $ECHO_C" >&6 - cf_save_CFLAGS="$CFLAGS" - for CC_SHARED_OPTS in -fPIC -fpic '' - do - CFLAGS="$cf_save_CFLAGS $CC_SHARED_OPTS" - cat >conftest.$ac_ext <<_ACEOF --#line 5520 "configure" -+#line 5616 "configure" - #include "confdefs.h" - #include - int -@@ -5529,16 +5625,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:5532: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:5628: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:5535: \$? = $ac_status" >&5 -+ echo "$as_me:5631: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:5538: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:5634: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:5541: \$? = $ac_status" >&5 -+ echo "$as_me:5637: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - break - else -@@ -5547,7 +5643,7 @@ - fi - rm -f conftest.$ac_objext conftest.$ac_ext - done -- echo "$as_me:5550: result: $CC_SHARED_OPTS" >&5 -+ echo "$as_me:5646: result: $CC_SHARED_OPTS" >&5 - echo "${ECHO_T}$CC_SHARED_OPTS" >&6 - CFLAGS="$cf_save_CFLAGS" - fi -@@ -5555,10 +5651,14 @@ - cf_cv_shlib_version_infix=no - - case $cf_cv_system_name in #(vi -- aix[56]*) #(vi -+ aix4.3-9*|aix[5-7]*) #(vi - if test "$GCC" = yes; then - CC_SHARED_OPTS= -- MK_SHARED_LIB='$(CC) -shared' -+ MK_SHARED_LIB='${CC} -shared -Wl,-brtl -Wl,-blibpath:${RPATH_LIST}:/usr/lib -o $@' -+ else -+ # CC_SHARED_OPTS='-qpic=large -G' -+ # perhaps "-bM:SRE -bnoentry -bexpall" -+ MK_SHARED_LIB='${CC} -G -Wl,-brtl -Wl,-blibpath:${RPATH_LIST}:/usr/lib -o $@' - fi - ;; - beos*) #(vi -@@ -5566,9 +5666,12 @@ - ;; - cygwin*) #(vi - CC_SHARED_OPTS= -- MK_SHARED_LIB='sh ../mk_shared_lib.sh $@ ${CC} ${CFLAGS}' -+ MK_SHARED_LIB='sh '$rel_builddir'/mk_shared_lib.sh $@ ${CC} ${CFLAGS}' -+ RM_SHARED_OPTS="$RM_SHARED_OPTS $rel_builddir/mk_shared_lib.sh *.dll.a" - cf_cv_shlib_version=cygdll - cf_cv_shlib_version_infix=cygdll -+ shlibdir=$bindir -+ MAKE_DLLS= - cat >mk_shared_lib.sh <<-CF_EOF - #!/bin/sh - SHARED_LIB=\$1 -@@ -5579,26 +5682,48 @@ - ** SHARED_LIB \$SHARED_LIB - ** IMPORT_LIB \$IMPORT_LIB - EOF -- exec \$* -shared -Wl,--out-implib=../lib/\${IMPORT_LIB} -Wl,--export-all-symbols -o ../lib/\${SHARED_LIB} -+ exec \$* -shared -Wl,--out-implib=\${IMPORT_LIB} -Wl,--export-all-symbols -o \${SHARED_LIB} - CF_EOF - chmod +x mk_shared_lib.sh - ;; -- darwin*) #(vi -- EXTRA_CFLAGS="-no-cpp-precomp" -- CC_SHARED_OPTS="-dynamic" -- MK_SHARED_LIB='${CC} ${CFLAGS} -dynamiclib -install_name ${libdir}/`basename $@` -compatibility_version ${ABI_VERSION} -current_version ${ABI_VERSION} -o $@' -- test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=abi -- cf_cv_shlib_version_infix=yes -- echo "$as_me:5592: checking if ld -search_paths_first works" >&5 --echo $ECHO_N "checking if ld -search_paths_first works... $ECHO_C" >&6 --if test "${cf_cv_ldflags_search_paths_first+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 --else -+ msys*) #(vi -+ CC_SHARED_OPTS= -+ MK_SHARED_LIB='sh '$rel_builddir'/mk_shared_lib.sh $@ ${CC} ${CFLAGS}' -+ RM_SHARED_OPTS="$RM_SHARED_OPTS $rel_builddir/mk_shared_lib.sh *.dll.a" -+ cf_cv_shlib_version=msysdll -+ cf_cv_shlib_version_infix=msysdll -+ shlibdir=$bindir -+ MAKE_DLLS= -+ cat >mk_shared_lib.sh <<-CF_EOF -+ #!/bin/sh -+ SHARED_LIB=\$1 -+ IMPORT_LIB=\`echo "\$1" | sed -e 's/msys-/lib/' -e 's/[0-9]*\.dll$/.dll.a/'\` -+ shift -+ cat <<-EOF -+ Linking shared library -+ ** SHARED_LIB \$SHARED_LIB -+ ** IMPORT_LIB \$IMPORT_LIB -+EOF -+ exec \$* -shared -Wl,--out-implib=\${IMPORT_LIB} -Wl,--export-all-symbols -o \${SHARED_LIB} -+CF_EOF -+ chmod +x mk_shared_lib.sh -+ ;; -+ darwin*) #(vi -+ cf_try_cflags="no-cpp-precomp" -+ CC_SHARED_OPTS="-dynamic" -+ MK_SHARED_LIB='${CC} ${CFLAGS} -dynamiclib -install_name ${libdir}/`basename $@` -compatibility_version ${ABI_VERSION} -current_version ${ABI_VERSION} -o $@' -+ test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=abi -+ cf_cv_shlib_version_infix=yes -+ echo "$as_me:5717: checking if ld -search_paths_first works" >&5 -+echo $ECHO_N "checking if ld -search_paths_first works... $ECHO_C" >&6 -+if test "${cf_cv_ldflags_search_paths_first+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else - - cf_save_LDFLAGS=$LDFLAGS - LDFLAGS="$LDFLAGS -Wl,-search_paths_first" - cat >conftest.$ac_ext <<_ACEOF --#line 5601 "configure" -+#line 5726 "configure" - #include "confdefs.h" - - int -@@ -5610,16 +5735,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:5613: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:5738: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:5616: \$? = $ac_status" >&5 -+ echo "$as_me:5741: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:5619: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:5744: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:5622: \$? = $ac_status" >&5 -+ echo "$as_me:5747: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_cv_ldflags_search_paths_first=yes - else -@@ -5630,12 +5755,20 @@ - rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - LDFLAGS=$cf_save_LDFLAGS - fi --echo "$as_me:5633: result: $cf_cv_ldflags_search_paths_first" >&5 -+echo "$as_me:5758: result: $cf_cv_ldflags_search_paths_first" >&5 - echo "${ECHO_T}$cf_cv_ldflags_search_paths_first" >&6 - if test $cf_cv_ldflags_search_paths_first = yes; then - LDFLAGS="$LDFLAGS -Wl,-search_paths_first" - fi - ;; -+ hpux[7-8]*) #(vi -+ # HP-UX 8.07 ld lacks "+b" option used for libdir search-list -+ if test "$GCC" != yes; then -+ CC_SHARED_OPTS='+Z' -+ fi -+ MK_SHARED_LIB='${LD} -b -o $@' -+ INSTALL_LIB="-m 555" -+ ;; - hpux*) #(vi - # (tested with gcc 2.7.2 -- I don't have c89) - if test "$GCC" = yes; then -@@ -5649,9 +5782,19 @@ - # readonly to exploit a quirk in the memory manager. - INSTALL_LIB="-m 555" - ;; -+ interix*) -+ test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel -+ if test "$cf_cv_shlib_version" = rel; then -+ cf_shared_soname='`basename .${REL_VERSION}`.${ABI_VERSION}' -+ else -+ cf_shared_soname='`basename `' -+ fi -+ CC_SHARED_OPTS= -+ MK_SHARED_LIB='${CC} -shared -Wl,-rpath,${RPATH_LIST} -Wl,-h,'$cf_shared_soname' -o ' -+ ;; - irix*) #(vi - if test "$cf_cv_enable_rpath" = yes ; then -- EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${libdir} $EXTRA_LDFLAGS" -+ EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS" - fi - # tested with IRIX 5.2 and 'cc'. - if test "$GCC" != yes; then -@@ -5668,7 +5811,7 @@ - LOCAL_LDFLAGS2="$LOCAL_LDFLAGS" - fi - if test "$cf_cv_enable_rpath" = yes ; then -- EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${libdir} $EXTRA_LDFLAGS" -+ EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS" - fi - - test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel -@@ -5680,13 +5823,40 @@ - - MK_SHARED_LIB='${CC} ${CFLAGS} -shared -Wl,-soname,'$cf_cv_shared_soname',-stats,-lc -o $@' - ;; -- openbsd[2-9].*) #(vi -+ mingw*) #(vi -+ cf_cv_shlib_version=mingw -+ cf_cv_shlib_version_infix=mingw -+ shlibdir=$bindir -+ MAKE_DLLS= -+ if test "$DFT_LWR_MODEL" = "shared" ; then -+ LOCAL_LDFLAGS="-Wl,--enable-auto-import" -+ LOCAL_LDFLAGS2="$LOCAL_LDFLAGS" -+ EXTRA_LDFLAGS="-Wl,--enable-auto-import $EXTRA_LDFLAGS" -+ fi -+ CC_SHARED_OPTS= -+ MK_SHARED_LIB='sh '$rel_builddir'/mk_shared_lib.sh $@ ${CC} ${CFLAGS}' -+ RM_SHARED_OPTS="$RM_SHARED_OPTS $rel_builddir/mk_shared_lib.sh *.dll.a" -+ cat >mk_shared_lib.sh <<-CF_EOF -+ #!/bin/sh -+ SHARED_LIB=\$1 -+ IMPORT_LIB=\`echo "\$1" | sed -e 's/[0-9]*\.dll$/.dll.a/'\` -+ shift -+ cat <<-EOF -+ Linking shared library -+ ** SHARED_LIB \$SHARED_LIB -+ ** IMPORT_LIB \$IMPORT_LIB -+EOF -+ exec \$* -shared -Wl,--enable-auto-import,--out-implib=\${IMPORT_LIB} -Wl,--export-all-symbols -o \${SHARED_LIB} -+CF_EOF -+ chmod +x mk_shared_lib.sh -+ ;; -+ openbsd[2-9].*|mirbsd*) #(vi - if test "$DFT_LWR_MODEL" = "shared" ; then - LOCAL_LDFLAGS="${LD_RPATH_OPT}\$(LOCAL_LIBDIR)" - LOCAL_LDFLAGS2="$LOCAL_LDFLAGS" - fi - if test "$cf_cv_enable_rpath" = yes ; then -- EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${libdir} $EXTRA_LDFLAGS" -+ EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS" - fi - CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC" - -@@ -5704,12 +5874,12 @@ - MK_SHARED_LIB='${LD} -Bshareable -o $@' - test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel - ;; -- freebsd*) #(vi -+ dragonfly*|freebsd*) #(vi - CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC" - if test "$DFT_LWR_MODEL" = "shared" && test "$cf_cv_enable_rpath" = yes ; then - LOCAL_LDFLAGS="${cf_ld_rpath_opt}\$(LOCAL_LIBDIR)" -- LOCAL_LDFLAGS2="${cf_ld_rpath_opt}\${libdir} $LOCAL_LDFLAGS" -- EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${libdir} $EXTRA_LDFLAGS" -+ LOCAL_LDFLAGS2="${cf_ld_rpath_opt}\${RPATH_LIST} $LOCAL_LDFLAGS" -+ EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS" - fi - - test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel -@@ -5726,7 +5896,7 @@ - if test "$DFT_LWR_MODEL" = "shared" && test "$cf_cv_enable_rpath" = yes ; then - LOCAL_LDFLAGS="${cf_ld_rpath_opt}\$(LOCAL_LIBDIR)" - LOCAL_LDFLAGS2="$LOCAL_LDFLAGS" -- EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${libdir} $EXTRA_LDFLAGS" -+ EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS" - if test "$cf_cv_shlib_version" = auto; then - if test -f /usr/libexec/ld.elf_so; then - cf_cv_shlib_version=abi -@@ -5744,7 +5914,7 @@ - - MK_SHARED_LIB='${CC} ${CFLAGS} -shared -Wl,-soname,'$cf_cv_shared_soname' -o $@' - else -- MK_SHARED_LIB='${LD} -shared -Bshareable -o $@' -+ MK_SHARED_LIB='${CC} -Wl,-shared -Wl,-Bshareable -o $@' - fi - ;; - osf*|mls+*) #(vi -@@ -5810,7 +5980,7 @@ - do - CFLAGS="$cf_shared_opts $cf_save_CFLAGS" - cat >conftest.$ac_ext <<_ACEOF --#line 5813 "configure" -+#line 5983 "configure" - #include "confdefs.h" - #include - int -@@ -5822,16 +5992,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:5825: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:5995: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:5828: \$? = $ac_status" >&5 -+ echo "$as_me:5998: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:5831: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:6001: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:5834: \$? = $ac_status" >&5 -+ echo "$as_me:6004: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - break - else -@@ -5868,21 +6038,64 @@ - test "$cf_cv_do_symlinks" = no && cf_cv_do_symlinks=yes - ;; - *) -- { echo "$as_me:5871: WARNING: ignored --with-shlib-version" >&5 -+ { echo "$as_me:6041: WARNING: ignored --with-shlib-version" >&5 - echo "$as_me: WARNING: ignored --with-shlib-version" >&2;} - ;; - esac - ;; - esac - -- if test -n "$cf_ld_rpath_opt" ; then -- MK_SHARED_LIB="$MK_SHARED_LIB $cf_ld_rpath_opt\${libdir}" -+ if test -n "$cf_try_cflags" -+ then -+cat > conftest.$ac_ext < -+int main(int argc, char *argv[]) -+{ -+ printf("hello\n"); -+ return (argv[argc-1] == 0) ; -+} -+EOF -+ cf_save_CFLAGS="$CFLAGS" -+ for cf_opt in $cf_try_cflags -+ do -+ CFLAGS="$cf_save_CFLAGS -$cf_opt" -+ echo "$as_me:6063: checking if CFLAGS option -$cf_opt works" >&5 -+echo $ECHO_N "checking if CFLAGS option -$cf_opt works... $ECHO_C" >&6 -+ if { (eval echo "$as_me:6065: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>&5 -+ ac_status=$? -+ echo "$as_me:6068: \$? = $ac_status" >&5 -+ (exit $ac_status); }; then -+ echo "$as_me:6070: result: yes" >&5 -+echo "${ECHO_T}yes" >&6 -+ cf_save_CFLAGS="$CFLAGS" -+ else -+ echo "$as_me:6074: result: no" >&5 -+echo "${ECHO_T}no" >&6 -+ fi -+ done -+ CFLAGS="$cf_save_CFLAGS" - fi - -+ # RPATH_LIST is a colon-separated list of directories -+ test -n "$cf_ld_rpath_opt" && MK_SHARED_LIB="$MK_SHARED_LIB $cf_ld_rpath_opt\${RPATH_LIST}" -+ test -z "$RPATH_LIST" && RPATH_LIST="\${libdir}" -+ -+ test $cf_cv_rm_so_locs = yes && RM_SHARED_OPTS="$RM_SHARED_OPTS so_locations" -+ -+ test -n "$verbose" && echo " CC_SHARED_OPTS: $CC_SHARED_OPTS" 1>&6 -+ -+echo "${as_me:-configure}:6089: testing CC_SHARED_OPTS: $CC_SHARED_OPTS ..." 1>&5 -+ -+ test -n "$verbose" && echo " MK_SHARED_LIB: $MK_SHARED_LIB" 1>&6 -+ -+echo "${as_me:-configure}:6093: testing MK_SHARED_LIB: $MK_SHARED_LIB ..." 1>&5 -+ - if test "$CC_SHARED_OPTS" = "unknown"; then - for model in $cf_list_models; do - if test "$model" = "shared"; then -- { { echo "$as_me:5885: error: Shared libraries are not supported in this version" >&5 -+ { { echo "$as_me:6098: error: Shared libraries are not supported in this version" >&5 - echo "$as_me: error: Shared libraries are not supported in this version" >&2;} - { (exit 1); exit 1; }; } - fi -@@ -5892,7 +6105,7 @@ - ### If we're building with rpath, try to link non-standard libs that way too. - if test "$DFT_LWR_MODEL" = "shared"; then - --echo "$as_me:5895: checking if rpath-hack should be disabled" >&5 -+echo "$as_me:6108: checking if rpath-hack should be disabled" >&5 - echo $ECHO_N "checking if rpath-hack should be disabled... $ECHO_C" >&6 - - # Check whether --enable-rpath-hack or --disable-rpath-hack was given. -@@ -5909,21 +6122,21 @@ - cf_disable_rpath_hack=no - - fi; --echo "$as_me:5912: result: $cf_disable_rpath_hack" >&5 -+echo "$as_me:6125: result: $cf_disable_rpath_hack" >&5 - echo "${ECHO_T}$cf_disable_rpath_hack" >&6 - if test "$cf_disable_rpath_hack" = no ; then - --echo "$as_me:5916: checking for updated LDFLAGS" >&5 -+echo "$as_me:6129: checking for updated LDFLAGS" >&5 - echo $ECHO_N "checking for updated LDFLAGS... $ECHO_C" >&6 - if test -n "$LD_RPATH_OPT" ; then -- echo "$as_me:5919: result: maybe" >&5 -+ echo "$as_me:6132: result: maybe" >&5 - echo "${ECHO_T}maybe" >&6 - - for ac_prog in ldd - do - # Extract the first word of "$ac_prog", so it can be a program name with args. - set dummy $ac_prog; ac_word=$2 --echo "$as_me:5926: checking for $ac_word" >&5 -+echo "$as_me:6139: checking for $ac_word" >&5 - echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 - if test "${ac_cv_prog_cf_ldd_prog+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -5938,7 +6151,7 @@ - test -z "$ac_dir" && ac_dir=. - $as_executable_p "$ac_dir/$ac_word" || continue - ac_cv_prog_cf_ldd_prog="$ac_prog" --echo "$as_me:5941: found $ac_dir/$ac_word" >&5 -+echo "$as_me:6154: found $ac_dir/$ac_word" >&5 - break - done - -@@ -5946,10 +6159,10 @@ - fi - cf_ldd_prog=$ac_cv_prog_cf_ldd_prog - if test -n "$cf_ldd_prog"; then -- echo "$as_me:5949: result: $cf_ldd_prog" >&5 -+ echo "$as_me:6162: result: $cf_ldd_prog" >&5 - echo "${ECHO_T}$cf_ldd_prog" >&6 - else -- echo "$as_me:5952: result: no" >&5 -+ echo "$as_me:6165: result: no" >&5 - echo "${ECHO_T}no" >&6 - fi - -@@ -5963,7 +6176,7 @@ - cf_rpath_oops= - - cat >conftest.$ac_ext <<_ACEOF --#line 5966 "configure" -+#line 6179 "configure" - #include "confdefs.h" - #include - int -@@ -5975,19 +6188,19 @@ - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:5978: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:6191: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:5981: \$? = $ac_status" >&5 -+ echo "$as_me:6194: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:5984: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:6197: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:5987: \$? = $ac_status" >&5 -+ echo "$as_me:6200: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- cf_rpath_oops=`$cf_ldd_prog conftest$ac_exeext | fgrep ' not found' | sed -e 's% =>.*$%%' |sort -u` -- cf_rpath_list=`$cf_ldd_prog conftest$ac_exeext | fgrep / | sed -e 's%^.*[ ]/%/%' -e 's%/[^/][^/]*$%%' |sort -u` -+ cf_rpath_oops=`$cf_ldd_prog conftest$ac_exeext | fgrep ' not found' | sed -e 's% =>.*$%%' |sort | uniq` -+ cf_rpath_list=`$cf_ldd_prog conftest$ac_exeext | fgrep / | sed -e 's%^.*[ ]/%/%' -e 's%/[^/][^/]*$%%' |sort | uniq` - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 -@@ -6012,7 +6225,7 @@ - then - test -n "$verbose" && echo " ...adding -L$cf_rpath_dir/lib to LDFLAGS for $cf_rpath_src" 1>&6 - --echo "${as_me:-configure}:6015: testing ...adding -L$cf_rpath_dir/lib to LDFLAGS for $cf_rpath_src ..." 1>&5 -+echo "${as_me:-configure}:6228: testing ...adding -L$cf_rpath_dir/lib to LDFLAGS for $cf_rpath_src ..." 1>&5 - - LDFLAGS="$LDFLAGS -L$cf_rpath_dir/lib" - break -@@ -6024,11 +6237,11 @@ - - test -n "$verbose" && echo " ...checking EXTRA_LDFLAGS $EXTRA_LDFLAGS" 1>&6 - --echo "${as_me:-configure}:6027: testing ...checking EXTRA_LDFLAGS $EXTRA_LDFLAGS ..." 1>&5 -+echo "${as_me:-configure}:6240: testing ...checking EXTRA_LDFLAGS $EXTRA_LDFLAGS ..." 1>&5 - - test -n "$verbose" && echo " ...checking LDFLAGS $LDFLAGS" 1>&6 - --echo "${as_me:-configure}:6031: testing ...checking LDFLAGS $LDFLAGS ..." 1>&5 -+echo "${as_me:-configure}:6244: testing ...checking LDFLAGS $LDFLAGS ..." 1>&5 - - cf_rpath_dst= - for cf_rpath_src in $LDFLAGS -@@ -6065,7 +6278,7 @@ - then - test -n "$verbose" && echo " ...Filter $cf_rpath_src ->$cf_rpath_tmp" 1>&6 - --echo "${as_me:-configure}:6068: testing ...Filter $cf_rpath_src ->$cf_rpath_tmp ..." 1>&5 -+echo "${as_me:-configure}:6281: testing ...Filter $cf_rpath_src ->$cf_rpath_tmp ..." 1>&5 - - EXTRA_LDFLAGS="$cf_rpath_tmp $EXTRA_LDFLAGS" - fi -@@ -6078,11 +6291,11 @@ - - test -n "$verbose" && echo " ...checked LDFLAGS $LDFLAGS" 1>&6 - --echo "${as_me:-configure}:6081: testing ...checked LDFLAGS $LDFLAGS ..." 1>&5 -+echo "${as_me:-configure}:6294: testing ...checked LDFLAGS $LDFLAGS ..." 1>&5 - - test -n "$verbose" && echo " ...checking LIBS $LIBS" 1>&6 - --echo "${as_me:-configure}:6085: testing ...checking LIBS $LIBS ..." 1>&5 -+echo "${as_me:-configure}:6298: testing ...checking LIBS $LIBS ..." 1>&5 - - cf_rpath_dst= - for cf_rpath_src in $LIBS -@@ -6119,7 +6332,7 @@ - then - test -n "$verbose" && echo " ...Filter $cf_rpath_src ->$cf_rpath_tmp" 1>&6 - --echo "${as_me:-configure}:6122: testing ...Filter $cf_rpath_src ->$cf_rpath_tmp ..." 1>&5 -+echo "${as_me:-configure}:6335: testing ...Filter $cf_rpath_src ->$cf_rpath_tmp ..." 1>&5 - - EXTRA_LDFLAGS="$cf_rpath_tmp $EXTRA_LDFLAGS" - fi -@@ -6132,12 +6345,15 @@ - - test -n "$verbose" && echo " ...checked LIBS $LIBS" 1>&6 - --echo "${as_me:-configure}:6135: testing ...checked LIBS $LIBS ..." 1>&5 -+echo "${as_me:-configure}:6348: testing ...checked LIBS $LIBS ..." 1>&5 - - test -n "$verbose" && echo " ...checked EXTRA_LDFLAGS $EXTRA_LDFLAGS" 1>&6 - --echo "${as_me:-configure}:6139: testing ...checked EXTRA_LDFLAGS $EXTRA_LDFLAGS ..." 1>&5 -+echo "${as_me:-configure}:6352: testing ...checked EXTRA_LDFLAGS $EXTRA_LDFLAGS ..." 1>&5 - -+else -+ echo "$as_me:6355: result: no" >&5 -+echo "${ECHO_T}no" >&6 - fi - - fi -@@ -6147,7 +6363,7 @@ - ############################################################################### - - ### use option --disable-overwrite to leave out the link to -lcurses --echo "$as_me:6150: checking if you wish to install ncurses overwriting curses" >&5 -+echo "$as_me:6366: checking if you wish to install ncurses overwriting curses" >&5 - echo $ECHO_N "checking if you wish to install ncurses overwriting curses... $ECHO_C" >&6 - - # Check whether --enable-overwrite or --disable-overwrite was given. -@@ -6157,10 +6373,10 @@ - else - if test "$prefix" = "/usr" ; then with_overwrite=yes; else with_overwrite=no; fi - fi; --echo "$as_me:6160: result: $with_overwrite" >&5 -+echo "$as_me:6376: result: $with_overwrite" >&5 - echo "${ECHO_T}$with_overwrite" >&6 - --echo "$as_me:6163: checking if external terminfo-database is used" >&5 -+echo "$as_me:6379: checking if external terminfo-database is used" >&5 - echo $ECHO_N "checking if external terminfo-database is used... $ECHO_C" >&6 - - # Check whether --enable-database or --disable-database was given. -@@ -6170,7 +6386,7 @@ - else - use_database=yes - fi; --echo "$as_me:6173: result: $use_database" >&5 -+echo "$as_me:6389: result: $use_database" >&5 - echo "${ECHO_T}$use_database" >&6 - - case $host_os in #(vi -@@ -6182,17 +6398,11 @@ - ;; - esac - -- case $cf_cv_system_name in -- os2*) PATH_SEPARATOR=';' ;; -- *) PATH_SEPARATOR=':' ;; -- esac -- -+NCURSES_USE_DATABASE=0 - if test "$use_database" != no ; then -- cat >>confdefs.h <<\EOF --#define USE_DATABASE 1 --EOF -+ NCURSES_USE_DATABASE=1 - -- echo "$as_me:6195: checking which terminfo source-file will be installed" >&5 -+ echo "$as_me:6405: checking which terminfo source-file will be installed" >&5 - echo $ECHO_N "checking which terminfo source-file will be installed... $ECHO_C" >&6 - - # Check whether --with-database or --without-database was given. -@@ -6200,10 +6410,10 @@ - withval="$with_database" - TERMINFO_SRC=$withval - fi; -- echo "$as_me:6203: result: $TERMINFO_SRC" >&5 -+ echo "$as_me:6413: result: $TERMINFO_SRC" >&5 - echo "${ECHO_T}$TERMINFO_SRC" >&6 - -- echo "$as_me:6206: checking whether to use hashed database instead of directory/tree" >&5 -+ echo "$as_me:6416: checking whether to use hashed database instead of directory/tree" >&5 - echo $ECHO_N "checking whether to use hashed database instead of directory/tree... $ECHO_C" >&6 - - # Check whether --with-hashed-db or --without-hashed-db was given. -@@ -6213,13 +6423,13 @@ - else - with_hashed_db=no - fi; -- echo "$as_me:6216: result: $with_hashed_db" >&5 -+ echo "$as_me:6426: result: $with_hashed_db" >&5 - echo "${ECHO_T}$with_hashed_db" >&6 - else - with_hashed_db=no - fi - --echo "$as_me:6222: checking for list of fallback descriptions" >&5 -+echo "$as_me:6432: checking for list of fallback descriptions" >&5 - echo $ECHO_N "checking for list of fallback descriptions... $ECHO_C" >&6 - - # Check whether --with-fallbacks or --without-fallbacks was given. -@@ -6229,11 +6439,11 @@ - else - with_fallback= - fi; --echo "$as_me:6232: result: $with_fallback" >&5 -+echo "$as_me:6442: result: $with_fallback" >&5 - echo "${ECHO_T}$with_fallback" >&6 - FALLBACK_LIST=`echo "$with_fallback" | sed -e 's/,/ /g'` - --echo "$as_me:6236: checking if you want modern xterm or antique" >&5 -+echo "$as_me:6446: checking if you want modern xterm or antique" >&5 - echo $ECHO_N "checking if you want modern xterm or antique... $ECHO_C" >&6 - - # Check whether --with-xterm-new or --without-xterm-new was given. -@@ -6247,17 +6457,42 @@ - no) with_xterm_new=xterm-old;; - *) with_xterm_new=xterm-new;; - esac --echo "$as_me:6250: result: $with_xterm_new" >&5 -+echo "$as_me:6460: result: $with_xterm_new" >&5 - echo "${ECHO_T}$with_xterm_new" >&6 - WHICH_XTERM=$with_xterm_new - -+echo "$as_me:6464: checking if xterm backspace sends BS or DEL" >&5 -+echo $ECHO_N "checking if xterm backspace sends BS or DEL... $ECHO_C" >&6 -+ -+# Check whether --with-xterm-kbs or --without-xterm-kbs was given. -+if test "${with_xterm_kbs+set}" = set; then -+ withval="$with_xterm_kbs" -+ with_xterm_kbs=$withval -+else -+ with_xterm_kbs=BS -+fi; -+case x$with_xterm_kbs in -+xyes|xno|xBS|xbs|x8) -+ with_xterm_kbs=BS -+ ;; -+xDEL|xdel|x127) -+ with_xterm_kbs=DEL -+ ;; -+*) -+ with_xterm_kbs=$withval -+ ;; -+esac -+echo "$as_me:6485: result: $with_xterm_kbs" >&5 -+echo "${ECHO_T}$with_xterm_kbs" >&6 -+XTERM_KBS=$with_xterm_kbs -+ - MAKE_TERMINFO= - if test "$use_database" = no ; then - TERMINFO="${datadir}/terminfo" - MAKE_TERMINFO="#" - else - --echo "$as_me:6260: checking for list of terminfo directories" >&5 -+echo "$as_me:6495: checking for list of terminfo directories" >&5 - echo $ECHO_N "checking for list of terminfo directories... $ECHO_C" >&6 - - # Check whether --with-terminfo-dirs or --without-terminfo-dirs was given. -@@ -6285,7 +6520,7 @@ - ;; - .[a-zA-Z]:[\\/]*) #(vi OS/2 EMX - ;; --.\${*prefix}*) #(vi -+.\${*prefix}*|.\${*dir}*) #(vi - eval cf_src_path="$cf_src_path" - case ".$cf_src_path" in #(vi - .NONE/*) -@@ -6297,26 +6532,37 @@ - cf_src_path=`echo $cf_src_path | sed -e s%NONE%$cf_path_syntax%` - ;; - *) -- { { echo "$as_me:6300: error: expected a pathname, not \"$cf_src_path\"" >&5 -+ { { echo "$as_me:6535: error: expected a pathname, not \"$cf_src_path\"" >&5 - echo "$as_me: error: expected a pathname, not \"$cf_src_path\"" >&2;} - { (exit 1); exit 1; }; } - ;; - esac - -- test -n "$cf_dst_path" && cf_dst_path="${cf_dst_path}:" -+ test -n "$cf_dst_path" && cf_dst_path="${cf_dst_path}$PATH_SEPARATOR" - cf_dst_path="${cf_dst_path}${cf_src_path}" - done - IFS="$ac_save_ifs" - --eval 'TERMINFO_DIRS="$cf_dst_path"' -+# This may use the prefix/exec_prefix symbols which will only yield "NONE" -+# so we have to check/work around. We do prefer the result of "eval"... -+eval cf_dst_eval="$cf_dst_path" -+case "x$cf_dst_eval" in #(vi -+xNONE*) #(vi -+ TERMINFO_DIRS=$cf_dst_path -+ ;; -+*) -+ TERMINFO_DIRS="$cf_dst_eval" -+ ;; -+esac - --echo "$as_me:6313: result: $TERMINFO_DIRS" >&5 -+echo "$as_me:6558: result: $TERMINFO_DIRS" >&5 - echo "${ECHO_T}$TERMINFO_DIRS" >&6 --test -n "$TERMINFO_DIRS" && cat >>confdefs.h <>confdefs.h <&5 -+echo "$as_me:6565: checking for default terminfo directory" >&5 - echo $ECHO_N "checking for default terminfo directory... $ECHO_C" >&6 - - # Check whether --with-default-terminfo-dir or --without-default-terminfo-dir was given. -@@ -6340,7 +6586,7 @@ - ;; - .[a-zA-Z]:[\\/]*) #(vi OS/2 EMX - ;; --.\${*prefix}*) #(vi -+.\${*prefix}*|.\${*dir}*) #(vi - eval withval="$withval" - case ".$withval" in #(vi - .NONE/*) -@@ -6352,17 +6598,18 @@ - withval=`echo $withval | sed -e s%NONE%$cf_path_syntax%` - ;; - *) -- { { echo "$as_me:6355: error: expected a pathname, not \"$withval\"" >&5 -+ { { echo "$as_me:6601: error: expected a pathname, not \"$withval\"" >&5 - echo "$as_me: error: expected a pathname, not \"$withval\"" >&2;} - { (exit 1); exit 1; }; } - ;; - esac - - fi --TERMINFO="$withval" -+eval TERMINFO="$withval" - --echo "$as_me:6364: result: $TERMINFO" >&5 -+echo "$as_me:6610: result: $TERMINFO" >&5 - echo "${ECHO_T}$TERMINFO" >&6 -+ - cat >>confdefs.h <&5 -+echo "$as_me:6621: checking if big-core option selected" >&5 - echo $ECHO_N "checking if big-core option selected... $ECHO_C" >&6 - - # Check whether --enable-big-core or --disable-big-core was given. -@@ -6383,7 +6630,7 @@ - with_big_core=no - else - cat >conftest.$ac_ext <<_ACEOF --#line 6386 "configure" -+#line 6633 "configure" - #include "confdefs.h" - - #include -@@ -6397,15 +6644,15 @@ - } - _ACEOF - rm -f conftest$ac_exeext --if { (eval echo "$as_me:6400: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:6647: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:6403: \$? = $ac_status" >&5 -+ echo "$as_me:6650: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' -- { (eval echo "$as_me:6405: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:6652: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:6408: \$? = $ac_status" >&5 -+ echo "$as_me:6655: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - with_big_core=yes - else -@@ -6417,16 +6664,17 @@ - rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext - fi - fi; --echo "$as_me:6420: result: $with_big_core" >&5 -+echo "$as_me:6667: result: $with_big_core" >&5 - echo "${ECHO_T}$with_big_core" >&6 --test "$with_big_core" = "yes" && cat >>confdefs.h <<\EOF -+test "x$with_big_core" = "xyes" && -+cat >>confdefs.h <<\EOF - #define HAVE_BIG_CORE 1 - EOF - - ### ISO C only guarantees 512-char strings, we have tables which load faster - ### when constructed using "big" strings. More than the C compiler, the awk - ### program is a limit on most vendor UNIX systems. Check that we can build. --echo "$as_me:6429: checking if big-strings option selected" >&5 -+echo "$as_me:6677: checking if big-strings option selected" >&5 - echo $ECHO_N "checking if big-strings option selected... $ECHO_C" >&6 - - # Check whether --enable-big-strings or --disable-big-strings was given. -@@ -6440,8 +6688,8 @@ - eval with_big_strings=no - ;; - *) #(vi -- if ( ${AWK} 'BEGIN { xx = "x"; while (length(xx) < 12000) { xx = xx "x"; }; printf("%s\n", xx); }' \ -- | $AWK '{ printf "%d\n", length($0); }' | $AWK 'BEGIN { eqls=0; recs=0; } { recs++; if ($0 == 12000) eqls++; } END { if (recs != 1 || eqls != 1) exit 1; }' 2>/dev/null >/dev/null ) ; then -+ if ( ${AWK} 'BEGIN { xx = "x"; while (length(xx) < 12000) { xx = xx "x"; }; printf("%s\n", xx); }' 2>/dev/null \ -+ | $AWK '{ printf "%d\n", length($0); }' 2>/dev/null | $AWK 'BEGIN { eqls=0; recs=0; } { recs++; if ($0 == 12000) eqls++; } END { if (recs != 1 || eqls != 1) exit 1; }' 2>/dev/null >/dev/null ) ; then - eval with_big_strings=yes - else - eval with_big_strings=no -@@ -6450,14 +6698,14 @@ - esac - - fi; --echo "$as_me:6453: result: $with_big_strings" >&5 -+echo "$as_me:6701: result: $with_big_strings" >&5 - echo "${ECHO_T}$with_big_strings" >&6 - - USE_BIG_STRINGS=0 --test "$with_big_strings" = "yes" && USE_BIG_STRINGS=1 -+test "x$with_big_strings" = "xyes" && USE_BIG_STRINGS=1 - - ### use option --enable-termcap to compile in the termcap fallback support --echo "$as_me:6460: checking if you want termcap-fallback support" >&5 -+echo "$as_me:6708: checking if you want termcap-fallback support" >&5 - echo $ECHO_N "checking if you want termcap-fallback support... $ECHO_C" >&6 - - # Check whether --enable-termcap or --disable-termcap was given. -@@ -6467,34 +6715,33 @@ - else - with_termcap=no - fi; --echo "$as_me:6470: result: $with_termcap" >&5 -+echo "$as_me:6718: result: $with_termcap" >&5 - echo "${ECHO_T}$with_termcap" >&6 - --if test "$with_termcap" != "yes" ; then -+NCURSES_USE_TERMCAP=0 -+if test "x$with_termcap" != "xyes" ; then - if test "$use_database" = no ; then - if test -z "$with_fallback" ; then -- { { echo "$as_me:6476: error: You have disabled the database w/o specifying fallbacks" >&5 -+ { { echo "$as_me:6725: error: You have disabled the database w/o specifying fallbacks" >&5 - echo "$as_me: error: You have disabled the database w/o specifying fallbacks" >&2;} - { (exit 1); exit 1; }; } - fi - fi -- cat >>confdefs.h <<\EOF -+ -+cat >>confdefs.h <<\EOF - #define PURE_TERMINFO 1 - EOF - - else - --if test "$with_ticlib" != no ; then -- { { echo "$as_me:6488: error: Options --with-ticlib and --enable-termcap cannot be combined" >&5 -+ if test "$with_ticlib" != no ; then -+ { { echo "$as_me:6738: error: Options --with-ticlib and --enable-termcap cannot be combined" >&5 - echo "$as_me: error: Options --with-ticlib and --enable-termcap cannot be combined" >&2;} - { (exit 1); exit 1; }; } --fi -- --cat >>confdefs.h <<\EOF --#define USE_TERMCAP 1 --EOF -+ fi - --echo "$as_me:6497: checking for list of termcap files" >&5 -+ NCURSES_USE_TERMCAP=1 -+ echo "$as_me:6744: checking for list of termcap files" >&5 - echo $ECHO_N "checking for list of termcap files... $ECHO_C" >&6 - - # Check whether --with-termpath or --without-termpath was given. -@@ -6522,7 +6769,7 @@ - ;; - .[a-zA-Z]:[\\/]*) #(vi OS/2 EMX - ;; --.\${*prefix}*) #(vi -+.\${*prefix}*|.\${*dir}*) #(vi - eval cf_src_path="$cf_src_path" - case ".$cf_src_path" in #(vi - .NONE/*) -@@ -6534,27 +6781,38 @@ - cf_src_path=`echo $cf_src_path | sed -e s%NONE%$cf_path_syntax%` - ;; - *) -- { { echo "$as_me:6537: error: expected a pathname, not \"$cf_src_path\"" >&5 -+ { { echo "$as_me:6784: error: expected a pathname, not \"$cf_src_path\"" >&5 - echo "$as_me: error: expected a pathname, not \"$cf_src_path\"" >&2;} - { (exit 1); exit 1; }; } - ;; - esac - -- test -n "$cf_dst_path" && cf_dst_path="${cf_dst_path}:" -+ test -n "$cf_dst_path" && cf_dst_path="${cf_dst_path}$PATH_SEPARATOR" - cf_dst_path="${cf_dst_path}${cf_src_path}" - done - IFS="$ac_save_ifs" - --eval 'TERMPATH="$cf_dst_path"' -+# This may use the prefix/exec_prefix symbols which will only yield "NONE" -+# so we have to check/work around. We do prefer the result of "eval"... -+eval cf_dst_eval="$cf_dst_path" -+case "x$cf_dst_eval" in #(vi -+xNONE*) #(vi -+ TERMPATH=$cf_dst_path -+ ;; -+*) -+ TERMPATH="$cf_dst_eval" -+ ;; -+esac - --echo "$as_me:6550: result: $TERMPATH" >&5 -+ echo "$as_me:6807: result: $TERMPATH" >&5 - echo "${ECHO_T}$TERMPATH" >&6 --test -n "$TERMPATH" && cat >>confdefs.h <>confdefs.h <&5 -+ ### use option --enable-getcap to use a hacked getcap for reading termcaps -+ echo "$as_me:6815: checking if fast termcap-loader is needed" >&5 - echo $ECHO_N "checking if fast termcap-loader is needed... $ECHO_C" >&6 - - # Check whether --enable-getcap or --disable-getcap was given. -@@ -6564,13 +6822,14 @@ - else - with_getcap=no - fi; --echo "$as_me:6567: result: $with_getcap" >&5 -+ echo "$as_me:6825: result: $with_getcap" >&5 - echo "${ECHO_T}$with_getcap" >&6 --test "$with_getcap" = "yes" && cat >>confdefs.h <<\EOF -+ test "x$with_getcap" = "xyes" && -+cat >>confdefs.h <<\EOF - #define USE_GETCAP 1 - EOF - --echo "$as_me:6573: checking if translated termcaps will be cached in ~/.terminfo" >&5 -+ echo "$as_me:6832: checking if translated termcaps will be cached in ~/.terminfo" >&5 - echo $ECHO_N "checking if translated termcaps will be cached in ~/.terminfo... $ECHO_C" >&6 - - # Check whether --enable-getcap-cache or --disable-getcap-cache was given. -@@ -6580,16 +6839,17 @@ - else - with_getcap_cache=no - fi; --echo "$as_me:6583: result: $with_getcap_cache" >&5 -+ echo "$as_me:6842: result: $with_getcap_cache" >&5 - echo "${ECHO_T}$with_getcap_cache" >&6 --test "$with_getcap_cache" = "yes" && cat >>confdefs.h <<\EOF -+ test "x$with_getcap_cache" = "xyes" && -+cat >>confdefs.h <<\EOF - #define USE_GETCAP_CACHE 1 - EOF - - fi - - ### Use option --disable-home-terminfo to completely remove ~/.terminfo --echo "$as_me:6592: checking if ~/.terminfo is wanted" >&5 -+echo "$as_me:6852: checking if ~/.terminfo is wanted" >&5 - echo $ECHO_N "checking if ~/.terminfo is wanted... $ECHO_C" >&6 - - # Check whether --enable-home-terminfo or --disable-home-terminfo was given. -@@ -6599,13 +6859,14 @@ - else - with_home_terminfo=yes - fi; --echo "$as_me:6602: result: $with_home_terminfo" >&5 -+echo "$as_me:6862: result: $with_home_terminfo" >&5 - echo "${ECHO_T}$with_home_terminfo" >&6 --test "$with_home_terminfo" = "yes" && cat >>confdefs.h <<\EOF -+test "x$with_home_terminfo" = "xyes" && -+cat >>confdefs.h <<\EOF - #define USE_HOME_TERMINFO 1 - EOF - --echo "$as_me:6608: checking if you want to use restricted environment when running as root" >&5 -+echo "$as_me:6869: checking if you want to use restricted environment when running as root" >&5 - echo $ECHO_N "checking if you want to use restricted environment when running as root... $ECHO_C" >&6 - - # Check whether --enable-root-environ or --disable-root-environ was given. -@@ -6615,9 +6876,10 @@ - else - with_root_environ=yes - fi; --echo "$as_me:6618: result: $with_root_environ" >&5 -+echo "$as_me:6879: result: $with_root_environ" >&5 - echo "${ECHO_T}$with_root_environ" >&6 --test "$with_root_environ" = yes && cat >>confdefs.h <<\EOF -+test "x$with_root_environ" = xyes && -+cat >>confdefs.h <<\EOF - #define USE_ROOT_ENVIRON 1 - EOF - -@@ -6629,13 +6891,13 @@ - unlink - do - as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` --echo "$as_me:6632: checking for $ac_func" >&5 -+echo "$as_me:6894: checking for $ac_func" >&5 - echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 - if eval "test \"\${$as_ac_var+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - cat >conftest.$ac_ext <<_ACEOF --#line 6638 "configure" -+#line 6900 "configure" - #include "confdefs.h" - /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. */ -@@ -6658,7 +6920,7 @@ - #if defined (__stub_$ac_func) || defined (__stub___$ac_func) - choke me - #else --f = $ac_func; -+f = $ac_func; /* workaround for ICC 12.0.3 */ if (f == 0) return 1; - #endif - - ; -@@ -6666,16 +6928,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:6669: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:6931: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:6672: \$? = $ac_status" >&5 -+ echo "$as_me:6934: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:6675: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:6937: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:6678: \$? = $ac_status" >&5 -+ echo "$as_me:6940: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - eval "$as_ac_var=yes" - else -@@ -6685,7 +6947,7 @@ - fi - rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - fi --echo "$as_me:6688: result: `eval echo '${'$as_ac_var'}'`" >&5 -+echo "$as_me:6950: result: `eval echo '${'$as_ac_var'}'`" >&5 - echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 - if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <&5 --echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 --if eval "test \"\${$as_ac_var+set}\" = set"; then -+for ac_func in \ -+ link \ -+ symlink -+do -+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -+echo "$as_me:6967: checking for $ac_func" >&5 -+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 -+if eval "test \"\${$as_ac_var+set}\" = set"; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ cat >conftest.$ac_ext <<_ACEOF -+#line 6973 "configure" -+#include "confdefs.h" -+/* System header to define __stub macros and hopefully few prototypes, -+ which can conflict with char $ac_func (); below. */ -+#include -+/* Override any gcc2 internal prototype to avoid an error. */ -+#ifdef __cplusplus -+extern "C" -+#endif -+/* We use char because int might match the return type of a gcc2 -+ builtin and then its argument prototype would still apply. */ -+char $ac_func (); -+char (*f) (); -+ -+int -+main () -+{ -+/* The GNU C library defines this for functions which it implements -+ to always fail with ENOSYS. Some functions are actually named -+ something starting with __ and the normal name is an alias. */ -+#if defined (__stub_$ac_func) || defined (__stub___$ac_func) -+choke me -+#else -+f = $ac_func; /* workaround for ICC 12.0.3 */ if (f == 0) return 1; -+#endif -+ -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext conftest$ac_exeext -+if { (eval echo "$as_me:7004: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>&5 -+ ac_status=$? -+ echo "$as_me:7007: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -s conftest$ac_exeext' -+ { (eval echo "$as_me:7010: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:7013: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ eval "$as_ac_var=yes" -+else -+ echo "$as_me: failed program was:" >&5 -+cat conftest.$ac_ext >&5 -+eval "$as_ac_var=no" -+fi -+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -+fi -+echo "$as_me:7023: result: `eval echo '${'$as_ac_var'}'`" >&5 -+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 -+if test `eval echo '${'$as_ac_var'}'` = yes; then -+ cat >>confdefs.h <&5 -+echo $ECHO_N "checking if link/symlink functions work... $ECHO_C" >&6 -+if test "${cf_cv_link_funcs+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ -+ cf_cv_link_funcs= -+ for cf_func in link symlink ; do -+ if test "$cross_compiling" = yes; then -+ -+ eval 'ac_cv_func_'$cf_func'=error' -+else -+ cat >conftest.$ac_ext <<_ACEOF -+#line 7047 "configure" -+#include "confdefs.h" -+ -+#include -+#include -+#ifdef HAVE_UNISTD_H -+#include -+#endif -+int main() -+{ -+ int fail = 0; -+ char *src = "config.log"; -+ char *dst = "conftest.chk"; -+ struct stat src_sb; -+ struct stat dst_sb; -+ -+ stat(src, &src_sb); -+ fail = ($cf_func("config.log", "conftest.chk") < 0) -+ || (stat(dst, &dst_sb) < 0) -+ || (dst_sb.st_mtime != src_sb.st_mtime); -+#ifdef HAVE_UNLINK -+ unlink(dst); -+#else -+ remove(dst); -+#endif -+ ${cf_cv_main_return:-return} (fail); -+} -+ -+_ACEOF -+rm -f conftest$ac_exeext -+if { (eval echo "$as_me:7077: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>&5 -+ ac_status=$? -+ echo "$as_me:7080: \$? = $ac_status" >&5 -+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext' -+ { (eval echo "$as_me:7082: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:7085: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ -+ cf_cv_link_funcs="$cf_cv_link_funcs $cf_func" -+ eval 'ac_cv_func_'$cf_func'=yes' -+else -+ echo "$as_me: program exited with status $ac_status" >&5 -+echo "$as_me: failed program was:" >&5 -+cat conftest.$ac_ext >&5 -+ -+ eval 'ac_cv_func_'$cf_func'=no' -+fi -+rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -+fi -+ done -+ test -z "$cf_cv_link_funcs" && cf_cv_link_funcs=no -+ -+fi -+echo "$as_me:7103: result: $cf_cv_link_funcs" >&5 -+echo "${ECHO_T}$cf_cv_link_funcs" >&6 -+ test "$ac_cv_func_link" = yes && -+cat >>confdefs.h <<\EOF -+#define HAVE_LINK 1 -+EOF -+ -+ test "$ac_cv_func_symlink" = yes && -+cat >>confdefs.h <<\EOF -+#define HAVE_SYMLINK 1 -+EOF -+ -+fi -+ -+with_links=no -+with_symlinks=no -+ -+# soft links (symbolic links) are useful for some systems where hard links do -+# not work, or to make it simpler to copy terminfo trees around. -+if test "x$ac_cv_func_symlink" = xyes ; then -+ echo "$as_me:7123: checking if tic should use symbolic links" >&5 -+echo $ECHO_N "checking if tic should use symbolic links... $ECHO_C" >&6 -+ -+# Check whether --enable-symlinks or --disable-symlinks was given. -+if test "${enable_symlinks+set}" = set; then -+ enableval="$enable_symlinks" -+ with_symlinks=$enableval -+else -+ with_symlinks=no -+fi; -+ echo "$as_me:7133: result: $with_symlinks" >&5 -+echo "${ECHO_T}$with_symlinks" >&6 -+fi -+ -+# If we have hard links and did not choose to use soft links instead, there is -+# no reason to make this choice optional - use the hard links. -+if test "$with_symlinks" = no ; then -+ echo "$as_me:7140: checking if tic should use hard links" >&5 -+echo $ECHO_N "checking if tic should use hard links... $ECHO_C" >&6 -+ if test "x$ac_cv_func_link" = xyes ; then -+ with_links=yes -+ else -+ with_links=no -+ fi -+ echo "$as_me:7147: result: $with_links" >&5 -+echo "${ECHO_T}$with_links" >&6 -+fi -+ -+test "x$with_links" = xyes && -+cat >>confdefs.h <<\EOF -+#define USE_LINKS 1 -+EOF -+ -+test "x$with_symlinks" = xyes && -+cat >>confdefs.h <<\EOF -+#define USE_SYMLINKS 1 -+EOF -+ -+### use option --enable-broken-linker to force on use of broken-linker support -+echo "$as_me:7162: checking if you want broken-linker support code" >&5 -+echo $ECHO_N "checking if you want broken-linker support code... $ECHO_C" >&6 -+ -+# Check whether --enable-broken_linker or --disable-broken_linker was given. -+if test "${enable_broken_linker+set}" = set; then -+ enableval="$enable_broken_linker" -+ with_broken_linker=$enableval -+else -+ with_broken_linker=${BROKEN_LINKER:-no} -+fi; -+echo "$as_me:7172: result: $with_broken_linker" >&5 -+echo "${ECHO_T}$with_broken_linker" >&6 -+ -+BROKEN_LINKER=0 -+if test "x$with_broken_linker" = xyes ; then -+ -+cat >>confdefs.h <<\EOF -+#define BROKEN_LINKER 1 -+EOF -+ -+ BROKEN_LINKER=1 -+elif test "$DFT_LWR_MODEL" = shared ; then -+ case $cf_cv_system_name in #(vi -+ cygwin*) -+ -+cat >>confdefs.h <<\EOF -+#define BROKEN_LINKER 1 -+EOF -+ -+ BROKEN_LINKER=1 -+ test -n "$verbose" && echo " cygwin linker is broken anyway" 1>&6 -+ -+echo "${as_me:-configure}:7194: testing cygwin linker is broken anyway ..." 1>&5 -+ -+ ;; -+ esac -+fi -+ -+### use option --enable-bsdpad to have tputs process BSD-style prefix padding -+echo "$as_me:7201: checking if tputs should process BSD-style prefix padding" >&5 -+echo $ECHO_N "checking if tputs should process BSD-style prefix padding... $ECHO_C" >&6 -+ -+# Check whether --enable-bsdpad or --disable-bsdpad was given. -+if test "${enable_bsdpad+set}" = set; then -+ enableval="$enable_bsdpad" -+ with_bsdpad=$enableval -+else -+ with_bsdpad=no -+fi; -+echo "$as_me:7211: result: $with_bsdpad" >&5 -+echo "${ECHO_T}$with_bsdpad" >&6 -+test "x$with_bsdpad" = xyes && -+cat >>confdefs.h <<\EOF -+#define BSD_TPUTS 1 -+EOF -+ -+### use option --enable-widec to turn on use of wide-character support -+NCURSES_CH_T=chtype -+NCURSES_LIBUTF8=0 -+ -+NEED_WCHAR_H=0 -+NCURSES_MBSTATE_T=0 -+NCURSES_WCHAR_T=0 -+NCURSES_WINT_T=0 -+ -+# Check to define _XOPEN_SOURCE "automatically" -+ -+cf_XOPEN_SOURCE=500 -+cf_POSIX_C_SOURCE=199506L -+cf_xopen_source= -+ -+case $host_os in #(vi -+aix[4-7]*) #(vi -+ cf_xopen_source="-D_ALL_SOURCE" -+ ;; -+cygwin|msys) #(vi -+ cf_XOPEN_SOURCE=600 -+ ;; -+darwin[0-8].*) #(vi -+ cf_xopen_source="-D_APPLE_C_SOURCE" -+ ;; -+darwin*) #(vi -+ cf_xopen_source="-D_DARWIN_C_SOURCE" -+ cf_XOPEN_SOURCE= -+ ;; -+freebsd*|dragonfly*) #(vi -+ # 5.x headers associate -+ # _XOPEN_SOURCE=600 with _POSIX_C_SOURCE=200112L -+ # _XOPEN_SOURCE=500 with _POSIX_C_SOURCE=199506L -+ cf_POSIX_C_SOURCE=200112L -+ cf_XOPEN_SOURCE=600 -+ cf_xopen_source="-D_BSD_TYPES -D__BSD_VISIBLE -D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" -+ ;; -+hpux11*) #(vi -+ cf_xopen_source="-D_HPUX_SOURCE -D_XOPEN_SOURCE=500" -+ ;; -+hpux*) #(vi -+ cf_xopen_source="-D_HPUX_SOURCE" -+ ;; -+irix[56].*) #(vi -+ cf_xopen_source="-D_SGI_SOURCE" -+ cf_XOPEN_SOURCE= -+ ;; -+linux*|gnu*|mint*|k*bsd*-gnu) #(vi -+ -+echo "$as_me:7267: checking if we must define _GNU_SOURCE" >&5 -+echo $ECHO_N "checking if we must define _GNU_SOURCE... $ECHO_C" >&6 -+if test "${cf_cv_gnu_source+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ -+cat >conftest.$ac_ext <<_ACEOF -+#line 7274 "configure" -+#include "confdefs.h" -+#include -+int -+main () -+{ -+ -+#ifndef _XOPEN_SOURCE -+make an error -+#endif -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:7289: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>&5 -+ ac_status=$? -+ echo "$as_me:7292: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:7295: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:7298: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ cf_cv_gnu_source=no -+else -+ echo "$as_me: failed program was:" >&5 -+cat conftest.$ac_ext >&5 -+cf_save="$CPPFLAGS" -+ CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" -+ cat >conftest.$ac_ext <<_ACEOF -+#line 7307 "configure" -+#include "confdefs.h" -+#include -+int -+main () -+{ -+ -+#ifdef _XOPEN_SOURCE -+make an error -+#endif -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:7322: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>&5 -+ ac_status=$? -+ echo "$as_me:7325: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:7328: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:7331: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ cf_cv_gnu_source=no -+else -+ echo "$as_me: failed program was:" >&5 -+cat conftest.$ac_ext >&5 -+cf_cv_gnu_source=yes -+fi -+rm -f conftest.$ac_objext conftest.$ac_ext -+ CPPFLAGS="$cf_save" -+ -+fi -+rm -f conftest.$ac_objext conftest.$ac_ext -+ -+fi -+echo "$as_me:7346: result: $cf_cv_gnu_source" >&5 -+echo "${ECHO_T}$cf_cv_gnu_source" >&6 -+test "$cf_cv_gnu_source" = yes && CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" -+ -+ ;; -+mirbsd*) #(vi -+ # setting _XOPEN_SOURCE or _POSIX_SOURCE breaks and other headers which use u_int / u_short types -+ cf_XOPEN_SOURCE= -+ -+cf_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE -+ -+cf_save_CFLAGS="$CFLAGS" -+cf_save_CPPFLAGS="$CPPFLAGS" -+ -+cf_trim_CFLAGS=`echo "$cf_save_CFLAGS" | \ -+ sed -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \ -+ -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?$//g'` -+ -+cf_trim_CPPFLAGS=`echo "$cf_save_CPPFLAGS" | \ -+ sed -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \ -+ -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?$//g'` -+ -+echo "$as_me:7368: checking if we should define _POSIX_C_SOURCE" >&5 -+echo $ECHO_N "checking if we should define _POSIX_C_SOURCE... $ECHO_C" >&6 -+if test "${cf_cv_posix_c_source+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ -+echo "${as_me:-configure}:7374: testing if the symbol is already defined go no further ..." 1>&5 -+ -+ cat >conftest.$ac_ext <<_ACEOF -+#line 7377 "configure" -+#include "confdefs.h" -+#include -+int -+main () -+{ -+ -+#ifndef _POSIX_C_SOURCE -+make an error -+#endif -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:7392: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>&5 -+ ac_status=$? -+ echo "$as_me:7395: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:7398: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:7401: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ cf_cv_posix_c_source=no -+else -+ echo "$as_me: failed program was:" >&5 -+cat conftest.$ac_ext >&5 -+cf_want_posix_source=no -+ case .$cf_POSIX_C_SOURCE in #(vi -+ .[12]??*) #(vi -+ cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" -+ ;; -+ .2) #(vi -+ cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" -+ cf_want_posix_source=yes -+ ;; -+ .*) -+ cf_want_posix_source=yes -+ ;; -+ esac -+ if test "$cf_want_posix_source" = yes ; then -+ cat >conftest.$ac_ext <<_ACEOF -+#line 7422 "configure" -+#include "confdefs.h" -+#include -+int -+main () -+{ -+ -+#ifdef _POSIX_SOURCE -+make an error -+#endif -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:7437: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>&5 -+ ac_status=$? -+ echo "$as_me:7440: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:7443: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:7446: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ : -+else -+ echo "$as_me: failed program was:" >&5 -+cat conftest.$ac_ext >&5 -+cf_cv_posix_c_source="$cf_cv_posix_c_source -D_POSIX_SOURCE" -+fi -+rm -f conftest.$ac_objext conftest.$ac_ext -+ fi -+ -+echo "${as_me:-configure}:7457: testing ifdef from value $cf_POSIX_C_SOURCE ..." 1>&5 -+ -+ CFLAGS="$cf_trim_CFLAGS" -+ CPPFLAGS="$cf_trim_CPPFLAGS $cf_cv_posix_c_source" -+ -+echo "${as_me:-configure}:7462: testing if the second compile does not leave our definition intact error ..." 1>&5 -+ -+ cat >conftest.$ac_ext <<_ACEOF -+#line 7465 "configure" -+#include "confdefs.h" -+#include -+int -+main () -+{ -+ -+#ifndef _POSIX_C_SOURCE -+make an error -+#endif -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:7480: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>&5 -+ ac_status=$? -+ echo "$as_me:7483: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:7486: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:7489: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ : -+else -+ echo "$as_me: failed program was:" >&5 -+cat conftest.$ac_ext >&5 -+cf_cv_posix_c_source=no -+fi -+rm -f conftest.$ac_objext conftest.$ac_ext -+ CFLAGS="$cf_save_CFLAGS" -+ CPPFLAGS="$cf_save_CPPFLAGS" -+ -+fi -+rm -f conftest.$ac_objext conftest.$ac_ext -+ -+fi -+echo "$as_me:7505: result: $cf_cv_posix_c_source" >&5 -+echo "${ECHO_T}$cf_cv_posix_c_source" >&6 -+ -+if test "$cf_cv_posix_c_source" != no ; then -+ CFLAGS="$cf_trim_CFLAGS" -+ CPPFLAGS="$cf_trim_CPPFLAGS" -+ -+cf_fix_cppflags=no -+cf_new_cflags= -+cf_new_cppflags= -+cf_new_extra_cppflags= -+ -+for cf_add_cflags in $cf_cv_posix_c_source -+do -+case $cf_fix_cppflags in -+no) -+ case $cf_add_cflags in #(vi -+ -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi -+ case $cf_add_cflags in -+ -D*) -+ cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` -+ -+ test "${cf_add_cflags}" != "${cf_tst_cflags}" \ -+ && test -z "${cf_tst_cflags}" \ -+ && cf_fix_cppflags=yes -+ -+ if test $cf_fix_cppflags = yes ; then -+ cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -+ continue -+ elif test "${cf_tst_cflags}" = "\"'" ; then -+ cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -+ continue -+ fi -+ ;; -+ esac -+ case "$CPPFLAGS" in -+ *$cf_add_cflags) #(vi -+ ;; -+ *) #(vi -+ case $cf_add_cflags in #(vi -+ -D*) -+ cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` -+ -+CPPFLAGS=`echo "$CPPFLAGS" | \ -+ sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ -+ -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` -+ -+ ;; -+ esac -+ cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" -+ ;; -+ esac -+ ;; -+ *) -+ cf_new_cflags="$cf_new_cflags $cf_add_cflags" -+ ;; -+ esac -+ ;; -+yes) -+ cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -+ -+ cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` -+ -+ test "${cf_add_cflags}" != "${cf_tst_cflags}" \ -+ && test -z "${cf_tst_cflags}" \ -+ && cf_fix_cppflags=no -+ ;; -+esac -+done -+ -+if test -n "$cf_new_cflags" ; then -+ -+ CFLAGS="$CFLAGS $cf_new_cflags" -+fi -+ -+if test -n "$cf_new_cppflags" ; then -+ -+ CPPFLAGS="$CPPFLAGS $cf_new_cppflags" -+fi -+ -+if test -n "$cf_new_extra_cppflags" ; then -+ -+ EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" -+fi -+ -+fi -+ -+ ;; -+netbsd*) #(vi -+ cf_xopen_source="-D_NETBSD_SOURCE" # setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw -+ ;; -+openbsd[4-9]*) #(vi -+ # setting _XOPEN_SOURCE lower than 500 breaks g++ compile with wchar.h, needed for ncursesw -+ cf_xopen_source="-D_BSD_SOURCE" -+ cf_XOPEN_SOURCE=600 -+ ;; -+openbsd*) #(vi -+ # setting _XOPEN_SOURCE breaks xterm on OpenBSD 2.8, is not needed for ncursesw -+ ;; -+osf[45]*) #(vi -+ cf_xopen_source="-D_OSF_SOURCE" -+ ;; -+nto-qnx*) #(vi -+ cf_xopen_source="-D_QNX_SOURCE" -+ ;; -+sco*) #(vi -+ # setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer -+ ;; -+solaris2.*) #(vi -+ cf_xopen_source="-D__EXTENSIONS__" -+ cf_cv_xopen_source=broken -+ ;; -+*) -+ -+echo "$as_me:7619: checking if we should define _XOPEN_SOURCE" >&5 -+echo $ECHO_N "checking if we should define _XOPEN_SOURCE... $ECHO_C" >&6 -+if test "${cf_cv_xopen_source+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else -- cat >conftest.$ac_ext <<_ACEOF --#line 6711 "configure" -+ -+ cat >conftest.$ac_ext <<_ACEOF -+#line 7626 "configure" - #include "confdefs.h" --/* System header to define __stub macros and hopefully few prototypes, -- which can conflict with char $ac_func (); below. */ --#include --/* Override any gcc2 internal prototype to avoid an error. */ --#ifdef __cplusplus --extern "C" --#endif --/* We use char because int might match the return type of a gcc2 -- builtin and then its argument prototype would still apply. */ --char $ac_func (); --char (*f) (); -+ -+#include -+#include -+#include - - int - main () - { --/* The GNU C library defines this for functions which it implements -- to always fail with ENOSYS. Some functions are actually named -- something starting with __ and the normal name is an alias. */ --#if defined (__stub_$ac_func) || defined (__stub___$ac_func) --choke me --#else --f = $ac_func; --#endif - -+#ifndef _XOPEN_SOURCE -+make an error -+#endif - ; - return 0; - } - _ACEOF --rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:6742: \"$ac_link\"") >&5 -- (eval $ac_link) 2>&5 -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:7645: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:6745: \$? = $ac_status" >&5 -+ echo "$as_me:7648: \$? = $ac_status" >&5 - (exit $ac_status); } && -- { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:6748: \"$ac_try\"") >&5 -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:7651: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:6751: \$? = $ac_status" >&5 -+ echo "$as_me:7654: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- eval "$as_ac_var=yes" -+ cf_cv_xopen_source=no - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --eval "$as_ac_var=no" --fi --rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext --fi --echo "$as_me:6761: result: `eval echo '${'$as_ac_var'}'`" >&5 --echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 --if test `eval echo '${'$as_ac_var'}'` = yes; then -- cat >>confdefs.h <&5 --echo $ECHO_N "checking if link/symlink functions work... $ECHO_C" >&6 --if test "${cf_cv_link_funcs+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 --else -- -- cf_cv_link_funcs= -- for cf_func in link symlink ; do -- if test "$cross_compiling" = yes; then -- -- eval 'ac_cv_func_'$cf_func'=error' --else -- cat >conftest.$ac_ext <<_ACEOF --#line 6785 "configure" -+cf_save="$CPPFLAGS" -+ CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" -+ cat >conftest.$ac_ext <<_ACEOF -+#line 7663 "configure" - #include "confdefs.h" - -+#include -+#include - #include --#include --#ifdef HAVE_UNISTD_H --#include --#endif --int main() -+ -+int -+main () - { -- int fail = 0; -- char *src = "config.log"; -- char *dst = "conftest.chk"; -- struct stat src_sb; -- struct stat dst_sb; - -- stat(src, &src_sb); -- fail = ($cf_func("config.log", "conftest.chk") < 0) -- || (stat(dst, &dst_sb) < 0) -- || (dst_sb.st_mtime != src_sb.st_mtime); --#ifdef HAVE_UNLINK -- unlink(dst); --#else -- remove(dst); -+#ifdef _XOPEN_SOURCE -+make an error - #endif -- ${cf_cv_main_return:-return} (fail); -+ ; -+ return 0; - } -- - _ACEOF --rm -f conftest$ac_exeext --if { (eval echo "$as_me:6815: \"$ac_link\"") >&5 -- (eval $ac_link) 2>&5 -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:7682: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:6818: \$? = $ac_status" >&5 -- (exit $ac_status); } && { ac_try='./conftest$ac_exeext' -- { (eval echo "$as_me:6820: \"$ac_try\"") >&5 -+ echo "$as_me:7685: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:7688: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:6823: \$? = $ac_status" >&5 -+ echo "$as_me:7691: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- -- cf_cv_link_funcs="$cf_cv_link_funcs $cf_func" -- eval 'ac_cv_func_'$cf_func'=yes' -+ cf_cv_xopen_source=no - else -- echo "$as_me: program exited with status $ac_status" >&5 --echo "$as_me: failed program was:" >&5 -+ echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 -- -- eval 'ac_cv_func_'$cf_func'=no' -+cf_cv_xopen_source=$cf_XOPEN_SOURCE - fi --rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -+rm -f conftest.$ac_objext conftest.$ac_ext -+ CPPFLAGS="$cf_save" -+ - fi -- done -- test -z "$cf_cv_link_funcs" && cf_cv_link_funcs=no -+rm -f conftest.$ac_objext conftest.$ac_ext - - fi --echo "$as_me:6841: result: $cf_cv_link_funcs" >&5 --echo "${ECHO_T}$cf_cv_link_funcs" >&6 -- test "$ac_cv_func_link" = yes && cat >>confdefs.h <<\EOF --#define HAVE_LINK 1 --EOF -+echo "$as_me:7706: result: $cf_cv_xopen_source" >&5 -+echo "${ECHO_T}$cf_cv_xopen_source" >&6 - -- test "$ac_cv_func_symlink" = yes && cat >>confdefs.h <<\EOF --#define HAVE_SYMLINK 1 --EOF -+if test "$cf_cv_xopen_source" != no ; then - --fi -+CFLAGS=`echo "$CFLAGS" | \ -+ sed -e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \ -+ -e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ ]*\)\?$//g'` - --with_links=no --with_symlinks=no -+CPPFLAGS=`echo "$CPPFLAGS" | \ -+ sed -e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \ -+ -e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ ]*\)\?$//g'` - --# soft links (symbolic links) are useful for some systems where hard links do --# not work, or to make it simpler to copy terminfo trees around. --if test "$ac_cv_func_symlink" = yes ; then -- echo "$as_me:6859: checking if tic should use symbolic links" >&5 --echo $ECHO_N "checking if tic should use symbolic links... $ECHO_C" >&6 -+ cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source" - --# Check whether --enable-symlinks or --disable-symlinks was given. --if test "${enable_symlinks+set}" = set; then -- enableval="$enable_symlinks" -- with_symlinks=$enableval --else -- with_symlinks=no --fi; -- echo "$as_me:6869: result: $with_symlinks" >&5 --echo "${ECHO_T}$with_symlinks" >&6 --fi -+cf_fix_cppflags=no -+cf_new_cflags= -+cf_new_cppflags= -+cf_new_extra_cppflags= - --# If we have hard links and did not choose to use soft links instead, there is --# no reason to make this choice optional - use the hard links. --if test "$with_symlinks" = no ; then -- echo "$as_me:6876: checking if tic should use hard links" >&5 --echo $ECHO_N "checking if tic should use hard links... $ECHO_C" >&6 -- if test "$ac_cv_func_link" = yes ; then -- with_links=yes -- else -- with_links=no -- fi -- echo "$as_me:6883: result: $with_links" >&5 --echo "${ECHO_T}$with_links" >&6 --fi -+for cf_add_cflags in $cf_temp_xopen_source -+do -+case $cf_fix_cppflags in -+no) -+ case $cf_add_cflags in #(vi -+ -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi -+ case $cf_add_cflags in -+ -D*) -+ cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` - --test "$with_links" = yes && cat >>confdefs.h <<\EOF --#define USE_LINKS 1 --EOF -+ test "${cf_add_cflags}" != "${cf_tst_cflags}" \ -+ && test -z "${cf_tst_cflags}" \ -+ && cf_fix_cppflags=yes - --test "$with_symlinks" = yes && cat >>confdefs.h <<\EOF --#define USE_SYMLINKS 1 --EOF -+ if test $cf_fix_cppflags = yes ; then -+ cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -+ continue -+ elif test "${cf_tst_cflags}" = "\"'" ; then -+ cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -+ continue -+ fi -+ ;; -+ esac -+ case "$CPPFLAGS" in -+ *$cf_add_cflags) #(vi -+ ;; -+ *) #(vi -+ case $cf_add_cflags in #(vi -+ -D*) -+ cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` - --### use option --enable-broken-linker to force on use of broken-linker support --echo "$as_me:6896: checking if you want broken-linker support code" >&5 --echo $ECHO_N "checking if you want broken-linker support code... $ECHO_C" >&6 -+CPPFLAGS=`echo "$CPPFLAGS" | \ -+ sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ -+ -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` - --# Check whether --enable-broken_linker or --disable-broken_linker was given. --if test "${enable_broken_linker+set}" = set; then -- enableval="$enable_broken_linker" -- with_broken_linker=$enableval --else -- with_broken_linker=${BROKEN_LINKER:-no} --fi; --echo "$as_me:6906: result: $with_broken_linker" >&5 --echo "${ECHO_T}$with_broken_linker" >&6 -+ ;; -+ esac -+ cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" -+ ;; -+ esac -+ ;; -+ *) -+ cf_new_cflags="$cf_new_cflags $cf_add_cflags" -+ ;; -+ esac -+ ;; -+yes) -+ cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" - --BROKEN_LINKER=0 --if test "$with_broken_linker" = yes ; then -- cat >>confdefs.h <<\EOF --#define BROKEN_LINKER 1 --EOF -+ cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` - -- BROKEN_LINKER=1 --elif test "$DFT_LWR_MODEL" = shared ; then -- case $cf_cv_system_name in #(vi -- cygwin*) -- cat >>confdefs.h <<\EOF --#define BROKEN_LINKER 1 --EOF -+ test "${cf_add_cflags}" != "${cf_tst_cflags}" \ -+ && test -z "${cf_tst_cflags}" \ -+ && cf_fix_cppflags=no -+ ;; -+esac -+done - -- BROKEN_LINKER=1 -- test -n "$verbose" && echo " cygwin linker is broken anyway" 1>&6 -+if test -n "$cf_new_cflags" ; then -+ -+ CFLAGS="$CFLAGS $cf_new_cflags" -+fi - --echo "${as_me:-configure}:6926: testing cygwin linker is broken anyway ..." 1>&5 -+if test -n "$cf_new_cppflags" ; then - -- ;; -- esac -+ CPPFLAGS="$CPPFLAGS $cf_new_cppflags" - fi - --### use option --enable-bsdpad to have tputs process BSD-style prefix padding --echo "$as_me:6933: checking if tputs should process BSD-style prefix padding" >&5 --echo $ECHO_N "checking if tputs should process BSD-style prefix padding... $ECHO_C" >&6 -+if test -n "$cf_new_extra_cppflags" ; then - --# Check whether --enable-bsdpad or --disable-bsdpad was given. --if test "${enable_bsdpad+set}" = set; then -- enableval="$enable_bsdpad" -- with_bsdpad=$enableval --else -- with_bsdpad=no --fi; --echo "$as_me:6943: result: $with_bsdpad" >&5 --echo "${ECHO_T}$with_bsdpad" >&6 --test "$with_bsdpad" = yes && cat >>confdefs.h <<\EOF --#define BSD_TPUTS 1 --EOF -+ EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" -+fi - --### use option --enable-widec to turn on use of wide-character support --NCURSES_CH_T=chtype --NCURSES_LIBUTF8=0 -+fi - --NEED_WCHAR_H=0 --NCURSES_MBSTATE_T=0 --NCURSES_WCHAR_T=0 --NCURSES_WINT_T=0 -+cf_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE - --# Check to define _XOPEN_SOURCE "automatically" -+cf_save_CFLAGS="$CFLAGS" -+cf_save_CPPFLAGS="$CPPFLAGS" - --cf_XOPEN_SOURCE=500 --cf_POSIX_C_SOURCE=199506L --cf_xopen_source= -+cf_trim_CFLAGS=`echo "$cf_save_CFLAGS" | \ -+ sed -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \ -+ -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?$//g'` - --case $host_os in #(vi --aix[456]*) #(vi -- cf_xopen_source="-D_ALL_SOURCE" -- ;; --cygwin) #(vi -- cf_XOPEN_SOURCE=600 -- ;; --darwin[0-8].*) #(vi -- cf_xopen_source="-D_APPLE_C_SOURCE" -- ;; --darwin*) #(vi -- cf_xopen_source="-D_DARWIN_C_SOURCE" -- ;; --freebsd*|dragonfly*) #(vi -- # 5.x headers associate -- # _XOPEN_SOURCE=600 with _POSIX_C_SOURCE=200112L -- # _XOPEN_SOURCE=500 with _POSIX_C_SOURCE=199506L -- cf_POSIX_C_SOURCE=200112L -- cf_XOPEN_SOURCE=600 -- cf_xopen_source="-D_BSD_TYPES -D__BSD_VISIBLE -D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" -- ;; --hpux11*) #(vi -- cf_xopen_source="-D_HPUX_SOURCE -D_XOPEN_SOURCE=500" -- ;; --hpux*) #(vi -- cf_xopen_source="-D_HPUX_SOURCE" -- ;; --irix[56].*) #(vi -- cf_xopen_source="-D_SGI_SOURCE" -- ;; --linux*|gnu*|mint*|k*bsd*-gnu) #(vi -+cf_trim_CPPFLAGS=`echo "$cf_save_CPPFLAGS" | \ -+ sed -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \ -+ -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?$//g'` - --echo "$as_me:6996: checking if we must define _GNU_SOURCE" >&5 --echo $ECHO_N "checking if we must define _GNU_SOURCE... $ECHO_C" >&6 --if test "${cf_cv_gnu_source+set}" = set; then -+echo "$as_me:7814: checking if we should define _POSIX_C_SOURCE" >&5 -+echo $ECHO_N "checking if we should define _POSIX_C_SOURCE... $ECHO_C" >&6 -+if test "${cf_cv_posix_c_source+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - --cat >conftest.$ac_ext <<_ACEOF --#line 7003 "configure" -+echo "${as_me:-configure}:7820: testing if the symbol is already defined go no further ..." 1>&5 -+ -+ cat >conftest.$ac_ext <<_ACEOF -+#line 7823 "configure" - #include "confdefs.h" - #include - int - main () - { - --#ifndef _XOPEN_SOURCE -+#ifndef _POSIX_C_SOURCE - make an error - #endif - ; -@@ -7015,32 +7835,44 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:7018: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:7838: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:7021: \$? = $ac_status" >&5 -+ echo "$as_me:7841: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:7024: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:7844: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:7027: \$? = $ac_status" >&5 -+ echo "$as_me:7847: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- cf_cv_gnu_source=no -+ cf_cv_posix_c_source=no - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --cf_save="$CPPFLAGS" -- CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" -- cat >conftest.$ac_ext <<_ACEOF --#line 7036 "configure" -+cf_want_posix_source=no -+ case .$cf_POSIX_C_SOURCE in #(vi -+ .[12]??*) #(vi -+ cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" -+ ;; -+ .2) #(vi -+ cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" -+ cf_want_posix_source=yes -+ ;; -+ .*) -+ cf_want_posix_source=yes -+ ;; -+ esac -+ if test "$cf_want_posix_source" = yes ; then -+ cat >conftest.$ac_ext <<_ACEOF -+#line 7868 "configure" - #include "confdefs.h" - #include - int - main () - { - --#ifdef _XOPEN_SOURCE -+#ifdef _POSIX_SOURCE - make an error - #endif - ; -@@ -7048,108 +7880,42 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:7051: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:7883: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:7054: \$? = $ac_status" >&5 -+ echo "$as_me:7886: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:7057: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:7889: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:7060: \$? = $ac_status" >&5 -+ echo "$as_me:7892: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- cf_cv_gnu_source=no -+ : - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --cf_cv_gnu_source=yes --fi --rm -f conftest.$ac_objext conftest.$ac_ext -- CPPFLAGS="$cf_save" -- -+cf_cv_posix_c_source="$cf_cv_posix_c_source -D_POSIX_SOURCE" - fi - rm -f conftest.$ac_objext conftest.$ac_ext -+ fi - --fi --echo "$as_me:7075: result: $cf_cv_gnu_source" >&5 --echo "${ECHO_T}$cf_cv_gnu_source" >&6 --test "$cf_cv_gnu_source" = yes && CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" -+echo "${as_me:-configure}:7903: testing ifdef from value $cf_POSIX_C_SOURCE ..." 1>&5 - -- ;; --mirbsd*) #(vi -- # setting _XOPEN_SOURCE or _POSIX_SOURCE breaks -- ;; --netbsd*) #(vi -- # setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw -- ;; --openbsd*) #(vi -- # setting _XOPEN_SOURCE breaks xterm on OpenBSD 2.8, is not needed for ncursesw -- ;; --osf[45]*) #(vi -- cf_xopen_source="-D_OSF_SOURCE" -- ;; --nto-qnx*) #(vi -- cf_xopen_source="-D_QNX_SOURCE" -- ;; --sco*) #(vi -- # setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer -- ;; --solaris2.1[0-9]) #(vi -- cf_xopen_source="-D__EXTENSIONS__ -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" -- ;; --solaris2.[1-9]) #(vi -- cf_xopen_source="-D__EXTENSIONS__" -- ;; --*) -- echo "$as_me:7105: checking if we should define _XOPEN_SOURCE" >&5 --echo $ECHO_N "checking if we should define _XOPEN_SOURCE... $ECHO_C" >&6 --if test "${cf_cv_xopen_source+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 --else -+ CFLAGS="$cf_trim_CFLAGS" -+ CPPFLAGS="$cf_trim_CPPFLAGS $cf_cv_posix_c_source" - -- cat >conftest.$ac_ext <<_ACEOF --#line 7112 "configure" --#include "confdefs.h" --#include --int --main () --{ -+echo "${as_me:-configure}:7908: testing if the second compile does not leave our definition intact error ..." 1>&5 - --#ifndef _XOPEN_SOURCE --make an error --#endif -- ; -- return 0; --} --_ACEOF --rm -f conftest.$ac_objext --if { (eval echo "$as_me:7127: \"$ac_compile\"") >&5 -- (eval $ac_compile) 2>&5 -- ac_status=$? -- echo "$as_me:7130: \$? = $ac_status" >&5 -- (exit $ac_status); } && -- { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:7133: \"$ac_try\"") >&5 -- (eval $ac_try) 2>&5 -- ac_status=$? -- echo "$as_me:7136: \$? = $ac_status" >&5 -- (exit $ac_status); }; }; then -- cf_cv_xopen_source=no --else -- echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 --cf_save="$CPPFLAGS" -- CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" - cat >conftest.$ac_ext <<_ACEOF --#line 7145 "configure" -+#line 7911 "configure" - #include "confdefs.h" - #include - int - main () - { - --#ifdef _XOPEN_SOURCE -+#ifndef _POSIX_C_SOURCE - make an error - #endif - ; -@@ -7157,50 +7923,129 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:7160: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:7926: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:7163: \$? = $ac_status" >&5 -+ echo "$as_me:7929: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:7166: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:7932: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:7169: \$? = $ac_status" >&5 -+ echo "$as_me:7935: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- cf_cv_xopen_source=no -+ : - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --cf_cv_xopen_source=$cf_XOPEN_SOURCE -+cf_cv_posix_c_source=no - fi - rm -f conftest.$ac_objext conftest.$ac_ext -- CPPFLAGS="$cf_save" -+ CFLAGS="$cf_save_CFLAGS" -+ CPPFLAGS="$cf_save_CPPFLAGS" -+ -+fi -+rm -f conftest.$ac_objext conftest.$ac_ext -+ -+fi -+echo "$as_me:7951: result: $cf_cv_posix_c_source" >&5 -+echo "${ECHO_T}$cf_cv_posix_c_source" >&6 -+ -+if test "$cf_cv_posix_c_source" != no ; then -+ CFLAGS="$cf_trim_CFLAGS" -+ CPPFLAGS="$cf_trim_CPPFLAGS" -+ -+cf_fix_cppflags=no -+cf_new_cflags= -+cf_new_cppflags= -+cf_new_extra_cppflags= -+ -+for cf_add_cflags in $cf_cv_posix_c_source -+do -+case $cf_fix_cppflags in -+no) -+ case $cf_add_cflags in #(vi -+ -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi -+ case $cf_add_cflags in -+ -D*) -+ cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` -+ -+ test "${cf_add_cflags}" != "${cf_tst_cflags}" \ -+ && test -z "${cf_tst_cflags}" \ -+ && cf_fix_cppflags=yes -+ -+ if test $cf_fix_cppflags = yes ; then -+ cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -+ continue -+ elif test "${cf_tst_cflags}" = "\"'" ; then -+ cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -+ continue -+ fi -+ ;; -+ esac -+ case "$CPPFLAGS" in -+ *$cf_add_cflags) #(vi -+ ;; -+ *) #(vi -+ case $cf_add_cflags in #(vi -+ -D*) -+ cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` -+ -+CPPFLAGS=`echo "$CPPFLAGS" | \ -+ sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ -+ -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` -+ -+ ;; -+ esac -+ cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" -+ ;; -+ esac -+ ;; -+ *) -+ cf_new_cflags="$cf_new_cflags $cf_add_cflags" -+ ;; -+ esac -+ ;; -+yes) -+ cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -+ -+ cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` -+ -+ test "${cf_add_cflags}" != "${cf_tst_cflags}" \ -+ && test -z "${cf_tst_cflags}" \ -+ && cf_fix_cppflags=no -+ ;; -+esac -+done -+ -+if test -n "$cf_new_cflags" ; then -+ -+ CFLAGS="$CFLAGS $cf_new_cflags" -+fi -+ -+if test -n "$cf_new_cppflags" ; then -+ -+ CPPFLAGS="$CPPFLAGS $cf_new_cppflags" -+fi -+ -+if test -n "$cf_new_extra_cppflags" ; then - -+ EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" - fi --rm -f conftest.$ac_objext conftest.$ac_ext - - fi --echo "$as_me:7184: result: $cf_cv_xopen_source" >&5 --echo "${ECHO_T}$cf_cv_xopen_source" >&6 -- if test "$cf_cv_xopen_source" != no ; then -- --CFLAGS=`echo "$CFLAGS" | \ -- sed -e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \ -- -e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ ]*\)\?$//g'` - --CPPFLAGS=`echo "$CPPFLAGS" | \ -- sed -e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \ -- -e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ ]*\)\?$//g'` -+ ;; -+esac - -- cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source" -+if test -n "$cf_xopen_source" ; then - - cf_fix_cppflags=no - cf_new_cflags= - cf_new_cppflags= - cf_new_extra_cppflags= - --for cf_add_cflags in $cf_temp_xopen_source -+for cf_add_cflags in $cf_xopen_source - do - case $cf_fix_cppflags in - no) -@@ -7273,38 +8118,20 @@ - EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" - fi - -- fi -- --cf_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE -- --cf_save_CFLAGS="$CFLAGS" --cf_save_CPPFLAGS="$CPPFLAGS" -- --cf_trim_CFLAGS=`echo "$cf_save_CFLAGS" | \ -- sed -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \ -- -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?$//g'` -- --cf_trim_CPPFLAGS=`echo "$cf_save_CPPFLAGS" | \ -- sed -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \ -- -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?$//g'` -- --echo "$as_me:7291: checking if we should define _POSIX_C_SOURCE" >&5 --echo $ECHO_N "checking if we should define _POSIX_C_SOURCE... $ECHO_C" >&6 --if test "${cf_cv_posix_c_source+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 --else -- --echo "${as_me:-configure}:7297: testing if the symbol is already defined go no further ..." 1>&5 -+fi - -+if test -n "$cf_XOPEN_SOURCE" && test -z "$cf_cv_xopen_source" ; then -+ echo "$as_me:8124: checking if _XOPEN_SOURCE really is set" >&5 -+echo $ECHO_N "checking if _XOPEN_SOURCE really is set... $ECHO_C" >&6 - cat >conftest.$ac_ext <<_ACEOF --#line 7300 "configure" -+#line 8127 "configure" - #include "confdefs.h" --#include -+#include - int - main () - { - --#ifndef _POSIX_C_SOURCE -+#ifndef _XOPEN_SOURCE - make an error - #endif - ; -@@ -7312,44 +8139,37 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:7315: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:8142: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:7318: \$? = $ac_status" >&5 -+ echo "$as_me:8145: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:7321: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:8148: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:7324: \$? = $ac_status" >&5 -+ echo "$as_me:8151: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- cf_cv_posix_c_source=no -+ cf_XOPEN_SOURCE_set=yes - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --cf_want_posix_source=no -- case .$cf_POSIX_C_SOURCE in #(vi -- .[12]??*) #(vi -- cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" -- ;; -- .2) #(vi -- cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" -- cf_want_posix_source=yes -- ;; -- .*) -- cf_want_posix_source=yes -- ;; -- esac -- if test "$cf_want_posix_source" = yes ; then -+cf_XOPEN_SOURCE_set=no -+fi -+rm -f conftest.$ac_objext conftest.$ac_ext -+ echo "$as_me:8160: result: $cf_XOPEN_SOURCE_set" >&5 -+echo "${ECHO_T}$cf_XOPEN_SOURCE_set" >&6 -+ if test $cf_XOPEN_SOURCE_set = yes -+ then - cat >conftest.$ac_ext <<_ACEOF --#line 7345 "configure" -+#line 8165 "configure" - #include "confdefs.h" --#include -+#include - int - main () - { - --#ifdef _POSIX_SOURCE -+#if (_XOPEN_SOURCE - 0) < $cf_XOPEN_SOURCE - make an error - #endif - ; -@@ -7357,42 +8177,87 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:7360: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:8180: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:7363: \$? = $ac_status" >&5 -+ echo "$as_me:8183: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:7366: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:8186: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:7369: \$? = $ac_status" >&5 -+ echo "$as_me:8189: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- : -+ cf_XOPEN_SOURCE_set_ok=yes - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --cf_cv_posix_c_source="$cf_cv_posix_c_source -D_POSIX_SOURCE" -+cf_XOPEN_SOURCE_set_ok=no - fi - rm -f conftest.$ac_objext conftest.$ac_ext -- fi -+ if test $cf_XOPEN_SOURCE_set_ok = no -+ then -+ { echo "$as_me:8200: WARNING: _XOPEN_SOURCE is lower than requested" >&5 -+echo "$as_me: WARNING: _XOPEN_SOURCE is lower than requested" >&2;} -+ fi -+ else -+ -+echo "$as_me:8205: checking if we should define _XOPEN_SOURCE" >&5 -+echo $ECHO_N "checking if we should define _XOPEN_SOURCE... $ECHO_C" >&6 -+if test "${cf_cv_xopen_source+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else - --echo "${as_me:-configure}:7380: testing ifdef from value $cf_POSIX_C_SOURCE ..." 1>&5 -+ cat >conftest.$ac_ext <<_ACEOF -+#line 8212 "configure" -+#include "confdefs.h" - -- CFLAGS="$cf_trim_CFLAGS" -- CPPFLAGS="$cf_trim_CPPFLAGS $cf_cv_posix_c_source" -+#include -+#include -+#include - --echo "${as_me:-configure}:7385: testing if the second compile does not leave our definition intact error ..." 1>&5 -+int -+main () -+{ - -+#ifndef _XOPEN_SOURCE -+make an error -+#endif -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:8231: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>&5 -+ ac_status=$? -+ echo "$as_me:8234: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:8237: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:8240: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ cf_cv_xopen_source=no -+else -+ echo "$as_me: failed program was:" >&5 -+cat conftest.$ac_ext >&5 -+cf_save="$CPPFLAGS" -+ CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" - cat >conftest.$ac_ext <<_ACEOF --#line 7388 "configure" -+#line 8249 "configure" - #include "confdefs.h" -+ -+#include -+#include - #include -+ - int - main () - { - --#ifndef _POSIX_C_SOURCE -+#ifdef _XOPEN_SOURCE - make an error - #endif - ; -@@ -7400,129 +8265,51 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:7403: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:8268: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:7406: \$? = $ac_status" >&5 -+ echo "$as_me:8271: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:7409: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:8274: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:7412: \$? = $ac_status" >&5 -+ echo "$as_me:8277: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- : -+ cf_cv_xopen_source=no - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --cf_cv_posix_c_source=no -+cf_cv_xopen_source=$cf_XOPEN_SOURCE - fi - rm -f conftest.$ac_objext conftest.$ac_ext -- CFLAGS="$cf_save_CFLAGS" -- CPPFLAGS="$cf_save_CPPFLAGS" -+ CPPFLAGS="$cf_save" - - fi - rm -f conftest.$ac_objext conftest.$ac_ext - - fi --echo "$as_me:7428: result: $cf_cv_posix_c_source" >&5 --echo "${ECHO_T}$cf_cv_posix_c_source" >&6 -- --if test "$cf_cv_posix_c_source" != no ; then -- CFLAGS="$cf_trim_CFLAGS" -- CPPFLAGS="$cf_trim_CPPFLAGS" -- --cf_fix_cppflags=no --cf_new_cflags= --cf_new_cppflags= --cf_new_extra_cppflags= -- --for cf_add_cflags in $cf_cv_posix_c_source --do --case $cf_fix_cppflags in --no) -- case $cf_add_cflags in #(vi -- -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi -- case $cf_add_cflags in -- -D*) -- cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` -+echo "$as_me:8292: result: $cf_cv_xopen_source" >&5 -+echo "${ECHO_T}$cf_cv_xopen_source" >&6 - -- test "${cf_add_cflags}" != "${cf_tst_cflags}" \ -- && test -z "${cf_tst_cflags}" \ -- && cf_fix_cppflags=yes -+if test "$cf_cv_xopen_source" != no ; then - -- if test $cf_fix_cppflags = yes ; then -- cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -- continue -- elif test "${cf_tst_cflags}" = "\"'" ; then -- cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -- continue -- fi -- ;; -- esac -- case "$CPPFLAGS" in -- *$cf_add_cflags) #(vi -- ;; -- *) #(vi -- case $cf_add_cflags in #(vi -- -D*) -- cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` -+CFLAGS=`echo "$CFLAGS" | \ -+ sed -e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \ -+ -e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ ]*\)\?$//g'` - - CPPFLAGS=`echo "$CPPFLAGS" | \ -- sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ -- -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` -- -- ;; -- esac -- cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" -- ;; -- esac -- ;; -- *) -- cf_new_cflags="$cf_new_cflags $cf_add_cflags" -- ;; -- esac -- ;; --yes) -- cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -- -- cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` -- -- test "${cf_add_cflags}" != "${cf_tst_cflags}" \ -- && test -z "${cf_tst_cflags}" \ -- && cf_fix_cppflags=no -- ;; --esac --done -- --if test -n "$cf_new_cflags" ; then -- -- CFLAGS="$CFLAGS $cf_new_cflags" --fi -- --if test -n "$cf_new_cppflags" ; then -- -- CPPFLAGS="$CPPFLAGS $cf_new_cppflags" --fi -- --if test -n "$cf_new_extra_cppflags" ; then -- -- EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" --fi -- --fi -- -- ;; --esac -+ sed -e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \ -+ -e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ ]*\)\?$//g'` - --if test -n "$cf_xopen_source" ; then -+ cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source" - - cf_fix_cppflags=no - cf_new_cflags= - cf_new_cppflags= - cf_new_extra_cppflags= - --for cf_add_cflags in $cf_xopen_source -+for cf_add_cflags in $cf_temp_xopen_source - do - case $cf_fix_cppflags in - no) -@@ -7597,16 +8384,19 @@ - - fi - -+ fi -+fi -+ - # Work around breakage on OS X - --echo "$as_me:7602: checking if SIGWINCH is defined" >&5 -+echo "$as_me:8392: checking if SIGWINCH is defined" >&5 - echo $ECHO_N "checking if SIGWINCH is defined... $ECHO_C" >&6 - if test "${cf_cv_define_sigwinch+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - - cat >conftest.$ac_ext <<_ACEOF --#line 7609 "configure" -+#line 8399 "configure" - #include "confdefs.h" - - #include -@@ -7621,23 +8411,23 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:7624: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:8414: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:7627: \$? = $ac_status" >&5 -+ echo "$as_me:8417: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:7630: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:8420: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:7633: \$? = $ac_status" >&5 -+ echo "$as_me:8423: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_cv_define_sigwinch=yes - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 - cat >conftest.$ac_ext <<_ACEOF --#line 7640 "configure" -+#line 8430 "configure" - #include "confdefs.h" - - #undef _XOPEN_SOURCE -@@ -7655,16 +8445,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:7658: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:8448: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:7661: \$? = $ac_status" >&5 -+ echo "$as_me:8451: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:7664: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:8454: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:7667: \$? = $ac_status" >&5 -+ echo "$as_me:8457: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_cv_define_sigwinch=maybe - else -@@ -7678,11 +8468,11 @@ - rm -f conftest.$ac_objext conftest.$ac_ext - - fi --echo "$as_me:7681: result: $cf_cv_define_sigwinch" >&5 -+echo "$as_me:8471: result: $cf_cv_define_sigwinch" >&5 - echo "${ECHO_T}$cf_cv_define_sigwinch" >&6 - - if test "$cf_cv_define_sigwinch" = maybe ; then --echo "$as_me:7685: checking for actual SIGWINCH definition" >&5 -+echo "$as_me:8475: checking for actual SIGWINCH definition" >&5 - echo $ECHO_N "checking for actual SIGWINCH definition... $ECHO_C" >&6 - if test "${cf_cv_fixup_sigwinch+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -7693,7 +8483,7 @@ - while test $cf_sigwinch != 1 - do - cat >conftest.$ac_ext <<_ACEOF --#line 7696 "configure" -+#line 8486 "configure" - #include "confdefs.h" - - #undef _XOPEN_SOURCE -@@ -7715,16 +8505,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:7718: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:8508: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:7721: \$? = $ac_status" >&5 -+ echo "$as_me:8511: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:7724: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:8514: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:7727: \$? = $ac_status" >&5 -+ echo "$as_me:8517: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_cv_fixup_sigwinch=$cf_sigwinch - break -@@ -7738,7 +8528,7 @@ - done - - fi --echo "$as_me:7741: result: $cf_cv_fixup_sigwinch" >&5 -+echo "$as_me:8531: result: $cf_cv_fixup_sigwinch" >&5 - echo "${ECHO_T}$cf_cv_fixup_sigwinch" >&6 - - if test "$cf_cv_fixup_sigwinch" != unknown ; then -@@ -7748,13 +8538,13 @@ - - # Checks for CODESET support. - -- echo "$as_me:7751: checking for nl_langinfo and CODESET" >&5 -+ echo "$as_me:8541: checking for nl_langinfo and CODESET" >&5 - echo $ECHO_N "checking for nl_langinfo and CODESET... $ECHO_C" >&6 - if test "${am_cv_langinfo_codeset+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - cat >conftest.$ac_ext <<_ACEOF --#line 7757 "configure" -+#line 8547 "configure" - #include "confdefs.h" - #include - int -@@ -7766,16 +8556,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:7769: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:8559: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:7772: \$? = $ac_status" >&5 -+ echo "$as_me:8562: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:7775: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:8565: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:7778: \$? = $ac_status" >&5 -+ echo "$as_me:8568: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - am_cv_langinfo_codeset=yes - else -@@ -7786,7 +8576,7 @@ - rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - - fi --echo "$as_me:7789: result: $am_cv_langinfo_codeset" >&5 -+echo "$as_me:8579: result: $am_cv_langinfo_codeset" >&5 - echo "${ECHO_T}$am_cv_langinfo_codeset" >&6 - if test $am_cv_langinfo_codeset = yes; then - -@@ -7800,7 +8590,7 @@ - NCURSES_OK_WCHAR_T= - NCURSES_OK_WINT_T= - --echo "$as_me:7803: checking if you want wide-character code" >&5 -+echo "$as_me:8593: checking if you want wide-character code" >&5 - echo $ECHO_N "checking if you want wide-character code... $ECHO_C" >&6 - - # Check whether --enable-widec or --disable-widec was given. -@@ -7810,23 +8600,72 @@ - else - with_widec=no - fi; --echo "$as_me:7813: result: $with_widec" >&5 -+echo "$as_me:8603: result: $with_widec" >&5 - echo "${ECHO_T}$with_widec" >&6 --if test "$with_widec" = yes ; then -+if test "x$with_widec" = xyes ; then - LIB_SUFFIX="w${LIB_SUFFIX}" -- cat >>confdefs.h <<\EOF -+ -+cat >>confdefs.h <<\EOF - #define USE_WIDEC_SUPPORT 1 - EOF - -- case "$CFLAGS $CPPFLAGS" in #(vi -- *-D_XOPEN_SOURCE=500) #(vi -- ;; -- *) -+cat >>confdefs.h <<\EOF -+#define NCURSES_WIDECHAR 1 -+EOF -+ -+echo "$as_me:8616: checking if wchar.h can be used as is" >&5 -+echo $ECHO_N "checking if wchar.h can be used as is... $ECHO_C" >&6 -+if test "${cf_cv_wchar_h_okay+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ -+cat >conftest.$ac_ext <<_ACEOF -+#line 8623 "configure" -+#include "confdefs.h" -+ -+#include -+#include -+ -+int -+main () -+{ -+ -+ wint_t foo = 0; -+ int bar = iswpunct(foo) -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:8640: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>&5 -+ ac_status=$? -+ echo "$as_me:8643: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:8646: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:8649: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ cf_cv_wchar_h_okay=yes -+else -+ echo "$as_me: failed program was:" >&5 -+cat conftest.$ac_ext >&5 -+cf_cv_wchar_h_okay=no -+fi -+rm -f conftest.$ac_objext conftest.$ac_ext -+fi -+echo "$as_me:8659: result: $cf_cv_wchar_h_okay" >&5 -+echo "${ECHO_T}$cf_cv_wchar_h_okay" >&6 -+ -+if test $cf_cv_wchar_h_okay = no -+then - --echo "$as_me:7826: checking if we must define _XOPEN_SOURCE_EXTENDED" >&5 -+echo "$as_me:8665: checking if we must define _XOPEN_SOURCE_EXTENDED" >&5 - echo $ECHO_N "checking if we must define _XOPEN_SOURCE_EXTENDED... $ECHO_C" >&6 - cat >conftest.$ac_ext <<_ACEOF --#line 7829 "configure" -+#line 8668 "configure" - #include "confdefs.h" - #include - -@@ -7842,16 +8681,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:7845: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:8684: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:7848: \$? = $ac_status" >&5 -+ echo "$as_me:8687: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:7851: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:8690: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:7854: \$? = $ac_status" >&5 -+ echo "$as_me:8693: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_result=no - else -@@ -7860,16 +8699,16 @@ - cf_result=yes - fi - rm -f conftest.$ac_objext conftest.$ac_ext --echo "$as_me:7863: result: $cf_result" >&5 -+echo "$as_me:8702: result: $cf_result" >&5 - echo "${ECHO_T}$cf_result" >&6 - - if test "$cf_result" = yes ; then - CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED" - elif test "x" != "x" ; then -- echo "$as_me:7869: checking checking for compatible value versus " >&5 -+ echo "$as_me:8708: checking checking for compatible value versus " >&5 - echo $ECHO_N "checking checking for compatible value versus ... $ECHO_C" >&6 - cat >conftest.$ac_ext <<_ACEOF --#line 7872 "configure" -+#line 8711 "configure" - #include "confdefs.h" - #include - -@@ -7885,16 +8724,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:7888: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:8727: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:7891: \$? = $ac_status" >&5 -+ echo "$as_me:8730: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:7894: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:8733: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:7897: \$? = $ac_status" >&5 -+ echo "$as_me:8736: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_result=yes - else -@@ -7903,7 +8742,7 @@ - cf_result=no - fi - rm -f conftest.$ac_objext conftest.$ac_ext -- echo "$as_me:7906: result: $cf_result" >&5 -+ echo "$as_me:8745: result: $cf_result" >&5 - echo "${ECHO_T}$cf_result" >&6 - if test "$cf_result" = no ; then - # perhaps we can override it - try... -@@ -7911,8 +8750,7 @@ - fi - fi - -- ;; -- esac -+fi - - # with_overwrite=no - NCURSES_CH_T=cchar_t -@@ -7920,13 +8758,13 @@ - for ac_func in putwc btowc wctob mbtowc wctomb mblen mbrlen mbrtowc wcsrtombs mbsrtowcs wcstombs mbstowcs - do - as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` --echo "$as_me:7923: checking for $ac_func" >&5 -+echo "$as_me:8761: checking for $ac_func" >&5 - echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 - if eval "test \"\${$as_ac_var+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - cat >conftest.$ac_ext <<_ACEOF --#line 7929 "configure" -+#line 8767 "configure" - #include "confdefs.h" - /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. */ -@@ -7949,7 +8787,7 @@ - #if defined (__stub_$ac_func) || defined (__stub___$ac_func) - choke me - #else --f = $ac_func; -+f = $ac_func; /* workaround for ICC 12.0.3 */ if (f == 0) return 1; - #endif - - ; -@@ -7957,16 +8795,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:7960: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:8798: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:7963: \$? = $ac_status" >&5 -+ echo "$as_me:8801: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:7966: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:8804: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:7969: \$? = $ac_status" >&5 -+ echo "$as_me:8807: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - eval "$as_ac_var=yes" - else -@@ -7976,7 +8814,7 @@ - fi - rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - fi --echo "$as_me:7979: result: `eval echo '${'$as_ac_var'}'`" >&5 -+echo "$as_me:8817: result: `eval echo '${'$as_ac_var'}'`" >&5 - echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 - if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <&5 -+echo "$as_me:8829: checking for multibyte character support" >&5 - echo $ECHO_N "checking for multibyte character support... $ECHO_C" >&6 - if test "${cf_cv_utf8_lib+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -7996,7 +8834,7 @@ - - cf_save_LIBS="$LIBS" - cat >conftest.$ac_ext <<_ACEOF --#line 7999 "configure" -+#line 8837 "configure" - #include "confdefs.h" - - #include -@@ -8009,16 +8847,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:8012: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:8850: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:8015: \$? = $ac_status" >&5 -+ echo "$as_me:8853: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:8018: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:8856: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:8021: \$? = $ac_status" >&5 -+ echo "$as_me:8859: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_cv_utf8_lib=yes - else -@@ -8030,12 +8868,12 @@ - cf_cv_header_path_utf8= - cf_cv_library_path_utf8= - --echo "${as_me:-configure}:8033: testing Starting FIND_LINKAGE(utf8,) ..." 1>&5 -+echo "${as_me:-configure}:8871: testing Starting FIND_LINKAGE(utf8,) ..." 1>&5 - - cf_save_LIBS="$LIBS" - - cat >conftest.$ac_ext <<_ACEOF --#line 8038 "configure" -+#line 8876 "configure" - #include "confdefs.h" - - #include -@@ -8048,16 +8886,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:8051: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:8889: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:8054: \$? = $ac_status" >&5 -+ echo "$as_me:8892: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:8057: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:8895: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:8060: \$? = $ac_status" >&5 -+ echo "$as_me:8898: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - - cf_cv_find_linkage_utf8=yes -@@ -8071,7 +8909,7 @@ - LIBS="-lutf8 $cf_save_LIBS" - - cat >conftest.$ac_ext <<_ACEOF --#line 8074 "configure" -+#line 8912 "configure" - #include "confdefs.h" - - #include -@@ -8084,16 +8922,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:8087: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:8925: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:8090: \$? = $ac_status" >&5 -+ echo "$as_me:8928: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:8093: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:8931: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:8096: \$? = $ac_status" >&5 -+ echo "$as_me:8934: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - - cf_cv_find_linkage_utf8=yes -@@ -8110,9 +8948,9 @@ - - test -n "$verbose" && echo " find linkage for utf8 library" 1>&6 - --echo "${as_me:-configure}:8113: testing find linkage for utf8 library ..." 1>&5 -+echo "${as_me:-configure}:8951: testing find linkage for utf8 library ..." 1>&5 - --echo "${as_me:-configure}:8115: testing Searching for headers in FIND_LINKAGE(utf8,) ..." 1>&5 -+echo "${as_me:-configure}:8953: testing Searching for headers in FIND_LINKAGE(utf8,) ..." 1>&5 - - cf_save_CPPFLAGS="$CPPFLAGS" - cf_test_CPPFLAGS="$CPPFLAGS" -@@ -8128,7 +8966,7 @@ - -I*) - cf_header_path=`echo ".$cf_header_path" |sed -e 's/^...//' -e 's,/include$,,'` - --test "$cf_header_path" != "NONE" && \ -+test "x$cf_header_path" != "xNONE" && \ - test -d "$cf_header_path" && \ - { - test -n "$verbose" && echo " ... testing for include-directories under $cf_header_path" -@@ -8149,9 +8987,9 @@ - - cf_search= - --test "/usr" != "$prefix" && \ -+test "x/usr" != "x$prefix" && \ - test -d "/usr" && \ --(test $prefix = NONE || test "/usr" != "$prefix") && { -+(test -z "$prefix" || test x$prefix = xNONE || test "x/usr" != "x$prefix") && { - test -n "$verbose" && echo " ... testing for include-directories under /usr" - test -d /usr/include && cf_search="$cf_search /usr/include" - test -d /usr/include/utf8 && cf_search="$cf_search /usr/include/utf8" -@@ -8160,7 +8998,7 @@ - test -d /usr/utf8/include/utf8 && cf_search="$cf_search /usr/utf8/include/utf8" - } - --test "$prefix" != "NONE" && \ -+test "x$prefix" != "xNONE" && \ - test -d "$prefix" && \ - { - test -n "$verbose" && echo " ... testing for include-directories under $prefix" -@@ -8171,9 +9009,9 @@ - test -d $prefix/utf8/include/utf8 && cf_search="$cf_search $prefix/utf8/include/utf8" - } - --test "/usr/local" != "$prefix" && \ -+test "x/usr/local" != "x$prefix" && \ - test -d "/usr/local" && \ --(test $prefix = NONE || test "/usr/local" != "$prefix") && { -+(test -z "$prefix" || test x$prefix = xNONE || test "x/usr/local" != "x$prefix") && { - test -n "$verbose" && echo " ... testing for include-directories under /usr/local" - test -d /usr/local/include && cf_search="$cf_search /usr/local/include" - test -d /usr/local/include/utf8 && cf_search="$cf_search /usr/local/include/utf8" -@@ -8182,9 +9020,9 @@ - test -d /usr/local/utf8/include/utf8 && cf_search="$cf_search /usr/local/utf8/include/utf8" - } - --test "/opt" != "$prefix" && \ -+test "x/opt" != "x$prefix" && \ - test -d "/opt" && \ --(test $prefix = NONE || test "/opt" != "$prefix") && { -+(test -z "$prefix" || test x$prefix = xNONE || test "x/opt" != "x$prefix") && { - test -n "$verbose" && echo " ... testing for include-directories under /opt" - test -d /opt/include && cf_search="$cf_search /opt/include" - test -d /opt/include/utf8 && cf_search="$cf_search /opt/include/utf8" -@@ -8193,9 +9031,9 @@ - test -d /opt/utf8/include/utf8 && cf_search="$cf_search /opt/utf8/include/utf8" - } - --test "$HOME" != "$prefix" && \ -+test "x$HOME" != "x$prefix" && \ - test -d "$HOME" && \ --(test $prefix = NONE || test "$HOME" != "$prefix") && { -+(test -z "$prefix" || test x$prefix = xNONE || test "x$HOME" != "x$prefix") && { - test -n "$verbose" && echo " ... testing for include-directories under $HOME" - test -d $HOME/include && cf_search="$cf_search $HOME/include" - test -d $HOME/include/utf8 && cf_search="$cf_search $HOME/include/utf8" -@@ -8225,11 +9063,11 @@ - if test -d $cf_cv_header_path_utf8 ; then - test -n "$verbose" && echo " ... testing $cf_cv_header_path_utf8" 1>&6 - --echo "${as_me:-configure}:8228: testing ... testing $cf_cv_header_path_utf8 ..." 1>&5 -+echo "${as_me:-configure}:9066: testing ... testing $cf_cv_header_path_utf8 ..." 1>&5 - - CPPFLAGS="$cf_save_CPPFLAGS -I$cf_cv_header_path_utf8" - cat >conftest.$ac_ext <<_ACEOF --#line 8232 "configure" -+#line 9070 "configure" - #include "confdefs.h" - - #include -@@ -8242,21 +9080,21 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:8245: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:9083: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:8248: \$? = $ac_status" >&5 -+ echo "$as_me:9086: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:8251: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:9089: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:8254: \$? = $ac_status" >&5 -+ echo "$as_me:9092: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - - test -n "$verbose" && echo " ... found utf8 headers in $cf_cv_header_path_utf8" 1>&6 - --echo "${as_me:-configure}:8259: testing ... found utf8 headers in $cf_cv_header_path_utf8 ..." 1>&5 -+echo "${as_me:-configure}:9097: testing ... found utf8 headers in $cf_cv_header_path_utf8 ..." 1>&5 - - cf_cv_find_linkage_utf8=maybe - cf_test_CPPFLAGS="$CPPFLAGS" -@@ -8274,7 +9112,7 @@ - - if test "$cf_cv_find_linkage_utf8" = maybe ; then - --echo "${as_me:-configure}:8277: testing Searching for utf8 library in FIND_LINKAGE(utf8,) ..." 1>&5 -+echo "${as_me:-configure}:9115: testing Searching for utf8 library in FIND_LINKAGE(utf8,) ..." 1>&5 - - cf_save_LIBS="$LIBS" - cf_save_LDFLAGS="$LDFLAGS" -@@ -8290,7 +9128,7 @@ - -L*) - cf_library_path=`echo ".$cf_library_path" |sed -e 's/^...//' -e 's,/lib$,,'` - --test "$cf_library_path" != "NONE" && \ -+test "x$cf_library_path" != "xNONE" && \ - test -d "$cf_library_path" && \ - { - test -n "$verbose" && echo " ... testing for lib-directories under $cf_library_path" -@@ -8309,9 +9147,9 @@ - - cf_search= - --test "/usr" != "$prefix" && \ -+test "x/usr" != "x$prefix" && \ - test -d "/usr" && \ --(test $prefix = NONE || test "/usr" != "$prefix") && { -+(test -z "$prefix" || test x$prefix = xNONE || test "x/usr" != "x$prefix") && { - test -n "$verbose" && echo " ... testing for lib-directories under /usr" - test -d /usr/lib && cf_search="$cf_search /usr/lib" - test -d /usr/lib/utf8 && cf_search="$cf_search /usr/lib/utf8" -@@ -8320,7 +9158,7 @@ - test -d /usr/utf8/lib/utf8 && cf_search="$cf_search /usr/utf8/lib/utf8" - } - --test "$prefix" != "NONE" && \ -+test "x$prefix" != "xNONE" && \ - test -d "$prefix" && \ - { - test -n "$verbose" && echo " ... testing for lib-directories under $prefix" -@@ -8331,9 +9169,9 @@ - test -d $prefix/utf8/lib/utf8 && cf_search="$cf_search $prefix/utf8/lib/utf8" - } - --test "/usr/local" != "$prefix" && \ -+test "x/usr/local" != "x$prefix" && \ - test -d "/usr/local" && \ --(test $prefix = NONE || test "/usr/local" != "$prefix") && { -+(test -z "$prefix" || test x$prefix = xNONE || test "x/usr/local" != "x$prefix") && { - test -n "$verbose" && echo " ... testing for lib-directories under /usr/local" - test -d /usr/local/lib && cf_search="$cf_search /usr/local/lib" - test -d /usr/local/lib/utf8 && cf_search="$cf_search /usr/local/lib/utf8" -@@ -8342,9 +9180,9 @@ - test -d /usr/local/utf8/lib/utf8 && cf_search="$cf_search /usr/local/utf8/lib/utf8" - } - --test "/opt" != "$prefix" && \ -+test "x/opt" != "x$prefix" && \ - test -d "/opt" && \ --(test $prefix = NONE || test "/opt" != "$prefix") && { -+(test -z "$prefix" || test x$prefix = xNONE || test "x/opt" != "x$prefix") && { - test -n "$verbose" && echo " ... testing for lib-directories under /opt" - test -d /opt/lib && cf_search="$cf_search /opt/lib" - test -d /opt/lib/utf8 && cf_search="$cf_search /opt/lib/utf8" -@@ -8353,9 +9191,9 @@ - test -d /opt/utf8/lib/utf8 && cf_search="$cf_search /opt/utf8/lib/utf8" - } - --test "$HOME" != "$prefix" && \ -+test "x$HOME" != "x$prefix" && \ - test -d "$HOME" && \ --(test $prefix = NONE || test "$HOME" != "$prefix") && { -+(test -z "$prefix" || test x$prefix = xNONE || test "x$HOME" != "x$prefix") && { - test -n "$verbose" && echo " ... testing for lib-directories under $HOME" - test -d $HOME/lib && cf_search="$cf_search $HOME/lib" - test -d $HOME/lib/utf8 && cf_search="$cf_search $HOME/lib/utf8" -@@ -8371,13 +9209,13 @@ - if test -d $cf_cv_library_path_utf8 ; then - test -n "$verbose" && echo " ... testing $cf_cv_library_path_utf8" 1>&6 - --echo "${as_me:-configure}:8374: testing ... testing $cf_cv_library_path_utf8 ..." 1>&5 -+echo "${as_me:-configure}:9212: testing ... testing $cf_cv_library_path_utf8 ..." 1>&5 - - CPPFLAGS="$cf_test_CPPFLAGS" - LIBS="-lutf8 $cf_save_LIBS" - LDFLAGS="$cf_save_LDFLAGS -L$cf_cv_library_path_utf8" - cat >conftest.$ac_ext <<_ACEOF --#line 8380 "configure" -+#line 9218 "configure" - #include "confdefs.h" - - #include -@@ -8390,21 +9228,21 @@ - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:8393: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:9231: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:8396: \$? = $ac_status" >&5 -+ echo "$as_me:9234: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:8399: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:9237: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:8402: \$? = $ac_status" >&5 -+ echo "$as_me:9240: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - - test -n "$verbose" && echo " ... found utf8 library in $cf_cv_library_path_utf8" 1>&6 - --echo "${as_me:-configure}:8407: testing ... found utf8 library in $cf_cv_library_path_utf8 ..." 1>&5 -+echo "${as_me:-configure}:9245: testing ... found utf8 library in $cf_cv_library_path_utf8 ..." 1>&5 - - cf_cv_find_linkage_utf8=yes - cf_cv_library_file_utf8="-lutf8" -@@ -8446,13 +9284,14 @@ - fi - rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - fi --echo "$as_me:8449: result: $cf_cv_utf8_lib" >&5 -+echo "$as_me:9287: result: $cf_cv_utf8_lib" >&5 - echo "${ECHO_T}$cf_cv_utf8_lib" >&6 - - # HAVE_LIBUTF8_H is used by ncurses if curses.h is shared between - # ncurses/ncursesw: - if test "$cf_cv_utf8_lib" = "add-on" ; then -- cat >>confdefs.h <<\EOF -+ -+cat >>confdefs.h <<\EOF - #define HAVE_LIBUTF8_H 1 - EOF - -@@ -8480,7 +9319,7 @@ - cf_save_CPPFLAGS=$CPPFLAGS - CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" - cat >conftest.$ac_ext <<_ACEOF --#line 8483 "configure" -+#line 9322 "configure" - #include "confdefs.h" - #include - int -@@ -8492,16 +9331,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:8495: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:9334: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:8498: \$? = $ac_status" >&5 -+ echo "$as_me:9337: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:8501: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:9340: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:8504: \$? = $ac_status" >&5 -+ echo "$as_me:9343: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : - else -@@ -8518,7 +9357,7 @@ - if test "$cf_have_incdir" = no ; then - test -n "$verbose" && echo " adding $cf_add_incdir to include-path" 1>&6 - --echo "${as_me:-configure}:8521: testing adding $cf_add_incdir to include-path ..." 1>&5 -+echo "${as_me:-configure}:9360: testing adding $cf_add_incdir to include-path ..." 1>&5 - - CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" - -@@ -8552,7 +9391,7 @@ - if test "$cf_have_libdir" = no ; then - test -n "$verbose" && echo " adding $cf_add_libdir to library-path" 1>&6 - --echo "${as_me:-configure}:8555: testing adding $cf_add_libdir to library-path ..." 1>&5 -+echo "${as_me:-configure}:9394: testing adding $cf_add_libdir to library-path ..." 1>&5 - - LDFLAGS="-L$cf_add_libdir $LDFLAGS" - fi -@@ -8569,14 +9408,14 @@ - fi - - # This is needed on Tru64 5.0 to declare mbstate_t --echo "$as_me:8572: checking if we must include wchar.h to declare mbstate_t" >&5 -+echo "$as_me:9411: checking if we must include wchar.h to declare mbstate_t" >&5 - echo $ECHO_N "checking if we must include wchar.h to declare mbstate_t... $ECHO_C" >&6 - if test "${cf_cv_mbstate_t+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - - cat >conftest.$ac_ext <<_ACEOF --#line 8579 "configure" -+#line 9418 "configure" - #include "confdefs.h" - - #include -@@ -8594,23 +9433,23 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:8597: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:9436: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:8600: \$? = $ac_status" >&5 -+ echo "$as_me:9439: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:8603: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:9442: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:8606: \$? = $ac_status" >&5 -+ echo "$as_me:9445: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_cv_mbstate_t=no - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 - cat >conftest.$ac_ext <<_ACEOF --#line 8613 "configure" -+#line 9452 "configure" - #include "confdefs.h" - - #include -@@ -8629,16 +9468,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:8632: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:9471: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:8635: \$? = $ac_status" >&5 -+ echo "$as_me:9474: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:8638: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:9477: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:8641: \$? = $ac_status" >&5 -+ echo "$as_me:9480: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_cv_mbstate_t=yes - else -@@ -8650,11 +9489,12 @@ - fi - rm -f conftest.$ac_objext conftest.$ac_ext - fi --echo "$as_me:8653: result: $cf_cv_mbstate_t" >&5 -+echo "$as_me:9492: result: $cf_cv_mbstate_t" >&5 - echo "${ECHO_T}$cf_cv_mbstate_t" >&6 - - if test "$cf_cv_mbstate_t" = yes ; then -- cat >>confdefs.h <<\EOF -+ -+cat >>confdefs.h <<\EOF - #define NEED_WCHAR_H 1 - EOF - -@@ -8667,14 +9507,14 @@ - fi - - # This is needed on Tru64 5.0 to declare wchar_t --echo "$as_me:8670: checking if we must include wchar.h to declare wchar_t" >&5 -+echo "$as_me:9510: checking if we must include wchar.h to declare wchar_t" >&5 - echo $ECHO_N "checking if we must include wchar.h to declare wchar_t... $ECHO_C" >&6 - if test "${cf_cv_wchar_t+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - - cat >conftest.$ac_ext <<_ACEOF --#line 8677 "configure" -+#line 9517 "configure" - #include "confdefs.h" - - #include -@@ -8692,23 +9532,23 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:8695: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:9535: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:8698: \$? = $ac_status" >&5 -+ echo "$as_me:9538: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:8701: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:9541: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:8704: \$? = $ac_status" >&5 -+ echo "$as_me:9544: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_cv_wchar_t=no - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 - cat >conftest.$ac_ext <<_ACEOF --#line 8711 "configure" -+#line 9551 "configure" - #include "confdefs.h" - - #include -@@ -8727,16 +9567,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:8730: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:9570: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:8733: \$? = $ac_status" >&5 -+ echo "$as_me:9573: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:8736: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:9576: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:8739: \$? = $ac_status" >&5 -+ echo "$as_me:9579: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_cv_wchar_t=yes - else -@@ -8748,11 +9588,12 @@ - fi - rm -f conftest.$ac_objext conftest.$ac_ext - fi --echo "$as_me:8751: result: $cf_cv_wchar_t" >&5 -+echo "$as_me:9591: result: $cf_cv_wchar_t" >&5 - echo "${ECHO_T}$cf_cv_wchar_t" >&6 - - if test "$cf_cv_wchar_t" = yes ; then -- cat >>confdefs.h <<\EOF -+ -+cat >>confdefs.h <<\EOF - #define NEED_WCHAR_H 1 - EOF - -@@ -8770,14 +9611,14 @@ - fi - - # This is needed on Tru64 5.0 to declare wint_t --echo "$as_me:8773: checking if we must include wchar.h to declare wint_t" >&5 -+echo "$as_me:9614: checking if we must include wchar.h to declare wint_t" >&5 - echo $ECHO_N "checking if we must include wchar.h to declare wint_t... $ECHO_C" >&6 - if test "${cf_cv_wint_t+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - - cat >conftest.$ac_ext <<_ACEOF --#line 8780 "configure" -+#line 9621 "configure" - #include "confdefs.h" - - #include -@@ -8795,23 +9636,23 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:8798: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:9639: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:8801: \$? = $ac_status" >&5 -+ echo "$as_me:9642: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:8804: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:9645: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:8807: \$? = $ac_status" >&5 -+ echo "$as_me:9648: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_cv_wint_t=no - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 - cat >conftest.$ac_ext <<_ACEOF --#line 8814 "configure" -+#line 9655 "configure" - #include "confdefs.h" - - #include -@@ -8830,16 +9671,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:8833: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:9674: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:8836: \$? = $ac_status" >&5 -+ echo "$as_me:9677: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:8839: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:9680: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:8842: \$? = $ac_status" >&5 -+ echo "$as_me:9683: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_cv_wint_t=yes - else -@@ -8851,11 +9692,12 @@ - fi - rm -f conftest.$ac_objext conftest.$ac_ext - fi --echo "$as_me:8854: result: $cf_cv_wint_t" >&5 -+echo "$as_me:9695: result: $cf_cv_wint_t" >&5 - echo "${ECHO_T}$cf_cv_wint_t" >&6 - - if test "$cf_cv_wint_t" = yes ; then -- cat >>confdefs.h <<\EOF -+ -+cat >>confdefs.h <<\EOF - #define NEED_WCHAR_H 1 - EOF - -@@ -8873,7 +9715,8 @@ - fi - - if test "$NCURSES_MBSTATE_T" != 0; then -- cat >>confdefs.h <<\EOF -+ -+cat >>confdefs.h <<\EOF - #define NEED_MBSTATE_T_DEF 1 - EOF - -@@ -8890,7 +9733,7 @@ - ;; - esac - --echo "$as_me:8893: checking whether to enable _LP64 definition in curses.h" >&5 -+echo "$as_me:9736: checking whether to enable _LP64 definition in curses.h" >&5 - echo $ECHO_N "checking whether to enable _LP64 definition in curses.h... $ECHO_C" >&6 - - # Check whether --enable-lp64 or --disable-lp64 was given. -@@ -8900,10 +9743,10 @@ - else - with_lp64=$default_with_lp64 - fi; --echo "$as_me:8903: result: $with_lp64" >&5 -+echo "$as_me:9746: result: $with_lp64" >&5 - echo "${ECHO_T}$with_lp64" >&6 - --if test "$with_lp64" = yes ; then -+if test "x$with_lp64" = xyes ; then - cf_cv_enable_lp64=1 - else - cf_cv_enable_lp64=0 -@@ -8916,7 +9759,7 @@ - fi; - if test "$enable_largefile" != no; then - -- echo "$as_me:8919: checking for special C compiler options needed for large files" >&5 -+ echo "$as_me:9762: checking for special C compiler options needed for large files" >&5 - echo $ECHO_N "checking for special C compiler options needed for large files... $ECHO_C" >&6 - if test "${ac_cv_sys_largefile_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -8928,7 +9771,7 @@ - # IRIX 6.2 and later do not support large files by default, - # so use the C compiler's -n32 option if that helps. - cat >conftest.$ac_ext <<_ACEOF --#line 8931 "configure" -+#line 9774 "configure" - #include "confdefs.h" - #include - /* Check that off_t can represent 2**63 - 1 correctly. -@@ -8948,16 +9791,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:8951: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:9794: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:8954: \$? = $ac_status" >&5 -+ echo "$as_me:9797: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:8957: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:9800: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:8960: \$? = $ac_status" >&5 -+ echo "$as_me:9803: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - break - else -@@ -8967,16 +9810,16 @@ - rm -f conftest.$ac_objext - CC="$CC -n32" - rm -f conftest.$ac_objext --if { (eval echo "$as_me:8970: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:9813: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:8973: \$? = $ac_status" >&5 -+ echo "$as_me:9816: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:8976: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:9819: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:8979: \$? = $ac_status" >&5 -+ echo "$as_me:9822: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_sys_largefile_CC=' -n32'; break - else -@@ -8990,13 +9833,13 @@ - rm -f conftest.$ac_ext - fi - fi --echo "$as_me:8993: result: $ac_cv_sys_largefile_CC" >&5 -+echo "$as_me:9836: result: $ac_cv_sys_largefile_CC" >&5 - echo "${ECHO_T}$ac_cv_sys_largefile_CC" >&6 - if test "$ac_cv_sys_largefile_CC" != no; then - CC=$CC$ac_cv_sys_largefile_CC - fi - -- echo "$as_me:8999: checking for _FILE_OFFSET_BITS value needed for large files" >&5 -+ echo "$as_me:9842: checking for _FILE_OFFSET_BITS value needed for large files" >&5 - echo $ECHO_N "checking for _FILE_OFFSET_BITS value needed for large files... $ECHO_C" >&6 - if test "${ac_cv_sys_file_offset_bits+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -9004,7 +9847,7 @@ - while :; do - ac_cv_sys_file_offset_bits=no - cat >conftest.$ac_ext <<_ACEOF --#line 9007 "configure" -+#line 9850 "configure" - #include "confdefs.h" - #include - /* Check that off_t can represent 2**63 - 1 correctly. -@@ -9024,16 +9867,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:9027: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:9870: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:9030: \$? = $ac_status" >&5 -+ echo "$as_me:9873: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:9033: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:9876: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:9036: \$? = $ac_status" >&5 -+ echo "$as_me:9879: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - break - else -@@ -9042,7 +9885,7 @@ - fi - rm -f conftest.$ac_objext conftest.$ac_ext - cat >conftest.$ac_ext <<_ACEOF --#line 9045 "configure" -+#line 9888 "configure" - #include "confdefs.h" - #define _FILE_OFFSET_BITS 64 - #include -@@ -9063,16 +9906,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:9066: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:9909: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:9069: \$? = $ac_status" >&5 -+ echo "$as_me:9912: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:9072: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:9915: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:9075: \$? = $ac_status" >&5 -+ echo "$as_me:9918: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_sys_file_offset_bits=64; break - else -@@ -9083,7 +9926,7 @@ - break - done - fi --echo "$as_me:9086: result: $ac_cv_sys_file_offset_bits" >&5 -+echo "$as_me:9929: result: $ac_cv_sys_file_offset_bits" >&5 - echo "${ECHO_T}$ac_cv_sys_file_offset_bits" >&6 - if test "$ac_cv_sys_file_offset_bits" != no; then - -@@ -9093,7 +9936,7 @@ - - fi - rm -rf conftest* -- echo "$as_me:9096: checking for _LARGE_FILES value needed for large files" >&5 -+ echo "$as_me:9939: checking for _LARGE_FILES value needed for large files" >&5 - echo $ECHO_N "checking for _LARGE_FILES value needed for large files... $ECHO_C" >&6 - if test "${ac_cv_sys_large_files+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -9101,7 +9944,7 @@ - while :; do - ac_cv_sys_large_files=no - cat >conftest.$ac_ext <<_ACEOF --#line 9104 "configure" -+#line 9947 "configure" - #include "confdefs.h" - #include - /* Check that off_t can represent 2**63 - 1 correctly. -@@ -9121,16 +9964,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:9124: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:9967: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:9127: \$? = $ac_status" >&5 -+ echo "$as_me:9970: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:9130: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:9973: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:9133: \$? = $ac_status" >&5 -+ echo "$as_me:9976: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - break - else -@@ -9139,7 +9982,7 @@ - fi - rm -f conftest.$ac_objext conftest.$ac_ext - cat >conftest.$ac_ext <<_ACEOF --#line 9142 "configure" -+#line 9985 "configure" - #include "confdefs.h" - #define _LARGE_FILES 1 - #include -@@ -9160,16 +10003,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:9163: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:10006: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:9166: \$? = $ac_status" >&5 -+ echo "$as_me:10009: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:9169: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:10012: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:9172: \$? = $ac_status" >&5 -+ echo "$as_me:10015: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_sys_large_files=1; break - else -@@ -9180,7 +10023,7 @@ - break - done - fi --echo "$as_me:9183: result: $ac_cv_sys_large_files" >&5 -+echo "$as_me:10026: result: $ac_cv_sys_large_files" >&5 - echo "${ECHO_T}$ac_cv_sys_large_files" >&6 - if test "$ac_cv_sys_large_files" != no; then - -@@ -9193,7 +10036,7 @@ - fi - - if test "$enable_largefile" != no ; then -- echo "$as_me:9196: checking for _LARGEFILE_SOURCE value needed for large files" >&5 -+ echo "$as_me:10039: checking for _LARGEFILE_SOURCE value needed for large files" >&5 - echo $ECHO_N "checking for _LARGEFILE_SOURCE value needed for large files... $ECHO_C" >&6 - if test "${ac_cv_sys_largefile_source+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -9201,7 +10044,7 @@ - while :; do - ac_cv_sys_largefile_source=no - cat >conftest.$ac_ext <<_ACEOF --#line 9204 "configure" -+#line 10047 "configure" - #include "confdefs.h" - #include - int -@@ -9213,16 +10056,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:9216: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:10059: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:9219: \$? = $ac_status" >&5 -+ echo "$as_me:10062: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:9222: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:10065: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:9225: \$? = $ac_status" >&5 -+ echo "$as_me:10068: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - break - else -@@ -9231,7 +10074,7 @@ - fi - rm -f conftest.$ac_objext conftest.$ac_ext - cat >conftest.$ac_ext <<_ACEOF --#line 9234 "configure" -+#line 10077 "configure" - #include "confdefs.h" - #define _LARGEFILE_SOURCE 1 - #include -@@ -9244,16 +10087,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:9247: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:10090: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:9250: \$? = $ac_status" >&5 -+ echo "$as_me:10093: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:9253: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:10096: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:9256: \$? = $ac_status" >&5 -+ echo "$as_me:10099: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_sys_largefile_source=1; break - else -@@ -9264,7 +10107,7 @@ - break - done - fi --echo "$as_me:9267: result: $ac_cv_sys_largefile_source" >&5 -+echo "$as_me:10110: result: $ac_cv_sys_largefile_source" >&5 - echo "${ECHO_T}$ac_cv_sys_largefile_source" >&6 - if test "$ac_cv_sys_largefile_source" != no; then - -@@ -9278,13 +10121,13 @@ - # We used to try defining _XOPEN_SOURCE=500 too, to work around a bug - # in glibc 2.1.3, but that breaks too many other things. - # If you want fseeko and ftello with glibc, upgrade to a fixed glibc. --echo "$as_me:9281: checking for fseeko" >&5 -+echo "$as_me:10124: checking for fseeko" >&5 - echo $ECHO_N "checking for fseeko... $ECHO_C" >&6 - if test "${ac_cv_func_fseeko+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - cat >conftest.$ac_ext <<_ACEOF --#line 9287 "configure" -+#line 10130 "configure" - #include "confdefs.h" - #include - int -@@ -9296,16 +10139,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:9299: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:10142: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:9302: \$? = $ac_status" >&5 -+ echo "$as_me:10145: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:9305: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:10148: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:9308: \$? = $ac_status" >&5 -+ echo "$as_me:10151: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_func_fseeko=yes - else -@@ -9315,7 +10158,7 @@ - fi - rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - fi --echo "$as_me:9318: result: $ac_cv_func_fseeko" >&5 -+echo "$as_me:10161: result: $ac_cv_func_fseeko" >&5 - echo "${ECHO_T}$ac_cv_func_fseeko" >&6 - if test $ac_cv_func_fseeko = yes; then - -@@ -9336,14 +10179,14 @@ - test "$ac_cv_sys_largefile_source" != no && CPPFLAGS="$CPPFLAGS -D_LARGEFILE_SOURCE " - test "$ac_cv_sys_file_offset_bits" != no && CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits " - -- echo "$as_me:9339: checking whether to use struct dirent64" >&5 -+ echo "$as_me:10182: checking whether to use struct dirent64" >&5 - echo $ECHO_N "checking whether to use struct dirent64... $ECHO_C" >&6 - if test "${cf_cv_struct_dirent64+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - - cat >conftest.$ac_ext <<_ACEOF --#line 9346 "configure" -+#line 10189 "configure" - #include "confdefs.h" - - #include -@@ -9364,16 +10207,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:9367: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:10210: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:9370: \$? = $ac_status" >&5 -+ echo "$as_me:10213: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:9373: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:10216: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:9376: \$? = $ac_status" >&5 -+ echo "$as_me:10219: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_cv_struct_dirent64=yes - else -@@ -9384,16 +10227,17 @@ - rm -f conftest.$ac_objext conftest.$ac_ext - - fi --echo "$as_me:9387: result: $cf_cv_struct_dirent64" >&5 -+echo "$as_me:10230: result: $cf_cv_struct_dirent64" >&5 - echo "${ECHO_T}$cf_cv_struct_dirent64" >&6 -- test "$cf_cv_struct_dirent64" = yes && cat >>confdefs.h <<\EOF -+ test "$cf_cv_struct_dirent64" = yes && -+cat >>confdefs.h <<\EOF - #define HAVE_STRUCT_DIRENT64 1 - EOF - - fi - - ### use option --disable-tparm-varargs to make tparm() conform to X/Open --echo "$as_me:9396: checking if you want tparm not to use X/Open fixed-parameter list" >&5 -+echo "$as_me:10240: checking if you want tparm not to use X/Open fixed-parameter list" >&5 - echo $ECHO_N "checking if you want tparm not to use X/Open fixed-parameter list... $ECHO_C" >&6 - - # Check whether --enable-tparm-varargs or --disable-tparm-varargs was given. -@@ -9403,14 +10247,14 @@ - else - with_tparm_varargs=yes - fi; --echo "$as_me:9406: result: $with_tparm_varargs" >&5 -+echo "$as_me:10250: result: $with_tparm_varargs" >&5 - echo "${ECHO_T}$with_tparm_varargs" >&6 - NCURSES_TPARM_VARARGS=0 --test "$with_tparm_varargs" = yes && NCURSES_TPARM_VARARGS=1 -+test "x$with_tparm_varargs" = xyes && NCURSES_TPARM_VARARGS=1 - - ### use option --disable-tic-depends to make libtic not explicitly depend on ncurses/ncursesw - if test "$with_ticlib" != no ; then --echo "$as_me:9413: checking if you want tic library to use explicit dependency on ncurses$LIB_SUFFIX library" >&5 -+echo "$as_me:10257: checking if you want tic library to use explicit dependency on ncurses$LIB_SUFFIX library" >&5 - echo $ECHO_N "checking if you want tic library to use explicit dependency on ncurses$LIB_SUFFIX library... $ECHO_C" >&6 - - # Check whether --enable-tic-depends or --disable-tic-depends was given. -@@ -9420,14 +10264,14 @@ - else - with_tic_depends=yes - fi; --echo "$as_me:9423: result: $with_tic_depends" >&5 -+echo "$as_me:10267: result: $with_tic_depends" >&5 - echo "${ECHO_T}$with_tic_depends" >&6 - else - with_tic_depends=no - fi - - ### use option --with-bool to override bool's type --echo "$as_me:9430: checking for type of bool" >&5 -+echo "$as_me:10274: checking for type of bool" >&5 - echo $ECHO_N "checking for type of bool... $ECHO_C" >&6 - - # Check whether --with-bool or --without-bool was given. -@@ -9437,10 +10281,10 @@ - else - NCURSES_BOOL=auto - fi; --echo "$as_me:9440: result: $NCURSES_BOOL" >&5 -+echo "$as_me:10284: result: $NCURSES_BOOL" >&5 - echo "${ECHO_T}$NCURSES_BOOL" >&6 - --echo "$as_me:9443: checking for alternate terminal capabilities file" >&5 -+echo "$as_me:10287: checking for alternate terminal capabilities file" >&5 - echo $ECHO_N "checking for alternate terminal capabilities file... $ECHO_C" >&6 - - # Check whether --with-caps or --without-caps was given. -@@ -9451,11 +10295,11 @@ - TERMINFO_CAPS=Caps - fi; - test -f "${srcdir}/include/${TERMINFO_CAPS}" || TERMINFO_CAPS=Caps --echo "$as_me:9454: result: $TERMINFO_CAPS" >&5 -+echo "$as_me:10298: result: $TERMINFO_CAPS" >&5 - echo "${ECHO_T}$TERMINFO_CAPS" >&6 - - ### use option --with-chtype to override chtype's type --echo "$as_me:9458: checking for type of chtype" >&5 -+echo "$as_me:10302: checking for type of chtype" >&5 - echo $ECHO_N "checking for type of chtype... $ECHO_C" >&6 - - # Check whether --with-chtype or --without-chtype was given. -@@ -9465,11 +10309,11 @@ - else - NCURSES_CHTYPE=auto - fi; --echo "$as_me:9468: result: $NCURSES_CHTYPE" >&5 -+echo "$as_me:10312: result: $NCURSES_CHTYPE" >&5 - echo "${ECHO_T}$NCURSES_CHTYPE" >&6 - - ### use option --with-ospeed to override ospeed's type --echo "$as_me:9472: checking for type of ospeed" >&5 -+echo "$as_me:10316: checking for type of ospeed" >&5 - echo $ECHO_N "checking for type of ospeed... $ECHO_C" >&6 - - # Check whether --with-ospeed or --without-ospeed was given. -@@ -9479,11 +10323,11 @@ - else - NCURSES_OSPEED=short - fi; --echo "$as_me:9482: result: $NCURSES_OSPEED" >&5 -+echo "$as_me:10326: result: $NCURSES_OSPEED" >&5 - echo "${ECHO_T}$NCURSES_OSPEED" >&6 - - ### use option --with-mmask-t to override mmask_t's type --echo "$as_me:9486: checking for type of mmask_t" >&5 -+echo "$as_me:10330: checking for type of mmask_t" >&5 - echo $ECHO_N "checking for type of mmask_t... $ECHO_C" >&6 - - # Check whether --with-mmask-t or --without-mmask-t was given. -@@ -9493,11 +10337,11 @@ - else - NCURSES_MMASK_T=auto - fi; --echo "$as_me:9496: result: $NCURSES_MMASK_T" >&5 -+echo "$as_me:10340: result: $NCURSES_MMASK_T" >&5 - echo "${ECHO_T}$NCURSES_MMASK_T" >&6 - - ### use option --with-ccharw-max to override CCHARW_MAX size --echo "$as_me:9500: checking for size CCHARW_MAX" >&5 -+echo "$as_me:10344: checking for size CCHARW_MAX" >&5 - echo $ECHO_N "checking for size CCHARW_MAX... $ECHO_C" >&6 - - # Check whether --with-ccharw-max or --without-ccharw-max was given. -@@ -9507,11 +10351,25 @@ - else - NCURSES_CCHARW_MAX=5 - fi; --echo "$as_me:9510: result: $NCURSES_CCHARW_MAX" >&5 -+echo "$as_me:10354: result: $NCURSES_CCHARW_MAX" >&5 - echo "${ECHO_T}$NCURSES_CCHARW_MAX" >&6 - -+### use option --with-tparm-arg to override tparm's argument type -+echo "$as_me:10358: checking for type of tparm args" >&5 -+echo $ECHO_N "checking for type of tparm args... $ECHO_C" >&6 -+ -+# Check whether --with-tparm-arg or --without-tparm-arg was given. -+if test "${with_tparm_arg+set}" = set; then -+ withval="$with_tparm_arg" -+ NCURSES_TPARM_ARG="$withval" -+else -+ NCURSES_TPARM_ARG=long -+fi; -+echo "$as_me:10368: result: $NCURSES_TPARM_ARG" >&5 -+echo "${ECHO_T}$NCURSES_TPARM_ARG" >&6 -+ - ### Enable compiling-in rcs id's --echo "$as_me:9514: checking if RCS identifiers should be compiled-in" >&5 -+echo "$as_me:10372: checking if RCS identifiers should be compiled-in" >&5 - echo $ECHO_N "checking if RCS identifiers should be compiled-in... $ECHO_C" >&6 - - # Check whether --with-rcs-ids or --without-rcs-ids was given. -@@ -9521,15 +10379,16 @@ - else - with_rcs_ids=no - fi; --echo "$as_me:9524: result: $with_rcs_ids" >&5 -+echo "$as_me:10382: result: $with_rcs_ids" >&5 - echo "${ECHO_T}$with_rcs_ids" >&6 --test "$with_rcs_ids" = yes && cat >>confdefs.h <<\EOF -+test "x$with_rcs_ids" = xyes && -+cat >>confdefs.h <<\EOF - #define USE_RCS_IDS 1 - EOF - - ############################################################################### - --echo "$as_me:9532: checking format of man-pages" >&5 -+echo "$as_me:10391: checking format of man-pages" >&5 - echo $ECHO_N "checking format of man-pages... $ECHO_C" >&6 - - # Check whether --with-manpage-format or --without-manpage-format was given. -@@ -9618,14 +10477,14 @@ - ;; - esac - --echo "$as_me:9621: result: $MANPAGE_FORMAT" >&5 -+echo "$as_me:10480: result: $MANPAGE_FORMAT" >&5 - echo "${ECHO_T}$MANPAGE_FORMAT" >&6 - if test -n "$cf_unknown" ; then -- { echo "$as_me:9624: WARNING: Unexpected manpage-format $cf_unknown" >&5 -+ { echo "$as_me:10483: WARNING: Unexpected manpage-format $cf_unknown" >&5 - echo "$as_me: WARNING: Unexpected manpage-format $cf_unknown" >&2;} - fi - --echo "$as_me:9628: checking for manpage renaming" >&5 -+echo "$as_me:10487: checking for manpage renaming" >&5 - echo $ECHO_N "checking for manpage renaming... $ECHO_C" >&6 - - # Check whether --with-manpage-renames or --without-manpage-renames was given. -@@ -9653,7 +10512,7 @@ - if test -f $srcdir/man/$MANPAGE_RENAMES ; then - MANPAGE_RENAMES=`cd $srcdir/man && pwd`/$MANPAGE_RENAMES - elif test ! -f $MANPAGE_RENAMES ; then -- { { echo "$as_me:9656: error: not a filename: $MANPAGE_RENAMES" >&5 -+ { { echo "$as_me:10515: error: not a filename: $MANPAGE_RENAMES" >&5 - echo "$as_me: error: not a filename: $MANPAGE_RENAMES" >&2;} - { (exit 1); exit 1; }; } - fi -@@ -9667,10 +10526,10 @@ - fi - fi - --echo "$as_me:9670: result: $MANPAGE_RENAMES" >&5 -+echo "$as_me:10529: result: $MANPAGE_RENAMES" >&5 - echo "${ECHO_T}$MANPAGE_RENAMES" >&6 - --echo "$as_me:9673: checking if manpage aliases will be installed" >&5 -+echo "$as_me:10532: checking if manpage aliases will be installed" >&5 - echo $ECHO_N "checking if manpage aliases will be installed... $ECHO_C" >&6 - - # Check whether --with-manpage-aliases or --without-manpage-aliases was given. -@@ -9681,7 +10540,7 @@ - MANPAGE_ALIASES=yes - fi; - --echo "$as_me:9684: result: $MANPAGE_ALIASES" >&5 -+echo "$as_me:10543: result: $MANPAGE_ALIASES" >&5 - echo "${ECHO_T}$MANPAGE_ALIASES" >&6 - - case "x$LN_S" in #(vi -@@ -9695,7 +10554,7 @@ - - MANPAGE_SYMLINKS=no - if test "$MANPAGE_ALIASES" = yes ; then --echo "$as_me:9698: checking if manpage symlinks should be used" >&5 -+echo "$as_me:10557: checking if manpage symlinks should be used" >&5 - echo $ECHO_N "checking if manpage symlinks should be used... $ECHO_C" >&6 - - # Check whether --with-manpage-symlinks or --without-manpage-symlinks was given. -@@ -9708,17 +10567,17 @@ - - if test "$$cf_use_symlinks" = no; then - if test "$MANPAGE_SYMLINKS" = yes ; then -- { echo "$as_me:9711: WARNING: cannot make symlinks" >&5 -+ { echo "$as_me:10570: WARNING: cannot make symlinks" >&5 - echo "$as_me: WARNING: cannot make symlinks" >&2;} - MANPAGE_SYMLINKS=no - fi - fi - --echo "$as_me:9717: result: $MANPAGE_SYMLINKS" >&5 -+echo "$as_me:10576: result: $MANPAGE_SYMLINKS" >&5 - echo "${ECHO_T}$MANPAGE_SYMLINKS" >&6 - fi - --echo "$as_me:9721: checking for manpage tbl" >&5 -+echo "$as_me:10580: checking for manpage tbl" >&5 - echo $ECHO_N "checking for manpage tbl... $ECHO_C" >&6 - - # Check whether --with-manpage-tbl or --without-manpage-tbl was given. -@@ -9729,7 +10588,7 @@ - MANPAGE_TBL=no - fi; - --echo "$as_me:9732: result: $MANPAGE_TBL" >&5 -+echo "$as_me:10591: result: $MANPAGE_TBL" >&5 - echo "${ECHO_T}$MANPAGE_TBL" >&6 - - if test "$prefix" = "NONE" ; then -@@ -9776,6 +10635,7 @@ - # this script is generated by the configure-script CF_MAN_PAGES macro. - - prefix="$cf_prefix" -+datarootdir="$datarootdir" - datadir="$datadir" - - NCURSES_MAJOR="$NCURSES_MAJOR" -@@ -9836,11 +10696,12 @@ - if test ! -f $cf_man_alias ; then - cat >>$cf_man_alias <<-CF_EOF2 - s,@DATADIR@,\$datadir,g -- s,@TERMINFO@,\$TERMINFO,g -- s,@NCURSES_MAJOR@,\$NCURSES_MAJOR,g -- s,@NCURSES_MINOR@,\$NCURSES_MINOR,g -- s,@NCURSES_PATCH@,\$NCURSES_PATCH,g -- s,@NCURSES_OSPEED@,\$NCURSES_OSPEED,g -+ s,@TERMINFO@,\${TERMINFO:="no default value"},g -+ s,@TERMINFO_DIRS@,\${TERMINFO_DIRS:="no default value"},g -+ s,@NCURSES_MAJOR@,\${NCURSES_MAJOR:="no default value"},g -+ s,@NCURSES_MINOR@,\${NCURSES_MINOR:="no default value"},g -+ s,@NCURSES_PATCH@,\${NCURSES_PATCH:="no default value"},g -+ s,@NCURSES_OSPEED@,\${NCURSES_OSPEED:="no default value"},g - CF_EOF - - for cf_name in captoinfo clear infocmp infotocap tabs tic toe tput tset -@@ -9869,7 +10730,9 @@ - - if test "$MANPAGE_ALIASES" != no ; then - cat >>$cf_edit_man <>$cf_edit_man <\$TMP.out -+ mv \$TMP.out \$TMP -+CF_EOF -+fi -+ - if test $with_curses_h != yes ; then - cat >>$cf_edit_man <\$TMP.out -@@ -10051,7 +10921,7 @@ - ############################################################################### - - ### Note that some functions (such as const) are normally disabled anyway. --echo "$as_me:10054: checking if you want to build with function extensions" >&5 -+echo "$as_me:10924: checking if you want to build with function extensions" >&5 - echo $ECHO_N "checking if you want to build with function extensions... $ECHO_C" >&6 - - # Check whether --enable-ext-funcs or --disable-ext-funcs was given. -@@ -10061,39 +10931,52 @@ - else - with_ext_funcs=yes - fi; --echo "$as_me:10064: result: $with_ext_funcs" >&5 -+echo "$as_me:10934: result: $with_ext_funcs" >&5 - echo "${ECHO_T}$with_ext_funcs" >&6 --if test "$with_ext_funcs" = yes ; then -+if test "x$with_ext_funcs" = xyes ; then - NCURSES_EXT_FUNCS=1 -- cat >>confdefs.h <<\EOF -+ -+cat >>confdefs.h <<\EOF -+#define HAVE_ASSUME_DEFAULT_COLORS 1 -+EOF -+ -+cat >>confdefs.h <<\EOF - #define HAVE_CURSES_VERSION 1 - EOF - -- cat >>confdefs.h <<\EOF -+cat >>confdefs.h <<\EOF - #define HAVE_HAS_KEY 1 - EOF - -- cat >>confdefs.h <<\EOF -+cat >>confdefs.h <<\EOF - #define HAVE_RESIZETERM 1 - EOF - -- cat >>confdefs.h <<\EOF -+cat >>confdefs.h <<\EOF - #define HAVE_RESIZE_TERM 1 - EOF - -- cat >>confdefs.h <<\EOF -+cat >>confdefs.h <<\EOF - #define HAVE_TERM_ENTRY_H 1 - EOF - -- cat >>confdefs.h <<\EOF -+cat >>confdefs.h <<\EOF - #define HAVE_USE_DEFAULT_COLORS 1 - EOF - -- cat >>confdefs.h <<\EOF -+cat >>confdefs.h <<\EOF -+#define HAVE_USE_SCREEN 1 -+EOF -+ -+cat >>confdefs.h <<\EOF -+#define HAVE_USE_WINDOW 1 -+EOF -+ -+cat >>confdefs.h <<\EOF - #define HAVE_WRESIZE 1 - EOF - -- cat >>confdefs.h <<\EOF -+cat >>confdefs.h <<\EOF - #define NCURSES_EXT_FUNCS 1 - EOF - -@@ -10103,7 +10986,7 @@ - GENERATED_EXT_FUNCS= - fi - --echo "$as_me:10106: checking if you want to build with experimental SCREEN extensions" >&5 -+echo "$as_me:10989: checking if you want to build with experimental SCREEN extensions" >&5 - echo $ECHO_N "checking if you want to build with experimental SCREEN extensions... $ECHO_C" >&6 - - # Check whether --enable-sp-funcs or --disable-sp-funcs was given. -@@ -10113,11 +10996,12 @@ - else - with_sp_funcs=no - fi; --echo "$as_me:10116: result: $with_sp_funcs" >&5 -+echo "$as_me:10999: result: $with_sp_funcs" >&5 - echo "${ECHO_T}$with_sp_funcs" >&6 --if test "$with_sp_funcs" = yes ; then -+if test "x$with_sp_funcs" = xyes ; then - NCURSES_SP_FUNCS=1 -- cat >>confdefs.h <<\EOF -+ -+cat >>confdefs.h <<\EOF - #define NCURSES_SP_FUNCS 1 - EOF - -@@ -10127,7 +11011,7 @@ - GENERATED_SP_FUNCS= - fi - --echo "$as_me:10130: checking if you want to build with experimental terminal-driver" >&5 -+echo "$as_me:11014: checking if you want to build with experimental terminal-driver" >&5 - echo $ECHO_N "checking if you want to build with experimental terminal-driver... $ECHO_C" >&6 - - # Check whether --enable-term-driver or --disable-term-driver was given. -@@ -10137,22 +11021,23 @@ - else - with_term_driver=no - fi; --echo "$as_me:10140: result: $with_term_driver" >&5 -+echo "$as_me:11024: result: $with_term_driver" >&5 - echo "${ECHO_T}$with_term_driver" >&6 --if test "$with_term_driver" = yes ; then -- cat >>confdefs.h <<\EOF -+if test "x$with_term_driver" = xyes ; then -+ -+cat >>confdefs.h <<\EOF - #define USE_TERM_DRIVER 1 - EOF - -- if test "$with_sp_funcs" != yes ; then -- { { echo "$as_me:10148: error: The term-driver option relies upon sp-funcs" >&5 -+ if test "x$with_sp_funcs" != xyes ; then -+ { { echo "$as_me:11033: error: The term-driver option relies upon sp-funcs" >&5 - echo "$as_me: error: The term-driver option relies upon sp-funcs" >&2;} - { (exit 1); exit 1; }; } - fi - fi - - ### use option --enable-const to turn on use of const beyond that in XSI. --echo "$as_me:10155: checking for extended use of const keyword" >&5 -+echo "$as_me:11040: checking for extended use of const keyword" >&5 - echo $ECHO_N "checking for extended use of const keyword... $ECHO_C" >&6 - - # Check whether --enable-const or --disable-const was given. -@@ -10162,15 +11047,15 @@ - else - with_ext_const=no - fi; --echo "$as_me:10165: result: $with_ext_const" >&5 -+echo "$as_me:11050: result: $with_ext_const" >&5 - echo "${ECHO_T}$with_ext_const" >&6 - NCURSES_CONST='/*nothing*/' --if test "$with_ext_const" = yes ; then -+if test "x$with_ext_const" = xyes ; then - NCURSES_CONST=const - fi - - ### use option --enable-ext-colors to turn on use of colors beyond 16. --echo "$as_me:10173: checking if you want to use extended colors" >&5 -+echo "$as_me:11058: checking if you want to use extended colors" >&5 - echo $ECHO_N "checking if you want to use extended colors... $ECHO_C" >&6 - - # Check whether --enable-ext-colors or --disable-ext-colors was given. -@@ -10180,12 +11065,12 @@ - else - with_ext_colors=no - fi; --echo "$as_me:10183: result: $with_ext_colors" >&5 -+echo "$as_me:11068: result: $with_ext_colors" >&5 - echo "${ECHO_T}$with_ext_colors" >&6 - NCURSES_EXT_COLORS=0 --if test "$with_ext_colors" = yes ; then -- if test "$with_widec" != yes ; then -- { { echo "$as_me:10188: error: This option applies only to wide-character library" >&5 -+if test "x$with_ext_colors" = xyes ; then -+ if test "x$with_widec" != xyes ; then -+ { { echo "$as_me:11073: error: This option applies only to wide-character library" >&5 - echo "$as_me: error: This option applies only to wide-character library" >&2;} - { (exit 1); exit 1; }; } - else -@@ -10196,7 +11081,7 @@ - 5.*) - cf_cv_rel_version=6.0 - cf_cv_abi_version=6 -- { echo "$as_me:10199: WARNING: Overriding ABI version to $cf_cv_abi_version" >&5 -+ { echo "$as_me:11084: WARNING: Overriding ABI version to $cf_cv_abi_version" >&5 - echo "$as_me: WARNING: Overriding ABI version to $cf_cv_abi_version" >&2;} - ;; - esac -@@ -10204,14 +11089,15 @@ - - fi - NCURSES_EXT_COLORS=1 -- cat >>confdefs.h <<\EOF -+ -+cat >>confdefs.h <<\EOF - #define NCURSES_EXT_COLORS 1 - EOF - - fi - - ### use option --enable-ext-mouse to modify coding to support 5-button mice --echo "$as_me:10214: checking if you want to use extended mouse encoding" >&5 -+echo "$as_me:11100: checking if you want to use extended mouse encoding" >&5 - echo $ECHO_N "checking if you want to use extended mouse encoding... $ECHO_C" >&6 - - # Check whether --enable-ext-mouse or --disable-ext-mouse was given. -@@ -10221,10 +11107,10 @@ - else - with_ext_mouse=no - fi; --echo "$as_me:10224: result: $with_ext_mouse" >&5 -+echo "$as_me:11110: result: $with_ext_mouse" >&5 - echo "${ECHO_T}$with_ext_mouse" >&6 - NCURSES_MOUSE_VERSION=1 --if test "$with_ext_mouse" = yes ; then -+if test "x$with_ext_mouse" = xyes ; then - NCURSES_MOUSE_VERSION=2 - - if test "${with_abi_version+set}" != set; then -@@ -10232,7 +11118,7 @@ - 5.*) - cf_cv_rel_version=6.0 - cf_cv_abi_version=6 -- { echo "$as_me:10235: WARNING: Overriding ABI version to $cf_cv_abi_version" >&5 -+ { echo "$as_me:11121: WARNING: Overriding ABI version to $cf_cv_abi_version" >&5 - echo "$as_me: WARNING: Overriding ABI version to $cf_cv_abi_version" >&2;} - ;; - esac -@@ -10240,7 +11126,7 @@ - - fi - --echo "$as_me:10243: checking if you want \$NCURSES_NO_PADDING code" >&5 -+echo "$as_me:11129: checking if you want \$NCURSES_NO_PADDING code" >&5 - echo $ECHO_N "checking if you want \$NCURSES_NO_PADDING code... $ECHO_C" >&6 - - # Check whether --enable-no-padding or --disable-no-padding was given. -@@ -10250,19 +11136,20 @@ - else - with_no_padding=$with_ext_funcs - fi; --echo "$as_me:10253: result: $with_no_padding" >&5 -+echo "$as_me:11139: result: $with_no_padding" >&5 - echo "${ECHO_T}$with_no_padding" >&6 --test "$with_no_padding" = yes && cat >>confdefs.h <<\EOF -+test "x$with_no_padding" = xyes && -+cat >>confdefs.h <<\EOF - #define NCURSES_NO_PADDING 1 - EOF - --echo "$as_me:10259: checking for ANSI C header files" >&5 -+echo "$as_me:11146: checking for ANSI C header files" >&5 - echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 - if test "${ac_cv_header_stdc+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - cat >conftest.$ac_ext <<_ACEOF --#line 10265 "configure" -+#line 11152 "configure" - #include "confdefs.h" - #include - #include -@@ -10270,13 +11157,13 @@ - #include - - _ACEOF --if { (eval echo "$as_me:10273: \"$ac_cpp conftest.$ac_ext\"") >&5 -+if { (eval echo "$as_me:11160: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 -- echo "$as_me:10279: \$? = $ac_status" >&5 -+ echo "$as_me:11166: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag -@@ -10298,7 +11185,7 @@ - if test $ac_cv_header_stdc = yes; then - # SunOS 4.x string.h does not declare mem*, contrary to ANSI. - cat >conftest.$ac_ext <<_ACEOF --#line 10301 "configure" -+#line 11188 "configure" - #include "confdefs.h" - #include - -@@ -10316,7 +11203,7 @@ - if test $ac_cv_header_stdc = yes; then - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. - cat >conftest.$ac_ext <<_ACEOF --#line 10319 "configure" -+#line 11206 "configure" - #include "confdefs.h" - #include - -@@ -10337,7 +11224,7 @@ - : - else - cat >conftest.$ac_ext <<_ACEOF --#line 10340 "configure" -+#line 11227 "configure" - #include "confdefs.h" - #include - #if ((' ' & 0x0FF) == 0x020) -@@ -10363,15 +11250,15 @@ - } - _ACEOF - rm -f conftest$ac_exeext --if { (eval echo "$as_me:10366: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:11253: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:10369: \$? = $ac_status" >&5 -+ echo "$as_me:11256: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' -- { (eval echo "$as_me:10371: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:11258: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:10374: \$? = $ac_status" >&5 -+ echo "$as_me:11261: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : - else -@@ -10384,7 +11271,7 @@ - fi - fi - fi --echo "$as_me:10387: result: $ac_cv_header_stdc" >&5 -+echo "$as_me:11274: result: $ac_cv_header_stdc" >&5 - echo "${ECHO_T}$ac_cv_header_stdc" >&6 - if test $ac_cv_header_stdc = yes; then - -@@ -10400,28 +11287,28 @@ - inttypes.h stdint.h unistd.h - do - as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` --echo "$as_me:10403: checking for $ac_header" >&5 -+echo "$as_me:11290: checking for $ac_header" >&5 - echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 - if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - cat >conftest.$ac_ext <<_ACEOF --#line 10409 "configure" -+#line 11296 "configure" - #include "confdefs.h" - $ac_includes_default - #include <$ac_header> - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:10415: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:11302: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:10418: \$? = $ac_status" >&5 -+ echo "$as_me:11305: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:10421: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:11308: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:10424: \$? = $ac_status" >&5 -+ echo "$as_me:11311: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - eval "$as_ac_Header=yes" - else -@@ -10431,7 +11318,7 @@ - fi - rm -f conftest.$ac_objext conftest.$ac_ext - fi --echo "$as_me:10434: result: `eval echo '${'$as_ac_Header'}'`" >&5 -+echo "$as_me:11321: result: `eval echo '${'$as_ac_Header'}'`" >&5 - echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 - if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <&5 -+echo "$as_me:11331: checking for signed char" >&5 - echo $ECHO_N "checking for signed char... $ECHO_C" >&6 - if test "${ac_cv_type_signed_char+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - cat >conftest.$ac_ext <<_ACEOF --#line 10450 "configure" -+#line 11337 "configure" - #include "confdefs.h" - $ac_includes_default - int -@@ -10462,16 +11349,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:10465: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:11352: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:10468: \$? = $ac_status" >&5 -+ echo "$as_me:11355: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:10471: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:11358: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:10474: \$? = $ac_status" >&5 -+ echo "$as_me:11361: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_type_signed_char=yes - else -@@ -10481,10 +11368,10 @@ - fi - rm -f conftest.$ac_objext conftest.$ac_ext - fi --echo "$as_me:10484: result: $ac_cv_type_signed_char" >&5 -+echo "$as_me:11371: result: $ac_cv_type_signed_char" >&5 - echo "${ECHO_T}$ac_cv_type_signed_char" >&6 - --echo "$as_me:10487: checking size of signed char" >&5 -+echo "$as_me:11374: checking size of signed char" >&5 - echo $ECHO_N "checking size of signed char... $ECHO_C" >&6 - if test "${ac_cv_sizeof_signed_char+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -10493,7 +11380,7 @@ - if test "$cross_compiling" = yes; then - # Depending upon the size, compute the lo and hi bounds. - cat >conftest.$ac_ext <<_ACEOF --#line 10496 "configure" -+#line 11383 "configure" - #include "confdefs.h" - $ac_includes_default - int -@@ -10505,21 +11392,21 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:10508: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:11395: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:10511: \$? = $ac_status" >&5 -+ echo "$as_me:11398: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:10514: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:11401: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:10517: \$? = $ac_status" >&5 -+ echo "$as_me:11404: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_lo=0 ac_mid=0 - while :; do - cat >conftest.$ac_ext <<_ACEOF --#line 10522 "configure" -+#line 11409 "configure" - #include "confdefs.h" - $ac_includes_default - int -@@ -10531,16 +11418,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:10534: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:11421: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:10537: \$? = $ac_status" >&5 -+ echo "$as_me:11424: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:10540: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:11427: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:10543: \$? = $ac_status" >&5 -+ echo "$as_me:11430: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_hi=$ac_mid; break - else -@@ -10556,7 +11443,7 @@ - ac_hi=-1 ac_mid=-1 - while :; do - cat >conftest.$ac_ext <<_ACEOF --#line 10559 "configure" -+#line 11446 "configure" - #include "confdefs.h" - $ac_includes_default - int -@@ -10568,16 +11455,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:10571: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:11458: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:10574: \$? = $ac_status" >&5 -+ echo "$as_me:11461: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:10577: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:11464: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:10580: \$? = $ac_status" >&5 -+ echo "$as_me:11467: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_lo=$ac_mid; break - else -@@ -10593,7 +11480,7 @@ - while test "x$ac_lo" != "x$ac_hi"; do - ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` - cat >conftest.$ac_ext <<_ACEOF --#line 10596 "configure" -+#line 11483 "configure" - #include "confdefs.h" - $ac_includes_default - int -@@ -10605,16 +11492,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:10608: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:11495: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:10611: \$? = $ac_status" >&5 -+ echo "$as_me:11498: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:10614: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:11501: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:10617: \$? = $ac_status" >&5 -+ echo "$as_me:11504: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_hi=$ac_mid - else -@@ -10627,12 +11514,12 @@ - ac_cv_sizeof_signed_char=$ac_lo - else - if test "$cross_compiling" = yes; then -- { { echo "$as_me:10630: error: cannot run test program while cross compiling" >&5 -+ { { echo "$as_me:11517: error: cannot run test program while cross compiling" >&5 - echo "$as_me: error: cannot run test program while cross compiling" >&2;} - { (exit 1); exit 1; }; } - else - cat >conftest.$ac_ext <<_ACEOF --#line 10635 "configure" -+#line 11522 "configure" - #include "confdefs.h" - $ac_includes_default - int -@@ -10648,15 +11535,15 @@ - } - _ACEOF - rm -f conftest$ac_exeext --if { (eval echo "$as_me:10651: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:11538: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:10654: \$? = $ac_status" >&5 -+ echo "$as_me:11541: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' -- { (eval echo "$as_me:10656: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:11543: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:10659: \$? = $ac_status" >&5 -+ echo "$as_me:11546: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_sizeof_signed_char=`cat conftest.val` - else -@@ -10672,7 +11559,7 @@ - ac_cv_sizeof_signed_char=0 - fi - fi --echo "$as_me:10675: result: $ac_cv_sizeof_signed_char" >&5 -+echo "$as_me:11562: result: $ac_cv_sizeof_signed_char" >&5 - echo "${ECHO_T}$ac_cv_sizeof_signed_char" >&6 - cat >>confdefs.h <&5 -+echo "$as_me:11573: checking if you want to use signed Boolean array in term.h" >&5 - echo $ECHO_N "checking if you want to use signed Boolean array in term.h... $ECHO_C" >&6 - - # Check whether --enable-signed-char or --disable-signed-char was given. -@@ -10693,12 +11580,12 @@ - else - with_signed_char=no - fi; --echo "$as_me:10696: result: $with_signed_char" >&5 -+echo "$as_me:11583: result: $with_signed_char" >&5 - echo "${ECHO_T}$with_signed_char" >&6 --test "$with_signed_char" != yes && NCURSES_SBOOL="char" -+test "x$with_signed_char" != xyes && NCURSES_SBOOL="char" - - ### use option --enable-sigwinch to turn on use of SIGWINCH logic --echo "$as_me:10701: checking if you want SIGWINCH handler" >&5 -+echo "$as_me:11588: checking if you want SIGWINCH handler" >&5 - echo $ECHO_N "checking if you want SIGWINCH handler... $ECHO_C" >&6 - - # Check whether --enable-sigwinch or --disable-sigwinch was given. -@@ -10708,14 +11595,15 @@ - else - with_sigwinch=$with_ext_funcs - fi; --echo "$as_me:10711: result: $with_sigwinch" >&5 -+echo "$as_me:11598: result: $with_sigwinch" >&5 - echo "${ECHO_T}$with_sigwinch" >&6 --test "$with_sigwinch" = yes && cat >>confdefs.h <<\EOF -+test "x$with_sigwinch" = xyes && -+cat >>confdefs.h <<\EOF - #define USE_SIGWINCH 1 - EOF - - ### use option --enable-tcap-names to allow user to define new capabilities --echo "$as_me:10718: checking if you want user-definable terminal capabilities like termcap" >&5 -+echo "$as_me:11606: checking if you want user-definable terminal capabilities like termcap" >&5 - echo $ECHO_N "checking if you want user-definable terminal capabilities like termcap... $ECHO_C" >&6 - - # Check whether --enable-tcap-names or --disable-tcap-names was given. -@@ -10725,15 +11613,15 @@ - else - with_tcap_names=$with_ext_funcs - fi; --echo "$as_me:10728: result: $with_tcap_names" >&5 -+echo "$as_me:11616: result: $with_tcap_names" >&5 - echo "${ECHO_T}$with_tcap_names" >&6 - NCURSES_XNAMES=0 --test "$with_tcap_names" = yes && NCURSES_XNAMES=1 -+test "x$with_tcap_names" = xyes && NCURSES_XNAMES=1 - - ############################################################################### - # These options are relatively safe to experiment with. - --echo "$as_me:10736: checking if you want all development code" >&5 -+echo "$as_me:11624: checking if you want all development code" >&5 - echo $ECHO_N "checking if you want all development code... $ECHO_C" >&6 - - # Check whether --with-develop or --without-develop was given. -@@ -10743,11 +11631,11 @@ - else - with_develop=no - fi; --echo "$as_me:10746: result: $with_develop" >&5 -+echo "$as_me:11634: result: $with_develop" >&5 - echo "${ECHO_T}$with_develop" >&6 - - ### use option --enable-hard-tabs to turn on use of hard-tabs optimize --echo "$as_me:10750: checking if you want hard-tabs code" >&5 -+echo "$as_me:11638: checking if you want hard-tabs code" >&5 - echo $ECHO_N "checking if you want hard-tabs code... $ECHO_C" >&6 - - # Check whether --enable-hard-tabs or --disable-hard-tabs was given. -@@ -10757,14 +11645,15 @@ - else - enable_hard_tabs=$with_develop - fi; --echo "$as_me:10760: result: $enable_hard_tabs" >&5 -+echo "$as_me:11648: result: $enable_hard_tabs" >&5 - echo "${ECHO_T}$enable_hard_tabs" >&6 --test "$enable_hard_tabs" = yes && cat >>confdefs.h <<\EOF -+test "x$enable_hard_tabs" = xyes && -+cat >>confdefs.h <<\EOF - #define USE_HARD_TABS 1 - EOF - - ### use option --enable-xmc-glitch to turn on use of magic-cookie optimize --echo "$as_me:10767: checking if you want limited support for xmc" >&5 -+echo "$as_me:11656: checking if you want limited support for xmc" >&5 - echo $ECHO_N "checking if you want limited support for xmc... $ECHO_C" >&6 - - # Check whether --enable-xmc-glitch or --disable-xmc-glitch was given. -@@ -10774,16 +11663,17 @@ - else - enable_xmc_glitch=$with_develop - fi; --echo "$as_me:10777: result: $enable_xmc_glitch" >&5 -+echo "$as_me:11666: result: $enable_xmc_glitch" >&5 - echo "${ECHO_T}$enable_xmc_glitch" >&6 --test "$enable_xmc_glitch" = yes && cat >>confdefs.h <<\EOF -+test "x$enable_xmc_glitch" = xyes && -+cat >>confdefs.h <<\EOF - #define USE_XMC_SUPPORT 1 - EOF - - ############################################################################### - # These are just experimental, probably should not be in a package: - --echo "$as_me:10786: checking if you do not want to assume colors are white-on-black" >&5 -+echo "$as_me:11676: checking if you do not want to assume colors are white-on-black" >&5 - echo $ECHO_N "checking if you do not want to assume colors are white-on-black... $ECHO_C" >&6 - - # Check whether --enable-assumed-color or --disable-assumed-color was given. -@@ -10793,14 +11683,15 @@ - else - with_assumed_color=yes - fi; --echo "$as_me:10796: result: $with_assumed_color" >&5 -+echo "$as_me:11686: result: $with_assumed_color" >&5 - echo "${ECHO_T}$with_assumed_color" >&6 --test "$with_assumed_color" = yes && cat >>confdefs.h <<\EOF -+test "x$with_assumed_color" = xyes && -+cat >>confdefs.h <<\EOF - #define USE_ASSUMED_COLOR 1 - EOF - - ### use option --enable-hashmap to turn on use of hashmap scrolling logic --echo "$as_me:10803: checking if you want hashmap scrolling-optimization code" >&5 -+echo "$as_me:11694: checking if you want hashmap scrolling-optimization code" >&5 - echo $ECHO_N "checking if you want hashmap scrolling-optimization code... $ECHO_C" >&6 - - # Check whether --enable-hashmap or --disable-hashmap was given. -@@ -10810,14 +11701,15 @@ - else - with_hashmap=yes - fi; --echo "$as_me:10813: result: $with_hashmap" >&5 -+echo "$as_me:11704: result: $with_hashmap" >&5 - echo "${ECHO_T}$with_hashmap" >&6 --test "$with_hashmap" = yes && cat >>confdefs.h <<\EOF -+test "x$with_hashmap" = xyes && -+cat >>confdefs.h <<\EOF - #define USE_HASHMAP 1 - EOF - - ### use option --enable-colorfgbg to turn on use of $COLORFGBG environment --echo "$as_me:10820: checking if you want colorfgbg code" >&5 -+echo "$as_me:11712: checking if you want colorfgbg code" >&5 - echo $ECHO_N "checking if you want colorfgbg code... $ECHO_C" >&6 - - # Check whether --enable-colorfgbg or --disable-colorfgbg was given. -@@ -10827,14 +11719,15 @@ - else - with_colorfgbg=no - fi; --echo "$as_me:10830: result: $with_colorfgbg" >&5 -+echo "$as_me:11722: result: $with_colorfgbg" >&5 - echo "${ECHO_T}$with_colorfgbg" >&6 --test "$with_colorfgbg" = yes && cat >>confdefs.h <<\EOF -+test "x$with_colorfgbg" = xyes && -+cat >>confdefs.h <<\EOF - #define USE_COLORFGBG 1 - EOF - - ### use option --enable-interop to turn on use of bindings used for interop --echo "$as_me:10837: checking if you want interop bindings" >&5 -+echo "$as_me:11730: checking if you want interop bindings" >&5 - echo $ECHO_N "checking if you want interop bindings... $ECHO_C" >&6 - - # Check whether --enable-interop or --disable-interop was given. -@@ -10844,16 +11737,16 @@ - else - with_exp_interop=no - fi; --echo "$as_me:10847: result: $with_exp_interop" >&5 -+echo "$as_me:11740: result: $with_exp_interop" >&5 - echo "${ECHO_T}$with_exp_interop" >&6 - - NCURSES_INTEROP_FUNCS=0 --test "$with_exp_interop" = yes && NCURSES_INTEROP_FUNCS=1 -+test "x$with_exp_interop" = xyes && NCURSES_INTEROP_FUNCS=1 - - # This is still experimental (20080329), but should ultimately be moved to - # the script-block --with-normal, etc. - --echo "$as_me:10856: checking if you want to link with the pthread library" >&5 -+echo "$as_me:11749: checking if you want to link with the pthread library" >&5 - echo $ECHO_N "checking if you want to link with the pthread library... $ECHO_C" >&6 - - # Check whether --with-pthread or --without-pthread was given. -@@ -10863,27 +11756,27 @@ - else - with_pthread=no - fi; --echo "$as_me:10866: result: $with_pthread" >&5 -+echo "$as_me:11759: result: $with_pthread" >&5 - echo "${ECHO_T}$with_pthread" >&6 - - if test "$with_pthread" != no ; then -- echo "$as_me:10870: checking for pthread.h" >&5 -+ echo "$as_me:11763: checking for pthread.h" >&5 - echo $ECHO_N "checking for pthread.h... $ECHO_C" >&6 - if test "${ac_cv_header_pthread_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - cat >conftest.$ac_ext <<_ACEOF --#line 10876 "configure" -+#line 11769 "configure" - #include "confdefs.h" - #include - _ACEOF --if { (eval echo "$as_me:10880: \"$ac_cpp conftest.$ac_ext\"") >&5 -+if { (eval echo "$as_me:11773: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 -- echo "$as_me:10886: \$? = $ac_status" >&5 -+ echo "$as_me:11779: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag -@@ -10902,20 +11795,22 @@ - fi - rm -f conftest.err conftest.$ac_ext - fi --echo "$as_me:10905: result: $ac_cv_header_pthread_h" >&5 -+echo "$as_me:11798: result: $ac_cv_header_pthread_h" >&5 - echo "${ECHO_T}$ac_cv_header_pthread_h" >&6 - if test $ac_cv_header_pthread_h = yes; then - -- cat >>confdefs.h <<\EOF -+cat >>confdefs.h <<\EOF - #define HAVE_PTHREADS_H 1 - EOF - -- echo "$as_me:10913: checking if we can link with the pthread library" >&5 --echo $ECHO_N "checking if we can link with the pthread library... $ECHO_C" >&6 -- cf_save_LIBS="$LIBS" -- LIBS="-lpthread $LIBS" -- cat >conftest.$ac_ext <<_ACEOF --#line 10918 "configure" -+ for cf_lib_pthread in pthread c_r -+ do -+ echo "$as_me:11808: checking if we can link with the $cf_lib_pthread library" >&5 -+echo $ECHO_N "checking if we can link with the $cf_lib_pthread library... $ECHO_C" >&6 -+ cf_save_LIBS="$LIBS" -+ LIBS="-l$cf_lib_pthread $LIBS" -+ cat >conftest.$ac_ext <<_ACEOF -+#line 11813 "configure" - #include "confdefs.h" - - #include -@@ -10924,23 +11819,24 @@ - main () - { - -- int rc = pthread_create(0,0,0,0); -+ int rc = pthread_create(0,0,0,0); -+ int r2 = pthread_mutexattr_settype(0, 0); - - ; - return 0; - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:10934: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:11830: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:10937: \$? = $ac_status" >&5 -+ echo "$as_me:11833: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:10940: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:11836: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:10943: \$? = $ac_status" >&5 -+ echo "$as_me:11839: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - with_pthread=yes - else -@@ -10949,34 +11845,37 @@ - with_pthread=no - fi - rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -- LIBS="$cf_save_LIBS" -- echo "$as_me:10953: result: $with_pthread" >&5 -+ LIBS="$cf_save_LIBS" -+ echo "$as_me:11849: result: $with_pthread" >&5 - echo "${ECHO_T}$with_pthread" >&6 -+ test "$with_pthread" = yes && break -+ done - -- if test "$with_pthread" = yes ; then -- LIBS="-lpthread $LIBS" -- cat >>confdefs.h <<\EOF -+ if test "$with_pthread" = yes ; then -+ LIBS="-l$cf_lib_pthread $LIBS" -+ -+cat >>confdefs.h <<\EOF - #define HAVE_LIBPTHREADS 1 - EOF - -- else -- { { echo "$as_me:10963: error: Cannot link with pthread library" >&5 -+ else -+ { { echo "$as_me:11862: error: Cannot link with pthread library" >&5 - echo "$as_me: error: Cannot link with pthread library" >&2;} - { (exit 1); exit 1; }; } -- fi -+ fi - - fi - - fi - - if test "x$with_pthread" != xno; then -- echo "$as_me:10973: checking for pthread_kill" >&5 -+ echo "$as_me:11872: checking for pthread_kill" >&5 - echo $ECHO_N "checking for pthread_kill... $ECHO_C" >&6 - if test "${ac_cv_func_pthread_kill+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - cat >conftest.$ac_ext <<_ACEOF --#line 10979 "configure" -+#line 11878 "configure" - #include "confdefs.h" - /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char pthread_kill (); below. */ -@@ -10999,7 +11898,7 @@ - #if defined (__stub_pthread_kill) || defined (__stub___pthread_kill) - choke me - #else --f = pthread_kill; -+f = pthread_kill; /* workaround for ICC 12.0.3 */ if (f == 0) return 1; - #endif - - ; -@@ -11007,16 +11906,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:11010: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:11909: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:11013: \$? = $ac_status" >&5 -+ echo "$as_me:11912: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:11016: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:11915: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:11019: \$? = $ac_status" >&5 -+ echo "$as_me:11918: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_func_pthread_kill=yes - else -@@ -11026,11 +11925,11 @@ - fi - rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - fi --echo "$as_me:11029: result: $ac_cv_func_pthread_kill" >&5 -+echo "$as_me:11928: result: $ac_cv_func_pthread_kill" >&5 - echo "${ECHO_T}$ac_cv_func_pthread_kill" >&6 - if test $ac_cv_func_pthread_kill = yes; then - -- echo "$as_me:11033: checking if you want to allow EINTR in wgetch with pthreads" >&5 -+ echo "$as_me:11932: checking if you want to allow EINTR in wgetch with pthreads" >&5 - echo $ECHO_N "checking if you want to allow EINTR in wgetch with pthreads... $ECHO_C" >&6 - - # Check whether --enable-pthreads-eintr or --disable-pthreads-eintr was given. -@@ -11040,17 +11939,18 @@ - else - use_pthreads_eintr=no - fi; -- echo "$as_me:11043: result: $use_pthreads_eintr" >&5 -+ echo "$as_me:11942: result: $use_pthreads_eintr" >&5 - echo "${ECHO_T}$use_pthreads_eintr" >&6 -- if test $use_pthreads_eintr = yes ; then -- cat >>confdefs.h <<\EOF -+ if test "x$use_pthreads_eintr" = xyes ; then -+ -+cat >>confdefs.h <<\EOF - #define USE_PTHREADS_EINTR 1 - EOF - - fi - fi - -- echo "$as_me:11053: checking if you want to use weak-symbols for pthreads" >&5 -+ echo "$as_me:11953: checking if you want to use weak-symbols for pthreads" >&5 - echo $ECHO_N "checking if you want to use weak-symbols for pthreads... $ECHO_C" >&6 - - # Check whether --enable-weak-symbols or --disable-weak-symbols was given. -@@ -11060,18 +11960,18 @@ - else - use_weak_symbols=no - fi; -- echo "$as_me:11063: result: $use_weak_symbols" >&5 -+ echo "$as_me:11963: result: $use_weak_symbols" >&5 - echo "${ECHO_T}$use_weak_symbols" >&6 -- if test "$use_weak_symbols" = yes ; then -+ if test "x$use_weak_symbols" = xyes ; then - --echo "$as_me:11067: checking if $CC supports weak symbols" >&5 -+echo "$as_me:11967: checking if $CC supports weak symbols" >&5 - echo $ECHO_N "checking if $CC supports weak symbols... $ECHO_C" >&6 - if test "${cf_cv_weak_symbols+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - - cat >conftest.$ac_ext <<_ACEOF --#line 11074 "configure" -+#line 11974 "configure" - #include "confdefs.h" - - #include -@@ -11097,16 +11997,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:11100: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:12000: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:11103: \$? = $ac_status" >&5 -+ echo "$as_me:12003: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:11106: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:12006: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:11109: \$? = $ac_status" >&5 -+ echo "$as_me:12009: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_cv_weak_symbols=yes - else -@@ -11117,15 +12017,16 @@ - rm -f conftest.$ac_objext conftest.$ac_ext - - fi --echo "$as_me:11120: result: $cf_cv_weak_symbols" >&5 -+echo "$as_me:12020: result: $cf_cv_weak_symbols" >&5 - echo "${ECHO_T}$cf_cv_weak_symbols" >&6 - - else - cf_cv_weak_symbols=no - fi - -- if test $cf_cv_weak_symbols = yes ; then -- cat >>confdefs.h <<\EOF -+ if test "x$cf_cv_weak_symbols" = xyes ; then -+ -+cat >>confdefs.h <<\EOF - #define USE_WEAK_SYMBOLS 1 - EOF - -@@ -11133,13 +12034,14 @@ - fi - - PTHREAD= --if test "$with_pthread" = "yes" ; then -- cat >>confdefs.h <<\EOF -+if test "x$with_pthread" = "xyes" ; then -+ -+cat >>confdefs.h <<\EOF - #define USE_PTHREADS 1 - EOF - - enable_reentrant=yes -- if test $cf_cv_weak_symbols = yes ; then -+ if test "x$cf_cv_weak_symbols" = xyes ; then - PTHREAD=-lpthread - fi - fi -@@ -11148,7 +12050,7 @@ - # opaque outside of that, so there is no --enable-opaque option. We can use - # this option without --with-pthreads, but this will be always set for - # pthreads. --echo "$as_me:11151: checking if you want experimental reentrant code" >&5 -+echo "$as_me:12053: checking if you want experimental reentrant code" >&5 - echo $ECHO_N "checking if you want experimental reentrant code... $ECHO_C" >&6 - - # Check whether --enable-reentrant or --disable-reentrant was given. -@@ -11158,14 +12060,14 @@ - else - with_reentrant=no - fi; --echo "$as_me:11161: result: $with_reentrant" >&5 -+echo "$as_me:12063: result: $with_reentrant" >&5 - echo "${ECHO_T}$with_reentrant" >&6 --if test "$with_reentrant" = yes ; then -+if test "x$with_reentrant" = xyes ; then - cf_cv_enable_reentrant=1 - cf_cv_enable_opaque="NCURSES_INTERNALS" - NCURSES_OPAQUE=1 - NCURSES_SIZE_T=int -- if test $cf_cv_weak_symbols = yes ; then -+ if test "x$cf_cv_weak_symbols" = xyes ; then - - # remove pthread library from $LIBS - LIBS=`echo "$LIBS" | sed -e 's/-lpthread[ ]//g' -e 's/-lpthread$//'` -@@ -11173,9 +12075,20 @@ - TEST_LIBS="-lpthread $TEST_LIBS" - TEST_LIBS2="-lpthread $TEST_LIBS2" - else -- LIB_SUFFIX="t${LIB_SUFFIX}" -+ # when not using weak symbols but with_reentrant, -+ # add 't' to the library suffix on all platforms -+ # except cygwin, where we only do that if ALSO -+ # compiling with full thread support. -+ case "$host" in -+ *cygwin* | *msys*) -+ if test "$with_pthread" = "yes" ; then -+ LIB_SUFFIX="t${LIB_SUFFIX}" -+ fi ;; -+ * ) LIB_SUFFIX="t${LIB_SUFFIX}" ;; -+ esac - fi -- cat >>confdefs.h <<\EOF -+ -+cat >>confdefs.h <<\EOF - #define USE_REENTRANT 1 - EOF - -@@ -11184,7 +12097,7 @@ - 5.*) - cf_cv_rel_version=6.0 - cf_cv_abi_version=6 -- { echo "$as_me:11187: WARNING: Overriding ABI version to $cf_cv_abi_version" >&5 -+ { echo "$as_me:12100: WARNING: Overriding ABI version to $cf_cv_abi_version" >&5 - echo "$as_me: WARNING: Overriding ABI version to $cf_cv_abi_version" >&2;} - ;; - esac -@@ -11199,7 +12112,7 @@ - - ### Allow using a different wrap-prefix - if test "$cf_cv_enable_reentrant" != 0 || test "$BROKEN_LINKER" = 1 ; then -- echo "$as_me:11202: checking for prefix used to wrap public variables" >&5 -+ echo "$as_me:12115: checking for prefix used to wrap public variables" >&5 - echo $ECHO_N "checking for prefix used to wrap public variables... $ECHO_C" >&6 - - # Check whether --with-wrap-prefix or --without-wrap-prefix was given. -@@ -11209,7 +12122,7 @@ - else - NCURSES_WRAP_PREFIX=_nc_ - fi; -- echo "$as_me:11212: result: $NCURSES_WRAP_PREFIX" >&5 -+ echo "$as_me:12125: result: $NCURSES_WRAP_PREFIX" >&5 - echo "${ECHO_T}$NCURSES_WRAP_PREFIX" >&6 - else - NCURSES_WRAP_PREFIX=_nc_ -@@ -11219,7 +12132,7 @@ - #define NCURSES_WRAP_PREFIX "$NCURSES_WRAP_PREFIX" - EOF - --echo "$as_me:11222: checking if you want experimental safe-sprintf code" >&5 -+echo "$as_me:12135: checking if you want experimental safe-sprintf code" >&5 - echo $ECHO_N "checking if you want experimental safe-sprintf code... $ECHO_C" >&6 - - # Check whether --enable-safe-sprintf or --disable-safe-sprintf was given. -@@ -11229,16 +12142,17 @@ - else - with_safe_sprintf=no - fi; --echo "$as_me:11232: result: $with_safe_sprintf" >&5 -+echo "$as_me:12145: result: $with_safe_sprintf" >&5 - echo "${ECHO_T}$with_safe_sprintf" >&6 --test "$with_safe_sprintf" = yes && cat >>confdefs.h <<\EOF -+test "x$with_safe_sprintf" = xyes && -+cat >>confdefs.h <<\EOF - #define USE_SAFE_SPRINTF 1 - EOF - - ### use option --disable-scroll-hints to turn off use of scroll-hints scrolling logic - # when hashmap is used scroll hints are useless - if test "$with_hashmap" = no ; then --echo "$as_me:11241: checking if you want to experiment without scrolling-hints code" >&5 -+echo "$as_me:12155: checking if you want to experiment without scrolling-hints code" >&5 - echo $ECHO_N "checking if you want to experiment without scrolling-hints code... $ECHO_C" >&6 - - # Check whether --enable-scroll-hints or --disable-scroll-hints was given. -@@ -11248,15 +12162,16 @@ - else - with_scroll_hints=yes - fi; --echo "$as_me:11251: result: $with_scroll_hints" >&5 -+echo "$as_me:12165: result: $with_scroll_hints" >&5 - echo "${ECHO_T}$with_scroll_hints" >&6 --test "$with_scroll_hints" = yes && cat >>confdefs.h <<\EOF -+test "x$with_scroll_hints" = xyes && -+cat >>confdefs.h <<\EOF - #define USE_SCROLL_HINTS 1 - EOF - - fi - --echo "$as_me:11259: checking if you want experimental wgetch-events code" >&5 -+echo "$as_me:12174: checking if you want experimental wgetch-events code" >&5 - echo $ECHO_N "checking if you want experimental wgetch-events code... $ECHO_C" >&6 - - # Check whether --enable-wgetch-events or --disable-wgetch-events was given. -@@ -11266,37 +12181,64 @@ - else - with_wgetch_events=no - fi; --echo "$as_me:11269: result: $with_wgetch_events" >&5 -+echo "$as_me:12184: result: $with_wgetch_events" >&5 - echo "${ECHO_T}$with_wgetch_events" >&6 --test "$with_wgetch_events" = yes && cat >>confdefs.h <<\EOF -+test "x$with_wgetch_events" = xyes && -+cat >>confdefs.h <<\EOF - #define NCURSES_WGETCH_EVENTS 1 - EOF - - ############################################################################### - - ### use option --disable-echo to suppress full display compiling commands --echo "$as_me:11278: checking if you want to display full commands during build" >&5 --echo $ECHO_N "checking if you want to display full commands during build... $ECHO_C" >&6 -+ -+echo "$as_me:12195: checking if you want to see long compiling messages" >&5 -+echo $ECHO_N "checking if you want to see long compiling messages... $ECHO_C" >&6 - - # Check whether --enable-echo or --disable-echo was given. - if test "${enable_echo+set}" = set; then - enableval="$enable_echo" -- with_echo=$enableval -+ test "$enableval" != no && enableval=yes -+ if test "$enableval" != "yes" ; then -+ -+ ECHO_LT='--silent' -+ ECHO_LD='@echo linking $@;' -+ RULE_CC='@echo compiling $<' -+ SHOW_CC='@echo compiling $@' -+ ECHO_CC='@' -+ -+ else -+ -+ ECHO_LT='' -+ ECHO_LD='' -+ RULE_CC='' -+ SHOW_CC='' -+ ECHO_CC='' -+ -+ fi - else -- with_echo=yes -+ enableval=yes -+ -+ ECHO_LT='' -+ ECHO_LD='' -+ RULE_CC='' -+ SHOW_CC='' -+ ECHO_CC='' -+ - fi; --if test "$with_echo" = yes; then -+echo "$as_me:12229: result: $enableval" >&5 -+echo "${ECHO_T}$enableval" >&6 -+ -+if test "x$enable_echo" = xyes; then - ECHO_LINK= - else - ECHO_LINK='@ echo linking $@ ... ;' - test -n "$LIBTOOL" && LIBTOOL="$LIBTOOL --silent" - test -n "$LIBTOOL_CXX" && LIBTOOL_CXX="$LIBTOOL_CXX --silent" - fi --echo "$as_me:11295: result: $with_echo" >&5 --echo "${ECHO_T}$with_echo" >&6 - - ### use option --enable-warnings to turn on all gcc warnings --echo "$as_me:11299: checking if you want to see compiler warnings" >&5 -+echo "$as_me:12241: checking if you want to see compiler warnings" >&5 - echo $ECHO_N "checking if you want to see compiler warnings... $ECHO_C" >&6 - - # Check whether --enable-warnings or --disable-warnings was given. -@@ -11304,7 +12246,7 @@ - enableval="$enable_warnings" - with_warnings=$enableval - fi; --echo "$as_me:11307: result: $with_warnings" >&5 -+echo "$as_me:12249: result: $with_warnings" >&5 - echo "${ECHO_T}$with_warnings" >&6 - - if test "x$with_warnings" = "xyes"; then -@@ -11316,12 +12258,12 @@ - if test "$GCC" = yes ; then - case $host_os in - linux*|gnu*) -- echo "$as_me:11319: checking if this is really Intel C compiler" >&5 -+ echo "$as_me:12261: checking if this is really Intel C compiler" >&5 - echo $ECHO_N "checking if this is really Intel C compiler... $ECHO_C" >&6 - cf_save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -no-gcc" - cat >conftest.$ac_ext <<_ACEOF --#line 11324 "configure" -+#line 12266 "configure" - #include "confdefs.h" - - int -@@ -11338,16 +12280,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:11341: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:12283: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:11344: \$? = $ac_status" >&5 -+ echo "$as_me:12286: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:11347: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:12289: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:11350: \$? = $ac_status" >&5 -+ echo "$as_me:12292: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - INTEL_COMPILER=yes - cf_save_CFLAGS="$cf_save_CFLAGS -we147 -no-gcc" -@@ -11358,14 +12300,63 @@ - fi - rm -f conftest.$ac_objext conftest.$ac_ext - CFLAGS="$cf_save_CFLAGS" -- echo "$as_me:11361: result: $INTEL_COMPILER" >&5 -+ echo "$as_me:12303: result: $INTEL_COMPILER" >&5 - echo "${ECHO_T}$INTEL_COMPILER" >&6 - ;; - esac - fi - -+CLANG_COMPILER=no -+ -+if test "$GCC" = yes ; then -+ echo "$as_me:12312: checking if this is really Clang C compiler" >&5 -+echo $ECHO_N "checking if this is really Clang C compiler... $ECHO_C" >&6 -+ cf_save_CFLAGS="$CFLAGS" -+ CFLAGS="$CFLAGS -Qunused-arguments" -+ cat >conftest.$ac_ext <<_ACEOF -+#line 12317 "configure" -+#include "confdefs.h" -+ -+int -+main () -+{ -+ -+#ifdef __clang__ -+#else -+make an error -+#endif -+ -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:12334: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>&5 -+ ac_status=$? -+ echo "$as_me:12337: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:12340: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:12343: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ CLANG_COMPILER=yes -+cf_save_CFLAGS="$cf_save_CFLAGS -Qunused-arguments" -+ -+else -+ echo "$as_me: failed program was:" >&5 -+cat conftest.$ac_ext >&5 -+fi -+rm -f conftest.$ac_objext conftest.$ac_ext -+ CFLAGS="$cf_save_CFLAGS" -+ echo "$as_me:12354: result: $CLANG_COMPILER" >&5 -+echo "${ECHO_T}$CLANG_COMPILER" >&6 -+fi -+ - cat > conftest.$ac_ext <&5 -+ { echo "$as_me:12376: checking for $CC warning options..." >&5 - echo "$as_me: checking for $CC warning options..." >&6;} - cf_save_CFLAGS="$CFLAGS" - EXTRA_CFLAGS="-Wall" -@@ -11398,12 +12389,12 @@ - wd981 - do - CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt" -- if { (eval echo "$as_me:11401: \"$ac_compile\"") >&5 -+ if { (eval echo "$as_me:12392: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:11404: \$? = $ac_status" >&5 -+ echo "$as_me:12395: \$? = $ac_status" >&5 - (exit $ac_status); }; then -- test -n "$verbose" && echo "$as_me:11406: result: ... -$cf_opt" >&5 -+ test -n "$verbose" && echo "$as_me:12397: result: ... -$cf_opt" >&5 - echo "${ECHO_T}... -$cf_opt" >&6 - EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt" - fi -@@ -11412,16 +12403,20 @@ - - elif test "$GCC" = yes - then -- { echo "$as_me:11415: checking for $CC warning options..." >&5 -+ { echo "$as_me:12406: checking for $CC warning options..." >&5 - echo "$as_me: checking for $CC warning options..." >&6;} - cf_save_CFLAGS="$CFLAGS" - EXTRA_CFLAGS= - cf_warn_CONST="" - test "$with_ext_const" = yes && cf_warn_CONST="Wwrite-strings" -+ cf_gcc_warnings="Wignored-qualifiers Wlogical-op Wvarargs" -+ test "x$CLANG_COMPILER" = xyes && cf_gcc_warnings= - for cf_opt in W Wall \ - Wbad-function-cast \ - Wcast-align \ - Wcast-qual \ -+ Wdeclaration-after-statement \ -+ Wextra \ - Winline \ - Wmissing-declarations \ - Wmissing-prototypes \ -@@ -11429,15 +12424,15 @@ - Wpointer-arith \ - Wshadow \ - Wstrict-prototypes \ -- Wundef $cf_warn_CONST Wdeclaration-after-statement Wextra Wno-unknown-pragmas Wswitch-enum -+ Wundef $cf_gcc_warnings $cf_warn_CONST Wno-unknown-pragmas Wswitch-enum - do - CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt" -- if { (eval echo "$as_me:11435: \"$ac_compile\"") >&5 -+ if { (eval echo "$as_me:12430: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:11438: \$? = $ac_status" >&5 -+ echo "$as_me:12433: \$? = $ac_status" >&5 - (exit $ac_status); }; then -- test -n "$verbose" && echo "$as_me:11440: result: ... -$cf_opt" >&5 -+ test -n "$verbose" && echo "$as_me:12435: result: ... -$cf_opt" >&5 - echo "${ECHO_T}... -$cf_opt" >&6 - case $cf_opt in #(vi - Wcast-qual) #(vi -@@ -11448,7 +12443,17 @@ - [34].*) - test -n "$verbose" && echo " feature is broken in gcc $GCC_VERSION" 1>&6 - --echo "${as_me:-configure}:11451: testing feature is broken in gcc $GCC_VERSION ..." 1>&5 -+echo "${as_me:-configure}:12446: testing feature is broken in gcc $GCC_VERSION ..." 1>&5 -+ -+ continue;; -+ esac -+ ;; -+ Wpointer-arith) #(vi -+ case $GCC_VERSION in -+ [12].*) -+ test -n "$verbose" && echo " feature is broken in gcc $GCC_VERSION" 1>&6 -+ -+echo "${as_me:-configure}:12456: testing feature is broken in gcc $GCC_VERSION ..." 1>&5 - - continue;; - esac -@@ -11461,19 +12466,19 @@ - fi - rm -rf conftest* - -- if test "$cf_with_cxx" = yes ; then -+ if test "x$cf_with_cxx" = xyes ; then - - INTEL_CPLUSPLUS=no - - if test "$GCC" = yes ; then - case $host_os in - linux*|gnu*) -- echo "$as_me:11471: checking if this is really Intel C++ compiler" >&5 -+ echo "$as_me:12476: checking if this is really Intel C++ compiler" >&5 - echo $ECHO_N "checking if this is really Intel C++ compiler... $ECHO_C" >&6 - cf_save_CFLAGS="$CXXFLAGS" - CXXFLAGS="$CXXFLAGS -no-gcc" - cat >conftest.$ac_ext <<_ACEOF --#line 11476 "configure" -+#line 12481 "configure" - #include "confdefs.h" - - int -@@ -11490,16 +12495,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:11493: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:12498: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:11496: \$? = $ac_status" >&5 -+ echo "$as_me:12501: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:11499: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:12504: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:11502: \$? = $ac_status" >&5 -+ echo "$as_me:12507: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - INTEL_CPLUSPLUS=yes - cf_save_CFLAGS="$cf_save_CFLAGS -we147 -no-gcc" -@@ -11510,12 +12515,61 @@ - fi - rm -f conftest.$ac_objext conftest.$ac_ext - CXXFLAGS="$cf_save_CFLAGS" -- echo "$as_me:11513: result: $INTEL_CPLUSPLUS" >&5 -+ echo "$as_me:12518: result: $INTEL_CPLUSPLUS" >&5 - echo "${ECHO_T}$INTEL_CPLUSPLUS" >&6 - ;; - esac - fi - -+CLANG_CPLUSPLUS=no -+ -+if test "$GCC" = yes ; then -+ echo "$as_me:12527: checking if this is really Clang C++ compiler" >&5 -+echo $ECHO_N "checking if this is really Clang C++ compiler... $ECHO_C" >&6 -+ cf_save_CFLAGS="$CXXFLAGS" -+ CXXFLAGS="$CXXFLAGS -Qunused-arguments" -+ cat >conftest.$ac_ext <<_ACEOF -+#line 12532 "configure" -+#include "confdefs.h" -+ -+int -+main () -+{ -+ -+#ifdef __clang__ -+#else -+make an error -+#endif -+ -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:12549: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>&5 -+ ac_status=$? -+ echo "$as_me:12552: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:12555: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:12558: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ CLANG_CPLUSPLUS=yes -+cf_save_CFLAGS="$cf_save_CFLAGS -Qunused-arguments" -+ -+else -+ echo "$as_me: failed program was:" >&5 -+cat conftest.$ac_ext >&5 -+fi -+rm -f conftest.$ac_objext conftest.$ac_ext -+ CXXFLAGS="$cf_save_CFLAGS" -+ echo "$as_me:12569: result: $CLANG_CPLUSPLUS" >&5 -+echo "${ECHO_T}$CLANG_CPLUSPLUS" >&6 -+fi -+ - ac_ext=cc - ac_cpp='$CXXCPP $CPPFLAGS' - ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -@@ -11524,7 +12578,7 @@ - ac_main_return=return - - cat > conftest.$ac_ext <&5 -+ { echo "$as_me:12599: checking for $CC warning options..." >&5 - echo "$as_me: checking for $CC warning options..." >&6;} - cf_save_CXXFLAGS="$CXXFLAGS" - EXTRA_CXXFLAGS="-Wall" -@@ -11559,12 +12613,12 @@ - wd981 - do - CXXFLAGS="$cf_save_CXXFLAGS $EXTRA_CXXFLAGS -$cf_opt" -- if { (eval echo "$as_me:11562: \"$ac_compile\"") >&5 -+ if { (eval echo "$as_me:12616: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:11565: \$? = $ac_status" >&5 -+ echo "$as_me:12619: \$? = $ac_status" >&5 - (exit $ac_status); }; then -- test -n "$verbose" && echo "$as_me:11567: result: ... -$cf_opt" >&5 -+ test -n "$verbose" && echo "$as_me:12621: result: ... -$cf_opt" >&5 - echo "${ECHO_T}... -$cf_opt" >&6 - EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS -$cf_opt" - fi -@@ -11573,7 +12627,7 @@ - - elif test "$GXX" = yes - then -- { echo "$as_me:11576: checking for $CXX warning options..." >&5 -+ { echo "$as_me:12630: checking for $CXX warning options..." >&5 - echo "$as_me: checking for $CXX warning options..." >&6;} - cf_save_CXXFLAGS="$CXXFLAGS" - EXTRA_CXXFLAGS="-W -Wall" -@@ -11589,29 +12643,30 @@ - for cf_opt in \ - Wabi \ - fabi-version=0 \ -+ Wextra \ -+ Wignored-qualifiers \ -+ Wlogical-op \ - Woverloaded-virtual \ - Wsign-promo \ - Wsynth \ - Wold-style-cast \ - Wcast-align \ - Wcast-qual \ -- Wmissing-prototypes \ - Wpointer-arith \ - Wshadow \ -- Wstrict-prototypes \ - Wundef $cf_gxx_extra_warnings Wno-unused - do - CXXFLAGS="$cf_save_CXXFLAGS $EXTRA_CXXFLAGS -Werror -$cf_opt" -- if { (eval echo "$as_me:11605: \"$ac_compile\"") >&5 -+ if { (eval echo "$as_me:12660: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:11608: \$? = $ac_status" >&5 -+ echo "$as_me:12663: \$? = $ac_status" >&5 - (exit $ac_status); }; then -- test -n "$verbose" && echo "$as_me:11610: result: ... -$cf_opt" >&5 -+ test -n "$verbose" && echo "$as_me:12665: result: ... -$cf_opt" >&5 - echo "${ECHO_T}... -$cf_opt" >&6 - EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS -$cf_opt" - else -- test -n "$verbose" && echo "$as_me:11614: result: ... no -$cf_opt" >&5 -+ test -n "$verbose" && echo "$as_me:12669: result: ... no -$cf_opt" >&5 - echo "${ECHO_T}... no -$cf_opt" >&6 - fi - done -@@ -11647,10 +12702,10 @@ - EOF - if test "$GCC" = yes - then -- { echo "$as_me:11650: checking for $CC __attribute__ directives..." >&5 -+ { echo "$as_me:12705: checking for $CC __attribute__ directives..." >&5 - echo "$as_me: checking for $CC __attribute__ directives..." >&6;} - cat > conftest.$ac_ext <&5 -+ if { (eval echo "$as_me:12757: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:11705: \$? = $ac_status" >&5 -+ echo "$as_me:12760: \$? = $ac_status" >&5 - (exit $ac_status); }; then -- test -n "$verbose" && echo "$as_me:11707: result: ... $cf_attribute" >&5 -+ test -n "$verbose" && echo "$as_me:12762: result: ... $cf_attribute" >&5 - echo "${ECHO_T}... $cf_attribute" >&6 - cat conftest.h >>confdefs.h - case $cf_attribute in #(vi -- printf) #(vi -- if test "$cf_printf_attribute" = no ; then -- cat >>confdefs.h <>confdefs.h <>confdefs.h <>confdefs.h <<\EOF -+#define GCC_PRINTF 1 - EOF -+ - fi -+ -+cat >>confdefs.h <>confdefs.h <>confdefs.h <>confdefs.h <<\EOF -+#define GCC_SCANF 1 - EOF -+ - fi -+ -+cat >>confdefs.h <>confdefs.h <>confdefs.h -+ fgrep define conftest.i >>confdefs.h -+fi -+rm -rf conftest* -+fi -+ -+echo "$as_me:12821: checking if you want to work around bogus compiler/loader warnings" >&5 -+echo $ECHO_N "checking if you want to work around bogus compiler/loader warnings... $ECHO_C" >&6 -+ -+# Check whether --enable-string-hacks or --disable-string-hacks was given. -+if test "${enable_string_hacks+set}" = set; then -+ enableval="$enable_string_hacks" -+ with_string_hacks=$enableval -+else -+ with_string_hacks=no -+fi; -+echo "$as_me:12831: result: $with_string_hacks" >&5 -+echo "${ECHO_T}$with_string_hacks" >&6 -+ -+if test "x$with_string_hacks" = "xyes"; then -+ -+cat >>confdefs.h <<\EOF -+#define USE_STRING_HACKS 1 -+EOF -+ -+ { echo "$as_me:12840: WARNING: enabling string-hacks to work around bogus compiler/loader warnings" >&5 -+echo "$as_me: WARNING: enabling string-hacks to work around bogus compiler/loader warnings" >&2;} -+ -+for ac_func in strlcat strlcpy snprintf -+do -+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -+echo "$as_me:12846: checking for $ac_func" >&5 -+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 -+if eval "test \"\${$as_ac_var+set}\" = set"; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ cat >conftest.$ac_ext <<_ACEOF -+#line 12852 "configure" -+#include "confdefs.h" -+/* System header to define __stub macros and hopefully few prototypes, -+ which can conflict with char $ac_func (); below. */ -+#include -+/* Override any gcc2 internal prototype to avoid an error. */ -+#ifdef __cplusplus -+extern "C" -+#endif -+/* We use char because int might match the return type of a gcc2 -+ builtin and then its argument prototype would still apply. */ -+char $ac_func (); -+char (*f) (); -+ -+int -+main () -+{ -+/* The GNU C library defines this for functions which it implements -+ to always fail with ENOSYS. Some functions are actually named -+ something starting with __ and the normal name is an alias. */ -+#if defined (__stub_$ac_func) || defined (__stub___$ac_func) -+choke me -+#else -+f = $ac_func; /* workaround for ICC 12.0.3 */ if (f == 0) return 1; -+#endif -+ -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext conftest$ac_exeext -+if { (eval echo "$as_me:12883: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>&5 -+ ac_status=$? -+ echo "$as_me:12886: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -s conftest$ac_exeext' -+ { (eval echo "$as_me:12889: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:12892: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ eval "$as_ac_var=yes" -+else -+ echo "$as_me: failed program was:" >&5 -+cat conftest.$ac_ext >&5 -+eval "$as_ac_var=no" - fi --rm -rf conftest* -+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -+fi -+echo "$as_me:12902: result: `eval echo '${'$as_ac_var'}'`" >&5 -+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 -+if test `eval echo '${'$as_ac_var'}'` = yes; then -+ cat >>confdefs.h <&5 -+echo "$as_me:12915: checking if you want to enable runtime assertions" >&5 - echo $ECHO_N "checking if you want to enable runtime assertions... $ECHO_C" >&6 - - # Check whether --enable-assertions or --disable-assertions was given. -@@ -11750,16 +12922,12 @@ - else - with_assertions=no - fi; --echo "$as_me:11753: result: $with_assertions" >&5 -+echo "$as_me:12925: result: $with_assertions" >&5 - echo "${ECHO_T}$with_assertions" >&6 - if test -n "$GCC" - then - if test "$with_assertions" = no - then -- cat >>confdefs.h <<\EOF --#define NDEBUG 1 --EOF -- - CPPFLAGS="$CPPFLAGS -DNDEBUG" - else - -@@ -11770,13 +12938,14 @@ - - ### use option --disable-leaks to suppress "permanent" leaks, for testing - --echo "$as_me:11773: checking if you want to use dmalloc for testing" >&5 -+echo "$as_me:12941: checking if you want to use dmalloc for testing" >&5 - echo $ECHO_N "checking if you want to use dmalloc for testing... $ECHO_C" >&6 - - # Check whether --with-dmalloc or --without-dmalloc was given. - if test "${with_dmalloc+set}" = set; then - withval="$with_dmalloc" -- cat >>confdefs.h <<\EOF -+ -+cat >>confdefs.h <&5 -+echo "$as_me:12958: result: ${with_dmalloc:-no}" >&5 - echo "${ECHO_T}${with_dmalloc:-no}" >&6 - - case .$with_cflags in #(vi -@@ -11880,23 +13049,23 @@ - esac - - if test "$with_dmalloc" = yes ; then -- echo "$as_me:11883: checking for dmalloc.h" >&5 -+ echo "$as_me:13052: checking for dmalloc.h" >&5 - echo $ECHO_N "checking for dmalloc.h... $ECHO_C" >&6 - if test "${ac_cv_header_dmalloc_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - cat >conftest.$ac_ext <<_ACEOF --#line 11889 "configure" -+#line 13058 "configure" - #include "confdefs.h" - #include - _ACEOF --if { (eval echo "$as_me:11893: \"$ac_cpp conftest.$ac_ext\"") >&5 -+if { (eval echo "$as_me:13062: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 -- echo "$as_me:11899: \$? = $ac_status" >&5 -+ echo "$as_me:13068: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag -@@ -11915,11 +13084,11 @@ - fi - rm -f conftest.err conftest.$ac_ext - fi --echo "$as_me:11918: result: $ac_cv_header_dmalloc_h" >&5 -+echo "$as_me:13087: result: $ac_cv_header_dmalloc_h" >&5 - echo "${ECHO_T}$ac_cv_header_dmalloc_h" >&6 - if test $ac_cv_header_dmalloc_h = yes; then - --echo "$as_me:11922: checking for dmalloc_debug in -ldmalloc" >&5 -+echo "$as_me:13091: checking for dmalloc_debug in -ldmalloc" >&5 - echo $ECHO_N "checking for dmalloc_debug in -ldmalloc... $ECHO_C" >&6 - if test "${ac_cv_lib_dmalloc_dmalloc_debug+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -11927,7 +13096,7 @@ - ac_check_lib_save_LIBS=$LIBS - LIBS="-ldmalloc $LIBS" - cat >conftest.$ac_ext <<_ACEOF --#line 11930 "configure" -+#line 13099 "configure" - #include "confdefs.h" - - /* Override any gcc2 internal prototype to avoid an error. */ -@@ -11946,16 +13115,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:11949: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:13118: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:11952: \$? = $ac_status" >&5 -+ echo "$as_me:13121: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:11955: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:13124: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:11958: \$? = $ac_status" >&5 -+ echo "$as_me:13127: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_dmalloc_dmalloc_debug=yes - else -@@ -11966,7 +13135,7 @@ - rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - LIBS=$ac_check_lib_save_LIBS - fi --echo "$as_me:11969: result: $ac_cv_lib_dmalloc_dmalloc_debug" >&5 -+echo "$as_me:13138: result: $ac_cv_lib_dmalloc_dmalloc_debug" >&5 - echo "${ECHO_T}$ac_cv_lib_dmalloc_dmalloc_debug" >&6 - if test $ac_cv_lib_dmalloc_dmalloc_debug = yes; then - cat >>confdefs.h <&5 -+echo "$as_me:13153: checking if you want to use dbmalloc for testing" >&5 - echo $ECHO_N "checking if you want to use dbmalloc for testing... $ECHO_C" >&6 - - # Check whether --with-dbmalloc or --without-dbmalloc was given. - if test "${with_dbmalloc+set}" = set; then - withval="$with_dbmalloc" -- cat >>confdefs.h <<\EOF -+ -+cat >>confdefs.h <&5 -+echo "$as_me:13170: result: ${with_dbmalloc:-no}" >&5 - echo "${ECHO_T}${with_dbmalloc:-no}" >&6 - - case .$with_cflags in #(vi -@@ -12091,23 +13261,23 @@ - esac - - if test "$with_dbmalloc" = yes ; then -- echo "$as_me:12094: checking for dbmalloc.h" >&5 -+ echo "$as_me:13264: checking for dbmalloc.h" >&5 - echo $ECHO_N "checking for dbmalloc.h... $ECHO_C" >&6 - if test "${ac_cv_header_dbmalloc_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - cat >conftest.$ac_ext <<_ACEOF --#line 12100 "configure" -+#line 13270 "configure" - #include "confdefs.h" - #include - _ACEOF --if { (eval echo "$as_me:12104: \"$ac_cpp conftest.$ac_ext\"") >&5 -+if { (eval echo "$as_me:13274: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 -- echo "$as_me:12110: \$? = $ac_status" >&5 -+ echo "$as_me:13280: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag -@@ -12126,11 +13296,11 @@ - fi - rm -f conftest.err conftest.$ac_ext - fi --echo "$as_me:12129: result: $ac_cv_header_dbmalloc_h" >&5 -+echo "$as_me:13299: result: $ac_cv_header_dbmalloc_h" >&5 - echo "${ECHO_T}$ac_cv_header_dbmalloc_h" >&6 - if test $ac_cv_header_dbmalloc_h = yes; then - --echo "$as_me:12133: checking for debug_malloc in -ldbmalloc" >&5 -+echo "$as_me:13303: checking for debug_malloc in -ldbmalloc" >&5 - echo $ECHO_N "checking for debug_malloc in -ldbmalloc... $ECHO_C" >&6 - if test "${ac_cv_lib_dbmalloc_debug_malloc+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -12138,7 +13308,7 @@ - ac_check_lib_save_LIBS=$LIBS - LIBS="-ldbmalloc $LIBS" - cat >conftest.$ac_ext <<_ACEOF --#line 12141 "configure" -+#line 13311 "configure" - #include "confdefs.h" - - /* Override any gcc2 internal prototype to avoid an error. */ -@@ -12157,16 +13327,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:12160: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:13330: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:12163: \$? = $ac_status" >&5 -+ echo "$as_me:13333: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:12166: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:13336: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:12169: \$? = $ac_status" >&5 -+ echo "$as_me:13339: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_dbmalloc_debug_malloc=yes - else -@@ -12177,7 +13347,7 @@ - rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - LIBS=$ac_check_lib_save_LIBS - fi --echo "$as_me:12180: result: $ac_cv_lib_dbmalloc_debug_malloc" >&5 -+echo "$as_me:13350: result: $ac_cv_lib_dbmalloc_debug_malloc" >&5 - echo "${ECHO_T}$ac_cv_lib_dbmalloc_debug_malloc" >&6 - if test $ac_cv_lib_dbmalloc_debug_malloc = yes; then - cat >>confdefs.h <&5 -+echo "$as_me:13365: checking if you want to use valgrind for testing" >&5 - echo $ECHO_N "checking if you want to use valgrind for testing... $ECHO_C" >&6 - - # Check whether --with-valgrind or --without-valgrind was given. - if test "${with_valgrind+set}" = set; then - withval="$with_valgrind" -- cat >>confdefs.h <<\EOF -+ -+cat >>confdefs.h <&5 -+echo "$as_me:13382: result: ${with_valgrind:-no}" >&5 - echo "${ECHO_T}${with_valgrind:-no}" >&6 - - case .$with_cflags in #(vi -@@ -12301,7 +13472,7 @@ - ;; - esac - --echo "$as_me:12304: checking if you want to perform memory-leak testing" >&5 -+echo "$as_me:13475: checking if you want to perform memory-leak testing" >&5 - echo $ECHO_N "checking if you want to perform memory-leak testing... $ECHO_C" >&6 - - # Check whether --enable-leaks or --disable-leaks was given. -@@ -12311,15 +13482,16 @@ - else - : ${with_no_leaks:=no} - fi; --echo "$as_me:12314: result: $with_no_leaks" >&5 -+echo "$as_me:13485: result: $with_no_leaks" >&5 - echo "${ECHO_T}$with_no_leaks" >&6 - - if test "$with_no_leaks" = yes ; then -- cat >>confdefs.h <<\EOF -+ -+cat >>confdefs.h <<\EOF - #define NO_LEAKS 1 - EOF - -- cat >>confdefs.h <<\EOF -+cat >>confdefs.h <<\EOF - #define YY_NO_LEAKS 1 - EOF - -@@ -12334,7 +13506,8 @@ - # Check whether --enable-expanded or --disable-expanded was given. - if test "${enable_expanded+set}" = set; then - enableval="$enable_expanded" -- test "$enableval" = yes && cat >>confdefs.h <<\EOF -+ test "x$enableval" = xyes && -+cat >>confdefs.h <<\EOF - #define NCURSES_EXPANDED 1 - EOF - -@@ -12345,7 +13518,8 @@ - # Check whether --enable-macros or --disable-macros was given. - if test "${enable_macros+set}" = set; then - enableval="$enable_macros" -- test "$enableval" = no && cat >>confdefs.h <<\EOF -+ test "$enableval" = no && -+cat >>confdefs.h <<\EOF - #define NCURSES_NOMACROS 1 - EOF - -@@ -12360,7 +13534,7 @@ - ;; - esac - --echo "$as_me:12363: checking whether to add trace feature to all models" >&5 -+echo "$as_me:13537: checking whether to add trace feature to all models" >&5 - echo $ECHO_N "checking whether to add trace feature to all models... $ECHO_C" >&6 - - # Check whether --with-trace or --without-trace was given. -@@ -12370,10 +13544,10 @@ - else - cf_with_trace=$cf_all_traces - fi; --echo "$as_me:12373: result: $cf_with_trace" >&5 -+echo "$as_me:13547: result: $cf_with_trace" >&5 - echo "${ECHO_T}$cf_with_trace" >&6 - --if test "$cf_with_trace" = yes ; then -+if test "x$cf_with_trace" = xyes ; then - LIB_TRACING=all - ADA_TRACE=TRUE - -@@ -12465,13 +13639,13 @@ - *mingw32*) #(vi - ;; - *) --echo "$as_me:12468: checking for gettimeofday" >&5 -+echo "$as_me:13642: checking for gettimeofday" >&5 - echo $ECHO_N "checking for gettimeofday... $ECHO_C" >&6 - if test "${ac_cv_func_gettimeofday+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - cat >conftest.$ac_ext <<_ACEOF --#line 12474 "configure" -+#line 13648 "configure" - #include "confdefs.h" - /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char gettimeofday (); below. */ -@@ -12494,7 +13668,7 @@ - #if defined (__stub_gettimeofday) || defined (__stub___gettimeofday) - choke me - #else --f = gettimeofday; -+f = gettimeofday; /* workaround for ICC 12.0.3 */ if (f == 0) return 1; - #endif - - ; -@@ -12502,16 +13676,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:12505: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:13679: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:12508: \$? = $ac_status" >&5 -+ echo "$as_me:13682: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:12511: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:13685: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:12514: \$? = $ac_status" >&5 -+ echo "$as_me:13688: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_func_gettimeofday=yes - else -@@ -12521,16 +13695,17 @@ - fi - rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - fi --echo "$as_me:12524: result: $ac_cv_func_gettimeofday" >&5 -+echo "$as_me:13698: result: $ac_cv_func_gettimeofday" >&5 - echo "${ECHO_T}$ac_cv_func_gettimeofday" >&6 - if test $ac_cv_func_gettimeofday = yes; then -- cat >>confdefs.h <<\EOF -+ -+cat >>confdefs.h <<\EOF - #define HAVE_GETTIMEOFDAY 1 - EOF - - else - --echo "$as_me:12533: checking for gettimeofday in -lbsd" >&5 -+echo "$as_me:13708: checking for gettimeofday in -lbsd" >&5 - echo $ECHO_N "checking for gettimeofday in -lbsd... $ECHO_C" >&6 - if test "${ac_cv_lib_bsd_gettimeofday+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -12538,7 +13713,7 @@ - ac_check_lib_save_LIBS=$LIBS - LIBS="-lbsd $LIBS" - cat >conftest.$ac_ext <<_ACEOF --#line 12541 "configure" -+#line 13716 "configure" - #include "confdefs.h" - - /* Override any gcc2 internal prototype to avoid an error. */ -@@ -12557,16 +13732,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:12560: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:13735: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:12563: \$? = $ac_status" >&5 -+ echo "$as_me:13738: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:12566: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:13741: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:12569: \$? = $ac_status" >&5 -+ echo "$as_me:13744: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_bsd_gettimeofday=yes - else -@@ -12577,10 +13752,11 @@ - rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - LIBS=$ac_check_lib_save_LIBS - fi --echo "$as_me:12580: result: $ac_cv_lib_bsd_gettimeofday" >&5 -+echo "$as_me:13755: result: $ac_cv_lib_bsd_gettimeofday" >&5 - echo "${ECHO_T}$ac_cv_lib_bsd_gettimeofday" >&6 - if test $ac_cv_lib_bsd_gettimeofday = yes; then -- cat >>confdefs.h <<\EOF -+ -+cat >>confdefs.h <<\EOF - #define HAVE_GETTIMEOFDAY 1 - EOF - -@@ -12591,14 +13767,14 @@ - ;; - esac - --echo "$as_me:12594: checking if -lm needed for math functions" >&5 -+echo "$as_me:13770: checking if -lm needed for math functions" >&5 - echo $ECHO_N "checking if -lm needed for math functions... $ECHO_C" >&6 - if test "${cf_cv_need_libm+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - - cat >conftest.$ac_ext <<_ACEOF --#line 12601 "configure" -+#line 13777 "configure" - #include "confdefs.h" - - #include -@@ -12607,22 +13783,22 @@ - int - main () - { --double x = rand(); printf("result = %g\n", sin(x)) -+double x = rand(); printf("result = %g\n", pow(sin(x),x)) - ; - return 0; - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:12616: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:13792: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:12619: \$? = $ac_status" >&5 -+ echo "$as_me:13795: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:12622: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:13798: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:12625: \$? = $ac_status" >&5 -+ echo "$as_me:13801: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_cv_need_libm=no - else -@@ -12632,7 +13808,7 @@ - fi - rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - fi --echo "$as_me:12635: result: $cf_cv_need_libm" >&5 -+echo "$as_me:13811: result: $cf_cv_need_libm" >&5 - echo "${ECHO_T}$cf_cv_need_libm" >&6 - if test "$cf_cv_need_libm" = yes - then -@@ -12640,13 +13816,13 @@ - fi - - ### Checks for header files. --echo "$as_me:12643: checking for ANSI C header files" >&5 -+echo "$as_me:13819: checking for ANSI C header files" >&5 - echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 - if test "${ac_cv_header_stdc+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - cat >conftest.$ac_ext <<_ACEOF --#line 12649 "configure" -+#line 13825 "configure" - #include "confdefs.h" - #include - #include -@@ -12654,13 +13830,13 @@ - #include - - _ACEOF --if { (eval echo "$as_me:12657: \"$ac_cpp conftest.$ac_ext\"") >&5 -+if { (eval echo "$as_me:13833: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 -- echo "$as_me:12663: \$? = $ac_status" >&5 -+ echo "$as_me:13839: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag -@@ -12682,7 +13858,7 @@ - if test $ac_cv_header_stdc = yes; then - # SunOS 4.x string.h does not declare mem*, contrary to ANSI. - cat >conftest.$ac_ext <<_ACEOF --#line 12685 "configure" -+#line 13861 "configure" - #include "confdefs.h" - #include - -@@ -12700,7 +13876,7 @@ - if test $ac_cv_header_stdc = yes; then - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. - cat >conftest.$ac_ext <<_ACEOF --#line 12703 "configure" -+#line 13879 "configure" - #include "confdefs.h" - #include - -@@ -12721,7 +13897,7 @@ - : - else - cat >conftest.$ac_ext <<_ACEOF --#line 12724 "configure" -+#line 13900 "configure" - #include "confdefs.h" - #include - #if ((' ' & 0x0FF) == 0x020) -@@ -12747,15 +13923,15 @@ - } - _ACEOF - rm -f conftest$ac_exeext --if { (eval echo "$as_me:12750: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:13926: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:12753: \$? = $ac_status" >&5 -+ echo "$as_me:13929: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' -- { (eval echo "$as_me:12755: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:13931: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:12758: \$? = $ac_status" >&5 -+ echo "$as_me:13934: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : - else -@@ -12768,7 +13944,7 @@ - fi - fi - fi --echo "$as_me:12771: result: $ac_cv_header_stdc" >&5 -+echo "$as_me:13947: result: $ac_cv_header_stdc" >&5 - echo "${ECHO_T}$ac_cv_header_stdc" >&6 - if test $ac_cv_header_stdc = yes; then - -@@ -12781,13 +13957,13 @@ - ac_header_dirent=no - for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do - as_ac_Header=`echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh` --echo "$as_me:12784: checking for $ac_hdr that defines DIR" >&5 -+echo "$as_me:13960: checking for $ac_hdr that defines DIR" >&5 - echo $ECHO_N "checking for $ac_hdr that defines DIR... $ECHO_C" >&6 - if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - cat >conftest.$ac_ext <<_ACEOF --#line 12790 "configure" -+#line 13966 "configure" - #include "confdefs.h" - #include - #include <$ac_hdr> -@@ -12802,16 +13978,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:12805: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:13981: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:12808: \$? = $ac_status" >&5 -+ echo "$as_me:13984: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:12811: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:13987: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:12814: \$? = $ac_status" >&5 -+ echo "$as_me:13990: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - eval "$as_ac_Header=yes" - else -@@ -12821,7 +13997,7 @@ - fi - rm -f conftest.$ac_objext conftest.$ac_ext - fi --echo "$as_me:12824: result: `eval echo '${'$as_ac_Header'}'`" >&5 -+echo "$as_me:14000: result: `eval echo '${'$as_ac_Header'}'`" >&5 - echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 - if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <&5 -+ echo "$as_me:14013: checking for opendir in -ldir" >&5 - echo $ECHO_N "checking for opendir in -ldir... $ECHO_C" >&6 - if test "${ac_cv_lib_dir_opendir+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -12842,7 +14018,7 @@ - ac_check_lib_save_LIBS=$LIBS - LIBS="-ldir $LIBS" - cat >conftest.$ac_ext <<_ACEOF --#line 12845 "configure" -+#line 14021 "configure" - #include "confdefs.h" - - /* Override any gcc2 internal prototype to avoid an error. */ -@@ -12861,16 +14037,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:12864: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:14040: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:12867: \$? = $ac_status" >&5 -+ echo "$as_me:14043: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:12870: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:14046: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:12873: \$? = $ac_status" >&5 -+ echo "$as_me:14049: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_dir_opendir=yes - else -@@ -12881,14 +14057,14 @@ - rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - LIBS=$ac_check_lib_save_LIBS - fi --echo "$as_me:12884: result: $ac_cv_lib_dir_opendir" >&5 -+echo "$as_me:14060: result: $ac_cv_lib_dir_opendir" >&5 - echo "${ECHO_T}$ac_cv_lib_dir_opendir" >&6 - if test $ac_cv_lib_dir_opendir = yes; then - LIBS="$LIBS -ldir" - fi - - else -- echo "$as_me:12891: checking for opendir in -lx" >&5 -+ echo "$as_me:14067: checking for opendir in -lx" >&5 - echo $ECHO_N "checking for opendir in -lx... $ECHO_C" >&6 - if test "${ac_cv_lib_x_opendir+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -12896,7 +14072,7 @@ - ac_check_lib_save_LIBS=$LIBS - LIBS="-lx $LIBS" - cat >conftest.$ac_ext <<_ACEOF --#line 12899 "configure" -+#line 14075 "configure" - #include "confdefs.h" - - /* Override any gcc2 internal prototype to avoid an error. */ -@@ -12915,16 +14091,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:12918: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:14094: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:12921: \$? = $ac_status" >&5 -+ echo "$as_me:14097: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:12924: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:14100: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:12927: \$? = $ac_status" >&5 -+ echo "$as_me:14103: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_x_opendir=yes - else -@@ -12935,7 +14111,7 @@ - rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - LIBS=$ac_check_lib_save_LIBS - fi --echo "$as_me:12938: result: $ac_cv_lib_x_opendir" >&5 -+echo "$as_me:14114: result: $ac_cv_lib_x_opendir" >&5 - echo "${ECHO_T}$ac_cv_lib_x_opendir" >&6 - if test $ac_cv_lib_x_opendir = yes; then - LIBS="$LIBS -lx" -@@ -12943,13 +14119,13 @@ - - fi - --echo "$as_me:12946: checking whether time.h and sys/time.h may both be included" >&5 -+echo "$as_me:14122: checking whether time.h and sys/time.h may both be included" >&5 - echo $ECHO_N "checking whether time.h and sys/time.h may both be included... $ECHO_C" >&6 - if test "${ac_cv_header_time+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - cat >conftest.$ac_ext <<_ACEOF --#line 12952 "configure" -+#line 14128 "configure" - #include "confdefs.h" - #include - #include -@@ -12965,16 +14141,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:12968: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:14144: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:12971: \$? = $ac_status" >&5 -+ echo "$as_me:14147: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:12974: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:14150: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:12977: \$? = $ac_status" >&5 -+ echo "$as_me:14153: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_header_time=yes - else -@@ -12984,7 +14160,7 @@ - fi - rm -f conftest.$ac_objext conftest.$ac_ext - fi --echo "$as_me:12987: result: $ac_cv_header_time" >&5 -+echo "$as_me:14163: result: $ac_cv_header_time" >&5 - echo "${ECHO_T}$ac_cv_header_time" >&6 - if test $ac_cv_header_time = yes; then - -@@ -12999,17 +14175,17 @@ - cf_regex_libs="regex re" - case $host_os in #(vi - mingw*) -- cf_regex_libs="regex.dll $cf_regex_libs" -+ cf_regex_libs="gnurx $cf_regex_libs" - ;; - esac - --echo "$as_me:13006: checking for regcomp" >&5 -+echo "$as_me:14182: checking for regcomp" >&5 - echo $ECHO_N "checking for regcomp... $ECHO_C" >&6 - if test "${ac_cv_func_regcomp+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - cat >conftest.$ac_ext <<_ACEOF --#line 13012 "configure" -+#line 14188 "configure" - #include "confdefs.h" - /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char regcomp (); below. */ -@@ -13032,7 +14208,7 @@ - #if defined (__stub_regcomp) || defined (__stub___regcomp) - choke me - #else --f = regcomp; -+f = regcomp; /* workaround for ICC 12.0.3 */ if (f == 0) return 1; - #endif - - ; -@@ -13040,16 +14216,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:13043: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:14219: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:13046: \$? = $ac_status" >&5 -+ echo "$as_me:14222: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:13049: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:14225: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:13052: \$? = $ac_status" >&5 -+ echo "$as_me:14228: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_func_regcomp=yes - else -@@ -13059,7 +14235,7 @@ - fi - rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - fi --echo "$as_me:13062: result: $ac_cv_func_regcomp" >&5 -+echo "$as_me:14238: result: $ac_cv_func_regcomp" >&5 - echo "${ECHO_T}$ac_cv_func_regcomp" >&6 - if test $ac_cv_func_regcomp = yes; then - cf_regex_func=regcomp -@@ -13068,7 +14244,7 @@ - for cf_regex_lib in $cf_regex_libs - do - as_ac_Lib=`echo "ac_cv_lib_$cf_regex_lib''_regcomp" | $as_tr_sh` --echo "$as_me:13071: checking for regcomp in -l$cf_regex_lib" >&5 -+echo "$as_me:14247: checking for regcomp in -l$cf_regex_lib" >&5 - echo $ECHO_N "checking for regcomp in -l$cf_regex_lib... $ECHO_C" >&6 - if eval "test \"\${$as_ac_Lib+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -13076,7 +14252,7 @@ - ac_check_lib_save_LIBS=$LIBS - LIBS="-l$cf_regex_lib $LIBS" - cat >conftest.$ac_ext <<_ACEOF --#line 13079 "configure" -+#line 14255 "configure" - #include "confdefs.h" - - /* Override any gcc2 internal prototype to avoid an error. */ -@@ -13095,16 +14271,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:13098: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:14274: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:13101: \$? = $ac_status" >&5 -+ echo "$as_me:14277: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:13104: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:14280: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:13107: \$? = $ac_status" >&5 -+ echo "$as_me:14283: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - eval "$as_ac_Lib=yes" - else -@@ -13115,7 +14291,7 @@ - rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - LIBS=$ac_check_lib_save_LIBS - fi --echo "$as_me:13118: result: `eval echo '${'$as_ac_Lib'}'`" >&5 -+echo "$as_me:14294: result: `eval echo '${'$as_ac_Lib'}'`" >&5 - echo "${ECHO_T}`eval echo '${'$as_ac_Lib'}'`" >&6 - if test `eval echo '${'$as_ac_Lib'}'` = yes; then - -@@ -13129,13 +14305,13 @@ - fi - - if test "$cf_regex_func" = no ; then -- echo "$as_me:13132: checking for compile" >&5 -+ echo "$as_me:14308: checking for compile" >&5 - echo $ECHO_N "checking for compile... $ECHO_C" >&6 - if test "${ac_cv_func_compile+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - cat >conftest.$ac_ext <<_ACEOF --#line 13138 "configure" -+#line 14314 "configure" - #include "confdefs.h" - /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char compile (); below. */ -@@ -13158,7 +14334,7 @@ - #if defined (__stub_compile) || defined (__stub___compile) - choke me - #else --f = compile; -+f = compile; /* workaround for ICC 12.0.3 */ if (f == 0) return 1; - #endif - - ; -@@ -13166,16 +14342,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:13169: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:14345: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:13172: \$? = $ac_status" >&5 -+ echo "$as_me:14348: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:13175: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:14351: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:13178: \$? = $ac_status" >&5 -+ echo "$as_me:14354: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_func_compile=yes - else -@@ -13185,13 +14361,13 @@ - fi - rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - fi --echo "$as_me:13188: result: $ac_cv_func_compile" >&5 -+echo "$as_me:14364: result: $ac_cv_func_compile" >&5 - echo "${ECHO_T}$ac_cv_func_compile" >&6 - if test $ac_cv_func_compile = yes; then - cf_regex_func=compile - else - -- echo "$as_me:13194: checking for compile in -lgen" >&5 -+ echo "$as_me:14370: checking for compile in -lgen" >&5 - echo $ECHO_N "checking for compile in -lgen... $ECHO_C" >&6 - if test "${ac_cv_lib_gen_compile+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -13199,7 +14375,7 @@ - ac_check_lib_save_LIBS=$LIBS - LIBS="-lgen $LIBS" - cat >conftest.$ac_ext <<_ACEOF --#line 13202 "configure" -+#line 14378 "configure" - #include "confdefs.h" - - /* Override any gcc2 internal prototype to avoid an error. */ -@@ -13218,16 +14394,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:13221: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:14397: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:13224: \$? = $ac_status" >&5 -+ echo "$as_me:14400: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:13227: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:14403: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:13230: \$? = $ac_status" >&5 -+ echo "$as_me:14406: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_gen_compile=yes - else -@@ -13238,7 +14414,7 @@ - rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - LIBS=$ac_check_lib_save_LIBS - fi --echo "$as_me:13241: result: $ac_cv_lib_gen_compile" >&5 -+echo "$as_me:14417: result: $ac_cv_lib_gen_compile" >&5 - echo "${ECHO_T}$ac_cv_lib_gen_compile" >&6 - if test $ac_cv_lib_gen_compile = yes; then - -@@ -13251,11 +14427,11 @@ - fi - - if test "$cf_regex_func" = no ; then -- { echo "$as_me:13254: WARNING: cannot find regular expression library" >&5 -+ { echo "$as_me:14430: WARNING: cannot find regular expression library" >&5 - echo "$as_me: WARNING: cannot find regular expression library" >&2;} - fi - --echo "$as_me:13258: checking for regular-expression headers" >&5 -+echo "$as_me:14434: checking for regular-expression headers" >&5 - echo $ECHO_N "checking for regular-expression headers... $ECHO_C" >&6 - if test "${cf_cv_regex_hdrs+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -13267,7 +14443,7 @@ - for cf_regex_hdr in regexp.h regexpr.h - do - cat >conftest.$ac_ext <<_ACEOF --#line 13270 "configure" -+#line 14446 "configure" - #include "confdefs.h" - #include <$cf_regex_hdr> - int -@@ -13282,16 +14458,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:13285: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:14461: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:13288: \$? = $ac_status" >&5 -+ echo "$as_me:14464: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:13291: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:14467: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:13294: \$? = $ac_status" >&5 -+ echo "$as_me:14470: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - - cf_cv_regex_hdrs=$cf_regex_hdr -@@ -13308,7 +14484,7 @@ - for cf_regex_hdr in regex.h - do - cat >conftest.$ac_ext <<_ACEOF --#line 13311 "configure" -+#line 14487 "configure" - #include "confdefs.h" - #include - #include <$cf_regex_hdr> -@@ -13326,16 +14502,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:13329: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:14505: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:13332: \$? = $ac_status" >&5 -+ echo "$as_me:14508: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:13335: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:14511: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:13338: \$? = $ac_status" >&5 -+ echo "$as_me:14514: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - - cf_cv_regex_hdrs=$cf_regex_hdr -@@ -13351,21 +14527,24 @@ - esac - - fi --echo "$as_me:13354: result: $cf_cv_regex_hdrs" >&5 -+echo "$as_me:14530: result: $cf_cv_regex_hdrs" >&5 - echo "${ECHO_T}$cf_cv_regex_hdrs" >&6 - - case $cf_cv_regex_hdrs in #(vi -- no) { echo "$as_me:13358: WARNING: no regular expression header found" >&5 -+ no) { echo "$as_me:14534: WARNING: no regular expression header found" >&5 - echo "$as_me: WARNING: no regular expression header found" >&2;} ;; #(vi -- regex.h) cat >>confdefs.h <<\EOF -+ regex.h) -+cat >>confdefs.h <<\EOF - #define HAVE_REGEX_H_FUNCS 1 - EOF - ;; #(vi -- regexp.h) cat >>confdefs.h <<\EOF -+ regexp.h) -+cat >>confdefs.h <<\EOF - #define HAVE_REGEXP_H_FUNCS 1 - EOF - ;; #(vi -- regexpr.h) cat >>confdefs.h <<\EOF -+ regexpr.h) -+cat >>confdefs.h <<\EOF - #define HAVE_REGEXPR_H_FUNCS 1 - EOF - ;; -@@ -13391,23 +14570,71 @@ - - do - as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` --echo "$as_me:13394: checking for $ac_header" >&5 -+echo "$as_me:14573: checking for $ac_header" >&5 -+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -+if eval "test \"\${$as_ac_Header+set}\" = set"; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ cat >conftest.$ac_ext <<_ACEOF -+#line 14579 "configure" -+#include "confdefs.h" -+#include <$ac_header> -+_ACEOF -+if { (eval echo "$as_me:14583: \"$ac_cpp conftest.$ac_ext\"") >&5 -+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 -+ ac_status=$? -+ egrep -v '^ *\+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 -+ echo "$as_me:14589: \$? = $ac_status" >&5 -+ (exit $ac_status); } >/dev/null; then -+ if test -s conftest.err; then -+ ac_cpp_err=$ac_c_preproc_warn_flag -+ else -+ ac_cpp_err= -+ fi -+else -+ ac_cpp_err=yes -+fi -+if test -z "$ac_cpp_err"; then -+ eval "$as_ac_Header=yes" -+else -+ echo "$as_me: failed program was:" >&5 -+ cat conftest.$ac_ext >&5 -+ eval "$as_ac_Header=no" -+fi -+rm -f conftest.err conftest.$ac_ext -+fi -+echo "$as_me:14608: result: `eval echo '${'$as_ac_Header'}'`" >&5 -+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -+if test `eval echo '${'$as_ac_Header'}'` = yes; then -+ cat >>confdefs.h <&5 - echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 - if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - cat >conftest.$ac_ext <<_ACEOF --#line 13400 "configure" -+#line 14627 "configure" - #include "confdefs.h" - #include <$ac_header> - _ACEOF --if { (eval echo "$as_me:13404: \"$ac_cpp conftest.$ac_ext\"") >&5 -+if { (eval echo "$as_me:14631: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 -- echo "$as_me:13410: \$? = $ac_status" >&5 -+ echo "$as_me:14637: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag -@@ -13426,7 +14653,7 @@ - fi - rm -f conftest.err conftest.$ac_ext - fi --echo "$as_me:13429: result: `eval echo '${'$as_ac_Header'}'`" >&5 -+echo "$as_me:14656: result: `eval echo '${'$as_ac_Header'}'`" >&5 - echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 - if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <&5 -+echo $ECHO_N "checking for header declaring getopt variables... $ECHO_C" >&6 -+if test "${cf_cv_getopt_header+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ -+cf_cv_getopt_header=none -+for cf_header in stdio.h stdlib.h unistd.h getopt.h -+do -+cat >conftest.$ac_ext <<_ACEOF -+#line 14676 "configure" -+#include "confdefs.h" -+ -+#include <$cf_header> -+int -+main () -+{ -+int x = optind; char *y = optarg -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:14689: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>&5 -+ ac_status=$? -+ echo "$as_me:14692: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:14695: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:14698: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ cf_cv_getopt_header=$cf_header -+ break -+else -+ echo "$as_me: failed program was:" >&5 -+cat conftest.$ac_ext >&5 -+fi -+rm -f conftest.$ac_objext conftest.$ac_ext -+done -+ -+fi -+echo "$as_me:14710: result: $cf_cv_getopt_header" >&5 -+echo "${ECHO_T}$cf_cv_getopt_header" >&6 -+if test $cf_cv_getopt_header != none ; then -+ -+cat >>confdefs.h <<\EOF -+#define HAVE_GETOPT_HEADER 1 -+EOF -+ -+fi -+ - # check for ISC (this may also define _POSIX_SOURCE) - # Note: even non-Posix ISC needs to declare fd_set --if test "$ISC" = yes ; then -+if test "x$ISC" = xyes ; then - --echo "$as_me:13443: checking for main in -lcposix" >&5 -+echo "$as_me:14724: checking for main in -lcposix" >&5 - echo $ECHO_N "checking for main in -lcposix... $ECHO_C" >&6 - if test "${ac_cv_lib_cposix_main+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -13448,7 +14729,7 @@ - ac_check_lib_save_LIBS=$LIBS - LIBS="-lcposix $LIBS" - cat >conftest.$ac_ext <<_ACEOF --#line 13451 "configure" -+#line 14732 "configure" - #include "confdefs.h" - - int -@@ -13460,16 +14741,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:13463: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:14744: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:13466: \$? = $ac_status" >&5 -+ echo "$as_me:14747: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:13469: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:14750: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:13472: \$? = $ac_status" >&5 -+ echo "$as_me:14753: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_cposix_main=yes - else -@@ -13480,7 +14761,7 @@ - rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - LIBS=$ac_check_lib_save_LIBS - fi --echo "$as_me:13483: result: $ac_cv_lib_cposix_main" >&5 -+echo "$as_me:14764: result: $ac_cv_lib_cposix_main" >&5 - echo "${ECHO_T}$ac_cv_lib_cposix_main" >&6 - if test $ac_cv_lib_cposix_main = yes; then - cat >>confdefs.h <&5 -+ echo "$as_me:14775: checking for bzero in -linet" >&5 - echo $ECHO_N "checking for bzero in -linet... $ECHO_C" >&6 - if test "${ac_cv_lib_inet_bzero+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -13499,7 +14780,7 @@ - ac_check_lib_save_LIBS=$LIBS - LIBS="-linet $LIBS" - cat >conftest.$ac_ext <<_ACEOF --#line 13502 "configure" -+#line 14783 "configure" - #include "confdefs.h" - - /* Override any gcc2 internal prototype to avoid an error. */ -@@ -13518,16 +14799,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:13521: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:14802: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:13524: \$? = $ac_status" >&5 -+ echo "$as_me:14805: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:13527: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:14808: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:13530: \$? = $ac_status" >&5 -+ echo "$as_me:14811: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_inet_bzero=yes - else -@@ -13538,21 +14819,21 @@ - rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - LIBS=$ac_check_lib_save_LIBS - fi --echo "$as_me:13541: result: $ac_cv_lib_inet_bzero" >&5 -+echo "$as_me:14822: result: $ac_cv_lib_inet_bzero" >&5 - echo "${ECHO_T}$ac_cv_lib_inet_bzero" >&6 - if test $ac_cv_lib_inet_bzero = yes; then - LIBS="-linet $LIBS" - fi - fi - --echo "$as_me:13548: checking if sys/time.h works with sys/select.h" >&5 -+echo "$as_me:14829: checking if sys/time.h works with sys/select.h" >&5 - echo $ECHO_N "checking if sys/time.h works with sys/select.h... $ECHO_C" >&6 - if test "${cf_cv_sys_time_select+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - - cat >conftest.$ac_ext <<_ACEOF --#line 13555 "configure" -+#line 14836 "configure" - #include "confdefs.h" - - #include -@@ -13572,16 +14853,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:13575: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:14856: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:13578: \$? = $ac_status" >&5 -+ echo "$as_me:14859: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:13581: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:14862: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:13584: \$? = $ac_status" >&5 -+ echo "$as_me:14865: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_cv_sys_time_select=yes - else -@@ -13593,9 +14874,10 @@ - - fi - --echo "$as_me:13596: result: $cf_cv_sys_time_select" >&5 -+echo "$as_me:14877: result: $cf_cv_sys_time_select" >&5 - echo "${ECHO_T}$cf_cv_sys_time_select" >&6 --test "$cf_cv_sys_time_select" = yes && cat >>confdefs.h <<\EOF -+test "$cf_cv_sys_time_select" = yes && -+cat >>confdefs.h <<\EOF - #define HAVE_SYS_TIME_SELECT 1 - EOF - -@@ -13607,104 +14889,13 @@ - ac_compiler_gnu=$ac_cv_c_compiler_gnu - ac_main_return=return - --echo "$as_me:13610: checking for $CC option to accept ANSI C" >&5 --echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 --if test "${ac_cv_prog_cc_stdc+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 --else -- ac_cv_prog_cc_stdc=no --ac_save_CC=$CC --cat >conftest.$ac_ext <<_ACEOF --#line 13618 "configure" --#include "confdefs.h" --#include --#include --#include --#include --/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ --struct buf { int x; }; --FILE * (*rcsopen) (struct buf *, struct stat *, int); --static char *e (p, i) -- char **p; -- int i; --{ -- return p[i]; --} --static char *f (char * (*g) (char **, int), char **p, ...) --{ -- char *s; -- va_list v; -- va_start (v,p); -- s = g (p, va_arg (v,int)); -- va_end (v); -- return s; --} --int test (int i, double x); --struct s1 {int (*f) (int a);}; --struct s2 {int (*f) (double a);}; --int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); --int argc; --char **argv; --int --main () --{ --return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; -- ; -- return 0; --} --_ACEOF --# Don't try gcc -ansi; that turns off useful extensions and --# breaks some systems' header files. --# AIX -qlanglvl=ansi --# Ultrix and OSF/1 -std1 --# HP-UX 10.20 and later -Ae --# HP-UX older versions -Aa -D_HPUX_SOURCE --# SVR4 -Xc -D__EXTENSIONS__ --for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" --do -- CC="$ac_save_CC $ac_arg" -- rm -f conftest.$ac_objext --if { (eval echo "$as_me:13667: \"$ac_compile\"") >&5 -- (eval $ac_compile) 2>&5 -- ac_status=$? -- echo "$as_me:13670: \$? = $ac_status" >&5 -- (exit $ac_status); } && -- { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:13673: \"$ac_try\"") >&5 -- (eval $ac_try) 2>&5 -- ac_status=$? -- echo "$as_me:13676: \$? = $ac_status" >&5 -- (exit $ac_status); }; }; then -- ac_cv_prog_cc_stdc=$ac_arg --break --else -- echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 --fi --rm -f conftest.$ac_objext --done --rm -f conftest.$ac_ext conftest.$ac_objext --CC=$ac_save_CC -- --fi -- --case "x$ac_cv_prog_cc_stdc" in -- x|xno) -- echo "$as_me:13693: result: none needed" >&5 --echo "${ECHO_T}none needed" >&6 ;; -- *) -- echo "$as_me:13696: result: $ac_cv_prog_cc_stdc" >&5 --echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 -- CC="$CC $ac_cv_prog_cc_stdc" ;; --esac -- --echo "$as_me:13701: checking for an ANSI C-conforming const" >&5 -+echo "$as_me:14892: checking for an ANSI C-conforming const" >&5 - echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6 - if test "${ac_cv_c_const+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - cat >conftest.$ac_ext <<_ACEOF --#line 13707 "configure" -+#line 14898 "configure" - #include "confdefs.h" - - int -@@ -13762,16 +14953,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:13765: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:14956: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:13768: \$? = $ac_status" >&5 -+ echo "$as_me:14959: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:13771: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:14962: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:13774: \$? = $ac_status" >&5 -+ echo "$as_me:14965: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_c_const=yes - else -@@ -13781,7 +14972,7 @@ - fi - rm -f conftest.$ac_objext conftest.$ac_ext - fi --echo "$as_me:13784: result: $ac_cv_c_const" >&5 -+echo "$as_me:14975: result: $ac_cv_c_const" >&5 - echo "${ECHO_T}$ac_cv_c_const" >&6 - if test $ac_cv_c_const = no; then - -@@ -13791,7 +14982,7 @@ - - fi - --echo "$as_me:13794: checking for inline" >&5 -+echo "$as_me:14985: checking for inline" >&5 - echo $ECHO_N "checking for inline... $ECHO_C" >&6 - if test "${ac_cv_c_inline+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -13799,7 +14990,7 @@ - ac_cv_c_inline=no - for ac_kw in inline __inline__ __inline; do - cat >conftest.$ac_ext <<_ACEOF --#line 13802 "configure" -+#line 14993 "configure" - #include "confdefs.h" - #ifndef __cplusplus - static $ac_kw int static_foo () {return 0; } -@@ -13808,16 +14999,16 @@ - - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:13811: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:15002: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:13814: \$? = $ac_status" >&5 -+ echo "$as_me:15005: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:13817: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:15008: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:13820: \$? = $ac_status" >&5 -+ echo "$as_me:15011: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_c_inline=$ac_kw; break - else -@@ -13828,7 +15019,7 @@ - done - - fi --echo "$as_me:13831: result: $ac_cv_c_inline" >&5 -+echo "$as_me:15022: result: $ac_cv_c_inline" >&5 - echo "${ECHO_T}$ac_cv_c_inline" >&6 - case $ac_cv_c_inline in - inline | yes) ;; -@@ -13849,9 +15040,12 @@ - if test "$INTEL_COMPILER" = yes - then - : -+ elif test "$CLANG_COMPILER" = yes -+ then -+ : - elif test "$GCC" = yes - then -- echo "$as_me:13854: checking if $CC supports options to tune inlining" >&5 -+ echo "$as_me:15048: checking if $CC supports options to tune inlining" >&5 - echo $ECHO_N "checking if $CC supports options to tune inlining... $ECHO_C" >&6 - if test "${cf_cv_gcc_inline+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -13860,7 +15054,7 @@ - cf_save_CFLAGS=$CFLAGS - CFLAGS="$CFLAGS --param max-inline-insns-single=1200" - cat >conftest.$ac_ext <<_ACEOF --#line 13863 "configure" -+#line 15057 "configure" - #include "confdefs.h" - inline int foo(void) { return 1; } - int -@@ -13872,16 +15066,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:13875: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:15069: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:13878: \$? = $ac_status" >&5 -+ echo "$as_me:15072: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:13881: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:15075: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:13884: \$? = $ac_status" >&5 -+ echo "$as_me:15078: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_cv_gcc_inline=yes - else -@@ -13893,7 +15087,7 @@ - CFLAGS=$cf_save_CFLAGS - - fi --echo "$as_me:13896: result: $cf_cv_gcc_inline" >&5 -+echo "$as_me:15090: result: $cf_cv_gcc_inline" >&5 - echo "${ECHO_T}$cf_cv_gcc_inline" >&6 - if test "$cf_cv_gcc_inline" = yes ; then - -@@ -13979,7 +15173,7 @@ - fi - fi - --echo "$as_me:13982: checking for signal global datatype" >&5 -+echo "$as_me:15176: checking for signal global datatype" >&5 - echo $ECHO_N "checking for signal global datatype... $ECHO_C" >&6 - if test "${cf_cv_sig_atomic_t+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -13991,7 +15185,7 @@ - "int" - do - cat >conftest.$ac_ext <<_ACEOF --#line 13994 "configure" -+#line 15188 "configure" - #include "confdefs.h" - - #include -@@ -14014,16 +15208,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:14017: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:15211: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:14020: \$? = $ac_status" >&5 -+ echo "$as_me:15214: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:14023: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:15217: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:14026: \$? = $ac_status" >&5 -+ echo "$as_me:15220: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_cv_sig_atomic_t=$cf_type - else -@@ -14037,15 +15231,16 @@ - - fi - --echo "$as_me:14040: result: $cf_cv_sig_atomic_t" >&5 -+echo "$as_me:15234: result: $cf_cv_sig_atomic_t" >&5 - echo "${ECHO_T}$cf_cv_sig_atomic_t" >&6 --test "$cf_cv_sig_atomic_t" != no && cat >>confdefs.h <>confdefs.h <&5 -+echo "$as_me:15243: checking for type of chtype" >&5 - echo $ECHO_N "checking for type of chtype... $ECHO_C" >&6 - if test "${cf_cv_typeof_chtype+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -14055,7 +15250,7 @@ - cf_cv_typeof_chtype=long - else - cat >conftest.$ac_ext <<_ACEOF --#line 14058 "configure" -+#line 15253 "configure" - #include "confdefs.h" - - #define WANT_BITS 31 -@@ -14090,15 +15285,15 @@ - - _ACEOF - rm -f conftest$ac_exeext --if { (eval echo "$as_me:14093: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:15288: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:14096: \$? = $ac_status" >&5 -+ echo "$as_me:15291: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' -- { (eval echo "$as_me:14098: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:15293: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:14101: \$? = $ac_status" >&5 -+ echo "$as_me:15296: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_cv_typeof_chtype=`cat cf_test.out` - else -@@ -14113,7 +15308,7 @@ - - fi - --echo "$as_me:14116: result: $cf_cv_typeof_chtype" >&5 -+echo "$as_me:15311: result: $cf_cv_typeof_chtype" >&5 - echo "${ECHO_T}$cf_cv_typeof_chtype" >&6 - - cat >>confdefs.h <&5 -+echo "$as_me:15323: checking if unsigned literals are legal" >&5 - echo $ECHO_N "checking if unsigned literals are legal... $ECHO_C" >&6 - if test "${cf_cv_unsigned_literals+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - - cat >conftest.$ac_ext <<_ACEOF --#line 14135 "configure" -+#line 15330 "configure" - #include "confdefs.h" - - int -@@ -14144,16 +15339,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:14147: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:15342: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:14150: \$? = $ac_status" >&5 -+ echo "$as_me:15345: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:14153: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:15348: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:14156: \$? = $ac_status" >&5 -+ echo "$as_me:15351: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_cv_unsigned_literals=yes - else -@@ -14165,7 +15360,7 @@ - - fi - --echo "$as_me:14168: result: $cf_cv_unsigned_literals" >&5 -+echo "$as_me:15363: result: $cf_cv_unsigned_literals" >&5 - echo "${ECHO_T}$cf_cv_unsigned_literals" >&6 - - cf_cv_1UL="1" -@@ -14181,14 +15376,14 @@ - - ### Checks for external-data - --echo "$as_me:14184: checking if external errno is declared" >&5 -+echo "$as_me:15379: checking if external errno is declared" >&5 - echo $ECHO_N "checking if external errno is declared... $ECHO_C" >&6 - if test "${cf_cv_dcl_errno+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - - cat >conftest.$ac_ext <<_ACEOF --#line 14191 "configure" -+#line 15386 "configure" - #include "confdefs.h" - - #ifdef HAVE_STDLIB_H -@@ -14206,16 +15401,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:14209: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:15404: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:14212: \$? = $ac_status" >&5 -+ echo "$as_me:15407: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:14215: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:15410: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:14218: \$? = $ac_status" >&5 -+ echo "$as_me:15413: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_cv_dcl_errno=yes - else -@@ -14226,7 +15421,7 @@ - rm -f conftest.$ac_objext conftest.$ac_ext - - fi --echo "$as_me:14229: result: $cf_cv_dcl_errno" >&5 -+echo "$as_me:15424: result: $cf_cv_dcl_errno" >&5 - echo "${ECHO_T}$cf_cv_dcl_errno" >&6 - - if test "$cf_cv_dcl_errno" = no ; then -@@ -14241,14 +15436,14 @@ - - # It's possible (for near-UNIX clones) that the data doesn't exist - --echo "$as_me:14244: checking if external errno exists" >&5 -+echo "$as_me:15439: checking if external errno exists" >&5 - echo $ECHO_N "checking if external errno exists... $ECHO_C" >&6 - if test "${cf_cv_have_errno+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - - cat >conftest.$ac_ext <<_ACEOF --#line 14251 "configure" -+#line 15446 "configure" - #include "confdefs.h" - - #undef errno -@@ -14263,16 +15458,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:14266: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:15461: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:14269: \$? = $ac_status" >&5 -+ echo "$as_me:15464: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:14272: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:15467: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:14275: \$? = $ac_status" >&5 -+ echo "$as_me:15470: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_cv_have_errno=yes - else -@@ -14283,7 +15478,7 @@ - rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - - fi --echo "$as_me:14286: result: $cf_cv_have_errno" >&5 -+echo "$as_me:15481: result: $cf_cv_have_errno" >&5 - echo "${ECHO_T}$cf_cv_have_errno" >&6 - - if test "$cf_cv_have_errno" = yes ; then -@@ -14296,7 +15491,7 @@ - - fi - --echo "$as_me:14299: checking if data-only library module links" >&5 -+echo "$as_me:15494: checking if data-only library module links" >&5 - echo $ECHO_N "checking if data-only library module links... $ECHO_C" >&6 - if test "${cf_cv_link_dataonly+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -14304,20 +15499,20 @@ - - rm -f conftest.a - cat >conftest.$ac_ext <&5 -+ if { (eval echo "$as_me:15505: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:14313: \$? = $ac_status" >&5 -+ echo "$as_me:15508: \$? = $ac_status" >&5 - (exit $ac_status); } ; then - mv conftest.o data.o && \ - ( $AR $ARFLAGS conftest.a data.o ) 2>&5 1>/dev/null - fi - rm -f conftest.$ac_ext data.o - cat >conftest.$ac_ext <&5 -+ if { (eval echo "$as_me:15528: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:14336: \$? = $ac_status" >&5 -+ echo "$as_me:15531: \$? = $ac_status" >&5 - (exit $ac_status); }; then - mv conftest.o func.o && \ - ( $AR $ARFLAGS conftest.a func.o ) 2>&5 1>/dev/null -@@ -14346,7 +15541,7 @@ - cf_cv_link_dataonly=unknown - else - cat >conftest.$ac_ext <<_ACEOF --#line 14349 "configure" -+#line 15544 "configure" - #include "confdefs.h" - - int main() -@@ -14357,15 +15552,15 @@ - - _ACEOF - rm -f conftest$ac_exeext --if { (eval echo "$as_me:14360: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:15555: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:14363: \$? = $ac_status" >&5 -+ echo "$as_me:15558: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' -- { (eval echo "$as_me:14365: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:15560: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:14368: \$? = $ac_status" >&5 -+ echo "$as_me:15563: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_cv_link_dataonly=yes - else -@@ -14380,11 +15575,12 @@ - - fi - --echo "$as_me:14383: result: $cf_cv_link_dataonly" >&5 -+echo "$as_me:15578: result: $cf_cv_link_dataonly" >&5 - echo "${ECHO_T}$cf_cv_link_dataonly" >&6 - - if test "$cf_cv_link_dataonly" = no ; then -- cat >>confdefs.h <<\EOF -+ -+cat >>confdefs.h <<\EOF - #define BROKEN_LINKER 1 - EOF - -@@ -14400,10 +15596,12 @@ - getttynam \ - issetugid \ - poll \ -+putenv \ - remove \ - select \ - setbuf \ - setbuffer \ -+setenv \ - setvbuf \ - sigaction \ - sigvec \ -@@ -14415,13 +15613,13 @@ - - do - as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` --echo "$as_me:14418: checking for $ac_func" >&5 -+echo "$as_me:15616: checking for $ac_func" >&5 - echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 - if eval "test \"\${$as_ac_var+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - cat >conftest.$ac_ext <<_ACEOF --#line 14424 "configure" -+#line 15622 "configure" - #include "confdefs.h" - /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. */ -@@ -14444,7 +15642,7 @@ - #if defined (__stub_$ac_func) || defined (__stub___$ac_func) - choke me - #else --f = $ac_func; -+f = $ac_func; /* workaround for ICC 12.0.3 */ if (f == 0) return 1; - #endif - - ; -@@ -14452,45 +15650,102 @@ - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:14455: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:15653: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>&5 -+ ac_status=$? -+ echo "$as_me:15656: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -s conftest$ac_exeext' -+ { (eval echo "$as_me:15659: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:15662: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ eval "$as_ac_var=yes" -+else -+ echo "$as_me: failed program was:" >&5 -+cat conftest.$ac_ext >&5 -+eval "$as_ac_var=no" -+fi -+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -+fi -+echo "$as_me:15672: result: `eval echo '${'$as_ac_var'}'`" >&5 -+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 -+if test `eval echo '${'$as_ac_var'}'` = yes; then -+ cat >>confdefs.h <&5 -+echo $ECHO_N "checking for terminal-capability database functions... $ECHO_C" >&6 -+if test "${cf_cv_cgetent+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ -+cat >conftest.$ac_ext <<_ACEOF -+#line 15691 "configure" -+#include "confdefs.h" -+ -+#include -+int -+main () -+{ -+ -+ char temp[128]; -+ char *buf = temp; -+ char *db_array = temp; -+ cgetent(&buf, &db_array, "vt100"); -+ cgetcap(buf, "tc", '='); -+ cgetmatch(buf, "tc"); -+ -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext conftest$ac_exeext -+if { (eval echo "$as_me:15711: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:14458: \$? = $ac_status" >&5 -+ echo "$as_me:15714: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:14461: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:15717: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:14464: \$? = $ac_status" >&5 -+ echo "$as_me:15720: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- eval "$as_ac_var=yes" -+ cf_cv_cgetent=yes - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --eval "$as_ac_var=no" -+cf_cv_cgetent=no - fi - rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext --fi --echo "$as_me:14474: result: `eval echo '${'$as_ac_var'}'`" >&5 --echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 --if test `eval echo '${'$as_ac_var'}'` = yes; then -- cat >>confdefs.h <&5 -+echo "${ECHO_T}$cf_cv_cgetent" >&6 - --if test "$with_getcap" = "yes" ; then -+if test "$cf_cv_cgetent" = yes -+then - --echo "$as_me:14486: checking for terminal-capability database functions" >&5 --echo $ECHO_N "checking for terminal-capability database functions... $ECHO_C" >&6 --if test "${cf_cv_cgetent+set}" = set; then -+cat >>confdefs.h <<\EOF -+#define HAVE_BSD_CGETENT 1 -+EOF -+ -+echo "$as_me:15741: checking if cgetent uses const parameter" >&5 -+echo $ECHO_N "checking if cgetent uses const parameter... $ECHO_C" >&6 -+if test "${cf_cv_cgetent_const+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - - cat >conftest.$ac_ext <<_ACEOF --#line 14493 "configure" -+#line 15748 "configure" - #include "confdefs.h" - - #include -@@ -14500,8 +15755,10 @@ - - char temp[128]; - char *buf = temp; -- char *db_array = temp; -- cgetent(&buf, /* int *, */ &db_array, "vt100"); -+#ifndef _NETBSD_SOURCE /* given, since April 2004 in stdlib.h */ -+ const char *db_array = temp; -+ cgetent(&buf, &db_array, "vt100"); -+#endif - cgetcap(buf, "tc", '='); - cgetmatch(buf, "tc"); - -@@ -14510,43 +15767,48 @@ - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:14513: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:15770: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:14516: \$? = $ac_status" >&5 -+ echo "$as_me:15773: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:14519: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:15776: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:14522: \$? = $ac_status" >&5 -+ echo "$as_me:15779: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- cf_cv_cgetent=yes -+ cf_cv_cgetent_const=yes - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --cf_cv_cgetent=no -+cf_cv_cgetent_const=no - fi - rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - - fi -+echo "$as_me:15790: result: $cf_cv_cgetent_const" >&5 -+echo "${ECHO_T}$cf_cv_cgetent_const" >&6 -+ if test "$cf_cv_cgetent_const" = yes -+ then - --echo "$as_me:14534: result: $cf_cv_cgetent" >&5 --echo "${ECHO_T}$cf_cv_cgetent" >&6 --test "$cf_cv_cgetent" = yes && cat >>confdefs.h <<\EOF --#define HAVE_BSD_CGETENT 1 -+cat >>confdefs.h <&5 -+echo "$as_me:15804: checking for isascii" >&5 - echo $ECHO_N "checking for isascii... $ECHO_C" >&6 - if test "${cf_cv_have_isascii+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - - cat >conftest.$ac_ext <<_ACEOF --#line 14549 "configure" -+#line 15811 "configure" - #include "confdefs.h" - #include - int -@@ -14558,16 +15820,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:14561: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:15823: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:14564: \$? = $ac_status" >&5 -+ echo "$as_me:15826: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:14567: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:15829: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:14570: \$? = $ac_status" >&5 -+ echo "$as_me:15832: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_cv_have_isascii=yes - else -@@ -14578,17 +15840,18 @@ - rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - - fi --echo "$as_me:14581: result: $cf_cv_have_isascii" >&5 -+echo "$as_me:15843: result: $cf_cv_have_isascii" >&5 - echo "${ECHO_T}$cf_cv_have_isascii" >&6 --test "$cf_cv_have_isascii" = yes && cat >>confdefs.h <<\EOF -+test "$cf_cv_have_isascii" = yes && -+cat >>confdefs.h <<\EOF - #define HAVE_ISASCII 1 - EOF - - if test "$ac_cv_func_sigaction" = yes; then --echo "$as_me:14588: checking whether sigaction needs _POSIX_SOURCE" >&5 -+echo "$as_me:15851: checking whether sigaction needs _POSIX_SOURCE" >&5 - echo $ECHO_N "checking whether sigaction needs _POSIX_SOURCE... $ECHO_C" >&6 - cat >conftest.$ac_ext <<_ACEOF --#line 14591 "configure" -+#line 15854 "configure" - #include "confdefs.h" - - #include -@@ -14602,16 +15865,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:14605: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:15868: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:14608: \$? = $ac_status" >&5 -+ echo "$as_me:15871: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:14611: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:15874: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:14614: \$? = $ac_status" >&5 -+ echo "$as_me:15877: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - sigact_bad=no - else -@@ -14619,7 +15882,7 @@ - cat conftest.$ac_ext >&5 - - cat >conftest.$ac_ext <<_ACEOF --#line 14622 "configure" -+#line 15885 "configure" - #include "confdefs.h" - - #define _POSIX_SOURCE -@@ -14634,20 +15897,21 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:14637: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:15900: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:14640: \$? = $ac_status" >&5 -+ echo "$as_me:15903: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:14643: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:15906: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:14646: \$? = $ac_status" >&5 -+ echo "$as_me:15909: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - sigact_bad=yes -- cat >>confdefs.h <<\EOF --#define SVR4_ACTION 1 -+ -+cat >>confdefs.h <<\EOF -+#define _POSIX_SOURCE 1 - EOF - - else -@@ -14658,11 +15922,11 @@ - rm -f conftest.$ac_objext conftest.$ac_ext - fi - rm -f conftest.$ac_objext conftest.$ac_ext --echo "$as_me:14661: result: $sigact_bad" >&5 -+echo "$as_me:15925: result: $sigact_bad" >&5 - echo "${ECHO_T}$sigact_bad" >&6 - fi - --echo "$as_me:14665: checking if nanosleep really works" >&5 -+echo "$as_me:15929: checking if nanosleep really works" >&5 - echo $ECHO_N "checking if nanosleep really works... $ECHO_C" >&6 - if test "${cf_cv_func_nanosleep+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -14672,7 +15936,7 @@ - cf_cv_func_nanosleep=unknown - else - cat >conftest.$ac_ext <<_ACEOF --#line 14675 "configure" -+#line 15939 "configure" - #include "confdefs.h" - - #include -@@ -14697,15 +15961,15 @@ - - _ACEOF - rm -f conftest$ac_exeext --if { (eval echo "$as_me:14700: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:15964: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:14703: \$? = $ac_status" >&5 -+ echo "$as_me:15967: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' -- { (eval echo "$as_me:14705: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:15969: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:14708: \$? = $ac_status" >&5 -+ echo "$as_me:15972: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_cv_func_nanosleep=yes - else -@@ -14717,10 +15981,11 @@ - rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext - fi - fi --echo "$as_me:14720: result: $cf_cv_func_nanosleep" >&5 -+echo "$as_me:15984: result: $cf_cv_func_nanosleep" >&5 - echo "${ECHO_T}$cf_cv_func_nanosleep" >&6 - --test "$cf_cv_func_nanosleep" = "yes" && cat >>confdefs.h <<\EOF -+test "$cf_cv_func_nanosleep" = "yes" && -+cat >>confdefs.h <<\EOF - #define HAVE_NANOSLEEP 1 - EOF - -@@ -14731,23 +15996,23 @@ - - do - as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` --echo "$as_me:14734: checking for $ac_header" >&5 -+echo "$as_me:15999: checking for $ac_header" >&5 - echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 - if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - cat >conftest.$ac_ext <<_ACEOF --#line 14740 "configure" -+#line 16005 "configure" - #include "confdefs.h" - #include <$ac_header> - _ACEOF --if { (eval echo "$as_me:14744: \"$ac_cpp conftest.$ac_ext\"") >&5 -+if { (eval echo "$as_me:16009: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 -- echo "$as_me:14750: \$? = $ac_status" >&5 -+ echo "$as_me:16015: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag -@@ -14766,7 +16031,7 @@ - fi - rm -f conftest.err conftest.$ac_ext - fi --echo "$as_me:14769: result: `eval echo '${'$as_ac_Header'}'`" >&5 -+echo "$as_me:16034: result: `eval echo '${'$as_ac_Header'}'`" >&5 - echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 - if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <&5 -+echo "$as_me:16049: checking for $ac_header" >&5 - echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 - if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - cat >conftest.$ac_ext <<_ACEOF --#line 14790 "configure" -+#line 16055 "configure" - #include "confdefs.h" - #include <$ac_header> - _ACEOF --if { (eval echo "$as_me:14794: \"$ac_cpp conftest.$ac_ext\"") >&5 -+if { (eval echo "$as_me:16059: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 -- echo "$as_me:14800: \$? = $ac_status" >&5 -+ echo "$as_me:16065: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag -@@ -14816,7 +16081,7 @@ - fi - rm -f conftest.err conftest.$ac_ext - fi --echo "$as_me:14819: result: `eval echo '${'$as_ac_Header'}'`" >&5 -+echo "$as_me:16084: result: `eval echo '${'$as_ac_Header'}'`" >&5 - echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 - if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <&5 -+ echo "$as_me:16102: checking whether termios.h needs _POSIX_SOURCE" >&5 - echo $ECHO_N "checking whether termios.h needs _POSIX_SOURCE... $ECHO_C" >&6 - cat >conftest.$ac_ext <<_ACEOF --#line 14840 "configure" -+#line 16105 "configure" - #include "confdefs.h" - #include - int -@@ -14849,16 +16114,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:14852: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:16117: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:14855: \$? = $ac_status" >&5 -+ echo "$as_me:16120: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:14858: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:16123: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:14861: \$? = $ac_status" >&5 -+ echo "$as_me:16126: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - termios_bad=no - else -@@ -14866,7 +16131,7 @@ - cat conftest.$ac_ext >&5 - - cat >conftest.$ac_ext <<_ACEOF --#line 14869 "configure" -+#line 16134 "configure" - #include "confdefs.h" - - #define _POSIX_SOURCE -@@ -14880,23 +16145,24 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:14883: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:16148: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:14886: \$? = $ac_status" >&5 -+ echo "$as_me:16151: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:14889: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:16154: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:14892: \$? = $ac_status" >&5 -+ echo "$as_me:16157: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - termios_bad=unknown - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --termios_bad=yes cat >>confdefs.h <<\EOF --#define SVR4_TERMIO 1 -+termios_bad=yes -+cat >>confdefs.h <<\EOF -+#define _POSIX_SOURCE 1 - EOF - - fi -@@ -14904,19 +16170,19 @@ - - fi - rm -f conftest.$ac_objext conftest.$ac_ext -- echo "$as_me:14907: result: $termios_bad" >&5 -+ echo "$as_me:16173: result: $termios_bad" >&5 - echo "${ECHO_T}$termios_bad" >&6 - fi - fi - --echo "$as_me:14912: checking for tcgetattr" >&5 -+echo "$as_me:16178: checking for tcgetattr" >&5 - echo $ECHO_N "checking for tcgetattr... $ECHO_C" >&6 - if test "${cf_cv_have_tcgetattr+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - - cat >conftest.$ac_ext <<_ACEOF --#line 14919 "configure" -+#line 16185 "configure" - #include "confdefs.h" - - #include -@@ -14944,16 +16210,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:14947: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:16213: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:14950: \$? = $ac_status" >&5 -+ echo "$as_me:16216: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:14953: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:16219: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:14956: \$? = $ac_status" >&5 -+ echo "$as_me:16222: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_cv_have_tcgetattr=yes - else -@@ -14963,20 +16229,21 @@ - fi - rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - fi --echo "$as_me:14966: result: $cf_cv_have_tcgetattr" >&5 -+echo "$as_me:16232: result: $cf_cv_have_tcgetattr" >&5 - echo "${ECHO_T}$cf_cv_have_tcgetattr" >&6 --test "$cf_cv_have_tcgetattr" = yes && cat >>confdefs.h <<\EOF -+test "$cf_cv_have_tcgetattr" = yes && -+cat >>confdefs.h <<\EOF - #define HAVE_TCGETATTR 1 - EOF - --echo "$as_me:14972: checking for vsscanf function or workaround" >&5 -+echo "$as_me:16239: checking for vsscanf function or workaround" >&5 - echo $ECHO_N "checking for vsscanf function or workaround... $ECHO_C" >&6 - if test "${cf_cv_func_vsscanf+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - - cat >conftest.$ac_ext <<_ACEOF --#line 14979 "configure" -+#line 16246 "configure" - #include "confdefs.h" - - #include -@@ -14992,16 +16259,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:14995: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:16262: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:14998: \$? = $ac_status" >&5 -+ echo "$as_me:16265: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:15001: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:16268: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:15004: \$? = $ac_status" >&5 -+ echo "$as_me:16271: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_cv_func_vsscanf=vsscanf - else -@@ -15009,7 +16276,7 @@ - cat conftest.$ac_ext >&5 - - cat >conftest.$ac_ext <<_ACEOF --#line 15012 "configure" -+#line 16279 "configure" - #include "confdefs.h" - - #include -@@ -15031,16 +16298,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:15034: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:16301: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:15037: \$? = $ac_status" >&5 -+ echo "$as_me:16304: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:15040: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:16307: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:15043: \$? = $ac_status" >&5 -+ echo "$as_me:16310: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_cv_func_vsscanf=vfscanf - else -@@ -15048,7 +16315,7 @@ - cat conftest.$ac_ext >&5 - - cat >conftest.$ac_ext <<_ACEOF --#line 15051 "configure" -+#line 16318 "configure" - #include "confdefs.h" - - #include -@@ -15070,16 +16337,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:15073: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:16340: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:15076: \$? = $ac_status" >&5 -+ echo "$as_me:16343: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:15079: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:16346: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:15082: \$? = $ac_status" >&5 -+ echo "$as_me:16349: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_cv_func_vsscanf=_doscan - else -@@ -15094,25 +16361,28 @@ - fi - rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - fi --echo "$as_me:15097: result: $cf_cv_func_vsscanf" >&5 -+echo "$as_me:16364: result: $cf_cv_func_vsscanf" >&5 - echo "${ECHO_T}$cf_cv_func_vsscanf" >&6 - - case $cf_cv_func_vsscanf in #(vi --vsscanf) cat >>confdefs.h <<\EOF -+vsscanf) -+cat >>confdefs.h <<\EOF - #define HAVE_VSSCANF 1 - EOF - ;; #(vi --vfscanf) cat >>confdefs.h <<\EOF -+vfscanf) -+cat >>confdefs.h <<\EOF - #define HAVE_VFSCANF 1 - EOF - ;; #(vi --_doscan) cat >>confdefs.h <<\EOF -+_doscan) -+cat >>confdefs.h <<\EOF - #define HAVE__DOSCAN 1 - EOF - ;; - esac - --echo "$as_me:15115: checking for working mkstemp" >&5 -+echo "$as_me:16385: checking for working mkstemp" >&5 - echo $ECHO_N "checking for working mkstemp... $ECHO_C" >&6 - if test "${cf_cv_func_mkstemp+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -15120,68 +16390,10 @@ - - rm -rf conftest* - if test "$cross_compiling" = yes; then -- echo "$as_me:15123: checking for mkstemp" >&5 --echo $ECHO_N "checking for mkstemp... $ECHO_C" >&6 --if test "${ac_cv_func_mkstemp+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 --else -- cat >conftest.$ac_ext <<_ACEOF --#line 15129 "configure" --#include "confdefs.h" --/* System header to define __stub macros and hopefully few prototypes, -- which can conflict with char mkstemp (); below. */ --#include --/* Override any gcc2 internal prototype to avoid an error. */ --#ifdef __cplusplus --extern "C" --#endif --/* We use char because int might match the return type of a gcc2 -- builtin and then its argument prototype would still apply. */ --char mkstemp (); --char (*f) (); -- --int --main () --{ --/* The GNU C library defines this for functions which it implements -- to always fail with ENOSYS. Some functions are actually named -- something starting with __ and the normal name is an alias. */ --#if defined (__stub_mkstemp) || defined (__stub___mkstemp) --choke me --#else --f = mkstemp; --#endif -- -- ; -- return 0; --} --_ACEOF --rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:15160: \"$ac_link\"") >&5 -- (eval $ac_link) 2>&5 -- ac_status=$? -- echo "$as_me:15163: \$? = $ac_status" >&5 -- (exit $ac_status); } && -- { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:15166: \"$ac_try\"") >&5 -- (eval $ac_try) 2>&5 -- ac_status=$? -- echo "$as_me:15169: \$? = $ac_status" >&5 -- (exit $ac_status); }; }; then -- ac_cv_func_mkstemp=yes --else -- echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 --ac_cv_func_mkstemp=no --fi --rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext --fi --echo "$as_me:15179: result: $ac_cv_func_mkstemp" >&5 --echo "${ECHO_T}$ac_cv_func_mkstemp" >&6 -- -+ cf_cv_func_mkstemp=maybe - else - cat >conftest.$ac_ext <<_ACEOF --#line 15184 "configure" -+#line 16396 "configure" - #include "confdefs.h" - - #include -@@ -15219,15 +16431,15 @@ - - _ACEOF - rm -f conftest$ac_exeext --if { (eval echo "$as_me:15222: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:16434: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:15225: \$? = $ac_status" >&5 -+ echo "$as_me:16437: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' -- { (eval echo "$as_me:15227: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:16439: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:15230: \$? = $ac_status" >&5 -+ echo "$as_me:16442: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_cv_func_mkstemp=yes - -@@ -15242,10 +16454,72 @@ - fi - - fi --echo "$as_me:15245: result: $cf_cv_func_mkstemp" >&5 -+echo "$as_me:16457: result: $cf_cv_func_mkstemp" >&5 - echo "${ECHO_T}$cf_cv_func_mkstemp" >&6 -+if test "x$cf_cv_func_mkstemp" = xmaybe ; then -+ echo "$as_me:16460: checking for mkstemp" >&5 -+echo $ECHO_N "checking for mkstemp... $ECHO_C" >&6 -+if test "${ac_cv_func_mkstemp+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ cat >conftest.$ac_ext <<_ACEOF -+#line 16466 "configure" -+#include "confdefs.h" -+/* System header to define __stub macros and hopefully few prototypes, -+ which can conflict with char mkstemp (); below. */ -+#include -+/* Override any gcc2 internal prototype to avoid an error. */ -+#ifdef __cplusplus -+extern "C" -+#endif -+/* We use char because int might match the return type of a gcc2 -+ builtin and then its argument prototype would still apply. */ -+char mkstemp (); -+char (*f) (); -+ -+int -+main () -+{ -+/* The GNU C library defines this for functions which it implements -+ to always fail with ENOSYS. Some functions are actually named -+ something starting with __ and the normal name is an alias. */ -+#if defined (__stub_mkstemp) || defined (__stub___mkstemp) -+choke me -+#else -+f = mkstemp; /* workaround for ICC 12.0.3 */ if (f == 0) return 1; -+#endif -+ -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext conftest$ac_exeext -+if { (eval echo "$as_me:16497: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>&5 -+ ac_status=$? -+ echo "$as_me:16500: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -s conftest$ac_exeext' -+ { (eval echo "$as_me:16503: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:16506: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ ac_cv_func_mkstemp=yes -+else -+ echo "$as_me: failed program was:" >&5 -+cat conftest.$ac_ext >&5 -+ac_cv_func_mkstemp=no -+fi -+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -+fi -+echo "$as_me:16516: result: $ac_cv_func_mkstemp" >&5 -+echo "${ECHO_T}$ac_cv_func_mkstemp" >&6 -+ -+fi - if test "x$cf_cv_func_mkstemp" = xyes || test "x$ac_cv_func_mkstemp" = xyes ; then -- cat >>confdefs.h <<\EOF -+ -+cat >>confdefs.h <<\EOF - #define HAVE_MKSTEMP 1 - EOF - -@@ -15259,22 +16533,22 @@ - HAVE_VSSCANF=0 - fi - --if test "$cross_compiling" = yes ; then -- { echo "$as_me:15263: WARNING: cross compiling: assume setvbuf params not reversed" >&5 -+if test "x$cross_compiling" = xyes ; then -+ { echo "$as_me:16537: WARNING: cross compiling: assume setvbuf params not reversed" >&5 - echo "$as_me: WARNING: cross compiling: assume setvbuf params not reversed" >&2;} - else -- echo "$as_me:15266: checking whether setvbuf arguments are reversed" >&5 -+ echo "$as_me:16540: checking whether setvbuf arguments are reversed" >&5 - echo $ECHO_N "checking whether setvbuf arguments are reversed... $ECHO_C" >&6 - if test "${ac_cv_func_setvbuf_reversed+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - if test "$cross_compiling" = yes; then -- { { echo "$as_me:15272: error: cannot run test program while cross compiling" >&5 -+ { { echo "$as_me:16546: error: cannot run test program while cross compiling" >&5 - echo "$as_me: error: cannot run test program while cross compiling" >&2;} - { (exit 1); exit 1; }; } - else - cat >conftest.$ac_ext <<_ACEOF --#line 15277 "configure" -+#line 16551 "configure" - #include "confdefs.h" - #include - /* If setvbuf has the reversed format, exit 0. */ -@@ -15291,15 +16565,15 @@ - } - _ACEOF - rm -f conftest$ac_exeext --if { (eval echo "$as_me:15294: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:16568: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:15297: \$? = $ac_status" >&5 -+ echo "$as_me:16571: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' -- { (eval echo "$as_me:15299: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:16573: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:15302: \$? = $ac_status" >&5 -+ echo "$as_me:16576: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_func_setvbuf_reversed=yes - else -@@ -15312,7 +16586,7 @@ - fi - rm -f core core.* *.core - fi --echo "$as_me:15315: result: $ac_cv_func_setvbuf_reversed" >&5 -+echo "$as_me:16589: result: $ac_cv_func_setvbuf_reversed" >&5 - echo "${ECHO_T}$ac_cv_func_setvbuf_reversed" >&6 - if test $ac_cv_func_setvbuf_reversed = yes; then - -@@ -15323,68 +16597,66 @@ - fi - - fi --echo "$as_me:15326: checking return type of signal handlers" >&5 --echo $ECHO_N "checking return type of signal handlers... $ECHO_C" >&6 --if test "${ac_cv_type_signal+set}" = set; then -+echo "$as_me:16600: checking for intptr_t" >&5 -+echo $ECHO_N "checking for intptr_t... $ECHO_C" >&6 -+if test "${ac_cv_type_intptr_t+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - cat >conftest.$ac_ext <<_ACEOF --#line 15332 "configure" -+#line 16606 "configure" - #include "confdefs.h" --#include --#include --#ifdef signal --# undef signal --#endif --#ifdef __cplusplus --extern "C" void (*signal (int, void (*)(int)))(int); --#else --void (*signal ()) (); --#endif -- -+$ac_includes_default - int - main () - { --int i; -+if ((intptr_t *) 0) -+ return 0; -+if (sizeof (intptr_t)) -+ return 0; - ; - return 0; - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:15354: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:16621: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:15357: \$? = $ac_status" >&5 -+ echo "$as_me:16624: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:15360: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:16627: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:15363: \$? = $ac_status" >&5 -+ echo "$as_me:16630: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- ac_cv_type_signal=void -+ ac_cv_type_intptr_t=yes - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --ac_cv_type_signal=int -+ac_cv_type_intptr_t=no - fi - rm -f conftest.$ac_objext conftest.$ac_ext - fi --echo "$as_me:15373: result: $ac_cv_type_signal" >&5 --echo "${ECHO_T}$ac_cv_type_signal" >&6 -+echo "$as_me:16640: result: $ac_cv_type_intptr_t" >&5 -+echo "${ECHO_T}$ac_cv_type_intptr_t" >&6 -+if test $ac_cv_type_intptr_t = yes; then -+ : -+else - - cat >>confdefs.h <&5 -+fi -+ -+echo "$as_me:16652: checking for type sigaction_t" >&5 - echo $ECHO_N "checking for type sigaction_t... $ECHO_C" >&6 - if test "${cf_cv_type_sigaction+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - - cat >conftest.$ac_ext <<_ACEOF --#line 15387 "configure" -+#line 16659 "configure" - #include "confdefs.h" - - #include -@@ -15397,16 +16669,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:15400: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:16672: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:15403: \$? = $ac_status" >&5 -+ echo "$as_me:16675: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:15406: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:16678: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:15409: \$? = $ac_status" >&5 -+ echo "$as_me:16681: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_cv_type_sigaction=yes - else -@@ -15417,13 +16689,14 @@ - rm -f conftest.$ac_objext conftest.$ac_ext - fi - --echo "$as_me:15420: result: $cf_cv_type_sigaction" >&5 -+echo "$as_me:16692: result: $cf_cv_type_sigaction" >&5 - echo "${ECHO_T}$cf_cv_type_sigaction" >&6 --test "$cf_cv_type_sigaction" = yes && cat >>confdefs.h <<\EOF -+test "$cf_cv_type_sigaction" = yes && -+cat >>confdefs.h <<\EOF - #define HAVE_TYPE_SIGACTION 1 - EOF - --echo "$as_me:15426: checking declaration of size-change" >&5 -+echo "$as_me:16699: checking declaration of size-change" >&5 - echo $ECHO_N "checking declaration of size-change... $ECHO_C" >&6 - if test "${cf_cv_sizechange+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -15438,7 +16711,7 @@ - CPPFLAGS="$cf_save_CPPFLAGS" - test -n "$cf_opts" && CPPFLAGS="$CPPFLAGS -D$cf_opts" - cat >conftest.$ac_ext <<_ACEOF --#line 15441 "configure" -+#line 16714 "configure" - #include "confdefs.h" - #include - #ifdef HAVE_TERMIOS_H -@@ -15482,16 +16755,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:15485: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:16758: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:15488: \$? = $ac_status" >&5 -+ echo "$as_me:16761: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:15491: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:16764: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:15494: \$? = $ac_status" >&5 -+ echo "$as_me:16767: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_cv_sizechange=yes - else -@@ -15510,10 +16783,11 @@ - done - - fi --echo "$as_me:15513: result: $cf_cv_sizechange" >&5 -+echo "$as_me:16786: result: $cf_cv_sizechange" >&5 - echo "${ECHO_T}$cf_cv_sizechange" >&6 - if test "$cf_cv_sizechange" != no ; then -- cat >>confdefs.h <<\EOF -+ -+cat >>confdefs.h <<\EOF - #define HAVE_SIZECHANGE 1 - EOF - -@@ -15527,13 +16801,13 @@ - esac - fi - --echo "$as_me:15530: checking for memmove" >&5 -+echo "$as_me:16804: checking for memmove" >&5 - echo $ECHO_N "checking for memmove... $ECHO_C" >&6 - if test "${ac_cv_func_memmove+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - cat >conftest.$ac_ext <<_ACEOF --#line 15536 "configure" -+#line 16810 "configure" - #include "confdefs.h" - /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char memmove (); below. */ -@@ -15556,7 +16830,7 @@ - #if defined (__stub_memmove) || defined (__stub___memmove) - choke me - #else --f = memmove; -+f = memmove; /* workaround for ICC 12.0.3 */ if (f == 0) return 1; - #endif - - ; -@@ -15564,16 +16838,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:15567: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:16841: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:15570: \$? = $ac_status" >&5 -+ echo "$as_me:16844: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:15573: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:16847: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:15576: \$? = $ac_status" >&5 -+ echo "$as_me:16850: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_func_memmove=yes - else -@@ -15583,19 +16857,19 @@ - fi - rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - fi --echo "$as_me:15586: result: $ac_cv_func_memmove" >&5 -+echo "$as_me:16860: result: $ac_cv_func_memmove" >&5 - echo "${ECHO_T}$ac_cv_func_memmove" >&6 - if test $ac_cv_func_memmove = yes; then - : - else - --echo "$as_me:15592: checking for bcopy" >&5 -+echo "$as_me:16866: checking for bcopy" >&5 - echo $ECHO_N "checking for bcopy... $ECHO_C" >&6 - if test "${ac_cv_func_bcopy+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - cat >conftest.$ac_ext <<_ACEOF --#line 15598 "configure" -+#line 16872 "configure" - #include "confdefs.h" - /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char bcopy (); below. */ -@@ -15618,7 +16892,7 @@ - #if defined (__stub_bcopy) || defined (__stub___bcopy) - choke me - #else --f = bcopy; -+f = bcopy; /* workaround for ICC 12.0.3 */ if (f == 0) return 1; - #endif - - ; -@@ -15626,16 +16900,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:15629: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:16903: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:15632: \$? = $ac_status" >&5 -+ echo "$as_me:16906: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:15635: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:16909: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:15638: \$? = $ac_status" >&5 -+ echo "$as_me:16912: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_func_bcopy=yes - else -@@ -15645,11 +16919,11 @@ - fi - rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - fi --echo "$as_me:15648: result: $ac_cv_func_bcopy" >&5 -+echo "$as_me:16922: result: $ac_cv_func_bcopy" >&5 - echo "${ECHO_T}$ac_cv_func_bcopy" >&6 - if test $ac_cv_func_bcopy = yes; then - -- echo "$as_me:15652: checking if bcopy does overlapping moves" >&5 -+ echo "$as_me:16926: checking if bcopy does overlapping moves" >&5 - echo $ECHO_N "checking if bcopy does overlapping moves... $ECHO_C" >&6 - if test "${cf_cv_good_bcopy+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -15659,7 +16933,7 @@ - cf_cv_good_bcopy=unknown - else - cat >conftest.$ac_ext <<_ACEOF --#line 15662 "configure" -+#line 16936 "configure" - #include "confdefs.h" - - int main() { -@@ -15673,15 +16947,15 @@ - - _ACEOF - rm -f conftest$ac_exeext --if { (eval echo "$as_me:15676: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:16950: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:15679: \$? = $ac_status" >&5 -+ echo "$as_me:16953: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' -- { (eval echo "$as_me:15681: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:16955: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:15684: \$? = $ac_status" >&5 -+ echo "$as_me:16958: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_cv_good_bcopy=yes - else -@@ -15694,7 +16968,7 @@ - fi - - fi --echo "$as_me:15697: result: $cf_cv_good_bcopy" >&5 -+echo "$as_me:16971: result: $cf_cv_good_bcopy" >&5 - echo "${ECHO_T}$cf_cv_good_bcopy" >&6 - - else -@@ -15702,12 +16976,14 @@ - fi - - if test "$cf_cv_good_bcopy" = yes ; then -- cat >>confdefs.h <<\EOF -+ -+cat >>confdefs.h <<\EOF - #define USE_OK_BCOPY 1 - EOF - - else -- cat >>confdefs.h <<\EOF -+ -+cat >>confdefs.h <<\EOF - #define USE_MY_MEMMOVE 1 - EOF - -@@ -15715,7 +16991,7 @@ - - fi - --echo "$as_me:15718: checking if poll really works" >&5 -+echo "$as_me:16994: checking if poll really works" >&5 - echo $ECHO_N "checking if poll really works... $ECHO_C" >&6 - if test "${cf_cv_working_poll+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -15725,10 +17001,13 @@ - cf_cv_working_poll=unknown - else - cat >conftest.$ac_ext <<_ACEOF --#line 15728 "configure" -+#line 17004 "configure" - #include "confdefs.h" - -+#include - #include -+#include -+#include - #ifdef HAVE_POLL_H - #include - #else -@@ -15738,23 +17017,46 @@ - struct pollfd myfds; - int ret; - -- myfds.fd = 0; -+ /* check for Darwin bug with respect to "devices" */ -+ myfds.fd = open("/dev/null", 1); /* O_WRONLY */ -+ if (myfds.fd < 0) -+ myfds.fd = 0; - myfds.events = POLLIN; -+ myfds.revents = 0; - - ret = poll(&myfds, 1, 100); -- ${cf_cv_main_return:-return}(ret != 0); -+ -+ if (ret < 0 || (myfds.revents & POLLNVAL)) { -+ ret = -1; -+ } else { -+ int fd = 0; -+ if (!isatty(fd)) { -+ fd = open("/dev/tty", 2); /* O_RDWR */ -+ } -+ -+ if (fd >= 0) { -+ /* also check with standard input */ -+ myfds.fd = fd; -+ myfds.events = POLLIN; -+ myfds.revents = 0; -+ ret = poll(&myfds, 1, 100); -+ } else { -+ ret = -1; -+ } -+ } -+ ${cf_cv_main_return:-return}(ret < 0); - } - _ACEOF - rm -f conftest$ac_exeext --if { (eval echo "$as_me:15749: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:17051: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:15752: \$? = $ac_status" >&5 -+ echo "$as_me:17054: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' -- { (eval echo "$as_me:15754: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:17056: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:15757: \$? = $ac_status" >&5 -+ echo "$as_me:17059: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_cv_working_poll=yes - else -@@ -15766,20 +17068,21 @@ - rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext - fi - fi --echo "$as_me:15769: result: $cf_cv_working_poll" >&5 -+echo "$as_me:17071: result: $cf_cv_working_poll" >&5 - echo "${ECHO_T}$cf_cv_working_poll" >&6 --test "$cf_cv_working_poll" = "yes" && cat >>confdefs.h <<\EOF -+test "$cf_cv_working_poll" = "yes" && -+cat >>confdefs.h <<\EOF - #define HAVE_WORKING_POLL 1 - EOF - --echo "$as_me:15775: checking for va_copy" >&5 -+echo "$as_me:17078: checking for va_copy" >&5 - echo $ECHO_N "checking for va_copy... $ECHO_C" >&6 - if test "${cf_cv_have_va_copy+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - - cat >conftest.$ac_ext <<_ACEOF --#line 15782 "configure" -+#line 17085 "configure" - #include "confdefs.h" - - #include -@@ -15796,16 +17099,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:15799: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:17102: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:15802: \$? = $ac_status" >&5 -+ echo "$as_me:17105: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:15805: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:17108: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:15808: \$? = $ac_status" >&5 -+ echo "$as_me:17111: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_cv_have_va_copy=yes - else -@@ -15815,21 +17118,22 @@ - fi - rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - fi --echo "$as_me:15818: result: $cf_cv_have_va_copy" >&5 -+echo "$as_me:17121: result: $cf_cv_have_va_copy" >&5 - echo "${ECHO_T}$cf_cv_have_va_copy" >&6 - --test "$cf_cv_have_va_copy" = yes && cat >>confdefs.h <<\EOF -+test "$cf_cv_have_va_copy" = yes && -+cat >>confdefs.h <<\EOF - #define HAVE_VA_COPY 1 - EOF - --echo "$as_me:15825: checking for __va_copy" >&5 -+echo "$as_me:17129: checking for __va_copy" >&5 - echo $ECHO_N "checking for __va_copy... $ECHO_C" >&6 - if test "${cf_cv_have___va_copy+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - - cat >conftest.$ac_ext <<_ACEOF --#line 15832 "configure" -+#line 17136 "configure" - #include "confdefs.h" - - #include -@@ -15846,16 +17150,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:15849: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:17153: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:15852: \$? = $ac_status" >&5 -+ echo "$as_me:17156: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:15855: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:17159: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:15858: \$? = $ac_status" >&5 -+ echo "$as_me:17162: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_cv_have___va_copy=yes - else -@@ -15865,20 +17169,21 @@ - fi - rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - fi --echo "$as_me:15868: result: $cf_cv_have___va_copy" >&5 -+echo "$as_me:17172: result: $cf_cv_have___va_copy" >&5 - echo "${ECHO_T}$cf_cv_have___va_copy" >&6 - --test "$cf_cv_have___va_copy" = yes && cat >>confdefs.h <<\EOF -+test "$cf_cv_have___va_copy" = yes && -+cat >>confdefs.h <<\EOF - #define HAVE___VA_COPY 1 - EOF - --echo "$as_me:15875: checking for pid_t" >&5 -+echo "$as_me:17180: checking for pid_t" >&5 - echo $ECHO_N "checking for pid_t... $ECHO_C" >&6 - if test "${ac_cv_type_pid_t+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - cat >conftest.$ac_ext <<_ACEOF --#line 15881 "configure" -+#line 17186 "configure" - #include "confdefs.h" - $ac_includes_default - int -@@ -15893,16 +17198,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:15896: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:17201: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:15899: \$? = $ac_status" >&5 -+ echo "$as_me:17204: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:15902: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:17207: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:15905: \$? = $ac_status" >&5 -+ echo "$as_me:17210: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_type_pid_t=yes - else -@@ -15912,7 +17217,7 @@ - fi - rm -f conftest.$ac_objext conftest.$ac_ext - fi --echo "$as_me:15915: result: $ac_cv_type_pid_t" >&5 -+echo "$as_me:17220: result: $ac_cv_type_pid_t" >&5 - echo "${ECHO_T}$ac_cv_type_pid_t" >&6 - if test $ac_cv_type_pid_t = yes; then - : -@@ -15927,23 +17232,23 @@ - for ac_header in unistd.h vfork.h - do - as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` --echo "$as_me:15930: checking for $ac_header" >&5 -+echo "$as_me:17235: checking for $ac_header" >&5 - echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 - if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - cat >conftest.$ac_ext <<_ACEOF --#line 15936 "configure" -+#line 17241 "configure" - #include "confdefs.h" - #include <$ac_header> - _ACEOF --if { (eval echo "$as_me:15940: \"$ac_cpp conftest.$ac_ext\"") >&5 -+if { (eval echo "$as_me:17245: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 -- echo "$as_me:15946: \$? = $ac_status" >&5 -+ echo "$as_me:17251: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag -@@ -15962,7 +17267,7 @@ - fi - rm -f conftest.err conftest.$ac_ext - fi --echo "$as_me:15965: result: `eval echo '${'$as_ac_Header'}'`" >&5 -+echo "$as_me:17270: result: `eval echo '${'$as_ac_Header'}'`" >&5 - echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 - if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <&5 -+echo "$as_me:17283: checking for $ac_func" >&5 - echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 - if eval "test \"\${$as_ac_var+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - cat >conftest.$ac_ext <<_ACEOF --#line 15984 "configure" -+#line 17289 "configure" - #include "confdefs.h" - /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. */ -@@ -16004,7 +17309,7 @@ - #if defined (__stub_$ac_func) || defined (__stub___$ac_func) - choke me - #else --f = $ac_func; -+f = $ac_func; /* workaround for ICC 12.0.3 */ if (f == 0) return 1; - #endif - - ; -@@ -16012,16 +17317,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:16015: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:17320: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:16018: \$? = $ac_status" >&5 -+ echo "$as_me:17323: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:16021: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:17326: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:16024: \$? = $ac_status" >&5 -+ echo "$as_me:17329: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - eval "$as_ac_var=yes" - else -@@ -16031,7 +17336,7 @@ - fi - rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - fi --echo "$as_me:16034: result: `eval echo '${'$as_ac_var'}'`" >&5 -+echo "$as_me:17339: result: `eval echo '${'$as_ac_var'}'`" >&5 - echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 - if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <&5 -+ echo "$as_me:17351: checking for working fork" >&5 - echo $ECHO_N "checking for working fork... $ECHO_C" >&6 - if test "${ac_cv_func_fork_works+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -16066,15 +17371,15 @@ - } - _ACEOF - rm -f conftest$ac_exeext --if { (eval echo "$as_me:16069: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:17374: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:16072: \$? = $ac_status" >&5 -+ echo "$as_me:17377: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' -- { (eval echo "$as_me:16074: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:17379: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:16077: \$? = $ac_status" >&5 -+ echo "$as_me:17382: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_func_fork_works=yes - else -@@ -16086,7 +17391,7 @@ - rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext - fi - fi --echo "$as_me:16089: result: $ac_cv_func_fork_works" >&5 -+echo "$as_me:17394: result: $ac_cv_func_fork_works" >&5 - echo "${ECHO_T}$ac_cv_func_fork_works" >&6 - - fi -@@ -16100,12 +17405,12 @@ - ac_cv_func_fork_works=yes - ;; - esac -- { echo "$as_me:16103: WARNING: CROSS: Result $ac_cv_func_fork_works guessed due to cross-compiling." >&5 -+ { echo "$as_me:17408: WARNING: CROSS: Result $ac_cv_func_fork_works guessed due to cross-compiling." >&5 - echo "$as_me: WARNING: CROSS: Result $ac_cv_func_fork_works guessed due to cross-compiling." >&2;} - fi - ac_cv_func_vfork_works=$ac_cv_func_vfork - if test "x$ac_cv_func_vfork" = xyes; then -- echo "$as_me:16108: checking for working vfork" >&5 -+ echo "$as_me:17413: checking for working vfork" >&5 - echo $ECHO_N "checking for working vfork... $ECHO_C" >&6 - if test "${ac_cv_func_vfork_works+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -16114,7 +17419,7 @@ - ac_cv_func_vfork_works=cross - else - cat >conftest.$ac_ext <<_ACEOF --#line 16117 "configure" -+#line 17422 "configure" - #include "confdefs.h" - /* Thanks to Paul Eggert for this test. */ - #include -@@ -16211,15 +17516,15 @@ - } - _ACEOF - rm -f conftest$ac_exeext --if { (eval echo "$as_me:16214: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:17519: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:16217: \$? = $ac_status" >&5 -+ echo "$as_me:17522: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' -- { (eval echo "$as_me:16219: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:17524: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:16222: \$? = $ac_status" >&5 -+ echo "$as_me:17527: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_func_vfork_works=yes - else -@@ -16231,13 +17536,13 @@ - rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext - fi - fi --echo "$as_me:16234: result: $ac_cv_func_vfork_works" >&5 -+echo "$as_me:17539: result: $ac_cv_func_vfork_works" >&5 - echo "${ECHO_T}$ac_cv_func_vfork_works" >&6 - - fi; - if test "x$ac_cv_func_fork_works" = xcross; then - ac_cv_func_vfork_works=ac_cv_func_vfork -- { echo "$as_me:16240: WARNING: CROSS: Result $ac_cv_func_vfork_works guessed due to cross-compiling." >&5 -+ { echo "$as_me:17545: WARNING: CROSS: Result $ac_cv_func_vfork_works guessed due to cross-compiling." >&5 - echo "$as_me: WARNING: CROSS: Result $ac_cv_func_vfork_works guessed due to cross-compiling." >&2;} - fi - -@@ -16264,7 +17569,7 @@ - - # special check for test/ditto.c - --echo "$as_me:16267: checking for openpty in -lutil" >&5 -+echo "$as_me:17572: checking for openpty in -lutil" >&5 - echo $ECHO_N "checking for openpty in -lutil... $ECHO_C" >&6 - if test "${ac_cv_lib_util_openpty+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -16272,7 +17577,7 @@ - ac_check_lib_save_LIBS=$LIBS - LIBS="-lutil $LIBS" - cat >conftest.$ac_ext <<_ACEOF --#line 16275 "configure" -+#line 17580 "configure" - #include "confdefs.h" - - /* Override any gcc2 internal prototype to avoid an error. */ -@@ -16291,16 +17596,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:16294: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:17599: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:16297: \$? = $ac_status" >&5 -+ echo "$as_me:17602: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:16300: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:17605: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:16303: \$? = $ac_status" >&5 -+ echo "$as_me:17608: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_util_openpty=yes - else -@@ -16311,7 +17616,7 @@ - rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - LIBS=$ac_check_lib_save_LIBS - fi --echo "$as_me:16314: result: $ac_cv_lib_util_openpty" >&5 -+echo "$as_me:17619: result: $ac_cv_lib_util_openpty" >&5 - echo "${ECHO_T}$ac_cv_lib_util_openpty" >&6 - if test $ac_cv_lib_util_openpty = yes; then - cf_cv_lib_util=yes -@@ -16319,7 +17624,7 @@ - cf_cv_lib_util=no - fi - --echo "$as_me:16322: checking for openpty header" >&5 -+echo "$as_me:17627: checking for openpty header" >&5 - echo $ECHO_N "checking for openpty header... $ECHO_C" >&6 - if test "${cf_cv_func_openpty+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -16330,7 +17635,7 @@ - for cf_header in pty.h libutil.h util.h - do - cat >conftest.$ac_ext <<_ACEOF --#line 16333 "configure" -+#line 17638 "configure" - #include "confdefs.h" - - #include <$cf_header> -@@ -16347,16 +17652,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:16350: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:17655: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:16353: \$? = $ac_status" >&5 -+ echo "$as_me:17658: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:16356: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:17661: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:16359: \$? = $ac_status" >&5 -+ echo "$as_me:17664: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - - cf_cv_func_openpty=$cf_header -@@ -16374,25 +17679,27 @@ - LIBS="$cf_save_LIBS" - - fi --echo "$as_me:16377: result: $cf_cv_func_openpty" >&5 -+echo "$as_me:17682: result: $cf_cv_func_openpty" >&5 - echo "${ECHO_T}$cf_cv_func_openpty" >&6 - - if test "$cf_cv_func_openpty" != no ; then -- cat >>confdefs.h <>confdefs.h < - EOF - -- cat >>confdefs.h <<\EOF -+cat >>confdefs.h <<\EOF - #define USE_XTERM_PTY 1 - EOF - -- if test "$cf_cv_lib_util" = yes ; then -+ if test "x$cf_cv_lib_util" = xyes ; then - TEST_LIBS="-lutil $TEST_LIBS" - fi - fi - - if test "$with_hashed_db" != no ; then -- cat >>confdefs.h <<\EOF -+ -+cat >>confdefs.h <<\EOF - #define USE_HASHED_DB 1 - EOF - -@@ -16426,7 +17733,7 @@ - cf_save_CPPFLAGS=$CPPFLAGS - CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" - cat >conftest.$ac_ext <<_ACEOF --#line 16429 "configure" -+#line 17736 "configure" - #include "confdefs.h" - #include - int -@@ -16438,16 +17745,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:16441: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:17748: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:16444: \$? = $ac_status" >&5 -+ echo "$as_me:17751: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:16447: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:17754: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:16450: \$? = $ac_status" >&5 -+ echo "$as_me:17757: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : - else -@@ -16464,7 +17771,7 @@ - if test "$cf_have_incdir" = no ; then - test -n "$verbose" && echo " adding $cf_add_incdir to include-path" 1>&6 - --echo "${as_me:-configure}:16467: testing adding $cf_add_incdir to include-path ..." 1>&5 -+echo "${as_me:-configure}:17774: testing adding $cf_add_incdir to include-path ..." 1>&5 - - CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" - -@@ -16498,7 +17805,7 @@ - if test "$cf_have_libdir" = no ; then - test -n "$verbose" && echo " adding $cf_add_libdir to library-path" 1>&6 - --echo "${as_me:-configure}:16501: testing adding $cf_add_libdir to library-path ..." 1>&5 -+echo "${as_me:-configure}:17808: testing adding $cf_add_libdir to library-path ..." 1>&5 - - LDFLAGS="-L$cf_add_libdir $LDFLAGS" - fi -@@ -16509,23 +17816,23 @@ - fi - esac - --echo "$as_me:16512: checking for db.h" >&5 -+echo "$as_me:17819: checking for db.h" >&5 - echo $ECHO_N "checking for db.h... $ECHO_C" >&6 - if test "${ac_cv_header_db_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - cat >conftest.$ac_ext <<_ACEOF --#line 16518 "configure" -+#line 17825 "configure" - #include "confdefs.h" - #include - _ACEOF --if { (eval echo "$as_me:16522: \"$ac_cpp conftest.$ac_ext\"") >&5 -+if { (eval echo "$as_me:17829: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 -- echo "$as_me:16528: \$? = $ac_status" >&5 -+ echo "$as_me:17835: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag -@@ -16544,11 +17851,11 @@ - fi - rm -f conftest.err conftest.$ac_ext - fi --echo "$as_me:16547: result: $ac_cv_header_db_h" >&5 -+echo "$as_me:17854: result: $ac_cv_header_db_h" >&5 - echo "${ECHO_T}$ac_cv_header_db_h" >&6 - if test $ac_cv_header_db_h = yes; then - --echo "$as_me:16551: checking for version of db" >&5 -+echo "$as_me:17858: checking for version of db" >&5 - echo $ECHO_N "checking for version of db... $ECHO_C" >&6 - if test "${cf_cv_hashed_db_version+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -16559,10 +17866,10 @@ - for cf_db_version in 1 2 3 4 5 - do - --echo "${as_me:-configure}:16562: testing checking for db version $cf_db_version ..." 1>&5 -+echo "${as_me:-configure}:17869: testing checking for db version $cf_db_version ..." 1>&5 - - cat >conftest.$ac_ext <<_ACEOF --#line 16565 "configure" -+#line 17872 "configure" - #include "confdefs.h" - - $ac_includes_default -@@ -16592,16 +17899,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:16595: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:17902: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:16598: \$? = $ac_status" >&5 -+ echo "$as_me:17905: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:16601: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:17908: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:16604: \$? = $ac_status" >&5 -+ echo "$as_me:17911: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - - cf_cv_hashed_db_version=$cf_db_version -@@ -16615,16 +17922,16 @@ - done - - fi --echo "$as_me:16618: result: $cf_cv_hashed_db_version" >&5 -+echo "$as_me:17925: result: $cf_cv_hashed_db_version" >&5 - echo "${ECHO_T}$cf_cv_hashed_db_version" >&6 - - if test "$cf_cv_hashed_db_version" = unknown ; then -- { { echo "$as_me:16622: error: Cannot determine version of db" >&5 -+ { { echo "$as_me:17929: error: Cannot determine version of db" >&5 - echo "$as_me: error: Cannot determine version of db" >&2;} - { (exit 1); exit 1; }; } - else - --echo "$as_me:16627: checking for db libraries" >&5 -+echo "$as_me:17934: checking for db libraries" >&5 - echo $ECHO_N "checking for db libraries... $ECHO_C" >&6 - if test "${cf_cv_hashed_db_libs+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -16638,10 +17945,10 @@ - LIBS="-l$cf_db_libs $LIBS" - fi - --echo "${as_me:-configure}:16641: testing checking for library "$cf_db_libs" ..." 1>&5 -+echo "${as_me:-configure}:17948: testing checking for library "$cf_db_libs" ..." 1>&5 - - cat >conftest.$ac_ext <<_ACEOF --#line 16644 "configure" -+#line 17951 "configure" - #include "confdefs.h" - - $ac_includes_default -@@ -16696,16 +18003,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:16699: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:18006: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:16702: \$? = $ac_status" >&5 -+ echo "$as_me:18009: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:16705: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:18012: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:16708: \$? = $ac_status" >&5 -+ echo "$as_me:18015: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - - if test -n "$cf_db_libs" ; then -@@ -16725,11 +18032,11 @@ - done - - fi --echo "$as_me:16728: result: $cf_cv_hashed_db_libs" >&5 -+echo "$as_me:18035: result: $cf_cv_hashed_db_libs" >&5 - echo "${ECHO_T}$cf_cv_hashed_db_libs" >&6 - - if test "$cf_cv_hashed_db_libs" = unknown ; then -- { { echo "$as_me:16732: error: Cannot determine library for db" >&5 -+ { { echo "$as_me:18039: error: Cannot determine library for db" >&5 - echo "$as_me: error: Cannot determine library for db" >&2;} - { (exit 1); exit 1; }; } - elif test "$cf_cv_hashed_db_libs" != default ; then -@@ -16739,7 +18046,7 @@ - - else - -- { { echo "$as_me:16742: error: Cannot find db.h" >&5 -+ { { echo "$as_me:18049: error: Cannot find db.h" >&5 - echo "$as_me: error: Cannot find db.h" >&2;} - { (exit 1); exit 1; }; } - -@@ -16754,7 +18061,7 @@ - - # Just in case, check if the C compiler has a bool type. - --echo "$as_me:16757: checking if we should include stdbool.h" >&5 -+echo "$as_me:18064: checking if we should include stdbool.h" >&5 - echo $ECHO_N "checking if we should include stdbool.h... $ECHO_C" >&6 - - if test "${cf_cv_header_stdbool_h+set}" = set; then -@@ -16762,7 +18069,7 @@ - else - - cat >conftest.$ac_ext <<_ACEOF --#line 16765 "configure" -+#line 18072 "configure" - #include "confdefs.h" - - int -@@ -16774,23 +18081,23 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:16777: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:18084: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:16780: \$? = $ac_status" >&5 -+ echo "$as_me:18087: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:16783: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:18090: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:16786: \$? = $ac_status" >&5 -+ echo "$as_me:18093: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_cv_header_stdbool_h=0 - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 - cat >conftest.$ac_ext <<_ACEOF --#line 16793 "configure" -+#line 18100 "configure" - #include "confdefs.h" - - #ifndef __BEOS__ -@@ -16806,16 +18113,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:16809: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:18116: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:16812: \$? = $ac_status" >&5 -+ echo "$as_me:18119: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:16815: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:18122: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:16818: \$? = $ac_status" >&5 -+ echo "$as_me:18125: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_cv_header_stdbool_h=1 - else -@@ -16829,13 +18136,13 @@ - fi - - if test "$cf_cv_header_stdbool_h" = 1 --then echo "$as_me:16832: result: yes" >&5 -+then echo "$as_me:18139: result: yes" >&5 - echo "${ECHO_T}yes" >&6 --else echo "$as_me:16834: result: no" >&5 -+else echo "$as_me:18141: result: no" >&5 - echo "${ECHO_T}no" >&6 - fi - --echo "$as_me:16838: checking for builtin bool type" >&5 -+echo "$as_me:18145: checking for builtin bool type" >&5 - echo $ECHO_N "checking for builtin bool type... $ECHO_C" >&6 - - if test "${cf_cv_cc_bool_type+set}" = set; then -@@ -16843,7 +18150,7 @@ - else - - cat >conftest.$ac_ext <<_ACEOF --#line 16846 "configure" -+#line 18153 "configure" - #include "confdefs.h" - - #include -@@ -16858,16 +18165,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:16861: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:18168: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:16864: \$? = $ac_status" >&5 -+ echo "$as_me:18171: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:16867: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:18174: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:16870: \$? = $ac_status" >&5 -+ echo "$as_me:18177: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_cv_cc_bool_type=1 - else -@@ -16880,9 +18187,9 @@ - fi - - if test "$cf_cv_cc_bool_type" = 1 --then echo "$as_me:16883: result: yes" >&5 -+then echo "$as_me:18190: result: yes" >&5 - echo "${ECHO_T}yes" >&6 --else echo "$as_me:16885: result: no" >&5 -+else echo "$as_me:18192: result: no" >&5 - echo "${ECHO_T}no" >&6 - fi - -@@ -16904,7 +18211,7 @@ - cf_stdcpp_libname=stdc++ - ;; - esac --echo "$as_me:16907: checking for library $cf_stdcpp_libname" >&5 -+echo "$as_me:18214: checking for library $cf_stdcpp_libname" >&5 - echo $ECHO_N "checking for library $cf_stdcpp_libname... $ECHO_C" >&6 - if test "${cf_cv_libstdcpp+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -16913,7 +18220,7 @@ - cf_save="$LIBS" - LIBS="-l$cf_stdcpp_libname $LIBS" - cat >conftest.$ac_ext <<_ACEOF --#line 16916 "configure" -+#line 18223 "configure" - #include "confdefs.h" - - #include -@@ -16929,16 +18236,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:16932: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:18239: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:16935: \$? = $ac_status" >&5 -+ echo "$as_me:18242: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:16938: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:18245: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:16941: \$? = $ac_status" >&5 -+ echo "$as_me:18248: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_cv_libstdcpp=yes - else -@@ -16950,12 +18257,12 @@ - LIBS="$cf_save" - - fi --echo "$as_me:16953: result: $cf_cv_libstdcpp" >&5 -+echo "$as_me:18260: result: $cf_cv_libstdcpp" >&5 - echo "${ECHO_T}$cf_cv_libstdcpp" >&6 - test "$cf_cv_libstdcpp" = yes && CXXLIBS="-l$cf_stdcpp_libname $CXXLIBS" - fi - -- echo "$as_me:16958: checking whether $CXX understands -c and -o together" >&5 -+ echo "$as_me:18265: checking whether $CXX understands -c and -o together" >&5 - echo $ECHO_N "checking whether $CXX understands -c and -o together... $ECHO_C" >&6 - if test "${cf_cv_prog_CXX_c_o+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -16971,15 +18278,15 @@ - # We do the test twice because some compilers refuse to overwrite an - # existing .o file with -o, though they will create one. - ac_try='$CXX -c conftest.$ac_ext -o conftest2.$ac_objext >&5' --if { (eval echo "$as_me:16974: \"$ac_try\"") >&5 -+if { (eval echo "$as_me:18281: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:16977: \$? = $ac_status" >&5 -+ echo "$as_me:18284: \$? = $ac_status" >&5 - (exit $ac_status); } && -- test -f conftest2.$ac_objext && { (eval echo "$as_me:16979: \"$ac_try\"") >&5 -+ test -f conftest2.$ac_objext && { (eval echo "$as_me:18286: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:16982: \$? = $ac_status" >&5 -+ echo "$as_me:18289: \$? = $ac_status" >&5 - (exit $ac_status); }; - then - eval cf_cv_prog_CXX_c_o=yes -@@ -16990,10 +18297,10 @@ - - fi - if test $cf_cv_prog_CXX_c_o = yes; then -- echo "$as_me:16993: result: yes" >&5 -+ echo "$as_me:18300: result: yes" >&5 - echo "${ECHO_T}yes" >&6 - else -- echo "$as_me:16996: result: no" >&5 -+ echo "$as_me:18303: result: no" >&5 - echo "${ECHO_T}no" >&6 - fi - -@@ -17013,12 +18320,12 @@ - ;; - esac - if test "$GXX" = yes; then -- echo "$as_me:17016: checking for lib$cf_gpp_libname" >&5 -+ echo "$as_me:18323: checking for lib$cf_gpp_libname" >&5 - echo $ECHO_N "checking for lib$cf_gpp_libname... $ECHO_C" >&6 - cf_save="$LIBS" - LIBS="-l$cf_gpp_libname $LIBS" - cat >conftest.$ac_ext <<_ACEOF --#line 17021 "configure" -+#line 18328 "configure" - #include "confdefs.h" - - #include <$cf_gpp_libname/builtin.h> -@@ -17032,26 +18339,28 @@ - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:17035: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:18342: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:17038: \$? = $ac_status" >&5 -+ echo "$as_me:18345: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:17041: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:18348: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:17044: \$? = $ac_status" >&5 -+ echo "$as_me:18351: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_cxx_library=yes - CXXLIBS="-l$cf_gpp_libname $CXXLIBS" - if test "$cf_gpp_libname" = cpp ; then -- cat >>confdefs.h <<\EOF -+ -+cat >>confdefs.h <<\EOF - #define HAVE_GPP_BUILTIN_H 1 - EOF - - else -- cat >>confdefs.h <<\EOF -+ -+cat >>confdefs.h <<\EOF - #define HAVE_GXX_BUILTIN_H 1 - EOF - -@@ -17060,7 +18369,7 @@ - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 - cat >conftest.$ac_ext <<_ACEOF --#line 17063 "configure" -+#line 18372 "configure" - #include "confdefs.h" - - #include -@@ -17074,20 +18383,21 @@ - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:17077: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:18386: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:17080: \$? = $ac_status" >&5 -+ echo "$as_me:18389: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:17083: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:18392: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:17086: \$? = $ac_status" >&5 -+ echo "$as_me:18395: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_cxx_library=yes - CXXLIBS="-l$cf_gpp_libname $CXXLIBS" -- cat >>confdefs.h <<\EOF -+ -+cat >>confdefs.h <<\EOF - #define HAVE_BUILTIN_H 1 - EOF - -@@ -17100,7 +18410,7 @@ - fi - rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - LIBS="$cf_save" -- echo "$as_me:17103: result: $cf_cxx_library" >&5 -+ echo "$as_me:18413: result: $cf_cxx_library" >&5 - echo "${ECHO_T}$cf_cxx_library" >&6 - fi - -@@ -17116,7 +18426,7 @@ - ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' - ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - ac_main_return=return --echo "$as_me:17119: checking how to run the C++ preprocessor" >&5 -+echo "$as_me:18429: checking how to run the C++ preprocessor" >&5 - echo $ECHO_N "checking how to run the C++ preprocessor... $ECHO_C" >&6 - if test -z "$CXXCPP"; then - if test "${ac_cv_prog_CXXCPP+set}" = set; then -@@ -17133,18 +18443,18 @@ - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat >conftest.$ac_ext <<_ACEOF --#line 17136 "configure" -+#line 18446 "configure" - #include "confdefs.h" - #include - Syntax error - _ACEOF --if { (eval echo "$as_me:17141: \"$ac_cpp conftest.$ac_ext\"") >&5 -+if { (eval echo "$as_me:18451: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 -- echo "$as_me:17147: \$? = $ac_status" >&5 -+ echo "$as_me:18457: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_cxx_preproc_warn_flag -@@ -17167,17 +18477,17 @@ - # OK, works on sane cases. Now check whether non-existent headers - # can be detected and how. - cat >conftest.$ac_ext <<_ACEOF --#line 17170 "configure" -+#line 18480 "configure" - #include "confdefs.h" - #include - _ACEOF --if { (eval echo "$as_me:17174: \"$ac_cpp conftest.$ac_ext\"") >&5 -+if { (eval echo "$as_me:18484: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 -- echo "$as_me:17180: \$? = $ac_status" >&5 -+ echo "$as_me:18490: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_cxx_preproc_warn_flag -@@ -17214,7 +18524,7 @@ - else - ac_cv_prog_CXXCPP=$CXXCPP - fi --echo "$as_me:17217: result: $CXXCPP" >&5 -+echo "$as_me:18527: result: $CXXCPP" >&5 - echo "${ECHO_T}$CXXCPP" >&6 - ac_preproc_ok=false - for ac_cxx_preproc_warn_flag in '' yes -@@ -17224,18 +18534,18 @@ - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat >conftest.$ac_ext <<_ACEOF --#line 17227 "configure" -+#line 18537 "configure" - #include "confdefs.h" - #include - Syntax error - _ACEOF --if { (eval echo "$as_me:17232: \"$ac_cpp conftest.$ac_ext\"") >&5 -+if { (eval echo "$as_me:18542: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 -- echo "$as_me:17238: \$? = $ac_status" >&5 -+ echo "$as_me:18548: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_cxx_preproc_warn_flag -@@ -17258,17 +18568,76 @@ - # OK, works on sane cases. Now check whether non-existent headers - # can be detected and how. - cat >conftest.$ac_ext <<_ACEOF --#line 17261 "configure" -+#line 18571 "configure" -+#include "confdefs.h" -+#include -+_ACEOF -+if { (eval echo "$as_me:18575: \"$ac_cpp conftest.$ac_ext\"") >&5 -+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 -+ ac_status=$? -+ egrep -v '^ *\+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 -+ echo "$as_me:18581: \$? = $ac_status" >&5 -+ (exit $ac_status); } >/dev/null; then -+ if test -s conftest.err; then -+ ac_cpp_err=$ac_cxx_preproc_warn_flag -+ else -+ ac_cpp_err= -+ fi -+else -+ ac_cpp_err=yes -+fi -+if test -z "$ac_cpp_err"; then -+ # Broken: success on invalid input. -+continue -+else -+ echo "$as_me: failed program was:" >&5 -+ cat conftest.$ac_ext >&5 -+ # Passes both tests. -+ac_preproc_ok=: -+break -+fi -+rm -f conftest.err conftest.$ac_ext -+ -+done -+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -+rm -f conftest.err conftest.$ac_ext -+if $ac_preproc_ok; then -+ : -+else -+ { { echo "$as_me:18609: error: C++ preprocessor \"$CXXCPP\" fails sanity check" >&5 -+echo "$as_me: error: C++ preprocessor \"$CXXCPP\" fails sanity check" >&2;} -+ { (exit 1); exit 1; }; } -+fi -+ -+ac_ext=cc -+ac_cpp='$CXXCPP $CPPFLAGS' -+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu -+ac_main_return=return -+ -+for ac_header in typeinfo -+do -+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -+echo "$as_me:18624: checking for $ac_header" >&5 -+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -+if eval "test \"\${$as_ac_Header+set}\" = set"; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ cat >conftest.$ac_ext <<_ACEOF -+#line 18630 "configure" - #include "confdefs.h" --#include -+#include <$ac_header> - _ACEOF --if { (eval echo "$as_me:17265: \"$ac_cpp conftest.$ac_ext\"") >&5 -+if { (eval echo "$as_me:18634: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 -- echo "$as_me:17271: \$? = $ac_status" >&5 -+ echo "$as_me:18640: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_cxx_preproc_warn_flag -@@ -17279,55 +18648,44 @@ - ac_cpp_err=yes - fi - if test -z "$ac_cpp_err"; then -- # Broken: success on invalid input. --continue -+ eval "$as_ac_Header=yes" - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 -- # Passes both tests. --ac_preproc_ok=: --break -+ eval "$as_ac_Header=no" - fi - rm -f conftest.err conftest.$ac_ext -- --done --# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. --rm -f conftest.err conftest.$ac_ext --if $ac_preproc_ok; then -- : --else -- { { echo "$as_me:17299: error: C++ preprocessor \"$CXXCPP\" fails sanity check" >&5 --echo "$as_me: error: C++ preprocessor \"$CXXCPP\" fails sanity check" >&2;} -- { (exit 1); exit 1; }; } - fi -+echo "$as_me:18659: result: `eval echo '${'$as_ac_Header'}'`" >&5 -+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -+if test `eval echo '${'$as_ac_Header'}'` = yes; then -+ cat >>confdefs.h <&5 -+echo "$as_me:18672: checking for $ac_header" >&5 - echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 - if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - cat >conftest.$ac_ext <<_ACEOF --#line 17320 "configure" -+#line 18678 "configure" - #include "confdefs.h" - #include <$ac_header> - _ACEOF --if { (eval echo "$as_me:17324: \"$ac_cpp conftest.$ac_ext\"") >&5 -+if { (eval echo "$as_me:18682: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 -- echo "$as_me:17330: \$? = $ac_status" >&5 -+ echo "$as_me:18688: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_cxx_preproc_warn_flag -@@ -17346,7 +18704,7 @@ - fi - rm -f conftest.err conftest.$ac_ext - fi --echo "$as_me:17349: result: `eval echo '${'$as_ac_Header'}'`" >&5 -+echo "$as_me:18707: result: `eval echo '${'$as_ac_Header'}'`" >&5 - echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 - if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <&5 -+if test x"$ac_cv_header_iostream" = xyes ; then -+ echo "$as_me:18718: checking if iostream uses std-namespace" >&5 - echo $ECHO_N "checking if iostream uses std-namespace... $ECHO_C" >&6 -- cat >conftest.$ac_ext <<_ACEOF --#line 17363 "configure" -+ cat >conftest.$ac_ext <<_ACEOF -+#line 18721 "configure" - #include "confdefs.h" - - #include -@@ -17377,16 +18735,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:17380: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:18738: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:17383: \$? = $ac_status" >&5 -+ echo "$as_me:18741: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:17386: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:18744: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:17389: \$? = $ac_status" >&5 -+ echo "$as_me:18747: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_iostream_namespace=yes - else -@@ -17395,17 +18753,18 @@ - cf_iostream_namespace=no - fi - rm -f conftest.$ac_objext conftest.$ac_ext -- echo "$as_me:17398: result: $cf_iostream_namespace" >&5 -+ echo "$as_me:18756: result: $cf_iostream_namespace" >&5 - echo "${ECHO_T}$cf_iostream_namespace" >&6 -- if test "$cf_iostream_namespace" = yes ; then -- cat >>confdefs.h <<\EOF -+ if test "$cf_iostream_namespace" = yes ; then -+ -+cat >>confdefs.h <<\EOF - #define IOSTREAM_NAMESPACE 1 - EOF - -- fi -- fi -+ fi -+fi - --echo "$as_me:17408: checking if we should include stdbool.h" >&5 -+echo "$as_me:18767: checking if we should include stdbool.h" >&5 - echo $ECHO_N "checking if we should include stdbool.h... $ECHO_C" >&6 - - if test "${cf_cv_header_stdbool_h+set}" = set; then -@@ -17413,7 +18772,7 @@ - else - - cat >conftest.$ac_ext <<_ACEOF --#line 17416 "configure" -+#line 18775 "configure" - #include "confdefs.h" - - int -@@ -17425,23 +18784,23 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:17428: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:18787: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:17431: \$? = $ac_status" >&5 -+ echo "$as_me:18790: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:17434: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:18793: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:17437: \$? = $ac_status" >&5 -+ echo "$as_me:18796: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_cv_header_stdbool_h=0 - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 - cat >conftest.$ac_ext <<_ACEOF --#line 17444 "configure" -+#line 18803 "configure" - #include "confdefs.h" - - #ifndef __BEOS__ -@@ -17457,16 +18816,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:17460: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:18819: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:17463: \$? = $ac_status" >&5 -+ echo "$as_me:18822: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:17466: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:18825: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:17469: \$? = $ac_status" >&5 -+ echo "$as_me:18828: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_cv_header_stdbool_h=1 - else -@@ -17480,13 +18839,13 @@ - fi - - if test "$cf_cv_header_stdbool_h" = 1 --then echo "$as_me:17483: result: yes" >&5 -+then echo "$as_me:18842: result: yes" >&5 - echo "${ECHO_T}yes" >&6 --else echo "$as_me:17485: result: no" >&5 -+else echo "$as_me:18844: result: no" >&5 - echo "${ECHO_T}no" >&6 - fi - --echo "$as_me:17489: checking for builtin bool type" >&5 -+echo "$as_me:18848: checking for builtin bool type" >&5 - echo $ECHO_N "checking for builtin bool type... $ECHO_C" >&6 - - if test "${cf_cv_builtin_bool+set}" = set; then -@@ -17494,7 +18853,7 @@ - else - - cat >conftest.$ac_ext <<_ACEOF --#line 17497 "configure" -+#line 18856 "configure" - #include "confdefs.h" - - #include -@@ -17509,16 +18868,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:17512: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:18871: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:17515: \$? = $ac_status" >&5 -+ echo "$as_me:18874: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:17518: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:18877: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:17521: \$? = $ac_status" >&5 -+ echo "$as_me:18880: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_cv_builtin_bool=1 - else -@@ -17531,13 +18890,13 @@ - fi - - if test "$cf_cv_builtin_bool" = 1 --then echo "$as_me:17534: result: yes" >&5 -+then echo "$as_me:18893: result: yes" >&5 - echo "${ECHO_T}yes" >&6 --else echo "$as_me:17536: result: no" >&5 -+else echo "$as_me:18895: result: no" >&5 - echo "${ECHO_T}no" >&6 - fi - --echo "$as_me:17540: checking for size of bool" >&5 -+echo "$as_me:18899: checking for size of bool" >&5 - echo $ECHO_N "checking for size of bool... $ECHO_C" >&6 - if test "${cf_cv_type_of_bool+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -17548,7 +18907,7 @@ - cf_cv_type_of_bool=unknown - else - cat >conftest.$ac_ext <<_ACEOF --#line 17551 "configure" -+#line 18910 "configure" - #include "confdefs.h" - - #include -@@ -17572,7 +18931,7 @@ - - #endif - --main() -+int main() - { - FILE *fp = fopen("cf_test.out", "w"); - if (fp != 0) { -@@ -17590,15 +18949,15 @@ - - _ACEOF - rm -f conftest$ac_exeext --if { (eval echo "$as_me:17593: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:18952: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:17596: \$? = $ac_status" >&5 -+ echo "$as_me:18955: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' -- { (eval echo "$as_me:17598: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:18957: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:17601: \$? = $ac_status" >&5 -+ echo "$as_me:18960: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_cv_type_of_bool=`cat cf_test.out` - if test -z "$cf_cv_type_of_bool"; then -@@ -17616,30 +18975,36 @@ - fi - - rm -f cf_test.out --echo "$as_me:17619: result: $cf_cv_type_of_bool" >&5 -+echo "$as_me:18978: result: $cf_cv_type_of_bool" >&5 - echo "${ECHO_T}$cf_cv_type_of_bool" >&6 - if test "$cf_cv_type_of_bool" = unknown ; then - case .$NCURSES_BOOL in #(vi - .auto|.) NCURSES_BOOL=unsigned;; - esac -- { echo "$as_me:17625: WARNING: Assuming $NCURSES_BOOL for type of bool" >&5 -+ { echo "$as_me:18984: WARNING: Assuming $NCURSES_BOOL for type of bool" >&5 - echo "$as_me: WARNING: Assuming $NCURSES_BOOL for type of bool" >&2;} - cf_cv_type_of_bool=$NCURSES_BOOL - fi - --echo "$as_me:17630: checking for special defines needed for etip.h" >&5 -+echo "$as_me:18989: checking for special defines needed for etip.h" >&5 - echo $ECHO_N "checking for special defines needed for etip.h... $ECHO_C" >&6 - cf_save_CXXFLAGS="$CXXFLAGS" - cf_result="none" -+ -+# etip.h includes ncurses.h which includes ncurses_dll.h -+# But ncurses_dll.h is generated - fix here. -+test -d include || mkdir include -+test -f include/ncurses_dll.h || sed -e 's/@NCURSES_WRAP_PREFIX@/'$NCURSES_WRAP_PREFIX'/g' ${srcdir}/include/ncurses_dll.h.in >include/ncurses_dll.h -+ - for cf_math in "" MATH_H - do - for cf_excp in "" MATH_EXCEPTION - do -- CXXFLAGS="$cf_save_CXXFLAGS -I${srcdir}/c++ -I${srcdir}/menu -I${srcdir}/include" -+ CXXFLAGS="$cf_save_CXXFLAGS -I${srcdir}/c++ -I${srcdir}/menu -Iinclude -I${srcdir}/include" - test -n "$cf_math" && CXXFLAGS="$CXXFLAGS -DETIP_NEEDS_${cf_math}" - test -n "$cf_excp" && CXXFLAGS="$CXXFLAGS -DETIP_NEEDS_${cf_excp}" - cat >conftest.$ac_ext <<_ACEOF --#line 17642 "configure" -+#line 19007 "configure" - #include "confdefs.h" - - #include -@@ -17653,16 +19018,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:17656: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:19021: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:17659: \$? = $ac_status" >&5 -+ echo "$as_me:19024: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:17662: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:19027: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:17665: \$? = $ac_status" >&5 -+ echo "$as_me:19030: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - - test -n "$cf_math" && cat >>confdefs.h <&5 -@@ -17683,12 +19048,12 @@ - rm -f conftest.$ac_objext conftest.$ac_ext - done - done --echo "$as_me:17686: result: $cf_result" >&5 -+echo "$as_me:19051: result: $cf_result" >&5 - echo "${ECHO_T}$cf_result" >&6 - CXXFLAGS="$cf_save_CXXFLAGS" - - if test -n "$CXX"; then --echo "$as_me:17691: checking if $CXX accepts parameter initialization" >&5 -+echo "$as_me:19056: checking if $CXX accepts parameter initialization" >&5 - echo $ECHO_N "checking if $CXX accepts parameter initialization... $ECHO_C" >&6 - if test "${cf_cv_cpp_param_init+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -17705,7 +19070,7 @@ - cf_cv_cpp_param_init=unknown - else - cat >conftest.$ac_ext <<_ACEOF --#line 17708 "configure" -+#line 19073 "configure" - #include "confdefs.h" - - class TEST { -@@ -17720,19 +19085,19 @@ - { - value = x; - } --void main() { } -+int main() { } - - _ACEOF - rm -f conftest$ac_exeext --if { (eval echo "$as_me:17727: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:19092: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:17730: \$? = $ac_status" >&5 -+ echo "$as_me:19095: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' -- { (eval echo "$as_me:17732: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:19097: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:17735: \$? = $ac_status" >&5 -+ echo "$as_me:19100: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_cv_cpp_param_init=yes - else -@@ -17751,16 +19116,17 @@ - ac_main_return=return - - fi --echo "$as_me:17754: result: $cf_cv_cpp_param_init" >&5 -+echo "$as_me:19119: result: $cf_cv_cpp_param_init" >&5 - echo "${ECHO_T}$cf_cv_cpp_param_init" >&6 - fi --test "$cf_cv_cpp_param_init" = yes && cat >>confdefs.h <<\EOF -+test "$cf_cv_cpp_param_init" = yes && -+cat >>confdefs.h <<\EOF - #define CPP_HAS_PARAM_INIT 1 - EOF - - if test -n "$CXX"; then - --echo "$as_me:17763: checking if $CXX accepts static_cast" >&5 -+echo "$as_me:19129: checking if $CXX accepts static_cast" >&5 - echo $ECHO_N "checking if $CXX accepts static_cast... $ECHO_C" >&6 - if test "${cf_cv_cpp_static_cast+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -17774,7 +19140,7 @@ - ac_main_return=return - - cat >conftest.$ac_ext <<_ACEOF --#line 17777 "configure" -+#line 19143 "configure" - #include "confdefs.h" - - class NCursesPanel -@@ -17786,7 +19152,7 @@ - int begin_x = 0) - { - } -- -+ NCursesPanel(); - ~NCursesPanel(); - }; - -@@ -17818,16 +19184,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:17821: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:19187: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:17824: \$? = $ac_status" >&5 -+ echo "$as_me:19190: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:17827: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:19193: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:17830: \$? = $ac_status" >&5 -+ echo "$as_me:19196: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_cv_cpp_static_cast=yes - else -@@ -17845,12 +19211,13 @@ - ac_main_return=return - - fi --echo "$as_me:17848: result: $cf_cv_cpp_static_cast" >&5 -+echo "$as_me:19214: result: $cf_cv_cpp_static_cast" >&5 - echo "${ECHO_T}$cf_cv_cpp_static_cast" >&6 - - fi - --test "$cf_cv_cpp_static_cast" = yes && cat >>confdefs.h <<\EOF -+test "$cf_cv_cpp_static_cast" = yes && -+cat >>confdefs.h <<\EOF - #define CPP_HAS_STATIC_CAST 1 - EOF - -@@ -17893,7 +19260,7 @@ - else - if test "$cf_cv_header_stdbool_h" = 1 ; then - --echo "$as_me:17896: checking for size of bool" >&5 -+echo "$as_me:19263: checking for size of bool" >&5 - echo $ECHO_N "checking for size of bool... $ECHO_C" >&6 - if test "${cf_cv_type_of_bool+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -17904,7 +19271,7 @@ - cf_cv_type_of_bool=unknown - else - cat >conftest.$ac_ext <<_ACEOF --#line 17907 "configure" -+#line 19274 "configure" - #include "confdefs.h" - - #include -@@ -17928,7 +19295,7 @@ - - #endif - --main() -+int main() - { - FILE *fp = fopen("cf_test.out", "w"); - if (fp != 0) { -@@ -17946,15 +19313,15 @@ - - _ACEOF - rm -f conftest$ac_exeext --if { (eval echo "$as_me:17949: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:19316: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:17952: \$? = $ac_status" >&5 -+ echo "$as_me:19319: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' -- { (eval echo "$as_me:17954: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:19321: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:17957: \$? = $ac_status" >&5 -+ echo "$as_me:19324: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_cv_type_of_bool=`cat cf_test.out` - if test -z "$cf_cv_type_of_bool"; then -@@ -17972,25 +19339,25 @@ - fi - - rm -f cf_test.out --echo "$as_me:17975: result: $cf_cv_type_of_bool" >&5 -+echo "$as_me:19342: result: $cf_cv_type_of_bool" >&5 - echo "${ECHO_T}$cf_cv_type_of_bool" >&6 - if test "$cf_cv_type_of_bool" = unknown ; then - case .$NCURSES_BOOL in #(vi - .auto|.) NCURSES_BOOL=unsigned;; - esac -- { echo "$as_me:17981: WARNING: Assuming $NCURSES_BOOL for type of bool" >&5 -+ { echo "$as_me:19348: WARNING: Assuming $NCURSES_BOOL for type of bool" >&5 - echo "$as_me: WARNING: Assuming $NCURSES_BOOL for type of bool" >&2;} - cf_cv_type_of_bool=$NCURSES_BOOL - fi - - else -- echo "$as_me:17987: checking for fallback type of bool" >&5 -+ echo "$as_me:19354: checking for fallback type of bool" >&5 - echo $ECHO_N "checking for fallback type of bool... $ECHO_C" >&6 - case "$host_cpu" in #(vi - i?86) cf_cv_type_of_bool=char ;; #(vi - *) cf_cv_type_of_bool=int ;; - esac -- echo "$as_me:17993: result: $cf_cv_type_of_bool" >&5 -+ echo "$as_me:19360: result: $cf_cv_type_of_bool" >&5 - echo "${ECHO_T}$cf_cv_type_of_bool" >&6 - fi - fi -@@ -18019,7 +19386,7 @@ - - if test "$cf_with_ada" != "no" ; then - if test "$with_libtool" != "no"; then -- { echo "$as_me:18022: WARNING: libtool does not support Ada - disabling feature" >&5 -+ { echo "$as_me:19389: WARNING: libtool does not support Ada - disabling feature" >&5 - echo "$as_me: WARNING: libtool does not support Ada - disabling feature" >&2;} - cf_with_ada=no - fi -@@ -18030,7 +19397,7 @@ - cf_ada_make=gnatmake - # Extract the first word of "$cf_ada_make", so it can be a program name with args. - set dummy $cf_ada_make; ac_word=$2 --echo "$as_me:18033: checking for $ac_word" >&5 -+echo "$as_me:19400: checking for $ac_word" >&5 - echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 - if test "${ac_cv_prog_gnat_exists+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -18045,7 +19412,7 @@ - test -z "$ac_dir" && ac_dir=. - $as_executable_p "$ac_dir/$ac_word" || continue - ac_cv_prog_gnat_exists="yes" --echo "$as_me:18048: found $ac_dir/$ac_word" >&5 -+echo "$as_me:19415: found $ac_dir/$ac_word" >&5 - break - done - -@@ -18054,31 +19421,32 @@ - fi - gnat_exists=$ac_cv_prog_gnat_exists - if test -n "$gnat_exists"; then -- echo "$as_me:18057: result: $gnat_exists" >&5 -+ echo "$as_me:19424: result: $gnat_exists" >&5 - echo "${ECHO_T}$gnat_exists" >&6 - else -- echo "$as_me:18060: result: no" >&5 -+ echo "$as_me:19427: result: no" >&5 - echo "${ECHO_T}no" >&6 - fi - - if test "$ac_cv_prog_gnat_exists" = no; then - cf_ada_make= -+ cf_cv_prog_gnat_correct=no - else - --echo "$as_me:18068: checking for gnat version" >&5 -+echo "$as_me:19436: checking for gnat version" >&5 - echo $ECHO_N "checking for gnat version... $ECHO_C" >&6 - cf_gnat_version=`${cf_ada_make:-gnatmake} -v 2>&1 | \ - grep '[0-9].[0-9][0-9]*' |\ - sed -e '2,$d' -e 's/[^0-9 \.]//g' -e 's/^[ ]*//' -e 's/ .*//'` --echo "$as_me:18073: result: $cf_gnat_version" >&5 -+echo "$as_me:19441: result: $cf_gnat_version" >&5 - echo "${ECHO_T}$cf_gnat_version" >&6 - - case $cf_gnat_version in #(vi --3.1[1-9]*|3.[2-9]*|[4-9].*) #(vi -+3.1[1-9]*|3.[2-9]*|[4-9].*|20[0-9][0-9]) #(vi - cf_cv_prog_gnat_correct=yes - ;; - *) -- { echo "$as_me:18081: WARNING: Unsupported GNAT version $cf_gnat_version. We require 3.11 or better. Disabling Ada95 binding." >&5 -+ { echo "$as_me:19449: WARNING: Unsupported GNAT version $cf_gnat_version. We require 3.11 or better. Disabling Ada95 binding." >&5 - echo "$as_me: WARNING: Unsupported GNAT version $cf_gnat_version. We require 3.11 or better. Disabling Ada95 binding." >&2;} - cf_cv_prog_gnat_correct=no - ;; -@@ -18086,7 +19454,7 @@ - - # Extract the first word of "m4", so it can be a program name with args. - set dummy m4; ac_word=$2 --echo "$as_me:18089: checking for $ac_word" >&5 -+echo "$as_me:19457: checking for $ac_word" >&5 - echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 - if test "${ac_cv_prog_M4_exists+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -18101,7 +19469,7 @@ - test -z "$ac_dir" && ac_dir=. - $as_executable_p "$ac_dir/$ac_word" || continue - ac_cv_prog_M4_exists="yes" --echo "$as_me:18104: found $ac_dir/$ac_word" >&5 -+echo "$as_me:19472: found $ac_dir/$ac_word" >&5 - break - done - -@@ -18110,10 +19478,10 @@ - fi - M4_exists=$ac_cv_prog_M4_exists - if test -n "$M4_exists"; then -- echo "$as_me:18113: result: $M4_exists" >&5 -+ echo "$as_me:19481: result: $M4_exists" >&5 - echo "${ECHO_T}$M4_exists" >&6 - else -- echo "$as_me:18116: result: no" >&5 -+ echo "$as_me:19484: result: no" >&5 - echo "${ECHO_T}no" >&6 - fi - -@@ -18122,7 +19490,7 @@ - echo Ada95 binding required program m4 not found. Ada95 binding disabled. - fi - if test "$cf_cv_prog_gnat_correct" = yes; then -- echo "$as_me:18125: checking if GNAT works" >&5 -+ echo "$as_me:19493: checking if GNAT works" >&5 - echo $ECHO_N "checking if GNAT works... $ECHO_C" >&6 - - rm -rf conftest* *~conftest* -@@ -18150,32 +19518,36 @@ - fi - rm -rf conftest* *~conftest* - -- echo "$as_me:18153: result: $cf_cv_prog_gnat_correct" >&5 -+ echo "$as_me:19521: result: $cf_cv_prog_gnat_correct" >&5 - echo "${ECHO_T}$cf_cv_prog_gnat_correct" >&6 - fi - fi - -- if test "$cf_cv_prog_gnat_correct" = yes; then -+ if test "x$cf_cv_prog_gnat_correct" = xyes; then - - ADAFLAGS="$ADAFLAGS -gnatpn" - -- # make ADAFLAGS consistent with CFLAGS -- case "$CFLAGS" in -- *-g*) -+ echo "$as_me:19530: checking optimization options for ADAFLAGS" >&5 -+echo $ECHO_N "checking optimization options for ADAFLAGS... $ECHO_C" >&6 -+ case "$CFLAGS" in -+ *-g*) - - ADAFLAGS="$ADAFLAGS -g" - -- ;; -- esac -- case "$CFLAGS" in -- *-O*) -+ ;; -+ esac -+ case "$CFLAGS" in -+ *-O*) -+ cf_O_flag=`echo "$CFLAGS" |sed -e 's/^.*-O/-O/' -e 's/[ ].*//'` - -- ADAFLAGS="$ADAFLAGS -O3" -+ ADAFLAGS="$ADAFLAGS $cf_O_flag" - -- ;; -- esac -+ ;; -+ esac -+ echo "$as_me:19547: result: $ADAFLAGS" >&5 -+echo "${ECHO_T}$ADAFLAGS" >&6 - --echo "$as_me:18178: checking if GNAT supports generics" >&5 -+echo "$as_me:19550: checking if GNAT supports generics" >&5 - echo $ECHO_N "checking if GNAT supports generics... $ECHO_C" >&6 - case $cf_gnat_version in #(vi - 3.[1-9]*|[4-9].*) #(vi -@@ -18185,7 +19557,7 @@ - cf_gnat_generics=no - ;; - esac --echo "$as_me:18188: result: $cf_gnat_generics" >&5 -+echo "$as_me:19560: result: $cf_gnat_generics" >&5 - echo "${ECHO_T}$cf_gnat_generics" >&6 - - if test "$cf_gnat_generics" = yes -@@ -18197,7 +19569,7 @@ - cf_generic_objects= - fi - --echo "$as_me:18200: checking if GNAT supports SIGINT" >&5 -+echo "$as_me:19572: checking if GNAT supports SIGINT" >&5 - echo $ECHO_N "checking if GNAT supports SIGINT... $ECHO_C" >&6 - if test "${cf_cv_gnat_sigint+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -18245,7 +19617,7 @@ - rm -rf conftest* *~conftest* - - fi --echo "$as_me:18248: result: $cf_cv_gnat_sigint" >&5 -+echo "$as_me:19620: result: $cf_cv_gnat_sigint" >&5 - echo "${ECHO_T}$cf_cv_gnat_sigint" >&6 - - if test $cf_cv_gnat_sigint = yes ; then -@@ -18254,7 +19626,7 @@ - USE_GNAT_SIGINT="#" - fi - --echo "$as_me:18257: checking if GNAT pragma Unreferenced works" >&5 -+echo "$as_me:19629: checking if GNAT pragma Unreferenced works" >&5 - echo $ECHO_N "checking if GNAT pragma Unreferenced works... $ECHO_C" >&6 - if test "${cf_cv_pragma_unreferenced+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -18285,7 +19657,7 @@ - rm -rf conftest* *~conftest* - - fi --echo "$as_me:18288: result: $cf_cv_pragma_unreferenced" >&5 -+echo "$as_me:19660: result: $cf_cv_pragma_unreferenced" >&5 - echo "${ECHO_T}$cf_cv_pragma_unreferenced" >&6 - - # if the pragma is supported, use it (needed in the Trace code). -@@ -18298,14 +19670,14 @@ - cf_gnat_libraries=no - cf_gnat_projects=no - --echo "$as_me:18301: checking if GNAT supports project files" >&5 -+echo "$as_me:19673: checking if GNAT supports project files" >&5 - echo $ECHO_N "checking if GNAT supports project files... $ECHO_C" >&6 - case $cf_gnat_version in #(vi - 3.[0-9]*) #(vi - ;; - *) - case $cf_cv_system_name in #(vi -- cygwin*) #(vi -+ cygwin*|msys*) #(vi - ;; - *) - mkdir conftest.src conftest.bin conftest.lib -@@ -18366,14 +19738,14 @@ - esac - ;; - esac --echo "$as_me:18369: result: $cf_gnat_projects" >&5 -+echo "$as_me:19741: result: $cf_gnat_projects" >&5 - echo "${ECHO_T}$cf_gnat_projects" >&6 - - if test $cf_gnat_projects = yes - then -- echo "$as_me:18374: checking if GNAT supports libraries" >&5 -+ echo "$as_me:19746: checking if GNAT supports libraries" >&5 - echo $ECHO_N "checking if GNAT supports libraries... $ECHO_C" >&6 -- echo "$as_me:18376: result: $cf_gnat_libraries" >&5 -+ echo "$as_me:19748: result: $cf_gnat_libraries" >&5 - echo "${ECHO_T}$cf_gnat_libraries" >&6 - fi - -@@ -18393,7 +19765,7 @@ - USE_GNAT_LIBRARIES="#" - fi - --echo "$as_me:18396: checking for ada-compiler" >&5 -+echo "$as_me:19768: checking for ada-compiler" >&5 - echo $ECHO_N "checking for ada-compiler... $ECHO_C" >&6 - - # Check whether --with-ada-compiler or --without-ada-compiler was given. -@@ -18404,12 +19776,12 @@ - cf_ada_compiler=gnatmake - fi; - --echo "$as_me:18407: result: $cf_ada_compiler" >&5 -+echo "$as_me:19779: result: $cf_ada_compiler" >&5 - echo "${ECHO_T}$cf_ada_compiler" >&6 - - cf_ada_package=terminal_interface - --echo "$as_me:18412: checking for ada-include" >&5 -+echo "$as_me:19784: checking for ada-include" >&5 - echo $ECHO_N "checking for ada-include... $ECHO_C" >&6 - - # Check whether --with-ada-include or --without-ada-include was given. -@@ -18433,7 +19805,7 @@ - ;; - .[a-zA-Z]:[\\/]*) #(vi OS/2 EMX - ;; --.\${*prefix}*) #(vi -+.\${*prefix}*|.\${*dir}*) #(vi - eval withval="$withval" - case ".$withval" in #(vi - .NONE/*) -@@ -18445,19 +19817,19 @@ - withval=`echo $withval | sed -e s%NONE%$cf_path_syntax%` - ;; - *) -- { { echo "$as_me:18448: error: expected a pathname, not \"$withval\"" >&5 -+ { { echo "$as_me:19820: error: expected a pathname, not \"$withval\"" >&5 - echo "$as_me: error: expected a pathname, not \"$withval\"" >&2;} - { (exit 1); exit 1; }; } - ;; - esac - - fi --ADA_INCLUDE="$withval" -+eval ADA_INCLUDE="$withval" - --echo "$as_me:18457: result: $ADA_INCLUDE" >&5 -+echo "$as_me:19829: result: $ADA_INCLUDE" >&5 - echo "${ECHO_T}$ADA_INCLUDE" >&6 - --echo "$as_me:18460: checking for ada-objects" >&5 -+echo "$as_me:19832: checking for ada-objects" >&5 - echo $ECHO_N "checking for ada-objects... $ECHO_C" >&6 - - # Check whether --with-ada-objects or --without-ada-objects was given. -@@ -18471,69 +19843,310 @@ - if test "x$prefix" != xNONE; then - cf_path_syntax="$prefix" - else -- cf_path_syntax="$ac_default_prefix" -+ cf_path_syntax="$ac_default_prefix" -+fi -+ -+case ".$withval" in #(vi -+.\$\(*\)*|.\'*\'*) #(vi -+ ;; -+..|./*|.\\*) #(vi -+ ;; -+.[a-zA-Z]:[\\/]*) #(vi OS/2 EMX -+ ;; -+.\${*prefix}*|.\${*dir}*) #(vi -+ eval withval="$withval" -+ case ".$withval" in #(vi -+ .NONE/*) -+ withval=`echo $withval | sed -e s%NONE%$cf_path_syntax%` -+ ;; -+ esac -+ ;; #(vi -+.no|.NONE/*) -+ withval=`echo $withval | sed -e s%NONE%$cf_path_syntax%` -+ ;; -+*) -+ { { echo "$as_me:19868: error: expected a pathname, not \"$withval\"" >&5 -+echo "$as_me: error: expected a pathname, not \"$withval\"" >&2;} -+ { (exit 1); exit 1; }; } -+ ;; -+esac -+ -+fi -+eval ADA_OBJECTS="$withval" -+ -+echo "$as_me:19877: result: $ADA_OBJECTS" >&5 -+echo "${ECHO_T}$ADA_OBJECTS" >&6 -+ -+echo "$as_me:19880: checking if an Ada95 shared-library should be built" >&5 -+echo $ECHO_N "checking if an Ada95 shared-library should be built... $ECHO_C" >&6 -+ -+# Check whether --with-ada-sharedlib or --without-ada-sharedlib was given. -+if test "${with_ada_sharedlib+set}" = set; then -+ withval="$with_ada_sharedlib" -+ with_ada_sharedlib=$withval -+else -+ with_ada_sharedlib=no -+fi; -+echo "$as_me:19890: result: $with_ada_sharedlib" >&5 -+echo "${ECHO_T}$with_ada_sharedlib" >&6 -+ -+ADA_SHAREDLIB='lib$(LIB_NAME).so.1' -+MAKE_ADA_SHAREDLIB="#" -+ -+if test "x$with_ada_sharedlib" != xno -+then -+ MAKE_ADA_SHAREDLIB= -+ if test "x$with_ada_sharedlib" != xyes -+ then -+ ADA_SHAREDLIB="$with_ada_sharedlib" -+ fi -+fi -+ -+ fi -+ fi -+else -+ cf_with_ada=no -+fi -+ -+# do this "late" to avoid conflict with header-checks -+if test "x$with_widec" = xyes ; then -+ echo "$as_me:19913: checking for wchar_t" >&5 -+echo $ECHO_N "checking for wchar_t... $ECHO_C" >&6 -+if test "${ac_cv_type_wchar_t+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ cat >conftest.$ac_ext <<_ACEOF -+#line 19919 "configure" -+#include "confdefs.h" -+$ac_includes_default -+int -+main () -+{ -+if ((wchar_t *) 0) -+ return 0; -+if (sizeof (wchar_t)) -+ return 0; -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:19934: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>&5 -+ ac_status=$? -+ echo "$as_me:19937: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:19940: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:19943: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ ac_cv_type_wchar_t=yes -+else -+ echo "$as_me: failed program was:" >&5 -+cat conftest.$ac_ext >&5 -+ac_cv_type_wchar_t=no -+fi -+rm -f conftest.$ac_objext conftest.$ac_ext -+fi -+echo "$as_me:19953: result: $ac_cv_type_wchar_t" >&5 -+echo "${ECHO_T}$ac_cv_type_wchar_t" >&6 -+ -+echo "$as_me:19956: checking size of wchar_t" >&5 -+echo $ECHO_N "checking size of wchar_t... $ECHO_C" >&6 -+if test "${ac_cv_sizeof_wchar_t+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ if test "$ac_cv_type_wchar_t" = yes; then -+ if test "$cross_compiling" = yes; then -+ # Depending upon the size, compute the lo and hi bounds. -+cat >conftest.$ac_ext <<_ACEOF -+#line 19965 "configure" -+#include "confdefs.h" -+$ac_includes_default -+int -+main () -+{ -+int _array_ [1 - 2 * !((sizeof (wchar_t)) >= 0)] -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:19977: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>&5 -+ ac_status=$? -+ echo "$as_me:19980: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:19983: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:19986: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ ac_lo=0 ac_mid=0 -+ while :; do -+ cat >conftest.$ac_ext <<_ACEOF -+#line 19991 "configure" -+#include "confdefs.h" -+$ac_includes_default -+int -+main () -+{ -+int _array_ [1 - 2 * !((sizeof (wchar_t)) <= $ac_mid)] -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:20003: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>&5 -+ ac_status=$? -+ echo "$as_me:20006: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:20009: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:20012: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ ac_hi=$ac_mid; break -+else -+ echo "$as_me: failed program was:" >&5 -+cat conftest.$ac_ext >&5 -+ac_lo=`expr $ac_mid + 1`; ac_mid=`expr 2 '*' $ac_mid + 1` -+fi -+rm -f conftest.$ac_objext conftest.$ac_ext -+ done -+else -+ echo "$as_me: failed program was:" >&5 -+cat conftest.$ac_ext >&5 -+ac_hi=-1 ac_mid=-1 -+ while :; do -+ cat >conftest.$ac_ext <<_ACEOF -+#line 20028 "configure" -+#include "confdefs.h" -+$ac_includes_default -+int -+main () -+{ -+int _array_ [1 - 2 * !((sizeof (wchar_t)) >= $ac_mid)] -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:20040: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>&5 -+ ac_status=$? -+ echo "$as_me:20043: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:20046: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:20049: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ ac_lo=$ac_mid; break -+else -+ echo "$as_me: failed program was:" >&5 -+cat conftest.$ac_ext >&5 -+ac_hi=`expr $ac_mid - 1`; ac_mid=`expr 2 '*' $ac_mid` -+fi -+rm -f conftest.$ac_objext conftest.$ac_ext -+ done -+fi -+rm -f conftest.$ac_objext conftest.$ac_ext -+# Binary search between lo and hi bounds. -+while test "x$ac_lo" != "x$ac_hi"; do -+ ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` -+ cat >conftest.$ac_ext <<_ACEOF -+#line 20065 "configure" -+#include "confdefs.h" -+$ac_includes_default -+int -+main () -+{ -+int _array_ [1 - 2 * !((sizeof (wchar_t)) <= $ac_mid)] -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:20077: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>&5 -+ ac_status=$? -+ echo "$as_me:20080: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:20083: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:20086: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ ac_hi=$ac_mid -+else -+ echo "$as_me: failed program was:" >&5 -+cat conftest.$ac_ext >&5 -+ac_lo=`expr $ac_mid + 1` - fi -- --case ".$withval" in #(vi --.\$\(*\)*|.\'*\'*) #(vi -- ;; --..|./*|.\\*) #(vi -- ;; --.[a-zA-Z]:[\\/]*) #(vi OS/2 EMX -- ;; --.\${*prefix}*) #(vi -- eval withval="$withval" -- case ".$withval" in #(vi -- .NONE/*) -- withval=`echo $withval | sed -e s%NONE%$cf_path_syntax%` -- ;; -- esac -- ;; #(vi --.no|.NONE/*) -- withval=`echo $withval | sed -e s%NONE%$cf_path_syntax%` -- ;; --*) -- { { echo "$as_me:18496: error: expected a pathname, not \"$withval\"" >&5 --echo "$as_me: error: expected a pathname, not \"$withval\"" >&2;} -+rm -f conftest.$ac_objext conftest.$ac_ext -+done -+ac_cv_sizeof_wchar_t=$ac_lo -+else -+ if test "$cross_compiling" = yes; then -+ { { echo "$as_me:20099: error: cannot run test program while cross compiling" >&5 -+echo "$as_me: error: cannot run test program while cross compiling" >&2;} - { (exit 1); exit 1; }; } -- ;; --esac -- -+else -+ cat >conftest.$ac_ext <<_ACEOF -+#line 20104 "configure" -+#include "confdefs.h" -+$ac_includes_default -+int -+main () -+{ -+FILE *f = fopen ("conftest.val", "w"); -+if (!f) -+ $ac_main_return (1); -+fprintf (f, "%d", (sizeof (wchar_t))); -+fclose (f); -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest$ac_exeext -+if { (eval echo "$as_me:20120: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>&5 -+ ac_status=$? -+ echo "$as_me:20123: \$? = $ac_status" >&5 -+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext' -+ { (eval echo "$as_me:20125: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:20128: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ ac_cv_sizeof_wchar_t=`cat conftest.val` -+else -+ echo "$as_me: program exited with status $ac_status" >&5 -+echo "$as_me: failed program was:" >&5 -+cat conftest.$ac_ext >&5 - fi --ADA_OBJECTS="$withval" -- --echo "$as_me:18505: result: $ADA_OBJECTS" >&5 --echo "${ECHO_T}$ADA_OBJECTS" >&6 -- --echo "$as_me:18508: checking if an Ada95 shared-library should be built" >&5 --echo $ECHO_N "checking if an Ada95 shared-library should be built... $ECHO_C" >&6 -- --# Check whether --with-ada-sharedlib or --without-ada-sharedlib was given. --if test "${with_ada_sharedlib+set}" = set; then -- withval="$with_ada_sharedlib" -- with_ada_sharedlib=$withval -+rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -+fi -+fi -+rm -f conftest.val - else -- with_ada_sharedlib=no --fi; --echo "$as_me:18518: result: $with_ada_sharedlib" >&5 --echo "${ECHO_T}$with_ada_sharedlib" >&6 -- --ADA_SHAREDLIB='lib$(LIB_NAME).so.1' --MAKE_ADA_SHAREDLIB="#" -- --if test "x$with_ada_sharedlib" != xno --then -- MAKE_ADA_SHAREDLIB= -- if test "x$with_ada_sharedlib" != xyes -- then -- ADA_SHAREDLIB="$with_ada_sharedlib" -- fi -+ ac_cv_sizeof_wchar_t=0 -+fi - fi -+echo "$as_me:20144: result: $ac_cv_sizeof_wchar_t" >&5 -+echo "${ECHO_T}$ac_cv_sizeof_wchar_t" >&6 -+cat >>confdefs.h <&5 -+echo "$as_me:20162: checking for library subsets" >&5 - echo $ECHO_N "checking for library subsets... $ECHO_C" >&6 - LIB_SUBSETS= - --if test "$cf_with_progs" = yes || test "$with_ticlib" != no || test "$with_termcap" != no; then -+if test "x$cf_with_progs" = xyes || test "$with_ticlib" != no || test "$with_termcap" != no; then - LIB_SUBSETS="${LIB_SUBSETS}ticlib" - if test "$with_ticlib" != no ; then - LIB_SUBSETS="${LIB_SUBSETS} " -@@ -18560,7 +20173,7 @@ - fi - - LIB_SUBSETS="${LIB_SUBSETS}termlib" --test "$with_ext_funcs" = yes && LIB_SUBSETS="${LIB_SUBSETS}+ext_tinfo" -+test "x$with_ext_funcs" = xyes && LIB_SUBSETS="${LIB_SUBSETS}+ext_tinfo" - - if test "$with_termlib" != no ; then - LIB_SUBSETS="${LIB_SUBSETS} " -@@ -18584,29 +20197,29 @@ - esac - fi - --test "$with_widec" = yes && LIB_SUBSETS="${LIB_SUBSETS}+widechar" --test "$with_ext_funcs" = yes && LIB_SUBSETS="${LIB_SUBSETS}+ext_funcs" -+test "x$with_widec" = xyes && LIB_SUBSETS="${LIB_SUBSETS}+widechar" -+test "x$with_ext_funcs" = xyes && LIB_SUBSETS="${LIB_SUBSETS}+ext_funcs" - --echo "$as_me:18590: result: $LIB_SUBSETS" >&5 -+echo "$as_me:20203: result: $LIB_SUBSETS" >&5 - echo "${ECHO_T}$LIB_SUBSETS" >&6 - - ### Construct the list of include-directories to be generated - --CPPFLAGS="$CPPFLAGS -I. -I../include" --if test "$srcdir" != "."; then -- CPPFLAGS="$CPPFLAGS -I\${srcdir}/../include" --fi - if test "$GCC" != yes; then -- CPPFLAGS="$CPPFLAGS -I\${includedir}" -+ CPPFLAGS="-I\${includedir} $CPPFLAGS" - elif test "$includedir" != "/usr/include"; then - if test "$includedir" = '${prefix}/include' ; then -- if test $prefix != /usr ; then -- CPPFLAGS="$CPPFLAGS -I\${includedir}" -+ if test x$prefix != x/usr ; then -+ CPPFLAGS="-I\${includedir} $CPPFLAGS" - fi - else -- CPPFLAGS="$CPPFLAGS -I\${includedir}" -+ CPPFLAGS="-I\${includedir} $CPPFLAGS" - fi - fi -+if test "$srcdir" != "."; then -+ CPPFLAGS="-I\${srcdir}/../include $CPPFLAGS" -+fi -+CPPFLAGS="-I. -I../include $CPPFLAGS" - - ACPPFLAGS="-I. -I../include -I../../include $ACPPFLAGS" - if test "$srcdir" != "."; then -@@ -18616,7 +20229,7 @@ - ACPPFLAGS="$ACPPFLAGS -I\${includedir}" - elif test "$includedir" != "/usr/include"; then - if test "$includedir" = '${prefix}/include' ; then -- if test $prefix != /usr ; then -+ if test x$prefix != x/usr ; then - ACPPFLAGS="$ACPPFLAGS -I\${includedir}" - fi - else -@@ -18625,7 +20238,7 @@ - fi - - ### Build up pieces for makefile rules --echo "$as_me:18628: checking default library suffix" >&5 -+echo "$as_me:20241: checking default library suffix" >&5 - echo $ECHO_N "checking default library suffix... $ECHO_C" >&6 - - case $DFT_LWR_MODEL in -@@ -18636,36 +20249,32 @@ - shared) DFT_ARG_SUFFIX='' ;; - esac - test -n "$LIB_SUFFIX" && DFT_ARG_SUFFIX="${LIB_SUFFIX}${DFT_ARG_SUFFIX}" --echo "$as_me:18639: result: $DFT_ARG_SUFFIX" >&5 -+echo "$as_me:20252: result: $DFT_ARG_SUFFIX" >&5 - echo "${ECHO_T}$DFT_ARG_SUFFIX" >&6 - --echo "$as_me:18642: checking default library-dependency suffix" >&5 -+echo "$as_me:20255: checking default library-dependency suffix" >&5 - echo $ECHO_N "checking default library-dependency suffix... $ECHO_C" >&6 - -- case $DFT_LWR_MODEL in #(vi -- libtool) #(vi -+ case X$DFT_LWR_MODEL in #(vi -+ Xlibtool) #(vi - DFT_LIB_SUFFIX='.la' - DFT_DEP_SUFFIX=$DFT_LIB_SUFFIX - ;; -- normal) #(vi -- DFT_LIB_SUFFIX='.a' -- DFT_DEP_SUFFIX=$DFT_LIB_SUFFIX -- ;; -- debug) #(vi -+ Xdebug) #(vi - DFT_LIB_SUFFIX='_g.a' - DFT_DEP_SUFFIX=$DFT_LIB_SUFFIX - ;; -- profile) #(vi -+ Xprofile) #(vi - DFT_LIB_SUFFIX='_p.a' - DFT_DEP_SUFFIX=$DFT_LIB_SUFFIX - ;; -- shared) #(vi -+ Xshared) #(vi - case $cf_cv_system_name in -- aix[56]*) #(vi -+ aix[5-7]*) #(vi - DFT_LIB_SUFFIX='.a' - DFT_DEP_SUFFIX=$DFT_LIB_SUFFIX - ;; -- cygwin*) #(vi -+ cygwin*|msys*|mingw*) #(vi - DFT_LIB_SUFFIX='.dll' - DFT_DEP_SUFFIX='.dll.a' - ;; -@@ -18685,17 +20294,23 @@ - ;; - esac - ;; -- *) DFT_LIB_SUFFIX='.so' -+ *) #(vi -+ DFT_LIB_SUFFIX='.so' - DFT_DEP_SUFFIX=$DFT_LIB_SUFFIX - ;; - esac -+ ;; -+ *) -+ DFT_LIB_SUFFIX='.a' -+ DFT_DEP_SUFFIX=$DFT_LIB_SUFFIX -+ ;; - esac - test -n "$LIB_SUFFIX" && DFT_LIB_SUFFIX="${LIB_SUFFIX}${DFT_LIB_SUFFIX}" - test -n "$LIB_SUFFIX" && DFT_DEP_SUFFIX="${LIB_SUFFIX}${DFT_DEP_SUFFIX}" --echo "$as_me:18695: result: $DFT_DEP_SUFFIX" >&5 -+echo "$as_me:20310: result: $DFT_DEP_SUFFIX" >&5 - echo "${ECHO_T}$DFT_DEP_SUFFIX" >&6 - --echo "$as_me:18698: checking default object directory" >&5 -+echo "$as_me:20313: checking default object directory" >&5 - echo $ECHO_N "checking default object directory... $ECHO_C" >&6 - - case $DFT_LWR_MODEL in -@@ -18705,47 +20320,47 @@ - profile) DFT_OBJ_SUBDIR='obj_p' ;; - shared) - case $cf_cv_system_name in #(vi -- cygwin) #(vi -+ cygwin|msys) #(vi - DFT_OBJ_SUBDIR='objects' ;; - *) - DFT_OBJ_SUBDIR='obj_s' ;; - esac - esac --echo "$as_me:18714: result: $DFT_OBJ_SUBDIR" >&5 -+echo "$as_me:20329: result: $DFT_OBJ_SUBDIR" >&5 - echo "${ECHO_T}$DFT_OBJ_SUBDIR" >&6 - --# libtool thinks it can make c++ shared libraries (perhaps only g++) --if test "$cf_with_cxx" = yes ; then --echo "$as_me:18719: checking c++ library-dependency suffix" >&5 -+if test "x$cf_with_cxx" = xyes ; then -+echo "$as_me:20333: checking c++ library-dependency suffix" >&5 - echo $ECHO_N "checking c++ library-dependency suffix... $ECHO_C" >&6 - if test "$with_libtool" != "no"; then -+ # libtool thinks it can make c++ shared libraries (perhaps only g++) -+ CXX_LIB_SUFFIX=$DFT_DEP_SUFFIX -+elif test "$with_shared_cxx" != "no"; then -+ # also for g++ users... - CXX_LIB_SUFFIX=$DFT_DEP_SUFFIX - else -+ # we normally make a static library because C/C++ library rules differ - -- case normal in #(vi -- libtool) #(vi -+ case Xnormal in #(vi -+ Xlibtool) #(vi - CXX_LIB_SUFFIX='.la' - CXX_DEP_SUFFIX=$CXX_LIB_SUFFIX - ;; -- normal) #(vi -- CXX_LIB_SUFFIX='.a' -- CXX_DEP_SUFFIX=$CXX_LIB_SUFFIX -- ;; -- debug) #(vi -+ Xdebug) #(vi - CXX_LIB_SUFFIX='_g.a' - CXX_DEP_SUFFIX=$CXX_LIB_SUFFIX - ;; -- profile) #(vi -+ Xprofile) #(vi - CXX_LIB_SUFFIX='_p.a' - CXX_DEP_SUFFIX=$CXX_LIB_SUFFIX - ;; -- shared) #(vi -+ Xshared) #(vi - case $cf_cv_system_name in -- aix[56]*) #(vi -+ aix[5-7]*) #(vi - CXX_LIB_SUFFIX='.a' - CXX_DEP_SUFFIX=$CXX_LIB_SUFFIX - ;; -- cygwin*) #(vi -+ cygwin*|msys*|mingw*) #(vi - CXX_LIB_SUFFIX='.dll' - CXX_DEP_SUFFIX='.dll.a' - ;; -@@ -18765,21 +20380,28 @@ - ;; - esac - ;; -- *) CXX_LIB_SUFFIX='.so' -+ *) #(vi -+ CXX_LIB_SUFFIX='.so' - CXX_DEP_SUFFIX=$CXX_LIB_SUFFIX - ;; - esac -+ ;; -+ *) -+ CXX_LIB_SUFFIX='.a' -+ CXX_DEP_SUFFIX=$CXX_LIB_SUFFIX -+ ;; - esac - test -n "$LIB_SUFFIX" && CXX_LIB_SUFFIX="${LIB_SUFFIX}${CXX_LIB_SUFFIX}" - test -n "$LIB_SUFFIX" && CXX_DEP_SUFFIX="${LIB_SUFFIX}${CXX_DEP_SUFFIX}" -+ - fi --echo "$as_me:18776: result: $CXX_LIB_SUFFIX" >&5 -+echo "$as_me:20398: result: $CXX_LIB_SUFFIX" >&5 - echo "${ECHO_T}$CXX_LIB_SUFFIX" >&6 - - fi - - # do not want -ldl in build except as needed for -lncurses dependency --if test "$with_dlsym" = yes ; then -+if test "x$with_dlsym" = xyes ; then - if test $DFT_LWR_MODEL = shared || \ - test $DFT_LWR_MODEL = libtool ; then - -@@ -18793,7 +20415,7 @@ - # TICS_LIST and TINFO_LIST are needed to build libtic.so and libterm.so, but - # do not need libdl - TICS_LIST= --if test "$with_dlsym" = yes ; then -+if test "x$with_dlsym" = xyes ; then - - # remove dl library from $SHLIB_LIST - TINFO_LIST=`echo "$SHLIB_LIST" | sed -e 's/-ldl[ ]//g' -e 's/-ldl$//'` -@@ -18802,7 +20424,7 @@ - - if test "$with_ticlib" != no ; then - -- if test "$with_ticlib" != yes ; then -+ if test "x$with_ticlib" != xyes ; then - TICS_NAME=$with_ticlib - TICS_ARG_SUFFIX="${with_ticlib}`echo ${DFT_ARG_SUFFIX}|sed -e "s/^${LIB_SUFFIX}//"`" - TICS_DEP_SUFFIX="${with_ticlib}`echo ${DFT_DEP_SUFFIX}|sed -e "s/^${LIB_SUFFIX}//"`" -@@ -18812,14 +20434,16 @@ - TICS_DEP_SUFFIX="${TICS_NAME}${DFT_DEP_SUFFIX}" - TICS_LIB_SUFFIX="${TICS_NAME}${LIB_SUFFIX}" - fi -- TICS_ARGS="-L${LIB_DIR} -l${TICS_LIB_SUFFIX}" -+ TICS_LDFLAGS="-L${LIB_DIR}" -+ TICS_LIBS="-l${TICS_LIB_SUFFIX}" - else -- TICS_ARGS="-L${LIB_DIR} -l${LIB_NAME}${DFT_ARG_SUFFIX}" -+ TICS_LDFLAGS="-L${LIB_DIR}" -+ TICS_LIBS="-l${LIB_NAME}${DFT_ARG_SUFFIX}" - fi - - if test "$with_termlib" != no ; then - -- if test "$with_termlib" != yes ; then -+ if test "x$with_termlib" != xyes ; then - TINFO_NAME=$with_termlib - TINFO_SUFFIX="`echo ${DFT_LIB_SUFFIX}|sed -e "s/^${LIB_SUFFIX}//"`" - TINFO_ARG_SUFFIX="${with_termlib}`echo ${DFT_ARG_SUFFIX}|sed -e "s/^${LIB_SUFFIX}//"`" -@@ -18837,14 +20461,22 @@ - if test "$DFT_LWR_MODEL" = "libtool"; then - TEST_ARGS="${TEST_DEPS}" - TEST_ARG2="${TEST_DEP2}" -- TINFO_ARGS="-L${LIB_DIR} $TEST_ARGS" -+ TINFO_LDFLAGS="-L${LIB_DIR}" -+ TINFO_LIBS="$TEST_ARGS" - TICS_LIST="$SHLIB_LIST $TEST_ARGS" - SHLIB_LIST="${SHLIB_LIST} $TEST_ARGS" - else - TEST_ARGS="-l${TINFO_ARG_SUFFIX}" - TEST_ARG2="-l${TINFO_ARG_SUFFIX}" -- TICS_LIST="$SHLIB_LIST -l${TINFO_LIB_SUFFIX}" -- TINFO_ARGS="-L${LIB_DIR} $TEST_ARGS" -+ if test "x$with_term_driver" != xno ; then -+ TICS_LIST="$SHLIB_LIST -l${LIB_NAME}${DFT_ARG_SUFFIX}" -+ TICS_LIBS="$TICS_LIBS -l${LIB_NAME}${DFT_ARG_SUFFIX}" -+ TINFO_LIBS="-l${LIB_NAME}${DFT_ARG_SUFFIX} $TEST_ARGS" -+ else -+ TICS_LIST="$SHLIB_LIST -l${TINFO_LIB_SUFFIX}" -+ TINFO_LIBS="$TEST_ARGS" -+ fi -+ TINFO_LDFLAGS="-L${LIB_DIR}" - SHLIB_LIST="$SHLIB_LIST -l${TINFO_LIB_SUFFIX}" - fi - else -@@ -18852,25 +20484,26 @@ - TINFO_NAME=${LIB_NAME} - TINFO_SUFFIX=${DFT_LIB_SUFFIX} - TINFO_ARG_SUFFIX=${LIB_NAME}${DFT_ARG_SUFFIX} -- if test "$with_tic_depends" = yes ; then -+ if test "x$with_tic_depends" = xyes ; then - TICS_LIST="$SHLIB_LIST -l${LIB_NAME}${DFT_ARG_SUFFIX}" - else - TICS_LIST="$SHLIB_LIST" - fi - -- TINFO_ARGS="-L${LIB_DIR} -l${LIB_NAME}${DFT_ARG_SUFFIX}" -+ TINFO_LDFLAGS="-L${LIB_DIR}" -+ TINFO_LIBS="-l${LIB_NAME}${DFT_ARG_SUFFIX}" - fi - - if test "$DFT_LWR_MODEL" = shared ; then - case $cf_cv_system_name in #(vi -- cygwin*) -- # "lib" files have ".dll.a" suffix, "cyg" files have ".dll" -+ cygwin*|msys*) -+ # "lib" files have ".dll.a" suffix, "cyg"or "msys-" files have ".dll" - TINFO_SUFFIX=.dll - ;; - esac - fi - --if test "$with_dlsym" = yes ; then -+if test "x$with_dlsym" = xyes ; then - - # remove dl library from $TICS_LIST - TICS_LIST=`echo "$TICS_LIST" | sed -e 's/-ldl[ ]//g' -e 's/-ldl$//'` -@@ -18882,7 +20515,7 @@ - fi - - # needed for Ada95 --TINFO_ARGS2=`echo "$TINFO_ARGS" | sed -e 's,-L\.\./,-L../../,'` -+TINFO_LDFLAGS2=`echo "$TINFO_LDFLAGS" | sed -e 's,-L\.\./,-L../../,'` - - case $DFT_LWR_MODEL in - normal|debug|profile) -@@ -18900,7 +20533,7 @@ - esac - else - case $cf_cv_system_name in #( -- aix[456]*) #( from ld manpage -+ aix[4-7]*) #( from ld manpage - LDFLAGS_STATIC=-bstatic - LDFLAGS_SHARED=-bdynamic - ;; -@@ -18927,19 +20560,19 @@ - - if test -n "$LDFLAGS_STATIC" && test -n "$LDFLAGS_SHARED" - then -- echo "$as_me:18930: checking if linker supports switching between static/dynamic" >&5 -+ echo "$as_me:20563: checking if linker supports switching between static/dynamic" >&5 - echo $ECHO_N "checking if linker supports switching between static/dynamic... $ECHO_C" >&6 - - rm -f libconftest.a - cat >conftest.$ac_ext < - int cf_ldflags_static(FILE *fp) { return fflush(fp); } - EOF -- if { (eval echo "$as_me:18939: \"$ac_compile\"") >&5 -+ if { (eval echo "$as_me:20572: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:18942: \$? = $ac_status" >&5 -+ echo "$as_me:20575: \$? = $ac_status" >&5 - (exit $ac_status); } ; then - ( $AR $ARFLAGS libconftest.a conftest.o ) 2>&5 1>/dev/null - ( eval $RANLIB libconftest.a ) 2>&5 >/dev/null -@@ -18950,10 +20583,10 @@ - - LIBS="$LDFLAGS_STATIC -L`pwd` -lconftest $LDFLAGS_DYNAMIC $LIBS" - cat >conftest.$ac_ext <<_ACEOF --#line 18953 "configure" -+#line 20586 "configure" - #include "confdefs.h" - --#line 18956 "configure" -+#line 20589 "configure" - #include - int cf_ldflags_static(FILE *fp); - -@@ -18968,18 +20601,28 @@ - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:18971: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:20604: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:18974: \$? = $ac_status" >&5 -+ echo "$as_me:20607: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:18977: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:20610: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:18980: \$? = $ac_status" >&5 -+ echo "$as_me:20613: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- cf_ldflags_static=yes -+ -+ # some linkers simply ignore the -dynamic -+ case x`file conftest$ac_exeext 2>/dev/null` in #(vi -+ *static*) # (vi -+ cf_ldflags_static=no -+ ;; -+ *) -+ cf_ldflags_static=yes -+ ;; -+ esac -+ - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 -@@ -18990,7 +20633,7 @@ - rm -f libconftest.* - LIBS="$cf_save_LIBS" - -- echo "$as_me:18993: result: $cf_ldflags_static" >&5 -+ echo "$as_me:20636: result: $cf_ldflags_static" >&5 - echo "${ECHO_T}$cf_ldflags_static" >&6 - - if test $cf_ldflags_static != yes -@@ -19006,20 +20649,25 @@ - ;; - esac - --echo "$as_me:19009: checking where we will install curses.h" >&5 -+echo "$as_me:20652: checking where we will install curses.h" >&5 - echo $ECHO_N "checking where we will install curses.h... $ECHO_C" >&6 --test "$with_overwrite" = no && \ --test "x$includedir" = 'x${prefix}/include' && \ -- includedir='${prefix}/include/ncurses'${LIB_SUFFIX} --echo "$as_me:19014: result: $includedir" >&5 --echo "${ECHO_T}$includedir" >&6 -+ -+includesubdir= -+if test "$with_overwrite" = no && \ -+ ( test "x$includedir" = 'x${prefix}/include' || \ -+ test "x$includedir" = "x${prefix}/include" ) -+then -+ includesubdir="/ncurses${LIB_SUFFIX}" -+fi -+echo "$as_me:20662: result: ${includedir}${includesubdir}" >&5 -+echo "${ECHO_T}${includedir}${includesubdir}" >&6 - - ### Resolve a conflict between normal and wide-curses by forcing applications - ### that will need libutf8 to add it to their configure script. - if test "$with_overwrite" != no ; then - if test "$NCURSES_LIBUTF8" = 1 ; then - NCURSES_LIBUTF8='defined(HAVE_LIBUTF8_H)' -- { echo "$as_me:19022: WARNING: Wide-character applications must define HAVE_LIBUTF8_H to include curses.h" >&5 -+ { echo "$as_me:20670: WARNING: Wide-character applications must define HAVE_LIBUTF8_H to include curses.h" >&5 - echo "$as_me: WARNING: Wide-character applications must define HAVE_LIBUTF8_H to include curses.h" >&2;} - fi - fi -@@ -19029,6 +20677,7 @@ - NCURSES_TREE= - - ### predefined stuff for the test programs -+ - cat >>confdefs.h <<\EOF - #define HAVE_SLK_COLOR 1 - EOF -@@ -19036,7 +20685,7 @@ - ### Construct the list of subdirectories for which we'll customize makefiles - ### with the appropriate compile-rules. - --echo "$as_me:19039: checking for src modules" >&5 -+echo "$as_me:20688: checking for src modules" >&5 - echo $ECHO_N "checking for src modules... $ECHO_C" >&6 - - # dependencies and linker-arguments for test-programs -@@ -19050,6 +20699,7 @@ - TEST_ARG2="-l${LIB_NAME}${DFT_ARG_SUFFIX} $TEST_ARG2" - fi - -+PC_MODULES_TO_MAKE="ncurses${DFT_ARG_SUFFIX}" - cf_cv_src_modules= - for cf_dir in $modules_to_build - do -@@ -19096,10 +20746,11 @@ - TEST_ARGS="-l${cf_dir}${DFT_ARG_SUFFIX} $TEST_ARGS" - TEST_ARG2="-l${cf_dir}${DFT_ARG_SUFFIX} $TEST_ARG2" - fi -+ PC_MODULES_TO_MAKE="${PC_MODULES_TO_MAKE} ${cf_dir}${DFT_ARG_SUFFIX}" - fi - fi - done --echo "$as_me:19102: result: $cf_cv_src_modules" >&5 -+echo "$as_me:20753: result: $cf_cv_src_modules" >&5 - echo "${ECHO_T}$cf_cv_src_modules" >&6 - - TEST_ARGS="-L${LIB_DIR} $TEST_ARGS" -@@ -19117,11 +20768,19 @@ - if test "x$cf_with_tests" != "xno" ; then - SRC_SUBDIRS="$SRC_SUBDIRS test" - fi --test -z "$MAKE_TERMINFO" && SRC_SUBDIRS="$SRC_SUBDIRS misc" --test "$cf_with_cxx_binding" != no && SRC_SUBDIRS="$SRC_SUBDIRS c++" -+if test "x$cf_with_db_install" = xyes; then -+ test -z "$MAKE_TERMINFO" && SRC_SUBDIRS="$SRC_SUBDIRS misc" -+fi -+if test "$cf_with_cxx_binding" != no; then -+ PC_MODULES_TO_MAKE="${PC_MODULES_TO_MAKE} ncurses++${DFT_ARG_SUFFIX}" -+ SRC_SUBDIRS="$SRC_SUBDIRS c++" -+fi -+ -+test "x$with_termlib" != xno && PC_MODULES_TO_MAKE="$PC_MODULES_TO_MAKE $TINFO_ARG_SUFFIX" -+test "x$with_ticlib" != xno && PC_MODULES_TO_MAKE="$PC_MODULES_TO_MAKE $TICS_ARG_SUFFIX" - - ADA_SUBDIRS= --if test "$cf_cv_prog_gnat_correct" = yes && test -f $srcdir/Ada95/Makefile.in; then -+if test "x$cf_with_ada" = "xyes" && test "x$cf_cv_prog_gnat_correct" = xyes && test -f $srcdir/Ada95/Makefile.in; then - SRC_SUBDIRS="$SRC_SUBDIRS Ada95" - ADA_SUBDIRS="gen src" - if test "x$cf_with_tests" != "xno" ; then -@@ -19143,7 +20802,7 @@ - - fi - --if test "$cf_with_ada" != "no" && test "$cf_cv_prog_gnat_correct" != "no"; then -+if test "x$cf_with_ada" = "xyes" && test "x$cf_cv_prog_gnat_correct" = "xyes"; then - SUB_MAKEFILES="$SUB_MAKEFILES Ada95/gen/adacurses${DFT_ARG_SUFFIX}-config:Ada95/gen/adacurses-config.in" - SUB_MAKEFILES="$SUB_MAKEFILES man/adacurses${DFT_ARG_SUFFIX}-config.1:man/MKada_config.in" - fi -@@ -19159,7 +20818,7 @@ - profile) cf_subdir='obj_p' ;; - shared) - case $cf_cv_system_name in #(vi -- cygwin) #(vi -+ cygwin|msys) #(vi - cf_subdir='objects' ;; - *) - cf_subdir='obj_s' ;; -@@ -19181,6 +20840,7 @@ - NCURSES_SHLIB2='sh $(top_srcdir)/misc/shlib' - - # values to use as strings -+ - cat >>confdefs.h <&5 -+echo "$as_me:20974: checking for $ac_word" >&5 - echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 - if test "${ac_cv_path_TIC_PATH+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -19322,7 +20988,7 @@ - test -z "$ac_dir" && ac_dir=. - if $as_executable_p "$ac_dir/$ac_word"; then - ac_cv_path_TIC_PATH="$ac_dir/$ac_word" -- echo "$as_me:19325: found $ac_dir/$ac_word" >&5 -+ echo "$as_me:20991: found $ac_dir/$ac_word" >&5 - break - fi - done -@@ -19334,10 +21000,10 @@ - TIC_PATH=$ac_cv_path_TIC_PATH - - if test -n "$TIC_PATH"; then -- echo "$as_me:19337: result: $TIC_PATH" >&5 -+ echo "$as_me:21003: result: $TIC_PATH" >&5 - echo "${ECHO_T}$TIC_PATH" >&6 - else -- echo "$as_me:19340: result: no" >&5 -+ echo "$as_me:21006: result: no" >&5 - echo "${ECHO_T}no" >&6 - fi - -@@ -19345,7 +21011,7 @@ - then - if test "$TIC_PATH" = unknown - then -- { echo "$as_me:19348: WARNING: no tic program found for fallbacks" >&5 -+ { echo "$as_me:21014: WARNING: no tic program found for fallbacks" >&5 - echo "$as_me: WARNING: no tic program found for fallbacks" >&2;} - fi - fi -@@ -19358,13 +21024,56 @@ - - ADAHTML_DIR=../../doc/html/ada - --SUB_SCRIPTS= -+# these could be configurable, but are not currently -+PANEL_NAME=panel -+MENU_NAME=menu -+FORM_NAME=form -+CXX_NAME=ncurses++ -+ -+# workaround for g++ versus Solaris (20131116) - case $cf_cv_system_name in #(vi --*mingw32*) #(vi -- SUB_SCRIPTS="mk-dlls.sh" -+solaris2*) #(vi -+ case "x$CPPFLAGS" in #(vi -+ *-D_XOPEN_SOURCE_EXTENDED*) -+ test -n "$verbose" && echo " moving _XOPEN_SOURCE_EXTENDED to work around g++ problem" 1>&6 -+ -+echo "${as_me:-configure}:21040: testing moving _XOPEN_SOURCE_EXTENDED to work around g++ problem ..." 1>&5 -+ -+ CFLAGS="$CFLAGS -D_XOPEN_SOURCE_EXTENDED" -+ CPPFLAGS=`echo "x$CPPFLAGS" | sed -e 's/^.//' -e 's/-D_XOPEN_SOURCE_EXTENDED//'` -+ ;; -+ esac -+ ;; -+esac -+ -+# AC_CHECK_SIZEOF demands a literal parameter, no variables. So we do this. -+case "x$NCURSES_OSPEED" in #(vi -+*short*) #(vi -+ cf_compatible=1 -+ ;; -+*) -+ cf_compatible=0 -+ ;; -+esac -+ -+cat >>confdefs.h <confcache <<\_ACEOF -@@ -19446,7 +21155,7 @@ - : ${CONFIG_STATUS=./config.status} - ac_clean_files_save=$ac_clean_files - ac_clean_files="$ac_clean_files $CONFIG_STATUS" --{ echo "$as_me:19449: creating $CONFIG_STATUS" >&5 -+{ echo "$as_me:21158: creating $CONFIG_STATUS" >&5 - echo "$as_me: creating $CONFIG_STATUS" >&6;} - cat >$CONFIG_STATUS <<_ACEOF - #! $SHELL -@@ -19578,7 +21287,7 @@ - cat >>$CONFIG_STATUS <&5 - echo "$as_me: error: ambiguous option: $1 - Try \`$0 --help' for more information." >&2;} -@@ -19641,7 +21350,7 @@ - ac_need_defaults=false;; - - # This is an error. -- -*) { { echo "$as_me:19644: error: unrecognized option: $1 -+ -*) { { echo "$as_me:21353: error: unrecognized option: $1 - Try \`$0 --help' for more information." >&5 - echo "$as_me: error: unrecognized option: $1 - Try \`$0 --help' for more information." >&2;} -@@ -19660,7 +21369,7 @@ - ## Running config.status. ## - ## ----------------------- ## - --This file was extended by $as_me 2.52.20101002, executed with -+This file was extended by $as_me 2.52.20121002, executed with - CONFIG_FILES = $CONFIG_FILES - CONFIG_HEADERS = $CONFIG_HEADERS - CONFIG_LINKS = $CONFIG_LINKS -@@ -19682,10 +21391,11 @@ - AWK="$AWK" - DFT_ARG_SUFFIX="$DFT_ARG_SUFFIX" - DFT_LWR_MODEL="$DFT_LWR_MODEL" --ECHO_LINK="$ECHO_LINK" -+ECHO_LD="$ECHO_LD" - LDCONFIG="$LDCONFIG" - LIBTOOL_VERSION="$LIBTOOL_VERSION" - LIB_NAME="$LIB_NAME" -+LIB_PREFIX="$LIB_PREFIX" - LIB_SUBSETS="$LIB_SUBSETS" - LIB_SUFFIX="$LIB_SUFFIX" - LIB_TRACING="$LIB_TRACING" -@@ -19707,7 +21417,7 @@ - TINFO_SUFFIX="$TINFO_SUFFIX" - USE_OLD_MAKERULES="$USE_OLD_MAKERULES" - WITH_CURSES_H="$with_curses_h" --WITH_ECHO="$with_echo" -+WITH_ECHO="${enable_echo:=yes}" - WITH_OVERWRITE="$with_overwrite" - cf_LIST_MODELS="$cf_list_models" - cf_cv_abi_version="$cf_cv_abi_version" -@@ -19717,16 +21427,20 @@ - cf_cv_enable_opaque="$cf_cv_enable_opaque" - cf_cv_prog_CC_c_o=$cf_cv_prog_CC_c_o - cf_cv_prog_CXX_c_o=$cf_cv_prog_CXX_c_o -+cf_cv_prog_gnat_correct=$cf_cv_prog_gnat_correct - cf_cv_rel_version="$cf_cv_rel_version" - cf_cv_rm_so_locs="$cf_cv_rm_so_locs" - cf_cv_shared_soname='$cf_cv_shared_soname' - cf_cv_shlib_version="$cf_cv_shlib_version" - cf_cv_shlib_version_infix="$cf_cv_shlib_version_infix" - cf_cv_system_name="$cf_cv_system_name" -+cf_cv_term_driver="$with_term_driver" - cf_with_ada="$cf_with_ada" - cf_with_cxx_binding="$cf_with_cxx_binding" -+cf_with_db_install="$cf_with_db_install" - cf_with_manpages="$cf_with_manpages" - cf_with_tests="$cf_with_tests" -+with_shared_cxx="$with_shared_cxx" - host="$host" - target="$target" - -@@ -19747,7 +21461,7 @@ - "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; - "default" ) CONFIG_COMMANDS="$CONFIG_COMMANDS default" ;; - "include/ncurses_cfg.h" ) CONFIG_HEADERS="$CONFIG_HEADERS include/ncurses_cfg.h:include/ncurses_cfg.hin" ;; -- *) { { echo "$as_me:19750: error: invalid argument: $ac_config_target" >&5 -+ *) { { echo "$as_me:21464: error: invalid argument: $ac_config_target" >&5 - echo "$as_me: error: invalid argument: $ac_config_target" >&2;} - { (exit 1); exit 1; }; };; - esac -@@ -19806,6 +21520,7 @@ - s,@bindir@,$bindir,;t t - s,@sbindir@,$sbindir,;t t - s,@libexecdir@,$libexecdir,;t t -+s,@datarootdir@,$datarootdir,;t t - s,@datadir@,$datadir,;t t - s,@sysconfdir@,$sysconfdir,;t t - s,@sharedstatedir@,$sharedstatedir,;t t -@@ -19858,9 +21573,8 @@ - s,@ac_ct_CC@,$ac_ct_CC,;t t - s,@EXEEXT@,$EXEEXT,;t t - s,@OBJEXT@,$OBJEXT,;t t --s,@CPP@,$CPP,;t t - s,@EXTRA_CPPFLAGS@,$EXTRA_CPPFLAGS,;t t --s,@PROG_EXT@,$PROG_EXT,;t t -+s,@CPP@,$CPP,;t t - s,@LDCONFIG@,$LDCONFIG,;t t - s,@CXX@,$CXX,;t t - s,@CXXFLAGS@,$CXXFLAGS,;t t -@@ -19887,6 +21601,8 @@ - s,@ac_ct_LD@,$ac_ct_LD,;t t - s,@AR@,$AR,;t t - s,@ac_ct_AR@,$ac_ct_AR,;t t -+s,@NM@,$NM,;t t -+s,@ac_ct_NM@,$ac_ct_NM,;t t - s,@ARFLAGS@,$ARFLAGS,;t t - s,@DESTDIR@,$DESTDIR,;t t - s,@BUILD_CC@,$BUILD_CC,;t t -@@ -19900,6 +21616,7 @@ - s,@cf_list_models@,$cf_list_models,;t t - s,@LIBTOOL_VERSION@,$LIBTOOL_VERSION,;t t - s,@LIBTOOL@,$LIBTOOL,;t t -+s,@ac_ct_LIBTOOL@,$ac_ct_LIBTOOL,;t t - s,@LT_UNDEF@,$LT_UNDEF,;t t - s,@LIBTOOL_CXX@,$LIBTOOL_CXX,;t t - s,@LIBTOOL_OPTS@,$LIBTOOL_OPTS,;t t -@@ -19921,25 +21638,32 @@ - s,@CC_G_OPT@,$CC_G_OPT,;t t - s,@CXX_G_OPT@,$CXX_G_OPT,;t t - s,@LD_MODEL@,$LD_MODEL,;t t -+s,@shlibdir@,$shlibdir,;t t -+s,@MAKE_DLLS@,$MAKE_DLLS,;t t - s,@CC_SHARED_OPTS@,$CC_SHARED_OPTS,;t t - s,@LD_RPATH_OPT@,$LD_RPATH_OPT,;t t - s,@LD_SHARED_OPTS@,$LD_SHARED_OPTS,;t t - s,@MK_SHARED_LIB@,$MK_SHARED_LIB,;t t -+s,@RM_SHARED_OPTS@,$RM_SHARED_OPTS,;t t - s,@LINK_PROGS@,$LINK_PROGS,;t t - s,@LINK_TESTS@,$LINK_TESTS,;t t - s,@EXTRA_LDFLAGS@,$EXTRA_LDFLAGS,;t t - s,@LOCAL_LDFLAGS@,$LOCAL_LDFLAGS,;t t - s,@LOCAL_LDFLAGS2@,$LOCAL_LDFLAGS2,;t t - s,@INSTALL_LIB@,$INSTALL_LIB,;t t -+s,@RPATH_LIST@,$RPATH_LIST,;t t - s,@cf_ldd_prog@,$cf_ldd_prog,;t t - s,@TERMINFO_SRC@,$TERMINFO_SRC,;t t -+s,@NCURSES_USE_DATABASE@,$NCURSES_USE_DATABASE,;t t - s,@FALLBACK_LIST@,$FALLBACK_LIST,;t t - s,@WHICH_XTERM@,$WHICH_XTERM,;t t -+s,@XTERM_KBS@,$XTERM_KBS,;t t - s,@TERMINFO_DIRS@,$TERMINFO_DIRS,;t t - s,@TERMINFO@,$TERMINFO,;t t - s,@MAKE_TERMINFO@,$MAKE_TERMINFO,;t t - s,@USE_BIG_STRINGS@,$USE_BIG_STRINGS,;t t - s,@TERMPATH@,$TERMPATH,;t t -+s,@NCURSES_USE_TERMCAP@,$NCURSES_USE_TERMCAP,;t t - s,@BROKEN_LINKER@,$BROKEN_LINKER,;t t - s,@NCURSES_CH_T@,$NCURSES_CH_T,;t t - s,@NCURSES_LIBUTF8@,$NCURSES_LIBUTF8,;t t -@@ -19955,6 +21679,7 @@ - s,@TERMINFO_CAPS@,$TERMINFO_CAPS,;t t - s,@NCURSES_OSPEED@,$NCURSES_OSPEED,;t t - s,@NCURSES_CCHARW_MAX@,$NCURSES_CCHARW_MAX,;t t -+s,@NCURSES_TPARM_ARG@,$NCURSES_TPARM_ARG,;t t - s,@MANPAGE_RENAMES@,$MANPAGE_RENAMES,;t t - s,@NCURSES_EXT_FUNCS@,$NCURSES_EXT_FUNCS,;t t - s,@GENERATED_EXT_FUNCS@,$GENERATED_EXT_FUNCS,;t t -@@ -19972,6 +21697,11 @@ - s,@NCURSES_OPAQUE@,$NCURSES_OPAQUE,;t t - s,@NCURSES_SIZE_T@,$NCURSES_SIZE_T,;t t - s,@NCURSES_WRAP_PREFIX@,$NCURSES_WRAP_PREFIX,;t t -+s,@ECHO_LT@,$ECHO_LT,;t t -+s,@ECHO_LD@,$ECHO_LD,;t t -+s,@RULE_CC@,$RULE_CC,;t t -+s,@SHOW_CC@,$SHOW_CC,;t t -+s,@ECHO_CC@,$ECHO_CC,;t t - s,@ECHO_LINK@,$ECHO_LINK,;t t - s,@ADAFLAGS@,$ADAFLAGS,;t t - s,@EXTRA_CFLAGS@,$EXTRA_CFLAGS,;t t -@@ -20015,14 +21745,17 @@ - s,@TICS_ARG_SUFFIX@,$TICS_ARG_SUFFIX,;t t - s,@TICS_DEP_SUFFIX@,$TICS_DEP_SUFFIX,;t t - s,@TICS_LIB_SUFFIX@,$TICS_LIB_SUFFIX,;t t --s,@TICS_ARGS@,$TICS_ARGS,;t t -+s,@TICS_LDFLAGS@,$TICS_LDFLAGS,;t t -+s,@TICS_LIBS@,$TICS_LIBS,;t t - s,@TINFO_ARG_SUFFIX@,$TINFO_ARG_SUFFIX,;t t - s,@TINFO_DEP_SUFFIX@,$TINFO_DEP_SUFFIX,;t t - s,@TINFO_LIB_SUFFIX@,$TINFO_LIB_SUFFIX,;t t --s,@TINFO_ARGS@,$TINFO_ARGS,;t t --s,@TINFO_ARGS2@,$TINFO_ARGS2,;t t -+s,@TINFO_LDFLAGS@,$TINFO_LDFLAGS,;t t -+s,@TINFO_LIBS@,$TINFO_LIBS,;t t -+s,@TINFO_LDFLAGS2@,$TINFO_LDFLAGS2,;t t - s,@LDFLAGS_STATIC@,$LDFLAGS_STATIC,;t t - s,@LDFLAGS_SHARED@,$LDFLAGS_SHARED,;t t -+s,@includesubdir@,$includesubdir,;t t - s,@WITH_OVERWRITE@,$WITH_OVERWRITE,;t t - s,@TICS_LIST@,$TICS_LIST,;t t - s,@TINFO_LIST@,$TINFO_LIST,;t t -@@ -20032,10 +21765,12 @@ - s,@TEST_DEPS@,$TEST_DEPS,;t t - s,@TEST_ARG2@,$TEST_ARG2,;t t - s,@TEST_DEP2@,$TEST_DEP2,;t t -+s,@PC_MODULES_TO_MAKE@,$PC_MODULES_TO_MAKE,;t t - s,@ADA_SUBDIRS@,$ADA_SUBDIRS,;t t - s,@DIRS_TO_MAKE@,$DIRS_TO_MAKE,;t t - s,@NCURSES_SHLIB2@,$NCURSES_SHLIB2,;t t - s,@HAVE_TCGETATTR@,$HAVE_TCGETATTR,;t t -+s,@HAVE_STDINT_H@,$HAVE_STDINT_H,;t t - s,@HAVE_TERMIO_H@,$HAVE_TERMIO_H,;t t - s,@HAVE_TERMIOS_H@,$HAVE_TERMIOS_H,;t t - s,@MAKE_PC_FILES@,$MAKE_PC_FILES,;t t -@@ -20043,6 +21778,10 @@ - s,@TIC_PATH@,$TIC_PATH,;t t - s,@MAKE_TESTS@,$MAKE_TESTS,;t t - s,@ADAHTML_DIR@,$ADAHTML_DIR,;t t -+s,@PANEL_NAME@,$PANEL_NAME,;t t -+s,@MENU_NAME@,$MENU_NAME,;t t -+s,@FORM_NAME@,$FORM_NAME,;t t -+s,@CXX_NAME@,$CXX_NAME,;t t - CEOF - - EOF -@@ -20157,7 +21896,7 @@ - esac - - if test x"$ac_file" != x-; then -- { echo "$as_me:20160: creating $ac_file" >&5 -+ { echo "$as_me:21899: creating $ac_file" >&5 - echo "$as_me: creating $ac_file" >&6;} - rm -f "$ac_file" - fi -@@ -20175,7 +21914,7 @@ - -) echo $tmp/stdin ;; - [\\/$]*) - # Absolute (can't be DOS-style, as IFS=:) -- test -f "$f" || { { echo "$as_me:20178: error: cannot find input file: $f" >&5 -+ test -f "$f" || { { echo "$as_me:21917: error: cannot find input file: $f" >&5 - echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - echo $f;; -@@ -20188,13 +21927,45 @@ - echo $srcdir/$f - else - # /dev/null tree -- { { echo "$as_me:20191: error: cannot find input file: $f" >&5 -+ { { echo "$as_me:21930: error: cannot find input file: $f" >&5 - echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - fi;; - esac - done` || { (exit 1); exit 1; } - EOF -+cat >>$CONFIG_STATUS <<\EOF -+ ac_warn_datarootdir=no -+ if test x"$ac_file" != x-; then -+ for ac_item in $ac_file_inputs -+ do -+ ac_seen=`grep '@\(datadir\|mandir\|infodir\)@' $ac_item` -+ if test -n "$ac_seen"; then -+ ac_used=`grep '@datarootdir@' $ac_item` -+ if test -z "$ac_used"; then -+ { echo "$as_me:21946: WARNING: datarootdir was used implicitly but not set: -+$ac_seen" >&5 -+echo "$as_me: WARNING: datarootdir was used implicitly but not set: -+$ac_seen" >&2;} -+ ac_warn_datarootdir=yes -+ fi -+ fi -+ ac_seen=`grep '${datarootdir}' $ac_item` -+ if test -n "$ac_seen"; then -+ { echo "$as_me:21955: WARNING: datarootdir was used explicitly but not set: -+$ac_seen" >&5 -+echo "$as_me: WARNING: datarootdir was used explicitly but not set: -+$ac_seen" >&2;} -+ ac_warn_datarootdir=yes -+ fi -+ done -+ fi -+ -+if test "x$ac_warn_datarootdir" = xyes; then -+ ac_sed_cmds="$ac_sed_cmds | sed -e 's,@datarootdir@,\${prefix}/share,g' -e 's,\${datarootdir},\${prefix}/share,g'" -+fi -+ -+EOF - cat >>$CONFIG_STATUS <$tmp/out - rm -f $tmp/stdin - if test x"$ac_file" != x-; then -- mv $tmp/out $ac_file -+ cp $tmp/out $ac_file -+ -+ for ac_name in prefix exec_prefix datarootdir -+ do -+ ac_seen=`fgrep -n '${'$ac_name'[:=].*}' $ac_file` -+ if test -n "$ac_seen"; then -+ ac_init=`egrep '[ ]*'$ac_name'[ ]*=' $ac_file` -+ if test -z "$ac_init"; then -+ ac_seen=`echo "$ac_seen" |sed -e 's,^,'$ac_file':,'` -+ { echo "$as_me:21992: WARNING: Variable $ac_name is used but was not set: -+$ac_seen" >&5 -+echo "$as_me: WARNING: Variable $ac_name is used but was not set: -+$ac_seen" >&2;} -+ fi -+ fi -+ done -+ egrep -n '@[a-z_][a-z_0-9]+@' $ac_file >$tmp/out -+ egrep -n '@[A-Z_][A-Z_0-9]+@' $ac_file >>$tmp/out -+ if test -s $tmp/out; then -+ ac_seen=`sed -e 's,^,'$ac_file':,' < $tmp/out` -+ { echo "$as_me:22003: WARNING: Some variables may not be substituted: -+$ac_seen" >&5 -+echo "$as_me: WARNING: Some variables may not be substituted: -+$ac_seen" >&2;} -+ fi - else - cat $tmp/out -- rm -f $tmp/out - fi -+ rm -f $tmp/out - - done - EOF -@@ -20254,7 +22049,7 @@ - * ) ac_file_in=$ac_file.in ;; - esac - -- test x"$ac_file" != x- && { echo "$as_me:20257: creating $ac_file" >&5 -+ test x"$ac_file" != x- && { echo "$as_me:22052: creating $ac_file" >&5 - echo "$as_me: creating $ac_file" >&6;} - - # First look for the input files in the build tree, otherwise in the -@@ -20265,7 +22060,7 @@ - -) echo $tmp/stdin ;; - [\\/$]*) - # Absolute (can't be DOS-style, as IFS=:) -- test -f "$f" || { { echo "$as_me:20268: error: cannot find input file: $f" >&5 -+ test -f "$f" || { { echo "$as_me:22063: error: cannot find input file: $f" >&5 - echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - echo $f;; -@@ -20278,7 +22073,7 @@ - echo $srcdir/$f - else - # /dev/null tree -- { { echo "$as_me:20281: error: cannot find input file: $f" >&5 -+ { { echo "$as_me:22076: error: cannot find input file: $f" >&5 - echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - fi;; -@@ -20336,7 +22131,7 @@ - rm -f $tmp/in - if test x"$ac_file" != x-; then - if cmp -s $ac_file $tmp/config.h 2>/dev/null; then -- { echo "$as_me:20339: $ac_file is unchanged" >&5 -+ { echo "$as_me:22134: $ac_file is unchanged" >&5 - echo "$as_me: $ac_file is unchanged" >&6;} - else - ac_dir=`$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ -@@ -20394,25 +22189,20 @@ - if test ! -d $srcdir/$cf_dir; then - continue - elif test -f $srcdir/$cf_dir/programs; then -- $AWK -f $srcdir/test/mk-test.awk INSTALL=no ECHO_LINK="$ECHO_LINK" $srcdir/$cf_dir/programs >>$cf_dir/Makefile -+ $AWK -f $srcdir/test/mk-test.awk INSTALL=no ECHO_LINK="$ECHO_LD" $srcdir/$cf_dir/programs >>$cf_dir/Makefile - fi - done - - fi - -- case $cf_cv_system_name in #(vi -- OS/2*|os2*) #(vi -- LIB_PREFIX='' -- ;; -- *) LIB_PREFIX='lib' -- ;; -- esac - cf_prefix=$LIB_PREFIX - --if test $cf_cv_shlib_version = cygdll ; then -+case $cf_cv_shlib_version in #(vi -+cygdll|msysdll|mingw) - TINFO_NAME=$TINFO_ARG_SUFFIX - TINFO_SUFFIX=.dll --fi -+ ;; -+esac - - if test -n "$TINFO_SUFFIX" ; then - case $TINFO_SUFFIX in -@@ -20438,34 +22228,30 @@ - elif test -f $srcdir/$cf_dir/modules; then - - SHARED_LIB= -- LIBS_TO_MAKE= -+ Libs_To_Make= - for cf_item in $cf_LIST_MODELS - do - -- case $cf_item in #(vi -- libtool) #(vi -+ case X$cf_item in #(vi -+ Xlibtool) #(vi - cf_suffix='.la' - cf_depsuf=$cf_suffix - ;; -- normal) #(vi -- cf_suffix='.a' -- cf_depsuf=$cf_suffix -- ;; -- debug) #(vi -+ Xdebug) #(vi - cf_suffix='_g.a' - cf_depsuf=$cf_suffix - ;; -- profile) #(vi -+ Xprofile) #(vi - cf_suffix='_p.a' - cf_depsuf=$cf_suffix - ;; -- shared) #(vi -+ Xshared) #(vi - case $cf_cv_system_name in -- aix[56]*) #(vi -+ aix[5-7]*) #(vi - cf_suffix='.a' - cf_depsuf=$cf_suffix - ;; -- cygwin*) #(vi -+ cygwin*|msys*|mingw*) #(vi - cf_suffix='.dll' - cf_depsuf='.dll.a' - ;; -@@ -20485,83 +22271,88 @@ - ;; - esac - ;; -- *) cf_suffix='.so' -+ *) #(vi -+ cf_suffix='.so' - cf_depsuf=$cf_suffix - ;; - esac -+ ;; -+ *) -+ cf_suffix='.a' -+ cf_depsuf=$cf_suffix -+ ;; - esac - test -n "$LIB_SUFFIX" && cf_suffix="${LIB_SUFFIX}${cf_suffix}" - test -n "$LIB_SUFFIX" && cf_depsuf="${LIB_SUFFIX}${cf_depsuf}" - -+ cf_libname=$cf_dir -+ test "$cf_dir" = c++ && cf_libname=ncurses++ - if test $cf_item = shared ; then -- if test "$cf_cv_do_symlinks" = yes ; then -- case "$cf_cv_shlib_version" in #(vi -- rel) #(vi -- case "$cf_cv_system_name" in #(vi -- darwin*) -- case .${LIB_SUFFIX} in -- .tw*) -- cf_suffix=`echo $cf_suffix | sed 's/^tw//'` -- cf_suffix=tw'.${REL_VERSION}'"$cf_suffix" -- ;; -- .t*) -- cf_suffix=`echo $cf_suffix | sed 's/^t//'` -- cf_suffix=t'.${REL_VERSION}'"$cf_suffix" -- ;; -- .w*) -- cf_suffix=`echo $cf_suffix | sed 's/^w//'` -- cf_suffix=w'.${REL_VERSION}'"$cf_suffix" -+ if test -n "${LIB_SUFFIX}" -+ then -+ cf_shared_suffix=`echo "$cf_suffix" | sed 's/^'"${LIB_SUFFIX}"'//'` -+ else -+ cf_shared_suffix="$cf_suffix" -+ fi -+ if test "$cf_cv_do_symlinks" = yes ; then -+ cf_version_name= -+ -+ case "$cf_cv_shlib_version" in #(vi -+ rel) #(vi -+ cf_version_name=REL_VERSION - ;; -- *) -- cf_suffix='.${REL_VERSION}'"$cf_suffix" -+ abi) -+ cf_version_name=ABI_VERSION - ;; - esac -- ;; #(vi -- *) cf_suffix="$cf_suffix"'.${REL_VERSION}' ;; -- esac -+ -+ if test -n "$cf_version_name" -+ then -+ case "$cf_cv_system_name" in #(vi -+ darwin*) -+ # "w", etc? -+ cf_suffix="${LIB_SUFFIX}"'.${'$cf_version_name'}'"$cf_shared_suffix" -+ ;; #(vi -+ *) -+ cf_suffix="$cf_suffix"'.${'$cf_version_name'}' -+ ;; -+ esac -+ fi -+ if test -n "${LIB_SUFFIX}" -+ then -+ cf_shared_suffix=`echo "$cf_suffix" | sed 's/^'"${LIB_SUFFIX}"'//'` -+ else -+ cf_shared_suffix="$cf_suffix" -+ fi -+ fi -+ # cygwin needs import library, and has unique naming convention -+ # use autodetected ${cf_prefix} for import lib and static lib, but -+ # use 'cyg' prefix for shared lib. -+ case $cf_cv_shlib_version in #(vi -+ cygdll) #(vi -+ cf_cygsuf=`echo "$cf_suffix" | sed -e 's/\.dll/\${ABI_VERSION}.dll/'` -+ Libs_To_Make="$Libs_To_Make ../lib/cyg${cf_libname}${cf_cygsuf}" -+ continue - ;; -- abi) -- case "$cf_cv_system_name" in #(vi -- darwin*) -- case .${LIB_SUFFIX} in -- .tw*) -- cf_suffix=`echo $cf_suffix | sed 's/^tw//'` -- cf_suffix=tw'.${ABI_VERSION}'"$cf_suffix" -- ;; -- .t*) -- cf_suffix=`echo $cf_suffix | sed 's/^t//'` -- cf_suffix=t'.${ABI_VERSION}'"$cf_suffix" -- ;; -- .w*) -- cf_suffix=`echo $cf_suffix | sed 's/^w//'` -- cf_suffix=w'.${ABI_VERSION}'"$cf_suffix" -- ;; -- *) -- cf_suffix='.${ABI_VERSION}'"$cf_suffix" -- ;; -- esac -- ;; #(vi -- *) cf_suffix="$cf_suffix"'.${ABI_VERSION}' ;; -- esac -+ msysdll) #(vi -+ cf_cygsuf=`echo "$cf_suffix" | sed -e 's/\.dll/\${ABI_VERSION}.dll/'` -+ Libs_To_Make="$Libs_To_Make ../lib/msys-${cf_libname}${cf_cygsuf}" -+ continue -+ ;; -+ mingw) -+ cf_cygsuf=`echo "$cf_suffix" | sed -e 's/\.dll/\${ABI_VERSION}.dll/'` -+ Libs_To_Make="$Libs_To_Make ../lib/lib${cf_libname}${cf_cygsuf}" -+ continue - ;; - esac - fi -- # cygwin needs import library, and has unique naming convention -- # use autodetected ${cf_prefix} for import lib and static lib, but -- # use 'cyg' prefix for shared lib. -- if test $cf_cv_shlib_version = cygdll ; then -- cf_cygsuf=`echo "$cf_suffix" | sed -e 's/\.dll/\${ABI_VERSION}.dll/'` -- LIBS_TO_MAKE="$LIBS_TO_MAKE ../lib/cyg${cf_dir}${cf_cygsuf}" -- continue -- fi -- fi -- LIBS_TO_MAKE="$LIBS_TO_MAKE ../lib/${cf_prefix}${cf_dir}${cf_suffix}" -+ Libs_To_Make="$Libs_To_Make ../lib/${cf_prefix}${cf_libname}${cf_suffix}" - done - - if test $cf_dir = ncurses ; then - cf_subsets="$LIB_SUBSETS" - cf_r_parts="$cf_subsets" -- cf_liblist="$LIBS_TO_MAKE" -+ cf_liblist="$Libs_To_Make" - - while test -n "$cf_r_parts" - do -@@ -20581,7 +22372,7 @@ - ;; - esac - if test -n "$cf_item"; then -- LIBS_TO_MAKE="$cf_item $LIBS_TO_MAKE" -+ Libs_To_Make="$cf_item $Libs_To_Make" - fi - else - break -@@ -20591,13 +22382,40 @@ - cf_subsets=`echo "$LIB_SUBSETS" | sed -e 's/^termlib.* //'` - fi - -- sed -e "s%@LIBS_TO_MAKE@%$LIBS_TO_MAKE%" \ -+ if test $cf_dir = c++; then -+ if test "x$with_shared_cxx" != xyes && test -n "$cf_shared_suffix"; then -+ cf_list= -+ for cf_item in $Libs_To_Make -+ do -+ case $cf_item in -+ *.a) -+ ;; -+ *) -+ cf_item=`echo "$cf_item" | sed -e "s,"$cf_shared_suffix",.a,"` -+ ;; -+ esac -+ for cf_test in $cf_list -+ do -+ if test "$cf_test" = "$cf_item" -+ then -+ cf_LIST_MODELS=`echo "$cf_LIST_MODELS" | sed -e 's/normal//'` -+ cf_item= -+ break -+ fi -+ done -+ test -n "$cf_item" && cf_list="$cf_list $cf_item" -+ done -+ Libs_To_Make="$cf_list" -+ fi -+ fi -+ -+ sed -e "s%@Libs_To_Make@%$Libs_To_Make%" \ - -e "s%@SHARED_LIB@%$SHARED_LIB%" \ - $cf_dir/Makefile >$cf_dir/Makefile.out - mv $cf_dir/Makefile.out $cf_dir/Makefile - - $AWK -f $srcdir/mk-0th.awk \ -- libname="${cf_dir}${LIB_SUFFIX}" subsets="$LIB_SUBSETS" \ -+ libname="${cf_dir}${LIB_SUFFIX}" subsets="$LIB_SUBSETS" ticlib="$TICS_LIB_SUFFIX" termlib="$TINFO_LIB_SUFFIX" \ - $srcdir/$cf_dir/modules >>$cf_dir/Makefile - - for cf_subset in $cf_subsets -@@ -20605,34 +22423,47 @@ - cf_subdirs= - for cf_item in $cf_LIST_MODELS - do -+ - echo "Appending rules for ${cf_item} model (${cf_dir}: ${cf_subset})" - - cf_ITEM=`echo "$cf_item" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` - -- case $cf_item in #(vi -- libtool) #(vi -+ CXX_MODEL=$cf_ITEM -+ if test "$CXX_MODEL" = SHARED; then -+ case $cf_cv_shlib_version in #(vi -+ cygdll|msysdll|mingw) #(vi -+ test "x$with_shared_cxx" = xno && test -n "$verbose" && echo " overriding CXX_MODEL to SHARED" 1>&6 -+ -+echo "${as_me:-configure}:22437: testing overriding CXX_MODEL to SHARED ..." 1>&5 -+ -+ with_shared_cxx=yes -+ ;; -+ *) -+ test "x$with_shared_cxx" = xno && CXX_MODEL=NORMAL -+ ;; -+ esac -+ fi -+ -+ case X$cf_item in #(vi -+ Xlibtool) #(vi - cf_suffix='.la' - cf_depsuf=$cf_suffix - ;; -- normal) #(vi -- cf_suffix='.a' -- cf_depsuf=$cf_suffix -- ;; -- debug) #(vi -+ Xdebug) #(vi - cf_suffix='_g.a' - cf_depsuf=$cf_suffix - ;; -- profile) #(vi -+ Xprofile) #(vi - cf_suffix='_p.a' - cf_depsuf=$cf_suffix - ;; -- shared) #(vi -+ Xshared) #(vi - case $cf_cv_system_name in -- aix[56]*) #(vi -+ aix[5-7]*) #(vi - cf_suffix='.a' - cf_depsuf=$cf_suffix - ;; -- cygwin*) #(vi -+ cygwin*|msys*|mingw*) #(vi - cf_suffix='.dll' - cf_depsuf='.dll.a' - ;; -@@ -20652,10 +22483,16 @@ - ;; - esac - ;; -- *) cf_suffix='.so' -+ *) #(vi -+ cf_suffix='.so' - cf_depsuf=$cf_suffix - ;; - esac -+ ;; -+ *) -+ cf_suffix='.a' -+ cf_depsuf=$cf_suffix -+ ;; - esac - test -n "$LIB_SUFFIX" && cf_suffix="${LIB_SUFFIX}${cf_suffix}" - test -n "$LIB_SUFFIX" && cf_depsuf="${LIB_SUFFIX}${cf_depsuf}" -@@ -20667,7 +22504,7 @@ - profile) cf_subdir='obj_p' ;; - shared) - case $cf_cv_system_name in #(vi -- cygwin) #(vi -+ cygwin|msys) #(vi - cf_subdir='objects' ;; - *) - cf_subdir='obj_s' ;; -@@ -20688,6 +22525,8 @@ - cf_libname=$TICS_LIB_SUFFIX - ;; - esac -+ elif test $cf_dir = c++ ; then -+ cf_libname=ncurses++$LIB_SUFFIX - else - cf_libname=${cf_libname}$LIB_SUFFIX - fi -@@ -20739,10 +22578,12 @@ - name=${cf_libname}${cf_dir_suffix} \ - traces=$LIB_TRACING \ - MODEL=$cf_ITEM \ -+ CXX_MODEL=$CXX_MODEL \ - model=$cf_subdir \ - prefix=$cf_prefix \ - suffix=$cf_suffix \ - subset=$cf_subset \ -+ driver=$cf_cv_term_driver \ - SymLink="$LN_S" \ - TermlibRoot=$TINFO_NAME \ - TermlibSuffix=$TINFO_SUFFIX \ -@@ -20781,7 +22622,7 @@ - done - fi - -- echo ' cd '$cf_dir' && ${MAKE} ${CF_MFLAGS} $@' >>Makefile -+ echo ' cd '$cf_dir' && ${MAKE} ${TOP_MFLAGS} $@' >>Makefile - done - - for cf_dir in $SRC_SUBDIRS -@@ -20796,7 +22637,7 @@ - echo 'libs \' >> Makefile - echo 'install.libs \' >> Makefile - echo 'uninstall.libs ::' >> Makefile -- echo ' cd '$cf_dir' && ${MAKE} ${CF_MFLAGS} $@' >> Makefile -+ echo ' cd '$cf_dir' && ${MAKE} ${TOP_MFLAGS} $@' >> Makefile - ;; - esac - fi -@@ -20819,7 +22660,7 @@ - uninstall.libs \\ - install.$cf_dir \\ - uninstall.$cf_dir :: -- cd $cf_dir && \${MAKE} \${CF_MFLAGS} \$@ -+ cd $cf_dir && \${MAKE} \${TOP_MFLAGS} \$@ - CF_EOF - elif test -f $srcdir/$cf_dir/headers; then - cat >> Makefile <> Makefile <> Makefile <>Ada95/src/Makefile - fi -diff -Naur ncurses-5.9/configure.in ncurses-5.9.patch/configure.in ---- ncurses-5.9/configure.in 2011-03-28 02:22:26.000000000 +0200 -+++ ncurses-5.9.patch/configure.in 2014-09-01 16:34:19.469887090 +0200 -@@ -1,5 +1,5 @@ - dnl*************************************************************************** --dnl Copyright (c) 1998-2010,2011 Free Software Foundation, Inc. * -+dnl Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. * - dnl * - dnl Permission is hereby granted, free of charge, to any person obtaining a * - dnl copy of this software and associated documentation files (the * -@@ -28,14 +28,14 @@ - dnl - dnl Author: Thomas E. Dickey 1995-on - dnl --dnl $Id: configure.in,v 1.520 2011/03/28 00:22:26 tom Exp $ -+dnl $Id: configure.in,v 1.578 2014/03/22 22:58:09 tom Exp $ - dnl Process this file with autoconf to produce a configure script. - dnl - dnl See http://invisible-island.net/autoconf/ for additional information. - dnl - dnl --------------------------------------------------------------------------- --AC_PREREQ(2.13.20020210) --AC_REVISION($Revision: 1.520 $) -+AC_PREREQ(2.52.20030208) -+AC_REVISION($Revision: 1.578 $) - AC_INIT(ncurses/base/lib_initscr.c) - AC_CONFIG_HEADER(include/ncurses_cfg.h:include/ncurses_cfg.hin) - -@@ -45,11 +45,7 @@ - CF_WITH_REL_VERSION(NCURSES) - CF_WITH_ABI_VERSION - --CF_CHECK_CACHE([AC_CANONICAL_SYSTEM]) --AC_ARG_WITH(system-type, --[ --with-system-type=XXX test: override derived host system-type], --[AC_MSG_WARN(overriding system type to $withval) -- cf_cv_system_name=$withval]) -+CF_WITH_SYSTYPE - - ### Save the given $CFLAGS to allow user-override. - cf_user_CFLAGS="$CFLAGS" -@@ -58,15 +54,22 @@ - CF_CFG_DEFAULTS - - ### Checks for programs. --AC_PROG_CC --CF_GCC_VERSION -+AC_ARG_WITH(ada, -+ [ --without-ada suppress check for Ada95, don't build demo], -+ [cf_with_ada=$withval], -+ [cf_with_ada=yes]) -+if test "x$cf_with_ada" = xyes -+then -+ cf_PROG_CC="gnatgcc gcc cc" -+else -+ cf_PROG_CC="gcc cc" -+fi -+ -+CF_PROG_CC($cf_PROG_CC) - - AC_PROG_CPP - AC_PROG_GCC_TRADITIONAL - CF_PROG_CC_C_O(CC) --AC_ISC_POSIX --CF_ANSI_CC_REQD --CF_PROG_EXT - CF_PROG_LDCONFIG - - dnl DEFECT in autoconf 2.12: an attempt to set policy, this breaks the -@@ -89,14 +92,16 @@ - cf_with_cxx=no; CXX=""; GXX="";])dnl - AC_PROG_CXX - popdef([AC_MSG_ERROR])dnl -- # autoconf 2.5x removed the error - by hardcoding it to g++. -+ # autoconf 2.5x removed the error (hardcoding it to g++, or just blank) - if test "$CXX" = "g++" ; then - AC_PATH_PROG(CXX,g++) - fi -- if test "$CXX" = "g++" ; then -- AC_MSG_WARN(ignoring hardcoded g++) -+ case "x$CXX" in #(vi -+ x|xg++) -+ AC_MSG_WARN([You don't have any C++ compiler, too bad]) - cf_with_cxx=no; CXX=""; GXX=""; -- fi -+ ;; -+ esac - fi - - CF_GXX_VERSION -@@ -116,12 +121,15 @@ - AC_MSG_RESULT($cf_with_cxx_binding) - - AC_MSG_CHECKING(if you want to build with Ada95) --AC_ARG_WITH(ada, -- [ --without-ada suppress check for Ada95, don't build demo], -- [cf_with_ada=$withval], -- [cf_with_ada=yes]) - AC_MSG_RESULT($cf_with_ada) - -+AC_MSG_CHECKING(if you want to install terminal database) -+AC_ARG_ENABLE(db-install, -+ [ --disable-db-install suppress install of terminal database], -+ [cf_with_db_install=$enableval], -+ [cf_with_db_install=yes]) -+AC_MSG_RESULT($cf_with_db_install) -+ - AC_MSG_CHECKING(if you want to install manpages) - AC_ARG_WITH(manpages, - [ --without-manpages suppress install of manpages], -@@ -131,14 +139,14 @@ - - AC_MSG_CHECKING(if you want to build programs such as tic) - AC_ARG_WITH(progs, -- [ --without-progs suppress build with programs (e.g., tic)], -+ [ --without-progs suppress build/install with programs (e.g., tic)], - [cf_with_progs=$withval], - [cf_with_progs=yes]) - AC_MSG_RESULT($cf_with_progs) - - AC_MSG_CHECKING(if you want to build test-programs) - AC_ARG_WITH(tests, -- [ --without-tests suppress build with test-programs], -+ [ --without-tests suppress build/install with test-programs], - [cf_with_tests=$withval], - [cf_with_tests=yes]) - AC_MSG_RESULT($cf_with_tests) -@@ -168,28 +176,8 @@ - - # if we find pkg-config, check if we should install the ".pc" files. - CF_PKG_CONFIG -- --if test "$PKG_CONFIG" != no ; then -- AC_MSG_CHECKING(if we should install .pc files for $PKG_CONFIG) -- -- # Leave this as something that can be overridden in the environment. -- if test -z "$PKG_CONFIG_LIBDIR" ; then -- PKG_CONFIG_LIBDIR=`echo "$PKG_CONFIG" | sed -e 's,/[[^/]]*/[[^/]]*$,,'`/lib/pkgconfig -- fi -- PKG_CONFIG_LIBDIR=`echo "$PKG_CONFIG_LIBDIR" | sed -e 's/^://' -e 's/:.*//'` -- if test -n "$PKG_CONFIG_LIBDIR" && test -d "$PKG_CONFIG_LIBDIR" ; then -- AC_ARG_ENABLE(pc-files, -- [ --enable-pc-files generate and install .pc files for pkg-config], -- [enable_pc_files=$enableval], -- [enable_pc_files=no]) -- AC_MSG_RESULT($enable_pc_files) -- else -- AC_MSG_RESULT(no) -- AC_MSG_WARN(did not find library $PKG_CONFIG_LIBDIR) -- enable_pc_files=no -- fi --fi --AC_SUBST(PKG_CONFIG_LIBDIR) -+CF_WITH_PKG_CONFIG_LIBDIR -+CF_ENABLE_PC_FILES - - AC_MSG_CHECKING(if we should assume mixed-case filenames) - AC_ARG_ENABLE(mixed-case, -@@ -201,8 +189,8 @@ - CF_MIXEDCASE_FILENAMES - else - cf_cv_mixedcase=$enable_mixedcase -- if test "$enable_mixedcase" = "yes" ; then -- AC_DEFINE(MIXEDCASE_FILENAMES) -+ if test "x$enable_mixedcase" = "xyes" ; then -+ AC_DEFINE(MIXEDCASE_FILENAMES,1,[Define to 1 if tic should assume mixed-case filenames]) - fi - fi - -@@ -215,6 +203,7 @@ - AC_CHECK_TOOL(RANLIB, ranlib, ':') - AC_CHECK_TOOL(LD, ld, ld) - AC_CHECK_TOOL(AR, ar, ar) -+AC_CHECK_TOOL(NM, nm, nm) - CF_AR_FLAGS - - dnl Special option for use by system-builders: the install-prefix is used to -@@ -223,8 +212,8 @@ - AC_MSG_CHECKING(if you have specified an install-prefix) - AC_ARG_WITH(install-prefix, - [ --with-install-prefix prefixes actual install-location ($DESTDIR)], -- [case "$withval" in #(vi -- yes|no) #(vi -+ [case "x$withval" in #(vi -+ xyes|xno) #(vi - ;; - *) DESTDIR="$withval" - ;; -@@ -261,7 +250,7 @@ - [with_shared=$withval], - [with_shared=no]) - AC_MSG_RESULT($with_shared) --test "$with_shared" = "yes" && cf_list_models="$cf_list_models shared" -+test "x$with_shared" = "xyes" && cf_list_models="$cf_list_models shared" - - AC_MSG_CHECKING(if you want to build static libraries) - AC_ARG_WITH(normal, -@@ -269,7 +258,7 @@ - [with_normal=$withval], - [with_normal=yes]) - AC_MSG_RESULT($with_normal) --test "$with_normal" = "yes" && cf_list_models="$cf_list_models normal" -+test "x$with_normal" = "xyes" && cf_list_models="$cf_list_models normal" - - AC_MSG_CHECKING(if you want to build debug libraries) - AC_ARG_WITH(debug, -@@ -277,7 +266,7 @@ - [with_debug=$withval], - [with_debug=yes]) - AC_MSG_RESULT($with_debug) --test "$with_debug" = "yes" && cf_list_models="$cf_list_models debug" -+test "x$with_debug" = "xyes" && cf_list_models="$cf_list_models debug" - - AC_MSG_CHECKING(if you want to build profiling libraries) - AC_ARG_WITH(profile, -@@ -285,10 +274,21 @@ - [with_profile=$withval], - [with_profile=no]) - AC_MSG_RESULT($with_profile) --test "$with_profile" = "yes" && cf_list_models="$cf_list_models profile" -+test "x$with_profile" = "xyes" && cf_list_models="$cf_list_models profile" - - fi - -+if test "X$cf_with_cxx_binding" != Xno; then -+if test "x$with_shared" = "xyes"; then -+AC_MSG_CHECKING(if you want to build C++ shared libraries) -+AC_ARG_WITH(cxx-shared, -+ [ --with-cxx-shared generate C++ shared-libraries], -+ [with_shared_cxx=$withval], -+ [with_shared_cxx=no]) -+AC_MSG_RESULT($with_shared_cxx) -+fi -+fi -+ - ############################################################################### - - AC_MSG_CHECKING(for specified models) -@@ -321,12 +321,11 @@ - LIB_DIR=../lib - LIB_2ND=../../lib - --CF_LIB_PREFIX(cf_prefix) --LIB_PREFIX=$cf_prefix --AC_SUBST(LIB_PREFIX) -+CF_WITH_LIB_PREFIX(cf_prefix) - - LIB_SUFFIX= - AC_SUBST(LIB_SUFFIX) -+CF_PATHSEP - - ############################################################################### - -@@ -354,21 +353,21 @@ - [with_dlsym=$withval], - [with_dlsym=yes]) - AC_MSG_RESULT($with_dlsym) -- if test "$with_dlsym" = yes ; then -+ if test "x$with_dlsym" = xyes ; then - CF_FUNC_DLSYM -- if test "$with_gpm" != yes ; then -+ if test "x$with_gpm" != xyes ; then - CF_VERBOSE(assuming soname for gpm is $with_gpm) - cf_cv_gpm_soname="$with_gpm" - else - CF_LIB_SONAME([#include ],[if (Gpm_Open(0,0)) Gpm_Close();],gpm) - fi -- test "$cf_cv_gpm_soname" != "unknown" && AC_DEFINE_UNQUOTED(LIBGPM_SONAME,"$cf_cv_gpm_soname") -+ test "$cf_cv_gpm_soname" != "unknown" && AC_DEFINE_UNQUOTED(LIBGPM_SONAME,"$cf_cv_gpm_soname",[Define as needed to set the gpm share library soname]) - SHLIB_LIST="-ldl $SHLIB_LIST" - else - SHLIB_LIST="-lgpm $SHLIB_LIST" - CF_ADD_LIB(gpm,TEST_LIBS) - fi -- AC_DEFINE(HAVE_LIBGPM) -+ AC_DEFINE(HAVE_LIBGPM,1,[Define to 1 if we have the gpm library]) - CF_CHECK_GPM_WGETCH - fi - -@@ -378,13 +377,13 @@ - - if test X"$CC_G_OPT" = X"" ; then - CC_G_OPT='-g' -- test -n "$GCC" && test "${ac_cv_prog_cc_g}" != yes && CC_G_OPT='' -+ test -n "$GCC" && test "x${ac_cv_prog_cc_g}" != xyes && CC_G_OPT='' - fi - AC_SUBST(CC_G_OPT) - - if test X"$CXX_G_OPT" = X"" ; then - CXX_G_OPT='-g' -- test -n "$GXX" && test "${ac_cv_prog_cxx_g}" != yes && CXX_G_OPT='' -+ test -n "$GXX" && test "x${ac_cv_prog_cxx_g}" != xyes && CXX_G_OPT='' - fi - AC_SUBST(CXX_G_OPT) - -@@ -411,6 +410,8 @@ - ;; - esac - -+# we will build libraries one-level down. -+rel_builddir=.. - CF_SHARED_OPTS - if test "$CC_SHARED_OPTS" = "unknown"; then - for model in $cf_list_models; do -@@ -453,9 +454,9 @@ - esac - AC_SUBST(TERMINFO_SRC) - --CF_PATHSEP -+NCURSES_USE_DATABASE=0 - if test "$use_database" != no ; then -- AC_DEFINE(USE_DATABASE) -+ NCURSES_USE_DATABASE=1 - - AC_MSG_CHECKING(which terminfo source-file will be installed) - AC_ARG_WITH(database, -@@ -471,6 +472,7 @@ - else - with_hashed_db=no - fi -+AC_SUBST(NCURSES_USE_DATABASE) - - AC_MSG_CHECKING(for list of fallback descriptions) - AC_ARG_WITH(fallbacks, -@@ -494,6 +496,26 @@ - WHICH_XTERM=$with_xterm_new - AC_SUBST(WHICH_XTERM) - -+AC_MSG_CHECKING(if xterm backspace sends BS or DEL) -+AC_ARG_WITH(xterm-kbs, -+ [ --with-xterm-kbs=XXX specify if xterm backspace sends BS or DEL], -+ [with_xterm_kbs=$withval], -+ [with_xterm_kbs=BS]) -+case x$with_xterm_kbs in -+xyes|xno|xBS|xbs|x8) -+ with_xterm_kbs=BS -+ ;; -+xDEL|xdel|x127) -+ with_xterm_kbs=DEL -+ ;; -+*) -+ with_xterm_kbs=$withval -+ ;; -+esac -+AC_MSG_RESULT($with_xterm_kbs) -+XTERM_KBS=$with_xterm_kbs -+AC_SUBST(XTERM_KBS) -+ - MAKE_TERMINFO= - if test "$use_database" = no ; then - TERMINFO="${datadir}/terminfo" -@@ -507,7 +529,7 @@ - DATADIR/terminfo, - ${datadir}/terminfo) - AC_MSG_RESULT($TERMINFO_DIRS) --test -n "$TERMINFO_DIRS" && AC_DEFINE_UNQUOTED(TERMINFO_DIRS,"$TERMINFO_DIRS") -+test -n "$TERMINFO_DIRS" && AC_DEFINE_UNQUOTED(TERMINFO_DIRS,"$TERMINFO_DIRS",[Define as needed to predefine the TERMINFO_DIR searchlist]) - - AC_MSG_CHECKING(for default terminfo directory) - CF_WITH_PATH(default-terminfo-dir, -@@ -516,7 +538,7 @@ - DATADIR/terminfo, - ${datadir}/terminfo) - AC_MSG_RESULT($TERMINFO) --AC_DEFINE_UNQUOTED(TERMINFO,"$TERMINFO") -+AC_DEFINE_UNQUOTED(TERMINFO,"$TERMINFO",[Define to set the default terminal database path]) - - fi - -@@ -543,7 +565,7 @@ - [with_big_core=no], - [with_big_core=no])]) - AC_MSG_RESULT($with_big_core) --test "$with_big_core" = "yes" && AC_DEFINE(HAVE_BIG_CORE) -+test "x$with_big_core" = "xyes" && AC_DEFINE(HAVE_BIG_CORE,1,[Define to 1 if machine has ample memory for tic]) - - ### ISO C only guarantees 512-char strings, we have tables which load faster - ### when constructed using "big" strings. More than the C compiler, the awk -@@ -556,7 +578,7 @@ - AC_MSG_RESULT($with_big_strings) - - USE_BIG_STRINGS=0 --test "$with_big_strings" = "yes" && USE_BIG_STRINGS=1 -+test "x$with_big_strings" = "xyes" && USE_BIG_STRINGS=1 - AC_SUBST(USE_BIG_STRINGS) - - ### use option --enable-termcap to compile in the termcap fallback support -@@ -567,46 +589,48 @@ - [with_termcap=no]) - AC_MSG_RESULT($with_termcap) - --if test "$with_termcap" != "yes" ; then -+NCURSES_USE_TERMCAP=0 -+if test "x$with_termcap" != "xyes" ; then - if test "$use_database" = no ; then - if test -z "$with_fallback" ; then - AC_ERROR(You have disabled the database w/o specifying fallbacks) - fi - fi -- AC_DEFINE(PURE_TERMINFO) -+ AC_DEFINE(PURE_TERMINFO,1,[Define to 1 if we should support only terminfo]) - else - --if test "$with_ticlib" != no ; then -- AC_ERROR(Options --with-ticlib and --enable-termcap cannot be combined) --fi -+ if test "$with_ticlib" != no ; then -+ AC_ERROR(Options --with-ticlib and --enable-termcap cannot be combined) -+ fi - --AC_DEFINE(USE_TERMCAP) --AC_MSG_CHECKING(for list of termcap files) --CF_WITH_PATHLIST(termpath, -- [ --with-termpath=XXX specify list of termcap files], -- TERMPATH, -- /etc/termcap:/usr/share/misc/termcap) --AC_MSG_RESULT($TERMPATH) --test -n "$TERMPATH" && AC_DEFINE_UNQUOTED(TERMPATH,"$TERMPATH") -- --### use option --enable-getcap to use a hacked getcap for reading termcaps --AC_MSG_CHECKING(if fast termcap-loader is needed) --AC_ARG_ENABLE(getcap, -- [ --enable-getcap fast termcap load, no xrefs to terminfo], -- [with_getcap=$enableval], -- [with_getcap=no]) --AC_MSG_RESULT($with_getcap) --test "$with_getcap" = "yes" && AC_DEFINE(USE_GETCAP) -- --AC_MSG_CHECKING(if translated termcaps will be cached in ~/.terminfo) --AC_ARG_ENABLE(getcap-cache, -- [ --enable-getcap-cache cache translated termcaps in ~/.terminfo], -- [with_getcap_cache=$enableval], -- [with_getcap_cache=no]) --AC_MSG_RESULT($with_getcap_cache) --test "$with_getcap_cache" = "yes" && AC_DEFINE(USE_GETCAP_CACHE) -+ NCURSES_USE_TERMCAP=1 -+ AC_MSG_CHECKING(for list of termcap files) -+ CF_WITH_PATHLIST(termpath, -+ [ --with-termpath=XXX specify list of termcap files], -+ TERMPATH, -+ /etc/termcap:/usr/share/misc/termcap) -+ AC_MSG_RESULT($TERMPATH) -+ test -n "$TERMPATH" && AC_DEFINE_UNQUOTED(TERMPATH,"$TERMPATH",[Define to set the termcap searchlist]) -+ -+ ### use option --enable-getcap to use a hacked getcap for reading termcaps -+ AC_MSG_CHECKING(if fast termcap-loader is needed) -+ AC_ARG_ENABLE(getcap, -+ [ --enable-getcap fast termcap load, no xrefs to terminfo], -+ [with_getcap=$enableval], -+ [with_getcap=no]) -+ AC_MSG_RESULT($with_getcap) -+ test "x$with_getcap" = "xyes" && AC_DEFINE(USE_GETCAP,1,[Define to 1 to use fast termcap-loader]) -+ -+ AC_MSG_CHECKING(if translated termcaps will be cached in ~/.terminfo) -+ AC_ARG_ENABLE(getcap-cache, -+ [ --enable-getcap-cache cache translated termcaps in ~/.terminfo], -+ [with_getcap_cache=$enableval], -+ [with_getcap_cache=no]) -+ AC_MSG_RESULT($with_getcap_cache) -+ test "x$with_getcap_cache" = "xyes" && AC_DEFINE(USE_GETCAP_CACHE,1,[Define to 1 if translated termcap should be stored in $HOME/.terminfo]) - - fi -+AC_SUBST(NCURSES_USE_TERMCAP) - - ### Use option --disable-home-terminfo to completely remove ~/.terminfo - AC_MSG_CHECKING(if ~/.terminfo is wanted) -@@ -615,7 +639,7 @@ - [with_home_terminfo=$enableval], - [with_home_terminfo=yes]) - AC_MSG_RESULT($with_home_terminfo) --test "$with_home_terminfo" = "yes" && AC_DEFINE(USE_HOME_TERMINFO) -+test "x$with_home_terminfo" = "xyes" && AC_DEFINE(USE_HOME_TERMINFO,1,[Define to 1 if $HOME/.terminfo feature is wanted]) - - AC_MSG_CHECKING(if you want to use restricted environment when running as root) - AC_ARG_ENABLE(root-environ, -@@ -623,7 +647,7 @@ - [with_root_environ=$enableval], - [with_root_environ=yes]) - AC_MSG_RESULT($with_root_environ) --test "$with_root_environ" = yes && AC_DEFINE(USE_ROOT_ENVIRON) -+test "x$with_root_environ" = xyes && AC_DEFINE(USE_ROOT_ENVIRON,1,[Define to 1 if environment should be restricted for root user]) - - ### Use option --enable-symlinks to make tic use symlinks, not hard links - ### to reduce storage requirements for the terminfo database. -@@ -634,7 +658,7 @@ - - # soft links (symbolic links) are useful for some systems where hard links do - # not work, or to make it simpler to copy terminfo trees around. --if test "$ac_cv_func_symlink" = yes ; then -+if test "x$ac_cv_func_symlink" = xyes ; then - AC_MSG_CHECKING(if tic should use symbolic links) - AC_ARG_ENABLE(symlinks, - [ --enable-symlinks make tic use symbolic links not hard links], -@@ -647,7 +671,7 @@ - # no reason to make this choice optional - use the hard links. - if test "$with_symlinks" = no ; then - AC_MSG_CHECKING(if tic should use hard links) -- if test "$ac_cv_func_link" = yes ; then -+ if test "x$ac_cv_func_link" = xyes ; then - with_links=yes - else - with_links=no -@@ -655,8 +679,8 @@ - AC_MSG_RESULT($with_links) - fi - --test "$with_links" = yes && AC_DEFINE(USE_LINKS) --test "$with_symlinks" = yes && AC_DEFINE(USE_SYMLINKS) -+test "x$with_links" = xyes && AC_DEFINE(USE_LINKS,1,[Define to 1 if hardlinks should be used in terminfo database]) -+test "x$with_symlinks" = xyes && AC_DEFINE(USE_SYMLINKS,1,[Define to 1 if symbolic links should be used in terminfo database]) - - ### use option --enable-broken-linker to force on use of broken-linker support - AC_MSG_CHECKING(if you want broken-linker support code) -@@ -667,13 +691,13 @@ - AC_MSG_RESULT($with_broken_linker) - - BROKEN_LINKER=0 --if test "$with_broken_linker" = yes ; then -- AC_DEFINE(BROKEN_LINKER) -+if test "x$with_broken_linker" = xyes ; then -+ AC_DEFINE(BROKEN_LINKER,1,[Define to 1 to work around linkers which cannot link data-only modules]) - BROKEN_LINKER=1 - elif test "$DFT_LWR_MODEL" = shared ; then - case $cf_cv_system_name in #(vi - cygwin*) -- AC_DEFINE(BROKEN_LINKER) -+ AC_DEFINE(BROKEN_LINKER,1,[Define to 1 to work around linkers which cannot link data-only modules]) - BROKEN_LINKER=1 - CF_VERBOSE(cygwin linker is broken anyway) - ;; -@@ -688,7 +712,7 @@ - [with_bsdpad=$enableval], - [with_bsdpad=no]) - AC_MSG_RESULT($with_bsdpad) --test "$with_bsdpad" = yes && AC_DEFINE(BSD_TPUTS) -+test "x$with_bsdpad" = xyes && AC_DEFINE(BSD_TPUTS,1,[Define to 1 to recognize BSD-style prefix padding]) - - ### use option --enable-widec to turn on use of wide-character support - NCURSES_CH_T=chtype -@@ -718,22 +742,17 @@ - [with_widec=$enableval], - [with_widec=no]) - AC_MSG_RESULT($with_widec) --if test "$with_widec" = yes ; then -+if test "x$with_widec" = xyes ; then - LIB_SUFFIX="w${LIB_SUFFIX}" -- AC_DEFINE(USE_WIDEC_SUPPORT) -+ AC_DEFINE(USE_WIDEC_SUPPORT,1,[Define to 1 to compile with wide-char/UTF-8 code]) -+ AC_DEFINE(NCURSES_WIDECHAR,1,[Define to 1 to compile with wide-char/UTF-8 code]) - -- case "$CFLAGS $CPPFLAGS" in #(vi -- *-D_XOPEN_SOURCE=500) #(vi -- ;; -- *) -- CF_PREDEFINE(_XOPEN_SOURCE_EXTENDED) -- ;; -- esac -+ CF_CHECK_WCHAR_H - - # with_overwrite=no - NCURSES_CH_T=cchar_t - AC_CHECK_FUNCS(putwc btowc wctob mbtowc wctomb mblen mbrlen mbrtowc wcsrtombs mbsrtowcs wcstombs mbstowcs) -- if test "$ac_cv_func_putwc" != yes ; then -+ if test "x$ac_cv_func_putwc" != xyes ; then - CF_UTF8_LIB - if test "$cf_cv_utf8_lib" != no ; then - NCURSES_LIBUTF8=1 -@@ -744,7 +763,7 @@ - CF_WCHAR_TYPE(wint_t, NCURSES_WINT_T, NCURSES_OK_WINT_T) - - if test "$NCURSES_MBSTATE_T" != 0; then -- AC_DEFINE(NEED_MBSTATE_T_DEF) -+ AC_DEFINE(NEED_MBSTATE_T_DEF,1,[Define to 1 if we must declare mbstate_t]) - fi - fi - AC_SUBST(NCURSES_CH_T) -@@ -775,7 +794,7 @@ - [with_lp64=$default_with_lp64]) - AC_MSG_RESULT($with_lp64) - --if test "$with_lp64" = yes ; then -+if test "x$with_lp64" = xyes ; then - cf_cv_enable_lp64=1 - else - cf_cv_enable_lp64=0 -@@ -792,7 +811,7 @@ - [with_tparm_varargs=yes]) - AC_MSG_RESULT($with_tparm_varargs) - NCURSES_TPARM_VARARGS=0 --test "$with_tparm_varargs" = yes && NCURSES_TPARM_VARARGS=1 -+test "x$with_tparm_varargs" = xyes && NCURSES_TPARM_VARARGS=1 - AC_SUBST(NCURSES_TPARM_VARARGS) - - ### use option --disable-tic-depends to make libtic not explicitly depend on ncurses/ncursesw -@@ -859,6 +878,15 @@ - AC_MSG_RESULT($NCURSES_CCHARW_MAX) - AC_SUBST(NCURSES_CCHARW_MAX) - -+### use option --with-tparm-arg to override tparm's argument type -+AC_MSG_CHECKING(for type of tparm args) -+AC_ARG_WITH(tparm-arg, -+ [ --with-tparm-arg=TYPE override parameter type of tparm], -+ [NCURSES_TPARM_ARG="$withval"], -+ [NCURSES_TPARM_ARG=long]) -+AC_MSG_RESULT($NCURSES_TPARM_ARG) -+AC_SUBST(NCURSES_TPARM_ARG) -+ - ### Enable compiling-in rcs id's - AC_MSG_CHECKING(if RCS identifiers should be compiled-in) - AC_ARG_WITH(rcs-ids, -@@ -866,7 +894,7 @@ - [with_rcs_ids=$withval], - [with_rcs_ids=no]) - AC_MSG_RESULT($with_rcs_ids) --test "$with_rcs_ids" = yes && AC_DEFINE(USE_RCS_IDS) -+test "x$with_rcs_ids" = xyes && AC_DEFINE(USE_RCS_IDS,1,[Define to 1 to compile-in RCS identifiers]) - - ############################################################################### - CF_MAN_PAGES([ captoinfo clear infocmp infotocap tabs tic toe tput tset ]) -@@ -881,16 +909,19 @@ - [with_ext_funcs=$enableval], - [with_ext_funcs=yes]) - AC_MSG_RESULT($with_ext_funcs) --if test "$with_ext_funcs" = yes ; then -+if test "x$with_ext_funcs" = xyes ; then - NCURSES_EXT_FUNCS=1 -- AC_DEFINE(HAVE_CURSES_VERSION) -- AC_DEFINE(HAVE_HAS_KEY) -- AC_DEFINE(HAVE_RESIZETERM) -- AC_DEFINE(HAVE_RESIZE_TERM) -- AC_DEFINE(HAVE_TERM_ENTRY_H) -- AC_DEFINE(HAVE_USE_DEFAULT_COLORS) -- AC_DEFINE(HAVE_WRESIZE) -- AC_DEFINE(NCURSES_EXT_FUNCS) -+ AC_DEFINE(HAVE_ASSUME_DEFAULT_COLORS,1,[Define to 1 to enable assume_default_colors() function]) -+ AC_DEFINE(HAVE_CURSES_VERSION,1,[Define to 1 to enable curses_version() function]) -+ AC_DEFINE(HAVE_HAS_KEY,1,[Define to 1 to enable has_key() function]) -+ AC_DEFINE(HAVE_RESIZETERM,1,[Define to 1 to enable resizeterm() function]) -+ AC_DEFINE(HAVE_RESIZE_TERM,1,[Define to 1 to enable resize_term() function]) -+ AC_DEFINE(HAVE_TERM_ENTRY_H,1,[Define to 1 to enable term_entry() function]) -+ AC_DEFINE(HAVE_USE_DEFAULT_COLORS,1,[Define to 1 to enable use_default_colors() function]) -+ AC_DEFINE(HAVE_USE_SCREEN,1,[Define to 1 to enable use_screen() function]) -+ AC_DEFINE(HAVE_USE_WINDOW,1,[Define to 1 to enable use_window() function]) -+ AC_DEFINE(HAVE_WRESIZE,1,[Define to 1 to enable wresize() function]) -+ AC_DEFINE(NCURSES_EXT_FUNCS,1,[Define to 1 to enable ncurses extended functions]) - GENERATED_EXT_FUNCS=generated - else - NCURSES_EXT_FUNCS=0 -@@ -905,9 +936,9 @@ - [with_sp_funcs=$enableval], - [with_sp_funcs=no]) - AC_MSG_RESULT($with_sp_funcs) --if test "$with_sp_funcs" = yes ; then -+if test "x$with_sp_funcs" = xyes ; then - NCURSES_SP_FUNCS=1 -- AC_DEFINE(NCURSES_SP_FUNCS) -+ AC_DEFINE(NCURSES_SP_FUNCS,1,[Define to 1 to enable experimental SCREEN-extensions]) - GENERATED_SP_FUNCS=generated - else - NCURSES_SP_FUNCS=0 -@@ -922,9 +953,9 @@ - [with_term_driver=$enableval], - [with_term_driver=no]) - AC_MSG_RESULT($with_term_driver) --if test "$with_term_driver" = yes ; then -- AC_DEFINE(USE_TERM_DRIVER) -- if test "$with_sp_funcs" != yes ; then -+if test "x$with_term_driver" = xyes ; then -+ AC_DEFINE(USE_TERM_DRIVER,1,[Define to 1 to enable experimental terminal-driver]) -+ if test "x$with_sp_funcs" != xyes ; then - AC_MSG_ERROR(The term-driver option relies upon sp-funcs) - fi - fi -@@ -937,7 +968,7 @@ - [with_ext_const=no]) - AC_MSG_RESULT($with_ext_const) - NCURSES_CONST='/*nothing*/' --if test "$with_ext_const" = yes ; then -+if test "x$with_ext_const" = xyes ; then - NCURSES_CONST=const - fi - AC_SUBST(NCURSES_CONST) -@@ -950,15 +981,15 @@ - [with_ext_colors=no]) - AC_MSG_RESULT($with_ext_colors) - NCURSES_EXT_COLORS=0 --if test "$with_ext_colors" = yes ; then -- if test "$with_widec" != yes ; then -+if test "x$with_ext_colors" = xyes ; then -+ if test "x$with_widec" != xyes ; then - AC_MSG_ERROR(This option applies only to wide-character library) - else - # cannot be ABI 5 since it changes sizeof(cchar_t) - CF_NCURSES_ABI_6 - fi - NCURSES_EXT_COLORS=1 -- AC_DEFINE(NCURSES_EXT_COLORS) -+ AC_DEFINE(NCURSES_EXT_COLORS,1,[Define to 1 to compile for 256-color support]) - fi - AC_SUBST(NCURSES_EXT_COLORS) - -@@ -970,7 +1001,7 @@ - [with_ext_mouse=no]) - AC_MSG_RESULT($with_ext_mouse) - NCURSES_MOUSE_VERSION=1 --if test "$with_ext_mouse" = yes ; then -+if test "x$with_ext_mouse" = xyes ; then - NCURSES_MOUSE_VERSION=2 - CF_NCURSES_ABI_6 - fi -@@ -982,7 +1013,7 @@ - [with_no_padding=$enableval], - [with_no_padding=$with_ext_funcs]) - AC_MSG_RESULT($with_no_padding) --test "$with_no_padding" = yes && AC_DEFINE(NCURSES_NO_PADDING) -+test "x$with_no_padding" = xyes && AC_DEFINE(NCURSES_NO_PADDING,1,[Define to 1 to compile with $NCURSES_NO_PADDING code]) - - AC_CHECK_SIZEOF([signed char], 0) - if test "$ac_cv_sizeof_signed_char" = 1 ; then -@@ -996,7 +1027,7 @@ - [with_signed_char=$enableval], - [with_signed_char=no]) - AC_MSG_RESULT($with_signed_char) --test "$with_signed_char" != yes && NCURSES_SBOOL="char" -+test "x$with_signed_char" != xyes && NCURSES_SBOOL="char" - AC_SUBST(NCURSES_SBOOL) - - ### use option --enable-sigwinch to turn on use of SIGWINCH logic -@@ -1006,7 +1037,7 @@ - [with_sigwinch=$enableval], - [with_sigwinch=$with_ext_funcs]) - AC_MSG_RESULT($with_sigwinch) --test "$with_sigwinch" = yes && AC_DEFINE(USE_SIGWINCH) -+test "x$with_sigwinch" = xyes && AC_DEFINE(USE_SIGWINCH,1,[Define to 1 to compile with SIGWINCH handler]) - - ### use option --enable-tcap-names to allow user to define new capabilities - AC_MSG_CHECKING(if you want user-definable terminal capabilities like termcap) -@@ -1016,7 +1047,7 @@ - [with_tcap_names=$with_ext_funcs]) - AC_MSG_RESULT($with_tcap_names) - NCURSES_XNAMES=0 --test "$with_tcap_names" = yes && NCURSES_XNAMES=1 -+test "x$with_tcap_names" = xyes && NCURSES_XNAMES=1 - AC_SUBST(NCURSES_XNAMES) - - ############################################################################### -@@ -1035,7 +1066,7 @@ - [ --enable-hard-tabs compile with hard-tabs code],, - [enable_hard_tabs=$with_develop]) - AC_MSG_RESULT($enable_hard_tabs) --test "$enable_hard_tabs" = yes && AC_DEFINE(USE_HARD_TABS) -+test "x$enable_hard_tabs" = xyes && AC_DEFINE(USE_HARD_TABS,1,[Define to 1 to compile with hard-tabs code]) - - ### use option --enable-xmc-glitch to turn on use of magic-cookie optimize - AC_MSG_CHECKING(if you want limited support for xmc) -@@ -1043,7 +1074,7 @@ - [ --enable-xmc-glitch compile with support for xmc (magic-cookie)],, - [enable_xmc_glitch=$with_develop]) - AC_MSG_RESULT($enable_xmc_glitch) --test "$enable_xmc_glitch" = yes && AC_DEFINE(USE_XMC_SUPPORT) -+test "x$enable_xmc_glitch" = xyes && AC_DEFINE(USE_XMC_SUPPORT,1,[Define to 1 to compile with support for xmc (magic-cookie)]) - - ############################################################################### - # These are just experimental, probably should not be in a package: -@@ -1055,7 +1086,7 @@ - [with_assumed_color=$enableval], - [with_assumed_color=yes]) - AC_MSG_RESULT($with_assumed_color) --test "$with_assumed_color" = yes && AC_DEFINE(USE_ASSUMED_COLOR) -+test "x$with_assumed_color" = xyes && AC_DEFINE(USE_ASSUMED_COLOR,1,[Define to 1 to assume things about default-colors]) - - ### use option --enable-hashmap to turn on use of hashmap scrolling logic - AC_MSG_CHECKING(if you want hashmap scrolling-optimization code) -@@ -1064,7 +1095,7 @@ - [with_hashmap=$enableval], - [with_hashmap=yes]) - AC_MSG_RESULT($with_hashmap) --test "$with_hashmap" = yes && AC_DEFINE(USE_HASHMAP) -+test "x$with_hashmap" = xyes && AC_DEFINE(USE_HASHMAP,1,[Define to 1 to compile with hashmap scrolling-optimization]) - - ### use option --enable-colorfgbg to turn on use of $COLORFGBG environment - AC_MSG_CHECKING(if you want colorfgbg code) -@@ -1073,7 +1104,7 @@ - [with_colorfgbg=$enableval], - [with_colorfgbg=no]) - AC_MSG_RESULT($with_colorfgbg) --test "$with_colorfgbg" = yes && AC_DEFINE(USE_COLORFGBG) -+test "x$with_colorfgbg" = xyes && AC_DEFINE(USE_COLORFGBG,1,[Define to 1 to compile-in experimental $COLORFGBG code]) - - ### use option --enable-interop to turn on use of bindings used for interop - AC_MSG_CHECKING(if you want interop bindings) -@@ -1084,7 +1115,7 @@ - AC_MSG_RESULT($with_exp_interop) - - NCURSES_INTEROP_FUNCS=0 --test "$with_exp_interop" = yes && NCURSES_INTEROP_FUNCS=1 -+test "x$with_exp_interop" = xyes && NCURSES_INTEROP_FUNCS=1 - AC_SUBST(NCURSES_INTEROP_FUNCS) - - # This is still experimental (20080329), but should ultimately be moved to -@@ -1099,8 +1130,8 @@ - [use_pthreads_eintr=$enableval], - [use_pthreads_eintr=no]) - AC_MSG_RESULT($use_pthreads_eintr) -- if test $use_pthreads_eintr = yes ; then -- AC_DEFINE(USE_PTHREADS_EINTR) -+ if test "x$use_pthreads_eintr" = xyes ; then -+ AC_DEFINE(USE_PTHREADS_EINTR,1,[Define to 1 to enable EINTR in wgetch with pthreads]) - fi]) - - AC_MSG_CHECKING(if you want to use weak-symbols for pthreads) -@@ -1109,22 +1140,22 @@ - [use_weak_symbols=$enableval], - [use_weak_symbols=no]) - AC_MSG_RESULT($use_weak_symbols) -- if test "$use_weak_symbols" = yes ; then -+ if test "x$use_weak_symbols" = xyes ; then - CF_WEAK_SYMBOLS - else - cf_cv_weak_symbols=no - fi - -- if test $cf_cv_weak_symbols = yes ; then -- AC_DEFINE(USE_WEAK_SYMBOLS) -+ if test "x$cf_cv_weak_symbols" = xyes ; then -+ AC_DEFINE(USE_WEAK_SYMBOLS,1,[Define to 1 to enable weak-symbols for pthreads]) - fi - fi - - PTHREAD= --if test "$with_pthread" = "yes" ; then -- AC_DEFINE(USE_PTHREADS) -+if test "x$with_pthread" = "xyes" ; then -+ AC_DEFINE(USE_PTHREADS,1,[Define to 1 to use pthreads feature]) - enable_reentrant=yes -- if test $cf_cv_weak_symbols = yes ; then -+ if test "x$cf_cv_weak_symbols" = xyes ; then - PTHREAD=-lpthread - fi - fi -@@ -1140,19 +1171,29 @@ - [with_reentrant=$enableval], - [with_reentrant=no]) - AC_MSG_RESULT($with_reentrant) --if test "$with_reentrant" = yes ; then -+if test "x$with_reentrant" = xyes ; then - cf_cv_enable_reentrant=1 - cf_cv_enable_opaque="NCURSES_INTERNALS" - NCURSES_OPAQUE=1 - NCURSES_SIZE_T=int -- if test $cf_cv_weak_symbols = yes ; then -+ if test "x$cf_cv_weak_symbols" = xyes ; then - CF_REMOVE_LIB(LIBS,$LIBS,pthread) - CF_ADD_LIB(pthread,TEST_LIBS) - CF_ADD_LIB(pthread,TEST_LIBS2) - else -- LIB_SUFFIX="t${LIB_SUFFIX}" -+ # when not using weak symbols but with_reentrant, -+ # add 't' to the library suffix on all platforms -+ # except cygwin, where we only do that if ALSO -+ # compiling with full thread support. -+ case "$host" in -+ *cygwin* | *msys*) -+ if test "$with_pthread" = "yes" ; then -+ LIB_SUFFIX="t${LIB_SUFFIX}" -+ fi ;; -+ * ) LIB_SUFFIX="t${LIB_SUFFIX}" ;; -+ esac - fi -- AC_DEFINE(USE_REENTRANT) -+ AC_DEFINE(USE_REENTRANT,1,[Define to 1 to use experimental reentrant feature]) - CF_NCURSES_ABI_6 - else - cf_cv_enable_reentrant=0 -@@ -1177,7 +1218,7 @@ - NCURSES_WRAP_PREFIX=_nc_ - fi - AC_SUBST(NCURSES_WRAP_PREFIX) --AC_DEFINE_UNQUOTED(NCURSES_WRAP_PREFIX,"$NCURSES_WRAP_PREFIX") -+AC_DEFINE_UNQUOTED(NCURSES_WRAP_PREFIX,"$NCURSES_WRAP_PREFIX",[Define to override _nc_ prefix]) - - AC_MSG_CHECKING(if you want experimental safe-sprintf code) - AC_ARG_ENABLE(safe-sprintf, -@@ -1185,7 +1226,7 @@ - [with_safe_sprintf=$enableval], - [with_safe_sprintf=no]) - AC_MSG_RESULT($with_safe_sprintf) --test "$with_safe_sprintf" = yes && AC_DEFINE(USE_SAFE_SPRINTF) -+test "x$with_safe_sprintf" = xyes && AC_DEFINE(USE_SAFE_SPRINTF,1,[Define to 1 to compile with experimental safe-sprintf code]) - - ### use option --disable-scroll-hints to turn off use of scroll-hints scrolling logic - # when hashmap is used scroll hints are useless -@@ -1196,7 +1237,7 @@ - [with_scroll_hints=$enableval], - [with_scroll_hints=yes]) - AC_MSG_RESULT($with_scroll_hints) --test "$with_scroll_hints" = yes && AC_DEFINE(USE_SCROLL_HINTS) -+test "x$with_scroll_hints" = xyes && AC_DEFINE(USE_SCROLL_HINTS,1,[Define to 1 to compile without scroll-hints code]) - fi - - AC_MSG_CHECKING(if you want experimental wgetch-events code) -@@ -1205,25 +1246,20 @@ - [with_wgetch_events=$enableval], - [with_wgetch_events=no]) - AC_MSG_RESULT($with_wgetch_events) --test "$with_wgetch_events" = yes && AC_DEFINE(NCURSES_WGETCH_EVENTS) -+test "x$with_wgetch_events" = xyes && AC_DEFINE(NCURSES_WGETCH_EVENTS,1,[Define to 1 to compile with experimental wgetch-events code]) - - ############################################################################### - CF_HELP_MESSAGE(Testing/development Options:) - - ### use option --disable-echo to suppress full display compiling commands --AC_MSG_CHECKING(if you want to display full commands during build) --AC_ARG_ENABLE(echo, -- [ --enable-echo build: display "compiling" commands (default)], -- [with_echo=$enableval], -- [with_echo=yes]) --if test "$with_echo" = yes; then -+CF_DISABLE_ECHO -+if test "x$enable_echo" = xyes; then - ECHO_LINK= - else - ECHO_LINK='@ echo linking $@ ... ;' - test -n "$LIBTOOL" && LIBTOOL="$LIBTOOL --silent" - test -n "$LIBTOOL_CXX" && LIBTOOL_CXX="$LIBTOOL_CXX --silent" - fi --AC_MSG_RESULT($with_echo) - AC_SUBST(ECHO_LINK) - - ### use option --enable-warnings to turn on all gcc warnings -@@ -1235,12 +1271,13 @@ - - if test "x$with_warnings" = "xyes"; then - CF_ADD_ADAFLAGS(-gnatg) -- CF_GCC_WARNINGS(Wdeclaration-after-statement Wextra Wno-unknown-pragmas Wswitch-enum) -- if test "$cf_with_cxx" = yes ; then -+ CF_GCC_WARNINGS(Wno-unknown-pragmas Wswitch-enum) -+ if test "x$cf_with_cxx" = xyes ; then - CF_GXX_WARNINGS(Wno-unused) - fi - fi - CF_GCC_ATTRIBUTES -+CF_ENABLE_STRING_HACKS - - ### use option --enable-assertions to turn on generation of assertion code - AC_MSG_CHECKING(if you want to enable runtime assertions) -@@ -1253,7 +1290,6 @@ - then - if test "$with_assertions" = no - then -- AC_DEFINE(NDEBUG) - CPPFLAGS="$CPPFLAGS -DNDEBUG" - else - CF_ADD_ADAFLAGS(-gnata) -@@ -1262,17 +1298,17 @@ - - ### use option --disable-leaks to suppress "permanent" leaks, for testing - CF_DISABLE_LEAKS --AC_DEFINE(HAVE_NC_ALLOC_H) -+AC_DEFINE(HAVE_NC_ALLOC_H,1,[Define to 1 if we have nc_alloc.h header]) - - ### use option --enable-expanded to generate certain macros as functions - AC_ARG_ENABLE(expanded, - [ --enable-expanded test: generate functions for certain macros], -- [test "$enableval" = yes && AC_DEFINE(NCURSES_EXPANDED)]) -+ [test "x$enableval" = xyes && AC_DEFINE(NCURSES_EXPANDED,1,[Define to 1 to generate functions for certain macros])]) - - ### use option --disable-macros to suppress macros in favor of functions - AC_ARG_ENABLE(macros, - [ --disable-macros test: use functions rather than macros], -- [test "$enableval" = no && AC_DEFINE(NCURSES_NOMACROS)]) -+ [test "$enableval" = no && AC_DEFINE(NCURSES_NOMACROS,1,[Define to 1 to use functions rather than macros])]) - - # Normally we only add trace() to the debug-library. Allow this to be - # extended to all models of the ncurses library: -@@ -1290,7 +1326,7 @@ - [cf_with_trace=$cf_all_traces]) - AC_MSG_RESULT($cf_with_trace) - --if test "$cf_with_trace" = yes ; then -+if test "x$cf_with_trace" = xyes ; then - LIB_TRACING=all - ADA_TRACE=TRUE - CF_ADD_CFLAGS(-DTRACE) -@@ -1307,15 +1343,15 @@ - ;; - *) - AC_CHECK_FUNC(gettimeofday, -- AC_DEFINE(HAVE_GETTIMEOFDAY),[ -+ AC_DEFINE(HAVE_GETTIMEOFDAY,1,[Define to 1 if we have gettimeofday function]),[ - - AC_CHECK_LIB(bsd, gettimeofday, -- AC_DEFINE(HAVE_GETTIMEOFDAY) -+ AC_DEFINE(HAVE_GETTIMEOFDAY,1,[Define to 1 if we have gettimeofday function]) - CF_ADD_LIB(bsd))])dnl CLIX: bzero, select, gettimeofday - ;; - esac - --CF_MATH_LIB(MATH_LIB,sin(x)) -+CF_MATH_LIB(MATH_LIB,pow(sin(x),x)) - AC_SUBST(MATH_LIB) - - ### Checks for header files. -@@ -1344,9 +1380,11 @@ - wctype.h \ - ) - -+CF_GETOPT_HEADER -+ - # check for ISC (this may also define _POSIX_SOURCE) - # Note: even non-Posix ISC needs to declare fd_set --if test "$ISC" = yes ; then -+if test "x$ISC" = xyes ; then - AC_CHECK_LIB(cposix,main) - AC_CHECK_LIB(inet,bzero,CF_ADD_LIB(inet))dnl also 'select()' - fi -@@ -1393,10 +1431,12 @@ - getttynam \ - issetugid \ - poll \ -+putenv \ - remove \ - select \ - setbuf \ - setbuffer \ -+setenv \ - setvbuf \ - sigaction \ - sigvec \ -@@ -1406,7 +1446,7 @@ - times \ - vsnprintf \ - ) --if test "$with_getcap" = "yes" ; then -+if test "x$with_getcap" = "xyes" ; then - CF_CGETENT - fi - -@@ -1421,12 +1461,12 @@ - CF_SUBST_IF(["$cf_cv_func_vsscanf" = vsscanf], HAVE_VSSCANF, 1, 0) - - dnl FIXME (may need this) AC_SYS_RESTARTABLE_SYSCALLS --if test "$cross_compiling" = yes ; then -+if test "x$cross_compiling" = xyes ; then - AC_MSG_WARN(cross compiling: assume setvbuf params not reversed) - else - AC_FUNC_SETVBUF_REVERSED - fi --AC_TYPE_SIGNAL -+AC_CHECK_TYPE(intptr_t, long) - CF_TYPE_SIGACTION - CF_SIZECHANGE - CF_FUNC_MEMMOVE -@@ -1437,9 +1477,9 @@ - # special check for test/ditto.c - CF_FUNC_OPENPTY - if test "$cf_cv_func_openpty" != no ; then -- AC_DEFINE_UNQUOTED(USE_OPENPTY_HEADER,<$cf_cv_func_openpty>) -- AC_DEFINE(USE_XTERM_PTY) -- if test "$cf_cv_lib_util" = yes ; then -+ AC_DEFINE_UNQUOTED(USE_OPENPTY_HEADER,<$cf_cv_func_openpty>,[Define to actual header for openpty function]) -+ AC_DEFINE(USE_XTERM_PTY,1,[Define to 1 if we should assume xterm pseudoterminal interface]) -+ if test "x$cf_cv_lib_util" = xyes ; then - CF_ADD_LIB(util,TEST_LIBS) - fi - fi -@@ -1447,7 +1487,7 @@ - AC_SUBST(TEST_LIBS2) - - if test "$with_hashed_db" != no ; then -- AC_DEFINE(USE_HASHED_DB) -+ AC_DEFINE(USE_HASHED_DB,1,[Define to 1 if we should build terminfo in hashed database]) - CF_HASHED_DB($with_hashed_db) - fi - -@@ -1478,50 +1518,14 @@ - ;; - esac - -- AC_CHECK_HEADERS(iostream typeinfo) -- -- if test x"$ac_cv_header_iostream" = xyes ; then -- AC_MSG_CHECKING(if iostream uses std-namespace) -- AC_TRY_COMPILE([ --#include --using std::endl; --using std::cerr;],[ --cerr << "testing" << endl; --],[cf_iostream_namespace=yes],[cf_iostream_namespace=no]) -- AC_MSG_RESULT($cf_iostream_namespace) -- if test "$cf_iostream_namespace" = yes ; then -- AC_DEFINE(IOSTREAM_NAMESPACE) -- fi -- fi -- -+ AC_CHECK_HEADERS(typeinfo) -+ CF_CXX_IOSTREAM_NAMESPACE - CF_BOOL_DECL - CF_BOOL_SIZE - CF_ETIP_DEFINES - CF_CPP_PARAM_INIT - CF_CPP_STATIC_CAST -- -- CXX_AR='$(AR)' -- CXX_ARFLAGS='$(ARFLAGS)' -- case $cf_cv_system_name in #(vi -- irix*) #(vi -- if test "$GXX" != yes ; then -- CXX_AR='$(CXX)' -- CXX_ARFLAGS='-ar -o' -- fi -- ;; -- sco3.2v5*) #(vi -- CXXLDFLAGS="-u main" -- ;; -- solaris2*) -- if test "$GXX" != yes ; then -- CXX_AR='$(CXX)' -- CXX_ARFLAGS='-xar -o' -- fi -- ;; -- esac -- AC_SUBST(CXXLDFLAGS) -- AC_SUBST(CXX_AR) -- AC_SUBST(CXX_ARFLAGS) -+ CF_CXX_AR_FLAGS - else - cf_cxx_library=no - cf_cv_builtin_bool=1 -@@ -1593,20 +1597,9 @@ - dnl At the moment we support no other Ada95 compiler. - if test "$cf_with_ada" != "no" ; then - CF_PROG_GNAT -- if test "$cf_cv_prog_gnat_correct" = yes; then -+ if test "x$cf_cv_prog_gnat_correct" = xyes; then - CF_ADD_ADAFLAGS(-gnatpn) -- -- # make ADAFLAGS consistent with CFLAGS -- case "$CFLAGS" in -- *-g*) -- CF_ADD_ADAFLAGS(-g) -- ;; -- esac -- case "$CFLAGS" in -- *-O*) -- CF_ADD_ADAFLAGS(-O3) -- ;; -- esac -+ CF_FIXUP_ADAFLAGS - - CF_GNAT_GENERICS - CF_GNAT_SIGINT -@@ -1627,6 +1620,11 @@ - cf_with_ada=no - fi - -+# do this "late" to avoid conflict with header-checks -+if test "x$with_widec" = xyes ; then -+ AC_CHECK_SIZEOF(wchar_t) -+fi -+ - ### Construct the ncurses library-subsets, if any, from this set of keywords: - ### none, base, ext_funcs, ext_tinfo, ticlib, termlib, widechar - ### -@@ -1640,7 +1638,7 @@ - AC_MSG_CHECKING(for library subsets) - LIB_SUBSETS= - --if test "$cf_with_progs" = yes || test "$with_ticlib" != no || test "$with_termcap" != no; then -+if test "x$cf_with_progs" = xyes || test "$with_ticlib" != no || test "$with_termcap" != no; then - LIB_SUBSETS="${LIB_SUBSETS}ticlib" - if test "$with_ticlib" != no ; then - LIB_SUBSETS="${LIB_SUBSETS} " -@@ -1650,7 +1648,7 @@ - fi - - LIB_SUBSETS="${LIB_SUBSETS}termlib" --test "$with_ext_funcs" = yes && LIB_SUBSETS="${LIB_SUBSETS}+ext_tinfo" -+test "x$with_ext_funcs" = xyes && LIB_SUBSETS="${LIB_SUBSETS}+ext_tinfo" - - if test "$with_termlib" != no ; then - LIB_SUBSETS="${LIB_SUBSETS} " -@@ -1674,8 +1672,8 @@ - esac - fi - --test "$with_widec" = yes && LIB_SUBSETS="${LIB_SUBSETS}+widechar" --test "$with_ext_funcs" = yes && LIB_SUBSETS="${LIB_SUBSETS}+ext_funcs" -+test "x$with_widec" = xyes && LIB_SUBSETS="${LIB_SUBSETS}+widechar" -+test "x$with_ext_funcs" = xyes && LIB_SUBSETS="${LIB_SUBSETS}+ext_funcs" - - AC_MSG_RESULT($LIB_SUBSETS) - -@@ -1699,20 +1697,24 @@ - AC_SUBST(DFT_OBJ_SUBDIR)dnl the default object-directory ("obj") - AC_MSG_RESULT($DFT_OBJ_SUBDIR) - --# libtool thinks it can make c++ shared libraries (perhaps only g++) --if test "$cf_with_cxx" = yes ; then -+if test "x$cf_with_cxx" = xyes ; then - AC_MSG_CHECKING(c++ library-dependency suffix) - if test "$with_libtool" != "no"; then -+ # libtool thinks it can make c++ shared libraries (perhaps only g++) -+ CXX_LIB_SUFFIX=$DFT_DEP_SUFFIX -+elif test "$with_shared_cxx" != "no"; then -+ # also for g++ users... - CXX_LIB_SUFFIX=$DFT_DEP_SUFFIX - else -- CF_LIB_SUFFIX(normal,CXX_LIB_SUFFIX,CXX_DEP_SUFFIX)dnl we normally make a static library -+ # we normally make a static library because C/C++ library rules differ -+ CF_LIB_SUFFIX(normal,CXX_LIB_SUFFIX,CXX_DEP_SUFFIX) - fi - AC_MSG_RESULT($CXX_LIB_SUFFIX) - AC_SUBST(CXX_LIB_SUFFIX) - fi - - # do not want -ldl in build except as needed for -lncurses dependency --if test "$with_dlsym" = yes ; then -+if test "x$with_dlsym" = xyes ; then - if test $DFT_LWR_MODEL = shared || \ - test $DFT_LWR_MODEL = libtool ; then - CF_REMOVE_LIB(LIBS,$LIBS,dl) -@@ -1723,13 +1725,13 @@ - # TICS_LIST and TINFO_LIST are needed to build libtic.so and libterm.so, but - # do not need libdl - TICS_LIST= --if test "$with_dlsym" = yes ; then -+if test "x$with_dlsym" = xyes ; then - CF_REMOVE_LIB(TINFO_LIST,$SHLIB_LIST,dl) - fi - - if test "$with_ticlib" != no ; then - -- if test "$with_ticlib" != yes ; then -+ if test "x$with_ticlib" != xyes ; then - TICS_NAME=$with_ticlib - TICS_ARG_SUFFIX="${with_ticlib}`echo ${DFT_ARG_SUFFIX}|sed -e "s/^${LIB_SUFFIX}//"`" - TICS_DEP_SUFFIX="${with_ticlib}`echo ${DFT_DEP_SUFFIX}|sed -e "s/^${LIB_SUFFIX}//"`" -@@ -1739,18 +1741,21 @@ - TICS_DEP_SUFFIX="${TICS_NAME}${DFT_DEP_SUFFIX}" - TICS_LIB_SUFFIX="${TICS_NAME}${LIB_SUFFIX}" - fi -- TICS_ARGS="-L${LIB_DIR} -l${TICS_LIB_SUFFIX}" -+ TICS_LDFLAGS="-L${LIB_DIR}" -+ TICS_LIBS="-l${TICS_LIB_SUFFIX}" - else -- TICS_ARGS="-L${LIB_DIR} -l${LIB_NAME}${DFT_ARG_SUFFIX}" -+ TICS_LDFLAGS="-L${LIB_DIR}" -+ TICS_LIBS="-l${LIB_NAME}${DFT_ARG_SUFFIX}" - fi - AC_SUBST(TICS_ARG_SUFFIX) - AC_SUBST(TICS_DEP_SUFFIX) - AC_SUBST(TICS_LIB_SUFFIX) --AC_SUBST(TICS_ARGS) -+AC_SUBST(TICS_LDFLAGS) -+AC_SUBST(TICS_LIBS) - - if test "$with_termlib" != no ; then - -- if test "$with_termlib" != yes ; then -+ if test "x$with_termlib" != xyes ; then - TINFO_NAME=$with_termlib - TINFO_SUFFIX="`echo ${DFT_LIB_SUFFIX}|sed -e "s/^${LIB_SUFFIX}//"`" - TINFO_ARG_SUFFIX="${with_termlib}`echo ${DFT_ARG_SUFFIX}|sed -e "s/^${LIB_SUFFIX}//"`" -@@ -1768,14 +1773,22 @@ - if test "$DFT_LWR_MODEL" = "libtool"; then - TEST_ARGS="${TEST_DEPS}" - TEST_ARG2="${TEST_DEP2}" -- TINFO_ARGS="-L${LIB_DIR} $TEST_ARGS" -+ TINFO_LDFLAGS="-L${LIB_DIR}" -+ TINFO_LIBS="$TEST_ARGS" - TICS_LIST="$SHLIB_LIST $TEST_ARGS" - SHLIB_LIST="${SHLIB_LIST} $TEST_ARGS" - else - TEST_ARGS="-l${TINFO_ARG_SUFFIX}" - TEST_ARG2="-l${TINFO_ARG_SUFFIX}" -- TICS_LIST="$SHLIB_LIST -l${TINFO_LIB_SUFFIX}" -- TINFO_ARGS="-L${LIB_DIR} $TEST_ARGS" -+ if test "x$with_term_driver" != xno ; then -+ TICS_LIST="$SHLIB_LIST -l${LIB_NAME}${DFT_ARG_SUFFIX}" -+ TICS_LIBS="$TICS_LIBS -l${LIB_NAME}${DFT_ARG_SUFFIX}" -+ TINFO_LIBS="-l${LIB_NAME}${DFT_ARG_SUFFIX} $TEST_ARGS" -+ else -+ TICS_LIST="$SHLIB_LIST -l${TINFO_LIB_SUFFIX}" -+ TINFO_LIBS="$TEST_ARGS" -+ fi -+ TINFO_LDFLAGS="-L${LIB_DIR}" - SHLIB_LIST="$SHLIB_LIST -l${TINFO_LIB_SUFFIX}" - fi - else -@@ -1783,19 +1796,20 @@ - TINFO_NAME=${LIB_NAME} - TINFO_SUFFIX=${DFT_LIB_SUFFIX} - TINFO_ARG_SUFFIX=${LIB_NAME}${DFT_ARG_SUFFIX} -- if test "$with_tic_depends" = yes ; then -+ if test "x$with_tic_depends" = xyes ; then - TICS_LIST="$SHLIB_LIST -l${LIB_NAME}${DFT_ARG_SUFFIX}" - else - TICS_LIST="$SHLIB_LIST" - fi - -- TINFO_ARGS="-L${LIB_DIR} -l${LIB_NAME}${DFT_ARG_SUFFIX}" -+ TINFO_LDFLAGS="-L${LIB_DIR}" -+ TINFO_LIBS="-l${LIB_NAME}${DFT_ARG_SUFFIX}" - fi - - if test "$DFT_LWR_MODEL" = shared ; then - case $cf_cv_system_name in #(vi -- cygwin*) -- # "lib" files have ".dll.a" suffix, "cyg" files have ".dll" -+ cygwin*|msys*) -+ # "lib" files have ".dll.a" suffix, "cyg"or "msys-" files have ".dll" - TINFO_SUFFIX=.dll - ;; - esac -@@ -1804,9 +1818,10 @@ - AC_SUBST(TINFO_ARG_SUFFIX) - AC_SUBST(TINFO_DEP_SUFFIX) - AC_SUBST(TINFO_LIB_SUFFIX) --AC_SUBST(TINFO_ARGS) -+AC_SUBST(TINFO_LDFLAGS) -+AC_SUBST(TINFO_LIBS) - --if test "$with_dlsym" = yes ; then -+if test "x$with_dlsym" = xyes ; then - CF_REMOVE_LIB(TICS_LIST,$TICS_LIST,dl) - fi - -@@ -1815,8 +1830,8 @@ - fi - - # needed for Ada95 --TINFO_ARGS2=`echo "$TINFO_ARGS" | sed -e 's,-L\.\./,-L../../,'` --AC_SUBST(TINFO_ARGS2) -+TINFO_LDFLAGS2=`echo "$TINFO_LDFLAGS" | sed -e 's,-L\.\./,-L../../,'` -+AC_SUBST(TINFO_LDFLAGS2) - - case $DFT_LWR_MODEL in - normal|debug|profile) -@@ -1825,10 +1840,15 @@ - esac - - AC_MSG_CHECKING(where we will install curses.h) --test "$with_overwrite" = no && \ --test "x$includedir" = 'x${prefix}/include' && \ -- includedir='${prefix}/include/ncurses'${LIB_SUFFIX} --AC_MSG_RESULT($includedir) -+AC_SUBST(includesubdir) -+includesubdir= -+if test "$with_overwrite" = no && \ -+ ( test "x$includedir" = 'x${prefix}/include' || \ -+ test "x$includedir" = "x${prefix}/include" ) -+then -+ includesubdir="/ncurses${LIB_SUFFIX}" -+fi -+AC_MSG_RESULT(${includedir}${includesubdir}) - - ### Resolve a conflict between normal and wide-curses by forcing applications - ### that will need libutf8 to add it to their configure script. -@@ -1850,14 +1870,14 @@ - AC_SUBST(NCURSES_TREE) - - ### predefined stuff for the test programs --AC_DEFINE(HAVE_SLK_COLOR) -+AC_DEFINE(HAVE_SLK_COLOR,1,[Define to 1 if we have slk_color for test-programs]) - - ### Construct the list of subdirectories for which we'll customize makefiles - ### with the appropriate compile-rules. - - CF_SRC_MODULES($modules_to_build) - --if test "$cf_with_ada" != "no" && test "$cf_cv_prog_gnat_correct" != "no"; then -+if test "x$cf_with_ada" = "xyes" && test "x$cf_cv_prog_gnat_correct" = "xyes"; then - SUB_MAKEFILES="$SUB_MAKEFILES Ada95/gen/adacurses${DFT_ARG_SUFFIX}-config:Ada95/gen/adacurses-config.in" - SUB_MAKEFILES="$SUB_MAKEFILES man/adacurses${DFT_ARG_SUFFIX}-config.1:man/MKada_config.in" - fi -@@ -1869,26 +1889,27 @@ - AC_SUBST(NCURSES_SHLIB2) - - # values to use as strings --AC_DEFINE_UNQUOTED(NCURSES_PATHSEP,'$PATH_SEPARATOR') -+AC_DEFINE_UNQUOTED(NCURSES_PATHSEP,'$PATH_SEPARATOR',[Define to override ':' as library path-separator]) - --AC_DEFINE_UNQUOTED(NCURSES_VERSION_STRING, "${NCURSES_MAJOR}.${NCURSES_MINOR}.${NCURSES_PATCH}") -+AC_DEFINE_UNQUOTED(NCURSES_VERSION_STRING, "${NCURSES_MAJOR}.${NCURSES_MINOR}.${NCURSES_PATCH}",[Define to 1 if machine has ample memory for tic]) - - ### Now that we're done running tests, add the compiler-warnings, if any - CF_ADD_CFLAGS($EXTRA_CFLAGS) - - ### Define substitutions for header files to avoid name-pollution --CF_SUBST_IF(["$cf_cv_have_tcgetattr" = yes], HAVE_TCGETATTR, 1, 0) --CF_SUBST_IF(["$ac_cv_header_termio_h" = yes], HAVE_TERMIO_H, 1, 0) --CF_SUBST_IF(["$ac_cv_header_termios_h" = yes], HAVE_TERMIOS_H, 1, 0) -+CF_SUBST_IF(["x$cf_cv_have_tcgetattr" = xyes], HAVE_TCGETATTR, 1, 0) -+CF_SUBST_IF(["x$ac_cv_header_stdint_h" = xyes], HAVE_STDINT_H, 1, 0) -+CF_SUBST_IF(["x$ac_cv_header_termio_h" = xyes], HAVE_TERMIO_H, 1, 0) -+CF_SUBST_IF(["x$ac_cv_header_termios_h" = xyes], HAVE_TERMIOS_H, 1, 0) - - ################################################################################ --test "$use_database" = yes && \ -+test "x$use_database" = xyes && \ - SUB_MAKEFILES="$SUB_MAKEFILES misc/run_tic.sh:misc/run_tic.in" - - SUB_MAKEFILES="$SUB_MAKEFILES misc/ncurses-config:misc/ncurses-config.in" - SUB_MAKEFILES="$SUB_MAKEFILES man/ncurses${DFT_ARG_SUFFIX}${cf_cv_abi_version}-config.1:man/MKncu_config.in" - --if test x"$enable_pc_files" = xyes ; then \ -+if test "x$enable_pc_files" = xyes ; then \ - SUB_MAKEFILES="$SUB_MAKEFILES misc/gen-pkgconfig:misc/gen-pkgconfig.in" - MAKE_PC_FILES= - else -@@ -1917,13 +1938,55 @@ - ADAHTML_DIR=../../doc/html/ada - AC_SUBST(ADAHTML_DIR) - --SUB_SCRIPTS= -+# these could be configurable, but are not currently -+PANEL_NAME=panel -+MENU_NAME=menu -+FORM_NAME=form -+CXX_NAME=ncurses++ -+ -+AC_SUBST(PANEL_NAME) -+AC_SUBST(MENU_NAME) -+AC_SUBST(FORM_NAME) -+AC_SUBST(CXX_NAME) -+ -+# workaround for g++ versus Solaris (20131116) - case $cf_cv_system_name in #(vi --*mingw32*) #(vi -- SUB_SCRIPTS="mk-dlls.sh" -+solaris2*) #(vi -+ case "x$CPPFLAGS" in #(vi -+ *-D_XOPEN_SOURCE_EXTENDED*) -+ CF_VERBOSE(moving _XOPEN_SOURCE_EXTENDED to work around g++ problem) -+ CFLAGS="$CFLAGS -D_XOPEN_SOURCE_EXTENDED" -+ CPPFLAGS=`echo "x$CPPFLAGS" | sed -e 's/^.//' -e 's/-D_XOPEN_SOURCE_EXTENDED//'` -+ ;; -+ esac - ;; - esac - -+# AC_CHECK_SIZEOF demands a literal parameter, no variables. So we do this. -+case "x$NCURSES_OSPEED" in #(vi -+*short*) #(vi -+ cf_compatible=1 -+ ;; -+*) -+ cf_compatible=0 -+ ;; -+esac -+AC_DEFINE_UNQUOTED(NCURSES_OSPEED_COMPAT,$cf_compatible,[Define to 1 if termcap variable ospeed is short]) -+ -+case "x$cf_cv_typeof_chtype" in -+xshort|xint|xlong) -+ cf_cv_typeof_chtype="unsigned $cf_cv_typeof_chtype" -+ ;; -+esac -+ -+case "x$cf_cv_typeof_mmask_t" in -+xshort|xint|xlong) -+ cf_cv_typeof_mmask_t="unsigned $cf_cv_typeof_mmask_t" -+ ;; -+esac -+ -+SUB_SCRIPTS= -+ - AC_OUTPUT( \ - include/MKterm.h.awk \ - include/curses.head:include/curses.h.in \ -@@ -1934,11 +1997,11 @@ - $SUB_MAKEFILES \ - Makefile,[ - if test "x$cf_with_tests" != xno ; then -- CF_PRG_RULES([$srcdir/test/mk-test.awk INSTALL=no ECHO_LINK="$ECHO_LINK"], test) -+ CF_PRG_RULES([$srcdir/test/mk-test.awk INSTALL=no ECHO_LINK="$ECHO_LD"], test) - fi - CF_LIB_RULES($SRC_SUBDIRS) - --if test "x$cf_with_ada" != xno ; then -+if test "x$cf_with_ada" = "xyes" && test "x$cf_cv_prog_gnat_correct" = "xyes"; then - if test -z "$USE_OLD_MAKERULES" ; then - $AWK -f $srcdir/Ada95/mk-1st.awk <$srcdir/Ada95/src/modules >>Ada95/src/Makefile - fi -@@ -1950,10 +2013,11 @@ - AWK="$AWK" - DFT_ARG_SUFFIX="$DFT_ARG_SUFFIX" - DFT_LWR_MODEL="$DFT_LWR_MODEL" --ECHO_LINK="$ECHO_LINK" -+ECHO_LD="$ECHO_LD" - LDCONFIG="$LDCONFIG" - LIBTOOL_VERSION="$LIBTOOL_VERSION" - LIB_NAME="$LIB_NAME" -+LIB_PREFIX="$LIB_PREFIX" - LIB_SUBSETS="$LIB_SUBSETS" - LIB_SUFFIX="$LIB_SUFFIX" - LIB_TRACING="$LIB_TRACING" -@@ -1975,7 +2039,7 @@ - TINFO_SUFFIX="$TINFO_SUFFIX" - USE_OLD_MAKERULES="$USE_OLD_MAKERULES" - WITH_CURSES_H="$with_curses_h" --WITH_ECHO="$with_echo" -+WITH_ECHO="${enable_echo:=yes}" - WITH_OVERWRITE="$with_overwrite" - cf_LIST_MODELS="$cf_list_models" - cf_cv_abi_version="$cf_cv_abi_version" -@@ -1985,16 +2049,20 @@ - cf_cv_enable_opaque="$cf_cv_enable_opaque" - cf_cv_prog_CC_c_o=$cf_cv_prog_CC_c_o - cf_cv_prog_CXX_c_o=$cf_cv_prog_CXX_c_o -+cf_cv_prog_gnat_correct=$cf_cv_prog_gnat_correct - cf_cv_rel_version="$cf_cv_rel_version" - cf_cv_rm_so_locs="$cf_cv_rm_so_locs" - cf_cv_shared_soname='$cf_cv_shared_soname' - cf_cv_shlib_version="$cf_cv_shlib_version" - cf_cv_shlib_version_infix="$cf_cv_shlib_version_infix" - cf_cv_system_name="$cf_cv_system_name" -+cf_cv_term_driver="$with_term_driver" - cf_with_ada="$cf_with_ada" - cf_with_cxx_binding="$cf_with_cxx_binding" -+cf_with_db_install="$cf_with_db_install" - cf_with_manpages="$cf_with_manpages" - cf_with_tests="$cf_with_tests" -+with_shared_cxx="$with_shared_cxx" - host="$host" - target="$target" - -diff -Naur ncurses-5.9/COPYING ncurses-5.9.patch/COPYING ---- ncurses-5.9/COPYING 1970-01-01 01:00:00.000000000 +0100 -+++ ncurses-5.9.patch/COPYING 2014-09-01 16:33:22.227791908 +0200 -@@ -0,0 +1,28 @@ -+Copyright (c) 1998-2013,2014 Free Software Foundation, Inc. -+ -+Permission is hereby granted, free of charge, to any person obtaining a -+copy of this software and associated documentation files (the -+"Software"), to deal in the Software without restriction, including -+without limitation the rights to use, copy, modify, merge, publish, -+distribute, distribute with modifications, sublicense, and/or sell -+copies of the Software, and to permit persons to whom the Software is -+furnished to do so, subject to the following conditions: -+ -+The above copyright notice and this permission notice shall be included -+in all copies or substantial portions of the Software. -+ -+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -+IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -+DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -+OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR -+THE USE OR OTHER DEALINGS IN THE SOFTWARE. -+ -+Except as contained in this notice, the name(s) of the above copyright -+holders shall not be used in advertising or otherwise to promote the -+sale, use or other dealings in this Software without prior written -+authorization. -+ -+-- vile:txtmode fc=72 -+-- $Id: COPYING,v 1.2 2014/01/18 23:59:29 tom Exp $ -diff -Naur ncurses-5.9/dist.mk ncurses-5.9.patch/dist.mk ---- ncurses-5.9/dist.mk 2011-04-05 00:42:20.000000000 +0200 -+++ ncurses-5.9.patch/dist.mk 2014-09-01 16:34:19.474887043 +0200 -@@ -1,5 +1,5 @@ - ############################################################################## --# Copyright (c) 1998-2010,2011 Free Software Foundation, Inc. # -+# Copyright (c) 1998-2013,2014 Free Software Foundation, Inc. # - # # - # Permission is hereby granted, free of charge, to any person obtaining a # - # copy of this software and associated documentation files (the "Software"), # -@@ -25,7 +25,7 @@ - # use or other dealings in this Software without prior written # - # authorization. # - ############################################################################## --# $Id: dist.mk,v 1.810 2011/04/04 22:42:20 tom Exp $ -+# $Id: dist.mk,v 1.978 2014/03/23 20:59:54 tom Exp $ - # Makefile for creating ncurses distributions. - # - # This only needs to be used directly as a makefile by developers, but -@@ -37,20 +37,21 @@ - # These define the major/minor/patch versions of ncurses. - NCURSES_MAJOR = 5 - NCURSES_MINOR = 9 --NCURSES_PATCH = 20110404 -+NCURSES_PATCH = 20140323 - - # We don't append the patch to the version, since this only applies to releases - VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR) - --# The most recent html files were generated with lynx 2.8.6, using ncurses --# configured with -+# The most recent html files were generated with lynx 2.8.6 (or later), using -+# ncurses configured with - # --without-manpage-renames - # on Debian/testing. The -scrollbar and -width options are used to make lynx - # use 79 columns as it did in 2.8.5 and before. - DUMP = lynx -dump -scrollbar=0 -width=79 - DUMP2 = $(DUMP) -nolist - --GNATHTML= `type -p gnathtml || type -p gnathtml.pl` -+# gcc's file is "gnathtml.pl" -+GNATHTML= gnathtml - - # man2html 3.0.1 is a Perl script which assumes that pages are fixed size. - # Not all man programs agree with this assumption; some use half-spacing, which -@@ -98,7 +99,13 @@ - MANPROG = tbl | nroff -mandoc -rLL=65n -rLT=71n -Tascii - - manhtml: -- @rm -f doc/html/man/*.html -+ @for f in doc/html/man/*.html; do \ -+ test -f $$f || continue; \ -+ case $$f in \ -+ */index.html) ;; \ -+ *) rm -f $$f ;; \ -+ esac; \ -+ done - @mkdir -p doc/html/man - @rm -f subst.tmp ; - @for f in man/*.[0-9]*; do \ -@@ -126,7 +133,7 @@ - g=$${m}.html ;\ - if [ -f doc/html/$$g ]; then chmod +w doc/html/$$g; fi;\ - echo "Converting $$m to HTML" ;\ -- echo '' > doc/html/man/$$g ;\ -+ echo '' > doc/html/man/$$g ;\ - echo '' >> doc/html/man/$$g ;\ -- ./edit_man.sh normal editing /usr/man man $$f | $(MANPROG) | tr '\255' '-' | $(MAN2HTML) -title "$$T" | \ -- sed -f subst.sed |\ -- sed -e 's/"curses.3x.html"/"ncurses.3x.html"/g' \ -+ ./edit_man.sh normal editing /usr/man man $$f | \ -+ $(MANPROG) | \ -+ tr '\255' '-' | \ -+ $(MAN2HTML) \ -+ -title "$$T" \ -+ -aliases man/manhtml.aliases \ -+ -externs man/manhtml.externs | \ -+ sed -f subst.sed |\ -+ sed -e 's/"curses.3x.html"/"ncurses.3x.html"/g' \ - >> doc/html/man/$$g ;\ - done - @rm -f subst.sed -@@ -149,7 +162,7 @@ - # .ali files contain cross referencing information required by gnathtml. - adahtml: - if [ ! -z "$(GNATHTML)" ]; then \ -- (cd ./Ada95/gen ; make html) ;\ -+ (cd ./Ada95/gen ; make html GNATHTML=$(GNATHTML) ) ;\ - fi - - # This only works on a clean source tree, of course. -diff -Naur ncurses-5.9/doc/html/ada/files/T.htm ncurses-5.9.patch/doc/html/ada/files/T.htm ---- ncurses-5.9/doc/html/ada/files/T.htm 2005-05-14 18:28:37.000000000 +0200 -+++ ncurses-5.9.patch/doc/html/ada/files/T.htm 2014-09-01 16:33:22.266791973 +0200 -@@ -1,5 +1,9 @@ - --T -+ -+ -+T -+ -+ - -

Files - T

- [index] -diff -Naur ncurses-5.9/doc/html/ada/files.htm ncurses-5.9.patch/doc/html/ada/files.htm ---- ncurses-5.9/doc/html/ada/files.htm 2005-05-14 18:28:37.000000000 +0200 -+++ ncurses-5.9.patch/doc/html/ada/files.htm 2014-09-01 16:33:22.266791973 +0200 -@@ -1,5 +1,17 @@ -- -- -+ -+ -+ -+ -+ -+ -+ - -

Files

- [T] -diff -Naur ncurses-5.9/doc/html/ada/funcs/A.htm ncurses-5.9.patch/doc/html/ada/funcs/A.htm ---- ncurses-5.9/doc/html/ada/funcs/A.htm 2011-03-20 00:18:38.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/ada/funcs/A.htm 2014-09-01 16:33:22.266791973 +0200 -@@ -1,24 +1,28 @@ - --A -+ -+ -+A -+ -+ - -

Functions - A

- [index] - -diff -Naur ncurses-5.9/doc/html/ada/funcs/B.htm ncurses-5.9.patch/doc/html/ada/funcs/B.htm ---- ncurses-5.9/doc/html/ada/funcs/B.htm 2011-03-26 22:54:28.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/ada/funcs/B.htm 2014-09-01 16:33:22.267791975 +0200 -@@ -1,21 +1,25 @@ - --B -+ -+ -+B -+ -+ - -

Functions - B

- [index] - -diff -Naur ncurses-5.9/doc/html/ada/funcs/C.htm ncurses-5.9.patch/doc/html/ada/funcs/C.htm ---- ncurses-5.9/doc/html/ada/funcs/C.htm 2011-03-26 22:54:28.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/ada/funcs/C.htm 2014-09-01 16:33:22.267791975 +0200 -@@ -1,50 +1,54 @@ - --C -+ -+ -+C -+ -+ - -

Functions - C

- [index] - -diff -Naur ncurses-5.9/doc/html/ada/funcs/H.htm ncurses-5.9.patch/doc/html/ada/funcs/H.htm ---- ncurses-5.9/doc/html/ada/funcs/H.htm 2011-03-26 22:54:28.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/ada/funcs/H.htm 2014-09-01 16:33:22.268791976 +0200 -@@ -1,22 +1,26 @@ - --H -+ -+ -+H -+ -+ - -

Functions - H

- [index] - -diff -Naur ncurses-5.9/doc/html/ada/funcs/I.htm ncurses-5.9.patch/doc/html/ada/funcs/I.htm ---- ncurses-5.9/doc/html/ada/funcs/I.htm 2011-03-26 22:54:28.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/ada/funcs/I.htm 2014-09-01 16:33:22.268791976 +0200 -@@ -1,45 +1,49 @@ - --I -+ -+ -+I -+ -+ - -

Functions - I

- [index] - -diff -Naur ncurses-5.9/doc/html/ada/funcs/L.htm ncurses-5.9.patch/doc/html/ada/funcs/L.htm ---- ncurses-5.9/doc/html/ada/funcs/L.htm 2011-03-26 22:54:28.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/ada/funcs/L.htm 2014-09-01 16:33:22.269791978 +0200 -@@ -1,20 +1,24 @@ - --L -+ -+ -+L -+ -+ - -

Functions - L

- [index] - -diff -Naur ncurses-5.9/doc/html/ada/funcs/M.htm ncurses-5.9.patch/doc/html/ada/funcs/M.htm ---- ncurses-5.9/doc/html/ada/funcs/M.htm 2011-03-26 22:54:28.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/ada/funcs/M.htm 2014-09-01 16:33:22.269791978 +0200 -@@ -1,12 +1,16 @@ - --M -+ -+ -+M -+ -+ - -

Functions - M

- [index] -
    -
  • Make_Arg --
  • Mark - terminal_interface-curses-menus.ads:413 --
  • Mark - terminal_interface-curses-menus.ads:417 -+
  • Mark - terminal_interface-curses-menus.ads:411 -+
  • Mark - terminal_interface-curses-menus.ads:415 -
  • Menu_Back - terminal_interface-curses-menus.adb:608 -
  • Menu_Back - terminal_interface-curses-menus.adb:618 -
  • Menu_Fmt -@@ -28,13 +32,13 @@ -
  • Mouseinterval -
  • Mouse_Avail -
  • Mouse_Interval --
  • Move - terminal_interface-curses-forms.ads:616 -+
  • Move - terminal_interface-curses-forms.ads:614 -
  • Move - terminal_interface-curses-panels.ads:117 -
  • Move - terminal_interface-curses-forms.adb:786 -
  • Move - terminal_interface-curses-panels.adb:132 --
  • Move_Cursor --
  • Move_Derived_Window --
  • Move_Window -+
  • Move_Cursor -+
  • Move_Derived_Window -+
  • Move_Window -
  • Mvderwin -
  • mvwaddch -
  • Mvwdelch -diff -Naur ncurses-5.9/doc/html/ada/funcs/N.htm ncurses-5.9.patch/doc/html/ada/funcs/N.htm ---- ncurses-5.9/doc/html/ada/funcs/N.htm 2011-03-26 22:54:28.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/ada/funcs/N.htm 2014-09-01 16:33:22.269791978 +0200 -@@ -1,13 +1,17 @@ - --N -+ -+ -+N -+ -+ - -

    Functions - N

    - [index] - -diff -Naur ncurses-5.9/doc/html/ada/funcs/O.htm ncurses-5.9.patch/doc/html/ada/funcs/O.htm ---- ncurses-5.9/doc/html/ada/funcs/O.htm 2011-03-26 22:54:28.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/ada/funcs/O.htm 2014-09-01 16:33:22.269791978 +0200 -@@ -1,12 +1,16 @@ - --O -+ -+ -+O -+ -+ - -

    Functions - O

    - [index] - -diff -Naur ncurses-5.9/doc/html/ada/funcs/P.htm ncurses-5.9.patch/doc/html/ada/funcs/P.htm ---- ncurses-5.9/doc/html/ada/funcs/P.htm 2011-03-26 22:54:28.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/ada/funcs/P.htm 2014-09-01 16:33:22.270791980 +0200 -@@ -1,32 +1,36 @@ - --P -+ -+ -+P -+ -+ - -

    Functions - P

    - [index] -
      --
    • Pad_Character - terminal_interface-curses-forms.ads:476 --
    • Pad_Character - terminal_interface-curses-menus.ads:494 --
    • Page -+
    • Pad_Character - terminal_interface-curses-forms.ads:474 -+
    • Pad_Character - terminal_interface-curses-menus.ads:492 -+
    • Page -
    • Page_Length - terminal_interface-curses-text_io.ads:80 -
    • Page_Length - terminal_interface-curses-text_io.ads:81 -
    • Paircontent --
    • Pair_Content -+
    • Pair_Content -
    • Panel_Hidden -
    • Panel_Userptr -
    • Panel_Win --
    • Pattern -+
    • Pattern -
    • Pechochar --
    • Peek - terminal_interface-curses.ads:1354 --
    • Peek - terminal_interface-curses.ads:1360 --
    • Peek - terminal_interface-curses.ads:1416 --
    • Peek - terminal_interface-curses.ads:1425 --
    • Peek - terminal_interface-curses.ads:1440 --
    • Peek - terminal_interface-curses.ads:1449 -+
    • Peek - terminal_interface-curses.ads:1353 -+
    • Peek - terminal_interface-curses.ads:1359 -+
    • Peek - terminal_interface-curses.ads:1415 -+
    • Peek - terminal_interface-curses.ads:1424 -+
    • Peek - terminal_interface-curses.ads:1439 -+
    • Peek - terminal_interface-curses.ads:1448 -
    • Pnoutrefresh --
    • Position_Cursor - terminal_interface-curses-forms.ads:687 --
    • Position_Cursor - terminal_interface-curses-menus.ads:398 --
    • Post - terminal_interface-curses-forms.ads:676 --
    • Post - terminal_interface-curses-menus.ads:326 -+
    • Position_Cursor - terminal_interface-curses-forms.ads:685 -+
    • Position_Cursor - terminal_interface-curses-menus.ads:396 -+
    • Post - terminal_interface-curses-forms.ads:674 -+
    • Post - terminal_interface-curses-menus.ads:324 -
    • Pos_Form_Cursor -
    • Pos_Menu_Cursor -
    • Prefresh -diff -Naur ncurses-5.9/doc/html/ada/funcs/Q.htm ncurses-5.9.patch/doc/html/ada/funcs/Q.htm ---- ncurses-5.9/doc/html/ada/funcs/Q.htm 2007-05-05 22:35:19.000000000 +0200 -+++ ncurses-5.9.patch/doc/html/ada/funcs/Q.htm 2014-09-01 16:33:22.270791980 +0200 -@@ -1,5 +1,9 @@ - --Q -+ -+ -+Q -+ -+ - -

      Functions - Q

      - [index] -diff -Naur ncurses-5.9/doc/html/ada/funcs/R.htm ncurses-5.9.patch/doc/html/ada/funcs/R.htm ---- ncurses-5.9/doc/html/ada/funcs/R.htm 2011-03-26 22:54:28.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/ada/funcs/R.htm 2014-09-01 16:33:22.270791980 +0200 -@@ -1,39 +1,43 @@ - --R -+ -+ -+R -+ -+ - -

      Functions - R

      - [index] - -diff -Naur ncurses-5.9/doc/html/ada/funcs/S.htm ncurses-5.9.patch/doc/html/ada/funcs/S.htm ---- ncurses-5.9/doc/html/ada/funcs/S.htm 2011-03-26 22:54:28.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/ada/funcs/S.htm 2014-09-01 16:33:22.270791980 +0200 -@@ -1,54 +1,58 @@ - --S -+ -+ -+S -+ -+ - -

      Functions - S

      - [index] - -diff -Naur ncurses-5.9/doc/html/ada/funcs/T.htm ncurses-5.9.patch/doc/html/ada/funcs/T.htm ---- ncurses-5.9/doc/html/ada/funcs/T.htm 2011-03-26 22:54:28.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/ada/funcs/T.htm 2014-09-01 16:33:22.271791981 +0200 -@@ -1,13 +1,17 @@ - --T -+ -+ -+T -+ -+ - -

      Functions - T

      - [index] - -diff -Naur ncurses-5.9/doc/html/ada/funcs/U.htm ncurses-5.9.patch/doc/html/ada/funcs/U.htm ---- ncurses-5.9/doc/html/ada/funcs/U.htm 2011-03-26 22:54:28.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/ada/funcs/U.htm 2014-09-01 16:33:22.271791981 +0200 -@@ -1,23 +1,27 @@ - --U -+ -+ -+U -+ -+ - -

      Functions - U

      - [index] - -diff -Naur ncurses-5.9/doc/html/ada/funcs/V.htm ncurses-5.9.patch/doc/html/ada/funcs/V.htm ---- ncurses-5.9/doc/html/ada/funcs/V.htm 2011-03-20 00:18:38.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/ada/funcs/V.htm 2014-09-01 16:33:22.271791981 +0200 -@@ -1,11 +1,15 @@ - --V -+ -+ -+V -+ -+ - -

      Functions - V

      - [index] - -diff -Naur ncurses-5.9/doc/html/ada/funcs/W.htm ncurses-5.9.patch/doc/html/ada/funcs/W.htm ---- ncurses-5.9/doc/html/ada/funcs/W.htm 2011-03-26 22:54:28.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/ada/funcs/W.htm 2014-09-01 16:33:22.271791981 +0200 -@@ -1,5 +1,9 @@ - --W -+ -+ -+W -+ -+ - -

      Functions - W

      - [index] -diff -Naur ncurses-5.9/doc/html/ada/funcs.htm ncurses-5.9.patch/doc/html/ada/funcs.htm ---- ncurses-5.9/doc/html/ada/funcs.htm 2005-05-14 18:28:39.000000000 +0200 -+++ ncurses-5.9.patch/doc/html/ada/funcs.htm 2014-09-01 16:33:22.266791973 +0200 -@@ -1,5 +1,17 @@ -- -- -+ -+ -+ -+ -+ -+ -+ - -

      Functions/Procedures

      - [A] -diff -Naur ncurses-5.9/doc/html/ada/index.htm ncurses-5.9.patch/doc/html/ada/index.htm ---- ncurses-5.9/doc/html/ada/index.htm 2005-05-14 18:28:37.000000000 +0200 -+++ ncurses-5.9.patch/doc/html/ada/index.htm 2014-09-01 16:33:22.271791981 +0200 -@@ -1,6 +1,9 @@ - - --Source Browser -+ -+Source Browser -+ -+ - - - <H2 ALIGN=CENTER>Files</H2> -diff -Naur ncurses-5.9/doc/html/ada/main.htm ncurses-5.9.patch/doc/html/ada/main.htm ---- ncurses-5.9/doc/html/ada/main.htm 2011-02-26 00:43:50.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/ada/main.htm 2014-09-01 16:33:22.271791981 +0200 -@@ -1,5 +1,17 @@ --<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> --<HTML><HEAD><TITLE></TITLE></HEAD> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> -+<HTML> -+<HEAD> -+<TITLE></TITLE> -+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> -+<style type="text/css"> -+*.comment { -+ color: green; -+} -+*.symbol { -+ color: red; -+} -+</style> -+</HEAD> - <BODY> - <P ALIGN=right><A HREF="main.htm" TARGET="_top">[No frame version is here]</A><P><H2 ALIGN=CENTER>Files</H2> - <A HREF="files/T.htm">[T]</A> -diff -Naur ncurses-5.9/doc/html/ada/terminal_interface__ads.htm ncurses-5.9.patch/doc/html/ada/terminal_interface__ads.htm ---- ncurses-5.9/doc/html/ada/terminal_interface__ads.htm 2006-09-23 22:31:33.000000000 +0200 -+++ ncurses-5.9.patch/doc/html/ada/terminal_interface__ads.htm 2014-09-01 16:33:22.315792055 +0200 -@@ -1,53 +1,65 @@ --<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> --<HTML><HEAD><TITLE>terminal_interface.ads</TITLE></HEAD> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> -+<HTML> -+<HEAD> -+<TITLE>terminal_interface.ads</TITLE> -+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> -+<style type="text/css"> -+*.comment { -+ color: green; -+} -+*.symbol { -+ color: red; -+} -+</style> -+</HEAD> - <BODY> --<HR><DIV ALIGN="center"><H1> File : terminal_interface.ads </H1></DIV><HR> -+<HR><DIV style="text-align:center"><H1> File : terminal_interface.ads </H1></DIV><HR> - <PRE> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Terminal_Interface --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- S P E C --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Copyright (c) 1998,2006 Free Software Foundation, Inc. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></FONT> --<FONT COLOR=green><EM>-- copy of this software and associated documentation files (the --</EM></FONT> --<FONT COLOR=green><EM>-- "Software"), to deal in the Software without restriction, including --</EM></FONT> --<FONT COLOR=green><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></FONT> --<FONT COLOR=green><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></FONT> --<FONT COLOR=green><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></FONT> --<FONT COLOR=green><EM>-- furnished to do so, subject to the following conditions: --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- The above copyright notice and this permission notice shall be included --</EM></FONT> --<FONT COLOR=green><EM>-- in all copies or substantial portions of the Software. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></FONT> --<FONT COLOR=green><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></FONT> --<FONT COLOR=green><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></FONT> --<FONT COLOR=green><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></FONT> --<FONT COLOR=green><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></FONT> --<FONT COLOR=green><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></FONT> --<FONT COLOR=green><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></FONT> --<FONT COLOR=green><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></FONT> --<FONT COLOR=green><EM>-- sale, use or other dealings in this Software without prior written --</EM></FONT> --<FONT COLOR=green><EM>-- authorization. --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Author: Juergen Pfeifer, 1996</EM></FONT> --<FONT COLOR=green><EM>-- Version Control:</EM></FONT> --<FONT COLOR=green><EM>-- @Revision: 1.14 @</EM></FONT> --<FONT COLOR=green><EM>-- @Date: 2006/06/25 14:30:22 @</EM></FONT> --<FONT COLOR=green><EM>-- Binding Version 01.00</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<b>package</b> <FONT COLOR=red><A NAME="ref_42_9">Terminal_Interface</A></FONT> <b>is</b> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Terminal_Interface --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- S P E C --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Copyright (c) 1998,2006 Free Software Foundation, Inc. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></span> -+<span class="comment"><EM>-- copy of this software and associated documentation files (the --</EM></span> -+<span class="comment"><EM>-- "Software"), to deal in the Software without restriction, including --</EM></span> -+<span class="comment"><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></span> -+<span class="comment"><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></span> -+<span class="comment"><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></span> -+<span class="comment"><EM>-- furnished to do so, subject to the following conditions: --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- The above copyright notice and this permission notice shall be included --</EM></span> -+<span class="comment"><EM>-- in all copies or substantial portions of the Software. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></span> -+<span class="comment"><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></span> -+<span class="comment"><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></span> -+<span class="comment"><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></span> -+<span class="comment"><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></span> -+<span class="comment"><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></span> -+<span class="comment"><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></span> -+<span class="comment"><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></span> -+<span class="comment"><EM>-- sale, use or other dealings in this Software without prior written --</EM></span> -+<span class="comment"><EM>-- authorization. --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Author: Juergen Pfeifer, 1996</EM></span> -+<span class="comment"><EM>-- Version Control:</EM></span> -+<span class="comment"><EM>-- @Revision: 1.14 @</EM></span> -+<span class="comment"><EM>-- @Date: 2006/06/25 14:30:22 @</EM></span> -+<span class="comment"><EM>-- Binding Version 01.00</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<b>package</b> <span class="symbol"><A NAME="ref_42_9">Terminal_Interface</A></span> <b>is</b> - <b>pragma</b> Pure (<A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>); --<FONT COLOR=green><EM>--</EM></FONT> --<FONT COLOR=green><EM>-- Everything is in the child units</EM></FONT> --<FONT COLOR=green><EM>--</EM></FONT> -+<span class="comment"><EM>--</EM></span> -+<span class="comment"><EM>-- Everything is in the child units</EM></span> -+<span class="comment"><EM>--</EM></span> - <b>end</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>; - </PRE></BODY></HTML> -diff -Naur ncurses-5.9/doc/html/ada/terminal_interface-curses__adb.htm ncurses-5.9.patch/doc/html/ada/terminal_interface-curses__adb.htm ---- ncurses-5.9/doc/html/ada/terminal_interface-curses__adb.htm 2011-03-26 22:54:31.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/ada/terminal_interface-curses__adb.htm 2014-09-01 16:33:22.311792048 +0200 -@@ -1,85 +1,97 @@ --<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> --<HTML><HEAD><TITLE>terminal_interface-curses.adb</TITLE></HEAD> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> -+<HTML> -+<HEAD> -+<TITLE>terminal_interface-curses.adb</TITLE> -+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> -+<style type="text/css"> -+*.comment { -+ color: green; -+} -+*.symbol { -+ color: red; -+} -+</style> -+</HEAD> - <BODY> --<HR><DIV ALIGN="center"><H1> File : terminal_interface-curses.adb </H1></DIV><HR> -+<HR><DIV style="text-align:center"><H1> File : terminal_interface-curses.adb </H1></DIV><HR> - <PRE> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Terminal_Interface.Curses --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- B O D Y --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Copyright (c) 1998-2009,2011 Free Software Foundation, Inc. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></FONT> --<FONT COLOR=green><EM>-- copy of this software and associated documentation files (the --</EM></FONT> --<FONT COLOR=green><EM>-- "Software"), to deal in the Software without restriction, including --</EM></FONT> --<FONT COLOR=green><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></FONT> --<FONT COLOR=green><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></FONT> --<FONT COLOR=green><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></FONT> --<FONT COLOR=green><EM>-- furnished to do so, subject to the following conditions: --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- The above copyright notice and this permission notice shall be included --</EM></FONT> --<FONT COLOR=green><EM>-- in all copies or substantial portions of the Software. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></FONT> --<FONT COLOR=green><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></FONT> --<FONT COLOR=green><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></FONT> --<FONT COLOR=green><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></FONT> --<FONT COLOR=green><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></FONT> --<FONT COLOR=green><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></FONT> --<FONT COLOR=green><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></FONT> --<FONT COLOR=green><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></FONT> --<FONT COLOR=green><EM>-- sale, use or other dealings in this Software without prior written --</EM></FONT> --<FONT COLOR=green><EM>-- authorization. --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Author: Juergen Pfeifer, 1996</EM></FONT> --<FONT COLOR=green><EM>-- Version Control:</EM></FONT> --<FONT COLOR=green><EM>-- @Revision: 1.8 @</EM></FONT> --<FONT COLOR=green><EM>-- @Date: 2011/03/22 23:02:14 @</EM></FONT> --<FONT COLOR=green><EM>-- Binding Version 01.00</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Terminal_Interface.Curses --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- B O D Y --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Copyright (c) 1998-2009,2011 Free Software Foundation, Inc. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></span> -+<span class="comment"><EM>-- copy of this software and associated documentation files (the --</EM></span> -+<span class="comment"><EM>-- "Software"), to deal in the Software without restriction, including --</EM></span> -+<span class="comment"><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></span> -+<span class="comment"><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></span> -+<span class="comment"><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></span> -+<span class="comment"><EM>-- furnished to do so, subject to the following conditions: --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- The above copyright notice and this permission notice shall be included --</EM></span> -+<span class="comment"><EM>-- in all copies or substantial portions of the Software. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></span> -+<span class="comment"><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></span> -+<span class="comment"><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></span> -+<span class="comment"><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></span> -+<span class="comment"><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></span> -+<span class="comment"><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></span> -+<span class="comment"><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></span> -+<span class="comment"><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></span> -+<span class="comment"><EM>-- sale, use or other dealings in this Software without prior written --</EM></span> -+<span class="comment"><EM>-- authorization. --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Author: Juergen Pfeifer, 1996</EM></span> -+<span class="comment"><EM>-- Version Control:</EM></span> -+<span class="comment"><EM>-- @Revision: 1.8 @</EM></span> -+<span class="comment"><EM>-- @Date: 2011/03/22 23:02:14 @</EM></span> -+<span class="comment"><EM>-- Binding Version 01.00</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> - <b>with</b> System; - - <b>with</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-aux__ads.htm#ref_50_35">Aux</A>; --<b>with</b> <A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>.C; <b>use</b> <A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>.C; --<b>with</b> <A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>.C.Strings; <b>use</b> <A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>.C.Strings; -+<b>with</b> <A HREF="interfac__ads.htm#ref_36_9">Interfaces</A>.C; <b>use</b> <A HREF="interfac__ads.htm#ref_36_9">Interfaces</A>.C; -+<b>with</b> <A HREF="interfac__ads.htm#ref_36_9">Interfaces</A>.C.Strings; <b>use</b> <A HREF="interfac__ads.htm#ref_36_9">Interfaces</A>.C.Strings; - <b>with</b> Ada.Characters.Handling; <b>use</b> Ada.Characters.Handling; - <b>with</b> Ada.Strings.Fixed; - --<b>package</b> <b>body</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<FONT COLOR=red><A NAME="ref_50_33" HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A></FONT> <b>is</b> -+<b>package</b> <b>body</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<span class="symbol"><A NAME="ref_50_33" HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A></span> <b>is</b> - - <b>use</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_50_35">Aux</A>; - <b>use</b> <b>type</b> System.Bit_Order; - -- <b>package</b> <FONT COLOR=red><A NAME="ref_55_12">ASF</A></FONT> <b>renames</b> Ada.Strings.Fixed; -+ <b>package</b> <span class="symbol"><A NAME="ref_55_12">ASF</A></span> <b>renames</b> Ada.Strings.Fixed; - - <b>type</b> chtype_array <b>is</b> <b>array</b> (size_t <b>range</b> &lt;&gt;) -- <b>of</b> <b>aliased</b> <A HREF="terminal_interface-curses__ads.htm#ref_354_9">Attributed_Character</A>; -+ <b>of</b> <b>aliased</b> <A HREF="terminal_interface-curses__ads.htm#ref_353_9">Attributed_Character</A>; - <b>pragma</b> Convention (C, chtype_array); - --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_62_13" HREF="terminal_interface-curses__ads.htm#ref_1618_13">Key_Name</A></FONT> (<FONT COLOR=red><A NAME="ref_62_23" HREF="terminal_interface-curses__ads.htm#ref_1618_23">Key</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_73_12">Real_Key_Code</A>) <b>return</b> String -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_62_13" HREF="terminal_interface-curses__ads.htm#ref_1617_13">Key_Name</A></span> (<span class="symbol"><A NAME="ref_62_23" HREF="terminal_interface-curses__ads.htm#ref_1617_23">Key</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_73_12">Real_Key_Code</A>) <b>return</b> String - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_64_16">Keyname</A></FONT> (<FONT COLOR=red><A NAME="ref_64_25" HREF="terminal_interface-curses__adb.htm#ref_64_16">K</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> chars_ptr; -+ <b>function</b> <span class="symbol"><A NAME="ref_64_16">Keyname</A></span> (<span class="symbol"><A NAME="ref_64_25" HREF="terminal_interface-curses__adb.htm#ref_64_16">K</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> chars_ptr; - <b>pragma</b> Import (C, Keyname, "keyname"); - -- <FONT COLOR=red><A NAME="ref_67_7">Ch</A></FONT> : Character; -+ <span class="symbol"><A NAME="ref_67_7">Ch</A></span> : Character; - <b>begin</b> -- <b>if</b> <A HREF="terminal_interface-curses__ads.htm#ref_1618_23">Key</A> &lt;= Character'Pos (Character'Last) <b>then</b> -- <A HREF="terminal_interface-curses__adb.htm#ref_67_7">Ch</A> := Character'Val (<A HREF="terminal_interface-curses__ads.htm#ref_1618_23">Key</A>); -+ <b>if</b> <A HREF="terminal_interface-curses__ads.htm#ref_1617_23">Key</A> &lt;= Character'Pos (Character'Last) <b>then</b> -+ <A HREF="terminal_interface-curses__adb.htm#ref_67_7">Ch</A> := Character'Val (<A HREF="terminal_interface-curses__ads.htm#ref_1617_23">Key</A>); - <b>if</b> Is_Control (<A HREF="terminal_interface-curses__adb.htm#ref_67_7">Ch</A>) <b>then</b> -- <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_1629_13">Un_Control</A> (<A HREF="terminal_interface-curses__ads.htm#ref_354_9">Attributed_Character</A>'(<A HREF="terminal_interface-curses__ads.htm#ref_358_10">Ch</A> =&gt; <A HREF="terminal_interface-curses__adb.htm#ref_67_7">Ch</A>, -- <A HREF="terminal_interface-curses__ads.htm#ref_357_10">Color</A> =&gt; <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>'First, -- <A HREF="terminal_interface-curses__ads.htm#ref_356_10">Attr</A> =&gt; <A HREF="terminal_interface-curses__ads.htm#ref_352_4">Normal_Video</A>)); -+ <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_1628_13">Un_Control</A> (<A HREF="terminal_interface-curses__ads.htm#ref_353_9">Attributed_Character</A>'(<A HREF="terminal_interface-curses__ads.htm#ref_357_10">Ch</A> =&gt; <A HREF="terminal_interface-curses__adb.htm#ref_67_7">Ch</A>, -+ <A HREF="terminal_interface-curses__ads.htm#ref_356_10">Color</A> =&gt; <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>'First, -+ <A HREF="terminal_interface-curses__ads.htm#ref_355_10">Attr</A> =&gt; <A HREF="terminal_interface-curses__ads.htm#ref_351_4">Normal_Video</A>)); - <b>elsif</b> Is_Graphic (<A HREF="terminal_interface-curses__adb.htm#ref_67_7">Ch</A>) <b>then</b> - <b>declare</b> -- <FONT COLOR=red><A NAME="ref_77_16">S</A></FONT> : String (1 .. 1); -+ <span class="symbol"><A NAME="ref_77_16">S</A></span> : String (1 .. 1); - <b>begin</b> - <A HREF="terminal_interface-curses__adb.htm#ref_77_16">S</A> (1) := <A HREF="terminal_interface-curses__adb.htm#ref_67_7">Ch</A>; - <b>return</b> <A HREF="terminal_interface-curses__adb.htm#ref_77_16">S</A>; -@@ -88,2475 +100,2475 @@ - <b>return</b> ""; - <b>end</b> <b>if</b>; - <b>else</b> -- <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_121_13">Fill_String</A> (<A HREF="terminal_interface-curses__adb.htm#ref_64_16">Keyname</A> (<A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1618_23">Key</A>))); -+ <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_121_13">Fill_String</A> (<A HREF="terminal_interface-curses__adb.htm#ref_64_16">Keyname</A> (<A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1617_23">Key</A>))); - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1618_13">Key_Name</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1617_13">Key_Name</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_90_14" HREF="terminal_interface-curses__ads.htm#ref_1612_14">Key_Name</A></FONT> (<FONT COLOR=red><A NAME="ref_90_24" HREF="terminal_interface-curses__ads.htm#ref_1612_24">Key</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_73_12">Real_Key_Code</A>; -- <FONT COLOR=red><A NAME="ref_91_24" HREF="terminal_interface-curses__ads.htm#ref_1613_24">Name</A></FONT> : <b>out</b> String) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_90_14" HREF="terminal_interface-curses__ads.htm#ref_1611_14">Key_Name</A></span> (<span class="symbol"><A NAME="ref_90_24" HREF="terminal_interface-curses__ads.htm#ref_1611_24">Key</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_73_12">Real_Key_Code</A>; -+ <span class="symbol"><A NAME="ref_91_24" HREF="terminal_interface-curses__ads.htm#ref_1612_24">Name</A></span> : <b>out</b> String) - <b>is</b> - <b>begin</b> -- <A HREF="terminal_interface-curses__adb.htm#ref_55_12">ASF</A>.Move (<A HREF="terminal_interface-curses__ads.htm#ref_1618_13">Key_Name</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1612_24">Key</A>), <A HREF="terminal_interface-curses__ads.htm#ref_1613_24">Name</A>); -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1612_14">Key_Name</A>; -+ <A HREF="terminal_interface-curses__adb.htm#ref_55_12">ASF</A>.Move (<A HREF="terminal_interface-curses__ads.htm#ref_1617_13">Key_Name</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1611_24">Key</A>), <A HREF="terminal_interface-curses__ads.htm#ref_1612_24">Name</A>); -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1611_14">Key_Name</A>; - --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_98_14" HREF="terminal_interface-curses__ads.htm#ref_488_14">Init_Screen</A></FONT> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_98_14" HREF="terminal_interface-curses__ads.htm#ref_487_14">Init_Screen</A></span> - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_100_16">Initscr</A></FONT> <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_100_16">Initscr</A></span> <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; - <b>pragma</b> Import (C, Initscr, "initscr"); - -- <FONT COLOR=red><A NAME="ref_103_7">W</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="symbol"><A NAME="ref_103_7">W</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; - <b>begin</b> - <A HREF="terminal_interface-curses__adb.htm#ref_103_7">W</A> := <A HREF="terminal_interface-curses__adb.htm#ref_100_16">Initscr</A>; - <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_103_7">W</A> = <A HREF="terminal_interface-curses__ads.htm#ref_58_4">Null_Window</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_488_14">Init_Screen</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_487_14">Init_Screen</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_111_14" HREF="terminal_interface-curses__ads.htm#ref_497_14">End_Windows</A></FONT> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_111_14" HREF="terminal_interface-curses__ads.htm#ref_496_14">End_Windows</A></span> - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_113_16">Endwin</A></FONT> <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_113_16">Endwin</A></span> <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Endwin, "endwin"); - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_113_16">Endwin</A> = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_497_14">End_Windows</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_496_14">End_Windows</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_121_13" HREF="terminal_interface-curses__ads.htm#ref_504_13">Is_End_Window</A></FONT> <b>return</b> Boolean -+ <b>function</b> <span class="symbol"><A NAME="ref_121_13" HREF="terminal_interface-curses__ads.htm#ref_503_13">Is_End_Window</A></span> <b>return</b> Boolean - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_123_16">Isendwin</A></FONT> <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_1926_9">Curses_Bool</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_123_16">Isendwin</A></span> <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_1925_9">Curses_Bool</A>; - <b>pragma</b> Import (C, Isendwin, "isendwin"); - <b>begin</b> -- <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_123_16">Isendwin</A> = <A HREF="terminal_interface-curses__ads.htm#ref_1927_4">Curses_Bool_False</A> <b>then</b> -+ <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_123_16">Isendwin</A> = <A HREF="terminal_interface-curses__ads.htm#ref_1926_4">Curses_Bool_False</A> <b>then</b> - <b>return</b> False; - <b>else</b> - <b>return</b> True; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_504_13">Is_End_Window</A>; --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_133_14" HREF="terminal_interface-curses__ads.htm#ref_513_14">Move_Cursor</A></FONT> (<FONT COLOR=red><A NAME="ref_133_27" HREF="terminal_interface-curses__ads.htm#ref_513_27">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_134_27" HREF="terminal_interface-curses__ads.htm#ref_514_27">Line</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_135_27" HREF="terminal_interface-curses__ads.htm#ref_515_27">Column</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>) -- <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_137_16">Wmove</A></FONT> (<FONT COLOR=red><A NAME="ref_137_23" HREF="terminal_interface-curses__adb.htm#ref_137_16">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- <FONT COLOR=red><A NAME="ref_138_23" HREF="terminal_interface-curses__adb.htm#ref_137_16">Line</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -- <FONT COLOR=red><A NAME="ref_139_23" HREF="terminal_interface-curses__adb.htm#ref_137_16">Column</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_503_13">Is_End_Window</A>; -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_133_14" HREF="terminal_interface-curses__ads.htm#ref_512_14">Move_Cursor</A></span> (<span class="symbol"><A NAME="ref_133_27" HREF="terminal_interface-curses__ads.htm#ref_512_27">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_134_27" HREF="terminal_interface-curses__ads.htm#ref_513_27">Line</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_135_27" HREF="terminal_interface-curses__ads.htm#ref_514_27">Column</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>) -+ <b>is</b> -+ <b>function</b> <span class="symbol"><A NAME="ref_137_16">Wmove</A></span> (<span class="symbol"><A NAME="ref_137_23" HREF="terminal_interface-curses__adb.htm#ref_137_16">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="symbol"><A NAME="ref_138_23" HREF="terminal_interface-curses__adb.htm#ref_137_16">Line</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <span class="symbol"><A NAME="ref_139_23" HREF="terminal_interface-curses__adb.htm#ref_137_16">Column</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> - ) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Wmove, "wmove"); - <b>begin</b> -- <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_137_16">Wmove</A> (<A HREF="terminal_interface-curses__ads.htm#ref_513_27">Win</A>, <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_514_27">Line</A>), <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_515_27">Column</A>)) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_137_16">Wmove</A> (<A HREF="terminal_interface-curses__ads.htm#ref_512_27">Win</A>, <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_513_27">Line</A>), <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_514_27">Column</A>)) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_513_14">Move_Cursor</A>; --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_148_14" HREF="terminal_interface-curses__ads.htm#ref_525_14">Add</A></FONT> (<FONT COLOR=red><A NAME="ref_148_19" HREF="terminal_interface-curses__ads.htm#ref_525_19">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_149_19" HREF="terminal_interface-curses__ads.htm#ref_526_19">Ch</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_354_9">Attributed_Character</A>) -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_512_14">Move_Cursor</A>; -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_148_14" HREF="terminal_interface-curses__ads.htm#ref_524_14">Add</A></span> (<span class="symbol"><A NAME="ref_148_19" HREF="terminal_interface-curses__ads.htm#ref_524_19">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_149_19" HREF="terminal_interface-curses__ads.htm#ref_525_19">Ch</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_353_9">Attributed_Character</A>) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_151_16">Waddch</A></FONT> (<FONT COLOR=red><A NAME="ref_151_24" HREF="terminal_interface-curses__adb.htm#ref_151_16">W</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- <FONT COLOR=red><A NAME="ref_152_24" HREF="terminal_interface-curses__adb.htm#ref_151_16">Ch</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_12">C_Chtype</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_151_16">Waddch</A></span> (<span class="symbol"><A NAME="ref_151_24" HREF="terminal_interface-curses__adb.htm#ref_151_16">W</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="symbol"><A NAME="ref_152_24" HREF="terminal_interface-curses__adb.htm#ref_151_16">Ch</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_12">C_Chtype</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Waddch, "waddch"); - <b>begin</b> -- <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_151_16">Waddch</A> (<A HREF="terminal_interface-curses__ads.htm#ref_525_19">Win</A>, AttrChar_To_Chtype (<A HREF="terminal_interface-curses__ads.htm#ref_526_19">Ch</A>)) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_151_16">Waddch</A> (<A HREF="terminal_interface-curses__ads.htm#ref_524_19">Win</A>, AttrChar_To_Chtype (<A HREF="terminal_interface-curses__ads.htm#ref_525_19">Ch</A>)) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_525_14">Add</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_524_14">Add</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_160_14" HREF="terminal_interface-curses__ads.htm#ref_530_14">Add</A></FONT> (<FONT COLOR=red><A NAME="ref_160_19" HREF="terminal_interface-curses__ads.htm#ref_530_19">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_161_19" HREF="terminal_interface-curses__ads.htm#ref_531_19">Ch</A></FONT> : Character) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_160_14" HREF="terminal_interface-curses__ads.htm#ref_529_14">Add</A></span> (<span class="symbol"><A NAME="ref_160_19" HREF="terminal_interface-curses__ads.htm#ref_529_19">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_161_19" HREF="terminal_interface-curses__ads.htm#ref_530_19">Ch</A></span> : Character) - <b>is</b> - <b>begin</b> -- <A HREF="terminal_interface-curses__ads.htm#ref_525_14">Add</A> (<A HREF="terminal_interface-curses__ads.htm#ref_530_19">Win</A>, -- <A HREF="terminal_interface-curses__ads.htm#ref_354_9">Attributed_Character</A>'(<A HREF="terminal_interface-curses__ads.htm#ref_358_10">Ch</A> =&gt; <A HREF="terminal_interface-curses__ads.htm#ref_531_19">Ch</A>, -- <A HREF="terminal_interface-curses__ads.htm#ref_357_10">Color</A> =&gt; <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>'First, -- <A HREF="terminal_interface-curses__ads.htm#ref_356_10">Attr</A> =&gt; <A HREF="terminal_interface-curses__ads.htm#ref_352_4">Normal_Video</A>)); -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_530_14">Add</A>; -- -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_170_14" HREF="terminal_interface-curses__ads.htm#ref_536_14">Add</A></FONT> -- (<FONT COLOR=red><A NAME="ref_171_7" HREF="terminal_interface-curses__ads.htm#ref_537_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_172_7" HREF="terminal_interface-curses__ads.htm#ref_538_7">Line</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_173_7" HREF="terminal_interface-curses__ads.htm#ref_539_7">Column</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -- <FONT COLOR=red><A NAME="ref_174_7" HREF="terminal_interface-curses__ads.htm#ref_540_7">Ch</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_354_9">Attributed_Character</A>) -- <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_176_16">mvwaddch</A></FONT> (<FONT COLOR=red><A NAME="ref_176_26" HREF="terminal_interface-curses__adb.htm#ref_176_16">W</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- <FONT COLOR=red><A NAME="ref_177_26" HREF="terminal_interface-curses__adb.htm#ref_176_16">Y</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -- <FONT COLOR=red><A NAME="ref_178_26" HREF="terminal_interface-curses__adb.htm#ref_176_16">X</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -- <FONT COLOR=red><A NAME="ref_179_26" HREF="terminal_interface-curses__adb.htm#ref_176_16">Ch</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_12">C_Chtype</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <A HREF="terminal_interface-curses__ads.htm#ref_524_14">Add</A> (<A HREF="terminal_interface-curses__ads.htm#ref_529_19">Win</A>, -+ <A HREF="terminal_interface-curses__ads.htm#ref_353_9">Attributed_Character</A>'(<A HREF="terminal_interface-curses__ads.htm#ref_357_10">Ch</A> =&gt; <A HREF="terminal_interface-curses__ads.htm#ref_530_19">Ch</A>, -+ <A HREF="terminal_interface-curses__ads.htm#ref_356_10">Color</A> =&gt; <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>'First, -+ <A HREF="terminal_interface-curses__ads.htm#ref_355_10">Attr</A> =&gt; <A HREF="terminal_interface-curses__ads.htm#ref_351_4">Normal_Video</A>)); -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_529_14">Add</A>; -+ -+ <b>procedure</b> <span class="symbol"><A NAME="ref_170_14" HREF="terminal_interface-curses__ads.htm#ref_535_14">Add</A></span> -+ (<span class="symbol"><A NAME="ref_171_7" HREF="terminal_interface-curses__ads.htm#ref_536_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_172_7" HREF="terminal_interface-curses__ads.htm#ref_537_7">Line</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_173_7" HREF="terminal_interface-curses__ads.htm#ref_538_7">Column</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -+ <span class="symbol"><A NAME="ref_174_7" HREF="terminal_interface-curses__ads.htm#ref_539_7">Ch</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_353_9">Attributed_Character</A>) -+ <b>is</b> -+ <b>function</b> <span class="symbol"><A NAME="ref_176_16">mvwaddch</A></span> (<span class="symbol"><A NAME="ref_176_26" HREF="terminal_interface-curses__adb.htm#ref_176_16">W</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="symbol"><A NAME="ref_177_26" HREF="terminal_interface-curses__adb.htm#ref_176_16">Y</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <span class="symbol"><A NAME="ref_178_26" HREF="terminal_interface-curses__adb.htm#ref_176_16">X</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <span class="symbol"><A NAME="ref_179_26" HREF="terminal_interface-curses__adb.htm#ref_176_16">Ch</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_12">C_Chtype</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, mvwaddch, "mvwaddch"); - <b>begin</b> -- <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_176_16">mvwaddch</A> (<A HREF="terminal_interface-curses__ads.htm#ref_537_7">Win</A>, <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_538_7">Line</A>), -- <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_539_7">Column</A>), -- AttrChar_To_Chtype (<A HREF="terminal_interface-curses__ads.htm#ref_540_7">Ch</A>)) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -- <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_536_14">Add</A>; -- -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_189_14" HREF="terminal_interface-curses__ads.htm#ref_544_14">Add</A></FONT> -- (<FONT COLOR=red><A NAME="ref_190_7" HREF="terminal_interface-curses__ads.htm#ref_545_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_191_7" HREF="terminal_interface-curses__ads.htm#ref_546_7">Line</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_192_7" HREF="terminal_interface-curses__ads.htm#ref_547_7">Column</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -- <FONT COLOR=red><A NAME="ref_193_7" HREF="terminal_interface-curses__ads.htm#ref_548_7">Ch</A></FONT> : Character) -- <b>is</b> -- <b>begin</b> -- <A HREF="terminal_interface-curses__ads.htm#ref_536_14">Add</A> (<A HREF="terminal_interface-curses__ads.htm#ref_545_7">Win</A>, -- <A HREF="terminal_interface-curses__ads.htm#ref_546_7">Line</A>, -- <A HREF="terminal_interface-curses__ads.htm#ref_547_7">Column</A>, -- <A HREF="terminal_interface-curses__ads.htm#ref_354_9">Attributed_Character</A>'(<A HREF="terminal_interface-curses__ads.htm#ref_358_10">Ch</A> =&gt; <A HREF="terminal_interface-curses__ads.htm#ref_548_7">Ch</A>, -- <A HREF="terminal_interface-curses__ads.htm#ref_357_10">Color</A> =&gt; <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>'First, -- <A HREF="terminal_interface-curses__ads.htm#ref_356_10">Attr</A> =&gt; <A HREF="terminal_interface-curses__ads.htm#ref_352_4">Normal_Video</A>)); -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_544_14">Add</A>; -- -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_204_14" HREF="terminal_interface-curses__ads.htm#ref_553_14">Add_With_Immediate_Echo</A></FONT> -- (<FONT COLOR=red><A NAME="ref_205_7" HREF="terminal_interface-curses__ads.htm#ref_554_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_206_7" HREF="terminal_interface-curses__ads.htm#ref_555_7">Ch</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_354_9">Attributed_Character</A>) -+ <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_176_16">mvwaddch</A> (<A HREF="terminal_interface-curses__ads.htm#ref_536_7">Win</A>, <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_537_7">Line</A>), -+ <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_538_7">Column</A>), -+ AttrChar_To_Chtype (<A HREF="terminal_interface-curses__ads.htm#ref_539_7">Ch</A>)) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; -+ <b>end</b> <b>if</b>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_535_14">Add</A>; -+ -+ <b>procedure</b> <span class="symbol"><A NAME="ref_189_14" HREF="terminal_interface-curses__ads.htm#ref_543_14">Add</A></span> -+ (<span class="symbol"><A NAME="ref_190_7" HREF="terminal_interface-curses__ads.htm#ref_544_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_191_7" HREF="terminal_interface-curses__ads.htm#ref_545_7">Line</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_192_7" HREF="terminal_interface-curses__ads.htm#ref_546_7">Column</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -+ <span class="symbol"><A NAME="ref_193_7" HREF="terminal_interface-curses__ads.htm#ref_547_7">Ch</A></span> : Character) -+ <b>is</b> -+ <b>begin</b> -+ <A HREF="terminal_interface-curses__ads.htm#ref_535_14">Add</A> (<A HREF="terminal_interface-curses__ads.htm#ref_544_7">Win</A>, -+ <A HREF="terminal_interface-curses__ads.htm#ref_545_7">Line</A>, -+ <A HREF="terminal_interface-curses__ads.htm#ref_546_7">Column</A>, -+ <A HREF="terminal_interface-curses__ads.htm#ref_353_9">Attributed_Character</A>'(<A HREF="terminal_interface-curses__ads.htm#ref_357_10">Ch</A> =&gt; <A HREF="terminal_interface-curses__ads.htm#ref_547_7">Ch</A>, -+ <A HREF="terminal_interface-curses__ads.htm#ref_356_10">Color</A> =&gt; <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>'First, -+ <A HREF="terminal_interface-curses__ads.htm#ref_355_10">Attr</A> =&gt; <A HREF="terminal_interface-curses__ads.htm#ref_351_4">Normal_Video</A>)); -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_543_14">Add</A>; -+ -+ <b>procedure</b> <span class="symbol"><A NAME="ref_204_14" HREF="terminal_interface-curses__ads.htm#ref_552_14">Add_With_Immediate_Echo</A></span> -+ (<span class="symbol"><A NAME="ref_205_7" HREF="terminal_interface-curses__ads.htm#ref_553_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_206_7" HREF="terminal_interface-curses__ads.htm#ref_554_7">Ch</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_353_9">Attributed_Character</A>) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_208_16">Wechochar</A></FONT> (<FONT COLOR=red><A NAME="ref_208_27" HREF="terminal_interface-curses__adb.htm#ref_208_16">W</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- <FONT COLOR=red><A NAME="ref_209_27" HREF="terminal_interface-curses__adb.htm#ref_208_16">Ch</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_12">C_Chtype</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_208_16">Wechochar</A></span> (<span class="symbol"><A NAME="ref_208_27" HREF="terminal_interface-curses__adb.htm#ref_208_16">W</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="symbol"><A NAME="ref_209_27" HREF="terminal_interface-curses__adb.htm#ref_208_16">Ch</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_12">C_Chtype</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Wechochar, "wechochar"); - <b>begin</b> -- <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_208_16">Wechochar</A> (<A HREF="terminal_interface-curses__ads.htm#ref_554_7">Win</A>, AttrChar_To_Chtype (<A HREF="terminal_interface-curses__ads.htm#ref_555_7">Ch</A>)) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_208_16">Wechochar</A> (<A HREF="terminal_interface-curses__ads.htm#ref_553_7">Win</A>, AttrChar_To_Chtype (<A HREF="terminal_interface-curses__ads.htm#ref_554_7">Ch</A>)) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_553_14">Add_With_Immediate_Echo</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_552_14">Add_With_Immediate_Echo</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_217_14" HREF="terminal_interface-curses__ads.htm#ref_559_14">Add_With_Immediate_Echo</A></FONT> -- (<FONT COLOR=red><A NAME="ref_218_7" HREF="terminal_interface-curses__ads.htm#ref_560_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_219_7" HREF="terminal_interface-curses__ads.htm#ref_561_7">Ch</A></FONT> : Character) -- <b>is</b> -- <b>begin</b> -- <A HREF="terminal_interface-curses__ads.htm#ref_553_14">Add_With_Immediate_Echo</A> -- (<A HREF="terminal_interface-curses__ads.htm#ref_560_7">Win</A>, -- <A HREF="terminal_interface-curses__ads.htm#ref_354_9">Attributed_Character</A>'(<A HREF="terminal_interface-curses__ads.htm#ref_358_10">Ch</A> =&gt; <A HREF="terminal_interface-curses__ads.htm#ref_561_7">Ch</A>, -- <A HREF="terminal_interface-curses__ads.htm#ref_357_10">Color</A> =&gt; <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>'First, -- <A HREF="terminal_interface-curses__ads.htm#ref_356_10">Attr</A> =&gt; <A HREF="terminal_interface-curses__ads.htm#ref_352_4">Normal_Video</A>)); -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_559_14">Add_With_Immediate_Echo</A>; --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_229_13" HREF="terminal_interface-curses__ads.htm#ref_571_13">Create</A></FONT> (<FONT COLOR=red><A NAME="ref_229_21" HREF="terminal_interface-curses__ads.htm#ref_572_7">Number_Of_Lines</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_63_12">Line_Count</A>; -- <FONT COLOR=red><A NAME="ref_230_21" HREF="terminal_interface-curses__ads.htm#ref_573_7">Number_Of_Columns</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_65_12">Column_Count</A>; -- <FONT COLOR=red><A NAME="ref_231_21" HREF="terminal_interface-curses__ads.htm#ref_574_7">First_Line_Position</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_232_21" HREF="terminal_interface-curses__ads.htm#ref_575_7">First_Column_Position</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> -- <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_234_16">Newwin</A></FONT> (<FONT COLOR=red><A NAME="ref_234_24" HREF="terminal_interface-curses__adb.htm#ref_234_16">Number_Of_Lines</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -- <FONT COLOR=red><A NAME="ref_235_24" HREF="terminal_interface-curses__adb.htm#ref_234_16">Number_Of_Columns</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -- <FONT COLOR=red><A NAME="ref_236_24" HREF="terminal_interface-curses__adb.htm#ref_234_16">First_Line_Position</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -- <FONT COLOR=red><A NAME="ref_237_24" HREF="terminal_interface-curses__adb.htm#ref_234_16">First_Column_Position</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <b>procedure</b> <span class="symbol"><A NAME="ref_217_14" HREF="terminal_interface-curses__ads.htm#ref_558_14">Add_With_Immediate_Echo</A></span> -+ (<span class="symbol"><A NAME="ref_218_7" HREF="terminal_interface-curses__ads.htm#ref_559_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_219_7" HREF="terminal_interface-curses__ads.htm#ref_560_7">Ch</A></span> : Character) -+ <b>is</b> -+ <b>begin</b> -+ <A HREF="terminal_interface-curses__ads.htm#ref_552_14">Add_With_Immediate_Echo</A> -+ (<A HREF="terminal_interface-curses__ads.htm#ref_559_7">Win</A>, -+ <A HREF="terminal_interface-curses__ads.htm#ref_353_9">Attributed_Character</A>'(<A HREF="terminal_interface-curses__ads.htm#ref_357_10">Ch</A> =&gt; <A HREF="terminal_interface-curses__ads.htm#ref_560_7">Ch</A>, -+ <A HREF="terminal_interface-curses__ads.htm#ref_356_10">Color</A> =&gt; <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>'First, -+ <A HREF="terminal_interface-curses__ads.htm#ref_355_10">Attr</A> =&gt; <A HREF="terminal_interface-curses__ads.htm#ref_351_4">Normal_Video</A>)); -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_558_14">Add_With_Immediate_Echo</A>; -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_229_13" HREF="terminal_interface-curses__ads.htm#ref_570_13">Create</A></span> (<span class="symbol"><A NAME="ref_229_21" HREF="terminal_interface-curses__ads.htm#ref_571_7">Number_Of_Lines</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_63_12">Line_Count</A>; -+ <span class="symbol"><A NAME="ref_230_21" HREF="terminal_interface-curses__ads.htm#ref_572_7">Number_Of_Columns</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_65_12">Column_Count</A>; -+ <span class="symbol"><A NAME="ref_231_21" HREF="terminal_interface-curses__ads.htm#ref_573_7">First_Line_Position</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_232_21" HREF="terminal_interface-curses__ads.htm#ref_574_7">First_Column_Position</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> -+ <b>is</b> -+ <b>function</b> <span class="symbol"><A NAME="ref_234_16">Newwin</A></span> (<span class="symbol"><A NAME="ref_234_24" HREF="terminal_interface-curses__adb.htm#ref_234_16">Number_Of_Lines</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <span class="symbol"><A NAME="ref_235_24" HREF="terminal_interface-curses__adb.htm#ref_234_16">Number_Of_Columns</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <span class="symbol"><A NAME="ref_236_24" HREF="terminal_interface-curses__adb.htm#ref_234_16">First_Line_Position</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <span class="symbol"><A NAME="ref_237_24" HREF="terminal_interface-curses__adb.htm#ref_234_16">First_Column_Position</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; - <b>pragma</b> Import (C, Newwin, "newwin"); - -- <FONT COLOR=red><A NAME="ref_240_7">W</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="symbol"><A NAME="ref_240_7">W</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; - <b>begin</b> -- <A HREF="terminal_interface-curses__adb.htm#ref_240_7">W</A> := <A HREF="terminal_interface-curses__adb.htm#ref_234_16">Newwin</A> (<A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_572_7">Number_Of_Lines</A>), -- <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_573_7">Number_Of_Columns</A>), -- <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_574_7">First_Line_Position</A>), -- <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_575_7">First_Column_Position</A>)); -+ <A HREF="terminal_interface-curses__adb.htm#ref_240_7">W</A> := <A HREF="terminal_interface-curses__adb.htm#ref_234_16">Newwin</A> (<A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_571_7">Number_Of_Lines</A>), -+ <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_572_7">Number_Of_Columns</A>), -+ <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_573_7">First_Line_Position</A>), -+ <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_574_7">First_Column_Position</A>)); - <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_240_7">W</A> = <A HREF="terminal_interface-curses__ads.htm#ref_58_4">Null_Window</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; - <b>return</b> <A HREF="terminal_interface-curses__adb.htm#ref_240_7">W</A>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_571_13">Create</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_570_13">Create</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_252_14" HREF="terminal_interface-curses__ads.htm#ref_590_14">Delete</A></FONT> (<FONT COLOR=red><A NAME="ref_252_22" HREF="terminal_interface-curses__ads.htm#ref_590_22">Win</A></FONT> : <b>in</b> <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_252_14" HREF="terminal_interface-curses__ads.htm#ref_589_14">Delete</A></span> (<span class="symbol"><A NAME="ref_252_22" HREF="terminal_interface-curses__ads.htm#ref_589_22">Win</A></span> : <b>in</b> <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_254_16">Wdelwin</A></FONT> (<FONT COLOR=red><A NAME="ref_254_25" HREF="terminal_interface-curses__adb.htm#ref_254_16">W</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_254_16">Wdelwin</A></span> (<span class="symbol"><A NAME="ref_254_25" HREF="terminal_interface-curses__adb.htm#ref_254_16">W</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Wdelwin, "delwin"); - <b>begin</b> -- <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_254_16">Wdelwin</A> (<A HREF="terminal_interface-curses__ads.htm#ref_590_22">Win</A>) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_254_16">Wdelwin</A> (<A HREF="terminal_interface-curses__ads.htm#ref_589_22">Win</A>) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; -- <A HREF="terminal_interface-curses__ads.htm#ref_590_22">Win</A> := <A HREF="terminal_interface-curses__ads.htm#ref_58_4">Null_Window</A>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_590_14">Delete</A>; -+ <A HREF="terminal_interface-curses__ads.htm#ref_589_22">Win</A> := <A HREF="terminal_interface-curses__ads.htm#ref_58_4">Null_Window</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_589_14">Delete</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_263_13" HREF="terminal_interface-curses__ads.htm#ref_596_13">Sub_Window</A></FONT> -- (<FONT COLOR=red><A NAME="ref_264_7" HREF="terminal_interface-curses__ads.htm#ref_597_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_265_7" HREF="terminal_interface-curses__ads.htm#ref_598_7">Number_Of_Lines</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_63_12">Line_Count</A>; -- <FONT COLOR=red><A NAME="ref_266_7" HREF="terminal_interface-curses__ads.htm#ref_599_7">Number_Of_Columns</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_65_12">Column_Count</A>; -- <FONT COLOR=red><A NAME="ref_267_7" HREF="terminal_interface-curses__ads.htm#ref_600_7">First_Line_Position</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_268_7" HREF="terminal_interface-curses__ads.htm#ref_601_7">First_Column_Position</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> -- <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_270_16">Subwin</A></FONT> -- (<FONT COLOR=red><A NAME="ref_271_10" HREF="terminal_interface-curses__adb.htm#ref_270_16">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- <FONT COLOR=red><A NAME="ref_272_10" HREF="terminal_interface-curses__adb.htm#ref_270_16">Number_Of_Lines</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -- <FONT COLOR=red><A NAME="ref_273_10" HREF="terminal_interface-curses__adb.htm#ref_270_16">Number_Of_Columns</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -- <FONT COLOR=red><A NAME="ref_274_10" HREF="terminal_interface-curses__adb.htm#ref_270_16">First_Line_Position</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -- <FONT COLOR=red><A NAME="ref_275_10" HREF="terminal_interface-curses__adb.htm#ref_270_16">First_Column_Position</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_263_13" HREF="terminal_interface-curses__ads.htm#ref_595_13">Sub_Window</A></span> -+ (<span class="symbol"><A NAME="ref_264_7" HREF="terminal_interface-curses__ads.htm#ref_596_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_265_7" HREF="terminal_interface-curses__ads.htm#ref_597_7">Number_Of_Lines</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_63_12">Line_Count</A>; -+ <span class="symbol"><A NAME="ref_266_7" HREF="terminal_interface-curses__ads.htm#ref_598_7">Number_Of_Columns</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_65_12">Column_Count</A>; -+ <span class="symbol"><A NAME="ref_267_7" HREF="terminal_interface-curses__ads.htm#ref_599_7">First_Line_Position</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_268_7" HREF="terminal_interface-curses__ads.htm#ref_600_7">First_Column_Position</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> -+ <b>is</b> -+ <b>function</b> <span class="symbol"><A NAME="ref_270_16">Subwin</A></span> -+ (<span class="symbol"><A NAME="ref_271_10" HREF="terminal_interface-curses__adb.htm#ref_270_16">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="symbol"><A NAME="ref_272_10" HREF="terminal_interface-curses__adb.htm#ref_270_16">Number_Of_Lines</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <span class="symbol"><A NAME="ref_273_10" HREF="terminal_interface-curses__adb.htm#ref_270_16">Number_Of_Columns</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <span class="symbol"><A NAME="ref_274_10" HREF="terminal_interface-curses__adb.htm#ref_270_16">First_Line_Position</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <span class="symbol"><A NAME="ref_275_10" HREF="terminal_interface-curses__adb.htm#ref_270_16">First_Column_Position</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; - <b>pragma</b> Import (C, Subwin, "subwin"); - -- <FONT COLOR=red><A NAME="ref_278_7">W</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="symbol"><A NAME="ref_278_7">W</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; - <b>begin</b> -- <A HREF="terminal_interface-curses__adb.htm#ref_278_7">W</A> := <A HREF="terminal_interface-curses__adb.htm#ref_270_16">Subwin</A> (<A HREF="terminal_interface-curses__ads.htm#ref_597_7">Win</A>, -- <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_598_7">Number_Of_Lines</A>), -- <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_599_7">Number_Of_Columns</A>), -- <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_600_7">First_Line_Position</A>), -- <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_601_7">First_Column_Position</A>)); -+ <A HREF="terminal_interface-curses__adb.htm#ref_278_7">W</A> := <A HREF="terminal_interface-curses__adb.htm#ref_270_16">Subwin</A> (<A HREF="terminal_interface-curses__ads.htm#ref_596_7">Win</A>, -+ <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_597_7">Number_Of_Lines</A>), -+ <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_598_7">Number_Of_Columns</A>), -+ <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_599_7">First_Line_Position</A>), -+ <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_600_7">First_Column_Position</A>)); - <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_278_7">W</A> = <A HREF="terminal_interface-curses__ads.htm#ref_58_4">Null_Window</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; - <b>return</b> <A HREF="terminal_interface-curses__adb.htm#ref_278_7">W</A>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_596_13">Sub_Window</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_595_13">Sub_Window</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_291_13" HREF="terminal_interface-curses__ads.htm#ref_606_13">Derived_Window</A></FONT> -- (<FONT COLOR=red><A NAME="ref_292_7" HREF="terminal_interface-curses__ads.htm#ref_607_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_293_7" HREF="terminal_interface-curses__ads.htm#ref_608_7">Number_Of_Lines</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_63_12">Line_Count</A>; -- <FONT COLOR=red><A NAME="ref_294_7" HREF="terminal_interface-curses__ads.htm#ref_609_7">Number_Of_Columns</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_65_12">Column_Count</A>; -- <FONT COLOR=red><A NAME="ref_295_7" HREF="terminal_interface-curses__ads.htm#ref_610_7">First_Line_Position</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_296_7" HREF="terminal_interface-curses__ads.htm#ref_611_7">First_Column_Position</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> -- <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_298_16">Derwin</A></FONT> -- (<FONT COLOR=red><A NAME="ref_299_10" HREF="terminal_interface-curses__adb.htm#ref_298_16">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- <FONT COLOR=red><A NAME="ref_300_10" HREF="terminal_interface-curses__adb.htm#ref_298_16">Number_Of_Lines</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -- <FONT COLOR=red><A NAME="ref_301_10" HREF="terminal_interface-curses__adb.htm#ref_298_16">Number_Of_Columns</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -- <FONT COLOR=red><A NAME="ref_302_10" HREF="terminal_interface-curses__adb.htm#ref_298_16">First_Line_Position</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -- <FONT COLOR=red><A NAME="ref_303_10" HREF="terminal_interface-curses__adb.htm#ref_298_16">First_Column_Position</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_291_13" HREF="terminal_interface-curses__ads.htm#ref_605_13">Derived_Window</A></span> -+ (<span class="symbol"><A NAME="ref_292_7" HREF="terminal_interface-curses__ads.htm#ref_606_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_293_7" HREF="terminal_interface-curses__ads.htm#ref_607_7">Number_Of_Lines</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_63_12">Line_Count</A>; -+ <span class="symbol"><A NAME="ref_294_7" HREF="terminal_interface-curses__ads.htm#ref_608_7">Number_Of_Columns</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_65_12">Column_Count</A>; -+ <span class="symbol"><A NAME="ref_295_7" HREF="terminal_interface-curses__ads.htm#ref_609_7">First_Line_Position</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_296_7" HREF="terminal_interface-curses__ads.htm#ref_610_7">First_Column_Position</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> -+ <b>is</b> -+ <b>function</b> <span class="symbol"><A NAME="ref_298_16">Derwin</A></span> -+ (<span class="symbol"><A NAME="ref_299_10" HREF="terminal_interface-curses__adb.htm#ref_298_16">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="symbol"><A NAME="ref_300_10" HREF="terminal_interface-curses__adb.htm#ref_298_16">Number_Of_Lines</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <span class="symbol"><A NAME="ref_301_10" HREF="terminal_interface-curses__adb.htm#ref_298_16">Number_Of_Columns</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <span class="symbol"><A NAME="ref_302_10" HREF="terminal_interface-curses__adb.htm#ref_298_16">First_Line_Position</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <span class="symbol"><A NAME="ref_303_10" HREF="terminal_interface-curses__adb.htm#ref_298_16">First_Column_Position</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; - <b>pragma</b> Import (C, Derwin, "derwin"); - -- <FONT COLOR=red><A NAME="ref_306_7">W</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="symbol"><A NAME="ref_306_7">W</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; - <b>begin</b> -- <A HREF="terminal_interface-curses__adb.htm#ref_306_7">W</A> := <A HREF="terminal_interface-curses__adb.htm#ref_298_16">Derwin</A> (<A HREF="terminal_interface-curses__ads.htm#ref_607_7">Win</A>, -- <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_608_7">Number_Of_Lines</A>), -- <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_609_7">Number_Of_Columns</A>), -- <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_610_7">First_Line_Position</A>), -- <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_611_7">First_Column_Position</A>)); -+ <A HREF="terminal_interface-curses__adb.htm#ref_306_7">W</A> := <A HREF="terminal_interface-curses__adb.htm#ref_298_16">Derwin</A> (<A HREF="terminal_interface-curses__ads.htm#ref_606_7">Win</A>, -+ <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_607_7">Number_Of_Lines</A>), -+ <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_608_7">Number_Of_Columns</A>), -+ <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_609_7">First_Line_Position</A>), -+ <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_610_7">First_Column_Position</A>)); - <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_306_7">W</A> = <A HREF="terminal_interface-curses__ads.htm#ref_58_4">Null_Window</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; - <b>return</b> <A HREF="terminal_interface-curses__adb.htm#ref_306_7">W</A>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_606_13">Derived_Window</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_605_13">Derived_Window</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_319_13" HREF="terminal_interface-curses__ads.htm#ref_616_13">Duplicate</A></FONT> (<FONT COLOR=red><A NAME="ref_319_24" HREF="terminal_interface-curses__ads.htm#ref_616_24">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> -+ <b>function</b> <span class="symbol"><A NAME="ref_319_13" HREF="terminal_interface-curses__ads.htm#ref_615_13">Duplicate</A></span> (<span class="symbol"><A NAME="ref_319_24" HREF="terminal_interface-curses__ads.htm#ref_615_24">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_321_16">Dupwin</A></FONT> (<FONT COLOR=red><A NAME="ref_321_24" HREF="terminal_interface-curses__adb.htm#ref_321_16">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_321_16">Dupwin</A></span> (<span class="symbol"><A NAME="ref_321_24" HREF="terminal_interface-curses__adb.htm#ref_321_16">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; - <b>pragma</b> Import (C, Dupwin, "dupwin"); - -- <FONT COLOR=red><A NAME="ref_324_7">W</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__adb.htm#ref_321_16">Dupwin</A> (<A HREF="terminal_interface-curses__ads.htm#ref_616_24">Win</A>); -+ <span class="symbol"><A NAME="ref_324_7">W</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__adb.htm#ref_321_16">Dupwin</A> (<A HREF="terminal_interface-curses__ads.htm#ref_615_24">Win</A>); - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_324_7">W</A> = <A HREF="terminal_interface-curses__ads.htm#ref_58_4">Null_Window</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; - <b>return</b> <A HREF="terminal_interface-curses__adb.htm#ref_324_7">W</A>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_616_13">Duplicate</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_615_13">Duplicate</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_332_14" HREF="terminal_interface-curses__ads.htm#ref_621_14">Move_Window</A></FONT> (<FONT COLOR=red><A NAME="ref_332_27" HREF="terminal_interface-curses__ads.htm#ref_621_27">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- <FONT COLOR=red><A NAME="ref_333_27" HREF="terminal_interface-curses__ads.htm#ref_622_27">Line</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_334_27" HREF="terminal_interface-curses__ads.htm#ref_623_27">Column</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>) -- <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_336_16">Mvwin</A></FONT> (<FONT COLOR=red><A NAME="ref_336_23" HREF="terminal_interface-curses__adb.htm#ref_336_16">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- <FONT COLOR=red><A NAME="ref_337_23" HREF="terminal_interface-curses__adb.htm#ref_336_16">Line</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -- <FONT COLOR=red><A NAME="ref_338_23" HREF="terminal_interface-curses__adb.htm#ref_336_16">Column</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>procedure</b> <span class="symbol"><A NAME="ref_332_14" HREF="terminal_interface-curses__ads.htm#ref_620_14">Move_Window</A></span> (<span class="symbol"><A NAME="ref_332_27" HREF="terminal_interface-curses__ads.htm#ref_620_27">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="symbol"><A NAME="ref_333_27" HREF="terminal_interface-curses__ads.htm#ref_621_27">Line</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_334_27" HREF="terminal_interface-curses__ads.htm#ref_622_27">Column</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>) -+ <b>is</b> -+ <b>function</b> <span class="symbol"><A NAME="ref_336_16">Mvwin</A></span> (<span class="symbol"><A NAME="ref_336_23" HREF="terminal_interface-curses__adb.htm#ref_336_16">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="symbol"><A NAME="ref_337_23" HREF="terminal_interface-curses__adb.htm#ref_336_16">Line</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <span class="symbol"><A NAME="ref_338_23" HREF="terminal_interface-curses__adb.htm#ref_336_16">Column</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Mvwin, "mvwin"); - <b>begin</b> -- <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_336_16">Mvwin</A> (<A HREF="terminal_interface-curses__ads.htm#ref_621_27">Win</A>, <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_622_27">Line</A>), <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_623_27">Column</A>)) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_336_16">Mvwin</A> (<A HREF="terminal_interface-curses__ads.htm#ref_620_27">Win</A>, <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_621_27">Line</A>), <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_622_27">Column</A>)) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_621_14">Move_Window</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_620_14">Move_Window</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_346_14" HREF="terminal_interface-curses__ads.htm#ref_628_14">Move_Derived_Window</A></FONT> (<FONT COLOR=red><A NAME="ref_346_35" HREF="terminal_interface-curses__ads.htm#ref_628_35">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- <FONT COLOR=red><A NAME="ref_347_35" HREF="terminal_interface-curses__ads.htm#ref_629_35">Line</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_348_35" HREF="terminal_interface-curses__ads.htm#ref_630_35">Column</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>) -- <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_350_16">Mvderwin</A></FONT> (<FONT COLOR=red><A NAME="ref_350_26" HREF="terminal_interface-curses__adb.htm#ref_350_16">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- <FONT COLOR=red><A NAME="ref_351_26" HREF="terminal_interface-curses__adb.htm#ref_350_16">Line</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -- <FONT COLOR=red><A NAME="ref_352_26" HREF="terminal_interface-curses__adb.htm#ref_350_16">Column</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>procedure</b> <span class="symbol"><A NAME="ref_346_14" HREF="terminal_interface-curses__ads.htm#ref_627_14">Move_Derived_Window</A></span> (<span class="symbol"><A NAME="ref_346_35" HREF="terminal_interface-curses__ads.htm#ref_627_35">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="symbol"><A NAME="ref_347_35" HREF="terminal_interface-curses__ads.htm#ref_628_35">Line</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_348_35" HREF="terminal_interface-curses__ads.htm#ref_629_35">Column</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>) -+ <b>is</b> -+ <b>function</b> <span class="symbol"><A NAME="ref_350_16">Mvderwin</A></span> (<span class="symbol"><A NAME="ref_350_26" HREF="terminal_interface-curses__adb.htm#ref_350_16">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="symbol"><A NAME="ref_351_26" HREF="terminal_interface-curses__adb.htm#ref_350_16">Line</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <span class="symbol"><A NAME="ref_352_26" HREF="terminal_interface-curses__adb.htm#ref_350_16">Column</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Mvderwin, "mvderwin"); - <b>begin</b> -- <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_350_16">Mvderwin</A> (<A HREF="terminal_interface-curses__ads.htm#ref_628_35">Win</A>, <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_629_35">Line</A>), <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_630_35">Column</A>)) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_350_16">Mvderwin</A> (<A HREF="terminal_interface-curses__ads.htm#ref_627_35">Win</A>, <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_628_35">Line</A>), <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_629_35">Column</A>)) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_628_14">Move_Derived_Window</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_627_14">Move_Derived_Window</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_360_14" HREF="terminal_interface-curses__ads.htm#ref_645_14">Set_Synch_Mode</A></FONT> (<FONT COLOR=red><A NAME="ref_360_30" HREF="terminal_interface-curses__ads.htm#ref_645_30">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_361_30" HREF="terminal_interface-curses__ads.htm#ref_646_30">Mode</A></FONT> : Boolean := False) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_360_14" HREF="terminal_interface-curses__ads.htm#ref_644_14">Set_Synch_Mode</A></span> (<span class="symbol"><A NAME="ref_360_30" HREF="terminal_interface-curses__ads.htm#ref_644_30">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_361_30" HREF="terminal_interface-curses__ads.htm#ref_645_30">Mode</A></span> : Boolean := False) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_363_16">Syncok</A></FONT> (<FONT COLOR=red><A NAME="ref_363_24" HREF="terminal_interface-curses__adb.htm#ref_363_16">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- <FONT COLOR=red><A NAME="ref_364_24" HREF="terminal_interface-curses__adb.htm#ref_363_16">Mode</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_1926_9">Curses_Bool</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_363_16">Syncok</A></span> (<span class="symbol"><A NAME="ref_363_24" HREF="terminal_interface-curses__adb.htm#ref_363_16">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="symbol"><A NAME="ref_364_24" HREF="terminal_interface-curses__adb.htm#ref_363_16">Mode</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_1925_9">Curses_Bool</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Syncok, "syncok"); - <b>begin</b> -- <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_363_16">Syncok</A> (<A HREF="terminal_interface-curses__ads.htm#ref_645_30">Win</A>, <A HREF="terminal_interface-curses__ads.htm#ref_1926_9">Curses_Bool</A> (Boolean'Pos (<A HREF="terminal_interface-curses__ads.htm#ref_646_30">Mode</A>))) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_363_16">Syncok</A> (<A HREF="terminal_interface-curses__ads.htm#ref_644_30">Win</A>, <A HREF="terminal_interface-curses__ads.htm#ref_1925_9">Curses_Bool</A> (Boolean'Pos (<A HREF="terminal_interface-curses__ads.htm#ref_645_30">Mode</A>))) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_645_14">Set_Synch_Mode</A>; --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_372_14" HREF="terminal_interface-curses__ads.htm#ref_655_14">Add</A></FONT> (<FONT COLOR=red><A NAME="ref_372_19" HREF="terminal_interface-curses__ads.htm#ref_655_19">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_373_19" HREF="terminal_interface-curses__ads.htm#ref_656_19">Str</A></FONT> : String; -- <FONT COLOR=red><A NAME="ref_374_19" HREF="terminal_interface-curses__ads.htm#ref_657_19">Len</A></FONT> : Integer := -1) -- <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_376_16">Waddnstr</A></FONT> (<FONT COLOR=red><A NAME="ref_376_26" HREF="terminal_interface-curses__adb.htm#ref_376_16">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- <FONT COLOR=red><A NAME="ref_377_26" HREF="terminal_interface-curses__adb.htm#ref_376_16">Str</A></FONT> : char_array; -- <FONT COLOR=red><A NAME="ref_378_26" HREF="terminal_interface-curses__adb.htm#ref_376_16">Len</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> := -1) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_644_14">Set_Synch_Mode</A>; -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_372_14" HREF="terminal_interface-curses__ads.htm#ref_654_14">Add</A></span> (<span class="symbol"><A NAME="ref_372_19" HREF="terminal_interface-curses__ads.htm#ref_654_19">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_373_19" HREF="terminal_interface-curses__ads.htm#ref_655_19">Str</A></span> : String; -+ <span class="symbol"><A NAME="ref_374_19" HREF="terminal_interface-curses__ads.htm#ref_656_19">Len</A></span> : Integer := -1) -+ <b>is</b> -+ <b>function</b> <span class="symbol"><A NAME="ref_376_16">Waddnstr</A></span> (<span class="symbol"><A NAME="ref_376_26" HREF="terminal_interface-curses__adb.htm#ref_376_16">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="symbol"><A NAME="ref_377_26" HREF="terminal_interface-curses__adb.htm#ref_376_16">Str</A></span> : char_array; -+ <span class="symbol"><A NAME="ref_378_26" HREF="terminal_interface-curses__adb.htm#ref_376_16">Len</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> := -1) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Waddnstr, "waddnstr"); - -- <FONT COLOR=red><A NAME="ref_381_7">Txt</A></FONT> : char_array (0 .. <A HREF="terminal_interface-curses__ads.htm#ref_656_19">Str</A>'Length); -- <FONT COLOR=red><A NAME="ref_382_7">Length</A></FONT> : size_t; -+ <span class="symbol"><A NAME="ref_381_7">Txt</A></span> : char_array (0 .. <A HREF="terminal_interface-curses__ads.htm#ref_655_19">Str</A>'Length); -+ <span class="symbol"><A NAME="ref_382_7">Length</A></span> : size_t; - <b>begin</b> -- To_C (<A HREF="terminal_interface-curses__ads.htm#ref_656_19">Str</A>, <A HREF="terminal_interface-curses__adb.htm#ref_381_7">Txt</A>, <A HREF="terminal_interface-curses__adb.htm#ref_382_7">Length</A>); -- <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_376_16">Waddnstr</A> (<A HREF="terminal_interface-curses__ads.htm#ref_655_19">Win</A>, <A HREF="terminal_interface-curses__adb.htm#ref_381_7">Txt</A>, <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_657_19">Len</A>)) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -- <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_655_14">Add</A>; -- -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_390_14" HREF="terminal_interface-curses__ads.htm#ref_664_14">Add</A></FONT> -- (<FONT COLOR=red><A NAME="ref_391_7" HREF="terminal_interface-curses__ads.htm#ref_664_19">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_392_7" HREF="terminal_interface-curses__ads.htm#ref_665_19">Line</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_393_7" HREF="terminal_interface-curses__ads.htm#ref_666_19">Column</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -- <FONT COLOR=red><A NAME="ref_394_7" HREF="terminal_interface-curses__ads.htm#ref_667_19">Str</A></FONT> : String; -- <FONT COLOR=red><A NAME="ref_395_7" HREF="terminal_interface-curses__ads.htm#ref_668_19">Len</A></FONT> : Integer := -1) -- <b>is</b> -- <b>begin</b> -- <A HREF="terminal_interface-curses__ads.htm#ref_513_14">Move_Cursor</A> (<A HREF="terminal_interface-curses__ads.htm#ref_664_19">Win</A>, <A HREF="terminal_interface-curses__ads.htm#ref_665_19">Line</A>, <A HREF="terminal_interface-curses__ads.htm#ref_666_19">Column</A>); -- <A HREF="terminal_interface-curses__ads.htm#ref_655_14">Add</A> (<A HREF="terminal_interface-curses__ads.htm#ref_664_19">Win</A>, <A HREF="terminal_interface-curses__ads.htm#ref_667_19">Str</A>, <A HREF="terminal_interface-curses__ads.htm#ref_668_19">Len</A>); -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_664_14">Add</A>; --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_402_14" HREF="terminal_interface-curses__ads.htm#ref_679_14">Add</A></FONT> -- (<FONT COLOR=red><A NAME="ref_403_7" HREF="terminal_interface-curses__ads.htm#ref_679_19">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_404_7" HREF="terminal_interface-curses__ads.htm#ref_680_19">Str</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_373_4">Attributed_String</A>; -- <FONT COLOR=red><A NAME="ref_405_7" HREF="terminal_interface-curses__ads.htm#ref_681_19">Len</A></FONT> : Integer := -1) -- <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_407_16">Waddchnstr</A></FONT> (<FONT COLOR=red><A NAME="ref_407_28" HREF="terminal_interface-curses__adb.htm#ref_407_16">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- <FONT COLOR=red><A NAME="ref_408_28" HREF="terminal_interface-curses__adb.htm#ref_407_16">Str</A></FONT> : chtype_array; -- <FONT COLOR=red><A NAME="ref_409_28" HREF="terminal_interface-curses__adb.htm#ref_407_16">Len</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> := -1) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ To_C (<A HREF="terminal_interface-curses__ads.htm#ref_655_19">Str</A>, <A HREF="terminal_interface-curses__adb.htm#ref_381_7">Txt</A>, <A HREF="terminal_interface-curses__adb.htm#ref_382_7">Length</A>); -+ <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_376_16">Waddnstr</A> (<A HREF="terminal_interface-curses__ads.htm#ref_654_19">Win</A>, <A HREF="terminal_interface-curses__adb.htm#ref_381_7">Txt</A>, <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_656_19">Len</A>)) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; -+ <b>end</b> <b>if</b>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_654_14">Add</A>; -+ -+ <b>procedure</b> <span class="symbol"><A NAME="ref_390_14" HREF="terminal_interface-curses__ads.htm#ref_663_14">Add</A></span> -+ (<span class="symbol"><A NAME="ref_391_7" HREF="terminal_interface-curses__ads.htm#ref_663_19">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_392_7" HREF="terminal_interface-curses__ads.htm#ref_664_19">Line</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_393_7" HREF="terminal_interface-curses__ads.htm#ref_665_19">Column</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -+ <span class="symbol"><A NAME="ref_394_7" HREF="terminal_interface-curses__ads.htm#ref_666_19">Str</A></span> : String; -+ <span class="symbol"><A NAME="ref_395_7" HREF="terminal_interface-curses__ads.htm#ref_667_19">Len</A></span> : Integer := -1) -+ <b>is</b> -+ <b>begin</b> -+ <A HREF="terminal_interface-curses__ads.htm#ref_512_14">Move_Cursor</A> (<A HREF="terminal_interface-curses__ads.htm#ref_663_19">Win</A>, <A HREF="terminal_interface-curses__ads.htm#ref_664_19">Line</A>, <A HREF="terminal_interface-curses__ads.htm#ref_665_19">Column</A>); -+ <A HREF="terminal_interface-curses__ads.htm#ref_654_14">Add</A> (<A HREF="terminal_interface-curses__ads.htm#ref_663_19">Win</A>, <A HREF="terminal_interface-curses__ads.htm#ref_666_19">Str</A>, <A HREF="terminal_interface-curses__ads.htm#ref_667_19">Len</A>); -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_663_14">Add</A>; -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_402_14" HREF="terminal_interface-curses__ads.htm#ref_678_14">Add</A></span> -+ (<span class="symbol"><A NAME="ref_403_7" HREF="terminal_interface-curses__ads.htm#ref_678_19">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_404_7" HREF="terminal_interface-curses__ads.htm#ref_679_19">Str</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_372_4">Attributed_String</A>; -+ <span class="symbol"><A NAME="ref_405_7" HREF="terminal_interface-curses__ads.htm#ref_680_19">Len</A></span> : Integer := -1) -+ <b>is</b> -+ <b>function</b> <span class="symbol"><A NAME="ref_407_16">Waddchnstr</A></span> (<span class="symbol"><A NAME="ref_407_28" HREF="terminal_interface-curses__adb.htm#ref_407_16">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="symbol"><A NAME="ref_408_28" HREF="terminal_interface-curses__adb.htm#ref_407_16">Str</A></span> : chtype_array; -+ <span class="symbol"><A NAME="ref_409_28" HREF="terminal_interface-curses__adb.htm#ref_407_16">Len</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> := -1) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Waddchnstr, "waddchnstr"); - -- <FONT COLOR=red><A NAME="ref_412_7">Txt</A></FONT> : chtype_array (0 .. <A HREF="terminal_interface-curses__ads.htm#ref_680_19">Str</A>'Length); -+ <span class="symbol"><A NAME="ref_412_7">Txt</A></span> : chtype_array (0 .. <A HREF="terminal_interface-curses__ads.htm#ref_679_19">Str</A>'Length); - <b>begin</b> -- <b>for</b> <FONT COLOR=red><A NAME="ref_414_11">Length</A></FONT> <b>in</b> 1 .. size_t (<A HREF="terminal_interface-curses__ads.htm#ref_680_19">Str</A>'Length) <b>loop</b> -- <A HREF="terminal_interface-curses__adb.htm#ref_412_7">Txt</A> (<A HREF="terminal_interface-curses__adb.htm#ref_414_11">Length</A> - 1) := <A HREF="terminal_interface-curses__ads.htm#ref_680_19">Str</A> (Natural (<A HREF="terminal_interface-curses__adb.htm#ref_414_11">Length</A>)); -+ <b>for</b> <span class="symbol"><A NAME="ref_414_11">Length</A></span> <b>in</b> 1 .. size_t (<A HREF="terminal_interface-curses__ads.htm#ref_679_19">Str</A>'Length) <b>loop</b> -+ <A HREF="terminal_interface-curses__adb.htm#ref_412_7">Txt</A> (<A HREF="terminal_interface-curses__adb.htm#ref_414_11">Length</A> - 1) := <A HREF="terminal_interface-curses__ads.htm#ref_679_19">Str</A> (Natural (<A HREF="terminal_interface-curses__adb.htm#ref_414_11">Length</A>)); - <b>end</b> <b>loop</b>; -- <A HREF="terminal_interface-curses__adb.htm#ref_412_7">Txt</A> (<A HREF="terminal_interface-curses__ads.htm#ref_680_19">Str</A>'Length) := <A HREF="terminal_interface-curses__ads.htm#ref_373_4">Default_Character</A>; -- <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_407_16">Waddchnstr</A> (<A HREF="terminal_interface-curses__ads.htm#ref_679_19">Win</A>, -+ <A HREF="terminal_interface-curses__adb.htm#ref_412_7">Txt</A> (<A HREF="terminal_interface-curses__ads.htm#ref_679_19">Str</A>'Length) := <A HREF="terminal_interface-curses__ads.htm#ref_372_4">Default_Character</A>; -+ <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_407_16">Waddchnstr</A> (<A HREF="terminal_interface-curses__ads.htm#ref_678_19">Win</A>, - <A HREF="terminal_interface-curses__adb.htm#ref_412_7">Txt</A>, -- <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_681_19">Len</A>)) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_680_19">Len</A>)) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_679_14">Add</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_678_14">Add</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_425_14" HREF="terminal_interface-curses__ads.htm#ref_688_14">Add</A></FONT> -- (<FONT COLOR=red><A NAME="ref_426_7" HREF="terminal_interface-curses__ads.htm#ref_688_19">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_427_7" HREF="terminal_interface-curses__ads.htm#ref_689_19">Line</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_428_7" HREF="terminal_interface-curses__ads.htm#ref_690_19">Column</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -- <FONT COLOR=red><A NAME="ref_429_7" HREF="terminal_interface-curses__ads.htm#ref_691_19">Str</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_373_4">Attributed_String</A>; -- <FONT COLOR=red><A NAME="ref_430_7" HREF="terminal_interface-curses__ads.htm#ref_692_19">Len</A></FONT> : Integer := -1) -- <b>is</b> -- <b>begin</b> -- <A HREF="terminal_interface-curses__ads.htm#ref_513_14">Move_Cursor</A> (<A HREF="terminal_interface-curses__ads.htm#ref_688_19">Win</A>, <A HREF="terminal_interface-curses__ads.htm#ref_689_19">Line</A>, <A HREF="terminal_interface-curses__ads.htm#ref_690_19">Column</A>); -- <A HREF="terminal_interface-curses__ads.htm#ref_679_14">Add</A> (<A HREF="terminal_interface-curses__ads.htm#ref_688_19">Win</A>, <A HREF="terminal_interface-curses__ads.htm#ref_691_19">Str</A>, <A HREF="terminal_interface-curses__ads.htm#ref_692_19">Len</A>); -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_688_14">Add</A>; --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_437_14" HREF="terminal_interface-curses__ads.htm#ref_706_14">Border</A></FONT> -- (<FONT COLOR=red><A NAME="ref_438_7" HREF="terminal_interface-curses__ads.htm#ref_707_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_439_7" HREF="terminal_interface-curses__ads.htm#ref_708_7">Left_Side_Symbol</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_354_9">Attributed_Character</A> := <A HREF="terminal_interface-curses__ads.htm#ref_373_4">Default_Character</A>; -- <FONT COLOR=red><A NAME="ref_440_7" HREF="terminal_interface-curses__ads.htm#ref_709_7">Right_Side_Symbol</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_354_9">Attributed_Character</A> := <A HREF="terminal_interface-curses__ads.htm#ref_373_4">Default_Character</A>; -- <FONT COLOR=red><A NAME="ref_441_7" HREF="terminal_interface-curses__ads.htm#ref_710_7">Top_Side_Symbol</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_354_9">Attributed_Character</A> := <A HREF="terminal_interface-curses__ads.htm#ref_373_4">Default_Character</A>; -- <FONT COLOR=red><A NAME="ref_442_7" HREF="terminal_interface-curses__ads.htm#ref_711_7">Bottom_Side_Symbol</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_354_9">Attributed_Character</A> := <A HREF="terminal_interface-curses__ads.htm#ref_373_4">Default_Character</A>; -- <FONT COLOR=red><A NAME="ref_443_7" HREF="terminal_interface-curses__ads.htm#ref_712_7">Upper_Left_Corner_Symbol</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_354_9">Attributed_Character</A> := <A HREF="terminal_interface-curses__ads.htm#ref_373_4">Default_Character</A>; -- <FONT COLOR=red><A NAME="ref_444_7" HREF="terminal_interface-curses__ads.htm#ref_713_7">Upper_Right_Corner_Symbol</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_354_9">Attributed_Character</A> := <A HREF="terminal_interface-curses__ads.htm#ref_373_4">Default_Character</A>; -- <FONT COLOR=red><A NAME="ref_445_7" HREF="terminal_interface-curses__ads.htm#ref_714_7">Lower_Left_Corner_Symbol</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_354_9">Attributed_Character</A> := <A HREF="terminal_interface-curses__ads.htm#ref_373_4">Default_Character</A>; -- <FONT COLOR=red><A NAME="ref_446_7" HREF="terminal_interface-curses__ads.htm#ref_715_7">Lower_Right_Corner_Symbol</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_354_9">Attributed_Character</A> := <A HREF="terminal_interface-curses__ads.htm#ref_373_4">Default_Character</A>) -- <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_448_16">Wborder</A></FONT> (<FONT COLOR=red><A NAME="ref_448_25" HREF="terminal_interface-curses__adb.htm#ref_448_16">W</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- <FONT COLOR=red><A NAME="ref_449_25" HREF="terminal_interface-curses__adb.htm#ref_448_16">LS</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_12">C_Chtype</A>; -- <FONT COLOR=red><A NAME="ref_450_25" HREF="terminal_interface-curses__adb.htm#ref_448_16">RS</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_12">C_Chtype</A>; -- <FONT COLOR=red><A NAME="ref_451_25" HREF="terminal_interface-curses__adb.htm#ref_448_16">TS</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_12">C_Chtype</A>; -- <FONT COLOR=red><A NAME="ref_452_25" HREF="terminal_interface-curses__adb.htm#ref_448_16">BS</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_12">C_Chtype</A>; -- <FONT COLOR=red><A NAME="ref_453_25" HREF="terminal_interface-curses__adb.htm#ref_448_16">ULC</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_12">C_Chtype</A>; -- <FONT COLOR=red><A NAME="ref_454_25" HREF="terminal_interface-curses__adb.htm#ref_448_16">URC</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_12">C_Chtype</A>; -- <FONT COLOR=red><A NAME="ref_455_25" HREF="terminal_interface-curses__adb.htm#ref_448_16">LLC</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_12">C_Chtype</A>; -- <FONT COLOR=red><A NAME="ref_456_25" HREF="terminal_interface-curses__adb.htm#ref_448_16">LRC</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_12">C_Chtype</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>procedure</b> <span class="symbol"><A NAME="ref_425_14" HREF="terminal_interface-curses__ads.htm#ref_687_14">Add</A></span> -+ (<span class="symbol"><A NAME="ref_426_7" HREF="terminal_interface-curses__ads.htm#ref_687_19">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_427_7" HREF="terminal_interface-curses__ads.htm#ref_688_19">Line</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_428_7" HREF="terminal_interface-curses__ads.htm#ref_689_19">Column</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -+ <span class="symbol"><A NAME="ref_429_7" HREF="terminal_interface-curses__ads.htm#ref_690_19">Str</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_372_4">Attributed_String</A>; -+ <span class="symbol"><A NAME="ref_430_7" HREF="terminal_interface-curses__ads.htm#ref_691_19">Len</A></span> : Integer := -1) -+ <b>is</b> -+ <b>begin</b> -+ <A HREF="terminal_interface-curses__ads.htm#ref_512_14">Move_Cursor</A> (<A HREF="terminal_interface-curses__ads.htm#ref_687_19">Win</A>, <A HREF="terminal_interface-curses__ads.htm#ref_688_19">Line</A>, <A HREF="terminal_interface-curses__ads.htm#ref_689_19">Column</A>); -+ <A HREF="terminal_interface-curses__ads.htm#ref_678_14">Add</A> (<A HREF="terminal_interface-curses__ads.htm#ref_687_19">Win</A>, <A HREF="terminal_interface-curses__ads.htm#ref_690_19">Str</A>, <A HREF="terminal_interface-curses__ads.htm#ref_691_19">Len</A>); -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_687_14">Add</A>; -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_437_14" HREF="terminal_interface-curses__ads.htm#ref_705_14">Border</A></span> -+ (<span class="symbol"><A NAME="ref_438_7" HREF="terminal_interface-curses__ads.htm#ref_706_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_439_7" HREF="terminal_interface-curses__ads.htm#ref_707_7">Left_Side_Symbol</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_353_9">Attributed_Character</A> := <A HREF="terminal_interface-curses__ads.htm#ref_372_4">Default_Character</A>; -+ <span class="symbol"><A NAME="ref_440_7" HREF="terminal_interface-curses__ads.htm#ref_708_7">Right_Side_Symbol</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_353_9">Attributed_Character</A> := <A HREF="terminal_interface-curses__ads.htm#ref_372_4">Default_Character</A>; -+ <span class="symbol"><A NAME="ref_441_7" HREF="terminal_interface-curses__ads.htm#ref_709_7">Top_Side_Symbol</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_353_9">Attributed_Character</A> := <A HREF="terminal_interface-curses__ads.htm#ref_372_4">Default_Character</A>; -+ <span class="symbol"><A NAME="ref_442_7" HREF="terminal_interface-curses__ads.htm#ref_710_7">Bottom_Side_Symbol</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_353_9">Attributed_Character</A> := <A HREF="terminal_interface-curses__ads.htm#ref_372_4">Default_Character</A>; -+ <span class="symbol"><A NAME="ref_443_7" HREF="terminal_interface-curses__ads.htm#ref_711_7">Upper_Left_Corner_Symbol</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_353_9">Attributed_Character</A> := <A HREF="terminal_interface-curses__ads.htm#ref_372_4">Default_Character</A>; -+ <span class="symbol"><A NAME="ref_444_7" HREF="terminal_interface-curses__ads.htm#ref_712_7">Upper_Right_Corner_Symbol</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_353_9">Attributed_Character</A> := <A HREF="terminal_interface-curses__ads.htm#ref_372_4">Default_Character</A>; -+ <span class="symbol"><A NAME="ref_445_7" HREF="terminal_interface-curses__ads.htm#ref_713_7">Lower_Left_Corner_Symbol</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_353_9">Attributed_Character</A> := <A HREF="terminal_interface-curses__ads.htm#ref_372_4">Default_Character</A>; -+ <span class="symbol"><A NAME="ref_446_7" HREF="terminal_interface-curses__ads.htm#ref_714_7">Lower_Right_Corner_Symbol</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_353_9">Attributed_Character</A> := <A HREF="terminal_interface-curses__ads.htm#ref_372_4">Default_Character</A>) -+ <b>is</b> -+ <b>function</b> <span class="symbol"><A NAME="ref_448_16">Wborder</A></span> (<span class="symbol"><A NAME="ref_448_25" HREF="terminal_interface-curses__adb.htm#ref_448_16">W</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="symbol"><A NAME="ref_449_25" HREF="terminal_interface-curses__adb.htm#ref_448_16">LS</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_12">C_Chtype</A>; -+ <span class="symbol"><A NAME="ref_450_25" HREF="terminal_interface-curses__adb.htm#ref_448_16">RS</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_12">C_Chtype</A>; -+ <span class="symbol"><A NAME="ref_451_25" HREF="terminal_interface-curses__adb.htm#ref_448_16">TS</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_12">C_Chtype</A>; -+ <span class="symbol"><A NAME="ref_452_25" HREF="terminal_interface-curses__adb.htm#ref_448_16">BS</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_12">C_Chtype</A>; -+ <span class="symbol"><A NAME="ref_453_25" HREF="terminal_interface-curses__adb.htm#ref_448_16">ULC</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_12">C_Chtype</A>; -+ <span class="symbol"><A NAME="ref_454_25" HREF="terminal_interface-curses__adb.htm#ref_448_16">URC</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_12">C_Chtype</A>; -+ <span class="symbol"><A NAME="ref_455_25" HREF="terminal_interface-curses__adb.htm#ref_448_16">LLC</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_12">C_Chtype</A>; -+ <span class="symbol"><A NAME="ref_456_25" HREF="terminal_interface-curses__adb.htm#ref_448_16">LRC</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_12">C_Chtype</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Wborder, "wborder"); - <b>begin</b> -- <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_448_16">Wborder</A> (<A HREF="terminal_interface-curses__ads.htm#ref_707_7">Win</A>, -- AttrChar_To_Chtype (<A HREF="terminal_interface-curses__ads.htm#ref_708_7">Left_Side_Symbol</A>), -- AttrChar_To_Chtype (<A HREF="terminal_interface-curses__ads.htm#ref_709_7">Right_Side_Symbol</A>), -- <A HREF="terminal_interface-curses-aux__ads.htm#ref_75_4">AttrChar_To_Chtype</A> (<A HREF="terminal_interface-curses__ads.htm#ref_710_7">Top_Side_Symbol</A>), -- <A HREF="terminal_interface-curses-aux__ads.htm#ref_75_4">AttrChar_To_Chtype</A> (<A HREF="terminal_interface-curses__ads.htm#ref_711_7">Bottom_Side_Symbol</A>), -- <A HREF="terminal_interface-curses-aux__ads.htm#ref_75_4">AttrChar_To_Chtype</A> (<A HREF="terminal_interface-curses__ads.htm#ref_712_7">Upper_Left_Corner_Symbol</A>), -- <A HREF="terminal_interface-curses-aux__ads.htm#ref_75_4">AttrChar_To_Chtype</A> (<A HREF="terminal_interface-curses__ads.htm#ref_713_7">Upper_Right_Corner_Symbol</A>), -- <A HREF="terminal_interface-curses-aux__ads.htm#ref_75_4">AttrChar_To_Chtype</A> (<A HREF="terminal_interface-curses__ads.htm#ref_714_7">Lower_Left_Corner_Symbol</A>), -- <A HREF="terminal_interface-curses-aux__ads.htm#ref_75_4">AttrChar_To_Chtype</A> (<A HREF="terminal_interface-curses__ads.htm#ref_715_7">Lower_Right_Corner_Symbol</A>) -+ <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_448_16">Wborder</A> (<A HREF="terminal_interface-curses__ads.htm#ref_706_7">Win</A>, -+ AttrChar_To_Chtype (<A HREF="terminal_interface-curses__ads.htm#ref_707_7">Left_Side_Symbol</A>), -+ AttrChar_To_Chtype (<A HREF="terminal_interface-curses__ads.htm#ref_708_7">Right_Side_Symbol</A>), -+ <A HREF="terminal_interface-curses-aux__ads.htm#ref_75_4">AttrChar_To_Chtype</A> (<A HREF="terminal_interface-curses__ads.htm#ref_709_7">Top_Side_Symbol</A>), -+ <A HREF="terminal_interface-curses-aux__ads.htm#ref_75_4">AttrChar_To_Chtype</A> (<A HREF="terminal_interface-curses__ads.htm#ref_710_7">Bottom_Side_Symbol</A>), -+ <A HREF="terminal_interface-curses-aux__ads.htm#ref_75_4">AttrChar_To_Chtype</A> (<A HREF="terminal_interface-curses__ads.htm#ref_711_7">Upper_Left_Corner_Symbol</A>), -+ <A HREF="terminal_interface-curses-aux__ads.htm#ref_75_4">AttrChar_To_Chtype</A> (<A HREF="terminal_interface-curses__ads.htm#ref_712_7">Upper_Right_Corner_Symbol</A>), -+ <A HREF="terminal_interface-curses-aux__ads.htm#ref_75_4">AttrChar_To_Chtype</A> (<A HREF="terminal_interface-curses__ads.htm#ref_713_7">Lower_Left_Corner_Symbol</A>), -+ <A HREF="terminal_interface-curses-aux__ads.htm#ref_75_4">AttrChar_To_Chtype</A> (<A HREF="terminal_interface-curses__ads.htm#ref_714_7">Lower_Right_Corner_Symbol</A>) - ) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> - <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_706_14">Border</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_705_14">Border</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_474_14" HREF="terminal_interface-curses__ads.htm#ref_722_14">Box</A></FONT> -- (<FONT COLOR=red><A NAME="ref_475_7" HREF="terminal_interface-curses__ads.htm#ref_723_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_476_7" HREF="terminal_interface-curses__ads.htm#ref_724_7">Vertical_Symbol</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_354_9">Attributed_Character</A> := <A HREF="terminal_interface-curses__ads.htm#ref_373_4">Default_Character</A>; -- <FONT COLOR=red><A NAME="ref_477_7" HREF="terminal_interface-curses__ads.htm#ref_725_7">Horizontal_Symbol</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_354_9">Attributed_Character</A> := <A HREF="terminal_interface-curses__ads.htm#ref_373_4">Default_Character</A>) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_474_14" HREF="terminal_interface-curses__ads.htm#ref_721_14">Box</A></span> -+ (<span class="symbol"><A NAME="ref_475_7" HREF="terminal_interface-curses__ads.htm#ref_722_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_476_7" HREF="terminal_interface-curses__ads.htm#ref_723_7">Vertical_Symbol</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_353_9">Attributed_Character</A> := <A HREF="terminal_interface-curses__ads.htm#ref_372_4">Default_Character</A>; -+ <span class="symbol"><A NAME="ref_477_7" HREF="terminal_interface-curses__ads.htm#ref_724_7">Horizontal_Symbol</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_353_9">Attributed_Character</A> := <A HREF="terminal_interface-curses__ads.htm#ref_372_4">Default_Character</A>) - <b>is</b> - <b>begin</b> -- <A HREF="terminal_interface-curses__ads.htm#ref_706_14">Border</A> (<A HREF="terminal_interface-curses__ads.htm#ref_723_7">Win</A>, -- <A HREF="terminal_interface-curses__ads.htm#ref_724_7">Vertical_Symbol</A>, <A HREF="terminal_interface-curses__ads.htm#ref_724_7">Vertical_Symbol</A>, -- <A HREF="terminal_interface-curses__ads.htm#ref_725_7">Horizontal_Symbol</A>, <A HREF="terminal_interface-curses__ads.htm#ref_725_7">Horizontal_Symbol</A>); -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_722_14">Box</A>; -+ <A HREF="terminal_interface-curses__ads.htm#ref_705_14">Border</A> (<A HREF="terminal_interface-curses__ads.htm#ref_722_7">Win</A>, -+ <A HREF="terminal_interface-curses__ads.htm#ref_723_7">Vertical_Symbol</A>, <A HREF="terminal_interface-curses__ads.htm#ref_723_7">Vertical_Symbol</A>, -+ <A HREF="terminal_interface-curses__ads.htm#ref_724_7">Horizontal_Symbol</A>, <A HREF="terminal_interface-curses__ads.htm#ref_724_7">Horizontal_Symbol</A>); -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_721_14">Box</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_485_14" HREF="terminal_interface-curses__ads.htm#ref_730_14">Horizontal_Line</A></FONT> -- (<FONT COLOR=red><A NAME="ref_486_7" HREF="terminal_interface-curses__ads.htm#ref_731_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_487_7" HREF="terminal_interface-curses__ads.htm#ref_732_7">Line_Size</A></FONT> : Natural; -- <FONT COLOR=red><A NAME="ref_488_7" HREF="terminal_interface-curses__ads.htm#ref_733_7">Line_Symbol</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_354_9">Attributed_Character</A> := <A HREF="terminal_interface-curses__ads.htm#ref_373_4">Default_Character</A>) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_485_14" HREF="terminal_interface-curses__ads.htm#ref_729_14">Horizontal_Line</A></span> -+ (<span class="symbol"><A NAME="ref_486_7" HREF="terminal_interface-curses__ads.htm#ref_730_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_487_7" HREF="terminal_interface-curses__ads.htm#ref_731_7">Line_Size</A></span> : Natural; -+ <span class="symbol"><A NAME="ref_488_7" HREF="terminal_interface-curses__ads.htm#ref_732_7">Line_Symbol</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_353_9">Attributed_Character</A> := <A HREF="terminal_interface-curses__ads.htm#ref_372_4">Default_Character</A>) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_490_16">Whline</A></FONT> (<FONT COLOR=red><A NAME="ref_490_24" HREF="terminal_interface-curses__adb.htm#ref_490_16">W</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- <FONT COLOR=red><A NAME="ref_491_24" HREF="terminal_interface-curses__adb.htm#ref_490_16">Ch</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_12">C_Chtype</A>; -- <FONT COLOR=red><A NAME="ref_492_24" HREF="terminal_interface-curses__adb.htm#ref_490_16">Len</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_490_16">Whline</A></span> (<span class="symbol"><A NAME="ref_490_24" HREF="terminal_interface-curses__adb.htm#ref_490_16">W</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="symbol"><A NAME="ref_491_24" HREF="terminal_interface-curses__adb.htm#ref_490_16">Ch</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_12">C_Chtype</A>; -+ <span class="symbol"><A NAME="ref_492_24" HREF="terminal_interface-curses__adb.htm#ref_490_16">Len</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Whline, "whline"); - <b>begin</b> -- <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_490_16">Whline</A> (<A HREF="terminal_interface-curses__ads.htm#ref_731_7">Win</A>, -- <A HREF="terminal_interface-curses-aux__ads.htm#ref_75_4">AttrChar_To_Chtype</A> (<A HREF="terminal_interface-curses__ads.htm#ref_733_7">Line_Symbol</A>), -- <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_732_7">Line_Size</A>)) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -- <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_730_14">Horizontal_Line</A>; -- -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_502_14" HREF="terminal_interface-curses__ads.htm#ref_739_14">Vertical_Line</A></FONT> -- (<FONT COLOR=red><A NAME="ref_503_7" HREF="terminal_interface-curses__ads.htm#ref_740_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_504_7" HREF="terminal_interface-curses__ads.htm#ref_741_7">Line_Size</A></FONT> : Natural; -- <FONT COLOR=red><A NAME="ref_505_7" HREF="terminal_interface-curses__ads.htm#ref_742_7">Line_Symbol</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_354_9">Attributed_Character</A> := <A HREF="terminal_interface-curses__ads.htm#ref_373_4">Default_Character</A>) -- <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_507_16">Wvline</A></FONT> (<FONT COLOR=red><A NAME="ref_507_24" HREF="terminal_interface-curses__adb.htm#ref_507_16">W</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- <FONT COLOR=red><A NAME="ref_508_24" HREF="terminal_interface-curses__adb.htm#ref_507_16">Ch</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_12">C_Chtype</A>; -- <FONT COLOR=red><A NAME="ref_509_24" HREF="terminal_interface-curses__adb.htm#ref_507_16">Len</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_490_16">Whline</A> (<A HREF="terminal_interface-curses__ads.htm#ref_730_7">Win</A>, -+ <A HREF="terminal_interface-curses-aux__ads.htm#ref_75_4">AttrChar_To_Chtype</A> (<A HREF="terminal_interface-curses__ads.htm#ref_732_7">Line_Symbol</A>), -+ <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_731_7">Line_Size</A>)) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; -+ <b>end</b> <b>if</b>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_729_14">Horizontal_Line</A>; -+ -+ <b>procedure</b> <span class="symbol"><A NAME="ref_502_14" HREF="terminal_interface-curses__ads.htm#ref_738_14">Vertical_Line</A></span> -+ (<span class="symbol"><A NAME="ref_503_7" HREF="terminal_interface-curses__ads.htm#ref_739_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_504_7" HREF="terminal_interface-curses__ads.htm#ref_740_7">Line_Size</A></span> : Natural; -+ <span class="symbol"><A NAME="ref_505_7" HREF="terminal_interface-curses__ads.htm#ref_741_7">Line_Symbol</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_353_9">Attributed_Character</A> := <A HREF="terminal_interface-curses__ads.htm#ref_372_4">Default_Character</A>) -+ <b>is</b> -+ <b>function</b> <span class="symbol"><A NAME="ref_507_16">Wvline</A></span> (<span class="symbol"><A NAME="ref_507_24" HREF="terminal_interface-curses__adb.htm#ref_507_16">W</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="symbol"><A NAME="ref_508_24" HREF="terminal_interface-curses__adb.htm#ref_507_16">Ch</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_12">C_Chtype</A>; -+ <span class="symbol"><A NAME="ref_509_24" HREF="terminal_interface-curses__adb.htm#ref_507_16">Len</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Wvline, "wvline"); - <b>begin</b> -- <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_507_16">Wvline</A> (<A HREF="terminal_interface-curses__ads.htm#ref_740_7">Win</A>, -- <A HREF="terminal_interface-curses-aux__ads.htm#ref_75_4">AttrChar_To_Chtype</A> (<A HREF="terminal_interface-curses__ads.htm#ref_742_7">Line_Symbol</A>), -- <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_741_7">Line_Size</A>)) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_507_16">Wvline</A> (<A HREF="terminal_interface-curses__ads.htm#ref_739_7">Win</A>, -+ <A HREF="terminal_interface-curses-aux__ads.htm#ref_75_4">AttrChar_To_Chtype</A> (<A HREF="terminal_interface-curses__ads.htm#ref_741_7">Line_Symbol</A>), -+ <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_740_7">Line_Size</A>)) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_739_14">Vertical_Line</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_738_14">Vertical_Line</A>; - --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_520_13" HREF="terminal_interface-curses__ads.htm#ref_753_13">Get_Keystroke</A></FONT> (<FONT COLOR=red><A NAME="ref_520_28" HREF="terminal_interface-curses__ads.htm#ref_753_28">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>) -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_520_13" HREF="terminal_interface-curses__ads.htm#ref_752_13">Get_Keystroke</A></span> (<span class="symbol"><A NAME="ref_520_28" HREF="terminal_interface-curses__ads.htm#ref_752_28">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>) - <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_73_12">Real_Key_Code</A> - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_523_16">Wgetch</A></FONT> (<FONT COLOR=red><A NAME="ref_523_24" HREF="terminal_interface-curses__adb.htm#ref_523_16">W</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_523_16">Wgetch</A></span> (<span class="symbol"><A NAME="ref_523_24" HREF="terminal_interface-curses__adb.htm#ref_523_16">W</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Wgetch, "wgetch"); - -- <FONT COLOR=red><A NAME="ref_526_7">C</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> := <A HREF="terminal_interface-curses__adb.htm#ref_523_16">Wgetch</A> (<A HREF="terminal_interface-curses__ads.htm#ref_753_28">Win</A>); -+ <span class="symbol"><A NAME="ref_526_7">C</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> := <A HREF="terminal_interface-curses__adb.htm#ref_523_16">Wgetch</A> (<A HREF="terminal_interface-curses__ads.htm#ref_752_28">Win</A>); - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_526_7">C</A> = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> - <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_88_4">Key_None</A>; - <b>else</b> - <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_73_12">Real_Key_Code</A> (<A HREF="terminal_interface-curses__adb.htm#ref_526_7">C</A>); - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_753_13">Get_Keystroke</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_752_13">Get_Keystroke</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_535_14" HREF="terminal_interface-curses__ads.htm#ref_764_14">Undo_Keystroke</A></FONT> (<FONT COLOR=red><A NAME="ref_535_30" HREF="terminal_interface-curses__ads.htm#ref_764_30">Key</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_73_12">Real_Key_Code</A>) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_535_14" HREF="terminal_interface-curses__ads.htm#ref_763_14">Undo_Keystroke</A></span> (<span class="symbol"><A NAME="ref_535_30" HREF="terminal_interface-curses__ads.htm#ref_763_30">Key</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_73_12">Real_Key_Code</A>) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_537_16">Ungetch</A></FONT> (<FONT COLOR=red><A NAME="ref_537_25" HREF="terminal_interface-curses__adb.htm#ref_537_16">Ch</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_537_16">Ungetch</A></span> (<span class="symbol"><A NAME="ref_537_25" HREF="terminal_interface-curses__adb.htm#ref_537_16">Ch</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Ungetch, "ungetch"); - <b>begin</b> -- <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_537_16">Ungetch</A> (<A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_764_30">Key</A>)) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_537_16">Ungetch</A> (<A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_763_30">Key</A>)) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_764_14">Undo_Keystroke</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_763_14">Undo_Keystroke</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_545_13" HREF="terminal_interface-curses__ads.htm#ref_769_13">Has_Key</A></FONT> (<FONT COLOR=red><A NAME="ref_545_22" HREF="terminal_interface-curses__ads.htm#ref_769_22">Key</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A>) <b>return</b> Boolean -+ <b>function</b> <span class="symbol"><A NAME="ref_545_13" HREF="terminal_interface-curses__ads.htm#ref_768_13">Has_Key</A></span> (<span class="symbol"><A NAME="ref_545_22" HREF="terminal_interface-curses__ads.htm#ref_768_22">Key</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A>) <b>return</b> Boolean - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_547_16">Haskey</A></FONT> (<FONT COLOR=red><A NAME="ref_547_24" HREF="terminal_interface-curses__adb.htm#ref_547_16">Key</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_547_16">Haskey</A></span> (<span class="symbol"><A NAME="ref_547_24" HREF="terminal_interface-curses__adb.htm#ref_547_16">Key</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Haskey, "has_key"); - <b>begin</b> -- <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_547_16">Haskey</A> (<A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_769_22">Key</A>)) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_75_4">Curses_False</A> <b>then</b> -+ <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_547_16">Haskey</A> (<A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_768_22">Key</A>)) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_75_4">Curses_False</A> <b>then</b> - <b>return</b> False; - <b>else</b> - <b>return</b> True; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_769_13">Has_Key</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_768_13">Has_Key</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_557_13" HREF="terminal_interface-curses__ads.htm#ref_776_13">Is_Function_Key</A></FONT> (<FONT COLOR=red><A NAME="ref_557_30" HREF="terminal_interface-curses__ads.htm#ref_776_30">Key</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A>) <b>return</b> Boolean -+ <b>function</b> <span class="symbol"><A NAME="ref_557_13" HREF="terminal_interface-curses__ads.htm#ref_775_13">Is_Function_Key</A></span> (<span class="symbol"><A NAME="ref_557_30" HREF="terminal_interface-curses__ads.htm#ref_775_30">Key</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A>) <b>return</b> Boolean - <b>is</b> -- <FONT COLOR=red><A NAME="ref_559_7">L</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> (Natural (<A HREF="terminal_interface-curses__ads.htm#ref_98_4">Key_F0</A>) + -- Natural (<A HREF="terminal_interface-curses__ads.htm#ref_780_12">Function_Key_Number</A>'Last)); -+ <span class="symbol"><A NAME="ref_559_7">L</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> (Natural (<A HREF="terminal_interface-curses__ads.htm#ref_98_4">Key_F0</A>) + -+ Natural (<A HREF="terminal_interface-curses__ads.htm#ref_779_12">Function_Key_Number</A>'Last)); - <b>begin</b> -- <b>if</b> (<A HREF="terminal_interface-curses__ads.htm#ref_776_30">Key</A> &gt;= <A HREF="terminal_interface-curses__ads.htm#ref_98_4">Key_F0</A>) <b>and</b> <b>then</b> (<A HREF="terminal_interface-curses__ads.htm#ref_776_30">Key</A> &lt;= <A HREF="terminal_interface-curses__adb.htm#ref_559_7">L</A>) <b>then</b> -+ <b>if</b> (<A HREF="terminal_interface-curses__ads.htm#ref_775_30">Key</A> &gt;= <A HREF="terminal_interface-curses__ads.htm#ref_98_4">Key_F0</A>) <b>and</b> <b>then</b> (<A HREF="terminal_interface-curses__ads.htm#ref_775_30">Key</A> &lt;= <A HREF="terminal_interface-curses__adb.htm#ref_559_7">L</A>) <b>then</b> - <b>return</b> True; - <b>else</b> - <b>return</b> False; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_776_13">Is_Function_Key</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_775_13">Is_Function_Key</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_569_13" HREF="terminal_interface-curses__ads.htm#ref_783_13">Function_Key</A></FONT> (<FONT COLOR=red><A NAME="ref_569_27" HREF="terminal_interface-curses__ads.htm#ref_783_27">Key</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_73_12">Real_Key_Code</A>) -- <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_780_12">Function_Key_Number</A> -+ <b>function</b> <span class="symbol"><A NAME="ref_569_13" HREF="terminal_interface-curses__ads.htm#ref_782_13">Function_Key</A></span> (<span class="symbol"><A NAME="ref_569_27" HREF="terminal_interface-curses__ads.htm#ref_782_27">Key</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_73_12">Real_Key_Code</A>) -+ <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_779_12">Function_Key_Number</A> - <b>is</b> - <b>begin</b> -- <b>if</b> <A HREF="terminal_interface-curses__ads.htm#ref_776_13">Is_Function_Key</A> (<A HREF="terminal_interface-curses__ads.htm#ref_783_27">Key</A>) <b>then</b> -- <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_780_12">Function_Key_Number</A> (<A HREF="terminal_interface-curses__ads.htm#ref_783_27">Key</A> - <A HREF="terminal_interface-curses__ads.htm#ref_98_4">Key_F0</A>); -+ <b>if</b> <A HREF="terminal_interface-curses__ads.htm#ref_775_13">Is_Function_Key</A> (<A HREF="terminal_interface-curses__ads.htm#ref_782_27">Key</A>) <b>then</b> -+ <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_779_12">Function_Key_Number</A> (<A HREF="terminal_interface-curses__ads.htm#ref_782_27">Key</A> - <A HREF="terminal_interface-curses__ads.htm#ref_98_4">Key_F0</A>); - <b>else</b> - <b>raise</b> Constraint_Error; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_783_13">Function_Key</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_782_13">Function_Key</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_580_13" HREF="terminal_interface-curses__ads.htm#ref_788_13">Function_Key_Code</A></FONT> (<FONT COLOR=red><A NAME="ref_580_32" HREF="terminal_interface-curses__ads.htm#ref_788_32">Key</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_780_12">Function_Key_Number</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_73_12">Real_Key_Code</A> -+ <b>function</b> <span class="symbol"><A NAME="ref_580_13" HREF="terminal_interface-curses__ads.htm#ref_787_13">Function_Key_Code</A></span> (<span class="symbol"><A NAME="ref_580_32" HREF="terminal_interface-curses__ads.htm#ref_787_32">Key</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_779_12">Function_Key_Number</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_73_12">Real_Key_Code</A> - <b>is</b> - <b>begin</b> -- <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_73_12">Real_Key_Code</A> (Natural (<A HREF="terminal_interface-curses__ads.htm#ref_98_4">Key_F0</A>) + Natural (<A HREF="terminal_interface-curses__ads.htm#ref_788_32">Key</A>)); -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_788_13">Function_Key_Code</A>; --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_586_14" HREF="terminal_interface-curses__ads.htm#ref_802_14">Standout</A></FONT> (<FONT COLOR=red><A NAME="ref_586_24" HREF="terminal_interface-curses__ads.htm#ref_802_24">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_587_24" HREF="terminal_interface-curses__ads.htm#ref_803_24">On</A></FONT> : Boolean := True) -+ <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_73_12">Real_Key_Code</A> (Natural (<A HREF="terminal_interface-curses__ads.htm#ref_98_4">Key_F0</A>) + Natural (<A HREF="terminal_interface-curses__ads.htm#ref_787_32">Key</A>)); -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_787_13">Function_Key_Code</A>; -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_586_14" HREF="terminal_interface-curses__ads.htm#ref_801_14">Standout</A></span> (<span class="symbol"><A NAME="ref_586_24" HREF="terminal_interface-curses__ads.htm#ref_801_24">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_587_24" HREF="terminal_interface-curses__ads.htm#ref_802_24">On</A></span> : Boolean := True) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_589_16">wstandout</A></FONT> (<FONT COLOR=red><A NAME="ref_589_27" HREF="terminal_interface-curses__adb.htm#ref_589_16">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_589_16">wstandout</A></span> (<span class="symbol"><A NAME="ref_589_27" HREF="terminal_interface-curses__adb.htm#ref_589_16">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, wstandout, "wstandout"); -- <b>function</b> <FONT COLOR=red><A NAME="ref_591_16">wstandend</A></FONT> (<FONT COLOR=red><A NAME="ref_591_27" HREF="terminal_interface-curses__adb.htm#ref_591_16">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_591_16">wstandend</A></span> (<span class="symbol"><A NAME="ref_591_27" HREF="terminal_interface-curses__adb.htm#ref_591_16">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, wstandend, "wstandend"); - -- <FONT COLOR=red><A NAME="ref_594_7">Err</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <span class="symbol"><A NAME="ref_594_7">Err</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>begin</b> -- <b>if</b> <A HREF="terminal_interface-curses__ads.htm#ref_803_24">On</A> <b>then</b> -- <A HREF="terminal_interface-curses__adb.htm#ref_594_7">Err</A> := <A HREF="terminal_interface-curses__adb.htm#ref_589_16">wstandout</A> (<A HREF="terminal_interface-curses__ads.htm#ref_802_24">Win</A>); -+ <b>if</b> <A HREF="terminal_interface-curses__ads.htm#ref_802_24">On</A> <b>then</b> -+ <A HREF="terminal_interface-curses__adb.htm#ref_594_7">Err</A> := <A HREF="terminal_interface-curses__adb.htm#ref_589_16">wstandout</A> (<A HREF="terminal_interface-curses__ads.htm#ref_801_24">Win</A>); - <b>else</b> -- <A HREF="terminal_interface-curses__adb.htm#ref_594_7">Err</A> := <A HREF="terminal_interface-curses__adb.htm#ref_591_16">wstandend</A> (<A HREF="terminal_interface-curses__ads.htm#ref_802_24">Win</A>); -+ <A HREF="terminal_interface-curses__adb.htm#ref_594_7">Err</A> := <A HREF="terminal_interface-curses__adb.htm#ref_591_16">wstandend</A> (<A HREF="terminal_interface-curses__ads.htm#ref_801_24">Win</A>); - <b>end</b> <b>if</b>; - <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_594_7">Err</A> = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_802_14">Standout</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_801_14">Standout</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_606_14" HREF="terminal_interface-curses__ads.htm#ref_808_14">Switch_Character_Attribute</A></FONT> -- (<FONT COLOR=red><A NAME="ref_607_7" HREF="terminal_interface-curses__ads.htm#ref_809_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_608_7" HREF="terminal_interface-curses__ads.htm#ref_810_7">Attr</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A> := <A HREF="terminal_interface-curses__ads.htm#ref_352_4">Normal_Video</A>; -- <FONT COLOR=red><A NAME="ref_609_7" HREF="terminal_interface-curses__ads.htm#ref_811_7">On</A></FONT> : Boolean := True) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_606_14" HREF="terminal_interface-curses__ads.htm#ref_807_14">Switch_Character_Attribute</A></span> -+ (<span class="symbol"><A NAME="ref_607_7" HREF="terminal_interface-curses__ads.htm#ref_808_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_608_7" HREF="terminal_interface-curses__ads.htm#ref_809_7">Attr</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A> := <A HREF="terminal_interface-curses__ads.htm#ref_351_4">Normal_Video</A>; -+ <span class="symbol"><A NAME="ref_609_7" HREF="terminal_interface-curses__ads.htm#ref_810_7">On</A></span> : Boolean := True) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_611_16">Wattron</A></FONT> (<FONT COLOR=red><A NAME="ref_611_25" HREF="terminal_interface-curses__adb.htm#ref_611_16">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- <FONT COLOR=red><A NAME="ref_612_25" HREF="terminal_interface-curses__adb.htm#ref_611_16">C_Attr</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_64_12">C_AttrType</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_611_16">Wattron</A></span> (<span class="symbol"><A NAME="ref_611_25" HREF="terminal_interface-curses__adb.htm#ref_611_16">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="symbol"><A NAME="ref_612_25" HREF="terminal_interface-curses__adb.htm#ref_611_16">C_Attr</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_64_12">C_AttrType</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Wattron, "wattr_on"); -- <b>function</b> <FONT COLOR=red><A NAME="ref_614_16">Wattroff</A></FONT> (<FONT COLOR=red><A NAME="ref_614_26" HREF="terminal_interface-curses__adb.htm#ref_614_16">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- <FONT COLOR=red><A NAME="ref_615_26" HREF="terminal_interface-curses__adb.htm#ref_614_16">C_Attr</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_64_12">C_AttrType</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_614_16">Wattroff</A></span> (<span class="symbol"><A NAME="ref_614_26" HREF="terminal_interface-curses__adb.htm#ref_614_16">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="symbol"><A NAME="ref_615_26" HREF="terminal_interface-curses__adb.htm#ref_614_16">C_Attr</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_64_12">C_AttrType</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Wattroff, "wattr_off"); -- <FONT COLOR=green><EM>-- In Ada we use the On Boolean to control whether or not we want to</EM></FONT> -- <FONT COLOR=green><EM>-- switch on or off the attributes in the set.</EM></FONT> -- <FONT COLOR=red><A NAME="ref_619_7">Err</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -- <FONT COLOR=red><A NAME="ref_620_7">AC</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_354_9">Attributed_Character</A> := (<A HREF="terminal_interface-curses__ads.htm#ref_358_10">Ch</A> =&gt; Character'First, -- <A HREF="terminal_interface-curses__ads.htm#ref_357_10">Color</A> =&gt; <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>'First, -- <A HREF="terminal_interface-curses__ads.htm#ref_356_10">Attr</A> =&gt; <A HREF="terminal_interface-curses__ads.htm#ref_810_7">Attr</A>); -+ <span class="comment"><EM>-- In Ada we use the On Boolean to control whether or not we want to</EM></span> -+ <span class="comment"><EM>-- switch on or off the attributes in the set.</EM></span> -+ <span class="symbol"><A NAME="ref_619_7">Err</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <span class="symbol"><A NAME="ref_620_7">AC</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_353_9">Attributed_Character</A> := (<A HREF="terminal_interface-curses__ads.htm#ref_357_10">Ch</A> =&gt; Character'First, -+ <A HREF="terminal_interface-curses__ads.htm#ref_356_10">Color</A> =&gt; <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>'First, -+ <A HREF="terminal_interface-curses__ads.htm#ref_355_10">Attr</A> =&gt; <A HREF="terminal_interface-curses__ads.htm#ref_809_7">Attr</A>); - <b>begin</b> -- <b>if</b> <A HREF="terminal_interface-curses__ads.htm#ref_811_7">On</A> <b>then</b> -- <A HREF="terminal_interface-curses__adb.htm#ref_619_7">Err</A> := <A HREF="terminal_interface-curses__adb.htm#ref_611_16">Wattron</A> (<A HREF="terminal_interface-curses__ads.htm#ref_809_7">Win</A>, AttrChar_To_AttrType (<A HREF="terminal_interface-curses__adb.htm#ref_620_7">AC</A>)); -+ <b>if</b> <A HREF="terminal_interface-curses__ads.htm#ref_810_7">On</A> <b>then</b> -+ <A HREF="terminal_interface-curses__adb.htm#ref_619_7">Err</A> := <A HREF="terminal_interface-curses__adb.htm#ref_611_16">Wattron</A> (<A HREF="terminal_interface-curses__ads.htm#ref_808_7">Win</A>, AttrChar_To_AttrType (<A HREF="terminal_interface-curses__adb.htm#ref_620_7">AC</A>)); - <b>else</b> -- <A HREF="terminal_interface-curses__adb.htm#ref_619_7">Err</A> := <A HREF="terminal_interface-curses__adb.htm#ref_614_16">Wattroff</A> (<A HREF="terminal_interface-curses__ads.htm#ref_809_7">Win</A>, AttrChar_To_AttrType (<A HREF="terminal_interface-curses__adb.htm#ref_620_7">AC</A>)); -+ <A HREF="terminal_interface-curses__adb.htm#ref_619_7">Err</A> := <A HREF="terminal_interface-curses__adb.htm#ref_614_16">Wattroff</A> (<A HREF="terminal_interface-curses__ads.htm#ref_808_7">Win</A>, AttrChar_To_AttrType (<A HREF="terminal_interface-curses__adb.htm#ref_620_7">AC</A>)); - <b>end</b> <b>if</b>; - <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_619_7">Err</A> = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_808_14">Switch_Character_Attribute</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_807_14">Switch_Character_Attribute</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_634_14" HREF="terminal_interface-curses__ads.htm#ref_819_14">Set_Character_Attributes</A></FONT> -- (<FONT COLOR=red><A NAME="ref_635_7" HREF="terminal_interface-curses__ads.htm#ref_820_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_636_7" HREF="terminal_interface-curses__ads.htm#ref_821_7">Attr</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A> := <A HREF="terminal_interface-curses__ads.htm#ref_352_4">Normal_Video</A>; -- <FONT COLOR=red><A NAME="ref_637_7" HREF="terminal_interface-curses__ads.htm#ref_822_7">Color</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A> := <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>'First) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_634_14" HREF="terminal_interface-curses__ads.htm#ref_818_14">Set_Character_Attributes</A></span> -+ (<span class="symbol"><A NAME="ref_635_7" HREF="terminal_interface-curses__ads.htm#ref_819_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_636_7" HREF="terminal_interface-curses__ads.htm#ref_820_7">Attr</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A> := <A HREF="terminal_interface-curses__ads.htm#ref_351_4">Normal_Video</A>; -+ <span class="symbol"><A NAME="ref_637_7" HREF="terminal_interface-curses__ads.htm#ref_821_7">Color</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A> := <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>'First) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_639_16">Wattrset</A></FONT> (<FONT COLOR=red><A NAME="ref_639_26" HREF="terminal_interface-curses__adb.htm#ref_639_16">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- <FONT COLOR=red><A NAME="ref_640_26" HREF="terminal_interface-curses__adb.htm#ref_639_16">C_Attr</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_64_12">C_AttrType</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -- <b>pragma</b> Import (C, Wattrset, "wattrset"); <FONT COLOR=green><EM>-- ??? wattr_set</EM></FONT> -+ <b>function</b> <span class="symbol"><A NAME="ref_639_16">Wattrset</A></span> (<span class="symbol"><A NAME="ref_639_26" HREF="terminal_interface-curses__adb.htm#ref_639_16">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="symbol"><A NAME="ref_640_26" HREF="terminal_interface-curses__adb.htm#ref_639_16">C_Attr</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_64_12">C_AttrType</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>pragma</b> Import (C, Wattrset, "wattrset"); <span class="comment"><EM>-- ??? wattr_set</EM></span> - <b>begin</b> -- <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_639_16">Wattrset</A> (<A HREF="terminal_interface-curses__ads.htm#ref_820_7">Win</A>, -- AttrChar_To_AttrType (<A HREF="terminal_interface-curses__ads.htm#ref_354_9">Attributed_Character</A>' -- (<A HREF="terminal_interface-curses__ads.htm#ref_358_10">Ch</A> =&gt; Character'First, -- <A HREF="terminal_interface-curses__ads.htm#ref_357_10">Color</A> =&gt; <A HREF="terminal_interface-curses__ads.htm#ref_822_7">Color</A>, -- <A HREF="terminal_interface-curses__ads.htm#ref_356_10">Attr</A> =&gt; <A HREF="terminal_interface-curses__ads.htm#ref_821_7">Attr</A>))) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_639_16">Wattrset</A> (<A HREF="terminal_interface-curses__ads.htm#ref_819_7">Win</A>, -+ AttrChar_To_AttrType (<A HREF="terminal_interface-curses__ads.htm#ref_353_9">Attributed_Character</A>' -+ (<A HREF="terminal_interface-curses__ads.htm#ref_357_10">Ch</A> =&gt; Character'First, -+ <A HREF="terminal_interface-curses__ads.htm#ref_356_10">Color</A> =&gt; <A HREF="terminal_interface-curses__ads.htm#ref_821_7">Color</A>, -+ <A HREF="terminal_interface-curses__ads.htm#ref_355_10">Attr</A> =&gt; <A HREF="terminal_interface-curses__ads.htm#ref_820_7">Attr</A>))) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_819_14">Set_Character_Attributes</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_818_14">Set_Character_Attributes</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_652_13" HREF="terminal_interface-curses__ads.htm#ref_828_13">Get_Character_Attribute</A></FONT> (<FONT COLOR=red><A NAME="ref_652_38" HREF="terminal_interface-curses__ads.htm#ref_829_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>) -+ <b>function</b> <span class="symbol"><A NAME="ref_652_13" HREF="terminal_interface-curses__ads.htm#ref_827_13">Get_Character_Attribute</A></span> (<span class="symbol"><A NAME="ref_652_38" HREF="terminal_interface-curses__ads.htm#ref_828_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>) - <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A> - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_655_16">Wattrget</A></FONT> (<FONT COLOR=red><A NAME="ref_655_26" HREF="terminal_interface-curses__adb.htm#ref_655_16">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- <FONT COLOR=red><A NAME="ref_656_26" HREF="terminal_interface-curses__adb.htm#ref_655_16">Atr</A></FONT> : <b>access</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_64_12">C_AttrType</A>; -- <FONT COLOR=red><A NAME="ref_657_26" HREF="terminal_interface-curses__adb.htm#ref_655_16">Col</A></FONT> : <b>access</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_56_12">C_Short</A>; -- <FONT COLOR=red><A NAME="ref_658_26" HREF="terminal_interface-curses__adb.htm#ref_655_16">Opt</A></FONT> : System.Address) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_655_16">Wattrget</A></span> (<span class="symbol"><A NAME="ref_655_26" HREF="terminal_interface-curses__adb.htm#ref_655_16">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="symbol"><A NAME="ref_656_26" HREF="terminal_interface-curses__adb.htm#ref_655_16">Atr</A></span> : <b>access</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_64_12">C_AttrType</A>; -+ <span class="symbol"><A NAME="ref_657_26" HREF="terminal_interface-curses__adb.htm#ref_655_16">Col</A></span> : <b>access</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_56_12">C_Short</A>; -+ <span class="symbol"><A NAME="ref_658_26" HREF="terminal_interface-curses__adb.htm#ref_655_16">Opt</A></span> : System.Address) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Wattrget, "wattr_get"); - -- <FONT COLOR=red><A NAME="ref_661_7">Attr</A></FONT> : <b>aliased</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_64_12">C_AttrType</A>; -- <FONT COLOR=red><A NAME="ref_662_7">Col</A></FONT> : <b>aliased</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_56_12">C_Short</A>; -- <FONT COLOR=red><A NAME="ref_663_7">Res</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> := <A HREF="terminal_interface-curses__adb.htm#ref_655_16">Wattrget</A> (<A HREF="terminal_interface-curses__ads.htm#ref_829_7">Win</A>, <A HREF="terminal_interface-curses__adb.htm#ref_661_7">Attr</A>'<b>Access</b>, <A HREF="terminal_interface-curses__adb.htm#ref_662_7">Col</A>'<b>Access</b>, -+ <span class="symbol"><A NAME="ref_661_7">Attr</A></span> : <b>aliased</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_64_12">C_AttrType</A>; -+ <span class="symbol"><A NAME="ref_662_7">Col</A></span> : <b>aliased</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_56_12">C_Short</A>; -+ <span class="symbol"><A NAME="ref_663_7">Res</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> := <A HREF="terminal_interface-curses__adb.htm#ref_655_16">Wattrget</A> (<A HREF="terminal_interface-curses__ads.htm#ref_828_7">Win</A>, <A HREF="terminal_interface-curses__adb.htm#ref_661_7">Attr</A>'<b>Access</b>, <A HREF="terminal_interface-curses__adb.htm#ref_662_7">Col</A>'<b>Access</b>, - System.Null_Address); -- <FONT COLOR=red><A NAME="ref_665_7">Ch</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_354_9">Attributed_Character</A>; -+ <span class="symbol"><A NAME="ref_665_7">Ch</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_353_9">Attributed_Character</A>; - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_663_7">Res</A> = <A HREF="terminal_interface-curses-aux__ads.htm#ref_71_4">Curses_Ok</A> <b>then</b> - <A HREF="terminal_interface-curses__adb.htm#ref_665_7">Ch</A> := AttrType_To_AttrChar (<A HREF="terminal_interface-curses__adb.htm#ref_661_7">Attr</A>); -- <b>return</b> <A HREF="terminal_interface-curses__adb.htm#ref_665_7">Ch</A>.<A HREF="terminal_interface-curses__ads.htm#ref_356_10">Attr</A>; -+ <b>return</b> <A HREF="terminal_interface-curses__adb.htm#ref_665_7">Ch</A>.<A HREF="terminal_interface-curses__ads.htm#ref_355_10">Attr</A>; - <b>else</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_828_13">Get_Character_Attribute</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_827_13">Get_Character_Attribute</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_675_13" HREF="terminal_interface-curses__ads.htm#ref_834_13">Get_Character_Attribute</A></FONT> (<FONT COLOR=red><A NAME="ref_675_38" HREF="terminal_interface-curses__ads.htm#ref_835_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>) -+ <b>function</b> <span class="symbol"><A NAME="ref_675_13" HREF="terminal_interface-curses__ads.htm#ref_833_13">Get_Character_Attribute</A></span> (<span class="symbol"><A NAME="ref_675_38" HREF="terminal_interface-curses__ads.htm#ref_834_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>) - <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A> - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_678_16">Wattrget</A></FONT> (<FONT COLOR=red><A NAME="ref_678_26" HREF="terminal_interface-curses__adb.htm#ref_678_16">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- <FONT COLOR=red><A NAME="ref_679_26" HREF="terminal_interface-curses__adb.htm#ref_678_16">Atr</A></FONT> : <b>access</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_64_12">C_AttrType</A>; -- <FONT COLOR=red><A NAME="ref_680_26" HREF="terminal_interface-curses__adb.htm#ref_678_16">Col</A></FONT> : <b>access</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_56_12">C_Short</A>; -- <FONT COLOR=red><A NAME="ref_681_26" HREF="terminal_interface-curses__adb.htm#ref_678_16">Opt</A></FONT> : System.Address) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_678_16">Wattrget</A></span> (<span class="symbol"><A NAME="ref_678_26" HREF="terminal_interface-curses__adb.htm#ref_678_16">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="symbol"><A NAME="ref_679_26" HREF="terminal_interface-curses__adb.htm#ref_678_16">Atr</A></span> : <b>access</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_64_12">C_AttrType</A>; -+ <span class="symbol"><A NAME="ref_680_26" HREF="terminal_interface-curses__adb.htm#ref_678_16">Col</A></span> : <b>access</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_56_12">C_Short</A>; -+ <span class="symbol"><A NAME="ref_681_26" HREF="terminal_interface-curses__adb.htm#ref_678_16">Opt</A></span> : System.Address) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Wattrget, "wattr_get"); - -- <FONT COLOR=red><A NAME="ref_684_7">Attr</A></FONT> : <b>aliased</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_64_12">C_AttrType</A>; -- <FONT COLOR=red><A NAME="ref_685_7">Col</A></FONT> : <b>aliased</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_56_12">C_Short</A>; -- <FONT COLOR=red><A NAME="ref_686_7">Res</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> := <A HREF="terminal_interface-curses__adb.htm#ref_678_16">Wattrget</A> (<A HREF="terminal_interface-curses__ads.htm#ref_835_7">Win</A>, <A HREF="terminal_interface-curses__adb.htm#ref_684_7">Attr</A>'<b>Access</b>, <A HREF="terminal_interface-curses__adb.htm#ref_685_7">Col</A>'<b>Access</b>, -+ <span class="symbol"><A NAME="ref_684_7">Attr</A></span> : <b>aliased</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_64_12">C_AttrType</A>; -+ <span class="symbol"><A NAME="ref_685_7">Col</A></span> : <b>aliased</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_56_12">C_Short</A>; -+ <span class="symbol"><A NAME="ref_686_7">Res</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> := <A HREF="terminal_interface-curses__adb.htm#ref_678_16">Wattrget</A> (<A HREF="terminal_interface-curses__ads.htm#ref_834_7">Win</A>, <A HREF="terminal_interface-curses__adb.htm#ref_684_7">Attr</A>'<b>Access</b>, <A HREF="terminal_interface-curses__adb.htm#ref_685_7">Col</A>'<b>Access</b>, - System.Null_Address); -- <FONT COLOR=red><A NAME="ref_688_7">Ch</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_354_9">Attributed_Character</A>; -+ <span class="symbol"><A NAME="ref_688_7">Ch</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_353_9">Attributed_Character</A>; - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_686_7">Res</A> = <A HREF="terminal_interface-curses-aux__ads.htm#ref_71_4">Curses_Ok</A> <b>then</b> - <A HREF="terminal_interface-curses__adb.htm#ref_688_7">Ch</A> := AttrType_To_AttrChar (<A HREF="terminal_interface-curses__adb.htm#ref_684_7">Attr</A>); -- <b>return</b> <A HREF="terminal_interface-curses__adb.htm#ref_688_7">Ch</A>.<A HREF="terminal_interface-curses__ads.htm#ref_357_10">Color</A>; -+ <b>return</b> <A HREF="terminal_interface-curses__adb.htm#ref_688_7">Ch</A>.<A HREF="terminal_interface-curses__ads.htm#ref_356_10">Color</A>; - <b>else</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_834_13">Get_Character_Attribute</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_833_13">Get_Character_Attribute</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_698_14" HREF="terminal_interface-curses__ads.htm#ref_840_14">Set_Color</A></FONT> (<FONT COLOR=red><A NAME="ref_698_25" HREF="terminal_interface-curses__ads.htm#ref_840_25">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_699_25" HREF="terminal_interface-curses__ads.htm#ref_841_25">Pair</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_698_14" HREF="terminal_interface-curses__ads.htm#ref_839_14">Set_Color</A></span> (<span class="symbol"><A NAME="ref_698_25" HREF="terminal_interface-curses__ads.htm#ref_839_25">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_699_25" HREF="terminal_interface-curses__ads.htm#ref_840_25">Pair</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_701_16">Wset_Color</A></FONT> (<FONT COLOR=red><A NAME="ref_701_28" HREF="terminal_interface-curses__adb.htm#ref_701_16">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- <FONT COLOR=red><A NAME="ref_702_28" HREF="terminal_interface-curses__adb.htm#ref_701_16">Color</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_56_12">C_Short</A>; -- <FONT COLOR=red><A NAME="ref_703_28" HREF="terminal_interface-curses__adb.htm#ref_701_16">Opts</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_62_12">C_Void_Ptr</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_701_16">Wset_Color</A></span> (<span class="symbol"><A NAME="ref_701_28" HREF="terminal_interface-curses__adb.htm#ref_701_16">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="symbol"><A NAME="ref_702_28" HREF="terminal_interface-curses__adb.htm#ref_701_16">Color</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_56_12">C_Short</A>; -+ <span class="symbol"><A NAME="ref_703_28" HREF="terminal_interface-curses__adb.htm#ref_701_16">Opts</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_62_12">C_Void_Ptr</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Wset_Color, "wcolor_set"); - <b>begin</b> -- <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_701_16">Wset_Color</A> (<A HREF="terminal_interface-curses__ads.htm#ref_840_25">Win</A>, -- <A HREF="terminal_interface-curses-aux__ads.htm#ref_56_12">C_Short</A> (<A HREF="terminal_interface-curses__ads.htm#ref_841_25">Pair</A>), -+ <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_701_16">Wset_Color</A> (<A HREF="terminal_interface-curses__ads.htm#ref_839_25">Win</A>, -+ <A HREF="terminal_interface-curses-aux__ads.htm#ref_56_12">C_Short</A> (<A HREF="terminal_interface-curses__ads.htm#ref_840_25">Pair</A>), - <A HREF="terminal_interface-curses-aux__ads.htm#ref_62_12">C_Void_Ptr</A> (System.Null_Address)) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_840_14">Set_Color</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_839_14">Set_Color</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_713_14" HREF="terminal_interface-curses__ads.htm#ref_847_14">Change_Attributes</A></FONT> -- (<FONT COLOR=red><A NAME="ref_714_7" HREF="terminal_interface-curses__ads.htm#ref_848_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_715_7" HREF="terminal_interface-curses__ads.htm#ref_849_7">Count</A></FONT> : Integer := -1; -- <FONT COLOR=red><A NAME="ref_716_7" HREF="terminal_interface-curses__ads.htm#ref_850_7">Attr</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A> := <A HREF="terminal_interface-curses__ads.htm#ref_352_4">Normal_Video</A>; -- <FONT COLOR=red><A NAME="ref_717_7" HREF="terminal_interface-curses__ads.htm#ref_851_7">Color</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A> := <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>'First) -- <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_719_16">Wchgat</A></FONT> (<FONT COLOR=red><A NAME="ref_719_24" HREF="terminal_interface-curses__adb.htm#ref_719_16">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- <FONT COLOR=red><A NAME="ref_720_24" HREF="terminal_interface-curses__adb.htm#ref_719_16">Cnt</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -- <FONT COLOR=red><A NAME="ref_721_24" HREF="terminal_interface-curses__adb.htm#ref_719_16">Attr</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_64_12">C_AttrType</A>; -- <FONT COLOR=red><A NAME="ref_722_24" HREF="terminal_interface-curses__adb.htm#ref_719_16">Color</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_56_12">C_Short</A>; -- <FONT COLOR=red><A NAME="ref_723_24" HREF="terminal_interface-curses__adb.htm#ref_719_16">Opts</A></FONT> : System.Address := System.Null_Address) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_713_14" HREF="terminal_interface-curses__ads.htm#ref_846_14">Change_Attributes</A></span> -+ (<span class="symbol"><A NAME="ref_714_7" HREF="terminal_interface-curses__ads.htm#ref_847_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_715_7" HREF="terminal_interface-curses__ads.htm#ref_848_7">Count</A></span> : Integer := -1; -+ <span class="symbol"><A NAME="ref_716_7" HREF="terminal_interface-curses__ads.htm#ref_849_7">Attr</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A> := <A HREF="terminal_interface-curses__ads.htm#ref_351_4">Normal_Video</A>; -+ <span class="symbol"><A NAME="ref_717_7" HREF="terminal_interface-curses__ads.htm#ref_850_7">Color</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A> := <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>'First) -+ <b>is</b> -+ <b>function</b> <span class="symbol"><A NAME="ref_719_16">Wchgat</A></span> (<span class="symbol"><A NAME="ref_719_24" HREF="terminal_interface-curses__adb.htm#ref_719_16">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="symbol"><A NAME="ref_720_24" HREF="terminal_interface-curses__adb.htm#ref_719_16">Cnt</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <span class="symbol"><A NAME="ref_721_24" HREF="terminal_interface-curses__adb.htm#ref_719_16">Attr</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_64_12">C_AttrType</A>; -+ <span class="symbol"><A NAME="ref_722_24" HREF="terminal_interface-curses__adb.htm#ref_719_16">Color</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_56_12">C_Short</A>; -+ <span class="symbol"><A NAME="ref_723_24" HREF="terminal_interface-curses__adb.htm#ref_719_16">Opts</A></span> : System.Address := System.Null_Address) - <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Wchgat, "wchgat"); - -- <FONT COLOR=red><A NAME="ref_727_7">Ch</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_354_9">Attributed_Character</A> := -- (<A HREF="terminal_interface-curses__ads.htm#ref_358_10">Ch</A> =&gt; Character'First, <A HREF="terminal_interface-curses__ads.htm#ref_357_10">Color</A> =&gt; <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>'First, <A HREF="terminal_interface-curses__ads.htm#ref_356_10">Attr</A> =&gt; <A HREF="terminal_interface-curses__ads.htm#ref_850_7">Attr</A>); -+ <span class="symbol"><A NAME="ref_727_7">Ch</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_353_9">Attributed_Character</A> := -+ (<A HREF="terminal_interface-curses__ads.htm#ref_357_10">Ch</A> =&gt; Character'First, <A HREF="terminal_interface-curses__ads.htm#ref_356_10">Color</A> =&gt; <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>'First, <A HREF="terminal_interface-curses__ads.htm#ref_355_10">Attr</A> =&gt; <A HREF="terminal_interface-curses__ads.htm#ref_849_7">Attr</A>); - <b>begin</b> -- <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_719_16">Wchgat</A> (<A HREF="terminal_interface-curses__ads.htm#ref_848_7">Win</A>, <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_849_7">Count</A>), AttrChar_To_AttrType (<A HREF="terminal_interface-curses__adb.htm#ref_727_7">Ch</A>), -- <A HREF="terminal_interface-curses-aux__ads.htm#ref_56_12">C_Short</A> (<A HREF="terminal_interface-curses__ads.htm#ref_851_7">Color</A>)) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -- <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_847_14">Change_Attributes</A>; -- -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_736_14" HREF="terminal_interface-curses__ads.htm#ref_856_14">Change_Attributes</A></FONT> -- (<FONT COLOR=red><A NAME="ref_737_7" HREF="terminal_interface-curses__ads.htm#ref_857_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_738_7" HREF="terminal_interface-curses__ads.htm#ref_858_7">Line</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A> := <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>'First; -- <FONT COLOR=red><A NAME="ref_739_7" HREF="terminal_interface-curses__ads.htm#ref_859_7">Column</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A> := <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>'First; -- <FONT COLOR=red><A NAME="ref_740_7" HREF="terminal_interface-curses__ads.htm#ref_860_7">Count</A></FONT> : Integer := -1; -- <FONT COLOR=red><A NAME="ref_741_7" HREF="terminal_interface-curses__ads.htm#ref_861_7">Attr</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A> := <A HREF="terminal_interface-curses__ads.htm#ref_352_4">Normal_Video</A>; -- <FONT COLOR=red><A NAME="ref_742_7" HREF="terminal_interface-curses__ads.htm#ref_862_7">Color</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A> := <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>'First) -- <b>is</b> -- <b>begin</b> -- <A HREF="terminal_interface-curses__ads.htm#ref_513_14">Move_Cursor</A> (<A HREF="terminal_interface-curses__ads.htm#ref_857_7">Win</A>, <A HREF="terminal_interface-curses__ads.htm#ref_858_7">Line</A>, <A HREF="terminal_interface-curses__ads.htm#ref_859_7">Column</A>); -- <A HREF="terminal_interface-curses__ads.htm#ref_847_14">Change_Attributes</A> (<A HREF="terminal_interface-curses__ads.htm#ref_857_7">Win</A>, <A HREF="terminal_interface-curses__ads.htm#ref_860_7">Count</A>, <A HREF="terminal_interface-curses__ads.htm#ref_861_7">Attr</A>, <A HREF="terminal_interface-curses__ads.htm#ref_862_7">Color</A>); -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_856_14">Change_Attributes</A>; --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_749_14" HREF="terminal_interface-curses__ads.htm#ref_872_14">Beep</A></FONT> -+ <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_719_16">Wchgat</A> (<A HREF="terminal_interface-curses__ads.htm#ref_847_7">Win</A>, <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_848_7">Count</A>), AttrChar_To_AttrType (<A HREF="terminal_interface-curses__adb.htm#ref_727_7">Ch</A>), -+ <A HREF="terminal_interface-curses-aux__ads.htm#ref_56_12">C_Short</A> (<A HREF="terminal_interface-curses__ads.htm#ref_850_7">Color</A>)) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; -+ <b>end</b> <b>if</b>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_846_14">Change_Attributes</A>; -+ -+ <b>procedure</b> <span class="symbol"><A NAME="ref_736_14" HREF="terminal_interface-curses__ads.htm#ref_855_14">Change_Attributes</A></span> -+ (<span class="symbol"><A NAME="ref_737_7" HREF="terminal_interface-curses__ads.htm#ref_856_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_738_7" HREF="terminal_interface-curses__ads.htm#ref_857_7">Line</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A> := <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>'First; -+ <span class="symbol"><A NAME="ref_739_7" HREF="terminal_interface-curses__ads.htm#ref_858_7">Column</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A> := <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>'First; -+ <span class="symbol"><A NAME="ref_740_7" HREF="terminal_interface-curses__ads.htm#ref_859_7">Count</A></span> : Integer := -1; -+ <span class="symbol"><A NAME="ref_741_7" HREF="terminal_interface-curses__ads.htm#ref_860_7">Attr</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A> := <A HREF="terminal_interface-curses__ads.htm#ref_351_4">Normal_Video</A>; -+ <span class="symbol"><A NAME="ref_742_7" HREF="terminal_interface-curses__ads.htm#ref_861_7">Color</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A> := <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>'First) -+ <b>is</b> -+ <b>begin</b> -+ <A HREF="terminal_interface-curses__ads.htm#ref_512_14">Move_Cursor</A> (<A HREF="terminal_interface-curses__ads.htm#ref_856_7">Win</A>, <A HREF="terminal_interface-curses__ads.htm#ref_857_7">Line</A>, <A HREF="terminal_interface-curses__ads.htm#ref_858_7">Column</A>); -+ <A HREF="terminal_interface-curses__ads.htm#ref_846_14">Change_Attributes</A> (<A HREF="terminal_interface-curses__ads.htm#ref_856_7">Win</A>, <A HREF="terminal_interface-curses__ads.htm#ref_859_7">Count</A>, <A HREF="terminal_interface-curses__ads.htm#ref_860_7">Attr</A>, <A HREF="terminal_interface-curses__ads.htm#ref_861_7">Color</A>); -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_855_14">Change_Attributes</A>; -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_749_14" HREF="terminal_interface-curses__ads.htm#ref_871_14">Beep</A></span> - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_751_16">Beeper</A></FONT> <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_751_16">Beeper</A></span> <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Beeper, "beep"); - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_751_16">Beeper</A> = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_872_14">Beep</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_871_14">Beep</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_759_14" HREF="terminal_interface-curses__ads.htm#ref_877_14">Flash_Screen</A></FONT> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_759_14" HREF="terminal_interface-curses__ads.htm#ref_876_14">Flash_Screen</A></span> - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_761_16">Flash</A></FONT> <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_761_16">Flash</A></span> <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Flash, "flash"); - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_761_16">Flash</A> = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_877_14">Flash_Screen</A>; --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_769_14" HREF="terminal_interface-curses__ads.htm#ref_888_14">Set_Cbreak_Mode</A></FONT> (<FONT COLOR=red><A NAME="ref_769_31" HREF="terminal_interface-curses__ads.htm#ref_888_31">SwitchOn</A></FONT> : Boolean := True) -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_876_14">Flash_Screen</A>; -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_769_14" HREF="terminal_interface-curses__ads.htm#ref_887_14">Set_Cbreak_Mode</A></span> (<span class="symbol"><A NAME="ref_769_31" HREF="terminal_interface-curses__ads.htm#ref_887_31">SwitchOn</A></span> : Boolean := True) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_771_16">Cbreak</A></FONT> <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_771_16">Cbreak</A></span> <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Cbreak, "cbreak"); -- <b>function</b> <FONT COLOR=red><A NAME="ref_773_16">NoCbreak</A></FONT> <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_773_16">NoCbreak</A></span> <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, NoCbreak, "nocbreak"); - -- <FONT COLOR=red><A NAME="ref_776_7">Err</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <span class="symbol"><A NAME="ref_776_7">Err</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>begin</b> -- <b>if</b> <A HREF="terminal_interface-curses__ads.htm#ref_888_31">SwitchOn</A> <b>then</b> -+ <b>if</b> <A HREF="terminal_interface-curses__ads.htm#ref_887_31">SwitchOn</A> <b>then</b> - <A HREF="terminal_interface-curses__adb.htm#ref_776_7">Err</A> := <A HREF="terminal_interface-curses__adb.htm#ref_771_16">Cbreak</A>; - <b>else</b> - <A HREF="terminal_interface-curses__adb.htm#ref_776_7">Err</A> := <A HREF="terminal_interface-curses__adb.htm#ref_773_16">NoCbreak</A>; - <b>end</b> <b>if</b>; - <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_776_7">Err</A> = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_888_14">Set_Cbreak_Mode</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_887_14">Set_Cbreak_Mode</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_788_14" HREF="terminal_interface-curses__ads.htm#ref_894_14">Set_Raw_Mode</A></FONT> (<FONT COLOR=red><A NAME="ref_788_28" HREF="terminal_interface-curses__ads.htm#ref_894_28">SwitchOn</A></FONT> : Boolean := True) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_788_14" HREF="terminal_interface-curses__ads.htm#ref_893_14">Set_Raw_Mode</A></span> (<span class="symbol"><A NAME="ref_788_28" HREF="terminal_interface-curses__ads.htm#ref_893_28">SwitchOn</A></span> : Boolean := True) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_790_16">Raw</A></FONT> <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_790_16">Raw</A></span> <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Raw, "raw"); -- <b>function</b> <FONT COLOR=red><A NAME="ref_792_16">NoRaw</A></FONT> <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_792_16">NoRaw</A></span> <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, NoRaw, "noraw"); - -- <FONT COLOR=red><A NAME="ref_795_7">Err</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <span class="symbol"><A NAME="ref_795_7">Err</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>begin</b> -- <b>if</b> <A HREF="terminal_interface-curses__ads.htm#ref_894_28">SwitchOn</A> <b>then</b> -+ <b>if</b> <A HREF="terminal_interface-curses__ads.htm#ref_893_28">SwitchOn</A> <b>then</b> - <A HREF="terminal_interface-curses__adb.htm#ref_795_7">Err</A> := <A HREF="terminal_interface-curses__adb.htm#ref_790_16">Raw</A>; - <b>else</b> - <A HREF="terminal_interface-curses__adb.htm#ref_795_7">Err</A> := <A HREF="terminal_interface-curses__adb.htm#ref_792_16">NoRaw</A>; - <b>end</b> <b>if</b>; - <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_795_7">Err</A> = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_894_14">Set_Raw_Mode</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_893_14">Set_Raw_Mode</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_807_14" HREF="terminal_interface-curses__ads.htm#ref_900_14">Set_Echo_Mode</A></FONT> (<FONT COLOR=red><A NAME="ref_807_29" HREF="terminal_interface-curses__ads.htm#ref_900_29">SwitchOn</A></FONT> : Boolean := True) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_807_14" HREF="terminal_interface-curses__ads.htm#ref_899_14">Set_Echo_Mode</A></span> (<span class="symbol"><A NAME="ref_807_29" HREF="terminal_interface-curses__ads.htm#ref_899_29">SwitchOn</A></span> : Boolean := True) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_809_16">Echo</A></FONT> <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_809_16">Echo</A></span> <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Echo, "echo"); -- <b>function</b> <FONT COLOR=red><A NAME="ref_811_16">NoEcho</A></FONT> <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_811_16">NoEcho</A></span> <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, NoEcho, "noecho"); - -- <FONT COLOR=red><A NAME="ref_814_7">Err</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <span class="symbol"><A NAME="ref_814_7">Err</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>begin</b> -- <b>if</b> <A HREF="terminal_interface-curses__ads.htm#ref_900_29">SwitchOn</A> <b>then</b> -+ <b>if</b> <A HREF="terminal_interface-curses__ads.htm#ref_899_29">SwitchOn</A> <b>then</b> - <A HREF="terminal_interface-curses__adb.htm#ref_814_7">Err</A> := <A HREF="terminal_interface-curses__adb.htm#ref_809_16">Echo</A>; - <b>else</b> - <A HREF="terminal_interface-curses__adb.htm#ref_814_7">Err</A> := <A HREF="terminal_interface-curses__adb.htm#ref_811_16">NoEcho</A>; - <b>end</b> <b>if</b>; - <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_814_7">Err</A> = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_900_14">Set_Echo_Mode</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_899_14">Set_Echo_Mode</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_826_14" HREF="terminal_interface-curses__ads.htm#ref_906_14">Set_Meta_Mode</A></FONT> (<FONT COLOR=red><A NAME="ref_826_29" HREF="terminal_interface-curses__ads.htm#ref_906_29">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_827_29" HREF="terminal_interface-curses__ads.htm#ref_907_29">SwitchOn</A></FONT> : Boolean := True) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_826_14" HREF="terminal_interface-curses__ads.htm#ref_905_14">Set_Meta_Mode</A></span> (<span class="symbol"><A NAME="ref_826_29" HREF="terminal_interface-curses__ads.htm#ref_905_29">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_827_29" HREF="terminal_interface-curses__ads.htm#ref_906_29">SwitchOn</A></span> : Boolean := True) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_829_16">Meta</A></FONT> (<FONT COLOR=red><A NAME="ref_829_22" HREF="terminal_interface-curses__adb.htm#ref_829_16">W</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; <FONT COLOR=red><A NAME="ref_829_34" HREF="terminal_interface-curses__adb.htm#ref_829_16">Mode</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_1926_9">Curses_Bool</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_829_16">Meta</A></span> (<span class="symbol"><A NAME="ref_829_22" HREF="terminal_interface-curses__adb.htm#ref_829_16">W</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; <span class="symbol"><A NAME="ref_829_34" HREF="terminal_interface-curses__adb.htm#ref_829_16">Mode</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_1925_9">Curses_Bool</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Meta, "meta"); - <b>begin</b> -- <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_829_16">Meta</A> (<A HREF="terminal_interface-curses__ads.htm#ref_906_29">Win</A>, <A HREF="terminal_interface-curses__ads.htm#ref_1926_9">Curses_Bool</A> (Boolean'Pos (<A HREF="terminal_interface-curses__ads.htm#ref_907_29">SwitchOn</A>))) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_829_16">Meta</A> (<A HREF="terminal_interface-curses__ads.htm#ref_905_29">Win</A>, <A HREF="terminal_interface-curses__ads.htm#ref_1925_9">Curses_Bool</A> (Boolean'Pos (<A HREF="terminal_interface-curses__ads.htm#ref_906_29">SwitchOn</A>))) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_906_14">Set_Meta_Mode</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_905_14">Set_Meta_Mode</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_837_14" HREF="terminal_interface-curses__ads.htm#ref_912_14">Set_KeyPad_Mode</A></FONT> (<FONT COLOR=red><A NAME="ref_837_31" HREF="terminal_interface-curses__ads.htm#ref_912_31">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_838_31" HREF="terminal_interface-curses__ads.htm#ref_913_31">SwitchOn</A></FONT> : Boolean := True) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_837_14" HREF="terminal_interface-curses__ads.htm#ref_911_14">Set_KeyPad_Mode</A></span> (<span class="symbol"><A NAME="ref_837_31" HREF="terminal_interface-curses__ads.htm#ref_911_31">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_838_31" HREF="terminal_interface-curses__ads.htm#ref_912_31">SwitchOn</A></span> : Boolean := True) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_840_16">Keypad</A></FONT> (<FONT COLOR=red><A NAME="ref_840_24" HREF="terminal_interface-curses__adb.htm#ref_840_16">W</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; <FONT COLOR=red><A NAME="ref_840_36" HREF="terminal_interface-curses__adb.htm#ref_840_16">Mode</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_1926_9">Curses_Bool</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_840_16">Keypad</A></span> (<span class="symbol"><A NAME="ref_840_24" HREF="terminal_interface-curses__adb.htm#ref_840_16">W</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; <span class="symbol"><A NAME="ref_840_36" HREF="terminal_interface-curses__adb.htm#ref_840_16">Mode</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_1925_9">Curses_Bool</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Keypad, "keypad"); - <b>begin</b> -- <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_840_16">Keypad</A> (<A HREF="terminal_interface-curses__ads.htm#ref_912_31">Win</A>, <A HREF="terminal_interface-curses__ads.htm#ref_1926_9">Curses_Bool</A> (Boolean'Pos (<A HREF="terminal_interface-curses__ads.htm#ref_913_31">SwitchOn</A>))) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_840_16">Keypad</A> (<A HREF="terminal_interface-curses__ads.htm#ref_911_31">Win</A>, <A HREF="terminal_interface-curses__ads.htm#ref_1925_9">Curses_Bool</A> (Boolean'Pos (<A HREF="terminal_interface-curses__ads.htm#ref_912_31">SwitchOn</A>))) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_912_14">Set_KeyPad_Mode</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_911_14">Set_KeyPad_Mode</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_848_13" HREF="terminal_interface-curses__ads.htm#ref_917_13">Get_KeyPad_Mode</A></FONT> (<FONT COLOR=red><A NAME="ref_848_30" HREF="terminal_interface-curses__ads.htm#ref_917_30">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>) -+ <b>function</b> <span class="symbol"><A NAME="ref_848_13" HREF="terminal_interface-curses__ads.htm#ref_916_13">Get_KeyPad_Mode</A></span> (<span class="symbol"><A NAME="ref_848_30" HREF="terminal_interface-curses__ads.htm#ref_916_30">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>) - <b>return</b> Boolean - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_851_16">Is_Keypad</A></FONT> (<FONT COLOR=red><A NAME="ref_851_27" HREF="terminal_interface-curses__adb.htm#ref_851_16">W</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_1926_9">Curses_Bool</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_851_16">Is_Keypad</A></span> (<span class="symbol"><A NAME="ref_851_27" HREF="terminal_interface-curses__adb.htm#ref_851_16">W</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_1925_9">Curses_Bool</A>; - <b>pragma</b> Import (C, Is_Keypad, "is_keypad"); - <b>begin</b> -- <b>return</b> (<A HREF="terminal_interface-curses__adb.htm#ref_851_16">Is_Keypad</A> (<A HREF="terminal_interface-curses__ads.htm#ref_917_30">Win</A>) /= <A HREF="terminal_interface-curses__ads.htm#ref_1927_4">Curses_Bool_False</A>); -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_917_13">Get_KeyPad_Mode</A>; -+ <b>return</b> (<A HREF="terminal_interface-curses__adb.htm#ref_851_16">Is_Keypad</A> (<A HREF="terminal_interface-curses__ads.htm#ref_916_30">Win</A>) /= <A HREF="terminal_interface-curses__ads.htm#ref_1926_4">Curses_Bool_False</A>); -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_916_13">Get_KeyPad_Mode</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_857_14" HREF="terminal_interface-curses__ads.htm#ref_925_14">Half_Delay</A></FONT> (<FONT COLOR=red><A NAME="ref_857_26" HREF="terminal_interface-curses__ads.htm#ref_925_26">Amount</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_922_9">Half_Delay_Amount</A>) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_857_14" HREF="terminal_interface-curses__ads.htm#ref_924_14">Half_Delay</A></span> (<span class="symbol"><A NAME="ref_857_26" HREF="terminal_interface-curses__ads.htm#ref_924_26">Amount</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_921_9">Half_Delay_Amount</A>) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_859_16">Halfdelay</A></FONT> (<FONT COLOR=red><A NAME="ref_859_27" HREF="terminal_interface-curses__adb.htm#ref_859_16">Amount</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_859_16">Halfdelay</A></span> (<span class="symbol"><A NAME="ref_859_27" HREF="terminal_interface-curses__adb.htm#ref_859_16">Amount</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Halfdelay, "halfdelay"); - <b>begin</b> -- <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_859_16">Halfdelay</A> (<A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_925_26">Amount</A>)) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_859_16">Halfdelay</A> (<A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_924_26">Amount</A>)) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_925_14">Half_Delay</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_924_14">Half_Delay</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_867_14" HREF="terminal_interface-curses__ads.htm#ref_930_14">Set_Flush_On_Interrupt_Mode</A></FONT> -- (<FONT COLOR=red><A NAME="ref_868_7" HREF="terminal_interface-curses__ads.htm#ref_931_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_869_7" HREF="terminal_interface-curses__ads.htm#ref_932_7">Mode</A></FONT> : Boolean := True) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_867_14" HREF="terminal_interface-curses__ads.htm#ref_929_14">Set_Flush_On_Interrupt_Mode</A></span> -+ (<span class="symbol"><A NAME="ref_868_7" HREF="terminal_interface-curses__ads.htm#ref_930_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_869_7" HREF="terminal_interface-curses__ads.htm#ref_931_7">Mode</A></span> : Boolean := True) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_871_16">Intrflush</A></FONT> (<FONT COLOR=red><A NAME="ref_871_27" HREF="terminal_interface-curses__adb.htm#ref_871_16">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; <FONT COLOR=red><A NAME="ref_871_41" HREF="terminal_interface-curses__adb.htm#ref_871_16">Mode</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_1926_9">Curses_Bool</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_871_16">Intrflush</A></span> (<span class="symbol"><A NAME="ref_871_27" HREF="terminal_interface-curses__adb.htm#ref_871_16">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; <span class="symbol"><A NAME="ref_871_41" HREF="terminal_interface-curses__adb.htm#ref_871_16">Mode</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_1925_9">Curses_Bool</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Intrflush, "intrflush"); - <b>begin</b> -- <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_871_16">Intrflush</A> (<A HREF="terminal_interface-curses__ads.htm#ref_931_7">Win</A>, <A HREF="terminal_interface-curses__ads.htm#ref_1926_9">Curses_Bool</A> (Boolean'Pos (<A HREF="terminal_interface-curses__ads.htm#ref_932_7">Mode</A>))) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_871_16">Intrflush</A> (<A HREF="terminal_interface-curses__ads.htm#ref_930_7">Win</A>, <A HREF="terminal_interface-curses__ads.htm#ref_1925_9">Curses_Bool</A> (Boolean'Pos (<A HREF="terminal_interface-curses__ads.htm#ref_931_7">Mode</A>))) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_930_14">Set_Flush_On_Interrupt_Mode</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_929_14">Set_Flush_On_Interrupt_Mode</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_879_14" HREF="terminal_interface-curses__ads.htm#ref_937_14">Set_Queue_Interrupt_Mode</A></FONT> -- (<FONT COLOR=red><A NAME="ref_880_7" HREF="terminal_interface-curses__ads.htm#ref_938_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_881_7" HREF="terminal_interface-curses__ads.htm#ref_939_7">Flush</A></FONT> : Boolean := True) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_879_14" HREF="terminal_interface-curses__ads.htm#ref_936_14">Set_Queue_Interrupt_Mode</A></span> -+ (<span class="symbol"><A NAME="ref_880_7" HREF="terminal_interface-curses__ads.htm#ref_937_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_881_7" HREF="terminal_interface-curses__ads.htm#ref_938_7">Flush</A></span> : Boolean := True) - <b>is</b> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_883_17">Qiflush</A></FONT>; -+ <b>procedure</b> <span class="symbol"><A NAME="ref_883_17">Qiflush</A></span>; - <b>pragma</b> Import (C, Qiflush, "qiflush"); -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_885_17">No_Qiflush</A></FONT>; -+ <b>procedure</b> <span class="symbol"><A NAME="ref_885_17">No_Qiflush</A></span>; - <b>pragma</b> Import (C, No_Qiflush, "noqiflush"); - <b>begin</b> -- <b>if</b> <A HREF="terminal_interface-curses__ads.htm#ref_938_7">Win</A> = <A HREF="terminal_interface-curses__ads.htm#ref_58_4">Null_Window</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>if</b> <A HREF="terminal_interface-curses__ads.htm#ref_937_7">Win</A> = <A HREF="terminal_interface-curses__ads.htm#ref_58_4">Null_Window</A> <b>then</b> -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; -- <b>if</b> <A HREF="terminal_interface-curses__ads.htm#ref_939_7">Flush</A> <b>then</b> -+ <b>if</b> <A HREF="terminal_interface-curses__ads.htm#ref_938_7">Flush</A> <b>then</b> - <A HREF="terminal_interface-curses__adb.htm#ref_883_17">Qiflush</A>; - <b>else</b> - <A HREF="terminal_interface-curses__adb.htm#ref_885_17">No_Qiflush</A>; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_937_14">Set_Queue_Interrupt_Mode</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_936_14">Set_Queue_Interrupt_Mode</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_898_14" HREF="terminal_interface-curses__ads.htm#ref_945_14">Set_NoDelay_Mode</A></FONT> -- (<FONT COLOR=red><A NAME="ref_899_7" HREF="terminal_interface-curses__ads.htm#ref_946_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_900_7" HREF="terminal_interface-curses__ads.htm#ref_947_7">Mode</A></FONT> : Boolean := False) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_898_14" HREF="terminal_interface-curses__ads.htm#ref_944_14">Set_NoDelay_Mode</A></span> -+ (<span class="symbol"><A NAME="ref_899_7" HREF="terminal_interface-curses__ads.htm#ref_945_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_900_7" HREF="terminal_interface-curses__ads.htm#ref_946_7">Mode</A></span> : Boolean := False) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_902_16">Nodelay</A></FONT> (<FONT COLOR=red><A NAME="ref_902_25" HREF="terminal_interface-curses__adb.htm#ref_902_16">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; <FONT COLOR=red><A NAME="ref_902_39" HREF="terminal_interface-curses__adb.htm#ref_902_16">Mode</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_1926_9">Curses_Bool</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_902_16">Nodelay</A></span> (<span class="symbol"><A NAME="ref_902_25" HREF="terminal_interface-curses__adb.htm#ref_902_16">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; <span class="symbol"><A NAME="ref_902_39" HREF="terminal_interface-curses__adb.htm#ref_902_16">Mode</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_1925_9">Curses_Bool</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Nodelay, "nodelay"); - <b>begin</b> -- <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_902_16">Nodelay</A> (<A HREF="terminal_interface-curses__ads.htm#ref_946_7">Win</A>, <A HREF="terminal_interface-curses__ads.htm#ref_1926_9">Curses_Bool</A> (Boolean'Pos (<A HREF="terminal_interface-curses__ads.htm#ref_947_7">Mode</A>))) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_902_16">Nodelay</A> (<A HREF="terminal_interface-curses__ads.htm#ref_945_7">Win</A>, <A HREF="terminal_interface-curses__ads.htm#ref_1925_9">Curses_Bool</A> (Boolean'Pos (<A HREF="terminal_interface-curses__ads.htm#ref_946_7">Mode</A>))) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_945_14">Set_NoDelay_Mode</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_944_14">Set_NoDelay_Mode</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_910_14" HREF="terminal_interface-curses__ads.htm#ref_954_14">Set_Timeout_Mode</A></FONT> (<FONT COLOR=red><A NAME="ref_910_32" HREF="terminal_interface-curses__ads.htm#ref_954_32">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_911_32" HREF="terminal_interface-curses__ads.htm#ref_955_32">Mode</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_951_9">Timeout_Mode</A>; -- <FONT COLOR=red><A NAME="ref_912_32" HREF="terminal_interface-curses__ads.htm#ref_956_32">Amount</A></FONT> : Natural) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_910_14" HREF="terminal_interface-curses__ads.htm#ref_953_14">Set_Timeout_Mode</A></span> (<span class="symbol"><A NAME="ref_910_32" HREF="terminal_interface-curses__ads.htm#ref_953_32">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_911_32" HREF="terminal_interface-curses__ads.htm#ref_954_32">Mode</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_950_9">Timeout_Mode</A>; -+ <span class="symbol"><A NAME="ref_912_32" HREF="terminal_interface-curses__ads.htm#ref_955_32">Amount</A></span> : Natural) - <b>is</b> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_914_17">Wtimeout</A></FONT> (<FONT COLOR=red><A NAME="ref_914_27" HREF="terminal_interface-curses__adb.htm#ref_914_17">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; <FONT COLOR=red><A NAME="ref_914_41" HREF="terminal_interface-curses__adb.htm#ref_914_17">Amount</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>); -+ <b>procedure</b> <span class="symbol"><A NAME="ref_914_17">Wtimeout</A></span> (<span class="symbol"><A NAME="ref_914_27" HREF="terminal_interface-curses__adb.htm#ref_914_17">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; <span class="symbol"><A NAME="ref_914_41" HREF="terminal_interface-curses__adb.htm#ref_914_17">Amount</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>); - <b>pragma</b> Import (C, Wtimeout, "wtimeout"); - -- <FONT COLOR=red><A NAME="ref_917_7">Time</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <span class="symbol"><A NAME="ref_917_7">Time</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>begin</b> -- <b>case</b> <A HREF="terminal_interface-curses__ads.htm#ref_955_32">Mode</A> <b>is</b> -- <b>when</b> <A HREF="terminal_interface-curses__ads.htm#ref_951_26">Blocking</A> =&gt; <A HREF="terminal_interface-curses__adb.htm#ref_917_7">Time</A> := -1; -- <b>when</b> <A HREF="terminal_interface-curses__ads.htm#ref_951_36">Non_Blocking</A> =&gt; <A HREF="terminal_interface-curses__adb.htm#ref_917_7">Time</A> := 0; -- <b>when</b> <A HREF="terminal_interface-curses__ads.htm#ref_951_50">Delayed</A> =&gt; -- <b>if</b> <A HREF="terminal_interface-curses__ads.htm#ref_956_32">Amount</A> = 0 <b>then</b> -+ <b>case</b> <A HREF="terminal_interface-curses__ads.htm#ref_954_32">Mode</A> <b>is</b> -+ <b>when</b> <A HREF="terminal_interface-curses__ads.htm#ref_950_26">Blocking</A> =&gt; <A HREF="terminal_interface-curses__adb.htm#ref_917_7">Time</A> := -1; -+ <b>when</b> <A HREF="terminal_interface-curses__ads.htm#ref_950_36">Non_Blocking</A> =&gt; <A HREF="terminal_interface-curses__adb.htm#ref_917_7">Time</A> := 0; -+ <b>when</b> <A HREF="terminal_interface-curses__ads.htm#ref_950_50">Delayed</A> =&gt; -+ <b>if</b> <A HREF="terminal_interface-curses__ads.htm#ref_955_32">Amount</A> = 0 <b>then</b> - <b>raise</b> Constraint_Error; - <b>end</b> <b>if</b>; -- <A HREF="terminal_interface-curses__adb.htm#ref_917_7">Time</A> := <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_956_32">Amount</A>); -+ <A HREF="terminal_interface-curses__adb.htm#ref_917_7">Time</A> := <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_955_32">Amount</A>); - <b>end</b> <b>case</b>; -- <A HREF="terminal_interface-curses__adb.htm#ref_914_17">Wtimeout</A> (<A HREF="terminal_interface-curses__ads.htm#ref_954_32">Win</A>, <A HREF="terminal_interface-curses__adb.htm#ref_917_7">Time</A>); -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_954_14">Set_Timeout_Mode</A>; -+ <A HREF="terminal_interface-curses__adb.htm#ref_914_17">Wtimeout</A> (<A HREF="terminal_interface-curses__ads.htm#ref_953_32">Win</A>, <A HREF="terminal_interface-curses__adb.htm#ref_917_7">Time</A>); -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_953_14">Set_Timeout_Mode</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_931_14" HREF="terminal_interface-curses__ads.htm#ref_966_14">Set_Escape_Timer_Mode</A></FONT> -- (<FONT COLOR=red><A NAME="ref_932_7" HREF="terminal_interface-curses__ads.htm#ref_967_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_933_7" HREF="terminal_interface-curses__ads.htm#ref_968_7">Timer_Off</A></FONT> : Boolean := False) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_931_14" HREF="terminal_interface-curses__ads.htm#ref_965_14">Set_Escape_Timer_Mode</A></span> -+ (<span class="symbol"><A NAME="ref_932_7" HREF="terminal_interface-curses__ads.htm#ref_966_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_933_7" HREF="terminal_interface-curses__ads.htm#ref_967_7">Timer_Off</A></span> : Boolean := False) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_935_16">Notimeout</A></FONT> (<FONT COLOR=red><A NAME="ref_935_27" HREF="terminal_interface-curses__adb.htm#ref_935_16">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; <FONT COLOR=red><A NAME="ref_935_41" HREF="terminal_interface-curses__adb.htm#ref_935_16">Mode</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_1926_9">Curses_Bool</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_935_16">Notimeout</A></span> (<span class="symbol"><A NAME="ref_935_27" HREF="terminal_interface-curses__adb.htm#ref_935_16">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; <span class="symbol"><A NAME="ref_935_41" HREF="terminal_interface-curses__adb.htm#ref_935_16">Mode</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_1925_9">Curses_Bool</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Notimeout, "notimeout"); - <b>begin</b> -- <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_935_16">Notimeout</A> (<A HREF="terminal_interface-curses__ads.htm#ref_967_7">Win</A>, <A HREF="terminal_interface-curses__ads.htm#ref_1926_9">Curses_Bool</A> (Boolean'Pos (<A HREF="terminal_interface-curses__ads.htm#ref_968_7">Timer_Off</A>))) -+ <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_935_16">Notimeout</A> (<A HREF="terminal_interface-curses__ads.htm#ref_966_7">Win</A>, <A HREF="terminal_interface-curses__ads.htm#ref_1925_9">Curses_Bool</A> (Boolean'Pos (<A HREF="terminal_interface-curses__ads.htm#ref_967_7">Timer_Off</A>))) - = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_966_14">Set_Escape_Timer_Mode</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_965_14">Set_Escape_Timer_Mode</A>; - --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_945_14" HREF="terminal_interface-curses__ads.htm#ref_977_14">Set_NL_Mode</A></FONT> (<FONT COLOR=red><A NAME="ref_945_27" HREF="terminal_interface-curses__ads.htm#ref_977_27">SwitchOn</A></FONT> : Boolean := True) -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_945_14" HREF="terminal_interface-curses__ads.htm#ref_976_14">Set_NL_Mode</A></span> (<span class="symbol"><A NAME="ref_945_27" HREF="terminal_interface-curses__ads.htm#ref_976_27">SwitchOn</A></span> : Boolean := True) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_947_16">NL</A></FONT> <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_947_16">NL</A></span> <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, NL, "nl"); -- <b>function</b> <FONT COLOR=red><A NAME="ref_949_16">NoNL</A></FONT> <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_949_16">NoNL</A></span> <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, NoNL, "nonl"); - -- <FONT COLOR=red><A NAME="ref_952_7">Err</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <span class="symbol"><A NAME="ref_952_7">Err</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>begin</b> -- <b>if</b> <A HREF="terminal_interface-curses__ads.htm#ref_977_27">SwitchOn</A> <b>then</b> -+ <b>if</b> <A HREF="terminal_interface-curses__ads.htm#ref_976_27">SwitchOn</A> <b>then</b> - <A HREF="terminal_interface-curses__adb.htm#ref_952_7">Err</A> := <A HREF="terminal_interface-curses__adb.htm#ref_947_16">NL</A>; - <b>else</b> - <A HREF="terminal_interface-curses__adb.htm#ref_952_7">Err</A> := <A HREF="terminal_interface-curses__adb.htm#ref_949_16">NoNL</A>; - <b>end</b> <b>if</b>; - <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_952_7">Err</A> = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_977_14">Set_NL_Mode</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_976_14">Set_NL_Mode</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_964_14" HREF="terminal_interface-curses__ads.htm#ref_983_14">Clear_On_Next_Update</A></FONT> -- (<FONT COLOR=red><A NAME="ref_965_7" HREF="terminal_interface-curses__ads.htm#ref_984_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_966_7" HREF="terminal_interface-curses__ads.htm#ref_985_7">Do_Clear</A></FONT> : Boolean := True) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_964_14" HREF="terminal_interface-curses__ads.htm#ref_982_14">Clear_On_Next_Update</A></span> -+ (<span class="symbol"><A NAME="ref_965_7" HREF="terminal_interface-curses__ads.htm#ref_983_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_966_7" HREF="terminal_interface-curses__ads.htm#ref_984_7">Do_Clear</A></span> : Boolean := True) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_968_16">Clear_Ok</A></FONT> (<FONT COLOR=red><A NAME="ref_968_26" HREF="terminal_interface-curses__adb.htm#ref_968_16">W</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; <FONT COLOR=red><A NAME="ref_968_38" HREF="terminal_interface-curses__adb.htm#ref_968_16">Flag</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_1926_9">Curses_Bool</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_968_16">Clear_Ok</A></span> (<span class="symbol"><A NAME="ref_968_26" HREF="terminal_interface-curses__adb.htm#ref_968_16">W</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; <span class="symbol"><A NAME="ref_968_38" HREF="terminal_interface-curses__adb.htm#ref_968_16">Flag</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_1925_9">Curses_Bool</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Clear_Ok, "clearok"); - <b>begin</b> -- <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_968_16">Clear_Ok</A> (<A HREF="terminal_interface-curses__ads.htm#ref_984_7">Win</A>, <A HREF="terminal_interface-curses__ads.htm#ref_1926_9">Curses_Bool</A> (Boolean'Pos (<A HREF="terminal_interface-curses__ads.htm#ref_985_7">Do_Clear</A>))) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_968_16">Clear_Ok</A> (<A HREF="terminal_interface-curses__ads.htm#ref_983_7">Win</A>, <A HREF="terminal_interface-curses__ads.htm#ref_1925_9">Curses_Bool</A> (Boolean'Pos (<A HREF="terminal_interface-curses__ads.htm#ref_984_7">Do_Clear</A>))) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_983_14">Clear_On_Next_Update</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_982_14">Clear_On_Next_Update</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_976_14" HREF="terminal_interface-curses__ads.htm#ref_990_14">Use_Insert_Delete_Line</A></FONT> -- (<FONT COLOR=red><A NAME="ref_977_7" HREF="terminal_interface-curses__ads.htm#ref_991_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_978_7" HREF="terminal_interface-curses__ads.htm#ref_992_7">Do_Idl</A></FONT> : Boolean := True) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_976_14" HREF="terminal_interface-curses__ads.htm#ref_989_14">Use_Insert_Delete_Line</A></span> -+ (<span class="symbol"><A NAME="ref_977_7" HREF="terminal_interface-curses__ads.htm#ref_990_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_978_7" HREF="terminal_interface-curses__ads.htm#ref_991_7">Do_Idl</A></span> : Boolean := True) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_980_16">IDL_Ok</A></FONT> (<FONT COLOR=red><A NAME="ref_980_24" HREF="terminal_interface-curses__adb.htm#ref_980_16">W</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; <FONT COLOR=red><A NAME="ref_980_36" HREF="terminal_interface-curses__adb.htm#ref_980_16">Flag</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_1926_9">Curses_Bool</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_980_16">IDL_Ok</A></span> (<span class="symbol"><A NAME="ref_980_24" HREF="terminal_interface-curses__adb.htm#ref_980_16">W</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; <span class="symbol"><A NAME="ref_980_36" HREF="terminal_interface-curses__adb.htm#ref_980_16">Flag</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_1925_9">Curses_Bool</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, IDL_Ok, "idlok"); - <b>begin</b> -- <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_980_16">IDL_Ok</A> (<A HREF="terminal_interface-curses__ads.htm#ref_991_7">Win</A>, <A HREF="terminal_interface-curses__ads.htm#ref_1926_9">Curses_Bool</A> (Boolean'Pos (<A HREF="terminal_interface-curses__ads.htm#ref_992_7">Do_Idl</A>))) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_980_16">IDL_Ok</A> (<A HREF="terminal_interface-curses__ads.htm#ref_990_7">Win</A>, <A HREF="terminal_interface-curses__ads.htm#ref_1925_9">Curses_Bool</A> (Boolean'Pos (<A HREF="terminal_interface-curses__ads.htm#ref_991_7">Do_Idl</A>))) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_990_14">Use_Insert_Delete_Line</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_989_14">Use_Insert_Delete_Line</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_988_14" HREF="terminal_interface-curses__ads.htm#ref_997_14">Use_Insert_Delete_Character</A></FONT> -- (<FONT COLOR=red><A NAME="ref_989_7" HREF="terminal_interface-curses__ads.htm#ref_998_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_990_7" HREF="terminal_interface-curses__ads.htm#ref_999_7">Do_Idc</A></FONT> : Boolean := True) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_988_14" HREF="terminal_interface-curses__ads.htm#ref_996_14">Use_Insert_Delete_Character</A></span> -+ (<span class="symbol"><A NAME="ref_989_7" HREF="terminal_interface-curses__ads.htm#ref_997_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_990_7" HREF="terminal_interface-curses__ads.htm#ref_998_7">Do_Idc</A></span> : Boolean := True) - <b>is</b> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_992_17">IDC_Ok</A></FONT> (<FONT COLOR=red><A NAME="ref_992_25" HREF="terminal_interface-curses__adb.htm#ref_992_17">W</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; <FONT COLOR=red><A NAME="ref_992_37" HREF="terminal_interface-curses__adb.htm#ref_992_17">Flag</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_1926_9">Curses_Bool</A>); -+ <b>procedure</b> <span class="symbol"><A NAME="ref_992_17">IDC_Ok</A></span> (<span class="symbol"><A NAME="ref_992_25" HREF="terminal_interface-curses__adb.htm#ref_992_17">W</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; <span class="symbol"><A NAME="ref_992_37" HREF="terminal_interface-curses__adb.htm#ref_992_17">Flag</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_1925_9">Curses_Bool</A>); - <b>pragma</b> Import (C, IDC_Ok, "idcok"); - <b>begin</b> -- <A HREF="terminal_interface-curses__adb.htm#ref_992_17">IDC_Ok</A> (<A HREF="terminal_interface-curses__ads.htm#ref_998_7">Win</A>, <A HREF="terminal_interface-curses__ads.htm#ref_1926_9">Curses_Bool</A> (Boolean'Pos (<A HREF="terminal_interface-curses__ads.htm#ref_999_7">Do_Idc</A>))); -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_997_14">Use_Insert_Delete_Character</A>; -+ <A HREF="terminal_interface-curses__adb.htm#ref_992_17">IDC_Ok</A> (<A HREF="terminal_interface-curses__ads.htm#ref_997_7">Win</A>, <A HREF="terminal_interface-curses__ads.htm#ref_1925_9">Curses_Bool</A> (Boolean'Pos (<A HREF="terminal_interface-curses__ads.htm#ref_998_7">Do_Idc</A>))); -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_996_14">Use_Insert_Delete_Character</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_998_14" HREF="terminal_interface-curses__ads.htm#ref_1004_14">Leave_Cursor_After_Update</A></FONT> -- (<FONT COLOR=red><A NAME="ref_999_7" HREF="terminal_interface-curses__ads.htm#ref_1005_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_1000_7" HREF="terminal_interface-curses__ads.htm#ref_1006_7">Do_Leave</A></FONT> : Boolean := True) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_998_14" HREF="terminal_interface-curses__ads.htm#ref_1003_14">Leave_Cursor_After_Update</A></span> -+ (<span class="symbol"><A NAME="ref_999_7" HREF="terminal_interface-curses__ads.htm#ref_1004_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_1000_7" HREF="terminal_interface-curses__ads.htm#ref_1005_7">Do_Leave</A></span> : Boolean := True) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1002_16">Leave_Ok</A></FONT> (<FONT COLOR=red><A NAME="ref_1002_26" HREF="terminal_interface-curses__adb.htm#ref_1002_16">W</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; <FONT COLOR=red><A NAME="ref_1002_38" HREF="terminal_interface-curses__adb.htm#ref_1002_16">Flag</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_1926_9">Curses_Bool</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_1002_16">Leave_Ok</A></span> (<span class="symbol"><A NAME="ref_1002_26" HREF="terminal_interface-curses__adb.htm#ref_1002_16">W</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; <span class="symbol"><A NAME="ref_1002_38" HREF="terminal_interface-curses__adb.htm#ref_1002_16">Flag</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_1925_9">Curses_Bool</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Leave_Ok, "leaveok"); - <b>begin</b> -- <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1002_16">Leave_Ok</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1005_7">Win</A>, <A HREF="terminal_interface-curses__ads.htm#ref_1926_9">Curses_Bool</A> (Boolean'Pos (<A HREF="terminal_interface-curses__ads.htm#ref_1006_7">Do_Leave</A>))) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1002_16">Leave_Ok</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1004_7">Win</A>, <A HREF="terminal_interface-curses__ads.htm#ref_1925_9">Curses_Bool</A> (Boolean'Pos (<A HREF="terminal_interface-curses__ads.htm#ref_1005_7">Do_Leave</A>))) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1004_14">Leave_Cursor_After_Update</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1003_14">Leave_Cursor_After_Update</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1010_14" HREF="terminal_interface-curses__ads.htm#ref_1011_14">Immediate_Update_Mode</A></FONT> -- (<FONT COLOR=red><A NAME="ref_1011_7" HREF="terminal_interface-curses__ads.htm#ref_1012_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_1012_7" HREF="terminal_interface-curses__ads.htm#ref_1013_7">Mode</A></FONT> : Boolean := False) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1010_14" HREF="terminal_interface-curses__ads.htm#ref_1010_14">Immediate_Update_Mode</A></span> -+ (<span class="symbol"><A NAME="ref_1011_7" HREF="terminal_interface-curses__ads.htm#ref_1011_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_1012_7" HREF="terminal_interface-curses__ads.htm#ref_1012_7">Mode</A></span> : Boolean := False) - <b>is</b> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1014_17">Immedok</A></FONT> (<FONT COLOR=red><A NAME="ref_1014_26" HREF="terminal_interface-curses__adb.htm#ref_1014_17">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; <FONT COLOR=red><A NAME="ref_1014_40" HREF="terminal_interface-curses__adb.htm#ref_1014_17">Mode</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_1926_9">Curses_Bool</A>); -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1014_17">Immedok</A></span> (<span class="symbol"><A NAME="ref_1014_26" HREF="terminal_interface-curses__adb.htm#ref_1014_17">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; <span class="symbol"><A NAME="ref_1014_40" HREF="terminal_interface-curses__adb.htm#ref_1014_17">Mode</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_1925_9">Curses_Bool</A>); - <b>pragma</b> Import (C, Immedok, "immedok"); - <b>begin</b> -- <A HREF="terminal_interface-curses__adb.htm#ref_1014_17">Immedok</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1012_7">Win</A>, <A HREF="terminal_interface-curses__ads.htm#ref_1926_9">Curses_Bool</A> (Boolean'Pos (<A HREF="terminal_interface-curses__ads.htm#ref_1013_7">Mode</A>))); -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1011_14">Immediate_Update_Mode</A>; -+ <A HREF="terminal_interface-curses__adb.htm#ref_1014_17">Immedok</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1011_7">Win</A>, <A HREF="terminal_interface-curses__ads.htm#ref_1925_9">Curses_Bool</A> (Boolean'Pos (<A HREF="terminal_interface-curses__ads.htm#ref_1012_7">Mode</A>))); -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1010_14">Immediate_Update_Mode</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1020_14" HREF="terminal_interface-curses__ads.htm#ref_1018_14">Allow_Scrolling</A></FONT> -- (<FONT COLOR=red><A NAME="ref_1021_7" HREF="terminal_interface-curses__ads.htm#ref_1019_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_1022_7" HREF="terminal_interface-curses__ads.htm#ref_1020_7">Mode</A></FONT> : Boolean := False) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1020_14" HREF="terminal_interface-curses__ads.htm#ref_1017_14">Allow_Scrolling</A></span> -+ (<span class="symbol"><A NAME="ref_1021_7" HREF="terminal_interface-curses__ads.htm#ref_1018_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_1022_7" HREF="terminal_interface-curses__ads.htm#ref_1019_7">Mode</A></span> : Boolean := False) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1024_16">Scrollok</A></FONT> (<FONT COLOR=red><A NAME="ref_1024_26" HREF="terminal_interface-curses__adb.htm#ref_1024_16">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; <FONT COLOR=red><A NAME="ref_1024_40" HREF="terminal_interface-curses__adb.htm#ref_1024_16">Mode</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_1926_9">Curses_Bool</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_1024_16">Scrollok</A></span> (<span class="symbol"><A NAME="ref_1024_26" HREF="terminal_interface-curses__adb.htm#ref_1024_16">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; <span class="symbol"><A NAME="ref_1024_40" HREF="terminal_interface-curses__adb.htm#ref_1024_16">Mode</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_1925_9">Curses_Bool</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Scrollok, "scrollok"); - <b>begin</b> -- <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1024_16">Scrollok</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1019_7">Win</A>, <A HREF="terminal_interface-curses__ads.htm#ref_1926_9">Curses_Bool</A> (Boolean'Pos (<A HREF="terminal_interface-curses__ads.htm#ref_1020_7">Mode</A>))) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1024_16">Scrollok</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1018_7">Win</A>, <A HREF="terminal_interface-curses__ads.htm#ref_1925_9">Curses_Bool</A> (Boolean'Pos (<A HREF="terminal_interface-curses__ads.htm#ref_1019_7">Mode</A>))) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1018_14">Allow_Scrolling</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1017_14">Allow_Scrolling</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_1032_13" HREF="terminal_interface-curses__ads.htm#ref_1024_13">Scrolling_Allowed</A></FONT> (<FONT COLOR=red><A NAME="ref_1032_32" HREF="terminal_interface-curses__ads.htm#ref_1024_32">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>) -+ <b>function</b> <span class="symbol"><A NAME="ref_1032_13" HREF="terminal_interface-curses__ads.htm#ref_1023_13">Scrolling_Allowed</A></span> (<span class="symbol"><A NAME="ref_1032_32" HREF="terminal_interface-curses__ads.htm#ref_1023_32">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>) - <b>return</b> Boolean - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1035_16">Is_Scroll_Ok</A></FONT> (<FONT COLOR=red><A NAME="ref_1035_30" HREF="terminal_interface-curses__adb.htm#ref_1035_16">W</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_1926_9">Curses_Bool</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_1035_16">Is_Scroll_Ok</A></span> (<span class="symbol"><A NAME="ref_1035_30" HREF="terminal_interface-curses__adb.htm#ref_1035_16">W</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_1925_9">Curses_Bool</A>; - <b>pragma</b> Import (C, Is_Scroll_Ok, "is_scrollok"); - <b>begin</b> -- <b>return</b> (<A HREF="terminal_interface-curses__adb.htm#ref_1035_16">Is_Scroll_Ok</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1024_32">Win</A>) /= <A HREF="terminal_interface-curses__ads.htm#ref_1927_4">Curses_Bool_False</A>); -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1024_13">Scrolling_Allowed</A>; -+ <b>return</b> (<A HREF="terminal_interface-curses__adb.htm#ref_1035_16">Is_Scroll_Ok</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1023_32">Win</A>) /= <A HREF="terminal_interface-curses__ads.htm#ref_1926_4">Curses_Bool_False</A>); -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1023_13">Scrolling_Allowed</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1041_14" HREF="terminal_interface-curses__ads.htm#ref_1029_14">Set_Scroll_Region</A></FONT> -- (<FONT COLOR=red><A NAME="ref_1042_7" HREF="terminal_interface-curses__ads.htm#ref_1030_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_1043_7" HREF="terminal_interface-curses__ads.htm#ref_1031_7">Top_Line</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_1044_7" HREF="terminal_interface-curses__ads.htm#ref_1032_7">Bottom_Line</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>) -- <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1046_16">Wsetscrreg</A></FONT> (<FONT COLOR=red><A NAME="ref_1046_28" HREF="terminal_interface-curses__adb.htm#ref_1046_16">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- <FONT COLOR=red><A NAME="ref_1047_28" HREF="terminal_interface-curses__adb.htm#ref_1046_16">Lin</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -- <FONT COLOR=red><A NAME="ref_1048_28" HREF="terminal_interface-curses__adb.htm#ref_1046_16">Col</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1041_14" HREF="terminal_interface-curses__ads.htm#ref_1028_14">Set_Scroll_Region</A></span> -+ (<span class="symbol"><A NAME="ref_1042_7" HREF="terminal_interface-curses__ads.htm#ref_1029_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_1043_7" HREF="terminal_interface-curses__ads.htm#ref_1030_7">Top_Line</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_1044_7" HREF="terminal_interface-curses__ads.htm#ref_1031_7">Bottom_Line</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>) -+ <b>is</b> -+ <b>function</b> <span class="symbol"><A NAME="ref_1046_16">Wsetscrreg</A></span> (<span class="symbol"><A NAME="ref_1046_28" HREF="terminal_interface-curses__adb.htm#ref_1046_16">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="symbol"><A NAME="ref_1047_28" HREF="terminal_interface-curses__adb.htm#ref_1046_16">Lin</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <span class="symbol"><A NAME="ref_1048_28" HREF="terminal_interface-curses__adb.htm#ref_1046_16">Col</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Wsetscrreg, "wsetscrreg"); - <b>begin</b> -- <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1046_16">Wsetscrreg</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1030_7">Win</A>, <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1031_7">Top_Line</A>), <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1032_7">Bottom_Line</A>)) -+ <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1046_16">Wsetscrreg</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1029_7">Win</A>, <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1030_7">Top_Line</A>), <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1031_7">Bottom_Line</A>)) - = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1029_14">Set_Scroll_Region</A>; --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1057_14" HREF="terminal_interface-curses__ads.htm#ref_1042_14">Update_Screen</A></FONT> -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1028_14">Set_Scroll_Region</A>; -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1057_14" HREF="terminal_interface-curses__ads.htm#ref_1041_14">Update_Screen</A></span> - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1059_16">Do_Update</A></FONT> <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_1059_16">Do_Update</A></span> <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Do_Update, "doupdate"); - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1059_16">Do_Update</A> = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1042_14">Update_Screen</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1041_14">Update_Screen</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1067_14" HREF="terminal_interface-curses__ads.htm#ref_1047_14">Refresh</A></FONT> (<FONT COLOR=red><A NAME="ref_1067_23" HREF="terminal_interface-curses__ads.htm#ref_1047_23">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1067_14" HREF="terminal_interface-curses__ads.htm#ref_1046_14">Refresh</A></span> (<span class="symbol"><A NAME="ref_1067_23" HREF="terminal_interface-curses__ads.htm#ref_1046_23">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1069_16">Wrefresh</A></FONT> (<FONT COLOR=red><A NAME="ref_1069_26" HREF="terminal_interface-curses__adb.htm#ref_1069_16">W</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_1069_16">Wrefresh</A></span> (<span class="symbol"><A NAME="ref_1069_26" HREF="terminal_interface-curses__adb.htm#ref_1069_16">W</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Wrefresh, "wrefresh"); - <b>begin</b> -- <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1069_16">Wrefresh</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1047_23">Win</A>) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1069_16">Wrefresh</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1046_23">Win</A>) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1047_14">Refresh</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1046_14">Refresh</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1077_14" HREF="terminal_interface-curses__ads.htm#ref_1054_14">Refresh_Without_Update</A></FONT> -- (<FONT COLOR=red><A NAME="ref_1078_7" HREF="terminal_interface-curses__ads.htm#ref_1055_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1077_14" HREF="terminal_interface-curses__ads.htm#ref_1053_14">Refresh_Without_Update</A></span> -+ (<span class="symbol"><A NAME="ref_1078_7" HREF="terminal_interface-curses__ads.htm#ref_1054_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1080_16">Wnoutrefresh</A></FONT> (<FONT COLOR=red><A NAME="ref_1080_30" HREF="terminal_interface-curses__adb.htm#ref_1080_16">W</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_1080_16">Wnoutrefresh</A></span> (<span class="symbol"><A NAME="ref_1080_30" HREF="terminal_interface-curses__adb.htm#ref_1080_16">W</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Wnoutrefresh, "wnoutrefresh"); - <b>begin</b> -- <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1080_16">Wnoutrefresh</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1055_7">Win</A>) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1080_16">Wnoutrefresh</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1054_7">Win</A>) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1054_14">Refresh_Without_Update</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1053_14">Refresh_Without_Update</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1088_14" HREF="terminal_interface-curses__ads.htm#ref_1061_14">Redraw</A></FONT> (<FONT COLOR=red><A NAME="ref_1088_22" HREF="terminal_interface-curses__ads.htm#ref_1061_22">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1088_14" HREF="terminal_interface-curses__ads.htm#ref_1060_14">Redraw</A></span> (<span class="symbol"><A NAME="ref_1088_22" HREF="terminal_interface-curses__ads.htm#ref_1060_22">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1090_16">Redrawwin</A></FONT> (<FONT COLOR=red><A NAME="ref_1090_27" HREF="terminal_interface-curses__adb.htm#ref_1090_16">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_1090_16">Redrawwin</A></span> (<span class="symbol"><A NAME="ref_1090_27" HREF="terminal_interface-curses__adb.htm#ref_1090_16">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Redrawwin, "redrawwin"); - <b>begin</b> -- <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1090_16">Redrawwin</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1061_22">Win</A>) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1090_16">Redrawwin</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1060_22">Win</A>) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1061_14">Redraw</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1060_14">Redraw</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1098_14" HREF="terminal_interface-curses__ads.htm#ref_1065_14">Redraw</A></FONT> -- (<FONT COLOR=red><A NAME="ref_1099_7" HREF="terminal_interface-curses__ads.htm#ref_1065_22">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_1100_7" HREF="terminal_interface-curses__ads.htm#ref_1066_22">Begin_Line</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_1101_7" HREF="terminal_interface-curses__ads.htm#ref_1067_22">Line_Count</A></FONT> : Positive) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1098_14" HREF="terminal_interface-curses__ads.htm#ref_1064_14">Redraw</A></span> -+ (<span class="symbol"><A NAME="ref_1099_7" HREF="terminal_interface-curses__ads.htm#ref_1064_22">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_1100_7" HREF="terminal_interface-curses__ads.htm#ref_1065_22">Begin_Line</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_1101_7" HREF="terminal_interface-curses__ads.htm#ref_1066_22">Line_Count</A></span> : Positive) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1103_16">Wredrawln</A></FONT> (<FONT COLOR=red><A NAME="ref_1103_27" HREF="terminal_interface-curses__adb.htm#ref_1103_16">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; <FONT COLOR=red><A NAME="ref_1103_41" HREF="terminal_interface-curses__adb.htm#ref_1103_16">First</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; <FONT COLOR=red><A NAME="ref_1103_56" HREF="terminal_interface-curses__adb.htm#ref_1103_16">Cnt</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) -+ <b>function</b> <span class="symbol"><A NAME="ref_1103_16">Wredrawln</A></span> (<span class="symbol"><A NAME="ref_1103_27" HREF="terminal_interface-curses__adb.htm#ref_1103_16">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; <span class="symbol"><A NAME="ref_1103_41" HREF="terminal_interface-curses__adb.htm#ref_1103_16">First</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; <span class="symbol"><A NAME="ref_1103_56" HREF="terminal_interface-curses__adb.htm#ref_1103_16">Cnt</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) - <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Wredrawln, "wredrawln"); - <b>begin</b> -- <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1103_16">Wredrawln</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1065_22">Win</A>, -- <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1066_22">Begin_Line</A>), -- <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1067_22">Line_Count</A>)) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1103_16">Wredrawln</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1064_22">Win</A>, -+ <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1065_22">Begin_Line</A>), -+ <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1066_22">Line_Count</A>)) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1065_14">Redraw</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1064_14">Redraw</A>; - --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1115_14" HREF="terminal_interface-curses__ads.htm#ref_1076_14">Erase</A></FONT> (<FONT COLOR=red><A NAME="ref_1115_21" HREF="terminal_interface-curses__ads.htm#ref_1076_21">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>) -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1115_14" HREF="terminal_interface-curses__ads.htm#ref_1075_14">Erase</A></span> (<span class="symbol"><A NAME="ref_1115_21" HREF="terminal_interface-curses__ads.htm#ref_1075_21">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1117_16">Werase</A></FONT> (<FONT COLOR=red><A NAME="ref_1117_24" HREF="terminal_interface-curses__adb.htm#ref_1117_16">W</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_1117_16">Werase</A></span> (<span class="symbol"><A NAME="ref_1117_24" HREF="terminal_interface-curses__adb.htm#ref_1117_16">W</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Werase, "werase"); - <b>begin</b> -- <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1117_16">Werase</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1076_21">Win</A>) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1117_16">Werase</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1075_21">Win</A>) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1076_14">Erase</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1075_14">Erase</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1125_14" HREF="terminal_interface-curses__ads.htm#ref_1082_14">Clear</A></FONT> (<FONT COLOR=red><A NAME="ref_1125_21" HREF="terminal_interface-curses__ads.htm#ref_1083_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1125_14" HREF="terminal_interface-curses__ads.htm#ref_1081_14">Clear</A></span> (<span class="symbol"><A NAME="ref_1125_21" HREF="terminal_interface-curses__ads.htm#ref_1082_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1127_16">Wclear</A></FONT> (<FONT COLOR=red><A NAME="ref_1127_24" HREF="terminal_interface-curses__adb.htm#ref_1127_16">W</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_1127_16">Wclear</A></span> (<span class="symbol"><A NAME="ref_1127_24" HREF="terminal_interface-curses__adb.htm#ref_1127_16">W</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Wclear, "wclear"); - <b>begin</b> -- <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1127_16">Wclear</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1083_7">Win</A>) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1127_16">Wclear</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1082_7">Win</A>) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1082_14">Clear</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1081_14">Clear</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1135_14" HREF="terminal_interface-curses__ads.htm#ref_1089_14">Clear_To_End_Of_Screen</A></FONT> (<FONT COLOR=red><A NAME="ref_1135_38" HREF="terminal_interface-curses__ads.htm#ref_1090_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1135_14" HREF="terminal_interface-curses__ads.htm#ref_1088_14">Clear_To_End_Of_Screen</A></span> (<span class="symbol"><A NAME="ref_1135_38" HREF="terminal_interface-curses__ads.htm#ref_1089_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1137_16">Wclearbot</A></FONT> (<FONT COLOR=red><A NAME="ref_1137_27" HREF="terminal_interface-curses__adb.htm#ref_1137_16">W</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_1137_16">Wclearbot</A></span> (<span class="symbol"><A NAME="ref_1137_27" HREF="terminal_interface-curses__adb.htm#ref_1137_16">W</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Wclearbot, "wclrtobot"); - <b>begin</b> -- <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1137_16">Wclearbot</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1090_7">Win</A>) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1137_16">Wclearbot</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1089_7">Win</A>) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1089_14">Clear_To_End_Of_Screen</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1088_14">Clear_To_End_Of_Screen</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1145_14" HREF="terminal_interface-curses__ads.htm#ref_1096_14">Clear_To_End_Of_Line</A></FONT> (<FONT COLOR=red><A NAME="ref_1145_36" HREF="terminal_interface-curses__ads.htm#ref_1097_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1145_14" HREF="terminal_interface-curses__ads.htm#ref_1095_14">Clear_To_End_Of_Line</A></span> (<span class="symbol"><A NAME="ref_1145_36" HREF="terminal_interface-curses__ads.htm#ref_1096_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1147_16">Wcleareol</A></FONT> (<FONT COLOR=red><A NAME="ref_1147_27" HREF="terminal_interface-curses__adb.htm#ref_1147_16">W</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_1147_16">Wcleareol</A></span> (<span class="symbol"><A NAME="ref_1147_27" HREF="terminal_interface-curses__adb.htm#ref_1147_16">W</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Wcleareol, "wclrtoeol"); - <b>begin</b> -- <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1147_16">Wcleareol</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1097_7">Win</A>) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1147_16">Wcleareol</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1096_7">Win</A>) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1096_14">Clear_To_End_Of_Line</A>; --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1155_14" HREF="terminal_interface-curses__ads.htm#ref_1110_14">Set_Background</A></FONT> -- (<FONT COLOR=red><A NAME="ref_1156_7" HREF="terminal_interface-curses__ads.htm#ref_1111_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_1157_7" HREF="terminal_interface-curses__ads.htm#ref_1112_7">Ch</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_354_9">Attributed_Character</A>) -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1095_14">Clear_To_End_Of_Line</A>; -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1155_14" HREF="terminal_interface-curses__ads.htm#ref_1109_14">Set_Background</A></span> -+ (<span class="symbol"><A NAME="ref_1156_7" HREF="terminal_interface-curses__ads.htm#ref_1110_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_1157_7" HREF="terminal_interface-curses__ads.htm#ref_1111_7">Ch</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_353_9">Attributed_Character</A>) - <b>is</b> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1159_17">WBackground</A></FONT> (<FONT COLOR=red><A NAME="ref_1159_30" HREF="terminal_interface-curses__adb.htm#ref_1159_17">W</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; <FONT COLOR=red><A NAME="ref_1159_42" HREF="terminal_interface-curses__adb.htm#ref_1159_17">Ch</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_12">C_Chtype</A>); -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1159_17">WBackground</A></span> (<span class="symbol"><A NAME="ref_1159_30" HREF="terminal_interface-curses__adb.htm#ref_1159_17">W</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; <span class="symbol"><A NAME="ref_1159_42" HREF="terminal_interface-curses__adb.htm#ref_1159_17">Ch</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_12">C_Chtype</A>); - <b>pragma</b> Import (C, WBackground, "wbkgdset"); - <b>begin</b> -- <A HREF="terminal_interface-curses__adb.htm#ref_1159_17">WBackground</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1111_7">Win</A>, <A HREF="terminal_interface-curses-aux__ads.htm#ref_75_4">AttrChar_To_Chtype</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1112_7">Ch</A>)); -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1110_14">Set_Background</A>; -+ <A HREF="terminal_interface-curses__adb.htm#ref_1159_17">WBackground</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1110_7">Win</A>, <A HREF="terminal_interface-curses-aux__ads.htm#ref_75_4">AttrChar_To_Chtype</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1111_7">Ch</A>)); -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1109_14">Set_Background</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1165_14" HREF="terminal_interface-curses__ads.htm#ref_1118_14">Change_Background</A></FONT> -- (<FONT COLOR=red><A NAME="ref_1166_7" HREF="terminal_interface-curses__ads.htm#ref_1119_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_1167_7" HREF="terminal_interface-curses__ads.htm#ref_1120_7">Ch</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_354_9">Attributed_Character</A>) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1165_14" HREF="terminal_interface-curses__ads.htm#ref_1117_14">Change_Background</A></span> -+ (<span class="symbol"><A NAME="ref_1166_7" HREF="terminal_interface-curses__ads.htm#ref_1118_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_1167_7" HREF="terminal_interface-curses__ads.htm#ref_1119_7">Ch</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_353_9">Attributed_Character</A>) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1169_16">WChangeBkgd</A></FONT> (<FONT COLOR=red><A NAME="ref_1169_29" HREF="terminal_interface-curses__adb.htm#ref_1169_16">W</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; <FONT COLOR=red><A NAME="ref_1169_41" HREF="terminal_interface-curses__adb.htm#ref_1169_16">Ch</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_12">C_Chtype</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_1169_16">WChangeBkgd</A></span> (<span class="symbol"><A NAME="ref_1169_29" HREF="terminal_interface-curses__adb.htm#ref_1169_16">W</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; <span class="symbol"><A NAME="ref_1169_41" HREF="terminal_interface-curses__adb.htm#ref_1169_16">Ch</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_12">C_Chtype</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, WChangeBkgd, "wbkgd"); - <b>begin</b> -- <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1169_16">WChangeBkgd</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1119_7">Win</A>, <A HREF="terminal_interface-curses-aux__ads.htm#ref_75_4">AttrChar_To_Chtype</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1120_7">Ch</A>)) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1169_16">WChangeBkgd</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1118_7">Win</A>, <A HREF="terminal_interface-curses-aux__ads.htm#ref_75_4">AttrChar_To_Chtype</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1119_7">Ch</A>)) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1118_14">Change_Background</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1117_14">Change_Background</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_1177_13" HREF="terminal_interface-curses__ads.htm#ref_1127_13">Get_Background</A></FONT> (<FONT COLOR=red><A NAME="ref_1177_29" HREF="terminal_interface-curses__ads.htm#ref_1127_29">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>) -- <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_354_9">Attributed_Character</A> -+ <b>function</b> <span class="symbol"><A NAME="ref_1177_13" HREF="terminal_interface-curses__ads.htm#ref_1126_13">Get_Background</A></span> (<span class="symbol"><A NAME="ref_1177_29" HREF="terminal_interface-curses__ads.htm#ref_1126_29">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>) -+ <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_353_9">Attributed_Character</A> - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1180_16">Wgetbkgd</A></FONT> (<FONT COLOR=red><A NAME="ref_1180_26" HREF="terminal_interface-curses__adb.htm#ref_1180_16">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_12">C_Chtype</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_1180_16">Wgetbkgd</A></span> (<span class="symbol"><A NAME="ref_1180_26" HREF="terminal_interface-curses__adb.htm#ref_1180_16">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_12">C_Chtype</A>; - <b>pragma</b> Import (C, Wgetbkgd, "getbkgd"); - <b>begin</b> -- <b>return</b> Chtype_To_AttrChar (<A HREF="terminal_interface-curses__adb.htm#ref_1180_16">Wgetbkgd</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1127_29">Win</A>)); -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1127_13">Get_Background</A>; --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1186_14" HREF="terminal_interface-curses__ads.htm#ref_1154_14">Change_Lines_Status</A></FONT> (<FONT COLOR=red><A NAME="ref_1186_35" HREF="terminal_interface-curses__ads.htm#ref_1154_35">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_1187_35" HREF="terminal_interface-curses__ads.htm#ref_1155_35">Start</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_1188_35" HREF="terminal_interface-curses__ads.htm#ref_1156_35">Count</A></FONT> : Positive; -- <FONT COLOR=red><A NAME="ref_1189_35" HREF="terminal_interface-curses__ads.htm#ref_1157_35">State</A></FONT> : Boolean) -- <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1191_16">Wtouchln</A></FONT> (<FONT COLOR=red><A NAME="ref_1191_26" HREF="terminal_interface-curses__adb.htm#ref_1191_16">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- <FONT COLOR=red><A NAME="ref_1192_26" HREF="terminal_interface-curses__adb.htm#ref_1191_16">Sta</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -- <FONT COLOR=red><A NAME="ref_1193_26" HREF="terminal_interface-curses__adb.htm#ref_1191_16">Cnt</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -- <FONT COLOR=red><A NAME="ref_1194_26" HREF="terminal_interface-curses__adb.htm#ref_1191_16">Chg</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>return</b> Chtype_To_AttrChar (<A HREF="terminal_interface-curses__adb.htm#ref_1180_16">Wgetbkgd</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1126_29">Win</A>)); -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1126_13">Get_Background</A>; -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1186_14" HREF="terminal_interface-curses__ads.htm#ref_1153_14">Change_Lines_Status</A></span> (<span class="symbol"><A NAME="ref_1186_35" HREF="terminal_interface-curses__ads.htm#ref_1153_35">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_1187_35" HREF="terminal_interface-curses__ads.htm#ref_1154_35">Start</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_1188_35" HREF="terminal_interface-curses__ads.htm#ref_1155_35">Count</A></span> : Positive; -+ <span class="symbol"><A NAME="ref_1189_35" HREF="terminal_interface-curses__ads.htm#ref_1156_35">State</A></span> : Boolean) -+ <b>is</b> -+ <b>function</b> <span class="symbol"><A NAME="ref_1191_16">Wtouchln</A></span> (<span class="symbol"><A NAME="ref_1191_26" HREF="terminal_interface-curses__adb.htm#ref_1191_16">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="symbol"><A NAME="ref_1192_26" HREF="terminal_interface-curses__adb.htm#ref_1191_16">Sta</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <span class="symbol"><A NAME="ref_1193_26" HREF="terminal_interface-curses__adb.htm#ref_1191_16">Cnt</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <span class="symbol"><A NAME="ref_1194_26" HREF="terminal_interface-curses__adb.htm#ref_1191_16">Chg</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Wtouchln, "wtouchln"); - <b>begin</b> -- <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1191_16">Wtouchln</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1154_35">Win</A>, <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1155_35">Start</A>), <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1156_35">Count</A>), -- <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (Boolean'Pos (<A HREF="terminal_interface-curses__ads.htm#ref_1157_35">State</A>))) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1191_16">Wtouchln</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1153_35">Win</A>, <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1154_35">Start</A>), <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1155_35">Count</A>), -+ <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (Boolean'Pos (<A HREF="terminal_interface-curses__ads.htm#ref_1156_35">State</A>))) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1154_14">Change_Lines_Status</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1153_14">Change_Lines_Status</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1203_14" HREF="terminal_interface-curses__ads.htm#ref_1143_14">Touch</A></FONT> (<FONT COLOR=red><A NAME="ref_1203_21" HREF="terminal_interface-curses__ads.htm#ref_1143_21">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1203_14" HREF="terminal_interface-curses__ads.htm#ref_1142_14">Touch</A></span> (<span class="symbol"><A NAME="ref_1203_21" HREF="terminal_interface-curses__ads.htm#ref_1142_21">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>) - <b>is</b> -- <FONT COLOR=red><A NAME="ref_1205_7">Y</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_1206_7">X</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -+ <span class="symbol"><A NAME="ref_1205_7">Y</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_1206_7">X</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; - <b>begin</b> -- <A HREF="terminal_interface-curses__ads.htm#ref_1230_14">Get_Size</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1143_21">Win</A>, <A HREF="terminal_interface-curses__adb.htm#ref_1205_7">Y</A>, <A HREF="terminal_interface-curses__adb.htm#ref_1206_7">X</A>); -+ <A HREF="terminal_interface-curses__ads.htm#ref_1229_14">Get_Size</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1142_21">Win</A>, <A HREF="terminal_interface-curses__adb.htm#ref_1205_7">Y</A>, <A HREF="terminal_interface-curses__adb.htm#ref_1206_7">X</A>); - <b>pragma</b> Unreferenced (<A HREF="terminal_interface-curses__adb.htm#ref_1206_7">X</A>); -- <A HREF="terminal_interface-curses__ads.htm#ref_1154_14">Change_Lines_Status</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1143_21">Win</A>, 0, Positive (<A HREF="terminal_interface-curses__adb.htm#ref_1205_7">Y</A>), True); -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1143_14">Touch</A>; -+ <A HREF="terminal_interface-curses__ads.htm#ref_1153_14">Change_Lines_Status</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1142_21">Win</A>, 0, Positive (<A HREF="terminal_interface-curses__adb.htm#ref_1205_7">Y</A>), True); -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1142_14">Touch</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1213_14" HREF="terminal_interface-curses__ads.htm#ref_1138_14">Untouch</A></FONT> (<FONT COLOR=red><A NAME="ref_1213_23" HREF="terminal_interface-curses__ads.htm#ref_1138_23">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1213_14" HREF="terminal_interface-curses__ads.htm#ref_1137_14">Untouch</A></span> (<span class="symbol"><A NAME="ref_1213_23" HREF="terminal_interface-curses__ads.htm#ref_1137_23">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>) - <b>is</b> -- <FONT COLOR=red><A NAME="ref_1215_7">Y</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_1216_7">X</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -+ <span class="symbol"><A NAME="ref_1215_7">Y</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_1216_7">X</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; - <b>begin</b> -- <A HREF="terminal_interface-curses__ads.htm#ref_1230_14">Get_Size</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1138_23">Win</A>, <A HREF="terminal_interface-curses__adb.htm#ref_1215_7">Y</A>, <A HREF="terminal_interface-curses__adb.htm#ref_1216_7">X</A>); -+ <A HREF="terminal_interface-curses__ads.htm#ref_1229_14">Get_Size</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1137_23">Win</A>, <A HREF="terminal_interface-curses__adb.htm#ref_1215_7">Y</A>, <A HREF="terminal_interface-curses__adb.htm#ref_1216_7">X</A>); - <b>pragma</b> Unreferenced (<A HREF="terminal_interface-curses__adb.htm#ref_1216_7">X</A>); -- <A HREF="terminal_interface-curses__ads.htm#ref_1154_14">Change_Lines_Status</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1138_23">Win</A>, 0, Positive (<A HREF="terminal_interface-curses__adb.htm#ref_1215_7">Y</A>), False); -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1138_14">Untouch</A>; -+ <A HREF="terminal_interface-curses__ads.htm#ref_1153_14">Change_Lines_Status</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1137_23">Win</A>, 0, Positive (<A HREF="terminal_interface-curses__adb.htm#ref_1215_7">Y</A>), False); -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1137_14">Untouch</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1223_14" HREF="terminal_interface-curses__ads.htm#ref_1147_14">Touch</A></FONT> (<FONT COLOR=red><A NAME="ref_1223_21" HREF="terminal_interface-curses__ads.htm#ref_1147_21">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_1224_21" HREF="terminal_interface-curses__ads.htm#ref_1148_21">Start</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_1225_21" HREF="terminal_interface-curses__ads.htm#ref_1149_21">Count</A></FONT> : Positive) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1223_14" HREF="terminal_interface-curses__ads.htm#ref_1146_14">Touch</A></span> (<span class="symbol"><A NAME="ref_1223_21" HREF="terminal_interface-curses__ads.htm#ref_1146_21">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_1224_21" HREF="terminal_interface-curses__ads.htm#ref_1147_21">Start</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_1225_21" HREF="terminal_interface-curses__ads.htm#ref_1148_21">Count</A></span> : Positive) - <b>is</b> - <b>begin</b> -- <A HREF="terminal_interface-curses__ads.htm#ref_1154_14">Change_Lines_Status</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1147_21">Win</A>, <A HREF="terminal_interface-curses__ads.htm#ref_1148_21">Start</A>, <A HREF="terminal_interface-curses__ads.htm#ref_1149_21">Count</A>, True); -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1147_14">Touch</A>; -+ <A HREF="terminal_interface-curses__ads.htm#ref_1153_14">Change_Lines_Status</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1146_21">Win</A>, <A HREF="terminal_interface-curses__ads.htm#ref_1147_21">Start</A>, <A HREF="terminal_interface-curses__ads.htm#ref_1148_21">Count</A>, True); -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1146_14">Touch</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_1231_13" HREF="terminal_interface-curses__ads.htm#ref_1162_13">Is_Touched</A></FONT> -- (<FONT COLOR=red><A NAME="ref_1232_7" HREF="terminal_interface-curses__ads.htm#ref_1162_25">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_1233_7" HREF="terminal_interface-curses__ads.htm#ref_1163_25">Line</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>) <b>return</b> Boolean -+ <b>function</b> <span class="symbol"><A NAME="ref_1231_13" HREF="terminal_interface-curses__ads.htm#ref_1161_13">Is_Touched</A></span> -+ (<span class="symbol"><A NAME="ref_1232_7" HREF="terminal_interface-curses__ads.htm#ref_1161_25">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_1233_7" HREF="terminal_interface-curses__ads.htm#ref_1162_25">Line</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>) <b>return</b> Boolean - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1235_16">WLineTouched</A></FONT> (<FONT COLOR=red><A NAME="ref_1235_30" HREF="terminal_interface-curses__adb.htm#ref_1235_16">W</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; <FONT COLOR=red><A NAME="ref_1235_42" HREF="terminal_interface-curses__adb.htm#ref_1235_16">L</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_1926_9">Curses_Bool</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_1235_16">WLineTouched</A></span> (<span class="symbol"><A NAME="ref_1235_30" HREF="terminal_interface-curses__adb.htm#ref_1235_16">W</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; <span class="symbol"><A NAME="ref_1235_42" HREF="terminal_interface-curses__adb.htm#ref_1235_16">L</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_1925_9">Curses_Bool</A>; - <b>pragma</b> Import (C, WLineTouched, "is_linetouched"); - <b>begin</b> -- <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1235_16">WLineTouched</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1162_25">Win</A>, <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1163_25">Line</A>)) = <A HREF="terminal_interface-curses__ads.htm#ref_1927_4">Curses_Bool_False</A> <b>then</b> -+ <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1235_16">WLineTouched</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1161_25">Win</A>, <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1162_25">Line</A>)) = <A HREF="terminal_interface-curses__ads.htm#ref_1926_4">Curses_Bool_False</A> <b>then</b> - <b>return</b> False; - <b>else</b> - <b>return</b> True; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1162_13">Is_Touched</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1161_13">Is_Touched</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_1245_13" HREF="terminal_interface-curses__ads.htm#ref_1167_13">Is_Touched</A></FONT> -- (<FONT COLOR=red><A NAME="ref_1246_7" HREF="terminal_interface-curses__ads.htm#ref_1167_25">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>) <b>return</b> Boolean -+ <b>function</b> <span class="symbol"><A NAME="ref_1245_13" HREF="terminal_interface-curses__ads.htm#ref_1166_13">Is_Touched</A></span> -+ (<span class="symbol"><A NAME="ref_1246_7" HREF="terminal_interface-curses__ads.htm#ref_1166_25">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>) <b>return</b> Boolean - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1248_16">WWinTouched</A></FONT> (<FONT COLOR=red><A NAME="ref_1248_29" HREF="terminal_interface-curses__adb.htm#ref_1248_16">W</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_1926_9">Curses_Bool</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_1248_16">WWinTouched</A></span> (<span class="symbol"><A NAME="ref_1248_29" HREF="terminal_interface-curses__adb.htm#ref_1248_16">W</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_1925_9">Curses_Bool</A>; - <b>pragma</b> Import (C, WWinTouched, "is_wintouched"); - <b>begin</b> -- <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1248_16">WWinTouched</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1167_25">Win</A>) = <A HREF="terminal_interface-curses__ads.htm#ref_1927_4">Curses_Bool_False</A> <b>then</b> -+ <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1248_16">WWinTouched</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1166_25">Win</A>) = <A HREF="terminal_interface-curses__ads.htm#ref_1926_4">Curses_Bool_False</A> <b>then</b> - <b>return</b> False; - <b>else</b> - <b>return</b> True; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1167_13">Is_Touched</A>; --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1258_14" HREF="terminal_interface-curses__ads.htm#ref_1176_14">Copy</A></FONT> -- (<FONT COLOR=red><A NAME="ref_1259_7" HREF="terminal_interface-curses__ads.htm#ref_1177_7">Source_Window</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- <FONT COLOR=red><A NAME="ref_1260_7" HREF="terminal_interface-curses__ads.htm#ref_1178_7">Destination_Window</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- <FONT COLOR=red><A NAME="ref_1261_7" HREF="terminal_interface-curses__ads.htm#ref_1179_7">Source_Top_Row</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_1262_7" HREF="terminal_interface-curses__ads.htm#ref_1180_7">Source_Left_Column</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -- <FONT COLOR=red><A NAME="ref_1263_7" HREF="terminal_interface-curses__ads.htm#ref_1181_7">Destination_Top_Row</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_1264_7" HREF="terminal_interface-curses__ads.htm#ref_1182_7">Destination_Left_Column</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -- <FONT COLOR=red><A NAME="ref_1265_7" HREF="terminal_interface-curses__ads.htm#ref_1183_7">Destination_Bottom_Row</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_1266_7" HREF="terminal_interface-curses__ads.htm#ref_1184_7">Destination_Right_Column</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -- <FONT COLOR=red><A NAME="ref_1267_7" HREF="terminal_interface-curses__ads.htm#ref_1185_7">Non_Destructive_Mode</A></FONT> : Boolean := True) -- <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1269_16">Copywin</A></FONT> (<FONT COLOR=red><A NAME="ref_1269_25" HREF="terminal_interface-curses__adb.htm#ref_1269_16">Src</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- <FONT COLOR=red><A NAME="ref_1270_25" HREF="terminal_interface-curses__adb.htm#ref_1269_16">Dst</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- <FONT COLOR=red><A NAME="ref_1271_25" HREF="terminal_interface-curses__adb.htm#ref_1269_16">Str</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -- <FONT COLOR=red><A NAME="ref_1272_25" HREF="terminal_interface-curses__adb.htm#ref_1269_16">Slc</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -- <FONT COLOR=red><A NAME="ref_1273_25" HREF="terminal_interface-curses__adb.htm#ref_1269_16">Dtr</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -- <FONT COLOR=red><A NAME="ref_1274_25" HREF="terminal_interface-curses__adb.htm#ref_1269_16">Dlc</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -- <FONT COLOR=red><A NAME="ref_1275_25" HREF="terminal_interface-curses__adb.htm#ref_1269_16">Dbr</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -- <FONT COLOR=red><A NAME="ref_1276_25" HREF="terminal_interface-curses__adb.htm#ref_1269_16">Drc</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -- <FONT COLOR=red><A NAME="ref_1277_25" HREF="terminal_interface-curses__adb.htm#ref_1269_16">Ndm</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1166_13">Is_Touched</A>; -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1258_14" HREF="terminal_interface-curses__ads.htm#ref_1175_14">Copy</A></span> -+ (<span class="symbol"><A NAME="ref_1259_7" HREF="terminal_interface-curses__ads.htm#ref_1176_7">Source_Window</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="symbol"><A NAME="ref_1260_7" HREF="terminal_interface-curses__ads.htm#ref_1177_7">Destination_Window</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="symbol"><A NAME="ref_1261_7" HREF="terminal_interface-curses__ads.htm#ref_1178_7">Source_Top_Row</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_1262_7" HREF="terminal_interface-curses__ads.htm#ref_1179_7">Source_Left_Column</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -+ <span class="symbol"><A NAME="ref_1263_7" HREF="terminal_interface-curses__ads.htm#ref_1180_7">Destination_Top_Row</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_1264_7" HREF="terminal_interface-curses__ads.htm#ref_1181_7">Destination_Left_Column</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -+ <span class="symbol"><A NAME="ref_1265_7" HREF="terminal_interface-curses__ads.htm#ref_1182_7">Destination_Bottom_Row</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_1266_7" HREF="terminal_interface-curses__ads.htm#ref_1183_7">Destination_Right_Column</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -+ <span class="symbol"><A NAME="ref_1267_7" HREF="terminal_interface-curses__ads.htm#ref_1184_7">Non_Destructive_Mode</A></span> : Boolean := True) -+ <b>is</b> -+ <b>function</b> <span class="symbol"><A NAME="ref_1269_16">Copywin</A></span> (<span class="symbol"><A NAME="ref_1269_25" HREF="terminal_interface-curses__adb.htm#ref_1269_16">Src</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="symbol"><A NAME="ref_1270_25" HREF="terminal_interface-curses__adb.htm#ref_1269_16">Dst</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="symbol"><A NAME="ref_1271_25" HREF="terminal_interface-curses__adb.htm#ref_1269_16">Str</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <span class="symbol"><A NAME="ref_1272_25" HREF="terminal_interface-curses__adb.htm#ref_1269_16">Slc</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <span class="symbol"><A NAME="ref_1273_25" HREF="terminal_interface-curses__adb.htm#ref_1269_16">Dtr</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <span class="symbol"><A NAME="ref_1274_25" HREF="terminal_interface-curses__adb.htm#ref_1269_16">Dlc</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <span class="symbol"><A NAME="ref_1275_25" HREF="terminal_interface-curses__adb.htm#ref_1269_16">Dbr</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <span class="symbol"><A NAME="ref_1276_25" HREF="terminal_interface-curses__adb.htm#ref_1269_16">Drc</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <span class="symbol"><A NAME="ref_1277_25" HREF="terminal_interface-curses__adb.htm#ref_1269_16">Ndm</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Copywin, "copywin"); - <b>begin</b> -- <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1269_16">Copywin</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1177_7">Source_Window</A>, -- <A HREF="terminal_interface-curses__ads.htm#ref_1178_7">Destination_Window</A>, -- <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1179_7">Source_Top_Row</A>), -- <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1180_7">Source_Left_Column</A>), -- <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1181_7">Destination_Top_Row</A>), -- <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1182_7">Destination_Left_Column</A>), -- <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1183_7">Destination_Bottom_Row</A>), -- <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1184_7">Destination_Right_Column</A>), -- Boolean'Pos (<A HREF="terminal_interface-curses__ads.htm#ref_1185_7">Non_Destructive_Mode</A>) -+ <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1269_16">Copywin</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1176_7">Source_Window</A>, -+ <A HREF="terminal_interface-curses__ads.htm#ref_1177_7">Destination_Window</A>, -+ <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1178_7">Source_Top_Row</A>), -+ <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1179_7">Source_Left_Column</A>), -+ <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1180_7">Destination_Top_Row</A>), -+ <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1181_7">Destination_Left_Column</A>), -+ <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1182_7">Destination_Bottom_Row</A>), -+ <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1183_7">Destination_Right_Column</A>), -+ Boolean'Pos (<A HREF="terminal_interface-curses__ads.htm#ref_1184_7">Non_Destructive_Mode</A>) - ) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1176_14">Copy</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1175_14">Copy</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1294_14" HREF="terminal_interface-curses__ads.htm#ref_1190_14">Overwrite</A></FONT> -- (<FONT COLOR=red><A NAME="ref_1295_7" HREF="terminal_interface-curses__ads.htm#ref_1190_25">Source_Window</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- <FONT COLOR=red><A NAME="ref_1296_7" HREF="terminal_interface-curses__ads.htm#ref_1191_25">Destination_Window</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1294_14" HREF="terminal_interface-curses__ads.htm#ref_1189_14">Overwrite</A></span> -+ (<span class="symbol"><A NAME="ref_1295_7" HREF="terminal_interface-curses__ads.htm#ref_1189_25">Source_Window</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="symbol"><A NAME="ref_1296_7" HREF="terminal_interface-curses__ads.htm#ref_1190_25">Destination_Window</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1298_16">Overwrite</A></FONT> (<FONT COLOR=red><A NAME="ref_1298_27" HREF="terminal_interface-curses__adb.htm#ref_1298_16">Src</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; <FONT COLOR=red><A NAME="ref_1298_41" HREF="terminal_interface-curses__adb.htm#ref_1298_16">Dst</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_1298_16">Overwrite</A></span> (<span class="symbol"><A NAME="ref_1298_27" HREF="terminal_interface-curses__adb.htm#ref_1298_16">Src</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; <span class="symbol"><A NAME="ref_1298_41" HREF="terminal_interface-curses__adb.htm#ref_1298_16">Dst</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Overwrite, "overwrite"); - <b>begin</b> -- <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1298_16">Overwrite</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1190_25">Source_Window</A>, <A HREF="terminal_interface-curses__ads.htm#ref_1191_25">Destination_Window</A>) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1298_16">Overwrite</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1189_25">Source_Window</A>, <A HREF="terminal_interface-curses__ads.htm#ref_1190_25">Destination_Window</A>) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1190_14">Overwrite</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1189_14">Overwrite</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1306_14" HREF="terminal_interface-curses__ads.htm#ref_1196_14">Overlay</A></FONT> -- (<FONT COLOR=red><A NAME="ref_1307_7" HREF="terminal_interface-curses__ads.htm#ref_1196_23">Source_Window</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- <FONT COLOR=red><A NAME="ref_1308_7" HREF="terminal_interface-curses__ads.htm#ref_1197_23">Destination_Window</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1306_14" HREF="terminal_interface-curses__ads.htm#ref_1195_14">Overlay</A></span> -+ (<span class="symbol"><A NAME="ref_1307_7" HREF="terminal_interface-curses__ads.htm#ref_1195_23">Source_Window</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="symbol"><A NAME="ref_1308_7" HREF="terminal_interface-curses__ads.htm#ref_1196_23">Destination_Window</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1310_16">Overlay</A></FONT> (<FONT COLOR=red><A NAME="ref_1310_25" HREF="terminal_interface-curses__adb.htm#ref_1310_16">Src</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; <FONT COLOR=red><A NAME="ref_1310_39" HREF="terminal_interface-curses__adb.htm#ref_1310_16">Dst</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_1310_16">Overlay</A></span> (<span class="symbol"><A NAME="ref_1310_25" HREF="terminal_interface-curses__adb.htm#ref_1310_16">Src</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; <span class="symbol"><A NAME="ref_1310_39" HREF="terminal_interface-curses__adb.htm#ref_1310_16">Dst</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Overlay, "overlay"); - <b>begin</b> -- <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1310_16">Overlay</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1196_23">Source_Window</A>, <A HREF="terminal_interface-curses__ads.htm#ref_1197_23">Destination_Window</A>) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1310_16">Overlay</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1195_23">Source_Window</A>, <A HREF="terminal_interface-curses__ads.htm#ref_1196_23">Destination_Window</A>) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1196_14">Overlay</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1195_14">Overlay</A>; - --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1319_14" HREF="terminal_interface-curses__ads.htm#ref_1206_14">Insert_Delete_Lines</A></FONT> -- (<FONT COLOR=red><A NAME="ref_1320_7" HREF="terminal_interface-curses__ads.htm#ref_1207_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_1321_7" HREF="terminal_interface-curses__ads.htm#ref_1208_7">Lines</A></FONT> : Integer := 1) <FONT COLOR=green><EM>-- default is to insert one line above</EM></FONT> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1319_14" HREF="terminal_interface-curses__ads.htm#ref_1205_14">Insert_Delete_Lines</A></span> -+ (<span class="symbol"><A NAME="ref_1320_7" HREF="terminal_interface-curses__ads.htm#ref_1206_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_1321_7" HREF="terminal_interface-curses__ads.htm#ref_1207_7">Lines</A></span> : Integer := 1) <span class="comment"><EM>-- default is to insert one line above</EM></span> - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1323_16">Winsdelln</A></FONT> (<FONT COLOR=red><A NAME="ref_1323_27" HREF="terminal_interface-curses__adb.htm#ref_1323_16">W</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; <FONT COLOR=red><A NAME="ref_1323_39" HREF="terminal_interface-curses__adb.htm#ref_1323_16">N</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_1323_16">Winsdelln</A></span> (<span class="symbol"><A NAME="ref_1323_27" HREF="terminal_interface-curses__adb.htm#ref_1323_16">W</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; <span class="symbol"><A NAME="ref_1323_39" HREF="terminal_interface-curses__adb.htm#ref_1323_16">N</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Winsdelln, "winsdelln"); - <b>begin</b> -- <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1323_16">Winsdelln</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1207_7">Win</A>, <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1208_7">Lines</A>)) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1323_16">Winsdelln</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1206_7">Win</A>, <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1207_7">Lines</A>)) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1206_14">Insert_Delete_Lines</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1205_14">Insert_Delete_Lines</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1331_14" HREF="terminal_interface-curses__ads.htm#ref_1214_14">Delete_Line</A></FONT> (<FONT COLOR=red><A NAME="ref_1331_27" HREF="terminal_interface-curses__ads.htm#ref_1214_27">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1331_14" HREF="terminal_interface-curses__ads.htm#ref_1213_14">Delete_Line</A></span> (<span class="symbol"><A NAME="ref_1331_27" HREF="terminal_interface-curses__ads.htm#ref_1213_27">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>) - <b>is</b> - <b>begin</b> -- <A HREF="terminal_interface-curses__ads.htm#ref_1206_14">Insert_Delete_Lines</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1214_27">Win</A>, -1); -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1214_14">Delete_Line</A>; -+ <A HREF="terminal_interface-curses__ads.htm#ref_1205_14">Insert_Delete_Lines</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1213_27">Win</A>, -1); -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1213_14">Delete_Line</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1337_14" HREF="terminal_interface-curses__ads.htm#ref_1220_14">Insert_Line</A></FONT> (<FONT COLOR=red><A NAME="ref_1337_27" HREF="terminal_interface-curses__ads.htm#ref_1220_27">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1337_14" HREF="terminal_interface-curses__ads.htm#ref_1219_14">Insert_Line</A></span> (<span class="symbol"><A NAME="ref_1337_27" HREF="terminal_interface-curses__ads.htm#ref_1219_27">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>) - <b>is</b> - <b>begin</b> -- <A HREF="terminal_interface-curses__ads.htm#ref_1206_14">Insert_Delete_Lines</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1220_27">Win</A>, 1); -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1220_14">Insert_Line</A>; --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -+ <A HREF="terminal_interface-curses__ads.htm#ref_1205_14">Insert_Delete_Lines</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1219_27">Win</A>, 1); -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1219_14">Insert_Line</A>; -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1344_14" HREF="terminal_interface-curses__ads.htm#ref_1230_14">Get_Size</A></FONT> -- (<FONT COLOR=red><A NAME="ref_1345_7" HREF="terminal_interface-curses__ads.htm#ref_1231_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_1346_7" HREF="terminal_interface-curses__ads.htm#ref_1232_7">Number_Of_Lines</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_63_12">Line_Count</A>; -- <FONT COLOR=red><A NAME="ref_1347_7" HREF="terminal_interface-curses__ads.htm#ref_1233_7">Number_Of_Columns</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_65_12">Column_Count</A>) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1344_14" HREF="terminal_interface-curses__ads.htm#ref_1229_14">Get_Size</A></span> -+ (<span class="symbol"><A NAME="ref_1345_7" HREF="terminal_interface-curses__ads.htm#ref_1230_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_1346_7" HREF="terminal_interface-curses__ads.htm#ref_1231_7">Number_Of_Lines</A></span> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_63_12">Line_Count</A>; -+ <span class="symbol"><A NAME="ref_1347_7" HREF="terminal_interface-curses__ads.htm#ref_1232_7">Number_Of_Columns</A></span> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_65_12">Column_Count</A>) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1349_16">GetMaxY</A></FONT> (<FONT COLOR=red><A NAME="ref_1349_25" HREF="terminal_interface-curses__adb.htm#ref_1349_16">W</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_1349_16">GetMaxY</A></span> (<span class="symbol"><A NAME="ref_1349_25" HREF="terminal_interface-curses__adb.htm#ref_1349_16">W</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, GetMaxY, "getmaxy"); - -- <b>function</b> <FONT COLOR=red><A NAME="ref_1352_16">GetMaxX</A></FONT> (<FONT COLOR=red><A NAME="ref_1352_25" HREF="terminal_interface-curses__adb.htm#ref_1352_16">W</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_1352_16">GetMaxX</A></span> (<span class="symbol"><A NAME="ref_1352_25" HREF="terminal_interface-curses__adb.htm#ref_1352_16">W</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, GetMaxX, "getmaxx"); - -- <FONT COLOR=red><A NAME="ref_1355_7">Y</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> := <A HREF="terminal_interface-curses__adb.htm#ref_1349_16">GetMaxY</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1231_7">Win</A>); -- <FONT COLOR=red><A NAME="ref_1356_7">X</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> := <A HREF="terminal_interface-curses__adb.htm#ref_1352_16">GetMaxX</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1231_7">Win</A>); -+ <span class="symbol"><A NAME="ref_1355_7">Y</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> := <A HREF="terminal_interface-curses__adb.htm#ref_1349_16">GetMaxY</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1230_7">Win</A>); -+ <span class="symbol"><A NAME="ref_1356_7">X</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> := <A HREF="terminal_interface-curses__adb.htm#ref_1352_16">GetMaxX</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1230_7">Win</A>); - <b>begin</b> -- <A HREF="terminal_interface-curses__ads.htm#ref_1232_7">Number_Of_Lines</A> := <A HREF="terminal_interface-curses__ads.htm#ref_63_12">Line_Count</A> (<A HREF="terminal_interface-curses__adb.htm#ref_1355_7">Y</A>); -- <A HREF="terminal_interface-curses__ads.htm#ref_1233_7">Number_Of_Columns</A> := <A HREF="terminal_interface-curses__ads.htm#ref_65_12">Column_Count</A> (<A HREF="terminal_interface-curses__adb.htm#ref_1356_7">X</A>); -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1230_14">Get_Size</A>; -- -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1362_14" HREF="terminal_interface-curses__ads.htm#ref_1238_14">Get_Window_Position</A></FONT> -- (<FONT COLOR=red><A NAME="ref_1363_7" HREF="terminal_interface-curses__ads.htm#ref_1239_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_1364_7" HREF="terminal_interface-curses__ads.htm#ref_1240_7">Top_Left_Line</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_1365_7" HREF="terminal_interface-curses__ads.htm#ref_1241_7">Top_Left_Column</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>) -+ <A HREF="terminal_interface-curses__ads.htm#ref_1231_7">Number_Of_Lines</A> := <A HREF="terminal_interface-curses__ads.htm#ref_63_12">Line_Count</A> (<A HREF="terminal_interface-curses__adb.htm#ref_1355_7">Y</A>); -+ <A HREF="terminal_interface-curses__ads.htm#ref_1232_7">Number_Of_Columns</A> := <A HREF="terminal_interface-curses__ads.htm#ref_65_12">Column_Count</A> (<A HREF="terminal_interface-curses__adb.htm#ref_1356_7">X</A>); -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1229_14">Get_Size</A>; -+ -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1362_14" HREF="terminal_interface-curses__ads.htm#ref_1237_14">Get_Window_Position</A></span> -+ (<span class="symbol"><A NAME="ref_1363_7" HREF="terminal_interface-curses__ads.htm#ref_1238_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_1364_7" HREF="terminal_interface-curses__ads.htm#ref_1239_7">Top_Left_Line</A></span> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_1365_7" HREF="terminal_interface-curses__ads.htm#ref_1240_7">Top_Left_Column</A></span> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1367_16">GetBegY</A></FONT> (<FONT COLOR=red><A NAME="ref_1367_25" HREF="terminal_interface-curses__adb.htm#ref_1367_16">W</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_1367_16">GetBegY</A></span> (<span class="symbol"><A NAME="ref_1367_25" HREF="terminal_interface-curses__adb.htm#ref_1367_16">W</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, GetBegY, "getbegy"); - -- <b>function</b> <FONT COLOR=red><A NAME="ref_1370_16">GetBegX</A></FONT> (<FONT COLOR=red><A NAME="ref_1370_25" HREF="terminal_interface-curses__adb.htm#ref_1370_16">W</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_1370_16">GetBegX</A></span> (<span class="symbol"><A NAME="ref_1370_25" HREF="terminal_interface-curses__adb.htm#ref_1370_16">W</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, GetBegX, "getbegx"); - -- <FONT COLOR=red><A NAME="ref_1373_7">Y</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_56_12">C_Short</A> := <A HREF="terminal_interface-curses-aux__ads.htm#ref_56_12">C_Short</A> (<A HREF="terminal_interface-curses__adb.htm#ref_1367_16">GetBegY</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1239_7">Win</A>)); -- <FONT COLOR=red><A NAME="ref_1374_7">X</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_56_12">C_Short</A> := <A HREF="terminal_interface-curses-aux__ads.htm#ref_56_12">C_Short</A> (<A HREF="terminal_interface-curses__adb.htm#ref_1370_16">GetBegX</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1239_7">Win</A>)); -+ <span class="symbol"><A NAME="ref_1373_7">Y</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_56_12">C_Short</A> := <A HREF="terminal_interface-curses-aux__ads.htm#ref_56_12">C_Short</A> (<A HREF="terminal_interface-curses__adb.htm#ref_1367_16">GetBegY</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1238_7">Win</A>)); -+ <span class="symbol"><A NAME="ref_1374_7">X</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_56_12">C_Short</A> := <A HREF="terminal_interface-curses-aux__ads.htm#ref_56_12">C_Short</A> (<A HREF="terminal_interface-curses__adb.htm#ref_1370_16">GetBegX</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1238_7">Win</A>)); - <b>begin</b> -- <A HREF="terminal_interface-curses__ads.htm#ref_1240_7">Top_Left_Line</A> := <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A> (<A HREF="terminal_interface-curses__adb.htm#ref_1373_7">Y</A>); -- <A HREF="terminal_interface-curses__ads.htm#ref_1241_7">Top_Left_Column</A> := <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A> (<A HREF="terminal_interface-curses__adb.htm#ref_1374_7">X</A>); -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1238_14">Get_Window_Position</A>; -- -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1380_14" HREF="terminal_interface-curses__ads.htm#ref_1246_14">Get_Cursor_Position</A></FONT> -- (<FONT COLOR=red><A NAME="ref_1381_7" HREF="terminal_interface-curses__ads.htm#ref_1247_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_1382_7" HREF="terminal_interface-curses__ads.htm#ref_1248_7">Line</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_1383_7" HREF="terminal_interface-curses__ads.htm#ref_1249_7">Column</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>) -+ <A HREF="terminal_interface-curses__ads.htm#ref_1239_7">Top_Left_Line</A> := <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A> (<A HREF="terminal_interface-curses__adb.htm#ref_1373_7">Y</A>); -+ <A HREF="terminal_interface-curses__ads.htm#ref_1240_7">Top_Left_Column</A> := <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A> (<A HREF="terminal_interface-curses__adb.htm#ref_1374_7">X</A>); -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1237_14">Get_Window_Position</A>; -+ -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1380_14" HREF="terminal_interface-curses__ads.htm#ref_1245_14">Get_Cursor_Position</A></span> -+ (<span class="symbol"><A NAME="ref_1381_7" HREF="terminal_interface-curses__ads.htm#ref_1246_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_1382_7" HREF="terminal_interface-curses__ads.htm#ref_1247_7">Line</A></span> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_1383_7" HREF="terminal_interface-curses__ads.htm#ref_1248_7">Column</A></span> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1385_16">GetCurY</A></FONT> (<FONT COLOR=red><A NAME="ref_1385_25" HREF="terminal_interface-curses__adb.htm#ref_1385_16">W</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_1385_16">GetCurY</A></span> (<span class="symbol"><A NAME="ref_1385_25" HREF="terminal_interface-curses__adb.htm#ref_1385_16">W</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, GetCurY, "getcury"); - -- <b>function</b> <FONT COLOR=red><A NAME="ref_1388_16">GetCurX</A></FONT> (<FONT COLOR=red><A NAME="ref_1388_25" HREF="terminal_interface-curses__adb.htm#ref_1388_16">W</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_1388_16">GetCurX</A></span> (<span class="symbol"><A NAME="ref_1388_25" HREF="terminal_interface-curses__adb.htm#ref_1388_16">W</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, GetCurX, "getcurx"); - -- <FONT COLOR=red><A NAME="ref_1391_7">Y</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_56_12">C_Short</A> := <A HREF="terminal_interface-curses-aux__ads.htm#ref_56_12">C_Short</A> (<A HREF="terminal_interface-curses__adb.htm#ref_1385_16">GetCurY</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1247_7">Win</A>)); -- <FONT COLOR=red><A NAME="ref_1392_7">X</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_56_12">C_Short</A> := <A HREF="terminal_interface-curses-aux__ads.htm#ref_56_12">C_Short</A> (<A HREF="terminal_interface-curses__adb.htm#ref_1388_16">GetCurX</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1247_7">Win</A>)); -+ <span class="symbol"><A NAME="ref_1391_7">Y</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_56_12">C_Short</A> := <A HREF="terminal_interface-curses-aux__ads.htm#ref_56_12">C_Short</A> (<A HREF="terminal_interface-curses__adb.htm#ref_1385_16">GetCurY</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1246_7">Win</A>)); -+ <span class="symbol"><A NAME="ref_1392_7">X</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_56_12">C_Short</A> := <A HREF="terminal_interface-curses-aux__ads.htm#ref_56_12">C_Short</A> (<A HREF="terminal_interface-curses__adb.htm#ref_1388_16">GetCurX</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1246_7">Win</A>)); - <b>begin</b> -- <A HREF="terminal_interface-curses__ads.htm#ref_1248_7">Line</A> := <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A> (<A HREF="terminal_interface-curses__adb.htm#ref_1391_7">Y</A>); -- <A HREF="terminal_interface-curses__ads.htm#ref_1249_7">Column</A> := <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A> (<A HREF="terminal_interface-curses__adb.htm#ref_1392_7">X</A>); -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1246_14">Get_Cursor_Position</A>; -- -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1398_14" HREF="terminal_interface-curses__ads.htm#ref_1254_14">Get_Origin_Relative_To_Parent</A></FONT> -- (<FONT COLOR=red><A NAME="ref_1399_7" HREF="terminal_interface-curses__ads.htm#ref_1255_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- <FONT COLOR=red><A NAME="ref_1400_7" HREF="terminal_interface-curses__ads.htm#ref_1256_7">Top_Left_Line</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_1401_7" HREF="terminal_interface-curses__ads.htm#ref_1257_7">Top_Left_Column</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -- <FONT COLOR=red><A NAME="ref_1402_7" HREF="terminal_interface-curses__ads.htm#ref_1258_7">Is_Not_A_Subwindow</A></FONT> : <b>out</b> Boolean) -+ <A HREF="terminal_interface-curses__ads.htm#ref_1247_7">Line</A> := <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A> (<A HREF="terminal_interface-curses__adb.htm#ref_1391_7">Y</A>); -+ <A HREF="terminal_interface-curses__ads.htm#ref_1248_7">Column</A> := <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A> (<A HREF="terminal_interface-curses__adb.htm#ref_1392_7">X</A>); -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1245_14">Get_Cursor_Position</A>; -+ -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1398_14" HREF="terminal_interface-curses__ads.htm#ref_1253_14">Get_Origin_Relative_To_Parent</A></span> -+ (<span class="symbol"><A NAME="ref_1399_7" HREF="terminal_interface-curses__ads.htm#ref_1254_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="symbol"><A NAME="ref_1400_7" HREF="terminal_interface-curses__ads.htm#ref_1255_7">Top_Left_Line</A></span> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_1401_7" HREF="terminal_interface-curses__ads.htm#ref_1256_7">Top_Left_Column</A></span> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -+ <span class="symbol"><A NAME="ref_1402_7" HREF="terminal_interface-curses__ads.htm#ref_1257_7">Is_Not_A_Subwindow</A></span> : <b>out</b> Boolean) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1404_16">GetParY</A></FONT> (<FONT COLOR=red><A NAME="ref_1404_25" HREF="terminal_interface-curses__adb.htm#ref_1404_16">W</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_1404_16">GetParY</A></span> (<span class="symbol"><A NAME="ref_1404_25" HREF="terminal_interface-curses__adb.htm#ref_1404_16">W</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, GetParY, "getpary"); - -- <b>function</b> <FONT COLOR=red><A NAME="ref_1407_16">GetParX</A></FONT> (<FONT COLOR=red><A NAME="ref_1407_25" HREF="terminal_interface-curses__adb.htm#ref_1407_16">W</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_1407_16">GetParX</A></span> (<span class="symbol"><A NAME="ref_1407_25" HREF="terminal_interface-curses__adb.htm#ref_1407_16">W</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, GetParX, "getparx"); - -- <FONT COLOR=red><A NAME="ref_1410_7">Y</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> := <A HREF="terminal_interface-curses__adb.htm#ref_1404_16">GetParY</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1255_7">Win</A>); -- <FONT COLOR=red><A NAME="ref_1411_7">X</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> := <A HREF="terminal_interface-curses__adb.htm#ref_1407_16">GetParX</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1255_7">Win</A>); -+ <span class="symbol"><A NAME="ref_1410_7">Y</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> := <A HREF="terminal_interface-curses__adb.htm#ref_1404_16">GetParY</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1254_7">Win</A>); -+ <span class="symbol"><A NAME="ref_1411_7">X</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> := <A HREF="terminal_interface-curses__adb.htm#ref_1407_16">GetParX</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1254_7">Win</A>); - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1410_7">Y</A> = -1 <b>then</b> -- <A HREF="terminal_interface-curses__ads.htm#ref_1256_7">Top_Left_Line</A> := <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>'Last; -- <A HREF="terminal_interface-curses__ads.htm#ref_1257_7">Top_Left_Column</A> := <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>'Last; -- <A HREF="terminal_interface-curses__ads.htm#ref_1258_7">Is_Not_A_Subwindow</A> := True; -- <b>else</b> -- <A HREF="terminal_interface-curses__ads.htm#ref_1256_7">Top_Left_Line</A> := <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A> (<A HREF="terminal_interface-curses__adb.htm#ref_1410_7">Y</A>); -- <A HREF="terminal_interface-curses__ads.htm#ref_1257_7">Top_Left_Column</A> := <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A> (<A HREF="terminal_interface-curses__adb.htm#ref_1411_7">X</A>); -- <A HREF="terminal_interface-curses__ads.htm#ref_1258_7">Is_Not_A_Subwindow</A> := False; -- <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1254_14">Get_Origin_Relative_To_Parent</A>; --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1424_13" HREF="terminal_interface-curses__ads.htm#ref_1269_13">New_Pad</A></FONT> (<FONT COLOR=red><A NAME="ref_1424_22" HREF="terminal_interface-curses__ads.htm#ref_1269_22">Lines</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_63_12">Line_Count</A>; -- <FONT COLOR=red><A NAME="ref_1425_22" HREF="terminal_interface-curses__ads.htm#ref_1270_22">Columns</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_65_12">Column_Count</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> -+ <A HREF="terminal_interface-curses__ads.htm#ref_1255_7">Top_Left_Line</A> := <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>'Last; -+ <A HREF="terminal_interface-curses__ads.htm#ref_1256_7">Top_Left_Column</A> := <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>'Last; -+ <A HREF="terminal_interface-curses__ads.htm#ref_1257_7">Is_Not_A_Subwindow</A> := True; -+ <b>else</b> -+ <A HREF="terminal_interface-curses__ads.htm#ref_1255_7">Top_Left_Line</A> := <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A> (<A HREF="terminal_interface-curses__adb.htm#ref_1410_7">Y</A>); -+ <A HREF="terminal_interface-curses__ads.htm#ref_1256_7">Top_Left_Column</A> := <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A> (<A HREF="terminal_interface-curses__adb.htm#ref_1411_7">X</A>); -+ <A HREF="terminal_interface-curses__ads.htm#ref_1257_7">Is_Not_A_Subwindow</A> := False; -+ <b>end</b> <b>if</b>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1253_14">Get_Origin_Relative_To_Parent</A>; -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_1424_13" HREF="terminal_interface-curses__ads.htm#ref_1268_13">New_Pad</A></span> (<span class="symbol"><A NAME="ref_1424_22" HREF="terminal_interface-curses__ads.htm#ref_1268_22">Lines</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_63_12">Line_Count</A>; -+ <span class="symbol"><A NAME="ref_1425_22" HREF="terminal_interface-curses__ads.htm#ref_1269_22">Columns</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_65_12">Column_Count</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1427_16">Newpad</A></FONT> (<FONT COLOR=red><A NAME="ref_1427_24" HREF="terminal_interface-curses__adb.htm#ref_1427_16">Lines</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; <FONT COLOR=red><A NAME="ref_1427_39" HREF="terminal_interface-curses__adb.htm#ref_1427_16">Columns</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_1427_16">Newpad</A></span> (<span class="symbol"><A NAME="ref_1427_24" HREF="terminal_interface-curses__adb.htm#ref_1427_16">Lines</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; <span class="symbol"><A NAME="ref_1427_39" HREF="terminal_interface-curses__adb.htm#ref_1427_16">Columns</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; - <b>pragma</b> Import (C, Newpad, "newpad"); - -- <FONT COLOR=red><A NAME="ref_1430_7">W</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="symbol"><A NAME="ref_1430_7">W</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; - <b>begin</b> -- <A HREF="terminal_interface-curses__adb.htm#ref_1430_7">W</A> := <A HREF="terminal_interface-curses__adb.htm#ref_1427_16">Newpad</A> (<A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1269_22">Lines</A>), <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1270_22">Columns</A>)); -+ <A HREF="terminal_interface-curses__adb.htm#ref_1430_7">W</A> := <A HREF="terminal_interface-curses__adb.htm#ref_1427_16">Newpad</A> (<A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1268_22">Lines</A>), <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1269_22">Columns</A>)); - <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1430_7">W</A> = <A HREF="terminal_interface-curses__ads.htm#ref_58_4">Null_Window</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; - <b>return</b> <A HREF="terminal_interface-curses__adb.htm#ref_1430_7">W</A>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1269_13">New_Pad</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1268_13">New_Pad</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_1439_13" HREF="terminal_interface-curses__ads.htm#ref_1275_13">Sub_Pad</A></FONT> -- (<FONT COLOR=red><A NAME="ref_1440_7" HREF="terminal_interface-curses__ads.htm#ref_1276_7">Pad</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- <FONT COLOR=red><A NAME="ref_1441_7" HREF="terminal_interface-curses__ads.htm#ref_1277_7">Number_Of_Lines</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_63_12">Line_Count</A>; -- <FONT COLOR=red><A NAME="ref_1442_7" HREF="terminal_interface-curses__ads.htm#ref_1278_7">Number_Of_Columns</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_65_12">Column_Count</A>; -- <FONT COLOR=red><A NAME="ref_1443_7" HREF="terminal_interface-curses__ads.htm#ref_1279_7">First_Line_Position</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_1444_7" HREF="terminal_interface-curses__ads.htm#ref_1280_7">First_Column_Position</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> -- <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1446_16">Subpad</A></FONT> -- (<FONT COLOR=red><A NAME="ref_1447_10" HREF="terminal_interface-curses__adb.htm#ref_1446_16">Pad</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- <FONT COLOR=red><A NAME="ref_1448_10" HREF="terminal_interface-curses__adb.htm#ref_1446_16">Number_Of_Lines</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -- <FONT COLOR=red><A NAME="ref_1449_10" HREF="terminal_interface-curses__adb.htm#ref_1446_16">Number_Of_Columns</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -- <FONT COLOR=red><A NAME="ref_1450_10" HREF="terminal_interface-curses__adb.htm#ref_1446_16">First_Line_Position</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -- <FONT COLOR=red><A NAME="ref_1451_10" HREF="terminal_interface-curses__adb.htm#ref_1446_16">First_Column_Position</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_1439_13" HREF="terminal_interface-curses__ads.htm#ref_1274_13">Sub_Pad</A></span> -+ (<span class="symbol"><A NAME="ref_1440_7" HREF="terminal_interface-curses__ads.htm#ref_1275_7">Pad</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="symbol"><A NAME="ref_1441_7" HREF="terminal_interface-curses__ads.htm#ref_1276_7">Number_Of_Lines</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_63_12">Line_Count</A>; -+ <span class="symbol"><A NAME="ref_1442_7" HREF="terminal_interface-curses__ads.htm#ref_1277_7">Number_Of_Columns</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_65_12">Column_Count</A>; -+ <span class="symbol"><A NAME="ref_1443_7" HREF="terminal_interface-curses__ads.htm#ref_1278_7">First_Line_Position</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_1444_7" HREF="terminal_interface-curses__ads.htm#ref_1279_7">First_Column_Position</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> -+ <b>is</b> -+ <b>function</b> <span class="symbol"><A NAME="ref_1446_16">Subpad</A></span> -+ (<span class="symbol"><A NAME="ref_1447_10" HREF="terminal_interface-curses__adb.htm#ref_1446_16">Pad</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="symbol"><A NAME="ref_1448_10" HREF="terminal_interface-curses__adb.htm#ref_1446_16">Number_Of_Lines</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <span class="symbol"><A NAME="ref_1449_10" HREF="terminal_interface-curses__adb.htm#ref_1446_16">Number_Of_Columns</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <span class="symbol"><A NAME="ref_1450_10" HREF="terminal_interface-curses__adb.htm#ref_1446_16">First_Line_Position</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <span class="symbol"><A NAME="ref_1451_10" HREF="terminal_interface-curses__adb.htm#ref_1446_16">First_Column_Position</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; - <b>pragma</b> Import (C, Subpad, "subpad"); - -- <FONT COLOR=red><A NAME="ref_1454_7">W</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="symbol"><A NAME="ref_1454_7">W</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; - <b>begin</b> -- <A HREF="terminal_interface-curses__adb.htm#ref_1454_7">W</A> := <A HREF="terminal_interface-curses__adb.htm#ref_1446_16">Subpad</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1276_7">Pad</A>, -- <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1277_7">Number_Of_Lines</A>), -- <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1278_7">Number_Of_Columns</A>), -- <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1279_7">First_Line_Position</A>), -- <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1280_7">First_Column_Position</A>)); -+ <A HREF="terminal_interface-curses__adb.htm#ref_1454_7">W</A> := <A HREF="terminal_interface-curses__adb.htm#ref_1446_16">Subpad</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1275_7">Pad</A>, -+ <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1276_7">Number_Of_Lines</A>), -+ <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1277_7">Number_Of_Columns</A>), -+ <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1278_7">First_Line_Position</A>), -+ <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1279_7">First_Column_Position</A>)); - <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1454_7">W</A> = <A HREF="terminal_interface-curses__ads.htm#ref_58_4">Null_Window</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; - <b>return</b> <A HREF="terminal_interface-curses__adb.htm#ref_1454_7">W</A>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1275_13">Sub_Pad</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1274_13">Sub_Pad</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1467_14" HREF="terminal_interface-curses__ads.htm#ref_1285_14">Refresh</A></FONT> -- (<FONT COLOR=red><A NAME="ref_1468_7" HREF="terminal_interface-curses__ads.htm#ref_1286_7">Pad</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- <FONT COLOR=red><A NAME="ref_1469_7" HREF="terminal_interface-curses__ads.htm#ref_1287_7">Source_Top_Row</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_1470_7" HREF="terminal_interface-curses__ads.htm#ref_1288_7">Source_Left_Column</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -- <FONT COLOR=red><A NAME="ref_1471_7" HREF="terminal_interface-curses__ads.htm#ref_1289_7">Destination_Top_Row</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_1472_7" HREF="terminal_interface-curses__ads.htm#ref_1290_7">Destination_Left_Column</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -- <FONT COLOR=red><A NAME="ref_1473_7" HREF="terminal_interface-curses__ads.htm#ref_1291_7">Destination_Bottom_Row</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_1474_7" HREF="terminal_interface-curses__ads.htm#ref_1292_7">Destination_Right_Column</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>) -- <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1476_16">Prefresh</A></FONT> -- (<FONT COLOR=red><A NAME="ref_1477_10" HREF="terminal_interface-curses__adb.htm#ref_1476_16">Pad</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- <FONT COLOR=red><A NAME="ref_1478_10" HREF="terminal_interface-curses__adb.htm#ref_1476_16">Source_Top_Row</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -- <FONT COLOR=red><A NAME="ref_1479_10" HREF="terminal_interface-curses__adb.htm#ref_1476_16">Source_Left_Column</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -- <FONT COLOR=red><A NAME="ref_1480_10" HREF="terminal_interface-curses__adb.htm#ref_1476_16">Destination_Top_Row</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -- <FONT COLOR=red><A NAME="ref_1481_10" HREF="terminal_interface-curses__adb.htm#ref_1476_16">Destination_Left_Column</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -- <FONT COLOR=red><A NAME="ref_1482_10" HREF="terminal_interface-curses__adb.htm#ref_1476_16">Destination_Bottom_Row</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -- <FONT COLOR=red><A NAME="ref_1483_10" HREF="terminal_interface-curses__adb.htm#ref_1476_16">Destination_Right_Column</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1467_14" HREF="terminal_interface-curses__ads.htm#ref_1284_14">Refresh</A></span> -+ (<span class="symbol"><A NAME="ref_1468_7" HREF="terminal_interface-curses__ads.htm#ref_1285_7">Pad</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="symbol"><A NAME="ref_1469_7" HREF="terminal_interface-curses__ads.htm#ref_1286_7">Source_Top_Row</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_1470_7" HREF="terminal_interface-curses__ads.htm#ref_1287_7">Source_Left_Column</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -+ <span class="symbol"><A NAME="ref_1471_7" HREF="terminal_interface-curses__ads.htm#ref_1288_7">Destination_Top_Row</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_1472_7" HREF="terminal_interface-curses__ads.htm#ref_1289_7">Destination_Left_Column</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -+ <span class="symbol"><A NAME="ref_1473_7" HREF="terminal_interface-curses__ads.htm#ref_1290_7">Destination_Bottom_Row</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_1474_7" HREF="terminal_interface-curses__ads.htm#ref_1291_7">Destination_Right_Column</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>) -+ <b>is</b> -+ <b>function</b> <span class="symbol"><A NAME="ref_1476_16">Prefresh</A></span> -+ (<span class="symbol"><A NAME="ref_1477_10" HREF="terminal_interface-curses__adb.htm#ref_1476_16">Pad</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="symbol"><A NAME="ref_1478_10" HREF="terminal_interface-curses__adb.htm#ref_1476_16">Source_Top_Row</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <span class="symbol"><A NAME="ref_1479_10" HREF="terminal_interface-curses__adb.htm#ref_1476_16">Source_Left_Column</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <span class="symbol"><A NAME="ref_1480_10" HREF="terminal_interface-curses__adb.htm#ref_1476_16">Destination_Top_Row</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <span class="symbol"><A NAME="ref_1481_10" HREF="terminal_interface-curses__adb.htm#ref_1476_16">Destination_Left_Column</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <span class="symbol"><A NAME="ref_1482_10" HREF="terminal_interface-curses__adb.htm#ref_1476_16">Destination_Bottom_Row</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <span class="symbol"><A NAME="ref_1483_10" HREF="terminal_interface-curses__adb.htm#ref_1476_16">Destination_Right_Column</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Prefresh, "prefresh"); - <b>begin</b> -- <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1476_16">Prefresh</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1286_7">Pad</A>, -- <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1287_7">Source_Top_Row</A>), -- <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1288_7">Source_Left_Column</A>), -- <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1289_7">Destination_Top_Row</A>), -- <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1290_7">Destination_Left_Column</A>), -- <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1291_7">Destination_Bottom_Row</A>), -- <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1292_7">Destination_Right_Column</A>)) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -- <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1285_14">Refresh</A>; -- -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1497_14" HREF="terminal_interface-curses__ads.htm#ref_1297_14">Refresh_Without_Update</A></FONT> -- (<FONT COLOR=red><A NAME="ref_1498_7" HREF="terminal_interface-curses__ads.htm#ref_1298_7">Pad</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- <FONT COLOR=red><A NAME="ref_1499_7" HREF="terminal_interface-curses__ads.htm#ref_1299_7">Source_Top_Row</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_1500_7" HREF="terminal_interface-curses__ads.htm#ref_1300_7">Source_Left_Column</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -- <FONT COLOR=red><A NAME="ref_1501_7" HREF="terminal_interface-curses__ads.htm#ref_1301_7">Destination_Top_Row</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_1502_7" HREF="terminal_interface-curses__ads.htm#ref_1302_7">Destination_Left_Column</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -- <FONT COLOR=red><A NAME="ref_1503_7" HREF="terminal_interface-curses__ads.htm#ref_1303_7">Destination_Bottom_Row</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_1504_7" HREF="terminal_interface-curses__ads.htm#ref_1304_7">Destination_Right_Column</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>) -- <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1506_16">Pnoutrefresh</A></FONT> -- (<FONT COLOR=red><A NAME="ref_1507_10" HREF="terminal_interface-curses__adb.htm#ref_1506_16">Pad</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- <FONT COLOR=red><A NAME="ref_1508_10" HREF="terminal_interface-curses__adb.htm#ref_1506_16">Source_Top_Row</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -- <FONT COLOR=red><A NAME="ref_1509_10" HREF="terminal_interface-curses__adb.htm#ref_1506_16">Source_Left_Column</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -- <FONT COLOR=red><A NAME="ref_1510_10" HREF="terminal_interface-curses__adb.htm#ref_1506_16">Destination_Top_Row</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -- <FONT COLOR=red><A NAME="ref_1511_10" HREF="terminal_interface-curses__adb.htm#ref_1506_16">Destination_Left_Column</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -- <FONT COLOR=red><A NAME="ref_1512_10" HREF="terminal_interface-curses__adb.htm#ref_1506_16">Destination_Bottom_Row</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -- <FONT COLOR=red><A NAME="ref_1513_10" HREF="terminal_interface-curses__adb.htm#ref_1506_16">Destination_Right_Column</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1476_16">Prefresh</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1285_7">Pad</A>, -+ <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1286_7">Source_Top_Row</A>), -+ <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1287_7">Source_Left_Column</A>), -+ <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1288_7">Destination_Top_Row</A>), -+ <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1289_7">Destination_Left_Column</A>), -+ <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1290_7">Destination_Bottom_Row</A>), -+ <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1291_7">Destination_Right_Column</A>)) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; -+ <b>end</b> <b>if</b>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1284_14">Refresh</A>; -+ -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1497_14" HREF="terminal_interface-curses__ads.htm#ref_1296_14">Refresh_Without_Update</A></span> -+ (<span class="symbol"><A NAME="ref_1498_7" HREF="terminal_interface-curses__ads.htm#ref_1297_7">Pad</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="symbol"><A NAME="ref_1499_7" HREF="terminal_interface-curses__ads.htm#ref_1298_7">Source_Top_Row</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_1500_7" HREF="terminal_interface-curses__ads.htm#ref_1299_7">Source_Left_Column</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -+ <span class="symbol"><A NAME="ref_1501_7" HREF="terminal_interface-curses__ads.htm#ref_1300_7">Destination_Top_Row</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_1502_7" HREF="terminal_interface-curses__ads.htm#ref_1301_7">Destination_Left_Column</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -+ <span class="symbol"><A NAME="ref_1503_7" HREF="terminal_interface-curses__ads.htm#ref_1302_7">Destination_Bottom_Row</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_1504_7" HREF="terminal_interface-curses__ads.htm#ref_1303_7">Destination_Right_Column</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>) -+ <b>is</b> -+ <b>function</b> <span class="symbol"><A NAME="ref_1506_16">Pnoutrefresh</A></span> -+ (<span class="symbol"><A NAME="ref_1507_10" HREF="terminal_interface-curses__adb.htm#ref_1506_16">Pad</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="symbol"><A NAME="ref_1508_10" HREF="terminal_interface-curses__adb.htm#ref_1506_16">Source_Top_Row</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <span class="symbol"><A NAME="ref_1509_10" HREF="terminal_interface-curses__adb.htm#ref_1506_16">Source_Left_Column</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <span class="symbol"><A NAME="ref_1510_10" HREF="terminal_interface-curses__adb.htm#ref_1506_16">Destination_Top_Row</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <span class="symbol"><A NAME="ref_1511_10" HREF="terminal_interface-curses__adb.htm#ref_1506_16">Destination_Left_Column</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <span class="symbol"><A NAME="ref_1512_10" HREF="terminal_interface-curses__adb.htm#ref_1506_16">Destination_Bottom_Row</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <span class="symbol"><A NAME="ref_1513_10" HREF="terminal_interface-curses__adb.htm#ref_1506_16">Destination_Right_Column</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Pnoutrefresh, "pnoutrefresh"); - <b>begin</b> -- <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1506_16">Pnoutrefresh</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1298_7">Pad</A>, -- <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1299_7">Source_Top_Row</A>), -- <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1300_7">Source_Left_Column</A>), -- <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1301_7">Destination_Top_Row</A>), -- <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1302_7">Destination_Left_Column</A>), -- <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1303_7">Destination_Bottom_Row</A>), -- <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1304_7">Destination_Right_Column</A>)) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -- <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1297_14">Refresh_Without_Update</A>; -- -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1527_14" HREF="terminal_interface-curses__ads.htm#ref_1309_14">Add_Character_To_Pad_And_Echo_It</A></FONT> -- (<FONT COLOR=red><A NAME="ref_1528_7" HREF="terminal_interface-curses__ads.htm#ref_1310_7">Pad</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- <FONT COLOR=red><A NAME="ref_1529_7" HREF="terminal_interface-curses__ads.htm#ref_1311_7">Ch</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_354_9">Attributed_Character</A>) -+ <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1506_16">Pnoutrefresh</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1297_7">Pad</A>, -+ <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1298_7">Source_Top_Row</A>), -+ <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1299_7">Source_Left_Column</A>), -+ <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1300_7">Destination_Top_Row</A>), -+ <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1301_7">Destination_Left_Column</A>), -+ <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1302_7">Destination_Bottom_Row</A>), -+ <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1303_7">Destination_Right_Column</A>)) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; -+ <b>end</b> <b>if</b>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1296_14">Refresh_Without_Update</A>; -+ -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1527_14" HREF="terminal_interface-curses__ads.htm#ref_1308_14">Add_Character_To_Pad_And_Echo_It</A></span> -+ (<span class="symbol"><A NAME="ref_1528_7" HREF="terminal_interface-curses__ads.htm#ref_1309_7">Pad</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="symbol"><A NAME="ref_1529_7" HREF="terminal_interface-curses__ads.htm#ref_1310_7">Ch</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_353_9">Attributed_Character</A>) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1531_16">Pechochar</A></FONT> (<FONT COLOR=red><A NAME="ref_1531_27" HREF="terminal_interface-curses__adb.htm#ref_1531_16">Pad</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; <FONT COLOR=red><A NAME="ref_1531_41" HREF="terminal_interface-curses__adb.htm#ref_1531_16">Ch</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_12">C_Chtype</A>) -+ <b>function</b> <span class="symbol"><A NAME="ref_1531_16">Pechochar</A></span> (<span class="symbol"><A NAME="ref_1531_27" HREF="terminal_interface-curses__adb.htm#ref_1531_16">Pad</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; <span class="symbol"><A NAME="ref_1531_41" HREF="terminal_interface-curses__adb.htm#ref_1531_16">Ch</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_12">C_Chtype</A>) - <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Pechochar, "pechochar"); - <b>begin</b> -- <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1531_16">Pechochar</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1310_7">Pad</A>, <A HREF="terminal_interface-curses-aux__ads.htm#ref_75_4">AttrChar_To_Chtype</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1311_7">Ch</A>)) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1531_16">Pechochar</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1309_7">Pad</A>, <A HREF="terminal_interface-curses-aux__ads.htm#ref_75_4">AttrChar_To_Chtype</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1310_7">Ch</A>)) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1309_14">Add_Character_To_Pad_And_Echo_It</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1308_14">Add_Character_To_Pad_And_Echo_It</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1540_14" HREF="terminal_interface-curses__ads.htm#ref_1314_14">Add_Character_To_Pad_And_Echo_It</A></FONT> -- (<FONT COLOR=red><A NAME="ref_1541_7" HREF="terminal_interface-curses__ads.htm#ref_1315_7">Pad</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- <FONT COLOR=red><A NAME="ref_1542_7" HREF="terminal_interface-curses__ads.htm#ref_1316_7">Ch</A></FONT> : Character) -- <b>is</b> -- <b>begin</b> -- <A HREF="terminal_interface-curses__ads.htm#ref_1309_14">Add_Character_To_Pad_And_Echo_It</A> -- (<A HREF="terminal_interface-curses__ads.htm#ref_1315_7">Pad</A>, -- <A HREF="terminal_interface-curses__ads.htm#ref_354_9">Attributed_Character</A>'(<A HREF="terminal_interface-curses__ads.htm#ref_358_10">Ch</A> =&gt; <A HREF="terminal_interface-curses__ads.htm#ref_1316_7">Ch</A>, -- <A HREF="terminal_interface-curses__ads.htm#ref_357_10">Color</A> =&gt; <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>'First, -- <A HREF="terminal_interface-curses__ads.htm#ref_356_10">Attr</A> =&gt; <A HREF="terminal_interface-curses__ads.htm#ref_352_4">Normal_Video</A>)); -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1314_14">Add_Character_To_Pad_And_Echo_It</A>; --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1552_14" HREF="terminal_interface-curses__ads.htm#ref_1324_14">Scroll</A></FONT> (<FONT COLOR=red><A NAME="ref_1552_22" HREF="terminal_interface-curses__ads.htm#ref_1324_22">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_1553_22" HREF="terminal_interface-curses__ads.htm#ref_1325_22">Amount</A></FONT> : Integer := 1) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1540_14" HREF="terminal_interface-curses__ads.htm#ref_1313_14">Add_Character_To_Pad_And_Echo_It</A></span> -+ (<span class="symbol"><A NAME="ref_1541_7" HREF="terminal_interface-curses__ads.htm#ref_1314_7">Pad</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="symbol"><A NAME="ref_1542_7" HREF="terminal_interface-curses__ads.htm#ref_1315_7">Ch</A></span> : Character) -+ <b>is</b> -+ <b>begin</b> -+ <A HREF="terminal_interface-curses__ads.htm#ref_1308_14">Add_Character_To_Pad_And_Echo_It</A> -+ (<A HREF="terminal_interface-curses__ads.htm#ref_1314_7">Pad</A>, -+ <A HREF="terminal_interface-curses__ads.htm#ref_353_9">Attributed_Character</A>'(<A HREF="terminal_interface-curses__ads.htm#ref_357_10">Ch</A> =&gt; <A HREF="terminal_interface-curses__ads.htm#ref_1315_7">Ch</A>, -+ <A HREF="terminal_interface-curses__ads.htm#ref_356_10">Color</A> =&gt; <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>'First, -+ <A HREF="terminal_interface-curses__ads.htm#ref_355_10">Attr</A> =&gt; <A HREF="terminal_interface-curses__ads.htm#ref_351_4">Normal_Video</A>)); -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1313_14">Add_Character_To_Pad_And_Echo_It</A>; -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1552_14" HREF="terminal_interface-curses__ads.htm#ref_1323_14">Scroll</A></span> (<span class="symbol"><A NAME="ref_1552_22" HREF="terminal_interface-curses__ads.htm#ref_1323_22">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_1553_22" HREF="terminal_interface-curses__ads.htm#ref_1324_22">Amount</A></span> : Integer := 1) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1555_16">Wscrl</A></FONT> (<FONT COLOR=red><A NAME="ref_1555_23" HREF="terminal_interface-curses__adb.htm#ref_1555_16">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; <FONT COLOR=red><A NAME="ref_1555_37" HREF="terminal_interface-curses__adb.htm#ref_1555_16">N</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_1555_16">Wscrl</A></span> (<span class="symbol"><A NAME="ref_1555_23" HREF="terminal_interface-curses__adb.htm#ref_1555_16">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; <span class="symbol"><A NAME="ref_1555_37" HREF="terminal_interface-curses__adb.htm#ref_1555_16">N</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Wscrl, "wscrl"); - - <b>begin</b> -- <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1555_16">Wscrl</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1324_22">Win</A>, <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1325_22">Amount</A>)) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1555_16">Wscrl</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1323_22">Win</A>, <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1324_22">Amount</A>)) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1324_14">Scroll</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1323_14">Scroll</A>; - --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1565_14" HREF="terminal_interface-curses__ads.htm#ref_1336_14">Delete_Character</A></FONT> (<FONT COLOR=red><A NAME="ref_1565_32" HREF="terminal_interface-curses__ads.htm#ref_1336_32">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>) -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1565_14" HREF="terminal_interface-curses__ads.htm#ref_1335_14">Delete_Character</A></span> (<span class="symbol"><A NAME="ref_1565_32" HREF="terminal_interface-curses__ads.htm#ref_1335_32">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1567_16">Wdelch</A></FONT> (<FONT COLOR=red><A NAME="ref_1567_24" HREF="terminal_interface-curses__adb.htm#ref_1567_16">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_1567_16">Wdelch</A></span> (<span class="symbol"><A NAME="ref_1567_24" HREF="terminal_interface-curses__adb.htm#ref_1567_16">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Wdelch, "wdelch"); - <b>begin</b> -- <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1567_16">Wdelch</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1336_32">Win</A>) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1567_16">Wdelch</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1335_32">Win</A>) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1336_14">Delete_Character</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1335_14">Delete_Character</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1575_14" HREF="terminal_interface-curses__ads.htm#ref_1341_14">Delete_Character</A></FONT> -- (<FONT COLOR=red><A NAME="ref_1576_7" HREF="terminal_interface-curses__ads.htm#ref_1342_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_1577_7" HREF="terminal_interface-curses__ads.htm#ref_1343_7">Line</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_1578_7" HREF="terminal_interface-curses__ads.htm#ref_1344_7">Column</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>) -- <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1580_16">Mvwdelch</A></FONT> (<FONT COLOR=red><A NAME="ref_1580_26" HREF="terminal_interface-curses__adb.htm#ref_1580_16">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- <FONT COLOR=red><A NAME="ref_1581_26" HREF="terminal_interface-curses__adb.htm#ref_1580_16">Lin</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -- <FONT COLOR=red><A NAME="ref_1582_26" HREF="terminal_interface-curses__adb.htm#ref_1580_16">Col</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1575_14" HREF="terminal_interface-curses__ads.htm#ref_1340_14">Delete_Character</A></span> -+ (<span class="symbol"><A NAME="ref_1576_7" HREF="terminal_interface-curses__ads.htm#ref_1341_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_1577_7" HREF="terminal_interface-curses__ads.htm#ref_1342_7">Line</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_1578_7" HREF="terminal_interface-curses__ads.htm#ref_1343_7">Column</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>) -+ <b>is</b> -+ <b>function</b> <span class="symbol"><A NAME="ref_1580_16">Mvwdelch</A></span> (<span class="symbol"><A NAME="ref_1580_26" HREF="terminal_interface-curses__adb.htm#ref_1580_16">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="symbol"><A NAME="ref_1581_26" HREF="terminal_interface-curses__adb.htm#ref_1580_16">Lin</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <span class="symbol"><A NAME="ref_1582_26" HREF="terminal_interface-curses__adb.htm#ref_1580_16">Col</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Mvwdelch, "mvwdelch"); - <b>begin</b> -- <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1580_16">Mvwdelch</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1342_7">Win</A>, <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1343_7">Line</A>), <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1344_7">Column</A>)) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1580_16">Mvwdelch</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1341_7">Win</A>, <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1342_7">Line</A>), <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1343_7">Column</A>)) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1341_14">Delete_Character</A>; --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1590_13" HREF="terminal_interface-curses__ads.htm#ref_1354_13">Peek</A></FONT> (<FONT COLOR=red><A NAME="ref_1590_19" HREF="terminal_interface-curses__ads.htm#ref_1354_19">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>) -- <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_354_9">Attributed_Character</A> -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1340_14">Delete_Character</A>; -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_1590_13" HREF="terminal_interface-curses__ads.htm#ref_1353_13">Peek</A></span> (<span class="symbol"><A NAME="ref_1590_19" HREF="terminal_interface-curses__ads.htm#ref_1353_19">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>) -+ <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_353_9">Attributed_Character</A> - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1593_16">Winch</A></FONT> (<FONT COLOR=red><A NAME="ref_1593_23" HREF="terminal_interface-curses__adb.htm#ref_1593_16">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_12">C_Chtype</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_1593_16">Winch</A></span> (<span class="symbol"><A NAME="ref_1593_23" HREF="terminal_interface-curses__adb.htm#ref_1593_16">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_12">C_Chtype</A>; - <b>pragma</b> Import (C, Winch, "winch"); - <b>begin</b> -- <b>return</b> Chtype_To_AttrChar (<A HREF="terminal_interface-curses__adb.htm#ref_1593_16">Winch</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1354_19">Win</A>)); -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1354_13">Peek</A>; -+ <b>return</b> Chtype_To_AttrChar (<A HREF="terminal_interface-curses__adb.htm#ref_1593_16">Winch</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1353_19">Win</A>)); -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1353_13">Peek</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_1599_13" HREF="terminal_interface-curses__ads.htm#ref_1360_13">Peek</A></FONT> -- (<FONT COLOR=red><A NAME="ref_1600_7" HREF="terminal_interface-curses__ads.htm#ref_1361_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_1601_7" HREF="terminal_interface-curses__ads.htm#ref_1362_7">Line</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_1602_7" HREF="terminal_interface-curses__ads.htm#ref_1363_7">Column</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_354_9">Attributed_Character</A> -- <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1604_16">Mvwinch</A></FONT> (<FONT COLOR=red><A NAME="ref_1604_25" HREF="terminal_interface-curses__adb.htm#ref_1604_16">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- <FONT COLOR=red><A NAME="ref_1605_25" HREF="terminal_interface-curses__adb.htm#ref_1604_16">Lin</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -- <FONT COLOR=red><A NAME="ref_1606_25" HREF="terminal_interface-curses__adb.htm#ref_1604_16">Col</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_12">C_Chtype</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_1599_13" HREF="terminal_interface-curses__ads.htm#ref_1359_13">Peek</A></span> -+ (<span class="symbol"><A NAME="ref_1600_7" HREF="terminal_interface-curses__ads.htm#ref_1360_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_1601_7" HREF="terminal_interface-curses__ads.htm#ref_1361_7">Line</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_1602_7" HREF="terminal_interface-curses__ads.htm#ref_1362_7">Column</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_353_9">Attributed_Character</A> -+ <b>is</b> -+ <b>function</b> <span class="symbol"><A NAME="ref_1604_16">Mvwinch</A></span> (<span class="symbol"><A NAME="ref_1604_25" HREF="terminal_interface-curses__adb.htm#ref_1604_16">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="symbol"><A NAME="ref_1605_25" HREF="terminal_interface-curses__adb.htm#ref_1604_16">Lin</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <span class="symbol"><A NAME="ref_1606_25" HREF="terminal_interface-curses__adb.htm#ref_1604_16">Col</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_12">C_Chtype</A>; - <b>pragma</b> Import (C, Mvwinch, "mvwinch"); - <b>begin</b> -- <b>return</b> Chtype_To_AttrChar (<A HREF="terminal_interface-curses__adb.htm#ref_1604_16">Mvwinch</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1361_7">Win</A>, <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1362_7">Line</A>), <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1363_7">Column</A>))); -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1360_13">Peek</A>; --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1612_14" HREF="terminal_interface-curses__ads.htm#ref_1373_14">Insert</A></FONT> (<FONT COLOR=red><A NAME="ref_1612_22" HREF="terminal_interface-curses__ads.htm#ref_1373_22">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_1613_22" HREF="terminal_interface-curses__ads.htm#ref_1374_22">Ch</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_354_9">Attributed_Character</A>) -+ <b>return</b> Chtype_To_AttrChar (<A HREF="terminal_interface-curses__adb.htm#ref_1604_16">Mvwinch</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1360_7">Win</A>, <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1361_7">Line</A>), <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1362_7">Column</A>))); -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1359_13">Peek</A>; -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1612_14" HREF="terminal_interface-curses__ads.htm#ref_1372_14">Insert</A></span> (<span class="symbol"><A NAME="ref_1612_22" HREF="terminal_interface-curses__ads.htm#ref_1372_22">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_1613_22" HREF="terminal_interface-curses__ads.htm#ref_1373_22">Ch</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_353_9">Attributed_Character</A>) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1615_16">Winsch</A></FONT> (<FONT COLOR=red><A NAME="ref_1615_24" HREF="terminal_interface-curses__adb.htm#ref_1615_16">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; <FONT COLOR=red><A NAME="ref_1615_38" HREF="terminal_interface-curses__adb.htm#ref_1615_16">Ch</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_12">C_Chtype</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_1615_16">Winsch</A></span> (<span class="symbol"><A NAME="ref_1615_24" HREF="terminal_interface-curses__adb.htm#ref_1615_16">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; <span class="symbol"><A NAME="ref_1615_38" HREF="terminal_interface-curses__adb.htm#ref_1615_16">Ch</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_12">C_Chtype</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Winsch, "winsch"); - <b>begin</b> -- <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1615_16">Winsch</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1373_22">Win</A>, <A HREF="terminal_interface-curses-aux__ads.htm#ref_75_4">AttrChar_To_Chtype</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1374_22">Ch</A>)) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1615_16">Winsch</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1372_22">Win</A>, <A HREF="terminal_interface-curses-aux__ads.htm#ref_75_4">AttrChar_To_Chtype</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1373_22">Ch</A>)) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1373_14">Insert</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1372_14">Insert</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1623_14" HREF="terminal_interface-curses__ads.htm#ref_1379_14">Insert</A></FONT> -- (<FONT COLOR=red><A NAME="ref_1624_7" HREF="terminal_interface-curses__ads.htm#ref_1379_22">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_1625_7" HREF="terminal_interface-curses__ads.htm#ref_1380_22">Line</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_1626_7" HREF="terminal_interface-curses__ads.htm#ref_1381_22">Column</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -- <FONT COLOR=red><A NAME="ref_1627_7" HREF="terminal_interface-curses__ads.htm#ref_1382_22">Ch</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_354_9">Attributed_Character</A>) -- <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1629_16">Mvwinsch</A></FONT> (<FONT COLOR=red><A NAME="ref_1629_26" HREF="terminal_interface-curses__adb.htm#ref_1629_16">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- <FONT COLOR=red><A NAME="ref_1630_26" HREF="terminal_interface-curses__adb.htm#ref_1629_16">Lin</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -- <FONT COLOR=red><A NAME="ref_1631_26" HREF="terminal_interface-curses__adb.htm#ref_1629_16">Col</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -- <FONT COLOR=red><A NAME="ref_1632_26" HREF="terminal_interface-curses__adb.htm#ref_1629_16">Ch</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_12">C_Chtype</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1623_14" HREF="terminal_interface-curses__ads.htm#ref_1378_14">Insert</A></span> -+ (<span class="symbol"><A NAME="ref_1624_7" HREF="terminal_interface-curses__ads.htm#ref_1378_22">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_1625_7" HREF="terminal_interface-curses__ads.htm#ref_1379_22">Line</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_1626_7" HREF="terminal_interface-curses__ads.htm#ref_1380_22">Column</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -+ <span class="symbol"><A NAME="ref_1627_7" HREF="terminal_interface-curses__ads.htm#ref_1381_22">Ch</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_353_9">Attributed_Character</A>) -+ <b>is</b> -+ <b>function</b> <span class="symbol"><A NAME="ref_1629_16">Mvwinsch</A></span> (<span class="symbol"><A NAME="ref_1629_26" HREF="terminal_interface-curses__adb.htm#ref_1629_16">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="symbol"><A NAME="ref_1630_26" HREF="terminal_interface-curses__adb.htm#ref_1629_16">Lin</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <span class="symbol"><A NAME="ref_1631_26" HREF="terminal_interface-curses__adb.htm#ref_1629_16">Col</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <span class="symbol"><A NAME="ref_1632_26" HREF="terminal_interface-curses__adb.htm#ref_1629_16">Ch</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_12">C_Chtype</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Mvwinsch, "mvwinsch"); - <b>begin</b> -- <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1629_16">Mvwinsch</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1379_22">Win</A>, -- <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1380_22">Line</A>), -- <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1381_22">Column</A>), -- <A HREF="terminal_interface-curses-aux__ads.htm#ref_75_4">AttrChar_To_Chtype</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1382_22">Ch</A>)) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -- <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1379_14">Insert</A>; --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1643_14" HREF="terminal_interface-curses__ads.htm#ref_1391_14">Insert</A></FONT> (<FONT COLOR=red><A NAME="ref_1643_22" HREF="terminal_interface-curses__ads.htm#ref_1391_22">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_1644_22" HREF="terminal_interface-curses__ads.htm#ref_1392_22">Str</A></FONT> : String; -- <FONT COLOR=red><A NAME="ref_1645_22" HREF="terminal_interface-curses__ads.htm#ref_1393_22">Len</A></FONT> : Integer := -1) -- <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1647_16">Winsnstr</A></FONT> (<FONT COLOR=red><A NAME="ref_1647_26" HREF="terminal_interface-curses__adb.htm#ref_1647_16">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- <FONT COLOR=red><A NAME="ref_1648_26" HREF="terminal_interface-curses__adb.htm#ref_1647_16">Str</A></FONT> : char_array; -- <FONT COLOR=red><A NAME="ref_1649_26" HREF="terminal_interface-curses__adb.htm#ref_1647_16">Len</A></FONT> : Integer := -1) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1629_16">Mvwinsch</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1378_22">Win</A>, -+ <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1379_22">Line</A>), -+ <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1380_22">Column</A>), -+ <A HREF="terminal_interface-curses-aux__ads.htm#ref_75_4">AttrChar_To_Chtype</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1381_22">Ch</A>)) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; -+ <b>end</b> <b>if</b>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1378_14">Insert</A>; -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1643_14" HREF="terminal_interface-curses__ads.htm#ref_1390_14">Insert</A></span> (<span class="symbol"><A NAME="ref_1643_22" HREF="terminal_interface-curses__ads.htm#ref_1390_22">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_1644_22" HREF="terminal_interface-curses__ads.htm#ref_1391_22">Str</A></span> : String; -+ <span class="symbol"><A NAME="ref_1645_22" HREF="terminal_interface-curses__ads.htm#ref_1392_22">Len</A></span> : Integer := -1) -+ <b>is</b> -+ <b>function</b> <span class="symbol"><A NAME="ref_1647_16">Winsnstr</A></span> (<span class="symbol"><A NAME="ref_1647_26" HREF="terminal_interface-curses__adb.htm#ref_1647_16">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="symbol"><A NAME="ref_1648_26" HREF="terminal_interface-curses__adb.htm#ref_1647_16">Str</A></span> : char_array; -+ <span class="symbol"><A NAME="ref_1649_26" HREF="terminal_interface-curses__adb.htm#ref_1647_16">Len</A></span> : Integer := -1) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Winsnstr, "winsnstr"); - -- <FONT COLOR=red><A NAME="ref_1652_7">Txt</A></FONT> : char_array (0 .. <A HREF="terminal_interface-curses__ads.htm#ref_1392_22">Str</A>'Length); -- <FONT COLOR=red><A NAME="ref_1653_7">Length</A></FONT> : size_t; -+ <span class="symbol"><A NAME="ref_1652_7">Txt</A></span> : char_array (0 .. <A HREF="terminal_interface-curses__ads.htm#ref_1391_22">Str</A>'Length); -+ <span class="symbol"><A NAME="ref_1653_7">Length</A></span> : size_t; - <b>begin</b> -- To_C (<A HREF="terminal_interface-curses__ads.htm#ref_1392_22">Str</A>, <A HREF="terminal_interface-curses__adb.htm#ref_1652_7">Txt</A>, <A HREF="terminal_interface-curses__adb.htm#ref_1653_7">Length</A>); -- <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1647_16">Winsnstr</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1391_22">Win</A>, <A HREF="terminal_interface-curses__adb.htm#ref_1652_7">Txt</A>, <A HREF="terminal_interface-curses__ads.htm#ref_1393_22">Len</A>) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -- <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1391_14">Insert</A>; -- -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1661_14" HREF="terminal_interface-curses__ads.htm#ref_1400_14">Insert</A></FONT> -- (<FONT COLOR=red><A NAME="ref_1662_7" HREF="terminal_interface-curses__ads.htm#ref_1400_22">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_1663_7" HREF="terminal_interface-curses__ads.htm#ref_1401_22">Line</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_1664_7" HREF="terminal_interface-curses__ads.htm#ref_1402_22">Column</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -- <FONT COLOR=red><A NAME="ref_1665_7" HREF="terminal_interface-curses__ads.htm#ref_1403_22">Str</A></FONT> : String; -- <FONT COLOR=red><A NAME="ref_1666_7" HREF="terminal_interface-curses__ads.htm#ref_1404_22">Len</A></FONT> : Integer := -1) -- <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1668_16">Mvwinsnstr</A></FONT> (<FONT COLOR=red><A NAME="ref_1668_28" HREF="terminal_interface-curses__adb.htm#ref_1668_16">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- <FONT COLOR=red><A NAME="ref_1669_28" HREF="terminal_interface-curses__adb.htm#ref_1668_16">Line</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -- <FONT COLOR=red><A NAME="ref_1670_28" HREF="terminal_interface-curses__adb.htm#ref_1668_16">Column</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -- <FONT COLOR=red><A NAME="ref_1671_28" HREF="terminal_interface-curses__adb.htm#ref_1668_16">Str</A></FONT> : char_array; -- <FONT COLOR=red><A NAME="ref_1672_28" HREF="terminal_interface-curses__adb.htm#ref_1668_16">Len</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ To_C (<A HREF="terminal_interface-curses__ads.htm#ref_1391_22">Str</A>, <A HREF="terminal_interface-curses__adb.htm#ref_1652_7">Txt</A>, <A HREF="terminal_interface-curses__adb.htm#ref_1653_7">Length</A>); -+ <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1647_16">Winsnstr</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1390_22">Win</A>, <A HREF="terminal_interface-curses__adb.htm#ref_1652_7">Txt</A>, <A HREF="terminal_interface-curses__ads.htm#ref_1392_22">Len</A>) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; -+ <b>end</b> <b>if</b>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1390_14">Insert</A>; -+ -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1661_14" HREF="terminal_interface-curses__ads.htm#ref_1399_14">Insert</A></span> -+ (<span class="symbol"><A NAME="ref_1662_7" HREF="terminal_interface-curses__ads.htm#ref_1399_22">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_1663_7" HREF="terminal_interface-curses__ads.htm#ref_1400_22">Line</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_1664_7" HREF="terminal_interface-curses__ads.htm#ref_1401_22">Column</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -+ <span class="symbol"><A NAME="ref_1665_7" HREF="terminal_interface-curses__ads.htm#ref_1402_22">Str</A></span> : String; -+ <span class="symbol"><A NAME="ref_1666_7" HREF="terminal_interface-curses__ads.htm#ref_1403_22">Len</A></span> : Integer := -1) -+ <b>is</b> -+ <b>function</b> <span class="symbol"><A NAME="ref_1668_16">Mvwinsnstr</A></span> (<span class="symbol"><A NAME="ref_1668_28" HREF="terminal_interface-curses__adb.htm#ref_1668_16">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="symbol"><A NAME="ref_1669_28" HREF="terminal_interface-curses__adb.htm#ref_1668_16">Line</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <span class="symbol"><A NAME="ref_1670_28" HREF="terminal_interface-curses__adb.htm#ref_1668_16">Column</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <span class="symbol"><A NAME="ref_1671_28" HREF="terminal_interface-curses__adb.htm#ref_1668_16">Str</A></span> : char_array; -+ <span class="symbol"><A NAME="ref_1672_28" HREF="terminal_interface-curses__adb.htm#ref_1668_16">Len</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Mvwinsnstr, "mvwinsnstr"); - -- <FONT COLOR=red><A NAME="ref_1675_7">Txt</A></FONT> : char_array (0 .. <A HREF="terminal_interface-curses__ads.htm#ref_1403_22">Str</A>'Length); -- <FONT COLOR=red><A NAME="ref_1676_7">Length</A></FONT> : size_t; -+ <span class="symbol"><A NAME="ref_1675_7">Txt</A></span> : char_array (0 .. <A HREF="terminal_interface-curses__ads.htm#ref_1402_22">Str</A>'Length); -+ <span class="symbol"><A NAME="ref_1676_7">Length</A></span> : size_t; - <b>begin</b> -- To_C (<A HREF="terminal_interface-curses__ads.htm#ref_1403_22">Str</A>, <A HREF="terminal_interface-curses__adb.htm#ref_1675_7">Txt</A>, <A HREF="terminal_interface-curses__adb.htm#ref_1676_7">Length</A>); -- <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1668_16">Mvwinsnstr</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1400_22">Win</A>, <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1401_22">Line</A>), <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1402_22">Column</A>), <A HREF="terminal_interface-curses__adb.htm#ref_1675_7">Txt</A>, <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1404_22">Len</A>)) -+ To_C (<A HREF="terminal_interface-curses__ads.htm#ref_1402_22">Str</A>, <A HREF="terminal_interface-curses__adb.htm#ref_1675_7">Txt</A>, <A HREF="terminal_interface-curses__adb.htm#ref_1676_7">Length</A>); -+ <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1668_16">Mvwinsnstr</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1399_22">Win</A>, <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1400_22">Line</A>), <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1401_22">Column</A>), <A HREF="terminal_interface-curses__adb.htm#ref_1675_7">Txt</A>, <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1403_22">Len</A>)) - = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1400_14">Insert</A>; --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1685_14" HREF="terminal_interface-curses__ads.htm#ref_1416_14">Peek</A></FONT> (<FONT COLOR=red><A NAME="ref_1685_20" HREF="terminal_interface-curses__ads.htm#ref_1416_20">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_1686_20" HREF="terminal_interface-curses__ads.htm#ref_1417_20">Str</A></FONT> : <b>out</b> String; -- <FONT COLOR=red><A NAME="ref_1687_20" HREF="terminal_interface-curses__ads.htm#ref_1418_20">Len</A></FONT> : Integer := -1) -- <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1689_16">Winnstr</A></FONT> (<FONT COLOR=red><A NAME="ref_1689_25" HREF="terminal_interface-curses__adb.htm#ref_1689_16">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- <FONT COLOR=red><A NAME="ref_1690_25" HREF="terminal_interface-curses__adb.htm#ref_1689_16">Str</A></FONT> : char_array; -- <FONT COLOR=red><A NAME="ref_1691_25" HREF="terminal_interface-curses__adb.htm#ref_1689_16">Len</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1399_14">Insert</A>; -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1685_14" HREF="terminal_interface-curses__ads.htm#ref_1415_14">Peek</A></span> (<span class="symbol"><A NAME="ref_1685_20" HREF="terminal_interface-curses__ads.htm#ref_1415_20">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_1686_20" HREF="terminal_interface-curses__ads.htm#ref_1416_20">Str</A></span> : <b>out</b> String; -+ <span class="symbol"><A NAME="ref_1687_20" HREF="terminal_interface-curses__ads.htm#ref_1417_20">Len</A></span> : Integer := -1) -+ <b>is</b> -+ <b>function</b> <span class="symbol"><A NAME="ref_1689_16">Winnstr</A></span> (<span class="symbol"><A NAME="ref_1689_25" HREF="terminal_interface-curses__adb.htm#ref_1689_16">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="symbol"><A NAME="ref_1690_25" HREF="terminal_interface-curses__adb.htm#ref_1689_16">Str</A></span> : char_array; -+ <span class="symbol"><A NAME="ref_1691_25" HREF="terminal_interface-curses__adb.htm#ref_1689_16">Len</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Winnstr, "winnstr"); - -- <FONT COLOR=red><A NAME="ref_1694_7">N</A></FONT> : Integer := <A HREF="terminal_interface-curses__ads.htm#ref_1418_20">Len</A>; -- <FONT COLOR=red><A NAME="ref_1695_7">Txt</A></FONT> : char_array (0 .. <A HREF="terminal_interface-curses__ads.htm#ref_1417_20">Str</A>'Length); -- <FONT COLOR=red><A NAME="ref_1696_7">Cnt</A></FONT> : Natural; -+ <span class="symbol"><A NAME="ref_1694_7">N</A></span> : Integer := <A HREF="terminal_interface-curses__ads.htm#ref_1417_20">Len</A>; -+ <span class="symbol"><A NAME="ref_1695_7">Txt</A></span> : char_array (0 .. <A HREF="terminal_interface-curses__ads.htm#ref_1416_20">Str</A>'Length); -+ <span class="symbol"><A NAME="ref_1696_7">Cnt</A></span> : Natural; - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1694_7">N</A> &lt; 0 <b>then</b> -- <A HREF="terminal_interface-curses__adb.htm#ref_1694_7">N</A> := <A HREF="terminal_interface-curses__ads.htm#ref_1417_20">Str</A>'Length; -+ <A HREF="terminal_interface-curses__adb.htm#ref_1694_7">N</A> := <A HREF="terminal_interface-curses__ads.htm#ref_1416_20">Str</A>'Length; - <b>end</b> <b>if</b>; -- <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1694_7">N</A> &gt; <A HREF="terminal_interface-curses__ads.htm#ref_1417_20">Str</A>'Length <b>then</b> -+ <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1694_7">N</A> &gt; <A HREF="terminal_interface-curses__ads.htm#ref_1416_20">Str</A>'Length <b>then</b> - <b>raise</b> Constraint_Error; - <b>end</b> <b>if</b>; -- <A HREF="terminal_interface-curses__adb.htm#ref_1695_7">Txt</A> (0) := <A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>.C.char'First; -- <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1689_16">Winnstr</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1416_20">Win</A>, <A HREF="terminal_interface-curses__adb.htm#ref_1695_7">Txt</A>, <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__adb.htm#ref_1694_7">N</A>)) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -- <b>end</b> <b>if</b>; -- To_Ada (<A HREF="terminal_interface-curses__adb.htm#ref_1695_7">Txt</A>, <A HREF="terminal_interface-curses__ads.htm#ref_1417_20">Str</A>, <A HREF="terminal_interface-curses__adb.htm#ref_1696_7">Cnt</A>, True); -- <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1696_7">Cnt</A> &lt; <A HREF="terminal_interface-curses__ads.htm#ref_1417_20">Str</A>'Length <b>then</b> -- <A HREF="terminal_interface-curses__ads.htm#ref_1417_20">Str</A> ((<A HREF="terminal_interface-curses__ads.htm#ref_1417_20">Str</A>'First + <A HREF="terminal_interface-curses__adb.htm#ref_1696_7">Cnt</A>) .. <A HREF="terminal_interface-curses__ads.htm#ref_1417_20">Str</A>'Last) := (<b>others</b> =&gt; ' '); -- <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1416_14">Peek</A>; -- -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1714_14" HREF="terminal_interface-curses__ads.htm#ref_1425_14">Peek</A></FONT> -- (<FONT COLOR=red><A NAME="ref_1715_7" HREF="terminal_interface-curses__ads.htm#ref_1425_20">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_1716_7" HREF="terminal_interface-curses__ads.htm#ref_1426_20">Line</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_1717_7" HREF="terminal_interface-curses__ads.htm#ref_1427_20">Column</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -- <FONT COLOR=red><A NAME="ref_1718_7" HREF="terminal_interface-curses__ads.htm#ref_1428_20">Str</A></FONT> : <b>out</b> String; -- <FONT COLOR=red><A NAME="ref_1719_7" HREF="terminal_interface-curses__ads.htm#ref_1429_20">Len</A></FONT> : Integer := -1) -- <b>is</b> -- <b>begin</b> -- <A HREF="terminal_interface-curses__ads.htm#ref_513_14">Move_Cursor</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1425_20">Win</A>, <A HREF="terminal_interface-curses__ads.htm#ref_1426_20">Line</A>, <A HREF="terminal_interface-curses__ads.htm#ref_1427_20">Column</A>); -- <A HREF="terminal_interface-curses__ads.htm#ref_1416_14">Peek</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1425_20">Win</A>, <A HREF="terminal_interface-curses__ads.htm#ref_1428_20">Str</A>, <A HREF="terminal_interface-curses__ads.htm#ref_1429_20">Len</A>); -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1425_14">Peek</A>; --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1726_14" HREF="terminal_interface-curses__ads.htm#ref_1440_14">Peek</A></FONT> -- (<FONT COLOR=red><A NAME="ref_1727_7" HREF="terminal_interface-curses__ads.htm#ref_1440_20">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_1728_7" HREF="terminal_interface-curses__ads.htm#ref_1441_20">Str</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_373_4">Attributed_String</A>; -- <FONT COLOR=red><A NAME="ref_1729_7" HREF="terminal_interface-curses__ads.htm#ref_1442_20">Len</A></FONT> : Integer := -1) -- <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1731_16">Winchnstr</A></FONT> (<FONT COLOR=red><A NAME="ref_1731_27" HREF="terminal_interface-curses__adb.htm#ref_1731_16">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- <FONT COLOR=red><A NAME="ref_1732_27" HREF="terminal_interface-curses__adb.htm#ref_1731_16">Str</A></FONT> : chtype_array; <FONT COLOR=green><EM>-- out</EM></FONT> -- <FONT COLOR=red><A NAME="ref_1733_27" HREF="terminal_interface-curses__adb.htm#ref_1731_16">Len</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <A HREF="terminal_interface-curses__adb.htm#ref_1695_7">Txt</A> (0) := <A HREF="interfac__ads.htm#ref_36_9">Interfaces</A>.C.char'First; -+ <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1689_16">Winnstr</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1415_20">Win</A>, <A HREF="terminal_interface-curses__adb.htm#ref_1695_7">Txt</A>, <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__adb.htm#ref_1694_7">N</A>)) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; -+ <b>end</b> <b>if</b>; -+ To_Ada (<A HREF="terminal_interface-curses__adb.htm#ref_1695_7">Txt</A>, <A HREF="terminal_interface-curses__ads.htm#ref_1416_20">Str</A>, <A HREF="terminal_interface-curses__adb.htm#ref_1696_7">Cnt</A>, True); -+ <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1696_7">Cnt</A> &lt; <A HREF="terminal_interface-curses__ads.htm#ref_1416_20">Str</A>'Length <b>then</b> -+ <A HREF="terminal_interface-curses__ads.htm#ref_1416_20">Str</A> ((<A HREF="terminal_interface-curses__ads.htm#ref_1416_20">Str</A>'First + <A HREF="terminal_interface-curses__adb.htm#ref_1696_7">Cnt</A>) .. <A HREF="terminal_interface-curses__ads.htm#ref_1416_20">Str</A>'Last) := (<b>others</b> =&gt; ' '); -+ <b>end</b> <b>if</b>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1415_14">Peek</A>; -+ -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1714_14" HREF="terminal_interface-curses__ads.htm#ref_1424_14">Peek</A></span> -+ (<span class="symbol"><A NAME="ref_1715_7" HREF="terminal_interface-curses__ads.htm#ref_1424_20">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_1716_7" HREF="terminal_interface-curses__ads.htm#ref_1425_20">Line</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_1717_7" HREF="terminal_interface-curses__ads.htm#ref_1426_20">Column</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -+ <span class="symbol"><A NAME="ref_1718_7" HREF="terminal_interface-curses__ads.htm#ref_1427_20">Str</A></span> : <b>out</b> String; -+ <span class="symbol"><A NAME="ref_1719_7" HREF="terminal_interface-curses__ads.htm#ref_1428_20">Len</A></span> : Integer := -1) -+ <b>is</b> -+ <b>begin</b> -+ <A HREF="terminal_interface-curses__ads.htm#ref_512_14">Move_Cursor</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1424_20">Win</A>, <A HREF="terminal_interface-curses__ads.htm#ref_1425_20">Line</A>, <A HREF="terminal_interface-curses__ads.htm#ref_1426_20">Column</A>); -+ <A HREF="terminal_interface-curses__ads.htm#ref_1415_14">Peek</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1424_20">Win</A>, <A HREF="terminal_interface-curses__ads.htm#ref_1427_20">Str</A>, <A HREF="terminal_interface-curses__ads.htm#ref_1428_20">Len</A>); -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1424_14">Peek</A>; -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1726_14" HREF="terminal_interface-curses__ads.htm#ref_1439_14">Peek</A></span> -+ (<span class="symbol"><A NAME="ref_1727_7" HREF="terminal_interface-curses__ads.htm#ref_1439_20">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_1728_7" HREF="terminal_interface-curses__ads.htm#ref_1440_20">Str</A></span> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_372_4">Attributed_String</A>; -+ <span class="symbol"><A NAME="ref_1729_7" HREF="terminal_interface-curses__ads.htm#ref_1441_20">Len</A></span> : Integer := -1) -+ <b>is</b> -+ <b>function</b> <span class="symbol"><A NAME="ref_1731_16">Winchnstr</A></span> (<span class="symbol"><A NAME="ref_1731_27" HREF="terminal_interface-curses__adb.htm#ref_1731_16">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="symbol"><A NAME="ref_1732_27" HREF="terminal_interface-curses__adb.htm#ref_1731_16">Str</A></span> : chtype_array; <span class="comment"><EM>-- out</EM></span> -+ <span class="symbol"><A NAME="ref_1733_27" HREF="terminal_interface-curses__adb.htm#ref_1731_16">Len</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Winchnstr, "winchnstr"); - -- <FONT COLOR=red><A NAME="ref_1736_7">N</A></FONT> : Integer := <A HREF="terminal_interface-curses__ads.htm#ref_1442_20">Len</A>; -- <FONT COLOR=red><A NAME="ref_1737_7">Txt</A></FONT> : <b>constant</b> chtype_array (0 .. <A HREF="terminal_interface-curses__ads.htm#ref_1441_20">Str</A>'Length) -- := (0 =&gt; <A HREF="terminal_interface-curses__ads.htm#ref_373_4">Default_Character</A>); -- <FONT COLOR=red><A NAME="ref_1739_7">Cnt</A></FONT> : Natural := 0; -+ <span class="symbol"><A NAME="ref_1736_7">N</A></span> : Integer := <A HREF="terminal_interface-curses__ads.htm#ref_1441_20">Len</A>; -+ <span class="symbol"><A NAME="ref_1737_7">Txt</A></span> : <b>constant</b> chtype_array (0 .. <A HREF="terminal_interface-curses__ads.htm#ref_1440_20">Str</A>'Length) -+ := (0 =&gt; <A HREF="terminal_interface-curses__ads.htm#ref_372_4">Default_Character</A>); -+ <span class="symbol"><A NAME="ref_1739_7">Cnt</A></span> : Natural := 0; - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1736_7">N</A> &lt; 0 <b>then</b> -- <A HREF="terminal_interface-curses__adb.htm#ref_1736_7">N</A> := <A HREF="terminal_interface-curses__ads.htm#ref_1441_20">Str</A>'Length; -+ <A HREF="terminal_interface-curses__adb.htm#ref_1736_7">N</A> := <A HREF="terminal_interface-curses__ads.htm#ref_1440_20">Str</A>'Length; - <b>end</b> <b>if</b>; -- <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1736_7">N</A> &gt; <A HREF="terminal_interface-curses__ads.htm#ref_1441_20">Str</A>'Length <b>then</b> -+ <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1736_7">N</A> &gt; <A HREF="terminal_interface-curses__ads.htm#ref_1440_20">Str</A>'Length <b>then</b> - <b>raise</b> Constraint_Error; - <b>end</b> <b>if</b>; -- <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1731_16">Winchnstr</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1440_20">Win</A>, <A HREF="terminal_interface-curses__adb.htm#ref_1737_7">Txt</A>, <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__adb.htm#ref_1736_7">N</A>)) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1731_16">Winchnstr</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1439_20">Win</A>, <A HREF="terminal_interface-curses__adb.htm#ref_1737_7">Txt</A>, <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__adb.htm#ref_1736_7">N</A>)) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; -- <b>for</b> <FONT COLOR=red><A NAME="ref_1750_11">To</A></FONT> <b>in</b> <A HREF="terminal_interface-curses__ads.htm#ref_1441_20">Str</A>'<b>Range</b> <b>loop</b> -- <b>exit</b> <b>when</b> <A HREF="terminal_interface-curses__adb.htm#ref_1737_7">Txt</A> (size_t (<A HREF="terminal_interface-curses__adb.htm#ref_1739_7">Cnt</A>)) = <A HREF="terminal_interface-curses__ads.htm#ref_373_4">Default_Character</A>; -- <A HREF="terminal_interface-curses__ads.htm#ref_1441_20">Str</A> (<A HREF="terminal_interface-curses__adb.htm#ref_1750_11">To</A>) := <A HREF="terminal_interface-curses__adb.htm#ref_1737_7">Txt</A> (size_t (<A HREF="terminal_interface-curses__adb.htm#ref_1739_7">Cnt</A>)); -+ <b>for</b> <span class="symbol"><A NAME="ref_1750_11">To</A></span> <b>in</b> <A HREF="terminal_interface-curses__ads.htm#ref_1440_20">Str</A>'<b>Range</b> <b>loop</b> -+ <b>exit</b> <b>when</b> <A HREF="terminal_interface-curses__adb.htm#ref_1737_7">Txt</A> (size_t (<A HREF="terminal_interface-curses__adb.htm#ref_1739_7">Cnt</A>)) = <A HREF="terminal_interface-curses__ads.htm#ref_372_4">Default_Character</A>; -+ <A HREF="terminal_interface-curses__ads.htm#ref_1440_20">Str</A> (<A HREF="terminal_interface-curses__adb.htm#ref_1750_11">To</A>) := <A HREF="terminal_interface-curses__adb.htm#ref_1737_7">Txt</A> (size_t (<A HREF="terminal_interface-curses__adb.htm#ref_1739_7">Cnt</A>)); - <A HREF="terminal_interface-curses__adb.htm#ref_1739_7">Cnt</A> := <A HREF="terminal_interface-curses__adb.htm#ref_1739_7">Cnt</A> + 1; - <b>end</b> <b>loop</b>; -- <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1739_7">Cnt</A> &lt; <A HREF="terminal_interface-curses__ads.htm#ref_1441_20">Str</A>'Length <b>then</b> -- <A HREF="terminal_interface-curses__ads.htm#ref_1441_20">Str</A> ((<A HREF="terminal_interface-curses__ads.htm#ref_1441_20">Str</A>'First + <A HREF="terminal_interface-curses__adb.htm#ref_1739_7">Cnt</A>) .. <A HREF="terminal_interface-curses__ads.htm#ref_1441_20">Str</A>'Last) := -- (<b>others</b> =&gt; (<A HREF="terminal_interface-curses__ads.htm#ref_358_10">Ch</A> =&gt; ' ', -- <A HREF="terminal_interface-curses__ads.htm#ref_357_10">Color</A> =&gt; <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>'First, -- <A HREF="terminal_interface-curses__ads.htm#ref_356_10">Attr</A> =&gt; <A HREF="terminal_interface-curses__ads.htm#ref_352_4">Normal_Video</A>)); -- <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1440_14">Peek</A>; -- -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1763_14" HREF="terminal_interface-curses__ads.htm#ref_1449_14">Peek</A></FONT> -- (<FONT COLOR=red><A NAME="ref_1764_7" HREF="terminal_interface-curses__ads.htm#ref_1449_20">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_1765_7" HREF="terminal_interface-curses__ads.htm#ref_1450_20">Line</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_1766_7" HREF="terminal_interface-curses__ads.htm#ref_1451_20">Column</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -- <FONT COLOR=red><A NAME="ref_1767_7" HREF="terminal_interface-curses__ads.htm#ref_1452_20">Str</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_373_4">Attributed_String</A>; -- <FONT COLOR=red><A NAME="ref_1768_7" HREF="terminal_interface-curses__ads.htm#ref_1453_20">Len</A></FONT> : Integer := -1) -- <b>is</b> -- <b>begin</b> -- <A HREF="terminal_interface-curses__ads.htm#ref_513_14">Move_Cursor</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1449_20">Win</A>, <A HREF="terminal_interface-curses__ads.htm#ref_1450_20">Line</A>, <A HREF="terminal_interface-curses__ads.htm#ref_1451_20">Column</A>); -- <A HREF="terminal_interface-curses__ads.htm#ref_1440_14">Peek</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1449_20">Win</A>, <A HREF="terminal_interface-curses__ads.htm#ref_1452_20">Str</A>, <A HREF="terminal_interface-curses__ads.htm#ref_1453_20">Len</A>); -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1449_14">Peek</A>; --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1775_14" HREF="terminal_interface-curses__ads.htm#ref_1465_14">Get</A></FONT> (<FONT COLOR=red><A NAME="ref_1775_19" HREF="terminal_interface-curses__ads.htm#ref_1465_19">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_1776_19" HREF="terminal_interface-curses__ads.htm#ref_1466_19">Str</A></FONT> : <b>out</b> String; -- <FONT COLOR=red><A NAME="ref_1777_19" HREF="terminal_interface-curses__ads.htm#ref_1467_19">Len</A></FONT> : Integer := -1) -- <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1779_16">Wgetnstr</A></FONT> (<FONT COLOR=red><A NAME="ref_1779_26" HREF="terminal_interface-curses__adb.htm#ref_1779_16">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- <FONT COLOR=red><A NAME="ref_1780_26" HREF="terminal_interface-curses__adb.htm#ref_1779_16">Str</A></FONT> : char_array; -- <FONT COLOR=red><A NAME="ref_1781_26" HREF="terminal_interface-curses__adb.htm#ref_1779_16">Len</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1739_7">Cnt</A> &lt; <A HREF="terminal_interface-curses__ads.htm#ref_1440_20">Str</A>'Length <b>then</b> -+ <A HREF="terminal_interface-curses__ads.htm#ref_1440_20">Str</A> ((<A HREF="terminal_interface-curses__ads.htm#ref_1440_20">Str</A>'First + <A HREF="terminal_interface-curses__adb.htm#ref_1739_7">Cnt</A>) .. <A HREF="terminal_interface-curses__ads.htm#ref_1440_20">Str</A>'Last) := -+ (<b>others</b> =&gt; (<A HREF="terminal_interface-curses__ads.htm#ref_357_10">Ch</A> =&gt; ' ', -+ <A HREF="terminal_interface-curses__ads.htm#ref_356_10">Color</A> =&gt; <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>'First, -+ <A HREF="terminal_interface-curses__ads.htm#ref_355_10">Attr</A> =&gt; <A HREF="terminal_interface-curses__ads.htm#ref_351_4">Normal_Video</A>)); -+ <b>end</b> <b>if</b>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1439_14">Peek</A>; -+ -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1763_14" HREF="terminal_interface-curses__ads.htm#ref_1448_14">Peek</A></span> -+ (<span class="symbol"><A NAME="ref_1764_7" HREF="terminal_interface-curses__ads.htm#ref_1448_20">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_1765_7" HREF="terminal_interface-curses__ads.htm#ref_1449_20">Line</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_1766_7" HREF="terminal_interface-curses__ads.htm#ref_1450_20">Column</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -+ <span class="symbol"><A NAME="ref_1767_7" HREF="terminal_interface-curses__ads.htm#ref_1451_20">Str</A></span> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_372_4">Attributed_String</A>; -+ <span class="symbol"><A NAME="ref_1768_7" HREF="terminal_interface-curses__ads.htm#ref_1452_20">Len</A></span> : Integer := -1) -+ <b>is</b> -+ <b>begin</b> -+ <A HREF="terminal_interface-curses__ads.htm#ref_512_14">Move_Cursor</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1448_20">Win</A>, <A HREF="terminal_interface-curses__ads.htm#ref_1449_20">Line</A>, <A HREF="terminal_interface-curses__ads.htm#ref_1450_20">Column</A>); -+ <A HREF="terminal_interface-curses__ads.htm#ref_1439_14">Peek</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1448_20">Win</A>, <A HREF="terminal_interface-curses__ads.htm#ref_1451_20">Str</A>, <A HREF="terminal_interface-curses__ads.htm#ref_1452_20">Len</A>); -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1448_14">Peek</A>; -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1775_14" HREF="terminal_interface-curses__ads.htm#ref_1464_14">Get</A></span> (<span class="symbol"><A NAME="ref_1775_19" HREF="terminal_interface-curses__ads.htm#ref_1464_19">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_1776_19" HREF="terminal_interface-curses__ads.htm#ref_1465_19">Str</A></span> : <b>out</b> String; -+ <span class="symbol"><A NAME="ref_1777_19" HREF="terminal_interface-curses__ads.htm#ref_1466_19">Len</A></span> : Integer := -1) -+ <b>is</b> -+ <b>function</b> <span class="symbol"><A NAME="ref_1779_16">Wgetnstr</A></span> (<span class="symbol"><A NAME="ref_1779_26" HREF="terminal_interface-curses__adb.htm#ref_1779_16">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="symbol"><A NAME="ref_1780_26" HREF="terminal_interface-curses__adb.htm#ref_1779_16">Str</A></span> : char_array; -+ <span class="symbol"><A NAME="ref_1781_26" HREF="terminal_interface-curses__adb.htm#ref_1779_16">Len</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Wgetnstr, "wgetnstr"); - -- <FONT COLOR=red><A NAME="ref_1784_7">N</A></FONT> : Integer := <A HREF="terminal_interface-curses__ads.htm#ref_1467_19">Len</A>; -- <FONT COLOR=red><A NAME="ref_1785_7">Txt</A></FONT> : char_array (0 .. <A HREF="terminal_interface-curses__ads.htm#ref_1466_19">Str</A>'Length); -- <FONT COLOR=red><A NAME="ref_1786_7">Cnt</A></FONT> : Natural; -+ <span class="symbol"><A NAME="ref_1784_7">N</A></span> : Integer := <A HREF="terminal_interface-curses__ads.htm#ref_1466_19">Len</A>; -+ <span class="symbol"><A NAME="ref_1785_7">Txt</A></span> : char_array (0 .. <A HREF="terminal_interface-curses__ads.htm#ref_1465_19">Str</A>'Length); -+ <span class="symbol"><A NAME="ref_1786_7">Cnt</A></span> : Natural; - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1784_7">N</A> &lt; 0 <b>then</b> -- <A HREF="terminal_interface-curses__adb.htm#ref_1784_7">N</A> := <A HREF="terminal_interface-curses__ads.htm#ref_1466_19">Str</A>'Length; -+ <A HREF="terminal_interface-curses__adb.htm#ref_1784_7">N</A> := <A HREF="terminal_interface-curses__ads.htm#ref_1465_19">Str</A>'Length; - <b>end</b> <b>if</b>; -- <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1784_7">N</A> &gt; <A HREF="terminal_interface-curses__ads.htm#ref_1466_19">Str</A>'Length <b>then</b> -+ <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1784_7">N</A> &gt; <A HREF="terminal_interface-curses__ads.htm#ref_1465_19">Str</A>'Length <b>then</b> - <b>raise</b> Constraint_Error; - <b>end</b> <b>if</b>; -- <A HREF="terminal_interface-curses__adb.htm#ref_1785_7">Txt</A> (0) := <A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>.C.char'First; -- <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1779_16">Wgetnstr</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1465_19">Win</A>, <A HREF="terminal_interface-curses__adb.htm#ref_1785_7">Txt</A>, <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__adb.htm#ref_1784_7">N</A>)) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -- <b>end</b> <b>if</b>; -- To_Ada (<A HREF="terminal_interface-curses__adb.htm#ref_1785_7">Txt</A>, <A HREF="terminal_interface-curses__ads.htm#ref_1466_19">Str</A>, <A HREF="terminal_interface-curses__adb.htm#ref_1786_7">Cnt</A>, True); -- <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1786_7">Cnt</A> &lt; <A HREF="terminal_interface-curses__ads.htm#ref_1466_19">Str</A>'Length <b>then</b> -- <A HREF="terminal_interface-curses__ads.htm#ref_1466_19">Str</A> ((<A HREF="terminal_interface-curses__ads.htm#ref_1466_19">Str</A>'First + <A HREF="terminal_interface-curses__adb.htm#ref_1786_7">Cnt</A>) .. <A HREF="terminal_interface-curses__ads.htm#ref_1466_19">Str</A>'Last) := (<b>others</b> =&gt; ' '); -- <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1465_14">Get</A>; -- -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1804_14" HREF="terminal_interface-curses__ads.htm#ref_1476_14">Get</A></FONT> -- (<FONT COLOR=red><A NAME="ref_1805_7" HREF="terminal_interface-curses__ads.htm#ref_1476_19">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_1806_7" HREF="terminal_interface-curses__ads.htm#ref_1477_19">Line</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_1807_7" HREF="terminal_interface-curses__ads.htm#ref_1478_19">Column</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -- <FONT COLOR=red><A NAME="ref_1808_7" HREF="terminal_interface-curses__ads.htm#ref_1479_19">Str</A></FONT> : <b>out</b> String; -- <FONT COLOR=red><A NAME="ref_1809_7" HREF="terminal_interface-curses__ads.htm#ref_1480_19">Len</A></FONT> : Integer := -1) -- <b>is</b> -- <b>begin</b> -- <A HREF="terminal_interface-curses__ads.htm#ref_513_14">Move_Cursor</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1476_19">Win</A>, <A HREF="terminal_interface-curses__ads.htm#ref_1477_19">Line</A>, <A HREF="terminal_interface-curses__ads.htm#ref_1478_19">Column</A>); -- <A HREF="terminal_interface-curses__ads.htm#ref_1465_14">Get</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1476_19">Win</A>, <A HREF="terminal_interface-curses__ads.htm#ref_1479_19">Str</A>, <A HREF="terminal_interface-curses__ads.htm#ref_1480_19">Len</A>); -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1476_14">Get</A>; --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1816_14" HREF="terminal_interface-curses__ads.htm#ref_1501_14">Init_Soft_Label_Keys</A></FONT> -- (<FONT COLOR=red><A NAME="ref_1817_7" HREF="terminal_interface-curses__ads.htm#ref_1502_7">Format</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_1493_9">Soft_Label_Key_Format</A> := <A HREF="terminal_interface-curses__ads.htm#ref_1493_35">Three_Two_Three</A>) -+ <A HREF="terminal_interface-curses__adb.htm#ref_1785_7">Txt</A> (0) := <A HREF="interfac__ads.htm#ref_36_9">Interfaces</A>.C.char'First; -+ <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1779_16">Wgetnstr</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1464_19">Win</A>, <A HREF="terminal_interface-curses__adb.htm#ref_1785_7">Txt</A>, <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__adb.htm#ref_1784_7">N</A>)) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; -+ <b>end</b> <b>if</b>; -+ To_Ada (<A HREF="terminal_interface-curses__adb.htm#ref_1785_7">Txt</A>, <A HREF="terminal_interface-curses__ads.htm#ref_1465_19">Str</A>, <A HREF="terminal_interface-curses__adb.htm#ref_1786_7">Cnt</A>, True); -+ <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1786_7">Cnt</A> &lt; <A HREF="terminal_interface-curses__ads.htm#ref_1465_19">Str</A>'Length <b>then</b> -+ <A HREF="terminal_interface-curses__ads.htm#ref_1465_19">Str</A> ((<A HREF="terminal_interface-curses__ads.htm#ref_1465_19">Str</A>'First + <A HREF="terminal_interface-curses__adb.htm#ref_1786_7">Cnt</A>) .. <A HREF="terminal_interface-curses__ads.htm#ref_1465_19">Str</A>'Last) := (<b>others</b> =&gt; ' '); -+ <b>end</b> <b>if</b>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1464_14">Get</A>; -+ -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1804_14" HREF="terminal_interface-curses__ads.htm#ref_1475_14">Get</A></span> -+ (<span class="symbol"><A NAME="ref_1805_7" HREF="terminal_interface-curses__ads.htm#ref_1475_19">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_1806_7" HREF="terminal_interface-curses__ads.htm#ref_1476_19">Line</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_1807_7" HREF="terminal_interface-curses__ads.htm#ref_1477_19">Column</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -+ <span class="symbol"><A NAME="ref_1808_7" HREF="terminal_interface-curses__ads.htm#ref_1478_19">Str</A></span> : <b>out</b> String; -+ <span class="symbol"><A NAME="ref_1809_7" HREF="terminal_interface-curses__ads.htm#ref_1479_19">Len</A></span> : Integer := -1) -+ <b>is</b> -+ <b>begin</b> -+ <A HREF="terminal_interface-curses__ads.htm#ref_512_14">Move_Cursor</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1475_19">Win</A>, <A HREF="terminal_interface-curses__ads.htm#ref_1476_19">Line</A>, <A HREF="terminal_interface-curses__ads.htm#ref_1477_19">Column</A>); -+ <A HREF="terminal_interface-curses__ads.htm#ref_1464_14">Get</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1475_19">Win</A>, <A HREF="terminal_interface-curses__ads.htm#ref_1478_19">Str</A>, <A HREF="terminal_interface-curses__ads.htm#ref_1479_19">Len</A>); -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1475_14">Get</A>; -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1816_14" HREF="terminal_interface-curses__ads.htm#ref_1500_14">Init_Soft_Label_Keys</A></span> -+ (<span class="symbol"><A NAME="ref_1817_7" HREF="terminal_interface-curses__ads.htm#ref_1501_7">Format</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_1492_9">Soft_Label_Key_Format</A> := <A HREF="terminal_interface-curses__ads.htm#ref_1492_35">Three_Two_Three</A>) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1819_16">Slk_Init</A></FONT> (<FONT COLOR=red><A NAME="ref_1819_26" HREF="terminal_interface-curses__adb.htm#ref_1819_16">Fmt</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_1819_16">Slk_Init</A></span> (<span class="symbol"><A NAME="ref_1819_26" HREF="terminal_interface-curses__adb.htm#ref_1819_16">Fmt</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Slk_Init, "slk_init"); - <b>begin</b> -- <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1819_16">Slk_Init</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1493_9">Soft_Label_Key_Format</A>'Pos (<A HREF="terminal_interface-curses__ads.htm#ref_1502_7">Format</A>)) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1819_16">Slk_Init</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1492_9">Soft_Label_Key_Format</A>'Pos (<A HREF="terminal_interface-curses__ads.htm#ref_1501_7">Format</A>)) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1501_14">Init_Soft_Label_Keys</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1500_14">Init_Soft_Label_Keys</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1827_14" HREF="terminal_interface-curses__ads.htm#ref_1507_14">Set_Soft_Label_Key</A></FONT> (<FONT COLOR=red><A NAME="ref_1827_34" HREF="terminal_interface-curses__ads.htm#ref_1507_34">Label</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_1497_9">Label_Number</A>; -- <FONT COLOR=red><A NAME="ref_1828_34" HREF="terminal_interface-curses__ads.htm#ref_1508_34">Text</A></FONT> : String; -- <FONT COLOR=red><A NAME="ref_1829_34" HREF="terminal_interface-curses__ads.htm#ref_1509_34">Fmt</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_1498_9">Label_Justification</A> := <A HREF="terminal_interface-curses__ads.htm#ref_1498_33">Left</A>) -- <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1831_16">Slk_Set</A></FONT> (<FONT COLOR=red><A NAME="ref_1831_25" HREF="terminal_interface-curses__adb.htm#ref_1831_16">Label</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -- <FONT COLOR=red><A NAME="ref_1832_25" HREF="terminal_interface-curses__adb.htm#ref_1831_16">Txt</A></FONT> : char_array; -- <FONT COLOR=red><A NAME="ref_1833_25" HREF="terminal_interface-curses__adb.htm#ref_1831_16">Fmt</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1827_14" HREF="terminal_interface-curses__ads.htm#ref_1506_14">Set_Soft_Label_Key</A></span> (<span class="symbol"><A NAME="ref_1827_34" HREF="terminal_interface-curses__ads.htm#ref_1506_34">Label</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_1496_9">Label_Number</A>; -+ <span class="symbol"><A NAME="ref_1828_34" HREF="terminal_interface-curses__ads.htm#ref_1507_34">Text</A></span> : String; -+ <span class="symbol"><A NAME="ref_1829_34" HREF="terminal_interface-curses__ads.htm#ref_1508_34">Fmt</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_1497_9">Label_Justification</A> := <A HREF="terminal_interface-curses__ads.htm#ref_1497_33">Left</A>) -+ <b>is</b> -+ <b>function</b> <span class="symbol"><A NAME="ref_1831_16">Slk_Set</A></span> (<span class="symbol"><A NAME="ref_1831_25" HREF="terminal_interface-curses__adb.htm#ref_1831_16">Label</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <span class="symbol"><A NAME="ref_1832_25" HREF="terminal_interface-curses__adb.htm#ref_1831_16">Txt</A></span> : char_array; -+ <span class="symbol"><A NAME="ref_1833_25" HREF="terminal_interface-curses__adb.htm#ref_1831_16">Fmt</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Slk_Set, "slk_set"); - -- <FONT COLOR=red><A NAME="ref_1836_7">Txt</A></FONT> : char_array (0 .. <A HREF="terminal_interface-curses__ads.htm#ref_1508_34">Text</A>'Length); -- <FONT COLOR=red><A NAME="ref_1837_7">Len</A></FONT> : size_t; -+ <span class="symbol"><A NAME="ref_1836_7">Txt</A></span> : char_array (0 .. <A HREF="terminal_interface-curses__ads.htm#ref_1507_34">Text</A>'Length); -+ <span class="symbol"><A NAME="ref_1837_7">Len</A></span> : size_t; - <b>begin</b> -- To_C (<A HREF="terminal_interface-curses__ads.htm#ref_1508_34">Text</A>, <A HREF="terminal_interface-curses__adb.htm#ref_1836_7">Txt</A>, <A HREF="terminal_interface-curses__adb.htm#ref_1837_7">Len</A>); -- <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1831_16">Slk_Set</A> (<A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1507_34">Label</A>), <A HREF="terminal_interface-curses__adb.htm#ref_1836_7">Txt</A>, -- <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1498_9">Label_Justification</A>'Pos (<A HREF="terminal_interface-curses__ads.htm#ref_1509_34">Fmt</A>))) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ To_C (<A HREF="terminal_interface-curses__ads.htm#ref_1507_34">Text</A>, <A HREF="terminal_interface-curses__adb.htm#ref_1836_7">Txt</A>, <A HREF="terminal_interface-curses__adb.htm#ref_1837_7">Len</A>); -+ <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1831_16">Slk_Set</A> (<A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1506_34">Label</A>), <A HREF="terminal_interface-curses__adb.htm#ref_1836_7">Txt</A>, -+ <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1497_9">Label_Justification</A>'Pos (<A HREF="terminal_interface-curses__ads.htm#ref_1508_34">Fmt</A>))) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1507_14">Set_Soft_Label_Key</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1506_14">Set_Soft_Label_Key</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1846_14" HREF="terminal_interface-curses__ads.htm#ref_1514_14">Refresh_Soft_Label_Keys</A></FONT> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1846_14" HREF="terminal_interface-curses__ads.htm#ref_1513_14">Refresh_Soft_Label_Keys</A></span> - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1848_16">Slk_Refresh</A></FONT> <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_1848_16">Slk_Refresh</A></span> <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Slk_Refresh, "slk_refresh"); - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1848_16">Slk_Refresh</A> = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1514_14">Refresh_Soft_Label_Keys</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1513_14">Refresh_Soft_Label_Keys</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1856_14" HREF="terminal_interface-curses__ads.htm#ref_1519_14">Refresh_Soft_Label_Keys_Without_Update</A></FONT> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1856_14" HREF="terminal_interface-curses__ads.htm#ref_1518_14">Refresh_Soft_Label_Keys_Without_Update</A></span> - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1858_16">Slk_Noutrefresh</A></FONT> <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_1858_16">Slk_Noutrefresh</A></span> <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Slk_Noutrefresh, "slk_noutrefresh"); - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1858_16">Slk_Noutrefresh</A> = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1519_14">Refresh_Soft_Label_Keys_Without_Update</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1518_14">Refresh_Soft_Label_Keys_Without_Update</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1866_14" HREF="terminal_interface-curses__ads.htm#ref_1524_14">Get_Soft_Label_Key</A></FONT> (<FONT COLOR=red><A NAME="ref_1866_34" HREF="terminal_interface-curses__ads.htm#ref_1524_34">Label</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_1497_9">Label_Number</A>; -- <FONT COLOR=red><A NAME="ref_1867_34" HREF="terminal_interface-curses__ads.htm#ref_1525_34">Text</A></FONT> : <b>out</b> String) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1866_14" HREF="terminal_interface-curses__ads.htm#ref_1523_14">Get_Soft_Label_Key</A></span> (<span class="symbol"><A NAME="ref_1866_34" HREF="terminal_interface-curses__ads.htm#ref_1523_34">Label</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_1496_9">Label_Number</A>; -+ <span class="symbol"><A NAME="ref_1867_34" HREF="terminal_interface-curses__ads.htm#ref_1524_34">Text</A></span> : <b>out</b> String) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1869_16">Slk_Label</A></FONT> (<FONT COLOR=red><A NAME="ref_1869_27" HREF="terminal_interface-curses__adb.htm#ref_1869_16">Label</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> chars_ptr; -+ <b>function</b> <span class="symbol"><A NAME="ref_1869_16">Slk_Label</A></span> (<span class="symbol"><A NAME="ref_1869_27" HREF="terminal_interface-curses__adb.htm#ref_1869_16">Label</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> chars_ptr; - <b>pragma</b> Import (C, Slk_Label, "slk_label"); - <b>begin</b> -- <A HREF="terminal_interface-curses-aux__ads.htm#ref_116_14">Fill_String</A> (<A HREF="terminal_interface-curses__adb.htm#ref_1869_16">Slk_Label</A> (<A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1524_34">Label</A>)), <A HREF="terminal_interface-curses__ads.htm#ref_1525_34">Text</A>); -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1524_14">Get_Soft_Label_Key</A>; -+ <A HREF="terminal_interface-curses-aux__ads.htm#ref_116_14">Fill_String</A> (<A HREF="terminal_interface-curses__adb.htm#ref_1869_16">Slk_Label</A> (<A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1523_34">Label</A>)), <A HREF="terminal_interface-curses__ads.htm#ref_1524_34">Text</A>); -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1523_14">Get_Soft_Label_Key</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_1875_13" HREF="terminal_interface-curses__ads.htm#ref_1529_13">Get_Soft_Label_Key</A></FONT> (<FONT COLOR=red><A NAME="ref_1875_33" HREF="terminal_interface-curses__ads.htm#ref_1529_33">Label</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_1497_9">Label_Number</A>) <b>return</b> String -+ <b>function</b> <span class="symbol"><A NAME="ref_1875_13" HREF="terminal_interface-curses__ads.htm#ref_1528_13">Get_Soft_Label_Key</A></span> (<span class="symbol"><A NAME="ref_1875_33" HREF="terminal_interface-curses__ads.htm#ref_1528_33">Label</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_1496_9">Label_Number</A>) <b>return</b> String - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1877_16">Slk_Label</A></FONT> (<FONT COLOR=red><A NAME="ref_1877_27" HREF="terminal_interface-curses__adb.htm#ref_1877_16">Label</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> chars_ptr; -+ <b>function</b> <span class="symbol"><A NAME="ref_1877_16">Slk_Label</A></span> (<span class="symbol"><A NAME="ref_1877_27" HREF="terminal_interface-curses__adb.htm#ref_1877_16">Label</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> chars_ptr; - <b>pragma</b> Import (C, Slk_Label, "slk_label"); - <b>begin</b> -- <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_121_13">Fill_String</A> (<A HREF="terminal_interface-curses__adb.htm#ref_1877_16">Slk_Label</A> (<A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1529_33">Label</A>))); -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1529_13">Get_Soft_Label_Key</A>; -+ <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_121_13">Fill_String</A> (<A HREF="terminal_interface-curses__adb.htm#ref_1877_16">Slk_Label</A> (<A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1528_33">Label</A>))); -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1528_13">Get_Soft_Label_Key</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1883_14" HREF="terminal_interface-curses__ads.htm#ref_1535_14">Clear_Soft_Label_Keys</A></FONT> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1883_14" HREF="terminal_interface-curses__ads.htm#ref_1534_14">Clear_Soft_Label_Keys</A></span> - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1885_16">Slk_Clear</A></FONT> <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_1885_16">Slk_Clear</A></span> <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Slk_Clear, "slk_clear"); - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1885_16">Slk_Clear</A> = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1535_14">Clear_Soft_Label_Keys</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1534_14">Clear_Soft_Label_Keys</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1893_14" HREF="terminal_interface-curses__ads.htm#ref_1540_14">Restore_Soft_Label_Keys</A></FONT> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1893_14" HREF="terminal_interface-curses__ads.htm#ref_1539_14">Restore_Soft_Label_Keys</A></span> - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1895_16">Slk_Restore</A></FONT> <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_1895_16">Slk_Restore</A></span> <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Slk_Restore, "slk_restore"); - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1895_16">Slk_Restore</A> = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1540_14">Restore_Soft_Label_Keys</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1539_14">Restore_Soft_Label_Keys</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1903_14" HREF="terminal_interface-curses__ads.htm#ref_1545_14">Touch_Soft_Label_Keys</A></FONT> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1903_14" HREF="terminal_interface-curses__ads.htm#ref_1544_14">Touch_Soft_Label_Keys</A></span> - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1905_16">Slk_Touch</A></FONT> <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_1905_16">Slk_Touch</A></span> <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Slk_Touch, "slk_touch"); - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1905_16">Slk_Touch</A> = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1545_14">Touch_Soft_Label_Keys</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1544_14">Touch_Soft_Label_Keys</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1913_14" HREF="terminal_interface-curses__ads.htm#ref_1550_14">Switch_Soft_Label_Key_Attributes</A></FONT> -- (<FONT COLOR=red><A NAME="ref_1914_7" HREF="terminal_interface-curses__ads.htm#ref_1551_7">Attr</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A>; -- <FONT COLOR=red><A NAME="ref_1915_7" HREF="terminal_interface-curses__ads.htm#ref_1552_7">On</A></FONT> : Boolean := True) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1913_14" HREF="terminal_interface-curses__ads.htm#ref_1549_14">Switch_Soft_Label_Key_Attributes</A></span> -+ (<span class="symbol"><A NAME="ref_1914_7" HREF="terminal_interface-curses__ads.htm#ref_1550_7">Attr</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A>; -+ <span class="symbol"><A NAME="ref_1915_7" HREF="terminal_interface-curses__ads.htm#ref_1551_7">On</A></span> : Boolean := True) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1917_16">Slk_Attron</A></FONT> (<FONT COLOR=red><A NAME="ref_1917_28" HREF="terminal_interface-curses__adb.htm#ref_1917_16">Ch</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_12">C_Chtype</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_1917_16">Slk_Attron</A></span> (<span class="symbol"><A NAME="ref_1917_28" HREF="terminal_interface-curses__adb.htm#ref_1917_16">Ch</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_12">C_Chtype</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Slk_Attron, "slk_attron"); -- <b>function</b> <FONT COLOR=red><A NAME="ref_1919_16">Slk_Attroff</A></FONT> (<FONT COLOR=red><A NAME="ref_1919_29" HREF="terminal_interface-curses__adb.htm#ref_1919_16">Ch</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_12">C_Chtype</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_1919_16">Slk_Attroff</A></span> (<span class="symbol"><A NAME="ref_1919_29" HREF="terminal_interface-curses__adb.htm#ref_1919_16">Ch</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_12">C_Chtype</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Slk_Attroff, "slk_attroff"); - -- <FONT COLOR=red><A NAME="ref_1922_7">Err</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -- <FONT COLOR=red><A NAME="ref_1923_7">Ch</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_354_9">Attributed_Character</A> := (<A HREF="terminal_interface-curses__ads.htm#ref_358_10">Ch</A> =&gt; Character'First, -- <A HREF="terminal_interface-curses__ads.htm#ref_356_10">Attr</A> =&gt; <A HREF="terminal_interface-curses__ads.htm#ref_1551_7">Attr</A>, -- <A HREF="terminal_interface-curses__ads.htm#ref_357_10">Color</A> =&gt; <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>'First); -+ <span class="symbol"><A NAME="ref_1922_7">Err</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <span class="symbol"><A NAME="ref_1923_7">Ch</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_353_9">Attributed_Character</A> := (<A HREF="terminal_interface-curses__ads.htm#ref_357_10">Ch</A> =&gt; Character'First, -+ <A HREF="terminal_interface-curses__ads.htm#ref_355_10">Attr</A> =&gt; <A HREF="terminal_interface-curses__ads.htm#ref_1550_7">Attr</A>, -+ <A HREF="terminal_interface-curses__ads.htm#ref_356_10">Color</A> =&gt; <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>'First); - <b>begin</b> -- <b>if</b> <A HREF="terminal_interface-curses__ads.htm#ref_1552_7">On</A> <b>then</b> -+ <b>if</b> <A HREF="terminal_interface-curses__ads.htm#ref_1551_7">On</A> <b>then</b> - <A HREF="terminal_interface-curses__adb.htm#ref_1922_7">Err</A> := <A HREF="terminal_interface-curses__adb.htm#ref_1917_16">Slk_Attron</A> (<A HREF="terminal_interface-curses-aux__ads.htm#ref_75_4">AttrChar_To_Chtype</A> (<A HREF="terminal_interface-curses__adb.htm#ref_1923_7">Ch</A>)); - <b>else</b> - <A HREF="terminal_interface-curses__adb.htm#ref_1922_7">Err</A> := <A HREF="terminal_interface-curses__adb.htm#ref_1919_16">Slk_Attroff</A> (<A HREF="terminal_interface-curses-aux__ads.htm#ref_75_4">AttrChar_To_Chtype</A> (<A HREF="terminal_interface-curses__adb.htm#ref_1923_7">Ch</A>)); - <b>end</b> <b>if</b>; - <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1922_7">Err</A> = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1550_14">Switch_Soft_Label_Key_Attributes</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1549_14">Switch_Soft_Label_Key_Attributes</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1937_14" HREF="terminal_interface-curses__ads.htm#ref_1558_14">Set_Soft_Label_Key_Attributes</A></FONT> -- (<FONT COLOR=red><A NAME="ref_1938_7" HREF="terminal_interface-curses__ads.htm#ref_1559_7">Attr</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A> := <A HREF="terminal_interface-curses__ads.htm#ref_352_4">Normal_Video</A>; -- <FONT COLOR=red><A NAME="ref_1939_7" HREF="terminal_interface-curses__ads.htm#ref_1560_7">Color</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A> := <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>'First) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1937_14" HREF="terminal_interface-curses__ads.htm#ref_1557_14">Set_Soft_Label_Key_Attributes</A></span> -+ (<span class="symbol"><A NAME="ref_1938_7" HREF="terminal_interface-curses__ads.htm#ref_1558_7">Attr</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A> := <A HREF="terminal_interface-curses__ads.htm#ref_351_4">Normal_Video</A>; -+ <span class="symbol"><A NAME="ref_1939_7" HREF="terminal_interface-curses__ads.htm#ref_1559_7">Color</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A> := <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>'First) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1941_16">Slk_Attrset</A></FONT> (<FONT COLOR=red><A NAME="ref_1941_29" HREF="terminal_interface-curses__adb.htm#ref_1941_16">Ch</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_12">C_Chtype</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_1941_16">Slk_Attrset</A></span> (<span class="symbol"><A NAME="ref_1941_29" HREF="terminal_interface-curses__adb.htm#ref_1941_16">Ch</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_12">C_Chtype</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Slk_Attrset, "slk_attrset"); - -- <FONT COLOR=red><A NAME="ref_1944_7">Ch</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_354_9">Attributed_Character</A> := (<A HREF="terminal_interface-curses__ads.htm#ref_358_10">Ch</A> =&gt; Character'First, -- <A HREF="terminal_interface-curses__ads.htm#ref_356_10">Attr</A> =&gt; <A HREF="terminal_interface-curses__ads.htm#ref_1559_7">Attr</A>, -- <A HREF="terminal_interface-curses__ads.htm#ref_357_10">Color</A> =&gt; <A HREF="terminal_interface-curses__ads.htm#ref_1560_7">Color</A>); -+ <span class="symbol"><A NAME="ref_1944_7">Ch</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_353_9">Attributed_Character</A> := (<A HREF="terminal_interface-curses__ads.htm#ref_357_10">Ch</A> =&gt; Character'First, -+ <A HREF="terminal_interface-curses__ads.htm#ref_355_10">Attr</A> =&gt; <A HREF="terminal_interface-curses__ads.htm#ref_1558_7">Attr</A>, -+ <A HREF="terminal_interface-curses__ads.htm#ref_356_10">Color</A> =&gt; <A HREF="terminal_interface-curses__ads.htm#ref_1559_7">Color</A>); - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1941_16">Slk_Attrset</A> (<A HREF="terminal_interface-curses-aux__ads.htm#ref_75_4">AttrChar_To_Chtype</A> (<A HREF="terminal_interface-curses__adb.htm#ref_1944_7">Ch</A>)) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1558_14">Set_Soft_Label_Key_Attributes</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1557_14">Set_Soft_Label_Key_Attributes</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_1953_13" HREF="terminal_interface-curses__ads.htm#ref_1565_13">Get_Soft_Label_Key_Attributes</A></FONT> <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A> -+ <b>function</b> <span class="symbol"><A NAME="ref_1953_13" HREF="terminal_interface-curses__ads.htm#ref_1564_13">Get_Soft_Label_Key_Attributes</A></span> <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A> - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1955_16">Slk_Attr</A></FONT> <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_12">C_Chtype</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_1955_16">Slk_Attr</A></span> <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_12">C_Chtype</A>; - <b>pragma</b> Import (C, Slk_Attr, "slk_attr"); - -- <FONT COLOR=red><A NAME="ref_1958_7">Attr</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_12">C_Chtype</A> := <A HREF="terminal_interface-curses__adb.htm#ref_1955_16">Slk_Attr</A>; -+ <span class="symbol"><A NAME="ref_1958_7">Attr</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_12">C_Chtype</A> := <A HREF="terminal_interface-curses__adb.htm#ref_1955_16">Slk_Attr</A>; - <b>begin</b> -- <b>return</b> Chtype_To_AttrChar (<A HREF="terminal_interface-curses__adb.htm#ref_1958_7">Attr</A>).<A HREF="terminal_interface-curses__ads.htm#ref_356_10">Attr</A>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1565_13">Get_Soft_Label_Key_Attributes</A>; -+ <b>return</b> Chtype_To_AttrChar (<A HREF="terminal_interface-curses__adb.htm#ref_1958_7">Attr</A>).<A HREF="terminal_interface-curses__ads.htm#ref_355_10">Attr</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1564_13">Get_Soft_Label_Key_Attributes</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_1963_13" HREF="terminal_interface-curses__ads.htm#ref_1569_13">Get_Soft_Label_Key_Attributes</A></FONT> <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A> -+ <b>function</b> <span class="symbol"><A NAME="ref_1963_13" HREF="terminal_interface-curses__ads.htm#ref_1568_13">Get_Soft_Label_Key_Attributes</A></span> <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A> - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1965_16">Slk_Attr</A></FONT> <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_12">C_Chtype</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_1965_16">Slk_Attr</A></span> <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_12">C_Chtype</A>; - <b>pragma</b> Import (C, Slk_Attr, "slk_attr"); - -- <FONT COLOR=red><A NAME="ref_1968_7">Attr</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_12">C_Chtype</A> := <A HREF="terminal_interface-curses__adb.htm#ref_1965_16">Slk_Attr</A>; -+ <span class="symbol"><A NAME="ref_1968_7">Attr</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_12">C_Chtype</A> := <A HREF="terminal_interface-curses__adb.htm#ref_1965_16">Slk_Attr</A>; - <b>begin</b> -- <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_75_4">Chtype_To_AttrChar</A> (<A HREF="terminal_interface-curses__adb.htm#ref_1968_7">Attr</A>).<A HREF="terminal_interface-curses__ads.htm#ref_357_10">Color</A>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1569_13">Get_Soft_Label_Key_Attributes</A>; -+ <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_75_4">Chtype_To_AttrChar</A> (<A HREF="terminal_interface-curses__adb.htm#ref_1968_7">Attr</A>).<A HREF="terminal_interface-curses__ads.htm#ref_356_10">Color</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1568_13">Get_Soft_Label_Key_Attributes</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1973_14" HREF="terminal_interface-curses__ads.htm#ref_1574_14">Set_Soft_Label_Key_Color</A></FONT> (<FONT COLOR=red><A NAME="ref_1973_40" HREF="terminal_interface-curses__ads.htm#ref_1574_40">Pair</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1973_14" HREF="terminal_interface-curses__ads.htm#ref_1573_14">Set_Soft_Label_Key_Color</A></span> (<span class="symbol"><A NAME="ref_1973_40" HREF="terminal_interface-curses__ads.htm#ref_1573_40">Pair</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1975_16">Slk_Color</A></FONT> (<FONT COLOR=red><A NAME="ref_1975_27" HREF="terminal_interface-curses__adb.htm#ref_1975_16">Color</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_56_12">C_Short</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_1975_16">Slk_Color</A></span> (<span class="symbol"><A NAME="ref_1975_27" HREF="terminal_interface-curses__adb.htm#ref_1975_16">Color</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_56_12">C_Short</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Slk_Color, "slk_color"); - <b>begin</b> -- <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1975_16">Slk_Color</A> (<A HREF="terminal_interface-curses-aux__ads.htm#ref_56_12">C_Short</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1574_40">Pair</A>)) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1975_16">Slk_Color</A> (<A HREF="terminal_interface-curses-aux__ads.htm#ref_56_12">C_Short</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1573_40">Pair</A>)) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1574_14">Set_Soft_Label_Key_Color</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1573_14">Set_Soft_Label_Key_Color</A>; - --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1984_14" HREF="terminal_interface-curses__ads.htm#ref_1588_14">Enable_Key</A></FONT> (<FONT COLOR=red><A NAME="ref_1984_26" HREF="terminal_interface-curses__ads.htm#ref_1588_26">Key</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A>; -- <FONT COLOR=red><A NAME="ref_1985_26" HREF="terminal_interface-curses__ads.htm#ref_1589_26">Enable</A></FONT> : Boolean := True) -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1984_14" HREF="terminal_interface-curses__ads.htm#ref_1587_14">Enable_Key</A></span> (<span class="symbol"><A NAME="ref_1984_26" HREF="terminal_interface-curses__ads.htm#ref_1587_26">Key</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A>; -+ <span class="symbol"><A NAME="ref_1985_26" HREF="terminal_interface-curses__ads.htm#ref_1588_26">Enable</A></span> : Boolean := True) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1987_16">Keyok</A></FONT> (<FONT COLOR=red><A NAME="ref_1987_23" HREF="terminal_interface-curses__adb.htm#ref_1987_16">Keycode</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -- <FONT COLOR=red><A NAME="ref_1988_23" HREF="terminal_interface-curses__adb.htm#ref_1987_16">On_Off</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_1926_9">Curses_Bool</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_1987_16">Keyok</A></span> (<span class="symbol"><A NAME="ref_1987_23" HREF="terminal_interface-curses__adb.htm#ref_1987_16">Keycode</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <span class="symbol"><A NAME="ref_1988_23" HREF="terminal_interface-curses__adb.htm#ref_1987_16">On_Off</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_1925_9">Curses_Bool</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Keyok, "keyok"); - <b>begin</b> -- <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1987_16">Keyok</A> (<A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1588_26">Key</A>), <A HREF="terminal_interface-curses__ads.htm#ref_1926_9">Curses_Bool</A> (Boolean'Pos (<A HREF="terminal_interface-curses__ads.htm#ref_1589_26">Enable</A>))) -+ <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_1987_16">Keyok</A> (<A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1587_26">Key</A>), <A HREF="terminal_interface-curses__ads.htm#ref_1925_9">Curses_Bool</A> (Boolean'Pos (<A HREF="terminal_interface-curses__ads.htm#ref_1588_26">Enable</A>))) - = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1588_14">Enable_Key</A>; --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1997_14" HREF="terminal_interface-curses__ads.htm#ref_1598_14">Define_Key</A></FONT> (<FONT COLOR=red><A NAME="ref_1997_26" HREF="terminal_interface-curses__ads.htm#ref_1598_26">Definition</A></FONT> : String; -- <FONT COLOR=red><A NAME="ref_1998_26" HREF="terminal_interface-curses__ads.htm#ref_1599_26">Key</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A>) -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1587_14">Enable_Key</A>; -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1997_14" HREF="terminal_interface-curses__ads.htm#ref_1597_14">Define_Key</A></span> (<span class="symbol"><A NAME="ref_1997_26" HREF="terminal_interface-curses__ads.htm#ref_1597_26">Definition</A></span> : String; -+ <span class="symbol"><A NAME="ref_1998_26" HREF="terminal_interface-curses__ads.htm#ref_1598_26">Key</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A>) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_2000_16">Defkey</A></FONT> (<FONT COLOR=red><A NAME="ref_2000_24" HREF="terminal_interface-curses__adb.htm#ref_2000_16">Def</A></FONT> : char_array; -- <FONT COLOR=red><A NAME="ref_2001_24" HREF="terminal_interface-curses__adb.htm#ref_2000_16">Key</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_2000_16">Defkey</A></span> (<span class="symbol"><A NAME="ref_2000_24" HREF="terminal_interface-curses__adb.htm#ref_2000_16">Def</A></span> : char_array; -+ <span class="symbol"><A NAME="ref_2001_24" HREF="terminal_interface-curses__adb.htm#ref_2000_16">Key</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Defkey, "define_key"); - -- <FONT COLOR=red><A NAME="ref_2004_7">Txt</A></FONT> : char_array (0 .. <A HREF="terminal_interface-curses__ads.htm#ref_1598_26">Definition</A>'Length); -- <FONT COLOR=red><A NAME="ref_2005_7">Length</A></FONT> : size_t; -+ <span class="symbol"><A NAME="ref_2004_7">Txt</A></span> : char_array (0 .. <A HREF="terminal_interface-curses__ads.htm#ref_1597_26">Definition</A>'Length); -+ <span class="symbol"><A NAME="ref_2005_7">Length</A></span> : size_t; - <b>begin</b> -- To_C (<A HREF="terminal_interface-curses__ads.htm#ref_1598_26">Definition</A>, <A HREF="terminal_interface-curses__adb.htm#ref_2004_7">Txt</A>, <A HREF="terminal_interface-curses__adb.htm#ref_2005_7">Length</A>); -- <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_2000_16">Defkey</A> (<A HREF="terminal_interface-curses__adb.htm#ref_2004_7">Txt</A>, <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1599_26">Key</A>)) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -- <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1598_14">Define_Key</A>; --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_2013_14" HREF="terminal_interface-curses__ads.htm#ref_1624_14">Un_Control</A></FONT> (<FONT COLOR=red><A NAME="ref_2013_26" HREF="terminal_interface-curses__ads.htm#ref_1624_26">Ch</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_354_9">Attributed_Character</A>; -- <FONT COLOR=red><A NAME="ref_2014_26" HREF="terminal_interface-curses__ads.htm#ref_1625_26">Str</A></FONT> : <b>out</b> String) -+ To_C (<A HREF="terminal_interface-curses__ads.htm#ref_1597_26">Definition</A>, <A HREF="terminal_interface-curses__adb.htm#ref_2004_7">Txt</A>, <A HREF="terminal_interface-curses__adb.htm#ref_2005_7">Length</A>); -+ <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_2000_16">Defkey</A> (<A HREF="terminal_interface-curses__adb.htm#ref_2004_7">Txt</A>, <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1598_26">Key</A>)) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; -+ <b>end</b> <b>if</b>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1597_14">Define_Key</A>; -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_2013_14" HREF="terminal_interface-curses__ads.htm#ref_1623_14">Un_Control</A></span> (<span class="symbol"><A NAME="ref_2013_26" HREF="terminal_interface-curses__ads.htm#ref_1623_26">Ch</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_353_9">Attributed_Character</A>; -+ <span class="symbol"><A NAME="ref_2014_26" HREF="terminal_interface-curses__ads.htm#ref_1624_26">Str</A></span> : <b>out</b> String) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_2016_16">Unctrl</A></FONT> (<FONT COLOR=red><A NAME="ref_2016_24" HREF="terminal_interface-curses__adb.htm#ref_2016_16">Ch</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_12">C_Chtype</A>) <b>return</b> chars_ptr; -+ <b>function</b> <span class="symbol"><A NAME="ref_2016_16">Unctrl</A></span> (<span class="symbol"><A NAME="ref_2016_24" HREF="terminal_interface-curses__adb.htm#ref_2016_16">Ch</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_12">C_Chtype</A>) <b>return</b> chars_ptr; - <b>pragma</b> Import (C, Unctrl, "unctrl"); - <b>begin</b> -- <A HREF="terminal_interface-curses-aux__ads.htm#ref_116_14">Fill_String</A> (<A HREF="terminal_interface-curses__adb.htm#ref_2016_16">Unctrl</A> (<A HREF="terminal_interface-curses-aux__ads.htm#ref_75_4">AttrChar_To_Chtype</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1624_26">Ch</A>)), <A HREF="terminal_interface-curses__ads.htm#ref_1625_26">Str</A>); -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1624_14">Un_Control</A>; -+ <A HREF="terminal_interface-curses-aux__ads.htm#ref_116_14">Fill_String</A> (<A HREF="terminal_interface-curses__adb.htm#ref_2016_16">Unctrl</A> (<A HREF="terminal_interface-curses-aux__ads.htm#ref_75_4">AttrChar_To_Chtype</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1623_26">Ch</A>)), <A HREF="terminal_interface-curses__ads.htm#ref_1624_26">Str</A>); -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1623_14">Un_Control</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_2022_13" HREF="terminal_interface-curses__ads.htm#ref_1629_13">Un_Control</A></FONT> (<FONT COLOR=red><A NAME="ref_2022_25" HREF="terminal_interface-curses__ads.htm#ref_1629_25">Ch</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_354_9">Attributed_Character</A>) <b>return</b> String -+ <b>function</b> <span class="symbol"><A NAME="ref_2022_13" HREF="terminal_interface-curses__ads.htm#ref_1628_13">Un_Control</A></span> (<span class="symbol"><A NAME="ref_2022_25" HREF="terminal_interface-curses__ads.htm#ref_1628_25">Ch</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_353_9">Attributed_Character</A>) <b>return</b> String - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_2024_16">Unctrl</A></FONT> (<FONT COLOR=red><A NAME="ref_2024_24" HREF="terminal_interface-curses__adb.htm#ref_2024_16">Ch</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_12">C_Chtype</A>) <b>return</b> chars_ptr; -+ <b>function</b> <span class="symbol"><A NAME="ref_2024_16">Unctrl</A></span> (<span class="symbol"><A NAME="ref_2024_24" HREF="terminal_interface-curses__adb.htm#ref_2024_16">Ch</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_12">C_Chtype</A>) <b>return</b> chars_ptr; - <b>pragma</b> Import (C, Unctrl, "unctrl"); - <b>begin</b> -- <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_121_13">Fill_String</A> (<A HREF="terminal_interface-curses__adb.htm#ref_2024_16">Unctrl</A> (<A HREF="terminal_interface-curses-aux__ads.htm#ref_75_4">AttrChar_To_Chtype</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1629_25">Ch</A>))); -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1629_13">Un_Control</A>; -+ <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_121_13">Fill_String</A> (<A HREF="terminal_interface-curses__adb.htm#ref_2024_16">Unctrl</A> (<A HREF="terminal_interface-curses-aux__ads.htm#ref_75_4">AttrChar_To_Chtype</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1628_25">Ch</A>))); -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1628_13">Un_Control</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_2030_14" HREF="terminal_interface-curses__ads.htm#ref_1635_14">Delay_Output</A></FONT> (<FONT COLOR=red><A NAME="ref_2030_28" HREF="terminal_interface-curses__ads.htm#ref_1635_28">Msecs</A></FONT> : Natural) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_2030_14" HREF="terminal_interface-curses__ads.htm#ref_1634_14">Delay_Output</A></span> (<span class="symbol"><A NAME="ref_2030_28" HREF="terminal_interface-curses__ads.htm#ref_1634_28">Msecs</A></span> : Natural) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_2032_16">Delayoutput</A></FONT> (<FONT COLOR=red><A NAME="ref_2032_29" HREF="terminal_interface-curses__adb.htm#ref_2032_16">Msecs</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_2032_16">Delayoutput</A></span> (<span class="symbol"><A NAME="ref_2032_29" HREF="terminal_interface-curses__adb.htm#ref_2032_16">Msecs</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Delayoutput, "delay_output"); - <b>begin</b> -- <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_2032_16">Delayoutput</A> (<A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1635_28">Msecs</A>)) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_2032_16">Delayoutput</A> (<A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1634_28">Msecs</A>)) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1635_14">Delay_Output</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1634_14">Delay_Output</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_2040_14" HREF="terminal_interface-curses__ads.htm#ref_1640_14">Flush_Input</A></FONT> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_2040_14" HREF="terminal_interface-curses__ads.htm#ref_1639_14">Flush_Input</A></span> - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_2042_16">Flushinp</A></FONT> <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_2042_16">Flushinp</A></span> <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Flushinp, "flushinp"); - <b>begin</b> -- <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_2042_16">Flushinp</A> = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> <FONT COLOR=green><EM>-- docu says that never happens, but...</EM></FONT> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_2042_16">Flushinp</A> = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> <span class="comment"><EM>-- docu says that never happens, but...</EM></span> -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1640_14">Flush_Input</A>; --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_2050_13" HREF="terminal_interface-curses__ads.htm#ref_1649_13">Baudrate</A></FONT> <b>return</b> Natural -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1639_14">Flush_Input</A>; -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_2050_13" HREF="terminal_interface-curses__ads.htm#ref_1648_13">Baudrate</A></span> <b>return</b> Natural - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_2052_16">Baud</A></FONT> <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_2052_16">Baud</A></span> <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Baud, "baudrate"); - <b>begin</b> - <b>return</b> Natural (<A HREF="terminal_interface-curses__adb.htm#ref_2052_16">Baud</A>); -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1649_13">Baudrate</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1648_13">Baudrate</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_2058_13" HREF="terminal_interface-curses__ads.htm#ref_1654_13">Erase_Character</A></FONT> <b>return</b> Character -+ <b>function</b> <span class="symbol"><A NAME="ref_2058_13" HREF="terminal_interface-curses__ads.htm#ref_1653_13">Erase_Character</A></span> <b>return</b> Character - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_2060_16">Erasechar</A></FONT> <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_2060_16">Erasechar</A></span> <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Erasechar, "erasechar"); - <b>begin</b> - <b>return</b> Character'Val (<A HREF="terminal_interface-curses__adb.htm#ref_2060_16">Erasechar</A>); -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1654_13">Erase_Character</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1653_13">Erase_Character</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_2066_13" HREF="terminal_interface-curses__ads.htm#ref_1659_13">Kill_Character</A></FONT> <b>return</b> Character -+ <b>function</b> <span class="symbol"><A NAME="ref_2066_13" HREF="terminal_interface-curses__ads.htm#ref_1658_13">Kill_Character</A></span> <b>return</b> Character - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_2068_16">Killchar</A></FONT> <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_2068_16">Killchar</A></span> <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Killchar, "killchar"); - <b>begin</b> - <b>return</b> Character'Val (<A HREF="terminal_interface-curses__adb.htm#ref_2068_16">Killchar</A>); -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1659_13">Kill_Character</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1658_13">Kill_Character</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_2074_13" HREF="terminal_interface-curses__ads.htm#ref_1664_13">Has_Insert_Character</A></FONT> <b>return</b> Boolean -+ <b>function</b> <span class="symbol"><A NAME="ref_2074_13" HREF="terminal_interface-curses__ads.htm#ref_1663_13">Has_Insert_Character</A></span> <b>return</b> Boolean - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_2076_16">Has_Ic</A></FONT> <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_1926_9">Curses_Bool</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_2076_16">Has_Ic</A></span> <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_1925_9">Curses_Bool</A>; - <b>pragma</b> Import (C, Has_Ic, "has_ic"); - <b>begin</b> -- <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_2076_16">Has_Ic</A> = <A HREF="terminal_interface-curses__ads.htm#ref_1927_4">Curses_Bool_False</A> <b>then</b> -+ <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_2076_16">Has_Ic</A> = <A HREF="terminal_interface-curses__ads.htm#ref_1926_4">Curses_Bool_False</A> <b>then</b> - <b>return</b> False; - <b>else</b> - <b>return</b> True; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1664_13">Has_Insert_Character</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1663_13">Has_Insert_Character</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_2086_13" HREF="terminal_interface-curses__ads.htm#ref_1669_13">Has_Insert_Line</A></FONT> <b>return</b> Boolean -+ <b>function</b> <span class="symbol"><A NAME="ref_2086_13" HREF="terminal_interface-curses__ads.htm#ref_1668_13">Has_Insert_Line</A></span> <b>return</b> Boolean - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_2088_16">Has_Il</A></FONT> <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_1926_9">Curses_Bool</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_2088_16">Has_Il</A></span> <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_1925_9">Curses_Bool</A>; - <b>pragma</b> Import (C, Has_Il, "has_il"); - <b>begin</b> -- <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_2088_16">Has_Il</A> = <A HREF="terminal_interface-curses__ads.htm#ref_1927_4">Curses_Bool_False</A> <b>then</b> -+ <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_2088_16">Has_Il</A> = <A HREF="terminal_interface-curses__ads.htm#ref_1926_4">Curses_Bool_False</A> <b>then</b> - <b>return</b> False; - <b>else</b> - <b>return</b> True; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1669_13">Has_Insert_Line</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1668_13">Has_Insert_Line</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_2098_13" HREF="terminal_interface-curses__ads.htm#ref_1674_13">Supported_Attributes</A></FONT> <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A> -+ <b>function</b> <span class="symbol"><A NAME="ref_2098_13" HREF="terminal_interface-curses__ads.htm#ref_1673_13">Supported_Attributes</A></span> <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A> - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_2100_16">Termattrs</A></FONT> <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_12">C_Chtype</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_2100_16">Termattrs</A></span> <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_12">C_Chtype</A>; - <b>pragma</b> Import (C, Termattrs, "termattrs"); - -- <FONT COLOR=red><A NAME="ref_2103_7">Ch</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_354_9">Attributed_Character</A> := <A HREF="terminal_interface-curses-aux__ads.htm#ref_75_4">Chtype_To_AttrChar</A> (<A HREF="terminal_interface-curses__adb.htm#ref_2100_16">Termattrs</A>); -+ <span class="symbol"><A NAME="ref_2103_7">Ch</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_353_9">Attributed_Character</A> := <A HREF="terminal_interface-curses-aux__ads.htm#ref_75_4">Chtype_To_AttrChar</A> (<A HREF="terminal_interface-curses__adb.htm#ref_2100_16">Termattrs</A>); - <b>begin</b> -- <b>return</b> <A HREF="terminal_interface-curses__adb.htm#ref_2103_7">Ch</A>.<A HREF="terminal_interface-curses__ads.htm#ref_356_10">Attr</A>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1674_13">Supported_Attributes</A>; -+ <b>return</b> <A HREF="terminal_interface-curses__adb.htm#ref_2103_7">Ch</A>.<A HREF="terminal_interface-curses__ads.htm#ref_355_10">Attr</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1673_13">Supported_Attributes</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_2108_14" HREF="terminal_interface-curses__ads.htm#ref_1679_14">Long_Name</A></FONT> (<FONT COLOR=red><A NAME="ref_2108_25" HREF="terminal_interface-curses__ads.htm#ref_1679_25">Name</A></FONT> : <b>out</b> String) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_2108_14" HREF="terminal_interface-curses__ads.htm#ref_1678_14">Long_Name</A></span> (<span class="symbol"><A NAME="ref_2108_25" HREF="terminal_interface-curses__ads.htm#ref_1678_25">Name</A></span> : <b>out</b> String) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_2110_16">Longname</A></FONT> <b>return</b> chars_ptr; -+ <b>function</b> <span class="symbol"><A NAME="ref_2110_16">Longname</A></span> <b>return</b> chars_ptr; - <b>pragma</b> Import (C, Longname, "longname"); - <b>begin</b> -- <A HREF="terminal_interface-curses-aux__ads.htm#ref_116_14">Fill_String</A> (<A HREF="terminal_interface-curses__adb.htm#ref_2110_16">Longname</A>, <A HREF="terminal_interface-curses__ads.htm#ref_1679_25">Name</A>); -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1679_14">Long_Name</A>; -+ <A HREF="terminal_interface-curses-aux__ads.htm#ref_116_14">Fill_String</A> (<A HREF="terminal_interface-curses__adb.htm#ref_2110_16">Longname</A>, <A HREF="terminal_interface-curses__ads.htm#ref_1678_25">Name</A>); -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1678_14">Long_Name</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_2116_13" HREF="terminal_interface-curses__ads.htm#ref_1683_13">Long_Name</A></FONT> <b>return</b> String -+ <b>function</b> <span class="symbol"><A NAME="ref_2116_13" HREF="terminal_interface-curses__ads.htm#ref_1682_13">Long_Name</A></span> <b>return</b> String - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_2118_16">Longname</A></FONT> <b>return</b> chars_ptr; -+ <b>function</b> <span class="symbol"><A NAME="ref_2118_16">Longname</A></span> <b>return</b> chars_ptr; - <b>pragma</b> Import (C, Longname, "longname"); - <b>begin</b> - <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_121_13">Fill_String</A> (<A HREF="terminal_interface-curses__adb.htm#ref_2118_16">Longname</A>); -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1683_13">Long_Name</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1682_13">Long_Name</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_2124_14" HREF="terminal_interface-curses__ads.htm#ref_1689_14">Terminal_Name</A></FONT> (<FONT COLOR=red><A NAME="ref_2124_29" HREF="terminal_interface-curses__ads.htm#ref_1689_29">Name</A></FONT> : <b>out</b> String) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_2124_14" HREF="terminal_interface-curses__ads.htm#ref_1688_14">Terminal_Name</A></span> (<span class="symbol"><A NAME="ref_2124_29" HREF="terminal_interface-curses__ads.htm#ref_1688_29">Name</A></span> : <b>out</b> String) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_2126_16">Termname</A></FONT> <b>return</b> chars_ptr; -+ <b>function</b> <span class="symbol"><A NAME="ref_2126_16">Termname</A></span> <b>return</b> chars_ptr; - <b>pragma</b> Import (C, Termname, "termname"); - <b>begin</b> -- <A HREF="terminal_interface-curses-aux__ads.htm#ref_116_14">Fill_String</A> (<A HREF="terminal_interface-curses__adb.htm#ref_2126_16">Termname</A>, <A HREF="terminal_interface-curses__ads.htm#ref_1689_29">Name</A>); -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1689_14">Terminal_Name</A>; -+ <A HREF="terminal_interface-curses-aux__ads.htm#ref_116_14">Fill_String</A> (<A HREF="terminal_interface-curses__adb.htm#ref_2126_16">Termname</A>, <A HREF="terminal_interface-curses__ads.htm#ref_1688_29">Name</A>); -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1688_14">Terminal_Name</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_2132_13" HREF="terminal_interface-curses__ads.htm#ref_1693_13">Terminal_Name</A></FONT> <b>return</b> String -+ <b>function</b> <span class="symbol"><A NAME="ref_2132_13" HREF="terminal_interface-curses__ads.htm#ref_1692_13">Terminal_Name</A></span> <b>return</b> String - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_2134_16">Termname</A></FONT> <b>return</b> chars_ptr; -+ <b>function</b> <span class="symbol"><A NAME="ref_2134_16">Termname</A></span> <b>return</b> chars_ptr; - <b>pragma</b> Import (C, Termname, "termname"); - <b>begin</b> - <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_121_13">Fill_String</A> (<A HREF="terminal_interface-curses__adb.htm#ref_2134_16">Termname</A>); -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1693_13">Terminal_Name</A>; --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_2140_14" HREF="terminal_interface-curses__ads.htm#ref_1714_14">Init_Pair</A></FONT> (<FONT COLOR=red><A NAME="ref_2140_25" HREF="terminal_interface-curses__ads.htm#ref_1714_25">Pair</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_301_12">Redefinable_Color_Pair</A>; -- <FONT COLOR=red><A NAME="ref_2141_25" HREF="terminal_interface-curses__ads.htm#ref_1715_25">Fore</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_278_9">Color_Number</A>; -- <FONT COLOR=red><A NAME="ref_2142_25" HREF="terminal_interface-curses__ads.htm#ref_1716_25">Back</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_278_9">Color_Number</A>) -- <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_2144_16">Initpair</A></FONT> (<FONT COLOR=red><A NAME="ref_2144_26" HREF="terminal_interface-curses__adb.htm#ref_2144_16">Pair</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_56_12">C_Short</A>; -- <FONT COLOR=red><A NAME="ref_2145_26" HREF="terminal_interface-curses__adb.htm#ref_2144_16">Fore</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_56_12">C_Short</A>; -- <FONT COLOR=red><A NAME="ref_2146_26" HREF="terminal_interface-curses__adb.htm#ref_2144_16">Back</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_56_12">C_Short</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1692_13">Terminal_Name</A>; -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_2140_14" HREF="terminal_interface-curses__ads.htm#ref_1713_14">Init_Pair</A></span> (<span class="symbol"><A NAME="ref_2140_25" HREF="terminal_interface-curses__ads.htm#ref_1713_25">Pair</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_301_12">Redefinable_Color_Pair</A>; -+ <span class="symbol"><A NAME="ref_2141_25" HREF="terminal_interface-curses__ads.htm#ref_1714_25">Fore</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_278_9">Color_Number</A>; -+ <span class="symbol"><A NAME="ref_2142_25" HREF="terminal_interface-curses__ads.htm#ref_1715_25">Back</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_278_9">Color_Number</A>) -+ <b>is</b> -+ <b>function</b> <span class="symbol"><A NAME="ref_2144_16">Initpair</A></span> (<span class="symbol"><A NAME="ref_2144_26" HREF="terminal_interface-curses__adb.htm#ref_2144_16">Pair</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_56_12">C_Short</A>; -+ <span class="symbol"><A NAME="ref_2145_26" HREF="terminal_interface-curses__adb.htm#ref_2144_16">Fore</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_56_12">C_Short</A>; -+ <span class="symbol"><A NAME="ref_2146_26" HREF="terminal_interface-curses__adb.htm#ref_2144_16">Back</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_56_12">C_Short</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Initpair, "init_pair"); - <b>begin</b> -- <b>if</b> Integer (<A HREF="terminal_interface-curses__ads.htm#ref_1714_25">Pair</A>) &gt;= <A HREF="terminal_interface-curses__ads.htm#ref_426_13">Number_Of_Color_Pairs</A> <b>then</b> -+ <b>if</b> Integer (<A HREF="terminal_interface-curses__ads.htm#ref_1713_25">Pair</A>) &gt;= <A HREF="terminal_interface-curses__ads.htm#ref_425_13">Number_Of_Color_Pairs</A> <b>then</b> - <b>raise</b> Constraint_Error; - <b>end</b> <b>if</b>; -- <b>if</b> Integer (<A HREF="terminal_interface-curses__ads.htm#ref_1715_25">Fore</A>) &gt;= <A HREF="terminal_interface-curses__ads.htm#ref_423_13">Number_Of_Colors</A> <b>or</b> <b>else</b> -- Integer (<A HREF="terminal_interface-curses__ads.htm#ref_1716_25">Back</A>) &gt;= <A HREF="terminal_interface-curses__ads.htm#ref_423_13">Number_Of_Colors</A> <b>then</b> -+ <b>if</b> Integer (<A HREF="terminal_interface-curses__ads.htm#ref_1714_25">Fore</A>) &gt;= <A HREF="terminal_interface-curses__ads.htm#ref_422_13">Number_Of_Colors</A> <b>or</b> <b>else</b> -+ Integer (<A HREF="terminal_interface-curses__ads.htm#ref_1715_25">Back</A>) &gt;= <A HREF="terminal_interface-curses__ads.htm#ref_422_13">Number_Of_Colors</A> <b>then</b> - <b>raise</b> Constraint_Error; - <b>end</b> <b>if</b>; -- <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_2144_16">Initpair</A> (<A HREF="terminal_interface-curses-aux__ads.htm#ref_56_12">C_Short</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1714_25">Pair</A>), <A HREF="terminal_interface-curses-aux__ads.htm#ref_56_12">C_Short</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1715_25">Fore</A>), <A HREF="terminal_interface-curses-aux__ads.htm#ref_56_12">C_Short</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1716_25">Back</A>)) -+ <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_2144_16">Initpair</A> (<A HREF="terminal_interface-curses-aux__ads.htm#ref_56_12">C_Short</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1713_25">Pair</A>), <A HREF="terminal_interface-curses-aux__ads.htm#ref_56_12">C_Short</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1714_25">Fore</A>), <A HREF="terminal_interface-curses-aux__ads.htm#ref_56_12">C_Short</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1715_25">Back</A>)) - = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1714_14">Init_Pair</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1713_14">Init_Pair</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_2162_14" HREF="terminal_interface-curses__ads.htm#ref_1721_14">Pair_Content</A></FONT> (<FONT COLOR=red><A NAME="ref_2162_28" HREF="terminal_interface-curses__ads.htm#ref_1721_28">Pair</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>; -- <FONT COLOR=red><A NAME="ref_2163_28" HREF="terminal_interface-curses__ads.htm#ref_1722_28">Fore</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_278_9">Color_Number</A>; -- <FONT COLOR=red><A NAME="ref_2164_28" HREF="terminal_interface-curses__ads.htm#ref_1723_28">Back</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_278_9">Color_Number</A>) -- <b>is</b> -- <b>type</b> <FONT COLOR=red><A NAME="ref_2166_12">C_Short_Access</A></FONT> <b>is</b> <b>access</b> <b>all</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_56_12">C_Short</A>; -- <b>function</b> <FONT COLOR=red><A NAME="ref_2167_16">Paircontent</A></FONT> (<FONT COLOR=red><A NAME="ref_2167_29" HREF="terminal_interface-curses__adb.htm#ref_2167_16">Pair</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_56_12">C_Short</A>; -- <FONT COLOR=red><A NAME="ref_2168_29" HREF="terminal_interface-curses__adb.htm#ref_2167_16">Fp</A></FONT> : <A HREF="terminal_interface-curses__adb.htm#ref_2166_12">C_Short_Access</A>; -- <FONT COLOR=red><A NAME="ref_2169_29" HREF="terminal_interface-curses__adb.htm#ref_2167_16">Bp</A></FONT> : <A HREF="terminal_interface-curses__adb.htm#ref_2166_12">C_Short_Access</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>procedure</b> <span class="symbol"><A NAME="ref_2162_14" HREF="terminal_interface-curses__ads.htm#ref_1720_14">Pair_Content</A></span> (<span class="symbol"><A NAME="ref_2162_28" HREF="terminal_interface-curses__ads.htm#ref_1720_28">Pair</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>; -+ <span class="symbol"><A NAME="ref_2163_28" HREF="terminal_interface-curses__ads.htm#ref_1721_28">Fore</A></span> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_278_9">Color_Number</A>; -+ <span class="symbol"><A NAME="ref_2164_28" HREF="terminal_interface-curses__ads.htm#ref_1722_28">Back</A></span> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_278_9">Color_Number</A>) -+ <b>is</b> -+ <b>type</b> <span class="symbol"><A NAME="ref_2166_12">C_Short_Access</A></span> <b>is</b> <b>access</b> <b>all</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_56_12">C_Short</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_2167_16">Paircontent</A></span> (<span class="symbol"><A NAME="ref_2167_29" HREF="terminal_interface-curses__adb.htm#ref_2167_16">Pair</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_56_12">C_Short</A>; -+ <span class="symbol"><A NAME="ref_2168_29" HREF="terminal_interface-curses__adb.htm#ref_2167_16">Fp</A></span> : <A HREF="terminal_interface-curses__adb.htm#ref_2166_12">C_Short_Access</A>; -+ <span class="symbol"><A NAME="ref_2169_29" HREF="terminal_interface-curses__adb.htm#ref_2167_16">Bp</A></span> : <A HREF="terminal_interface-curses__adb.htm#ref_2166_12">C_Short_Access</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Paircontent, "pair_content"); - -- <FONT COLOR=red><A NAME="ref_2172_7">F</A></FONT>, <FONT COLOR=red><A NAME="ref_2172_10">B</A></FONT> : <b>aliased</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_56_12">C_Short</A>; -+ <span class="symbol"><A NAME="ref_2172_7">F</A></span>, <span class="symbol"><A NAME="ref_2172_10">B</A></span> : <b>aliased</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_56_12">C_Short</A>; - <b>begin</b> -- <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_2167_16">Paircontent</A> (<A HREF="terminal_interface-curses-aux__ads.htm#ref_56_12">C_Short</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1721_28">Pair</A>), <A HREF="terminal_interface-curses__adb.htm#ref_2172_7">F</A>'<b>Access</b>, <A HREF="terminal_interface-curses__adb.htm#ref_2172_10">B</A>'<b>Access</b>) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_2167_16">Paircontent</A> (<A HREF="terminal_interface-curses-aux__ads.htm#ref_56_12">C_Short</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1720_28">Pair</A>), <A HREF="terminal_interface-curses__adb.htm#ref_2172_7">F</A>'<b>Access</b>, <A HREF="terminal_interface-curses__adb.htm#ref_2172_10">B</A>'<b>Access</b>) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>else</b> -- <A HREF="terminal_interface-curses__ads.htm#ref_1722_28">Fore</A> := <A HREF="terminal_interface-curses__ads.htm#ref_278_9">Color_Number</A> (<A HREF="terminal_interface-curses__adb.htm#ref_2172_7">F</A>); -- <A HREF="terminal_interface-curses__ads.htm#ref_1723_28">Back</A> := <A HREF="terminal_interface-curses__ads.htm#ref_278_9">Color_Number</A> (<A HREF="terminal_interface-curses__adb.htm#ref_2172_10">B</A>); -+ <A HREF="terminal_interface-curses__ads.htm#ref_1721_28">Fore</A> := <A HREF="terminal_interface-curses__ads.htm#ref_278_9">Color_Number</A> (<A HREF="terminal_interface-curses__adb.htm#ref_2172_7">F</A>); -+ <A HREF="terminal_interface-curses__ads.htm#ref_1722_28">Back</A> := <A HREF="terminal_interface-curses__ads.htm#ref_278_9">Color_Number</A> (<A HREF="terminal_interface-curses__adb.htm#ref_2172_10">B</A>); - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1721_14">Pair_Content</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1720_14">Pair_Content</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_2182_13" HREF="terminal_interface-curses__ads.htm#ref_1728_13">Has_Colors</A></FONT> <b>return</b> Boolean -+ <b>function</b> <span class="symbol"><A NAME="ref_2182_13" HREF="terminal_interface-curses__ads.htm#ref_1727_13">Has_Colors</A></span> <b>return</b> Boolean - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_2184_16">Hascolors</A></FONT> <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_1926_9">Curses_Bool</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_2184_16">Hascolors</A></span> <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_1925_9">Curses_Bool</A>; - <b>pragma</b> Import (C, Hascolors, "has_colors"); - <b>begin</b> -- <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_2184_16">Hascolors</A> = <A HREF="terminal_interface-curses__ads.htm#ref_1927_4">Curses_Bool_False</A> <b>then</b> -+ <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_2184_16">Hascolors</A> = <A HREF="terminal_interface-curses__ads.htm#ref_1926_4">Curses_Bool_False</A> <b>then</b> - <b>return</b> False; - <b>else</b> - <b>return</b> True; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1728_13">Has_Colors</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1727_13">Has_Colors</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_2194_14" HREF="terminal_interface-curses__ads.htm#ref_1733_14">Init_Color</A></FONT> (<FONT COLOR=red><A NAME="ref_2194_26" HREF="terminal_interface-curses__ads.htm#ref_1733_26">Color</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_278_9">Color_Number</A>; -- <FONT COLOR=red><A NAME="ref_2195_26" HREF="terminal_interface-curses__ads.htm#ref_1734_26">Red</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_295_9">RGB_Value</A>; -- <FONT COLOR=red><A NAME="ref_2196_26" HREF="terminal_interface-curses__ads.htm#ref_1735_26">Green</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_295_9">RGB_Value</A>; -- <FONT COLOR=red><A NAME="ref_2197_26" HREF="terminal_interface-curses__ads.htm#ref_1736_26">Blue</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_295_9">RGB_Value</A>) -- <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_2199_16">Initcolor</A></FONT> (<FONT COLOR=red><A NAME="ref_2199_27" HREF="terminal_interface-curses__adb.htm#ref_2199_16">Col</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_56_12">C_Short</A>; -- <FONT COLOR=red><A NAME="ref_2200_27" HREF="terminal_interface-curses__adb.htm#ref_2199_16">Red</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_56_12">C_Short</A>; -- <FONT COLOR=red><A NAME="ref_2201_27" HREF="terminal_interface-curses__adb.htm#ref_2199_16">Green</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_56_12">C_Short</A>; -- <FONT COLOR=red><A NAME="ref_2202_27" HREF="terminal_interface-curses__adb.htm#ref_2199_16">Blue</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_56_12">C_Short</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>procedure</b> <span class="symbol"><A NAME="ref_2194_14" HREF="terminal_interface-curses__ads.htm#ref_1732_14">Init_Color</A></span> (<span class="symbol"><A NAME="ref_2194_26" HREF="terminal_interface-curses__ads.htm#ref_1732_26">Color</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_278_9">Color_Number</A>; -+ <span class="symbol"><A NAME="ref_2195_26" HREF="terminal_interface-curses__ads.htm#ref_1733_26">Red</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_295_9">RGB_Value</A>; -+ <span class="symbol"><A NAME="ref_2196_26" HREF="terminal_interface-curses__ads.htm#ref_1734_26">Green</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_295_9">RGB_Value</A>; -+ <span class="symbol"><A NAME="ref_2197_26" HREF="terminal_interface-curses__ads.htm#ref_1735_26">Blue</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_295_9">RGB_Value</A>) -+ <b>is</b> -+ <b>function</b> <span class="symbol"><A NAME="ref_2199_16">Initcolor</A></span> (<span class="symbol"><A NAME="ref_2199_27" HREF="terminal_interface-curses__adb.htm#ref_2199_16">Col</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_56_12">C_Short</A>; -+ <span class="symbol"><A NAME="ref_2200_27" HREF="terminal_interface-curses__adb.htm#ref_2199_16">Red</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_56_12">C_Short</A>; -+ <span class="symbol"><A NAME="ref_2201_27" HREF="terminal_interface-curses__adb.htm#ref_2199_16">Green</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_56_12">C_Short</A>; -+ <span class="symbol"><A NAME="ref_2202_27" HREF="terminal_interface-curses__adb.htm#ref_2199_16">Blue</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_56_12">C_Short</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Initcolor, "init_color"); - <b>begin</b> -- <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_2199_16">Initcolor</A> (<A HREF="terminal_interface-curses-aux__ads.htm#ref_56_12">C_Short</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1733_26">Color</A>), <A HREF="terminal_interface-curses-aux__ads.htm#ref_56_12">C_Short</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1734_26">Red</A>), <A HREF="terminal_interface-curses-aux__ads.htm#ref_56_12">C_Short</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1735_26">Green</A>), -- <A HREF="terminal_interface-curses-aux__ads.htm#ref_56_12">C_Short</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1736_26">Blue</A>)) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_2199_16">Initcolor</A> (<A HREF="terminal_interface-curses-aux__ads.htm#ref_56_12">C_Short</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1732_26">Color</A>), <A HREF="terminal_interface-curses-aux__ads.htm#ref_56_12">C_Short</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1733_26">Red</A>), <A HREF="terminal_interface-curses-aux__ads.htm#ref_56_12">C_Short</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1734_26">Green</A>), -+ <A HREF="terminal_interface-curses-aux__ads.htm#ref_56_12">C_Short</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1735_26">Blue</A>)) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1733_14">Init_Color</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1732_14">Init_Color</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_2211_13" HREF="terminal_interface-curses__ads.htm#ref_1741_13">Can_Change_Color</A></FONT> <b>return</b> Boolean -+ <b>function</b> <span class="symbol"><A NAME="ref_2211_13" HREF="terminal_interface-curses__ads.htm#ref_1740_13">Can_Change_Color</A></span> <b>return</b> Boolean - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_2213_16">Canchangecolor</A></FONT> <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_1926_9">Curses_Bool</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_2213_16">Canchangecolor</A></span> <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_1925_9">Curses_Bool</A>; - <b>pragma</b> Import (C, Canchangecolor, "can_change_color"); - <b>begin</b> -- <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_2213_16">Canchangecolor</A> = <A HREF="terminal_interface-curses__ads.htm#ref_1927_4">Curses_Bool_False</A> <b>then</b> -+ <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_2213_16">Canchangecolor</A> = <A HREF="terminal_interface-curses__ads.htm#ref_1926_4">Curses_Bool_False</A> <b>then</b> - <b>return</b> False; - <b>else</b> - <b>return</b> True; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1741_13">Can_Change_Color</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1740_13">Can_Change_Color</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_2223_14" HREF="terminal_interface-curses__ads.htm#ref_1746_14">Color_Content</A></FONT> (<FONT COLOR=red><A NAME="ref_2223_29" HREF="terminal_interface-curses__ads.htm#ref_1746_29">Color</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_278_9">Color_Number</A>; -- <FONT COLOR=red><A NAME="ref_2224_29" HREF="terminal_interface-curses__ads.htm#ref_1747_29">Red</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_295_9">RGB_Value</A>; -- <FONT COLOR=red><A NAME="ref_2225_29" HREF="terminal_interface-curses__ads.htm#ref_1748_29">Green</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_295_9">RGB_Value</A>; -- <FONT COLOR=red><A NAME="ref_2226_29" HREF="terminal_interface-curses__ads.htm#ref_1749_29">Blue</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_295_9">RGB_Value</A>) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_2223_14" HREF="terminal_interface-curses__ads.htm#ref_1745_14">Color_Content</A></span> (<span class="symbol"><A NAME="ref_2223_29" HREF="terminal_interface-curses__ads.htm#ref_1745_29">Color</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_278_9">Color_Number</A>; -+ <span class="symbol"><A NAME="ref_2224_29" HREF="terminal_interface-curses__ads.htm#ref_1746_29">Red</A></span> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_295_9">RGB_Value</A>; -+ <span class="symbol"><A NAME="ref_2225_29" HREF="terminal_interface-curses__ads.htm#ref_1747_29">Green</A></span> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_295_9">RGB_Value</A>; -+ <span class="symbol"><A NAME="ref_2226_29" HREF="terminal_interface-curses__ads.htm#ref_1748_29">Blue</A></span> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_295_9">RGB_Value</A>) - <b>is</b> -- <b>type</b> <FONT COLOR=red><A NAME="ref_2228_12">C_Short_Access</A></FONT> <b>is</b> <b>access</b> <b>all</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_56_12">C_Short</A>; -+ <b>type</b> <span class="symbol"><A NAME="ref_2228_12">C_Short_Access</A></span> <b>is</b> <b>access</b> <b>all</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_56_12">C_Short</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_2230_16">Colorcontent</A></FONT> (<FONT COLOR=red><A NAME="ref_2230_30" HREF="terminal_interface-curses__adb.htm#ref_2230_16">Color</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_56_12">C_Short</A>; <FONT COLOR=red><A NAME="ref_2230_47" HREF="terminal_interface-curses__adb.htm#ref_2230_16">R</A></FONT>, <FONT COLOR=red><A NAME="ref_2230_50" HREF="terminal_interface-curses__adb.htm#ref_2230_16">G</A></FONT>, <FONT COLOR=red><A NAME="ref_2230_53" HREF="terminal_interface-curses__adb.htm#ref_2230_16">B</A></FONT> : <A HREF="terminal_interface-curses__adb.htm#ref_2228_12">C_Short_Access</A>) -+ <b>function</b> <span class="symbol"><A NAME="ref_2230_16">Colorcontent</A></span> (<span class="symbol"><A NAME="ref_2230_30" HREF="terminal_interface-curses__adb.htm#ref_2230_16">Color</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_56_12">C_Short</A>; <span class="symbol"><A NAME="ref_2230_47" HREF="terminal_interface-curses__adb.htm#ref_2230_16">R</A></span>, <span class="symbol"><A NAME="ref_2230_50" HREF="terminal_interface-curses__adb.htm#ref_2230_16">G</A></span>, <span class="symbol"><A NAME="ref_2230_53" HREF="terminal_interface-curses__adb.htm#ref_2230_16">B</A></span> : <A HREF="terminal_interface-curses__adb.htm#ref_2228_12">C_Short_Access</A>) - <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Colorcontent, "color_content"); - -- <FONT COLOR=red><A NAME="ref_2234_7">R</A></FONT>, <FONT COLOR=red><A NAME="ref_2234_10">G</A></FONT>, <FONT COLOR=red><A NAME="ref_2234_13">B</A></FONT> : <b>aliased</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_56_12">C_Short</A>; -+ <span class="symbol"><A NAME="ref_2234_7">R</A></span>, <span class="symbol"><A NAME="ref_2234_10">G</A></span>, <span class="symbol"><A NAME="ref_2234_13">B</A></span> : <b>aliased</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_56_12">C_Short</A>; - <b>begin</b> -- <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_2230_16">Colorcontent</A> (<A HREF="terminal_interface-curses-aux__ads.htm#ref_56_12">C_Short</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1746_29">Color</A>), <A HREF="terminal_interface-curses__adb.htm#ref_2234_7">R</A>'<b>Access</b>, <A HREF="terminal_interface-curses__adb.htm#ref_2234_10">G</A>'<b>Access</b>, <A HREF="terminal_interface-curses__adb.htm#ref_2234_13">B</A>'<b>Access</b>) = -+ <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_2230_16">Colorcontent</A> (<A HREF="terminal_interface-curses-aux__ads.htm#ref_56_12">C_Short</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1745_29">Color</A>), <A HREF="terminal_interface-curses__adb.htm#ref_2234_7">R</A>'<b>Access</b>, <A HREF="terminal_interface-curses__adb.htm#ref_2234_10">G</A>'<b>Access</b>, <A HREF="terminal_interface-curses__adb.htm#ref_2234_13">B</A>'<b>Access</b>) = - <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>else</b> -- <A HREF="terminal_interface-curses__ads.htm#ref_1747_29">Red</A> := <A HREF="terminal_interface-curses__ads.htm#ref_295_9">RGB_Value</A> (<A HREF="terminal_interface-curses__adb.htm#ref_2234_7">R</A>); -- <A HREF="terminal_interface-curses__ads.htm#ref_1748_29">Green</A> := <A HREF="terminal_interface-curses__ads.htm#ref_295_9">RGB_Value</A> (<A HREF="terminal_interface-curses__adb.htm#ref_2234_10">G</A>); -- <A HREF="terminal_interface-curses__ads.htm#ref_1749_29">Blue</A> := <A HREF="terminal_interface-curses__ads.htm#ref_295_9">RGB_Value</A> (<A HREF="terminal_interface-curses__adb.htm#ref_2234_13">B</A>); -+ <A HREF="terminal_interface-curses__ads.htm#ref_1746_29">Red</A> := <A HREF="terminal_interface-curses__ads.htm#ref_295_9">RGB_Value</A> (<A HREF="terminal_interface-curses__adb.htm#ref_2234_7">R</A>); -+ <A HREF="terminal_interface-curses__ads.htm#ref_1747_29">Green</A> := <A HREF="terminal_interface-curses__ads.htm#ref_295_9">RGB_Value</A> (<A HREF="terminal_interface-curses__adb.htm#ref_2234_10">G</A>); -+ <A HREF="terminal_interface-curses__ads.htm#ref_1748_29">Blue</A> := <A HREF="terminal_interface-curses__ads.htm#ref_295_9">RGB_Value</A> (<A HREF="terminal_interface-curses__adb.htm#ref_2234_13">B</A>); - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1746_14">Color_Content</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1745_14">Color_Content</A>; - --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_2247_14" HREF="terminal_interface-curses__ads.htm#ref_1761_14">Save_Curses_Mode</A></FONT> (<FONT COLOR=red><A NAME="ref_2247_32" HREF="terminal_interface-curses__ads.htm#ref_1761_32">Mode</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_1758_9">Curses_Mode</A>) -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_2247_14" HREF="terminal_interface-curses__ads.htm#ref_1760_14">Save_Curses_Mode</A></span> (<span class="symbol"><A NAME="ref_2247_32" HREF="terminal_interface-curses__ads.htm#ref_1760_32">Mode</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_1757_9">Curses_Mode</A>) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_2249_16">Def_Prog_Mode</A></FONT> <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_2249_16">Def_Prog_Mode</A></span> <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Def_Prog_Mode, "def_prog_mode"); -- <b>function</b> <FONT COLOR=red><A NAME="ref_2251_16">Def_Shell_Mode</A></FONT> <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_2251_16">Def_Shell_Mode</A></span> <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Def_Shell_Mode, "def_shell_mode"); - -- <FONT COLOR=red><A NAME="ref_2254_7">Err</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <span class="symbol"><A NAME="ref_2254_7">Err</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>begin</b> -- <b>case</b> <A HREF="terminal_interface-curses__ads.htm#ref_1761_32">Mode</A> <b>is</b> -- <b>when</b> <A HREF="terminal_interface-curses__ads.htm#ref_1758_25">Curses</A> =&gt; <A HREF="terminal_interface-curses__adb.htm#ref_2254_7">Err</A> := <A HREF="terminal_interface-curses__adb.htm#ref_2249_16">Def_Prog_Mode</A>; -- <b>when</b> <A HREF="terminal_interface-curses__ads.htm#ref_1758_33">Shell</A> =&gt; <A HREF="terminal_interface-curses__adb.htm#ref_2254_7">Err</A> := <A HREF="terminal_interface-curses__adb.htm#ref_2251_16">Def_Shell_Mode</A>; -+ <b>case</b> <A HREF="terminal_interface-curses__ads.htm#ref_1760_32">Mode</A> <b>is</b> -+ <b>when</b> <A HREF="terminal_interface-curses__ads.htm#ref_1757_25">Curses</A> =&gt; <A HREF="terminal_interface-curses__adb.htm#ref_2254_7">Err</A> := <A HREF="terminal_interface-curses__adb.htm#ref_2249_16">Def_Prog_Mode</A>; -+ <b>when</b> <A HREF="terminal_interface-curses__ads.htm#ref_1757_33">Shell</A> =&gt; <A HREF="terminal_interface-curses__adb.htm#ref_2254_7">Err</A> := <A HREF="terminal_interface-curses__adb.htm#ref_2251_16">Def_Shell_Mode</A>; - <b>end</b> <b>case</b>; - <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_2254_7">Err</A> = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1761_14">Save_Curses_Mode</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1760_14">Save_Curses_Mode</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_2265_14" HREF="terminal_interface-curses__ads.htm#ref_1767_14">Reset_Curses_Mode</A></FONT> (<FONT COLOR=red><A NAME="ref_2265_33" HREF="terminal_interface-curses__ads.htm#ref_1767_33">Mode</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_1758_9">Curses_Mode</A>) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_2265_14" HREF="terminal_interface-curses__ads.htm#ref_1766_14">Reset_Curses_Mode</A></span> (<span class="symbol"><A NAME="ref_2265_33" HREF="terminal_interface-curses__ads.htm#ref_1766_33">Mode</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_1757_9">Curses_Mode</A>) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_2267_16">Reset_Prog_Mode</A></FONT> <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_2267_16">Reset_Prog_Mode</A></span> <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Reset_Prog_Mode, "reset_prog_mode"); -- <b>function</b> <FONT COLOR=red><A NAME="ref_2269_16">Reset_Shell_Mode</A></FONT> <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_2269_16">Reset_Shell_Mode</A></span> <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Reset_Shell_Mode, "reset_shell_mode"); - -- <FONT COLOR=red><A NAME="ref_2272_7">Err</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <span class="symbol"><A NAME="ref_2272_7">Err</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>begin</b> -- <b>case</b> <A HREF="terminal_interface-curses__ads.htm#ref_1767_33">Mode</A> <b>is</b> -- <b>when</b> <A HREF="terminal_interface-curses__ads.htm#ref_1758_25">Curses</A> =&gt; <A HREF="terminal_interface-curses__adb.htm#ref_2272_7">Err</A> := <A HREF="terminal_interface-curses__adb.htm#ref_2267_16">Reset_Prog_Mode</A>; -- <b>when</b> <A HREF="terminal_interface-curses__ads.htm#ref_1758_33">Shell</A> =&gt; <A HREF="terminal_interface-curses__adb.htm#ref_2272_7">Err</A> := <A HREF="terminal_interface-curses__adb.htm#ref_2269_16">Reset_Shell_Mode</A>; -+ <b>case</b> <A HREF="terminal_interface-curses__ads.htm#ref_1766_33">Mode</A> <b>is</b> -+ <b>when</b> <A HREF="terminal_interface-curses__ads.htm#ref_1757_25">Curses</A> =&gt; <A HREF="terminal_interface-curses__adb.htm#ref_2272_7">Err</A> := <A HREF="terminal_interface-curses__adb.htm#ref_2267_16">Reset_Prog_Mode</A>; -+ <b>when</b> <A HREF="terminal_interface-curses__ads.htm#ref_1757_33">Shell</A> =&gt; <A HREF="terminal_interface-curses__adb.htm#ref_2272_7">Err</A> := <A HREF="terminal_interface-curses__adb.htm#ref_2269_16">Reset_Shell_Mode</A>; - <b>end</b> <b>case</b>; - <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_2272_7">Err</A> = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1767_14">Reset_Curses_Mode</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1766_14">Reset_Curses_Mode</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_2283_14" HREF="terminal_interface-curses__ads.htm#ref_1773_14">Save_Terminal_State</A></FONT> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_2283_14" HREF="terminal_interface-curses__ads.htm#ref_1772_14">Save_Terminal_State</A></span> - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_2285_16">Savetty</A></FONT> <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_2285_16">Savetty</A></span> <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Savetty, "savetty"); - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_2285_16">Savetty</A> = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1773_14">Save_Terminal_State</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1772_14">Save_Terminal_State</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_2293_14" HREF="terminal_interface-curses__ads.htm#ref_1778_14">Reset_Terminal_State</A></FONT> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_2293_14" HREF="terminal_interface-curses__ads.htm#ref_1777_14">Reset_Terminal_State</A></span> - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_2295_16">Resetty</A></FONT> <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_2295_16">Resetty</A></span> <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Resetty, "resetty"); - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_2295_16">Resetty</A> = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1778_14">Reset_Terminal_State</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1777_14">Reset_Terminal_State</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_2303_14" HREF="terminal_interface-curses__ads.htm#ref_1791_14">Rip_Off_Lines</A></FONT> (<FONT COLOR=red><A NAME="ref_2303_29" HREF="terminal_interface-curses__ads.htm#ref_1791_29">Lines</A></FONT> : Integer; -- <FONT COLOR=red><A NAME="ref_2304_29" HREF="terminal_interface-curses__ads.htm#ref_1792_29">Proc</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_1782_9">Stdscr_Init_Proc</A>) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_2303_14" HREF="terminal_interface-curses__ads.htm#ref_1790_14">Rip_Off_Lines</A></span> (<span class="symbol"><A NAME="ref_2303_29" HREF="terminal_interface-curses__ads.htm#ref_1790_29">Lines</A></span> : Integer; -+ <span class="symbol"><A NAME="ref_2304_29" HREF="terminal_interface-curses__ads.htm#ref_1791_29">Proc</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_1781_9">Stdscr_Init_Proc</A>) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_2306_16">Ripoffline</A></FONT> (<FONT COLOR=red><A NAME="ref_2306_28" HREF="terminal_interface-curses__adb.htm#ref_2306_16">Lines</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -- <FONT COLOR=red><A NAME="ref_2307_28" HREF="terminal_interface-curses__adb.htm#ref_2306_16">Proc</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_1782_9">Stdscr_Init_Proc</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_2306_16">Ripoffline</A></span> (<span class="symbol"><A NAME="ref_2306_28" HREF="terminal_interface-curses__adb.htm#ref_2306_16">Lines</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <span class="symbol"><A NAME="ref_2307_28" HREF="terminal_interface-curses__adb.htm#ref_2306_16">Proc</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_1781_9">Stdscr_Init_Proc</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Ripoffline, "_nc_ripoffline"); - <b>begin</b> -- <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_2306_16">Ripoffline</A> (<A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1791_29">Lines</A>), <A HREF="terminal_interface-curses__ads.htm#ref_1792_29">Proc</A>) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_2306_16">Ripoffline</A> (<A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1790_29">Lines</A>), <A HREF="terminal_interface-curses__ads.htm#ref_1791_29">Proc</A>) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1791_14">Rip_Off_Lines</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1790_14">Rip_Off_Lines</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_2315_14" HREF="terminal_interface-curses__ads.htm#ref_1803_14">Set_Cursor_Visibility</A></FONT> (<FONT COLOR=red><A NAME="ref_2315_37" HREF="terminal_interface-curses__ads.htm#ref_1803_37">Visibility</A></FONT> : <b>in</b> <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_1800_9">Cursor_Visibility</A>) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_2315_14" HREF="terminal_interface-curses__ads.htm#ref_1802_14">Set_Cursor_Visibility</A></span> (<span class="symbol"><A NAME="ref_2315_37" HREF="terminal_interface-curses__ads.htm#ref_1802_37">Visibility</A></span> : <b>in</b> <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_1799_9">Cursor_Visibility</A>) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_2317_16">Curs_Set</A></FONT> (<FONT COLOR=red><A NAME="ref_2317_26" HREF="terminal_interface-curses__adb.htm#ref_2317_16">Curs</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_2317_16">Curs_Set</A></span> (<span class="symbol"><A NAME="ref_2317_26" HREF="terminal_interface-curses__adb.htm#ref_2317_16">Curs</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Curs_Set, "curs_set"); - -- <FONT COLOR=red><A NAME="ref_2320_7">Res</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <span class="symbol"><A NAME="ref_2320_7">Res</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>begin</b> -- <A HREF="terminal_interface-curses__adb.htm#ref_2320_7">Res</A> := <A HREF="terminal_interface-curses__adb.htm#ref_2317_16">Curs_Set</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1800_9">Cursor_Visibility</A>'Pos (<A HREF="terminal_interface-curses__ads.htm#ref_1803_37">Visibility</A>)); -+ <A HREF="terminal_interface-curses__adb.htm#ref_2320_7">Res</A> := <A HREF="terminal_interface-curses__adb.htm#ref_2317_16">Curs_Set</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1799_9">Cursor_Visibility</A>'Pos (<A HREF="terminal_interface-curses__ads.htm#ref_1802_37">Visibility</A>)); - <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_2320_7">Res</A> /= <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <A HREF="terminal_interface-curses__ads.htm#ref_1803_37">Visibility</A> := <A HREF="terminal_interface-curses__ads.htm#ref_1800_9">Cursor_Visibility</A>'Val (<A HREF="terminal_interface-curses__adb.htm#ref_2320_7">Res</A>); -+ <A HREF="terminal_interface-curses__ads.htm#ref_1802_37">Visibility</A> := <A HREF="terminal_interface-curses__ads.htm#ref_1799_9">Cursor_Visibility</A>'Val (<A HREF="terminal_interface-curses__adb.htm#ref_2320_7">Res</A>); - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1803_14">Set_Cursor_Visibility</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1802_14">Set_Cursor_Visibility</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_2328_14" HREF="terminal_interface-curses__ads.htm#ref_1808_14">Nap_Milli_Seconds</A></FONT> (<FONT COLOR=red><A NAME="ref_2328_33" HREF="terminal_interface-curses__ads.htm#ref_1808_33">Ms</A></FONT> : Natural) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_2328_14" HREF="terminal_interface-curses__ads.htm#ref_1807_14">Nap_Milli_Seconds</A></span> (<span class="symbol"><A NAME="ref_2328_33" HREF="terminal_interface-curses__ads.htm#ref_1807_33">Ms</A></span> : Natural) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_2330_16">Napms</A></FONT> (<FONT COLOR=red><A NAME="ref_2330_23" HREF="terminal_interface-curses__adb.htm#ref_2330_16">Ms</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_2330_16">Napms</A></span> (<span class="symbol"><A NAME="ref_2330_23" HREF="terminal_interface-curses__adb.htm#ref_2330_16">Ms</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Napms, "napms"); - <b>begin</b> -- <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_2330_16">Napms</A> (<A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1808_33">Ms</A>)) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_2330_16">Napms</A> (<A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1807_33">Ms</A>)) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1808_14">Nap_Milli_Seconds</A>; --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1807_14">Nap_Milli_Seconds</A>; -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> - -- <b>function</b> <FONT COLOR=red><A NAME="ref_2339_13" HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A></FONT> <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> -+ <b>function</b> <span class="symbol"><A NAME="ref_2339_13" HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A></span> <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> - <b>is</b> -- <FONT COLOR=red><A NAME="ref_2341_7">Result</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="symbol"><A NAME="ref_2341_7">Result</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; - <b>pragma</b> Import (C, <A HREF="terminal_interface-curses__adb.htm#ref_2341_7">Result</A>, "stdscr"); - <b>begin</b> - <b>return</b> <A HREF="terminal_interface-curses__adb.htm#ref_2341_7">Result</A>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_2347_13" HREF="terminal_interface-curses__ads.htm#ref_483_13">Current_Window</A></FONT> <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> -+ <b>function</b> <span class="symbol"><A NAME="ref_2347_13" HREF="terminal_interface-curses__ads.htm#ref_482_13">Current_Window</A></span> <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> - <b>is</b> -- <FONT COLOR=red><A NAME="ref_2349_7">Result</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="symbol"><A NAME="ref_2349_7">Result</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; - <b>pragma</b> Import (C, <A HREF="terminal_interface-curses__adb.htm#ref_2349_7">Result</A>, "curscr"); - <b>begin</b> - <b>return</b> <A HREF="terminal_interface-curses__adb.htm#ref_2349_7">Result</A>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_483_13">Current_Window</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_482_13">Current_Window</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_2355_13" HREF="terminal_interface-curses__ads.htm#ref_414_13">Lines</A></FONT> <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_63_12">Line_Count</A> -+ <b>function</b> <span class="symbol"><A NAME="ref_2355_13" HREF="terminal_interface-curses__ads.htm#ref_413_13">Lines</A></span> <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_63_12">Line_Count</A> - <b>is</b> -- <FONT COLOR=red><A NAME="ref_2357_7">Result</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <span class="symbol"><A NAME="ref_2357_7">Result</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, <A HREF="terminal_interface-curses__adb.htm#ref_2357_7">Result</A>, "LINES"); - <b>begin</b> - <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_63_12">Line_Count</A> (<A HREF="terminal_interface-curses__adb.htm#ref_2357_7">Result</A>); -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_414_13">Lines</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_413_13">Lines</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_2363_13" HREF="terminal_interface-curses__ads.htm#ref_417_13">Columns</A></FONT> <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_65_12">Column_Count</A> -+ <b>function</b> <span class="symbol"><A NAME="ref_2363_13" HREF="terminal_interface-curses__ads.htm#ref_416_13">Columns</A></span> <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_65_12">Column_Count</A> - <b>is</b> -- <FONT COLOR=red><A NAME="ref_2365_7">Result</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <span class="symbol"><A NAME="ref_2365_7">Result</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, <A HREF="terminal_interface-curses__adb.htm#ref_2365_7">Result</A>, "COLS"); - <b>begin</b> - <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_65_12">Column_Count</A> (<A HREF="terminal_interface-curses__adb.htm#ref_2365_7">Result</A>); -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_417_13">Columns</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_416_13">Columns</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_2371_13" HREF="terminal_interface-curses__ads.htm#ref_420_13">Tab_Size</A></FONT> <b>return</b> Natural -+ <b>function</b> <span class="symbol"><A NAME="ref_2371_13" HREF="terminal_interface-curses__ads.htm#ref_419_13">Tab_Size</A></span> <b>return</b> Natural - <b>is</b> -- <FONT COLOR=red><A NAME="ref_2373_7">Result</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <span class="symbol"><A NAME="ref_2373_7">Result</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, <A HREF="terminal_interface-curses__adb.htm#ref_2373_7">Result</A>, "TABSIZE"); - <b>begin</b> - <b>return</b> Natural (<A HREF="terminal_interface-curses__adb.htm#ref_2373_7">Result</A>); -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_420_13">Tab_Size</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_419_13">Tab_Size</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_2379_13" HREF="terminal_interface-curses__ads.htm#ref_423_13">Number_Of_Colors</A></FONT> <b>return</b> Natural -+ <b>function</b> <span class="symbol"><A NAME="ref_2379_13" HREF="terminal_interface-curses__ads.htm#ref_422_13">Number_Of_Colors</A></span> <b>return</b> Natural - <b>is</b> -- <FONT COLOR=red><A NAME="ref_2381_7">Result</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <span class="symbol"><A NAME="ref_2381_7">Result</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, <A HREF="terminal_interface-curses__adb.htm#ref_2381_7">Result</A>, "COLORS"); - <b>begin</b> - <b>return</b> Natural (<A HREF="terminal_interface-curses__adb.htm#ref_2381_7">Result</A>); -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_423_13">Number_Of_Colors</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_422_13">Number_Of_Colors</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_2387_13" HREF="terminal_interface-curses__ads.htm#ref_426_13">Number_Of_Color_Pairs</A></FONT> <b>return</b> Natural -+ <b>function</b> <span class="symbol"><A NAME="ref_2387_13" HREF="terminal_interface-curses__ads.htm#ref_425_13">Number_Of_Color_Pairs</A></span> <b>return</b> Natural - <b>is</b> -- <FONT COLOR=red><A NAME="ref_2389_7">Result</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <span class="symbol"><A NAME="ref_2389_7">Result</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, <A HREF="terminal_interface-curses__adb.htm#ref_2389_7">Result</A>, "COLOR_PAIRS"); - <b>begin</b> - <b>return</b> Natural (<A HREF="terminal_interface-curses__adb.htm#ref_2389_7">Result</A>); -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_426_13">Number_Of_Color_Pairs</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_425_13">Number_Of_Color_Pairs</A>; - --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_2396_14" HREF="terminal_interface-curses__ads.htm#ref_1816_14">Transform_Coordinates</A></FONT> -- (<FONT COLOR=red><A NAME="ref_2397_7" HREF="terminal_interface-curses__ads.htm#ref_1817_7">W</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_2398_7" HREF="terminal_interface-curses__ads.htm#ref_1818_7">Line</A></FONT> : <b>in</b> <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_2399_7" HREF="terminal_interface-curses__ads.htm#ref_1819_7">Column</A></FONT> : <b>in</b> <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -- <FONT COLOR=red><A NAME="ref_2400_7" HREF="terminal_interface-curses__ads.htm#ref_1820_7">Dir</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_1815_9">Transform_Direction</A> := <A HREF="terminal_interface-curses__ads.htm#ref_1815_33">From_Screen</A>) -- <b>is</b> -- <b>type</b> <FONT COLOR=red><A NAME="ref_2402_12">Int_Access</A></FONT> <b>is</b> <b>access</b> <b>all</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -- <b>function</b> <FONT COLOR=red><A NAME="ref_2403_16">Transform</A></FONT> (<FONT COLOR=red><A NAME="ref_2403_27" HREF="terminal_interface-curses__adb.htm#ref_2403_16">W</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- <FONT COLOR=red><A NAME="ref_2404_27" HREF="terminal_interface-curses__adb.htm#ref_2403_16">Y</A></FONT>, <FONT COLOR=red><A NAME="ref_2404_30" HREF="terminal_interface-curses__adb.htm#ref_2403_16">X</A></FONT> : <A HREF="terminal_interface-curses__adb.htm#ref_2402_12">Int_Access</A>; -- <FONT COLOR=red><A NAME="ref_2405_27" HREF="terminal_interface-curses__adb.htm#ref_2403_16">Dir</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_1926_9">Curses_Bool</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_2396_14" HREF="terminal_interface-curses__ads.htm#ref_1815_14">Transform_Coordinates</A></span> -+ (<span class="symbol"><A NAME="ref_2397_7" HREF="terminal_interface-curses__ads.htm#ref_1816_7">W</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_2398_7" HREF="terminal_interface-curses__ads.htm#ref_1817_7">Line</A></span> : <b>in</b> <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_2399_7" HREF="terminal_interface-curses__ads.htm#ref_1818_7">Column</A></span> : <b>in</b> <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -+ <span class="symbol"><A NAME="ref_2400_7" HREF="terminal_interface-curses__ads.htm#ref_1819_7">Dir</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_1814_9">Transform_Direction</A> := <A HREF="terminal_interface-curses__ads.htm#ref_1814_33">From_Screen</A>) -+ <b>is</b> -+ <b>type</b> <span class="symbol"><A NAME="ref_2402_12">Int_Access</A></span> <b>is</b> <b>access</b> <b>all</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_2403_16">Transform</A></span> (<span class="symbol"><A NAME="ref_2403_27" HREF="terminal_interface-curses__adb.htm#ref_2403_16">W</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="symbol"><A NAME="ref_2404_27" HREF="terminal_interface-curses__adb.htm#ref_2403_16">Y</A></span>, <span class="symbol"><A NAME="ref_2404_30" HREF="terminal_interface-curses__adb.htm#ref_2403_16">X</A></span> : <A HREF="terminal_interface-curses__adb.htm#ref_2402_12">Int_Access</A>; -+ <span class="symbol"><A NAME="ref_2405_27" HREF="terminal_interface-curses__adb.htm#ref_2403_16">Dir</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_1925_9">Curses_Bool</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Transform, "wmouse_trafo"); - -- <FONT COLOR=red><A NAME="ref_2408_7">X</A></FONT> : <b>aliased</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> := <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1819_7">Column</A>); -- <FONT COLOR=red><A NAME="ref_2409_7">Y</A></FONT> : <b>aliased</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> := <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1818_7">Line</A>); -- <FONT COLOR=red><A NAME="ref_2410_7">D</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_1926_9">Curses_Bool</A> := <A HREF="terminal_interface-curses__ads.htm#ref_1927_4">Curses_Bool_False</A>; -- <FONT COLOR=red><A NAME="ref_2411_7">R</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <span class="symbol"><A NAME="ref_2408_7">X</A></span> : <b>aliased</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> := <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1818_7">Column</A>); -+ <span class="symbol"><A NAME="ref_2409_7">Y</A></span> : <b>aliased</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> := <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1817_7">Line</A>); -+ <span class="symbol"><A NAME="ref_2410_7">D</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_1925_9">Curses_Bool</A> := <A HREF="terminal_interface-curses__ads.htm#ref_1926_4">Curses_Bool_False</A>; -+ <span class="symbol"><A NAME="ref_2411_7">R</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>begin</b> -- <b>if</b> <A HREF="terminal_interface-curses__ads.htm#ref_1820_7">Dir</A> = <A HREF="terminal_interface-curses__ads.htm#ref_1815_46">To_Screen</A> <b>then</b> -+ <b>if</b> <A HREF="terminal_interface-curses__ads.htm#ref_1819_7">Dir</A> = <A HREF="terminal_interface-curses__ads.htm#ref_1814_46">To_Screen</A> <b>then</b> - <A HREF="terminal_interface-curses__adb.htm#ref_2410_7">D</A> := 1; - <b>end</b> <b>if</b>; -- <A HREF="terminal_interface-curses__adb.htm#ref_2411_7">R</A> := <A HREF="terminal_interface-curses__adb.htm#ref_2403_16">Transform</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1817_7">W</A>, <A HREF="terminal_interface-curses__adb.htm#ref_2409_7">Y</A>'<b>Access</b>, <A HREF="terminal_interface-curses__adb.htm#ref_2408_7">X</A>'<b>Access</b>, <A HREF="terminal_interface-curses__adb.htm#ref_2410_7">D</A>); -+ <A HREF="terminal_interface-curses__adb.htm#ref_2411_7">R</A> := <A HREF="terminal_interface-curses__adb.htm#ref_2403_16">Transform</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1816_7">W</A>, <A HREF="terminal_interface-curses__adb.htm#ref_2409_7">Y</A>'<b>Access</b>, <A HREF="terminal_interface-curses__adb.htm#ref_2408_7">X</A>'<b>Access</b>, <A HREF="terminal_interface-curses__adb.htm#ref_2410_7">D</A>); - <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_2411_7">R</A> = <A HREF="terminal_interface-curses-aux__ads.htm#ref_75_4">Curses_False</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>else</b> -- <A HREF="terminal_interface-curses__ads.htm#ref_1818_7">Line</A> := <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A> (<A HREF="terminal_interface-curses__adb.htm#ref_2409_7">Y</A>); -- <A HREF="terminal_interface-curses__ads.htm#ref_1819_7">Column</A> := <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A> (<A HREF="terminal_interface-curses__adb.htm#ref_2408_7">X</A>); -+ <A HREF="terminal_interface-curses__ads.htm#ref_1817_7">Line</A> := <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A> (<A HREF="terminal_interface-curses__adb.htm#ref_2409_7">Y</A>); -+ <A HREF="terminal_interface-curses__ads.htm#ref_1818_7">Column</A> := <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A> (<A HREF="terminal_interface-curses__adb.htm#ref_2408_7">X</A>); - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1816_14">Transform_Coordinates</A>; --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_2425_14" HREF="terminal_interface-curses__ads.htm#ref_1833_14">Use_Default_Colors</A></FONT> <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_2426_16">C_Use_Default_Colors</A></FONT> <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1815_14">Transform_Coordinates</A>; -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_2425_14" HREF="terminal_interface-curses__ads.htm#ref_1832_14">Use_Default_Colors</A></span> <b>is</b> -+ <b>function</b> <span class="symbol"><A NAME="ref_2426_16">C_Use_Default_Colors</A></span> <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, C_Use_Default_Colors, "use_default_colors"); -- <FONT COLOR=red><A NAME="ref_2428_7">Err</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> := <A HREF="terminal_interface-curses__adb.htm#ref_2426_16">C_Use_Default_Colors</A>; -+ <span class="symbol"><A NAME="ref_2428_7">Err</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> := <A HREF="terminal_interface-curses__adb.htm#ref_2426_16">C_Use_Default_Colors</A>; - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_2428_7">Err</A> = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1833_14">Use_Default_Colors</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1832_14">Use_Default_Colors</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_2435_14" HREF="terminal_interface-curses__ads.htm#ref_1838_14">Assume_Default_Colors</A></FONT> (<FONT COLOR=red><A NAME="ref_2435_37" HREF="terminal_interface-curses__ads.htm#ref_1838_37">Fore</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_278_9">Color_Number</A> := <A HREF="terminal_interface-curses__ads.htm#ref_285_4">Default_Color</A>; -- <FONT COLOR=red><A NAME="ref_2436_37" HREF="terminal_interface-curses__ads.htm#ref_1839_37">Back</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_278_9">Color_Number</A> := <A HREF="terminal_interface-curses__ads.htm#ref_285_4">Default_Color</A>) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_2435_14" HREF="terminal_interface-curses__ads.htm#ref_1837_14">Assume_Default_Colors</A></span> (<span class="symbol"><A NAME="ref_2435_37" HREF="terminal_interface-curses__ads.htm#ref_1837_37">Fore</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_278_9">Color_Number</A> := <A HREF="terminal_interface-curses__ads.htm#ref_285_4">Default_Color</A>; -+ <span class="symbol"><A NAME="ref_2436_37" HREF="terminal_interface-curses__ads.htm#ref_1838_37">Back</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_278_9">Color_Number</A> := <A HREF="terminal_interface-curses__ads.htm#ref_285_4">Default_Color</A>) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_2438_16">C_Assume_Default_Colors</A></FONT> (<FONT COLOR=red><A NAME="ref_2438_41" HREF="terminal_interface-curses__adb.htm#ref_2438_16">Fore</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -- <FONT COLOR=red><A NAME="ref_2439_41" HREF="terminal_interface-curses__adb.htm#ref_2438_16">Back</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_2438_16">C_Assume_Default_Colors</A></span> (<span class="symbol"><A NAME="ref_2438_41" HREF="terminal_interface-curses__adb.htm#ref_2438_16">Fore</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <span class="symbol"><A NAME="ref_2439_41" HREF="terminal_interface-curses__adb.htm#ref_2438_16">Back</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, C_Assume_Default_Colors, "assume_default_colors"); - -- <FONT COLOR=red><A NAME="ref_2442_7">Err</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> := <A HREF="terminal_interface-curses__adb.htm#ref_2438_16">C_Assume_Default_Colors</A> (<A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1838_37">Fore</A>), -- <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1839_37">Back</A>)); -+ <span class="symbol"><A NAME="ref_2442_7">Err</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> := <A HREF="terminal_interface-curses__adb.htm#ref_2438_16">C_Assume_Default_Colors</A> (<A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1837_37">Fore</A>), -+ <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1838_37">Back</A>)); - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_2442_7">Err</A> = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1838_14">Assume_Default_Colors</A>; --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_2450_13" HREF="terminal_interface-curses__ads.htm#ref_1848_13">Curses_Version</A></FONT> <b>return</b> String -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1837_14">Assume_Default_Colors</A>; -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_2450_13" HREF="terminal_interface-curses__ads.htm#ref_1847_13">Curses_Version</A></span> <b>return</b> String - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_2452_16">curses_versionC</A></FONT> <b>return</b> chars_ptr; -+ <b>function</b> <span class="symbol"><A NAME="ref_2452_16">curses_versionC</A></span> <b>return</b> chars_ptr; - <b>pragma</b> Import (C, curses_versionC, "curses_version"); -- <FONT COLOR=red><A NAME="ref_2454_7">Result</A></FONT> : <b>constant</b> chars_ptr := <A HREF="terminal_interface-curses__adb.htm#ref_2452_16">curses_versionC</A>; -+ <span class="symbol"><A NAME="ref_2454_7">Result</A></span> : <b>constant</b> chars_ptr := <A HREF="terminal_interface-curses__adb.htm#ref_2452_16">curses_versionC</A>; - <b>begin</b> - <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_121_13">Fill_String</A> (<A HREF="terminal_interface-curses__adb.htm#ref_2454_7">Result</A>); -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1848_13">Curses_Version</A>; --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_2459_14" HREF="terminal_interface-curses__ads.htm#ref_1861_14">Curses_Free_All</A></FONT> <b>is</b> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_2460_17">curses_freeall</A></FONT>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1847_13">Curses_Version</A>; -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_2459_14" HREF="terminal_interface-curses__ads.htm#ref_1860_14">Curses_Free_All</A></span> <b>is</b> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_2460_17">curses_freeall</A></span>; - <b>pragma</b> Import (C, curses_freeall, "_nc_freeall"); - <b>begin</b> -- <FONT COLOR=green><EM>-- Use this only for testing: you cannot use curses after calling it,</EM></FONT> -- <FONT COLOR=green><EM>-- so it has to be the "last" thing done before exiting the program.</EM></FONT> -- <FONT COLOR=green><EM>-- This will not really free ALL of memory used by curses. That is</EM></FONT> -- <FONT COLOR=green><EM>-- because it cannot free the memory used for stdout's setbuf. The</EM></FONT> -- <FONT COLOR=green><EM>-- _nc_free_and_exit() procedure can do that, but it can be invoked</EM></FONT> -- <FONT COLOR=green><EM>-- safely only from C - and again, that only as the "last" thing done</EM></FONT> -- <FONT COLOR=green><EM>-- before exiting the program.</EM></FONT> -+ <span class="comment"><EM>-- Use this only for testing: you cannot use curses after calling it,</EM></span> -+ <span class="comment"><EM>-- so it has to be the "last" thing done before exiting the program.</EM></span> -+ <span class="comment"><EM>-- This will not really free ALL of memory used by curses. That is</EM></span> -+ <span class="comment"><EM>-- because it cannot free the memory used for stdout's setbuf. The</EM></span> -+ <span class="comment"><EM>-- _nc_free_and_exit() procedure can do that, but it can be invoked</EM></span> -+ <span class="comment"><EM>-- safely only from C - and again, that only as the "last" thing done</EM></span> -+ <span class="comment"><EM>-- before exiting the program.</EM></span> - <A HREF="terminal_interface-curses__adb.htm#ref_2460_17">curses_freeall</A>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1861_14">Curses_Free_All</A>; --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_2473_13" HREF="terminal_interface-curses__ads.htm#ref_1853_13">Use_Extended_Names</A></FONT> (<FONT COLOR=red><A NAME="ref_2473_33" HREF="terminal_interface-curses__ads.htm#ref_1853_33">Enable</A></FONT> : Boolean) <b>return</b> Boolean -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1860_14">Curses_Free_All</A>; -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_2473_13" HREF="terminal_interface-curses__ads.htm#ref_1852_13">Use_Extended_Names</A></span> (<span class="symbol"><A NAME="ref_2473_33" HREF="terminal_interface-curses__ads.htm#ref_1852_33">Enable</A></span> : Boolean) <b>return</b> Boolean - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_2475_16">use_extended_namesC</A></FONT> (<FONT COLOR=red><A NAME="ref_2475_37" HREF="terminal_interface-curses__adb.htm#ref_2475_16">e</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_1926_9">Curses_Bool</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_2475_16">use_extended_namesC</A></span> (<span class="symbol"><A NAME="ref_2475_37" HREF="terminal_interface-curses__adb.htm#ref_2475_16">e</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_1925_9">Curses_Bool</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, use_extended_namesC, "use_extended_names"); - -- <FONT COLOR=red><A NAME="ref_2478_7">Res</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> := -- <A HREF="terminal_interface-curses__adb.htm#ref_2475_16">use_extended_namesC</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1926_9">Curses_Bool</A> (Boolean'Pos (<A HREF="terminal_interface-curses__ads.htm#ref_1853_33">Enable</A>))); -+ <span class="symbol"><A NAME="ref_2478_7">Res</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> := -+ <A HREF="terminal_interface-curses__adb.htm#ref_2475_16">use_extended_namesC</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1925_9">Curses_Bool</A> (Boolean'Pos (<A HREF="terminal_interface-curses__ads.htm#ref_1852_33">Enable</A>))); - <b>begin</b> -- <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_2478_7">Res</A> = <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1927_4">Curses_Bool_False</A>) <b>then</b> -+ <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_2478_7">Res</A> = <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1926_4">Curses_Bool_False</A>) <b>then</b> - <b>return</b> False; - <b>else</b> - <b>return</b> True; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1853_13">Use_Extended_Names</A>; --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_2488_14" HREF="terminal_interface-curses__ads.htm#ref_1869_14">Screen_Dump_To_File</A></FONT> (<FONT COLOR=red><A NAME="ref_2488_35" HREF="terminal_interface-curses__ads.htm#ref_1869_35">Filename</A></FONT> : String) -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1852_13">Use_Extended_Names</A>; -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_2488_14" HREF="terminal_interface-curses__ads.htm#ref_1868_14">Screen_Dump_To_File</A></span> (<span class="symbol"><A NAME="ref_2488_35" HREF="terminal_interface-curses__ads.htm#ref_1868_35">Filename</A></span> : String) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_2490_16">scr_dump</A></FONT> (<FONT COLOR=red><A NAME="ref_2490_26" HREF="terminal_interface-curses__adb.htm#ref_2490_16">f</A></FONT> : char_array) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_2490_16">scr_dump</A></span> (<span class="symbol"><A NAME="ref_2490_26" HREF="terminal_interface-curses__adb.htm#ref_2490_16">f</A></span> : char_array) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, scr_dump, "scr_dump"); -- <FONT COLOR=red><A NAME="ref_2492_7">Txt</A></FONT> : char_array (0 .. <A HREF="terminal_interface-curses__ads.htm#ref_1869_35">Filename</A>'Length); -- <FONT COLOR=red><A NAME="ref_2493_7">Length</A></FONT> : size_t; -+ <span class="symbol"><A NAME="ref_2492_7">Txt</A></span> : char_array (0 .. <A HREF="terminal_interface-curses__ads.htm#ref_1868_35">Filename</A>'Length); -+ <span class="symbol"><A NAME="ref_2493_7">Length</A></span> : size_t; - <b>begin</b> -- To_C (<A HREF="terminal_interface-curses__ads.htm#ref_1869_35">Filename</A>, <A HREF="terminal_interface-curses__adb.htm#ref_2492_7">Txt</A>, <A HREF="terminal_interface-curses__adb.htm#ref_2493_7">Length</A>); -+ To_C (<A HREF="terminal_interface-curses__ads.htm#ref_1868_35">Filename</A>, <A HREF="terminal_interface-curses__adb.htm#ref_2492_7">Txt</A>, <A HREF="terminal_interface-curses__adb.htm#ref_2493_7">Length</A>); - <b>if</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> = <A HREF="terminal_interface-curses__adb.htm#ref_2490_16">scr_dump</A> (<A HREF="terminal_interface-curses__adb.htm#ref_2492_7">Txt</A>) <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1869_14">Screen_Dump_To_File</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1868_14">Screen_Dump_To_File</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_2501_14" HREF="terminal_interface-curses__ads.htm#ref_1873_14">Screen_Restore_From_File</A></FONT> (<FONT COLOR=red><A NAME="ref_2501_40" HREF="terminal_interface-curses__ads.htm#ref_1873_40">Filename</A></FONT> : String) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_2501_14" HREF="terminal_interface-curses__ads.htm#ref_1872_14">Screen_Restore_From_File</A></span> (<span class="symbol"><A NAME="ref_2501_40" HREF="terminal_interface-curses__ads.htm#ref_1872_40">Filename</A></span> : String) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_2503_16">scr_restore</A></FONT> (<FONT COLOR=red><A NAME="ref_2503_29" HREF="terminal_interface-curses__adb.htm#ref_2503_16">f</A></FONT> : char_array) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_2503_16">scr_restore</A></span> (<span class="symbol"><A NAME="ref_2503_29" HREF="terminal_interface-curses__adb.htm#ref_2503_16">f</A></span> : char_array) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, scr_restore, "scr_restore"); -- <FONT COLOR=red><A NAME="ref_2505_7">Txt</A></FONT> : char_array (0 .. <A HREF="terminal_interface-curses__ads.htm#ref_1873_40">Filename</A>'Length); -- <FONT COLOR=red><A NAME="ref_2506_7">Length</A></FONT> : size_t; -+ <span class="symbol"><A NAME="ref_2505_7">Txt</A></span> : char_array (0 .. <A HREF="terminal_interface-curses__ads.htm#ref_1872_40">Filename</A>'Length); -+ <span class="symbol"><A NAME="ref_2506_7">Length</A></span> : size_t; - <b>begin</b> -- To_C (<A HREF="terminal_interface-curses__ads.htm#ref_1873_40">Filename</A>, <A HREF="terminal_interface-curses__adb.htm#ref_2505_7">Txt</A>, <A HREF="terminal_interface-curses__adb.htm#ref_2506_7">Length</A>); -+ To_C (<A HREF="terminal_interface-curses__ads.htm#ref_1872_40">Filename</A>, <A HREF="terminal_interface-curses__adb.htm#ref_2505_7">Txt</A>, <A HREF="terminal_interface-curses__adb.htm#ref_2506_7">Length</A>); - <b>if</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> = <A HREF="terminal_interface-curses__adb.htm#ref_2503_16">scr_restore</A> (<A HREF="terminal_interface-curses__adb.htm#ref_2505_7">Txt</A>) <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1873_14">Screen_Restore_From_File</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1872_14">Screen_Restore_From_File</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_2514_14" HREF="terminal_interface-curses__ads.htm#ref_1877_14">Screen_Init_From_File</A></FONT> (<FONT COLOR=red><A NAME="ref_2514_37" HREF="terminal_interface-curses__ads.htm#ref_1877_37">Filename</A></FONT> : String) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_2514_14" HREF="terminal_interface-curses__ads.htm#ref_1876_14">Screen_Init_From_File</A></span> (<span class="symbol"><A NAME="ref_2514_37" HREF="terminal_interface-curses__ads.htm#ref_1876_37">Filename</A></span> : String) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_2516_16">scr_init</A></FONT> (<FONT COLOR=red><A NAME="ref_2516_26" HREF="terminal_interface-curses__adb.htm#ref_2516_16">f</A></FONT> : char_array) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_2516_16">scr_init</A></span> (<span class="symbol"><A NAME="ref_2516_26" HREF="terminal_interface-curses__adb.htm#ref_2516_16">f</A></span> : char_array) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, scr_init, "scr_init"); -- <FONT COLOR=red><A NAME="ref_2518_7">Txt</A></FONT> : char_array (0 .. <A HREF="terminal_interface-curses__ads.htm#ref_1877_37">Filename</A>'Length); -- <FONT COLOR=red><A NAME="ref_2519_7">Length</A></FONT> : size_t; -+ <span class="symbol"><A NAME="ref_2518_7">Txt</A></span> : char_array (0 .. <A HREF="terminal_interface-curses__ads.htm#ref_1876_37">Filename</A>'Length); -+ <span class="symbol"><A NAME="ref_2519_7">Length</A></span> : size_t; - <b>begin</b> -- To_C (<A HREF="terminal_interface-curses__ads.htm#ref_1877_37">Filename</A>, <A HREF="terminal_interface-curses__adb.htm#ref_2518_7">Txt</A>, <A HREF="terminal_interface-curses__adb.htm#ref_2519_7">Length</A>); -+ To_C (<A HREF="terminal_interface-curses__ads.htm#ref_1876_37">Filename</A>, <A HREF="terminal_interface-curses__adb.htm#ref_2518_7">Txt</A>, <A HREF="terminal_interface-curses__adb.htm#ref_2519_7">Length</A>); - <b>if</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> = <A HREF="terminal_interface-curses__adb.htm#ref_2516_16">scr_init</A> (<A HREF="terminal_interface-curses__adb.htm#ref_2518_7">Txt</A>) <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1877_14">Screen_Init_From_File</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1876_14">Screen_Init_From_File</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_2527_14" HREF="terminal_interface-curses__ads.htm#ref_1881_14">Screen_Set_File</A></FONT> (<FONT COLOR=red><A NAME="ref_2527_31" HREF="terminal_interface-curses__ads.htm#ref_1881_31">Filename</A></FONT> : String) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_2527_14" HREF="terminal_interface-curses__ads.htm#ref_1880_14">Screen_Set_File</A></span> (<span class="symbol"><A NAME="ref_2527_31" HREF="terminal_interface-curses__ads.htm#ref_1880_31">Filename</A></span> : String) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_2529_16">scr_set</A></FONT> (<FONT COLOR=red><A NAME="ref_2529_25" HREF="terminal_interface-curses__adb.htm#ref_2529_16">f</A></FONT> : char_array) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_2529_16">scr_set</A></span> (<span class="symbol"><A NAME="ref_2529_25" HREF="terminal_interface-curses__adb.htm#ref_2529_16">f</A></span> : char_array) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, scr_set, "scr_set"); -- <FONT COLOR=red><A NAME="ref_2531_7">Txt</A></FONT> : char_array (0 .. <A HREF="terminal_interface-curses__ads.htm#ref_1881_31">Filename</A>'Length); -- <FONT COLOR=red><A NAME="ref_2532_7">Length</A></FONT> : size_t; -+ <span class="symbol"><A NAME="ref_2531_7">Txt</A></span> : char_array (0 .. <A HREF="terminal_interface-curses__ads.htm#ref_1880_31">Filename</A>'Length); -+ <span class="symbol"><A NAME="ref_2532_7">Length</A></span> : size_t; - <b>begin</b> -- To_C (<A HREF="terminal_interface-curses__ads.htm#ref_1881_31">Filename</A>, <A HREF="terminal_interface-curses__adb.htm#ref_2531_7">Txt</A>, <A HREF="terminal_interface-curses__adb.htm#ref_2532_7">Length</A>); -+ To_C (<A HREF="terminal_interface-curses__ads.htm#ref_1880_31">Filename</A>, <A HREF="terminal_interface-curses__adb.htm#ref_2531_7">Txt</A>, <A HREF="terminal_interface-curses__adb.htm#ref_2532_7">Length</A>); - <b>if</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> = <A HREF="terminal_interface-curses__adb.htm#ref_2529_16">scr_set</A> (<A HREF="terminal_interface-curses__adb.htm#ref_2531_7">Txt</A>) <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1881_14">Screen_Set_File</A>; --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_2540_14" HREF="terminal_interface-curses__ads.htm#ref_1913_14">Resize</A></FONT> (<FONT COLOR=red><A NAME="ref_2540_22" HREF="terminal_interface-curses__ads.htm#ref_1913_22">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_2541_22" HREF="terminal_interface-curses__ads.htm#ref_1914_22">Number_Of_Lines</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_63_12">Line_Count</A>; -- <FONT COLOR=red><A NAME="ref_2542_22" HREF="terminal_interface-curses__ads.htm#ref_1915_22">Number_Of_Columns</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_65_12">Column_Count</A>) <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_2543_16">wresize</A></FONT> (<FONT COLOR=red><A NAME="ref_2543_25" HREF="terminal_interface-curses__adb.htm#ref_2543_16">win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- <FONT COLOR=red><A NAME="ref_2544_25" HREF="terminal_interface-curses__adb.htm#ref_2543_16">lines</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -- <FONT COLOR=red><A NAME="ref_2545_25" HREF="terminal_interface-curses__adb.htm#ref_2543_16">columns</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1880_14">Screen_Set_File</A>; -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_2540_14" HREF="terminal_interface-curses__ads.htm#ref_1912_14">Resize</A></span> (<span class="symbol"><A NAME="ref_2540_22" HREF="terminal_interface-curses__ads.htm#ref_1912_22">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_2541_22" HREF="terminal_interface-curses__ads.htm#ref_1913_22">Number_Of_Lines</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_63_12">Line_Count</A>; -+ <span class="symbol"><A NAME="ref_2542_22" HREF="terminal_interface-curses__ads.htm#ref_1914_22">Number_Of_Columns</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_65_12">Column_Count</A>) <b>is</b> -+ <b>function</b> <span class="symbol"><A NAME="ref_2543_16">wresize</A></span> (<span class="symbol"><A NAME="ref_2543_25" HREF="terminal_interface-curses__adb.htm#ref_2543_16">win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="symbol"><A NAME="ref_2544_25" HREF="terminal_interface-curses__adb.htm#ref_2543_16">lines</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <span class="symbol"><A NAME="ref_2545_25" HREF="terminal_interface-curses__adb.htm#ref_2543_16">columns</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, wresize); - <b>begin</b> -- <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_2543_16">wresize</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1913_22">Win</A>, -- <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1914_22">Number_Of_Lines</A>), -- <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1915_22">Number_Of_Columns</A>)) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>if</b> <A HREF="terminal_interface-curses__adb.htm#ref_2543_16">wresize</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1912_22">Win</A>, -+ <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1913_22">Number_Of_Lines</A>), -+ <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses__ads.htm#ref_1914_22">Number_Of_Columns</A>)) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1913_14">Resize</A>; --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -+ <b>end</b> <A HREF="terminal_interface-curses__ads.htm#ref_1912_14">Resize</A>; -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> - - <b>end</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>; - </PRE></BODY></HTML> -diff -Naur ncurses-5.9/doc/html/ada/terminal_interface-curses__ads.htm ncurses-5.9.patch/doc/html/ada/terminal_interface-curses__ads.htm ---- ncurses-5.9/doc/html/ada/terminal_interface-curses__ads.htm 2011-04-02 21:53:41.000000000 +0200 -+++ ncurses-5.9.patch/doc/html/ada/terminal_interface-curses__ads.htm 2014-09-01 16:33:22.314792053 +0200 -@@ -1,225 +1,237 @@ --<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> --<HTML><HEAD><TITLE>terminal_interface-curses.ads</TITLE></HEAD> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> -+<HTML> -+<HEAD> -+<TITLE>terminal_interface-curses.ads</TITLE> -+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> -+<style type="text/css"> -+*.comment { -+ color: green; -+} -+*.symbol { -+ color: red; -+} -+</style> -+</HEAD> - <BODY> --<HR><DIV ALIGN="center"><H1> File : terminal_interface-curses.ads </H1></DIV><HR> -+<HR><DIV style="text-align:center"><H1> File : terminal_interface-curses.ads </H1></DIV><HR> - <PRE> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Terminal_Interface.Curses --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- S P E C --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Copyright (c) 1998-2009,2011 Free Software Foundation, Inc. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></FONT> --<FONT COLOR=green><EM>-- copy of this software and associated documentation files (the --</EM></FONT> --<FONT COLOR=green><EM>-- "Software"), to deal in the Software without restriction, including --</EM></FONT> --<FONT COLOR=green><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></FONT> --<FONT COLOR=green><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></FONT> --<FONT COLOR=green><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></FONT> --<FONT COLOR=green><EM>-- furnished to do so, subject to the following conditions: --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- The above copyright notice and this permission notice shall be included --</EM></FONT> --<FONT COLOR=green><EM>-- in all copies or substantial portions of the Software. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></FONT> --<FONT COLOR=green><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></FONT> --<FONT COLOR=green><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></FONT> --<FONT COLOR=green><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></FONT> --<FONT COLOR=green><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></FONT> --<FONT COLOR=green><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></FONT> --<FONT COLOR=green><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></FONT> --<FONT COLOR=green><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></FONT> --<FONT COLOR=green><EM>-- sale, use or other dealings in this Software without prior written --</EM></FONT> --<FONT COLOR=green><EM>-- authorization. --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Author: Juergen Pfeifer, 1996</EM></FONT> --<FONT COLOR=green><EM>-- Version Control:</EM></FONT> --<FONT COLOR=green><EM>-- @Revision: 1.44 @</EM></FONT> --<FONT COLOR=green><EM>-- @Date: 2011/03/19 23:05:56 @</EM></FONT> --<FONT COLOR=green><EM>-- Binding Version 01.00</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- curses binding.</EM></FONT> --<FONT COLOR=green><EM>-- This module is generated. Please don't change it manually!</EM></FONT> --<FONT COLOR=green><EM>-- Run the generator instead.</EM></FONT> --<FONT COLOR=green><EM>-- |</EM></FONT> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Terminal_Interface.Curses --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- S P E C --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Copyright (c) 1998-2009,2011 Free Software Foundation, Inc. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></span> -+<span class="comment"><EM>-- copy of this software and associated documentation files (the --</EM></span> -+<span class="comment"><EM>-- "Software"), to deal in the Software without restriction, including --</EM></span> -+<span class="comment"><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></span> -+<span class="comment"><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></span> -+<span class="comment"><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></span> -+<span class="comment"><EM>-- furnished to do so, subject to the following conditions: --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- The above copyright notice and this permission notice shall be included --</EM></span> -+<span class="comment"><EM>-- in all copies or substantial portions of the Software. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></span> -+<span class="comment"><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></span> -+<span class="comment"><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></span> -+<span class="comment"><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></span> -+<span class="comment"><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></span> -+<span class="comment"><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></span> -+<span class="comment"><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></span> -+<span class="comment"><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></span> -+<span class="comment"><EM>-- sale, use or other dealings in this Software without prior written --</EM></span> -+<span class="comment"><EM>-- authorization. --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Author: Juergen Pfeifer, 1996</EM></span> -+<span class="comment"><EM>-- Version Control:</EM></span> -+<span class="comment"><EM>-- @Revision: 1.44 @</EM></span> -+<span class="comment"><EM>-- @Date: 2011/03/19 23:05:56 @</EM></span> -+<span class="comment"><EM>-- Binding Version 01.00</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- curses binding.</EM></span> -+<span class="comment"><EM>-- This module is generated. Please don't change it manually!</EM></span> -+<span class="comment"><EM>-- Run the generator instead.</EM></span> -+<span class="comment"><EM>-- |</EM></span> - <b>with</b> System.Storage_Elements; --<b>with</b> <A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>.C; <FONT COLOR=green><EM>-- We need this for some assertions.</EM></FONT> -+<b>with</b> <A HREF="interfac__ads.htm#ref_36_9">Interfaces</A>.C; <span class="comment"><EM>-- We need this for some assertions.</EM></span> - --<b>package</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<FONT COLOR=red><A NAME="ref_49_28" HREF="terminal_interface-curses__adb.htm#ref_50_33">Curses</A></FONT> <b>is</b> -+<b>package</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<span class="symbol"><A NAME="ref_49_28" HREF="terminal_interface-curses__adb.htm#ref_50_33">Curses</A></span> <b>is</b> - <b>pragma</b> Preelaborate (<A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>); - <b>pragma</b> Linker_Options ("-lncurses"); - -- <FONT COLOR=red><A NAME="ref_53_4">NC_Major_Version</A></FONT> : <b>constant</b> := 5; <FONT COLOR=green><EM>-- Major version of the library</EM></FONT> -- <FONT COLOR=red><A NAME="ref_54_4">NC_Minor_Version</A></FONT> : <b>constant</b> := 9; <FONT COLOR=green><EM>-- Minor version of the library</EM></FONT> -- <FONT COLOR=red><A NAME="ref_55_4">NC_Version</A></FONT> : <b>constant</b> String := "5.9"; <FONT COLOR=green><EM>-- Version of library</EM></FONT> -- -- <b>type</b> <FONT COLOR=red><A NAME="ref_57_9">Window</A></FONT> <b>is</b> <b>private</b>; -- <FONT COLOR=red><A NAME="ref_58_4">Null_Window</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- -- <b>type</b> <FONT COLOR=red><A NAME="ref_60_9">Line_Position</A></FONT> <b>is</b> <b>new</b> Integer; <FONT COLOR=green><EM>-- line coordinate</EM></FONT> -- <b>type</b> <FONT COLOR=red><A NAME="ref_61_9">Column_Position</A></FONT> <b>is</b> <b>new</b> Integer; <FONT COLOR=green><EM>-- column coordinate</EM></FONT> -- -- <b>subtype</b> <FONT COLOR=red><A NAME="ref_63_12">Line_Count</A></FONT> <b>is</b> <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A> <b>range</b> 1 .. <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>'Last; -- <FONT COLOR=green><EM>-- Type to count lines. We do not allow null windows, so must be positive</EM></FONT> -- <b>subtype</b> <FONT COLOR=red><A NAME="ref_65_12">Column_Count</A></FONT> <b>is</b> <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A> <b>range</b> 1 .. <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>'Last; -- <FONT COLOR=green><EM>-- Type to count columns. We do not allow null windows, so must be positive</EM></FONT> -- -- <b>type</b> <FONT COLOR=red><A NAME="ref_68_9">Key_Code</A></FONT> <b>is</b> <b>new</b> Integer; -- <FONT COLOR=green><EM>-- That is anything including real characters, special keys and logical</EM></FONT> -- <FONT COLOR=green><EM>-- request codes.</EM></FONT> -- -- <FONT COLOR=green><EM>-- FIXME: The "-1" should be Curses_Err</EM></FONT> -- <b>subtype</b> <FONT COLOR=red><A NAME="ref_73_12">Real_Key_Code</A></FONT> <b>is</b> <A HREF="terminal_interface-curses__ads.htm#ref_68_9">Key_Code</A> <b>range</b> -1 .. 8#777#; -- <FONT COLOR=green><EM>-- This are the codes that potentially represent a real keystroke.</EM></FONT> -- <FONT COLOR=green><EM>-- Not all codes may be possible on a specific terminal. To check the</EM></FONT> -- <FONT COLOR=green><EM>-- availability of a special key, the Has_Key function is provided.</EM></FONT> -+ <span class="symbol"><A NAME="ref_53_4">NC_Major_Version</A></span> : <b>constant</b> := 5; <span class="comment"><EM>-- Major version of the library</EM></span> -+ <span class="symbol"><A NAME="ref_54_4">NC_Minor_Version</A></span> : <b>constant</b> := 9; <span class="comment"><EM>-- Minor version of the library</EM></span> -+ <span class="symbol"><A NAME="ref_55_4">NC_Version</A></span> : <b>constant</b> String := "5.9"; <span class="comment"><EM>-- Version of library</EM></span> -+ -+ <b>type</b> <span class="symbol"><A NAME="ref_57_9">Window</A></span> <b>is</b> <b>private</b>; -+ <span class="symbol"><A NAME="ref_58_4">Null_Window</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ -+ <b>type</b> <span class="symbol"><A NAME="ref_60_9">Line_Position</A></span> <b>is</b> <b>new</b> Integer; <span class="comment"><EM>-- line coordinate</EM></span> -+ <b>type</b> <span class="symbol"><A NAME="ref_61_9">Column_Position</A></span> <b>is</b> <b>new</b> Integer; <span class="comment"><EM>-- column coordinate</EM></span> -+ -+ <b>subtype</b> <span class="symbol"><A NAME="ref_63_12">Line_Count</A></span> <b>is</b> <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A> <b>range</b> 1 .. <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>'Last; -+ <span class="comment"><EM>-- Type to count lines. We do not allow null windows, so must be positive</EM></span> -+ <b>subtype</b> <span class="symbol"><A NAME="ref_65_12">Column_Count</A></span> <b>is</b> <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A> <b>range</b> 1 .. <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>'Last; -+ <span class="comment"><EM>-- Type to count columns. We do not allow null windows, so must be positive</EM></span> -+ -+ <b>type</b> <span class="symbol"><A NAME="ref_68_9">Key_Code</A></span> <b>is</b> <b>new</b> Integer; -+ <span class="comment"><EM>-- That is anything including real characters, special keys and logical</EM></span> -+ <span class="comment"><EM>-- request codes.</EM></span> -+ -+ <span class="comment"><EM>-- FIXME: The "-1" should be Curses_Err</EM></span> -+ <b>subtype</b> <span class="symbol"><A NAME="ref_73_12">Real_Key_Code</A></span> <b>is</b> <A HREF="terminal_interface-curses__ads.htm#ref_68_9">Key_Code</A> <b>range</b> -1 .. 8#777#; -+ <span class="comment"><EM>-- This are the codes that potentially represent a real keystroke.</EM></span> -+ <span class="comment"><EM>-- Not all codes may be possible on a specific terminal. To check the</EM></span> -+ <span class="comment"><EM>-- availability of a special key, the Has_Key function is provided.</EM></span> - -- <b>subtype</b> <FONT COLOR=red><A NAME="ref_78_12">Special_Key_Code</A></FONT> <b>is</b> <A HREF="terminal_interface-curses__ads.htm#ref_73_12">Real_Key_Code</A> -+ <b>subtype</b> <span class="symbol"><A NAME="ref_78_12">Special_Key_Code</A></span> <b>is</b> <A HREF="terminal_interface-curses__ads.htm#ref_73_12">Real_Key_Code</A> - <b>range</b> 8#400# .. <A HREF="terminal_interface-curses__ads.htm#ref_73_12">Real_Key_Code</A>'Last; -- <FONT COLOR=green><EM>-- Type for a function- or special key number</EM></FONT> -+ <span class="comment"><EM>-- Type for a function- or special key number</EM></span> - -- <b>subtype</b> <FONT COLOR=red><A NAME="ref_82_12">Normal_Key_Code</A></FONT> <b>is</b> <A HREF="terminal_interface-curses__ads.htm#ref_73_12">Real_Key_Code</A> <b>range</b> -+ <b>subtype</b> <span class="symbol"><A NAME="ref_82_12">Normal_Key_Code</A></span> <b>is</b> <A HREF="terminal_interface-curses__ads.htm#ref_73_12">Real_Key_Code</A> <b>range</b> - Character'Pos (Character'First) .. Character'Pos (Character'Last); -- <FONT COLOR=green><EM>-- This are the codes for regular (incl. non-graphical) characters.</EM></FONT> -+ <span class="comment"><EM>-- This are the codes for regular (incl. non-graphical) characters.</EM></span> - -- <FONT COLOR=green><EM>-- Constants for function- and special keys</EM></FONT> -- <FONT COLOR=green><EM>--</EM></FONT> -- <FONT COLOR=red><A NAME="ref_88_4">Key_None</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#400#; -- <FONT COLOR=red><A NAME="ref_89_4">Key_Code_Yes</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#400#; -- <FONT COLOR=red><A NAME="ref_90_4">Key_Min</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#401#; -- <FONT COLOR=red><A NAME="ref_91_4">Key_Break</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#401#; -- <FONT COLOR=red><A NAME="ref_92_4">Key_Cursor_Down</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#402#; -- <FONT COLOR=red><A NAME="ref_93_4">Key_Cursor_Up</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#403#; -- <FONT COLOR=red><A NAME="ref_94_4">Key_Cursor_Left</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#404#; -- <FONT COLOR=red><A NAME="ref_95_4">Key_Cursor_Right</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#405#; -- <FONT COLOR=red><A NAME="ref_96_4">Key_Home</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#406#; -- <FONT COLOR=red><A NAME="ref_97_4">Key_Backspace</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#407#; -- <FONT COLOR=red><A NAME="ref_98_4">Key_F0</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#410#; -- <FONT COLOR=red><A NAME="ref_99_4">Key_F1</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#411#; -- <FONT COLOR=red><A NAME="ref_100_4">Key_F2</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#412#; -- <FONT COLOR=red><A NAME="ref_101_4">Key_F3</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#413#; -- <FONT COLOR=red><A NAME="ref_102_4">Key_F4</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#414#; -- <FONT COLOR=red><A NAME="ref_103_4">Key_F5</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#415#; -- <FONT COLOR=red><A NAME="ref_104_4">Key_F6</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#416#; -- <FONT COLOR=red><A NAME="ref_105_4">Key_F7</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#417#; -- <FONT COLOR=red><A NAME="ref_106_4">Key_F8</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#420#; -- <FONT COLOR=red><A NAME="ref_107_4">Key_F9</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#421#; -- <FONT COLOR=red><A NAME="ref_108_4">Key_F10</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#422#; -- <FONT COLOR=red><A NAME="ref_109_4">Key_F11</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#423#; -- <FONT COLOR=red><A NAME="ref_110_4">Key_F12</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#424#; -- <FONT COLOR=red><A NAME="ref_111_4">Key_F13</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#425#; -- <FONT COLOR=red><A NAME="ref_112_4">Key_F14</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#426#; -- <FONT COLOR=red><A NAME="ref_113_4">Key_F15</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#427#; -- <FONT COLOR=red><A NAME="ref_114_4">Key_F16</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#430#; -- <FONT COLOR=red><A NAME="ref_115_4">Key_F17</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#431#; -- <FONT COLOR=red><A NAME="ref_116_4">Key_F18</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#432#; -- <FONT COLOR=red><A NAME="ref_117_4">Key_F19</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#433#; -- <FONT COLOR=red><A NAME="ref_118_4">Key_F20</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#434#; -- <FONT COLOR=red><A NAME="ref_119_4">Key_F21</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#435#; -- <FONT COLOR=red><A NAME="ref_120_4">Key_F22</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#436#; -- <FONT COLOR=red><A NAME="ref_121_4">Key_F23</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#437#; -- <FONT COLOR=red><A NAME="ref_122_4">Key_F24</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#440#; -- <FONT COLOR=red><A NAME="ref_123_4">Key_Delete_Line</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#510#; -- <FONT COLOR=red><A NAME="ref_124_4">Key_Insert_Line</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#511#; -- <FONT COLOR=red><A NAME="ref_125_4">Key_Delete_Char</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#512#; -- <FONT COLOR=red><A NAME="ref_126_4">Key_Insert_Char</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#513#; -- <FONT COLOR=red><A NAME="ref_127_4">Key_Exit_Insert_Mode</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#514#; -- <FONT COLOR=red><A NAME="ref_128_4">Key_Clear_Screen</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#515#; -- <FONT COLOR=red><A NAME="ref_129_4">Key_Clear_End_Of_Screen</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#516#; -- <FONT COLOR=red><A NAME="ref_130_4">Key_Clear_End_Of_Line</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#517#; -- <FONT COLOR=red><A NAME="ref_131_4">Key_Scroll_1_Forward</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#520#; -- <FONT COLOR=red><A NAME="ref_132_4">Key_Scroll_1_Backward</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#521#; -- <FONT COLOR=red><A NAME="ref_133_4">Key_Next_Page</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#522#; -- <FONT COLOR=red><A NAME="ref_134_4">Key_Previous_Page</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#523#; -- <FONT COLOR=red><A NAME="ref_135_4">Key_Set_Tab</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#524#; -- <FONT COLOR=red><A NAME="ref_136_4">Key_Clear_Tab</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#525#; -- <FONT COLOR=red><A NAME="ref_137_4">Key_Clear_All_Tabs</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#526#; -- <FONT COLOR=red><A NAME="ref_138_4">Key_Enter_Or_Send</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#527#; -- <FONT COLOR=red><A NAME="ref_139_4">Key_Soft_Reset</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#530#; -- <FONT COLOR=red><A NAME="ref_140_4">Key_Reset</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#531#; -- <FONT COLOR=red><A NAME="ref_141_4">Key_Print</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#532#; -- <FONT COLOR=red><A NAME="ref_142_4">Key_Bottom</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#533#; -- <FONT COLOR=red><A NAME="ref_143_4">Key_Upper_Left_Of_Keypad</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#534#; -- <FONT COLOR=red><A NAME="ref_144_4">Key_Upper_Right_Of_Keypad</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#535#; -- <FONT COLOR=red><A NAME="ref_145_4">Key_Center_Of_Keypad</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#536#; -- <FONT COLOR=red><A NAME="ref_146_4">Key_Lower_Left_Of_Keypad</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#537#; -- <FONT COLOR=red><A NAME="ref_147_4">Key_Lower_Right_Of_Keypad</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#540#; -- <FONT COLOR=red><A NAME="ref_148_4">Key_Back_Tab</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#541#; -- <FONT COLOR=red><A NAME="ref_149_4">Key_Beginning</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#542#; -- <FONT COLOR=red><A NAME="ref_150_4">Key_Cancel</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#543#; -- <FONT COLOR=red><A NAME="ref_151_4">Key_Close</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#544#; -- <FONT COLOR=red><A NAME="ref_152_4">Key_Command</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#545#; -- <FONT COLOR=red><A NAME="ref_153_4">Key_Copy</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#546#; -- <FONT COLOR=red><A NAME="ref_154_4">Key_Create</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#547#; -- <FONT COLOR=red><A NAME="ref_155_4">Key_End</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#550#; -- <FONT COLOR=red><A NAME="ref_156_4">Key_Exit</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#551#; -- <FONT COLOR=red><A NAME="ref_157_4">Key_Find</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#552#; -- <FONT COLOR=red><A NAME="ref_158_4">Key_Help</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#553#; -- <FONT COLOR=red><A NAME="ref_159_4">Key_Mark</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#554#; -- <FONT COLOR=red><A NAME="ref_160_4">Key_Message</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#555#; -- <FONT COLOR=red><A NAME="ref_161_4">Key_Move</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#556#; -- <FONT COLOR=red><A NAME="ref_162_4">Key_Next</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#557#; -- <FONT COLOR=red><A NAME="ref_163_4">Key_Open</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#560#; -- <FONT COLOR=red><A NAME="ref_164_4">Key_Options</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#561#; -- <FONT COLOR=red><A NAME="ref_165_4">Key_Previous</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#562#; -- <FONT COLOR=red><A NAME="ref_166_4">Key_Redo</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#563#; -- <FONT COLOR=red><A NAME="ref_167_4">Key_Reference</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#564#; -- <FONT COLOR=red><A NAME="ref_168_4">Key_Refresh</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#565#; -- <FONT COLOR=red><A NAME="ref_169_4">Key_Replace</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#566#; -- <FONT COLOR=red><A NAME="ref_170_4">Key_Restart</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#567#; -- <FONT COLOR=red><A NAME="ref_171_4">Key_Resume</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#570#; -- <FONT COLOR=red><A NAME="ref_172_4">Key_Save</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#571#; -- <FONT COLOR=red><A NAME="ref_173_4">Key_Shift_Begin</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#572#; -- <FONT COLOR=red><A NAME="ref_174_4">Key_Shift_Cancel</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#573#; -- <FONT COLOR=red><A NAME="ref_175_4">Key_Shift_Command</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#574#; -- <FONT COLOR=red><A NAME="ref_176_4">Key_Shift_Copy</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#575#; -- <FONT COLOR=red><A NAME="ref_177_4">Key_Shift_Create</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#576#; -- <FONT COLOR=red><A NAME="ref_178_4">Key_Shift_Delete_Char</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#577#; -- <FONT COLOR=red><A NAME="ref_179_4">Key_Shift_Delete_Line</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#600#; -- <FONT COLOR=red><A NAME="ref_180_4">Key_Select</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#601#; -- <FONT COLOR=red><A NAME="ref_181_4">Key_Shift_End</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#602#; -- <FONT COLOR=red><A NAME="ref_182_4">Key_Shift_Clear_End_Of_Line</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#603#; -- <FONT COLOR=red><A NAME="ref_183_4">Key_Shift_Exit</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#604#; -- <FONT COLOR=red><A NAME="ref_184_4">Key_Shift_Find</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#605#; -- <FONT COLOR=red><A NAME="ref_185_4">Key_Shift_Help</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#606#; -- <FONT COLOR=red><A NAME="ref_186_4">Key_Shift_Home</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#607#; -- <FONT COLOR=red><A NAME="ref_187_4">Key_Shift_Insert_Char</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#610#; -- <FONT COLOR=red><A NAME="ref_188_4">Key_Shift_Cursor_Left</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#611#; -- <FONT COLOR=red><A NAME="ref_189_4">Key_Shift_Message</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#612#; -- <FONT COLOR=red><A NAME="ref_190_4">Key_Shift_Move</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#613#; -- <FONT COLOR=red><A NAME="ref_191_4">Key_Shift_Next_Page</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#614#; -- <FONT COLOR=red><A NAME="ref_192_4">Key_Shift_Options</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#615#; -- <FONT COLOR=red><A NAME="ref_193_4">Key_Shift_Previous_Page</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#616#; -- <FONT COLOR=red><A NAME="ref_194_4">Key_Shift_Print</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#617#; -- <FONT COLOR=red><A NAME="ref_195_4">Key_Shift_Redo</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#620#; -- <FONT COLOR=red><A NAME="ref_196_4">Key_Shift_Replace</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#621#; -- <FONT COLOR=red><A NAME="ref_197_4">Key_Shift_Cursor_Right</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#622#; -- <FONT COLOR=red><A NAME="ref_198_4">Key_Shift_Resume</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#623#; -- <FONT COLOR=red><A NAME="ref_199_4">Key_Shift_Save</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#624#; -- <FONT COLOR=red><A NAME="ref_200_4">Key_Shift_Suspend</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#625#; -- <FONT COLOR=red><A NAME="ref_201_4">Key_Shift_Undo</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#626#; -- <FONT COLOR=red><A NAME="ref_202_4">Key_Suspend</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#627#; -- <FONT COLOR=red><A NAME="ref_203_4">Key_Undo</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#630#; -- <FONT COLOR=red><A NAME="ref_204_4">Key_Mouse</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#631#; -- <FONT COLOR=red><A NAME="ref_205_4">Key_Resize</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#632#; -+ <span class="comment"><EM>-- Constants for function- and special keys</EM></span> -+ <span class="comment"><EM>--</EM></span> -+ <span class="symbol"><A NAME="ref_88_4">Key_None</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#400#; -+ <span class="symbol"><A NAME="ref_89_4">Key_Code_Yes</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#400#; -+ <span class="symbol"><A NAME="ref_90_4">Key_Min</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#401#; -+ <span class="symbol"><A NAME="ref_91_4">Key_Break</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#401#; -+ <span class="symbol"><A NAME="ref_92_4">Key_Cursor_Down</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#402#; -+ <span class="symbol"><A NAME="ref_93_4">Key_Cursor_Up</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#403#; -+ <span class="symbol"><A NAME="ref_94_4">Key_Cursor_Left</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#404#; -+ <span class="symbol"><A NAME="ref_95_4">Key_Cursor_Right</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#405#; -+ <span class="symbol"><A NAME="ref_96_4">Key_Home</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#406#; -+ <span class="symbol"><A NAME="ref_97_4">Key_Backspace</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#407#; -+ <span class="symbol"><A NAME="ref_98_4">Key_F0</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#410#; -+ <span class="symbol"><A NAME="ref_99_4">Key_F1</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#411#; -+ <span class="symbol"><A NAME="ref_100_4">Key_F2</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#412#; -+ <span class="symbol"><A NAME="ref_101_4">Key_F3</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#413#; -+ <span class="symbol"><A NAME="ref_102_4">Key_F4</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#414#; -+ <span class="symbol"><A NAME="ref_103_4">Key_F5</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#415#; -+ <span class="symbol"><A NAME="ref_104_4">Key_F6</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#416#; -+ <span class="symbol"><A NAME="ref_105_4">Key_F7</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#417#; -+ <span class="symbol"><A NAME="ref_106_4">Key_F8</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#420#; -+ <span class="symbol"><A NAME="ref_107_4">Key_F9</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#421#; -+ <span class="symbol"><A NAME="ref_108_4">Key_F10</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#422#; -+ <span class="symbol"><A NAME="ref_109_4">Key_F11</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#423#; -+ <span class="symbol"><A NAME="ref_110_4">Key_F12</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#424#; -+ <span class="symbol"><A NAME="ref_111_4">Key_F13</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#425#; -+ <span class="symbol"><A NAME="ref_112_4">Key_F14</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#426#; -+ <span class="symbol"><A NAME="ref_113_4">Key_F15</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#427#; -+ <span class="symbol"><A NAME="ref_114_4">Key_F16</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#430#; -+ <span class="symbol"><A NAME="ref_115_4">Key_F17</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#431#; -+ <span class="symbol"><A NAME="ref_116_4">Key_F18</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#432#; -+ <span class="symbol"><A NAME="ref_117_4">Key_F19</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#433#; -+ <span class="symbol"><A NAME="ref_118_4">Key_F20</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#434#; -+ <span class="symbol"><A NAME="ref_119_4">Key_F21</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#435#; -+ <span class="symbol"><A NAME="ref_120_4">Key_F22</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#436#; -+ <span class="symbol"><A NAME="ref_121_4">Key_F23</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#437#; -+ <span class="symbol"><A NAME="ref_122_4">Key_F24</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#440#; -+ <span class="symbol"><A NAME="ref_123_4">Key_Delete_Line</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#510#; -+ <span class="symbol"><A NAME="ref_124_4">Key_Insert_Line</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#511#; -+ <span class="symbol"><A NAME="ref_125_4">Key_Delete_Char</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#512#; -+ <span class="symbol"><A NAME="ref_126_4">Key_Insert_Char</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#513#; -+ <span class="symbol"><A NAME="ref_127_4">Key_Exit_Insert_Mode</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#514#; -+ <span class="symbol"><A NAME="ref_128_4">Key_Clear_Screen</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#515#; -+ <span class="symbol"><A NAME="ref_129_4">Key_Clear_End_Of_Screen</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#516#; -+ <span class="symbol"><A NAME="ref_130_4">Key_Clear_End_Of_Line</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#517#; -+ <span class="symbol"><A NAME="ref_131_4">Key_Scroll_1_Forward</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#520#; -+ <span class="symbol"><A NAME="ref_132_4">Key_Scroll_1_Backward</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#521#; -+ <span class="symbol"><A NAME="ref_133_4">Key_Next_Page</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#522#; -+ <span class="symbol"><A NAME="ref_134_4">Key_Previous_Page</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#523#; -+ <span class="symbol"><A NAME="ref_135_4">Key_Set_Tab</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#524#; -+ <span class="symbol"><A NAME="ref_136_4">Key_Clear_Tab</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#525#; -+ <span class="symbol"><A NAME="ref_137_4">Key_Clear_All_Tabs</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#526#; -+ <span class="symbol"><A NAME="ref_138_4">Key_Enter_Or_Send</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#527#; -+ <span class="symbol"><A NAME="ref_139_4">Key_Soft_Reset</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#530#; -+ <span class="symbol"><A NAME="ref_140_4">Key_Reset</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#531#; -+ <span class="symbol"><A NAME="ref_141_4">Key_Print</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#532#; -+ <span class="symbol"><A NAME="ref_142_4">Key_Bottom</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#533#; -+ <span class="symbol"><A NAME="ref_143_4">Key_Upper_Left_Of_Keypad</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#534#; -+ <span class="symbol"><A NAME="ref_144_4">Key_Upper_Right_Of_Keypad</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#535#; -+ <span class="symbol"><A NAME="ref_145_4">Key_Center_Of_Keypad</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#536#; -+ <span class="symbol"><A NAME="ref_146_4">Key_Lower_Left_Of_Keypad</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#537#; -+ <span class="symbol"><A NAME="ref_147_4">Key_Lower_Right_Of_Keypad</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#540#; -+ <span class="symbol"><A NAME="ref_148_4">Key_Back_Tab</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#541#; -+ <span class="symbol"><A NAME="ref_149_4">Key_Beginning</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#542#; -+ <span class="symbol"><A NAME="ref_150_4">Key_Cancel</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#543#; -+ <span class="symbol"><A NAME="ref_151_4">Key_Close</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#544#; -+ <span class="symbol"><A NAME="ref_152_4">Key_Command</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#545#; -+ <span class="symbol"><A NAME="ref_153_4">Key_Copy</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#546#; -+ <span class="symbol"><A NAME="ref_154_4">Key_Create</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#547#; -+ <span class="symbol"><A NAME="ref_155_4">Key_End</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#550#; -+ <span class="symbol"><A NAME="ref_156_4">Key_Exit</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#551#; -+ <span class="symbol"><A NAME="ref_157_4">Key_Find</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#552#; -+ <span class="symbol"><A NAME="ref_158_4">Key_Help</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#553#; -+ <span class="symbol"><A NAME="ref_159_4">Key_Mark</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#554#; -+ <span class="symbol"><A NAME="ref_160_4">Key_Message</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#555#; -+ <span class="symbol"><A NAME="ref_161_4">Key_Move</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#556#; -+ <span class="symbol"><A NAME="ref_162_4">Key_Next</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#557#; -+ <span class="symbol"><A NAME="ref_163_4">Key_Open</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#560#; -+ <span class="symbol"><A NAME="ref_164_4">Key_Options</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#561#; -+ <span class="symbol"><A NAME="ref_165_4">Key_Previous</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#562#; -+ <span class="symbol"><A NAME="ref_166_4">Key_Redo</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#563#; -+ <span class="symbol"><A NAME="ref_167_4">Key_Reference</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#564#; -+ <span class="symbol"><A NAME="ref_168_4">Key_Refresh</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#565#; -+ <span class="symbol"><A NAME="ref_169_4">Key_Replace</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#566#; -+ <span class="symbol"><A NAME="ref_170_4">Key_Restart</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#567#; -+ <span class="symbol"><A NAME="ref_171_4">Key_Resume</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#570#; -+ <span class="symbol"><A NAME="ref_172_4">Key_Save</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#571#; -+ <span class="symbol"><A NAME="ref_173_4">Key_Shift_Begin</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#572#; -+ <span class="symbol"><A NAME="ref_174_4">Key_Shift_Cancel</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#573#; -+ <span class="symbol"><A NAME="ref_175_4">Key_Shift_Command</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#574#; -+ <span class="symbol"><A NAME="ref_176_4">Key_Shift_Copy</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#575#; -+ <span class="symbol"><A NAME="ref_177_4">Key_Shift_Create</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#576#; -+ <span class="symbol"><A NAME="ref_178_4">Key_Shift_Delete_Char</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#577#; -+ <span class="symbol"><A NAME="ref_179_4">Key_Shift_Delete_Line</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#600#; -+ <span class="symbol"><A NAME="ref_180_4">Key_Select</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#601#; -+ <span class="symbol"><A NAME="ref_181_4">Key_Shift_End</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#602#; -+ <span class="symbol"><A NAME="ref_182_4">Key_Shift_Clear_End_Of_Line</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#603#; -+ <span class="symbol"><A NAME="ref_183_4">Key_Shift_Exit</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#604#; -+ <span class="symbol"><A NAME="ref_184_4">Key_Shift_Find</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#605#; -+ <span class="symbol"><A NAME="ref_185_4">Key_Shift_Help</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#606#; -+ <span class="symbol"><A NAME="ref_186_4">Key_Shift_Home</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#607#; -+ <span class="symbol"><A NAME="ref_187_4">Key_Shift_Insert_Char</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#610#; -+ <span class="symbol"><A NAME="ref_188_4">Key_Shift_Cursor_Left</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#611#; -+ <span class="symbol"><A NAME="ref_189_4">Key_Shift_Message</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#612#; -+ <span class="symbol"><A NAME="ref_190_4">Key_Shift_Move</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#613#; -+ <span class="symbol"><A NAME="ref_191_4">Key_Shift_Next_Page</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#614#; -+ <span class="symbol"><A NAME="ref_192_4">Key_Shift_Options</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#615#; -+ <span class="symbol"><A NAME="ref_193_4">Key_Shift_Previous_Page</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#616#; -+ <span class="symbol"><A NAME="ref_194_4">Key_Shift_Print</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#617#; -+ <span class="symbol"><A NAME="ref_195_4">Key_Shift_Redo</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#620#; -+ <span class="symbol"><A NAME="ref_196_4">Key_Shift_Replace</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#621#; -+ <span class="symbol"><A NAME="ref_197_4">Key_Shift_Cursor_Right</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#622#; -+ <span class="symbol"><A NAME="ref_198_4">Key_Shift_Resume</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#623#; -+ <span class="symbol"><A NAME="ref_199_4">Key_Shift_Save</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#624#; -+ <span class="symbol"><A NAME="ref_200_4">Key_Shift_Suspend</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#625#; -+ <span class="symbol"><A NAME="ref_201_4">Key_Shift_Undo</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#626#; -+ <span class="symbol"><A NAME="ref_202_4">Key_Suspend</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#627#; -+ <span class="symbol"><A NAME="ref_203_4">Key_Undo</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#630#; -+ <span class="symbol"><A NAME="ref_204_4">Key_Mouse</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#631#; -+ <span class="symbol"><A NAME="ref_205_4">Key_Resize</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> := 8#632#; - -- <FONT COLOR=red><A NAME="ref_207_4">Key_Max</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> -+ <span class="symbol"><A NAME="ref_207_4">Key_Max</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> - := <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A>'Last; - -- <b>subtype</b> <FONT COLOR=red><A NAME="ref_210_12">User_Key_Code</A></FONT> <b>is</b> <A HREF="terminal_interface-curses__ads.htm#ref_68_9">Key_Code</A> -+ <b>subtype</b> <span class="symbol"><A NAME="ref_210_12">User_Key_Code</A></span> <b>is</b> <A HREF="terminal_interface-curses__ads.htm#ref_68_9">Key_Code</A> - <b>range</b> (<A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 129) .. <A HREF="terminal_interface-curses__ads.htm#ref_68_9">Key_Code</A>'Last; -- <FONT COLOR=green><EM>-- This is reserved for user defined key codes. The range between Key_Max</EM></FONT> -- <FONT COLOR=green><EM>-- and the first user code is reserved for subsystems like menu and forms.</EM></FONT> -+ <span class="comment"><EM>-- This is reserved for user defined key codes. The range between Key_Max</EM></span> -+ <span class="comment"><EM>-- and the first user code is reserved for subsystems like menu and forms.</EM></span> - -- <FONT COLOR=green><EM>-- For those who like to use the original key names we produce them were</EM></FONT> -- <FONT COLOR=green><EM>-- they differ from the original. Please note that they may differ in</EM></FONT> -- <FONT COLOR=green><EM>-- lower/upper case.</EM></FONT> -+ <span class="comment"><EM>-- For those who like to use the original key names we produce them were</EM></span> -+ <span class="comment"><EM>-- they differ from the original. Please note that they may differ in</EM></span> -+ <span class="comment"><EM>-- lower/upper case.</EM></span> - KEY_DOWN : <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> <b>renames</b> <A HREF="terminal_interface-curses__ads.htm#ref_92_4">Key_Cursor_Down</A>; - KEY_UP : <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> <b>renames</b> <A HREF="terminal_interface-curses__ads.htm#ref_93_4">Key_Cursor_Up</A>; - KEY_LEFT : <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> <b>renames</b> <A HREF="terminal_interface-curses__ads.htm#ref_94_4">Key_Cursor_Left</A>; -@@ -278,55 +290,54 @@ - KEY_SSUSPEND : <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> <b>renames</b> <A HREF="terminal_interface-curses__ads.htm#ref_200_4">Key_Shift_Suspend</A>; - KEY_SUNDO : <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A> <b>renames</b> <A HREF="terminal_interface-curses__ads.htm#ref_201_4">Key_Shift_Undo</A>; - --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> - -- <b>type</b> <FONT COLOR=red><A NAME="ref_278_9">Color_Number</A></FONT> <b>is</b> <b>range</b> -1 .. Integer (<A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>.C.short'Last); -- <b>for</b> <A HREF="terminal_interface-curses__ads.htm#ref_278_9">Color_Number</A>'Size <b>use</b> <A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>.C.short'Size; -- <FONT COLOR=green><EM>-- (n)curses uses a short for the color index</EM></FONT> -- <FONT COLOR=green><EM>-- The model is, that a Color_Number is an index into an array of</EM></FONT> -- <FONT COLOR=green><EM>-- (potentially) definable colors. Some of those indices are</EM></FONT> -- <FONT COLOR=green><EM>-- predefined (see below), although they may not really exist.</EM></FONT> -- -- <FONT COLOR=red><A NAME="ref_285_4">Default_Color</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_278_9">Color_Number</A> := -1; -- <FONT COLOR=red><A NAME="ref_286_4">Black</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_278_9">Color_Number</A> := 0; -- <FONT COLOR=red><A NAME="ref_287_4">Red</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_278_9">Color_Number</A> := 1; -- <FONT COLOR=red><A NAME="ref_288_4">Green</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_278_9">Color_Number</A> := 2; -- <FONT COLOR=red><A NAME="ref_289_4">Yellow</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_278_9">Color_Number</A> := 3; -- <FONT COLOR=red><A NAME="ref_290_4">Blue</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_278_9">Color_Number</A> := 4; -- <FONT COLOR=red><A NAME="ref_291_4">Magenta</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_278_9">Color_Number</A> := 5; -- <FONT COLOR=red><A NAME="ref_292_4">Cyan</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_278_9">Color_Number</A> := 6; -- <FONT COLOR=red><A NAME="ref_293_4">White</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_278_9">Color_Number</A> := 7; -- -- <b>type</b> <FONT COLOR=red><A NAME="ref_295_9">RGB_Value</A></FONT> <b>is</b> <b>range</b> 0 .. Integer (<A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>.C.short'Last); -- <b>for</b> <A HREF="terminal_interface-curses__ads.htm#ref_295_9">RGB_Value</A>'Size <b>use</b> <A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>.C.short'Size; -- <FONT COLOR=green><EM>-- Some system may allow to redefine a color by setting RGB values.</EM></FONT> -+ <b>type</b> <span class="symbol"><A NAME="ref_278_9">Color_Number</A></span> <b>is</b> <b>range</b> -1 .. Integer (<A HREF="interfac__ads.htm#ref_36_9">Interfaces</A>.C.short'Last); -+ <b>for</b> <A HREF="terminal_interface-curses__ads.htm#ref_278_9">Color_Number</A>'Size <b>use</b> <A HREF="interfac__ads.htm#ref_36_9">Interfaces</A>.C.short'Size; -+ <span class="comment"><EM>-- (n)curses uses a short for the color index</EM></span> -+ <span class="comment"><EM>-- The model is, that a Color_Number is an index into an array of</EM></span> -+ <span class="comment"><EM>-- (potentially) definable colors. Some of those indices are</EM></span> -+ <span class="comment"><EM>-- predefined (see below), although they may not really exist.</EM></span> -+ -+ <span class="symbol"><A NAME="ref_285_4">Default_Color</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_278_9">Color_Number</A> := -1; -+ <span class="symbol"><A NAME="ref_286_4">Black</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_278_9">Color_Number</A> := 0; -+ <span class="symbol"><A NAME="ref_287_4">Red</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_278_9">Color_Number</A> := 1; -+ <span class="symbol"><A NAME="ref_288_4">Green</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_278_9">Color_Number</A> := 2; -+ <span class="symbol"><A NAME="ref_289_4">Yellow</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_278_9">Color_Number</A> := 3; -+ <span class="symbol"><A NAME="ref_290_4">Blue</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_278_9">Color_Number</A> := 4; -+ <span class="symbol"><A NAME="ref_291_4">Magenta</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_278_9">Color_Number</A> := 5; -+ <span class="symbol"><A NAME="ref_292_4">Cyan</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_278_9">Color_Number</A> := 6; -+ <span class="symbol"><A NAME="ref_293_4">White</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_278_9">Color_Number</A> := 7; -+ -+ <b>type</b> <span class="symbol"><A NAME="ref_295_9">RGB_Value</A></span> <b>is</b> <b>range</b> 0 .. Integer (<A HREF="interfac__ads.htm#ref_36_9">Interfaces</A>.C.short'Last); -+ <b>for</b> <A HREF="terminal_interface-curses__ads.htm#ref_295_9">RGB_Value</A>'Size <b>use</b> <A HREF="interfac__ads.htm#ref_36_9">Interfaces</A>.C.short'Size; -+ <span class="comment"><EM>-- Some system may allow to redefine a color by setting RGB values.</EM></span> - -- <b>type</b> <FONT COLOR=red><A NAME="ref_299_9">Color_Pair</A></FONT> <b>is</b> <b>range</b> 0 .. 255; -+ <b>type</b> <span class="symbol"><A NAME="ref_299_9">Color_Pair</A></span> <b>is</b> <b>range</b> 0 .. 255; - <b>for</b> <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>'Size <b>use</b> 8; -- <b>subtype</b> <FONT COLOR=red><A NAME="ref_301_12">Redefinable_Color_Pair</A></FONT> <b>is</b> <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A> <b>range</b> 1 .. 255; -- <FONT COLOR=green><EM>-- (n)curses reserves 1 Byte for the color-pair number. Color Pair 0</EM></FONT> -- <FONT COLOR=green><EM>-- is fixed (Black &amp; White). A color pair is simply a combination of</EM></FONT> -- <FONT COLOR=green><EM>-- two colors described by Color_Numbers, one for the foreground and</EM></FONT> -- <FONT COLOR=green><EM>-- the other for the background</EM></FONT> -+ <b>subtype</b> <span class="symbol"><A NAME="ref_301_12">Redefinable_Color_Pair</A></span> <b>is</b> <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A> <b>range</b> 1 .. 255; -+ <span class="comment"><EM>-- (n)curses reserves 1 Byte for the color-pair number. Color Pair 0</EM></span> -+ <span class="comment"><EM>-- is fixed (Black &amp; White). A color pair is simply a combination of</EM></span> -+ <span class="comment"><EM>-- two colors described by Color_Numbers, one for the foreground and</EM></span> -+ <span class="comment"><EM>-- the other for the background</EM></span> - -- <b>type</b> <FONT COLOR=red><A NAME="ref_307_9">Character_Attribute_Set</A></FONT> <b>is</b> -+ <b>type</b> <span class="symbol"><A NAME="ref_307_9">Character_Attribute_Set</A></span> <b>is</b> - <b>record</b> -- <FONT COLOR=red><A NAME="ref_309_10">Stand_Out</A></FONT> : Boolean; -- <FONT COLOR=red><A NAME="ref_310_10">Under_Line</A></FONT> : Boolean; -- <FONT COLOR=red><A NAME="ref_311_10">Reverse_Video</A></FONT> : Boolean; -- <FONT COLOR=red><A NAME="ref_312_10">Blink</A></FONT> : Boolean; -- <FONT COLOR=red><A NAME="ref_313_10">Dim_Character</A></FONT> : Boolean; -- <FONT COLOR=red><A NAME="ref_314_10">Bold_Character</A></FONT> : Boolean; -- <FONT COLOR=red><A NAME="ref_315_10">Alternate_Character_Set</A></FONT> : Boolean; -- <FONT COLOR=red><A NAME="ref_316_10">Invisible_Character</A></FONT> : Boolean; -- <FONT COLOR=red><A NAME="ref_317_10">Protected_Character</A></FONT> : Boolean; -- <FONT COLOR=red><A NAME="ref_318_10">Horizontal</A></FONT> : Boolean; -- <FONT COLOR=red><A NAME="ref_319_10">Left</A></FONT> : Boolean; -- <FONT COLOR=red><A NAME="ref_320_10">Low</A></FONT> : Boolean; -- <FONT COLOR=red><A NAME="ref_321_10">Right</A></FONT> : Boolean; -- <FONT COLOR=red><A NAME="ref_322_10">Top</A></FONT> : Boolean; -- <FONT COLOR=red><A NAME="ref_323_10">Vertical</A></FONT> : Boolean; -- <FONT COLOR=red><A NAME="ref_324_10">Unused</A></FONT> : Boolean; -+ <span class="symbol"><A NAME="ref_309_10">Stand_Out</A></span> : Boolean; -+ <span class="symbol"><A NAME="ref_310_10">Under_Line</A></span> : Boolean; -+ <span class="symbol"><A NAME="ref_311_10">Reverse_Video</A></span> : Boolean; -+ <span class="symbol"><A NAME="ref_312_10">Blink</A></span> : Boolean; -+ <span class="symbol"><A NAME="ref_313_10">Dim_Character</A></span> : Boolean; -+ <span class="symbol"><A NAME="ref_314_10">Bold_Character</A></span> : Boolean; -+ <span class="symbol"><A NAME="ref_315_10">Alternate_Character_Set</A></span> : Boolean; -+ <span class="symbol"><A NAME="ref_316_10">Invisible_Character</A></span> : Boolean; -+ <span class="symbol"><A NAME="ref_317_10">Protected_Character</A></span> : Boolean; -+ <span class="symbol"><A NAME="ref_318_10">Horizontal</A></span> : Boolean; -+ <span class="symbol"><A NAME="ref_319_10">Left</A></span> : Boolean; -+ <span class="symbol"><A NAME="ref_320_10">Low</A></span> : Boolean; -+ <span class="symbol"><A NAME="ref_321_10">Right</A></span> : Boolean; -+ <span class="symbol"><A NAME="ref_322_10">Top</A></span> : Boolean; -+ <span class="symbol"><A NAME="ref_323_10">Vertical</A></span> : Boolean; - <b>end</b> <b>record</b>; - <b>pragma</b> Convention (C, <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A>); - -@@ -347,1589 +358,1589 @@ - <A HREF="terminal_interface-curses__ads.htm#ref_321_10">Right</A> <b>at</b> 0 <b>range</b> 12 .. 12; - <A HREF="terminal_interface-curses__ads.htm#ref_322_10">Top</A> <b>at</b> 0 <b>range</b> 13 .. 13; - <A HREF="terminal_interface-curses__ads.htm#ref_323_10">Vertical</A> <b>at</b> 0 <b>range</b> 14 .. 14; -- <A HREF="terminal_interface-curses__ads.htm#ref_324_10">Unused</A> <b>at</b> 0 <b>range</b> 15 .. 15; - <b>end</b> <b>record</b>; -- <b>for</b> <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A>'Size <b>use</b> 16; -- <FONT COLOR=green><EM>-- Please note: this rep. clause is generated and may be</EM></FONT> -- <FONT COLOR=green><EM>-- different on your system.</EM></FONT> -- <FONT COLOR=green><EM>-- (n)curses uses all but the lowest 16 Bits for Attributes.</EM></FONT> -+ <b>pragma</b> Warnings (Off); <b>for</b> <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A>'Size <b>use</b> 16; -+ <b>pragma</b> Warnings (On); -+ <span class="comment"><EM>-- Please note: this rep. clause is generated and may be</EM></span> -+ <span class="comment"><EM>-- different on your system.</EM></span> -+ <span class="comment"><EM>-- (n)curses uses all but the lowest 16 Bits for Attributes.</EM></span> - -- <FONT COLOR=red><A NAME="ref_352_4">Normal_Video</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A> := (<b>others</b> =&gt; False); -+ <span class="symbol"><A NAME="ref_351_4">Normal_Video</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A> := (<b>others</b> =&gt; False); - -- <b>type</b> <FONT COLOR=red><A NAME="ref_354_9">Attributed_Character</A></FONT> <b>is</b> -+ <b>type</b> <span class="symbol"><A NAME="ref_353_9">Attributed_Character</A></span> <b>is</b> - <b>record</b> -- <FONT COLOR=red><A NAME="ref_356_10">Attr</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A>; -- <FONT COLOR=red><A NAME="ref_357_10">Color</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>; -- <FONT COLOR=red><A NAME="ref_358_10">Ch</A></FONT> : Character; -+ <span class="symbol"><A NAME="ref_355_10">Attr</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A>; -+ <span class="symbol"><A NAME="ref_356_10">Color</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>; -+ <span class="symbol"><A NAME="ref_357_10">Ch</A></span> : Character; - <b>end</b> <b>record</b>; -- <b>pragma</b> Convention (C, <A HREF="terminal_interface-curses__ads.htm#ref_354_9">Attributed_Character</A>); -- <FONT COLOR=green><EM>-- This is the counterpart for the chtype in C.</EM></FONT> -+ <b>pragma</b> Convention (C, <A HREF="terminal_interface-curses__ads.htm#ref_353_9">Attributed_Character</A>); -+ <span class="comment"><EM>-- This is the counterpart for the chtype in C.</EM></span> - -- <b>for</b> <A HREF="terminal_interface-curses__ads.htm#ref_354_9">Attributed_Character</A> <b>use</b> -+ <b>for</b> <A HREF="terminal_interface-curses__ads.htm#ref_353_9">Attributed_Character</A> <b>use</b> - <b>record</b> -- <A HREF="terminal_interface-curses__ads.htm#ref_358_10">Ch</A> <b>at</b> 0 <b>range</b> 0 .. 7; -- <A HREF="terminal_interface-curses__ads.htm#ref_357_10">Color</A> <b>at</b> 0 <b>range</b> 8 .. 15; -- <A HREF="terminal_interface-curses__ads.htm#ref_356_10">Attr</A> <b>at</b> 0 <b>range</b> 16 .. 31; -+ <A HREF="terminal_interface-curses__ads.htm#ref_357_10">Ch</A> <b>at</b> 0 <b>range</b> 0 .. 7; -+ <A HREF="terminal_interface-curses__ads.htm#ref_356_10">Color</A> <b>at</b> 0 <b>range</b> 8 .. 15; -+ <A HREF="terminal_interface-curses__ads.htm#ref_355_10">Attr</A> <b>at</b> 0 <b>range</b> 16 .. 31; - <b>end</b> <b>record</b>; -- <b>for</b> <A HREF="terminal_interface-curses__ads.htm#ref_354_9">Attributed_Character</A>'Size <b>use</b> 32; -- <FONT COLOR=green><EM>-- Please note: this rep. clause is generated and may be</EM></FONT> -- <FONT COLOR=green><EM>-- different on your system.</EM></FONT> -- -- <FONT COLOR=red><A NAME="ref_373_4">Default_Character</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_354_9">Attributed_Character</A> -- := (<A HREF="terminal_interface-curses__ads.htm#ref_358_10">Ch</A> =&gt; Character'First, -- <A HREF="terminal_interface-curses__ads.htm#ref_357_10">Color</A> =&gt; <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>'First, -- <A HREF="terminal_interface-curses__ads.htm#ref_356_10">Attr</A> =&gt; (<b>others</b> =&gt; False)); <FONT COLOR=green><EM>-- preelaboratable Normal_Video</EM></FONT> -+ <b>for</b> <A HREF="terminal_interface-curses__ads.htm#ref_353_9">Attributed_Character</A>'Size <b>use</b> 32; -+ <span class="comment"><EM>-- Please note: this rep. clause is generated and may be</EM></span> -+ <span class="comment"><EM>-- different on your system.</EM></span> -+ -+ <span class="symbol"><A NAME="ref_372_4">Default_Character</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_353_9">Attributed_Character</A> -+ := (<A HREF="terminal_interface-curses__ads.htm#ref_357_10">Ch</A> =&gt; Character'First, -+ <A HREF="terminal_interface-curses__ads.htm#ref_356_10">Color</A> =&gt; <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>'First, -+ <A HREF="terminal_interface-curses__ads.htm#ref_355_10">Attr</A> =&gt; (<b>others</b> =&gt; False)); <span class="comment"><EM>-- preelaboratable Normal_Video</EM></span> - -- <b>type</b> Attributed_String <b>is</b> <b>array</b> (Positive <b>range</b> &lt;&gt;) <b>of</b> <A HREF="terminal_interface-curses__ads.htm#ref_354_9">Attributed_Character</A>; -+ <b>type</b> Attributed_String <b>is</b> <b>array</b> (Positive <b>range</b> &lt;&gt;) <b>of</b> <A HREF="terminal_interface-curses__ads.htm#ref_353_9">Attributed_Character</A>; - <b>pragma</b> Pack (Attributed_String); -- <FONT COLOR=green><EM>-- In this binding we allow strings of attributed characters.</EM></FONT> -+ <span class="comment"><EM>-- In this binding we allow strings of attributed characters.</EM></span> - -- <FONT COLOR=green><EM>------------------</EM></FONT> -- <FONT COLOR=green><EM>-- Exceptions --</EM></FONT> -- <FONT COLOR=green><EM>------------------</EM></FONT> -- <FONT COLOR=red><A NAME="ref_385_4">Curses_Exception</A></FONT> : <b>exception</b>; -- <FONT COLOR=red><A NAME="ref_386_4">Wrong_Curses_Version</A></FONT> : <b>exception</b>; -- -- <FONT COLOR=green><EM>-- Those exceptions are raised by the ETI (Extended Terminal Interface)</EM></FONT> -- <FONT COLOR=green><EM>-- subpackets for Menu and Forms handling.</EM></FONT> -- <FONT COLOR=green><EM>--</EM></FONT> -- <FONT COLOR=red><A NAME="ref_391_4">Eti_System_Error</A></FONT> : <b>exception</b>; -- <FONT COLOR=red><A NAME="ref_392_4">Eti_Bad_Argument</A></FONT> : <b>exception</b>; -- <FONT COLOR=red><A NAME="ref_393_4">Eti_Posted</A></FONT> : <b>exception</b>; -- <FONT COLOR=red><A NAME="ref_394_4">Eti_Connected</A></FONT> : <b>exception</b>; -- <FONT COLOR=red><A NAME="ref_395_4">Eti_Bad_State</A></FONT> : <b>exception</b>; -- <FONT COLOR=red><A NAME="ref_396_4">Eti_No_Room</A></FONT> : <b>exception</b>; -- <FONT COLOR=red><A NAME="ref_397_4">Eti_Not_Posted</A></FONT> : <b>exception</b>; -- <FONT COLOR=red><A NAME="ref_398_4">Eti_Unknown_Command</A></FONT> : <b>exception</b>; -- <FONT COLOR=red><A NAME="ref_399_4">Eti_No_Match</A></FONT> : <b>exception</b>; -- <FONT COLOR=red><A NAME="ref_400_4">Eti_Not_Selectable</A></FONT> : <b>exception</b>; -- <FONT COLOR=red><A NAME="ref_401_4">Eti_Not_Connected</A></FONT> : <b>exception</b>; -- <FONT COLOR=red><A NAME="ref_402_4">Eti_Request_Denied</A></FONT> : <b>exception</b>; -- <FONT COLOR=red><A NAME="ref_403_4">Eti_Invalid_Field</A></FONT> : <b>exception</b>; -- <FONT COLOR=red><A NAME="ref_404_4">Eti_Current</A></FONT> : <b>exception</b>; -- -- <FONT COLOR=green><EM>--------------------------------------------------------------------------</EM></FONT> -- <FONT COLOR=green><EM>-- External C variables</EM></FONT> -- <FONT COLOR=green><EM>-- Conceptually even in C this are kind of constants, but they are</EM></FONT> -- <FONT COLOR=green><EM>-- initialized and sometimes changed by the library routines at runtime</EM></FONT> -- <FONT COLOR=green><EM>-- depending on the type of terminal. I believe the best way to model</EM></FONT> -- <FONT COLOR=green><EM>-- this is to use functions.</EM></FONT> -- <FONT COLOR=green><EM>--------------------------------------------------------------------------</EM></FONT> -- -- <b>function</b> <FONT COLOR=red><A NAME="ref_414_13" HREF="terminal_interface-curses__adb.htm#ref_2355_13">Lines</A></FONT> <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_63_12">Line_Count</A>; -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_414_13">Lines</A>); -- -- <b>function</b> <FONT COLOR=red><A NAME="ref_417_13" HREF="terminal_interface-curses__adb.htm#ref_2363_13">Columns</A></FONT> <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_65_12">Column_Count</A>; -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_417_13">Columns</A>); -+ <span class="comment"><EM>------------------</EM></span> -+ <span class="comment"><EM>-- Exceptions --</EM></span> -+ <span class="comment"><EM>------------------</EM></span> -+ <span class="symbol"><A NAME="ref_384_4">Curses_Exception</A></span> : <b>exception</b>; -+ <span class="symbol"><A NAME="ref_385_4">Wrong_Curses_Version</A></span> : <b>exception</b>; -+ -+ <span class="comment"><EM>-- Those exceptions are raised by the ETI (Extended Terminal Interface)</EM></span> -+ <span class="comment"><EM>-- subpackets for Menu and Forms handling.</EM></span> -+ <span class="comment"><EM>--</EM></span> -+ <span class="symbol"><A NAME="ref_390_4">Eti_System_Error</A></span> : <b>exception</b>; -+ <span class="symbol"><A NAME="ref_391_4">Eti_Bad_Argument</A></span> : <b>exception</b>; -+ <span class="symbol"><A NAME="ref_392_4">Eti_Posted</A></span> : <b>exception</b>; -+ <span class="symbol"><A NAME="ref_393_4">Eti_Connected</A></span> : <b>exception</b>; -+ <span class="symbol"><A NAME="ref_394_4">Eti_Bad_State</A></span> : <b>exception</b>; -+ <span class="symbol"><A NAME="ref_395_4">Eti_No_Room</A></span> : <b>exception</b>; -+ <span class="symbol"><A NAME="ref_396_4">Eti_Not_Posted</A></span> : <b>exception</b>; -+ <span class="symbol"><A NAME="ref_397_4">Eti_Unknown_Command</A></span> : <b>exception</b>; -+ <span class="symbol"><A NAME="ref_398_4">Eti_No_Match</A></span> : <b>exception</b>; -+ <span class="symbol"><A NAME="ref_399_4">Eti_Not_Selectable</A></span> : <b>exception</b>; -+ <span class="symbol"><A NAME="ref_400_4">Eti_Not_Connected</A></span> : <b>exception</b>; -+ <span class="symbol"><A NAME="ref_401_4">Eti_Request_Denied</A></span> : <b>exception</b>; -+ <span class="symbol"><A NAME="ref_402_4">Eti_Invalid_Field</A></span> : <b>exception</b>; -+ <span class="symbol"><A NAME="ref_403_4">Eti_Current</A></span> : <b>exception</b>; -+ -+ <span class="comment"><EM>--------------------------------------------------------------------------</EM></span> -+ <span class="comment"><EM>-- External C variables</EM></span> -+ <span class="comment"><EM>-- Conceptually even in C this are kind of constants, but they are</EM></span> -+ <span class="comment"><EM>-- initialized and sometimes changed by the library routines at runtime</EM></span> -+ <span class="comment"><EM>-- depending on the type of terminal. I believe the best way to model</EM></span> -+ <span class="comment"><EM>-- this is to use functions.</EM></span> -+ <span class="comment"><EM>--------------------------------------------------------------------------</EM></span> -+ -+ <b>function</b> <span class="symbol"><A NAME="ref_413_13" HREF="terminal_interface-curses__adb.htm#ref_2355_13">Lines</A></span> <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_63_12">Line_Count</A>; -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_413_13">Lines</A>); -+ -+ <b>function</b> <span class="symbol"><A NAME="ref_416_13" HREF="terminal_interface-curses__adb.htm#ref_2363_13">Columns</A></span> <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_65_12">Column_Count</A>; -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_416_13">Columns</A>); - -- <b>function</b> <FONT COLOR=red><A NAME="ref_420_13" HREF="terminal_interface-curses__adb.htm#ref_2371_13">Tab_Size</A></FONT> <b>return</b> Natural; -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_420_13">Tab_Size</A>); -+ <b>function</b> <span class="symbol"><A NAME="ref_419_13" HREF="terminal_interface-curses__adb.htm#ref_2371_13">Tab_Size</A></span> <b>return</b> Natural; -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_419_13">Tab_Size</A>); - -- <b>function</b> <FONT COLOR=red><A NAME="ref_423_13" HREF="terminal_interface-curses__adb.htm#ref_2379_13">Number_Of_Colors</A></FONT> <b>return</b> Natural; -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_423_13">Number_Of_Colors</A>); -+ <b>function</b> <span class="symbol"><A NAME="ref_422_13" HREF="terminal_interface-curses__adb.htm#ref_2379_13">Number_Of_Colors</A></span> <b>return</b> Natural; -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_422_13">Number_Of_Colors</A>); - -- <b>function</b> <FONT COLOR=red><A NAME="ref_426_13" HREF="terminal_interface-curses__adb.htm#ref_2387_13">Number_Of_Color_Pairs</A></FONT> <b>return</b> Natural; -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_426_13">Number_Of_Color_Pairs</A>); -+ <b>function</b> <span class="symbol"><A NAME="ref_425_13" HREF="terminal_interface-curses__adb.htm#ref_2387_13">Number_Of_Color_Pairs</A></span> <b>return</b> Natural; -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_425_13">Number_Of_Color_Pairs</A>); - - <b>type</b> C_ACS_Map <b>is</b> <b>array</b> (Character'Val (0) .. Character'Val (127)) -- <b>of</b> <A HREF="terminal_interface-curses__ads.htm#ref_354_9">Attributed_Character</A>; -- <FONT COLOR=red><A NAME="ref_431_4">ACS_Map</A></FONT> : C_ACS_Map; -- <b>pragma</b> Import (C, <A HREF="terminal_interface-curses__ads.htm#ref_431_4">ACS_Map</A>, "acs_map"); -- <FONT COLOR=green><EM>--</EM></FONT> -- <FONT COLOR=green><EM>--</EM></FONT> -- <FONT COLOR=green><EM>-- Constants for several characters from the Alternate Character Set</EM></FONT> -- <FONT COLOR=green><EM>-- You must use these constants as indices into the ACS_Map array</EM></FONT> -- <FONT COLOR=green><EM>-- to get the corresponding attributed character at runtime.</EM></FONT> -- <FONT COLOR=green><EM>--</EM></FONT> -- <FONT COLOR=red><A NAME="ref_439_4">ACS_Upper_Left_Corner</A></FONT> : <b>constant</b> Character := 'l'; -- <FONT COLOR=red><A NAME="ref_440_4">ACS_Lower_Left_Corner</A></FONT> : <b>constant</b> Character := 'm'; -- <FONT COLOR=red><A NAME="ref_441_4">ACS_Upper_Right_Corner</A></FONT> : <b>constant</b> Character := 'k'; -- <FONT COLOR=red><A NAME="ref_442_4">ACS_Lower_Right_Corner</A></FONT> : <b>constant</b> Character := 'j'; -- <FONT COLOR=red><A NAME="ref_443_4">ACS_Left_Tee</A></FONT> : <b>constant</b> Character := 't'; -- <FONT COLOR=red><A NAME="ref_444_4">ACS_Right_Tee</A></FONT> : <b>constant</b> Character := 'u'; -- <FONT COLOR=red><A NAME="ref_445_4">ACS_Bottom_Tee</A></FONT> : <b>constant</b> Character := 'v'; -- <FONT COLOR=red><A NAME="ref_446_4">ACS_Top_Tee</A></FONT> : <b>constant</b> Character := 'w'; -- <FONT COLOR=red><A NAME="ref_447_4">ACS_Horizontal_Line</A></FONT> : <b>constant</b> Character := 'q'; -- <FONT COLOR=red><A NAME="ref_448_4">ACS_Vertical_Line</A></FONT> : <b>constant</b> Character := 'x'; -- <FONT COLOR=red><A NAME="ref_449_4">ACS_Plus_Symbol</A></FONT> : <b>constant</b> Character := 'n'; -- <FONT COLOR=red><A NAME="ref_450_4">ACS_Scan_Line_1</A></FONT> : <b>constant</b> Character := 'o'; -- <FONT COLOR=red><A NAME="ref_451_4">ACS_Scan_Line_9</A></FONT> : <b>constant</b> Character := 's'; -- <FONT COLOR=red><A NAME="ref_452_4">ACS_Diamond</A></FONT> : <b>constant</b> Character := Character'Val (96); -- <FONT COLOR=red><A NAME="ref_453_4">ACS_Checker_Board</A></FONT> : <b>constant</b> Character := 'a'; -- <FONT COLOR=red><A NAME="ref_454_4">ACS_Degree</A></FONT> : <b>constant</b> Character := 'f'; -- <FONT COLOR=red><A NAME="ref_455_4">ACS_Plus_Minus</A></FONT> : <b>constant</b> Character := 'g'; -- <FONT COLOR=red><A NAME="ref_456_4">ACS_Bullet</A></FONT> : <b>constant</b> Character := '~'; -- <FONT COLOR=red><A NAME="ref_457_4">ACS_Left_Arrow</A></FONT> : <b>constant</b> Character := ','; -- <FONT COLOR=red><A NAME="ref_458_4">ACS_Right_Arrow</A></FONT> : <b>constant</b> Character := '+'; -- <FONT COLOR=red><A NAME="ref_459_4">ACS_Down_Arrow</A></FONT> : <b>constant</b> Character := '.'; -- <FONT COLOR=red><A NAME="ref_460_4">ACS_Up_Arrow</A></FONT> : <b>constant</b> Character := '-'; -- <FONT COLOR=red><A NAME="ref_461_4">ACS_Board_Of_Squares</A></FONT> : <b>constant</b> Character := 'h'; -- <FONT COLOR=red><A NAME="ref_462_4">ACS_Lantern</A></FONT> : <b>constant</b> Character := 'i'; -- <FONT COLOR=red><A NAME="ref_463_4">ACS_Solid_Block</A></FONT> : <b>constant</b> Character := '0'; -- <FONT COLOR=red><A NAME="ref_464_4">ACS_Scan_Line_3</A></FONT> : <b>constant</b> Character := 'p'; -- <FONT COLOR=red><A NAME="ref_465_4">ACS_Scan_Line_7</A></FONT> : <b>constant</b> Character := 'r'; -- <FONT COLOR=red><A NAME="ref_466_4">ACS_Less_Or_Equal</A></FONT> : <b>constant</b> Character := 'y'; -- <FONT COLOR=red><A NAME="ref_467_4">ACS_Greater_Or_Equal</A></FONT> : <b>constant</b> Character := 'z'; -- <FONT COLOR=red><A NAME="ref_468_4">ACS_PI</A></FONT> : <b>constant</b> Character := '{'; -- <FONT COLOR=red><A NAME="ref_469_4">ACS_Not_Equal</A></FONT> : <b>constant</b> Character := '|'; -- <FONT COLOR=red><A NAME="ref_470_4">ACS_Sterling</A></FONT> : <b>constant</b> Character := '}'; -- -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page <A HREF="../man/curs_initscr.3x.html">curs_initscr.3x</A></EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Not implemented: newterm, set_term, delscreen</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_1"#2|</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_478_13" HREF="terminal_interface-curses__adb.htm#ref_2339_13">Standard_Window</A></FONT> <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_initscr.3x.html">stdscr</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_2"#2|</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_483_13" HREF="terminal_interface-curses__adb.htm#ref_2347_13">Current_Window</A></FONT> <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_initscr.3x.html">curscr</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_483_13">Current_Window</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_3"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_488_14" HREF="terminal_interface-curses__adb.htm#ref_98_14">Init_Screen</A></FONT>; -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_4"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_491_14">Init_Windows</A></FONT> <b>renames</b> <A HREF="terminal_interface-curses__ads.htm#ref_488_14">Init_Screen</A>; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_initscr.3x.html">initscr()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_488_14">Init_Screen</A>); -- <FONT COLOR=green><EM>-- pragma Inline (Init_Windows);</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_5"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_497_14" HREF="terminal_interface-curses__adb.htm#ref_111_14">End_Windows</A></FONT>; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_initscr.3x.html">endwin()</A></EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_499_14">End_Screen</A></FONT> <b>renames</b> <A HREF="terminal_interface-curses__ads.htm#ref_497_14">End_Windows</A>; -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_497_14">End_Windows</A>); -- <FONT COLOR=green><EM>-- pragma Inline (End_Screen);</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_6"#2|</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_504_13" HREF="terminal_interface-curses__adb.htm#ref_121_13">Is_End_Window</A></FONT> <b>return</b> Boolean; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_initscr.3x.html">isendwin()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_504_13">Is_End_Window</A>); -- -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page <A HREF="../man/curs_move.3x.html">curs_move.3x</A></EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_7"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_513_14" HREF="terminal_interface-curses__adb.htm#ref_133_14">Move_Cursor</A></FONT> (<FONT COLOR=red><A NAME="ref_513_27" HREF="terminal_interface-curses__adb.htm#ref_133_27">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_514_27" HREF="terminal_interface-curses__adb.htm#ref_134_27">Line</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_515_27" HREF="terminal_interface-curses__adb.htm#ref_135_27">Column</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_move.3x.html">wmove()</A></EM></FONT> -- <FONT COLOR=green><EM>-- AKA: move()</EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_513_14">Move_Cursor</A>); -- -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page <A HREF="../man/curs_addch.3x.html">curs_addch.3x</A></EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_8"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_525_14" HREF="terminal_interface-curses__adb.htm#ref_148_14">Add</A></FONT> (<FONT COLOR=red><A NAME="ref_525_19" HREF="terminal_interface-curses__adb.htm#ref_148_19">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_526_19" HREF="terminal_interface-curses__adb.htm#ref_149_19">Ch</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_354_9">Attributed_Character</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_addch.3x.html">waddch()</A></EM></FONT> -- <FONT COLOR=green><EM>-- AKA: addch()</EM></FONT> -- -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_530_14" HREF="terminal_interface-curses__adb.htm#ref_160_14">Add</A></FONT> (<FONT COLOR=red><A NAME="ref_530_19" HREF="terminal_interface-curses__adb.htm#ref_160_19">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_531_19" HREF="terminal_interface-curses__adb.htm#ref_161_19">Ch</A></FONT> : Character); -- <FONT COLOR=green><EM>-- Add a single character at the current logical cursor position to</EM></FONT> -- <FONT COLOR=green><EM>-- the window. Use the current windows attributes.</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_9"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_536_14" HREF="terminal_interface-curses__adb.htm#ref_170_14">Add</A></FONT> -- (<FONT COLOR=red><A NAME="ref_537_7" HREF="terminal_interface-curses__adb.htm#ref_171_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_538_7" HREF="terminal_interface-curses__adb.htm#ref_172_7">Line</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_539_7" HREF="terminal_interface-curses__adb.htm#ref_173_7">Column</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -- <FONT COLOR=red><A NAME="ref_540_7" HREF="terminal_interface-curses__adb.htm#ref_174_7">Ch</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_354_9">Attributed_Character</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_addch.3x.html">mvwaddch()</A></EM></FONT> -- <FONT COLOR=green><EM>-- AKA: mvaddch()</EM></FONT> -- -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_544_14" HREF="terminal_interface-curses__adb.htm#ref_189_14">Add</A></FONT> -- (<FONT COLOR=red><A NAME="ref_545_7" HREF="terminal_interface-curses__adb.htm#ref_190_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_546_7" HREF="terminal_interface-curses__adb.htm#ref_191_7">Line</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_547_7" HREF="terminal_interface-curses__adb.htm#ref_192_7">Column</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -- <FONT COLOR=red><A NAME="ref_548_7" HREF="terminal_interface-curses__adb.htm#ref_193_7">Ch</A></FONT> : Character); -- <FONT COLOR=green><EM>-- Move to the position and add a single character into the window</EM></FONT> -- <FONT COLOR=green><EM>-- There are more Add routines, so the Inline pragma follows later</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_10"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_553_14" HREF="terminal_interface-curses__adb.htm#ref_204_14">Add_With_Immediate_Echo</A></FONT> -- (<FONT COLOR=red><A NAME="ref_554_7" HREF="terminal_interface-curses__adb.htm#ref_205_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_555_7" HREF="terminal_interface-curses__adb.htm#ref_206_7">Ch</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_354_9">Attributed_Character</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_addch.3x.html">wechochar()</A></EM></FONT> -- <FONT COLOR=green><EM>-- AKA: echochar()</EM></FONT> -- -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_559_14" HREF="terminal_interface-curses__adb.htm#ref_217_14">Add_With_Immediate_Echo</A></FONT> -- (<FONT COLOR=red><A NAME="ref_560_7" HREF="terminal_interface-curses__adb.htm#ref_218_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_561_7" HREF="terminal_interface-curses__adb.htm#ref_219_7">Ch</A></FONT> : Character); -- <FONT COLOR=green><EM>-- Add a character and do an immediate refresh of the screen.</EM></FONT> -+ <b>of</b> <A HREF="terminal_interface-curses__ads.htm#ref_353_9">Attributed_Character</A>; -+ <span class="symbol"><A NAME="ref_430_4">ACS_Map</A></span> : C_ACS_Map; -+ <b>pragma</b> Import (C, <A HREF="terminal_interface-curses__ads.htm#ref_430_4">ACS_Map</A>, "acs_map"); -+ <span class="comment"><EM>--</EM></span> -+ <span class="comment"><EM>--</EM></span> -+ <span class="comment"><EM>-- Constants for several characters from the Alternate Character Set</EM></span> -+ <span class="comment"><EM>-- You must use these constants as indices into the ACS_Map array</EM></span> -+ <span class="comment"><EM>-- to get the corresponding attributed character at runtime.</EM></span> -+ <span class="comment"><EM>--</EM></span> -+ <span class="symbol"><A NAME="ref_438_4">ACS_Upper_Left_Corner</A></span> : <b>constant</b> Character := 'l'; -+ <span class="symbol"><A NAME="ref_439_4">ACS_Lower_Left_Corner</A></span> : <b>constant</b> Character := 'm'; -+ <span class="symbol"><A NAME="ref_440_4">ACS_Upper_Right_Corner</A></span> : <b>constant</b> Character := 'k'; -+ <span class="symbol"><A NAME="ref_441_4">ACS_Lower_Right_Corner</A></span> : <b>constant</b> Character := 'j'; -+ <span class="symbol"><A NAME="ref_442_4">ACS_Left_Tee</A></span> : <b>constant</b> Character := 't'; -+ <span class="symbol"><A NAME="ref_443_4">ACS_Right_Tee</A></span> : <b>constant</b> Character := 'u'; -+ <span class="symbol"><A NAME="ref_444_4">ACS_Bottom_Tee</A></span> : <b>constant</b> Character := 'v'; -+ <span class="symbol"><A NAME="ref_445_4">ACS_Top_Tee</A></span> : <b>constant</b> Character := 'w'; -+ <span class="symbol"><A NAME="ref_446_4">ACS_Horizontal_Line</A></span> : <b>constant</b> Character := 'q'; -+ <span class="symbol"><A NAME="ref_447_4">ACS_Vertical_Line</A></span> : <b>constant</b> Character := 'x'; -+ <span class="symbol"><A NAME="ref_448_4">ACS_Plus_Symbol</A></span> : <b>constant</b> Character := 'n'; -+ <span class="symbol"><A NAME="ref_449_4">ACS_Scan_Line_1</A></span> : <b>constant</b> Character := 'o'; -+ <span class="symbol"><A NAME="ref_450_4">ACS_Scan_Line_9</A></span> : <b>constant</b> Character := 's'; -+ <span class="symbol"><A NAME="ref_451_4">ACS_Diamond</A></span> : <b>constant</b> Character := Character'Val (96); -+ <span class="symbol"><A NAME="ref_452_4">ACS_Checker_Board</A></span> : <b>constant</b> Character := 'a'; -+ <span class="symbol"><A NAME="ref_453_4">ACS_Degree</A></span> : <b>constant</b> Character := 'f'; -+ <span class="symbol"><A NAME="ref_454_4">ACS_Plus_Minus</A></span> : <b>constant</b> Character := 'g'; -+ <span class="symbol"><A NAME="ref_455_4">ACS_Bullet</A></span> : <b>constant</b> Character := '~'; -+ <span class="symbol"><A NAME="ref_456_4">ACS_Left_Arrow</A></span> : <b>constant</b> Character := ','; -+ <span class="symbol"><A NAME="ref_457_4">ACS_Right_Arrow</A></span> : <b>constant</b> Character := '+'; -+ <span class="symbol"><A NAME="ref_458_4">ACS_Down_Arrow</A></span> : <b>constant</b> Character := '.'; -+ <span class="symbol"><A NAME="ref_459_4">ACS_Up_Arrow</A></span> : <b>constant</b> Character := '-'; -+ <span class="symbol"><A NAME="ref_460_4">ACS_Board_Of_Squares</A></span> : <b>constant</b> Character := 'h'; -+ <span class="symbol"><A NAME="ref_461_4">ACS_Lantern</A></span> : <b>constant</b> Character := 'i'; -+ <span class="symbol"><A NAME="ref_462_4">ACS_Solid_Block</A></span> : <b>constant</b> Character := '0'; -+ <span class="symbol"><A NAME="ref_463_4">ACS_Scan_Line_3</A></span> : <b>constant</b> Character := 'p'; -+ <span class="symbol"><A NAME="ref_464_4">ACS_Scan_Line_7</A></span> : <b>constant</b> Character := 'r'; -+ <span class="symbol"><A NAME="ref_465_4">ACS_Less_Or_Equal</A></span> : <b>constant</b> Character := 'y'; -+ <span class="symbol"><A NAME="ref_466_4">ACS_Greater_Or_Equal</A></span> : <b>constant</b> Character := 'z'; -+ <span class="symbol"><A NAME="ref_467_4">ACS_PI</A></span> : <b>constant</b> Character := '{'; -+ <span class="symbol"><A NAME="ref_468_4">ACS_Not_Equal</A></span> : <b>constant</b> Character := '|'; -+ <span class="symbol"><A NAME="ref_469_4">ACS_Sterling</A></span> : <b>constant</b> Character := '}'; -+ -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page <A HREF="../man/curs_initscr.3x.html">curs_initscr.3x</A></EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Not implemented: newterm, set_term, delscreen</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_1"#2|</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_477_13" HREF="terminal_interface-curses__adb.htm#ref_2339_13">Standard_Window</A></span> <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_initscr.3x.html">stdscr</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_2"#2|</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_482_13" HREF="terminal_interface-curses__adb.htm#ref_2347_13">Current_Window</A></span> <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_initscr.3x.html">curscr</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_482_13">Current_Window</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_3"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_487_14" HREF="terminal_interface-curses__adb.htm#ref_98_14">Init_Screen</A></span>; -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_4"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_490_14">Init_Windows</A></span> <b>renames</b> <A HREF="terminal_interface-curses__ads.htm#ref_487_14">Init_Screen</A>; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_initscr.3x.html">initscr()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_487_14">Init_Screen</A>); -+ <span class="comment"><EM>-- pragma Inline (Init_Windows);</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_5"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_496_14" HREF="terminal_interface-curses__adb.htm#ref_111_14">End_Windows</A></span>; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_initscr.3x.html">endwin()</A></EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_498_14">End_Screen</A></span> <b>renames</b> <A HREF="terminal_interface-curses__ads.htm#ref_496_14">End_Windows</A>; -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_496_14">End_Windows</A>); -+ <span class="comment"><EM>-- pragma Inline (End_Screen);</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_6"#2|</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_503_13" HREF="terminal_interface-curses__adb.htm#ref_121_13">Is_End_Window</A></span> <b>return</b> Boolean; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_initscr.3x.html">isendwin()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_503_13">Is_End_Window</A>); -+ -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page <A HREF="../man/curs_move.3x.html">curs_move.3x</A></EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_7"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_512_14" HREF="terminal_interface-curses__adb.htm#ref_133_14">Move_Cursor</A></span> (<span class="symbol"><A NAME="ref_512_27" HREF="terminal_interface-curses__adb.htm#ref_133_27">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_513_27" HREF="terminal_interface-curses__adb.htm#ref_134_27">Line</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_514_27" HREF="terminal_interface-curses__adb.htm#ref_135_27">Column</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_move.3x.html">wmove()</A></EM></span> -+ <span class="comment"><EM>-- AKA: move()</EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_512_14">Move_Cursor</A>); -+ -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page <A HREF="../man/curs_addch.3x.html">curs_addch.3x</A></EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_8"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_524_14" HREF="terminal_interface-curses__adb.htm#ref_148_14">Add</A></span> (<span class="symbol"><A NAME="ref_524_19" HREF="terminal_interface-curses__adb.htm#ref_148_19">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_525_19" HREF="terminal_interface-curses__adb.htm#ref_149_19">Ch</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_353_9">Attributed_Character</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_addch.3x.html">waddch()</A></EM></span> -+ <span class="comment"><EM>-- AKA: addch()</EM></span> -+ -+ <b>procedure</b> <span class="symbol"><A NAME="ref_529_14" HREF="terminal_interface-curses__adb.htm#ref_160_14">Add</A></span> (<span class="symbol"><A NAME="ref_529_19" HREF="terminal_interface-curses__adb.htm#ref_160_19">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_530_19" HREF="terminal_interface-curses__adb.htm#ref_161_19">Ch</A></span> : Character); -+ <span class="comment"><EM>-- Add a single character at the current logical cursor position to</EM></span> -+ <span class="comment"><EM>-- the window. Use the current windows attributes.</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_9"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_535_14" HREF="terminal_interface-curses__adb.htm#ref_170_14">Add</A></span> -+ (<span class="symbol"><A NAME="ref_536_7" HREF="terminal_interface-curses__adb.htm#ref_171_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_537_7" HREF="terminal_interface-curses__adb.htm#ref_172_7">Line</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_538_7" HREF="terminal_interface-curses__adb.htm#ref_173_7">Column</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -+ <span class="symbol"><A NAME="ref_539_7" HREF="terminal_interface-curses__adb.htm#ref_174_7">Ch</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_353_9">Attributed_Character</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_addch.3x.html">mvwaddch()</A></EM></span> -+ <span class="comment"><EM>-- AKA: mvaddch()</EM></span> -+ -+ <b>procedure</b> <span class="symbol"><A NAME="ref_543_14" HREF="terminal_interface-curses__adb.htm#ref_189_14">Add</A></span> -+ (<span class="symbol"><A NAME="ref_544_7" HREF="terminal_interface-curses__adb.htm#ref_190_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_545_7" HREF="terminal_interface-curses__adb.htm#ref_191_7">Line</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_546_7" HREF="terminal_interface-curses__adb.htm#ref_192_7">Column</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -+ <span class="symbol"><A NAME="ref_547_7" HREF="terminal_interface-curses__adb.htm#ref_193_7">Ch</A></span> : Character); -+ <span class="comment"><EM>-- Move to the position and add a single character into the window</EM></span> -+ <span class="comment"><EM>-- There are more Add routines, so the Inline pragma follows later</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_10"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_552_14" HREF="terminal_interface-curses__adb.htm#ref_204_14">Add_With_Immediate_Echo</A></span> -+ (<span class="symbol"><A NAME="ref_553_7" HREF="terminal_interface-curses__adb.htm#ref_205_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_554_7" HREF="terminal_interface-curses__adb.htm#ref_206_7">Ch</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_353_9">Attributed_Character</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_addch.3x.html">wechochar()</A></EM></span> -+ <span class="comment"><EM>-- AKA: echochar()</EM></span> -+ -+ <b>procedure</b> <span class="symbol"><A NAME="ref_558_14" HREF="terminal_interface-curses__adb.htm#ref_217_14">Add_With_Immediate_Echo</A></span> -+ (<span class="symbol"><A NAME="ref_559_7" HREF="terminal_interface-curses__adb.htm#ref_218_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_560_7" HREF="terminal_interface-curses__adb.htm#ref_219_7">Ch</A></span> : Character); -+ <span class="comment"><EM>-- Add a character and do an immediate refresh of the screen.</EM></span> - <b>pragma</b> Inline (Add_With_Immediate_Echo); - -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page <A HREF="../man/curs_window.3x.html">curs_window.3x</A></EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- Not Implemented: wcursyncup</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_11"#2|</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_571_13" HREF="terminal_interface-curses__adb.htm#ref_229_13">Create</A></FONT> -- (<FONT COLOR=red><A NAME="ref_572_7" HREF="terminal_interface-curses__adb.htm#ref_229_21">Number_Of_Lines</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_63_12">Line_Count</A>; -- <FONT COLOR=red><A NAME="ref_573_7" HREF="terminal_interface-curses__adb.htm#ref_230_21">Number_Of_Columns</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_65_12">Column_Count</A>; -- <FONT COLOR=red><A NAME="ref_574_7" HREF="terminal_interface-curses__adb.htm#ref_231_21">First_Line_Position</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_575_7" HREF="terminal_interface-curses__adb.htm#ref_232_21">First_Column_Position</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- <FONT COLOR=green><EM>-- Not Implemented: Default Number_Of_Lines, Number_Of_Columns</EM></FONT> -- <FONT COLOR=green><EM>-- the C version lets them be 0, see the man page.</EM></FONT> -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_window.3x.html">newwin()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_571_13">Create</A>); -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page <A HREF="../man/curs_window.3x.html">curs_window.3x</A></EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- Not Implemented: wcursyncup</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_11"#2|</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_570_13" HREF="terminal_interface-curses__adb.htm#ref_229_13">Create</A></span> -+ (<span class="symbol"><A NAME="ref_571_7" HREF="terminal_interface-curses__adb.htm#ref_229_21">Number_Of_Lines</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_63_12">Line_Count</A>; -+ <span class="symbol"><A NAME="ref_572_7" HREF="terminal_interface-curses__adb.htm#ref_230_21">Number_Of_Columns</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_65_12">Column_Count</A>; -+ <span class="symbol"><A NAME="ref_573_7" HREF="terminal_interface-curses__adb.htm#ref_231_21">First_Line_Position</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_574_7" HREF="terminal_interface-curses__adb.htm#ref_232_21">First_Column_Position</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="comment"><EM>-- Not Implemented: Default Number_Of_Lines, Number_Of_Columns</EM></span> -+ <span class="comment"><EM>-- the C version lets them be 0, see the man page.</EM></span> -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_window.3x.html">newwin()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_570_13">Create</A>); - - <b>function</b> New_Window -- (<FONT COLOR=red><A NAME="ref_582_7">Number_Of_Lines</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_63_12">Line_Count</A>; -- <FONT COLOR=red><A NAME="ref_583_7">Number_Of_Columns</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_65_12">Column_Count</A>; -- <FONT COLOR=red><A NAME="ref_584_7">First_Line_Position</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_585_7">First_Column_Position</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> -- <b>renames</b> <A HREF="terminal_interface-curses__ads.htm#ref_571_13">Create</A>; -- <FONT COLOR=green><EM>-- pragma Inline (New_Window);</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_12"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_590_14" HREF="terminal_interface-curses__adb.htm#ref_252_14">Delete</A></FONT> (<FONT COLOR=red><A NAME="ref_590_22" HREF="terminal_interface-curses__adb.htm#ref_252_22">Win</A></FONT> : <b>in</b> <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_window.3x.html">delwin()</A></EM></FONT> -- <FONT COLOR=green><EM>-- Reset Win to Null_Window</EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_590_14">Delete</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_13"#2|</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_596_13" HREF="terminal_interface-curses__adb.htm#ref_263_13">Sub_Window</A></FONT> -- (<FONT COLOR=red><A NAME="ref_597_7" HREF="terminal_interface-curses__adb.htm#ref_264_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_598_7" HREF="terminal_interface-curses__adb.htm#ref_265_7">Number_Of_Lines</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_63_12">Line_Count</A>; -- <FONT COLOR=red><A NAME="ref_599_7" HREF="terminal_interface-curses__adb.htm#ref_266_7">Number_Of_Columns</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_65_12">Column_Count</A>; -- <FONT COLOR=red><A NAME="ref_600_7" HREF="terminal_interface-curses__adb.htm#ref_267_7">First_Line_Position</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_601_7" HREF="terminal_interface-curses__adb.htm#ref_268_7">First_Column_Position</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_window.3x.html">subwin()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_596_13">Sub_Window</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_14"#2|</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_606_13" HREF="terminal_interface-curses__adb.htm#ref_291_13">Derived_Window</A></FONT> -- (<FONT COLOR=red><A NAME="ref_607_7" HREF="terminal_interface-curses__adb.htm#ref_292_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_608_7" HREF="terminal_interface-curses__adb.htm#ref_293_7">Number_Of_Lines</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_63_12">Line_Count</A>; -- <FONT COLOR=red><A NAME="ref_609_7" HREF="terminal_interface-curses__adb.htm#ref_294_7">Number_Of_Columns</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_65_12">Column_Count</A>; -- <FONT COLOR=red><A NAME="ref_610_7" HREF="terminal_interface-curses__adb.htm#ref_295_7">First_Line_Position</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_611_7" HREF="terminal_interface-curses__adb.htm#ref_296_7">First_Column_Position</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_window.3x.html">derwin()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_606_13">Derived_Window</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_15"#2|</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_616_13" HREF="terminal_interface-curses__adb.htm#ref_319_13">Duplicate</A></FONT> (<FONT COLOR=red><A NAME="ref_616_24" HREF="terminal_interface-curses__adb.htm#ref_319_24">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_window.3x.html">dupwin()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_616_13">Duplicate</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_16"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_621_14" HREF="terminal_interface-curses__adb.htm#ref_332_14">Move_Window</A></FONT> (<FONT COLOR=red><A NAME="ref_621_27" HREF="terminal_interface-curses__adb.htm#ref_332_27">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- <FONT COLOR=red><A NAME="ref_622_27" HREF="terminal_interface-curses__adb.htm#ref_333_27">Line</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_623_27" HREF="terminal_interface-curses__adb.htm#ref_334_27">Column</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_window.3x.html">mvwin()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_621_14">Move_Window</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_17"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_628_14" HREF="terminal_interface-curses__adb.htm#ref_346_14">Move_Derived_Window</A></FONT> (<FONT COLOR=red><A NAME="ref_628_35" HREF="terminal_interface-curses__adb.htm#ref_346_35">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- <FONT COLOR=red><A NAME="ref_629_35" HREF="terminal_interface-curses__adb.htm#ref_347_35">Line</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_630_35" HREF="terminal_interface-curses__adb.htm#ref_348_35">Column</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_window.3x.html">mvderwin()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_628_14">Move_Derived_Window</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_18"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_635_14">Synchronize_Upwards</A></FONT> (<FONT COLOR=red><A NAME="ref_635_35" HREF="terminal_interface-curses__ads.htm#ref_635_14">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_window.3x.html">wsyncup()</A></EM></FONT> -+ (<span class="symbol"><A NAME="ref_581_7">Number_Of_Lines</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_63_12">Line_Count</A>; -+ <span class="symbol"><A NAME="ref_582_7">Number_Of_Columns</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_65_12">Column_Count</A>; -+ <span class="symbol"><A NAME="ref_583_7">First_Line_Position</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_584_7">First_Column_Position</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> -+ <b>renames</b> <A HREF="terminal_interface-curses__ads.htm#ref_570_13">Create</A>; -+ <span class="comment"><EM>-- pragma Inline (New_Window);</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_12"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_589_14" HREF="terminal_interface-curses__adb.htm#ref_252_14">Delete</A></span> (<span class="symbol"><A NAME="ref_589_22" HREF="terminal_interface-curses__adb.htm#ref_252_22">Win</A></span> : <b>in</b> <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_window.3x.html">delwin()</A></EM></span> -+ <span class="comment"><EM>-- Reset Win to Null_Window</EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_589_14">Delete</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_13"#2|</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_595_13" HREF="terminal_interface-curses__adb.htm#ref_263_13">Sub_Window</A></span> -+ (<span class="symbol"><A NAME="ref_596_7" HREF="terminal_interface-curses__adb.htm#ref_264_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_597_7" HREF="terminal_interface-curses__adb.htm#ref_265_7">Number_Of_Lines</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_63_12">Line_Count</A>; -+ <span class="symbol"><A NAME="ref_598_7" HREF="terminal_interface-curses__adb.htm#ref_266_7">Number_Of_Columns</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_65_12">Column_Count</A>; -+ <span class="symbol"><A NAME="ref_599_7" HREF="terminal_interface-curses__adb.htm#ref_267_7">First_Line_Position</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_600_7" HREF="terminal_interface-curses__adb.htm#ref_268_7">First_Column_Position</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_window.3x.html">subwin()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_595_13">Sub_Window</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_14"#2|</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_605_13" HREF="terminal_interface-curses__adb.htm#ref_291_13">Derived_Window</A></span> -+ (<span class="symbol"><A NAME="ref_606_7" HREF="terminal_interface-curses__adb.htm#ref_292_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_607_7" HREF="terminal_interface-curses__adb.htm#ref_293_7">Number_Of_Lines</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_63_12">Line_Count</A>; -+ <span class="symbol"><A NAME="ref_608_7" HREF="terminal_interface-curses__adb.htm#ref_294_7">Number_Of_Columns</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_65_12">Column_Count</A>; -+ <span class="symbol"><A NAME="ref_609_7" HREF="terminal_interface-curses__adb.htm#ref_295_7">First_Line_Position</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_610_7" HREF="terminal_interface-curses__adb.htm#ref_296_7">First_Column_Position</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_window.3x.html">derwin()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_605_13">Derived_Window</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_15"#2|</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_615_13" HREF="terminal_interface-curses__adb.htm#ref_319_13">Duplicate</A></span> (<span class="symbol"><A NAME="ref_615_24" HREF="terminal_interface-curses__adb.htm#ref_319_24">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_window.3x.html">dupwin()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_615_13">Duplicate</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_16"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_620_14" HREF="terminal_interface-curses__adb.htm#ref_332_14">Move_Window</A></span> (<span class="symbol"><A NAME="ref_620_27" HREF="terminal_interface-curses__adb.htm#ref_332_27">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="symbol"><A NAME="ref_621_27" HREF="terminal_interface-curses__adb.htm#ref_333_27">Line</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_622_27" HREF="terminal_interface-curses__adb.htm#ref_334_27">Column</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_window.3x.html">mvwin()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_620_14">Move_Window</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_17"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_627_14" HREF="terminal_interface-curses__adb.htm#ref_346_14">Move_Derived_Window</A></span> (<span class="symbol"><A NAME="ref_627_35" HREF="terminal_interface-curses__adb.htm#ref_346_35">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="symbol"><A NAME="ref_628_35" HREF="terminal_interface-curses__adb.htm#ref_347_35">Line</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_629_35" HREF="terminal_interface-curses__adb.htm#ref_348_35">Column</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_window.3x.html">mvderwin()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_627_14">Move_Derived_Window</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_18"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_634_14">Synchronize_Upwards</A></span> (<span class="symbol"><A NAME="ref_634_35" HREF="terminal_interface-curses__ads.htm#ref_634_14">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_window.3x.html">wsyncup()</A></EM></span> - <b>pragma</b> Import (C, Synchronize_Upwards, "wsyncup"); - -- <FONT COLOR=green><EM>-- #1A NAME="AFU_19"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_640_14">Synchronize_Downwards</A></FONT> (<FONT COLOR=red><A NAME="ref_640_37" HREF="terminal_interface-curses__ads.htm#ref_640_14">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_window.3x.html">wsyncdown()</A></EM></FONT> -+ <span class="comment"><EM>-- #1A NAME="AFU_19"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_639_14">Synchronize_Downwards</A></span> (<span class="symbol"><A NAME="ref_639_37" HREF="terminal_interface-curses__ads.htm#ref_639_14">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_window.3x.html">wsyncdown()</A></EM></span> - <b>pragma</b> Import (C, Synchronize_Downwards, "wsyncdown"); - -- <FONT COLOR=green><EM>-- #1A NAME="AFU_20"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_645_14" HREF="terminal_interface-curses__adb.htm#ref_360_14">Set_Synch_Mode</A></FONT> (<FONT COLOR=red><A NAME="ref_645_30" HREF="terminal_interface-curses__adb.htm#ref_360_30">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_646_30" HREF="terminal_interface-curses__adb.htm#ref_361_30">Mode</A></FONT> : Boolean := False); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_window.3x.html">syncok()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_645_14">Set_Synch_Mode</A>); -- -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page <A HREF="../man/curs_addstr.3x.html">curs_addstr.3x</A></EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_21"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_655_14" HREF="terminal_interface-curses__adb.htm#ref_372_14">Add</A></FONT> (<FONT COLOR=red><A NAME="ref_655_19" HREF="terminal_interface-curses__adb.htm#ref_372_19">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_656_19" HREF="terminal_interface-curses__adb.htm#ref_373_19">Str</A></FONT> : String; -- <FONT COLOR=red><A NAME="ref_657_19" HREF="terminal_interface-curses__adb.htm#ref_374_19">Len</A></FONT> : Integer := -1); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_addstr.3x.html">waddnstr()</A></EM></FONT> -- <FONT COLOR=green><EM>-- AKA: waddstr()</EM></FONT> -- <FONT COLOR=green><EM>-- AKA: addnstr()</EM></FONT> -- <FONT COLOR=green><EM>-- AKA: addstr()</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_22"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_664_14" HREF="terminal_interface-curses__adb.htm#ref_390_14">Add</A></FONT> (<FONT COLOR=red><A NAME="ref_664_19" HREF="terminal_interface-curses__adb.htm#ref_391_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_665_19" HREF="terminal_interface-curses__adb.htm#ref_392_7">Line</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_666_19" HREF="terminal_interface-curses__adb.htm#ref_393_7">Column</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -- <FONT COLOR=red><A NAME="ref_667_19" HREF="terminal_interface-curses__adb.htm#ref_394_7">Str</A></FONT> : String; -- <FONT COLOR=red><A NAME="ref_668_19" HREF="terminal_interface-curses__adb.htm#ref_395_7">Len</A></FONT> : Integer := -1); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_addstr.3x.html">mvwaddnstr()</A></EM></FONT> -- <FONT COLOR=green><EM>-- AKA: mvwaddstr()</EM></FONT> -- <FONT COLOR=green><EM>-- AKA: mvaddnstr()</EM></FONT> -- <FONT COLOR=green><EM>-- AKA: mvaddstr()</EM></FONT> -- -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page <A HREF="../man/curs_addchstr.3x.html">curs_addchstr.3x</A></EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_23"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_679_14" HREF="terminal_interface-curses__adb.htm#ref_402_14">Add</A></FONT> (<FONT COLOR=red><A NAME="ref_679_19" HREF="terminal_interface-curses__adb.htm#ref_403_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_680_19" HREF="terminal_interface-curses__adb.htm#ref_404_7">Str</A></FONT> : Attributed_String; -- <FONT COLOR=red><A NAME="ref_681_19" HREF="terminal_interface-curses__adb.htm#ref_405_7">Len</A></FONT> : Integer := -1); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_addchstr.3x.html">waddchnstr()</A></EM></FONT> -- <FONT COLOR=green><EM>-- AKA: waddchstr()</EM></FONT> -- <FONT COLOR=green><EM>-- AKA: addchnstr()</EM></FONT> -- <FONT COLOR=green><EM>-- AKA: addchstr()</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_24"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_688_14" HREF="terminal_interface-curses__adb.htm#ref_425_14">Add</A></FONT> (<FONT COLOR=red><A NAME="ref_688_19" HREF="terminal_interface-curses__adb.htm#ref_426_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_689_19" HREF="terminal_interface-curses__adb.htm#ref_427_7">Line</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_690_19" HREF="terminal_interface-curses__adb.htm#ref_428_7">Column</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -- <FONT COLOR=red><A NAME="ref_691_19" HREF="terminal_interface-curses__adb.htm#ref_429_7">Str</A></FONT> : Attributed_String; -- <FONT COLOR=red><A NAME="ref_692_19" HREF="terminal_interface-curses__adb.htm#ref_430_7">Len</A></FONT> : Integer := -1); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_addchstr.3x.html">mvwaddchnstr()</A></EM></FONT> -- <FONT COLOR=green><EM>-- AKA: mvwaddchstr()</EM></FONT> -- <FONT COLOR=green><EM>-- AKA: mvaddchnstr()</EM></FONT> -- <FONT COLOR=green><EM>-- AKA: mvaddchstr()</EM></FONT> -+ <span class="comment"><EM>-- #1A NAME="AFU_20"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_644_14" HREF="terminal_interface-curses__adb.htm#ref_360_14">Set_Synch_Mode</A></span> (<span class="symbol"><A NAME="ref_644_30" HREF="terminal_interface-curses__adb.htm#ref_360_30">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_645_30" HREF="terminal_interface-curses__adb.htm#ref_361_30">Mode</A></span> : Boolean := False); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_window.3x.html">syncok()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_644_14">Set_Synch_Mode</A>); -+ -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page <A HREF="../man/curs_addstr.3x.html">curs_addstr.3x</A></EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_21"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_654_14" HREF="terminal_interface-curses__adb.htm#ref_372_14">Add</A></span> (<span class="symbol"><A NAME="ref_654_19" HREF="terminal_interface-curses__adb.htm#ref_372_19">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_655_19" HREF="terminal_interface-curses__adb.htm#ref_373_19">Str</A></span> : String; -+ <span class="symbol"><A NAME="ref_656_19" HREF="terminal_interface-curses__adb.htm#ref_374_19">Len</A></span> : Integer := -1); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_addstr.3x.html">waddnstr()</A></EM></span> -+ <span class="comment"><EM>-- AKA: waddstr()</EM></span> -+ <span class="comment"><EM>-- AKA: addnstr()</EM></span> -+ <span class="comment"><EM>-- AKA: addstr()</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_22"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_663_14" HREF="terminal_interface-curses__adb.htm#ref_390_14">Add</A></span> (<span class="symbol"><A NAME="ref_663_19" HREF="terminal_interface-curses__adb.htm#ref_391_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_664_19" HREF="terminal_interface-curses__adb.htm#ref_392_7">Line</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_665_19" HREF="terminal_interface-curses__adb.htm#ref_393_7">Column</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -+ <span class="symbol"><A NAME="ref_666_19" HREF="terminal_interface-curses__adb.htm#ref_394_7">Str</A></span> : String; -+ <span class="symbol"><A NAME="ref_667_19" HREF="terminal_interface-curses__adb.htm#ref_395_7">Len</A></span> : Integer := -1); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_addstr.3x.html">mvwaddnstr()</A></EM></span> -+ <span class="comment"><EM>-- AKA: mvwaddstr()</EM></span> -+ <span class="comment"><EM>-- AKA: mvaddnstr()</EM></span> -+ <span class="comment"><EM>-- AKA: mvaddstr()</EM></span> -+ -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page <A HREF="../man/curs_addchstr.3x.html">curs_addchstr.3x</A></EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_23"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_678_14" HREF="terminal_interface-curses__adb.htm#ref_402_14">Add</A></span> (<span class="symbol"><A NAME="ref_678_19" HREF="terminal_interface-curses__adb.htm#ref_403_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_679_19" HREF="terminal_interface-curses__adb.htm#ref_404_7">Str</A></span> : Attributed_String; -+ <span class="symbol"><A NAME="ref_680_19" HREF="terminal_interface-curses__adb.htm#ref_405_7">Len</A></span> : Integer := -1); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_addchstr.3x.html">waddchnstr()</A></EM></span> -+ <span class="comment"><EM>-- AKA: waddchstr()</EM></span> -+ <span class="comment"><EM>-- AKA: addchnstr()</EM></span> -+ <span class="comment"><EM>-- AKA: addchstr()</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_24"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_687_14" HREF="terminal_interface-curses__adb.htm#ref_425_14">Add</A></span> (<span class="symbol"><A NAME="ref_687_19" HREF="terminal_interface-curses__adb.htm#ref_426_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_688_19" HREF="terminal_interface-curses__adb.htm#ref_427_7">Line</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_689_19" HREF="terminal_interface-curses__adb.htm#ref_428_7">Column</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -+ <span class="symbol"><A NAME="ref_690_19" HREF="terminal_interface-curses__adb.htm#ref_429_7">Str</A></span> : Attributed_String; -+ <span class="symbol"><A NAME="ref_691_19" HREF="terminal_interface-curses__adb.htm#ref_430_7">Len</A></span> : Integer := -1); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_addchstr.3x.html">mvwaddchnstr()</A></EM></span> -+ <span class="comment"><EM>-- AKA: mvwaddchstr()</EM></span> -+ <span class="comment"><EM>-- AKA: mvaddchnstr()</EM></span> -+ <span class="comment"><EM>-- AKA: mvaddchstr()</EM></span> - <b>pragma</b> Inline (Add); - -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page <A HREF="../man/curs_border.3x.html">curs_border.3x</A></EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Not implemented: mvhline, mvwhline, mvvline, mvwvline</EM></FONT> -- <FONT COLOR=green><EM>-- | use Move_Cursor then Horizontal_Line or Vertical_Line</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_25"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_706_14" HREF="terminal_interface-curses__adb.htm#ref_437_14">Border</A></FONT> -- (<FONT COLOR=red><A NAME="ref_707_7" HREF="terminal_interface-curses__adb.htm#ref_438_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_708_7" HREF="terminal_interface-curses__adb.htm#ref_439_7">Left_Side_Symbol</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_354_9">Attributed_Character</A> := <A HREF="terminal_interface-curses__ads.htm#ref_373_4">Default_Character</A>; -- <FONT COLOR=red><A NAME="ref_709_7" HREF="terminal_interface-curses__adb.htm#ref_440_7">Right_Side_Symbol</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_354_9">Attributed_Character</A> := <A HREF="terminal_interface-curses__ads.htm#ref_373_4">Default_Character</A>; -- <FONT COLOR=red><A NAME="ref_710_7" HREF="terminal_interface-curses__adb.htm#ref_441_7">Top_Side_Symbol</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_354_9">Attributed_Character</A> := <A HREF="terminal_interface-curses__ads.htm#ref_373_4">Default_Character</A>; -- <FONT COLOR=red><A NAME="ref_711_7" HREF="terminal_interface-curses__adb.htm#ref_442_7">Bottom_Side_Symbol</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_354_9">Attributed_Character</A> := <A HREF="terminal_interface-curses__ads.htm#ref_373_4">Default_Character</A>; -- <FONT COLOR=red><A NAME="ref_712_7" HREF="terminal_interface-curses__adb.htm#ref_443_7">Upper_Left_Corner_Symbol</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_354_9">Attributed_Character</A> := <A HREF="terminal_interface-curses__ads.htm#ref_373_4">Default_Character</A>; -- <FONT COLOR=red><A NAME="ref_713_7" HREF="terminal_interface-curses__adb.htm#ref_444_7">Upper_Right_Corner_Symbol</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_354_9">Attributed_Character</A> := <A HREF="terminal_interface-curses__ads.htm#ref_373_4">Default_Character</A>; -- <FONT COLOR=red><A NAME="ref_714_7" HREF="terminal_interface-curses__adb.htm#ref_445_7">Lower_Left_Corner_Symbol</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_354_9">Attributed_Character</A> := <A HREF="terminal_interface-curses__ads.htm#ref_373_4">Default_Character</A>; -- <FONT COLOR=red><A NAME="ref_715_7" HREF="terminal_interface-curses__adb.htm#ref_446_7">Lower_Right_Corner_Symbol</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_354_9">Attributed_Character</A> := <A HREF="terminal_interface-curses__ads.htm#ref_373_4">Default_Character</A> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page <A HREF="../man/curs_border.3x.html">curs_border.3x</A></EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Not implemented: mvhline, mvwhline, mvvline, mvwvline</EM></span> -+ <span class="comment"><EM>-- | use Move_Cursor then Horizontal_Line or Vertical_Line</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_25"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_705_14" HREF="terminal_interface-curses__adb.htm#ref_437_14">Border</A></span> -+ (<span class="symbol"><A NAME="ref_706_7" HREF="terminal_interface-curses__adb.htm#ref_438_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_707_7" HREF="terminal_interface-curses__adb.htm#ref_439_7">Left_Side_Symbol</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_353_9">Attributed_Character</A> := <A HREF="terminal_interface-curses__ads.htm#ref_372_4">Default_Character</A>; -+ <span class="symbol"><A NAME="ref_708_7" HREF="terminal_interface-curses__adb.htm#ref_440_7">Right_Side_Symbol</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_353_9">Attributed_Character</A> := <A HREF="terminal_interface-curses__ads.htm#ref_372_4">Default_Character</A>; -+ <span class="symbol"><A NAME="ref_709_7" HREF="terminal_interface-curses__adb.htm#ref_441_7">Top_Side_Symbol</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_353_9">Attributed_Character</A> := <A HREF="terminal_interface-curses__ads.htm#ref_372_4">Default_Character</A>; -+ <span class="symbol"><A NAME="ref_710_7" HREF="terminal_interface-curses__adb.htm#ref_442_7">Bottom_Side_Symbol</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_353_9">Attributed_Character</A> := <A HREF="terminal_interface-curses__ads.htm#ref_372_4">Default_Character</A>; -+ <span class="symbol"><A NAME="ref_711_7" HREF="terminal_interface-curses__adb.htm#ref_443_7">Upper_Left_Corner_Symbol</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_353_9">Attributed_Character</A> := <A HREF="terminal_interface-curses__ads.htm#ref_372_4">Default_Character</A>; -+ <span class="symbol"><A NAME="ref_712_7" HREF="terminal_interface-curses__adb.htm#ref_444_7">Upper_Right_Corner_Symbol</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_353_9">Attributed_Character</A> := <A HREF="terminal_interface-curses__ads.htm#ref_372_4">Default_Character</A>; -+ <span class="symbol"><A NAME="ref_713_7" HREF="terminal_interface-curses__adb.htm#ref_445_7">Lower_Left_Corner_Symbol</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_353_9">Attributed_Character</A> := <A HREF="terminal_interface-curses__ads.htm#ref_372_4">Default_Character</A>; -+ <span class="symbol"><A NAME="ref_714_7" HREF="terminal_interface-curses__adb.htm#ref_446_7">Lower_Right_Corner_Symbol</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_353_9">Attributed_Character</A> := <A HREF="terminal_interface-curses__ads.htm#ref_372_4">Default_Character</A> - ); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_border.3x.html">wborder()</A></EM></FONT> -- <FONT COLOR=green><EM>-- AKA: border()</EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_706_14">Border</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_26"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_722_14" HREF="terminal_interface-curses__adb.htm#ref_474_14">Box</A></FONT> -- (<FONT COLOR=red><A NAME="ref_723_7" HREF="terminal_interface-curses__adb.htm#ref_475_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_724_7" HREF="terminal_interface-curses__adb.htm#ref_476_7">Vertical_Symbol</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_354_9">Attributed_Character</A> := <A HREF="terminal_interface-curses__ads.htm#ref_373_4">Default_Character</A>; -- <FONT COLOR=red><A NAME="ref_725_7" HREF="terminal_interface-curses__adb.htm#ref_477_7">Horizontal_Symbol</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_354_9">Attributed_Character</A> := <A HREF="terminal_interface-curses__ads.htm#ref_373_4">Default_Character</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_border.3x.html">box()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_722_14">Box</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_27"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_730_14" HREF="terminal_interface-curses__adb.htm#ref_485_14">Horizontal_Line</A></FONT> -- (<FONT COLOR=red><A NAME="ref_731_7" HREF="terminal_interface-curses__adb.htm#ref_486_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_732_7" HREF="terminal_interface-curses__adb.htm#ref_487_7">Line_Size</A></FONT> : Natural; -- <FONT COLOR=red><A NAME="ref_733_7" HREF="terminal_interface-curses__adb.htm#ref_488_7">Line_Symbol</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_354_9">Attributed_Character</A> := <A HREF="terminal_interface-curses__ads.htm#ref_373_4">Default_Character</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_border.3x.html">whline()</A></EM></FONT> -- <FONT COLOR=green><EM>-- AKA: hline()</EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_730_14">Horizontal_Line</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_28"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_739_14" HREF="terminal_interface-curses__adb.htm#ref_502_14">Vertical_Line</A></FONT> -- (<FONT COLOR=red><A NAME="ref_740_7" HREF="terminal_interface-curses__adb.htm#ref_503_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_741_7" HREF="terminal_interface-curses__adb.htm#ref_504_7">Line_Size</A></FONT> : Natural; -- <FONT COLOR=red><A NAME="ref_742_7" HREF="terminal_interface-curses__adb.htm#ref_505_7">Line_Symbol</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_354_9">Attributed_Character</A> := <A HREF="terminal_interface-curses__ads.htm#ref_373_4">Default_Character</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_border.3x.html">wvline()</A></EM></FONT> -- <FONT COLOR=green><EM>-- AKA: vline()</EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_739_14">Vertical_Line</A>); -- -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page <A HREF="../man/curs_getch.3x.html">curs_getch.3x</A></EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- Not implemented: mvgetch, mvwgetch</EM></FONT> -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_border.3x.html">wborder()</A></EM></span> -+ <span class="comment"><EM>-- AKA: border()</EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_705_14">Border</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_26"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_721_14" HREF="terminal_interface-curses__adb.htm#ref_474_14">Box</A></span> -+ (<span class="symbol"><A NAME="ref_722_7" HREF="terminal_interface-curses__adb.htm#ref_475_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_723_7" HREF="terminal_interface-curses__adb.htm#ref_476_7">Vertical_Symbol</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_353_9">Attributed_Character</A> := <A HREF="terminal_interface-curses__ads.htm#ref_372_4">Default_Character</A>; -+ <span class="symbol"><A NAME="ref_724_7" HREF="terminal_interface-curses__adb.htm#ref_477_7">Horizontal_Symbol</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_353_9">Attributed_Character</A> := <A HREF="terminal_interface-curses__ads.htm#ref_372_4">Default_Character</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_border.3x.html">box()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_721_14">Box</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_27"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_729_14" HREF="terminal_interface-curses__adb.htm#ref_485_14">Horizontal_Line</A></span> -+ (<span class="symbol"><A NAME="ref_730_7" HREF="terminal_interface-curses__adb.htm#ref_486_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_731_7" HREF="terminal_interface-curses__adb.htm#ref_487_7">Line_Size</A></span> : Natural; -+ <span class="symbol"><A NAME="ref_732_7" HREF="terminal_interface-curses__adb.htm#ref_488_7">Line_Symbol</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_353_9">Attributed_Character</A> := <A HREF="terminal_interface-curses__ads.htm#ref_372_4">Default_Character</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_border.3x.html">whline()</A></EM></span> -+ <span class="comment"><EM>-- AKA: hline()</EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_729_14">Horizontal_Line</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_28"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_738_14" HREF="terminal_interface-curses__adb.htm#ref_502_14">Vertical_Line</A></span> -+ (<span class="symbol"><A NAME="ref_739_7" HREF="terminal_interface-curses__adb.htm#ref_503_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_740_7" HREF="terminal_interface-curses__adb.htm#ref_504_7">Line_Size</A></span> : Natural; -+ <span class="symbol"><A NAME="ref_741_7" HREF="terminal_interface-curses__adb.htm#ref_505_7">Line_Symbol</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_353_9">Attributed_Character</A> := <A HREF="terminal_interface-curses__ads.htm#ref_372_4">Default_Character</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_border.3x.html">wvline()</A></EM></span> -+ <span class="comment"><EM>-- AKA: vline()</EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_738_14">Vertical_Line</A>); -+ -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page <A HREF="../man/curs_getch.3x.html">curs_getch.3x</A></EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- Not implemented: mvgetch, mvwgetch</EM></span> - -- <FONT COLOR=green><EM>-- #1A NAME="AFU_29"#2|</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_753_13" HREF="terminal_interface-curses__adb.htm#ref_520_13">Get_Keystroke</A></FONT> (<FONT COLOR=red><A NAME="ref_753_28" HREF="terminal_interface-curses__adb.htm#ref_520_28">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>) -+ <span class="comment"><EM>-- #1A NAME="AFU_29"#2|</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_752_13" HREF="terminal_interface-curses__adb.htm#ref_520_13">Get_Keystroke</A></span> (<span class="symbol"><A NAME="ref_752_28" HREF="terminal_interface-curses__adb.htm#ref_520_28">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>) - <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_73_12">Real_Key_Code</A>; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_getch.3x.html">wgetch()</A></EM></FONT> -- <FONT COLOR=green><EM>-- AKA: getch()</EM></FONT> -- <FONT COLOR=green><EM>-- Get a character from the keyboard and echo it - if enabled - to the</EM></FONT> -- <FONT COLOR=green><EM>-- window.</EM></FONT> -- <FONT COLOR=green><EM>-- If for any reason (i.e. a timeout) we could not get a character the</EM></FONT> -- <FONT COLOR=green><EM>-- returned keycode is Key_None.</EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_753_13">Get_Keystroke</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_30"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_764_14" HREF="terminal_interface-curses__adb.htm#ref_535_14">Undo_Keystroke</A></FONT> (<FONT COLOR=red><A NAME="ref_764_30" HREF="terminal_interface-curses__adb.htm#ref_535_30">Key</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_73_12">Real_Key_Code</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_getch.3x.html">ungetch()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_764_14">Undo_Keystroke</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_31"#2|</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_769_13" HREF="terminal_interface-curses__adb.htm#ref_545_13">Has_Key</A></FONT> (<FONT COLOR=red><A NAME="ref_769_22" HREF="terminal_interface-curses__adb.htm#ref_545_22">Key</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A>) <b>return</b> Boolean; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_getch.3x.html">has_key()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_769_13">Has_Key</A>); -- -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- | Some helper functions</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_776_13" HREF="terminal_interface-curses__adb.htm#ref_557_13">Is_Function_Key</A></FONT> (<FONT COLOR=red><A NAME="ref_776_30" HREF="terminal_interface-curses__adb.htm#ref_557_30">Key</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A>) <b>return</b> Boolean; -- <FONT COLOR=green><EM>-- Return True if the Key is a function key (i.e. one of F0 .. F63)</EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_776_13">Is_Function_Key</A>); -- -- <b>subtype</b> <FONT COLOR=red><A NAME="ref_780_12">Function_Key_Number</A></FONT> <b>is</b> Integer <b>range</b> 0 .. 63; -- <FONT COLOR=green><EM>-- (n)curses allows for 64 function keys.</EM></FONT> -- -- <b>function</b> <FONT COLOR=red><A NAME="ref_783_13" HREF="terminal_interface-curses__adb.htm#ref_569_13">Function_Key</A></FONT> (<FONT COLOR=red><A NAME="ref_783_27" HREF="terminal_interface-curses__adb.htm#ref_569_27">Key</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_73_12">Real_Key_Code</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_780_12">Function_Key_Number</A>; -- <FONT COLOR=green><EM>-- Return the number of the function key. If the code is not a</EM></FONT> -- <FONT COLOR=green><EM>-- function key, a CONSTRAINT_ERROR will be raised.</EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_783_13">Function_Key</A>); -- -- <b>function</b> <FONT COLOR=red><A NAME="ref_788_13" HREF="terminal_interface-curses__adb.htm#ref_580_13">Function_Key_Code</A></FONT> (<FONT COLOR=red><A NAME="ref_788_32" HREF="terminal_interface-curses__adb.htm#ref_580_32">Key</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_780_12">Function_Key_Number</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_73_12">Real_Key_Code</A>; -- <FONT COLOR=green><EM>-- Return the key code for a given function-key number.</EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_788_13">Function_Key_Code</A>); -- -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page <A HREF="../man/curs_attr.3x.html">curs_attr.3x</A></EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Not implemented attr_off, wattr_off,</EM></FONT> -- <FONT COLOR=green><EM>-- | attr_on, wattr_on, attr_set, wattr_set</EM></FONT> -- -- <FONT COLOR=green><EM>-- PAIR_NUMBER</EM></FONT> -- <FONT COLOR=green><EM>-- PAIR_NUMBER(c) is the same as c.Color</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_32"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_802_14" HREF="terminal_interface-curses__adb.htm#ref_586_14">Standout</A></FONT> (<FONT COLOR=red><A NAME="ref_802_24" HREF="terminal_interface-curses__adb.htm#ref_586_24">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_803_24" HREF="terminal_interface-curses__adb.htm#ref_587_24">On</A></FONT> : Boolean := True); -- <FONT COLOR=green><EM>-- AKA: wstandout()</EM></FONT> -- <FONT COLOR=green><EM>-- AKA: wstandend()</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_33"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_808_14" HREF="terminal_interface-curses__adb.htm#ref_606_14">Switch_Character_Attribute</A></FONT> -- (<FONT COLOR=red><A NAME="ref_809_7" HREF="terminal_interface-curses__adb.htm#ref_607_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_810_7" HREF="terminal_interface-curses__adb.htm#ref_608_7">Attr</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A> := <A HREF="terminal_interface-curses__ads.htm#ref_352_4">Normal_Video</A>; -- <FONT COLOR=red><A NAME="ref_811_7" HREF="terminal_interface-curses__adb.htm#ref_609_7">On</A></FONT> : Boolean := True); <FONT COLOR=green><EM>-- if False we switch Off.</EM></FONT> -- <FONT COLOR=green><EM>-- Switches those Attributes set to true in the list.</EM></FONT> -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_attr.3x.html">wattron()</A></EM></FONT> -- <FONT COLOR=green><EM>-- AKA: wattroff()</EM></FONT> -- <FONT COLOR=green><EM>-- AKA: attron()</EM></FONT> -- <FONT COLOR=green><EM>-- AKA: attroff()</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_34"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_819_14" HREF="terminal_interface-curses__adb.htm#ref_634_14">Set_Character_Attributes</A></FONT> -- (<FONT COLOR=red><A NAME="ref_820_7" HREF="terminal_interface-curses__adb.htm#ref_635_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_821_7" HREF="terminal_interface-curses__adb.htm#ref_636_7">Attr</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A> := <A HREF="terminal_interface-curses__ads.htm#ref_352_4">Normal_Video</A>; -- <FONT COLOR=red><A NAME="ref_822_7" HREF="terminal_interface-curses__adb.htm#ref_637_7">Color</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A> := <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>'First); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_attr.3x.html">wattrset()</A></EM></FONT> -- <FONT COLOR=green><EM>-- AKA: attrset()</EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_819_14">Set_Character_Attributes</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_35"#2|</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_828_13" HREF="terminal_interface-curses__adb.htm#ref_652_13">Get_Character_Attribute</A></FONT> -- (<FONT COLOR=red><A NAME="ref_829_7" HREF="terminal_interface-curses__adb.htm#ref_652_38">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A>; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_attr.3x.html">wattr_get()</A></EM></FONT> -- <FONT COLOR=green><EM>-- AKA: attr_get()</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_36"#2|</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_834_13" HREF="terminal_interface-curses__adb.htm#ref_675_13">Get_Character_Attribute</A></FONT> -- (<FONT COLOR=red><A NAME="ref_835_7" HREF="terminal_interface-curses__adb.htm#ref_675_38">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_attr.3x.html">wattr_get()</A></EM></FONT> -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_getch.3x.html">wgetch()</A></EM></span> -+ <span class="comment"><EM>-- AKA: getch()</EM></span> -+ <span class="comment"><EM>-- Get a character from the keyboard and echo it - if enabled - to the</EM></span> -+ <span class="comment"><EM>-- window.</EM></span> -+ <span class="comment"><EM>-- If for any reason (i.e. a timeout) we could not get a character the</EM></span> -+ <span class="comment"><EM>-- returned keycode is Key_None.</EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_752_13">Get_Keystroke</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_30"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_763_14" HREF="terminal_interface-curses__adb.htm#ref_535_14">Undo_Keystroke</A></span> (<span class="symbol"><A NAME="ref_763_30" HREF="terminal_interface-curses__adb.htm#ref_535_30">Key</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_73_12">Real_Key_Code</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_getch.3x.html">ungetch()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_763_14">Undo_Keystroke</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_31"#2|</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_768_13" HREF="terminal_interface-curses__adb.htm#ref_545_13">Has_Key</A></span> (<span class="symbol"><A NAME="ref_768_22" HREF="terminal_interface-curses__adb.htm#ref_545_22">Key</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A>) <b>return</b> Boolean; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_getch.3x.html">has_key()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_768_13">Has_Key</A>); -+ -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- | Some helper functions</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_775_13" HREF="terminal_interface-curses__adb.htm#ref_557_13">Is_Function_Key</A></span> (<span class="symbol"><A NAME="ref_775_30" HREF="terminal_interface-curses__adb.htm#ref_557_30">Key</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A>) <b>return</b> Boolean; -+ <span class="comment"><EM>-- Return True if the Key is a function key (i.e. one of F0 .. F63)</EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_775_13">Is_Function_Key</A>); -+ -+ <b>subtype</b> <span class="symbol"><A NAME="ref_779_12">Function_Key_Number</A></span> <b>is</b> Integer <b>range</b> 0 .. 63; -+ <span class="comment"><EM>-- (n)curses allows for 64 function keys.</EM></span> -+ -+ <b>function</b> <span class="symbol"><A NAME="ref_782_13" HREF="terminal_interface-curses__adb.htm#ref_569_13">Function_Key</A></span> (<span class="symbol"><A NAME="ref_782_27" HREF="terminal_interface-curses__adb.htm#ref_569_27">Key</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_73_12">Real_Key_Code</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_779_12">Function_Key_Number</A>; -+ <span class="comment"><EM>-- Return the number of the function key. If the code is not a</EM></span> -+ <span class="comment"><EM>-- function key, a CONSTRAINT_ERROR will be raised.</EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_782_13">Function_Key</A>); -+ -+ <b>function</b> <span class="symbol"><A NAME="ref_787_13" HREF="terminal_interface-curses__adb.htm#ref_580_13">Function_Key_Code</A></span> (<span class="symbol"><A NAME="ref_787_32" HREF="terminal_interface-curses__adb.htm#ref_580_32">Key</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_779_12">Function_Key_Number</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_73_12">Real_Key_Code</A>; -+ <span class="comment"><EM>-- Return the key code for a given function-key number.</EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_787_13">Function_Key_Code</A>); -+ -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page <A HREF="../man/curs_attr.3x.html">curs_attr.3x</A></EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Not implemented attr_off, wattr_off,</EM></span> -+ <span class="comment"><EM>-- | attr_on, wattr_on, attr_set, wattr_set</EM></span> -+ -+ <span class="comment"><EM>-- PAIR_NUMBER</EM></span> -+ <span class="comment"><EM>-- PAIR_NUMBER(c) is the same as c.Color</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_32"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_801_14" HREF="terminal_interface-curses__adb.htm#ref_586_14">Standout</A></span> (<span class="symbol"><A NAME="ref_801_24" HREF="terminal_interface-curses__adb.htm#ref_586_24">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_802_24" HREF="terminal_interface-curses__adb.htm#ref_587_24">On</A></span> : Boolean := True); -+ <span class="comment"><EM>-- AKA: wstandout()</EM></span> -+ <span class="comment"><EM>-- AKA: wstandend()</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_33"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_807_14" HREF="terminal_interface-curses__adb.htm#ref_606_14">Switch_Character_Attribute</A></span> -+ (<span class="symbol"><A NAME="ref_808_7" HREF="terminal_interface-curses__adb.htm#ref_607_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_809_7" HREF="terminal_interface-curses__adb.htm#ref_608_7">Attr</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A> := <A HREF="terminal_interface-curses__ads.htm#ref_351_4">Normal_Video</A>; -+ <span class="symbol"><A NAME="ref_810_7" HREF="terminal_interface-curses__adb.htm#ref_609_7">On</A></span> : Boolean := True); <span class="comment"><EM>-- if False we switch Off.</EM></span> -+ <span class="comment"><EM>-- Switches those Attributes set to true in the list.</EM></span> -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_attr.3x.html">wattron()</A></EM></span> -+ <span class="comment"><EM>-- AKA: wattroff()</EM></span> -+ <span class="comment"><EM>-- AKA: attron()</EM></span> -+ <span class="comment"><EM>-- AKA: attroff()</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_34"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_818_14" HREF="terminal_interface-curses__adb.htm#ref_634_14">Set_Character_Attributes</A></span> -+ (<span class="symbol"><A NAME="ref_819_7" HREF="terminal_interface-curses__adb.htm#ref_635_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_820_7" HREF="terminal_interface-curses__adb.htm#ref_636_7">Attr</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A> := <A HREF="terminal_interface-curses__ads.htm#ref_351_4">Normal_Video</A>; -+ <span class="symbol"><A NAME="ref_821_7" HREF="terminal_interface-curses__adb.htm#ref_637_7">Color</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A> := <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>'First); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_attr.3x.html">wattrset()</A></EM></span> -+ <span class="comment"><EM>-- AKA: attrset()</EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_818_14">Set_Character_Attributes</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_35"#2|</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_827_13" HREF="terminal_interface-curses__adb.htm#ref_652_13">Get_Character_Attribute</A></span> -+ (<span class="symbol"><A NAME="ref_828_7" HREF="terminal_interface-curses__adb.htm#ref_652_38">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A>; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_attr.3x.html">wattr_get()</A></EM></span> -+ <span class="comment"><EM>-- AKA: attr_get()</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_36"#2|</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_833_13" HREF="terminal_interface-curses__adb.htm#ref_675_13">Get_Character_Attribute</A></span> -+ (<span class="symbol"><A NAME="ref_834_7" HREF="terminal_interface-curses__adb.htm#ref_675_38">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_attr.3x.html">wattr_get()</A></EM></span> - <b>pragma</b> Inline (Get_Character_Attribute); - -- <FONT COLOR=green><EM>-- #1A NAME="AFU_37"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_840_14" HREF="terminal_interface-curses__adb.htm#ref_698_14">Set_Color</A></FONT> (<FONT COLOR=red><A NAME="ref_840_25" HREF="terminal_interface-curses__adb.htm#ref_698_25">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_841_25" HREF="terminal_interface-curses__adb.htm#ref_699_25">Pair</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_attr.3x.html">wcolor_set()</A></EM></FONT> -- <FONT COLOR=green><EM>-- AKA: color_set()</EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_840_14">Set_Color</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_38"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_847_14" HREF="terminal_interface-curses__adb.htm#ref_713_14">Change_Attributes</A></FONT> -- (<FONT COLOR=red><A NAME="ref_848_7" HREF="terminal_interface-curses__adb.htm#ref_714_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_849_7" HREF="terminal_interface-curses__adb.htm#ref_715_7">Count</A></FONT> : Integer := -1; -- <FONT COLOR=red><A NAME="ref_850_7" HREF="terminal_interface-curses__adb.htm#ref_716_7">Attr</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A> := <A HREF="terminal_interface-curses__ads.htm#ref_352_4">Normal_Video</A>; -- <FONT COLOR=red><A NAME="ref_851_7" HREF="terminal_interface-curses__adb.htm#ref_717_7">Color</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A> := <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>'First); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_attr.3x.html">wchgat()</A></EM></FONT> -- <FONT COLOR=green><EM>-- AKA: chgat()</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_39"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_856_14" HREF="terminal_interface-curses__adb.htm#ref_736_14">Change_Attributes</A></FONT> -- (<FONT COLOR=red><A NAME="ref_857_7" HREF="terminal_interface-curses__adb.htm#ref_737_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_858_7" HREF="terminal_interface-curses__adb.htm#ref_738_7">Line</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A> := <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>'First; -- <FONT COLOR=red><A NAME="ref_859_7" HREF="terminal_interface-curses__adb.htm#ref_739_7">Column</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A> := <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>'First; -- <FONT COLOR=red><A NAME="ref_860_7" HREF="terminal_interface-curses__adb.htm#ref_740_7">Count</A></FONT> : Integer := -1; -- <FONT COLOR=red><A NAME="ref_861_7" HREF="terminal_interface-curses__adb.htm#ref_741_7">Attr</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A> := <A HREF="terminal_interface-curses__ads.htm#ref_352_4">Normal_Video</A>; -- <FONT COLOR=red><A NAME="ref_862_7" HREF="terminal_interface-curses__adb.htm#ref_742_7">Color</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A> := <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>'First); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_attr.3x.html">mvwchgat()</A></EM></FONT> -- <FONT COLOR=green><EM>-- AKA: mvchgat()</EM></FONT> -+ <span class="comment"><EM>-- #1A NAME="AFU_37"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_839_14" HREF="terminal_interface-curses__adb.htm#ref_698_14">Set_Color</A></span> (<span class="symbol"><A NAME="ref_839_25" HREF="terminal_interface-curses__adb.htm#ref_698_25">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_840_25" HREF="terminal_interface-curses__adb.htm#ref_699_25">Pair</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_attr.3x.html">wcolor_set()</A></EM></span> -+ <span class="comment"><EM>-- AKA: color_set()</EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_839_14">Set_Color</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_38"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_846_14" HREF="terminal_interface-curses__adb.htm#ref_713_14">Change_Attributes</A></span> -+ (<span class="symbol"><A NAME="ref_847_7" HREF="terminal_interface-curses__adb.htm#ref_714_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_848_7" HREF="terminal_interface-curses__adb.htm#ref_715_7">Count</A></span> : Integer := -1; -+ <span class="symbol"><A NAME="ref_849_7" HREF="terminal_interface-curses__adb.htm#ref_716_7">Attr</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A> := <A HREF="terminal_interface-curses__ads.htm#ref_351_4">Normal_Video</A>; -+ <span class="symbol"><A NAME="ref_850_7" HREF="terminal_interface-curses__adb.htm#ref_717_7">Color</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A> := <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>'First); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_attr.3x.html">wchgat()</A></EM></span> -+ <span class="comment"><EM>-- AKA: chgat()</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_39"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_855_14" HREF="terminal_interface-curses__adb.htm#ref_736_14">Change_Attributes</A></span> -+ (<span class="symbol"><A NAME="ref_856_7" HREF="terminal_interface-curses__adb.htm#ref_737_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_857_7" HREF="terminal_interface-curses__adb.htm#ref_738_7">Line</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A> := <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>'First; -+ <span class="symbol"><A NAME="ref_858_7" HREF="terminal_interface-curses__adb.htm#ref_739_7">Column</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A> := <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>'First; -+ <span class="symbol"><A NAME="ref_859_7" HREF="terminal_interface-curses__adb.htm#ref_740_7">Count</A></span> : Integer := -1; -+ <span class="symbol"><A NAME="ref_860_7" HREF="terminal_interface-curses__adb.htm#ref_741_7">Attr</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A> := <A HREF="terminal_interface-curses__ads.htm#ref_351_4">Normal_Video</A>; -+ <span class="symbol"><A NAME="ref_861_7" HREF="terminal_interface-curses__adb.htm#ref_742_7">Color</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A> := <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>'First); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_attr.3x.html">mvwchgat()</A></EM></span> -+ <span class="comment"><EM>-- AKA: mvchgat()</EM></span> - <b>pragma</b> Inline (Change_Attributes); - -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page <A HREF="../man/curs_beep.3x.html">curs_beep.3x</A></EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_40"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_872_14" HREF="terminal_interface-curses__adb.htm#ref_749_14">Beep</A></FONT>; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_beep.3x.html">beep()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_872_14">Beep</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_41"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_877_14" HREF="terminal_interface-curses__adb.htm#ref_759_14">Flash_Screen</A></FONT>; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_beep.3x.html">flash()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_877_14">Flash_Screen</A>); -- -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page <A HREF="../man/curs_inopts.3x.html">curs_inopts.3x</A></EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- -- <FONT COLOR=green><EM>-- | Not implemented : typeahead</EM></FONT> -- <FONT COLOR=green><EM>--</EM></FONT> -- <FONT COLOR=green><EM>-- #1A NAME="AFU_42"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_888_14" HREF="terminal_interface-curses__adb.htm#ref_769_14">Set_Cbreak_Mode</A></FONT> (<FONT COLOR=red><A NAME="ref_888_31" HREF="terminal_interface-curses__adb.htm#ref_769_31">SwitchOn</A></FONT> : Boolean := True); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_inopts.3x.html">cbreak()</A></EM></FONT> -- <FONT COLOR=green><EM>-- AKA: nocbreak()</EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_888_14">Set_Cbreak_Mode</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_43"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_894_14" HREF="terminal_interface-curses__adb.htm#ref_788_14">Set_Raw_Mode</A></FONT> (<FONT COLOR=red><A NAME="ref_894_28" HREF="terminal_interface-curses__adb.htm#ref_788_28">SwitchOn</A></FONT> : Boolean := True); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_inopts.3x.html">raw()</A></EM></FONT> -- <FONT COLOR=green><EM>-- AKA: noraw()</EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_894_14">Set_Raw_Mode</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_44"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_900_14" HREF="terminal_interface-curses__adb.htm#ref_807_14">Set_Echo_Mode</A></FONT> (<FONT COLOR=red><A NAME="ref_900_29" HREF="terminal_interface-curses__adb.htm#ref_807_29">SwitchOn</A></FONT> : Boolean := True); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_inopts.3x.html">echo()</A></EM></FONT> -- <FONT COLOR=green><EM>-- AKA: noecho()</EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_900_14">Set_Echo_Mode</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_45"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_906_14" HREF="terminal_interface-curses__adb.htm#ref_826_14">Set_Meta_Mode</A></FONT> (<FONT COLOR=red><A NAME="ref_906_29" HREF="terminal_interface-curses__adb.htm#ref_826_29">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_907_29" HREF="terminal_interface-curses__adb.htm#ref_827_29">SwitchOn</A></FONT> : Boolean := True); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_inopts.3x.html">meta()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_906_14">Set_Meta_Mode</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_46"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_912_14" HREF="terminal_interface-curses__adb.htm#ref_837_14">Set_KeyPad_Mode</A></FONT> (<FONT COLOR=red><A NAME="ref_912_31" HREF="terminal_interface-curses__adb.htm#ref_837_31">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_913_31" HREF="terminal_interface-curses__adb.htm#ref_838_31">SwitchOn</A></FONT> : Boolean := True); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_inopts.3x.html">keypad()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_912_14">Set_KeyPad_Mode</A>); -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page <A HREF="../man/curs_beep.3x.html">curs_beep.3x</A></EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_40"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_871_14" HREF="terminal_interface-curses__adb.htm#ref_749_14">Beep</A></span>; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_beep.3x.html">beep()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_871_14">Beep</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_41"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_876_14" HREF="terminal_interface-curses__adb.htm#ref_759_14">Flash_Screen</A></span>; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_beep.3x.html">flash()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_876_14">Flash_Screen</A>); -+ -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page <A HREF="../man/curs_inopts.3x.html">curs_inopts.3x</A></EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ -+ <span class="comment"><EM>-- | Not implemented : typeahead</EM></span> -+ <span class="comment"><EM>--</EM></span> -+ <span class="comment"><EM>-- #1A NAME="AFU_42"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_887_14" HREF="terminal_interface-curses__adb.htm#ref_769_14">Set_Cbreak_Mode</A></span> (<span class="symbol"><A NAME="ref_887_31" HREF="terminal_interface-curses__adb.htm#ref_769_31">SwitchOn</A></span> : Boolean := True); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_inopts.3x.html">cbreak()</A></EM></span> -+ <span class="comment"><EM>-- AKA: nocbreak()</EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_887_14">Set_Cbreak_Mode</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_43"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_893_14" HREF="terminal_interface-curses__adb.htm#ref_788_14">Set_Raw_Mode</A></span> (<span class="symbol"><A NAME="ref_893_28" HREF="terminal_interface-curses__adb.htm#ref_788_28">SwitchOn</A></span> : Boolean := True); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_inopts.3x.html">raw()</A></EM></span> -+ <span class="comment"><EM>-- AKA: noraw()</EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_893_14">Set_Raw_Mode</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_44"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_899_14" HREF="terminal_interface-curses__adb.htm#ref_807_14">Set_Echo_Mode</A></span> (<span class="symbol"><A NAME="ref_899_29" HREF="terminal_interface-curses__adb.htm#ref_807_29">SwitchOn</A></span> : Boolean := True); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_inopts.3x.html">echo()</A></EM></span> -+ <span class="comment"><EM>-- AKA: noecho()</EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_899_14">Set_Echo_Mode</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_45"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_905_14" HREF="terminal_interface-curses__adb.htm#ref_826_14">Set_Meta_Mode</A></span> (<span class="symbol"><A NAME="ref_905_29" HREF="terminal_interface-curses__adb.htm#ref_826_29">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_906_29" HREF="terminal_interface-curses__adb.htm#ref_827_29">SwitchOn</A></span> : Boolean := True); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_inopts.3x.html">meta()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_905_14">Set_Meta_Mode</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_46"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_911_14" HREF="terminal_interface-curses__adb.htm#ref_837_14">Set_KeyPad_Mode</A></span> (<span class="symbol"><A NAME="ref_911_31" HREF="terminal_interface-curses__adb.htm#ref_837_31">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_912_31" HREF="terminal_interface-curses__adb.htm#ref_838_31">SwitchOn</A></span> : Boolean := True); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_inopts.3x.html">keypad()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_911_14">Set_KeyPad_Mode</A>); - -- <b>function</b> <FONT COLOR=red><A NAME="ref_917_13" HREF="terminal_interface-curses__adb.htm#ref_848_13">Get_KeyPad_Mode</A></FONT> (<FONT COLOR=red><A NAME="ref_917_30" HREF="terminal_interface-curses__adb.htm#ref_848_30">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>) -+ <b>function</b> <span class="symbol"><A NAME="ref_916_13" HREF="terminal_interface-curses__adb.htm#ref_848_13">Get_KeyPad_Mode</A></span> (<span class="symbol"><A NAME="ref_916_30" HREF="terminal_interface-curses__adb.htm#ref_848_30">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>) - <b>return</b> Boolean; -- <FONT COLOR=green><EM>-- This has no pendant in C. There you've to look into the WINDOWS</EM></FONT> -- <FONT COLOR=green><EM>-- structure to get the value. Bad practice, not repeated in Ada.</EM></FONT> -+ <span class="comment"><EM>-- This has no pendant in C. There you've to look into the WINDOWS</EM></span> -+ <span class="comment"><EM>-- structure to get the value. Bad practice, not repeated in Ada.</EM></span> - -- <b>type</b> <FONT COLOR=red><A NAME="ref_922_9">Half_Delay_Amount</A></FONT> <b>is</b> <b>range</b> 1 .. 255; -+ <b>type</b> <span class="symbol"><A NAME="ref_921_9">Half_Delay_Amount</A></span> <b>is</b> <b>range</b> 1 .. 255; - -- <FONT COLOR=green><EM>-- #1A NAME="AFU_47"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_925_14" HREF="terminal_interface-curses__adb.htm#ref_857_14">Half_Delay</A></FONT> (<FONT COLOR=red><A NAME="ref_925_26" HREF="terminal_interface-curses__adb.htm#ref_857_26">Amount</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_922_9">Half_Delay_Amount</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_inopts.3x.html">halfdelay()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_925_14">Half_Delay</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_48"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_930_14" HREF="terminal_interface-curses__adb.htm#ref_867_14">Set_Flush_On_Interrupt_Mode</A></FONT> -- (<FONT COLOR=red><A NAME="ref_931_7" HREF="terminal_interface-curses__adb.htm#ref_868_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_932_7" HREF="terminal_interface-curses__adb.htm#ref_869_7">Mode</A></FONT> : Boolean := True); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_inopts.3x.html">intrflush()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_930_14">Set_Flush_On_Interrupt_Mode</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_49"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_937_14" HREF="terminal_interface-curses__adb.htm#ref_879_14">Set_Queue_Interrupt_Mode</A></FONT> -- (<FONT COLOR=red><A NAME="ref_938_7" HREF="terminal_interface-curses__adb.htm#ref_880_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_939_7" HREF="terminal_interface-curses__adb.htm#ref_881_7">Flush</A></FONT> : Boolean := True); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_inopts.3x.html">qiflush()</A></EM></FONT> -- <FONT COLOR=green><EM>-- AKA: noqiflush()</EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_937_14">Set_Queue_Interrupt_Mode</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_50"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_945_14" HREF="terminal_interface-curses__adb.htm#ref_898_14">Set_NoDelay_Mode</A></FONT> -- (<FONT COLOR=red><A NAME="ref_946_7" HREF="terminal_interface-curses__adb.htm#ref_899_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_947_7" HREF="terminal_interface-curses__adb.htm#ref_900_7">Mode</A></FONT> : Boolean := False); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_inopts.3x.html">nodelay()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_945_14">Set_NoDelay_Mode</A>); -- -- <b>type</b> <FONT COLOR=red><A NAME="ref_951_9">Timeout_Mode</A></FONT> <b>is</b> (<FONT COLOR=red><A NAME="ref_951_26">Blocking</A></FONT>, <FONT COLOR=red><A NAME="ref_951_36">Non_Blocking</A></FONT>, <FONT COLOR=red><A NAME="ref_951_50">Delayed</A></FONT>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_51"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_954_14" HREF="terminal_interface-curses__adb.htm#ref_910_14">Set_Timeout_Mode</A></FONT> (<FONT COLOR=red><A NAME="ref_954_32" HREF="terminal_interface-curses__adb.htm#ref_910_32">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_955_32" HREF="terminal_interface-curses__adb.htm#ref_911_32">Mode</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_951_9">Timeout_Mode</A>; -- <FONT COLOR=red><A NAME="ref_956_32" HREF="terminal_interface-curses__adb.htm#ref_912_32">Amount</A></FONT> : Natural); <FONT COLOR=green><EM>-- in Milliseconds</EM></FONT> -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_inopts.3x.html">wtimeout()</A></EM></FONT> -- <FONT COLOR=green><EM>-- AKA: timeout()</EM></FONT> -- <FONT COLOR=green><EM>-- Instead of overloading the semantic of the sign of amount, we</EM></FONT> -- <FONT COLOR=green><EM>-- introduce the Timeout_Mode parameter. This should improve</EM></FONT> -- <FONT COLOR=green><EM>-- readability. For Blocking and Non_Blocking, the Amount is not</EM></FONT> -- <FONT COLOR=green><EM>-- evaluated.</EM></FONT> -- <FONT COLOR=green><EM>-- We do not inline this procedure.</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_52"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_966_14" HREF="terminal_interface-curses__adb.htm#ref_931_14">Set_Escape_Timer_Mode</A></FONT> -- (<FONT COLOR=red><A NAME="ref_967_7" HREF="terminal_interface-curses__adb.htm#ref_932_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_968_7" HREF="terminal_interface-curses__adb.htm#ref_933_7">Timer_Off</A></FONT> : Boolean := False); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_inopts.3x.html">notimeout()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_966_14">Set_Escape_Timer_Mode</A>); -- -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page <A HREF="../man/curs_outopts.3x.html">curs_outopts.3x</A></EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_53"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_977_14" HREF="terminal_interface-curses__adb.htm#ref_945_14">Set_NL_Mode</A></FONT> (<FONT COLOR=red><A NAME="ref_977_27" HREF="terminal_interface-curses__adb.htm#ref_945_27">SwitchOn</A></FONT> : Boolean := True); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_outopts.3x.html">nl()</A></EM></FONT> -- <FONT COLOR=green><EM>-- AKA: nonl()</EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_977_14">Set_NL_Mode</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_54"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_983_14" HREF="terminal_interface-curses__adb.htm#ref_964_14">Clear_On_Next_Update</A></FONT> -- (<FONT COLOR=red><A NAME="ref_984_7" HREF="terminal_interface-curses__adb.htm#ref_965_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_985_7" HREF="terminal_interface-curses__adb.htm#ref_966_7">Do_Clear</A></FONT> : Boolean := True); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_outopts.3x.html">clearok()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_983_14">Clear_On_Next_Update</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_55"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_990_14" HREF="terminal_interface-curses__adb.htm#ref_976_14">Use_Insert_Delete_Line</A></FONT> -- (<FONT COLOR=red><A NAME="ref_991_7" HREF="terminal_interface-curses__adb.htm#ref_977_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_992_7" HREF="terminal_interface-curses__adb.htm#ref_978_7">Do_Idl</A></FONT> : Boolean := True); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_outopts.3x.html">idlok()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_990_14">Use_Insert_Delete_Line</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_56"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_997_14" HREF="terminal_interface-curses__adb.htm#ref_988_14">Use_Insert_Delete_Character</A></FONT> -- (<FONT COLOR=red><A NAME="ref_998_7" HREF="terminal_interface-curses__adb.htm#ref_989_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_999_7" HREF="terminal_interface-curses__adb.htm#ref_990_7">Do_Idc</A></FONT> : Boolean := True); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_outopts.3x.html">idcok()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_997_14">Use_Insert_Delete_Character</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_57"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1004_14" HREF="terminal_interface-curses__adb.htm#ref_998_14">Leave_Cursor_After_Update</A></FONT> -- (<FONT COLOR=red><A NAME="ref_1005_7" HREF="terminal_interface-curses__adb.htm#ref_999_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_1006_7" HREF="terminal_interface-curses__adb.htm#ref_1000_7">Do_Leave</A></FONT> : Boolean := True); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_outopts.3x.html">leaveok()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1004_14">Leave_Cursor_After_Update</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_58"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1011_14" HREF="terminal_interface-curses__adb.htm#ref_1010_14">Immediate_Update_Mode</A></FONT> -- (<FONT COLOR=red><A NAME="ref_1012_7" HREF="terminal_interface-curses__adb.htm#ref_1011_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_1013_7" HREF="terminal_interface-curses__adb.htm#ref_1012_7">Mode</A></FONT> : Boolean := False); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_outopts.3x.html">immedok()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1011_14">Immediate_Update_Mode</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_59"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1018_14" HREF="terminal_interface-curses__adb.htm#ref_1020_14">Allow_Scrolling</A></FONT> -- (<FONT COLOR=red><A NAME="ref_1019_7" HREF="terminal_interface-curses__adb.htm#ref_1021_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_1020_7" HREF="terminal_interface-curses__adb.htm#ref_1022_7">Mode</A></FONT> : Boolean := False); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_outopts.3x.html">scrollok()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1018_14">Allow_Scrolling</A>); -- -- <b>function</b> <FONT COLOR=red><A NAME="ref_1024_13" HREF="terminal_interface-curses__adb.htm#ref_1032_13">Scrolling_Allowed</A></FONT> (<FONT COLOR=red><A NAME="ref_1024_32" HREF="terminal_interface-curses__adb.htm#ref_1032_32">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>) <b>return</b> Boolean; -- <FONT COLOR=green><EM>-- There is no such function in the C interface.</EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1024_13">Scrolling_Allowed</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_60"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1029_14" HREF="terminal_interface-curses__adb.htm#ref_1041_14">Set_Scroll_Region</A></FONT> -- (<FONT COLOR=red><A NAME="ref_1030_7" HREF="terminal_interface-curses__adb.htm#ref_1042_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_1031_7" HREF="terminal_interface-curses__adb.htm#ref_1043_7">Top_Line</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_1032_7" HREF="terminal_interface-curses__adb.htm#ref_1044_7">Bottom_Line</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_outopts.3x.html">wsetscrreg()</A></EM></FONT> -- <FONT COLOR=green><EM>-- AKA: setscrreg()</EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1029_14">Set_Scroll_Region</A>); -- -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page <A HREF="../man/curs_refresh.3x.html">curs_refresh.3x</A></EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_61"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1042_14" HREF="terminal_interface-curses__adb.htm#ref_1057_14">Update_Screen</A></FONT>; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_refresh.3x.html">doupdate()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1042_14">Update_Screen</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_62"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1047_14" HREF="terminal_interface-curses__adb.htm#ref_1067_14">Refresh</A></FONT> (<FONT COLOR=red><A NAME="ref_1047_23" HREF="terminal_interface-curses__adb.htm#ref_1067_23">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_refresh.3x.html">wrefresh()</A></EM></FONT> -- <FONT COLOR=green><EM>-- There is an overloaded Refresh for Pads.</EM></FONT> -- <FONT COLOR=green><EM>-- The Inline pragma appears there</EM></FONT> -- <FONT COLOR=green><EM>-- AKA: refresh()</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_63"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1054_14" HREF="terminal_interface-curses__adb.htm#ref_1077_14">Refresh_Without_Update</A></FONT> -- (<FONT COLOR=red><A NAME="ref_1055_7" HREF="terminal_interface-curses__adb.htm#ref_1078_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_refresh.3x.html">wnoutrefresh()</A></EM></FONT> -- <FONT COLOR=green><EM>-- There is an overloaded Refresh_Without_Update for Pads.</EM></FONT> -- <FONT COLOR=green><EM>-- The Inline pragma appears there</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_64"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1061_14" HREF="terminal_interface-curses__adb.htm#ref_1088_14">Redraw</A></FONT> (<FONT COLOR=red><A NAME="ref_1061_22" HREF="terminal_interface-curses__adb.htm#ref_1088_22">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_refresh.3x.html">redrawwin()</A></EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_65"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1065_14" HREF="terminal_interface-curses__adb.htm#ref_1098_14">Redraw</A></FONT> (<FONT COLOR=red><A NAME="ref_1065_22" HREF="terminal_interface-curses__adb.htm#ref_1099_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_1066_22" HREF="terminal_interface-curses__adb.htm#ref_1100_7">Begin_Line</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_1067_22" HREF="terminal_interface-curses__adb.htm#ref_1101_7">Line_Count</A></FONT> : Positive); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_refresh.3x.html">wredrawln()</A></EM></FONT> -+ <span class="comment"><EM>-- #1A NAME="AFU_47"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_924_14" HREF="terminal_interface-curses__adb.htm#ref_857_14">Half_Delay</A></span> (<span class="symbol"><A NAME="ref_924_26" HREF="terminal_interface-curses__adb.htm#ref_857_26">Amount</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_921_9">Half_Delay_Amount</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_inopts.3x.html">halfdelay()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_924_14">Half_Delay</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_48"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_929_14" HREF="terminal_interface-curses__adb.htm#ref_867_14">Set_Flush_On_Interrupt_Mode</A></span> -+ (<span class="symbol"><A NAME="ref_930_7" HREF="terminal_interface-curses__adb.htm#ref_868_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_931_7" HREF="terminal_interface-curses__adb.htm#ref_869_7">Mode</A></span> : Boolean := True); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_inopts.3x.html">intrflush()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_929_14">Set_Flush_On_Interrupt_Mode</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_49"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_936_14" HREF="terminal_interface-curses__adb.htm#ref_879_14">Set_Queue_Interrupt_Mode</A></span> -+ (<span class="symbol"><A NAME="ref_937_7" HREF="terminal_interface-curses__adb.htm#ref_880_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_938_7" HREF="terminal_interface-curses__adb.htm#ref_881_7">Flush</A></span> : Boolean := True); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_inopts.3x.html">qiflush()</A></EM></span> -+ <span class="comment"><EM>-- AKA: noqiflush()</EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_936_14">Set_Queue_Interrupt_Mode</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_50"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_944_14" HREF="terminal_interface-curses__adb.htm#ref_898_14">Set_NoDelay_Mode</A></span> -+ (<span class="symbol"><A NAME="ref_945_7" HREF="terminal_interface-curses__adb.htm#ref_899_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_946_7" HREF="terminal_interface-curses__adb.htm#ref_900_7">Mode</A></span> : Boolean := False); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_inopts.3x.html">nodelay()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_944_14">Set_NoDelay_Mode</A>); -+ -+ <b>type</b> <span class="symbol"><A NAME="ref_950_9">Timeout_Mode</A></span> <b>is</b> (<span class="symbol"><A NAME="ref_950_26">Blocking</A></span>, <span class="symbol"><A NAME="ref_950_36">Non_Blocking</A></span>, <span class="symbol"><A NAME="ref_950_50">Delayed</A></span>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_51"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_953_14" HREF="terminal_interface-curses__adb.htm#ref_910_14">Set_Timeout_Mode</A></span> (<span class="symbol"><A NAME="ref_953_32" HREF="terminal_interface-curses__adb.htm#ref_910_32">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_954_32" HREF="terminal_interface-curses__adb.htm#ref_911_32">Mode</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_950_9">Timeout_Mode</A>; -+ <span class="symbol"><A NAME="ref_955_32" HREF="terminal_interface-curses__adb.htm#ref_912_32">Amount</A></span> : Natural); <span class="comment"><EM>-- in Milliseconds</EM></span> -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_inopts.3x.html">wtimeout()</A></EM></span> -+ <span class="comment"><EM>-- AKA: timeout()</EM></span> -+ <span class="comment"><EM>-- Instead of overloading the semantic of the sign of amount, we</EM></span> -+ <span class="comment"><EM>-- introduce the Timeout_Mode parameter. This should improve</EM></span> -+ <span class="comment"><EM>-- readability. For Blocking and Non_Blocking, the Amount is not</EM></span> -+ <span class="comment"><EM>-- evaluated.</EM></span> -+ <span class="comment"><EM>-- We do not inline this procedure.</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_52"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_965_14" HREF="terminal_interface-curses__adb.htm#ref_931_14">Set_Escape_Timer_Mode</A></span> -+ (<span class="symbol"><A NAME="ref_966_7" HREF="terminal_interface-curses__adb.htm#ref_932_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_967_7" HREF="terminal_interface-curses__adb.htm#ref_933_7">Timer_Off</A></span> : Boolean := False); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_inopts.3x.html">notimeout()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_965_14">Set_Escape_Timer_Mode</A>); -+ -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page <A HREF="../man/curs_outopts.3x.html">curs_outopts.3x</A></EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_53"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_976_14" HREF="terminal_interface-curses__adb.htm#ref_945_14">Set_NL_Mode</A></span> (<span class="symbol"><A NAME="ref_976_27" HREF="terminal_interface-curses__adb.htm#ref_945_27">SwitchOn</A></span> : Boolean := True); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_outopts.3x.html">nl()</A></EM></span> -+ <span class="comment"><EM>-- AKA: nonl()</EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_976_14">Set_NL_Mode</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_54"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_982_14" HREF="terminal_interface-curses__adb.htm#ref_964_14">Clear_On_Next_Update</A></span> -+ (<span class="symbol"><A NAME="ref_983_7" HREF="terminal_interface-curses__adb.htm#ref_965_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_984_7" HREF="terminal_interface-curses__adb.htm#ref_966_7">Do_Clear</A></span> : Boolean := True); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_outopts.3x.html">clearok()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_982_14">Clear_On_Next_Update</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_55"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_989_14" HREF="terminal_interface-curses__adb.htm#ref_976_14">Use_Insert_Delete_Line</A></span> -+ (<span class="symbol"><A NAME="ref_990_7" HREF="terminal_interface-curses__adb.htm#ref_977_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_991_7" HREF="terminal_interface-curses__adb.htm#ref_978_7">Do_Idl</A></span> : Boolean := True); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_outopts.3x.html">idlok()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_989_14">Use_Insert_Delete_Line</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_56"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_996_14" HREF="terminal_interface-curses__adb.htm#ref_988_14">Use_Insert_Delete_Character</A></span> -+ (<span class="symbol"><A NAME="ref_997_7" HREF="terminal_interface-curses__adb.htm#ref_989_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_998_7" HREF="terminal_interface-curses__adb.htm#ref_990_7">Do_Idc</A></span> : Boolean := True); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_outopts.3x.html">idcok()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_996_14">Use_Insert_Delete_Character</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_57"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1003_14" HREF="terminal_interface-curses__adb.htm#ref_998_14">Leave_Cursor_After_Update</A></span> -+ (<span class="symbol"><A NAME="ref_1004_7" HREF="terminal_interface-curses__adb.htm#ref_999_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_1005_7" HREF="terminal_interface-curses__adb.htm#ref_1000_7">Do_Leave</A></span> : Boolean := True); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_outopts.3x.html">leaveok()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1003_14">Leave_Cursor_After_Update</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_58"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1010_14" HREF="terminal_interface-curses__adb.htm#ref_1010_14">Immediate_Update_Mode</A></span> -+ (<span class="symbol"><A NAME="ref_1011_7" HREF="terminal_interface-curses__adb.htm#ref_1011_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_1012_7" HREF="terminal_interface-curses__adb.htm#ref_1012_7">Mode</A></span> : Boolean := False); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_outopts.3x.html">immedok()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1010_14">Immediate_Update_Mode</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_59"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1017_14" HREF="terminal_interface-curses__adb.htm#ref_1020_14">Allow_Scrolling</A></span> -+ (<span class="symbol"><A NAME="ref_1018_7" HREF="terminal_interface-curses__adb.htm#ref_1021_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_1019_7" HREF="terminal_interface-curses__adb.htm#ref_1022_7">Mode</A></span> : Boolean := False); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_outopts.3x.html">scrollok()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1017_14">Allow_Scrolling</A>); -+ -+ <b>function</b> <span class="symbol"><A NAME="ref_1023_13" HREF="terminal_interface-curses__adb.htm#ref_1032_13">Scrolling_Allowed</A></span> (<span class="symbol"><A NAME="ref_1023_32" HREF="terminal_interface-curses__adb.htm#ref_1032_32">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>) <b>return</b> Boolean; -+ <span class="comment"><EM>-- There is no such function in the C interface.</EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1023_13">Scrolling_Allowed</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_60"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1028_14" HREF="terminal_interface-curses__adb.htm#ref_1041_14">Set_Scroll_Region</A></span> -+ (<span class="symbol"><A NAME="ref_1029_7" HREF="terminal_interface-curses__adb.htm#ref_1042_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_1030_7" HREF="terminal_interface-curses__adb.htm#ref_1043_7">Top_Line</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_1031_7" HREF="terminal_interface-curses__adb.htm#ref_1044_7">Bottom_Line</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_outopts.3x.html">wsetscrreg()</A></EM></span> -+ <span class="comment"><EM>-- AKA: setscrreg()</EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1028_14">Set_Scroll_Region</A>); -+ -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page <A HREF="../man/curs_refresh.3x.html">curs_refresh.3x</A></EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_61"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1041_14" HREF="terminal_interface-curses__adb.htm#ref_1057_14">Update_Screen</A></span>; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_refresh.3x.html">doupdate()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1041_14">Update_Screen</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_62"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1046_14" HREF="terminal_interface-curses__adb.htm#ref_1067_14">Refresh</A></span> (<span class="symbol"><A NAME="ref_1046_23" HREF="terminal_interface-curses__adb.htm#ref_1067_23">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_refresh.3x.html">wrefresh()</A></EM></span> -+ <span class="comment"><EM>-- There is an overloaded Refresh for Pads.</EM></span> -+ <span class="comment"><EM>-- The Inline pragma appears there</EM></span> -+ <span class="comment"><EM>-- AKA: refresh()</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_63"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1053_14" HREF="terminal_interface-curses__adb.htm#ref_1077_14">Refresh_Without_Update</A></span> -+ (<span class="symbol"><A NAME="ref_1054_7" HREF="terminal_interface-curses__adb.htm#ref_1078_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_refresh.3x.html">wnoutrefresh()</A></EM></span> -+ <span class="comment"><EM>-- There is an overloaded Refresh_Without_Update for Pads.</EM></span> -+ <span class="comment"><EM>-- The Inline pragma appears there</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_64"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1060_14" HREF="terminal_interface-curses__adb.htm#ref_1088_14">Redraw</A></span> (<span class="symbol"><A NAME="ref_1060_22" HREF="terminal_interface-curses__adb.htm#ref_1088_22">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_refresh.3x.html">redrawwin()</A></EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_65"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1064_14" HREF="terminal_interface-curses__adb.htm#ref_1098_14">Redraw</A></span> (<span class="symbol"><A NAME="ref_1064_22" HREF="terminal_interface-curses__adb.htm#ref_1099_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_1065_22" HREF="terminal_interface-curses__adb.htm#ref_1100_7">Begin_Line</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_1066_22" HREF="terminal_interface-curses__adb.htm#ref_1101_7">Line_Count</A></span> : Positive); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_refresh.3x.html">wredrawln()</A></EM></span> - <b>pragma</b> Inline (Redraw); - -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page <A HREF="../man/curs_clear.3x.html">curs_clear.3x</A></EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_66"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1076_14" HREF="terminal_interface-curses__adb.htm#ref_1115_14">Erase</A></FONT> (<FONT COLOR=red><A NAME="ref_1076_21" HREF="terminal_interface-curses__adb.htm#ref_1115_21">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_clear.3x.html">werase()</A></EM></FONT> -- <FONT COLOR=green><EM>-- AKA: erase()</EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1076_14">Erase</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_67"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1082_14" HREF="terminal_interface-curses__adb.htm#ref_1125_14">Clear</A></FONT> -- (<FONT COLOR=red><A NAME="ref_1083_7" HREF="terminal_interface-curses__adb.htm#ref_1125_21">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_clear.3x.html">wclear()</A></EM></FONT> -- <FONT COLOR=green><EM>-- AKA: clear()</EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1082_14">Clear</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_68"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1089_14" HREF="terminal_interface-curses__adb.htm#ref_1135_14">Clear_To_End_Of_Screen</A></FONT> -- (<FONT COLOR=red><A NAME="ref_1090_7" HREF="terminal_interface-curses__adb.htm#ref_1135_38">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_clear.3x.html">wclrtobot()</A></EM></FONT> -- <FONT COLOR=green><EM>-- AKA: clrtobot()</EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1089_14">Clear_To_End_Of_Screen</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_69"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1096_14" HREF="terminal_interface-curses__adb.htm#ref_1145_14">Clear_To_End_Of_Line</A></FONT> -- (<FONT COLOR=red><A NAME="ref_1097_7" HREF="terminal_interface-curses__adb.htm#ref_1145_36">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_clear.3x.html">wclrtoeol()</A></EM></FONT> -- <FONT COLOR=green><EM>-- AKA: clrtoeol()</EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1096_14">Clear_To_End_Of_Line</A>); -- -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page <A HREF="../man/curs_bkgd.3x.html">curs_bkgd.3x</A></EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_70"#2|</EM></FONT> -- <FONT COLOR=green><EM>-- TODO: we could have Set_Background(Window; Character_Attribute_Set)</EM></FONT> -- <FONT COLOR=green><EM>-- because in C it is common to see bkgdset(A_BOLD) or</EM></FONT> -- <FONT COLOR=green><EM>-- bkgdset(COLOR_PAIR(n))</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1110_14" HREF="terminal_interface-curses__adb.htm#ref_1155_14">Set_Background</A></FONT> -- (<FONT COLOR=red><A NAME="ref_1111_7" HREF="terminal_interface-curses__adb.htm#ref_1156_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_1112_7" HREF="terminal_interface-curses__adb.htm#ref_1157_7">Ch</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_354_9">Attributed_Character</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_bkgd.3x.html">wbkgdset()</A></EM></FONT> -- <FONT COLOR=green><EM>-- AKA: bkgdset()</EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1110_14">Set_Background</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_71"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1118_14" HREF="terminal_interface-curses__adb.htm#ref_1165_14">Change_Background</A></FONT> -- (<FONT COLOR=red><A NAME="ref_1119_7" HREF="terminal_interface-curses__adb.htm#ref_1166_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_1120_7" HREF="terminal_interface-curses__adb.htm#ref_1167_7">Ch</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_354_9">Attributed_Character</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_bkgd.3x.html">wbkgd()</A></EM></FONT> -- <FONT COLOR=green><EM>-- AKA: bkgd()</EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1118_14">Change_Background</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_72"#2|</EM></FONT> -- <FONT COLOR=green><EM>-- ? wbkgdget is not listed in curs_bkgd, getbkgd is thpough.</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1127_13" HREF="terminal_interface-curses__adb.htm#ref_1177_13">Get_Background</A></FONT> (<FONT COLOR=red><A NAME="ref_1127_29" HREF="terminal_interface-curses__adb.htm#ref_1177_29">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>) -- <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_354_9">Attributed_Character</A>; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_bkgd.3x.html">wbkgdget()</A></EM></FONT> -- <FONT COLOR=green><EM>-- AKA: bkgdget()</EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1127_13">Get_Background</A>); -- -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page <A HREF="../man/curs_touch.3x.html">curs_touch.3x</A></EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_73"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1138_14" HREF="terminal_interface-curses__adb.htm#ref_1213_14">Untouch</A></FONT> (<FONT COLOR=red><A NAME="ref_1138_23" HREF="terminal_interface-curses__adb.htm#ref_1213_23">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_touch.3x.html">untouchwin()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1138_14">Untouch</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_74"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1143_14" HREF="terminal_interface-curses__adb.htm#ref_1203_14">Touch</A></FONT> (<FONT COLOR=red><A NAME="ref_1143_21" HREF="terminal_interface-curses__adb.htm#ref_1203_21">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_touch.3x.html">touchwin()</A></EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_75"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1147_14" HREF="terminal_interface-curses__adb.htm#ref_1223_14">Touch</A></FONT> (<FONT COLOR=red><A NAME="ref_1147_21" HREF="terminal_interface-curses__adb.htm#ref_1223_21">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_1148_21" HREF="terminal_interface-curses__adb.htm#ref_1224_21">Start</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_1149_21" HREF="terminal_interface-curses__adb.htm#ref_1225_21">Count</A></FONT> : Positive); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_touch.3x.html">touchline()</A></EM></FONT> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page <A HREF="../man/curs_clear.3x.html">curs_clear.3x</A></EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_66"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1075_14" HREF="terminal_interface-curses__adb.htm#ref_1115_14">Erase</A></span> (<span class="symbol"><A NAME="ref_1075_21" HREF="terminal_interface-curses__adb.htm#ref_1115_21">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_clear.3x.html">werase()</A></EM></span> -+ <span class="comment"><EM>-- AKA: erase()</EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1075_14">Erase</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_67"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1081_14" HREF="terminal_interface-curses__adb.htm#ref_1125_14">Clear</A></span> -+ (<span class="symbol"><A NAME="ref_1082_7" HREF="terminal_interface-curses__adb.htm#ref_1125_21">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_clear.3x.html">wclear()</A></EM></span> -+ <span class="comment"><EM>-- AKA: clear()</EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1081_14">Clear</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_68"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1088_14" HREF="terminal_interface-curses__adb.htm#ref_1135_14">Clear_To_End_Of_Screen</A></span> -+ (<span class="symbol"><A NAME="ref_1089_7" HREF="terminal_interface-curses__adb.htm#ref_1135_38">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_clear.3x.html">wclrtobot()</A></EM></span> -+ <span class="comment"><EM>-- AKA: clrtobot()</EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1088_14">Clear_To_End_Of_Screen</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_69"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1095_14" HREF="terminal_interface-curses__adb.htm#ref_1145_14">Clear_To_End_Of_Line</A></span> -+ (<span class="symbol"><A NAME="ref_1096_7" HREF="terminal_interface-curses__adb.htm#ref_1145_36">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_clear.3x.html">wclrtoeol()</A></EM></span> -+ <span class="comment"><EM>-- AKA: clrtoeol()</EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1095_14">Clear_To_End_Of_Line</A>); -+ -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page <A HREF="../man/curs_bkgd.3x.html">curs_bkgd.3x</A></EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_70"#2|</EM></span> -+ <span class="comment"><EM>-- TODO: we could have Set_Background(Window; Character_Attribute_Set)</EM></span> -+ <span class="comment"><EM>-- because in C it is common to see bkgdset(A_BOLD) or</EM></span> -+ <span class="comment"><EM>-- bkgdset(COLOR_PAIR(n))</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1109_14" HREF="terminal_interface-curses__adb.htm#ref_1155_14">Set_Background</A></span> -+ (<span class="symbol"><A NAME="ref_1110_7" HREF="terminal_interface-curses__adb.htm#ref_1156_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_1111_7" HREF="terminal_interface-curses__adb.htm#ref_1157_7">Ch</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_353_9">Attributed_Character</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_bkgd.3x.html">wbkgdset()</A></EM></span> -+ <span class="comment"><EM>-- AKA: bkgdset()</EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1109_14">Set_Background</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_71"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1117_14" HREF="terminal_interface-curses__adb.htm#ref_1165_14">Change_Background</A></span> -+ (<span class="symbol"><A NAME="ref_1118_7" HREF="terminal_interface-curses__adb.htm#ref_1166_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_1119_7" HREF="terminal_interface-curses__adb.htm#ref_1167_7">Ch</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_353_9">Attributed_Character</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_bkgd.3x.html">wbkgd()</A></EM></span> -+ <span class="comment"><EM>-- AKA: bkgd()</EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1117_14">Change_Background</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_72"#2|</EM></span> -+ <span class="comment"><EM>-- ? wbkgdget is not listed in curs_bkgd, getbkgd is thpough.</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_1126_13" HREF="terminal_interface-curses__adb.htm#ref_1177_13">Get_Background</A></span> (<span class="symbol"><A NAME="ref_1126_29" HREF="terminal_interface-curses__adb.htm#ref_1177_29">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>) -+ <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_353_9">Attributed_Character</A>; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_bkgd.3x.html">wbkgdget()</A></EM></span> -+ <span class="comment"><EM>-- AKA: bkgdget()</EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1126_13">Get_Background</A>); -+ -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page <A HREF="../man/curs_touch.3x.html">curs_touch.3x</A></EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_73"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1137_14" HREF="terminal_interface-curses__adb.htm#ref_1213_14">Untouch</A></span> (<span class="symbol"><A NAME="ref_1137_23" HREF="terminal_interface-curses__adb.htm#ref_1213_23">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_touch.3x.html">untouchwin()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1137_14">Untouch</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_74"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1142_14" HREF="terminal_interface-curses__adb.htm#ref_1203_14">Touch</A></span> (<span class="symbol"><A NAME="ref_1142_21" HREF="terminal_interface-curses__adb.htm#ref_1203_21">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_touch.3x.html">touchwin()</A></EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_75"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1146_14" HREF="terminal_interface-curses__adb.htm#ref_1223_14">Touch</A></span> (<span class="symbol"><A NAME="ref_1146_21" HREF="terminal_interface-curses__adb.htm#ref_1223_21">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_1147_21" HREF="terminal_interface-curses__adb.htm#ref_1224_21">Start</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_1148_21" HREF="terminal_interface-curses__adb.htm#ref_1225_21">Count</A></span> : Positive); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_touch.3x.html">touchline()</A></EM></span> - <b>pragma</b> Inline (Touch); - -- <FONT COLOR=green><EM>-- #1A NAME="AFU_76"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1154_14" HREF="terminal_interface-curses__adb.htm#ref_1186_14">Change_Lines_Status</A></FONT> (<FONT COLOR=red><A NAME="ref_1154_35" HREF="terminal_interface-curses__adb.htm#ref_1186_35">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_1155_35" HREF="terminal_interface-curses__adb.htm#ref_1187_35">Start</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_1156_35" HREF="terminal_interface-curses__adb.htm#ref_1188_35">Count</A></FONT> : Positive; -- <FONT COLOR=red><A NAME="ref_1157_35" HREF="terminal_interface-curses__adb.htm#ref_1189_35">State</A></FONT> : Boolean); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_touch.3x.html">wtouchln()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1154_14">Change_Lines_Status</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_77"#2|</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1162_13" HREF="terminal_interface-curses__adb.htm#ref_1231_13">Is_Touched</A></FONT> (<FONT COLOR=red><A NAME="ref_1162_25" HREF="terminal_interface-curses__adb.htm#ref_1232_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_1163_25" HREF="terminal_interface-curses__adb.htm#ref_1233_7">Line</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>) <b>return</b> Boolean; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_touch.3x.html">is_linetouched()</A></EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_78"#2|</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1167_13" HREF="terminal_interface-curses__adb.htm#ref_1245_13">Is_Touched</A></FONT> (<FONT COLOR=red><A NAME="ref_1167_25" HREF="terminal_interface-curses__adb.htm#ref_1246_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>) <b>return</b> Boolean; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_touch.3x.html">is_wintouched()</A></EM></FONT> -+ <span class="comment"><EM>-- #1A NAME="AFU_76"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1153_14" HREF="terminal_interface-curses__adb.htm#ref_1186_14">Change_Lines_Status</A></span> (<span class="symbol"><A NAME="ref_1153_35" HREF="terminal_interface-curses__adb.htm#ref_1186_35">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_1154_35" HREF="terminal_interface-curses__adb.htm#ref_1187_35">Start</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_1155_35" HREF="terminal_interface-curses__adb.htm#ref_1188_35">Count</A></span> : Positive; -+ <span class="symbol"><A NAME="ref_1156_35" HREF="terminal_interface-curses__adb.htm#ref_1189_35">State</A></span> : Boolean); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_touch.3x.html">wtouchln()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1153_14">Change_Lines_Status</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_77"#2|</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_1161_13" HREF="terminal_interface-curses__adb.htm#ref_1231_13">Is_Touched</A></span> (<span class="symbol"><A NAME="ref_1161_25" HREF="terminal_interface-curses__adb.htm#ref_1232_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_1162_25" HREF="terminal_interface-curses__adb.htm#ref_1233_7">Line</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>) <b>return</b> Boolean; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_touch.3x.html">is_linetouched()</A></EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_78"#2|</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_1166_13" HREF="terminal_interface-curses__adb.htm#ref_1245_13">Is_Touched</A></span> (<span class="symbol"><A NAME="ref_1166_25" HREF="terminal_interface-curses__adb.htm#ref_1246_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>) <b>return</b> Boolean; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_touch.3x.html">is_wintouched()</A></EM></span> - <b>pragma</b> Inline (Is_Touched); - -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page <A HREF="../man/curs_overlay.3x.html">curs_overlay.3x</A></EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_79"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1176_14" HREF="terminal_interface-curses__adb.htm#ref_1258_14">Copy</A></FONT> -- (<FONT COLOR=red><A NAME="ref_1177_7" HREF="terminal_interface-curses__adb.htm#ref_1259_7">Source_Window</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- <FONT COLOR=red><A NAME="ref_1178_7" HREF="terminal_interface-curses__adb.htm#ref_1260_7">Destination_Window</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- <FONT COLOR=red><A NAME="ref_1179_7" HREF="terminal_interface-curses__adb.htm#ref_1261_7">Source_Top_Row</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_1180_7" HREF="terminal_interface-curses__adb.htm#ref_1262_7">Source_Left_Column</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -- <FONT COLOR=red><A NAME="ref_1181_7" HREF="terminal_interface-curses__adb.htm#ref_1263_7">Destination_Top_Row</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_1182_7" HREF="terminal_interface-curses__adb.htm#ref_1264_7">Destination_Left_Column</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -- <FONT COLOR=red><A NAME="ref_1183_7" HREF="terminal_interface-curses__adb.htm#ref_1265_7">Destination_Bottom_Row</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_1184_7" HREF="terminal_interface-curses__adb.htm#ref_1266_7">Destination_Right_Column</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -- <FONT COLOR=red><A NAME="ref_1185_7" HREF="terminal_interface-curses__adb.htm#ref_1267_7">Non_Destructive_Mode</A></FONT> : Boolean := True); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_overlay.3x.html">copywin()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1176_14">Copy</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_80"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1190_14" HREF="terminal_interface-curses__adb.htm#ref_1294_14">Overwrite</A></FONT> (<FONT COLOR=red><A NAME="ref_1190_25" HREF="terminal_interface-curses__adb.htm#ref_1295_7">Source_Window</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- <FONT COLOR=red><A NAME="ref_1191_25" HREF="terminal_interface-curses__adb.htm#ref_1296_7">Destination_Window</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_overlay.3x.html">overwrite()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1190_14">Overwrite</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_81"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1196_14" HREF="terminal_interface-curses__adb.htm#ref_1306_14">Overlay</A></FONT> (<FONT COLOR=red><A NAME="ref_1196_23" HREF="terminal_interface-curses__adb.htm#ref_1307_7">Source_Window</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- <FONT COLOR=red><A NAME="ref_1197_23" HREF="terminal_interface-curses__adb.htm#ref_1308_7">Destination_Window</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_overlay.3x.html">overlay()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1196_14">Overlay</A>); -- -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page <A HREF="../man/curs_deleteln.3x.html">curs_deleteln.3x</A></EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_82"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1206_14" HREF="terminal_interface-curses__adb.htm#ref_1319_14">Insert_Delete_Lines</A></FONT> -- (<FONT COLOR=red><A NAME="ref_1207_7" HREF="terminal_interface-curses__adb.htm#ref_1320_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_1208_7" HREF="terminal_interface-curses__adb.htm#ref_1321_7">Lines</A></FONT> : Integer := 1); <FONT COLOR=green><EM>-- default is to insert one line above</EM></FONT> -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_deleteln.3x.html">winsdelln()</A></EM></FONT> -- <FONT COLOR=green><EM>-- AKA: insdelln()</EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1206_14">Insert_Delete_Lines</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_83"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1214_14" HREF="terminal_interface-curses__adb.htm#ref_1331_14">Delete_Line</A></FONT> (<FONT COLOR=red><A NAME="ref_1214_27" HREF="terminal_interface-curses__adb.htm#ref_1331_27">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_deleteln.3x.html">wdeleteln()</A></EM></FONT> -- <FONT COLOR=green><EM>-- AKA: deleteln()</EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1214_14">Delete_Line</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_84"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1220_14" HREF="terminal_interface-curses__adb.htm#ref_1337_14">Insert_Line</A></FONT> (<FONT COLOR=red><A NAME="ref_1220_27" HREF="terminal_interface-curses__adb.htm#ref_1337_27">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_deleteln.3x.html">winsertln()</A></EM></FONT> -- <FONT COLOR=green><EM>-- AKA: insertln()</EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1220_14">Insert_Line</A>); -- -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page <A HREF="../man/curs_getyx.3x.html">curs_getyx.3x</A></EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_85"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1230_14" HREF="terminal_interface-curses__adb.htm#ref_1344_14">Get_Size</A></FONT> -- (<FONT COLOR=red><A NAME="ref_1231_7" HREF="terminal_interface-curses__adb.htm#ref_1345_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_1232_7" HREF="terminal_interface-curses__adb.htm#ref_1346_7">Number_Of_Lines</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_63_12">Line_Count</A>; -- <FONT COLOR=red><A NAME="ref_1233_7" HREF="terminal_interface-curses__adb.htm#ref_1347_7">Number_Of_Columns</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_65_12">Column_Count</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_getyx.3x.html">getmaxyx()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1230_14">Get_Size</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_86"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1238_14" HREF="terminal_interface-curses__adb.htm#ref_1362_14">Get_Window_Position</A></FONT> -- (<FONT COLOR=red><A NAME="ref_1239_7" HREF="terminal_interface-curses__adb.htm#ref_1363_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_1240_7" HREF="terminal_interface-curses__adb.htm#ref_1364_7">Top_Left_Line</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_1241_7" HREF="terminal_interface-curses__adb.htm#ref_1365_7">Top_Left_Column</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_getyx.3x.html">getbegyx()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1238_14">Get_Window_Position</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_87"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1246_14" HREF="terminal_interface-curses__adb.htm#ref_1380_14">Get_Cursor_Position</A></FONT> -- (<FONT COLOR=red><A NAME="ref_1247_7" HREF="terminal_interface-curses__adb.htm#ref_1381_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_1248_7" HREF="terminal_interface-curses__adb.htm#ref_1382_7">Line</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_1249_7" HREF="terminal_interface-curses__adb.htm#ref_1383_7">Column</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_getyx.3x.html">getyx()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1246_14">Get_Cursor_Position</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_88"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1254_14" HREF="terminal_interface-curses__adb.htm#ref_1398_14">Get_Origin_Relative_To_Parent</A></FONT> -- (<FONT COLOR=red><A NAME="ref_1255_7" HREF="terminal_interface-curses__adb.htm#ref_1399_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- <FONT COLOR=red><A NAME="ref_1256_7" HREF="terminal_interface-curses__adb.htm#ref_1400_7">Top_Left_Line</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_1257_7" HREF="terminal_interface-curses__adb.htm#ref_1401_7">Top_Left_Column</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -- <FONT COLOR=red><A NAME="ref_1258_7" HREF="terminal_interface-curses__adb.htm#ref_1402_7">Is_Not_A_Subwindow</A></FONT> : <b>out</b> Boolean); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_getyx.3x.html">getparyx()</A></EM></FONT> -- <FONT COLOR=green><EM>-- Instead of placing -1 in the coordinates as return, we use a Boolean</EM></FONT> -- <FONT COLOR=green><EM>-- to return the info that the window has no parent.</EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1254_14">Get_Origin_Relative_To_Parent</A>); -- -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page <A HREF="../man/curs_pad.3x.html">curs_pad.3x</A></EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_89"#2|</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1269_13" HREF="terminal_interface-curses__adb.htm#ref_1424_13">New_Pad</A></FONT> (<FONT COLOR=red><A NAME="ref_1269_22" HREF="terminal_interface-curses__adb.htm#ref_1424_22">Lines</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_63_12">Line_Count</A>; -- <FONT COLOR=red><A NAME="ref_1270_22" HREF="terminal_interface-curses__adb.htm#ref_1425_22">Columns</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_65_12">Column_Count</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_pad.3x.html">newpad()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1269_13">New_Pad</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_90"#2|</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1275_13" HREF="terminal_interface-curses__adb.htm#ref_1439_13">Sub_Pad</A></FONT> -- (<FONT COLOR=red><A NAME="ref_1276_7" HREF="terminal_interface-curses__adb.htm#ref_1440_7">Pad</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- <FONT COLOR=red><A NAME="ref_1277_7" HREF="terminal_interface-curses__adb.htm#ref_1441_7">Number_Of_Lines</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_63_12">Line_Count</A>; -- <FONT COLOR=red><A NAME="ref_1278_7" HREF="terminal_interface-curses__adb.htm#ref_1442_7">Number_Of_Columns</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_65_12">Column_Count</A>; -- <FONT COLOR=red><A NAME="ref_1279_7" HREF="terminal_interface-curses__adb.htm#ref_1443_7">First_Line_Position</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_1280_7" HREF="terminal_interface-curses__adb.htm#ref_1444_7">First_Column_Position</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_pad.3x.html">subpad()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1275_13">Sub_Pad</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_91"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1285_14" HREF="terminal_interface-curses__adb.htm#ref_1467_14">Refresh</A></FONT> -- (<FONT COLOR=red><A NAME="ref_1286_7" HREF="terminal_interface-curses__adb.htm#ref_1468_7">Pad</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- <FONT COLOR=red><A NAME="ref_1287_7" HREF="terminal_interface-curses__adb.htm#ref_1469_7">Source_Top_Row</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_1288_7" HREF="terminal_interface-curses__adb.htm#ref_1470_7">Source_Left_Column</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -- <FONT COLOR=red><A NAME="ref_1289_7" HREF="terminal_interface-curses__adb.htm#ref_1471_7">Destination_Top_Row</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_1290_7" HREF="terminal_interface-curses__adb.htm#ref_1472_7">Destination_Left_Column</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -- <FONT COLOR=red><A NAME="ref_1291_7" HREF="terminal_interface-curses__adb.htm#ref_1473_7">Destination_Bottom_Row</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_1292_7" HREF="terminal_interface-curses__adb.htm#ref_1474_7">Destination_Right_Column</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_pad.3x.html">prefresh()</A></EM></FONT> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page <A HREF="../man/curs_overlay.3x.html">curs_overlay.3x</A></EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_79"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1175_14" HREF="terminal_interface-curses__adb.htm#ref_1258_14">Copy</A></span> -+ (<span class="symbol"><A NAME="ref_1176_7" HREF="terminal_interface-curses__adb.htm#ref_1259_7">Source_Window</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="symbol"><A NAME="ref_1177_7" HREF="terminal_interface-curses__adb.htm#ref_1260_7">Destination_Window</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="symbol"><A NAME="ref_1178_7" HREF="terminal_interface-curses__adb.htm#ref_1261_7">Source_Top_Row</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_1179_7" HREF="terminal_interface-curses__adb.htm#ref_1262_7">Source_Left_Column</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -+ <span class="symbol"><A NAME="ref_1180_7" HREF="terminal_interface-curses__adb.htm#ref_1263_7">Destination_Top_Row</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_1181_7" HREF="terminal_interface-curses__adb.htm#ref_1264_7">Destination_Left_Column</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -+ <span class="symbol"><A NAME="ref_1182_7" HREF="terminal_interface-curses__adb.htm#ref_1265_7">Destination_Bottom_Row</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_1183_7" HREF="terminal_interface-curses__adb.htm#ref_1266_7">Destination_Right_Column</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -+ <span class="symbol"><A NAME="ref_1184_7" HREF="terminal_interface-curses__adb.htm#ref_1267_7">Non_Destructive_Mode</A></span> : Boolean := True); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_overlay.3x.html">copywin()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1175_14">Copy</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_80"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1189_14" HREF="terminal_interface-curses__adb.htm#ref_1294_14">Overwrite</A></span> (<span class="symbol"><A NAME="ref_1189_25" HREF="terminal_interface-curses__adb.htm#ref_1295_7">Source_Window</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="symbol"><A NAME="ref_1190_25" HREF="terminal_interface-curses__adb.htm#ref_1296_7">Destination_Window</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_overlay.3x.html">overwrite()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1189_14">Overwrite</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_81"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1195_14" HREF="terminal_interface-curses__adb.htm#ref_1306_14">Overlay</A></span> (<span class="symbol"><A NAME="ref_1195_23" HREF="terminal_interface-curses__adb.htm#ref_1307_7">Source_Window</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="symbol"><A NAME="ref_1196_23" HREF="terminal_interface-curses__adb.htm#ref_1308_7">Destination_Window</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_overlay.3x.html">overlay()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1195_14">Overlay</A>); -+ -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page <A HREF="../man/curs_deleteln.3x.html">curs_deleteln.3x</A></EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_82"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1205_14" HREF="terminal_interface-curses__adb.htm#ref_1319_14">Insert_Delete_Lines</A></span> -+ (<span class="symbol"><A NAME="ref_1206_7" HREF="terminal_interface-curses__adb.htm#ref_1320_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_1207_7" HREF="terminal_interface-curses__adb.htm#ref_1321_7">Lines</A></span> : Integer := 1); <span class="comment"><EM>-- default is to insert one line above</EM></span> -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_deleteln.3x.html">winsdelln()</A></EM></span> -+ <span class="comment"><EM>-- AKA: insdelln()</EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1205_14">Insert_Delete_Lines</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_83"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1213_14" HREF="terminal_interface-curses__adb.htm#ref_1331_14">Delete_Line</A></span> (<span class="symbol"><A NAME="ref_1213_27" HREF="terminal_interface-curses__adb.htm#ref_1331_27">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_deleteln.3x.html">wdeleteln()</A></EM></span> -+ <span class="comment"><EM>-- AKA: deleteln()</EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1213_14">Delete_Line</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_84"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1219_14" HREF="terminal_interface-curses__adb.htm#ref_1337_14">Insert_Line</A></span> (<span class="symbol"><A NAME="ref_1219_27" HREF="terminal_interface-curses__adb.htm#ref_1337_27">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_deleteln.3x.html">winsertln()</A></EM></span> -+ <span class="comment"><EM>-- AKA: insertln()</EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1219_14">Insert_Line</A>); -+ -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page <A HREF="../man/curs_getyx.3x.html">curs_getyx.3x</A></EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_85"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1229_14" HREF="terminal_interface-curses__adb.htm#ref_1344_14">Get_Size</A></span> -+ (<span class="symbol"><A NAME="ref_1230_7" HREF="terminal_interface-curses__adb.htm#ref_1345_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_1231_7" HREF="terminal_interface-curses__adb.htm#ref_1346_7">Number_Of_Lines</A></span> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_63_12">Line_Count</A>; -+ <span class="symbol"><A NAME="ref_1232_7" HREF="terminal_interface-curses__adb.htm#ref_1347_7">Number_Of_Columns</A></span> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_65_12">Column_Count</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_getyx.3x.html">getmaxyx()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1229_14">Get_Size</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_86"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1237_14" HREF="terminal_interface-curses__adb.htm#ref_1362_14">Get_Window_Position</A></span> -+ (<span class="symbol"><A NAME="ref_1238_7" HREF="terminal_interface-curses__adb.htm#ref_1363_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_1239_7" HREF="terminal_interface-curses__adb.htm#ref_1364_7">Top_Left_Line</A></span> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_1240_7" HREF="terminal_interface-curses__adb.htm#ref_1365_7">Top_Left_Column</A></span> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_getyx.3x.html">getbegyx()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1237_14">Get_Window_Position</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_87"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1245_14" HREF="terminal_interface-curses__adb.htm#ref_1380_14">Get_Cursor_Position</A></span> -+ (<span class="symbol"><A NAME="ref_1246_7" HREF="terminal_interface-curses__adb.htm#ref_1381_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_1247_7" HREF="terminal_interface-curses__adb.htm#ref_1382_7">Line</A></span> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_1248_7" HREF="terminal_interface-curses__adb.htm#ref_1383_7">Column</A></span> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_getyx.3x.html">getyx()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1245_14">Get_Cursor_Position</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_88"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1253_14" HREF="terminal_interface-curses__adb.htm#ref_1398_14">Get_Origin_Relative_To_Parent</A></span> -+ (<span class="symbol"><A NAME="ref_1254_7" HREF="terminal_interface-curses__adb.htm#ref_1399_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="symbol"><A NAME="ref_1255_7" HREF="terminal_interface-curses__adb.htm#ref_1400_7">Top_Left_Line</A></span> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_1256_7" HREF="terminal_interface-curses__adb.htm#ref_1401_7">Top_Left_Column</A></span> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -+ <span class="symbol"><A NAME="ref_1257_7" HREF="terminal_interface-curses__adb.htm#ref_1402_7">Is_Not_A_Subwindow</A></span> : <b>out</b> Boolean); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_getyx.3x.html">getparyx()</A></EM></span> -+ <span class="comment"><EM>-- Instead of placing -1 in the coordinates as return, we use a Boolean</EM></span> -+ <span class="comment"><EM>-- to return the info that the window has no parent.</EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1253_14">Get_Origin_Relative_To_Parent</A>); -+ -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page <A HREF="../man/curs_pad.3x.html">curs_pad.3x</A></EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_89"#2|</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_1268_13" HREF="terminal_interface-curses__adb.htm#ref_1424_13">New_Pad</A></span> (<span class="symbol"><A NAME="ref_1268_22" HREF="terminal_interface-curses__adb.htm#ref_1424_22">Lines</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_63_12">Line_Count</A>; -+ <span class="symbol"><A NAME="ref_1269_22" HREF="terminal_interface-curses__adb.htm#ref_1425_22">Columns</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_65_12">Column_Count</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_pad.3x.html">newpad()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1268_13">New_Pad</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_90"#2|</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_1274_13" HREF="terminal_interface-curses__adb.htm#ref_1439_13">Sub_Pad</A></span> -+ (<span class="symbol"><A NAME="ref_1275_7" HREF="terminal_interface-curses__adb.htm#ref_1440_7">Pad</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="symbol"><A NAME="ref_1276_7" HREF="terminal_interface-curses__adb.htm#ref_1441_7">Number_Of_Lines</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_63_12">Line_Count</A>; -+ <span class="symbol"><A NAME="ref_1277_7" HREF="terminal_interface-curses__adb.htm#ref_1442_7">Number_Of_Columns</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_65_12">Column_Count</A>; -+ <span class="symbol"><A NAME="ref_1278_7" HREF="terminal_interface-curses__adb.htm#ref_1443_7">First_Line_Position</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_1279_7" HREF="terminal_interface-curses__adb.htm#ref_1444_7">First_Column_Position</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_pad.3x.html">subpad()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1274_13">Sub_Pad</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_91"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1284_14" HREF="terminal_interface-curses__adb.htm#ref_1467_14">Refresh</A></span> -+ (<span class="symbol"><A NAME="ref_1285_7" HREF="terminal_interface-curses__adb.htm#ref_1468_7">Pad</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="symbol"><A NAME="ref_1286_7" HREF="terminal_interface-curses__adb.htm#ref_1469_7">Source_Top_Row</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_1287_7" HREF="terminal_interface-curses__adb.htm#ref_1470_7">Source_Left_Column</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -+ <span class="symbol"><A NAME="ref_1288_7" HREF="terminal_interface-curses__adb.htm#ref_1471_7">Destination_Top_Row</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_1289_7" HREF="terminal_interface-curses__adb.htm#ref_1472_7">Destination_Left_Column</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -+ <span class="symbol"><A NAME="ref_1290_7" HREF="terminal_interface-curses__adb.htm#ref_1473_7">Destination_Bottom_Row</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_1291_7" HREF="terminal_interface-curses__adb.htm#ref_1474_7">Destination_Right_Column</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_pad.3x.html">prefresh()</A></EM></span> - <b>pragma</b> Inline (Refresh); - -- <FONT COLOR=green><EM>-- #1A NAME="AFU_92"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1297_14" HREF="terminal_interface-curses__adb.htm#ref_1497_14">Refresh_Without_Update</A></FONT> -- (<FONT COLOR=red><A NAME="ref_1298_7" HREF="terminal_interface-curses__adb.htm#ref_1498_7">Pad</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- <FONT COLOR=red><A NAME="ref_1299_7" HREF="terminal_interface-curses__adb.htm#ref_1499_7">Source_Top_Row</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_1300_7" HREF="terminal_interface-curses__adb.htm#ref_1500_7">Source_Left_Column</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -- <FONT COLOR=red><A NAME="ref_1301_7" HREF="terminal_interface-curses__adb.htm#ref_1501_7">Destination_Top_Row</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_1302_7" HREF="terminal_interface-curses__adb.htm#ref_1502_7">Destination_Left_Column</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -- <FONT COLOR=red><A NAME="ref_1303_7" HREF="terminal_interface-curses__adb.htm#ref_1503_7">Destination_Bottom_Row</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_1304_7" HREF="terminal_interface-curses__adb.htm#ref_1504_7">Destination_Right_Column</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_pad.3x.html">pnoutrefresh()</A></EM></FONT> -+ <span class="comment"><EM>-- #1A NAME="AFU_92"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1296_14" HREF="terminal_interface-curses__adb.htm#ref_1497_14">Refresh_Without_Update</A></span> -+ (<span class="symbol"><A NAME="ref_1297_7" HREF="terminal_interface-curses__adb.htm#ref_1498_7">Pad</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="symbol"><A NAME="ref_1298_7" HREF="terminal_interface-curses__adb.htm#ref_1499_7">Source_Top_Row</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_1299_7" HREF="terminal_interface-curses__adb.htm#ref_1500_7">Source_Left_Column</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -+ <span class="symbol"><A NAME="ref_1300_7" HREF="terminal_interface-curses__adb.htm#ref_1501_7">Destination_Top_Row</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_1301_7" HREF="terminal_interface-curses__adb.htm#ref_1502_7">Destination_Left_Column</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -+ <span class="symbol"><A NAME="ref_1302_7" HREF="terminal_interface-curses__adb.htm#ref_1503_7">Destination_Bottom_Row</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_1303_7" HREF="terminal_interface-curses__adb.htm#ref_1504_7">Destination_Right_Column</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_pad.3x.html">pnoutrefresh()</A></EM></span> - <b>pragma</b> Inline (Refresh_Without_Update); - -- <FONT COLOR=green><EM>-- #1A NAME="AFU_93"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1309_14" HREF="terminal_interface-curses__adb.htm#ref_1527_14">Add_Character_To_Pad_And_Echo_It</A></FONT> -- (<FONT COLOR=red><A NAME="ref_1310_7" HREF="terminal_interface-curses__adb.htm#ref_1528_7">Pad</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- <FONT COLOR=red><A NAME="ref_1311_7" HREF="terminal_interface-curses__adb.htm#ref_1529_7">Ch</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_354_9">Attributed_Character</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_pad.3x.html">pechochar()</A></EM></FONT> -- -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1314_14" HREF="terminal_interface-curses__adb.htm#ref_1540_14">Add_Character_To_Pad_And_Echo_It</A></FONT> -- (<FONT COLOR=red><A NAME="ref_1315_7" HREF="terminal_interface-curses__adb.htm#ref_1541_7">Pad</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- <FONT COLOR=red><A NAME="ref_1316_7" HREF="terminal_interface-curses__adb.htm#ref_1542_7">Ch</A></FONT> : Character); -+ <span class="comment"><EM>-- #1A NAME="AFU_93"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1308_14" HREF="terminal_interface-curses__adb.htm#ref_1527_14">Add_Character_To_Pad_And_Echo_It</A></span> -+ (<span class="symbol"><A NAME="ref_1309_7" HREF="terminal_interface-curses__adb.htm#ref_1528_7">Pad</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="symbol"><A NAME="ref_1310_7" HREF="terminal_interface-curses__adb.htm#ref_1529_7">Ch</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_353_9">Attributed_Character</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_pad.3x.html">pechochar()</A></EM></span> -+ -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1313_14" HREF="terminal_interface-curses__adb.htm#ref_1540_14">Add_Character_To_Pad_And_Echo_It</A></span> -+ (<span class="symbol"><A NAME="ref_1314_7" HREF="terminal_interface-curses__adb.htm#ref_1541_7">Pad</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="symbol"><A NAME="ref_1315_7" HREF="terminal_interface-curses__adb.htm#ref_1542_7">Ch</A></span> : Character); - <b>pragma</b> Inline (Add_Character_To_Pad_And_Echo_It); - -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page <A HREF="../man/curs_scroll.3x.html">curs_scroll.3x</A></EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_94"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1324_14" HREF="terminal_interface-curses__adb.htm#ref_1552_14">Scroll</A></FONT> (<FONT COLOR=red><A NAME="ref_1324_22" HREF="terminal_interface-curses__adb.htm#ref_1552_22">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_1325_22" HREF="terminal_interface-curses__adb.htm#ref_1553_22">Amount</A></FONT> : Integer := 1); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_scroll.3x.html">wscrl()</A></EM></FONT> -- <FONT COLOR=green><EM>-- AKA: scroll()</EM></FONT> -- <FONT COLOR=green><EM>-- AKA: scrl()</EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1324_14">Scroll</A>); -- -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page <A HREF="../man/curs_delch.3x.html">curs_delch.3x</A></EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_95"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1336_14" HREF="terminal_interface-curses__adb.htm#ref_1565_14">Delete_Character</A></FONT> (<FONT COLOR=red><A NAME="ref_1336_32" HREF="terminal_interface-curses__adb.htm#ref_1565_32">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_delch.3x.html">wdelch()</A></EM></FONT> -- <FONT COLOR=green><EM>-- AKA: delch()</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_96"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1341_14" HREF="terminal_interface-curses__adb.htm#ref_1575_14">Delete_Character</A></FONT> -- (<FONT COLOR=red><A NAME="ref_1342_7" HREF="terminal_interface-curses__adb.htm#ref_1576_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_1343_7" HREF="terminal_interface-curses__adb.htm#ref_1577_7">Line</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_1344_7" HREF="terminal_interface-curses__adb.htm#ref_1578_7">Column</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_delch.3x.html">mvwdelch()</A></EM></FONT> -- <FONT COLOR=green><EM>-- AKA: mvdelch()</EM></FONT> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page <A HREF="../man/curs_scroll.3x.html">curs_scroll.3x</A></EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_94"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1323_14" HREF="terminal_interface-curses__adb.htm#ref_1552_14">Scroll</A></span> (<span class="symbol"><A NAME="ref_1323_22" HREF="terminal_interface-curses__adb.htm#ref_1552_22">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_1324_22" HREF="terminal_interface-curses__adb.htm#ref_1553_22">Amount</A></span> : Integer := 1); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_scroll.3x.html">wscrl()</A></EM></span> -+ <span class="comment"><EM>-- AKA: scroll()</EM></span> -+ <span class="comment"><EM>-- AKA: scrl()</EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1323_14">Scroll</A>); -+ -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page <A HREF="../man/curs_delch.3x.html">curs_delch.3x</A></EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_95"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1335_14" HREF="terminal_interface-curses__adb.htm#ref_1565_14">Delete_Character</A></span> (<span class="symbol"><A NAME="ref_1335_32" HREF="terminal_interface-curses__adb.htm#ref_1565_32">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_delch.3x.html">wdelch()</A></EM></span> -+ <span class="comment"><EM>-- AKA: delch()</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_96"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1340_14" HREF="terminal_interface-curses__adb.htm#ref_1575_14">Delete_Character</A></span> -+ (<span class="symbol"><A NAME="ref_1341_7" HREF="terminal_interface-curses__adb.htm#ref_1576_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_1342_7" HREF="terminal_interface-curses__adb.htm#ref_1577_7">Line</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_1343_7" HREF="terminal_interface-curses__adb.htm#ref_1578_7">Column</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_delch.3x.html">mvwdelch()</A></EM></span> -+ <span class="comment"><EM>-- AKA: mvdelch()</EM></span> - <b>pragma</b> Inline (Delete_Character); - -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page <A HREF="../man/curs_inch.3x.html">curs_inch.3x</A></EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_97"#2|</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1354_13" HREF="terminal_interface-curses__adb.htm#ref_1590_13">Peek</A></FONT> (<FONT COLOR=red><A NAME="ref_1354_19" HREF="terminal_interface-curses__adb.htm#ref_1590_19">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>) -- <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_354_9">Attributed_Character</A>; -- <FONT COLOR=green><EM>-- AKA: inch()</EM></FONT> -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_inch.3x.html">winch()</A></EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_98"#2|</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1360_13" HREF="terminal_interface-curses__adb.htm#ref_1599_13">Peek</A></FONT> -- (<FONT COLOR=red><A NAME="ref_1361_7" HREF="terminal_interface-curses__adb.htm#ref_1600_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_1362_7" HREF="terminal_interface-curses__adb.htm#ref_1601_7">Line</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_1363_7" HREF="terminal_interface-curses__adb.htm#ref_1602_7">Column</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_354_9">Attributed_Character</A>; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_inch.3x.html">mvwinch()</A></EM></FONT> -- <FONT COLOR=green><EM>-- AKA: mvinch()</EM></FONT> -- <FONT COLOR=green><EM>-- More Peek's follow, pragma Inline appears later.</EM></FONT> -- -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page <A HREF="../man/curs_insch.3x.html">curs_insch.3x</A></EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_99"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1373_14" HREF="terminal_interface-curses__adb.htm#ref_1612_14">Insert</A></FONT> (<FONT COLOR=red><A NAME="ref_1373_22" HREF="terminal_interface-curses__adb.htm#ref_1612_22">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_1374_22" HREF="terminal_interface-curses__adb.htm#ref_1613_22">Ch</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_354_9">Attributed_Character</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_insch.3x.html">winsch()</A></EM></FONT> -- <FONT COLOR=green><EM>-- AKA: insch()</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_100"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1379_14" HREF="terminal_interface-curses__adb.htm#ref_1623_14">Insert</A></FONT> (<FONT COLOR=red><A NAME="ref_1379_22" HREF="terminal_interface-curses__adb.htm#ref_1624_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_1380_22" HREF="terminal_interface-curses__adb.htm#ref_1625_7">Line</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_1381_22" HREF="terminal_interface-curses__adb.htm#ref_1626_7">Column</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -- <FONT COLOR=red><A NAME="ref_1382_22" HREF="terminal_interface-curses__adb.htm#ref_1627_7">Ch</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_354_9">Attributed_Character</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_insch.3x.html">mvwinsch()</A></EM></FONT> -- <FONT COLOR=green><EM>-- AKA: mvinsch()</EM></FONT> -- -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page <A HREF="../man/curs_insstr.3x.html">curs_insstr.3x</A></EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_101"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1391_14" HREF="terminal_interface-curses__adb.htm#ref_1643_14">Insert</A></FONT> (<FONT COLOR=red><A NAME="ref_1391_22" HREF="terminal_interface-curses__adb.htm#ref_1643_22">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_1392_22" HREF="terminal_interface-curses__adb.htm#ref_1644_22">Str</A></FONT> : String; -- <FONT COLOR=red><A NAME="ref_1393_22" HREF="terminal_interface-curses__adb.htm#ref_1645_22">Len</A></FONT> : Integer := -1); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_insstr.3x.html">winsnstr()</A></EM></FONT> -- <FONT COLOR=green><EM>-- AKA: winsstr()</EM></FONT> -- <FONT COLOR=green><EM>-- AKA: insnstr()</EM></FONT> -- <FONT COLOR=green><EM>-- AKA: insstr()</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_102"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1400_14" HREF="terminal_interface-curses__adb.htm#ref_1661_14">Insert</A></FONT> (<FONT COLOR=red><A NAME="ref_1400_22" HREF="terminal_interface-curses__adb.htm#ref_1662_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_1401_22" HREF="terminal_interface-curses__adb.htm#ref_1663_7">Line</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_1402_22" HREF="terminal_interface-curses__adb.htm#ref_1664_7">Column</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -- <FONT COLOR=red><A NAME="ref_1403_22" HREF="terminal_interface-curses__adb.htm#ref_1665_7">Str</A></FONT> : String; -- <FONT COLOR=red><A NAME="ref_1404_22" HREF="terminal_interface-curses__adb.htm#ref_1666_7">Len</A></FONT> : Integer := -1); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_insstr.3x.html">mvwinsnstr()</A></EM></FONT> -- <FONT COLOR=green><EM>-- AKA: mvwinsstr()</EM></FONT> -- <FONT COLOR=green><EM>-- AKA: mvinsnstr()</EM></FONT> -- <FONT COLOR=green><EM>-- AKA: mvinsstr()</EM></FONT> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page <A HREF="../man/curs_inch.3x.html">curs_inch.3x</A></EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_97"#2|</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_1353_13" HREF="terminal_interface-curses__adb.htm#ref_1590_13">Peek</A></span> (<span class="symbol"><A NAME="ref_1353_19" HREF="terminal_interface-curses__adb.htm#ref_1590_19">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>) -+ <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_353_9">Attributed_Character</A>; -+ <span class="comment"><EM>-- AKA: inch()</EM></span> -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_inch.3x.html">winch()</A></EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_98"#2|</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_1359_13" HREF="terminal_interface-curses__adb.htm#ref_1599_13">Peek</A></span> -+ (<span class="symbol"><A NAME="ref_1360_7" HREF="terminal_interface-curses__adb.htm#ref_1600_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_1361_7" HREF="terminal_interface-curses__adb.htm#ref_1601_7">Line</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_1362_7" HREF="terminal_interface-curses__adb.htm#ref_1602_7">Column</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_353_9">Attributed_Character</A>; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_inch.3x.html">mvwinch()</A></EM></span> -+ <span class="comment"><EM>-- AKA: mvinch()</EM></span> -+ <span class="comment"><EM>-- More Peek's follow, pragma Inline appears later.</EM></span> -+ -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page <A HREF="../man/curs_insch.3x.html">curs_insch.3x</A></EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_99"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1372_14" HREF="terminal_interface-curses__adb.htm#ref_1612_14">Insert</A></span> (<span class="symbol"><A NAME="ref_1372_22" HREF="terminal_interface-curses__adb.htm#ref_1612_22">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_1373_22" HREF="terminal_interface-curses__adb.htm#ref_1613_22">Ch</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_353_9">Attributed_Character</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_insch.3x.html">winsch()</A></EM></span> -+ <span class="comment"><EM>-- AKA: insch()</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_100"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1378_14" HREF="terminal_interface-curses__adb.htm#ref_1623_14">Insert</A></span> (<span class="symbol"><A NAME="ref_1378_22" HREF="terminal_interface-curses__adb.htm#ref_1624_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_1379_22" HREF="terminal_interface-curses__adb.htm#ref_1625_7">Line</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_1380_22" HREF="terminal_interface-curses__adb.htm#ref_1626_7">Column</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -+ <span class="symbol"><A NAME="ref_1381_22" HREF="terminal_interface-curses__adb.htm#ref_1627_7">Ch</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_353_9">Attributed_Character</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_insch.3x.html">mvwinsch()</A></EM></span> -+ <span class="comment"><EM>-- AKA: mvinsch()</EM></span> -+ -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page <A HREF="../man/curs_insstr.3x.html">curs_insstr.3x</A></EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_101"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1390_14" HREF="terminal_interface-curses__adb.htm#ref_1643_14">Insert</A></span> (<span class="symbol"><A NAME="ref_1390_22" HREF="terminal_interface-curses__adb.htm#ref_1643_22">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_1391_22" HREF="terminal_interface-curses__adb.htm#ref_1644_22">Str</A></span> : String; -+ <span class="symbol"><A NAME="ref_1392_22" HREF="terminal_interface-curses__adb.htm#ref_1645_22">Len</A></span> : Integer := -1); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_insstr.3x.html">winsnstr()</A></EM></span> -+ <span class="comment"><EM>-- AKA: winsstr()</EM></span> -+ <span class="comment"><EM>-- AKA: insnstr()</EM></span> -+ <span class="comment"><EM>-- AKA: insstr()</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_102"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1399_14" HREF="terminal_interface-curses__adb.htm#ref_1661_14">Insert</A></span> (<span class="symbol"><A NAME="ref_1399_22" HREF="terminal_interface-curses__adb.htm#ref_1662_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_1400_22" HREF="terminal_interface-curses__adb.htm#ref_1663_7">Line</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_1401_22" HREF="terminal_interface-curses__adb.htm#ref_1664_7">Column</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -+ <span class="symbol"><A NAME="ref_1402_22" HREF="terminal_interface-curses__adb.htm#ref_1665_7">Str</A></span> : String; -+ <span class="symbol"><A NAME="ref_1403_22" HREF="terminal_interface-curses__adb.htm#ref_1666_7">Len</A></span> : Integer := -1); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_insstr.3x.html">mvwinsnstr()</A></EM></span> -+ <span class="comment"><EM>-- AKA: mvwinsstr()</EM></span> -+ <span class="comment"><EM>-- AKA: mvinsnstr()</EM></span> -+ <span class="comment"><EM>-- AKA: mvinsstr()</EM></span> - <b>pragma</b> Inline (Insert); - -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page <A HREF="../man/curs_instr.3x.html">curs_instr.3x</A></EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_103"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1416_14" HREF="terminal_interface-curses__adb.htm#ref_1685_14">Peek</A></FONT> (<FONT COLOR=red><A NAME="ref_1416_20" HREF="terminal_interface-curses__adb.htm#ref_1685_20">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_1417_20" HREF="terminal_interface-curses__adb.htm#ref_1686_20">Str</A></FONT> : <b>out</b> String; -- <FONT COLOR=red><A NAME="ref_1418_20" HREF="terminal_interface-curses__adb.htm#ref_1687_20">Len</A></FONT> : Integer := -1); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_instr.3x.html">winnstr()</A></EM></FONT> -- <FONT COLOR=green><EM>-- AKA: winstr()</EM></FONT> -- <FONT COLOR=green><EM>-- AKA: innstr()</EM></FONT> -- <FONT COLOR=green><EM>-- AKA: instr()</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_104"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1425_14" HREF="terminal_interface-curses__adb.htm#ref_1714_14">Peek</A></FONT> (<FONT COLOR=red><A NAME="ref_1425_20" HREF="terminal_interface-curses__adb.htm#ref_1715_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_1426_20" HREF="terminal_interface-curses__adb.htm#ref_1716_7">Line</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_1427_20" HREF="terminal_interface-curses__adb.htm#ref_1717_7">Column</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -- <FONT COLOR=red><A NAME="ref_1428_20" HREF="terminal_interface-curses__adb.htm#ref_1718_7">Str</A></FONT> : <b>out</b> String; -- <FONT COLOR=red><A NAME="ref_1429_20" HREF="terminal_interface-curses__adb.htm#ref_1719_7">Len</A></FONT> : Integer := -1); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_instr.3x.html">mvwinnstr()</A></EM></FONT> -- <FONT COLOR=green><EM>-- AKA: mvwinstr()</EM></FONT> -- <FONT COLOR=green><EM>-- AKA: mvinnstr()</EM></FONT> -- <FONT COLOR=green><EM>-- AKA: mvinstr()</EM></FONT> -- -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page <A HREF="../man/curs_inchstr.3x.html">curs_inchstr.3x</A></EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_105"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1440_14" HREF="terminal_interface-curses__adb.htm#ref_1726_14">Peek</A></FONT> (<FONT COLOR=red><A NAME="ref_1440_20" HREF="terminal_interface-curses__adb.htm#ref_1727_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_1441_20" HREF="terminal_interface-curses__adb.htm#ref_1728_7">Str</A></FONT> : <b>out</b> Attributed_String; -- <FONT COLOR=red><A NAME="ref_1442_20" HREF="terminal_interface-curses__adb.htm#ref_1729_7">Len</A></FONT> : Integer := -1); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_inchstr.3x.html">winchnstr()</A></EM></FONT> -- <FONT COLOR=green><EM>-- AKA: winchstr()</EM></FONT> -- <FONT COLOR=green><EM>-- AKA: inchnstr()</EM></FONT> -- <FONT COLOR=green><EM>-- AKA: inchstr()</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_106"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1449_14" HREF="terminal_interface-curses__adb.htm#ref_1763_14">Peek</A></FONT> (<FONT COLOR=red><A NAME="ref_1449_20" HREF="terminal_interface-curses__adb.htm#ref_1764_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_1450_20" HREF="terminal_interface-curses__adb.htm#ref_1765_7">Line</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_1451_20" HREF="terminal_interface-curses__adb.htm#ref_1766_7">Column</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -- <FONT COLOR=red><A NAME="ref_1452_20" HREF="terminal_interface-curses__adb.htm#ref_1767_7">Str</A></FONT> : <b>out</b> Attributed_String; -- <FONT COLOR=red><A NAME="ref_1453_20" HREF="terminal_interface-curses__adb.htm#ref_1768_7">Len</A></FONT> : Integer := -1); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_inchstr.3x.html">mvwinchnstr()</A></EM></FONT> -- <FONT COLOR=green><EM>-- AKA: mvwinchstr()</EM></FONT> -- <FONT COLOR=green><EM>-- AKA: mvinchnstr()</EM></FONT> -- <FONT COLOR=green><EM>-- AKA: mvinchstr()</EM></FONT> -- <FONT COLOR=green><EM>-- We do not inline the Peek procedures</EM></FONT> -- -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page <A HREF="../man/curs_getstr.3x.html">curs_getstr.3x</A></EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_107"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1465_14" HREF="terminal_interface-curses__adb.htm#ref_1775_14">Get</A></FONT> (<FONT COLOR=red><A NAME="ref_1465_19" HREF="terminal_interface-curses__adb.htm#ref_1775_19">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_1466_19" HREF="terminal_interface-curses__adb.htm#ref_1776_19">Str</A></FONT> : <b>out</b> String; -- <FONT COLOR=red><A NAME="ref_1467_19" HREF="terminal_interface-curses__adb.htm#ref_1777_19">Len</A></FONT> : Integer := -1); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_getstr.3x.html">wgetnstr()</A></EM></FONT> -- <FONT COLOR=green><EM>-- AKA: wgetstr()</EM></FONT> -- <FONT COLOR=green><EM>-- AKA: getnstr()</EM></FONT> -- <FONT COLOR=green><EM>-- AKA: getstr()</EM></FONT> -- <FONT COLOR=green><EM>-- actually getstr is not supported because that results in buffer</EM></FONT> -- <FONT COLOR=green><EM>-- overflows.</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_108"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1476_14" HREF="terminal_interface-curses__adb.htm#ref_1804_14">Get</A></FONT> (<FONT COLOR=red><A NAME="ref_1476_19" HREF="terminal_interface-curses__adb.htm#ref_1805_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_1477_19" HREF="terminal_interface-curses__adb.htm#ref_1806_7">Line</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_1478_19" HREF="terminal_interface-curses__adb.htm#ref_1807_7">Column</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -- <FONT COLOR=red><A NAME="ref_1479_19" HREF="terminal_interface-curses__adb.htm#ref_1808_7">Str</A></FONT> : <b>out</b> String; -- <FONT COLOR=red><A NAME="ref_1480_19" HREF="terminal_interface-curses__adb.htm#ref_1809_7">Len</A></FONT> : Integer := -1); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_getstr.3x.html">mvwgetnstr()</A></EM></FONT> -- <FONT COLOR=green><EM>-- AKA: mvwgetstr()</EM></FONT> -- <FONT COLOR=green><EM>-- AKA: mvgetnstr()</EM></FONT> -- <FONT COLOR=green><EM>-- AKA: mvgetstr()</EM></FONT> -- <FONT COLOR=green><EM>-- Get is not inlined</EM></FONT> -- -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page <A HREF="../man/curs_slk.3x.html">curs_slk.3x</A></EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- -- <FONT COLOR=green><EM>-- Not Implemented: slk_attr_on, slk_attr_off, slk_attr_set</EM></FONT> -- -- <b>type</b> <FONT COLOR=red><A NAME="ref_1493_9">Soft_Label_Key_Format</A></FONT> <b>is</b> (<FONT COLOR=red><A NAME="ref_1493_35">Three_Two_Three</A></FONT>, -- <FONT COLOR=red><A NAME="ref_1494_35">Four_Four</A></FONT>, -- <FONT COLOR=red><A NAME="ref_1495_35">PC_Style</A></FONT>, <FONT COLOR=green><EM>-- ncurses specific</EM></FONT> -- <FONT COLOR=red><A NAME="ref_1496_35">PC_Style_With_Index</A></FONT>); <FONT COLOR=green><EM>-- "</EM></FONT> -- <b>type</b> <FONT COLOR=red><A NAME="ref_1497_9">Label_Number</A></FONT> <b>is</b> <b>new</b> Positive <b>range</b> 1 .. 12; -- <b>type</b> <FONT COLOR=red><A NAME="ref_1498_9">Label_Justification</A></FONT> <b>is</b> (<FONT COLOR=red><A NAME="ref_1498_33">Left</A></FONT>, <FONT COLOR=red><A NAME="ref_1498_39">Centered</A></FONT>, <FONT COLOR=red><A NAME="ref_1498_49">Right</A></FONT>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_109"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1501_14" HREF="terminal_interface-curses__adb.htm#ref_1816_14">Init_Soft_Label_Keys</A></FONT> -- (<FONT COLOR=red><A NAME="ref_1502_7" HREF="terminal_interface-curses__adb.htm#ref_1817_7">Format</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_1493_9">Soft_Label_Key_Format</A> := <A HREF="terminal_interface-curses__ads.htm#ref_1493_35">Three_Two_Three</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_slk.3x.html">slk_init()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1501_14">Init_Soft_Label_Keys</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_110"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1507_14" HREF="terminal_interface-curses__adb.htm#ref_1827_14">Set_Soft_Label_Key</A></FONT> (<FONT COLOR=red><A NAME="ref_1507_34" HREF="terminal_interface-curses__adb.htm#ref_1827_34">Label</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_1497_9">Label_Number</A>; -- <FONT COLOR=red><A NAME="ref_1508_34" HREF="terminal_interface-curses__adb.htm#ref_1828_34">Text</A></FONT> : String; -- <FONT COLOR=red><A NAME="ref_1509_34" HREF="terminal_interface-curses__adb.htm#ref_1829_34">Fmt</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_1498_9">Label_Justification</A> := <A HREF="terminal_interface-curses__ads.htm#ref_1498_33">Left</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_slk.3x.html">slk_set()</A></EM></FONT> -- <FONT COLOR=green><EM>-- We do not inline this procedure</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_111"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1514_14" HREF="terminal_interface-curses__adb.htm#ref_1846_14">Refresh_Soft_Label_Keys</A></FONT>; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_slk.3x.html">slk_refresh()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1514_14">Refresh_Soft_Label_Keys</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_112"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1519_14" HREF="terminal_interface-curses__adb.htm#ref_1856_14">Refresh_Soft_Label_Keys_Without_Update</A></FONT>; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_slk.3x.html">slk_noutrefresh()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1519_14">Refresh_Soft_Label_Keys_Without_Update</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_113"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1524_14" HREF="terminal_interface-curses__adb.htm#ref_1866_14">Get_Soft_Label_Key</A></FONT> (<FONT COLOR=red><A NAME="ref_1524_34" HREF="terminal_interface-curses__adb.htm#ref_1866_34">Label</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_1497_9">Label_Number</A>; -- <FONT COLOR=red><A NAME="ref_1525_34" HREF="terminal_interface-curses__adb.htm#ref_1867_34">Text</A></FONT> : <b>out</b> String); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_slk.3x.html">slk_label()</A></EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_114"#2|</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1529_13" HREF="terminal_interface-curses__adb.htm#ref_1875_13">Get_Soft_Label_Key</A></FONT> (<FONT COLOR=red><A NAME="ref_1529_33" HREF="terminal_interface-curses__adb.htm#ref_1875_33">Label</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_1497_9">Label_Number</A>) <b>return</b> String; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_slk.3x.html">slk_label()</A></EM></FONT> -- <FONT COLOR=green><EM>-- Same as function</EM></FONT> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page <A HREF="../man/curs_instr.3x.html">curs_instr.3x</A></EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_103"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1415_14" HREF="terminal_interface-curses__adb.htm#ref_1685_14">Peek</A></span> (<span class="symbol"><A NAME="ref_1415_20" HREF="terminal_interface-curses__adb.htm#ref_1685_20">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_1416_20" HREF="terminal_interface-curses__adb.htm#ref_1686_20">Str</A></span> : <b>out</b> String; -+ <span class="symbol"><A NAME="ref_1417_20" HREF="terminal_interface-curses__adb.htm#ref_1687_20">Len</A></span> : Integer := -1); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_instr.3x.html">winnstr()</A></EM></span> -+ <span class="comment"><EM>-- AKA: winstr()</EM></span> -+ <span class="comment"><EM>-- AKA: innstr()</EM></span> -+ <span class="comment"><EM>-- AKA: instr()</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_104"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1424_14" HREF="terminal_interface-curses__adb.htm#ref_1714_14">Peek</A></span> (<span class="symbol"><A NAME="ref_1424_20" HREF="terminal_interface-curses__adb.htm#ref_1715_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_1425_20" HREF="terminal_interface-curses__adb.htm#ref_1716_7">Line</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_1426_20" HREF="terminal_interface-curses__adb.htm#ref_1717_7">Column</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -+ <span class="symbol"><A NAME="ref_1427_20" HREF="terminal_interface-curses__adb.htm#ref_1718_7">Str</A></span> : <b>out</b> String; -+ <span class="symbol"><A NAME="ref_1428_20" HREF="terminal_interface-curses__adb.htm#ref_1719_7">Len</A></span> : Integer := -1); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_instr.3x.html">mvwinnstr()</A></EM></span> -+ <span class="comment"><EM>-- AKA: mvwinstr()</EM></span> -+ <span class="comment"><EM>-- AKA: mvinnstr()</EM></span> -+ <span class="comment"><EM>-- AKA: mvinstr()</EM></span> -+ -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page <A HREF="../man/curs_inchstr.3x.html">curs_inchstr.3x</A></EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_105"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1439_14" HREF="terminal_interface-curses__adb.htm#ref_1726_14">Peek</A></span> (<span class="symbol"><A NAME="ref_1439_20" HREF="terminal_interface-curses__adb.htm#ref_1727_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_1440_20" HREF="terminal_interface-curses__adb.htm#ref_1728_7">Str</A></span> : <b>out</b> Attributed_String; -+ <span class="symbol"><A NAME="ref_1441_20" HREF="terminal_interface-curses__adb.htm#ref_1729_7">Len</A></span> : Integer := -1); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_inchstr.3x.html">winchnstr()</A></EM></span> -+ <span class="comment"><EM>-- AKA: winchstr()</EM></span> -+ <span class="comment"><EM>-- AKA: inchnstr()</EM></span> -+ <span class="comment"><EM>-- AKA: inchstr()</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_106"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1448_14" HREF="terminal_interface-curses__adb.htm#ref_1763_14">Peek</A></span> (<span class="symbol"><A NAME="ref_1448_20" HREF="terminal_interface-curses__adb.htm#ref_1764_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_1449_20" HREF="terminal_interface-curses__adb.htm#ref_1765_7">Line</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_1450_20" HREF="terminal_interface-curses__adb.htm#ref_1766_7">Column</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -+ <span class="symbol"><A NAME="ref_1451_20" HREF="terminal_interface-curses__adb.htm#ref_1767_7">Str</A></span> : <b>out</b> Attributed_String; -+ <span class="symbol"><A NAME="ref_1452_20" HREF="terminal_interface-curses__adb.htm#ref_1768_7">Len</A></span> : Integer := -1); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_inchstr.3x.html">mvwinchnstr()</A></EM></span> -+ <span class="comment"><EM>-- AKA: mvwinchstr()</EM></span> -+ <span class="comment"><EM>-- AKA: mvinchnstr()</EM></span> -+ <span class="comment"><EM>-- AKA: mvinchstr()</EM></span> -+ <span class="comment"><EM>-- We do not inline the Peek procedures</EM></span> -+ -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page <A HREF="../man/curs_getstr.3x.html">curs_getstr.3x</A></EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_107"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1464_14" HREF="terminal_interface-curses__adb.htm#ref_1775_14">Get</A></span> (<span class="symbol"><A NAME="ref_1464_19" HREF="terminal_interface-curses__adb.htm#ref_1775_19">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_1465_19" HREF="terminal_interface-curses__adb.htm#ref_1776_19">Str</A></span> : <b>out</b> String; -+ <span class="symbol"><A NAME="ref_1466_19" HREF="terminal_interface-curses__adb.htm#ref_1777_19">Len</A></span> : Integer := -1); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_getstr.3x.html">wgetnstr()</A></EM></span> -+ <span class="comment"><EM>-- AKA: wgetstr()</EM></span> -+ <span class="comment"><EM>-- AKA: getnstr()</EM></span> -+ <span class="comment"><EM>-- AKA: getstr()</EM></span> -+ <span class="comment"><EM>-- actually getstr is not supported because that results in buffer</EM></span> -+ <span class="comment"><EM>-- overflows.</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_108"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1475_14" HREF="terminal_interface-curses__adb.htm#ref_1804_14">Get</A></span> (<span class="symbol"><A NAME="ref_1475_19" HREF="terminal_interface-curses__adb.htm#ref_1805_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_1476_19" HREF="terminal_interface-curses__adb.htm#ref_1806_7">Line</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_1477_19" HREF="terminal_interface-curses__adb.htm#ref_1807_7">Column</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -+ <span class="symbol"><A NAME="ref_1478_19" HREF="terminal_interface-curses__adb.htm#ref_1808_7">Str</A></span> : <b>out</b> String; -+ <span class="symbol"><A NAME="ref_1479_19" HREF="terminal_interface-curses__adb.htm#ref_1809_7">Len</A></span> : Integer := -1); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_getstr.3x.html">mvwgetnstr()</A></EM></span> -+ <span class="comment"><EM>-- AKA: mvwgetstr()</EM></span> -+ <span class="comment"><EM>-- AKA: mvgetnstr()</EM></span> -+ <span class="comment"><EM>-- AKA: mvgetstr()</EM></span> -+ <span class="comment"><EM>-- Get is not inlined</EM></span> -+ -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page <A HREF="../man/curs_slk.3x.html">curs_slk.3x</A></EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ -+ <span class="comment"><EM>-- Not Implemented: slk_attr_on, slk_attr_off, slk_attr_set</EM></span> -+ -+ <b>type</b> <span class="symbol"><A NAME="ref_1492_9">Soft_Label_Key_Format</A></span> <b>is</b> (<span class="symbol"><A NAME="ref_1492_35">Three_Two_Three</A></span>, -+ <span class="symbol"><A NAME="ref_1493_35">Four_Four</A></span>, -+ <span class="symbol"><A NAME="ref_1494_35">PC_Style</A></span>, <span class="comment"><EM>-- ncurses specific</EM></span> -+ <span class="symbol"><A NAME="ref_1495_35">PC_Style_With_Index</A></span>); <span class="comment"><EM>-- "</EM></span> -+ <b>type</b> <span class="symbol"><A NAME="ref_1496_9">Label_Number</A></span> <b>is</b> <b>new</b> Positive <b>range</b> 1 .. 12; -+ <b>type</b> <span class="symbol"><A NAME="ref_1497_9">Label_Justification</A></span> <b>is</b> (<span class="symbol"><A NAME="ref_1497_33">Left</A></span>, <span class="symbol"><A NAME="ref_1497_39">Centered</A></span>, <span class="symbol"><A NAME="ref_1497_49">Right</A></span>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_109"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1500_14" HREF="terminal_interface-curses__adb.htm#ref_1816_14">Init_Soft_Label_Keys</A></span> -+ (<span class="symbol"><A NAME="ref_1501_7" HREF="terminal_interface-curses__adb.htm#ref_1817_7">Format</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_1492_9">Soft_Label_Key_Format</A> := <A HREF="terminal_interface-curses__ads.htm#ref_1492_35">Three_Two_Three</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_slk.3x.html">slk_init()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1500_14">Init_Soft_Label_Keys</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_110"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1506_14" HREF="terminal_interface-curses__adb.htm#ref_1827_14">Set_Soft_Label_Key</A></span> (<span class="symbol"><A NAME="ref_1506_34" HREF="terminal_interface-curses__adb.htm#ref_1827_34">Label</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_1496_9">Label_Number</A>; -+ <span class="symbol"><A NAME="ref_1507_34" HREF="terminal_interface-curses__adb.htm#ref_1828_34">Text</A></span> : String; -+ <span class="symbol"><A NAME="ref_1508_34" HREF="terminal_interface-curses__adb.htm#ref_1829_34">Fmt</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_1497_9">Label_Justification</A> := <A HREF="terminal_interface-curses__ads.htm#ref_1497_33">Left</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_slk.3x.html">slk_set()</A></EM></span> -+ <span class="comment"><EM>-- We do not inline this procedure</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_111"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1513_14" HREF="terminal_interface-curses__adb.htm#ref_1846_14">Refresh_Soft_Label_Keys</A></span>; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_slk.3x.html">slk_refresh()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1513_14">Refresh_Soft_Label_Keys</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_112"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1518_14" HREF="terminal_interface-curses__adb.htm#ref_1856_14">Refresh_Soft_Label_Keys_Without_Update</A></span>; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_slk.3x.html">slk_noutrefresh()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1518_14">Refresh_Soft_Label_Keys_Without_Update</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_113"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1523_14" HREF="terminal_interface-curses__adb.htm#ref_1866_14">Get_Soft_Label_Key</A></span> (<span class="symbol"><A NAME="ref_1523_34" HREF="terminal_interface-curses__adb.htm#ref_1866_34">Label</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_1496_9">Label_Number</A>; -+ <span class="symbol"><A NAME="ref_1524_34" HREF="terminal_interface-curses__adb.htm#ref_1867_34">Text</A></span> : <b>out</b> String); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_slk.3x.html">slk_label()</A></EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_114"#2|</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_1528_13" HREF="terminal_interface-curses__adb.htm#ref_1875_13">Get_Soft_Label_Key</A></span> (<span class="symbol"><A NAME="ref_1528_33" HREF="terminal_interface-curses__adb.htm#ref_1875_33">Label</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_1496_9">Label_Number</A>) <b>return</b> String; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_slk.3x.html">slk_label()</A></EM></span> -+ <span class="comment"><EM>-- Same as function</EM></span> - <b>pragma</b> Inline (Get_Soft_Label_Key); - -- <FONT COLOR=green><EM>-- #1A NAME="AFU_115"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1535_14" HREF="terminal_interface-curses__adb.htm#ref_1883_14">Clear_Soft_Label_Keys</A></FONT>; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_slk.3x.html">slk_clear()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1535_14">Clear_Soft_Label_Keys</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_116"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1540_14" HREF="terminal_interface-curses__adb.htm#ref_1893_14">Restore_Soft_Label_Keys</A></FONT>; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_slk.3x.html">slk_restore()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1540_14">Restore_Soft_Label_Keys</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_117"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1545_14" HREF="terminal_interface-curses__adb.htm#ref_1903_14">Touch_Soft_Label_Keys</A></FONT>; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_slk.3x.html">slk_touch()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1545_14">Touch_Soft_Label_Keys</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_118"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1550_14" HREF="terminal_interface-curses__adb.htm#ref_1913_14">Switch_Soft_Label_Key_Attributes</A></FONT> -- (<FONT COLOR=red><A NAME="ref_1551_7" HREF="terminal_interface-curses__adb.htm#ref_1914_7">Attr</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A>; -- <FONT COLOR=red><A NAME="ref_1552_7" HREF="terminal_interface-curses__adb.htm#ref_1915_7">On</A></FONT> : Boolean := True); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_slk.3x.html">slk_attron()</A></EM></FONT> -- <FONT COLOR=green><EM>-- AKA: slk_attroff()</EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1550_14">Switch_Soft_Label_Key_Attributes</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_119"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1558_14" HREF="terminal_interface-curses__adb.htm#ref_1937_14">Set_Soft_Label_Key_Attributes</A></FONT> -- (<FONT COLOR=red><A NAME="ref_1559_7" HREF="terminal_interface-curses__adb.htm#ref_1938_7">Attr</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A> := <A HREF="terminal_interface-curses__ads.htm#ref_352_4">Normal_Video</A>; -- <FONT COLOR=red><A NAME="ref_1560_7" HREF="terminal_interface-curses__adb.htm#ref_1939_7">Color</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A> := <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>'First); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_slk.3x.html">slk_attrset()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1558_14">Set_Soft_Label_Key_Attributes</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_120"#2|</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1565_13" HREF="terminal_interface-curses__adb.htm#ref_1953_13">Get_Soft_Label_Key_Attributes</A></FONT> <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A>; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_slk.3x.html">slk_attr()</A></EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_121"#2|</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1569_13" HREF="terminal_interface-curses__adb.htm#ref_1963_13">Get_Soft_Label_Key_Attributes</A></FONT> <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_slk.3x.html">slk_attr()</A></EM></FONT> -+ <span class="comment"><EM>-- #1A NAME="AFU_115"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1534_14" HREF="terminal_interface-curses__adb.htm#ref_1883_14">Clear_Soft_Label_Keys</A></span>; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_slk.3x.html">slk_clear()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1534_14">Clear_Soft_Label_Keys</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_116"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1539_14" HREF="terminal_interface-curses__adb.htm#ref_1893_14">Restore_Soft_Label_Keys</A></span>; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_slk.3x.html">slk_restore()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1539_14">Restore_Soft_Label_Keys</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_117"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1544_14" HREF="terminal_interface-curses__adb.htm#ref_1903_14">Touch_Soft_Label_Keys</A></span>; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_slk.3x.html">slk_touch()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1544_14">Touch_Soft_Label_Keys</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_118"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1549_14" HREF="terminal_interface-curses__adb.htm#ref_1913_14">Switch_Soft_Label_Key_Attributes</A></span> -+ (<span class="symbol"><A NAME="ref_1550_7" HREF="terminal_interface-curses__adb.htm#ref_1914_7">Attr</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A>; -+ <span class="symbol"><A NAME="ref_1551_7" HREF="terminal_interface-curses__adb.htm#ref_1915_7">On</A></span> : Boolean := True); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_slk.3x.html">slk_attron()</A></EM></span> -+ <span class="comment"><EM>-- AKA: slk_attroff()</EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1549_14">Switch_Soft_Label_Key_Attributes</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_119"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1557_14" HREF="terminal_interface-curses__adb.htm#ref_1937_14">Set_Soft_Label_Key_Attributes</A></span> -+ (<span class="symbol"><A NAME="ref_1558_7" HREF="terminal_interface-curses__adb.htm#ref_1938_7">Attr</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A> := <A HREF="terminal_interface-curses__ads.htm#ref_351_4">Normal_Video</A>; -+ <span class="symbol"><A NAME="ref_1559_7" HREF="terminal_interface-curses__adb.htm#ref_1939_7">Color</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A> := <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>'First); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_slk.3x.html">slk_attrset()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1557_14">Set_Soft_Label_Key_Attributes</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_120"#2|</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_1564_13" HREF="terminal_interface-curses__adb.htm#ref_1953_13">Get_Soft_Label_Key_Attributes</A></span> <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A>; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_slk.3x.html">slk_attr()</A></EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_121"#2|</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_1568_13" HREF="terminal_interface-curses__adb.htm#ref_1963_13">Get_Soft_Label_Key_Attributes</A></span> <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_slk.3x.html">slk_attr()</A></EM></span> - <b>pragma</b> Inline (Get_Soft_Label_Key_Attributes); - -- <FONT COLOR=green><EM>-- #1A NAME="AFU_122"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1574_14" HREF="terminal_interface-curses__adb.htm#ref_1973_14">Set_Soft_Label_Key_Color</A></FONT> (<FONT COLOR=red><A NAME="ref_1574_40" HREF="terminal_interface-curses__adb.htm#ref_1973_40">Pair</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_slk.3x.html">slk_color()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1574_14">Set_Soft_Label_Key_Color</A>); -- -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page <A HREF="../man/keybound.3x.html">keybound.3x</A></EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- Not Implemented: keybound</EM></FONT> -- -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page <A HREF="../man/keyok.3x.html">keyok.3x</A></EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_123"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1588_14" HREF="terminal_interface-curses__adb.htm#ref_1984_14">Enable_Key</A></FONT> (<FONT COLOR=red><A NAME="ref_1588_26" HREF="terminal_interface-curses__adb.htm#ref_1984_26">Key</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A>; -- <FONT COLOR=red><A NAME="ref_1589_26" HREF="terminal_interface-curses__adb.htm#ref_1985_26">Enable</A></FONT> : Boolean := True); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/keyok.3x.html">keyok()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1588_14">Enable_Key</A>); -- -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page <A HREF="../man/define_key.3x.html">define_key.3x</A></EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_124"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1598_14" HREF="terminal_interface-curses__adb.htm#ref_1997_14">Define_Key</A></FONT> (<FONT COLOR=red><A NAME="ref_1598_26" HREF="terminal_interface-curses__adb.htm#ref_1997_26">Definition</A></FONT> : String; -- <FONT COLOR=red><A NAME="ref_1599_26" HREF="terminal_interface-curses__adb.htm#ref_1998_26">Key</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/define_key.3x.html">define_key()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1598_14">Define_Key</A>); -- -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page <A HREF="../man/curs_util.3x.html">curs_util.3x</A></EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- -- <FONT COLOR=green><EM>-- | Not implemented : filter, use_env</EM></FONT> -- <FONT COLOR=green><EM>-- | putwin, getwin are in the child package PutWin</EM></FONT> -- <FONT COLOR=green><EM>--</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_125"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1612_14" HREF="terminal_interface-curses__adb.htm#ref_90_14">Key_Name</A></FONT> (<FONT COLOR=red><A NAME="ref_1612_24" HREF="terminal_interface-curses__adb.htm#ref_90_24">Key</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_73_12">Real_Key_Code</A>; -- <FONT COLOR=red><A NAME="ref_1613_24" HREF="terminal_interface-curses__adb.htm#ref_91_24">Name</A></FONT> : <b>out</b> String); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_util.3x.html">keyname()</A></EM></FONT> -- <FONT COLOR=green><EM>-- The external name for a real keystroke.</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_126"#2|</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1618_13" HREF="terminal_interface-curses__adb.htm#ref_62_13">Key_Name</A></FONT> (<FONT COLOR=red><A NAME="ref_1618_23" HREF="terminal_interface-curses__adb.htm#ref_62_23">Key</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_73_12">Real_Key_Code</A>) <b>return</b> String; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_util.3x.html">keyname()</A></EM></FONT> -- <FONT COLOR=green><EM>-- Same as function</EM></FONT> -- <FONT COLOR=green><EM>-- We do not inline this routine</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_127"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1624_14" HREF="terminal_interface-curses__adb.htm#ref_2013_14">Un_Control</A></FONT> (<FONT COLOR=red><A NAME="ref_1624_26" HREF="terminal_interface-curses__adb.htm#ref_2013_26">Ch</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_354_9">Attributed_Character</A>; -- <FONT COLOR=red><A NAME="ref_1625_26" HREF="terminal_interface-curses__adb.htm#ref_2014_26">Str</A></FONT> : <b>out</b> String); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_util.3x.html">unctrl()</A></EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_128"#2|</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1629_13" HREF="terminal_interface-curses__adb.htm#ref_2022_13">Un_Control</A></FONT> (<FONT COLOR=red><A NAME="ref_1629_25" HREF="terminal_interface-curses__adb.htm#ref_2022_25">Ch</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_354_9">Attributed_Character</A>) <b>return</b> String; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_util.3x.html">unctrl()</A></EM></FONT> -- <FONT COLOR=green><EM>-- Same as function</EM></FONT> -+ <span class="comment"><EM>-- #1A NAME="AFU_122"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1573_14" HREF="terminal_interface-curses__adb.htm#ref_1973_14">Set_Soft_Label_Key_Color</A></span> (<span class="symbol"><A NAME="ref_1573_40" HREF="terminal_interface-curses__adb.htm#ref_1973_40">Pair</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_slk.3x.html">slk_color()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1573_14">Set_Soft_Label_Key_Color</A>); -+ -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page <A HREF="../man/keybound.3x.html">keybound.3x</A></EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- Not Implemented: keybound</EM></span> -+ -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page <A HREF="../man/keyok.3x.html">keyok.3x</A></EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_123"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1587_14" HREF="terminal_interface-curses__adb.htm#ref_1984_14">Enable_Key</A></span> (<span class="symbol"><A NAME="ref_1587_26" HREF="terminal_interface-curses__adb.htm#ref_1984_26">Key</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A>; -+ <span class="symbol"><A NAME="ref_1588_26" HREF="terminal_interface-curses__adb.htm#ref_1985_26">Enable</A></span> : Boolean := True); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/keyok.3x.html">keyok()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1587_14">Enable_Key</A>); -+ -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page <A HREF="../man/define_key.3x.html">define_key.3x</A></EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_124"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1597_14" HREF="terminal_interface-curses__adb.htm#ref_1997_14">Define_Key</A></span> (<span class="symbol"><A NAME="ref_1597_26" HREF="terminal_interface-curses__adb.htm#ref_1997_26">Definition</A></span> : String; -+ <span class="symbol"><A NAME="ref_1598_26" HREF="terminal_interface-curses__adb.htm#ref_1998_26">Key</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_78_12">Special_Key_Code</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/define_key.3x.html">define_key()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1597_14">Define_Key</A>); -+ -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page <A HREF="../man/curs_util.3x.html">curs_util.3x</A></EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ -+ <span class="comment"><EM>-- | Not implemented : filter, use_env</EM></span> -+ <span class="comment"><EM>-- | putwin, getwin are in the child package PutWin</EM></span> -+ <span class="comment"><EM>--</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_125"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1611_14" HREF="terminal_interface-curses__adb.htm#ref_90_14">Key_Name</A></span> (<span class="symbol"><A NAME="ref_1611_24" HREF="terminal_interface-curses__adb.htm#ref_90_24">Key</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_73_12">Real_Key_Code</A>; -+ <span class="symbol"><A NAME="ref_1612_24" HREF="terminal_interface-curses__adb.htm#ref_91_24">Name</A></span> : <b>out</b> String); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_util.3x.html">keyname()</A></EM></span> -+ <span class="comment"><EM>-- The external name for a real keystroke.</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_126"#2|</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_1617_13" HREF="terminal_interface-curses__adb.htm#ref_62_13">Key_Name</A></span> (<span class="symbol"><A NAME="ref_1617_23" HREF="terminal_interface-curses__adb.htm#ref_62_23">Key</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_73_12">Real_Key_Code</A>) <b>return</b> String; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_util.3x.html">keyname()</A></EM></span> -+ <span class="comment"><EM>-- Same as function</EM></span> -+ <span class="comment"><EM>-- We do not inline this routine</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_127"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1623_14" HREF="terminal_interface-curses__adb.htm#ref_2013_14">Un_Control</A></span> (<span class="symbol"><A NAME="ref_1623_26" HREF="terminal_interface-curses__adb.htm#ref_2013_26">Ch</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_353_9">Attributed_Character</A>; -+ <span class="symbol"><A NAME="ref_1624_26" HREF="terminal_interface-curses__adb.htm#ref_2014_26">Str</A></span> : <b>out</b> String); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_util.3x.html">unctrl()</A></EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_128"#2|</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_1628_13" HREF="terminal_interface-curses__adb.htm#ref_2022_13">Un_Control</A></span> (<span class="symbol"><A NAME="ref_1628_25" HREF="terminal_interface-curses__adb.htm#ref_2022_25">Ch</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_353_9">Attributed_Character</A>) <b>return</b> String; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_util.3x.html">unctrl()</A></EM></span> -+ <span class="comment"><EM>-- Same as function</EM></span> - <b>pragma</b> Inline (Un_Control); - -- <FONT COLOR=green><EM>-- #1A NAME="AFU_129"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1635_14" HREF="terminal_interface-curses__adb.htm#ref_2030_14">Delay_Output</A></FONT> (<FONT COLOR=red><A NAME="ref_1635_28" HREF="terminal_interface-curses__adb.htm#ref_2030_28">Msecs</A></FONT> : Natural); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_util.3x.html">delay_output()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1635_14">Delay_Output</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_130"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1640_14" HREF="terminal_interface-curses__adb.htm#ref_2040_14">Flush_Input</A></FONT>; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_util.3x.html">flushinp()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1640_14">Flush_Input</A>); -- -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page <A HREF="../man/curs_termattrs.3x.html">curs_termattrs.3x</A></EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_131"#2|</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1649_13" HREF="terminal_interface-curses__adb.htm#ref_2050_13">Baudrate</A></FONT> <b>return</b> Natural; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_termattrs.3x.html">baudrate()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1649_13">Baudrate</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_132"#2|</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1654_13" HREF="terminal_interface-curses__adb.htm#ref_2058_13">Erase_Character</A></FONT> <b>return</b> Character; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_termattrs.3x.html">erasechar()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1654_13">Erase_Character</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_133"#2|</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1659_13" HREF="terminal_interface-curses__adb.htm#ref_2066_13">Kill_Character</A></FONT> <b>return</b> Character; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_termattrs.3x.html">killchar()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1659_13">Kill_Character</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_134"#2|</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1664_13" HREF="terminal_interface-curses__adb.htm#ref_2074_13">Has_Insert_Character</A></FONT> <b>return</b> Boolean; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_termattrs.3x.html">has_ic()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1664_13">Has_Insert_Character</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_135"#2|</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1669_13" HREF="terminal_interface-curses__adb.htm#ref_2086_13">Has_Insert_Line</A></FONT> <b>return</b> Boolean; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_termattrs.3x.html">has_il()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1669_13">Has_Insert_Line</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_136"#2|</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1674_13" HREF="terminal_interface-curses__adb.htm#ref_2098_13">Supported_Attributes</A></FONT> <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A>; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_termattrs.3x.html">termattrs()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1674_13">Supported_Attributes</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_137"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1679_14" HREF="terminal_interface-curses__adb.htm#ref_2108_14">Long_Name</A></FONT> (<FONT COLOR=red><A NAME="ref_1679_25" HREF="terminal_interface-curses__adb.htm#ref_2108_25">Name</A></FONT> : <b>out</b> String); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_termattrs.3x.html">longname()</A></EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_138"#2|</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1683_13" HREF="terminal_interface-curses__adb.htm#ref_2116_13">Long_Name</A></FONT> <b>return</b> String; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_termattrs.3x.html">longname()</A></EM></FONT> -- <FONT COLOR=green><EM>-- Same as function</EM></FONT> -+ <span class="comment"><EM>-- #1A NAME="AFU_129"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1634_14" HREF="terminal_interface-curses__adb.htm#ref_2030_14">Delay_Output</A></span> (<span class="symbol"><A NAME="ref_1634_28" HREF="terminal_interface-curses__adb.htm#ref_2030_28">Msecs</A></span> : Natural); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_util.3x.html">delay_output()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1634_14">Delay_Output</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_130"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1639_14" HREF="terminal_interface-curses__adb.htm#ref_2040_14">Flush_Input</A></span>; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_util.3x.html">flushinp()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1639_14">Flush_Input</A>); -+ -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page <A HREF="../man/curs_termattrs.3x.html">curs_termattrs.3x</A></EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_131"#2|</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_1648_13" HREF="terminal_interface-curses__adb.htm#ref_2050_13">Baudrate</A></span> <b>return</b> Natural; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_termattrs.3x.html">baudrate()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1648_13">Baudrate</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_132"#2|</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_1653_13" HREF="terminal_interface-curses__adb.htm#ref_2058_13">Erase_Character</A></span> <b>return</b> Character; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_termattrs.3x.html">erasechar()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1653_13">Erase_Character</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_133"#2|</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_1658_13" HREF="terminal_interface-curses__adb.htm#ref_2066_13">Kill_Character</A></span> <b>return</b> Character; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_termattrs.3x.html">killchar()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1658_13">Kill_Character</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_134"#2|</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_1663_13" HREF="terminal_interface-curses__adb.htm#ref_2074_13">Has_Insert_Character</A></span> <b>return</b> Boolean; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_termattrs.3x.html">has_ic()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1663_13">Has_Insert_Character</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_135"#2|</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_1668_13" HREF="terminal_interface-curses__adb.htm#ref_2086_13">Has_Insert_Line</A></span> <b>return</b> Boolean; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_termattrs.3x.html">has_il()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1668_13">Has_Insert_Line</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_136"#2|</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_1673_13" HREF="terminal_interface-curses__adb.htm#ref_2098_13">Supported_Attributes</A></span> <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A>; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_termattrs.3x.html">termattrs()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1673_13">Supported_Attributes</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_137"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1678_14" HREF="terminal_interface-curses__adb.htm#ref_2108_14">Long_Name</A></span> (<span class="symbol"><A NAME="ref_1678_25" HREF="terminal_interface-curses__adb.htm#ref_2108_25">Name</A></span> : <b>out</b> String); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_termattrs.3x.html">longname()</A></EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_138"#2|</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_1682_13" HREF="terminal_interface-curses__adb.htm#ref_2116_13">Long_Name</A></span> <b>return</b> String; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_termattrs.3x.html">longname()</A></EM></span> -+ <span class="comment"><EM>-- Same as function</EM></span> - <b>pragma</b> Inline (Long_Name); - -- <FONT COLOR=green><EM>-- #1A NAME="AFU_139"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1689_14" HREF="terminal_interface-curses__adb.htm#ref_2124_14">Terminal_Name</A></FONT> (<FONT COLOR=red><A NAME="ref_1689_29" HREF="terminal_interface-curses__adb.htm#ref_2124_29">Name</A></FONT> : <b>out</b> String); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_termattrs.3x.html">termname()</A></EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_140"#2|</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1693_13" HREF="terminal_interface-curses__adb.htm#ref_2132_13">Terminal_Name</A></FONT> <b>return</b> String; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_termattrs.3x.html">termname()</A></EM></FONT> -- <FONT COLOR=green><EM>-- Same as function</EM></FONT> -+ <span class="comment"><EM>-- #1A NAME="AFU_139"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1688_14" HREF="terminal_interface-curses__adb.htm#ref_2124_14">Terminal_Name</A></span> (<span class="symbol"><A NAME="ref_1688_29" HREF="terminal_interface-curses__adb.htm#ref_2124_29">Name</A></span> : <b>out</b> String); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_termattrs.3x.html">termname()</A></EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_140"#2|</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_1692_13" HREF="terminal_interface-curses__adb.htm#ref_2132_13">Terminal_Name</A></span> <b>return</b> String; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_termattrs.3x.html">termname()</A></EM></span> -+ <span class="comment"><EM>-- Same as function</EM></span> - <b>pragma</b> Inline (Terminal_Name); - -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page <A HREF="../man/curs_color.3x.html">curs_color.3x</A></EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- -- <FONT COLOR=green><EM>-- COLOR_PAIR</EM></FONT> -- <FONT COLOR=green><EM>-- COLOR_PAIR(n) in C is the same as</EM></FONT> -- <FONT COLOR=green><EM>-- Attributed_Character(Ch =&gt; Nul, Color =&gt; n, Attr =&gt; Normal_Video)</EM></FONT> -- <FONT COLOR=green><EM>-- In C you often see something like c = c | COLOR_PAIR(n);</EM></FONT> -- <FONT COLOR=green><EM>-- This is equivalent to c.Color := n;</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_141"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1709_14">Start_Color</A></FONT>; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_color.3x.html">start_color()</A></EM></FONT> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page <A HREF="../man/curs_color.3x.html">curs_color.3x</A></EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ -+ <span class="comment"><EM>-- COLOR_PAIR</EM></span> -+ <span class="comment"><EM>-- COLOR_PAIR(n) in C is the same as</EM></span> -+ <span class="comment"><EM>-- Attributed_Character(Ch =&gt; Nul, Color =&gt; n, Attr =&gt; Normal_Video)</EM></span> -+ <span class="comment"><EM>-- In C you often see something like c = c | COLOR_PAIR(n);</EM></span> -+ <span class="comment"><EM>-- This is equivalent to c.Color := n;</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_141"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1708_14">Start_Color</A></span>; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_color.3x.html">start_color()</A></EM></span> - <b>pragma</b> Import (C, Start_Color, "start_color"); - -- <FONT COLOR=green><EM>-- #1A NAME="AFU_142"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1714_14" HREF="terminal_interface-curses__adb.htm#ref_2140_14">Init_Pair</A></FONT> (<FONT COLOR=red><A NAME="ref_1714_25" HREF="terminal_interface-curses__adb.htm#ref_2140_25">Pair</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_301_12">Redefinable_Color_Pair</A>; -- <FONT COLOR=red><A NAME="ref_1715_25" HREF="terminal_interface-curses__adb.htm#ref_2141_25">Fore</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_278_9">Color_Number</A>; -- <FONT COLOR=red><A NAME="ref_1716_25" HREF="terminal_interface-curses__adb.htm#ref_2142_25">Back</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_278_9">Color_Number</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_color.3x.html">init_pair()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1714_14">Init_Pair</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_143"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1721_14" HREF="terminal_interface-curses__adb.htm#ref_2162_14">Pair_Content</A></FONT> (<FONT COLOR=red><A NAME="ref_1721_28" HREF="terminal_interface-curses__adb.htm#ref_2162_28">Pair</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>; -- <FONT COLOR=red><A NAME="ref_1722_28" HREF="terminal_interface-curses__adb.htm#ref_2163_28">Fore</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_278_9">Color_Number</A>; -- <FONT COLOR=red><A NAME="ref_1723_28" HREF="terminal_interface-curses__adb.htm#ref_2164_28">Back</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_278_9">Color_Number</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_color.3x.html">pair_content()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1721_14">Pair_Content</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_144"#2|</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1728_13" HREF="terminal_interface-curses__adb.htm#ref_2182_13">Has_Colors</A></FONT> <b>return</b> Boolean; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_color.3x.html">has_colors()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1728_13">Has_Colors</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_145"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1733_14" HREF="terminal_interface-curses__adb.htm#ref_2194_14">Init_Color</A></FONT> (<FONT COLOR=red><A NAME="ref_1733_26" HREF="terminal_interface-curses__adb.htm#ref_2194_26">Color</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_278_9">Color_Number</A>; -- <FONT COLOR=red><A NAME="ref_1734_26" HREF="terminal_interface-curses__adb.htm#ref_2195_26">Red</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_295_9">RGB_Value</A>; -- <FONT COLOR=red><A NAME="ref_1735_26" HREF="terminal_interface-curses__adb.htm#ref_2196_26">Green</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_295_9">RGB_Value</A>; -- <FONT COLOR=red><A NAME="ref_1736_26" HREF="terminal_interface-curses__adb.htm#ref_2197_26">Blue</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_295_9">RGB_Value</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_color.3x.html">init_color()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1733_14">Init_Color</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_146"#2|</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1741_13" HREF="terminal_interface-curses__adb.htm#ref_2211_13">Can_Change_Color</A></FONT> <b>return</b> Boolean; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_color.3x.html">can_change_color()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1741_13">Can_Change_Color</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_147"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1746_14" HREF="terminal_interface-curses__adb.htm#ref_2223_14">Color_Content</A></FONT> (<FONT COLOR=red><A NAME="ref_1746_29" HREF="terminal_interface-curses__adb.htm#ref_2223_29">Color</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_278_9">Color_Number</A>; -- <FONT COLOR=red><A NAME="ref_1747_29" HREF="terminal_interface-curses__adb.htm#ref_2224_29">Red</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_295_9">RGB_Value</A>; -- <FONT COLOR=red><A NAME="ref_1748_29" HREF="terminal_interface-curses__adb.htm#ref_2225_29">Green</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_295_9">RGB_Value</A>; -- <FONT COLOR=red><A NAME="ref_1749_29" HREF="terminal_interface-curses__adb.htm#ref_2226_29">Blue</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_295_9">RGB_Value</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_color.3x.html">color_content()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1746_14">Color_Content</A>); -- -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page <A HREF="../man/curs_kernel.3x.html">curs_kernel.3x</A></EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Not implemented: getsyx, setsyx</EM></FONT> -- <FONT COLOR=green><EM>--</EM></FONT> -- <b>type</b> <FONT COLOR=red><A NAME="ref_1758_9">Curses_Mode</A></FONT> <b>is</b> (<FONT COLOR=red><A NAME="ref_1758_25">Curses</A></FONT>, <FONT COLOR=red><A NAME="ref_1758_33">Shell</A></FONT>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_148"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1761_14" HREF="terminal_interface-curses__adb.htm#ref_2247_14">Save_Curses_Mode</A></FONT> (<FONT COLOR=red><A NAME="ref_1761_32" HREF="terminal_interface-curses__adb.htm#ref_2247_32">Mode</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_1758_9">Curses_Mode</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_kernel.3x.html">def_prog_mode()</A></EM></FONT> -- <FONT COLOR=green><EM>-- AKA: def_shell_mode()</EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1761_14">Save_Curses_Mode</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_149"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1767_14" HREF="terminal_interface-curses__adb.htm#ref_2265_14">Reset_Curses_Mode</A></FONT> (<FONT COLOR=red><A NAME="ref_1767_33" HREF="terminal_interface-curses__adb.htm#ref_2265_33">Mode</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_1758_9">Curses_Mode</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_kernel.3x.html">reset_prog_mode()</A></EM></FONT> -- <FONT COLOR=green><EM>-- AKA: reset_shell_mode()</EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1767_14">Reset_Curses_Mode</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_150"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1773_14" HREF="terminal_interface-curses__adb.htm#ref_2283_14">Save_Terminal_State</A></FONT>; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_kernel.3x.html">savetty()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1773_14">Save_Terminal_State</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_151"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1778_14" HREF="terminal_interface-curses__adb.htm#ref_2293_14">Reset_Terminal_State</A></FONT>; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_kernel.3x.html">resetty();</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1778_14">Reset_Terminal_State</A>); -- -- <b>type</b> <FONT COLOR=red><A NAME="ref_1782_9">Stdscr_Init_Proc</A></FONT> <b>is</b> <b>access</b> -- <b>function</b> (<FONT COLOR=red><A NAME="ref_1783_17">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- <FONT COLOR=red><A NAME="ref_1784_17">Columns</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_65_12">Column_Count</A>) <b>return</b> Integer; -- <b>pragma</b> Convention (C, <A HREF="terminal_interface-curses__ads.htm#ref_1782_9">Stdscr_Init_Proc</A>); -- <FONT COLOR=green><EM>-- N.B.: the return value is actually ignored, but it seems to be</EM></FONT> -- <FONT COLOR=green><EM>-- a good practice to return 0 if you think all went fine</EM></FONT> -- <FONT COLOR=green><EM>-- and -1 otherwise.</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_152"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1791_14" HREF="terminal_interface-curses__adb.htm#ref_2303_14">Rip_Off_Lines</A></FONT> (<FONT COLOR=red><A NAME="ref_1791_29" HREF="terminal_interface-curses__adb.htm#ref_2303_29">Lines</A></FONT> : Integer; -- <FONT COLOR=red><A NAME="ref_1792_29" HREF="terminal_interface-curses__adb.htm#ref_2304_29">Proc</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_1782_9">Stdscr_Init_Proc</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_kernel.3x.html">ripoffline()</A></EM></FONT> -- <FONT COLOR=green><EM>-- N.B.: to be more precise, this uses a ncurses specific enhancement of</EM></FONT> -- <FONT COLOR=green><EM>-- ripoffline(), in which the Lines argument absolute value is the</EM></FONT> -- <FONT COLOR=green><EM>-- number of lines to be ripped of. The official ripoffline() only</EM></FONT> -- <FONT COLOR=green><EM>-- uses the sign of Lines to remove a single line from bottom or top.</EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1791_14">Rip_Off_Lines</A>); -- -- <b>type</b> <FONT COLOR=red><A NAME="ref_1800_9">Cursor_Visibility</A></FONT> <b>is</b> (<FONT COLOR=red><A NAME="ref_1800_31">Invisible</A></FONT>, <FONT COLOR=red><A NAME="ref_1800_42">Normal</A></FONT>, <FONT COLOR=red><A NAME="ref_1800_50">Very_Visible</A></FONT>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_153"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1803_14" HREF="terminal_interface-curses__adb.htm#ref_2315_14">Set_Cursor_Visibility</A></FONT> (<FONT COLOR=red><A NAME="ref_1803_37" HREF="terminal_interface-curses__adb.htm#ref_2315_37">Visibility</A></FONT> : <b>in</b> <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_1800_9">Cursor_Visibility</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_kernel.3x.html">curs_set()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1803_14">Set_Cursor_Visibility</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_154"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1808_14" HREF="terminal_interface-curses__adb.htm#ref_2328_14">Nap_Milli_Seconds</A></FONT> (<FONT COLOR=red><A NAME="ref_1808_33" HREF="terminal_interface-curses__adb.htm#ref_2328_33">Ms</A></FONT> : Natural); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_kernel.3x.html">napms()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1808_14">Nap_Milli_Seconds</A>); -- -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Some useful helpers.</EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <b>type</b> <FONT COLOR=red><A NAME="ref_1815_9">Transform_Direction</A></FONT> <b>is</b> (<FONT COLOR=red><A NAME="ref_1815_33">From_Screen</A></FONT>, <FONT COLOR=red><A NAME="ref_1815_46">To_Screen</A></FONT>); -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1816_14" HREF="terminal_interface-curses__adb.htm#ref_2396_14">Transform_Coordinates</A></FONT> -- (<FONT COLOR=red><A NAME="ref_1817_7" HREF="terminal_interface-curses__adb.htm#ref_2397_7">W</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_1818_7" HREF="terminal_interface-curses__adb.htm#ref_2398_7">Line</A></FONT> : <b>in</b> <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_1819_7" HREF="terminal_interface-curses__adb.htm#ref_2399_7">Column</A></FONT> : <b>in</b> <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -- <FONT COLOR=red><A NAME="ref_1820_7" HREF="terminal_interface-curses__adb.htm#ref_2400_7">Dir</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_1815_9">Transform_Direction</A> := <A HREF="terminal_interface-curses__ads.htm#ref_1815_33">From_Screen</A>); -- <FONT COLOR=green><EM>-- This procedure transforms screen coordinates into coordinates relative</EM></FONT> -- <FONT COLOR=green><EM>-- to the window and vice versa, depending on the Dir parameter.</EM></FONT> -- <FONT COLOR=green><EM>-- Screen coordinates are the position information for the physical device.</EM></FONT> -- <FONT COLOR=green><EM>-- An Curses_Exception will be raised if Line and Column are not in the</EM></FONT> -- <FONT COLOR=green><EM>-- Window or if you pass the Null_Window as argument.</EM></FONT> -- <FONT COLOR=green><EM>-- We do not inline this procedure</EM></FONT> -- -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page <A HREF="../man/default_colors.3x.html">default_colors.3x</A></EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_155"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1833_14" HREF="terminal_interface-curses__adb.htm#ref_2425_14">Use_Default_Colors</A></FONT>; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/default_colors.3x.html">use_default_colors()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1833_14">Use_Default_Colors</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_156"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1838_14" HREF="terminal_interface-curses__adb.htm#ref_2435_14">Assume_Default_Colors</A></FONT> (<FONT COLOR=red><A NAME="ref_1838_37" HREF="terminal_interface-curses__adb.htm#ref_2435_37">Fore</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_278_9">Color_Number</A> := <A HREF="terminal_interface-curses__ads.htm#ref_285_4">Default_Color</A>; -- <FONT COLOR=red><A NAME="ref_1839_37" HREF="terminal_interface-curses__adb.htm#ref_2436_37">Back</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_278_9">Color_Number</A> := <A HREF="terminal_interface-curses__ads.htm#ref_285_4">Default_Color</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/default_colors.3x.html">assume_default_colors()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1838_14">Assume_Default_Colors</A>); -- -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page <A HREF="../man/curs_extend.3x.html">curs_extend.3x</A></EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_157"#2|</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1848_13" HREF="terminal_interface-curses__adb.htm#ref_2450_13">Curses_Version</A></FONT> <b>return</b> String; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_extend.3x.html">curses_version()</A></EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_158"#2|</EM></FONT> -- <FONT COLOR=green><EM>-- The returnvalue is the previous setting of the flag</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1853_13" HREF="terminal_interface-curses__adb.htm#ref_2473_13">Use_Extended_Names</A></FONT> (<FONT COLOR=red><A NAME="ref_1853_33" HREF="terminal_interface-curses__adb.htm#ref_2473_33">Enable</A></FONT> : Boolean) <b>return</b> Boolean; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_extend.3x.html">use_extended_names()</A></EM></FONT> -- -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page <A HREF="../man/curs_trace.3x.html">curs_trace.3x</A></EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_159"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1861_14" HREF="terminal_interface-curses__adb.htm#ref_2459_14">Curses_Free_All</A></FONT>; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_trace.3x.html">_nc_freeall()</A></EM></FONT> -- -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page <A HREF="../man/curs_scr_dump.3x.html">curs_scr_dump.3x</A></EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_160"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1869_14" HREF="terminal_interface-curses__adb.htm#ref_2488_14">Screen_Dump_To_File</A></FONT> (<FONT COLOR=red><A NAME="ref_1869_35" HREF="terminal_interface-curses__adb.htm#ref_2488_35">Filename</A></FONT> : String); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_scr_dump.3x.html">scr_dump()</A></EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_161"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1873_14" HREF="terminal_interface-curses__adb.htm#ref_2501_14">Screen_Restore_From_File</A></FONT> (<FONT COLOR=red><A NAME="ref_1873_40" HREF="terminal_interface-curses__adb.htm#ref_2501_40">Filename</A></FONT> : String); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_scr_dump.3x.html">scr_restore()</A></EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_162"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1877_14" HREF="terminal_interface-curses__adb.htm#ref_2514_14">Screen_Init_From_File</A></FONT> (<FONT COLOR=red><A NAME="ref_1877_37" HREF="terminal_interface-curses__adb.htm#ref_2514_37">Filename</A></FONT> : String); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_scr_dump.3x.html">scr_init()</A></EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_163"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1881_14" HREF="terminal_interface-curses__adb.htm#ref_2527_14">Screen_Set_File</A></FONT> (<FONT COLOR=red><A NAME="ref_1881_31" HREF="terminal_interface-curses__adb.htm#ref_2527_31">Filename</A></FONT> : String); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_scr_dump.3x.html">scr_set()</A></EM></FONT> -- -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page <A HREF="../man/curs_print.3x.html">curs_print.3x</A></EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- Not implemented: mcprint</EM></FONT> -- -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page <A HREF="../man/curs_printw.3x.html">curs_printw.3x</A></EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- Not implemented: printw, wprintw, mvprintw, mvwprintw, vwprintw,</EM></FONT> -- <FONT COLOR=green><EM>-- vw_printw</EM></FONT> -- <FONT COLOR=green><EM>-- Please use the Ada style Text_IO child packages for formatted</EM></FONT> -- <FONT COLOR=green><EM>-- printing. It does not make a lot of sense to map the printf style</EM></FONT> -- <FONT COLOR=green><EM>-- C functions to Ada.</EM></FONT> -- -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page <A HREF="../man/curs_scanw.3x.html">curs_scanw.3x</A></EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- Not implemented: scanw, wscanw, mvscanw, mvwscanw, vwscanw, vw_scanw</EM></FONT> -- -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page <A HREF="../man/resizeterm.3x.html">resizeterm.3x</A></EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- Not Implemented: resizeterm</EM></FONT> -- -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page <A HREF="../man/wresize.3x.html">wresize.3x</A></EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_164"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1913_14" HREF="terminal_interface-curses__adb.htm#ref_2540_14">Resize</A></FONT> (<FONT COLOR=red><A NAME="ref_1913_22" HREF="terminal_interface-curses__adb.htm#ref_2540_22">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_1914_22" HREF="terminal_interface-curses__adb.htm#ref_2541_22">Number_Of_Lines</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_63_12">Line_Count</A>; -- <FONT COLOR=red><A NAME="ref_1915_22" HREF="terminal_interface-curses__adb.htm#ref_2542_22">Number_Of_Columns</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_65_12">Column_Count</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/wresize.3x.html">wresize()</A></EM></FONT> -+ <span class="comment"><EM>-- #1A NAME="AFU_142"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1713_14" HREF="terminal_interface-curses__adb.htm#ref_2140_14">Init_Pair</A></span> (<span class="symbol"><A NAME="ref_1713_25" HREF="terminal_interface-curses__adb.htm#ref_2140_25">Pair</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_301_12">Redefinable_Color_Pair</A>; -+ <span class="symbol"><A NAME="ref_1714_25" HREF="terminal_interface-curses__adb.htm#ref_2141_25">Fore</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_278_9">Color_Number</A>; -+ <span class="symbol"><A NAME="ref_1715_25" HREF="terminal_interface-curses__adb.htm#ref_2142_25">Back</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_278_9">Color_Number</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_color.3x.html">init_pair()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1713_14">Init_Pair</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_143"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1720_14" HREF="terminal_interface-curses__adb.htm#ref_2162_14">Pair_Content</A></span> (<span class="symbol"><A NAME="ref_1720_28" HREF="terminal_interface-curses__adb.htm#ref_2162_28">Pair</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>; -+ <span class="symbol"><A NAME="ref_1721_28" HREF="terminal_interface-curses__adb.htm#ref_2163_28">Fore</A></span> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_278_9">Color_Number</A>; -+ <span class="symbol"><A NAME="ref_1722_28" HREF="terminal_interface-curses__adb.htm#ref_2164_28">Back</A></span> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_278_9">Color_Number</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_color.3x.html">pair_content()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1720_14">Pair_Content</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_144"#2|</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_1727_13" HREF="terminal_interface-curses__adb.htm#ref_2182_13">Has_Colors</A></span> <b>return</b> Boolean; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_color.3x.html">has_colors()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1727_13">Has_Colors</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_145"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1732_14" HREF="terminal_interface-curses__adb.htm#ref_2194_14">Init_Color</A></span> (<span class="symbol"><A NAME="ref_1732_26" HREF="terminal_interface-curses__adb.htm#ref_2194_26">Color</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_278_9">Color_Number</A>; -+ <span class="symbol"><A NAME="ref_1733_26" HREF="terminal_interface-curses__adb.htm#ref_2195_26">Red</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_295_9">RGB_Value</A>; -+ <span class="symbol"><A NAME="ref_1734_26" HREF="terminal_interface-curses__adb.htm#ref_2196_26">Green</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_295_9">RGB_Value</A>; -+ <span class="symbol"><A NAME="ref_1735_26" HREF="terminal_interface-curses__adb.htm#ref_2197_26">Blue</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_295_9">RGB_Value</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_color.3x.html">init_color()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1732_14">Init_Color</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_146"#2|</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_1740_13" HREF="terminal_interface-curses__adb.htm#ref_2211_13">Can_Change_Color</A></span> <b>return</b> Boolean; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_color.3x.html">can_change_color()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1740_13">Can_Change_Color</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_147"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1745_14" HREF="terminal_interface-curses__adb.htm#ref_2223_14">Color_Content</A></span> (<span class="symbol"><A NAME="ref_1745_29" HREF="terminal_interface-curses__adb.htm#ref_2223_29">Color</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_278_9">Color_Number</A>; -+ <span class="symbol"><A NAME="ref_1746_29" HREF="terminal_interface-curses__adb.htm#ref_2224_29">Red</A></span> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_295_9">RGB_Value</A>; -+ <span class="symbol"><A NAME="ref_1747_29" HREF="terminal_interface-curses__adb.htm#ref_2225_29">Green</A></span> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_295_9">RGB_Value</A>; -+ <span class="symbol"><A NAME="ref_1748_29" HREF="terminal_interface-curses__adb.htm#ref_2226_29">Blue</A></span> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_295_9">RGB_Value</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_color.3x.html">color_content()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1745_14">Color_Content</A>); -+ -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page <A HREF="../man/curs_kernel.3x.html">curs_kernel.3x</A></EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Not implemented: getsyx, setsyx</EM></span> -+ <span class="comment"><EM>--</EM></span> -+ <b>type</b> <span class="symbol"><A NAME="ref_1757_9">Curses_Mode</A></span> <b>is</b> (<span class="symbol"><A NAME="ref_1757_25">Curses</A></span>, <span class="symbol"><A NAME="ref_1757_33">Shell</A></span>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_148"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1760_14" HREF="terminal_interface-curses__adb.htm#ref_2247_14">Save_Curses_Mode</A></span> (<span class="symbol"><A NAME="ref_1760_32" HREF="terminal_interface-curses__adb.htm#ref_2247_32">Mode</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_1757_9">Curses_Mode</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_kernel.3x.html">def_prog_mode()</A></EM></span> -+ <span class="comment"><EM>-- AKA: def_shell_mode()</EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1760_14">Save_Curses_Mode</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_149"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1766_14" HREF="terminal_interface-curses__adb.htm#ref_2265_14">Reset_Curses_Mode</A></span> (<span class="symbol"><A NAME="ref_1766_33" HREF="terminal_interface-curses__adb.htm#ref_2265_33">Mode</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_1757_9">Curses_Mode</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_kernel.3x.html">reset_prog_mode()</A></EM></span> -+ <span class="comment"><EM>-- AKA: reset_shell_mode()</EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1766_14">Reset_Curses_Mode</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_150"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1772_14" HREF="terminal_interface-curses__adb.htm#ref_2283_14">Save_Terminal_State</A></span>; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_kernel.3x.html">savetty()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1772_14">Save_Terminal_State</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_151"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1777_14" HREF="terminal_interface-curses__adb.htm#ref_2293_14">Reset_Terminal_State</A></span>; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_kernel.3x.html">resetty();</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1777_14">Reset_Terminal_State</A>); -+ -+ <b>type</b> <span class="symbol"><A NAME="ref_1781_9">Stdscr_Init_Proc</A></span> <b>is</b> <b>access</b> -+ <b>function</b> (<span class="symbol"><A NAME="ref_1782_17">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="symbol"><A NAME="ref_1783_17">Columns</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_65_12">Column_Count</A>) <b>return</b> Integer; -+ <b>pragma</b> Convention (C, <A HREF="terminal_interface-curses__ads.htm#ref_1781_9">Stdscr_Init_Proc</A>); -+ <span class="comment"><EM>-- N.B.: the return value is actually ignored, but it seems to be</EM></span> -+ <span class="comment"><EM>-- a good practice to return 0 if you think all went fine</EM></span> -+ <span class="comment"><EM>-- and -1 otherwise.</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_152"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1790_14" HREF="terminal_interface-curses__adb.htm#ref_2303_14">Rip_Off_Lines</A></span> (<span class="symbol"><A NAME="ref_1790_29" HREF="terminal_interface-curses__adb.htm#ref_2303_29">Lines</A></span> : Integer; -+ <span class="symbol"><A NAME="ref_1791_29" HREF="terminal_interface-curses__adb.htm#ref_2304_29">Proc</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_1781_9">Stdscr_Init_Proc</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_kernel.3x.html">ripoffline()</A></EM></span> -+ <span class="comment"><EM>-- N.B.: to be more precise, this uses a ncurses specific enhancement of</EM></span> -+ <span class="comment"><EM>-- ripoffline(), in which the Lines argument absolute value is the</EM></span> -+ <span class="comment"><EM>-- number of lines to be ripped of. The official ripoffline() only</EM></span> -+ <span class="comment"><EM>-- uses the sign of Lines to remove a single line from bottom or top.</EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1790_14">Rip_Off_Lines</A>); -+ -+ <b>type</b> <span class="symbol"><A NAME="ref_1799_9">Cursor_Visibility</A></span> <b>is</b> (<span class="symbol"><A NAME="ref_1799_31">Invisible</A></span>, <span class="symbol"><A NAME="ref_1799_42">Normal</A></span>, <span class="symbol"><A NAME="ref_1799_50">Very_Visible</A></span>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_153"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1802_14" HREF="terminal_interface-curses__adb.htm#ref_2315_14">Set_Cursor_Visibility</A></span> (<span class="symbol"><A NAME="ref_1802_37" HREF="terminal_interface-curses__adb.htm#ref_2315_37">Visibility</A></span> : <b>in</b> <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_1799_9">Cursor_Visibility</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_kernel.3x.html">curs_set()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1802_14">Set_Cursor_Visibility</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_154"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1807_14" HREF="terminal_interface-curses__adb.htm#ref_2328_14">Nap_Milli_Seconds</A></span> (<span class="symbol"><A NAME="ref_1807_33" HREF="terminal_interface-curses__adb.htm#ref_2328_33">Ms</A></span> : Natural); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_kernel.3x.html">napms()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1807_14">Nap_Milli_Seconds</A>); -+ -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Some useful helpers.</EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <b>type</b> <span class="symbol"><A NAME="ref_1814_9">Transform_Direction</A></span> <b>is</b> (<span class="symbol"><A NAME="ref_1814_33">From_Screen</A></span>, <span class="symbol"><A NAME="ref_1814_46">To_Screen</A></span>); -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1815_14" HREF="terminal_interface-curses__adb.htm#ref_2396_14">Transform_Coordinates</A></span> -+ (<span class="symbol"><A NAME="ref_1816_7" HREF="terminal_interface-curses__adb.htm#ref_2397_7">W</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_1817_7" HREF="terminal_interface-curses__adb.htm#ref_2398_7">Line</A></span> : <b>in</b> <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_1818_7" HREF="terminal_interface-curses__adb.htm#ref_2399_7">Column</A></span> : <b>in</b> <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -+ <span class="symbol"><A NAME="ref_1819_7" HREF="terminal_interface-curses__adb.htm#ref_2400_7">Dir</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_1814_9">Transform_Direction</A> := <A HREF="terminal_interface-curses__ads.htm#ref_1814_33">From_Screen</A>); -+ <span class="comment"><EM>-- This procedure transforms screen coordinates into coordinates relative</EM></span> -+ <span class="comment"><EM>-- to the window and vice versa, depending on the Dir parameter.</EM></span> -+ <span class="comment"><EM>-- Screen coordinates are the position information for the physical device.</EM></span> -+ <span class="comment"><EM>-- An Curses_Exception will be raised if Line and Column are not in the</EM></span> -+ <span class="comment"><EM>-- Window or if you pass the Null_Window as argument.</EM></span> -+ <span class="comment"><EM>-- We do not inline this procedure</EM></span> -+ -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page <A HREF="../man/default_colors.3x.html">default_colors.3x</A></EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_155"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1832_14" HREF="terminal_interface-curses__adb.htm#ref_2425_14">Use_Default_Colors</A></span>; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/default_colors.3x.html">use_default_colors()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1832_14">Use_Default_Colors</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_156"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1837_14" HREF="terminal_interface-curses__adb.htm#ref_2435_14">Assume_Default_Colors</A></span> (<span class="symbol"><A NAME="ref_1837_37" HREF="terminal_interface-curses__adb.htm#ref_2435_37">Fore</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_278_9">Color_Number</A> := <A HREF="terminal_interface-curses__ads.htm#ref_285_4">Default_Color</A>; -+ <span class="symbol"><A NAME="ref_1838_37" HREF="terminal_interface-curses__adb.htm#ref_2436_37">Back</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_278_9">Color_Number</A> := <A HREF="terminal_interface-curses__ads.htm#ref_285_4">Default_Color</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/default_colors.3x.html">assume_default_colors()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses__ads.htm#ref_1837_14">Assume_Default_Colors</A>); -+ -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page <A HREF="../man/curs_extend.3x.html">curs_extend.3x</A></EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_157"#2|</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_1847_13" HREF="terminal_interface-curses__adb.htm#ref_2450_13">Curses_Version</A></span> <b>return</b> String; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_extend.3x.html">curses_version()</A></EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_158"#2|</EM></span> -+ <span class="comment"><EM>-- The returnvalue is the previous setting of the flag</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_1852_13" HREF="terminal_interface-curses__adb.htm#ref_2473_13">Use_Extended_Names</A></span> (<span class="symbol"><A NAME="ref_1852_33" HREF="terminal_interface-curses__adb.htm#ref_2473_33">Enable</A></span> : Boolean) <b>return</b> Boolean; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_extend.3x.html">use_extended_names()</A></EM></span> -+ -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page <A HREF="../man/curs_trace.3x.html">curs_trace.3x</A></EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_159"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1860_14" HREF="terminal_interface-curses__adb.htm#ref_2459_14">Curses_Free_All</A></span>; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_trace.3x.html">_nc_freeall()</A></EM></span> -+ -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page <A HREF="../man/curs_scr_dump.3x.html">curs_scr_dump.3x</A></EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_160"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1868_14" HREF="terminal_interface-curses__adb.htm#ref_2488_14">Screen_Dump_To_File</A></span> (<span class="symbol"><A NAME="ref_1868_35" HREF="terminal_interface-curses__adb.htm#ref_2488_35">Filename</A></span> : String); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_scr_dump.3x.html">scr_dump()</A></EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_161"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1872_14" HREF="terminal_interface-curses__adb.htm#ref_2501_14">Screen_Restore_From_File</A></span> (<span class="symbol"><A NAME="ref_1872_40" HREF="terminal_interface-curses__adb.htm#ref_2501_40">Filename</A></span> : String); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_scr_dump.3x.html">scr_restore()</A></EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_162"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1876_14" HREF="terminal_interface-curses__adb.htm#ref_2514_14">Screen_Init_From_File</A></span> (<span class="symbol"><A NAME="ref_1876_37" HREF="terminal_interface-curses__adb.htm#ref_2514_37">Filename</A></span> : String); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_scr_dump.3x.html">scr_init()</A></EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_163"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1880_14" HREF="terminal_interface-curses__adb.htm#ref_2527_14">Screen_Set_File</A></span> (<span class="symbol"><A NAME="ref_1880_31" HREF="terminal_interface-curses__adb.htm#ref_2527_31">Filename</A></span> : String); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_scr_dump.3x.html">scr_set()</A></EM></span> -+ -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page <A HREF="../man/curs_print.3x.html">curs_print.3x</A></EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- Not implemented: mcprint</EM></span> -+ -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page <A HREF="../man/curs_printw.3x.html">curs_printw.3x</A></EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- Not implemented: printw, wprintw, mvprintw, mvwprintw, vwprintw,</EM></span> -+ <span class="comment"><EM>-- vw_printw</EM></span> -+ <span class="comment"><EM>-- Please use the Ada style Text_IO child packages for formatted</EM></span> -+ <span class="comment"><EM>-- printing. It does not make a lot of sense to map the printf style</EM></span> -+ <span class="comment"><EM>-- C functions to Ada.</EM></span> -+ -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page <A HREF="../man/curs_scanw.3x.html">curs_scanw.3x</A></EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- Not implemented: scanw, wscanw, mvscanw, mvwscanw, vwscanw, vw_scanw</EM></span> -+ -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page <A HREF="../man/resizeterm.3x.html">resizeterm.3x</A></EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- Not Implemented: resizeterm</EM></span> -+ -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page <A HREF="../man/wresize.3x.html">wresize.3x</A></EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_164"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1912_14" HREF="terminal_interface-curses__adb.htm#ref_2540_14">Resize</A></span> (<span class="symbol"><A NAME="ref_1912_22" HREF="terminal_interface-curses__adb.htm#ref_2540_22">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_1913_22" HREF="terminal_interface-curses__adb.htm#ref_2541_22">Number_Of_Lines</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_63_12">Line_Count</A>; -+ <span class="symbol"><A NAME="ref_1914_22" HREF="terminal_interface-curses__adb.htm#ref_2542_22">Number_Of_Columns</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_65_12">Column_Count</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/wresize.3x.html">wresize()</A></EM></span> - - <b>private</b> - <b>type</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> <b>is</b> <b>new</b> System.Storage_Elements.Integer_Address; - <A HREF="terminal_interface-curses__ads.htm#ref_58_4">Null_Window</A> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := 0; - -- <FONT COLOR=green><EM>-- The next constants are generated and may be different on your</EM></FONT> -- <FONT COLOR=green><EM>-- architecture.</EM></FONT> -- <FONT COLOR=green><EM>--</EM></FONT> -- <FONT COLOR=red><A NAME="ref_1925_4">Sizeof_bool</A></FONT> : <b>constant</b> Natural := 1; <FONT COLOR=green><EM>-- bool</EM></FONT> -- <b>type</b> <FONT COLOR=red><A NAME="ref_1926_9">Curses_Bool</A></FONT> <b>is</b> <b>mod</b> 2 ** <A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>.C.char'Size; -- <FONT COLOR=red><A NAME="ref_1927_4">Curses_Bool_False</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_1926_9">Curses_Bool</A> := 0; -+ <span class="comment"><EM>-- The next constants are generated and may be different on your</EM></span> -+ <span class="comment"><EM>-- architecture.</EM></span> -+ <span class="comment"><EM>--</EM></span> -+ <span class="symbol"><A NAME="ref_1924_4">Sizeof_bool</A></span> : <b>constant</b> Natural := 1; <span class="comment"><EM>-- bool</EM></span> -+ <b>type</b> <span class="symbol"><A NAME="ref_1925_9">Curses_Bool</A></span> <b>is</b> <b>mod</b> 2 ** <A HREF="interfac__ads.htm#ref_36_9">Interfaces</A>.C.char'Size; -+ <span class="symbol"><A NAME="ref_1926_4">Curses_Bool_False</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_1925_9">Curses_Bool</A> := 0; - - <b>end</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>; - </PRE></BODY></HTML> -diff -Naur ncurses-5.9/doc/html/ada/terminal_interface-curses-aux__adb.htm ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-aux__adb.htm ---- ncurses-5.9/doc/html/ada/terminal_interface-curses-aux__adb.htm 2011-03-20 00:18:39.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-aux__adb.htm 2014-09-01 16:33:22.272791983 +0200 -@@ -1,58 +1,70 @@ --<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> --<HTML><HEAD><TITLE>terminal_interface-curses-aux.adb</TITLE></HEAD> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> -+<HTML> -+<HEAD> -+<TITLE>terminal_interface-curses-aux.adb</TITLE> -+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> -+<style type="text/css"> -+*.comment { -+ color: green; -+} -+*.symbol { -+ color: red; -+} -+</style> -+</HEAD> - <BODY> --<HR><DIV ALIGN="center"><H1> File : terminal_interface-curses-aux.adb </H1></DIV><HR> -+<HR><DIV style="text-align:center"><H1> File : terminal_interface-curses-aux.adb </H1></DIV><HR> - <PRE> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Terminal_Interface.Curses.Aux --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- B O D Y --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Copyright (c) 1998-2003,2009 Free Software Foundation, Inc. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></FONT> --<FONT COLOR=green><EM>-- copy of this software and associated documentation files (the --</EM></FONT> --<FONT COLOR=green><EM>-- "Software"), to deal in the Software without restriction, including --</EM></FONT> --<FONT COLOR=green><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></FONT> --<FONT COLOR=green><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></FONT> --<FONT COLOR=green><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></FONT> --<FONT COLOR=green><EM>-- furnished to do so, subject to the following conditions: --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- The above copyright notice and this permission notice shall be included --</EM></FONT> --<FONT COLOR=green><EM>-- in all copies or substantial portions of the Software. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></FONT> --<FONT COLOR=green><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></FONT> --<FONT COLOR=green><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></FONT> --<FONT COLOR=green><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></FONT> --<FONT COLOR=green><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></FONT> --<FONT COLOR=green><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></FONT> --<FONT COLOR=green><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></FONT> --<FONT COLOR=green><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></FONT> --<FONT COLOR=green><EM>-- sale, use or other dealings in this Software without prior written --</EM></FONT> --<FONT COLOR=green><EM>-- authorization. --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Author: Juergen Pfeifer, 1996</EM></FONT> --<FONT COLOR=green><EM>-- Version Control:</EM></FONT> --<FONT COLOR=green><EM>-- @Revision: 1.11 @</EM></FONT> --<FONT COLOR=green><EM>-- Binding Version 01.00</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<b>package</b> <b>body</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<FONT COLOR=red><A NAME="ref_41_40" HREF="terminal_interface-curses-aux__ads.htm#ref_50_35">Aux</A></FONT> <b>is</b> -- <FONT COLOR=green><EM>--</EM></FONT> -- <FONT COLOR=green><EM>-- Some helpers</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_44_14" HREF="terminal_interface-curses-aux__ads.htm#ref_116_14">Fill_String</A></FONT> (<FONT COLOR=red><A NAME="ref_44_27" HREF="terminal_interface-curses-aux__ads.htm#ref_116_27">Cp</A></FONT> : chars_ptr; -- <FONT COLOR=red><A NAME="ref_45_27" HREF="terminal_interface-curses-aux__ads.htm#ref_117_27">Str</A></FONT> : <b>out</b> String) -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Terminal_Interface.Curses.Aux --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- B O D Y --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Copyright (c) 1998-2003,2009 Free Software Foundation, Inc. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></span> -+<span class="comment"><EM>-- copy of this software and associated documentation files (the --</EM></span> -+<span class="comment"><EM>-- "Software"), to deal in the Software without restriction, including --</EM></span> -+<span class="comment"><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></span> -+<span class="comment"><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></span> -+<span class="comment"><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></span> -+<span class="comment"><EM>-- furnished to do so, subject to the following conditions: --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- The above copyright notice and this permission notice shall be included --</EM></span> -+<span class="comment"><EM>-- in all copies or substantial portions of the Software. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></span> -+<span class="comment"><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></span> -+<span class="comment"><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></span> -+<span class="comment"><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></span> -+<span class="comment"><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></span> -+<span class="comment"><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></span> -+<span class="comment"><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></span> -+<span class="comment"><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></span> -+<span class="comment"><EM>-- sale, use or other dealings in this Software without prior written --</EM></span> -+<span class="comment"><EM>-- authorization. --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Author: Juergen Pfeifer, 1996</EM></span> -+<span class="comment"><EM>-- Version Control:</EM></span> -+<span class="comment"><EM>-- @Revision: 1.11 @</EM></span> -+<span class="comment"><EM>-- Binding Version 01.00</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<b>package</b> <b>body</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<span class="symbol"><A NAME="ref_41_40" HREF="terminal_interface-curses-aux__ads.htm#ref_50_35">Aux</A></span> <b>is</b> -+ <span class="comment"><EM>--</EM></span> -+ <span class="comment"><EM>-- Some helpers</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_44_14" HREF="terminal_interface-curses-aux__ads.htm#ref_116_14">Fill_String</A></span> (<span class="symbol"><A NAME="ref_44_27" HREF="terminal_interface-curses-aux__ads.htm#ref_116_27">Cp</A></span> : chars_ptr; -+ <span class="symbol"><A NAME="ref_45_27" HREF="terminal_interface-curses-aux__ads.htm#ref_117_27">Str</A></span> : <b>out</b> String) - <b>is</b> -- <FONT COLOR=green><EM>-- Fill the string with the characters referenced by the</EM></FONT> -- <FONT COLOR=green><EM>-- chars_ptr.</EM></FONT> -- <FONT COLOR=green><EM>--</EM></FONT> -- <FONT COLOR=red><A NAME="ref_50_7">Len</A></FONT> : Natural; -+ <span class="comment"><EM>-- Fill the string with the characters referenced by the</EM></span> -+ <span class="comment"><EM>-- chars_ptr.</EM></span> -+ <span class="comment"><EM>--</EM></span> -+ <span class="symbol"><A NAME="ref_50_7">Len</A></span> : Natural; - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_116_27">Cp</A> /= Null_Ptr <b>then</b> - <A HREF="terminal_interface-curses-aux__adb.htm#ref_50_7">Len</A> := Natural (Strlen (<A HREF="terminal_interface-curses-aux__ads.htm#ref_116_27">Cp</A>)); -@@ -60,7 +72,7 @@ - <b>raise</b> Constraint_Error; - <b>end</b> <b>if</b>; - <b>declare</b> -- <FONT COLOR=red><A NAME="ref_58_13">S</A></FONT> : String (1 .. <A HREF="terminal_interface-curses-aux__adb.htm#ref_50_7">Len</A>); -+ <span class="symbol"><A NAME="ref_58_13">S</A></span> : String (1 .. <A HREF="terminal_interface-curses-aux__adb.htm#ref_50_7">Len</A>); - <b>begin</b> - <A HREF="terminal_interface-curses-aux__adb.htm#ref_58_13">S</A> := Value (<A HREF="terminal_interface-curses-aux__ads.htm#ref_116_27">Cp</A>); - <A HREF="terminal_interface-curses-aux__ads.htm#ref_117_27">Str</A> (<A HREF="terminal_interface-curses-aux__ads.htm#ref_117_27">Str</A>'First .. (<A HREF="terminal_interface-curses-aux__ads.htm#ref_117_27">Str</A>'First + <A HREF="terminal_interface-curses-aux__adb.htm#ref_50_7">Len</A> - 1)) := <A HREF="terminal_interface-curses-aux__adb.htm#ref_58_13">S</A> (<A HREF="terminal_interface-curses-aux__adb.htm#ref_58_13">S</A>'<b>Range</b>); -@@ -75,9 +87,9 @@ - - <b>end</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_116_14">Fill_String</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_73_13" HREF="terminal_interface-curses-aux__ads.htm#ref_121_13">Fill_String</A></FONT> (<FONT COLOR=red><A NAME="ref_73_26" HREF="terminal_interface-curses-aux__ads.htm#ref_121_26">Cp</A></FONT> : chars_ptr) <b>return</b> String -+ <b>function</b> <span class="symbol"><A NAME="ref_73_13" HREF="terminal_interface-curses-aux__ads.htm#ref_121_13">Fill_String</A></span> (<span class="symbol"><A NAME="ref_73_26" HREF="terminal_interface-curses-aux__ads.htm#ref_121_26">Cp</A></span> : chars_ptr) <b>return</b> String - <b>is</b> -- <FONT COLOR=red><A NAME="ref_75_7">Len</A></FONT> : Natural; -+ <span class="symbol"><A NAME="ref_75_7">Len</A></span> : Natural; - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_121_26">Cp</A> /= Null_Ptr <b>then</b> - <A HREF="terminal_interface-curses-aux__adb.htm#ref_75_7">Len</A> := Natural (Strlen (<A HREF="terminal_interface-curses-aux__ads.htm#ref_121_26">Cp</A>)); -@@ -85,7 +97,7 @@ - <b>return</b> ""; - <b>else</b> - <b>declare</b> -- <FONT COLOR=red><A NAME="ref_83_16">S</A></FONT> : String (1 .. <A HREF="terminal_interface-curses-aux__adb.htm#ref_75_7">Len</A>); -+ <span class="symbol"><A NAME="ref_83_16">S</A></span> : String (1 .. <A HREF="terminal_interface-curses-aux__adb.htm#ref_75_7">Len</A>); - <b>begin</b> - <A HREF="terminal_interface-curses-aux__ads.htm#ref_116_14">Fill_String</A> (<A HREF="terminal_interface-curses-aux__ads.htm#ref_121_26">Cp</A>, <A HREF="terminal_interface-curses-aux__adb.htm#ref_83_16">S</A>); - <b>return</b> <A HREF="terminal_interface-curses-aux__adb.htm#ref_83_16">S</A>; -@@ -96,25 +108,25 @@ - <b>end</b> <b>if</b>; - <b>end</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_121_13">Fill_String</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_94_14" HREF="terminal_interface-curses-aux__ads.htm#ref_96_14">Eti_Exception</A></FONT> (<FONT COLOR=red><A NAME="ref_94_29" HREF="terminal_interface-curses-aux__ads.htm#ref_96_29">Code</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A>) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_94_14" HREF="terminal_interface-curses-aux__ads.htm#ref_96_14">Eti_Exception</A></span> (<span class="symbol"><A NAME="ref_94_29" HREF="terminal_interface-curses-aux__ads.htm#ref_96_29">Code</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A>) - <b>is</b> - <b>begin</b> - <b>case</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_96_29">Code</A> <b>is</b> - <b>when</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_80_4">E_Ok</A> =&gt; <b>null</b>; -- <b>when</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_81_4">E_System_Error</A> =&gt; <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_391_4">Eti_System_Error</A>; -- <b>when</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_82_4">E_Bad_Argument</A> =&gt; <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_392_4">Eti_Bad_Argument</A>; -- <b>when</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_83_4">E_Posted</A> =&gt; <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_393_4">Eti_Posted</A>; -- <b>when</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_84_4">E_Connected</A> =&gt; <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_394_4">Eti_Connected</A>; -- <b>when</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_85_4">E_Bad_State</A> =&gt; <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_395_4">Eti_Bad_State</A>; -- <b>when</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_86_4">E_No_Room</A> =&gt; <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_396_4">Eti_No_Room</A>; -- <b>when</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_87_4">E_Not_Posted</A> =&gt; <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_397_4">Eti_Not_Posted</A>; -- <b>when</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_88_4">E_Unknown_Command</A> =&gt; <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_398_4">Eti_Unknown_Command</A>; -- <b>when</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_89_4">E_No_Match</A> =&gt; <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_399_4">Eti_No_Match</A>; -- <b>when</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_90_4">E_Not_Selectable</A> =&gt; <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_400_4">Eti_Not_Selectable</A>; -- <b>when</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_91_4">E_Not_Connected</A> =&gt; <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_401_4">Eti_Not_Connected</A>; -- <b>when</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_92_4">E_Request_Denied</A> =&gt; <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_402_4">Eti_Request_Denied</A>; -- <b>when</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_93_4">E_Invalid_Field</A> =&gt; <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_403_4">Eti_Invalid_Field</A>; -- <b>when</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_94_4">E_Current</A> =&gt; <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_404_4">Eti_Current</A>; -+ <b>when</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_81_4">E_System_Error</A> =&gt; <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_390_4">Eti_System_Error</A>; -+ <b>when</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_82_4">E_Bad_Argument</A> =&gt; <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_391_4">Eti_Bad_Argument</A>; -+ <b>when</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_83_4">E_Posted</A> =&gt; <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_392_4">Eti_Posted</A>; -+ <b>when</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_84_4">E_Connected</A> =&gt; <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_393_4">Eti_Connected</A>; -+ <b>when</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_85_4">E_Bad_State</A> =&gt; <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_394_4">Eti_Bad_State</A>; -+ <b>when</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_86_4">E_No_Room</A> =&gt; <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_395_4">Eti_No_Room</A>; -+ <b>when</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_87_4">E_Not_Posted</A> =&gt; <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_396_4">Eti_Not_Posted</A>; -+ <b>when</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_88_4">E_Unknown_Command</A> =&gt; <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_397_4">Eti_Unknown_Command</A>; -+ <b>when</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_89_4">E_No_Match</A> =&gt; <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_398_4">Eti_No_Match</A>; -+ <b>when</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_90_4">E_Not_Selectable</A> =&gt; <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_399_4">Eti_Not_Selectable</A>; -+ <b>when</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_91_4">E_Not_Connected</A> =&gt; <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_400_4">Eti_Not_Connected</A>; -+ <b>when</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_92_4">E_Request_Denied</A> =&gt; <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_401_4">Eti_Request_Denied</A>; -+ <b>when</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_93_4">E_Invalid_Field</A> =&gt; <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_402_4">Eti_Invalid_Field</A>; -+ <b>when</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_94_4">E_Current</A> =&gt; <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_403_4">Eti_Current</A>; - <b>end</b> <b>case</b>; - <b>end</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_96_14">Eti_Exception</A>; - -diff -Naur ncurses-5.9/doc/html/ada/terminal_interface-curses-aux__ads.htm ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-aux__ads.htm ---- ncurses-5.9/doc/html/ada/terminal_interface-curses-aux__ads.htm 2011-03-20 00:18:39.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-aux__ads.htm 2014-09-01 16:33:22.272791983 +0200 -@@ -1,130 +1,142 @@ --<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> --<HTML><HEAD><TITLE>terminal_interface-curses-aux.ads</TITLE></HEAD> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> -+<HTML> -+<HEAD> -+<TITLE>terminal_interface-curses-aux.ads</TITLE> -+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> -+<style type="text/css"> -+*.comment { -+ color: green; -+} -+*.symbol { -+ color: red; -+} -+</style> -+</HEAD> - <BODY> --<HR><DIV ALIGN="center"><H1> File : terminal_interface-curses-aux.ads </H1></DIV><HR> -+<HR><DIV style="text-align:center"><H1> File : terminal_interface-curses-aux.ads </H1></DIV><HR> - <PRE> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Terminal_Interface.Curses.Aux --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- S P E C --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Copyright (c) 1998-2009,2011 Free Software Foundation, Inc. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></FONT> --<FONT COLOR=green><EM>-- copy of this software and associated documentation files (the --</EM></FONT> --<FONT COLOR=green><EM>-- "Software"), to deal in the Software without restriction, including --</EM></FONT> --<FONT COLOR=green><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></FONT> --<FONT COLOR=green><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></FONT> --<FONT COLOR=green><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></FONT> --<FONT COLOR=green><EM>-- furnished to do so, subject to the following conditions: --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- The above copyright notice and this permission notice shall be included --</EM></FONT> --<FONT COLOR=green><EM>-- in all copies or substantial portions of the Software. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></FONT> --<FONT COLOR=green><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></FONT> --<FONT COLOR=green><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></FONT> --<FONT COLOR=green><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></FONT> --<FONT COLOR=green><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></FONT> --<FONT COLOR=green><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></FONT> --<FONT COLOR=green><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></FONT> --<FONT COLOR=green><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></FONT> --<FONT COLOR=green><EM>-- sale, use or other dealings in this Software without prior written --</EM></FONT> --<FONT COLOR=green><EM>-- authorization. --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Author: Juergen Pfeifer, 1996</EM></FONT> --<FONT COLOR=green><EM>-- Version Control:</EM></FONT> --<FONT COLOR=green><EM>-- @Revision: 1.18 @</EM></FONT> --<FONT COLOR=green><EM>-- Binding Version 01.00</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- curses binding.</EM></FONT> --<FONT COLOR=green><EM>-- This module is generated. Please don't change it manually!</EM></FONT> --<FONT COLOR=green><EM>-- Run the generator instead.</EM></FONT> --<FONT COLOR=green><EM>-- |</EM></FONT> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Terminal_Interface.Curses.Aux --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- S P E C --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Copyright (c) 1998-2009,2011 Free Software Foundation, Inc. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></span> -+<span class="comment"><EM>-- copy of this software and associated documentation files (the --</EM></span> -+<span class="comment"><EM>-- "Software"), to deal in the Software without restriction, including --</EM></span> -+<span class="comment"><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></span> -+<span class="comment"><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></span> -+<span class="comment"><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></span> -+<span class="comment"><EM>-- furnished to do so, subject to the following conditions: --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- The above copyright notice and this permission notice shall be included --</EM></span> -+<span class="comment"><EM>-- in all copies or substantial portions of the Software. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></span> -+<span class="comment"><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></span> -+<span class="comment"><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></span> -+<span class="comment"><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></span> -+<span class="comment"><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></span> -+<span class="comment"><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></span> -+<span class="comment"><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></span> -+<span class="comment"><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></span> -+<span class="comment"><EM>-- sale, use or other dealings in this Software without prior written --</EM></span> -+<span class="comment"><EM>-- authorization. --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Author: Juergen Pfeifer, 1996</EM></span> -+<span class="comment"><EM>-- Version Control:</EM></span> -+<span class="comment"><EM>-- @Revision: 1.18 @</EM></span> -+<span class="comment"><EM>-- Binding Version 01.00</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- curses binding.</EM></span> -+<span class="comment"><EM>-- This module is generated. Please don't change it manually!</EM></span> -+<span class="comment"><EM>-- Run the generator instead.</EM></span> -+<span class="comment"><EM>-- |</EM></span> - <b>with</b> System; --<b>with</b> <A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>.C; --<b>with</b> <A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>.C.Strings; <b>use</b> <A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>.C.Strings; -+<b>with</b> <A HREF="interfac__ads.htm#ref_36_9">Interfaces</A>.C; -+<b>with</b> <A HREF="interfac__ads.htm#ref_36_9">Interfaces</A>.C.Strings; <b>use</b> <A HREF="interfac__ads.htm#ref_36_9">Interfaces</A>.C.Strings; - <b>with</b> <A HREF="unchconv__ads.htm#ref_20_10">Unchecked_Conversion</A>; - --<b>package</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<FONT COLOR=red><A NAME="ref_50_35" HREF="terminal_interface-curses-aux__adb.htm#ref_41_40">Aux</A></FONT> <b>is</b> -+<b>package</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<span class="symbol"><A NAME="ref_50_35" HREF="terminal_interface-curses-aux__adb.htm#ref_41_40">Aux</A></span> <b>is</b> - <b>pragma</b> Preelaborate (<A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-aux__ads.htm#ref_50_35">Aux</A>); - -- <b>use</b> <b>type</b> <A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>.C.int; -+ <b>use</b> <b>type</b> <A HREF="interfac__ads.htm#ref_36_9">Interfaces</A>.C.int; - -- <b>subtype</b> <FONT COLOR=red><A NAME="ref_55_12">C_Int</A></FONT> <b>is</b> <A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>.C.int; -- <b>subtype</b> <FONT COLOR=red><A NAME="ref_56_12">C_Short</A></FONT> <b>is</b> <A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>.C.short; -- <b>subtype</b> <FONT COLOR=red><A NAME="ref_57_12">C_Long_Int</A></FONT> <b>is</b> <A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>.C.long; -- <b>subtype</b> <FONT COLOR=red><A NAME="ref_58_12">C_Size_T</A></FONT> <b>is</b> <A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>.C.size_t; -- <b>subtype</b> <FONT COLOR=red><A NAME="ref_59_12">C_UInt</A></FONT> <b>is</b> <A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>.C.unsigned; -- <b>subtype</b> <FONT COLOR=red><A NAME="ref_60_12">C_ULong</A></FONT> <b>is</b> <A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>.C.unsigned_long; -- <b>subtype</b> <FONT COLOR=red><A NAME="ref_61_12">C_Char_Ptr</A></FONT> <b>is</b> <A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>.C.Strings.chars_ptr; -- <b>type</b> <FONT COLOR=red><A NAME="ref_62_12">C_Void_Ptr</A></FONT> <b>is</b> <b>new</b> System.Address; -- <b>type</b> <FONT COLOR=red><A NAME="ref_63_12">C_Chtype</A></FONT> <b>is</b> <b>new</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_60_12">C_ULong</A>; -- <b>type</b> <FONT COLOR=red><A NAME="ref_64_12">C_AttrType</A></FONT> <b>is</b> <b>new</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_60_12">C_ULong</A>; -- -- <FONT COLOR=green><EM>-- This is how those constants are defined in ncurses. I see them also</EM></FONT> -- <FONT COLOR=green><EM>-- exactly like this in all ETI implementations I ever tested. So it</EM></FONT> -- <FONT COLOR=green><EM>-- could be that this is quite general, but please check with your curses.</EM></FONT> -- <FONT COLOR=green><EM>-- This is critical, because curses sometime mixes Boolean returns with</EM></FONT> -- <FONT COLOR=green><EM>-- returning an error status.</EM></FONT> -- <FONT COLOR=red><A NAME="ref_71_4">Curses_Ok</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> := 0; -- <FONT COLOR=red><A NAME="ref_72_4">Curses_Err</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> := -1; -- -- <FONT COLOR=red><A NAME="ref_74_4">Curses_True</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> := 1; -- <FONT COLOR=red><A NAME="ref_75_4">Curses_False</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> := 0; -- -- <FONT COLOR=green><EM>-- Eti_Error: type for error codes returned by the menu and form subsystem</EM></FONT> -- <b>subtype</b> <FONT COLOR=red><A NAME="ref_78_12">Eti_Error</A></FONT> <b>is</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> <b>range</b> -14 .. 0; -- -- <FONT COLOR=red><A NAME="ref_80_4">E_Ok</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := 0; -- <FONT COLOR=red><A NAME="ref_81_4">E_System_Error</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := -1; -- <FONT COLOR=red><A NAME="ref_82_4">E_Bad_Argument</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := -2; -- <FONT COLOR=red><A NAME="ref_83_4">E_Posted</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := -3; -- <FONT COLOR=red><A NAME="ref_84_4">E_Connected</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := -4; -- <FONT COLOR=red><A NAME="ref_85_4">E_Bad_State</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := -5; -- <FONT COLOR=red><A NAME="ref_86_4">E_No_Room</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := -6; -- <FONT COLOR=red><A NAME="ref_87_4">E_Not_Posted</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := -7; -- <FONT COLOR=red><A NAME="ref_88_4">E_Unknown_Command</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := -8; -- <FONT COLOR=red><A NAME="ref_89_4">E_No_Match</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := -9; -- <FONT COLOR=red><A NAME="ref_90_4">E_Not_Selectable</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := -10; -- <FONT COLOR=red><A NAME="ref_91_4">E_Not_Connected</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := -11; -- <FONT COLOR=red><A NAME="ref_92_4">E_Request_Denied</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := -12; -- <FONT COLOR=red><A NAME="ref_93_4">E_Invalid_Field</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := -13; -- <FONT COLOR=red><A NAME="ref_94_4">E_Current</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := -14; -- -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_96_14" HREF="terminal_interface-curses-aux__adb.htm#ref_94_14">Eti_Exception</A></FONT> (<FONT COLOR=red><A NAME="ref_96_29" HREF="terminal_interface-curses-aux__adb.htm#ref_94_29">Code</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A>); -- <FONT COLOR=green><EM>-- Dispatch the error code and raise the appropriate exception</EM></FONT> -- <FONT COLOR=green><EM>--</EM></FONT> -- <FONT COLOR=green><EM>--</EM></FONT> -- <FONT COLOR=green><EM>-- Some helpers</EM></FONT> -+ <b>subtype</b> <span class="symbol"><A NAME="ref_55_12">C_Int</A></span> <b>is</b> <A HREF="interfac__ads.htm#ref_36_9">Interfaces</A>.C.int; -+ <b>subtype</b> <span class="symbol"><A NAME="ref_56_12">C_Short</A></span> <b>is</b> <A HREF="interfac__ads.htm#ref_36_9">Interfaces</A>.C.short; -+ <b>subtype</b> <span class="symbol"><A NAME="ref_57_12">C_Long_Int</A></span> <b>is</b> <A HREF="interfac__ads.htm#ref_36_9">Interfaces</A>.C.long; -+ <b>subtype</b> <span class="symbol"><A NAME="ref_58_12">C_Size_T</A></span> <b>is</b> <A HREF="interfac__ads.htm#ref_36_9">Interfaces</A>.C.size_t; -+ <b>subtype</b> <span class="symbol"><A NAME="ref_59_12">C_UInt</A></span> <b>is</b> <A HREF="interfac__ads.htm#ref_36_9">Interfaces</A>.C.unsigned; -+ <b>subtype</b> <span class="symbol"><A NAME="ref_60_12">C_ULong</A></span> <b>is</b> <A HREF="interfac__ads.htm#ref_36_9">Interfaces</A>.C.unsigned_long; -+ <b>subtype</b> <span class="symbol"><A NAME="ref_61_12">C_Char_Ptr</A></span> <b>is</b> <A HREF="interfac__ads.htm#ref_36_9">Interfaces</A>.C.Strings.chars_ptr; -+ <b>type</b> <span class="symbol"><A NAME="ref_62_12">C_Void_Ptr</A></span> <b>is</b> <b>new</b> System.Address; -+ <b>type</b> <span class="symbol"><A NAME="ref_63_12">C_Chtype</A></span> <b>is</b> <b>new</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_59_12">C_UInt</A>; -+ <b>type</b> <span class="symbol"><A NAME="ref_64_12">C_AttrType</A></span> <b>is</b> <b>new</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_59_12">C_UInt</A>; -+ -+ <span class="comment"><EM>-- This is how those constants are defined in ncurses. I see them also</EM></span> -+ <span class="comment"><EM>-- exactly like this in all ETI implementations I ever tested. So it</EM></span> -+ <span class="comment"><EM>-- could be that this is quite general, but please check with your curses.</EM></span> -+ <span class="comment"><EM>-- This is critical, because curses sometime mixes Boolean returns with</EM></span> -+ <span class="comment"><EM>-- returning an error status.</EM></span> -+ <span class="symbol"><A NAME="ref_71_4">Curses_Ok</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> := 0; -+ <span class="symbol"><A NAME="ref_72_4">Curses_Err</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> := -1; -+ -+ <span class="symbol"><A NAME="ref_74_4">Curses_True</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> := 1; -+ <span class="symbol"><A NAME="ref_75_4">Curses_False</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> := 0; -+ -+ <span class="comment"><EM>-- Eti_Error: type for error codes returned by the menu and form subsystem</EM></span> -+ <b>subtype</b> <span class="symbol"><A NAME="ref_78_12">Eti_Error</A></span> <b>is</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> <b>range</b> -14 .. 0; -+ -+ <span class="symbol"><A NAME="ref_80_4">E_Ok</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := 0; -+ <span class="symbol"><A NAME="ref_81_4">E_System_Error</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := -1; -+ <span class="symbol"><A NAME="ref_82_4">E_Bad_Argument</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := -2; -+ <span class="symbol"><A NAME="ref_83_4">E_Posted</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := -3; -+ <span class="symbol"><A NAME="ref_84_4">E_Connected</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := -4; -+ <span class="symbol"><A NAME="ref_85_4">E_Bad_State</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := -5; -+ <span class="symbol"><A NAME="ref_86_4">E_No_Room</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := -6; -+ <span class="symbol"><A NAME="ref_87_4">E_Not_Posted</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := -7; -+ <span class="symbol"><A NAME="ref_88_4">E_Unknown_Command</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := -8; -+ <span class="symbol"><A NAME="ref_89_4">E_No_Match</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := -9; -+ <span class="symbol"><A NAME="ref_90_4">E_Not_Selectable</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := -10; -+ <span class="symbol"><A NAME="ref_91_4">E_Not_Connected</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := -11; -+ <span class="symbol"><A NAME="ref_92_4">E_Request_Denied</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := -12; -+ <span class="symbol"><A NAME="ref_93_4">E_Invalid_Field</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := -13; -+ <span class="symbol"><A NAME="ref_94_4">E_Current</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := -14; -+ -+ <b>procedure</b> <span class="symbol"><A NAME="ref_96_14" HREF="terminal_interface-curses-aux__adb.htm#ref_94_14">Eti_Exception</A></span> (<span class="symbol"><A NAME="ref_96_29" HREF="terminal_interface-curses-aux__adb.htm#ref_94_29">Code</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A>); -+ <span class="comment"><EM>-- Dispatch the error code and raise the appropriate exception</EM></span> -+ <span class="comment"><EM>--</EM></span> -+ <span class="comment"><EM>--</EM></span> -+ <span class="comment"><EM>-- Some helpers</EM></span> - <b>function</b> Chtype_To_AttrChar <b>is</b> <b>new</b> - <A HREF="unchconv__ads.htm#ref_20_10">Unchecked_Conversion</A> (<A HREF="unchconv__ads.htm#ref_17_9">Source</A> =&gt; <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_12">C_Chtype</A>, -- <A HREF="unchconv__ads.htm#ref_18_9">Target</A> =&gt; <A HREF="terminal_interface-curses__ads.htm#ref_354_9">Attributed_Character</A>); -+ <A HREF="unchconv__ads.htm#ref_18_9">Target</A> =&gt; <A HREF="terminal_interface-curses__ads.htm#ref_353_9">Attributed_Character</A>); - <b>function</b> AttrChar_To_Chtype <b>is</b> <b>new</b> -- <A HREF="unchconv__ads.htm#ref_20_10">Unchecked_Conversion</A> (<A HREF="unchconv__ads.htm#ref_17_9">Source</A> =&gt; <A HREF="terminal_interface-curses__ads.htm#ref_354_9">Attributed_Character</A>, -+ <A HREF="unchconv__ads.htm#ref_20_10">Unchecked_Conversion</A> (<A HREF="unchconv__ads.htm#ref_17_9">Source</A> =&gt; <A HREF="terminal_interface-curses__ads.htm#ref_353_9">Attributed_Character</A>, - <A HREF="unchconv__ads.htm#ref_18_9">Target</A> =&gt; <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_12">C_Chtype</A>); - - <b>function</b> AttrChar_To_AttrType <b>is</b> <b>new</b> -- <A HREF="unchconv__ads.htm#ref_20_10">Unchecked_Conversion</A> (<A HREF="unchconv__ads.htm#ref_17_9">Source</A> =&gt; <A HREF="terminal_interface-curses__ads.htm#ref_354_9">Attributed_Character</A>, -+ <A HREF="unchconv__ads.htm#ref_20_10">Unchecked_Conversion</A> (<A HREF="unchconv__ads.htm#ref_17_9">Source</A> =&gt; <A HREF="terminal_interface-curses__ads.htm#ref_353_9">Attributed_Character</A>, - <A HREF="unchconv__ads.htm#ref_18_9">Target</A> =&gt; <A HREF="terminal_interface-curses-aux__ads.htm#ref_64_12">C_AttrType</A>); - - <b>function</b> AttrType_To_AttrChar <b>is</b> <b>new</b> - <A HREF="unchconv__ads.htm#ref_20_10">Unchecked_Conversion</A> (<A HREF="unchconv__ads.htm#ref_17_9">Source</A> =&gt; <A HREF="terminal_interface-curses-aux__ads.htm#ref_64_12">C_AttrType</A>, -- <A HREF="unchconv__ads.htm#ref_18_9">Target</A> =&gt; <A HREF="terminal_interface-curses__ads.htm#ref_354_9">Attributed_Character</A>); -+ <A HREF="unchconv__ads.htm#ref_18_9">Target</A> =&gt; <A HREF="terminal_interface-curses__ads.htm#ref_353_9">Attributed_Character</A>); - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_116_14" HREF="terminal_interface-curses-aux__adb.htm#ref_44_14">Fill_String</A></FONT> (<FONT COLOR=red><A NAME="ref_116_27" HREF="terminal_interface-curses-aux__adb.htm#ref_44_27">Cp</A></FONT> : chars_ptr; -- <FONT COLOR=red><A NAME="ref_117_27" HREF="terminal_interface-curses-aux__adb.htm#ref_45_27">Str</A></FONT> : <b>out</b> String); -- <FONT COLOR=green><EM>-- Fill the Str parameter with the string denoted by the chars_ptr</EM></FONT> -- <FONT COLOR=green><EM>-- C-Style string.</EM></FONT> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_116_14" HREF="terminal_interface-curses-aux__adb.htm#ref_44_14">Fill_String</A></span> (<span class="symbol"><A NAME="ref_116_27" HREF="terminal_interface-curses-aux__adb.htm#ref_44_27">Cp</A></span> : chars_ptr; -+ <span class="symbol"><A NAME="ref_117_27" HREF="terminal_interface-curses-aux__adb.htm#ref_45_27">Str</A></span> : <b>out</b> String); -+ <span class="comment"><EM>-- Fill the Str parameter with the string denoted by the chars_ptr</EM></span> -+ <span class="comment"><EM>-- C-Style string.</EM></span> - -- <b>function</b> <FONT COLOR=red><A NAME="ref_121_13" HREF="terminal_interface-curses-aux__adb.htm#ref_73_13">Fill_String</A></FONT> (<FONT COLOR=red><A NAME="ref_121_26" HREF="terminal_interface-curses-aux__adb.htm#ref_73_26">Cp</A></FONT> : chars_ptr) <b>return</b> String; -- <FONT COLOR=green><EM>-- Same but as function.</EM></FONT> -+ <b>function</b> <span class="symbol"><A NAME="ref_121_13" HREF="terminal_interface-curses-aux__adb.htm#ref_73_13">Fill_String</A></span> (<span class="symbol"><A NAME="ref_121_26" HREF="terminal_interface-curses-aux__adb.htm#ref_73_26">Cp</A></span> : chars_ptr) <b>return</b> String; -+ <span class="comment"><EM>-- Same but as function.</EM></span> - - <b>end</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-aux__ads.htm#ref_50_35">Aux</A>; - </PRE></BODY></HTML> -diff -Naur ncurses-5.9/doc/html/ada/terminal_interface-curses-forms__adb.htm ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-forms__adb.htm ---- ncurses-5.9/doc/html/ada/terminal_interface-curses-forms__adb.htm 2011-03-26 22:54:29.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-forms__adb.htm 2014-09-01 16:33:22.285792004 +0200 -@@ -1,71 +1,83 @@ --<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> --<HTML><HEAD><TITLE>terminal_interface-curses-forms.adb</TITLE></HEAD> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> -+<HTML> -+<HEAD> -+<TITLE>terminal_interface-curses-forms.adb</TITLE> -+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> -+<style type="text/css"> -+*.comment { -+ color: green; -+} -+*.symbol { -+ color: red; -+} -+</style> -+</HEAD> - <BODY> --<HR><DIV ALIGN="center"><H1> File : terminal_interface-curses-forms.adb </H1></DIV><HR> -+<HR><DIV style="text-align:center"><H1> File : terminal_interface-curses-forms.adb </H1></DIV><HR> - <PRE> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Terminal_Interface.Curses.Forms --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- B O D Y --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Copyright (c) 1998-2009,2011 Free Software Foundation, Inc. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></FONT> --<FONT COLOR=green><EM>-- copy of this software and associated documentation files (the --</EM></FONT> --<FONT COLOR=green><EM>-- "Software"), to deal in the Software without restriction, including --</EM></FONT> --<FONT COLOR=green><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></FONT> --<FONT COLOR=green><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></FONT> --<FONT COLOR=green><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></FONT> --<FONT COLOR=green><EM>-- furnished to do so, subject to the following conditions: --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- The above copyright notice and this permission notice shall be included --</EM></FONT> --<FONT COLOR=green><EM>-- in all copies or substantial portions of the Software. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></FONT> --<FONT COLOR=green><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></FONT> --<FONT COLOR=green><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></FONT> --<FONT COLOR=green><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></FONT> --<FONT COLOR=green><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></FONT> --<FONT COLOR=green><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></FONT> --<FONT COLOR=green><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></FONT> --<FONT COLOR=green><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></FONT> --<FONT COLOR=green><EM>-- sale, use or other dealings in this Software without prior written --</EM></FONT> --<FONT COLOR=green><EM>-- authorization. --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Author: Juergen Pfeifer, 1996</EM></FONT> --<FONT COLOR=green><EM>-- Version Control:</EM></FONT> --<FONT COLOR=green><EM>-- @Revision: 1.28 @</EM></FONT> --<FONT COLOR=green><EM>-- @Date: 2011/03/22 23:37:32 @</EM></FONT> --<FONT COLOR=green><EM>-- Binding Version 01.00</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Terminal_Interface.Curses.Forms --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- B O D Y --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Copyright (c) 1998-2009,2011 Free Software Foundation, Inc. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></span> -+<span class="comment"><EM>-- copy of this software and associated documentation files (the --</EM></span> -+<span class="comment"><EM>-- "Software"), to deal in the Software without restriction, including --</EM></span> -+<span class="comment"><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></span> -+<span class="comment"><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></span> -+<span class="comment"><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></span> -+<span class="comment"><EM>-- furnished to do so, subject to the following conditions: --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- The above copyright notice and this permission notice shall be included --</EM></span> -+<span class="comment"><EM>-- in all copies or substantial portions of the Software. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></span> -+<span class="comment"><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></span> -+<span class="comment"><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></span> -+<span class="comment"><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></span> -+<span class="comment"><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></span> -+<span class="comment"><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></span> -+<span class="comment"><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></span> -+<span class="comment"><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></span> -+<span class="comment"><EM>-- sale, use or other dealings in this Software without prior written --</EM></span> -+<span class="comment"><EM>-- authorization. --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Author: Juergen Pfeifer, 1996</EM></span> -+<span class="comment"><EM>-- Version Control:</EM></span> -+<span class="comment"><EM>-- @Revision: 1.28 @</EM></span> -+<span class="comment"><EM>-- @Date: 2011/03/22 23:37:32 @</EM></span> -+<span class="comment"><EM>-- Binding Version 01.00</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> - <b>with</b> Ada.Unchecked_Deallocation; - <b>with</b> Ada.Unchecked_Conversion; - --<b>with</b> <A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>.C; <b>use</b> <A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>.C; --<b>with</b> <A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>.C.Strings; <b>use</b> <A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>.C.Strings; --<b>with</b> <A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>.C.Pointers; -+<b>with</b> <A HREF="interfac__ads.htm#ref_36_9">Interfaces</A>.C; <b>use</b> <A HREF="interfac__ads.htm#ref_36_9">Interfaces</A>.C; -+<b>with</b> <A HREF="interfac__ads.htm#ref_36_9">Interfaces</A>.C.Strings; <b>use</b> <A HREF="interfac__ads.htm#ref_36_9">Interfaces</A>.C.Strings; -+<b>with</b> <A HREF="interfac__ads.htm#ref_36_9">Interfaces</A>.C.Pointers; - - <b>with</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-aux__ads.htm#ref_50_35">Aux</A>; - --<b>package</b> <b>body</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<FONT COLOR=red><A NAME="ref_51_40" HREF="terminal_interface-curses-forms__ads.htm#ref_49_35">Forms</A></FONT> <b>is</b> -+<b>package</b> <b>body</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<span class="symbol"><A NAME="ref_51_40" HREF="terminal_interface-curses-forms__ads.htm#ref_49_35">Forms</A></span> <b>is</b> - - <b>use</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-aux__ads.htm#ref_50_35">Aux</A>; - - <b>type</b> C_Field_Array <b>is</b> <b>array</b> (Natural <b>range</b> &lt;&gt;) <b>of</b> <b>aliased</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; - <b>package</b> F_Array <b>is</b> <b>new</b> -- <A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>.C.Pointers (Natural, <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>, C_Field_Array, <A HREF="terminal_interface-curses-forms__ads.htm#ref_59_4">Null_Field</A>); -+ <A HREF="interfac__ads.htm#ref_36_9">Interfaces</A>.C.Pointers (Natural, <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>, C_Field_Array, <A HREF="terminal_interface-curses-forms__ads.htm#ref_59_4">Null_Field</A>); - --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- subtype chars_ptr is Interfaces.C.Strings.chars_ptr;</EM></FONT> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- subtype chars_ptr is Interfaces.C.Strings.chars_ptr;</EM></span> - - <b>function</b> FOS_2_CInt <b>is</b> <b>new</b> - Ada.Unchecked_Conversion (<A HREF="terminal_interface-curses-forms__ads.htm#ref_68_9">Field_Option_Set</A>, -@@ -76,467 +88,467 @@ - <A HREF="terminal_interface-curses-forms__ads.htm#ref_68_9">Field_Option_Set</A>); - - <b>function</b> FrmOS_2_CInt <b>is</b> <b>new</b> -- Ada.Unchecked_Conversion (<A HREF="terminal_interface-curses-forms__ads.htm#ref_109_9">Form_Option_Set</A>, -+ Ada.Unchecked_Conversion (<A HREF="terminal_interface-curses-forms__ads.htm#ref_108_9">Form_Option_Set</A>, - <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>); - - <b>function</b> CInt_2_FrmOS <b>is</b> <b>new</b> - Ada.Unchecked_Conversion (<A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>, -- <A HREF="terminal_interface-curses-forms__ads.htm#ref_109_9">Form_Option_Set</A>); -+ <A HREF="terminal_interface-curses-forms__ads.htm#ref_108_9">Form_Option_Set</A>); - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_81_14" HREF="terminal_interface-curses-forms__ads.htm#ref_280_14">Request_Name</A></FONT> (<FONT COLOR=red><A NAME="ref_81_28" HREF="terminal_interface-curses-forms__ads.htm#ref_280_28">Key</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A>; -- <FONT COLOR=red><A NAME="ref_82_33" HREF="terminal_interface-curses-forms__ads.htm#ref_281_28">Name</A></FONT> : <b>out</b> String) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_81_14" HREF="terminal_interface-curses-forms__ads.htm#ref_278_14">Request_Name</A></span> (<span class="symbol"><A NAME="ref_81_28" HREF="terminal_interface-curses-forms__ads.htm#ref_278_28">Key</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A>; -+ <span class="symbol"><A NAME="ref_82_33" HREF="terminal_interface-curses-forms__ads.htm#ref_279_28">Name</A></span> : <b>out</b> String) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_84_16">Form_Request_Name</A></FONT> (<FONT COLOR=red><A NAME="ref_84_35" HREF="terminal_interface-curses-forms__adb.htm#ref_84_16">Key</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> chars_ptr; -+ <b>function</b> <span class="symbol"><A NAME="ref_84_16">Form_Request_Name</A></span> (<span class="symbol"><A NAME="ref_84_35" HREF="terminal_interface-curses-forms__adb.htm#ref_84_16">Key</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> chars_ptr; - <b>pragma</b> Import (C, Form_Request_Name, "form_request_name"); - <b>begin</b> -- <A HREF="terminal_interface-curses-aux__ads.htm#ref_116_14">Fill_String</A> (<A HREF="terminal_interface-curses-forms__adb.htm#ref_84_16">Form_Request_Name</A> (<A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_280_28">Key</A>)), <A HREF="terminal_interface-curses-forms__ads.htm#ref_281_28">Name</A>); -- <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_280_14">Request_Name</A>; -+ <A HREF="terminal_interface-curses-aux__ads.htm#ref_116_14">Fill_String</A> (<A HREF="terminal_interface-curses-forms__adb.htm#ref_84_16">Form_Request_Name</A> (<A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_278_28">Key</A>)), <A HREF="terminal_interface-curses-forms__ads.htm#ref_279_28">Name</A>); -+ <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_278_14">Request_Name</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_90_13" HREF="terminal_interface-curses-forms__ads.htm#ref_283_14">Request_Name</A></FONT> (<FONT COLOR=red><A NAME="ref_90_27" HREF="terminal_interface-curses-forms__ads.htm#ref_283_28">Key</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A>) <b>return</b> String -+ <b>function</b> <span class="symbol"><A NAME="ref_90_13" HREF="terminal_interface-curses-forms__ads.htm#ref_281_14">Request_Name</A></span> (<span class="symbol"><A NAME="ref_90_27" HREF="terminal_interface-curses-forms__ads.htm#ref_281_28">Key</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A>) <b>return</b> String - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_92_16">Form_Request_Name</A></FONT> (<FONT COLOR=red><A NAME="ref_92_35" HREF="terminal_interface-curses-forms__adb.htm#ref_92_16">Key</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> chars_ptr; -+ <b>function</b> <span class="symbol"><A NAME="ref_92_16">Form_Request_Name</A></span> (<span class="symbol"><A NAME="ref_92_35" HREF="terminal_interface-curses-forms__adb.htm#ref_92_16">Key</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> chars_ptr; - <b>pragma</b> Import (C, Form_Request_Name, "form_request_name"); - <b>begin</b> -- <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_121_13">Fill_String</A> (<A HREF="terminal_interface-curses-forms__adb.htm#ref_92_16">Form_Request_Name</A> (<A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_283_28">Key</A>))); -- <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_283_14">Request_Name</A>; --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | man page form_field_new.3x</EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_108_13" HREF="terminal_interface-curses-forms__ads.htm#ref_297_13">Create</A></FONT> (<FONT COLOR=red><A NAME="ref_108_21" HREF="terminal_interface-curses-forms__ads.htm#ref_297_21">Height</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_63_12">Line_Count</A>; -- <FONT COLOR=red><A NAME="ref_109_21" HREF="terminal_interface-curses-forms__ads.htm#ref_298_21">Width</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_65_12">Column_Count</A>; -- <FONT COLOR=red><A NAME="ref_110_21" HREF="terminal_interface-curses-forms__ads.htm#ref_299_21">Top</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_111_21" HREF="terminal_interface-curses-forms__ads.htm#ref_300_21">Left</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -- <FONT COLOR=red><A NAME="ref_112_21" HREF="terminal_interface-curses-forms__ads.htm#ref_301_21">Off_Screen</A></FONT> : Natural := 0; -- <FONT COLOR=red><A NAME="ref_113_21" HREF="terminal_interface-curses-forms__ads.htm#ref_302_21">More_Buffers</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_133_9">Buffer_Number</A> := <A HREF="terminal_interface-curses-forms__ads.htm#ref_133_9">Buffer_Number</A>'First) -+ <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_121_13">Fill_String</A> (<A HREF="terminal_interface-curses-forms__adb.htm#ref_92_16">Form_Request_Name</A> (<A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_281_28">Key</A>))); -+ <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_281_14">Request_Name</A>; -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | man page form_field_new.3x</EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_108_13" HREF="terminal_interface-curses-forms__ads.htm#ref_295_13">Create</A></span> (<span class="symbol"><A NAME="ref_108_21" HREF="terminal_interface-curses-forms__ads.htm#ref_295_21">Height</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_63_12">Line_Count</A>; -+ <span class="symbol"><A NAME="ref_109_21" HREF="terminal_interface-curses-forms__ads.htm#ref_296_21">Width</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_65_12">Column_Count</A>; -+ <span class="symbol"><A NAME="ref_110_21" HREF="terminal_interface-curses-forms__ads.htm#ref_297_21">Top</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_111_21" HREF="terminal_interface-curses-forms__ads.htm#ref_298_21">Left</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -+ <span class="symbol"><A NAME="ref_112_21" HREF="terminal_interface-curses-forms__ads.htm#ref_299_21">Off_Screen</A></span> : Natural := 0; -+ <span class="symbol"><A NAME="ref_113_21" HREF="terminal_interface-curses-forms__ads.htm#ref_300_21">More_Buffers</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_131_9">Buffer_Number</A> := <A HREF="terminal_interface-curses-forms__ads.htm#ref_131_9">Buffer_Number</A>'First) - <b>return</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A> - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_116_16">Newfield</A></FONT> (<FONT COLOR=red><A NAME="ref_116_26" HREF="terminal_interface-curses-forms__adb.htm#ref_116_16">H</A></FONT>, <FONT COLOR=red><A NAME="ref_116_29" HREF="terminal_interface-curses-forms__adb.htm#ref_116_16">W</A></FONT>, <FONT COLOR=red><A NAME="ref_116_32" HREF="terminal_interface-curses-forms__adb.htm#ref_116_16">T</A></FONT>, <FONT COLOR=red><A NAME="ref_116_35" HREF="terminal_interface-curses-forms__adb.htm#ref_116_16">L</A></FONT>, <FONT COLOR=red><A NAME="ref_116_38" HREF="terminal_interface-curses-forms__adb.htm#ref_116_16">O</A></FONT>, <FONT COLOR=red><A NAME="ref_116_41" HREF="terminal_interface-curses-forms__adb.htm#ref_116_16">M</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_116_16">Newfield</A></span> (<span class="symbol"><A NAME="ref_116_26" HREF="terminal_interface-curses-forms__adb.htm#ref_116_16">H</A></span>, <span class="symbol"><A NAME="ref_116_29" HREF="terminal_interface-curses-forms__adb.htm#ref_116_16">W</A></span>, <span class="symbol"><A NAME="ref_116_32" HREF="terminal_interface-curses-forms__adb.htm#ref_116_16">T</A></span>, <span class="symbol"><A NAME="ref_116_35" HREF="terminal_interface-curses-forms__adb.htm#ref_116_16">L</A></span>, <span class="symbol"><A NAME="ref_116_38" HREF="terminal_interface-curses-forms__adb.htm#ref_116_16">O</A></span>, <span class="symbol"><A NAME="ref_116_41" HREF="terminal_interface-curses-forms__adb.htm#ref_116_16">M</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; - <b>pragma</b> Import (C, Newfield, "new_field"); -- <FONT COLOR=red><A NAME="ref_118_7">Fld</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A> := <A HREF="terminal_interface-curses-forms__adb.htm#ref_116_16">Newfield</A> (<A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_297_21">Height</A>), <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_298_21">Width</A>), -- <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_299_21">Top</A>), <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_300_21">Left</A>), -- <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_301_21">Off_Screen</A>), -- <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_302_21">More_Buffers</A>)); -+ <span class="symbol"><A NAME="ref_118_7">Fld</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A> := <A HREF="terminal_interface-curses-forms__adb.htm#ref_116_16">Newfield</A> (<A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_295_21">Height</A>), <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_296_21">Width</A>), -+ <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_297_21">Top</A>), <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_298_21">Left</A>), -+ <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_299_21">Off_Screen</A>), -+ <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_300_21">More_Buffers</A>)); - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses-forms__adb.htm#ref_118_7">Fld</A> = <A HREF="terminal_interface-curses-forms__ads.htm#ref_59_4">Null_Field</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_290_4">Form_Exception</A>; -+ <b>raise</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_288_4">Form_Exception</A>; - <b>end</b> <b>if</b>; - <b>return</b> <A HREF="terminal_interface-curses-forms__adb.htm#ref_118_7">Fld</A>; -- <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_297_13">Create</A>; --<FONT COLOR=green><EM>-- |</EM></FONT> --<FONT COLOR=green><EM>-- |</EM></FONT> --<FONT COLOR=green><EM>-- |</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_131_14" HREF="terminal_interface-curses-forms__ads.htm#ref_319_14">Delete</A></FONT> (<FONT COLOR=red><A NAME="ref_131_22" HREF="terminal_interface-curses-forms__ads.htm#ref_319_22">Fld</A></FONT> : <b>in</b> <b>out</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>) -+ <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_295_13">Create</A>; -+<span class="comment"><EM>-- |</EM></span> -+<span class="comment"><EM>-- |</EM></span> -+<span class="comment"><EM>-- |</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_131_14" HREF="terminal_interface-curses-forms__ads.htm#ref_317_14">Delete</A></span> (<span class="symbol"><A NAME="ref_131_22" HREF="terminal_interface-curses-forms__ads.htm#ref_317_22">Fld</A></span> : <b>in</b> <b>out</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_133_16">Free_Field</A></FONT> (<FONT COLOR=red><A NAME="ref_133_28" HREF="terminal_interface-curses-forms__adb.htm#ref_133_16">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_133_16">Free_Field</A></span> (<span class="symbol"><A NAME="ref_133_28" HREF="terminal_interface-curses-forms__adb.htm#ref_133_16">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Free_Field, "free_field"); - -- <FONT COLOR=red><A NAME="ref_136_7">Res</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A>; -+ <span class="symbol"><A NAME="ref_136_7">Res</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A>; - <b>begin</b> -- <A HREF="terminal_interface-curses-forms__adb.htm#ref_136_7">Res</A> := <A HREF="terminal_interface-curses-forms__adb.htm#ref_133_16">Free_Field</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_319_22">Fld</A>); -+ <A HREF="terminal_interface-curses-forms__adb.htm#ref_136_7">Res</A> := <A HREF="terminal_interface-curses-forms__adb.htm#ref_133_16">Free_Field</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_317_22">Fld</A>); - <b>if</b> <A HREF="terminal_interface-curses-forms__adb.htm#ref_136_7">Res</A> /= <A HREF="terminal_interface-curses-aux__ads.htm#ref_80_4">E_Ok</A> <b>then</b> - <A HREF="terminal_interface-curses-aux__ads.htm#ref_96_14">Eti_Exception</A> (<A HREF="terminal_interface-curses-forms__adb.htm#ref_136_7">Res</A>); - <b>end</b> <b>if</b>; -- <A HREF="terminal_interface-curses-forms__ads.htm#ref_319_22">Fld</A> := <A HREF="terminal_interface-curses-forms__ads.htm#ref_59_4">Null_Field</A>; -- <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_319_14">Delete</A>; -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_147_13" HREF="terminal_interface-curses-forms__ads.htm#ref_325_13">Duplicate</A></FONT> (<FONT COLOR=red><A NAME="ref_147_24" HREF="terminal_interface-curses-forms__ads.htm#ref_325_24">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_148_24" HREF="terminal_interface-curses-forms__ads.htm#ref_326_24">Top</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_149_24" HREF="terminal_interface-curses-forms__ads.htm#ref_327_24">Left</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>) <b>return</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A> -- <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_151_16">Dup_Field</A></FONT> (<FONT COLOR=red><A NAME="ref_151_27" HREF="terminal_interface-curses-forms__adb.htm#ref_151_16">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_152_27" HREF="terminal_interface-curses-forms__adb.htm#ref_151_16">Top</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -- <FONT COLOR=red><A NAME="ref_153_27" HREF="terminal_interface-curses-forms__adb.htm#ref_151_16">Left</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <A HREF="terminal_interface-curses-forms__ads.htm#ref_317_22">Fld</A> := <A HREF="terminal_interface-curses-forms__ads.htm#ref_59_4">Null_Field</A>; -+ <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_317_14">Delete</A>; -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_147_13" HREF="terminal_interface-curses-forms__ads.htm#ref_323_13">Duplicate</A></span> (<span class="symbol"><A NAME="ref_147_24" HREF="terminal_interface-curses-forms__ads.htm#ref_323_24">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_148_24" HREF="terminal_interface-curses-forms__ads.htm#ref_324_24">Top</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_149_24" HREF="terminal_interface-curses-forms__ads.htm#ref_325_24">Left</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>) <b>return</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A> -+ <b>is</b> -+ <b>function</b> <span class="symbol"><A NAME="ref_151_16">Dup_Field</A></span> (<span class="symbol"><A NAME="ref_151_27" HREF="terminal_interface-curses-forms__adb.htm#ref_151_16">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_152_27" HREF="terminal_interface-curses-forms__adb.htm#ref_151_16">Top</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <span class="symbol"><A NAME="ref_153_27" HREF="terminal_interface-curses-forms__adb.htm#ref_151_16">Left</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; - <b>pragma</b> Import (C, Dup_Field, "dup_field"); - -- <FONT COLOR=red><A NAME="ref_156_7">F</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A> := <A HREF="terminal_interface-curses-forms__adb.htm#ref_151_16">Dup_Field</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_325_24">Fld</A>, -- <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_326_24">Top</A>), -- <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_327_24">Left</A>)); -+ <span class="symbol"><A NAME="ref_156_7">F</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A> := <A HREF="terminal_interface-curses-forms__adb.htm#ref_151_16">Dup_Field</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_323_24">Fld</A>, -+ <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_324_24">Top</A>), -+ <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_325_24">Left</A>)); - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses-forms__adb.htm#ref_156_7">F</A> = <A HREF="terminal_interface-curses-forms__ads.htm#ref_59_4">Null_Field</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_290_4">Form_Exception</A>; -+ <b>raise</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_288_4">Form_Exception</A>; - <b>end</b> <b>if</b>; - <b>return</b> <A HREF="terminal_interface-curses-forms__adb.htm#ref_156_7">F</A>; -- <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_325_13">Duplicate</A>; -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_168_13" HREF="terminal_interface-curses-forms__ads.htm#ref_332_13">Link</A></FONT> (<FONT COLOR=red><A NAME="ref_168_19" HREF="terminal_interface-curses-forms__ads.htm#ref_332_19">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_169_19" HREF="terminal_interface-curses-forms__ads.htm#ref_333_19">Top</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_170_19" HREF="terminal_interface-curses-forms__ads.htm#ref_334_19">Left</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>) <b>return</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A> -- <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_172_16">Lnk_Field</A></FONT> (<FONT COLOR=red><A NAME="ref_172_27" HREF="terminal_interface-curses-forms__adb.htm#ref_172_16">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_173_27" HREF="terminal_interface-curses-forms__adb.htm#ref_172_16">Top</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -- <FONT COLOR=red><A NAME="ref_174_27" HREF="terminal_interface-curses-forms__adb.htm#ref_172_16">Left</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_323_13">Duplicate</A>; -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_168_13" HREF="terminal_interface-curses-forms__ads.htm#ref_330_13">Link</A></span> (<span class="symbol"><A NAME="ref_168_19" HREF="terminal_interface-curses-forms__ads.htm#ref_330_19">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_169_19" HREF="terminal_interface-curses-forms__ads.htm#ref_331_19">Top</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_170_19" HREF="terminal_interface-curses-forms__ads.htm#ref_332_19">Left</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>) <b>return</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A> -+ <b>is</b> -+ <b>function</b> <span class="symbol"><A NAME="ref_172_16">Lnk_Field</A></span> (<span class="symbol"><A NAME="ref_172_27" HREF="terminal_interface-curses-forms__adb.htm#ref_172_16">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_173_27" HREF="terminal_interface-curses-forms__adb.htm#ref_172_16">Top</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <span class="symbol"><A NAME="ref_174_27" HREF="terminal_interface-curses-forms__adb.htm#ref_172_16">Left</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; - <b>pragma</b> Import (C, Lnk_Field, "link_field"); - -- <FONT COLOR=red><A NAME="ref_177_7">F</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A> := <A HREF="terminal_interface-curses-forms__adb.htm#ref_172_16">Lnk_Field</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_332_19">Fld</A>, -- <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_333_19">Top</A>), -- <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_334_19">Left</A>)); -+ <span class="symbol"><A NAME="ref_177_7">F</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A> := <A HREF="terminal_interface-curses-forms__adb.htm#ref_172_16">Lnk_Field</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_330_19">Fld</A>, -+ <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_331_19">Top</A>), -+ <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_332_19">Left</A>)); - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses-forms__adb.htm#ref_177_7">F</A> = <A HREF="terminal_interface-curses-forms__ads.htm#ref_59_4">Null_Field</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_290_4">Form_Exception</A>; -+ <b>raise</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_288_4">Form_Exception</A>; - <b>end</b> <b>if</b>; - <b>return</b> <A HREF="terminal_interface-curses-forms__adb.htm#ref_177_7">F</A>; -- <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_332_13">Link</A>; -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | man page form_field_just.3x</EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_193_14" HREF="terminal_interface-curses-forms__ads.htm#ref_343_14">Set_Justification</A></FONT> (<FONT COLOR=red><A NAME="ref_193_33" HREF="terminal_interface-curses-forms__ads.htm#ref_343_33">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_194_33" HREF="terminal_interface-curses-forms__ads.htm#ref_344_33">Just</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_62_9">Field_Justification</A> := <A HREF="terminal_interface-curses-forms__ads.htm#ref_62_33">None</A>) -+ <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_330_13">Link</A>; -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | man page form_field_just.3x</EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_193_14" HREF="terminal_interface-curses-forms__ads.htm#ref_341_14">Set_Justification</A></span> (<span class="symbol"><A NAME="ref_193_33" HREF="terminal_interface-curses-forms__ads.htm#ref_341_33">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_194_33" HREF="terminal_interface-curses-forms__ads.htm#ref_342_33">Just</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_62_9">Field_Justification</A> := <A HREF="terminal_interface-curses-forms__ads.htm#ref_62_33">None</A>) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_196_16">Set_Field_Just</A></FONT> (<FONT COLOR=red><A NAME="ref_196_32" HREF="terminal_interface-curses-forms__adb.htm#ref_196_16">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_197_32" HREF="terminal_interface-curses-forms__adb.htm#ref_196_16">Just</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_196_16">Set_Field_Just</A></span> (<span class="symbol"><A NAME="ref_196_32" HREF="terminal_interface-curses-forms__adb.htm#ref_196_16">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_197_32" HREF="terminal_interface-curses-forms__adb.htm#ref_196_16">Just</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Set_Field_Just, "set_field_just"); - -- <FONT COLOR=red><A NAME="ref_200_7">Res</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := -- <A HREF="terminal_interface-curses-forms__adb.htm#ref_196_16">Set_Field_Just</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_343_33">Fld</A>, -- <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_62_9">Field_Justification</A>'Pos (<A HREF="terminal_interface-curses-forms__ads.htm#ref_344_33">Just</A>))); -+ <span class="symbol"><A NAME="ref_200_7">Res</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := -+ <A HREF="terminal_interface-curses-forms__adb.htm#ref_196_16">Set_Field_Just</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_341_33">Fld</A>, -+ <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_62_9">Field_Justification</A>'Pos (<A HREF="terminal_interface-curses-forms__ads.htm#ref_342_33">Just</A>))); - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses-forms__adb.htm#ref_200_7">Res</A> /= <A HREF="terminal_interface-curses-aux__ads.htm#ref_80_4">E_Ok</A> <b>then</b> - <A HREF="terminal_interface-curses-aux__ads.htm#ref_96_14">Eti_Exception</A> (<A HREF="terminal_interface-curses-forms__adb.htm#ref_200_7">Res</A>); - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_343_14">Set_Justification</A>; -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_211_13" HREF="terminal_interface-curses-forms__ads.htm#ref_349_13">Get_Justification</A></FONT> (<FONT COLOR=red><A NAME="ref_211_32" HREF="terminal_interface-curses-forms__ads.htm#ref_349_32">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>) <b>return</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_62_9">Field_Justification</A> -+ <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_341_14">Set_Justification</A>; -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_211_13" HREF="terminal_interface-curses-forms__ads.htm#ref_347_13">Get_Justification</A></span> (<span class="symbol"><A NAME="ref_211_32" HREF="terminal_interface-curses-forms__ads.htm#ref_347_32">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>) <b>return</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_62_9">Field_Justification</A> - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_213_16">Field_Just</A></FONT> (<FONT COLOR=red><A NAME="ref_213_28" HREF="terminal_interface-curses-forms__adb.htm#ref_213_16">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_213_16">Field_Just</A></span> (<span class="symbol"><A NAME="ref_213_28" HREF="terminal_interface-curses-forms__adb.htm#ref_213_16">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Field_Just, "field_just"); - <b>begin</b> -- <b>return</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_62_9">Field_Justification</A>'Val (<A HREF="terminal_interface-curses-forms__adb.htm#ref_213_16">Field_Just</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_349_32">Fld</A>)); -- <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_349_13">Get_Justification</A>; -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | man page form_field_buffer.3x</EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_225_14" HREF="terminal_interface-curses-forms__ads.htm#ref_358_14">Set_Buffer</A></FONT> -- (<FONT COLOR=red><A NAME="ref_226_7" HREF="terminal_interface-curses-forms__ads.htm#ref_359_7">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_227_7" HREF="terminal_interface-curses-forms__ads.htm#ref_360_7">Buffer</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_133_9">Buffer_Number</A> := <A HREF="terminal_interface-curses-forms__ads.htm#ref_133_9">Buffer_Number</A>'First; -- <FONT COLOR=red><A NAME="ref_228_7" HREF="terminal_interface-curses-forms__ads.htm#ref_361_7">Str</A></FONT> : String) -- <b>is</b> -- <b>type</b> <FONT COLOR=red><A NAME="ref_230_12">Char_Ptr</A></FONT> <b>is</b> <b>access</b> <b>all</b> <A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>.C.char; -- <b>function</b> <FONT COLOR=red><A NAME="ref_231_16">Set_Fld_Buffer</A></FONT> (<FONT COLOR=red><A NAME="ref_231_32" HREF="terminal_interface-curses-forms__adb.htm#ref_231_16">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_232_34" HREF="terminal_interface-curses-forms__adb.htm#ref_231_16">Bufnum</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -- <FONT COLOR=red><A NAME="ref_233_34" HREF="terminal_interface-curses-forms__adb.htm#ref_231_16">S</A></FONT> : <A HREF="terminal_interface-curses-forms__adb.htm#ref_230_12">Char_Ptr</A>) -+ <b>return</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_62_9">Field_Justification</A>'Val (<A HREF="terminal_interface-curses-forms__adb.htm#ref_213_16">Field_Just</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_347_32">Fld</A>)); -+ <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_347_13">Get_Justification</A>; -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | man page form_field_buffer.3x</EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_225_14" HREF="terminal_interface-curses-forms__ads.htm#ref_356_14">Set_Buffer</A></span> -+ (<span class="symbol"><A NAME="ref_226_7" HREF="terminal_interface-curses-forms__ads.htm#ref_357_7">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_227_7" HREF="terminal_interface-curses-forms__ads.htm#ref_358_7">Buffer</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_131_9">Buffer_Number</A> := <A HREF="terminal_interface-curses-forms__ads.htm#ref_131_9">Buffer_Number</A>'First; -+ <span class="symbol"><A NAME="ref_228_7" HREF="terminal_interface-curses-forms__ads.htm#ref_359_7">Str</A></span> : String) -+ <b>is</b> -+ <b>type</b> <span class="symbol"><A NAME="ref_230_12">Char_Ptr</A></span> <b>is</b> <b>access</b> <b>all</b> <A HREF="interfac__ads.htm#ref_36_9">Interfaces</A>.C.char; -+ <b>function</b> <span class="symbol"><A NAME="ref_231_16">Set_Fld_Buffer</A></span> (<span class="symbol"><A NAME="ref_231_32" HREF="terminal_interface-curses-forms__adb.htm#ref_231_16">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_232_34" HREF="terminal_interface-curses-forms__adb.htm#ref_231_16">Bufnum</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <span class="symbol"><A NAME="ref_233_34" HREF="terminal_interface-curses-forms__adb.htm#ref_231_16">S</A></span> : <A HREF="terminal_interface-curses-forms__adb.htm#ref_230_12">Char_Ptr</A>) - <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Set_Fld_Buffer, "set_field_buffer"); - -- <FONT COLOR=red><A NAME="ref_237_7">Txt</A></FONT> : char_array (0 .. <A HREF="terminal_interface-curses-forms__ads.htm#ref_361_7">Str</A>'Length); -- <FONT COLOR=red><A NAME="ref_238_7">Len</A></FONT> : size_t; -- <FONT COLOR=red><A NAME="ref_239_7">Res</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A>; -+ <span class="symbol"><A NAME="ref_237_7">Txt</A></span> : char_array (0 .. <A HREF="terminal_interface-curses-forms__ads.htm#ref_359_7">Str</A>'Length); -+ <span class="symbol"><A NAME="ref_238_7">Len</A></span> : size_t; -+ <span class="symbol"><A NAME="ref_239_7">Res</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A>; - <b>begin</b> -- To_C (<A HREF="terminal_interface-curses-forms__ads.htm#ref_361_7">Str</A>, <A HREF="terminal_interface-curses-forms__adb.htm#ref_237_7">Txt</A>, <A HREF="terminal_interface-curses-forms__adb.htm#ref_238_7">Len</A>); -- <A HREF="terminal_interface-curses-forms__adb.htm#ref_239_7">Res</A> := <A HREF="terminal_interface-curses-forms__adb.htm#ref_231_16">Set_Fld_Buffer</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_359_7">Fld</A>, <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_360_7">Buffer</A>), <A HREF="terminal_interface-curses-forms__adb.htm#ref_237_7">Txt</A> (<A HREF="terminal_interface-curses-forms__adb.htm#ref_237_7">Txt</A>'First)'<b>Access</b>); -+ To_C (<A HREF="terminal_interface-curses-forms__ads.htm#ref_359_7">Str</A>, <A HREF="terminal_interface-curses-forms__adb.htm#ref_237_7">Txt</A>, <A HREF="terminal_interface-curses-forms__adb.htm#ref_238_7">Len</A>); -+ <A HREF="terminal_interface-curses-forms__adb.htm#ref_239_7">Res</A> := <A HREF="terminal_interface-curses-forms__adb.htm#ref_231_16">Set_Fld_Buffer</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_357_7">Fld</A>, <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_358_7">Buffer</A>), <A HREF="terminal_interface-curses-forms__adb.htm#ref_237_7">Txt</A> (<A HREF="terminal_interface-curses-forms__adb.htm#ref_237_7">Txt</A>'First)'<b>Access</b>); - <b>if</b> <A HREF="terminal_interface-curses-forms__adb.htm#ref_239_7">Res</A> /= <A HREF="terminal_interface-curses-aux__ads.htm#ref_80_4">E_Ok</A> <b>then</b> - <A HREF="terminal_interface-curses-aux__ads.htm#ref_96_14">Eti_Exception</A> (<A HREF="terminal_interface-curses-forms__adb.htm#ref_239_7">Res</A>); - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_358_14">Set_Buffer</A>; -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_250_14" HREF="terminal_interface-curses-forms__ads.htm#ref_366_14">Get_Buffer</A></FONT> -- (<FONT COLOR=red><A NAME="ref_251_7" HREF="terminal_interface-curses-forms__ads.htm#ref_367_7">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_252_7" HREF="terminal_interface-curses-forms__ads.htm#ref_368_7">Buffer</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_133_9">Buffer_Number</A> := <A HREF="terminal_interface-curses-forms__ads.htm#ref_133_9">Buffer_Number</A>'First; -- <FONT COLOR=red><A NAME="ref_253_7" HREF="terminal_interface-curses-forms__ads.htm#ref_369_7">Str</A></FONT> : <b>out</b> String) -+ <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_356_14">Set_Buffer</A>; -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_250_14" HREF="terminal_interface-curses-forms__ads.htm#ref_364_14">Get_Buffer</A></span> -+ (<span class="symbol"><A NAME="ref_251_7" HREF="terminal_interface-curses-forms__ads.htm#ref_365_7">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_252_7" HREF="terminal_interface-curses-forms__ads.htm#ref_366_7">Buffer</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_131_9">Buffer_Number</A> := <A HREF="terminal_interface-curses-forms__ads.htm#ref_131_9">Buffer_Number</A>'First; -+ <span class="symbol"><A NAME="ref_253_7" HREF="terminal_interface-curses-forms__ads.htm#ref_367_7">Str</A></span> : <b>out</b> String) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_255_16">Field_Buffer</A></FONT> (<FONT COLOR=red><A NAME="ref_255_30" HREF="terminal_interface-curses-forms__adb.htm#ref_255_16">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_256_30" HREF="terminal_interface-curses-forms__adb.htm#ref_255_16">B</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> chars_ptr; -+ <b>function</b> <span class="symbol"><A NAME="ref_255_16">Field_Buffer</A></span> (<span class="symbol"><A NAME="ref_255_30" HREF="terminal_interface-curses-forms__adb.htm#ref_255_16">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_256_30" HREF="terminal_interface-curses-forms__adb.htm#ref_255_16">B</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> chars_ptr; - <b>pragma</b> Import (C, Field_Buffer, "field_buffer"); - <b>begin</b> -- <A HREF="terminal_interface-curses-aux__ads.htm#ref_116_14">Fill_String</A> (<A HREF="terminal_interface-curses-forms__adb.htm#ref_255_16">Field_Buffer</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_367_7">Fld</A>, <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_368_7">Buffer</A>)), <A HREF="terminal_interface-curses-forms__ads.htm#ref_369_7">Str</A>); -- <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_366_14">Get_Buffer</A>; -+ <A HREF="terminal_interface-curses-aux__ads.htm#ref_116_14">Fill_String</A> (<A HREF="terminal_interface-curses-forms__adb.htm#ref_255_16">Field_Buffer</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_365_7">Fld</A>, <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_366_7">Buffer</A>)), <A HREF="terminal_interface-curses-forms__ads.htm#ref_367_7">Str</A>); -+ <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_364_14">Get_Buffer</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_262_13" HREF="terminal_interface-curses-forms__ads.htm#ref_372_13">Get_Buffer</A></FONT> -- (<FONT COLOR=red><A NAME="ref_263_7" HREF="terminal_interface-curses-forms__ads.htm#ref_373_7">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_264_7" HREF="terminal_interface-curses-forms__ads.htm#ref_374_7">Buffer</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_133_9">Buffer_Number</A> := <A HREF="terminal_interface-curses-forms__ads.htm#ref_133_9">Buffer_Number</A>'First) <b>return</b> String -+ <b>function</b> <span class="symbol"><A NAME="ref_262_13" HREF="terminal_interface-curses-forms__ads.htm#ref_370_13">Get_Buffer</A></span> -+ (<span class="symbol"><A NAME="ref_263_7" HREF="terminal_interface-curses-forms__ads.htm#ref_371_7">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_264_7" HREF="terminal_interface-curses-forms__ads.htm#ref_372_7">Buffer</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_131_9">Buffer_Number</A> := <A HREF="terminal_interface-curses-forms__ads.htm#ref_131_9">Buffer_Number</A>'First) <b>return</b> String - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_266_16">Field_Buffer</A></FONT> (<FONT COLOR=red><A NAME="ref_266_30" HREF="terminal_interface-curses-forms__adb.htm#ref_266_16">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_267_30" HREF="terminal_interface-curses-forms__adb.htm#ref_266_16">B</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> chars_ptr; -+ <b>function</b> <span class="symbol"><A NAME="ref_266_16">Field_Buffer</A></span> (<span class="symbol"><A NAME="ref_266_30" HREF="terminal_interface-curses-forms__adb.htm#ref_266_16">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_267_30" HREF="terminal_interface-curses-forms__adb.htm#ref_266_16">B</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> chars_ptr; - <b>pragma</b> Import (C, Field_Buffer, "field_buffer"); - <b>begin</b> -- <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_121_13">Fill_String</A> (<A HREF="terminal_interface-curses-forms__adb.htm#ref_266_16">Field_Buffer</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_373_7">Fld</A>, <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_374_7">Buffer</A>))); -- <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_372_13">Get_Buffer</A>; -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_275_14" HREF="terminal_interface-curses-forms__ads.htm#ref_380_14">Set_Status</A></FONT> (<FONT COLOR=red><A NAME="ref_275_26" HREF="terminal_interface-curses-forms__ads.htm#ref_380_26">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_276_26" HREF="terminal_interface-curses-forms__ads.htm#ref_381_26">Status</A></FONT> : Boolean := True) -+ <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_121_13">Fill_String</A> (<A HREF="terminal_interface-curses-forms__adb.htm#ref_266_16">Field_Buffer</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_371_7">Fld</A>, <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_372_7">Buffer</A>))); -+ <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_370_13">Get_Buffer</A>; -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_275_14" HREF="terminal_interface-curses-forms__ads.htm#ref_378_14">Set_Status</A></span> (<span class="symbol"><A NAME="ref_275_26" HREF="terminal_interface-curses-forms__ads.htm#ref_378_26">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_276_26" HREF="terminal_interface-curses-forms__ads.htm#ref_379_26">Status</A></span> : Boolean := True) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_278_16">Set_Fld_Status</A></FONT> (<FONT COLOR=red><A NAME="ref_278_32" HREF="terminal_interface-curses-forms__adb.htm#ref_278_16">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_279_32" HREF="terminal_interface-curses-forms__adb.htm#ref_278_16">St</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_278_16">Set_Fld_Status</A></span> (<span class="symbol"><A NAME="ref_278_32" HREF="terminal_interface-curses-forms__adb.htm#ref_278_16">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_279_32" HREF="terminal_interface-curses-forms__adb.htm#ref_278_16">St</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Set_Fld_Status, "set_field_status"); - -- <FONT COLOR=red><A NAME="ref_282_7">Res</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := <A HREF="terminal_interface-curses-forms__adb.htm#ref_278_16">Set_Fld_Status</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_380_26">Fld</A>, Boolean'Pos (<A HREF="terminal_interface-curses-forms__ads.htm#ref_381_26">Status</A>)); -+ <span class="symbol"><A NAME="ref_282_7">Res</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := <A HREF="terminal_interface-curses-forms__adb.htm#ref_278_16">Set_Fld_Status</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_378_26">Fld</A>, Boolean'Pos (<A HREF="terminal_interface-curses-forms__ads.htm#ref_379_26">Status</A>)); - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses-forms__adb.htm#ref_282_7">Res</A> /= <A HREF="terminal_interface-curses-aux__ads.htm#ref_80_4">E_Ok</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_290_4">Form_Exception</A>; -+ <b>raise</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_288_4">Form_Exception</A>; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_380_14">Set_Status</A>; -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_291_13" HREF="terminal_interface-curses-forms__ads.htm#ref_386_13">Changed</A></FONT> (<FONT COLOR=red><A NAME="ref_291_22" HREF="terminal_interface-curses-forms__ads.htm#ref_386_22">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>) <b>return</b> Boolean -+ <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_378_14">Set_Status</A>; -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_291_13" HREF="terminal_interface-curses-forms__ads.htm#ref_384_13">Changed</A></span> (<span class="symbol"><A NAME="ref_291_22" HREF="terminal_interface-curses-forms__ads.htm#ref_384_22">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>) <b>return</b> Boolean - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_293_16">Field_Status</A></FONT> (<FONT COLOR=red><A NAME="ref_293_30" HREF="terminal_interface-curses-forms__adb.htm#ref_293_16">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_293_16">Field_Status</A></span> (<span class="symbol"><A NAME="ref_293_30" HREF="terminal_interface-curses-forms__adb.htm#ref_293_16">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Field_Status, "field_status"); - -- <FONT COLOR=red><A NAME="ref_296_7">Res</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> := <A HREF="terminal_interface-curses-forms__adb.htm#ref_293_16">Field_Status</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_386_22">Fld</A>); -+ <span class="symbol"><A NAME="ref_296_7">Res</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> := <A HREF="terminal_interface-curses-forms__adb.htm#ref_293_16">Field_Status</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_384_22">Fld</A>); - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses-forms__adb.htm#ref_296_7">Res</A> = <A HREF="terminal_interface-curses-aux__ads.htm#ref_75_4">Curses_False</A> <b>then</b> - <b>return</b> False; - <b>else</b> - <b>return</b> True; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_386_13">Changed</A>; -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_307_14" HREF="terminal_interface-curses-forms__ads.htm#ref_391_14">Set_Maximum_Size</A></FONT> (<FONT COLOR=red><A NAME="ref_307_32" HREF="terminal_interface-curses-forms__ads.htm#ref_391_32">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_308_32" HREF="terminal_interface-curses-forms__ads.htm#ref_392_32">Max</A></FONT> : Natural := 0) -+ <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_384_13">Changed</A>; -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_307_14" HREF="terminal_interface-curses-forms__ads.htm#ref_389_14">Set_Maximum_Size</A></span> (<span class="symbol"><A NAME="ref_307_32" HREF="terminal_interface-curses-forms__ads.htm#ref_389_32">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_308_32" HREF="terminal_interface-curses-forms__ads.htm#ref_390_32">Max</A></span> : Natural := 0) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_310_16">Set_Field_Max</A></FONT> (<FONT COLOR=red><A NAME="ref_310_31" HREF="terminal_interface-curses-forms__adb.htm#ref_310_16">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_311_31" HREF="terminal_interface-curses-forms__adb.htm#ref_310_16">M</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_310_16">Set_Field_Max</A></span> (<span class="symbol"><A NAME="ref_310_31" HREF="terminal_interface-curses-forms__adb.htm#ref_310_16">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_311_31" HREF="terminal_interface-curses-forms__adb.htm#ref_310_16">M</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Set_Field_Max, "set_max_field"); - -- <FONT COLOR=red><A NAME="ref_314_7">Res</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := <A HREF="terminal_interface-curses-forms__adb.htm#ref_310_16">Set_Field_Max</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_391_32">Fld</A>, <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_392_32">Max</A>)); -+ <span class="symbol"><A NAME="ref_314_7">Res</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := <A HREF="terminal_interface-curses-forms__adb.htm#ref_310_16">Set_Field_Max</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_389_32">Fld</A>, <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_390_32">Max</A>)); - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses-forms__adb.htm#ref_314_7">Res</A> /= <A HREF="terminal_interface-curses-aux__ads.htm#ref_80_4">E_Ok</A> <b>then</b> - <A HREF="terminal_interface-curses-aux__ads.htm#ref_96_14">Eti_Exception</A> (<A HREF="terminal_interface-curses-forms__adb.htm#ref_314_7">Res</A>); - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_391_14">Set_Maximum_Size</A>; -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | man page form_field_opts.3x</EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_327_14" HREF="terminal_interface-curses-forms__ads.htm#ref_401_14">Set_Options</A></FONT> (<FONT COLOR=red><A NAME="ref_327_27" HREF="terminal_interface-curses-forms__ads.htm#ref_401_27">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_328_27" HREF="terminal_interface-curses-forms__ads.htm#ref_402_27">Options</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_68_9">Field_Option_Set</A>) -+ <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_389_14">Set_Maximum_Size</A>; -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | man page form_field_opts.3x</EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_327_14" HREF="terminal_interface-curses-forms__ads.htm#ref_399_14">Set_Options</A></span> (<span class="symbol"><A NAME="ref_327_27" HREF="terminal_interface-curses-forms__ads.htm#ref_399_27">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_328_27" HREF="terminal_interface-curses-forms__ads.htm#ref_400_27">Options</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_68_9">Field_Option_Set</A>) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_330_16">Set_Field_Opts</A></FONT> (<FONT COLOR=red><A NAME="ref_330_32" HREF="terminal_interface-curses-forms__adb.htm#ref_330_16">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_331_32" HREF="terminal_interface-curses-forms__adb.htm#ref_330_16">Opt</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_330_16">Set_Field_Opts</A></span> (<span class="symbol"><A NAME="ref_330_32" HREF="terminal_interface-curses-forms__adb.htm#ref_330_16">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_331_32" HREF="terminal_interface-curses-forms__adb.htm#ref_330_16">Opt</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Set_Field_Opts, "set_field_opts"); - -- <FONT COLOR=red><A NAME="ref_334_7">Opt</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> := FOS_2_CInt (<A HREF="terminal_interface-curses-forms__ads.htm#ref_402_27">Options</A>); -- <FONT COLOR=red><A NAME="ref_335_7">Res</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A>; -+ <span class="symbol"><A NAME="ref_334_7">Opt</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> := FOS_2_CInt (<A HREF="terminal_interface-curses-forms__ads.htm#ref_400_27">Options</A>); -+ <span class="symbol"><A NAME="ref_335_7">Res</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A>; - <b>begin</b> -- <A HREF="terminal_interface-curses-forms__adb.htm#ref_335_7">Res</A> := <A HREF="terminal_interface-curses-forms__adb.htm#ref_330_16">Set_Field_Opts</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_401_27">Fld</A>, <A HREF="terminal_interface-curses-forms__adb.htm#ref_334_7">Opt</A>); -+ <A HREF="terminal_interface-curses-forms__adb.htm#ref_335_7">Res</A> := <A HREF="terminal_interface-curses-forms__adb.htm#ref_330_16">Set_Field_Opts</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_399_27">Fld</A>, <A HREF="terminal_interface-curses-forms__adb.htm#ref_334_7">Opt</A>); - <b>if</b> <A HREF="terminal_interface-curses-forms__adb.htm#ref_335_7">Res</A> /= <A HREF="terminal_interface-curses-aux__ads.htm#ref_80_4">E_Ok</A> <b>then</b> - <A HREF="terminal_interface-curses-aux__ads.htm#ref_96_14">Eti_Exception</A> (<A HREF="terminal_interface-curses-forms__adb.htm#ref_335_7">Res</A>); - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_401_14">Set_Options</A>; -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_345_14" HREF="terminal_interface-curses-forms__ads.htm#ref_407_14">Switch_Options</A></FONT> (<FONT COLOR=red><A NAME="ref_345_30" HREF="terminal_interface-curses-forms__ads.htm#ref_407_30">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_346_30" HREF="terminal_interface-curses-forms__ads.htm#ref_408_30">Options</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_68_9">Field_Option_Set</A>; -- <FONT COLOR=red><A NAME="ref_347_30" HREF="terminal_interface-curses-forms__ads.htm#ref_409_30">On</A></FONT> : Boolean := True) -+ <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_399_14">Set_Options</A>; -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_345_14" HREF="terminal_interface-curses-forms__ads.htm#ref_405_14">Switch_Options</A></span> (<span class="symbol"><A NAME="ref_345_30" HREF="terminal_interface-curses-forms__ads.htm#ref_405_30">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_346_30" HREF="terminal_interface-curses-forms__ads.htm#ref_406_30">Options</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_68_9">Field_Option_Set</A>; -+ <span class="symbol"><A NAME="ref_347_30" HREF="terminal_interface-curses-forms__ads.htm#ref_407_30">On</A></span> : Boolean := True) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_349_16">Field_Opts_On</A></FONT> (<FONT COLOR=red><A NAME="ref_349_31" HREF="terminal_interface-curses-forms__adb.htm#ref_349_16">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_350_31" HREF="terminal_interface-curses-forms__adb.htm#ref_349_16">Opt</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_349_16">Field_Opts_On</A></span> (<span class="symbol"><A NAME="ref_349_31" HREF="terminal_interface-curses-forms__adb.htm#ref_349_16">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_350_31" HREF="terminal_interface-curses-forms__adb.htm#ref_349_16">Opt</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Field_Opts_On, "field_opts_on"); -- <b>function</b> <FONT COLOR=red><A NAME="ref_352_16">Field_Opts_Off</A></FONT> (<FONT COLOR=red><A NAME="ref_352_32" HREF="terminal_interface-curses-forms__adb.htm#ref_352_16">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_353_32" HREF="terminal_interface-curses-forms__adb.htm#ref_352_16">Opt</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_352_16">Field_Opts_Off</A></span> (<span class="symbol"><A NAME="ref_352_32" HREF="terminal_interface-curses-forms__adb.htm#ref_352_16">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_353_32" HREF="terminal_interface-curses-forms__adb.htm#ref_352_16">Opt</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Field_Opts_Off, "field_opts_off"); - -- <FONT COLOR=red><A NAME="ref_356_7">Err</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A>; -- <FONT COLOR=red><A NAME="ref_357_7">Opt</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> := FOS_2_CInt (<A HREF="terminal_interface-curses-forms__ads.htm#ref_408_30">Options</A>); -+ <span class="symbol"><A NAME="ref_356_7">Err</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A>; -+ <span class="symbol"><A NAME="ref_357_7">Opt</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> := FOS_2_CInt (<A HREF="terminal_interface-curses-forms__ads.htm#ref_406_30">Options</A>); - <b>begin</b> -- <b>if</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_409_30">On</A> <b>then</b> -- <A HREF="terminal_interface-curses-forms__adb.htm#ref_356_7">Err</A> := <A HREF="terminal_interface-curses-forms__adb.htm#ref_349_16">Field_Opts_On</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_407_30">Fld</A>, <A HREF="terminal_interface-curses-forms__adb.htm#ref_357_7">Opt</A>); -+ <b>if</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_407_30">On</A> <b>then</b> -+ <A HREF="terminal_interface-curses-forms__adb.htm#ref_356_7">Err</A> := <A HREF="terminal_interface-curses-forms__adb.htm#ref_349_16">Field_Opts_On</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_405_30">Fld</A>, <A HREF="terminal_interface-curses-forms__adb.htm#ref_357_7">Opt</A>); - <b>else</b> -- <A HREF="terminal_interface-curses-forms__adb.htm#ref_356_7">Err</A> := <A HREF="terminal_interface-curses-forms__adb.htm#ref_352_16">Field_Opts_Off</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_407_30">Fld</A>, <A HREF="terminal_interface-curses-forms__adb.htm#ref_357_7">Opt</A>); -+ <A HREF="terminal_interface-curses-forms__adb.htm#ref_356_7">Err</A> := <A HREF="terminal_interface-curses-forms__adb.htm#ref_352_16">Field_Opts_Off</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_405_30">Fld</A>, <A HREF="terminal_interface-curses-forms__adb.htm#ref_357_7">Opt</A>); - <b>end</b> <b>if</b>; - <b>if</b> <A HREF="terminal_interface-curses-forms__adb.htm#ref_356_7">Err</A> /= <A HREF="terminal_interface-curses-aux__ads.htm#ref_80_4">E_Ok</A> <b>then</b> - <A HREF="terminal_interface-curses-aux__ads.htm#ref_96_14">Eti_Exception</A> (<A HREF="terminal_interface-curses-forms__adb.htm#ref_356_7">Err</A>); - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_407_14">Switch_Options</A>; -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_371_14" HREF="terminal_interface-curses-forms__ads.htm#ref_415_14">Get_Options</A></FONT> (<FONT COLOR=red><A NAME="ref_371_27" HREF="terminal_interface-curses-forms__ads.htm#ref_415_27">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_372_27" HREF="terminal_interface-curses-forms__ads.htm#ref_416_27">Options</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_68_9">Field_Option_Set</A>) -+ <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_405_14">Switch_Options</A>; -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_371_14" HREF="terminal_interface-curses-forms__ads.htm#ref_413_14">Get_Options</A></span> (<span class="symbol"><A NAME="ref_371_27" HREF="terminal_interface-curses-forms__ads.htm#ref_413_27">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_372_27" HREF="terminal_interface-curses-forms__ads.htm#ref_414_27">Options</A></span> : <b>out</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_68_9">Field_Option_Set</A>) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_374_16">Field_Opts</A></FONT> (<FONT COLOR=red><A NAME="ref_374_28" HREF="terminal_interface-curses-forms__adb.htm#ref_374_16">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_374_16">Field_Opts</A></span> (<span class="symbol"><A NAME="ref_374_28" HREF="terminal_interface-curses-forms__adb.htm#ref_374_16">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Field_Opts, "field_opts"); - -- <FONT COLOR=red><A NAME="ref_377_7">Res</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> := <A HREF="terminal_interface-curses-forms__adb.htm#ref_374_16">Field_Opts</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_415_27">Fld</A>); -+ <span class="symbol"><A NAME="ref_377_7">Res</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> := <A HREF="terminal_interface-curses-forms__adb.htm#ref_374_16">Field_Opts</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_413_27">Fld</A>); - <b>begin</b> -- <A HREF="terminal_interface-curses-forms__ads.htm#ref_416_27">Options</A> := CInt_2_FOS (<A HREF="terminal_interface-curses-forms__adb.htm#ref_377_7">Res</A>); -- <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_415_14">Get_Options</A>; -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_384_13" HREF="terminal_interface-curses-forms__ads.htm#ref_420_13">Get_Options</A></FONT> (<FONT COLOR=red><A NAME="ref_384_26" HREF="terminal_interface-curses-forms__ads.htm#ref_420_26">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A> := <A HREF="terminal_interface-curses-forms__ads.htm#ref_59_4">Null_Field</A>) -+ <A HREF="terminal_interface-curses-forms__ads.htm#ref_414_27">Options</A> := CInt_2_FOS (<A HREF="terminal_interface-curses-forms__adb.htm#ref_377_7">Res</A>); -+ <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_413_14">Get_Options</A>; -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_384_13" HREF="terminal_interface-curses-forms__ads.htm#ref_418_13">Get_Options</A></span> (<span class="symbol"><A NAME="ref_384_26" HREF="terminal_interface-curses-forms__ads.htm#ref_418_26">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A> := <A HREF="terminal_interface-curses-forms__ads.htm#ref_59_4">Null_Field</A>) - <b>return</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_68_9">Field_Option_Set</A> - <b>is</b> -- <FONT COLOR=red><A NAME="ref_387_7">Fos</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_68_9">Field_Option_Set</A>; -+ <span class="symbol"><A NAME="ref_387_7">Fos</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_68_9">Field_Option_Set</A>; - <b>begin</b> -- <A HREF="terminal_interface-curses-forms__ads.htm#ref_415_14">Get_Options</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_420_26">Fld</A>, <A HREF="terminal_interface-curses-forms__adb.htm#ref_387_7">Fos</A>); -+ <A HREF="terminal_interface-curses-forms__ads.htm#ref_413_14">Get_Options</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_418_26">Fld</A>, <A HREF="terminal_interface-curses-forms__adb.htm#ref_387_7">Fos</A>); - <b>return</b> <A HREF="terminal_interface-curses-forms__adb.htm#ref_387_7">Fos</A>; -- <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_420_13">Get_Options</A>; -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | man page form_field_attributes.3x</EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_399_14" HREF="terminal_interface-curses-forms__ads.htm#ref_430_14">Set_Foreground</A></FONT> -- (<FONT COLOR=red><A NAME="ref_400_7" HREF="terminal_interface-curses-forms__ads.htm#ref_431_7">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_401_7" HREF="terminal_interface-curses-forms__ads.htm#ref_432_7">Fore</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A> := <A HREF="terminal_interface-curses__ads.htm#ref_352_4">Normal_Video</A>; -- <FONT COLOR=red><A NAME="ref_402_7" HREF="terminal_interface-curses-forms__ads.htm#ref_433_7">Color</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A> := <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>'First) -+ <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_418_13">Get_Options</A>; -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | man page form_field_attributes.3x</EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_399_14" HREF="terminal_interface-curses-forms__ads.htm#ref_428_14">Set_Foreground</A></span> -+ (<span class="symbol"><A NAME="ref_400_7" HREF="terminal_interface-curses-forms__ads.htm#ref_429_7">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_401_7" HREF="terminal_interface-curses-forms__ads.htm#ref_430_7">Fore</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A> := <A HREF="terminal_interface-curses__ads.htm#ref_351_4">Normal_Video</A>; -+ <span class="symbol"><A NAME="ref_402_7" HREF="terminal_interface-curses-forms__ads.htm#ref_431_7">Color</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A> := <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>'First) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_404_16">Set_Field_Fore</A></FONT> (<FONT COLOR=red><A NAME="ref_404_32" HREF="terminal_interface-curses-forms__adb.htm#ref_404_16">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_405_32" HREF="terminal_interface-curses-forms__adb.htm#ref_404_16">Attr</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_12">C_Chtype</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_404_16">Set_Field_Fore</A></span> (<span class="symbol"><A NAME="ref_404_32" HREF="terminal_interface-curses-forms__adb.htm#ref_404_16">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_405_32" HREF="terminal_interface-curses-forms__adb.htm#ref_404_16">Attr</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_12">C_Chtype</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Set_Field_Fore, "set_field_fore"); - -- <FONT COLOR=red><A NAME="ref_408_7">Ch</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_354_9">Attributed_Character</A> := (<A HREF="terminal_interface-curses__ads.htm#ref_358_10">Ch</A> =&gt; Character'First, -- <A HREF="terminal_interface-curses__ads.htm#ref_357_10">Color</A> =&gt; <A HREF="terminal_interface-curses-forms__ads.htm#ref_433_7">Color</A>, -- <A HREF="terminal_interface-curses__ads.htm#ref_356_10">Attr</A> =&gt; <A HREF="terminal_interface-curses-forms__ads.htm#ref_432_7">Fore</A>); -- <FONT COLOR=red><A NAME="ref_411_7">Res</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := -- <A HREF="terminal_interface-curses-forms__adb.htm#ref_404_16">Set_Field_Fore</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_431_7">Fld</A>, AttrChar_To_Chtype (<A HREF="terminal_interface-curses-forms__adb.htm#ref_408_7">Ch</A>)); -+ <span class="symbol"><A NAME="ref_408_7">Ch</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_353_9">Attributed_Character</A> := (<A HREF="terminal_interface-curses__ads.htm#ref_357_10">Ch</A> =&gt; Character'First, -+ <A HREF="terminal_interface-curses__ads.htm#ref_356_10">Color</A> =&gt; <A HREF="terminal_interface-curses-forms__ads.htm#ref_431_7">Color</A>, -+ <A HREF="terminal_interface-curses__ads.htm#ref_355_10">Attr</A> =&gt; <A HREF="terminal_interface-curses-forms__ads.htm#ref_430_7">Fore</A>); -+ <span class="symbol"><A NAME="ref_411_7">Res</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := -+ <A HREF="terminal_interface-curses-forms__adb.htm#ref_404_16">Set_Field_Fore</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_429_7">Fld</A>, AttrChar_To_Chtype (<A HREF="terminal_interface-curses-forms__adb.htm#ref_408_7">Ch</A>)); - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses-forms__adb.htm#ref_411_7">Res</A> /= <A HREF="terminal_interface-curses-aux__ads.htm#ref_80_4">E_Ok</A> <b>then</b> - <A HREF="terminal_interface-curses-aux__ads.htm#ref_96_14">Eti_Exception</A> (<A HREF="terminal_interface-curses-forms__adb.htm#ref_411_7">Res</A>); - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_430_14">Set_Foreground</A>; -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_421_14" HREF="terminal_interface-curses-forms__ads.htm#ref_438_14">Foreground</A></FONT> (<FONT COLOR=red><A NAME="ref_421_26" HREF="terminal_interface-curses-forms__ads.htm#ref_438_26">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_422_26" HREF="terminal_interface-curses-forms__ads.htm#ref_439_26">Fore</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A>) -+ <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_428_14">Set_Foreground</A>; -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_421_14" HREF="terminal_interface-curses-forms__ads.htm#ref_436_14">Foreground</A></span> (<span class="symbol"><A NAME="ref_421_26" HREF="terminal_interface-curses-forms__ads.htm#ref_436_26">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_422_26" HREF="terminal_interface-curses-forms__ads.htm#ref_437_26">Fore</A></span> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A>) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_424_16">Field_Fore</A></FONT> (<FONT COLOR=red><A NAME="ref_424_28" HREF="terminal_interface-curses-forms__adb.htm#ref_424_16">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_12">C_Chtype</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_424_16">Field_Fore</A></span> (<span class="symbol"><A NAME="ref_424_28" HREF="terminal_interface-curses-forms__adb.htm#ref_424_16">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_12">C_Chtype</A>; - <b>pragma</b> Import (C, Field_Fore, "field_fore"); - <b>begin</b> -- <A HREF="terminal_interface-curses-forms__ads.htm#ref_439_26">Fore</A> := Chtype_To_AttrChar (<A HREF="terminal_interface-curses-forms__adb.htm#ref_424_16">Field_Fore</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_438_26">Fld</A>)).<A HREF="terminal_interface-curses__ads.htm#ref_356_10">Attr</A>; -- <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_438_14">Foreground</A>; -+ <A HREF="terminal_interface-curses-forms__ads.htm#ref_437_26">Fore</A> := Chtype_To_AttrChar (<A HREF="terminal_interface-curses-forms__adb.htm#ref_424_16">Field_Fore</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_436_26">Fld</A>)).<A HREF="terminal_interface-curses__ads.htm#ref_355_10">Attr</A>; -+ <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_436_14">Foreground</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_430_14" HREF="terminal_interface-curses-forms__ads.htm#ref_443_14">Foreground</A></FONT> (<FONT COLOR=red><A NAME="ref_430_26" HREF="terminal_interface-curses-forms__ads.htm#ref_443_26">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_431_26" HREF="terminal_interface-curses-forms__ads.htm#ref_444_26">Fore</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A>; -- <FONT COLOR=red><A NAME="ref_432_26" HREF="terminal_interface-curses-forms__ads.htm#ref_445_26">Color</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_430_14" HREF="terminal_interface-curses-forms__ads.htm#ref_441_14">Foreground</A></span> (<span class="symbol"><A NAME="ref_430_26" HREF="terminal_interface-curses-forms__ads.htm#ref_441_26">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_431_26" HREF="terminal_interface-curses-forms__ads.htm#ref_442_26">Fore</A></span> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A>; -+ <span class="symbol"><A NAME="ref_432_26" HREF="terminal_interface-curses-forms__ads.htm#ref_443_26">Color</A></span> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_434_16">Field_Fore</A></FONT> (<FONT COLOR=red><A NAME="ref_434_28" HREF="terminal_interface-curses-forms__adb.htm#ref_434_16">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_12">C_Chtype</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_434_16">Field_Fore</A></span> (<span class="symbol"><A NAME="ref_434_28" HREF="terminal_interface-curses-forms__adb.htm#ref_434_16">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_12">C_Chtype</A>; - <b>pragma</b> Import (C, Field_Fore, "field_fore"); - <b>begin</b> -- <A HREF="terminal_interface-curses-forms__ads.htm#ref_444_26">Fore</A> := Chtype_To_AttrChar (<A HREF="terminal_interface-curses-forms__adb.htm#ref_434_16">Field_Fore</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_443_26">Fld</A>)).<A HREF="terminal_interface-curses__ads.htm#ref_356_10">Attr</A>; -- <A HREF="terminal_interface-curses-forms__ads.htm#ref_445_26">Color</A> := Chtype_To_AttrChar (<A HREF="terminal_interface-curses-forms__adb.htm#ref_434_16">Field_Fore</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_443_26">Fld</A>)).<A HREF="terminal_interface-curses__ads.htm#ref_357_10">Color</A>; -- <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_443_14">Foreground</A>; -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_443_14" HREF="terminal_interface-curses-forms__ads.htm#ref_450_14">Set_Background</A></FONT> -- (<FONT COLOR=red><A NAME="ref_444_7" HREF="terminal_interface-curses-forms__ads.htm#ref_451_7">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_445_7" HREF="terminal_interface-curses-forms__ads.htm#ref_452_7">Back</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A> := <A HREF="terminal_interface-curses__ads.htm#ref_352_4">Normal_Video</A>; -- <FONT COLOR=red><A NAME="ref_446_7" HREF="terminal_interface-curses-forms__ads.htm#ref_453_7">Color</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A> := <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>'First) -+ <A HREF="terminal_interface-curses-forms__ads.htm#ref_442_26">Fore</A> := Chtype_To_AttrChar (<A HREF="terminal_interface-curses-forms__adb.htm#ref_434_16">Field_Fore</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_441_26">Fld</A>)).<A HREF="terminal_interface-curses__ads.htm#ref_355_10">Attr</A>; -+ <A HREF="terminal_interface-curses-forms__ads.htm#ref_443_26">Color</A> := Chtype_To_AttrChar (<A HREF="terminal_interface-curses-forms__adb.htm#ref_434_16">Field_Fore</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_441_26">Fld</A>)).<A HREF="terminal_interface-curses__ads.htm#ref_356_10">Color</A>; -+ <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_441_14">Foreground</A>; -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_443_14" HREF="terminal_interface-curses-forms__ads.htm#ref_448_14">Set_Background</A></span> -+ (<span class="symbol"><A NAME="ref_444_7" HREF="terminal_interface-curses-forms__ads.htm#ref_449_7">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_445_7" HREF="terminal_interface-curses-forms__ads.htm#ref_450_7">Back</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A> := <A HREF="terminal_interface-curses__ads.htm#ref_351_4">Normal_Video</A>; -+ <span class="symbol"><A NAME="ref_446_7" HREF="terminal_interface-curses-forms__ads.htm#ref_451_7">Color</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A> := <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>'First) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_448_16">Set_Field_Back</A></FONT> (<FONT COLOR=red><A NAME="ref_448_32" HREF="terminal_interface-curses-forms__adb.htm#ref_448_16">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_449_32" HREF="terminal_interface-curses-forms__adb.htm#ref_448_16">Attr</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_12">C_Chtype</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_448_16">Set_Field_Back</A></span> (<span class="symbol"><A NAME="ref_448_32" HREF="terminal_interface-curses-forms__adb.htm#ref_448_16">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_449_32" HREF="terminal_interface-curses-forms__adb.htm#ref_448_16">Attr</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_12">C_Chtype</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Set_Field_Back, "set_field_back"); - -- <FONT COLOR=red><A NAME="ref_452_7">Ch</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_354_9">Attributed_Character</A> := (<A HREF="terminal_interface-curses__ads.htm#ref_358_10">Ch</A> =&gt; Character'First, -- <A HREF="terminal_interface-curses__ads.htm#ref_357_10">Color</A> =&gt; <A HREF="terminal_interface-curses-forms__ads.htm#ref_453_7">Color</A>, -- <A HREF="terminal_interface-curses__ads.htm#ref_356_10">Attr</A> =&gt; <A HREF="terminal_interface-curses-forms__ads.htm#ref_452_7">Back</A>); -- <FONT COLOR=red><A NAME="ref_455_7">Res</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := -- <A HREF="terminal_interface-curses-forms__adb.htm#ref_448_16">Set_Field_Back</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_451_7">Fld</A>, AttrChar_To_Chtype (<A HREF="terminal_interface-curses-forms__adb.htm#ref_452_7">Ch</A>)); -+ <span class="symbol"><A NAME="ref_452_7">Ch</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_353_9">Attributed_Character</A> := (<A HREF="terminal_interface-curses__ads.htm#ref_357_10">Ch</A> =&gt; Character'First, -+ <A HREF="terminal_interface-curses__ads.htm#ref_356_10">Color</A> =&gt; <A HREF="terminal_interface-curses-forms__ads.htm#ref_451_7">Color</A>, -+ <A HREF="terminal_interface-curses__ads.htm#ref_355_10">Attr</A> =&gt; <A HREF="terminal_interface-curses-forms__ads.htm#ref_450_7">Back</A>); -+ <span class="symbol"><A NAME="ref_455_7">Res</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := -+ <A HREF="terminal_interface-curses-forms__adb.htm#ref_448_16">Set_Field_Back</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_449_7">Fld</A>, AttrChar_To_Chtype (<A HREF="terminal_interface-curses-forms__adb.htm#ref_452_7">Ch</A>)); - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses-forms__adb.htm#ref_455_7">Res</A> /= <A HREF="terminal_interface-curses-aux__ads.htm#ref_80_4">E_Ok</A> <b>then</b> - <A HREF="terminal_interface-curses-aux__ads.htm#ref_96_14">Eti_Exception</A> (<A HREF="terminal_interface-curses-forms__adb.htm#ref_455_7">Res</A>); - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_450_14">Set_Background</A>; -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_465_14" HREF="terminal_interface-curses-forms__ads.htm#ref_458_14">Background</A></FONT> (<FONT COLOR=red><A NAME="ref_465_26" HREF="terminal_interface-curses-forms__ads.htm#ref_458_26">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_466_26" HREF="terminal_interface-curses-forms__ads.htm#ref_459_26">Back</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A>) -+ <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_448_14">Set_Background</A>; -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_465_14" HREF="terminal_interface-curses-forms__ads.htm#ref_456_14">Background</A></span> (<span class="symbol"><A NAME="ref_465_26" HREF="terminal_interface-curses-forms__ads.htm#ref_456_26">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_466_26" HREF="terminal_interface-curses-forms__ads.htm#ref_457_26">Back</A></span> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A>) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_468_16">Field_Back</A></FONT> (<FONT COLOR=red><A NAME="ref_468_28" HREF="terminal_interface-curses-forms__adb.htm#ref_468_16">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_12">C_Chtype</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_468_16">Field_Back</A></span> (<span class="symbol"><A NAME="ref_468_28" HREF="terminal_interface-curses-forms__adb.htm#ref_468_16">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_12">C_Chtype</A>; - <b>pragma</b> Import (C, Field_Back, "field_back"); - <b>begin</b> -- <A HREF="terminal_interface-curses-forms__ads.htm#ref_459_26">Back</A> := Chtype_To_AttrChar (<A HREF="terminal_interface-curses-forms__adb.htm#ref_468_16">Field_Back</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_458_26">Fld</A>)).<A HREF="terminal_interface-curses__ads.htm#ref_356_10">Attr</A>; -- <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_458_14">Background</A>; -+ <A HREF="terminal_interface-curses-forms__ads.htm#ref_457_26">Back</A> := Chtype_To_AttrChar (<A HREF="terminal_interface-curses-forms__adb.htm#ref_468_16">Field_Back</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_456_26">Fld</A>)).<A HREF="terminal_interface-curses__ads.htm#ref_355_10">Attr</A>; -+ <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_456_14">Background</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_474_14" HREF="terminal_interface-curses-forms__ads.htm#ref_463_14">Background</A></FONT> (<FONT COLOR=red><A NAME="ref_474_26" HREF="terminal_interface-curses-forms__ads.htm#ref_463_26">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_475_26" HREF="terminal_interface-curses-forms__ads.htm#ref_464_26">Back</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A>; -- <FONT COLOR=red><A NAME="ref_476_26" HREF="terminal_interface-curses-forms__ads.htm#ref_465_26">Color</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_474_14" HREF="terminal_interface-curses-forms__ads.htm#ref_461_14">Background</A></span> (<span class="symbol"><A NAME="ref_474_26" HREF="terminal_interface-curses-forms__ads.htm#ref_461_26">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_475_26" HREF="terminal_interface-curses-forms__ads.htm#ref_462_26">Back</A></span> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A>; -+ <span class="symbol"><A NAME="ref_476_26" HREF="terminal_interface-curses-forms__ads.htm#ref_463_26">Color</A></span> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_478_16">Field_Back</A></FONT> (<FONT COLOR=red><A NAME="ref_478_28" HREF="terminal_interface-curses-forms__adb.htm#ref_478_16">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_12">C_Chtype</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_478_16">Field_Back</A></span> (<span class="symbol"><A NAME="ref_478_28" HREF="terminal_interface-curses-forms__adb.htm#ref_478_16">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_12">C_Chtype</A>; - <b>pragma</b> Import (C, Field_Back, "field_back"); - <b>begin</b> -- <A HREF="terminal_interface-curses-forms__ads.htm#ref_464_26">Back</A> := <A HREF="terminal_interface-curses-aux__ads.htm#ref_96_14">Chtype_To_AttrChar</A> (<A HREF="terminal_interface-curses-forms__adb.htm#ref_478_16">Field_Back</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_463_26">Fld</A>)).<A HREF="terminal_interface-curses__ads.htm#ref_356_10">Attr</A>; -- <A HREF="terminal_interface-curses-forms__ads.htm#ref_465_26">Color</A> := <A HREF="terminal_interface-curses-aux__ads.htm#ref_96_14">Chtype_To_AttrChar</A> (<A HREF="terminal_interface-curses-forms__adb.htm#ref_478_16">Field_Back</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_463_26">Fld</A>)).<A HREF="terminal_interface-curses__ads.htm#ref_357_10">Color</A>; -- <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_463_14">Background</A>; -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_487_14" HREF="terminal_interface-curses-forms__ads.htm#ref_470_14">Set_Pad_Character</A></FONT> (<FONT COLOR=red><A NAME="ref_487_33" HREF="terminal_interface-curses-forms__ads.htm#ref_470_33">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_488_33" HREF="terminal_interface-curses-forms__ads.htm#ref_471_33">Pad</A></FONT> : Character := Space) -+ <A HREF="terminal_interface-curses-forms__ads.htm#ref_462_26">Back</A> := <A HREF="terminal_interface-curses-aux__ads.htm#ref_96_14">Chtype_To_AttrChar</A> (<A HREF="terminal_interface-curses-forms__adb.htm#ref_478_16">Field_Back</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_461_26">Fld</A>)).<A HREF="terminal_interface-curses__ads.htm#ref_355_10">Attr</A>; -+ <A HREF="terminal_interface-curses-forms__ads.htm#ref_463_26">Color</A> := <A HREF="terminal_interface-curses-aux__ads.htm#ref_96_14">Chtype_To_AttrChar</A> (<A HREF="terminal_interface-curses-forms__adb.htm#ref_478_16">Field_Back</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_461_26">Fld</A>)).<A HREF="terminal_interface-curses__ads.htm#ref_356_10">Color</A>; -+ <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_461_14">Background</A>; -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_487_14" HREF="terminal_interface-curses-forms__ads.htm#ref_468_14">Set_Pad_Character</A></span> (<span class="symbol"><A NAME="ref_487_33" HREF="terminal_interface-curses-forms__ads.htm#ref_468_33">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_488_33" HREF="terminal_interface-curses-forms__ads.htm#ref_469_33">Pad</A></span> : Character := Space) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_490_16">Set_Field_Pad</A></FONT> (<FONT COLOR=red><A NAME="ref_490_31" HREF="terminal_interface-curses-forms__adb.htm#ref_490_16">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_491_31" HREF="terminal_interface-curses-forms__adb.htm#ref_490_16">Ch</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_490_16">Set_Field_Pad</A></span> (<span class="symbol"><A NAME="ref_490_31" HREF="terminal_interface-curses-forms__adb.htm#ref_490_16">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_491_31" HREF="terminal_interface-curses-forms__adb.htm#ref_490_16">Ch</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Set_Field_Pad, "set_field_pad"); - -- <FONT COLOR=red><A NAME="ref_494_7">Res</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := <A HREF="terminal_interface-curses-forms__adb.htm#ref_490_16">Set_Field_Pad</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_470_33">Fld</A>, -- <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (Character'Pos (<A HREF="terminal_interface-curses-forms__ads.htm#ref_471_33">Pad</A>))); -+ <span class="symbol"><A NAME="ref_494_7">Res</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := <A HREF="terminal_interface-curses-forms__adb.htm#ref_490_16">Set_Field_Pad</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_468_33">Fld</A>, -+ <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (Character'Pos (<A HREF="terminal_interface-curses-forms__ads.htm#ref_469_33">Pad</A>))); - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses-forms__adb.htm#ref_494_7">Res</A> /= <A HREF="terminal_interface-curses-aux__ads.htm#ref_80_4">E_Ok</A> <b>then</b> - <A HREF="terminal_interface-curses-aux__ads.htm#ref_96_14">Eti_Exception</A> (<A HREF="terminal_interface-curses-forms__adb.htm#ref_494_7">Res</A>); - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_470_14">Set_Pad_Character</A>; -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_504_14" HREF="terminal_interface-curses-forms__ads.htm#ref_476_14">Pad_Character</A></FONT> (<FONT COLOR=red><A NAME="ref_504_29" HREF="terminal_interface-curses-forms__ads.htm#ref_476_29">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_505_29" HREF="terminal_interface-curses-forms__ads.htm#ref_477_29">Pad</A></FONT> : <b>out</b> Character) -+ <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_468_14">Set_Pad_Character</A>; -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_504_14" HREF="terminal_interface-curses-forms__ads.htm#ref_474_14">Pad_Character</A></span> (<span class="symbol"><A NAME="ref_504_29" HREF="terminal_interface-curses-forms__ads.htm#ref_474_29">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_505_29" HREF="terminal_interface-curses-forms__ads.htm#ref_475_29">Pad</A></span> : <b>out</b> Character) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_507_16">Field_Pad</A></FONT> (<FONT COLOR=red><A NAME="ref_507_27" HREF="terminal_interface-curses-forms__adb.htm#ref_507_16">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_507_16">Field_Pad</A></span> (<span class="symbol"><A NAME="ref_507_27" HREF="terminal_interface-curses-forms__adb.htm#ref_507_16">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Field_Pad, "field_pad"); - <b>begin</b> -- <A HREF="terminal_interface-curses-forms__ads.htm#ref_477_29">Pad</A> := Character'Val (<A HREF="terminal_interface-curses-forms__adb.htm#ref_507_16">Field_Pad</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_476_29">Fld</A>)); -- <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_476_14">Pad_Character</A>; -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | man page form_field_info.3x</EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_519_14" HREF="terminal_interface-curses-forms__ads.htm#ref_486_14">Info</A></FONT> (<FONT COLOR=red><A NAME="ref_519_20" HREF="terminal_interface-curses-forms__ads.htm#ref_486_20">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_520_20" HREF="terminal_interface-curses-forms__ads.htm#ref_487_20">Lines</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_63_12">Line_Count</A>; -- <FONT COLOR=red><A NAME="ref_521_20" HREF="terminal_interface-curses-forms__ads.htm#ref_488_20">Columns</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_65_12">Column_Count</A>; -- <FONT COLOR=red><A NAME="ref_522_20" HREF="terminal_interface-curses-forms__ads.htm#ref_489_20">First_Row</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_523_20" HREF="terminal_interface-curses-forms__ads.htm#ref_490_20">First_Column</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -- <FONT COLOR=red><A NAME="ref_524_20" HREF="terminal_interface-curses-forms__ads.htm#ref_491_20">Off_Screen</A></FONT> : <b>out</b> Natural; -- <FONT COLOR=red><A NAME="ref_525_20" HREF="terminal_interface-curses-forms__ads.htm#ref_492_20">Additional_Buffers</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_133_9">Buffer_Number</A>) -- <b>is</b> -- <b>type</b> <FONT COLOR=red><A NAME="ref_527_12">C_Int_Access</A></FONT> <b>is</b> <b>access</b> <b>all</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -- <b>function</b> <FONT COLOR=red><A NAME="ref_528_16">Fld_Info</A></FONT> (<FONT COLOR=red><A NAME="ref_528_26" HREF="terminal_interface-curses-forms__adb.htm#ref_528_16">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_529_26" HREF="terminal_interface-curses-forms__adb.htm#ref_528_16">L</A></FONT>, <FONT COLOR=red><A NAME="ref_529_29" HREF="terminal_interface-curses-forms__adb.htm#ref_528_16">C</A></FONT>, <FONT COLOR=red><A NAME="ref_529_32" HREF="terminal_interface-curses-forms__adb.htm#ref_528_16">Fr</A></FONT>, <FONT COLOR=red><A NAME="ref_529_36" HREF="terminal_interface-curses-forms__adb.htm#ref_528_16">Fc</A></FONT>, <FONT COLOR=red><A NAME="ref_529_40" HREF="terminal_interface-curses-forms__adb.htm#ref_528_16">Os</A></FONT>, <FONT COLOR=red><A NAME="ref_529_44" HREF="terminal_interface-curses-forms__adb.htm#ref_528_16">Ab</A></FONT> : <A HREF="terminal_interface-curses-forms__adb.htm#ref_527_12">C_Int_Access</A>) -+ <A HREF="terminal_interface-curses-forms__ads.htm#ref_475_29">Pad</A> := Character'Val (<A HREF="terminal_interface-curses-forms__adb.htm#ref_507_16">Field_Pad</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_474_29">Fld</A>)); -+ <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_474_14">Pad_Character</A>; -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | man page form_field_info.3x</EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_519_14" HREF="terminal_interface-curses-forms__ads.htm#ref_484_14">Info</A></span> (<span class="symbol"><A NAME="ref_519_20" HREF="terminal_interface-curses-forms__ads.htm#ref_484_20">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_520_20" HREF="terminal_interface-curses-forms__ads.htm#ref_485_20">Lines</A></span> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_63_12">Line_Count</A>; -+ <span class="symbol"><A NAME="ref_521_20" HREF="terminal_interface-curses-forms__ads.htm#ref_486_20">Columns</A></span> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_65_12">Column_Count</A>; -+ <span class="symbol"><A NAME="ref_522_20" HREF="terminal_interface-curses-forms__ads.htm#ref_487_20">First_Row</A></span> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_523_20" HREF="terminal_interface-curses-forms__ads.htm#ref_488_20">First_Column</A></span> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -+ <span class="symbol"><A NAME="ref_524_20" HREF="terminal_interface-curses-forms__ads.htm#ref_489_20">Off_Screen</A></span> : <b>out</b> Natural; -+ <span class="symbol"><A NAME="ref_525_20" HREF="terminal_interface-curses-forms__ads.htm#ref_490_20">Additional_Buffers</A></span> : <b>out</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_131_9">Buffer_Number</A>) -+ <b>is</b> -+ <b>type</b> <span class="symbol"><A NAME="ref_527_12">C_Int_Access</A></span> <b>is</b> <b>access</b> <b>all</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_528_16">Fld_Info</A></span> (<span class="symbol"><A NAME="ref_528_26" HREF="terminal_interface-curses-forms__adb.htm#ref_528_16">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_529_26" HREF="terminal_interface-curses-forms__adb.htm#ref_528_16">L</A></span>, <span class="symbol"><A NAME="ref_529_29" HREF="terminal_interface-curses-forms__adb.htm#ref_528_16">C</A></span>, <span class="symbol"><A NAME="ref_529_32" HREF="terminal_interface-curses-forms__adb.htm#ref_528_16">Fr</A></span>, <span class="symbol"><A NAME="ref_529_36" HREF="terminal_interface-curses-forms__adb.htm#ref_528_16">Fc</A></span>, <span class="symbol"><A NAME="ref_529_40" HREF="terminal_interface-curses-forms__adb.htm#ref_528_16">Os</A></span>, <span class="symbol"><A NAME="ref_529_44" HREF="terminal_interface-curses-forms__adb.htm#ref_528_16">Ab</A></span> : <A HREF="terminal_interface-curses-forms__adb.htm#ref_527_12">C_Int_Access</A>) - <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Fld_Info, "field_info"); - -- <FONT COLOR=red><A NAME="ref_533_7">L</A></FONT>, <FONT COLOR=red><A NAME="ref_533_10">C</A></FONT>, <FONT COLOR=red><A NAME="ref_533_13">Fr</A></FONT>, <FONT COLOR=red><A NAME="ref_533_17">Fc</A></FONT>, <FONT COLOR=red><A NAME="ref_533_21">Os</A></FONT>, <FONT COLOR=red><A NAME="ref_533_25">Ab</A></FONT> : <b>aliased</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -- <FONT COLOR=red><A NAME="ref_534_7">Res</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := <A HREF="terminal_interface-curses-forms__adb.htm#ref_528_16">Fld_Info</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_486_20">Fld</A>, -+ <span class="symbol"><A NAME="ref_533_7">L</A></span>, <span class="symbol"><A NAME="ref_533_10">C</A></span>, <span class="symbol"><A NAME="ref_533_13">Fr</A></span>, <span class="symbol"><A NAME="ref_533_17">Fc</A></span>, <span class="symbol"><A NAME="ref_533_21">Os</A></span>, <span class="symbol"><A NAME="ref_533_25">Ab</A></span> : <b>aliased</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <span class="symbol"><A NAME="ref_534_7">Res</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := <A HREF="terminal_interface-curses-forms__adb.htm#ref_528_16">Fld_Info</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_484_20">Fld</A>, - <A HREF="terminal_interface-curses-forms__adb.htm#ref_533_7">L</A>'<b>Access</b>, <A HREF="terminal_interface-curses-forms__adb.htm#ref_533_10">C</A>'<b>Access</b>, - <A HREF="terminal_interface-curses-forms__adb.htm#ref_533_13">Fr</A>'<b>Access</b>, <A HREF="terminal_interface-curses-forms__adb.htm#ref_533_17">Fc</A>'<b>Access</b>, - <A HREF="terminal_interface-curses-forms__adb.htm#ref_533_21">Os</A>'<b>Access</b>, <A HREF="terminal_interface-curses-forms__adb.htm#ref_533_25">Ab</A>'<b>Access</b>); -@@ -544,624 +556,624 @@ - <b>if</b> <A HREF="terminal_interface-curses-forms__adb.htm#ref_534_7">Res</A> /= <A HREF="terminal_interface-curses-aux__ads.htm#ref_80_4">E_Ok</A> <b>then</b> - <A HREF="terminal_interface-curses-aux__ads.htm#ref_96_14">Eti_Exception</A> (<A HREF="terminal_interface-curses-forms__adb.htm#ref_534_7">Res</A>); - <b>else</b> -- <A HREF="terminal_interface-curses-forms__ads.htm#ref_487_20">Lines</A> := <A HREF="terminal_interface-curses__ads.htm#ref_63_12">Line_Count</A> (<A HREF="terminal_interface-curses-forms__adb.htm#ref_533_7">L</A>); -- <A HREF="terminal_interface-curses-forms__ads.htm#ref_488_20">Columns</A> := <A HREF="terminal_interface-curses__ads.htm#ref_65_12">Column_Count</A> (<A HREF="terminal_interface-curses-forms__adb.htm#ref_533_10">C</A>); -- <A HREF="terminal_interface-curses-forms__ads.htm#ref_489_20">First_Row</A> := <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A> (<A HREF="terminal_interface-curses-forms__adb.htm#ref_533_13">Fr</A>); -- <A HREF="terminal_interface-curses-forms__ads.htm#ref_490_20">First_Column</A> := <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A> (<A HREF="terminal_interface-curses-forms__adb.htm#ref_533_17">Fc</A>); -- <A HREF="terminal_interface-curses-forms__ads.htm#ref_491_20">Off_Screen</A> := Natural (<A HREF="terminal_interface-curses-forms__adb.htm#ref_533_21">Os</A>); -- <A HREF="terminal_interface-curses-forms__ads.htm#ref_492_20">Additional_Buffers</A> := <A HREF="terminal_interface-curses-forms__ads.htm#ref_133_9">Buffer_Number</A> (<A HREF="terminal_interface-curses-forms__adb.htm#ref_533_25">Ab</A>); -- <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_486_14">Info</A>; --<FONT COLOR=green><EM>-- |</EM></FONT> --<FONT COLOR=green><EM>-- |</EM></FONT> --<FONT COLOR=green><EM>-- |</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_553_14" HREF="terminal_interface-curses-forms__ads.htm#ref_497_14">Dynamic_Info</A></FONT> (<FONT COLOR=red><A NAME="ref_553_28" HREF="terminal_interface-curses-forms__ads.htm#ref_497_28">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_554_28" HREF="terminal_interface-curses-forms__ads.htm#ref_498_28">Lines</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_63_12">Line_Count</A>; -- <FONT COLOR=red><A NAME="ref_555_28" HREF="terminal_interface-curses-forms__ads.htm#ref_499_28">Columns</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_65_12">Column_Count</A>; -- <FONT COLOR=red><A NAME="ref_556_28" HREF="terminal_interface-curses-forms__ads.htm#ref_500_28">Max</A></FONT> : <b>out</b> Natural) -+ <A HREF="terminal_interface-curses-forms__ads.htm#ref_485_20">Lines</A> := <A HREF="terminal_interface-curses__ads.htm#ref_63_12">Line_Count</A> (<A HREF="terminal_interface-curses-forms__adb.htm#ref_533_7">L</A>); -+ <A HREF="terminal_interface-curses-forms__ads.htm#ref_486_20">Columns</A> := <A HREF="terminal_interface-curses__ads.htm#ref_65_12">Column_Count</A> (<A HREF="terminal_interface-curses-forms__adb.htm#ref_533_10">C</A>); -+ <A HREF="terminal_interface-curses-forms__ads.htm#ref_487_20">First_Row</A> := <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A> (<A HREF="terminal_interface-curses-forms__adb.htm#ref_533_13">Fr</A>); -+ <A HREF="terminal_interface-curses-forms__ads.htm#ref_488_20">First_Column</A> := <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A> (<A HREF="terminal_interface-curses-forms__adb.htm#ref_533_17">Fc</A>); -+ <A HREF="terminal_interface-curses-forms__ads.htm#ref_489_20">Off_Screen</A> := Natural (<A HREF="terminal_interface-curses-forms__adb.htm#ref_533_21">Os</A>); -+ <A HREF="terminal_interface-curses-forms__ads.htm#ref_490_20">Additional_Buffers</A> := <A HREF="terminal_interface-curses-forms__ads.htm#ref_131_9">Buffer_Number</A> (<A HREF="terminal_interface-curses-forms__adb.htm#ref_533_25">Ab</A>); -+ <b>end</b> <b>if</b>; -+ <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_484_14">Info</A>; -+<span class="comment"><EM>-- |</EM></span> -+<span class="comment"><EM>-- |</EM></span> -+<span class="comment"><EM>-- |</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_553_14" HREF="terminal_interface-curses-forms__ads.htm#ref_495_14">Dynamic_Info</A></span> (<span class="symbol"><A NAME="ref_553_28" HREF="terminal_interface-curses-forms__ads.htm#ref_495_28">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_554_28" HREF="terminal_interface-curses-forms__ads.htm#ref_496_28">Lines</A></span> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_63_12">Line_Count</A>; -+ <span class="symbol"><A NAME="ref_555_28" HREF="terminal_interface-curses-forms__ads.htm#ref_497_28">Columns</A></span> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_65_12">Column_Count</A>; -+ <span class="symbol"><A NAME="ref_556_28" HREF="terminal_interface-curses-forms__ads.htm#ref_498_28">Max</A></span> : <b>out</b> Natural) - <b>is</b> -- <b>type</b> <FONT COLOR=red><A NAME="ref_558_12">C_Int_Access</A></FONT> <b>is</b> <b>access</b> <b>all</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -- <b>function</b> <FONT COLOR=red><A NAME="ref_559_16">Dyn_Info</A></FONT> (<FONT COLOR=red><A NAME="ref_559_26" HREF="terminal_interface-curses-forms__adb.htm#ref_559_16">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; <FONT COLOR=red><A NAME="ref_559_39" HREF="terminal_interface-curses-forms__adb.htm#ref_559_16">L</A></FONT>, <FONT COLOR=red><A NAME="ref_559_42" HREF="terminal_interface-curses-forms__adb.htm#ref_559_16">C</A></FONT>, <FONT COLOR=red><A NAME="ref_559_45" HREF="terminal_interface-curses-forms__adb.htm#ref_559_16">M</A></FONT> : <A HREF="terminal_interface-curses-forms__adb.htm#ref_558_12">C_Int_Access</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>type</b> <span class="symbol"><A NAME="ref_558_12">C_Int_Access</A></span> <b>is</b> <b>access</b> <b>all</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_559_16">Dyn_Info</A></span> (<span class="symbol"><A NAME="ref_559_26" HREF="terminal_interface-curses-forms__adb.htm#ref_559_16">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; <span class="symbol"><A NAME="ref_559_39" HREF="terminal_interface-curses-forms__adb.htm#ref_559_16">L</A></span>, <span class="symbol"><A NAME="ref_559_42" HREF="terminal_interface-curses-forms__adb.htm#ref_559_16">C</A></span>, <span class="symbol"><A NAME="ref_559_45" HREF="terminal_interface-curses-forms__adb.htm#ref_559_16">M</A></span> : <A HREF="terminal_interface-curses-forms__adb.htm#ref_558_12">C_Int_Access</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Dyn_Info, "dynamic_field_info"); - -- <FONT COLOR=red><A NAME="ref_562_7">L</A></FONT>, <FONT COLOR=red><A NAME="ref_562_10">C</A></FONT>, <FONT COLOR=red><A NAME="ref_562_13">M</A></FONT> : <b>aliased</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -- <FONT COLOR=red><A NAME="ref_563_7">Res</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := <A HREF="terminal_interface-curses-forms__adb.htm#ref_559_16">Dyn_Info</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_497_28">Fld</A>, -+ <span class="symbol"><A NAME="ref_562_7">L</A></span>, <span class="symbol"><A NAME="ref_562_10">C</A></span>, <span class="symbol"><A NAME="ref_562_13">M</A></span> : <b>aliased</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <span class="symbol"><A NAME="ref_563_7">Res</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := <A HREF="terminal_interface-curses-forms__adb.htm#ref_559_16">Dyn_Info</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_495_28">Fld</A>, - <A HREF="terminal_interface-curses-forms__adb.htm#ref_562_7">L</A>'<b>Access</b>, <A HREF="terminal_interface-curses-forms__adb.htm#ref_562_10">C</A>'<b>Access</b>, - <A HREF="terminal_interface-curses-forms__adb.htm#ref_562_13">M</A>'<b>Access</b>); - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses-forms__adb.htm#ref_563_7">Res</A> /= <A HREF="terminal_interface-curses-aux__ads.htm#ref_80_4">E_Ok</A> <b>then</b> - <A HREF="terminal_interface-curses-aux__ads.htm#ref_96_14">Eti_Exception</A> (<A HREF="terminal_interface-curses-forms__adb.htm#ref_563_7">Res</A>); - <b>else</b> -- <A HREF="terminal_interface-curses-forms__ads.htm#ref_498_28">Lines</A> := <A HREF="terminal_interface-curses__ads.htm#ref_63_12">Line_Count</A> (<A HREF="terminal_interface-curses-forms__adb.htm#ref_562_7">L</A>); -- <A HREF="terminal_interface-curses-forms__ads.htm#ref_499_28">Columns</A> := <A HREF="terminal_interface-curses__ads.htm#ref_65_12">Column_Count</A> (<A HREF="terminal_interface-curses-forms__adb.htm#ref_562_10">C</A>); -- <A HREF="terminal_interface-curses-forms__ads.htm#ref_500_28">Max</A> := Natural (<A HREF="terminal_interface-curses-forms__adb.htm#ref_562_13">M</A>); -- <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_497_14">Dynamic_Info</A>; -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | man page form_win.3x</EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_582_14" HREF="terminal_interface-curses-forms__ads.htm#ref_509_14">Set_Window</A></FONT> (<FONT COLOR=red><A NAME="ref_582_26" HREF="terminal_interface-curses-forms__ads.htm#ref_509_26">Frm</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -- <FONT COLOR=red><A NAME="ref_583_26" HREF="terminal_interface-curses-forms__ads.htm#ref_510_26">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) -+ <A HREF="terminal_interface-curses-forms__ads.htm#ref_496_28">Lines</A> := <A HREF="terminal_interface-curses__ads.htm#ref_63_12">Line_Count</A> (<A HREF="terminal_interface-curses-forms__adb.htm#ref_562_7">L</A>); -+ <A HREF="terminal_interface-curses-forms__ads.htm#ref_497_28">Columns</A> := <A HREF="terminal_interface-curses__ads.htm#ref_65_12">Column_Count</A> (<A HREF="terminal_interface-curses-forms__adb.htm#ref_562_10">C</A>); -+ <A HREF="terminal_interface-curses-forms__ads.htm#ref_498_28">Max</A> := Natural (<A HREF="terminal_interface-curses-forms__adb.htm#ref_562_13">M</A>); -+ <b>end</b> <b>if</b>; -+ <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_495_14">Dynamic_Info</A>; -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | man page form_win.3x</EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_582_14" HREF="terminal_interface-curses-forms__ads.htm#ref_507_14">Set_Window</A></span> (<span class="symbol"><A NAME="ref_582_26" HREF="terminal_interface-curses-forms__ads.htm#ref_507_26">Frm</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -+ <span class="symbol"><A NAME="ref_583_26" HREF="terminal_interface-curses-forms__ads.htm#ref_508_26">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_585_16">Set_Form_Win</A></FONT> (<FONT COLOR=red><A NAME="ref_585_30" HREF="terminal_interface-curses-forms__adb.htm#ref_585_16">Frm</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -- <FONT COLOR=red><A NAME="ref_586_30" HREF="terminal_interface-curses-forms__adb.htm#ref_585_16">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_585_16">Set_Form_Win</A></span> (<span class="symbol"><A NAME="ref_585_30" HREF="terminal_interface-curses-forms__adb.htm#ref_585_16">Frm</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -+ <span class="symbol"><A NAME="ref_586_30" HREF="terminal_interface-curses-forms__adb.htm#ref_585_16">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Set_Form_Win, "set_form_win"); - -- <FONT COLOR=red><A NAME="ref_589_7">Res</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := <A HREF="terminal_interface-curses-forms__adb.htm#ref_585_16">Set_Form_Win</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_509_26">Frm</A>, <A HREF="terminal_interface-curses-forms__ads.htm#ref_510_26">Win</A>); -+ <span class="symbol"><A NAME="ref_589_7">Res</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := <A HREF="terminal_interface-curses-forms__adb.htm#ref_585_16">Set_Form_Win</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_507_26">Frm</A>, <A HREF="terminal_interface-curses-forms__ads.htm#ref_508_26">Win</A>); - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses-forms__adb.htm#ref_589_7">Res</A> /= <A HREF="terminal_interface-curses-aux__ads.htm#ref_80_4">E_Ok</A> <b>then</b> - <A HREF="terminal_interface-curses-aux__ads.htm#ref_96_14">Eti_Exception</A> (<A HREF="terminal_interface-curses-forms__adb.htm#ref_589_7">Res</A>); - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_509_14">Set_Window</A>; -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_598_13" HREF="terminal_interface-curses-forms__ads.htm#ref_515_13">Get_Window</A></FONT> (<FONT COLOR=red><A NAME="ref_598_25" HREF="terminal_interface-curses-forms__ads.htm#ref_515_25">Frm</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> -+ <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_507_14">Set_Window</A>; -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_598_13" HREF="terminal_interface-curses-forms__ads.htm#ref_513_13">Get_Window</A></span> (<span class="symbol"><A NAME="ref_598_25" HREF="terminal_interface-curses-forms__ads.htm#ref_513_25">Frm</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_600_16">Form_Win</A></FONT> (<FONT COLOR=red><A NAME="ref_600_26" HREF="terminal_interface-curses-forms__adb.htm#ref_600_16">Frm</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_600_16">Form_Win</A></span> (<span class="symbol"><A NAME="ref_600_26" HREF="terminal_interface-curses-forms__adb.htm#ref_600_16">Frm</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; - <b>pragma</b> Import (C, Form_Win, "form_win"); - -- <FONT COLOR=red><A NAME="ref_603_7">W</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses-forms__adb.htm#ref_600_16">Form_Win</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_515_25">Frm</A>); -+ <span class="symbol"><A NAME="ref_603_7">W</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses-forms__adb.htm#ref_600_16">Form_Win</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_513_25">Frm</A>); - <b>begin</b> - <b>return</b> <A HREF="terminal_interface-curses-forms__adb.htm#ref_603_7">W</A>; -- <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_515_13">Get_Window</A>; -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_610_14" HREF="terminal_interface-curses-forms__ads.htm#ref_520_14">Set_Sub_Window</A></FONT> (<FONT COLOR=red><A NAME="ref_610_30" HREF="terminal_interface-curses-forms__ads.htm#ref_520_30">Frm</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -- <FONT COLOR=red><A NAME="ref_611_30" HREF="terminal_interface-curses-forms__ads.htm#ref_521_30">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) -+ <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_513_13">Get_Window</A>; -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_610_14" HREF="terminal_interface-curses-forms__ads.htm#ref_518_14">Set_Sub_Window</A></span> (<span class="symbol"><A NAME="ref_610_30" HREF="terminal_interface-curses-forms__ads.htm#ref_518_30">Frm</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -+ <span class="symbol"><A NAME="ref_611_30" HREF="terminal_interface-curses-forms__ads.htm#ref_519_30">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_613_16">Set_Form_Sub</A></FONT> (<FONT COLOR=red><A NAME="ref_613_30" HREF="terminal_interface-curses-forms__adb.htm#ref_613_16">Frm</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -- <FONT COLOR=red><A NAME="ref_614_30" HREF="terminal_interface-curses-forms__adb.htm#ref_613_16">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_613_16">Set_Form_Sub</A></span> (<span class="symbol"><A NAME="ref_613_30" HREF="terminal_interface-curses-forms__adb.htm#ref_613_16">Frm</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -+ <span class="symbol"><A NAME="ref_614_30" HREF="terminal_interface-curses-forms__adb.htm#ref_613_16">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Set_Form_Sub, "set_form_sub"); - -- <FONT COLOR=red><A NAME="ref_617_7">Res</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := <A HREF="terminal_interface-curses-forms__adb.htm#ref_613_16">Set_Form_Sub</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_520_30">Frm</A>, <A HREF="terminal_interface-curses-forms__ads.htm#ref_521_30">Win</A>); -+ <span class="symbol"><A NAME="ref_617_7">Res</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := <A HREF="terminal_interface-curses-forms__adb.htm#ref_613_16">Set_Form_Sub</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_518_30">Frm</A>, <A HREF="terminal_interface-curses-forms__ads.htm#ref_519_30">Win</A>); - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses-forms__adb.htm#ref_617_7">Res</A> /= <A HREF="terminal_interface-curses-aux__ads.htm#ref_80_4">E_Ok</A> <b>then</b> - <A HREF="terminal_interface-curses-aux__ads.htm#ref_96_14">Eti_Exception</A> (<A HREF="terminal_interface-curses-forms__adb.htm#ref_617_7">Res</A>); - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_520_14">Set_Sub_Window</A>; -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_626_13" HREF="terminal_interface-curses-forms__ads.htm#ref_526_13">Get_Sub_Window</A></FONT> (<FONT COLOR=red><A NAME="ref_626_29" HREF="terminal_interface-curses-forms__ads.htm#ref_526_29">Frm</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> -+ <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_518_14">Set_Sub_Window</A>; -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_626_13" HREF="terminal_interface-curses-forms__ads.htm#ref_524_13">Get_Sub_Window</A></span> (<span class="symbol"><A NAME="ref_626_29" HREF="terminal_interface-curses-forms__ads.htm#ref_524_29">Frm</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_628_16">Form_Sub</A></FONT> (<FONT COLOR=red><A NAME="ref_628_26" HREF="terminal_interface-curses-forms__adb.htm#ref_628_16">Frm</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_628_16">Form_Sub</A></span> (<span class="symbol"><A NAME="ref_628_26" HREF="terminal_interface-curses-forms__adb.htm#ref_628_16">Frm</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; - <b>pragma</b> Import (C, Form_Sub, "form_sub"); - -- <FONT COLOR=red><A NAME="ref_631_7">W</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses-forms__adb.htm#ref_628_16">Form_Sub</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_526_29">Frm</A>); -+ <span class="symbol"><A NAME="ref_631_7">W</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses-forms__adb.htm#ref_628_16">Form_Sub</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_524_29">Frm</A>); - <b>begin</b> - <b>return</b> <A HREF="terminal_interface-curses-forms__adb.htm#ref_631_7">W</A>; -- <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_526_13">Get_Sub_Window</A>; -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_638_14" HREF="terminal_interface-curses-forms__ads.htm#ref_531_14">Scale</A></FONT> (<FONT COLOR=red><A NAME="ref_638_21" HREF="terminal_interface-curses-forms__ads.htm#ref_531_21">Frm</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -- <FONT COLOR=red><A NAME="ref_639_21" HREF="terminal_interface-curses-forms__ads.htm#ref_532_21">Lines</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_63_12">Line_Count</A>; -- <FONT COLOR=red><A NAME="ref_640_21" HREF="terminal_interface-curses-forms__ads.htm#ref_533_21">Columns</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_65_12">Column_Count</A>) -+ <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_524_13">Get_Sub_Window</A>; -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_638_14" HREF="terminal_interface-curses-forms__ads.htm#ref_529_14">Scale</A></span> (<span class="symbol"><A NAME="ref_638_21" HREF="terminal_interface-curses-forms__ads.htm#ref_529_21">Frm</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -+ <span class="symbol"><A NAME="ref_639_21" HREF="terminal_interface-curses-forms__ads.htm#ref_530_21">Lines</A></span> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_63_12">Line_Count</A>; -+ <span class="symbol"><A NAME="ref_640_21" HREF="terminal_interface-curses-forms__ads.htm#ref_531_21">Columns</A></span> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_65_12">Column_Count</A>) - <b>is</b> -- <b>type</b> <FONT COLOR=red><A NAME="ref_642_12">C_Int_Access</A></FONT> <b>is</b> <b>access</b> <b>all</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -- <b>function</b> <FONT COLOR=red><A NAME="ref_643_16">M_Scale</A></FONT> (<FONT COLOR=red><A NAME="ref_643_25" HREF="terminal_interface-curses-forms__adb.htm#ref_643_16">Frm</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; <FONT COLOR=red><A NAME="ref_643_37" HREF="terminal_interface-curses-forms__adb.htm#ref_643_16">Yp</A></FONT>, <FONT COLOR=red><A NAME="ref_643_41" HREF="terminal_interface-curses-forms__adb.htm#ref_643_16">Xp</A></FONT> : <A HREF="terminal_interface-curses-forms__adb.htm#ref_642_12">C_Int_Access</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>type</b> <span class="symbol"><A NAME="ref_642_12">C_Int_Access</A></span> <b>is</b> <b>access</b> <b>all</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_643_16">M_Scale</A></span> (<span class="symbol"><A NAME="ref_643_25" HREF="terminal_interface-curses-forms__adb.htm#ref_643_16">Frm</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; <span class="symbol"><A NAME="ref_643_37" HREF="terminal_interface-curses-forms__adb.htm#ref_643_16">Yp</A></span>, <span class="symbol"><A NAME="ref_643_41" HREF="terminal_interface-curses-forms__adb.htm#ref_643_16">Xp</A></span> : <A HREF="terminal_interface-curses-forms__adb.htm#ref_642_12">C_Int_Access</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, M_Scale, "scale_form"); - -- <FONT COLOR=red><A NAME="ref_646_7">X</A></FONT>, <FONT COLOR=red><A NAME="ref_646_10">Y</A></FONT> : <b>aliased</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -- <FONT COLOR=red><A NAME="ref_647_7">Res</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := <A HREF="terminal_interface-curses-forms__adb.htm#ref_643_16">M_Scale</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_531_21">Frm</A>, <A HREF="terminal_interface-curses-forms__adb.htm#ref_646_10">Y</A>'<b>Access</b>, <A HREF="terminal_interface-curses-forms__adb.htm#ref_646_7">X</A>'<b>Access</b>); -+ <span class="symbol"><A NAME="ref_646_7">X</A></span>, <span class="symbol"><A NAME="ref_646_10">Y</A></span> : <b>aliased</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <span class="symbol"><A NAME="ref_647_7">Res</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := <A HREF="terminal_interface-curses-forms__adb.htm#ref_643_16">M_Scale</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_529_21">Frm</A>, <A HREF="terminal_interface-curses-forms__adb.htm#ref_646_10">Y</A>'<b>Access</b>, <A HREF="terminal_interface-curses-forms__adb.htm#ref_646_7">X</A>'<b>Access</b>); - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses-forms__adb.htm#ref_647_7">Res</A> /= <A HREF="terminal_interface-curses-aux__ads.htm#ref_80_4">E_Ok</A> <b>then</b> - <A HREF="terminal_interface-curses-aux__ads.htm#ref_96_14">Eti_Exception</A> (<A HREF="terminal_interface-curses-forms__adb.htm#ref_647_7">Res</A>); - <b>end</b> <b>if</b>; -- <A HREF="terminal_interface-curses-forms__ads.htm#ref_532_21">Lines</A> := <A HREF="terminal_interface-curses__ads.htm#ref_63_12">Line_Count</A> (<A HREF="terminal_interface-curses-forms__adb.htm#ref_646_10">Y</A>); -- <A HREF="terminal_interface-curses-forms__ads.htm#ref_533_21">Columns</A> := <A HREF="terminal_interface-curses__ads.htm#ref_65_12">Column_Count</A> (<A HREF="terminal_interface-curses-forms__adb.htm#ref_646_7">X</A>); -- <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_531_14">Scale</A>; -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | man page menu_hook.3x</EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_662_14" HREF="terminal_interface-curses-forms__ads.htm#ref_545_14">Set_Field_Init_Hook</A></FONT> (<FONT COLOR=red><A NAME="ref_662_35" HREF="terminal_interface-curses-forms__ads.htm#ref_545_35">Frm</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -- <FONT COLOR=red><A NAME="ref_663_35" HREF="terminal_interface-curses-forms__ads.htm#ref_546_35">Proc</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_541_9">Form_Hook_Function</A>) -+ <A HREF="terminal_interface-curses-forms__ads.htm#ref_530_21">Lines</A> := <A HREF="terminal_interface-curses__ads.htm#ref_63_12">Line_Count</A> (<A HREF="terminal_interface-curses-forms__adb.htm#ref_646_10">Y</A>); -+ <A HREF="terminal_interface-curses-forms__ads.htm#ref_531_21">Columns</A> := <A HREF="terminal_interface-curses__ads.htm#ref_65_12">Column_Count</A> (<A HREF="terminal_interface-curses-forms__adb.htm#ref_646_7">X</A>); -+ <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_529_14">Scale</A>; -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | man page menu_hook.3x</EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_662_14" HREF="terminal_interface-curses-forms__ads.htm#ref_543_14">Set_Field_Init_Hook</A></span> (<span class="symbol"><A NAME="ref_662_35" HREF="terminal_interface-curses-forms__ads.htm#ref_543_35">Frm</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -+ <span class="symbol"><A NAME="ref_663_35" HREF="terminal_interface-curses-forms__ads.htm#ref_544_35">Proc</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_539_9">Form_Hook_Function</A>) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_665_16">Set_Field_Init</A></FONT> (<FONT COLOR=red><A NAME="ref_665_32" HREF="terminal_interface-curses-forms__adb.htm#ref_665_16">Frm</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -- <FONT COLOR=red><A NAME="ref_666_32" HREF="terminal_interface-curses-forms__adb.htm#ref_665_16">Proc</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_541_9">Form_Hook_Function</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_665_16">Set_Field_Init</A></span> (<span class="symbol"><A NAME="ref_665_32" HREF="terminal_interface-curses-forms__adb.htm#ref_665_16">Frm</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -+ <span class="symbol"><A NAME="ref_666_32" HREF="terminal_interface-curses-forms__adb.htm#ref_665_16">Proc</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_539_9">Form_Hook_Function</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Set_Field_Init, "set_field_init"); - -- <FONT COLOR=red><A NAME="ref_669_7">Res</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := <A HREF="terminal_interface-curses-forms__adb.htm#ref_665_16">Set_Field_Init</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_545_35">Frm</A>, <A HREF="terminal_interface-curses-forms__ads.htm#ref_546_35">Proc</A>); -+ <span class="symbol"><A NAME="ref_669_7">Res</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := <A HREF="terminal_interface-curses-forms__adb.htm#ref_665_16">Set_Field_Init</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_543_35">Frm</A>, <A HREF="terminal_interface-curses-forms__ads.htm#ref_544_35">Proc</A>); - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses-forms__adb.htm#ref_669_7">Res</A> /= <A HREF="terminal_interface-curses-aux__ads.htm#ref_80_4">E_Ok</A> <b>then</b> - <A HREF="terminal_interface-curses-aux__ads.htm#ref_96_14">Eti_Exception</A> (<A HREF="terminal_interface-curses-forms__adb.htm#ref_669_7">Res</A>); - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_545_14">Set_Field_Init_Hook</A>; -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_678_14" HREF="terminal_interface-curses-forms__ads.htm#ref_551_14">Set_Field_Term_Hook</A></FONT> (<FONT COLOR=red><A NAME="ref_678_35" HREF="terminal_interface-curses-forms__ads.htm#ref_551_35">Frm</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -- <FONT COLOR=red><A NAME="ref_679_35" HREF="terminal_interface-curses-forms__ads.htm#ref_552_35">Proc</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_541_9">Form_Hook_Function</A>) -+ <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_543_14">Set_Field_Init_Hook</A>; -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_678_14" HREF="terminal_interface-curses-forms__ads.htm#ref_549_14">Set_Field_Term_Hook</A></span> (<span class="symbol"><A NAME="ref_678_35" HREF="terminal_interface-curses-forms__ads.htm#ref_549_35">Frm</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -+ <span class="symbol"><A NAME="ref_679_35" HREF="terminal_interface-curses-forms__ads.htm#ref_550_35">Proc</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_539_9">Form_Hook_Function</A>) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_681_16">Set_Field_Term</A></FONT> (<FONT COLOR=red><A NAME="ref_681_32" HREF="terminal_interface-curses-forms__adb.htm#ref_681_16">Frm</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -- <FONT COLOR=red><A NAME="ref_682_32" HREF="terminal_interface-curses-forms__adb.htm#ref_681_16">Proc</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_541_9">Form_Hook_Function</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_681_16">Set_Field_Term</A></span> (<span class="symbol"><A NAME="ref_681_32" HREF="terminal_interface-curses-forms__adb.htm#ref_681_16">Frm</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -+ <span class="symbol"><A NAME="ref_682_32" HREF="terminal_interface-curses-forms__adb.htm#ref_681_16">Proc</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_539_9">Form_Hook_Function</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Set_Field_Term, "set_field_term"); - -- <FONT COLOR=red><A NAME="ref_685_7">Res</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := <A HREF="terminal_interface-curses-forms__adb.htm#ref_681_16">Set_Field_Term</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_551_35">Frm</A>, <A HREF="terminal_interface-curses-forms__ads.htm#ref_552_35">Proc</A>); -+ <span class="symbol"><A NAME="ref_685_7">Res</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := <A HREF="terminal_interface-curses-forms__adb.htm#ref_681_16">Set_Field_Term</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_549_35">Frm</A>, <A HREF="terminal_interface-curses-forms__ads.htm#ref_550_35">Proc</A>); - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses-forms__adb.htm#ref_685_7">Res</A> /= <A HREF="terminal_interface-curses-aux__ads.htm#ref_80_4">E_Ok</A> <b>then</b> - <A HREF="terminal_interface-curses-aux__ads.htm#ref_96_14">Eti_Exception</A> (<A HREF="terminal_interface-curses-forms__adb.htm#ref_685_7">Res</A>); - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_551_14">Set_Field_Term_Hook</A>; -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_694_14" HREF="terminal_interface-curses-forms__ads.htm#ref_557_14">Set_Form_Init_Hook</A></FONT> (<FONT COLOR=red><A NAME="ref_694_34" HREF="terminal_interface-curses-forms__ads.htm#ref_557_34">Frm</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -- <FONT COLOR=red><A NAME="ref_695_34" HREF="terminal_interface-curses-forms__ads.htm#ref_558_34">Proc</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_541_9">Form_Hook_Function</A>) -+ <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_549_14">Set_Field_Term_Hook</A>; -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_694_14" HREF="terminal_interface-curses-forms__ads.htm#ref_555_14">Set_Form_Init_Hook</A></span> (<span class="symbol"><A NAME="ref_694_34" HREF="terminal_interface-curses-forms__ads.htm#ref_555_34">Frm</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -+ <span class="symbol"><A NAME="ref_695_34" HREF="terminal_interface-curses-forms__ads.htm#ref_556_34">Proc</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_539_9">Form_Hook_Function</A>) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_697_16">Set_Form_Init</A></FONT> (<FONT COLOR=red><A NAME="ref_697_31" HREF="terminal_interface-curses-forms__adb.htm#ref_697_16">Frm</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -- <FONT COLOR=red><A NAME="ref_698_31" HREF="terminal_interface-curses-forms__adb.htm#ref_697_16">Proc</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_541_9">Form_Hook_Function</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_697_16">Set_Form_Init</A></span> (<span class="symbol"><A NAME="ref_697_31" HREF="terminal_interface-curses-forms__adb.htm#ref_697_16">Frm</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -+ <span class="symbol"><A NAME="ref_698_31" HREF="terminal_interface-curses-forms__adb.htm#ref_697_16">Proc</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_539_9">Form_Hook_Function</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Set_Form_Init, "set_form_init"); - -- <FONT COLOR=red><A NAME="ref_701_7">Res</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := <A HREF="terminal_interface-curses-forms__adb.htm#ref_697_16">Set_Form_Init</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_557_34">Frm</A>, <A HREF="terminal_interface-curses-forms__ads.htm#ref_558_34">Proc</A>); -+ <span class="symbol"><A NAME="ref_701_7">Res</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := <A HREF="terminal_interface-curses-forms__adb.htm#ref_697_16">Set_Form_Init</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_555_34">Frm</A>, <A HREF="terminal_interface-curses-forms__ads.htm#ref_556_34">Proc</A>); - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses-forms__adb.htm#ref_701_7">Res</A> /= <A HREF="terminal_interface-curses-aux__ads.htm#ref_80_4">E_Ok</A> <b>then</b> - <A HREF="terminal_interface-curses-aux__ads.htm#ref_96_14">Eti_Exception</A> (<A HREF="terminal_interface-curses-forms__adb.htm#ref_701_7">Res</A>); - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_557_14">Set_Form_Init_Hook</A>; -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_710_14" HREF="terminal_interface-curses-forms__ads.htm#ref_563_14">Set_Form_Term_Hook</A></FONT> (<FONT COLOR=red><A NAME="ref_710_34" HREF="terminal_interface-curses-forms__ads.htm#ref_563_34">Frm</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -- <FONT COLOR=red><A NAME="ref_711_34" HREF="terminal_interface-curses-forms__ads.htm#ref_564_34">Proc</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_541_9">Form_Hook_Function</A>) -+ <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_555_14">Set_Form_Init_Hook</A>; -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_710_14" HREF="terminal_interface-curses-forms__ads.htm#ref_561_14">Set_Form_Term_Hook</A></span> (<span class="symbol"><A NAME="ref_710_34" HREF="terminal_interface-curses-forms__ads.htm#ref_561_34">Frm</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -+ <span class="symbol"><A NAME="ref_711_34" HREF="terminal_interface-curses-forms__ads.htm#ref_562_34">Proc</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_539_9">Form_Hook_Function</A>) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_713_16">Set_Form_Term</A></FONT> (<FONT COLOR=red><A NAME="ref_713_31" HREF="terminal_interface-curses-forms__adb.htm#ref_713_16">Frm</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -- <FONT COLOR=red><A NAME="ref_714_31" HREF="terminal_interface-curses-forms__adb.htm#ref_713_16">Proc</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_541_9">Form_Hook_Function</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_713_16">Set_Form_Term</A></span> (<span class="symbol"><A NAME="ref_713_31" HREF="terminal_interface-curses-forms__adb.htm#ref_713_16">Frm</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -+ <span class="symbol"><A NAME="ref_714_31" HREF="terminal_interface-curses-forms__adb.htm#ref_713_16">Proc</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_539_9">Form_Hook_Function</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Set_Form_Term, "set_form_term"); - -- <FONT COLOR=red><A NAME="ref_717_7">Res</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := <A HREF="terminal_interface-curses-forms__adb.htm#ref_713_16">Set_Form_Term</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_563_34">Frm</A>, <A HREF="terminal_interface-curses-forms__ads.htm#ref_564_34">Proc</A>); -+ <span class="symbol"><A NAME="ref_717_7">Res</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := <A HREF="terminal_interface-curses-forms__adb.htm#ref_713_16">Set_Form_Term</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_561_34">Frm</A>, <A HREF="terminal_interface-curses-forms__ads.htm#ref_562_34">Proc</A>); - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses-forms__adb.htm#ref_717_7">Res</A> /= <A HREF="terminal_interface-curses-aux__ads.htm#ref_80_4">E_Ok</A> <b>then</b> - <A HREF="terminal_interface-curses-aux__ads.htm#ref_96_14">Eti_Exception</A> (<A HREF="terminal_interface-curses-forms__adb.htm#ref_717_7">Res</A>); - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_563_14">Set_Form_Term_Hook</A>; -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | man page form_fields.3x</EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_730_14" HREF="terminal_interface-curses-forms__ads.htm#ref_593_14">Redefine</A></FONT> (<FONT COLOR=red><A NAME="ref_730_24" HREF="terminal_interface-curses-forms__ads.htm#ref_593_24">Frm</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -- <FONT COLOR=red><A NAME="ref_731_24" HREF="terminal_interface-curses-forms__ads.htm#ref_594_24">Flds</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_138_9">Field_Array_Access</A>) -+ <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_561_14">Set_Form_Term_Hook</A>; -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | man page form_fields.3x</EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_730_14" HREF="terminal_interface-curses-forms__ads.htm#ref_591_14">Redefine</A></span> (<span class="symbol"><A NAME="ref_730_24" HREF="terminal_interface-curses-forms__ads.htm#ref_591_24">Frm</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -+ <span class="symbol"><A NAME="ref_731_24" HREF="terminal_interface-curses-forms__ads.htm#ref_592_24">Flds</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_136_9">Field_Array_Access</A>) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_733_16">Set_Frm_Fields</A></FONT> (<FONT COLOR=red><A NAME="ref_733_32" HREF="terminal_interface-curses-forms__adb.htm#ref_733_16">Frm</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -- <FONT COLOR=red><A NAME="ref_734_32" HREF="terminal_interface-curses-forms__adb.htm#ref_733_16">Items</A></FONT> : System.Address) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_733_16">Set_Frm_Fields</A></span> (<span class="symbol"><A NAME="ref_733_32" HREF="terminal_interface-curses-forms__adb.htm#ref_733_16">Frm</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -+ <span class="symbol"><A NAME="ref_734_32" HREF="terminal_interface-curses-forms__adb.htm#ref_733_16">Items</A></span> : System.Address) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Set_Frm_Fields, "set_form_fields"); - -- <FONT COLOR=red><A NAME="ref_737_7">Res</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A>; -+ <span class="symbol"><A NAME="ref_737_7">Res</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A>; - <b>begin</b> -- <b>pragma</b> Assert (<A HREF="terminal_interface-curses-forms__ads.htm#ref_594_24">Flds</A>.<b>all</b> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_594_24">Flds</A>'Last) = <A HREF="terminal_interface-curses-forms__ads.htm#ref_59_4">Null_Field</A>); -- <b>if</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_594_24">Flds</A>.<b>all</b> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_594_24">Flds</A>'Last) /= <A HREF="terminal_interface-curses-forms__ads.htm#ref_59_4">Null_Field</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_290_4">Form_Exception</A>; -+ <b>pragma</b> Assert (<A HREF="terminal_interface-curses-forms__ads.htm#ref_592_24">Flds</A>.<b>all</b> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_592_24">Flds</A>'Last) = <A HREF="terminal_interface-curses-forms__ads.htm#ref_59_4">Null_Field</A>); -+ <b>if</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_592_24">Flds</A>.<b>all</b> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_592_24">Flds</A>'Last) /= <A HREF="terminal_interface-curses-forms__ads.htm#ref_59_4">Null_Field</A> <b>then</b> -+ <b>raise</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_288_4">Form_Exception</A>; - <b>else</b> -- <A HREF="terminal_interface-curses-forms__adb.htm#ref_737_7">Res</A> := <A HREF="terminal_interface-curses-forms__adb.htm#ref_733_16">Set_Frm_Fields</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_593_24">Frm</A>, <A HREF="terminal_interface-curses-forms__ads.htm#ref_594_24">Flds</A>.<b>all</b> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_594_24">Flds</A>'First)'Address); -+ <A HREF="terminal_interface-curses-forms__adb.htm#ref_737_7">Res</A> := <A HREF="terminal_interface-curses-forms__adb.htm#ref_733_16">Set_Frm_Fields</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_591_24">Frm</A>, <A HREF="terminal_interface-curses-forms__ads.htm#ref_592_24">Flds</A>.<b>all</b> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_592_24">Flds</A>'First)'Address); - <b>if</b> <A HREF="terminal_interface-curses-forms__adb.htm#ref_737_7">Res</A> /= <A HREF="terminal_interface-curses-aux__ads.htm#ref_80_4">E_Ok</A> <b>then</b> - <A HREF="terminal_interface-curses-aux__ads.htm#ref_96_14">Eti_Exception</A> (<A HREF="terminal_interface-curses-forms__adb.htm#ref_737_7">Res</A>); - <b>end</b> <b>if</b>; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_593_14">Redefine</A>; -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_752_13" HREF="terminal_interface-curses-forms__ads.htm#ref_605_13">Fields</A></FONT> (<FONT COLOR=red><A NAME="ref_752_21" HREF="terminal_interface-curses-forms__ads.htm#ref_605_21">Frm</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -- <FONT COLOR=red><A NAME="ref_753_21" HREF="terminal_interface-curses-forms__ads.htm#ref_606_21">Index</A></FONT> : Positive) <b>return</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A> -+ <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_591_14">Redefine</A>; -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_752_13" HREF="terminal_interface-curses-forms__ads.htm#ref_603_13">Fields</A></span> (<span class="symbol"><A NAME="ref_752_21" HREF="terminal_interface-curses-forms__ads.htm#ref_603_21">Frm</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -+ <span class="symbol"><A NAME="ref_753_21" HREF="terminal_interface-curses-forms__ads.htm#ref_604_21">Index</A></span> : Positive) <b>return</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A> - <b>is</b> - <b>use</b> F_Array; - -- <b>function</b> C_Fields (<FONT COLOR=red><A NAME="ref_757_26">Frm</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>) <b>return</b> Pointer; -+ <b>function</b> C_Fields (<span class="symbol"><A NAME="ref_757_26">Frm</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>) <b>return</b> Pointer; - <b>pragma</b> Import (C, C_Fields, "form_fields"); - -- P : Pointer := C_Fields (<A HREF="terminal_interface-curses-forms__ads.htm#ref_605_21">Frm</A>); -+ P : Pointer := C_Fields (<A HREF="terminal_interface-curses-forms__ads.htm#ref_603_21">Frm</A>); - <b>begin</b> -- <b>if</b> P = <b>null</b> <b>or</b> <b>else</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_606_21">Index</A> &gt; <A HREF="terminal_interface-curses-forms__ads.htm#ref_611_13">Field_Count</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_605_21">Frm</A>) <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_290_4">Form_Exception</A>; -+ <b>if</b> P = <b>null</b> <b>or</b> <b>else</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_604_21">Index</A> &gt; <A HREF="terminal_interface-curses-forms__ads.htm#ref_609_13">Field_Count</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_603_21">Frm</A>) <b>then</b> -+ <b>raise</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_288_4">Form_Exception</A>; - <b>else</b> -- P := P + ptrdiff_t (<A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_606_21">Index</A>) - 1); -+ P := P + ptrdiff_t (<A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_604_21">Index</A>) - 1); - <b>return</b> P.<b>all</b>; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_605_13">Fields</A>; -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_772_13" HREF="terminal_interface-curses-forms__ads.htm#ref_611_13">Field_Count</A></FONT> (<FONT COLOR=red><A NAME="ref_772_26" HREF="terminal_interface-curses-forms__ads.htm#ref_611_26">Frm</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>) <b>return</b> Natural -+ <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_603_13">Fields</A>; -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_772_13" HREF="terminal_interface-curses-forms__ads.htm#ref_609_13">Field_Count</A></span> (<span class="symbol"><A NAME="ref_772_26" HREF="terminal_interface-curses-forms__ads.htm#ref_609_26">Frm</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>) <b>return</b> Natural - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_774_16">Count</A></FONT> (<FONT COLOR=red><A NAME="ref_774_23" HREF="terminal_interface-curses-forms__adb.htm#ref_774_16">Frm</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_774_16">Count</A></span> (<span class="symbol"><A NAME="ref_774_23" HREF="terminal_interface-curses-forms__adb.htm#ref_774_16">Frm</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Count, "field_count"); - <b>begin</b> -- <b>return</b> Natural (<A HREF="terminal_interface-curses-forms__adb.htm#ref_774_16">Count</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_611_26">Frm</A>)); -- <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_611_13">Field_Count</A>; -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_782_14" HREF="terminal_interface-curses-forms__ads.htm#ref_616_14">Move</A></FONT> (<FONT COLOR=red><A NAME="ref_782_20" HREF="terminal_interface-curses-forms__ads.htm#ref_616_20">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_783_20" HREF="terminal_interface-curses-forms__ads.htm#ref_617_20">Line</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_784_20" HREF="terminal_interface-curses-forms__ads.htm#ref_618_20">Column</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>) -+ <b>return</b> Natural (<A HREF="terminal_interface-curses-forms__adb.htm#ref_774_16">Count</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_609_26">Frm</A>)); -+ <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_609_13">Field_Count</A>; -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_782_14" HREF="terminal_interface-curses-forms__ads.htm#ref_614_14">Move</A></span> (<span class="symbol"><A NAME="ref_782_20" HREF="terminal_interface-curses-forms__ads.htm#ref_614_20">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_783_20" HREF="terminal_interface-curses-forms__ads.htm#ref_615_20">Line</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_784_20" HREF="terminal_interface-curses-forms__ads.htm#ref_616_20">Column</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_786_16">Move</A></FONT> (<FONT COLOR=red><A NAME="ref_786_22" HREF="terminal_interface-curses-forms__adb.htm#ref_786_16">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; <FONT COLOR=red><A NAME="ref_786_35" HREF="terminal_interface-curses-forms__adb.htm#ref_786_16">L</A></FONT>, <FONT COLOR=red><A NAME="ref_786_38" HREF="terminal_interface-curses-forms__adb.htm#ref_786_16">C</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_786_16">Move</A></span> (<span class="symbol"><A NAME="ref_786_22" HREF="terminal_interface-curses-forms__adb.htm#ref_786_16">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; <span class="symbol"><A NAME="ref_786_35" HREF="terminal_interface-curses-forms__adb.htm#ref_786_16">L</A></span>, <span class="symbol"><A NAME="ref_786_38" HREF="terminal_interface-curses-forms__adb.htm#ref_786_16">C</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Move, "move_field"); - -- <FONT COLOR=red><A NAME="ref_789_7">Res</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := <A HREF="terminal_interface-curses-forms__adb.htm#ref_786_16">Move</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_616_20">Fld</A>, <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_617_20">Line</A>), <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_618_20">Column</A>)); -+ <span class="symbol"><A NAME="ref_789_7">Res</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := <A HREF="terminal_interface-curses-forms__adb.htm#ref_786_16">Move</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_614_20">Fld</A>, <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_615_20">Line</A>), <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_616_20">Column</A>)); - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses-forms__adb.htm#ref_789_7">Res</A> /= <A HREF="terminal_interface-curses-aux__ads.htm#ref_80_4">E_Ok</A> <b>then</b> - <A HREF="terminal_interface-curses-aux__ads.htm#ref_96_14">Eti_Exception</A> (<A HREF="terminal_interface-curses-forms__adb.htm#ref_789_7">Res</A>); - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_616_14">Move</A>; -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | man page form_new.3x</EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_802_13" HREF="terminal_interface-curses-forms__ads.htm#ref_627_13">Create</A></FONT> (<FONT COLOR=red><A NAME="ref_802_21" HREF="terminal_interface-curses-forms__ads.htm#ref_627_21">Fields</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_138_9">Field_Array_Access</A>) <b>return</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A> -+ <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_614_14">Move</A>; -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | man page form_new.3x</EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_802_13" HREF="terminal_interface-curses-forms__ads.htm#ref_625_13">Create</A></span> (<span class="symbol"><A NAME="ref_802_21" HREF="terminal_interface-curses-forms__ads.htm#ref_625_21">Fields</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_136_9">Field_Array_Access</A>) <b>return</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A> - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_804_16">NewForm</A></FONT> (<FONT COLOR=red><A NAME="ref_804_25" HREF="terminal_interface-curses-forms__adb.htm#ref_804_16">Fields</A></FONT> : System.Address) <b>return</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_804_16">NewForm</A></span> (<span class="symbol"><A NAME="ref_804_25" HREF="terminal_interface-curses-forms__adb.htm#ref_804_16">Fields</A></span> : System.Address) <b>return</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; - <b>pragma</b> Import (C, NewForm, "new_form"); - -- <FONT COLOR=red><A NAME="ref_807_7">M</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -+ <span class="symbol"><A NAME="ref_807_7">M</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; - <b>begin</b> -- <b>pragma</b> Assert (<A HREF="terminal_interface-curses-forms__ads.htm#ref_627_21">Fields</A>.<b>all</b> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_627_21">Fields</A>'Last) = <A HREF="terminal_interface-curses-forms__ads.htm#ref_59_4">Null_Field</A>); -- <b>if</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_627_21">Fields</A>.<b>all</b> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_627_21">Fields</A>'Last) /= <A HREF="terminal_interface-curses-forms__ads.htm#ref_59_4">Null_Field</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_290_4">Form_Exception</A>; -+ <b>pragma</b> Assert (<A HREF="terminal_interface-curses-forms__ads.htm#ref_625_21">Fields</A>.<b>all</b> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_625_21">Fields</A>'Last) = <A HREF="terminal_interface-curses-forms__ads.htm#ref_59_4">Null_Field</A>); -+ <b>if</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_625_21">Fields</A>.<b>all</b> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_625_21">Fields</A>'Last) /= <A HREF="terminal_interface-curses-forms__ads.htm#ref_59_4">Null_Field</A> <b>then</b> -+ <b>raise</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_288_4">Form_Exception</A>; - <b>else</b> -- <A HREF="terminal_interface-curses-forms__adb.htm#ref_807_7">M</A> := <A HREF="terminal_interface-curses-forms__adb.htm#ref_804_16">NewForm</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_627_21">Fields</A>.<b>all</b> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_627_21">Fields</A>'First)'Address); -+ <A HREF="terminal_interface-curses-forms__adb.htm#ref_807_7">M</A> := <A HREF="terminal_interface-curses-forms__adb.htm#ref_804_16">NewForm</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_625_21">Fields</A>.<b>all</b> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_625_21">Fields</A>'First)'Address); - <b>if</b> <A HREF="terminal_interface-curses-forms__adb.htm#ref_807_7">M</A> = <A HREF="terminal_interface-curses-forms__ads.htm#ref_60_4">Null_Form</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_290_4">Form_Exception</A>; -+ <b>raise</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_288_4">Form_Exception</A>; - <b>end</b> <b>if</b>; - <b>return</b> <A HREF="terminal_interface-curses-forms__adb.htm#ref_807_7">M</A>; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_627_13">Create</A>; -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_823_14" HREF="terminal_interface-curses-forms__ads.htm#ref_638_14">Delete</A></FONT> (<FONT COLOR=red><A NAME="ref_823_22" HREF="terminal_interface-curses-forms__ads.htm#ref_638_22">Frm</A></FONT> : <b>in</b> <b>out</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>) -+ <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_625_13">Create</A>; -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_823_14" HREF="terminal_interface-curses-forms__ads.htm#ref_636_14">Delete</A></span> (<span class="symbol"><A NAME="ref_823_22" HREF="terminal_interface-curses-forms__ads.htm#ref_636_22">Frm</A></span> : <b>in</b> <b>out</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_825_16">Free</A></FONT> (<FONT COLOR=red><A NAME="ref_825_22" HREF="terminal_interface-curses-forms__adb.htm#ref_825_16">Frm</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_825_16">Free</A></span> (<span class="symbol"><A NAME="ref_825_22" HREF="terminal_interface-curses-forms__adb.htm#ref_825_16">Frm</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Free, "free_form"); - -- <FONT COLOR=red><A NAME="ref_828_7">Res</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := <A HREF="terminal_interface-curses-forms__adb.htm#ref_825_16">Free</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_638_22">Frm</A>); -+ <span class="symbol"><A NAME="ref_828_7">Res</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := <A HREF="terminal_interface-curses-forms__adb.htm#ref_825_16">Free</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_636_22">Frm</A>); - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses-forms__adb.htm#ref_828_7">Res</A> /= <A HREF="terminal_interface-curses-aux__ads.htm#ref_80_4">E_Ok</A> <b>then</b> - <A HREF="terminal_interface-curses-aux__ads.htm#ref_96_14">Eti_Exception</A> (<A HREF="terminal_interface-curses-forms__adb.htm#ref_828_7">Res</A>); - <b>end</b> <b>if</b>; -- <A HREF="terminal_interface-curses-forms__ads.htm#ref_638_22">Frm</A> := <A HREF="terminal_interface-curses-forms__ads.htm#ref_60_4">Null_Form</A>; -- <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_638_14">Delete</A>; -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | man page form_opts.3x</EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_842_14" HREF="terminal_interface-curses-forms__ads.htm#ref_648_14">Set_Options</A></FONT> (<FONT COLOR=red><A NAME="ref_842_27" HREF="terminal_interface-curses-forms__ads.htm#ref_648_27">Frm</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -- <FONT COLOR=red><A NAME="ref_843_27" HREF="terminal_interface-curses-forms__ads.htm#ref_649_27">Options</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_109_9">Form_Option_Set</A>) -+ <A HREF="terminal_interface-curses-forms__ads.htm#ref_636_22">Frm</A> := <A HREF="terminal_interface-curses-forms__ads.htm#ref_60_4">Null_Form</A>; -+ <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_636_14">Delete</A>; -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | man page form_opts.3x</EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_842_14" HREF="terminal_interface-curses-forms__ads.htm#ref_646_14">Set_Options</A></span> (<span class="symbol"><A NAME="ref_842_27" HREF="terminal_interface-curses-forms__ads.htm#ref_646_27">Frm</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -+ <span class="symbol"><A NAME="ref_843_27" HREF="terminal_interface-curses-forms__ads.htm#ref_647_27">Options</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_108_9">Form_Option_Set</A>) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_845_16">Set_Form_Opts</A></FONT> (<FONT COLOR=red><A NAME="ref_845_31" HREF="terminal_interface-curses-forms__adb.htm#ref_845_16">Frm</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -- <FONT COLOR=red><A NAME="ref_846_31" HREF="terminal_interface-curses-forms__adb.htm#ref_845_16">Opt</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_845_16">Set_Form_Opts</A></span> (<span class="symbol"><A NAME="ref_845_31" HREF="terminal_interface-curses-forms__adb.htm#ref_845_16">Frm</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -+ <span class="symbol"><A NAME="ref_846_31" HREF="terminal_interface-curses-forms__adb.htm#ref_845_16">Opt</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Set_Form_Opts, "set_form_opts"); - -- <FONT COLOR=red><A NAME="ref_849_7">Opt</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> := FrmOS_2_CInt (<A HREF="terminal_interface-curses-forms__ads.htm#ref_649_27">Options</A>); -- <FONT COLOR=red><A NAME="ref_850_7">Res</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A>; -+ <span class="symbol"><A NAME="ref_849_7">Opt</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> := FrmOS_2_CInt (<A HREF="terminal_interface-curses-forms__ads.htm#ref_647_27">Options</A>); -+ <span class="symbol"><A NAME="ref_850_7">Res</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A>; - <b>begin</b> -- <A HREF="terminal_interface-curses-forms__adb.htm#ref_850_7">Res</A> := <A HREF="terminal_interface-curses-forms__adb.htm#ref_845_16">Set_Form_Opts</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_648_27">Frm</A>, <A HREF="terminal_interface-curses-forms__adb.htm#ref_849_7">Opt</A>); -+ <A HREF="terminal_interface-curses-forms__adb.htm#ref_850_7">Res</A> := <A HREF="terminal_interface-curses-forms__adb.htm#ref_845_16">Set_Form_Opts</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_646_27">Frm</A>, <A HREF="terminal_interface-curses-forms__adb.htm#ref_849_7">Opt</A>); - <b>if</b> <A HREF="terminal_interface-curses-forms__adb.htm#ref_850_7">Res</A> /= <A HREF="terminal_interface-curses-aux__ads.htm#ref_80_4">E_Ok</A> <b>then</b> - <A HREF="terminal_interface-curses-aux__ads.htm#ref_96_14">Eti_Exception</A> (<A HREF="terminal_interface-curses-forms__adb.htm#ref_850_7">Res</A>); - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_648_14">Set_Options</A>; -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_860_14" HREF="terminal_interface-curses-forms__ads.htm#ref_654_14">Switch_Options</A></FONT> (<FONT COLOR=red><A NAME="ref_860_30" HREF="terminal_interface-curses-forms__ads.htm#ref_654_30">Frm</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -- <FONT COLOR=red><A NAME="ref_861_30" HREF="terminal_interface-curses-forms__ads.htm#ref_655_30">Options</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_109_9">Form_Option_Set</A>; -- <FONT COLOR=red><A NAME="ref_862_30" HREF="terminal_interface-curses-forms__ads.htm#ref_656_30">On</A></FONT> : Boolean := True) -+ <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_646_14">Set_Options</A>; -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_860_14" HREF="terminal_interface-curses-forms__ads.htm#ref_652_14">Switch_Options</A></span> (<span class="symbol"><A NAME="ref_860_30" HREF="terminal_interface-curses-forms__ads.htm#ref_652_30">Frm</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -+ <span class="symbol"><A NAME="ref_861_30" HREF="terminal_interface-curses-forms__ads.htm#ref_653_30">Options</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_108_9">Form_Option_Set</A>; -+ <span class="symbol"><A NAME="ref_862_30" HREF="terminal_interface-curses-forms__ads.htm#ref_654_30">On</A></span> : Boolean := True) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_864_16">Form_Opts_On</A></FONT> (<FONT COLOR=red><A NAME="ref_864_30" HREF="terminal_interface-curses-forms__adb.htm#ref_864_16">Frm</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -- <FONT COLOR=red><A NAME="ref_865_30" HREF="terminal_interface-curses-forms__adb.htm#ref_864_16">Opt</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_864_16">Form_Opts_On</A></span> (<span class="symbol"><A NAME="ref_864_30" HREF="terminal_interface-curses-forms__adb.htm#ref_864_16">Frm</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -+ <span class="symbol"><A NAME="ref_865_30" HREF="terminal_interface-curses-forms__adb.htm#ref_864_16">Opt</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Form_Opts_On, "form_opts_on"); -- <b>function</b> <FONT COLOR=red><A NAME="ref_867_16">Form_Opts_Off</A></FONT> (<FONT COLOR=red><A NAME="ref_867_31" HREF="terminal_interface-curses-forms__adb.htm#ref_867_16">Frm</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -- <FONT COLOR=red><A NAME="ref_868_31" HREF="terminal_interface-curses-forms__adb.htm#ref_867_16">Opt</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_867_16">Form_Opts_Off</A></span> (<span class="symbol"><A NAME="ref_867_31" HREF="terminal_interface-curses-forms__adb.htm#ref_867_16">Frm</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -+ <span class="symbol"><A NAME="ref_868_31" HREF="terminal_interface-curses-forms__adb.htm#ref_867_16">Opt</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Form_Opts_Off, "form_opts_off"); - -- <FONT COLOR=red><A NAME="ref_871_7">Err</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A>; -- <FONT COLOR=red><A NAME="ref_872_7">Opt</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> := FrmOS_2_CInt (<A HREF="terminal_interface-curses-forms__ads.htm#ref_655_30">Options</A>); -+ <span class="symbol"><A NAME="ref_871_7">Err</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A>; -+ <span class="symbol"><A NAME="ref_872_7">Opt</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> := FrmOS_2_CInt (<A HREF="terminal_interface-curses-forms__ads.htm#ref_653_30">Options</A>); - <b>begin</b> -- <b>if</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_656_30">On</A> <b>then</b> -- <A HREF="terminal_interface-curses-forms__adb.htm#ref_871_7">Err</A> := <A HREF="terminal_interface-curses-forms__adb.htm#ref_864_16">Form_Opts_On</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_654_30">Frm</A>, <A HREF="terminal_interface-curses-forms__adb.htm#ref_872_7">Opt</A>); -+ <b>if</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_654_30">On</A> <b>then</b> -+ <A HREF="terminal_interface-curses-forms__adb.htm#ref_871_7">Err</A> := <A HREF="terminal_interface-curses-forms__adb.htm#ref_864_16">Form_Opts_On</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_652_30">Frm</A>, <A HREF="terminal_interface-curses-forms__adb.htm#ref_872_7">Opt</A>); - <b>else</b> -- <A HREF="terminal_interface-curses-forms__adb.htm#ref_871_7">Err</A> := <A HREF="terminal_interface-curses-forms__adb.htm#ref_867_16">Form_Opts_Off</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_654_30">Frm</A>, <A HREF="terminal_interface-curses-forms__adb.htm#ref_872_7">Opt</A>); -+ <A HREF="terminal_interface-curses-forms__adb.htm#ref_871_7">Err</A> := <A HREF="terminal_interface-curses-forms__adb.htm#ref_867_16">Form_Opts_Off</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_652_30">Frm</A>, <A HREF="terminal_interface-curses-forms__adb.htm#ref_872_7">Opt</A>); - <b>end</b> <b>if</b>; - <b>if</b> <A HREF="terminal_interface-curses-forms__adb.htm#ref_871_7">Err</A> /= <A HREF="terminal_interface-curses-aux__ads.htm#ref_80_4">E_Ok</A> <b>then</b> - <A HREF="terminal_interface-curses-aux__ads.htm#ref_96_14">Eti_Exception</A> (<A HREF="terminal_interface-curses-forms__adb.htm#ref_871_7">Err</A>); - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_654_14">Switch_Options</A>; -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_886_14" HREF="terminal_interface-curses-forms__ads.htm#ref_662_14">Get_Options</A></FONT> (<FONT COLOR=red><A NAME="ref_886_27" HREF="terminal_interface-curses-forms__ads.htm#ref_662_27">Frm</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -- <FONT COLOR=red><A NAME="ref_887_27" HREF="terminal_interface-curses-forms__ads.htm#ref_663_27">Options</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_109_9">Form_Option_Set</A>) -+ <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_652_14">Switch_Options</A>; -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_886_14" HREF="terminal_interface-curses-forms__ads.htm#ref_660_14">Get_Options</A></span> (<span class="symbol"><A NAME="ref_886_27" HREF="terminal_interface-curses-forms__ads.htm#ref_660_27">Frm</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -+ <span class="symbol"><A NAME="ref_887_27" HREF="terminal_interface-curses-forms__ads.htm#ref_661_27">Options</A></span> : <b>out</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_108_9">Form_Option_Set</A>) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_889_16">Form_Opts</A></FONT> (<FONT COLOR=red><A NAME="ref_889_27" HREF="terminal_interface-curses-forms__adb.htm#ref_889_16">Frm</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_889_16">Form_Opts</A></span> (<span class="symbol"><A NAME="ref_889_27" HREF="terminal_interface-curses-forms__adb.htm#ref_889_16">Frm</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Form_Opts, "form_opts"); - -- <FONT COLOR=red><A NAME="ref_892_7">Res</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> := <A HREF="terminal_interface-curses-forms__adb.htm#ref_889_16">Form_Opts</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_662_27">Frm</A>); -+ <span class="symbol"><A NAME="ref_892_7">Res</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> := <A HREF="terminal_interface-curses-forms__adb.htm#ref_889_16">Form_Opts</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_660_27">Frm</A>); - <b>begin</b> -- <A HREF="terminal_interface-curses-forms__ads.htm#ref_663_27">Options</A> := CInt_2_FrmOS (<A HREF="terminal_interface-curses-forms__adb.htm#ref_892_7">Res</A>); -- <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_662_14">Get_Options</A>; -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_899_13" HREF="terminal_interface-curses-forms__ads.htm#ref_667_13">Get_Options</A></FONT> (<FONT COLOR=red><A NAME="ref_899_26" HREF="terminal_interface-curses-forms__ads.htm#ref_667_26">Frm</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A> := <A HREF="terminal_interface-curses-forms__ads.htm#ref_60_4">Null_Form</A>) <b>return</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_109_9">Form_Option_Set</A> -+ <A HREF="terminal_interface-curses-forms__ads.htm#ref_661_27">Options</A> := CInt_2_FrmOS (<A HREF="terminal_interface-curses-forms__adb.htm#ref_892_7">Res</A>); -+ <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_660_14">Get_Options</A>; -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_899_13" HREF="terminal_interface-curses-forms__ads.htm#ref_665_13">Get_Options</A></span> (<span class="symbol"><A NAME="ref_899_26" HREF="terminal_interface-curses-forms__ads.htm#ref_665_26">Frm</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A> := <A HREF="terminal_interface-curses-forms__ads.htm#ref_60_4">Null_Form</A>) <b>return</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_108_9">Form_Option_Set</A> - <b>is</b> -- <FONT COLOR=red><A NAME="ref_901_7">Fos</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_109_9">Form_Option_Set</A>; -+ <span class="symbol"><A NAME="ref_901_7">Fos</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_108_9">Form_Option_Set</A>; - <b>begin</b> -- <A HREF="terminal_interface-curses-forms__ads.htm#ref_662_14">Get_Options</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_667_26">Frm</A>, <A HREF="terminal_interface-curses-forms__adb.htm#ref_901_7">Fos</A>); -+ <A HREF="terminal_interface-curses-forms__ads.htm#ref_660_14">Get_Options</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_665_26">Frm</A>, <A HREF="terminal_interface-curses-forms__adb.htm#ref_901_7">Fos</A>); - <b>return</b> <A HREF="terminal_interface-curses-forms__adb.htm#ref_901_7">Fos</A>; -- <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_667_13">Get_Options</A>; -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | man page form_post.3x</EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_913_14" HREF="terminal_interface-curses-forms__ads.htm#ref_676_14">Post</A></FONT> (<FONT COLOR=red><A NAME="ref_913_20" HREF="terminal_interface-curses-forms__ads.htm#ref_676_20">Frm</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -- <FONT COLOR=red><A NAME="ref_914_20" HREF="terminal_interface-curses-forms__ads.htm#ref_677_20">Post</A></FONT> : Boolean := True) -+ <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_665_13">Get_Options</A>; -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | man page form_post.3x</EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_913_14" HREF="terminal_interface-curses-forms__ads.htm#ref_674_14">Post</A></span> (<span class="symbol"><A NAME="ref_913_20" HREF="terminal_interface-curses-forms__ads.htm#ref_674_20">Frm</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -+ <span class="symbol"><A NAME="ref_914_20" HREF="terminal_interface-curses-forms__ads.htm#ref_675_20">Post</A></span> : Boolean := True) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_916_16">M_Post</A></FONT> (<FONT COLOR=red><A NAME="ref_916_24" HREF="terminal_interface-curses-forms__adb.htm#ref_916_16">Frm</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_916_16">M_Post</A></span> (<span class="symbol"><A NAME="ref_916_24" HREF="terminal_interface-curses-forms__adb.htm#ref_916_16">Frm</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, M_Post, "post_form"); -- <b>function</b> <FONT COLOR=red><A NAME="ref_918_16">M_Unpost</A></FONT> (<FONT COLOR=red><A NAME="ref_918_26" HREF="terminal_interface-curses-forms__adb.htm#ref_918_16">Frm</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_918_16">M_Unpost</A></span> (<span class="symbol"><A NAME="ref_918_26" HREF="terminal_interface-curses-forms__adb.htm#ref_918_16">Frm</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, M_Unpost, "unpost_form"); - -- <FONT COLOR=red><A NAME="ref_921_7">Res</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A>; -+ <span class="symbol"><A NAME="ref_921_7">Res</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A>; - <b>begin</b> -- <b>if</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_677_20">Post</A> <b>then</b> -- <A HREF="terminal_interface-curses-forms__adb.htm#ref_921_7">Res</A> := <A HREF="terminal_interface-curses-forms__adb.htm#ref_916_16">M_Post</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_676_20">Frm</A>); -+ <b>if</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_675_20">Post</A> <b>then</b> -+ <A HREF="terminal_interface-curses-forms__adb.htm#ref_921_7">Res</A> := <A HREF="terminal_interface-curses-forms__adb.htm#ref_916_16">M_Post</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_674_20">Frm</A>); - <b>else</b> -- <A HREF="terminal_interface-curses-forms__adb.htm#ref_921_7">Res</A> := <A HREF="terminal_interface-curses-forms__adb.htm#ref_918_16">M_Unpost</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_676_20">Frm</A>); -+ <A HREF="terminal_interface-curses-forms__adb.htm#ref_921_7">Res</A> := <A HREF="terminal_interface-curses-forms__adb.htm#ref_918_16">M_Unpost</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_674_20">Frm</A>); - <b>end</b> <b>if</b>; - <b>if</b> <A HREF="terminal_interface-curses-forms__adb.htm#ref_921_7">Res</A> /= <A HREF="terminal_interface-curses-aux__ads.htm#ref_80_4">E_Ok</A> <b>then</b> - <A HREF="terminal_interface-curses-aux__ads.htm#ref_96_14">Eti_Exception</A> (<A HREF="terminal_interface-curses-forms__adb.htm#ref_921_7">Res</A>); - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_676_14">Post</A>; -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | man page form_cursor.3x</EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_939_14" HREF="terminal_interface-curses-forms__ads.htm#ref_687_14">Position_Cursor</A></FONT> (<FONT COLOR=red><A NAME="ref_939_31" HREF="terminal_interface-curses-forms__ads.htm#ref_687_31">Frm</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>) -+ <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_674_14">Post</A>; -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | man page form_cursor.3x</EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_939_14" HREF="terminal_interface-curses-forms__ads.htm#ref_685_14">Position_Cursor</A></span> (<span class="symbol"><A NAME="ref_939_31" HREF="terminal_interface-curses-forms__ads.htm#ref_685_31">Frm</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_941_16">Pos_Form_Cursor</A></FONT> (<FONT COLOR=red><A NAME="ref_941_33" HREF="terminal_interface-curses-forms__adb.htm#ref_941_16">Frm</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_941_16">Pos_Form_Cursor</A></span> (<span class="symbol"><A NAME="ref_941_33" HREF="terminal_interface-curses-forms__adb.htm#ref_941_16">Frm</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Pos_Form_Cursor, "pos_form_cursor"); - -- <FONT COLOR=red><A NAME="ref_944_7">Res</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := <A HREF="terminal_interface-curses-forms__adb.htm#ref_941_16">Pos_Form_Cursor</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_687_31">Frm</A>); -+ <span class="symbol"><A NAME="ref_944_7">Res</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := <A HREF="terminal_interface-curses-forms__adb.htm#ref_941_16">Pos_Form_Cursor</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_685_31">Frm</A>); - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses-forms__adb.htm#ref_944_7">Res</A> /= <A HREF="terminal_interface-curses-aux__ads.htm#ref_80_4">E_Ok</A> <b>then</b> - <A HREF="terminal_interface-curses-aux__ads.htm#ref_96_14">Eti_Exception</A> (<A HREF="terminal_interface-curses-forms__adb.htm#ref_944_7">Res</A>); - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_687_14">Position_Cursor</A>; -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | man page form_data.3x</EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_957_13" HREF="terminal_interface-curses-forms__ads.htm#ref_696_13">Data_Ahead</A></FONT> (<FONT COLOR=red><A NAME="ref_957_25" HREF="terminal_interface-curses-forms__ads.htm#ref_696_25">Frm</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>) <b>return</b> Boolean -+ <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_685_14">Position_Cursor</A>; -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | man page form_data.3x</EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_957_13" HREF="terminal_interface-curses-forms__ads.htm#ref_694_13">Data_Ahead</A></span> (<span class="symbol"><A NAME="ref_957_25" HREF="terminal_interface-curses-forms__ads.htm#ref_694_25">Frm</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>) <b>return</b> Boolean - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_959_16">Ahead</A></FONT> (<FONT COLOR=red><A NAME="ref_959_23" HREF="terminal_interface-curses-forms__adb.htm#ref_959_16">Frm</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_959_16">Ahead</A></span> (<span class="symbol"><A NAME="ref_959_23" HREF="terminal_interface-curses-forms__adb.htm#ref_959_16">Frm</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Ahead, "data_ahead"); - -- <FONT COLOR=red><A NAME="ref_962_7">Res</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> := <A HREF="terminal_interface-curses-forms__adb.htm#ref_959_16">Ahead</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_696_25">Frm</A>); -+ <span class="symbol"><A NAME="ref_962_7">Res</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> := <A HREF="terminal_interface-curses-forms__adb.htm#ref_959_16">Ahead</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_694_25">Frm</A>); - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses-forms__adb.htm#ref_962_7">Res</A> = <A HREF="terminal_interface-curses-aux__ads.htm#ref_75_4">Curses_False</A> <b>then</b> - <b>return</b> False; - <b>else</b> - <b>return</b> True; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_696_13">Data_Ahead</A>; -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_973_13" HREF="terminal_interface-curses-forms__ads.htm#ref_701_13">Data_Behind</A></FONT> (<FONT COLOR=red><A NAME="ref_973_26" HREF="terminal_interface-curses-forms__ads.htm#ref_701_26">Frm</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>) <b>return</b> Boolean -+ <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_694_13">Data_Ahead</A>; -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_973_13" HREF="terminal_interface-curses-forms__ads.htm#ref_699_13">Data_Behind</A></span> (<span class="symbol"><A NAME="ref_973_26" HREF="terminal_interface-curses-forms__ads.htm#ref_699_26">Frm</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>) <b>return</b> Boolean - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_975_16">Behind</A></FONT> (<FONT COLOR=red><A NAME="ref_975_24" HREF="terminal_interface-curses-forms__adb.htm#ref_975_16">Frm</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_975_16">Behind</A></span> (<span class="symbol"><A NAME="ref_975_24" HREF="terminal_interface-curses-forms__adb.htm#ref_975_16">Frm</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Behind, "data_behind"); - -- <FONT COLOR=red><A NAME="ref_978_7">Res</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> := <A HREF="terminal_interface-curses-forms__adb.htm#ref_975_16">Behind</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_701_26">Frm</A>); -+ <span class="symbol"><A NAME="ref_978_7">Res</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> := <A HREF="terminal_interface-curses-forms__adb.htm#ref_975_16">Behind</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_699_26">Frm</A>); - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses-forms__adb.htm#ref_978_7">Res</A> = <A HREF="terminal_interface-curses-aux__ads.htm#ref_75_4">Curses_False</A> <b>then</b> - <b>return</b> False; - <b>else</b> - <b>return</b> True; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_701_13">Data_Behind</A>; -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | man page form_driver.3x</EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_993_13" HREF="terminal_interface-curses-forms__ads.htm#ref_715_13">Driver</A></FONT> (<FONT COLOR=red><A NAME="ref_993_21" HREF="terminal_interface-curses-forms__ads.htm#ref_715_21">Frm</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -- <FONT COLOR=red><A NAME="ref_994_21" HREF="terminal_interface-curses-forms__ads.htm#ref_716_21">Key</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_68_9">Key_Code</A>) <b>return</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_709_9">Driver_Result</A> -+ <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_699_13">Data_Behind</A>; -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | man page form_driver.3x</EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_993_13" HREF="terminal_interface-curses-forms__ads.htm#ref_713_13">Driver</A></span> (<span class="symbol"><A NAME="ref_993_21" HREF="terminal_interface-curses-forms__ads.htm#ref_713_21">Frm</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -+ <span class="symbol"><A NAME="ref_994_21" HREF="terminal_interface-curses-forms__ads.htm#ref_714_21">Key</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_68_9">Key_Code</A>) <b>return</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_707_9">Driver_Result</A> - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_996_16">Frm_Driver</A></FONT> (<FONT COLOR=red><A NAME="ref_996_28" HREF="terminal_interface-curses-forms__adb.htm#ref_996_16">Frm</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; <FONT COLOR=red><A NAME="ref_996_40" HREF="terminal_interface-curses-forms__adb.htm#ref_996_16">Key</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_996_16">Frm_Driver</A></span> (<span class="symbol"><A NAME="ref_996_28" HREF="terminal_interface-curses-forms__adb.htm#ref_996_16">Frm</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; <span class="symbol"><A NAME="ref_996_40" HREF="terminal_interface-curses-forms__adb.htm#ref_996_16">Key</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Frm_Driver, "form_driver"); - -- <FONT COLOR=red><A NAME="ref_999_7">R</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := <A HREF="terminal_interface-curses-forms__adb.htm#ref_996_16">Frm_Driver</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_715_21">Frm</A>, <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_716_21">Key</A>)); -+ <span class="symbol"><A NAME="ref_999_7">R</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := <A HREF="terminal_interface-curses-forms__adb.htm#ref_996_16">Frm_Driver</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_713_21">Frm</A>, <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_714_21">Key</A>)); - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses-forms__adb.htm#ref_999_7">R</A> /= <A HREF="terminal_interface-curses-aux__ads.htm#ref_80_4">E_Ok</A> <b>then</b> - <b>if</b> <A HREF="terminal_interface-curses-forms__adb.htm#ref_999_7">R</A> = <A HREF="terminal_interface-curses-aux__ads.htm#ref_88_4">E_Unknown_Command</A> <b>then</b> -- <b>return</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_711_27">Unknown_Request</A>; -+ <b>return</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_709_27">Unknown_Request</A>; - <b>elsif</b> <A HREF="terminal_interface-curses-forms__adb.htm#ref_999_7">R</A> = <A HREF="terminal_interface-curses-aux__ads.htm#ref_93_4">E_Invalid_Field</A> <b>then</b> -- <b>return</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_712_27">Invalid_Field</A>; -+ <b>return</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_710_27">Invalid_Field</A>; - <b>elsif</b> <A HREF="terminal_interface-curses-forms__adb.htm#ref_999_7">R</A> = <A HREF="terminal_interface-curses-aux__ads.htm#ref_92_4">E_Request_Denied</A> <b>then</b> -- <b>return</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_710_27">Request_Denied</A>; -+ <b>return</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_708_27">Request_Denied</A>; - <b>else</b> - <A HREF="terminal_interface-curses-aux__ads.htm#ref_96_14">Eti_Exception</A> (<A HREF="terminal_interface-curses-forms__adb.htm#ref_999_7">R</A>); -- <b>return</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_709_27">Form_Ok</A>; -+ <b>return</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_707_27">Form_Ok</A>; - <b>end</b> <b>if</b>; - <b>else</b> -- <b>return</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_709_27">Form_Ok</A>; -+ <b>return</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_707_27">Form_Ok</A>; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_715_13">Driver</A>; -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | man page form_page.3x</EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1023_14" HREF="terminal_interface-curses-forms__ads.htm#ref_727_14">Set_Current</A></FONT> (<FONT COLOR=red><A NAME="ref_1023_27" HREF="terminal_interface-curses-forms__ads.htm#ref_727_27">Frm</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -- <FONT COLOR=red><A NAME="ref_1024_27" HREF="terminal_interface-curses-forms__ads.htm#ref_728_27">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>) -+ <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_713_13">Driver</A>; -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | man page form_page.3x</EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1023_14" HREF="terminal_interface-curses-forms__ads.htm#ref_725_14">Set_Current</A></span> (<span class="symbol"><A NAME="ref_1023_27" HREF="terminal_interface-curses-forms__ads.htm#ref_725_27">Frm</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -+ <span class="symbol"><A NAME="ref_1024_27" HREF="terminal_interface-curses-forms__ads.htm#ref_726_27">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1026_16">Set_Current_Fld</A></FONT> (<FONT COLOR=red><A NAME="ref_1026_33" HREF="terminal_interface-curses-forms__adb.htm#ref_1026_16">Frm</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; <FONT COLOR=red><A NAME="ref_1026_45" HREF="terminal_interface-curses-forms__adb.htm#ref_1026_16">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_1026_16">Set_Current_Fld</A></span> (<span class="symbol"><A NAME="ref_1026_33" HREF="terminal_interface-curses-forms__adb.htm#ref_1026_16">Frm</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; <span class="symbol"><A NAME="ref_1026_45" HREF="terminal_interface-curses-forms__adb.htm#ref_1026_16">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Set_Current_Fld, "set_current_field"); - -- <FONT COLOR=red><A NAME="ref_1029_7">Res</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := <A HREF="terminal_interface-curses-forms__adb.htm#ref_1026_16">Set_Current_Fld</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_727_27">Frm</A>, <A HREF="terminal_interface-curses-forms__ads.htm#ref_728_27">Fld</A>); -+ <span class="symbol"><A NAME="ref_1029_7">Res</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := <A HREF="terminal_interface-curses-forms__adb.htm#ref_1026_16">Set_Current_Fld</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_725_27">Frm</A>, <A HREF="terminal_interface-curses-forms__ads.htm#ref_726_27">Fld</A>); - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses-forms__adb.htm#ref_1029_7">Res</A> /= <A HREF="terminal_interface-curses-aux__ads.htm#ref_80_4">E_Ok</A> <b>then</b> - <A HREF="terminal_interface-curses-aux__ads.htm#ref_96_14">Eti_Exception</A> (<A HREF="terminal_interface-curses-forms__adb.htm#ref_1029_7">Res</A>); - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_727_14">Set_Current</A>; -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1038_13" HREF="terminal_interface-curses-forms__ads.htm#ref_733_13">Current</A></FONT> (<FONT COLOR=red><A NAME="ref_1038_22" HREF="terminal_interface-curses-forms__ads.htm#ref_733_22">Frm</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>) <b>return</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A> -+ <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_725_14">Set_Current</A>; -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_1038_13" HREF="terminal_interface-curses-forms__ads.htm#ref_731_13">Current</A></span> (<span class="symbol"><A NAME="ref_1038_22" HREF="terminal_interface-curses-forms__ads.htm#ref_731_22">Frm</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>) <b>return</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A> - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1040_16">Current_Fld</A></FONT> (<FONT COLOR=red><A NAME="ref_1040_29" HREF="terminal_interface-curses-forms__adb.htm#ref_1040_16">Frm</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>) <b>return</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_1040_16">Current_Fld</A></span> (<span class="symbol"><A NAME="ref_1040_29" HREF="terminal_interface-curses-forms__adb.htm#ref_1040_16">Frm</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>) <b>return</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; - <b>pragma</b> Import (C, Current_Fld, "current_field"); - -- <FONT COLOR=red><A NAME="ref_1043_7">Fld</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A> := <A HREF="terminal_interface-curses-forms__adb.htm#ref_1040_16">Current_Fld</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_733_22">Frm</A>); -+ <span class="symbol"><A NAME="ref_1043_7">Fld</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A> := <A HREF="terminal_interface-curses-forms__adb.htm#ref_1040_16">Current_Fld</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_731_22">Frm</A>); - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses-forms__adb.htm#ref_1043_7">Fld</A> = <A HREF="terminal_interface-curses-forms__ads.htm#ref_59_4">Null_Field</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_290_4">Form_Exception</A>; -+ <b>raise</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_288_4">Form_Exception</A>; - <b>end</b> <b>if</b>; - <b>return</b> <A HREF="terminal_interface-curses-forms__adb.htm#ref_1043_7">Fld</A>; -- <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_733_13">Current</A>; -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1053_14" HREF="terminal_interface-curses-forms__ads.htm#ref_738_14">Set_Page</A></FONT> (<FONT COLOR=red><A NAME="ref_1053_24" HREF="terminal_interface-curses-forms__ads.htm#ref_738_24">Frm</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -- <FONT COLOR=red><A NAME="ref_1054_24" HREF="terminal_interface-curses-forms__ads.htm#ref_739_24">Page</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_724_9">Page_Number</A> := <A HREF="terminal_interface-curses-forms__ads.htm#ref_724_9">Page_Number</A>'First) -+ <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_731_13">Current</A>; -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1053_14" HREF="terminal_interface-curses-forms__ads.htm#ref_736_14">Set_Page</A></span> (<span class="symbol"><A NAME="ref_1053_24" HREF="terminal_interface-curses-forms__ads.htm#ref_736_24">Frm</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -+ <span class="symbol"><A NAME="ref_1054_24" HREF="terminal_interface-curses-forms__ads.htm#ref_737_24">Page</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_722_9">Page_Number</A> := <A HREF="terminal_interface-curses-forms__ads.htm#ref_722_9">Page_Number</A>'First) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1056_16">Set_Frm_Page</A></FONT> (<FONT COLOR=red><A NAME="ref_1056_30" HREF="terminal_interface-curses-forms__adb.htm#ref_1056_16">Frm</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; <FONT COLOR=red><A NAME="ref_1056_42" HREF="terminal_interface-curses-forms__adb.htm#ref_1056_16">Pg</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_1056_16">Set_Frm_Page</A></span> (<span class="symbol"><A NAME="ref_1056_30" HREF="terminal_interface-curses-forms__adb.htm#ref_1056_16">Frm</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; <span class="symbol"><A NAME="ref_1056_42" HREF="terminal_interface-curses-forms__adb.htm#ref_1056_16">Pg</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Set_Frm_Page, "set_form_page"); - -- <FONT COLOR=red><A NAME="ref_1059_7">Res</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := <A HREF="terminal_interface-curses-forms__adb.htm#ref_1056_16">Set_Frm_Page</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_738_24">Frm</A>, <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_739_24">Page</A>)); -+ <span class="symbol"><A NAME="ref_1059_7">Res</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := <A HREF="terminal_interface-curses-forms__adb.htm#ref_1056_16">Set_Frm_Page</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_736_24">Frm</A>, <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_737_24">Page</A>)); - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses-forms__adb.htm#ref_1059_7">Res</A> /= <A HREF="terminal_interface-curses-aux__ads.htm#ref_80_4">E_Ok</A> <b>then</b> - <A HREF="terminal_interface-curses-aux__ads.htm#ref_96_14">Eti_Exception</A> (<A HREF="terminal_interface-curses-forms__adb.htm#ref_1059_7">Res</A>); - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_738_14">Set_Page</A>; -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1068_13" HREF="terminal_interface-curses-forms__ads.htm#ref_744_13">Page</A></FONT> (<FONT COLOR=red><A NAME="ref_1068_19" HREF="terminal_interface-curses-forms__ads.htm#ref_744_19">Frm</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>) <b>return</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_724_9">Page_Number</A> -+ <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_736_14">Set_Page</A>; -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_1068_13" HREF="terminal_interface-curses-forms__ads.htm#ref_742_13">Page</A></span> (<span class="symbol"><A NAME="ref_1068_19" HREF="terminal_interface-curses-forms__ads.htm#ref_742_19">Frm</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>) <b>return</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_722_9">Page_Number</A> - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1070_16">Get_Page</A></FONT> (<FONT COLOR=red><A NAME="ref_1070_26" HREF="terminal_interface-curses-forms__adb.htm#ref_1070_16">Frm</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_1070_16">Get_Page</A></span> (<span class="symbol"><A NAME="ref_1070_26" HREF="terminal_interface-curses-forms__adb.htm#ref_1070_16">Frm</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Get_Page, "form_page"); - -- <FONT COLOR=red><A NAME="ref_1073_7">P</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> := <A HREF="terminal_interface-curses-forms__adb.htm#ref_1070_16">Get_Page</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_744_19">Frm</A>); -+ <span class="symbol"><A NAME="ref_1073_7">P</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> := <A HREF="terminal_interface-curses-forms__adb.htm#ref_1070_16">Get_Page</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_742_19">Frm</A>); - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses-forms__adb.htm#ref_1073_7">P</A> &lt; 0 <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_290_4">Form_Exception</A>; -+ <b>raise</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_288_4">Form_Exception</A>; - <b>else</b> -- <b>return</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_724_9">Page_Number</A> (<A HREF="terminal_interface-curses-forms__adb.htm#ref_1073_7">P</A>); -+ <b>return</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_722_9">Page_Number</A> (<A HREF="terminal_interface-curses-forms__adb.htm#ref_1073_7">P</A>); - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_744_13">Page</A>; -+ <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_742_13">Page</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_1082_13" HREF="terminal_interface-curses-forms__ads.htm#ref_749_13">Get_Index</A></FONT> (<FONT COLOR=red><A NAME="ref_1082_24" HREF="terminal_interface-curses-forms__ads.htm#ref_749_24">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>) <b>return</b> Positive -+ <b>function</b> <span class="symbol"><A NAME="ref_1082_13" HREF="terminal_interface-curses-forms__ads.htm#ref_747_13">Get_Index</A></span> (<span class="symbol"><A NAME="ref_1082_24" HREF="terminal_interface-curses-forms__ads.htm#ref_747_24">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>) <b>return</b> Positive - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1084_16">Get_Fieldindex</A></FONT> (<FONT COLOR=red><A NAME="ref_1084_32" HREF="terminal_interface-curses-forms__adb.htm#ref_1084_16">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_1084_16">Get_Fieldindex</A></span> (<span class="symbol"><A NAME="ref_1084_32" HREF="terminal_interface-curses-forms__adb.htm#ref_1084_16">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Get_Fieldindex, "field_index"); - -- <FONT COLOR=red><A NAME="ref_1087_7">Res</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> := <A HREF="terminal_interface-curses-forms__adb.htm#ref_1084_16">Get_Fieldindex</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_749_24">Fld</A>); -+ <span class="symbol"><A NAME="ref_1087_7">Res</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> := <A HREF="terminal_interface-curses-forms__adb.htm#ref_1084_16">Get_Fieldindex</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_747_24">Fld</A>); - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses-forms__adb.htm#ref_1087_7">Res</A> = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_290_4">Form_Exception</A>; -+ <b>raise</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_288_4">Form_Exception</A>; - <b>end</b> <b>if</b>; - <b>return</b> Positive (Natural (<A HREF="terminal_interface-curses-forms__adb.htm#ref_1087_7">Res</A>) + Positive'First); -- <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_749_13">Get_Index</A>; -+ <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_747_13">Get_Index</A>; - -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | man page form_new_page.3x</EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1102_14" HREF="terminal_interface-curses-forms__ads.htm#ref_761_14">Set_New_Page</A></FONT> (<FONT COLOR=red><A NAME="ref_1102_28" HREF="terminal_interface-curses-forms__ads.htm#ref_761_28">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_1103_28" HREF="terminal_interface-curses-forms__ads.htm#ref_762_28">New_Page</A></FONT> : Boolean := True) -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | man page form_new_page.3x</EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1102_14" HREF="terminal_interface-curses-forms__ads.htm#ref_759_14">Set_New_Page</A></span> (<span class="symbol"><A NAME="ref_1102_28" HREF="terminal_interface-curses-forms__ads.htm#ref_759_28">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_1103_28" HREF="terminal_interface-curses-forms__ads.htm#ref_760_28">New_Page</A></span> : Boolean := True) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1105_16">Set_Page</A></FONT> (<FONT COLOR=red><A NAME="ref_1105_26" HREF="terminal_interface-curses-forms__adb.htm#ref_1105_16">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; <FONT COLOR=red><A NAME="ref_1105_39" HREF="terminal_interface-curses-forms__adb.htm#ref_1105_16">Flg</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_1105_16">Set_Page</A></span> (<span class="symbol"><A NAME="ref_1105_26" HREF="terminal_interface-curses-forms__adb.htm#ref_1105_16">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; <span class="symbol"><A NAME="ref_1105_39" HREF="terminal_interface-curses-forms__adb.htm#ref_1105_16">Flg</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Set_Page, "set_new_page"); - -- <FONT COLOR=red><A NAME="ref_1108_7">Res</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := <A HREF="terminal_interface-curses-forms__adb.htm#ref_1105_16">Set_Page</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_761_28">Fld</A>, Boolean'Pos (<A HREF="terminal_interface-curses-forms__ads.htm#ref_762_28">New_Page</A>)); -+ <span class="symbol"><A NAME="ref_1108_7">Res</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := <A HREF="terminal_interface-curses-forms__adb.htm#ref_1105_16">Set_Page</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_759_28">Fld</A>, Boolean'Pos (<A HREF="terminal_interface-curses-forms__ads.htm#ref_760_28">New_Page</A>)); - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses-forms__adb.htm#ref_1108_7">Res</A> /= <A HREF="terminal_interface-curses-aux__ads.htm#ref_80_4">E_Ok</A> <b>then</b> - <A HREF="terminal_interface-curses-aux__ads.htm#ref_96_14">Eti_Exception</A> (<A HREF="terminal_interface-curses-forms__adb.htm#ref_1108_7">Res</A>); - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_761_14">Set_New_Page</A>; -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1117_13" HREF="terminal_interface-curses-forms__ads.htm#ref_767_13">Is_New_Page</A></FONT> (<FONT COLOR=red><A NAME="ref_1117_26" HREF="terminal_interface-curses-forms__ads.htm#ref_767_26">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>) <b>return</b> Boolean -+ <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_759_14">Set_New_Page</A>; -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_1117_13" HREF="terminal_interface-curses-forms__ads.htm#ref_765_13">Is_New_Page</A></span> (<span class="symbol"><A NAME="ref_1117_26" HREF="terminal_interface-curses-forms__ads.htm#ref_765_26">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>) <b>return</b> Boolean - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1119_16">Is_New</A></FONT> (<FONT COLOR=red><A NAME="ref_1119_24" HREF="terminal_interface-curses-forms__adb.htm#ref_1119_16">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_1119_16">Is_New</A></span> (<span class="symbol"><A NAME="ref_1119_24" HREF="terminal_interface-curses-forms__adb.htm#ref_1119_16">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Is_New, "new_page"); - -- <FONT COLOR=red><A NAME="ref_1122_7">Res</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> := <A HREF="terminal_interface-curses-forms__adb.htm#ref_1119_16">Is_New</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_767_26">Fld</A>); -+ <span class="symbol"><A NAME="ref_1122_7">Res</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> := <A HREF="terminal_interface-curses-forms__adb.htm#ref_1119_16">Is_New</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_765_26">Fld</A>); - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses-forms__adb.htm#ref_1122_7">Res</A> = <A HREF="terminal_interface-curses-aux__ads.htm#ref_75_4">Curses_False</A> <b>then</b> - <b>return</b> False; - <b>else</b> - <b>return</b> True; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_767_13">Is_New_Page</A>; -+ <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_765_13">Is_New_Page</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_1131_14" HREF="terminal_interface-curses-forms__ads.htm#ref_140_14">Free</A></FONT> (<FONT COLOR=red><A NAME="ref_1131_20" HREF="terminal_interface-curses-forms__ads.htm#ref_140_20">FA</A></FONT> : <b>in</b> <b>out</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_138_9">Field_Array_Access</A>; -- <FONT COLOR=red><A NAME="ref_1132_20" HREF="terminal_interface-curses-forms__ads.htm#ref_141_20">Free_Fields</A></FONT> : Boolean := False) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_1131_14" HREF="terminal_interface-curses-forms__ads.htm#ref_138_14">Free</A></span> (<span class="symbol"><A NAME="ref_1131_20" HREF="terminal_interface-curses-forms__ads.htm#ref_138_20">FA</A></span> : <b>in</b> <b>out</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_136_9">Field_Array_Access</A>; -+ <span class="symbol"><A NAME="ref_1132_20" HREF="terminal_interface-curses-forms__ads.htm#ref_139_20">Free_Fields</A></span> : Boolean := False) - <b>is</b> - <b>procedure</b> Release <b>is</b> <b>new</b> Ada.Unchecked_Deallocation -- (Field_Array, <A HREF="terminal_interface-curses-forms__ads.htm#ref_138_9">Field_Array_Access</A>); -+ (Field_Array, <A HREF="terminal_interface-curses-forms__ads.htm#ref_136_9">Field_Array_Access</A>); - <b>begin</b> -- <b>if</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_140_20">FA</A> /= <b>null</b> <b>and</b> <b>then</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_141_20">Free_Fields</A> <b>then</b> -- <b>for</b> <FONT COLOR=red><A NAME="ref_1138_14">I</A></FONT> <b>in</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_140_20">FA</A>'First .. (<A HREF="terminal_interface-curses-forms__ads.htm#ref_140_20">FA</A>'Last - 1) <b>loop</b> -- <b>if</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_140_20">FA</A>.<b>all</b> (<A HREF="terminal_interface-curses-forms__adb.htm#ref_1138_14">I</A>) /= <A HREF="terminal_interface-curses-forms__ads.htm#ref_59_4">Null_Field</A> <b>then</b> -- <A HREF="terminal_interface-curses-forms__ads.htm#ref_319_14">Delete</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_140_20">FA</A>.<b>all</b> (<A HREF="terminal_interface-curses-forms__adb.htm#ref_1138_14">I</A>)); -+ <b>if</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_138_20">FA</A> /= <b>null</b> <b>and</b> <b>then</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_139_20">Free_Fields</A> <b>then</b> -+ <b>for</b> <span class="symbol"><A NAME="ref_1138_14">I</A></span> <b>in</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_138_20">FA</A>'First .. (<A HREF="terminal_interface-curses-forms__ads.htm#ref_138_20">FA</A>'Last - 1) <b>loop</b> -+ <b>if</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_138_20">FA</A>.<b>all</b> (<A HREF="terminal_interface-curses-forms__adb.htm#ref_1138_14">I</A>) /= <A HREF="terminal_interface-curses-forms__ads.htm#ref_59_4">Null_Field</A> <b>then</b> -+ <A HREF="terminal_interface-curses-forms__ads.htm#ref_317_14">Delete</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_138_20">FA</A>.<b>all</b> (<A HREF="terminal_interface-curses-forms__adb.htm#ref_1138_14">I</A>)); - <b>end</b> <b>if</b>; - <b>end</b> <b>loop</b>; - <b>end</b> <b>if</b>; -- Release (<A HREF="terminal_interface-curses-forms__ads.htm#ref_140_20">FA</A>); -- <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_140_14">Free</A>; -+ Release (<A HREF="terminal_interface-curses-forms__ads.htm#ref_138_20">FA</A>); -+ <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_138_14">Free</A>; - -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> - -- <b>function</b> <FONT COLOR=red><A NAME="ref_1149_13" HREF="terminal_interface-curses-forms__ads.htm#ref_104_13">Default_Field_Options</A></FONT> <b>return</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_68_9">Field_Option_Set</A> -+ <b>function</b> <span class="symbol"><A NAME="ref_1149_13" HREF="terminal_interface-curses-forms__ads.htm#ref_103_13">Default_Field_Options</A></span> <b>return</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_68_9">Field_Option_Set</A> - <b>is</b> - <b>begin</b> -- <b>return</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_420_13">Get_Options</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_59_4">Null_Field</A>); -- <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_104_13">Default_Field_Options</A>; -+ <b>return</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_418_13">Get_Options</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_59_4">Null_Field</A>); -+ <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_103_13">Default_Field_Options</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_1155_13" HREF="terminal_interface-curses-forms__ads.htm#ref_129_13">Default_Form_Options</A></FONT> <b>return</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_109_9">Form_Option_Set</A> -+ <b>function</b> <span class="symbol"><A NAME="ref_1155_13" HREF="terminal_interface-curses-forms__ads.htm#ref_127_13">Default_Form_Options</A></span> <b>return</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_108_9">Form_Option_Set</A> - <b>is</b> - <b>begin</b> -- <b>return</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_667_13">Get_Options</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_60_4">Null_Form</A>); -- <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_129_13">Default_Form_Options</A>; -+ <b>return</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_665_13">Get_Options</A> (<A HREF="terminal_interface-curses-forms__ads.htm#ref_60_4">Null_Form</A>); -+ <b>end</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_127_13">Default_Form_Options</A>; - - <b>end</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-forms__ads.htm#ref_49_35">Forms</A>; - </PRE></BODY></HTML> -diff -Naur ncurses-5.9/doc/html/ada/terminal_interface-curses-forms__ads.htm ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-forms__ads.htm ---- ncurses-5.9/doc/html/ada/terminal_interface-curses-forms__ads.htm 2011-03-20 00:18:40.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-forms__ads.htm 2014-09-01 16:33:22.288792010 +0200 -@@ -1,88 +1,99 @@ --<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> --<HTML><HEAD><TITLE>terminal_interface-curses-forms.ads</TITLE></HEAD> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> -+<HTML> -+<HEAD> -+<TITLE>terminal_interface-curses-forms.ads</TITLE> -+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> -+<style type="text/css"> -+*.comment { -+ color: green; -+} -+*.symbol { -+ color: red; -+} -+</style> -+</HEAD> - <BODY> --<HR><DIV ALIGN="center"><H1> File : terminal_interface-curses-forms.ads </H1></DIV><HR> -+<HR><DIV style="text-align:center"><H1> File : terminal_interface-curses-forms.ads </H1></DIV><HR> - <PRE> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Terminal_Interface.Curses.Form --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- S P E C --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Copyright (c) 1998-2006,2009 Free Software Foundation, Inc. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></FONT> --<FONT COLOR=green><EM>-- copy of this software and associated documentation files (the --</EM></FONT> --<FONT COLOR=green><EM>-- "Software"), to deal in the Software without restriction, including --</EM></FONT> --<FONT COLOR=green><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></FONT> --<FONT COLOR=green><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></FONT> --<FONT COLOR=green><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></FONT> --<FONT COLOR=green><EM>-- furnished to do so, subject to the following conditions: --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- The above copyright notice and this permission notice shall be included --</EM></FONT> --<FONT COLOR=green><EM>-- in all copies or substantial portions of the Software. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></FONT> --<FONT COLOR=green><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></FONT> --<FONT COLOR=green><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></FONT> --<FONT COLOR=green><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></FONT> --<FONT COLOR=green><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></FONT> --<FONT COLOR=green><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></FONT> --<FONT COLOR=green><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></FONT> --<FONT COLOR=green><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></FONT> --<FONT COLOR=green><EM>-- sale, use or other dealings in this Software without prior written --</EM></FONT> --<FONT COLOR=green><EM>-- authorization. --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Author: Juergen Pfeifer, 1996</EM></FONT> --<FONT COLOR=green><EM>-- Version Control:</EM></FONT> --<FONT COLOR=green><EM>-- @Revision: 1.30 @</EM></FONT> --<FONT COLOR=green><EM>-- @Date: 2009/12/26 17:31:35 @</EM></FONT> --<FONT COLOR=green><EM>-- Binding Version 01.00</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- form binding.</EM></FONT> --<FONT COLOR=green><EM>-- This module is generated. Please don't change it manually!</EM></FONT> --<FONT COLOR=green><EM>-- Run the generator instead.</EM></FONT> --<FONT COLOR=green><EM>-- |</EM></FONT> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Terminal_Interface.Curses.Form --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- S P E C --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Copyright (c) 1998-2006,2009 Free Software Foundation, Inc. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></span> -+<span class="comment"><EM>-- copy of this software and associated documentation files (the --</EM></span> -+<span class="comment"><EM>-- "Software"), to deal in the Software without restriction, including --</EM></span> -+<span class="comment"><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></span> -+<span class="comment"><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></span> -+<span class="comment"><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></span> -+<span class="comment"><EM>-- furnished to do so, subject to the following conditions: --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- The above copyright notice and this permission notice shall be included --</EM></span> -+<span class="comment"><EM>-- in all copies or substantial portions of the Software. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></span> -+<span class="comment"><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></span> -+<span class="comment"><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></span> -+<span class="comment"><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></span> -+<span class="comment"><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></span> -+<span class="comment"><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></span> -+<span class="comment"><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></span> -+<span class="comment"><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></span> -+<span class="comment"><EM>-- sale, use or other dealings in this Software without prior written --</EM></span> -+<span class="comment"><EM>-- authorization. --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Author: Juergen Pfeifer, 1996</EM></span> -+<span class="comment"><EM>-- Version Control:</EM></span> -+<span class="comment"><EM>-- @Revision: 1.30 @</EM></span> -+<span class="comment"><EM>-- @Date: 2009/12/26 17:31:35 @</EM></span> -+<span class="comment"><EM>-- Binding Version 01.00</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- form binding.</EM></span> -+<span class="comment"><EM>-- This module is generated. Please don't change it manually!</EM></span> -+<span class="comment"><EM>-- Run the generator instead.</EM></span> -+<span class="comment"><EM>-- |</EM></span> - <b>with</b> System; - <b>with</b> Ada.Characters.Latin_1; - --<b>package</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<FONT COLOR=red><A NAME="ref_49_35" HREF="terminal_interface-curses-forms__adb.htm#ref_51_40">Forms</A></FONT> <b>is</b> -+<b>package</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<span class="symbol"><A NAME="ref_49_35" HREF="terminal_interface-curses-forms__adb.htm#ref_51_40">Forms</A></span> <b>is</b> - <b>pragma</b> Preelaborate (<A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-forms__ads.htm#ref_49_35">Forms</A>); - <b>pragma</b> Linker_Options ("-lform"); - <b>pragma</b> Linker_Options ("-lncurses"); - - Space : Character <b>renames</b> Ada.Characters.Latin_1.Space; - -- <b>type</b> <FONT COLOR=red><A NAME="ref_56_9">Field</A></FONT> <b>is</b> <b>private</b>; -- <b>type</b> <FONT COLOR=red><A NAME="ref_57_9">Form</A></FONT> <b>is</b> <b>private</b>; -+ <b>type</b> <span class="symbol"><A NAME="ref_56_9">Field</A></span> <b>is</b> <b>private</b>; -+ <b>type</b> <span class="symbol"><A NAME="ref_57_9">Form</A></span> <b>is</b> <b>private</b>; - -- <FONT COLOR=red><A NAME="ref_59_4">Null_Field</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_60_4">Null_Form</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -+ <span class="symbol"><A NAME="ref_59_4">Null_Field</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_60_4">Null_Form</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; - -- <b>type</b> <FONT COLOR=red><A NAME="ref_62_9">Field_Justification</A></FONT> <b>is</b> (<FONT COLOR=red><A NAME="ref_62_33">None</A></FONT>, -- <FONT COLOR=red><A NAME="ref_63_33">Left</A></FONT>, -- <FONT COLOR=red><A NAME="ref_64_33">Center</A></FONT>, -- <FONT COLOR=red><A NAME="ref_65_33">Right</A></FONT>); -+ <b>type</b> <span class="symbol"><A NAME="ref_62_9">Field_Justification</A></span> <b>is</b> (<span class="symbol"><A NAME="ref_62_33">None</A></span>, -+ <span class="symbol"><A NAME="ref_63_33">Left</A></span>, -+ <span class="symbol"><A NAME="ref_64_33">Center</A></span>, -+ <span class="symbol"><A NAME="ref_65_33">Right</A></span>); - - <b>pragma</b> Warnings (Off); -- <b>type</b> <FONT COLOR=red><A NAME="ref_68_9">Field_Option_Set</A></FONT> <b>is</b> -+ <b>type</b> <span class="symbol"><A NAME="ref_68_9">Field_Option_Set</A></span> <b>is</b> - <b>record</b> -- <FONT COLOR=red><A NAME="ref_70_10">Visible</A></FONT> : Boolean; -- <FONT COLOR=red><A NAME="ref_71_10">Active</A></FONT> : Boolean; -- <FONT COLOR=red><A NAME="ref_72_10">Public</A></FONT> : Boolean; -- <FONT COLOR=red><A NAME="ref_73_10">Edit</A></FONT> : Boolean; -- <FONT COLOR=red><A NAME="ref_74_10">Wrap</A></FONT> : Boolean; -- <FONT COLOR=red><A NAME="ref_75_10">Blank</A></FONT> : Boolean; -- <FONT COLOR=red><A NAME="ref_76_10">Auto_Skip</A></FONT> : Boolean; -- <FONT COLOR=red><A NAME="ref_77_10">Null_Ok</A></FONT> : Boolean; -- <FONT COLOR=red><A NAME="ref_78_10">Pass_Ok</A></FONT> : Boolean; -- <FONT COLOR=red><A NAME="ref_79_10">Static</A></FONT> : Boolean; -- <FONT COLOR=red><A NAME="ref_80_10">Unused</A></FONT> : Boolean; -+ <span class="symbol"><A NAME="ref_70_10">Visible</A></span> : Boolean; -+ <span class="symbol"><A NAME="ref_71_10">Active</A></span> : Boolean; -+ <span class="symbol"><A NAME="ref_72_10">Public</A></span> : Boolean; -+ <span class="symbol"><A NAME="ref_73_10">Edit</A></span> : Boolean; -+ <span class="symbol"><A NAME="ref_74_10">Wrap</A></span> : Boolean; -+ <span class="symbol"><A NAME="ref_75_10">Blank</A></span> : Boolean; -+ <span class="symbol"><A NAME="ref_76_10">Auto_Skip</A></span> : Boolean; -+ <span class="symbol"><A NAME="ref_77_10">Null_Ok</A></span> : Boolean; -+ <span class="symbol"><A NAME="ref_78_10">Pass_Ok</A></span> : Boolean; -+ <span class="symbol"><A NAME="ref_79_10">Static</A></span> : Boolean; - <b>end</b> <b>record</b>; - <b>pragma</b> Convention (C, <A HREF="terminal_interface-curses-forms__ads.htm#ref_68_9">Field_Option_Set</A>); - -@@ -98,687 +109,686 @@ - <A HREF="terminal_interface-curses-forms__ads.htm#ref_77_10">Null_Ok</A> <b>at</b> 0 <b>range</b> 7 .. 7; - <A HREF="terminal_interface-curses-forms__ads.htm#ref_78_10">Pass_Ok</A> <b>at</b> 0 <b>range</b> 8 .. 8; - <A HREF="terminal_interface-curses-forms__ads.htm#ref_79_10">Static</A> <b>at</b> 0 <b>range</b> 9 .. 9; -- <A HREF="terminal_interface-curses-forms__ads.htm#ref_80_10">Unused</A> <b>at</b> 0 <b>range</b> 10 .. 31; - <b>end</b> <b>record</b>; -- <b>for</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_68_9">Field_Option_Set</A>'Size <b>use</b> 32; -- <FONT COLOR=green><EM>-- Please note: this rep. clause is generated and may be</EM></FONT> -- <FONT COLOR=green><EM>-- different on your system.Dnl</EM></FONT> -+ <b>pragma</b> Warnings (Off); <b>for</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_68_9">Field_Option_Set</A>'Size <b>use</b> 32; -+ <b>pragma</b> Warnings (On); -+ <span class="comment"><EM>-- Please note: this rep. clause is generated and may be</EM></span> -+ <span class="comment"><EM>-- different on your system.Dnl</EM></span> - - <b>pragma</b> Warnings (On); - -- <b>function</b> <FONT COLOR=red><A NAME="ref_104_13" HREF="terminal_interface-curses-forms__adb.htm#ref_1149_13">Default_Field_Options</A></FONT> <b>return</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_68_9">Field_Option_Set</A>; -- <FONT COLOR=green><EM>-- The initial defaults for the field options.</EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses-forms__ads.htm#ref_104_13">Default_Field_Options</A>); -+ <b>function</b> <span class="symbol"><A NAME="ref_103_13" HREF="terminal_interface-curses-forms__adb.htm#ref_1149_13">Default_Field_Options</A></span> <b>return</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_68_9">Field_Option_Set</A>; -+ <span class="comment"><EM>-- The initial defaults for the field options.</EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses-forms__ads.htm#ref_103_13">Default_Field_Options</A>); - - <b>pragma</b> Warnings (Off); -- <b>type</b> <FONT COLOR=red><A NAME="ref_109_9">Form_Option_Set</A></FONT> <b>is</b> -+ <b>type</b> <span class="symbol"><A NAME="ref_108_9">Form_Option_Set</A></span> <b>is</b> - <b>record</b> -- <FONT COLOR=red><A NAME="ref_111_10">NL_Overload</A></FONT> : Boolean; -- <FONT COLOR=red><A NAME="ref_112_10">BS_Overload</A></FONT> : Boolean; -- <FONT COLOR=red><A NAME="ref_113_10">Unused</A></FONT> : Boolean; -+ <span class="symbol"><A NAME="ref_110_10">NL_Overload</A></span> : Boolean; -+ <span class="symbol"><A NAME="ref_111_10">BS_Overload</A></span> : Boolean; - <b>end</b> <b>record</b>; -- <b>pragma</b> Convention (C, <A HREF="terminal_interface-curses-forms__ads.htm#ref_109_9">Form_Option_Set</A>); -+ <b>pragma</b> Convention (C, <A HREF="terminal_interface-curses-forms__ads.htm#ref_108_9">Form_Option_Set</A>); - -- <b>for</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_109_9">Form_Option_Set</A> <b>use</b> -+ <b>for</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_108_9">Form_Option_Set</A> <b>use</b> - <b>record</b> -- <A HREF="terminal_interface-curses-forms__ads.htm#ref_111_10">NL_Overload</A> <b>at</b> 0 <b>range</b> 0 .. 0; -- <A HREF="terminal_interface-curses-forms__ads.htm#ref_112_10">BS_Overload</A> <b>at</b> 0 <b>range</b> 1 .. 1; -- <A HREF="terminal_interface-curses-forms__ads.htm#ref_113_10">Unused</A> <b>at</b> 0 <b>range</b> 2 .. 31; -+ <A HREF="terminal_interface-curses-forms__ads.htm#ref_110_10">NL_Overload</A> <b>at</b> 0 <b>range</b> 0 .. 0; -+ <A HREF="terminal_interface-curses-forms__ads.htm#ref_111_10">BS_Overload</A> <b>at</b> 0 <b>range</b> 1 .. 1; - <b>end</b> <b>record</b>; -- <b>for</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_109_9">Form_Option_Set</A>'Size <b>use</b> 32; -- <FONT COLOR=green><EM>-- Please note: this rep. clause is generated and may be</EM></FONT> -- <FONT COLOR=green><EM>-- different on your system.Dnl</EM></FONT> -+ <b>pragma</b> Warnings (Off); <b>for</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_108_9">Form_Option_Set</A>'Size <b>use</b> 32; -+ <b>pragma</b> Warnings (On); -+ <span class="comment"><EM>-- Please note: this rep. clause is generated and may be</EM></span> -+ <span class="comment"><EM>-- different on your system.Dnl</EM></span> - - <b>pragma</b> Warnings (On); - -- <b>function</b> <FONT COLOR=red><A NAME="ref_129_13" HREF="terminal_interface-curses-forms__adb.htm#ref_1155_13">Default_Form_Options</A></FONT> <b>return</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_109_9">Form_Option_Set</A>; -- <FONT COLOR=green><EM>-- The initial defaults for the form options.</EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses-forms__ads.htm#ref_129_13">Default_Form_Options</A>); -+ <b>function</b> <span class="symbol"><A NAME="ref_127_13" HREF="terminal_interface-curses-forms__adb.htm#ref_1155_13">Default_Form_Options</A></span> <b>return</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_108_9">Form_Option_Set</A>; -+ <span class="comment"><EM>-- The initial defaults for the form options.</EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses-forms__ads.htm#ref_127_13">Default_Form_Options</A>); - -- <b>type</b> <FONT COLOR=red><A NAME="ref_133_9">Buffer_Number</A></FONT> <b>is</b> <b>new</b> Natural; -+ <b>type</b> <span class="symbol"><A NAME="ref_131_9">Buffer_Number</A></span> <b>is</b> <b>new</b> Natural; - - <b>type</b> Field_Array <b>is</b> <b>array</b> (Positive <b>range</b> &lt;&gt;) <b>of</b> <b>aliased</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; - <b>pragma</b> Convention (C, Field_Array); - -- <b>type</b> <FONT COLOR=red><A NAME="ref_138_9">Field_Array_Access</A></FONT> <b>is</b> <b>access</b> Field_Array; -+ <b>type</b> <span class="symbol"><A NAME="ref_136_9">Field_Array_Access</A></span> <b>is</b> <b>access</b> Field_Array; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_140_14" HREF="terminal_interface-curses-forms__adb.htm#ref_1131_14">Free</A></FONT> (<FONT COLOR=red><A NAME="ref_140_20" HREF="terminal_interface-curses-forms__adb.htm#ref_1131_20">FA</A></FONT> : <b>in</b> <b>out</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_138_9">Field_Array_Access</A>; -- <FONT COLOR=red><A NAME="ref_141_20" HREF="terminal_interface-curses-forms__adb.htm#ref_1132_20">Free_Fields</A></FONT> : Boolean := False); -- <FONT COLOR=green><EM>-- Release the memory for an allocated field array</EM></FONT> -- <FONT COLOR=green><EM>-- If Free_Fields is True, call Delete() for all the fields in</EM></FONT> -- <FONT COLOR=green><EM>-- the array.</EM></FONT> -- -- <b>subtype</b> <FONT COLOR=red><A NAME="ref_146_12">Form_Request_Code</A></FONT> <b>is</b> <A HREF="terminal_interface-curses__ads.htm#ref_68_9">Key_Code</A> <b>range</b> (<A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 1) .. (<A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 57); -- -- <FONT COLOR=green><EM>-- The prefix F_ stands for "Form Request"</EM></FONT> -- <FONT COLOR=red><A NAME="ref_149_4">F_Next_Page</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 1; -- <FONT COLOR=red><A NAME="ref_150_4">F_Previous_Page</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 2; -- <FONT COLOR=red><A NAME="ref_151_4">F_First_Page</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 3; -- <FONT COLOR=red><A NAME="ref_152_4">F_Last_Page</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 4; -- -- <FONT COLOR=red><A NAME="ref_154_4">F_Next_Field</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 5; -- <FONT COLOR=red><A NAME="ref_155_4">F_Previous_Field</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 6; -- <FONT COLOR=red><A NAME="ref_156_4">F_First_Field</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 7; -- <FONT COLOR=red><A NAME="ref_157_4">F_Last_Field</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 8; -- <FONT COLOR=red><A NAME="ref_158_4">F_Sorted_Next_Field</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 9; -- <FONT COLOR=red><A NAME="ref_159_4">F_Sorted_Previous_Field</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 10; -- <FONT COLOR=red><A NAME="ref_160_4">F_Sorted_First_Field</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 11; -- <FONT COLOR=red><A NAME="ref_161_4">F_Sorted_Last_Field</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 12; -- <FONT COLOR=red><A NAME="ref_162_4">F_Left_Field</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 13; -- <FONT COLOR=red><A NAME="ref_163_4">F_Right_Field</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 14; -- <FONT COLOR=red><A NAME="ref_164_4">F_Up_Field</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 15; -- <FONT COLOR=red><A NAME="ref_165_4">F_Down_Field</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 16; -- -- <FONT COLOR=red><A NAME="ref_167_4">F_Next_Char</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 17; -- <FONT COLOR=red><A NAME="ref_168_4">F_Previous_Char</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 18; -- <FONT COLOR=red><A NAME="ref_169_4">F_Next_Line</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 19; -- <FONT COLOR=red><A NAME="ref_170_4">F_Previous_Line</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 20; -- <FONT COLOR=red><A NAME="ref_171_4">F_Next_Word</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 21; -- <FONT COLOR=red><A NAME="ref_172_4">F_Previous_Word</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 22; -- <FONT COLOR=red><A NAME="ref_173_4">F_Begin_Field</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 23; -- <FONT COLOR=red><A NAME="ref_174_4">F_End_Field</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 24; -- <FONT COLOR=red><A NAME="ref_175_4">F_Begin_Line</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 25; -- <FONT COLOR=red><A NAME="ref_176_4">F_End_Line</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 26; -- <FONT COLOR=red><A NAME="ref_177_4">F_Left_Char</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 27; -- <FONT COLOR=red><A NAME="ref_178_4">F_Right_Char</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 28; -- <FONT COLOR=red><A NAME="ref_179_4">F_Up_Char</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 29; -- <FONT COLOR=red><A NAME="ref_180_4">F_Down_Char</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 30; -- -- <FONT COLOR=red><A NAME="ref_182_4">F_New_Line</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 31; -- <FONT COLOR=red><A NAME="ref_183_4">F_Insert_Char</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 32; -- <FONT COLOR=red><A NAME="ref_184_4">F_Insert_Line</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 33; -- <FONT COLOR=red><A NAME="ref_185_4">F_Delete_Char</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 34; -- <FONT COLOR=red><A NAME="ref_186_4">F_Delete_Previous</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 35; -- <FONT COLOR=red><A NAME="ref_187_4">F_Delete_Line</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 36; -- <FONT COLOR=red><A NAME="ref_188_4">F_Delete_Word</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 37; -- <FONT COLOR=red><A NAME="ref_189_4">F_Clear_EOL</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 38; -- <FONT COLOR=red><A NAME="ref_190_4">F_Clear_EOF</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 39; -- <FONT COLOR=red><A NAME="ref_191_4">F_Clear_Field</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 40; -- <FONT COLOR=red><A NAME="ref_192_4">F_Overlay_Mode</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 41; -- <FONT COLOR=red><A NAME="ref_193_4">F_Insert_Mode</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 42; -- -- <FONT COLOR=green><EM>-- Vertical Scrolling</EM></FONT> -- <FONT COLOR=red><A NAME="ref_196_4">F_ScrollForward_Line</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 43; -- <FONT COLOR=red><A NAME="ref_197_4">F_ScrollBackward_Line</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 44; -- <FONT COLOR=red><A NAME="ref_198_4">F_ScrollForward_Page</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 45; -- <FONT COLOR=red><A NAME="ref_199_4">F_ScrollBackward_Page</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 46; -- <FONT COLOR=red><A NAME="ref_200_4">F_ScrollForward_HalfPage</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 47; -- <FONT COLOR=red><A NAME="ref_201_4">F_ScrollBackward_HalfPage</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 48; -- -- <FONT COLOR=green><EM>-- Horizontal Scrolling</EM></FONT> -- <FONT COLOR=red><A NAME="ref_204_4">F_HScrollForward_Char</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 49; -- <FONT COLOR=red><A NAME="ref_205_4">F_HScrollBackward_Char</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 50; -- <FONT COLOR=red><A NAME="ref_206_4">F_HScrollForward_Line</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 51; -- <FONT COLOR=red><A NAME="ref_207_4">F_HScrollBackward_Line</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 52; -- <FONT COLOR=red><A NAME="ref_208_4">F_HScrollForward_HalfLine</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 53; -- <FONT COLOR=red><A NAME="ref_209_4">F_HScrollBackward_HalfLine</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 54; -- -- <FONT COLOR=red><A NAME="ref_211_4">F_Validate_Field</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 55; -- <FONT COLOR=red><A NAME="ref_212_4">F_Next_Choice</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 56; -- <FONT COLOR=red><A NAME="ref_213_4">F_Previous_Choice</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 57; -- -- <FONT COLOR=green><EM>-- For those who like the old 'C' style request names</EM></FONT> -- REQ_NEXT_PAGE : <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_149_4">F_Next_Page</A>; -- REQ_PREV_PAGE : <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_150_4">F_Previous_Page</A>; -- REQ_FIRST_PAGE : <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_151_4">F_First_Page</A>; -- REQ_LAST_PAGE : <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_152_4">F_Last_Page</A>; -- -- REQ_NEXT_FIELD : <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_154_4">F_Next_Field</A>; -- REQ_PREV_FIELD : <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_155_4">F_Previous_Field</A>; -- REQ_FIRST_FIELD : <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_156_4">F_First_Field</A>; -- REQ_LAST_FIELD : <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_157_4">F_Last_Field</A>; -- REQ_SNEXT_FIELD : <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_158_4">F_Sorted_Next_Field</A>; -- REQ_SPREV_FIELD : <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_159_4">F_Sorted_Previous_Field</A>; -- REQ_SFIRST_FIELD : <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_160_4">F_Sorted_First_Field</A>; -- REQ_SLAST_FIELD : <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_161_4">F_Sorted_Last_Field</A>; -- REQ_LEFT_FIELD : <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_162_4">F_Left_Field</A>; -- REQ_RIGHT_FIELD : <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_163_4">F_Right_Field</A>; -- REQ_UP_FIELD : <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_164_4">F_Up_Field</A>; -- REQ_DOWN_FIELD : <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_165_4">F_Down_Field</A>; -- -- REQ_NEXT_CHAR : <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_167_4">F_Next_Char</A>; -- REQ_PREV_CHAR : <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_168_4">F_Previous_Char</A>; -- REQ_NEXT_LINE : <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_169_4">F_Next_Line</A>; -- REQ_PREV_LINE : <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_170_4">F_Previous_Line</A>; -- REQ_NEXT_WORD : <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_171_4">F_Next_Word</A>; -- REQ_PREV_WORD : <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_172_4">F_Previous_Word</A>; -- REQ_BEG_FIELD : <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_173_4">F_Begin_Field</A>; -- REQ_END_FIELD : <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_174_4">F_End_Field</A>; -- REQ_BEG_LINE : <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_175_4">F_Begin_Line</A>; -- REQ_END_LINE : <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_176_4">F_End_Line</A>; -- REQ_LEFT_CHAR : <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_177_4">F_Left_Char</A>; -- REQ_RIGHT_CHAR : <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_178_4">F_Right_Char</A>; -- REQ_UP_CHAR : <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_179_4">F_Up_Char</A>; -- REQ_DOWN_CHAR : <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_180_4">F_Down_Char</A>; -- -- REQ_NEW_LINE : <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_182_4">F_New_Line</A>; -- REQ_INS_CHAR : <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_183_4">F_Insert_Char</A>; -- REQ_INS_LINE : <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_184_4">F_Insert_Line</A>; -- REQ_DEL_CHAR : <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_185_4">F_Delete_Char</A>; -- REQ_DEL_PREV : <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_186_4">F_Delete_Previous</A>; -- REQ_DEL_LINE : <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_187_4">F_Delete_Line</A>; -- REQ_DEL_WORD : <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_188_4">F_Delete_Word</A>; -- REQ_CLR_EOL : <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_189_4">F_Clear_EOL</A>; -- REQ_CLR_EOF : <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_190_4">F_Clear_EOF</A>; -- REQ_CLR_FIELD : <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_191_4">F_Clear_Field</A>; -- REQ_OVL_MODE : <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_192_4">F_Overlay_Mode</A>; -- REQ_INS_MODE : <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_193_4">F_Insert_Mode</A>; -- -- REQ_SCR_FLINE : <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_196_4">F_ScrollForward_Line</A>; -- REQ_SCR_BLINE : <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_197_4">F_ScrollBackward_Line</A>; -- REQ_SCR_FPAGE : <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_198_4">F_ScrollForward_Page</A>; -- REQ_SCR_BPAGE : <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_199_4">F_ScrollBackward_Page</A>; -- REQ_SCR_FHPAGE : <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_200_4">F_ScrollForward_HalfPage</A>; -- REQ_SCR_BHPAGE : <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_201_4">F_ScrollBackward_HalfPage</A>; -- -- REQ_SCR_FCHAR : <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_204_4">F_HScrollForward_Char</A>; -- REQ_SCR_BCHAR : <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_205_4">F_HScrollBackward_Char</A>; -- REQ_SCR_HFLINE : <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_206_4">F_HScrollForward_Line</A>; -- REQ_SCR_HBLINE : <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_207_4">F_HScrollBackward_Line</A>; -- REQ_SCR_HFHALF : <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_208_4">F_HScrollForward_HalfLine</A>; -- REQ_SCR_HBHALF : <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_209_4">F_HScrollBackward_HalfLine</A>; -- -- REQ_VALIDATION : <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_211_4">F_Validate_Field</A>; -- REQ_NEXT_CHOICE : <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_212_4">F_Next_Choice</A>; -- REQ_PREV_CHOICE : <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_213_4">F_Previous_Choice</A>; -+ <b>procedure</b> <span class="symbol"><A NAME="ref_138_14" HREF="terminal_interface-curses-forms__adb.htm#ref_1131_14">Free</A></span> (<span class="symbol"><A NAME="ref_138_20" HREF="terminal_interface-curses-forms__adb.htm#ref_1131_20">FA</A></span> : <b>in</b> <b>out</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_136_9">Field_Array_Access</A>; -+ <span class="symbol"><A NAME="ref_139_20" HREF="terminal_interface-curses-forms__adb.htm#ref_1132_20">Free_Fields</A></span> : Boolean := False); -+ <span class="comment"><EM>-- Release the memory for an allocated field array</EM></span> -+ <span class="comment"><EM>-- If Free_Fields is True, call Delete() for all the fields in</EM></span> -+ <span class="comment"><EM>-- the array.</EM></span> -+ -+ <b>subtype</b> <span class="symbol"><A NAME="ref_144_12">Form_Request_Code</A></span> <b>is</b> <A HREF="terminal_interface-curses__ads.htm#ref_68_9">Key_Code</A> <b>range</b> (<A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 1) .. (<A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 57); -+ -+ <span class="comment"><EM>-- The prefix F_ stands for "Form Request"</EM></span> -+ <span class="symbol"><A NAME="ref_147_4">F_Next_Page</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 1; -+ <span class="symbol"><A NAME="ref_148_4">F_Previous_Page</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 2; -+ <span class="symbol"><A NAME="ref_149_4">F_First_Page</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 3; -+ <span class="symbol"><A NAME="ref_150_4">F_Last_Page</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 4; -+ -+ <span class="symbol"><A NAME="ref_152_4">F_Next_Field</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 5; -+ <span class="symbol"><A NAME="ref_153_4">F_Previous_Field</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 6; -+ <span class="symbol"><A NAME="ref_154_4">F_First_Field</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 7; -+ <span class="symbol"><A NAME="ref_155_4">F_Last_Field</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 8; -+ <span class="symbol"><A NAME="ref_156_4">F_Sorted_Next_Field</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 9; -+ <span class="symbol"><A NAME="ref_157_4">F_Sorted_Previous_Field</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 10; -+ <span class="symbol"><A NAME="ref_158_4">F_Sorted_First_Field</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 11; -+ <span class="symbol"><A NAME="ref_159_4">F_Sorted_Last_Field</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 12; -+ <span class="symbol"><A NAME="ref_160_4">F_Left_Field</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 13; -+ <span class="symbol"><A NAME="ref_161_4">F_Right_Field</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 14; -+ <span class="symbol"><A NAME="ref_162_4">F_Up_Field</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 15; -+ <span class="symbol"><A NAME="ref_163_4">F_Down_Field</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 16; -+ -+ <span class="symbol"><A NAME="ref_165_4">F_Next_Char</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 17; -+ <span class="symbol"><A NAME="ref_166_4">F_Previous_Char</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 18; -+ <span class="symbol"><A NAME="ref_167_4">F_Next_Line</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 19; -+ <span class="symbol"><A NAME="ref_168_4">F_Previous_Line</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 20; -+ <span class="symbol"><A NAME="ref_169_4">F_Next_Word</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 21; -+ <span class="symbol"><A NAME="ref_170_4">F_Previous_Word</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 22; -+ <span class="symbol"><A NAME="ref_171_4">F_Begin_Field</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 23; -+ <span class="symbol"><A NAME="ref_172_4">F_End_Field</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 24; -+ <span class="symbol"><A NAME="ref_173_4">F_Begin_Line</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 25; -+ <span class="symbol"><A NAME="ref_174_4">F_End_Line</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 26; -+ <span class="symbol"><A NAME="ref_175_4">F_Left_Char</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 27; -+ <span class="symbol"><A NAME="ref_176_4">F_Right_Char</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 28; -+ <span class="symbol"><A NAME="ref_177_4">F_Up_Char</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 29; -+ <span class="symbol"><A NAME="ref_178_4">F_Down_Char</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 30; -+ -+ <span class="symbol"><A NAME="ref_180_4">F_New_Line</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 31; -+ <span class="symbol"><A NAME="ref_181_4">F_Insert_Char</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 32; -+ <span class="symbol"><A NAME="ref_182_4">F_Insert_Line</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 33; -+ <span class="symbol"><A NAME="ref_183_4">F_Delete_Char</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 34; -+ <span class="symbol"><A NAME="ref_184_4">F_Delete_Previous</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 35; -+ <span class="symbol"><A NAME="ref_185_4">F_Delete_Line</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 36; -+ <span class="symbol"><A NAME="ref_186_4">F_Delete_Word</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 37; -+ <span class="symbol"><A NAME="ref_187_4">F_Clear_EOL</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 38; -+ <span class="symbol"><A NAME="ref_188_4">F_Clear_EOF</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 39; -+ <span class="symbol"><A NAME="ref_189_4">F_Clear_Field</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 40; -+ <span class="symbol"><A NAME="ref_190_4">F_Overlay_Mode</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 41; -+ <span class="symbol"><A NAME="ref_191_4">F_Insert_Mode</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 42; -+ -+ <span class="comment"><EM>-- Vertical Scrolling</EM></span> -+ <span class="symbol"><A NAME="ref_194_4">F_ScrollForward_Line</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 43; -+ <span class="symbol"><A NAME="ref_195_4">F_ScrollBackward_Line</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 44; -+ <span class="symbol"><A NAME="ref_196_4">F_ScrollForward_Page</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 45; -+ <span class="symbol"><A NAME="ref_197_4">F_ScrollBackward_Page</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 46; -+ <span class="symbol"><A NAME="ref_198_4">F_ScrollForward_HalfPage</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 47; -+ <span class="symbol"><A NAME="ref_199_4">F_ScrollBackward_HalfPage</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 48; -+ -+ <span class="comment"><EM>-- Horizontal Scrolling</EM></span> -+ <span class="symbol"><A NAME="ref_202_4">F_HScrollForward_Char</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 49; -+ <span class="symbol"><A NAME="ref_203_4">F_HScrollBackward_Char</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 50; -+ <span class="symbol"><A NAME="ref_204_4">F_HScrollForward_Line</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 51; -+ <span class="symbol"><A NAME="ref_205_4">F_HScrollBackward_Line</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 52; -+ <span class="symbol"><A NAME="ref_206_4">F_HScrollForward_HalfLine</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 53; -+ <span class="symbol"><A NAME="ref_207_4">F_HScrollBackward_HalfLine</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 54; -+ -+ <span class="symbol"><A NAME="ref_209_4">F_Validate_Field</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 55; -+ <span class="symbol"><A NAME="ref_210_4">F_Next_Choice</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 56; -+ <span class="symbol"><A NAME="ref_211_4">F_Previous_Choice</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 57; -+ -+ <span class="comment"><EM>-- For those who like the old 'C' style request names</EM></span> -+ REQ_NEXT_PAGE : <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_147_4">F_Next_Page</A>; -+ REQ_PREV_PAGE : <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_148_4">F_Previous_Page</A>; -+ REQ_FIRST_PAGE : <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_149_4">F_First_Page</A>; -+ REQ_LAST_PAGE : <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_150_4">F_Last_Page</A>; -+ -+ REQ_NEXT_FIELD : <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_152_4">F_Next_Field</A>; -+ REQ_PREV_FIELD : <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_153_4">F_Previous_Field</A>; -+ REQ_FIRST_FIELD : <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_154_4">F_First_Field</A>; -+ REQ_LAST_FIELD : <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_155_4">F_Last_Field</A>; -+ REQ_SNEXT_FIELD : <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_156_4">F_Sorted_Next_Field</A>; -+ REQ_SPREV_FIELD : <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_157_4">F_Sorted_Previous_Field</A>; -+ REQ_SFIRST_FIELD : <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_158_4">F_Sorted_First_Field</A>; -+ REQ_SLAST_FIELD : <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_159_4">F_Sorted_Last_Field</A>; -+ REQ_LEFT_FIELD : <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_160_4">F_Left_Field</A>; -+ REQ_RIGHT_FIELD : <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_161_4">F_Right_Field</A>; -+ REQ_UP_FIELD : <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_162_4">F_Up_Field</A>; -+ REQ_DOWN_FIELD : <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_163_4">F_Down_Field</A>; -+ -+ REQ_NEXT_CHAR : <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_165_4">F_Next_Char</A>; -+ REQ_PREV_CHAR : <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_166_4">F_Previous_Char</A>; -+ REQ_NEXT_LINE : <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_167_4">F_Next_Line</A>; -+ REQ_PREV_LINE : <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_168_4">F_Previous_Line</A>; -+ REQ_NEXT_WORD : <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_169_4">F_Next_Word</A>; -+ REQ_PREV_WORD : <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_170_4">F_Previous_Word</A>; -+ REQ_BEG_FIELD : <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_171_4">F_Begin_Field</A>; -+ REQ_END_FIELD : <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_172_4">F_End_Field</A>; -+ REQ_BEG_LINE : <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_173_4">F_Begin_Line</A>; -+ REQ_END_LINE : <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_174_4">F_End_Line</A>; -+ REQ_LEFT_CHAR : <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_175_4">F_Left_Char</A>; -+ REQ_RIGHT_CHAR : <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_176_4">F_Right_Char</A>; -+ REQ_UP_CHAR : <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_177_4">F_Up_Char</A>; -+ REQ_DOWN_CHAR : <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_178_4">F_Down_Char</A>; -+ -+ REQ_NEW_LINE : <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_180_4">F_New_Line</A>; -+ REQ_INS_CHAR : <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_181_4">F_Insert_Char</A>; -+ REQ_INS_LINE : <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_182_4">F_Insert_Line</A>; -+ REQ_DEL_CHAR : <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_183_4">F_Delete_Char</A>; -+ REQ_DEL_PREV : <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_184_4">F_Delete_Previous</A>; -+ REQ_DEL_LINE : <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_185_4">F_Delete_Line</A>; -+ REQ_DEL_WORD : <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_186_4">F_Delete_Word</A>; -+ REQ_CLR_EOL : <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_187_4">F_Clear_EOL</A>; -+ REQ_CLR_EOF : <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_188_4">F_Clear_EOF</A>; -+ REQ_CLR_FIELD : <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_189_4">F_Clear_Field</A>; -+ REQ_OVL_MODE : <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_190_4">F_Overlay_Mode</A>; -+ REQ_INS_MODE : <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_191_4">F_Insert_Mode</A>; -+ -+ REQ_SCR_FLINE : <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_194_4">F_ScrollForward_Line</A>; -+ REQ_SCR_BLINE : <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_195_4">F_ScrollBackward_Line</A>; -+ REQ_SCR_FPAGE : <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_196_4">F_ScrollForward_Page</A>; -+ REQ_SCR_BPAGE : <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_197_4">F_ScrollBackward_Page</A>; -+ REQ_SCR_FHPAGE : <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_198_4">F_ScrollForward_HalfPage</A>; -+ REQ_SCR_BHPAGE : <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_199_4">F_ScrollBackward_HalfPage</A>; -+ -+ REQ_SCR_FCHAR : <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_202_4">F_HScrollForward_Char</A>; -+ REQ_SCR_BCHAR : <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_203_4">F_HScrollBackward_Char</A>; -+ REQ_SCR_HFLINE : <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_204_4">F_HScrollForward_Line</A>; -+ REQ_SCR_HBLINE : <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_205_4">F_HScrollBackward_Line</A>; -+ REQ_SCR_HFHALF : <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_206_4">F_HScrollForward_HalfLine</A>; -+ REQ_SCR_HBHALF : <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_207_4">F_HScrollBackward_HalfLine</A>; -+ -+ REQ_VALIDATION : <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_209_4">F_Validate_Field</A>; -+ REQ_NEXT_CHOICE : <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_210_4">F_Next_Choice</A>; -+ REQ_PREV_CHOICE : <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_211_4">F_Previous_Choice</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_280_14" HREF="terminal_interface-curses-forms__adb.htm#ref_81_14">Request_Name</A></FONT> (<FONT COLOR=red><A NAME="ref_280_28" HREF="terminal_interface-curses-forms__adb.htm#ref_81_28">Key</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A>; -- <FONT COLOR=red><A NAME="ref_281_28" HREF="terminal_interface-curses-forms__adb.htm#ref_82_33">Name</A></FONT> : <b>out</b> String); -+ <b>procedure</b> <span class="symbol"><A NAME="ref_278_14" HREF="terminal_interface-curses-forms__adb.htm#ref_81_14">Request_Name</A></span> (<span class="symbol"><A NAME="ref_278_28" HREF="terminal_interface-curses-forms__adb.htm#ref_81_28">Key</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A>; -+ <span class="symbol"><A NAME="ref_279_28" HREF="terminal_interface-curses-forms__adb.htm#ref_82_33">Name</A></span> : <b>out</b> String); - -- <b>function</b> <FONT COLOR=red><A NAME="ref_283_14" HREF="terminal_interface-curses-forms__adb.htm#ref_90_13">Request_Name</A></FONT> (<FONT COLOR=red><A NAME="ref_283_28" HREF="terminal_interface-curses-forms__adb.htm#ref_90_27">Key</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_146_12">Form_Request_Code</A>) <b>return</b> String; -- <FONT COLOR=green><EM>-- Same as function</EM></FONT> -+ <b>function</b> <span class="symbol"><A NAME="ref_281_14" HREF="terminal_interface-curses-forms__adb.htm#ref_90_13">Request_Name</A></span> (<span class="symbol"><A NAME="ref_281_28" HREF="terminal_interface-curses-forms__adb.htm#ref_90_27">Key</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_144_12">Form_Request_Code</A>) <b>return</b> String; -+ <span class="comment"><EM>-- Same as function</EM></span> - <b>pragma</b> Inline (Request_Name); - -- <FONT COLOR=green><EM>------------------</EM></FONT> -- <FONT COLOR=green><EM>-- Exceptions --</EM></FONT> -- <FONT COLOR=green><EM>------------------</EM></FONT> -- <FONT COLOR=red><A NAME="ref_290_4">Form_Exception</A></FONT> : <b>exception</b>; -- -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page <A HREF="../man/form_field_new.3x.html">form_field_new.3x</A></EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_1"#2|</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_297_13" HREF="terminal_interface-curses-forms__adb.htm#ref_108_13">Create</A></FONT> (<FONT COLOR=red><A NAME="ref_297_21" HREF="terminal_interface-curses-forms__adb.htm#ref_108_21">Height</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_63_12">Line_Count</A>; -- <FONT COLOR=red><A NAME="ref_298_21" HREF="terminal_interface-curses-forms__adb.htm#ref_109_21">Width</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_65_12">Column_Count</A>; -- <FONT COLOR=red><A NAME="ref_299_21" HREF="terminal_interface-curses-forms__adb.htm#ref_110_21">Top</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_300_21" HREF="terminal_interface-curses-forms__adb.htm#ref_111_21">Left</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -- <FONT COLOR=red><A NAME="ref_301_21" HREF="terminal_interface-curses-forms__adb.htm#ref_112_21">Off_Screen</A></FONT> : Natural := 0; -- <FONT COLOR=red><A NAME="ref_302_21" HREF="terminal_interface-curses-forms__adb.htm#ref_113_21">More_Buffers</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_133_9">Buffer_Number</A> := <A HREF="terminal_interface-curses-forms__ads.htm#ref_133_9">Buffer_Number</A>'First) -+ <span class="comment"><EM>------------------</EM></span> -+ <span class="comment"><EM>-- Exceptions --</EM></span> -+ <span class="comment"><EM>------------------</EM></span> -+ <span class="symbol"><A NAME="ref_288_4">Form_Exception</A></span> : <b>exception</b>; -+ -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page <A HREF="../man/form_field_new.3x.html">form_field_new.3x</A></EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_1"#2|</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_295_13" HREF="terminal_interface-curses-forms__adb.htm#ref_108_13">Create</A></span> (<span class="symbol"><A NAME="ref_295_21" HREF="terminal_interface-curses-forms__adb.htm#ref_108_21">Height</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_63_12">Line_Count</A>; -+ <span class="symbol"><A NAME="ref_296_21" HREF="terminal_interface-curses-forms__adb.htm#ref_109_21">Width</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_65_12">Column_Count</A>; -+ <span class="symbol"><A NAME="ref_297_21" HREF="terminal_interface-curses-forms__adb.htm#ref_110_21">Top</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_298_21" HREF="terminal_interface-curses-forms__adb.htm#ref_111_21">Left</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -+ <span class="symbol"><A NAME="ref_299_21" HREF="terminal_interface-curses-forms__adb.htm#ref_112_21">Off_Screen</A></span> : Natural := 0; -+ <span class="symbol"><A NAME="ref_300_21" HREF="terminal_interface-curses-forms__adb.htm#ref_113_21">More_Buffers</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_131_9">Buffer_Number</A> := <A HREF="terminal_interface-curses-forms__ads.htm#ref_131_9">Buffer_Number</A>'First) - <b>return</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/form_field_new.3x.html">new_field()</A></EM></FONT> -- <FONT COLOR=green><EM>-- An overloaded Create is defined later. Pragma Inline appears there.</EM></FONT> -+ <span class="comment"><EM>-- AKA: <A HREF="../man/form_field_new.3x.html">new_field()</A></EM></span> -+ <span class="comment"><EM>-- An overloaded Create is defined later. Pragma Inline appears there.</EM></span> - -- <FONT COLOR=green><EM>-- #1A NAME="AFU_2"#2|</EM></FONT> -- <b>function</b> New_Field (<FONT COLOR=red><A NAME="ref_308_24">Height</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_63_12">Line_Count</A>; -- <FONT COLOR=red><A NAME="ref_309_24">Width</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_65_12">Column_Count</A>; -- <FONT COLOR=red><A NAME="ref_310_24">Top</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_311_24">Left</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -- <FONT COLOR=red><A NAME="ref_312_24">Off_Screen</A></FONT> : Natural := 0; -- <FONT COLOR=red><A NAME="ref_313_24">More_Buffers</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_133_9">Buffer_Number</A> := <A HREF="terminal_interface-curses-forms__ads.htm#ref_133_9">Buffer_Number</A>'First) -- <b>return</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_297_13">Create</A>; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/form_field_new.3x.html">new_field()</A></EM></FONT> -+ <span class="comment"><EM>-- #1A NAME="AFU_2"#2|</EM></span> -+ <b>function</b> New_Field (<span class="symbol"><A NAME="ref_306_24">Height</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_63_12">Line_Count</A>; -+ <span class="symbol"><A NAME="ref_307_24">Width</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_65_12">Column_Count</A>; -+ <span class="symbol"><A NAME="ref_308_24">Top</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_309_24">Left</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -+ <span class="symbol"><A NAME="ref_310_24">Off_Screen</A></span> : Natural := 0; -+ <span class="symbol"><A NAME="ref_311_24">More_Buffers</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_131_9">Buffer_Number</A> := <A HREF="terminal_interface-curses-forms__ads.htm#ref_131_9">Buffer_Number</A>'First) -+ <b>return</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A> <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_295_13">Create</A>; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/form_field_new.3x.html">new_field()</A></EM></span> - <b>pragma</b> Inline (New_Field); - -- <FONT COLOR=green><EM>-- #1A NAME="AFU_3"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_319_14" HREF="terminal_interface-curses-forms__adb.htm#ref_131_14">Delete</A></FONT> (<FONT COLOR=red><A NAME="ref_319_22" HREF="terminal_interface-curses-forms__adb.htm#ref_131_22">Fld</A></FONT> : <b>in</b> <b>out</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/form_field_new.3x.html">free_field()</A></EM></FONT> -- <FONT COLOR=green><EM>-- Reset Fld to Null_Field</EM></FONT> -- <FONT COLOR=green><EM>-- An overloaded Delete is defined later. Pragma Inline appears there.</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_4"#2|</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_325_13" HREF="terminal_interface-curses-forms__adb.htm#ref_147_13">Duplicate</A></FONT> (<FONT COLOR=red><A NAME="ref_325_24" HREF="terminal_interface-curses-forms__adb.htm#ref_147_24">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_326_24" HREF="terminal_interface-curses-forms__adb.htm#ref_148_24">Top</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_327_24" HREF="terminal_interface-curses-forms__adb.htm#ref_149_24">Left</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>) <b>return</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/form_field_new.3x.html">dup_field()</A></EM></FONT> -+ <span class="comment"><EM>-- #1A NAME="AFU_3"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_317_14" HREF="terminal_interface-curses-forms__adb.htm#ref_131_14">Delete</A></span> (<span class="symbol"><A NAME="ref_317_22" HREF="terminal_interface-curses-forms__adb.htm#ref_131_22">Fld</A></span> : <b>in</b> <b>out</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/form_field_new.3x.html">free_field()</A></EM></span> -+ <span class="comment"><EM>-- Reset Fld to Null_Field</EM></span> -+ <span class="comment"><EM>-- An overloaded Delete is defined later. Pragma Inline appears there.</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_4"#2|</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_323_13" HREF="terminal_interface-curses-forms__adb.htm#ref_147_13">Duplicate</A></span> (<span class="symbol"><A NAME="ref_323_24" HREF="terminal_interface-curses-forms__adb.htm#ref_147_24">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_324_24" HREF="terminal_interface-curses-forms__adb.htm#ref_148_24">Top</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_325_24" HREF="terminal_interface-curses-forms__adb.htm#ref_149_24">Left</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>) <b>return</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/form_field_new.3x.html">dup_field()</A></EM></span> - <b>pragma</b> Inline (Duplicate); - -- <FONT COLOR=green><EM>-- #1A NAME="AFU_5"#2|</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_332_13" HREF="terminal_interface-curses-forms__adb.htm#ref_168_13">Link</A></FONT> (<FONT COLOR=red><A NAME="ref_332_19" HREF="terminal_interface-curses-forms__adb.htm#ref_168_19">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_333_19" HREF="terminal_interface-curses-forms__adb.htm#ref_169_19">Top</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_334_19" HREF="terminal_interface-curses-forms__adb.htm#ref_170_19">Left</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>) <b>return</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/form_field_new.3x.html">link_field()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses-forms__ads.htm#ref_332_13">Link</A>); -- -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page <A HREF="../man/form_field_just.3x.html">form_field_just.3x</A></EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_6"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_343_14" HREF="terminal_interface-curses-forms__adb.htm#ref_193_14">Set_Justification</A></FONT> (<FONT COLOR=red><A NAME="ref_343_33" HREF="terminal_interface-curses-forms__adb.htm#ref_193_33">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_344_33" HREF="terminal_interface-curses-forms__adb.htm#ref_194_33">Just</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_62_9">Field_Justification</A> := <A HREF="terminal_interface-curses-forms__ads.htm#ref_62_33">None</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/form_field_just.3x.html">set_field_just()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses-forms__ads.htm#ref_343_14">Set_Justification</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_7"#2|</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_349_13" HREF="terminal_interface-curses-forms__adb.htm#ref_211_13">Get_Justification</A></FONT> (<FONT COLOR=red><A NAME="ref_349_32" HREF="terminal_interface-curses-forms__adb.htm#ref_211_32">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>) <b>return</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_62_9">Field_Justification</A>; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/form_field_just.3x.html">field_just()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses-forms__ads.htm#ref_349_13">Get_Justification</A>); -- -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page <A HREF="../man/form_field_buffer.3x.html">form_field_buffer.3x</A></EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_8"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_358_14" HREF="terminal_interface-curses-forms__adb.htm#ref_225_14">Set_Buffer</A></FONT> -- (<FONT COLOR=red><A NAME="ref_359_7" HREF="terminal_interface-curses-forms__adb.htm#ref_226_7">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_360_7" HREF="terminal_interface-curses-forms__adb.htm#ref_227_7">Buffer</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_133_9">Buffer_Number</A> := <A HREF="terminal_interface-curses-forms__ads.htm#ref_133_9">Buffer_Number</A>'First; -- <FONT COLOR=red><A NAME="ref_361_7" HREF="terminal_interface-curses-forms__adb.htm#ref_228_7">Str</A></FONT> : String); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/form_field_buffer.3x.html">set_field_buffer()</A></EM></FONT> -- <FONT COLOR=green><EM>-- Not inlined</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_9"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_366_14" HREF="terminal_interface-curses-forms__adb.htm#ref_250_14">Get_Buffer</A></FONT> -- (<FONT COLOR=red><A NAME="ref_367_7" HREF="terminal_interface-curses-forms__adb.htm#ref_251_7">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_368_7" HREF="terminal_interface-curses-forms__adb.htm#ref_252_7">Buffer</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_133_9">Buffer_Number</A> := <A HREF="terminal_interface-curses-forms__ads.htm#ref_133_9">Buffer_Number</A>'First; -- <FONT COLOR=red><A NAME="ref_369_7" HREF="terminal_interface-curses-forms__adb.htm#ref_253_7">Str</A></FONT> : <b>out</b> String); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/form_field_buffer.3x.html">field_buffer()</A></EM></FONT> -- -- <b>function</b> <FONT COLOR=red><A NAME="ref_372_13" HREF="terminal_interface-curses-forms__adb.htm#ref_262_13">Get_Buffer</A></FONT> -- (<FONT COLOR=red><A NAME="ref_373_7" HREF="terminal_interface-curses-forms__adb.htm#ref_263_7">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_374_7" HREF="terminal_interface-curses-forms__adb.htm#ref_264_7">Buffer</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_133_9">Buffer_Number</A> := <A HREF="terminal_interface-curses-forms__ads.htm#ref_133_9">Buffer_Number</A>'First) <b>return</b> String; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/form_field_buffer.3x.html">field_buffer()</A></EM></FONT> -- <FONT COLOR=green><EM>-- Same but as function</EM></FONT> -+ <span class="comment"><EM>-- #1A NAME="AFU_5"#2|</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_330_13" HREF="terminal_interface-curses-forms__adb.htm#ref_168_13">Link</A></span> (<span class="symbol"><A NAME="ref_330_19" HREF="terminal_interface-curses-forms__adb.htm#ref_168_19">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_331_19" HREF="terminal_interface-curses-forms__adb.htm#ref_169_19">Top</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_332_19" HREF="terminal_interface-curses-forms__adb.htm#ref_170_19">Left</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>) <b>return</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/form_field_new.3x.html">link_field()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses-forms__ads.htm#ref_330_13">Link</A>); -+ -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page <A HREF="../man/form_field_just.3x.html">form_field_just.3x</A></EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_6"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_341_14" HREF="terminal_interface-curses-forms__adb.htm#ref_193_14">Set_Justification</A></span> (<span class="symbol"><A NAME="ref_341_33" HREF="terminal_interface-curses-forms__adb.htm#ref_193_33">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_342_33" HREF="terminal_interface-curses-forms__adb.htm#ref_194_33">Just</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_62_9">Field_Justification</A> := <A HREF="terminal_interface-curses-forms__ads.htm#ref_62_33">None</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/form_field_just.3x.html">set_field_just()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses-forms__ads.htm#ref_341_14">Set_Justification</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_7"#2|</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_347_13" HREF="terminal_interface-curses-forms__adb.htm#ref_211_13">Get_Justification</A></span> (<span class="symbol"><A NAME="ref_347_32" HREF="terminal_interface-curses-forms__adb.htm#ref_211_32">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>) <b>return</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_62_9">Field_Justification</A>; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/form_field_just.3x.html">field_just()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses-forms__ads.htm#ref_347_13">Get_Justification</A>); -+ -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page <A HREF="../man/form_field_buffer.3x.html">form_field_buffer.3x</A></EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_8"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_356_14" HREF="terminal_interface-curses-forms__adb.htm#ref_225_14">Set_Buffer</A></span> -+ (<span class="symbol"><A NAME="ref_357_7" HREF="terminal_interface-curses-forms__adb.htm#ref_226_7">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_358_7" HREF="terminal_interface-curses-forms__adb.htm#ref_227_7">Buffer</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_131_9">Buffer_Number</A> := <A HREF="terminal_interface-curses-forms__ads.htm#ref_131_9">Buffer_Number</A>'First; -+ <span class="symbol"><A NAME="ref_359_7" HREF="terminal_interface-curses-forms__adb.htm#ref_228_7">Str</A></span> : String); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/form_field_buffer.3x.html">set_field_buffer()</A></EM></span> -+ <span class="comment"><EM>-- Not inlined</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_9"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_364_14" HREF="terminal_interface-curses-forms__adb.htm#ref_250_14">Get_Buffer</A></span> -+ (<span class="symbol"><A NAME="ref_365_7" HREF="terminal_interface-curses-forms__adb.htm#ref_251_7">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_366_7" HREF="terminal_interface-curses-forms__adb.htm#ref_252_7">Buffer</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_131_9">Buffer_Number</A> := <A HREF="terminal_interface-curses-forms__ads.htm#ref_131_9">Buffer_Number</A>'First; -+ <span class="symbol"><A NAME="ref_367_7" HREF="terminal_interface-curses-forms__adb.htm#ref_253_7">Str</A></span> : <b>out</b> String); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/form_field_buffer.3x.html">field_buffer()</A></EM></span> -+ -+ <b>function</b> <span class="symbol"><A NAME="ref_370_13" HREF="terminal_interface-curses-forms__adb.htm#ref_262_13">Get_Buffer</A></span> -+ (<span class="symbol"><A NAME="ref_371_7" HREF="terminal_interface-curses-forms__adb.htm#ref_263_7">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_372_7" HREF="terminal_interface-curses-forms__adb.htm#ref_264_7">Buffer</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_131_9">Buffer_Number</A> := <A HREF="terminal_interface-curses-forms__ads.htm#ref_131_9">Buffer_Number</A>'First) <b>return</b> String; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/form_field_buffer.3x.html">field_buffer()</A></EM></span> -+ <span class="comment"><EM>-- Same but as function</EM></span> - <b>pragma</b> Inline (Get_Buffer); - -- <FONT COLOR=green><EM>-- #1A NAME="AFU_10"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_380_14" HREF="terminal_interface-curses-forms__adb.htm#ref_275_14">Set_Status</A></FONT> (<FONT COLOR=red><A NAME="ref_380_26" HREF="terminal_interface-curses-forms__adb.htm#ref_275_26">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_381_26" HREF="terminal_interface-curses-forms__adb.htm#ref_276_26">Status</A></FONT> : Boolean := True); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/form_field_buffer.3x.html">set_field_status()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses-forms__ads.htm#ref_380_14">Set_Status</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_11"#2|</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_386_13" HREF="terminal_interface-curses-forms__adb.htm#ref_291_13">Changed</A></FONT> (<FONT COLOR=red><A NAME="ref_386_22" HREF="terminal_interface-curses-forms__adb.htm#ref_291_22">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>) <b>return</b> Boolean; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/form_field_buffer.3x.html">field_status()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses-forms__ads.htm#ref_386_13">Changed</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_12"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_391_14" HREF="terminal_interface-curses-forms__adb.htm#ref_307_14">Set_Maximum_Size</A></FONT> (<FONT COLOR=red><A NAME="ref_391_32" HREF="terminal_interface-curses-forms__adb.htm#ref_307_32">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_392_32" HREF="terminal_interface-curses-forms__adb.htm#ref_308_32">Max</A></FONT> : Natural := 0); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/form_field_buffer.3x.html">set_field_max()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses-forms__ads.htm#ref_391_14">Set_Maximum_Size</A>); -- -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page <A HREF="../man/form_field_opts.3x.html">form_field_opts.3x</A></EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_13"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_401_14" HREF="terminal_interface-curses-forms__adb.htm#ref_327_14">Set_Options</A></FONT> (<FONT COLOR=red><A NAME="ref_401_27" HREF="terminal_interface-curses-forms__adb.htm#ref_327_27">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_402_27" HREF="terminal_interface-curses-forms__adb.htm#ref_328_27">Options</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_68_9">Field_Option_Set</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/form_field_opts.3x.html">set_field_opts()</A></EM></FONT> -- <FONT COLOR=green><EM>-- An overloaded version is defined later. Pragma Inline appears there</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_14"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_407_14" HREF="terminal_interface-curses-forms__adb.htm#ref_345_14">Switch_Options</A></FONT> (<FONT COLOR=red><A NAME="ref_407_30" HREF="terminal_interface-curses-forms__adb.htm#ref_345_30">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_408_30" HREF="terminal_interface-curses-forms__adb.htm#ref_346_30">Options</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_68_9">Field_Option_Set</A>; -- <FONT COLOR=red><A NAME="ref_409_30" HREF="terminal_interface-curses-forms__adb.htm#ref_347_30">On</A></FONT> : Boolean := True); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/form_field_opts.3x.html">field_opts_on()</A></EM></FONT> -- <FONT COLOR=green><EM>-- AKA: field_opts_off()</EM></FONT> -- <FONT COLOR=green><EM>-- An overloaded version is defined later. Pragma Inline appears there</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_15"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_415_14" HREF="terminal_interface-curses-forms__adb.htm#ref_371_14">Get_Options</A></FONT> (<FONT COLOR=red><A NAME="ref_415_27" HREF="terminal_interface-curses-forms__adb.htm#ref_371_27">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_416_27" HREF="terminal_interface-curses-forms__adb.htm#ref_372_27">Options</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_68_9">Field_Option_Set</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/form_field_opts.3x.html">field_opts()</A></EM></FONT> -+ <span class="comment"><EM>-- #1A NAME="AFU_10"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_378_14" HREF="terminal_interface-curses-forms__adb.htm#ref_275_14">Set_Status</A></span> (<span class="symbol"><A NAME="ref_378_26" HREF="terminal_interface-curses-forms__adb.htm#ref_275_26">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_379_26" HREF="terminal_interface-curses-forms__adb.htm#ref_276_26">Status</A></span> : Boolean := True); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/form_field_buffer.3x.html">set_field_status()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses-forms__ads.htm#ref_378_14">Set_Status</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_11"#2|</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_384_13" HREF="terminal_interface-curses-forms__adb.htm#ref_291_13">Changed</A></span> (<span class="symbol"><A NAME="ref_384_22" HREF="terminal_interface-curses-forms__adb.htm#ref_291_22">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>) <b>return</b> Boolean; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/form_field_buffer.3x.html">field_status()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses-forms__ads.htm#ref_384_13">Changed</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_12"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_389_14" HREF="terminal_interface-curses-forms__adb.htm#ref_307_14">Set_Maximum_Size</A></span> (<span class="symbol"><A NAME="ref_389_32" HREF="terminal_interface-curses-forms__adb.htm#ref_307_32">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_390_32" HREF="terminal_interface-curses-forms__adb.htm#ref_308_32">Max</A></span> : Natural := 0); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/form_field_buffer.3x.html">set_field_max()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses-forms__ads.htm#ref_389_14">Set_Maximum_Size</A>); -+ -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page <A HREF="../man/form_field_opts.3x.html">form_field_opts.3x</A></EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_13"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_399_14" HREF="terminal_interface-curses-forms__adb.htm#ref_327_14">Set_Options</A></span> (<span class="symbol"><A NAME="ref_399_27" HREF="terminal_interface-curses-forms__adb.htm#ref_327_27">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_400_27" HREF="terminal_interface-curses-forms__adb.htm#ref_328_27">Options</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_68_9">Field_Option_Set</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/form_field_opts.3x.html">set_field_opts()</A></EM></span> -+ <span class="comment"><EM>-- An overloaded version is defined later. Pragma Inline appears there</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_14"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_405_14" HREF="terminal_interface-curses-forms__adb.htm#ref_345_14">Switch_Options</A></span> (<span class="symbol"><A NAME="ref_405_30" HREF="terminal_interface-curses-forms__adb.htm#ref_345_30">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_406_30" HREF="terminal_interface-curses-forms__adb.htm#ref_346_30">Options</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_68_9">Field_Option_Set</A>; -+ <span class="symbol"><A NAME="ref_407_30" HREF="terminal_interface-curses-forms__adb.htm#ref_347_30">On</A></span> : Boolean := True); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/form_field_opts.3x.html">field_opts_on()</A></EM></span> -+ <span class="comment"><EM>-- AKA: field_opts_off()</EM></span> -+ <span class="comment"><EM>-- An overloaded version is defined later. Pragma Inline appears there</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_15"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_413_14" HREF="terminal_interface-curses-forms__adb.htm#ref_371_14">Get_Options</A></span> (<span class="symbol"><A NAME="ref_413_27" HREF="terminal_interface-curses-forms__adb.htm#ref_371_27">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_414_27" HREF="terminal_interface-curses-forms__adb.htm#ref_372_27">Options</A></span> : <b>out</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_68_9">Field_Option_Set</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/form_field_opts.3x.html">field_opts()</A></EM></span> - -- <FONT COLOR=green><EM>-- #1A NAME="AFU_16"#2|</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_420_13" HREF="terminal_interface-curses-forms__adb.htm#ref_384_13">Get_Options</A></FONT> (<FONT COLOR=red><A NAME="ref_420_26" HREF="terminal_interface-curses-forms__adb.htm#ref_384_26">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A> := <A HREF="terminal_interface-curses-forms__ads.htm#ref_59_4">Null_Field</A>) -+ <span class="comment"><EM>-- #1A NAME="AFU_16"#2|</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_418_13" HREF="terminal_interface-curses-forms__adb.htm#ref_384_13">Get_Options</A></span> (<span class="symbol"><A NAME="ref_418_26" HREF="terminal_interface-curses-forms__adb.htm#ref_384_26">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A> := <A HREF="terminal_interface-curses-forms__ads.htm#ref_59_4">Null_Field</A>) - <b>return</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_68_9">Field_Option_Set</A>; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/form_field_opts.3x.html">field_opts()</A></EM></FONT> -- <FONT COLOR=green><EM>-- An overloaded version is defined later. Pragma Inline appears there</EM></FONT> -+ <span class="comment"><EM>-- AKA: <A HREF="../man/form_field_opts.3x.html">field_opts()</A></EM></span> -+ <span class="comment"><EM>-- An overloaded version is defined later. Pragma Inline appears there</EM></span> - -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page <A HREF="../man/form_field_attributes.3x.html">form_field_attributes.3x</A></EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_17"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_430_14" HREF="terminal_interface-curses-forms__adb.htm#ref_399_14">Set_Foreground</A></FONT> -- (<FONT COLOR=red><A NAME="ref_431_7" HREF="terminal_interface-curses-forms__adb.htm#ref_400_7">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_432_7" HREF="terminal_interface-curses-forms__adb.htm#ref_401_7">Fore</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A> := <A HREF="terminal_interface-curses__ads.htm#ref_352_4">Normal_Video</A>; -- <FONT COLOR=red><A NAME="ref_433_7" HREF="terminal_interface-curses-forms__adb.htm#ref_402_7">Color</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A> := <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>'First); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/form_field_attributes.3x.html">set_field_fore()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses-forms__ads.htm#ref_430_14">Set_Foreground</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_18"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_438_14" HREF="terminal_interface-curses-forms__adb.htm#ref_421_14">Foreground</A></FONT> (<FONT COLOR=red><A NAME="ref_438_26" HREF="terminal_interface-curses-forms__adb.htm#ref_421_26">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_439_26" HREF="terminal_interface-curses-forms__adb.htm#ref_422_26">Fore</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/form_field_attributes.3x.html">field_fore()</A></EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_19"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_443_14" HREF="terminal_interface-curses-forms__adb.htm#ref_430_14">Foreground</A></FONT> (<FONT COLOR=red><A NAME="ref_443_26" HREF="terminal_interface-curses-forms__adb.htm#ref_430_26">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_444_26" HREF="terminal_interface-curses-forms__adb.htm#ref_431_26">Fore</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A>; -- <FONT COLOR=red><A NAME="ref_445_26" HREF="terminal_interface-curses-forms__adb.htm#ref_432_26">Color</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/form_field_attributes.3x.html">field_fore()</A></EM></FONT> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page <A HREF="../man/form_field_attributes.3x.html">form_field_attributes.3x</A></EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_17"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_428_14" HREF="terminal_interface-curses-forms__adb.htm#ref_399_14">Set_Foreground</A></span> -+ (<span class="symbol"><A NAME="ref_429_7" HREF="terminal_interface-curses-forms__adb.htm#ref_400_7">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_430_7" HREF="terminal_interface-curses-forms__adb.htm#ref_401_7">Fore</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A> := <A HREF="terminal_interface-curses__ads.htm#ref_351_4">Normal_Video</A>; -+ <span class="symbol"><A NAME="ref_431_7" HREF="terminal_interface-curses-forms__adb.htm#ref_402_7">Color</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A> := <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>'First); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/form_field_attributes.3x.html">set_field_fore()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses-forms__ads.htm#ref_428_14">Set_Foreground</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_18"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_436_14" HREF="terminal_interface-curses-forms__adb.htm#ref_421_14">Foreground</A></span> (<span class="symbol"><A NAME="ref_436_26" HREF="terminal_interface-curses-forms__adb.htm#ref_421_26">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_437_26" HREF="terminal_interface-curses-forms__adb.htm#ref_422_26">Fore</A></span> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/form_field_attributes.3x.html">field_fore()</A></EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_19"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_441_14" HREF="terminal_interface-curses-forms__adb.htm#ref_430_14">Foreground</A></span> (<span class="symbol"><A NAME="ref_441_26" HREF="terminal_interface-curses-forms__adb.htm#ref_430_26">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_442_26" HREF="terminal_interface-curses-forms__adb.htm#ref_431_26">Fore</A></span> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A>; -+ <span class="symbol"><A NAME="ref_443_26" HREF="terminal_interface-curses-forms__adb.htm#ref_432_26">Color</A></span> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/form_field_attributes.3x.html">field_fore()</A></EM></span> - <b>pragma</b> Inline (Foreground); - -- <FONT COLOR=green><EM>-- #1A NAME="AFU_20"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_450_14" HREF="terminal_interface-curses-forms__adb.htm#ref_443_14">Set_Background</A></FONT> -- (<FONT COLOR=red><A NAME="ref_451_7" HREF="terminal_interface-curses-forms__adb.htm#ref_444_7">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_452_7" HREF="terminal_interface-curses-forms__adb.htm#ref_445_7">Back</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A> := <A HREF="terminal_interface-curses__ads.htm#ref_352_4">Normal_Video</A>; -- <FONT COLOR=red><A NAME="ref_453_7" HREF="terminal_interface-curses-forms__adb.htm#ref_446_7">Color</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A> := <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>'First); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/form_field_attributes.3x.html">set_field_back()</A></EM></FONT> -+ <span class="comment"><EM>-- #1A NAME="AFU_20"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_448_14" HREF="terminal_interface-curses-forms__adb.htm#ref_443_14">Set_Background</A></span> -+ (<span class="symbol"><A NAME="ref_449_7" HREF="terminal_interface-curses-forms__adb.htm#ref_444_7">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_450_7" HREF="terminal_interface-curses-forms__adb.htm#ref_445_7">Back</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A> := <A HREF="terminal_interface-curses__ads.htm#ref_351_4">Normal_Video</A>; -+ <span class="symbol"><A NAME="ref_451_7" HREF="terminal_interface-curses-forms__adb.htm#ref_446_7">Color</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A> := <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>'First); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/form_field_attributes.3x.html">set_field_back()</A></EM></span> - <b>pragma</b> Inline (Set_Background); - -- <FONT COLOR=green><EM>-- #1A NAME="AFU_21"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_458_14" HREF="terminal_interface-curses-forms__adb.htm#ref_465_14">Background</A></FONT> (<FONT COLOR=red><A NAME="ref_458_26" HREF="terminal_interface-curses-forms__adb.htm#ref_465_26">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_459_26" HREF="terminal_interface-curses-forms__adb.htm#ref_466_26">Back</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/form_field_attributes.3x.html">field_back()</A></EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_22"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_463_14" HREF="terminal_interface-curses-forms__adb.htm#ref_474_14">Background</A></FONT> (<FONT COLOR=red><A NAME="ref_463_26" HREF="terminal_interface-curses-forms__adb.htm#ref_474_26">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_464_26" HREF="terminal_interface-curses-forms__adb.htm#ref_475_26">Back</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A>; -- <FONT COLOR=red><A NAME="ref_465_26" HREF="terminal_interface-curses-forms__adb.htm#ref_476_26">Color</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/form_field_attributes.3x.html">field_back()</A></EM></FONT> -+ <span class="comment"><EM>-- #1A NAME="AFU_21"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_456_14" HREF="terminal_interface-curses-forms__adb.htm#ref_465_14">Background</A></span> (<span class="symbol"><A NAME="ref_456_26" HREF="terminal_interface-curses-forms__adb.htm#ref_465_26">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_457_26" HREF="terminal_interface-curses-forms__adb.htm#ref_466_26">Back</A></span> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/form_field_attributes.3x.html">field_back()</A></EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_22"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_461_14" HREF="terminal_interface-curses-forms__adb.htm#ref_474_14">Background</A></span> (<span class="symbol"><A NAME="ref_461_26" HREF="terminal_interface-curses-forms__adb.htm#ref_474_26">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_462_26" HREF="terminal_interface-curses-forms__adb.htm#ref_475_26">Back</A></span> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A>; -+ <span class="symbol"><A NAME="ref_463_26" HREF="terminal_interface-curses-forms__adb.htm#ref_476_26">Color</A></span> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/form_field_attributes.3x.html">field_back()</A></EM></span> - <b>pragma</b> Inline (Background); - -- <FONT COLOR=green><EM>-- #1A NAME="AFU_23"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_470_14" HREF="terminal_interface-curses-forms__adb.htm#ref_487_14">Set_Pad_Character</A></FONT> (<FONT COLOR=red><A NAME="ref_470_33" HREF="terminal_interface-curses-forms__adb.htm#ref_487_33">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_471_33" HREF="terminal_interface-curses-forms__adb.htm#ref_488_33">Pad</A></FONT> : Character := Space); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/form_field_attributes.3x.html">set_field_pad()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses-forms__ads.htm#ref_470_14">Set_Pad_Character</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_24"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_476_14" HREF="terminal_interface-curses-forms__adb.htm#ref_504_14">Pad_Character</A></FONT> (<FONT COLOR=red><A NAME="ref_476_29" HREF="terminal_interface-curses-forms__adb.htm#ref_504_29">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_477_29" HREF="terminal_interface-curses-forms__adb.htm#ref_505_29">Pad</A></FONT> : <b>out</b> Character); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/form_field_attributes.3x.html">field_pad()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses-forms__ads.htm#ref_476_14">Pad_Character</A>); -- -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page <A HREF="../man/form_field_info.3x.html">form_field_info.3x</A></EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_25"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_486_14" HREF="terminal_interface-curses-forms__adb.htm#ref_519_14">Info</A></FONT> (<FONT COLOR=red><A NAME="ref_486_20" HREF="terminal_interface-curses-forms__adb.htm#ref_519_20">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_487_20" HREF="terminal_interface-curses-forms__adb.htm#ref_520_20">Lines</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_63_12">Line_Count</A>; -- <FONT COLOR=red><A NAME="ref_488_20" HREF="terminal_interface-curses-forms__adb.htm#ref_521_20">Columns</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_65_12">Column_Count</A>; -- <FONT COLOR=red><A NAME="ref_489_20" HREF="terminal_interface-curses-forms__adb.htm#ref_522_20">First_Row</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_490_20" HREF="terminal_interface-curses-forms__adb.htm#ref_523_20">First_Column</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -- <FONT COLOR=red><A NAME="ref_491_20" HREF="terminal_interface-curses-forms__adb.htm#ref_524_20">Off_Screen</A></FONT> : <b>out</b> Natural; -- <FONT COLOR=red><A NAME="ref_492_20" HREF="terminal_interface-curses-forms__adb.htm#ref_525_20">Additional_Buffers</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_133_9">Buffer_Number</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/form_field_info.3x.html">field_info()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses-forms__ads.htm#ref_486_14">Info</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_26"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_497_14" HREF="terminal_interface-curses-forms__adb.htm#ref_553_14">Dynamic_Info</A></FONT> (<FONT COLOR=red><A NAME="ref_497_28" HREF="terminal_interface-curses-forms__adb.htm#ref_553_28">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_498_28" HREF="terminal_interface-curses-forms__adb.htm#ref_554_28">Lines</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_63_12">Line_Count</A>; -- <FONT COLOR=red><A NAME="ref_499_28" HREF="terminal_interface-curses-forms__adb.htm#ref_555_28">Columns</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_65_12">Column_Count</A>; -- <FONT COLOR=red><A NAME="ref_500_28" HREF="terminal_interface-curses-forms__adb.htm#ref_556_28">Max</A></FONT> : <b>out</b> Natural); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/form_field_info.3x.html">dynamic_field_info()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses-forms__ads.htm#ref_497_14">Dynamic_Info</A>); -- -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page <A HREF="../man/form_win.3x.html">form_win.3x</A></EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_27"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_509_14" HREF="terminal_interface-curses-forms__adb.htm#ref_582_14">Set_Window</A></FONT> (<FONT COLOR=red><A NAME="ref_509_26" HREF="terminal_interface-curses-forms__adb.htm#ref_582_26">Frm</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -- <FONT COLOR=red><A NAME="ref_510_26" HREF="terminal_interface-curses-forms__adb.htm#ref_583_26">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/form_win.3x.html">set_form_win()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses-forms__ads.htm#ref_509_14">Set_Window</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_28"#2|</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_515_13" HREF="terminal_interface-curses-forms__adb.htm#ref_598_13">Get_Window</A></FONT> (<FONT COLOR=red><A NAME="ref_515_25" HREF="terminal_interface-curses-forms__adb.htm#ref_598_25">Frm</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/form_win.3x.html">form_win()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses-forms__ads.htm#ref_515_13">Get_Window</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_29"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_520_14" HREF="terminal_interface-curses-forms__adb.htm#ref_610_14">Set_Sub_Window</A></FONT> (<FONT COLOR=red><A NAME="ref_520_30" HREF="terminal_interface-curses-forms__adb.htm#ref_610_30">Frm</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -- <FONT COLOR=red><A NAME="ref_521_30" HREF="terminal_interface-curses-forms__adb.htm#ref_611_30">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/form_win.3x.html">set_form_sub()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses-forms__ads.htm#ref_520_14">Set_Sub_Window</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_30"#2|</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_526_13" HREF="terminal_interface-curses-forms__adb.htm#ref_626_13">Get_Sub_Window</A></FONT> (<FONT COLOR=red><A NAME="ref_526_29" HREF="terminal_interface-curses-forms__adb.htm#ref_626_29">Frm</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/form_win.3x.html">form_sub()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses-forms__ads.htm#ref_526_13">Get_Sub_Window</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_31"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_531_14" HREF="terminal_interface-curses-forms__adb.htm#ref_638_14">Scale</A></FONT> (<FONT COLOR=red><A NAME="ref_531_21" HREF="terminal_interface-curses-forms__adb.htm#ref_638_21">Frm</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -- <FONT COLOR=red><A NAME="ref_532_21" HREF="terminal_interface-curses-forms__adb.htm#ref_639_21">Lines</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_63_12">Line_Count</A>; -- <FONT COLOR=red><A NAME="ref_533_21" HREF="terminal_interface-curses-forms__adb.htm#ref_640_21">Columns</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_65_12">Column_Count</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/form_win.3x.html">scale_form()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses-forms__ads.htm#ref_531_14">Scale</A>); -- -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page <A HREF="../man/form_hook.3x.html">form_hook.3x</A></EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- -- <b>type</b> <FONT COLOR=red><A NAME="ref_541_9">Form_Hook_Function</A></FONT> <b>is</b> <b>access</b> <b>procedure</b> (<FONT COLOR=red><A NAME="ref_541_49">Frm</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>); -- <b>pragma</b> Convention (C, <A HREF="terminal_interface-curses-forms__ads.htm#ref_541_9">Form_Hook_Function</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_32"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_545_14" HREF="terminal_interface-curses-forms__adb.htm#ref_662_14">Set_Field_Init_Hook</A></FONT> (<FONT COLOR=red><A NAME="ref_545_35" HREF="terminal_interface-curses-forms__adb.htm#ref_662_35">Frm</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -- <FONT COLOR=red><A NAME="ref_546_35" HREF="terminal_interface-curses-forms__adb.htm#ref_663_35">Proc</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_541_9">Form_Hook_Function</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/form_hook.3x.html">set_field_init()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses-forms__ads.htm#ref_545_14">Set_Field_Init_Hook</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_33"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_551_14" HREF="terminal_interface-curses-forms__adb.htm#ref_678_14">Set_Field_Term_Hook</A></FONT> (<FONT COLOR=red><A NAME="ref_551_35" HREF="terminal_interface-curses-forms__adb.htm#ref_678_35">Frm</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -- <FONT COLOR=red><A NAME="ref_552_35" HREF="terminal_interface-curses-forms__adb.htm#ref_679_35">Proc</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_541_9">Form_Hook_Function</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/form_hook.3x.html">set_field_term()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses-forms__ads.htm#ref_551_14">Set_Field_Term_Hook</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_34"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_557_14" HREF="terminal_interface-curses-forms__adb.htm#ref_694_14">Set_Form_Init_Hook</A></FONT> (<FONT COLOR=red><A NAME="ref_557_34" HREF="terminal_interface-curses-forms__adb.htm#ref_694_34">Frm</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -- <FONT COLOR=red><A NAME="ref_558_34" HREF="terminal_interface-curses-forms__adb.htm#ref_695_34">Proc</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_541_9">Form_Hook_Function</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/form_hook.3x.html">set_form_init()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses-forms__ads.htm#ref_557_14">Set_Form_Init_Hook</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_35"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_563_14" HREF="terminal_interface-curses-forms__adb.htm#ref_710_14">Set_Form_Term_Hook</A></FONT> (<FONT COLOR=red><A NAME="ref_563_34" HREF="terminal_interface-curses-forms__adb.htm#ref_710_34">Frm</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -- <FONT COLOR=red><A NAME="ref_564_34" HREF="terminal_interface-curses-forms__adb.htm#ref_711_34">Proc</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_541_9">Form_Hook_Function</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/form_hook.3x.html">set_form_term()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses-forms__ads.htm#ref_563_14">Set_Form_Term_Hook</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_36"#2|</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_569_13">Get_Field_Init_Hook</A></FONT> (<FONT COLOR=red><A NAME="ref_569_34" HREF="terminal_interface-curses-forms__ads.htm#ref_569_13">Frm</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>) <b>return</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_541_9">Form_Hook_Function</A>; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/form_hook.3x.html">field_init()</A></EM></FONT> -+ <span class="comment"><EM>-- #1A NAME="AFU_23"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_468_14" HREF="terminal_interface-curses-forms__adb.htm#ref_487_14">Set_Pad_Character</A></span> (<span class="symbol"><A NAME="ref_468_33" HREF="terminal_interface-curses-forms__adb.htm#ref_487_33">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_469_33" HREF="terminal_interface-curses-forms__adb.htm#ref_488_33">Pad</A></span> : Character := Space); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/form_field_attributes.3x.html">set_field_pad()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses-forms__ads.htm#ref_468_14">Set_Pad_Character</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_24"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_474_14" HREF="terminal_interface-curses-forms__adb.htm#ref_504_14">Pad_Character</A></span> (<span class="symbol"><A NAME="ref_474_29" HREF="terminal_interface-curses-forms__adb.htm#ref_504_29">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_475_29" HREF="terminal_interface-curses-forms__adb.htm#ref_505_29">Pad</A></span> : <b>out</b> Character); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/form_field_attributes.3x.html">field_pad()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses-forms__ads.htm#ref_474_14">Pad_Character</A>); -+ -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page <A HREF="../man/form_field_info.3x.html">form_field_info.3x</A></EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_25"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_484_14" HREF="terminal_interface-curses-forms__adb.htm#ref_519_14">Info</A></span> (<span class="symbol"><A NAME="ref_484_20" HREF="terminal_interface-curses-forms__adb.htm#ref_519_20">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_485_20" HREF="terminal_interface-curses-forms__adb.htm#ref_520_20">Lines</A></span> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_63_12">Line_Count</A>; -+ <span class="symbol"><A NAME="ref_486_20" HREF="terminal_interface-curses-forms__adb.htm#ref_521_20">Columns</A></span> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_65_12">Column_Count</A>; -+ <span class="symbol"><A NAME="ref_487_20" HREF="terminal_interface-curses-forms__adb.htm#ref_522_20">First_Row</A></span> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_488_20" HREF="terminal_interface-curses-forms__adb.htm#ref_523_20">First_Column</A></span> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -+ <span class="symbol"><A NAME="ref_489_20" HREF="terminal_interface-curses-forms__adb.htm#ref_524_20">Off_Screen</A></span> : <b>out</b> Natural; -+ <span class="symbol"><A NAME="ref_490_20" HREF="terminal_interface-curses-forms__adb.htm#ref_525_20">Additional_Buffers</A></span> : <b>out</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_131_9">Buffer_Number</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/form_field_info.3x.html">field_info()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses-forms__ads.htm#ref_484_14">Info</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_26"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_495_14" HREF="terminal_interface-curses-forms__adb.htm#ref_553_14">Dynamic_Info</A></span> (<span class="symbol"><A NAME="ref_495_28" HREF="terminal_interface-curses-forms__adb.htm#ref_553_28">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_496_28" HREF="terminal_interface-curses-forms__adb.htm#ref_554_28">Lines</A></span> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_63_12">Line_Count</A>; -+ <span class="symbol"><A NAME="ref_497_28" HREF="terminal_interface-curses-forms__adb.htm#ref_555_28">Columns</A></span> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_65_12">Column_Count</A>; -+ <span class="symbol"><A NAME="ref_498_28" HREF="terminal_interface-curses-forms__adb.htm#ref_556_28">Max</A></span> : <b>out</b> Natural); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/form_field_info.3x.html">dynamic_field_info()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses-forms__ads.htm#ref_495_14">Dynamic_Info</A>); -+ -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page <A HREF="../man/form_win.3x.html">form_win.3x</A></EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_27"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_507_14" HREF="terminal_interface-curses-forms__adb.htm#ref_582_14">Set_Window</A></span> (<span class="symbol"><A NAME="ref_507_26" HREF="terminal_interface-curses-forms__adb.htm#ref_582_26">Frm</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -+ <span class="symbol"><A NAME="ref_508_26" HREF="terminal_interface-curses-forms__adb.htm#ref_583_26">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/form_win.3x.html">set_form_win()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses-forms__ads.htm#ref_507_14">Set_Window</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_28"#2|</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_513_13" HREF="terminal_interface-curses-forms__adb.htm#ref_598_13">Get_Window</A></span> (<span class="symbol"><A NAME="ref_513_25" HREF="terminal_interface-curses-forms__adb.htm#ref_598_25">Frm</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/form_win.3x.html">form_win()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses-forms__ads.htm#ref_513_13">Get_Window</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_29"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_518_14" HREF="terminal_interface-curses-forms__adb.htm#ref_610_14">Set_Sub_Window</A></span> (<span class="symbol"><A NAME="ref_518_30" HREF="terminal_interface-curses-forms__adb.htm#ref_610_30">Frm</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -+ <span class="symbol"><A NAME="ref_519_30" HREF="terminal_interface-curses-forms__adb.htm#ref_611_30">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/form_win.3x.html">set_form_sub()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses-forms__ads.htm#ref_518_14">Set_Sub_Window</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_30"#2|</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_524_13" HREF="terminal_interface-curses-forms__adb.htm#ref_626_13">Get_Sub_Window</A></span> (<span class="symbol"><A NAME="ref_524_29" HREF="terminal_interface-curses-forms__adb.htm#ref_626_29">Frm</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/form_win.3x.html">form_sub()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses-forms__ads.htm#ref_524_13">Get_Sub_Window</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_31"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_529_14" HREF="terminal_interface-curses-forms__adb.htm#ref_638_14">Scale</A></span> (<span class="symbol"><A NAME="ref_529_21" HREF="terminal_interface-curses-forms__adb.htm#ref_638_21">Frm</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -+ <span class="symbol"><A NAME="ref_530_21" HREF="terminal_interface-curses-forms__adb.htm#ref_639_21">Lines</A></span> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_63_12">Line_Count</A>; -+ <span class="symbol"><A NAME="ref_531_21" HREF="terminal_interface-curses-forms__adb.htm#ref_640_21">Columns</A></span> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_65_12">Column_Count</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/form_win.3x.html">scale_form()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses-forms__ads.htm#ref_529_14">Scale</A>); -+ -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page <A HREF="../man/form_hook.3x.html">form_hook.3x</A></EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ -+ <b>type</b> <span class="symbol"><A NAME="ref_539_9">Form_Hook_Function</A></span> <b>is</b> <b>access</b> <b>procedure</b> (<span class="symbol"><A NAME="ref_539_49">Frm</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>); -+ <b>pragma</b> Convention (C, <A HREF="terminal_interface-curses-forms__ads.htm#ref_539_9">Form_Hook_Function</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_32"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_543_14" HREF="terminal_interface-curses-forms__adb.htm#ref_662_14">Set_Field_Init_Hook</A></span> (<span class="symbol"><A NAME="ref_543_35" HREF="terminal_interface-curses-forms__adb.htm#ref_662_35">Frm</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -+ <span class="symbol"><A NAME="ref_544_35" HREF="terminal_interface-curses-forms__adb.htm#ref_663_35">Proc</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_539_9">Form_Hook_Function</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/form_hook.3x.html">set_field_init()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses-forms__ads.htm#ref_543_14">Set_Field_Init_Hook</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_33"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_549_14" HREF="terminal_interface-curses-forms__adb.htm#ref_678_14">Set_Field_Term_Hook</A></span> (<span class="symbol"><A NAME="ref_549_35" HREF="terminal_interface-curses-forms__adb.htm#ref_678_35">Frm</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -+ <span class="symbol"><A NAME="ref_550_35" HREF="terminal_interface-curses-forms__adb.htm#ref_679_35">Proc</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_539_9">Form_Hook_Function</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/form_hook.3x.html">set_field_term()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses-forms__ads.htm#ref_549_14">Set_Field_Term_Hook</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_34"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_555_14" HREF="terminal_interface-curses-forms__adb.htm#ref_694_14">Set_Form_Init_Hook</A></span> (<span class="symbol"><A NAME="ref_555_34" HREF="terminal_interface-curses-forms__adb.htm#ref_694_34">Frm</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -+ <span class="symbol"><A NAME="ref_556_34" HREF="terminal_interface-curses-forms__adb.htm#ref_695_34">Proc</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_539_9">Form_Hook_Function</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/form_hook.3x.html">set_form_init()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses-forms__ads.htm#ref_555_14">Set_Form_Init_Hook</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_35"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_561_14" HREF="terminal_interface-curses-forms__adb.htm#ref_710_14">Set_Form_Term_Hook</A></span> (<span class="symbol"><A NAME="ref_561_34" HREF="terminal_interface-curses-forms__adb.htm#ref_710_34">Frm</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -+ <span class="symbol"><A NAME="ref_562_34" HREF="terminal_interface-curses-forms__adb.htm#ref_711_34">Proc</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_539_9">Form_Hook_Function</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/form_hook.3x.html">set_form_term()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses-forms__ads.htm#ref_561_14">Set_Form_Term_Hook</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_36"#2|</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_567_13">Get_Field_Init_Hook</A></span> (<span class="symbol"><A NAME="ref_567_34" HREF="terminal_interface-curses-forms__ads.htm#ref_567_13">Frm</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>) <b>return</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_539_9">Form_Hook_Function</A>; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/form_hook.3x.html">field_init()</A></EM></span> - <b>pragma</b> Import (C, Get_Field_Init_Hook, "field_init"); - -- <FONT COLOR=green><EM>-- #1A NAME="AFU_37"#2|</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_574_13">Get_Field_Term_Hook</A></FONT> (<FONT COLOR=red><A NAME="ref_574_34" HREF="terminal_interface-curses-forms__ads.htm#ref_574_13">Frm</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>) <b>return</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_541_9">Form_Hook_Function</A>; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/form_hook.3x.html">field_term()</A></EM></FONT> -+ <span class="comment"><EM>-- #1A NAME="AFU_37"#2|</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_572_13">Get_Field_Term_Hook</A></span> (<span class="symbol"><A NAME="ref_572_34" HREF="terminal_interface-curses-forms__ads.htm#ref_572_13">Frm</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>) <b>return</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_539_9">Form_Hook_Function</A>; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/form_hook.3x.html">field_term()</A></EM></span> - <b>pragma</b> Import (C, Get_Field_Term_Hook, "field_term"); - -- <FONT COLOR=green><EM>-- #1A NAME="AFU_38"#2|</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_579_13">Get_Form_Init_Hook</A></FONT> (<FONT COLOR=red><A NAME="ref_579_33" HREF="terminal_interface-curses-forms__ads.htm#ref_579_13">Frm</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>) <b>return</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_541_9">Form_Hook_Function</A>; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/form_hook.3x.html">form_init()</A></EM></FONT> -+ <span class="comment"><EM>-- #1A NAME="AFU_38"#2|</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_577_13">Get_Form_Init_Hook</A></span> (<span class="symbol"><A NAME="ref_577_33" HREF="terminal_interface-curses-forms__ads.htm#ref_577_13">Frm</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>) <b>return</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_539_9">Form_Hook_Function</A>; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/form_hook.3x.html">form_init()</A></EM></span> - <b>pragma</b> Import (C, Get_Form_Init_Hook, "form_init"); - -- <FONT COLOR=green><EM>-- #1A NAME="AFU_39"#2|</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_584_13">Get_Form_Term_Hook</A></FONT> (<FONT COLOR=red><A NAME="ref_584_33" HREF="terminal_interface-curses-forms__ads.htm#ref_584_13">Frm</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>) <b>return</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_541_9">Form_Hook_Function</A>; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/form_hook.3x.html">form_term()</A></EM></FONT> -+ <span class="comment"><EM>-- #1A NAME="AFU_39"#2|</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_582_13">Get_Form_Term_Hook</A></span> (<span class="symbol"><A NAME="ref_582_33" HREF="terminal_interface-curses-forms__ads.htm#ref_582_13">Frm</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>) <b>return</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_539_9">Form_Hook_Function</A>; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/form_hook.3x.html">form_term()</A></EM></span> - <b>pragma</b> Import (C, Get_Form_Term_Hook, "form_term"); - -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page <A HREF="../man/form_field.3x.html">form_field.3x</A></EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_40"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_593_14" HREF="terminal_interface-curses-forms__adb.htm#ref_730_14">Redefine</A></FONT> (<FONT COLOR=red><A NAME="ref_593_24" HREF="terminal_interface-curses-forms__adb.htm#ref_730_24">Frm</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -- <FONT COLOR=red><A NAME="ref_594_24" HREF="terminal_interface-curses-forms__adb.htm#ref_731_24">Flds</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_138_9">Field_Array_Access</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/form_field.3x.html">set_form_fields()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses-forms__ads.htm#ref_593_14">Redefine</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_41"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_599_14">Set_Fields</A></FONT> (<FONT COLOR=red><A NAME="ref_599_26">Frm</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -- <FONT COLOR=red><A NAME="ref_600_26">Flds</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_138_9">Field_Array_Access</A>) <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_593_14">Redefine</A>; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/form_field.3x.html">set_form_fields()</A></EM></FONT> -- <FONT COLOR=green><EM>-- pragma Inline (Set_Fields);</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_42"#2|</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_605_13" HREF="terminal_interface-curses-forms__adb.htm#ref_752_13">Fields</A></FONT> (<FONT COLOR=red><A NAME="ref_605_21" HREF="terminal_interface-curses-forms__adb.htm#ref_752_21">Frm</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -- <FONT COLOR=red><A NAME="ref_606_21" HREF="terminal_interface-curses-forms__adb.htm#ref_753_21">Index</A></FONT> : Positive) <b>return</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/form_field.3x.html">form_fields()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses-forms__ads.htm#ref_605_13">Fields</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_43"#2|</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_611_13" HREF="terminal_interface-curses-forms__adb.htm#ref_772_13">Field_Count</A></FONT> (<FONT COLOR=red><A NAME="ref_611_26" HREF="terminal_interface-curses-forms__adb.htm#ref_772_26">Frm</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>) <b>return</b> Natural; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/form_field.3x.html">field_count()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses-forms__ads.htm#ref_611_13">Field_Count</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_44"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_616_14" HREF="terminal_interface-curses-forms__adb.htm#ref_782_14">Move</A></FONT> (<FONT COLOR=red><A NAME="ref_616_20" HREF="terminal_interface-curses-forms__adb.htm#ref_782_20">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_617_20" HREF="terminal_interface-curses-forms__adb.htm#ref_783_20">Line</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_618_20" HREF="terminal_interface-curses-forms__adb.htm#ref_784_20">Column</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/form_field.3x.html">move_field()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses-forms__ads.htm#ref_616_14">Move</A>); -- -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page <A HREF="../man/form_new.3x.html">form_new.3x</A></EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_45"#2|</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_627_13" HREF="terminal_interface-curses-forms__adb.htm#ref_802_13">Create</A></FONT> (<FONT COLOR=red><A NAME="ref_627_21" HREF="terminal_interface-curses-forms__adb.htm#ref_802_21">Fields</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_138_9">Field_Array_Access</A>) <b>return</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/form_new.3x.html">new_form()</A></EM></FONT> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page <A HREF="../man/form_field.3x.html">form_field.3x</A></EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_40"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_591_14" HREF="terminal_interface-curses-forms__adb.htm#ref_730_14">Redefine</A></span> (<span class="symbol"><A NAME="ref_591_24" HREF="terminal_interface-curses-forms__adb.htm#ref_730_24">Frm</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -+ <span class="symbol"><A NAME="ref_592_24" HREF="terminal_interface-curses-forms__adb.htm#ref_731_24">Flds</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_136_9">Field_Array_Access</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/form_field.3x.html">set_form_fields()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses-forms__ads.htm#ref_591_14">Redefine</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_41"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_597_14">Set_Fields</A></span> (<span class="symbol"><A NAME="ref_597_26">Frm</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -+ <span class="symbol"><A NAME="ref_598_26">Flds</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_136_9">Field_Array_Access</A>) <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_591_14">Redefine</A>; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/form_field.3x.html">set_form_fields()</A></EM></span> -+ <span class="comment"><EM>-- pragma Inline (Set_Fields);</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_42"#2|</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_603_13" HREF="terminal_interface-curses-forms__adb.htm#ref_752_13">Fields</A></span> (<span class="symbol"><A NAME="ref_603_21" HREF="terminal_interface-curses-forms__adb.htm#ref_752_21">Frm</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -+ <span class="symbol"><A NAME="ref_604_21" HREF="terminal_interface-curses-forms__adb.htm#ref_753_21">Index</A></span> : Positive) <b>return</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/form_field.3x.html">form_fields()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses-forms__ads.htm#ref_603_13">Fields</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_43"#2|</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_609_13" HREF="terminal_interface-curses-forms__adb.htm#ref_772_13">Field_Count</A></span> (<span class="symbol"><A NAME="ref_609_26" HREF="terminal_interface-curses-forms__adb.htm#ref_772_26">Frm</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>) <b>return</b> Natural; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/form_field.3x.html">field_count()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses-forms__ads.htm#ref_609_13">Field_Count</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_44"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_614_14" HREF="terminal_interface-curses-forms__adb.htm#ref_782_14">Move</A></span> (<span class="symbol"><A NAME="ref_614_20" HREF="terminal_interface-curses-forms__adb.htm#ref_782_20">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_615_20" HREF="terminal_interface-curses-forms__adb.htm#ref_783_20">Line</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_616_20" HREF="terminal_interface-curses-forms__adb.htm#ref_784_20">Column</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/form_field.3x.html">move_field()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses-forms__ads.htm#ref_614_14">Move</A>); -+ -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page <A HREF="../man/form_new.3x.html">form_new.3x</A></EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_45"#2|</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_625_13" HREF="terminal_interface-curses-forms__adb.htm#ref_802_13">Create</A></span> (<span class="symbol"><A NAME="ref_625_21" HREF="terminal_interface-curses-forms__adb.htm#ref_802_21">Fields</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_136_9">Field_Array_Access</A>) <b>return</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/form_new.3x.html">new_form()</A></EM></span> - <b>pragma</b> Inline (Create); - -- <FONT COLOR=green><EM>-- #1A NAME="AFU_46"#2|</EM></FONT> -- <b>function</b> New_Form (<FONT COLOR=red><A NAME="ref_632_23">Fields</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_138_9">Field_Array_Access</A>) <b>return</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A> -- <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_627_13">Create</A>; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/form_new.3x.html">new_form()</A></EM></FONT> -- <FONT COLOR=green><EM>-- pragma Inline (New_Form);</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_47"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_638_14" HREF="terminal_interface-curses-forms__adb.htm#ref_823_14">Delete</A></FONT> (<FONT COLOR=red><A NAME="ref_638_22" HREF="terminal_interface-curses-forms__adb.htm#ref_823_22">Frm</A></FONT> : <b>in</b> <b>out</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/form_new.3x.html">free_form()</A></EM></FONT> -- <FONT COLOR=green><EM>-- Reset Frm to Null_Form</EM></FONT> -+ <span class="comment"><EM>-- #1A NAME="AFU_46"#2|</EM></span> -+ <b>function</b> New_Form (<span class="symbol"><A NAME="ref_630_23">Fields</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_136_9">Field_Array_Access</A>) <b>return</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A> -+ <b>renames</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_625_13">Create</A>; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/form_new.3x.html">new_form()</A></EM></span> -+ <span class="comment"><EM>-- pragma Inline (New_Form);</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_47"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_636_14" HREF="terminal_interface-curses-forms__adb.htm#ref_823_14">Delete</A></span> (<span class="symbol"><A NAME="ref_636_22" HREF="terminal_interface-curses-forms__adb.htm#ref_823_22">Frm</A></span> : <b>in</b> <b>out</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/form_new.3x.html">free_form()</A></EM></span> -+ <span class="comment"><EM>-- Reset Frm to Null_Form</EM></span> - <b>pragma</b> Inline (Delete); - -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page <A HREF="../man/form_opts.3x.html">form_opts.3x</A></EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_48"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_648_14" HREF="terminal_interface-curses-forms__adb.htm#ref_842_14">Set_Options</A></FONT> (<FONT COLOR=red><A NAME="ref_648_27" HREF="terminal_interface-curses-forms__adb.htm#ref_842_27">Frm</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -- <FONT COLOR=red><A NAME="ref_649_27" HREF="terminal_interface-curses-forms__adb.htm#ref_843_27">Options</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_109_9">Form_Option_Set</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/form_opts.3x.html">set_form_opts()</A></EM></FONT> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page <A HREF="../man/form_opts.3x.html">form_opts.3x</A></EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_48"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_646_14" HREF="terminal_interface-curses-forms__adb.htm#ref_842_14">Set_Options</A></span> (<span class="symbol"><A NAME="ref_646_27" HREF="terminal_interface-curses-forms__adb.htm#ref_842_27">Frm</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -+ <span class="symbol"><A NAME="ref_647_27" HREF="terminal_interface-curses-forms__adb.htm#ref_843_27">Options</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_108_9">Form_Option_Set</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/form_opts.3x.html">set_form_opts()</A></EM></span> - <b>pragma</b> Inline (Set_Options); - -- <FONT COLOR=green><EM>-- #1A NAME="AFU_49"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_654_14" HREF="terminal_interface-curses-forms__adb.htm#ref_860_14">Switch_Options</A></FONT> (<FONT COLOR=red><A NAME="ref_654_30" HREF="terminal_interface-curses-forms__adb.htm#ref_860_30">Frm</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -- <FONT COLOR=red><A NAME="ref_655_30" HREF="terminal_interface-curses-forms__adb.htm#ref_861_30">Options</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_109_9">Form_Option_Set</A>; -- <FONT COLOR=red><A NAME="ref_656_30" HREF="terminal_interface-curses-forms__adb.htm#ref_862_30">On</A></FONT> : Boolean := True); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/form_opts.3x.html">form_opts_on()</A></EM></FONT> -- <FONT COLOR=green><EM>-- AKA: form_opts_off()</EM></FONT> -+ <span class="comment"><EM>-- #1A NAME="AFU_49"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_652_14" HREF="terminal_interface-curses-forms__adb.htm#ref_860_14">Switch_Options</A></span> (<span class="symbol"><A NAME="ref_652_30" HREF="terminal_interface-curses-forms__adb.htm#ref_860_30">Frm</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -+ <span class="symbol"><A NAME="ref_653_30" HREF="terminal_interface-curses-forms__adb.htm#ref_861_30">Options</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_108_9">Form_Option_Set</A>; -+ <span class="symbol"><A NAME="ref_654_30" HREF="terminal_interface-curses-forms__adb.htm#ref_862_30">On</A></span> : Boolean := True); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/form_opts.3x.html">form_opts_on()</A></EM></span> -+ <span class="comment"><EM>-- AKA: form_opts_off()</EM></span> - <b>pragma</b> Inline (Switch_Options); - -- <FONT COLOR=green><EM>-- #1A NAME="AFU_50"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_662_14" HREF="terminal_interface-curses-forms__adb.htm#ref_886_14">Get_Options</A></FONT> (<FONT COLOR=red><A NAME="ref_662_27" HREF="terminal_interface-curses-forms__adb.htm#ref_886_27">Frm</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -- <FONT COLOR=red><A NAME="ref_663_27" HREF="terminal_interface-curses-forms__adb.htm#ref_887_27">Options</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_109_9">Form_Option_Set</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/form_opts.3x.html">form_opts()</A></EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_51"#2|</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_667_13" HREF="terminal_interface-curses-forms__adb.htm#ref_899_13">Get_Options</A></FONT> (<FONT COLOR=red><A NAME="ref_667_26" HREF="terminal_interface-curses-forms__adb.htm#ref_899_26">Frm</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A> := <A HREF="terminal_interface-curses-forms__ads.htm#ref_60_4">Null_Form</A>) <b>return</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_109_9">Form_Option_Set</A>; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/form_opts.3x.html">form_opts()</A></EM></FONT> -+ <span class="comment"><EM>-- #1A NAME="AFU_50"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_660_14" HREF="terminal_interface-curses-forms__adb.htm#ref_886_14">Get_Options</A></span> (<span class="symbol"><A NAME="ref_660_27" HREF="terminal_interface-curses-forms__adb.htm#ref_886_27">Frm</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -+ <span class="symbol"><A NAME="ref_661_27" HREF="terminal_interface-curses-forms__adb.htm#ref_887_27">Options</A></span> : <b>out</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_108_9">Form_Option_Set</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/form_opts.3x.html">form_opts()</A></EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_51"#2|</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_665_13" HREF="terminal_interface-curses-forms__adb.htm#ref_899_13">Get_Options</A></span> (<span class="symbol"><A NAME="ref_665_26" HREF="terminal_interface-curses-forms__adb.htm#ref_899_26">Frm</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A> := <A HREF="terminal_interface-curses-forms__ads.htm#ref_60_4">Null_Form</A>) <b>return</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_108_9">Form_Option_Set</A>; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/form_opts.3x.html">form_opts()</A></EM></span> - <b>pragma</b> Inline (Get_Options); - -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page <A HREF="../man/form_post.3x.html">form_post.3x</A></EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_52"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_676_14" HREF="terminal_interface-curses-forms__adb.htm#ref_913_14">Post</A></FONT> (<FONT COLOR=red><A NAME="ref_676_20" HREF="terminal_interface-curses-forms__adb.htm#ref_913_20">Frm</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -- <FONT COLOR=red><A NAME="ref_677_20" HREF="terminal_interface-curses-forms__adb.htm#ref_914_20">Post</A></FONT> : Boolean := True); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/form_post.3x.html">post_form()</A></EM></FONT> -- <FONT COLOR=green><EM>-- AKA: unpost_form()</EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses-forms__ads.htm#ref_676_14">Post</A>); -- -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page <A HREF="../man/form_cursor.3x.html">form_cursor.3x</A></EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_53"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_687_14" HREF="terminal_interface-curses-forms__adb.htm#ref_939_14">Position_Cursor</A></FONT> (<FONT COLOR=red><A NAME="ref_687_31" HREF="terminal_interface-curses-forms__adb.htm#ref_939_31">Frm</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/form_cursor.3x.html">pos_form_cursor()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses-forms__ads.htm#ref_687_14">Position_Cursor</A>); -- -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page <A HREF="../man/form_data.3x.html">form_data.3x</A></EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_54"#2|</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_696_13" HREF="terminal_interface-curses-forms__adb.htm#ref_957_13">Data_Ahead</A></FONT> (<FONT COLOR=red><A NAME="ref_696_25" HREF="terminal_interface-curses-forms__adb.htm#ref_957_25">Frm</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>) <b>return</b> Boolean; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/form_data.3x.html">data_ahead()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses-forms__ads.htm#ref_696_13">Data_Ahead</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_55"#2|</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_701_13" HREF="terminal_interface-curses-forms__adb.htm#ref_973_13">Data_Behind</A></FONT> (<FONT COLOR=red><A NAME="ref_701_26" HREF="terminal_interface-curses-forms__adb.htm#ref_973_26">Frm</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>) <b>return</b> Boolean; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/form_data.3x.html">data_behind()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses-forms__ads.htm#ref_701_13">Data_Behind</A>); -- -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page <A HREF="../man/form_driver.3x.html">form_driver.3x</A></EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- -- <b>type</b> <FONT COLOR=red><A NAME="ref_709_9">Driver_Result</A></FONT> <b>is</b> (<FONT COLOR=red><A NAME="ref_709_27">Form_Ok</A></FONT>, -- <FONT COLOR=red><A NAME="ref_710_27">Request_Denied</A></FONT>, -- <FONT COLOR=red><A NAME="ref_711_27">Unknown_Request</A></FONT>, -- <FONT COLOR=red><A NAME="ref_712_27">Invalid_Field</A></FONT>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_56"#2|</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_715_13" HREF="terminal_interface-curses-forms__adb.htm#ref_993_13">Driver</A></FONT> (<FONT COLOR=red><A NAME="ref_715_21" HREF="terminal_interface-curses-forms__adb.htm#ref_993_21">Frm</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -- <FONT COLOR=red><A NAME="ref_716_21" HREF="terminal_interface-curses-forms__adb.htm#ref_994_21">Key</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_68_9">Key_Code</A>) <b>return</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_709_9">Driver_Result</A>; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/form_driver.3x.html">form_driver()</A></EM></FONT> -- <FONT COLOR=green><EM>-- Driver not inlined</EM></FONT> -- -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page <A HREF="../man/form_page.3x.html">form_page.3x</A></EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- -- <b>type</b> <FONT COLOR=red><A NAME="ref_724_9">Page_Number</A></FONT> <b>is</b> <b>new</b> Natural; -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_57"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_727_14" HREF="terminal_interface-curses-forms__adb.htm#ref_1023_14">Set_Current</A></FONT> (<FONT COLOR=red><A NAME="ref_727_27" HREF="terminal_interface-curses-forms__adb.htm#ref_1023_27">Frm</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -- <FONT COLOR=red><A NAME="ref_728_27" HREF="terminal_interface-curses-forms__adb.htm#ref_1024_27">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/form_page.3x.html">set_current_field()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses-forms__ads.htm#ref_727_14">Set_Current</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_58"#2|</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_733_13" HREF="terminal_interface-curses-forms__adb.htm#ref_1038_13">Current</A></FONT> (<FONT COLOR=red><A NAME="ref_733_22" HREF="terminal_interface-curses-forms__adb.htm#ref_1038_22">Frm</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>) <b>return</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/form_page.3x.html">current_field()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses-forms__ads.htm#ref_733_13">Current</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_59"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_738_14" HREF="terminal_interface-curses-forms__adb.htm#ref_1053_14">Set_Page</A></FONT> (<FONT COLOR=red><A NAME="ref_738_24" HREF="terminal_interface-curses-forms__adb.htm#ref_1053_24">Frm</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -- <FONT COLOR=red><A NAME="ref_739_24" HREF="terminal_interface-curses-forms__adb.htm#ref_1054_24">Page</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_724_9">Page_Number</A> := <A HREF="terminal_interface-curses-forms__ads.htm#ref_724_9">Page_Number</A>'First); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/form_page.3x.html">set_form_page()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses-forms__ads.htm#ref_738_14">Set_Page</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_60"#2|</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_744_13" HREF="terminal_interface-curses-forms__adb.htm#ref_1068_13">Page</A></FONT> (<FONT COLOR=red><A NAME="ref_744_19" HREF="terminal_interface-curses-forms__adb.htm#ref_1068_19">Frm</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>) <b>return</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_724_9">Page_Number</A>; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/form_page.3x.html">form_page()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses-forms__ads.htm#ref_744_13">Page</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_61"#2|</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_749_13" HREF="terminal_interface-curses-forms__adb.htm#ref_1082_13">Get_Index</A></FONT> (<FONT COLOR=red><A NAME="ref_749_24" HREF="terminal_interface-curses-forms__adb.htm#ref_1082_24">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>) <b>return</b> Positive; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/form_page.3x.html">field_index()</A></EM></FONT> -- <FONT COLOR=green><EM>-- Please note that in this binding we start the numbering of fields</EM></FONT> -- <FONT COLOR=green><EM>-- with 1. So this is number is one more than you get from the low</EM></FONT> -- <FONT COLOR=green><EM>-- level call.</EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses-forms__ads.htm#ref_749_13">Get_Index</A>); -- -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page <A HREF="../man/form_new_page.3x.html">form_new_page.3x</A></EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_62"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_761_14" HREF="terminal_interface-curses-forms__adb.htm#ref_1102_14">Set_New_Page</A></FONT> (<FONT COLOR=red><A NAME="ref_761_28" HREF="terminal_interface-curses-forms__adb.htm#ref_1102_28">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_762_28" HREF="terminal_interface-curses-forms__adb.htm#ref_1103_28">New_Page</A></FONT> : Boolean := True); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/form_new_page.3x.html">set_new_page()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses-forms__ads.htm#ref_761_14">Set_New_Page</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_63"#2|</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_767_13" HREF="terminal_interface-curses-forms__adb.htm#ref_1117_13">Is_New_Page</A></FONT> (<FONT COLOR=red><A NAME="ref_767_26" HREF="terminal_interface-curses-forms__adb.htm#ref_1117_26">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>) <b>return</b> Boolean; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/form_new_page.3x.html">new_page()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses-forms__ads.htm#ref_767_13">Is_New_Page</A>); -- -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page <A HREF="../man/form_requestname.3x.html">form_requestname.3x</A></EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- Not Implemented: form_request_name, form_request_by_name</EM></FONT> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page <A HREF="../man/form_post.3x.html">form_post.3x</A></EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_52"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_674_14" HREF="terminal_interface-curses-forms__adb.htm#ref_913_14">Post</A></span> (<span class="symbol"><A NAME="ref_674_20" HREF="terminal_interface-curses-forms__adb.htm#ref_913_20">Frm</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -+ <span class="symbol"><A NAME="ref_675_20" HREF="terminal_interface-curses-forms__adb.htm#ref_914_20">Post</A></span> : Boolean := True); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/form_post.3x.html">post_form()</A></EM></span> -+ <span class="comment"><EM>-- AKA: unpost_form()</EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses-forms__ads.htm#ref_674_14">Post</A>); -+ -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page <A HREF="../man/form_cursor.3x.html">form_cursor.3x</A></EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_53"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_685_14" HREF="terminal_interface-curses-forms__adb.htm#ref_939_14">Position_Cursor</A></span> (<span class="symbol"><A NAME="ref_685_31" HREF="terminal_interface-curses-forms__adb.htm#ref_939_31">Frm</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/form_cursor.3x.html">pos_form_cursor()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses-forms__ads.htm#ref_685_14">Position_Cursor</A>); -+ -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page <A HREF="../man/form_data.3x.html">form_data.3x</A></EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_54"#2|</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_694_13" HREF="terminal_interface-curses-forms__adb.htm#ref_957_13">Data_Ahead</A></span> (<span class="symbol"><A NAME="ref_694_25" HREF="terminal_interface-curses-forms__adb.htm#ref_957_25">Frm</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>) <b>return</b> Boolean; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/form_data.3x.html">data_ahead()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses-forms__ads.htm#ref_694_13">Data_Ahead</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_55"#2|</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_699_13" HREF="terminal_interface-curses-forms__adb.htm#ref_973_13">Data_Behind</A></span> (<span class="symbol"><A NAME="ref_699_26" HREF="terminal_interface-curses-forms__adb.htm#ref_973_26">Frm</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>) <b>return</b> Boolean; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/form_data.3x.html">data_behind()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses-forms__ads.htm#ref_699_13">Data_Behind</A>); -+ -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page <A HREF="../man/form_driver.3x.html">form_driver.3x</A></EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ -+ <b>type</b> <span class="symbol"><A NAME="ref_707_9">Driver_Result</A></span> <b>is</b> (<span class="symbol"><A NAME="ref_707_27">Form_Ok</A></span>, -+ <span class="symbol"><A NAME="ref_708_27">Request_Denied</A></span>, -+ <span class="symbol"><A NAME="ref_709_27">Unknown_Request</A></span>, -+ <span class="symbol"><A NAME="ref_710_27">Invalid_Field</A></span>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_56"#2|</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_713_13" HREF="terminal_interface-curses-forms__adb.htm#ref_993_13">Driver</A></span> (<span class="symbol"><A NAME="ref_713_21" HREF="terminal_interface-curses-forms__adb.htm#ref_993_21">Frm</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -+ <span class="symbol"><A NAME="ref_714_21" HREF="terminal_interface-curses-forms__adb.htm#ref_994_21">Key</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_68_9">Key_Code</A>) <b>return</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_707_9">Driver_Result</A>; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/form_driver.3x.html">form_driver()</A></EM></span> -+ <span class="comment"><EM>-- Driver not inlined</EM></span> -+ -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page <A HREF="../man/form_page.3x.html">form_page.3x</A></EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ -+ <b>type</b> <span class="symbol"><A NAME="ref_722_9">Page_Number</A></span> <b>is</b> <b>new</b> Natural; -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_57"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_725_14" HREF="terminal_interface-curses-forms__adb.htm#ref_1023_14">Set_Current</A></span> (<span class="symbol"><A NAME="ref_725_27" HREF="terminal_interface-curses-forms__adb.htm#ref_1023_27">Frm</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -+ <span class="symbol"><A NAME="ref_726_27" HREF="terminal_interface-curses-forms__adb.htm#ref_1024_27">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/form_page.3x.html">set_current_field()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses-forms__ads.htm#ref_725_14">Set_Current</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_58"#2|</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_731_13" HREF="terminal_interface-curses-forms__adb.htm#ref_1038_13">Current</A></span> (<span class="symbol"><A NAME="ref_731_22" HREF="terminal_interface-curses-forms__adb.htm#ref_1038_22">Frm</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>) <b>return</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/form_page.3x.html">current_field()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses-forms__ads.htm#ref_731_13">Current</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_59"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_736_14" HREF="terminal_interface-curses-forms__adb.htm#ref_1053_14">Set_Page</A></span> (<span class="symbol"><A NAME="ref_736_24" HREF="terminal_interface-curses-forms__adb.htm#ref_1053_24">Frm</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -+ <span class="symbol"><A NAME="ref_737_24" HREF="terminal_interface-curses-forms__adb.htm#ref_1054_24">Page</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_722_9">Page_Number</A> := <A HREF="terminal_interface-curses-forms__ads.htm#ref_722_9">Page_Number</A>'First); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/form_page.3x.html">set_form_page()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses-forms__ads.htm#ref_736_14">Set_Page</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_60"#2|</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_742_13" HREF="terminal_interface-curses-forms__adb.htm#ref_1068_13">Page</A></span> (<span class="symbol"><A NAME="ref_742_19" HREF="terminal_interface-curses-forms__adb.htm#ref_1068_19">Frm</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>) <b>return</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_722_9">Page_Number</A>; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/form_page.3x.html">form_page()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses-forms__ads.htm#ref_742_13">Page</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_61"#2|</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_747_13" HREF="terminal_interface-curses-forms__adb.htm#ref_1082_13">Get_Index</A></span> (<span class="symbol"><A NAME="ref_747_24" HREF="terminal_interface-curses-forms__adb.htm#ref_1082_24">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>) <b>return</b> Positive; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/form_page.3x.html">field_index()</A></EM></span> -+ <span class="comment"><EM>-- Please note that in this binding we start the numbering of fields</EM></span> -+ <span class="comment"><EM>-- with 1. So this is number is one more than you get from the low</EM></span> -+ <span class="comment"><EM>-- level call.</EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses-forms__ads.htm#ref_747_13">Get_Index</A>); -+ -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page <A HREF="../man/form_new_page.3x.html">form_new_page.3x</A></EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_62"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_759_14" HREF="terminal_interface-curses-forms__adb.htm#ref_1102_14">Set_New_Page</A></span> (<span class="symbol"><A NAME="ref_759_28" HREF="terminal_interface-curses-forms__adb.htm#ref_1102_28">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_760_28" HREF="terminal_interface-curses-forms__adb.htm#ref_1103_28">New_Page</A></span> : Boolean := True); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/form_new_page.3x.html">set_new_page()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses-forms__ads.htm#ref_759_14">Set_New_Page</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_63"#2|</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_765_13" HREF="terminal_interface-curses-forms__adb.htm#ref_1117_13">Is_New_Page</A></span> (<span class="symbol"><A NAME="ref_765_26" HREF="terminal_interface-curses-forms__adb.htm#ref_1117_26">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>) <b>return</b> Boolean; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/form_new_page.3x.html">new_page()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses-forms__ads.htm#ref_765_13">Is_New_Page</A>); -+ -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page <A HREF="../man/form_requestname.3x.html">form_requestname.3x</A></EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- Not Implemented: form_request_name, form_request_by_name</EM></span> - --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> - <b>private</b> - <b>type</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A> <b>is</b> <b>new</b> System.Storage_Elements.Integer_Address; - <b>type</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A> <b>is</b> <b>new</b> System.Storage_Elements.Integer_Address; -diff -Naur ncurses-5.9/doc/html/ada/terminal_interface-curses-forms-field_types__adb.htm ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-forms-field_types__adb.htm ---- ncurses-5.9/doc/html/ada/terminal_interface-curses-forms-field_types__adb.htm 2011-03-26 22:54:29.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-forms-field_types__adb.htm 2014-09-01 16:33:22.280791996 +0200 -@@ -1,81 +1,93 @@ --<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> --<HTML><HEAD><TITLE>terminal_interface-curses-forms-field_types.adb</TITLE></HEAD> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> -+<HTML> -+<HEAD> -+<TITLE>terminal_interface-curses-forms-field_types.adb</TITLE> -+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> -+<style type="text/css"> -+*.comment { -+ color: green; -+} -+*.symbol { -+ color: red; -+} -+</style> -+</HEAD> - <BODY> --<HR><DIV ALIGN="center"><H1> File : terminal_interface-curses-forms-field_types.adb </H1></DIV><HR> -+<HR><DIV style="text-align:center"><H1> File : terminal_interface-curses-forms-field_types.adb </H1></DIV><HR> - <PRE> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Terminal_Interface.Curses.Forms.Field_Types --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- B O D Y --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Copyright (c) 1998-2009,2011 Free Software Foundation, Inc. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></FONT> --<FONT COLOR=green><EM>-- copy of this software and associated documentation files (the --</EM></FONT> --<FONT COLOR=green><EM>-- "Software"), to deal in the Software without restriction, including --</EM></FONT> --<FONT COLOR=green><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></FONT> --<FONT COLOR=green><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></FONT> --<FONT COLOR=green><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></FONT> --<FONT COLOR=green><EM>-- furnished to do so, subject to the following conditions: --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- The above copyright notice and this permission notice shall be included --</EM></FONT> --<FONT COLOR=green><EM>-- in all copies or substantial portions of the Software. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></FONT> --<FONT COLOR=green><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></FONT> --<FONT COLOR=green><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></FONT> --<FONT COLOR=green><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></FONT> --<FONT COLOR=green><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></FONT> --<FONT COLOR=green><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></FONT> --<FONT COLOR=green><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></FONT> --<FONT COLOR=green><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></FONT> --<FONT COLOR=green><EM>-- sale, use or other dealings in this Software without prior written --</EM></FONT> --<FONT COLOR=green><EM>-- authorization. --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Author: Juergen Pfeifer, 1996</EM></FONT> --<FONT COLOR=green><EM>-- Version Control:</EM></FONT> --<FONT COLOR=green><EM>-- @Revision: 1.25 @</EM></FONT> --<FONT COLOR=green><EM>-- @Date: 2011/03/22 23:22:27 @</EM></FONT> --<FONT COLOR=green><EM>-- Binding Version 01.00</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Terminal_Interface.Curses.Forms.Field_Types --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- B O D Y --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Copyright (c) 1998-2009,2011 Free Software Foundation, Inc. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></span> -+<span class="comment"><EM>-- copy of this software and associated documentation files (the --</EM></span> -+<span class="comment"><EM>-- "Software"), to deal in the Software without restriction, including --</EM></span> -+<span class="comment"><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></span> -+<span class="comment"><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></span> -+<span class="comment"><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></span> -+<span class="comment"><EM>-- furnished to do so, subject to the following conditions: --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- The above copyright notice and this permission notice shall be included --</EM></span> -+<span class="comment"><EM>-- in all copies or substantial portions of the Software. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></span> -+<span class="comment"><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></span> -+<span class="comment"><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></span> -+<span class="comment"><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></span> -+<span class="comment"><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></span> -+<span class="comment"><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></span> -+<span class="comment"><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></span> -+<span class="comment"><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></span> -+<span class="comment"><EM>-- sale, use or other dealings in this Software without prior written --</EM></span> -+<span class="comment"><EM>-- authorization. --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Author: Juergen Pfeifer, 1996</EM></span> -+<span class="comment"><EM>-- Version Control:</EM></span> -+<span class="comment"><EM>-- @Revision: 1.25 @</EM></span> -+<span class="comment"><EM>-- @Date: 2011/03/22 23:22:27 @</EM></span> -+<span class="comment"><EM>-- Binding Version 01.00</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> - <b>with</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-aux__ads.htm#ref_50_35">Aux</A>; <b>use</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-aux__ads.htm#ref_50_35">Aux</A>; - <b>with</b> Ada.Unchecked_Deallocation; - <b>with</b> System.Address_To_Access_Conversions; - --<FONT COLOR=green><EM>-- |</EM></FONT> --<FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> --<FONT COLOR=green><EM>-- | man page form_fieldtype.3x</EM></FONT> --<FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> --<FONT COLOR=green><EM>-- |</EM></FONT> --<b>package</b> <b>body</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-forms__ads.htm#ref_49_35">Forms</A>.<FONT COLOR=red><A NAME="ref_51_46" HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_43_41">Field_Types</A></FONT> <b>is</b> -+<span class="comment"><EM>-- |</EM></span> -+<span class="comment"><EM>-- |=====================================================================</EM></span> -+<span class="comment"><EM>-- | man page form_fieldtype.3x</EM></span> -+<span class="comment"><EM>-- |=====================================================================</EM></span> -+<span class="comment"><EM>-- |</EM></span> -+<b>package</b> <b>body</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-forms__ads.htm#ref_49_35">Forms</A>.<span class="symbol"><A NAME="ref_51_46" HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_43_41">Field_Types</A></span> <b>is</b> - - <b>use</b> <b>type</b> System.Address; - - <b>package</b> Argument_Conversions <b>is</b> - <b>new</b> System.Address_To_Access_Conversions (<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_211_9">Argument</A>); - -- <b>function</b> <FONT COLOR=red><A NAME="ref_58_13">Get_Fieldtype</A></FONT> (<FONT COLOR=red><A NAME="ref_58_28" HREF="terminal_interface-curses-forms-field_types__adb.htm#ref_58_13">F</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>) <b>return</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_132_9">C_Field_Type</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_58_13">Get_Fieldtype</A></span> (<span class="symbol"><A NAME="ref_58_28" HREF="terminal_interface-curses-forms-field_types__adb.htm#ref_58_13">F</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>) <b>return</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_132_9">C_Field_Type</A>; - <b>pragma</b> Import (C, Get_Fieldtype, "field_type"); - -- <b>function</b> <FONT COLOR=red><A NAME="ref_61_13">Get_Arg</A></FONT> (<FONT COLOR=red><A NAME="ref_61_22" HREF="terminal_interface-curses-forms-field_types__adb.htm#ref_61_13">F</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>) <b>return</b> System.Address; -+ <b>function</b> <span class="symbol"><A NAME="ref_61_13">Get_Arg</A></span> (<span class="symbol"><A NAME="ref_61_22" HREF="terminal_interface-curses-forms-field_types__adb.htm#ref_61_13">F</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>) <b>return</b> System.Address; - <b>pragma</b> Import (C, Get_Arg, "field_arg"); -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | man page form_field_validation.3x</EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_70_13" HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_79_13">Get_Type</A></FONT> (<FONT COLOR=red><A NAME="ref_70_23" HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_79_23">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>) <b>return</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_63_9">Field_Type_Access</A> -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | man page form_field_validation.3x</EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_70_13" HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_79_13">Get_Type</A></span> (<span class="symbol"><A NAME="ref_70_23" HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_79_23">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>) <b>return</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_63_9">Field_Type_Access</A> - <b>is</b> -- <FONT COLOR=red><A NAME="ref_72_7">Low_Level</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_132_9">C_Field_Type</A> := <A HREF="terminal_interface-curses-forms-field_types__adb.htm#ref_58_13">Get_Fieldtype</A> (<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_79_23">Fld</A>); -- <FONT COLOR=red><A NAME="ref_73_7">Arg</A></FONT> : <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_216_9">Argument_Access</A>; -+ <span class="symbol"><A NAME="ref_72_7">Low_Level</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_132_9">C_Field_Type</A> := <A HREF="terminal_interface-curses-forms-field_types__adb.htm#ref_58_13">Get_Fieldtype</A> (<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_79_23">Fld</A>); -+ <span class="symbol"><A NAME="ref_73_7">Arg</A></span> : <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_216_9">Argument_Access</A>; - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses-forms-field_types__adb.htm#ref_72_7">Low_Level</A> = <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_134_4">Null_Field_Type</A> <b>then</b> - <b>return</b> <b>null</b>; -@@ -87,32 +99,32 @@ - <A HREF="terminal_interface-curses-forms-field_types__adb.htm#ref_73_7">Arg</A> := <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_216_9">Argument_Access</A> - (Argument_Conversions.To_Pointer (<A HREF="terminal_interface-curses-forms-field_types__adb.htm#ref_61_13">Get_Arg</A> (<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_79_23">Fld</A>))); - <b>if</b> <A HREF="terminal_interface-curses-forms-field_types__adb.htm#ref_73_7">Arg</A> = <b>null</b> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_290_4">Form_Exception</A>; -+ <b>raise</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_288_4">Form_Exception</A>; - <b>else</b> - <b>return</b> <A HREF="terminal_interface-curses-forms-field_types__adb.htm#ref_73_7">Arg</A>.<b>all</b>.<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_212_7">Typ</A>; - <b>end</b> <b>if</b>; - <b>else</b> -- <b>raise</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_290_4">Form_Exception</A>; -+ <b>raise</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_288_4">Form_Exception</A>; - <b>end</b> <b>if</b>; - <b>end</b> <b>if</b>; - <b>end</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_79_13">Get_Type</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_95_13" HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_167_13">Copy_Arg</A></FONT> (<FONT COLOR=red><A NAME="ref_95_23" HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_167_23">Usr</A></FONT> : System.Address) <b>return</b> System.Address -+ <b>function</b> <span class="symbol"><A NAME="ref_95_13" HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_167_13">Copy_Arg</A></span> (<span class="symbol"><A NAME="ref_95_23" HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_167_23">Usr</A></span> : System.Address) <b>return</b> System.Address - <b>is</b> - <b>begin</b> - <b>return</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_167_23">Usr</A>; - <b>end</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_167_13">Copy_Arg</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_101_14" HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_172_14">Free_Arg</A></FONT> (<FONT COLOR=red><A NAME="ref_101_24" HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_172_24">Usr</A></FONT> : System.Address) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_101_14" HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_172_14">Free_Arg</A></span> (<span class="symbol"><A NAME="ref_101_24" HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_172_24">Usr</A></span> : System.Address) - <b>is</b> - <b>procedure</b> Free_Type <b>is</b> <b>new</b> Ada.Unchecked_Deallocation - (<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_52_9">Field_Type</A>'Class, <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_63_9">Field_Type_Access</A>); - <b>procedure</b> Freeargs <b>is</b> <b>new</b> Ada.Unchecked_Deallocation - (<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_211_9">Argument</A>, <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_216_9">Argument_Access</A>); - -- <FONT COLOR=red><A NAME="ref_108_7">To_Be_Free</A></FONT> : <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_216_9">Argument_Access</A> -+ <span class="symbol"><A NAME="ref_108_7">To_Be_Free</A></span> : <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_216_9">Argument_Access</A> - := <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_216_9">Argument_Access</A> (Argument_Conversions.To_Pointer (<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_172_24">Usr</A>)); -- <FONT COLOR=red><A NAME="ref_110_7">Low_Level</A></FONT> : <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_132_9">C_Field_Type</A>; -+ <span class="symbol"><A NAME="ref_110_7">Low_Level</A></span> : <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_132_9">C_Field_Type</A>; - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses-forms-field_types__adb.htm#ref_108_7">To_Be_Free</A> /= <b>null</b> <b>then</b> - <b>if</b> <A HREF="terminal_interface-curses-forms-field_types__adb.htm#ref_108_7">To_Be_Free</A>.<b>all</b>.<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_213_7">Usr</A> /= System.Null_Address <b>then</b> -@@ -128,23 +140,23 @@ - <b>end</b> <b>if</b>; - <b>end</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_172_14">Free_Arg</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_126_14" HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_151_14">Wrap_Builtin</A></FONT> (<FONT COLOR=red><A NAME="ref_126_28" HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_151_28">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_127_28" HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_152_28">Typ</A></FONT> : <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_52_9">Field_Type</A>'Class; -- <FONT COLOR=red><A NAME="ref_128_28" HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_153_28">Cft</A></FONT> : <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_132_9">C_Field_Type</A> := <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_148_13">C_Builtin_Router</A>) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_126_14" HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_151_14">Wrap_Builtin</A></span> (<span class="symbol"><A NAME="ref_126_28" HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_151_28">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_127_28" HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_152_28">Typ</A></span> : <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_52_9">Field_Type</A>'Class; -+ <span class="symbol"><A NAME="ref_128_28" HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_153_28">Cft</A></span> : <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_132_9">C_Field_Type</A> := <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_148_13">C_Builtin_Router</A>) - <b>is</b> -- <FONT COLOR=red><A NAME="ref_130_7">Usr_Arg</A></FONT> : <b>constant</b> System.Address := <A HREF="terminal_interface-curses-forms-field_types__adb.htm#ref_61_13">Get_Arg</A> (<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_151_28">Fld</A>); -- <FONT COLOR=red><A NAME="ref_131_7">Low_Level</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_132_9">C_Field_Type</A> := <A HREF="terminal_interface-curses-forms-field_types__adb.htm#ref_58_13">Get_Fieldtype</A> (<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_151_28">Fld</A>); -- <FONT COLOR=red><A NAME="ref_132_7">Arg</A></FONT> : <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_216_9">Argument_Access</A>; -- <FONT COLOR=red><A NAME="ref_133_7">Res</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A>; -- <b>function</b> <FONT COLOR=red><A NAME="ref_134_16">Set_Fld_Type</A></FONT> (<FONT COLOR=red><A NAME="ref_134_30" HREF="terminal_interface-curses-forms-field_types__adb.htm#ref_134_16">F</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A> := <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_151_28">Fld</A>; -- <FONT COLOR=red><A NAME="ref_135_30" HREF="terminal_interface-curses-forms-field_types__adb.htm#ref_134_16">Cf</A></FONT> : <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_132_9">C_Field_Type</A> := <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_153_28">Cft</A>; -- <FONT COLOR=red><A NAME="ref_136_30" HREF="terminal_interface-curses-forms-field_types__adb.htm#ref_134_16">Arg1</A></FONT> : <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_216_9">Argument_Access</A>) <b>return</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_46_12">C_Int</A>; -+ <span class="symbol"><A NAME="ref_130_7">Usr_Arg</A></span> : <b>constant</b> System.Address := <A HREF="terminal_interface-curses-forms-field_types__adb.htm#ref_61_13">Get_Arg</A> (<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_151_28">Fld</A>); -+ <span class="symbol"><A NAME="ref_131_7">Low_Level</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_132_9">C_Field_Type</A> := <A HREF="terminal_interface-curses-forms-field_types__adb.htm#ref_58_13">Get_Fieldtype</A> (<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_151_28">Fld</A>); -+ <span class="symbol"><A NAME="ref_132_7">Arg</A></span> : <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_216_9">Argument_Access</A>; -+ <span class="symbol"><A NAME="ref_133_7">Res</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_134_16">Set_Fld_Type</A></span> (<span class="symbol"><A NAME="ref_134_30" HREF="terminal_interface-curses-forms-field_types__adb.htm#ref_134_16">F</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A> := <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_151_28">Fld</A>; -+ <span class="symbol"><A NAME="ref_135_30" HREF="terminal_interface-curses-forms-field_types__adb.htm#ref_134_16">Cf</A></span> : <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_132_9">C_Field_Type</A> := <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_153_28">Cft</A>; -+ <span class="symbol"><A NAME="ref_136_30" HREF="terminal_interface-curses-forms-field_types__adb.htm#ref_134_16">Arg1</A></span> : <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_216_9">Argument_Access</A>) <b>return</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_46_12">C_Int</A>; - <b>pragma</b> Import (C, Set_Fld_Type, "set_field_type_user"); - - <b>begin</b> - <b>pragma</b> Assert (<A HREF="terminal_interface-curses-forms-field_types__adb.htm#ref_131_7">Low_Level</A> /= <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_134_4">Null_Field_Type</A>); - <b>if</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_153_28">Cft</A> /= <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_148_13">C_Builtin_Router</A> <b>and</b> <b>then</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_153_28">Cft</A> /= <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_149_13">C_Choice_Router</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_290_4">Form_Exception</A>; -+ <b>raise</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_288_4">Form_Exception</A>; - <b>else</b> - <A HREF="terminal_interface-curses-forms-field_types__adb.htm#ref_132_7">Arg</A> := <b>new</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_211_9">Argument</A>'(<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_213_7">Usr</A> =&gt; System.Null_Address, - <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_212_7">Typ</A> =&gt; <b>new</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_52_9">Field_Type</A>'Class'(<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_152_28">Typ</A>), -@@ -164,10 +176,10 @@ - <b>end</b> <b>if</b>; - <b>end</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_151_14">Wrap_Builtin</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_162_13" HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_177_13">Field_Check_Router</A></FONT> (<FONT COLOR=red><A NAME="ref_162_33" HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_177_33">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_163_33" HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_178_33">Usr</A></FONT> : System.Address) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_1926_9">Curses_Bool</A> -+ <b>function</b> <span class="symbol"><A NAME="ref_162_13" HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_177_13">Field_Check_Router</A></span> (<span class="symbol"><A NAME="ref_162_33" HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_177_33">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_163_33" HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_178_33">Usr</A></span> : System.Address) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_1925_9">Curses_Bool</A> - <b>is</b> -- <FONT COLOR=red><A NAME="ref_165_7">Arg</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_216_9">Argument_Access</A> -+ <span class="symbol"><A NAME="ref_165_7">Arg</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_216_9">Argument_Access</A> - := <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_216_9">Argument_Access</A> (Argument_Conversions.To_Pointer (<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_178_33">Usr</A>)); - <b>begin</b> - <b>pragma</b> Assert (<A HREF="terminal_interface-curses-forms-field_types__adb.htm#ref_165_7">Arg</A> /= <b>null</b> <b>and</b> <b>then</b> <A HREF="terminal_interface-curses-forms-field_types__adb.htm#ref_165_7">Arg</A>.<b>all</b>.<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_214_7">Cft</A> /= <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_134_4">Null_Field_Type</A> -@@ -179,10 +191,10 @@ - <b>end</b> <b>if</b>; - <b>end</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_177_13">Field_Check_Router</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_177_13" HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_185_13">Char_Check_Router</A></FONT> (<FONT COLOR=red><A NAME="ref_177_32" HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_185_32">Ch</A></FONT> : <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_46_12">C_Int</A>; -- <FONT COLOR=red><A NAME="ref_178_32" HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_186_32">Usr</A></FONT> : System.Address) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_1926_9">Curses_Bool</A> -+ <b>function</b> <span class="symbol"><A NAME="ref_177_13" HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_185_13">Char_Check_Router</A></span> (<span class="symbol"><A NAME="ref_177_32" HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_185_32">Ch</A></span> : <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_46_12">C_Int</A>; -+ <span class="symbol"><A NAME="ref_178_32" HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_186_32">Usr</A></span> : System.Address) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_1925_9">Curses_Bool</A> - <b>is</b> -- <FONT COLOR=red><A NAME="ref_180_7">Arg</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_216_9">Argument_Access</A> -+ <span class="symbol"><A NAME="ref_180_7">Arg</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_216_9">Argument_Access</A> - := <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_216_9">Argument_Access</A> (Argument_Conversions.To_Pointer (<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_186_32">Usr</A>)); - <b>begin</b> - <b>pragma</b> Assert (<A HREF="terminal_interface-curses-forms-field_types__adb.htm#ref_180_7">Arg</A> /= <b>null</b> <b>and</b> <b>then</b> <A HREF="terminal_interface-curses-forms-field_types__adb.htm#ref_180_7">Arg</A>.<b>all</b>.<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_214_7">Cft</A> /= <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_134_4">Null_Field_Type</A> -@@ -194,10 +206,10 @@ - <b>end</b> <b>if</b>; - <b>end</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_185_13">Char_Check_Router</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_192_13" HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_193_13">Next_Router</A></FONT> (<FONT COLOR=red><A NAME="ref_192_26" HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_193_26">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_193_26" HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_194_26">Usr</A></FONT> : System.Address) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_1926_9">Curses_Bool</A> -+ <b>function</b> <span class="symbol"><A NAME="ref_192_13" HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_193_13">Next_Router</A></span> (<span class="symbol"><A NAME="ref_192_26" HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_193_26">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_193_26" HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_194_26">Usr</A></span> : System.Address) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_1925_9">Curses_Bool</A> - <b>is</b> -- <FONT COLOR=red><A NAME="ref_195_7">Arg</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_216_9">Argument_Access</A> -+ <span class="symbol"><A NAME="ref_195_7">Arg</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_216_9">Argument_Access</A> - := <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_216_9">Argument_Access</A> (Argument_Conversions.To_Pointer (<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_194_26">Usr</A>)); - <b>begin</b> - <b>pragma</b> Assert (<A HREF="terminal_interface-curses-forms-field_types__adb.htm#ref_195_7">Arg</A> /= <b>null</b> <b>and</b> <b>then</b> <A HREF="terminal_interface-curses-forms-field_types__adb.htm#ref_195_7">Arg</A>.<b>all</b>.<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_214_7">Cft</A> /= <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_134_4">Null_Field_Type</A> -@@ -209,10 +221,10 @@ - <b>end</b> <b>if</b>; - <b>end</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_193_13">Next_Router</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_207_13" HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_201_13">Prev_Router</A></FONT> (<FONT COLOR=red><A NAME="ref_207_26" HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_201_26">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_208_26" HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_202_26">Usr</A></FONT> : System.Address) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_1926_9">Curses_Bool</A> -+ <b>function</b> <span class="symbol"><A NAME="ref_207_13" HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_201_13">Prev_Router</A></span> (<span class="symbol"><A NAME="ref_207_26" HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_201_26">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_208_26" HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_202_26">Usr</A></span> : System.Address) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_1925_9">Curses_Bool</A> - <b>is</b> -- <FONT COLOR=red><A NAME="ref_210_7">Arg</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_216_9">Argument_Access</A> := -+ <span class="symbol"><A NAME="ref_210_7">Arg</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_216_9">Argument_Access</A> := - <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_216_9">Argument_Access</A> (Argument_Conversions.To_Pointer (<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_202_26">Usr</A>)); - <b>begin</b> - <b>pragma</b> Assert (<A HREF="terminal_interface-curses-forms-field_types__adb.htm#ref_210_7">Arg</A> /= <b>null</b> <b>and</b> <b>then</b> <A HREF="terminal_interface-curses-forms-field_types__adb.htm#ref_210_7">Arg</A>.<b>all</b>.<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_214_7">Cft</A> /= <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_134_4">Null_Field_Type</A> -@@ -224,18 +236,18 @@ - <b>end</b> <b>if</b>; - <b>end</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_201_13">Prev_Router</A>; - -- <FONT COLOR=green><EM>-- -----------------------------------------------------------------------</EM></FONT> -- <FONT COLOR=green><EM>--</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_224_13" HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_148_13">C_Builtin_Router</A></FONT> <b>return</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_132_9">C_Field_Type</A> -+ <span class="comment"><EM>-- -----------------------------------------------------------------------</EM></span> -+ <span class="comment"><EM>--</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_224_13" HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_148_13">C_Builtin_Router</A></span> <b>return</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_132_9">C_Field_Type</A> - <b>is</b> -- <FONT COLOR=red><A NAME="ref_226_7">Res</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A>; -- <FONT COLOR=red><A NAME="ref_227_7">T</A></FONT> : <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_132_9">C_Field_Type</A>; -+ <span class="symbol"><A NAME="ref_226_7">Res</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A>; -+ <span class="symbol"><A NAME="ref_227_7">T</A></span> : <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_132_9">C_Field_Type</A>; - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_143_4">M_Builtin_Router</A> = <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_134_4">Null_Field_Type</A> <b>then</b> - <A HREF="terminal_interface-curses-forms-field_types__adb.htm#ref_227_7">T</A> := <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_222_13">New_Fieldtype</A> (<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_177_13">Field_Check_Router</A>'<b>Access</b>, - <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_185_13">Char_Check_Router</A>'<b>Access</b>); - <b>if</b> <A HREF="terminal_interface-curses-forms-field_types__adb.htm#ref_227_7">T</A> = <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_134_4">Null_Field_Type</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_290_4">Form_Exception</A>; -+ <b>raise</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_288_4">Form_Exception</A>; - <b>else</b> - <A HREF="terminal_interface-curses-forms-field_types__adb.htm#ref_226_7">Res</A> := <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_227_13">Set_Fieldtype_Arg</A> (<A HREF="terminal_interface-curses-forms-field_types__adb.htm#ref_227_7">T</A>, - <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_162_13">Make_Arg</A>'<b>Access</b>, -@@ -251,18 +263,18 @@ - <b>return</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_143_4">M_Builtin_Router</A>; - <b>end</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_148_13">C_Builtin_Router</A>; - -- <FONT COLOR=green><EM>-- -----------------------------------------------------------------------</EM></FONT> -- <FONT COLOR=green><EM>--</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_251_13" HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_149_13">C_Choice_Router</A></FONT> <b>return</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_132_9">C_Field_Type</A> -+ <span class="comment"><EM>-- -----------------------------------------------------------------------</EM></span> -+ <span class="comment"><EM>--</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_251_13" HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_149_13">C_Choice_Router</A></span> <b>return</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_132_9">C_Field_Type</A> - <b>is</b> -- <FONT COLOR=red><A NAME="ref_253_7">Res</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A>; -- <FONT COLOR=red><A NAME="ref_254_7">T</A></FONT> : <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_132_9">C_Field_Type</A>; -+ <span class="symbol"><A NAME="ref_253_7">Res</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A>; -+ <span class="symbol"><A NAME="ref_254_7">T</A></span> : <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_132_9">C_Field_Type</A>; - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_144_4">M_Choice_Router</A> = <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_134_4">Null_Field_Type</A> <b>then</b> - <A HREF="terminal_interface-curses-forms-field_types__adb.htm#ref_254_7">T</A> := <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_222_13">New_Fieldtype</A> (<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_177_13">Field_Check_Router</A>'<b>Access</b>, - <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_185_13">Char_Check_Router</A>'<b>Access</b>); - <b>if</b> <A HREF="terminal_interface-curses-forms-field_types__adb.htm#ref_254_7">T</A> = <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_134_4">Null_Field_Type</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_290_4">Form_Exception</A>; -+ <b>raise</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_288_4">Form_Exception</A>; - <b>else</b> - <A HREF="terminal_interface-curses-forms-field_types__adb.htm#ref_253_7">Res</A> := <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_227_13">Set_Fieldtype_Arg</A> (<A HREF="terminal_interface-curses-forms-field_types__adb.htm#ref_254_7">T</A>, - <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_162_13">Make_Arg</A>'<b>Access</b>, -diff -Naur ncurses-5.9/doc/html/ada/terminal_interface-curses-forms-field_types__ads.htm ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-forms-field_types__ads.htm ---- ncurses-5.9/doc/html/ada/terminal_interface-curses-forms-field_types__ads.htm 2011-03-26 22:54:29.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-forms-field_types__ads.htm 2014-09-01 16:33:22.281791998 +0200 -@@ -1,243 +1,255 @@ --<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> --<HTML><HEAD><TITLE>terminal_interface-curses-forms-field_types.ads</TITLE></HEAD> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> -+<HTML> -+<HEAD> -+<TITLE>terminal_interface-curses-forms-field_types.ads</TITLE> -+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> -+<style type="text/css"> -+*.comment { -+ color: green; -+} -+*.symbol { -+ color: red; -+} -+</style> -+</HEAD> - <BODY> --<HR><DIV ALIGN="center"><H1> File : terminal_interface-curses-forms-field_types.ads </H1></DIV><HR> -+<HR><DIV style="text-align:center"><H1> File : terminal_interface-curses-forms-field_types.ads </H1></DIV><HR> - <PRE> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Terminal_Interface.Curses.Forms.Field_Types --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- S P E C --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Copyright (c) 1998-2009,2011 Free Software Foundation, Inc. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></FONT> --<FONT COLOR=green><EM>-- copy of this software and associated documentation files (the --</EM></FONT> --<FONT COLOR=green><EM>-- "Software"), to deal in the Software without restriction, including --</EM></FONT> --<FONT COLOR=green><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></FONT> --<FONT COLOR=green><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></FONT> --<FONT COLOR=green><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></FONT> --<FONT COLOR=green><EM>-- furnished to do so, subject to the following conditions: --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- The above copyright notice and this permission notice shall be included --</EM></FONT> --<FONT COLOR=green><EM>-- in all copies or substantial portions of the Software. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></FONT> --<FONT COLOR=green><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></FONT> --<FONT COLOR=green><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></FONT> --<FONT COLOR=green><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></FONT> --<FONT COLOR=green><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></FONT> --<FONT COLOR=green><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></FONT> --<FONT COLOR=green><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></FONT> --<FONT COLOR=green><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></FONT> --<FONT COLOR=green><EM>-- sale, use or other dealings in this Software without prior written --</EM></FONT> --<FONT COLOR=green><EM>-- authorization. --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Author: Juergen Pfeifer, 1996</EM></FONT> --<FONT COLOR=green><EM>-- Version Control:</EM></FONT> --<FONT COLOR=green><EM>-- @Revision: 1.16 @</EM></FONT> --<FONT COLOR=green><EM>-- Binding Version 01.00</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<b>with</b> <A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>.C; -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Terminal_Interface.Curses.Forms.Field_Types --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- S P E C --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Copyright (c) 1998-2009,2011 Free Software Foundation, Inc. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></span> -+<span class="comment"><EM>-- copy of this software and associated documentation files (the --</EM></span> -+<span class="comment"><EM>-- "Software"), to deal in the Software without restriction, including --</EM></span> -+<span class="comment"><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></span> -+<span class="comment"><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></span> -+<span class="comment"><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></span> -+<span class="comment"><EM>-- furnished to do so, subject to the following conditions: --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- The above copyright notice and this permission notice shall be included --</EM></span> -+<span class="comment"><EM>-- in all copies or substantial portions of the Software. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></span> -+<span class="comment"><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></span> -+<span class="comment"><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></span> -+<span class="comment"><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></span> -+<span class="comment"><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></span> -+<span class="comment"><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></span> -+<span class="comment"><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></span> -+<span class="comment"><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></span> -+<span class="comment"><EM>-- sale, use or other dealings in this Software without prior written --</EM></span> -+<span class="comment"><EM>-- authorization. --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Author: Juergen Pfeifer, 1996</EM></span> -+<span class="comment"><EM>-- Version Control:</EM></span> -+<span class="comment"><EM>-- @Revision: 1.17 @</EM></span> -+<span class="comment"><EM>-- Binding Version 01.00</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<b>with</b> <A HREF="interfac__ads.htm#ref_36_9">Interfaces</A>.C; - --<b>package</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-forms__ads.htm#ref_49_35">Forms</A>.<FONT COLOR=red><A NAME="ref_43_41" HREF="terminal_interface-curses-forms-field_types__adb.htm#ref_51_46">Field_Types</A></FONT> <b>is</b> -+<b>package</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-forms__ads.htm#ref_49_35">Forms</A>.<span class="symbol"><A NAME="ref_43_41" HREF="terminal_interface-curses-forms-field_types__adb.htm#ref_51_46">Field_Types</A></span> <b>is</b> - <b>pragma</b> Preelaborate (<A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-forms__ads.htm#ref_49_35">Forms</A>.<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_43_41">Field_Types</A>); -- <b>use</b> <b>type</b> <A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>.C.int; -- <b>subtype</b> <FONT COLOR=red><A NAME="ref_46_12">C_Int</A></FONT> <b>is</b> <A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>.C.int; -+ <b>use</b> <b>type</b> <A HREF="interfac__ads.htm#ref_36_9">Interfaces</A>.C.int; -+ <b>subtype</b> <span class="symbol"><A NAME="ref_46_12">C_Int</A></span> <b>is</b> <A HREF="interfac__ads.htm#ref_36_9">Interfaces</A>.C.int; - -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page <A HREF="../man/form_fieldtype.3x.html">form_fieldtype.3x</A></EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- -- <b>type</b> <FONT COLOR=red><A NAME="ref_52_9">Field_Type</A></FONT> <b>is</b> <b>abstract</b> <b>tagged</b> <b>null</b> <b>record</b>; -- <FONT COLOR=green><EM>-- Abstract base type for all field types. A concrete field type</EM></FONT> -- <FONT COLOR=green><EM>-- is an extension that adds some data elements describing formats or</EM></FONT> -- <FONT COLOR=green><EM>-- boundary values for the type and validation routines.</EM></FONT> -- <FONT COLOR=green><EM>-- For the builtin low-level fieldtypes, the validation routines are</EM></FONT> -- <FONT COLOR=green><EM>-- already defined by the low-level C library.</EM></FONT> -- <FONT COLOR=green><EM>-- The builtin types like Alpha or AlphaNumeric etc. are defined in</EM></FONT> -- <FONT COLOR=green><EM>-- child packages of this package. You may use one of them as example</EM></FONT> -- <FONT COLOR=green><EM>-- how to create you own child packages for low-level field types that</EM></FONT> -- <FONT COLOR=green><EM>-- you may have already written in C.</EM></FONT> -- -- <b>type</b> <FONT COLOR=red><A NAME="ref_63_9">Field_Type_Access</A></FONT> <b>is</b> <b>access</b> <b>all</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_52_9">Field_Type</A>'Class; -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_1"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_66_14">Set_Field_Type</A></FONT> (<FONT COLOR=red><A NAME="ref_66_30" HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_66_14">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_67_30" HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_66_14">Fld_Type</A></FONT> : <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_52_9">Field_Type</A>) <b>is</b> <b>abstract</b>; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/form_fieldtype.3x.html">set_field_type()</A></EM></FONT> -- <FONT COLOR=green><EM>-- But: we hide the vararg mechanism of the C interface. You always</EM></FONT> -- <FONT COLOR=green><EM>-- have to pass a single Field_Type parameter.</EM></FONT> -- -- <FONT COLOR=green><EM>-- ---------------------------------------------------------------------</EM></FONT> -- -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page <A HREF="../man/form_field_validation.3x.html">form_field_validation.3x</A></EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_2"#2|</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_79_13" HREF="terminal_interface-curses-forms-field_types__adb.htm#ref_70_13">Get_Type</A></FONT> (<FONT COLOR=red><A NAME="ref_79_23" HREF="terminal_interface-curses-forms-field_types__adb.htm#ref_70_23">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>) <b>return</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_63_9">Field_Type_Access</A>; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/form_field_validation.3x.html">field_type()</A></EM></FONT> -- <FONT COLOR=green><EM>-- AKA: field_arg()</EM></FONT> -- <FONT COLOR=green><EM>-- In Ada95 we can combine these. If you try to retrieve the field type</EM></FONT> -- <FONT COLOR=green><EM>-- that is not defined as extension of the abstract tagged type above,</EM></FONT> -- <FONT COLOR=green><EM>-- you will raise a Form_Exception.</EM></FONT> -- <FONT COLOR=green><EM>-- This is not inlined</EM></FONT> -- -- <FONT COLOR=green><EM>-- +----------------------------------------------------------------------</EM></FONT> -- <FONT COLOR=green><EM>-- | Private Part.</EM></FONT> -- <FONT COLOR=green><EM>-- | Most of this is used by the implementations of the child packages.</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page <A HREF="../man/form_fieldtype.3x.html">form_fieldtype.3x</A></EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ -+ <b>type</b> <span class="symbol"><A NAME="ref_52_9">Field_Type</A></span> <b>is</b> <b>abstract</b> <b>tagged</b> <b>null</b> <b>record</b>; -+ <span class="comment"><EM>-- Abstract base type for all field types. A concrete field type</EM></span> -+ <span class="comment"><EM>-- is an extension that adds some data elements describing formats or</EM></span> -+ <span class="comment"><EM>-- boundary values for the type and validation routines.</EM></span> -+ <span class="comment"><EM>-- For the builtin low-level fieldtypes, the validation routines are</EM></span> -+ <span class="comment"><EM>-- already defined by the low-level C library.</EM></span> -+ <span class="comment"><EM>-- The builtin types like Alpha or AlphaNumeric etc. are defined in</EM></span> -+ <span class="comment"><EM>-- child packages of this package. You may use one of them as example</EM></span> -+ <span class="comment"><EM>-- how to create you own child packages for low-level field types that</EM></span> -+ <span class="comment"><EM>-- you may have already written in C.</EM></span> -+ -+ <b>type</b> <span class="symbol"><A NAME="ref_63_9">Field_Type_Access</A></span> <b>is</b> <b>access</b> <b>all</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_52_9">Field_Type</A>'Class; -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_1"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_66_14">Set_Field_Type</A></span> (<span class="symbol"><A NAME="ref_66_30" HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_66_14">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_67_30" HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_66_14">Fld_Type</A></span> : <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_52_9">Field_Type</A>) <b>is</b> <b>abstract</b>; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/form_fieldtype.3x.html">set_field_type()</A></EM></span> -+ <span class="comment"><EM>-- But: we hide the vararg mechanism of the C interface. You always</EM></span> -+ <span class="comment"><EM>-- have to pass a single Field_Type parameter.</EM></span> -+ -+ <span class="comment"><EM>-- ---------------------------------------------------------------------</EM></span> -+ -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page <A HREF="../man/form_field_validation.3x.html">form_field_validation.3x</A></EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_2"#2|</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_79_13" HREF="terminal_interface-curses-forms-field_types__adb.htm#ref_70_13">Get_Type</A></span> (<span class="symbol"><A NAME="ref_79_23" HREF="terminal_interface-curses-forms-field_types__adb.htm#ref_70_23">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>) <b>return</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_63_9">Field_Type_Access</A>; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/form_field_validation.3x.html">field_type()</A></EM></span> -+ <span class="comment"><EM>-- AKA: field_arg()</EM></span> -+ <span class="comment"><EM>-- In Ada95 we can combine these. If you try to retrieve the field type</EM></span> -+ <span class="comment"><EM>-- that is not defined as extension of the abstract tagged type above,</EM></span> -+ <span class="comment"><EM>-- you will raise a Form_Exception.</EM></span> -+ <span class="comment"><EM>-- This is not inlined</EM></span> -+ -+ <span class="comment"><EM>-- +----------------------------------------------------------------------</EM></span> -+ <span class="comment"><EM>-- | Private Part.</EM></span> -+ <span class="comment"><EM>-- | Most of this is used by the implementations of the child packages.</EM></span> -+ <span class="comment"><EM>-- |</EM></span> - <b>private</b> -- <b>type</b> <FONT COLOR=red><A NAME="ref_92_9">Makearg_Function</A></FONT> <b>is</b> <b>access</b> -- <b>function</b> (<FONT COLOR=red><A NAME="ref_93_16">Args</A></FONT> : System.Address) <b>return</b> System.Address; -+ <b>type</b> <span class="symbol"><A NAME="ref_92_9">Makearg_Function</A></span> <b>is</b> <b>access</b> -+ <b>function</b> (<span class="symbol"><A NAME="ref_93_16">Args</A></span> : System.Address) <b>return</b> System.Address; - <b>pragma</b> Convention (C, <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_92_9">Makearg_Function</A>); - -- <b>type</b> <FONT COLOR=red><A NAME="ref_96_9">Copyarg_Function</A></FONT> <b>is</b> <b>access</b> -- <b>function</b> (<FONT COLOR=red><A NAME="ref_97_16">Usr</A></FONT> : System.Address) <b>return</b> System.Address; -+ <b>type</b> <span class="symbol"><A NAME="ref_96_9">Copyarg_Function</A></span> <b>is</b> <b>access</b> -+ <b>function</b> (<span class="symbol"><A NAME="ref_97_16">Usr</A></span> : System.Address) <b>return</b> System.Address; - <b>pragma</b> Convention (C, <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_96_9">Copyarg_Function</A>); - -- <b>type</b> <FONT COLOR=red><A NAME="ref_100_9">Freearg_Function</A></FONT> <b>is</b> <b>access</b> -- <b>procedure</b> (<FONT COLOR=red><A NAME="ref_101_17">Usr</A></FONT> : System.Address); -+ <b>type</b> <span class="symbol"><A NAME="ref_100_9">Freearg_Function</A></span> <b>is</b> <b>access</b> -+ <b>procedure</b> (<span class="symbol"><A NAME="ref_101_17">Usr</A></span> : System.Address); - <b>pragma</b> Convention (C, <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_100_9">Freearg_Function</A>); - -- <b>type</b> <FONT COLOR=red><A NAME="ref_104_9">Field_Check_Function</A></FONT> <b>is</b> <b>access</b> -- <b>function</b> (<FONT COLOR=red><A NAME="ref_105_16">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; <FONT COLOR=red><A NAME="ref_105_29">Usr</A></FONT> : System.Address) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_1926_9">Curses_Bool</A>; -+ <b>type</b> <span class="symbol"><A NAME="ref_104_9">Field_Check_Function</A></span> <b>is</b> <b>access</b> -+ <b>function</b> (<span class="symbol"><A NAME="ref_105_16">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; <span class="symbol"><A NAME="ref_105_29">Usr</A></span> : System.Address) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_1925_9">Curses_Bool</A>; - <b>pragma</b> Convention (C, <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_104_9">Field_Check_Function</A>); - -- <b>type</b> <FONT COLOR=red><A NAME="ref_108_9">Char_Check_Function</A></FONT> <b>is</b> <b>access</b> -- <b>function</b> (<FONT COLOR=red><A NAME="ref_109_16">Ch</A></FONT> : <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_46_12">C_Int</A>; <FONT COLOR=red><A NAME="ref_109_28">Usr</A></FONT> : System.Address) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_1926_9">Curses_Bool</A>; -+ <b>type</b> <span class="symbol"><A NAME="ref_108_9">Char_Check_Function</A></span> <b>is</b> <b>access</b> -+ <b>function</b> (<span class="symbol"><A NAME="ref_109_16">Ch</A></span> : <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_46_12">C_Int</A>; <span class="symbol"><A NAME="ref_109_28">Usr</A></span> : System.Address) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_1925_9">Curses_Bool</A>; - <b>pragma</b> Convention (C, <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_108_9">Char_Check_Function</A>); - -- <b>type</b> <FONT COLOR=red><A NAME="ref_112_9">Choice_Function</A></FONT> <b>is</b> <b>access</b> -- <b>function</b> (<FONT COLOR=red><A NAME="ref_113_16">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; <FONT COLOR=red><A NAME="ref_113_29">Usr</A></FONT> : System.Address) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_1926_9">Curses_Bool</A>; -+ <b>type</b> <span class="symbol"><A NAME="ref_112_9">Choice_Function</A></span> <b>is</b> <b>access</b> -+ <b>function</b> (<span class="symbol"><A NAME="ref_113_16">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; <span class="symbol"><A NAME="ref_113_29">Usr</A></span> : System.Address) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_1925_9">Curses_Bool</A>; - <b>pragma</b> Convention (C, <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_112_9">Choice_Function</A>); - -- <FONT COLOR=green><EM>-- +----------------------------------------------------------------------</EM></FONT> -- <FONT COLOR=green><EM>-- | This must be in sync with the FIELDTYPE structure in form.h</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <b>type</b> <FONT COLOR=red><A NAME="ref_119_9">Low_Level_Field_Type</A></FONT> <b>is</b> -+ <span class="comment"><EM>-- +----------------------------------------------------------------------</EM></span> -+ <span class="comment"><EM>-- | This must be in sync with the FIELDTYPE structure in form.h</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <b>type</b> <span class="symbol"><A NAME="ref_119_9">Low_Level_Field_Type</A></span> <b>is</b> - <b>record</b> -- <FONT COLOR=red><A NAME="ref_121_10">Status</A></FONT> : <A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>.C.unsigned_short; -- <FONT COLOR=red><A NAME="ref_122_10">Ref_Count</A></FONT> : <A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>.C.long; -- <FONT COLOR=red><A NAME="ref_123_10">Left</A></FONT>, <FONT COLOR=red><A NAME="ref_123_16">Right</A></FONT> : System.Address; -- <FONT COLOR=red><A NAME="ref_124_10">Makearg</A></FONT> : <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_92_9">Makearg_Function</A>; -- <FONT COLOR=red><A NAME="ref_125_10">Copyarg</A></FONT> : <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_96_9">Copyarg_Function</A>; -- <FONT COLOR=red><A NAME="ref_126_10">Freearg</A></FONT> : <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_100_9">Freearg_Function</A>; -- <FONT COLOR=red><A NAME="ref_127_10">Fcheck</A></FONT> : <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_104_9">Field_Check_Function</A>; -- <FONT COLOR=red><A NAME="ref_128_10">Ccheck</A></FONT> : <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_108_9">Char_Check_Function</A>; -- <FONT COLOR=red><A NAME="ref_129_10">Next</A></FONT>, <FONT COLOR=red><A NAME="ref_129_16">Prev</A></FONT> : <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_112_9">Choice_Function</A>; -+ <span class="symbol"><A NAME="ref_121_10">Status</A></span> : <A HREF="interfac__ads.htm#ref_36_9">Interfaces</A>.C.unsigned_short; -+ <span class="symbol"><A NAME="ref_122_10">Ref_Count</A></span> : <A HREF="interfac__ads.htm#ref_36_9">Interfaces</A>.C.long; -+ <span class="symbol"><A NAME="ref_123_10">Left</A></span>, <span class="symbol"><A NAME="ref_123_16">Right</A></span> : System.Address; -+ <span class="symbol"><A NAME="ref_124_10">Makearg</A></span> : <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_92_9">Makearg_Function</A>; -+ <span class="symbol"><A NAME="ref_125_10">Copyarg</A></span> : <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_96_9">Copyarg_Function</A>; -+ <span class="symbol"><A NAME="ref_126_10">Freearg</A></span> : <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_100_9">Freearg_Function</A>; -+ <span class="symbol"><A NAME="ref_127_10">Fcheck</A></span> : <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_104_9">Field_Check_Function</A>; -+ <span class="symbol"><A NAME="ref_128_10">Ccheck</A></span> : <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_108_9">Char_Check_Function</A>; -+ <span class="symbol"><A NAME="ref_129_10">Next</A></span>, <span class="symbol"><A NAME="ref_129_16">Prev</A></span> : <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_112_9">Choice_Function</A>; - <b>end</b> <b>record</b>; - <b>pragma</b> Convention (C, <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_119_9">Low_Level_Field_Type</A>); -- <b>type</b> <FONT COLOR=red><A NAME="ref_132_9">C_Field_Type</A></FONT> <b>is</b> <b>access</b> <b>all</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_119_9">Low_Level_Field_Type</A>; -+ <b>type</b> <span class="symbol"><A NAME="ref_132_9">C_Field_Type</A></span> <b>is</b> <b>access</b> <b>all</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_119_9">Low_Level_Field_Type</A>; - -- <FONT COLOR=red><A NAME="ref_134_4">Null_Field_Type</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_132_9">C_Field_Type</A> := <b>null</b>; -+ <span class="symbol"><A NAME="ref_134_4">Null_Field_Type</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_132_9">C_Field_Type</A> := <b>null</b>; - -- <FONT COLOR=green><EM>-- +----------------------------------------------------------------------</EM></FONT> -- <FONT COLOR=green><EM>-- | This four low-level fieldtypes are the ones associated with</EM></FONT> -- <FONT COLOR=green><EM>-- | fieldtypes handled by this binding. Any other low-level fieldtype</EM></FONT> -- <FONT COLOR=green><EM>-- | will result in a Form_Exception is function Get_Type.</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=red><A NAME="ref_141_4">M_Generic_Type</A></FONT> : <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_132_9">C_Field_Type</A> := <b>null</b>; -- <FONT COLOR=red><A NAME="ref_142_4">M_Generic_Choice</A></FONT> : <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_132_9">C_Field_Type</A> := <b>null</b>; -- <FONT COLOR=red><A NAME="ref_143_4">M_Builtin_Router</A></FONT> : <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_132_9">C_Field_Type</A> := <b>null</b>; -- <FONT COLOR=red><A NAME="ref_144_4">M_Choice_Router</A></FONT> : <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_132_9">C_Field_Type</A> := <b>null</b>; -- -- <FONT COLOR=green><EM>-- Two wrapper functions to access those low-level fieldtypes defined</EM></FONT> -- <FONT COLOR=green><EM>-- in this package.</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_148_13" HREF="terminal_interface-curses-forms-field_types__adb.htm#ref_224_13">C_Builtin_Router</A></FONT> <b>return</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_132_9">C_Field_Type</A>; -- <b>function</b> <FONT COLOR=red><A NAME="ref_149_13" HREF="terminal_interface-curses-forms-field_types__adb.htm#ref_251_13">C_Choice_Router</A></FONT> <b>return</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_132_9">C_Field_Type</A>; -- -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_151_14" HREF="terminal_interface-curses-forms-field_types__adb.htm#ref_126_14">Wrap_Builtin</A></FONT> (<FONT COLOR=red><A NAME="ref_151_28" HREF="terminal_interface-curses-forms-field_types__adb.htm#ref_126_28">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_152_28" HREF="terminal_interface-curses-forms-field_types__adb.htm#ref_127_28">Typ</A></FONT> : <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_52_9">Field_Type</A>'Class; -- <FONT COLOR=red><A NAME="ref_153_28" HREF="terminal_interface-curses-forms-field_types__adb.htm#ref_128_28">Cft</A></FONT> : <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_132_9">C_Field_Type</A> := <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_148_13">C_Builtin_Router</A>); -- <FONT COLOR=green><EM>-- This procedure has to be called by the Set_Field_Type implementation</EM></FONT> -- <FONT COLOR=green><EM>-- for builtin low-level fieldtypes to replace it by an Ada95</EM></FONT> -- <FONT COLOR=green><EM>-- conformant Field_Type object.</EM></FONT> -- <FONT COLOR=green><EM>-- The parameter Cft must be C_Builtin_Router for regular low-level</EM></FONT> -- <FONT COLOR=green><EM>-- fieldtypes (like TYP_ALPHA or TYP_ALNUM) and C_Choice_Router for</EM></FONT> -- <FONT COLOR=green><EM>-- low-level fieldtypes witch choice functions (like TYP_ENUM).</EM></FONT> -- <FONT COLOR=green><EM>-- Any other value will raise a Form_Exception.</EM></FONT> -+ <span class="comment"><EM>-- +----------------------------------------------------------------------</EM></span> -+ <span class="comment"><EM>-- | This four low-level fieldtypes are the ones associated with</EM></span> -+ <span class="comment"><EM>-- | fieldtypes handled by this binding. Any other low-level fieldtype</EM></span> -+ <span class="comment"><EM>-- | will result in a Form_Exception is function Get_Type.</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="symbol"><A NAME="ref_141_4">M_Generic_Type</A></span> : <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_132_9">C_Field_Type</A> := <b>null</b>; -+ <span class="symbol"><A NAME="ref_142_4">M_Generic_Choice</A></span> : <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_132_9">C_Field_Type</A> := <b>null</b>; -+ <span class="symbol"><A NAME="ref_143_4">M_Builtin_Router</A></span> : <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_132_9">C_Field_Type</A> := <b>null</b>; -+ <span class="symbol"><A NAME="ref_144_4">M_Choice_Router</A></span> : <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_132_9">C_Field_Type</A> := <b>null</b>; -+ -+ <span class="comment"><EM>-- Two wrapper functions to access those low-level fieldtypes defined</EM></span> -+ <span class="comment"><EM>-- in this package.</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_148_13" HREF="terminal_interface-curses-forms-field_types__adb.htm#ref_224_13">C_Builtin_Router</A></span> <b>return</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_132_9">C_Field_Type</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_149_13" HREF="terminal_interface-curses-forms-field_types__adb.htm#ref_251_13">C_Choice_Router</A></span> <b>return</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_132_9">C_Field_Type</A>; -+ -+ <b>procedure</b> <span class="symbol"><A NAME="ref_151_14" HREF="terminal_interface-curses-forms-field_types__adb.htm#ref_126_14">Wrap_Builtin</A></span> (<span class="symbol"><A NAME="ref_151_28" HREF="terminal_interface-curses-forms-field_types__adb.htm#ref_126_28">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_152_28" HREF="terminal_interface-curses-forms-field_types__adb.htm#ref_127_28">Typ</A></span> : <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_52_9">Field_Type</A>'Class; -+ <span class="symbol"><A NAME="ref_153_28" HREF="terminal_interface-curses-forms-field_types__adb.htm#ref_128_28">Cft</A></span> : <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_132_9">C_Field_Type</A> := <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_148_13">C_Builtin_Router</A>); -+ <span class="comment"><EM>-- This procedure has to be called by the Set_Field_Type implementation</EM></span> -+ <span class="comment"><EM>-- for builtin low-level fieldtypes to replace it by an Ada95</EM></span> -+ <span class="comment"><EM>-- conformant Field_Type object.</EM></span> -+ <span class="comment"><EM>-- The parameter Cft must be C_Builtin_Router for regular low-level</EM></span> -+ <span class="comment"><EM>-- fieldtypes (like TYP_ALPHA or TYP_ALNUM) and C_Choice_Router for</EM></span> -+ <span class="comment"><EM>-- low-level fieldtypes witch choice functions (like TYP_ENUM).</EM></span> -+ <span class="comment"><EM>-- Any other value will raise a Form_Exception.</EM></span> - -- <b>function</b> <FONT COLOR=red><A NAME="ref_162_13">Make_Arg</A></FONT> (<FONT COLOR=red><A NAME="ref_162_23" HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_162_13">Args</A></FONT> : System.Address) <b>return</b> System.Address; -+ <b>function</b> <span class="symbol"><A NAME="ref_162_13">Make_Arg</A></span> (<span class="symbol"><A NAME="ref_162_23" HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_162_13">Args</A></span> : System.Address) <b>return</b> System.Address; - <b>pragma</b> Import (C, Make_Arg, "void_star_make_arg"); -- <FONT COLOR=green><EM>-- This is the Makearg_Function for the internal low-level types</EM></FONT> -- <FONT COLOR=green><EM>-- introduced by this binding.</EM></FONT> -+ <span class="comment"><EM>-- This is the Makearg_Function for the internal low-level types</EM></span> -+ <span class="comment"><EM>-- introduced by this binding.</EM></span> - -- <b>function</b> <FONT COLOR=red><A NAME="ref_167_13" HREF="terminal_interface-curses-forms-field_types__adb.htm#ref_95_13">Copy_Arg</A></FONT> (<FONT COLOR=red><A NAME="ref_167_23" HREF="terminal_interface-curses-forms-field_types__adb.htm#ref_95_23">Usr</A></FONT> : System.Address) <b>return</b> System.Address; -+ <b>function</b> <span class="symbol"><A NAME="ref_167_13" HREF="terminal_interface-curses-forms-field_types__adb.htm#ref_95_13">Copy_Arg</A></span> (<span class="symbol"><A NAME="ref_167_23" HREF="terminal_interface-curses-forms-field_types__adb.htm#ref_95_23">Usr</A></span> : System.Address) <b>return</b> System.Address; - <b>pragma</b> Convention (C, <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_167_13">Copy_Arg</A>); -- <FONT COLOR=green><EM>-- This is the Copyarg_Function for the internal low-level types</EM></FONT> -- <FONT COLOR=green><EM>-- introduced by this binding.</EM></FONT> -+ <span class="comment"><EM>-- This is the Copyarg_Function for the internal low-level types</EM></span> -+ <span class="comment"><EM>-- introduced by this binding.</EM></span> - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_172_14" HREF="terminal_interface-curses-forms-field_types__adb.htm#ref_101_14">Free_Arg</A></FONT> (<FONT COLOR=red><A NAME="ref_172_24" HREF="terminal_interface-curses-forms-field_types__adb.htm#ref_101_24">Usr</A></FONT> : System.Address); -+ <b>procedure</b> <span class="symbol"><A NAME="ref_172_14" HREF="terminal_interface-curses-forms-field_types__adb.htm#ref_101_14">Free_Arg</A></span> (<span class="symbol"><A NAME="ref_172_24" HREF="terminal_interface-curses-forms-field_types__adb.htm#ref_101_24">Usr</A></span> : System.Address); - <b>pragma</b> Convention (C, <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_172_14">Free_Arg</A>); -- <FONT COLOR=green><EM>-- This is the Freearg_Function for the internal low-level types</EM></FONT> -- <FONT COLOR=green><EM>-- introduced by this binding.</EM></FONT> -+ <span class="comment"><EM>-- This is the Freearg_Function for the internal low-level types</EM></span> -+ <span class="comment"><EM>-- introduced by this binding.</EM></span> - -- <b>function</b> <FONT COLOR=red><A NAME="ref_177_13" HREF="terminal_interface-curses-forms-field_types__adb.htm#ref_162_13">Field_Check_Router</A></FONT> (<FONT COLOR=red><A NAME="ref_177_33" HREF="terminal_interface-curses-forms-field_types__adb.htm#ref_162_33">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_178_33" HREF="terminal_interface-curses-forms-field_types__adb.htm#ref_163_33">Usr</A></FONT> : System.Address) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_1926_9">Curses_Bool</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_177_13" HREF="terminal_interface-curses-forms-field_types__adb.htm#ref_162_13">Field_Check_Router</A></span> (<span class="symbol"><A NAME="ref_177_33" HREF="terminal_interface-curses-forms-field_types__adb.htm#ref_162_33">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_178_33" HREF="terminal_interface-curses-forms-field_types__adb.htm#ref_163_33">Usr</A></span> : System.Address) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_1925_9">Curses_Bool</A>; - <b>pragma</b> Convention (C, <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_177_13">Field_Check_Router</A>); -- <FONT COLOR=green><EM>-- This is the Field_Check_Function for the internal low-level types</EM></FONT> -- <FONT COLOR=green><EM>-- introduced to wrap the low-level types by a Field_Type derived</EM></FONT> -- <FONT COLOR=green><EM>-- type. It routes the call to the corresponding low-level validation</EM></FONT> -- <FONT COLOR=green><EM>-- function.</EM></FONT> -+ <span class="comment"><EM>-- This is the Field_Check_Function for the internal low-level types</EM></span> -+ <span class="comment"><EM>-- introduced to wrap the low-level types by a Field_Type derived</EM></span> -+ <span class="comment"><EM>-- type. It routes the call to the corresponding low-level validation</EM></span> -+ <span class="comment"><EM>-- function.</EM></span> - -- <b>function</b> <FONT COLOR=red><A NAME="ref_185_13" HREF="terminal_interface-curses-forms-field_types__adb.htm#ref_177_13">Char_Check_Router</A></FONT> (<FONT COLOR=red><A NAME="ref_185_32" HREF="terminal_interface-curses-forms-field_types__adb.htm#ref_177_32">Ch</A></FONT> : <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_46_12">C_Int</A>; -- <FONT COLOR=red><A NAME="ref_186_32" HREF="terminal_interface-curses-forms-field_types__adb.htm#ref_178_32">Usr</A></FONT> : System.Address) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_1926_9">Curses_Bool</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_185_13" HREF="terminal_interface-curses-forms-field_types__adb.htm#ref_177_13">Char_Check_Router</A></span> (<span class="symbol"><A NAME="ref_185_32" HREF="terminal_interface-curses-forms-field_types__adb.htm#ref_177_32">Ch</A></span> : <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_46_12">C_Int</A>; -+ <span class="symbol"><A NAME="ref_186_32" HREF="terminal_interface-curses-forms-field_types__adb.htm#ref_178_32">Usr</A></span> : System.Address) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_1925_9">Curses_Bool</A>; - <b>pragma</b> Convention (C, <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_185_13">Char_Check_Router</A>); -- <FONT COLOR=green><EM>-- This is the Char_Check_Function for the internal low-level types</EM></FONT> -- <FONT COLOR=green><EM>-- introduced to wrap the low-level types by a Field_Type derived</EM></FONT> -- <FONT COLOR=green><EM>-- type. It routes the call to the corresponding low-level validation</EM></FONT> -- <FONT COLOR=green><EM>-- function.</EM></FONT> -+ <span class="comment"><EM>-- This is the Char_Check_Function for the internal low-level types</EM></span> -+ <span class="comment"><EM>-- introduced to wrap the low-level types by a Field_Type derived</EM></span> -+ <span class="comment"><EM>-- type. It routes the call to the corresponding low-level validation</EM></span> -+ <span class="comment"><EM>-- function.</EM></span> - -- <b>function</b> <FONT COLOR=red><A NAME="ref_193_13" HREF="terminal_interface-curses-forms-field_types__adb.htm#ref_192_13">Next_Router</A></FONT> (<FONT COLOR=red><A NAME="ref_193_26" HREF="terminal_interface-curses-forms-field_types__adb.htm#ref_192_26">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_194_26" HREF="terminal_interface-curses-forms-field_types__adb.htm#ref_193_26">Usr</A></FONT> : System.Address) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_1926_9">Curses_Bool</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_193_13" HREF="terminal_interface-curses-forms-field_types__adb.htm#ref_192_13">Next_Router</A></span> (<span class="symbol"><A NAME="ref_193_26" HREF="terminal_interface-curses-forms-field_types__adb.htm#ref_192_26">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_194_26" HREF="terminal_interface-curses-forms-field_types__adb.htm#ref_193_26">Usr</A></span> : System.Address) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_1925_9">Curses_Bool</A>; - <b>pragma</b> Convention (C, <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_193_13">Next_Router</A>); -- <FONT COLOR=green><EM>-- This is the Choice_Function for the internal low-level types</EM></FONT> -- <FONT COLOR=green><EM>-- introduced to wrap the low-level types by a Field_Type derived</EM></FONT> -- <FONT COLOR=green><EM>-- type. It routes the call to the corresponding low-level next_choice</EM></FONT> -- <FONT COLOR=green><EM>-- function.</EM></FONT> -+ <span class="comment"><EM>-- This is the Choice_Function for the internal low-level types</EM></span> -+ <span class="comment"><EM>-- introduced to wrap the low-level types by a Field_Type derived</EM></span> -+ <span class="comment"><EM>-- type. It routes the call to the corresponding low-level next_choice</EM></span> -+ <span class="comment"><EM>-- function.</EM></span> - -- <b>function</b> <FONT COLOR=red><A NAME="ref_201_13" HREF="terminal_interface-curses-forms-field_types__adb.htm#ref_207_13">Prev_Router</A></FONT> (<FONT COLOR=red><A NAME="ref_201_26" HREF="terminal_interface-curses-forms-field_types__adb.htm#ref_207_26">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_202_26" HREF="terminal_interface-curses-forms-field_types__adb.htm#ref_208_26">Usr</A></FONT> : System.Address) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_1926_9">Curses_Bool</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_201_13" HREF="terminal_interface-curses-forms-field_types__adb.htm#ref_207_13">Prev_Router</A></span> (<span class="symbol"><A NAME="ref_201_26" HREF="terminal_interface-curses-forms-field_types__adb.htm#ref_207_26">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_202_26" HREF="terminal_interface-curses-forms-field_types__adb.htm#ref_208_26">Usr</A></span> : System.Address) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_1925_9">Curses_Bool</A>; - <b>pragma</b> Convention (C, <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_201_13">Prev_Router</A>); -- <FONT COLOR=green><EM>-- This is the Choice_Function for the internal low-level types</EM></FONT> -- <FONT COLOR=green><EM>-- introduced to wrap the low-level types by a Field_Type derived</EM></FONT> -- <FONT COLOR=green><EM>-- type. It routes the call to the corresponding low-level prev_choice</EM></FONT> -- <FONT COLOR=green><EM>-- function.</EM></FONT> -- -- <FONT COLOR=green><EM>-- This is the Argument structure maintained by all low-level field types</EM></FONT> -- <FONT COLOR=green><EM>-- introduced by this binding.</EM></FONT> -- <b>type</b> <FONT COLOR=red><A NAME="ref_211_9">Argument</A></FONT> <b>is</b> <b>record</b> -- <FONT COLOR=red><A NAME="ref_212_7">Typ</A></FONT> : <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_63_9">Field_Type_Access</A>; <FONT COLOR=green><EM>-- the Field_Type creating this record</EM></FONT> -- <FONT COLOR=red><A NAME="ref_213_7">Usr</A></FONT> : System.Address; <FONT COLOR=green><EM>-- original arg for builtin low-level types</EM></FONT> -- <FONT COLOR=red><A NAME="ref_214_7">Cft</A></FONT> : <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_132_9">C_Field_Type</A>; <FONT COLOR=green><EM>-- the original low-level type</EM></FONT> -+ <span class="comment"><EM>-- This is the Choice_Function for the internal low-level types</EM></span> -+ <span class="comment"><EM>-- introduced to wrap the low-level types by a Field_Type derived</EM></span> -+ <span class="comment"><EM>-- type. It routes the call to the corresponding low-level prev_choice</EM></span> -+ <span class="comment"><EM>-- function.</EM></span> -+ -+ <span class="comment"><EM>-- This is the Argument structure maintained by all low-level field types</EM></span> -+ <span class="comment"><EM>-- introduced by this binding.</EM></span> -+ <b>type</b> <span class="symbol"><A NAME="ref_211_9">Argument</A></span> <b>is</b> <b>record</b> -+ <span class="symbol"><A NAME="ref_212_7">Typ</A></span> : <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_63_9">Field_Type_Access</A>; <span class="comment"><EM>-- the Field_Type creating this record</EM></span> -+ <span class="symbol"><A NAME="ref_213_7">Usr</A></span> : System.Address; <span class="comment"><EM>-- original arg for builtin low-level types</EM></span> -+ <span class="symbol"><A NAME="ref_214_7">Cft</A></span> : <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_132_9">C_Field_Type</A>; <span class="comment"><EM>-- the original low-level type</EM></span> - <b>end</b> <b>record</b>; -- <b>type</b> <FONT COLOR=red><A NAME="ref_216_9">Argument_Access</A></FONT> <b>is</b> <b>access</b> <b>all</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_211_9">Argument</A>; -+ <b>type</b> <span class="symbol"><A NAME="ref_216_9">Argument_Access</A></span> <b>is</b> <b>access</b> <b>all</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_211_9">Argument</A>; - -- <FONT COLOR=green><EM>-- +----------------------------------------------------------------------</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- | Some Imports of libform routines to deal with low-level fieldtypes.</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_222_13">New_Fieldtype</A></FONT> (<FONT COLOR=red><A NAME="ref_222_28" HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_222_13">Fcheck</A></FONT> : <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_104_9">Field_Check_Function</A>; -- <FONT COLOR=red><A NAME="ref_223_28" HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_222_13">Ccheck</A></FONT> : <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_108_9">Char_Check_Function</A>) -+ <span class="comment"><EM>-- +----------------------------------------------------------------------</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- | Some Imports of libform routines to deal with low-level fieldtypes.</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_222_13">New_Fieldtype</A></span> (<span class="symbol"><A NAME="ref_222_28" HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_222_13">Fcheck</A></span> : <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_104_9">Field_Check_Function</A>; -+ <span class="symbol"><A NAME="ref_223_28" HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_222_13">Ccheck</A></span> : <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_108_9">Char_Check_Function</A>) - <b>return</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_132_9">C_Field_Type</A>; - <b>pragma</b> Import (C, New_Fieldtype, "new_fieldtype"); - -- <b>function</b> <FONT COLOR=red><A NAME="ref_227_13">Set_Fieldtype_Arg</A></FONT> (<FONT COLOR=red><A NAME="ref_227_32" HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_227_13">Cft</A></FONT> : <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_132_9">C_Field_Type</A>; -- <FONT COLOR=red><A NAME="ref_228_32" HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_227_13">Mak</A></FONT> : <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_92_9">Makearg_Function</A> := <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_162_13">Make_Arg</A>'<b>Access</b>; -- <FONT COLOR=red><A NAME="ref_229_32" HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_227_13">Cop</A></FONT> : <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_96_9">Copyarg_Function</A> := <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_167_13">Copy_Arg</A>'<b>Access</b>; -- <FONT COLOR=red><A NAME="ref_230_32" HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_227_13">Fre</A></FONT> : <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_100_9">Freearg_Function</A> := <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_172_14">Free_Arg</A>'<b>Access</b>) -+ <b>function</b> <span class="symbol"><A NAME="ref_227_13">Set_Fieldtype_Arg</A></span> (<span class="symbol"><A NAME="ref_227_32" HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_227_13">Cft</A></span> : <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_132_9">C_Field_Type</A>; -+ <span class="symbol"><A NAME="ref_228_32" HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_227_13">Mak</A></span> : <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_92_9">Makearg_Function</A> := <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_162_13">Make_Arg</A>'<b>Access</b>; -+ <span class="symbol"><A NAME="ref_229_32" HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_227_13">Cop</A></span> : <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_96_9">Copyarg_Function</A> := <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_167_13">Copy_Arg</A>'<b>Access</b>; -+ <span class="symbol"><A NAME="ref_230_32" HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_227_13">Fre</A></span> : <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_100_9">Freearg_Function</A> := <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_172_14">Free_Arg</A>'<b>Access</b>) - <b>return</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_46_12">C_Int</A>; - <b>pragma</b> Import (C, Set_Fieldtype_Arg, "set_fieldtype_arg"); - -- <b>function</b> <FONT COLOR=red><A NAME="ref_234_13">Set_Fieldtype_Choice</A></FONT> (<FONT COLOR=red><A NAME="ref_234_35" HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_234_13">Cft</A></FONT> : <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_132_9">C_Field_Type</A>; -- <FONT COLOR=red><A NAME="ref_235_35" HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_234_13">Next</A></FONT>, <FONT COLOR=red><A NAME="ref_235_41" HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_234_13">Prev</A></FONT> : <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_112_9">Choice_Function</A>) -+ <b>function</b> <span class="symbol"><A NAME="ref_234_13">Set_Fieldtype_Choice</A></span> (<span class="symbol"><A NAME="ref_234_35" HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_234_13">Cft</A></span> : <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_132_9">C_Field_Type</A>; -+ <span class="symbol"><A NAME="ref_235_35" HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_234_13">Next</A></span>, <span class="symbol"><A NAME="ref_235_41" HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_234_13">Prev</A></span> : <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_112_9">Choice_Function</A>) - <b>return</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_46_12">C_Int</A>; - <b>pragma</b> Import (C, Set_Fieldtype_Choice, "set_fieldtype_choice"); - -diff -Naur ncurses-5.9/doc/html/ada/terminal_interface-curses-forms-field_types-alpha__adb.htm ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-forms-field_types-alpha__adb.htm ---- ncurses-5.9/doc/html/ada/terminal_interface-curses-forms-field_types-alpha__adb.htm 2011-03-20 00:18:39.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-forms-field_types-alpha__adb.htm 2014-09-01 16:33:22.273791985 +0200 -@@ -1,61 +1,73 @@ --<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> --<HTML><HEAD><TITLE>terminal_interface-curses-forms-field_types-alpha.adb</TITLE></HEAD> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> -+<HTML> -+<HEAD> -+<TITLE>terminal_interface-curses-forms-field_types-alpha.adb</TITLE> -+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> -+<style type="text/css"> -+*.comment { -+ color: green; -+} -+*.symbol { -+ color: red; -+} -+</style> -+</HEAD> - <BODY> --<HR><DIV ALIGN="center"><H1> File : terminal_interface-curses-forms-field_types-alpha.adb </H1></DIV><HR> -+<HR><DIV style="text-align:center"><H1> File : terminal_interface-curses-forms-field_types-alpha.adb </H1></DIV><HR> - <PRE> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Terminal_Interface.Curses.Forms.Field_Types.Alpha --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- B O D Y --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Copyright (c) 1998-2009,2011 Free Software Foundation, Inc. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></FONT> --<FONT COLOR=green><EM>-- copy of this software and associated documentation files (the --</EM></FONT> --<FONT COLOR=green><EM>-- "Software"), to deal in the Software without restriction, including --</EM></FONT> --<FONT COLOR=green><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></FONT> --<FONT COLOR=green><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></FONT> --<FONT COLOR=green><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></FONT> --<FONT COLOR=green><EM>-- furnished to do so, subject to the following conditions: --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- The above copyright notice and this permission notice shall be included --</EM></FONT> --<FONT COLOR=green><EM>-- in all copies or substantial portions of the Software. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></FONT> --<FONT COLOR=green><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></FONT> --<FONT COLOR=green><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></FONT> --<FONT COLOR=green><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></FONT> --<FONT COLOR=green><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></FONT> --<FONT COLOR=green><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></FONT> --<FONT COLOR=green><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></FONT> --<FONT COLOR=green><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></FONT> --<FONT COLOR=green><EM>-- sale, use or other dealings in this Software without prior written --</EM></FONT> --<FONT COLOR=green><EM>-- authorization. --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Author: Juergen Pfeifer, 1996</EM></FONT> --<FONT COLOR=green><EM>-- Version Control:</EM></FONT> --<FONT COLOR=green><EM>-- @Revision: 1.11 @</EM></FONT> --<FONT COLOR=green><EM>-- @Date: 2011/03/19 00:45:37 @</EM></FONT> --<FONT COLOR=green><EM>-- Binding Version 01.00</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Terminal_Interface.Curses.Forms.Field_Types.Alpha --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- B O D Y --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Copyright (c) 1998-2009,2011 Free Software Foundation, Inc. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></span> -+<span class="comment"><EM>-- copy of this software and associated documentation files (the --</EM></span> -+<span class="comment"><EM>-- "Software"), to deal in the Software without restriction, including --</EM></span> -+<span class="comment"><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></span> -+<span class="comment"><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></span> -+<span class="comment"><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></span> -+<span class="comment"><EM>-- furnished to do so, subject to the following conditions: --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- The above copyright notice and this permission notice shall be included --</EM></span> -+<span class="comment"><EM>-- in all copies or substantial portions of the Software. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></span> -+<span class="comment"><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></span> -+<span class="comment"><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></span> -+<span class="comment"><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></span> -+<span class="comment"><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></span> -+<span class="comment"><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></span> -+<span class="comment"><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></span> -+<span class="comment"><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></span> -+<span class="comment"><EM>-- sale, use or other dealings in this Software without prior written --</EM></span> -+<span class="comment"><EM>-- authorization. --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Author: Juergen Pfeifer, 1996</EM></span> -+<span class="comment"><EM>-- Version Control:</EM></span> -+<span class="comment"><EM>-- @Revision: 1.11 @</EM></span> -+<span class="comment"><EM>-- @Date: 2011/03/19 00:45:37 @</EM></span> -+<span class="comment"><EM>-- Binding Version 01.00</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> - <b>with</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-aux__ads.htm#ref_50_35">Aux</A>; <b>use</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-aux__ads.htm#ref_50_35">Aux</A>; - --<b>package</b> <b>body</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-forms__ads.htm#ref_49_35">Forms</A>.<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_43_41">Field_Types</A>.<FONT COLOR=red><A NAME="ref_44_58" HREF="terminal_interface-curses-forms-field_types-alpha__ads.htm#ref_41_53">Alpha</A></FONT> <b>is</b> -+<b>package</b> <b>body</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-forms__ads.htm#ref_49_35">Forms</A>.<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_43_41">Field_Types</A>.<span class="symbol"><A NAME="ref_44_58" HREF="terminal_interface-curses-forms-field_types-alpha__ads.htm#ref_41_53">Alpha</A></span> <b>is</b> - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_46_14" HREF="terminal_interface-curses-forms-field_types-alpha__ads.htm#ref_49_14">Set_Field_Type</A></FONT> (<FONT COLOR=red><A NAME="ref_46_30" HREF="terminal_interface-curses-forms-field_types-alpha__ads.htm#ref_49_30">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_47_30" HREF="terminal_interface-curses-forms-field_types-alpha__ads.htm#ref_50_30">Typ</A></FONT> : <A HREF="terminal_interface-curses-forms-field_types-alpha__ads.htm#ref_44_9">Alpha_Field</A>) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_46_14" HREF="terminal_interface-curses-forms-field_types-alpha__ads.htm#ref_49_14">Set_Field_Type</A></span> (<span class="symbol"><A NAME="ref_46_30" HREF="terminal_interface-curses-forms-field_types-alpha__ads.htm#ref_49_30">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_47_30" HREF="terminal_interface-curses-forms-field_types-alpha__ads.htm#ref_50_30">Typ</A></span> : <A HREF="terminal_interface-curses-forms-field_types-alpha__ads.htm#ref_44_9">Alpha_Field</A>) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_49_16">Set_Fld_Type</A></FONT> (<FONT COLOR=red><A NAME="ref_49_30" HREF="terminal_interface-curses-forms-field_types-alpha__adb.htm#ref_49_16">F</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A> := <A HREF="terminal_interface-curses-forms-field_types-alpha__ads.htm#ref_49_30">Fld</A>; -- <FONT COLOR=red><A NAME="ref_50_30" HREF="terminal_interface-curses-forms-field_types-alpha__adb.htm#ref_49_16">Arg1</A></FONT> : <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_46_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_46_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_49_16">Set_Fld_Type</A></span> (<span class="symbol"><A NAME="ref_49_30" HREF="terminal_interface-curses-forms-field_types-alpha__adb.htm#ref_49_16">F</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A> := <A HREF="terminal_interface-curses-forms-field_types-alpha__ads.htm#ref_49_30">Fld</A>; -+ <span class="symbol"><A NAME="ref_50_30" HREF="terminal_interface-curses-forms-field_types-alpha__adb.htm#ref_49_16">Arg1</A></span> : <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_46_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_46_12">C_Int</A>; - <b>pragma</b> Import (C, Set_Fld_Type, "set_field_type_alpha"); - -- <FONT COLOR=red><A NAME="ref_53_7">Res</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A>; -+ <span class="symbol"><A NAME="ref_53_7">Res</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A>; - <b>begin</b> - <A HREF="terminal_interface-curses-forms-field_types-alpha__adb.htm#ref_53_7">Res</A> := <A HREF="terminal_interface-curses-forms-field_types-alpha__adb.htm#ref_49_16">Set_Fld_Type</A> (<A HREF="terminal_interface-curses-forms-field_types-alpha__adb.htm#ref_50_30">Arg1</A> =&gt; <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_46_12">C_Int</A> (<A HREF="terminal_interface-curses-forms-field_types-alpha__ads.htm#ref_50_30">Typ</A>.<A HREF="terminal_interface-curses-forms-field_types-alpha__ads.htm#ref_46_9">Minimum_Field_Width</A>)); - <b>if</b> <A HREF="terminal_interface-curses-forms-field_types-alpha__adb.htm#ref_53_7">Res</A> /= <A HREF="terminal_interface-curses-aux__ads.htm#ref_80_4">E_Ok</A> <b>then</b> -diff -Naur ncurses-5.9/doc/html/ada/terminal_interface-curses-forms-field_types-alpha__ads.htm ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-forms-field_types-alpha__ads.htm ---- ncurses-5.9/doc/html/ada/terminal_interface-curses-forms-field_types-alpha__ads.htm 2010-01-09 21:31:26.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-forms-field_types-alpha__ads.htm 2014-09-01 16:33:22.273791985 +0200 -@@ -1,58 +1,70 @@ --<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> --<HTML><HEAD><TITLE>terminal_interface-curses-forms-field_types-alpha.ads</TITLE></HEAD> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> -+<HTML> -+<HEAD> -+<TITLE>terminal_interface-curses-forms-field_types-alpha.ads</TITLE> -+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> -+<style type="text/css"> -+*.comment { -+ color: green; -+} -+*.symbol { -+ color: red; -+} -+</style> -+</HEAD> - <BODY> --<HR><DIV ALIGN="center"><H1> File : terminal_interface-curses-forms-field_types-alpha.ads </H1></DIV><HR> -+<HR><DIV style="text-align:center"><H1> File : terminal_interface-curses-forms-field_types-alpha.ads </H1></DIV><HR> - <PRE> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Terminal_Interface.Curses.Forms.Field_Types.Alpha --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- S P E C --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Copyright (c) 1998-2003,2009 Free Software Foundation, Inc. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></FONT> --<FONT COLOR=green><EM>-- copy of this software and associated documentation files (the --</EM></FONT> --<FONT COLOR=green><EM>-- "Software"), to deal in the Software without restriction, including --</EM></FONT> --<FONT COLOR=green><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></FONT> --<FONT COLOR=green><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></FONT> --<FONT COLOR=green><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></FONT> --<FONT COLOR=green><EM>-- furnished to do so, subject to the following conditions: --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- The above copyright notice and this permission notice shall be included --</EM></FONT> --<FONT COLOR=green><EM>-- in all copies or substantial portions of the Software. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></FONT> --<FONT COLOR=green><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></FONT> --<FONT COLOR=green><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></FONT> --<FONT COLOR=green><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></FONT> --<FONT COLOR=green><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></FONT> --<FONT COLOR=green><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></FONT> --<FONT COLOR=green><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></FONT> --<FONT COLOR=green><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></FONT> --<FONT COLOR=green><EM>-- sale, use or other dealings in this Software without prior written --</EM></FONT> --<FONT COLOR=green><EM>-- authorization. --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Author: Juergen Pfeifer, 1996</EM></FONT> --<FONT COLOR=green><EM>-- Version Control:</EM></FONT> --<FONT COLOR=green><EM>-- @Revision: 1.12 @</EM></FONT> --<FONT COLOR=green><EM>-- Binding Version 01.00</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<b>package</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-forms__ads.htm#ref_49_35">Forms</A>.<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_43_41">Field_Types</A>.<FONT COLOR=red><A NAME="ref_41_53" HREF="terminal_interface-curses-forms-field_types-alpha__adb.htm#ref_44_58">Alpha</A></FONT> <b>is</b> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Terminal_Interface.Curses.Forms.Field_Types.Alpha --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- S P E C --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Copyright (c) 1998-2003,2009 Free Software Foundation, Inc. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></span> -+<span class="comment"><EM>-- copy of this software and associated documentation files (the --</EM></span> -+<span class="comment"><EM>-- "Software"), to deal in the Software without restriction, including --</EM></span> -+<span class="comment"><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></span> -+<span class="comment"><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></span> -+<span class="comment"><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></span> -+<span class="comment"><EM>-- furnished to do so, subject to the following conditions: --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- The above copyright notice and this permission notice shall be included --</EM></span> -+<span class="comment"><EM>-- in all copies or substantial portions of the Software. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></span> -+<span class="comment"><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></span> -+<span class="comment"><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></span> -+<span class="comment"><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></span> -+<span class="comment"><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></span> -+<span class="comment"><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></span> -+<span class="comment"><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></span> -+<span class="comment"><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></span> -+<span class="comment"><EM>-- sale, use or other dealings in this Software without prior written --</EM></span> -+<span class="comment"><EM>-- authorization. --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Author: Juergen Pfeifer, 1996</EM></span> -+<span class="comment"><EM>-- Version Control:</EM></span> -+<span class="comment"><EM>-- @Revision: 1.12 @</EM></span> -+<span class="comment"><EM>-- Binding Version 01.00</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<b>package</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-forms__ads.htm#ref_49_35">Forms</A>.<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_43_41">Field_Types</A>.<span class="symbol"><A NAME="ref_41_53" HREF="terminal_interface-curses-forms-field_types-alpha__adb.htm#ref_44_58">Alpha</A></span> <b>is</b> - <b>pragma</b> Preelaborate (<A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-forms__ads.htm#ref_49_35">Forms</A>.<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_43_41">Field_Types</A>.<A HREF="terminal_interface-curses-forms-field_types-alpha__ads.htm#ref_41_53">Alpha</A>); - -- <b>type</b> <FONT COLOR=red><A NAME="ref_44_9">Alpha_Field</A></FONT> <b>is</b> <b>new</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_52_9">Field_Type</A> -+ <b>type</b> <span class="symbol"><A NAME="ref_44_9">Alpha_Field</A></span> <b>is</b> <b>new</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_52_9">Field_Type</A> - <b>with</b> <b>record</b> -- <FONT COLOR=red><A NAME="ref_46_9">Minimum_Field_Width</A></FONT> : Natural := 0; -+ <span class="symbol"><A NAME="ref_46_9">Minimum_Field_Width</A></span> : Natural := 0; - <b>end</b> <b>record</b>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_49_14" HREF="terminal_interface-curses-forms-field_types-alpha__adb.htm#ref_46_14">Set_Field_Type</A></FONT> (<FONT COLOR=red><A NAME="ref_49_30" HREF="terminal_interface-curses-forms-field_types-alpha__adb.htm#ref_46_30">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_50_30" HREF="terminal_interface-curses-forms-field_types-alpha__adb.htm#ref_47_30">Typ</A></FONT> : <A HREF="terminal_interface-curses-forms-field_types-alpha__ads.htm#ref_44_9">Alpha_Field</A>); -+ <b>procedure</b> <span class="symbol"><A NAME="ref_49_14" HREF="terminal_interface-curses-forms-field_types-alpha__adb.htm#ref_46_14">Set_Field_Type</A></span> (<span class="symbol"><A NAME="ref_49_30" HREF="terminal_interface-curses-forms-field_types-alpha__adb.htm#ref_46_30">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_50_30" HREF="terminal_interface-curses-forms-field_types-alpha__adb.htm#ref_47_30">Typ</A></span> : <A HREF="terminal_interface-curses-forms-field_types-alpha__ads.htm#ref_44_9">Alpha_Field</A>); - <b>pragma</b> Inline (Set_Field_Type); - - <b>end</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-forms__ads.htm#ref_49_35">Forms</A>.<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_43_41">Field_Types</A>.<A HREF="terminal_interface-curses-forms-field_types-alpha__ads.htm#ref_41_53">Alpha</A>; -diff -Naur ncurses-5.9/doc/html/ada/terminal_interface-curses-forms-field_types-alphanumeric__adb.htm ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-forms-field_types-alphanumeric__adb.htm ---- ncurses-5.9/doc/html/ada/terminal_interface-curses-forms-field_types-alphanumeric__adb.htm 2011-03-20 00:18:39.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-forms-field_types-alphanumeric__adb.htm 2014-09-01 16:33:22.273791985 +0200 -@@ -1,61 +1,73 @@ --<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> --<HTML><HEAD><TITLE>terminal_interface-curses-forms-field_types-alphanumeric.adb</TITLE></HEAD> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> -+<HTML> -+<HEAD> -+<TITLE>terminal_interface-curses-forms-field_types-alphanumeric.adb</TITLE> -+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> -+<style type="text/css"> -+*.comment { -+ color: green; -+} -+*.symbol { -+ color: red; -+} -+</style> -+</HEAD> - <BODY> --<HR><DIV ALIGN="center"><H1> File : terminal_interface-curses-forms-field_types-alphanumeric.adb </H1></DIV><HR> -+<HR><DIV style="text-align:center"><H1> File : terminal_interface-curses-forms-field_types-alphanumeric.adb </H1></DIV><HR> - <PRE> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Terminal_Interface.Curses.Forms.Field_Types.AlphaNumeric --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- B O D Y --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Copyright (c) 1998-2009,2011 Free Software Foundation, Inc. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></FONT> --<FONT COLOR=green><EM>-- copy of this software and associated documentation files (the --</EM></FONT> --<FONT COLOR=green><EM>-- "Software"), to deal in the Software without restriction, including --</EM></FONT> --<FONT COLOR=green><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></FONT> --<FONT COLOR=green><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></FONT> --<FONT COLOR=green><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></FONT> --<FONT COLOR=green><EM>-- furnished to do so, subject to the following conditions: --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- The above copyright notice and this permission notice shall be included --</EM></FONT> --<FONT COLOR=green><EM>-- in all copies or substantial portions of the Software. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></FONT> --<FONT COLOR=green><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></FONT> --<FONT COLOR=green><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></FONT> --<FONT COLOR=green><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></FONT> --<FONT COLOR=green><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></FONT> --<FONT COLOR=green><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></FONT> --<FONT COLOR=green><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></FONT> --<FONT COLOR=green><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></FONT> --<FONT COLOR=green><EM>-- sale, use or other dealings in this Software without prior written --</EM></FONT> --<FONT COLOR=green><EM>-- authorization. --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Author: Juergen Pfeifer, 1996</EM></FONT> --<FONT COLOR=green><EM>-- Version Control:</EM></FONT> --<FONT COLOR=green><EM>-- @Revision: 1.11 @</EM></FONT> --<FONT COLOR=green><EM>-- @Date: 2011/03/19 00:45:37 @</EM></FONT> --<FONT COLOR=green><EM>-- Binding Version 01.00</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Terminal_Interface.Curses.Forms.Field_Types.AlphaNumeric --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- B O D Y --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Copyright (c) 1998-2009,2011 Free Software Foundation, Inc. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></span> -+<span class="comment"><EM>-- copy of this software and associated documentation files (the --</EM></span> -+<span class="comment"><EM>-- "Software"), to deal in the Software without restriction, including --</EM></span> -+<span class="comment"><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></span> -+<span class="comment"><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></span> -+<span class="comment"><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></span> -+<span class="comment"><EM>-- furnished to do so, subject to the following conditions: --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- The above copyright notice and this permission notice shall be included --</EM></span> -+<span class="comment"><EM>-- in all copies or substantial portions of the Software. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></span> -+<span class="comment"><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></span> -+<span class="comment"><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></span> -+<span class="comment"><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></span> -+<span class="comment"><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></span> -+<span class="comment"><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></span> -+<span class="comment"><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></span> -+<span class="comment"><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></span> -+<span class="comment"><EM>-- sale, use or other dealings in this Software without prior written --</EM></span> -+<span class="comment"><EM>-- authorization. --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Author: Juergen Pfeifer, 1996</EM></span> -+<span class="comment"><EM>-- Version Control:</EM></span> -+<span class="comment"><EM>-- @Revision: 1.11 @</EM></span> -+<span class="comment"><EM>-- @Date: 2011/03/19 00:45:37 @</EM></span> -+<span class="comment"><EM>-- Binding Version 01.00</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> - <b>with</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-aux__ads.htm#ref_50_35">Aux</A>; <b>use</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-aux__ads.htm#ref_50_35">Aux</A>; - --<b>package</b> <b>body</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-forms__ads.htm#ref_49_35">Forms</A>.<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_43_41">Field_Types</A>.<FONT COLOR=red><A NAME="ref_44_58" HREF="terminal_interface-curses-forms-field_types-alphanumeric__ads.htm#ref_41_53">AlphaNumeric</A></FONT> <b>is</b> -+<b>package</b> <b>body</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-forms__ads.htm#ref_49_35">Forms</A>.<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_43_41">Field_Types</A>.<span class="symbol"><A NAME="ref_44_58" HREF="terminal_interface-curses-forms-field_types-alphanumeric__ads.htm#ref_41_53">AlphaNumeric</A></span> <b>is</b> - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_46_14" HREF="terminal_interface-curses-forms-field_types-alphanumeric__ads.htm#ref_50_14">Set_Field_Type</A></FONT> (<FONT COLOR=red><A NAME="ref_46_30" HREF="terminal_interface-curses-forms-field_types-alphanumeric__ads.htm#ref_50_30">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_47_30" HREF="terminal_interface-curses-forms-field_types-alphanumeric__ads.htm#ref_51_30">Typ</A></FONT> : <A HREF="terminal_interface-curses-forms-field_types-alphanumeric__ads.htm#ref_45_9">AlphaNumeric_Field</A>) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_46_14" HREF="terminal_interface-curses-forms-field_types-alphanumeric__ads.htm#ref_50_14">Set_Field_Type</A></span> (<span class="symbol"><A NAME="ref_46_30" HREF="terminal_interface-curses-forms-field_types-alphanumeric__ads.htm#ref_50_30">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_47_30" HREF="terminal_interface-curses-forms-field_types-alphanumeric__ads.htm#ref_51_30">Typ</A></span> : <A HREF="terminal_interface-curses-forms-field_types-alphanumeric__ads.htm#ref_45_9">AlphaNumeric_Field</A>) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_49_16">Set_Fld_Type</A></FONT> (<FONT COLOR=red><A NAME="ref_49_30" HREF="terminal_interface-curses-forms-field_types-alphanumeric__adb.htm#ref_49_16">F</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A> := <A HREF="terminal_interface-curses-forms-field_types-alphanumeric__ads.htm#ref_50_30">Fld</A>; -- <FONT COLOR=red><A NAME="ref_50_30" HREF="terminal_interface-curses-forms-field_types-alphanumeric__adb.htm#ref_49_16">Arg1</A></FONT> : <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_46_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_46_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_49_16">Set_Fld_Type</A></span> (<span class="symbol"><A NAME="ref_49_30" HREF="terminal_interface-curses-forms-field_types-alphanumeric__adb.htm#ref_49_16">F</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A> := <A HREF="terminal_interface-curses-forms-field_types-alphanumeric__ads.htm#ref_50_30">Fld</A>; -+ <span class="symbol"><A NAME="ref_50_30" HREF="terminal_interface-curses-forms-field_types-alphanumeric__adb.htm#ref_49_16">Arg1</A></span> : <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_46_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_46_12">C_Int</A>; - <b>pragma</b> Import (C, Set_Fld_Type, "set_field_type_alnum"); - -- <FONT COLOR=red><A NAME="ref_53_7">Res</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A>; -+ <span class="symbol"><A NAME="ref_53_7">Res</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A>; - <b>begin</b> - <A HREF="terminal_interface-curses-forms-field_types-alphanumeric__adb.htm#ref_53_7">Res</A> := <A HREF="terminal_interface-curses-forms-field_types-alphanumeric__adb.htm#ref_49_16">Set_Fld_Type</A> (<A HREF="terminal_interface-curses-forms-field_types-alphanumeric__adb.htm#ref_50_30">Arg1</A> =&gt; <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_46_12">C_Int</A> (<A HREF="terminal_interface-curses-forms-field_types-alphanumeric__ads.htm#ref_51_30">Typ</A>.<A HREF="terminal_interface-curses-forms-field_types-alphanumeric__ads.htm#ref_47_9">Minimum_Field_Width</A>)); - <b>if</b> <A HREF="terminal_interface-curses-forms-field_types-alphanumeric__adb.htm#ref_53_7">Res</A> /= <A HREF="terminal_interface-curses-aux__ads.htm#ref_80_4">E_Ok</A> <b>then</b> -diff -Naur ncurses-5.9/doc/html/ada/terminal_interface-curses-forms-field_types-alphanumeric__ads.htm ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-forms-field_types-alphanumeric__ads.htm ---- ncurses-5.9/doc/html/ada/terminal_interface-curses-forms-field_types-alphanumeric__ads.htm 2010-01-09 21:31:26.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-forms-field_types-alphanumeric__ads.htm 2014-09-01 16:33:22.274791986 +0200 -@@ -1,59 +1,71 @@ --<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> --<HTML><HEAD><TITLE>terminal_interface-curses-forms-field_types-alphanumeric.ads</TITLE></HEAD> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> -+<HTML> -+<HEAD> -+<TITLE>terminal_interface-curses-forms-field_types-alphanumeric.ads</TITLE> -+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> -+<style type="text/css"> -+*.comment { -+ color: green; -+} -+*.symbol { -+ color: red; -+} -+</style> -+</HEAD> - <BODY> --<HR><DIV ALIGN="center"><H1> File : terminal_interface-curses-forms-field_types-alphanumeric.ads </H1></DIV><HR> -+<HR><DIV style="text-align:center"><H1> File : terminal_interface-curses-forms-field_types-alphanumeric.ads </H1></DIV><HR> - <PRE> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Terminal_Interface.Curses.Forms.Field_Types.AlphaNumeric --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- S P E C --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Copyright (c) 1998-2003,2009 Free Software Foundation, Inc. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></FONT> --<FONT COLOR=green><EM>-- copy of this software and associated documentation files (the --</EM></FONT> --<FONT COLOR=green><EM>-- "Software"), to deal in the Software without restriction, including --</EM></FONT> --<FONT COLOR=green><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></FONT> --<FONT COLOR=green><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></FONT> --<FONT COLOR=green><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></FONT> --<FONT COLOR=green><EM>-- furnished to do so, subject to the following conditions: --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- The above copyright notice and this permission notice shall be included --</EM></FONT> --<FONT COLOR=green><EM>-- in all copies or substantial portions of the Software. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></FONT> --<FONT COLOR=green><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></FONT> --<FONT COLOR=green><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></FONT> --<FONT COLOR=green><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></FONT> --<FONT COLOR=green><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></FONT> --<FONT COLOR=green><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></FONT> --<FONT COLOR=green><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></FONT> --<FONT COLOR=green><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></FONT> --<FONT COLOR=green><EM>-- sale, use or other dealings in this Software without prior written --</EM></FONT> --<FONT COLOR=green><EM>-- authorization. --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Author: Juergen Pfeifer, 1996</EM></FONT> --<FONT COLOR=green><EM>-- Version Control:</EM></FONT> --<FONT COLOR=green><EM>-- @Revision: 1.12 @</EM></FONT> --<FONT COLOR=green><EM>-- Binding Version 01.00</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<b>package</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-forms__ads.htm#ref_49_35">Forms</A>.<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_43_41">Field_Types</A>.<FONT COLOR=red><A NAME="ref_41_53" HREF="terminal_interface-curses-forms-field_types-alphanumeric__adb.htm#ref_44_58">AlphaNumeric</A></FONT> <b>is</b> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Terminal_Interface.Curses.Forms.Field_Types.AlphaNumeric --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- S P E C --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Copyright (c) 1998-2003,2009 Free Software Foundation, Inc. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></span> -+<span class="comment"><EM>-- copy of this software and associated documentation files (the --</EM></span> -+<span class="comment"><EM>-- "Software"), to deal in the Software without restriction, including --</EM></span> -+<span class="comment"><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></span> -+<span class="comment"><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></span> -+<span class="comment"><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></span> -+<span class="comment"><EM>-- furnished to do so, subject to the following conditions: --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- The above copyright notice and this permission notice shall be included --</EM></span> -+<span class="comment"><EM>-- in all copies or substantial portions of the Software. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></span> -+<span class="comment"><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></span> -+<span class="comment"><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></span> -+<span class="comment"><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></span> -+<span class="comment"><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></span> -+<span class="comment"><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></span> -+<span class="comment"><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></span> -+<span class="comment"><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></span> -+<span class="comment"><EM>-- sale, use or other dealings in this Software without prior written --</EM></span> -+<span class="comment"><EM>-- authorization. --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Author: Juergen Pfeifer, 1996</EM></span> -+<span class="comment"><EM>-- Version Control:</EM></span> -+<span class="comment"><EM>-- @Revision: 1.12 @</EM></span> -+<span class="comment"><EM>-- Binding Version 01.00</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<b>package</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-forms__ads.htm#ref_49_35">Forms</A>.<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_43_41">Field_Types</A>.<span class="symbol"><A NAME="ref_41_53" HREF="terminal_interface-curses-forms-field_types-alphanumeric__adb.htm#ref_44_58">AlphaNumeric</A></span> <b>is</b> - <b>pragma</b> Preelaborate - (<A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-forms__ads.htm#ref_49_35">Forms</A>.<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_43_41">Field_Types</A>.<A HREF="terminal_interface-curses-forms-field_types-alphanumeric__ads.htm#ref_41_53">AlphaNumeric</A>); - -- <b>type</b> <FONT COLOR=red><A NAME="ref_45_9">AlphaNumeric_Field</A></FONT> <b>is</b> <b>new</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_52_9">Field_Type</A> -+ <b>type</b> <span class="symbol"><A NAME="ref_45_9">AlphaNumeric_Field</A></span> <b>is</b> <b>new</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_52_9">Field_Type</A> - <b>with</b> <b>record</b> -- <FONT COLOR=red><A NAME="ref_47_9">Minimum_Field_Width</A></FONT> : Natural := 0; -+ <span class="symbol"><A NAME="ref_47_9">Minimum_Field_Width</A></span> : Natural := 0; - <b>end</b> <b>record</b>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_50_14" HREF="terminal_interface-curses-forms-field_types-alphanumeric__adb.htm#ref_46_14">Set_Field_Type</A></FONT> (<FONT COLOR=red><A NAME="ref_50_30" HREF="terminal_interface-curses-forms-field_types-alphanumeric__adb.htm#ref_46_30">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_51_30" HREF="terminal_interface-curses-forms-field_types-alphanumeric__adb.htm#ref_47_30">Typ</A></FONT> : <A HREF="terminal_interface-curses-forms-field_types-alphanumeric__ads.htm#ref_45_9">AlphaNumeric_Field</A>); -+ <b>procedure</b> <span class="symbol"><A NAME="ref_50_14" HREF="terminal_interface-curses-forms-field_types-alphanumeric__adb.htm#ref_46_14">Set_Field_Type</A></span> (<span class="symbol"><A NAME="ref_50_30" HREF="terminal_interface-curses-forms-field_types-alphanumeric__adb.htm#ref_46_30">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_51_30" HREF="terminal_interface-curses-forms-field_types-alphanumeric__adb.htm#ref_47_30">Typ</A></span> : <A HREF="terminal_interface-curses-forms-field_types-alphanumeric__ads.htm#ref_45_9">AlphaNumeric_Field</A>); - <b>pragma</b> Inline (Set_Field_Type); - - <b>end</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-forms__ads.htm#ref_49_35">Forms</A>.<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_43_41">Field_Types</A>.<A HREF="terminal_interface-curses-forms-field_types-alphanumeric__ads.htm#ref_41_53">AlphaNumeric</A>; -diff -Naur ncurses-5.9/doc/html/ada/terminal_interface-curses-forms-field_types-enumeration-ada__adb.htm ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-forms-field_types-enumeration-ada__adb.htm ---- ncurses-5.9/doc/html/ada/terminal_interface-curses-forms-field_types-enumeration-ada__adb.htm 2011-03-26 22:54:29.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-forms-field_types-enumeration-ada__adb.htm 2014-09-01 16:33:22.274791986 +0200 -@@ -1,68 +1,80 @@ --<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> --<HTML><HEAD><TITLE>terminal_interface-curses-forms-field_types-enumeration-ada.adb</TITLE></HEAD> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> -+<HTML> -+<HEAD> -+<TITLE>terminal_interface-curses-forms-field_types-enumeration-ada.adb</TITLE> -+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> -+<style type="text/css"> -+*.comment { -+ color: green; -+} -+*.symbol { -+ color: red; -+} -+</style> -+</HEAD> - <BODY> --<HR><DIV ALIGN="center"><H1> File : terminal_interface-curses-forms-field_types-enumeration-ada.adb </H1></DIV><HR> -+<HR><DIV style="text-align:center"><H1> File : terminal_interface-curses-forms-field_types-enumeration-ada.adb </H1></DIV><HR> - <PRE> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Terminal_Interface.Curses.Forms.Field_Types.Enumeration.Ada --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- B O D Y --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Copyright (c) 1998-2004,2011 Free Software Foundation, Inc. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></FONT> --<FONT COLOR=green><EM>-- copy of this software and associated documentation files (the --</EM></FONT> --<FONT COLOR=green><EM>-- "Software"), to deal in the Software without restriction, including --</EM></FONT> --<FONT COLOR=green><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></FONT> --<FONT COLOR=green><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></FONT> --<FONT COLOR=green><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></FONT> --<FONT COLOR=green><EM>-- furnished to do so, subject to the following conditions: --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- The above copyright notice and this permission notice shall be included --</EM></FONT> --<FONT COLOR=green><EM>-- in all copies or substantial portions of the Software. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></FONT> --<FONT COLOR=green><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></FONT> --<FONT COLOR=green><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></FONT> --<FONT COLOR=green><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></FONT> --<FONT COLOR=green><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></FONT> --<FONT COLOR=green><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></FONT> --<FONT COLOR=green><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></FONT> --<FONT COLOR=green><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></FONT> --<FONT COLOR=green><EM>-- sale, use or other dealings in this Software without prior written --</EM></FONT> --<FONT COLOR=green><EM>-- authorization. --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Author: Juergen Pfeifer, 1996</EM></FONT> --<FONT COLOR=green><EM>-- Version Control:</EM></FONT> --<FONT COLOR=green><EM>-- @Revision: 1.11 @</EM></FONT> --<FONT COLOR=green><EM>-- @Date: 2011/03/22 23:36:20 @</EM></FONT> --<FONT COLOR=green><EM>-- Binding Version 01.00</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Terminal_Interface.Curses.Forms.Field_Types.Enumeration.Ada --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- B O D Y --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Copyright (c) 1998-2004,2011 Free Software Foundation, Inc. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></span> -+<span class="comment"><EM>-- copy of this software and associated documentation files (the --</EM></span> -+<span class="comment"><EM>-- "Software"), to deal in the Software without restriction, including --</EM></span> -+<span class="comment"><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></span> -+<span class="comment"><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></span> -+<span class="comment"><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></span> -+<span class="comment"><EM>-- furnished to do so, subject to the following conditions: --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- The above copyright notice and this permission notice shall be included --</EM></span> -+<span class="comment"><EM>-- in all copies or substantial portions of the Software. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></span> -+<span class="comment"><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></span> -+<span class="comment"><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></span> -+<span class="comment"><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></span> -+<span class="comment"><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></span> -+<span class="comment"><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></span> -+<span class="comment"><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></span> -+<span class="comment"><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></span> -+<span class="comment"><EM>-- sale, use or other dealings in this Software without prior written --</EM></span> -+<span class="comment"><EM>-- authorization. --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Author: Juergen Pfeifer, 1996</EM></span> -+<span class="comment"><EM>-- Version Control:</EM></span> -+<span class="comment"><EM>-- @Revision: 1.11 @</EM></span> -+<span class="comment"><EM>-- @Date: 2011/03/22 23:36:20 @</EM></span> -+<span class="comment"><EM>-- Binding Version 01.00</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> - <b>with</b> Ada.Characters.Handling; <b>use</b> Ada.Characters.Handling; - --<b>package</b> <b>body</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-forms__ads.htm#ref_49_35">Forms</A>.<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_43_41">Field_Types</A>.<A HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_43_53">Enumeration</A>.<FONT COLOR=red><A NAME="ref_44_70" HREF="terminal_interface-curses-forms-field_types-enumeration-ada__ads.htm#ref_44_65">Ada</A></FONT> <b>is</b> -+<b>package</b> <b>body</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-forms__ads.htm#ref_49_35">Forms</A>.<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_43_41">Field_Types</A>.<A HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_43_53">Enumeration</A>.<span class="symbol"><A NAME="ref_44_70" HREF="terminal_interface-curses-forms-field_types-enumeration-ada__ads.htm#ref_44_65">Ada</A></span> <b>is</b> - -- <b>function</b> <FONT COLOR=red><A NAME="ref_46_13" HREF="terminal_interface-curses-forms-field_types-enumeration-ada__ads.htm#ref_48_13">Create</A></FONT> (<FONT COLOR=red><A NAME="ref_46_21" HREF="terminal_interface-curses-forms-field_types-enumeration-ada__ads.htm#ref_48_21">Set</A></FONT> : <A HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_50_9">Type_Set</A> := <A HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_50_46">Mixed_Case</A>; -- <FONT COLOR=red><A NAME="ref_47_21" HREF="terminal_interface-curses-forms-field_types-enumeration-ada__ads.htm#ref_49_21">Case_Sensitive</A></FONT> : Boolean := False; -- <FONT COLOR=red><A NAME="ref_48_21" HREF="terminal_interface-curses-forms-field_types-enumeration-ada__ads.htm#ref_50_21">Must_Be_Unique</A></FONT> : Boolean := False) -+ <b>function</b> <span class="symbol"><A NAME="ref_46_13" HREF="terminal_interface-curses-forms-field_types-enumeration-ada__ads.htm#ref_48_13">Create</A></span> (<span class="symbol"><A NAME="ref_46_21" HREF="terminal_interface-curses-forms-field_types-enumeration-ada__ads.htm#ref_48_21">Set</A></span> : <A HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_50_9">Type_Set</A> := <A HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_50_46">Mixed_Case</A>; -+ <span class="symbol"><A NAME="ref_47_21" HREF="terminal_interface-curses-forms-field_types-enumeration-ada__ads.htm#ref_49_21">Case_Sensitive</A></span> : Boolean := False; -+ <span class="symbol"><A NAME="ref_48_21" HREF="terminal_interface-curses-forms-field_types-enumeration-ada__ads.htm#ref_50_21">Must_Be_Unique</A></span> : Boolean := False) - <b>return</b> <A HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_62_9">Enumeration_Field</A> - <b>is</b> -- <FONT COLOR=red><A NAME="ref_51_7">I</A></FONT> : <A HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_55_9">Enumeration_Info</A> (<A HREF="terminal_interface-curses-forms-field_types-enumeration-ada__ads.htm#ref_42_9">T</A>'Pos (<A HREF="terminal_interface-curses-forms-field_types-enumeration-ada__ads.htm#ref_42_9">T</A>'Last) - <A HREF="terminal_interface-curses-forms-field_types-enumeration-ada__ads.htm#ref_42_9">T</A>'Pos (<A HREF="terminal_interface-curses-forms-field_types-enumeration-ada__ads.htm#ref_42_9">T</A>'First) + 1); -- <FONT COLOR=red><A NAME="ref_52_7">J</A></FONT> : Positive := 1; -+ <span class="symbol"><A NAME="ref_51_7">I</A></span> : <A HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_55_9">Enumeration_Info</A> (<A HREF="terminal_interface-curses-forms-field_types-enumeration-ada__ads.htm#ref_42_9">T</A>'Pos (<A HREF="terminal_interface-curses-forms-field_types-enumeration-ada__ads.htm#ref_42_9">T</A>'Last) - <A HREF="terminal_interface-curses-forms-field_types-enumeration-ada__ads.htm#ref_42_9">T</A>'Pos (<A HREF="terminal_interface-curses-forms-field_types-enumeration-ada__ads.htm#ref_42_9">T</A>'First) + 1); -+ <span class="symbol"><A NAME="ref_52_7">J</A></span> : Positive := 1; - <b>begin</b> - <A HREF="terminal_interface-curses-forms-field_types-enumeration-ada__adb.htm#ref_51_7">I</A>.<A HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_58_10">Case_Sensitive</A> := <A HREF="terminal_interface-curses-forms-field_types-enumeration-ada__ads.htm#ref_49_21">Case_Sensitive</A>; - <A HREF="terminal_interface-curses-forms-field_types-enumeration-ada__adb.htm#ref_51_7">I</A>.<A HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_59_10">Match_Must_Be_Unique</A> := <A HREF="terminal_interface-curses-forms-field_types-enumeration-ada__ads.htm#ref_50_21">Must_Be_Unique</A>; - -- <b>for</b> <FONT COLOR=red><A NAME="ref_57_11">E</A></FONT> <b>in</b> <A HREF="terminal_interface-curses-forms-field_types-enumeration-ada__ads.htm#ref_42_9">T</A>'<b>Range</b> <b>loop</b> -+ <b>for</b> <span class="symbol"><A NAME="ref_57_11">E</A></span> <b>in</b> <A HREF="terminal_interface-curses-forms-field_types-enumeration-ada__ads.htm#ref_42_9">T</A>'<b>Range</b> <b>loop</b> - <A HREF="terminal_interface-curses-forms-field_types-enumeration-ada__adb.htm#ref_51_7">I</A>.<A HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_57_10">Names</A> (<A HREF="terminal_interface-curses-forms-field_types-enumeration-ada__adb.htm#ref_52_7">J</A>) := <b>new</b> String'(<A HREF="terminal_interface-curses-forms-field_types-enumeration-ada__ads.htm#ref_42_9">T</A>'Image (<A HREF="terminal_interface-curses-forms-field_types-enumeration-ada__adb.htm#ref_57_11">E</A>)); -- <FONT COLOR=green><EM>-- The Image attribute defaults to upper case, so we have to handle</EM></FONT> -- <FONT COLOR=green><EM>-- only the other ones...</EM></FONT> -+ <span class="comment"><EM>-- The Image attribute defaults to upper case, so we have to handle</EM></span> -+ <span class="comment"><EM>-- only the other ones...</EM></span> - <b>if</b> <A HREF="terminal_interface-curses-forms-field_types-enumeration-ada__ads.htm#ref_48_21">Set</A> /= <A HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_50_34">Upper_Case</A> <b>then</b> - <A HREF="terminal_interface-curses-forms-field_types-enumeration-ada__adb.htm#ref_51_7">I</A>.<A HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_57_10">Names</A> (<A HREF="terminal_interface-curses-forms-field_types-enumeration-ada__adb.htm#ref_52_7">J</A>).<b>all</b> := To_Lower (<A HREF="terminal_interface-curses-forms-field_types-enumeration-ada__adb.htm#ref_51_7">I</A>.<A HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_57_10">Names</A> (<A HREF="terminal_interface-curses-forms-field_types-enumeration-ada__adb.htm#ref_52_7">J</A>).<b>all</b>); - <b>if</b> <A HREF="terminal_interface-curses-forms-field_types-enumeration-ada__ads.htm#ref_48_21">Set</A> = <A HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_50_46">Mixed_Case</A> <b>then</b> -@@ -76,11 +88,11 @@ - <b>return</b> <A HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_64_13">Create</A> (<A HREF="terminal_interface-curses-forms-field_types-enumeration-ada__adb.htm#ref_51_7">I</A>, True); - <b>end</b> <A HREF="terminal_interface-curses-forms-field_types-enumeration-ada__ads.htm#ref_48_13">Create</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_74_13" HREF="terminal_interface-curses-forms-field_types-enumeration-ada__ads.htm#ref_53_13">Value</A></FONT> (<FONT COLOR=red><A NAME="ref_74_20" HREF="terminal_interface-curses-forms-field_types-enumeration-ada__ads.htm#ref_53_20">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_75_20" HREF="terminal_interface-curses-forms-field_types-enumeration-ada__ads.htm#ref_54_20">Buf</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_133_9">Buffer_Number</A> := <A HREF="terminal_interface-curses-forms__ads.htm#ref_133_9">Buffer_Number</A>'First) <b>return</b> <A HREF="terminal_interface-curses-forms-field_types-enumeration-ada__ads.htm#ref_42_9">T</A> -+ <b>function</b> <span class="symbol"><A NAME="ref_74_13" HREF="terminal_interface-curses-forms-field_types-enumeration-ada__ads.htm#ref_53_13">Value</A></span> (<span class="symbol"><A NAME="ref_74_20" HREF="terminal_interface-curses-forms-field_types-enumeration-ada__ads.htm#ref_53_20">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_75_20" HREF="terminal_interface-curses-forms-field_types-enumeration-ada__ads.htm#ref_54_20">Buf</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_131_9">Buffer_Number</A> := <A HREF="terminal_interface-curses-forms__ads.htm#ref_131_9">Buffer_Number</A>'First) <b>return</b> <A HREF="terminal_interface-curses-forms-field_types-enumeration-ada__ads.htm#ref_42_9">T</A> - <b>is</b> - <b>begin</b> -- <b>return</b> <A HREF="terminal_interface-curses-forms-field_types-enumeration-ada__ads.htm#ref_42_9">T</A>'Value (<A HREF="terminal_interface-curses-forms__ads.htm#ref_372_13">Get_Buffer</A> (<A HREF="terminal_interface-curses-forms-field_types-enumeration-ada__ads.htm#ref_53_20">Fld</A>, <A HREF="terminal_interface-curses-forms-field_types-enumeration-ada__ads.htm#ref_54_20">Buf</A>)); -+ <b>return</b> <A HREF="terminal_interface-curses-forms-field_types-enumeration-ada__ads.htm#ref_42_9">T</A>'Value (<A HREF="terminal_interface-curses-forms__ads.htm#ref_370_13">Get_Buffer</A> (<A HREF="terminal_interface-curses-forms-field_types-enumeration-ada__ads.htm#ref_53_20">Fld</A>, <A HREF="terminal_interface-curses-forms-field_types-enumeration-ada__ads.htm#ref_54_20">Buf</A>)); - <b>end</b> <A HREF="terminal_interface-curses-forms-field_types-enumeration-ada__ads.htm#ref_53_13">Value</A>; - - <b>end</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-forms__ads.htm#ref_49_35">Forms</A>.<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_43_41">Field_Types</A>.<A HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_43_53">Enumeration</A>.<A HREF="terminal_interface-curses-forms-field_types-enumeration-ada__ads.htm#ref_44_65">Ada</A>; -diff -Naur ncurses-5.9/doc/html/ada/terminal_interface-curses-forms-field_types-enumeration-ada__ads.htm ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-forms-field_types-enumeration-ada__ads.htm ---- ncurses-5.9/doc/html/ada/terminal_interface-curses-forms-field_types-enumeration-ada__ads.htm 2011-03-20 00:18:39.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-forms-field_types-enumeration-ada__ads.htm 2014-09-01 16:33:22.274791986 +0200 -@@ -1,65 +1,77 @@ --<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> --<HTML><HEAD><TITLE>terminal_interface-curses-forms-field_types-enumeration-ada.ads</TITLE></HEAD> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> -+<HTML> -+<HEAD> -+<TITLE>terminal_interface-curses-forms-field_types-enumeration-ada.ads</TITLE> -+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> -+<style type="text/css"> -+*.comment { -+ color: green; -+} -+*.symbol { -+ color: red; -+} -+</style> -+</HEAD> - <BODY> --<HR><DIV ALIGN="center"><H1> File : terminal_interface-curses-forms-field_types-enumeration-ada.ads </H1></DIV><HR> -+<HR><DIV style="text-align:center"><H1> File : terminal_interface-curses-forms-field_types-enumeration-ada.ads </H1></DIV><HR> - <PRE> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Terminal_Interface.Curses.Forms.Field_Types.Enumeration.Ada --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- S P E C --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Copyright (c) 1998 Free Software Foundation, Inc. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></FONT> --<FONT COLOR=green><EM>-- copy of this software and associated documentation files (the --</EM></FONT> --<FONT COLOR=green><EM>-- "Software"), to deal in the Software without restriction, including --</EM></FONT> --<FONT COLOR=green><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></FONT> --<FONT COLOR=green><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></FONT> --<FONT COLOR=green><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></FONT> --<FONT COLOR=green><EM>-- furnished to do so, subject to the following conditions: --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- The above copyright notice and this permission notice shall be included --</EM></FONT> --<FONT COLOR=green><EM>-- in all copies or substantial portions of the Software. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></FONT> --<FONT COLOR=green><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></FONT> --<FONT COLOR=green><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></FONT> --<FONT COLOR=green><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></FONT> --<FONT COLOR=green><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></FONT> --<FONT COLOR=green><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></FONT> --<FONT COLOR=green><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></FONT> --<FONT COLOR=green><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></FONT> --<FONT COLOR=green><EM>-- sale, use or other dealings in this Software without prior written --</EM></FONT> --<FONT COLOR=green><EM>-- authorization. --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Author: Juergen Pfeifer, 1996</EM></FONT> --<FONT COLOR=green><EM>-- Version Control:</EM></FONT> --<FONT COLOR=green><EM>-- @Revision: 1.10 @</EM></FONT> --<FONT COLOR=green><EM>-- Binding Version 01.00</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Terminal_Interface.Curses.Forms.Field_Types.Enumeration.Ada --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- S P E C --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Copyright (c) 1998 Free Software Foundation, Inc. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></span> -+<span class="comment"><EM>-- copy of this software and associated documentation files (the --</EM></span> -+<span class="comment"><EM>-- "Software"), to deal in the Software without restriction, including --</EM></span> -+<span class="comment"><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></span> -+<span class="comment"><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></span> -+<span class="comment"><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></span> -+<span class="comment"><EM>-- furnished to do so, subject to the following conditions: --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- The above copyright notice and this permission notice shall be included --</EM></span> -+<span class="comment"><EM>-- in all copies or substantial portions of the Software. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></span> -+<span class="comment"><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></span> -+<span class="comment"><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></span> -+<span class="comment"><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></span> -+<span class="comment"><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></span> -+<span class="comment"><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></span> -+<span class="comment"><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></span> -+<span class="comment"><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></span> -+<span class="comment"><EM>-- sale, use or other dealings in this Software without prior written --</EM></span> -+<span class="comment"><EM>-- authorization. --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Author: Juergen Pfeifer, 1996</EM></span> -+<span class="comment"><EM>-- Version Control:</EM></span> -+<span class="comment"><EM>-- @Revision: 1.10 @</EM></span> -+<span class="comment"><EM>-- Binding Version 01.00</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> - <b>generic</b> -- <b>type</b> <FONT COLOR=red><A NAME="ref_42_9" HREF="terminal_interface-curses-forms-field_types-enumeration-ada__ads.htm#ref_44_65">T</A></FONT> <b>is</b> (&lt;&gt;); -+ <b>type</b> <span class="symbol"><A NAME="ref_42_9" HREF="terminal_interface-curses-forms-field_types-enumeration-ada__ads.htm#ref_44_65">T</A></span> <b>is</b> (&lt;&gt;); - --<b>package</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-forms__ads.htm#ref_49_35">Forms</A>.<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_43_41">Field_Types</A>.<A HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_43_53">Enumeration</A>.<FONT COLOR=red><A NAME="ref_44_65" HREF="terminal_interface-curses-forms-field_types-enumeration-ada__adb.htm#ref_44_70">Ada</A></FONT> <b>is</b> -+<b>package</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-forms__ads.htm#ref_49_35">Forms</A>.<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_43_41">Field_Types</A>.<A HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_43_53">Enumeration</A>.<span class="symbol"><A NAME="ref_44_65" HREF="terminal_interface-curses-forms-field_types-enumeration-ada__adb.htm#ref_44_70">Ada</A></span> <b>is</b> - <b>pragma</b> Preelaborate - (<A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-forms__ads.htm#ref_49_35">Forms</A>.<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_43_41">Field_Types</A>.<A HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_43_53">Enumeration</A>.<A HREF="terminal_interface-curses-forms-field_types-enumeration-ada__ads.htm#ref_44_65">Ada</A>); - -- <b>function</b> <FONT COLOR=red><A NAME="ref_48_13" HREF="terminal_interface-curses-forms-field_types-enumeration-ada__adb.htm#ref_46_13">Create</A></FONT> (<FONT COLOR=red><A NAME="ref_48_21" HREF="terminal_interface-curses-forms-field_types-enumeration-ada__adb.htm#ref_46_21">Set</A></FONT> : <A HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_50_9">Type_Set</A> := <A HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_50_46">Mixed_Case</A>; -- <FONT COLOR=red><A NAME="ref_49_21" HREF="terminal_interface-curses-forms-field_types-enumeration-ada__adb.htm#ref_47_21">Case_Sensitive</A></FONT> : Boolean := False; -- <FONT COLOR=red><A NAME="ref_50_21" HREF="terminal_interface-curses-forms-field_types-enumeration-ada__adb.htm#ref_48_21">Must_Be_Unique</A></FONT> : Boolean := False) -+ <b>function</b> <span class="symbol"><A NAME="ref_48_13" HREF="terminal_interface-curses-forms-field_types-enumeration-ada__adb.htm#ref_46_13">Create</A></span> (<span class="symbol"><A NAME="ref_48_21" HREF="terminal_interface-curses-forms-field_types-enumeration-ada__adb.htm#ref_46_21">Set</A></span> : <A HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_50_9">Type_Set</A> := <A HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_50_46">Mixed_Case</A>; -+ <span class="symbol"><A NAME="ref_49_21" HREF="terminal_interface-curses-forms-field_types-enumeration-ada__adb.htm#ref_47_21">Case_Sensitive</A></span> : Boolean := False; -+ <span class="symbol"><A NAME="ref_50_21" HREF="terminal_interface-curses-forms-field_types-enumeration-ada__adb.htm#ref_48_21">Must_Be_Unique</A></span> : Boolean := False) - <b>return</b> <A HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_62_9">Enumeration_Field</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_53_13" HREF="terminal_interface-curses-forms-field_types-enumeration-ada__adb.htm#ref_74_13">Value</A></FONT> (<FONT COLOR=red><A NAME="ref_53_20" HREF="terminal_interface-curses-forms-field_types-enumeration-ada__adb.htm#ref_74_20">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_54_20" HREF="terminal_interface-curses-forms-field_types-enumeration-ada__adb.htm#ref_75_20">Buf</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_133_9">Buffer_Number</A> := <A HREF="terminal_interface-curses-forms__ads.htm#ref_133_9">Buffer_Number</A>'First) <b>return</b> <A HREF="terminal_interface-curses-forms-field_types-enumeration-ada__ads.htm#ref_42_9">T</A>; -- <FONT COLOR=green><EM>-- Translate the content of the fields buffer - indicated by the</EM></FONT> -- <FONT COLOR=green><EM>-- buffer number - into an enumeration value. If the buffer is empty</EM></FONT> -- <FONT COLOR=green><EM>-- or the content is invalid, a Constraint_Error is raises.</EM></FONT> -+ <b>function</b> <span class="symbol"><A NAME="ref_53_13" HREF="terminal_interface-curses-forms-field_types-enumeration-ada__adb.htm#ref_74_13">Value</A></span> (<span class="symbol"><A NAME="ref_53_20" HREF="terminal_interface-curses-forms-field_types-enumeration-ada__adb.htm#ref_74_20">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_54_20" HREF="terminal_interface-curses-forms-field_types-enumeration-ada__adb.htm#ref_75_20">Buf</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_131_9">Buffer_Number</A> := <A HREF="terminal_interface-curses-forms__ads.htm#ref_131_9">Buffer_Number</A>'First) <b>return</b> <A HREF="terminal_interface-curses-forms-field_types-enumeration-ada__ads.htm#ref_42_9">T</A>; -+ <span class="comment"><EM>-- Translate the content of the fields buffer - indicated by the</EM></span> -+ <span class="comment"><EM>-- buffer number - into an enumeration value. If the buffer is empty</EM></span> -+ <span class="comment"><EM>-- or the content is invalid, a Constraint_Error is raises.</EM></span> - - <b>end</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-forms__ads.htm#ref_49_35">Forms</A>.<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_43_41">Field_Types</A>.<A HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_43_53">Enumeration</A>.<A HREF="terminal_interface-curses-forms-field_types-enumeration-ada__ads.htm#ref_44_65">Ada</A>; - </PRE></BODY></HTML> -diff -Naur ncurses-5.9/doc/html/ada/terminal_interface-curses-forms-field_types-enumeration__adb.htm ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-forms-field_types-enumeration__adb.htm ---- ncurses-5.9/doc/html/ada/terminal_interface-curses-forms-field_types-enumeration__adb.htm 2011-03-26 22:54:29.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-forms-field_types-enumeration__adb.htm 2014-09-01 16:33:22.275791988 +0200 -@@ -1,72 +1,84 @@ --<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> --<HTML><HEAD><TITLE>terminal_interface-curses-forms-field_types-enumeration.adb</TITLE></HEAD> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> -+<HTML> -+<HEAD> -+<TITLE>terminal_interface-curses-forms-field_types-enumeration.adb</TITLE> -+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> -+<style type="text/css"> -+*.comment { -+ color: green; -+} -+*.symbol { -+ color: red; -+} -+</style> -+</HEAD> - <BODY> --<HR><DIV ALIGN="center"><H1> File : terminal_interface-curses-forms-field_types-enumeration.adb </H1></DIV><HR> -+<HR><DIV style="text-align:center"><H1> File : terminal_interface-curses-forms-field_types-enumeration.adb </H1></DIV><HR> - <PRE> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Terminal_Interface.Curses.Forms.Field_Types.Enumeration --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- B O D Y --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Copyright (c) 1998-2009,2011 Free Software Foundation, Inc. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></FONT> --<FONT COLOR=green><EM>-- copy of this software and associated documentation files (the --</EM></FONT> --<FONT COLOR=green><EM>-- "Software"), to deal in the Software without restriction, including --</EM></FONT> --<FONT COLOR=green><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></FONT> --<FONT COLOR=green><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></FONT> --<FONT COLOR=green><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></FONT> --<FONT COLOR=green><EM>-- furnished to do so, subject to the following conditions: --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- The above copyright notice and this permission notice shall be included --</EM></FONT> --<FONT COLOR=green><EM>-- in all copies or substantial portions of the Software. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></FONT> --<FONT COLOR=green><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></FONT> --<FONT COLOR=green><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></FONT> --<FONT COLOR=green><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></FONT> --<FONT COLOR=green><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></FONT> --<FONT COLOR=green><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></FONT> --<FONT COLOR=green><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></FONT> --<FONT COLOR=green><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></FONT> --<FONT COLOR=green><EM>-- sale, use or other dealings in this Software without prior written --</EM></FONT> --<FONT COLOR=green><EM>-- authorization. --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Author: Juergen Pfeifer, 1996</EM></FONT> --<FONT COLOR=green><EM>-- Version Control:</EM></FONT> --<FONT COLOR=green><EM>-- @Revision: 1.10 @</EM></FONT> --<FONT COLOR=green><EM>-- Binding Version 01.00</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Terminal_Interface.Curses.Forms.Field_Types.Enumeration --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- B O D Y --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Copyright (c) 1998-2009,2011 Free Software Foundation, Inc. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></span> -+<span class="comment"><EM>-- copy of this software and associated documentation files (the --</EM></span> -+<span class="comment"><EM>-- "Software"), to deal in the Software without restriction, including --</EM></span> -+<span class="comment"><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></span> -+<span class="comment"><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></span> -+<span class="comment"><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></span> -+<span class="comment"><EM>-- furnished to do so, subject to the following conditions: --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- The above copyright notice and this permission notice shall be included --</EM></span> -+<span class="comment"><EM>-- in all copies or substantial portions of the Software. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></span> -+<span class="comment"><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></span> -+<span class="comment"><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></span> -+<span class="comment"><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></span> -+<span class="comment"><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></span> -+<span class="comment"><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></span> -+<span class="comment"><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></span> -+<span class="comment"><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></span> -+<span class="comment"><EM>-- sale, use or other dealings in this Software without prior written --</EM></span> -+<span class="comment"><EM>-- authorization. --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Author: Juergen Pfeifer, 1996</EM></span> -+<span class="comment"><EM>-- Version Control:</EM></span> -+<span class="comment"><EM>-- @Revision: 1.10 @</EM></span> -+<span class="comment"><EM>-- Binding Version 01.00</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> - <b>with</b> Ada.Unchecked_Deallocation; --<b>with</b> <A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>.C; <b>use</b> <A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>.C; --<b>with</b> <A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>.C.Strings; <b>use</b> <A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>.C.Strings; -+<b>with</b> <A HREF="interfac__ads.htm#ref_36_9">Interfaces</A>.C; <b>use</b> <A HREF="interfac__ads.htm#ref_36_9">Interfaces</A>.C; -+<b>with</b> <A HREF="interfac__ads.htm#ref_36_9">Interfaces</A>.C.Strings; <b>use</b> <A HREF="interfac__ads.htm#ref_36_9">Interfaces</A>.C.Strings; - <b>with</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-aux__ads.htm#ref_50_35">Aux</A>; <b>use</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-aux__ads.htm#ref_50_35">Aux</A>; - --<b>package</b> <b>body</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-forms__ads.htm#ref_49_35">Forms</A>.<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_43_41">Field_Types</A>.<FONT COLOR=red><A NAME="ref_46_58" HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_43_53">Enumeration</A></FONT> <b>is</b> -+<b>package</b> <b>body</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-forms__ads.htm#ref_49_35">Forms</A>.<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_43_41">Field_Types</A>.<span class="symbol"><A NAME="ref_46_58" HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_43_53">Enumeration</A></span> <b>is</b> - -- <b>function</b> <FONT COLOR=red><A NAME="ref_48_13" HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_64_13">Create</A></FONT> (<FONT COLOR=red><A NAME="ref_48_21" HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_64_21">Info</A></FONT> : <A HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_55_9">Enumeration_Info</A>; -- <FONT COLOR=red><A NAME="ref_49_21" HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_65_21">Auto_Release_Names</A></FONT> : Boolean := False) -+ <b>function</b> <span class="symbol"><A NAME="ref_48_13" HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_64_13">Create</A></span> (<span class="symbol"><A NAME="ref_48_21" HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_64_21">Info</A></span> : <A HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_55_9">Enumeration_Info</A>; -+ <span class="symbol"><A NAME="ref_49_21" HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_65_21">Auto_Release_Names</A></span> : Boolean := False) - <b>return</b> <A HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_62_9">Enumeration_Field</A> - <b>is</b> - <b>procedure</b> Release_String <b>is</b> - <b>new</b> Ada.Unchecked_Deallocation (String, - <A HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_47_9">String_Access</A>); -- <FONT COLOR=red><A NAME="ref_55_7">E</A></FONT> : <A HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_62_9">Enumeration_Field</A>; -- <FONT COLOR=red><A NAME="ref_56_7">L</A></FONT> : <b>constant</b> size_t := 1 + size_t (<A HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_64_21">Info</A>.<A HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_55_27">C</A>); -- <FONT COLOR=red><A NAME="ref_57_7">S</A></FONT> : <A HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_47_9">String_Access</A>; -+ <span class="symbol"><A NAME="ref_55_7">E</A></span> : <A HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_62_9">Enumeration_Field</A>; -+ <span class="symbol"><A NAME="ref_56_7">L</A></span> : <b>constant</b> size_t := 1 + size_t (<A HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_64_21">Info</A>.<A HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_55_27">C</A>); -+ <span class="symbol"><A NAME="ref_57_7">S</A></span> : <A HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_47_9">String_Access</A>; - <b>begin</b> - <A HREF="terminal_interface-curses-forms-field_types-enumeration__adb.htm#ref_55_7">E</A>.<A HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_93_10">Case_Sensitive</A> := <A HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_64_21">Info</A>.<A HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_58_10">Case_Sensitive</A>; - <A HREF="terminal_interface-curses-forms-field_types-enumeration__adb.htm#ref_55_7">E</A>.<A HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_94_10">Match_Must_Be_Unique</A> := <A HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_64_21">Info</A>.<A HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_59_10">Match_Must_Be_Unique</A>; - <A HREF="terminal_interface-curses-forms-field_types-enumeration__adb.htm#ref_55_7">E</A>.<A HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_95_10">Arr</A> := <b>new</b> chars_ptr_array (size_t (1) .. <A HREF="terminal_interface-curses-forms-field_types-enumeration__adb.htm#ref_56_7">L</A>); -- <b>for</b> <FONT COLOR=red><A NAME="ref_62_11">I</A></FONT> <b>in</b> 1 .. Positive (<A HREF="terminal_interface-curses-forms-field_types-enumeration__adb.htm#ref_56_7">L</A> - 1) <b>loop</b> -+ <b>for</b> <span class="symbol"><A NAME="ref_62_11">I</A></span> <b>in</b> 1 .. Positive (<A HREF="terminal_interface-curses-forms-field_types-enumeration__adb.htm#ref_56_7">L</A> - 1) <b>loop</b> - <b>if</b> <A HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_64_21">Info</A>.<A HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_57_10">Names</A> (<A HREF="terminal_interface-curses-forms-field_types-enumeration__adb.htm#ref_62_11">I</A>) = <b>null</b> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_290_4">Form_Exception</A>; -+ <b>raise</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_288_4">Form_Exception</A>; - <b>end</b> <b>if</b>; - <A HREF="terminal_interface-curses-forms-field_types-enumeration__adb.htm#ref_55_7">E</A>.<A HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_95_10">Arr</A>.<b>all</b> (size_t (<A HREF="terminal_interface-curses-forms-field_types-enumeration__adb.htm#ref_62_11">I</A>)) := New_String (<A HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_64_21">Info</A>.<A HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_57_10">Names</A> (<A HREF="terminal_interface-curses-forms-field_types-enumeration__adb.htm#ref_62_11">I</A>).<b>all</b>); - <b>if</b> <A HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_65_21">Auto_Release_Names</A> <b>then</b> -@@ -78,10 +90,10 @@ - <b>return</b> <A HREF="terminal_interface-curses-forms-field_types-enumeration__adb.htm#ref_55_7">E</A>; - <b>end</b> <A HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_64_13">Create</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_76_14" HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_77_14">Release</A></FONT> (<FONT COLOR=red><A NAME="ref_76_23" HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_77_23">Enum</A></FONT> : <b>in</b> <b>out</b> <A HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_62_9">Enumeration_Field</A>) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_76_14" HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_77_14">Release</A></span> (<span class="symbol"><A NAME="ref_76_23" HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_77_23">Enum</A></span> : <b>in</b> <b>out</b> <A HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_62_9">Enumeration_Field</A>) - <b>is</b> -- <FONT COLOR=red><A NAME="ref_78_7">I</A></FONT> : size_t := 0; -- <FONT COLOR=red><A NAME="ref_79_7">P</A></FONT> : chars_ptr; -+ <span class="symbol"><A NAME="ref_78_7">I</A></span> : size_t := 0; -+ <span class="symbol"><A NAME="ref_79_7">P</A></span> : chars_ptr; - <b>begin</b> - <b>loop</b> - <A HREF="terminal_interface-curses-forms-field_types-enumeration__adb.htm#ref_79_7">P</A> := <A HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_77_23">Enum</A>.<A HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_95_10">Arr</A>.<b>all</b> (<A HREF="terminal_interface-curses-forms-field_types-enumeration__adb.htm#ref_78_7">I</A>); -@@ -93,19 +105,19 @@ - <A HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_77_23">Enum</A>.<A HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_95_10">Arr</A> := <b>null</b>; - <b>end</b> <A HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_77_14">Release</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_91_14" HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_84_14">Set_Field_Type</A></FONT> (<FONT COLOR=red><A NAME="ref_91_30" HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_84_30">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_92_30" HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_85_30">Typ</A></FONT> : <A HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_62_9">Enumeration_Field</A>) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_91_14" HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_84_14">Set_Field_Type</A></span> (<span class="symbol"><A NAME="ref_91_30" HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_84_30">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_92_30" HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_85_30">Typ</A></span> : <A HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_62_9">Enumeration_Field</A>) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_94_16">Set_Fld_Type</A></FONT> (<FONT COLOR=red><A NAME="ref_94_30" HREF="terminal_interface-curses-forms-field_types-enumeration__adb.htm#ref_94_16">F</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A> := <A HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_84_30">Fld</A>; -- <FONT COLOR=red><A NAME="ref_95_30" HREF="terminal_interface-curses-forms-field_types-enumeration__adb.htm#ref_94_16">Arg1</A></FONT> : chars_ptr_array; -- <FONT COLOR=red><A NAME="ref_96_30" HREF="terminal_interface-curses-forms-field_types-enumeration__adb.htm#ref_94_16">Arg2</A></FONT> : <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_46_12">C_Int</A>; -- <FONT COLOR=red><A NAME="ref_97_30" HREF="terminal_interface-curses-forms-field_types-enumeration__adb.htm#ref_94_16">Arg3</A></FONT> : <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_46_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_46_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_94_16">Set_Fld_Type</A></span> (<span class="symbol"><A NAME="ref_94_30" HREF="terminal_interface-curses-forms-field_types-enumeration__adb.htm#ref_94_16">F</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A> := <A HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_84_30">Fld</A>; -+ <span class="symbol"><A NAME="ref_95_30" HREF="terminal_interface-curses-forms-field_types-enumeration__adb.htm#ref_94_16">Arg1</A></span> : chars_ptr_array; -+ <span class="symbol"><A NAME="ref_96_30" HREF="terminal_interface-curses-forms-field_types-enumeration__adb.htm#ref_94_16">Arg2</A></span> : <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_46_12">C_Int</A>; -+ <span class="symbol"><A NAME="ref_97_30" HREF="terminal_interface-curses-forms-field_types-enumeration__adb.htm#ref_94_16">Arg3</A></span> : <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_46_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_46_12">C_Int</A>; - <b>pragma</b> Import (C, Set_Fld_Type, "set_field_type_enum"); - -- <FONT COLOR=red><A NAME="ref_100_7">Res</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A>; -+ <span class="symbol"><A NAME="ref_100_7">Res</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A>; - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_85_30">Typ</A>.<A HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_95_10">Arr</A> = <b>null</b> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_290_4">Form_Exception</A>; -+ <b>raise</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_288_4">Form_Exception</A>; - <b>end</b> <b>if</b>; - <A HREF="terminal_interface-curses-forms-field_types-enumeration__adb.htm#ref_100_7">Res</A> := <A HREF="terminal_interface-curses-forms-field_types-enumeration__adb.htm#ref_94_16">Set_Fld_Type</A> (<A HREF="terminal_interface-curses-forms-field_types-enumeration__adb.htm#ref_95_30">Arg1</A> =&gt; <A HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_85_30">Typ</A>.<A HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_95_10">Arr</A>.<b>all</b>, - <A HREF="terminal_interface-curses-forms-field_types-enumeration__adb.htm#ref_96_30">Arg2</A> =&gt; <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_46_12">C_Int</A> (Boolean'Pos (<A HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_85_30">Typ</A>.<A HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_93_10">Case_Sensitive</A>)), -diff -Naur ncurses-5.9/doc/html/ada/terminal_interface-curses-forms-field_types-enumeration__ads.htm ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-forms-field_types-enumeration__ads.htm ---- ncurses-5.9/doc/html/ada/terminal_interface-curses-forms-field_types-enumeration__ads.htm 2011-02-26 00:43:49.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-forms-field_types-enumeration__ads.htm 2014-09-01 16:33:22.275791988 +0200 -@@ -1,103 +1,115 @@ --<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> --<HTML><HEAD><TITLE>terminal_interface-curses-forms-field_types-enumeration.ads</TITLE></HEAD> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> -+<HTML> -+<HEAD> -+<TITLE>terminal_interface-curses-forms-field_types-enumeration.ads</TITLE> -+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> -+<style type="text/css"> -+*.comment { -+ color: green; -+} -+*.symbol { -+ color: red; -+} -+</style> -+</HEAD> - <BODY> --<HR><DIV ALIGN="center"><H1> File : terminal_interface-curses-forms-field_types-enumeration.ads </H1></DIV><HR> -+<HR><DIV style="text-align:center"><H1> File : terminal_interface-curses-forms-field_types-enumeration.ads </H1></DIV><HR> - <PRE> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Terminal_Interface.Curses.Forms.Field_Types.Enumeration --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- S P E C --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Copyright (c) 1998-2003,2009 Free Software Foundation, Inc. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></FONT> --<FONT COLOR=green><EM>-- copy of this software and associated documentation files (the --</EM></FONT> --<FONT COLOR=green><EM>-- "Software"), to deal in the Software without restriction, including --</EM></FONT> --<FONT COLOR=green><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></FONT> --<FONT COLOR=green><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></FONT> --<FONT COLOR=green><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></FONT> --<FONT COLOR=green><EM>-- furnished to do so, subject to the following conditions: --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- The above copyright notice and this permission notice shall be included --</EM></FONT> --<FONT COLOR=green><EM>-- in all copies or substantial portions of the Software. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></FONT> --<FONT COLOR=green><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></FONT> --<FONT COLOR=green><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></FONT> --<FONT COLOR=green><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></FONT> --<FONT COLOR=green><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></FONT> --<FONT COLOR=green><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></FONT> --<FONT COLOR=green><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></FONT> --<FONT COLOR=green><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></FONT> --<FONT COLOR=green><EM>-- sale, use or other dealings in this Software without prior written --</EM></FONT> --<FONT COLOR=green><EM>-- authorization. --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Author: Juergen Pfeifer, 1996</EM></FONT> --<FONT COLOR=green><EM>-- Version Control:</EM></FONT> --<FONT COLOR=green><EM>-- @Revision: 1.12 @</EM></FONT> --<FONT COLOR=green><EM>-- Binding Version 01.00</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<b>with</b> <A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>.C.Strings; -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Terminal_Interface.Curses.Forms.Field_Types.Enumeration --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- S P E C --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Copyright (c) 1998-2003,2009 Free Software Foundation, Inc. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></span> -+<span class="comment"><EM>-- copy of this software and associated documentation files (the --</EM></span> -+<span class="comment"><EM>-- "Software"), to deal in the Software without restriction, including --</EM></span> -+<span class="comment"><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></span> -+<span class="comment"><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></span> -+<span class="comment"><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></span> -+<span class="comment"><EM>-- furnished to do so, subject to the following conditions: --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- The above copyright notice and this permission notice shall be included --</EM></span> -+<span class="comment"><EM>-- in all copies or substantial portions of the Software. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></span> -+<span class="comment"><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></span> -+<span class="comment"><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></span> -+<span class="comment"><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></span> -+<span class="comment"><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></span> -+<span class="comment"><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></span> -+<span class="comment"><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></span> -+<span class="comment"><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></span> -+<span class="comment"><EM>-- sale, use or other dealings in this Software without prior written --</EM></span> -+<span class="comment"><EM>-- authorization. --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Author: Juergen Pfeifer, 1996</EM></span> -+<span class="comment"><EM>-- Version Control:</EM></span> -+<span class="comment"><EM>-- @Revision: 1.12 @</EM></span> -+<span class="comment"><EM>-- Binding Version 01.00</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<b>with</b> <A HREF="interfac__ads.htm#ref_36_9">Interfaces</A>.C.Strings; - --<b>package</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-forms__ads.htm#ref_49_35">Forms</A>.<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_43_41">Field_Types</A>.<FONT COLOR=red><A NAME="ref_43_53" HREF="terminal_interface-curses-forms-field_types-enumeration__adb.htm#ref_46_58">Enumeration</A></FONT> <b>is</b> -+<b>package</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-forms__ads.htm#ref_49_35">Forms</A>.<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_43_41">Field_Types</A>.<span class="symbol"><A NAME="ref_43_53" HREF="terminal_interface-curses-forms-field_types-enumeration__adb.htm#ref_46_58">Enumeration</A></span> <b>is</b> - <b>pragma</b> Preelaborate - (<A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-forms__ads.htm#ref_49_35">Forms</A>.<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_43_41">Field_Types</A>.<A HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_43_53">Enumeration</A>); - -- <b>type</b> <FONT COLOR=red><A NAME="ref_47_9">String_Access</A></FONT> <b>is</b> <b>access</b> String; -+ <b>type</b> <span class="symbol"><A NAME="ref_47_9">String_Access</A></span> <b>is</b> <b>access</b> String; - -- <FONT COLOR=green><EM>-- Type_Set is used by the child package Ada</EM></FONT> -- <b>type</b> <FONT COLOR=red><A NAME="ref_50_9">Type_Set</A></FONT> <b>is</b> (<FONT COLOR=red><A NAME="ref_50_22">Lower_Case</A></FONT>, <FONT COLOR=red><A NAME="ref_50_34">Upper_Case</A></FONT>, <FONT COLOR=red><A NAME="ref_50_46">Mixed_Case</A></FONT>); -+ <span class="comment"><EM>-- Type_Set is used by the child package Ada</EM></span> -+ <b>type</b> <span class="symbol"><A NAME="ref_50_9">Type_Set</A></span> <b>is</b> (<span class="symbol"><A NAME="ref_50_22">Lower_Case</A></span>, <span class="symbol"><A NAME="ref_50_34">Upper_Case</A></span>, <span class="symbol"><A NAME="ref_50_46">Mixed_Case</A></span>); - - <b>type</b> Enum_Array <b>is</b> <b>array</b> (Positive <b>range</b> &lt;&gt;) - <b>of</b> <A HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_47_9">String_Access</A>; - -- <b>type</b> <FONT COLOR=red><A NAME="ref_55_9">Enumeration_Info</A></FONT> (<FONT COLOR=red><A NAME="ref_55_27" HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_55_9">C</A></FONT> : Positive) <b>is</b> -+ <b>type</b> <span class="symbol"><A NAME="ref_55_9">Enumeration_Info</A></span> (<span class="symbol"><A NAME="ref_55_27" HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_55_9">C</A></span> : Positive) <b>is</b> - <b>record</b> -- <FONT COLOR=red><A NAME="ref_57_10">Names</A></FONT> : Enum_Array (1 .. <A HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_55_27">C</A>); -- <FONT COLOR=red><A NAME="ref_58_10">Case_Sensitive</A></FONT> : Boolean := False; -- <FONT COLOR=red><A NAME="ref_59_10">Match_Must_Be_Unique</A></FONT> : Boolean := False; -+ <span class="symbol"><A NAME="ref_57_10">Names</A></span> : Enum_Array (1 .. <A HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_55_27">C</A>); -+ <span class="symbol"><A NAME="ref_58_10">Case_Sensitive</A></span> : Boolean := False; -+ <span class="symbol"><A NAME="ref_59_10">Match_Must_Be_Unique</A></span> : Boolean := False; - <b>end</b> <b>record</b>; - -- <b>type</b> <FONT COLOR=red><A NAME="ref_62_9">Enumeration_Field</A></FONT> <b>is</b> <b>new</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_52_9">Field_Type</A> <b>with</b> <b>private</b>; -+ <b>type</b> <span class="symbol"><A NAME="ref_62_9">Enumeration_Field</A></span> <b>is</b> <b>new</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_52_9">Field_Type</A> <b>with</b> <b>private</b>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_64_13" HREF="terminal_interface-curses-forms-field_types-enumeration__adb.htm#ref_48_13">Create</A></FONT> (<FONT COLOR=red><A NAME="ref_64_21" HREF="terminal_interface-curses-forms-field_types-enumeration__adb.htm#ref_48_21">Info</A></FONT> : <A HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_55_9">Enumeration_Info</A>; -- <FONT COLOR=red><A NAME="ref_65_21" HREF="terminal_interface-curses-forms-field_types-enumeration__adb.htm#ref_49_21">Auto_Release_Names</A></FONT> : Boolean := False) -+ <b>function</b> <span class="symbol"><A NAME="ref_64_13" HREF="terminal_interface-curses-forms-field_types-enumeration__adb.htm#ref_48_13">Create</A></span> (<span class="symbol"><A NAME="ref_64_21" HREF="terminal_interface-curses-forms-field_types-enumeration__adb.htm#ref_48_21">Info</A></span> : <A HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_55_9">Enumeration_Info</A>; -+ <span class="symbol"><A NAME="ref_65_21" HREF="terminal_interface-curses-forms-field_types-enumeration__adb.htm#ref_49_21">Auto_Release_Names</A></span> : Boolean := False) - <b>return</b> <A HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_62_9">Enumeration_Field</A>; -- <FONT COLOR=green><EM>-- Make an fieldtype from the info. Enumerations are special, because</EM></FONT> -- <FONT COLOR=green><EM>-- they normally don't copy the enum values into a private store, so</EM></FONT> -- <FONT COLOR=green><EM>-- we have to care for the lifetime of the info we provide.</EM></FONT> -- <FONT COLOR=green><EM>-- The Auto_Release_Names flag may be used to automatically releases</EM></FONT> -- <FONT COLOR=green><EM>-- the strings in the Names array of the Enumeration_Info.</EM></FONT> -+ <span class="comment"><EM>-- Make an fieldtype from the info. Enumerations are special, because</EM></span> -+ <span class="comment"><EM>-- they normally don't copy the enum values into a private store, so</EM></span> -+ <span class="comment"><EM>-- we have to care for the lifetime of the info we provide.</EM></span> -+ <span class="comment"><EM>-- The Auto_Release_Names flag may be used to automatically releases</EM></span> -+ <span class="comment"><EM>-- the strings in the Names array of the Enumeration_Info.</EM></span> - -- <b>function</b> Make_Enumeration_Type (<FONT COLOR=red><A NAME="ref_73_36">Info</A></FONT> : <A HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_55_9">Enumeration_Info</A>; -- <FONT COLOR=red><A NAME="ref_74_36">Auto_Release_Names</A></FONT> : Boolean := False) -+ <b>function</b> Make_Enumeration_Type (<span class="symbol"><A NAME="ref_73_36">Info</A></span> : <A HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_55_9">Enumeration_Info</A>; -+ <span class="symbol"><A NAME="ref_74_36">Auto_Release_Names</A></span> : Boolean := False) - <b>return</b> <A HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_62_9">Enumeration_Field</A> <b>renames</b> <A HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_64_13">Create</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_77_14" HREF="terminal_interface-curses-forms-field_types-enumeration__adb.htm#ref_76_14">Release</A></FONT> (<FONT COLOR=red><A NAME="ref_77_23" HREF="terminal_interface-curses-forms-field_types-enumeration__adb.htm#ref_76_23">Enum</A></FONT> : <b>in</b> <b>out</b> <A HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_62_9">Enumeration_Field</A>); -- <FONT COLOR=green><EM>-- But we may want to release the field to release the memory allocated</EM></FONT> -- <FONT COLOR=green><EM>-- by it internally. After that the Enumeration field is no longer usable.</EM></FONT> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_77_14" HREF="terminal_interface-curses-forms-field_types-enumeration__adb.htm#ref_76_14">Release</A></span> (<span class="symbol"><A NAME="ref_77_23" HREF="terminal_interface-curses-forms-field_types-enumeration__adb.htm#ref_76_23">Enum</A></span> : <b>in</b> <b>out</b> <A HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_62_9">Enumeration_Field</A>); -+ <span class="comment"><EM>-- But we may want to release the field to release the memory allocated</EM></span> -+ <span class="comment"><EM>-- by it internally. After that the Enumeration field is no longer usable.</EM></span> - -- <FONT COLOR=green><EM>-- The next type defintions are all ncurses extensions. They are typically</EM></FONT> -- <FONT COLOR=green><EM>-- not available in other curses implementations.</EM></FONT> -+ <span class="comment"><EM>-- The next type defintions are all ncurses extensions. They are typically</EM></span> -+ <span class="comment"><EM>-- not available in other curses implementations.</EM></span> - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_84_14" HREF="terminal_interface-curses-forms-field_types-enumeration__adb.htm#ref_91_14">Set_Field_Type</A></FONT> (<FONT COLOR=red><A NAME="ref_84_30" HREF="terminal_interface-curses-forms-field_types-enumeration__adb.htm#ref_91_30">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_85_30" HREF="terminal_interface-curses-forms-field_types-enumeration__adb.htm#ref_92_30">Typ</A></FONT> : <A HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_62_9">Enumeration_Field</A>); -+ <b>procedure</b> <span class="symbol"><A NAME="ref_84_14" HREF="terminal_interface-curses-forms-field_types-enumeration__adb.htm#ref_91_14">Set_Field_Type</A></span> (<span class="symbol"><A NAME="ref_84_30" HREF="terminal_interface-curses-forms-field_types-enumeration__adb.htm#ref_91_30">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_85_30" HREF="terminal_interface-curses-forms-field_types-enumeration__adb.htm#ref_92_30">Typ</A></span> : <A HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_62_9">Enumeration_Field</A>); - <b>pragma</b> Inline (Set_Field_Type); - - <b>private</b> -- <b>type</b> <FONT COLOR=red><A NAME="ref_89_9">CPA_Access</A></FONT> <b>is</b> <b>access</b> <A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>.C.Strings.chars_ptr_array; -+ <b>type</b> <span class="symbol"><A NAME="ref_89_9">CPA_Access</A></span> <b>is</b> <b>access</b> <A HREF="interfac__ads.htm#ref_36_9">Interfaces</A>.C.Strings.chars_ptr_array; - - <b>type</b> <A HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_62_9">Enumeration_Field</A> <b>is</b> <b>new</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_52_9">Field_Type</A> <b>with</b> - <b>record</b> -- <FONT COLOR=red><A NAME="ref_93_10">Case_Sensitive</A></FONT> : Boolean := False; -- <FONT COLOR=red><A NAME="ref_94_10">Match_Must_Be_Unique</A></FONT> : Boolean := False; -- <FONT COLOR=red><A NAME="ref_95_10">Arr</A></FONT> : <A HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_89_9">CPA_Access</A> := <b>null</b>; -+ <span class="symbol"><A NAME="ref_93_10">Case_Sensitive</A></span> : Boolean := False; -+ <span class="symbol"><A NAME="ref_94_10">Match_Must_Be_Unique</A></span> : Boolean := False; -+ <span class="symbol"><A NAME="ref_95_10">Arr</A></span> : <A HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_89_9">CPA_Access</A> := <b>null</b>; - <b>end</b> <b>record</b>; - - <b>end</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-forms__ads.htm#ref_49_35">Forms</A>.<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_43_41">Field_Types</A>.<A HREF="terminal_interface-curses-forms-field_types-enumeration__ads.htm#ref_43_53">Enumeration</A>; -diff -Naur ncurses-5.9/doc/html/ada/terminal_interface-curses-forms-field_types-intfield__adb.htm ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-forms-field_types-intfield__adb.htm ---- ncurses-5.9/doc/html/ada/terminal_interface-curses-forms-field_types-intfield__adb.htm 2011-03-20 00:18:39.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-forms-field_types-intfield__adb.htm 2014-09-01 16:33:22.276791990 +0200 -@@ -1,63 +1,75 @@ --<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> --<HTML><HEAD><TITLE>terminal_interface-curses-forms-field_types-intfield.adb</TITLE></HEAD> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> -+<HTML> -+<HEAD> -+<TITLE>terminal_interface-curses-forms-field_types-intfield.adb</TITLE> -+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> -+<style type="text/css"> -+*.comment { -+ color: green; -+} -+*.symbol { -+ color: red; -+} -+</style> -+</HEAD> - <BODY> --<HR><DIV ALIGN="center"><H1> File : terminal_interface-curses-forms-field_types-intfield.adb </H1></DIV><HR> -+<HR><DIV style="text-align:center"><H1> File : terminal_interface-curses-forms-field_types-intfield.adb </H1></DIV><HR> - <PRE> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Terminal_Interface.Curses.Forms.Field_Types.IntField --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- B O D Y --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Copyright (c) 1998-2009,2011 Free Software Foundation, Inc. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></FONT> --<FONT COLOR=green><EM>-- copy of this software and associated documentation files (the --</EM></FONT> --<FONT COLOR=green><EM>-- "Software"), to deal in the Software without restriction, including --</EM></FONT> --<FONT COLOR=green><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></FONT> --<FONT COLOR=green><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></FONT> --<FONT COLOR=green><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></FONT> --<FONT COLOR=green><EM>-- furnished to do so, subject to the following conditions: --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- The above copyright notice and this permission notice shall be included --</EM></FONT> --<FONT COLOR=green><EM>-- in all copies or substantial portions of the Software. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></FONT> --<FONT COLOR=green><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></FONT> --<FONT COLOR=green><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></FONT> --<FONT COLOR=green><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></FONT> --<FONT COLOR=green><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></FONT> --<FONT COLOR=green><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></FONT> --<FONT COLOR=green><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></FONT> --<FONT COLOR=green><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></FONT> --<FONT COLOR=green><EM>-- sale, use or other dealings in this Software without prior written --</EM></FONT> --<FONT COLOR=green><EM>-- authorization. --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Author: Juergen Pfeifer, 1996</EM></FONT> --<FONT COLOR=green><EM>-- Version Control:</EM></FONT> --<FONT COLOR=green><EM>-- @Revision: 1.11 @</EM></FONT> --<FONT COLOR=green><EM>-- @Date: 2011/03/19 00:45:37 @</EM></FONT> --<FONT COLOR=green><EM>-- Binding Version 01.00</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Terminal_Interface.Curses.Forms.Field_Types.IntField --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- B O D Y --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Copyright (c) 1998-2009,2011 Free Software Foundation, Inc. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></span> -+<span class="comment"><EM>-- copy of this software and associated documentation files (the --</EM></span> -+<span class="comment"><EM>-- "Software"), to deal in the Software without restriction, including --</EM></span> -+<span class="comment"><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></span> -+<span class="comment"><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></span> -+<span class="comment"><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></span> -+<span class="comment"><EM>-- furnished to do so, subject to the following conditions: --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- The above copyright notice and this permission notice shall be included --</EM></span> -+<span class="comment"><EM>-- in all copies or substantial portions of the Software. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></span> -+<span class="comment"><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></span> -+<span class="comment"><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></span> -+<span class="comment"><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></span> -+<span class="comment"><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></span> -+<span class="comment"><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></span> -+<span class="comment"><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></span> -+<span class="comment"><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></span> -+<span class="comment"><EM>-- sale, use or other dealings in this Software without prior written --</EM></span> -+<span class="comment"><EM>-- authorization. --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Author: Juergen Pfeifer, 1996</EM></span> -+<span class="comment"><EM>-- Version Control:</EM></span> -+<span class="comment"><EM>-- @Revision: 1.11 @</EM></span> -+<span class="comment"><EM>-- @Date: 2011/03/19 00:45:37 @</EM></span> -+<span class="comment"><EM>-- Binding Version 01.00</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> - <b>with</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-aux__ads.htm#ref_50_35">Aux</A>; <b>use</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-aux__ads.htm#ref_50_35">Aux</A>; - --<b>package</b> <b>body</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-forms__ads.htm#ref_49_35">Forms</A>.<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_43_41">Field_Types</A>.<FONT COLOR=red><A NAME="ref_44_58" HREF="terminal_interface-curses-forms-field_types-intfield__ads.htm#ref_41_53">IntField</A></FONT> <b>is</b> -+<b>package</b> <b>body</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-forms__ads.htm#ref_49_35">Forms</A>.<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_43_41">Field_Types</A>.<span class="symbol"><A NAME="ref_44_58" HREF="terminal_interface-curses-forms-field_types-intfield__ads.htm#ref_41_53">IntField</A></span> <b>is</b> - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_46_14" HREF="terminal_interface-curses-forms-field_types-intfield__ads.htm#ref_51_14">Set_Field_Type</A></FONT> (<FONT COLOR=red><A NAME="ref_46_30" HREF="terminal_interface-curses-forms-field_types-intfield__ads.htm#ref_51_30">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_47_30" HREF="terminal_interface-curses-forms-field_types-intfield__ads.htm#ref_52_30">Typ</A></FONT> : <A HREF="terminal_interface-curses-forms-field_types-intfield__ads.htm#ref_44_9">Integer_Field</A>) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_46_14" HREF="terminal_interface-curses-forms-field_types-intfield__ads.htm#ref_51_14">Set_Field_Type</A></span> (<span class="symbol"><A NAME="ref_46_30" HREF="terminal_interface-curses-forms-field_types-intfield__ads.htm#ref_51_30">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_47_30" HREF="terminal_interface-curses-forms-field_types-intfield__ads.htm#ref_52_30">Typ</A></span> : <A HREF="terminal_interface-curses-forms-field_types-intfield__ads.htm#ref_44_9">Integer_Field</A>) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_49_16">Set_Fld_Type</A></FONT> (<FONT COLOR=red><A NAME="ref_49_30" HREF="terminal_interface-curses-forms-field_types-intfield__adb.htm#ref_49_16">F</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A> := <A HREF="terminal_interface-curses-forms-field_types-intfield__ads.htm#ref_51_30">Fld</A>; -- <FONT COLOR=red><A NAME="ref_50_30" HREF="terminal_interface-curses-forms-field_types-intfield__adb.htm#ref_49_16">Arg1</A></FONT> : <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_46_12">C_Int</A>; -- <FONT COLOR=red><A NAME="ref_51_30" HREF="terminal_interface-curses-forms-field_types-intfield__adb.htm#ref_49_16">Arg2</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_57_12">C_Long_Int</A>; -- <FONT COLOR=red><A NAME="ref_52_30" HREF="terminal_interface-curses-forms-field_types-intfield__adb.htm#ref_49_16">Arg3</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_57_12">C_Long_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_46_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_49_16">Set_Fld_Type</A></span> (<span class="symbol"><A NAME="ref_49_30" HREF="terminal_interface-curses-forms-field_types-intfield__adb.htm#ref_49_16">F</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A> := <A HREF="terminal_interface-curses-forms-field_types-intfield__ads.htm#ref_51_30">Fld</A>; -+ <span class="symbol"><A NAME="ref_50_30" HREF="terminal_interface-curses-forms-field_types-intfield__adb.htm#ref_49_16">Arg1</A></span> : <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_46_12">C_Int</A>; -+ <span class="symbol"><A NAME="ref_51_30" HREF="terminal_interface-curses-forms-field_types-intfield__adb.htm#ref_49_16">Arg2</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_57_12">C_Long_Int</A>; -+ <span class="symbol"><A NAME="ref_52_30" HREF="terminal_interface-curses-forms-field_types-intfield__adb.htm#ref_49_16">Arg3</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_57_12">C_Long_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_46_12">C_Int</A>; - <b>pragma</b> Import (C, Set_Fld_Type, "set_field_type_integer"); - -- <FONT COLOR=red><A NAME="ref_55_7">Res</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A>; -+ <span class="symbol"><A NAME="ref_55_7">Res</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A>; - <b>begin</b> - <A HREF="terminal_interface-curses-forms-field_types-intfield__adb.htm#ref_55_7">Res</A> := <A HREF="terminal_interface-curses-forms-field_types-intfield__adb.htm#ref_49_16">Set_Fld_Type</A> (<A HREF="terminal_interface-curses-forms-field_types-intfield__adb.htm#ref_50_30">Arg1</A> =&gt; <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_46_12">C_Int</A> (<A HREF="terminal_interface-curses-forms-field_types-intfield__ads.htm#ref_52_30">Typ</A>.<A HREF="terminal_interface-curses-forms-field_types-intfield__ads.htm#ref_46_10">Precision</A>), - <A HREF="terminal_interface-curses-forms-field_types-intfield__adb.htm#ref_51_30">Arg2</A> =&gt; <A HREF="terminal_interface-curses-aux__ads.htm#ref_57_12">C_Long_Int</A> (<A HREF="terminal_interface-curses-forms-field_types-intfield__ads.htm#ref_52_30">Typ</A>.<A HREF="terminal_interface-curses-forms-field_types-intfield__ads.htm#ref_47_10">Lower_Limit</A>), -diff -Naur ncurses-5.9/doc/html/ada/terminal_interface-curses-forms-field_types-intfield__ads.htm ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-forms-field_types-intfield__ads.htm ---- ncurses-5.9/doc/html/ada/terminal_interface-curses-forms-field_types-intfield__ads.htm 2010-01-09 21:31:26.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-forms-field_types-intfield__ads.htm 2014-09-01 16:33:22.276791990 +0200 -@@ -1,60 +1,72 @@ --<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> --<HTML><HEAD><TITLE>terminal_interface-curses-forms-field_types-intfield.ads</TITLE></HEAD> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> -+<HTML> -+<HEAD> -+<TITLE>terminal_interface-curses-forms-field_types-intfield.ads</TITLE> -+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> -+<style type="text/css"> -+*.comment { -+ color: green; -+} -+*.symbol { -+ color: red; -+} -+</style> -+</HEAD> - <BODY> --<HR><DIV ALIGN="center"><H1> File : terminal_interface-curses-forms-field_types-intfield.ads </H1></DIV><HR> -+<HR><DIV style="text-align:center"><H1> File : terminal_interface-curses-forms-field_types-intfield.ads </H1></DIV><HR> - <PRE> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Terminal_Interface.Curses.Forms.Field_Types.IntField --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- S P E C --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Copyright (c) 1998-2003,2009 Free Software Foundation, Inc. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></FONT> --<FONT COLOR=green><EM>-- copy of this software and associated documentation files (the --</EM></FONT> --<FONT COLOR=green><EM>-- "Software"), to deal in the Software without restriction, including --</EM></FONT> --<FONT COLOR=green><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></FONT> --<FONT COLOR=green><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></FONT> --<FONT COLOR=green><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></FONT> --<FONT COLOR=green><EM>-- furnished to do so, subject to the following conditions: --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- The above copyright notice and this permission notice shall be included --</EM></FONT> --<FONT COLOR=green><EM>-- in all copies or substantial portions of the Software. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></FONT> --<FONT COLOR=green><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></FONT> --<FONT COLOR=green><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></FONT> --<FONT COLOR=green><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></FONT> --<FONT COLOR=green><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></FONT> --<FONT COLOR=green><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></FONT> --<FONT COLOR=green><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></FONT> --<FONT COLOR=green><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></FONT> --<FONT COLOR=green><EM>-- sale, use or other dealings in this Software without prior written --</EM></FONT> --<FONT COLOR=green><EM>-- authorization. --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Author: Juergen Pfeifer, 1996</EM></FONT> --<FONT COLOR=green><EM>-- Version Control:</EM></FONT> --<FONT COLOR=green><EM>-- @Revision: 1.12 @</EM></FONT> --<FONT COLOR=green><EM>-- Binding Version 01.00</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<b>package</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-forms__ads.htm#ref_49_35">Forms</A>.<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_43_41">Field_Types</A>.<FONT COLOR=red><A NAME="ref_41_53" HREF="terminal_interface-curses-forms-field_types-intfield__adb.htm#ref_44_58">IntField</A></FONT> <b>is</b> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Terminal_Interface.Curses.Forms.Field_Types.IntField --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- S P E C --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Copyright (c) 1998-2003,2009 Free Software Foundation, Inc. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></span> -+<span class="comment"><EM>-- copy of this software and associated documentation files (the --</EM></span> -+<span class="comment"><EM>-- "Software"), to deal in the Software without restriction, including --</EM></span> -+<span class="comment"><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></span> -+<span class="comment"><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></span> -+<span class="comment"><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></span> -+<span class="comment"><EM>-- furnished to do so, subject to the following conditions: --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- The above copyright notice and this permission notice shall be included --</EM></span> -+<span class="comment"><EM>-- in all copies or substantial portions of the Software. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></span> -+<span class="comment"><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></span> -+<span class="comment"><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></span> -+<span class="comment"><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></span> -+<span class="comment"><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></span> -+<span class="comment"><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></span> -+<span class="comment"><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></span> -+<span class="comment"><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></span> -+<span class="comment"><EM>-- sale, use or other dealings in this Software without prior written --</EM></span> -+<span class="comment"><EM>-- authorization. --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Author: Juergen Pfeifer, 1996</EM></span> -+<span class="comment"><EM>-- Version Control:</EM></span> -+<span class="comment"><EM>-- @Revision: 1.12 @</EM></span> -+<span class="comment"><EM>-- Binding Version 01.00</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<b>package</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-forms__ads.htm#ref_49_35">Forms</A>.<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_43_41">Field_Types</A>.<span class="symbol"><A NAME="ref_41_53" HREF="terminal_interface-curses-forms-field_types-intfield__adb.htm#ref_44_58">IntField</A></span> <b>is</b> - <b>pragma</b> Preelaborate (<A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-forms__ads.htm#ref_49_35">Forms</A>.<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_43_41">Field_Types</A>.<A HREF="terminal_interface-curses-forms-field_types-intfield__ads.htm#ref_41_53">IntField</A>); - -- <b>type</b> <FONT COLOR=red><A NAME="ref_44_9">Integer_Field</A></FONT> <b>is</b> <b>new</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_52_9">Field_Type</A> <b>with</b> -+ <b>type</b> <span class="symbol"><A NAME="ref_44_9">Integer_Field</A></span> <b>is</b> <b>new</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_52_9">Field_Type</A> <b>with</b> - <b>record</b> -- <FONT COLOR=red><A NAME="ref_46_10">Precision</A></FONT> : Natural; -- <FONT COLOR=red><A NAME="ref_47_10">Lower_Limit</A></FONT> : Integer; -- <FONT COLOR=red><A NAME="ref_48_10">Upper_Limit</A></FONT> : Integer; -+ <span class="symbol"><A NAME="ref_46_10">Precision</A></span> : Natural; -+ <span class="symbol"><A NAME="ref_47_10">Lower_Limit</A></span> : Integer; -+ <span class="symbol"><A NAME="ref_48_10">Upper_Limit</A></span> : Integer; - <b>end</b> <b>record</b>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_51_14" HREF="terminal_interface-curses-forms-field_types-intfield__adb.htm#ref_46_14">Set_Field_Type</A></FONT> (<FONT COLOR=red><A NAME="ref_51_30" HREF="terminal_interface-curses-forms-field_types-intfield__adb.htm#ref_46_30">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_52_30" HREF="terminal_interface-curses-forms-field_types-intfield__adb.htm#ref_47_30">Typ</A></FONT> : <A HREF="terminal_interface-curses-forms-field_types-intfield__ads.htm#ref_44_9">Integer_Field</A>); -+ <b>procedure</b> <span class="symbol"><A NAME="ref_51_14" HREF="terminal_interface-curses-forms-field_types-intfield__adb.htm#ref_46_14">Set_Field_Type</A></span> (<span class="symbol"><A NAME="ref_51_30" HREF="terminal_interface-curses-forms-field_types-intfield__adb.htm#ref_46_30">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_52_30" HREF="terminal_interface-curses-forms-field_types-intfield__adb.htm#ref_47_30">Typ</A></span> : <A HREF="terminal_interface-curses-forms-field_types-intfield__ads.htm#ref_44_9">Integer_Field</A>); - <b>pragma</b> Inline (Set_Field_Type); - - <b>end</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-forms__ads.htm#ref_49_35">Forms</A>.<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_43_41">Field_Types</A>.<A HREF="terminal_interface-curses-forms-field_types-intfield__ads.htm#ref_41_53">IntField</A>; -diff -Naur ncurses-5.9/doc/html/ada/terminal_interface-curses-forms-field_types-ipv4_address__adb.htm ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-forms-field_types-ipv4_address__adb.htm ---- ncurses-5.9/doc/html/ada/terminal_interface-curses-forms-field_types-ipv4_address__adb.htm 2011-03-20 00:18:39.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-forms-field_types-ipv4_address__adb.htm 2014-09-01 16:33:22.276791990 +0200 -@@ -1,61 +1,73 @@ --<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> --<HTML><HEAD><TITLE>terminal_interface-curses-forms-field_types-ipv4_address.adb</TITLE></HEAD> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> -+<HTML> -+<HEAD> -+<TITLE>terminal_interface-curses-forms-field_types-ipv4_address.adb</TITLE> -+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> -+<style type="text/css"> -+*.comment { -+ color: green; -+} -+*.symbol { -+ color: red; -+} -+</style> -+</HEAD> - <BODY> --<HR><DIV ALIGN="center"><H1> File : terminal_interface-curses-forms-field_types-ipv4_address.adb </H1></DIV><HR> -+<HR><DIV style="text-align:center"><H1> File : terminal_interface-curses-forms-field_types-ipv4_address.adb </H1></DIV><HR> - <PRE> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Terminal_Interface.Curses.Forms.Field_Types.IPV4_Address --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- B O D Y --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Copyright (c) 1998-2009,2011 Free Software Foundation, Inc. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></FONT> --<FONT COLOR=green><EM>-- copy of this software and associated documentation files (the --</EM></FONT> --<FONT COLOR=green><EM>-- "Software"), to deal in the Software without restriction, including --</EM></FONT> --<FONT COLOR=green><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></FONT> --<FONT COLOR=green><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></FONT> --<FONT COLOR=green><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></FONT> --<FONT COLOR=green><EM>-- furnished to do so, subject to the following conditions: --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- The above copyright notice and this permission notice shall be included --</EM></FONT> --<FONT COLOR=green><EM>-- in all copies or substantial portions of the Software. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></FONT> --<FONT COLOR=green><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></FONT> --<FONT COLOR=green><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></FONT> --<FONT COLOR=green><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></FONT> --<FONT COLOR=green><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></FONT> --<FONT COLOR=green><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></FONT> --<FONT COLOR=green><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></FONT> --<FONT COLOR=green><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></FONT> --<FONT COLOR=green><EM>-- sale, use or other dealings in this Software without prior written --</EM></FONT> --<FONT COLOR=green><EM>-- authorization. --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Author: Juergen Pfeifer, 1996</EM></FONT> --<FONT COLOR=green><EM>-- Version Control:</EM></FONT> --<FONT COLOR=green><EM>-- @Revision: 1.11 @</EM></FONT> --<FONT COLOR=green><EM>-- @Date: 2011/03/19 00:45:37 @</EM></FONT> --<FONT COLOR=green><EM>-- Binding Version 01.00</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Terminal_Interface.Curses.Forms.Field_Types.IPV4_Address --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- B O D Y --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Copyright (c) 1998-2009,2011 Free Software Foundation, Inc. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></span> -+<span class="comment"><EM>-- copy of this software and associated documentation files (the --</EM></span> -+<span class="comment"><EM>-- "Software"), to deal in the Software without restriction, including --</EM></span> -+<span class="comment"><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></span> -+<span class="comment"><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></span> -+<span class="comment"><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></span> -+<span class="comment"><EM>-- furnished to do so, subject to the following conditions: --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- The above copyright notice and this permission notice shall be included --</EM></span> -+<span class="comment"><EM>-- in all copies or substantial portions of the Software. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></span> -+<span class="comment"><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></span> -+<span class="comment"><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></span> -+<span class="comment"><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></span> -+<span class="comment"><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></span> -+<span class="comment"><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></span> -+<span class="comment"><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></span> -+<span class="comment"><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></span> -+<span class="comment"><EM>-- sale, use or other dealings in this Software without prior written --</EM></span> -+<span class="comment"><EM>-- authorization. --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Author: Juergen Pfeifer, 1996</EM></span> -+<span class="comment"><EM>-- Version Control:</EM></span> -+<span class="comment"><EM>-- @Revision: 1.11 @</EM></span> -+<span class="comment"><EM>-- @Date: 2011/03/19 00:45:37 @</EM></span> -+<span class="comment"><EM>-- Binding Version 01.00</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> - <b>with</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-aux__ads.htm#ref_50_35">Aux</A>; <b>use</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-aux__ads.htm#ref_50_35">Aux</A>; - --<b>package</b> <b>body</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-forms__ads.htm#ref_49_35">Forms</A>.<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_43_41">Field_Types</A>.<FONT COLOR=red><A NAME="ref_44_58" HREF="terminal_interface-curses-forms-field_types-ipv4_address__ads.htm#ref_41_53">IPV4_Address</A></FONT> <b>is</b> -+<b>package</b> <b>body</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-forms__ads.htm#ref_49_35">Forms</A>.<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_43_41">Field_Types</A>.<span class="symbol"><A NAME="ref_44_58" HREF="terminal_interface-curses-forms-field_types-ipv4_address__ads.htm#ref_41_53">IPV4_Address</A></span> <b>is</b> - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_46_14" HREF="terminal_interface-curses-forms-field_types-ipv4_address__ads.htm#ref_47_14">Set_Field_Type</A></FONT> (<FONT COLOR=red><A NAME="ref_46_30" HREF="terminal_interface-curses-forms-field_types-ipv4_address__ads.htm#ref_47_30">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_47_30" HREF="terminal_interface-curses-forms-field_types-ipv4_address__ads.htm#ref_48_30">Typ</A></FONT> : <A HREF="terminal_interface-curses-forms-field_types-ipv4_address__ads.htm#ref_45_9">Internet_V4_Address_Field</A>) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_46_14" HREF="terminal_interface-curses-forms-field_types-ipv4_address__ads.htm#ref_47_14">Set_Field_Type</A></span> (<span class="symbol"><A NAME="ref_46_30" HREF="terminal_interface-curses-forms-field_types-ipv4_address__ads.htm#ref_47_30">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_47_30" HREF="terminal_interface-curses-forms-field_types-ipv4_address__ads.htm#ref_48_30">Typ</A></span> : <A HREF="terminal_interface-curses-forms-field_types-ipv4_address__ads.htm#ref_45_9">Internet_V4_Address_Field</A>) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_49_16">Set_Fld_Type</A></FONT> (<FONT COLOR=red><A NAME="ref_49_30" HREF="terminal_interface-curses-forms-field_types-ipv4_address__adb.htm#ref_49_16">F</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A> := <A HREF="terminal_interface-curses-forms-field_types-ipv4_address__ads.htm#ref_47_30">Fld</A>) -+ <b>function</b> <span class="symbol"><A NAME="ref_49_16">Set_Fld_Type</A></span> (<span class="symbol"><A NAME="ref_49_30" HREF="terminal_interface-curses-forms-field_types-ipv4_address__adb.htm#ref_49_16">F</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A> := <A HREF="terminal_interface-curses-forms-field_types-ipv4_address__ads.htm#ref_47_30">Fld</A>) - <b>return</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_46_12">C_Int</A>; - <b>pragma</b> Import (C, Set_Fld_Type, "set_field_type_ipv4"); - -- <FONT COLOR=red><A NAME="ref_53_7">Res</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A>; -+ <span class="symbol"><A NAME="ref_53_7">Res</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A>; - <b>begin</b> - <A HREF="terminal_interface-curses-forms-field_types-ipv4_address__adb.htm#ref_53_7">Res</A> := <A HREF="terminal_interface-curses-forms-field_types-ipv4_address__adb.htm#ref_49_16">Set_Fld_Type</A>; - <b>if</b> <A HREF="terminal_interface-curses-forms-field_types-ipv4_address__adb.htm#ref_53_7">Res</A> /= <A HREF="terminal_interface-curses-aux__ads.htm#ref_80_4">E_Ok</A> <b>then</b> -diff -Naur ncurses-5.9/doc/html/ada/terminal_interface-curses-forms-field_types-ipv4_address__ads.htm ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-forms-field_types-ipv4_address__ads.htm ---- ncurses-5.9/doc/html/ada/terminal_interface-curses-forms-field_types-ipv4_address__ads.htm 2010-01-09 21:31:26.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-forms-field_types-ipv4_address__ads.htm 2014-09-01 16:33:22.277791991 +0200 -@@ -1,56 +1,68 @@ --<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> --<HTML><HEAD><TITLE>terminal_interface-curses-forms-field_types-ipv4_address.ads</TITLE></HEAD> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> -+<HTML> -+<HEAD> -+<TITLE>terminal_interface-curses-forms-field_types-ipv4_address.ads</TITLE> -+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> -+<style type="text/css"> -+*.comment { -+ color: green; -+} -+*.symbol { -+ color: red; -+} -+</style> -+</HEAD> - <BODY> --<HR><DIV ALIGN="center"><H1> File : terminal_interface-curses-forms-field_types-ipv4_address.ads </H1></DIV><HR> -+<HR><DIV style="text-align:center"><H1> File : terminal_interface-curses-forms-field_types-ipv4_address.ads </H1></DIV><HR> - <PRE> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Terminal_Interface.Curses.Forms.Field_Types.IPV4_Address --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- S P E C --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Copyright (c) 1998-2003,2009 Free Software Foundation, Inc. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></FONT> --<FONT COLOR=green><EM>-- copy of this software and associated documentation files (the --</EM></FONT> --<FONT COLOR=green><EM>-- "Software"), to deal in the Software without restriction, including --</EM></FONT> --<FONT COLOR=green><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></FONT> --<FONT COLOR=green><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></FONT> --<FONT COLOR=green><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></FONT> --<FONT COLOR=green><EM>-- furnished to do so, subject to the following conditions: --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- The above copyright notice and this permission notice shall be included --</EM></FONT> --<FONT COLOR=green><EM>-- in all copies or substantial portions of the Software. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></FONT> --<FONT COLOR=green><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></FONT> --<FONT COLOR=green><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></FONT> --<FONT COLOR=green><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></FONT> --<FONT COLOR=green><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></FONT> --<FONT COLOR=green><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></FONT> --<FONT COLOR=green><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></FONT> --<FONT COLOR=green><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></FONT> --<FONT COLOR=green><EM>-- sale, use or other dealings in this Software without prior written --</EM></FONT> --<FONT COLOR=green><EM>-- authorization. --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Author: Juergen Pfeifer, 1996</EM></FONT> --<FONT COLOR=green><EM>-- Version Control:</EM></FONT> --<FONT COLOR=green><EM>-- @Revision: 1.12 @</EM></FONT> --<FONT COLOR=green><EM>-- Binding Version 01.00</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<b>package</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-forms__ads.htm#ref_49_35">Forms</A>.<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_43_41">Field_Types</A>.<FONT COLOR=red><A NAME="ref_41_53" HREF="terminal_interface-curses-forms-field_types-ipv4_address__adb.htm#ref_44_58">IPV4_Address</A></FONT> <b>is</b> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Terminal_Interface.Curses.Forms.Field_Types.IPV4_Address --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- S P E C --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Copyright (c) 1998-2003,2009 Free Software Foundation, Inc. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></span> -+<span class="comment"><EM>-- copy of this software and associated documentation files (the --</EM></span> -+<span class="comment"><EM>-- "Software"), to deal in the Software without restriction, including --</EM></span> -+<span class="comment"><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></span> -+<span class="comment"><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></span> -+<span class="comment"><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></span> -+<span class="comment"><EM>-- furnished to do so, subject to the following conditions: --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- The above copyright notice and this permission notice shall be included --</EM></span> -+<span class="comment"><EM>-- in all copies or substantial portions of the Software. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></span> -+<span class="comment"><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></span> -+<span class="comment"><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></span> -+<span class="comment"><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></span> -+<span class="comment"><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></span> -+<span class="comment"><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></span> -+<span class="comment"><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></span> -+<span class="comment"><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></span> -+<span class="comment"><EM>-- sale, use or other dealings in this Software without prior written --</EM></span> -+<span class="comment"><EM>-- authorization. --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Author: Juergen Pfeifer, 1996</EM></span> -+<span class="comment"><EM>-- Version Control:</EM></span> -+<span class="comment"><EM>-- @Revision: 1.12 @</EM></span> -+<span class="comment"><EM>-- Binding Version 01.00</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<b>package</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-forms__ads.htm#ref_49_35">Forms</A>.<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_43_41">Field_Types</A>.<span class="symbol"><A NAME="ref_41_53" HREF="terminal_interface-curses-forms-field_types-ipv4_address__adb.htm#ref_44_58">IPV4_Address</A></span> <b>is</b> - <b>pragma</b> Preelaborate - (<A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-forms__ads.htm#ref_49_35">Forms</A>.<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_43_41">Field_Types</A>.<A HREF="terminal_interface-curses-forms-field_types-ipv4_address__ads.htm#ref_41_53">IPV4_Address</A>); - -- <b>type</b> <FONT COLOR=red><A NAME="ref_45_9">Internet_V4_Address_Field</A></FONT> <b>is</b> <b>new</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_52_9">Field_Type</A> <b>with</b> <b>null</b> <b>record</b>; -+ <b>type</b> <span class="symbol"><A NAME="ref_45_9">Internet_V4_Address_Field</A></span> <b>is</b> <b>new</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_52_9">Field_Type</A> <b>with</b> <b>null</b> <b>record</b>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_47_14" HREF="terminal_interface-curses-forms-field_types-ipv4_address__adb.htm#ref_46_14">Set_Field_Type</A></FONT> (<FONT COLOR=red><A NAME="ref_47_30" HREF="terminal_interface-curses-forms-field_types-ipv4_address__adb.htm#ref_46_30">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_48_30" HREF="terminal_interface-curses-forms-field_types-ipv4_address__adb.htm#ref_47_30">Typ</A></FONT> : <A HREF="terminal_interface-curses-forms-field_types-ipv4_address__ads.htm#ref_45_9">Internet_V4_Address_Field</A>); -+ <b>procedure</b> <span class="symbol"><A NAME="ref_47_14" HREF="terminal_interface-curses-forms-field_types-ipv4_address__adb.htm#ref_46_14">Set_Field_Type</A></span> (<span class="symbol"><A NAME="ref_47_30" HREF="terminal_interface-curses-forms-field_types-ipv4_address__adb.htm#ref_46_30">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_48_30" HREF="terminal_interface-curses-forms-field_types-ipv4_address__adb.htm#ref_47_30">Typ</A></span> : <A HREF="terminal_interface-curses-forms-field_types-ipv4_address__ads.htm#ref_45_9">Internet_V4_Address_Field</A>); - <b>pragma</b> Inline (Set_Field_Type); - - <b>end</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-forms__ads.htm#ref_49_35">Forms</A>.<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_43_41">Field_Types</A>.<A HREF="terminal_interface-curses-forms-field_types-ipv4_address__ads.htm#ref_41_53">IPV4_Address</A>; -diff -Naur ncurses-5.9/doc/html/ada/terminal_interface-curses-forms-field_types-numeric__adb.htm ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-forms-field_types-numeric__adb.htm ---- ncurses-5.9/doc/html/ada/terminal_interface-curses-forms-field_types-numeric__adb.htm 2011-03-20 00:18:39.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-forms-field_types-numeric__adb.htm 2014-09-01 16:33:22.277791991 +0200 -@@ -1,66 +1,78 @@ --<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> --<HTML><HEAD><TITLE>terminal_interface-curses-forms-field_types-numeric.adb</TITLE></HEAD> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> -+<HTML> -+<HEAD> -+<TITLE>terminal_interface-curses-forms-field_types-numeric.adb</TITLE> -+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> -+<style type="text/css"> -+*.comment { -+ color: green; -+} -+*.symbol { -+ color: red; -+} -+</style> -+</HEAD> - <BODY> --<HR><DIV ALIGN="center"><H1> File : terminal_interface-curses-forms-field_types-numeric.adb </H1></DIV><HR> -+<HR><DIV style="text-align:center"><H1> File : terminal_interface-curses-forms-field_types-numeric.adb </H1></DIV><HR> - <PRE> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Terminal_Interface.Curses.Forms.Field_Types.Numeric --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- B O D Y --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Copyright (c) 1998-2009,2011 Free Software Foundation, Inc. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></FONT> --<FONT COLOR=green><EM>-- copy of this software and associated documentation files (the --</EM></FONT> --<FONT COLOR=green><EM>-- "Software"), to deal in the Software without restriction, including --</EM></FONT> --<FONT COLOR=green><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></FONT> --<FONT COLOR=green><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></FONT> --<FONT COLOR=green><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></FONT> --<FONT COLOR=green><EM>-- furnished to do so, subject to the following conditions: --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- The above copyright notice and this permission notice shall be included --</EM></FONT> --<FONT COLOR=green><EM>-- in all copies or substantial portions of the Software. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></FONT> --<FONT COLOR=green><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></FONT> --<FONT COLOR=green><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></FONT> --<FONT COLOR=green><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></FONT> --<FONT COLOR=green><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></FONT> --<FONT COLOR=green><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></FONT> --<FONT COLOR=green><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></FONT> --<FONT COLOR=green><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></FONT> --<FONT COLOR=green><EM>-- sale, use or other dealings in this Software without prior written --</EM></FONT> --<FONT COLOR=green><EM>-- authorization. --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Author: Juergen Pfeifer, 1996</EM></FONT> --<FONT COLOR=green><EM>-- Version Control:</EM></FONT> --<FONT COLOR=green><EM>-- @Revision: 1.12 @</EM></FONT> --<FONT COLOR=green><EM>-- @Date: 2011/03/19 00:45:37 @</EM></FONT> --<FONT COLOR=green><EM>-- Binding Version 01.00</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<b>with</b> <A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>.C; -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Terminal_Interface.Curses.Forms.Field_Types.Numeric --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- B O D Y --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Copyright (c) 1998-2009,2011 Free Software Foundation, Inc. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></span> -+<span class="comment"><EM>-- copy of this software and associated documentation files (the --</EM></span> -+<span class="comment"><EM>-- "Software"), to deal in the Software without restriction, including --</EM></span> -+<span class="comment"><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></span> -+<span class="comment"><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></span> -+<span class="comment"><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></span> -+<span class="comment"><EM>-- furnished to do so, subject to the following conditions: --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- The above copyright notice and this permission notice shall be included --</EM></span> -+<span class="comment"><EM>-- in all copies or substantial portions of the Software. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></span> -+<span class="comment"><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></span> -+<span class="comment"><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></span> -+<span class="comment"><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></span> -+<span class="comment"><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></span> -+<span class="comment"><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></span> -+<span class="comment"><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></span> -+<span class="comment"><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></span> -+<span class="comment"><EM>-- sale, use or other dealings in this Software without prior written --</EM></span> -+<span class="comment"><EM>-- authorization. --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Author: Juergen Pfeifer, 1996</EM></span> -+<span class="comment"><EM>-- Version Control:</EM></span> -+<span class="comment"><EM>-- @Revision: 1.12 @</EM></span> -+<span class="comment"><EM>-- @Date: 2011/03/19 00:45:37 @</EM></span> -+<span class="comment"><EM>-- Binding Version 01.00</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<b>with</b> <A HREF="interfac__ads.htm#ref_36_9">Interfaces</A>.C; - <b>with</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-aux__ads.htm#ref_50_35">Aux</A>; <b>use</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-aux__ads.htm#ref_50_35">Aux</A>; - --<b>package</b> <b>body</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-forms__ads.htm#ref_49_35">Forms</A>.<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_43_41">Field_Types</A>.<FONT COLOR=red><A NAME="ref_45_58" HREF="terminal_interface-curses-forms-field_types-numeric__ads.htm#ref_41_53">Numeric</A></FONT> <b>is</b> -+<b>package</b> <b>body</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-forms__ads.htm#ref_49_35">Forms</A>.<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_43_41">Field_Types</A>.<span class="symbol"><A NAME="ref_45_58" HREF="terminal_interface-curses-forms-field_types-numeric__ads.htm#ref_41_53">Numeric</A></span> <b>is</b> - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_47_14" HREF="terminal_interface-curses-forms-field_types-numeric__ads.htm#ref_51_14">Set_Field_Type</A></FONT> (<FONT COLOR=red><A NAME="ref_47_30" HREF="terminal_interface-curses-forms-field_types-numeric__ads.htm#ref_51_30">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_48_30" HREF="terminal_interface-curses-forms-field_types-numeric__ads.htm#ref_52_30">Typ</A></FONT> : <A HREF="terminal_interface-curses-forms-field_types-numeric__ads.htm#ref_44_9">Numeric_Field</A>) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_47_14" HREF="terminal_interface-curses-forms-field_types-numeric__ads.htm#ref_51_14">Set_Field_Type</A></span> (<span class="symbol"><A NAME="ref_47_30" HREF="terminal_interface-curses-forms-field_types-numeric__ads.htm#ref_51_30">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_48_30" HREF="terminal_interface-curses-forms-field_types-numeric__ads.htm#ref_52_30">Typ</A></span> : <A HREF="terminal_interface-curses-forms-field_types-numeric__ads.htm#ref_44_9">Numeric_Field</A>) - <b>is</b> -- <b>type</b> <FONT COLOR=red><A NAME="ref_50_12">Double</A></FONT> <b>is</b> <b>new</b> <A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>.C.double; -+ <b>type</b> <span class="symbol"><A NAME="ref_50_12">Double</A></span> <b>is</b> <b>new</b> <A HREF="interfac__ads.htm#ref_36_9">Interfaces</A>.C.double; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_52_16">Set_Fld_Type</A></FONT> (<FONT COLOR=red><A NAME="ref_52_30" HREF="terminal_interface-curses-forms-field_types-numeric__adb.htm#ref_52_16">F</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A> := <A HREF="terminal_interface-curses-forms-field_types-numeric__ads.htm#ref_51_30">Fld</A>; -- <FONT COLOR=red><A NAME="ref_53_30" HREF="terminal_interface-curses-forms-field_types-numeric__adb.htm#ref_52_16">Arg1</A></FONT> : <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_46_12">C_Int</A>; -- <FONT COLOR=red><A NAME="ref_54_30" HREF="terminal_interface-curses-forms-field_types-numeric__adb.htm#ref_52_16">Arg2</A></FONT> : <A HREF="terminal_interface-curses-forms-field_types-numeric__adb.htm#ref_50_12">Double</A>; -- <FONT COLOR=red><A NAME="ref_55_30" HREF="terminal_interface-curses-forms-field_types-numeric__adb.htm#ref_52_16">Arg3</A></FONT> : <A HREF="terminal_interface-curses-forms-field_types-numeric__adb.htm#ref_50_12">Double</A>) <b>return</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_46_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_52_16">Set_Fld_Type</A></span> (<span class="symbol"><A NAME="ref_52_30" HREF="terminal_interface-curses-forms-field_types-numeric__adb.htm#ref_52_16">F</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A> := <A HREF="terminal_interface-curses-forms-field_types-numeric__ads.htm#ref_51_30">Fld</A>; -+ <span class="symbol"><A NAME="ref_53_30" HREF="terminal_interface-curses-forms-field_types-numeric__adb.htm#ref_52_16">Arg1</A></span> : <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_46_12">C_Int</A>; -+ <span class="symbol"><A NAME="ref_54_30" HREF="terminal_interface-curses-forms-field_types-numeric__adb.htm#ref_52_16">Arg2</A></span> : <A HREF="terminal_interface-curses-forms-field_types-numeric__adb.htm#ref_50_12">Double</A>; -+ <span class="symbol"><A NAME="ref_55_30" HREF="terminal_interface-curses-forms-field_types-numeric__adb.htm#ref_52_16">Arg3</A></span> : <A HREF="terminal_interface-curses-forms-field_types-numeric__adb.htm#ref_50_12">Double</A>) <b>return</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_46_12">C_Int</A>; - <b>pragma</b> Import (C, Set_Fld_Type, "set_field_type_numeric"); - -- <FONT COLOR=red><A NAME="ref_58_7">Res</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A>; -+ <span class="symbol"><A NAME="ref_58_7">Res</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A>; - <b>begin</b> - <A HREF="terminal_interface-curses-forms-field_types-numeric__adb.htm#ref_58_7">Res</A> := <A HREF="terminal_interface-curses-forms-field_types-numeric__adb.htm#ref_52_16">Set_Fld_Type</A> (<A HREF="terminal_interface-curses-forms-field_types-numeric__adb.htm#ref_53_30">Arg1</A> =&gt; <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_46_12">C_Int</A> (<A HREF="terminal_interface-curses-forms-field_types-numeric__ads.htm#ref_52_30">Typ</A>.<A HREF="terminal_interface-curses-forms-field_types-numeric__ads.htm#ref_46_10">Precision</A>), - <A HREF="terminal_interface-curses-forms-field_types-numeric__adb.htm#ref_54_30">Arg2</A> =&gt; <A HREF="terminal_interface-curses-forms-field_types-numeric__adb.htm#ref_50_12">Double</A> (<A HREF="terminal_interface-curses-forms-field_types-numeric__ads.htm#ref_52_30">Typ</A>.<A HREF="terminal_interface-curses-forms-field_types-numeric__ads.htm#ref_47_10">Lower_Limit</A>), -diff -Naur ncurses-5.9/doc/html/ada/terminal_interface-curses-forms-field_types-numeric__ads.htm ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-forms-field_types-numeric__ads.htm ---- ncurses-5.9/doc/html/ada/terminal_interface-curses-forms-field_types-numeric__ads.htm 2010-01-09 21:31:26.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-forms-field_types-numeric__ads.htm 2014-09-01 16:33:22.277791991 +0200 -@@ -1,60 +1,72 @@ --<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> --<HTML><HEAD><TITLE>terminal_interface-curses-forms-field_types-numeric.ads</TITLE></HEAD> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> -+<HTML> -+<HEAD> -+<TITLE>terminal_interface-curses-forms-field_types-numeric.ads</TITLE> -+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> -+<style type="text/css"> -+*.comment { -+ color: green; -+} -+*.symbol { -+ color: red; -+} -+</style> -+</HEAD> - <BODY> --<HR><DIV ALIGN="center"><H1> File : terminal_interface-curses-forms-field_types-numeric.ads </H1></DIV><HR> -+<HR><DIV style="text-align:center"><H1> File : terminal_interface-curses-forms-field_types-numeric.ads </H1></DIV><HR> - <PRE> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Terminal_Interface.Curses.Forms.Field_Types.Numeric --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- S P E C --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Copyright (c) 1998-2003,2009 Free Software Foundation, Inc. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></FONT> --<FONT COLOR=green><EM>-- copy of this software and associated documentation files (the --</EM></FONT> --<FONT COLOR=green><EM>-- "Software"), to deal in the Software without restriction, including --</EM></FONT> --<FONT COLOR=green><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></FONT> --<FONT COLOR=green><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></FONT> --<FONT COLOR=green><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></FONT> --<FONT COLOR=green><EM>-- furnished to do so, subject to the following conditions: --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- The above copyright notice and this permission notice shall be included --</EM></FONT> --<FONT COLOR=green><EM>-- in all copies or substantial portions of the Software. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></FONT> --<FONT COLOR=green><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></FONT> --<FONT COLOR=green><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></FONT> --<FONT COLOR=green><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></FONT> --<FONT COLOR=green><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></FONT> --<FONT COLOR=green><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></FONT> --<FONT COLOR=green><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></FONT> --<FONT COLOR=green><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></FONT> --<FONT COLOR=green><EM>-- sale, use or other dealings in this Software without prior written --</EM></FONT> --<FONT COLOR=green><EM>-- authorization. --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Author: Juergen Pfeifer, 1996</EM></FONT> --<FONT COLOR=green><EM>-- Version Control:</EM></FONT> --<FONT COLOR=green><EM>-- @Revision: 1.12 @</EM></FONT> --<FONT COLOR=green><EM>-- Binding Version 01.00</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<b>package</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-forms__ads.htm#ref_49_35">Forms</A>.<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_43_41">Field_Types</A>.<FONT COLOR=red><A NAME="ref_41_53" HREF="terminal_interface-curses-forms-field_types-numeric__adb.htm#ref_45_58">Numeric</A></FONT> <b>is</b> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Terminal_Interface.Curses.Forms.Field_Types.Numeric --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- S P E C --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Copyright (c) 1998-2003,2009 Free Software Foundation, Inc. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></span> -+<span class="comment"><EM>-- copy of this software and associated documentation files (the --</EM></span> -+<span class="comment"><EM>-- "Software"), to deal in the Software without restriction, including --</EM></span> -+<span class="comment"><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></span> -+<span class="comment"><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></span> -+<span class="comment"><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></span> -+<span class="comment"><EM>-- furnished to do so, subject to the following conditions: --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- The above copyright notice and this permission notice shall be included --</EM></span> -+<span class="comment"><EM>-- in all copies or substantial portions of the Software. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></span> -+<span class="comment"><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></span> -+<span class="comment"><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></span> -+<span class="comment"><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></span> -+<span class="comment"><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></span> -+<span class="comment"><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></span> -+<span class="comment"><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></span> -+<span class="comment"><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></span> -+<span class="comment"><EM>-- sale, use or other dealings in this Software without prior written --</EM></span> -+<span class="comment"><EM>-- authorization. --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Author: Juergen Pfeifer, 1996</EM></span> -+<span class="comment"><EM>-- Version Control:</EM></span> -+<span class="comment"><EM>-- @Revision: 1.12 @</EM></span> -+<span class="comment"><EM>-- Binding Version 01.00</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<b>package</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-forms__ads.htm#ref_49_35">Forms</A>.<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_43_41">Field_Types</A>.<span class="symbol"><A NAME="ref_41_53" HREF="terminal_interface-curses-forms-field_types-numeric__adb.htm#ref_45_58">Numeric</A></span> <b>is</b> - <b>pragma</b> Preelaborate (<A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-forms__ads.htm#ref_49_35">Forms</A>.<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_43_41">Field_Types</A>.<A HREF="terminal_interface-curses-forms-field_types-numeric__ads.htm#ref_41_53">Numeric</A>); - -- <b>type</b> <FONT COLOR=red><A NAME="ref_44_9">Numeric_Field</A></FONT> <b>is</b> <b>new</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_52_9">Field_Type</A> <b>with</b> -+ <b>type</b> <span class="symbol"><A NAME="ref_44_9">Numeric_Field</A></span> <b>is</b> <b>new</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_52_9">Field_Type</A> <b>with</b> - <b>record</b> -- <FONT COLOR=red><A NAME="ref_46_10">Precision</A></FONT> : Natural; -- <FONT COLOR=red><A NAME="ref_47_10">Lower_Limit</A></FONT> : Float; -- <FONT COLOR=red><A NAME="ref_48_10">Upper_Limit</A></FONT> : Float; -+ <span class="symbol"><A NAME="ref_46_10">Precision</A></span> : Natural; -+ <span class="symbol"><A NAME="ref_47_10">Lower_Limit</A></span> : Float; -+ <span class="symbol"><A NAME="ref_48_10">Upper_Limit</A></span> : Float; - <b>end</b> <b>record</b>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_51_14" HREF="terminal_interface-curses-forms-field_types-numeric__adb.htm#ref_47_14">Set_Field_Type</A></FONT> (<FONT COLOR=red><A NAME="ref_51_30" HREF="terminal_interface-curses-forms-field_types-numeric__adb.htm#ref_47_30">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_52_30" HREF="terminal_interface-curses-forms-field_types-numeric__adb.htm#ref_48_30">Typ</A></FONT> : <A HREF="terminal_interface-curses-forms-field_types-numeric__ads.htm#ref_44_9">Numeric_Field</A>); -+ <b>procedure</b> <span class="symbol"><A NAME="ref_51_14" HREF="terminal_interface-curses-forms-field_types-numeric__adb.htm#ref_47_14">Set_Field_Type</A></span> (<span class="symbol"><A NAME="ref_51_30" HREF="terminal_interface-curses-forms-field_types-numeric__adb.htm#ref_47_30">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_52_30" HREF="terminal_interface-curses-forms-field_types-numeric__adb.htm#ref_48_30">Typ</A></span> : <A HREF="terminal_interface-curses-forms-field_types-numeric__ads.htm#ref_44_9">Numeric_Field</A>); - <b>pragma</b> Inline (Set_Field_Type); - - <b>end</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-forms__ads.htm#ref_49_35">Forms</A>.<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_43_41">Field_Types</A>.<A HREF="terminal_interface-curses-forms-field_types-numeric__ads.htm#ref_41_53">Numeric</A>; -diff -Naur ncurses-5.9/doc/html/ada/terminal_interface-curses-forms-field_types-regexp__adb.htm ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-forms-field_types-regexp__adb.htm ---- ncurses-5.9/doc/html/ada/terminal_interface-curses-forms-field_types-regexp__adb.htm 2011-03-20 00:18:39.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-forms-field_types-regexp__adb.htm 2014-09-01 16:33:22.278791993 +0200 -@@ -1,65 +1,77 @@ --<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> --<HTML><HEAD><TITLE>terminal_interface-curses-forms-field_types-regexp.adb</TITLE></HEAD> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> -+<HTML> -+<HEAD> -+<TITLE>terminal_interface-curses-forms-field_types-regexp.adb</TITLE> -+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> -+<style type="text/css"> -+*.comment { -+ color: green; -+} -+*.symbol { -+ color: red; -+} -+</style> -+</HEAD> - <BODY> --<HR><DIV ALIGN="center"><H1> File : terminal_interface-curses-forms-field_types-regexp.adb </H1></DIV><HR> -+<HR><DIV style="text-align:center"><H1> File : terminal_interface-curses-forms-field_types-regexp.adb </H1></DIV><HR> - <PRE> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Terminal_Interface.Curses.Forms.Field_Types.RegExp --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- B O D Y --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Copyright (c) 1998-2009,2011 Free Software Foundation, Inc. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></FONT> --<FONT COLOR=green><EM>-- copy of this software and associated documentation files (the --</EM></FONT> --<FONT COLOR=green><EM>-- "Software"), to deal in the Software without restriction, including --</EM></FONT> --<FONT COLOR=green><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></FONT> --<FONT COLOR=green><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></FONT> --<FONT COLOR=green><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></FONT> --<FONT COLOR=green><EM>-- furnished to do so, subject to the following conditions: --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- The above copyright notice and this permission notice shall be included --</EM></FONT> --<FONT COLOR=green><EM>-- in all copies or substantial portions of the Software. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></FONT> --<FONT COLOR=green><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></FONT> --<FONT COLOR=green><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></FONT> --<FONT COLOR=green><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></FONT> --<FONT COLOR=green><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></FONT> --<FONT COLOR=green><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></FONT> --<FONT COLOR=green><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></FONT> --<FONT COLOR=green><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></FONT> --<FONT COLOR=green><EM>-- sale, use or other dealings in this Software without prior written --</EM></FONT> --<FONT COLOR=green><EM>-- authorization. --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Author: Juergen Pfeifer, 1996</EM></FONT> --<FONT COLOR=green><EM>-- Version Control:</EM></FONT> --<FONT COLOR=green><EM>-- @Revision: 1.10 @</EM></FONT> --<FONT COLOR=green><EM>-- Binding Version 01.00</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<b>with</b> <A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>.C; <b>use</b> <A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>.C; -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Terminal_Interface.Curses.Forms.Field_Types.RegExp --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- B O D Y --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Copyright (c) 1998-2009,2011 Free Software Foundation, Inc. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></span> -+<span class="comment"><EM>-- copy of this software and associated documentation files (the --</EM></span> -+<span class="comment"><EM>-- "Software"), to deal in the Software without restriction, including --</EM></span> -+<span class="comment"><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></span> -+<span class="comment"><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></span> -+<span class="comment"><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></span> -+<span class="comment"><EM>-- furnished to do so, subject to the following conditions: --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- The above copyright notice and this permission notice shall be included --</EM></span> -+<span class="comment"><EM>-- in all copies or substantial portions of the Software. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></span> -+<span class="comment"><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></span> -+<span class="comment"><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></span> -+<span class="comment"><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></span> -+<span class="comment"><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></span> -+<span class="comment"><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></span> -+<span class="comment"><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></span> -+<span class="comment"><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></span> -+<span class="comment"><EM>-- sale, use or other dealings in this Software without prior written --</EM></span> -+<span class="comment"><EM>-- authorization. --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Author: Juergen Pfeifer, 1996</EM></span> -+<span class="comment"><EM>-- Version Control:</EM></span> -+<span class="comment"><EM>-- @Revision: 1.10 @</EM></span> -+<span class="comment"><EM>-- Binding Version 01.00</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<b>with</b> <A HREF="interfac__ads.htm#ref_36_9">Interfaces</A>.C; <b>use</b> <A HREF="interfac__ads.htm#ref_36_9">Interfaces</A>.C; - <b>with</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-aux__ads.htm#ref_50_35">Aux</A>; <b>use</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-aux__ads.htm#ref_50_35">Aux</A>; - --<b>package</b> <b>body</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-forms__ads.htm#ref_49_35">Forms</A>.<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_43_41">Field_Types</A>.<FONT COLOR=red><A NAME="ref_44_58" HREF="terminal_interface-curses-forms-field_types-regexp__ads.htm#ref_41_53">RegExp</A></FONT> <b>is</b> -+<b>package</b> <b>body</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-forms__ads.htm#ref_49_35">Forms</A>.<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_43_41">Field_Types</A>.<span class="symbol"><A NAME="ref_44_58" HREF="terminal_interface-curses-forms-field_types-regexp__ads.htm#ref_41_53">RegExp</A></span> <b>is</b> - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_46_14" HREF="terminal_interface-curses-forms-field_types-regexp__ads.htm#ref_51_14">Set_Field_Type</A></FONT> (<FONT COLOR=red><A NAME="ref_46_30" HREF="terminal_interface-curses-forms-field_types-regexp__ads.htm#ref_51_30">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_47_30" HREF="terminal_interface-curses-forms-field_types-regexp__ads.htm#ref_52_30">Typ</A></FONT> : <A HREF="terminal_interface-curses-forms-field_types-regexp__ads.htm#ref_46_9">Regular_Expression_Field</A>) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_46_14" HREF="terminal_interface-curses-forms-field_types-regexp__ads.htm#ref_51_14">Set_Field_Type</A></span> (<span class="symbol"><A NAME="ref_46_30" HREF="terminal_interface-curses-forms-field_types-regexp__ads.htm#ref_51_30">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_47_30" HREF="terminal_interface-curses-forms-field_types-regexp__ads.htm#ref_52_30">Typ</A></span> : <A HREF="terminal_interface-curses-forms-field_types-regexp__ads.htm#ref_46_9">Regular_Expression_Field</A>) - <b>is</b> -- <b>type</b> <FONT COLOR=red><A NAME="ref_49_12">Char_Ptr</A></FONT> <b>is</b> <b>access</b> <b>all</b> <A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>.C.char; -+ <b>type</b> <span class="symbol"><A NAME="ref_49_12">Char_Ptr</A></span> <b>is</b> <b>access</b> <b>all</b> <A HREF="interfac__ads.htm#ref_36_9">Interfaces</A>.C.char; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_51_16">Set_Ftyp</A></FONT> (<FONT COLOR=red><A NAME="ref_51_26" HREF="terminal_interface-curses-forms-field_types-regexp__adb.htm#ref_51_16">F</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A> := <A HREF="terminal_interface-curses-forms-field_types-regexp__ads.htm#ref_51_30">Fld</A>; -- <FONT COLOR=red><A NAME="ref_52_26" HREF="terminal_interface-curses-forms-field_types-regexp__adb.htm#ref_51_16">Arg1</A></FONT> : <A HREF="terminal_interface-curses-forms-field_types-regexp__adb.htm#ref_49_12">Char_Ptr</A>) <b>return</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_46_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_51_16">Set_Ftyp</A></span> (<span class="symbol"><A NAME="ref_51_26" HREF="terminal_interface-curses-forms-field_types-regexp__adb.htm#ref_51_16">F</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A> := <A HREF="terminal_interface-curses-forms-field_types-regexp__ads.htm#ref_51_30">Fld</A>; -+ <span class="symbol"><A NAME="ref_52_26" HREF="terminal_interface-curses-forms-field_types-regexp__adb.htm#ref_51_16">Arg1</A></span> : <A HREF="terminal_interface-curses-forms-field_types-regexp__adb.htm#ref_49_12">Char_Ptr</A>) <b>return</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_46_12">C_Int</A>; - <b>pragma</b> Import (C, Set_Ftyp, "set_field_type_regexp"); - -- <FONT COLOR=red><A NAME="ref_55_7">Txt</A></FONT> : char_array (0 .. <A HREF="terminal_interface-curses-forms-field_types-regexp__ads.htm#ref_52_30">Typ</A>.<A HREF="terminal_interface-curses-forms-field_types-regexp__ads.htm#ref_48_10">Regular_Expression</A>.<b>all</b>'Length); -- <FONT COLOR=red><A NAME="ref_56_7">Len</A></FONT> : size_t; -- <FONT COLOR=red><A NAME="ref_57_7">Res</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A>; -+ <span class="symbol"><A NAME="ref_55_7">Txt</A></span> : char_array (0 .. <A HREF="terminal_interface-curses-forms-field_types-regexp__ads.htm#ref_52_30">Typ</A>.<A HREF="terminal_interface-curses-forms-field_types-regexp__ads.htm#ref_48_10">Regular_Expression</A>.<b>all</b>'Length); -+ <span class="symbol"><A NAME="ref_56_7">Len</A></span> : size_t; -+ <span class="symbol"><A NAME="ref_57_7">Res</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A>; - <b>begin</b> - To_C (<A HREF="terminal_interface-curses-forms-field_types-regexp__ads.htm#ref_52_30">Typ</A>.<A HREF="terminal_interface-curses-forms-field_types-regexp__ads.htm#ref_48_10">Regular_Expression</A>.<b>all</b>, <A HREF="terminal_interface-curses-forms-field_types-regexp__adb.htm#ref_55_7">Txt</A>, <A HREF="terminal_interface-curses-forms-field_types-regexp__adb.htm#ref_56_7">Len</A>); - <A HREF="terminal_interface-curses-forms-field_types-regexp__adb.htm#ref_57_7">Res</A> := <A HREF="terminal_interface-curses-forms-field_types-regexp__adb.htm#ref_51_16">Set_Ftyp</A> (<A HREF="terminal_interface-curses-forms-field_types-regexp__adb.htm#ref_52_26">Arg1</A> =&gt; <A HREF="terminal_interface-curses-forms-field_types-regexp__adb.htm#ref_55_7">Txt</A> (<A HREF="terminal_interface-curses-forms-field_types-regexp__adb.htm#ref_55_7">Txt</A>'First)'<b>Access</b>); -diff -Naur ncurses-5.9/doc/html/ada/terminal_interface-curses-forms-field_types-regexp__ads.htm ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-forms-field_types-regexp__ads.htm ---- ncurses-5.9/doc/html/ada/terminal_interface-curses-forms-field_types-regexp__ads.htm 2010-01-09 21:31:26.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-forms-field_types-regexp__ads.htm 2014-09-01 16:33:22.278791993 +0200 -@@ -1,60 +1,72 @@ --<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> --<HTML><HEAD><TITLE>terminal_interface-curses-forms-field_types-regexp.ads</TITLE></HEAD> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> -+<HTML> -+<HEAD> -+<TITLE>terminal_interface-curses-forms-field_types-regexp.ads</TITLE> -+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> -+<style type="text/css"> -+*.comment { -+ color: green; -+} -+*.symbol { -+ color: red; -+} -+</style> -+</HEAD> - <BODY> --<HR><DIV ALIGN="center"><H1> File : terminal_interface-curses-forms-field_types-regexp.ads </H1></DIV><HR> -+<HR><DIV style="text-align:center"><H1> File : terminal_interface-curses-forms-field_types-regexp.ads </H1></DIV><HR> - <PRE> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Terminal_Interface.Curses.Forms.Field_Types.RegExp --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- S P E C --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Copyright (c) 1998-2003,2009 Free Software Foundation, Inc. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></FONT> --<FONT COLOR=green><EM>-- copy of this software and associated documentation files (the --</EM></FONT> --<FONT COLOR=green><EM>-- "Software"), to deal in the Software without restriction, including --</EM></FONT> --<FONT COLOR=green><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></FONT> --<FONT COLOR=green><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></FONT> --<FONT COLOR=green><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></FONT> --<FONT COLOR=green><EM>-- furnished to do so, subject to the following conditions: --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- The above copyright notice and this permission notice shall be included --</EM></FONT> --<FONT COLOR=green><EM>-- in all copies or substantial portions of the Software. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></FONT> --<FONT COLOR=green><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></FONT> --<FONT COLOR=green><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></FONT> --<FONT COLOR=green><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></FONT> --<FONT COLOR=green><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></FONT> --<FONT COLOR=green><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></FONT> --<FONT COLOR=green><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></FONT> --<FONT COLOR=green><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></FONT> --<FONT COLOR=green><EM>-- sale, use or other dealings in this Software without prior written --</EM></FONT> --<FONT COLOR=green><EM>-- authorization. --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Author: Juergen Pfeifer, 1996</EM></FONT> --<FONT COLOR=green><EM>-- Version Control:</EM></FONT> --<FONT COLOR=green><EM>-- @Revision: 1.12 @</EM></FONT> --<FONT COLOR=green><EM>-- Binding Version 01.00</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<b>package</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-forms__ads.htm#ref_49_35">Forms</A>.<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_43_41">Field_Types</A>.<FONT COLOR=red><A NAME="ref_41_53" HREF="terminal_interface-curses-forms-field_types-regexp__adb.htm#ref_44_58">RegExp</A></FONT> <b>is</b> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Terminal_Interface.Curses.Forms.Field_Types.RegExp --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- S P E C --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Copyright (c) 1998-2003,2009 Free Software Foundation, Inc. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></span> -+<span class="comment"><EM>-- copy of this software and associated documentation files (the --</EM></span> -+<span class="comment"><EM>-- "Software"), to deal in the Software without restriction, including --</EM></span> -+<span class="comment"><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></span> -+<span class="comment"><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></span> -+<span class="comment"><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></span> -+<span class="comment"><EM>-- furnished to do so, subject to the following conditions: --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- The above copyright notice and this permission notice shall be included --</EM></span> -+<span class="comment"><EM>-- in all copies or substantial portions of the Software. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></span> -+<span class="comment"><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></span> -+<span class="comment"><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></span> -+<span class="comment"><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></span> -+<span class="comment"><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></span> -+<span class="comment"><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></span> -+<span class="comment"><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></span> -+<span class="comment"><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></span> -+<span class="comment"><EM>-- sale, use or other dealings in this Software without prior written --</EM></span> -+<span class="comment"><EM>-- authorization. --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Author: Juergen Pfeifer, 1996</EM></span> -+<span class="comment"><EM>-- Version Control:</EM></span> -+<span class="comment"><EM>-- @Revision: 1.12 @</EM></span> -+<span class="comment"><EM>-- Binding Version 01.00</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<b>package</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-forms__ads.htm#ref_49_35">Forms</A>.<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_43_41">Field_Types</A>.<span class="symbol"><A NAME="ref_41_53" HREF="terminal_interface-curses-forms-field_types-regexp__adb.htm#ref_44_58">RegExp</A></span> <b>is</b> - <b>pragma</b> Preelaborate (<A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-forms__ads.htm#ref_49_35">Forms</A>.<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_43_41">Field_Types</A>.<A HREF="terminal_interface-curses-forms-field_types-regexp__ads.htm#ref_41_53">RegExp</A>); - -- <b>type</b> <FONT COLOR=red><A NAME="ref_44_9">String_Access</A></FONT> <b>is</b> <b>access</b> String; -+ <b>type</b> <span class="symbol"><A NAME="ref_44_9">String_Access</A></span> <b>is</b> <b>access</b> String; - -- <b>type</b> <FONT COLOR=red><A NAME="ref_46_9">Regular_Expression_Field</A></FONT> <b>is</b> <b>new</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_52_9">Field_Type</A> <b>with</b> -+ <b>type</b> <span class="symbol"><A NAME="ref_46_9">Regular_Expression_Field</A></span> <b>is</b> <b>new</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_52_9">Field_Type</A> <b>with</b> - <b>record</b> -- <FONT COLOR=red><A NAME="ref_48_10">Regular_Expression</A></FONT> : <A HREF="terminal_interface-curses-forms-field_types-regexp__ads.htm#ref_44_9">String_Access</A>; -+ <span class="symbol"><A NAME="ref_48_10">Regular_Expression</A></span> : <A HREF="terminal_interface-curses-forms-field_types-regexp__ads.htm#ref_44_9">String_Access</A>; - <b>end</b> <b>record</b>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_51_14" HREF="terminal_interface-curses-forms-field_types-regexp__adb.htm#ref_46_14">Set_Field_Type</A></FONT> (<FONT COLOR=red><A NAME="ref_51_30" HREF="terminal_interface-curses-forms-field_types-regexp__adb.htm#ref_46_30">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_52_30" HREF="terminal_interface-curses-forms-field_types-regexp__adb.htm#ref_47_30">Typ</A></FONT> : <A HREF="terminal_interface-curses-forms-field_types-regexp__ads.htm#ref_46_9">Regular_Expression_Field</A>); -+ <b>procedure</b> <span class="symbol"><A NAME="ref_51_14" HREF="terminal_interface-curses-forms-field_types-regexp__adb.htm#ref_46_14">Set_Field_Type</A></span> (<span class="symbol"><A NAME="ref_51_30" HREF="terminal_interface-curses-forms-field_types-regexp__adb.htm#ref_46_30">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_52_30" HREF="terminal_interface-curses-forms-field_types-regexp__adb.htm#ref_47_30">Typ</A></span> : <A HREF="terminal_interface-curses-forms-field_types-regexp__ads.htm#ref_46_9">Regular_Expression_Field</A>); - <b>pragma</b> Inline (Set_Field_Type); - - <b>end</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-forms__ads.htm#ref_49_35">Forms</A>.<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_43_41">Field_Types</A>.<A HREF="terminal_interface-curses-forms-field_types-regexp__ads.htm#ref_41_53">RegExp</A>; -diff -Naur ncurses-5.9/doc/html/ada/terminal_interface-curses-forms-field_types-user__adb.htm ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-forms-field_types-user__adb.htm ---- ncurses-5.9/doc/html/ada/terminal_interface-curses-forms-field_types-user__adb.htm 2011-03-26 22:54:29.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-forms-field_types-user__adb.htm 2014-09-01 16:33:22.279791995 +0200 -@@ -1,72 +1,84 @@ --<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> --<HTML><HEAD><TITLE>terminal_interface-curses-forms-field_types-user.adb</TITLE></HEAD> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> -+<HTML> -+<HEAD> -+<TITLE>terminal_interface-curses-forms-field_types-user.adb</TITLE> -+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> -+<style type="text/css"> -+*.comment { -+ color: green; -+} -+*.symbol { -+ color: red; -+} -+</style> -+</HEAD> - <BODY> --<HR><DIV ALIGN="center"><H1> File : terminal_interface-curses-forms-field_types-user.adb </H1></DIV><HR> -+<HR><DIV style="text-align:center"><H1> File : terminal_interface-curses-forms-field_types-user.adb </H1></DIV><HR> - <PRE> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Terminal_Interface.Curses.Forms.Field_Types.User --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- B O D Y --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Copyright (c) 1998-2009,2011 Free Software Foundation, Inc. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></FONT> --<FONT COLOR=green><EM>-- copy of this software and associated documentation files (the --</EM></FONT> --<FONT COLOR=green><EM>-- "Software"), to deal in the Software without restriction, including --</EM></FONT> --<FONT COLOR=green><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></FONT> --<FONT COLOR=green><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></FONT> --<FONT COLOR=green><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></FONT> --<FONT COLOR=green><EM>-- furnished to do so, subject to the following conditions: --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- The above copyright notice and this permission notice shall be included --</EM></FONT> --<FONT COLOR=green><EM>-- in all copies or substantial portions of the Software. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></FONT> --<FONT COLOR=green><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></FONT> --<FONT COLOR=green><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></FONT> --<FONT COLOR=green><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></FONT> --<FONT COLOR=green><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></FONT> --<FONT COLOR=green><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></FONT> --<FONT COLOR=green><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></FONT> --<FONT COLOR=green><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></FONT> --<FONT COLOR=green><EM>-- sale, use or other dealings in this Software without prior written --</EM></FONT> --<FONT COLOR=green><EM>-- authorization. --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Author: Juergen Pfeifer, 1996</EM></FONT> --<FONT COLOR=green><EM>-- Version Control:</EM></FONT> --<FONT COLOR=green><EM>-- @Revision: 1.21 @</EM></FONT> --<FONT COLOR=green><EM>-- @Date: 2011/03/23 00:44:58 @</EM></FONT> --<FONT COLOR=green><EM>-- Binding Version 01.00</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Terminal_Interface.Curses.Forms.Field_Types.User --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- B O D Y --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Copyright (c) 1998-2009,2011 Free Software Foundation, Inc. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></span> -+<span class="comment"><EM>-- copy of this software and associated documentation files (the --</EM></span> -+<span class="comment"><EM>-- "Software"), to deal in the Software without restriction, including --</EM></span> -+<span class="comment"><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></span> -+<span class="comment"><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></span> -+<span class="comment"><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></span> -+<span class="comment"><EM>-- furnished to do so, subject to the following conditions: --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- The above copyright notice and this permission notice shall be included --</EM></span> -+<span class="comment"><EM>-- in all copies or substantial portions of the Software. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></span> -+<span class="comment"><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></span> -+<span class="comment"><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></span> -+<span class="comment"><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></span> -+<span class="comment"><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></span> -+<span class="comment"><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></span> -+<span class="comment"><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></span> -+<span class="comment"><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></span> -+<span class="comment"><EM>-- sale, use or other dealings in this Software without prior written --</EM></span> -+<span class="comment"><EM>-- authorization. --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Author: Juergen Pfeifer, 1996</EM></span> -+<span class="comment"><EM>-- Version Control:</EM></span> -+<span class="comment"><EM>-- @Revision: 1.21 @</EM></span> -+<span class="comment"><EM>-- @Date: 2011/03/23 00:44:58 @</EM></span> -+<span class="comment"><EM>-- Binding Version 01.00</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> - <b>with</b> System.Address_To_Access_Conversions; - <b>with</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-aux__ads.htm#ref_50_35">Aux</A>; <b>use</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-aux__ads.htm#ref_50_35">Aux</A>; - --<b>package</b> <b>body</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-forms__ads.htm#ref_49_35">Forms</A>.<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_43_41">Field_Types</A>.<FONT COLOR=red><A NAME="ref_45_58" HREF="terminal_interface-curses-forms-field_types-user__ads.htm#ref_44_53">User</A></FONT> <b>is</b> -+<b>package</b> <b>body</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-forms__ads.htm#ref_49_35">Forms</A>.<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_43_41">Field_Types</A>.<span class="symbol"><A NAME="ref_45_58" HREF="terminal_interface-curses-forms-field_types-user__ads.htm#ref_44_53">User</A></span> <b>is</b> - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_47_14" HREF="terminal_interface-curses-forms-field_types-user__ads.htm#ref_70_14">Set_Field_Type</A></FONT> (<FONT COLOR=red><A NAME="ref_47_30" HREF="terminal_interface-curses-forms-field_types-user__ads.htm#ref_70_30">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_48_30" HREF="terminal_interface-curses-forms-field_types-user__ads.htm#ref_71_30">Typ</A></FONT> : <A HREF="terminal_interface-curses-forms-field_types-user__ads.htm#ref_48_9">User_Defined_Field_Type</A>) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_47_14" HREF="terminal_interface-curses-forms-field_types-user__ads.htm#ref_70_14">Set_Field_Type</A></span> (<span class="symbol"><A NAME="ref_47_30" HREF="terminal_interface-curses-forms-field_types-user__ads.htm#ref_70_30">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_48_30" HREF="terminal_interface-curses-forms-field_types-user__ads.htm#ref_71_30">Typ</A></span> : <A HREF="terminal_interface-curses-forms-field_types-user__ads.htm#ref_48_9">User_Defined_Field_Type</A>) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_50_16" HREF="terminal_interface-curses-forms-field_types-user__adb.htm#ref_61_16">Allocate_Arg</A></FONT> (<FONT COLOR=red><A NAME="ref_50_30" HREF="terminal_interface-curses-forms-field_types-user__adb.htm#ref_61_30">T</A></FONT> : <A HREF="terminal_interface-curses-forms-field_types-user__ads.htm#ref_48_9">User_Defined_Field_Type</A>'Class) -+ <b>function</b> <span class="symbol"><A NAME="ref_50_16" HREF="terminal_interface-curses-forms-field_types-user__adb.htm#ref_61_16">Allocate_Arg</A></span> (<span class="symbol"><A NAME="ref_50_30" HREF="terminal_interface-curses-forms-field_types-user__adb.htm#ref_61_30">T</A></span> : <A HREF="terminal_interface-curses-forms-field_types-user__ads.htm#ref_48_9">User_Defined_Field_Type</A>'Class) - <b>return</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_216_9">Argument_Access</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_53_16">Set_Fld_Type</A></FONT> (<FONT COLOR=red><A NAME="ref_53_30" HREF="terminal_interface-curses-forms-field_types-user__adb.htm#ref_53_16">F</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A> := <A HREF="terminal_interface-curses-forms-field_types-user__ads.htm#ref_70_30">Fld</A>; -- <FONT COLOR=red><A NAME="ref_54_30" HREF="terminal_interface-curses-forms-field_types-user__adb.htm#ref_53_16">Cft</A></FONT> : <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_132_9">C_Field_Type</A> := <A HREF="terminal_interface-curses-forms-field_types-user__ads.htm#ref_79_13">C_Generic_Type</A>; -- <FONT COLOR=red><A NAME="ref_55_30" HREF="terminal_interface-curses-forms-field_types-user__adb.htm#ref_53_16">Arg1</A></FONT> : <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_216_9">Argument_Access</A>) -+ <b>function</b> <span class="symbol"><A NAME="ref_53_16">Set_Fld_Type</A></span> (<span class="symbol"><A NAME="ref_53_30" HREF="terminal_interface-curses-forms-field_types-user__adb.htm#ref_53_16">F</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A> := <A HREF="terminal_interface-curses-forms-field_types-user__ads.htm#ref_70_30">Fld</A>; -+ <span class="symbol"><A NAME="ref_54_30" HREF="terminal_interface-curses-forms-field_types-user__adb.htm#ref_53_16">Cft</A></span> : <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_132_9">C_Field_Type</A> := <A HREF="terminal_interface-curses-forms-field_types-user__ads.htm#ref_79_13">C_Generic_Type</A>; -+ <span class="symbol"><A NAME="ref_55_30" HREF="terminal_interface-curses-forms-field_types-user__adb.htm#ref_53_16">Arg1</A></span> : <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_216_9">Argument_Access</A>) - <b>return</b> <A HREF="terminal_interface-curses-forms-field_types-user__ads.htm#ref_46_12">C_Int</A>; - <b>pragma</b> Import (C, Set_Fld_Type, "set_field_type_user"); - -- <FONT COLOR=red><A NAME="ref_59_7">Res</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A>; -+ <span class="symbol"><A NAME="ref_59_7">Res</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_61_16" HREF="terminal_interface-curses-forms-field_types-user__adb.htm#ref_50_16">Allocate_Arg</A></FONT> (<FONT COLOR=red><A NAME="ref_61_30" HREF="terminal_interface-curses-forms-field_types-user__adb.htm#ref_50_30">T</A></FONT> : <A HREF="terminal_interface-curses-forms-field_types-user__ads.htm#ref_48_9">User_Defined_Field_Type</A>'Class) -+ <b>function</b> <span class="symbol"><A NAME="ref_61_16" HREF="terminal_interface-curses-forms-field_types-user__adb.htm#ref_50_16">Allocate_Arg</A></span> (<span class="symbol"><A NAME="ref_61_30" HREF="terminal_interface-curses-forms-field_types-user__adb.htm#ref_50_30">T</A></span> : <A HREF="terminal_interface-curses-forms-field_types-user__ads.htm#ref_48_9">User_Defined_Field_Type</A>'Class) - <b>return</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_216_9">Argument_Access</A> - <b>is</b> -- <FONT COLOR=red><A NAME="ref_64_10">Ptr</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_63_9">Field_Type_Access</A> -+ <span class="symbol"><A NAME="ref_64_10">Ptr</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_63_9">Field_Type_Access</A> - := <b>new</b> <A HREF="terminal_interface-curses-forms-field_types-user__ads.htm#ref_48_9">User_Defined_Field_Type</A>'Class'(<A HREF="terminal_interface-curses-forms-field_types-user__adb.htm#ref_50_30">T</A>); - <b>begin</b> - <b>return</b> <b>new</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_211_9">Argument</A>'(<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_213_7">Usr</A> =&gt; System.Null_Address, -@@ -84,42 +96,42 @@ - <b>package</b> Argument_Conversions <b>is</b> - <b>new</b> System.Address_To_Access_Conversions (<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_211_9">Argument</A>); - -- <b>function</b> <FONT COLOR=red><A NAME="ref_82_13" HREF="terminal_interface-curses-forms-field_types-user__ads.htm#ref_81_13">Generic_Field_Check</A></FONT> (<FONT COLOR=red><A NAME="ref_82_34" HREF="terminal_interface-curses-forms-field_types-user__ads.htm#ref_81_34">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_83_34" HREF="terminal_interface-curses-forms-field_types-user__ads.htm#ref_82_34">Usr</A></FONT> : System.Address) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_1926_9">Curses_Bool</A> -+ <b>function</b> <span class="symbol"><A NAME="ref_82_13" HREF="terminal_interface-curses-forms-field_types-user__ads.htm#ref_81_13">Generic_Field_Check</A></span> (<span class="symbol"><A NAME="ref_82_34" HREF="terminal_interface-curses-forms-field_types-user__ads.htm#ref_81_34">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_83_34" HREF="terminal_interface-curses-forms-field_types-user__ads.htm#ref_82_34">Usr</A></span> : System.Address) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_1925_9">Curses_Bool</A> - <b>is</b> -- <FONT COLOR=red><A NAME="ref_85_7">Result</A></FONT> : Boolean; -- <FONT COLOR=red><A NAME="ref_86_7">Udf</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-forms-field_types-user__ads.htm#ref_53_9">User_Defined_Field_Type_Access</A> := -+ <span class="symbol"><A NAME="ref_85_7">Result</A></span> : Boolean; -+ <span class="symbol"><A NAME="ref_86_7">Udf</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-forms-field_types-user__ads.htm#ref_53_9">User_Defined_Field_Type_Access</A> := - <A HREF="terminal_interface-curses-forms-field_types-user__ads.htm#ref_53_9">User_Defined_Field_Type_Access</A> - (<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_216_9">Argument_Access</A> (Argument_Conversions.To_Pointer (<A HREF="terminal_interface-curses-forms-field_types-user__ads.htm#ref_82_34">Usr</A>)).<b>all</b>.<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_212_7">Typ</A>); - <b>begin</b> - <A HREF="terminal_interface-curses-forms-field_types-user__adb.htm#ref_85_7">Result</A> := <A HREF="terminal_interface-curses-forms-field_types-user__ads.htm#ref_56_13">Field_Check</A> (<A HREF="terminal_interface-curses-forms-field_types-user__ads.htm#ref_81_34">Fld</A>, <A HREF="terminal_interface-curses-forms-field_types-user__adb.htm#ref_86_7">Udf</A>.<b>all</b>); -- <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_1926_9">Curses_Bool</A> (Boolean'Pos (<A HREF="terminal_interface-curses-forms-field_types-user__adb.htm#ref_85_7">Result</A>)); -+ <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_1925_9">Curses_Bool</A> (Boolean'Pos (<A HREF="terminal_interface-curses-forms-field_types-user__adb.htm#ref_85_7">Result</A>)); - <b>end</b> <A HREF="terminal_interface-curses-forms-field_types-user__ads.htm#ref_81_13">Generic_Field_Check</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_94_13" HREF="terminal_interface-curses-forms-field_types-user__ads.htm#ref_88_13">Generic_Char_Check</A></FONT> (<FONT COLOR=red><A NAME="ref_94_33" HREF="terminal_interface-curses-forms-field_types-user__ads.htm#ref_88_33">Ch</A></FONT> : <A HREF="terminal_interface-curses-forms-field_types-user__ads.htm#ref_46_12">C_Int</A>; -- <FONT COLOR=red><A NAME="ref_95_33" HREF="terminal_interface-curses-forms-field_types-user__ads.htm#ref_89_33">Usr</A></FONT> : System.Address) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_1926_9">Curses_Bool</A> -+ <b>function</b> <span class="symbol"><A NAME="ref_94_13" HREF="terminal_interface-curses-forms-field_types-user__ads.htm#ref_88_13">Generic_Char_Check</A></span> (<span class="symbol"><A NAME="ref_94_33" HREF="terminal_interface-curses-forms-field_types-user__ads.htm#ref_88_33">Ch</A></span> : <A HREF="terminal_interface-curses-forms-field_types-user__ads.htm#ref_46_12">C_Int</A>; -+ <span class="symbol"><A NAME="ref_95_33" HREF="terminal_interface-curses-forms-field_types-user__ads.htm#ref_89_33">Usr</A></span> : System.Address) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_1925_9">Curses_Bool</A> - <b>is</b> -- <FONT COLOR=red><A NAME="ref_97_7">Result</A></FONT> : Boolean; -- <FONT COLOR=red><A NAME="ref_98_7">Udf</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-forms-field_types-user__ads.htm#ref_53_9">User_Defined_Field_Type_Access</A> := -+ <span class="symbol"><A NAME="ref_97_7">Result</A></span> : Boolean; -+ <span class="symbol"><A NAME="ref_98_7">Udf</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-forms-field_types-user__ads.htm#ref_53_9">User_Defined_Field_Type_Access</A> := - <A HREF="terminal_interface-curses-forms-field_types-user__ads.htm#ref_53_9">User_Defined_Field_Type_Access</A> - (<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_216_9">Argument_Access</A> (Argument_Conversions.To_Pointer (<A HREF="terminal_interface-curses-forms-field_types-user__ads.htm#ref_89_33">Usr</A>)).<b>all</b>.<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_212_7">Typ</A>); - <b>begin</b> - <A HREF="terminal_interface-curses-forms-field_types-user__adb.htm#ref_97_7">Result</A> := <A HREF="terminal_interface-curses-forms-field_types-user__ads.htm#ref_63_13">Character_Check</A> (Character'Val (<A HREF="terminal_interface-curses-forms-field_types-user__ads.htm#ref_88_33">Ch</A>), <A HREF="terminal_interface-curses-forms-field_types-user__adb.htm#ref_98_7">Udf</A>.<b>all</b>); -- <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_1926_9">Curses_Bool</A> (Boolean'Pos (<A HREF="terminal_interface-curses-forms-field_types-user__adb.htm#ref_97_7">Result</A>)); -+ <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_1925_9">Curses_Bool</A> (Boolean'Pos (<A HREF="terminal_interface-curses-forms-field_types-user__adb.htm#ref_97_7">Result</A>)); - <b>end</b> <A HREF="terminal_interface-curses-forms-field_types-user__ads.htm#ref_88_13">Generic_Char_Check</A>; - -- <FONT COLOR=green><EM>-- -----------------------------------------------------------------------</EM></FONT> -- <FONT COLOR=green><EM>--</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_108_13" HREF="terminal_interface-curses-forms-field_types-user__ads.htm#ref_79_13">C_Generic_Type</A></FONT> <b>return</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_132_9">C_Field_Type</A> -+ <span class="comment"><EM>-- -----------------------------------------------------------------------</EM></span> -+ <span class="comment"><EM>--</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_108_13" HREF="terminal_interface-curses-forms-field_types-user__ads.htm#ref_79_13">C_Generic_Type</A></span> <b>return</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_132_9">C_Field_Type</A> - <b>is</b> -- <FONT COLOR=red><A NAME="ref_110_7">Res</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A>; -- <FONT COLOR=red><A NAME="ref_111_7">T</A></FONT> : <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_132_9">C_Field_Type</A>; -+ <span class="symbol"><A NAME="ref_110_7">Res</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A>; -+ <span class="symbol"><A NAME="ref_111_7">T</A></span> : <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_132_9">C_Field_Type</A>; - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_141_4">M_Generic_Type</A> = <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_134_4">Null_Field_Type</A> <b>then</b> - <A HREF="terminal_interface-curses-forms-field_types-user__adb.htm#ref_111_7">T</A> := <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_222_13">New_Fieldtype</A> (<A HREF="terminal_interface-curses-forms-field_types-user__ads.htm#ref_81_13">Generic_Field_Check</A>'<b>Access</b>, - <A HREF="terminal_interface-curses-forms-field_types-user__ads.htm#ref_88_13">Generic_Char_Check</A>'<b>Access</b>); - <b>if</b> <A HREF="terminal_interface-curses-forms-field_types-user__adb.htm#ref_111_7">T</A> = <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_134_4">Null_Field_Type</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_290_4">Form_Exception</A>; -+ <b>raise</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_288_4">Form_Exception</A>; - <b>else</b> - <A HREF="terminal_interface-curses-forms-field_types-user__adb.htm#ref_110_7">Res</A> := <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_227_13">Set_Fieldtype_Arg</A> (<A HREF="terminal_interface-curses-forms-field_types-user__adb.htm#ref_111_7">T</A>, - <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_162_13">Make_Arg</A>'<b>Access</b>, -diff -Naur ncurses-5.9/doc/html/ada/terminal_interface-curses-forms-field_types-user__ads.htm ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-forms-field_types-user__ads.htm ---- ncurses-5.9/doc/html/ada/terminal_interface-curses-forms-field_types-user__ads.htm 2011-03-26 22:54:29.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-forms-field_types-user__ads.htm 2014-09-01 16:33:22.280791996 +0200 -@@ -1,101 +1,113 @@ --<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> --<HTML><HEAD><TITLE>terminal_interface-curses-forms-field_types-user.ads</TITLE></HEAD> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> -+<HTML> -+<HEAD> -+<TITLE>terminal_interface-curses-forms-field_types-user.ads</TITLE> -+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> -+<style type="text/css"> -+*.comment { -+ color: green; -+} -+*.symbol { -+ color: red; -+} -+</style> -+</HEAD> - <BODY> --<HR><DIV ALIGN="center"><H1> File : terminal_interface-curses-forms-field_types-user.ads </H1></DIV><HR> -+<HR><DIV style="text-align:center"><H1> File : terminal_interface-curses-forms-field_types-user.ads </H1></DIV><HR> - <PRE> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Terminal_Interface.Curses.Forms.Field_Types.User --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- S P E C --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Copyright (c) 1998-2009,2011 Free Software Foundation, Inc. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></FONT> --<FONT COLOR=green><EM>-- copy of this software and associated documentation files (the --</EM></FONT> --<FONT COLOR=green><EM>-- "Software"), to deal in the Software without restriction, including --</EM></FONT> --<FONT COLOR=green><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></FONT> --<FONT COLOR=green><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></FONT> --<FONT COLOR=green><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></FONT> --<FONT COLOR=green><EM>-- furnished to do so, subject to the following conditions: --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- The above copyright notice and this permission notice shall be included --</EM></FONT> --<FONT COLOR=green><EM>-- in all copies or substantial portions of the Software. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></FONT> --<FONT COLOR=green><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></FONT> --<FONT COLOR=green><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></FONT> --<FONT COLOR=green><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></FONT> --<FONT COLOR=green><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></FONT> --<FONT COLOR=green><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></FONT> --<FONT COLOR=green><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></FONT> --<FONT COLOR=green><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></FONT> --<FONT COLOR=green><EM>-- sale, use or other dealings in this Software without prior written --</EM></FONT> --<FONT COLOR=green><EM>-- authorization. --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Author: Juergen Pfeifer, 1996</EM></FONT> --<FONT COLOR=green><EM>-- Version Control:</EM></FONT> --<FONT COLOR=green><EM>-- @Revision: 1.15 @</EM></FONT> --<FONT COLOR=green><EM>-- @Date: 2011/03/19 12:27:21 @</EM></FONT> --<FONT COLOR=green><EM>-- Binding Version 01.00</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<b>with</b> <A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>.C; -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Terminal_Interface.Curses.Forms.Field_Types.User --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- S P E C --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Copyright (c) 1998-2009,2011 Free Software Foundation, Inc. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></span> -+<span class="comment"><EM>-- copy of this software and associated documentation files (the --</EM></span> -+<span class="comment"><EM>-- "Software"), to deal in the Software without restriction, including --</EM></span> -+<span class="comment"><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></span> -+<span class="comment"><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></span> -+<span class="comment"><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></span> -+<span class="comment"><EM>-- furnished to do so, subject to the following conditions: --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- The above copyright notice and this permission notice shall be included --</EM></span> -+<span class="comment"><EM>-- in all copies or substantial portions of the Software. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></span> -+<span class="comment"><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></span> -+<span class="comment"><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></span> -+<span class="comment"><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></span> -+<span class="comment"><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></span> -+<span class="comment"><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></span> -+<span class="comment"><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></span> -+<span class="comment"><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></span> -+<span class="comment"><EM>-- sale, use or other dealings in this Software without prior written --</EM></span> -+<span class="comment"><EM>-- authorization. --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Author: Juergen Pfeifer, 1996</EM></span> -+<span class="comment"><EM>-- Version Control:</EM></span> -+<span class="comment"><EM>-- @Revision: 1.15 @</EM></span> -+<span class="comment"><EM>-- @Date: 2011/03/19 12:27:21 @</EM></span> -+<span class="comment"><EM>-- Binding Version 01.00</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<b>with</b> <A HREF="interfac__ads.htm#ref_36_9">Interfaces</A>.C; - --<b>package</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-forms__ads.htm#ref_49_35">Forms</A>.<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_43_41">Field_Types</A>.<FONT COLOR=red><A NAME="ref_44_53" HREF="terminal_interface-curses-forms-field_types-user__adb.htm#ref_45_58">User</A></FONT> <b>is</b> -+<b>package</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-forms__ads.htm#ref_49_35">Forms</A>.<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_43_41">Field_Types</A>.<span class="symbol"><A NAME="ref_44_53" HREF="terminal_interface-curses-forms-field_types-user__adb.htm#ref_45_58">User</A></span> <b>is</b> - <b>pragma</b> Preelaborate (<A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-forms__ads.htm#ref_49_35">Forms</A>.<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_43_41">Field_Types</A>.<A HREF="terminal_interface-curses-forms-field_types-user__ads.htm#ref_44_53">User</A>); -- <b>subtype</b> <FONT COLOR=red><A NAME="ref_46_12">C_Int</A></FONT> <b>is</b> <A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>.C.int; -+ <b>subtype</b> <span class="symbol"><A NAME="ref_46_12">C_Int</A></span> <b>is</b> <A HREF="interfac__ads.htm#ref_36_9">Interfaces</A>.C.int; - -- <b>type</b> <FONT COLOR=red><A NAME="ref_48_9">User_Defined_Field_Type</A></FONT> <b>is</b> <b>abstract</b> <b>new</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_52_9">Field_Type</A> <b>with</b> <b>null</b> <b>record</b>; -- <FONT COLOR=green><EM>-- This is the root of the mechanism we use to create field types in</EM></FONT> -- <FONT COLOR=green><EM>-- Ada95. You should your own type derive from this one and implement</EM></FONT> -- <FONT COLOR=green><EM>-- the Field_Check and Character_Check functions for your own type.</EM></FONT> -+ <b>type</b> <span class="symbol"><A NAME="ref_48_9">User_Defined_Field_Type</A></span> <b>is</b> <b>abstract</b> <b>new</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_52_9">Field_Type</A> <b>with</b> <b>null</b> <b>record</b>; -+ <span class="comment"><EM>-- This is the root of the mechanism we use to create field types in</EM></span> -+ <span class="comment"><EM>-- Ada95. You should your own type derive from this one and implement</EM></span> -+ <span class="comment"><EM>-- the Field_Check and Character_Check functions for your own type.</EM></span> - -- <b>type</b> <FONT COLOR=red><A NAME="ref_53_9">User_Defined_Field_Type_Access</A></FONT> <b>is</b> <b>access</b> <b>all</b> -+ <b>type</b> <span class="symbol"><A NAME="ref_53_9">User_Defined_Field_Type_Access</A></span> <b>is</b> <b>access</b> <b>all</b> - <A HREF="terminal_interface-curses-forms-field_types-user__ads.htm#ref_48_9">User_Defined_Field_Type</A>'Class; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_56_13">Field_Check</A></FONT> -- (<FONT COLOR=red><A NAME="ref_57_7" HREF="terminal_interface-curses-forms-field_types-user__ads.htm#ref_56_13">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_58_7" HREF="terminal_interface-curses-forms-field_types-user__ads.htm#ref_56_13">Typ</A></FONT> : <A HREF="terminal_interface-curses-forms-field_types-user__ads.htm#ref_48_9">User_Defined_Field_Type</A>) <b>return</b> Boolean -+ <b>function</b> <span class="symbol"><A NAME="ref_56_13">Field_Check</A></span> -+ (<span class="symbol"><A NAME="ref_57_7" HREF="terminal_interface-curses-forms-field_types-user__ads.htm#ref_56_13">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_58_7" HREF="terminal_interface-curses-forms-field_types-user__ads.htm#ref_56_13">Typ</A></span> : <A HREF="terminal_interface-curses-forms-field_types-user__ads.htm#ref_48_9">User_Defined_Field_Type</A>) <b>return</b> Boolean - <b>is</b> <b>abstract</b>; -- <FONT COLOR=green><EM>-- If True is returned, the field is considered valid, otherwise it is</EM></FONT> -- <FONT COLOR=green><EM>-- invalid.</EM></FONT> -+ <span class="comment"><EM>-- If True is returned, the field is considered valid, otherwise it is</EM></span> -+ <span class="comment"><EM>-- invalid.</EM></span> - -- <b>function</b> <FONT COLOR=red><A NAME="ref_63_13">Character_Check</A></FONT> -- (<FONT COLOR=red><A NAME="ref_64_7" HREF="terminal_interface-curses-forms-field_types-user__ads.htm#ref_63_13">Ch</A></FONT> : Character; -- <FONT COLOR=red><A NAME="ref_65_7" HREF="terminal_interface-curses-forms-field_types-user__ads.htm#ref_63_13">Typ</A></FONT> : <A HREF="terminal_interface-curses-forms-field_types-user__ads.htm#ref_48_9">User_Defined_Field_Type</A>) <b>return</b> Boolean -+ <b>function</b> <span class="symbol"><A NAME="ref_63_13">Character_Check</A></span> -+ (<span class="symbol"><A NAME="ref_64_7" HREF="terminal_interface-curses-forms-field_types-user__ads.htm#ref_63_13">Ch</A></span> : Character; -+ <span class="symbol"><A NAME="ref_65_7" HREF="terminal_interface-curses-forms-field_types-user__ads.htm#ref_63_13">Typ</A></span> : <A HREF="terminal_interface-curses-forms-field_types-user__ads.htm#ref_48_9">User_Defined_Field_Type</A>) <b>return</b> Boolean - <b>is</b> <b>abstract</b>; -- <FONT COLOR=green><EM>-- If True is returned, the character is considered as valid for the</EM></FONT> -- <FONT COLOR=green><EM>-- field, otherwise as invalid.</EM></FONT> -+ <span class="comment"><EM>-- If True is returned, the character is considered as valid for the</EM></span> -+ <span class="comment"><EM>-- field, otherwise as invalid.</EM></span> - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_70_14" HREF="terminal_interface-curses-forms-field_types-user__adb.htm#ref_47_14">Set_Field_Type</A></FONT> (<FONT COLOR=red><A NAME="ref_70_30" HREF="terminal_interface-curses-forms-field_types-user__adb.htm#ref_47_30">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_71_30" HREF="terminal_interface-curses-forms-field_types-user__adb.htm#ref_48_30">Typ</A></FONT> : <A HREF="terminal_interface-curses-forms-field_types-user__ads.htm#ref_48_9">User_Defined_Field_Type</A>); -- <FONT COLOR=green><EM>-- This should work for all types derived from User_Defined_Field_Type.</EM></FONT> -- <FONT COLOR=green><EM>-- No need to reimplement it for your derived type.</EM></FONT> -- -- <FONT COLOR=green><EM>-- +----------------------------------------------------------------------</EM></FONT> -- <FONT COLOR=green><EM>-- | Private Part.</EM></FONT> -- <FONT COLOR=green><EM>-- | Used by the Choice child package.</EM></FONT> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_70_14" HREF="terminal_interface-curses-forms-field_types-user__adb.htm#ref_47_14">Set_Field_Type</A></span> (<span class="symbol"><A NAME="ref_70_30" HREF="terminal_interface-curses-forms-field_types-user__adb.htm#ref_47_30">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_71_30" HREF="terminal_interface-curses-forms-field_types-user__adb.htm#ref_48_30">Typ</A></span> : <A HREF="terminal_interface-curses-forms-field_types-user__ads.htm#ref_48_9">User_Defined_Field_Type</A>); -+ <span class="comment"><EM>-- This should work for all types derived from User_Defined_Field_Type.</EM></span> -+ <span class="comment"><EM>-- No need to reimplement it for your derived type.</EM></span> -+ -+ <span class="comment"><EM>-- +----------------------------------------------------------------------</EM></span> -+ <span class="comment"><EM>-- | Private Part.</EM></span> -+ <span class="comment"><EM>-- | Used by the Choice child package.</EM></span> - <b>private</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_79_13" HREF="terminal_interface-curses-forms-field_types-user__adb.htm#ref_108_13">C_Generic_Type</A></FONT> <b>return</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_132_9">C_Field_Type</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_79_13" HREF="terminal_interface-curses-forms-field_types-user__adb.htm#ref_108_13">C_Generic_Type</A></span> <b>return</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_132_9">C_Field_Type</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_81_13" HREF="terminal_interface-curses-forms-field_types-user__adb.htm#ref_82_13">Generic_Field_Check</A></FONT> (<FONT COLOR=red><A NAME="ref_81_34" HREF="terminal_interface-curses-forms-field_types-user__adb.htm#ref_82_34">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_82_34" HREF="terminal_interface-curses-forms-field_types-user__adb.htm#ref_83_34">Usr</A></FONT> : System.Address) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_1926_9">Curses_Bool</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_81_13" HREF="terminal_interface-curses-forms-field_types-user__adb.htm#ref_82_13">Generic_Field_Check</A></span> (<span class="symbol"><A NAME="ref_81_34" HREF="terminal_interface-curses-forms-field_types-user__adb.htm#ref_82_34">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_82_34" HREF="terminal_interface-curses-forms-field_types-user__adb.htm#ref_83_34">Usr</A></span> : System.Address) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_1925_9">Curses_Bool</A>; - <b>pragma</b> Convention (C, <A HREF="terminal_interface-curses-forms-field_types-user__ads.htm#ref_81_13">Generic_Field_Check</A>); -- <FONT COLOR=green><EM>-- This is the generic Field_Check_Function for the low-level fieldtype</EM></FONT> -- <FONT COLOR=green><EM>-- representing all the User_Defined_Field_Type derivatives. It routes</EM></FONT> -- <FONT COLOR=green><EM>-- the call to the Field_Check implementation for the type.</EM></FONT> -+ <span class="comment"><EM>-- This is the generic Field_Check_Function for the low-level fieldtype</EM></span> -+ <span class="comment"><EM>-- representing all the User_Defined_Field_Type derivatives. It routes</EM></span> -+ <span class="comment"><EM>-- the call to the Field_Check implementation for the type.</EM></span> - -- <b>function</b> <FONT COLOR=red><A NAME="ref_88_13" HREF="terminal_interface-curses-forms-field_types-user__adb.htm#ref_94_13">Generic_Char_Check</A></FONT> (<FONT COLOR=red><A NAME="ref_88_33" HREF="terminal_interface-curses-forms-field_types-user__adb.htm#ref_94_33">Ch</A></FONT> : <A HREF="terminal_interface-curses-forms-field_types-user__ads.htm#ref_46_12">C_Int</A>; -- <FONT COLOR=red><A NAME="ref_89_33" HREF="terminal_interface-curses-forms-field_types-user__adb.htm#ref_95_33">Usr</A></FONT> : System.Address) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_1926_9">Curses_Bool</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_88_13" HREF="terminal_interface-curses-forms-field_types-user__adb.htm#ref_94_13">Generic_Char_Check</A></span> (<span class="symbol"><A NAME="ref_88_33" HREF="terminal_interface-curses-forms-field_types-user__adb.htm#ref_94_33">Ch</A></span> : <A HREF="terminal_interface-curses-forms-field_types-user__ads.htm#ref_46_12">C_Int</A>; -+ <span class="symbol"><A NAME="ref_89_33" HREF="terminal_interface-curses-forms-field_types-user__adb.htm#ref_95_33">Usr</A></span> : System.Address) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_1925_9">Curses_Bool</A>; - <b>pragma</b> Convention (C, <A HREF="terminal_interface-curses-forms-field_types-user__ads.htm#ref_88_13">Generic_Char_Check</A>); -- <FONT COLOR=green><EM>-- This is the generic Char_Check_Function for the low-level fieldtype</EM></FONT> -- <FONT COLOR=green><EM>-- representing all the User_Defined_Field_Type derivatives. It routes</EM></FONT> -- <FONT COLOR=green><EM>-- the call to the Character_Check implementation for the type.</EM></FONT> -+ <span class="comment"><EM>-- This is the generic Char_Check_Function for the low-level fieldtype</EM></span> -+ <span class="comment"><EM>-- representing all the User_Defined_Field_Type derivatives. It routes</EM></span> -+ <span class="comment"><EM>-- the call to the Character_Check implementation for the type.</EM></span> - - <b>end</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-forms__ads.htm#ref_49_35">Forms</A>.<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_43_41">Field_Types</A>.<A HREF="terminal_interface-curses-forms-field_types-user__ads.htm#ref_44_53">User</A>; - </PRE></BODY></HTML> -diff -Naur ncurses-5.9/doc/html/ada/terminal_interface-curses-forms-field_types-user-choice__adb.htm ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-forms-field_types-user-choice__adb.htm ---- ncurses-5.9/doc/html/ada/terminal_interface-curses-forms-field_types-user-choice__adb.htm 2011-03-26 22:54:29.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-forms-field_types-user-choice__adb.htm 2014-09-01 16:33:22.278791993 +0200 -@@ -1,93 +1,105 @@ --<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> --<HTML><HEAD><TITLE>terminal_interface-curses-forms-field_types-user-choice.adb</TITLE></HEAD> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> -+<HTML> -+<HEAD> -+<TITLE>terminal_interface-curses-forms-field_types-user-choice.adb</TITLE> -+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> -+<style type="text/css"> -+*.comment { -+ color: green; -+} -+*.symbol { -+ color: red; -+} -+</style> -+</HEAD> - <BODY> --<HR><DIV ALIGN="center"><H1> File : terminal_interface-curses-forms-field_types-user-choice.adb </H1></DIV><HR> -+<HR><DIV style="text-align:center"><H1> File : terminal_interface-curses-forms-field_types-user-choice.adb </H1></DIV><HR> - <PRE> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Terminal_Interface.Curses.Forms.Field_Types.User.Choice --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- B O D Y --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Copyright (c) 1998-2008,2011 Free Software Foundation, Inc. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></FONT> --<FONT COLOR=green><EM>-- copy of this software and associated documentation files (the --</EM></FONT> --<FONT COLOR=green><EM>-- "Software"), to deal in the Software without restriction, including --</EM></FONT> --<FONT COLOR=green><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></FONT> --<FONT COLOR=green><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></FONT> --<FONT COLOR=green><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></FONT> --<FONT COLOR=green><EM>-- furnished to do so, subject to the following conditions: --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- The above copyright notice and this permission notice shall be included --</EM></FONT> --<FONT COLOR=green><EM>-- in all copies or substantial portions of the Software. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></FONT> --<FONT COLOR=green><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></FONT> --<FONT COLOR=green><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></FONT> --<FONT COLOR=green><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></FONT> --<FONT COLOR=green><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></FONT> --<FONT COLOR=green><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></FONT> --<FONT COLOR=green><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></FONT> --<FONT COLOR=green><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></FONT> --<FONT COLOR=green><EM>-- sale, use or other dealings in this Software without prior written --</EM></FONT> --<FONT COLOR=green><EM>-- authorization. --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Author: Juergen Pfeifer, 1996</EM></FONT> --<FONT COLOR=green><EM>-- Version Control:</EM></FONT> --<FONT COLOR=green><EM>-- @Revision: 1.17 @</EM></FONT> --<FONT COLOR=green><EM>-- @Date: 2011/03/22 10:53:37 @</EM></FONT> --<FONT COLOR=green><EM>-- Binding Version 01.00</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Terminal_Interface.Curses.Forms.Field_Types.User.Choice --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- B O D Y --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Copyright (c) 1998-2008,2011 Free Software Foundation, Inc. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></span> -+<span class="comment"><EM>-- copy of this software and associated documentation files (the --</EM></span> -+<span class="comment"><EM>-- "Software"), to deal in the Software without restriction, including --</EM></span> -+<span class="comment"><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></span> -+<span class="comment"><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></span> -+<span class="comment"><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></span> -+<span class="comment"><EM>-- furnished to do so, subject to the following conditions: --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- The above copyright notice and this permission notice shall be included --</EM></span> -+<span class="comment"><EM>-- in all copies or substantial portions of the Software. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></span> -+<span class="comment"><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></span> -+<span class="comment"><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></span> -+<span class="comment"><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></span> -+<span class="comment"><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></span> -+<span class="comment"><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></span> -+<span class="comment"><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></span> -+<span class="comment"><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></span> -+<span class="comment"><EM>-- sale, use or other dealings in this Software without prior written --</EM></span> -+<span class="comment"><EM>-- authorization. --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Author: Juergen Pfeifer, 1996</EM></span> -+<span class="comment"><EM>-- Version Control:</EM></span> -+<span class="comment"><EM>-- @Revision: 1.17 @</EM></span> -+<span class="comment"><EM>-- @Date: 2011/03/22 10:53:37 @</EM></span> -+<span class="comment"><EM>-- Binding Version 01.00</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> - <b>with</b> System.Address_To_Access_Conversions; - <b>with</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-aux__ads.htm#ref_50_35">Aux</A>; <b>use</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-aux__ads.htm#ref_50_35">Aux</A>; - --<b>package</b> <b>body</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-forms__ads.htm#ref_49_35">Forms</A>.<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_43_41">Field_Types</A>.<A HREF="terminal_interface-curses-forms-field_types-user__ads.htm#ref_44_53">User</A>.<FONT COLOR=red><A NAME="ref_45_63" HREF="terminal_interface-curses-forms-field_types-user-choice__ads.htm#ref_44_58">Choice</A></FONT> <b>is</b> -+<b>package</b> <b>body</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-forms__ads.htm#ref_49_35">Forms</A>.<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_43_41">Field_Types</A>.<A HREF="terminal_interface-curses-forms-field_types-user__ads.htm#ref_44_53">User</A>.<span class="symbol"><A NAME="ref_45_63" HREF="terminal_interface-curses-forms-field_types-user-choice__ads.htm#ref_44_58">Choice</A></span> <b>is</b> - - <b>package</b> Argument_Conversions <b>is</b> - <b>new</b> System.Address_To_Access_Conversions (<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_211_9">Argument</A>); - -- <b>function</b> <FONT COLOR=red><A NAME="ref_50_13" HREF="terminal_interface-curses-forms-field_types-user-choice__ads.htm#ref_80_13">Generic_Next</A></FONT> (<FONT COLOR=red><A NAME="ref_50_27" HREF="terminal_interface-curses-forms-field_types-user-choice__ads.htm#ref_80_27">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_51_27" HREF="terminal_interface-curses-forms-field_types-user-choice__ads.htm#ref_81_27">Usr</A></FONT> : System.Address) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_1926_9">Curses_Bool</A> -+ <b>function</b> <span class="symbol"><A NAME="ref_50_13" HREF="terminal_interface-curses-forms-field_types-user-choice__ads.htm#ref_80_13">Generic_Next</A></span> (<span class="symbol"><A NAME="ref_50_27" HREF="terminal_interface-curses-forms-field_types-user-choice__ads.htm#ref_80_27">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_51_27" HREF="terminal_interface-curses-forms-field_types-user-choice__ads.htm#ref_81_27">Usr</A></span> : System.Address) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_1925_9">Curses_Bool</A> - <b>is</b> -- <FONT COLOR=red><A NAME="ref_53_7">Result</A></FONT> : Boolean; -- <FONT COLOR=red><A NAME="ref_54_7">Udf</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-forms-field_types-user-choice__ads.htm#ref_57_9">User_Defined_Field_Type_With_Choice_Access</A> := -+ <span class="symbol"><A NAME="ref_53_7">Result</A></span> : Boolean; -+ <span class="symbol"><A NAME="ref_54_7">Udf</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-forms-field_types-user-choice__ads.htm#ref_57_9">User_Defined_Field_Type_With_Choice_Access</A> := - <A HREF="terminal_interface-curses-forms-field_types-user-choice__ads.htm#ref_57_9">User_Defined_Field_Type_With_Choice_Access</A> - (<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_216_9">Argument_Access</A> (Argument_Conversions.To_Pointer (<A HREF="terminal_interface-curses-forms-field_types-user-choice__ads.htm#ref_81_27">Usr</A>)).<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_212_7">Typ</A>); - <b>begin</b> - <A HREF="terminal_interface-curses-forms-field_types-user-choice__adb.htm#ref_53_7">Result</A> := <A HREF="terminal_interface-curses-forms-field_types-user-choice__ads.htm#ref_60_13">Next</A> (<A HREF="terminal_interface-curses-forms-field_types-user-choice__ads.htm#ref_80_27">Fld</A>, <A HREF="terminal_interface-curses-forms-field_types-user-choice__adb.htm#ref_54_7">Udf</A>.<b>all</b>); -- <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_1926_9">Curses_Bool</A> (Boolean'Pos (<A HREF="terminal_interface-curses-forms-field_types-user-choice__adb.htm#ref_53_7">Result</A>)); -+ <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_1925_9">Curses_Bool</A> (Boolean'Pos (<A HREF="terminal_interface-curses-forms-field_types-user-choice__adb.htm#ref_53_7">Result</A>)); - <b>end</b> <A HREF="terminal_interface-curses-forms-field_types-user-choice__ads.htm#ref_80_13">Generic_Next</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_62_13" HREF="terminal_interface-curses-forms-field_types-user-choice__ads.htm#ref_87_13">Generic_Prev</A></FONT> (<FONT COLOR=red><A NAME="ref_62_27" HREF="terminal_interface-curses-forms-field_types-user-choice__ads.htm#ref_87_27">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_63_27" HREF="terminal_interface-curses-forms-field_types-user-choice__ads.htm#ref_88_27">Usr</A></FONT> : System.Address) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_1926_9">Curses_Bool</A> -+ <b>function</b> <span class="symbol"><A NAME="ref_62_13" HREF="terminal_interface-curses-forms-field_types-user-choice__ads.htm#ref_87_13">Generic_Prev</A></span> (<span class="symbol"><A NAME="ref_62_27" HREF="terminal_interface-curses-forms-field_types-user-choice__ads.htm#ref_87_27">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_63_27" HREF="terminal_interface-curses-forms-field_types-user-choice__ads.htm#ref_88_27">Usr</A></span> : System.Address) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_1925_9">Curses_Bool</A> - <b>is</b> -- <FONT COLOR=red><A NAME="ref_65_7">Result</A></FONT> : Boolean; -- <FONT COLOR=red><A NAME="ref_66_7">Udf</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-forms-field_types-user-choice__ads.htm#ref_57_9">User_Defined_Field_Type_With_Choice_Access</A> := -+ <span class="symbol"><A NAME="ref_65_7">Result</A></span> : Boolean; -+ <span class="symbol"><A NAME="ref_66_7">Udf</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-forms-field_types-user-choice__ads.htm#ref_57_9">User_Defined_Field_Type_With_Choice_Access</A> := - <A HREF="terminal_interface-curses-forms-field_types-user-choice__ads.htm#ref_57_9">User_Defined_Field_Type_With_Choice_Access</A> - (<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_216_9">Argument_Access</A> (Argument_Conversions.To_Pointer (<A HREF="terminal_interface-curses-forms-field_types-user-choice__ads.htm#ref_88_27">Usr</A>)).<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_212_7">Typ</A>); - <b>begin</b> - <A HREF="terminal_interface-curses-forms-field_types-user-choice__adb.htm#ref_65_7">Result</A> := <A HREF="terminal_interface-curses-forms-field_types-user-choice__ads.htm#ref_67_13">Previous</A> (<A HREF="terminal_interface-curses-forms-field_types-user-choice__ads.htm#ref_87_27">Fld</A>, <A HREF="terminal_interface-curses-forms-field_types-user-choice__adb.htm#ref_66_7">Udf</A>.<b>all</b>); -- <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_1926_9">Curses_Bool</A> (Boolean'Pos (<A HREF="terminal_interface-curses-forms-field_types-user-choice__adb.htm#ref_65_7">Result</A>)); -+ <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_1925_9">Curses_Bool</A> (Boolean'Pos (<A HREF="terminal_interface-curses-forms-field_types-user-choice__adb.htm#ref_65_7">Result</A>)); - <b>end</b> <A HREF="terminal_interface-curses-forms-field_types-user-choice__ads.htm#ref_87_13">Generic_Prev</A>; - -- <FONT COLOR=green><EM>-- -----------------------------------------------------------------------</EM></FONT> -- <FONT COLOR=green><EM>--</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_76_13" HREF="terminal_interface-curses-forms-field_types-user-choice__ads.htm#ref_78_13">C_Generic_Choice</A></FONT> <b>return</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_132_9">C_Field_Type</A> -+ <span class="comment"><EM>-- -----------------------------------------------------------------------</EM></span> -+ <span class="comment"><EM>--</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_76_13" HREF="terminal_interface-curses-forms-field_types-user-choice__ads.htm#ref_78_13">C_Generic_Choice</A></span> <b>return</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_132_9">C_Field_Type</A> - <b>is</b> -- <FONT COLOR=red><A NAME="ref_78_7">Res</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A>; -- <FONT COLOR=red><A NAME="ref_79_7">T</A></FONT> : <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_132_9">C_Field_Type</A>; -+ <span class="symbol"><A NAME="ref_78_7">Res</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A>; -+ <span class="symbol"><A NAME="ref_79_7">T</A></span> : <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_132_9">C_Field_Type</A>; - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_142_4">M_Generic_Choice</A> = <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_134_4">Null_Field_Type</A> <b>then</b> - <A HREF="terminal_interface-curses-forms-field_types-user-choice__adb.htm#ref_79_7">T</A> := <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_222_13">New_Fieldtype</A> (<A HREF="terminal_interface-curses-forms-field_types-user__ads.htm#ref_81_13">Generic_Field_Check</A>'<b>Access</b>, - <A HREF="terminal_interface-curses-forms-field_types-user__ads.htm#ref_88_13">Generic_Char_Check</A>'<b>Access</b>); - <b>if</b> <A HREF="terminal_interface-curses-forms-field_types-user-choice__adb.htm#ref_79_7">T</A> = <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_134_4">Null_Field_Type</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_290_4">Form_Exception</A>; -+ <b>raise</b> <A HREF="terminal_interface-curses-forms__ads.htm#ref_288_4">Form_Exception</A>; - <b>else</b> - <A HREF="terminal_interface-curses-forms-field_types-user-choice__adb.htm#ref_78_7">Res</A> := <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_227_13">Set_Fieldtype_Arg</A> (<A HREF="terminal_interface-curses-forms-field_types-user-choice__adb.htm#ref_79_7">T</A>, - <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_162_13">Make_Arg</A>'<b>Access</b>, -diff -Naur ncurses-5.9/doc/html/ada/terminal_interface-curses-forms-field_types-user-choice__ads.htm ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-forms-field_types-user-choice__ads.htm ---- ncurses-5.9/doc/html/ada/terminal_interface-curses-forms-field_types-user-choice__ads.htm 2011-03-26 22:54:29.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-forms-field_types-user-choice__ads.htm 2014-09-01 16:33:22.279791995 +0200 -@@ -1,100 +1,112 @@ --<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> --<HTML><HEAD><TITLE>terminal_interface-curses-forms-field_types-user-choice.ads</TITLE></HEAD> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> -+<HTML> -+<HEAD> -+<TITLE>terminal_interface-curses-forms-field_types-user-choice.ads</TITLE> -+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> -+<style type="text/css"> -+*.comment { -+ color: green; -+} -+*.symbol { -+ color: red; -+} -+</style> -+</HEAD> - <BODY> --<HR><DIV ALIGN="center"><H1> File : terminal_interface-curses-forms-field_types-user-choice.ads </H1></DIV><HR> -+<HR><DIV style="text-align:center"><H1> File : terminal_interface-curses-forms-field_types-user-choice.ads </H1></DIV><HR> - <PRE> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Terminal_Interface.Curses.Forms.Field_Types.User.Choice --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- S P E C --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Copyright (c) 1998-2008,2011 Free Software Foundation, Inc. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></FONT> --<FONT COLOR=green><EM>-- copy of this software and associated documentation files (the --</EM></FONT> --<FONT COLOR=green><EM>-- "Software"), to deal in the Software without restriction, including --</EM></FONT> --<FONT COLOR=green><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></FONT> --<FONT COLOR=green><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></FONT> --<FONT COLOR=green><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></FONT> --<FONT COLOR=green><EM>-- furnished to do so, subject to the following conditions: --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- The above copyright notice and this permission notice shall be included --</EM></FONT> --<FONT COLOR=green><EM>-- in all copies or substantial portions of the Software. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></FONT> --<FONT COLOR=green><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></FONT> --<FONT COLOR=green><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></FONT> --<FONT COLOR=green><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></FONT> --<FONT COLOR=green><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></FONT> --<FONT COLOR=green><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></FONT> --<FONT COLOR=green><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></FONT> --<FONT COLOR=green><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></FONT> --<FONT COLOR=green><EM>-- sale, use or other dealings in this Software without prior written --</EM></FONT> --<FONT COLOR=green><EM>-- authorization. --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Author: Juergen Pfeifer, 1996</EM></FONT> --<FONT COLOR=green><EM>-- Version Control:</EM></FONT> --<FONT COLOR=green><EM>-- @Revision: 1.14 @</EM></FONT> --<FONT COLOR=green><EM>-- @Date: 2011/03/19 12:27:47 @</EM></FONT> --<FONT COLOR=green><EM>-- Binding Version 01.00</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<b>with</b> <A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>.C; -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Terminal_Interface.Curses.Forms.Field_Types.User.Choice --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- S P E C --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Copyright (c) 1998-2008,2011 Free Software Foundation, Inc. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></span> -+<span class="comment"><EM>-- copy of this software and associated documentation files (the --</EM></span> -+<span class="comment"><EM>-- "Software"), to deal in the Software without restriction, including --</EM></span> -+<span class="comment"><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></span> -+<span class="comment"><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></span> -+<span class="comment"><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></span> -+<span class="comment"><EM>-- furnished to do so, subject to the following conditions: --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- The above copyright notice and this permission notice shall be included --</EM></span> -+<span class="comment"><EM>-- in all copies or substantial portions of the Software. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></span> -+<span class="comment"><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></span> -+<span class="comment"><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></span> -+<span class="comment"><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></span> -+<span class="comment"><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></span> -+<span class="comment"><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></span> -+<span class="comment"><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></span> -+<span class="comment"><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></span> -+<span class="comment"><EM>-- sale, use or other dealings in this Software without prior written --</EM></span> -+<span class="comment"><EM>-- authorization. --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Author: Juergen Pfeifer, 1996</EM></span> -+<span class="comment"><EM>-- Version Control:</EM></span> -+<span class="comment"><EM>-- @Revision: 1.14 @</EM></span> -+<span class="comment"><EM>-- @Date: 2011/03/19 12:27:47 @</EM></span> -+<span class="comment"><EM>-- Binding Version 01.00</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<b>with</b> <A HREF="interfac__ads.htm#ref_36_9">Interfaces</A>.C; - --<b>package</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-forms__ads.htm#ref_49_35">Forms</A>.<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_43_41">Field_Types</A>.<A HREF="terminal_interface-curses-forms-field_types-user__ads.htm#ref_44_53">User</A>.<FONT COLOR=red><A NAME="ref_44_58" HREF="terminal_interface-curses-forms-field_types-user-choice__adb.htm#ref_45_63">Choice</A></FONT> <b>is</b> -+<b>package</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-forms__ads.htm#ref_49_35">Forms</A>.<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_43_41">Field_Types</A>.<A HREF="terminal_interface-curses-forms-field_types-user__ads.htm#ref_44_53">User</A>.<span class="symbol"><A NAME="ref_44_58" HREF="terminal_interface-curses-forms-field_types-user-choice__adb.htm#ref_45_63">Choice</A></span> <b>is</b> - <b>pragma</b> Preelaborate - (<A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-forms__ads.htm#ref_49_35">Forms</A>.<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_43_41">Field_Types</A>.<A HREF="terminal_interface-curses-forms-field_types-user__ads.htm#ref_44_53">User</A>.<A HREF="terminal_interface-curses-forms-field_types-user-choice__ads.htm#ref_44_58">Choice</A>); - -- <b>subtype</b> <FONT COLOR=red><A NAME="ref_48_12">C_Int</A></FONT> <b>is</b> <A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>.C.int; -+ <b>subtype</b> <span class="symbol"><A NAME="ref_48_12">C_Int</A></span> <b>is</b> <A HREF="interfac__ads.htm#ref_36_9">Interfaces</A>.C.int; - -- <b>type</b> <FONT COLOR=red><A NAME="ref_50_9">User_Defined_Field_Type_With_Choice</A></FONT> <b>is</b> <b>abstract</b> <b>new</b> -+ <b>type</b> <span class="symbol"><A NAME="ref_50_9">User_Defined_Field_Type_With_Choice</A></span> <b>is</b> <b>abstract</b> <b>new</b> - <A HREF="terminal_interface-curses-forms-field_types-user__ads.htm#ref_48_9">User_Defined_Field_Type</A> <b>with</b> <b>null</b> <b>record</b>; -- <FONT COLOR=green><EM>-- This is the root of the mechanism we use to create field types in</EM></FONT> -- <FONT COLOR=green><EM>-- Ada95 that allow the prev/next mechanism. You should your own type</EM></FONT> -- <FONT COLOR=green><EM>-- derive from this one and implement the Field_Check, Character_Check</EM></FONT> -- <FONT COLOR=green><EM>-- Next and Previous functions for your own type.</EM></FONT> -+ <span class="comment"><EM>-- This is the root of the mechanism we use to create field types in</EM></span> -+ <span class="comment"><EM>-- Ada95 that allow the prev/next mechanism. You should your own type</EM></span> -+ <span class="comment"><EM>-- derive from this one and implement the Field_Check, Character_Check</EM></span> -+ <span class="comment"><EM>-- Next and Previous functions for your own type.</EM></span> - -- <b>type</b> <FONT COLOR=red><A NAME="ref_57_9">User_Defined_Field_Type_With_Choice_Access</A></FONT> <b>is</b> <b>access</b> <b>all</b> -+ <b>type</b> <span class="symbol"><A NAME="ref_57_9">User_Defined_Field_Type_With_Choice_Access</A></span> <b>is</b> <b>access</b> <b>all</b> - <A HREF="terminal_interface-curses-forms-field_types-user-choice__ads.htm#ref_50_9">User_Defined_Field_Type_With_Choice</A>'Class; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_60_13">Next</A></FONT> -- (<FONT COLOR=red><A NAME="ref_61_7" HREF="terminal_interface-curses-forms-field_types-user-choice__ads.htm#ref_60_13">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_62_7" HREF="terminal_interface-curses-forms-field_types-user-choice__ads.htm#ref_60_13">Typ</A></FONT> : <A HREF="terminal_interface-curses-forms-field_types-user-choice__ads.htm#ref_50_9">User_Defined_Field_Type_With_Choice</A>) <b>return</b> Boolean -+ <b>function</b> <span class="symbol"><A NAME="ref_60_13">Next</A></span> -+ (<span class="symbol"><A NAME="ref_61_7" HREF="terminal_interface-curses-forms-field_types-user-choice__ads.htm#ref_60_13">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_62_7" HREF="terminal_interface-curses-forms-field_types-user-choice__ads.htm#ref_60_13">Typ</A></span> : <A HREF="terminal_interface-curses-forms-field_types-user-choice__ads.htm#ref_50_9">User_Defined_Field_Type_With_Choice</A>) <b>return</b> Boolean - <b>is</b> <b>abstract</b>; -- <FONT COLOR=green><EM>-- If True is returned, the function successfully generated a next</EM></FONT> -- <FONT COLOR=green><EM>-- value into the fields buffer.</EM></FONT> -+ <span class="comment"><EM>-- If True is returned, the function successfully generated a next</EM></span> -+ <span class="comment"><EM>-- value into the fields buffer.</EM></span> - -- <b>function</b> <FONT COLOR=red><A NAME="ref_67_13">Previous</A></FONT> -- (<FONT COLOR=red><A NAME="ref_68_7" HREF="terminal_interface-curses-forms-field_types-user-choice__ads.htm#ref_67_13">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_69_7" HREF="terminal_interface-curses-forms-field_types-user-choice__ads.htm#ref_67_13">Typ</A></FONT> : <A HREF="terminal_interface-curses-forms-field_types-user-choice__ads.htm#ref_50_9">User_Defined_Field_Type_With_Choice</A>) <b>return</b> Boolean -+ <b>function</b> <span class="symbol"><A NAME="ref_67_13">Previous</A></span> -+ (<span class="symbol"><A NAME="ref_68_7" HREF="terminal_interface-curses-forms-field_types-user-choice__ads.htm#ref_67_13">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_69_7" HREF="terminal_interface-curses-forms-field_types-user-choice__ads.htm#ref_67_13">Typ</A></span> : <A HREF="terminal_interface-curses-forms-field_types-user-choice__ads.htm#ref_50_9">User_Defined_Field_Type_With_Choice</A>) <b>return</b> Boolean - <b>is</b> <b>abstract</b>; -- <FONT COLOR=green><EM>-- If True is returned, the function successfully generated a previous</EM></FONT> -- <FONT COLOR=green><EM>-- value into the fields buffer.</EM></FONT> -+ <span class="comment"><EM>-- If True is returned, the function successfully generated a previous</EM></span> -+ <span class="comment"><EM>-- value into the fields buffer.</EM></span> - -- <FONT COLOR=green><EM>-- +----------------------------------------------------------------------</EM></FONT> -- <FONT COLOR=green><EM>-- | Private Part.</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -+ <span class="comment"><EM>-- +----------------------------------------------------------------------</EM></span> -+ <span class="comment"><EM>-- | Private Part.</EM></span> -+ <span class="comment"><EM>-- |</EM></span> - <b>private</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_78_13" HREF="terminal_interface-curses-forms-field_types-user-choice__adb.htm#ref_76_13">C_Generic_Choice</A></FONT> <b>return</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_132_9">C_Field_Type</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_78_13" HREF="terminal_interface-curses-forms-field_types-user-choice__adb.htm#ref_76_13">C_Generic_Choice</A></span> <b>return</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_132_9">C_Field_Type</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_80_13" HREF="terminal_interface-curses-forms-field_types-user-choice__adb.htm#ref_50_13">Generic_Next</A></FONT> (<FONT COLOR=red><A NAME="ref_80_27" HREF="terminal_interface-curses-forms-field_types-user-choice__adb.htm#ref_50_27">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_81_27" HREF="terminal_interface-curses-forms-field_types-user-choice__adb.htm#ref_51_27">Usr</A></FONT> : System.Address) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_1926_9">Curses_Bool</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_80_13" HREF="terminal_interface-curses-forms-field_types-user-choice__adb.htm#ref_50_13">Generic_Next</A></span> (<span class="symbol"><A NAME="ref_80_27" HREF="terminal_interface-curses-forms-field_types-user-choice__adb.htm#ref_50_27">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_81_27" HREF="terminal_interface-curses-forms-field_types-user-choice__adb.htm#ref_51_27">Usr</A></span> : System.Address) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_1925_9">Curses_Bool</A>; - <b>pragma</b> Convention (C, <A HREF="terminal_interface-curses-forms-field_types-user-choice__ads.htm#ref_80_13">Generic_Next</A>); -- <FONT COLOR=green><EM>-- This is the generic next Choice_Function for the low-level fieldtype</EM></FONT> -- <FONT COLOR=green><EM>-- representing all the User_Defined_Field_Type derivatives. It routes</EM></FONT> -- <FONT COLOR=green><EM>-- the call to the Next implementation for the type.</EM></FONT> -+ <span class="comment"><EM>-- This is the generic next Choice_Function for the low-level fieldtype</EM></span> -+ <span class="comment"><EM>-- representing all the User_Defined_Field_Type derivatives. It routes</EM></span> -+ <span class="comment"><EM>-- the call to the Next implementation for the type.</EM></span> - -- <b>function</b> <FONT COLOR=red><A NAME="ref_87_13" HREF="terminal_interface-curses-forms-field_types-user-choice__adb.htm#ref_62_13">Generic_Prev</A></FONT> (<FONT COLOR=red><A NAME="ref_87_27" HREF="terminal_interface-curses-forms-field_types-user-choice__adb.htm#ref_62_27">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_88_27" HREF="terminal_interface-curses-forms-field_types-user-choice__adb.htm#ref_63_27">Usr</A></FONT> : System.Address) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_1926_9">Curses_Bool</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_87_13" HREF="terminal_interface-curses-forms-field_types-user-choice__adb.htm#ref_62_13">Generic_Prev</A></span> (<span class="symbol"><A NAME="ref_87_27" HREF="terminal_interface-curses-forms-field_types-user-choice__adb.htm#ref_62_27">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_88_27" HREF="terminal_interface-curses-forms-field_types-user-choice__adb.htm#ref_63_27">Usr</A></span> : System.Address) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_1925_9">Curses_Bool</A>; - <b>pragma</b> Convention (C, <A HREF="terminal_interface-curses-forms-field_types-user-choice__ads.htm#ref_87_13">Generic_Prev</A>); -- <FONT COLOR=green><EM>-- This is the generic prev Choice_Function for the low-level fieldtype</EM></FONT> -- <FONT COLOR=green><EM>-- representing all the User_Defined_Field_Type derivatives. It routes</EM></FONT> -- <FONT COLOR=green><EM>-- the call to the Previous implementation for the type.</EM></FONT> -+ <span class="comment"><EM>-- This is the generic prev Choice_Function for the low-level fieldtype</EM></span> -+ <span class="comment"><EM>-- representing all the User_Defined_Field_Type derivatives. It routes</EM></span> -+ <span class="comment"><EM>-- the call to the Previous implementation for the type.</EM></span> - - <b>end</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-forms__ads.htm#ref_49_35">Forms</A>.<A HREF="terminal_interface-curses-forms-field_types__ads.htm#ref_43_41">Field_Types</A>.<A HREF="terminal_interface-curses-forms-field_types-user__ads.htm#ref_44_53">User</A>.<A HREF="terminal_interface-curses-forms-field_types-user-choice__ads.htm#ref_44_58">Choice</A>; - </PRE></BODY></HTML> -diff -Naur ncurses-5.9/doc/html/ada/terminal_interface-curses-forms-field_user_data__adb.htm ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-forms-field_user_data__adb.htm ---- ncurses-5.9/doc/html/ada/terminal_interface-curses-forms-field_user_data__adb.htm 2011-02-26 00:43:49.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-forms-field_user_data__adb.htm 2014-09-01 16:33:22.281791998 +0200 -@@ -1,87 +1,99 @@ --<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> --<HTML><HEAD><TITLE>terminal_interface-curses-forms-field_user_data.adb</TITLE></HEAD> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> -+<HTML> -+<HEAD> -+<TITLE>terminal_interface-curses-forms-field_user_data.adb</TITLE> -+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> -+<style type="text/css"> -+*.comment { -+ color: green; -+} -+*.symbol { -+ color: red; -+} -+</style> -+</HEAD> - <BODY> --<HR><DIV ALIGN="center"><H1> File : terminal_interface-curses-forms-field_user_data.adb </H1></DIV><HR> -+<HR><DIV style="text-align:center"><H1> File : terminal_interface-curses-forms-field_user_data.adb </H1></DIV><HR> - <PRE> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Terminal_Interface.Curses.Forms.Field_User_Data --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- B O D Y --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Copyright (c) 1998-2003,2009 Free Software Foundation, Inc. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></FONT> --<FONT COLOR=green><EM>-- copy of this software and associated documentation files (the --</EM></FONT> --<FONT COLOR=green><EM>-- "Software"), to deal in the Software without restriction, including --</EM></FONT> --<FONT COLOR=green><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></FONT> --<FONT COLOR=green><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></FONT> --<FONT COLOR=green><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></FONT> --<FONT COLOR=green><EM>-- furnished to do so, subject to the following conditions: --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- The above copyright notice and this permission notice shall be included --</EM></FONT> --<FONT COLOR=green><EM>-- in all copies or substantial portions of the Software. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></FONT> --<FONT COLOR=green><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></FONT> --<FONT COLOR=green><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></FONT> --<FONT COLOR=green><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></FONT> --<FONT COLOR=green><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></FONT> --<FONT COLOR=green><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></FONT> --<FONT COLOR=green><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></FONT> --<FONT COLOR=green><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></FONT> --<FONT COLOR=green><EM>-- sale, use or other dealings in this Software without prior written --</EM></FONT> --<FONT COLOR=green><EM>-- authorization. --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Author: Juergen Pfeifer, 1996</EM></FONT> --<FONT COLOR=green><EM>-- Version Control:</EM></FONT> --<FONT COLOR=green><EM>-- @Revision: 1.13 @</EM></FONT> --<FONT COLOR=green><EM>-- Binding Version 01.00</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Terminal_Interface.Curses.Forms.Field_User_Data --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- B O D Y --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Copyright (c) 1998-2003,2009 Free Software Foundation, Inc. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></span> -+<span class="comment"><EM>-- copy of this software and associated documentation files (the --</EM></span> -+<span class="comment"><EM>-- "Software"), to deal in the Software without restriction, including --</EM></span> -+<span class="comment"><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></span> -+<span class="comment"><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></span> -+<span class="comment"><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></span> -+<span class="comment"><EM>-- furnished to do so, subject to the following conditions: --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- The above copyright notice and this permission notice shall be included --</EM></span> -+<span class="comment"><EM>-- in all copies or substantial portions of the Software. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></span> -+<span class="comment"><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></span> -+<span class="comment"><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></span> -+<span class="comment"><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></span> -+<span class="comment"><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></span> -+<span class="comment"><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></span> -+<span class="comment"><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></span> -+<span class="comment"><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></span> -+<span class="comment"><EM>-- sale, use or other dealings in this Software without prior written --</EM></span> -+<span class="comment"><EM>-- authorization. --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Author: Juergen Pfeifer, 1996</EM></span> -+<span class="comment"><EM>-- Version Control:</EM></span> -+<span class="comment"><EM>-- @Revision: 1.13 @</EM></span> -+<span class="comment"><EM>-- Binding Version 01.00</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> - <b>with</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-aux__ads.htm#ref_50_35">Aux</A>; <b>use</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-aux__ads.htm#ref_50_35">Aux</A>; - --<FONT COLOR=green><EM>-- |</EM></FONT> --<FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> --<FONT COLOR=green><EM>-- | man page form_field_userptr.3x</EM></FONT> --<FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> --<FONT COLOR=green><EM>-- |</EM></FONT> --<b>package</b> <b>body</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-forms__ads.htm#ref_49_35">Forms</A>.<FONT COLOR=red><A NAME="ref_48_46" HREF="terminal_interface-curses-forms-field_user_data__ads.htm#ref_45_41">Field_User_Data</A></FONT> <b>is</b> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <b>use</b> <b>type</b> <A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>.C.int; -+<span class="comment"><EM>-- |</EM></span> -+<span class="comment"><EM>-- |=====================================================================</EM></span> -+<span class="comment"><EM>-- | man page form_field_userptr.3x</EM></span> -+<span class="comment"><EM>-- |=====================================================================</EM></span> -+<span class="comment"><EM>-- |</EM></span> -+<b>package</b> <b>body</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-forms__ads.htm#ref_49_35">Forms</A>.<span class="symbol"><A NAME="ref_48_46" HREF="terminal_interface-curses-forms-field_user_data__ads.htm#ref_45_41">Field_User_Data</A></span> <b>is</b> -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <b>use</b> <b>type</b> <A HREF="interfac__ads.htm#ref_36_9">Interfaces</A>.C.int; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_54_14" HREF="terminal_interface-curses-forms-field_user_data__ads.htm#ref_53_14">Set_User_Data</A></FONT> (<FONT COLOR=red><A NAME="ref_54_29" HREF="terminal_interface-curses-forms-field_user_data__ads.htm#ref_53_29">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_55_29" HREF="terminal_interface-curses-forms-field_user_data__ads.htm#ref_54_29">Data</A></FONT> : <A HREF="terminal_interface-curses-forms-field_user_data__ads.htm#ref_44_9">User_Access</A>) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_54_14" HREF="terminal_interface-curses-forms-field_user_data__ads.htm#ref_53_14">Set_User_Data</A></span> (<span class="symbol"><A NAME="ref_54_29" HREF="terminal_interface-curses-forms-field_user_data__ads.htm#ref_53_29">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_55_29" HREF="terminal_interface-curses-forms-field_user_data__ads.htm#ref_54_29">Data</A></span> : <A HREF="terminal_interface-curses-forms-field_user_data__ads.htm#ref_44_9">User_Access</A>) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_57_16">Set_Field_Userptr</A></FONT> (<FONT COLOR=red><A NAME="ref_57_35" HREF="terminal_interface-curses-forms-field_user_data__adb.htm#ref_57_16">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_58_35" HREF="terminal_interface-curses-forms-field_user_data__adb.htm#ref_57_16">Usr</A></FONT> : <A HREF="terminal_interface-curses-forms-field_user_data__ads.htm#ref_44_9">User_Access</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_57_16">Set_Field_Userptr</A></span> (<span class="symbol"><A NAME="ref_57_35" HREF="terminal_interface-curses-forms-field_user_data__adb.htm#ref_57_16">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_58_35" HREF="terminal_interface-curses-forms-field_user_data__adb.htm#ref_57_16">Usr</A></span> : <A HREF="terminal_interface-curses-forms-field_user_data__ads.htm#ref_44_9">User_Access</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Set_Field_Userptr, "set_field_userptr"); - -- <FONT COLOR=red><A NAME="ref_61_7">Res</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := <A HREF="terminal_interface-curses-forms-field_user_data__adb.htm#ref_57_16">Set_Field_Userptr</A> (<A HREF="terminal_interface-curses-forms-field_user_data__ads.htm#ref_53_29">Fld</A>, <A HREF="terminal_interface-curses-forms-field_user_data__ads.htm#ref_54_29">Data</A>); -+ <span class="symbol"><A NAME="ref_61_7">Res</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := <A HREF="terminal_interface-curses-forms-field_user_data__adb.htm#ref_57_16">Set_Field_Userptr</A> (<A HREF="terminal_interface-curses-forms-field_user_data__ads.htm#ref_53_29">Fld</A>, <A HREF="terminal_interface-curses-forms-field_user_data__ads.htm#ref_54_29">Data</A>); - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses-forms-field_user_data__adb.htm#ref_61_7">Res</A> /= <A HREF="terminal_interface-curses-aux__ads.htm#ref_80_4">E_Ok</A> <b>then</b> - <A HREF="terminal_interface-curses-aux__ads.htm#ref_96_14">Eti_Exception</A> (<A HREF="terminal_interface-curses-forms-field_user_data__adb.htm#ref_61_7">Res</A>); - <b>end</b> <b>if</b>; - <b>end</b> <A HREF="terminal_interface-curses-forms-field_user_data__ads.htm#ref_53_14">Set_User_Data</A>; -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_70_13" HREF="terminal_interface-curses-forms-field_user_data__ads.htm#ref_64_13">Get_User_Data</A></FONT> (<FONT COLOR=red><A NAME="ref_70_28" HREF="terminal_interface-curses-forms-field_user_data__ads.htm#ref_64_28">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>) <b>return</b> <A HREF="terminal_interface-curses-forms-field_user_data__ads.htm#ref_44_9">User_Access</A> -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_70_13" HREF="terminal_interface-curses-forms-field_user_data__ads.htm#ref_64_13">Get_User_Data</A></span> (<span class="symbol"><A NAME="ref_70_28" HREF="terminal_interface-curses-forms-field_user_data__ads.htm#ref_64_28">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>) <b>return</b> <A HREF="terminal_interface-curses-forms-field_user_data__ads.htm#ref_44_9">User_Access</A> - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_72_16">Field_Userptr</A></FONT> (<FONT COLOR=red><A NAME="ref_72_31" HREF="terminal_interface-curses-forms-field_user_data__adb.htm#ref_72_16">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>) <b>return</b> <A HREF="terminal_interface-curses-forms-field_user_data__ads.htm#ref_44_9">User_Access</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_72_16">Field_Userptr</A></span> (<span class="symbol"><A NAME="ref_72_31" HREF="terminal_interface-curses-forms-field_user_data__adb.htm#ref_72_16">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>) <b>return</b> <A HREF="terminal_interface-curses-forms-field_user_data__ads.htm#ref_44_9">User_Access</A>; - <b>pragma</b> Import (C, Field_Userptr, "field_userptr"); - <b>begin</b> - <b>return</b> <A HREF="terminal_interface-curses-forms-field_user_data__adb.htm#ref_72_16">Field_Userptr</A> (<A HREF="terminal_interface-curses-forms-field_user_data__ads.htm#ref_64_28">Fld</A>); - <b>end</b> <A HREF="terminal_interface-curses-forms-field_user_data__ads.htm#ref_64_13">Get_User_Data</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_78_14" HREF="terminal_interface-curses-forms-field_user_data__ads.htm#ref_59_14">Get_User_Data</A></FONT> (<FONT COLOR=red><A NAME="ref_78_29" HREF="terminal_interface-curses-forms-field_user_data__ads.htm#ref_59_29">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_79_29" HREF="terminal_interface-curses-forms-field_user_data__ads.htm#ref_60_29">Data</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses-forms-field_user_data__ads.htm#ref_44_9">User_Access</A>) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_78_14" HREF="terminal_interface-curses-forms-field_user_data__ads.htm#ref_59_14">Get_User_Data</A></span> (<span class="symbol"><A NAME="ref_78_29" HREF="terminal_interface-curses-forms-field_user_data__ads.htm#ref_59_29">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_79_29" HREF="terminal_interface-curses-forms-field_user_data__ads.htm#ref_60_29">Data</A></span> : <b>out</b> <A HREF="terminal_interface-curses-forms-field_user_data__ads.htm#ref_44_9">User_Access</A>) - <b>is</b> - <b>begin</b> - <A HREF="terminal_interface-curses-forms-field_user_data__ads.htm#ref_60_29">Data</A> := <A HREF="terminal_interface-curses-forms-field_user_data__ads.htm#ref_64_13">Get_User_Data</A> (<A HREF="terminal_interface-curses-forms-field_user_data__ads.htm#ref_59_29">Fld</A>); -diff -Naur ncurses-5.9/doc/html/ada/terminal_interface-curses-forms-field_user_data__ads.htm ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-forms-field_user_data__ads.htm ---- ncurses-5.9/doc/html/ada/terminal_interface-curses-forms-field_user_data__ads.htm 2010-01-09 21:31:26.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-forms-field_user_data__ads.htm 2014-09-01 16:33:22.282792000 +0200 -@@ -1,74 +1,86 @@ --<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> --<HTML><HEAD><TITLE>terminal_interface-curses-forms-field_user_data.ads</TITLE></HEAD> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> -+<HTML> -+<HEAD> -+<TITLE>terminal_interface-curses-forms-field_user_data.ads</TITLE> -+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> -+<style type="text/css"> -+*.comment { -+ color: green; -+} -+*.symbol { -+ color: red; -+} -+</style> -+</HEAD> - <BODY> --<HR><DIV ALIGN="center"><H1> File : terminal_interface-curses-forms-field_user_data.ads </H1></DIV><HR> -+<HR><DIV style="text-align:center"><H1> File : terminal_interface-curses-forms-field_user_data.ads </H1></DIV><HR> - <PRE> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Terminal_Interface.Curses.Forms.Field_User_Data --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- S P E C --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Copyright (c) 1998-2003,2009 Free Software Foundation, Inc. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></FONT> --<FONT COLOR=green><EM>-- copy of this software and associated documentation files (the --</EM></FONT> --<FONT COLOR=green><EM>-- "Software"), to deal in the Software without restriction, including --</EM></FONT> --<FONT COLOR=green><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></FONT> --<FONT COLOR=green><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></FONT> --<FONT COLOR=green><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></FONT> --<FONT COLOR=green><EM>-- furnished to do so, subject to the following conditions: --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- The above copyright notice and this permission notice shall be included --</EM></FONT> --<FONT COLOR=green><EM>-- in all copies or substantial portions of the Software. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></FONT> --<FONT COLOR=green><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></FONT> --<FONT COLOR=green><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></FONT> --<FONT COLOR=green><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></FONT> --<FONT COLOR=green><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></FONT> --<FONT COLOR=green><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></FONT> --<FONT COLOR=green><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></FONT> --<FONT COLOR=green><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></FONT> --<FONT COLOR=green><EM>-- sale, use or other dealings in this Software without prior written --</EM></FONT> --<FONT COLOR=green><EM>-- authorization. --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Author: Juergen Pfeifer, 1996</EM></FONT> --<FONT COLOR=green><EM>-- Version Control:</EM></FONT> --<FONT COLOR=green><EM>-- @Revision: 1.16 @</EM></FONT> --<FONT COLOR=green><EM>-- Binding Version 01.00</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Terminal_Interface.Curses.Forms.Field_User_Data --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- S P E C --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Copyright (c) 1998-2003,2009 Free Software Foundation, Inc. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></span> -+<span class="comment"><EM>-- copy of this software and associated documentation files (the --</EM></span> -+<span class="comment"><EM>-- "Software"), to deal in the Software without restriction, including --</EM></span> -+<span class="comment"><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></span> -+<span class="comment"><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></span> -+<span class="comment"><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></span> -+<span class="comment"><EM>-- furnished to do so, subject to the following conditions: --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- The above copyright notice and this permission notice shall be included --</EM></span> -+<span class="comment"><EM>-- in all copies or substantial portions of the Software. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></span> -+<span class="comment"><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></span> -+<span class="comment"><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></span> -+<span class="comment"><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></span> -+<span class="comment"><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></span> -+<span class="comment"><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></span> -+<span class="comment"><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></span> -+<span class="comment"><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></span> -+<span class="comment"><EM>-- sale, use or other dealings in this Software without prior written --</EM></span> -+<span class="comment"><EM>-- authorization. --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Author: Juergen Pfeifer, 1996</EM></span> -+<span class="comment"><EM>-- Version Control:</EM></span> -+<span class="comment"><EM>-- @Revision: 1.16 @</EM></span> -+<span class="comment"><EM>-- Binding Version 01.00</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> - - <b>generic</b> -- <b>type</b> <FONT COLOR=red><A NAME="ref_43_9" HREF="terminal_interface-curses-forms-field_user_data__ads.htm#ref_45_41">User</A></FONT> <b>is</b> <b>limited</b> <b>private</b>; -- <b>type</b> <FONT COLOR=red><A NAME="ref_44_9" HREF="terminal_interface-curses-forms-field_user_data__ads.htm#ref_45_41">User_Access</A></FONT> <b>is</b> <b>access</b> <A HREF="terminal_interface-curses-forms-field_user_data__ads.htm#ref_43_9">User</A>; --<b>package</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-forms__ads.htm#ref_49_35">Forms</A>.<FONT COLOR=red><A NAME="ref_45_41" HREF="terminal_interface-curses-forms-field_user_data__adb.htm#ref_48_46">Field_User_Data</A></FONT> <b>is</b> -+ <b>type</b> <span class="symbol"><A NAME="ref_43_9" HREF="terminal_interface-curses-forms-field_user_data__ads.htm#ref_45_41">User</A></span> <b>is</b> <b>limited</b> <b>private</b>; -+ <b>type</b> <span class="symbol"><A NAME="ref_44_9" HREF="terminal_interface-curses-forms-field_user_data__ads.htm#ref_45_41">User_Access</A></span> <b>is</b> <b>access</b> <A HREF="terminal_interface-curses-forms-field_user_data__ads.htm#ref_43_9">User</A>; -+<b>package</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-forms__ads.htm#ref_49_35">Forms</A>.<span class="symbol"><A NAME="ref_45_41" HREF="terminal_interface-curses-forms-field_user_data__adb.htm#ref_48_46">Field_User_Data</A></span> <b>is</b> - <b>pragma</b> Preelaborate (<A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-forms__ads.htm#ref_49_35">Forms</A>.<A HREF="terminal_interface-curses-forms-field_user_data__ads.htm#ref_45_41">Field_User_Data</A>); - -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page <A HREF="../man/form_field_userptr.3x.html">form_field_userptr.3x</A></EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_1"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_53_14" HREF="terminal_interface-curses-forms-field_user_data__adb.htm#ref_54_14">Set_User_Data</A></FONT> (<FONT COLOR=red><A NAME="ref_53_29" HREF="terminal_interface-curses-forms-field_user_data__adb.htm#ref_54_29">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_54_29" HREF="terminal_interface-curses-forms-field_user_data__adb.htm#ref_55_29">Data</A></FONT> : <A HREF="terminal_interface-curses-forms-field_user_data__ads.htm#ref_44_9">User_Access</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/form_field_userptr.3x.html">set_field_userptr</A></EM></FONT> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page <A HREF="../man/form_field_userptr.3x.html">form_field_userptr.3x</A></EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_1"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_53_14" HREF="terminal_interface-curses-forms-field_user_data__adb.htm#ref_54_14">Set_User_Data</A></span> (<span class="symbol"><A NAME="ref_53_29" HREF="terminal_interface-curses-forms-field_user_data__adb.htm#ref_54_29">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_54_29" HREF="terminal_interface-curses-forms-field_user_data__adb.htm#ref_55_29">Data</A></span> : <A HREF="terminal_interface-curses-forms-field_user_data__ads.htm#ref_44_9">User_Access</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/form_field_userptr.3x.html">set_field_userptr</A></EM></span> - <b>pragma</b> Inline (<A HREF="terminal_interface-curses-forms-field_user_data__ads.htm#ref_53_14">Set_User_Data</A>); - -- <FONT COLOR=green><EM>-- #1A NAME="AFU_2"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_59_14" HREF="terminal_interface-curses-forms-field_user_data__adb.htm#ref_78_14">Get_User_Data</A></FONT> (<FONT COLOR=red><A NAME="ref_59_29" HREF="terminal_interface-curses-forms-field_user_data__adb.htm#ref_78_29">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -- <FONT COLOR=red><A NAME="ref_60_29" HREF="terminal_interface-curses-forms-field_user_data__adb.htm#ref_79_29">Data</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses-forms-field_user_data__ads.htm#ref_44_9">User_Access</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/form_field_userptr.3x.html">field_userptr</A></EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_3"#2|</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_64_13" HREF="terminal_interface-curses-forms-field_user_data__adb.htm#ref_70_13">Get_User_Data</A></FONT> (<FONT COLOR=red><A NAME="ref_64_28" HREF="terminal_interface-curses-forms-field_user_data__adb.htm#ref_70_28">Fld</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>) <b>return</b> <A HREF="terminal_interface-curses-forms-field_user_data__ads.htm#ref_44_9">User_Access</A>; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/form_field_userptr.3x.html">field_userptr</A></EM></FONT> -- <FONT COLOR=green><EM>-- Sama as function</EM></FONT> -+ <span class="comment"><EM>-- #1A NAME="AFU_2"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_59_14" HREF="terminal_interface-curses-forms-field_user_data__adb.htm#ref_78_14">Get_User_Data</A></span> (<span class="symbol"><A NAME="ref_59_29" HREF="terminal_interface-curses-forms-field_user_data__adb.htm#ref_78_29">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>; -+ <span class="symbol"><A NAME="ref_60_29" HREF="terminal_interface-curses-forms-field_user_data__adb.htm#ref_79_29">Data</A></span> : <b>out</b> <A HREF="terminal_interface-curses-forms-field_user_data__ads.htm#ref_44_9">User_Access</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/form_field_userptr.3x.html">field_userptr</A></EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_3"#2|</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_64_13" HREF="terminal_interface-curses-forms-field_user_data__adb.htm#ref_70_13">Get_User_Data</A></span> (<span class="symbol"><A NAME="ref_64_28" HREF="terminal_interface-curses-forms-field_user_data__adb.htm#ref_70_28">Fld</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_56_9">Field</A>) <b>return</b> <A HREF="terminal_interface-curses-forms-field_user_data__ads.htm#ref_44_9">User_Access</A>; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/form_field_userptr.3x.html">field_userptr</A></EM></span> -+ <span class="comment"><EM>-- Sama as function</EM></span> - <b>pragma</b> Inline (Get_User_Data); - - <b>end</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-forms__ads.htm#ref_49_35">Forms</A>.<A HREF="terminal_interface-curses-forms-field_user_data__ads.htm#ref_45_41">Field_User_Data</A>; -diff -Naur ncurses-5.9/doc/html/ada/terminal_interface-curses-forms-form_user_data__adb.htm ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-forms-form_user_data__adb.htm ---- ncurses-5.9/doc/html/ada/terminal_interface-curses-forms-form_user_data__adb.htm 2011-02-26 00:43:49.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-forms-form_user_data__adb.htm 2014-09-01 16:33:22.282792000 +0200 -@@ -1,88 +1,100 @@ --<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> --<HTML><HEAD><TITLE>terminal_interface-curses-forms-form_user_data.adb</TITLE></HEAD> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> -+<HTML> -+<HEAD> -+<TITLE>terminal_interface-curses-forms-form_user_data.adb</TITLE> -+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> -+<style type="text/css"> -+*.comment { -+ color: green; -+} -+*.symbol { -+ color: red; -+} -+</style> -+</HEAD> - <BODY> --<HR><DIV ALIGN="center"><H1> File : terminal_interface-curses-forms-form_user_data.adb </H1></DIV><HR> -+<HR><DIV style="text-align:center"><H1> File : terminal_interface-curses-forms-form_user_data.adb </H1></DIV><HR> - <PRE> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Terminal_Interface.Curses.Forms.Form_User_Data --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- B O D Y --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Copyright (c) 1998-2003,2009 Free Software Foundation, Inc. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></FONT> --<FONT COLOR=green><EM>-- copy of this software and associated documentation files (the --</EM></FONT> --<FONT COLOR=green><EM>-- "Software"), to deal in the Software without restriction, including --</EM></FONT> --<FONT COLOR=green><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></FONT> --<FONT COLOR=green><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></FONT> --<FONT COLOR=green><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></FONT> --<FONT COLOR=green><EM>-- furnished to do so, subject to the following conditions: --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- The above copyright notice and this permission notice shall be included --</EM></FONT> --<FONT COLOR=green><EM>-- in all copies or substantial portions of the Software. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></FONT> --<FONT COLOR=green><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></FONT> --<FONT COLOR=green><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></FONT> --<FONT COLOR=green><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></FONT> --<FONT COLOR=green><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></FONT> --<FONT COLOR=green><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></FONT> --<FONT COLOR=green><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></FONT> --<FONT COLOR=green><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></FONT> --<FONT COLOR=green><EM>-- sale, use or other dealings in this Software without prior written --</EM></FONT> --<FONT COLOR=green><EM>-- authorization. --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Author: Juergen Pfeifer, 1996</EM></FONT> --<FONT COLOR=green><EM>-- Version Control:</EM></FONT> --<FONT COLOR=green><EM>-- @Revision: 1.13 @</EM></FONT> --<FONT COLOR=green><EM>-- Binding Version 01.00</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- |</EM></FONT> --<FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> --<FONT COLOR=green><EM>-- | man page form__userptr.3x</EM></FONT> --<FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> --<FONT COLOR=green><EM>-- |</EM></FONT> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Terminal_Interface.Curses.Forms.Form_User_Data --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- B O D Y --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Copyright (c) 1998-2003,2009 Free Software Foundation, Inc. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></span> -+<span class="comment"><EM>-- copy of this software and associated documentation files (the --</EM></span> -+<span class="comment"><EM>-- "Software"), to deal in the Software without restriction, including --</EM></span> -+<span class="comment"><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></span> -+<span class="comment"><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></span> -+<span class="comment"><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></span> -+<span class="comment"><EM>-- furnished to do so, subject to the following conditions: --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- The above copyright notice and this permission notice shall be included --</EM></span> -+<span class="comment"><EM>-- in all copies or substantial portions of the Software. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></span> -+<span class="comment"><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></span> -+<span class="comment"><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></span> -+<span class="comment"><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></span> -+<span class="comment"><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></span> -+<span class="comment"><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></span> -+<span class="comment"><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></span> -+<span class="comment"><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></span> -+<span class="comment"><EM>-- sale, use or other dealings in this Software without prior written --</EM></span> -+<span class="comment"><EM>-- authorization. --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Author: Juergen Pfeifer, 1996</EM></span> -+<span class="comment"><EM>-- Version Control:</EM></span> -+<span class="comment"><EM>-- @Revision: 1.13 @</EM></span> -+<span class="comment"><EM>-- Binding Version 01.00</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- |</EM></span> -+<span class="comment"><EM>-- |=====================================================================</EM></span> -+<span class="comment"><EM>-- | man page form__userptr.3x</EM></span> -+<span class="comment"><EM>-- |=====================================================================</EM></span> -+<span class="comment"><EM>-- |</EM></span> - <b>with</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-aux__ads.htm#ref_50_35">Aux</A>; <b>use</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-aux__ads.htm#ref_50_35">Aux</A>; - --<b>package</b> <b>body</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-forms__ads.htm#ref_49_35">Forms</A>.<FONT COLOR=red><A NAME="ref_48_46" HREF="terminal_interface-curses-forms-form_user_data__ads.htm#ref_45_41">Form_User_Data</A></FONT> <b>is</b> -+<b>package</b> <b>body</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-forms__ads.htm#ref_49_35">Forms</A>.<span class="symbol"><A NAME="ref_48_46" HREF="terminal_interface-curses-forms-form_user_data__ads.htm#ref_45_41">Form_User_Data</A></span> <b>is</b> - -- <b>use</b> <b>type</b> <A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>.C.int; -+ <b>use</b> <b>type</b> <A HREF="interfac__ads.htm#ref_36_9">Interfaces</A>.C.int; - -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_55_14" HREF="terminal_interface-curses-forms-form_user_data__ads.htm#ref_53_14">Set_User_Data</A></FONT> (<FONT COLOR=red><A NAME="ref_55_29" HREF="terminal_interface-curses-forms-form_user_data__ads.htm#ref_53_29">Frm</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -- <FONT COLOR=red><A NAME="ref_56_29" HREF="terminal_interface-curses-forms-form_user_data__ads.htm#ref_54_29">Data</A></FONT> : <A HREF="terminal_interface-curses-forms-form_user_data__ads.htm#ref_44_9">User_Access</A>) -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_55_14" HREF="terminal_interface-curses-forms-form_user_data__ads.htm#ref_53_14">Set_User_Data</A></span> (<span class="symbol"><A NAME="ref_55_29" HREF="terminal_interface-curses-forms-form_user_data__ads.htm#ref_53_29">Frm</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -+ <span class="symbol"><A NAME="ref_56_29" HREF="terminal_interface-curses-forms-form_user_data__ads.htm#ref_54_29">Data</A></span> : <A HREF="terminal_interface-curses-forms-form_user_data__ads.htm#ref_44_9">User_Access</A>) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_58_16">Set_Form_Userptr</A></FONT> (<FONT COLOR=red><A NAME="ref_58_34" HREF="terminal_interface-curses-forms-form_user_data__adb.htm#ref_58_16">Frm</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -- <FONT COLOR=red><A NAME="ref_59_34" HREF="terminal_interface-curses-forms-form_user_data__adb.htm#ref_58_16">Data</A></FONT> : <A HREF="terminal_interface-curses-forms-form_user_data__ads.htm#ref_44_9">User_Access</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_58_16">Set_Form_Userptr</A></span> (<span class="symbol"><A NAME="ref_58_34" HREF="terminal_interface-curses-forms-form_user_data__adb.htm#ref_58_16">Frm</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -+ <span class="symbol"><A NAME="ref_59_34" HREF="terminal_interface-curses-forms-form_user_data__adb.htm#ref_58_16">Data</A></span> : <A HREF="terminal_interface-curses-forms-form_user_data__ads.htm#ref_44_9">User_Access</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Set_Form_Userptr, "set_form_userptr"); - -- <FONT COLOR=red><A NAME="ref_62_7">Res</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := <A HREF="terminal_interface-curses-forms-form_user_data__adb.htm#ref_58_16">Set_Form_Userptr</A> (<A HREF="terminal_interface-curses-forms-form_user_data__ads.htm#ref_53_29">Frm</A>, <A HREF="terminal_interface-curses-forms-form_user_data__ads.htm#ref_54_29">Data</A>); -+ <span class="symbol"><A NAME="ref_62_7">Res</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := <A HREF="terminal_interface-curses-forms-form_user_data__adb.htm#ref_58_16">Set_Form_Userptr</A> (<A HREF="terminal_interface-curses-forms-form_user_data__ads.htm#ref_53_29">Frm</A>, <A HREF="terminal_interface-curses-forms-form_user_data__ads.htm#ref_54_29">Data</A>); - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses-forms-form_user_data__adb.htm#ref_62_7">Res</A> /= <A HREF="terminal_interface-curses-aux__ads.htm#ref_80_4">E_Ok</A> <b>then</b> - <A HREF="terminal_interface-curses-aux__ads.htm#ref_96_14">Eti_Exception</A> (<A HREF="terminal_interface-curses-forms-form_user_data__adb.htm#ref_62_7">Res</A>); - <b>end</b> <b>if</b>; - <b>end</b> <A HREF="terminal_interface-curses-forms-form_user_data__ads.htm#ref_53_14">Set_User_Data</A>; -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_71_13" HREF="terminal_interface-curses-forms-form_user_data__ads.htm#ref_64_13">Get_User_Data</A></FONT> (<FONT COLOR=red><A NAME="ref_71_28" HREF="terminal_interface-curses-forms-form_user_data__ads.htm#ref_64_28">Frm</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>) <b>return</b> <A HREF="terminal_interface-curses-forms-form_user_data__ads.htm#ref_44_9">User_Access</A> -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <span class="comment"><EM>-- |</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_71_13" HREF="terminal_interface-curses-forms-form_user_data__ads.htm#ref_64_13">Get_User_Data</A></span> (<span class="symbol"><A NAME="ref_71_28" HREF="terminal_interface-curses-forms-form_user_data__ads.htm#ref_64_28">Frm</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>) <b>return</b> <A HREF="terminal_interface-curses-forms-form_user_data__ads.htm#ref_44_9">User_Access</A> - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_73_16">Form_Userptr</A></FONT> (<FONT COLOR=red><A NAME="ref_73_30" HREF="terminal_interface-curses-forms-form_user_data__adb.htm#ref_73_16">Frm</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>) <b>return</b> <A HREF="terminal_interface-curses-forms-form_user_data__ads.htm#ref_44_9">User_Access</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_73_16">Form_Userptr</A></span> (<span class="symbol"><A NAME="ref_73_30" HREF="terminal_interface-curses-forms-form_user_data__adb.htm#ref_73_16">Frm</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>) <b>return</b> <A HREF="terminal_interface-curses-forms-form_user_data__ads.htm#ref_44_9">User_Access</A>; - <b>pragma</b> Import (C, Form_Userptr, "form_userptr"); - <b>begin</b> - <b>return</b> <A HREF="terminal_interface-curses-forms-form_user_data__adb.htm#ref_73_16">Form_Userptr</A> (<A HREF="terminal_interface-curses-forms-form_user_data__ads.htm#ref_64_28">Frm</A>); - <b>end</b> <A HREF="terminal_interface-curses-forms-form_user_data__ads.htm#ref_64_13">Get_User_Data</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_79_14" HREF="terminal_interface-curses-forms-form_user_data__ads.htm#ref_59_14">Get_User_Data</A></FONT> (<FONT COLOR=red><A NAME="ref_79_29" HREF="terminal_interface-curses-forms-form_user_data__ads.htm#ref_59_29">Frm</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -- <FONT COLOR=red><A NAME="ref_80_29" HREF="terminal_interface-curses-forms-form_user_data__ads.htm#ref_60_29">Data</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses-forms-form_user_data__ads.htm#ref_44_9">User_Access</A>) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_79_14" HREF="terminal_interface-curses-forms-form_user_data__ads.htm#ref_59_14">Get_User_Data</A></span> (<span class="symbol"><A NAME="ref_79_29" HREF="terminal_interface-curses-forms-form_user_data__ads.htm#ref_59_29">Frm</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -+ <span class="symbol"><A NAME="ref_80_29" HREF="terminal_interface-curses-forms-form_user_data__ads.htm#ref_60_29">Data</A></span> : <b>out</b> <A HREF="terminal_interface-curses-forms-form_user_data__ads.htm#ref_44_9">User_Access</A>) - <b>is</b> - <b>begin</b> - <A HREF="terminal_interface-curses-forms-form_user_data__ads.htm#ref_60_29">Data</A> := <A HREF="terminal_interface-curses-forms-form_user_data__ads.htm#ref_64_13">Get_User_Data</A> (<A HREF="terminal_interface-curses-forms-form_user_data__ads.htm#ref_59_29">Frm</A>); -diff -Naur ncurses-5.9/doc/html/ada/terminal_interface-curses-forms-form_user_data__ads.htm ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-forms-form_user_data__ads.htm ---- ncurses-5.9/doc/html/ada/terminal_interface-curses-forms-form_user_data__ads.htm 2010-01-09 21:31:26.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-forms-form_user_data__ads.htm 2014-09-01 16:33:22.282792000 +0200 -@@ -1,74 +1,86 @@ --<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> --<HTML><HEAD><TITLE>terminal_interface-curses-forms-form_user_data.ads</TITLE></HEAD> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> -+<HTML> -+<HEAD> -+<TITLE>terminal_interface-curses-forms-form_user_data.ads</TITLE> -+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> -+<style type="text/css"> -+*.comment { -+ color: green; -+} -+*.symbol { -+ color: red; -+} -+</style> -+</HEAD> - <BODY> --<HR><DIV ALIGN="center"><H1> File : terminal_interface-curses-forms-form_user_data.ads </H1></DIV><HR> -+<HR><DIV style="text-align:center"><H1> File : terminal_interface-curses-forms-form_user_data.ads </H1></DIV><HR> - <PRE> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Terminal_Interface.Curses.Forms.Form_User_Data --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- S P E C --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Copyright (c) 1998-2003,2009 Free Software Foundation, Inc. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></FONT> --<FONT COLOR=green><EM>-- copy of this software and associated documentation files (the --</EM></FONT> --<FONT COLOR=green><EM>-- "Software"), to deal in the Software without restriction, including --</EM></FONT> --<FONT COLOR=green><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></FONT> --<FONT COLOR=green><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></FONT> --<FONT COLOR=green><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></FONT> --<FONT COLOR=green><EM>-- furnished to do so, subject to the following conditions: --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- The above copyright notice and this permission notice shall be included --</EM></FONT> --<FONT COLOR=green><EM>-- in all copies or substantial portions of the Software. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></FONT> --<FONT COLOR=green><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></FONT> --<FONT COLOR=green><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></FONT> --<FONT COLOR=green><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></FONT> --<FONT COLOR=green><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></FONT> --<FONT COLOR=green><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></FONT> --<FONT COLOR=green><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></FONT> --<FONT COLOR=green><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></FONT> --<FONT COLOR=green><EM>-- sale, use or other dealings in this Software without prior written --</EM></FONT> --<FONT COLOR=green><EM>-- authorization. --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Author: Juergen Pfeifer, 1996</EM></FONT> --<FONT COLOR=green><EM>-- Version Control:</EM></FONT> --<FONT COLOR=green><EM>-- @Revision: 1.15 @</EM></FONT> --<FONT COLOR=green><EM>-- Binding Version 01.00</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Terminal_Interface.Curses.Forms.Form_User_Data --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- S P E C --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Copyright (c) 1998-2003,2009 Free Software Foundation, Inc. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></span> -+<span class="comment"><EM>-- copy of this software and associated documentation files (the --</EM></span> -+<span class="comment"><EM>-- "Software"), to deal in the Software without restriction, including --</EM></span> -+<span class="comment"><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></span> -+<span class="comment"><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></span> -+<span class="comment"><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></span> -+<span class="comment"><EM>-- furnished to do so, subject to the following conditions: --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- The above copyright notice and this permission notice shall be included --</EM></span> -+<span class="comment"><EM>-- in all copies or substantial portions of the Software. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></span> -+<span class="comment"><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></span> -+<span class="comment"><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></span> -+<span class="comment"><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></span> -+<span class="comment"><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></span> -+<span class="comment"><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></span> -+<span class="comment"><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></span> -+<span class="comment"><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></span> -+<span class="comment"><EM>-- sale, use or other dealings in this Software without prior written --</EM></span> -+<span class="comment"><EM>-- authorization. --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Author: Juergen Pfeifer, 1996</EM></span> -+<span class="comment"><EM>-- Version Control:</EM></span> -+<span class="comment"><EM>-- @Revision: 1.15 @</EM></span> -+<span class="comment"><EM>-- Binding Version 01.00</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> - - <b>generic</b> -- <b>type</b> <FONT COLOR=red><A NAME="ref_43_9" HREF="terminal_interface-curses-forms-form_user_data__ads.htm#ref_45_41">User</A></FONT> <b>is</b> <b>limited</b> <b>private</b>; -- <b>type</b> <FONT COLOR=red><A NAME="ref_44_9" HREF="terminal_interface-curses-forms-form_user_data__ads.htm#ref_45_41">User_Access</A></FONT> <b>is</b> <b>access</b> <A HREF="terminal_interface-curses-forms-form_user_data__ads.htm#ref_43_9">User</A>; --<b>package</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-forms__ads.htm#ref_49_35">Forms</A>.<FONT COLOR=red><A NAME="ref_45_41" HREF="terminal_interface-curses-forms-form_user_data__adb.htm#ref_48_46">Form_User_Data</A></FONT> <b>is</b> -+ <b>type</b> <span class="symbol"><A NAME="ref_43_9" HREF="terminal_interface-curses-forms-form_user_data__ads.htm#ref_45_41">User</A></span> <b>is</b> <b>limited</b> <b>private</b>; -+ <b>type</b> <span class="symbol"><A NAME="ref_44_9" HREF="terminal_interface-curses-forms-form_user_data__ads.htm#ref_45_41">User_Access</A></span> <b>is</b> <b>access</b> <A HREF="terminal_interface-curses-forms-form_user_data__ads.htm#ref_43_9">User</A>; -+<b>package</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-forms__ads.htm#ref_49_35">Forms</A>.<span class="symbol"><A NAME="ref_45_41" HREF="terminal_interface-curses-forms-form_user_data__adb.htm#ref_48_46">Form_User_Data</A></span> <b>is</b> - <b>pragma</b> Preelaborate (<A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-forms__ads.htm#ref_49_35">Forms</A>.<A HREF="terminal_interface-curses-forms-form_user_data__ads.htm#ref_45_41">Form_User_Data</A>); - -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page <A HREF="../man/form_userptr.3x.html">form_userptr.3x</A></EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_1"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_53_14" HREF="terminal_interface-curses-forms-form_user_data__adb.htm#ref_55_14">Set_User_Data</A></FONT> (<FONT COLOR=red><A NAME="ref_53_29" HREF="terminal_interface-curses-forms-form_user_data__adb.htm#ref_55_29">Frm</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -- <FONT COLOR=red><A NAME="ref_54_29" HREF="terminal_interface-curses-forms-form_user_data__adb.htm#ref_56_29">Data</A></FONT> : <A HREF="terminal_interface-curses-forms-form_user_data__ads.htm#ref_44_9">User_Access</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/form_userptr.3x.html">set_form_userptr</A></EM></FONT> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page <A HREF="../man/form_userptr.3x.html">form_userptr.3x</A></EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_1"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_53_14" HREF="terminal_interface-curses-forms-form_user_data__adb.htm#ref_55_14">Set_User_Data</A></span> (<span class="symbol"><A NAME="ref_53_29" HREF="terminal_interface-curses-forms-form_user_data__adb.htm#ref_55_29">Frm</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -+ <span class="symbol"><A NAME="ref_54_29" HREF="terminal_interface-curses-forms-form_user_data__adb.htm#ref_56_29">Data</A></span> : <A HREF="terminal_interface-curses-forms-form_user_data__ads.htm#ref_44_9">User_Access</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/form_userptr.3x.html">set_form_userptr</A></EM></span> - <b>pragma</b> Inline (<A HREF="terminal_interface-curses-forms-form_user_data__ads.htm#ref_53_14">Set_User_Data</A>); - -- <FONT COLOR=green><EM>-- #1A NAME="AFU_2"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_59_14" HREF="terminal_interface-curses-forms-form_user_data__adb.htm#ref_79_14">Get_User_Data</A></FONT> (<FONT COLOR=red><A NAME="ref_59_29" HREF="terminal_interface-curses-forms-form_user_data__adb.htm#ref_79_29">Frm</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -- <FONT COLOR=red><A NAME="ref_60_29" HREF="terminal_interface-curses-forms-form_user_data__adb.htm#ref_80_29">Data</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses-forms-form_user_data__ads.htm#ref_44_9">User_Access</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/form_userptr.3x.html">form_userptr</A></EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_3"#2|</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_64_13" HREF="terminal_interface-curses-forms-form_user_data__adb.htm#ref_71_13">Get_User_Data</A></FONT> (<FONT COLOR=red><A NAME="ref_64_28" HREF="terminal_interface-curses-forms-form_user_data__adb.htm#ref_71_28">Frm</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>) <b>return</b> <A HREF="terminal_interface-curses-forms-form_user_data__ads.htm#ref_44_9">User_Access</A>; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/form_userptr.3x.html">form_userptr</A></EM></FONT> -- <FONT COLOR=green><EM>-- Same as function</EM></FONT> -+ <span class="comment"><EM>-- #1A NAME="AFU_2"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_59_14" HREF="terminal_interface-curses-forms-form_user_data__adb.htm#ref_79_14">Get_User_Data</A></span> (<span class="symbol"><A NAME="ref_59_29" HREF="terminal_interface-curses-forms-form_user_data__adb.htm#ref_79_29">Frm</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>; -+ <span class="symbol"><A NAME="ref_60_29" HREF="terminal_interface-curses-forms-form_user_data__adb.htm#ref_80_29">Data</A></span> : <b>out</b> <A HREF="terminal_interface-curses-forms-form_user_data__ads.htm#ref_44_9">User_Access</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/form_userptr.3x.html">form_userptr</A></EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_3"#2|</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_64_13" HREF="terminal_interface-curses-forms-form_user_data__adb.htm#ref_71_13">Get_User_Data</A></span> (<span class="symbol"><A NAME="ref_64_28" HREF="terminal_interface-curses-forms-form_user_data__adb.htm#ref_71_28">Frm</A></span> : <A HREF="terminal_interface-curses-forms__ads.htm#ref_57_9">Form</A>) <b>return</b> <A HREF="terminal_interface-curses-forms-form_user_data__ads.htm#ref_44_9">User_Access</A>; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/form_userptr.3x.html">form_userptr</A></EM></span> -+ <span class="comment"><EM>-- Same as function</EM></span> - <b>pragma</b> Inline (Get_User_Data); - - <b>end</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-forms__ads.htm#ref_49_35">Forms</A>.<A HREF="terminal_interface-curses-forms-form_user_data__ads.htm#ref_45_41">Form_User_Data</A>; -diff -Naur ncurses-5.9/doc/html/ada/terminal_interface-curses-menus__adb.htm ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-menus__adb.htm ---- ncurses-5.9/doc/html/ada/terminal_interface-curses-menus__adb.htm 2011-03-26 22:54:29.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-menus__adb.htm 2014-09-01 16:33:22.292792016 +0200 -@@ -1,66 +1,78 @@ --<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> --<HTML><HEAD><TITLE>terminal_interface-curses-menus.adb</TITLE></HEAD> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> -+<HTML> -+<HEAD> -+<TITLE>terminal_interface-curses-menus.adb</TITLE> -+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> -+<style type="text/css"> -+*.comment { -+ color: green; -+} -+*.symbol { -+ color: red; -+} -+</style> -+</HEAD> - <BODY> --<HR><DIV ALIGN="center"><H1> File : terminal_interface-curses-menus.adb </H1></DIV><HR> -+<HR><DIV style="text-align:center"><H1> File : terminal_interface-curses-menus.adb </H1></DIV><HR> - <PRE> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Terminal_Interface.Curses.Menus --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- B O D Y --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Copyright (c) 1998-2009,2011 Free Software Foundation, Inc. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></FONT> --<FONT COLOR=green><EM>-- copy of this software and associated documentation files (the --</EM></FONT> --<FONT COLOR=green><EM>-- "Software"), to deal in the Software without restriction, including --</EM></FONT> --<FONT COLOR=green><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></FONT> --<FONT COLOR=green><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></FONT> --<FONT COLOR=green><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></FONT> --<FONT COLOR=green><EM>-- furnished to do so, subject to the following conditions: --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- The above copyright notice and this permission notice shall be included --</EM></FONT> --<FONT COLOR=green><EM>-- in all copies or substantial portions of the Software. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></FONT> --<FONT COLOR=green><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></FONT> --<FONT COLOR=green><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></FONT> --<FONT COLOR=green><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></FONT> --<FONT COLOR=green><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></FONT> --<FONT COLOR=green><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></FONT> --<FONT COLOR=green><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></FONT> --<FONT COLOR=green><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></FONT> --<FONT COLOR=green><EM>-- sale, use or other dealings in this Software without prior written --</EM></FONT> --<FONT COLOR=green><EM>-- authorization. --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Author: Juergen Pfeifer, 1996</EM></FONT> --<FONT COLOR=green><EM>-- Version Control:</EM></FONT> --<FONT COLOR=green><EM>-- @Revision: 1.28 @</EM></FONT> --<FONT COLOR=green><EM>-- @Date: 2011/03/22 23:38:12 @</EM></FONT> --<FONT COLOR=green><EM>-- Binding Version 01.00</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Terminal_Interface.Curses.Menus --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- B O D Y --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Copyright (c) 1998-2009,2011 Free Software Foundation, Inc. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></span> -+<span class="comment"><EM>-- copy of this software and associated documentation files (the --</EM></span> -+<span class="comment"><EM>-- "Software"), to deal in the Software without restriction, including --</EM></span> -+<span class="comment"><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></span> -+<span class="comment"><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></span> -+<span class="comment"><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></span> -+<span class="comment"><EM>-- furnished to do so, subject to the following conditions: --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- The above copyright notice and this permission notice shall be included --</EM></span> -+<span class="comment"><EM>-- in all copies or substantial portions of the Software. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></span> -+<span class="comment"><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></span> -+<span class="comment"><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></span> -+<span class="comment"><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></span> -+<span class="comment"><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></span> -+<span class="comment"><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></span> -+<span class="comment"><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></span> -+<span class="comment"><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></span> -+<span class="comment"><EM>-- sale, use or other dealings in this Software without prior written --</EM></span> -+<span class="comment"><EM>-- authorization. --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Author: Juergen Pfeifer, 1996</EM></span> -+<span class="comment"><EM>-- Version Control:</EM></span> -+<span class="comment"><EM>-- @Revision: 1.28 @</EM></span> -+<span class="comment"><EM>-- @Date: 2011/03/22 23:38:12 @</EM></span> -+<span class="comment"><EM>-- Binding Version 01.00</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> - <b>with</b> Ada.Unchecked_Deallocation; - <b>with</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-aux__ads.htm#ref_50_35">Aux</A>; <b>use</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-aux__ads.htm#ref_50_35">Aux</A>; - --<b>with</b> <A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>.C; <b>use</b> <A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>.C; --<b>with</b> <A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>.C.Strings; <b>use</b> <A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>.C.Strings; --<b>with</b> <A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>.C.Pointers; -+<b>with</b> <A HREF="interfac__ads.htm#ref_36_9">Interfaces</A>.C; <b>use</b> <A HREF="interfac__ads.htm#ref_36_9">Interfaces</A>.C; -+<b>with</b> <A HREF="interfac__ads.htm#ref_36_9">Interfaces</A>.C.Strings; <b>use</b> <A HREF="interfac__ads.htm#ref_36_9">Interfaces</A>.C.Strings; -+<b>with</b> <A HREF="interfac__ads.htm#ref_36_9">Interfaces</A>.C.Pointers; - - <b>with</b> Ada.Unchecked_Conversion; - --<b>package</b> <b>body</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<FONT COLOR=red><A NAME="ref_51_40" HREF="terminal_interface-curses-menus__ads.htm#ref_49_35">Menus</A></FONT> <b>is</b> -+<b>package</b> <b>body</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<span class="symbol"><A NAME="ref_51_40" HREF="terminal_interface-curses-menus__ads.htm#ref_49_35">Menus</A></span> <b>is</b> - - <b>type</b> C_Item_Array <b>is</b> <b>array</b> (Natural <b>range</b> &lt;&gt;) <b>of</b> <b>aliased</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>; - <b>package</b> I_Array <b>is</b> <b>new</b> -- <A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>.C.Pointers (Natural, <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>, C_Item_Array, <A HREF="terminal_interface-curses-menus__ads.htm#ref_62_4">Null_Item</A>); -+ <A HREF="interfac__ads.htm#ref_36_9">Interfaces</A>.C.Pointers (Natural, <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>, C_Item_Array, <A HREF="terminal_interface-curses-menus__ads.htm#ref_62_4">Null_Item</A>); - - <b>use</b> <b>type</b> System.Bit_Order; -- <b>subtype</b> <FONT COLOR=red><A NAME="ref_58_12">chars_ptr</A></FONT> <b>is</b> <A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>.C.Strings.chars_ptr; -+ <b>subtype</b> <span class="symbol"><A NAME="ref_58_12">chars_ptr</A></span> <b>is</b> <A HREF="interfac__ads.htm#ref_36_9">Interfaces</A>.C.Strings.chars_ptr; - - <b>function</b> MOS_2_CInt <b>is</b> <b>new</b> - Ada.Unchecked_Conversion (<A HREF="terminal_interface-curses-menus__ads.htm#ref_121_9">Menu_Option_Set</A>, -@@ -71,656 +83,656 @@ - <A HREF="terminal_interface-curses-menus__ads.htm#ref_121_9">Menu_Option_Set</A>); - - <b>function</b> IOS_2_CInt <b>is</b> <b>new</b> -- Ada.Unchecked_Conversion (<A HREF="terminal_interface-curses-menus__ads.htm#ref_155_9">Item_Option_Set</A>, -+ Ada.Unchecked_Conversion (<A HREF="terminal_interface-curses-menus__ads.htm#ref_154_9">Item_Option_Set</A>, - <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>); - - <b>function</b> CInt_2_IOS <b>is</b> <b>new</b> - Ada.Unchecked_Conversion (<A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>, -- <A HREF="terminal_interface-curses-menus__ads.htm#ref_155_9">Item_Option_Set</A>); -+ <A HREF="terminal_interface-curses-menus__ads.htm#ref_154_9">Item_Option_Set</A>); - --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_77_14" HREF="terminal_interface-curses-menus__ads.htm#ref_106_14">Request_Name</A></FONT> (<FONT COLOR=red><A NAME="ref_77_28" HREF="terminal_interface-curses-menus__ads.htm#ref_106_28">Key</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_65_12">Menu_Request_Code</A>; -- <FONT COLOR=red><A NAME="ref_78_28" HREF="terminal_interface-curses-menus__ads.htm#ref_107_28">Name</A></FONT> : <b>out</b> String) -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_77_14" HREF="terminal_interface-curses-menus__ads.htm#ref_106_14">Request_Name</A></span> (<span class="symbol"><A NAME="ref_77_28" HREF="terminal_interface-curses-menus__ads.htm#ref_106_28">Key</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_65_12">Menu_Request_Code</A>; -+ <span class="symbol"><A NAME="ref_78_28" HREF="terminal_interface-curses-menus__ads.htm#ref_107_28">Name</A></span> : <b>out</b> String) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_80_16">Request_Name</A></FONT> (<FONT COLOR=red><A NAME="ref_80_30" HREF="terminal_interface-curses-menus__adb.htm#ref_80_16">Key</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-menus__adb.htm#ref_58_12">chars_ptr</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_80_16">Request_Name</A></span> (<span class="symbol"><A NAME="ref_80_30" HREF="terminal_interface-curses-menus__adb.htm#ref_80_16">Key</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-menus__adb.htm#ref_58_12">chars_ptr</A>; - <b>pragma</b> Import (C, Request_Name, "menu_request_name"); - <b>begin</b> - <A HREF="terminal_interface-curses-aux__ads.htm#ref_116_14">Fill_String</A> (<A HREF="terminal_interface-curses-menus__adb.htm#ref_80_16">Request_Name</A> (<A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_106_28">Key</A>)), <A HREF="terminal_interface-curses-menus__ads.htm#ref_107_28">Name</A>); - <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_106_14">Request_Name</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_86_13" HREF="terminal_interface-curses-menus__ads.htm#ref_109_14">Request_Name</A></FONT> (<FONT COLOR=red><A NAME="ref_86_27" HREF="terminal_interface-curses-menus__ads.htm#ref_109_28">Key</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_65_12">Menu_Request_Code</A>) <b>return</b> String -+ <b>function</b> <span class="symbol"><A NAME="ref_86_13" HREF="terminal_interface-curses-menus__ads.htm#ref_109_14">Request_Name</A></span> (<span class="symbol"><A NAME="ref_86_27" HREF="terminal_interface-curses-menus__ads.htm#ref_109_28">Key</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_65_12">Menu_Request_Code</A>) <b>return</b> String - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_88_16">Request_Name</A></FONT> (<FONT COLOR=red><A NAME="ref_88_30" HREF="terminal_interface-curses-menus__adb.htm#ref_88_16">Key</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-menus__adb.htm#ref_58_12">chars_ptr</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_88_16">Request_Name</A></span> (<span class="symbol"><A NAME="ref_88_30" HREF="terminal_interface-curses-menus__adb.htm#ref_88_16">Key</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-menus__adb.htm#ref_58_12">chars_ptr</A>; - <b>pragma</b> Import (C, Request_Name, "menu_request_name"); - <b>begin</b> - <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_121_13">Fill_String</A> (<A HREF="terminal_interface-curses-menus__adb.htm#ref_88_16">Request_Name</A> (<A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_109_28">Key</A>))); - <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_109_14">Request_Name</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_94_13" HREF="terminal_interface-curses-menus__ads.htm#ref_195_13">Create</A></FONT> (<FONT COLOR=red><A NAME="ref_94_21" HREF="terminal_interface-curses-menus__ads.htm#ref_195_21">Name</A></FONT> : String; -- <FONT COLOR=red><A NAME="ref_95_21" HREF="terminal_interface-curses-menus__ads.htm#ref_196_21">Description</A></FONT> : String := "") <b>return</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A> -+ <b>function</b> <span class="symbol"><A NAME="ref_94_13" HREF="terminal_interface-curses-menus__ads.htm#ref_193_13">Create</A></span> (<span class="symbol"><A NAME="ref_94_21" HREF="terminal_interface-curses-menus__ads.htm#ref_193_21">Name</A></span> : String; -+ <span class="symbol"><A NAME="ref_95_21" HREF="terminal_interface-curses-menus__ads.htm#ref_194_21">Description</A></span> : String := "") <b>return</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A> - <b>is</b> -- <b>type</b> <FONT COLOR=red><A NAME="ref_97_12">Char_Ptr</A></FONT> <b>is</b> <b>access</b> <b>all</b> <A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>.C.char; -- <b>function</b> <FONT COLOR=red><A NAME="ref_98_16">Newitem</A></FONT> (<FONT COLOR=red><A NAME="ref_98_25" HREF="terminal_interface-curses-menus__adb.htm#ref_98_16">Name</A></FONT>, <FONT COLOR=red><A NAME="ref_98_31" HREF="terminal_interface-curses-menus__adb.htm#ref_98_16">Desc</A></FONT> : <A HREF="terminal_interface-curses-menus__adb.htm#ref_97_12">Char_Ptr</A>) <b>return</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>; -+ <b>type</b> <span class="symbol"><A NAME="ref_97_12">Char_Ptr</A></span> <b>is</b> <b>access</b> <b>all</b> <A HREF="interfac__ads.htm#ref_36_9">Interfaces</A>.C.char; -+ <b>function</b> <span class="symbol"><A NAME="ref_98_16">Newitem</A></span> (<span class="symbol"><A NAME="ref_98_25" HREF="terminal_interface-curses-menus__adb.htm#ref_98_16">Name</A></span>, <span class="symbol"><A NAME="ref_98_31" HREF="terminal_interface-curses-menus__adb.htm#ref_98_16">Desc</A></span> : <A HREF="terminal_interface-curses-menus__adb.htm#ref_97_12">Char_Ptr</A>) <b>return</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>; - <b>pragma</b> Import (C, Newitem, "new_item"); - -- <b>type</b> Name_String <b>is</b> <b>new</b> char_array (0 .. <A HREF="terminal_interface-curses-menus__ads.htm#ref_195_21">Name</A>'Length); -- <b>type</b> <FONT COLOR=red><A NAME="ref_102_12">Name_String_Ptr</A></FONT> <b>is</b> <b>access</b> Name_String; -+ <b>type</b> Name_String <b>is</b> <b>new</b> char_array (0 .. <A HREF="terminal_interface-curses-menus__ads.htm#ref_193_21">Name</A>'Length); -+ <b>type</b> <span class="symbol"><A NAME="ref_102_12">Name_String_Ptr</A></span> <b>is</b> <b>access</b> Name_String; - <b>pragma</b> Controlled (<A HREF="terminal_interface-curses-menus__adb.htm#ref_102_12">Name_String_Ptr</A>); - -- <b>type</b> Desc_String <b>is</b> <b>new</b> char_array (0 .. <A HREF="terminal_interface-curses-menus__ads.htm#ref_196_21">Description</A>'Length); -- <b>type</b> <FONT COLOR=red><A NAME="ref_106_12">Desc_String_Ptr</A></FONT> <b>is</b> <b>access</b> Desc_String; -+ <b>type</b> Desc_String <b>is</b> <b>new</b> char_array (0 .. <A HREF="terminal_interface-curses-menus__ads.htm#ref_194_21">Description</A>'Length); -+ <b>type</b> <span class="symbol"><A NAME="ref_106_12">Desc_String_Ptr</A></span> <b>is</b> <b>access</b> Desc_String; - <b>pragma</b> Controlled (<A HREF="terminal_interface-curses-menus__adb.htm#ref_106_12">Desc_String_Ptr</A>); - -- <FONT COLOR=red><A NAME="ref_109_7">Name_Str</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-menus__adb.htm#ref_102_12">Name_String_Ptr</A> := <b>new</b> Name_String; -- <FONT COLOR=red><A NAME="ref_110_7">Desc_Str</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-menus__adb.htm#ref_106_12">Desc_String_Ptr</A> := <b>new</b> Desc_String; -- <FONT COLOR=red><A NAME="ref_111_7">Name_Len</A></FONT>, <FONT COLOR=red><A NAME="ref_111_17">Desc_Len</A></FONT> : size_t; -- <FONT COLOR=red><A NAME="ref_112_7">Result</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>; -+ <span class="symbol"><A NAME="ref_109_7">Name_Str</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-menus__adb.htm#ref_102_12">Name_String_Ptr</A> := <b>new</b> Name_String; -+ <span class="symbol"><A NAME="ref_110_7">Desc_Str</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-menus__adb.htm#ref_106_12">Desc_String_Ptr</A> := <b>new</b> Desc_String; -+ <span class="symbol"><A NAME="ref_111_7">Name_Len</A></span>, <span class="symbol"><A NAME="ref_111_17">Desc_Len</A></span> : size_t; -+ <span class="symbol"><A NAME="ref_112_7">Result</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>; - <b>begin</b> -- To_C (<A HREF="terminal_interface-curses-menus__ads.htm#ref_195_21">Name</A>, <A HREF="terminal_interface-curses-menus__adb.htm#ref_109_7">Name_Str</A>.<b>all</b>, <A HREF="terminal_interface-curses-menus__adb.htm#ref_111_7">Name_Len</A>); -- To_C (<A HREF="terminal_interface-curses-menus__ads.htm#ref_196_21">Description</A>, <A HREF="terminal_interface-curses-menus__adb.htm#ref_110_7">Desc_Str</A>.<b>all</b>, <A HREF="terminal_interface-curses-menus__adb.htm#ref_111_17">Desc_Len</A>); -+ To_C (<A HREF="terminal_interface-curses-menus__ads.htm#ref_193_21">Name</A>, <A HREF="terminal_interface-curses-menus__adb.htm#ref_109_7">Name_Str</A>.<b>all</b>, <A HREF="terminal_interface-curses-menus__adb.htm#ref_111_7">Name_Len</A>); -+ To_C (<A HREF="terminal_interface-curses-menus__ads.htm#ref_194_21">Description</A>, <A HREF="terminal_interface-curses-menus__adb.htm#ref_110_7">Desc_Str</A>.<b>all</b>, <A HREF="terminal_interface-curses-menus__adb.htm#ref_111_17">Desc_Len</A>); - <A HREF="terminal_interface-curses-menus__adb.htm#ref_112_7">Result</A> := <A HREF="terminal_interface-curses-menus__adb.htm#ref_98_16">Newitem</A> (<A HREF="terminal_interface-curses-menus__adb.htm#ref_109_7">Name_Str</A>.<b>all</b> (<A HREF="terminal_interface-curses-menus__adb.htm#ref_109_7">Name_Str</A>.<b>all</b>'First)'<b>Access</b>, - <A HREF="terminal_interface-curses-menus__adb.htm#ref_110_7">Desc_Str</A>.<b>all</b> (<A HREF="terminal_interface-curses-menus__adb.htm#ref_110_7">Desc_Str</A>.<b>all</b>'First)'<b>Access</b>); - <b>if</b> <A HREF="terminal_interface-curses-menus__adb.htm#ref_112_7">Result</A> = <A HREF="terminal_interface-curses-menus__ads.htm#ref_62_4">Null_Item</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_391_4">Eti_System_Error</A>; -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_390_4">Eti_System_Error</A>; - <b>end</b> <b>if</b>; - <b>return</b> <A HREF="terminal_interface-curses-menus__adb.htm#ref_112_7">Result</A>; -- <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_195_13">Create</A>; -+ <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_193_13">Create</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_124_14" HREF="terminal_interface-curses-menus__ads.htm#ref_207_14">Delete</A></FONT> (<FONT COLOR=red><A NAME="ref_124_22" HREF="terminal_interface-curses-menus__ads.htm#ref_207_22">Itm</A></FONT> : <b>in</b> <b>out</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_124_14" HREF="terminal_interface-curses-menus__ads.htm#ref_205_14">Delete</A></span> (<span class="symbol"><A NAME="ref_124_22" HREF="terminal_interface-curses-menus__ads.htm#ref_205_22">Itm</A></span> : <b>in</b> <b>out</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_126_16">Descname</A></FONT> (<FONT COLOR=red><A NAME="ref_126_26" HREF="terminal_interface-curses-menus__adb.htm#ref_126_16">Itm</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>) <b>return</b> <A HREF="terminal_interface-curses-menus__adb.htm#ref_58_12">chars_ptr</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_126_16">Descname</A></span> (<span class="symbol"><A NAME="ref_126_26" HREF="terminal_interface-curses-menus__adb.htm#ref_126_16">Itm</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>) <b>return</b> <A HREF="terminal_interface-curses-menus__adb.htm#ref_58_12">chars_ptr</A>; - <b>pragma</b> Import (C, Descname, "item_description"); -- <b>function</b> <FONT COLOR=red><A NAME="ref_128_16">Itemname</A></FONT> (<FONT COLOR=red><A NAME="ref_128_26" HREF="terminal_interface-curses-menus__adb.htm#ref_128_16">Itm</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>) <b>return</b> <A HREF="terminal_interface-curses-menus__adb.htm#ref_58_12">chars_ptr</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_128_16">Itemname</A></span> (<span class="symbol"><A NAME="ref_128_26" HREF="terminal_interface-curses-menus__adb.htm#ref_128_16">Itm</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>) <b>return</b> <A HREF="terminal_interface-curses-menus__adb.htm#ref_58_12">chars_ptr</A>; - <b>pragma</b> Import (C, Itemname, "item_name"); - -- <b>function</b> <FONT COLOR=red><A NAME="ref_131_16">Freeitem</A></FONT> (<FONT COLOR=red><A NAME="ref_131_26" HREF="terminal_interface-curses-menus__adb.htm#ref_131_16">Itm</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_131_16">Freeitem</A></span> (<span class="symbol"><A NAME="ref_131_26" HREF="terminal_interface-curses-menus__adb.htm#ref_131_16">Itm</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Freeitem, "free_item"); - -- <FONT COLOR=red><A NAME="ref_134_7">Res</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A>; -- <FONT COLOR=red><A NAME="ref_135_7">Ptr</A></FONT> : <A HREF="terminal_interface-curses-menus__adb.htm#ref_58_12">chars_ptr</A>; -+ <span class="symbol"><A NAME="ref_134_7">Res</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A>; -+ <span class="symbol"><A NAME="ref_135_7">Ptr</A></span> : <A HREF="terminal_interface-curses-menus__adb.htm#ref_58_12">chars_ptr</A>; - <b>begin</b> -- <A HREF="terminal_interface-curses-menus__adb.htm#ref_135_7">Ptr</A> := <A HREF="terminal_interface-curses-menus__adb.htm#ref_126_16">Descname</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_207_22">Itm</A>); -+ <A HREF="terminal_interface-curses-menus__adb.htm#ref_135_7">Ptr</A> := <A HREF="terminal_interface-curses-menus__adb.htm#ref_126_16">Descname</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_205_22">Itm</A>); - <b>if</b> <A HREF="terminal_interface-curses-menus__adb.htm#ref_135_7">Ptr</A> /= Null_Ptr <b>then</b> -- <A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>.C.Strings.Free (<A HREF="terminal_interface-curses-menus__adb.htm#ref_135_7">Ptr</A>); -+ <A HREF="interfac__ads.htm#ref_36_9">Interfaces</A>.C.Strings.Free (<A HREF="terminal_interface-curses-menus__adb.htm#ref_135_7">Ptr</A>); - <b>end</b> <b>if</b>; -- <A HREF="terminal_interface-curses-menus__adb.htm#ref_135_7">Ptr</A> := <A HREF="terminal_interface-curses-menus__adb.htm#ref_128_16">Itemname</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_207_22">Itm</A>); -+ <A HREF="terminal_interface-curses-menus__adb.htm#ref_135_7">Ptr</A> := <A HREF="terminal_interface-curses-menus__adb.htm#ref_128_16">Itemname</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_205_22">Itm</A>); - <b>if</b> <A HREF="terminal_interface-curses-menus__adb.htm#ref_135_7">Ptr</A> /= Null_Ptr <b>then</b> -- <A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>.C.Strings.Free (<A HREF="terminal_interface-curses-menus__adb.htm#ref_135_7">Ptr</A>); -+ <A HREF="interfac__ads.htm#ref_36_9">Interfaces</A>.C.Strings.Free (<A HREF="terminal_interface-curses-menus__adb.htm#ref_135_7">Ptr</A>); - <b>end</b> <b>if</b>; -- <A HREF="terminal_interface-curses-menus__adb.htm#ref_134_7">Res</A> := <A HREF="terminal_interface-curses-menus__adb.htm#ref_131_16">Freeitem</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_207_22">Itm</A>); -+ <A HREF="terminal_interface-curses-menus__adb.htm#ref_134_7">Res</A> := <A HREF="terminal_interface-curses-menus__adb.htm#ref_131_16">Freeitem</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_205_22">Itm</A>); - <b>if</b> <A HREF="terminal_interface-curses-menus__adb.htm#ref_134_7">Res</A> /= <A HREF="terminal_interface-curses-aux__ads.htm#ref_80_4">E_Ok</A> <b>then</b> - <A HREF="terminal_interface-curses-aux__ads.htm#ref_96_14">Eti_Exception</A> (<A HREF="terminal_interface-curses-menus__adb.htm#ref_134_7">Res</A>); - <b>end</b> <b>if</b>; -- <A HREF="terminal_interface-curses-menus__ads.htm#ref_207_22">Itm</A> := <A HREF="terminal_interface-curses-menus__ads.htm#ref_62_4">Null_Item</A>; -- <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_207_14">Delete</A>; --<FONT COLOR=green><EM>-------------------------------------------------------------------------------</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_152_14" HREF="terminal_interface-curses-menus__ads.htm#ref_216_14">Set_Value</A></FONT> (<FONT COLOR=red><A NAME="ref_152_25" HREF="terminal_interface-curses-menus__ads.htm#ref_216_25">Itm</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>; -- <FONT COLOR=red><A NAME="ref_153_25" HREF="terminal_interface-curses-menus__ads.htm#ref_217_25">Value</A></FONT> : Boolean := True) -+ <A HREF="terminal_interface-curses-menus__ads.htm#ref_205_22">Itm</A> := <A HREF="terminal_interface-curses-menus__ads.htm#ref_62_4">Null_Item</A>; -+ <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_205_14">Delete</A>; -+<span class="comment"><EM>-------------------------------------------------------------------------------</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_152_14" HREF="terminal_interface-curses-menus__ads.htm#ref_214_14">Set_Value</A></span> (<span class="symbol"><A NAME="ref_152_25" HREF="terminal_interface-curses-menus__ads.htm#ref_214_25">Itm</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>; -+ <span class="symbol"><A NAME="ref_153_25" HREF="terminal_interface-curses-menus__ads.htm#ref_215_25">Value</A></span> : Boolean := True) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_155_16">Set_Item_Val</A></FONT> (<FONT COLOR=red><A NAME="ref_155_30" HREF="terminal_interface-curses-menus__adb.htm#ref_155_16">Itm</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>; -- <FONT COLOR=red><A NAME="ref_156_30" HREF="terminal_interface-curses-menus__adb.htm#ref_155_16">Val</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_155_16">Set_Item_Val</A></span> (<span class="symbol"><A NAME="ref_155_30" HREF="terminal_interface-curses-menus__adb.htm#ref_155_16">Itm</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>; -+ <span class="symbol"><A NAME="ref_156_30" HREF="terminal_interface-curses-menus__adb.htm#ref_155_16">Val</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Set_Item_Val, "set_item_value"); - -- <FONT COLOR=red><A NAME="ref_159_7">Res</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := <A HREF="terminal_interface-curses-menus__adb.htm#ref_155_16">Set_Item_Val</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_216_25">Itm</A>, Boolean'Pos (<A HREF="terminal_interface-curses-menus__ads.htm#ref_217_25">Value</A>)); -+ <span class="symbol"><A NAME="ref_159_7">Res</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := <A HREF="terminal_interface-curses-menus__adb.htm#ref_155_16">Set_Item_Val</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_214_25">Itm</A>, Boolean'Pos (<A HREF="terminal_interface-curses-menus__ads.htm#ref_215_25">Value</A>)); - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses-menus__adb.htm#ref_159_7">Res</A> /= <A HREF="terminal_interface-curses-aux__ads.htm#ref_80_4">E_Ok</A> <b>then</b> - <A HREF="terminal_interface-curses-aux__ads.htm#ref_96_14">Eti_Exception</A> (<A HREF="terminal_interface-curses-menus__adb.htm#ref_159_7">Res</A>); - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_216_14">Set_Value</A>; -+ <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_214_14">Set_Value</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_166_13" HREF="terminal_interface-curses-menus__ads.htm#ref_222_13">Value</A></FONT> (<FONT COLOR=red><A NAME="ref_166_20" HREF="terminal_interface-curses-menus__ads.htm#ref_222_20">Itm</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>) <b>return</b> Boolean -+ <b>function</b> <span class="symbol"><A NAME="ref_166_13" HREF="terminal_interface-curses-menus__ads.htm#ref_220_13">Value</A></span> (<span class="symbol"><A NAME="ref_166_20" HREF="terminal_interface-curses-menus__ads.htm#ref_220_20">Itm</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>) <b>return</b> Boolean - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_168_16">Item_Val</A></FONT> (<FONT COLOR=red><A NAME="ref_168_26" HREF="terminal_interface-curses-menus__adb.htm#ref_168_16">Itm</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_168_16">Item_Val</A></span> (<span class="symbol"><A NAME="ref_168_26" HREF="terminal_interface-curses-menus__adb.htm#ref_168_16">Itm</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Item_Val, "item_value"); - <b>begin</b> -- <b>if</b> <A HREF="terminal_interface-curses-menus__adb.htm#ref_168_16">Item_Val</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_222_20">Itm</A>) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_75_4">Curses_False</A> <b>then</b> -+ <b>if</b> <A HREF="terminal_interface-curses-menus__adb.htm#ref_168_16">Item_Val</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_220_20">Itm</A>) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_75_4">Curses_False</A> <b>then</b> - <b>return</b> False; - <b>else</b> - <b>return</b> True; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_222_13">Value</A>; -+ <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_220_13">Value</A>; - --<FONT COLOR=green><EM>-------------------------------------------------------------------------------</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_179_13" HREF="terminal_interface-curses-menus__ads.htm#ref_231_13">Visible</A></FONT> (<FONT COLOR=red><A NAME="ref_179_22" HREF="terminal_interface-curses-menus__ads.htm#ref_231_22">Itm</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>) <b>return</b> Boolean -+<span class="comment"><EM>-------------------------------------------------------------------------------</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_179_13" HREF="terminal_interface-curses-menus__ads.htm#ref_229_13">Visible</A></span> (<span class="symbol"><A NAME="ref_179_22" HREF="terminal_interface-curses-menus__ads.htm#ref_229_22">Itm</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>) <b>return</b> Boolean - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_181_16">Item_Vis</A></FONT> (<FONT COLOR=red><A NAME="ref_181_26" HREF="terminal_interface-curses-menus__adb.htm#ref_181_16">Itm</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_181_16">Item_Vis</A></span> (<span class="symbol"><A NAME="ref_181_26" HREF="terminal_interface-curses-menus__adb.htm#ref_181_16">Itm</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Item_Vis, "item_visible"); - <b>begin</b> -- <b>if</b> <A HREF="terminal_interface-curses-menus__adb.htm#ref_181_16">Item_Vis</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_231_22">Itm</A>) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_75_4">Curses_False</A> <b>then</b> -+ <b>if</b> <A HREF="terminal_interface-curses-menus__adb.htm#ref_181_16">Item_Vis</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_229_22">Itm</A>) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_75_4">Curses_False</A> <b>then</b> - <b>return</b> False; - <b>else</b> - <b>return</b> True; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_231_13">Visible</A>; --<FONT COLOR=green><EM>-------------------------------------------------------------------------------</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_191_14" HREF="terminal_interface-curses-menus__ads.htm#ref_240_14">Set_Options</A></FONT> (<FONT COLOR=red><A NAME="ref_191_27" HREF="terminal_interface-curses-menus__ads.htm#ref_240_27">Itm</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>; -- <FONT COLOR=red><A NAME="ref_192_27" HREF="terminal_interface-curses-menus__ads.htm#ref_241_27">Options</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_155_9">Item_Option_Set</A>) -+ <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_229_13">Visible</A>; -+<span class="comment"><EM>-------------------------------------------------------------------------------</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_191_14" HREF="terminal_interface-curses-menus__ads.htm#ref_238_14">Set_Options</A></span> (<span class="symbol"><A NAME="ref_191_27" HREF="terminal_interface-curses-menus__ads.htm#ref_238_27">Itm</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>; -+ <span class="symbol"><A NAME="ref_192_27" HREF="terminal_interface-curses-menus__ads.htm#ref_239_27">Options</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_154_9">Item_Option_Set</A>) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_194_16">Set_Item_Opts</A></FONT> (<FONT COLOR=red><A NAME="ref_194_31" HREF="terminal_interface-curses-menus__adb.htm#ref_194_16">Itm</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>; -- <FONT COLOR=red><A NAME="ref_195_31" HREF="terminal_interface-curses-menus__adb.htm#ref_194_16">Opt</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_194_16">Set_Item_Opts</A></span> (<span class="symbol"><A NAME="ref_194_31" HREF="terminal_interface-curses-menus__adb.htm#ref_194_16">Itm</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>; -+ <span class="symbol"><A NAME="ref_195_31" HREF="terminal_interface-curses-menus__adb.htm#ref_194_16">Opt</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Set_Item_Opts, "set_item_opts"); - -- <FONT COLOR=red><A NAME="ref_198_7">Opt</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> := IOS_2_CInt (<A HREF="terminal_interface-curses-menus__ads.htm#ref_241_27">Options</A>); -- <FONT COLOR=red><A NAME="ref_199_7">Res</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A>; -+ <span class="symbol"><A NAME="ref_198_7">Opt</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> := IOS_2_CInt (<A HREF="terminal_interface-curses-menus__ads.htm#ref_239_27">Options</A>); -+ <span class="symbol"><A NAME="ref_199_7">Res</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A>; - <b>begin</b> -- <A HREF="terminal_interface-curses-menus__adb.htm#ref_199_7">Res</A> := <A HREF="terminal_interface-curses-menus__adb.htm#ref_194_16">Set_Item_Opts</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_240_27">Itm</A>, <A HREF="terminal_interface-curses-menus__adb.htm#ref_198_7">Opt</A>); -+ <A HREF="terminal_interface-curses-menus__adb.htm#ref_199_7">Res</A> := <A HREF="terminal_interface-curses-menus__adb.htm#ref_194_16">Set_Item_Opts</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_238_27">Itm</A>, <A HREF="terminal_interface-curses-menus__adb.htm#ref_198_7">Opt</A>); - <b>if</b> <A HREF="terminal_interface-curses-menus__adb.htm#ref_199_7">Res</A> /= <A HREF="terminal_interface-curses-aux__ads.htm#ref_80_4">E_Ok</A> <b>then</b> - <A HREF="terminal_interface-curses-aux__ads.htm#ref_96_14">Eti_Exception</A> (<A HREF="terminal_interface-curses-menus__adb.htm#ref_199_7">Res</A>); - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_240_14">Set_Options</A>; -+ <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_238_14">Set_Options</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_207_14" HREF="terminal_interface-curses-menus__ads.htm#ref_246_14">Switch_Options</A></FONT> (<FONT COLOR=red><A NAME="ref_207_30" HREF="terminal_interface-curses-menus__ads.htm#ref_246_30">Itm</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>; -- <FONT COLOR=red><A NAME="ref_208_30" HREF="terminal_interface-curses-menus__ads.htm#ref_247_30">Options</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_155_9">Item_Option_Set</A>; -- <FONT COLOR=red><A NAME="ref_209_30" HREF="terminal_interface-curses-menus__ads.htm#ref_248_30">On</A></FONT> : Boolean := True) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_207_14" HREF="terminal_interface-curses-menus__ads.htm#ref_244_14">Switch_Options</A></span> (<span class="symbol"><A NAME="ref_207_30" HREF="terminal_interface-curses-menus__ads.htm#ref_244_30">Itm</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>; -+ <span class="symbol"><A NAME="ref_208_30" HREF="terminal_interface-curses-menus__ads.htm#ref_245_30">Options</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_154_9">Item_Option_Set</A>; -+ <span class="symbol"><A NAME="ref_209_30" HREF="terminal_interface-curses-menus__ads.htm#ref_246_30">On</A></span> : Boolean := True) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_211_16">Item_Opts_On</A></FONT> (<FONT COLOR=red><A NAME="ref_211_30" HREF="terminal_interface-curses-menus__adb.htm#ref_211_16">Itm</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>; -- <FONT COLOR=red><A NAME="ref_212_30" HREF="terminal_interface-curses-menus__adb.htm#ref_211_16">Opt</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_211_16">Item_Opts_On</A></span> (<span class="symbol"><A NAME="ref_211_30" HREF="terminal_interface-curses-menus__adb.htm#ref_211_16">Itm</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>; -+ <span class="symbol"><A NAME="ref_212_30" HREF="terminal_interface-curses-menus__adb.htm#ref_211_16">Opt</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Item_Opts_On, "item_opts_on"); -- <b>function</b> <FONT COLOR=red><A NAME="ref_214_16">Item_Opts_Off</A></FONT> (<FONT COLOR=red><A NAME="ref_214_31" HREF="terminal_interface-curses-menus__adb.htm#ref_214_16">Itm</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>; -- <FONT COLOR=red><A NAME="ref_215_31" HREF="terminal_interface-curses-menus__adb.htm#ref_214_16">Opt</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_214_16">Item_Opts_Off</A></span> (<span class="symbol"><A NAME="ref_214_31" HREF="terminal_interface-curses-menus__adb.htm#ref_214_16">Itm</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>; -+ <span class="symbol"><A NAME="ref_215_31" HREF="terminal_interface-curses-menus__adb.htm#ref_214_16">Opt</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Item_Opts_Off, "item_opts_off"); - -- <FONT COLOR=red><A NAME="ref_218_7">Opt</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> := IOS_2_CInt (<A HREF="terminal_interface-curses-menus__ads.htm#ref_247_30">Options</A>); -- <FONT COLOR=red><A NAME="ref_219_7">Err</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A>; -+ <span class="symbol"><A NAME="ref_218_7">Opt</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> := IOS_2_CInt (<A HREF="terminal_interface-curses-menus__ads.htm#ref_245_30">Options</A>); -+ <span class="symbol"><A NAME="ref_219_7">Err</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A>; - <b>begin</b> -- <b>if</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_248_30">On</A> <b>then</b> -- <A HREF="terminal_interface-curses-menus__adb.htm#ref_219_7">Err</A> := <A HREF="terminal_interface-curses-menus__adb.htm#ref_211_16">Item_Opts_On</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_246_30">Itm</A>, <A HREF="terminal_interface-curses-menus__adb.htm#ref_218_7">Opt</A>); -+ <b>if</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_246_30">On</A> <b>then</b> -+ <A HREF="terminal_interface-curses-menus__adb.htm#ref_219_7">Err</A> := <A HREF="terminal_interface-curses-menus__adb.htm#ref_211_16">Item_Opts_On</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_244_30">Itm</A>, <A HREF="terminal_interface-curses-menus__adb.htm#ref_218_7">Opt</A>); - <b>else</b> -- <A HREF="terminal_interface-curses-menus__adb.htm#ref_219_7">Err</A> := <A HREF="terminal_interface-curses-menus__adb.htm#ref_214_16">Item_Opts_Off</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_246_30">Itm</A>, <A HREF="terminal_interface-curses-menus__adb.htm#ref_218_7">Opt</A>); -+ <A HREF="terminal_interface-curses-menus__adb.htm#ref_219_7">Err</A> := <A HREF="terminal_interface-curses-menus__adb.htm#ref_214_16">Item_Opts_Off</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_244_30">Itm</A>, <A HREF="terminal_interface-curses-menus__adb.htm#ref_218_7">Opt</A>); - <b>end</b> <b>if</b>; - <b>if</b> <A HREF="terminal_interface-curses-menus__adb.htm#ref_219_7">Err</A> /= <A HREF="terminal_interface-curses-aux__ads.htm#ref_80_4">E_Ok</A> <b>then</b> - <A HREF="terminal_interface-curses-aux__ads.htm#ref_96_14">Eti_Exception</A> (<A HREF="terminal_interface-curses-menus__adb.htm#ref_219_7">Err</A>); - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_246_14">Switch_Options</A>; -+ <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_244_14">Switch_Options</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_231_14" HREF="terminal_interface-curses-menus__ads.htm#ref_255_14">Get_Options</A></FONT> (<FONT COLOR=red><A NAME="ref_231_27" HREF="terminal_interface-curses-menus__ads.htm#ref_255_27">Itm</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>; -- <FONT COLOR=red><A NAME="ref_232_27" HREF="terminal_interface-curses-menus__ads.htm#ref_256_27">Options</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_155_9">Item_Option_Set</A>) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_231_14" HREF="terminal_interface-curses-menus__ads.htm#ref_253_14">Get_Options</A></span> (<span class="symbol"><A NAME="ref_231_27" HREF="terminal_interface-curses-menus__ads.htm#ref_253_27">Itm</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>; -+ <span class="symbol"><A NAME="ref_232_27" HREF="terminal_interface-curses-menus__ads.htm#ref_254_27">Options</A></span> : <b>out</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_154_9">Item_Option_Set</A>) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_234_16">Item_Opts</A></FONT> (<FONT COLOR=red><A NAME="ref_234_27" HREF="terminal_interface-curses-menus__adb.htm#ref_234_16">Itm</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_234_16">Item_Opts</A></span> (<span class="symbol"><A NAME="ref_234_27" HREF="terminal_interface-curses-menus__adb.htm#ref_234_16">Itm</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Item_Opts, "item_opts"); - -- <FONT COLOR=red><A NAME="ref_237_7">Res</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> := <A HREF="terminal_interface-curses-menus__adb.htm#ref_234_16">Item_Opts</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_255_27">Itm</A>); -+ <span class="symbol"><A NAME="ref_237_7">Res</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> := <A HREF="terminal_interface-curses-menus__adb.htm#ref_234_16">Item_Opts</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_253_27">Itm</A>); - <b>begin</b> -- <A HREF="terminal_interface-curses-menus__ads.htm#ref_256_27">Options</A> := CInt_2_IOS (<A HREF="terminal_interface-curses-menus__adb.htm#ref_237_7">Res</A>); -- <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_255_14">Get_Options</A>; -+ <A HREF="terminal_interface-curses-menus__ads.htm#ref_254_27">Options</A> := CInt_2_IOS (<A HREF="terminal_interface-curses-menus__adb.htm#ref_237_7">Res</A>); -+ <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_253_14">Get_Options</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_242_13" HREF="terminal_interface-curses-menus__ads.htm#ref_260_13">Get_Options</A></FONT> (<FONT COLOR=red><A NAME="ref_242_26" HREF="terminal_interface-curses-menus__ads.htm#ref_260_26">Itm</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A> := <A HREF="terminal_interface-curses-menus__ads.htm#ref_62_4">Null_Item</A>) <b>return</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_155_9">Item_Option_Set</A> -+ <b>function</b> <span class="symbol"><A NAME="ref_242_13" HREF="terminal_interface-curses-menus__ads.htm#ref_258_13">Get_Options</A></span> (<span class="symbol"><A NAME="ref_242_26" HREF="terminal_interface-curses-menus__ads.htm#ref_258_26">Itm</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A> := <A HREF="terminal_interface-curses-menus__ads.htm#ref_62_4">Null_Item</A>) <b>return</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_154_9">Item_Option_Set</A> - <b>is</b> -- <FONT COLOR=red><A NAME="ref_244_7">Ios</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_155_9">Item_Option_Set</A>; -+ <span class="symbol"><A NAME="ref_244_7">Ios</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_154_9">Item_Option_Set</A>; - <b>begin</b> -- <A HREF="terminal_interface-curses-menus__ads.htm#ref_255_14">Get_Options</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_260_26">Itm</A>, <A HREF="terminal_interface-curses-menus__adb.htm#ref_244_7">Ios</A>); -+ <A HREF="terminal_interface-curses-menus__ads.htm#ref_253_14">Get_Options</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_258_26">Itm</A>, <A HREF="terminal_interface-curses-menus__adb.htm#ref_244_7">Ios</A>); - <b>return</b> <A HREF="terminal_interface-curses-menus__adb.htm#ref_244_7">Ios</A>; -- <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_260_13">Get_Options</A>; --<FONT COLOR=green><EM>-------------------------------------------------------------------------------</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_250_14" HREF="terminal_interface-curses-menus__ads.htm#ref_269_14">Name</A></FONT> (<FONT COLOR=red><A NAME="ref_250_20" HREF="terminal_interface-curses-menus__ads.htm#ref_269_20">Itm</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>; -- <FONT COLOR=red><A NAME="ref_251_20" HREF="terminal_interface-curses-menus__ads.htm#ref_270_20">Name</A></FONT> : <b>out</b> String) -+ <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_258_13">Get_Options</A>; -+<span class="comment"><EM>-------------------------------------------------------------------------------</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_250_14" HREF="terminal_interface-curses-menus__ads.htm#ref_267_14">Name</A></span> (<span class="symbol"><A NAME="ref_250_20" HREF="terminal_interface-curses-menus__ads.htm#ref_267_20">Itm</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>; -+ <span class="symbol"><A NAME="ref_251_20" HREF="terminal_interface-curses-menus__ads.htm#ref_268_20">Name</A></span> : <b>out</b> String) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_253_16">Itemname</A></FONT> (<FONT COLOR=red><A NAME="ref_253_26" HREF="terminal_interface-curses-menus__adb.htm#ref_253_16">Itm</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>) <b>return</b> <A HREF="terminal_interface-curses-menus__adb.htm#ref_58_12">chars_ptr</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_253_16">Itemname</A></span> (<span class="symbol"><A NAME="ref_253_26" HREF="terminal_interface-curses-menus__adb.htm#ref_253_16">Itm</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>) <b>return</b> <A HREF="terminal_interface-curses-menus__adb.htm#ref_58_12">chars_ptr</A>; - <b>pragma</b> Import (C, Itemname, "item_name"); - <b>begin</b> -- <A HREF="terminal_interface-curses-aux__ads.htm#ref_116_14">Fill_String</A> (<A HREF="terminal_interface-curses-menus__adb.htm#ref_253_16">Itemname</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_269_20">Itm</A>), <A HREF="terminal_interface-curses-menus__ads.htm#ref_270_20">Name</A>); -- <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_269_14">Name</A>; -+ <A HREF="terminal_interface-curses-aux__ads.htm#ref_116_14">Fill_String</A> (<A HREF="terminal_interface-curses-menus__adb.htm#ref_253_16">Itemname</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_267_20">Itm</A>), <A HREF="terminal_interface-curses-menus__ads.htm#ref_268_20">Name</A>); -+ <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_267_14">Name</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_259_13" HREF="terminal_interface-curses-menus__ads.htm#ref_272_14">Name</A></FONT> (<FONT COLOR=red><A NAME="ref_259_19" HREF="terminal_interface-curses-menus__ads.htm#ref_272_20">Itm</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>) <b>return</b> String -+ <b>function</b> <span class="symbol"><A NAME="ref_259_13" HREF="terminal_interface-curses-menus__ads.htm#ref_270_14">Name</A></span> (<span class="symbol"><A NAME="ref_259_19" HREF="terminal_interface-curses-menus__ads.htm#ref_270_20">Itm</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>) <b>return</b> String - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_261_16">Itemname</A></FONT> (<FONT COLOR=red><A NAME="ref_261_26" HREF="terminal_interface-curses-menus__adb.htm#ref_261_16">Itm</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>) <b>return</b> <A HREF="terminal_interface-curses-menus__adb.htm#ref_58_12">chars_ptr</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_261_16">Itemname</A></span> (<span class="symbol"><A NAME="ref_261_26" HREF="terminal_interface-curses-menus__adb.htm#ref_261_16">Itm</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>) <b>return</b> <A HREF="terminal_interface-curses-menus__adb.htm#ref_58_12">chars_ptr</A>; - <b>pragma</b> Import (C, Itemname, "item_name"); - <b>begin</b> -- <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_121_13">Fill_String</A> (<A HREF="terminal_interface-curses-menus__adb.htm#ref_261_16">Itemname</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_272_20">Itm</A>)); -- <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_272_14">Name</A>; -+ <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_121_13">Fill_String</A> (<A HREF="terminal_interface-curses-menus__adb.htm#ref_261_16">Itemname</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_270_20">Itm</A>)); -+ <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_270_14">Name</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_267_14" HREF="terminal_interface-curses-menus__ads.htm#ref_278_14">Description</A></FONT> (<FONT COLOR=red><A NAME="ref_267_27" HREF="terminal_interface-curses-menus__ads.htm#ref_278_27">Itm</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>; -- <FONT COLOR=red><A NAME="ref_268_27" HREF="terminal_interface-curses-menus__ads.htm#ref_279_27">Description</A></FONT> : <b>out</b> String) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_267_14" HREF="terminal_interface-curses-menus__ads.htm#ref_276_14">Description</A></span> (<span class="symbol"><A NAME="ref_267_27" HREF="terminal_interface-curses-menus__ads.htm#ref_276_27">Itm</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>; -+ <span class="symbol"><A NAME="ref_268_27" HREF="terminal_interface-curses-menus__ads.htm#ref_277_27">Description</A></span> : <b>out</b> String) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_270_16">Descname</A></FONT> (<FONT COLOR=red><A NAME="ref_270_26" HREF="terminal_interface-curses-menus__adb.htm#ref_270_16">Itm</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>) <b>return</b> <A HREF="terminal_interface-curses-menus__adb.htm#ref_58_12">chars_ptr</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_270_16">Descname</A></span> (<span class="symbol"><A NAME="ref_270_26" HREF="terminal_interface-curses-menus__adb.htm#ref_270_16">Itm</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>) <b>return</b> <A HREF="terminal_interface-curses-menus__adb.htm#ref_58_12">chars_ptr</A>; - <b>pragma</b> Import (C, Descname, "item_description"); - <b>begin</b> -- <A HREF="terminal_interface-curses-aux__ads.htm#ref_116_14">Fill_String</A> (<A HREF="terminal_interface-curses-menus__adb.htm#ref_270_16">Descname</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_278_27">Itm</A>), <A HREF="terminal_interface-curses-menus__ads.htm#ref_279_27">Description</A>); -- <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_278_14">Description</A>; -+ <A HREF="terminal_interface-curses-aux__ads.htm#ref_116_14">Fill_String</A> (<A HREF="terminal_interface-curses-menus__adb.htm#ref_270_16">Descname</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_276_27">Itm</A>), <A HREF="terminal_interface-curses-menus__ads.htm#ref_277_27">Description</A>); -+ <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_276_14">Description</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_276_13" HREF="terminal_interface-curses-menus__ads.htm#ref_282_14">Description</A></FONT> (<FONT COLOR=red><A NAME="ref_276_26" HREF="terminal_interface-curses-menus__ads.htm#ref_282_27">Itm</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>) <b>return</b> String -+ <b>function</b> <span class="symbol"><A NAME="ref_276_13" HREF="terminal_interface-curses-menus__ads.htm#ref_280_14">Description</A></span> (<span class="symbol"><A NAME="ref_276_26" HREF="terminal_interface-curses-menus__ads.htm#ref_280_27">Itm</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>) <b>return</b> String - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_278_16">Descname</A></FONT> (<FONT COLOR=red><A NAME="ref_278_26" HREF="terminal_interface-curses-menus__adb.htm#ref_278_16">Itm</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>) <b>return</b> <A HREF="terminal_interface-curses-menus__adb.htm#ref_58_12">chars_ptr</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_278_16">Descname</A></span> (<span class="symbol"><A NAME="ref_278_26" HREF="terminal_interface-curses-menus__adb.htm#ref_278_16">Itm</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>) <b>return</b> <A HREF="terminal_interface-curses-menus__adb.htm#ref_58_12">chars_ptr</A>; - <b>pragma</b> Import (C, Descname, "item_description"); - <b>begin</b> -- <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_121_13">Fill_String</A> (<A HREF="terminal_interface-curses-menus__adb.htm#ref_278_16">Descname</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_282_27">Itm</A>)); -- <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_282_14">Description</A>; --<FONT COLOR=green><EM>-------------------------------------------------------------------------------</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_284_14" HREF="terminal_interface-curses-menus__ads.htm#ref_292_14">Set_Current</A></FONT> (<FONT COLOR=red><A NAME="ref_284_27" HREF="terminal_interface-curses-menus__ads.htm#ref_292_27">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_285_27" HREF="terminal_interface-curses-menus__ads.htm#ref_293_27">Itm</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>) -+ <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_121_13">Fill_String</A> (<A HREF="terminal_interface-curses-menus__adb.htm#ref_278_16">Descname</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_280_27">Itm</A>)); -+ <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_280_14">Description</A>; -+<span class="comment"><EM>-------------------------------------------------------------------------------</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_284_14" HREF="terminal_interface-curses-menus__ads.htm#ref_290_14">Set_Current</A></span> (<span class="symbol"><A NAME="ref_284_27" HREF="terminal_interface-curses-menus__ads.htm#ref_290_27">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_285_27" HREF="terminal_interface-curses-menus__ads.htm#ref_291_27">Itm</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_287_16">Set_Curr_Item</A></FONT> (<FONT COLOR=red><A NAME="ref_287_31" HREF="terminal_interface-curses-menus__adb.htm#ref_287_16">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_288_31" HREF="terminal_interface-curses-menus__adb.htm#ref_287_16">Itm</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_287_16">Set_Curr_Item</A></span> (<span class="symbol"><A NAME="ref_287_31" HREF="terminal_interface-curses-menus__adb.htm#ref_287_16">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_288_31" HREF="terminal_interface-curses-menus__adb.htm#ref_287_16">Itm</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Set_Curr_Item, "set_current_item"); - -- <FONT COLOR=red><A NAME="ref_291_7">Res</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := <A HREF="terminal_interface-curses-menus__adb.htm#ref_287_16">Set_Curr_Item</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_292_27">Men</A>, <A HREF="terminal_interface-curses-menus__ads.htm#ref_293_27">Itm</A>); -+ <span class="symbol"><A NAME="ref_291_7">Res</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := <A HREF="terminal_interface-curses-menus__adb.htm#ref_287_16">Set_Curr_Item</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_290_27">Men</A>, <A HREF="terminal_interface-curses-menus__ads.htm#ref_291_27">Itm</A>); - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses-menus__adb.htm#ref_291_7">Res</A> /= <A HREF="terminal_interface-curses-aux__ads.htm#ref_80_4">E_Ok</A> <b>then</b> - <A HREF="terminal_interface-curses-aux__ads.htm#ref_96_14">Eti_Exception</A> (<A HREF="terminal_interface-curses-menus__adb.htm#ref_291_7">Res</A>); - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_292_14">Set_Current</A>; -+ <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_290_14">Set_Current</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_298_13" HREF="terminal_interface-curses-menus__ads.htm#ref_298_13">Current</A></FONT> (<FONT COLOR=red><A NAME="ref_298_22" HREF="terminal_interface-curses-menus__ads.htm#ref_298_22">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A> -+ <b>function</b> <span class="symbol"><A NAME="ref_298_13" HREF="terminal_interface-curses-menus__ads.htm#ref_296_13">Current</A></span> (<span class="symbol"><A NAME="ref_298_22" HREF="terminal_interface-curses-menus__ads.htm#ref_296_22">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A> - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_300_16">Curr_Item</A></FONT> (<FONT COLOR=red><A NAME="ref_300_27" HREF="terminal_interface-curses-menus__adb.htm#ref_300_16">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_300_16">Curr_Item</A></span> (<span class="symbol"><A NAME="ref_300_27" HREF="terminal_interface-curses-menus__adb.htm#ref_300_16">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>; - <b>pragma</b> Import (C, Curr_Item, "current_item"); - -- <FONT COLOR=red><A NAME="ref_303_7">Res</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A> := <A HREF="terminal_interface-curses-menus__adb.htm#ref_300_16">Curr_Item</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_298_22">Men</A>); -+ <span class="symbol"><A NAME="ref_303_7">Res</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A> := <A HREF="terminal_interface-curses-menus__adb.htm#ref_300_16">Curr_Item</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_296_22">Men</A>); - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses-menus__adb.htm#ref_303_7">Res</A> = <A HREF="terminal_interface-curses-menus__ads.htm#ref_62_4">Null_Item</A> <b>then</b> - <b>raise</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_116_4">Menu_Exception</A>; - <b>end</b> <b>if</b>; - <b>return</b> <A HREF="terminal_interface-curses-menus__adb.htm#ref_303_7">Res</A>; -- <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_298_13">Current</A>; -+ <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_296_13">Current</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_311_14" HREF="terminal_interface-curses-menus__ads.htm#ref_303_14">Set_Top_Row</A></FONT> (<FONT COLOR=red><A NAME="ref_311_27" HREF="terminal_interface-curses-menus__ads.htm#ref_303_27">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_312_27" HREF="terminal_interface-curses-menus__ads.htm#ref_304_27">Line</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_311_14" HREF="terminal_interface-curses-menus__ads.htm#ref_301_14">Set_Top_Row</A></span> (<span class="symbol"><A NAME="ref_311_27" HREF="terminal_interface-curses-menus__ads.htm#ref_301_27">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_312_27" HREF="terminal_interface-curses-menus__ads.htm#ref_302_27">Line</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_314_16">Set_Toprow</A></FONT> (<FONT COLOR=red><A NAME="ref_314_28" HREF="terminal_interface-curses-menus__adb.htm#ref_314_16">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_315_28" HREF="terminal_interface-curses-menus__adb.htm#ref_314_16">Line</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_314_16">Set_Toprow</A></span> (<span class="symbol"><A NAME="ref_314_28" HREF="terminal_interface-curses-menus__adb.htm#ref_314_16">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_315_28" HREF="terminal_interface-curses-menus__adb.htm#ref_314_16">Line</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Set_Toprow, "set_top_row"); - -- <FONT COLOR=red><A NAME="ref_318_7">Res</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := <A HREF="terminal_interface-curses-menus__adb.htm#ref_314_16">Set_Toprow</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_303_27">Men</A>, <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_304_27">Line</A>)); -+ <span class="symbol"><A NAME="ref_318_7">Res</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := <A HREF="terminal_interface-curses-menus__adb.htm#ref_314_16">Set_Toprow</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_301_27">Men</A>, <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_302_27">Line</A>)); - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses-menus__adb.htm#ref_318_7">Res</A> /= <A HREF="terminal_interface-curses-aux__ads.htm#ref_80_4">E_Ok</A> <b>then</b> - <A HREF="terminal_interface-curses-aux__ads.htm#ref_96_14">Eti_Exception</A> (<A HREF="terminal_interface-curses-menus__adb.htm#ref_318_7">Res</A>); - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_303_14">Set_Top_Row</A>; -+ <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_301_14">Set_Top_Row</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_325_13" HREF="terminal_interface-curses-menus__ads.htm#ref_309_13">Top_Row</A></FONT> (<FONT COLOR=red><A NAME="ref_325_22" HREF="terminal_interface-curses-menus__ads.htm#ref_309_22">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A> -+ <b>function</b> <span class="symbol"><A NAME="ref_325_13" HREF="terminal_interface-curses-menus__ads.htm#ref_307_13">Top_Row</A></span> (<span class="symbol"><A NAME="ref_325_22" HREF="terminal_interface-curses-menus__ads.htm#ref_307_22">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A> - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_327_16">Toprow</A></FONT> (<FONT COLOR=red><A NAME="ref_327_24" HREF="terminal_interface-curses-menus__adb.htm#ref_327_16">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_327_16">Toprow</A></span> (<span class="symbol"><A NAME="ref_327_24" HREF="terminal_interface-curses-menus__adb.htm#ref_327_16">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Toprow, "top_row"); - -- <FONT COLOR=red><A NAME="ref_330_7">Res</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> := <A HREF="terminal_interface-curses-menus__adb.htm#ref_327_16">Toprow</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_309_22">Men</A>); -+ <span class="symbol"><A NAME="ref_330_7">Res</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> := <A HREF="terminal_interface-curses-menus__adb.htm#ref_327_16">Toprow</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_307_22">Men</A>); - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses-menus__adb.htm#ref_330_7">Res</A> = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> - <b>raise</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_116_4">Menu_Exception</A>; - <b>end</b> <b>if</b>; - <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A> (<A HREF="terminal_interface-curses-menus__adb.htm#ref_330_7">Res</A>); -- <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_309_13">Top_Row</A>; -+ <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_307_13">Top_Row</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_338_13" HREF="terminal_interface-curses-menus__ads.htm#ref_314_13">Get_Index</A></FONT> (<FONT COLOR=red><A NAME="ref_338_24" HREF="terminal_interface-curses-menus__ads.htm#ref_314_24">Itm</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>) <b>return</b> Positive -+ <b>function</b> <span class="symbol"><A NAME="ref_338_13" HREF="terminal_interface-curses-menus__ads.htm#ref_312_13">Get_Index</A></span> (<span class="symbol"><A NAME="ref_338_24" HREF="terminal_interface-curses-menus__ads.htm#ref_312_24">Itm</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>) <b>return</b> Positive - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_340_16">Get_Itemindex</A></FONT> (<FONT COLOR=red><A NAME="ref_340_31" HREF="terminal_interface-curses-menus__adb.htm#ref_340_16">Itm</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_340_16">Get_Itemindex</A></span> (<span class="symbol"><A NAME="ref_340_31" HREF="terminal_interface-curses-menus__adb.htm#ref_340_16">Itm</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Get_Itemindex, "item_index"); - -- <FONT COLOR=red><A NAME="ref_343_7">Res</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> := <A HREF="terminal_interface-curses-menus__adb.htm#ref_340_16">Get_Itemindex</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_314_24">Itm</A>); -+ <span class="symbol"><A NAME="ref_343_7">Res</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> := <A HREF="terminal_interface-curses-menus__adb.htm#ref_340_16">Get_Itemindex</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_312_24">Itm</A>); - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses-menus__adb.htm#ref_343_7">Res</A> = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> - <b>raise</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_116_4">Menu_Exception</A>; - <b>end</b> <b>if</b>; - <b>return</b> Positive (Natural (<A HREF="terminal_interface-curses-menus__adb.htm#ref_343_7">Res</A>) + Positive'First); -- <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_314_13">Get_Index</A>; --<FONT COLOR=green><EM>-------------------------------------------------------------------------------</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_351_14" HREF="terminal_interface-curses-menus__ads.htm#ref_326_14">Post</A></FONT> (<FONT COLOR=red><A NAME="ref_351_20" HREF="terminal_interface-curses-menus__ads.htm#ref_326_20">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_352_20" HREF="terminal_interface-curses-menus__ads.htm#ref_327_20">Post</A></FONT> : Boolean := True) -+ <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_312_13">Get_Index</A>; -+<span class="comment"><EM>-------------------------------------------------------------------------------</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_351_14" HREF="terminal_interface-curses-menus__ads.htm#ref_324_14">Post</A></span> (<span class="symbol"><A NAME="ref_351_20" HREF="terminal_interface-curses-menus__ads.htm#ref_324_20">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_352_20" HREF="terminal_interface-curses-menus__ads.htm#ref_325_20">Post</A></span> : Boolean := True) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_354_16">M_Post</A></FONT> (<FONT COLOR=red><A NAME="ref_354_24" HREF="terminal_interface-curses-menus__adb.htm#ref_354_16">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_354_16">M_Post</A></span> (<span class="symbol"><A NAME="ref_354_24" HREF="terminal_interface-curses-menus__adb.htm#ref_354_16">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, M_Post, "post_menu"); -- <b>function</b> <FONT COLOR=red><A NAME="ref_356_16">M_Unpost</A></FONT> (<FONT COLOR=red><A NAME="ref_356_26" HREF="terminal_interface-curses-menus__adb.htm#ref_356_16">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_356_16">M_Unpost</A></span> (<span class="symbol"><A NAME="ref_356_26" HREF="terminal_interface-curses-menus__adb.htm#ref_356_16">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, M_Unpost, "unpost_menu"); - -- <FONT COLOR=red><A NAME="ref_359_7">Res</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A>; -+ <span class="symbol"><A NAME="ref_359_7">Res</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A>; - <b>begin</b> -- <b>if</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_327_20">Post</A> <b>then</b> -- <A HREF="terminal_interface-curses-menus__adb.htm#ref_359_7">Res</A> := <A HREF="terminal_interface-curses-menus__adb.htm#ref_354_16">M_Post</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_326_20">Men</A>); -+ <b>if</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_325_20">Post</A> <b>then</b> -+ <A HREF="terminal_interface-curses-menus__adb.htm#ref_359_7">Res</A> := <A HREF="terminal_interface-curses-menus__adb.htm#ref_354_16">M_Post</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_324_20">Men</A>); - <b>else</b> -- <A HREF="terminal_interface-curses-menus__adb.htm#ref_359_7">Res</A> := <A HREF="terminal_interface-curses-menus__adb.htm#ref_356_16">M_Unpost</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_326_20">Men</A>); -+ <A HREF="terminal_interface-curses-menus__adb.htm#ref_359_7">Res</A> := <A HREF="terminal_interface-curses-menus__adb.htm#ref_356_16">M_Unpost</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_324_20">Men</A>); - <b>end</b> <b>if</b>; - <b>if</b> <A HREF="terminal_interface-curses-menus__adb.htm#ref_359_7">Res</A> /= <A HREF="terminal_interface-curses-aux__ads.htm#ref_80_4">E_Ok</A> <b>then</b> - <A HREF="terminal_interface-curses-aux__ads.htm#ref_96_14">Eti_Exception</A> (<A HREF="terminal_interface-curses-menus__adb.htm#ref_359_7">Res</A>); - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_326_14">Post</A>; --<FONT COLOR=green><EM>-------------------------------------------------------------------------------</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_371_14" HREF="terminal_interface-curses-menus__ads.htm#ref_337_14">Set_Options</A></FONT> (<FONT COLOR=red><A NAME="ref_371_27" HREF="terminal_interface-curses-menus__ads.htm#ref_337_27">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_372_27" HREF="terminal_interface-curses-menus__ads.htm#ref_338_27">Options</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_121_9">Menu_Option_Set</A>) -+ <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_324_14">Post</A>; -+<span class="comment"><EM>-------------------------------------------------------------------------------</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_371_14" HREF="terminal_interface-curses-menus__ads.htm#ref_335_14">Set_Options</A></span> (<span class="symbol"><A NAME="ref_371_27" HREF="terminal_interface-curses-menus__ads.htm#ref_335_27">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_372_27" HREF="terminal_interface-curses-menus__ads.htm#ref_336_27">Options</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_121_9">Menu_Option_Set</A>) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_374_16">Set_Menu_Opts</A></FONT> (<FONT COLOR=red><A NAME="ref_374_31" HREF="terminal_interface-curses-menus__adb.htm#ref_374_16">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_375_31" HREF="terminal_interface-curses-menus__adb.htm#ref_374_16">Opt</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_374_16">Set_Menu_Opts</A></span> (<span class="symbol"><A NAME="ref_374_31" HREF="terminal_interface-curses-menus__adb.htm#ref_374_16">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_375_31" HREF="terminal_interface-curses-menus__adb.htm#ref_374_16">Opt</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Set_Menu_Opts, "set_menu_opts"); - -- <FONT COLOR=red><A NAME="ref_378_7">Opt</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> := MOS_2_CInt (<A HREF="terminal_interface-curses-menus__ads.htm#ref_338_27">Options</A>); -- <FONT COLOR=red><A NAME="ref_379_7">Res</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A>; -+ <span class="symbol"><A NAME="ref_378_7">Opt</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> := MOS_2_CInt (<A HREF="terminal_interface-curses-menus__ads.htm#ref_336_27">Options</A>); -+ <span class="symbol"><A NAME="ref_379_7">Res</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A>; - <b>begin</b> -- <A HREF="terminal_interface-curses-menus__adb.htm#ref_379_7">Res</A> := <A HREF="terminal_interface-curses-menus__adb.htm#ref_374_16">Set_Menu_Opts</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_337_27">Men</A>, <A HREF="terminal_interface-curses-menus__adb.htm#ref_378_7">Opt</A>); -+ <A HREF="terminal_interface-curses-menus__adb.htm#ref_379_7">Res</A> := <A HREF="terminal_interface-curses-menus__adb.htm#ref_374_16">Set_Menu_Opts</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_335_27">Men</A>, <A HREF="terminal_interface-curses-menus__adb.htm#ref_378_7">Opt</A>); - <b>if</b> <A HREF="terminal_interface-curses-menus__adb.htm#ref_379_7">Res</A> /= <A HREF="terminal_interface-curses-aux__ads.htm#ref_80_4">E_Ok</A> <b>then</b> - <A HREF="terminal_interface-curses-aux__ads.htm#ref_96_14">Eti_Exception</A> (<A HREF="terminal_interface-curses-menus__adb.htm#ref_379_7">Res</A>); - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_337_14">Set_Options</A>; -+ <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_335_14">Set_Options</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_387_14" HREF="terminal_interface-curses-menus__ads.htm#ref_343_14">Switch_Options</A></FONT> (<FONT COLOR=red><A NAME="ref_387_30" HREF="terminal_interface-curses-menus__ads.htm#ref_343_30">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_388_30" HREF="terminal_interface-curses-menus__ads.htm#ref_344_30">Options</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_121_9">Menu_Option_Set</A>; -- <FONT COLOR=red><A NAME="ref_389_30" HREF="terminal_interface-curses-menus__ads.htm#ref_345_30">On</A></FONT> : Boolean := True) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_387_14" HREF="terminal_interface-curses-menus__ads.htm#ref_341_14">Switch_Options</A></span> (<span class="symbol"><A NAME="ref_387_30" HREF="terminal_interface-curses-menus__ads.htm#ref_341_30">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_388_30" HREF="terminal_interface-curses-menus__ads.htm#ref_342_30">Options</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_121_9">Menu_Option_Set</A>; -+ <span class="symbol"><A NAME="ref_389_30" HREF="terminal_interface-curses-menus__ads.htm#ref_343_30">On</A></span> : Boolean := True) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_391_16">Menu_Opts_On</A></FONT> (<FONT COLOR=red><A NAME="ref_391_30" HREF="terminal_interface-curses-menus__adb.htm#ref_391_16">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_392_30" HREF="terminal_interface-curses-menus__adb.htm#ref_391_16">Opt</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_391_16">Menu_Opts_On</A></span> (<span class="symbol"><A NAME="ref_391_30" HREF="terminal_interface-curses-menus__adb.htm#ref_391_16">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_392_30" HREF="terminal_interface-curses-menus__adb.htm#ref_391_16">Opt</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Menu_Opts_On, "menu_opts_on"); -- <b>function</b> <FONT COLOR=red><A NAME="ref_394_16">Menu_Opts_Off</A></FONT> (<FONT COLOR=red><A NAME="ref_394_31" HREF="terminal_interface-curses-menus__adb.htm#ref_394_16">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_395_31" HREF="terminal_interface-curses-menus__adb.htm#ref_394_16">Opt</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_394_16">Menu_Opts_Off</A></span> (<span class="symbol"><A NAME="ref_394_31" HREF="terminal_interface-curses-menus__adb.htm#ref_394_16">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_395_31" HREF="terminal_interface-curses-menus__adb.htm#ref_394_16">Opt</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Menu_Opts_Off, "menu_opts_off"); - -- <FONT COLOR=red><A NAME="ref_398_7">Opt</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> := MOS_2_CInt (<A HREF="terminal_interface-curses-menus__ads.htm#ref_344_30">Options</A>); -- <FONT COLOR=red><A NAME="ref_399_7">Err</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A>; -+ <span class="symbol"><A NAME="ref_398_7">Opt</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> := MOS_2_CInt (<A HREF="terminal_interface-curses-menus__ads.htm#ref_342_30">Options</A>); -+ <span class="symbol"><A NAME="ref_399_7">Err</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A>; - <b>begin</b> -- <b>if</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_345_30">On</A> <b>then</b> -- <A HREF="terminal_interface-curses-menus__adb.htm#ref_399_7">Err</A> := <A HREF="terminal_interface-curses-menus__adb.htm#ref_391_16">Menu_Opts_On</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_343_30">Men</A>, <A HREF="terminal_interface-curses-menus__adb.htm#ref_398_7">Opt</A>); -+ <b>if</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_343_30">On</A> <b>then</b> -+ <A HREF="terminal_interface-curses-menus__adb.htm#ref_399_7">Err</A> := <A HREF="terminal_interface-curses-menus__adb.htm#ref_391_16">Menu_Opts_On</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_341_30">Men</A>, <A HREF="terminal_interface-curses-menus__adb.htm#ref_398_7">Opt</A>); - <b>else</b> -- <A HREF="terminal_interface-curses-menus__adb.htm#ref_399_7">Err</A> := <A HREF="terminal_interface-curses-menus__adb.htm#ref_394_16">Menu_Opts_Off</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_343_30">Men</A>, <A HREF="terminal_interface-curses-menus__adb.htm#ref_398_7">Opt</A>); -+ <A HREF="terminal_interface-curses-menus__adb.htm#ref_399_7">Err</A> := <A HREF="terminal_interface-curses-menus__adb.htm#ref_394_16">Menu_Opts_Off</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_341_30">Men</A>, <A HREF="terminal_interface-curses-menus__adb.htm#ref_398_7">Opt</A>); - <b>end</b> <b>if</b>; - <b>if</b> <A HREF="terminal_interface-curses-menus__adb.htm#ref_399_7">Err</A> /= <A HREF="terminal_interface-curses-aux__ads.htm#ref_80_4">E_Ok</A> <b>then</b> - <A HREF="terminal_interface-curses-aux__ads.htm#ref_96_14">Eti_Exception</A> (<A HREF="terminal_interface-curses-menus__adb.htm#ref_399_7">Err</A>); - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_343_14">Switch_Options</A>; -+ <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_341_14">Switch_Options</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_411_14" HREF="terminal_interface-curses-menus__ads.htm#ref_351_14">Get_Options</A></FONT> (<FONT COLOR=red><A NAME="ref_411_27" HREF="terminal_interface-curses-menus__ads.htm#ref_351_27">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_412_27" HREF="terminal_interface-curses-menus__ads.htm#ref_352_27">Options</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_121_9">Menu_Option_Set</A>) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_411_14" HREF="terminal_interface-curses-menus__ads.htm#ref_349_14">Get_Options</A></span> (<span class="symbol"><A NAME="ref_411_27" HREF="terminal_interface-curses-menus__ads.htm#ref_349_27">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_412_27" HREF="terminal_interface-curses-menus__ads.htm#ref_350_27">Options</A></span> : <b>out</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_121_9">Menu_Option_Set</A>) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_414_16">Menu_Opts</A></FONT> (<FONT COLOR=red><A NAME="ref_414_27" HREF="terminal_interface-curses-menus__adb.htm#ref_414_16">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_414_16">Menu_Opts</A></span> (<span class="symbol"><A NAME="ref_414_27" HREF="terminal_interface-curses-menus__adb.htm#ref_414_16">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Menu_Opts, "menu_opts"); - -- <FONT COLOR=red><A NAME="ref_417_7">Res</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> := <A HREF="terminal_interface-curses-menus__adb.htm#ref_414_16">Menu_Opts</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_351_27">Men</A>); -+ <span class="symbol"><A NAME="ref_417_7">Res</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> := <A HREF="terminal_interface-curses-menus__adb.htm#ref_414_16">Menu_Opts</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_349_27">Men</A>); - <b>begin</b> -- <A HREF="terminal_interface-curses-menus__ads.htm#ref_352_27">Options</A> := CInt_2_MOS (<A HREF="terminal_interface-curses-menus__adb.htm#ref_417_7">Res</A>); -- <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_351_14">Get_Options</A>; -+ <A HREF="terminal_interface-curses-menus__ads.htm#ref_350_27">Options</A> := CInt_2_MOS (<A HREF="terminal_interface-curses-menus__adb.htm#ref_417_7">Res</A>); -+ <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_349_14">Get_Options</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_422_13" HREF="terminal_interface-curses-menus__ads.htm#ref_356_13">Get_Options</A></FONT> (<FONT COLOR=red><A NAME="ref_422_26" HREF="terminal_interface-curses-menus__ads.htm#ref_356_26">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A> := <A HREF="terminal_interface-curses-menus__ads.htm#ref_63_4">Null_Menu</A>) <b>return</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_121_9">Menu_Option_Set</A> -+ <b>function</b> <span class="symbol"><A NAME="ref_422_13" HREF="terminal_interface-curses-menus__ads.htm#ref_354_13">Get_Options</A></span> (<span class="symbol"><A NAME="ref_422_26" HREF="terminal_interface-curses-menus__ads.htm#ref_354_26">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A> := <A HREF="terminal_interface-curses-menus__ads.htm#ref_63_4">Null_Menu</A>) <b>return</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_121_9">Menu_Option_Set</A> - <b>is</b> -- <FONT COLOR=red><A NAME="ref_424_7">Mos</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_121_9">Menu_Option_Set</A>; -+ <span class="symbol"><A NAME="ref_424_7">Mos</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_121_9">Menu_Option_Set</A>; - <b>begin</b> -- <A HREF="terminal_interface-curses-menus__ads.htm#ref_351_14">Get_Options</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_356_26">Men</A>, <A HREF="terminal_interface-curses-menus__adb.htm#ref_424_7">Mos</A>); -+ <A HREF="terminal_interface-curses-menus__ads.htm#ref_349_14">Get_Options</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_354_26">Men</A>, <A HREF="terminal_interface-curses-menus__adb.htm#ref_424_7">Mos</A>); - <b>return</b> <A HREF="terminal_interface-curses-menus__adb.htm#ref_424_7">Mos</A>; -- <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_356_13">Get_Options</A>; --<FONT COLOR=green><EM>-------------------------------------------------------------------------------</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_430_14" HREF="terminal_interface-curses-menus__ads.htm#ref_365_14">Set_Window</A></FONT> (<FONT COLOR=red><A NAME="ref_430_26" HREF="terminal_interface-curses-menus__ads.htm#ref_365_26">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_431_26" HREF="terminal_interface-curses-menus__ads.htm#ref_366_26">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) -+ <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_354_13">Get_Options</A>; -+<span class="comment"><EM>-------------------------------------------------------------------------------</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_430_14" HREF="terminal_interface-curses-menus__ads.htm#ref_363_14">Set_Window</A></span> (<span class="symbol"><A NAME="ref_430_26" HREF="terminal_interface-curses-menus__ads.htm#ref_363_26">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_431_26" HREF="terminal_interface-curses-menus__ads.htm#ref_364_26">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_433_16">Set_Menu_Win</A></FONT> (<FONT COLOR=red><A NAME="ref_433_30" HREF="terminal_interface-curses-menus__adb.htm#ref_433_16">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_434_30" HREF="terminal_interface-curses-menus__adb.htm#ref_433_16">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_433_16">Set_Menu_Win</A></span> (<span class="symbol"><A NAME="ref_433_30" HREF="terminal_interface-curses-menus__adb.htm#ref_433_16">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_434_30" HREF="terminal_interface-curses-menus__adb.htm#ref_433_16">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Set_Menu_Win, "set_menu_win"); - -- <FONT COLOR=red><A NAME="ref_437_7">Res</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := <A HREF="terminal_interface-curses-menus__adb.htm#ref_433_16">Set_Menu_Win</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_365_26">Men</A>, <A HREF="terminal_interface-curses-menus__ads.htm#ref_366_26">Win</A>); -+ <span class="symbol"><A NAME="ref_437_7">Res</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := <A HREF="terminal_interface-curses-menus__adb.htm#ref_433_16">Set_Menu_Win</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_363_26">Men</A>, <A HREF="terminal_interface-curses-menus__ads.htm#ref_364_26">Win</A>); - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses-menus__adb.htm#ref_437_7">Res</A> /= <A HREF="terminal_interface-curses-aux__ads.htm#ref_80_4">E_Ok</A> <b>then</b> - <A HREF="terminal_interface-curses-aux__ads.htm#ref_96_14">Eti_Exception</A> (<A HREF="terminal_interface-curses-menus__adb.htm#ref_437_7">Res</A>); - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_365_14">Set_Window</A>; -+ <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_363_14">Set_Window</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_444_13" HREF="terminal_interface-curses-menus__ads.htm#ref_371_13">Get_Window</A></FONT> (<FONT COLOR=red><A NAME="ref_444_25" HREF="terminal_interface-curses-menus__ads.htm#ref_371_25">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> -+ <b>function</b> <span class="symbol"><A NAME="ref_444_13" HREF="terminal_interface-curses-menus__ads.htm#ref_369_13">Get_Window</A></span> (<span class="symbol"><A NAME="ref_444_25" HREF="terminal_interface-curses-menus__ads.htm#ref_369_25">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_446_16">Menu_Win</A></FONT> (<FONT COLOR=red><A NAME="ref_446_26" HREF="terminal_interface-curses-menus__adb.htm#ref_446_16">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_446_16">Menu_Win</A></span> (<span class="symbol"><A NAME="ref_446_26" HREF="terminal_interface-curses-menus__adb.htm#ref_446_16">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; - <b>pragma</b> Import (C, Menu_Win, "menu_win"); - -- <FONT COLOR=red><A NAME="ref_449_7">W</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses-menus__adb.htm#ref_446_16">Menu_Win</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_371_25">Men</A>); -+ <span class="symbol"><A NAME="ref_449_7">W</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses-menus__adb.htm#ref_446_16">Menu_Win</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_369_25">Men</A>); - <b>begin</b> - <b>return</b> <A HREF="terminal_interface-curses-menus__adb.htm#ref_449_7">W</A>; -- <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_371_13">Get_Window</A>; -+ <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_369_13">Get_Window</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_454_14" HREF="terminal_interface-curses-menus__ads.htm#ref_376_14">Set_Sub_Window</A></FONT> (<FONT COLOR=red><A NAME="ref_454_30" HREF="terminal_interface-curses-menus__ads.htm#ref_376_30">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_455_30" HREF="terminal_interface-curses-menus__ads.htm#ref_377_30">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_454_14" HREF="terminal_interface-curses-menus__ads.htm#ref_374_14">Set_Sub_Window</A></span> (<span class="symbol"><A NAME="ref_454_30" HREF="terminal_interface-curses-menus__ads.htm#ref_374_30">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_455_30" HREF="terminal_interface-curses-menus__ads.htm#ref_375_30">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_457_16">Set_Menu_Sub</A></FONT> (<FONT COLOR=red><A NAME="ref_457_30" HREF="terminal_interface-curses-menus__adb.htm#ref_457_16">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_458_30" HREF="terminal_interface-curses-menus__adb.htm#ref_457_16">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_457_16">Set_Menu_Sub</A></span> (<span class="symbol"><A NAME="ref_457_30" HREF="terminal_interface-curses-menus__adb.htm#ref_457_16">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_458_30" HREF="terminal_interface-curses-menus__adb.htm#ref_457_16">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Set_Menu_Sub, "set_menu_sub"); - -- <FONT COLOR=red><A NAME="ref_461_7">Res</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := <A HREF="terminal_interface-curses-menus__adb.htm#ref_457_16">Set_Menu_Sub</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_376_30">Men</A>, <A HREF="terminal_interface-curses-menus__ads.htm#ref_377_30">Win</A>); -+ <span class="symbol"><A NAME="ref_461_7">Res</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := <A HREF="terminal_interface-curses-menus__adb.htm#ref_457_16">Set_Menu_Sub</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_374_30">Men</A>, <A HREF="terminal_interface-curses-menus__ads.htm#ref_375_30">Win</A>); - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses-menus__adb.htm#ref_461_7">Res</A> /= <A HREF="terminal_interface-curses-aux__ads.htm#ref_80_4">E_Ok</A> <b>then</b> - <A HREF="terminal_interface-curses-aux__ads.htm#ref_96_14">Eti_Exception</A> (<A HREF="terminal_interface-curses-menus__adb.htm#ref_461_7">Res</A>); - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_376_14">Set_Sub_Window</A>; -+ <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_374_14">Set_Sub_Window</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_468_13" HREF="terminal_interface-curses-menus__ads.htm#ref_382_13">Get_Sub_Window</A></FONT> (<FONT COLOR=red><A NAME="ref_468_29" HREF="terminal_interface-curses-menus__ads.htm#ref_382_29">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> -+ <b>function</b> <span class="symbol"><A NAME="ref_468_13" HREF="terminal_interface-curses-menus__ads.htm#ref_380_13">Get_Sub_Window</A></span> (<span class="symbol"><A NAME="ref_468_29" HREF="terminal_interface-curses-menus__ads.htm#ref_380_29">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_470_16">Menu_Sub</A></FONT> (<FONT COLOR=red><A NAME="ref_470_26" HREF="terminal_interface-curses-menus__adb.htm#ref_470_16">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_470_16">Menu_Sub</A></span> (<span class="symbol"><A NAME="ref_470_26" HREF="terminal_interface-curses-menus__adb.htm#ref_470_16">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; - <b>pragma</b> Import (C, Menu_Sub, "menu_sub"); - -- <FONT COLOR=red><A NAME="ref_473_7">W</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses-menus__adb.htm#ref_470_16">Menu_Sub</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_382_29">Men</A>); -+ <span class="symbol"><A NAME="ref_473_7">W</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses-menus__adb.htm#ref_470_16">Menu_Sub</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_380_29">Men</A>); - <b>begin</b> - <b>return</b> <A HREF="terminal_interface-curses-menus__adb.htm#ref_473_7">W</A>; -- <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_382_13">Get_Sub_Window</A>; -+ <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_380_13">Get_Sub_Window</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_478_14" HREF="terminal_interface-curses-menus__ads.htm#ref_387_14">Scale</A></FONT> (<FONT COLOR=red><A NAME="ref_478_21" HREF="terminal_interface-curses-menus__ads.htm#ref_387_21">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_479_21" HREF="terminal_interface-curses-menus__ads.htm#ref_388_21">Lines</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_63_12">Line_Count</A>; -- <FONT COLOR=red><A NAME="ref_480_21" HREF="terminal_interface-curses-menus__ads.htm#ref_389_21">Columns</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_65_12">Column_Count</A>) -- <b>is</b> -- <b>type</b> <FONT COLOR=red><A NAME="ref_482_12">C_Int_Access</A></FONT> <b>is</b> <b>access</b> <b>all</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -- <b>function</b> <FONT COLOR=red><A NAME="ref_483_16">M_Scale</A></FONT> (<FONT COLOR=red><A NAME="ref_483_25" HREF="terminal_interface-curses-menus__adb.htm#ref_483_16">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_484_25" HREF="terminal_interface-curses-menus__adb.htm#ref_483_16">Yp</A></FONT>, <FONT COLOR=red><A NAME="ref_484_29" HREF="terminal_interface-curses-menus__adb.htm#ref_483_16">Xp</A></FONT> : <A HREF="terminal_interface-curses-menus__adb.htm#ref_482_12">C_Int_Access</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>procedure</b> <span class="symbol"><A NAME="ref_478_14" HREF="terminal_interface-curses-menus__ads.htm#ref_385_14">Scale</A></span> (<span class="symbol"><A NAME="ref_478_21" HREF="terminal_interface-curses-menus__ads.htm#ref_385_21">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_479_21" HREF="terminal_interface-curses-menus__ads.htm#ref_386_21">Lines</A></span> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_63_12">Line_Count</A>; -+ <span class="symbol"><A NAME="ref_480_21" HREF="terminal_interface-curses-menus__ads.htm#ref_387_21">Columns</A></span> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_65_12">Column_Count</A>) -+ <b>is</b> -+ <b>type</b> <span class="symbol"><A NAME="ref_482_12">C_Int_Access</A></span> <b>is</b> <b>access</b> <b>all</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_483_16">M_Scale</A></span> (<span class="symbol"><A NAME="ref_483_25" HREF="terminal_interface-curses-menus__adb.htm#ref_483_16">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_484_25" HREF="terminal_interface-curses-menus__adb.htm#ref_483_16">Yp</A></span>, <span class="symbol"><A NAME="ref_484_29" HREF="terminal_interface-curses-menus__adb.htm#ref_483_16">Xp</A></span> : <A HREF="terminal_interface-curses-menus__adb.htm#ref_482_12">C_Int_Access</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, M_Scale, "scale_menu"); - -- <FONT COLOR=red><A NAME="ref_487_7">X</A></FONT>, <FONT COLOR=red><A NAME="ref_487_10">Y</A></FONT> : <b>aliased</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -- <FONT COLOR=red><A NAME="ref_488_7">Res</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := <A HREF="terminal_interface-curses-menus__adb.htm#ref_483_16">M_Scale</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_387_21">Men</A>, <A HREF="terminal_interface-curses-menus__adb.htm#ref_487_10">Y</A>'<b>Access</b>, <A HREF="terminal_interface-curses-menus__adb.htm#ref_487_7">X</A>'<b>Access</b>); -+ <span class="symbol"><A NAME="ref_487_7">X</A></span>, <span class="symbol"><A NAME="ref_487_10">Y</A></span> : <b>aliased</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <span class="symbol"><A NAME="ref_488_7">Res</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := <A HREF="terminal_interface-curses-menus__adb.htm#ref_483_16">M_Scale</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_385_21">Men</A>, <A HREF="terminal_interface-curses-menus__adb.htm#ref_487_10">Y</A>'<b>Access</b>, <A HREF="terminal_interface-curses-menus__adb.htm#ref_487_7">X</A>'<b>Access</b>); - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses-menus__adb.htm#ref_488_7">Res</A> /= <A HREF="terminal_interface-curses-aux__ads.htm#ref_80_4">E_Ok</A> <b>then</b> - <A HREF="terminal_interface-curses-aux__ads.htm#ref_96_14">Eti_Exception</A> (<A HREF="terminal_interface-curses-menus__adb.htm#ref_488_7">Res</A>); - <b>end</b> <b>if</b>; -- <A HREF="terminal_interface-curses-menus__ads.htm#ref_388_21">Lines</A> := <A HREF="terminal_interface-curses__ads.htm#ref_63_12">Line_Count</A> (<A HREF="terminal_interface-curses-menus__adb.htm#ref_487_10">Y</A>); -- <A HREF="terminal_interface-curses-menus__ads.htm#ref_389_21">Columns</A> := <A HREF="terminal_interface-curses__ads.htm#ref_65_12">Column_Count</A> (<A HREF="terminal_interface-curses-menus__adb.htm#ref_487_7">X</A>); -- <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_387_14">Scale</A>; --<FONT COLOR=green><EM>-------------------------------------------------------------------------------</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_497_14" HREF="terminal_interface-curses-menus__ads.htm#ref_398_14">Position_Cursor</A></FONT> (<FONT COLOR=red><A NAME="ref_497_31" HREF="terminal_interface-curses-menus__ads.htm#ref_398_31">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) -+ <A HREF="terminal_interface-curses-menus__ads.htm#ref_386_21">Lines</A> := <A HREF="terminal_interface-curses__ads.htm#ref_63_12">Line_Count</A> (<A HREF="terminal_interface-curses-menus__adb.htm#ref_487_10">Y</A>); -+ <A HREF="terminal_interface-curses-menus__ads.htm#ref_387_21">Columns</A> := <A HREF="terminal_interface-curses__ads.htm#ref_65_12">Column_Count</A> (<A HREF="terminal_interface-curses-menus__adb.htm#ref_487_7">X</A>); -+ <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_385_14">Scale</A>; -+<span class="comment"><EM>-------------------------------------------------------------------------------</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_497_14" HREF="terminal_interface-curses-menus__ads.htm#ref_396_14">Position_Cursor</A></span> (<span class="symbol"><A NAME="ref_497_31" HREF="terminal_interface-curses-menus__ads.htm#ref_396_31">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_499_16">Pos_Menu_Cursor</A></FONT> (<FONT COLOR=red><A NAME="ref_499_33" HREF="terminal_interface-curses-menus__adb.htm#ref_499_16">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_499_16">Pos_Menu_Cursor</A></span> (<span class="symbol"><A NAME="ref_499_33" HREF="terminal_interface-curses-menus__adb.htm#ref_499_16">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Pos_Menu_Cursor, "pos_menu_cursor"); - -- <FONT COLOR=red><A NAME="ref_502_7">Res</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := <A HREF="terminal_interface-curses-menus__adb.htm#ref_499_16">Pos_Menu_Cursor</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_398_31">Men</A>); -+ <span class="symbol"><A NAME="ref_502_7">Res</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := <A HREF="terminal_interface-curses-menus__adb.htm#ref_499_16">Pos_Menu_Cursor</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_396_31">Men</A>); - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses-menus__adb.htm#ref_502_7">Res</A> /= <A HREF="terminal_interface-curses-aux__ads.htm#ref_80_4">E_Ok</A> <b>then</b> - <A HREF="terminal_interface-curses-aux__ads.htm#ref_96_14">Eti_Exception</A> (<A HREF="terminal_interface-curses-menus__adb.htm#ref_502_7">Res</A>); - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_398_14">Position_Cursor</A>; -+ <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_396_14">Position_Cursor</A>; - --<FONT COLOR=green><EM>-------------------------------------------------------------------------------</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_510_14" HREF="terminal_interface-curses-menus__ads.htm#ref_407_14">Set_Mark</A></FONT> (<FONT COLOR=red><A NAME="ref_510_24" HREF="terminal_interface-curses-menus__ads.htm#ref_407_24">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_511_24" HREF="terminal_interface-curses-menus__ads.htm#ref_408_24">Mark</A></FONT> : String) -- <b>is</b> -- <b>type</b> <FONT COLOR=red><A NAME="ref_513_12">Char_Ptr</A></FONT> <b>is</b> <b>access</b> <b>all</b> <A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>.C.char; -- <b>function</b> <FONT COLOR=red><A NAME="ref_514_16">Set_Mark</A></FONT> (<FONT COLOR=red><A NAME="ref_514_26" HREF="terminal_interface-curses-menus__adb.htm#ref_514_16">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_515_26" HREF="terminal_interface-curses-menus__adb.htm#ref_514_16">Mark</A></FONT> : <A HREF="terminal_interface-curses-menus__adb.htm#ref_513_12">Char_Ptr</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+<span class="comment"><EM>-------------------------------------------------------------------------------</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_510_14" HREF="terminal_interface-curses-menus__ads.htm#ref_405_14">Set_Mark</A></span> (<span class="symbol"><A NAME="ref_510_24" HREF="terminal_interface-curses-menus__ads.htm#ref_405_24">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_511_24" HREF="terminal_interface-curses-menus__ads.htm#ref_406_24">Mark</A></span> : String) -+ <b>is</b> -+ <b>type</b> <span class="symbol"><A NAME="ref_513_12">Char_Ptr</A></span> <b>is</b> <b>access</b> <b>all</b> <A HREF="interfac__ads.htm#ref_36_9">Interfaces</A>.C.char; -+ <b>function</b> <span class="symbol"><A NAME="ref_514_16">Set_Mark</A></span> (<span class="symbol"><A NAME="ref_514_26" HREF="terminal_interface-curses-menus__adb.htm#ref_514_16">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_515_26" HREF="terminal_interface-curses-menus__adb.htm#ref_514_16">Mark</A></span> : <A HREF="terminal_interface-curses-menus__adb.htm#ref_513_12">Char_Ptr</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Set_Mark, "set_menu_mark"); - -- <FONT COLOR=red><A NAME="ref_518_7">Txt</A></FONT> : char_array (0 .. <A HREF="terminal_interface-curses-menus__ads.htm#ref_408_24">Mark</A>'Length); -- <FONT COLOR=red><A NAME="ref_519_7">Len</A></FONT> : size_t; -- <FONT COLOR=red><A NAME="ref_520_7">Res</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A>; -+ <span class="symbol"><A NAME="ref_518_7">Txt</A></span> : char_array (0 .. <A HREF="terminal_interface-curses-menus__ads.htm#ref_406_24">Mark</A>'Length); -+ <span class="symbol"><A NAME="ref_519_7">Len</A></span> : size_t; -+ <span class="symbol"><A NAME="ref_520_7">Res</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A>; - <b>begin</b> -- To_C (<A HREF="terminal_interface-curses-menus__ads.htm#ref_408_24">Mark</A>, <A HREF="terminal_interface-curses-menus__adb.htm#ref_518_7">Txt</A>, <A HREF="terminal_interface-curses-menus__adb.htm#ref_519_7">Len</A>); -- <A HREF="terminal_interface-curses-menus__adb.htm#ref_520_7">Res</A> := <A HREF="terminal_interface-curses-menus__adb.htm#ref_514_16">Set_Mark</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_407_24">Men</A>, <A HREF="terminal_interface-curses-menus__adb.htm#ref_518_7">Txt</A> (<A HREF="terminal_interface-curses-menus__adb.htm#ref_518_7">Txt</A>'First)'<b>Access</b>); -+ To_C (<A HREF="terminal_interface-curses-menus__ads.htm#ref_406_24">Mark</A>, <A HREF="terminal_interface-curses-menus__adb.htm#ref_518_7">Txt</A>, <A HREF="terminal_interface-curses-menus__adb.htm#ref_519_7">Len</A>); -+ <A HREF="terminal_interface-curses-menus__adb.htm#ref_520_7">Res</A> := <A HREF="terminal_interface-curses-menus__adb.htm#ref_514_16">Set_Mark</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_405_24">Men</A>, <A HREF="terminal_interface-curses-menus__adb.htm#ref_518_7">Txt</A> (<A HREF="terminal_interface-curses-menus__adb.htm#ref_518_7">Txt</A>'First)'<b>Access</b>); - <b>if</b> <A HREF="terminal_interface-curses-menus__adb.htm#ref_520_7">Res</A> /= <A HREF="terminal_interface-curses-aux__ads.htm#ref_80_4">E_Ok</A> <b>then</b> - <A HREF="terminal_interface-curses-aux__ads.htm#ref_96_14">Eti_Exception</A> (<A HREF="terminal_interface-curses-menus__adb.htm#ref_520_7">Res</A>); - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_407_14">Set_Mark</A>; -+ <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_405_14">Set_Mark</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_529_14" HREF="terminal_interface-curses-menus__ads.htm#ref_413_14">Mark</A></FONT> (<FONT COLOR=red><A NAME="ref_529_20" HREF="terminal_interface-curses-menus__ads.htm#ref_413_20">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_530_20" HREF="terminal_interface-curses-menus__ads.htm#ref_414_20">Mark</A></FONT> : <b>out</b> String) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_529_14" HREF="terminal_interface-curses-menus__ads.htm#ref_411_14">Mark</A></span> (<span class="symbol"><A NAME="ref_529_20" HREF="terminal_interface-curses-menus__ads.htm#ref_411_20">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_530_20" HREF="terminal_interface-curses-menus__ads.htm#ref_412_20">Mark</A></span> : <b>out</b> String) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_532_16">Get_Menu_Mark</A></FONT> (<FONT COLOR=red><A NAME="ref_532_31" HREF="terminal_interface-curses-menus__adb.htm#ref_532_16">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> <A HREF="terminal_interface-curses-menus__adb.htm#ref_58_12">chars_ptr</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_532_16">Get_Menu_Mark</A></span> (<span class="symbol"><A NAME="ref_532_31" HREF="terminal_interface-curses-menus__adb.htm#ref_532_16">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> <A HREF="terminal_interface-curses-menus__adb.htm#ref_58_12">chars_ptr</A>; - <b>pragma</b> Import (C, Get_Menu_Mark, "menu_mark"); - <b>begin</b> -- <A HREF="terminal_interface-curses-aux__ads.htm#ref_116_14">Fill_String</A> (<A HREF="terminal_interface-curses-menus__adb.htm#ref_532_16">Get_Menu_Mark</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_413_20">Men</A>), <A HREF="terminal_interface-curses-menus__ads.htm#ref_414_20">Mark</A>); -- <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_413_14">Mark</A>; -+ <A HREF="terminal_interface-curses-aux__ads.htm#ref_116_14">Fill_String</A> (<A HREF="terminal_interface-curses-menus__adb.htm#ref_532_16">Get_Menu_Mark</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_411_20">Men</A>), <A HREF="terminal_interface-curses-menus__ads.htm#ref_412_20">Mark</A>); -+ <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_411_14">Mark</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_538_13" HREF="terminal_interface-curses-menus__ads.htm#ref_417_14">Mark</A></FONT> (<FONT COLOR=red><A NAME="ref_538_19" HREF="terminal_interface-curses-menus__ads.htm#ref_417_20">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> String -+ <b>function</b> <span class="symbol"><A NAME="ref_538_13" HREF="terminal_interface-curses-menus__ads.htm#ref_415_14">Mark</A></span> (<span class="symbol"><A NAME="ref_538_19" HREF="terminal_interface-curses-menus__ads.htm#ref_415_20">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> String - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_540_16">Get_Menu_Mark</A></FONT> (<FONT COLOR=red><A NAME="ref_540_31" HREF="terminal_interface-curses-menus__adb.htm#ref_540_16">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> <A HREF="terminal_interface-curses-menus__adb.htm#ref_58_12">chars_ptr</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_540_16">Get_Menu_Mark</A></span> (<span class="symbol"><A NAME="ref_540_31" HREF="terminal_interface-curses-menus__adb.htm#ref_540_16">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> <A HREF="terminal_interface-curses-menus__adb.htm#ref_58_12">chars_ptr</A>; - <b>pragma</b> Import (C, Get_Menu_Mark, "menu_mark"); - <b>begin</b> -- <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_121_13">Fill_String</A> (<A HREF="terminal_interface-curses-menus__adb.htm#ref_540_16">Get_Menu_Mark</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_417_20">Men</A>)); -- <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_417_14">Mark</A>; -+ <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_121_13">Fill_String</A> (<A HREF="terminal_interface-curses-menus__adb.htm#ref_540_16">Get_Menu_Mark</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_415_20">Men</A>)); -+ <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_415_14">Mark</A>; - --<FONT COLOR=green><EM>-------------------------------------------------------------------------------</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_547_14" HREF="terminal_interface-curses-menus__ads.htm#ref_427_14">Set_Foreground</A></FONT> -- (<FONT COLOR=red><A NAME="ref_548_7" HREF="terminal_interface-curses-menus__ads.htm#ref_428_7">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_549_7" HREF="terminal_interface-curses-menus__ads.htm#ref_429_7">Fore</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A> := <A HREF="terminal_interface-curses__ads.htm#ref_352_4">Normal_Video</A>; -- <FONT COLOR=red><A NAME="ref_550_7" HREF="terminal_interface-curses-menus__ads.htm#ref_430_7">Color</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A> := <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>'First) -+<span class="comment"><EM>-------------------------------------------------------------------------------</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_547_14" HREF="terminal_interface-curses-menus__ads.htm#ref_425_14">Set_Foreground</A></span> -+ (<span class="symbol"><A NAME="ref_548_7" HREF="terminal_interface-curses-menus__ads.htm#ref_426_7">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_549_7" HREF="terminal_interface-curses-menus__ads.htm#ref_427_7">Fore</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A> := <A HREF="terminal_interface-curses__ads.htm#ref_351_4">Normal_Video</A>; -+ <span class="symbol"><A NAME="ref_550_7" HREF="terminal_interface-curses-menus__ads.htm#ref_428_7">Color</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A> := <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>'First) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_552_16">Set_Menu_Fore</A></FONT> (<FONT COLOR=red><A NAME="ref_552_31" HREF="terminal_interface-curses-menus__adb.htm#ref_552_16">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_553_31" HREF="terminal_interface-curses-menus__adb.htm#ref_552_16">Attr</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_12">C_Chtype</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_552_16">Set_Menu_Fore</A></span> (<span class="symbol"><A NAME="ref_552_31" HREF="terminal_interface-curses-menus__adb.htm#ref_552_16">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_553_31" HREF="terminal_interface-curses-menus__adb.htm#ref_552_16">Attr</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_12">C_Chtype</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Set_Menu_Fore, "set_menu_fore"); - -- <FONT COLOR=red><A NAME="ref_556_7">Ch</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_354_9">Attributed_Character</A> := (<A HREF="terminal_interface-curses__ads.htm#ref_358_10">Ch</A> =&gt; Character'First, -- <A HREF="terminal_interface-curses__ads.htm#ref_357_10">Color</A> =&gt; <A HREF="terminal_interface-curses-menus__ads.htm#ref_430_7">Color</A>, -- <A HREF="terminal_interface-curses__ads.htm#ref_356_10">Attr</A> =&gt; <A HREF="terminal_interface-curses-menus__ads.htm#ref_429_7">Fore</A>); -- <FONT COLOR=red><A NAME="ref_559_7">Res</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := <A HREF="terminal_interface-curses-menus__adb.htm#ref_552_16">Set_Menu_Fore</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_428_7">Men</A>, AttrChar_To_Chtype (<A HREF="terminal_interface-curses-menus__adb.htm#ref_556_7">Ch</A>)); -+ <span class="symbol"><A NAME="ref_556_7">Ch</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_353_9">Attributed_Character</A> := (<A HREF="terminal_interface-curses__ads.htm#ref_357_10">Ch</A> =&gt; Character'First, -+ <A HREF="terminal_interface-curses__ads.htm#ref_356_10">Color</A> =&gt; <A HREF="terminal_interface-curses-menus__ads.htm#ref_428_7">Color</A>, -+ <A HREF="terminal_interface-curses__ads.htm#ref_355_10">Attr</A> =&gt; <A HREF="terminal_interface-curses-menus__ads.htm#ref_427_7">Fore</A>); -+ <span class="symbol"><A NAME="ref_559_7">Res</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := <A HREF="terminal_interface-curses-menus__adb.htm#ref_552_16">Set_Menu_Fore</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_426_7">Men</A>, AttrChar_To_Chtype (<A HREF="terminal_interface-curses-menus__adb.htm#ref_556_7">Ch</A>)); - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses-menus__adb.htm#ref_559_7">Res</A> /= <A HREF="terminal_interface-curses-aux__ads.htm#ref_80_4">E_Ok</A> <b>then</b> - <A HREF="terminal_interface-curses-aux__ads.htm#ref_96_14">Eti_Exception</A> (<A HREF="terminal_interface-curses-menus__adb.htm#ref_559_7">Res</A>); - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_427_14">Set_Foreground</A>; -+ <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_425_14">Set_Foreground</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_566_14" HREF="terminal_interface-curses-menus__ads.htm#ref_435_14">Foreground</A></FONT> (<FONT COLOR=red><A NAME="ref_566_26" HREF="terminal_interface-curses-menus__ads.htm#ref_435_26">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_567_26" HREF="terminal_interface-curses-menus__ads.htm#ref_436_26">Fore</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A>) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_566_14" HREF="terminal_interface-curses-menus__ads.htm#ref_433_14">Foreground</A></span> (<span class="symbol"><A NAME="ref_566_26" HREF="terminal_interface-curses-menus__ads.htm#ref_433_26">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_567_26" HREF="terminal_interface-curses-menus__ads.htm#ref_434_26">Fore</A></span> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A>) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_569_16">Menu_Fore</A></FONT> (<FONT COLOR=red><A NAME="ref_569_27" HREF="terminal_interface-curses-menus__adb.htm#ref_569_16">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_12">C_Chtype</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_569_16">Menu_Fore</A></span> (<span class="symbol"><A NAME="ref_569_27" HREF="terminal_interface-curses-menus__adb.htm#ref_569_16">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_12">C_Chtype</A>; - <b>pragma</b> Import (C, Menu_Fore, "menu_fore"); - <b>begin</b> -- <A HREF="terminal_interface-curses-menus__ads.htm#ref_436_26">Fore</A> := Chtype_To_AttrChar (<A HREF="terminal_interface-curses-menus__adb.htm#ref_569_16">Menu_Fore</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_435_26">Men</A>)).<A HREF="terminal_interface-curses__ads.htm#ref_356_10">Attr</A>; -- <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_435_14">Foreground</A>; -+ <A HREF="terminal_interface-curses-menus__ads.htm#ref_434_26">Fore</A> := Chtype_To_AttrChar (<A HREF="terminal_interface-curses-menus__adb.htm#ref_569_16">Menu_Fore</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_433_26">Men</A>)).<A HREF="terminal_interface-curses__ads.htm#ref_355_10">Attr</A>; -+ <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_433_14">Foreground</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_575_14" HREF="terminal_interface-curses-menus__ads.htm#ref_440_14">Foreground</A></FONT> (<FONT COLOR=red><A NAME="ref_575_26" HREF="terminal_interface-curses-menus__ads.htm#ref_440_26">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_576_26" HREF="terminal_interface-curses-menus__ads.htm#ref_441_26">Fore</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A>; -- <FONT COLOR=red><A NAME="ref_577_26" HREF="terminal_interface-curses-menus__ads.htm#ref_442_26">Color</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_575_14" HREF="terminal_interface-curses-menus__ads.htm#ref_438_14">Foreground</A></span> (<span class="symbol"><A NAME="ref_575_26" HREF="terminal_interface-curses-menus__ads.htm#ref_438_26">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_576_26" HREF="terminal_interface-curses-menus__ads.htm#ref_439_26">Fore</A></span> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A>; -+ <span class="symbol"><A NAME="ref_577_26" HREF="terminal_interface-curses-menus__ads.htm#ref_440_26">Color</A></span> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_579_16">Menu_Fore</A></FONT> (<FONT COLOR=red><A NAME="ref_579_27" HREF="terminal_interface-curses-menus__adb.htm#ref_579_16">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_12">C_Chtype</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_579_16">Menu_Fore</A></span> (<span class="symbol"><A NAME="ref_579_27" HREF="terminal_interface-curses-menus__adb.htm#ref_579_16">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_12">C_Chtype</A>; - <b>pragma</b> Import (C, Menu_Fore, "menu_fore"); - <b>begin</b> -- <A HREF="terminal_interface-curses-menus__ads.htm#ref_441_26">Fore</A> := Chtype_To_AttrChar (<A HREF="terminal_interface-curses-menus__adb.htm#ref_579_16">Menu_Fore</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_440_26">Men</A>)).<A HREF="terminal_interface-curses__ads.htm#ref_356_10">Attr</A>; -- <A HREF="terminal_interface-curses-menus__ads.htm#ref_442_26">Color</A> := Chtype_To_AttrChar (<A HREF="terminal_interface-curses-menus__adb.htm#ref_579_16">Menu_Fore</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_440_26">Men</A>)).<A HREF="terminal_interface-curses__ads.htm#ref_357_10">Color</A>; -- <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_440_14">Foreground</A>; -- -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_586_14" HREF="terminal_interface-curses-menus__ads.htm#ref_447_14">Set_Background</A></FONT> -- (<FONT COLOR=red><A NAME="ref_587_7" HREF="terminal_interface-curses-menus__ads.htm#ref_448_7">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_588_7" HREF="terminal_interface-curses-menus__ads.htm#ref_449_7">Back</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A> := <A HREF="terminal_interface-curses__ads.htm#ref_352_4">Normal_Video</A>; -- <FONT COLOR=red><A NAME="ref_589_7" HREF="terminal_interface-curses-menus__ads.htm#ref_450_7">Color</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A> := <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>'First) -+ <A HREF="terminal_interface-curses-menus__ads.htm#ref_439_26">Fore</A> := Chtype_To_AttrChar (<A HREF="terminal_interface-curses-menus__adb.htm#ref_579_16">Menu_Fore</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_438_26">Men</A>)).<A HREF="terminal_interface-curses__ads.htm#ref_355_10">Attr</A>; -+ <A HREF="terminal_interface-curses-menus__ads.htm#ref_440_26">Color</A> := Chtype_To_AttrChar (<A HREF="terminal_interface-curses-menus__adb.htm#ref_579_16">Menu_Fore</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_438_26">Men</A>)).<A HREF="terminal_interface-curses__ads.htm#ref_356_10">Color</A>; -+ <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_438_14">Foreground</A>; -+ -+ <b>procedure</b> <span class="symbol"><A NAME="ref_586_14" HREF="terminal_interface-curses-menus__ads.htm#ref_445_14">Set_Background</A></span> -+ (<span class="symbol"><A NAME="ref_587_7" HREF="terminal_interface-curses-menus__ads.htm#ref_446_7">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_588_7" HREF="terminal_interface-curses-menus__ads.htm#ref_447_7">Back</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A> := <A HREF="terminal_interface-curses__ads.htm#ref_351_4">Normal_Video</A>; -+ <span class="symbol"><A NAME="ref_589_7" HREF="terminal_interface-curses-menus__ads.htm#ref_448_7">Color</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A> := <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>'First) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_591_16">Set_Menu_Back</A></FONT> (<FONT COLOR=red><A NAME="ref_591_31" HREF="terminal_interface-curses-menus__adb.htm#ref_591_16">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_592_31" HREF="terminal_interface-curses-menus__adb.htm#ref_591_16">Attr</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_12">C_Chtype</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_591_16">Set_Menu_Back</A></span> (<span class="symbol"><A NAME="ref_591_31" HREF="terminal_interface-curses-menus__adb.htm#ref_591_16">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_592_31" HREF="terminal_interface-curses-menus__adb.htm#ref_591_16">Attr</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_12">C_Chtype</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Set_Menu_Back, "set_menu_back"); - -- <FONT COLOR=red><A NAME="ref_595_7">Ch</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_354_9">Attributed_Character</A> := (<A HREF="terminal_interface-curses__ads.htm#ref_358_10">Ch</A> =&gt; Character'First, -- <A HREF="terminal_interface-curses__ads.htm#ref_357_10">Color</A> =&gt; <A HREF="terminal_interface-curses-menus__ads.htm#ref_450_7">Color</A>, -- <A HREF="terminal_interface-curses__ads.htm#ref_356_10">Attr</A> =&gt; <A HREF="terminal_interface-curses-menus__ads.htm#ref_449_7">Back</A>); -- <FONT COLOR=red><A NAME="ref_598_7">Res</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := <A HREF="terminal_interface-curses-menus__adb.htm#ref_591_16">Set_Menu_Back</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_448_7">Men</A>, AttrChar_To_Chtype (<A HREF="terminal_interface-curses-menus__adb.htm#ref_595_7">Ch</A>)); -+ <span class="symbol"><A NAME="ref_595_7">Ch</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_353_9">Attributed_Character</A> := (<A HREF="terminal_interface-curses__ads.htm#ref_357_10">Ch</A> =&gt; Character'First, -+ <A HREF="terminal_interface-curses__ads.htm#ref_356_10">Color</A> =&gt; <A HREF="terminal_interface-curses-menus__ads.htm#ref_448_7">Color</A>, -+ <A HREF="terminal_interface-curses__ads.htm#ref_355_10">Attr</A> =&gt; <A HREF="terminal_interface-curses-menus__ads.htm#ref_447_7">Back</A>); -+ <span class="symbol"><A NAME="ref_598_7">Res</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := <A HREF="terminal_interface-curses-menus__adb.htm#ref_591_16">Set_Menu_Back</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_446_7">Men</A>, AttrChar_To_Chtype (<A HREF="terminal_interface-curses-menus__adb.htm#ref_595_7">Ch</A>)); - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses-menus__adb.htm#ref_598_7">Res</A> /= <A HREF="terminal_interface-curses-aux__ads.htm#ref_80_4">E_Ok</A> <b>then</b> - <A HREF="terminal_interface-curses-aux__ads.htm#ref_96_14">Eti_Exception</A> (<A HREF="terminal_interface-curses-menus__adb.htm#ref_598_7">Res</A>); - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_447_14">Set_Background</A>; -+ <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_445_14">Set_Background</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_605_14" HREF="terminal_interface-curses-menus__ads.htm#ref_455_14">Background</A></FONT> (<FONT COLOR=red><A NAME="ref_605_26" HREF="terminal_interface-curses-menus__ads.htm#ref_455_26">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_606_26" HREF="terminal_interface-curses-menus__ads.htm#ref_456_26">Back</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A>) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_605_14" HREF="terminal_interface-curses-menus__ads.htm#ref_453_14">Background</A></span> (<span class="symbol"><A NAME="ref_605_26" HREF="terminal_interface-curses-menus__ads.htm#ref_453_26">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_606_26" HREF="terminal_interface-curses-menus__ads.htm#ref_454_26">Back</A></span> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A>) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_608_16">Menu_Back</A></FONT> (<FONT COLOR=red><A NAME="ref_608_27" HREF="terminal_interface-curses-menus__adb.htm#ref_608_16">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_12">C_Chtype</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_608_16">Menu_Back</A></span> (<span class="symbol"><A NAME="ref_608_27" HREF="terminal_interface-curses-menus__adb.htm#ref_608_16">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_12">C_Chtype</A>; - <b>pragma</b> Import (C, Menu_Back, "menu_back"); - <b>begin</b> -- <A HREF="terminal_interface-curses-menus__ads.htm#ref_456_26">Back</A> := Chtype_To_AttrChar (<A HREF="terminal_interface-curses-menus__adb.htm#ref_608_16">Menu_Back</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_455_26">Men</A>)).<A HREF="terminal_interface-curses__ads.htm#ref_356_10">Attr</A>; -- <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_455_14">Background</A>; -+ <A HREF="terminal_interface-curses-menus__ads.htm#ref_454_26">Back</A> := Chtype_To_AttrChar (<A HREF="terminal_interface-curses-menus__adb.htm#ref_608_16">Menu_Back</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_453_26">Men</A>)).<A HREF="terminal_interface-curses__ads.htm#ref_355_10">Attr</A>; -+ <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_453_14">Background</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_614_14" HREF="terminal_interface-curses-menus__ads.htm#ref_460_14">Background</A></FONT> (<FONT COLOR=red><A NAME="ref_614_26" HREF="terminal_interface-curses-menus__ads.htm#ref_460_26">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_615_26" HREF="terminal_interface-curses-menus__ads.htm#ref_461_26">Back</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A>; -- <FONT COLOR=red><A NAME="ref_616_26" HREF="terminal_interface-curses-menus__ads.htm#ref_462_26">Color</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_614_14" HREF="terminal_interface-curses-menus__ads.htm#ref_458_14">Background</A></span> (<span class="symbol"><A NAME="ref_614_26" HREF="terminal_interface-curses-menus__ads.htm#ref_458_26">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_615_26" HREF="terminal_interface-curses-menus__ads.htm#ref_459_26">Back</A></span> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A>; -+ <span class="symbol"><A NAME="ref_616_26" HREF="terminal_interface-curses-menus__ads.htm#ref_460_26">Color</A></span> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_618_16">Menu_Back</A></FONT> (<FONT COLOR=red><A NAME="ref_618_27" HREF="terminal_interface-curses-menus__adb.htm#ref_618_16">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_12">C_Chtype</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_618_16">Menu_Back</A></span> (<span class="symbol"><A NAME="ref_618_27" HREF="terminal_interface-curses-menus__adb.htm#ref_618_16">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_12">C_Chtype</A>; - <b>pragma</b> Import (C, Menu_Back, "menu_back"); - <b>begin</b> -- <A HREF="terminal_interface-curses-menus__ads.htm#ref_461_26">Back</A> := <A HREF="terminal_interface-curses-aux__ads.htm#ref_96_14">Chtype_To_AttrChar</A> (<A HREF="terminal_interface-curses-menus__adb.htm#ref_618_16">Menu_Back</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_460_26">Men</A>)).<A HREF="terminal_interface-curses__ads.htm#ref_356_10">Attr</A>; -- <A HREF="terminal_interface-curses-menus__ads.htm#ref_462_26">Color</A> := <A HREF="terminal_interface-curses-aux__ads.htm#ref_96_14">Chtype_To_AttrChar</A> (<A HREF="terminal_interface-curses-menus__adb.htm#ref_618_16">Menu_Back</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_460_26">Men</A>)).<A HREF="terminal_interface-curses__ads.htm#ref_357_10">Color</A>; -- <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_460_14">Background</A>; -- -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_625_14" HREF="terminal_interface-curses-menus__ads.htm#ref_467_14">Set_Grey</A></FONT> (<FONT COLOR=red><A NAME="ref_625_24" HREF="terminal_interface-curses-menus__ads.htm#ref_468_7">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_626_24" HREF="terminal_interface-curses-menus__ads.htm#ref_469_7">Grey</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A> := <A HREF="terminal_interface-curses__ads.htm#ref_352_4">Normal_Video</A>; -- <FONT COLOR=red><A NAME="ref_627_24" HREF="terminal_interface-curses-menus__ads.htm#ref_470_7">Color</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A> := <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>'First) -+ <A HREF="terminal_interface-curses-menus__ads.htm#ref_459_26">Back</A> := <A HREF="terminal_interface-curses-aux__ads.htm#ref_96_14">Chtype_To_AttrChar</A> (<A HREF="terminal_interface-curses-menus__adb.htm#ref_618_16">Menu_Back</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_458_26">Men</A>)).<A HREF="terminal_interface-curses__ads.htm#ref_355_10">Attr</A>; -+ <A HREF="terminal_interface-curses-menus__ads.htm#ref_460_26">Color</A> := <A HREF="terminal_interface-curses-aux__ads.htm#ref_96_14">Chtype_To_AttrChar</A> (<A HREF="terminal_interface-curses-menus__adb.htm#ref_618_16">Menu_Back</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_458_26">Men</A>)).<A HREF="terminal_interface-curses__ads.htm#ref_356_10">Color</A>; -+ <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_458_14">Background</A>; -+ -+ <b>procedure</b> <span class="symbol"><A NAME="ref_625_14" HREF="terminal_interface-curses-menus__ads.htm#ref_465_14">Set_Grey</A></span> (<span class="symbol"><A NAME="ref_625_24" HREF="terminal_interface-curses-menus__ads.htm#ref_466_7">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_626_24" HREF="terminal_interface-curses-menus__ads.htm#ref_467_7">Grey</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A> := <A HREF="terminal_interface-curses__ads.htm#ref_351_4">Normal_Video</A>; -+ <span class="symbol"><A NAME="ref_627_24" HREF="terminal_interface-curses-menus__ads.htm#ref_468_7">Color</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A> := <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>'First) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_629_16">Set_Menu_Grey</A></FONT> (<FONT COLOR=red><A NAME="ref_629_31" HREF="terminal_interface-curses-menus__adb.htm#ref_629_16">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_630_31" HREF="terminal_interface-curses-menus__adb.htm#ref_629_16">Attr</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_12">C_Chtype</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_629_16">Set_Menu_Grey</A></span> (<span class="symbol"><A NAME="ref_629_31" HREF="terminal_interface-curses-menus__adb.htm#ref_629_16">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_630_31" HREF="terminal_interface-curses-menus__adb.htm#ref_629_16">Attr</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_12">C_Chtype</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Set_Menu_Grey, "set_menu_grey"); - -- <FONT COLOR=red><A NAME="ref_633_7">Ch</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_354_9">Attributed_Character</A> := (<A HREF="terminal_interface-curses__ads.htm#ref_358_10">Ch</A> =&gt; Character'First, -- <A HREF="terminal_interface-curses__ads.htm#ref_357_10">Color</A> =&gt; <A HREF="terminal_interface-curses-menus__ads.htm#ref_470_7">Color</A>, -- <A HREF="terminal_interface-curses__ads.htm#ref_356_10">Attr</A> =&gt; <A HREF="terminal_interface-curses-menus__ads.htm#ref_469_7">Grey</A>); -+ <span class="symbol"><A NAME="ref_633_7">Ch</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_353_9">Attributed_Character</A> := (<A HREF="terminal_interface-curses__ads.htm#ref_357_10">Ch</A> =&gt; Character'First, -+ <A HREF="terminal_interface-curses__ads.htm#ref_356_10">Color</A> =&gt; <A HREF="terminal_interface-curses-menus__ads.htm#ref_468_7">Color</A>, -+ <A HREF="terminal_interface-curses__ads.htm#ref_355_10">Attr</A> =&gt; <A HREF="terminal_interface-curses-menus__ads.htm#ref_467_7">Grey</A>); - -- <FONT COLOR=red><A NAME="ref_637_7">Res</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := <A HREF="terminal_interface-curses-menus__adb.htm#ref_629_16">Set_Menu_Grey</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_468_7">Men</A>, AttrChar_To_Chtype (<A HREF="terminal_interface-curses-menus__adb.htm#ref_633_7">Ch</A>)); -+ <span class="symbol"><A NAME="ref_637_7">Res</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := <A HREF="terminal_interface-curses-menus__adb.htm#ref_629_16">Set_Menu_Grey</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_466_7">Men</A>, AttrChar_To_Chtype (<A HREF="terminal_interface-curses-menus__adb.htm#ref_633_7">Ch</A>)); - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses-menus__adb.htm#ref_637_7">Res</A> /= <A HREF="terminal_interface-curses-aux__ads.htm#ref_80_4">E_Ok</A> <b>then</b> - <A HREF="terminal_interface-curses-aux__ads.htm#ref_96_14">Eti_Exception</A> (<A HREF="terminal_interface-curses-menus__adb.htm#ref_637_7">Res</A>); - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_467_14">Set_Grey</A>; -+ <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_465_14">Set_Grey</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_644_14" HREF="terminal_interface-curses-menus__ads.htm#ref_475_14">Grey</A></FONT> (<FONT COLOR=red><A NAME="ref_644_20" HREF="terminal_interface-curses-menus__ads.htm#ref_475_20">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_645_20" HREF="terminal_interface-curses-menus__ads.htm#ref_476_20">Grey</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A>) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_644_14" HREF="terminal_interface-curses-menus__ads.htm#ref_473_14">Grey</A></span> (<span class="symbol"><A NAME="ref_644_20" HREF="terminal_interface-curses-menus__ads.htm#ref_473_20">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_645_20" HREF="terminal_interface-curses-menus__ads.htm#ref_474_20">Grey</A></span> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A>) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_647_16">Menu_Grey</A></FONT> (<FONT COLOR=red><A NAME="ref_647_27" HREF="terminal_interface-curses-menus__adb.htm#ref_647_16">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_12">C_Chtype</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_647_16">Menu_Grey</A></span> (<span class="symbol"><A NAME="ref_647_27" HREF="terminal_interface-curses-menus__adb.htm#ref_647_16">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_12">C_Chtype</A>; - <b>pragma</b> Import (C, Menu_Grey, "menu_grey"); - <b>begin</b> -- <A HREF="terminal_interface-curses-menus__ads.htm#ref_476_20">Grey</A> := <A HREF="terminal_interface-curses-aux__ads.htm#ref_96_14">Chtype_To_AttrChar</A> (<A HREF="terminal_interface-curses-menus__adb.htm#ref_647_16">Menu_Grey</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_475_20">Men</A>)).<A HREF="terminal_interface-curses__ads.htm#ref_356_10">Attr</A>; -- <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_475_14">Grey</A>; -+ <A HREF="terminal_interface-curses-menus__ads.htm#ref_474_20">Grey</A> := <A HREF="terminal_interface-curses-aux__ads.htm#ref_96_14">Chtype_To_AttrChar</A> (<A HREF="terminal_interface-curses-menus__adb.htm#ref_647_16">Menu_Grey</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_473_20">Men</A>)).<A HREF="terminal_interface-curses__ads.htm#ref_355_10">Attr</A>; -+ <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_473_14">Grey</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_653_14" HREF="terminal_interface-curses-menus__ads.htm#ref_480_14">Grey</A></FONT> (<FONT COLOR=red><A NAME="ref_653_20" HREF="terminal_interface-curses-menus__ads.htm#ref_481_7">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_654_20" HREF="terminal_interface-curses-menus__ads.htm#ref_482_7">Grey</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A>; -- <FONT COLOR=red><A NAME="ref_655_20" HREF="terminal_interface-curses-menus__ads.htm#ref_483_7">Color</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_653_14" HREF="terminal_interface-curses-menus__ads.htm#ref_478_14">Grey</A></span> (<span class="symbol"><A NAME="ref_653_20" HREF="terminal_interface-curses-menus__ads.htm#ref_479_7">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_654_20" HREF="terminal_interface-curses-menus__ads.htm#ref_480_7">Grey</A></span> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A>; -+ <span class="symbol"><A NAME="ref_655_20" HREF="terminal_interface-curses-menus__ads.htm#ref_481_7">Color</A></span> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_657_16">Menu_Grey</A></FONT> (<FONT COLOR=red><A NAME="ref_657_27" HREF="terminal_interface-curses-menus__adb.htm#ref_657_16">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_12">C_Chtype</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_657_16">Menu_Grey</A></span> (<span class="symbol"><A NAME="ref_657_27" HREF="terminal_interface-curses-menus__adb.htm#ref_657_16">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_12">C_Chtype</A>; - <b>pragma</b> Import (C, Menu_Grey, "menu_grey"); - <b>begin</b> -- <A HREF="terminal_interface-curses-menus__ads.htm#ref_482_7">Grey</A> := <A HREF="terminal_interface-curses-aux__ads.htm#ref_96_14">Chtype_To_AttrChar</A> (<A HREF="terminal_interface-curses-menus__adb.htm#ref_657_16">Menu_Grey</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_481_7">Men</A>)).<A HREF="terminal_interface-curses__ads.htm#ref_356_10">Attr</A>; -- <A HREF="terminal_interface-curses-menus__ads.htm#ref_483_7">Color</A> := <A HREF="terminal_interface-curses-aux__ads.htm#ref_96_14">Chtype_To_AttrChar</A> (<A HREF="terminal_interface-curses-menus__adb.htm#ref_657_16">Menu_Grey</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_481_7">Men</A>)).<A HREF="terminal_interface-curses__ads.htm#ref_357_10">Color</A>; -- <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_480_14">Grey</A>; -+ <A HREF="terminal_interface-curses-menus__ads.htm#ref_480_7">Grey</A> := <A HREF="terminal_interface-curses-aux__ads.htm#ref_96_14">Chtype_To_AttrChar</A> (<A HREF="terminal_interface-curses-menus__adb.htm#ref_657_16">Menu_Grey</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_479_7">Men</A>)).<A HREF="terminal_interface-curses__ads.htm#ref_355_10">Attr</A>; -+ <A HREF="terminal_interface-curses-menus__ads.htm#ref_481_7">Color</A> := <A HREF="terminal_interface-curses-aux__ads.htm#ref_96_14">Chtype_To_AttrChar</A> (<A HREF="terminal_interface-curses-menus__adb.htm#ref_657_16">Menu_Grey</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_479_7">Men</A>)).<A HREF="terminal_interface-curses__ads.htm#ref_356_10">Color</A>; -+ <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_478_14">Grey</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_664_14" HREF="terminal_interface-curses-menus__ads.htm#ref_488_14">Set_Pad_Character</A></FONT> (<FONT COLOR=red><A NAME="ref_664_33" HREF="terminal_interface-curses-menus__ads.htm#ref_488_33">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_665_33" HREF="terminal_interface-curses-menus__ads.htm#ref_489_33">Pad</A></FONT> : Character := Space) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_664_14" HREF="terminal_interface-curses-menus__ads.htm#ref_486_14">Set_Pad_Character</A></span> (<span class="symbol"><A NAME="ref_664_33" HREF="terminal_interface-curses-menus__ads.htm#ref_486_33">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_665_33" HREF="terminal_interface-curses-menus__ads.htm#ref_487_33">Pad</A></span> : Character := Space) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_667_16">Set_Menu_Pad</A></FONT> (<FONT COLOR=red><A NAME="ref_667_30" HREF="terminal_interface-curses-menus__adb.htm#ref_667_16">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_668_30" HREF="terminal_interface-curses-menus__adb.htm#ref_667_16">Ch</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_667_16">Set_Menu_Pad</A></span> (<span class="symbol"><A NAME="ref_667_30" HREF="terminal_interface-curses-menus__adb.htm#ref_667_16">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_668_30" HREF="terminal_interface-curses-menus__adb.htm#ref_667_16">Ch</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Set_Menu_Pad, "set_menu_pad"); - -- <FONT COLOR=red><A NAME="ref_671_7">Res</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := <A HREF="terminal_interface-curses-menus__adb.htm#ref_667_16">Set_Menu_Pad</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_488_33">Men</A>, -- <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (Character'Pos (<A HREF="terminal_interface-curses-menus__ads.htm#ref_489_33">Pad</A>))); -+ <span class="symbol"><A NAME="ref_671_7">Res</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := <A HREF="terminal_interface-curses-menus__adb.htm#ref_667_16">Set_Menu_Pad</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_486_33">Men</A>, -+ <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (Character'Pos (<A HREF="terminal_interface-curses-menus__ads.htm#ref_487_33">Pad</A>))); - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses-menus__adb.htm#ref_671_7">Res</A> /= <A HREF="terminal_interface-curses-aux__ads.htm#ref_80_4">E_Ok</A> <b>then</b> - <A HREF="terminal_interface-curses-aux__ads.htm#ref_96_14">Eti_Exception</A> (<A HREF="terminal_interface-curses-menus__adb.htm#ref_671_7">Res</A>); - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_488_14">Set_Pad_Character</A>; -+ <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_486_14">Set_Pad_Character</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_679_14" HREF="terminal_interface-curses-menus__ads.htm#ref_494_14">Pad_Character</A></FONT> (<FONT COLOR=red><A NAME="ref_679_29" HREF="terminal_interface-curses-menus__ads.htm#ref_494_29">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_680_29" HREF="terminal_interface-curses-menus__ads.htm#ref_495_29">Pad</A></FONT> : <b>out</b> Character) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_679_14" HREF="terminal_interface-curses-menus__ads.htm#ref_492_14">Pad_Character</A></span> (<span class="symbol"><A NAME="ref_679_29" HREF="terminal_interface-curses-menus__ads.htm#ref_492_29">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_680_29" HREF="terminal_interface-curses-menus__ads.htm#ref_493_29">Pad</A></span> : <b>out</b> Character) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_682_16">Menu_Pad</A></FONT> (<FONT COLOR=red><A NAME="ref_682_26" HREF="terminal_interface-curses-menus__adb.htm#ref_682_16">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_682_16">Menu_Pad</A></span> (<span class="symbol"><A NAME="ref_682_26" HREF="terminal_interface-curses-menus__adb.htm#ref_682_16">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Menu_Pad, "menu_pad"); - <b>begin</b> -- <A HREF="terminal_interface-curses-menus__ads.htm#ref_495_29">Pad</A> := Character'Val (<A HREF="terminal_interface-curses-menus__adb.htm#ref_682_16">Menu_Pad</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_494_29">Men</A>)); -- <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_494_14">Pad_Character</A>; --<FONT COLOR=green><EM>-------------------------------------------------------------------------------</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_688_14" HREF="terminal_interface-curses-menus__ads.htm#ref_504_14">Set_Spacing</A></FONT> (<FONT COLOR=red><A NAME="ref_688_27" HREF="terminal_interface-curses-menus__ads.htm#ref_504_27">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_689_27" HREF="terminal_interface-curses-menus__ads.htm#ref_505_27">Descr</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A> := 0; -- <FONT COLOR=red><A NAME="ref_690_27" HREF="terminal_interface-curses-menus__ads.htm#ref_506_27">Row</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A> := 0; -- <FONT COLOR=red><A NAME="ref_691_27" HREF="terminal_interface-curses-menus__ads.htm#ref_507_27">Col</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A> := 0) -+ <A HREF="terminal_interface-curses-menus__ads.htm#ref_493_29">Pad</A> := Character'Val (<A HREF="terminal_interface-curses-menus__adb.htm#ref_682_16">Menu_Pad</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_492_29">Men</A>)); -+ <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_492_14">Pad_Character</A>; -+<span class="comment"><EM>-------------------------------------------------------------------------------</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_688_14" HREF="terminal_interface-curses-menus__ads.htm#ref_502_14">Set_Spacing</A></span> (<span class="symbol"><A NAME="ref_688_27" HREF="terminal_interface-curses-menus__ads.htm#ref_502_27">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_689_27" HREF="terminal_interface-curses-menus__ads.htm#ref_503_27">Descr</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A> := 0; -+ <span class="symbol"><A NAME="ref_690_27" HREF="terminal_interface-curses-menus__ads.htm#ref_504_27">Row</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A> := 0; -+ <span class="symbol"><A NAME="ref_691_27" HREF="terminal_interface-curses-menus__ads.htm#ref_505_27">Col</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A> := 0) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_693_16">Set_Spacing</A></FONT> (<FONT COLOR=red><A NAME="ref_693_29" HREF="terminal_interface-curses-menus__adb.htm#ref_693_16">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_694_29" HREF="terminal_interface-curses-menus__adb.htm#ref_693_16">D</A></FONT>, <FONT COLOR=red><A NAME="ref_694_32" HREF="terminal_interface-curses-menus__adb.htm#ref_693_16">R</A></FONT>, <FONT COLOR=red><A NAME="ref_694_35" HREF="terminal_interface-curses-menus__adb.htm#ref_693_16">C</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_693_16">Set_Spacing</A></span> (<span class="symbol"><A NAME="ref_693_29" HREF="terminal_interface-curses-menus__adb.htm#ref_693_16">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_694_29" HREF="terminal_interface-curses-menus__adb.htm#ref_693_16">D</A></span>, <span class="symbol"><A NAME="ref_694_32" HREF="terminal_interface-curses-menus__adb.htm#ref_693_16">R</A></span>, <span class="symbol"><A NAME="ref_694_35" HREF="terminal_interface-curses-menus__adb.htm#ref_693_16">C</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Set_Spacing, "set_menu_spacing"); - -- <FONT COLOR=red><A NAME="ref_697_7">Res</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := <A HREF="terminal_interface-curses-menus__adb.htm#ref_693_16">Set_Spacing</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_504_27">Men</A>, -- <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_505_27">Descr</A>), -- <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_506_27">Row</A>), -- <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_507_27">Col</A>)); -+ <span class="symbol"><A NAME="ref_697_7">Res</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := <A HREF="terminal_interface-curses-menus__adb.htm#ref_693_16">Set_Spacing</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_502_27">Men</A>, -+ <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_503_27">Descr</A>), -+ <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_504_27">Row</A>), -+ <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_505_27">Col</A>)); - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses-menus__adb.htm#ref_697_7">Res</A> /= <A HREF="terminal_interface-curses-aux__ads.htm#ref_80_4">E_Ok</A> <b>then</b> - <A HREF="terminal_interface-curses-aux__ads.htm#ref_96_14">Eti_Exception</A> (<A HREF="terminal_interface-curses-menus__adb.htm#ref_697_7">Res</A>); - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_504_14">Set_Spacing</A>; -+ <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_502_14">Set_Spacing</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_707_14" HREF="terminal_interface-curses-menus__ads.htm#ref_512_14">Spacing</A></FONT> (<FONT COLOR=red><A NAME="ref_707_23" HREF="terminal_interface-curses-menus__ads.htm#ref_512_23">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_708_23" HREF="terminal_interface-curses-menus__ads.htm#ref_513_23">Descr</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -- <FONT COLOR=red><A NAME="ref_709_23" HREF="terminal_interface-curses-menus__ads.htm#ref_514_23">Row</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_710_23" HREF="terminal_interface-curses-menus__ads.htm#ref_515_23">Col</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>) -- <b>is</b> -- <b>type</b> <FONT COLOR=red><A NAME="ref_712_12">C_Int_Access</A></FONT> <b>is</b> <b>access</b> <b>all</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -- <b>function</b> <FONT COLOR=red><A NAME="ref_713_16">Get_Spacing</A></FONT> (<FONT COLOR=red><A NAME="ref_713_29" HREF="terminal_interface-curses-menus__adb.htm#ref_713_16">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_714_29" HREF="terminal_interface-curses-menus__adb.htm#ref_713_16">D</A></FONT>, <FONT COLOR=red><A NAME="ref_714_32" HREF="terminal_interface-curses-menus__adb.htm#ref_713_16">R</A></FONT>, <FONT COLOR=red><A NAME="ref_714_35" HREF="terminal_interface-curses-menus__adb.htm#ref_713_16">C</A></FONT> : <A HREF="terminal_interface-curses-menus__adb.htm#ref_712_12">C_Int_Access</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>procedure</b> <span class="symbol"><A NAME="ref_707_14" HREF="terminal_interface-curses-menus__ads.htm#ref_510_14">Spacing</A></span> (<span class="symbol"><A NAME="ref_707_23" HREF="terminal_interface-curses-menus__ads.htm#ref_510_23">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_708_23" HREF="terminal_interface-curses-menus__ads.htm#ref_511_23">Descr</A></span> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -+ <span class="symbol"><A NAME="ref_709_23" HREF="terminal_interface-curses-menus__ads.htm#ref_512_23">Row</A></span> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_710_23" HREF="terminal_interface-curses-menus__ads.htm#ref_513_23">Col</A></span> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>) -+ <b>is</b> -+ <b>type</b> <span class="symbol"><A NAME="ref_712_12">C_Int_Access</A></span> <b>is</b> <b>access</b> <b>all</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_713_16">Get_Spacing</A></span> (<span class="symbol"><A NAME="ref_713_29" HREF="terminal_interface-curses-menus__adb.htm#ref_713_16">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_714_29" HREF="terminal_interface-curses-menus__adb.htm#ref_713_16">D</A></span>, <span class="symbol"><A NAME="ref_714_32" HREF="terminal_interface-curses-menus__adb.htm#ref_713_16">R</A></span>, <span class="symbol"><A NAME="ref_714_35" HREF="terminal_interface-curses-menus__adb.htm#ref_713_16">C</A></span> : <A HREF="terminal_interface-curses-menus__adb.htm#ref_712_12">C_Int_Access</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Get_Spacing, "menu_spacing"); - -- <FONT COLOR=red><A NAME="ref_717_7">D</A></FONT>, <FONT COLOR=red><A NAME="ref_717_10">R</A></FONT>, <FONT COLOR=red><A NAME="ref_717_13">C</A></FONT> : <b>aliased</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -- <FONT COLOR=red><A NAME="ref_718_7">Res</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := <A HREF="terminal_interface-curses-menus__adb.htm#ref_713_16">Get_Spacing</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_512_23">Men</A>, -+ <span class="symbol"><A NAME="ref_717_7">D</A></span>, <span class="symbol"><A NAME="ref_717_10">R</A></span>, <span class="symbol"><A NAME="ref_717_13">C</A></span> : <b>aliased</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <span class="symbol"><A NAME="ref_718_7">Res</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := <A HREF="terminal_interface-curses-menus__adb.htm#ref_713_16">Get_Spacing</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_510_23">Men</A>, - <A HREF="terminal_interface-curses-menus__adb.htm#ref_717_7">D</A>'<b>Access</b>, - <A HREF="terminal_interface-curses-menus__adb.htm#ref_717_10">R</A>'<b>Access</b>, - <A HREF="terminal_interface-curses-menus__adb.htm#ref_717_13">C</A>'<b>Access</b>); -@@ -728,26 +740,26 @@ - <b>if</b> <A HREF="terminal_interface-curses-menus__adb.htm#ref_718_7">Res</A> /= <A HREF="terminal_interface-curses-aux__ads.htm#ref_80_4">E_Ok</A> <b>then</b> - <A HREF="terminal_interface-curses-aux__ads.htm#ref_96_14">Eti_Exception</A> (<A HREF="terminal_interface-curses-menus__adb.htm#ref_718_7">Res</A>); - <b>else</b> -- <A HREF="terminal_interface-curses-menus__ads.htm#ref_513_23">Descr</A> := <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A> (<A HREF="terminal_interface-curses-menus__adb.htm#ref_717_7">D</A>); -- <A HREF="terminal_interface-curses-menus__ads.htm#ref_514_23">Row</A> := <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A> (<A HREF="terminal_interface-curses-menus__adb.htm#ref_717_10">R</A>); -- <A HREF="terminal_interface-curses-menus__ads.htm#ref_515_23">Col</A> := <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A> (<A HREF="terminal_interface-curses-menus__adb.htm#ref_717_13">C</A>); -- <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_512_14">Spacing</A>; --<FONT COLOR=green><EM>-------------------------------------------------------------------------------</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_732_13" HREF="terminal_interface-curses-menus__ads.htm#ref_524_13">Set_Pattern</A></FONT> (<FONT COLOR=red><A NAME="ref_732_26" HREF="terminal_interface-curses-menus__ads.htm#ref_524_26">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_733_26" HREF="terminal_interface-curses-menus__ads.htm#ref_525_26">Text</A></FONT> : String) <b>return</b> Boolean -- <b>is</b> -- <b>type</b> <FONT COLOR=red><A NAME="ref_735_12">Char_Ptr</A></FONT> <b>is</b> <b>access</b> <b>all</b> <A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>.C.char; -- <b>function</b> <FONT COLOR=red><A NAME="ref_736_16">Set_Pattern</A></FONT> (<FONT COLOR=red><A NAME="ref_736_29" HREF="terminal_interface-curses-menus__adb.htm#ref_736_16">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_737_29" HREF="terminal_interface-curses-menus__adb.htm#ref_736_16">Pattern</A></FONT> : <A HREF="terminal_interface-curses-menus__adb.htm#ref_735_12">Char_Ptr</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <A HREF="terminal_interface-curses-menus__ads.htm#ref_511_23">Descr</A> := <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A> (<A HREF="terminal_interface-curses-menus__adb.htm#ref_717_7">D</A>); -+ <A HREF="terminal_interface-curses-menus__ads.htm#ref_512_23">Row</A> := <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A> (<A HREF="terminal_interface-curses-menus__adb.htm#ref_717_10">R</A>); -+ <A HREF="terminal_interface-curses-menus__ads.htm#ref_513_23">Col</A> := <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A> (<A HREF="terminal_interface-curses-menus__adb.htm#ref_717_13">C</A>); -+ <b>end</b> <b>if</b>; -+ <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_510_14">Spacing</A>; -+<span class="comment"><EM>-------------------------------------------------------------------------------</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_732_13" HREF="terminal_interface-curses-menus__ads.htm#ref_522_13">Set_Pattern</A></span> (<span class="symbol"><A NAME="ref_732_26" HREF="terminal_interface-curses-menus__ads.htm#ref_522_26">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_733_26" HREF="terminal_interface-curses-menus__ads.htm#ref_523_26">Text</A></span> : String) <b>return</b> Boolean -+ <b>is</b> -+ <b>type</b> <span class="symbol"><A NAME="ref_735_12">Char_Ptr</A></span> <b>is</b> <b>access</b> <b>all</b> <A HREF="interfac__ads.htm#ref_36_9">Interfaces</A>.C.char; -+ <b>function</b> <span class="symbol"><A NAME="ref_736_16">Set_Pattern</A></span> (<span class="symbol"><A NAME="ref_736_29" HREF="terminal_interface-curses-menus__adb.htm#ref_736_16">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_737_29" HREF="terminal_interface-curses-menus__adb.htm#ref_736_16">Pattern</A></span> : <A HREF="terminal_interface-curses-menus__adb.htm#ref_735_12">Char_Ptr</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Set_Pattern, "set_menu_pattern"); - -- <FONT COLOR=red><A NAME="ref_740_7">S</A></FONT> : char_array (0 .. <A HREF="terminal_interface-curses-menus__ads.htm#ref_525_26">Text</A>'Length); -- <FONT COLOR=red><A NAME="ref_741_7">L</A></FONT> : size_t; -- <FONT COLOR=red><A NAME="ref_742_7">Res</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A>; -+ <span class="symbol"><A NAME="ref_740_7">S</A></span> : char_array (0 .. <A HREF="terminal_interface-curses-menus__ads.htm#ref_523_26">Text</A>'Length); -+ <span class="symbol"><A NAME="ref_741_7">L</A></span> : size_t; -+ <span class="symbol"><A NAME="ref_742_7">Res</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A>; - <b>begin</b> -- To_C (<A HREF="terminal_interface-curses-menus__ads.htm#ref_525_26">Text</A>, <A HREF="terminal_interface-curses-menus__adb.htm#ref_740_7">S</A>, <A HREF="terminal_interface-curses-menus__adb.htm#ref_741_7">L</A>); -- <A HREF="terminal_interface-curses-menus__adb.htm#ref_742_7">Res</A> := <A HREF="terminal_interface-curses-menus__adb.htm#ref_736_16">Set_Pattern</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_524_26">Men</A>, <A HREF="terminal_interface-curses-menus__adb.htm#ref_740_7">S</A> (<A HREF="terminal_interface-curses-menus__adb.htm#ref_740_7">S</A>'First)'<b>Access</b>); -+ To_C (<A HREF="terminal_interface-curses-menus__ads.htm#ref_523_26">Text</A>, <A HREF="terminal_interface-curses-menus__adb.htm#ref_740_7">S</A>, <A HREF="terminal_interface-curses-menus__adb.htm#ref_741_7">L</A>); -+ <A HREF="terminal_interface-curses-menus__adb.htm#ref_742_7">Res</A> := <A HREF="terminal_interface-curses-menus__adb.htm#ref_736_16">Set_Pattern</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_522_26">Men</A>, <A HREF="terminal_interface-curses-menus__adb.htm#ref_740_7">S</A> (<A HREF="terminal_interface-curses-menus__adb.htm#ref_740_7">S</A>'First)'<b>Access</b>); - <b>case</b> <A HREF="terminal_interface-curses-menus__adb.htm#ref_742_7">Res</A> <b>is</b> - <b>when</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_89_4">E_No_Match</A> =&gt; <b>return</b> False; - <b>when</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_80_4">E_Ok</A> =&gt; <b>return</b> True; -@@ -755,274 +767,274 @@ - <A HREF="terminal_interface-curses-aux__ads.htm#ref_96_14">Eti_Exception</A> (<A HREF="terminal_interface-curses-menus__adb.htm#ref_742_7">Res</A>); - <b>return</b> False; - <b>end</b> <b>case</b>; -- <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_524_13">Set_Pattern</A>; -+ <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_522_13">Set_Pattern</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_755_14" HREF="terminal_interface-curses-menus__ads.htm#ref_531_14">Pattern</A></FONT> (<FONT COLOR=red><A NAME="ref_755_23" HREF="terminal_interface-curses-menus__ads.htm#ref_531_23">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_756_23" HREF="terminal_interface-curses-menus__ads.htm#ref_532_23">Text</A></FONT> : <b>out</b> String) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_755_14" HREF="terminal_interface-curses-menus__ads.htm#ref_529_14">Pattern</A></span> (<span class="symbol"><A NAME="ref_755_23" HREF="terminal_interface-curses-menus__ads.htm#ref_529_23">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_756_23" HREF="terminal_interface-curses-menus__ads.htm#ref_530_23">Text</A></span> : <b>out</b> String) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_758_16">Get_Pattern</A></FONT> (<FONT COLOR=red><A NAME="ref_758_29" HREF="terminal_interface-curses-menus__adb.htm#ref_758_16">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> <A HREF="terminal_interface-curses-menus__adb.htm#ref_58_12">chars_ptr</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_758_16">Get_Pattern</A></span> (<span class="symbol"><A NAME="ref_758_29" HREF="terminal_interface-curses-menus__adb.htm#ref_758_16">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> <A HREF="terminal_interface-curses-menus__adb.htm#ref_58_12">chars_ptr</A>; - <b>pragma</b> Import (C, Get_Pattern, "menu_pattern"); - <b>begin</b> -- <A HREF="terminal_interface-curses-aux__ads.htm#ref_116_14">Fill_String</A> (<A HREF="terminal_interface-curses-menus__adb.htm#ref_758_16">Get_Pattern</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_531_23">Men</A>), <A HREF="terminal_interface-curses-menus__ads.htm#ref_532_23">Text</A>); -- <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_531_14">Pattern</A>; --<FONT COLOR=green><EM>-------------------------------------------------------------------------------</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_764_14" HREF="terminal_interface-curses-menus__ads.htm#ref_541_14">Set_Format</A></FONT> (<FONT COLOR=red><A NAME="ref_764_26" HREF="terminal_interface-curses-menus__ads.htm#ref_541_26">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_765_26" HREF="terminal_interface-curses-menus__ads.htm#ref_542_26">Lines</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_63_12">Line_Count</A>; -- <FONT COLOR=red><A NAME="ref_766_26" HREF="terminal_interface-curses-menus__ads.htm#ref_543_26">Columns</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_65_12">Column_Count</A>) -- <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_768_16">Set_Menu_Fmt</A></FONT> (<FONT COLOR=red><A NAME="ref_768_30" HREF="terminal_interface-curses-menus__adb.htm#ref_768_16">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_769_30" HREF="terminal_interface-curses-menus__adb.htm#ref_768_16">Lin</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -- <FONT COLOR=red><A NAME="ref_770_30" HREF="terminal_interface-curses-menus__adb.htm#ref_768_16">Col</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <A HREF="terminal_interface-curses-aux__ads.htm#ref_116_14">Fill_String</A> (<A HREF="terminal_interface-curses-menus__adb.htm#ref_758_16">Get_Pattern</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_529_23">Men</A>), <A HREF="terminal_interface-curses-menus__ads.htm#ref_530_23">Text</A>); -+ <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_529_14">Pattern</A>; -+<span class="comment"><EM>-------------------------------------------------------------------------------</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_764_14" HREF="terminal_interface-curses-menus__ads.htm#ref_539_14">Set_Format</A></span> (<span class="symbol"><A NAME="ref_764_26" HREF="terminal_interface-curses-menus__ads.htm#ref_539_26">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_765_26" HREF="terminal_interface-curses-menus__ads.htm#ref_540_26">Lines</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_63_12">Line_Count</A>; -+ <span class="symbol"><A NAME="ref_766_26" HREF="terminal_interface-curses-menus__ads.htm#ref_541_26">Columns</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_65_12">Column_Count</A>) -+ <b>is</b> -+ <b>function</b> <span class="symbol"><A NAME="ref_768_16">Set_Menu_Fmt</A></span> (<span class="symbol"><A NAME="ref_768_30" HREF="terminal_interface-curses-menus__adb.htm#ref_768_16">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_769_30" HREF="terminal_interface-curses-menus__adb.htm#ref_768_16">Lin</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <span class="symbol"><A NAME="ref_770_30" HREF="terminal_interface-curses-menus__adb.htm#ref_768_16">Col</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Set_Menu_Fmt, "set_menu_format"); - -- <FONT COLOR=red><A NAME="ref_773_7">Res</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := <A HREF="terminal_interface-curses-menus__adb.htm#ref_768_16">Set_Menu_Fmt</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_541_26">Men</A>, -- <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_542_26">Lines</A>), -- <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_543_26">Columns</A>)); -+ <span class="symbol"><A NAME="ref_773_7">Res</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := <A HREF="terminal_interface-curses-menus__adb.htm#ref_768_16">Set_Menu_Fmt</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_539_26">Men</A>, -+ <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_540_26">Lines</A>), -+ <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_541_26">Columns</A>)); - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses-menus__adb.htm#ref_773_7">Res</A> /= <A HREF="terminal_interface-curses-aux__ads.htm#ref_80_4">E_Ok</A> <b>then</b> - <A HREF="terminal_interface-curses-aux__ads.htm#ref_96_14">Eti_Exception</A> (<A HREF="terminal_interface-curses-menus__adb.htm#ref_773_7">Res</A>); - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_541_14">Set_Format</A>; -+ <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_539_14">Set_Format</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_782_14" HREF="terminal_interface-curses-menus__ads.htm#ref_555_14">Format</A></FONT> (<FONT COLOR=red><A NAME="ref_782_22" HREF="terminal_interface-curses-menus__ads.htm#ref_555_22">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_783_22" HREF="terminal_interface-curses-menus__ads.htm#ref_556_22">Lines</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_63_12">Line_Count</A>; -- <FONT COLOR=red><A NAME="ref_784_22" HREF="terminal_interface-curses-menus__ads.htm#ref_557_22">Columns</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_65_12">Column_Count</A>) -- <b>is</b> -- <b>type</b> <FONT COLOR=red><A NAME="ref_786_12">C_Int_Access</A></FONT> <b>is</b> <b>access</b> <b>all</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -- <b>function</b> <FONT COLOR=red><A NAME="ref_787_16">Menu_Fmt</A></FONT> (<FONT COLOR=red><A NAME="ref_787_26" HREF="terminal_interface-curses-menus__adb.htm#ref_787_16">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_788_26" HREF="terminal_interface-curses-menus__adb.htm#ref_787_16">Y</A></FONT>, <FONT COLOR=red><A NAME="ref_788_29" HREF="terminal_interface-curses-menus__adb.htm#ref_787_16">X</A></FONT> : <A HREF="terminal_interface-curses-menus__adb.htm#ref_786_12">C_Int_Access</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>procedure</b> <span class="symbol"><A NAME="ref_782_14" HREF="terminal_interface-curses-menus__ads.htm#ref_553_14">Format</A></span> (<span class="symbol"><A NAME="ref_782_22" HREF="terminal_interface-curses-menus__ads.htm#ref_553_22">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_783_22" HREF="terminal_interface-curses-menus__ads.htm#ref_554_22">Lines</A></span> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_63_12">Line_Count</A>; -+ <span class="symbol"><A NAME="ref_784_22" HREF="terminal_interface-curses-menus__ads.htm#ref_555_22">Columns</A></span> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_65_12">Column_Count</A>) -+ <b>is</b> -+ <b>type</b> <span class="symbol"><A NAME="ref_786_12">C_Int_Access</A></span> <b>is</b> <b>access</b> <b>all</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_787_16">Menu_Fmt</A></span> (<span class="symbol"><A NAME="ref_787_26" HREF="terminal_interface-curses-menus__adb.htm#ref_787_16">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_788_26" HREF="terminal_interface-curses-menus__adb.htm#ref_787_16">Y</A></span>, <span class="symbol"><A NAME="ref_788_29" HREF="terminal_interface-curses-menus__adb.htm#ref_787_16">X</A></span> : <A HREF="terminal_interface-curses-menus__adb.htm#ref_786_12">C_Int_Access</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Menu_Fmt, "menu_format"); - -- <FONT COLOR=red><A NAME="ref_791_7">L</A></FONT>, <FONT COLOR=red><A NAME="ref_791_10">C</A></FONT> : <b>aliased</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -- <FONT COLOR=red><A NAME="ref_792_7">Res</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := <A HREF="terminal_interface-curses-menus__adb.htm#ref_787_16">Menu_Fmt</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_555_22">Men</A>, <A HREF="terminal_interface-curses-menus__adb.htm#ref_791_7">L</A>'<b>Access</b>, <A HREF="terminal_interface-curses-menus__adb.htm#ref_791_10">C</A>'<b>Access</b>); -+ <span class="symbol"><A NAME="ref_791_7">L</A></span>, <span class="symbol"><A NAME="ref_791_10">C</A></span> : <b>aliased</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <span class="symbol"><A NAME="ref_792_7">Res</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := <A HREF="terminal_interface-curses-menus__adb.htm#ref_787_16">Menu_Fmt</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_553_22">Men</A>, <A HREF="terminal_interface-curses-menus__adb.htm#ref_791_7">L</A>'<b>Access</b>, <A HREF="terminal_interface-curses-menus__adb.htm#ref_791_10">C</A>'<b>Access</b>); - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses-menus__adb.htm#ref_792_7">Res</A> /= <A HREF="terminal_interface-curses-aux__ads.htm#ref_80_4">E_Ok</A> <b>then</b> - <A HREF="terminal_interface-curses-aux__ads.htm#ref_96_14">Eti_Exception</A> (<A HREF="terminal_interface-curses-menus__adb.htm#ref_792_7">Res</A>); - <b>else</b> -- <A HREF="terminal_interface-curses-menus__ads.htm#ref_556_22">Lines</A> := <A HREF="terminal_interface-curses__ads.htm#ref_63_12">Line_Count</A> (<A HREF="terminal_interface-curses-menus__adb.htm#ref_791_7">L</A>); -- <A HREF="terminal_interface-curses-menus__ads.htm#ref_557_22">Columns</A> := <A HREF="terminal_interface-curses__ads.htm#ref_65_12">Column_Count</A> (<A HREF="terminal_interface-curses-menus__adb.htm#ref_791_10">C</A>); -+ <A HREF="terminal_interface-curses-menus__ads.htm#ref_554_22">Lines</A> := <A HREF="terminal_interface-curses__ads.htm#ref_63_12">Line_Count</A> (<A HREF="terminal_interface-curses-menus__adb.htm#ref_791_7">L</A>); -+ <A HREF="terminal_interface-curses-menus__ads.htm#ref_555_22">Columns</A> := <A HREF="terminal_interface-curses__ads.htm#ref_65_12">Column_Count</A> (<A HREF="terminal_interface-curses-menus__adb.htm#ref_791_10">C</A>); - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_555_14">Format</A>; --<FONT COLOR=green><EM>-------------------------------------------------------------------------------</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_802_14" HREF="terminal_interface-curses-menus__ads.htm#ref_569_14">Set_Item_Init_Hook</A></FONT> (<FONT COLOR=red><A NAME="ref_802_34" HREF="terminal_interface-curses-menus__ads.htm#ref_569_34">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_803_34" HREF="terminal_interface-curses-menus__ads.htm#ref_570_34">Proc</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_565_9">Menu_Hook_Function</A>) -+ <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_553_14">Format</A>; -+<span class="comment"><EM>-------------------------------------------------------------------------------</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_802_14" HREF="terminal_interface-curses-menus__ads.htm#ref_567_14">Set_Item_Init_Hook</A></span> (<span class="symbol"><A NAME="ref_802_34" HREF="terminal_interface-curses-menus__ads.htm#ref_567_34">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_803_34" HREF="terminal_interface-curses-menus__ads.htm#ref_568_34">Proc</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_563_9">Menu_Hook_Function</A>) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_805_16">Set_Item_Init</A></FONT> (<FONT COLOR=red><A NAME="ref_805_31" HREF="terminal_interface-curses-menus__adb.htm#ref_805_16">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_806_31" HREF="terminal_interface-curses-menus__adb.htm#ref_805_16">Proc</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_565_9">Menu_Hook_Function</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_805_16">Set_Item_Init</A></span> (<span class="symbol"><A NAME="ref_805_31" HREF="terminal_interface-curses-menus__adb.htm#ref_805_16">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_806_31" HREF="terminal_interface-curses-menus__adb.htm#ref_805_16">Proc</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_563_9">Menu_Hook_Function</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Set_Item_Init, "set_item_init"); - -- <FONT COLOR=red><A NAME="ref_809_7">Res</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := <A HREF="terminal_interface-curses-menus__adb.htm#ref_805_16">Set_Item_Init</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_569_34">Men</A>, <A HREF="terminal_interface-curses-menus__ads.htm#ref_570_34">Proc</A>); -+ <span class="symbol"><A NAME="ref_809_7">Res</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := <A HREF="terminal_interface-curses-menus__adb.htm#ref_805_16">Set_Item_Init</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_567_34">Men</A>, <A HREF="terminal_interface-curses-menus__ads.htm#ref_568_34">Proc</A>); - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses-menus__adb.htm#ref_809_7">Res</A> /= <A HREF="terminal_interface-curses-aux__ads.htm#ref_80_4">E_Ok</A> <b>then</b> - <A HREF="terminal_interface-curses-aux__ads.htm#ref_96_14">Eti_Exception</A> (<A HREF="terminal_interface-curses-menus__adb.htm#ref_809_7">Res</A>); - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_569_14">Set_Item_Init_Hook</A>; -+ <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_567_14">Set_Item_Init_Hook</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_816_14" HREF="terminal_interface-curses-menus__ads.htm#ref_575_14">Set_Item_Term_Hook</A></FONT> (<FONT COLOR=red><A NAME="ref_816_34" HREF="terminal_interface-curses-menus__ads.htm#ref_575_34">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_817_34" HREF="terminal_interface-curses-menus__ads.htm#ref_576_34">Proc</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_565_9">Menu_Hook_Function</A>) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_816_14" HREF="terminal_interface-curses-menus__ads.htm#ref_573_14">Set_Item_Term_Hook</A></span> (<span class="symbol"><A NAME="ref_816_34" HREF="terminal_interface-curses-menus__ads.htm#ref_573_34">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_817_34" HREF="terminal_interface-curses-menus__ads.htm#ref_574_34">Proc</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_563_9">Menu_Hook_Function</A>) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_819_16">Set_Item_Term</A></FONT> (<FONT COLOR=red><A NAME="ref_819_31" HREF="terminal_interface-curses-menus__adb.htm#ref_819_16">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_820_31" HREF="terminal_interface-curses-menus__adb.htm#ref_819_16">Proc</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_565_9">Menu_Hook_Function</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_819_16">Set_Item_Term</A></span> (<span class="symbol"><A NAME="ref_819_31" HREF="terminal_interface-curses-menus__adb.htm#ref_819_16">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_820_31" HREF="terminal_interface-curses-menus__adb.htm#ref_819_16">Proc</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_563_9">Menu_Hook_Function</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Set_Item_Term, "set_item_term"); - -- <FONT COLOR=red><A NAME="ref_823_7">Res</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := <A HREF="terminal_interface-curses-menus__adb.htm#ref_819_16">Set_Item_Term</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_575_34">Men</A>, <A HREF="terminal_interface-curses-menus__ads.htm#ref_576_34">Proc</A>); -+ <span class="symbol"><A NAME="ref_823_7">Res</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := <A HREF="terminal_interface-curses-menus__adb.htm#ref_819_16">Set_Item_Term</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_573_34">Men</A>, <A HREF="terminal_interface-curses-menus__ads.htm#ref_574_34">Proc</A>); - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses-menus__adb.htm#ref_823_7">Res</A> /= <A HREF="terminal_interface-curses-aux__ads.htm#ref_80_4">E_Ok</A> <b>then</b> - <A HREF="terminal_interface-curses-aux__ads.htm#ref_96_14">Eti_Exception</A> (<A HREF="terminal_interface-curses-menus__adb.htm#ref_823_7">Res</A>); - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_575_14">Set_Item_Term_Hook</A>; -+ <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_573_14">Set_Item_Term_Hook</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_830_14" HREF="terminal_interface-curses-menus__ads.htm#ref_581_14">Set_Menu_Init_Hook</A></FONT> (<FONT COLOR=red><A NAME="ref_830_34" HREF="terminal_interface-curses-menus__ads.htm#ref_581_34">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_831_34" HREF="terminal_interface-curses-menus__ads.htm#ref_582_34">Proc</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_565_9">Menu_Hook_Function</A>) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_830_14" HREF="terminal_interface-curses-menus__ads.htm#ref_579_14">Set_Menu_Init_Hook</A></span> (<span class="symbol"><A NAME="ref_830_34" HREF="terminal_interface-curses-menus__ads.htm#ref_579_34">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_831_34" HREF="terminal_interface-curses-menus__ads.htm#ref_580_34">Proc</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_563_9">Menu_Hook_Function</A>) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_833_16">Set_Menu_Init</A></FONT> (<FONT COLOR=red><A NAME="ref_833_31" HREF="terminal_interface-curses-menus__adb.htm#ref_833_16">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_834_31" HREF="terminal_interface-curses-menus__adb.htm#ref_833_16">Proc</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_565_9">Menu_Hook_Function</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_833_16">Set_Menu_Init</A></span> (<span class="symbol"><A NAME="ref_833_31" HREF="terminal_interface-curses-menus__adb.htm#ref_833_16">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_834_31" HREF="terminal_interface-curses-menus__adb.htm#ref_833_16">Proc</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_563_9">Menu_Hook_Function</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Set_Menu_Init, "set_menu_init"); - -- <FONT COLOR=red><A NAME="ref_837_7">Res</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := <A HREF="terminal_interface-curses-menus__adb.htm#ref_833_16">Set_Menu_Init</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_581_34">Men</A>, <A HREF="terminal_interface-curses-menus__ads.htm#ref_582_34">Proc</A>); -+ <span class="symbol"><A NAME="ref_837_7">Res</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := <A HREF="terminal_interface-curses-menus__adb.htm#ref_833_16">Set_Menu_Init</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_579_34">Men</A>, <A HREF="terminal_interface-curses-menus__ads.htm#ref_580_34">Proc</A>); - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses-menus__adb.htm#ref_837_7">Res</A> /= <A HREF="terminal_interface-curses-aux__ads.htm#ref_80_4">E_Ok</A> <b>then</b> - <A HREF="terminal_interface-curses-aux__ads.htm#ref_96_14">Eti_Exception</A> (<A HREF="terminal_interface-curses-menus__adb.htm#ref_837_7">Res</A>); - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_581_14">Set_Menu_Init_Hook</A>; -+ <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_579_14">Set_Menu_Init_Hook</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_844_14" HREF="terminal_interface-curses-menus__ads.htm#ref_587_14">Set_Menu_Term_Hook</A></FONT> (<FONT COLOR=red><A NAME="ref_844_34" HREF="terminal_interface-curses-menus__ads.htm#ref_587_34">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_845_34" HREF="terminal_interface-curses-menus__ads.htm#ref_588_34">Proc</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_565_9">Menu_Hook_Function</A>) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_844_14" HREF="terminal_interface-curses-menus__ads.htm#ref_585_14">Set_Menu_Term_Hook</A></span> (<span class="symbol"><A NAME="ref_844_34" HREF="terminal_interface-curses-menus__ads.htm#ref_585_34">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_845_34" HREF="terminal_interface-curses-menus__ads.htm#ref_586_34">Proc</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_563_9">Menu_Hook_Function</A>) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_847_16">Set_Menu_Term</A></FONT> (<FONT COLOR=red><A NAME="ref_847_31" HREF="terminal_interface-curses-menus__adb.htm#ref_847_16">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_848_31" HREF="terminal_interface-curses-menus__adb.htm#ref_847_16">Proc</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_565_9">Menu_Hook_Function</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_847_16">Set_Menu_Term</A></span> (<span class="symbol"><A NAME="ref_847_31" HREF="terminal_interface-curses-menus__adb.htm#ref_847_16">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_848_31" HREF="terminal_interface-curses-menus__adb.htm#ref_847_16">Proc</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_563_9">Menu_Hook_Function</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Set_Menu_Term, "set_menu_term"); - -- <FONT COLOR=red><A NAME="ref_851_7">Res</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := <A HREF="terminal_interface-curses-menus__adb.htm#ref_847_16">Set_Menu_Term</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_587_34">Men</A>, <A HREF="terminal_interface-curses-menus__ads.htm#ref_588_34">Proc</A>); -+ <span class="symbol"><A NAME="ref_851_7">Res</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := <A HREF="terminal_interface-curses-menus__adb.htm#ref_847_16">Set_Menu_Term</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_585_34">Men</A>, <A HREF="terminal_interface-curses-menus__ads.htm#ref_586_34">Proc</A>); - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses-menus__adb.htm#ref_851_7">Res</A> /= <A HREF="terminal_interface-curses-aux__ads.htm#ref_80_4">E_Ok</A> <b>then</b> - <A HREF="terminal_interface-curses-aux__ads.htm#ref_96_14">Eti_Exception</A> (<A HREF="terminal_interface-curses-menus__adb.htm#ref_851_7">Res</A>); - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_587_14">Set_Menu_Term_Hook</A>; -+ <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_585_14">Set_Menu_Term_Hook</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_858_13" HREF="terminal_interface-curses-menus__ads.htm#ref_593_13">Get_Item_Init_Hook</A></FONT> (<FONT COLOR=red><A NAME="ref_858_33" HREF="terminal_interface-curses-menus__ads.htm#ref_593_33">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_565_9">Menu_Hook_Function</A> -+ <b>function</b> <span class="symbol"><A NAME="ref_858_13" HREF="terminal_interface-curses-menus__ads.htm#ref_591_13">Get_Item_Init_Hook</A></span> (<span class="symbol"><A NAME="ref_858_33" HREF="terminal_interface-curses-menus__ads.htm#ref_591_33">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_563_9">Menu_Hook_Function</A> - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_860_16">Item_Init</A></FONT> (<FONT COLOR=red><A NAME="ref_860_27" HREF="terminal_interface-curses-menus__adb.htm#ref_860_16">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_565_9">Menu_Hook_Function</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_860_16">Item_Init</A></span> (<span class="symbol"><A NAME="ref_860_27" HREF="terminal_interface-curses-menus__adb.htm#ref_860_16">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_563_9">Menu_Hook_Function</A>; - <b>pragma</b> Import (C, Item_Init, "item_init"); - <b>begin</b> -- <b>return</b> <A HREF="terminal_interface-curses-menus__adb.htm#ref_860_16">Item_Init</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_593_33">Men</A>); -- <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_593_13">Get_Item_Init_Hook</A>; -+ <b>return</b> <A HREF="terminal_interface-curses-menus__adb.htm#ref_860_16">Item_Init</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_591_33">Men</A>); -+ <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_591_13">Get_Item_Init_Hook</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_866_13" HREF="terminal_interface-curses-menus__ads.htm#ref_598_13">Get_Item_Term_Hook</A></FONT> (<FONT COLOR=red><A NAME="ref_866_33" HREF="terminal_interface-curses-menus__ads.htm#ref_598_33">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_565_9">Menu_Hook_Function</A> -+ <b>function</b> <span class="symbol"><A NAME="ref_866_13" HREF="terminal_interface-curses-menus__ads.htm#ref_596_13">Get_Item_Term_Hook</A></span> (<span class="symbol"><A NAME="ref_866_33" HREF="terminal_interface-curses-menus__ads.htm#ref_596_33">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_563_9">Menu_Hook_Function</A> - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_868_16">Item_Term</A></FONT> (<FONT COLOR=red><A NAME="ref_868_27" HREF="terminal_interface-curses-menus__adb.htm#ref_868_16">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_565_9">Menu_Hook_Function</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_868_16">Item_Term</A></span> (<span class="symbol"><A NAME="ref_868_27" HREF="terminal_interface-curses-menus__adb.htm#ref_868_16">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_563_9">Menu_Hook_Function</A>; - <b>pragma</b> Import (C, Item_Term, "item_term"); - <b>begin</b> -- <b>return</b> <A HREF="terminal_interface-curses-menus__adb.htm#ref_868_16">Item_Term</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_598_33">Men</A>); -- <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_598_13">Get_Item_Term_Hook</A>; -+ <b>return</b> <A HREF="terminal_interface-curses-menus__adb.htm#ref_868_16">Item_Term</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_596_33">Men</A>); -+ <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_596_13">Get_Item_Term_Hook</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_874_13" HREF="terminal_interface-curses-menus__ads.htm#ref_603_13">Get_Menu_Init_Hook</A></FONT> (<FONT COLOR=red><A NAME="ref_874_33" HREF="terminal_interface-curses-menus__ads.htm#ref_603_33">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_565_9">Menu_Hook_Function</A> -+ <b>function</b> <span class="symbol"><A NAME="ref_874_13" HREF="terminal_interface-curses-menus__ads.htm#ref_601_13">Get_Menu_Init_Hook</A></span> (<span class="symbol"><A NAME="ref_874_33" HREF="terminal_interface-curses-menus__ads.htm#ref_601_33">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_563_9">Menu_Hook_Function</A> - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_876_16">Menu_Init</A></FONT> (<FONT COLOR=red><A NAME="ref_876_27" HREF="terminal_interface-curses-menus__adb.htm#ref_876_16">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_565_9">Menu_Hook_Function</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_876_16">Menu_Init</A></span> (<span class="symbol"><A NAME="ref_876_27" HREF="terminal_interface-curses-menus__adb.htm#ref_876_16">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_563_9">Menu_Hook_Function</A>; - <b>pragma</b> Import (C, Menu_Init, "menu_init"); - <b>begin</b> -- <b>return</b> <A HREF="terminal_interface-curses-menus__adb.htm#ref_876_16">Menu_Init</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_603_33">Men</A>); -- <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_603_13">Get_Menu_Init_Hook</A>; -+ <b>return</b> <A HREF="terminal_interface-curses-menus__adb.htm#ref_876_16">Menu_Init</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_601_33">Men</A>); -+ <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_601_13">Get_Menu_Init_Hook</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_882_13" HREF="terminal_interface-curses-menus__ads.htm#ref_608_13">Get_Menu_Term_Hook</A></FONT> (<FONT COLOR=red><A NAME="ref_882_33" HREF="terminal_interface-curses-menus__ads.htm#ref_608_33">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_565_9">Menu_Hook_Function</A> -+ <b>function</b> <span class="symbol"><A NAME="ref_882_13" HREF="terminal_interface-curses-menus__ads.htm#ref_606_13">Get_Menu_Term_Hook</A></span> (<span class="symbol"><A NAME="ref_882_33" HREF="terminal_interface-curses-menus__ads.htm#ref_606_33">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_563_9">Menu_Hook_Function</A> - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_884_16">Menu_Term</A></FONT> (<FONT COLOR=red><A NAME="ref_884_27" HREF="terminal_interface-curses-menus__adb.htm#ref_884_16">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_565_9">Menu_Hook_Function</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_884_16">Menu_Term</A></span> (<span class="symbol"><A NAME="ref_884_27" HREF="terminal_interface-curses-menus__adb.htm#ref_884_16">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_563_9">Menu_Hook_Function</A>; - <b>pragma</b> Import (C, Menu_Term, "menu_term"); - <b>begin</b> -- <b>return</b> <A HREF="terminal_interface-curses-menus__adb.htm#ref_884_16">Menu_Term</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_608_33">Men</A>); -- <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_608_13">Get_Menu_Term_Hook</A>; --<FONT COLOR=green><EM>-------------------------------------------------------------------------------</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_890_14" HREF="terminal_interface-curses-menus__ads.htm#ref_617_14">Redefine</A></FONT> (<FONT COLOR=red><A NAME="ref_890_24" HREF="terminal_interface-curses-menus__ads.htm#ref_617_24">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_891_24" HREF="terminal_interface-curses-menus__ads.htm#ref_618_24">Items</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_182_9">Item_Array_Access</A>) -+ <b>return</b> <A HREF="terminal_interface-curses-menus__adb.htm#ref_884_16">Menu_Term</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_606_33">Men</A>); -+ <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_606_13">Get_Menu_Term_Hook</A>; -+<span class="comment"><EM>-------------------------------------------------------------------------------</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_890_14" HREF="terminal_interface-curses-menus__ads.htm#ref_615_14">Redefine</A></span> (<span class="symbol"><A NAME="ref_890_24" HREF="terminal_interface-curses-menus__ads.htm#ref_615_24">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_891_24" HREF="terminal_interface-curses-menus__ads.htm#ref_616_24">Items</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_180_9">Item_Array_Access</A>) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_893_16">Set_Items</A></FONT> (<FONT COLOR=red><A NAME="ref_893_27" HREF="terminal_interface-curses-menus__adb.htm#ref_893_16">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_894_27" HREF="terminal_interface-curses-menus__adb.htm#ref_893_16">Items</A></FONT> : System.Address) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_893_16">Set_Items</A></span> (<span class="symbol"><A NAME="ref_893_27" HREF="terminal_interface-curses-menus__adb.htm#ref_893_16">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_894_27" HREF="terminal_interface-curses-menus__adb.htm#ref_893_16">Items</A></span> : System.Address) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Set_Items, "set_menu_items"); - -- <FONT COLOR=red><A NAME="ref_897_7">Res</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A>; -+ <span class="symbol"><A NAME="ref_897_7">Res</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A>; - <b>begin</b> -- <b>pragma</b> Assert (<A HREF="terminal_interface-curses-menus__ads.htm#ref_618_24">Items</A>.<b>all</b> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_618_24">Items</A>'Last) = <A HREF="terminal_interface-curses-menus__ads.htm#ref_62_4">Null_Item</A>); -- <b>if</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_618_24">Items</A>.<b>all</b> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_618_24">Items</A>'Last) /= <A HREF="terminal_interface-curses-menus__ads.htm#ref_62_4">Null_Item</A> <b>then</b> -+ <b>pragma</b> Assert (<A HREF="terminal_interface-curses-menus__ads.htm#ref_616_24">Items</A>.<b>all</b> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_616_24">Items</A>'Last) = <A HREF="terminal_interface-curses-menus__ads.htm#ref_62_4">Null_Item</A>); -+ <b>if</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_616_24">Items</A>.<b>all</b> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_616_24">Items</A>'Last) /= <A HREF="terminal_interface-curses-menus__ads.htm#ref_62_4">Null_Item</A> <b>then</b> - <b>raise</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_116_4">Menu_Exception</A>; - <b>else</b> -- <A HREF="terminal_interface-curses-menus__adb.htm#ref_897_7">Res</A> := <A HREF="terminal_interface-curses-menus__adb.htm#ref_893_16">Set_Items</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_617_24">Men</A>, <A HREF="terminal_interface-curses-menus__ads.htm#ref_618_24">Items</A>.<b>all</b>'Address); -+ <A HREF="terminal_interface-curses-menus__adb.htm#ref_897_7">Res</A> := <A HREF="terminal_interface-curses-menus__adb.htm#ref_893_16">Set_Items</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_615_24">Men</A>, <A HREF="terminal_interface-curses-menus__ads.htm#ref_616_24">Items</A>.<b>all</b>'Address); - <b>if</b> <A HREF="terminal_interface-curses-menus__adb.htm#ref_897_7">Res</A> /= <A HREF="terminal_interface-curses-aux__ads.htm#ref_80_4">E_Ok</A> <b>then</b> - <A HREF="terminal_interface-curses-aux__ads.htm#ref_96_14">Eti_Exception</A> (<A HREF="terminal_interface-curses-menus__adb.htm#ref_897_7">Res</A>); - <b>end</b> <b>if</b>; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_617_14">Redefine</A>; -+ <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_615_14">Redefine</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_910_13" HREF="terminal_interface-curses-menus__ads.htm#ref_633_13">Item_Count</A></FONT> (<FONT COLOR=red><A NAME="ref_910_25" HREF="terminal_interface-curses-menus__ads.htm#ref_633_25">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> Natural -+ <b>function</b> <span class="symbol"><A NAME="ref_910_13" HREF="terminal_interface-curses-menus__ads.htm#ref_631_13">Item_Count</A></span> (<span class="symbol"><A NAME="ref_910_25" HREF="terminal_interface-curses-menus__ads.htm#ref_631_25">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> Natural - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_912_16">Count</A></FONT> (<FONT COLOR=red><A NAME="ref_912_23" HREF="terminal_interface-curses-menus__adb.htm#ref_912_16">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_912_16">Count</A></span> (<span class="symbol"><A NAME="ref_912_23" HREF="terminal_interface-curses-menus__adb.htm#ref_912_16">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Count, "item_count"); - <b>begin</b> -- <b>return</b> Natural (<A HREF="terminal_interface-curses-menus__adb.htm#ref_912_16">Count</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_633_25">Men</A>)); -- <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_633_13">Item_Count</A>; -+ <b>return</b> Natural (<A HREF="terminal_interface-curses-menus__adb.htm#ref_912_16">Count</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_631_25">Men</A>)); -+ <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_631_13">Item_Count</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_918_13" HREF="terminal_interface-curses-menus__ads.htm#ref_627_13">Items</A></FONT> (<FONT COLOR=red><A NAME="ref_918_20" HREF="terminal_interface-curses-menus__ads.htm#ref_627_20">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_919_20" HREF="terminal_interface-curses-menus__ads.htm#ref_628_20">Index</A></FONT> : Positive) <b>return</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A> -+ <b>function</b> <span class="symbol"><A NAME="ref_918_13" HREF="terminal_interface-curses-menus__ads.htm#ref_625_13">Items</A></span> (<span class="symbol"><A NAME="ref_918_20" HREF="terminal_interface-curses-menus__ads.htm#ref_625_20">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_919_20" HREF="terminal_interface-curses-menus__ads.htm#ref_626_20">Index</A></span> : Positive) <b>return</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A> - <b>is</b> - <b>use</b> I_Array; - -- <b>function</b> C_Mitems (<FONT COLOR=red><A NAME="ref_923_26">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> Pointer; -+ <b>function</b> C_Mitems (<span class="symbol"><A NAME="ref_923_26">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> Pointer; - <b>pragma</b> Import (C, C_Mitems, "menu_items"); - -- P : Pointer := C_Mitems (<A HREF="terminal_interface-curses-menus__ads.htm#ref_627_20">Men</A>); -+ P : Pointer := C_Mitems (<A HREF="terminal_interface-curses-menus__ads.htm#ref_625_20">Men</A>); - <b>begin</b> -- <b>if</b> P = <b>null</b> <b>or</b> <b>else</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_628_20">Index</A> &gt; <A HREF="terminal_interface-curses-menus__ads.htm#ref_633_13">Item_Count</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_627_20">Men</A>) <b>then</b> -+ <b>if</b> P = <b>null</b> <b>or</b> <b>else</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_626_20">Index</A> &gt; <A HREF="terminal_interface-curses-menus__ads.htm#ref_631_13">Item_Count</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_625_20">Men</A>) <b>then</b> - <b>raise</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_116_4">Menu_Exception</A>; - <b>else</b> -- P := P + ptrdiff_t (<A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_628_20">Index</A>) - 1); -+ P := P + ptrdiff_t (<A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_626_20">Index</A>) - 1); - <b>return</b> P.<b>all</b>; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_627_13">Items</A>; -+ <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_625_13">Items</A>; - --<FONT COLOR=green><EM>-------------------------------------------------------------------------------</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_937_13" HREF="terminal_interface-curses-menus__ads.htm#ref_642_13">Create</A></FONT> (<FONT COLOR=red><A NAME="ref_937_21" HREF="terminal_interface-curses-menus__ads.htm#ref_642_21">Items</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_182_9">Item_Array_Access</A>) <b>return</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A> -+<span class="comment"><EM>-------------------------------------------------------------------------------</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_937_13" HREF="terminal_interface-curses-menus__ads.htm#ref_640_13">Create</A></span> (<span class="symbol"><A NAME="ref_937_21" HREF="terminal_interface-curses-menus__ads.htm#ref_640_21">Items</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_180_9">Item_Array_Access</A>) <b>return</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A> - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_939_16">Newmenu</A></FONT> (<FONT COLOR=red><A NAME="ref_939_25" HREF="terminal_interface-curses-menus__adb.htm#ref_939_16">Items</A></FONT> : System.Address) <b>return</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_939_16">Newmenu</A></span> (<span class="symbol"><A NAME="ref_939_25" HREF="terminal_interface-curses-menus__adb.htm#ref_939_16">Items</A></span> : System.Address) <b>return</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; - <b>pragma</b> Import (C, Newmenu, "new_menu"); - -- <FONT COLOR=red><A NAME="ref_942_7">M</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_942_7">M</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; - <b>begin</b> -- <b>pragma</b> Assert (<A HREF="terminal_interface-curses-menus__ads.htm#ref_642_21">Items</A>.<b>all</b> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_642_21">Items</A>'Last) = <A HREF="terminal_interface-curses-menus__ads.htm#ref_62_4">Null_Item</A>); -- <b>if</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_642_21">Items</A>.<b>all</b> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_642_21">Items</A>'Last) /= <A HREF="terminal_interface-curses-menus__ads.htm#ref_62_4">Null_Item</A> <b>then</b> -+ <b>pragma</b> Assert (<A HREF="terminal_interface-curses-menus__ads.htm#ref_640_21">Items</A>.<b>all</b> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_640_21">Items</A>'Last) = <A HREF="terminal_interface-curses-menus__ads.htm#ref_62_4">Null_Item</A>); -+ <b>if</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_640_21">Items</A>.<b>all</b> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_640_21">Items</A>'Last) /= <A HREF="terminal_interface-curses-menus__ads.htm#ref_62_4">Null_Item</A> <b>then</b> - <b>raise</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_116_4">Menu_Exception</A>; - <b>else</b> -- <A HREF="terminal_interface-curses-menus__adb.htm#ref_942_7">M</A> := <A HREF="terminal_interface-curses-menus__adb.htm#ref_939_16">Newmenu</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_642_21">Items</A>.<b>all</b>'Address); -+ <A HREF="terminal_interface-curses-menus__adb.htm#ref_942_7">M</A> := <A HREF="terminal_interface-curses-menus__adb.htm#ref_939_16">Newmenu</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_640_21">Items</A>.<b>all</b>'Address); - <b>if</b> <A HREF="terminal_interface-curses-menus__adb.htm#ref_942_7">M</A> = <A HREF="terminal_interface-curses-menus__ads.htm#ref_63_4">Null_Menu</A> <b>then</b> - <b>raise</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_116_4">Menu_Exception</A>; - <b>end</b> <b>if</b>; - <b>return</b> <A HREF="terminal_interface-curses-menus__adb.htm#ref_942_7">M</A>; - <b>end</b> <b>if</b>; -- <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_642_13">Create</A>; -+ <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_640_13">Create</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_956_14" HREF="terminal_interface-curses-menus__ads.htm#ref_649_14">Delete</A></FONT> (<FONT COLOR=red><A NAME="ref_956_22" HREF="terminal_interface-curses-menus__ads.htm#ref_649_22">Men</A></FONT> : <b>in</b> <b>out</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_956_14" HREF="terminal_interface-curses-menus__ads.htm#ref_647_14">Delete</A></span> (<span class="symbol"><A NAME="ref_956_22" HREF="terminal_interface-curses-menus__ads.htm#ref_647_22">Men</A></span> : <b>in</b> <b>out</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_958_16">Free</A></FONT> (<FONT COLOR=red><A NAME="ref_958_22" HREF="terminal_interface-curses-menus__adb.htm#ref_958_16">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_958_16">Free</A></span> (<span class="symbol"><A NAME="ref_958_22" HREF="terminal_interface-curses-menus__adb.htm#ref_958_16">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Free, "free_menu"); - -- <FONT COLOR=red><A NAME="ref_961_7">Res</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := <A HREF="terminal_interface-curses-menus__adb.htm#ref_958_16">Free</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_649_22">Men</A>); -+ <span class="symbol"><A NAME="ref_961_7">Res</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := <A HREF="terminal_interface-curses-menus__adb.htm#ref_958_16">Free</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_647_22">Men</A>); - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses-menus__adb.htm#ref_961_7">Res</A> /= <A HREF="terminal_interface-curses-aux__ads.htm#ref_80_4">E_Ok</A> <b>then</b> - <A HREF="terminal_interface-curses-aux__ads.htm#ref_96_14">Eti_Exception</A> (<A HREF="terminal_interface-curses-menus__adb.htm#ref_961_7">Res</A>); - <b>end</b> <b>if</b>; -- <A HREF="terminal_interface-curses-menus__ads.htm#ref_649_22">Men</A> := <A HREF="terminal_interface-curses-menus__ads.htm#ref_63_4">Null_Menu</A>; -- <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_649_14">Delete</A>; -+ <A HREF="terminal_interface-curses-menus__ads.htm#ref_647_22">Men</A> := <A HREF="terminal_interface-curses-menus__ads.htm#ref_63_4">Null_Menu</A>; -+ <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_647_14">Delete</A>; - --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_970_13" HREF="terminal_interface-curses-menus__ads.htm#ref_664_13">Driver</A></FONT> (<FONT COLOR=red><A NAME="ref_970_21" HREF="terminal_interface-curses-menus__ads.htm#ref_664_21">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_971_21" HREF="terminal_interface-curses-menus__ads.htm#ref_665_21">Key</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_68_9">Key_Code</A>) <b>return</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_658_9">Driver_Result</A> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_970_13" HREF="terminal_interface-curses-menus__ads.htm#ref_662_13">Driver</A></span> (<span class="symbol"><A NAME="ref_970_21" HREF="terminal_interface-curses-menus__ads.htm#ref_662_21">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_971_21" HREF="terminal_interface-curses-menus__ads.htm#ref_663_21">Key</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_68_9">Key_Code</A>) <b>return</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_656_9">Driver_Result</A> - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_973_16">Driver</A></FONT> (<FONT COLOR=red><A NAME="ref_973_24" HREF="terminal_interface-curses-menus__adb.htm#ref_973_16">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_974_24" HREF="terminal_interface-curses-menus__adb.htm#ref_973_16">Key</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_973_16">Driver</A></span> (<span class="symbol"><A NAME="ref_973_24" HREF="terminal_interface-curses-menus__adb.htm#ref_973_16">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_974_24" HREF="terminal_interface-curses-menus__adb.htm#ref_973_16">Key</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Driver, "menu_driver"); - -- <FONT COLOR=red><A NAME="ref_977_7">R</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := <A HREF="terminal_interface-curses-menus__adb.htm#ref_973_16">Driver</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_664_21">Men</A>, <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_665_21">Key</A>)); -+ <span class="symbol"><A NAME="ref_977_7">R</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := <A HREF="terminal_interface-curses-menus__adb.htm#ref_973_16">Driver</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_662_21">Men</A>, <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_663_21">Key</A>)); - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses-menus__adb.htm#ref_977_7">R</A> /= <A HREF="terminal_interface-curses-aux__ads.htm#ref_80_4">E_Ok</A> <b>then</b> - <b>case</b> <A HREF="terminal_interface-curses-menus__adb.htm#ref_977_7">R</A> <b>is</b> -- <b>when</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_88_4">E_Unknown_Command</A> =&gt; <b>return</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_660_27">Unknown_Request</A>; -- <b>when</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_89_4">E_No_Match</A> =&gt; <b>return</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_661_27">No_Match</A>; -+ <b>when</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_88_4">E_Unknown_Command</A> =&gt; <b>return</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_658_27">Unknown_Request</A>; -+ <b>when</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_89_4">E_No_Match</A> =&gt; <b>return</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_659_27">No_Match</A>; - <b>when</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_92_4">E_Request_Denied</A> | -- <A HREF="terminal_interface-curses-aux__ads.htm#ref_90_4">E_Not_Selectable</A> =&gt; <b>return</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_659_27">Request_Denied</A>; -+ <A HREF="terminal_interface-curses-aux__ads.htm#ref_90_4">E_Not_Selectable</A> =&gt; <b>return</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_657_27">Request_Denied</A>; - <b>when</b> <b>others</b> =&gt; - <A HREF="terminal_interface-curses-aux__ads.htm#ref_96_14">Eti_Exception</A> (<A HREF="terminal_interface-curses-menus__adb.htm#ref_977_7">R</A>); - <b>end</b> <b>case</b>; - <b>end</b> <b>if</b>; -- <b>return</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_658_27">Menu_Ok</A>; -- <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_664_13">Driver</A>; -+ <b>return</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_656_27">Menu_Ok</A>; -+ <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_662_13">Driver</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_992_14" HREF="terminal_interface-curses-menus__ads.htm#ref_184_14">Free</A></FONT> (<FONT COLOR=red><A NAME="ref_992_20" HREF="terminal_interface-curses-menus__ads.htm#ref_184_20">IA</A></FONT> : <b>in</b> <b>out</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_182_9">Item_Array_Access</A>; -- <FONT COLOR=red><A NAME="ref_993_20" HREF="terminal_interface-curses-menus__ads.htm#ref_185_20">Free_Items</A></FONT> : Boolean := False) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_992_14" HREF="terminal_interface-curses-menus__ads.htm#ref_182_14">Free</A></span> (<span class="symbol"><A NAME="ref_992_20" HREF="terminal_interface-curses-menus__ads.htm#ref_182_20">IA</A></span> : <b>in</b> <b>out</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_180_9">Item_Array_Access</A>; -+ <span class="symbol"><A NAME="ref_993_20" HREF="terminal_interface-curses-menus__ads.htm#ref_183_20">Free_Items</A></span> : Boolean := False) - <b>is</b> - <b>procedure</b> Release <b>is</b> <b>new</b> Ada.Unchecked_Deallocation -- (Item_Array, <A HREF="terminal_interface-curses-menus__ads.htm#ref_182_9">Item_Array_Access</A>); -+ (Item_Array, <A HREF="terminal_interface-curses-menus__ads.htm#ref_180_9">Item_Array_Access</A>); - <b>begin</b> -- <b>if</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_184_20">IA</A> /= <b>null</b> <b>and</b> <b>then</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_185_20">Free_Items</A> <b>then</b> -- <b>for</b> <FONT COLOR=red><A NAME="ref_999_14">I</A></FONT> <b>in</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_184_20">IA</A>'First .. (<A HREF="terminal_interface-curses-menus__ads.htm#ref_184_20">IA</A>'Last - 1) <b>loop</b> -- <b>if</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_184_20">IA</A>.<b>all</b> (<A HREF="terminal_interface-curses-menus__adb.htm#ref_999_14">I</A>) /= <A HREF="terminal_interface-curses-menus__ads.htm#ref_62_4">Null_Item</A> <b>then</b> -- <A HREF="terminal_interface-curses-menus__ads.htm#ref_207_14">Delete</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_184_20">IA</A>.<b>all</b> (<A HREF="terminal_interface-curses-menus__adb.htm#ref_999_14">I</A>)); -+ <b>if</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_182_20">IA</A> /= <b>null</b> <b>and</b> <b>then</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_183_20">Free_Items</A> <b>then</b> -+ <b>for</b> <span class="symbol"><A NAME="ref_999_14">I</A></span> <b>in</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_182_20">IA</A>'First .. (<A HREF="terminal_interface-curses-menus__ads.htm#ref_182_20">IA</A>'Last - 1) <b>loop</b> -+ <b>if</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_182_20">IA</A>.<b>all</b> (<A HREF="terminal_interface-curses-menus__adb.htm#ref_999_14">I</A>) /= <A HREF="terminal_interface-curses-menus__ads.htm#ref_62_4">Null_Item</A> <b>then</b> -+ <A HREF="terminal_interface-curses-menus__ads.htm#ref_205_14">Delete</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_182_20">IA</A>.<b>all</b> (<A HREF="terminal_interface-curses-menus__adb.htm#ref_999_14">I</A>)); - <b>end</b> <b>if</b>; - <b>end</b> <b>loop</b>; - <b>end</b> <b>if</b>; -- Release (<A HREF="terminal_interface-curses-menus__ads.htm#ref_184_20">IA</A>); -- <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_184_14">Free</A>; -+ Release (<A HREF="terminal_interface-curses-menus__ads.htm#ref_182_20">IA</A>); -+ <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_182_14">Free</A>; - --<FONT COLOR=green><EM>-------------------------------------------------------------------------------</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_1009_13" HREF="terminal_interface-curses-menus__ads.htm#ref_148_13">Default_Menu_Options</A></FONT> <b>return</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_121_9">Menu_Option_Set</A> -+<span class="comment"><EM>-------------------------------------------------------------------------------</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_1009_13" HREF="terminal_interface-curses-menus__ads.htm#ref_147_13">Default_Menu_Options</A></span> <b>return</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_121_9">Menu_Option_Set</A> - <b>is</b> - <b>begin</b> -- <b>return</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_356_13">Get_Options</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_63_4">Null_Menu</A>); -- <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_148_13">Default_Menu_Options</A>; -+ <b>return</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_354_13">Get_Options</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_63_4">Null_Menu</A>); -+ <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_147_13">Default_Menu_Options</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_1015_13" HREF="terminal_interface-curses-menus__ads.htm#ref_172_13">Default_Item_Options</A></FONT> <b>return</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_155_9">Item_Option_Set</A> -+ <b>function</b> <span class="symbol"><A NAME="ref_1015_13" HREF="terminal_interface-curses-menus__ads.htm#ref_170_13">Default_Item_Options</A></span> <b>return</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_154_9">Item_Option_Set</A> - <b>is</b> - <b>begin</b> -- <b>return</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_260_13">Get_Options</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_62_4">Null_Item</A>); -- <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_172_13">Default_Item_Options</A>; --<FONT COLOR=green><EM>-------------------------------------------------------------------------------</EM></FONT> -+ <b>return</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_258_13">Get_Options</A> (<A HREF="terminal_interface-curses-menus__ads.htm#ref_62_4">Null_Item</A>); -+ <b>end</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_170_13">Default_Item_Options</A>; -+<span class="comment"><EM>-------------------------------------------------------------------------------</EM></span> - - <b>end</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-menus__ads.htm#ref_49_35">Menus</A>; - </PRE></BODY></HTML> -diff -Naur ncurses-5.9/doc/html/ada/terminal_interface-curses-menus__ads.htm ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-menus__ads.htm ---- ncurses-5.9/doc/html/ada/terminal_interface-curses-menus__ads.htm 2011-03-20 00:18:40.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-menus__ads.htm 2014-09-01 16:33:22.293792018 +0200 -@@ -1,95 +1,107 @@ --<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> --<HTML><HEAD><TITLE>terminal_interface-curses-menus.ads</TITLE></HEAD> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> -+<HTML> -+<HEAD> -+<TITLE>terminal_interface-curses-menus.ads</TITLE> -+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> -+<style type="text/css"> -+*.comment { -+ color: green; -+} -+*.symbol { -+ color: red; -+} -+</style> -+</HEAD> - <BODY> --<HR><DIV ALIGN="center"><H1> File : terminal_interface-curses-menus.ads </H1></DIV><HR> -+<HR><DIV style="text-align:center"><H1> File : terminal_interface-curses-menus.ads </H1></DIV><HR> - <PRE> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Terminal_Interface.Curses.Menu --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- S P E C --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Copyright (c) 1998-2007,2009 Free Software Foundation, Inc. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></FONT> --<FONT COLOR=green><EM>-- copy of this software and associated documentation files (the --</EM></FONT> --<FONT COLOR=green><EM>-- "Software"), to deal in the Software without restriction, including --</EM></FONT> --<FONT COLOR=green><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></FONT> --<FONT COLOR=green><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></FONT> --<FONT COLOR=green><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></FONT> --<FONT COLOR=green><EM>-- furnished to do so, subject to the following conditions: --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- The above copyright notice and this permission notice shall be included --</EM></FONT> --<FONT COLOR=green><EM>-- in all copies or substantial portions of the Software. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></FONT> --<FONT COLOR=green><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></FONT> --<FONT COLOR=green><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></FONT> --<FONT COLOR=green><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></FONT> --<FONT COLOR=green><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></FONT> --<FONT COLOR=green><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></FONT> --<FONT COLOR=green><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></FONT> --<FONT COLOR=green><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></FONT> --<FONT COLOR=green><EM>-- sale, use or other dealings in this Software without prior written --</EM></FONT> --<FONT COLOR=green><EM>-- authorization. --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Author: Juergen Pfeifer, 1996</EM></FONT> --<FONT COLOR=green><EM>-- Version Control:</EM></FONT> --<FONT COLOR=green><EM>-- @Revision: 1.28 @</EM></FONT> --<FONT COLOR=green><EM>-- @Date: 2009/12/26 18:35:22 @</EM></FONT> --<FONT COLOR=green><EM>-- Binding Version 01.00</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- menu binding.</EM></FONT> --<FONT COLOR=green><EM>-- This module is generated. Please don't change it manually!</EM></FONT> --<FONT COLOR=green><EM>-- Run the generator instead.</EM></FONT> --<FONT COLOR=green><EM>-- |</EM></FONT> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Terminal_Interface.Curses.Menu --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- S P E C --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Copyright (c) 1998-2007,2009 Free Software Foundation, Inc. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></span> -+<span class="comment"><EM>-- copy of this software and associated documentation files (the --</EM></span> -+<span class="comment"><EM>-- "Software"), to deal in the Software without restriction, including --</EM></span> -+<span class="comment"><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></span> -+<span class="comment"><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></span> -+<span class="comment"><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></span> -+<span class="comment"><EM>-- furnished to do so, subject to the following conditions: --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- The above copyright notice and this permission notice shall be included --</EM></span> -+<span class="comment"><EM>-- in all copies or substantial portions of the Software. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></span> -+<span class="comment"><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></span> -+<span class="comment"><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></span> -+<span class="comment"><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></span> -+<span class="comment"><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></span> -+<span class="comment"><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></span> -+<span class="comment"><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></span> -+<span class="comment"><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></span> -+<span class="comment"><EM>-- sale, use or other dealings in this Software without prior written --</EM></span> -+<span class="comment"><EM>-- authorization. --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Author: Juergen Pfeifer, 1996</EM></span> -+<span class="comment"><EM>-- Version Control:</EM></span> -+<span class="comment"><EM>-- @Revision: 1.28 @</EM></span> -+<span class="comment"><EM>-- @Date: 2009/12/26 18:35:22 @</EM></span> -+<span class="comment"><EM>-- Binding Version 01.00</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- menu binding.</EM></span> -+<span class="comment"><EM>-- This module is generated. Please don't change it manually!</EM></span> -+<span class="comment"><EM>-- Run the generator instead.</EM></span> -+<span class="comment"><EM>-- |</EM></span> - <b>with</b> System; - <b>with</b> Ada.Characters.Latin_1; - --<b>package</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<FONT COLOR=red><A NAME="ref_49_35" HREF="terminal_interface-curses-menus__adb.htm#ref_51_40">Menus</A></FONT> <b>is</b> -+<b>package</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<span class="symbol"><A NAME="ref_49_35" HREF="terminal_interface-curses-menus__adb.htm#ref_51_40">Menus</A></span> <b>is</b> - <b>pragma</b> Preelaborate (<A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-menus__ads.htm#ref_49_35">Menus</A>); - <b>pragma</b> Linker_Options ("-lmenu"); - <b>pragma</b> Linker_Options ("-lncurses"); - - Space : Character <b>renames</b> Ada.Characters.Latin_1.Space; - -- <b>type</b> <FONT COLOR=red><A NAME="ref_56_9">Item</A></FONT> <b>is</b> <b>private</b>; -- <b>type</b> <FONT COLOR=red><A NAME="ref_57_9">Menu</A></FONT> <b>is</b> <b>private</b>; -+ <b>type</b> <span class="symbol"><A NAME="ref_56_9">Item</A></span> <b>is</b> <b>private</b>; -+ <b>type</b> <span class="symbol"><A NAME="ref_57_9">Menu</A></span> <b>is</b> <b>private</b>; - -- <FONT COLOR=green><EM>---------------------------</EM></FONT> -- <FONT COLOR=green><EM>-- Interface constants --</EM></FONT> -- <FONT COLOR=green><EM>---------------------------</EM></FONT> -- <FONT COLOR=red><A NAME="ref_62_4">Null_Item</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>; -- <FONT COLOR=red><A NAME="ref_63_4">Null_Menu</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="comment"><EM>---------------------------</EM></span> -+ <span class="comment"><EM>-- Interface constants --</EM></span> -+ <span class="comment"><EM>---------------------------</EM></span> -+ <span class="symbol"><A NAME="ref_62_4">Null_Item</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>; -+ <span class="symbol"><A NAME="ref_63_4">Null_Menu</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; - -- <b>subtype</b> <FONT COLOR=red><A NAME="ref_65_12">Menu_Request_Code</A></FONT> <b>is</b> <A HREF="terminal_interface-curses__ads.htm#ref_68_9">Key_Code</A> -+ <b>subtype</b> <span class="symbol"><A NAME="ref_65_12">Menu_Request_Code</A></span> <b>is</b> <A HREF="terminal_interface-curses__ads.htm#ref_68_9">Key_Code</A> - <b>range</b> (<A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 1) .. (<A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 17); - -- <FONT COLOR=green><EM>-- The prefix M_ stands for "Menu Request"</EM></FONT> -- <FONT COLOR=red><A NAME="ref_69_4">M_Left_Item</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_65_12">Menu_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 1; -- <FONT COLOR=red><A NAME="ref_70_4">M_Right_Item</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_65_12">Menu_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 2; -- <FONT COLOR=red><A NAME="ref_71_4">M_Up_Item</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_65_12">Menu_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 3; -- <FONT COLOR=red><A NAME="ref_72_4">M_Down_Item</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_65_12">Menu_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 4; -- <FONT COLOR=red><A NAME="ref_73_4">M_ScrollUp_Line</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_65_12">Menu_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 5; -- <FONT COLOR=red><A NAME="ref_74_4">M_ScrollDown_Line</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_65_12">Menu_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 6; -- <FONT COLOR=red><A NAME="ref_75_4">M_ScrollDown_Page</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_65_12">Menu_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 7; -- <FONT COLOR=red><A NAME="ref_76_4">M_ScrollUp_Page</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_65_12">Menu_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 8; -- <FONT COLOR=red><A NAME="ref_77_4">M_First_Item</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_65_12">Menu_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 9; -- <FONT COLOR=red><A NAME="ref_78_4">M_Last_Item</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_65_12">Menu_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 10; -- <FONT COLOR=red><A NAME="ref_79_4">M_Next_Item</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_65_12">Menu_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 11; -- <FONT COLOR=red><A NAME="ref_80_4">M_Previous_Item</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_65_12">Menu_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 12; -- <FONT COLOR=red><A NAME="ref_81_4">M_Toggle_Item</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_65_12">Menu_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 13; -- <FONT COLOR=red><A NAME="ref_82_4">M_Clear_Pattern</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_65_12">Menu_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 14; -- <FONT COLOR=red><A NAME="ref_83_4">M_Back_Pattern</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_65_12">Menu_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 15; -- <FONT COLOR=red><A NAME="ref_84_4">M_Next_Match</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_65_12">Menu_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 16; -- <FONT COLOR=red><A NAME="ref_85_4">M_Previous_Match</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_65_12">Menu_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 17; -+ <span class="comment"><EM>-- The prefix M_ stands for "Menu Request"</EM></span> -+ <span class="symbol"><A NAME="ref_69_4">M_Left_Item</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_65_12">Menu_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 1; -+ <span class="symbol"><A NAME="ref_70_4">M_Right_Item</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_65_12">Menu_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 2; -+ <span class="symbol"><A NAME="ref_71_4">M_Up_Item</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_65_12">Menu_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 3; -+ <span class="symbol"><A NAME="ref_72_4">M_Down_Item</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_65_12">Menu_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 4; -+ <span class="symbol"><A NAME="ref_73_4">M_ScrollUp_Line</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_65_12">Menu_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 5; -+ <span class="symbol"><A NAME="ref_74_4">M_ScrollDown_Line</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_65_12">Menu_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 6; -+ <span class="symbol"><A NAME="ref_75_4">M_ScrollDown_Page</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_65_12">Menu_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 7; -+ <span class="symbol"><A NAME="ref_76_4">M_ScrollUp_Page</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_65_12">Menu_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 8; -+ <span class="symbol"><A NAME="ref_77_4">M_First_Item</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_65_12">Menu_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 9; -+ <span class="symbol"><A NAME="ref_78_4">M_Last_Item</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_65_12">Menu_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 10; -+ <span class="symbol"><A NAME="ref_79_4">M_Next_Item</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_65_12">Menu_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 11; -+ <span class="symbol"><A NAME="ref_80_4">M_Previous_Item</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_65_12">Menu_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 12; -+ <span class="symbol"><A NAME="ref_81_4">M_Toggle_Item</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_65_12">Menu_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 13; -+ <span class="symbol"><A NAME="ref_82_4">M_Clear_Pattern</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_65_12">Menu_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 14; -+ <span class="symbol"><A NAME="ref_83_4">M_Back_Pattern</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_65_12">Menu_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 15; -+ <span class="symbol"><A NAME="ref_84_4">M_Next_Match</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_65_12">Menu_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 16; -+ <span class="symbol"><A NAME="ref_85_4">M_Previous_Match</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_65_12">Menu_Request_Code</A> := <A HREF="terminal_interface-curses__ads.htm#ref_207_4">Key_Max</A> + 17; - -- <FONT COLOR=green><EM>-- For those who like the old 'C' names for the request codes</EM></FONT> -+ <span class="comment"><EM>-- For those who like the old 'C' names for the request codes</EM></span> - REQ_LEFT_ITEM : <A HREF="terminal_interface-curses-menus__ads.htm#ref_65_12">Menu_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_69_4">M_Left_Item</A>; - REQ_RIGHT_ITEM : <A HREF="terminal_interface-curses-menus__ads.htm#ref_65_12">Menu_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_70_4">M_Right_Item</A>; - REQ_UP_ITEM : <A HREF="terminal_interface-curses-menus__ads.htm#ref_65_12">Menu_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_71_4">M_Up_Item</A>; -@@ -108,30 +120,29 @@ - REQ_NEXT_MATCH : <A HREF="terminal_interface-curses-menus__ads.htm#ref_65_12">Menu_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_84_4">M_Next_Match</A>; - REQ_PREV_MATCH : <A HREF="terminal_interface-curses-menus__ads.htm#ref_65_12">Menu_Request_Code</A> <b>renames</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_85_4">M_Previous_Match</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_106_14" HREF="terminal_interface-curses-menus__adb.htm#ref_77_14">Request_Name</A></FONT> (<FONT COLOR=red><A NAME="ref_106_28" HREF="terminal_interface-curses-menus__adb.htm#ref_77_28">Key</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_65_12">Menu_Request_Code</A>; -- <FONT COLOR=red><A NAME="ref_107_28" HREF="terminal_interface-curses-menus__adb.htm#ref_78_28">Name</A></FONT> : <b>out</b> String); -+ <b>procedure</b> <span class="symbol"><A NAME="ref_106_14" HREF="terminal_interface-curses-menus__adb.htm#ref_77_14">Request_Name</A></span> (<span class="symbol"><A NAME="ref_106_28" HREF="terminal_interface-curses-menus__adb.htm#ref_77_28">Key</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_65_12">Menu_Request_Code</A>; -+ <span class="symbol"><A NAME="ref_107_28" HREF="terminal_interface-curses-menus__adb.htm#ref_78_28">Name</A></span> : <b>out</b> String); - -- <b>function</b> <FONT COLOR=red><A NAME="ref_109_14" HREF="terminal_interface-curses-menus__adb.htm#ref_86_13">Request_Name</A></FONT> (<FONT COLOR=red><A NAME="ref_109_28" HREF="terminal_interface-curses-menus__adb.htm#ref_86_27">Key</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_65_12">Menu_Request_Code</A>) <b>return</b> String; -- <FONT COLOR=green><EM>-- Same as function</EM></FONT> -+ <b>function</b> <span class="symbol"><A NAME="ref_109_14" HREF="terminal_interface-curses-menus__adb.htm#ref_86_13">Request_Name</A></span> (<span class="symbol"><A NAME="ref_109_28" HREF="terminal_interface-curses-menus__adb.htm#ref_86_27">Key</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_65_12">Menu_Request_Code</A>) <b>return</b> String; -+ <span class="comment"><EM>-- Same as function</EM></span> - -- <FONT COLOR=green><EM>------------------</EM></FONT> -- <FONT COLOR=green><EM>-- Exceptions --</EM></FONT> -- <FONT COLOR=green><EM>------------------</EM></FONT> -- -- <FONT COLOR=red><A NAME="ref_116_4">Menu_Exception</A></FONT> : <b>exception</b>; -- <FONT COLOR=green><EM>--</EM></FONT> -- <FONT COLOR=green><EM>-- Menu options</EM></FONT> -- <FONT COLOR=green><EM>--</EM></FONT> -+ <span class="comment"><EM>------------------</EM></span> -+ <span class="comment"><EM>-- Exceptions --</EM></span> -+ <span class="comment"><EM>------------------</EM></span> -+ -+ <span class="symbol"><A NAME="ref_116_4">Menu_Exception</A></span> : <b>exception</b>; -+ <span class="comment"><EM>--</EM></span> -+ <span class="comment"><EM>-- Menu options</EM></span> -+ <span class="comment"><EM>--</EM></span> - <b>pragma</b> Warnings (Off); -- <b>type</b> <FONT COLOR=red><A NAME="ref_121_9">Menu_Option_Set</A></FONT> <b>is</b> -+ <b>type</b> <span class="symbol"><A NAME="ref_121_9">Menu_Option_Set</A></span> <b>is</b> - <b>record</b> -- <FONT COLOR=red><A NAME="ref_123_10">One_Valued</A></FONT> : Boolean; -- <FONT COLOR=red><A NAME="ref_124_10">Show_Descriptions</A></FONT> : Boolean; -- <FONT COLOR=red><A NAME="ref_125_10">Row_Major_Order</A></FONT> : Boolean; -- <FONT COLOR=red><A NAME="ref_126_10">Ignore_Case</A></FONT> : Boolean; -- <FONT COLOR=red><A NAME="ref_127_10">Show_Matches</A></FONT> : Boolean; -- <FONT COLOR=red><A NAME="ref_128_10">Non_Cyclic</A></FONT> : Boolean; -- <FONT COLOR=red><A NAME="ref_129_10">Unused</A></FONT> : Boolean; -+ <span class="symbol"><A NAME="ref_123_10">One_Valued</A></span> : Boolean; -+ <span class="symbol"><A NAME="ref_124_10">Show_Descriptions</A></span> : Boolean; -+ <span class="symbol"><A NAME="ref_125_10">Row_Major_Order</A></span> : Boolean; -+ <span class="symbol"><A NAME="ref_126_10">Ignore_Case</A></span> : Boolean; -+ <span class="symbol"><A NAME="ref_127_10">Show_Matches</A></span> : Boolean; -+ <span class="symbol"><A NAME="ref_128_10">Non_Cyclic</A></span> : Boolean; - <b>end</b> <b>record</b>; - <b>pragma</b> Convention (C, <A HREF="terminal_interface-curses-menus__ads.htm#ref_121_9">Menu_Option_Set</A>); - -@@ -143,537 +154,536 @@ - <A HREF="terminal_interface-curses-menus__ads.htm#ref_126_10">Ignore_Case</A> <b>at</b> 0 <b>range</b> 3 .. 3; - <A HREF="terminal_interface-curses-menus__ads.htm#ref_127_10">Show_Matches</A> <b>at</b> 0 <b>range</b> 4 .. 4; - <A HREF="terminal_interface-curses-menus__ads.htm#ref_128_10">Non_Cyclic</A> <b>at</b> 0 <b>range</b> 5 .. 5; -- <A HREF="terminal_interface-curses-menus__ads.htm#ref_129_10">Unused</A> <b>at</b> 0 <b>range</b> 6 .. 31; - <b>end</b> <b>record</b>; -- <b>for</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_121_9">Menu_Option_Set</A>'Size <b>use</b> 32; -- <FONT COLOR=green><EM>-- Please note: this rep. clause is generated and may be</EM></FONT> -- <FONT COLOR=green><EM>-- different on your system.</EM></FONT> -+ <b>pragma</b> Warnings (Off); <b>for</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_121_9">Menu_Option_Set</A>'Size <b>use</b> 32; -+ <b>pragma</b> Warnings (On); -+ <span class="comment"><EM>-- Please note: this rep. clause is generated and may be</EM></span> -+ <span class="comment"><EM>-- different on your system.</EM></span> - <b>pragma</b> Warnings (On); - -- <b>function</b> <FONT COLOR=red><A NAME="ref_148_13" HREF="terminal_interface-curses-menus__adb.htm#ref_1009_13">Default_Menu_Options</A></FONT> <b>return</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_121_9">Menu_Option_Set</A>; -- <FONT COLOR=green><EM>-- Initial default options for a menu.</EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses-menus__ads.htm#ref_148_13">Default_Menu_Options</A>); -- <FONT COLOR=green><EM>--</EM></FONT> -- <FONT COLOR=green><EM>-- Item options</EM></FONT> -- <FONT COLOR=green><EM>--</EM></FONT> -+ <b>function</b> <span class="symbol"><A NAME="ref_147_13" HREF="terminal_interface-curses-menus__adb.htm#ref_1009_13">Default_Menu_Options</A></span> <b>return</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_121_9">Menu_Option_Set</A>; -+ <span class="comment"><EM>-- Initial default options for a menu.</EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses-menus__ads.htm#ref_147_13">Default_Menu_Options</A>); -+ <span class="comment"><EM>--</EM></span> -+ <span class="comment"><EM>-- Item options</EM></span> -+ <span class="comment"><EM>--</EM></span> - <b>pragma</b> Warnings (Off); -- <b>type</b> <FONT COLOR=red><A NAME="ref_155_9">Item_Option_Set</A></FONT> <b>is</b> -+ <b>type</b> <span class="symbol"><A NAME="ref_154_9">Item_Option_Set</A></span> <b>is</b> - <b>record</b> -- <FONT COLOR=red><A NAME="ref_157_10">Selectable</A></FONT> : Boolean; -- <FONT COLOR=red><A NAME="ref_158_10">Unused</A></FONT> : Boolean; -+ <span class="symbol"><A NAME="ref_156_10">Selectable</A></span> : Boolean; - <b>end</b> <b>record</b>; -- <b>pragma</b> Convention (C, <A HREF="terminal_interface-curses-menus__ads.htm#ref_155_9">Item_Option_Set</A>); -+ <b>pragma</b> Convention (C, <A HREF="terminal_interface-curses-menus__ads.htm#ref_154_9">Item_Option_Set</A>); - -- <b>for</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_155_9">Item_Option_Set</A> <b>use</b> -+ <b>for</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_154_9">Item_Option_Set</A> <b>use</b> - <b>record</b> -- <A HREF="terminal_interface-curses-menus__ads.htm#ref_157_10">Selectable</A> <b>at</b> 0 <b>range</b> 0 .. 0; -- <A HREF="terminal_interface-curses-menus__ads.htm#ref_158_10">Unused</A> <b>at</b> 0 <b>range</b> 1 .. 31; -+ <A HREF="terminal_interface-curses-menus__ads.htm#ref_156_10">Selectable</A> <b>at</b> 0 <b>range</b> 0 .. 0; - <b>end</b> <b>record</b>; -- <b>for</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_155_9">Item_Option_Set</A>'Size <b>use</b> 32; -- <FONT COLOR=green><EM>-- Please note: this rep. clause is generated and may be</EM></FONT> -- <FONT COLOR=green><EM>-- different on your system.</EM></FONT> -+ <b>pragma</b> Warnings (Off); <b>for</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_154_9">Item_Option_Set</A>'Size <b>use</b> 32; -+ <b>pragma</b> Warnings (On); -+ <span class="comment"><EM>-- Please note: this rep. clause is generated and may be</EM></span> -+ <span class="comment"><EM>-- different on your system.</EM></span> - <b>pragma</b> Warnings (On); - -- <b>function</b> <FONT COLOR=red><A NAME="ref_172_13" HREF="terminal_interface-curses-menus__adb.htm#ref_1015_13">Default_Item_Options</A></FONT> <b>return</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_155_9">Item_Option_Set</A>; -- <FONT COLOR=green><EM>-- Initial default options for an item.</EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses-menus__ads.htm#ref_172_13">Default_Item_Options</A>); -- -- <FONT COLOR=green><EM>--</EM></FONT> -- <FONT COLOR=green><EM>-- Item Array</EM></FONT> -- <FONT COLOR=green><EM>--</EM></FONT> -+ <b>function</b> <span class="symbol"><A NAME="ref_170_13" HREF="terminal_interface-curses-menus__adb.htm#ref_1015_13">Default_Item_Options</A></span> <b>return</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_154_9">Item_Option_Set</A>; -+ <span class="comment"><EM>-- Initial default options for an item.</EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses-menus__ads.htm#ref_170_13">Default_Item_Options</A>); -+ -+ <span class="comment"><EM>--</EM></span> -+ <span class="comment"><EM>-- Item Array</EM></span> -+ <span class="comment"><EM>--</EM></span> - <b>type</b> Item_Array <b>is</b> <b>array</b> (Positive <b>range</b> &lt;&gt;) <b>of</b> <b>aliased</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>; - <b>pragma</b> Convention (C, Item_Array); - -- <b>type</b> <FONT COLOR=red><A NAME="ref_182_9">Item_Array_Access</A></FONT> <b>is</b> <b>access</b> Item_Array; -+ <b>type</b> <span class="symbol"><A NAME="ref_180_9">Item_Array_Access</A></span> <b>is</b> <b>access</b> Item_Array; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_184_14" HREF="terminal_interface-curses-menus__adb.htm#ref_992_14">Free</A></FONT> (<FONT COLOR=red><A NAME="ref_184_20" HREF="terminal_interface-curses-menus__adb.htm#ref_992_20">IA</A></FONT> : <b>in</b> <b>out</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_182_9">Item_Array_Access</A>; -- <FONT COLOR=red><A NAME="ref_185_20" HREF="terminal_interface-curses-menus__adb.htm#ref_993_20">Free_Items</A></FONT> : Boolean := False); -- <FONT COLOR=green><EM>-- Release the memory for an allocated item array</EM></FONT> -- <FONT COLOR=green><EM>-- If Free_Items is True, call Delete() for all the items in</EM></FONT> -- <FONT COLOR=green><EM>-- the array.</EM></FONT> -- -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page <A HREF="../man/mitem_new.3x.html">mitem_new.3x</A></EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_1"#2|</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_195_13" HREF="terminal_interface-curses-menus__adb.htm#ref_94_13">Create</A></FONT> (<FONT COLOR=red><A NAME="ref_195_21" HREF="terminal_interface-curses-menus__adb.htm#ref_94_21">Name</A></FONT> : String; -- <FONT COLOR=red><A NAME="ref_196_21" HREF="terminal_interface-curses-menus__adb.htm#ref_95_21">Description</A></FONT> : String := "") <b>return</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/mitem_new.3x.html">new_item()</A></EM></FONT> -- <FONT COLOR=green><EM>-- Not inlined.</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_2"#2|</EM></FONT> -- <b>function</b> New_Item (<FONT COLOR=red><A NAME="ref_201_23">Name</A></FONT> : String; -- <FONT COLOR=red><A NAME="ref_202_23">Description</A></FONT> : String := "") <b>return</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A> -- <b>renames</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_195_13">Create</A>; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/mitem_new.3x.html">new_item()</A></EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_3"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_207_14" HREF="terminal_interface-curses-menus__adb.htm#ref_124_14">Delete</A></FONT> (<FONT COLOR=red><A NAME="ref_207_22" HREF="terminal_interface-curses-menus__adb.htm#ref_124_22">Itm</A></FONT> : <b>in</b> <b>out</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/mitem_new.3x.html">free_item()</A></EM></FONT> -- <FONT COLOR=green><EM>-- Resets Itm to Null_Item</EM></FONT> -- -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page <A HREF="../man/mitem_value.3x.html">mitem_value.3x</A></EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_4"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_216_14" HREF="terminal_interface-curses-menus__adb.htm#ref_152_14">Set_Value</A></FONT> (<FONT COLOR=red><A NAME="ref_216_25" HREF="terminal_interface-curses-menus__adb.htm#ref_152_25">Itm</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>; -- <FONT COLOR=red><A NAME="ref_217_25" HREF="terminal_interface-curses-menus__adb.htm#ref_153_25">Value</A></FONT> : Boolean := True); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/mitem_value.3x.html">set_item_value()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses-menus__ads.htm#ref_216_14">Set_Value</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_5"#2|</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_222_13" HREF="terminal_interface-curses-menus__adb.htm#ref_166_13">Value</A></FONT> (<FONT COLOR=red><A NAME="ref_222_20" HREF="terminal_interface-curses-menus__adb.htm#ref_166_20">Itm</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>) <b>return</b> Boolean; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/mitem_value.3x.html">item_value()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses-menus__ads.htm#ref_222_13">Value</A>); -- -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page <A HREF="../man/mitem_visible.3x.html">mitem_visible.3x</A></EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_6"#2|</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_231_13" HREF="terminal_interface-curses-menus__adb.htm#ref_179_13">Visible</A></FONT> (<FONT COLOR=red><A NAME="ref_231_22" HREF="terminal_interface-curses-menus__adb.htm#ref_179_22">Itm</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>) <b>return</b> Boolean; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/mitem_visible.3x.html">item_visible()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses-menus__ads.htm#ref_231_13">Visible</A>); -- -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page <A HREF="../man/mitem_opts.3x.html">mitem_opts.3x</A></EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_7"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_240_14" HREF="terminal_interface-curses-menus__adb.htm#ref_191_14">Set_Options</A></FONT> (<FONT COLOR=red><A NAME="ref_240_27" HREF="terminal_interface-curses-menus__adb.htm#ref_191_27">Itm</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>; -- <FONT COLOR=red><A NAME="ref_241_27" HREF="terminal_interface-curses-menus__adb.htm#ref_192_27">Options</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_155_9">Item_Option_Set</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/mitem_opts.3x.html">set_item_opts()</A></EM></FONT> -- <FONT COLOR=green><EM>-- An overloaded Set_Options is defined later. Pragma Inline appears there</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_8"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_246_14" HREF="terminal_interface-curses-menus__adb.htm#ref_207_14">Switch_Options</A></FONT> (<FONT COLOR=red><A NAME="ref_246_30" HREF="terminal_interface-curses-menus__adb.htm#ref_207_30">Itm</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>; -- <FONT COLOR=red><A NAME="ref_247_30" HREF="terminal_interface-curses-menus__adb.htm#ref_208_30">Options</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_155_9">Item_Option_Set</A>; -- <FONT COLOR=red><A NAME="ref_248_30" HREF="terminal_interface-curses-menus__adb.htm#ref_209_30">On</A></FONT> : Boolean := True); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/mitem_opts.3x.html">item_opts_on()</A></EM></FONT> -- <FONT COLOR=green><EM>-- AKA: item_opts_off()</EM></FONT> -- <FONT COLOR=green><EM>-- An overloaded Switch_Options is defined later.</EM></FONT> -- <FONT COLOR=green><EM>-- Pragma Inline appears there</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_9"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_255_14" HREF="terminal_interface-curses-menus__adb.htm#ref_231_14">Get_Options</A></FONT> (<FONT COLOR=red><A NAME="ref_255_27" HREF="terminal_interface-curses-menus__adb.htm#ref_231_27">Itm</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>; -- <FONT COLOR=red><A NAME="ref_256_27" HREF="terminal_interface-curses-menus__adb.htm#ref_232_27">Options</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_155_9">Item_Option_Set</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/mitem_opts.3x.html">item_opts()</A></EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_10"#2|</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_260_13" HREF="terminal_interface-curses-menus__adb.htm#ref_242_13">Get_Options</A></FONT> (<FONT COLOR=red><A NAME="ref_260_26" HREF="terminal_interface-curses-menus__adb.htm#ref_242_26">Itm</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A> := <A HREF="terminal_interface-curses-menus__ads.htm#ref_62_4">Null_Item</A>) <b>return</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_155_9">Item_Option_Set</A>; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/mitem_opts.3x.html">item_opts()</A></EM></FONT> -- <FONT COLOR=green><EM>-- An overloaded Get_Options is defined later. Pragma Inline appears there</EM></FONT> -- -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page <A HREF="../man/mitem_name.3x.html">mitem_name.3x</A></EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_11"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_269_14" HREF="terminal_interface-curses-menus__adb.htm#ref_250_14">Name</A></FONT> (<FONT COLOR=red><A NAME="ref_269_20" HREF="terminal_interface-curses-menus__adb.htm#ref_250_20">Itm</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>; -- <FONT COLOR=red><A NAME="ref_270_20" HREF="terminal_interface-curses-menus__adb.htm#ref_251_20">Name</A></FONT> : <b>out</b> String); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/mitem_name.3x.html">item_name()</A></EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_272_14" HREF="terminal_interface-curses-menus__adb.htm#ref_259_13">Name</A></FONT> (<FONT COLOR=red><A NAME="ref_272_20" HREF="terminal_interface-curses-menus__adb.htm#ref_259_19">Itm</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>) <b>return</b> String; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/mitem_name.3x.html">item_name()</A></EM></FONT> -- <FONT COLOR=green><EM>-- Implemented as function</EM></FONT> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_182_14" HREF="terminal_interface-curses-menus__adb.htm#ref_992_14">Free</A></span> (<span class="symbol"><A NAME="ref_182_20" HREF="terminal_interface-curses-menus__adb.htm#ref_992_20">IA</A></span> : <b>in</b> <b>out</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_180_9">Item_Array_Access</A>; -+ <span class="symbol"><A NAME="ref_183_20" HREF="terminal_interface-curses-menus__adb.htm#ref_993_20">Free_Items</A></span> : Boolean := False); -+ <span class="comment"><EM>-- Release the memory for an allocated item array</EM></span> -+ <span class="comment"><EM>-- If Free_Items is True, call Delete() for all the items in</EM></span> -+ <span class="comment"><EM>-- the array.</EM></span> -+ -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page <A HREF="../man/mitem_new.3x.html">mitem_new.3x</A></EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_1"#2|</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_193_13" HREF="terminal_interface-curses-menus__adb.htm#ref_94_13">Create</A></span> (<span class="symbol"><A NAME="ref_193_21" HREF="terminal_interface-curses-menus__adb.htm#ref_94_21">Name</A></span> : String; -+ <span class="symbol"><A NAME="ref_194_21" HREF="terminal_interface-curses-menus__adb.htm#ref_95_21">Description</A></span> : String := "") <b>return</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/mitem_new.3x.html">new_item()</A></EM></span> -+ <span class="comment"><EM>-- Not inlined.</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_2"#2|</EM></span> -+ <b>function</b> New_Item (<span class="symbol"><A NAME="ref_199_23">Name</A></span> : String; -+ <span class="symbol"><A NAME="ref_200_23">Description</A></span> : String := "") <b>return</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A> -+ <b>renames</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_193_13">Create</A>; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/mitem_new.3x.html">new_item()</A></EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_3"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_205_14" HREF="terminal_interface-curses-menus__adb.htm#ref_124_14">Delete</A></span> (<span class="symbol"><A NAME="ref_205_22" HREF="terminal_interface-curses-menus__adb.htm#ref_124_22">Itm</A></span> : <b>in</b> <b>out</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/mitem_new.3x.html">free_item()</A></EM></span> -+ <span class="comment"><EM>-- Resets Itm to Null_Item</EM></span> -+ -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page <A HREF="../man/mitem_value.3x.html">mitem_value.3x</A></EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_4"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_214_14" HREF="terminal_interface-curses-menus__adb.htm#ref_152_14">Set_Value</A></span> (<span class="symbol"><A NAME="ref_214_25" HREF="terminal_interface-curses-menus__adb.htm#ref_152_25">Itm</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>; -+ <span class="symbol"><A NAME="ref_215_25" HREF="terminal_interface-curses-menus__adb.htm#ref_153_25">Value</A></span> : Boolean := True); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/mitem_value.3x.html">set_item_value()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses-menus__ads.htm#ref_214_14">Set_Value</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_5"#2|</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_220_13" HREF="terminal_interface-curses-menus__adb.htm#ref_166_13">Value</A></span> (<span class="symbol"><A NAME="ref_220_20" HREF="terminal_interface-curses-menus__adb.htm#ref_166_20">Itm</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>) <b>return</b> Boolean; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/mitem_value.3x.html">item_value()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses-menus__ads.htm#ref_220_13">Value</A>); -+ -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page <A HREF="../man/mitem_visible.3x.html">mitem_visible.3x</A></EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_6"#2|</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_229_13" HREF="terminal_interface-curses-menus__adb.htm#ref_179_13">Visible</A></span> (<span class="symbol"><A NAME="ref_229_22" HREF="terminal_interface-curses-menus__adb.htm#ref_179_22">Itm</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>) <b>return</b> Boolean; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/mitem_visible.3x.html">item_visible()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses-menus__ads.htm#ref_229_13">Visible</A>); -+ -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page <A HREF="../man/mitem_opts.3x.html">mitem_opts.3x</A></EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_7"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_238_14" HREF="terminal_interface-curses-menus__adb.htm#ref_191_14">Set_Options</A></span> (<span class="symbol"><A NAME="ref_238_27" HREF="terminal_interface-curses-menus__adb.htm#ref_191_27">Itm</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>; -+ <span class="symbol"><A NAME="ref_239_27" HREF="terminal_interface-curses-menus__adb.htm#ref_192_27">Options</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_154_9">Item_Option_Set</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/mitem_opts.3x.html">set_item_opts()</A></EM></span> -+ <span class="comment"><EM>-- An overloaded Set_Options is defined later. Pragma Inline appears there</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_8"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_244_14" HREF="terminal_interface-curses-menus__adb.htm#ref_207_14">Switch_Options</A></span> (<span class="symbol"><A NAME="ref_244_30" HREF="terminal_interface-curses-menus__adb.htm#ref_207_30">Itm</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>; -+ <span class="symbol"><A NAME="ref_245_30" HREF="terminal_interface-curses-menus__adb.htm#ref_208_30">Options</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_154_9">Item_Option_Set</A>; -+ <span class="symbol"><A NAME="ref_246_30" HREF="terminal_interface-curses-menus__adb.htm#ref_209_30">On</A></span> : Boolean := True); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/mitem_opts.3x.html">item_opts_on()</A></EM></span> -+ <span class="comment"><EM>-- AKA: item_opts_off()</EM></span> -+ <span class="comment"><EM>-- An overloaded Switch_Options is defined later.</EM></span> -+ <span class="comment"><EM>-- Pragma Inline appears there</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_9"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_253_14" HREF="terminal_interface-curses-menus__adb.htm#ref_231_14">Get_Options</A></span> (<span class="symbol"><A NAME="ref_253_27" HREF="terminal_interface-curses-menus__adb.htm#ref_231_27">Itm</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>; -+ <span class="symbol"><A NAME="ref_254_27" HREF="terminal_interface-curses-menus__adb.htm#ref_232_27">Options</A></span> : <b>out</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_154_9">Item_Option_Set</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/mitem_opts.3x.html">item_opts()</A></EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_10"#2|</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_258_13" HREF="terminal_interface-curses-menus__adb.htm#ref_242_13">Get_Options</A></span> (<span class="symbol"><A NAME="ref_258_26" HREF="terminal_interface-curses-menus__adb.htm#ref_242_26">Itm</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A> := <A HREF="terminal_interface-curses-menus__ads.htm#ref_62_4">Null_Item</A>) <b>return</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_154_9">Item_Option_Set</A>; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/mitem_opts.3x.html">item_opts()</A></EM></span> -+ <span class="comment"><EM>-- An overloaded Get_Options is defined later. Pragma Inline appears there</EM></span> -+ -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page <A HREF="../man/mitem_name.3x.html">mitem_name.3x</A></EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_11"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_267_14" HREF="terminal_interface-curses-menus__adb.htm#ref_250_14">Name</A></span> (<span class="symbol"><A NAME="ref_267_20" HREF="terminal_interface-curses-menus__adb.htm#ref_250_20">Itm</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>; -+ <span class="symbol"><A NAME="ref_268_20" HREF="terminal_interface-curses-menus__adb.htm#ref_251_20">Name</A></span> : <b>out</b> String); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/mitem_name.3x.html">item_name()</A></EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_270_14" HREF="terminal_interface-curses-menus__adb.htm#ref_259_13">Name</A></span> (<span class="symbol"><A NAME="ref_270_20" HREF="terminal_interface-curses-menus__adb.htm#ref_259_19">Itm</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>) <b>return</b> String; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/mitem_name.3x.html">item_name()</A></EM></span> -+ <span class="comment"><EM>-- Implemented as function</EM></span> - <b>pragma</b> Inline (Name); - -- <FONT COLOR=green><EM>-- #1A NAME="AFU_12"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_278_14" HREF="terminal_interface-curses-menus__adb.htm#ref_267_14">Description</A></FONT> (<FONT COLOR=red><A NAME="ref_278_27" HREF="terminal_interface-curses-menus__adb.htm#ref_267_27">Itm</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>; -- <FONT COLOR=red><A NAME="ref_279_27" HREF="terminal_interface-curses-menus__adb.htm#ref_268_27">Description</A></FONT> : <b>out</b> String); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/mitem_name.3x.html">item_description();</A></EM></FONT> -- -- <b>function</b> <FONT COLOR=red><A NAME="ref_282_14" HREF="terminal_interface-curses-menus__adb.htm#ref_276_13">Description</A></FONT> (<FONT COLOR=red><A NAME="ref_282_27" HREF="terminal_interface-curses-menus__adb.htm#ref_276_26">Itm</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>) <b>return</b> String; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/mitem_name.3x.html">item_description();</A></EM></FONT> -- <FONT COLOR=green><EM>-- Implemented as function</EM></FONT> -+ <span class="comment"><EM>-- #1A NAME="AFU_12"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_276_14" HREF="terminal_interface-curses-menus__adb.htm#ref_267_14">Description</A></span> (<span class="symbol"><A NAME="ref_276_27" HREF="terminal_interface-curses-menus__adb.htm#ref_267_27">Itm</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>; -+ <span class="symbol"><A NAME="ref_277_27" HREF="terminal_interface-curses-menus__adb.htm#ref_268_27">Description</A></span> : <b>out</b> String); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/mitem_name.3x.html">item_description();</A></EM></span> -+ -+ <b>function</b> <span class="symbol"><A NAME="ref_280_14" HREF="terminal_interface-curses-menus__adb.htm#ref_276_13">Description</A></span> (<span class="symbol"><A NAME="ref_280_27" HREF="terminal_interface-curses-menus__adb.htm#ref_276_26">Itm</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>) <b>return</b> String; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/mitem_name.3x.html">item_description();</A></EM></span> -+ <span class="comment"><EM>-- Implemented as function</EM></span> - <b>pragma</b> Inline (Description); - -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page <A HREF="../man/mitem_current.3x.html">mitem_current.3x</A></EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_13"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_292_14" HREF="terminal_interface-curses-menus__adb.htm#ref_284_14">Set_Current</A></FONT> (<FONT COLOR=red><A NAME="ref_292_27" HREF="terminal_interface-curses-menus__adb.htm#ref_284_27">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_293_27" HREF="terminal_interface-curses-menus__adb.htm#ref_285_27">Itm</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/mitem_current.3x.html">set_current_item()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses-menus__ads.htm#ref_292_14">Set_Current</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_14"#2|</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_298_13" HREF="terminal_interface-curses-menus__adb.htm#ref_298_13">Current</A></FONT> (<FONT COLOR=red><A NAME="ref_298_22" HREF="terminal_interface-curses-menus__adb.htm#ref_298_22">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/mitem_current.3x.html">current_item()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses-menus__ads.htm#ref_298_13">Current</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_15"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_303_14" HREF="terminal_interface-curses-menus__adb.htm#ref_311_14">Set_Top_Row</A></FONT> (<FONT COLOR=red><A NAME="ref_303_27" HREF="terminal_interface-curses-menus__adb.htm#ref_311_27">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_304_27" HREF="terminal_interface-curses-menus__adb.htm#ref_312_27">Line</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/mitem_current.3x.html">set_top_row()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses-menus__ads.htm#ref_303_14">Set_Top_Row</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_16"#2|</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_309_13" HREF="terminal_interface-curses-menus__adb.htm#ref_325_13">Top_Row</A></FONT> (<FONT COLOR=red><A NAME="ref_309_22" HREF="terminal_interface-curses-menus__adb.htm#ref_325_22">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/mitem_current.3x.html">top_row()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses-menus__ads.htm#ref_309_13">Top_Row</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_17"#2|</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_314_13" HREF="terminal_interface-curses-menus__adb.htm#ref_338_13">Get_Index</A></FONT> (<FONT COLOR=red><A NAME="ref_314_24" HREF="terminal_interface-curses-menus__adb.htm#ref_338_24">Itm</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>) <b>return</b> Positive; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/mitem_current.3x.html">item_index()</A></EM></FONT> -- <FONT COLOR=green><EM>-- Please note that in this binding we start the numbering of items</EM></FONT> -- <FONT COLOR=green><EM>-- with 1. So this is number is one more than you get from the low</EM></FONT> -- <FONT COLOR=green><EM>-- level call.</EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses-menus__ads.htm#ref_314_13">Get_Index</A>); -- -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page <A HREF="../man/menu_post.3x.html">menu_post.3x</A></EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_18"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_326_14" HREF="terminal_interface-curses-menus__adb.htm#ref_351_14">Post</A></FONT> (<FONT COLOR=red><A NAME="ref_326_20" HREF="terminal_interface-curses-menus__adb.htm#ref_351_20">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_327_20" HREF="terminal_interface-curses-menus__adb.htm#ref_352_20">Post</A></FONT> : Boolean := True); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/menu_post.3x.html">post_menu()</A></EM></FONT> -- <FONT COLOR=green><EM>-- AKA: unpost_menu()</EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses-menus__ads.htm#ref_326_14">Post</A>); -- -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page <A HREF="../man/menu_opts.3x.html">menu_opts.3x</A></EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_19"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_337_14" HREF="terminal_interface-curses-menus__adb.htm#ref_371_14">Set_Options</A></FONT> (<FONT COLOR=red><A NAME="ref_337_27" HREF="terminal_interface-curses-menus__adb.htm#ref_371_27">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_338_27" HREF="terminal_interface-curses-menus__adb.htm#ref_372_27">Options</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_121_9">Menu_Option_Set</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/menu_opts.3x.html">set_menu_opts()</A></EM></FONT> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page <A HREF="../man/mitem_current.3x.html">mitem_current.3x</A></EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_13"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_290_14" HREF="terminal_interface-curses-menus__adb.htm#ref_284_14">Set_Current</A></span> (<span class="symbol"><A NAME="ref_290_27" HREF="terminal_interface-curses-menus__adb.htm#ref_284_27">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_291_27" HREF="terminal_interface-curses-menus__adb.htm#ref_285_27">Itm</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/mitem_current.3x.html">set_current_item()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses-menus__ads.htm#ref_290_14">Set_Current</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_14"#2|</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_296_13" HREF="terminal_interface-curses-menus__adb.htm#ref_298_13">Current</A></span> (<span class="symbol"><A NAME="ref_296_22" HREF="terminal_interface-curses-menus__adb.htm#ref_298_22">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/mitem_current.3x.html">current_item()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses-menus__ads.htm#ref_296_13">Current</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_15"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_301_14" HREF="terminal_interface-curses-menus__adb.htm#ref_311_14">Set_Top_Row</A></span> (<span class="symbol"><A NAME="ref_301_27" HREF="terminal_interface-curses-menus__adb.htm#ref_311_27">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_302_27" HREF="terminal_interface-curses-menus__adb.htm#ref_312_27">Line</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/mitem_current.3x.html">set_top_row()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses-menus__ads.htm#ref_301_14">Set_Top_Row</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_16"#2|</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_307_13" HREF="terminal_interface-curses-menus__adb.htm#ref_325_13">Top_Row</A></span> (<span class="symbol"><A NAME="ref_307_22" HREF="terminal_interface-curses-menus__adb.htm#ref_325_22">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/mitem_current.3x.html">top_row()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses-menus__ads.htm#ref_307_13">Top_Row</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_17"#2|</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_312_13" HREF="terminal_interface-curses-menus__adb.htm#ref_338_13">Get_Index</A></span> (<span class="symbol"><A NAME="ref_312_24" HREF="terminal_interface-curses-menus__adb.htm#ref_338_24">Itm</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>) <b>return</b> Positive; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/mitem_current.3x.html">item_index()</A></EM></span> -+ <span class="comment"><EM>-- Please note that in this binding we start the numbering of items</EM></span> -+ <span class="comment"><EM>-- with 1. So this is number is one more than you get from the low</EM></span> -+ <span class="comment"><EM>-- level call.</EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses-menus__ads.htm#ref_312_13">Get_Index</A>); -+ -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page <A HREF="../man/menu_post.3x.html">menu_post.3x</A></EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_18"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_324_14" HREF="terminal_interface-curses-menus__adb.htm#ref_351_14">Post</A></span> (<span class="symbol"><A NAME="ref_324_20" HREF="terminal_interface-curses-menus__adb.htm#ref_351_20">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_325_20" HREF="terminal_interface-curses-menus__adb.htm#ref_352_20">Post</A></span> : Boolean := True); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/menu_post.3x.html">post_menu()</A></EM></span> -+ <span class="comment"><EM>-- AKA: unpost_menu()</EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses-menus__ads.htm#ref_324_14">Post</A>); -+ -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page <A HREF="../man/menu_opts.3x.html">menu_opts.3x</A></EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_19"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_335_14" HREF="terminal_interface-curses-menus__adb.htm#ref_371_14">Set_Options</A></span> (<span class="symbol"><A NAME="ref_335_27" HREF="terminal_interface-curses-menus__adb.htm#ref_371_27">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_336_27" HREF="terminal_interface-curses-menus__adb.htm#ref_372_27">Options</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_121_9">Menu_Option_Set</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/menu_opts.3x.html">set_menu_opts()</A></EM></span> - <b>pragma</b> Inline (Set_Options); - -- <FONT COLOR=green><EM>-- #1A NAME="AFU_20"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_343_14" HREF="terminal_interface-curses-menus__adb.htm#ref_387_14">Switch_Options</A></FONT> (<FONT COLOR=red><A NAME="ref_343_30" HREF="terminal_interface-curses-menus__adb.htm#ref_387_30">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_344_30" HREF="terminal_interface-curses-menus__adb.htm#ref_388_30">Options</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_121_9">Menu_Option_Set</A>; -- <FONT COLOR=red><A NAME="ref_345_30" HREF="terminal_interface-curses-menus__adb.htm#ref_389_30">On</A></FONT> : Boolean := True); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/menu_opts.3x.html">menu_opts_on()</A></EM></FONT> -- <FONT COLOR=green><EM>-- AKA: menu_opts_off()</EM></FONT> -+ <span class="comment"><EM>-- #1A NAME="AFU_20"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_341_14" HREF="terminal_interface-curses-menus__adb.htm#ref_387_14">Switch_Options</A></span> (<span class="symbol"><A NAME="ref_341_30" HREF="terminal_interface-curses-menus__adb.htm#ref_387_30">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_342_30" HREF="terminal_interface-curses-menus__adb.htm#ref_388_30">Options</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_121_9">Menu_Option_Set</A>; -+ <span class="symbol"><A NAME="ref_343_30" HREF="terminal_interface-curses-menus__adb.htm#ref_389_30">On</A></span> : Boolean := True); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/menu_opts.3x.html">menu_opts_on()</A></EM></span> -+ <span class="comment"><EM>-- AKA: menu_opts_off()</EM></span> - <b>pragma</b> Inline (Switch_Options); - -- <FONT COLOR=green><EM>-- #1A NAME="AFU_21"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_351_14" HREF="terminal_interface-curses-menus__adb.htm#ref_411_14">Get_Options</A></FONT> (<FONT COLOR=red><A NAME="ref_351_27" HREF="terminal_interface-curses-menus__adb.htm#ref_411_27">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_352_27" HREF="terminal_interface-curses-menus__adb.htm#ref_412_27">Options</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_121_9">Menu_Option_Set</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/menu_opts.3x.html">menu_opts()</A></EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_22"#2|</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_356_13" HREF="terminal_interface-curses-menus__adb.htm#ref_422_13">Get_Options</A></FONT> (<FONT COLOR=red><A NAME="ref_356_26" HREF="terminal_interface-curses-menus__adb.htm#ref_422_26">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A> := <A HREF="terminal_interface-curses-menus__ads.htm#ref_63_4">Null_Menu</A>) <b>return</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_121_9">Menu_Option_Set</A>; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/menu_opts.3x.html">menu_opts()</A></EM></FONT> -+ <span class="comment"><EM>-- #1A NAME="AFU_21"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_349_14" HREF="terminal_interface-curses-menus__adb.htm#ref_411_14">Get_Options</A></span> (<span class="symbol"><A NAME="ref_349_27" HREF="terminal_interface-curses-menus__adb.htm#ref_411_27">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_350_27" HREF="terminal_interface-curses-menus__adb.htm#ref_412_27">Options</A></span> : <b>out</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_121_9">Menu_Option_Set</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/menu_opts.3x.html">menu_opts()</A></EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_22"#2|</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_354_13" HREF="terminal_interface-curses-menus__adb.htm#ref_422_13">Get_Options</A></span> (<span class="symbol"><A NAME="ref_354_26" HREF="terminal_interface-curses-menus__adb.htm#ref_422_26">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A> := <A HREF="terminal_interface-curses-menus__ads.htm#ref_63_4">Null_Menu</A>) <b>return</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_121_9">Menu_Option_Set</A>; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/menu_opts.3x.html">menu_opts()</A></EM></span> - <b>pragma</b> Inline (Get_Options); - -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page <A HREF="../man/menu_win.3x.html">menu_win.3x</A></EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_23"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_365_14" HREF="terminal_interface-curses-menus__adb.htm#ref_430_14">Set_Window</A></FONT> (<FONT COLOR=red><A NAME="ref_365_26" HREF="terminal_interface-curses-menus__adb.htm#ref_430_26">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_366_26" HREF="terminal_interface-curses-menus__adb.htm#ref_431_26">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/menu_win.3x.html">set_menu_win()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses-menus__ads.htm#ref_365_14">Set_Window</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_24"#2|</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_371_13" HREF="terminal_interface-curses-menus__adb.htm#ref_444_13">Get_Window</A></FONT> (<FONT COLOR=red><A NAME="ref_371_25" HREF="terminal_interface-curses-menus__adb.htm#ref_444_25">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/menu_win.3x.html">menu_win()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses-menus__ads.htm#ref_371_13">Get_Window</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_25"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_376_14" HREF="terminal_interface-curses-menus__adb.htm#ref_454_14">Set_Sub_Window</A></FONT> (<FONT COLOR=red><A NAME="ref_376_30" HREF="terminal_interface-curses-menus__adb.htm#ref_454_30">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_377_30" HREF="terminal_interface-curses-menus__adb.htm#ref_455_30">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/menu_win.3x.html">set_menu_sub()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses-menus__ads.htm#ref_376_14">Set_Sub_Window</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_26"#2|</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_382_13" HREF="terminal_interface-curses-menus__adb.htm#ref_468_13">Get_Sub_Window</A></FONT> (<FONT COLOR=red><A NAME="ref_382_29" HREF="terminal_interface-curses-menus__adb.htm#ref_468_29">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/menu_win.3x.html">menu_sub()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses-menus__ads.htm#ref_382_13">Get_Sub_Window</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_27"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_387_14" HREF="terminal_interface-curses-menus__adb.htm#ref_478_14">Scale</A></FONT> (<FONT COLOR=red><A NAME="ref_387_21" HREF="terminal_interface-curses-menus__adb.htm#ref_478_21">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_388_21" HREF="terminal_interface-curses-menus__adb.htm#ref_479_21">Lines</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_63_12">Line_Count</A>; -- <FONT COLOR=red><A NAME="ref_389_21" HREF="terminal_interface-curses-menus__adb.htm#ref_480_21">Columns</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_65_12">Column_Count</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/menu_win.3x.html">scale_menu()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses-menus__ads.htm#ref_387_14">Scale</A>); -- -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page <A HREF="../man/menu_cursor.3x.html">menu_cursor.3x</A></EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_28"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_398_14" HREF="terminal_interface-curses-menus__adb.htm#ref_497_14">Position_Cursor</A></FONT> (<FONT COLOR=red><A NAME="ref_398_31" HREF="terminal_interface-curses-menus__adb.htm#ref_497_31">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/menu_cursor.3x.html">pos_menu_cursor()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses-menus__ads.htm#ref_398_14">Position_Cursor</A>); -- -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page <A HREF="../man/menu_mark.3x.html">menu_mark.3x</A></EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_29"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_407_14" HREF="terminal_interface-curses-menus__adb.htm#ref_510_14">Set_Mark</A></FONT> (<FONT COLOR=red><A NAME="ref_407_24" HREF="terminal_interface-curses-menus__adb.htm#ref_510_24">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_408_24" HREF="terminal_interface-curses-menus__adb.htm#ref_511_24">Mark</A></FONT> : String); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/menu_mark.3x.html">set_menu_mark()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses-menus__ads.htm#ref_407_14">Set_Mark</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_30"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_413_14" HREF="terminal_interface-curses-menus__adb.htm#ref_529_14">Mark</A></FONT> (<FONT COLOR=red><A NAME="ref_413_20" HREF="terminal_interface-curses-menus__adb.htm#ref_529_20">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_414_20" HREF="terminal_interface-curses-menus__adb.htm#ref_530_20">Mark</A></FONT> : <b>out</b> String); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/menu_mark.3x.html">menu_mark()</A></EM></FONT> -- -- <b>function</b> <FONT COLOR=red><A NAME="ref_417_14" HREF="terminal_interface-curses-menus__adb.htm#ref_538_13">Mark</A></FONT> (<FONT COLOR=red><A NAME="ref_417_20" HREF="terminal_interface-curses-menus__adb.htm#ref_538_19">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> String; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/menu_mark.3x.html">menu_mark()</A></EM></FONT> -- <FONT COLOR=green><EM>-- Implemented as function</EM></FONT> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page <A HREF="../man/menu_win.3x.html">menu_win.3x</A></EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_23"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_363_14" HREF="terminal_interface-curses-menus__adb.htm#ref_430_14">Set_Window</A></span> (<span class="symbol"><A NAME="ref_363_26" HREF="terminal_interface-curses-menus__adb.htm#ref_430_26">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_364_26" HREF="terminal_interface-curses-menus__adb.htm#ref_431_26">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/menu_win.3x.html">set_menu_win()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses-menus__ads.htm#ref_363_14">Set_Window</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_24"#2|</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_369_13" HREF="terminal_interface-curses-menus__adb.htm#ref_444_13">Get_Window</A></span> (<span class="symbol"><A NAME="ref_369_25" HREF="terminal_interface-curses-menus__adb.htm#ref_444_25">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/menu_win.3x.html">menu_win()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses-menus__ads.htm#ref_369_13">Get_Window</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_25"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_374_14" HREF="terminal_interface-curses-menus__adb.htm#ref_454_14">Set_Sub_Window</A></span> (<span class="symbol"><A NAME="ref_374_30" HREF="terminal_interface-curses-menus__adb.htm#ref_454_30">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_375_30" HREF="terminal_interface-curses-menus__adb.htm#ref_455_30">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/menu_win.3x.html">set_menu_sub()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses-menus__ads.htm#ref_374_14">Set_Sub_Window</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_26"#2|</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_380_13" HREF="terminal_interface-curses-menus__adb.htm#ref_468_13">Get_Sub_Window</A></span> (<span class="symbol"><A NAME="ref_380_29" HREF="terminal_interface-curses-menus__adb.htm#ref_468_29">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/menu_win.3x.html">menu_sub()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses-menus__ads.htm#ref_380_13">Get_Sub_Window</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_27"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_385_14" HREF="terminal_interface-curses-menus__adb.htm#ref_478_14">Scale</A></span> (<span class="symbol"><A NAME="ref_385_21" HREF="terminal_interface-curses-menus__adb.htm#ref_478_21">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_386_21" HREF="terminal_interface-curses-menus__adb.htm#ref_479_21">Lines</A></span> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_63_12">Line_Count</A>; -+ <span class="symbol"><A NAME="ref_387_21" HREF="terminal_interface-curses-menus__adb.htm#ref_480_21">Columns</A></span> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_65_12">Column_Count</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/menu_win.3x.html">scale_menu()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses-menus__ads.htm#ref_385_14">Scale</A>); -+ -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page <A HREF="../man/menu_cursor.3x.html">menu_cursor.3x</A></EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_28"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_396_14" HREF="terminal_interface-curses-menus__adb.htm#ref_497_14">Position_Cursor</A></span> (<span class="symbol"><A NAME="ref_396_31" HREF="terminal_interface-curses-menus__adb.htm#ref_497_31">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/menu_cursor.3x.html">pos_menu_cursor()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses-menus__ads.htm#ref_396_14">Position_Cursor</A>); -+ -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page <A HREF="../man/menu_mark.3x.html">menu_mark.3x</A></EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_29"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_405_14" HREF="terminal_interface-curses-menus__adb.htm#ref_510_14">Set_Mark</A></span> (<span class="symbol"><A NAME="ref_405_24" HREF="terminal_interface-curses-menus__adb.htm#ref_510_24">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_406_24" HREF="terminal_interface-curses-menus__adb.htm#ref_511_24">Mark</A></span> : String); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/menu_mark.3x.html">set_menu_mark()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses-menus__ads.htm#ref_405_14">Set_Mark</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_30"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_411_14" HREF="terminal_interface-curses-menus__adb.htm#ref_529_14">Mark</A></span> (<span class="symbol"><A NAME="ref_411_20" HREF="terminal_interface-curses-menus__adb.htm#ref_529_20">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_412_20" HREF="terminal_interface-curses-menus__adb.htm#ref_530_20">Mark</A></span> : <b>out</b> String); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/menu_mark.3x.html">menu_mark()</A></EM></span> -+ -+ <b>function</b> <span class="symbol"><A NAME="ref_415_14" HREF="terminal_interface-curses-menus__adb.htm#ref_538_13">Mark</A></span> (<span class="symbol"><A NAME="ref_415_20" HREF="terminal_interface-curses-menus__adb.htm#ref_538_19">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> String; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/menu_mark.3x.html">menu_mark()</A></EM></span> -+ <span class="comment"><EM>-- Implemented as function</EM></span> - <b>pragma</b> Inline (Mark); - -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page <A HREF="../man/menu_attributes.3x.html">menu_attributes.3x</A></EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_31"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_427_14" HREF="terminal_interface-curses-menus__adb.htm#ref_547_14">Set_Foreground</A></FONT> -- (<FONT COLOR=red><A NAME="ref_428_7" HREF="terminal_interface-curses-menus__adb.htm#ref_548_7">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_429_7" HREF="terminal_interface-curses-menus__adb.htm#ref_549_7">Fore</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A> := <A HREF="terminal_interface-curses__ads.htm#ref_352_4">Normal_Video</A>; -- <FONT COLOR=red><A NAME="ref_430_7" HREF="terminal_interface-curses-menus__adb.htm#ref_550_7">Color</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A> := <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>'First); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/menu_attributes.3x.html">set_menu_fore()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses-menus__ads.htm#ref_427_14">Set_Foreground</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_32"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_435_14" HREF="terminal_interface-curses-menus__adb.htm#ref_566_14">Foreground</A></FONT> (<FONT COLOR=red><A NAME="ref_435_26" HREF="terminal_interface-curses-menus__adb.htm#ref_566_26">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_436_26" HREF="terminal_interface-curses-menus__adb.htm#ref_567_26">Fore</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/menu_attributes.3x.html">menu_fore()</A></EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_33"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_440_14" HREF="terminal_interface-curses-menus__adb.htm#ref_575_14">Foreground</A></FONT> (<FONT COLOR=red><A NAME="ref_440_26" HREF="terminal_interface-curses-menus__adb.htm#ref_575_26">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_441_26" HREF="terminal_interface-curses-menus__adb.htm#ref_576_26">Fore</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A>; -- <FONT COLOR=red><A NAME="ref_442_26" HREF="terminal_interface-curses-menus__adb.htm#ref_577_26">Color</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/menu_attributes.3x.html">menu_fore()</A></EM></FONT> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page <A HREF="../man/menu_attributes.3x.html">menu_attributes.3x</A></EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_31"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_425_14" HREF="terminal_interface-curses-menus__adb.htm#ref_547_14">Set_Foreground</A></span> -+ (<span class="symbol"><A NAME="ref_426_7" HREF="terminal_interface-curses-menus__adb.htm#ref_548_7">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_427_7" HREF="terminal_interface-curses-menus__adb.htm#ref_549_7">Fore</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A> := <A HREF="terminal_interface-curses__ads.htm#ref_351_4">Normal_Video</A>; -+ <span class="symbol"><A NAME="ref_428_7" HREF="terminal_interface-curses-menus__adb.htm#ref_550_7">Color</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A> := <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>'First); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/menu_attributes.3x.html">set_menu_fore()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses-menus__ads.htm#ref_425_14">Set_Foreground</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_32"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_433_14" HREF="terminal_interface-curses-menus__adb.htm#ref_566_14">Foreground</A></span> (<span class="symbol"><A NAME="ref_433_26" HREF="terminal_interface-curses-menus__adb.htm#ref_566_26">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_434_26" HREF="terminal_interface-curses-menus__adb.htm#ref_567_26">Fore</A></span> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/menu_attributes.3x.html">menu_fore()</A></EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_33"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_438_14" HREF="terminal_interface-curses-menus__adb.htm#ref_575_14">Foreground</A></span> (<span class="symbol"><A NAME="ref_438_26" HREF="terminal_interface-curses-menus__adb.htm#ref_575_26">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_439_26" HREF="terminal_interface-curses-menus__adb.htm#ref_576_26">Fore</A></span> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A>; -+ <span class="symbol"><A NAME="ref_440_26" HREF="terminal_interface-curses-menus__adb.htm#ref_577_26">Color</A></span> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/menu_attributes.3x.html">menu_fore()</A></EM></span> - <b>pragma</b> Inline (Foreground); - -- <FONT COLOR=green><EM>-- #1A NAME="AFU_34"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_447_14" HREF="terminal_interface-curses-menus__adb.htm#ref_586_14">Set_Background</A></FONT> -- (<FONT COLOR=red><A NAME="ref_448_7" HREF="terminal_interface-curses-menus__adb.htm#ref_587_7">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_449_7" HREF="terminal_interface-curses-menus__adb.htm#ref_588_7">Back</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A> := <A HREF="terminal_interface-curses__ads.htm#ref_352_4">Normal_Video</A>; -- <FONT COLOR=red><A NAME="ref_450_7" HREF="terminal_interface-curses-menus__adb.htm#ref_589_7">Color</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A> := <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>'First); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/menu_attributes.3x.html">set_menu_back()</A></EM></FONT> -+ <span class="comment"><EM>-- #1A NAME="AFU_34"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_445_14" HREF="terminal_interface-curses-menus__adb.htm#ref_586_14">Set_Background</A></span> -+ (<span class="symbol"><A NAME="ref_446_7" HREF="terminal_interface-curses-menus__adb.htm#ref_587_7">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_447_7" HREF="terminal_interface-curses-menus__adb.htm#ref_588_7">Back</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A> := <A HREF="terminal_interface-curses__ads.htm#ref_351_4">Normal_Video</A>; -+ <span class="symbol"><A NAME="ref_448_7" HREF="terminal_interface-curses-menus__adb.htm#ref_589_7">Color</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A> := <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>'First); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/menu_attributes.3x.html">set_menu_back()</A></EM></span> - <b>pragma</b> Inline (Set_Background); - -- <FONT COLOR=green><EM>-- #1A NAME="AFU_35"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_455_14" HREF="terminal_interface-curses-menus__adb.htm#ref_605_14">Background</A></FONT> (<FONT COLOR=red><A NAME="ref_455_26" HREF="terminal_interface-curses-menus__adb.htm#ref_605_26">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_456_26" HREF="terminal_interface-curses-menus__adb.htm#ref_606_26">Back</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/menu_attributes.3x.html">menu_back()</A></EM></FONT> -- <FONT COLOR=green><EM>-- #1A NAME="AFU_36"#2|</EM></FONT> -- -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_460_14" HREF="terminal_interface-curses-menus__adb.htm#ref_614_14">Background</A></FONT> (<FONT COLOR=red><A NAME="ref_460_26" HREF="terminal_interface-curses-menus__adb.htm#ref_614_26">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_461_26" HREF="terminal_interface-curses-menus__adb.htm#ref_615_26">Back</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A>; -- <FONT COLOR=red><A NAME="ref_462_26" HREF="terminal_interface-curses-menus__adb.htm#ref_616_26">Color</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/menu_attributes.3x.html">menu_back()</A></EM></FONT> -+ <span class="comment"><EM>-- #1A NAME="AFU_35"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_453_14" HREF="terminal_interface-curses-menus__adb.htm#ref_605_14">Background</A></span> (<span class="symbol"><A NAME="ref_453_26" HREF="terminal_interface-curses-menus__adb.htm#ref_605_26">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_454_26" HREF="terminal_interface-curses-menus__adb.htm#ref_606_26">Back</A></span> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/menu_attributes.3x.html">menu_back()</A></EM></span> -+ <span class="comment"><EM>-- #1A NAME="AFU_36"#2|</EM></span> -+ -+ <b>procedure</b> <span class="symbol"><A NAME="ref_458_14" HREF="terminal_interface-curses-menus__adb.htm#ref_614_14">Background</A></span> (<span class="symbol"><A NAME="ref_458_26" HREF="terminal_interface-curses-menus__adb.htm#ref_614_26">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_459_26" HREF="terminal_interface-curses-menus__adb.htm#ref_615_26">Back</A></span> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A>; -+ <span class="symbol"><A NAME="ref_460_26" HREF="terminal_interface-curses-menus__adb.htm#ref_616_26">Color</A></span> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/menu_attributes.3x.html">menu_back()</A></EM></span> - <b>pragma</b> Inline (Background); - -- <FONT COLOR=green><EM>-- #1A NAME="AFU_37"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_467_14" HREF="terminal_interface-curses-menus__adb.htm#ref_625_14">Set_Grey</A></FONT> -- (<FONT COLOR=red><A NAME="ref_468_7" HREF="terminal_interface-curses-menus__adb.htm#ref_625_24">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_469_7" HREF="terminal_interface-curses-menus__adb.htm#ref_626_24">Grey</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A> := <A HREF="terminal_interface-curses__ads.htm#ref_352_4">Normal_Video</A>; -- <FONT COLOR=red><A NAME="ref_470_7" HREF="terminal_interface-curses-menus__adb.htm#ref_627_24">Color</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A> := <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>'First); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/menu_attributes.3x.html">set_menu_grey()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses-menus__ads.htm#ref_467_14">Set_Grey</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_38"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_475_14" HREF="terminal_interface-curses-menus__adb.htm#ref_644_14">Grey</A></FONT> (<FONT COLOR=red><A NAME="ref_475_20" HREF="terminal_interface-curses-menus__adb.htm#ref_644_20">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_476_20" HREF="terminal_interface-curses-menus__adb.htm#ref_645_20">Grey</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/menu_attributes.3x.html">menu_grey()</A></EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_39"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_480_14" HREF="terminal_interface-curses-menus__adb.htm#ref_653_14">Grey</A></FONT> -- (<FONT COLOR=red><A NAME="ref_481_7" HREF="terminal_interface-curses-menus__adb.htm#ref_653_20">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_482_7" HREF="terminal_interface-curses-menus__adb.htm#ref_654_20">Grey</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A>; -- <FONT COLOR=red><A NAME="ref_483_7" HREF="terminal_interface-curses-menus__adb.htm#ref_655_20">Color</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/menu_attributes.3x.html">menu_grey()</A></EM></FONT> -+ <span class="comment"><EM>-- #1A NAME="AFU_37"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_465_14" HREF="terminal_interface-curses-menus__adb.htm#ref_625_14">Set_Grey</A></span> -+ (<span class="symbol"><A NAME="ref_466_7" HREF="terminal_interface-curses-menus__adb.htm#ref_625_24">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_467_7" HREF="terminal_interface-curses-menus__adb.htm#ref_626_24">Grey</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A> := <A HREF="terminal_interface-curses__ads.htm#ref_351_4">Normal_Video</A>; -+ <span class="symbol"><A NAME="ref_468_7" HREF="terminal_interface-curses-menus__adb.htm#ref_627_24">Color</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A> := <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>'First); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/menu_attributes.3x.html">set_menu_grey()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses-menus__ads.htm#ref_465_14">Set_Grey</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_38"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_473_14" HREF="terminal_interface-curses-menus__adb.htm#ref_644_14">Grey</A></span> (<span class="symbol"><A NAME="ref_473_20" HREF="terminal_interface-curses-menus__adb.htm#ref_644_20">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_474_20" HREF="terminal_interface-curses-menus__adb.htm#ref_645_20">Grey</A></span> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/menu_attributes.3x.html">menu_grey()</A></EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_39"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_478_14" HREF="terminal_interface-curses-menus__adb.htm#ref_653_14">Grey</A></span> -+ (<span class="symbol"><A NAME="ref_479_7" HREF="terminal_interface-curses-menus__adb.htm#ref_653_20">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_480_7" HREF="terminal_interface-curses-menus__adb.htm#ref_654_20">Grey</A></span> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_307_9">Character_Attribute_Set</A>; -+ <span class="symbol"><A NAME="ref_481_7" HREF="terminal_interface-curses-menus__adb.htm#ref_655_20">Color</A></span> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_299_9">Color_Pair</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/menu_attributes.3x.html">menu_grey()</A></EM></span> - <b>pragma</b> Inline (Grey); - -- <FONT COLOR=green><EM>-- #1A NAME="AFU_40"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_488_14" HREF="terminal_interface-curses-menus__adb.htm#ref_664_14">Set_Pad_Character</A></FONT> (<FONT COLOR=red><A NAME="ref_488_33" HREF="terminal_interface-curses-menus__adb.htm#ref_664_33">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_489_33" HREF="terminal_interface-curses-menus__adb.htm#ref_665_33">Pad</A></FONT> : Character := Space); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/menu_attributes.3x.html">set_menu_pad()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses-menus__ads.htm#ref_488_14">Set_Pad_Character</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_41"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_494_14" HREF="terminal_interface-curses-menus__adb.htm#ref_679_14">Pad_Character</A></FONT> (<FONT COLOR=red><A NAME="ref_494_29" HREF="terminal_interface-curses-menus__adb.htm#ref_679_29">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_495_29" HREF="terminal_interface-curses-menus__adb.htm#ref_680_29">Pad</A></FONT> : <b>out</b> Character); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/menu_attributes.3x.html">menu_pad()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses-menus__ads.htm#ref_494_14">Pad_Character</A>); -- -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page <A HREF="../man/menu_spacing.3x.html">menu_spacing.3x</A></EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_42"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_504_14" HREF="terminal_interface-curses-menus__adb.htm#ref_688_14">Set_Spacing</A></FONT> (<FONT COLOR=red><A NAME="ref_504_27" HREF="terminal_interface-curses-menus__adb.htm#ref_688_27">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_505_27" HREF="terminal_interface-curses-menus__adb.htm#ref_689_27">Descr</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A> := 0; -- <FONT COLOR=red><A NAME="ref_506_27" HREF="terminal_interface-curses-menus__adb.htm#ref_690_27">Row</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A> := 0; -- <FONT COLOR=red><A NAME="ref_507_27" HREF="terminal_interface-curses-menus__adb.htm#ref_691_27">Col</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A> := 0); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/menu_spacing.3x.html">set_menu_spacing()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses-menus__ads.htm#ref_504_14">Set_Spacing</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_43"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_512_14" HREF="terminal_interface-curses-menus__adb.htm#ref_707_14">Spacing</A></FONT> (<FONT COLOR=red><A NAME="ref_512_23" HREF="terminal_interface-curses-menus__adb.htm#ref_707_23">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_513_23" HREF="terminal_interface-curses-menus__adb.htm#ref_708_23">Descr</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -- <FONT COLOR=red><A NAME="ref_514_23" HREF="terminal_interface-curses-menus__adb.htm#ref_709_23">Row</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_515_23" HREF="terminal_interface-curses-menus__adb.htm#ref_710_23">Col</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/menu_spacing.3x.html">menu_spacing()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses-menus__ads.htm#ref_512_14">Spacing</A>); -- -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page <A HREF="../man/menu_pattern.3x.html">menu_pattern.3x</A></EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_44"#2|</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_524_13" HREF="terminal_interface-curses-menus__adb.htm#ref_732_13">Set_Pattern</A></FONT> (<FONT COLOR=red><A NAME="ref_524_26" HREF="terminal_interface-curses-menus__adb.htm#ref_732_26">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_525_26" HREF="terminal_interface-curses-menus__adb.htm#ref_733_26">Text</A></FONT> : String) <b>return</b> Boolean; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/menu_pattern.3x.html">set_menu_pattern()</A></EM></FONT> -- <FONT COLOR=green><EM>-- Return TRUE if the pattern matches, FALSE otherwise</EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses-menus__ads.htm#ref_524_13">Set_Pattern</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_45"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_531_14" HREF="terminal_interface-curses-menus__adb.htm#ref_755_14">Pattern</A></FONT> (<FONT COLOR=red><A NAME="ref_531_23" HREF="terminal_interface-curses-menus__adb.htm#ref_755_23">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_532_23" HREF="terminal_interface-curses-menus__adb.htm#ref_756_23">Text</A></FONT> : <b>out</b> String); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/menu_pattern.3x.html">menu_pattern()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses-menus__ads.htm#ref_531_14">Pattern</A>); -- -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page <A HREF="../man/menu_format.3x.html">menu_format.3x</A></EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_46"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_541_14" HREF="terminal_interface-curses-menus__adb.htm#ref_764_14">Set_Format</A></FONT> (<FONT COLOR=red><A NAME="ref_541_26" HREF="terminal_interface-curses-menus__adb.htm#ref_764_26">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_542_26" HREF="terminal_interface-curses-menus__adb.htm#ref_765_26">Lines</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_63_12">Line_Count</A>; -- <FONT COLOR=red><A NAME="ref_543_26" HREF="terminal_interface-curses-menus__adb.htm#ref_766_26">Columns</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_65_12">Column_Count</A>); -- <FONT COLOR=green><EM>-- Not implemented: 0 argument for Lines or Columns;</EM></FONT> -- <FONT COLOR=green><EM>-- instead use Format to get the current sizes</EM></FONT> -- <FONT COLOR=green><EM>-- The default format is 16 rows, 1 column. Calling</EM></FONT> -- <FONT COLOR=green><EM>-- set_menu_format with a null menu pointer will change this</EM></FONT> -- <FONT COLOR=green><EM>-- default. A zero row or column argument to set_menu_format</EM></FONT> -- <FONT COLOR=green><EM>-- is interpreted as a request not to change the current</EM></FONT> -- <FONT COLOR=green><EM>-- value.</EM></FONT> -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/menu_format.3x.html">set_menu_format()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses-menus__ads.htm#ref_541_14">Set_Format</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_47"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_555_14" HREF="terminal_interface-curses-menus__adb.htm#ref_782_14">Format</A></FONT> (<FONT COLOR=red><A NAME="ref_555_22" HREF="terminal_interface-curses-menus__adb.htm#ref_782_22">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_556_22" HREF="terminal_interface-curses-menus__adb.htm#ref_783_22">Lines</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_63_12">Line_Count</A>; -- <FONT COLOR=red><A NAME="ref_557_22" HREF="terminal_interface-curses-menus__adb.htm#ref_784_22">Columns</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_65_12">Column_Count</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/menu_format.3x.html">menu_format()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses-menus__ads.htm#ref_555_14">Format</A>); -- -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page <A HREF="../man/menu_hook.3x.html">menu_hook.3x</A></EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- -- <b>type</b> <FONT COLOR=red><A NAME="ref_565_9">Menu_Hook_Function</A></FONT> <b>is</b> <b>access</b> <b>procedure</b> (<FONT COLOR=red><A NAME="ref_565_49">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>); -- <b>pragma</b> Convention (C, <A HREF="terminal_interface-curses-menus__ads.htm#ref_565_9">Menu_Hook_Function</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_48"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_569_14" HREF="terminal_interface-curses-menus__adb.htm#ref_802_14">Set_Item_Init_Hook</A></FONT> (<FONT COLOR=red><A NAME="ref_569_34" HREF="terminal_interface-curses-menus__adb.htm#ref_802_34">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_570_34" HREF="terminal_interface-curses-menus__adb.htm#ref_803_34">Proc</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_565_9">Menu_Hook_Function</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/menu_hook.3x.html">set_item_init()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses-menus__ads.htm#ref_569_14">Set_Item_Init_Hook</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_49"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_575_14" HREF="terminal_interface-curses-menus__adb.htm#ref_816_14">Set_Item_Term_Hook</A></FONT> (<FONT COLOR=red><A NAME="ref_575_34" HREF="terminal_interface-curses-menus__adb.htm#ref_816_34">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_576_34" HREF="terminal_interface-curses-menus__adb.htm#ref_817_34">Proc</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_565_9">Menu_Hook_Function</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/menu_hook.3x.html">set_item_term()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses-menus__ads.htm#ref_575_14">Set_Item_Term_Hook</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_50"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_581_14" HREF="terminal_interface-curses-menus__adb.htm#ref_830_14">Set_Menu_Init_Hook</A></FONT> (<FONT COLOR=red><A NAME="ref_581_34" HREF="terminal_interface-curses-menus__adb.htm#ref_830_34">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_582_34" HREF="terminal_interface-curses-menus__adb.htm#ref_831_34">Proc</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_565_9">Menu_Hook_Function</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/menu_hook.3x.html">set_menu_init()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses-menus__ads.htm#ref_581_14">Set_Menu_Init_Hook</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_51"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_587_14" HREF="terminal_interface-curses-menus__adb.htm#ref_844_14">Set_Menu_Term_Hook</A></FONT> (<FONT COLOR=red><A NAME="ref_587_34" HREF="terminal_interface-curses-menus__adb.htm#ref_844_34">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_588_34" HREF="terminal_interface-curses-menus__adb.htm#ref_845_34">Proc</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_565_9">Menu_Hook_Function</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/menu_hook.3x.html">set_menu_term()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses-menus__ads.htm#ref_587_14">Set_Menu_Term_Hook</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_52"#2|</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_593_13" HREF="terminal_interface-curses-menus__adb.htm#ref_858_13">Get_Item_Init_Hook</A></FONT> (<FONT COLOR=red><A NAME="ref_593_33" HREF="terminal_interface-curses-menus__adb.htm#ref_858_33">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_565_9">Menu_Hook_Function</A>; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/menu_hook.3x.html">item_init()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses-menus__ads.htm#ref_593_13">Get_Item_Init_Hook</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_53"#2|</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_598_13" HREF="terminal_interface-curses-menus__adb.htm#ref_866_13">Get_Item_Term_Hook</A></FONT> (<FONT COLOR=red><A NAME="ref_598_33" HREF="terminal_interface-curses-menus__adb.htm#ref_866_33">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_565_9">Menu_Hook_Function</A>; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/menu_hook.3x.html">item_term()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses-menus__ads.htm#ref_598_13">Get_Item_Term_Hook</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_54"#2|</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_603_13" HREF="terminal_interface-curses-menus__adb.htm#ref_874_13">Get_Menu_Init_Hook</A></FONT> (<FONT COLOR=red><A NAME="ref_603_33" HREF="terminal_interface-curses-menus__adb.htm#ref_874_33">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_565_9">Menu_Hook_Function</A>; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/menu_hook.3x.html">menu_init()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses-menus__ads.htm#ref_603_13">Get_Menu_Init_Hook</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_55"#2|</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_608_13" HREF="terminal_interface-curses-menus__adb.htm#ref_882_13">Get_Menu_Term_Hook</A></FONT> (<FONT COLOR=red><A NAME="ref_608_33" HREF="terminal_interface-curses-menus__adb.htm#ref_882_33">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_565_9">Menu_Hook_Function</A>; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/menu_hook.3x.html">menu_term()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses-menus__ads.htm#ref_608_13">Get_Menu_Term_Hook</A>); -- -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page <A HREF="../man/menu_items.3x.html">menu_items.3x</A></EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_56"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_617_14" HREF="terminal_interface-curses-menus__adb.htm#ref_890_14">Redefine</A></FONT> (<FONT COLOR=red><A NAME="ref_617_24" HREF="terminal_interface-curses-menus__adb.htm#ref_890_24">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_618_24" HREF="terminal_interface-curses-menus__adb.htm#ref_891_24">Items</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_182_9">Item_Array_Access</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/menu_items.3x.html">set_menu_items()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses-menus__ads.htm#ref_617_14">Redefine</A>); -- -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_622_14">Set_Items</A></FONT> (<FONT COLOR=red><A NAME="ref_622_25">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_623_25">Items</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_182_9">Item_Array_Access</A>) <b>renames</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_617_14">Redefine</A>; -- <FONT COLOR=green><EM>-- pragma Inline (Set_Items);</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_57"#2|</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_627_13" HREF="terminal_interface-curses-menus__adb.htm#ref_918_13">Items</A></FONT> (<FONT COLOR=red><A NAME="ref_627_20" HREF="terminal_interface-curses-menus__adb.htm#ref_918_20">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_628_20" HREF="terminal_interface-curses-menus__adb.htm#ref_919_20">Index</A></FONT> : Positive) <b>return</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/menu_items.3x.html">menu_items()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses-menus__ads.htm#ref_627_13">Items</A>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_58"#2|</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_633_13" HREF="terminal_interface-curses-menus__adb.htm#ref_910_13">Item_Count</A></FONT> (<FONT COLOR=red><A NAME="ref_633_25" HREF="terminal_interface-curses-menus__adb.htm#ref_910_25">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> Natural; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/menu_items.3x.html">item_count()</A></EM></FONT> -- <b>pragma</b> Inline (<A HREF="terminal_interface-curses-menus__ads.htm#ref_633_13">Item_Count</A>); -- -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page <A HREF="../man/menu_new.3x.html">menu_new.3x</A></EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_59"#2|</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_642_13" HREF="terminal_interface-curses-menus__adb.htm#ref_937_13">Create</A></FONT> (<FONT COLOR=red><A NAME="ref_642_21" HREF="terminal_interface-curses-menus__adb.htm#ref_937_21">Items</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_182_9">Item_Array_Access</A>) <b>return</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/menu_new.3x.html">new_menu()</A></EM></FONT> -- <FONT COLOR=green><EM>-- Not inlined</EM></FONT> -- -- <b>function</b> New_Menu (<FONT COLOR=red><A NAME="ref_646_23">Items</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_182_9">Item_Array_Access</A>) <b>return</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A> <b>renames</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_642_13">Create</A>; -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_60"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_649_14" HREF="terminal_interface-curses-menus__adb.htm#ref_956_14">Delete</A></FONT> (<FONT COLOR=red><A NAME="ref_649_22" HREF="terminal_interface-curses-menus__adb.htm#ref_956_22">Men</A></FONT> : <b>in</b> <b>out</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/menu_new.3x.html">free_menu()</A></EM></FONT> -- <FONT COLOR=green><EM>-- Reset Men to Null_Menu</EM></FONT> -- <FONT COLOR=green><EM>-- Not inlined</EM></FONT> -- -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page <A HREF="../man/menu_driver.3x.html">menu_driver.3x</A></EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- -- <b>type</b> <FONT COLOR=red><A NAME="ref_658_9">Driver_Result</A></FONT> <b>is</b> (<FONT COLOR=red><A NAME="ref_658_27">Menu_Ok</A></FONT>, -- <FONT COLOR=red><A NAME="ref_659_27">Request_Denied</A></FONT>, -- <FONT COLOR=red><A NAME="ref_660_27">Unknown_Request</A></FONT>, -- <FONT COLOR=red><A NAME="ref_661_27">No_Match</A></FONT>); -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_61"#2|</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_664_13" HREF="terminal_interface-curses-menus__adb.htm#ref_970_13">Driver</A></FONT> (<FONT COLOR=red><A NAME="ref_664_21" HREF="terminal_interface-curses-menus__adb.htm#ref_970_21">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_665_21" HREF="terminal_interface-curses-menus__adb.htm#ref_971_21">Key</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_68_9">Key_Code</A>) <b>return</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_658_9">Driver_Result</A>; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/menu_driver.3x.html">menu_driver()</A></EM></FONT> -- <FONT COLOR=green><EM>-- Driver is not inlined</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_62"#2|</EM></FONT> -- <FONT COLOR=green><EM>-- Not Implemented: menu_request_name, menu_request_by_name</EM></FONT> --<FONT COLOR=green><EM>-------------------------------------------------------------------------------</EM></FONT> -+ <span class="comment"><EM>-- #1A NAME="AFU_40"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_486_14" HREF="terminal_interface-curses-menus__adb.htm#ref_664_14">Set_Pad_Character</A></span> (<span class="symbol"><A NAME="ref_486_33" HREF="terminal_interface-curses-menus__adb.htm#ref_664_33">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_487_33" HREF="terminal_interface-curses-menus__adb.htm#ref_665_33">Pad</A></span> : Character := Space); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/menu_attributes.3x.html">set_menu_pad()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses-menus__ads.htm#ref_486_14">Set_Pad_Character</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_41"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_492_14" HREF="terminal_interface-curses-menus__adb.htm#ref_679_14">Pad_Character</A></span> (<span class="symbol"><A NAME="ref_492_29" HREF="terminal_interface-curses-menus__adb.htm#ref_679_29">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_493_29" HREF="terminal_interface-curses-menus__adb.htm#ref_680_29">Pad</A></span> : <b>out</b> Character); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/menu_attributes.3x.html">menu_pad()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses-menus__ads.htm#ref_492_14">Pad_Character</A>); -+ -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page <A HREF="../man/menu_spacing.3x.html">menu_spacing.3x</A></EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_42"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_502_14" HREF="terminal_interface-curses-menus__adb.htm#ref_688_14">Set_Spacing</A></span> (<span class="symbol"><A NAME="ref_502_27" HREF="terminal_interface-curses-menus__adb.htm#ref_688_27">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_503_27" HREF="terminal_interface-curses-menus__adb.htm#ref_689_27">Descr</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A> := 0; -+ <span class="symbol"><A NAME="ref_504_27" HREF="terminal_interface-curses-menus__adb.htm#ref_690_27">Row</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A> := 0; -+ <span class="symbol"><A NAME="ref_505_27" HREF="terminal_interface-curses-menus__adb.htm#ref_691_27">Col</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A> := 0); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/menu_spacing.3x.html">set_menu_spacing()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses-menus__ads.htm#ref_502_14">Set_Spacing</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_43"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_510_14" HREF="terminal_interface-curses-menus__adb.htm#ref_707_14">Spacing</A></span> (<span class="symbol"><A NAME="ref_510_23" HREF="terminal_interface-curses-menus__adb.htm#ref_707_23">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_511_23" HREF="terminal_interface-curses-menus__adb.htm#ref_708_23">Descr</A></span> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -+ <span class="symbol"><A NAME="ref_512_23" HREF="terminal_interface-curses-menus__adb.htm#ref_709_23">Row</A></span> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_513_23" HREF="terminal_interface-curses-menus__adb.htm#ref_710_23">Col</A></span> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/menu_spacing.3x.html">menu_spacing()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses-menus__ads.htm#ref_510_14">Spacing</A>); -+ -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page <A HREF="../man/menu_pattern.3x.html">menu_pattern.3x</A></EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_44"#2|</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_522_13" HREF="terminal_interface-curses-menus__adb.htm#ref_732_13">Set_Pattern</A></span> (<span class="symbol"><A NAME="ref_522_26" HREF="terminal_interface-curses-menus__adb.htm#ref_732_26">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_523_26" HREF="terminal_interface-curses-menus__adb.htm#ref_733_26">Text</A></span> : String) <b>return</b> Boolean; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/menu_pattern.3x.html">set_menu_pattern()</A></EM></span> -+ <span class="comment"><EM>-- Return TRUE if the pattern matches, FALSE otherwise</EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses-menus__ads.htm#ref_522_13">Set_Pattern</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_45"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_529_14" HREF="terminal_interface-curses-menus__adb.htm#ref_755_14">Pattern</A></span> (<span class="symbol"><A NAME="ref_529_23" HREF="terminal_interface-curses-menus__adb.htm#ref_755_23">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_530_23" HREF="terminal_interface-curses-menus__adb.htm#ref_756_23">Text</A></span> : <b>out</b> String); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/menu_pattern.3x.html">menu_pattern()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses-menus__ads.htm#ref_529_14">Pattern</A>); -+ -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page <A HREF="../man/menu_format.3x.html">menu_format.3x</A></EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_46"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_539_14" HREF="terminal_interface-curses-menus__adb.htm#ref_764_14">Set_Format</A></span> (<span class="symbol"><A NAME="ref_539_26" HREF="terminal_interface-curses-menus__adb.htm#ref_764_26">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_540_26" HREF="terminal_interface-curses-menus__adb.htm#ref_765_26">Lines</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_63_12">Line_Count</A>; -+ <span class="symbol"><A NAME="ref_541_26" HREF="terminal_interface-curses-menus__adb.htm#ref_766_26">Columns</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_65_12">Column_Count</A>); -+ <span class="comment"><EM>-- Not implemented: 0 argument for Lines or Columns;</EM></span> -+ <span class="comment"><EM>-- instead use Format to get the current sizes</EM></span> -+ <span class="comment"><EM>-- The default format is 16 rows, 1 column. Calling</EM></span> -+ <span class="comment"><EM>-- set_menu_format with a null menu pointer will change this</EM></span> -+ <span class="comment"><EM>-- default. A zero row or column argument to set_menu_format</EM></span> -+ <span class="comment"><EM>-- is interpreted as a request not to change the current</EM></span> -+ <span class="comment"><EM>-- value.</EM></span> -+ <span class="comment"><EM>-- AKA: <A HREF="../man/menu_format.3x.html">set_menu_format()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses-menus__ads.htm#ref_539_14">Set_Format</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_47"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_553_14" HREF="terminal_interface-curses-menus__adb.htm#ref_782_14">Format</A></span> (<span class="symbol"><A NAME="ref_553_22" HREF="terminal_interface-curses-menus__adb.htm#ref_782_22">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_554_22" HREF="terminal_interface-curses-menus__adb.htm#ref_783_22">Lines</A></span> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_63_12">Line_Count</A>; -+ <span class="symbol"><A NAME="ref_555_22" HREF="terminal_interface-curses-menus__adb.htm#ref_784_22">Columns</A></span> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_65_12">Column_Count</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/menu_format.3x.html">menu_format()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses-menus__ads.htm#ref_553_14">Format</A>); -+ -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page <A HREF="../man/menu_hook.3x.html">menu_hook.3x</A></EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ -+ <b>type</b> <span class="symbol"><A NAME="ref_563_9">Menu_Hook_Function</A></span> <b>is</b> <b>access</b> <b>procedure</b> (<span class="symbol"><A NAME="ref_563_49">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>); -+ <b>pragma</b> Convention (C, <A HREF="terminal_interface-curses-menus__ads.htm#ref_563_9">Menu_Hook_Function</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_48"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_567_14" HREF="terminal_interface-curses-menus__adb.htm#ref_802_14">Set_Item_Init_Hook</A></span> (<span class="symbol"><A NAME="ref_567_34" HREF="terminal_interface-curses-menus__adb.htm#ref_802_34">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_568_34" HREF="terminal_interface-curses-menus__adb.htm#ref_803_34">Proc</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_563_9">Menu_Hook_Function</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/menu_hook.3x.html">set_item_init()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses-menus__ads.htm#ref_567_14">Set_Item_Init_Hook</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_49"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_573_14" HREF="terminal_interface-curses-menus__adb.htm#ref_816_14">Set_Item_Term_Hook</A></span> (<span class="symbol"><A NAME="ref_573_34" HREF="terminal_interface-curses-menus__adb.htm#ref_816_34">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_574_34" HREF="terminal_interface-curses-menus__adb.htm#ref_817_34">Proc</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_563_9">Menu_Hook_Function</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/menu_hook.3x.html">set_item_term()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses-menus__ads.htm#ref_573_14">Set_Item_Term_Hook</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_50"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_579_14" HREF="terminal_interface-curses-menus__adb.htm#ref_830_14">Set_Menu_Init_Hook</A></span> (<span class="symbol"><A NAME="ref_579_34" HREF="terminal_interface-curses-menus__adb.htm#ref_830_34">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_580_34" HREF="terminal_interface-curses-menus__adb.htm#ref_831_34">Proc</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_563_9">Menu_Hook_Function</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/menu_hook.3x.html">set_menu_init()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses-menus__ads.htm#ref_579_14">Set_Menu_Init_Hook</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_51"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_585_14" HREF="terminal_interface-curses-menus__adb.htm#ref_844_14">Set_Menu_Term_Hook</A></span> (<span class="symbol"><A NAME="ref_585_34" HREF="terminal_interface-curses-menus__adb.htm#ref_844_34">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_586_34" HREF="terminal_interface-curses-menus__adb.htm#ref_845_34">Proc</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_563_9">Menu_Hook_Function</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/menu_hook.3x.html">set_menu_term()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses-menus__ads.htm#ref_585_14">Set_Menu_Term_Hook</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_52"#2|</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_591_13" HREF="terminal_interface-curses-menus__adb.htm#ref_858_13">Get_Item_Init_Hook</A></span> (<span class="symbol"><A NAME="ref_591_33" HREF="terminal_interface-curses-menus__adb.htm#ref_858_33">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_563_9">Menu_Hook_Function</A>; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/menu_hook.3x.html">item_init()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses-menus__ads.htm#ref_591_13">Get_Item_Init_Hook</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_53"#2|</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_596_13" HREF="terminal_interface-curses-menus__adb.htm#ref_866_13">Get_Item_Term_Hook</A></span> (<span class="symbol"><A NAME="ref_596_33" HREF="terminal_interface-curses-menus__adb.htm#ref_866_33">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_563_9">Menu_Hook_Function</A>; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/menu_hook.3x.html">item_term()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses-menus__ads.htm#ref_596_13">Get_Item_Term_Hook</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_54"#2|</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_601_13" HREF="terminal_interface-curses-menus__adb.htm#ref_874_13">Get_Menu_Init_Hook</A></span> (<span class="symbol"><A NAME="ref_601_33" HREF="terminal_interface-curses-menus__adb.htm#ref_874_33">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_563_9">Menu_Hook_Function</A>; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/menu_hook.3x.html">menu_init()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses-menus__ads.htm#ref_601_13">Get_Menu_Init_Hook</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_55"#2|</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_606_13" HREF="terminal_interface-curses-menus__adb.htm#ref_882_13">Get_Menu_Term_Hook</A></span> (<span class="symbol"><A NAME="ref_606_33" HREF="terminal_interface-curses-menus__adb.htm#ref_882_33">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_563_9">Menu_Hook_Function</A>; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/menu_hook.3x.html">menu_term()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses-menus__ads.htm#ref_606_13">Get_Menu_Term_Hook</A>); -+ -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page <A HREF="../man/menu_items.3x.html">menu_items.3x</A></EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_56"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_615_14" HREF="terminal_interface-curses-menus__adb.htm#ref_890_14">Redefine</A></span> (<span class="symbol"><A NAME="ref_615_24" HREF="terminal_interface-curses-menus__adb.htm#ref_890_24">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_616_24" HREF="terminal_interface-curses-menus__adb.htm#ref_891_24">Items</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_180_9">Item_Array_Access</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/menu_items.3x.html">set_menu_items()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses-menus__ads.htm#ref_615_14">Redefine</A>); -+ -+ <b>procedure</b> <span class="symbol"><A NAME="ref_620_14">Set_Items</A></span> (<span class="symbol"><A NAME="ref_620_25">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_621_25">Items</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_180_9">Item_Array_Access</A>) <b>renames</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_615_14">Redefine</A>; -+ <span class="comment"><EM>-- pragma Inline (Set_Items);</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_57"#2|</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_625_13" HREF="terminal_interface-curses-menus__adb.htm#ref_918_13">Items</A></span> (<span class="symbol"><A NAME="ref_625_20" HREF="terminal_interface-curses-menus__adb.htm#ref_918_20">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_626_20" HREF="terminal_interface-curses-menus__adb.htm#ref_919_20">Index</A></span> : Positive) <b>return</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/menu_items.3x.html">menu_items()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses-menus__ads.htm#ref_625_13">Items</A>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_58"#2|</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_631_13" HREF="terminal_interface-curses-menus__adb.htm#ref_910_13">Item_Count</A></span> (<span class="symbol"><A NAME="ref_631_25" HREF="terminal_interface-curses-menus__adb.htm#ref_910_25">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> Natural; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/menu_items.3x.html">item_count()</A></EM></span> -+ <b>pragma</b> Inline (<A HREF="terminal_interface-curses-menus__ads.htm#ref_631_13">Item_Count</A>); -+ -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page <A HREF="../man/menu_new.3x.html">menu_new.3x</A></EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_59"#2|</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_640_13" HREF="terminal_interface-curses-menus__adb.htm#ref_937_13">Create</A></span> (<span class="symbol"><A NAME="ref_640_21" HREF="terminal_interface-curses-menus__adb.htm#ref_937_21">Items</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_180_9">Item_Array_Access</A>) <b>return</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/menu_new.3x.html">new_menu()</A></EM></span> -+ <span class="comment"><EM>-- Not inlined</EM></span> -+ -+ <b>function</b> New_Menu (<span class="symbol"><A NAME="ref_644_23">Items</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_180_9">Item_Array_Access</A>) <b>return</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A> <b>renames</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_640_13">Create</A>; -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_60"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_647_14" HREF="terminal_interface-curses-menus__adb.htm#ref_956_14">Delete</A></span> (<span class="symbol"><A NAME="ref_647_22" HREF="terminal_interface-curses-menus__adb.htm#ref_956_22">Men</A></span> : <b>in</b> <b>out</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/menu_new.3x.html">free_menu()</A></EM></span> -+ <span class="comment"><EM>-- Reset Men to Null_Menu</EM></span> -+ <span class="comment"><EM>-- Not inlined</EM></span> -+ -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page <A HREF="../man/menu_driver.3x.html">menu_driver.3x</A></EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ -+ <b>type</b> <span class="symbol"><A NAME="ref_656_9">Driver_Result</A></span> <b>is</b> (<span class="symbol"><A NAME="ref_656_27">Menu_Ok</A></span>, -+ <span class="symbol"><A NAME="ref_657_27">Request_Denied</A></span>, -+ <span class="symbol"><A NAME="ref_658_27">Unknown_Request</A></span>, -+ <span class="symbol"><A NAME="ref_659_27">No_Match</A></span>); -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_61"#2|</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_662_13" HREF="terminal_interface-curses-menus__adb.htm#ref_970_13">Driver</A></span> (<span class="symbol"><A NAME="ref_662_21" HREF="terminal_interface-curses-menus__adb.htm#ref_970_21">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_663_21" HREF="terminal_interface-curses-menus__adb.htm#ref_971_21">Key</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_68_9">Key_Code</A>) <b>return</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_656_9">Driver_Result</A>; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/menu_driver.3x.html">menu_driver()</A></EM></span> -+ <span class="comment"><EM>-- Driver is not inlined</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_62"#2|</EM></span> -+ <span class="comment"><EM>-- Not Implemented: menu_request_name, menu_request_by_name</EM></span> -+<span class="comment"><EM>-------------------------------------------------------------------------------</EM></span> - <b>private</b> - <b>type</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A> <b>is</b> <b>new</b> System.Storage_Elements.Integer_Address; - <b>type</b> <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A> <b>is</b> <b>new</b> System.Storage_Elements.Integer_Address; -diff -Naur ncurses-5.9/doc/html/ada/terminal_interface-curses-menus-item_user_data__adb.htm ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-menus-item_user_data__adb.htm ---- ncurses-5.9/doc/html/ada/terminal_interface-curses-menus-item_user_data__adb.htm 2011-02-26 00:43:49.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-menus-item_user_data__adb.htm 2014-09-01 16:33:22.288792010 +0200 -@@ -1,79 +1,91 @@ --<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> --<HTML><HEAD><TITLE>terminal_interface-curses-menus-item_user_data.adb</TITLE></HEAD> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> -+<HTML> -+<HEAD> -+<TITLE>terminal_interface-curses-menus-item_user_data.adb</TITLE> -+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> -+<style type="text/css"> -+*.comment { -+ color: green; -+} -+*.symbol { -+ color: red; -+} -+</style> -+</HEAD> - <BODY> --<HR><DIV ALIGN="center"><H1> File : terminal_interface-curses-menus-item_user_data.adb </H1></DIV><HR> -+<HR><DIV style="text-align:center"><H1> File : terminal_interface-curses-menus-item_user_data.adb </H1></DIV><HR> - <PRE> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Terminal_Interface.Curses.Menus.Item_User_Data --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- B O D Y --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Copyright (c) 1998-2003,2009 Free Software Foundation, Inc. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></FONT> --<FONT COLOR=green><EM>-- copy of this software and associated documentation files (the --</EM></FONT> --<FONT COLOR=green><EM>-- "Software"), to deal in the Software without restriction, including --</EM></FONT> --<FONT COLOR=green><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></FONT> --<FONT COLOR=green><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></FONT> --<FONT COLOR=green><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></FONT> --<FONT COLOR=green><EM>-- furnished to do so, subject to the following conditions: --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- The above copyright notice and this permission notice shall be included --</EM></FONT> --<FONT COLOR=green><EM>-- in all copies or substantial portions of the Software. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></FONT> --<FONT COLOR=green><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></FONT> --<FONT COLOR=green><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></FONT> --<FONT COLOR=green><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></FONT> --<FONT COLOR=green><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></FONT> --<FONT COLOR=green><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></FONT> --<FONT COLOR=green><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></FONT> --<FONT COLOR=green><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></FONT> --<FONT COLOR=green><EM>-- sale, use or other dealings in this Software without prior written --</EM></FONT> --<FONT COLOR=green><EM>-- authorization. --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Author: Juergen Pfeifer, 1996</EM></FONT> --<FONT COLOR=green><EM>-- Version Control:</EM></FONT> --<FONT COLOR=green><EM>-- @Revision: 1.12 @</EM></FONT> --<FONT COLOR=green><EM>-- Binding Version 01.00</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<b>with</b> <A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>.C; -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Terminal_Interface.Curses.Menus.Item_User_Data --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- B O D Y --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Copyright (c) 1998-2003,2009 Free Software Foundation, Inc. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></span> -+<span class="comment"><EM>-- copy of this software and associated documentation files (the --</EM></span> -+<span class="comment"><EM>-- "Software"), to deal in the Software without restriction, including --</EM></span> -+<span class="comment"><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></span> -+<span class="comment"><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></span> -+<span class="comment"><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></span> -+<span class="comment"><EM>-- furnished to do so, subject to the following conditions: --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- The above copyright notice and this permission notice shall be included --</EM></span> -+<span class="comment"><EM>-- in all copies or substantial portions of the Software. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></span> -+<span class="comment"><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></span> -+<span class="comment"><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></span> -+<span class="comment"><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></span> -+<span class="comment"><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></span> -+<span class="comment"><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></span> -+<span class="comment"><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></span> -+<span class="comment"><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></span> -+<span class="comment"><EM>-- sale, use or other dealings in this Software without prior written --</EM></span> -+<span class="comment"><EM>-- authorization. --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Author: Juergen Pfeifer, 1996</EM></span> -+<span class="comment"><EM>-- Version Control:</EM></span> -+<span class="comment"><EM>-- @Revision: 1.12 @</EM></span> -+<span class="comment"><EM>-- Binding Version 01.00</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<b>with</b> <A HREF="interfac__ads.htm#ref_36_9">Interfaces</A>.C; - <b>with</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-aux__ads.htm#ref_50_35">Aux</A>; <b>use</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-aux__ads.htm#ref_50_35">Aux</A>; - --<b>package</b> <b>body</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-menus__ads.htm#ref_49_35">Menus</A>.<FONT COLOR=red><A NAME="ref_44_46" HREF="terminal_interface-curses-menus-item_user_data__ads.htm#ref_46_41">Item_User_Data</A></FONT> <b>is</b> -+<b>package</b> <b>body</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-menus__ads.htm#ref_49_35">Menus</A>.<span class="symbol"><A NAME="ref_44_46" HREF="terminal_interface-curses-menus-item_user_data__ads.htm#ref_46_41">Item_User_Data</A></span> <b>is</b> - -- <b>use</b> <b>type</b> <A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>.C.int; -+ <b>use</b> <b>type</b> <A HREF="interfac__ads.htm#ref_36_9">Interfaces</A>.C.int; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_48_14" HREF="terminal_interface-curses-menus-item_user_data__ads.htm#ref_58_14">Set_User_Data</A></FONT> (<FONT COLOR=red><A NAME="ref_48_29" HREF="terminal_interface-curses-menus-item_user_data__ads.htm#ref_58_29">Itm</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>; -- <FONT COLOR=red><A NAME="ref_49_29" HREF="terminal_interface-curses-menus-item_user_data__ads.htm#ref_59_29">Data</A></FONT> : <A HREF="terminal_interface-curses-menus-item_user_data__ads.htm#ref_45_9">User_Access</A>) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_48_14" HREF="terminal_interface-curses-menus-item_user_data__ads.htm#ref_58_14">Set_User_Data</A></span> (<span class="symbol"><A NAME="ref_48_29" HREF="terminal_interface-curses-menus-item_user_data__ads.htm#ref_58_29">Itm</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>; -+ <span class="symbol"><A NAME="ref_49_29" HREF="terminal_interface-curses-menus-item_user_data__ads.htm#ref_59_29">Data</A></span> : <A HREF="terminal_interface-curses-menus-item_user_data__ads.htm#ref_45_9">User_Access</A>) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_51_16">Set_Item_Userptr</A></FONT> (<FONT COLOR=red><A NAME="ref_51_34" HREF="terminal_interface-curses-menus-item_user_data__adb.htm#ref_51_16">Itm</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>; -- <FONT COLOR=red><A NAME="ref_52_34" HREF="terminal_interface-curses-menus-item_user_data__adb.htm#ref_51_16">Addr</A></FONT> : <A HREF="terminal_interface-curses-menus-item_user_data__ads.htm#ref_45_9">User_Access</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_51_16">Set_Item_Userptr</A></span> (<span class="symbol"><A NAME="ref_51_34" HREF="terminal_interface-curses-menus-item_user_data__adb.htm#ref_51_16">Itm</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>; -+ <span class="symbol"><A NAME="ref_52_34" HREF="terminal_interface-curses-menus-item_user_data__adb.htm#ref_51_16">Addr</A></span> : <A HREF="terminal_interface-curses-menus-item_user_data__ads.htm#ref_45_9">User_Access</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Set_Item_Userptr, "set_item_userptr"); - -- <FONT COLOR=red><A NAME="ref_55_7">Res</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := <A HREF="terminal_interface-curses-menus-item_user_data__adb.htm#ref_51_16">Set_Item_Userptr</A> (<A HREF="terminal_interface-curses-menus-item_user_data__ads.htm#ref_58_29">Itm</A>, <A HREF="terminal_interface-curses-menus-item_user_data__ads.htm#ref_59_29">Data</A>); -+ <span class="symbol"><A NAME="ref_55_7">Res</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := <A HREF="terminal_interface-curses-menus-item_user_data__adb.htm#ref_51_16">Set_Item_Userptr</A> (<A HREF="terminal_interface-curses-menus-item_user_data__ads.htm#ref_58_29">Itm</A>, <A HREF="terminal_interface-curses-menus-item_user_data__ads.htm#ref_59_29">Data</A>); - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses-menus-item_user_data__adb.htm#ref_55_7">Res</A> /= <A HREF="terminal_interface-curses-aux__ads.htm#ref_80_4">E_Ok</A> <b>then</b> - <A HREF="terminal_interface-curses-aux__ads.htm#ref_96_14">Eti_Exception</A> (<A HREF="terminal_interface-curses-menus-item_user_data__adb.htm#ref_55_7">Res</A>); - <b>end</b> <b>if</b>; - <b>end</b> <A HREF="terminal_interface-curses-menus-item_user_data__ads.htm#ref_58_14">Set_User_Data</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_62_13" HREF="terminal_interface-curses-menus-item_user_data__ads.htm#ref_69_13">Get_User_Data</A></FONT> (<FONT COLOR=red><A NAME="ref_62_28" HREF="terminal_interface-curses-menus-item_user_data__ads.htm#ref_69_28">Itm</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>) <b>return</b> <A HREF="terminal_interface-curses-menus-item_user_data__ads.htm#ref_45_9">User_Access</A> -+ <b>function</b> <span class="symbol"><A NAME="ref_62_13" HREF="terminal_interface-curses-menus-item_user_data__ads.htm#ref_69_13">Get_User_Data</A></span> (<span class="symbol"><A NAME="ref_62_28" HREF="terminal_interface-curses-menus-item_user_data__ads.htm#ref_69_28">Itm</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>) <b>return</b> <A HREF="terminal_interface-curses-menus-item_user_data__ads.htm#ref_45_9">User_Access</A> - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_64_16">Item_Userptr</A></FONT> (<FONT COLOR=red><A NAME="ref_64_30" HREF="terminal_interface-curses-menus-item_user_data__adb.htm#ref_64_16">Itm</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>) <b>return</b> <A HREF="terminal_interface-curses-menus-item_user_data__ads.htm#ref_45_9">User_Access</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_64_16">Item_Userptr</A></span> (<span class="symbol"><A NAME="ref_64_30" HREF="terminal_interface-curses-menus-item_user_data__adb.htm#ref_64_16">Itm</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>) <b>return</b> <A HREF="terminal_interface-curses-menus-item_user_data__ads.htm#ref_45_9">User_Access</A>; - <b>pragma</b> Import (C, Item_Userptr, "item_userptr"); - <b>begin</b> - <b>return</b> <A HREF="terminal_interface-curses-menus-item_user_data__adb.htm#ref_64_16">Item_Userptr</A> (<A HREF="terminal_interface-curses-menus-item_user_data__ads.htm#ref_69_28">Itm</A>); - <b>end</b> <A HREF="terminal_interface-curses-menus-item_user_data__ads.htm#ref_69_13">Get_User_Data</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_70_14" HREF="terminal_interface-curses-menus-item_user_data__ads.htm#ref_64_14">Get_User_Data</A></FONT> (<FONT COLOR=red><A NAME="ref_70_29" HREF="terminal_interface-curses-menus-item_user_data__ads.htm#ref_64_29">Itm</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>; -- <FONT COLOR=red><A NAME="ref_71_29" HREF="terminal_interface-curses-menus-item_user_data__ads.htm#ref_65_29">Data</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses-menus-item_user_data__ads.htm#ref_45_9">User_Access</A>) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_70_14" HREF="terminal_interface-curses-menus-item_user_data__ads.htm#ref_64_14">Get_User_Data</A></span> (<span class="symbol"><A NAME="ref_70_29" HREF="terminal_interface-curses-menus-item_user_data__ads.htm#ref_64_29">Itm</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>; -+ <span class="symbol"><A NAME="ref_71_29" HREF="terminal_interface-curses-menus-item_user_data__ads.htm#ref_65_29">Data</A></span> : <b>out</b> <A HREF="terminal_interface-curses-menus-item_user_data__ads.htm#ref_45_9">User_Access</A>) - <b>is</b> - <b>begin</b> - <A HREF="terminal_interface-curses-menus-item_user_data__ads.htm#ref_65_29">Data</A> := <A HREF="terminal_interface-curses-menus-item_user_data__ads.htm#ref_69_13">Get_User_Data</A> (<A HREF="terminal_interface-curses-menus-item_user_data__ads.htm#ref_64_29">Itm</A>); -diff -Naur ncurses-5.9/doc/html/ada/terminal_interface-curses-menus-item_user_data__ads.htm ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-menus-item_user_data__ads.htm ---- ncurses-5.9/doc/html/ada/terminal_interface-curses-menus-item_user_data__ads.htm 2010-01-09 21:31:26.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-menus-item_user_data__ads.htm 2014-09-01 16:33:22.288792010 +0200 -@@ -1,79 +1,91 @@ --<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> --<HTML><HEAD><TITLE>terminal_interface-curses-menus-item_user_data.ads</TITLE></HEAD> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> -+<HTML> -+<HEAD> -+<TITLE>terminal_interface-curses-menus-item_user_data.ads</TITLE> -+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> -+<style type="text/css"> -+*.comment { -+ color: green; -+} -+*.symbol { -+ color: red; -+} -+</style> -+</HEAD> - <BODY> --<HR><DIV ALIGN="center"><H1> File : terminal_interface-curses-menus-item_user_data.ads </H1></DIV><HR> -+<HR><DIV style="text-align:center"><H1> File : terminal_interface-curses-menus-item_user_data.ads </H1></DIV><HR> - <PRE> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Terminal_Interface.Curses.Menus.Item_User_Data --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- S P E C --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Copyright (c) 1998-2006,2009 Free Software Foundation, Inc. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></FONT> --<FONT COLOR=green><EM>-- copy of this software and associated documentation files (the --</EM></FONT> --<FONT COLOR=green><EM>-- "Software"), to deal in the Software without restriction, including --</EM></FONT> --<FONT COLOR=green><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></FONT> --<FONT COLOR=green><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></FONT> --<FONT COLOR=green><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></FONT> --<FONT COLOR=green><EM>-- furnished to do so, subject to the following conditions: --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- The above copyright notice and this permission notice shall be included --</EM></FONT> --<FONT COLOR=green><EM>-- in all copies or substantial portions of the Software. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></FONT> --<FONT COLOR=green><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></FONT> --<FONT COLOR=green><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></FONT> --<FONT COLOR=green><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></FONT> --<FONT COLOR=green><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></FONT> --<FONT COLOR=green><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></FONT> --<FONT COLOR=green><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></FONT> --<FONT COLOR=green><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></FONT> --<FONT COLOR=green><EM>-- sale, use or other dealings in this Software without prior written --</EM></FONT> --<FONT COLOR=green><EM>-- authorization. --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Author: Juergen Pfeifer, 1996</EM></FONT> --<FONT COLOR=green><EM>-- Version Control:</EM></FONT> --<FONT COLOR=green><EM>-- @Revision: 1.17 @</EM></FONT> --<FONT COLOR=green><EM>-- @Date: 2009/12/26 17:31:35 @</EM></FONT> --<FONT COLOR=green><EM>-- Binding Version 01.00</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Terminal_Interface.Curses.Menus.Item_User_Data --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- S P E C --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Copyright (c) 1998-2006,2009 Free Software Foundation, Inc. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></span> -+<span class="comment"><EM>-- copy of this software and associated documentation files (the --</EM></span> -+<span class="comment"><EM>-- "Software"), to deal in the Software without restriction, including --</EM></span> -+<span class="comment"><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></span> -+<span class="comment"><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></span> -+<span class="comment"><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></span> -+<span class="comment"><EM>-- furnished to do so, subject to the following conditions: --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- The above copyright notice and this permission notice shall be included --</EM></span> -+<span class="comment"><EM>-- in all copies or substantial portions of the Software. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></span> -+<span class="comment"><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></span> -+<span class="comment"><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></span> -+<span class="comment"><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></span> -+<span class="comment"><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></span> -+<span class="comment"><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></span> -+<span class="comment"><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></span> -+<span class="comment"><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></span> -+<span class="comment"><EM>-- sale, use or other dealings in this Software without prior written --</EM></span> -+<span class="comment"><EM>-- authorization. --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Author: Juergen Pfeifer, 1996</EM></span> -+<span class="comment"><EM>-- Version Control:</EM></span> -+<span class="comment"><EM>-- @Revision: 1.17 @</EM></span> -+<span class="comment"><EM>-- @Date: 2009/12/26 17:31:35 @</EM></span> -+<span class="comment"><EM>-- Binding Version 01.00</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> - - <b>generic</b> -- <b>type</b> <FONT COLOR=red><A NAME="ref_44_9" HREF="terminal_interface-curses-menus-item_user_data__ads.htm#ref_46_41">User</A></FONT> <b>is</b> <b>limited</b> <b>private</b>; -- <b>type</b> <FONT COLOR=red><A NAME="ref_45_9" HREF="terminal_interface-curses-menus-item_user_data__ads.htm#ref_46_41">User_Access</A></FONT> <b>is</b> <b>access</b> <A HREF="terminal_interface-curses-menus-item_user_data__ads.htm#ref_44_9">User</A>; --<b>package</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-menus__ads.htm#ref_49_35">Menus</A>.<FONT COLOR=red><A NAME="ref_46_41" HREF="terminal_interface-curses-menus-item_user_data__adb.htm#ref_44_46">Item_User_Data</A></FONT> <b>is</b> -+ <b>type</b> <span class="symbol"><A NAME="ref_44_9" HREF="terminal_interface-curses-menus-item_user_data__ads.htm#ref_46_41">User</A></span> <b>is</b> <b>limited</b> <b>private</b>; -+ <b>type</b> <span class="symbol"><A NAME="ref_45_9" HREF="terminal_interface-curses-menus-item_user_data__ads.htm#ref_46_41">User_Access</A></span> <b>is</b> <b>access</b> <A HREF="terminal_interface-curses-menus-item_user_data__ads.htm#ref_44_9">User</A>; -+<b>package</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-menus__ads.htm#ref_49_35">Menus</A>.<span class="symbol"><A NAME="ref_46_41" HREF="terminal_interface-curses-menus-item_user_data__adb.htm#ref_44_46">Item_User_Data</A></span> <b>is</b> - <b>pragma</b> Preelaborate (<A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-menus__ads.htm#ref_49_35">Menus</A>.<A HREF="terminal_interface-curses-menus-item_user_data__ads.htm#ref_46_41">Item_User_Data</A>); - -- <FONT COLOR=green><EM>-- The binding uses the same user pointer for menu items</EM></FONT> -- <FONT COLOR=green><EM>-- as the low level C implementation. So you can safely</EM></FONT> -- <FONT COLOR=green><EM>-- read or write the user pointer also with the C routines</EM></FONT> -- <FONT COLOR=green><EM>--</EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page <A HREF="../man/mitem_userptr.3x.html">mitem_userptr.3x</A></EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_1"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_58_14" HREF="terminal_interface-curses-menus-item_user_data__adb.htm#ref_48_14">Set_User_Data</A></FONT> (<FONT COLOR=red><A NAME="ref_58_29" HREF="terminal_interface-curses-menus-item_user_data__adb.htm#ref_48_29">Itm</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>; -- <FONT COLOR=red><A NAME="ref_59_29" HREF="terminal_interface-curses-menus-item_user_data__adb.htm#ref_49_29">Data</A></FONT> : <A HREF="terminal_interface-curses-menus-item_user_data__ads.htm#ref_45_9">User_Access</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/mitem_userptr.3x.html">set_item_userptr</A></EM></FONT> -+ <span class="comment"><EM>-- The binding uses the same user pointer for menu items</EM></span> -+ <span class="comment"><EM>-- as the low level C implementation. So you can safely</EM></span> -+ <span class="comment"><EM>-- read or write the user pointer also with the C routines</EM></span> -+ <span class="comment"><EM>--</EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page <A HREF="../man/mitem_userptr.3x.html">mitem_userptr.3x</A></EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_1"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_58_14" HREF="terminal_interface-curses-menus-item_user_data__adb.htm#ref_48_14">Set_User_Data</A></span> (<span class="symbol"><A NAME="ref_58_29" HREF="terminal_interface-curses-menus-item_user_data__adb.htm#ref_48_29">Itm</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>; -+ <span class="symbol"><A NAME="ref_59_29" HREF="terminal_interface-curses-menus-item_user_data__adb.htm#ref_49_29">Data</A></span> : <A HREF="terminal_interface-curses-menus-item_user_data__ads.htm#ref_45_9">User_Access</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/mitem_userptr.3x.html">set_item_userptr</A></EM></span> - <b>pragma</b> Inline (<A HREF="terminal_interface-curses-menus-item_user_data__ads.htm#ref_58_14">Set_User_Data</A>); - -- <FONT COLOR=green><EM>-- #1A NAME="AFU_2"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_64_14" HREF="terminal_interface-curses-menus-item_user_data__adb.htm#ref_70_14">Get_User_Data</A></FONT> (<FONT COLOR=red><A NAME="ref_64_29" HREF="terminal_interface-curses-menus-item_user_data__adb.htm#ref_70_29">Itm</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>; -- <FONT COLOR=red><A NAME="ref_65_29" HREF="terminal_interface-curses-menus-item_user_data__adb.htm#ref_71_29">Data</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses-menus-item_user_data__ads.htm#ref_45_9">User_Access</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/mitem_userptr.3x.html">item_userptr</A></EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_3"#2|</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_69_13" HREF="terminal_interface-curses-menus-item_user_data__adb.htm#ref_62_13">Get_User_Data</A></FONT> (<FONT COLOR=red><A NAME="ref_69_28" HREF="terminal_interface-curses-menus-item_user_data__adb.htm#ref_62_28">Itm</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>) <b>return</b> <A HREF="terminal_interface-curses-menus-item_user_data__ads.htm#ref_45_9">User_Access</A>; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/mitem_userptr.3x.html">item_userptr</A></EM></FONT> -- <FONT COLOR=green><EM>-- Same as function</EM></FONT> -+ <span class="comment"><EM>-- #1A NAME="AFU_2"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_64_14" HREF="terminal_interface-curses-menus-item_user_data__adb.htm#ref_70_14">Get_User_Data</A></span> (<span class="symbol"><A NAME="ref_64_29" HREF="terminal_interface-curses-menus-item_user_data__adb.htm#ref_70_29">Itm</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>; -+ <span class="symbol"><A NAME="ref_65_29" HREF="terminal_interface-curses-menus-item_user_data__adb.htm#ref_71_29">Data</A></span> : <b>out</b> <A HREF="terminal_interface-curses-menus-item_user_data__ads.htm#ref_45_9">User_Access</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/mitem_userptr.3x.html">item_userptr</A></EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_3"#2|</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_69_13" HREF="terminal_interface-curses-menus-item_user_data__adb.htm#ref_62_13">Get_User_Data</A></span> (<span class="symbol"><A NAME="ref_69_28" HREF="terminal_interface-curses-menus-item_user_data__adb.htm#ref_62_28">Itm</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_56_9">Item</A>) <b>return</b> <A HREF="terminal_interface-curses-menus-item_user_data__ads.htm#ref_45_9">User_Access</A>; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/mitem_userptr.3x.html">item_userptr</A></EM></span> -+ <span class="comment"><EM>-- Same as function</EM></span> - <b>pragma</b> Inline (Get_User_Data); - - <b>end</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-menus__ads.htm#ref_49_35">Menus</A>.<A HREF="terminal_interface-curses-menus-item_user_data__ads.htm#ref_46_41">Item_User_Data</A>; -diff -Naur ncurses-5.9/doc/html/ada/terminal_interface-curses-menus-menu_user_data__adb.htm ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-menus-menu_user_data__adb.htm ---- ncurses-5.9/doc/html/ada/terminal_interface-curses-menus-menu_user_data__adb.htm 2011-02-26 00:43:49.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-menus-menu_user_data__adb.htm 2014-09-01 16:33:22.289792011 +0200 -@@ -1,78 +1,90 @@ --<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> --<HTML><HEAD><TITLE>terminal_interface-curses-menus-menu_user_data.adb</TITLE></HEAD> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> -+<HTML> -+<HEAD> -+<TITLE>terminal_interface-curses-menus-menu_user_data.adb</TITLE> -+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> -+<style type="text/css"> -+*.comment { -+ color: green; -+} -+*.symbol { -+ color: red; -+} -+</style> -+</HEAD> - <BODY> --<HR><DIV ALIGN="center"><H1> File : terminal_interface-curses-menus-menu_user_data.adb </H1></DIV><HR> -+<HR><DIV style="text-align:center"><H1> File : terminal_interface-curses-menus-menu_user_data.adb </H1></DIV><HR> - <PRE> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Terminal_Interface.Curses.Menus.Menu_User_Data --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- B O D Y --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Copyright (c) 1998-2003,2009 Free Software Foundation, Inc. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></FONT> --<FONT COLOR=green><EM>-- copy of this software and associated documentation files (the --</EM></FONT> --<FONT COLOR=green><EM>-- "Software"), to deal in the Software without restriction, including --</EM></FONT> --<FONT COLOR=green><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></FONT> --<FONT COLOR=green><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></FONT> --<FONT COLOR=green><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></FONT> --<FONT COLOR=green><EM>-- furnished to do so, subject to the following conditions: --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- The above copyright notice and this permission notice shall be included --</EM></FONT> --<FONT COLOR=green><EM>-- in all copies or substantial portions of the Software. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></FONT> --<FONT COLOR=green><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></FONT> --<FONT COLOR=green><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></FONT> --<FONT COLOR=green><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></FONT> --<FONT COLOR=green><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></FONT> --<FONT COLOR=green><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></FONT> --<FONT COLOR=green><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></FONT> --<FONT COLOR=green><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></FONT> --<FONT COLOR=green><EM>-- sale, use or other dealings in this Software without prior written --</EM></FONT> --<FONT COLOR=green><EM>-- authorization. --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Author: Juergen Pfeifer, 1996</EM></FONT> --<FONT COLOR=green><EM>-- Version Control:</EM></FONT> --<FONT COLOR=green><EM>-- @Revision: 1.13 @</EM></FONT> --<FONT COLOR=green><EM>-- Binding Version 01.00</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Terminal_Interface.Curses.Menus.Menu_User_Data --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- B O D Y --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Copyright (c) 1998-2003,2009 Free Software Foundation, Inc. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></span> -+<span class="comment"><EM>-- copy of this software and associated documentation files (the --</EM></span> -+<span class="comment"><EM>-- "Software"), to deal in the Software without restriction, including --</EM></span> -+<span class="comment"><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></span> -+<span class="comment"><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></span> -+<span class="comment"><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></span> -+<span class="comment"><EM>-- furnished to do so, subject to the following conditions: --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- The above copyright notice and this permission notice shall be included --</EM></span> -+<span class="comment"><EM>-- in all copies or substantial portions of the Software. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></span> -+<span class="comment"><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></span> -+<span class="comment"><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></span> -+<span class="comment"><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></span> -+<span class="comment"><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></span> -+<span class="comment"><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></span> -+<span class="comment"><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></span> -+<span class="comment"><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></span> -+<span class="comment"><EM>-- sale, use or other dealings in this Software without prior written --</EM></span> -+<span class="comment"><EM>-- authorization. --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Author: Juergen Pfeifer, 1996</EM></span> -+<span class="comment"><EM>-- Version Control:</EM></span> -+<span class="comment"><EM>-- @Revision: 1.13 @</EM></span> -+<span class="comment"><EM>-- Binding Version 01.00</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> - <b>with</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-aux__ads.htm#ref_50_35">Aux</A>; <b>use</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-aux__ads.htm#ref_50_35">Aux</A>; - --<b>package</b> <b>body</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-menus__ads.htm#ref_49_35">Menus</A>.<FONT COLOR=red><A NAME="ref_43_46" HREF="terminal_interface-curses-menus-menu_user_data__ads.htm#ref_45_41">Menu_User_Data</A></FONT> <b>is</b> -+<b>package</b> <b>body</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-menus__ads.htm#ref_49_35">Menus</A>.<span class="symbol"><A NAME="ref_43_46" HREF="terminal_interface-curses-menus-menu_user_data__ads.htm#ref_45_41">Menu_User_Data</A></span> <b>is</b> - -- <b>use</b> <b>type</b> <A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>.C.int; -+ <b>use</b> <b>type</b> <A HREF="interfac__ads.htm#ref_36_9">Interfaces</A>.C.int; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_47_14" HREF="terminal_interface-curses-menus-menu_user_data__ads.htm#ref_53_14">Set_User_Data</A></FONT> (<FONT COLOR=red><A NAME="ref_47_29" HREF="terminal_interface-curses-menus-menu_user_data__ads.htm#ref_53_29">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_48_29" HREF="terminal_interface-curses-menus-menu_user_data__ads.htm#ref_54_29">Data</A></FONT> : <A HREF="terminal_interface-curses-menus-menu_user_data__ads.htm#ref_44_9">User_Access</A>) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_47_14" HREF="terminal_interface-curses-menus-menu_user_data__ads.htm#ref_53_14">Set_User_Data</A></span> (<span class="symbol"><A NAME="ref_47_29" HREF="terminal_interface-curses-menus-menu_user_data__ads.htm#ref_53_29">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_48_29" HREF="terminal_interface-curses-menus-menu_user_data__ads.htm#ref_54_29">Data</A></span> : <A HREF="terminal_interface-curses-menus-menu_user_data__ads.htm#ref_44_9">User_Access</A>) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_50_16">Set_Menu_Userptr</A></FONT> (<FONT COLOR=red><A NAME="ref_50_34" HREF="terminal_interface-curses-menus-menu_user_data__adb.htm#ref_50_16">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_51_34" HREF="terminal_interface-curses-menus-menu_user_data__adb.htm#ref_50_16">Data</A></FONT> : <A HREF="terminal_interface-curses-menus-menu_user_data__ads.htm#ref_44_9">User_Access</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_50_16">Set_Menu_Userptr</A></span> (<span class="symbol"><A NAME="ref_50_34" HREF="terminal_interface-curses-menus-menu_user_data__adb.htm#ref_50_16">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_51_34" HREF="terminal_interface-curses-menus-menu_user_data__adb.htm#ref_50_16">Data</A></span> : <A HREF="terminal_interface-curses-menus-menu_user_data__ads.htm#ref_44_9">User_Access</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Set_Menu_Userptr, "set_menu_userptr"); - -- <FONT COLOR=red><A NAME="ref_54_7">Res</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := <A HREF="terminal_interface-curses-menus-menu_user_data__adb.htm#ref_50_16">Set_Menu_Userptr</A> (<A HREF="terminal_interface-curses-menus-menu_user_data__ads.htm#ref_53_29">Men</A>, <A HREF="terminal_interface-curses-menus-menu_user_data__ads.htm#ref_54_29">Data</A>); -+ <span class="symbol"><A NAME="ref_54_7">Res</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_78_12">Eti_Error</A> := <A HREF="terminal_interface-curses-menus-menu_user_data__adb.htm#ref_50_16">Set_Menu_Userptr</A> (<A HREF="terminal_interface-curses-menus-menu_user_data__ads.htm#ref_53_29">Men</A>, <A HREF="terminal_interface-curses-menus-menu_user_data__ads.htm#ref_54_29">Data</A>); - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses-menus-menu_user_data__adb.htm#ref_54_7">Res</A> /= <A HREF="terminal_interface-curses-aux__ads.htm#ref_80_4">E_Ok</A> <b>then</b> - <A HREF="terminal_interface-curses-aux__ads.htm#ref_96_14">Eti_Exception</A> (<A HREF="terminal_interface-curses-menus-menu_user_data__adb.htm#ref_54_7">Res</A>); - <b>end</b> <b>if</b>; - <b>end</b> <A HREF="terminal_interface-curses-menus-menu_user_data__ads.htm#ref_53_14">Set_User_Data</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_61_13" HREF="terminal_interface-curses-menus-menu_user_data__ads.htm#ref_64_13">Get_User_Data</A></FONT> (<FONT COLOR=red><A NAME="ref_61_28" HREF="terminal_interface-curses-menus-menu_user_data__ads.htm#ref_64_28">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> <A HREF="terminal_interface-curses-menus-menu_user_data__ads.htm#ref_44_9">User_Access</A> -+ <b>function</b> <span class="symbol"><A NAME="ref_61_13" HREF="terminal_interface-curses-menus-menu_user_data__ads.htm#ref_64_13">Get_User_Data</A></span> (<span class="symbol"><A NAME="ref_61_28" HREF="terminal_interface-curses-menus-menu_user_data__ads.htm#ref_64_28">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> <A HREF="terminal_interface-curses-menus-menu_user_data__ads.htm#ref_44_9">User_Access</A> - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_63_16">Menu_Userptr</A></FONT> (<FONT COLOR=red><A NAME="ref_63_30" HREF="terminal_interface-curses-menus-menu_user_data__adb.htm#ref_63_16">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> <A HREF="terminal_interface-curses-menus-menu_user_data__ads.htm#ref_44_9">User_Access</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_63_16">Menu_Userptr</A></span> (<span class="symbol"><A NAME="ref_63_30" HREF="terminal_interface-curses-menus-menu_user_data__adb.htm#ref_63_16">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> <A HREF="terminal_interface-curses-menus-menu_user_data__ads.htm#ref_44_9">User_Access</A>; - <b>pragma</b> Import (C, Menu_Userptr, "menu_userptr"); - <b>begin</b> - <b>return</b> <A HREF="terminal_interface-curses-menus-menu_user_data__adb.htm#ref_63_16">Menu_Userptr</A> (<A HREF="terminal_interface-curses-menus-menu_user_data__ads.htm#ref_64_28">Men</A>); - <b>end</b> <A HREF="terminal_interface-curses-menus-menu_user_data__ads.htm#ref_64_13">Get_User_Data</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_69_14" HREF="terminal_interface-curses-menus-menu_user_data__ads.htm#ref_59_14">Get_User_Data</A></FONT> (<FONT COLOR=red><A NAME="ref_69_29" HREF="terminal_interface-curses-menus-menu_user_data__ads.htm#ref_59_29">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_70_29" HREF="terminal_interface-curses-menus-menu_user_data__ads.htm#ref_60_29">Data</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses-menus-menu_user_data__ads.htm#ref_44_9">User_Access</A>) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_69_14" HREF="terminal_interface-curses-menus-menu_user_data__ads.htm#ref_59_14">Get_User_Data</A></span> (<span class="symbol"><A NAME="ref_69_29" HREF="terminal_interface-curses-menus-menu_user_data__ads.htm#ref_59_29">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_70_29" HREF="terminal_interface-curses-menus-menu_user_data__ads.htm#ref_60_29">Data</A></span> : <b>out</b> <A HREF="terminal_interface-curses-menus-menu_user_data__ads.htm#ref_44_9">User_Access</A>) - <b>is</b> - <b>begin</b> - <A HREF="terminal_interface-curses-menus-menu_user_data__ads.htm#ref_60_29">Data</A> := <A HREF="terminal_interface-curses-menus-menu_user_data__ads.htm#ref_64_13">Get_User_Data</A> (<A HREF="terminal_interface-curses-menus-menu_user_data__ads.htm#ref_59_29">Men</A>); -diff -Naur ncurses-5.9/doc/html/ada/terminal_interface-curses-menus-menu_user_data__ads.htm ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-menus-menu_user_data__ads.htm ---- ncurses-5.9/doc/html/ada/terminal_interface-curses-menus-menu_user_data__ads.htm 2010-01-09 21:31:26.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-menus-menu_user_data__ads.htm 2014-09-01 16:33:22.289792011 +0200 -@@ -1,74 +1,86 @@ --<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> --<HTML><HEAD><TITLE>terminal_interface-curses-menus-menu_user_data.ads</TITLE></HEAD> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> -+<HTML> -+<HEAD> -+<TITLE>terminal_interface-curses-menus-menu_user_data.ads</TITLE> -+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> -+<style type="text/css"> -+*.comment { -+ color: green; -+} -+*.symbol { -+ color: red; -+} -+</style> -+</HEAD> - <BODY> --<HR><DIV ALIGN="center"><H1> File : terminal_interface-curses-menus-menu_user_data.ads </H1></DIV><HR> -+<HR><DIV style="text-align:center"><H1> File : terminal_interface-curses-menus-menu_user_data.ads </H1></DIV><HR> - <PRE> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Terminal_Interface.Curses.Menus.Menu_User_Data --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- S P E C --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Copyright (c) 1998-2003,2009 Free Software Foundation, Inc. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></FONT> --<FONT COLOR=green><EM>-- copy of this software and associated documentation files (the --</EM></FONT> --<FONT COLOR=green><EM>-- "Software"), to deal in the Software without restriction, including --</EM></FONT> --<FONT COLOR=green><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></FONT> --<FONT COLOR=green><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></FONT> --<FONT COLOR=green><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></FONT> --<FONT COLOR=green><EM>-- furnished to do so, subject to the following conditions: --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- The above copyright notice and this permission notice shall be included --</EM></FONT> --<FONT COLOR=green><EM>-- in all copies or substantial portions of the Software. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></FONT> --<FONT COLOR=green><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></FONT> --<FONT COLOR=green><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></FONT> --<FONT COLOR=green><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></FONT> --<FONT COLOR=green><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></FONT> --<FONT COLOR=green><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></FONT> --<FONT COLOR=green><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></FONT> --<FONT COLOR=green><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></FONT> --<FONT COLOR=green><EM>-- sale, use or other dealings in this Software without prior written --</EM></FONT> --<FONT COLOR=green><EM>-- authorization. --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Author: Juergen Pfeifer, 1996</EM></FONT> --<FONT COLOR=green><EM>-- Version Control:</EM></FONT> --<FONT COLOR=green><EM>-- @Revision: 1.15 @</EM></FONT> --<FONT COLOR=green><EM>-- Binding Version 01.00</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Terminal_Interface.Curses.Menus.Menu_User_Data --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- S P E C --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Copyright (c) 1998-2003,2009 Free Software Foundation, Inc. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></span> -+<span class="comment"><EM>-- copy of this software and associated documentation files (the --</EM></span> -+<span class="comment"><EM>-- "Software"), to deal in the Software without restriction, including --</EM></span> -+<span class="comment"><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></span> -+<span class="comment"><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></span> -+<span class="comment"><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></span> -+<span class="comment"><EM>-- furnished to do so, subject to the following conditions: --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- The above copyright notice and this permission notice shall be included --</EM></span> -+<span class="comment"><EM>-- in all copies or substantial portions of the Software. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></span> -+<span class="comment"><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></span> -+<span class="comment"><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></span> -+<span class="comment"><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></span> -+<span class="comment"><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></span> -+<span class="comment"><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></span> -+<span class="comment"><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></span> -+<span class="comment"><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></span> -+<span class="comment"><EM>-- sale, use or other dealings in this Software without prior written --</EM></span> -+<span class="comment"><EM>-- authorization. --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Author: Juergen Pfeifer, 1996</EM></span> -+<span class="comment"><EM>-- Version Control:</EM></span> -+<span class="comment"><EM>-- @Revision: 1.15 @</EM></span> -+<span class="comment"><EM>-- Binding Version 01.00</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> - - <b>generic</b> -- <b>type</b> <FONT COLOR=red><A NAME="ref_43_9" HREF="terminal_interface-curses-menus-menu_user_data__ads.htm#ref_45_41">User</A></FONT> <b>is</b> <b>limited</b> <b>private</b>; -- <b>type</b> <FONT COLOR=red><A NAME="ref_44_9" HREF="terminal_interface-curses-menus-menu_user_data__ads.htm#ref_45_41">User_Access</A></FONT> <b>is</b> <b>access</b> <A HREF="terminal_interface-curses-menus-menu_user_data__ads.htm#ref_43_9">User</A>; --<b>package</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-menus__ads.htm#ref_49_35">Menus</A>.<FONT COLOR=red><A NAME="ref_45_41" HREF="terminal_interface-curses-menus-menu_user_data__adb.htm#ref_43_46">Menu_User_Data</A></FONT> <b>is</b> -+ <b>type</b> <span class="symbol"><A NAME="ref_43_9" HREF="terminal_interface-curses-menus-menu_user_data__ads.htm#ref_45_41">User</A></span> <b>is</b> <b>limited</b> <b>private</b>; -+ <b>type</b> <span class="symbol"><A NAME="ref_44_9" HREF="terminal_interface-curses-menus-menu_user_data__ads.htm#ref_45_41">User_Access</A></span> <b>is</b> <b>access</b> <A HREF="terminal_interface-curses-menus-menu_user_data__ads.htm#ref_43_9">User</A>; -+<b>package</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-menus__ads.htm#ref_49_35">Menus</A>.<span class="symbol"><A NAME="ref_45_41" HREF="terminal_interface-curses-menus-menu_user_data__adb.htm#ref_43_46">Menu_User_Data</A></span> <b>is</b> - <b>pragma</b> Preelaborate (<A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-menus__ads.htm#ref_49_35">Menus</A>.<A HREF="terminal_interface-curses-menus-menu_user_data__ads.htm#ref_45_41">Menu_User_Data</A>); - -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page <A HREF="../man/menu_userptr.3x.html">menu_userptr.3x</A></EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_1"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_53_14" HREF="terminal_interface-curses-menus-menu_user_data__adb.htm#ref_47_14">Set_User_Data</A></FONT> (<FONT COLOR=red><A NAME="ref_53_29" HREF="terminal_interface-curses-menus-menu_user_data__adb.htm#ref_47_29">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_54_29" HREF="terminal_interface-curses-menus-menu_user_data__adb.htm#ref_48_29">Data</A></FONT> : <A HREF="terminal_interface-curses-menus-menu_user_data__ads.htm#ref_44_9">User_Access</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/menu_userptr.3x.html">set_menu_userptr</A></EM></FONT> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page <A HREF="../man/menu_userptr.3x.html">menu_userptr.3x</A></EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_1"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_53_14" HREF="terminal_interface-curses-menus-menu_user_data__adb.htm#ref_47_14">Set_User_Data</A></span> (<span class="symbol"><A NAME="ref_53_29" HREF="terminal_interface-curses-menus-menu_user_data__adb.htm#ref_47_29">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_54_29" HREF="terminal_interface-curses-menus-menu_user_data__adb.htm#ref_48_29">Data</A></span> : <A HREF="terminal_interface-curses-menus-menu_user_data__ads.htm#ref_44_9">User_Access</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/menu_userptr.3x.html">set_menu_userptr</A></EM></span> - <b>pragma</b> Inline (<A HREF="terminal_interface-curses-menus-menu_user_data__ads.htm#ref_53_14">Set_User_Data</A>); - -- <FONT COLOR=green><EM>-- #1A NAME="AFU_2"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_59_14" HREF="terminal_interface-curses-menus-menu_user_data__adb.htm#ref_69_14">Get_User_Data</A></FONT> (<FONT COLOR=red><A NAME="ref_59_29" HREF="terminal_interface-curses-menus-menu_user_data__adb.htm#ref_69_29">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -- <FONT COLOR=red><A NAME="ref_60_29" HREF="terminal_interface-curses-menus-menu_user_data__adb.htm#ref_70_29">Data</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses-menus-menu_user_data__ads.htm#ref_44_9">User_Access</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/menu_userptr.3x.html">menu_userptr</A></EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_3"#2|</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_64_13" HREF="terminal_interface-curses-menus-menu_user_data__adb.htm#ref_61_13">Get_User_Data</A></FONT> (<FONT COLOR=red><A NAME="ref_64_28" HREF="terminal_interface-curses-menus-menu_user_data__adb.htm#ref_61_28">Men</A></FONT> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> <A HREF="terminal_interface-curses-menus-menu_user_data__ads.htm#ref_44_9">User_Access</A>; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/menu_userptr.3x.html">menu_userptr</A></EM></FONT> -- <FONT COLOR=green><EM>-- Same as function</EM></FONT> -+ <span class="comment"><EM>-- #1A NAME="AFU_2"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_59_14" HREF="terminal_interface-curses-menus-menu_user_data__adb.htm#ref_69_14">Get_User_Data</A></span> (<span class="symbol"><A NAME="ref_59_29" HREF="terminal_interface-curses-menus-menu_user_data__adb.htm#ref_69_29">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>; -+ <span class="symbol"><A NAME="ref_60_29" HREF="terminal_interface-curses-menus-menu_user_data__adb.htm#ref_70_29">Data</A></span> : <b>out</b> <A HREF="terminal_interface-curses-menus-menu_user_data__ads.htm#ref_44_9">User_Access</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/menu_userptr.3x.html">menu_userptr</A></EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_3"#2|</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_64_13" HREF="terminal_interface-curses-menus-menu_user_data__adb.htm#ref_61_13">Get_User_Data</A></span> (<span class="symbol"><A NAME="ref_64_28" HREF="terminal_interface-curses-menus-menu_user_data__adb.htm#ref_61_28">Men</A></span> : <A HREF="terminal_interface-curses-menus__ads.htm#ref_57_9">Menu</A>) <b>return</b> <A HREF="terminal_interface-curses-menus-menu_user_data__ads.htm#ref_44_9">User_Access</A>; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/menu_userptr.3x.html">menu_userptr</A></EM></span> -+ <span class="comment"><EM>-- Same as function</EM></span> - <b>pragma</b> Inline (Get_User_Data); - - <b>end</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-menus__ads.htm#ref_49_35">Menus</A>.<A HREF="terminal_interface-curses-menus-menu_user_data__ads.htm#ref_45_41">Menu_User_Data</A>; -diff -Naur ncurses-5.9/doc/html/ada/terminal_interface-curses-mouse__adb.htm ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-mouse__adb.htm ---- ncurses-5.9/doc/html/ada/terminal_interface-curses-mouse__adb.htm 2011-03-20 00:18:40.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-mouse__adb.htm 2014-09-01 16:33:22.294792020 +0200 -@@ -1,93 +1,105 @@ --<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> --<HTML><HEAD><TITLE>terminal_interface-curses-mouse.adb</TITLE></HEAD> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> -+<HTML> -+<HEAD> -+<TITLE>terminal_interface-curses-mouse.adb</TITLE> -+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> -+<style type="text/css"> -+*.comment { -+ color: green; -+} -+*.symbol { -+ color: red; -+} -+</style> -+</HEAD> - <BODY> --<HR><DIV ALIGN="center"><H1> File : terminal_interface-curses-mouse.adb </H1></DIV><HR> -+<HR><DIV style="text-align:center"><H1> File : terminal_interface-curses-mouse.adb </H1></DIV><HR> - <PRE> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Terminal_Interface.Curses.Mouse --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- B O D Y --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Copyright (c) 1998-2008,2009 Free Software Foundation, Inc. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></FONT> --<FONT COLOR=green><EM>-- copy of this software and associated documentation files (the --</EM></FONT> --<FONT COLOR=green><EM>-- "Software"), to deal in the Software without restriction, including --</EM></FONT> --<FONT COLOR=green><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></FONT> --<FONT COLOR=green><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></FONT> --<FONT COLOR=green><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></FONT> --<FONT COLOR=green><EM>-- furnished to do so, subject to the following conditions: --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- The above copyright notice and this permission notice shall be included --</EM></FONT> --<FONT COLOR=green><EM>-- in all copies or substantial portions of the Software. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></FONT> --<FONT COLOR=green><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></FONT> --<FONT COLOR=green><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></FONT> --<FONT COLOR=green><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></FONT> --<FONT COLOR=green><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></FONT> --<FONT COLOR=green><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></FONT> --<FONT COLOR=green><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></FONT> --<FONT COLOR=green><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></FONT> --<FONT COLOR=green><EM>-- sale, use or other dealings in this Software without prior written --</EM></FONT> --<FONT COLOR=green><EM>-- authorization. --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Author: Juergen Pfeifer, 1996</EM></FONT> --<FONT COLOR=green><EM>-- Version Control:</EM></FONT> --<FONT COLOR=green><EM>-- @Revision: 1.24 @</EM></FONT> --<FONT COLOR=green><EM>-- @Date: 2009/12/26 17:38:58 @</EM></FONT> --<FONT COLOR=green><EM>-- Binding Version 01.00</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Terminal_Interface.Curses.Mouse --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- B O D Y --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Copyright (c) 1998-2008,2009 Free Software Foundation, Inc. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></span> -+<span class="comment"><EM>-- copy of this software and associated documentation files (the --</EM></span> -+<span class="comment"><EM>-- "Software"), to deal in the Software without restriction, including --</EM></span> -+<span class="comment"><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></span> -+<span class="comment"><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></span> -+<span class="comment"><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></span> -+<span class="comment"><EM>-- furnished to do so, subject to the following conditions: --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- The above copyright notice and this permission notice shall be included --</EM></span> -+<span class="comment"><EM>-- in all copies or substantial portions of the Software. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></span> -+<span class="comment"><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></span> -+<span class="comment"><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></span> -+<span class="comment"><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></span> -+<span class="comment"><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></span> -+<span class="comment"><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></span> -+<span class="comment"><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></span> -+<span class="comment"><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></span> -+<span class="comment"><EM>-- sale, use or other dealings in this Software without prior written --</EM></span> -+<span class="comment"><EM>-- authorization. --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Author: Juergen Pfeifer, 1996</EM></span> -+<span class="comment"><EM>-- Version Control:</EM></span> -+<span class="comment"><EM>-- @Revision: 1.24 @</EM></span> -+<span class="comment"><EM>-- @Date: 2009/12/26 17:38:58 @</EM></span> -+<span class="comment"><EM>-- Binding Version 01.00</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> - <b>with</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-aux__ads.htm#ref_50_35">Aux</A>; <b>use</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-aux__ads.htm#ref_50_35">Aux</A>; --<b>with</b> <A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>.C; <b>use</b> <A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>.C; --<b>use</b> <A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>; -+<b>with</b> <A HREF="interfac__ads.htm#ref_36_9">Interfaces</A>.C; <b>use</b> <A HREF="interfac__ads.htm#ref_36_9">Interfaces</A>.C; -+<b>use</b> <A HREF="interfac__ads.htm#ref_36_9">Interfaces</A>; - --<b>package</b> <b>body</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<FONT COLOR=red><A NAME="ref_46_40" HREF="terminal_interface-curses-mouse__ads.htm#ref_48_35">Mouse</A></FONT> <b>is</b> -+<b>package</b> <b>body</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<span class="symbol"><A NAME="ref_46_40" HREF="terminal_interface-curses-mouse__ads.htm#ref_48_35">Mouse</A></span> <b>is</b> - - <b>use</b> <b>type</b> System.Bit_Order; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_50_13" HREF="terminal_interface-curses-mouse__ads.htm#ref_94_13">Has_Mouse</A></FONT> <b>return</b> Boolean -+ <b>function</b> <span class="symbol"><A NAME="ref_50_13" HREF="terminal_interface-curses-mouse__ads.htm#ref_94_13">Has_Mouse</A></span> <b>return</b> Boolean - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_52_16">Mouse_Avail</A></FONT> <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_52_16">Mouse_Avail</A></span> <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Mouse_Avail, "has_mouse"); - <b>begin</b> -- <b>if</b> <A HREF="terminal_interface-curses__ads.htm#ref_769_13">Has_Key</A> (<A HREF="terminal_interface-curses__ads.htm#ref_204_4">Key_Mouse</A>) <b>or</b> <b>else</b> <A HREF="terminal_interface-curses-mouse__adb.htm#ref_52_16">Mouse_Avail</A> /= 0 <b>then</b> -+ <b>if</b> <A HREF="terminal_interface-curses__ads.htm#ref_768_13">Has_Key</A> (<A HREF="terminal_interface-curses__ads.htm#ref_204_4">Key_Mouse</A>) <b>or</b> <b>else</b> <A HREF="terminal_interface-curses-mouse__adb.htm#ref_52_16">Mouse_Avail</A> /= 0 <b>then</b> - <b>return</b> True; - <b>else</b> - <b>return</b> False; - <b>end</b> <b>if</b>; - <b>end</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_94_13">Has_Mouse</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_62_13" HREF="terminal_interface-curses-mouse__ads.htm#ref_129_13">Get_Mouse</A></FONT> <b>return</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_88_9">Mouse_Event</A> -+ <b>function</b> <span class="symbol"><A NAME="ref_62_13" HREF="terminal_interface-curses-mouse__ads.htm#ref_129_13">Get_Mouse</A></span> <b>return</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_88_9">Mouse_Event</A> - <b>is</b> -- <b>type</b> <FONT COLOR=red><A NAME="ref_64_12">Event_Access</A></FONT> <b>is</b> <b>access</b> <b>all</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_88_9">Mouse_Event</A>; -+ <b>type</b> <span class="symbol"><A NAME="ref_64_12">Event_Access</A></span> <b>is</b> <b>access</b> <b>all</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_88_9">Mouse_Event</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_66_16">Getmouse</A></FONT> (<FONT COLOR=red><A NAME="ref_66_26" HREF="terminal_interface-curses-mouse__adb.htm#ref_66_16">Ev</A></FONT> : <A HREF="terminal_interface-curses-mouse__adb.htm#ref_64_12">Event_Access</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_66_16">Getmouse</A></span> (<span class="symbol"><A NAME="ref_66_26" HREF="terminal_interface-curses-mouse__adb.htm#ref_66_16">Ev</A></span> : <A HREF="terminal_interface-curses-mouse__adb.htm#ref_64_12">Event_Access</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Getmouse, "getmouse"); - -- <FONT COLOR=red><A NAME="ref_69_7">Event</A></FONT> : <b>aliased</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_88_9">Mouse_Event</A>; -+ <span class="symbol"><A NAME="ref_69_7">Event</A></span> : <b>aliased</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_88_9">Mouse_Event</A>; - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses-mouse__adb.htm#ref_66_16">Getmouse</A> (<A HREF="terminal_interface-curses-mouse__adb.htm#ref_69_7">Event</A>'<b>Access</b>) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; - <b>return</b> <A HREF="terminal_interface-curses-mouse__adb.htm#ref_69_7">Event</A>; - <b>end</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_129_13">Get_Mouse</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_77_14" HREF="terminal_interface-curses-mouse__ads.htm#ref_97_14">Register_Reportable_Event</A></FONT> (<FONT COLOR=red><A NAME="ref_77_41" HREF="terminal_interface-curses-mouse__ads.htm#ref_98_7">Button</A></FONT> : <A HREF="terminal_interface-curses-mouse__ads.htm#ref_64_9">Mouse_Button</A>; -- <FONT COLOR=red><A NAME="ref_78_41" HREF="terminal_interface-curses-mouse__ads.htm#ref_99_7">State</A></FONT> : <A HREF="terminal_interface-curses-mouse__ads.htm#ref_75_9">Button_State</A>; -- <FONT COLOR=red><A NAME="ref_79_41" HREF="terminal_interface-curses-mouse__ads.htm#ref_100_7">Mask</A></FONT> : <b>in</b> <b>out</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A>) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_77_14" HREF="terminal_interface-curses-mouse__ads.htm#ref_97_14">Register_Reportable_Event</A></span> (<span class="symbol"><A NAME="ref_77_41" HREF="terminal_interface-curses-mouse__ads.htm#ref_98_7">Button</A></span> : <A HREF="terminal_interface-curses-mouse__ads.htm#ref_64_9">Mouse_Button</A>; -+ <span class="symbol"><A NAME="ref_78_41" HREF="terminal_interface-curses-mouse__ads.htm#ref_99_7">State</A></span> : <A HREF="terminal_interface-curses-mouse__ads.htm#ref_75_9">Button_State</A>; -+ <span class="symbol"><A NAME="ref_79_41" HREF="terminal_interface-curses-mouse__ads.htm#ref_100_7">Mask</A></span> : <b>in</b> <b>out</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A>) - <b>is</b> -- <FONT COLOR=red><A NAME="ref_81_7">Button_Nr</A></FONT> : <b>constant</b> Natural := <A HREF="terminal_interface-curses-mouse__ads.htm#ref_64_9">Mouse_Button</A>'Pos (<A HREF="terminal_interface-curses-mouse__ads.htm#ref_98_7">Button</A>); -- <FONT COLOR=red><A NAME="ref_82_7">State_Nr</A></FONT> : <b>constant</b> Natural := <A HREF="terminal_interface-curses-mouse__ads.htm#ref_75_9">Button_State</A>'Pos (<A HREF="terminal_interface-curses-mouse__ads.htm#ref_99_7">State</A>); -+ <span class="symbol"><A NAME="ref_81_7">Button_Nr</A></span> : <b>constant</b> Natural := <A HREF="terminal_interface-curses-mouse__ads.htm#ref_64_9">Mouse_Button</A>'Pos (<A HREF="terminal_interface-curses-mouse__ads.htm#ref_98_7">Button</A>); -+ <span class="symbol"><A NAME="ref_82_7">State_Nr</A></span> : <b>constant</b> Natural := <A HREF="terminal_interface-curses-mouse__ads.htm#ref_75_9">Button_State</A>'Pos (<A HREF="terminal_interface-curses-mouse__ads.htm#ref_99_7">State</A>); - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_98_7">Button</A> <b>in</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_73_12">Modifier_Keys</A> <b>and</b> <b>then</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_99_7">State</A> /= <A HREF="terminal_interface-curses-mouse__ads.htm#ref_76_26">Pressed</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>else</b> - <b>if</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_98_7">Button</A> <b>in</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_72_12">Real_Buttons</A> <b>then</b> - <A HREF="terminal_interface-curses-mouse__ads.htm#ref_100_7">Mask</A> := <A HREF="terminal_interface-curses-mouse__ads.htm#ref_100_7">Mask</A> <b>or</b> ((2 ** (6 * <A HREF="terminal_interface-curses-mouse__adb.htm#ref_81_7">Button_Nr</A>)) ** <A HREF="terminal_interface-curses-mouse__adb.htm#ref_82_7">State_Nr</A>); -@@ -97,52 +109,52 @@ - <b>end</b> <b>if</b>; - <b>end</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_97_14">Register_Reportable_Event</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_95_14" HREF="terminal_interface-curses-mouse__ads.htm#ref_106_14">Register_Reportable_Events</A></FONT> (<FONT COLOR=red><A NAME="ref_95_42" HREF="terminal_interface-curses-mouse__ads.htm#ref_107_7">Button</A></FONT> : <A HREF="terminal_interface-curses-mouse__ads.htm#ref_64_9">Mouse_Button</A>; -- <FONT COLOR=red><A NAME="ref_96_42" HREF="terminal_interface-curses-mouse__ads.htm#ref_108_7">State</A></FONT> : Button_States; -- <FONT COLOR=red><A NAME="ref_97_42" HREF="terminal_interface-curses-mouse__ads.htm#ref_109_7">Mask</A></FONT> : <b>in</b> <b>out</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A>) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_95_14" HREF="terminal_interface-curses-mouse__ads.htm#ref_106_14">Register_Reportable_Events</A></span> (<span class="symbol"><A NAME="ref_95_42" HREF="terminal_interface-curses-mouse__ads.htm#ref_107_7">Button</A></span> : <A HREF="terminal_interface-curses-mouse__ads.htm#ref_64_9">Mouse_Button</A>; -+ <span class="symbol"><A NAME="ref_96_42" HREF="terminal_interface-curses-mouse__ads.htm#ref_108_7">State</A></span> : Button_States; -+ <span class="symbol"><A NAME="ref_97_42" HREF="terminal_interface-curses-mouse__ads.htm#ref_109_7">Mask</A></span> : <b>in</b> <b>out</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A>) - <b>is</b> - <b>begin</b> -- <b>for</b> <FONT COLOR=red><A NAME="ref_100_11">S</A></FONT> <b>in</b> Button_States'<b>Range</b> <b>loop</b> -+ <b>for</b> <span class="symbol"><A NAME="ref_100_11">S</A></span> <b>in</b> Button_States'<b>Range</b> <b>loop</b> - <b>if</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_108_7">State</A> (<A HREF="terminal_interface-curses-mouse__adb.htm#ref_100_11">S</A>) <b>then</b> - <A HREF="terminal_interface-curses-mouse__ads.htm#ref_97_14">Register_Reportable_Event</A> (<A HREF="terminal_interface-curses-mouse__ads.htm#ref_107_7">Button</A>, <A HREF="terminal_interface-curses-mouse__adb.htm#ref_100_11">S</A>, <A HREF="terminal_interface-curses-mouse__ads.htm#ref_109_7">Mask</A>); - <b>end</b> <b>if</b>; - <b>end</b> <b>loop</b>; - <b>end</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_106_14">Register_Reportable_Events</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_107_13" HREF="terminal_interface-curses-mouse__ads.htm#ref_119_13">Start_Mouse</A></FONT> (<FONT COLOR=red><A NAME="ref_107_26" HREF="terminal_interface-curses-mouse__ads.htm#ref_119_26">Mask</A></FONT> : <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A> := <A HREF="terminal_interface-curses-mouse__ads.htm#ref_62_4">All_Events</A>) -+ <b>function</b> <span class="symbol"><A NAME="ref_107_13" HREF="terminal_interface-curses-mouse__ads.htm#ref_119_13">Start_Mouse</A></span> (<span class="symbol"><A NAME="ref_107_26" HREF="terminal_interface-curses-mouse__ads.htm#ref_119_26">Mask</A></span> : <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A> := <A HREF="terminal_interface-curses-mouse__ads.htm#ref_62_4">All_Events</A>) - <b>return</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A> - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_110_16">MMask</A></FONT> (<FONT COLOR=red><A NAME="ref_110_23" HREF="terminal_interface-curses-mouse__adb.htm#ref_110_16">M</A></FONT> : <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A>; -- <FONT COLOR=red><A NAME="ref_111_23" HREF="terminal_interface-curses-mouse__adb.htm#ref_110_16">O</A></FONT> : <b>access</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A>) <b>return</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_110_16">MMask</A></span> (<span class="symbol"><A NAME="ref_110_23" HREF="terminal_interface-curses-mouse__adb.htm#ref_110_16">M</A></span> : <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A>; -+ <span class="symbol"><A NAME="ref_111_23" HREF="terminal_interface-curses-mouse__adb.htm#ref_110_16">O</A></span> : <b>access</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A>) <b>return</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A>; - <b>pragma</b> Import (C, MMask, "mousemask"); -- <FONT COLOR=red><A NAME="ref_113_7">R</A></FONT> : <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A>; -- <FONT COLOR=red><A NAME="ref_114_7">Old</A></FONT> : <b>aliased</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A>; -+ <span class="symbol"><A NAME="ref_113_7">R</A></span> : <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A>; -+ <span class="symbol"><A NAME="ref_114_7">Old</A></span> : <b>aliased</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A>; - <b>begin</b> - <A HREF="terminal_interface-curses-mouse__adb.htm#ref_113_7">R</A> := <A HREF="terminal_interface-curses-mouse__adb.htm#ref_110_16">MMask</A> (<A HREF="terminal_interface-curses-mouse__ads.htm#ref_119_26">Mask</A>, <A HREF="terminal_interface-curses-mouse__adb.htm#ref_114_7">Old</A>'<b>Access</b>); - <b>if</b> <A HREF="terminal_interface-curses-mouse__adb.htm#ref_113_7">R</A> = <A HREF="terminal_interface-curses-mouse__ads.htm#ref_61_4">No_Events</A> <b>then</b> -- <A HREF="terminal_interface-curses__ads.htm#ref_872_14">Beep</A>; -+ <A HREF="terminal_interface-curses__ads.htm#ref_871_14">Beep</A>; - <b>end</b> <b>if</b>; - <b>return</b> <A HREF="terminal_interface-curses-mouse__adb.htm#ref_114_7">Old</A>; - <b>end</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_119_13">Start_Mouse</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_123_14" HREF="terminal_interface-curses-mouse__ads.htm#ref_124_14">End_Mouse</A></FONT> (<FONT COLOR=red><A NAME="ref_123_25" HREF="terminal_interface-curses-mouse__ads.htm#ref_124_25">Mask</A></FONT> : <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A> := <A HREF="terminal_interface-curses-mouse__ads.htm#ref_61_4">No_Events</A>) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_123_14" HREF="terminal_interface-curses-mouse__ads.htm#ref_124_14">End_Mouse</A></span> (<span class="symbol"><A NAME="ref_123_25" HREF="terminal_interface-curses-mouse__ads.htm#ref_124_25">Mask</A></span> : <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A> := <A HREF="terminal_interface-curses-mouse__ads.htm#ref_61_4">No_Events</A>) - <b>is</b> - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_124_25">Mask</A> /= <A HREF="terminal_interface-curses-mouse__ads.htm#ref_61_4">No_Events</A> <b>then</b> -- <A HREF="terminal_interface-curses__ads.htm#ref_872_14">Beep</A>; -+ <A HREF="terminal_interface-curses__ads.htm#ref_871_14">Beep</A>; - <b>end</b> <b>if</b>; - <b>end</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_124_14">End_Mouse</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_131_14" HREF="terminal_interface-curses-mouse__adb.htm#ref_135_14">Dispatch_Event</A></FONT> (<FONT COLOR=red><A NAME="ref_131_30" HREF="terminal_interface-curses-mouse__adb.htm#ref_135_30">Mask</A></FONT> : <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A>; -- <FONT COLOR=red><A NAME="ref_132_30" HREF="terminal_interface-curses-mouse__adb.htm#ref_136_30">Button</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_64_9">Mouse_Button</A>; -- <FONT COLOR=red><A NAME="ref_133_30" HREF="terminal_interface-curses-mouse__adb.htm#ref_137_30">State</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_75_9">Button_State</A>); -- -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_135_14" HREF="terminal_interface-curses-mouse__adb.htm#ref_131_14">Dispatch_Event</A></FONT> (<FONT COLOR=red><A NAME="ref_135_30" HREF="terminal_interface-curses-mouse__adb.htm#ref_131_30">Mask</A></FONT> : <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A>; -- <FONT COLOR=red><A NAME="ref_136_30" HREF="terminal_interface-curses-mouse__adb.htm#ref_132_30">Button</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_64_9">Mouse_Button</A>; -- <FONT COLOR=red><A NAME="ref_137_30" HREF="terminal_interface-curses-mouse__adb.htm#ref_133_30">State</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_75_9">Button_State</A>) <b>is</b> -- <FONT COLOR=red><A NAME="ref_138_7">L</A></FONT> : <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A>; -+ <b>procedure</b> <span class="symbol"><A NAME="ref_131_14" HREF="terminal_interface-curses-mouse__adb.htm#ref_135_14">Dispatch_Event</A></span> (<span class="symbol"><A NAME="ref_131_30" HREF="terminal_interface-curses-mouse__adb.htm#ref_135_30">Mask</A></span> : <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A>; -+ <span class="symbol"><A NAME="ref_132_30" HREF="terminal_interface-curses-mouse__adb.htm#ref_136_30">Button</A></span> : <b>out</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_64_9">Mouse_Button</A>; -+ <span class="symbol"><A NAME="ref_133_30" HREF="terminal_interface-curses-mouse__adb.htm#ref_137_30">State</A></span> : <b>out</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_75_9">Button_State</A>); -+ -+ <b>procedure</b> <span class="symbol"><A NAME="ref_135_14" HREF="terminal_interface-curses-mouse__adb.htm#ref_131_14">Dispatch_Event</A></span> (<span class="symbol"><A NAME="ref_135_30" HREF="terminal_interface-curses-mouse__adb.htm#ref_131_30">Mask</A></span> : <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A>; -+ <span class="symbol"><A NAME="ref_136_30" HREF="terminal_interface-curses-mouse__adb.htm#ref_132_30">Button</A></span> : <b>out</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_64_9">Mouse_Button</A>; -+ <span class="symbol"><A NAME="ref_137_30" HREF="terminal_interface-curses-mouse__adb.htm#ref_133_30">State</A></span> : <b>out</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_75_9">Button_State</A>) <b>is</b> -+ <span class="symbol"><A NAME="ref_138_7">L</A></span> : <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A>; - <b>begin</b> -- <A HREF="terminal_interface-curses-mouse__adb.htm#ref_132_30">Button</A> := <A HREF="terminal_interface-curses-mouse__ads.htm#ref_70_26">Alt</A>; <FONT COLOR=green><EM>-- preset to non real button;</EM></FONT> -+ <A HREF="terminal_interface-curses-mouse__adb.htm#ref_132_30">Button</A> := <A HREF="terminal_interface-curses-mouse__ads.htm#ref_70_26">Alt</A>; <span class="comment"><EM>-- preset to non real button;</EM></span> - <b>if</b> (<A HREF="terminal_interface-curses-mouse__adb.htm#ref_131_30">Mask</A> <b>and</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_217_4">BUTTON1_EVENTS</A>) /= 0 <b>then</b> - <A HREF="terminal_interface-curses-mouse__adb.htm#ref_132_30">Button</A> := <A HREF="terminal_interface-curses-mouse__ads.htm#ref_64_26">Left</A>; - <b>elsif</b> (<A HREF="terminal_interface-curses-mouse__adb.htm#ref_131_30">Mask</A> <b>and</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_218_4">BUTTON2_EVENTS</A>) /= 0 <b>then</b> -@@ -154,7 +166,7 @@ - <b>end</b> <b>if</b>; - <b>if</b> <A HREF="terminal_interface-curses-mouse__adb.htm#ref_132_30">Button</A> <b>in</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_72_12">Real_Buttons</A> <b>then</b> - <A HREF="terminal_interface-curses-mouse__adb.htm#ref_138_7">L</A> := 2 ** (6 * <A HREF="terminal_interface-curses-mouse__ads.htm#ref_64_9">Mouse_Button</A>'Pos (<A HREF="terminal_interface-curses-mouse__adb.htm#ref_132_30">Button</A>)); -- <b>for</b> <FONT COLOR=red><A NAME="ref_152_14">I</A></FONT> <b>in</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_75_9">Button_State</A>'<b>Range</b> <b>loop</b> -+ <b>for</b> <span class="symbol"><A NAME="ref_152_14">I</A></span> <b>in</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_75_9">Button_State</A>'<b>Range</b> <b>loop</b> - <b>if</b> (<A HREF="terminal_interface-curses-mouse__adb.htm#ref_131_30">Mask</A> <b>and</b> <A HREF="terminal_interface-curses-mouse__adb.htm#ref_138_7">L</A>) /= 0 <b>then</b> - <A HREF="terminal_interface-curses-mouse__adb.htm#ref_133_30">State</A> := <A HREF="terminal_interface-curses-mouse__adb.htm#ref_152_14">I</A>; - <b>exit</b>; -@@ -173,47 +185,47 @@ - <b>end</b> <b>if</b>; - <b>end</b> <A HREF="terminal_interface-curses-mouse__adb.htm#ref_131_14">Dispatch_Event</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_171_14" HREF="terminal_interface-curses-mouse__ads.htm#ref_133_14">Get_Event</A></FONT> (<FONT COLOR=red><A NAME="ref_171_25" HREF="terminal_interface-curses-mouse__ads.htm#ref_133_25">Event</A></FONT> : <A HREF="terminal_interface-curses-mouse__ads.htm#ref_88_9">Mouse_Event</A>; -- <FONT COLOR=red><A NAME="ref_172_25" HREF="terminal_interface-curses-mouse__ads.htm#ref_134_25">Y</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_173_25" HREF="terminal_interface-curses-mouse__ads.htm#ref_135_25">X</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -- <FONT COLOR=red><A NAME="ref_174_25" HREF="terminal_interface-curses-mouse__ads.htm#ref_136_25">Button</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_64_9">Mouse_Button</A>; -- <FONT COLOR=red><A NAME="ref_175_25" HREF="terminal_interface-curses-mouse__ads.htm#ref_137_25">State</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_75_9">Button_State</A>) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_171_14" HREF="terminal_interface-curses-mouse__ads.htm#ref_133_14">Get_Event</A></span> (<span class="symbol"><A NAME="ref_171_25" HREF="terminal_interface-curses-mouse__ads.htm#ref_133_25">Event</A></span> : <A HREF="terminal_interface-curses-mouse__ads.htm#ref_88_9">Mouse_Event</A>; -+ <span class="symbol"><A NAME="ref_172_25" HREF="terminal_interface-curses-mouse__ads.htm#ref_134_25">Y</A></span> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_173_25" HREF="terminal_interface-curses-mouse__ads.htm#ref_135_25">X</A></span> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -+ <span class="symbol"><A NAME="ref_174_25" HREF="terminal_interface-curses-mouse__ads.htm#ref_136_25">Button</A></span> : <b>out</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_64_9">Mouse_Button</A>; -+ <span class="symbol"><A NAME="ref_175_25" HREF="terminal_interface-curses-mouse__ads.htm#ref_137_25">State</A></span> : <b>out</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_75_9">Button_State</A>) - <b>is</b> -- <FONT COLOR=red><A NAME="ref_177_7">Mask</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A> := <A HREF="terminal_interface-curses-mouse__ads.htm#ref_133_25">Event</A>.<A HREF="terminal_interface-curses-mouse__ads.htm#ref_170_10">Bstate</A>; -+ <span class="symbol"><A NAME="ref_177_7">Mask</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A> := <A HREF="terminal_interface-curses-mouse__ads.htm#ref_133_25">Event</A>.<A HREF="terminal_interface-curses-mouse__ads.htm#ref_170_10">Bstate</A>; - <b>begin</b> - <A HREF="terminal_interface-curses-mouse__ads.htm#ref_135_25">X</A> := <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A> (<A HREF="terminal_interface-curses-mouse__ads.htm#ref_133_25">Event</A>.<A HREF="terminal_interface-curses-mouse__ads.htm#ref_168_10">X</A>); - <A HREF="terminal_interface-curses-mouse__ads.htm#ref_134_25">Y</A> := <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A> (<A HREF="terminal_interface-curses-mouse__ads.htm#ref_133_25">Event</A>.<A HREF="terminal_interface-curses-mouse__ads.htm#ref_168_13">Y</A>); - <A HREF="terminal_interface-curses-mouse__adb.htm#ref_131_14">Dispatch_Event</A> (<A HREF="terminal_interface-curses-mouse__adb.htm#ref_177_7">Mask</A>, <A HREF="terminal_interface-curses-mouse__ads.htm#ref_136_25">Button</A>, <A HREF="terminal_interface-curses-mouse__ads.htm#ref_137_25">State</A>); - <b>end</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_133_14">Get_Event</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_184_14" HREF="terminal_interface-curses-mouse__ads.htm#ref_145_14">Unget_Mouse</A></FONT> (<FONT COLOR=red><A NAME="ref_184_27" HREF="terminal_interface-curses-mouse__ads.htm#ref_145_27">Event</A></FONT> : <A HREF="terminal_interface-curses-mouse__ads.htm#ref_88_9">Mouse_Event</A>) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_184_14" HREF="terminal_interface-curses-mouse__ads.htm#ref_145_14">Unget_Mouse</A></span> (<span class="symbol"><A NAME="ref_184_27" HREF="terminal_interface-curses-mouse__ads.htm#ref_145_27">Event</A></span> : <A HREF="terminal_interface-curses-mouse__ads.htm#ref_88_9">Mouse_Event</A>) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_186_16">Ungetmouse</A></FONT> (<FONT COLOR=red><A NAME="ref_186_28" HREF="terminal_interface-curses-mouse__adb.htm#ref_186_16">Ev</A></FONT> : <A HREF="terminal_interface-curses-mouse__ads.htm#ref_88_9">Mouse_Event</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_186_16">Ungetmouse</A></span> (<span class="symbol"><A NAME="ref_186_28" HREF="terminal_interface-curses-mouse__adb.htm#ref_186_16">Ev</A></span> : <A HREF="terminal_interface-curses-mouse__ads.htm#ref_88_9">Mouse_Event</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Ungetmouse, "ungetmouse"); - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses-mouse__adb.htm#ref_186_16">Ungetmouse</A> (<A HREF="terminal_interface-curses-mouse__ads.htm#ref_145_27">Event</A>) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; - <b>end</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_145_14">Unget_Mouse</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_194_13" HREF="terminal_interface-curses-mouse__ads.htm#ref_150_13">Enclosed_In_Window</A></FONT> (<FONT COLOR=red><A NAME="ref_194_33" HREF="terminal_interface-curses-mouse__ads.htm#ref_150_33">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_195_33" HREF="terminal_interface-curses-mouse__ads.htm#ref_151_33">Event</A></FONT> : <A HREF="terminal_interface-curses-mouse__ads.htm#ref_88_9">Mouse_Event</A>) <b>return</b> Boolean -+ <b>function</b> <span class="symbol"><A NAME="ref_194_13" HREF="terminal_interface-curses-mouse__ads.htm#ref_150_13">Enclosed_In_Window</A></span> (<span class="symbol"><A NAME="ref_194_33" HREF="terminal_interface-curses-mouse__ads.htm#ref_150_33">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_195_33" HREF="terminal_interface-curses-mouse__ads.htm#ref_151_33">Event</A></span> : <A HREF="terminal_interface-curses-mouse__ads.htm#ref_88_9">Mouse_Event</A>) <b>return</b> Boolean - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_197_16">Wenclose</A></FONT> (<FONT COLOR=red><A NAME="ref_197_26" HREF="terminal_interface-curses-mouse__adb.htm#ref_197_16">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; <FONT COLOR=red><A NAME="ref_197_40" HREF="terminal_interface-curses-mouse__adb.htm#ref_197_16">Y</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; <FONT COLOR=red><A NAME="ref_197_51" HREF="terminal_interface-curses-mouse__adb.htm#ref_197_16">X</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) -- <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_1926_9">Curses_Bool</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_197_16">Wenclose</A></span> (<span class="symbol"><A NAME="ref_197_26" HREF="terminal_interface-curses-mouse__adb.htm#ref_197_16">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; <span class="symbol"><A NAME="ref_197_40" HREF="terminal_interface-curses-mouse__adb.htm#ref_197_16">Y</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; <span class="symbol"><A NAME="ref_197_51" HREF="terminal_interface-curses-mouse__adb.htm#ref_197_16">X</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) -+ <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_1925_9">Curses_Bool</A>; - <b>pragma</b> Import (C, Wenclose, "wenclose"); - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses-mouse__adb.htm#ref_197_16">Wenclose</A> (<A HREF="terminal_interface-curses-mouse__ads.htm#ref_150_33">Win</A>, <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses-mouse__ads.htm#ref_151_33">Event</A>.<A HREF="terminal_interface-curses-mouse__ads.htm#ref_168_13">Y</A>), <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses-mouse__ads.htm#ref_151_33">Event</A>.<A HREF="terminal_interface-curses-mouse__ads.htm#ref_168_10">X</A>)) -- = <A HREF="terminal_interface-curses__ads.htm#ref_1927_4">Curses_Bool_False</A> <b>then</b> -+ = <A HREF="terminal_interface-curses__ads.htm#ref_1926_4">Curses_Bool_False</A> <b>then</b> - <b>return</b> False; - <b>else</b> - <b>return</b> True; - <b>end</b> <b>if</b>; - <b>end</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_150_13">Enclosed_In_Window</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_209_13" HREF="terminal_interface-curses-mouse__ads.htm#ref_157_13">Mouse_Interval</A></FONT> (<FONT COLOR=red><A NAME="ref_209_29" HREF="terminal_interface-curses-mouse__ads.htm#ref_157_29">Msec</A></FONT> : Natural := 200) <b>return</b> Natural -+ <b>function</b> <span class="symbol"><A NAME="ref_209_13" HREF="terminal_interface-curses-mouse__ads.htm#ref_157_13">Mouse_Interval</A></span> (<span class="symbol"><A NAME="ref_209_29" HREF="terminal_interface-curses-mouse__ads.htm#ref_157_29">Msec</A></span> : Natural := 200) <b>return</b> Natural - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_211_16">Mouseinterval</A></FONT> (<FONT COLOR=red><A NAME="ref_211_31" HREF="terminal_interface-curses-mouse__adb.htm#ref_211_16">Msec</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_211_16">Mouseinterval</A></span> (<span class="symbol"><A NAME="ref_211_31" HREF="terminal_interface-curses-mouse__adb.htm#ref_211_16">Msec</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Mouseinterval, "mouseinterval"); - <b>begin</b> - <b>return</b> Natural (<A HREF="terminal_interface-curses-mouse__adb.htm#ref_211_16">Mouseinterval</A> (<A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses-mouse__ads.htm#ref_157_29">Msec</A>))); -diff -Naur ncurses-5.9/doc/html/ada/terminal_interface-curses-mouse__ads.htm ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-mouse__ads.htm ---- ncurses-5.9/doc/html/ada/terminal_interface-curses-mouse__ads.htm 2011-03-20 00:18:40.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-mouse__ads.htm 2014-09-01 16:33:22.294792020 +0200 -@@ -1,178 +1,190 @@ --<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> --<HTML><HEAD><TITLE>terminal_interface-curses-mouse.ads</TITLE></HEAD> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> -+<HTML> -+<HEAD> -+<TITLE>terminal_interface-curses-mouse.ads</TITLE> -+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> -+<style type="text/css"> -+*.comment { -+ color: green; -+} -+*.symbol { -+ color: red; -+} -+</style> -+</HEAD> - <BODY> --<HR><DIV ALIGN="center"><H1> File : terminal_interface-curses-mouse.ads </H1></DIV><HR> -+<HR><DIV style="text-align:center"><H1> File : terminal_interface-curses-mouse.ads </H1></DIV><HR> - <PRE> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Terminal_Interface.Curses.Mouse --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- S P E C --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Copyright (c) 1998-2009,2011 Free Software Foundation, Inc. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></FONT> --<FONT COLOR=green><EM>-- copy of this software and associated documentation files (the --</EM></FONT> --<FONT COLOR=green><EM>-- "Software"), to deal in the Software without restriction, including --</EM></FONT> --<FONT COLOR=green><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></FONT> --<FONT COLOR=green><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></FONT> --<FONT COLOR=green><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></FONT> --<FONT COLOR=green><EM>-- furnished to do so, subject to the following conditions: --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- The above copyright notice and this permission notice shall be included --</EM></FONT> --<FONT COLOR=green><EM>-- in all copies or substantial portions of the Software. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></FONT> --<FONT COLOR=green><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></FONT> --<FONT COLOR=green><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></FONT> --<FONT COLOR=green><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></FONT> --<FONT COLOR=green><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></FONT> --<FONT COLOR=green><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></FONT> --<FONT COLOR=green><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></FONT> --<FONT COLOR=green><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></FONT> --<FONT COLOR=green><EM>-- sale, use or other dealings in this Software without prior written --</EM></FONT> --<FONT COLOR=green><EM>-- authorization. --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Author: Juergen Pfeifer, 1996</EM></FONT> --<FONT COLOR=green><EM>-- Version Control:</EM></FONT> --<FONT COLOR=green><EM>-- @Revision: 1.29 @</EM></FONT> --<FONT COLOR=green><EM>-- @Date: 2011/03/19 12:35:58 @</EM></FONT> --<FONT COLOR=green><EM>-- Binding Version 01.00</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- mouse binding.</EM></FONT> --<FONT COLOR=green><EM>-- This module is generated. Please don't change it manually!</EM></FONT> --<FONT COLOR=green><EM>-- Run the generator instead.</EM></FONT> --<FONT COLOR=green><EM>-- |</EM></FONT> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Terminal_Interface.Curses.Mouse --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- S P E C --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Copyright (c) 1998-2009,2011 Free Software Foundation, Inc. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></span> -+<span class="comment"><EM>-- copy of this software and associated documentation files (the --</EM></span> -+<span class="comment"><EM>-- "Software"), to deal in the Software without restriction, including --</EM></span> -+<span class="comment"><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></span> -+<span class="comment"><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></span> -+<span class="comment"><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></span> -+<span class="comment"><EM>-- furnished to do so, subject to the following conditions: --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- The above copyright notice and this permission notice shall be included --</EM></span> -+<span class="comment"><EM>-- in all copies or substantial portions of the Software. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></span> -+<span class="comment"><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></span> -+<span class="comment"><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></span> -+<span class="comment"><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></span> -+<span class="comment"><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></span> -+<span class="comment"><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></span> -+<span class="comment"><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></span> -+<span class="comment"><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></span> -+<span class="comment"><EM>-- sale, use or other dealings in this Software without prior written --</EM></span> -+<span class="comment"><EM>-- authorization. --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Author: Juergen Pfeifer, 1996</EM></span> -+<span class="comment"><EM>-- Version Control:</EM></span> -+<span class="comment"><EM>-- @Revision: 1.29 @</EM></span> -+<span class="comment"><EM>-- @Date: 2011/03/19 12:35:58 @</EM></span> -+<span class="comment"><EM>-- Binding Version 01.00</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- mouse binding.</EM></span> -+<span class="comment"><EM>-- This module is generated. Please don't change it manually!</EM></span> -+<span class="comment"><EM>-- Run the generator instead.</EM></span> -+<span class="comment"><EM>-- |</EM></span> - <b>with</b> System; - --<b>package</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<FONT COLOR=red><A NAME="ref_48_35" HREF="terminal_interface-curses-mouse__adb.htm#ref_46_40">Mouse</A></FONT> <b>is</b> -+<b>package</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<span class="symbol"><A NAME="ref_48_35" HREF="terminal_interface-curses-mouse__adb.htm#ref_46_40">Mouse</A></span> <b>is</b> - <b>pragma</b> Preelaborate (<A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-mouse__ads.htm#ref_48_35">Mouse</A>); - -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page <A HREF="../man/curs_mouse.3x.html">curs_mouse.3x</A></EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- mouse_trafo, wmouse_trafo are implemented as Transform_Coordinates</EM></FONT> -- <FONT COLOR=green><EM>-- in the parent package.</EM></FONT> -- <FONT COLOR=green><EM>--</EM></FONT> -- <FONT COLOR=green><EM>-- Not implemented:</EM></FONT> -- <FONT COLOR=green><EM>-- REPORT_MOUSE_POSITION (i.e. as a parameter to Register_Reportable_Event</EM></FONT> -- <FONT COLOR=green><EM>-- or Start_Mouse)</EM></FONT> -- <b>type</b> <FONT COLOR=red><A NAME="ref_60_9">Event_Mask</A></FONT> <b>is</b> <b>private</b>; -- <FONT COLOR=red><A NAME="ref_61_4">No_Events</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A>; -- <FONT COLOR=red><A NAME="ref_62_4">All_Events</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A>; -- -- <b>type</b> <FONT COLOR=red><A NAME="ref_64_9">Mouse_Button</A></FONT> <b>is</b> (<FONT COLOR=red><A NAME="ref_64_26">Left</A></FONT>, <FONT COLOR=green><EM>-- aka: Button 1</EM></FONT> -- <FONT COLOR=red><A NAME="ref_65_26">Middle</A></FONT>, <FONT COLOR=green><EM>-- aka: Button 2</EM></FONT> -- <FONT COLOR=red><A NAME="ref_66_26">Right</A></FONT>, <FONT COLOR=green><EM>-- aka: Button 3</EM></FONT> -- <FONT COLOR=red><A NAME="ref_67_26">Button4</A></FONT>, <FONT COLOR=green><EM>-- aka: Button 4</EM></FONT> -- <FONT COLOR=red><A NAME="ref_68_26">Control</A></FONT>, <FONT COLOR=green><EM>-- Control Key</EM></FONT> -- <FONT COLOR=red><A NAME="ref_69_26">Shift</A></FONT>, <FONT COLOR=green><EM>-- Shift Key</EM></FONT> -- <FONT COLOR=red><A NAME="ref_70_26">Alt</A></FONT>); <FONT COLOR=green><EM>-- ALT Key</EM></FONT> -- -- <b>subtype</b> <FONT COLOR=red><A NAME="ref_72_12">Real_Buttons</A></FONT> <b>is</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_64_9">Mouse_Button</A> <b>range</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_64_26">Left</A> .. <A HREF="terminal_interface-curses-mouse__ads.htm#ref_67_26">Button4</A>; -- <b>subtype</b> <FONT COLOR=red><A NAME="ref_73_12">Modifier_Keys</A></FONT> <b>is</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_64_9">Mouse_Button</A> <b>range</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_68_26">Control</A> .. <A HREF="terminal_interface-curses-mouse__ads.htm#ref_70_26">Alt</A>; -- -- <b>type</b> <FONT COLOR=red><A NAME="ref_75_9">Button_State</A></FONT> <b>is</b> (<FONT COLOR=red><A NAME="ref_75_26">Released</A></FONT>, -- <FONT COLOR=red><A NAME="ref_76_26">Pressed</A></FONT>, -- <FONT COLOR=red><A NAME="ref_77_26">Clicked</A></FONT>, -- <FONT COLOR=red><A NAME="ref_78_26">Double_Clicked</A></FONT>, -- <FONT COLOR=red><A NAME="ref_79_26">Triple_Clicked</A></FONT>); -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page <A HREF="../man/curs_mouse.3x.html">curs_mouse.3x</A></EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- mouse_trafo, wmouse_trafo are implemented as Transform_Coordinates</EM></span> -+ <span class="comment"><EM>-- in the parent package.</EM></span> -+ <span class="comment"><EM>--</EM></span> -+ <span class="comment"><EM>-- Not implemented:</EM></span> -+ <span class="comment"><EM>-- REPORT_MOUSE_POSITION (i.e. as a parameter to Register_Reportable_Event</EM></span> -+ <span class="comment"><EM>-- or Start_Mouse)</EM></span> -+ <b>type</b> <span class="symbol"><A NAME="ref_60_9">Event_Mask</A></span> <b>is</b> <b>private</b>; -+ <span class="symbol"><A NAME="ref_61_4">No_Events</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A>; -+ <span class="symbol"><A NAME="ref_62_4">All_Events</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A>; -+ -+ <b>type</b> <span class="symbol"><A NAME="ref_64_9">Mouse_Button</A></span> <b>is</b> (<span class="symbol"><A NAME="ref_64_26">Left</A></span>, <span class="comment"><EM>-- aka: Button 1</EM></span> -+ <span class="symbol"><A NAME="ref_65_26">Middle</A></span>, <span class="comment"><EM>-- aka: Button 2</EM></span> -+ <span class="symbol"><A NAME="ref_66_26">Right</A></span>, <span class="comment"><EM>-- aka: Button 3</EM></span> -+ <span class="symbol"><A NAME="ref_67_26">Button4</A></span>, <span class="comment"><EM>-- aka: Button 4</EM></span> -+ <span class="symbol"><A NAME="ref_68_26">Control</A></span>, <span class="comment"><EM>-- Control Key</EM></span> -+ <span class="symbol"><A NAME="ref_69_26">Shift</A></span>, <span class="comment"><EM>-- Shift Key</EM></span> -+ <span class="symbol"><A NAME="ref_70_26">Alt</A></span>); <span class="comment"><EM>-- ALT Key</EM></span> -+ -+ <b>subtype</b> <span class="symbol"><A NAME="ref_72_12">Real_Buttons</A></span> <b>is</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_64_9">Mouse_Button</A> <b>range</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_64_26">Left</A> .. <A HREF="terminal_interface-curses-mouse__ads.htm#ref_67_26">Button4</A>; -+ <b>subtype</b> <span class="symbol"><A NAME="ref_73_12">Modifier_Keys</A></span> <b>is</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_64_9">Mouse_Button</A> <b>range</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_68_26">Control</A> .. <A HREF="terminal_interface-curses-mouse__ads.htm#ref_70_26">Alt</A>; -+ -+ <b>type</b> <span class="symbol"><A NAME="ref_75_9">Button_State</A></span> <b>is</b> (<span class="symbol"><A NAME="ref_75_26">Released</A></span>, -+ <span class="symbol"><A NAME="ref_76_26">Pressed</A></span>, -+ <span class="symbol"><A NAME="ref_77_26">Clicked</A></span>, -+ <span class="symbol"><A NAME="ref_78_26">Double_Clicked</A></span>, -+ <span class="symbol"><A NAME="ref_79_26">Triple_Clicked</A></span>); - - <b>type</b> Button_States <b>is</b> <b>array</b> (<A HREF="terminal_interface-curses-mouse__ads.htm#ref_75_9">Button_State</A>) <b>of</b> Boolean; - <b>pragma</b> Pack (Button_States); - -- <FONT COLOR=red><A NAME="ref_84_4">All_Clicks</A></FONT> : <b>constant</b> Button_States := (<A HREF="terminal_interface-curses-mouse__ads.htm#ref_77_26">Clicked</A> .. <A HREF="terminal_interface-curses-mouse__ads.htm#ref_79_26">Triple_Clicked</A> =&gt; True, -+ <span class="symbol"><A NAME="ref_84_4">All_Clicks</A></span> : <b>constant</b> Button_States := (<A HREF="terminal_interface-curses-mouse__ads.htm#ref_77_26">Clicked</A> .. <A HREF="terminal_interface-curses-mouse__ads.htm#ref_79_26">Triple_Clicked</A> =&gt; True, - <b>others</b> =&gt; False); -- <FONT COLOR=red><A NAME="ref_86_4">All_States</A></FONT> : <b>constant</b> Button_States := (<b>others</b> =&gt; True); -+ <span class="symbol"><A NAME="ref_86_4">All_States</A></span> : <b>constant</b> Button_States := (<b>others</b> =&gt; True); - -- <b>type</b> <FONT COLOR=red><A NAME="ref_88_9">Mouse_Event</A></FONT> <b>is</b> <b>private</b>; -+ <b>type</b> <span class="symbol"><A NAME="ref_88_9">Mouse_Event</A></span> <b>is</b> <b>private</b>; - -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page <A HREF="../man/curs_mouse.3x.html">curs_mouse.3x</A></EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- -- <b>function</b> <FONT COLOR=red><A NAME="ref_94_13" HREF="terminal_interface-curses-mouse__adb.htm#ref_50_13">Has_Mouse</A></FONT> <b>return</b> Boolean; -- <FONT COLOR=green><EM>-- Return true if a mouse device is supported, false otherwise.</EM></FONT> -- -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_97_14" HREF="terminal_interface-curses-mouse__adb.htm#ref_77_14">Register_Reportable_Event</A></FONT> -- (<FONT COLOR=red><A NAME="ref_98_7" HREF="terminal_interface-curses-mouse__adb.htm#ref_77_41">Button</A></FONT> : <A HREF="terminal_interface-curses-mouse__ads.htm#ref_64_9">Mouse_Button</A>; -- <FONT COLOR=red><A NAME="ref_99_7" HREF="terminal_interface-curses-mouse__adb.htm#ref_78_41">State</A></FONT> : <A HREF="terminal_interface-curses-mouse__ads.htm#ref_75_9">Button_State</A>; -- <FONT COLOR=red><A NAME="ref_100_7" HREF="terminal_interface-curses-mouse__adb.htm#ref_79_41">Mask</A></FONT> : <b>in</b> <b>out</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A>); -- <FONT COLOR=green><EM>-- Stores the event described by the button and the state in the mask.</EM></FONT> -- <FONT COLOR=green><EM>-- Before you call this the first time, you should initialize the mask</EM></FONT> -- <FONT COLOR=green><EM>-- with the Empty_Mask constant</EM></FONT> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page <A HREF="../man/curs_mouse.3x.html">curs_mouse.3x</A></EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ -+ <b>function</b> <span class="symbol"><A NAME="ref_94_13" HREF="terminal_interface-curses-mouse__adb.htm#ref_50_13">Has_Mouse</A></span> <b>return</b> Boolean; -+ <span class="comment"><EM>-- Return true if a mouse device is supported, false otherwise.</EM></span> -+ -+ <b>procedure</b> <span class="symbol"><A NAME="ref_97_14" HREF="terminal_interface-curses-mouse__adb.htm#ref_77_14">Register_Reportable_Event</A></span> -+ (<span class="symbol"><A NAME="ref_98_7" HREF="terminal_interface-curses-mouse__adb.htm#ref_77_41">Button</A></span> : <A HREF="terminal_interface-curses-mouse__ads.htm#ref_64_9">Mouse_Button</A>; -+ <span class="symbol"><A NAME="ref_99_7" HREF="terminal_interface-curses-mouse__adb.htm#ref_78_41">State</A></span> : <A HREF="terminal_interface-curses-mouse__ads.htm#ref_75_9">Button_State</A>; -+ <span class="symbol"><A NAME="ref_100_7" HREF="terminal_interface-curses-mouse__adb.htm#ref_79_41">Mask</A></span> : <b>in</b> <b>out</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A>); -+ <span class="comment"><EM>-- Stores the event described by the button and the state in the mask.</EM></span> -+ <span class="comment"><EM>-- Before you call this the first time, you should initialize the mask</EM></span> -+ <span class="comment"><EM>-- with the Empty_Mask constant</EM></span> - <b>pragma</b> Inline (<A HREF="terminal_interface-curses-mouse__ads.htm#ref_97_14">Register_Reportable_Event</A>); - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_106_14" HREF="terminal_interface-curses-mouse__adb.htm#ref_95_14">Register_Reportable_Events</A></FONT> -- (<FONT COLOR=red><A NAME="ref_107_7" HREF="terminal_interface-curses-mouse__adb.htm#ref_95_42">Button</A></FONT> : <A HREF="terminal_interface-curses-mouse__ads.htm#ref_64_9">Mouse_Button</A>; -- <FONT COLOR=red><A NAME="ref_108_7" HREF="terminal_interface-curses-mouse__adb.htm#ref_96_42">State</A></FONT> : Button_States; -- <FONT COLOR=red><A NAME="ref_109_7" HREF="terminal_interface-curses-mouse__adb.htm#ref_97_42">Mask</A></FONT> : <b>in</b> <b>out</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A>); -- <FONT COLOR=green><EM>-- Register all events described by the Button and the State bitmap.</EM></FONT> -- <FONT COLOR=green><EM>-- Before you call this the first time, you should initialize the mask</EM></FONT> -- <FONT COLOR=green><EM>-- with the Empty_Mask constant</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_1"#2|</EM></FONT> -- <FONT COLOR=green><EM>-- There is one difference to mousmask(): we return the value of the</EM></FONT> -- <FONT COLOR=green><EM>-- old mask, that means the event mask value before this call.</EM></FONT> -- <FONT COLOR=green><EM>-- Not Implemented: The library version</EM></FONT> -- <FONT COLOR=green><EM>-- returns a Mouse_Mask that tells which events are reported.</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_119_13" HREF="terminal_interface-curses-mouse__adb.htm#ref_107_13">Start_Mouse</A></FONT> (<FONT COLOR=red><A NAME="ref_119_26" HREF="terminal_interface-curses-mouse__adb.htm#ref_107_26">Mask</A></FONT> : <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A> := <A HREF="terminal_interface-curses-mouse__ads.htm#ref_62_4">All_Events</A>) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_106_14" HREF="terminal_interface-curses-mouse__adb.htm#ref_95_14">Register_Reportable_Events</A></span> -+ (<span class="symbol"><A NAME="ref_107_7" HREF="terminal_interface-curses-mouse__adb.htm#ref_95_42">Button</A></span> : <A HREF="terminal_interface-curses-mouse__ads.htm#ref_64_9">Mouse_Button</A>; -+ <span class="symbol"><A NAME="ref_108_7" HREF="terminal_interface-curses-mouse__adb.htm#ref_96_42">State</A></span> : Button_States; -+ <span class="symbol"><A NAME="ref_109_7" HREF="terminal_interface-curses-mouse__adb.htm#ref_97_42">Mask</A></span> : <b>in</b> <b>out</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A>); -+ <span class="comment"><EM>-- Register all events described by the Button and the State bitmap.</EM></span> -+ <span class="comment"><EM>-- Before you call this the first time, you should initialize the mask</EM></span> -+ <span class="comment"><EM>-- with the Empty_Mask constant</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_1"#2|</EM></span> -+ <span class="comment"><EM>-- There is one difference to mousmask(): we return the value of the</EM></span> -+ <span class="comment"><EM>-- old mask, that means the event mask value before this call.</EM></span> -+ <span class="comment"><EM>-- Not Implemented: The library version</EM></span> -+ <span class="comment"><EM>-- returns a Mouse_Mask that tells which events are reported.</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_119_13" HREF="terminal_interface-curses-mouse__adb.htm#ref_107_13">Start_Mouse</A></span> (<span class="symbol"><A NAME="ref_119_26" HREF="terminal_interface-curses-mouse__adb.htm#ref_107_26">Mask</A></span> : <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A> := <A HREF="terminal_interface-curses-mouse__ads.htm#ref_62_4">All_Events</A>) - <b>return</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A>; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_mouse.3x.html">mousemask()</A></EM></FONT> -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_mouse.3x.html">mousemask()</A></EM></span> - <b>pragma</b> Inline (<A HREF="terminal_interface-curses-mouse__ads.htm#ref_119_13">Start_Mouse</A>); - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_124_14" HREF="terminal_interface-curses-mouse__adb.htm#ref_123_14">End_Mouse</A></FONT> (<FONT COLOR=red><A NAME="ref_124_25" HREF="terminal_interface-curses-mouse__adb.htm#ref_123_25">Mask</A></FONT> : <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A> := <A HREF="terminal_interface-curses-mouse__ads.htm#ref_61_4">No_Events</A>); -- <FONT COLOR=green><EM>-- Terminates the mouse, restores the specified event mask</EM></FONT> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_124_14" HREF="terminal_interface-curses-mouse__adb.htm#ref_123_14">End_Mouse</A></span> (<span class="symbol"><A NAME="ref_124_25" HREF="terminal_interface-curses-mouse__adb.htm#ref_123_25">Mask</A></span> : <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A> := <A HREF="terminal_interface-curses-mouse__ads.htm#ref_61_4">No_Events</A>); -+ <span class="comment"><EM>-- Terminates the mouse, restores the specified event mask</EM></span> - <b>pragma</b> Inline (<A HREF="terminal_interface-curses-mouse__ads.htm#ref_124_14">End_Mouse</A>); - -- <FONT COLOR=green><EM>-- #1A NAME="AFU_2"#2|</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_129_13" HREF="terminal_interface-curses-mouse__adb.htm#ref_62_13">Get_Mouse</A></FONT> <b>return</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_88_9">Mouse_Event</A>; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_mouse.3x.html">getmouse()</A></EM></FONT> -+ <span class="comment"><EM>-- #1A NAME="AFU_2"#2|</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_129_13" HREF="terminal_interface-curses-mouse__adb.htm#ref_62_13">Get_Mouse</A></span> <b>return</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_88_9">Mouse_Event</A>; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_mouse.3x.html">getmouse()</A></EM></span> - <b>pragma</b> Inline (<A HREF="terminal_interface-curses-mouse__ads.htm#ref_129_13">Get_Mouse</A>); - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_133_14" HREF="terminal_interface-curses-mouse__adb.htm#ref_171_14">Get_Event</A></FONT> (<FONT COLOR=red><A NAME="ref_133_25" HREF="terminal_interface-curses-mouse__adb.htm#ref_171_25">Event</A></FONT> : <A HREF="terminal_interface-curses-mouse__ads.htm#ref_88_9">Mouse_Event</A>; -- <FONT COLOR=red><A NAME="ref_134_25" HREF="terminal_interface-curses-mouse__adb.htm#ref_172_25">Y</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_135_25" HREF="terminal_interface-curses-mouse__adb.htm#ref_173_25">X</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -- <FONT COLOR=red><A NAME="ref_136_25" HREF="terminal_interface-curses-mouse__adb.htm#ref_174_25">Button</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_64_9">Mouse_Button</A>; -- <FONT COLOR=red><A NAME="ref_137_25" HREF="terminal_interface-curses-mouse__adb.htm#ref_175_25">State</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_75_9">Button_State</A>); -- <FONT COLOR=green><EM>-- !!! Warning: X and Y are screen coordinates. Due to ripped of lines they</EM></FONT> -- <FONT COLOR=green><EM>-- may not be identical to window coordinates.</EM></FONT> -- <FONT COLOR=green><EM>-- Not Implemented: Get_Event only reports one event, the C library</EM></FONT> -- <FONT COLOR=green><EM>-- version supports multiple events, e.g. {click-1, click-3}</EM></FONT> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_133_14" HREF="terminal_interface-curses-mouse__adb.htm#ref_171_14">Get_Event</A></span> (<span class="symbol"><A NAME="ref_133_25" HREF="terminal_interface-curses-mouse__adb.htm#ref_171_25">Event</A></span> : <A HREF="terminal_interface-curses-mouse__ads.htm#ref_88_9">Mouse_Event</A>; -+ <span class="symbol"><A NAME="ref_134_25" HREF="terminal_interface-curses-mouse__adb.htm#ref_172_25">Y</A></span> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_135_25" HREF="terminal_interface-curses-mouse__adb.htm#ref_173_25">X</A></span> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -+ <span class="symbol"><A NAME="ref_136_25" HREF="terminal_interface-curses-mouse__adb.htm#ref_174_25">Button</A></span> : <b>out</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_64_9">Mouse_Button</A>; -+ <span class="symbol"><A NAME="ref_137_25" HREF="terminal_interface-curses-mouse__adb.htm#ref_175_25">State</A></span> : <b>out</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_75_9">Button_State</A>); -+ <span class="comment"><EM>-- !!! Warning: X and Y are screen coordinates. Due to ripped of lines they</EM></span> -+ <span class="comment"><EM>-- may not be identical to window coordinates.</EM></span> -+ <span class="comment"><EM>-- Not Implemented: Get_Event only reports one event, the C library</EM></span> -+ <span class="comment"><EM>-- version supports multiple events, e.g. {click-1, click-3}</EM></span> - <b>pragma</b> Inline (<A HREF="terminal_interface-curses-mouse__ads.htm#ref_133_14">Get_Event</A>); - -- <FONT COLOR=green><EM>-- #1A NAME="AFU_3"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_145_14" HREF="terminal_interface-curses-mouse__adb.htm#ref_184_14">Unget_Mouse</A></FONT> (<FONT COLOR=red><A NAME="ref_145_27" HREF="terminal_interface-curses-mouse__adb.htm#ref_184_27">Event</A></FONT> : <A HREF="terminal_interface-curses-mouse__ads.htm#ref_88_9">Mouse_Event</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_mouse.3x.html">ungetmouse()</A></EM></FONT> -+ <span class="comment"><EM>-- #1A NAME="AFU_3"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_145_14" HREF="terminal_interface-curses-mouse__adb.htm#ref_184_14">Unget_Mouse</A></span> (<span class="symbol"><A NAME="ref_145_27" HREF="terminal_interface-curses-mouse__adb.htm#ref_184_27">Event</A></span> : <A HREF="terminal_interface-curses-mouse__ads.htm#ref_88_9">Mouse_Event</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_mouse.3x.html">ungetmouse()</A></EM></span> - <b>pragma</b> Inline (<A HREF="terminal_interface-curses-mouse__ads.htm#ref_145_14">Unget_Mouse</A>); - -- <FONT COLOR=green><EM>-- #1A NAME="AFU_4"#2|</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_150_13" HREF="terminal_interface-curses-mouse__adb.htm#ref_194_13">Enclosed_In_Window</A></FONT> (<FONT COLOR=red><A NAME="ref_150_33" HREF="terminal_interface-curses-mouse__adb.htm#ref_194_33">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -- <FONT COLOR=red><A NAME="ref_151_33" HREF="terminal_interface-curses-mouse__adb.htm#ref_195_33">Event</A></FONT> : <A HREF="terminal_interface-curses-mouse__ads.htm#ref_88_9">Mouse_Event</A>) <b>return</b> Boolean; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_mouse.3x.html">wenclose()</A></EM></FONT> -- <FONT COLOR=green><EM>-- But : use event instead of screen coordinates.</EM></FONT> -+ <span class="comment"><EM>-- #1A NAME="AFU_4"#2|</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_150_13" HREF="terminal_interface-curses-mouse__adb.htm#ref_194_13">Enclosed_In_Window</A></span> (<span class="symbol"><A NAME="ref_150_33" HREF="terminal_interface-curses-mouse__adb.htm#ref_194_33">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; -+ <span class="symbol"><A NAME="ref_151_33" HREF="terminal_interface-curses-mouse__adb.htm#ref_195_33">Event</A></span> : <A HREF="terminal_interface-curses-mouse__ads.htm#ref_88_9">Mouse_Event</A>) <b>return</b> Boolean; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_mouse.3x.html">wenclose()</A></EM></span> -+ <span class="comment"><EM>-- But : use event instead of screen coordinates.</EM></span> - <b>pragma</b> Inline (<A HREF="terminal_interface-curses-mouse__ads.htm#ref_150_13">Enclosed_In_Window</A>); - -- <FONT COLOR=green><EM>-- #1A NAME="AFU_5"#2|</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_157_13" HREF="terminal_interface-curses-mouse__adb.htm#ref_209_13">Mouse_Interval</A></FONT> (<FONT COLOR=red><A NAME="ref_157_29" HREF="terminal_interface-curses-mouse__adb.htm#ref_209_29">Msec</A></FONT> : Natural := 200) <b>return</b> Natural; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_mouse.3x.html">mouseinterval()</A></EM></FONT> -+ <span class="comment"><EM>-- #1A NAME="AFU_5"#2|</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_157_13" HREF="terminal_interface-curses-mouse__adb.htm#ref_209_13">Mouse_Interval</A></span> (<span class="symbol"><A NAME="ref_157_29" HREF="terminal_interface-curses-mouse__adb.htm#ref_209_29">Msec</A></span> : Natural := 200) <b>return</b> Natural; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_mouse.3x.html">mouseinterval()</A></EM></span> - <b>pragma</b> Inline (<A HREF="terminal_interface-curses-mouse__ads.htm#ref_157_13">Mouse_Interval</A>); - - <b>private</b> -- <b>type</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A> <b>is</b> <b>new</b> <A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>.C.unsigned_long; -+ <b>type</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A> <b>is</b> <b>new</b> <A HREF="interfac__ads.htm#ref_36_9">Interfaces</A>.C.unsigned_long; - - <b>type</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_88_9">Mouse_Event</A> <b>is</b> - <b>record</b> -- <FONT COLOR=red><A NAME="ref_166_10">Id</A></FONT> : Integer <b>range</b> Integer (<A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>.C.short'First) .. -- Integer (<A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>.C.short'Last); -- <FONT COLOR=red><A NAME="ref_168_10">X</A></FONT>, <FONT COLOR=red><A NAME="ref_168_13">Y</A></FONT>, <FONT COLOR=red><A NAME="ref_168_16">Z</A></FONT> : Integer <b>range</b> Integer (<A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>.C.int'First) .. -- Integer (<A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>.C.int'Last); -- <FONT COLOR=red><A NAME="ref_170_10">Bstate</A></FONT> : <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A>; -+ <span class="symbol"><A NAME="ref_166_10">Id</A></span> : Integer <b>range</b> Integer (<A HREF="interfac__ads.htm#ref_36_9">Interfaces</A>.C.short'First) .. -+ Integer (<A HREF="interfac__ads.htm#ref_36_9">Interfaces</A>.C.short'Last); -+ <span class="symbol"><A NAME="ref_168_10">X</A></span>, <span class="symbol"><A NAME="ref_168_13">Y</A></span>, <span class="symbol"><A NAME="ref_168_16">Z</A></span> : Integer <b>range</b> Integer (<A HREF="interfac__ads.htm#ref_36_9">Interfaces</A>.C.int'First) .. -+ Integer (<A HREF="interfac__ads.htm#ref_36_9">Interfaces</A>.C.int'Last); -+ <span class="symbol"><A NAME="ref_170_10">Bstate</A></span> : <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A>; - <b>end</b> <b>record</b>; - <b>pragma</b> Convention (C, <A HREF="terminal_interface-curses-mouse__ads.htm#ref_88_9">Mouse_Event</A>); - -@@ -182,47 +194,47 @@ - <A HREF="terminal_interface-curses-mouse__ads.htm#ref_168_10">X</A> <b>at</b> 0 <b>range</b> 32 .. 63; - <A HREF="terminal_interface-curses-mouse__ads.htm#ref_168_13">Y</A> <b>at</b> 0 <b>range</b> 64 .. 95; - <A HREF="terminal_interface-curses-mouse__ads.htm#ref_168_16">Z</A> <b>at</b> 0 <b>range</b> 96 .. 127; -- <A HREF="terminal_interface-curses-mouse__ads.htm#ref_170_10">Bstate</A> <b>at</b> 0 <b>range</b> 128 .. 159; -+ <A HREF="terminal_interface-curses-mouse__ads.htm#ref_170_10">Bstate</A> <b>at</b> 0 <b>range</b> 128 .. 191; - <b>end</b> <b>record</b>; -- <FONT COLOR=green><EM>-- Please note: this rep. clause is generated and may be</EM></FONT> -- <FONT COLOR=green><EM>-- different on your system.</EM></FONT> -+ <span class="comment"><EM>-- Please note: this rep. clause is generated and may be</EM></span> -+ <span class="comment"><EM>-- different on your system.</EM></span> - -- <FONT COLOR=red><A NAME="ref_185_4">Generation_Bit_Order</A></FONT> : <b>constant</b> System.Bit_Order := System.Low_Order_First; -- <FONT COLOR=green><EM>-- This constant may be different on your system.</EM></FONT> -+ <span class="symbol"><A NAME="ref_185_4">Generation_Bit_Order</A></span> : <b>constant</b> System.Bit_Order := System.Low_Order_First; -+ <span class="comment"><EM>-- This constant may be different on your system.</EM></span> - -- <FONT COLOR=red><A NAME="ref_188_4">BUTTON1_RELEASED</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A> := 8#00000000001#; -- <FONT COLOR=red><A NAME="ref_189_4">BUTTON1_PRESSED</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A> := 8#00000000002#; -- <FONT COLOR=red><A NAME="ref_190_4">BUTTON1_CLICKED</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A> := 8#00000000004#; -- <FONT COLOR=red><A NAME="ref_191_4">BUTTON1_DOUBLE_CLICKED</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A> := 8#00000000010#; -- <FONT COLOR=red><A NAME="ref_192_4">BUTTON1_TRIPLE_CLICKED</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A> := 8#00000000020#; -- <FONT COLOR=red><A NAME="ref_193_4">BUTTON1_RESERVED_EVENT</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A> := 8#00000000040#; -- <FONT COLOR=red><A NAME="ref_194_4">BUTTON2_RELEASED</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A> := 8#00000000100#; -- <FONT COLOR=red><A NAME="ref_195_4">BUTTON2_PRESSED</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A> := 8#00000000200#; -- <FONT COLOR=red><A NAME="ref_196_4">BUTTON2_CLICKED</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A> := 8#00000000400#; -- <FONT COLOR=red><A NAME="ref_197_4">BUTTON2_DOUBLE_CLICKED</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A> := 8#00000001000#; -- <FONT COLOR=red><A NAME="ref_198_4">BUTTON2_TRIPLE_CLICKED</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A> := 8#00000002000#; -- <FONT COLOR=red><A NAME="ref_199_4">BUTTON2_RESERVED_EVENT</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A> := 8#00000004000#; -- <FONT COLOR=red><A NAME="ref_200_4">BUTTON3_RELEASED</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A> := 8#00000010000#; -- <FONT COLOR=red><A NAME="ref_201_4">BUTTON3_PRESSED</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A> := 8#00000020000#; -- <FONT COLOR=red><A NAME="ref_202_4">BUTTON3_CLICKED</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A> := 8#00000040000#; -- <FONT COLOR=red><A NAME="ref_203_4">BUTTON3_DOUBLE_CLICKED</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A> := 8#00000100000#; -- <FONT COLOR=red><A NAME="ref_204_4">BUTTON3_TRIPLE_CLICKED</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A> := 8#00000200000#; -- <FONT COLOR=red><A NAME="ref_205_4">BUTTON3_RESERVED_EVENT</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A> := 8#00000400000#; -- <FONT COLOR=red><A NAME="ref_206_4">BUTTON4_RELEASED</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A> := 8#00001000000#; -- <FONT COLOR=red><A NAME="ref_207_4">BUTTON4_PRESSED</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A> := 8#00002000000#; -- <FONT COLOR=red><A NAME="ref_208_4">BUTTON4_CLICKED</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A> := 8#00004000000#; -- <FONT COLOR=red><A NAME="ref_209_4">BUTTON4_DOUBLE_CLICKED</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A> := 8#00010000000#; -- <FONT COLOR=red><A NAME="ref_210_4">BUTTON4_TRIPLE_CLICKED</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A> := 8#00020000000#; -- <FONT COLOR=red><A NAME="ref_211_4">BUTTON4_RESERVED_EVENT</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A> := 8#00040000000#; -- <FONT COLOR=red><A NAME="ref_212_4">BUTTON_CTRL</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A> := 8#00100000000#; -- <FONT COLOR=red><A NAME="ref_213_4">BUTTON_SHIFT</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A> := 8#00200000000#; -- <FONT COLOR=red><A NAME="ref_214_4">BUTTON_ALT</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A> := 8#00400000000#; -- <FONT COLOR=red><A NAME="ref_215_4">REPORT_MOUSE_POSITION</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A> := 8#01000000000#; -- <FONT COLOR=red><A NAME="ref_216_4">ALL_MOUSE_EVENTS</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A> := 8#00777777777#; -- <FONT COLOR=red><A NAME="ref_217_4">BUTTON1_EVENTS</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A> := 8#00000000077#; -- <FONT COLOR=red><A NAME="ref_218_4">BUTTON2_EVENTS</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A> := 8#00000007700#; -- <FONT COLOR=red><A NAME="ref_219_4">BUTTON3_EVENTS</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A> := 8#00000770000#; -- <FONT COLOR=red><A NAME="ref_220_4">BUTTON4_EVENTS</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A> := 8#00077000000#; -+ <span class="symbol"><A NAME="ref_188_4">BUTTON1_RELEASED</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A> := 8#00000000001#; -+ <span class="symbol"><A NAME="ref_189_4">BUTTON1_PRESSED</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A> := 8#00000000002#; -+ <span class="symbol"><A NAME="ref_190_4">BUTTON1_CLICKED</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A> := 8#00000000004#; -+ <span class="symbol"><A NAME="ref_191_4">BUTTON1_DOUBLE_CLICKED</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A> := 8#00000000010#; -+ <span class="symbol"><A NAME="ref_192_4">BUTTON1_TRIPLE_CLICKED</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A> := 8#00000000020#; -+ <span class="symbol"><A NAME="ref_193_4">BUTTON1_RESERVED_EVENT</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A> := 8#00000000040#; -+ <span class="symbol"><A NAME="ref_194_4">BUTTON2_RELEASED</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A> := 8#00000000100#; -+ <span class="symbol"><A NAME="ref_195_4">BUTTON2_PRESSED</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A> := 8#00000000200#; -+ <span class="symbol"><A NAME="ref_196_4">BUTTON2_CLICKED</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A> := 8#00000000400#; -+ <span class="symbol"><A NAME="ref_197_4">BUTTON2_DOUBLE_CLICKED</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A> := 8#00000001000#; -+ <span class="symbol"><A NAME="ref_198_4">BUTTON2_TRIPLE_CLICKED</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A> := 8#00000002000#; -+ <span class="symbol"><A NAME="ref_199_4">BUTTON2_RESERVED_EVENT</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A> := 8#00000004000#; -+ <span class="symbol"><A NAME="ref_200_4">BUTTON3_RELEASED</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A> := 8#00000010000#; -+ <span class="symbol"><A NAME="ref_201_4">BUTTON3_PRESSED</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A> := 8#00000020000#; -+ <span class="symbol"><A NAME="ref_202_4">BUTTON3_CLICKED</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A> := 8#00000040000#; -+ <span class="symbol"><A NAME="ref_203_4">BUTTON3_DOUBLE_CLICKED</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A> := 8#00000100000#; -+ <span class="symbol"><A NAME="ref_204_4">BUTTON3_TRIPLE_CLICKED</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A> := 8#00000200000#; -+ <span class="symbol"><A NAME="ref_205_4">BUTTON3_RESERVED_EVENT</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A> := 8#00000400000#; -+ <span class="symbol"><A NAME="ref_206_4">BUTTON4_RELEASED</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A> := 8#00001000000#; -+ <span class="symbol"><A NAME="ref_207_4">BUTTON4_PRESSED</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A> := 8#00002000000#; -+ <span class="symbol"><A NAME="ref_208_4">BUTTON4_CLICKED</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A> := 8#00004000000#; -+ <span class="symbol"><A NAME="ref_209_4">BUTTON4_DOUBLE_CLICKED</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A> := 8#00010000000#; -+ <span class="symbol"><A NAME="ref_210_4">BUTTON4_TRIPLE_CLICKED</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A> := 8#00020000000#; -+ <span class="symbol"><A NAME="ref_211_4">BUTTON4_RESERVED_EVENT</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A> := 8#00040000000#; -+ <span class="symbol"><A NAME="ref_212_4">BUTTON_CTRL</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A> := 8#00100000000#; -+ <span class="symbol"><A NAME="ref_213_4">BUTTON_SHIFT</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A> := 8#00200000000#; -+ <span class="symbol"><A NAME="ref_214_4">BUTTON_ALT</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A> := 8#00400000000#; -+ <span class="symbol"><A NAME="ref_215_4">REPORT_MOUSE_POSITION</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A> := 8#01000000000#; -+ <span class="symbol"><A NAME="ref_216_4">ALL_MOUSE_EVENTS</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A> := 8#00777777777#; -+ <span class="symbol"><A NAME="ref_217_4">BUTTON1_EVENTS</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A> := 8#00000000077#; -+ <span class="symbol"><A NAME="ref_218_4">BUTTON2_EVENTS</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A> := 8#00000007700#; -+ <span class="symbol"><A NAME="ref_219_4">BUTTON3_EVENTS</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A> := 8#00000770000#; -+ <span class="symbol"><A NAME="ref_220_4">BUTTON4_EVENTS</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A> := 8#00077000000#; - - <A HREF="terminal_interface-curses-mouse__ads.htm#ref_61_4">No_Events</A> : <b>constant</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A> := 0; - <A HREF="terminal_interface-curses-mouse__ads.htm#ref_62_4">All_Events</A> : <b>constant</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Event_Mask</A> := <A HREF="terminal_interface-curses-mouse__ads.htm#ref_216_4">ALL_MOUSE_EVENTS</A>; -diff -Naur ncurses-5.9/doc/html/ada/terminal_interface-curses-panels__adb.htm ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-panels__adb.htm ---- ncurses-5.9/doc/html/ada/terminal_interface-curses-panels__adb.htm 2011-02-26 00:43:50.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-panels__adb.htm 2014-09-01 16:33:22.296792023 +0200 -@@ -1,62 +1,74 @@ --<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> --<HTML><HEAD><TITLE>terminal_interface-curses-panels.adb</TITLE></HEAD> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> -+<HTML> -+<HEAD> -+<TITLE>terminal_interface-curses-panels.adb</TITLE> -+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> -+<style type="text/css"> -+*.comment { -+ color: green; -+} -+*.symbol { -+ color: red; -+} -+</style> -+</HEAD> - <BODY> --<HR><DIV ALIGN="center"><H1> File : terminal_interface-curses-panels.adb </H1></DIV><HR> -+<HR><DIV style="text-align:center"><H1> File : terminal_interface-curses-panels.adb </H1></DIV><HR> - <PRE> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Terminal_Interface.Curses.Panels --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- B O D Y --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Copyright (c) 1998-2004,2009 Free Software Foundation, Inc. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></FONT> --<FONT COLOR=green><EM>-- copy of this software and associated documentation files (the --</EM></FONT> --<FONT COLOR=green><EM>-- "Software"), to deal in the Software without restriction, including --</EM></FONT> --<FONT COLOR=green><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></FONT> --<FONT COLOR=green><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></FONT> --<FONT COLOR=green><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></FONT> --<FONT COLOR=green><EM>-- furnished to do so, subject to the following conditions: --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- The above copyright notice and this permission notice shall be included --</EM></FONT> --<FONT COLOR=green><EM>-- in all copies or substantial portions of the Software. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></FONT> --<FONT COLOR=green><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></FONT> --<FONT COLOR=green><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></FONT> --<FONT COLOR=green><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></FONT> --<FONT COLOR=green><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></FONT> --<FONT COLOR=green><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></FONT> --<FONT COLOR=green><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></FONT> --<FONT COLOR=green><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></FONT> --<FONT COLOR=green><EM>-- sale, use or other dealings in this Software without prior written --</EM></FONT> --<FONT COLOR=green><EM>-- authorization. --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Author: Juergen Pfeifer, 1996</EM></FONT> --<FONT COLOR=green><EM>-- Version Control:</EM></FONT> --<FONT COLOR=green><EM>-- @Revision: 1.14 @</EM></FONT> --<FONT COLOR=green><EM>-- @Date: 2009/12/26 17:38:58 @</EM></FONT> --<FONT COLOR=green><EM>-- Binding Version 01.00</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Terminal_Interface.Curses.Panels --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- B O D Y --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Copyright (c) 1998-2004,2009 Free Software Foundation, Inc. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></span> -+<span class="comment"><EM>-- copy of this software and associated documentation files (the --</EM></span> -+<span class="comment"><EM>-- "Software"), to deal in the Software without restriction, including --</EM></span> -+<span class="comment"><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></span> -+<span class="comment"><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></span> -+<span class="comment"><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></span> -+<span class="comment"><EM>-- furnished to do so, subject to the following conditions: --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- The above copyright notice and this permission notice shall be included --</EM></span> -+<span class="comment"><EM>-- in all copies or substantial portions of the Software. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></span> -+<span class="comment"><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></span> -+<span class="comment"><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></span> -+<span class="comment"><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></span> -+<span class="comment"><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></span> -+<span class="comment"><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></span> -+<span class="comment"><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></span> -+<span class="comment"><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></span> -+<span class="comment"><EM>-- sale, use or other dealings in this Software without prior written --</EM></span> -+<span class="comment"><EM>-- authorization. --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Author: Juergen Pfeifer, 1996</EM></span> -+<span class="comment"><EM>-- Version Control:</EM></span> -+<span class="comment"><EM>-- @Revision: 1.14 @</EM></span> -+<span class="comment"><EM>-- @Date: 2009/12/26 17:38:58 @</EM></span> -+<span class="comment"><EM>-- Binding Version 01.00</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> - <b>with</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-aux__ads.htm#ref_50_35">Aux</A>; <b>use</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-aux__ads.htm#ref_50_35">Aux</A>; --<b>with</b> <A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>.C; -+<b>with</b> <A HREF="interfac__ads.htm#ref_36_9">Interfaces</A>.C; - --<b>package</b> <b>body</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<FONT COLOR=red><A NAME="ref_45_40" HREF="terminal_interface-curses-panels__ads.htm#ref_44_35">Panels</A></FONT> <b>is</b> -+<b>package</b> <b>body</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<span class="symbol"><A NAME="ref_45_40" HREF="terminal_interface-curses-panels__ads.htm#ref_44_35">Panels</A></span> <b>is</b> - -- <b>use</b> <b>type</b> <A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>.C.int; -+ <b>use</b> <b>type</b> <A HREF="interfac__ads.htm#ref_36_9">Interfaces</A>.C.int; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_49_13" HREF="terminal_interface-curses-panels__ads.htm#ref_67_13">Create</A></FONT> (<FONT COLOR=red><A NAME="ref_49_21" HREF="terminal_interface-curses-panels__ads.htm#ref_67_21">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-panels__ads.htm#ref_49_9">Panel</A> -+ <b>function</b> <span class="symbol"><A NAME="ref_49_13" HREF="terminal_interface-curses-panels__ads.htm#ref_67_13">Create</A></span> (<span class="symbol"><A NAME="ref_49_21" HREF="terminal_interface-curses-panels__ads.htm#ref_67_21">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-panels__ads.htm#ref_49_9">Panel</A> - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_51_16">Newpanel</A></FONT> (<FONT COLOR=red><A NAME="ref_51_26" HREF="terminal_interface-curses-panels__adb.htm#ref_51_16">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-panels__ads.htm#ref_49_9">Panel</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_51_16">Newpanel</A></span> (<span class="symbol"><A NAME="ref_51_26" HREF="terminal_interface-curses-panels__adb.htm#ref_51_16">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-panels__ads.htm#ref_49_9">Panel</A>; - <b>pragma</b> Import (C, Newpanel, "new_panel"); - -- <FONT COLOR=red><A NAME="ref_54_7">Pan</A></FONT> : <A HREF="terminal_interface-curses-panels__ads.htm#ref_49_9">Panel</A>; -+ <span class="symbol"><A NAME="ref_54_7">Pan</A></span> : <A HREF="terminal_interface-curses-panels__ads.htm#ref_49_9">Panel</A>; - <b>begin</b> - <A HREF="terminal_interface-curses-panels__adb.htm#ref_54_7">Pan</A> := <A HREF="terminal_interface-curses-panels__adb.htm#ref_51_16">Newpanel</A> (<A HREF="terminal_interface-curses-panels__ads.htm#ref_67_21">Win</A>); - <b>if</b> <A HREF="terminal_interface-curses-panels__adb.htm#ref_54_7">Pan</A> = <A HREF="terminal_interface-curses-panels__ads.htm#ref_54_4">Null_Panel</A> <b>then</b> -@@ -65,9 +77,9 @@ - <b>return</b> <A HREF="terminal_interface-curses-panels__adb.htm#ref_54_7">Pan</A>; - <b>end</b> <A HREF="terminal_interface-curses-panels__ads.htm#ref_67_13">Create</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_63_14" HREF="terminal_interface-curses-panels__ads.htm#ref_77_14">Bottom</A></FONT> (<FONT COLOR=red><A NAME="ref_63_22" HREF="terminal_interface-curses-panels__ads.htm#ref_77_22">Pan</A></FONT> : <A HREF="terminal_interface-curses-panels__ads.htm#ref_49_9">Panel</A>) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_63_14" HREF="terminal_interface-curses-panels__ads.htm#ref_77_14">Bottom</A></span> (<span class="symbol"><A NAME="ref_63_22" HREF="terminal_interface-curses-panels__ads.htm#ref_77_22">Pan</A></span> : <A HREF="terminal_interface-curses-panels__ads.htm#ref_49_9">Panel</A>) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_65_16">Bottompanel</A></FONT> (<FONT COLOR=red><A NAME="ref_65_29" HREF="terminal_interface-curses-panels__adb.htm#ref_65_16">Pan</A></FONT> : <A HREF="terminal_interface-curses-panels__ads.htm#ref_49_9">Panel</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_65_16">Bottompanel</A></span> (<span class="symbol"><A NAME="ref_65_29" HREF="terminal_interface-curses-panels__adb.htm#ref_65_16">Pan</A></span> : <A HREF="terminal_interface-curses-panels__ads.htm#ref_49_9">Panel</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Bottompanel, "bottom_panel"); - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses-panels__adb.htm#ref_65_16">Bottompanel</A> (<A HREF="terminal_interface-curses-panels__ads.htm#ref_77_22">Pan</A>) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -@@ -75,9 +87,9 @@ - <b>end</b> <b>if</b>; - <b>end</b> <A HREF="terminal_interface-curses-panels__ads.htm#ref_77_14">Bottom</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_73_14" HREF="terminal_interface-curses-panels__ads.htm#ref_82_14">Top</A></FONT> (<FONT COLOR=red><A NAME="ref_73_19" HREF="terminal_interface-curses-panels__ads.htm#ref_82_19">Pan</A></FONT> : <A HREF="terminal_interface-curses-panels__ads.htm#ref_49_9">Panel</A>) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_73_14" HREF="terminal_interface-curses-panels__ads.htm#ref_82_14">Top</A></span> (<span class="symbol"><A NAME="ref_73_19" HREF="terminal_interface-curses-panels__ads.htm#ref_82_19">Pan</A></span> : <A HREF="terminal_interface-curses-panels__ads.htm#ref_49_9">Panel</A>) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_75_16">Toppanel</A></FONT> (<FONT COLOR=red><A NAME="ref_75_26" HREF="terminal_interface-curses-panels__adb.htm#ref_75_16">Pan</A></FONT> : <A HREF="terminal_interface-curses-panels__ads.htm#ref_49_9">Panel</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_75_16">Toppanel</A></span> (<span class="symbol"><A NAME="ref_75_26" HREF="terminal_interface-curses-panels__adb.htm#ref_75_16">Pan</A></span> : <A HREF="terminal_interface-curses-panels__ads.htm#ref_49_9">Panel</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Toppanel, "top_panel"); - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses-panels__adb.htm#ref_75_16">Toppanel</A> (<A HREF="terminal_interface-curses-panels__ads.htm#ref_82_19">Pan</A>) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -@@ -85,9 +97,9 @@ - <b>end</b> <b>if</b>; - <b>end</b> <A HREF="terminal_interface-curses-panels__ads.htm#ref_82_14">Top</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_83_14" HREF="terminal_interface-curses-panels__ads.htm#ref_87_14">Show</A></FONT> (<FONT COLOR=red><A NAME="ref_83_20" HREF="terminal_interface-curses-panels__ads.htm#ref_87_20">Pan</A></FONT> : <A HREF="terminal_interface-curses-panels__ads.htm#ref_49_9">Panel</A>) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_83_14" HREF="terminal_interface-curses-panels__ads.htm#ref_87_14">Show</A></span> (<span class="symbol"><A NAME="ref_83_20" HREF="terminal_interface-curses-panels__ads.htm#ref_87_20">Pan</A></span> : <A HREF="terminal_interface-curses-panels__ads.htm#ref_49_9">Panel</A>) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_85_16">Showpanel</A></FONT> (<FONT COLOR=red><A NAME="ref_85_27" HREF="terminal_interface-curses-panels__adb.htm#ref_85_16">Pan</A></FONT> : <A HREF="terminal_interface-curses-panels__ads.htm#ref_49_9">Panel</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_85_16">Showpanel</A></span> (<span class="symbol"><A NAME="ref_85_27" HREF="terminal_interface-curses-panels__adb.htm#ref_85_16">Pan</A></span> : <A HREF="terminal_interface-curses-panels__ads.htm#ref_49_9">Panel</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Showpanel, "show_panel"); - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses-panels__adb.htm#ref_85_16">Showpanel</A> (<A HREF="terminal_interface-curses-panels__ads.htm#ref_87_20">Pan</A>) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -@@ -95,9 +107,9 @@ - <b>end</b> <b>if</b>; - <b>end</b> <A HREF="terminal_interface-curses-panels__ads.htm#ref_87_14">Show</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_93_14" HREF="terminal_interface-curses-panels__ads.htm#ref_97_14">Hide</A></FONT> (<FONT COLOR=red><A NAME="ref_93_20" HREF="terminal_interface-curses-panels__ads.htm#ref_97_20">Pan</A></FONT> : <A HREF="terminal_interface-curses-panels__ads.htm#ref_49_9">Panel</A>) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_93_14" HREF="terminal_interface-curses-panels__ads.htm#ref_97_14">Hide</A></span> (<span class="symbol"><A NAME="ref_93_20" HREF="terminal_interface-curses-panels__ads.htm#ref_97_20">Pan</A></span> : <A HREF="terminal_interface-curses-panels__ads.htm#ref_49_9">Panel</A>) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_95_16">Hidepanel</A></FONT> (<FONT COLOR=red><A NAME="ref_95_27" HREF="terminal_interface-curses-panels__adb.htm#ref_95_16">Pan</A></FONT> : <A HREF="terminal_interface-curses-panels__ads.htm#ref_49_9">Panel</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_95_16">Hidepanel</A></span> (<span class="symbol"><A NAME="ref_95_27" HREF="terminal_interface-curses-panels__adb.htm#ref_95_16">Pan</A></span> : <A HREF="terminal_interface-curses-panels__ads.htm#ref_49_9">Panel</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Hidepanel, "hide_panel"); - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses-panels__adb.htm#ref_95_16">Hidepanel</A> (<A HREF="terminal_interface-curses-panels__ads.htm#ref_97_20">Pan</A>) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -@@ -105,12 +117,12 @@ - <b>end</b> <b>if</b>; - <b>end</b> <A HREF="terminal_interface-curses-panels__ads.htm#ref_97_14">Hide</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_103_13" HREF="terminal_interface-curses-panels__ads.htm#ref_102_13">Get_Window</A></FONT> (<FONT COLOR=red><A NAME="ref_103_25" HREF="terminal_interface-curses-panels__ads.htm#ref_102_25">Pan</A></FONT> : <A HREF="terminal_interface-curses-panels__ads.htm#ref_49_9">Panel</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> -+ <b>function</b> <span class="symbol"><A NAME="ref_103_13" HREF="terminal_interface-curses-panels__ads.htm#ref_102_13">Get_Window</A></span> (<span class="symbol"><A NAME="ref_103_25" HREF="terminal_interface-curses-panels__ads.htm#ref_102_25">Pan</A></span> : <A HREF="terminal_interface-curses-panels__ads.htm#ref_49_9">Panel</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_105_16">Panel_Win</A></FONT> (<FONT COLOR=red><A NAME="ref_105_27" HREF="terminal_interface-curses-panels__adb.htm#ref_105_16">Pan</A></FONT> : <A HREF="terminal_interface-curses-panels__ads.htm#ref_49_9">Panel</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_105_16">Panel_Win</A></span> (<span class="symbol"><A NAME="ref_105_27" HREF="terminal_interface-curses-panels__adb.htm#ref_105_16">Pan</A></span> : <A HREF="terminal_interface-curses-panels__ads.htm#ref_49_9">Panel</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; - <b>pragma</b> Import (C, Panel_Win, "panel_window"); - -- <FONT COLOR=red><A NAME="ref_108_7">Win</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses-panels__adb.htm#ref_105_16">Panel_Win</A> (<A HREF="terminal_interface-curses-panels__ads.htm#ref_102_25">Pan</A>); -+ <span class="symbol"><A NAME="ref_108_7">Win</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses-panels__adb.htm#ref_105_16">Panel_Win</A> (<A HREF="terminal_interface-curses-panels__ads.htm#ref_102_25">Pan</A>); - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses-panels__adb.htm#ref_108_7">Win</A> = <A HREF="terminal_interface-curses__ads.htm#ref_58_4">Null_Window</A> <b>then</b> - <b>raise</b> <A HREF="terminal_interface-curses-panels__ads.htm#ref_60_4">Panel_Exception</A>; -@@ -118,11 +130,11 @@ - <b>return</b> <A HREF="terminal_interface-curses-panels__adb.htm#ref_108_7">Win</A>; - <b>end</b> <A HREF="terminal_interface-curses-panels__ads.htm#ref_102_13">Get_Window</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_116_14" HREF="terminal_interface-curses-panels__ads.htm#ref_111_14">Replace</A></FONT> (<FONT COLOR=red><A NAME="ref_116_23" HREF="terminal_interface-curses-panels__ads.htm#ref_111_23">Pan</A></FONT> : <A HREF="terminal_interface-curses-panels__ads.htm#ref_49_9">Panel</A>; -- <FONT COLOR=red><A NAME="ref_117_23" HREF="terminal_interface-curses-panels__ads.htm#ref_112_23">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_116_14" HREF="terminal_interface-curses-panels__ads.htm#ref_111_14">Replace</A></span> (<span class="symbol"><A NAME="ref_116_23" HREF="terminal_interface-curses-panels__ads.htm#ref_111_23">Pan</A></span> : <A HREF="terminal_interface-curses-panels__ads.htm#ref_49_9">Panel</A>; -+ <span class="symbol"><A NAME="ref_117_23" HREF="terminal_interface-curses-panels__ads.htm#ref_112_23">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_119_16">Replace_Pan</A></FONT> (<FONT COLOR=red><A NAME="ref_119_29" HREF="terminal_interface-curses-panels__adb.htm#ref_119_16">Pan</A></FONT> : <A HREF="terminal_interface-curses-panels__ads.htm#ref_49_9">Panel</A>; -- <FONT COLOR=red><A NAME="ref_120_29" HREF="terminal_interface-curses-panels__adb.htm#ref_119_16">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_119_16">Replace_Pan</A></span> (<span class="symbol"><A NAME="ref_119_29" HREF="terminal_interface-curses-panels__adb.htm#ref_119_16">Pan</A></span> : <A HREF="terminal_interface-curses-panels__ads.htm#ref_49_9">Panel</A>; -+ <span class="symbol"><A NAME="ref_120_29" HREF="terminal_interface-curses-panels__adb.htm#ref_119_16">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Replace_Pan, "replace_panel"); - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses-panels__adb.htm#ref_119_16">Replace_Pan</A> (<A HREF="terminal_interface-curses-panels__ads.htm#ref_111_23">Pan</A>, <A HREF="terminal_interface-curses-panels__ads.htm#ref_112_23">Win</A>) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -@@ -130,13 +142,13 @@ - <b>end</b> <b>if</b>; - <b>end</b> <A HREF="terminal_interface-curses-panels__ads.htm#ref_111_14">Replace</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_128_14" HREF="terminal_interface-curses-panels__ads.htm#ref_117_14">Move</A></FONT> (<FONT COLOR=red><A NAME="ref_128_20" HREF="terminal_interface-curses-panels__ads.htm#ref_117_20">Pan</A></FONT> : <A HREF="terminal_interface-curses-panels__ads.htm#ref_49_9">Panel</A>; -- <FONT COLOR=red><A NAME="ref_129_20" HREF="terminal_interface-curses-panels__ads.htm#ref_118_20">Line</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_130_20" HREF="terminal_interface-curses-panels__ads.htm#ref_119_20">Column</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>) -- <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_132_16">Move</A></FONT> (<FONT COLOR=red><A NAME="ref_132_22" HREF="terminal_interface-curses-panels__adb.htm#ref_132_16">Pan</A></FONT> : <A HREF="terminal_interface-curses-panels__ads.htm#ref_49_9">Panel</A>; -- <FONT COLOR=red><A NAME="ref_133_22" HREF="terminal_interface-curses-panels__adb.htm#ref_132_16">Line</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -- <FONT COLOR=red><A NAME="ref_134_22" HREF="terminal_interface-curses-panels__adb.htm#ref_132_16">Column</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>procedure</b> <span class="symbol"><A NAME="ref_128_14" HREF="terminal_interface-curses-panels__ads.htm#ref_117_14">Move</A></span> (<span class="symbol"><A NAME="ref_128_20" HREF="terminal_interface-curses-panels__ads.htm#ref_117_20">Pan</A></span> : <A HREF="terminal_interface-curses-panels__ads.htm#ref_49_9">Panel</A>; -+ <span class="symbol"><A NAME="ref_129_20" HREF="terminal_interface-curses-panels__ads.htm#ref_118_20">Line</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_130_20" HREF="terminal_interface-curses-panels__ads.htm#ref_119_20">Column</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>) -+ <b>is</b> -+ <b>function</b> <span class="symbol"><A NAME="ref_132_16">Move</A></span> (<span class="symbol"><A NAME="ref_132_22" HREF="terminal_interface-curses-panels__adb.htm#ref_132_16">Pan</A></span> : <A HREF="terminal_interface-curses-panels__ads.htm#ref_49_9">Panel</A>; -+ <span class="symbol"><A NAME="ref_133_22" HREF="terminal_interface-curses-panels__adb.htm#ref_132_16">Line</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <span class="symbol"><A NAME="ref_134_22" HREF="terminal_interface-curses-panels__adb.htm#ref_132_16">Column</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Move, "move_panel"); - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses-panels__adb.htm#ref_132_16">Move</A> (<A HREF="terminal_interface-curses-panels__ads.htm#ref_117_20">Pan</A>, <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses-panels__ads.htm#ref_118_20">Line</A>), <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses-panels__ads.htm#ref_119_20">Column</A>)) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -@@ -144,9 +156,9 @@ - <b>end</b> <b>if</b>; - <b>end</b> <A HREF="terminal_interface-curses-panels__ads.htm#ref_117_14">Move</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_142_13" HREF="terminal_interface-curses-panels__ads.htm#ref_124_13">Is_Hidden</A></FONT> (<FONT COLOR=red><A NAME="ref_142_24" HREF="terminal_interface-curses-panels__ads.htm#ref_124_24">Pan</A></FONT> : <A HREF="terminal_interface-curses-panels__ads.htm#ref_49_9">Panel</A>) <b>return</b> Boolean -+ <b>function</b> <span class="symbol"><A NAME="ref_142_13" HREF="terminal_interface-curses-panels__ads.htm#ref_124_13">Is_Hidden</A></span> (<span class="symbol"><A NAME="ref_142_24" HREF="terminal_interface-curses-panels__ads.htm#ref_124_24">Pan</A></span> : <A HREF="terminal_interface-curses-panels__ads.htm#ref_49_9">Panel</A>) <b>return</b> Boolean - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_144_16">Panel_Hidden</A></FONT> (<FONT COLOR=red><A NAME="ref_144_30" HREF="terminal_interface-curses-panels__adb.htm#ref_144_16">Pan</A></FONT> : <A HREF="terminal_interface-curses-panels__ads.htm#ref_49_9">Panel</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_144_16">Panel_Hidden</A></span> (<span class="symbol"><A NAME="ref_144_30" HREF="terminal_interface-curses-panels__adb.htm#ref_144_16">Pan</A></span> : <A HREF="terminal_interface-curses-panels__ads.htm#ref_49_9">Panel</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Panel_Hidden, "panel_hidden"); - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses-panels__adb.htm#ref_144_16">Panel_Hidden</A> (<A HREF="terminal_interface-curses-panels__ads.htm#ref_124_24">Pan</A>) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_75_4">Curses_False</A> <b>then</b> -@@ -156,9 +168,9 @@ - <b>end</b> <b>if</b>; - <b>end</b> <A HREF="terminal_interface-curses-panels__ads.htm#ref_124_13">Is_Hidden</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_154_14" HREF="terminal_interface-curses-panels__ads.htm#ref_139_14">Delete</A></FONT> (<FONT COLOR=red><A NAME="ref_154_22" HREF="terminal_interface-curses-panels__ads.htm#ref_139_22">Pan</A></FONT> : <b>in</b> <b>out</b> <A HREF="terminal_interface-curses-panels__ads.htm#ref_49_9">Panel</A>) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_154_14" HREF="terminal_interface-curses-panels__ads.htm#ref_139_14">Delete</A></span> (<span class="symbol"><A NAME="ref_154_22" HREF="terminal_interface-curses-panels__ads.htm#ref_139_22">Pan</A></span> : <b>in</b> <b>out</b> <A HREF="terminal_interface-curses-panels__ads.htm#ref_49_9">Panel</A>) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_156_16">Del_Panel</A></FONT> (<FONT COLOR=red><A NAME="ref_156_27" HREF="terminal_interface-curses-panels__adb.htm#ref_156_16">Pan</A></FONT> : <A HREF="terminal_interface-curses-panels__ads.htm#ref_49_9">Panel</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_156_16">Del_Panel</A></span> (<span class="symbol"><A NAME="ref_156_27" HREF="terminal_interface-curses-panels__adb.htm#ref_156_16">Pan</A></span> : <A HREF="terminal_interface-curses-panels__ads.htm#ref_49_9">Panel</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Del_Panel, "del_panel"); - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses-panels__adb.htm#ref_156_16">Del_Panel</A> (<A HREF="terminal_interface-curses-panels__ads.htm#ref_139_22">Pan</A>) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -diff -Naur ncurses-5.9/doc/html/ada/terminal_interface-curses-panels__ads.htm ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-panels__ads.htm ---- ncurses-5.9/doc/html/ada/terminal_interface-curses-panels__ads.htm 2010-05-29 23:56:06.000000000 +0200 -+++ ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-panels__ads.htm 2014-09-01 16:33:22.296792023 +0200 -@@ -1,148 +1,160 @@ --<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> --<HTML><HEAD><TITLE>terminal_interface-curses-panels.ads</TITLE></HEAD> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> -+<HTML> -+<HEAD> -+<TITLE>terminal_interface-curses-panels.ads</TITLE> -+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> -+<style type="text/css"> -+*.comment { -+ color: green; -+} -+*.symbol { -+ color: red; -+} -+</style> -+</HEAD> - <BODY> --<HR><DIV ALIGN="center"><H1> File : terminal_interface-curses-panels.ads </H1></DIV><HR> -+<HR><DIV style="text-align:center"><H1> File : terminal_interface-curses-panels.ads </H1></DIV><HR> - <PRE> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Terminal_Interface.Curses.Panels --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- S P E C --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Copyright (c) 1998-2006,2009 Free Software Foundation, Inc. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></FONT> --<FONT COLOR=green><EM>-- copy of this software and associated documentation files (the --</EM></FONT> --<FONT COLOR=green><EM>-- "Software"), to deal in the Software without restriction, including --</EM></FONT> --<FONT COLOR=green><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></FONT> --<FONT COLOR=green><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></FONT> --<FONT COLOR=green><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></FONT> --<FONT COLOR=green><EM>-- furnished to do so, subject to the following conditions: --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- The above copyright notice and this permission notice shall be included --</EM></FONT> --<FONT COLOR=green><EM>-- in all copies or substantial portions of the Software. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></FONT> --<FONT COLOR=green><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></FONT> --<FONT COLOR=green><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></FONT> --<FONT COLOR=green><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></FONT> --<FONT COLOR=green><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></FONT> --<FONT COLOR=green><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></FONT> --<FONT COLOR=green><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></FONT> --<FONT COLOR=green><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></FONT> --<FONT COLOR=green><EM>-- sale, use or other dealings in this Software without prior written --</EM></FONT> --<FONT COLOR=green><EM>-- authorization. --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Author: Juergen Pfeifer, 1996</EM></FONT> --<FONT COLOR=green><EM>-- Version Control:</EM></FONT> --<FONT COLOR=green><EM>-- @Revision: 1.20 @</EM></FONT> --<FONT COLOR=green><EM>-- @Date: 2009/12/26 17:38:58 @</EM></FONT> --<FONT COLOR=green><EM>-- Binding Version 01.00</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Terminal_Interface.Curses.Panels --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- S P E C --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Copyright (c) 1998-2006,2009 Free Software Foundation, Inc. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></span> -+<span class="comment"><EM>-- copy of this software and associated documentation files (the --</EM></span> -+<span class="comment"><EM>-- "Software"), to deal in the Software without restriction, including --</EM></span> -+<span class="comment"><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></span> -+<span class="comment"><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></span> -+<span class="comment"><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></span> -+<span class="comment"><EM>-- furnished to do so, subject to the following conditions: --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- The above copyright notice and this permission notice shall be included --</EM></span> -+<span class="comment"><EM>-- in all copies or substantial portions of the Software. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></span> -+<span class="comment"><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></span> -+<span class="comment"><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></span> -+<span class="comment"><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></span> -+<span class="comment"><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></span> -+<span class="comment"><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></span> -+<span class="comment"><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></span> -+<span class="comment"><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></span> -+<span class="comment"><EM>-- sale, use or other dealings in this Software without prior written --</EM></span> -+<span class="comment"><EM>-- authorization. --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Author: Juergen Pfeifer, 1996</EM></span> -+<span class="comment"><EM>-- Version Control:</EM></span> -+<span class="comment"><EM>-- @Revision: 1.20 @</EM></span> -+<span class="comment"><EM>-- @Date: 2009/12/26 17:38:58 @</EM></span> -+<span class="comment"><EM>-- Binding Version 01.00</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> - <b>with</b> System; - --<b>package</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<FONT COLOR=red><A NAME="ref_44_35" HREF="terminal_interface-curses-panels__adb.htm#ref_45_40">Panels</A></FONT> <b>is</b> -+<b>package</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<span class="symbol"><A NAME="ref_44_35" HREF="terminal_interface-curses-panels__adb.htm#ref_45_40">Panels</A></span> <b>is</b> - <b>pragma</b> Preelaborate (<A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-panels__ads.htm#ref_44_35">Panels</A>); - <b>pragma</b> Linker_Options ("-lpanel"); - <b>pragma</b> Linker_Options ("-lncurses"); - -- <b>type</b> <FONT COLOR=red><A NAME="ref_49_9">Panel</A></FONT> <b>is</b> <b>private</b>; -+ <b>type</b> <span class="symbol"><A NAME="ref_49_9">Panel</A></span> <b>is</b> <b>private</b>; - -- <FONT COLOR=green><EM>---------------------------</EM></FONT> -- <FONT COLOR=green><EM>-- Interface constants --</EM></FONT> -- <FONT COLOR=green><EM>---------------------------</EM></FONT> -- <FONT COLOR=red><A NAME="ref_54_4">Null_Panel</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-panels__ads.htm#ref_49_9">Panel</A>; -- -- <FONT COLOR=green><EM>-------------------</EM></FONT> -- <FONT COLOR=green><EM>-- Exceptions --</EM></FONT> -- <FONT COLOR=green><EM>-------------------</EM></FONT> -- -- <FONT COLOR=red><A NAME="ref_60_4">Panel_Exception</A></FONT> : <b>exception</b>; -- -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page <A HREF="../man/panel.3x.html">panel.3x</A></EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_1"#2|</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_67_13" HREF="terminal_interface-curses-panels__adb.htm#ref_49_13">Create</A></FONT> (<FONT COLOR=red><A NAME="ref_67_21" HREF="terminal_interface-curses-panels__adb.htm#ref_49_21">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-panels__ads.htm#ref_49_9">Panel</A>; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/panel.3x.html">new_panel()</A></EM></FONT> -+ <span class="comment"><EM>---------------------------</EM></span> -+ <span class="comment"><EM>-- Interface constants --</EM></span> -+ <span class="comment"><EM>---------------------------</EM></span> -+ <span class="symbol"><A NAME="ref_54_4">Null_Panel</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-panels__ads.htm#ref_49_9">Panel</A>; -+ -+ <span class="comment"><EM>-------------------</EM></span> -+ <span class="comment"><EM>-- Exceptions --</EM></span> -+ <span class="comment"><EM>-------------------</EM></span> -+ -+ <span class="symbol"><A NAME="ref_60_4">Panel_Exception</A></span> : <b>exception</b>; -+ -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page <A HREF="../man/panel.3x.html">panel.3x</A></EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_1"#2|</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_67_13" HREF="terminal_interface-curses-panels__adb.htm#ref_49_13">Create</A></span> (<span class="symbol"><A NAME="ref_67_21" HREF="terminal_interface-curses-panels__adb.htm#ref_49_21">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-panels__ads.htm#ref_49_9">Panel</A>; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/panel.3x.html">new_panel()</A></EM></span> - <b>pragma</b> Inline (Create); - -- <FONT COLOR=green><EM>-- #1A NAME="AFU_2"#2|</EM></FONT> -- <b>function</b> New_Panel (<FONT COLOR=red><A NAME="ref_72_24">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-panels__ads.htm#ref_49_9">Panel</A> <b>renames</b> <A HREF="terminal_interface-curses-panels__ads.htm#ref_67_13">Create</A>; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/panel.3x.html">new_panel()</A></EM></FONT> -- <FONT COLOR=green><EM>-- pragma Inline (New_Panel);</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_3"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_77_14" HREF="terminal_interface-curses-panels__adb.htm#ref_63_14">Bottom</A></FONT> (<FONT COLOR=red><A NAME="ref_77_22" HREF="terminal_interface-curses-panels__adb.htm#ref_63_22">Pan</A></FONT> : <A HREF="terminal_interface-curses-panels__ads.htm#ref_49_9">Panel</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/panel.3x.html">bottom_panel()</A></EM></FONT> -+ <span class="comment"><EM>-- #1A NAME="AFU_2"#2|</EM></span> -+ <b>function</b> New_Panel (<span class="symbol"><A NAME="ref_72_24">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-panels__ads.htm#ref_49_9">Panel</A> <b>renames</b> <A HREF="terminal_interface-curses-panels__ads.htm#ref_67_13">Create</A>; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/panel.3x.html">new_panel()</A></EM></span> -+ <span class="comment"><EM>-- pragma Inline (New_Panel);</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_3"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_77_14" HREF="terminal_interface-curses-panels__adb.htm#ref_63_14">Bottom</A></span> (<span class="symbol"><A NAME="ref_77_22" HREF="terminal_interface-curses-panels__adb.htm#ref_63_22">Pan</A></span> : <A HREF="terminal_interface-curses-panels__ads.htm#ref_49_9">Panel</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/panel.3x.html">bottom_panel()</A></EM></span> - <b>pragma</b> Inline (<A HREF="terminal_interface-curses-panels__ads.htm#ref_77_14">Bottom</A>); - -- <FONT COLOR=green><EM>-- #1A NAME="AFU_4"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_82_14" HREF="terminal_interface-curses-panels__adb.htm#ref_73_14">Top</A></FONT> (<FONT COLOR=red><A NAME="ref_82_19" HREF="terminal_interface-curses-panels__adb.htm#ref_73_19">Pan</A></FONT> : <A HREF="terminal_interface-curses-panels__ads.htm#ref_49_9">Panel</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/panel.3x.html">top_panel()</A></EM></FONT> -+ <span class="comment"><EM>-- #1A NAME="AFU_4"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_82_14" HREF="terminal_interface-curses-panels__adb.htm#ref_73_14">Top</A></span> (<span class="symbol"><A NAME="ref_82_19" HREF="terminal_interface-curses-panels__adb.htm#ref_73_19">Pan</A></span> : <A HREF="terminal_interface-curses-panels__ads.htm#ref_49_9">Panel</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/panel.3x.html">top_panel()</A></EM></span> - <b>pragma</b> Inline (<A HREF="terminal_interface-curses-panels__ads.htm#ref_82_14">Top</A>); - -- <FONT COLOR=green><EM>-- #1A NAME="AFU_5"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_87_14" HREF="terminal_interface-curses-panels__adb.htm#ref_83_14">Show</A></FONT> (<FONT COLOR=red><A NAME="ref_87_20" HREF="terminal_interface-curses-panels__adb.htm#ref_83_20">Pan</A></FONT> : <A HREF="terminal_interface-curses-panels__ads.htm#ref_49_9">Panel</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/panel.3x.html">show_panel()</A></EM></FONT> -+ <span class="comment"><EM>-- #1A NAME="AFU_5"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_87_14" HREF="terminal_interface-curses-panels__adb.htm#ref_83_14">Show</A></span> (<span class="symbol"><A NAME="ref_87_20" HREF="terminal_interface-curses-panels__adb.htm#ref_83_20">Pan</A></span> : <A HREF="terminal_interface-curses-panels__ads.htm#ref_49_9">Panel</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/panel.3x.html">show_panel()</A></EM></span> - <b>pragma</b> Inline (<A HREF="terminal_interface-curses-panels__ads.htm#ref_87_14">Show</A>); - -- <FONT COLOR=green><EM>-- #1A NAME="AFU_6"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_92_14">Update_Panels</A></FONT>; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/panel.3x.html">update_panels()</A></EM></FONT> -+ <span class="comment"><EM>-- #1A NAME="AFU_6"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_92_14">Update_Panels</A></span>; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/panel.3x.html">update_panels()</A></EM></span> - <b>pragma</b> Import (C, Update_Panels, "update_panels"); - -- <FONT COLOR=green><EM>-- #1A NAME="AFU_7"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_97_14" HREF="terminal_interface-curses-panels__adb.htm#ref_93_14">Hide</A></FONT> (<FONT COLOR=red><A NAME="ref_97_20" HREF="terminal_interface-curses-panels__adb.htm#ref_93_20">Pan</A></FONT> : <A HREF="terminal_interface-curses-panels__ads.htm#ref_49_9">Panel</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/panel.3x.html">hide_panel()</A></EM></FONT> -+ <span class="comment"><EM>-- #1A NAME="AFU_7"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_97_14" HREF="terminal_interface-curses-panels__adb.htm#ref_93_14">Hide</A></span> (<span class="symbol"><A NAME="ref_97_20" HREF="terminal_interface-curses-panels__adb.htm#ref_93_20">Pan</A></span> : <A HREF="terminal_interface-curses-panels__ads.htm#ref_49_9">Panel</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/panel.3x.html">hide_panel()</A></EM></span> - <b>pragma</b> Inline (<A HREF="terminal_interface-curses-panels__ads.htm#ref_97_14">Hide</A>); - -- <FONT COLOR=green><EM>-- #1A NAME="AFU_8"#2|</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_102_13" HREF="terminal_interface-curses-panels__adb.htm#ref_103_13">Get_Window</A></FONT> (<FONT COLOR=red><A NAME="ref_102_25" HREF="terminal_interface-curses-panels__adb.htm#ref_103_25">Pan</A></FONT> : <A HREF="terminal_interface-curses-panels__ads.htm#ref_49_9">Panel</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/panel.3x.html">panel_window()</A></EM></FONT> -+ <span class="comment"><EM>-- #1A NAME="AFU_8"#2|</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_102_13" HREF="terminal_interface-curses-panels__adb.htm#ref_103_13">Get_Window</A></span> (<span class="symbol"><A NAME="ref_102_25" HREF="terminal_interface-curses-panels__adb.htm#ref_103_25">Pan</A></span> : <A HREF="terminal_interface-curses-panels__ads.htm#ref_49_9">Panel</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/panel.3x.html">panel_window()</A></EM></span> - <b>pragma</b> Inline (<A HREF="terminal_interface-curses-panels__ads.htm#ref_102_13">Get_Window</A>); - -- <FONT COLOR=green><EM>-- #1A NAME="AFU_9"#2|</EM></FONT> -- <b>function</b> Panel_Window (<FONT COLOR=red><A NAME="ref_107_27">Pan</A></FONT> : <A HREF="terminal_interface-curses-panels__ads.htm#ref_49_9">Panel</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> <b>renames</b> <A HREF="terminal_interface-curses-panels__ads.htm#ref_102_13">Get_Window</A>; -- <FONT COLOR=green><EM>-- pragma Inline (Panel_Window);</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_10"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_111_14" HREF="terminal_interface-curses-panels__adb.htm#ref_116_14">Replace</A></FONT> (<FONT COLOR=red><A NAME="ref_111_23" HREF="terminal_interface-curses-panels__adb.htm#ref_116_23">Pan</A></FONT> : <A HREF="terminal_interface-curses-panels__ads.htm#ref_49_9">Panel</A>; -- <FONT COLOR=red><A NAME="ref_112_23" HREF="terminal_interface-curses-panels__adb.htm#ref_117_23">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/panel.3x.html">replace_panel()</A></EM></FONT> -+ <span class="comment"><EM>-- #1A NAME="AFU_9"#2|</EM></span> -+ <b>function</b> Panel_Window (<span class="symbol"><A NAME="ref_107_27">Pan</A></span> : <A HREF="terminal_interface-curses-panels__ads.htm#ref_49_9">Panel</A>) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> <b>renames</b> <A HREF="terminal_interface-curses-panels__ads.htm#ref_102_13">Get_Window</A>; -+ <span class="comment"><EM>-- pragma Inline (Panel_Window);</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_10"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_111_14" HREF="terminal_interface-curses-panels__adb.htm#ref_116_14">Replace</A></span> (<span class="symbol"><A NAME="ref_111_23" HREF="terminal_interface-curses-panels__adb.htm#ref_116_23">Pan</A></span> : <A HREF="terminal_interface-curses-panels__ads.htm#ref_49_9">Panel</A>; -+ <span class="symbol"><A NAME="ref_112_23" HREF="terminal_interface-curses-panels__adb.htm#ref_117_23">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/panel.3x.html">replace_panel()</A></EM></span> - <b>pragma</b> Inline (<A HREF="terminal_interface-curses-panels__ads.htm#ref_111_14">Replace</A>); - -- <FONT COLOR=green><EM>-- #1A NAME="AFU_11"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_117_14" HREF="terminal_interface-curses-panels__adb.htm#ref_128_14">Move</A></FONT> (<FONT COLOR=red><A NAME="ref_117_20" HREF="terminal_interface-curses-panels__adb.htm#ref_128_20">Pan</A></FONT> : <A HREF="terminal_interface-curses-panels__ads.htm#ref_49_9">Panel</A>; -- <FONT COLOR=red><A NAME="ref_118_20" HREF="terminal_interface-curses-panels__adb.htm#ref_129_20">Line</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_119_20" HREF="terminal_interface-curses-panels__adb.htm#ref_130_20">Column</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/panel.3x.html">move_panel()</A></EM></FONT> -+ <span class="comment"><EM>-- #1A NAME="AFU_11"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_117_14" HREF="terminal_interface-curses-panels__adb.htm#ref_128_14">Move</A></span> (<span class="symbol"><A NAME="ref_117_20" HREF="terminal_interface-curses-panels__adb.htm#ref_128_20">Pan</A></span> : <A HREF="terminal_interface-curses-panels__ads.htm#ref_49_9">Panel</A>; -+ <span class="symbol"><A NAME="ref_118_20" HREF="terminal_interface-curses-panels__adb.htm#ref_129_20">Line</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_119_20" HREF="terminal_interface-curses-panels__adb.htm#ref_130_20">Column</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/panel.3x.html">move_panel()</A></EM></span> - <b>pragma</b> Inline (<A HREF="terminal_interface-curses-panels__ads.htm#ref_117_14">Move</A>); - -- <FONT COLOR=green><EM>-- #1A NAME="AFU_12"#2|</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_124_13" HREF="terminal_interface-curses-panels__adb.htm#ref_142_13">Is_Hidden</A></FONT> (<FONT COLOR=red><A NAME="ref_124_24" HREF="terminal_interface-curses-panels__adb.htm#ref_142_24">Pan</A></FONT> : <A HREF="terminal_interface-curses-panels__ads.htm#ref_49_9">Panel</A>) <b>return</b> Boolean; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/panel.3x.html">panel_hidden()</A></EM></FONT> -+ <span class="comment"><EM>-- #1A NAME="AFU_12"#2|</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_124_13" HREF="terminal_interface-curses-panels__adb.htm#ref_142_13">Is_Hidden</A></span> (<span class="symbol"><A NAME="ref_124_24" HREF="terminal_interface-curses-panels__adb.htm#ref_142_24">Pan</A></span> : <A HREF="terminal_interface-curses-panels__ads.htm#ref_49_9">Panel</A>) <b>return</b> Boolean; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/panel.3x.html">panel_hidden()</A></EM></span> - <b>pragma</b> Inline (<A HREF="terminal_interface-curses-panels__ads.htm#ref_124_13">Is_Hidden</A>); - -- <FONT COLOR=green><EM>-- #1A NAME="AFU_13"#2|</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_129_13">Above</A></FONT> (<FONT COLOR=red><A NAME="ref_129_20" HREF="terminal_interface-curses-panels__ads.htm#ref_129_13">Pan</A></FONT> : <A HREF="terminal_interface-curses-panels__ads.htm#ref_49_9">Panel</A>) <b>return</b> <A HREF="terminal_interface-curses-panels__ads.htm#ref_49_9">Panel</A>; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/panel.3x.html">panel_above()</A></EM></FONT> -+ <span class="comment"><EM>-- #1A NAME="AFU_13"#2|</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_129_13">Above</A></span> (<span class="symbol"><A NAME="ref_129_20" HREF="terminal_interface-curses-panels__ads.htm#ref_129_13">Pan</A></span> : <A HREF="terminal_interface-curses-panels__ads.htm#ref_49_9">Panel</A>) <b>return</b> <A HREF="terminal_interface-curses-panels__ads.htm#ref_49_9">Panel</A>; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/panel.3x.html">panel_above()</A></EM></span> - <b>pragma</b> Import (C, Above, "panel_above"); - -- <FONT COLOR=green><EM>-- #1A NAME="AFU_14"#2|</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_134_13">Below</A></FONT> (<FONT COLOR=red><A NAME="ref_134_20" HREF="terminal_interface-curses-panels__ads.htm#ref_134_13">Pan</A></FONT> : <A HREF="terminal_interface-curses-panels__ads.htm#ref_49_9">Panel</A>) <b>return</b> <A HREF="terminal_interface-curses-panels__ads.htm#ref_49_9">Panel</A>; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/panel.3x.html">panel_below()</A></EM></FONT> -+ <span class="comment"><EM>-- #1A NAME="AFU_14"#2|</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_134_13">Below</A></span> (<span class="symbol"><A NAME="ref_134_20" HREF="terminal_interface-curses-panels__ads.htm#ref_134_13">Pan</A></span> : <A HREF="terminal_interface-curses-panels__ads.htm#ref_49_9">Panel</A>) <b>return</b> <A HREF="terminal_interface-curses-panels__ads.htm#ref_49_9">Panel</A>; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/panel.3x.html">panel_below()</A></EM></span> - <b>pragma</b> Import (C, Below, "panel_below"); - -- <FONT COLOR=green><EM>-- #1A NAME="AFU_15"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_139_14" HREF="terminal_interface-curses-panels__adb.htm#ref_154_14">Delete</A></FONT> (<FONT COLOR=red><A NAME="ref_139_22" HREF="terminal_interface-curses-panels__adb.htm#ref_154_22">Pan</A></FONT> : <b>in</b> <b>out</b> <A HREF="terminal_interface-curses-panels__ads.htm#ref_49_9">Panel</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/panel.3x.html">del_panel()</A></EM></FONT> -+ <span class="comment"><EM>-- #1A NAME="AFU_15"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_139_14" HREF="terminal_interface-curses-panels__adb.htm#ref_154_14">Delete</A></span> (<span class="symbol"><A NAME="ref_139_22" HREF="terminal_interface-curses-panels__adb.htm#ref_154_22">Pan</A></span> : <b>in</b> <b>out</b> <A HREF="terminal_interface-curses-panels__ads.htm#ref_49_9">Panel</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/panel.3x.html">del_panel()</A></EM></span> - <b>pragma</b> Inline (Delete); - - <b>private</b> -diff -Naur ncurses-5.9/doc/html/ada/terminal_interface-curses-panels-user_data__adb.htm ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-panels-user_data__adb.htm ---- ncurses-5.9/doc/html/ada/terminal_interface-curses-panels-user_data__adb.htm 2011-02-26 00:43:49.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-panels-user_data__adb.htm 2014-09-01 16:33:22.295792021 +0200 -@@ -1,63 +1,75 @@ --<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> --<HTML><HEAD><TITLE>terminal_interface-curses-panels-user_data.adb</TITLE></HEAD> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> -+<HTML> -+<HEAD> -+<TITLE>terminal_interface-curses-panels-user_data.adb</TITLE> -+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> -+<style type="text/css"> -+*.comment { -+ color: green; -+} -+*.symbol { -+ color: red; -+} -+</style> -+</HEAD> - <BODY> --<HR><DIV ALIGN="center"><H1> File : terminal_interface-curses-panels-user_data.adb </H1></DIV><HR> -+<HR><DIV style="text-align:center"><H1> File : terminal_interface-curses-panels-user_data.adb </H1></DIV><HR> - <PRE> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Terminal_Interface.Curses.Panels.User_Data --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- B O D Y --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Copyright (c) 1998-2003,2009 Free Software Foundation, Inc. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></FONT> --<FONT COLOR=green><EM>-- copy of this software and associated documentation files (the --</EM></FONT> --<FONT COLOR=green><EM>-- "Software"), to deal in the Software without restriction, including --</EM></FONT> --<FONT COLOR=green><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></FONT> --<FONT COLOR=green><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></FONT> --<FONT COLOR=green><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></FONT> --<FONT COLOR=green><EM>-- furnished to do so, subject to the following conditions: --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- The above copyright notice and this permission notice shall be included --</EM></FONT> --<FONT COLOR=green><EM>-- in all copies or substantial portions of the Software. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></FONT> --<FONT COLOR=green><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></FONT> --<FONT COLOR=green><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></FONT> --<FONT COLOR=green><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></FONT> --<FONT COLOR=green><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></FONT> --<FONT COLOR=green><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></FONT> --<FONT COLOR=green><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></FONT> --<FONT COLOR=green><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></FONT> --<FONT COLOR=green><EM>-- sale, use or other dealings in this Software without prior written --</EM></FONT> --<FONT COLOR=green><EM>-- authorization. --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Author: Juergen Pfeifer, 1996</EM></FONT> --<FONT COLOR=green><EM>-- Version Control:</EM></FONT> --<FONT COLOR=green><EM>-- @Revision: 1.12 @</EM></FONT> --<FONT COLOR=green><EM>-- Binding Version 01.00</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<b>with</b> <A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>.C; -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Terminal_Interface.Curses.Panels.User_Data --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- B O D Y --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Copyright (c) 1998-2003,2009 Free Software Foundation, Inc. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></span> -+<span class="comment"><EM>-- copy of this software and associated documentation files (the --</EM></span> -+<span class="comment"><EM>-- "Software"), to deal in the Software without restriction, including --</EM></span> -+<span class="comment"><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></span> -+<span class="comment"><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></span> -+<span class="comment"><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></span> -+<span class="comment"><EM>-- furnished to do so, subject to the following conditions: --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- The above copyright notice and this permission notice shall be included --</EM></span> -+<span class="comment"><EM>-- in all copies or substantial portions of the Software. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></span> -+<span class="comment"><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></span> -+<span class="comment"><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></span> -+<span class="comment"><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></span> -+<span class="comment"><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></span> -+<span class="comment"><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></span> -+<span class="comment"><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></span> -+<span class="comment"><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></span> -+<span class="comment"><EM>-- sale, use or other dealings in this Software without prior written --</EM></span> -+<span class="comment"><EM>-- authorization. --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Author: Juergen Pfeifer, 1996</EM></span> -+<span class="comment"><EM>-- Version Control:</EM></span> -+<span class="comment"><EM>-- @Revision: 1.12 @</EM></span> -+<span class="comment"><EM>-- Binding Version 01.00</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<b>with</b> <A HREF="interfac__ads.htm#ref_36_9">Interfaces</A>.C; - <b>with</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-aux__ads.htm#ref_50_35">Aux</A>; - <b>use</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-aux__ads.htm#ref_50_35">Aux</A>; - <b>with</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-panels__ads.htm#ref_44_35">Panels</A>; - <b>use</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-panels__ads.htm#ref_44_35">Panels</A>; - --<b>package</b> <b>body</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-panels__ads.htm#ref_44_35">Panels</A>.<FONT COLOR=red><A NAME="ref_47_47" HREF="terminal_interface-curses-panels-user_data__ads.htm#ref_45_42">User_Data</A></FONT> <b>is</b> -+<b>package</b> <b>body</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-panels__ads.htm#ref_44_35">Panels</A>.<span class="symbol"><A NAME="ref_47_47" HREF="terminal_interface-curses-panels-user_data__ads.htm#ref_45_42">User_Data</A></span> <b>is</b> - -- <b>use</b> <b>type</b> <A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>.C.int; -+ <b>use</b> <b>type</b> <A HREF="interfac__ads.htm#ref_36_9">Interfaces</A>.C.int; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_51_14" HREF="terminal_interface-curses-panels-user_data__ads.htm#ref_53_14">Set_User_Data</A></FONT> (<FONT COLOR=red><A NAME="ref_51_29" HREF="terminal_interface-curses-panels-user_data__ads.htm#ref_53_29">Pan</A></FONT> : <A HREF="terminal_interface-curses-panels__ads.htm#ref_49_9">Panel</A>; -- <FONT COLOR=red><A NAME="ref_52_29" HREF="terminal_interface-curses-panels-user_data__ads.htm#ref_54_29">Data</A></FONT> : <A HREF="terminal_interface-curses-panels-user_data__ads.htm#ref_44_9">User_Access</A>) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_51_14" HREF="terminal_interface-curses-panels-user_data__ads.htm#ref_53_14">Set_User_Data</A></span> (<span class="symbol"><A NAME="ref_51_29" HREF="terminal_interface-curses-panels-user_data__ads.htm#ref_53_29">Pan</A></span> : <A HREF="terminal_interface-curses-panels__ads.htm#ref_49_9">Panel</A>; -+ <span class="symbol"><A NAME="ref_52_29" HREF="terminal_interface-curses-panels-user_data__ads.htm#ref_54_29">Data</A></span> : <A HREF="terminal_interface-curses-panels-user_data__ads.htm#ref_44_9">User_Access</A>) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_54_16">Set_Panel_Userptr</A></FONT> (<FONT COLOR=red><A NAME="ref_54_35" HREF="terminal_interface-curses-panels-user_data__adb.htm#ref_54_16">Pan</A></FONT> : <A HREF="terminal_interface-curses-panels__ads.htm#ref_49_9">Panel</A>; -- <FONT COLOR=red><A NAME="ref_55_35" HREF="terminal_interface-curses-panels-user_data__adb.htm#ref_54_16">Addr</A></FONT> : <A HREF="terminal_interface-curses-panels-user_data__ads.htm#ref_44_9">User_Access</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_54_16">Set_Panel_Userptr</A></span> (<span class="symbol"><A NAME="ref_54_35" HREF="terminal_interface-curses-panels-user_data__adb.htm#ref_54_16">Pan</A></span> : <A HREF="terminal_interface-curses-panels__ads.htm#ref_49_9">Panel</A>; -+ <span class="symbol"><A NAME="ref_55_35" HREF="terminal_interface-curses-panels-user_data__adb.htm#ref_54_16">Addr</A></span> : <A HREF="terminal_interface-curses-panels-user_data__ads.htm#ref_44_9">User_Access</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, Set_Panel_Userptr, "set_panel_userptr"); - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses-panels-user_data__adb.htm#ref_54_16">Set_Panel_Userptr</A> (<A HREF="terminal_interface-curses-panels-user_data__ads.htm#ref_53_29">Pan</A>, <A HREF="terminal_interface-curses-panels-user_data__ads.htm#ref_54_29">Data</A>) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -@@ -65,16 +77,16 @@ - <b>end</b> <b>if</b>; - <b>end</b> <A HREF="terminal_interface-curses-panels-user_data__ads.htm#ref_53_14">Set_User_Data</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_63_13" HREF="terminal_interface-curses-panels-user_data__ads.htm#ref_64_13">Get_User_Data</A></FONT> (<FONT COLOR=red><A NAME="ref_63_28" HREF="terminal_interface-curses-panels-user_data__ads.htm#ref_64_28">Pan</A></FONT> : <A HREF="terminal_interface-curses-panels__ads.htm#ref_49_9">Panel</A>) <b>return</b> <A HREF="terminal_interface-curses-panels-user_data__ads.htm#ref_44_9">User_Access</A> -+ <b>function</b> <span class="symbol"><A NAME="ref_63_13" HREF="terminal_interface-curses-panels-user_data__ads.htm#ref_64_13">Get_User_Data</A></span> (<span class="symbol"><A NAME="ref_63_28" HREF="terminal_interface-curses-panels-user_data__ads.htm#ref_64_28">Pan</A></span> : <A HREF="terminal_interface-curses-panels__ads.htm#ref_49_9">Panel</A>) <b>return</b> <A HREF="terminal_interface-curses-panels-user_data__ads.htm#ref_44_9">User_Access</A> - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_65_16">Panel_Userptr</A></FONT> (<FONT COLOR=red><A NAME="ref_65_31" HREF="terminal_interface-curses-panels-user_data__adb.htm#ref_65_16">Pan</A></FONT> : <A HREF="terminal_interface-curses-panels__ads.htm#ref_49_9">Panel</A>) <b>return</b> <A HREF="terminal_interface-curses-panels-user_data__ads.htm#ref_44_9">User_Access</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_65_16">Panel_Userptr</A></span> (<span class="symbol"><A NAME="ref_65_31" HREF="terminal_interface-curses-panels-user_data__adb.htm#ref_65_16">Pan</A></span> : <A HREF="terminal_interface-curses-panels__ads.htm#ref_49_9">Panel</A>) <b>return</b> <A HREF="terminal_interface-curses-panels-user_data__ads.htm#ref_44_9">User_Access</A>; - <b>pragma</b> Import (C, Panel_Userptr, "panel_userptr"); - <b>begin</b> - <b>return</b> <A HREF="terminal_interface-curses-panels-user_data__adb.htm#ref_65_16">Panel_Userptr</A> (<A HREF="terminal_interface-curses-panels-user_data__ads.htm#ref_64_28">Pan</A>); - <b>end</b> <A HREF="terminal_interface-curses-panels-user_data__ads.htm#ref_64_13">Get_User_Data</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_71_14" HREF="terminal_interface-curses-panels-user_data__ads.htm#ref_59_14">Get_User_Data</A></FONT> (<FONT COLOR=red><A NAME="ref_71_29" HREF="terminal_interface-curses-panels-user_data__ads.htm#ref_59_29">Pan</A></FONT> : <A HREF="terminal_interface-curses-panels__ads.htm#ref_49_9">Panel</A>; -- <FONT COLOR=red><A NAME="ref_72_29" HREF="terminal_interface-curses-panels-user_data__ads.htm#ref_60_29">Data</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses-panels-user_data__ads.htm#ref_44_9">User_Access</A>) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_71_14" HREF="terminal_interface-curses-panels-user_data__ads.htm#ref_59_14">Get_User_Data</A></span> (<span class="symbol"><A NAME="ref_71_29" HREF="terminal_interface-curses-panels-user_data__ads.htm#ref_59_29">Pan</A></span> : <A HREF="terminal_interface-curses-panels__ads.htm#ref_49_9">Panel</A>; -+ <span class="symbol"><A NAME="ref_72_29" HREF="terminal_interface-curses-panels-user_data__ads.htm#ref_60_29">Data</A></span> : <b>out</b> <A HREF="terminal_interface-curses-panels-user_data__ads.htm#ref_44_9">User_Access</A>) - <b>is</b> - <b>begin</b> - <A HREF="terminal_interface-curses-panels-user_data__ads.htm#ref_60_29">Data</A> := <A HREF="terminal_interface-curses-panels-user_data__ads.htm#ref_64_13">Get_User_Data</A> (<A HREF="terminal_interface-curses-panels-user_data__ads.htm#ref_59_29">Pan</A>); -diff -Naur ncurses-5.9/doc/html/ada/terminal_interface-curses-panels-user_data__ads.htm ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-panels-user_data__ads.htm ---- ncurses-5.9/doc/html/ada/terminal_interface-curses-panels-user_data__ads.htm 2010-01-09 21:31:26.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-panels-user_data__ads.htm 2014-09-01 16:33:22.295792021 +0200 -@@ -1,74 +1,86 @@ --<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> --<HTML><HEAD><TITLE>terminal_interface-curses-panels-user_data.ads</TITLE></HEAD> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> -+<HTML> -+<HEAD> -+<TITLE>terminal_interface-curses-panels-user_data.ads</TITLE> -+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> -+<style type="text/css"> -+*.comment { -+ color: green; -+} -+*.symbol { -+ color: red; -+} -+</style> -+</HEAD> - <BODY> --<HR><DIV ALIGN="center"><H1> File : terminal_interface-curses-panels-user_data.ads </H1></DIV><HR> -+<HR><DIV style="text-align:center"><H1> File : terminal_interface-curses-panels-user_data.ads </H1></DIV><HR> - <PRE> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Terminal_Interface.Curses.Panels.User_Data --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- S P E C --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Copyright (c) 1998-2003,2009 Free Software Foundation, Inc. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></FONT> --<FONT COLOR=green><EM>-- copy of this software and associated documentation files (the --</EM></FONT> --<FONT COLOR=green><EM>-- "Software"), to deal in the Software without restriction, including --</EM></FONT> --<FONT COLOR=green><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></FONT> --<FONT COLOR=green><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></FONT> --<FONT COLOR=green><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></FONT> --<FONT COLOR=green><EM>-- furnished to do so, subject to the following conditions: --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- The above copyright notice and this permission notice shall be included --</EM></FONT> --<FONT COLOR=green><EM>-- in all copies or substantial portions of the Software. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></FONT> --<FONT COLOR=green><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></FONT> --<FONT COLOR=green><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></FONT> --<FONT COLOR=green><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></FONT> --<FONT COLOR=green><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></FONT> --<FONT COLOR=green><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></FONT> --<FONT COLOR=green><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></FONT> --<FONT COLOR=green><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></FONT> --<FONT COLOR=green><EM>-- sale, use or other dealings in this Software without prior written --</EM></FONT> --<FONT COLOR=green><EM>-- authorization. --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Author: Juergen Pfeifer, 1996</EM></FONT> --<FONT COLOR=green><EM>-- Version Control:</EM></FONT> --<FONT COLOR=green><EM>-- @Revision: 1.15 @</EM></FONT> --<FONT COLOR=green><EM>-- Binding Version 01.00</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Terminal_Interface.Curses.Panels.User_Data --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- S P E C --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Copyright (c) 1998-2003,2009 Free Software Foundation, Inc. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></span> -+<span class="comment"><EM>-- copy of this software and associated documentation files (the --</EM></span> -+<span class="comment"><EM>-- "Software"), to deal in the Software without restriction, including --</EM></span> -+<span class="comment"><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></span> -+<span class="comment"><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></span> -+<span class="comment"><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></span> -+<span class="comment"><EM>-- furnished to do so, subject to the following conditions: --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- The above copyright notice and this permission notice shall be included --</EM></span> -+<span class="comment"><EM>-- in all copies or substantial portions of the Software. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></span> -+<span class="comment"><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></span> -+<span class="comment"><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></span> -+<span class="comment"><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></span> -+<span class="comment"><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></span> -+<span class="comment"><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></span> -+<span class="comment"><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></span> -+<span class="comment"><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></span> -+<span class="comment"><EM>-- sale, use or other dealings in this Software without prior written --</EM></span> -+<span class="comment"><EM>-- authorization. --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Author: Juergen Pfeifer, 1996</EM></span> -+<span class="comment"><EM>-- Version Control:</EM></span> -+<span class="comment"><EM>-- @Revision: 1.15 @</EM></span> -+<span class="comment"><EM>-- Binding Version 01.00</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> - - <b>generic</b> -- <b>type</b> <FONT COLOR=red><A NAME="ref_43_9" HREF="terminal_interface-curses-panels-user_data__ads.htm#ref_45_42">User</A></FONT> <b>is</b> <b>limited</b> <b>private</b>; -- <b>type</b> <FONT COLOR=red><A NAME="ref_44_9" HREF="terminal_interface-curses-panels-user_data__ads.htm#ref_45_42">User_Access</A></FONT> <b>is</b> <b>access</b> <b>all</b> <A HREF="terminal_interface-curses-panels-user_data__ads.htm#ref_43_9">User</A>; --<b>package</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-panels__ads.htm#ref_44_35">Panels</A>.<FONT COLOR=red><A NAME="ref_45_42" HREF="terminal_interface-curses-panels-user_data__adb.htm#ref_47_47">User_Data</A></FONT> <b>is</b> -+ <b>type</b> <span class="symbol"><A NAME="ref_43_9" HREF="terminal_interface-curses-panels-user_data__ads.htm#ref_45_42">User</A></span> <b>is</b> <b>limited</b> <b>private</b>; -+ <b>type</b> <span class="symbol"><A NAME="ref_44_9" HREF="terminal_interface-curses-panels-user_data__ads.htm#ref_45_42">User_Access</A></span> <b>is</b> <b>access</b> <b>all</b> <A HREF="terminal_interface-curses-panels-user_data__ads.htm#ref_43_9">User</A>; -+<b>package</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-panels__ads.htm#ref_44_35">Panels</A>.<span class="symbol"><A NAME="ref_45_42" HREF="terminal_interface-curses-panels-user_data__adb.htm#ref_47_47">User_Data</A></span> <b>is</b> - <b>pragma</b> Preelaborate (<A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-panels__ads.htm#ref_44_35">Panels</A>.<A HREF="terminal_interface-curses-panels-user_data__ads.htm#ref_45_42">User_Data</A>); - -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page <A HREF="../man/panel.3x.html">panel.3x</A></EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_1"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_53_14" HREF="terminal_interface-curses-panels-user_data__adb.htm#ref_51_14">Set_User_Data</A></FONT> (<FONT COLOR=red><A NAME="ref_53_29" HREF="terminal_interface-curses-panels-user_data__adb.htm#ref_51_29">Pan</A></FONT> : <A HREF="terminal_interface-curses-panels__ads.htm#ref_49_9">Panel</A>; -- <FONT COLOR=red><A NAME="ref_54_29" HREF="terminal_interface-curses-panels-user_data__adb.htm#ref_52_29">Data</A></FONT> : <A HREF="terminal_interface-curses-panels-user_data__ads.htm#ref_44_9">User_Access</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/panel.3x.html">set_panel_userptr</A></EM></FONT> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page <A HREF="../man/panel.3x.html">panel.3x</A></EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_1"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_53_14" HREF="terminal_interface-curses-panels-user_data__adb.htm#ref_51_14">Set_User_Data</A></span> (<span class="symbol"><A NAME="ref_53_29" HREF="terminal_interface-curses-panels-user_data__adb.htm#ref_51_29">Pan</A></span> : <A HREF="terminal_interface-curses-panels__ads.htm#ref_49_9">Panel</A>; -+ <span class="symbol"><A NAME="ref_54_29" HREF="terminal_interface-curses-panels-user_data__adb.htm#ref_52_29">Data</A></span> : <A HREF="terminal_interface-curses-panels-user_data__ads.htm#ref_44_9">User_Access</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/panel.3x.html">set_panel_userptr</A></EM></span> - <b>pragma</b> Inline (<A HREF="terminal_interface-curses-panels-user_data__ads.htm#ref_53_14">Set_User_Data</A>); - -- <FONT COLOR=green><EM>-- #1A NAME="AFU_2"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_59_14" HREF="terminal_interface-curses-panels-user_data__adb.htm#ref_71_14">Get_User_Data</A></FONT> (<FONT COLOR=red><A NAME="ref_59_29" HREF="terminal_interface-curses-panels-user_data__adb.htm#ref_71_29">Pan</A></FONT> : <A HREF="terminal_interface-curses-panels__ads.htm#ref_49_9">Panel</A>; -- <FONT COLOR=red><A NAME="ref_60_29" HREF="terminal_interface-curses-panels-user_data__adb.htm#ref_72_29">Data</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses-panels-user_data__ads.htm#ref_44_9">User_Access</A>); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/panel.3x.html">panel_userptr</A></EM></FONT> -- -- <FONT COLOR=green><EM>-- #1A NAME="AFU_3"#2|</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_64_13" HREF="terminal_interface-curses-panels-user_data__adb.htm#ref_63_13">Get_User_Data</A></FONT> (<FONT COLOR=red><A NAME="ref_64_28" HREF="terminal_interface-curses-panels-user_data__adb.htm#ref_63_28">Pan</A></FONT> : <A HREF="terminal_interface-curses-panels__ads.htm#ref_49_9">Panel</A>) <b>return</b> <A HREF="terminal_interface-curses-panels-user_data__ads.htm#ref_44_9">User_Access</A>; -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/panel.3x.html">panel_userptr</A></EM></FONT> -- <FONT COLOR=green><EM>-- Same as function</EM></FONT> -+ <span class="comment"><EM>-- #1A NAME="AFU_2"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_59_14" HREF="terminal_interface-curses-panels-user_data__adb.htm#ref_71_14">Get_User_Data</A></span> (<span class="symbol"><A NAME="ref_59_29" HREF="terminal_interface-curses-panels-user_data__adb.htm#ref_71_29">Pan</A></span> : <A HREF="terminal_interface-curses-panels__ads.htm#ref_49_9">Panel</A>; -+ <span class="symbol"><A NAME="ref_60_29" HREF="terminal_interface-curses-panels-user_data__adb.htm#ref_72_29">Data</A></span> : <b>out</b> <A HREF="terminal_interface-curses-panels-user_data__ads.htm#ref_44_9">User_Access</A>); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/panel.3x.html">panel_userptr</A></EM></span> -+ -+ <span class="comment"><EM>-- #1A NAME="AFU_3"#2|</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_64_13" HREF="terminal_interface-curses-panels-user_data__adb.htm#ref_63_13">Get_User_Data</A></span> (<span class="symbol"><A NAME="ref_64_28" HREF="terminal_interface-curses-panels-user_data__adb.htm#ref_63_28">Pan</A></span> : <A HREF="terminal_interface-curses-panels__ads.htm#ref_49_9">Panel</A>) <b>return</b> <A HREF="terminal_interface-curses-panels-user_data__ads.htm#ref_44_9">User_Access</A>; -+ <span class="comment"><EM>-- AKA: <A HREF="../man/panel.3x.html">panel_userptr</A></EM></span> -+ <span class="comment"><EM>-- Same as function</EM></span> - <b>pragma</b> Inline (Get_User_Data); - - <b>end</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-panels__ads.htm#ref_44_35">Panels</A>.<A HREF="terminal_interface-curses-panels-user_data__ads.htm#ref_45_42">User_Data</A>; -diff -Naur ncurses-5.9/doc/html/ada/terminal_interface-curses-putwin__adb.htm ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-putwin__adb.htm ---- ncurses-5.9/doc/html/ada/terminal_interface-curses-putwin__adb.htm 2011-03-20 00:18:41.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-putwin__adb.htm 2014-09-01 16:33:22.296792023 +0200 -@@ -1,79 +1,91 @@ --<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> --<HTML><HEAD><TITLE>terminal_interface-curses-putwin.adb</TITLE></HEAD> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> -+<HTML> -+<HEAD> -+<TITLE>terminal_interface-curses-putwin.adb</TITLE> -+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> -+<style type="text/css"> -+*.comment { -+ color: green; -+} -+*.symbol { -+ color: red; -+} -+</style> -+</HEAD> - <BODY> --<HR><DIV ALIGN="center"><H1> File : terminal_interface-curses-putwin.adb </H1></DIV><HR> -+<HR><DIV style="text-align:center"><H1> File : terminal_interface-curses-putwin.adb </H1></DIV><HR> - <PRE> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Terminal_Interface.Curses.PutWin --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- B O D Y --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Copyright (c) 2000 Free Software Foundation, Inc. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></FONT> --<FONT COLOR=green><EM>-- copy of this software and associated documentation files (the --</EM></FONT> --<FONT COLOR=green><EM>-- "Software"), to deal in the Software without restriction, including --</EM></FONT> --<FONT COLOR=green><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></FONT> --<FONT COLOR=green><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></FONT> --<FONT COLOR=green><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></FONT> --<FONT COLOR=green><EM>-- furnished to do so, subject to the following conditions: --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- The above copyright notice and this permission notice shall be included --</EM></FONT> --<FONT COLOR=green><EM>-- in all copies or substantial portions of the Software. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></FONT> --<FONT COLOR=green><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></FONT> --<FONT COLOR=green><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></FONT> --<FONT COLOR=green><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></FONT> --<FONT COLOR=green><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></FONT> --<FONT COLOR=green><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></FONT> --<FONT COLOR=green><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></FONT> --<FONT COLOR=green><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></FONT> --<FONT COLOR=green><EM>-- sale, use or other dealings in this Software without prior written --</EM></FONT> --<FONT COLOR=green><EM>-- authorization. --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Author: Juergen Pfeifer, 1996</EM></FONT> --<FONT COLOR=green><EM>-- Version Control:</EM></FONT> --<FONT COLOR=green><EM>-- @Revision: 1.3 @</EM></FONT> --<FONT COLOR=green><EM>-- Binding Version 01.00</EM></FONT> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Terminal_Interface.Curses.PutWin --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- B O D Y --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Copyright (c) 2000 Free Software Foundation, Inc. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></span> -+<span class="comment"><EM>-- copy of this software and associated documentation files (the --</EM></span> -+<span class="comment"><EM>-- "Software"), to deal in the Software without restriction, including --</EM></span> -+<span class="comment"><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></span> -+<span class="comment"><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></span> -+<span class="comment"><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></span> -+<span class="comment"><EM>-- furnished to do so, subject to the following conditions: --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- The above copyright notice and this permission notice shall be included --</EM></span> -+<span class="comment"><EM>-- in all copies or substantial portions of the Software. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></span> -+<span class="comment"><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></span> -+<span class="comment"><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></span> -+<span class="comment"><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></span> -+<span class="comment"><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></span> -+<span class="comment"><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></span> -+<span class="comment"><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></span> -+<span class="comment"><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></span> -+<span class="comment"><EM>-- sale, use or other dealings in this Software without prior written --</EM></span> -+<span class="comment"><EM>-- authorization. --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Author: Juergen Pfeifer, 1996</EM></span> -+<span class="comment"><EM>-- Version Control:</EM></span> -+<span class="comment"><EM>-- @Revision: 1.3 @</EM></span> -+<span class="comment"><EM>-- Binding Version 01.00</EM></span> - - <b>with</b> Ada.Streams.Stream_IO.C_Streams; --<b>with</b> <A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>.C_Streams; -+<b>with</b> <A HREF="interfac__ads.htm#ref_36_9">Interfaces</A>.C_Streams; - <b>with</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-aux__ads.htm#ref_50_35">Aux</A>; <b>use</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-aux__ads.htm#ref_50_35">Aux</A>; - --<b>package</b> <b>body</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<FONT COLOR=red><A NAME="ref_45_40" HREF="terminal_interface-curses-putwin__ads.htm#ref_43_35">PutWin</A></FONT> <b>is</b> -+<b>package</b> <b>body</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<span class="symbol"><A NAME="ref_45_40" HREF="terminal_interface-curses-putwin__ads.htm#ref_43_35">PutWin</A></span> <b>is</b> - -- <b>package</b> <FONT COLOR=red><A NAME="ref_47_12">ICS</A></FONT> <b>renames</b> <A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>.C_Streams; -- <b>package</b> <FONT COLOR=red><A NAME="ref_48_12">ACS</A></FONT> <b>renames</b> Ada.Streams.Stream_IO.C_Streams; -+ <b>package</b> <span class="symbol"><A NAME="ref_47_12">ICS</A></span> <b>renames</b> <A HREF="interfac__ads.htm#ref_36_9">Interfaces</A>.C_Streams; -+ <b>package</b> <span class="symbol"><A NAME="ref_48_12">ACS</A></span> <b>renames</b> Ada.Streams.Stream_IO.C_Streams; - <b>use</b> <b>type</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_51_14" HREF="terminal_interface-curses-putwin__ads.htm#ref_45_14">Put_Window</A></FONT> (<FONT COLOR=red><A NAME="ref_51_26" HREF="terminal_interface-curses-putwin__ads.htm#ref_45_26">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- <FONT COLOR=red><A NAME="ref_52_26" HREF="terminal_interface-curses-putwin__ads.htm#ref_46_26">File</A></FONT> : Ada.Streams.Stream_IO.File_Type) <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_53_16">putwin</A></FONT> (<FONT COLOR=red><A NAME="ref_53_24" HREF="terminal_interface-curses-putwin__adb.htm#ref_53_16">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; <FONT COLOR=red><A NAME="ref_53_38" HREF="terminal_interface-curses-putwin__adb.htm#ref_53_16">f</A></FONT> : <A HREF="terminal_interface-curses-putwin__adb.htm#ref_47_12">ICS</A>.FILEs) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>procedure</b> <span class="symbol"><A NAME="ref_51_14" HREF="terminal_interface-curses-putwin__ads.htm#ref_45_14">Put_Window</A></span> (<span class="symbol"><A NAME="ref_51_26" HREF="terminal_interface-curses-putwin__ads.htm#ref_45_26">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="symbol"><A NAME="ref_52_26" HREF="terminal_interface-curses-putwin__ads.htm#ref_46_26">File</A></span> : Ada.Streams.Stream_IO.File_Type) <b>is</b> -+ <b>function</b> <span class="symbol"><A NAME="ref_53_16">putwin</A></span> (<span class="symbol"><A NAME="ref_53_24" HREF="terminal_interface-curses-putwin__adb.htm#ref_53_16">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; <span class="symbol"><A NAME="ref_53_38" HREF="terminal_interface-curses-putwin__adb.htm#ref_53_16">f</A></span> : <A HREF="terminal_interface-curses-putwin__adb.htm#ref_47_12">ICS</A>.FILEs) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, putwin, "putwin"); - -- <FONT COLOR=red><A NAME="ref_56_7">R</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> := <A HREF="terminal_interface-curses-putwin__adb.htm#ref_53_16">putwin</A> (<A HREF="terminal_interface-curses-putwin__ads.htm#ref_45_26">Win</A>, <A HREF="terminal_interface-curses-putwin__adb.htm#ref_48_12">ACS</A>.C_Stream (<A HREF="terminal_interface-curses-putwin__ads.htm#ref_46_26">File</A>)); -+ <span class="symbol"><A NAME="ref_56_7">R</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> := <A HREF="terminal_interface-curses-putwin__adb.htm#ref_53_16">putwin</A> (<A HREF="terminal_interface-curses-putwin__ads.htm#ref_45_26">Win</A>, <A HREF="terminal_interface-curses-putwin__adb.htm#ref_48_12">ACS</A>.C_Stream (<A HREF="terminal_interface-curses-putwin__ads.htm#ref_46_26">File</A>)); - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses-putwin__adb.htm#ref_56_7">R</A> /= <A HREF="terminal_interface-curses-aux__ads.htm#ref_71_4">Curses_Ok</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; - <b>end</b> <A HREF="terminal_interface-curses-putwin__ads.htm#ref_45_14">Put_Window</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_63_13" HREF="terminal_interface-curses-putwin__ads.htm#ref_48_13">Get_Window</A></FONT> (<FONT COLOR=red><A NAME="ref_63_25" HREF="terminal_interface-curses-putwin__ads.htm#ref_48_25">File</A></FONT> : Ada.Streams.Stream_IO.File_Type) -+ <b>function</b> <span class="symbol"><A NAME="ref_63_13" HREF="terminal_interface-curses-putwin__ads.htm#ref_48_13">Get_Window</A></span> (<span class="symbol"><A NAME="ref_63_25" HREF="terminal_interface-curses-putwin__ads.htm#ref_48_25">File</A></span> : Ada.Streams.Stream_IO.File_Type) - <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_65_16">getwin</A></FONT> (<FONT COLOR=red><A NAME="ref_65_24" HREF="terminal_interface-curses-putwin__adb.htm#ref_65_16">f</A></FONT> : <A HREF="terminal_interface-curses-putwin__adb.htm#ref_47_12">ICS</A>.FILEs) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_65_16">getwin</A></span> (<span class="symbol"><A NAME="ref_65_24" HREF="terminal_interface-curses-putwin__adb.htm#ref_65_16">f</A></span> : <A HREF="terminal_interface-curses-putwin__adb.htm#ref_47_12">ICS</A>.FILEs) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; - <b>pragma</b> Import (C, getwin, "getwin"); - -- <FONT COLOR=red><A NAME="ref_68_7">W</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses-putwin__adb.htm#ref_65_16">getwin</A> (<A HREF="terminal_interface-curses-putwin__adb.htm#ref_48_12">ACS</A>.C_Stream (<A HREF="terminal_interface-curses-putwin__ads.htm#ref_48_25">File</A>)); -+ <span class="symbol"><A NAME="ref_68_7">W</A></span> : <b>constant</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses-putwin__adb.htm#ref_65_16">getwin</A> (<A HREF="terminal_interface-curses-putwin__adb.htm#ref_48_12">ACS</A>.C_Stream (<A HREF="terminal_interface-curses-putwin__ads.htm#ref_48_25">File</A>)); - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses-putwin__adb.htm#ref_68_7">W</A> = <A HREF="terminal_interface-curses__ads.htm#ref_58_4">Null_Window</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>else</b> - <b>return</b> <A HREF="terminal_interface-curses-putwin__adb.htm#ref_68_7">W</A>; - <b>end</b> <b>if</b>; -diff -Naur ncurses-5.9/doc/html/ada/terminal_interface-curses-putwin__ads.htm ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-putwin__ads.htm ---- ncurses-5.9/doc/html/ada/terminal_interface-curses-putwin__ads.htm 2006-09-23 22:31:32.000000000 +0200 -+++ ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-putwin__ads.htm 2014-09-01 16:33:22.297792024 +0200 -@@ -1,56 +1,68 @@ --<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> --<HTML><HEAD><TITLE>terminal_interface-curses-putwin.ads</TITLE></HEAD> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> -+<HTML> -+<HEAD> -+<TITLE>terminal_interface-curses-putwin.ads</TITLE> -+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> -+<style type="text/css"> -+*.comment { -+ color: green; -+} -+*.symbol { -+ color: red; -+} -+</style> -+</HEAD> - <BODY> --<HR><DIV ALIGN="center"><H1> File : terminal_interface-curses-putwin.ads </H1></DIV><HR> -+<HR><DIV style="text-align:center"><H1> File : terminal_interface-curses-putwin.ads </H1></DIV><HR> - <PRE> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Terminal_Interface.Curses.PutWin --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- S P E C --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Copyright (c) 2000 Free Software Foundation, Inc. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></FONT> --<FONT COLOR=green><EM>-- copy of this software and associated documentation files (the --</EM></FONT> --<FONT COLOR=green><EM>-- "Software"), to deal in the Software without restriction, including --</EM></FONT> --<FONT COLOR=green><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></FONT> --<FONT COLOR=green><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></FONT> --<FONT COLOR=green><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></FONT> --<FONT COLOR=green><EM>-- furnished to do so, subject to the following conditions: --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- The above copyright notice and this permission notice shall be included --</EM></FONT> --<FONT COLOR=green><EM>-- in all copies or substantial portions of the Software. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></FONT> --<FONT COLOR=green><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></FONT> --<FONT COLOR=green><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></FONT> --<FONT COLOR=green><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></FONT> --<FONT COLOR=green><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></FONT> --<FONT COLOR=green><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></FONT> --<FONT COLOR=green><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></FONT> --<FONT COLOR=green><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></FONT> --<FONT COLOR=green><EM>-- sale, use or other dealings in this Software without prior written --</EM></FONT> --<FONT COLOR=green><EM>-- authorization. --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Author: Juergen Pfeifer, 1996</EM></FONT> --<FONT COLOR=green><EM>-- Version Control:</EM></FONT> --<FONT COLOR=green><EM>-- @Revision: 1.3 @</EM></FONT> --<FONT COLOR=green><EM>-- Binding Version 01.00</EM></FONT> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Terminal_Interface.Curses.PutWin --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- S P E C --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Copyright (c) 2000 Free Software Foundation, Inc. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></span> -+<span class="comment"><EM>-- copy of this software and associated documentation files (the --</EM></span> -+<span class="comment"><EM>-- "Software"), to deal in the Software without restriction, including --</EM></span> -+<span class="comment"><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></span> -+<span class="comment"><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></span> -+<span class="comment"><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></span> -+<span class="comment"><EM>-- furnished to do so, subject to the following conditions: --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- The above copyright notice and this permission notice shall be included --</EM></span> -+<span class="comment"><EM>-- in all copies or substantial portions of the Software. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></span> -+<span class="comment"><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></span> -+<span class="comment"><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></span> -+<span class="comment"><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></span> -+<span class="comment"><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></span> -+<span class="comment"><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></span> -+<span class="comment"><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></span> -+<span class="comment"><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></span> -+<span class="comment"><EM>-- sale, use or other dealings in this Software without prior written --</EM></span> -+<span class="comment"><EM>-- authorization. --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Author: Juergen Pfeifer, 1996</EM></span> -+<span class="comment"><EM>-- Version Control:</EM></span> -+<span class="comment"><EM>-- @Revision: 1.3 @</EM></span> -+<span class="comment"><EM>-- Binding Version 01.00</EM></span> - - <b>with</b> Ada.Streams.Stream_IO; - --<b>package</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<FONT COLOR=red><A NAME="ref_43_35" HREF="terminal_interface-curses-putwin__adb.htm#ref_45_40">PutWin</A></FONT> <b>is</b> -+<b>package</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<span class="symbol"><A NAME="ref_43_35" HREF="terminal_interface-curses-putwin__adb.htm#ref_45_40">PutWin</A></span> <b>is</b> - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_45_14" HREF="terminal_interface-curses-putwin__adb.htm#ref_51_14">Put_Window</A></FONT> (<FONT COLOR=red><A NAME="ref_45_26" HREF="terminal_interface-curses-putwin__adb.htm#ref_51_26">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- <FONT COLOR=red><A NAME="ref_46_26" HREF="terminal_interface-curses-putwin__adb.htm#ref_52_26">File</A></FONT> : Ada.Streams.Stream_IO.File_Type); -+ <b>procedure</b> <span class="symbol"><A NAME="ref_45_14" HREF="terminal_interface-curses-putwin__adb.htm#ref_51_14">Put_Window</A></span> (<span class="symbol"><A NAME="ref_45_26" HREF="terminal_interface-curses-putwin__adb.htm#ref_51_26">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="symbol"><A NAME="ref_46_26" HREF="terminal_interface-curses-putwin__adb.htm#ref_52_26">File</A></span> : Ada.Streams.Stream_IO.File_Type); - -- <b>function</b> <FONT COLOR=red><A NAME="ref_48_13" HREF="terminal_interface-curses-putwin__adb.htm#ref_63_13">Get_Window</A></FONT> (<FONT COLOR=red><A NAME="ref_48_25" HREF="terminal_interface-curses-putwin__adb.htm#ref_63_25">File</A></FONT> : Ada.Streams.Stream_IO.File_Type) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_48_13" HREF="terminal_interface-curses-putwin__adb.htm#ref_63_13">Get_Window</A></span> (<span class="symbol"><A NAME="ref_48_25" HREF="terminal_interface-curses-putwin__adb.htm#ref_63_25">File</A></span> : Ada.Streams.Stream_IO.File_Type) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; - - <b>end</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-putwin__ads.htm#ref_43_35">PutWin</A>; - </PRE></BODY></HTML> -diff -Naur ncurses-5.9/doc/html/ada/terminal_interface-curses-termcap__adb.htm ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-termcap__adb.htm ---- ncurses-5.9/doc/html/ada/terminal_interface-curses-termcap__adb.htm 2011-03-20 00:18:41.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-termcap__adb.htm 2014-09-01 16:33:22.297792024 +0200 -@@ -1,82 +1,94 @@ --<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> --<HTML><HEAD><TITLE>terminal_interface-curses-termcap.adb</TITLE></HEAD> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> -+<HTML> -+<HEAD> -+<TITLE>terminal_interface-curses-termcap.adb</TITLE> -+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> -+<style type="text/css"> -+*.comment { -+ color: green; -+} -+*.symbol { -+ color: red; -+} -+</style> -+</HEAD> - <BODY> --<HR><DIV ALIGN="center"><H1> File : terminal_interface-curses-termcap.adb </H1></DIV><HR> -+<HR><DIV style="text-align:center"><H1> File : terminal_interface-curses-termcap.adb </H1></DIV><HR> - <PRE> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Terminal_Interface.Curses.Termcap --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- B O D Y --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Copyright (c) 2000-2006,2009 Free Software Foundation, Inc. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></FONT> --<FONT COLOR=green><EM>-- copy of this software and associated documentation files (the --</EM></FONT> --<FONT COLOR=green><EM>-- "Software"), to deal in the Software without restriction, including --</EM></FONT> --<FONT COLOR=green><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></FONT> --<FONT COLOR=green><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></FONT> --<FONT COLOR=green><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></FONT> --<FONT COLOR=green><EM>-- furnished to do so, subject to the following conditions: --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- The above copyright notice and this permission notice shall be included --</EM></FONT> --<FONT COLOR=green><EM>-- in all copies or substantial portions of the Software. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></FONT> --<FONT COLOR=green><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></FONT> --<FONT COLOR=green><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></FONT> --<FONT COLOR=green><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></FONT> --<FONT COLOR=green><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></FONT> --<FONT COLOR=green><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></FONT> --<FONT COLOR=green><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></FONT> --<FONT COLOR=green><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></FONT> --<FONT COLOR=green><EM>-- sale, use or other dealings in this Software without prior written --</EM></FONT> --<FONT COLOR=green><EM>-- authorization. --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Author: Juergen Pfeifer, 1996</EM></FONT> --<FONT COLOR=green><EM>-- Version Control:</EM></FONT> --<FONT COLOR=green><EM>-- @Revision: 1.12 @</EM></FONT> --<FONT COLOR=green><EM>-- @Date: 2009/12/26 17:38:58 @</EM></FONT> --<FONT COLOR=green><EM>-- Binding Version 01.00</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Terminal_Interface.Curses.Termcap --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- B O D Y --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Copyright (c) 2000-2006,2009 Free Software Foundation, Inc. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></span> -+<span class="comment"><EM>-- copy of this software and associated documentation files (the --</EM></span> -+<span class="comment"><EM>-- "Software"), to deal in the Software without restriction, including --</EM></span> -+<span class="comment"><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></span> -+<span class="comment"><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></span> -+<span class="comment"><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></span> -+<span class="comment"><EM>-- furnished to do so, subject to the following conditions: --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- The above copyright notice and this permission notice shall be included --</EM></span> -+<span class="comment"><EM>-- in all copies or substantial portions of the Software. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></span> -+<span class="comment"><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></span> -+<span class="comment"><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></span> -+<span class="comment"><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></span> -+<span class="comment"><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></span> -+<span class="comment"><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></span> -+<span class="comment"><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></span> -+<span class="comment"><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></span> -+<span class="comment"><EM>-- sale, use or other dealings in this Software without prior written --</EM></span> -+<span class="comment"><EM>-- authorization. --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Author: Juergen Pfeifer, 1996</EM></span> -+<span class="comment"><EM>-- Version Control:</EM></span> -+<span class="comment"><EM>-- @Revision: 1.12 @</EM></span> -+<span class="comment"><EM>-- @Date: 2009/12/26 17:38:58 @</EM></span> -+<span class="comment"><EM>-- Binding Version 01.00</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> - - <b>with</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-aux__ads.htm#ref_50_35">Aux</A>; <b>use</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-aux__ads.htm#ref_50_35">Aux</A>; --<b>with</b> <A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>.C; <b>use</b> <A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>.C; --<b>with</b> <A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>.C.Strings; <b>use</b> <A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>.C.Strings; -+<b>with</b> <A HREF="interfac__ads.htm#ref_36_9">Interfaces</A>.C; <b>use</b> <A HREF="interfac__ads.htm#ref_36_9">Interfaces</A>.C; -+<b>with</b> <A HREF="interfac__ads.htm#ref_36_9">Interfaces</A>.C.Strings; <b>use</b> <A HREF="interfac__ads.htm#ref_36_9">Interfaces</A>.C.Strings; - --<b>package</b> <b>body</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<FONT COLOR=red><A NAME="ref_47_40" HREF="terminal_interface-curses-termcap__ads.htm#ref_42_35">Termcap</A></FONT> <b>is</b> -+<b>package</b> <b>body</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<span class="symbol"><A NAME="ref_47_40" HREF="terminal_interface-curses-termcap__ads.htm#ref_42_35">Termcap</A></span> <b>is</b> - -- <b>function</b> <FONT COLOR=red><A NAME="ref_49_13" HREF="terminal_interface-curses-termcap__ads.htm#ref_59_13">Get_Entry</A></FONT> (<FONT COLOR=red><A NAME="ref_49_24" HREF="terminal_interface-curses-termcap__ads.htm#ref_59_24">Name</A></FONT> : String) <b>return</b> Boolean -+ <b>function</b> <span class="symbol"><A NAME="ref_49_13" HREF="terminal_interface-curses-termcap__ads.htm#ref_59_13">Get_Entry</A></span> (<span class="symbol"><A NAME="ref_49_24" HREF="terminal_interface-curses-termcap__ads.htm#ref_59_24">Name</A></span> : String) <b>return</b> Boolean - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_51_16">tgetent</A></FONT> (<FONT COLOR=red><A NAME="ref_51_25" HREF="terminal_interface-curses-termcap__adb.htm#ref_51_16">name</A></FONT> : char_array; <FONT COLOR=red><A NAME="ref_51_44" HREF="terminal_interface-curses-termcap__adb.htm#ref_51_16">val</A></FONT> : char_array) -+ <b>function</b> <span class="symbol"><A NAME="ref_51_16">tgetent</A></span> (<span class="symbol"><A NAME="ref_51_25" HREF="terminal_interface-curses-termcap__adb.htm#ref_51_16">name</A></span> : char_array; <span class="symbol"><A NAME="ref_51_44" HREF="terminal_interface-curses-termcap__adb.htm#ref_51_16">val</A></span> : char_array) - <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, tgetent, "tgetent"); -- <FONT COLOR=red><A NAME="ref_54_7">NameTxt</A></FONT> : char_array (0 .. <A HREF="terminal_interface-curses-termcap__ads.htm#ref_59_24">Name</A>'Length); -- <FONT COLOR=red><A NAME="ref_55_7">Length</A></FONT> : size_t; -- <FONT COLOR=red><A NAME="ref_56_7">ignored</A></FONT> : <b>constant</b> char_array (0 .. 0) := (0 =&gt; nul); -- <FONT COLOR=red><A NAME="ref_57_7">result</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <span class="symbol"><A NAME="ref_54_7">NameTxt</A></span> : char_array (0 .. <A HREF="terminal_interface-curses-termcap__ads.htm#ref_59_24">Name</A>'Length); -+ <span class="symbol"><A NAME="ref_55_7">Length</A></span> : size_t; -+ <span class="symbol"><A NAME="ref_56_7">ignored</A></span> : <b>constant</b> char_array (0 .. 0) := (0 =&gt; nul); -+ <span class="symbol"><A NAME="ref_57_7">result</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>begin</b> - To_C (<A HREF="terminal_interface-curses-termcap__ads.htm#ref_59_24">Name</A>, <A HREF="terminal_interface-curses-termcap__adb.htm#ref_54_7">NameTxt</A>, <A HREF="terminal_interface-curses-termcap__adb.htm#ref_55_7">Length</A>); - <A HREF="terminal_interface-curses-termcap__adb.htm#ref_57_7">result</A> := <A HREF="terminal_interface-curses-termcap__adb.htm#ref_51_16">tgetent</A> (char_array (<A HREF="terminal_interface-curses-termcap__adb.htm#ref_56_7">ignored</A>), <A HREF="terminal_interface-curses-termcap__adb.htm#ref_54_7">NameTxt</A>); - <b>if</b> <A HREF="terminal_interface-curses-termcap__adb.htm#ref_57_7">result</A> = -1 <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>else</b> - <b>return</b> Boolean'Val (<A HREF="terminal_interface-curses-termcap__adb.htm#ref_57_7">result</A>); - <b>end</b> <b>if</b>; - <b>end</b> <A HREF="terminal_interface-curses-termcap__ads.htm#ref_59_13">Get_Entry</A>; - --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_69_13" HREF="terminal_interface-curses-termcap__ads.htm#ref_63_13">Get_Flag</A></FONT> (<FONT COLOR=red><A NAME="ref_69_23" HREF="terminal_interface-curses-termcap__ads.htm#ref_63_23">Name</A></FONT> : String) <b>return</b> Boolean -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_69_13" HREF="terminal_interface-curses-termcap__ads.htm#ref_63_13">Get_Flag</A></span> (<span class="symbol"><A NAME="ref_69_23" HREF="terminal_interface-curses-termcap__ads.htm#ref_63_23">Name</A></span> : String) <b>return</b> Boolean - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_71_16">tgetflag</A></FONT> (<FONT COLOR=red><A NAME="ref_71_26" HREF="terminal_interface-curses-termcap__adb.htm#ref_71_16">id</A></FONT> : char_array) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_71_16">tgetflag</A></span> (<span class="symbol"><A NAME="ref_71_26" HREF="terminal_interface-curses-termcap__adb.htm#ref_71_16">id</A></span> : char_array) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, tgetflag, "tgetflag"); -- <FONT COLOR=red><A NAME="ref_73_7">Txt</A></FONT> : char_array (0 .. <A HREF="terminal_interface-curses-termcap__ads.htm#ref_63_23">Name</A>'Length); -- <FONT COLOR=red><A NAME="ref_74_7">Length</A></FONT> : size_t; -+ <span class="symbol"><A NAME="ref_73_7">Txt</A></span> : char_array (0 .. <A HREF="terminal_interface-curses-termcap__ads.htm#ref_63_23">Name</A>'Length); -+ <span class="symbol"><A NAME="ref_74_7">Length</A></span> : size_t; - <b>begin</b> - To_C (<A HREF="terminal_interface-curses-termcap__ads.htm#ref_63_23">Name</A>, <A HREF="terminal_interface-curses-termcap__adb.htm#ref_73_7">Txt</A>, <A HREF="terminal_interface-curses-termcap__adb.htm#ref_74_7">Length</A>); - <b>if</b> <A HREF="terminal_interface-curses-termcap__adb.htm#ref_71_16">tgetflag</A> (<A HREF="terminal_interface-curses-termcap__adb.htm#ref_73_7">Txt</A>) = 0 <b>then</b> -@@ -86,15 +98,15 @@ - <b>end</b> <b>if</b>; - <b>end</b> <A HREF="terminal_interface-curses-termcap__ads.htm#ref_63_13">Get_Flag</A>; - --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_85_14" HREF="terminal_interface-curses-termcap__ads.htm#ref_67_14">Get_Number</A></FONT> (<FONT COLOR=red><A NAME="ref_85_26" HREF="terminal_interface-curses-termcap__ads.htm#ref_67_26">Name</A></FONT> : String; -- <FONT COLOR=red><A NAME="ref_86_26" HREF="terminal_interface-curses-termcap__ads.htm#ref_68_26">Value</A></FONT> : <b>out</b> Integer; -- <FONT COLOR=red><A NAME="ref_87_26" HREF="terminal_interface-curses-termcap__ads.htm#ref_69_26">Result</A></FONT> : <b>out</b> Boolean) -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_85_14" HREF="terminal_interface-curses-termcap__ads.htm#ref_67_14">Get_Number</A></span> (<span class="symbol"><A NAME="ref_85_26" HREF="terminal_interface-curses-termcap__ads.htm#ref_67_26">Name</A></span> : String; -+ <span class="symbol"><A NAME="ref_86_26" HREF="terminal_interface-curses-termcap__ads.htm#ref_68_26">Value</A></span> : <b>out</b> Integer; -+ <span class="symbol"><A NAME="ref_87_26" HREF="terminal_interface-curses-termcap__ads.htm#ref_69_26">Result</A></span> : <b>out</b> Boolean) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_89_16">tgetnum</A></FONT> (<FONT COLOR=red><A NAME="ref_89_25" HREF="terminal_interface-curses-termcap__adb.htm#ref_89_16">id</A></FONT> : char_array) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_89_16">tgetnum</A></span> (<span class="symbol"><A NAME="ref_89_25" HREF="terminal_interface-curses-termcap__adb.htm#ref_89_16">id</A></span> : char_array) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, tgetnum, "tgetnum"); -- <FONT COLOR=red><A NAME="ref_91_7">Txt</A></FONT> : char_array (0 .. <A HREF="terminal_interface-curses-termcap__ads.htm#ref_67_26">Name</A>'Length); -- <FONT COLOR=red><A NAME="ref_92_7">Length</A></FONT> : size_t; -+ <span class="symbol"><A NAME="ref_91_7">Txt</A></span> : char_array (0 .. <A HREF="terminal_interface-curses-termcap__ads.htm#ref_67_26">Name</A>'Length); -+ <span class="symbol"><A NAME="ref_92_7">Length</A></span> : size_t; - <b>begin</b> - To_C (<A HREF="terminal_interface-curses-termcap__ads.htm#ref_67_26">Name</A>, <A HREF="terminal_interface-curses-termcap__adb.htm#ref_91_7">Txt</A>, <A HREF="terminal_interface-curses-termcap__adb.htm#ref_92_7">Length</A>); - <A HREF="terminal_interface-curses-termcap__ads.htm#ref_68_26">Value</A> := Integer (<A HREF="terminal_interface-curses-termcap__adb.htm#ref_89_16">tgetnum</A> (<A HREF="terminal_interface-curses-termcap__adb.htm#ref_91_7">Txt</A>)); -@@ -105,19 +117,19 @@ - <b>end</b> <b>if</b>; - <b>end</b> <A HREF="terminal_interface-curses-termcap__ads.htm#ref_67_14">Get_Number</A>; - --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_104_14" HREF="terminal_interface-curses-termcap__ads.htm#ref_73_14">Get_String</A></FONT> (<FONT COLOR=red><A NAME="ref_104_26" HREF="terminal_interface-curses-termcap__ads.htm#ref_73_26">Name</A></FONT> : String; -- <FONT COLOR=red><A NAME="ref_105_26" HREF="terminal_interface-curses-termcap__ads.htm#ref_74_26">Value</A></FONT> : <b>out</b> String; -- <FONT COLOR=red><A NAME="ref_106_26" HREF="terminal_interface-curses-termcap__ads.htm#ref_75_26">Result</A></FONT> : <b>out</b> Boolean) -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_104_14" HREF="terminal_interface-curses-termcap__ads.htm#ref_73_14">Get_String</A></span> (<span class="symbol"><A NAME="ref_104_26" HREF="terminal_interface-curses-termcap__ads.htm#ref_73_26">Name</A></span> : String; -+ <span class="symbol"><A NAME="ref_105_26" HREF="terminal_interface-curses-termcap__ads.htm#ref_74_26">Value</A></span> : <b>out</b> String; -+ <span class="symbol"><A NAME="ref_106_26" HREF="terminal_interface-curses-termcap__ads.htm#ref_75_26">Result</A></span> : <b>out</b> Boolean) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_108_16">tgetstr</A></FONT> (<FONT COLOR=red><A NAME="ref_108_25" HREF="terminal_interface-curses-termcap__adb.htm#ref_108_16">id</A></FONT> : char_array; -- <FONT COLOR=red><A NAME="ref_109_25" HREF="terminal_interface-curses-termcap__adb.htm#ref_108_16">buf</A></FONT> : char_array) <b>return</b> chars_ptr; -+ <b>function</b> <span class="symbol"><A NAME="ref_108_16">tgetstr</A></span> (<span class="symbol"><A NAME="ref_108_25" HREF="terminal_interface-curses-termcap__adb.htm#ref_108_16">id</A></span> : char_array; -+ <span class="symbol"><A NAME="ref_109_25" HREF="terminal_interface-curses-termcap__adb.htm#ref_108_16">buf</A></span> : char_array) <b>return</b> chars_ptr; - <b>pragma</b> Import (C, tgetstr, "tgetstr"); -- <FONT COLOR=red><A NAME="ref_111_7">Txt</A></FONT> : char_array (0 .. <A HREF="terminal_interface-curses-termcap__ads.htm#ref_73_26">Name</A>'Length); -- <FONT COLOR=red><A NAME="ref_112_7">Length</A></FONT> : size_t; -- <FONT COLOR=red><A NAME="ref_113_7">Txt2</A></FONT> : chars_ptr; -- <b>type</b> t <b>is</b> <b>new</b> char_array (0 .. 1024); <FONT COLOR=green><EM>-- does it need to be 1024?</EM></FONT> -- <FONT COLOR=red><A NAME="ref_115_7">Return_Buffer</A></FONT> : <b>constant</b> t := (<b>others</b> =&gt; nul); -+ <span class="symbol"><A NAME="ref_111_7">Txt</A></span> : char_array (0 .. <A HREF="terminal_interface-curses-termcap__ads.htm#ref_73_26">Name</A>'Length); -+ <span class="symbol"><A NAME="ref_112_7">Length</A></span> : size_t; -+ <span class="symbol"><A NAME="ref_113_7">Txt2</A></span> : chars_ptr; -+ <b>type</b> t <b>is</b> <b>new</b> char_array (0 .. 1024); <span class="comment"><EM>-- does it need to be 1024?</EM></span> -+ <span class="symbol"><A NAME="ref_115_7">Return_Buffer</A></span> : <b>constant</b> t := (<b>others</b> =&gt; nul); - <b>begin</b> - To_C (<A HREF="terminal_interface-curses-termcap__ads.htm#ref_73_26">Name</A>, <A HREF="terminal_interface-curses-termcap__adb.htm#ref_111_7">Txt</A>, <A HREF="terminal_interface-curses-termcap__adb.htm#ref_112_7">Length</A>); - <A HREF="terminal_interface-curses-termcap__adb.htm#ref_113_7">Txt2</A> := <A HREF="terminal_interface-curses-termcap__adb.htm#ref_108_16">tgetstr</A> (<A HREF="terminal_interface-curses-termcap__adb.htm#ref_111_7">Txt</A>, char_array (<A HREF="terminal_interface-curses-termcap__adb.htm#ref_115_7">Return_Buffer</A>)); -@@ -129,16 +141,16 @@ - <b>end</b> <b>if</b>; - <b>end</b> <A HREF="terminal_interface-curses-termcap__ads.htm#ref_73_14">Get_String</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_127_13" HREF="terminal_interface-curses-termcap__ads.htm#ref_76_13">Get_String</A></FONT> (<FONT COLOR=red><A NAME="ref_127_25" HREF="terminal_interface-curses-termcap__ads.htm#ref_76_25">Name</A></FONT> : String) <b>return</b> Boolean -+ <b>function</b> <span class="symbol"><A NAME="ref_127_13" HREF="terminal_interface-curses-termcap__ads.htm#ref_76_13">Get_String</A></span> (<span class="symbol"><A NAME="ref_127_25" HREF="terminal_interface-curses-termcap__ads.htm#ref_76_25">Name</A></span> : String) <b>return</b> Boolean - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_129_16">tgetstr</A></FONT> (<FONT COLOR=red><A NAME="ref_129_25" HREF="terminal_interface-curses-termcap__adb.htm#ref_129_16">Id</A></FONT> : char_array; -- <FONT COLOR=red><A NAME="ref_130_25" HREF="terminal_interface-curses-termcap__adb.htm#ref_129_16">buf</A></FONT> : char_array) <b>return</b> chars_ptr; -+ <b>function</b> <span class="symbol"><A NAME="ref_129_16">tgetstr</A></span> (<span class="symbol"><A NAME="ref_129_25" HREF="terminal_interface-curses-termcap__adb.htm#ref_129_16">Id</A></span> : char_array; -+ <span class="symbol"><A NAME="ref_130_25" HREF="terminal_interface-curses-termcap__adb.htm#ref_129_16">buf</A></span> : char_array) <b>return</b> chars_ptr; - <b>pragma</b> Import (C, tgetstr, "tgetstr"); -- <FONT COLOR=red><A NAME="ref_132_7">Txt</A></FONT> : char_array (0 .. <A HREF="terminal_interface-curses-termcap__ads.htm#ref_76_25">Name</A>'Length); -- <FONT COLOR=red><A NAME="ref_133_7">Length</A></FONT> : size_t; -- <FONT COLOR=red><A NAME="ref_134_7">Txt2</A></FONT> : chars_ptr; -- <b>type</b> t <b>is</b> <b>new</b> char_array (0 .. 1024); <FONT COLOR=green><EM>-- does it need to be 1024?</EM></FONT> -- <FONT COLOR=red><A NAME="ref_136_7">Phony_Txt</A></FONT> : <b>constant</b> t := (<b>others</b> =&gt; nul); -+ <span class="symbol"><A NAME="ref_132_7">Txt</A></span> : char_array (0 .. <A HREF="terminal_interface-curses-termcap__ads.htm#ref_76_25">Name</A>'Length); -+ <span class="symbol"><A NAME="ref_133_7">Length</A></span> : size_t; -+ <span class="symbol"><A NAME="ref_134_7">Txt2</A></span> : chars_ptr; -+ <b>type</b> t <b>is</b> <b>new</b> char_array (0 .. 1024); <span class="comment"><EM>-- does it need to be 1024?</EM></span> -+ <span class="symbol"><A NAME="ref_136_7">Phony_Txt</A></span> : <b>constant</b> t := (<b>others</b> =&gt; nul); - <b>begin</b> - To_C (<A HREF="terminal_interface-curses-termcap__ads.htm#ref_76_25">Name</A>, <A HREF="terminal_interface-curses-termcap__adb.htm#ref_132_7">Txt</A>, <A HREF="terminal_interface-curses-termcap__adb.htm#ref_133_7">Length</A>); - <A HREF="terminal_interface-curses-termcap__adb.htm#ref_134_7">Txt2</A> := <A HREF="terminal_interface-curses-termcap__adb.htm#ref_129_16">tgetstr</A> (<A HREF="terminal_interface-curses-termcap__adb.htm#ref_132_7">Txt</A>, char_array (<A HREF="terminal_interface-curses-termcap__adb.htm#ref_136_7">Phony_Txt</A>)); -@@ -149,16 +161,16 @@ - <b>end</b> <b>if</b>; - <b>end</b> <A HREF="terminal_interface-curses-termcap__ads.htm#ref_76_13">Get_String</A>; - --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_148_13" HREF="terminal_interface-curses-termcap__ads.htm#ref_53_13">TGoto</A></FONT> (<FONT COLOR=red><A NAME="ref_148_20" HREF="terminal_interface-curses-termcap__ads.htm#ref_53_20">Cap</A></FONT> : String; -- <FONT COLOR=red><A NAME="ref_149_20" HREF="terminal_interface-curses-termcap__ads.htm#ref_54_20">Col</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -- <FONT COLOR=red><A NAME="ref_150_20" HREF="terminal_interface-curses-termcap__ads.htm#ref_55_20">Row</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>) <b>return</b> Termcap_String <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_151_16">tgoto</A></FONT> (<FONT COLOR=red><A NAME="ref_151_23" HREF="terminal_interface-curses-termcap__adb.htm#ref_151_16">cap</A></FONT> : char_array; -- <FONT COLOR=red><A NAME="ref_152_23" HREF="terminal_interface-curses-termcap__adb.htm#ref_151_16">col</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -- <FONT COLOR=red><A NAME="ref_153_23" HREF="terminal_interface-curses-termcap__adb.htm#ref_151_16">row</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> chars_ptr; -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_148_13" HREF="terminal_interface-curses-termcap__ads.htm#ref_53_13">TGoto</A></span> (<span class="symbol"><A NAME="ref_148_20" HREF="terminal_interface-curses-termcap__ads.htm#ref_53_20">Cap</A></span> : String; -+ <span class="symbol"><A NAME="ref_149_20" HREF="terminal_interface-curses-termcap__ads.htm#ref_54_20">Col</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -+ <span class="symbol"><A NAME="ref_150_20" HREF="terminal_interface-curses-termcap__ads.htm#ref_55_20">Row</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>) <b>return</b> Termcap_String <b>is</b> -+ <b>function</b> <span class="symbol"><A NAME="ref_151_16">tgoto</A></span> (<span class="symbol"><A NAME="ref_151_23" HREF="terminal_interface-curses-termcap__adb.htm#ref_151_16">cap</A></span> : char_array; -+ <span class="symbol"><A NAME="ref_152_23" HREF="terminal_interface-curses-termcap__adb.htm#ref_151_16">col</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <span class="symbol"><A NAME="ref_153_23" HREF="terminal_interface-curses-termcap__adb.htm#ref_151_16">row</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> chars_ptr; - <b>pragma</b> Import (C, tgoto); -- <FONT COLOR=red><A NAME="ref_155_7">Txt</A></FONT> : char_array (0 .. <A HREF="terminal_interface-curses-termcap__ads.htm#ref_53_20">Cap</A>'Length); -- <FONT COLOR=red><A NAME="ref_156_7">Length</A></FONT> : size_t; -+ <span class="symbol"><A NAME="ref_155_7">Txt</A></span> : char_array (0 .. <A HREF="terminal_interface-curses-termcap__ads.htm#ref_53_20">Cap</A>'Length); -+ <span class="symbol"><A NAME="ref_156_7">Length</A></span> : size_t; - <b>begin</b> - To_C (<A HREF="terminal_interface-curses-termcap__ads.htm#ref_53_20">Cap</A>, <A HREF="terminal_interface-curses-termcap__adb.htm#ref_155_7">Txt</A>, <A HREF="terminal_interface-curses-termcap__adb.htm#ref_156_7">Length</A>); - <b>return</b> Termcap_String (<A HREF="terminal_interface-curses-aux__ads.htm#ref_121_13">Fill_String</A> -diff -Naur ncurses-5.9/doc/html/ada/terminal_interface-curses-termcap__ads.htm ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-termcap__ads.htm ---- ncurses-5.9/doc/html/ada/terminal_interface-curses-termcap__ads.htm 2008-10-11 23:36:31.000000000 +0200 -+++ ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-termcap__ads.htm 2014-09-01 16:33:22.297792024 +0200 -@@ -1,86 +1,98 @@ --<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> --<HTML><HEAD><TITLE>terminal_interface-curses-termcap.ads</TITLE></HEAD> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> -+<HTML> -+<HEAD> -+<TITLE>terminal_interface-curses-termcap.ads</TITLE> -+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> -+<style type="text/css"> -+*.comment { -+ color: green; -+} -+*.symbol { -+ color: red; -+} -+</style> -+</HEAD> - <BODY> --<HR><DIV ALIGN="center"><H1> File : terminal_interface-curses-termcap.ads </H1></DIV><HR> -+<HR><DIV style="text-align:center"><H1> File : terminal_interface-curses-termcap.ads </H1></DIV><HR> - <PRE> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Terminal_Interface.Curses.Termcap --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- S P E C --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Copyright (c) 2000 Free Software Foundation, Inc. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></FONT> --<FONT COLOR=green><EM>-- copy of this software and associated documentation files (the --</EM></FONT> --<FONT COLOR=green><EM>-- "Software"), to deal in the Software without restriction, including --</EM></FONT> --<FONT COLOR=green><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></FONT> --<FONT COLOR=green><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></FONT> --<FONT COLOR=green><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></FONT> --<FONT COLOR=green><EM>-- furnished to do so, subject to the following conditions: --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- The above copyright notice and this permission notice shall be included --</EM></FONT> --<FONT COLOR=green><EM>-- in all copies or substantial portions of the Software. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></FONT> --<FONT COLOR=green><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></FONT> --<FONT COLOR=green><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></FONT> --<FONT COLOR=green><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></FONT> --<FONT COLOR=green><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></FONT> --<FONT COLOR=green><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></FONT> --<FONT COLOR=green><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></FONT> --<FONT COLOR=green><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></FONT> --<FONT COLOR=green><EM>-- sale, use or other dealings in this Software without prior written --</EM></FONT> --<FONT COLOR=green><EM>-- authorization. --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Author: Juergen Pfeifer, 1996</EM></FONT> --<FONT COLOR=green><EM>-- Version Control:</EM></FONT> --<FONT COLOR=green><EM>-- @Revision: 1.3 @</EM></FONT> --<FONT COLOR=green><EM>-- Binding Version 01.00</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Terminal_Interface.Curses.Termcap --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- S P E C --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Copyright (c) 2000 Free Software Foundation, Inc. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></span> -+<span class="comment"><EM>-- copy of this software and associated documentation files (the --</EM></span> -+<span class="comment"><EM>-- "Software"), to deal in the Software without restriction, including --</EM></span> -+<span class="comment"><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></span> -+<span class="comment"><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></span> -+<span class="comment"><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></span> -+<span class="comment"><EM>-- furnished to do so, subject to the following conditions: --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- The above copyright notice and this permission notice shall be included --</EM></span> -+<span class="comment"><EM>-- in all copies or substantial portions of the Software. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></span> -+<span class="comment"><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></span> -+<span class="comment"><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></span> -+<span class="comment"><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></span> -+<span class="comment"><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></span> -+<span class="comment"><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></span> -+<span class="comment"><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></span> -+<span class="comment"><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></span> -+<span class="comment"><EM>-- sale, use or other dealings in this Software without prior written --</EM></span> -+<span class="comment"><EM>-- authorization. --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Author: Juergen Pfeifer, 1996</EM></span> -+<span class="comment"><EM>-- Version Control:</EM></span> -+<span class="comment"><EM>-- @Revision: 1.3 @</EM></span> -+<span class="comment"><EM>-- Binding Version 01.00</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> - --<b>package</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<FONT COLOR=red><A NAME="ref_42_35" HREF="terminal_interface-curses-termcap__adb.htm#ref_47_40">Termcap</A></FONT> <b>is</b> -+<b>package</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<span class="symbol"><A NAME="ref_42_35" HREF="terminal_interface-curses-termcap__adb.htm#ref_47_40">Termcap</A></span> <b>is</b> - <b>pragma</b> Preelaborate (<A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-termcap__ads.htm#ref_42_35">Termcap</A>); - -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page curs_termcap.3x</EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- Not implemented: tputs (see curs_terminfo)</EM></FONT> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page curs_termcap.3x</EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- Not implemented: tputs (see curs_terminfo)</EM></span> - - <b>type</b> Termcap_String <b>is</b> <b>new</b> String; - -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_53_13" HREF="terminal_interface-curses-termcap__adb.htm#ref_148_13">TGoto</A></FONT> (<FONT COLOR=red><A NAME="ref_53_20" HREF="terminal_interface-curses-termcap__adb.htm#ref_148_20">Cap</A></FONT> : String; -- <FONT COLOR=red><A NAME="ref_54_20" HREF="terminal_interface-curses-termcap__adb.htm#ref_149_20">Col</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -- <FONT COLOR=red><A NAME="ref_55_20" HREF="terminal_interface-curses-termcap__adb.htm#ref_150_20">Row</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>) <b>return</b> Termcap_String; -- <FONT COLOR=green><EM>-- AKA: tgoto()</EM></FONT> -- -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_59_13" HREF="terminal_interface-curses-termcap__adb.htm#ref_49_13">Get_Entry</A></FONT> (<FONT COLOR=red><A NAME="ref_59_24" HREF="terminal_interface-curses-termcap__adb.htm#ref_49_24">Name</A></FONT> : String) <b>return</b> Boolean; -- <FONT COLOR=green><EM>-- AKA: tgetent()</EM></FONT> -- -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_63_13" HREF="terminal_interface-curses-termcap__adb.htm#ref_69_13">Get_Flag</A></FONT> (<FONT COLOR=red><A NAME="ref_63_23" HREF="terminal_interface-curses-termcap__adb.htm#ref_69_23">Name</A></FONT> : String) <b>return</b> Boolean; -- <FONT COLOR=green><EM>-- AKA: tgetflag()</EM></FONT> -- -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_67_14" HREF="terminal_interface-curses-termcap__adb.htm#ref_85_14">Get_Number</A></FONT> (<FONT COLOR=red><A NAME="ref_67_26" HREF="terminal_interface-curses-termcap__adb.htm#ref_85_26">Name</A></FONT> : String; -- <FONT COLOR=red><A NAME="ref_68_26" HREF="terminal_interface-curses-termcap__adb.htm#ref_86_26">Value</A></FONT> : <b>out</b> Integer; -- <FONT COLOR=red><A NAME="ref_69_26" HREF="terminal_interface-curses-termcap__adb.htm#ref_87_26">Result</A></FONT> : <b>out</b> Boolean); -- <FONT COLOR=green><EM>-- AKA: tgetnum()</EM></FONT> -- -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_73_14" HREF="terminal_interface-curses-termcap__adb.htm#ref_104_14">Get_String</A></FONT> (<FONT COLOR=red><A NAME="ref_73_26" HREF="terminal_interface-curses-termcap__adb.htm#ref_104_26">Name</A></FONT> : String; -- <FONT COLOR=red><A NAME="ref_74_26" HREF="terminal_interface-curses-termcap__adb.htm#ref_105_26">Value</A></FONT> : <b>out</b> String; -- <FONT COLOR=red><A NAME="ref_75_26" HREF="terminal_interface-curses-termcap__adb.htm#ref_106_26">Result</A></FONT> : <b>out</b> Boolean); -- <b>function</b> <FONT COLOR=red><A NAME="ref_76_13" HREF="terminal_interface-curses-termcap__adb.htm#ref_127_13">Get_String</A></FONT> (<FONT COLOR=red><A NAME="ref_76_25" HREF="terminal_interface-curses-termcap__adb.htm#ref_127_25">Name</A></FONT> : String) <b>return</b> Boolean; -- <FONT COLOR=green><EM>-- Returns True if the string is found.</EM></FONT> -- <FONT COLOR=green><EM>-- AKA: tgetstr()</EM></FONT> -+ <span class="comment"><EM>-- |</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_53_13" HREF="terminal_interface-curses-termcap__adb.htm#ref_148_13">TGoto</A></span> (<span class="symbol"><A NAME="ref_53_20" HREF="terminal_interface-curses-termcap__adb.htm#ref_148_20">Cap</A></span> : String; -+ <span class="symbol"><A NAME="ref_54_20" HREF="terminal_interface-curses-termcap__adb.htm#ref_149_20">Col</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -+ <span class="symbol"><A NAME="ref_55_20" HREF="terminal_interface-curses-termcap__adb.htm#ref_150_20">Row</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>) <b>return</b> Termcap_String; -+ <span class="comment"><EM>-- AKA: tgoto()</EM></span> -+ -+ <span class="comment"><EM>-- |</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_59_13" HREF="terminal_interface-curses-termcap__adb.htm#ref_49_13">Get_Entry</A></span> (<span class="symbol"><A NAME="ref_59_24" HREF="terminal_interface-curses-termcap__adb.htm#ref_49_24">Name</A></span> : String) <b>return</b> Boolean; -+ <span class="comment"><EM>-- AKA: tgetent()</EM></span> -+ -+ <span class="comment"><EM>-- |</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_63_13" HREF="terminal_interface-curses-termcap__adb.htm#ref_69_13">Get_Flag</A></span> (<span class="symbol"><A NAME="ref_63_23" HREF="terminal_interface-curses-termcap__adb.htm#ref_69_23">Name</A></span> : String) <b>return</b> Boolean; -+ <span class="comment"><EM>-- AKA: tgetflag()</EM></span> -+ -+ <span class="comment"><EM>-- |</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_67_14" HREF="terminal_interface-curses-termcap__adb.htm#ref_85_14">Get_Number</A></span> (<span class="symbol"><A NAME="ref_67_26" HREF="terminal_interface-curses-termcap__adb.htm#ref_85_26">Name</A></span> : String; -+ <span class="symbol"><A NAME="ref_68_26" HREF="terminal_interface-curses-termcap__adb.htm#ref_86_26">Value</A></span> : <b>out</b> Integer; -+ <span class="symbol"><A NAME="ref_69_26" HREF="terminal_interface-curses-termcap__adb.htm#ref_87_26">Result</A></span> : <b>out</b> Boolean); -+ <span class="comment"><EM>-- AKA: tgetnum()</EM></span> -+ -+ <span class="comment"><EM>-- |</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_73_14" HREF="terminal_interface-curses-termcap__adb.htm#ref_104_14">Get_String</A></span> (<span class="symbol"><A NAME="ref_73_26" HREF="terminal_interface-curses-termcap__adb.htm#ref_104_26">Name</A></span> : String; -+ <span class="symbol"><A NAME="ref_74_26" HREF="terminal_interface-curses-termcap__adb.htm#ref_105_26">Value</A></span> : <b>out</b> String; -+ <span class="symbol"><A NAME="ref_75_26" HREF="terminal_interface-curses-termcap__adb.htm#ref_106_26">Result</A></span> : <b>out</b> Boolean); -+ <b>function</b> <span class="symbol"><A NAME="ref_76_13" HREF="terminal_interface-curses-termcap__adb.htm#ref_127_13">Get_String</A></span> (<span class="symbol"><A NAME="ref_76_25" HREF="terminal_interface-curses-termcap__adb.htm#ref_127_25">Name</A></span> : String) <b>return</b> Boolean; -+ <span class="comment"><EM>-- Returns True if the string is found.</EM></span> -+ <span class="comment"><EM>-- AKA: tgetstr()</EM></span> - - <b>end</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-termcap__ads.htm#ref_42_35">Termcap</A>; - </PRE></BODY></HTML> -diff -Naur ncurses-5.9/doc/html/ada/terminal_interface-curses-terminfo__adb.htm ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-terminfo__adb.htm ---- ncurses-5.9/doc/html/ada/terminal_interface-curses-terminfo__adb.htm 2011-03-20 00:18:41.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-terminfo__adb.htm 2014-09-01 16:33:22.298792026 +0200 -@@ -1,62 +1,74 @@ --<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> --<HTML><HEAD><TITLE>terminal_interface-curses-terminfo.adb</TITLE></HEAD> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> -+<HTML> -+<HEAD> -+<TITLE>terminal_interface-curses-terminfo.adb</TITLE> -+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> -+<style type="text/css"> -+*.comment { -+ color: green; -+} -+*.symbol { -+ color: red; -+} -+</style> -+</HEAD> - <BODY> --<HR><DIV ALIGN="center"><H1> File : terminal_interface-curses-terminfo.adb </H1></DIV><HR> -+<HR><DIV style="text-align:center"><H1> File : terminal_interface-curses-terminfo.adb </H1></DIV><HR> - <PRE> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Terminal_Interface.Curses.Terminfo --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- B O D Y --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Copyright (c) 1998-2006,2009 Free Software Foundation, Inc. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></FONT> --<FONT COLOR=green><EM>-- copy of this software and associated documentation files (the --</EM></FONT> --<FONT COLOR=green><EM>-- "Software"), to deal in the Software without restriction, including --</EM></FONT> --<FONT COLOR=green><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></FONT> --<FONT COLOR=green><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></FONT> --<FONT COLOR=green><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></FONT> --<FONT COLOR=green><EM>-- furnished to do so, subject to the following conditions: --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- The above copyright notice and this permission notice shall be included --</EM></FONT> --<FONT COLOR=green><EM>-- in all copies or substantial portions of the Software. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></FONT> --<FONT COLOR=green><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></FONT> --<FONT COLOR=green><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></FONT> --<FONT COLOR=green><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></FONT> --<FONT COLOR=green><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></FONT> --<FONT COLOR=green><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></FONT> --<FONT COLOR=green><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></FONT> --<FONT COLOR=green><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></FONT> --<FONT COLOR=green><EM>-- sale, use or other dealings in this Software without prior written --</EM></FONT> --<FONT COLOR=green><EM>-- authorization. --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Author: Juergen Pfeifer, 1996</EM></FONT> --<FONT COLOR=green><EM>-- Version Control:</EM></FONT> --<FONT COLOR=green><EM>-- @Revision: 1.6 @</EM></FONT> --<FONT COLOR=green><EM>-- @Date: 2009/12/26 17:38:58 @</EM></FONT> --<FONT COLOR=green><EM>-- Binding Version 01.00</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Terminal_Interface.Curses.Terminfo --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- B O D Y --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Copyright (c) 1998-2006,2009 Free Software Foundation, Inc. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></span> -+<span class="comment"><EM>-- copy of this software and associated documentation files (the --</EM></span> -+<span class="comment"><EM>-- "Software"), to deal in the Software without restriction, including --</EM></span> -+<span class="comment"><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></span> -+<span class="comment"><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></span> -+<span class="comment"><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></span> -+<span class="comment"><EM>-- furnished to do so, subject to the following conditions: --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- The above copyright notice and this permission notice shall be included --</EM></span> -+<span class="comment"><EM>-- in all copies or substantial portions of the Software. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></span> -+<span class="comment"><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></span> -+<span class="comment"><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></span> -+<span class="comment"><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></span> -+<span class="comment"><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></span> -+<span class="comment"><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></span> -+<span class="comment"><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></span> -+<span class="comment"><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></span> -+<span class="comment"><EM>-- sale, use or other dealings in this Software without prior written --</EM></span> -+<span class="comment"><EM>-- authorization. --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Author: Juergen Pfeifer, 1996</EM></span> -+<span class="comment"><EM>-- Version Control:</EM></span> -+<span class="comment"><EM>-- @Revision: 1.6 @</EM></span> -+<span class="comment"><EM>-- @Date: 2009/12/26 17:38:58 @</EM></span> -+<span class="comment"><EM>-- Binding Version 01.00</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> - - <b>with</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-aux__ads.htm#ref_50_35">Aux</A>; <b>use</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-aux__ads.htm#ref_50_35">Aux</A>; --<b>with</b> <A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>.C; <b>use</b> <A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>.C; --<b>with</b> <A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>.C.Strings; <b>use</b> <A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>.C.Strings; -+<b>with</b> <A HREF="interfac__ads.htm#ref_36_9">Interfaces</A>.C; <b>use</b> <A HREF="interfac__ads.htm#ref_36_9">Interfaces</A>.C; -+<b>with</b> <A HREF="interfac__ads.htm#ref_36_9">Interfaces</A>.C.Strings; <b>use</b> <A HREF="interfac__ads.htm#ref_36_9">Interfaces</A>.C.Strings; - <b>with</b> Ada.Unchecked_Conversion; - --<b>package</b> <b>body</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<FONT COLOR=red><A NAME="ref_48_40" HREF="terminal_interface-curses-terminfo__ads.htm#ref_44_35">Terminfo</A></FONT> <b>is</b> -+<b>package</b> <b>body</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<span class="symbol"><A NAME="ref_48_40" HREF="terminal_interface-curses-terminfo__ads.htm#ref_44_35">Terminfo</A></span> <b>is</b> - -- <b>function</b> <FONT COLOR=red><A NAME="ref_50_13" HREF="terminal_interface-curses-terminfo__adb.htm#ref_52_13">Is_MinusOne_Pointer</A></FONT> (<FONT COLOR=red><A NAME="ref_50_34" HREF="terminal_interface-curses-terminfo__adb.htm#ref_52_34">P</A></FONT> : chars_ptr) <b>return</b> Boolean; -+ <b>function</b> <span class="symbol"><A NAME="ref_50_13" HREF="terminal_interface-curses-terminfo__adb.htm#ref_52_13">Is_MinusOne_Pointer</A></span> (<span class="symbol"><A NAME="ref_50_34" HREF="terminal_interface-curses-terminfo__adb.htm#ref_52_34">P</A></span> : chars_ptr) <b>return</b> Boolean; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_52_13" HREF="terminal_interface-curses-terminfo__adb.htm#ref_50_13">Is_MinusOne_Pointer</A></FONT> (<FONT COLOR=red><A NAME="ref_52_34" HREF="terminal_interface-curses-terminfo__adb.htm#ref_50_34">P</A></FONT> : chars_ptr) <b>return</b> Boolean <b>is</b> -- <b>type</b> <FONT COLOR=red><A NAME="ref_53_12">Weird_Address</A></FONT> <b>is</b> <b>new</b> System.Storage_Elements.Integer_Address; -- <FONT COLOR=red><A NAME="ref_54_7">Invalid_Pointer</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-terminfo__adb.htm#ref_53_12">Weird_Address</A> := -1; -+ <b>function</b> <span class="symbol"><A NAME="ref_52_13" HREF="terminal_interface-curses-terminfo__adb.htm#ref_50_13">Is_MinusOne_Pointer</A></span> (<span class="symbol"><A NAME="ref_52_34" HREF="terminal_interface-curses-terminfo__adb.htm#ref_50_34">P</A></span> : chars_ptr) <b>return</b> Boolean <b>is</b> -+ <b>type</b> <span class="symbol"><A NAME="ref_53_12">Weird_Address</A></span> <b>is</b> <b>new</b> System.Storage_Elements.Integer_Address; -+ <span class="symbol"><A NAME="ref_54_7">Invalid_Pointer</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-terminfo__adb.htm#ref_53_12">Weird_Address</A> := -1; - <b>function</b> To_Weird <b>is</b> <b>new</b> Ada.Unchecked_Conversion - (Source =&gt; chars_ptr, Target =&gt; <A HREF="terminal_interface-curses-terminfo__adb.htm#ref_53_12">Weird_Address</A>); - <b>begin</b> -@@ -68,89 +80,89 @@ - <b>end</b> <A HREF="terminal_interface-curses-terminfo__adb.htm#ref_50_13">Is_MinusOne_Pointer</A>; - <b>pragma</b> Inline (<A HREF="terminal_interface-curses-terminfo__adb.htm#ref_50_13">Is_MinusOne_Pointer</A>); - --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_67_13" HREF="terminal_interface-curses-terminfo__ads.htm#ref_64_13">Get_Flag</A></FONT> (<FONT COLOR=red><A NAME="ref_67_23" HREF="terminal_interface-curses-terminfo__ads.htm#ref_64_23">Name</A></FONT> : String) <b>return</b> Boolean -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_67_13" HREF="terminal_interface-curses-terminfo__ads.htm#ref_64_13">Get_Flag</A></span> (<span class="symbol"><A NAME="ref_67_23" HREF="terminal_interface-curses-terminfo__ads.htm#ref_64_23">Name</A></span> : String) <b>return</b> Boolean - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_69_16">tigetflag</A></FONT> (<FONT COLOR=red><A NAME="ref_69_27" HREF="terminal_interface-curses-terminfo__adb.htm#ref_69_16">id</A></FONT> : char_array) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_1926_9">Curses_Bool</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_69_16">tigetflag</A></span> (<span class="symbol"><A NAME="ref_69_27" HREF="terminal_interface-curses-terminfo__adb.htm#ref_69_16">id</A></span> : char_array) <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_1925_9">Curses_Bool</A>; - <b>pragma</b> Import (C, tigetflag); -- <FONT COLOR=red><A NAME="ref_71_7">Txt</A></FONT> : char_array (0 .. <A HREF="terminal_interface-curses-terminfo__ads.htm#ref_64_23">Name</A>'Length); -- <FONT COLOR=red><A NAME="ref_72_7">Length</A></FONT> : size_t; -+ <span class="symbol"><A NAME="ref_71_7">Txt</A></span> : char_array (0 .. <A HREF="terminal_interface-curses-terminfo__ads.htm#ref_64_23">Name</A>'Length); -+ <span class="symbol"><A NAME="ref_72_7">Length</A></span> : size_t; - <b>begin</b> - To_C (<A HREF="terminal_interface-curses-terminfo__ads.htm#ref_64_23">Name</A>, <A HREF="terminal_interface-curses-terminfo__adb.htm#ref_71_7">Txt</A>, <A HREF="terminal_interface-curses-terminfo__adb.htm#ref_72_7">Length</A>); -- <b>if</b> <A HREF="terminal_interface-curses-terminfo__adb.htm#ref_69_16">tigetflag</A> (<A HREF="terminal_interface-curses-terminfo__adb.htm#ref_71_7">Txt</A>) = <A HREF="terminal_interface-curses__ads.htm#ref_1926_9">Curses_Bool</A> (<A HREF="terminal_interface-curses-aux__ads.htm#ref_74_4">Curses_True</A>) <b>then</b> -+ <b>if</b> <A HREF="terminal_interface-curses-terminfo__adb.htm#ref_69_16">tigetflag</A> (<A HREF="terminal_interface-curses-terminfo__adb.htm#ref_71_7">Txt</A>) = <A HREF="terminal_interface-curses__ads.htm#ref_1925_9">Curses_Bool</A> (<A HREF="terminal_interface-curses-aux__ads.htm#ref_74_4">Curses_True</A>) <b>then</b> - <b>return</b> True; - <b>else</b> - <b>return</b> False; - <b>end</b> <b>if</b>; - <b>end</b> <A HREF="terminal_interface-curses-terminfo__ads.htm#ref_64_13">Get_Flag</A>; - --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_83_14" HREF="terminal_interface-curses-terminfo__ads.htm#ref_57_14">Get_String</A></FONT> (<FONT COLOR=red><A NAME="ref_83_26" HREF="terminal_interface-curses-terminfo__ads.htm#ref_57_26">Name</A></FONT> : String; -- <FONT COLOR=red><A NAME="ref_84_26" HREF="terminal_interface-curses-terminfo__ads.htm#ref_58_26">Value</A></FONT> : <b>out</b> Terminfo_String; -- <FONT COLOR=red><A NAME="ref_85_26" HREF="terminal_interface-curses-terminfo__ads.htm#ref_59_26">Result</A></FONT> : <b>out</b> Boolean) -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_83_14" HREF="terminal_interface-curses-terminfo__ads.htm#ref_57_14">Get_String</A></span> (<span class="symbol"><A NAME="ref_83_26" HREF="terminal_interface-curses-terminfo__ads.htm#ref_57_26">Name</A></span> : String; -+ <span class="symbol"><A NAME="ref_84_26" HREF="terminal_interface-curses-terminfo__ads.htm#ref_58_26">Value</A></span> : <b>out</b> Terminfo_String; -+ <span class="symbol"><A NAME="ref_85_26" HREF="terminal_interface-curses-terminfo__ads.htm#ref_59_26">Result</A></span> : <b>out</b> Boolean) - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_87_16">tigetstr</A></FONT> (<FONT COLOR=red><A NAME="ref_87_26" HREF="terminal_interface-curses-terminfo__adb.htm#ref_87_16">id</A></FONT> : char_array) <b>return</b> chars_ptr; -+ <b>function</b> <span class="symbol"><A NAME="ref_87_16">tigetstr</A></span> (<span class="symbol"><A NAME="ref_87_26" HREF="terminal_interface-curses-terminfo__adb.htm#ref_87_16">id</A></span> : char_array) <b>return</b> chars_ptr; - <b>pragma</b> Import (C, tigetstr, "tigetstr"); -- <FONT COLOR=red><A NAME="ref_89_7">Txt</A></FONT> : char_array (0 .. <A HREF="terminal_interface-curses-terminfo__ads.htm#ref_57_26">Name</A>'Length); -- <FONT COLOR=red><A NAME="ref_90_7">Length</A></FONT> : size_t; -- <FONT COLOR=red><A NAME="ref_91_7">Txt2</A></FONT> : chars_ptr; -+ <span class="symbol"><A NAME="ref_89_7">Txt</A></span> : char_array (0 .. <A HREF="terminal_interface-curses-terminfo__ads.htm#ref_57_26">Name</A>'Length); -+ <span class="symbol"><A NAME="ref_90_7">Length</A></span> : size_t; -+ <span class="symbol"><A NAME="ref_91_7">Txt2</A></span> : chars_ptr; - <b>begin</b> - To_C (<A HREF="terminal_interface-curses-terminfo__ads.htm#ref_57_26">Name</A>, <A HREF="terminal_interface-curses-terminfo__adb.htm#ref_89_7">Txt</A>, <A HREF="terminal_interface-curses-terminfo__adb.htm#ref_90_7">Length</A>); - <A HREF="terminal_interface-curses-terminfo__adb.htm#ref_91_7">Txt2</A> := <A HREF="terminal_interface-curses-terminfo__adb.htm#ref_87_16">tigetstr</A> (<A HREF="terminal_interface-curses-terminfo__adb.htm#ref_89_7">Txt</A>); - <b>if</b> <A HREF="terminal_interface-curses-terminfo__adb.htm#ref_91_7">Txt2</A> = Null_Ptr <b>then</b> - <A HREF="terminal_interface-curses-terminfo__ads.htm#ref_59_26">Result</A> := False; - <b>elsif</b> <A HREF="terminal_interface-curses-terminfo__adb.htm#ref_50_13">Is_MinusOne_Pointer</A> (<A HREF="terminal_interface-curses-terminfo__adb.htm#ref_91_7">Txt2</A>) <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>else</b> - <A HREF="terminal_interface-curses-terminfo__ads.htm#ref_58_26">Value</A> := Terminfo_String (<A HREF="terminal_interface-curses-aux__ads.htm#ref_121_13">Fill_String</A> (<A HREF="terminal_interface-curses-terminfo__adb.htm#ref_91_7">Txt2</A>)); - <A HREF="terminal_interface-curses-terminfo__ads.htm#ref_59_26">Result</A> := True; - <b>end</b> <b>if</b>; - <b>end</b> <A HREF="terminal_interface-curses-terminfo__ads.htm#ref_57_14">Get_String</A>; - --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_106_13" HREF="terminal_interface-curses-terminfo__ads.htm#ref_60_13">Has_String</A></FONT> (<FONT COLOR=red><A NAME="ref_106_25" HREF="terminal_interface-curses-terminfo__ads.htm#ref_60_25">Name</A></FONT> : String) <b>return</b> Boolean -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_106_13" HREF="terminal_interface-curses-terminfo__ads.htm#ref_60_13">Has_String</A></span> (<span class="symbol"><A NAME="ref_106_25" HREF="terminal_interface-curses-terminfo__ads.htm#ref_60_25">Name</A></span> : String) <b>return</b> Boolean - <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_108_16">tigetstr</A></FONT> (<FONT COLOR=red><A NAME="ref_108_26" HREF="terminal_interface-curses-terminfo__adb.htm#ref_108_16">id</A></FONT> : char_array) <b>return</b> chars_ptr; -+ <b>function</b> <span class="symbol"><A NAME="ref_108_16">tigetstr</A></span> (<span class="symbol"><A NAME="ref_108_26" HREF="terminal_interface-curses-terminfo__adb.htm#ref_108_16">id</A></span> : char_array) <b>return</b> chars_ptr; - <b>pragma</b> Import (C, tigetstr, "tigetstr"); -- <FONT COLOR=red><A NAME="ref_110_7">Txt</A></FONT> : char_array (0 .. <A HREF="terminal_interface-curses-terminfo__ads.htm#ref_60_25">Name</A>'Length); -- <FONT COLOR=red><A NAME="ref_111_7">Length</A></FONT> : size_t; -- <FONT COLOR=red><A NAME="ref_112_7">Txt2</A></FONT> : chars_ptr; -+ <span class="symbol"><A NAME="ref_110_7">Txt</A></span> : char_array (0 .. <A HREF="terminal_interface-curses-terminfo__ads.htm#ref_60_25">Name</A>'Length); -+ <span class="symbol"><A NAME="ref_111_7">Length</A></span> : size_t; -+ <span class="symbol"><A NAME="ref_112_7">Txt2</A></span> : chars_ptr; - <b>begin</b> - To_C (<A HREF="terminal_interface-curses-terminfo__ads.htm#ref_60_25">Name</A>, <A HREF="terminal_interface-curses-terminfo__adb.htm#ref_110_7">Txt</A>, <A HREF="terminal_interface-curses-terminfo__adb.htm#ref_111_7">Length</A>); - <A HREF="terminal_interface-curses-terminfo__adb.htm#ref_112_7">Txt2</A> := <A HREF="terminal_interface-curses-terminfo__adb.htm#ref_108_16">tigetstr</A> (<A HREF="terminal_interface-curses-terminfo__adb.htm#ref_110_7">Txt</A>); - <b>if</b> <A HREF="terminal_interface-curses-terminfo__adb.htm#ref_112_7">Txt2</A> = Null_Ptr <b>then</b> - <b>return</b> False; - <b>elsif</b> <A HREF="terminal_interface-curses-terminfo__adb.htm#ref_50_13">Is_MinusOne_Pointer</A> (<A HREF="terminal_interface-curses-terminfo__adb.htm#ref_112_7">Txt2</A>) <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>else</b> - <b>return</b> True; - <b>end</b> <b>if</b>; - <b>end</b> <A HREF="terminal_interface-curses-terminfo__ads.htm#ref_60_13">Has_String</A>; - --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_126_13" HREF="terminal_interface-curses-terminfo__ads.htm#ref_68_13">Get_Number</A></FONT> (<FONT COLOR=red><A NAME="ref_126_25" HREF="terminal_interface-curses-terminfo__ads.htm#ref_68_25">Name</A></FONT> : String) <b>return</b> Integer <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_127_16">tigetstr</A></FONT> (<FONT COLOR=red><A NAME="ref_127_26" HREF="terminal_interface-curses-terminfo__adb.htm#ref_127_16">s</A></FONT> : char_array) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_126_13" HREF="terminal_interface-curses-terminfo__ads.htm#ref_68_13">Get_Number</A></span> (<span class="symbol"><A NAME="ref_126_25" HREF="terminal_interface-curses-terminfo__ads.htm#ref_68_25">Name</A></span> : String) <b>return</b> Integer <b>is</b> -+ <b>function</b> <span class="symbol"><A NAME="ref_127_16">tigetstr</A></span> (<span class="symbol"><A NAME="ref_127_26" HREF="terminal_interface-curses-terminfo__adb.htm#ref_127_16">s</A></span> : char_array) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, tigetstr); -- <FONT COLOR=red><A NAME="ref_129_7">Txt</A></FONT> : char_array (0 .. <A HREF="terminal_interface-curses-terminfo__ads.htm#ref_68_25">Name</A>'Length); -- <FONT COLOR=red><A NAME="ref_130_7">Length</A></FONT> : size_t; -+ <span class="symbol"><A NAME="ref_129_7">Txt</A></span> : char_array (0 .. <A HREF="terminal_interface-curses-terminfo__ads.htm#ref_68_25">Name</A>'Length); -+ <span class="symbol"><A NAME="ref_130_7">Length</A></span> : size_t; - <b>begin</b> - To_C (<A HREF="terminal_interface-curses-terminfo__ads.htm#ref_68_25">Name</A>, <A HREF="terminal_interface-curses-terminfo__adb.htm#ref_129_7">Txt</A>, <A HREF="terminal_interface-curses-terminfo__adb.htm#ref_130_7">Length</A>); - <b>return</b> Integer (<A HREF="terminal_interface-curses-terminfo__adb.htm#ref_127_16">tigetstr</A> (<A HREF="terminal_interface-curses-terminfo__adb.htm#ref_129_7">Txt</A>)); - <b>end</b> <A HREF="terminal_interface-curses-terminfo__ads.htm#ref_68_13">Get_Number</A>; - --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_137_14" HREF="terminal_interface-curses-terminfo__ads.htm#ref_76_14">Put_String</A></FONT> (<FONT COLOR=red><A NAME="ref_137_26" HREF="terminal_interface-curses-terminfo__ads.htm#ref_76_26">Str</A></FONT> : Terminfo_String; -- <FONT COLOR=red><A NAME="ref_138_26" HREF="terminal_interface-curses-terminfo__ads.htm#ref_77_26">affcnt</A></FONT> : Natural := 1; -- <FONT COLOR=red><A NAME="ref_139_26" HREF="terminal_interface-curses-terminfo__ads.htm#ref_78_26">putc</A></FONT> : <A HREF="terminal_interface-curses-terminfo__ads.htm#ref_71_9">putctype</A> := <b>null</b>) <b>is</b> -- <b>function</b> <FONT COLOR=red><A NAME="ref_140_16">tputs</A></FONT> (<FONT COLOR=red><A NAME="ref_140_23" HREF="terminal_interface-curses-terminfo__adb.htm#ref_140_16">str</A></FONT> : char_array; -- <FONT COLOR=red><A NAME="ref_141_23" HREF="terminal_interface-curses-terminfo__adb.htm#ref_140_16">affcnt</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -- <FONT COLOR=red><A NAME="ref_142_23" HREF="terminal_interface-curses-terminfo__adb.htm#ref_140_16">putc</A></FONT> : <A HREF="terminal_interface-curses-terminfo__ads.htm#ref_71_9">putctype</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -- <b>function</b> <FONT COLOR=red><A NAME="ref_143_16">putp</A></FONT> (<FONT COLOR=red><A NAME="ref_143_22" HREF="terminal_interface-curses-terminfo__adb.htm#ref_143_16">str</A></FONT> : char_array) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_137_14" HREF="terminal_interface-curses-terminfo__ads.htm#ref_76_14">Put_String</A></span> (<span class="symbol"><A NAME="ref_137_26" HREF="terminal_interface-curses-terminfo__ads.htm#ref_76_26">Str</A></span> : Terminfo_String; -+ <span class="symbol"><A NAME="ref_138_26" HREF="terminal_interface-curses-terminfo__ads.htm#ref_77_26">affcnt</A></span> : Natural := 1; -+ <span class="symbol"><A NAME="ref_139_26" HREF="terminal_interface-curses-terminfo__ads.htm#ref_78_26">putc</A></span> : <A HREF="terminal_interface-curses-terminfo__ads.htm#ref_71_9">putctype</A> := <b>null</b>) <b>is</b> -+ <b>function</b> <span class="symbol"><A NAME="ref_140_16">tputs</A></span> (<span class="symbol"><A NAME="ref_140_23" HREF="terminal_interface-curses-terminfo__adb.htm#ref_140_16">str</A></span> : char_array; -+ <span class="symbol"><A NAME="ref_141_23" HREF="terminal_interface-curses-terminfo__adb.htm#ref_140_16">affcnt</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <span class="symbol"><A NAME="ref_142_23" HREF="terminal_interface-curses-terminfo__adb.htm#ref_140_16">putc</A></span> : <A HREF="terminal_interface-curses-terminfo__ads.htm#ref_71_9">putctype</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_143_16">putp</A></span> (<span class="symbol"><A NAME="ref_143_22" HREF="terminal_interface-curses-terminfo__adb.htm#ref_143_16">str</A></span> : char_array) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>pragma</b> Import (C, tputs); - <b>pragma</b> Import (C, putp); -- <FONT COLOR=red><A NAME="ref_146_7">Txt</A></FONT> : char_array (0 .. <A HREF="terminal_interface-curses-terminfo__ads.htm#ref_76_26">Str</A>'Length); -- <FONT COLOR=red><A NAME="ref_147_7">Length</A></FONT> : size_t; -- <FONT COLOR=red><A NAME="ref_148_7">Err</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; -+ <span class="symbol"><A NAME="ref_146_7">Txt</A></span> : char_array (0 .. <A HREF="terminal_interface-curses-terminfo__ads.htm#ref_76_26">Str</A>'Length); -+ <span class="symbol"><A NAME="ref_147_7">Length</A></span> : size_t; -+ <span class="symbol"><A NAME="ref_148_7">Err</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; - <b>begin</b> - To_C (String (<A HREF="terminal_interface-curses-terminfo__ads.htm#ref_76_26">Str</A>), <A HREF="terminal_interface-curses-terminfo__adb.htm#ref_146_7">Txt</A>, <A HREF="terminal_interface-curses-terminfo__adb.htm#ref_147_7">Length</A>); - <b>if</b> <A HREF="terminal_interface-curses-terminfo__ads.htm#ref_78_26">putc</A> = <b>null</b> <b>then</b> -@@ -159,7 +171,7 @@ - <A HREF="terminal_interface-curses-terminfo__adb.htm#ref_148_7">Err</A> := <A HREF="terminal_interface-curses-terminfo__adb.htm#ref_140_16">tputs</A> (<A HREF="terminal_interface-curses-terminfo__adb.htm#ref_146_7">Txt</A>, <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses-terminfo__ads.htm#ref_77_26">affcnt</A>), <A HREF="terminal_interface-curses-terminfo__ads.htm#ref_78_26">putc</A>); - <b>end</b> <b>if</b>; - <b>if</b> <A HREF="terminal_interface-curses-terminfo__adb.htm#ref_148_7">Err</A> = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b> -- <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_385_4">Curses_Exception</A>; -+ <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_384_4">Curses_Exception</A>; - <b>end</b> <b>if</b>; - <b>end</b> <A HREF="terminal_interface-curses-terminfo__ads.htm#ref_76_14">Put_String</A>; - -diff -Naur ncurses-5.9/doc/html/ada/terminal_interface-curses-terminfo__ads.htm ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-terminfo__ads.htm ---- ncurses-5.9/doc/html/ada/terminal_interface-curses-terminfo__ads.htm 2011-02-26 00:43:50.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-terminfo__ads.htm 2014-09-01 16:33:22.298792026 +0200 -@@ -1,87 +1,99 @@ --<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> --<HTML><HEAD><TITLE>terminal_interface-curses-terminfo.ads</TITLE></HEAD> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> -+<HTML> -+<HEAD> -+<TITLE>terminal_interface-curses-terminfo.ads</TITLE> -+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> -+<style type="text/css"> -+*.comment { -+ color: green; -+} -+*.symbol { -+ color: red; -+} -+</style> -+</HEAD> - <BODY> --<HR><DIV ALIGN="center"><H1> File : terminal_interface-curses-terminfo.ads </H1></DIV><HR> -+<HR><DIV style="text-align:center"><H1> File : terminal_interface-curses-terminfo.ads </H1></DIV><HR> - <PRE> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Terminal_Interface.Curses.Terminfo --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- S P E C --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Copyright (c) 2000 Free Software Foundation, Inc. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></FONT> --<FONT COLOR=green><EM>-- copy of this software and associated documentation files (the --</EM></FONT> --<FONT COLOR=green><EM>-- "Software"), to deal in the Software without restriction, including --</EM></FONT> --<FONT COLOR=green><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></FONT> --<FONT COLOR=green><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></FONT> --<FONT COLOR=green><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></FONT> --<FONT COLOR=green><EM>-- furnished to do so, subject to the following conditions: --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- The above copyright notice and this permission notice shall be included --</EM></FONT> --<FONT COLOR=green><EM>-- in all copies or substantial portions of the Software. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></FONT> --<FONT COLOR=green><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></FONT> --<FONT COLOR=green><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></FONT> --<FONT COLOR=green><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></FONT> --<FONT COLOR=green><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></FONT> --<FONT COLOR=green><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></FONT> --<FONT COLOR=green><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></FONT> --<FONT COLOR=green><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></FONT> --<FONT COLOR=green><EM>-- sale, use or other dealings in this Software without prior written --</EM></FONT> --<FONT COLOR=green><EM>-- authorization. --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Author: Juergen Pfeifer, 1996</EM></FONT> --<FONT COLOR=green><EM>-- Version Control:</EM></FONT> --<FONT COLOR=green><EM>-- @Revision: 1.3 @</EM></FONT> --<FONT COLOR=green><EM>-- Binding Version 01.00</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Terminal_Interface.Curses.Terminfo --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- S P E C --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Copyright (c) 2000 Free Software Foundation, Inc. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></span> -+<span class="comment"><EM>-- copy of this software and associated documentation files (the --</EM></span> -+<span class="comment"><EM>-- "Software"), to deal in the Software without restriction, including --</EM></span> -+<span class="comment"><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></span> -+<span class="comment"><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></span> -+<span class="comment"><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></span> -+<span class="comment"><EM>-- furnished to do so, subject to the following conditions: --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- The above copyright notice and this permission notice shall be included --</EM></span> -+<span class="comment"><EM>-- in all copies or substantial portions of the Software. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></span> -+<span class="comment"><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></span> -+<span class="comment"><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></span> -+<span class="comment"><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></span> -+<span class="comment"><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></span> -+<span class="comment"><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></span> -+<span class="comment"><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></span> -+<span class="comment"><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></span> -+<span class="comment"><EM>-- sale, use or other dealings in this Software without prior written --</EM></span> -+<span class="comment"><EM>-- authorization. --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Author: Juergen Pfeifer, 1996</EM></span> -+<span class="comment"><EM>-- Version Control:</EM></span> -+<span class="comment"><EM>-- @Revision: 1.3 @</EM></span> -+<span class="comment"><EM>-- Binding Version 01.00</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> - --<b>with</b> <A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>.C; -+<b>with</b> <A HREF="interfac__ads.htm#ref_36_9">Interfaces</A>.C; - --<b>package</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<FONT COLOR=red><A NAME="ref_44_35" HREF="terminal_interface-curses-terminfo__adb.htm#ref_48_40">Terminfo</A></FONT> <b>is</b> -+<b>package</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<span class="symbol"><A NAME="ref_44_35" HREF="terminal_interface-curses-terminfo__adb.htm#ref_48_40">Terminfo</A></span> <b>is</b> - <b>pragma</b> Preelaborate (<A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-terminfo__ads.htm#ref_44_35">Terminfo</A>); - -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page curs_terminfo.3x</EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- Not implemented: setupterm, setterm, set_curterm, del_curterm,</EM></FONT> -- <FONT COLOR=green><EM>-- restartterm, tparm, putp, vidputs, vidattr,</EM></FONT> -- <FONT COLOR=green><EM>-- mvcur</EM></FONT> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page curs_terminfo.3x</EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- Not implemented: setupterm, setterm, set_curterm, del_curterm,</EM></span> -+ <span class="comment"><EM>-- restartterm, tparm, putp, vidputs, vidattr,</EM></span> -+ <span class="comment"><EM>-- mvcur</EM></span> - - <b>type</b> Terminfo_String <b>is</b> <b>new</b> String; - -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_57_14" HREF="terminal_interface-curses-terminfo__adb.htm#ref_83_14">Get_String</A></FONT> (<FONT COLOR=red><A NAME="ref_57_26" HREF="terminal_interface-curses-terminfo__adb.htm#ref_83_26">Name</A></FONT> : String; -- <FONT COLOR=red><A NAME="ref_58_26" HREF="terminal_interface-curses-terminfo__adb.htm#ref_84_26">Value</A></FONT> : <b>out</b> Terminfo_String; -- <FONT COLOR=red><A NAME="ref_59_26" HREF="terminal_interface-curses-terminfo__adb.htm#ref_85_26">Result</A></FONT> : <b>out</b> Boolean); -- <b>function</b> <FONT COLOR=red><A NAME="ref_60_13" HREF="terminal_interface-curses-terminfo__adb.htm#ref_106_13">Has_String</A></FONT> (<FONT COLOR=red><A NAME="ref_60_25" HREF="terminal_interface-curses-terminfo__adb.htm#ref_106_25">Name</A></FONT> : String) <b>return</b> Boolean; -- <FONT COLOR=green><EM>-- AKA: tigetstr()</EM></FONT> -- -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_64_13" HREF="terminal_interface-curses-terminfo__adb.htm#ref_67_13">Get_Flag</A></FONT> (<FONT COLOR=red><A NAME="ref_64_23" HREF="terminal_interface-curses-terminfo__adb.htm#ref_67_23">Name</A></FONT> : String) <b>return</b> Boolean; -- <FONT COLOR=green><EM>-- AKA: tigetflag()</EM></FONT> -- -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <b>function</b> <FONT COLOR=red><A NAME="ref_68_13" HREF="terminal_interface-curses-terminfo__adb.htm#ref_126_13">Get_Number</A></FONT> (<FONT COLOR=red><A NAME="ref_68_25" HREF="terminal_interface-curses-terminfo__adb.htm#ref_126_25">Name</A></FONT> : String) <b>return</b> Integer; -- <FONT COLOR=green><EM>-- AKA: tigetnum()</EM></FONT> -+ <span class="comment"><EM>-- |</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_57_14" HREF="terminal_interface-curses-terminfo__adb.htm#ref_83_14">Get_String</A></span> (<span class="symbol"><A NAME="ref_57_26" HREF="terminal_interface-curses-terminfo__adb.htm#ref_83_26">Name</A></span> : String; -+ <span class="symbol"><A NAME="ref_58_26" HREF="terminal_interface-curses-terminfo__adb.htm#ref_84_26">Value</A></span> : <b>out</b> Terminfo_String; -+ <span class="symbol"><A NAME="ref_59_26" HREF="terminal_interface-curses-terminfo__adb.htm#ref_85_26">Result</A></span> : <b>out</b> Boolean); -+ <b>function</b> <span class="symbol"><A NAME="ref_60_13" HREF="terminal_interface-curses-terminfo__adb.htm#ref_106_13">Has_String</A></span> (<span class="symbol"><A NAME="ref_60_25" HREF="terminal_interface-curses-terminfo__adb.htm#ref_106_25">Name</A></span> : String) <b>return</b> Boolean; -+ <span class="comment"><EM>-- AKA: tigetstr()</EM></span> -+ -+ <span class="comment"><EM>-- |</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_64_13" HREF="terminal_interface-curses-terminfo__adb.htm#ref_67_13">Get_Flag</A></span> (<span class="symbol"><A NAME="ref_64_23" HREF="terminal_interface-curses-terminfo__adb.htm#ref_67_23">Name</A></span> : String) <b>return</b> Boolean; -+ <span class="comment"><EM>-- AKA: tigetflag()</EM></span> -+ -+ <span class="comment"><EM>-- |</EM></span> -+ <b>function</b> <span class="symbol"><A NAME="ref_68_13" HREF="terminal_interface-curses-terminfo__adb.htm#ref_126_13">Get_Number</A></span> (<span class="symbol"><A NAME="ref_68_25" HREF="terminal_interface-curses-terminfo__adb.htm#ref_126_25">Name</A></span> : String) <b>return</b> Integer; -+ <span class="comment"><EM>-- AKA: tigetnum()</EM></span> - -- <b>type</b> <FONT COLOR=red><A NAME="ref_71_9">putctype</A></FONT> <b>is</b> <b>access</b> <b>function</b> (<FONT COLOR=red><A NAME="ref_71_38">c</A></FONT> : <A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>.C.int) -- <b>return</b> <A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>.C.int; -+ <b>type</b> <span class="symbol"><A NAME="ref_71_9">putctype</A></span> <b>is</b> <b>access</b> <b>function</b> (<span class="symbol"><A NAME="ref_71_38">c</A></span> : <A HREF="interfac__ads.htm#ref_36_9">Interfaces</A>.C.int) -+ <b>return</b> <A HREF="interfac__ads.htm#ref_36_9">Interfaces</A>.C.int; - <b>pragma</b> Convention (C, <A HREF="terminal_interface-curses-terminfo__ads.htm#ref_71_9">putctype</A>); - -- <FONT COLOR=green><EM>-- |</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_76_14" HREF="terminal_interface-curses-terminfo__adb.htm#ref_137_14">Put_String</A></FONT> (<FONT COLOR=red><A NAME="ref_76_26" HREF="terminal_interface-curses-terminfo__adb.htm#ref_137_26">Str</A></FONT> : Terminfo_String; -- <FONT COLOR=red><A NAME="ref_77_26" HREF="terminal_interface-curses-terminfo__adb.htm#ref_138_26">affcnt</A></FONT> : Natural := 1; -- <FONT COLOR=red><A NAME="ref_78_26" HREF="terminal_interface-curses-terminfo__adb.htm#ref_139_26">putc</A></FONT> : <A HREF="terminal_interface-curses-terminfo__ads.htm#ref_71_9">putctype</A> := <b>null</b>); -- <FONT COLOR=green><EM>-- AKA: tputs()</EM></FONT> -+ <span class="comment"><EM>-- |</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_76_14" HREF="terminal_interface-curses-terminfo__adb.htm#ref_137_14">Put_String</A></span> (<span class="symbol"><A NAME="ref_76_26" HREF="terminal_interface-curses-terminfo__adb.htm#ref_137_26">Str</A></span> : Terminfo_String; -+ <span class="symbol"><A NAME="ref_77_26" HREF="terminal_interface-curses-terminfo__adb.htm#ref_138_26">affcnt</A></span> : Natural := 1; -+ <span class="symbol"><A NAME="ref_78_26" HREF="terminal_interface-curses-terminfo__adb.htm#ref_139_26">putc</A></span> : <A HREF="terminal_interface-curses-terminfo__ads.htm#ref_71_9">putctype</A> := <b>null</b>); -+ <span class="comment"><EM>-- AKA: tputs()</EM></span> - - <b>end</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-terminfo__ads.htm#ref_44_35">Terminfo</A>; - </PRE></BODY></HTML> -diff -Naur ncurses-5.9/doc/html/ada/terminal_interface-curses-text_io__adb.htm ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-text_io__adb.htm ---- ncurses-5.9/doc/html/ada/terminal_interface-curses-text_io__adb.htm 2011-03-26 22:54:30.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-text_io__adb.htm 2014-09-01 16:33:22.304792036 +0200 -@@ -1,181 +1,193 @@ --<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> --<HTML><HEAD><TITLE>terminal_interface-curses-text_io.adb</TITLE></HEAD> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> -+<HTML> -+<HEAD> -+<TITLE>terminal_interface-curses-text_io.adb</TITLE> -+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> -+<style type="text/css"> -+*.comment { -+ color: green; -+} -+*.symbol { -+ color: red; -+} -+</style> -+</HEAD> - <BODY> --<HR><DIV ALIGN="center"><H1> File : terminal_interface-curses-text_io.adb </H1></DIV><HR> -+<HR><DIV style="text-align:center"><H1> File : terminal_interface-curses-text_io.adb </H1></DIV><HR> - <PRE> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Terminal_Interface.Curses.Text_IO --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- B O D Y --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Copyright (c) 1998-2009,2011 Free Software Foundation, Inc. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></FONT> --<FONT COLOR=green><EM>-- copy of this software and associated documentation files (the --</EM></FONT> --<FONT COLOR=green><EM>-- "Software"), to deal in the Software without restriction, including --</EM></FONT> --<FONT COLOR=green><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></FONT> --<FONT COLOR=green><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></FONT> --<FONT COLOR=green><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></FONT> --<FONT COLOR=green><EM>-- furnished to do so, subject to the following conditions: --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- The above copyright notice and this permission notice shall be included --</EM></FONT> --<FONT COLOR=green><EM>-- in all copies or substantial portions of the Software. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></FONT> --<FONT COLOR=green><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></FONT> --<FONT COLOR=green><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></FONT> --<FONT COLOR=green><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></FONT> --<FONT COLOR=green><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></FONT> --<FONT COLOR=green><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></FONT> --<FONT COLOR=green><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></FONT> --<FONT COLOR=green><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></FONT> --<FONT COLOR=green><EM>-- sale, use or other dealings in this Software without prior written --</EM></FONT> --<FONT COLOR=green><EM>-- authorization. --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Author: Juergen Pfeifer, 1996</EM></FONT> --<FONT COLOR=green><EM>-- Version Control:</EM></FONT> --<FONT COLOR=green><EM>-- @Revision: 1.20 @</EM></FONT> --<FONT COLOR=green><EM>-- @Date: 2011/03/22 23:38:49 @</EM></FONT> --<FONT COLOR=green><EM>-- Binding Version 01.00</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<b>package</b> <b>body</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<FONT COLOR=red><A NAME="ref_42_40" HREF="terminal_interface-curses-text_io__ads.htm#ref_44_35">Text_IO</A></FONT> <b>is</b> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Terminal_Interface.Curses.Text_IO --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- B O D Y --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Copyright (c) 1998-2009,2011 Free Software Foundation, Inc. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></span> -+<span class="comment"><EM>-- copy of this software and associated documentation files (the --</EM></span> -+<span class="comment"><EM>-- "Software"), to deal in the Software without restriction, including --</EM></span> -+<span class="comment"><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></span> -+<span class="comment"><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></span> -+<span class="comment"><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></span> -+<span class="comment"><EM>-- furnished to do so, subject to the following conditions: --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- The above copyright notice and this permission notice shall be included --</EM></span> -+<span class="comment"><EM>-- in all copies or substantial portions of the Software. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></span> -+<span class="comment"><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></span> -+<span class="comment"><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></span> -+<span class="comment"><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></span> -+<span class="comment"><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></span> -+<span class="comment"><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></span> -+<span class="comment"><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></span> -+<span class="comment"><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></span> -+<span class="comment"><EM>-- sale, use or other dealings in this Software without prior written --</EM></span> -+<span class="comment"><EM>-- authorization. --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Author: Juergen Pfeifer, 1996</EM></span> -+<span class="comment"><EM>-- Version Control:</EM></span> -+<span class="comment"><EM>-- @Revision: 1.20 @</EM></span> -+<span class="comment"><EM>-- @Date: 2011/03/22 23:38:49 @</EM></span> -+<span class="comment"><EM>-- Binding Version 01.00</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<b>package</b> <b>body</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<span class="symbol"><A NAME="ref_42_40" HREF="terminal_interface-curses-text_io__ads.htm#ref_44_35">Text_IO</A></span> <b>is</b> - -- <FONT COLOR=red><A NAME="ref_44_4">Default_Window</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_58_4">Null_Window</A>; -+ <span class="symbol"><A NAME="ref_44_4">Default_Window</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_58_4">Null_Window</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_46_14" HREF="terminal_interface-curses-text_io__ads.htm#ref_59_14">Set_Window</A></FONT> (<FONT COLOR=red><A NAME="ref_46_26" HREF="terminal_interface-curses-text_io__ads.htm#ref_59_26">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_46_14" HREF="terminal_interface-curses-text_io__ads.htm#ref_59_14">Set_Window</A></span> (<span class="symbol"><A NAME="ref_46_26" HREF="terminal_interface-curses-text_io__ads.htm#ref_59_26">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) - <b>is</b> - <b>begin</b> - <A HREF="terminal_interface-curses-text_io__adb.htm#ref_44_4">Default_Window</A> := <A HREF="terminal_interface-curses-text_io__ads.htm#ref_59_26">Win</A>; - <b>end</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_59_14">Set_Window</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_52_13" HREF="terminal_interface-curses-text_io__ads.htm#ref_62_13">Get_Window</A></FONT> <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> -+ <b>function</b> <span class="symbol"><A NAME="ref_52_13" HREF="terminal_interface-curses-text_io__ads.htm#ref_62_13">Get_Window</A></span> <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> - <b>is</b> - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses-text_io__adb.htm#ref_44_4">Default_Window</A> = <A HREF="terminal_interface-curses__ads.htm#ref_58_4">Null_Window</A> <b>then</b> -- <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_478_13">Standard_Window</A>; -+ <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_477_13">Standard_Window</A>; - <b>else</b> - <b>return</b> <A HREF="terminal_interface-curses-text_io__adb.htm#ref_44_4">Default_Window</A>; - <b>end</b> <b>if</b>; - <b>end</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_62_13">Get_Window</A>; - <b>pragma</b> Inline (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_62_13">Get_Window</A>); - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_63_14" HREF="terminal_interface-curses-text_io__ads.htm#ref_65_14">Flush</A></FONT> (<FONT COLOR=red><A NAME="ref_63_21" HREF="terminal_interface-curses-text_io__ads.htm#ref_65_21">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_63_14" HREF="terminal_interface-curses-text_io__ads.htm#ref_65_14">Flush</A></span> (<span class="symbol"><A NAME="ref_63_21" HREF="terminal_interface-curses-text_io__ads.htm#ref_65_21">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) - <b>is</b> - <b>begin</b> -- <A HREF="terminal_interface-curses__ads.htm#ref_1047_14">Refresh</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_65_21">Win</A>); -+ <A HREF="terminal_interface-curses__ads.htm#ref_1046_14">Refresh</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_65_21">Win</A>); - <b>end</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_65_14">Flush</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_69_14" HREF="terminal_interface-curses-text_io__ads.htm#ref_66_14">Flush</A></FONT> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_69_14" HREF="terminal_interface-curses-text_io__ads.htm#ref_66_14">Flush</A></span> - <b>is</b> - <b>begin</b> - <A HREF="terminal_interface-curses-text_io__ads.htm#ref_65_14">Flush</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_62_13">Get_Window</A>); - <b>end</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_66_14">Flush</A>; - -- <FONT COLOR=green><EM>--------------------------------------------</EM></FONT> -- <FONT COLOR=green><EM>-- Specification of line and page lengths --</EM></FONT> -- <FONT COLOR=green><EM>--------------------------------------------</EM></FONT> -- -- <FONT COLOR=green><EM>-- There are no set routines in this package. I assume, that you allocate</EM></FONT> -- <FONT COLOR=green><EM>-- the window with an appropriate size.</EM></FONT> -- <FONT COLOR=green><EM>-- A scroll-window is interpreted as an page with unbounded page length,</EM></FONT> -- <FONT COLOR=green><EM>-- i.e. it returns the conventional 0 as page length.</EM></FONT> -- -- <b>function</b> <FONT COLOR=red><A NAME="ref_84_13" HREF="terminal_interface-curses-text_io__ads.htm#ref_77_13">Line_Length</A></FONT> (<FONT COLOR=red><A NAME="ref_84_26" HREF="terminal_interface-curses-text_io__ads.htm#ref_77_26">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_47_12">Count</A> -- <b>is</b> -- <FONT COLOR=red><A NAME="ref_86_7">N_Lines</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_63_12">Line_Count</A>; -- <FONT COLOR=red><A NAME="ref_87_7">N_Cols</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_65_12">Column_Count</A>; -- <b>begin</b> -- <A HREF="terminal_interface-curses__ads.htm#ref_1230_14">Get_Size</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_77_26">Win</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#ref_86_7">N_Lines</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#ref_87_7">N_Cols</A>); -- <FONT COLOR=green><EM>-- if Natural (N_Cols) &gt; Natural (Count'Last) then</EM></FONT> -- <FONT COLOR=green><EM>-- raise Layout_Error;</EM></FONT> -- <FONT COLOR=green><EM>-- end if;</EM></FONT> -+ <span class="comment"><EM>--------------------------------------------</EM></span> -+ <span class="comment"><EM>-- Specification of line and page lengths --</EM></span> -+ <span class="comment"><EM>--------------------------------------------</EM></span> -+ -+ <span class="comment"><EM>-- There are no set routines in this package. I assume, that you allocate</EM></span> -+ <span class="comment"><EM>-- the window with an appropriate size.</EM></span> -+ <span class="comment"><EM>-- A scroll-window is interpreted as an page with unbounded page length,</EM></span> -+ <span class="comment"><EM>-- i.e. it returns the conventional 0 as page length.</EM></span> -+ -+ <b>function</b> <span class="symbol"><A NAME="ref_84_13" HREF="terminal_interface-curses-text_io__ads.htm#ref_77_13">Line_Length</A></span> (<span class="symbol"><A NAME="ref_84_26" HREF="terminal_interface-curses-text_io__ads.htm#ref_77_26">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_47_12">Count</A> -+ <b>is</b> -+ <span class="symbol"><A NAME="ref_86_7">N_Lines</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_63_12">Line_Count</A>; -+ <span class="symbol"><A NAME="ref_87_7">N_Cols</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_65_12">Column_Count</A>; -+ <b>begin</b> -+ <A HREF="terminal_interface-curses__ads.htm#ref_1229_14">Get_Size</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_77_26">Win</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#ref_86_7">N_Lines</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#ref_87_7">N_Cols</A>); -+ <span class="comment"><EM>-- if Natural (N_Cols) &gt; Natural (Count'Last) then</EM></span> -+ <span class="comment"><EM>-- raise Layout_Error;</EM></span> -+ <span class="comment"><EM>-- end if;</EM></span> - <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_47_12">Count</A> (<A HREF="terminal_interface-curses-text_io__adb.htm#ref_87_7">N_Cols</A>); - <b>end</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_77_13">Line_Length</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_96_13" HREF="terminal_interface-curses-text_io__ads.htm#ref_78_13">Line_Length</A></FONT> <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_47_12">Count</A> -+ <b>function</b> <span class="symbol"><A NAME="ref_96_13" HREF="terminal_interface-curses-text_io__ads.htm#ref_78_13">Line_Length</A></span> <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_47_12">Count</A> - <b>is</b> - <b>begin</b> - <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_77_13">Line_Length</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_62_13">Get_Window</A>); - <b>end</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_78_13">Line_Length</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_102_13" HREF="terminal_interface-curses-text_io__ads.htm#ref_80_13">Page_Length</A></FONT> (<FONT COLOR=red><A NAME="ref_102_26" HREF="terminal_interface-curses-text_io__ads.htm#ref_80_26">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_47_12">Count</A> -+ <b>function</b> <span class="symbol"><A NAME="ref_102_13" HREF="terminal_interface-curses-text_io__ads.htm#ref_80_13">Page_Length</A></span> (<span class="symbol"><A NAME="ref_102_26" HREF="terminal_interface-curses-text_io__ads.htm#ref_80_26">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_47_12">Count</A> - <b>is</b> -- <FONT COLOR=red><A NAME="ref_104_7">N_Lines</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_63_12">Line_Count</A>; -- <FONT COLOR=red><A NAME="ref_105_7">N_Cols</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_65_12">Column_Count</A>; -+ <span class="symbol"><A NAME="ref_104_7">N_Lines</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_63_12">Line_Count</A>; -+ <span class="symbol"><A NAME="ref_105_7">N_Cols</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_65_12">Column_Count</A>; - <b>begin</b> -- <b>if</b> <A HREF="terminal_interface-curses__ads.htm#ref_1024_13">Scrolling_Allowed</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_80_26">Win</A>) <b>then</b> -+ <b>if</b> <A HREF="terminal_interface-curses__ads.htm#ref_1023_13">Scrolling_Allowed</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_80_26">Win</A>) <b>then</b> - <b>return</b> 0; - <b>else</b> -- <A HREF="terminal_interface-curses__ads.htm#ref_1230_14">Get_Size</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_80_26">Win</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#ref_104_7">N_Lines</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#ref_105_7">N_Cols</A>); -- <FONT COLOR=green><EM>-- if Natural (N_Lines) &gt; Natural (Count'Last) then</EM></FONT> -- <FONT COLOR=green><EM>-- raise Layout_Error;</EM></FONT> -- <FONT COLOR=green><EM>-- end if;</EM></FONT> -+ <A HREF="terminal_interface-curses__ads.htm#ref_1229_14">Get_Size</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_80_26">Win</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#ref_104_7">N_Lines</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#ref_105_7">N_Cols</A>); -+ <span class="comment"><EM>-- if Natural (N_Lines) &gt; Natural (Count'Last) then</EM></span> -+ <span class="comment"><EM>-- raise Layout_Error;</EM></span> -+ <span class="comment"><EM>-- end if;</EM></span> - <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_47_12">Count</A> (<A HREF="terminal_interface-curses-text_io__adb.htm#ref_104_7">N_Lines</A>); - <b>end</b> <b>if</b>; - <b>end</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_80_13">Page_Length</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_118_13" HREF="terminal_interface-curses-text_io__ads.htm#ref_81_13">Page_Length</A></FONT> <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_47_12">Count</A> -+ <b>function</b> <span class="symbol"><A NAME="ref_118_13" HREF="terminal_interface-curses-text_io__ads.htm#ref_81_13">Page_Length</A></span> <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_47_12">Count</A> - <b>is</b> - <b>begin</b> - <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_80_13">Page_Length</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_62_13">Get_Window</A>); - <b>end</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_81_13">Page_Length</A>; - -- <FONT COLOR=green><EM>------------------------------------</EM></FONT> -- <FONT COLOR=green><EM>-- Column, Line, and Page Control --</EM></FONT> -- <FONT COLOR=green><EM>------------------------------------</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_127_14" HREF="terminal_interface-curses-text_io__ads.htm#ref_86_14">New_Line</A></FONT> (<FONT COLOR=red><A NAME="ref_127_24" HREF="terminal_interface-curses-text_io__ads.htm#ref_86_24">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; <FONT COLOR=red><A NAME="ref_127_38" HREF="terminal_interface-curses-text_io__ads.htm#ref_86_38">Spacing</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_48_12">Positive_Count</A> := 1) -+ <span class="comment"><EM>------------------------------------</EM></span> -+ <span class="comment"><EM>-- Column, Line, and Page Control --</EM></span> -+ <span class="comment"><EM>------------------------------------</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_127_14" HREF="terminal_interface-curses-text_io__ads.htm#ref_86_14">New_Line</A></span> (<span class="symbol"><A NAME="ref_127_24" HREF="terminal_interface-curses-text_io__ads.htm#ref_86_24">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; <span class="symbol"><A NAME="ref_127_38" HREF="terminal_interface-curses-text_io__ads.htm#ref_86_38">Spacing</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_48_12">Positive_Count</A> := 1) - <b>is</b> -- <FONT COLOR=red><A NAME="ref_129_7">P_Size</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_47_12">Count</A> := <A HREF="terminal_interface-curses-text_io__ads.htm#ref_80_13">Page_Length</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_86_24">Win</A>); -+ <span class="symbol"><A NAME="ref_129_7">P_Size</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_47_12">Count</A> := <A HREF="terminal_interface-curses-text_io__ads.htm#ref_80_13">Page_Length</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_86_24">Win</A>); - <b>begin</b> - <b>if</b> <b>not</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_86_38">Spacing</A>'Valid <b>then</b> - <b>raise</b> Constraint_Error; - <b>end</b> <b>if</b>; - -- <b>for</b> <FONT COLOR=red><A NAME="ref_135_11">I</A></FONT> <b>in</b> 1 .. <A HREF="terminal_interface-curses-text_io__ads.htm#ref_86_38">Spacing</A> <b>loop</b> -+ <b>for</b> <span class="symbol"><A NAME="ref_135_11">I</A></span> <b>in</b> 1 .. <A HREF="terminal_interface-curses-text_io__ads.htm#ref_86_38">Spacing</A> <b>loop</b> - <b>if</b> <A HREF="terminal_interface-curses-text_io__adb.htm#ref_129_7">P_Size</A> &gt; 0 <b>and</b> <b>then</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_101_13">Line</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_86_24">Win</A>) &gt;= <A HREF="terminal_interface-curses-text_io__adb.htm#ref_129_7">P_Size</A> <b>then</b> - <A HREF="terminal_interface-curses-text_io__ads.htm#ref_89_14">New_Page</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_86_24">Win</A>); - <b>else</b> -- <A HREF="terminal_interface-curses__ads.htm#ref_530_14">Add</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_86_24">Win</A>, ASCII.LF); -+ <A HREF="terminal_interface-curses__ads.htm#ref_529_14">Add</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_86_24">Win</A>, ASCII.LF); - <b>end</b> <b>if</b>; - <b>end</b> <b>loop</b>; - <b>end</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_86_14">New_Line</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_144_14" HREF="terminal_interface-curses-text_io__ads.htm#ref_87_14">New_Line</A></FONT> (<FONT COLOR=red><A NAME="ref_144_24" HREF="terminal_interface-curses-text_io__ads.htm#ref_87_24">Spacing</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_48_12">Positive_Count</A> := 1) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_144_14" HREF="terminal_interface-curses-text_io__ads.htm#ref_87_14">New_Line</A></span> (<span class="symbol"><A NAME="ref_144_24" HREF="terminal_interface-curses-text_io__ads.htm#ref_87_24">Spacing</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_48_12">Positive_Count</A> := 1) - <b>is</b> - <b>begin</b> - <A HREF="terminal_interface-curses-text_io__ads.htm#ref_86_14">New_Line</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_62_13">Get_Window</A>, <A HREF="terminal_interface-curses-text_io__ads.htm#ref_87_24">Spacing</A>); - <b>end</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_87_14">New_Line</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_150_14" HREF="terminal_interface-curses-text_io__ads.htm#ref_89_14">New_Page</A></FONT> (<FONT COLOR=red><A NAME="ref_150_24" HREF="terminal_interface-curses-text_io__ads.htm#ref_89_24">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_150_14" HREF="terminal_interface-curses-text_io__ads.htm#ref_89_14">New_Page</A></span> (<span class="symbol"><A NAME="ref_150_24" HREF="terminal_interface-curses-text_io__ads.htm#ref_89_24">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) - <b>is</b> - <b>begin</b> -- <A HREF="terminal_interface-curses__ads.htm#ref_1082_14">Clear</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_89_24">Win</A>); -+ <A HREF="terminal_interface-curses__ads.htm#ref_1081_14">Clear</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_89_24">Win</A>); - <b>end</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_89_14">New_Page</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_156_14" HREF="terminal_interface-curses-text_io__ads.htm#ref_90_14">New_Page</A></FONT> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_156_14" HREF="terminal_interface-curses-text_io__ads.htm#ref_90_14">New_Page</A></span> - <b>is</b> - <b>begin</b> - <A HREF="terminal_interface-curses-text_io__ads.htm#ref_89_14">New_Page</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_62_13">Get_Window</A>); - <b>end</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_90_14">New_Page</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_162_14" HREF="terminal_interface-curses-text_io__ads.htm#ref_92_14">Set_Col</A></FONT> (<FONT COLOR=red><A NAME="ref_162_23" HREF="terminal_interface-curses-text_io__ads.htm#ref_92_23">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; <FONT COLOR=red><A NAME="ref_162_38" HREF="terminal_interface-curses-text_io__ads.htm#ref_92_38">To</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_48_12">Positive_Count</A>) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_162_14" HREF="terminal_interface-curses-text_io__ads.htm#ref_92_14">Set_Col</A></span> (<span class="symbol"><A NAME="ref_162_23" HREF="terminal_interface-curses-text_io__ads.htm#ref_92_23">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; <span class="symbol"><A NAME="ref_162_38" HREF="terminal_interface-curses-text_io__ads.htm#ref_92_38">To</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_48_12">Positive_Count</A>) - <b>is</b> -- <FONT COLOR=red><A NAME="ref_164_7">Y</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_165_7">X1</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -- <FONT COLOR=red><A NAME="ref_166_7">X2</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -- <FONT COLOR=red><A NAME="ref_167_7">N</A></FONT> : Natural; -+ <span class="symbol"><A NAME="ref_164_7">Y</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_165_7">X1</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -+ <span class="symbol"><A NAME="ref_166_7">X2</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -+ <span class="symbol"><A NAME="ref_167_7">N</A></span> : Natural; - <b>begin</b> - <b>if</b> <b>not</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_92_38">To</A>'Valid <b>then</b> - <b>raise</b> Constraint_Error; - <b>end</b> <b>if</b>; - -- <A HREF="terminal_interface-curses__ads.htm#ref_1246_14">Get_Cursor_Position</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_92_23">Win</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#ref_164_7">Y</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#ref_165_7">X1</A>); -+ <A HREF="terminal_interface-curses__ads.htm#ref_1245_14">Get_Cursor_Position</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_92_23">Win</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#ref_164_7">Y</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#ref_165_7">X1</A>); - <A HREF="terminal_interface-curses-text_io__adb.htm#ref_167_7">N</A> := Natural (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_92_38">To</A>); <A HREF="terminal_interface-curses-text_io__adb.htm#ref_167_7">N</A> := <A HREF="terminal_interface-curses-text_io__adb.htm#ref_167_7">N</A> - 1; - <A HREF="terminal_interface-curses-text_io__adb.htm#ref_166_7">X2</A> := <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A> (<A HREF="terminal_interface-curses-text_io__adb.htm#ref_167_7">N</A>); - <b>if</b> <A HREF="terminal_interface-curses-text_io__adb.htm#ref_165_7">X1</A> &gt; <A HREF="terminal_interface-curses-text_io__adb.htm#ref_166_7">X2</A> <b>then</b> -@@ -184,7 +196,7 @@ - <b>end</b> <b>if</b>; - <b>if</b> <A HREF="terminal_interface-curses-text_io__adb.htm#ref_165_7">X1</A> &lt; <A HREF="terminal_interface-curses-text_io__adb.htm#ref_166_7">X2</A> <b>then</b> - <b>declare</b> -- <FONT COLOR=red><A NAME="ref_182_13">Filler</A></FONT> : <b>constant</b> String (Integer (<A HREF="terminal_interface-curses-text_io__adb.htm#ref_165_7">X1</A>) .. (Integer (<A HREF="terminal_interface-curses-text_io__adb.htm#ref_166_7">X2</A>) - 1)) -+ <span class="symbol"><A NAME="ref_182_13">Filler</A></span> : <b>constant</b> String (Integer (<A HREF="terminal_interface-curses-text_io__adb.htm#ref_165_7">X1</A>) .. (Integer (<A HREF="terminal_interface-curses-text_io__adb.htm#ref_166_7">X2</A>) - 1)) - := (<b>others</b> =&gt; ' '); - <b>begin</b> - <A HREF="terminal_interface-curses-text_io__ads.htm#ref_115_14">Put</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_92_23">Win</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#ref_182_13">Filler</A>); -@@ -192,24 +204,24 @@ - <b>end</b> <b>if</b>; - <b>end</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_92_14">Set_Col</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_190_14" HREF="terminal_interface-curses-text_io__ads.htm#ref_93_14">Set_Col</A></FONT> (<FONT COLOR=red><A NAME="ref_190_23" HREF="terminal_interface-curses-text_io__ads.htm#ref_93_23">To</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_48_12">Positive_Count</A>) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_190_14" HREF="terminal_interface-curses-text_io__ads.htm#ref_93_14">Set_Col</A></span> (<span class="symbol"><A NAME="ref_190_23" HREF="terminal_interface-curses-text_io__ads.htm#ref_93_23">To</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_48_12">Positive_Count</A>) - <b>is</b> - <b>begin</b> - <A HREF="terminal_interface-curses-text_io__ads.htm#ref_92_14">Set_Col</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_62_13">Get_Window</A>, <A HREF="terminal_interface-curses-text_io__ads.htm#ref_93_23">To</A>); - <b>end</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_93_14">Set_Col</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_196_14" HREF="terminal_interface-curses-text_io__ads.htm#ref_95_14">Set_Line</A></FONT> (<FONT COLOR=red><A NAME="ref_196_24" HREF="terminal_interface-curses-text_io__ads.htm#ref_95_24">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; <FONT COLOR=red><A NAME="ref_196_38" HREF="terminal_interface-curses-text_io__ads.htm#ref_95_38">To</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_48_12">Positive_Count</A>) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_196_14" HREF="terminal_interface-curses-text_io__ads.htm#ref_95_14">Set_Line</A></span> (<span class="symbol"><A NAME="ref_196_24" HREF="terminal_interface-curses-text_io__ads.htm#ref_95_24">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; <span class="symbol"><A NAME="ref_196_38" HREF="terminal_interface-curses-text_io__ads.htm#ref_95_38">To</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_48_12">Positive_Count</A>) - <b>is</b> -- <FONT COLOR=red><A NAME="ref_198_7">Y1</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_199_7">Y2</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_200_7">X</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -- <FONT COLOR=red><A NAME="ref_201_7">N</A></FONT> : Natural; -+ <span class="symbol"><A NAME="ref_198_7">Y1</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_199_7">Y2</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_200_7">X</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -+ <span class="symbol"><A NAME="ref_201_7">N</A></span> : Natural; - <b>begin</b> - <b>if</b> <b>not</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_95_38">To</A>'Valid <b>then</b> - <b>raise</b> Constraint_Error; - <b>end</b> <b>if</b>; - -- <A HREF="terminal_interface-curses__ads.htm#ref_1246_14">Get_Cursor_Position</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_95_24">Win</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#ref_198_7">Y1</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#ref_200_7">X</A>); -+ <A HREF="terminal_interface-curses__ads.htm#ref_1245_14">Get_Cursor_Position</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_95_24">Win</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#ref_198_7">Y1</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#ref_200_7">X</A>); - <b>pragma</b> Unreferenced (<A HREF="terminal_interface-curses-text_io__adb.htm#ref_200_7">X</A>); - <A HREF="terminal_interface-curses-text_io__adb.htm#ref_201_7">N</A> := Natural (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_95_38">To</A>); <A HREF="terminal_interface-curses-text_io__adb.htm#ref_201_7">N</A> := <A HREF="terminal_interface-curses-text_io__adb.htm#ref_201_7">N</A> - 1; - <A HREF="terminal_interface-curses-text_io__adb.htm#ref_199_7">Y2</A> := <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A> (<A HREF="terminal_interface-curses-text_io__adb.htm#ref_201_7">N</A>); -@@ -222,119 +234,119 @@ - <b>end</b> <b>if</b>; - <b>end</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_95_14">Set_Line</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_220_14" HREF="terminal_interface-curses-text_io__ads.htm#ref_96_14">Set_Line</A></FONT> (<FONT COLOR=red><A NAME="ref_220_24" HREF="terminal_interface-curses-text_io__ads.htm#ref_96_24">To</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_48_12">Positive_Count</A>) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_220_14" HREF="terminal_interface-curses-text_io__ads.htm#ref_96_14">Set_Line</A></span> (<span class="symbol"><A NAME="ref_220_24" HREF="terminal_interface-curses-text_io__ads.htm#ref_96_24">To</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_48_12">Positive_Count</A>) - <b>is</b> - <b>begin</b> - <A HREF="terminal_interface-curses-text_io__ads.htm#ref_95_14">Set_Line</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_62_13">Get_Window</A>, <A HREF="terminal_interface-curses-text_io__ads.htm#ref_96_24">To</A>); - <b>end</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_96_14">Set_Line</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_226_13" HREF="terminal_interface-curses-text_io__ads.htm#ref_98_13">Col</A></FONT> (<FONT COLOR=red><A NAME="ref_226_18" HREF="terminal_interface-curses-text_io__ads.htm#ref_98_18">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_48_12">Positive_Count</A> -+ <b>function</b> <span class="symbol"><A NAME="ref_226_13" HREF="terminal_interface-curses-text_io__ads.htm#ref_98_13">Col</A></span> (<span class="symbol"><A NAME="ref_226_18" HREF="terminal_interface-curses-text_io__ads.htm#ref_98_18">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_48_12">Positive_Count</A> - <b>is</b> -- <FONT COLOR=red><A NAME="ref_228_7">Y</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_229_7">X</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -- <FONT COLOR=red><A NAME="ref_230_7">N</A></FONT> : Natural; -+ <span class="symbol"><A NAME="ref_228_7">Y</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_229_7">X</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -+ <span class="symbol"><A NAME="ref_230_7">N</A></span> : Natural; - <b>begin</b> -- <A HREF="terminal_interface-curses__ads.htm#ref_1246_14">Get_Cursor_Position</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_98_18">Win</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#ref_228_7">Y</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#ref_229_7">X</A>); -+ <A HREF="terminal_interface-curses__ads.htm#ref_1245_14">Get_Cursor_Position</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_98_18">Win</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#ref_228_7">Y</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#ref_229_7">X</A>); - <A HREF="terminal_interface-curses-text_io__adb.htm#ref_230_7">N</A> := Natural (<A HREF="terminal_interface-curses-text_io__adb.htm#ref_229_7">X</A>); <A HREF="terminal_interface-curses-text_io__adb.htm#ref_230_7">N</A> := <A HREF="terminal_interface-curses-text_io__adb.htm#ref_230_7">N</A> + 1; -- <FONT COLOR=green><EM>-- if N &gt; Natural (Count'Last) then</EM></FONT> -- <FONT COLOR=green><EM>-- raise Layout_Error;</EM></FONT> -- <FONT COLOR=green><EM>-- end if;</EM></FONT> -+ <span class="comment"><EM>-- if N &gt; Natural (Count'Last) then</EM></span> -+ <span class="comment"><EM>-- raise Layout_Error;</EM></span> -+ <span class="comment"><EM>-- end if;</EM></span> - <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_48_12">Positive_Count</A> (<A HREF="terminal_interface-curses-text_io__adb.htm#ref_230_7">N</A>); - <b>end</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_98_13">Col</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_240_13" HREF="terminal_interface-curses-text_io__ads.htm#ref_99_13">Col</A></FONT> <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_48_12">Positive_Count</A> -+ <b>function</b> <span class="symbol"><A NAME="ref_240_13" HREF="terminal_interface-curses-text_io__ads.htm#ref_99_13">Col</A></span> <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_48_12">Positive_Count</A> - <b>is</b> - <b>begin</b> - <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_98_13">Col</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_62_13">Get_Window</A>); - <b>end</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_99_13">Col</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_246_13" HREF="terminal_interface-curses-text_io__ads.htm#ref_101_13">Line</A></FONT> (<FONT COLOR=red><A NAME="ref_246_19" HREF="terminal_interface-curses-text_io__ads.htm#ref_101_19">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_48_12">Positive_Count</A> -+ <b>function</b> <span class="symbol"><A NAME="ref_246_13" HREF="terminal_interface-curses-text_io__ads.htm#ref_101_13">Line</A></span> (<span class="symbol"><A NAME="ref_246_19" HREF="terminal_interface-curses-text_io__ads.htm#ref_101_19">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_48_12">Positive_Count</A> - <b>is</b> -- <FONT COLOR=red><A NAME="ref_248_7">Y</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_249_7">X</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -- <FONT COLOR=red><A NAME="ref_250_7">N</A></FONT> : Natural; -+ <span class="symbol"><A NAME="ref_248_7">Y</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_249_7">X</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -+ <span class="symbol"><A NAME="ref_250_7">N</A></span> : Natural; - <b>begin</b> -- <A HREF="terminal_interface-curses__ads.htm#ref_1246_14">Get_Cursor_Position</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_101_19">Win</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#ref_248_7">Y</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#ref_249_7">X</A>); -+ <A HREF="terminal_interface-curses__ads.htm#ref_1245_14">Get_Cursor_Position</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_101_19">Win</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#ref_248_7">Y</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#ref_249_7">X</A>); - <A HREF="terminal_interface-curses-text_io__adb.htm#ref_250_7">N</A> := Natural (<A HREF="terminal_interface-curses-text_io__adb.htm#ref_248_7">Y</A>); <A HREF="terminal_interface-curses-text_io__adb.htm#ref_250_7">N</A> := <A HREF="terminal_interface-curses-text_io__adb.htm#ref_250_7">N</A> + 1; -- <FONT COLOR=green><EM>-- if N &gt; Natural (Count'Last) then</EM></FONT> -- <FONT COLOR=green><EM>-- raise Layout_Error;</EM></FONT> -- <FONT COLOR=green><EM>-- end if;</EM></FONT> -+ <span class="comment"><EM>-- if N &gt; Natural (Count'Last) then</EM></span> -+ <span class="comment"><EM>-- raise Layout_Error;</EM></span> -+ <span class="comment"><EM>-- end if;</EM></span> - <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_48_12">Positive_Count</A> (<A HREF="terminal_interface-curses-text_io__adb.htm#ref_250_7">N</A>); - <b>end</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_101_13">Line</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_260_13" HREF="terminal_interface-curses-text_io__ads.htm#ref_102_13">Line</A></FONT> <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_48_12">Positive_Count</A> -+ <b>function</b> <span class="symbol"><A NAME="ref_260_13" HREF="terminal_interface-curses-text_io__ads.htm#ref_102_13">Line</A></span> <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_48_12">Positive_Count</A> - <b>is</b> - <b>begin</b> - <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_101_13">Line</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_62_13">Get_Window</A>); - <b>end</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_102_13">Line</A>; - -- <FONT COLOR=green><EM>-----------------------</EM></FONT> -- <FONT COLOR=green><EM>-- Characters Output --</EM></FONT> -- <FONT COLOR=green><EM>-----------------------</EM></FONT> -- -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_270_14" HREF="terminal_interface-curses-text_io__ads.htm#ref_108_14">Put</A></FONT> (<FONT COLOR=red><A NAME="ref_270_19" HREF="terminal_interface-curses-text_io__ads.htm#ref_108_19">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; <FONT COLOR=red><A NAME="ref_270_34" HREF="terminal_interface-curses-text_io__ads.htm#ref_108_34">Item</A></FONT> : Character) -- <b>is</b> -- <FONT COLOR=red><A NAME="ref_272_7">P_Size</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_47_12">Count</A> := <A HREF="terminal_interface-curses-text_io__ads.htm#ref_80_13">Page_Length</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_108_19">Win</A>); -- <FONT COLOR=red><A NAME="ref_273_7">Y</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_274_7">X</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -- <FONT COLOR=red><A NAME="ref_275_7">L</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_63_12">Line_Count</A>; -- <FONT COLOR=red><A NAME="ref_276_7">C</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_65_12">Column_Count</A>; -+ <span class="comment"><EM>-----------------------</EM></span> -+ <span class="comment"><EM>-- Characters Output --</EM></span> -+ <span class="comment"><EM>-----------------------</EM></span> -+ -+ <b>procedure</b> <span class="symbol"><A NAME="ref_270_14" HREF="terminal_interface-curses-text_io__ads.htm#ref_108_14">Put</A></span> (<span class="symbol"><A NAME="ref_270_19" HREF="terminal_interface-curses-text_io__ads.htm#ref_108_19">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; <span class="symbol"><A NAME="ref_270_34" HREF="terminal_interface-curses-text_io__ads.htm#ref_108_34">Item</A></span> : Character) -+ <b>is</b> -+ <span class="symbol"><A NAME="ref_272_7">P_Size</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_47_12">Count</A> := <A HREF="terminal_interface-curses-text_io__ads.htm#ref_80_13">Page_Length</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_108_19">Win</A>); -+ <span class="symbol"><A NAME="ref_273_7">Y</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_274_7">X</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -+ <span class="symbol"><A NAME="ref_275_7">L</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_63_12">Line_Count</A>; -+ <span class="symbol"><A NAME="ref_276_7">C</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_65_12">Column_Count</A>; - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses-text_io__adb.htm#ref_272_7">P_Size</A> &gt; 0 <b>then</b> -- <A HREF="terminal_interface-curses__ads.htm#ref_1246_14">Get_Cursor_Position</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_108_19">Win</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#ref_273_7">Y</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#ref_274_7">X</A>); -- <A HREF="terminal_interface-curses__ads.htm#ref_1230_14">Get_Size</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_108_19">Win</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#ref_275_7">L</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#ref_276_7">C</A>); -+ <A HREF="terminal_interface-curses__ads.htm#ref_1245_14">Get_Cursor_Position</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_108_19">Win</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#ref_273_7">Y</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#ref_274_7">X</A>); -+ <A HREF="terminal_interface-curses__ads.htm#ref_1229_14">Get_Size</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_108_19">Win</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#ref_275_7">L</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#ref_276_7">C</A>); - <b>if</b> (<A HREF="terminal_interface-curses-text_io__adb.htm#ref_273_7">Y</A> + 1) = <A HREF="terminal_interface-curses-text_io__adb.htm#ref_275_7">L</A> <b>and</b> <b>then</b> (<A HREF="terminal_interface-curses-text_io__adb.htm#ref_274_7">X</A> + 1) = <A HREF="terminal_interface-curses-text_io__adb.htm#ref_276_7">C</A> <b>then</b> - <A HREF="terminal_interface-curses-text_io__ads.htm#ref_89_14">New_Page</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_108_19">Win</A>); - <b>end</b> <b>if</b>; - <b>end</b> <b>if</b>; -- <A HREF="terminal_interface-curses__ads.htm#ref_530_14">Add</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_108_19">Win</A>, <A HREF="terminal_interface-curses-text_io__ads.htm#ref_108_34">Item</A>); -+ <A HREF="terminal_interface-curses__ads.htm#ref_529_14">Add</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_108_19">Win</A>, <A HREF="terminal_interface-curses-text_io__ads.htm#ref_108_34">Item</A>); - <b>end</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_108_14">Put</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_288_14" HREF="terminal_interface-curses-text_io__ads.htm#ref_109_14">Put</A></FONT> (<FONT COLOR=red><A NAME="ref_288_19" HREF="terminal_interface-curses-text_io__ads.htm#ref_109_19">Item</A></FONT> : Character) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_288_14" HREF="terminal_interface-curses-text_io__ads.htm#ref_109_14">Put</A></span> (<span class="symbol"><A NAME="ref_288_19" HREF="terminal_interface-curses-text_io__ads.htm#ref_109_19">Item</A></span> : Character) - <b>is</b> - <b>begin</b> - <A HREF="terminal_interface-curses-text_io__ads.htm#ref_108_14">Put</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_62_13">Get_Window</A>, <A HREF="terminal_interface-curses-text_io__ads.htm#ref_109_19">Item</A>); - <b>end</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_109_14">Put</A>; - -- <FONT COLOR=green><EM>--------------------</EM></FONT> -- <FONT COLOR=green><EM>-- Strings-Output --</EM></FONT> -- <FONT COLOR=green><EM>--------------------</EM></FONT> -- -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_298_14" HREF="terminal_interface-curses-text_io__ads.htm#ref_115_14">Put</A></FONT> (<FONT COLOR=red><A NAME="ref_298_19" HREF="terminal_interface-curses-text_io__ads.htm#ref_115_19">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; <FONT COLOR=red><A NAME="ref_298_34" HREF="terminal_interface-curses-text_io__ads.htm#ref_115_34">Item</A></FONT> : String) -- <b>is</b> -- <FONT COLOR=red><A NAME="ref_300_7">P_Size</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_47_12">Count</A> := <A HREF="terminal_interface-curses-text_io__ads.htm#ref_80_13">Page_Length</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_115_19">Win</A>); -- <FONT COLOR=red><A NAME="ref_301_7">Y</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_302_7">X</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -- <FONT COLOR=red><A NAME="ref_303_7">L</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_63_12">Line_Count</A>; -- <FONT COLOR=red><A NAME="ref_304_7">C</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_65_12">Column_Count</A>; -+ <span class="comment"><EM>--------------------</EM></span> -+ <span class="comment"><EM>-- Strings-Output --</EM></span> -+ <span class="comment"><EM>--------------------</EM></span> -+ -+ <b>procedure</b> <span class="symbol"><A NAME="ref_298_14" HREF="terminal_interface-curses-text_io__ads.htm#ref_115_14">Put</A></span> (<span class="symbol"><A NAME="ref_298_19" HREF="terminal_interface-curses-text_io__ads.htm#ref_115_19">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; <span class="symbol"><A NAME="ref_298_34" HREF="terminal_interface-curses-text_io__ads.htm#ref_115_34">Item</A></span> : String) -+ <b>is</b> -+ <span class="symbol"><A NAME="ref_300_7">P_Size</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_47_12">Count</A> := <A HREF="terminal_interface-curses-text_io__ads.htm#ref_80_13">Page_Length</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_115_19">Win</A>); -+ <span class="symbol"><A NAME="ref_301_7">Y</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_302_7">X</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -+ <span class="symbol"><A NAME="ref_303_7">L</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_63_12">Line_Count</A>; -+ <span class="symbol"><A NAME="ref_304_7">C</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_65_12">Column_Count</A>; - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses-text_io__adb.htm#ref_300_7">P_Size</A> &gt; 0 <b>then</b> -- <A HREF="terminal_interface-curses__ads.htm#ref_1246_14">Get_Cursor_Position</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_115_19">Win</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#ref_301_7">Y</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#ref_302_7">X</A>); -- <A HREF="terminal_interface-curses__ads.htm#ref_1230_14">Get_Size</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_115_19">Win</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#ref_303_7">L</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#ref_304_7">C</A>); -+ <A HREF="terminal_interface-curses__ads.htm#ref_1245_14">Get_Cursor_Position</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_115_19">Win</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#ref_301_7">Y</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#ref_302_7">X</A>); -+ <A HREF="terminal_interface-curses__ads.htm#ref_1229_14">Get_Size</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_115_19">Win</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#ref_303_7">L</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#ref_304_7">C</A>); - <b>if</b> (<A HREF="terminal_interface-curses-text_io__adb.htm#ref_301_7">Y</A> + 1) = <A HREF="terminal_interface-curses-text_io__adb.htm#ref_303_7">L</A> <b>and</b> <b>then</b> (<A HREF="terminal_interface-curses-text_io__adb.htm#ref_302_7">X</A> + 1 + <A HREF="terminal_interface-curses-text_io__ads.htm#ref_115_34">Item</A>'Length) &gt;= <A HREF="terminal_interface-curses-text_io__adb.htm#ref_304_7">C</A> <b>then</b> - <A HREF="terminal_interface-curses-text_io__ads.htm#ref_89_14">New_Page</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_115_19">Win</A>); - <b>end</b> <b>if</b>; - <b>end</b> <b>if</b>; -- <A HREF="terminal_interface-curses__ads.htm#ref_655_14">Add</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_115_19">Win</A>, <A HREF="terminal_interface-curses-text_io__ads.htm#ref_115_34">Item</A>); -+ <A HREF="terminal_interface-curses__ads.htm#ref_654_14">Add</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_115_19">Win</A>, <A HREF="terminal_interface-curses-text_io__ads.htm#ref_115_34">Item</A>); - <b>end</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_115_14">Put</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_316_14" HREF="terminal_interface-curses-text_io__ads.htm#ref_116_14">Put</A></FONT> (<FONT COLOR=red><A NAME="ref_316_19" HREF="terminal_interface-curses-text_io__ads.htm#ref_116_19">Item</A></FONT> : String) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_316_14" HREF="terminal_interface-curses-text_io__ads.htm#ref_116_14">Put</A></span> (<span class="symbol"><A NAME="ref_316_19" HREF="terminal_interface-curses-text_io__ads.htm#ref_116_19">Item</A></span> : String) - <b>is</b> - <b>begin</b> - <A HREF="terminal_interface-curses-text_io__ads.htm#ref_115_14">Put</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_62_13">Get_Window</A>, <A HREF="terminal_interface-curses-text_io__ads.htm#ref_116_19">Item</A>); - <b>end</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_116_14">Put</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_322_14" HREF="terminal_interface-curses-text_io__ads.htm#ref_118_14">Put_Line</A></FONT> -- (<FONT COLOR=red><A NAME="ref_323_7" HREF="terminal_interface-curses-text_io__ads.htm#ref_119_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- <FONT COLOR=red><A NAME="ref_324_7" HREF="terminal_interface-curses-text_io__ads.htm#ref_120_7">Item</A></FONT> : String) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_322_14" HREF="terminal_interface-curses-text_io__ads.htm#ref_118_14">Put_Line</A></span> -+ (<span class="symbol"><A NAME="ref_323_7" HREF="terminal_interface-curses-text_io__ads.htm#ref_119_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="symbol"><A NAME="ref_324_7" HREF="terminal_interface-curses-text_io__ads.htm#ref_120_7">Item</A></span> : String) - <b>is</b> - <b>begin</b> - <A HREF="terminal_interface-curses-text_io__ads.htm#ref_115_14">Put</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_119_7">Win</A>, <A HREF="terminal_interface-curses-text_io__ads.htm#ref_120_7">Item</A>); - <A HREF="terminal_interface-curses-text_io__ads.htm#ref_86_14">New_Line</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_119_7">Win</A>, 1); - <b>end</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_118_14">Put_Line</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_331_14" HREF="terminal_interface-curses-text_io__ads.htm#ref_122_14">Put_Line</A></FONT> -- (<FONT COLOR=red><A NAME="ref_332_7" HREF="terminal_interface-curses-text_io__ads.htm#ref_123_7">Item</A></FONT> : String) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_331_14" HREF="terminal_interface-curses-text_io__ads.htm#ref_122_14">Put_Line</A></span> -+ (<span class="symbol"><A NAME="ref_332_7" HREF="terminal_interface-curses-text_io__ads.htm#ref_123_7">Item</A></span> : String) - <b>is</b> - <b>begin</b> - <A HREF="terminal_interface-curses-text_io__ads.htm#ref_118_14">Put_Line</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_62_13">Get_Window</A>, <A HREF="terminal_interface-curses-text_io__ads.htm#ref_123_7">Item</A>); -diff -Naur ncurses-5.9/doc/html/ada/terminal_interface-curses-text_io__ads.htm ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-text_io__ads.htm ---- ncurses-5.9/doc/html/ada/terminal_interface-curses-text_io__ads.htm 2011-03-26 22:54:30.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-text_io__ads.htm 2014-09-01 16:33:22.304792036 +0200 -@@ -1,142 +1,154 @@ --<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> --<HTML><HEAD><TITLE>terminal_interface-curses-text_io.ads</TITLE></HEAD> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> -+<HTML> -+<HEAD> -+<TITLE>terminal_interface-curses-text_io.ads</TITLE> -+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> -+<style type="text/css"> -+*.comment { -+ color: green; -+} -+*.symbol { -+ color: red; -+} -+</style> -+</HEAD> - <BODY> --<HR><DIV ALIGN="center"><H1> File : terminal_interface-curses-text_io.ads </H1></DIV><HR> -+<HR><DIV style="text-align:center"><H1> File : terminal_interface-curses-text_io.ads </H1></DIV><HR> - <PRE> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Terminal_Interface.Curses.Text_IO --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- S P E C --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Copyright (c) 1998-2003,2009 Free Software Foundation, Inc. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></FONT> --<FONT COLOR=green><EM>-- copy of this software and associated documentation files (the --</EM></FONT> --<FONT COLOR=green><EM>-- "Software"), to deal in the Software without restriction, including --</EM></FONT> --<FONT COLOR=green><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></FONT> --<FONT COLOR=green><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></FONT> --<FONT COLOR=green><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></FONT> --<FONT COLOR=green><EM>-- furnished to do so, subject to the following conditions: --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- The above copyright notice and this permission notice shall be included --</EM></FONT> --<FONT COLOR=green><EM>-- in all copies or substantial portions of the Software. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></FONT> --<FONT COLOR=green><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></FONT> --<FONT COLOR=green><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></FONT> --<FONT COLOR=green><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></FONT> --<FONT COLOR=green><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></FONT> --<FONT COLOR=green><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></FONT> --<FONT COLOR=green><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></FONT> --<FONT COLOR=green><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></FONT> --<FONT COLOR=green><EM>-- sale, use or other dealings in this Software without prior written --</EM></FONT> --<FONT COLOR=green><EM>-- authorization. --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Author: Juergen Pfeifer, 1996</EM></FONT> --<FONT COLOR=green><EM>-- Version Control:</EM></FONT> --<FONT COLOR=green><EM>-- @Revision: 1.14 @</EM></FONT> --<FONT COLOR=green><EM>-- Binding Version 01.00</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Terminal_Interface.Curses.Text_IO --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- S P E C --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Copyright (c) 1998-2003,2009 Free Software Foundation, Inc. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></span> -+<span class="comment"><EM>-- copy of this software and associated documentation files (the --</EM></span> -+<span class="comment"><EM>-- "Software"), to deal in the Software without restriction, including --</EM></span> -+<span class="comment"><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></span> -+<span class="comment"><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></span> -+<span class="comment"><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></span> -+<span class="comment"><EM>-- furnished to do so, subject to the following conditions: --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- The above copyright notice and this permission notice shall be included --</EM></span> -+<span class="comment"><EM>-- in all copies or substantial portions of the Software. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></span> -+<span class="comment"><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></span> -+<span class="comment"><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></span> -+<span class="comment"><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></span> -+<span class="comment"><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></span> -+<span class="comment"><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></span> -+<span class="comment"><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></span> -+<span class="comment"><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></span> -+<span class="comment"><EM>-- sale, use or other dealings in this Software without prior written --</EM></span> -+<span class="comment"><EM>-- authorization. --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Author: Juergen Pfeifer, 1996</EM></span> -+<span class="comment"><EM>-- Version Control:</EM></span> -+<span class="comment"><EM>-- @Revision: 1.14 @</EM></span> -+<span class="comment"><EM>-- Binding Version 01.00</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> - <b>with</b> Ada.Text_IO; - <b>with</b> Ada.IO_Exceptions; - --<b>package</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<FONT COLOR=red><A NAME="ref_44_35" HREF="terminal_interface-curses-text_io__adb.htm#ref_42_40">Text_IO</A></FONT> <b>is</b> -+<b>package</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<span class="symbol"><A NAME="ref_44_35" HREF="terminal_interface-curses-text_io__adb.htm#ref_42_40">Text_IO</A></span> <b>is</b> - - <b>use</b> <b>type</b> Ada.Text_IO.Count; -- <b>subtype</b> <FONT COLOR=red><A NAME="ref_47_12">Count</A></FONT> <b>is</b> Ada.Text_IO.Count; -- <b>subtype</b> <FONT COLOR=red><A NAME="ref_48_12">Positive_Count</A></FONT> <b>is</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_47_12">Count</A> <b>range</b> 1 .. <A HREF="terminal_interface-curses-text_io__ads.htm#ref_47_12">Count</A>'Last; -+ <b>subtype</b> <span class="symbol"><A NAME="ref_47_12">Count</A></span> <b>is</b> Ada.Text_IO.Count; -+ <b>subtype</b> <span class="symbol"><A NAME="ref_48_12">Positive_Count</A></span> <b>is</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_47_12">Count</A> <b>range</b> 1 .. <A HREF="terminal_interface-curses-text_io__ads.htm#ref_47_12">Count</A>'Last; - -- <b>subtype</b> <FONT COLOR=red><A NAME="ref_50_12">Field</A></FONT> <b>is</b> Ada.Text_IO.Field; -- <b>subtype</b> <FONT COLOR=red><A NAME="ref_51_12">Number_Base</A></FONT> <b>is</b> Integer <b>range</b> 2 .. 16; -+ <b>subtype</b> <span class="symbol"><A NAME="ref_50_12">Field</A></span> <b>is</b> Ada.Text_IO.Field; -+ <b>subtype</b> <span class="symbol"><A NAME="ref_51_12">Number_Base</A></span> <b>is</b> Integer <b>range</b> 2 .. 16; - -- <b>type</b> <FONT COLOR=red><A NAME="ref_53_9">Type_Set</A></FONT> <b>is</b> (<FONT COLOR=red><A NAME="ref_53_22">Lower_Case</A></FONT>, <FONT COLOR=red><A NAME="ref_53_34">Upper_Case</A></FONT>, <FONT COLOR=red><A NAME="ref_53_46">Mixed_Case</A></FONT>); -+ <b>type</b> <span class="symbol"><A NAME="ref_53_9">Type_Set</A></span> <b>is</b> (<span class="symbol"><A NAME="ref_53_22">Lower_Case</A></span>, <span class="symbol"><A NAME="ref_53_34">Upper_Case</A></span>, <span class="symbol"><A NAME="ref_53_46">Mixed_Case</A></span>); - -- <FONT COLOR=green><EM>-- For most of the routines you will see a version without a Window</EM></FONT> -- <FONT COLOR=green><EM>-- type parameter. They will operate on a default window, which can</EM></FONT> -- <FONT COLOR=green><EM>-- be set by the user. It is initially equal to Standard_Window.</EM></FONT> -+ <span class="comment"><EM>-- For most of the routines you will see a version without a Window</EM></span> -+ <span class="comment"><EM>-- type parameter. They will operate on a default window, which can</EM></span> -+ <span class="comment"><EM>-- be set by the user. It is initially equal to Standard_Window.</EM></span> - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_59_14" HREF="terminal_interface-curses-text_io__adb.htm#ref_46_14">Set_Window</A></FONT> (<FONT COLOR=red><A NAME="ref_59_26" HREF="terminal_interface-curses-text_io__adb.htm#ref_46_26">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>); -- <FONT COLOR=green><EM>-- Set Win as the default window</EM></FONT> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_59_14" HREF="terminal_interface-curses-text_io__adb.htm#ref_46_14">Set_Window</A></span> (<span class="symbol"><A NAME="ref_59_26" HREF="terminal_interface-curses-text_io__adb.htm#ref_46_26">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>); -+ <span class="comment"><EM>-- Set Win as the default window</EM></span> - -- <b>function</b> <FONT COLOR=red><A NAME="ref_62_13" HREF="terminal_interface-curses-text_io__adb.htm#ref_52_13">Get_Window</A></FONT> <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- <FONT COLOR=green><EM>-- Get the current default window</EM></FONT> -+ <b>function</b> <span class="symbol"><A NAME="ref_62_13" HREF="terminal_interface-curses-text_io__adb.htm#ref_52_13">Get_Window</A></span> <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="comment"><EM>-- Get the current default window</EM></span> - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_65_14" HREF="terminal_interface-curses-text_io__adb.htm#ref_63_14">Flush</A></FONT> (<FONT COLOR=red><A NAME="ref_65_21" HREF="terminal_interface-curses-text_io__adb.htm#ref_63_21">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>); -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_66_14" HREF="terminal_interface-curses-text_io__adb.htm#ref_69_14">Flush</A></FONT>; -+ <b>procedure</b> <span class="symbol"><A NAME="ref_65_14" HREF="terminal_interface-curses-text_io__adb.htm#ref_63_14">Flush</A></span> (<span class="symbol"><A NAME="ref_65_21" HREF="terminal_interface-curses-text_io__adb.htm#ref_63_21">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>); -+ <b>procedure</b> <span class="symbol"><A NAME="ref_66_14" HREF="terminal_interface-curses-text_io__adb.htm#ref_69_14">Flush</A></span>; - -- <FONT COLOR=green><EM>--------------------------------------------</EM></FONT> -- <FONT COLOR=green><EM>-- Specification of line and page lengths --</EM></FONT> -- <FONT COLOR=green><EM>--------------------------------------------</EM></FONT> -+ <span class="comment"><EM>--------------------------------------------</EM></span> -+ <span class="comment"><EM>-- Specification of line and page lengths --</EM></span> -+ <span class="comment"><EM>--------------------------------------------</EM></span> - -- <FONT COLOR=green><EM>-- There are no set routines in this package. I assume, that you allocate</EM></FONT> -- <FONT COLOR=green><EM>-- the window with an appropriate size.</EM></FONT> -- <FONT COLOR=green><EM>-- A scroll-window is interpreted as an page with unbounded page length,</EM></FONT> -- <FONT COLOR=green><EM>-- i.e. it returns the conventional 0 as page length.</EM></FONT> -+ <span class="comment"><EM>-- There are no set routines in this package. I assume, that you allocate</EM></span> -+ <span class="comment"><EM>-- the window with an appropriate size.</EM></span> -+ <span class="comment"><EM>-- A scroll-window is interpreted as an page with unbounded page length,</EM></span> -+ <span class="comment"><EM>-- i.e. it returns the conventional 0 as page length.</EM></span> - -- <b>function</b> <FONT COLOR=red><A NAME="ref_77_13" HREF="terminal_interface-curses-text_io__adb.htm#ref_84_13">Line_Length</A></FONT> (<FONT COLOR=red><A NAME="ref_77_26" HREF="terminal_interface-curses-text_io__adb.htm#ref_84_26">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_47_12">Count</A>; -- <b>function</b> <FONT COLOR=red><A NAME="ref_78_13" HREF="terminal_interface-curses-text_io__adb.htm#ref_96_13">Line_Length</A></FONT> <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_47_12">Count</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_77_13" HREF="terminal_interface-curses-text_io__adb.htm#ref_84_13">Line_Length</A></span> (<span class="symbol"><A NAME="ref_77_26" HREF="terminal_interface-curses-text_io__adb.htm#ref_84_26">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_47_12">Count</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_78_13" HREF="terminal_interface-curses-text_io__adb.htm#ref_96_13">Line_Length</A></span> <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_47_12">Count</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_80_13" HREF="terminal_interface-curses-text_io__adb.htm#ref_102_13">Page_Length</A></FONT> (<FONT COLOR=red><A NAME="ref_80_26" HREF="terminal_interface-curses-text_io__adb.htm#ref_102_26">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_47_12">Count</A>; -- <b>function</b> <FONT COLOR=red><A NAME="ref_81_13" HREF="terminal_interface-curses-text_io__adb.htm#ref_118_13">Page_Length</A></FONT> <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_47_12">Count</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_80_13" HREF="terminal_interface-curses-text_io__adb.htm#ref_102_13">Page_Length</A></span> (<span class="symbol"><A NAME="ref_80_26" HREF="terminal_interface-curses-text_io__adb.htm#ref_102_26">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_47_12">Count</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_81_13" HREF="terminal_interface-curses-text_io__adb.htm#ref_118_13">Page_Length</A></span> <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_47_12">Count</A>; - -- <FONT COLOR=green><EM>------------------------------------</EM></FONT> -- <FONT COLOR=green><EM>-- Column, Line, and Page Control --</EM></FONT> -- <FONT COLOR=green><EM>------------------------------------</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_86_14" HREF="terminal_interface-curses-text_io__adb.htm#ref_127_14">New_Line</A></FONT> (<FONT COLOR=red><A NAME="ref_86_24" HREF="terminal_interface-curses-text_io__adb.htm#ref_127_24">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; <FONT COLOR=red><A NAME="ref_86_38" HREF="terminal_interface-curses-text_io__adb.htm#ref_127_38">Spacing</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_48_12">Positive_Count</A> := 1); -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_87_14" HREF="terminal_interface-curses-text_io__adb.htm#ref_144_14">New_Line</A></FONT> (<FONT COLOR=red><A NAME="ref_87_24" HREF="terminal_interface-curses-text_io__adb.htm#ref_144_24">Spacing</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_48_12">Positive_Count</A> := 1); -+ <span class="comment"><EM>------------------------------------</EM></span> -+ <span class="comment"><EM>-- Column, Line, and Page Control --</EM></span> -+ <span class="comment"><EM>------------------------------------</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_86_14" HREF="terminal_interface-curses-text_io__adb.htm#ref_127_14">New_Line</A></span> (<span class="symbol"><A NAME="ref_86_24" HREF="terminal_interface-curses-text_io__adb.htm#ref_127_24">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; <span class="symbol"><A NAME="ref_86_38" HREF="terminal_interface-curses-text_io__adb.htm#ref_127_38">Spacing</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_48_12">Positive_Count</A> := 1); -+ <b>procedure</b> <span class="symbol"><A NAME="ref_87_14" HREF="terminal_interface-curses-text_io__adb.htm#ref_144_14">New_Line</A></span> (<span class="symbol"><A NAME="ref_87_24" HREF="terminal_interface-curses-text_io__adb.htm#ref_144_24">Spacing</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_48_12">Positive_Count</A> := 1); - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_89_14" HREF="terminal_interface-curses-text_io__adb.htm#ref_150_14">New_Page</A></FONT> (<FONT COLOR=red><A NAME="ref_89_24" HREF="terminal_interface-curses-text_io__adb.htm#ref_150_24">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>); -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_90_14" HREF="terminal_interface-curses-text_io__adb.htm#ref_156_14">New_Page</A></FONT>; -+ <b>procedure</b> <span class="symbol"><A NAME="ref_89_14" HREF="terminal_interface-curses-text_io__adb.htm#ref_150_14">New_Page</A></span> (<span class="symbol"><A NAME="ref_89_24" HREF="terminal_interface-curses-text_io__adb.htm#ref_150_24">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>); -+ <b>procedure</b> <span class="symbol"><A NAME="ref_90_14" HREF="terminal_interface-curses-text_io__adb.htm#ref_156_14">New_Page</A></span>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_92_14" HREF="terminal_interface-curses-text_io__adb.htm#ref_162_14">Set_Col</A></FONT> (<FONT COLOR=red><A NAME="ref_92_23" HREF="terminal_interface-curses-text_io__adb.htm#ref_162_23">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; <FONT COLOR=red><A NAME="ref_92_38" HREF="terminal_interface-curses-text_io__adb.htm#ref_162_38">To</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_48_12">Positive_Count</A>); -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_93_14" HREF="terminal_interface-curses-text_io__adb.htm#ref_190_14">Set_Col</A></FONT> (<FONT COLOR=red><A NAME="ref_93_23" HREF="terminal_interface-curses-text_io__adb.htm#ref_190_23">To</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_48_12">Positive_Count</A>); -+ <b>procedure</b> <span class="symbol"><A NAME="ref_92_14" HREF="terminal_interface-curses-text_io__adb.htm#ref_162_14">Set_Col</A></span> (<span class="symbol"><A NAME="ref_92_23" HREF="terminal_interface-curses-text_io__adb.htm#ref_162_23">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; <span class="symbol"><A NAME="ref_92_38" HREF="terminal_interface-curses-text_io__adb.htm#ref_162_38">To</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_48_12">Positive_Count</A>); -+ <b>procedure</b> <span class="symbol"><A NAME="ref_93_14" HREF="terminal_interface-curses-text_io__adb.htm#ref_190_14">Set_Col</A></span> (<span class="symbol"><A NAME="ref_93_23" HREF="terminal_interface-curses-text_io__adb.htm#ref_190_23">To</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_48_12">Positive_Count</A>); - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_95_14" HREF="terminal_interface-curses-text_io__adb.htm#ref_196_14">Set_Line</A></FONT> (<FONT COLOR=red><A NAME="ref_95_24" HREF="terminal_interface-curses-text_io__adb.htm#ref_196_24">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; <FONT COLOR=red><A NAME="ref_95_38" HREF="terminal_interface-curses-text_io__adb.htm#ref_196_38">To</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_48_12">Positive_Count</A>); -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_96_14" HREF="terminal_interface-curses-text_io__adb.htm#ref_220_14">Set_Line</A></FONT> (<FONT COLOR=red><A NAME="ref_96_24" HREF="terminal_interface-curses-text_io__adb.htm#ref_220_24">To</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_48_12">Positive_Count</A>); -+ <b>procedure</b> <span class="symbol"><A NAME="ref_95_14" HREF="terminal_interface-curses-text_io__adb.htm#ref_196_14">Set_Line</A></span> (<span class="symbol"><A NAME="ref_95_24" HREF="terminal_interface-curses-text_io__adb.htm#ref_196_24">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; <span class="symbol"><A NAME="ref_95_38" HREF="terminal_interface-curses-text_io__adb.htm#ref_196_38">To</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_48_12">Positive_Count</A>); -+ <b>procedure</b> <span class="symbol"><A NAME="ref_96_14" HREF="terminal_interface-curses-text_io__adb.htm#ref_220_14">Set_Line</A></span> (<span class="symbol"><A NAME="ref_96_24" HREF="terminal_interface-curses-text_io__adb.htm#ref_220_24">To</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_48_12">Positive_Count</A>); - -- <b>function</b> <FONT COLOR=red><A NAME="ref_98_13" HREF="terminal_interface-curses-text_io__adb.htm#ref_226_13">Col</A></FONT> (<FONT COLOR=red><A NAME="ref_98_18" HREF="terminal_interface-curses-text_io__adb.htm#ref_226_18">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_48_12">Positive_Count</A>; -- <b>function</b> <FONT COLOR=red><A NAME="ref_99_13" HREF="terminal_interface-curses-text_io__adb.htm#ref_240_13">Col</A></FONT> <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_48_12">Positive_Count</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_98_13" HREF="terminal_interface-curses-text_io__adb.htm#ref_226_13">Col</A></span> (<span class="symbol"><A NAME="ref_98_18" HREF="terminal_interface-curses-text_io__adb.htm#ref_226_18">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_48_12">Positive_Count</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_99_13" HREF="terminal_interface-curses-text_io__adb.htm#ref_240_13">Col</A></span> <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_48_12">Positive_Count</A>; - -- <b>function</b> <FONT COLOR=red><A NAME="ref_101_13" HREF="terminal_interface-curses-text_io__adb.htm#ref_246_13">Line</A></FONT> (<FONT COLOR=red><A NAME="ref_101_19" HREF="terminal_interface-curses-text_io__adb.htm#ref_246_19">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_48_12">Positive_Count</A>; -- <b>function</b> <FONT COLOR=red><A NAME="ref_102_13" HREF="terminal_interface-curses-text_io__adb.htm#ref_260_13">Line</A></FONT> <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_48_12">Positive_Count</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_101_13" HREF="terminal_interface-curses-text_io__adb.htm#ref_246_13">Line</A></span> (<span class="symbol"><A NAME="ref_101_19" HREF="terminal_interface-curses-text_io__adb.htm#ref_246_19">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_48_12">Positive_Count</A>; -+ <b>function</b> <span class="symbol"><A NAME="ref_102_13" HREF="terminal_interface-curses-text_io__adb.htm#ref_260_13">Line</A></span> <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_48_12">Positive_Count</A>; - -- <FONT COLOR=green><EM>-----------------------</EM></FONT> -- <FONT COLOR=green><EM>-- Characters-Output --</EM></FONT> -- <FONT COLOR=green><EM>-----------------------</EM></FONT> -+ <span class="comment"><EM>-----------------------</EM></span> -+ <span class="comment"><EM>-- Characters-Output --</EM></span> -+ <span class="comment"><EM>-----------------------</EM></span> - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_108_14" HREF="terminal_interface-curses-text_io__adb.htm#ref_270_14">Put</A></FONT> (<FONT COLOR=red><A NAME="ref_108_19" HREF="terminal_interface-curses-text_io__adb.htm#ref_270_19">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; <FONT COLOR=red><A NAME="ref_108_34" HREF="terminal_interface-curses-text_io__adb.htm#ref_270_34">Item</A></FONT> : Character); -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_109_14" HREF="terminal_interface-curses-text_io__adb.htm#ref_288_14">Put</A></FONT> (<FONT COLOR=red><A NAME="ref_109_19" HREF="terminal_interface-curses-text_io__adb.htm#ref_288_19">Item</A></FONT> : Character); -+ <b>procedure</b> <span class="symbol"><A NAME="ref_108_14" HREF="terminal_interface-curses-text_io__adb.htm#ref_270_14">Put</A></span> (<span class="symbol"><A NAME="ref_108_19" HREF="terminal_interface-curses-text_io__adb.htm#ref_270_19">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; <span class="symbol"><A NAME="ref_108_34" HREF="terminal_interface-curses-text_io__adb.htm#ref_270_34">Item</A></span> : Character); -+ <b>procedure</b> <span class="symbol"><A NAME="ref_109_14" HREF="terminal_interface-curses-text_io__adb.htm#ref_288_14">Put</A></span> (<span class="symbol"><A NAME="ref_109_19" HREF="terminal_interface-curses-text_io__adb.htm#ref_288_19">Item</A></span> : Character); - -- <FONT COLOR=green><EM>--------------------</EM></FONT> -- <FONT COLOR=green><EM>-- Strings-Output --</EM></FONT> -- <FONT COLOR=green><EM>--------------------</EM></FONT> -+ <span class="comment"><EM>--------------------</EM></span> -+ <span class="comment"><EM>-- Strings-Output --</EM></span> -+ <span class="comment"><EM>--------------------</EM></span> - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_115_14" HREF="terminal_interface-curses-text_io__adb.htm#ref_298_14">Put</A></FONT> (<FONT COLOR=red><A NAME="ref_115_19" HREF="terminal_interface-curses-text_io__adb.htm#ref_298_19">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; <FONT COLOR=red><A NAME="ref_115_34" HREF="terminal_interface-curses-text_io__adb.htm#ref_298_34">Item</A></FONT> : String); -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_116_14" HREF="terminal_interface-curses-text_io__adb.htm#ref_316_14">Put</A></FONT> (<FONT COLOR=red><A NAME="ref_116_19" HREF="terminal_interface-curses-text_io__adb.htm#ref_316_19">Item</A></FONT> : String); -+ <b>procedure</b> <span class="symbol"><A NAME="ref_115_14" HREF="terminal_interface-curses-text_io__adb.htm#ref_298_14">Put</A></span> (<span class="symbol"><A NAME="ref_115_19" HREF="terminal_interface-curses-text_io__adb.htm#ref_298_19">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; <span class="symbol"><A NAME="ref_115_34" HREF="terminal_interface-curses-text_io__adb.htm#ref_298_34">Item</A></span> : String); -+ <b>procedure</b> <span class="symbol"><A NAME="ref_116_14" HREF="terminal_interface-curses-text_io__adb.htm#ref_316_14">Put</A></span> (<span class="symbol"><A NAME="ref_116_19" HREF="terminal_interface-curses-text_io__adb.htm#ref_316_19">Item</A></span> : String); - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_118_14" HREF="terminal_interface-curses-text_io__adb.htm#ref_322_14">Put_Line</A></FONT> -- (<FONT COLOR=red><A NAME="ref_119_7" HREF="terminal_interface-curses-text_io__adb.htm#ref_323_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- <FONT COLOR=red><A NAME="ref_120_7" HREF="terminal_interface-curses-text_io__adb.htm#ref_324_7">Item</A></FONT> : String); -+ <b>procedure</b> <span class="symbol"><A NAME="ref_118_14" HREF="terminal_interface-curses-text_io__adb.htm#ref_322_14">Put_Line</A></span> -+ (<span class="symbol"><A NAME="ref_119_7" HREF="terminal_interface-curses-text_io__adb.htm#ref_323_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="symbol"><A NAME="ref_120_7" HREF="terminal_interface-curses-text_io__adb.htm#ref_324_7">Item</A></span> : String); - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_122_14" HREF="terminal_interface-curses-text_io__adb.htm#ref_331_14">Put_Line</A></FONT> -- (<FONT COLOR=red><A NAME="ref_123_7" HREF="terminal_interface-curses-text_io__adb.htm#ref_332_7">Item</A></FONT> : String); -+ <b>procedure</b> <span class="symbol"><A NAME="ref_122_14" HREF="terminal_interface-curses-text_io__adb.htm#ref_331_14">Put_Line</A></span> -+ (<span class="symbol"><A NAME="ref_123_7" HREF="terminal_interface-curses-text_io__adb.htm#ref_332_7">Item</A></span> : String); - -- <FONT COLOR=green><EM>-- Exceptions</EM></FONT> -+ <span class="comment"><EM>-- Exceptions</EM></span> - -- <FONT COLOR=red><A NAME="ref_127_4">Status_Error</A></FONT> : <b>exception</b> <b>renames</b> Ada.IO_Exceptions.Status_Error; -- <FONT COLOR=red><A NAME="ref_128_4">Mode_Error</A></FONT> : <b>exception</b> <b>renames</b> Ada.IO_Exceptions.Mode_Error; -- <FONT COLOR=red><A NAME="ref_129_4">Name_Error</A></FONT> : <b>exception</b> <b>renames</b> Ada.IO_Exceptions.Name_Error; -- <FONT COLOR=red><A NAME="ref_130_4">Use_Error</A></FONT> : <b>exception</b> <b>renames</b> Ada.IO_Exceptions.Use_Error; -- <FONT COLOR=red><A NAME="ref_131_4">Device_Error</A></FONT> : <b>exception</b> <b>renames</b> Ada.IO_Exceptions.Device_Error; -- <FONT COLOR=red><A NAME="ref_132_4">End_Error</A></FONT> : <b>exception</b> <b>renames</b> Ada.IO_Exceptions.End_Error; -- <FONT COLOR=red><A NAME="ref_133_4">Data_Error</A></FONT> : <b>exception</b> <b>renames</b> Ada.IO_Exceptions.Data_Error; -- <FONT COLOR=red><A NAME="ref_134_4">Layout_Error</A></FONT> : <b>exception</b> <b>renames</b> Ada.IO_Exceptions.Layout_Error; -+ <span class="symbol"><A NAME="ref_127_4">Status_Error</A></span> : <b>exception</b> <b>renames</b> Ada.IO_Exceptions.Status_Error; -+ <span class="symbol"><A NAME="ref_128_4">Mode_Error</A></span> : <b>exception</b> <b>renames</b> Ada.IO_Exceptions.Mode_Error; -+ <span class="symbol"><A NAME="ref_129_4">Name_Error</A></span> : <b>exception</b> <b>renames</b> Ada.IO_Exceptions.Name_Error; -+ <span class="symbol"><A NAME="ref_130_4">Use_Error</A></span> : <b>exception</b> <b>renames</b> Ada.IO_Exceptions.Use_Error; -+ <span class="symbol"><A NAME="ref_131_4">Device_Error</A></span> : <b>exception</b> <b>renames</b> Ada.IO_Exceptions.Device_Error; -+ <span class="symbol"><A NAME="ref_132_4">End_Error</A></span> : <b>exception</b> <b>renames</b> Ada.IO_Exceptions.End_Error; -+ <span class="symbol"><A NAME="ref_133_4">Data_Error</A></span> : <b>exception</b> <b>renames</b> Ada.IO_Exceptions.Data_Error; -+ <span class="symbol"><A NAME="ref_134_4">Layout_Error</A></span> : <b>exception</b> <b>renames</b> Ada.IO_Exceptions.Layout_Error; - - <b>end</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-text_io__ads.htm#ref_44_35">Text_IO</A>; - </PRE></BODY></HTML> -diff -Naur ncurses-5.9/doc/html/ada/terminal_interface-curses-text_io-aux__adb.htm ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-text_io-aux__adb.htm ---- ncurses-5.9/doc/html/ada/terminal_interface-curses-text_io-aux__adb.htm 2011-03-20 00:18:41.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-text_io-aux__adb.htm 2014-09-01 16:33:22.299792028 +0200 -@@ -1,69 +1,81 @@ --<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> --<HTML><HEAD><TITLE>terminal_interface-curses-text_io-aux.adb</TITLE></HEAD> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> -+<HTML> -+<HEAD> -+<TITLE>terminal_interface-curses-text_io-aux.adb</TITLE> -+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> -+<style type="text/css"> -+*.comment { -+ color: green; -+} -+*.symbol { -+ color: red; -+} -+</style> -+</HEAD> - <BODY> --<HR><DIV ALIGN="center"><H1> File : terminal_interface-curses-text_io-aux.adb </H1></DIV><HR> -+<HR><DIV style="text-align:center"><H1> File : terminal_interface-curses-text_io-aux.adb </H1></DIV><HR> - <PRE> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Terminal_Interface.Curses.Text_IO.Aux --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- B O D Y --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Copyright (c) 1998-2006,2009 Free Software Foundation, Inc. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></FONT> --<FONT COLOR=green><EM>-- copy of this software and associated documentation files (the --</EM></FONT> --<FONT COLOR=green><EM>-- "Software"), to deal in the Software without restriction, including --</EM></FONT> --<FONT COLOR=green><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></FONT> --<FONT COLOR=green><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></FONT> --<FONT COLOR=green><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></FONT> --<FONT COLOR=green><EM>-- furnished to do so, subject to the following conditions: --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- The above copyright notice and this permission notice shall be included --</EM></FONT> --<FONT COLOR=green><EM>-- in all copies or substantial portions of the Software. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></FONT> --<FONT COLOR=green><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></FONT> --<FONT COLOR=green><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></FONT> --<FONT COLOR=green><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></FONT> --<FONT COLOR=green><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></FONT> --<FONT COLOR=green><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></FONT> --<FONT COLOR=green><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></FONT> --<FONT COLOR=green><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></FONT> --<FONT COLOR=green><EM>-- sale, use or other dealings in this Software without prior written --</EM></FONT> --<FONT COLOR=green><EM>-- authorization. --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Author: Juergen Pfeifer, 1996</EM></FONT> --<FONT COLOR=green><EM>-- Version Control:</EM></FONT> --<FONT COLOR=green><EM>-- @Revision: 1.13 @</EM></FONT> --<FONT COLOR=green><EM>-- @Date: 2009/12/26 17:38:58 @</EM></FONT> --<FONT COLOR=green><EM>-- Binding Version 01.00</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<b>package</b> <b>body</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-text_io__ads.htm#ref_44_35">Text_IO</A>.<FONT COLOR=red><A NAME="ref_42_48" HREF="terminal_interface-curses-text_io-aux__ads.htm#ref_42_51">Aux</A></FONT> <b>is</b> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Terminal_Interface.Curses.Text_IO.Aux --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- B O D Y --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Copyright (c) 1998-2006,2009 Free Software Foundation, Inc. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></span> -+<span class="comment"><EM>-- copy of this software and associated documentation files (the --</EM></span> -+<span class="comment"><EM>-- "Software"), to deal in the Software without restriction, including --</EM></span> -+<span class="comment"><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></span> -+<span class="comment"><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></span> -+<span class="comment"><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></span> -+<span class="comment"><EM>-- furnished to do so, subject to the following conditions: --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- The above copyright notice and this permission notice shall be included --</EM></span> -+<span class="comment"><EM>-- in all copies or substantial portions of the Software. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></span> -+<span class="comment"><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></span> -+<span class="comment"><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></span> -+<span class="comment"><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></span> -+<span class="comment"><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></span> -+<span class="comment"><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></span> -+<span class="comment"><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></span> -+<span class="comment"><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></span> -+<span class="comment"><EM>-- sale, use or other dealings in this Software without prior written --</EM></span> -+<span class="comment"><EM>-- authorization. --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Author: Juergen Pfeifer, 1996</EM></span> -+<span class="comment"><EM>-- Version Control:</EM></span> -+<span class="comment"><EM>-- @Revision: 1.13 @</EM></span> -+<span class="comment"><EM>-- @Date: 2009/12/26 17:38:58 @</EM></span> -+<span class="comment"><EM>-- Binding Version 01.00</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<b>package</b> <b>body</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-text_io__ads.htm#ref_44_35">Text_IO</A>.<span class="symbol"><A NAME="ref_42_48" HREF="terminal_interface-curses-text_io-aux__ads.htm#ref_42_51">Aux</A></span> <b>is</b> - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_44_14" HREF="terminal_interface-curses-text_io-aux__ads.htm#ref_48_14">Put_Buf</A></FONT> -- (<FONT COLOR=red><A NAME="ref_45_7" HREF="terminal_interface-curses-text_io-aux__ads.htm#ref_49_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- <FONT COLOR=red><A NAME="ref_46_7" HREF="terminal_interface-curses-text_io-aux__ads.htm#ref_50_7">Buf</A></FONT> : String; -- <FONT COLOR=red><A NAME="ref_47_7" HREF="terminal_interface-curses-text_io-aux__ads.htm#ref_51_7">Width</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A>; -- <FONT COLOR=red><A NAME="ref_48_7" HREF="terminal_interface-curses-text_io-aux__ads.htm#ref_52_7">Signal</A></FONT> : Boolean := True; -- <FONT COLOR=red><A NAME="ref_49_7" HREF="terminal_interface-curses-text_io-aux__ads.htm#ref_53_7">Ljust</A></FONT> : Boolean := False) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_44_14" HREF="terminal_interface-curses-text_io-aux__ads.htm#ref_48_14">Put_Buf</A></span> -+ (<span class="symbol"><A NAME="ref_45_7" HREF="terminal_interface-curses-text_io-aux__ads.htm#ref_49_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="symbol"><A NAME="ref_46_7" HREF="terminal_interface-curses-text_io-aux__ads.htm#ref_50_7">Buf</A></span> : String; -+ <span class="symbol"><A NAME="ref_47_7" HREF="terminal_interface-curses-text_io-aux__ads.htm#ref_51_7">Width</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A>; -+ <span class="symbol"><A NAME="ref_48_7" HREF="terminal_interface-curses-text_io-aux__ads.htm#ref_52_7">Signal</A></span> : Boolean := True; -+ <span class="symbol"><A NAME="ref_49_7" HREF="terminal_interface-curses-text_io-aux__ads.htm#ref_53_7">Ljust</A></span> : Boolean := False) - <b>is</b> -- <FONT COLOR=red><A NAME="ref_51_7">L</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A>; -- <FONT COLOR=red><A NAME="ref_52_7">Len</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A>; -- <FONT COLOR=red><A NAME="ref_53_7">W</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-aux__ads.htm#ref_51_7">Width</A>; -- <FONT COLOR=red><A NAME="ref_54_7">LC</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_63_12">Line_Count</A>; -- <FONT COLOR=red><A NAME="ref_55_7">CC</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_65_12">Column_Count</A>; -- <FONT COLOR=red><A NAME="ref_56_7">Y</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -- <FONT COLOR=red><A NAME="ref_57_7">X</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; -+ <span class="symbol"><A NAME="ref_51_7">L</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A>; -+ <span class="symbol"><A NAME="ref_52_7">Len</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A>; -+ <span class="symbol"><A NAME="ref_53_7">W</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-aux__ads.htm#ref_51_7">Width</A>; -+ <span class="symbol"><A NAME="ref_54_7">LC</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_63_12">Line_Count</A>; -+ <span class="symbol"><A NAME="ref_55_7">CC</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_65_12">Column_Count</A>; -+ <span class="symbol"><A NAME="ref_56_7">Y</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>; -+ <span class="symbol"><A NAME="ref_57_7">X</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_59_17" HREF="terminal_interface-curses-text_io-aux__adb.htm#ref_61_17">Output</A></FONT> (<FONT COLOR=red><A NAME="ref_59_25" HREF="terminal_interface-curses-text_io-aux__adb.htm#ref_61_25">From</A></FONT>, <FONT COLOR=red><A NAME="ref_59_31" HREF="terminal_interface-curses-text_io-aux__adb.htm#ref_61_31">To</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A>); -+ <b>procedure</b> <span class="symbol"><A NAME="ref_59_17" HREF="terminal_interface-curses-text_io-aux__adb.htm#ref_61_17">Output</A></span> (<span class="symbol"><A NAME="ref_59_25" HREF="terminal_interface-curses-text_io-aux__adb.htm#ref_61_25">From</A></span>, <span class="symbol"><A NAME="ref_59_31" HREF="terminal_interface-curses-text_io-aux__adb.htm#ref_61_31">To</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A>); - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_61_17" HREF="terminal_interface-curses-text_io-aux__adb.htm#ref_59_17">Output</A></FONT> (<FONT COLOR=red><A NAME="ref_61_25" HREF="terminal_interface-curses-text_io-aux__adb.htm#ref_59_25">From</A></FONT>, <FONT COLOR=red><A NAME="ref_61_31" HREF="terminal_interface-curses-text_io-aux__adb.htm#ref_59_31">To</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A>) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_61_17" HREF="terminal_interface-curses-text_io-aux__adb.htm#ref_59_17">Output</A></span> (<span class="symbol"><A NAME="ref_61_25" HREF="terminal_interface-curses-text_io-aux__adb.htm#ref_59_25">From</A></span>, <span class="symbol"><A NAME="ref_61_31" HREF="terminal_interface-curses-text_io-aux__adb.htm#ref_59_31">To</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A>) - <b>is</b> - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses-text_io-aux__adb.htm#ref_52_7">Len</A> &gt; 0 <b>then</b> -@@ -71,12 +83,12 @@ - <A HREF="terminal_interface-curses-text_io-aux__adb.htm#ref_53_7">W</A> := <A HREF="terminal_interface-curses-text_io-aux__adb.htm#ref_52_7">Len</A>; - <b>end</b> <b>if</b>; - <b>if</b> <A HREF="terminal_interface-curses-text_io-aux__adb.htm#ref_52_7">Len</A> &gt; <A HREF="terminal_interface-curses-text_io-aux__adb.htm#ref_53_7">W</A> <b>then</b> -- <FONT COLOR=green><EM>-- LRM A10.6 (7) says this</EM></FONT> -+ <span class="comment"><EM>-- LRM A10.6 (7) says this</EM></span> - <A HREF="terminal_interface-curses-text_io-aux__adb.htm#ref_53_7">W</A> := <A HREF="terminal_interface-curses-text_io-aux__adb.htm#ref_52_7">Len</A>; - <b>end</b> <b>if</b>; - - <b>pragma</b> Assert (<A HREF="terminal_interface-curses-text_io-aux__adb.htm#ref_52_7">Len</A> &lt;= <A HREF="terminal_interface-curses-text_io-aux__adb.htm#ref_53_7">W</A>); -- <A HREF="terminal_interface-curses__ads.htm#ref_1230_14">Get_Size</A> (<A HREF="terminal_interface-curses-text_io-aux__ads.htm#ref_49_7">Win</A>, <A HREF="terminal_interface-curses-text_io-aux__adb.htm#ref_54_7">LC</A>, <A HREF="terminal_interface-curses-text_io-aux__adb.htm#ref_55_7">CC</A>); -+ <A HREF="terminal_interface-curses__ads.htm#ref_1229_14">Get_Size</A> (<A HREF="terminal_interface-curses-text_io-aux__ads.htm#ref_49_7">Win</A>, <A HREF="terminal_interface-curses-text_io-aux__adb.htm#ref_54_7">LC</A>, <A HREF="terminal_interface-curses-text_io-aux__adb.htm#ref_55_7">CC</A>); - <b>if</b> <A HREF="terminal_interface-curses__ads.htm#ref_65_12">Column_Count</A> (<A HREF="terminal_interface-curses-text_io-aux__adb.htm#ref_52_7">Len</A>) &gt; <A HREF="terminal_interface-curses-text_io-aux__adb.htm#ref_55_7">CC</A> <b>then</b> - <b>if</b> <A HREF="terminal_interface-curses-text_io-aux__ads.htm#ref_52_7">Signal</A> <b>then</b> - <b>raise</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_134_4">Layout_Error</A>; -@@ -86,20 +98,20 @@ - <b>else</b> - <b>if</b> <A HREF="terminal_interface-curses-text_io-aux__adb.htm#ref_52_7">Len</A> &lt; <A HREF="terminal_interface-curses-text_io-aux__adb.htm#ref_53_7">W</A> <b>and</b> <b>then</b> <b>not</b> <A HREF="terminal_interface-curses-text_io-aux__ads.htm#ref_53_7">Ljust</A> <b>then</b> - <b>declare</b> -- <FONT COLOR=red><A NAME="ref_84_22">Filler</A></FONT> : <b>constant</b> String (1 .. (<A HREF="terminal_interface-curses-text_io-aux__adb.htm#ref_53_7">W</A> - <A HREF="terminal_interface-curses-text_io-aux__adb.htm#ref_52_7">Len</A>)) -+ <span class="symbol"><A NAME="ref_84_22">Filler</A></span> : <b>constant</b> String (1 .. (<A HREF="terminal_interface-curses-text_io-aux__adb.htm#ref_53_7">W</A> - <A HREF="terminal_interface-curses-text_io-aux__adb.htm#ref_52_7">Len</A>)) - := (<b>others</b> =&gt; ' '); - <b>begin</b> - <A HREF="terminal_interface-curses-text_io__ads.htm#ref_115_14">Put</A> (<A HREF="terminal_interface-curses-text_io-aux__ads.htm#ref_49_7">Win</A>, <A HREF="terminal_interface-curses-text_io-aux__adb.htm#ref_84_22">Filler</A>); - <b>end</b>; - <b>end</b> <b>if</b>; -- <A HREF="terminal_interface-curses__ads.htm#ref_1246_14">Get_Cursor_Position</A> (<A HREF="terminal_interface-curses-text_io-aux__ads.htm#ref_49_7">Win</A>, <A HREF="terminal_interface-curses-text_io-aux__adb.htm#ref_56_7">Y</A>, <A HREF="terminal_interface-curses-text_io-aux__adb.htm#ref_57_7">X</A>); -+ <A HREF="terminal_interface-curses__ads.htm#ref_1245_14">Get_Cursor_Position</A> (<A HREF="terminal_interface-curses-text_io-aux__ads.htm#ref_49_7">Win</A>, <A HREF="terminal_interface-curses-text_io-aux__adb.htm#ref_56_7">Y</A>, <A HREF="terminal_interface-curses-text_io-aux__adb.htm#ref_57_7">X</A>); - <b>if</b> (<A HREF="terminal_interface-curses-text_io-aux__adb.htm#ref_57_7">X</A> + <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A> (<A HREF="terminal_interface-curses-text_io-aux__adb.htm#ref_52_7">Len</A>)) &gt; <A HREF="terminal_interface-curses-text_io-aux__adb.htm#ref_55_7">CC</A> <b>then</b> - <A HREF="terminal_interface-curses-text_io__ads.htm#ref_86_14">New_Line</A> (<A HREF="terminal_interface-curses-text_io-aux__ads.htm#ref_49_7">Win</A>); - <b>end</b> <b>if</b>; - <A HREF="terminal_interface-curses-text_io__ads.htm#ref_115_14">Put</A> (<A HREF="terminal_interface-curses-text_io-aux__ads.htm#ref_49_7">Win</A>, <A HREF="terminal_interface-curses-text_io-aux__ads.htm#ref_50_7">Buf</A> (<A HREF="terminal_interface-curses-text_io-aux__adb.htm#ref_59_25">From</A> .. <A HREF="terminal_interface-curses-text_io-aux__adb.htm#ref_59_31">To</A>)); - <b>if</b> <A HREF="terminal_interface-curses-text_io-aux__adb.htm#ref_52_7">Len</A> &lt; <A HREF="terminal_interface-curses-text_io-aux__adb.htm#ref_53_7">W</A> <b>and</b> <b>then</b> <A HREF="terminal_interface-curses-text_io-aux__ads.htm#ref_53_7">Ljust</A> <b>then</b> - <b>declare</b> -- <FONT COLOR=red><A NAME="ref_97_22">Filler</A></FONT> : <b>constant</b> String (1 .. (<A HREF="terminal_interface-curses-text_io-aux__adb.htm#ref_53_7">W</A> - <A HREF="terminal_interface-curses-text_io-aux__adb.htm#ref_52_7">Len</A>)) -+ <span class="symbol"><A NAME="ref_97_22">Filler</A></span> : <b>constant</b> String (1 .. (<A HREF="terminal_interface-curses-text_io-aux__adb.htm#ref_53_7">W</A> - <A HREF="terminal_interface-curses-text_io-aux__adb.htm#ref_52_7">Len</A>)) - := (<b>others</b> =&gt; ' '); - <b>begin</b> - <A HREF="terminal_interface-curses-text_io__ads.htm#ref_115_14">Put</A> (<A HREF="terminal_interface-curses-text_io-aux__ads.htm#ref_49_7">Win</A>, <A HREF="terminal_interface-curses-text_io-aux__adb.htm#ref_97_22">Filler</A>); -@@ -113,15 +125,15 @@ - <b>pragma</b> Assert (<A HREF="terminal_interface-curses-text_io-aux__ads.htm#ref_49_7">Win</A> /= <A HREF="terminal_interface-curses__ads.htm#ref_58_4">Null_Window</A>); - <b>if</b> <A HREF="terminal_interface-curses-text_io-aux__ads.htm#ref_53_7">Ljust</A> <b>then</b> - <A HREF="terminal_interface-curses-text_io-aux__adb.htm#ref_51_7">L</A> := 1; -- <b>for</b> <FONT COLOR=red><A NAME="ref_111_14">I</A></FONT> <b>in</b> 1 .. <A HREF="terminal_interface-curses-text_io-aux__ads.htm#ref_50_7">Buf</A>'Length <b>loop</b> -+ <b>for</b> <span class="symbol"><A NAME="ref_111_14">I</A></span> <b>in</b> 1 .. <A HREF="terminal_interface-curses-text_io-aux__ads.htm#ref_50_7">Buf</A>'Length <b>loop</b> - <b>exit</b> <b>when</b> <A HREF="terminal_interface-curses-text_io-aux__ads.htm#ref_50_7">Buf</A> (<A HREF="terminal_interface-curses-text_io-aux__adb.htm#ref_51_7">L</A>) = ' '; - <A HREF="terminal_interface-curses-text_io-aux__adb.htm#ref_51_7">L</A> := <A HREF="terminal_interface-curses-text_io-aux__adb.htm#ref_51_7">L</A> + 1; - <b>end</b> <b>loop</b>; - <A HREF="terminal_interface-curses-text_io-aux__adb.htm#ref_52_7">Len</A> := <A HREF="terminal_interface-curses-text_io-aux__adb.htm#ref_51_7">L</A> - 1; - <A HREF="terminal_interface-curses-text_io-aux__adb.htm#ref_59_17">Output</A> (1, <A HREF="terminal_interface-curses-text_io-aux__adb.htm#ref_52_7">Len</A>); -- <b>else</b> <FONT COLOR=green><EM>-- input buffer is not left justified</EM></FONT> -+ <b>else</b> <span class="comment"><EM>-- input buffer is not left justified</EM></span> - <A HREF="terminal_interface-curses-text_io-aux__adb.htm#ref_51_7">L</A> := <A HREF="terminal_interface-curses-text_io-aux__ads.htm#ref_50_7">Buf</A>'Length; -- <b>for</b> <FONT COLOR=red><A NAME="ref_119_14">I</A></FONT> <b>in</b> 1 .. <A HREF="terminal_interface-curses-text_io-aux__ads.htm#ref_50_7">Buf</A>'Length <b>loop</b> -+ <b>for</b> <span class="symbol"><A NAME="ref_119_14">I</A></span> <b>in</b> 1 .. <A HREF="terminal_interface-curses-text_io-aux__ads.htm#ref_50_7">Buf</A>'Length <b>loop</b> - <b>exit</b> <b>when</b> <A HREF="terminal_interface-curses-text_io-aux__ads.htm#ref_50_7">Buf</A> (<A HREF="terminal_interface-curses-text_io-aux__adb.htm#ref_51_7">L</A>) = ' '; - <A HREF="terminal_interface-curses-text_io-aux__adb.htm#ref_51_7">L</A> := <A HREF="terminal_interface-curses-text_io-aux__adb.htm#ref_51_7">L</A> - 1; - <b>end</b> <b>loop</b>; -diff -Naur ncurses-5.9/doc/html/ada/terminal_interface-curses-text_io-aux__ads.htm ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-text_io-aux__ads.htm ---- ncurses-5.9/doc/html/ada/terminal_interface-curses-text_io-aux__ads.htm 2010-01-09 21:31:27.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-text_io-aux__ads.htm 2014-09-01 16:33:22.299792028 +0200 -@@ -1,61 +1,73 @@ --<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> --<HTML><HEAD><TITLE>terminal_interface-curses-text_io-aux.ads</TITLE></HEAD> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> -+<HTML> -+<HEAD> -+<TITLE>terminal_interface-curses-text_io-aux.ads</TITLE> -+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> -+<style type="text/css"> -+*.comment { -+ color: green; -+} -+*.symbol { -+ color: red; -+} -+</style> -+</HEAD> - <BODY> --<HR><DIV ALIGN="center"><H1> File : terminal_interface-curses-text_io-aux.ads </H1></DIV><HR> -+<HR><DIV style="text-align:center"><H1> File : terminal_interface-curses-text_io-aux.ads </H1></DIV><HR> - <PRE> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Terminal_Interface.Curses.Text_IO.Aux --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- S P E C --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Copyright (c) 1998-2006,2009 Free Software Foundation, Inc. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></FONT> --<FONT COLOR=green><EM>-- copy of this software and associated documentation files (the --</EM></FONT> --<FONT COLOR=green><EM>-- "Software"), to deal in the Software without restriction, including --</EM></FONT> --<FONT COLOR=green><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></FONT> --<FONT COLOR=green><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></FONT> --<FONT COLOR=green><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></FONT> --<FONT COLOR=green><EM>-- furnished to do so, subject to the following conditions: --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- The above copyright notice and this permission notice shall be included --</EM></FONT> --<FONT COLOR=green><EM>-- in all copies or substantial portions of the Software. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></FONT> --<FONT COLOR=green><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></FONT> --<FONT COLOR=green><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></FONT> --<FONT COLOR=green><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></FONT> --<FONT COLOR=green><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></FONT> --<FONT COLOR=green><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></FONT> --<FONT COLOR=green><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></FONT> --<FONT COLOR=green><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></FONT> --<FONT COLOR=green><EM>-- sale, use or other dealings in this Software without prior written --</EM></FONT> --<FONT COLOR=green><EM>-- authorization. --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Author: Juergen Pfeifer, 1996</EM></FONT> --<FONT COLOR=green><EM>-- Version Control:</EM></FONT> --<FONT COLOR=green><EM>-- @Revision: 1.14 @</EM></FONT> --<FONT COLOR=green><EM>-- @Date: 2009/12/26 17:38:58 @</EM></FONT> --<FONT COLOR=green><EM>-- Binding Version 01.00</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<b>private</b> <b>package</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-text_io__ads.htm#ref_44_35">Text_IO</A>.<FONT COLOR=red><A NAME="ref_42_51" HREF="terminal_interface-curses-text_io-aux__adb.htm#ref_42_48">Aux</A></FONT> <b>is</b> -- <FONT COLOR=green><EM>-- pragma Preelaborate (Aux);</EM></FONT> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Terminal_Interface.Curses.Text_IO.Aux --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- S P E C --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Copyright (c) 1998-2006,2009 Free Software Foundation, Inc. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></span> -+<span class="comment"><EM>-- copy of this software and associated documentation files (the --</EM></span> -+<span class="comment"><EM>-- "Software"), to deal in the Software without restriction, including --</EM></span> -+<span class="comment"><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></span> -+<span class="comment"><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></span> -+<span class="comment"><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></span> -+<span class="comment"><EM>-- furnished to do so, subject to the following conditions: --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- The above copyright notice and this permission notice shall be included --</EM></span> -+<span class="comment"><EM>-- in all copies or substantial portions of the Software. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></span> -+<span class="comment"><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></span> -+<span class="comment"><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></span> -+<span class="comment"><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></span> -+<span class="comment"><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></span> -+<span class="comment"><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></span> -+<span class="comment"><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></span> -+<span class="comment"><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></span> -+<span class="comment"><EM>-- sale, use or other dealings in this Software without prior written --</EM></span> -+<span class="comment"><EM>-- authorization. --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Author: Juergen Pfeifer, 1996</EM></span> -+<span class="comment"><EM>-- Version Control:</EM></span> -+<span class="comment"><EM>-- @Revision: 1.14 @</EM></span> -+<span class="comment"><EM>-- @Date: 2009/12/26 17:38:58 @</EM></span> -+<span class="comment"><EM>-- Binding Version 01.00</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<b>private</b> <b>package</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-text_io__ads.htm#ref_44_35">Text_IO</A>.<span class="symbol"><A NAME="ref_42_51" HREF="terminal_interface-curses-text_io-aux__adb.htm#ref_42_48">Aux</A></span> <b>is</b> -+ <span class="comment"><EM>-- pragma Preelaborate (Aux);</EM></span> - -- <FONT COLOR=green><EM>-- This routine is called from the Text_IO output routines for numeric</EM></FONT> -- <FONT COLOR=green><EM>-- and enumeration types.</EM></FONT> -- <FONT COLOR=green><EM>--</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_48_14" HREF="terminal_interface-curses-text_io-aux__adb.htm#ref_44_14">Put_Buf</A></FONT> -- (<FONT COLOR=red><A NAME="ref_49_7" HREF="terminal_interface-curses-text_io-aux__adb.htm#ref_45_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; <FONT COLOR=green><EM>-- The output window</EM></FONT> -- <FONT COLOR=red><A NAME="ref_50_7" HREF="terminal_interface-curses-text_io-aux__adb.htm#ref_46_7">Buf</A></FONT> : String; <FONT COLOR=green><EM>-- The buffer containing the text</EM></FONT> -- <FONT COLOR=red><A NAME="ref_51_7" HREF="terminal_interface-curses-text_io-aux__adb.htm#ref_47_7">Width</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A>; <FONT COLOR=green><EM>-- The width of the output field</EM></FONT> -- <FONT COLOR=red><A NAME="ref_52_7" HREF="terminal_interface-curses-text_io-aux__adb.htm#ref_48_7">Signal</A></FONT> : Boolean := True; <FONT COLOR=green><EM>-- If true, we raise Layout_Error</EM></FONT> -- <FONT COLOR=red><A NAME="ref_53_7" HREF="terminal_interface-curses-text_io-aux__adb.htm#ref_49_7">Ljust</A></FONT> : Boolean := False); <FONT COLOR=green><EM>-- The Buf is left justified</EM></FONT> -+ <span class="comment"><EM>-- This routine is called from the Text_IO output routines for numeric</EM></span> -+ <span class="comment"><EM>-- and enumeration types.</EM></span> -+ <span class="comment"><EM>--</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_48_14" HREF="terminal_interface-curses-text_io-aux__adb.htm#ref_44_14">Put_Buf</A></span> -+ (<span class="symbol"><A NAME="ref_49_7" HREF="terminal_interface-curses-text_io-aux__adb.htm#ref_45_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; <span class="comment"><EM>-- The output window</EM></span> -+ <span class="symbol"><A NAME="ref_50_7" HREF="terminal_interface-curses-text_io-aux__adb.htm#ref_46_7">Buf</A></span> : String; <span class="comment"><EM>-- The buffer containing the text</EM></span> -+ <span class="symbol"><A NAME="ref_51_7" HREF="terminal_interface-curses-text_io-aux__adb.htm#ref_47_7">Width</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A>; <span class="comment"><EM>-- The width of the output field</EM></span> -+ <span class="symbol"><A NAME="ref_52_7" HREF="terminal_interface-curses-text_io-aux__adb.htm#ref_48_7">Signal</A></span> : Boolean := True; <span class="comment"><EM>-- If true, we raise Layout_Error</EM></span> -+ <span class="symbol"><A NAME="ref_53_7" HREF="terminal_interface-curses-text_io-aux__adb.htm#ref_49_7">Ljust</A></span> : Boolean := False); <span class="comment"><EM>-- The Buf is left justified</EM></span> - - <b>end</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-text_io__ads.htm#ref_44_35">Text_IO</A>.<A HREF="terminal_interface-curses-text_io-aux__ads.htm#ref_42_51">Aux</A>; - </PRE></BODY></HTML> -diff -Naur ncurses-5.9/doc/html/ada/terminal_interface-curses-text_io-complex_io__adb.htm ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-text_io-complex_io__adb.htm ---- ncurses-5.9/doc/html/ada/terminal_interface-curses-text_io-complex_io__adb.htm 2010-01-09 21:31:27.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-text_io-complex_io__adb.htm 2014-09-01 16:33:22.299792028 +0200 -@@ -1,61 +1,73 @@ --<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> --<HTML><HEAD><TITLE>terminal_interface-curses-text_io-complex_io.adb</TITLE></HEAD> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> -+<HTML> -+<HEAD> -+<TITLE>terminal_interface-curses-text_io-complex_io.adb</TITLE> -+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> -+<style type="text/css"> -+*.comment { -+ color: green; -+} -+*.symbol { -+ color: red; -+} -+</style> -+</HEAD> - <BODY> --<HR><DIV ALIGN="center"><H1> File : terminal_interface-curses-text_io-complex_io.adb </H1></DIV><HR> -+<HR><DIV style="text-align:center"><H1> File : terminal_interface-curses-text_io-complex_io.adb </H1></DIV><HR> - <PRE> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Terminal_Interface.Curses.Text_IO.Complex_IO --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- B O D Y --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Copyright (c) 1998-2003,2009 Free Software Foundation, Inc. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></FONT> --<FONT COLOR=green><EM>-- copy of this software and associated documentation files (the --</EM></FONT> --<FONT COLOR=green><EM>-- "Software"), to deal in the Software without restriction, including --</EM></FONT> --<FONT COLOR=green><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></FONT> --<FONT COLOR=green><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></FONT> --<FONT COLOR=green><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></FONT> --<FONT COLOR=green><EM>-- furnished to do so, subject to the following conditions: --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- The above copyright notice and this permission notice shall be included --</EM></FONT> --<FONT COLOR=green><EM>-- in all copies or substantial portions of the Software. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></FONT> --<FONT COLOR=green><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></FONT> --<FONT COLOR=green><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></FONT> --<FONT COLOR=green><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></FONT> --<FONT COLOR=green><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></FONT> --<FONT COLOR=green><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></FONT> --<FONT COLOR=green><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></FONT> --<FONT COLOR=green><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></FONT> --<FONT COLOR=green><EM>-- sale, use or other dealings in this Software without prior written --</EM></FONT> --<FONT COLOR=green><EM>-- authorization. --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Author: Juergen Pfeifer, 1996</EM></FONT> --<FONT COLOR=green><EM>-- Version Control:</EM></FONT> --<FONT COLOR=green><EM>-- @Revision: 1.11 @</EM></FONT> --<FONT COLOR=green><EM>-- Binding Version 01.00</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Terminal_Interface.Curses.Text_IO.Complex_IO --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- B O D Y --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Copyright (c) 1998-2003,2009 Free Software Foundation, Inc. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></span> -+<span class="comment"><EM>-- copy of this software and associated documentation files (the --</EM></span> -+<span class="comment"><EM>-- "Software"), to deal in the Software without restriction, including --</EM></span> -+<span class="comment"><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></span> -+<span class="comment"><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></span> -+<span class="comment"><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></span> -+<span class="comment"><EM>-- furnished to do so, subject to the following conditions: --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- The above copyright notice and this permission notice shall be included --</EM></span> -+<span class="comment"><EM>-- in all copies or substantial portions of the Software. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></span> -+<span class="comment"><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></span> -+<span class="comment"><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></span> -+<span class="comment"><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></span> -+<span class="comment"><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></span> -+<span class="comment"><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></span> -+<span class="comment"><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></span> -+<span class="comment"><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></span> -+<span class="comment"><EM>-- sale, use or other dealings in this Software without prior written --</EM></span> -+<span class="comment"><EM>-- authorization. --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Author: Juergen Pfeifer, 1996</EM></span> -+<span class="comment"><EM>-- Version Control:</EM></span> -+<span class="comment"><EM>-- @Revision: 1.11 @</EM></span> -+<span class="comment"><EM>-- Binding Version 01.00</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> - <b>with</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-text_io__ads.htm#ref_44_35">Text_IO</A>.<A HREF="terminal_interface-curses-text_io-float_io__ads.htm#ref_44_43">Float_IO</A>; - --<b>package</b> <b>body</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-text_io__ads.htm#ref_44_35">Text_IO</A>.<FONT COLOR=red><A NAME="ref_43_48" HREF="terminal_interface-curses-text_io-complex_io__ads.htm#ref_46_43">Complex_IO</A></FONT> <b>is</b> -+<b>package</b> <b>body</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-text_io__ads.htm#ref_44_35">Text_IO</A>.<span class="symbol"><A NAME="ref_43_48" HREF="terminal_interface-curses-text_io-complex_io__ads.htm#ref_46_43">Complex_IO</A></span> <b>is</b> - - <b>package</b> FIO <b>is</b> <b>new</b> - <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-text_io__ads.htm#ref_44_35">Text_IO</A>.<A HREF="terminal_interface-curses-text_io-float_io__ads.htm#ref_44_43">Float_IO</A> (Complex_Types.Real'Base); - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_48_14" HREF="terminal_interface-curses-text_io-complex_io__ads.htm#ref_54_14">Put</A></FONT> -- (<FONT COLOR=red><A NAME="ref_49_7" HREF="terminal_interface-curses-text_io-complex_io__ads.htm#ref_55_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <b>procedure</b> <span class="symbol"><A NAME="ref_48_14" HREF="terminal_interface-curses-text_io-complex_io__ads.htm#ref_54_14">Put</A></span> -+ (<span class="symbol"><A NAME="ref_49_7" HREF="terminal_interface-curses-text_io-complex_io__ads.htm#ref_55_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; - Item : Complex; -- <FONT COLOR=red><A NAME="ref_51_7" HREF="terminal_interface-curses-text_io-complex_io__ads.htm#ref_57_7">Fore</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-complex_io__ads.htm#ref_50_4">Default_Fore</A>; -- <FONT COLOR=red><A NAME="ref_52_7" HREF="terminal_interface-curses-text_io-complex_io__ads.htm#ref_58_7">Aft</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-complex_io__ads.htm#ref_51_4">Default_Aft</A>; -- <FONT COLOR=red><A NAME="ref_53_7" HREF="terminal_interface-curses-text_io-complex_io__ads.htm#ref_59_7">Exp</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-complex_io__ads.htm#ref_52_4">Default_Exp</A>) -+ <span class="symbol"><A NAME="ref_51_7" HREF="terminal_interface-curses-text_io-complex_io__ads.htm#ref_57_7">Fore</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-complex_io__ads.htm#ref_50_4">Default_Fore</A>; -+ <span class="symbol"><A NAME="ref_52_7" HREF="terminal_interface-curses-text_io-complex_io__ads.htm#ref_58_7">Aft</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-complex_io__ads.htm#ref_51_4">Default_Aft</A>; -+ <span class="symbol"><A NAME="ref_53_7" HREF="terminal_interface-curses-text_io-complex_io__ads.htm#ref_59_7">Exp</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-complex_io__ads.htm#ref_52_4">Default_Exp</A>) - <b>is</b> - <b>begin</b> - <A HREF="terminal_interface-curses-text_io__ads.htm#ref_108_14">Put</A> (<A HREF="terminal_interface-curses-text_io-complex_io__ads.htm#ref_55_7">Win</A>, '('); -@@ -65,11 +77,11 @@ - <A HREF="terminal_interface-curses-text_io__ads.htm#ref_108_14">Put</A> (<A HREF="terminal_interface-curses-text_io-complex_io__ads.htm#ref_55_7">Win</A>, ')'); - <b>end</b> <A HREF="terminal_interface-curses-text_io-complex_io__ads.htm#ref_54_14">Put</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_63_14" HREF="terminal_interface-curses-text_io-complex_io__ads.htm#ref_61_14">Put</A></FONT> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_63_14" HREF="terminal_interface-curses-text_io-complex_io__ads.htm#ref_61_14">Put</A></span> - (Item : Complex; -- <FONT COLOR=red><A NAME="ref_65_7" HREF="terminal_interface-curses-text_io-complex_io__ads.htm#ref_63_7">Fore</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-complex_io__ads.htm#ref_50_4">Default_Fore</A>; -- <FONT COLOR=red><A NAME="ref_66_7" HREF="terminal_interface-curses-text_io-complex_io__ads.htm#ref_64_7">Aft</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-complex_io__ads.htm#ref_51_4">Default_Aft</A>; -- <FONT COLOR=red><A NAME="ref_67_7" HREF="terminal_interface-curses-text_io-complex_io__ads.htm#ref_65_7">Exp</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-complex_io__ads.htm#ref_52_4">Default_Exp</A>) -+ <span class="symbol"><A NAME="ref_65_7" HREF="terminal_interface-curses-text_io-complex_io__ads.htm#ref_63_7">Fore</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-complex_io__ads.htm#ref_50_4">Default_Fore</A>; -+ <span class="symbol"><A NAME="ref_66_7" HREF="terminal_interface-curses-text_io-complex_io__ads.htm#ref_64_7">Aft</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-complex_io__ads.htm#ref_51_4">Default_Aft</A>; -+ <span class="symbol"><A NAME="ref_67_7" HREF="terminal_interface-curses-text_io-complex_io__ads.htm#ref_65_7">Exp</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-complex_io__ads.htm#ref_52_4">Default_Exp</A>) - <b>is</b> - <b>begin</b> - <A HREF="terminal_interface-curses-text_io-complex_io__ads.htm#ref_54_14">Put</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_62_13">Get_Window</A>, Item, <A HREF="terminal_interface-curses-text_io-complex_io__ads.htm#ref_63_7">Fore</A>, <A HREF="terminal_interface-curses-text_io-complex_io__ads.htm#ref_64_7">Aft</A>, <A HREF="terminal_interface-curses-text_io-complex_io__ads.htm#ref_65_7">Exp</A>); -diff -Naur ncurses-5.9/doc/html/ada/terminal_interface-curses-text_io-complex_io__ads.htm ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-text_io-complex_io__ads.htm ---- ncurses-5.9/doc/html/ada/terminal_interface-curses-text_io-complex_io__ads.htm 2010-01-09 21:31:27.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-text_io-complex_io__ads.htm 2014-09-01 16:33:22.299792028 +0200 -@@ -1,73 +1,85 @@ --<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> --<HTML><HEAD><TITLE>terminal_interface-curses-text_io-complex_io.ads</TITLE></HEAD> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> -+<HTML> -+<HEAD> -+<TITLE>terminal_interface-curses-text_io-complex_io.ads</TITLE> -+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> -+<style type="text/css"> -+*.comment { -+ color: green; -+} -+*.symbol { -+ color: red; -+} -+</style> -+</HEAD> - <BODY> --<HR><DIV ALIGN="center"><H1> File : terminal_interface-curses-text_io-complex_io.ads </H1></DIV><HR> -+<HR><DIV style="text-align:center"><H1> File : terminal_interface-curses-text_io-complex_io.ads </H1></DIV><HR> - <PRE> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Terminal_Interface.Curses.Text_IO.Complex_IO --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- S P E C --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Copyright (c) 1998-2003,2009 Free Software Foundation, Inc. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></FONT> --<FONT COLOR=green><EM>-- copy of this software and associated documentation files (the --</EM></FONT> --<FONT COLOR=green><EM>-- "Software"), to deal in the Software without restriction, including --</EM></FONT> --<FONT COLOR=green><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></FONT> --<FONT COLOR=green><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></FONT> --<FONT COLOR=green><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></FONT> --<FONT COLOR=green><EM>-- furnished to do so, subject to the following conditions: --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- The above copyright notice and this permission notice shall be included --</EM></FONT> --<FONT COLOR=green><EM>-- in all copies or substantial portions of the Software. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></FONT> --<FONT COLOR=green><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></FONT> --<FONT COLOR=green><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></FONT> --<FONT COLOR=green><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></FONT> --<FONT COLOR=green><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></FONT> --<FONT COLOR=green><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></FONT> --<FONT COLOR=green><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></FONT> --<FONT COLOR=green><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></FONT> --<FONT COLOR=green><EM>-- sale, use or other dealings in this Software without prior written --</EM></FONT> --<FONT COLOR=green><EM>-- authorization. --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Author: Juergen Pfeifer, 1996</EM></FONT> --<FONT COLOR=green><EM>-- Version Control:</EM></FONT> --<FONT COLOR=green><EM>-- @Revision: 1.11 @</EM></FONT> --<FONT COLOR=green><EM>-- Binding Version 01.00</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Terminal_Interface.Curses.Text_IO.Complex_IO --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- S P E C --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Copyright (c) 1998-2003,2009 Free Software Foundation, Inc. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></span> -+<span class="comment"><EM>-- copy of this software and associated documentation files (the --</EM></span> -+<span class="comment"><EM>-- "Software"), to deal in the Software without restriction, including --</EM></span> -+<span class="comment"><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></span> -+<span class="comment"><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></span> -+<span class="comment"><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></span> -+<span class="comment"><EM>-- furnished to do so, subject to the following conditions: --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- The above copyright notice and this permission notice shall be included --</EM></span> -+<span class="comment"><EM>-- in all copies or substantial portions of the Software. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></span> -+<span class="comment"><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></span> -+<span class="comment"><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></span> -+<span class="comment"><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></span> -+<span class="comment"><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></span> -+<span class="comment"><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></span> -+<span class="comment"><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></span> -+<span class="comment"><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></span> -+<span class="comment"><EM>-- sale, use or other dealings in this Software without prior written --</EM></span> -+<span class="comment"><EM>-- authorization. --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Author: Juergen Pfeifer, 1996</EM></span> -+<span class="comment"><EM>-- Version Control:</EM></span> -+<span class="comment"><EM>-- @Revision: 1.11 @</EM></span> -+<span class="comment"><EM>-- Binding Version 01.00</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> - <b>with</b> Ada.Numerics.Generic_Complex_Types; - - <b>generic</b> - <b>with</b> <b>package</b> <A HREF="terminal_interface-curses-text_io-complex_io__ads.htm#ref_46_43">Complex_Types</A> <b>is</b> <b>new</b> Ada.Numerics.Generic_Complex_Types (&lt;&gt;); - --<b>package</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-text_io__ads.htm#ref_44_35">Text_IO</A>.<FONT COLOR=red><A NAME="ref_46_43" HREF="terminal_interface-curses-text_io-complex_io__adb.htm#ref_43_48">Complex_IO</A></FONT> <b>is</b> -+<b>package</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-text_io__ads.htm#ref_44_35">Text_IO</A>.<span class="symbol"><A NAME="ref_46_43" HREF="terminal_interface-curses-text_io-complex_io__adb.htm#ref_43_48">Complex_IO</A></span> <b>is</b> - - <b>use</b> Complex_Types; - -- <FONT COLOR=red><A NAME="ref_50_4">Default_Fore</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := 2; -- <FONT COLOR=red><A NAME="ref_51_4">Default_Aft</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := Real'<b>Digits</b> - 1; -- <FONT COLOR=red><A NAME="ref_52_4">Default_Exp</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := 3; -+ <span class="symbol"><A NAME="ref_50_4">Default_Fore</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := 2; -+ <span class="symbol"><A NAME="ref_51_4">Default_Aft</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := Real'<b>Digits</b> - 1; -+ <span class="symbol"><A NAME="ref_52_4">Default_Exp</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := 3; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_54_14" HREF="terminal_interface-curses-text_io-complex_io__adb.htm#ref_48_14">Put</A></FONT> -- (<FONT COLOR=red><A NAME="ref_55_7" HREF="terminal_interface-curses-text_io-complex_io__adb.htm#ref_49_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <b>procedure</b> <span class="symbol"><A NAME="ref_54_14" HREF="terminal_interface-curses-text_io-complex_io__adb.htm#ref_48_14">Put</A></span> -+ (<span class="symbol"><A NAME="ref_55_7" HREF="terminal_interface-curses-text_io-complex_io__adb.htm#ref_49_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; - <A HREF="terminal_interface-curses-text_io-complex_io__ads.htm#ref_54_14">Item</A> : Complex; -- <FONT COLOR=red><A NAME="ref_57_7" HREF="terminal_interface-curses-text_io-complex_io__adb.htm#ref_51_7">Fore</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-complex_io__ads.htm#ref_50_4">Default_Fore</A>; -- <FONT COLOR=red><A NAME="ref_58_7" HREF="terminal_interface-curses-text_io-complex_io__adb.htm#ref_52_7">Aft</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-complex_io__ads.htm#ref_51_4">Default_Aft</A>; -- <FONT COLOR=red><A NAME="ref_59_7" HREF="terminal_interface-curses-text_io-complex_io__adb.htm#ref_53_7">Exp</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-complex_io__ads.htm#ref_52_4">Default_Exp</A>); -+ <span class="symbol"><A NAME="ref_57_7" HREF="terminal_interface-curses-text_io-complex_io__adb.htm#ref_51_7">Fore</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-complex_io__ads.htm#ref_50_4">Default_Fore</A>; -+ <span class="symbol"><A NAME="ref_58_7" HREF="terminal_interface-curses-text_io-complex_io__adb.htm#ref_52_7">Aft</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-complex_io__ads.htm#ref_51_4">Default_Aft</A>; -+ <span class="symbol"><A NAME="ref_59_7" HREF="terminal_interface-curses-text_io-complex_io__adb.htm#ref_53_7">Exp</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-complex_io__ads.htm#ref_52_4">Default_Exp</A>); - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_61_14" HREF="terminal_interface-curses-text_io-complex_io__adb.htm#ref_63_14">Put</A></FONT> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_61_14" HREF="terminal_interface-curses-text_io-complex_io__adb.htm#ref_63_14">Put</A></span> - (<A HREF="terminal_interface-curses-text_io-complex_io__ads.htm#ref_61_14">Item</A> : Complex; -- <FONT COLOR=red><A NAME="ref_63_7" HREF="terminal_interface-curses-text_io-complex_io__adb.htm#ref_65_7">Fore</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-complex_io__ads.htm#ref_50_4">Default_Fore</A>; -- <FONT COLOR=red><A NAME="ref_64_7" HREF="terminal_interface-curses-text_io-complex_io__adb.htm#ref_66_7">Aft</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-complex_io__ads.htm#ref_51_4">Default_Aft</A>; -- <FONT COLOR=red><A NAME="ref_65_7" HREF="terminal_interface-curses-text_io-complex_io__adb.htm#ref_67_7">Exp</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-complex_io__ads.htm#ref_52_4">Default_Exp</A>); -+ <span class="symbol"><A NAME="ref_63_7" HREF="terminal_interface-curses-text_io-complex_io__adb.htm#ref_65_7">Fore</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-complex_io__ads.htm#ref_50_4">Default_Fore</A>; -+ <span class="symbol"><A NAME="ref_64_7" HREF="terminal_interface-curses-text_io-complex_io__adb.htm#ref_66_7">Aft</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-complex_io__ads.htm#ref_51_4">Default_Aft</A>; -+ <span class="symbol"><A NAME="ref_65_7" HREF="terminal_interface-curses-text_io-complex_io__adb.htm#ref_67_7">Exp</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-complex_io__ads.htm#ref_52_4">Default_Exp</A>); - - <b>private</b> - <b>pragma</b> Inline (Put); -diff -Naur ncurses-5.9/doc/html/ada/terminal_interface-curses-text_io-decimal_io__adb.htm ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-text_io-decimal_io__adb.htm ---- ncurses-5.9/doc/html/ada/terminal_interface-curses-text_io-decimal_io__adb.htm 2010-01-09 21:31:27.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-text_io-decimal_io__adb.htm 2014-09-01 16:33:22.300792030 +0200 -@@ -1,65 +1,77 @@ --<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> --<HTML><HEAD><TITLE>terminal_interface-curses-text_io-decimal_io.adb</TITLE></HEAD> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> -+<HTML> -+<HEAD> -+<TITLE>terminal_interface-curses-text_io-decimal_io.adb</TITLE> -+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> -+<style type="text/css"> -+*.comment { -+ color: green; -+} -+*.symbol { -+ color: red; -+} -+</style> -+</HEAD> - <BODY> --<HR><DIV ALIGN="center"><H1> File : terminal_interface-curses-text_io-decimal_io.adb </H1></DIV><HR> -+<HR><DIV style="text-align:center"><H1> File : terminal_interface-curses-text_io-decimal_io.adb </H1></DIV><HR> - <PRE> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Terminal_Interface.Curses.Text_IO.Decimal_IO --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- B O D Y --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Copyright (c) 1998-2003,2009 Free Software Foundation, Inc. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></FONT> --<FONT COLOR=green><EM>-- copy of this software and associated documentation files (the --</EM></FONT> --<FONT COLOR=green><EM>-- "Software"), to deal in the Software without restriction, including --</EM></FONT> --<FONT COLOR=green><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></FONT> --<FONT COLOR=green><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></FONT> --<FONT COLOR=green><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></FONT> --<FONT COLOR=green><EM>-- furnished to do so, subject to the following conditions: --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- The above copyright notice and this permission notice shall be included --</EM></FONT> --<FONT COLOR=green><EM>-- in all copies or substantial portions of the Software. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></FONT> --<FONT COLOR=green><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></FONT> --<FONT COLOR=green><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></FONT> --<FONT COLOR=green><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></FONT> --<FONT COLOR=green><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></FONT> --<FONT COLOR=green><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></FONT> --<FONT COLOR=green><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></FONT> --<FONT COLOR=green><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></FONT> --<FONT COLOR=green><EM>-- sale, use or other dealings in this Software without prior written --</EM></FONT> --<FONT COLOR=green><EM>-- authorization. --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Author: Juergen Pfeifer, 1996</EM></FONT> --<FONT COLOR=green><EM>-- Version Control:</EM></FONT> --<FONT COLOR=green><EM>-- @Revision: 1.11 @</EM></FONT> --<FONT COLOR=green><EM>-- Binding Version 01.00</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Terminal_Interface.Curses.Text_IO.Decimal_IO --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- B O D Y --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Copyright (c) 1998-2003,2009 Free Software Foundation, Inc. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></span> -+<span class="comment"><EM>-- copy of this software and associated documentation files (the --</EM></span> -+<span class="comment"><EM>-- "Software"), to deal in the Software without restriction, including --</EM></span> -+<span class="comment"><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></span> -+<span class="comment"><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></span> -+<span class="comment"><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></span> -+<span class="comment"><EM>-- furnished to do so, subject to the following conditions: --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- The above copyright notice and this permission notice shall be included --</EM></span> -+<span class="comment"><EM>-- in all copies or substantial portions of the Software. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></span> -+<span class="comment"><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></span> -+<span class="comment"><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></span> -+<span class="comment"><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></span> -+<span class="comment"><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></span> -+<span class="comment"><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></span> -+<span class="comment"><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></span> -+<span class="comment"><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></span> -+<span class="comment"><EM>-- sale, use or other dealings in this Software without prior written --</EM></span> -+<span class="comment"><EM>-- authorization. --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Author: Juergen Pfeifer, 1996</EM></span> -+<span class="comment"><EM>-- Version Control:</EM></span> -+<span class="comment"><EM>-- @Revision: 1.11 @</EM></span> -+<span class="comment"><EM>-- Binding Version 01.00</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> - <b>with</b> Ada.Text_IO; - <b>with</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-text_io__ads.htm#ref_44_35">Text_IO</A>.<A HREF="terminal_interface-curses-text_io-aux__ads.htm#ref_42_51">Aux</A>; - --<b>package</b> <b>body</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-text_io__ads.htm#ref_44_35">Text_IO</A>.<FONT COLOR=red><A NAME="ref_44_48" HREF="terminal_interface-curses-text_io-decimal_io__ads.htm#ref_44_43">Decimal_IO</A></FONT> <b>is</b> -+<b>package</b> <b>body</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-text_io__ads.htm#ref_44_35">Text_IO</A>.<span class="symbol"><A NAME="ref_44_48" HREF="terminal_interface-curses-text_io-decimal_io__ads.htm#ref_44_43">Decimal_IO</A></span> <b>is</b> - -- <b>package</b> <FONT COLOR=red><A NAME="ref_46_12">Aux</A></FONT> <b>renames</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-text_io__ads.htm#ref_44_35">Text_IO</A>.<A HREF="terminal_interface-curses-text_io-aux__ads.htm#ref_42_51">Aux</A>; -+ <b>package</b> <span class="symbol"><A NAME="ref_46_12">Aux</A></span> <b>renames</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-text_io__ads.htm#ref_44_35">Text_IO</A>.<A HREF="terminal_interface-curses-text_io-aux__ads.htm#ref_42_51">Aux</A>; - <b>package</b> DIO <b>is</b> <b>new</b> Ada.Text_IO.Decimal_IO (<A HREF="terminal_interface-curses-text_io-decimal_io__ads.htm#ref_42_9">Num</A>); - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_49_14" HREF="terminal_interface-curses-text_io-decimal_io__ads.htm#ref_50_14">Put</A></FONT> -- (<FONT COLOR=red><A NAME="ref_50_7" HREF="terminal_interface-curses-text_io-decimal_io__ads.htm#ref_51_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- <FONT COLOR=red><A NAME="ref_51_7" HREF="terminal_interface-curses-text_io-decimal_io__ads.htm#ref_52_7">Item</A></FONT> : <A HREF="terminal_interface-curses-text_io-decimal_io__ads.htm#ref_42_9">Num</A>; -- <FONT COLOR=red><A NAME="ref_52_7" HREF="terminal_interface-curses-text_io-decimal_io__ads.htm#ref_53_7">Fore</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-decimal_io__ads.htm#ref_46_4">Default_Fore</A>; -- <FONT COLOR=red><A NAME="ref_53_7" HREF="terminal_interface-curses-text_io-decimal_io__ads.htm#ref_54_7">Aft</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-decimal_io__ads.htm#ref_47_4">Default_Aft</A>; -- <FONT COLOR=red><A NAME="ref_54_7" HREF="terminal_interface-curses-text_io-decimal_io__ads.htm#ref_55_7">Exp</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-decimal_io__ads.htm#ref_48_4">Default_Exp</A>) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_49_14" HREF="terminal_interface-curses-text_io-decimal_io__ads.htm#ref_50_14">Put</A></span> -+ (<span class="symbol"><A NAME="ref_50_7" HREF="terminal_interface-curses-text_io-decimal_io__ads.htm#ref_51_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="symbol"><A NAME="ref_51_7" HREF="terminal_interface-curses-text_io-decimal_io__ads.htm#ref_52_7">Item</A></span> : <A HREF="terminal_interface-curses-text_io-decimal_io__ads.htm#ref_42_9">Num</A>; -+ <span class="symbol"><A NAME="ref_52_7" HREF="terminal_interface-curses-text_io-decimal_io__ads.htm#ref_53_7">Fore</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-decimal_io__ads.htm#ref_46_4">Default_Fore</A>; -+ <span class="symbol"><A NAME="ref_53_7" HREF="terminal_interface-curses-text_io-decimal_io__ads.htm#ref_54_7">Aft</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-decimal_io__ads.htm#ref_47_4">Default_Aft</A>; -+ <span class="symbol"><A NAME="ref_54_7" HREF="terminal_interface-curses-text_io-decimal_io__ads.htm#ref_55_7">Exp</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-decimal_io__ads.htm#ref_48_4">Default_Exp</A>) - <b>is</b> -- <FONT COLOR=red><A NAME="ref_56_7">Buf</A></FONT> : String (1 .. <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A>'Last); -- <FONT COLOR=red><A NAME="ref_57_7">Len</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-decimal_io__ads.htm#ref_53_7">Fore</A> + 1 + <A HREF="terminal_interface-curses-text_io-decimal_io__ads.htm#ref_54_7">Aft</A>; -+ <span class="symbol"><A NAME="ref_56_7">Buf</A></span> : String (1 .. <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A>'Last); -+ <span class="symbol"><A NAME="ref_57_7">Len</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-decimal_io__ads.htm#ref_53_7">Fore</A> + 1 + <A HREF="terminal_interface-curses-text_io-decimal_io__ads.htm#ref_54_7">Aft</A>; - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses-text_io-decimal_io__ads.htm#ref_55_7">Exp</A> &gt; 0 <b>then</b> - <A HREF="terminal_interface-curses-text_io-decimal_io__adb.htm#ref_57_7">Len</A> := <A HREF="terminal_interface-curses-text_io-decimal_io__adb.htm#ref_57_7">Len</A> + 1 + <A HREF="terminal_interface-curses-text_io-decimal_io__ads.htm#ref_55_7">Exp</A>; -@@ -68,11 +80,11 @@ - <A HREF="terminal_interface-curses-text_io-decimal_io__adb.htm#ref_46_12">Aux</A>.<A HREF="terminal_interface-curses-text_io-aux__ads.htm#ref_48_14">Put_Buf</A> (<A HREF="terminal_interface-curses-text_io-decimal_io__ads.htm#ref_51_7">Win</A>, <A HREF="terminal_interface-curses-text_io-decimal_io__adb.htm#ref_56_7">Buf</A>, <A HREF="terminal_interface-curses-text_io-decimal_io__adb.htm#ref_57_7">Len</A>, False); - <b>end</b> <A HREF="terminal_interface-curses-text_io-decimal_io__ads.htm#ref_50_14">Put</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_66_14" HREF="terminal_interface-curses-text_io-decimal_io__ads.htm#ref_57_14">Put</A></FONT> -- (<FONT COLOR=red><A NAME="ref_67_7" HREF="terminal_interface-curses-text_io-decimal_io__ads.htm#ref_58_7">Item</A></FONT> : <A HREF="terminal_interface-curses-text_io-decimal_io__ads.htm#ref_42_9">Num</A>; -- <FONT COLOR=red><A NAME="ref_68_7" HREF="terminal_interface-curses-text_io-decimal_io__ads.htm#ref_59_7">Fore</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-decimal_io__ads.htm#ref_46_4">Default_Fore</A>; -- <FONT COLOR=red><A NAME="ref_69_7" HREF="terminal_interface-curses-text_io-decimal_io__ads.htm#ref_60_7">Aft</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-decimal_io__ads.htm#ref_47_4">Default_Aft</A>; -- <FONT COLOR=red><A NAME="ref_70_7" HREF="terminal_interface-curses-text_io-decimal_io__ads.htm#ref_61_7">Exp</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-decimal_io__ads.htm#ref_48_4">Default_Exp</A>) <b>is</b> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_66_14" HREF="terminal_interface-curses-text_io-decimal_io__ads.htm#ref_57_14">Put</A></span> -+ (<span class="symbol"><A NAME="ref_67_7" HREF="terminal_interface-curses-text_io-decimal_io__ads.htm#ref_58_7">Item</A></span> : <A HREF="terminal_interface-curses-text_io-decimal_io__ads.htm#ref_42_9">Num</A>; -+ <span class="symbol"><A NAME="ref_68_7" HREF="terminal_interface-curses-text_io-decimal_io__ads.htm#ref_59_7">Fore</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-decimal_io__ads.htm#ref_46_4">Default_Fore</A>; -+ <span class="symbol"><A NAME="ref_69_7" HREF="terminal_interface-curses-text_io-decimal_io__ads.htm#ref_60_7">Aft</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-decimal_io__ads.htm#ref_47_4">Default_Aft</A>; -+ <span class="symbol"><A NAME="ref_70_7" HREF="terminal_interface-curses-text_io-decimal_io__ads.htm#ref_61_7">Exp</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-decimal_io__ads.htm#ref_48_4">Default_Exp</A>) <b>is</b> - <b>begin</b> - <A HREF="terminal_interface-curses-text_io-decimal_io__ads.htm#ref_50_14">Put</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_62_13">Get_Window</A>, <A HREF="terminal_interface-curses-text_io-decimal_io__ads.htm#ref_58_7">Item</A>, <A HREF="terminal_interface-curses-text_io-decimal_io__ads.htm#ref_59_7">Fore</A>, <A HREF="terminal_interface-curses-text_io-decimal_io__ads.htm#ref_60_7">Aft</A>, <A HREF="terminal_interface-curses-text_io-decimal_io__ads.htm#ref_61_7">Exp</A>); - <b>end</b> <A HREF="terminal_interface-curses-text_io-decimal_io__ads.htm#ref_57_14">Put</A>; -diff -Naur ncurses-5.9/doc/html/ada/terminal_interface-curses-text_io-decimal_io__ads.htm ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-text_io-decimal_io__ads.htm ---- ncurses-5.9/doc/html/ada/terminal_interface-curses-text_io-decimal_io__ads.htm 2010-01-09 21:31:27.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-text_io-decimal_io__ads.htm 2014-09-01 16:33:22.300792030 +0200 -@@ -1,69 +1,81 @@ --<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> --<HTML><HEAD><TITLE>terminal_interface-curses-text_io-decimal_io.ads</TITLE></HEAD> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> -+<HTML> -+<HEAD> -+<TITLE>terminal_interface-curses-text_io-decimal_io.ads</TITLE> -+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> -+<style type="text/css"> -+*.comment { -+ color: green; -+} -+*.symbol { -+ color: red; -+} -+</style> -+</HEAD> - <BODY> --<HR><DIV ALIGN="center"><H1> File : terminal_interface-curses-text_io-decimal_io.ads </H1></DIV><HR> -+<HR><DIV style="text-align:center"><H1> File : terminal_interface-curses-text_io-decimal_io.ads </H1></DIV><HR> - <PRE> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Terminal_Interface.Curses.Text_IO.Decimal_IO --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- S P E C --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Copyright (c) 1998-2003,2009 Free Software Foundation, Inc. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></FONT> --<FONT COLOR=green><EM>-- copy of this software and associated documentation files (the --</EM></FONT> --<FONT COLOR=green><EM>-- "Software"), to deal in the Software without restriction, including --</EM></FONT> --<FONT COLOR=green><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></FONT> --<FONT COLOR=green><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></FONT> --<FONT COLOR=green><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></FONT> --<FONT COLOR=green><EM>-- furnished to do so, subject to the following conditions: --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- The above copyright notice and this permission notice shall be included --</EM></FONT> --<FONT COLOR=green><EM>-- in all copies or substantial portions of the Software. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></FONT> --<FONT COLOR=green><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></FONT> --<FONT COLOR=green><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></FONT> --<FONT COLOR=green><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></FONT> --<FONT COLOR=green><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></FONT> --<FONT COLOR=green><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></FONT> --<FONT COLOR=green><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></FONT> --<FONT COLOR=green><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></FONT> --<FONT COLOR=green><EM>-- sale, use or other dealings in this Software without prior written --</EM></FONT> --<FONT COLOR=green><EM>-- authorization. --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Author: Juergen Pfeifer, 1996</EM></FONT> --<FONT COLOR=green><EM>-- Version Control:</EM></FONT> --<FONT COLOR=green><EM>-- @Revision: 1.12 @</EM></FONT> --<FONT COLOR=green><EM>-- Binding Version 01.00</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Terminal_Interface.Curses.Text_IO.Decimal_IO --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- S P E C --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Copyright (c) 1998-2003,2009 Free Software Foundation, Inc. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></span> -+<span class="comment"><EM>-- copy of this software and associated documentation files (the --</EM></span> -+<span class="comment"><EM>-- "Software"), to deal in the Software without restriction, including --</EM></span> -+<span class="comment"><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></span> -+<span class="comment"><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></span> -+<span class="comment"><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></span> -+<span class="comment"><EM>-- furnished to do so, subject to the following conditions: --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- The above copyright notice and this permission notice shall be included --</EM></span> -+<span class="comment"><EM>-- in all copies or substantial portions of the Software. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></span> -+<span class="comment"><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></span> -+<span class="comment"><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></span> -+<span class="comment"><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></span> -+<span class="comment"><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></span> -+<span class="comment"><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></span> -+<span class="comment"><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></span> -+<span class="comment"><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></span> -+<span class="comment"><EM>-- sale, use or other dealings in this Software without prior written --</EM></span> -+<span class="comment"><EM>-- authorization. --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Author: Juergen Pfeifer, 1996</EM></span> -+<span class="comment"><EM>-- Version Control:</EM></span> -+<span class="comment"><EM>-- @Revision: 1.12 @</EM></span> -+<span class="comment"><EM>-- Binding Version 01.00</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> - <b>generic</b> -- <b>type</b> <FONT COLOR=red><A NAME="ref_42_9" HREF="terminal_interface-curses-text_io-decimal_io__ads.htm#ref_44_43">Num</A></FONT> <b>is</b> <b>delta</b> &lt;&gt; <b>digits</b> &lt;&gt;; -+ <b>type</b> <span class="symbol"><A NAME="ref_42_9" HREF="terminal_interface-curses-text_io-decimal_io__ads.htm#ref_44_43">Num</A></span> <b>is</b> <b>delta</b> &lt;&gt; <b>digits</b> &lt;&gt;; - --<b>package</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-text_io__ads.htm#ref_44_35">Text_IO</A>.<FONT COLOR=red><A NAME="ref_44_43" HREF="terminal_interface-curses-text_io-decimal_io__adb.htm#ref_44_48">Decimal_IO</A></FONT> <b>is</b> -+<b>package</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-text_io__ads.htm#ref_44_35">Text_IO</A>.<span class="symbol"><A NAME="ref_44_43" HREF="terminal_interface-curses-text_io-decimal_io__adb.htm#ref_44_48">Decimal_IO</A></span> <b>is</b> - -- <FONT COLOR=red><A NAME="ref_46_4">Default_Fore</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-decimal_io__ads.htm#ref_42_9">Num</A>'Fore; -- <FONT COLOR=red><A NAME="ref_47_4">Default_Aft</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-decimal_io__ads.htm#ref_42_9">Num</A>'Aft; -- <FONT COLOR=red><A NAME="ref_48_4">Default_Exp</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := 0; -+ <span class="symbol"><A NAME="ref_46_4">Default_Fore</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-decimal_io__ads.htm#ref_42_9">Num</A>'Fore; -+ <span class="symbol"><A NAME="ref_47_4">Default_Aft</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-decimal_io__ads.htm#ref_42_9">Num</A>'Aft; -+ <span class="symbol"><A NAME="ref_48_4">Default_Exp</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := 0; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_50_14" HREF="terminal_interface-curses-text_io-decimal_io__adb.htm#ref_49_14">Put</A></FONT> -- (<FONT COLOR=red><A NAME="ref_51_7" HREF="terminal_interface-curses-text_io-decimal_io__adb.htm#ref_50_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- <FONT COLOR=red><A NAME="ref_52_7" HREF="terminal_interface-curses-text_io-decimal_io__adb.htm#ref_51_7">Item</A></FONT> : <A HREF="terminal_interface-curses-text_io-decimal_io__ads.htm#ref_42_9">Num</A>; -- <FONT COLOR=red><A NAME="ref_53_7" HREF="terminal_interface-curses-text_io-decimal_io__adb.htm#ref_52_7">Fore</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-decimal_io__ads.htm#ref_46_4">Default_Fore</A>; -- <FONT COLOR=red><A NAME="ref_54_7" HREF="terminal_interface-curses-text_io-decimal_io__adb.htm#ref_53_7">Aft</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-decimal_io__ads.htm#ref_47_4">Default_Aft</A>; -- <FONT COLOR=red><A NAME="ref_55_7" HREF="terminal_interface-curses-text_io-decimal_io__adb.htm#ref_54_7">Exp</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-decimal_io__ads.htm#ref_48_4">Default_Exp</A>); -+ <b>procedure</b> <span class="symbol"><A NAME="ref_50_14" HREF="terminal_interface-curses-text_io-decimal_io__adb.htm#ref_49_14">Put</A></span> -+ (<span class="symbol"><A NAME="ref_51_7" HREF="terminal_interface-curses-text_io-decimal_io__adb.htm#ref_50_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="symbol"><A NAME="ref_52_7" HREF="terminal_interface-curses-text_io-decimal_io__adb.htm#ref_51_7">Item</A></span> : <A HREF="terminal_interface-curses-text_io-decimal_io__ads.htm#ref_42_9">Num</A>; -+ <span class="symbol"><A NAME="ref_53_7" HREF="terminal_interface-curses-text_io-decimal_io__adb.htm#ref_52_7">Fore</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-decimal_io__ads.htm#ref_46_4">Default_Fore</A>; -+ <span class="symbol"><A NAME="ref_54_7" HREF="terminal_interface-curses-text_io-decimal_io__adb.htm#ref_53_7">Aft</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-decimal_io__ads.htm#ref_47_4">Default_Aft</A>; -+ <span class="symbol"><A NAME="ref_55_7" HREF="terminal_interface-curses-text_io-decimal_io__adb.htm#ref_54_7">Exp</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-decimal_io__ads.htm#ref_48_4">Default_Exp</A>); - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_57_14" HREF="terminal_interface-curses-text_io-decimal_io__adb.htm#ref_66_14">Put</A></FONT> -- (<FONT COLOR=red><A NAME="ref_58_7" HREF="terminal_interface-curses-text_io-decimal_io__adb.htm#ref_67_7">Item</A></FONT> : <A HREF="terminal_interface-curses-text_io-decimal_io__ads.htm#ref_42_9">Num</A>; -- <FONT COLOR=red><A NAME="ref_59_7" HREF="terminal_interface-curses-text_io-decimal_io__adb.htm#ref_68_7">Fore</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-decimal_io__ads.htm#ref_46_4">Default_Fore</A>; -- <FONT COLOR=red><A NAME="ref_60_7" HREF="terminal_interface-curses-text_io-decimal_io__adb.htm#ref_69_7">Aft</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-decimal_io__ads.htm#ref_47_4">Default_Aft</A>; -- <FONT COLOR=red><A NAME="ref_61_7" HREF="terminal_interface-curses-text_io-decimal_io__adb.htm#ref_70_7">Exp</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-decimal_io__ads.htm#ref_48_4">Default_Exp</A>); -+ <b>procedure</b> <span class="symbol"><A NAME="ref_57_14" HREF="terminal_interface-curses-text_io-decimal_io__adb.htm#ref_66_14">Put</A></span> -+ (<span class="symbol"><A NAME="ref_58_7" HREF="terminal_interface-curses-text_io-decimal_io__adb.htm#ref_67_7">Item</A></span> : <A HREF="terminal_interface-curses-text_io-decimal_io__ads.htm#ref_42_9">Num</A>; -+ <span class="symbol"><A NAME="ref_59_7" HREF="terminal_interface-curses-text_io-decimal_io__adb.htm#ref_68_7">Fore</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-decimal_io__ads.htm#ref_46_4">Default_Fore</A>; -+ <span class="symbol"><A NAME="ref_60_7" HREF="terminal_interface-curses-text_io-decimal_io__adb.htm#ref_69_7">Aft</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-decimal_io__ads.htm#ref_47_4">Default_Aft</A>; -+ <span class="symbol"><A NAME="ref_61_7" HREF="terminal_interface-curses-text_io-decimal_io__adb.htm#ref_70_7">Exp</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-decimal_io__ads.htm#ref_48_4">Default_Exp</A>); - - <b>private</b> - <b>pragma</b> Inline (Put); -diff -Naur ncurses-5.9/doc/html/ada/terminal_interface-curses-text_io-enumeration_io__adb.htm ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-text_io-enumeration_io__adb.htm ---- ncurses-5.9/doc/html/ada/terminal_interface-curses-text_io-enumeration_io__adb.htm 2010-01-09 21:31:27.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-text_io-enumeration_io__adb.htm 2014-09-01 16:33:22.300792030 +0200 -@@ -1,65 +1,77 @@ --<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> --<HTML><HEAD><TITLE>terminal_interface-curses-text_io-enumeration_io.adb</TITLE></HEAD> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> -+<HTML> -+<HEAD> -+<TITLE>terminal_interface-curses-text_io-enumeration_io.adb</TITLE> -+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> -+<style type="text/css"> -+*.comment { -+ color: green; -+} -+*.symbol { -+ color: red; -+} -+</style> -+</HEAD> - <BODY> --<HR><DIV ALIGN="center"><H1> File : terminal_interface-curses-text_io-enumeration_io.adb </H1></DIV><HR> -+<HR><DIV style="text-align:center"><H1> File : terminal_interface-curses-text_io-enumeration_io.adb </H1></DIV><HR> - <PRE> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Terminal_Interface.Curses.Text_IO.Enumeration_IO --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- B O D Y --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Copyright (c) 1998-2003,2009 Free Software Foundation, Inc. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></FONT> --<FONT COLOR=green><EM>-- copy of this software and associated documentation files (the --</EM></FONT> --<FONT COLOR=green><EM>-- "Software"), to deal in the Software without restriction, including --</EM></FONT> --<FONT COLOR=green><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></FONT> --<FONT COLOR=green><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></FONT> --<FONT COLOR=green><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></FONT> --<FONT COLOR=green><EM>-- furnished to do so, subject to the following conditions: --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- The above copyright notice and this permission notice shall be included --</EM></FONT> --<FONT COLOR=green><EM>-- in all copies or substantial portions of the Software. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></FONT> --<FONT COLOR=green><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></FONT> --<FONT COLOR=green><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></FONT> --<FONT COLOR=green><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></FONT> --<FONT COLOR=green><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></FONT> --<FONT COLOR=green><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></FONT> --<FONT COLOR=green><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></FONT> --<FONT COLOR=green><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></FONT> --<FONT COLOR=green><EM>-- sale, use or other dealings in this Software without prior written --</EM></FONT> --<FONT COLOR=green><EM>-- authorization. --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Author: Juergen Pfeifer, 1996</EM></FONT> --<FONT COLOR=green><EM>-- Version Control:</EM></FONT> --<FONT COLOR=green><EM>-- @Revision: 1.11 @</EM></FONT> --<FONT COLOR=green><EM>-- Binding Version 01.00</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Terminal_Interface.Curses.Text_IO.Enumeration_IO --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- B O D Y --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Copyright (c) 1998-2003,2009 Free Software Foundation, Inc. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></span> -+<span class="comment"><EM>-- copy of this software and associated documentation files (the --</EM></span> -+<span class="comment"><EM>-- "Software"), to deal in the Software without restriction, including --</EM></span> -+<span class="comment"><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></span> -+<span class="comment"><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></span> -+<span class="comment"><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></span> -+<span class="comment"><EM>-- furnished to do so, subject to the following conditions: --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- The above copyright notice and this permission notice shall be included --</EM></span> -+<span class="comment"><EM>-- in all copies or substantial portions of the Software. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></span> -+<span class="comment"><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></span> -+<span class="comment"><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></span> -+<span class="comment"><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></span> -+<span class="comment"><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></span> -+<span class="comment"><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></span> -+<span class="comment"><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></span> -+<span class="comment"><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></span> -+<span class="comment"><EM>-- sale, use or other dealings in this Software without prior written --</EM></span> -+<span class="comment"><EM>-- authorization. --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Author: Juergen Pfeifer, 1996</EM></span> -+<span class="comment"><EM>-- Version Control:</EM></span> -+<span class="comment"><EM>-- @Revision: 1.11 @</EM></span> -+<span class="comment"><EM>-- Binding Version 01.00</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> - <b>with</b> Ada.Text_IO; - <b>with</b> Ada.Characters.Handling; <b>use</b> Ada.Characters.Handling; - <b>with</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-text_io__ads.htm#ref_44_35">Text_IO</A>.<A HREF="terminal_interface-curses-text_io-aux__ads.htm#ref_42_51">Aux</A>; - --<b>package</b> <b>body</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-text_io__ads.htm#ref_44_35">Text_IO</A>.<FONT COLOR=red><A NAME="ref_45_48" HREF="terminal_interface-curses-text_io-enumeration_io__ads.htm#ref_44_43">Enumeration_IO</A></FONT> <b>is</b> -+<b>package</b> <b>body</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-text_io__ads.htm#ref_44_35">Text_IO</A>.<span class="symbol"><A NAME="ref_45_48" HREF="terminal_interface-curses-text_io-enumeration_io__ads.htm#ref_44_43">Enumeration_IO</A></span> <b>is</b> - -- <b>package</b> <FONT COLOR=red><A NAME="ref_47_12">Aux</A></FONT> <b>renames</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-text_io__ads.htm#ref_44_35">Text_IO</A>.<A HREF="terminal_interface-curses-text_io-aux__ads.htm#ref_42_51">Aux</A>; -+ <b>package</b> <span class="symbol"><A NAME="ref_47_12">Aux</A></span> <b>renames</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-text_io__ads.htm#ref_44_35">Text_IO</A>.<A HREF="terminal_interface-curses-text_io-aux__ads.htm#ref_42_51">Aux</A>; - <b>package</b> EIO <b>is</b> <b>new</b> Ada.Text_IO.Enumeration_IO (<A HREF="terminal_interface-curses-text_io-enumeration_io__ads.htm#ref_42_9">Enum</A>); - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_50_14" HREF="terminal_interface-curses-text_io-enumeration_io__ads.htm#ref_49_14">Put</A></FONT> -- (<FONT COLOR=red><A NAME="ref_51_7" HREF="terminal_interface-curses-text_io-enumeration_io__ads.htm#ref_50_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- <FONT COLOR=red><A NAME="ref_52_7" HREF="terminal_interface-curses-text_io-enumeration_io__ads.htm#ref_51_7">Item</A></FONT> : <A HREF="terminal_interface-curses-text_io-enumeration_io__ads.htm#ref_42_9">Enum</A>; -- <FONT COLOR=red><A NAME="ref_53_7" HREF="terminal_interface-curses-text_io-enumeration_io__ads.htm#ref_52_7">Width</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-enumeration_io__ads.htm#ref_46_4">Default_Width</A>; -- <FONT COLOR=red><A NAME="ref_54_7" HREF="terminal_interface-curses-text_io-enumeration_io__ads.htm#ref_53_7">Set</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_53_9">Type_Set</A> := <A HREF="terminal_interface-curses-text_io-enumeration_io__ads.htm#ref_47_4">Default_Setting</A>) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_50_14" HREF="terminal_interface-curses-text_io-enumeration_io__ads.htm#ref_49_14">Put</A></span> -+ (<span class="symbol"><A NAME="ref_51_7" HREF="terminal_interface-curses-text_io-enumeration_io__ads.htm#ref_50_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="symbol"><A NAME="ref_52_7" HREF="terminal_interface-curses-text_io-enumeration_io__ads.htm#ref_51_7">Item</A></span> : <A HREF="terminal_interface-curses-text_io-enumeration_io__ads.htm#ref_42_9">Enum</A>; -+ <span class="symbol"><A NAME="ref_53_7" HREF="terminal_interface-curses-text_io-enumeration_io__ads.htm#ref_52_7">Width</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-enumeration_io__ads.htm#ref_46_4">Default_Width</A>; -+ <span class="symbol"><A NAME="ref_54_7" HREF="terminal_interface-curses-text_io-enumeration_io__ads.htm#ref_53_7">Set</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_53_9">Type_Set</A> := <A HREF="terminal_interface-curses-text_io-enumeration_io__ads.htm#ref_47_4">Default_Setting</A>) - <b>is</b> -- <FONT COLOR=red><A NAME="ref_56_7">Buf</A></FONT> : String (1 .. <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A>'Last); -- <FONT COLOR=red><A NAME="ref_57_7">Tset</A></FONT> : Ada.Text_IO.Type_Set; -+ <span class="symbol"><A NAME="ref_56_7">Buf</A></span> : String (1 .. <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A>'Last); -+ <span class="symbol"><A NAME="ref_57_7">Tset</A></span> : Ada.Text_IO.Type_Set; - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses-text_io-enumeration_io__ads.htm#ref_53_7">Set</A> /= <A HREF="terminal_interface-curses-text_io__ads.htm#ref_53_46">Mixed_Case</A> <b>then</b> - <A HREF="terminal_interface-curses-text_io-enumeration_io__adb.htm#ref_57_7">Tset</A> := Ada.Text_IO.Type_Set'Val (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_53_9">Type_Set</A>'Pos (<A HREF="terminal_interface-curses-text_io-enumeration_io__ads.htm#ref_53_7">Set</A>)); -@@ -73,10 +85,10 @@ - <A HREF="terminal_interface-curses-text_io-enumeration_io__adb.htm#ref_47_12">Aux</A>.<A HREF="terminal_interface-curses-text_io-aux__ads.htm#ref_48_14">Put_Buf</A> (<A HREF="terminal_interface-curses-text_io-enumeration_io__ads.htm#ref_50_7">Win</A>, <A HREF="terminal_interface-curses-text_io-enumeration_io__adb.htm#ref_56_7">Buf</A>, <A HREF="terminal_interface-curses-text_io-enumeration_io__ads.htm#ref_52_7">Width</A>, True, True); - <b>end</b> <A HREF="terminal_interface-curses-text_io-enumeration_io__ads.htm#ref_49_14">Put</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_71_14" HREF="terminal_interface-curses-text_io-enumeration_io__ads.htm#ref_55_14">Put</A></FONT> -- (<FONT COLOR=red><A NAME="ref_72_7" HREF="terminal_interface-curses-text_io-enumeration_io__ads.htm#ref_56_7">Item</A></FONT> : <A HREF="terminal_interface-curses-text_io-enumeration_io__ads.htm#ref_42_9">Enum</A>; -- <FONT COLOR=red><A NAME="ref_73_7" HREF="terminal_interface-curses-text_io-enumeration_io__ads.htm#ref_57_7">Width</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-enumeration_io__ads.htm#ref_46_4">Default_Width</A>; -- <FONT COLOR=red><A NAME="ref_74_7" HREF="terminal_interface-curses-text_io-enumeration_io__ads.htm#ref_58_7">Set</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_53_9">Type_Set</A> := <A HREF="terminal_interface-curses-text_io-enumeration_io__ads.htm#ref_47_4">Default_Setting</A>) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_71_14" HREF="terminal_interface-curses-text_io-enumeration_io__ads.htm#ref_55_14">Put</A></span> -+ (<span class="symbol"><A NAME="ref_72_7" HREF="terminal_interface-curses-text_io-enumeration_io__ads.htm#ref_56_7">Item</A></span> : <A HREF="terminal_interface-curses-text_io-enumeration_io__ads.htm#ref_42_9">Enum</A>; -+ <span class="symbol"><A NAME="ref_73_7" HREF="terminal_interface-curses-text_io-enumeration_io__ads.htm#ref_57_7">Width</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-enumeration_io__ads.htm#ref_46_4">Default_Width</A>; -+ <span class="symbol"><A NAME="ref_74_7" HREF="terminal_interface-curses-text_io-enumeration_io__ads.htm#ref_58_7">Set</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_53_9">Type_Set</A> := <A HREF="terminal_interface-curses-text_io-enumeration_io__ads.htm#ref_47_4">Default_Setting</A>) - <b>is</b> - <b>begin</b> - <A HREF="terminal_interface-curses-text_io-enumeration_io__ads.htm#ref_49_14">Put</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_62_13">Get_Window</A>, <A HREF="terminal_interface-curses-text_io-enumeration_io__ads.htm#ref_56_7">Item</A>, <A HREF="terminal_interface-curses-text_io-enumeration_io__ads.htm#ref_57_7">Width</A>, <A HREF="terminal_interface-curses-text_io-enumeration_io__ads.htm#ref_58_7">Set</A>); -diff -Naur ncurses-5.9/doc/html/ada/terminal_interface-curses-text_io-enumeration_io__ads.htm ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-text_io-enumeration_io__ads.htm ---- ncurses-5.9/doc/html/ada/terminal_interface-curses-text_io-enumeration_io__ads.htm 2010-01-09 21:31:27.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-text_io-enumeration_io__ads.htm 2014-09-01 16:33:22.301792031 +0200 -@@ -1,66 +1,78 @@ --<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> --<HTML><HEAD><TITLE>terminal_interface-curses-text_io-enumeration_io.ads</TITLE></HEAD> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> -+<HTML> -+<HEAD> -+<TITLE>terminal_interface-curses-text_io-enumeration_io.ads</TITLE> -+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> -+<style type="text/css"> -+*.comment { -+ color: green; -+} -+*.symbol { -+ color: red; -+} -+</style> -+</HEAD> - <BODY> --<HR><DIV ALIGN="center"><H1> File : terminal_interface-curses-text_io-enumeration_io.ads </H1></DIV><HR> -+<HR><DIV style="text-align:center"><H1> File : terminal_interface-curses-text_io-enumeration_io.ads </H1></DIV><HR> - <PRE> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Terminal_Interface.Curses.Text_IO.Enumeration_IO --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- S P E C --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Copyright (c) 1998-2003,2009 Free Software Foundation, Inc. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></FONT> --<FONT COLOR=green><EM>-- copy of this software and associated documentation files (the --</EM></FONT> --<FONT COLOR=green><EM>-- "Software"), to deal in the Software without restriction, including --</EM></FONT> --<FONT COLOR=green><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></FONT> --<FONT COLOR=green><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></FONT> --<FONT COLOR=green><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></FONT> --<FONT COLOR=green><EM>-- furnished to do so, subject to the following conditions: --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- The above copyright notice and this permission notice shall be included --</EM></FONT> --<FONT COLOR=green><EM>-- in all copies or substantial portions of the Software. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></FONT> --<FONT COLOR=green><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></FONT> --<FONT COLOR=green><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></FONT> --<FONT COLOR=green><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></FONT> --<FONT COLOR=green><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></FONT> --<FONT COLOR=green><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></FONT> --<FONT COLOR=green><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></FONT> --<FONT COLOR=green><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></FONT> --<FONT COLOR=green><EM>-- sale, use or other dealings in this Software without prior written --</EM></FONT> --<FONT COLOR=green><EM>-- authorization. --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Author: Juergen Pfeifer, 1996</EM></FONT> --<FONT COLOR=green><EM>-- Version Control:</EM></FONT> --<FONT COLOR=green><EM>-- @Revision: 1.12 @</EM></FONT> --<FONT COLOR=green><EM>-- Binding Version 01.00</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Terminal_Interface.Curses.Text_IO.Enumeration_IO --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- S P E C --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Copyright (c) 1998-2003,2009 Free Software Foundation, Inc. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></span> -+<span class="comment"><EM>-- copy of this software and associated documentation files (the --</EM></span> -+<span class="comment"><EM>-- "Software"), to deal in the Software without restriction, including --</EM></span> -+<span class="comment"><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></span> -+<span class="comment"><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></span> -+<span class="comment"><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></span> -+<span class="comment"><EM>-- furnished to do so, subject to the following conditions: --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- The above copyright notice and this permission notice shall be included --</EM></span> -+<span class="comment"><EM>-- in all copies or substantial portions of the Software. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></span> -+<span class="comment"><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></span> -+<span class="comment"><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></span> -+<span class="comment"><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></span> -+<span class="comment"><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></span> -+<span class="comment"><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></span> -+<span class="comment"><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></span> -+<span class="comment"><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></span> -+<span class="comment"><EM>-- sale, use or other dealings in this Software without prior written --</EM></span> -+<span class="comment"><EM>-- authorization. --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Author: Juergen Pfeifer, 1996</EM></span> -+<span class="comment"><EM>-- Version Control:</EM></span> -+<span class="comment"><EM>-- @Revision: 1.12 @</EM></span> -+<span class="comment"><EM>-- Binding Version 01.00</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> - <b>generic</b> -- <b>type</b> <FONT COLOR=red><A NAME="ref_42_9" HREF="terminal_interface-curses-text_io-enumeration_io__ads.htm#ref_44_43">Enum</A></FONT> <b>is</b> (&lt;&gt;); -+ <b>type</b> <span class="symbol"><A NAME="ref_42_9" HREF="terminal_interface-curses-text_io-enumeration_io__ads.htm#ref_44_43">Enum</A></span> <b>is</b> (&lt;&gt;); - --<b>package</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-text_io__ads.htm#ref_44_35">Text_IO</A>.<FONT COLOR=red><A NAME="ref_44_43" HREF="terminal_interface-curses-text_io-enumeration_io__adb.htm#ref_45_48">Enumeration_IO</A></FONT> <b>is</b> -+<b>package</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-text_io__ads.htm#ref_44_35">Text_IO</A>.<span class="symbol"><A NAME="ref_44_43" HREF="terminal_interface-curses-text_io-enumeration_io__adb.htm#ref_45_48">Enumeration_IO</A></span> <b>is</b> - -- <FONT COLOR=red><A NAME="ref_46_4">Default_Width</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := 0; -- <FONT COLOR=red><A NAME="ref_47_4">Default_Setting</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_53_9">Type_Set</A> := <A HREF="terminal_interface-curses-text_io__ads.htm#ref_53_46">Mixed_Case</A>; -+ <span class="symbol"><A NAME="ref_46_4">Default_Width</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := 0; -+ <span class="symbol"><A NAME="ref_47_4">Default_Setting</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_53_9">Type_Set</A> := <A HREF="terminal_interface-curses-text_io__ads.htm#ref_53_46">Mixed_Case</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_49_14" HREF="terminal_interface-curses-text_io-enumeration_io__adb.htm#ref_50_14">Put</A></FONT> -- (<FONT COLOR=red><A NAME="ref_50_7" HREF="terminal_interface-curses-text_io-enumeration_io__adb.htm#ref_51_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- <FONT COLOR=red><A NAME="ref_51_7" HREF="terminal_interface-curses-text_io-enumeration_io__adb.htm#ref_52_7">Item</A></FONT> : <A HREF="terminal_interface-curses-text_io-enumeration_io__ads.htm#ref_42_9">Enum</A>; -- <FONT COLOR=red><A NAME="ref_52_7" HREF="terminal_interface-curses-text_io-enumeration_io__adb.htm#ref_53_7">Width</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-enumeration_io__ads.htm#ref_46_4">Default_Width</A>; -- <FONT COLOR=red><A NAME="ref_53_7" HREF="terminal_interface-curses-text_io-enumeration_io__adb.htm#ref_54_7">Set</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_53_9">Type_Set</A> := <A HREF="terminal_interface-curses-text_io-enumeration_io__ads.htm#ref_47_4">Default_Setting</A>); -+ <b>procedure</b> <span class="symbol"><A NAME="ref_49_14" HREF="terminal_interface-curses-text_io-enumeration_io__adb.htm#ref_50_14">Put</A></span> -+ (<span class="symbol"><A NAME="ref_50_7" HREF="terminal_interface-curses-text_io-enumeration_io__adb.htm#ref_51_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="symbol"><A NAME="ref_51_7" HREF="terminal_interface-curses-text_io-enumeration_io__adb.htm#ref_52_7">Item</A></span> : <A HREF="terminal_interface-curses-text_io-enumeration_io__ads.htm#ref_42_9">Enum</A>; -+ <span class="symbol"><A NAME="ref_52_7" HREF="terminal_interface-curses-text_io-enumeration_io__adb.htm#ref_53_7">Width</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-enumeration_io__ads.htm#ref_46_4">Default_Width</A>; -+ <span class="symbol"><A NAME="ref_53_7" HREF="terminal_interface-curses-text_io-enumeration_io__adb.htm#ref_54_7">Set</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_53_9">Type_Set</A> := <A HREF="terminal_interface-curses-text_io-enumeration_io__ads.htm#ref_47_4">Default_Setting</A>); - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_55_14" HREF="terminal_interface-curses-text_io-enumeration_io__adb.htm#ref_71_14">Put</A></FONT> -- (<FONT COLOR=red><A NAME="ref_56_7" HREF="terminal_interface-curses-text_io-enumeration_io__adb.htm#ref_72_7">Item</A></FONT> : <A HREF="terminal_interface-curses-text_io-enumeration_io__ads.htm#ref_42_9">Enum</A>; -- <FONT COLOR=red><A NAME="ref_57_7" HREF="terminal_interface-curses-text_io-enumeration_io__adb.htm#ref_73_7">Width</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-enumeration_io__ads.htm#ref_46_4">Default_Width</A>; -- <FONT COLOR=red><A NAME="ref_58_7" HREF="terminal_interface-curses-text_io-enumeration_io__adb.htm#ref_74_7">Set</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_53_9">Type_Set</A> := <A HREF="terminal_interface-curses-text_io-enumeration_io__ads.htm#ref_47_4">Default_Setting</A>); -+ <b>procedure</b> <span class="symbol"><A NAME="ref_55_14" HREF="terminal_interface-curses-text_io-enumeration_io__adb.htm#ref_71_14">Put</A></span> -+ (<span class="symbol"><A NAME="ref_56_7" HREF="terminal_interface-curses-text_io-enumeration_io__adb.htm#ref_72_7">Item</A></span> : <A HREF="terminal_interface-curses-text_io-enumeration_io__ads.htm#ref_42_9">Enum</A>; -+ <span class="symbol"><A NAME="ref_57_7" HREF="terminal_interface-curses-text_io-enumeration_io__adb.htm#ref_73_7">Width</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-enumeration_io__ads.htm#ref_46_4">Default_Width</A>; -+ <span class="symbol"><A NAME="ref_58_7" HREF="terminal_interface-curses-text_io-enumeration_io__adb.htm#ref_74_7">Set</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_53_9">Type_Set</A> := <A HREF="terminal_interface-curses-text_io-enumeration_io__ads.htm#ref_47_4">Default_Setting</A>); - - <b>private</b> - <b>pragma</b> Inline (Put); -diff -Naur ncurses-5.9/doc/html/ada/terminal_interface-curses-text_io-fixed_io__adb.htm ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-text_io-fixed_io__adb.htm ---- ncurses-5.9/doc/html/ada/terminal_interface-curses-text_io-fixed_io__adb.htm 2010-01-09 21:31:27.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-text_io-fixed_io__adb.htm 2014-09-01 16:33:22.301792031 +0200 -@@ -1,65 +1,77 @@ --<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> --<HTML><HEAD><TITLE>terminal_interface-curses-text_io-fixed_io.adb</TITLE></HEAD> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> -+<HTML> -+<HEAD> -+<TITLE>terminal_interface-curses-text_io-fixed_io.adb</TITLE> -+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> -+<style type="text/css"> -+*.comment { -+ color: green; -+} -+*.symbol { -+ color: red; -+} -+</style> -+</HEAD> - <BODY> --<HR><DIV ALIGN="center"><H1> File : terminal_interface-curses-text_io-fixed_io.adb </H1></DIV><HR> -+<HR><DIV style="text-align:center"><H1> File : terminal_interface-curses-text_io-fixed_io.adb </H1></DIV><HR> - <PRE> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Terminal_Interface.Curses.Text_IO.Fixed_IO --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- B O D Y --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Copyright (c) 1998-2003,2009 Free Software Foundation, Inc. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></FONT> --<FONT COLOR=green><EM>-- copy of this software and associated documentation files (the --</EM></FONT> --<FONT COLOR=green><EM>-- "Software"), to deal in the Software without restriction, including --</EM></FONT> --<FONT COLOR=green><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></FONT> --<FONT COLOR=green><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></FONT> --<FONT COLOR=green><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></FONT> --<FONT COLOR=green><EM>-- furnished to do so, subject to the following conditions: --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- The above copyright notice and this permission notice shall be included --</EM></FONT> --<FONT COLOR=green><EM>-- in all copies or substantial portions of the Software. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></FONT> --<FONT COLOR=green><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></FONT> --<FONT COLOR=green><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></FONT> --<FONT COLOR=green><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></FONT> --<FONT COLOR=green><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></FONT> --<FONT COLOR=green><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></FONT> --<FONT COLOR=green><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></FONT> --<FONT COLOR=green><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></FONT> --<FONT COLOR=green><EM>-- sale, use or other dealings in this Software without prior written --</EM></FONT> --<FONT COLOR=green><EM>-- authorization. --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Author: Juergen Pfeifer, 1996</EM></FONT> --<FONT COLOR=green><EM>-- Version Control:</EM></FONT> --<FONT COLOR=green><EM>-- @Revision: 1.11 @</EM></FONT> --<FONT COLOR=green><EM>-- Binding Version 01.00</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Terminal_Interface.Curses.Text_IO.Fixed_IO --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- B O D Y --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Copyright (c) 1998-2003,2009 Free Software Foundation, Inc. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></span> -+<span class="comment"><EM>-- copy of this software and associated documentation files (the --</EM></span> -+<span class="comment"><EM>-- "Software"), to deal in the Software without restriction, including --</EM></span> -+<span class="comment"><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></span> -+<span class="comment"><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></span> -+<span class="comment"><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></span> -+<span class="comment"><EM>-- furnished to do so, subject to the following conditions: --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- The above copyright notice and this permission notice shall be included --</EM></span> -+<span class="comment"><EM>-- in all copies or substantial portions of the Software. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></span> -+<span class="comment"><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></span> -+<span class="comment"><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></span> -+<span class="comment"><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></span> -+<span class="comment"><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></span> -+<span class="comment"><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></span> -+<span class="comment"><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></span> -+<span class="comment"><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></span> -+<span class="comment"><EM>-- sale, use or other dealings in this Software without prior written --</EM></span> -+<span class="comment"><EM>-- authorization. --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Author: Juergen Pfeifer, 1996</EM></span> -+<span class="comment"><EM>-- Version Control:</EM></span> -+<span class="comment"><EM>-- @Revision: 1.11 @</EM></span> -+<span class="comment"><EM>-- Binding Version 01.00</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> - <b>with</b> Ada.Text_IO; - <b>with</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-text_io__ads.htm#ref_44_35">Text_IO</A>.<A HREF="terminal_interface-curses-text_io-aux__ads.htm#ref_42_51">Aux</A>; - --<b>package</b> <b>body</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-text_io__ads.htm#ref_44_35">Text_IO</A>.<FONT COLOR=red><A NAME="ref_44_48" HREF="terminal_interface-curses-text_io-fixed_io__ads.htm#ref_44_43">Fixed_IO</A></FONT> <b>is</b> -+<b>package</b> <b>body</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-text_io__ads.htm#ref_44_35">Text_IO</A>.<span class="symbol"><A NAME="ref_44_48" HREF="terminal_interface-curses-text_io-fixed_io__ads.htm#ref_44_43">Fixed_IO</A></span> <b>is</b> - -- <b>package</b> <FONT COLOR=red><A NAME="ref_46_12">Aux</A></FONT> <b>renames</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-text_io__ads.htm#ref_44_35">Text_IO</A>.<A HREF="terminal_interface-curses-text_io-aux__ads.htm#ref_42_51">Aux</A>; -+ <b>package</b> <span class="symbol"><A NAME="ref_46_12">Aux</A></span> <b>renames</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-text_io__ads.htm#ref_44_35">Text_IO</A>.<A HREF="terminal_interface-curses-text_io-aux__ads.htm#ref_42_51">Aux</A>; - <b>package</b> FIXIO <b>is</b> <b>new</b> Ada.Text_IO.Fixed_IO (<A HREF="terminal_interface-curses-text_io-fixed_io__ads.htm#ref_42_9">Num</A>); - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_49_14" HREF="terminal_interface-curses-text_io-fixed_io__ads.htm#ref_50_14">Put</A></FONT> -- (<FONT COLOR=red><A NAME="ref_50_7" HREF="terminal_interface-curses-text_io-fixed_io__ads.htm#ref_51_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- <FONT COLOR=red><A NAME="ref_51_7" HREF="terminal_interface-curses-text_io-fixed_io__ads.htm#ref_52_7">Item</A></FONT> : <A HREF="terminal_interface-curses-text_io-fixed_io__ads.htm#ref_42_9">Num</A>; -- <FONT COLOR=red><A NAME="ref_52_7" HREF="terminal_interface-curses-text_io-fixed_io__ads.htm#ref_53_7">Fore</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-fixed_io__ads.htm#ref_46_4">Default_Fore</A>; -- <FONT COLOR=red><A NAME="ref_53_7" HREF="terminal_interface-curses-text_io-fixed_io__ads.htm#ref_54_7">Aft</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-fixed_io__ads.htm#ref_47_4">Default_Aft</A>; -- <FONT COLOR=red><A NAME="ref_54_7" HREF="terminal_interface-curses-text_io-fixed_io__ads.htm#ref_55_7">Exp</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-fixed_io__ads.htm#ref_48_4">Default_Exp</A>) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_49_14" HREF="terminal_interface-curses-text_io-fixed_io__ads.htm#ref_50_14">Put</A></span> -+ (<span class="symbol"><A NAME="ref_50_7" HREF="terminal_interface-curses-text_io-fixed_io__ads.htm#ref_51_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="symbol"><A NAME="ref_51_7" HREF="terminal_interface-curses-text_io-fixed_io__ads.htm#ref_52_7">Item</A></span> : <A HREF="terminal_interface-curses-text_io-fixed_io__ads.htm#ref_42_9">Num</A>; -+ <span class="symbol"><A NAME="ref_52_7" HREF="terminal_interface-curses-text_io-fixed_io__ads.htm#ref_53_7">Fore</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-fixed_io__ads.htm#ref_46_4">Default_Fore</A>; -+ <span class="symbol"><A NAME="ref_53_7" HREF="terminal_interface-curses-text_io-fixed_io__ads.htm#ref_54_7">Aft</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-fixed_io__ads.htm#ref_47_4">Default_Aft</A>; -+ <span class="symbol"><A NAME="ref_54_7" HREF="terminal_interface-curses-text_io-fixed_io__ads.htm#ref_55_7">Exp</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-fixed_io__ads.htm#ref_48_4">Default_Exp</A>) - <b>is</b> -- <FONT COLOR=red><A NAME="ref_56_7">Buf</A></FONT> : String (1 .. <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A>'Last); -- <FONT COLOR=red><A NAME="ref_57_7">Len</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-fixed_io__ads.htm#ref_53_7">Fore</A> + 1 + <A HREF="terminal_interface-curses-text_io-fixed_io__ads.htm#ref_54_7">Aft</A>; -+ <span class="symbol"><A NAME="ref_56_7">Buf</A></span> : String (1 .. <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A>'Last); -+ <span class="symbol"><A NAME="ref_57_7">Len</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-fixed_io__ads.htm#ref_53_7">Fore</A> + 1 + <A HREF="terminal_interface-curses-text_io-fixed_io__ads.htm#ref_54_7">Aft</A>; - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses-text_io-fixed_io__ads.htm#ref_55_7">Exp</A> &gt; 0 <b>then</b> - <A HREF="terminal_interface-curses-text_io-fixed_io__adb.htm#ref_57_7">Len</A> := <A HREF="terminal_interface-curses-text_io-fixed_io__adb.htm#ref_57_7">Len</A> + 1 + <A HREF="terminal_interface-curses-text_io-fixed_io__ads.htm#ref_55_7">Exp</A>; -@@ -68,11 +80,11 @@ - <A HREF="terminal_interface-curses-text_io-fixed_io__adb.htm#ref_46_12">Aux</A>.<A HREF="terminal_interface-curses-text_io-aux__ads.htm#ref_48_14">Put_Buf</A> (<A HREF="terminal_interface-curses-text_io-fixed_io__ads.htm#ref_51_7">Win</A>, <A HREF="terminal_interface-curses-text_io-fixed_io__adb.htm#ref_56_7">Buf</A>, <A HREF="terminal_interface-curses-text_io-fixed_io__adb.htm#ref_57_7">Len</A>, False); - <b>end</b> <A HREF="terminal_interface-curses-text_io-fixed_io__ads.htm#ref_50_14">Put</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_66_14" HREF="terminal_interface-curses-text_io-fixed_io__ads.htm#ref_57_14">Put</A></FONT> -- (<FONT COLOR=red><A NAME="ref_67_7" HREF="terminal_interface-curses-text_io-fixed_io__ads.htm#ref_58_7">Item</A></FONT> : <A HREF="terminal_interface-curses-text_io-fixed_io__ads.htm#ref_42_9">Num</A>; -- <FONT COLOR=red><A NAME="ref_68_7" HREF="terminal_interface-curses-text_io-fixed_io__ads.htm#ref_59_7">Fore</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-fixed_io__ads.htm#ref_46_4">Default_Fore</A>; -- <FONT COLOR=red><A NAME="ref_69_7" HREF="terminal_interface-curses-text_io-fixed_io__ads.htm#ref_60_7">Aft</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-fixed_io__ads.htm#ref_47_4">Default_Aft</A>; -- <FONT COLOR=red><A NAME="ref_70_7" HREF="terminal_interface-curses-text_io-fixed_io__ads.htm#ref_61_7">Exp</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-fixed_io__ads.htm#ref_48_4">Default_Exp</A>) <b>is</b> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_66_14" HREF="terminal_interface-curses-text_io-fixed_io__ads.htm#ref_57_14">Put</A></span> -+ (<span class="symbol"><A NAME="ref_67_7" HREF="terminal_interface-curses-text_io-fixed_io__ads.htm#ref_58_7">Item</A></span> : <A HREF="terminal_interface-curses-text_io-fixed_io__ads.htm#ref_42_9">Num</A>; -+ <span class="symbol"><A NAME="ref_68_7" HREF="terminal_interface-curses-text_io-fixed_io__ads.htm#ref_59_7">Fore</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-fixed_io__ads.htm#ref_46_4">Default_Fore</A>; -+ <span class="symbol"><A NAME="ref_69_7" HREF="terminal_interface-curses-text_io-fixed_io__ads.htm#ref_60_7">Aft</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-fixed_io__ads.htm#ref_47_4">Default_Aft</A>; -+ <span class="symbol"><A NAME="ref_70_7" HREF="terminal_interface-curses-text_io-fixed_io__ads.htm#ref_61_7">Exp</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-fixed_io__ads.htm#ref_48_4">Default_Exp</A>) <b>is</b> - <b>begin</b> - <A HREF="terminal_interface-curses-text_io-fixed_io__ads.htm#ref_50_14">Put</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_62_13">Get_Window</A>, <A HREF="terminal_interface-curses-text_io-fixed_io__ads.htm#ref_58_7">Item</A>, <A HREF="terminal_interface-curses-text_io-fixed_io__ads.htm#ref_59_7">Fore</A>, <A HREF="terminal_interface-curses-text_io-fixed_io__ads.htm#ref_60_7">Aft</A>, <A HREF="terminal_interface-curses-text_io-fixed_io__ads.htm#ref_61_7">Exp</A>); - <b>end</b> <A HREF="terminal_interface-curses-text_io-fixed_io__ads.htm#ref_57_14">Put</A>; -diff -Naur ncurses-5.9/doc/html/ada/terminal_interface-curses-text_io-fixed_io__ads.htm ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-text_io-fixed_io__ads.htm ---- ncurses-5.9/doc/html/ada/terminal_interface-curses-text_io-fixed_io__ads.htm 2010-01-09 21:31:27.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-text_io-fixed_io__ads.htm 2014-09-01 16:33:22.301792031 +0200 -@@ -1,69 +1,81 @@ --<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> --<HTML><HEAD><TITLE>terminal_interface-curses-text_io-fixed_io.ads</TITLE></HEAD> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> -+<HTML> -+<HEAD> -+<TITLE>terminal_interface-curses-text_io-fixed_io.ads</TITLE> -+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> -+<style type="text/css"> -+*.comment { -+ color: green; -+} -+*.symbol { -+ color: red; -+} -+</style> -+</HEAD> - <BODY> --<HR><DIV ALIGN="center"><H1> File : terminal_interface-curses-text_io-fixed_io.ads </H1></DIV><HR> -+<HR><DIV style="text-align:center"><H1> File : terminal_interface-curses-text_io-fixed_io.ads </H1></DIV><HR> - <PRE> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Terminal_Interface.Curses.Text_IO.Fixed_IO --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- S P E C --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Copyright (c) 1998-2003,2009 Free Software Foundation, Inc. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></FONT> --<FONT COLOR=green><EM>-- copy of this software and associated documentation files (the --</EM></FONT> --<FONT COLOR=green><EM>-- "Software"), to deal in the Software without restriction, including --</EM></FONT> --<FONT COLOR=green><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></FONT> --<FONT COLOR=green><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></FONT> --<FONT COLOR=green><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></FONT> --<FONT COLOR=green><EM>-- furnished to do so, subject to the following conditions: --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- The above copyright notice and this permission notice shall be included --</EM></FONT> --<FONT COLOR=green><EM>-- in all copies or substantial portions of the Software. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></FONT> --<FONT COLOR=green><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></FONT> --<FONT COLOR=green><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></FONT> --<FONT COLOR=green><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></FONT> --<FONT COLOR=green><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></FONT> --<FONT COLOR=green><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></FONT> --<FONT COLOR=green><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></FONT> --<FONT COLOR=green><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></FONT> --<FONT COLOR=green><EM>-- sale, use or other dealings in this Software without prior written --</EM></FONT> --<FONT COLOR=green><EM>-- authorization. --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Author: Juergen Pfeifer, 1996</EM></FONT> --<FONT COLOR=green><EM>-- Version Control:</EM></FONT> --<FONT COLOR=green><EM>-- @Revision: 1.12 @</EM></FONT> --<FONT COLOR=green><EM>-- Binding Version 01.00</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Terminal_Interface.Curses.Text_IO.Fixed_IO --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- S P E C --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Copyright (c) 1998-2003,2009 Free Software Foundation, Inc. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></span> -+<span class="comment"><EM>-- copy of this software and associated documentation files (the --</EM></span> -+<span class="comment"><EM>-- "Software"), to deal in the Software without restriction, including --</EM></span> -+<span class="comment"><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></span> -+<span class="comment"><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></span> -+<span class="comment"><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></span> -+<span class="comment"><EM>-- furnished to do so, subject to the following conditions: --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- The above copyright notice and this permission notice shall be included --</EM></span> -+<span class="comment"><EM>-- in all copies or substantial portions of the Software. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></span> -+<span class="comment"><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></span> -+<span class="comment"><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></span> -+<span class="comment"><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></span> -+<span class="comment"><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></span> -+<span class="comment"><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></span> -+<span class="comment"><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></span> -+<span class="comment"><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></span> -+<span class="comment"><EM>-- sale, use or other dealings in this Software without prior written --</EM></span> -+<span class="comment"><EM>-- authorization. --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Author: Juergen Pfeifer, 1996</EM></span> -+<span class="comment"><EM>-- Version Control:</EM></span> -+<span class="comment"><EM>-- @Revision: 1.12 @</EM></span> -+<span class="comment"><EM>-- Binding Version 01.00</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> - <b>generic</b> -- <b>type</b> <FONT COLOR=red><A NAME="ref_42_9" HREF="terminal_interface-curses-text_io-fixed_io__ads.htm#ref_44_43">Num</A></FONT> <b>is</b> <b>delta</b> &lt;&gt;; -+ <b>type</b> <span class="symbol"><A NAME="ref_42_9" HREF="terminal_interface-curses-text_io-fixed_io__ads.htm#ref_44_43">Num</A></span> <b>is</b> <b>delta</b> &lt;&gt;; - --<b>package</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-text_io__ads.htm#ref_44_35">Text_IO</A>.<FONT COLOR=red><A NAME="ref_44_43" HREF="terminal_interface-curses-text_io-fixed_io__adb.htm#ref_44_48">Fixed_IO</A></FONT> <b>is</b> -+<b>package</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-text_io__ads.htm#ref_44_35">Text_IO</A>.<span class="symbol"><A NAME="ref_44_43" HREF="terminal_interface-curses-text_io-fixed_io__adb.htm#ref_44_48">Fixed_IO</A></span> <b>is</b> - -- <FONT COLOR=red><A NAME="ref_46_4">Default_Fore</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-fixed_io__ads.htm#ref_42_9">Num</A>'Fore; -- <FONT COLOR=red><A NAME="ref_47_4">Default_Aft</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-fixed_io__ads.htm#ref_42_9">Num</A>'Aft; -- <FONT COLOR=red><A NAME="ref_48_4">Default_Exp</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := 0; -+ <span class="symbol"><A NAME="ref_46_4">Default_Fore</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-fixed_io__ads.htm#ref_42_9">Num</A>'Fore; -+ <span class="symbol"><A NAME="ref_47_4">Default_Aft</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-fixed_io__ads.htm#ref_42_9">Num</A>'Aft; -+ <span class="symbol"><A NAME="ref_48_4">Default_Exp</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := 0; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_50_14" HREF="terminal_interface-curses-text_io-fixed_io__adb.htm#ref_49_14">Put</A></FONT> -- (<FONT COLOR=red><A NAME="ref_51_7" HREF="terminal_interface-curses-text_io-fixed_io__adb.htm#ref_50_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- <FONT COLOR=red><A NAME="ref_52_7" HREF="terminal_interface-curses-text_io-fixed_io__adb.htm#ref_51_7">Item</A></FONT> : <A HREF="terminal_interface-curses-text_io-fixed_io__ads.htm#ref_42_9">Num</A>; -- <FONT COLOR=red><A NAME="ref_53_7" HREF="terminal_interface-curses-text_io-fixed_io__adb.htm#ref_52_7">Fore</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-fixed_io__ads.htm#ref_46_4">Default_Fore</A>; -- <FONT COLOR=red><A NAME="ref_54_7" HREF="terminal_interface-curses-text_io-fixed_io__adb.htm#ref_53_7">Aft</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-fixed_io__ads.htm#ref_47_4">Default_Aft</A>; -- <FONT COLOR=red><A NAME="ref_55_7" HREF="terminal_interface-curses-text_io-fixed_io__adb.htm#ref_54_7">Exp</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-fixed_io__ads.htm#ref_48_4">Default_Exp</A>); -+ <b>procedure</b> <span class="symbol"><A NAME="ref_50_14" HREF="terminal_interface-curses-text_io-fixed_io__adb.htm#ref_49_14">Put</A></span> -+ (<span class="symbol"><A NAME="ref_51_7" HREF="terminal_interface-curses-text_io-fixed_io__adb.htm#ref_50_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="symbol"><A NAME="ref_52_7" HREF="terminal_interface-curses-text_io-fixed_io__adb.htm#ref_51_7">Item</A></span> : <A HREF="terminal_interface-curses-text_io-fixed_io__ads.htm#ref_42_9">Num</A>; -+ <span class="symbol"><A NAME="ref_53_7" HREF="terminal_interface-curses-text_io-fixed_io__adb.htm#ref_52_7">Fore</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-fixed_io__ads.htm#ref_46_4">Default_Fore</A>; -+ <span class="symbol"><A NAME="ref_54_7" HREF="terminal_interface-curses-text_io-fixed_io__adb.htm#ref_53_7">Aft</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-fixed_io__ads.htm#ref_47_4">Default_Aft</A>; -+ <span class="symbol"><A NAME="ref_55_7" HREF="terminal_interface-curses-text_io-fixed_io__adb.htm#ref_54_7">Exp</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-fixed_io__ads.htm#ref_48_4">Default_Exp</A>); - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_57_14" HREF="terminal_interface-curses-text_io-fixed_io__adb.htm#ref_66_14">Put</A></FONT> -- (<FONT COLOR=red><A NAME="ref_58_7" HREF="terminal_interface-curses-text_io-fixed_io__adb.htm#ref_67_7">Item</A></FONT> : <A HREF="terminal_interface-curses-text_io-fixed_io__ads.htm#ref_42_9">Num</A>; -- <FONT COLOR=red><A NAME="ref_59_7" HREF="terminal_interface-curses-text_io-fixed_io__adb.htm#ref_68_7">Fore</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-fixed_io__ads.htm#ref_46_4">Default_Fore</A>; -- <FONT COLOR=red><A NAME="ref_60_7" HREF="terminal_interface-curses-text_io-fixed_io__adb.htm#ref_69_7">Aft</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-fixed_io__ads.htm#ref_47_4">Default_Aft</A>; -- <FONT COLOR=red><A NAME="ref_61_7" HREF="terminal_interface-curses-text_io-fixed_io__adb.htm#ref_70_7">Exp</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-fixed_io__ads.htm#ref_48_4">Default_Exp</A>); -+ <b>procedure</b> <span class="symbol"><A NAME="ref_57_14" HREF="terminal_interface-curses-text_io-fixed_io__adb.htm#ref_66_14">Put</A></span> -+ (<span class="symbol"><A NAME="ref_58_7" HREF="terminal_interface-curses-text_io-fixed_io__adb.htm#ref_67_7">Item</A></span> : <A HREF="terminal_interface-curses-text_io-fixed_io__ads.htm#ref_42_9">Num</A>; -+ <span class="symbol"><A NAME="ref_59_7" HREF="terminal_interface-curses-text_io-fixed_io__adb.htm#ref_68_7">Fore</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-fixed_io__ads.htm#ref_46_4">Default_Fore</A>; -+ <span class="symbol"><A NAME="ref_60_7" HREF="terminal_interface-curses-text_io-fixed_io__adb.htm#ref_69_7">Aft</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-fixed_io__ads.htm#ref_47_4">Default_Aft</A>; -+ <span class="symbol"><A NAME="ref_61_7" HREF="terminal_interface-curses-text_io-fixed_io__adb.htm#ref_70_7">Exp</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-fixed_io__ads.htm#ref_48_4">Default_Exp</A>); - - <b>private</b> - <b>pragma</b> Inline (Put); -diff -Naur ncurses-5.9/doc/html/ada/terminal_interface-curses-text_io-float_io__adb.htm ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-text_io-float_io__adb.htm ---- ncurses-5.9/doc/html/ada/terminal_interface-curses-text_io-float_io__adb.htm 2010-01-09 21:31:27.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-text_io-float_io__adb.htm 2014-09-01 16:33:22.302792033 +0200 -@@ -1,65 +1,77 @@ --<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> --<HTML><HEAD><TITLE>terminal_interface-curses-text_io-float_io.adb</TITLE></HEAD> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> -+<HTML> -+<HEAD> -+<TITLE>terminal_interface-curses-text_io-float_io.adb</TITLE> -+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> -+<style type="text/css"> -+*.comment { -+ color: green; -+} -+*.symbol { -+ color: red; -+} -+</style> -+</HEAD> - <BODY> --<HR><DIV ALIGN="center"><H1> File : terminal_interface-curses-text_io-float_io.adb </H1></DIV><HR> -+<HR><DIV style="text-align:center"><H1> File : terminal_interface-curses-text_io-float_io.adb </H1></DIV><HR> - <PRE> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Terminal_Interface.Curses.Text_IO.Float_IO --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- B O D Y --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Copyright (c) 1998-2003,2009 Free Software Foundation, Inc. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></FONT> --<FONT COLOR=green><EM>-- copy of this software and associated documentation files (the --</EM></FONT> --<FONT COLOR=green><EM>-- "Software"), to deal in the Software without restriction, including --</EM></FONT> --<FONT COLOR=green><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></FONT> --<FONT COLOR=green><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></FONT> --<FONT COLOR=green><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></FONT> --<FONT COLOR=green><EM>-- furnished to do so, subject to the following conditions: --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- The above copyright notice and this permission notice shall be included --</EM></FONT> --<FONT COLOR=green><EM>-- in all copies or substantial portions of the Software. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></FONT> --<FONT COLOR=green><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></FONT> --<FONT COLOR=green><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></FONT> --<FONT COLOR=green><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></FONT> --<FONT COLOR=green><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></FONT> --<FONT COLOR=green><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></FONT> --<FONT COLOR=green><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></FONT> --<FONT COLOR=green><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></FONT> --<FONT COLOR=green><EM>-- sale, use or other dealings in this Software without prior written --</EM></FONT> --<FONT COLOR=green><EM>-- authorization. --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Author: Juergen Pfeifer, 1996</EM></FONT> --<FONT COLOR=green><EM>-- Version Control:</EM></FONT> --<FONT COLOR=green><EM>-- @Revision: 1.11 @</EM></FONT> --<FONT COLOR=green><EM>-- Binding Version 01.00</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Terminal_Interface.Curses.Text_IO.Float_IO --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- B O D Y --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Copyright (c) 1998-2003,2009 Free Software Foundation, Inc. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></span> -+<span class="comment"><EM>-- copy of this software and associated documentation files (the --</EM></span> -+<span class="comment"><EM>-- "Software"), to deal in the Software without restriction, including --</EM></span> -+<span class="comment"><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></span> -+<span class="comment"><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></span> -+<span class="comment"><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></span> -+<span class="comment"><EM>-- furnished to do so, subject to the following conditions: --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- The above copyright notice and this permission notice shall be included --</EM></span> -+<span class="comment"><EM>-- in all copies or substantial portions of the Software. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></span> -+<span class="comment"><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></span> -+<span class="comment"><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></span> -+<span class="comment"><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></span> -+<span class="comment"><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></span> -+<span class="comment"><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></span> -+<span class="comment"><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></span> -+<span class="comment"><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></span> -+<span class="comment"><EM>-- sale, use or other dealings in this Software without prior written --</EM></span> -+<span class="comment"><EM>-- authorization. --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Author: Juergen Pfeifer, 1996</EM></span> -+<span class="comment"><EM>-- Version Control:</EM></span> -+<span class="comment"><EM>-- @Revision: 1.11 @</EM></span> -+<span class="comment"><EM>-- Binding Version 01.00</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> - <b>with</b> Ada.Text_IO; - <b>with</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-text_io__ads.htm#ref_44_35">Text_IO</A>.<A HREF="terminal_interface-curses-text_io-aux__ads.htm#ref_42_51">Aux</A>; - --<b>package</b> <b>body</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-text_io__ads.htm#ref_44_35">Text_IO</A>.<FONT COLOR=red><A NAME="ref_44_48" HREF="terminal_interface-curses-text_io-float_io__ads.htm#ref_44_43">Float_IO</A></FONT> <b>is</b> -+<b>package</b> <b>body</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-text_io__ads.htm#ref_44_35">Text_IO</A>.<span class="symbol"><A NAME="ref_44_48" HREF="terminal_interface-curses-text_io-float_io__ads.htm#ref_44_43">Float_IO</A></span> <b>is</b> - -- <b>package</b> <FONT COLOR=red><A NAME="ref_46_12">Aux</A></FONT> <b>renames</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-text_io__ads.htm#ref_44_35">Text_IO</A>.<A HREF="terminal_interface-curses-text_io-aux__ads.htm#ref_42_51">Aux</A>; -+ <b>package</b> <span class="symbol"><A NAME="ref_46_12">Aux</A></span> <b>renames</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-text_io__ads.htm#ref_44_35">Text_IO</A>.<A HREF="terminal_interface-curses-text_io-aux__ads.htm#ref_42_51">Aux</A>; - <b>package</b> FIO <b>is</b> <b>new</b> Ada.Text_IO.Float_IO (<A HREF="terminal_interface-curses-text_io-float_io__ads.htm#ref_42_9">Num</A>); - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_49_14" HREF="terminal_interface-curses-text_io-float_io__ads.htm#ref_50_14">Put</A></FONT> -- (<FONT COLOR=red><A NAME="ref_50_7" HREF="terminal_interface-curses-text_io-float_io__ads.htm#ref_51_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- <FONT COLOR=red><A NAME="ref_51_7" HREF="terminal_interface-curses-text_io-float_io__ads.htm#ref_52_7">Item</A></FONT> : <A HREF="terminal_interface-curses-text_io-float_io__ads.htm#ref_42_9">Num</A>; -- <FONT COLOR=red><A NAME="ref_52_7" HREF="terminal_interface-curses-text_io-float_io__ads.htm#ref_53_7">Fore</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-float_io__ads.htm#ref_46_4">Default_Fore</A>; -- <FONT COLOR=red><A NAME="ref_53_7" HREF="terminal_interface-curses-text_io-float_io__ads.htm#ref_54_7">Aft</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-float_io__ads.htm#ref_47_4">Default_Aft</A>; -- <FONT COLOR=red><A NAME="ref_54_7" HREF="terminal_interface-curses-text_io-float_io__ads.htm#ref_55_7">Exp</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-float_io__ads.htm#ref_48_4">Default_Exp</A>) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_49_14" HREF="terminal_interface-curses-text_io-float_io__ads.htm#ref_50_14">Put</A></span> -+ (<span class="symbol"><A NAME="ref_50_7" HREF="terminal_interface-curses-text_io-float_io__ads.htm#ref_51_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="symbol"><A NAME="ref_51_7" HREF="terminal_interface-curses-text_io-float_io__ads.htm#ref_52_7">Item</A></span> : <A HREF="terminal_interface-curses-text_io-float_io__ads.htm#ref_42_9">Num</A>; -+ <span class="symbol"><A NAME="ref_52_7" HREF="terminal_interface-curses-text_io-float_io__ads.htm#ref_53_7">Fore</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-float_io__ads.htm#ref_46_4">Default_Fore</A>; -+ <span class="symbol"><A NAME="ref_53_7" HREF="terminal_interface-curses-text_io-float_io__ads.htm#ref_54_7">Aft</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-float_io__ads.htm#ref_47_4">Default_Aft</A>; -+ <span class="symbol"><A NAME="ref_54_7" HREF="terminal_interface-curses-text_io-float_io__ads.htm#ref_55_7">Exp</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-float_io__ads.htm#ref_48_4">Default_Exp</A>) - <b>is</b> -- <FONT COLOR=red><A NAME="ref_56_7">Buf</A></FONT> : String (1 .. <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A>'Last); -- <FONT COLOR=red><A NAME="ref_57_7">Len</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-float_io__ads.htm#ref_53_7">Fore</A> + 1 + <A HREF="terminal_interface-curses-text_io-float_io__ads.htm#ref_54_7">Aft</A>; -+ <span class="symbol"><A NAME="ref_56_7">Buf</A></span> : String (1 .. <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A>'Last); -+ <span class="symbol"><A NAME="ref_57_7">Len</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-float_io__ads.htm#ref_53_7">Fore</A> + 1 + <A HREF="terminal_interface-curses-text_io-float_io__ads.htm#ref_54_7">Aft</A>; - <b>begin</b> - <b>if</b> <A HREF="terminal_interface-curses-text_io-float_io__ads.htm#ref_55_7">Exp</A> &gt; 0 <b>then</b> - <A HREF="terminal_interface-curses-text_io-float_io__adb.htm#ref_57_7">Len</A> := <A HREF="terminal_interface-curses-text_io-float_io__adb.htm#ref_57_7">Len</A> + 1 + <A HREF="terminal_interface-curses-text_io-float_io__ads.htm#ref_55_7">Exp</A>; -@@ -68,11 +80,11 @@ - <A HREF="terminal_interface-curses-text_io-float_io__adb.htm#ref_46_12">Aux</A>.<A HREF="terminal_interface-curses-text_io-aux__ads.htm#ref_48_14">Put_Buf</A> (<A HREF="terminal_interface-curses-text_io-float_io__ads.htm#ref_51_7">Win</A>, <A HREF="terminal_interface-curses-text_io-float_io__adb.htm#ref_56_7">Buf</A>, <A HREF="terminal_interface-curses-text_io-float_io__adb.htm#ref_57_7">Len</A>, False); - <b>end</b> <A HREF="terminal_interface-curses-text_io-float_io__ads.htm#ref_50_14">Put</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_66_14" HREF="terminal_interface-curses-text_io-float_io__ads.htm#ref_57_14">Put</A></FONT> -- (<FONT COLOR=red><A NAME="ref_67_7" HREF="terminal_interface-curses-text_io-float_io__ads.htm#ref_58_7">Item</A></FONT> : <A HREF="terminal_interface-curses-text_io-float_io__ads.htm#ref_42_9">Num</A>; -- <FONT COLOR=red><A NAME="ref_68_7" HREF="terminal_interface-curses-text_io-float_io__ads.htm#ref_59_7">Fore</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-float_io__ads.htm#ref_46_4">Default_Fore</A>; -- <FONT COLOR=red><A NAME="ref_69_7" HREF="terminal_interface-curses-text_io-float_io__ads.htm#ref_60_7">Aft</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-float_io__ads.htm#ref_47_4">Default_Aft</A>; -- <FONT COLOR=red><A NAME="ref_70_7" HREF="terminal_interface-curses-text_io-float_io__ads.htm#ref_61_7">Exp</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-float_io__ads.htm#ref_48_4">Default_Exp</A>) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_66_14" HREF="terminal_interface-curses-text_io-float_io__ads.htm#ref_57_14">Put</A></span> -+ (<span class="symbol"><A NAME="ref_67_7" HREF="terminal_interface-curses-text_io-float_io__ads.htm#ref_58_7">Item</A></span> : <A HREF="terminal_interface-curses-text_io-float_io__ads.htm#ref_42_9">Num</A>; -+ <span class="symbol"><A NAME="ref_68_7" HREF="terminal_interface-curses-text_io-float_io__ads.htm#ref_59_7">Fore</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-float_io__ads.htm#ref_46_4">Default_Fore</A>; -+ <span class="symbol"><A NAME="ref_69_7" HREF="terminal_interface-curses-text_io-float_io__ads.htm#ref_60_7">Aft</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-float_io__ads.htm#ref_47_4">Default_Aft</A>; -+ <span class="symbol"><A NAME="ref_70_7" HREF="terminal_interface-curses-text_io-float_io__ads.htm#ref_61_7">Exp</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-float_io__ads.htm#ref_48_4">Default_Exp</A>) - <b>is</b> - <b>begin</b> - <A HREF="terminal_interface-curses-text_io-float_io__ads.htm#ref_50_14">Put</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_62_13">Get_Window</A>, <A HREF="terminal_interface-curses-text_io-float_io__ads.htm#ref_58_7">Item</A>, <A HREF="terminal_interface-curses-text_io-float_io__ads.htm#ref_59_7">Fore</A>, <A HREF="terminal_interface-curses-text_io-float_io__ads.htm#ref_60_7">Aft</A>, <A HREF="terminal_interface-curses-text_io-float_io__ads.htm#ref_61_7">Exp</A>); -diff -Naur ncurses-5.9/doc/html/ada/terminal_interface-curses-text_io-float_io__ads.htm ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-text_io-float_io__ads.htm ---- ncurses-5.9/doc/html/ada/terminal_interface-curses-text_io-float_io__ads.htm 2010-01-09 21:31:27.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-text_io-float_io__ads.htm 2014-09-01 16:33:22.302792033 +0200 -@@ -1,69 +1,81 @@ --<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> --<HTML><HEAD><TITLE>terminal_interface-curses-text_io-float_io.ads</TITLE></HEAD> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> -+<HTML> -+<HEAD> -+<TITLE>terminal_interface-curses-text_io-float_io.ads</TITLE> -+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> -+<style type="text/css"> -+*.comment { -+ color: green; -+} -+*.symbol { -+ color: red; -+} -+</style> -+</HEAD> - <BODY> --<HR><DIV ALIGN="center"><H1> File : terminal_interface-curses-text_io-float_io.ads </H1></DIV><HR> -+<HR><DIV style="text-align:center"><H1> File : terminal_interface-curses-text_io-float_io.ads </H1></DIV><HR> - <PRE> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Terminal_Interface.Curses.Text_IO.Float_IO --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- S P E C --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Copyright (c) 1998-2003,2009 Free Software Foundation, Inc. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></FONT> --<FONT COLOR=green><EM>-- copy of this software and associated documentation files (the --</EM></FONT> --<FONT COLOR=green><EM>-- "Software"), to deal in the Software without restriction, including --</EM></FONT> --<FONT COLOR=green><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></FONT> --<FONT COLOR=green><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></FONT> --<FONT COLOR=green><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></FONT> --<FONT COLOR=green><EM>-- furnished to do so, subject to the following conditions: --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- The above copyright notice and this permission notice shall be included --</EM></FONT> --<FONT COLOR=green><EM>-- in all copies or substantial portions of the Software. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></FONT> --<FONT COLOR=green><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></FONT> --<FONT COLOR=green><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></FONT> --<FONT COLOR=green><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></FONT> --<FONT COLOR=green><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></FONT> --<FONT COLOR=green><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></FONT> --<FONT COLOR=green><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></FONT> --<FONT COLOR=green><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></FONT> --<FONT COLOR=green><EM>-- sale, use or other dealings in this Software without prior written --</EM></FONT> --<FONT COLOR=green><EM>-- authorization. --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Author: Juergen Pfeifer, 1996</EM></FONT> --<FONT COLOR=green><EM>-- Version Control:</EM></FONT> --<FONT COLOR=green><EM>-- @Revision: 1.12 @</EM></FONT> --<FONT COLOR=green><EM>-- Binding Version 01.00</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Terminal_Interface.Curses.Text_IO.Float_IO --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- S P E C --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Copyright (c) 1998-2003,2009 Free Software Foundation, Inc. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></span> -+<span class="comment"><EM>-- copy of this software and associated documentation files (the --</EM></span> -+<span class="comment"><EM>-- "Software"), to deal in the Software without restriction, including --</EM></span> -+<span class="comment"><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></span> -+<span class="comment"><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></span> -+<span class="comment"><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></span> -+<span class="comment"><EM>-- furnished to do so, subject to the following conditions: --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- The above copyright notice and this permission notice shall be included --</EM></span> -+<span class="comment"><EM>-- in all copies or substantial portions of the Software. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></span> -+<span class="comment"><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></span> -+<span class="comment"><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></span> -+<span class="comment"><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></span> -+<span class="comment"><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></span> -+<span class="comment"><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></span> -+<span class="comment"><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></span> -+<span class="comment"><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></span> -+<span class="comment"><EM>-- sale, use or other dealings in this Software without prior written --</EM></span> -+<span class="comment"><EM>-- authorization. --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Author: Juergen Pfeifer, 1996</EM></span> -+<span class="comment"><EM>-- Version Control:</EM></span> -+<span class="comment"><EM>-- @Revision: 1.12 @</EM></span> -+<span class="comment"><EM>-- Binding Version 01.00</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> - <b>generic</b> -- <b>type</b> <FONT COLOR=red><A NAME="ref_42_9" HREF="terminal_interface-curses-text_io-float_io__ads.htm#ref_44_43">Num</A></FONT> <b>is</b> <b>digits</b> &lt;&gt;; -+ <b>type</b> <span class="symbol"><A NAME="ref_42_9" HREF="terminal_interface-curses-text_io-float_io__ads.htm#ref_44_43">Num</A></span> <b>is</b> <b>digits</b> &lt;&gt;; - --<b>package</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-text_io__ads.htm#ref_44_35">Text_IO</A>.<FONT COLOR=red><A NAME="ref_44_43" HREF="terminal_interface-curses-text_io-float_io__adb.htm#ref_44_48">Float_IO</A></FONT> <b>is</b> -+<b>package</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-text_io__ads.htm#ref_44_35">Text_IO</A>.<span class="symbol"><A NAME="ref_44_43" HREF="terminal_interface-curses-text_io-float_io__adb.htm#ref_44_48">Float_IO</A></span> <b>is</b> - -- <FONT COLOR=red><A NAME="ref_46_4">Default_Fore</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := 2; -- <FONT COLOR=red><A NAME="ref_47_4">Default_Aft</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-float_io__ads.htm#ref_42_9">Num</A>'<b>Digits</b> - 1; -- <FONT COLOR=red><A NAME="ref_48_4">Default_Exp</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := 3; -+ <span class="symbol"><A NAME="ref_46_4">Default_Fore</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := 2; -+ <span class="symbol"><A NAME="ref_47_4">Default_Aft</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-float_io__ads.htm#ref_42_9">Num</A>'<b>Digits</b> - 1; -+ <span class="symbol"><A NAME="ref_48_4">Default_Exp</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := 3; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_50_14" HREF="terminal_interface-curses-text_io-float_io__adb.htm#ref_49_14">Put</A></FONT> -- (<FONT COLOR=red><A NAME="ref_51_7" HREF="terminal_interface-curses-text_io-float_io__adb.htm#ref_50_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- <FONT COLOR=red><A NAME="ref_52_7" HREF="terminal_interface-curses-text_io-float_io__adb.htm#ref_51_7">Item</A></FONT> : <A HREF="terminal_interface-curses-text_io-float_io__ads.htm#ref_42_9">Num</A>; -- <FONT COLOR=red><A NAME="ref_53_7" HREF="terminal_interface-curses-text_io-float_io__adb.htm#ref_52_7">Fore</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-float_io__ads.htm#ref_46_4">Default_Fore</A>; -- <FONT COLOR=red><A NAME="ref_54_7" HREF="terminal_interface-curses-text_io-float_io__adb.htm#ref_53_7">Aft</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-float_io__ads.htm#ref_47_4">Default_Aft</A>; -- <FONT COLOR=red><A NAME="ref_55_7" HREF="terminal_interface-curses-text_io-float_io__adb.htm#ref_54_7">Exp</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-float_io__ads.htm#ref_48_4">Default_Exp</A>); -+ <b>procedure</b> <span class="symbol"><A NAME="ref_50_14" HREF="terminal_interface-curses-text_io-float_io__adb.htm#ref_49_14">Put</A></span> -+ (<span class="symbol"><A NAME="ref_51_7" HREF="terminal_interface-curses-text_io-float_io__adb.htm#ref_50_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="symbol"><A NAME="ref_52_7" HREF="terminal_interface-curses-text_io-float_io__adb.htm#ref_51_7">Item</A></span> : <A HREF="terminal_interface-curses-text_io-float_io__ads.htm#ref_42_9">Num</A>; -+ <span class="symbol"><A NAME="ref_53_7" HREF="terminal_interface-curses-text_io-float_io__adb.htm#ref_52_7">Fore</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-float_io__ads.htm#ref_46_4">Default_Fore</A>; -+ <span class="symbol"><A NAME="ref_54_7" HREF="terminal_interface-curses-text_io-float_io__adb.htm#ref_53_7">Aft</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-float_io__ads.htm#ref_47_4">Default_Aft</A>; -+ <span class="symbol"><A NAME="ref_55_7" HREF="terminal_interface-curses-text_io-float_io__adb.htm#ref_54_7">Exp</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-float_io__ads.htm#ref_48_4">Default_Exp</A>); - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_57_14" HREF="terminal_interface-curses-text_io-float_io__adb.htm#ref_66_14">Put</A></FONT> -- (<FONT COLOR=red><A NAME="ref_58_7" HREF="terminal_interface-curses-text_io-float_io__adb.htm#ref_67_7">Item</A></FONT> : <A HREF="terminal_interface-curses-text_io-float_io__ads.htm#ref_42_9">Num</A>; -- <FONT COLOR=red><A NAME="ref_59_7" HREF="terminal_interface-curses-text_io-float_io__adb.htm#ref_68_7">Fore</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-float_io__ads.htm#ref_46_4">Default_Fore</A>; -- <FONT COLOR=red><A NAME="ref_60_7" HREF="terminal_interface-curses-text_io-float_io__adb.htm#ref_69_7">Aft</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-float_io__ads.htm#ref_47_4">Default_Aft</A>; -- <FONT COLOR=red><A NAME="ref_61_7" HREF="terminal_interface-curses-text_io-float_io__adb.htm#ref_70_7">Exp</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-float_io__ads.htm#ref_48_4">Default_Exp</A>); -+ <b>procedure</b> <span class="symbol"><A NAME="ref_57_14" HREF="terminal_interface-curses-text_io-float_io__adb.htm#ref_66_14">Put</A></span> -+ (<span class="symbol"><A NAME="ref_58_7" HREF="terminal_interface-curses-text_io-float_io__adb.htm#ref_67_7">Item</A></span> : <A HREF="terminal_interface-curses-text_io-float_io__ads.htm#ref_42_9">Num</A>; -+ <span class="symbol"><A NAME="ref_59_7" HREF="terminal_interface-curses-text_io-float_io__adb.htm#ref_68_7">Fore</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-float_io__ads.htm#ref_46_4">Default_Fore</A>; -+ <span class="symbol"><A NAME="ref_60_7" HREF="terminal_interface-curses-text_io-float_io__adb.htm#ref_69_7">Aft</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-float_io__ads.htm#ref_47_4">Default_Aft</A>; -+ <span class="symbol"><A NAME="ref_61_7" HREF="terminal_interface-curses-text_io-float_io__adb.htm#ref_70_7">Exp</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-float_io__ads.htm#ref_48_4">Default_Exp</A>); - - <b>private</b> - <b>pragma</b> Inline (Put); -diff -Naur ncurses-5.9/doc/html/ada/terminal_interface-curses-text_io-integer_io__adb.htm ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-text_io-integer_io__adb.htm ---- ncurses-5.9/doc/html/ada/terminal_interface-curses-text_io-integer_io__adb.htm 2010-01-09 21:31:27.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-text_io-integer_io__adb.htm 2014-09-01 16:33:22.302792033 +0200 -@@ -1,72 +1,84 @@ --<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> --<HTML><HEAD><TITLE>terminal_interface-curses-text_io-integer_io.adb</TITLE></HEAD> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> -+<HTML> -+<HEAD> -+<TITLE>terminal_interface-curses-text_io-integer_io.adb</TITLE> -+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> -+<style type="text/css"> -+*.comment { -+ color: green; -+} -+*.symbol { -+ color: red; -+} -+</style> -+</HEAD> - <BODY> --<HR><DIV ALIGN="center"><H1> File : terminal_interface-curses-text_io-integer_io.adb </H1></DIV><HR> -+<HR><DIV style="text-align:center"><H1> File : terminal_interface-curses-text_io-integer_io.adb </H1></DIV><HR> - <PRE> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Terminal_Interface.Curses.Text_IO.Integer_IO --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- B O D Y --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Copyright (c) 1998-2003,2009 Free Software Foundation, Inc. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></FONT> --<FONT COLOR=green><EM>-- copy of this software and associated documentation files (the --</EM></FONT> --<FONT COLOR=green><EM>-- "Software"), to deal in the Software without restriction, including --</EM></FONT> --<FONT COLOR=green><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></FONT> --<FONT COLOR=green><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></FONT> --<FONT COLOR=green><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></FONT> --<FONT COLOR=green><EM>-- furnished to do so, subject to the following conditions: --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- The above copyright notice and this permission notice shall be included --</EM></FONT> --<FONT COLOR=green><EM>-- in all copies or substantial portions of the Software. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></FONT> --<FONT COLOR=green><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></FONT> --<FONT COLOR=green><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></FONT> --<FONT COLOR=green><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></FONT> --<FONT COLOR=green><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></FONT> --<FONT COLOR=green><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></FONT> --<FONT COLOR=green><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></FONT> --<FONT COLOR=green><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></FONT> --<FONT COLOR=green><EM>-- sale, use or other dealings in this Software without prior written --</EM></FONT> --<FONT COLOR=green><EM>-- authorization. --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Author: Juergen Pfeifer, 1996</EM></FONT> --<FONT COLOR=green><EM>-- Version Control:</EM></FONT> --<FONT COLOR=green><EM>-- @Revision: 1.11 @</EM></FONT> --<FONT COLOR=green><EM>-- Binding Version 01.00</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Terminal_Interface.Curses.Text_IO.Integer_IO --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- B O D Y --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Copyright (c) 1998-2003,2009 Free Software Foundation, Inc. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></span> -+<span class="comment"><EM>-- copy of this software and associated documentation files (the --</EM></span> -+<span class="comment"><EM>-- "Software"), to deal in the Software without restriction, including --</EM></span> -+<span class="comment"><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></span> -+<span class="comment"><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></span> -+<span class="comment"><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></span> -+<span class="comment"><EM>-- furnished to do so, subject to the following conditions: --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- The above copyright notice and this permission notice shall be included --</EM></span> -+<span class="comment"><EM>-- in all copies or substantial portions of the Software. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></span> -+<span class="comment"><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></span> -+<span class="comment"><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></span> -+<span class="comment"><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></span> -+<span class="comment"><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></span> -+<span class="comment"><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></span> -+<span class="comment"><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></span> -+<span class="comment"><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></span> -+<span class="comment"><EM>-- sale, use or other dealings in this Software without prior written --</EM></span> -+<span class="comment"><EM>-- authorization. --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Author: Juergen Pfeifer, 1996</EM></span> -+<span class="comment"><EM>-- Version Control:</EM></span> -+<span class="comment"><EM>-- @Revision: 1.11 @</EM></span> -+<span class="comment"><EM>-- Binding Version 01.00</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> - <b>with</b> Ada.Text_IO; - <b>with</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-text_io__ads.htm#ref_44_35">Text_IO</A>.<A HREF="terminal_interface-curses-text_io-aux__ads.htm#ref_42_51">Aux</A>; - --<b>package</b> <b>body</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-text_io__ads.htm#ref_44_35">Text_IO</A>.<FONT COLOR=red><A NAME="ref_44_48" HREF="terminal_interface-curses-text_io-integer_io__ads.htm#ref_44_43">Integer_IO</A></FONT> <b>is</b> -+<b>package</b> <b>body</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-text_io__ads.htm#ref_44_35">Text_IO</A>.<span class="symbol"><A NAME="ref_44_48" HREF="terminal_interface-curses-text_io-integer_io__ads.htm#ref_44_43">Integer_IO</A></span> <b>is</b> - -- <b>package</b> <FONT COLOR=red><A NAME="ref_46_12">Aux</A></FONT> <b>renames</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-text_io__ads.htm#ref_44_35">Text_IO</A>.<A HREF="terminal_interface-curses-text_io-aux__ads.htm#ref_42_51">Aux</A>; -+ <b>package</b> <span class="symbol"><A NAME="ref_46_12">Aux</A></span> <b>renames</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-text_io__ads.htm#ref_44_35">Text_IO</A>.<A HREF="terminal_interface-curses-text_io-aux__ads.htm#ref_42_51">Aux</A>; - <b>package</b> IIO <b>is</b> <b>new</b> Ada.Text_IO.Integer_IO (<A HREF="terminal_interface-curses-text_io-integer_io__ads.htm#ref_42_9">Num</A>); - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_49_14" HREF="terminal_interface-curses-text_io-integer_io__ads.htm#ref_49_14">Put</A></FONT> -- (<FONT COLOR=red><A NAME="ref_50_7" HREF="terminal_interface-curses-text_io-integer_io__ads.htm#ref_50_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- <FONT COLOR=red><A NAME="ref_51_7" HREF="terminal_interface-curses-text_io-integer_io__ads.htm#ref_51_7">Item</A></FONT> : <A HREF="terminal_interface-curses-text_io-integer_io__ads.htm#ref_42_9">Num</A>; -- <FONT COLOR=red><A NAME="ref_52_7" HREF="terminal_interface-curses-text_io-integer_io__ads.htm#ref_52_7">Width</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-integer_io__ads.htm#ref_46_4">Default_Width</A>; -- <FONT COLOR=red><A NAME="ref_53_7" HREF="terminal_interface-curses-text_io-integer_io__ads.htm#ref_53_7">Base</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_51_12">Number_Base</A> := <A HREF="terminal_interface-curses-text_io-integer_io__ads.htm#ref_47_4">Default_Base</A>) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_49_14" HREF="terminal_interface-curses-text_io-integer_io__ads.htm#ref_49_14">Put</A></span> -+ (<span class="symbol"><A NAME="ref_50_7" HREF="terminal_interface-curses-text_io-integer_io__ads.htm#ref_50_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="symbol"><A NAME="ref_51_7" HREF="terminal_interface-curses-text_io-integer_io__ads.htm#ref_51_7">Item</A></span> : <A HREF="terminal_interface-curses-text_io-integer_io__ads.htm#ref_42_9">Num</A>; -+ <span class="symbol"><A NAME="ref_52_7" HREF="terminal_interface-curses-text_io-integer_io__ads.htm#ref_52_7">Width</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-integer_io__ads.htm#ref_46_4">Default_Width</A>; -+ <span class="symbol"><A NAME="ref_53_7" HREF="terminal_interface-curses-text_io-integer_io__ads.htm#ref_53_7">Base</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_51_12">Number_Base</A> := <A HREF="terminal_interface-curses-text_io-integer_io__ads.htm#ref_47_4">Default_Base</A>) - <b>is</b> -- <FONT COLOR=red><A NAME="ref_55_7">Buf</A></FONT> : String (1 .. <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A>'Last); -+ <span class="symbol"><A NAME="ref_55_7">Buf</A></span> : String (1 .. <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A>'Last); - <b>begin</b> - IIO.Put (<A HREF="terminal_interface-curses-text_io-integer_io__adb.htm#ref_55_7">Buf</A>, <A HREF="terminal_interface-curses-text_io-integer_io__ads.htm#ref_51_7">Item</A>, <A HREF="terminal_interface-curses-text_io-integer_io__ads.htm#ref_53_7">Base</A>); - <A HREF="terminal_interface-curses-text_io-integer_io__adb.htm#ref_46_12">Aux</A>.<A HREF="terminal_interface-curses-text_io-aux__ads.htm#ref_48_14">Put_Buf</A> (<A HREF="terminal_interface-curses-text_io-integer_io__ads.htm#ref_50_7">Win</A>, <A HREF="terminal_interface-curses-text_io-integer_io__adb.htm#ref_55_7">Buf</A>, <A HREF="terminal_interface-curses-text_io-integer_io__ads.htm#ref_52_7">Width</A>); - <b>end</b> <A HREF="terminal_interface-curses-text_io-integer_io__ads.htm#ref_49_14">Put</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_61_14" HREF="terminal_interface-curses-text_io-integer_io__ads.htm#ref_55_14">Put</A></FONT> -- (<FONT COLOR=red><A NAME="ref_62_7" HREF="terminal_interface-curses-text_io-integer_io__ads.htm#ref_56_7">Item</A></FONT> : <A HREF="terminal_interface-curses-text_io-integer_io__ads.htm#ref_42_9">Num</A>; -- <FONT COLOR=red><A NAME="ref_63_7" HREF="terminal_interface-curses-text_io-integer_io__ads.htm#ref_57_7">Width</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-integer_io__ads.htm#ref_46_4">Default_Width</A>; -- <FONT COLOR=red><A NAME="ref_64_7" HREF="terminal_interface-curses-text_io-integer_io__ads.htm#ref_58_7">Base</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_51_12">Number_Base</A> := <A HREF="terminal_interface-curses-text_io-integer_io__ads.htm#ref_47_4">Default_Base</A>) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_61_14" HREF="terminal_interface-curses-text_io-integer_io__ads.htm#ref_55_14">Put</A></span> -+ (<span class="symbol"><A NAME="ref_62_7" HREF="terminal_interface-curses-text_io-integer_io__ads.htm#ref_56_7">Item</A></span> : <A HREF="terminal_interface-curses-text_io-integer_io__ads.htm#ref_42_9">Num</A>; -+ <span class="symbol"><A NAME="ref_63_7" HREF="terminal_interface-curses-text_io-integer_io__ads.htm#ref_57_7">Width</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-integer_io__ads.htm#ref_46_4">Default_Width</A>; -+ <span class="symbol"><A NAME="ref_64_7" HREF="terminal_interface-curses-text_io-integer_io__ads.htm#ref_58_7">Base</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_51_12">Number_Base</A> := <A HREF="terminal_interface-curses-text_io-integer_io__ads.htm#ref_47_4">Default_Base</A>) - <b>is</b> - <b>begin</b> - <A HREF="terminal_interface-curses-text_io-integer_io__ads.htm#ref_49_14">Put</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_62_13">Get_Window</A>, <A HREF="terminal_interface-curses-text_io-integer_io__ads.htm#ref_56_7">Item</A>, <A HREF="terminal_interface-curses-text_io-integer_io__ads.htm#ref_57_7">Width</A>, <A HREF="terminal_interface-curses-text_io-integer_io__ads.htm#ref_58_7">Base</A>); -diff -Naur ncurses-5.9/doc/html/ada/terminal_interface-curses-text_io-integer_io__ads.htm ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-text_io-integer_io__ads.htm ---- ncurses-5.9/doc/html/ada/terminal_interface-curses-text_io-integer_io__ads.htm 2010-01-09 21:31:27.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-text_io-integer_io__ads.htm 2014-09-01 16:33:22.302792033 +0200 -@@ -1,66 +1,78 @@ --<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> --<HTML><HEAD><TITLE>terminal_interface-curses-text_io-integer_io.ads</TITLE></HEAD> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> -+<HTML> -+<HEAD> -+<TITLE>terminal_interface-curses-text_io-integer_io.ads</TITLE> -+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> -+<style type="text/css"> -+*.comment { -+ color: green; -+} -+*.symbol { -+ color: red; -+} -+</style> -+</HEAD> - <BODY> --<HR><DIV ALIGN="center"><H1> File : terminal_interface-curses-text_io-integer_io.ads </H1></DIV><HR> -+<HR><DIV style="text-align:center"><H1> File : terminal_interface-curses-text_io-integer_io.ads </H1></DIV><HR> - <PRE> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Terminal_Interface.Curses.Text_IO.Integer_IO --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- S P E C --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Copyright (c) 1998-2003,2009 Free Software Foundation, Inc. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></FONT> --<FONT COLOR=green><EM>-- copy of this software and associated documentation files (the --</EM></FONT> --<FONT COLOR=green><EM>-- "Software"), to deal in the Software without restriction, including --</EM></FONT> --<FONT COLOR=green><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></FONT> --<FONT COLOR=green><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></FONT> --<FONT COLOR=green><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></FONT> --<FONT COLOR=green><EM>-- furnished to do so, subject to the following conditions: --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- The above copyright notice and this permission notice shall be included --</EM></FONT> --<FONT COLOR=green><EM>-- in all copies or substantial portions of the Software. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></FONT> --<FONT COLOR=green><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></FONT> --<FONT COLOR=green><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></FONT> --<FONT COLOR=green><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></FONT> --<FONT COLOR=green><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></FONT> --<FONT COLOR=green><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></FONT> --<FONT COLOR=green><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></FONT> --<FONT COLOR=green><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></FONT> --<FONT COLOR=green><EM>-- sale, use or other dealings in this Software without prior written --</EM></FONT> --<FONT COLOR=green><EM>-- authorization. --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Author: Juergen Pfeifer, 1996</EM></FONT> --<FONT COLOR=green><EM>-- Version Control:</EM></FONT> --<FONT COLOR=green><EM>-- @Revision: 1.12 @</EM></FONT> --<FONT COLOR=green><EM>-- Binding Version 01.00</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Terminal_Interface.Curses.Text_IO.Integer_IO --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- S P E C --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Copyright (c) 1998-2003,2009 Free Software Foundation, Inc. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></span> -+<span class="comment"><EM>-- copy of this software and associated documentation files (the --</EM></span> -+<span class="comment"><EM>-- "Software"), to deal in the Software without restriction, including --</EM></span> -+<span class="comment"><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></span> -+<span class="comment"><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></span> -+<span class="comment"><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></span> -+<span class="comment"><EM>-- furnished to do so, subject to the following conditions: --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- The above copyright notice and this permission notice shall be included --</EM></span> -+<span class="comment"><EM>-- in all copies or substantial portions of the Software. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></span> -+<span class="comment"><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></span> -+<span class="comment"><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></span> -+<span class="comment"><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></span> -+<span class="comment"><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></span> -+<span class="comment"><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></span> -+<span class="comment"><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></span> -+<span class="comment"><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></span> -+<span class="comment"><EM>-- sale, use or other dealings in this Software without prior written --</EM></span> -+<span class="comment"><EM>-- authorization. --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Author: Juergen Pfeifer, 1996</EM></span> -+<span class="comment"><EM>-- Version Control:</EM></span> -+<span class="comment"><EM>-- @Revision: 1.12 @</EM></span> -+<span class="comment"><EM>-- Binding Version 01.00</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> - <b>generic</b> -- <b>type</b> <FONT COLOR=red><A NAME="ref_42_9" HREF="terminal_interface-curses-text_io-integer_io__ads.htm#ref_44_43">Num</A></FONT> <b>is</b> <b>range</b> &lt;&gt;; -+ <b>type</b> <span class="symbol"><A NAME="ref_42_9" HREF="terminal_interface-curses-text_io-integer_io__ads.htm#ref_44_43">Num</A></span> <b>is</b> <b>range</b> &lt;&gt;; - --<b>package</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-text_io__ads.htm#ref_44_35">Text_IO</A>.<FONT COLOR=red><A NAME="ref_44_43" HREF="terminal_interface-curses-text_io-integer_io__adb.htm#ref_44_48">Integer_IO</A></FONT> <b>is</b> -+<b>package</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-text_io__ads.htm#ref_44_35">Text_IO</A>.<span class="symbol"><A NAME="ref_44_43" HREF="terminal_interface-curses-text_io-integer_io__adb.htm#ref_44_48">Integer_IO</A></span> <b>is</b> - -- <FONT COLOR=red><A NAME="ref_46_4">Default_Width</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-integer_io__ads.htm#ref_42_9">Num</A>'Width; -- <FONT COLOR=red><A NAME="ref_47_4">Default_Base</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_51_12">Number_Base</A> := 10; -+ <span class="symbol"><A NAME="ref_46_4">Default_Width</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-integer_io__ads.htm#ref_42_9">Num</A>'Width; -+ <span class="symbol"><A NAME="ref_47_4">Default_Base</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_51_12">Number_Base</A> := 10; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_49_14" HREF="terminal_interface-curses-text_io-integer_io__adb.htm#ref_49_14">Put</A></FONT> -- (<FONT COLOR=red><A NAME="ref_50_7" HREF="terminal_interface-curses-text_io-integer_io__adb.htm#ref_50_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- <FONT COLOR=red><A NAME="ref_51_7" HREF="terminal_interface-curses-text_io-integer_io__adb.htm#ref_51_7">Item</A></FONT> : <A HREF="terminal_interface-curses-text_io-integer_io__ads.htm#ref_42_9">Num</A>; -- <FONT COLOR=red><A NAME="ref_52_7" HREF="terminal_interface-curses-text_io-integer_io__adb.htm#ref_52_7">Width</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-integer_io__ads.htm#ref_46_4">Default_Width</A>; -- <FONT COLOR=red><A NAME="ref_53_7" HREF="terminal_interface-curses-text_io-integer_io__adb.htm#ref_53_7">Base</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_51_12">Number_Base</A> := <A HREF="terminal_interface-curses-text_io-integer_io__ads.htm#ref_47_4">Default_Base</A>); -+ <b>procedure</b> <span class="symbol"><A NAME="ref_49_14" HREF="terminal_interface-curses-text_io-integer_io__adb.htm#ref_49_14">Put</A></span> -+ (<span class="symbol"><A NAME="ref_50_7" HREF="terminal_interface-curses-text_io-integer_io__adb.htm#ref_50_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="symbol"><A NAME="ref_51_7" HREF="terminal_interface-curses-text_io-integer_io__adb.htm#ref_51_7">Item</A></span> : <A HREF="terminal_interface-curses-text_io-integer_io__ads.htm#ref_42_9">Num</A>; -+ <span class="symbol"><A NAME="ref_52_7" HREF="terminal_interface-curses-text_io-integer_io__adb.htm#ref_52_7">Width</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-integer_io__ads.htm#ref_46_4">Default_Width</A>; -+ <span class="symbol"><A NAME="ref_53_7" HREF="terminal_interface-curses-text_io-integer_io__adb.htm#ref_53_7">Base</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_51_12">Number_Base</A> := <A HREF="terminal_interface-curses-text_io-integer_io__ads.htm#ref_47_4">Default_Base</A>); - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_55_14" HREF="terminal_interface-curses-text_io-integer_io__adb.htm#ref_61_14">Put</A></FONT> -- (<FONT COLOR=red><A NAME="ref_56_7" HREF="terminal_interface-curses-text_io-integer_io__adb.htm#ref_62_7">Item</A></FONT> : <A HREF="terminal_interface-curses-text_io-integer_io__ads.htm#ref_42_9">Num</A>; -- <FONT COLOR=red><A NAME="ref_57_7" HREF="terminal_interface-curses-text_io-integer_io__adb.htm#ref_63_7">Width</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-integer_io__ads.htm#ref_46_4">Default_Width</A>; -- <FONT COLOR=red><A NAME="ref_58_7" HREF="terminal_interface-curses-text_io-integer_io__adb.htm#ref_64_7">Base</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_51_12">Number_Base</A> := <A HREF="terminal_interface-curses-text_io-integer_io__ads.htm#ref_47_4">Default_Base</A>); -+ <b>procedure</b> <span class="symbol"><A NAME="ref_55_14" HREF="terminal_interface-curses-text_io-integer_io__adb.htm#ref_61_14">Put</A></span> -+ (<span class="symbol"><A NAME="ref_56_7" HREF="terminal_interface-curses-text_io-integer_io__adb.htm#ref_62_7">Item</A></span> : <A HREF="terminal_interface-curses-text_io-integer_io__ads.htm#ref_42_9">Num</A>; -+ <span class="symbol"><A NAME="ref_57_7" HREF="terminal_interface-curses-text_io-integer_io__adb.htm#ref_63_7">Width</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-integer_io__ads.htm#ref_46_4">Default_Width</A>; -+ <span class="symbol"><A NAME="ref_58_7" HREF="terminal_interface-curses-text_io-integer_io__adb.htm#ref_64_7">Base</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_51_12">Number_Base</A> := <A HREF="terminal_interface-curses-text_io-integer_io__ads.htm#ref_47_4">Default_Base</A>); - - <b>private</b> - <b>pragma</b> Inline (Put); -diff -Naur ncurses-5.9/doc/html/ada/terminal_interface-curses-text_io-modular_io__adb.htm ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-text_io-modular_io__adb.htm ---- ncurses-5.9/doc/html/ada/terminal_interface-curses-text_io-modular_io__adb.htm 2010-01-09 21:31:27.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-text_io-modular_io__adb.htm 2014-09-01 16:33:22.303792034 +0200 -@@ -1,72 +1,84 @@ --<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> --<HTML><HEAD><TITLE>terminal_interface-curses-text_io-modular_io.adb</TITLE></HEAD> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> -+<HTML> -+<HEAD> -+<TITLE>terminal_interface-curses-text_io-modular_io.adb</TITLE> -+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> -+<style type="text/css"> -+*.comment { -+ color: green; -+} -+*.symbol { -+ color: red; -+} -+</style> -+</HEAD> - <BODY> --<HR><DIV ALIGN="center"><H1> File : terminal_interface-curses-text_io-modular_io.adb </H1></DIV><HR> -+<HR><DIV style="text-align:center"><H1> File : terminal_interface-curses-text_io-modular_io.adb </H1></DIV><HR> - <PRE> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Terminal_Interface.Curses.Text_IO.Modular_IO --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- B O D Y --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Copyright (c) 1998-2003,2009 Free Software Foundation, Inc. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></FONT> --<FONT COLOR=green><EM>-- copy of this software and associated documentation files (the --</EM></FONT> --<FONT COLOR=green><EM>-- "Software"), to deal in the Software without restriction, including --</EM></FONT> --<FONT COLOR=green><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></FONT> --<FONT COLOR=green><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></FONT> --<FONT COLOR=green><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></FONT> --<FONT COLOR=green><EM>-- furnished to do so, subject to the following conditions: --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- The above copyright notice and this permission notice shall be included --</EM></FONT> --<FONT COLOR=green><EM>-- in all copies or substantial portions of the Software. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></FONT> --<FONT COLOR=green><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></FONT> --<FONT COLOR=green><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></FONT> --<FONT COLOR=green><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></FONT> --<FONT COLOR=green><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></FONT> --<FONT COLOR=green><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></FONT> --<FONT COLOR=green><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></FONT> --<FONT COLOR=green><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></FONT> --<FONT COLOR=green><EM>-- sale, use or other dealings in this Software without prior written --</EM></FONT> --<FONT COLOR=green><EM>-- authorization. --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Author: Juergen Pfeifer, 1996</EM></FONT> --<FONT COLOR=green><EM>-- Version Control:</EM></FONT> --<FONT COLOR=green><EM>-- @Revision: 1.11 @</EM></FONT> --<FONT COLOR=green><EM>-- Binding Version 01.00</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Terminal_Interface.Curses.Text_IO.Modular_IO --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- B O D Y --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Copyright (c) 1998-2003,2009 Free Software Foundation, Inc. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></span> -+<span class="comment"><EM>-- copy of this software and associated documentation files (the --</EM></span> -+<span class="comment"><EM>-- "Software"), to deal in the Software without restriction, including --</EM></span> -+<span class="comment"><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></span> -+<span class="comment"><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></span> -+<span class="comment"><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></span> -+<span class="comment"><EM>-- furnished to do so, subject to the following conditions: --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- The above copyright notice and this permission notice shall be included --</EM></span> -+<span class="comment"><EM>-- in all copies or substantial portions of the Software. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></span> -+<span class="comment"><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></span> -+<span class="comment"><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></span> -+<span class="comment"><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></span> -+<span class="comment"><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></span> -+<span class="comment"><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></span> -+<span class="comment"><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></span> -+<span class="comment"><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></span> -+<span class="comment"><EM>-- sale, use or other dealings in this Software without prior written --</EM></span> -+<span class="comment"><EM>-- authorization. --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Author: Juergen Pfeifer, 1996</EM></span> -+<span class="comment"><EM>-- Version Control:</EM></span> -+<span class="comment"><EM>-- @Revision: 1.11 @</EM></span> -+<span class="comment"><EM>-- Binding Version 01.00</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> - <b>with</b> Ada.Text_IO; - <b>with</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-text_io__ads.htm#ref_44_35">Text_IO</A>.<A HREF="terminal_interface-curses-text_io-aux__ads.htm#ref_42_51">Aux</A>; - --<b>package</b> <b>body</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-text_io__ads.htm#ref_44_35">Text_IO</A>.<FONT COLOR=red><A NAME="ref_44_48" HREF="terminal_interface-curses-text_io-modular_io__ads.htm#ref_44_43">Modular_IO</A></FONT> <b>is</b> -+<b>package</b> <b>body</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-text_io__ads.htm#ref_44_35">Text_IO</A>.<span class="symbol"><A NAME="ref_44_48" HREF="terminal_interface-curses-text_io-modular_io__ads.htm#ref_44_43">Modular_IO</A></span> <b>is</b> - -- <b>package</b> <FONT COLOR=red><A NAME="ref_46_12">Aux</A></FONT> <b>renames</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-text_io__ads.htm#ref_44_35">Text_IO</A>.<A HREF="terminal_interface-curses-text_io-aux__ads.htm#ref_42_51">Aux</A>; -+ <b>package</b> <span class="symbol"><A NAME="ref_46_12">Aux</A></span> <b>renames</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-text_io__ads.htm#ref_44_35">Text_IO</A>.<A HREF="terminal_interface-curses-text_io-aux__ads.htm#ref_42_51">Aux</A>; - <b>package</b> MIO <b>is</b> <b>new</b> Ada.Text_IO.Modular_IO (<A HREF="terminal_interface-curses-text_io-modular_io__ads.htm#ref_42_9">Num</A>); - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_49_14" HREF="terminal_interface-curses-text_io-modular_io__ads.htm#ref_49_14">Put</A></FONT> -- (<FONT COLOR=red><A NAME="ref_50_7" HREF="terminal_interface-curses-text_io-modular_io__ads.htm#ref_50_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- <FONT COLOR=red><A NAME="ref_51_7" HREF="terminal_interface-curses-text_io-modular_io__ads.htm#ref_51_7">Item</A></FONT> : <A HREF="terminal_interface-curses-text_io-modular_io__ads.htm#ref_42_9">Num</A>; -- <FONT COLOR=red><A NAME="ref_52_7" HREF="terminal_interface-curses-text_io-modular_io__ads.htm#ref_52_7">Width</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-modular_io__ads.htm#ref_46_4">Default_Width</A>; -- <FONT COLOR=red><A NAME="ref_53_7" HREF="terminal_interface-curses-text_io-modular_io__ads.htm#ref_53_7">Base</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_51_12">Number_Base</A> := <A HREF="terminal_interface-curses-text_io-modular_io__ads.htm#ref_47_4">Default_Base</A>) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_49_14" HREF="terminal_interface-curses-text_io-modular_io__ads.htm#ref_49_14">Put</A></span> -+ (<span class="symbol"><A NAME="ref_50_7" HREF="terminal_interface-curses-text_io-modular_io__ads.htm#ref_50_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="symbol"><A NAME="ref_51_7" HREF="terminal_interface-curses-text_io-modular_io__ads.htm#ref_51_7">Item</A></span> : <A HREF="terminal_interface-curses-text_io-modular_io__ads.htm#ref_42_9">Num</A>; -+ <span class="symbol"><A NAME="ref_52_7" HREF="terminal_interface-curses-text_io-modular_io__ads.htm#ref_52_7">Width</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-modular_io__ads.htm#ref_46_4">Default_Width</A>; -+ <span class="symbol"><A NAME="ref_53_7" HREF="terminal_interface-curses-text_io-modular_io__ads.htm#ref_53_7">Base</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_51_12">Number_Base</A> := <A HREF="terminal_interface-curses-text_io-modular_io__ads.htm#ref_47_4">Default_Base</A>) - <b>is</b> -- <FONT COLOR=red><A NAME="ref_55_7">Buf</A></FONT> : String (1 .. <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A>'Last); -+ <span class="symbol"><A NAME="ref_55_7">Buf</A></span> : String (1 .. <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A>'Last); - <b>begin</b> - MIO.Put (<A HREF="terminal_interface-curses-text_io-modular_io__adb.htm#ref_55_7">Buf</A>, <A HREF="terminal_interface-curses-text_io-modular_io__ads.htm#ref_51_7">Item</A>, <A HREF="terminal_interface-curses-text_io-modular_io__ads.htm#ref_53_7">Base</A>); - <A HREF="terminal_interface-curses-text_io-modular_io__adb.htm#ref_46_12">Aux</A>.<A HREF="terminal_interface-curses-text_io-aux__ads.htm#ref_48_14">Put_Buf</A> (<A HREF="terminal_interface-curses-text_io-modular_io__ads.htm#ref_50_7">Win</A>, <A HREF="terminal_interface-curses-text_io-modular_io__adb.htm#ref_55_7">Buf</A>, <A HREF="terminal_interface-curses-text_io-modular_io__ads.htm#ref_52_7">Width</A>); - <b>end</b> <A HREF="terminal_interface-curses-text_io-modular_io__ads.htm#ref_49_14">Put</A>; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_61_14" HREF="terminal_interface-curses-text_io-modular_io__ads.htm#ref_55_14">Put</A></FONT> -- (<FONT COLOR=red><A NAME="ref_62_7" HREF="terminal_interface-curses-text_io-modular_io__ads.htm#ref_56_7">Item</A></FONT> : <A HREF="terminal_interface-curses-text_io-modular_io__ads.htm#ref_42_9">Num</A>; -- <FONT COLOR=red><A NAME="ref_63_7" HREF="terminal_interface-curses-text_io-modular_io__ads.htm#ref_57_7">Width</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-modular_io__ads.htm#ref_46_4">Default_Width</A>; -- <FONT COLOR=red><A NAME="ref_64_7" HREF="terminal_interface-curses-text_io-modular_io__ads.htm#ref_58_7">Base</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_51_12">Number_Base</A> := <A HREF="terminal_interface-curses-text_io-modular_io__ads.htm#ref_47_4">Default_Base</A>) -+ <b>procedure</b> <span class="symbol"><A NAME="ref_61_14" HREF="terminal_interface-curses-text_io-modular_io__ads.htm#ref_55_14">Put</A></span> -+ (<span class="symbol"><A NAME="ref_62_7" HREF="terminal_interface-curses-text_io-modular_io__ads.htm#ref_56_7">Item</A></span> : <A HREF="terminal_interface-curses-text_io-modular_io__ads.htm#ref_42_9">Num</A>; -+ <span class="symbol"><A NAME="ref_63_7" HREF="terminal_interface-curses-text_io-modular_io__ads.htm#ref_57_7">Width</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-modular_io__ads.htm#ref_46_4">Default_Width</A>; -+ <span class="symbol"><A NAME="ref_64_7" HREF="terminal_interface-curses-text_io-modular_io__ads.htm#ref_58_7">Base</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_51_12">Number_Base</A> := <A HREF="terminal_interface-curses-text_io-modular_io__ads.htm#ref_47_4">Default_Base</A>) - <b>is</b> - <b>begin</b> - <A HREF="terminal_interface-curses-text_io-modular_io__ads.htm#ref_49_14">Put</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_62_13">Get_Window</A>, <A HREF="terminal_interface-curses-text_io-modular_io__ads.htm#ref_56_7">Item</A>, <A HREF="terminal_interface-curses-text_io-modular_io__ads.htm#ref_57_7">Width</A>, <A HREF="terminal_interface-curses-text_io-modular_io__ads.htm#ref_58_7">Base</A>); -diff -Naur ncurses-5.9/doc/html/ada/terminal_interface-curses-text_io-modular_io__ads.htm ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-text_io-modular_io__ads.htm ---- ncurses-5.9/doc/html/ada/terminal_interface-curses-text_io-modular_io__ads.htm 2010-01-09 21:31:27.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-text_io-modular_io__ads.htm 2014-09-01 16:33:22.303792034 +0200 -@@ -1,66 +1,78 @@ --<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> --<HTML><HEAD><TITLE>terminal_interface-curses-text_io-modular_io.ads</TITLE></HEAD> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> -+<HTML> -+<HEAD> -+<TITLE>terminal_interface-curses-text_io-modular_io.ads</TITLE> -+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> -+<style type="text/css"> -+*.comment { -+ color: green; -+} -+*.symbol { -+ color: red; -+} -+</style> -+</HEAD> - <BODY> --<HR><DIV ALIGN="center"><H1> File : terminal_interface-curses-text_io-modular_io.ads </H1></DIV><HR> -+<HR><DIV style="text-align:center"><H1> File : terminal_interface-curses-text_io-modular_io.ads </H1></DIV><HR> - <PRE> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Terminal_Interface.Curses.Text_IO.Modular_IO --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- S P E C --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Copyright (c) 1998-2003,2009 Free Software Foundation, Inc. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></FONT> --<FONT COLOR=green><EM>-- copy of this software and associated documentation files (the --</EM></FONT> --<FONT COLOR=green><EM>-- "Software"), to deal in the Software without restriction, including --</EM></FONT> --<FONT COLOR=green><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></FONT> --<FONT COLOR=green><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></FONT> --<FONT COLOR=green><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></FONT> --<FONT COLOR=green><EM>-- furnished to do so, subject to the following conditions: --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- The above copyright notice and this permission notice shall be included --</EM></FONT> --<FONT COLOR=green><EM>-- in all copies or substantial portions of the Software. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></FONT> --<FONT COLOR=green><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></FONT> --<FONT COLOR=green><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></FONT> --<FONT COLOR=green><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></FONT> --<FONT COLOR=green><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></FONT> --<FONT COLOR=green><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></FONT> --<FONT COLOR=green><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></FONT> --<FONT COLOR=green><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></FONT> --<FONT COLOR=green><EM>-- sale, use or other dealings in this Software without prior written --</EM></FONT> --<FONT COLOR=green><EM>-- authorization. --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Author: Juergen Pfeifer, 1996</EM></FONT> --<FONT COLOR=green><EM>-- Version Control:</EM></FONT> --<FONT COLOR=green><EM>-- @Revision: 1.12 @</EM></FONT> --<FONT COLOR=green><EM>-- Binding Version 01.00</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Terminal_Interface.Curses.Text_IO.Modular_IO --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- S P E C --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Copyright (c) 1998-2003,2009 Free Software Foundation, Inc. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></span> -+<span class="comment"><EM>-- copy of this software and associated documentation files (the --</EM></span> -+<span class="comment"><EM>-- "Software"), to deal in the Software without restriction, including --</EM></span> -+<span class="comment"><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></span> -+<span class="comment"><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></span> -+<span class="comment"><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></span> -+<span class="comment"><EM>-- furnished to do so, subject to the following conditions: --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- The above copyright notice and this permission notice shall be included --</EM></span> -+<span class="comment"><EM>-- in all copies or substantial portions of the Software. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></span> -+<span class="comment"><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></span> -+<span class="comment"><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></span> -+<span class="comment"><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></span> -+<span class="comment"><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></span> -+<span class="comment"><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></span> -+<span class="comment"><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></span> -+<span class="comment"><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></span> -+<span class="comment"><EM>-- sale, use or other dealings in this Software without prior written --</EM></span> -+<span class="comment"><EM>-- authorization. --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Author: Juergen Pfeifer, 1996</EM></span> -+<span class="comment"><EM>-- Version Control:</EM></span> -+<span class="comment"><EM>-- @Revision: 1.12 @</EM></span> -+<span class="comment"><EM>-- Binding Version 01.00</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> - <b>generic</b> -- <b>type</b> <FONT COLOR=red><A NAME="ref_42_9" HREF="terminal_interface-curses-text_io-modular_io__ads.htm#ref_44_43">Num</A></FONT> <b>is</b> <b>mod</b> &lt;&gt;; -+ <b>type</b> <span class="symbol"><A NAME="ref_42_9" HREF="terminal_interface-curses-text_io-modular_io__ads.htm#ref_44_43">Num</A></span> <b>is</b> <b>mod</b> &lt;&gt;; - --<b>package</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-text_io__ads.htm#ref_44_35">Text_IO</A>.<FONT COLOR=red><A NAME="ref_44_43" HREF="terminal_interface-curses-text_io-modular_io__adb.htm#ref_44_48">Modular_IO</A></FONT> <b>is</b> -+<b>package</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-text_io__ads.htm#ref_44_35">Text_IO</A>.<span class="symbol"><A NAME="ref_44_43" HREF="terminal_interface-curses-text_io-modular_io__adb.htm#ref_44_48">Modular_IO</A></span> <b>is</b> - -- <FONT COLOR=red><A NAME="ref_46_4">Default_Width</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-modular_io__ads.htm#ref_42_9">Num</A>'Width; -- <FONT COLOR=red><A NAME="ref_47_4">Default_Base</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_51_12">Number_Base</A> := 10; -+ <span class="symbol"><A NAME="ref_46_4">Default_Width</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-modular_io__ads.htm#ref_42_9">Num</A>'Width; -+ <span class="symbol"><A NAME="ref_47_4">Default_Base</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_51_12">Number_Base</A> := 10; - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_49_14" HREF="terminal_interface-curses-text_io-modular_io__adb.htm#ref_49_14">Put</A></FONT> -- (<FONT COLOR=red><A NAME="ref_50_7" HREF="terminal_interface-curses-text_io-modular_io__adb.htm#ref_50_7">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -- <FONT COLOR=red><A NAME="ref_51_7" HREF="terminal_interface-curses-text_io-modular_io__adb.htm#ref_51_7">Item</A></FONT> : <A HREF="terminal_interface-curses-text_io-modular_io__ads.htm#ref_42_9">Num</A>; -- <FONT COLOR=red><A NAME="ref_52_7" HREF="terminal_interface-curses-text_io-modular_io__adb.htm#ref_52_7">Width</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-modular_io__ads.htm#ref_46_4">Default_Width</A>; -- <FONT COLOR=red><A NAME="ref_53_7" HREF="terminal_interface-curses-text_io-modular_io__adb.htm#ref_53_7">Base</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_51_12">Number_Base</A> := <A HREF="terminal_interface-curses-text_io-modular_io__ads.htm#ref_47_4">Default_Base</A>); -+ <b>procedure</b> <span class="symbol"><A NAME="ref_49_14" HREF="terminal_interface-curses-text_io-modular_io__adb.htm#ref_49_14">Put</A></span> -+ (<span class="symbol"><A NAME="ref_50_7" HREF="terminal_interface-curses-text_io-modular_io__adb.htm#ref_50_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; -+ <span class="symbol"><A NAME="ref_51_7" HREF="terminal_interface-curses-text_io-modular_io__adb.htm#ref_51_7">Item</A></span> : <A HREF="terminal_interface-curses-text_io-modular_io__ads.htm#ref_42_9">Num</A>; -+ <span class="symbol"><A NAME="ref_52_7" HREF="terminal_interface-curses-text_io-modular_io__adb.htm#ref_52_7">Width</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-modular_io__ads.htm#ref_46_4">Default_Width</A>; -+ <span class="symbol"><A NAME="ref_53_7" HREF="terminal_interface-curses-text_io-modular_io__adb.htm#ref_53_7">Base</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_51_12">Number_Base</A> := <A HREF="terminal_interface-curses-text_io-modular_io__ads.htm#ref_47_4">Default_Base</A>); - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_55_14" HREF="terminal_interface-curses-text_io-modular_io__adb.htm#ref_61_14">Put</A></FONT> -- (<FONT COLOR=red><A NAME="ref_56_7" HREF="terminal_interface-curses-text_io-modular_io__adb.htm#ref_62_7">Item</A></FONT> : <A HREF="terminal_interface-curses-text_io-modular_io__ads.htm#ref_42_9">Num</A>; -- <FONT COLOR=red><A NAME="ref_57_7" HREF="terminal_interface-curses-text_io-modular_io__adb.htm#ref_63_7">Width</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-modular_io__ads.htm#ref_46_4">Default_Width</A>; -- <FONT COLOR=red><A NAME="ref_58_7" HREF="terminal_interface-curses-text_io-modular_io__adb.htm#ref_64_7">Base</A></FONT> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_51_12">Number_Base</A> := <A HREF="terminal_interface-curses-text_io-modular_io__ads.htm#ref_47_4">Default_Base</A>); -+ <b>procedure</b> <span class="symbol"><A NAME="ref_55_14" HREF="terminal_interface-curses-text_io-modular_io__adb.htm#ref_61_14">Put</A></span> -+ (<span class="symbol"><A NAME="ref_56_7" HREF="terminal_interface-curses-text_io-modular_io__adb.htm#ref_62_7">Item</A></span> : <A HREF="terminal_interface-curses-text_io-modular_io__ads.htm#ref_42_9">Num</A>; -+ <span class="symbol"><A NAME="ref_57_7" HREF="terminal_interface-curses-text_io-modular_io__adb.htm#ref_63_7">Width</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_50_12">Field</A> := <A HREF="terminal_interface-curses-text_io-modular_io__ads.htm#ref_46_4">Default_Width</A>; -+ <span class="symbol"><A NAME="ref_58_7" HREF="terminal_interface-curses-text_io-modular_io__adb.htm#ref_64_7">Base</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_51_12">Number_Base</A> := <A HREF="terminal_interface-curses-text_io-modular_io__ads.htm#ref_47_4">Default_Base</A>); - - <b>private</b> - <b>pragma</b> Inline (Put); -diff -Naur ncurses-5.9/doc/html/ada/terminal_interface-curses-trace__adb.htm ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-trace__adb.htm ---- ncurses-5.9/doc/html/ada/terminal_interface-curses-trace__adb.htm 2011-03-20 00:18:42.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-trace__adb.htm 2014-09-01 16:33:22.305792038 +0200 -@@ -1,62 +1,95 @@ --<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> --<HTML><HEAD><TITLE>terminal_interface-curses-trace.adb</TITLE></HEAD> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> -+<HTML> -+<HEAD> -+<TITLE>terminal_interface-curses-trace.adb</TITLE> -+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> -+<style type="text/css"> -+*.comment { -+ color: green; -+} -+*.symbol { -+ color: red; -+} -+</style> -+</HEAD> - <BODY> --<HR><DIV ALIGN="center"><H1> File : terminal_interface-curses-trace.adb </H1></DIV><HR> -+<HR><DIV style="text-align:center"><H1> File : terminal_interface-curses-trace.adb </H1></DIV><HR> - <PRE> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Terminal_Interface.Curses.Trace --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- B O D Y --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Copyright (c) 2000-2004,2009 Free Software Foundation, Inc. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></FONT> --<FONT COLOR=green><EM>-- copy of this software and associated documentation files (the --</EM></FONT> --<FONT COLOR=green><EM>-- "Software"), to deal in the Software without restriction, including --</EM></FONT> --<FONT COLOR=green><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></FONT> --<FONT COLOR=green><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></FONT> --<FONT COLOR=green><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></FONT> --<FONT COLOR=green><EM>-- furnished to do so, subject to the following conditions: --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- The above copyright notice and this permission notice shall be included --</EM></FONT> --<FONT COLOR=green><EM>-- in all copies or substantial portions of the Software. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></FONT> --<FONT COLOR=green><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></FONT> --<FONT COLOR=green><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></FONT> --<FONT COLOR=green><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></FONT> --<FONT COLOR=green><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></FONT> --<FONT COLOR=green><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></FONT> --<FONT COLOR=green><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></FONT> --<FONT COLOR=green><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></FONT> --<FONT COLOR=green><EM>-- sale, use or other dealings in this Software without prior written --</EM></FONT> --<FONT COLOR=green><EM>-- authorization. --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Author: Juergen Pfeifer, 1996</EM></FONT> --<FONT COLOR=green><EM>-- Version Control:</EM></FONT> --<FONT COLOR=green><EM>-- @Revision: 1.7 @</EM></FONT> --<FONT COLOR=green><EM>-- Binding Version 01.00</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Terminal_Interface.Curses.Trace --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- B O D Y --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Copyright (c) 2000-2004,2009 Free Software Foundation, Inc. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></span> -+<span class="comment"><EM>-- copy of this software and associated documentation files (the --</EM></span> -+<span class="comment"><EM>-- "Software"), to deal in the Software without restriction, including --</EM></span> -+<span class="comment"><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></span> -+<span class="comment"><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></span> -+<span class="comment"><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></span> -+<span class="comment"><EM>-- furnished to do so, subject to the following conditions: --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- The above copyright notice and this permission notice shall be included --</EM></span> -+<span class="comment"><EM>-- in all copies or substantial portions of the Software. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></span> -+<span class="comment"><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></span> -+<span class="comment"><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></span> -+<span class="comment"><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></span> -+<span class="comment"><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></span> -+<span class="comment"><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></span> -+<span class="comment"><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></span> -+<span class="comment"><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></span> -+<span class="comment"><EM>-- sale, use or other dealings in this Software without prior written --</EM></span> -+<span class="comment"><EM>-- authorization. --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Author: Juergen Pfeifer, 1996</EM></span> -+<span class="comment"><EM>-- Version Control:</EM></span> -+<span class="comment"><EM>-- @Revision: 1.7 @</EM></span> -+<span class="comment"><EM>-- Binding Version 01.00</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<b>with</b> <A HREF="interfac__ads.htm#ref_36_9">Interfaces</A>.C; <b>use</b> <A HREF="interfac__ads.htm#ref_36_9">Interfaces</A>.C; -+<b>with</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-aux__ads.htm#ref_50_35">Aux</A>; <b>use</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-aux__ads.htm#ref_50_35">Aux</A>; -+<b>with</b> Ada.Unchecked_Conversion; - --<b>package</b> <b>body</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<FONT COLOR=red><A NAME="ref_42_40" HREF="terminal_interface-curses-trace__ads.htm#ref_42_35">Trace</A></FONT> <b>is</b> -+<b>package</b> <b>body</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<span class="symbol"><A NAME="ref_45_40" HREF="terminal_interface-curses-trace__ads.htm#ref_42_35">Trace</A></span> <b>is</b> - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_44_14" HREF="terminal_interface-curses-trace__ads.htm#ref_106_14">Trace_On</A></FONT> (<FONT COLOR=red><A NAME="ref_44_24" HREF="terminal_interface-curses-trace__ads.htm#ref_106_24">x</A></FONT> : <A HREF="terminal_interface-curses-trace__ads.htm#ref_46_9">Trace_Attribute_Set</A>) <b>is</b> -- <b>pragma</b> Unreferenced (<A HREF="terminal_interface-curses-trace__ads.htm#ref_106_24">x</A>); -+ <b>type</b> <span class="symbol"><A NAME="ref_47_9">C_TraceType</A></span> <b>is</b> <b>new</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_59_12">C_UInt</A>; -+ -+ <b>function</b> TraceAda_To_TraceC <b>is</b> <b>new</b> -+ Ada.Unchecked_Conversion (Source =&gt; <A HREF="terminal_interface-curses-trace__ads.htm#ref_46_9">Trace_Attribute_Set</A>, -+ Target =&gt; <A HREF="terminal_interface-curses-trace__adb.htm#ref_47_9">C_TraceType</A>); -+ -+ <b>procedure</b> <span class="symbol"><A NAME="ref_53_14" HREF="terminal_interface-curses-trace__ads.htm#ref_105_14">Trace_On</A></span> (<span class="symbol"><A NAME="ref_53_24" HREF="terminal_interface-curses-trace__ads.htm#ref_105_24">x</A></span> : <A HREF="terminal_interface-curses-trace__ads.htm#ref_46_9">Trace_Attribute_Set</A>) <b>is</b> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_54_17">traceC</A></span> (<span class="symbol"><A NAME="ref_54_25" HREF="terminal_interface-curses-trace__adb.htm#ref_54_17">y</A></span> : <A HREF="terminal_interface-curses-trace__adb.htm#ref_47_9">C_TraceType</A>); -+ <b>pragma</b> Import (C, traceC, "trace"); - <b>begin</b> -- <b>null</b>; -- <b>end</b> <A HREF="terminal_interface-curses-trace__ads.htm#ref_106_14">Trace_On</A>; -+ <A HREF="terminal_interface-curses-trace__adb.htm#ref_54_17">traceC</A> (TraceAda_To_TraceC (<A HREF="terminal_interface-curses-trace__ads.htm#ref_105_24">x</A>)); -+ <b>end</b> <A HREF="terminal_interface-curses-trace__ads.htm#ref_105_14">Trace_On</A>; -+ -+ <span class="comment"><EM>-- 75. (12) A C function that takes a variable number of arguments can</EM></span> -+ <span class="comment"><EM>-- correspond to several Ada subprograms, taking various specific</EM></span> -+ <span class="comment"><EM>-- numbers and types of parameters.</EM></span> - -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_50_14" HREF="terminal_interface-curses-trace__ads.htm#ref_110_14">Trace_Put</A></FONT> (<FONT COLOR=red><A NAME="ref_50_25" HREF="terminal_interface-curses-trace__ads.htm#ref_110_25">str</A></FONT> : String) <b>is</b> -- <b>pragma</b> Unreferenced (<A HREF="terminal_interface-curses-trace__ads.htm#ref_110_25">str</A>); -+ <b>procedure</b> <span class="symbol"><A NAME="ref_64_14" HREF="terminal_interface-curses-trace__ads.htm#ref_109_14">Trace_Put</A></span> (<span class="symbol"><A NAME="ref_64_25" HREF="terminal_interface-curses-trace__ads.htm#ref_109_25">str</A></span> : String) <b>is</b> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_65_17">tracef</A></span> (<span class="symbol"><A NAME="ref_65_25" HREF="terminal_interface-curses-trace__adb.htm#ref_65_17">format</A></span> : char_array; <span class="symbol"><A NAME="ref_65_46" HREF="terminal_interface-curses-trace__adb.htm#ref_65_17">s</A></span> : char_array); -+ <b>pragma</b> Import (C, tracef, "_traces"); -+ <span class="symbol"><A NAME="ref_67_7">Txt</A></span> : char_array (0 .. <A HREF="terminal_interface-curses-trace__ads.htm#ref_109_25">str</A>'Length); -+ <span class="symbol"><A NAME="ref_68_7">Length</A></span> : size_t; -+ <span class="symbol"><A NAME="ref_69_7">formatstr</A></span> : <b>constant</b> String := "%s" &amp; ASCII.NUL; -+ <span class="symbol"><A NAME="ref_70_7">formattxt</A></span> : char_array (0 .. <A HREF="terminal_interface-curses-trace__adb.htm#ref_69_7">formatstr</A>'Length); - <b>begin</b> -- <b>null</b>; -- <b>end</b> <A HREF="terminal_interface-curses-trace__ads.htm#ref_110_14">Trace_Put</A>; -+ To_C (<A HREF="terminal_interface-curses-trace__adb.htm#ref_69_7">formatstr</A>, <A HREF="terminal_interface-curses-trace__adb.htm#ref_70_7">formattxt</A>, <A HREF="terminal_interface-curses-trace__adb.htm#ref_68_7">Length</A>); -+ To_C (<A HREF="terminal_interface-curses-trace__ads.htm#ref_109_25">str</A>, <A HREF="terminal_interface-curses-trace__adb.htm#ref_67_7">Txt</A>, <A HREF="terminal_interface-curses-trace__adb.htm#ref_68_7">Length</A>); -+ <A HREF="terminal_interface-curses-trace__adb.htm#ref_65_17">tracef</A> (<A HREF="terminal_interface-curses-trace__adb.htm#ref_70_7">formattxt</A>, <A HREF="terminal_interface-curses-trace__adb.htm#ref_67_7">Txt</A>); -+ <b>end</b> <A HREF="terminal_interface-curses-trace__ads.htm#ref_109_14">Trace_Put</A>; - - <b>end</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-trace__ads.htm#ref_42_35">Trace</A>; - </PRE></BODY></HTML> -diff -Naur ncurses-5.9/doc/html/ada/terminal_interface-curses-trace__ads.htm ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-trace__ads.htm ---- ncurses-5.9/doc/html/ada/terminal_interface-curses-trace__ads.htm 2011-03-20 00:18:42.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/ada/terminal_interface-curses-trace__ads.htm 2014-09-01 16:33:22.305792038 +0200 -@@ -1,69 +1,80 @@ --<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> --<HTML><HEAD><TITLE>terminal_interface-curses-trace.ads</TITLE></HEAD> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> -+<HTML> -+<HEAD> -+<TITLE>terminal_interface-curses-trace.ads</TITLE> -+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> -+<style type="text/css"> -+*.comment { -+ color: green; -+} -+*.symbol { -+ color: red; -+} -+</style> -+</HEAD> - <BODY> --<HR><DIV ALIGN="center"><H1> File : terminal_interface-curses-trace.ads </H1></DIV><HR> -+<HR><DIV style="text-align:center"><H1> File : terminal_interface-curses-trace.ads </H1></DIV><HR> - <PRE> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Terminal_Interface.Curses.Trace --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- S P E C --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Copyright (c) 2000 Free Software Foundation, Inc. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></FONT> --<FONT COLOR=green><EM>-- copy of this software and associated documentation files (the --</EM></FONT> --<FONT COLOR=green><EM>-- "Software"), to deal in the Software without restriction, including --</EM></FONT> --<FONT COLOR=green><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></FONT> --<FONT COLOR=green><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></FONT> --<FONT COLOR=green><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></FONT> --<FONT COLOR=green><EM>-- furnished to do so, subject to the following conditions: --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- The above copyright notice and this permission notice shall be included --</EM></FONT> --<FONT COLOR=green><EM>-- in all copies or substantial portions of the Software. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></FONT> --<FONT COLOR=green><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></FONT> --<FONT COLOR=green><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></FONT> --<FONT COLOR=green><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></FONT> --<FONT COLOR=green><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></FONT> --<FONT COLOR=green><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></FONT> --<FONT COLOR=green><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></FONT> --<FONT COLOR=green><EM>-- --</EM></FONT> --<FONT COLOR=green><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></FONT> --<FONT COLOR=green><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></FONT> --<FONT COLOR=green><EM>-- sale, use or other dealings in this Software without prior written --</EM></FONT> --<FONT COLOR=green><EM>-- authorization. --</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> --<FONT COLOR=green><EM>-- Author: Eugene V. Melaragno &lt;aldomel@ix.netcom.com&gt; 2000</EM></FONT> --<FONT COLOR=green><EM>-- Version Control:</EM></FONT> --<FONT COLOR=green><EM>-- @Revision: 1.1 @</EM></FONT> --<FONT COLOR=green><EM>-- Binding Version 01.00</EM></FONT> --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Terminal_Interface.Curses.Trace --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- S P E C --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Copyright (c) 2000 Free Software Foundation, Inc. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></span> -+<span class="comment"><EM>-- copy of this software and associated documentation files (the --</EM></span> -+<span class="comment"><EM>-- "Software"), to deal in the Software without restriction, including --</EM></span> -+<span class="comment"><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></span> -+<span class="comment"><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></span> -+<span class="comment"><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></span> -+<span class="comment"><EM>-- furnished to do so, subject to the following conditions: --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- The above copyright notice and this permission notice shall be included --</EM></span> -+<span class="comment"><EM>-- in all copies or substantial portions of the Software. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></span> -+<span class="comment"><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></span> -+<span class="comment"><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></span> -+<span class="comment"><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></span> -+<span class="comment"><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></span> -+<span class="comment"><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></span> -+<span class="comment"><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></span> -+<span class="comment"><EM>-- --</EM></span> -+<span class="comment"><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></span> -+<span class="comment"><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></span> -+<span class="comment"><EM>-- sale, use or other dealings in this Software without prior written --</EM></span> -+<span class="comment"><EM>-- authorization. --</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> -+<span class="comment"><EM>-- Author: Eugene V. Melaragno &lt;aldomel@ix.netcom.com&gt; 2000</EM></span> -+<span class="comment"><EM>-- Version Control:</EM></span> -+<span class="comment"><EM>-- @Revision: 1.1 @</EM></span> -+<span class="comment"><EM>-- Binding Version 01.00</EM></span> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> - --<b>package</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<FONT COLOR=red><A NAME="ref_42_35" HREF="terminal_interface-curses-trace__adb.htm#ref_42_40">Trace</A></FONT> <b>is</b> -+<b>package</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<span class="symbol"><A NAME="ref_42_35" HREF="terminal_interface-curses-trace__adb.htm#ref_45_40">Trace</A></span> <b>is</b> - <b>pragma</b> Preelaborate (<A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-trace__ads.htm#ref_42_35">Trace</A>); - - <b>pragma</b> Warnings (Off); -- <b>type</b> <FONT COLOR=red><A NAME="ref_46_9">Trace_Attribute_Set</A></FONT> <b>is</b> -+ <b>type</b> <span class="symbol"><A NAME="ref_46_9">Trace_Attribute_Set</A></span> <b>is</b> - <b>record</b> -- <FONT COLOR=red><A NAME="ref_48_10">Times</A></FONT> : Boolean; -- <FONT COLOR=red><A NAME="ref_49_10">Tputs</A></FONT> : Boolean; -- <FONT COLOR=red><A NAME="ref_50_10">Update</A></FONT> : Boolean; -- <FONT COLOR=red><A NAME="ref_51_10">Cursor_Move</A></FONT> : Boolean; -- <FONT COLOR=red><A NAME="ref_52_10">Character_Output</A></FONT> : Boolean; -- <FONT COLOR=red><A NAME="ref_53_10">Calls</A></FONT> : Boolean; -- <FONT COLOR=red><A NAME="ref_54_10">Virtual_Puts</A></FONT> : Boolean; -- <FONT COLOR=red><A NAME="ref_55_10">Input_Events</A></FONT> : Boolean; -- <FONT COLOR=red><A NAME="ref_56_10">TTY_State</A></FONT> : Boolean; -- <FONT COLOR=red><A NAME="ref_57_10">Internal_Calls</A></FONT> : Boolean; -- <FONT COLOR=red><A NAME="ref_58_10">Character_Calls</A></FONT> : Boolean; -- <FONT COLOR=red><A NAME="ref_59_10">Termcap_TermInfo</A></FONT> : Boolean; -- <FONT COLOR=red><A NAME="ref_60_10">Attributes_And_Colors</A></FONT> : Boolean; -- <FONT COLOR=red><A NAME="ref_61_10">Unused</A></FONT> : Boolean; -+ <span class="symbol"><A NAME="ref_48_10">Times</A></span> : Boolean; -+ <span class="symbol"><A NAME="ref_49_10">Tputs</A></span> : Boolean; -+ <span class="symbol"><A NAME="ref_50_10">Update</A></span> : Boolean; -+ <span class="symbol"><A NAME="ref_51_10">Cursor_Move</A></span> : Boolean; -+ <span class="symbol"><A NAME="ref_52_10">Character_Output</A></span> : Boolean; -+ <span class="symbol"><A NAME="ref_53_10">Calls</A></span> : Boolean; -+ <span class="symbol"><A NAME="ref_54_10">Virtual_Puts</A></span> : Boolean; -+ <span class="symbol"><A NAME="ref_55_10">Input_Events</A></span> : Boolean; -+ <span class="symbol"><A NAME="ref_56_10">TTY_State</A></span> : Boolean; -+ <span class="symbol"><A NAME="ref_57_10">Internal_Calls</A></span> : Boolean; -+ <span class="symbol"><A NAME="ref_58_10">Character_Calls</A></span> : Boolean; -+ <span class="symbol"><A NAME="ref_59_10">Termcap_TermInfo</A></span> : Boolean; -+ <span class="symbol"><A NAME="ref_60_10">Attributes_And_Colors</A></span> : Boolean; - <b>end</b> <b>record</b>; - <b>pragma</b> Convention (C, <A HREF="terminal_interface-curses-trace__ads.htm#ref_46_9">Trace_Attribute_Set</A>); - -@@ -82,41 +93,41 @@ - <A HREF="terminal_interface-curses-trace__ads.htm#ref_58_10">Character_Calls</A> <b>at</b> 0 <b>range</b> 10 .. 10; - <A HREF="terminal_interface-curses-trace__ads.htm#ref_59_10">Termcap_TermInfo</A> <b>at</b> 0 <b>range</b> 11 .. 11; - <A HREF="terminal_interface-curses-trace__ads.htm#ref_60_10">Attributes_And_Colors</A> <b>at</b> 0 <b>range</b> 12 .. 12; -- <A HREF="terminal_interface-curses-trace__ads.htm#ref_61_10">Unused</A> <b>at</b> 0 <b>range</b> 13 .. 31; - <b>end</b> <b>record</b>; -- <b>for</b> <A HREF="terminal_interface-curses-trace__ads.htm#ref_46_9">Trace_Attribute_Set</A>'Size <b>use</b> 32; -- <FONT COLOR=green><EM>-- Please note: this rep. clause is generated and may be</EM></FONT> -- <FONT COLOR=green><EM>-- different on your system.</EM></FONT> -+ <b>pragma</b> Warnings (Off); <b>for</b> <A HREF="terminal_interface-curses-trace__ads.htm#ref_46_9">Trace_Attribute_Set</A>'Size <b>use</b> 32; -+ <b>pragma</b> Warnings (On); -+ <span class="comment"><EM>-- Please note: this rep. clause is generated and may be</EM></span> -+ <span class="comment"><EM>-- different on your system.</EM></span> - - <b>pragma</b> Warnings (On); - -- <FONT COLOR=red><A NAME="ref_88_4">Trace_Disable</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-trace__ads.htm#ref_46_9">Trace_Attribute_Set</A> := (<b>others</b> =&gt; False); -+ <span class="symbol"><A NAME="ref_87_4">Trace_Disable</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-trace__ads.htm#ref_46_9">Trace_Attribute_Set</A> := (<b>others</b> =&gt; False); - -- <FONT COLOR=red><A NAME="ref_90_4">Trace_Ordinary</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-trace__ads.htm#ref_46_9">Trace_Attribute_Set</A> := -+ <span class="symbol"><A NAME="ref_89_4">Trace_Ordinary</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-trace__ads.htm#ref_46_9">Trace_Attribute_Set</A> := - (<A HREF="terminal_interface-curses-trace__ads.htm#ref_48_10">Times</A> =&gt; True, - <A HREF="terminal_interface-curses-trace__ads.htm#ref_49_10">Tputs</A> =&gt; True, - <A HREF="terminal_interface-curses-trace__ads.htm#ref_50_10">Update</A> =&gt; True, - <A HREF="terminal_interface-curses-trace__ads.htm#ref_51_10">Cursor_Move</A> =&gt; True, - <A HREF="terminal_interface-curses-trace__ads.htm#ref_52_10">Character_Output</A> =&gt; True, - <b>others</b> =&gt; False); -- <FONT COLOR=red><A NAME="ref_97_4">Trace_Maximum</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-trace__ads.htm#ref_46_9">Trace_Attribute_Set</A> := (<b>others</b> =&gt; True); -+ <span class="symbol"><A NAME="ref_96_4">Trace_Maximum</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-trace__ads.htm#ref_46_9">Trace_Attribute_Set</A> := (<b>others</b> =&gt; True); - --<FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT> -+<span class="comment"><EM>------------------------------------------------------------------------------</EM></span> - -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -- <FONT COLOR=green><EM>-- | Man page <A HREF="../man/curs_trace.3x.html">curs_trace.3x</A></EM></FONT> -- <FONT COLOR=green><EM>-- |=====================================================================</EM></FONT> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> -+ <span class="comment"><EM>-- | Man page <A HREF="../man/curs_trace.3x.html">curs_trace.3x</A></EM></span> -+ <span class="comment"><EM>-- |=====================================================================</EM></span> - -- <FONT COLOR=green><EM>-- #1A NAME="AFU_1"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_106_14" HREF="terminal_interface-curses-trace__adb.htm#ref_44_14">Trace_On</A></FONT> (<FONT COLOR=red><A NAME="ref_106_24" HREF="terminal_interface-curses-trace__adb.htm#ref_44_24">x</A></FONT> : <A HREF="terminal_interface-curses-trace__ads.htm#ref_46_9">Trace_Attribute_Set</A>); -- <FONT COLOR=green><EM>-- The debugging library has trace.</EM></FONT> -+ <span class="comment"><EM>-- #1A NAME="AFU_1"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_105_14" HREF="terminal_interface-curses-trace__adb.htm#ref_53_14">Trace_On</A></span> (<span class="symbol"><A NAME="ref_105_24" HREF="terminal_interface-curses-trace__adb.htm#ref_53_24">x</A></span> : <A HREF="terminal_interface-curses-trace__ads.htm#ref_46_9">Trace_Attribute_Set</A>); -+ <span class="comment"><EM>-- The debugging library has trace.</EM></span> - -- <FONT COLOR=green><EM>-- #1A NAME="AFU_2"#2|</EM></FONT> -- <b>procedure</b> <FONT COLOR=red><A NAME="ref_110_14" HREF="terminal_interface-curses-trace__adb.htm#ref_50_14">Trace_Put</A></FONT> (<FONT COLOR=red><A NAME="ref_110_25" HREF="terminal_interface-curses-trace__adb.htm#ref_50_25">str</A></FONT> : String); -- <FONT COLOR=green><EM>-- AKA: <A HREF="../man/curs_trace.3x.html">_tracef()</A></EM></FONT> -+ <span class="comment"><EM>-- #1A NAME="AFU_2"#2|</EM></span> -+ <b>procedure</b> <span class="symbol"><A NAME="ref_109_14" HREF="terminal_interface-curses-trace__adb.htm#ref_64_14">Trace_Put</A></span> (<span class="symbol"><A NAME="ref_109_25" HREF="terminal_interface-curses-trace__adb.htm#ref_64_25">str</A></span> : String); -+ <span class="comment"><EM>-- AKA: <A HREF="../man/curs_trace.3x.html">_tracef()</A></EM></span> - -- <FONT COLOR=red><A NAME="ref_113_4">Current_Trace_Setting</A></FONT> : <A HREF="terminal_interface-curses-trace__ads.htm#ref_46_9">Trace_Attribute_Set</A>; -- <b>pragma</b> Import (C, <A HREF="terminal_interface-curses-trace__ads.htm#ref_113_4">Current_Trace_Setting</A>, "_nc_tracing"); -+ <span class="symbol"><A NAME="ref_112_4">Current_Trace_Setting</A></span> : <A HREF="terminal_interface-curses-trace__ads.htm#ref_46_9">Trace_Attribute_Set</A>; -+ <b>pragma</b> Import (C, <A HREF="terminal_interface-curses-trace__ads.htm#ref_112_4">Current_Trace_Setting</A>, "_nc_tracing"); - - <b>end</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-trace__ads.htm#ref_42_35">Trace</A>; - </PRE></BODY></HTML> -diff -Naur ncurses-5.9/doc/html/Ada95.html ncurses-5.9.patch/doc/html/Ada95.html ---- ncurses-5.9/doc/html/Ada95.html 2010-12-04 17:42:54.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/Ada95.html 2014-09-01 16:33:22.259791961 +0200 -@@ -1,8 +1,7 @@ --<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> - <!-- -- $Id: Ada95.html,v 1.8 2010/12/04 16:42:54 tom Exp $ -+ $Id: Ada95.html,v 1.14 2013/05/18 21:34:34 tom Exp $ - **************************************************************************** -- * Copyright (c) 1998-2004,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2010,2013 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -29,156 +28,316 @@ - * authorization. * - **************************************************************************** - --> --<HTML> --<HEAD> --<TITLE>Ada95 Binding for ncurses</Title> --<link rev=made href="mailto:bug-ncurses@gnu.org"> --<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> --</HEAD> --<BODY> --<H1>Ada95 Binding for ncurses</H1> --by J&uuml;rgen Pfeifer. -- --<HR SIZE=3 NOSHADE> --<H2>General Remarks</H2> --<UL> --<LI>This document describes Version 01.00 of the binding.</LI> --<LI>The functionality is modeled to be compatible with the ncurses --package, a clone of the SVr4 curses model.<BR> --I did the development on an Intel box running the latest stable release of --<A HREF="http://www.linux.org">Linux</A>, ncurses and the most recent released --<A HREF="http://www.gnat.com">GNU Ada Translator</A> --gnat versions. For any older versions of ncurses and gnat --it is not guaranteed to work.</LI> --<LI>You must have the m4 macroprocessor to build this package. --If you don't have this program, you can get the FSF version --<A HREF="ftp://ftp.gnu.org/pub/gnu/">here</A>.</LI> --<LI>Ada programs are supposed to be readable. One of my --favorite methods to make code readable is to use expressive --names for the identifiers. You can find a list of a mapping --of the cryptic curses names to the Ada names in this <A HREF="ada/table.html">table</A>.</LI> --<LI>This is not a typical one-to-one interface mapping. It is --close to one-to-one on the functional level. Each (n)curses function --has it's counterpart with a more or less similar formal parameter list --in the binding. It is not one-to-one with respect to the datatypes. --I tried to make records out of the flat chtype and similar structures, --so you don't have to do bit operations to mark an attributed character --as bold. Just make the boolean member <STRONG>bold</STRONG> of the record --true. The binding also hides the structures like WINDOW, PANEL, MENU, FORM --etc. ! It's a pure functional API.</LI> --<LI>I try to do as much error checking as possible and feasible --in the binding. I will raise an Ada exception when something --went wrong in the low-level curses. This has the effect that - at least --first time in my life - (n)curses programs have now a very rigid error --checking, but - thanks to Ada - you don't have to code the orgiastic --error checking style of C.</LI> --<LI>Support for wide characters is currently not in the binding, as it --is not really in ncurses at this point in time.</LI> --</UL> -- --<H2>Limitations</H2> --<UL> --<LI>I provide no SCREEN datatype and functions to set a new screen. --If you need this (mostly for debugging I guess), write a small --C routine doing all this and import it into your Ada program.</LI> --<LI>I provide no functions to switch on/off curses tracing options. --Same suggestion as above.</LI> --<LI>Although Ada95 is an OO Language, this binding doesn't provide --an OO abstraction of the (n)curses functionality. As mentioned above --it's a thin binding for the (n)curses functions. But without any --doubt it would be nice to build on top of this an OO abstraction --of (n)curses functionality.<BR> --The only exception is the method how fieldtypes are represented in --this Binding. We provide an abstract tagged type Field_Type from --which the various fieldtypes are derived.</LI> --<LI>I currently do not support the link_fieldtype functionality of the --forms subsystem.</LI> --<LI>The *_IO packages are currently output only.</LI> --</UL> -- --<H2>Hierarchy of packages</H2> --<UL> --<LI><A HREF="ada/terminal_interface__ads.htm">Terminal_Interface</A> -- <UL><LI><A HREF="ada/terminal_interface-curses__ads.htm">Curses</A> -- <UL><LI><A HREF="ada/terminal_interface-curses-mouse__ads.htm">Mouse</A> -- <LI><A HREF="ada/terminal_interface-curses-panels__ads.htm">Panels</A> -- <UL><LI><A HREF="ada/terminal_interface-curses-panels-user_data__ads.htm">User_Data</A> -- </UL> -- <LI><A HREF="ada/terminal_interface-curses-menus__ads.htm">Menus</A> -- <UL><LI><A HREF="ada/terminal_interface-curses-menus-menu_user_data__ads.htm">Menu_User_Data</A> -- <LI><A HREF="ada/terminal_interface-curses-menus-item_user_data__ads.htm">Item_User_Data</A> -- </UL> -- <LI><A HREF="ada/terminal_interface-curses-forms__ads.htm">Forms</A> -- <UL><LI><A HREF="ada/terminal_interface-curses-forms-form_user_data__ads.htm">Form_User_Data</A> -- <LI><A HREF="ada/terminal_interface-curses-forms-field_user_data__ads.htm">Field_User_Data</A> -- <LI><A HREF="ada/terminal_interface-curses-forms-field_types__ads.htm">Field_Types</A> -- <UL><LI><A HREF="ada/terminal_interface-curses-forms-field_types-alpha__ads.htm">Alpha</A> -- <LI><A HREF="ada/terminal_interface-curses-forms-field_types-alphanumeric__ads.htm">AlphaNumeric</A> -- <LI><A HREF="ada/terminal_interface-curses-forms-field_types-intfield__ads.htm">IntField</A> -- <LI><A HREF="ada/terminal_interface-curses-forms-field_types-numeric__ads.htm">Numeric</A> -- <LI><A HREF="ada/terminal_interface-curses-forms-field_types-regexp__ads.htm">RegExp</A> -- <LI><A HREF="ada/terminal_interface-curses-forms-field_types-ipv4_address__ads.htm">IPV4_Address</A> -- <LI><A HREF="ada/terminal_interface-curses-forms-field_types-enumeration__ads.htm">Enumeration</A> -- <UL><LI><A HREF="ada/terminal_interface-curses-forms-field_types-enumeration-ada__ads.htm">Ada</A> -- </UL> -- <LI><A HREF="ada/terminal_interface-curses-forms-field_types-user__ads.htm">User</A> -- <UL><LI><A HREF="ada/terminal_interface-curses-forms-field_types-user-choice__ads.htm">Choice</A> -- </UL> -- </UL> -- </UL> -- <LI><A HREF="ada/terminal_interface-curses-text_io__ads.htm">Text_IO</A> -- <UL><LI><A HREF="ada/terminal_interface-curses-text_io-integer_io__ads.htm">Integer_IO</A> -- <LI><A HREF="ada/terminal_interface-curses-text_io-float_io__ads.htm">Float_IO</A> -- <LI><A HREF="ada/terminal_interface-curses-text_io-fixed_io__ads.htm">Fixed_IO</A> -- <LI><A HREF="ada/terminal_interface-curses-text_io-decimal_io__ads.htm">Decimal_IO</A> -- <LI><A HREF="ada/terminal_interface-curses-text_io-modular_io__ads.htm">Modular_IO</A> -- <LI><A HREF="ada/terminal_interface-curses-text_io-enumeration_io__ads.htm">Enumeration_IO</A> -- <LI><A HREF="ada/terminal_interface-curses-text_io-complex_io__ads.htm">Complex_IO</A> -- </UL> -- </UL> -- </UL> --</UL> --If you want to navigate through the html pages of the package specs, click <A HREF="ada/index.htm">here</A>. --<H2>Implementation Details</H2> --<H4>Behind the abstraction</H4> --All the new types like <STRONG>Window</STRONG>, <STRONG>Panel</STRONG>, --<STRONG>Menu</STRONG>, <STRONG>Form</STRONG> etc. are just --opaque representations of the pointers to the corresponding --low level (n)curses structures like --<STRONG>WINDOW *</STRONG>, <STRONG>PANEL *</STRONG>, --<STRONG>MENU *</STRONG> or <STRONG>FORM *</STRONG>. --So you can safely pass them to C routines that expect a pointer --to one of those structures. --<H4>Extended ripoffline() usage</H4> --The official documentation of (n)curses says, that the line parameter --determines only whether or not exactly <STRONG>one</STRONG> line is --stolen from the top or bottom of the screen. So essentially only the --sign of the parameter is evaluated. ncurses has internally implemented --it in a way, that uses the line parameter also to control the amount of --lines to steal. This mechanism is used in the <STRONG>Rip_Off_Lines</STRONG> --routine of the binding. --<H4><A NAME="userpointer">How user defined field types work</A></H4> --TBD --<H4>Enumeration fields handling</H4> --The (n)curses documentation says, that the String arrays to be passed to --an TYPE_ENUM fieldtype must not be automatic variables. This is not true --in this binding, because it is internally arranged to safely copy these --values. --<H4><A NAME="compiler">Using other Ada compilers</A></H4> --This should basically not be a problem. --<H4>Port to other curses implementations</H4> --Basically it should not be too hard to make all this run on a regular SVr4 --implementation of curses. The problems are probably these:<BR> --<UL> --<LI>ncurses has some additional features which are presented in this binding. You --have two choices to deal with this: --<UL> --<LI>Emulate the feature in this binding</LI> --<LI>Raise an exception for non implemented features</LI> --</UL> --Most likely you will follow a mixed approach. Some features are easy to simulate, --others will be hard if not impossible.</LI> --</UL> --I'm quite sure I forgot something. --</BODY> --</HTML> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> -+ -+<html> -+<head> -+ <meta name="generator" content= -+ "HTML Tidy for Linux (vers 25 March 2009), see www.w3.org"> -+ -+ <title>Ada95 Binding for ncurses</title> -+ <link rev="made" href="mailto:bug-ncurses@gnu.org"> -+ <meta http-equiv="Content-Type" content= -+ "text/html; charset=us-ascii"> -+</head> -+ -+<body> -+ <h1>Ada95 Binding for ncurses</h1> -+ -+ <p>by J&uuml;rgen Pfeifer.</p> -+ <hr> -+ -+ <h2>General Remarks</h2> -+ -+ <ul> -+ <li>This document describes Version 01.00 of the binding.</li> -+ -+ <li>The functionality is modeled to be compatible with the -+ ncurses package, a clone of the SVr4 curses model.<br> -+ I did the development on an Intel box running the latest stable -+ release of <a href="http://www.linux.org">Linux</a>, ncurses -+ and the most recent released <a href="http://www.gnat.com">GNU -+ Ada Translator</a> gnat versions. For any older versions of -+ ncurses and gnat it is not guaranteed to work.</li> -+ -+ <li>You must have the m4 macroprocessor to build this package. -+ If you don't have this program, you can get the FSF version -+ <a href="ftp://ftp.gnu.org/pub/gnu/">here</a>.</li> -+ -+ <li>Ada programs are supposed to be readable. One of my -+ favorite methods to make code readable is to use expressive -+ names for the identifiers. You can find a list of a mapping of -+ the cryptic curses names to the Ada names in this <a href= -+ "ada/table.html">table</a>.</li> -+ -+ <li>This is not a typical one-to-one interface mapping. It is -+ close to one-to-one on the functional level. Each (n)curses -+ function has it's counterpart with a more or less similar -+ formal parameter list in the binding. It is not one-to-one with -+ respect to the datatypes. I tried to make records out of the -+ flat chtype and similar structures, so you don't have to do bit -+ operations to mark an attributed character as bold. Just make -+ the boolean member <strong>bold</strong> of the record true. -+ The binding also hides the structures like WINDOW, PANEL, MENU, -+ FORM etc. ! It's a pure functional API.</li> -+ -+ <li>I try to do as much error checking as possible and feasible -+ in the binding. I will raise an Ada exception when something -+ went wrong in the low-level curses. This has the effect that - -+ at least first time in my life - (n)curses programs have now a -+ very rigid error checking, but - thanks to Ada - you don't have -+ to code the orgiastic error checking style of C.</li> -+ -+ <li>Support for wide characters is currently not in the -+ binding, as it is not really in ncurses at this point in -+ time.</li> -+ </ul> -+ -+ <h2>Limitations</h2> -+ -+ <ul> -+ <li>I provide no SCREEN datatype and functions to set a new -+ screen. If you need this (mostly for debugging I guess), write -+ a small C routine doing all this and import it into your Ada -+ program.</li> -+ -+ <li>I provide no functions to switch on/off curses tracing -+ options. Same suggestion as above.</li> -+ -+ <li>Although Ada95 is an OO Language, this binding doesn't -+ provide an OO abstraction of the (n)curses functionality. As -+ mentioned above it's a thin binding for the (n)curses -+ functions. But without any doubt it would be nice to build on -+ top of this an OO abstraction of (n)curses functionality.<br> -+ The only exception is the method how fieldtypes are represented -+ in this Binding. We provide an abstract tagged type Field_Type -+ from which the various fieldtypes are derived.</li> -+ -+ <li>I currently do not support the link_fieldtype functionality -+ of the forms subsystem.</li> -+ -+ <li>The *_IO packages are currently output only.</li> -+ </ul> -+ -+ <h2>Hierarchy of packages</h2> -+ -+ <ul> -+ <li> -+ <a href= -+ "ada/terminal_interface__ads.htm">Terminal_Interface</a> -+ -+ <ul> -+ <li> -+ <a href= -+ "ada/terminal_interface-curses__ads.htm">Curses</a> -+ -+ <ul> -+ <li><a href= -+ "ada/terminal_interface-curses-mouse__ads.htm">Mouse</a></li> -+ -+ <li> -+ <a href= -+ "ada/terminal_interface-curses-panels__ads.htm">Panels</a> -+ -+ <ul> -+ <li><a href= -+ "ada/terminal_interface-curses-panels-user_data__ads.htm"> -+ User_Data</a></li> -+ </ul> -+ </li> -+ -+ <li> -+ <a href= -+ "ada/terminal_interface-curses-menus__ads.htm">Menus</a> -+ -+ <ul> -+ <li><a href= -+ "ada/terminal_interface-curses-menus-menu_user_data__ads.htm"> -+ Menu_User_Data</a></li> -+ -+ <li><a href= -+ "ada/terminal_interface-curses-menus-item_user_data__ads.htm"> -+ Item_User_Data</a></li> -+ </ul> -+ </li> -+ -+ <li> -+ <a href= -+ "ada/terminal_interface-curses-forms__ads.htm">Forms</a> -+ -+ <ul> -+ <li><a href= -+ "ada/terminal_interface-curses-forms-form_user_data__ads.htm"> -+ Form_User_Data</a></li> -+ -+ <li><a href= -+ "ada/terminal_interface-curses-forms-field_user_data__ads.htm"> -+ Field_User_Data</a></li> -+ -+ <li> -+ <a href= -+ "ada/terminal_interface-curses-forms-field_types__ads.htm"> -+ Field_Types</a> -+ -+ <ul> -+ <li><a href= -+ "ada/terminal_interface-curses-forms-field_types-alpha__ads.htm"> -+ Alpha</a></li> -+ -+ <li><a href= -+ "ada/terminal_interface-curses-forms-field_types-alphanumeric__ads.htm"> -+ AlphaNumeric</a></li> -+ -+ <li><a href= -+ "ada/terminal_interface-curses-forms-field_types-intfield__ads.htm"> -+ IntField</a></li> -+ -+ <li><a href= -+ "ada/terminal_interface-curses-forms-field_types-numeric__ads.htm"> -+ Numeric</a></li> -+ -+ <li><a href= -+ "ada/terminal_interface-curses-forms-field_types-regexp__ads.htm"> -+ RegExp</a></li> -+ -+ <li><a href= -+ "ada/terminal_interface-curses-forms-field_types-ipv4_address__ads.htm"> -+ IPV4_Address</a></li> -+ -+ <li> -+ <a href= -+ "ada/terminal_interface-curses-forms-field_types-enumeration__ads.htm"> -+ Enumeration</a> -+ -+ <ul> -+ <li><a href= -+ "ada/terminal_interface-curses-forms-field_types-enumeration-ada__ads.htm"> -+ Ada</a></li> -+ </ul> -+ </li> -+ -+ <li> -+ <a href= -+ "ada/terminal_interface-curses-forms-field_types-user__ads.htm"> -+ User</a> -+ -+ <ul> -+ <li><a href= -+ "ada/terminal_interface-curses-forms-field_types-user-choice__ads.htm"> -+ Choice</a></li> -+ </ul> -+ </li> -+ </ul> -+ </li> -+ </ul> -+ </li> -+ -+ <li> -+ <a href= -+ "ada/terminal_interface-curses-text_io__ads.htm">Text_IO</a> -+ -+ <ul> -+ <li><a href= -+ "ada/terminal_interface-curses-text_io-integer_io__ads.htm"> -+ Integer_IO</a></li> -+ -+ <li><a href= -+ "ada/terminal_interface-curses-text_io-float_io__ads.htm"> -+ Float_IO</a></li> -+ -+ <li><a href= -+ "ada/terminal_interface-curses-text_io-fixed_io__ads.htm"> -+ Fixed_IO</a></li> -+ -+ <li><a href= -+ "ada/terminal_interface-curses-text_io-decimal_io__ads.htm"> -+ Decimal_IO</a></li> -+ -+ <li><a href= -+ "ada/terminal_interface-curses-text_io-modular_io__ads.htm"> -+ Modular_IO</a></li> -+ -+ <li><a href= -+ "ada/terminal_interface-curses-text_io-enumeration_io__ads.htm"> -+ Enumeration_IO</a></li> -+ -+ <li><a href= -+ "ada/terminal_interface-curses-text_io-complex_io__ads.htm"> -+ Complex_IO</a></li> -+ </ul> -+ </li> -+ </ul> -+ </li> -+ </ul> -+ </li> -+ </ul> -+ -+ <p>If you want to navigate through the html pages of the package -+ specs, click <a href="ada/index.htm">here</a>.</p> -+ -+ <h2>Implementation Details</h2> -+ -+ <h4>Behind the abstraction</h4> -+ -+ <p>All the new types like <strong>Window</strong>, -+ <strong>Panel</strong>, <strong>Menu</strong>, -+ <strong>Form</strong> etc. are just opaque representations of the -+ pointers to the corresponding low level (n)curses structures like -+ <strong>WINDOW *</strong>, <strong>PANEL *</strong>, <strong>MENU -+ *</strong> or <strong>FORM *</strong>. So you can safely pass -+ them to C routines that expect a pointer to one of those -+ structures.</p> -+ -+ <h4>Extended ripoffline() usage</h4> -+ -+ <p>The official documentation of (n)curses says, that the line -+ parameter determines only whether or not exactly -+ <strong>one</strong> line is stolen from the top or bottom of the -+ screen. So essentially only the sign of the parameter is -+ evaluated. ncurses has internally implemented it in a way, that -+ uses the line parameter also to control the amount of lines to -+ steal. This mechanism is used in the -+ <strong>Rip_Off_Lines</strong> routine of the binding.</p> -+ -+ <h4><a name="userpointer" id="userpointer">How user defined field -+ types work</a></h4> -+ -+ <p>TBD</p> -+ -+ <h4>Enumeration fields handling</h4> -+ -+ <p>The (n)curses documentation says, that the String arrays to be -+ passed to an TYPE_ENUM fieldtype must not be automatic variables. -+ This is not true in this binding, because it is internally -+ arranged to safely copy these values.</p> -+ -+ <h4><a name="compiler" id="compiler">Using other Ada -+ compilers</a></h4> -+ -+ <p>This should basically not be a problem.</p> -+ -+ <h4>Port to other curses implementations</h4> -+ -+ <p>Basically it should not be too hard to make all this run on a -+ regular SVr4 implementation of curses. The problems are probably -+ these:<br></p> -+ -+ <ul> -+ <li>ncurses has some additional features which are presented in -+ this binding. You have two choices to deal with this: -+ -+ <ul> -+ <li>Emulate the feature in this binding</li> -+ -+ <li>Raise an exception for non implemented features</li> -+ </ul> -+ -+ <p>Most likely you will follow a mixed approach. Some -+ features are easy to simulate, others will be hard if not -+ impossible.</p> -+ </li> -+ </ul> -+ -+ <p>I'm quite sure I forgot something.</p> -+</body> -+</html> -diff -Naur ncurses-5.9/doc/html/announce.html ncurses-5.9.patch/doc/html/announce.html ---- ncurses-5.9/doc/html/announce.html 2011-04-04 11:46:33.000000000 +0200 -+++ ncurses-5.9.patch/doc/html/announce.html 2014-09-01 16:33:22.315792055 +0200 -@@ -1,6 +1,6 @@ --<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- -- $Id: announce.html,v 1.55 2011/04/04 09:46:33 tom Exp $ -+ $Id: announce.html,v 1.56 2013/05/17 23:34:26 tom Exp $ - **************************************************************************** - * Copyright (c) 1998-2010,2011 Free Software Foundation, Inc. * - * * -diff -Naur ncurses-5.9/doc/html/hackguide.html ncurses-5.9.patch/doc/html/hackguide.html ---- ncurses-5.9/doc/html/hackguide.html 2010-12-04 17:44:21.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/hackguide.html 2014-09-01 16:33:22.315792055 +0200 -@@ -1,8 +1,8 @@ --<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- -- $Id: hackguide.html,v 1.28 2010/12/04 16:44:21 tom Exp $ -+ $Id: hackguide.html,v 1.29 2013/05/17 23:29:18 tom Exp $ - **************************************************************************** -- * Copyright (c) 1998-2005,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -diff -Naur ncurses-5.9/doc/html/index.html ncurses-5.9.patch/doc/html/index.html ---- ncurses-5.9/doc/html/index.html 2010-12-04 19:36:44.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/index.html 2014-09-01 16:33:22.315792055 +0200 -@@ -1,8 +1,8 @@ --<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- -- $Id: index.html,v 1.5 2010/12/04 18:36:44 tom Exp $ -+ $Id: index.html,v 1.6 2013/05/17 23:30:29 tom Exp $ - **************************************************************************** -- * Copyright (c) 1998-2006,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2010,2013 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -diff -Naur ncurses-5.9/doc/html/man/adacurses-config.1.html ncurses-5.9.patch/doc/html/man/adacurses-config.1.html ---- ncurses-5.9/doc/html/man/adacurses-config.1.html 2011-04-05 00:46:28.000000000 +0200 -+++ ncurses-5.9.patch/doc/html/man/adacurses-config.1.html 2014-09-01 16:33:22.315792055 +0200 -@@ -1,4 +1,4 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - **************************************************************************** - * Copyright (c) 2010,2011 Free Software Foundation, Inc. * -@@ -83,7 +83,7 @@ - <H2>SEE ALSO</H2><PRE> - <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG> - -- This describes <STRONG>ncurses</STRONG> version 5.9 (patch 20110404). -+ This describes <STRONG>ncurses</STRONG> version 5.9 (patch 20131221). - - - -diff -Naur ncurses-5.9/doc/html/man/captoinfo.1m.html ncurses-5.9.patch/doc/html/man/captoinfo.1m.html ---- ncurses-5.9/doc/html/man/captoinfo.1m.html 2011-04-05 00:46:28.000000000 +0200 -+++ ncurses-5.9.patch/doc/html/man/captoinfo.1m.html 2014-09-01 16:33:22.316792056 +0200 -@@ -1,4 +1,4 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - * t - **************************************************************************** -@@ -87,8 +87,8 @@ - - </PRE> - <H2>FILES</H2><PRE> -- /usr/share/terminfo Compiled terminal description -- database. -+ /usr/share/terminfo Compiled terminal description data- -+ base. - - - </PRE> -@@ -101,7 +101,6 @@ - has not mistakenly translated a completely unknown and - random capability and/or syntax error. - -- - Nonstd Std From Terminfo - name name capability - ----------------------------------------------- -@@ -116,8 +115,8 @@ - EN @7 XENIX key_end - GE ae XENIX exit_alt_charset_mode - GS as XENIX enter_alt_charset_mode -- - HM kh XENIX key_home -+ - LD kL XENIX key_dl - PD kN XENIX key_npage - PN po XENIX prtr_off -@@ -139,7 +138,6 @@ - bilities for forms drawing, designed to take advantage of - the IBM PC high-half graphics. They were as follows: - -- - Cap Graphic - ----------------------------- - G2 upper left -@@ -182,7 +180,6 @@ - font0 s0ds - font1 s1ds - font2 s2ds -- - font3 s3ds - - Additionally, the AIX <EM>box1</EM> capability will be automati- -@@ -208,7 +205,7 @@ - <H2>SEE ALSO</H2><PRE> - <STRONG><A HREF="infocmp.1m.html">infocmp(1m)</A></STRONG>, <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>, <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG> - -- This describes <STRONG>ncurses</STRONG> version 5.9 (patch 20110404). -+ This describes <STRONG>ncurses</STRONG> version 5.9 (patch 20131221). - - - </PRE> -diff -Naur ncurses-5.9/doc/html/man/clear.1.html ncurses-5.9.patch/doc/html/man/clear.1.html ---- ncurses-5.9/doc/html/man/clear.1.html 2011-04-05 00:46:28.000000000 +0200 -+++ ncurses-5.9.patch/doc/html/man/clear.1.html 2014-09-01 16:33:22.316792056 +0200 -@@ -1,7 +1,7 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - **************************************************************************** -- * Copyright (c) 1998-2006,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2010,2013 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -27,7 +27,7 @@ - * sale, use or other dealings in this Software without prior written * - * authorization. * - **************************************************************************** -- * @Id: clear.1,v 1.8 2010/12/04 18:36:44 tom Exp @ -+ * @Id: clear.1,v 1.10 2013/06/22 22:22:11 tom Exp @ - --> - <HTML> - <HEAD> -@@ -57,9 +57,11 @@ - - </PRE> - <H2>DESCRIPTION</H2><PRE> -- <STRONG>clear</STRONG> clears your screen if this is possible. It looks in -- the environment for the terminal type and then in the <STRONG>ter-</STRONG> -- <STRONG>minfo</STRONG> database to figure out how to clear the screen. -+ <STRONG>clear</STRONG> clears your screen if this is possible, including -+ its scrollback buffer (if the extended "E3" capability is -+ defined). <STRONG>clear</STRONG> looks in the environment for the terminal -+ type and then in the <STRONG>terminfo</STRONG> database to determine how to -+ clear the screen. - - <STRONG>clear</STRONG> ignores any command-line parameters that may be - present. -@@ -69,7 +71,7 @@ - <H2>SEE ALSO</H2><PRE> - <STRONG><A HREF="tput.1.html">tput(1)</A></STRONG>, <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG> - -- This describes <STRONG>ncurses</STRONG> version 5.9 (patch 20110404). -+ This describes <STRONG>ncurses</STRONG> version 5.9 (patch 20131221). - - - -diff -Naur ncurses-5.9/doc/html/man/curs_addch.3x.html ncurses-5.9.patch/doc/html/man/curs_addch.3x.html ---- ncurses-5.9/doc/html/man/curs_addch.3x.html 2011-02-26 00:24:50.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/curs_addch.3x.html 2014-09-01 16:33:22.316792056 +0200 -@@ -1,4 +1,4 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - * t - **************************************************************************** -@@ -70,7 +70,7 @@ - The <STRONG>addch</STRONG>, <STRONG>waddch</STRONG>, <STRONG>mvaddch</STRONG> and <STRONG>mvwaddch</STRONG> routines put the - character <EM>ch</EM> into the given window at its current window - position, which is then advanced. They are analogous to -- <STRONG>putchar</STRONG> in <STRONG><A HREF="stdio.3.html">stdio(3)</A></STRONG>. If the advance is at the right mar- -+ <STRONG>putchar</STRONG> in <STRONG>stdio(3)</STRONG>. If the advance is at the right mar- - gin, the cursor automatically wraps to the beginning of - the next line. At the bottom of the current scrolling - region, if <STRONG>scrollok</STRONG> is enabled, the scrolling region is -@@ -112,9 +112,8 @@ - characters to the screen with routines of the <STRONG>addch</STRONG> fam- - ily. The default character listed below is used if the - <STRONG>acsc</STRONG> capability does not define a terminal-specific -- replacement for it. The names are taken from VT100 -- nomenclature. -- -+ replacement for it. The names are taken from VT100 nomen- -+ clature. - - <EM>Name</EM> <EM>Default</EM> <EM>Description</EM> - -------------------------------------------------- -@@ -202,7 +201,7 @@ - <H2>SEE ALSO</H2><PRE> - <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>, <STRONG><A HREF="curs_attr.3x.html">curs_attr(3x)</A></STRONG>, <STRONG><A HREF="curs_clear.3x.html">curs_clear(3x)</A></STRONG>, <STRONG><A HREF="curs_inch.3x.html">curs_inch(3x)</A></STRONG>, - <STRONG><A HREF="curs_outopts.3x.html">curs_outopts(3x)</A></STRONG>, <STRONG><A HREF="curs_refresh.3x.html">curs_refresh(3x)</A></STRONG>, <STRONG><A HREF="curs_variables.3x.html">curs_variables(3x)</A></STRONG>, -- <STRONG><A HREF="putc.3.html">putc(3)</A></STRONG>. -+ <STRONG>putc(3)</STRONG>. - - Comparable functions in the wide-character (ncursesw) - library are described in <STRONG><A HREF="curs_add_wch.3x.html">curs_add_wch(3x)</A></STRONG>. -diff -Naur ncurses-5.9/doc/html/man/curs_addchstr.3x.html ncurses-5.9.patch/doc/html/man/curs_addchstr.3x.html ---- ncurses-5.9/doc/html/man/curs_addchstr.3x.html 2011-01-09 02:03:04.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/curs_addchstr.3x.html 2014-09-01 16:33:22.316792056 +0200 -@@ -1,7 +1,7 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - **************************************************************************** -- * Copyright (c) 1998-2006,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -27,7 +27,7 @@ - * sale, use or other dealings in this Software without prior written * - * authorization. * - **************************************************************************** -- * @Id: curs_addchstr.3x,v 1.15 2010/12/04 18:36:44 tom Exp @ -+ * @Id: curs_addchstr.3x,v 1.16 2012/11/03 22:54:43 tom Exp @ - --> - <HTML> - <HEAD> -@@ -62,62 +62,63 @@ - <STRONG>int</STRONG> <STRONG>waddchnstr(WINDOW</STRONG> <STRONG>*win,</STRONG> <STRONG>const</STRONG> <STRONG>chtype</STRONG> <STRONG>*chstr,</STRONG> <STRONG>int</STRONG> <STRONG>n);</STRONG> - <STRONG>int</STRONG> <STRONG>mvaddchstr(int</STRONG> <STRONG>y,</STRONG> <STRONG>int</STRONG> <STRONG>x,</STRONG> <STRONG>const</STRONG> <STRONG>chtype</STRONG> <STRONG>*chstr);</STRONG> - <STRONG>int</STRONG> <STRONG>mvaddchnstr(int</STRONG> <STRONG>y,</STRONG> <STRONG>int</STRONG> <STRONG>x,</STRONG> <STRONG>const</STRONG> <STRONG>chtype</STRONG> <STRONG>*chstr,</STRONG> <STRONG>int</STRONG> <STRONG>n);</STRONG> -- <STRONG>int</STRONG> <STRONG>mvwaddchstr(WINDOW</STRONG> <STRONG>*win,</STRONG> <STRONG>int</STRONG> <STRONG>y,</STRONG> <STRONG>int</STRONG> <STRONG>x,</STRONG> <STRONG>const</STRONG> <STRONG>chtype</STRONG> -- <STRONG>*chstr);</STRONG> -- <STRONG>int</STRONG> <STRONG>mvwaddchnstr(WINDOW</STRONG> <STRONG>*win,</STRONG> <STRONG>int</STRONG> <STRONG>y,</STRONG> <STRONG>int</STRONG> <STRONG>x,</STRONG> <STRONG>const</STRONG> <STRONG>chtype</STRONG> -- <STRONG>*chstr,</STRONG> <STRONG>int</STRONG> <STRONG>n);</STRONG> -+ <STRONG>int</STRONG> <STRONG>mvwaddchstr(WINDOW</STRONG> <STRONG>*win,</STRONG> <STRONG>int</STRONG> <STRONG>y,</STRONG> <STRONG>int</STRONG> <STRONG>x,</STRONG> <STRONG>const</STRONG> <STRONG>chtype</STRONG> <STRONG>*chstr);</STRONG> -+ <STRONG>int</STRONG> <STRONG>mvwaddchnstr(WINDOW</STRONG> <STRONG>*win,</STRONG> <STRONG>int</STRONG> <STRONG>y,</STRONG> <STRONG>int</STRONG> <STRONG>x,</STRONG> <STRONG>const</STRONG> <STRONG>chtype</STRONG> <STRONG>*chstr,</STRONG> <STRONG>int</STRONG> <STRONG>n);</STRONG> - - - </PRE> - <H2>DESCRIPTION</H2><PRE> -- These routines copy <EM>chstr</EM> into the window image structure -- at and after the current cursor position. The four rou- -- tines with <EM>n</EM> as the last argument copy at most <EM>n</EM> elements, -- but no more than will fit on the line. If <STRONG>n</STRONG>=<STRONG>-1</STRONG> then the -- whole string is copied, to the maximum number of charac- -- ters that will fit on the line. -- -- The window cursor is <EM>not</EM> advanced, and these routines work -- faster than <STRONG>waddnstr</STRONG>. On the other hand, they do not per- -- form any kind of checking (such as for the newline, -- backspace, or carriage return characters), they do not ad- -- vance the current cursor position, they do not expand oth- -- er control characters to ^-escapes, and they truncate the -- string if it crosses the right margin, rather than wrap- -- ping it around to the new line. -+ These functions copy the (null-terminated) <EM>chstr</EM> array in- -+ to the window image structure starting at the current cur- -+ sor position. The four functions with <EM>n</EM> as the last argu- -+ ment copy at most <EM>n</EM> elements, but no more than will fit on -+ the line. If <STRONG>n</STRONG>=<STRONG>-1</STRONG> then the whole array is copied, to the -+ maximum number of characters that will fit on the line. -+ -+ The window cursor is <EM>not</EM> advanced. These functions work -+ faster than <STRONG>waddnstr</STRONG>. On the other hand: -+ -+ <STRONG>o</STRONG> they do not perform checking (such as for the newline, -+ backspace, or carriage return characters), -+ -+ <STRONG>o</STRONG> they do not advance the current cursor position, -+ -+ <STRONG>o</STRONG> they do not expand other control characters to ^-es- -+ capes, and -+ -+ <STRONG>o</STRONG> they truncate the string if it crosses the right mar- -+ gin, rather than wrapping it around to the new line. - - - </PRE> --<H2>RETURN VALUES</H2><PRE> -- All routines return the integer <STRONG>ERR</STRONG> upon failure and <STRONG>OK</STRONG> on -- success (the SVr4 manuals specify only "an integer value -- other than <STRONG>ERR</STRONG>") upon successful completion, unless other- -- wise noted in the preceding routine descriptions. -+<H2>RETURN VALUE</H2><PRE> -+ All functions return the integer <STRONG>ERR</STRONG> upon failure and <STRONG>OK</STRONG> -+ on success. - -- X/Open does not define any error conditions. This imple- -+ X/Open does not define any error conditions. This imple- - mentation returns an error if the window pointer is null. - -- Functions with a "mv" prefix first perform a cursor move- -- ment using <STRONG>wmove</STRONG>, and return an error if the position is -+ Functions with a "mv" prefix first perform a cursor move- -+ ment using <STRONG>wmove</STRONG>, and return an error if the position is - outside the window, or if the window pointer is null. - - - </PRE> - <H2>NOTES</H2><PRE> -- Note that all routines except <STRONG>waddchnstr</STRONG> may be macros. -+ All functions except <STRONG>waddchnstr</STRONG> may be macros. - - - </PRE> - <H2>PORTABILITY</H2><PRE> -- These entry points are described in the XSI Curses stan- -+ These entry points are described in the XSI Curses stan- - dard, Issue 4. - - - </PRE> - <H2>SEE ALSO</H2><PRE> -- <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>. -+ <STRONG><A HREF="curs_addstr.3x.html">curs_addstr(3x)</A></STRONG>, <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>. - -- Comparable functions in the wide-character (ncursesw) li- -+ Comparable functions in the wide-character (ncursesw) li- - brary are described in <STRONG><A HREF="curs_add_wchstr.3x.html">curs_add_wchstr(3x)</A></STRONG>. - - -diff -Naur ncurses-5.9/doc/html/man/curs_addstr.3x.html ncurses-5.9.patch/doc/html/man/curs_addstr.3x.html ---- ncurses-5.9/doc/html/man/curs_addstr.3x.html 2011-01-09 02:03:05.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/curs_addstr.3x.html 2014-09-01 16:33:22.317792058 +0200 -@@ -1,7 +1,7 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - **************************************************************************** -- * Copyright (c) 1998-2005,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -27,7 +27,7 @@ - * sale, use or other dealings in this Software without prior written * - * authorization. * - **************************************************************************** -- * @Id: curs_addstr.3x,v 1.16 2010/12/04 18:36:44 tom Exp @ -+ * @Id: curs_addstr.3x,v 1.17 2012/11/03 22:57:31 tom Exp @ - --> - <HTML> - <HEAD> -@@ -68,26 +68,32 @@ - - </PRE> - <H2>DESCRIPTION</H2><PRE> -- These routines write the characters of the (null-terminat- -- ed) character string <EM>str</EM> on the given window. It is simi- -- lar to calling <STRONG>waddch</STRONG> once for each character in the -- string. The four routines with <EM>n</EM> as the last argument -- write at most <EM>n</EM> characters. If <EM>n</EM> is -1, then the entire -- string will be added, up to the maximum number of charac- -- ters that will fit on the line, or until a terminating -- null is reached. -+ These functions write the (null-terminated) character -+ string <EM>str</EM> on the given window. It is similar to calling -+ <STRONG>waddch</STRONG> once for each character in the string. -+ -+ The <EM>mv</EM> functions perform cursor movement once, before -+ writing any characters. Thereafter, the cursor is ad- -+ vanced as a side-effect of writing to the window. -+ -+ The four functions with <EM>n</EM> as the last argument write at -+ most <EM>n</EM> characters, or until a terminating null is reached. -+ If <EM>n</EM> is -1, then the entire string will be added. - - - </PRE> - <H2>RETURN VALUE</H2><PRE> -- All routines return the integer <STRONG>ERR</STRONG> upon failure and <STRONG>OK</STRONG> on -- success (the SVr4 manuals specify only "an integer value -- other than <STRONG>ERR</STRONG>") upon successful completion. -+ All functions return the integer <STRONG>ERR</STRONG> upon failure and <STRONG>OK</STRONG> -+ on success. - - X/Open does not define any error conditions. This imple- -- mentation returns an error if the window pointer is null -- or if the string pointer is null or if the corresponding -- calls to <STRONG>waddch</STRONG> return an error. -+ mentation returns an error -+ -+ <STRONG>o</STRONG> if the window pointer is null or -+ -+ <STRONG>o</STRONG> if the string pointer is null or -+ -+ <STRONG>o</STRONG> if the corresponding calls to <STRONG>waddch</STRONG> return an error. - - Functions with a "mv" prefix first perform a cursor move- - ment using <STRONG>wmove</STRONG>, and return an error if the position is -@@ -96,16 +102,13 @@ - - </PRE> - <H2>NOTES</H2><PRE> -- Note that all of these routines except <STRONG>waddstr</STRONG> and -- <STRONG>waddnstr</STRONG> may be macros. -+ All of these functions except <STRONG>waddnstr</STRONG> may be macros. - - - </PRE> - <H2>PORTABILITY</H2><PRE> -- All these entry points are described in the XSI Curses -- standard, Issue 4. The XSI errors EILSEQ and EOVERFLOW, -- associated with extended-level conformance, are not yet -- detected. -+ These functions are described in the XSI Curses standard, -+ Issue 4. - - - </PRE> -diff -Naur ncurses-5.9/doc/html/man/curs_add_wch.3x.html ncurses-5.9.patch/doc/html/man/curs_add_wch.3x.html ---- ncurses-5.9/doc/html/man/curs_add_wch.3x.html 2011-02-26 00:24:49.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/curs_add_wch.3x.html 2014-09-01 16:33:22.316792056 +0200 -@@ -1,7 +1,7 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - **************************************************************************** -- * Copyright (c) 2001-2010,2011 Free Software Foundation, Inc. * -+ * Copyright (c) 2001-2011,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -27,7 +27,7 @@ - * sale, use or other dealings in this Software without prior written * - * authorization. * - **************************************************************************** -- * @Id: curs_add_wch.3x,v 1.14 2011/01/15 15:27:43 tom Exp @ -+ * @Id: curs_add_wch.3x,v 1.15 2012/11/03 23:03:59 tom Exp @ - --> - <HTML> - <HEAD> -@@ -77,17 +77,17 @@ - ous character at that location is removed. A new - character specified by <EM>wch</EM> is placed at that location - with rendition specified by <EM>wch</EM>. The cursor then -- advances to the next spacing character on the screen. -+ advances to the next spacing character on the screen. - - <STRONG>o</STRONG> If <EM>wch</EM> refers to a non-spacing character, all previous -- characters at that location are preserved. The non- -- spacing characters of <EM>wch</EM> are added to the spacing -- complex character, and the rendition specified by <EM>wch</EM> -+ characters at that location are preserved. The non- -+ spacing characters of <EM>wch</EM> are added to the spacing -+ complex character, and the rendition specified by <EM>wch</EM> - is ignored. - -- <STRONG>o</STRONG> If the character part of <EM>wch</EM> is a tab, newline, -- backspace or other control character, the window is -- updated and the cursor moves as if <STRONG>addch</STRONG> were called. -+ <STRONG>o</STRONG> If the character part of <EM>wch</EM> is a tab, newline, -+ backspace or other control character, the window is -+ updated and the cursor moves as if <STRONG>addch</STRONG> were called. - - The <STRONG>echo_wchar</STRONG> function is functionally equivalent to a - call to <STRONG>add_wch</STRONG> followed by a call to <STRONG>refresh</STRONG>. Similarly, -@@ -99,11 +99,10 @@ - functions instead of their equivalents. - - <STRONG>Line</STRONG> <STRONG>Graphics</STRONG> -- Like <STRONG><A HREF="addch.3x.html">addch(3x)</A></STRONG>, <STRONG>addch_wch</STRONG> accepts symbols which make it -+ Like <STRONG><A HREF="curs_addch.3x.html">curs_addch(3x)</A></STRONG>, <STRONG>addch_wch</STRONG> accepts symbols which make it - simple to draw lines and other frequently used special - characters. These symbols correspond to the same VT100 -- line-drawing set as <STRONG><A HREF="addch.3x.html">addch(3x)</A></STRONG>. -- -+ line-drawing set as <STRONG><A HREF="curs_addch.3x.html">curs_addch(3x)</A></STRONG>. - - <EM>Name</EM> <EM>Unicode</EM> <EM>Default</EM> <EM>Description</EM> - ---------------------------------------------------------------- -@@ -111,8 +110,8 @@ - WACS_BOARD 0x2592 # board of squares - WACS_BTEE 0x2534 + bottom tee - WACS_BULLET 0x00b7 o bullet -- - WACS_CKBOARD 0x2592 : checker board (stipple) -+ - WACS_DARROW 0x2193 v arrow pointing down - WACS_DEGREE 0x00b0 ' degree symbol - WACS_DIAMOND 0x25c6 + diamond -@@ -144,7 +143,6 @@ - The wide-character configuration of ncurses also defines - symbols for thick- and double-lines: - -- - <EM>Name</EM> <EM>Unicode</EM> <EM>Default</EM> <EM>Description</EM> - --------------------------------------------------------------------- - WACS_T_ULCORNER 0x250f + thick upper left corner -@@ -172,7 +170,7 @@ - - - </PRE> --<H2>RETURN VALUES</H2><PRE> -+<H2>RETURN VALUE</H2><PRE> - All routines return the integer <STRONG>ERR</STRONG> upon failure and <STRONG>OK</STRONG> on - success. - -@@ -217,7 +215,7 @@ - </PRE> - <H2>SEE ALSO</H2><PRE> - <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>, <STRONG><A HREF="curs_addch.3x.html">curs_addch(3x)</A></STRONG>, <STRONG><A HREF="curs_attr.3x.html">curs_attr(3x)</A></STRONG>, <STRONG><A HREF="curs_clear.3x.html">curs_clear(3x)</A></STRONG>, -- <STRONG><A HREF="curs_outopts.3x.html">curs_outopts(3x)</A></STRONG>, <STRONG><A HREF="curs_refresh.3x.html">curs_refresh(3x)</A></STRONG>, <STRONG><A HREF="putwc.3.html">putwc(3)</A></STRONG> -+ <STRONG><A HREF="curs_outopts.3x.html">curs_outopts(3x)</A></STRONG>, <STRONG><A HREF="curs_refresh.3x.html">curs_refresh(3x)</A></STRONG>, <STRONG>putwc(3)</STRONG> - - - -diff -Naur ncurses-5.9/doc/html/man/curs_add_wchstr.3x.html ncurses-5.9.patch/doc/html/man/curs_add_wchstr.3x.html ---- ncurses-5.9/doc/html/man/curs_add_wchstr.3x.html 2011-01-09 02:03:05.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/curs_add_wchstr.3x.html 2014-09-01 16:33:22.316792056 +0200 -@@ -1,7 +1,7 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - **************************************************************************** -- * Copyright (c) 2002-2005,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 2002-2010,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -27,7 +27,7 @@ - * sale, use or other dealings in this Software without prior written * - * authorization. * - **************************************************************************** -- * @Id: curs_add_wchstr.3x,v 1.9 2010/12/04 18:36:44 tom Exp @ -+ * @Id: curs_add_wchstr.3x,v 1.10 2012/11/03 22:54:43 tom Exp @ - --> - <HTML> - <HEAD> -@@ -47,7 +47,7 @@ - - </PRE> - <H2>NAME</H2><PRE> -- <STRONG>add_wchstr</STRONG>, <STRONG>add_wchnstr</STRONG>, <STRONG>wadd_wchstr</STRONG>, <STRONG>wadd_wchnstr</STRONG>, -+ <STRONG>add_wchstr</STRONG>, <STRONG>add_wchnstr</STRONG>, <STRONG>wadd_wchstr</STRONG>, <STRONG>wadd_wchnstr</STRONG>, - <STRONG>mvadd_wchstr</STRONG>, <STRONG>mvadd_wchnstr</STRONG>, <STRONG>mvwadd_wchstr</STRONG>, <STRONG>mvwadd_wchnstr</STRONG> - - add an array of complex characters (and attributes) to a - curses window -@@ -69,39 +69,42 @@ - - </PRE> - <H2>DESCRIPTION</H2><PRE> -- These routines copy the array of complex characters <EM>wchstr</EM> -- into the window image structure at and after the current -- cursor position. The four routines with <EM>n</EM> as the last -- argument copy at most <EM>n</EM> elements, but no more than will -- fit on the line. If <STRONG>n</STRONG>=<STRONG>-1</STRONG> then the whole array is copied, -- to the maximum number of characters that will fit on the -- line. -- -- The window cursor is <EM>not</EM> advanced. These routines work -- faster than <STRONG>waddnstr</STRONG>. On the other hand, they do not per- -- form checking (such as for the newline, backspace, or car- -- riage return characters), they do not advance the current -- cursor position, they do not expand other control charac- -- ters to ^-escapes, and they truncate the string if it -- crosses the right margin, rather than wrapping it around -- to the new line. -- -- These routines end successfully on encountering a null -- <EM>cchar</EM><STRONG>_</STRONG><EM>t</EM>, or when they have filled the current line. If a -- complex character cannot completely fit at the end of the -- current line, the remaining columns are filled with the -+ These functions copy the (null-terminated) array of com- -+ plex characters <EM>wchstr</EM> into the window image structure -+ starting at the current cursor position. The four func- -+ tions with <EM>n</EM> as the last argument copy at most <EM>n</EM> elements, -+ but no more than will fit on the line. If <STRONG>n</STRONG>=<STRONG>-1</STRONG> then the -+ whole array is copied, to the maximum number of characters -+ that will fit on the line. -+ -+ The window cursor is <EM>not</EM> advanced. These functions work -+ faster than <STRONG>waddnstr</STRONG>. On the other hand: -+ -+ <STRONG>o</STRONG> they do not perform checking (such as for the newline, -+ backspace, or carriage return characters), -+ -+ <STRONG>o</STRONG> they do not advance the current cursor position, -+ -+ <STRONG>o</STRONG> they do not expand other control characters to ^-es- -+ capes, and -+ -+ <STRONG>o</STRONG> they truncate the string if it crosses the right mar- -+ gin, rather than wrapping it around to the new line. -+ -+ These functions end successfully on encountering a null -+ <EM>cchar</EM><STRONG>_</STRONG><EM>t</EM>, or when they have filled the current line. If a -+ complex character cannot completely fit at the end of the -+ current line, the remaining columns are filled with the - background character and rendition. - - - </PRE> --<H2>NOTES</H2><PRE> -- All functions except <STRONG>wadd_wchnstr</STRONG> may be macros. -+<H2>RETURN VALUE</H2><PRE> -+ All functions return the integer <STRONG>ERR</STRONG> upon failure and <STRONG>OK</STRONG> -+ on success. - -- --</PRE> --<H2>RETURN VALUES</H2><PRE> -- All routines return the integer <STRONG>ERR</STRONG> upon failure and <STRONG>OK</STRONG> on -- success. -+ X/Open does not define any error conditions. This imple- -+ mentation returns an error if the window pointer is null. - - Functions with a "mv" prefix first perform a cursor move- - ment using <STRONG>wmove</STRONG>, and return an error if the position is -@@ -109,14 +112,22 @@ - - - </PRE> -+<H2>NOTES</H2><PRE> -+ All functions except <STRONG>wadd_wchnstr</STRONG> may be macros. -+ -+ -+</PRE> - <H2>PORTABILITY</H2><PRE> -- All these entry points are described in the XSI Curses -- standard, Issue 4. -+ These entry points are described in the XSI Curses stan- -+ dard, Issue 4. - - - </PRE> - <H2>SEE ALSO</H2><PRE> -- <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>, <STRONG><A HREF="curs_addchstr.3x.html">curs_addchstr(3x)</A></STRONG>, <STRONG><A HREF="curs_addwstr.3x.html">curs_addwstr(3x)</A></STRONG> -+ <STRONG><A HREF="curs_addwstr.3x.html">curs_addwstr(3x)</A></STRONG>, <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>. -+ -+ Comparable functions in the narrow-character (ncurses) li- -+ brary are described in <STRONG><A HREF="curs_addchstr.3x.html">curs_addchstr(3x)</A></STRONG>. - - - -diff -Naur ncurses-5.9/doc/html/man/curs_addwstr.3x.html ncurses-5.9.patch/doc/html/man/curs_addwstr.3x.html ---- ncurses-5.9/doc/html/man/curs_addwstr.3x.html 2011-01-09 02:03:05.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/curs_addwstr.3x.html 2014-09-01 16:33:22.317792058 +0200 -@@ -1,7 +1,7 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - **************************************************************************** -- * Copyright (c) 2002-2006,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 2002-2010,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -27,7 +27,7 @@ - * sale, use or other dealings in this Software without prior written * - * authorization. * - **************************************************************************** -- * @Id: curs_addwstr.3x,v 1.10 2010/12/04 18:36:44 tom Exp @ -+ * @Id: curs_addwstr.3x,v 1.11 2012/11/03 22:57:31 tom Exp @ - --> - <HTML> - <HEAD> -@@ -68,43 +68,51 @@ - - </PRE> - <H2>DESCRIPTION</H2><PRE> -- These routines write the characters of the (null-terminat- -- ed) <STRONG>wchar_t</STRONG> character string <EM>wstr</EM> on the given window. It -- is similar to constructing a <STRONG>cchar_t</STRONG> for each wchar_t in -- the string, then calling <STRONG>wadd_wch</STRONG> for the resulting -+ These functions write the characters of the (null-termi- -+ nated) <STRONG>wchar_t</STRONG> character string <EM>wstr</EM> on the given window. -+ It is similar to constructing a <STRONG>cchar_t</STRONG> for each wchar_t -+ in the string, then calling <STRONG>wadd_wch</STRONG> for the resulting - <STRONG>cchar_t</STRONG>. - -- The <EM>mv</EM> routines perform cursor movement once, before writ- -- ing any characters. Thereafter, the cursor is advanced as -- a side-effect of writing to the window. -+ The <EM>mv</EM> functions perform cursor movement once, before -+ writing any characters. Thereafter, the cursor is ad- -+ vanced as a side-effect of writing to the window. - -- The four routines with <EM>n</EM> as the last argument write at -- most <EM>n</EM> <STRONG>wchar_t</STRONG> characters. If <EM>n</EM> is -1, then the entire -- string will be added, up to the maximum number of charac- -- ters that will fit on the line, or until a terminating -- null is reached. -+ The four functions with <EM>n</EM> as the last argument write at -+ most <EM>n</EM> <STRONG>wchar_t</STRONG> characters, or until a terminating null is -+ reached. If <EM>n</EM> is -1, then the entire string will be -+ added. - - - </PRE> --<H2>RETURN VALUES</H2><PRE> -- All routines return the integer <STRONG>ERR</STRONG> upon failure and <STRONG>OK</STRONG> on -- success. -+<H2>RETURN VALUE</H2><PRE> -+ All functions return the integer <STRONG>ERR</STRONG> upon failure and <STRONG>OK</STRONG> -+ on success. - -- Functions with a "mv" prefix first perform a cursor move- -- ment using <STRONG>wmove</STRONG>, and return an error if the position is -+ X/Open does not define any error conditions. This imple- -+ mentation returns an error -+ -+ <STRONG>o</STRONG> if the window pointer is null or -+ -+ <STRONG>o</STRONG> if the string pointer is null or -+ -+ <STRONG>o</STRONG> if the corresponding calls to <STRONG>wadd_wch</STRONG> return an er- -+ ror. -+ -+ Functions with a "mv" prefix first perform a cursor move- -+ ment using <STRONG>wmove</STRONG>, and return an error if the position is - outside the window, or if the window pointer is null. - - - </PRE> - <H2>NOTES</H2><PRE> -- Note that all of these routines except <STRONG>waddnwstr</STRONG> may be -- macros. -+ All of these functions except <STRONG>waddnwstr</STRONG> may be macros. - - - </PRE> - <H2>PORTABILITY</H2><PRE> -- All these entry points are described in the XSI Curses -- standard, Issue 4. -+ These functions are described in the XSI Curses standard, -+ Issue 4. - - - </PRE> -diff -Naur ncurses-5.9/doc/html/man/curs_attr.3x.html ncurses-5.9.patch/doc/html/man/curs_attr.3x.html ---- ncurses-5.9/doc/html/man/curs_attr.3x.html 2011-02-26 00:24:50.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/curs_attr.3x.html 2014-09-01 16:33:22.317792058 +0200 -@@ -1,8 +1,8 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - * t - **************************************************************************** -- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2010,2013 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -28,7 +28,7 @@ - * sale, use or other dealings in this Software without prior written * - * authorization. * - **************************************************************************** -- * @Id: curs_attr.3x,v 1.36 2010/12/04 18:36:44 tom Exp @ -+ * @Id: curs_attr.3x,v 1.39 2013/09/21 20:39:49 Sven.Joachim Exp @ - --> - <HTML> - <HEAD> -@@ -148,19 +148,36 @@ - be passed to the routines <STRONG>attron</STRONG>, <STRONG>attroff</STRONG>, and <STRONG>attrset</STRONG>, or - OR'd with the characters passed to <STRONG>addch</STRONG>. - -+ <EM>Name</EM> <EM>Description</EM> -+ ------------------------------------------------------------ -+ <STRONG>A_NORMAL</STRONG> Normal display (no highlight) -+ <STRONG>A_STANDOUT</STRONG> Best highlighting mode of the terminal. -+ <STRONG>A_UNDERLINE</STRONG> Underlining -+ <STRONG>A_REVERSE</STRONG> Reverse video -+ <STRONG>A_BLINK</STRONG> Blinking -+ <STRONG>A_DIM</STRONG> Half bright -+ <STRONG>A_BOLD</STRONG> Extra bright or bold -+ <STRONG>A_PROTECT</STRONG> Protected mode -+ <STRONG>A_INVIS</STRONG> Invisible or blank mode -+ <STRONG>A_ALTCHARSET</STRONG> Alternate character set -+ <STRONG>A_ITALIC</STRONG> Italics (non-X/Open extension) -+ <STRONG>A_CHARTEXT</STRONG> Bit-mask to extract a character -+ <STRONG>COLOR_PAIR(</STRONG><EM>n</EM><STRONG>)</STRONG> Color-pair number <EM>n</EM> -+ -+ These video attributes are supported by <STRONG>attr_on</STRONG> and relat- -+ ed functions (which also support the attributes recognized -+ by <STRONG>attron</STRONG>, etc.): -+ -+ <EM>Name</EM> <EM>Description</EM> -+ ----------------------------------------- -+ <STRONG>WA_HORIZONTAL</STRONG> Horizontal highlight -+ <STRONG>WA_LEFT</STRONG> Left highlight -+ <STRONG>WA_LOW</STRONG> Low highlight -+ <STRONG>WA_RIGHT</STRONG> Right highlight -+ <STRONG>WA_TOP</STRONG> Top highlight -+ <STRONG>WA_VERTICAL</STRONG> Vertical highlight - -- <STRONG>A_NORMAL</STRONG> Normal display (no highlight) -- <STRONG>A_STANDOUT</STRONG> Best highlighting mode of the terminal. -- <STRONG>A_UNDERLINE</STRONG> Underlining -- <STRONG>A_REVERSE</STRONG> Reverse video -- <STRONG>A_BLINK</STRONG> Blinking -- <STRONG>A_DIM</STRONG> Half bright -- <STRONG>A_BOLD</STRONG> Extra bright or bold -- <STRONG>A_PROTECT</STRONG> Protected mode -- <STRONG>A_INVIS</STRONG> Invisible or blank mode -- <STRONG>A_ALTCHARSET</STRONG> Alternate character set -- <STRONG>A_CHARTEXT</STRONG> Bit-mask to extract a character -- <STRONG>COLOR_PAIR(</STRONG><EM>n</EM><STRONG>)</STRONG> Color-pair number <EM>n</EM> -+ For consistency - - The following macro is the reverse of <STRONG>COLOR_PAIR(</STRONG><EM>n</EM><STRONG>)</STRONG>: - -@@ -202,33 +219,44 @@ - correctly manipulate all other highlights (specifically, - <STRONG>A_ALTCHARSET</STRONG>, <STRONG>A_PROTECT</STRONG>, and <STRONG>A_INVIS</STRONG>). - -+ This implementation provides the <STRONG>A_ITALIC</STRONG> attribute for -+ terminals which have the <EM>enter</EM><STRONG>_</STRONG><EM>italics</EM><STRONG>_</STRONG><EM>mode</EM> (sitm) and <EM>ex-</EM> -+ <EM>it</EM><STRONG>_</STRONG><EM>italics</EM><STRONG>_</STRONG><EM>mode</EM> (ritm) capabilities. Italics are not men- -+ tioned in X/Open Curses. Unlike the other video at- -+ tributes, <STRONG>I_ITALIC</STRONG> is unrelated to the <EM>set</EM><STRONG>_</STRONG><EM>attributes</EM> ca- -+ pabilities. This implementation makes the assumption that -+ <EM>exit</EM><STRONG>_</STRONG><EM>attribute</EM><STRONG>_</STRONG><EM>mode</EM> may also reset italics. -+ - XSI Curses added the new entry points, <STRONG>attr_get</STRONG>, <STRONG>attr_on</STRONG>, - <STRONG>attr_off</STRONG>, <STRONG>attr_set</STRONG>, <STRONG>wattr_on</STRONG>, <STRONG>wattr_off</STRONG>, <STRONG>wattr_get</STRONG>, <STRONG>wat-</STRONG> - <STRONG>tr_set</STRONG>. These are intended to work with a new series of -- highlight macros prefixed with <STRONG>WA_</STRONG>. -- -- Older versions of this library did not force an update of -- the screen when changing the attributes. Use <STRONG>touchwin</STRONG> to -- force the screen to match the updated attributes. -+ highlight macros prefixed with <STRONG>WA_</STRONG>. The older macros have -+ direct counterparts in the newer set of names: - -+ <EM>Name</EM> <EM>Description</EM> -+ ------------------------------------------------------------ -+ <STRONG>WA_NORMAL</STRONG> Normal display (no highlight) -+ <STRONG>WA_STANDOUT</STRONG> Best highlighting mode of the terminal. -+ <STRONG>WA_UNDERLINE</STRONG> Underlining -+ <STRONG>WA_REVERSE</STRONG> Reverse video -+ <STRONG>WA_BLINK</STRONG> Blinking -+ <STRONG>WA_DIM</STRONG> Half bright -+ <STRONG>WA_BOLD</STRONG> Extra bright or bold -+ <STRONG>WA_ALTCHARSET</STRONG> Alternate character set - -- <STRONG>WA_NORMAL</STRONG> Normal display (no highlight) -- <STRONG>WA_STANDOUT</STRONG> Best highlighting mode of the terminal. -- <STRONG>WA_UNDERLINE</STRONG> Underlining -- <STRONG>WA_REVERSE</STRONG> Reverse video -- <STRONG>WA_BLINK</STRONG> Blinking -- <STRONG>WA_DIM</STRONG> Half bright -- <STRONG>WA_BOLD</STRONG> Extra bright or bold -- <STRONG>WA_ALTCHARSET</STRONG> Alternate character set -+ Older versions of this library did not force an update of -+ the screen when changing the attributes. Use <STRONG>touchwin</STRONG> to -+ force the screen to match the updated attributes. - - The XSI curses standard specifies that each pair of corre- -- sponding <STRONG>A_</STRONG> and <STRONG>WA_</STRONG>-using functions operates on the same -+ sponding <STRONG>A_</STRONG> and <STRONG>WA_</STRONG>-using functions operates on the same - current-highlight information. - - The XSI standard extended conformance level adds new high- - lights <STRONG>A_HORIZONTAL</STRONG>, <STRONG>A_LEFT</STRONG>, <STRONG>A_LOW</STRONG>, <STRONG>A_RIGHT</STRONG>, <STRONG>A_TOP</STRONG>, <STRONG>A_VER-</STRONG> -- <STRONG>TICAL</STRONG> (and corresponding <STRONG>WA_</STRONG> macros for each) which this -- implementation does not yet support. -+ <STRONG>TICAL</STRONG> (and corresponding <STRONG>WA_</STRONG> macros for each). As of Au- -+ gust 2013, no known terminal provides these highlights -+ (i.e., via the <STRONG>sgr1</STRONG> capability). - - - </PRE> -diff -Naur ncurses-5.9/doc/html/man/curs_beep.3x.html ncurses-5.9.patch/doc/html/man/curs_beep.3x.html ---- ncurses-5.9/doc/html/man/curs_beep.3x.html 2011-01-09 02:03:05.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/curs_beep.3x.html 2014-09-01 16:33:22.317792058 +0200 -@@ -1,4 +1,4 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - **************************************************************************** - * Copyright (c) 1998-2005,2010 Free Software Foundation, Inc. * -diff -Naur ncurses-5.9/doc/html/man/curs_bkgd.3x.html ncurses-5.9.patch/doc/html/man/curs_bkgd.3x.html ---- ncurses-5.9/doc/html/man/curs_bkgd.3x.html 2011-01-09 02:03:06.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/curs_bkgd.3x.html 2014-09-01 16:33:22.317792058 +0200 -@@ -1,4 +1,4 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - **************************************************************************** - * Copyright (c) 1998-2003,2010 Free Software Foundation, Inc. * -diff -Naur ncurses-5.9/doc/html/man/curs_bkgrnd.3x.html ncurses-5.9.patch/doc/html/man/curs_bkgrnd.3x.html ---- ncurses-5.9/doc/html/man/curs_bkgrnd.3x.html 2011-01-09 02:03:06.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/curs_bkgrnd.3x.html 2014-09-01 16:33:22.317792058 +0200 -@@ -1,7 +1,7 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - **************************************************************************** -- * Copyright (c) 2002-2006,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 2002-2010,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -27,7 +27,7 @@ - * sale, use or other dealings in this Software without prior written * - * authorization. * - **************************************************************************** -- * @Id: curs_bkgrnd.3x,v 1.4 2010/12/04 18:49:20 tom Exp @ -+ * @Id: curs_bkgrnd.3x,v 1.5 2012/11/03 23:03:59 tom Exp @ - --> - <HTML> - <HEAD> -@@ -102,7 +102,7 @@ - - - </PRE> --<H2>RETURN VALUES</H2><PRE> -+<H2>RETURN VALUE</H2><PRE> - The <STRONG>bkgrndset</STRONG> and <STRONG>wbkgrndset</STRONG> routines do not return a - value. - -diff -Naur ncurses-5.9/doc/html/man/curs_border.3x.html ncurses-5.9.patch/doc/html/man/curs_border.3x.html ---- ncurses-5.9/doc/html/man/curs_border.3x.html 2011-01-09 02:03:06.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/curs_border.3x.html 2014-09-01 16:33:22.318792059 +0200 -@@ -1,4 +1,4 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - **************************************************************************** - * Copyright (c) 1998-2007,2010 Free Software Foundation, Inc. * -diff -Naur ncurses-5.9/doc/html/man/curs_border_set.3x.html ncurses-5.9.patch/doc/html/man/curs_border_set.3x.html ---- ncurses-5.9/doc/html/man/curs_border_set.3x.html 2011-01-22 22:01:21.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/curs_border_set.3x.html 2014-09-01 16:33:22.318792059 +0200 -@@ -1,7 +1,7 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - **************************************************************************** -- * Copyright (c) 2002-2010,2011 Free Software Foundation, Inc. * -+ * Copyright (c) 2002-2011,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -27,7 +27,7 @@ - * sale, use or other dealings in this Software without prior written * - * authorization. * - **************************************************************************** -- * @Id: curs_border_set.3x,v 1.10 2011/01/15 12:56:18 tom Exp @ -+ * @Id: curs_border_set.3x,v 1.11 2012/11/03 23:03:59 tom Exp @ - --> - <HTML> - <HEAD> -@@ -154,7 +154,7 @@ - - - </PRE> --<H2>RETURN VALUES</H2><PRE> -+<H2>RETURN VALUE</H2><PRE> - Upon successful completion, these functions return <STRONG>OK</STRONG>. - Otherwise, they return <STRONG>ERR</STRONG>. - -diff -Naur ncurses-5.9/doc/html/man/curs_clear.3x.html ncurses-5.9.patch/doc/html/man/curs_clear.3x.html ---- ncurses-5.9/doc/html/man/curs_clear.3x.html 2011-01-09 02:03:06.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/curs_clear.3x.html 2014-09-01 16:33:22.318792059 +0200 -@@ -1,4 +1,4 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - **************************************************************************** - * Copyright (c) 1998-2007,2010 Free Software Foundation, Inc. * -diff -Naur ncurses-5.9/doc/html/man/curs_color.3x.html ncurses-5.9.patch/doc/html/man/curs_color.3x.html ---- ncurses-5.9/doc/html/man/curs_color.3x.html 2011-01-09 02:03:06.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/curs_color.3x.html 2014-09-01 16:33:22.318792059 +0200 -@@ -1,4 +1,4 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - **************************************************************************** - * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * -diff -Naur ncurses-5.9/doc/html/man/curs_delch.3x.html ncurses-5.9.patch/doc/html/man/curs_delch.3x.html ---- ncurses-5.9/doc/html/man/curs_delch.3x.html 2011-01-09 02:03:07.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/curs_delch.3x.html 2014-09-01 16:33:22.318792059 +0200 -@@ -1,4 +1,4 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - **************************************************************************** - * Copyright (c) 1998-2006,2010 Free Software Foundation, Inc. * -diff -Naur ncurses-5.9/doc/html/man/curs_deleteln.3x.html ncurses-5.9.patch/doc/html/man/curs_deleteln.3x.html ---- ncurses-5.9/doc/html/man/curs_deleteln.3x.html 2011-01-09 02:03:07.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/curs_deleteln.3x.html 2014-09-01 16:33:22.318792059 +0200 -@@ -1,4 +1,4 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - **************************************************************************** - * Copyright (c) 1998-2007,2010 Free Software Foundation, Inc. * -diff -Naur ncurses-5.9/doc/html/man/curs_extend.3x.html ncurses-5.9.patch/doc/html/man/curs_extend.3x.html ---- ncurses-5.9/doc/html/man/curs_extend.3x.html 2011-01-09 02:03:07.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/curs_extend.3x.html 2014-09-01 16:33:22.318792059 +0200 -@@ -1,4 +1,4 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - **************************************************************************** - * Copyright (c) 1999-2006,2010 Free Software Foundation, Inc. * -diff -Naur ncurses-5.9/doc/html/man/curs_getcchar.3x.html ncurses-5.9.patch/doc/html/man/curs_getcchar.3x.html ---- ncurses-5.9/doc/html/man/curs_getcchar.3x.html 2011-01-09 02:03:07.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/curs_getcchar.3x.html 2014-09-01 16:33:22.319792061 +0200 -@@ -1,7 +1,7 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - **************************************************************************** -- * Copyright (c) 2001-2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 2001-2010,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -27,7 +27,7 @@ - * sale, use or other dealings in this Software without prior written * - * authorization. * - **************************************************************************** -- * @Id: curs_getcchar.3x,v 1.15 2010/12/04 18:36:44 tom Exp @ -+ * @Id: curs_getcchar.3x,v 1.16 2012/11/03 23:03:59 tom Exp @ - --> - <HTML> - <HEAD> -@@ -128,7 +128,7 @@ - - - </PRE> --<H2>RETURN VALUES</H2><PRE> -+<H2>RETURN VALUE</H2><PRE> - When <EM>wch</EM> is a null pointer, <STRONG>getcchar</STRONG> returns the number of - wide characters referenced by <EM>wcval</EM>, including one for a - trailing null. -@@ -143,7 +143,7 @@ - </PRE> - <H2>SEE ALSO</H2><PRE> - Functions: <STRONG><A HREF="curs_attr.3x.html">curs_attr(3x)</A></STRONG>, <STRONG><A HREF="curs_color.3x.html">curs_color(3x)</A></STRONG>, <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>, -- <STRONG><A HREF="wcwidth.3.html">wcwidth(3)</A></STRONG>. -+ <STRONG>wcwidth(3)</STRONG>. - - - -diff -Naur ncurses-5.9/doc/html/man/curs_getch.3x.html ncurses-5.9.patch/doc/html/man/curs_getch.3x.html ---- ncurses-5.9/doc/html/man/curs_getch.3x.html 2011-02-26 00:24:52.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/curs_getch.3x.html 2014-09-01 16:33:22.319792061 +0200 -@@ -1,8 +1,8 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - * t - **************************************************************************** -- * Copyright (c) 1998-2010,2011 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -28,7 +28,7 @@ - * sale, use or other dealings in this Software without prior written * - * authorization. * - **************************************************************************** -- * @Id: curs_getch.3x,v 1.36 2011/01/22 19:38:51 tom Exp @ -+ * @Id: curs_getch.3x,v 1.37 2012/07/07 20:04:56 tom Exp @ - --> - <HTML> - <HEAD> -@@ -110,7 +110,6 @@ - be returned by the next call to <STRONG>wgetch</STRONG>. There is just one - input queue for all windows. - -- - <STRONG>Function</STRONG> <STRONG>Keys</STRONG> - The following function keys, defined in <STRONG>&lt;curses.h&gt;</STRONG>, might - be returned by <STRONG>getch</STRONG> if <STRONG>keypad</STRONG> has been enabled. Note -@@ -179,8 +178,8 @@ - KEY_REPLACE Replace key - KEY_RESIZE Screen resized - KEY_RESTART Restart key -- KEY_RESUME Resume key - -+ KEY_RESUME Resume key - KEY_SAVE Save key - KEY_SBEG Shifted beginning key - KEY_SCANCEL Shifted cancel key -@@ -233,21 +232,18 @@ - sion of <STRONG>KEY_MOUSE</STRONG>. - - -- - </PRE> - <H2>RETURN VALUE</H2><PRE> - All routines return the integer <STRONG>ERR</STRONG> upon failure and an - integer value other than <STRONG>ERR</STRONG> (<STRONG>OK</STRONG> in the case of ungetch()) - upon successful completion. - -- <STRONG>ungetch</STRONG> -- returns an error if there is no more room in -- the FIFO. -- -- <STRONG>wgetch</STRONG> -- returns an error if the window pointer is -- null, or if its timeout expires without having -- any data. -+ <STRONG>ungetch</STRONG> -+ returns ERR if there is no more room in the FIFO. -+ -+ <STRONG>wgetch</STRONG> -+ returns ERR if the window pointer is null, or if -+ its timeout expires without having any data. - - Functions with a "mv" prefix first perform a cursor move- - ment using <STRONG>wmove</STRONG>, and return an error if the position is -@@ -321,7 +317,7 @@ - documentation. Under historical curses implementations, - it varied depending on whether the operating system's im- - plementation of handled signal receipt interrupts a -- <STRONG><A HREF="read.2.html">read(2)</A></STRONG> call in progress or not, and also (in some imple- -+ <STRONG>read(2)</STRONG> call in progress or not, and also (in some imple- - mentations) depending on whether an input timeout or non- - blocking mode has been set. - -diff -Naur ncurses-5.9/doc/html/man/curs_getstr.3x.html ncurses-5.9.patch/doc/html/man/curs_getstr.3x.html ---- ncurses-5.9/doc/html/man/curs_getstr.3x.html 2011-01-09 02:03:08.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/curs_getstr.3x.html 2014-09-01 16:33:22.319792061 +0200 -@@ -1,4 +1,4 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - **************************************************************************** - * Copyright (c) 1998-2005,2010 Free Software Foundation, Inc. * -diff -Naur ncurses-5.9/doc/html/man/curs_get_wch.3x.html ncurses-5.9.patch/doc/html/man/curs_get_wch.3x.html ---- ncurses-5.9/doc/html/man/curs_get_wch.3x.html 2010-09-18 23:35:17.000000000 +0200 -+++ ncurses-5.9.patch/doc/html/man/curs_get_wch.3x.html 2014-09-01 16:33:22.319792061 +0200 -@@ -1,7 +1,7 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - **************************************************************************** -- * Copyright (c) 2002-2006,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 2002-2010,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -27,7 +27,7 @@ - * sale, use or other dealings in this Software without prior written * - * authorization. * - **************************************************************************** -- * @Id: curs_get_wch.3x,v 1.7 2010/08/14 23:31:42 tom Exp @ -+ * @Id: curs_get_wch.3x,v 1.8 2012/11/03 23:03:59 tom Exp @ - --> - <HTML> - <HEAD> -@@ -122,7 +122,7 @@ - - - </PRE> --<H2>RETURN VALUES</H2><PRE> -+<H2>RETURN VALUE</H2><PRE> - When <STRONG>get_wch</STRONG>, <STRONG>wget_wch</STRONG>, <STRONG>mvget_wch</STRONG>, and <STRONG>mvwget_wch</STRONG> func- - tions successfully report the pressing of a function key, - they return <STRONG>KEY_CODE_YES</STRONG>. When they successfully report a -diff -Naur ncurses-5.9/doc/html/man/curs_get_wstr.3x.html ncurses-5.9.patch/doc/html/man/curs_get_wstr.3x.html ---- ncurses-5.9/doc/html/man/curs_get_wstr.3x.html 2011-01-09 02:03:08.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/curs_get_wstr.3x.html 2014-09-01 16:33:22.319792061 +0200 -@@ -1,7 +1,7 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - **************************************************************************** -- * Copyright (c) 2002-2006,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 2002-2010,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -27,7 +27,7 @@ - * sale, use or other dealings in this Software without prior written * - * authorization. * - **************************************************************************** -- * @Id: curs_get_wstr.3x,v 1.8 2010/12/04 18:36:44 tom Exp @ -+ * @Id: curs_get_wstr.3x,v 1.9 2012/11/03 23:03:59 tom Exp @ - --> - <HTML> - <HEAD> -@@ -118,7 +118,7 @@ - - - </PRE> --<H2>RETURN VALUES</H2><PRE> -+<H2>RETURN VALUE</H2><PRE> - All of these functions return <STRONG>OK</STRONG> upon successful comple- - tion. Otherwise, they return <STRONG>ERR</STRONG>. - -diff -Naur ncurses-5.9/doc/html/man/curs_getyx.3x.html ncurses-5.9.patch/doc/html/man/curs_getyx.3x.html ---- ncurses-5.9/doc/html/man/curs_getyx.3x.html 2011-01-09 02:03:08.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/curs_getyx.3x.html 2014-09-01 16:33:22.319792061 +0200 -@@ -1,4 +1,4 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - **************************************************************************** - * Copyright (c) 1998-2007,2010 Free Software Foundation, Inc. * -diff -Naur ncurses-5.9/doc/html/man/curs_inch.3x.html ncurses-5.9.patch/doc/html/man/curs_inch.3x.html ---- ncurses-5.9/doc/html/man/curs_inch.3x.html 2011-01-09 02:03:08.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/curs_inch.3x.html 2014-09-01 16:33:22.320792063 +0200 -@@ -1,4 +1,4 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - * t - **************************************************************************** -diff -Naur ncurses-5.9/doc/html/man/curs_inchstr.3x.html ncurses-5.9.patch/doc/html/man/curs_inchstr.3x.html ---- ncurses-5.9/doc/html/man/curs_inchstr.3x.html 2011-01-09 02:03:09.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/curs_inchstr.3x.html 2014-09-01 16:33:22.320792063 +0200 -@@ -1,4 +1,4 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - **************************************************************************** - * Copyright (c) 1998-2006,2010 Free Software Foundation, Inc. * -diff -Naur ncurses-5.9/doc/html/man/curs_initscr.3x.html ncurses-5.9.patch/doc/html/man/curs_initscr.3x.html ---- ncurses-5.9/doc/html/man/curs_initscr.3x.html 2011-01-09 02:03:09.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/curs_initscr.3x.html 2014-09-01 16:33:22.320792063 +0200 -@@ -1,7 +1,7 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - **************************************************************************** -- * Copyright (c) 1998-2005,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -27,7 +27,7 @@ - * sale, use or other dealings in this Software without prior written * - * authorization. * - **************************************************************************** -- * @Id: curs_initscr.3x,v 1.17 2010/12/04 18:36:58 tom Exp @ -+ * @Id: curs_initscr.3x,v 1.19 2013/07/20 19:34:14 tom Exp @ - --> - <HTML> - <HEAD> -@@ -148,11 +148,19 @@ - rather than exiting. It is safe but redundant to check - the return value of <STRONG>initscr</STRONG> in XSI Curses. - -+ If the TERM variable is missing or empty, <STRONG>initscr</STRONG> uses the -+ value "unknown", which normally corresponds to a terminal -+ entry with the <EM>generic</EM> (<EM>gn</EM>) capability. Generic entries -+ are detected by <STRONG><A HREF="curs_terminfo.3x.html">curs_terminfo(3x)</A></STRONG> and cannot be used for full- -+ screen operation. Other implementations may handle a -+ missing/empty TERM variable differently. -+ - - </PRE> - <H2>SEE ALSO</H2><PRE> - <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>, <STRONG><A HREF="curs_kernel.3x.html">curs_kernel(3x)</A></STRONG>, <STRONG><A HREF="curs_refresh.3x.html">curs_refresh(3x)</A></STRONG>, -- <STRONG><A HREF="curs_slk.3x.html">curs_slk(3x)</A></STRONG>, <STRONG><A HREF="curs_util.3x.html">curs_util(3x)</A></STRONG>, <STRONG><A HREF="curs_variables.3x.html">curs_variables(3x)</A></STRONG>. -+ <STRONG><A HREF="curs_slk.3x.html">curs_slk(3x)</A></STRONG>, <STRONG><A HREF="curs_terminfo.3x.html">curs_terminfo(3x)</A></STRONG>, <STRONG><A HREF="curs_util.3x.html">curs_util(3x)</A></STRONG>, <STRONG>curs_vari-</STRONG> -+ <STRONG><A HREF="curs_variables.3x.html">ables(3x)</A></STRONG>. - - - -diff -Naur ncurses-5.9/doc/html/man/curs_inopts.3x.html ncurses-5.9.patch/doc/html/man/curs_inopts.3x.html ---- ncurses-5.9/doc/html/man/curs_inopts.3x.html 2011-01-09 02:03:09.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/curs_inopts.3x.html 2014-09-01 16:33:22.320792063 +0200 -@@ -1,7 +1,7 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - **************************************************************************** -- * Copyright (c) 1998-2005,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -27,7 +27,7 @@ - * sale, use or other dealings in this Software without prior written * - * authorization. * - **************************************************************************** -- * @Id: curs_inopts.3x,v 1.15 2010/12/04 18:40:45 tom Exp @ -+ * @Id: curs_inopts.3x,v 1.18 2013/07/20 19:42:02 tom Exp @ - --> - <HTML> - <HEAD> -@@ -135,7 +135,7 @@ - - Initially, whether the terminal returns 7 or 8 significant - bits on input depends on the control mode of the tty driv- -- er [see <STRONG><A HREF="termio.7.html">termio(7)</A></STRONG>]. To force 8 bits to be returned, in- -+ er [see <STRONG>termio(7)</STRONG>]. To force 8 bits to be returned, in- - voke <STRONG>meta</STRONG>(<EM>win</EM>, <STRONG>TRUE</STRONG>); this is equivalent, under POSIX, to - setting the CS8 flag on the terminal. To force 7 bits to - be returned, invoke <STRONG>meta</STRONG>(<EM>win</EM>, <STRONG>FALSE</STRONG>); this is equivalent, -@@ -168,7 +168,7 @@ - - When the <STRONG>noqiflush</STRONG> routine is used, normal flush of input - and output queues associated with the <STRONG>INTR</STRONG>, <STRONG>QUIT</STRONG> and <STRONG>SUSP</STRONG> -- characters will not be done [see <STRONG><A HREF="termio.7.html">termio(7)</A></STRONG>]. When <STRONG>qiflush</STRONG> -+ characters will not be done [see <STRONG>termio(7)</STRONG>]. When <STRONG>qiflush</STRONG> - is called, the queues will be flushed when these control - characters are read. You may want to call <STRONG>noqiflush()</STRONG> in - a signal handler if you want output to continue as though -@@ -185,7 +185,7 @@ - additional capability of being able to block for only <EM>de-</EM> - <EM>lay</EM> milliseconds (where <EM>delay</EM> is positive). - -- The <STRONG>curses</STRONG> library does ``line-breakout optimization'' by -+ The <STRONG>curses</STRONG> library does "line-breakout optimization" by - looking for typeahead periodically while updating the - screen. If input is found, and it is coming from a tty, - the current update is postponed until <STRONG>refresh</STRONG> or <STRONG>doupdate</STRONG> -@@ -229,24 +229,58 @@ - ty, set echo or noecho explicitly just after initializa- - tion, even if your program remains in cooked mode. - -+ When <STRONG>keypad</STRONG> is first enabled, ncurses loads the key-defi- -+ nitions for the current terminal description. If the ter- -+ minal description includes extended string capabilities, -+ e.g., from using the <STRONG>-x</STRONG> option of tic, then ncurses also -+ defines keys for the capabilities whose names begin with -+ "k". The corresponding keycodes are generated and (de- -+ pending on previous loads of terminal descriptions) may -+ differ from one execution of a program to the next. The -+ generated keycodes are recognized by the <STRONG>keyname</STRONG> function -+ (which will then return a name beginning with "k" denoting -+ the terminfo capability name rather than "K", used for -+ curses key-names). On the other hand, an application can -+ use <STRONG>define_key</STRONG> to establish a specific keycode for a given -+ string. This makes it possible for an application to -+ check for an extended capability's presence with <EM>tigetstr</EM>, -+ and reassign the keycode to match its own needs. -+ -+ Low-level applications can use <STRONG>tigetstr</STRONG> to obtain the def- -+ inition of any particular string capability. Higher-level -+ applications which use the curses <STRONG>wgetch</STRONG> and similar func- -+ tions to return keycodes rely upon the order in which the -+ strings are loaded. If more than one key definition has -+ the same string value, then <STRONG>wgetch</STRONG> can return only one -+ keycode. Most curses implementations (including ncurses) -+ load key definitions in the order defined by the array of -+ string capability names. The last key to be loaded deter- -+ mines the keycode which will be returned. In ncurses, you -+ may also have extended capabilities interpreted as key -+ definitions. These are loaded after the predefined keys, -+ and if a capability's value is the same as a previously- -+ loaded key definition, the later definition is the one -+ used. -+ - - </PRE> - <H2>NOTES</H2><PRE> -- Note that <STRONG>echo</STRONG>, <STRONG>noecho</STRONG>, <STRONG>halfdelay</STRONG>, <STRONG>intrflush</STRONG>, <STRONG>meta</STRONG>, <STRONG>node-</STRONG> -- <STRONG>lay</STRONG>, <STRONG>notimeout</STRONG>, <STRONG>noqiflush</STRONG>, <STRONG>qiflush</STRONG>, <STRONG>timeout</STRONG>, and <STRONG>wtimeout</STRONG> -+ Note that <STRONG>echo</STRONG>, <STRONG>noecho</STRONG>, <STRONG>halfdelay</STRONG>, <STRONG>intrflush</STRONG>, <STRONG>meta</STRONG>, <STRONG>node-</STRONG> -+ <STRONG>lay</STRONG>, <STRONG>notimeout</STRONG>, <STRONG>noqiflush</STRONG>, <STRONG>qiflush</STRONG>, <STRONG>timeout</STRONG>, and <STRONG>wtimeout</STRONG> - may be macros. - - The <STRONG>noraw</STRONG> and <STRONG>nocbreak</STRONG> calls follow historical practice in -- that they attempt to restore to normal (`cooked') mode -- from raw and cbreak modes respectively. Mixing raw/noraw -- and cbreak/nocbreak calls leads to tty driver control -- states that are hard to predict or understand; it is not -+ that they attempt to restore to normal (`cooked') mode -+ from raw and cbreak modes respectively. Mixing raw/noraw -+ and cbreak/nocbreak calls leads to tty driver control -+ states that are hard to predict or understand; it is not - recommended. - - - </PRE> - <H2>SEE ALSO</H2><PRE> -- <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>, <STRONG><A HREF="curs_getch.3x.html">curs_getch(3x)</A></STRONG>, <STRONG><A HREF="curs_initscr.3x.html">curs_initscr(3x)</A></STRONG>, <STRONG><A HREF="termio.7.html">termio(7)</A></STRONG> -+ <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>, <STRONG><A HREF="curs_getch.3x.html">curs_getch(3x)</A></STRONG>, <STRONG><A HREF="curs_initscr.3x.html">curs_initscr(3x)</A></STRONG>, -+ <STRONG><A HREF="curs_util.3x.html">curs_util(3x)</A></STRONG>, <STRONG><A HREF="define_key.3x.html">define_key(3x)</A></STRONG>, <STRONG>termio(7)</STRONG> - - - -diff -Naur ncurses-5.9/doc/html/man/curs_insch.3x.html ncurses-5.9.patch/doc/html/man/curs_insch.3x.html ---- ncurses-5.9/doc/html/man/curs_insch.3x.html 2011-01-09 02:03:09.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/curs_insch.3x.html 2014-09-01 16:33:22.320792063 +0200 -@@ -1,4 +1,4 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - **************************************************************************** - * Copyright (c) 1998-2006,2010 Free Software Foundation, Inc. * -diff -Naur ncurses-5.9/doc/html/man/curs_insstr.3x.html ncurses-5.9.patch/doc/html/man/curs_insstr.3x.html ---- ncurses-5.9/doc/html/man/curs_insstr.3x.html 2011-01-09 02:03:09.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/curs_insstr.3x.html 2014-09-01 16:33:22.321792065 +0200 -@@ -1,4 +1,4 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - **************************************************************************** - * Copyright (c) 1998-2006,2010 Free Software Foundation, Inc. * -diff -Naur ncurses-5.9/doc/html/man/curs_instr.3x.html ncurses-5.9.patch/doc/html/man/curs_instr.3x.html ---- ncurses-5.9/doc/html/man/curs_instr.3x.html 2011-01-09 02:03:10.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/curs_instr.3x.html 2014-09-01 16:33:22.321792065 +0200 -@@ -1,4 +1,4 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - **************************************************************************** - * Copyright (c) 1998-2006,2010 Free Software Foundation, Inc. * -diff -Naur ncurses-5.9/doc/html/man/curs_ins_wch.3x.html ncurses-5.9.patch/doc/html/man/curs_ins_wch.3x.html ---- ncurses-5.9/doc/html/man/curs_ins_wch.3x.html 2011-01-09 02:03:10.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/curs_ins_wch.3x.html 2014-09-01 16:33:22.320792063 +0200 -@@ -1,4 +1,4 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - **************************************************************************** - * Copyright (c) 2002-2006,2010 Free Software Foundation, Inc. * -diff -Naur ncurses-5.9/doc/html/man/curs_ins_wstr.3x.html ncurses-5.9.patch/doc/html/man/curs_ins_wstr.3x.html ---- ncurses-5.9/doc/html/man/curs_ins_wstr.3x.html 2011-01-09 02:03:10.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/curs_ins_wstr.3x.html 2014-09-01 16:33:22.320792063 +0200 -@@ -1,7 +1,7 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - **************************************************************************** -- * Copyright (c) 2002-2005,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 2002-2010,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -27,7 +27,7 @@ - * sale, use or other dealings in this Software without prior written * - * authorization. * - **************************************************************************** -- * @Id: curs_ins_wstr.3x,v 1.6 2010/12/04 18:38:55 tom Exp @ -+ * @Id: curs_ins_wstr.3x,v 1.7 2012/11/03 23:03:59 tom Exp @ - --> - <HTML> - <HEAD> -@@ -102,7 +102,7 @@ - - - </PRE> --<H2>RETURN VALUES</H2><PRE> -+<H2>RETURN VALUE</H2><PRE> - Upon successful completion, these functions return OK. - Otherwise, they return ERR. - -diff -Naur ncurses-5.9/doc/html/man/curs_in_wch.3x.html ncurses-5.9.patch/doc/html/man/curs_in_wch.3x.html ---- ncurses-5.9/doc/html/man/curs_in_wch.3x.html 2011-01-09 02:03:10.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/curs_in_wch.3x.html 2014-09-01 16:33:22.319792061 +0200 -@@ -1,4 +1,4 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - **************************************************************************** - * Copyright (c) 2002-2006,2010 Free Software Foundation, Inc. * -diff -Naur ncurses-5.9/doc/html/man/curs_in_wchstr.3x.html ncurses-5.9.patch/doc/html/man/curs_in_wchstr.3x.html ---- ncurses-5.9/doc/html/man/curs_in_wchstr.3x.html 2011-01-09 02:03:10.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/curs_in_wchstr.3x.html 2014-09-01 16:33:22.320792063 +0200 -@@ -1,7 +1,7 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - **************************************************************************** -- * Copyright (c) 2002-2006,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 2002-2010,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -27,7 +27,7 @@ - * sale, use or other dealings in this Software without prior written * - * authorization. * - **************************************************************************** -- * @Id: curs_in_wchstr.3x,v 1.8 2010/12/04 18:36:44 tom Exp @ -+ * @Id: curs_in_wchstr.3x,v 1.9 2012/11/03 23:03:59 tom Exp @ - --> - <HTML> - <HEAD> -@@ -90,7 +90,7 @@ - - - </PRE> --<H2>RETURN VALUES</H2><PRE> -+<H2>RETURN VALUE</H2><PRE> - Upon successful completion, these functions return <STRONG>OK</STRONG>. - Otherwise, they return <STRONG>ERR</STRONG>. - -diff -Naur ncurses-5.9/doc/html/man/curs_inwstr.3x.html ncurses-5.9.patch/doc/html/man/curs_inwstr.3x.html ---- ncurses-5.9/doc/html/man/curs_inwstr.3x.html 2011-01-09 02:03:11.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/curs_inwstr.3x.html 2014-09-01 16:33:22.321792065 +0200 -@@ -1,7 +1,7 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - **************************************************************************** -- * Copyright (c) 2002-2006,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 2002-2010,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -27,7 +27,7 @@ - * sale, use or other dealings in this Software without prior written * - * authorization. * - **************************************************************************** -- * @Id: curs_inwstr.3x,v 1.7 2010/12/04 18:38:55 tom Exp @ -+ * @Id: curs_inwstr.3x,v 1.8 2012/11/03 23:03:59 tom Exp @ - --> - <HTML> - <HEAD> -@@ -87,7 +87,7 @@ - - - </PRE> --<H2>RETURN VALUES</H2><PRE> -+<H2>RETURN VALUE</H2><PRE> - All routines return <STRONG>ERR</STRONG> upon failure. Upon successful com- - pletion, the *<STRONG>inwstr</STRONG> routines return <STRONG>OK</STRONG>, and the *<STRONG>innwstr</STRONG> - routines return the number of characters read into the -diff -Naur ncurses-5.9/doc/html/man/curs_kernel.3x.html ncurses-5.9.patch/doc/html/man/curs_kernel.3x.html ---- ncurses-5.9/doc/html/man/curs_kernel.3x.html 2011-01-09 02:03:11.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/curs_kernel.3x.html 2014-09-01 16:33:22.321792065 +0200 -@@ -1,4 +1,4 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - **************************************************************************** - * Copyright (c) 1998-2005,2010 Free Software Foundation, Inc. * -diff -Naur ncurses-5.9/doc/html/man/curs_legacy.3x.html ncurses-5.9.patch/doc/html/man/curs_legacy.3x.html ---- ncurses-5.9/doc/html/man/curs_legacy.3x.html 2011-01-09 02:03:11.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/curs_legacy.3x.html 2014-09-01 16:33:22.321792065 +0200 -@@ -1,4 +1,4 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - **************************************************************************** - * Copyright (c) 2007,2010 Free Software Foundation, Inc. * -diff -Naur ncurses-5.9/doc/html/man/curs_memleaks.3x.html ncurses-5.9.patch/doc/html/man/curs_memleaks.3x.html ---- ncurses-5.9/doc/html/man/curs_memleaks.3x.html 2011-01-09 02:03:11.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/curs_memleaks.3x.html 2014-09-01 16:33:22.321792065 +0200 -@@ -1,4 +1,4 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - **************************************************************************** - * Copyright (c) 2008,2010 Free Software Foundation, Inc. * -diff -Naur ncurses-5.9/doc/html/man/curs_mouse.3x.html ncurses-5.9.patch/doc/html/man/curs_mouse.3x.html ---- ncurses-5.9/doc/html/man/curs_mouse.3x.html 2011-02-26 00:24:55.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/curs_mouse.3x.html 2014-09-01 16:33:22.321792065 +0200 -@@ -1,8 +1,8 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - * t - **************************************************************************** -- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2010,2013 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -28,7 +28,7 @@ - * sale, use or other dealings in this Software without prior written * - * authorization. * - **************************************************************************** -- * @Id: curs_mouse.3x,v 1.38 2010/12/04 18:38:55 tom Exp @ -+ * @Id: curs_mouse.3x,v 1.39 2013/06/22 18:09:42 tom Exp @ - --> - <HTML> - <HEAD> -@@ -59,13 +59,12 @@ - - <STRONG>typedef</STRONG> <STRONG>unsigned</STRONG> <STRONG>long</STRONG> <STRONG>mmask_t;</STRONG> - -- typedef struct -- { -- short id; <EM>/*</EM> <EM>ID</EM> <EM>to</EM> <EM>distinguish</EM> <EM>multiple</EM> <EM>devices</EM> <EM>*/</EM> -+ <STRONG>typedef</STRONG> <STRONG>struct</STRONG> <STRONG>{</STRONG> -+ <STRONG>short</STRONG> <STRONG>id;</STRONG> <EM>/*</EM> <EM>ID</EM> <EM>to</EM> <EM>distinguish</EM> <EM>multiple</EM> <EM>devices</EM> <EM>*/</EM> - <STRONG>int</STRONG> <STRONG>x,</STRONG> <STRONG>y,</STRONG> <STRONG>z;</STRONG> <EM>/*</EM> <EM>event</EM> <EM>coordinates</EM> <EM>*/</EM> - <STRONG>mmask_t</STRONG> <STRONG>bstate;</STRONG> <EM>/*</EM> <EM>button</EM> <EM>state</EM> <EM>bits</EM> <EM>*/</EM> -- <STRONG>}</STRONG> -- <STRONG>MEVENT;</STRONG> -+ <STRONG>}</STRONG> <STRONG>MEVENT;</STRONG> -+ - <STRONG>bool</STRONG> <STRONG>has_mouse(void);</STRONG> - <STRONG>int</STRONG> <STRONG>getmouse(MEVENT</STRONG> <STRONG>*event);</STRONG> - <STRONG>int</STRONG> <STRONG>ungetmouse(MEVENT</STRONG> <STRONG>*event);</STRONG> -@@ -98,7 +97,6 @@ - - Here are the mouse event type masks which may be defined: - -- - <EM>Name</EM> <EM>Description</EM> - --------------------------------------------------------------------- - BUTTON1_PRESSED mouse button 1 down -@@ -111,11 +109,10 @@ - BUTTON2_RELEASED mouse button 2 up - BUTTON2_CLICKED mouse button 2 clicked - BUTTON2_DOUBLE_CLICKED mouse button 2 double clicked -- -- - BUTTON2_TRIPLE_CLICKED mouse button 2 triple clicked - --------------------------------------------------------------------- - BUTTON3_PRESSED mouse button 3 down -+ - BUTTON3_RELEASED mouse button 3 up - BUTTON3_CLICKED mouse button 3 clicked - BUTTON3_DOUBLE_CLICKED mouse button 3 double clicked -diff -Naur ncurses-5.9/doc/html/man/curs_move.3x.html ncurses-5.9.patch/doc/html/man/curs_move.3x.html ---- ncurses-5.9/doc/html/man/curs_move.3x.html 2011-01-09 02:03:12.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/curs_move.3x.html 2014-09-01 16:33:22.322792066 +0200 -@@ -1,4 +1,4 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - **************************************************************************** - * Copyright (c) 1998-2006,2010 Free Software Foundation, Inc. * -diff -Naur ncurses-5.9/doc/html/man/curs_opaque.3x.html ncurses-5.9.patch/doc/html/man/curs_opaque.3x.html ---- ncurses-5.9/doc/html/man/curs_opaque.3x.html 2011-01-09 02:03:12.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/curs_opaque.3x.html 2014-09-01 16:33:22.322792066 +0200 -@@ -1,7 +1,7 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - **************************************************************************** -- * Copyright (c) 2007-2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 2007-2010,2013 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -27,7 +27,7 @@ - * sale, use or other dealings in this Software without prior written * - * authorization. * - **************************************************************************** -- * @Id: curs_opaque.3x,v 1.9 2010/12/04 18:40:45 tom Exp @ -+ * @Id: curs_opaque.3x,v 1.10 2013/07/20 19:42:29 tom Exp @ - --> - <HTML> - <HEAD> -@@ -76,7 +76,7 @@ - <H2>DESCRIPTION</H2><PRE> - This implementation provides functions which return prop- - erties set in the WINDOW structure, allowing it to be -- ``opaque'' if the symbol <STRONG>NCURSES_OPAQUE</STRONG> is defined: -+ "opaque" if the symbol <STRONG>NCURSES_OPAQUE</STRONG> is defined: - - <STRONG>is_cleared</STRONG> - returns the value set in <STRONG>clearok</STRONG> -diff -Naur ncurses-5.9/doc/html/man/curs_outopts.3x.html ncurses-5.9.patch/doc/html/man/curs_outopts.3x.html ---- ncurses-5.9/doc/html/man/curs_outopts.3x.html 2011-01-09 02:03:12.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/curs_outopts.3x.html 2014-09-01 16:33:22.322792066 +0200 -@@ -1,4 +1,4 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - **************************************************************************** - * Copyright (c) 1998-2007,2010 Free Software Foundation, Inc. * -diff -Naur ncurses-5.9/doc/html/man/curs_overlay.3x.html ncurses-5.9.patch/doc/html/man/curs_overlay.3x.html ---- ncurses-5.9/doc/html/man/curs_overlay.3x.html 2011-01-09 02:03:12.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/curs_overlay.3x.html 2014-09-01 16:33:22.322792066 +0200 -@@ -1,7 +1,7 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - **************************************************************************** -- * Copyright (c) 1998-2006,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2010,2013 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -27,7 +27,7 @@ - * sale, use or other dealings in this Software without prior written * - * authorization. * - **************************************************************************** -- * @Id: curs_overlay.3x,v 1.16 2010/12/04 18:40:45 tom Exp @ -+ * @Id: curs_overlay.3x,v 1.17 2013/04/06 23:48:51 tom Exp @ - --> - <HTML> - <HEAD> -@@ -72,7 +72,7 @@ - (blanks are not copied) whereas <STRONG>overwrite</STRONG> is destructive. - - The <STRONG>copywin</STRONG> routine provides a finer granularity of con- -- trol over the <STRONG>overlay</STRONG> and <STRONG>overwrite</STRONG> routines. Like in the -+ trol over the <STRONG>overlay</STRONG> and <STRONG>overwrite</STRONG> routines. As in the - <STRONG>prefresh</STRONG> routine, a rectangle is specified in the destina- - tion window, (<EM>dminrow</EM>, <EM>dmincol</EM>) and (<EM>dmaxrow</EM>, <EM>dmaxcol</EM>), - and the upper-left-corner coordinates of the source win- -diff -Naur ncurses-5.9/doc/html/man/curs_pad.3x.html ncurses-5.9.patch/doc/html/man/curs_pad.3x.html ---- ncurses-5.9/doc/html/man/curs_pad.3x.html 2011-01-09 02:03:12.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/curs_pad.3x.html 2014-09-01 16:33:22.322792066 +0200 -@@ -1,4 +1,4 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - **************************************************************************** - * Copyright (c) 1998-2005,2010 Free Software Foundation, Inc. * -diff -Naur ncurses-5.9/doc/html/man/curs_print.3x.html ncurses-5.9.patch/doc/html/man/curs_print.3x.html ---- ncurses-5.9/doc/html/man/curs_print.3x.html 2011-01-09 02:03:12.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/curs_print.3x.html 2014-09-01 16:33:22.322792066 +0200 -@@ -1,4 +1,4 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - **************************************************************************** - * Copyright (c) 1998-2006,2010 Free Software Foundation, Inc. * -diff -Naur ncurses-5.9/doc/html/man/curs_printw.3x.html ncurses-5.9.patch/doc/html/man/curs_printw.3x.html ---- ncurses-5.9/doc/html/man/curs_printw.3x.html 2011-01-09 02:03:13.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/curs_printw.3x.html 2014-09-01 16:33:22.322792066 +0200 -@@ -1,4 +1,4 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - **************************************************************************** - * Copyright (c) 1998-2006,2010 Free Software Foundation, Inc. * -@@ -69,12 +69,12 @@ - </PRE> - <H2>DESCRIPTION</H2><PRE> - The <STRONG>printw</STRONG>, <STRONG>wprintw</STRONG>, <STRONG>mvprintw</STRONG> and <STRONG>mvwprintw</STRONG> routines are -- analogous to <STRONG>printf</STRONG> [see <STRONG><A HREF="printf.3.html">printf(3)</A></STRONG>]. In effect, the -+ analogous to <STRONG>printf</STRONG> [see <STRONG>printf(3)</STRONG>]. In effect, the - string that would be output by <STRONG>printf</STRONG> is output instead as - though <STRONG>waddstr</STRONG> were used on the given window. - - The <STRONG>vwprintw</STRONG> and <STRONG>wv_printw</STRONG> routines are analogous to -- <STRONG>vprintf</STRONG> [see <STRONG><A HREF="printf.3.html">printf(3)</A></STRONG>] and perform a <STRONG>wprintw</STRONG> using a -+ <STRONG>vprintf</STRONG> [see <STRONG>printf(3)</STRONG>] and perform a <STRONG>wprintw</STRONG> using a - variable argument list. The third argument is a <STRONG>va_list</STRONG>, - a pointer to a list of arguments, as defined in - <STRONG>&lt;stdarg.h&gt;</STRONG>. -@@ -111,7 +111,7 @@ - - </PRE> - <H2>SEE ALSO</H2><PRE> -- <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>, <STRONG><A HREF="printf.3.html">printf(3)</A></STRONG>, <STRONG>vprintf(3)</STRONG> -+ <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>, <STRONG>printf(3)</STRONG>, <STRONG>vprintf(3)</STRONG> - - - -diff -Naur ncurses-5.9/doc/html/man/curs_refresh.3x.html ncurses-5.9.patch/doc/html/man/curs_refresh.3x.html ---- ncurses-5.9/doc/html/man/curs_refresh.3x.html 2011-01-09 02:03:13.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/curs_refresh.3x.html 2014-09-01 16:33:22.322792066 +0200 -@@ -1,4 +1,4 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - **************************************************************************** - * Copyright (c) 1998-2005,2010 Free Software Foundation, Inc. * -diff -Naur ncurses-5.9/doc/html/man/curs_scanw.3x.html ncurses-5.9.patch/doc/html/man/curs_scanw.3x.html ---- ncurses-5.9/doc/html/man/curs_scanw.3x.html 2011-01-09 02:03:13.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/curs_scanw.3x.html 2014-09-01 16:33:22.323792068 +0200 -@@ -1,4 +1,4 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - **************************************************************************** - * Copyright (c) 1998-2006,2010 Free Software Foundation, Inc. * -@@ -66,9 +66,9 @@ - </PRE> - <H2>DESCRIPTION</H2><PRE> - The <STRONG>scanw</STRONG>, <STRONG>wscanw</STRONG> and <STRONG>mvscanw</STRONG> routines are analogous to -- <STRONG>scanf</STRONG> [see <STRONG><A HREF="scanf.3.html">scanf(3)</A></STRONG>]. The effect of these routines is as -+ <STRONG>scanf</STRONG> [see <STRONG>scanf(3)</STRONG>]. The effect of these routines is as - though <STRONG>wgetstr</STRONG> were called on the window, and the result- -- ing line used as input for <STRONG><A HREF="sscanf.3.html">sscanf(3)</A></STRONG>. Fields which do not -+ ing line used as input for <STRONG>sscanf(3)</STRONG>. Fields which do not - map to a variable in the <EM>fmt</EM> field are lost. - - The <STRONG>vwscanw</STRONG> and <STRONG>vw_scanw</STRONG> routines are analogous to <STRONG>vscanf</STRONG>. -@@ -118,7 +118,7 @@ - - </PRE> - <H2>SEE ALSO</H2><PRE> -- <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>, <STRONG><A HREF="curs_getstr.3x.html">curs_getstr(3x)</A></STRONG>, <STRONG><A HREF="curs_printw.3x.html">curs_printw(3x)</A></STRONG>, <STRONG><A HREF="scanf.3.html">scanf(3)</A></STRONG> -+ <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>, <STRONG><A HREF="curs_getstr.3x.html">curs_getstr(3x)</A></STRONG>, <STRONG><A HREF="curs_printw.3x.html">curs_printw(3x)</A></STRONG>, <STRONG>scanf(3)</STRONG> - - - -diff -Naur ncurses-5.9/doc/html/man/curs_scr_dump.3x.html ncurses-5.9.patch/doc/html/man/curs_scr_dump.3x.html ---- ncurses-5.9/doc/html/man/curs_scr_dump.3x.html 2011-01-09 02:03:13.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/curs_scr_dump.3x.html 2014-09-01 16:33:22.323792068 +0200 -@@ -1,4 +1,4 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - **************************************************************************** - * Copyright (c) 1998-2006,2010 Free Software Foundation, Inc. * -@@ -122,7 +122,7 @@ - </PRE> - <H2>SEE ALSO</H2><PRE> - <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>, <STRONG><A HREF="curs_initscr.3x.html">curs_initscr(3x)</A></STRONG>, <STRONG><A HREF="curs_refresh.3x.html">curs_refresh(3x)</A></STRONG>, -- <STRONG><A HREF="curs_util.3x.html">curs_util(3x)</A></STRONG>, <STRONG><A HREF="system.3.html">system(3)</A></STRONG> -+ <STRONG><A HREF="curs_util.3x.html">curs_util(3x)</A></STRONG>, <STRONG>system(3)</STRONG> - - - -diff -Naur ncurses-5.9/doc/html/man/curs_scroll.3x.html ncurses-5.9.patch/doc/html/man/curs_scroll.3x.html ---- ncurses-5.9/doc/html/man/curs_scroll.3x.html 2011-01-09 02:03:13.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/curs_scroll.3x.html 2014-09-01 16:33:22.323792068 +0200 -@@ -1,4 +1,4 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - **************************************************************************** - * Copyright (c) 1998-2006,2010 Free Software Foundation, Inc. * -diff -Naur ncurses-5.9/doc/html/man/curs_slk.3x.html ncurses-5.9.patch/doc/html/man/curs_slk.3x.html ---- ncurses-5.9/doc/html/man/curs_slk.3x.html 2011-01-09 02:03:14.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/curs_slk.3x.html 2014-09-01 16:33:22.323792068 +0200 -@@ -1,4 +1,4 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - **************************************************************************** - * Copyright (c) 1998-2007,2010 Free Software Foundation, Inc. * -diff -Naur ncurses-5.9/doc/html/man/curs_sp_funcs.3x.html ncurses-5.9.patch/doc/html/man/curs_sp_funcs.3x.html ---- ncurses-5.9/doc/html/man/curs_sp_funcs.3x.html 2011-02-26 00:24:57.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/curs_sp_funcs.3x.html 2014-09-01 16:33:22.323792068 +0200 -@@ -1,7 +1,7 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - **************************************************************************** -- * Copyright (c) 2010 Free Software Foundation, Inc. * -+ * Copyright (c) 2010,2013 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -27,7 +27,7 @@ - * sale, use or other dealings in this Software without prior written * - * authorization. * - **************************************************************************** -- * @Id: curs_sp_funcs.3x,v 1.5 2010/12/04 18:38:55 tom Exp @ -+ * @Id: curs_sp_funcs.3x,v 1.6 2013/06/22 17:53:59 tom Exp @ - * *************************************************************************** - * *************************************************************************** - * *************************************************************************** -@@ -131,7 +131,7 @@ - <STRONG>int</STRONG> <STRONG>slk_attron_sp(SCREEN*,</STRONG> <STRONG>const</STRONG> <STRONG>chtype);</STRONG> - <STRONG>int</STRONG> <STRONG>slk_attr_set_sp(SCREEN*,</STRONG> <STRONG>const</STRONG> <STRONG>attr_t,</STRONG> <STRONG>short,</STRONG> <STRONG>void*);</STRONG> - <STRONG>int</STRONG> <STRONG>slk_attrset_sp(SCREEN*,</STRONG> <STRONG>const</STRONG> <STRONG>chtype);</STRONG> -- <STRONG>int</STRONG> <STRONG>slk_attr_sp((SCREEN*);</STRONG> -+ <STRONG>int</STRONG> <STRONG>slk_attr_sp(SCREEN*);</STRONG> - <STRONG>int</STRONG> <STRONG>slk_clear_sp(SCREEN*);</STRONG> - <STRONG>int</STRONG> <STRONG>slk_color_sp(SCREEN*,</STRONG> <STRONG>short);</STRONG> - <STRONG>int</STRONG> <STRONG>slk_init_sp(SCREEN*,</STRONG> <STRONG>int);</STRONG> -@@ -193,16 +193,15 @@ - functions which improve the ability to manage multiple - screens. This feature can be added to any of the configu- - rations supported by ncurses; it adds new entrypoints -- without changing the meaning of any of the existing ones. -- -+ without changing the meaning of any of the existing ones. - - <STRONG>IMPROVED</STRONG> <STRONG>FUNCTIONS</STRONG> -- Most of the functions are new versions of existing func- -+ Most of the functions are new versions of existing func- - tions. A parameter is added at the front of the parameter - list. It is a SCREEN pointer. - -- The existing functions all use the current screen, which -- is a static variable. The extended functions use the -+ The existing functions all use the current screen, which -+ is a static variable. The extended functions use the - specified screen, thereby reducing the number of variables - which must be modified to update multiple screens. - -@@ -210,22 +209,22 @@ - Here are the new functions: - - ceiling_panel -- this returns a pointer to the topmost panel in the -+ this returns a pointer to the topmost panel in the - given screen. - - ground_panel -- this returns a pointer to the lowest panel in the -+ this returns a pointer to the lowest panel in the - given screen. - - new_prescr -- when creating a new screen, the library uses static -- variables which have been preset, e.g., by -- <STRONG><A HREF="use_env.3x.html">use_env(3x)</A></STRONG>, <STRONG><A HREF="filter.3x.html">filter(3x)</A></STRONG>, etc. With the screen-point- -+ when creating a new screen, the library uses static -+ variables which have been preset, e.g., by -+ <STRONG><A HREF="curs_util.3x.html">curs_util(3x)</A></STRONG>, <STRONG><A HREF="curs_util.3x.html">curs_util(3x)</A></STRONG>, etc. With the screen-point- - er extension, there are situations where it must cre- -- ate a current screen before the unextended library -- does. The <STRONG>new_prescr</STRONG> function is used internally to -+ ate a current screen before the unextended library -+ does. The <STRONG>new_prescr</STRONG> function is used internally to - handle these cases. It is also provided as an entry- -- point to allow applications to customize the library -+ point to allow applications to customize the library - initialization. - - -@@ -234,37 +233,36 @@ - This extension introduces some new names: - - NCURSES_SP_FUNCS -- This is set to the library patch-level number. In -- the unextended library, this is zero (0), to make it -+ This is set to the library patch-level number. In -+ the unextended library, this is zero (0), to make it - useful for checking if the extension is provided. - - NCURSES_SP_NAME -- The new functions are named using the macro <EM>NCURS-</EM> -- <EM>ES</EM><STRONG>_</STRONG><EM>SP</EM><STRONG>_</STRONG><EM>NAME</EM>, which hides the actual implementation. -+ The new functions are named using the macro <EM>NCURS-</EM> -+ <EM>ES</EM><STRONG>_</STRONG><EM>SP</EM><STRONG>_</STRONG><EM>NAME</EM>, which hides the actual implementation. - Currently this adds a "_sp" suffix to the name of the -- unextended function. This manual page indexes the -+ unextended function. This manual page indexes the - extensions showing the full name. However the proper -- usage of these functions uses the macro, to provide -+ usage of these functions uses the macro, to provide - for the possibility of changing the naming convention - for specific library configurations. - - NCURSES_SP_OUTC -- This is a new function-pointer type to use in the -- screen-pointer functions where an <EM>NCURSES</EM><STRONG>_</STRONG><EM>OUTC</EM> is -+ This is a new function-pointer type to use in the -+ screen-pointer functions where an <EM>NCURSES</EM><STRONG>_</STRONG><EM>OUTC</EM> is - used in the unextended library. - - NCURSES_OUTC -- This is a function-pointer type used for the cases -- where a function passes characters to the output -- stream, e.g., <STRONG><A HREF="vidputs.3x.html">vidputs(3x)</A></STRONG>. -- -+ This is a function-pointer type used for the cases -+ where a function passes characters to the output -+ stream, e.g., <STRONG><A HREF="curs_terminfo.3x.html">curs_terminfo(3x)</A></STRONG>. - - - </PRE> - <H2>PORTABILITY</H2><PRE> -- These routines are specific to ncurses. They were not -- supported on Version 7, BSD or System V implementations. -- It is recommended that any code depending on ncurses ex- -+ These routines are specific to ncurses. They were not -+ supported on Version 7, BSD or System V implementations. -+ It is recommended that any code depending on ncurses ex- - tensions be conditioned using <EM>NCURSES</EM><STRONG>_</STRONG><EM>SP</EM><STRONG>_</STRONG><EM>FUNCS</EM>. - - -diff -Naur ncurses-5.9/doc/html/man/curs_termattrs.3x.html ncurses-5.9.patch/doc/html/man/curs_termattrs.3x.html ---- ncurses-5.9/doc/html/man/curs_termattrs.3x.html 2011-02-26 00:24:58.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/curs_termattrs.3x.html 2014-09-01 16:33:22.323792068 +0200 -@@ -1,4 +1,4 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - **************************************************************************** - * Copyright (c) 1998-2007,2010 Free Software Foundation, Inc. * -@@ -111,11 +111,11 @@ - - If a given terminal does not support a video attribute - that an application program is trying to use, <STRONG>curses</STRONG> may -- substitute a different video attribute for it. The -- <STRONG>termattrs</STRONG> and <STRONG>term_attrs</STRONG> functions return a logical <STRONG>OR</STRONG> of -- all video attributes supported by the terminal using <EM>A</EM><STRONG>_</STRONG> -- and <EM>WA</EM><STRONG>_</STRONG> constants respectively. This information is use- -- ful when a <STRONG>curses</STRONG> program needs complete control over the -+ substitute a different video attribute for it. The <STRONG>ter-</STRONG> -+ <STRONG>mattrs</STRONG> and <STRONG>term_attrs</STRONG> functions return a logical <STRONG>OR</STRONG> of all -+ video attributes supported by the terminal using <EM>A</EM><STRONG>_</STRONG> and -+ <EM>WA</EM><STRONG>_</STRONG> constants respectively. This information is useful -+ when a <STRONG>curses</STRONG> program needs complete control over the - appearance of the screen. - - The <STRONG>termname</STRONG> routine returns the terminal name used by -diff -Naur ncurses-5.9/doc/html/man/curs_termcap.3x.html ncurses-5.9.patch/doc/html/man/curs_termcap.3x.html ---- ncurses-5.9/doc/html/man/curs_termcap.3x.html 2011-01-09 02:03:14.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/curs_termcap.3x.html 2014-09-01 16:33:22.324792069 +0200 -@@ -1,7 +1,7 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - **************************************************************************** -- * Copyright (c) 1998-2007,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -27,7 +27,7 @@ - * sale, use or other dealings in this Software without prior written * - * authorization. * - **************************************************************************** -- * @Id: curs_termcap.3x,v 1.26 2010/12/04 18:38:55 tom Exp @ -+ * @Id: curs_termcap.3x,v 1.30 2013/01/19 15:58:48 tom Exp @ - --> - <HTML> - <HEAD> -@@ -79,39 +79,62 @@ - bilities of entries for which a terminfo entry has been - compiled. - -- The <STRONG>tgetent</STRONG> routine loads the entry for <EM>name</EM>. It returns -- 1 on success, 0 if there is no such entry, and -1 if the -- terminfo database could not be found. The emulation ig- -- nores the buffer pointer <EM>bp</EM>. -+ <STRONG>INITIALIZATION</STRONG> -+ The <STRONG>tgetent</STRONG> routine loads the entry for <EM>name</EM>. It returns: - -+ 1 on success, -+ -+ 0 if there is no such entry (or that it is a generic -+ type, having too little information for curses ap- -+ plications to run), and -+ -+ -1 if the terminfo database could not be found. -+ -+ This differs from the <EM>termcap</EM> library in two ways: -+ -+ <STRONG>o</STRONG> The emulation ignores the buffer pointer <EM>bp</EM>. The -+ <EM>termcap</EM> library would store a copy of the terminal -+ description in the area referenced by this pointer. -+ However, ncurses stores its terminal descriptions -+ in compiled binary form, which is not the same -+ thing. -+ -+ <STRONG>o</STRONG> There is a difference in return codes. The <EM>termcap</EM> -+ library does not check if the terminal description -+ is marked with the <EM>generic</EM> capability, or if the -+ terminal description has cursor-addressing. -+ -+ <STRONG>CAPABILITY</STRONG> <STRONG>VALUES</STRONG> - The <STRONG>tgetflag</STRONG> routine gets the boolean entry for <EM>id</EM>, or ze- - ro if it is not available. - -- The <STRONG>tgetnum</STRONG> routine gets the numeric entry for <EM>id</EM>, or -1 -+ The <STRONG>tgetnum</STRONG> routine gets the numeric entry for <EM>id</EM>, or -1 - if it is not available. - -- The <STRONG>tgetstr</STRONG> routine returns the string entry for <EM>id</EM>, or -- zero if it is not available. Use <STRONG>tputs</STRONG> to output the re- -- turned string. The return value will also be copied to -- the buffer pointed to by <EM>area</EM>, and the <EM>area</EM> value will be -+ The <STRONG>tgetstr</STRONG> routine returns the string entry for <EM>id</EM>, or -+ zero if it is not available. Use <STRONG>tputs</STRONG> to output the re- -+ turned string. The return value will also be copied to -+ the buffer pointed to by <EM>area</EM>, and the <EM>area</EM> value will be - updated to point past the null ending this value. - - Only the first two characters of the <STRONG>id</STRONG> parameter of <STRONG>tget-</STRONG> - <STRONG>flag</STRONG>, <STRONG>tgetnum</STRONG> and <STRONG>tgetstr</STRONG> are compared in lookups. - -- The <STRONG>tgoto</STRONG> routine instantiates the parameters into the -- given capability. The output from this routine is to be -+ <STRONG>FORMATTING</STRONG> <STRONG>CAPABILITIES</STRONG> -+ The <STRONG>tgoto</STRONG> routine instantiates the parameters into the -+ given capability. The output from this routine is to be - passed to <STRONG>tputs</STRONG>. - -- The <STRONG>tputs</STRONG> routine is described on the <STRONG><A HREF="curs_terminfo.3x.html">curs_terminfo(3x)</A></STRONG> -+ The <STRONG>tputs</STRONG> routine is described on the <STRONG><A HREF="curs_terminfo.3x.html">curs_terminfo(3x)</A></STRONG> - manual page. It can retrieve capabilities by either term- - cap or terminfo name. - -+ <STRONG>GLOBAL</STRONG> <STRONG>VARIABLES</STRONG> - The variables <STRONG>PC</STRONG>, <STRONG>UP</STRONG> and <STRONG>BC</STRONG> are set by <STRONG>tgetent</STRONG> to the ter- - minfo entry's data for <STRONG>pad_char</STRONG>, <STRONG>cursor_up</STRONG> and -- <STRONG>backspace_if_not_bs</STRONG>, respectively. <STRONG>UP</STRONG> is not used by -+ <STRONG>backspace_if_not_bs</STRONG>, respectively. <STRONG>UP</STRONG> is not used by - ncurses. <STRONG>PC</STRONG> is used in the <STRONG>tdelay_output</STRONG> function. <STRONG>BC</STRONG> is -- used in the <STRONG>tgoto</STRONG> emulation. The variable <STRONG>ospeed</STRONG> is set -+ used in the <STRONG>tgoto</STRONG> emulation. The variable <STRONG>ospeed</STRONG> is set - by ncurses in a system-specific coding to reflect the ter- - minal speed. - -@@ -119,7 +142,7 @@ - </PRE> - <H2>RETURN VALUE</H2><PRE> - Except where explicitly noted, routines that return an in- -- teger return <STRONG>ERR</STRONG> upon failure and <STRONG>OK</STRONG> (SVr4 only specifies -+ teger return <STRONG>ERR</STRONG> upon failure and <STRONG>OK</STRONG> (SVr4 only specifies - "an integer value other than <STRONG>ERR</STRONG>") upon successful comple- - tion. - -@@ -129,54 +152,76 @@ - </PRE> - <H2>BUGS</H2><PRE> - If you call <STRONG>tgetstr</STRONG> to fetch <STRONG>ca</STRONG> or any other parameterized -- string, be aware that it will be returned in terminfo no- -+ string, be aware that it will be returned in terminfo no- - tation, not the older and not-quite-compatible termcap no- -- tation. This will not cause problems if all you do with -- it is call <STRONG>tgoto</STRONG> or <STRONG>tparm</STRONG>, which both expand terminfo- -- style strings as terminfo. (The <STRONG>tgoto</STRONG> function, if con- -- figured to support termcap, will check if the string is -- indeed terminfo-style by looking for "%p" parameters or -- "$&lt;..&gt;" delays, and invoke a termcap-style parser if the -+ tation. This will not cause problems if all you do with -+ it is call <STRONG>tgoto</STRONG> or <STRONG>tparm</STRONG>, which both expand terminfo- -+ style strings as terminfo. (The <STRONG>tgoto</STRONG> function, if con- -+ figured to support termcap, will check if the string is -+ indeed terminfo-style by looking for "%p" parameters or -+ "$&lt;..&gt;" delays, and invoke a termcap-style parser if the - string does not appear to be terminfo). - -- Because terminfo conventions for representing padding in -- string capabilities differ from termcap's, <STRONG>tputs("50");</STRONG> -- will put out a literal "50" rather than busy-waiting for -+ Because terminfo conventions for representing padding in -+ string capabilities differ from termcap's, <STRONG>tputs("50");</STRONG> -+ will put out a literal "50" rather than busy-waiting for - 50 milliseconds. Cope with it. - -- Note that termcap has nothing analogous to terminfo's <STRONG>sgr</STRONG> -- string. One consequence of this is that termcap applica- -- tions assume me (terminfo <STRONG>sgr0</STRONG>) does not reset the alter- -- nate character set. This implementation checks for, and -+ Note that termcap has nothing analogous to terminfo's <STRONG>sgr</STRONG> -+ string. One consequence of this is that termcap applica- -+ tions assume me (terminfo <STRONG>sgr0</STRONG>) does not reset the alter- -+ nate character set. This implementation checks for, and - modifies the data shown to the termcap interface to accom- - modate termcap's limitation in this respect. - - - </PRE> - <H2>PORTABILITY</H2><PRE> -- The XSI Curses standard, Issue 4 describes these func- -- tions. However, they are marked TO BE WITHDRAWN and may -+ The XSI Curses standard, Issue 4 describes these func- -+ tions. However, they are marked TO BE WITHDRAWN and may - be removed in future versions. - -- Neither the XSI Curses standard nor the SVr4 man pages -- documented the return values of <STRONG>tgetent</STRONG> correctly, though -- all three were in fact returned ever since SVr1. In par- -- ticular, an omission in the XSI Curses documentation has -- been misinterpreted to mean that <STRONG>tgetent</STRONG> returns <STRONG>OK</STRONG> or -+ Neither the XSI Curses standard nor the SVr4 man pages -+ documented the return values of <STRONG>tgetent</STRONG> correctly, though -+ all three were in fact returned ever since SVr1. In par- -+ ticular, an omission in the XSI Curses documentation has -+ been misinterpreted to mean that <STRONG>tgetent</STRONG> returns <STRONG>OK</STRONG> or - <STRONG>ERR</STRONG>. Because the purpose of these functions is to provide -- compatibility with the <EM>termcap</EM> library, that is a defect -+ compatibility with the <EM>termcap</EM> library, that is a defect - in XCurses, Issue 4, Version 2 rather than in ncurses. - -- External variables are provided for support of certain -- termcap applications. However, termcap applications' use -+ External variables are provided for support of certain -+ termcap applications. However, termcap applications' use - of those variables is poorly documented, e.g., not distin- -- guishing between input and output. In particular, some -+ guishing between input and output. In particular, some - applications are reported to declare and/or modify <STRONG>ospeed</STRONG>. - -+ The comment that only the first two characters of the <STRONG>id</STRONG> -+ parameter are used escapes many application developers. -+ The original BSD 4.2 termcap library (and historical -+ relics thereof) did not require a trailing null NUL on the -+ parameter name passed to <STRONG>tgetstr</STRONG>, <STRONG>tgetnum</STRONG> and <STRONG>tgetflag</STRONG>. -+ Some applications assume that the termcap interface does -+ not require the trailing NUL for the parameter name. Tak- -+ ing into account these issues: -+ -+ <STRONG>o</STRONG> As a special case, <STRONG>tgetflag</STRONG> matched against a single- -+ character identifier provided that was at the end of -+ the terminal description. You should not rely upon -+ this behavior in portable programs. This implementa- -+ tion disallows matches against single-character capa- -+ bility names. -+ -+ <STRONG>o</STRONG> This implementation disallows matches by the termcap -+ interface against extended capability names which are -+ longer than two characters. -+ - - </PRE> - <H2>SEE ALSO</H2><PRE> -- <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>, <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG>, <STRONG><A HREF="term_variables.3x.html">term_variables(3x)</A></STRONG>, <STRONG><A HREF="putc.3.html">putc(3)</A></STRONG>. -+ <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>, <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG>, <STRONG><A HREF="term_variables.3x.html">term_variables(3x)</A></STRONG>, <STRONG>putc(3)</STRONG>. -+ -+ http://invisible-island.net/ncurses/tctest.html - - - -diff -Naur ncurses-5.9/doc/html/man/curs_terminfo.3x.html ncurses-5.9.patch/doc/html/man/curs_terminfo.3x.html ---- ncurses-5.9/doc/html/man/curs_terminfo.3x.html 2011-01-09 02:03:15.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/curs_terminfo.3x.html 2014-09-01 16:33:22.324792069 +0200 -@@ -1,7 +1,7 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - **************************************************************************** -- * Copyright (c) 1999-2008,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1999-2011,2013 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -27,7 +27,12 @@ - * sale, use or other dealings in this Software without prior written * - * authorization. * - **************************************************************************** -- * @Id: curs_terminfo.3x,v 1.35 2010/12/04 18:38:55 tom Exp @ -+ * @Id: curs_terminfo.3x,v 1.43 2013/07/20 19:29:59 tom Exp @ -+ * *************************************************************************** -+ * *************************************************************************** -+ * *************************************************************************** -+ * *************************************************************************** -+ * *************************************************************************** - --> - <HTML> - <HEAD> -@@ -68,7 +73,7 @@ - <STRONG>int</STRONG> <STRONG>putp(const</STRONG> <STRONG>char</STRONG> <STRONG>*</STRONG><EM>str</EM><STRONG>);</STRONG> - <STRONG>int</STRONG> <STRONG>vidputs(chtype</STRONG> <EM>attrs</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <STRONG>(*</STRONG><EM>putc</EM><STRONG>)(int));</STRONG> - <STRONG>int</STRONG> <STRONG>vidattr(chtype</STRONG> <EM>attrs</EM><STRONG>);</STRONG> -- <STRONG>int</STRONG> <STRONG>vid_puts(attr_t</STRONG> <EM>attrs</EM><STRONG>,</STRONG> <STRONG>short</STRONG> <EM>pair</EM><STRONG>,</STRONG> <STRONG>void</STRONG> <STRONG>*</STRONG><EM>opts</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <STRONG>(*</STRONG><EM>putc</EM><STRONG>)(char));</STRONG> -+ <STRONG>int</STRONG> <STRONG>vid_puts(attr_t</STRONG> <EM>attrs</EM><STRONG>,</STRONG> <STRONG>short</STRONG> <EM>pair</EM><STRONG>,</STRONG> <STRONG>void</STRONG> <STRONG>*</STRONG><EM>opts</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <STRONG>(*</STRONG><EM>putc</EM><STRONG>)(int));</STRONG> - <STRONG>int</STRONG> <STRONG>vid_attr(attr_t</STRONG> <EM>attrs</EM><STRONG>,</STRONG> <STRONG>short</STRONG> <EM>pair</EM><STRONG>,</STRONG> <STRONG>void</STRONG> <STRONG>*</STRONG><EM>opts</EM><STRONG>);</STRONG> - <STRONG>int</STRONG> <STRONG>mvcur(int</STRONG> <EM>oldrow</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <EM>oldcol</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <EM>newrow</EM>, int <EM>newcol</EM><STRONG>);</STRONG> - <STRONG>int</STRONG> <STRONG>tigetflag(char</STRONG> <STRONG>*</STRONG><EM>capname</EM><STRONG>);</STRONG> -@@ -85,38 +90,51 @@ - tion keys. For all other functionality, <STRONG>curses</STRONG> routines - are more suitable and their use is recommended. - -+ <STRONG>Initialization</STRONG> - Initially, <STRONG>setupterm</STRONG> should be called. Note that <STRONG>se-</STRONG> - <STRONG>tupterm</STRONG> is automatically called by <STRONG>initscr</STRONG> and <STRONG>newterm</STRONG>. - This defines the set of terminal-dependent variables -- [listed in <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG>]. The <STRONG>terminfo</STRONG> variables <STRONG>lines</STRONG> and -- <STRONG>columns</STRONG> are initialized by <STRONG>setupterm</STRONG> as follows: -+ [listed in <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG>]. - -- If <STRONG>use_env(FALSE)</STRONG> has been called, values for <STRONG>lines</STRONG> -- and <STRONG>columns</STRONG> specified in <STRONG>terminfo</STRONG> are used. -+ Each initialization routine provides applications with the -+ terminal capabilities either directly (via header defini- -+ tions), or by special functions. The header files <STRONG>curs-</STRONG> -+ <STRONG>es.h</STRONG> and <STRONG>term.h</STRONG> should be included (in this order) to get -+ the definitions for these strings, numbers, and flags. - -- Otherwise, if the environment variables <STRONG>LINES</STRONG> and -- <STRONG>COLUMNS</STRONG> exist, their values are used. If these en- -- vironment variables do not exist and the program is -- running in a window, the current window size is -- used. Otherwise, if the environment variables do -- not exist, the values for <STRONG>lines</STRONG> and <STRONG>columns</STRONG> speci- -- fied in the <STRONG>terminfo</STRONG> database are used. -- -- The header files <STRONG>curses.h</STRONG> and <STRONG>term.h</STRONG> should be included -- (in this order) to get the definitions for these strings, -- numbers, and flags. Parameterized strings should be -- passed through <STRONG>tparm</STRONG> to instantiate them. All <STRONG>terminfo</STRONG> -- strings [including the output of <STRONG>tparm</STRONG>] should be printed -- with <STRONG>tputs</STRONG> or <STRONG>putp</STRONG>. Call the <STRONG>reset_shell_mode</STRONG> to restore -- the tty modes before exiting [see <STRONG><A HREF="curs_kernel.3x.html">curs_kernel(3x)</A></STRONG>]. Pro- -- grams which use cursor addressing should output <STRONG>en-</STRONG> -- <STRONG>ter_ca_mode</STRONG> upon startup and should output <STRONG>exit_ca_mode</STRONG> -- before exiting. Programs desiring shell escapes should -- call -- -- <STRONG>reset_shell_mode</STRONG> and output <STRONG>exit_ca_mode</STRONG> before the shell -- is called and should output <STRONG>enter_ca_mode</STRONG> and call <STRONG>re-</STRONG> -- <STRONG>set_prog_mode</STRONG> after returning from the shell. -+ The <STRONG>terminfo</STRONG> variables <STRONG>lines</STRONG> and <STRONG>columns</STRONG> are initialized -+ by <STRONG>setupterm</STRONG> as follows: -+ -+ <STRONG>o</STRONG> If <STRONG>use_env(FALSE)</STRONG> has been called, values for <STRONG>lines</STRONG> -+ and <STRONG>columns</STRONG> specified in <STRONG>terminfo</STRONG> are used. -+ -+ <STRONG>o</STRONG> Otherwise, if the environment variables <STRONG>LINES</STRONG> and <STRONG>COL-</STRONG> -+ <STRONG>UMNS</STRONG> exist, their values are used. If these environ- -+ ment variables do not exist and the program is running -+ in a window, the current window size is used. Other- -+ wise, if the environment variables do not exist, the -+ values for <STRONG>lines</STRONG> and <STRONG>columns</STRONG> specified in the <STRONG>terminfo</STRONG> -+ database are used. -+ -+ Parameterized strings should be passed through <STRONG>tparm</STRONG> to -+ instantiate them. All <STRONG>terminfo</STRONG> strings [including the -+ output of <STRONG>tparm</STRONG>] should be printed with <STRONG>tputs</STRONG> or <STRONG>putp</STRONG>. -+ Call <STRONG>reset_shell_mode</STRONG> to restore the tty modes before ex- -+ iting [see <STRONG><A HREF="curs_kernel.3x.html">curs_kernel(3x)</A></STRONG>]. -+ -+ Programs which use cursor addressing should -+ -+ <STRONG>o</STRONG> output <STRONG>enter_ca_mode</STRONG> upon startup and -+ -+ <STRONG>o</STRONG> output <STRONG>exit_ca_mode</STRONG> before exiting. -+ -+ Programs which execute shell subprocesses should -+ -+ <STRONG>o</STRONG> call <STRONG>reset_shell_mode</STRONG> and output <STRONG>exit_ca_mode</STRONG> before -+ the shell is called and -+ -+ <STRONG>o</STRONG> output <STRONG>enter_ca_mode</STRONG> and call <STRONG>reset_prog_mode</STRONG> after -+ returning from the shell. - - The <STRONG>setupterm</STRONG> routine reads in the <STRONG>terminfo</STRONG> database, ini- - tializing the <STRONG>terminfo</STRONG> structures, but does not set up the -@@ -129,54 +147,74 @@ - <EM>rret</EM>. A return value of <STRONG>OK</STRONG> combined with status of <STRONG>1</STRONG> in - <EM>errret</EM> is normal. If <STRONG>ERR</STRONG> is returned, examine <EM>errret</EM>: - -- <STRONG>1</STRONG> means that the terminal is hardcopy, cannot be -- used for curses applications. -+ <STRONG>1</STRONG> means that the terminal is hardcopy, cannot be used -+ for curses applications. -+ -+ <STRONG>setupterm</STRONG> determines if the entry is a hardcopy type -+ by checking the <EM>hc</EM> (<EM>hardcopy</EM>) capability. - -- <STRONG>0</STRONG> means that the terminal could not be found, or -- that it is a generic type, having too little -- information for curses applications to run. -+ <STRONG>0</STRONG> means that the terminal could not be found, or that -+ it is a generic type, having too little information -+ for curses applications to run. - -- <STRONG>-1</STRONG> means that the <STRONG>terminfo</STRONG> database could not be -- found. -+ <STRONG>setupterm</STRONG> determines if the entry is a generic type -+ by checking the <EM>gn</EM> (<EM>generic</EM>) capability. - -- If <EM>errret</EM> is null, <STRONG>setupterm</STRONG> prints an error message upon -+ <STRONG>-1</STRONG> means that the <STRONG>terminfo</STRONG> database could not be found. -+ -+ If <EM>errret</EM> is null, <STRONG>setupterm</STRONG> prints an error message upon - finding an error and exits. Thus, the simplest call is: - - <STRONG>setupterm((char</STRONG> <STRONG>*)0,</STRONG> <STRONG>1,</STRONG> <STRONG>(int</STRONG> <STRONG>*)0);</STRONG>, - -- which uses all the defaults and sends the output to <STRONG>std-</STRONG> -+ which uses all the defaults and sends the output to <STRONG>std-</STRONG> - <STRONG>out</STRONG>. - -- The <STRONG>setterm</STRONG> routine is being replaced by <STRONG>setupterm</STRONG>. The -- call: -+ The <STRONG>setterm</STRONG> routine was replaced by <STRONG>setupterm</STRONG>. The call: - - <STRONG>setupterm(</STRONG><EM>term</EM><STRONG>,</STRONG> <STRONG>1,</STRONG> <STRONG>(int</STRONG> <STRONG>*)0)</STRONG> - - provides the same functionality as <STRONG>setterm(</STRONG><EM>term</EM><STRONG>)</STRONG>. The -- <STRONG>setterm</STRONG> routine is included here for BSD compatibility, -- and is not recommended for new programs. -+ <STRONG>setterm</STRONG> routine is provided for BSD compatibility, and is -+ not recommended for new programs. - -- The <STRONG>set_curterm</STRONG> routine sets the variable <STRONG>cur_term</STRONG> to -- <EM>nterm</EM>, and makes all of the <STRONG>terminfo</STRONG> boolean, numeric, and -- string variables use the values from <EM>nterm</EM>. It returns -- the old value of <STRONG>cur_term</STRONG>. -+ <STRONG>The</STRONG> <STRONG>Terminal</STRONG> <STRONG>State</STRONG> -+ The <STRONG>setupterm</STRONG> routine stores its information about the -+ terminal in a <STRONG>TERMINAL</STRONG> structure pointed to by the global -+ variable <STRONG>cur_term</STRONG>. If it detects an error, or decides -+ that the terminal is unsuitable (hardcopy or generic), it -+ discards this information, making it not available to ap- -+ plications. -+ -+ If <STRONG>setupterm</STRONG> is called repeatedly for the same terminal -+ type, it will reuse the information. It maintains only -+ one copy of a given terminal's capabilities in memory. If -+ it is called for different terminal types, <STRONG>setupterm</STRONG> allo- -+ cates new storage for each set of terminal capabilities. -+ -+ The <STRONG>set_curterm</STRONG> routine sets <STRONG>cur_term</STRONG> to <EM>nterm</EM>, and makes -+ all of the <STRONG>terminfo</STRONG> boolean, numeric, and string variables -+ use the values from <EM>nterm</EM>. It returns the old value of -+ <STRONG>cur_term</STRONG>. - -- The <STRONG>del_curterm</STRONG> routine frees the space pointed to by -+ The <STRONG>del_curterm</STRONG> routine frees the space pointed to by - <EM>oterm</EM> and makes it available for further use. If <EM>oterm</EM> is -- the same as <STRONG>cur_term</STRONG>, references to any of the <STRONG>terminfo</STRONG> -- boolean, numeric, and string variables thereafter may re- -- fer to invalid memory locations until another <STRONG>setupterm</STRONG> -+ the same as <STRONG>cur_term</STRONG>, references to any of the <STRONG>terminfo</STRONG> -+ boolean, numeric, and string variables thereafter may re- -+ fer to invalid memory locations until another <STRONG>setupterm</STRONG> - has been called. - - The <STRONG>restartterm</STRONG> routine is similar to <STRONG>setupterm</STRONG> and -- <STRONG>initscr</STRONG>, except that it is called after restoring memory -- to a previous state (for example, when reloading a game -- saved as a core image dump). It assumes that the windows -- and the input and output options are the same as when mem- -- ory was saved, but the terminal type and baud rate may be -- different. Accordingly, it saves various tty state bits, -- calls <STRONG>setupterm</STRONG>, and then restores the bits. -+ <STRONG>initscr</STRONG>, except that it is called after restoring memory -+ to a previous state (for example, when reloading a game -+ saved as a core image dump). <STRONG>restartterm</STRONG> assumes that the -+ windows and the input and output options are the same as -+ when memory was saved, but the terminal type and baud rate -+ may be different. Accordingly, <STRONG>restartterm</STRONG> saves various -+ tty state bits, calls <STRONG>setupterm</STRONG>, and then restores the -+ bits. - -+ <STRONG>Formatting</STRONG> <STRONG>Output</STRONG> - The <STRONG>tparm</STRONG> routine instantiates the string <EM>str</EM> with parame- - ters <EM>pi</EM>. A pointer is returned to the result of <EM>str</EM> with - the parameters applied. -@@ -185,6 +223,7 @@ - rather than a fixed-parameter list. Its numeric parame- - ters are integers (int) rather than longs. - -+ <STRONG>Output</STRONG> <STRONG>Functions</STRONG> - The <STRONG>tputs</STRONG> routine applies padding information to the - string <EM>str</EM> and outputs it. The <EM>str</EM> must be a terminfo - string variable or the return value from <STRONG>tparm</STRONG>, <STRONG>tgetstr</STRONG>, -@@ -218,36 +257,48 @@ - takes effect immediately (rather than at the next re- - fresh). - -+ <STRONG>Terminal</STRONG> <STRONG>Capability</STRONG> <STRONG>Functions</STRONG> - The <STRONG>tigetflag</STRONG>, <STRONG>tigetnum</STRONG> and <STRONG>tigetstr</STRONG> routines return the - value of the capability corresponding to the <STRONG>terminfo</STRONG> <EM>cap-</EM> -- <EM>name</EM> passed to them, such as <STRONG>xenl</STRONG>. -+ <EM>name</EM> passed to them, such as <STRONG>xenl</STRONG>. The <EM>capname</EM> for each -+ capability is given in the table column entitled <EM>capname</EM> -+ code in the capabilities section of <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG>. -+ -+ These routines return special values to denote errors. -+ -+ The <STRONG>tigetflag</STRONG> routine returns -+ -+ <STRONG>-1</STRONG> if <EM>capname</EM> is not a boolean capability, or -+ -+ <STRONG>0</STRONG> if it is canceled or absent from the terminal de- -+ scription. - -- The <STRONG>tigetflag</STRONG> routine returns the value <STRONG>-1</STRONG> if <EM>capname</EM> is -- not a boolean capability, or <STRONG>0</STRONG> if it is canceled or absent -- from the terminal description. -- -- The <STRONG>tigetnum</STRONG> routine returns the value <STRONG>-2</STRONG> if <EM>capname</EM> is -- not a numeric capability, or <STRONG>-1</STRONG> if it is canceled or ab- -- sent from the terminal description. -- -- The <STRONG>tigetstr</STRONG> routine returns the value <STRONG>(char</STRONG> <STRONG>*)-1</STRONG> if <EM>cap-</EM> -- <EM>name</EM> is not a string capability, or <STRONG>0</STRONG> if it is canceled or -- absent from the terminal description. -- -- The <EM>capname</EM> for each capability is given in the table col- -- umn entitled <EM>capname</EM> code in the capabilities section of -- <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG>. -+ The <STRONG>tigetnum</STRONG> routine returns - -+ <STRONG>-2</STRONG> if <EM>capname</EM> is not a numeric capability, or -+ -+ <STRONG>-1</STRONG> if it is canceled or absent from the terminal de- -+ scription. -+ -+ The <STRONG>tigetstr</STRONG> routine returns -+ -+ <STRONG>(char</STRONG> <STRONG>*)-1</STRONG> -+ if <EM>capname</EM> is not a string capability, or -+ -+ <STRONG>0</STRONG> if it is canceled or absent from the terminal de- -+ scription. -+ -+ <STRONG>Terminal</STRONG> <STRONG>Capability</STRONG> <STRONG>Names</STRONG> -+ These null-terminated arrays contain the short terminfo -+ names ("codes"), the <STRONG>termcap</STRONG> names, and the long terminfo -+ names ("fnames") for each of the predefined <STRONG>terminfo</STRONG> vari- -+ ables: - <STRONG>char</STRONG> <STRONG>*boolnames[]</STRONG>, <STRONG>*boolcodes[]</STRONG>, <STRONG>*boolfnames[]</STRONG> - - <STRONG>char</STRONG> <STRONG>*numnames[]</STRONG>, <STRONG>*numcodes[]</STRONG>, <STRONG>*numfnames[]</STRONG> - - <STRONG>char</STRONG> <STRONG>*strnames[]</STRONG>, <STRONG>*strcodes[]</STRONG>, <STRONG>*strfnames[]</STRONG> - -- These null-terminated arrays contain the <EM>capnames</EM>, the -- <STRONG>termcap</STRONG> codes, and the full C names, for each of the <STRONG>ter-</STRONG> -- <STRONG>minfo</STRONG> variables. -- - - </PRE> - <H2>RETURN VALUE</H2><PRE> -@@ -261,49 +312,64 @@ - X/Open defines no error conditions. In this implementa- - tion - -- <STRONG>del_curterm</STRONG> -- returns an error if its terminal parameter is -- null. -- -- <STRONG>putp</STRONG> calls <STRONG>tputs</STRONG>, returning the same error-codes. -- -- <STRONG>restartterm</STRONG> -- returns an error if the associated call to <STRONG>se-</STRONG> -- <STRONG>tupterm</STRONG> returns an error. -- -- <STRONG>setupterm</STRONG> -- returns an error if it cannot allocate enough -- memory, or create the initial windows (stdscr, -- curscr, newscr). Other error conditions are -- documented above. -- -- <STRONG>tputs</STRONG> -- returns an error if the string parameter is -- null. It does not detect I/O errors: X/Open -- states that <STRONG>tputs</STRONG> ignores the return value of -- the output function <EM>putc</EM>. -- -- --</PRE> --<H2>NOTES</H2><PRE> -- The <STRONG>setupterm</STRONG> routine should be used in place of <STRONG>setterm</STRONG>. -- It may be useful when you want to test for terminal capa- -- bilities without committing to the allocation of storage -- involved in <STRONG>initscr</STRONG>. -- -- Note that <STRONG>vidattr</STRONG> and <STRONG>vidputs</STRONG> may be macros. -+ <STRONG>del_curterm</STRONG> -+ returns an error if its terminal parameter is -+ null. -+ -+ <STRONG>putp</STRONG> calls <STRONG>tputs</STRONG>, returning the same error-codes. -+ -+ <STRONG>restartterm</STRONG> -+ returns an error if the associated call to <STRONG>se-</STRONG> -+ <STRONG>tupterm</STRONG> returns an error. -+ -+ <STRONG>setupterm</STRONG> -+ returns an error if it cannot allocate enough -+ memory, or create the initial windows (stdscr, -+ curscr, newscr). Other error conditions are -+ documented above. -+ -+ <STRONG>tputs</STRONG> -+ returns an error if the string parameter is -+ null. It does not detect I/O errors: X/Open -+ states that <STRONG>tputs</STRONG> ignores the return value of -+ the output function <EM>putc</EM>. - - - </PRE> - <H2>PORTABILITY</H2><PRE> -- The function <STRONG>setterm</STRONG> is not described by X/Open and must -- be considered non-portable. All other functions are as -+ X/Open notes that <STRONG>vidattr</STRONG> and <STRONG>vidputs</STRONG> may be macros. -+ -+ The function <STRONG>setterm</STRONG> is not described by X/Open and must -+ be considered non-portable. All other functions are as - described by X/Open. - -- <STRONG>setupterm</STRONG> copies the terminal name to the array <STRONG>ttytype</STRONG>. -- This is not part of X/Open Curses, but is assumed by some -+ <STRONG>setupterm</STRONG> copies the terminal name to the array <STRONG>ttytype</STRONG>. -+ This is not part of X/Open Curses, but is assumed by some - applications. - -+ If configured to use the terminal-driver, e.g., for the -+ MinGW port, -+ -+ <STRONG>o</STRONG> <STRONG>setupterm</STRONG> interprets a missing/empty TERM variable as -+ the special value "unknown". -+ -+ <STRONG>o</STRONG> <STRONG>setupterm</STRONG> allows explicit use of the the windows con- -+ sole driver by checking if $TERM is set to "#win32con" -+ or an abbreviation of that string. -+ -+ Older versions of <STRONG>ncurses</STRONG> assumed that the file descriptor -+ passed to <STRONG>setupterm</STRONG> from <STRONG>initscr</STRONG> or <STRONG>newterm</STRONG> uses buffered -+ I/O, and would write to the corresponding stream. In ad- -+ dition to the limitation that the terminal was left in -+ block-buffered mode on exit (like SystemV curses), it was -+ problematic because <STRONG>ncurses</STRONG> did not allow a reliable way -+ to cleanup on receiving SIGTSTP. The current version uses -+ output buffers managed directly by <STRONG>ncurses</STRONG>. Some of the -+ low-level functions described in this manual page write to -+ the standard output. They are not signal-safe. The high- -+ level functions in <STRONG>ncurses</STRONG> use alternate versions of these -+ functions using the more reliable buffering scheme. -+ - In System V Release 4, <STRONG>set_curterm</STRONG> has an <STRONG>int</STRONG> return type - and returns <STRONG>OK</STRONG> or <STRONG>ERR</STRONG>. We have chosen to implement the - X/Open Curses semantics. -@@ -323,12 +389,12 @@ - zeroes are fine for this purpose. - - In response to comments by Thomas E. Dickey, X/Open Curses -- Issue 7 proposed the <STRONG>tiparam</STRONG> function in mid-2009. -+ Issue 7 proposed the <STRONG>tiparm</STRONG> function in mid-2009. - - X/Open notes that after calling <STRONG>mvcur</STRONG>, the curses state - may not match the actual terminal state, and that an ap- - plication should touch and refresh the window before re- -- suming normal curses calls. Both ncurses and System V Re- -+ suming normal curses calls. Both <STRONG>ncurses</STRONG> and System V Re- - lease 4 curses implement <STRONG>mvcur</STRONG> using the SCREEN data allo- - cated in either <STRONG>initscr</STRONG> or <STRONG>newterm</STRONG>. So though it is docu- - mented as a terminfo function, <STRONG>mvcur</STRONG> is really a curses -@@ -339,15 +405,18 @@ - for the old ordinates. In that case, the old location is - unknown. - -+ Other implementions may not declare the capability name -+ arrays. Some provide them without declaring them. X/Open -+ does not specify them. -+ - Extended terminal capability names, e.g., as defined by -- <STRONG>tic</STRONG> <STRONG>-x</STRONG>, are not stored in the arrays described in this -- section. -+ <STRONG>tic</STRONG> <STRONG>-x</STRONG>, are not stored in the arrays described here. - - - </PRE> - <H2>SEE ALSO</H2><PRE> -- <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>, <STRONG><A HREF="curs_initscr.3x.html">curs_initscr(3x)</A></STRONG>, <STRONG><A HREF="curs_kernel.3x.html">curs_kernel(3x)</A></STRONG>, <STRONG>curs_term-</STRONG> -- <STRONG><A HREF="curs_termcap.3x.html">cap(3x)</A></STRONG>, <STRONG><A HREF="curs_variables.3x.html">curs_variables(3x)</A></STRONG>, <STRONG><A HREF="term_variables.3x.html">term_variables(3x)</A></STRONG>, <STRONG><A HREF="putc.3.html">putc(3)</A></STRONG>, -+ <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>, <STRONG><A HREF="curs_initscr.3x.html">curs_initscr(3x)</A></STRONG>, <STRONG><A HREF="curs_kernel.3x.html">curs_kernel(3x)</A></STRONG>, <STRONG>curs_term-</STRONG> -+ <STRONG><A HREF="curs_termcap.3x.html">cap(3x)</A></STRONG>, <STRONG><A HREF="curs_variables.3x.html">curs_variables(3x)</A></STRONG>, <STRONG><A HREF="term_variables.3x.html">term_variables(3x)</A></STRONG>, <STRONG>putc(3)</STRONG>, - <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG> - - -diff -Naur ncurses-5.9/doc/html/man/curs_threads.3x.html ncurses-5.9.patch/doc/html/man/curs_threads.3x.html ---- ncurses-5.9/doc/html/man/curs_threads.3x.html 2011-01-09 02:03:15.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/curs_threads.3x.html 2014-09-01 16:33:22.324792069 +0200 -@@ -1,7 +1,7 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - **************************************************************************** -- * Copyright (c) 2008,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 2008-2010,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -27,7 +27,7 @@ - * sale, use or other dealings in this Software without prior written * - * authorization. * - **************************************************************************** -- * @Id: curs_threads.3x,v 1.18 2010/12/04 18:38:55 tom Exp @ -+ * @Id: curs_threads.3x,v 1.19 2012/05/26 17:03:26 tom Exp @ - * *************************************************************************** - * *************************************************************************** - --> -@@ -61,9 +61,9 @@ - <STRONG>int</STRONG> <STRONG>get_escdelay(void);</STRONG> - <STRONG>int</STRONG> <STRONG>set_escdelay(int</STRONG> <STRONG>size);</STRONG> - <STRONG>int</STRONG> <STRONG>set_tabsize(int</STRONG> <STRONG>size);</STRONG> -- <STRONG>int</STRONG> <STRONG>use_screen(SCREEN</STRONG> <STRONG>*scr,</STRONG> <STRONG>NCURSES_WINDOW_CB</STRONG> <STRONG>func,</STRONG> <STRONG>void</STRONG> -+ <STRONG>int</STRONG> <STRONG>use_screen(SCREEN</STRONG> <STRONG>*scr,</STRONG> <STRONG>NCURSES_SCREEN_CB</STRONG> <STRONG>func,</STRONG> <STRONG>void</STRONG> - <STRONG>*data);</STRONG> -- <STRONG>int</STRONG> <STRONG>use_window(WINDOW</STRONG> <STRONG>*win,</STRONG> <STRONG>NCURSES_SCREEN_CB</STRONG> <STRONG>func,</STRONG> <STRONG>void</STRONG> -+ <STRONG>int</STRONG> <STRONG>use_window(WINDOW</STRONG> <STRONG>*win,</STRONG> <STRONG>NCURSES_WINDOW_CB</STRONG> <STRONG>func,</STRONG> <STRONG>void</STRONG> - <STRONG>*data);</STRONG> - - -diff -Naur ncurses-5.9/doc/html/man/curs_touch.3x.html ncurses-5.9.patch/doc/html/man/curs_touch.3x.html ---- ncurses-5.9/doc/html/man/curs_touch.3x.html 2011-01-09 02:03:15.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/curs_touch.3x.html 2014-09-01 16:33:22.324792069 +0200 -@@ -1,4 +1,4 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - **************************************************************************** - * Copyright (c) 1998-2006,2010 Free Software Foundation, Inc. * -diff -Naur ncurses-5.9/doc/html/man/curs_trace.3x.html ncurses-5.9.patch/doc/html/man/curs_trace.3x.html ---- ncurses-5.9/doc/html/man/curs_trace.3x.html 2011-01-09 02:03:16.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/curs_trace.3x.html 2014-09-01 16:33:22.324792069 +0200 -@@ -1,4 +1,4 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - **************************************************************************** - * Copyright (c) 2000-2009,2010 Free Software Foundation, Inc. * -diff -Naur ncurses-5.9/doc/html/man/curs_util.3x.html ncurses-5.9.patch/doc/html/man/curs_util.3x.html ---- ncurses-5.9/doc/html/man/curs_util.3x.html 2011-02-26 00:24:59.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/curs_util.3x.html 2014-09-01 16:33:22.325792071 +0200 -@@ -1,7 +1,8 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- -+ * t - **************************************************************************** -- * Copyright (c) 1998-2008,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -27,7 +28,7 @@ - * sale, use or other dealings in this Software without prior written * - * authorization. * - **************************************************************************** -- * @Id: curs_util.3x,v 1.32 2010/12/04 18:38:55 tom Exp @ -+ * @Id: curs_util.3x,v 1.37 2013/07/20 19:43:45 tom Exp @ - --> - <HTML> - <HEAD> -@@ -48,8 +49,8 @@ - </PRE> - <H2>NAME</H2><PRE> - <STRONG>delay_output</STRONG>, <STRONG>filter</STRONG>, <STRONG>flushinp</STRONG>, <STRONG>getwin</STRONG>, <STRONG>key_name</STRONG>, <STRONG>keyname</STRONG>, -- <STRONG>nofilter</STRONG>, <STRONG>putwin</STRONG>, <STRONG>unctrl</STRONG>, <STRONG>use_env</STRONG>, <STRONG>wunctrl</STRONG> - miscellaneous -- <STRONG>curses</STRONG> utility routines -+ <STRONG>nofilter</STRONG>, <STRONG>putwin</STRONG>, <STRONG>unctrl</STRONG>, <STRONG>use_env</STRONG>, <STRONG>use_tioctl</STRONG>, <STRONG>wunctrl</STRONG> - -+ miscellaneous <STRONG>curses</STRONG> utility routines - - - </PRE> -@@ -63,6 +64,7 @@ - <STRONG>void</STRONG> <STRONG>filter(void);</STRONG> - <STRONG>void</STRONG> <STRONG>nofilter(void);</STRONG> - <STRONG>void</STRONG> <STRONG>use_env(bool</STRONG> <STRONG>f);</STRONG> -+ <STRONG>void</STRONG> <STRONG>use_tioctl(bool</STRONG> <STRONG>f);</STRONG> - <STRONG>int</STRONG> <STRONG>putwin(WINDOW</STRONG> <STRONG>*win,</STRONG> <STRONG>FILE</STRONG> <STRONG>*filep);</STRONG> - <STRONG>WINDOW</STRONG> <STRONG>*getwin(FILE</STRONG> <STRONG>*filep);</STRONG> - <STRONG>int</STRONG> <STRONG>delay_output(int</STRONG> <STRONG>ms);</STRONG> -@@ -122,16 +124,66 @@ - <STRONG>$TERM</STRONG>. The limitation arises because the <STRONG>filter</STRONG> routine - modifies the in-memory copy of the terminal information. - -- The <STRONG>use_env</STRONG> routine, if used, is called before <STRONG>initscr</STRONG> or -- <STRONG>newterm</STRONG> are called. When called with <STRONG>FALSE</STRONG> as an argu- -- ment, the values of <STRONG>lines</STRONG> and <STRONG>columns</STRONG> specified in the -- <EM>terminfo</EM> database will be used, even if environment vari- -- ables <STRONG>LINES</STRONG> and <STRONG>COLUMNS</STRONG> (used by default) are set, or if -- <STRONG>curses</STRONG> is running in a window (in which case default be- -- havior would be to use the window size if <STRONG>LINES</STRONG> and -- <STRONG>COLUMNS</STRONG> are not set). Note that setting <STRONG>LINES</STRONG> or <STRONG>COLUMNS</STRONG> -- overrides the corresponding size which may be obtained -- from the operating system. -+ The <STRONG>use_env</STRONG> routine, if used, should be called before -+ <STRONG>initscr</STRONG> or <STRONG>newterm</STRONG> are called (because those compute the -+ screen size). It modifies the way <STRONG>ncurses</STRONG> treats environ- -+ ment variables when determining the screen size. -+ -+ <STRONG>o</STRONG> Normally ncurses looks first at the terminal database -+ for the screen size. -+ -+ If <STRONG>use_env</STRONG> was called with <STRONG>FALSE</STRONG> for parameter, it -+ stops here unless If <STRONG>use_tioctl</STRONG> was also called with -+ <STRONG>TRUE</STRONG> for parameter. -+ -+ <STRONG>o</STRONG> Then it asks for the screen size via operating system -+ calls. If successful, it overrides the values from -+ the terminal database. -+ -+ <STRONG>o</STRONG> Finally (unless <STRONG>use_env</STRONG> was called with <STRONG>FALSE</STRONG> parame- -+ ter), ncurses examines the <STRONG>LINES</STRONG> or <STRONG>COLUMNS</STRONG> environ- -+ ment variables, using a value in those to override the -+ results from the operating system or terminal data- -+ base. -+ -+ Ncurses also updates the screen size in response to -+ SIGWINCH, unless overridden by the <STRONG>LINES</STRONG> or <STRONG>COLUMNS</STRONG> -+ environment variables, -+ -+ The <STRONG>use_tioctl</STRONG> routine, if used, should be called before -+ <STRONG>initscr</STRONG> or <STRONG>newterm</STRONG> are called (because those compute the -+ screen size). After <STRONG>use_tioctl</STRONG> is called with <STRONG>TRUE</STRONG> as an -+ argument, ncurses modifies the last step in its computa- -+ tion of screen size as follows: -+ -+ <STRONG>o</STRONG> checks if the <STRONG>LINES</STRONG> and <STRONG>COLUMNS</STRONG> environment variables -+ are set to a number greater than zero. -+ -+ <STRONG>o</STRONG> for each, ncurses updates the corresponding environ- -+ ment variable with the value that it has obtained via -+ operating system call or from the terminal database. -+ -+ <STRONG>o</STRONG> ncurses re-fetches the value of the environment vari- -+ ables so that it is still the environment variables -+ which set the screen size. -+ -+ The <STRONG>use_env</STRONG> and <STRONG>use_tioctl</STRONG> routines combine as summarized -+ here: -+ -+ <EM>use</EM><STRONG>_</STRONG><EM>env</EM> <EM>use</EM><STRONG>_</STRONG><EM>tioctl</EM> <EM>Summary</EM> -+ ---------------------------------------------------------------- -+ TRUE FALSE This is the default behavior. ncurses -+ uses operating system calls unless over- -+ ridden by $LINES or $COLUMNS environment -+ variables. -+ TRUE TRUE ncurses updates $LINES and $COLUMNS -+ based on operating system calls. -+ -+ FALSE TRUE ncurses ignores $LINES and $COLUMNS, us- -+ es operating system calls to obtain -+ size. -+ FALSE FALSE ncurses relies on the terminal database -+ to determine size. - - The <STRONG>putwin</STRONG> routine writes all data associated with window - <EM>win</EM> into the file to which <EM>filep</EM> points. This information -@@ -191,60 +243,60 @@ - control code. If <STRONG>use_legacy_coding</STRONG> has been called - with a <STRONG>2</STRONG> parameter, <STRONG>unctrl</STRONG> returns the parameter, - i.e., a one-character string with the parameter as -- the first character. Otherwise, it returns ``~@'', -- ``~A'', etc., analogous to ``^@'', ``^A'', C0 con- -- trols. -- -- X/Open Curses does not document whether <STRONG>unctrl</STRONG> can -- be called before initializing curses. This imple- -- mentation permits that, and returns the ``~@'', -- etc., values in that case. -+ the first character. Otherwise, it returns "~@", -+ "~A", etc., analogous to "^@", "^A", C0 controls. - -- <STRONG>o</STRONG> parameter values outside the 0 to 255 range. <STRONG>unc-</STRONG> -+ X/Open Curses does not document whether <STRONG>unctrl</STRONG> can -+ be called before initializing curses. This imple- -+ mentation permits that, and returns the "~@", etc., -+ values in that case. -+ -+ <STRONG>o</STRONG> parameter values outside the 0 to 255 range. <STRONG>unc-</STRONG> - <STRONG>trl</STRONG> returns a null pointer. - - The SVr4 documentation describes the action of <STRONG>filter</STRONG> only -- in the vaguest terms. The description here is adapted -- from the XSI Curses standard (which erroneously fails to -+ in the vaguest terms. The description here is adapted -+ from the XSI Curses standard (which erroneously fails to - describe the disabling of <STRONG>cuu</STRONG>). - -- The strings returned by <STRONG>unctrl</STRONG> in this implementation are -- determined at compile time, showing C1 controls from the -- upper-128 codes with a `~' prefix rather than `^'. Other -- implementations have different conventions. For example, -- they may show both sets of control characters with `^', -- and strip the parameter to 7 bits. Or they may ignore C1 -- controls and treat all of the upper-128 codes as print- -+ The strings returned by <STRONG>unctrl</STRONG> in this implementation are -+ determined at compile time, showing C1 controls from the -+ upper-128 codes with a `~' prefix rather than `^'. Other -+ implementations have different conventions. For example, -+ they may show both sets of control characters with `^', -+ and strip the parameter to 7 bits. Or they may ignore C1 -+ controls and treat all of the upper-128 codes as print- - able. This implementation uses 8 bits but does not modify - the string to reflect locale. The <STRONG>use_legacy_coding</STRONG> func- - tion allows the caller to change the output of <STRONG>unctrl</STRONG>. - -- Likewise, the <STRONG>meta</STRONG> function allows the caller to change -- the output of <STRONG>keyname</STRONG>, i.e., it determines whether to use -- the `M-' prefix for ``meta'' keys (codes in the range 128 -- to 255). Both <STRONG>use_legacy_coding</STRONG> and <STRONG>meta</STRONG> succeed only af- -- ter curses is initialized. X/Open Curses does not docu- -- ment the treatment of codes 128 to 159. When treating -- them as ``meta'' keys (or if <STRONG>keyname</STRONG> is called before ini- -- tializing curses), this implementation returns strings -- ``M-^@'', ``M-^A'', etc. -- -- The <STRONG>keyname</STRONG> function may return the names of user-defined -- string capabilities which are defined in the terminfo en- -- try via the <STRONG>-x</STRONG> option of <STRONG>tic</STRONG>. This implementation auto- -- matically assigns at run-time keycodes to user-defined -- strings which begin with "k". The keycodes start at -- KEY_MAX, but are not guaranteed to be the same value for -- different runs because user-defined codes are merged from -- all terminal descriptions which have been loaded. The -- <STRONG>use_extended_names</STRONG> function controls whether this data is -- loaded when the terminal description is read by the li- -+ Likewise, the <STRONG>meta</STRONG> function allows the caller to change -+ the output of <STRONG>keyname</STRONG>, i.e., it determines whether to use -+ the `M-' prefix for "meta" keys (codes in the range 128 to -+ 255). Both <STRONG>use_legacy_coding</STRONG> and <STRONG>meta</STRONG> succeed only after -+ curses is initialized. X/Open Curses does not document -+ the treatment of codes 128 to 159. When treating them as -+ "meta" keys (or if <STRONG>keyname</STRONG> is called before initializing -+ curses), this implementation returns strings "M-^@", -+ "M-^A", etc. -+ -+ The <STRONG>keyname</STRONG> function may return the names of user-defined -+ string capabilities which are defined in the terminfo en- -+ try via the <STRONG>-x</STRONG> option of <STRONG>tic</STRONG>. This implementation auto- -+ matically assigns at run-time keycodes to user-defined -+ strings which begin with "k". The keycodes start at -+ KEY_MAX, but are not guaranteed to be the same value for -+ different runs because user-defined codes are merged from -+ all terminal descriptions which have been loaded. The -+ <STRONG>use_extended_names</STRONG> function controls whether this data is -+ loaded when the terminal description is read by the li- - brary. - -- The <STRONG>nofilter</STRONG> routine is specific to ncurses. It was not -- supported on Version 7, BSD or System V implementations. -- It is recommended that any code depending on ncurses ex- -- tensions be conditioned using NCURSES_VERSION. -+ The <STRONG>nofilter</STRONG> and <STRONG>use_tioctl</STRONG> routines are specific to -+ ncurses. They were not supported on Version 7, BSD or -+ System V implementations. It is recommended that any code -+ depending on ncurses extensions be conditioned using -+ NCURSES_VERSION. - - - </PRE> -diff -Naur ncurses-5.9/doc/html/man/curs_variables.3x.html ncurses-5.9.patch/doc/html/man/curs_variables.3x.html ---- ncurses-5.9/doc/html/man/curs_variables.3x.html 2011-01-09 02:03:16.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/curs_variables.3x.html 2014-09-01 16:33:22.325792071 +0200 -@@ -1,7 +1,7 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - **************************************************************************** -- * Copyright (c) 2010 Free Software Foundation, Inc. * -+ * Copyright (c) 2010,2013 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -27,7 +27,7 @@ - * sale, use or other dealings in this Software without prior written * - * authorization. * - **************************************************************************** -- * @Id: curs_variables.3x,v 1.4 2010/12/04 18:38:55 tom Exp @ -+ * @Id: curs_variables.3x,v 1.6 2013/12/21 18:41:32 tom Exp @ - --> - <HTML> - <HEAD> -@@ -73,10 +73,10 @@ - <STRONG><A HREF="ncurses.3x.html">es(3x)</A></STRONG> manual page. - - Depending on the configuration, these may be actual vari- -- ables, or macros (see <STRONG><A HREF="curs_threads.3x.html">curs_threads(3x)</A></STRONG>) which provide -- read-only access to <EM>curses</EM>'s state. In either case, ap- -- plications should treat them as read-only to avoid confus- -- ing the library. -+ ables, or macros (see <STRONG><A HREF="curs_threads.3x.html">curs_threads(3x)</A></STRONG> and -+ <STRONG><A HREF="curs_opaque.3x.html">curs_opaque(3x)</A></STRONG>) which provide read-only access to <EM>curs-</EM> -+ <EM>es</EM>'s state. In either case, applications should treat -+ them as read-only to avoid confusing the library. - - <STRONG>COLOR_PAIRS</STRONG> - After initializing curses, this variable contains the num- -@@ -133,7 +133,7 @@ - </PRE> - <H2>NOTES</H2><PRE> - The curses library is initialized using either -- <STRONG><A HREF="initscr.3x.html">initscr(3x)</A></STRONG>, or <STRONG><A HREF="newterm.3x.html">newterm(3x)</A></STRONG>. -+ <STRONG><A HREF="curs_initscr.3x.html">curs_initscr(3x)</A></STRONG>, or <STRONG><A HREF="curs_initscr.3x.html">curs_initscr(3x)</A></STRONG>. - - If <STRONG>curses</STRONG> is configured to use separate curses/terminfo - libraries, most of these variables reside in the curses -@@ -148,8 +148,8 @@ - - </PRE> - <H2>SEE ALSO</H2><PRE> -- <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>, <STRONG><A HREF="curs_threads.3x.html">curs_threads(3x)</A></STRONG>, <STRONG><A HREF="term_variables.3x.html">term_variables(3x)</A></STRONG>, <STRONG>termin-</STRONG> -- <STRONG><A HREF="terminfo.3x.html">fo(3x)</A></STRONG>, <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG>. -+ <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>, <STRONG><A HREF="curs_opaque.3x.html">curs_opaque(3x)</A></STRONG>, <STRONG><A HREF="curs_terminfo.3x.html">curs_terminfo(3x)</A></STRONG>, -+ <STRONG><A HREF="curs_threads.3x.html">curs_threads(3x)</A></STRONG>, <STRONG><A HREF="term_variables.3x.html">term_variables(3x)</A></STRONG>, <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG>. - - - -diff -Naur ncurses-5.9/doc/html/man/curs_window.3x.html ncurses-5.9.patch/doc/html/man/curs_window.3x.html ---- ncurses-5.9/doc/html/man/curs_window.3x.html 2011-01-09 02:03:17.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/curs_window.3x.html 2014-09-01 16:33:22.325792071 +0200 -@@ -1,4 +1,4 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - **************************************************************************** - * Copyright (c) 1998-2006,2010 Free Software Foundation, Inc. * -diff -Naur ncurses-5.9/doc/html/man/default_colors.3x.html ncurses-5.9.patch/doc/html/man/default_colors.3x.html ---- ncurses-5.9/doc/html/man/default_colors.3x.html 2011-01-09 02:03:17.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/default_colors.3x.html 2014-09-01 16:33:22.325792071 +0200 -@@ -1,4 +1,4 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - **************************************************************************** - * Copyright (c) 1998-2010,2011 Free Software Foundation, Inc. * -@@ -159,7 +159,7 @@ - - </PRE> - <H2>SEE ALSO</H2><PRE> -- <STRONG><A HREF="curs_color.3x.html">curs_color(3x)</A></STRONG>, <STRONG><A HREF="ded.1.html">ded(1)</A></STRONG>. -+ <STRONG><A HREF="curs_color.3x.html">curs_color(3x)</A></STRONG>, <STRONG>ded(1)</STRONG>. - - - </PRE> -diff -Naur ncurses-5.9/doc/html/man/define_key.3x.html ncurses-5.9.patch/doc/html/man/define_key.3x.html ---- ncurses-5.9/doc/html/man/define_key.3x.html 2011-01-09 02:03:17.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/define_key.3x.html 2014-09-01 16:33:22.325792071 +0200 -@@ -1,4 +1,4 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - **************************************************************************** - * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * -diff -Naur ncurses-5.9/doc/html/man/form.3x.html ncurses-5.9.patch/doc/html/man/form.3x.html ---- ncurses-5.9/doc/html/man/form.3x.html 2011-04-05 00:46:40.000000000 +0200 -+++ ncurses-5.9.patch/doc/html/man/form.3x.html 2014-09-01 16:33:22.325792071 +0200 -@@ -1,4 +1,4 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - * t - **************************************************************************** -@@ -243,7 +243,7 @@ - - </PRE> - <H2>SEE ALSO</H2><PRE> -- This describes <STRONG>ncurses</STRONG> version 5.9 (patch 20110404). -+ This describes <STRONG>ncurses</STRONG> version 5.9 (patch 20131221). - - - -diff -Naur ncurses-5.9/doc/html/man/form_cursor.3x.html ncurses-5.9.patch/doc/html/man/form_cursor.3x.html ---- ncurses-5.9/doc/html/man/form_cursor.3x.html 2011-01-09 02:03:17.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/form_cursor.3x.html 2014-09-01 16:33:22.325792071 +0200 -@@ -1,4 +1,4 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - * t - **************************************************************************** -diff -Naur ncurses-5.9/doc/html/man/form_data.3x.html ncurses-5.9.patch/doc/html/man/form_data.3x.html ---- ncurses-5.9/doc/html/man/form_data.3x.html 2011-01-09 02:03:18.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/form_data.3x.html 2014-09-01 16:33:22.326792073 +0200 -@@ -1,4 +1,4 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - * t - **************************************************************************** -diff -Naur ncurses-5.9/doc/html/man/form_driver.3x.html ncurses-5.9.patch/doc/html/man/form_driver.3x.html ---- ncurses-5.9/doc/html/man/form_driver.3x.html 2011-01-09 02:03:18.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/form_driver.3x.html 2014-09-01 16:33:22.326792073 +0200 -@@ -1,4 +1,4 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - **************************************************************************** - * Copyright (c) 1998-2008,2010 Free Software Foundation, Inc. * -@@ -342,7 +342,7 @@ - - </PRE> - <H2>SEE ALSO</H2><PRE> -- <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>, <STRONG><A HREF="form.3x.html">form(3x)</A></STRONG>, <STRONG><A HREF="form_variables.3x.html">form_variables(3x)</A></STRONG>, <STRONG><A HREF="getch.3x.html">getch(3x)</A></STRONG>. -+ <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>, <STRONG><A HREF="form.3x.html">form(3x)</A></STRONG>, <STRONG><A HREF="form_variables.3x.html">form_variables(3x)</A></STRONG>, <STRONG><A HREF="curs_getch.3x.html">curs_getch(3x)</A></STRONG>. - - - </PRE> -diff -Naur ncurses-5.9/doc/html/man/form_field.3x.html ncurses-5.9.patch/doc/html/man/form_field.3x.html ---- ncurses-5.9/doc/html/man/form_field.3x.html 2011-01-09 02:03:18.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/form_field.3x.html 2014-09-01 16:33:22.326792073 +0200 -@@ -1,8 +1,8 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - * t - **************************************************************************** -- * Copyright (c) 1998-2006,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -28,7 +28,7 @@ - * sale, use or other dealings in this Software without prior written * - * authorization. * - **************************************************************************** -- * @Id: form_field.3x,v 1.10 2010/12/04 18:40:45 tom Exp @ -+ * @Id: form_field.3x,v 1.11 2012/11/03 23:03:59 tom Exp @ - --> - <HTML> - <HEAD> -@@ -78,7 +78,7 @@ - - - </PRE> --<H2>RETURN VALUES</H2><PRE> -+<H2>RETURN VALUE</H2><PRE> - The function <STRONG>form_fields</STRONG> returns a pointer (which may be - <STRONG>NULL</STRONG>). It does not set errno. - -diff -Naur ncurses-5.9/doc/html/man/form_field_attributes.3x.html ncurses-5.9.patch/doc/html/man/form_field_attributes.3x.html ---- ncurses-5.9/doc/html/man/form_field_attributes.3x.html 2011-01-09 02:03:18.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/form_field_attributes.3x.html 2014-09-01 16:33:22.326792073 +0200 -@@ -1,4 +1,4 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - * t - **************************************************************************** -diff -Naur ncurses-5.9/doc/html/man/form_field_buffer.3x.html ncurses-5.9.patch/doc/html/man/form_field_buffer.3x.html ---- ncurses-5.9/doc/html/man/form_field_buffer.3x.html 2011-02-26 00:25:01.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/form_field_buffer.3x.html 2014-09-01 16:33:22.326792073 +0200 -@@ -1,4 +1,4 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - * t - **************************************************************************** -@@ -151,8 +151,8 @@ - When configured for wide characters, <STRONG>field_buffer</STRONG> returns - a pointer to temporary storage (allocated and freed by the - library). The application should not attempt to modify -- the data. It will be freed on the next call to -- <STRONG>field_buffer</STRONG> to return the same buffer. <STRONG>&lt;curses.h&gt;</STRONG>. -+ the data. It will be freed on the next call to <STRONG>field_buf-</STRONG> -+ <STRONG>fer</STRONG> to return the same buffer. <STRONG>&lt;curses.h&gt;</STRONG>. - - - </PRE> -diff -Naur ncurses-5.9/doc/html/man/form_field_info.3x.html ncurses-5.9.patch/doc/html/man/form_field_info.3x.html ---- ncurses-5.9/doc/html/man/form_field_info.3x.html 2011-01-09 02:03:19.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/form_field_info.3x.html 2014-09-01 16:33:22.326792073 +0200 -@@ -1,4 +1,4 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - * t - **************************************************************************** -diff -Naur ncurses-5.9/doc/html/man/form_field_just.3x.html ncurses-5.9.patch/doc/html/man/form_field_just.3x.html ---- ncurses-5.9/doc/html/man/form_field_just.3x.html 2011-01-09 02:03:19.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/form_field_just.3x.html 2014-09-01 16:33:22.326792073 +0200 -@@ -1,4 +1,4 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - * t - **************************************************************************** -diff -Naur ncurses-5.9/doc/html/man/form_field_new.3x.html ncurses-5.9.patch/doc/html/man/form_field_new.3x.html ---- ncurses-5.9/doc/html/man/form_field_new.3x.html 2011-01-09 02:03:19.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/form_field_new.3x.html 2014-09-01 16:33:22.326792073 +0200 -@@ -1,4 +1,4 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - * t - **************************************************************************** -diff -Naur ncurses-5.9/doc/html/man/form_field_opts.3x.html ncurses-5.9.patch/doc/html/man/form_field_opts.3x.html ---- ncurses-5.9/doc/html/man/form_field_opts.3x.html 2011-01-09 02:03:19.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/form_field_opts.3x.html 2014-09-01 16:33:22.327792074 +0200 -@@ -1,4 +1,4 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - * t - **************************************************************************** -diff -Naur ncurses-5.9/doc/html/man/form_fieldtype.3x.html ncurses-5.9.patch/doc/html/man/form_fieldtype.3x.html ---- ncurses-5.9/doc/html/man/form_fieldtype.3x.html 2011-02-26 00:25:02.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/form_fieldtype.3x.html 2014-09-01 16:33:22.327792074 +0200 -@@ -1,4 +1,4 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - * t - **************************************************************************** -@@ -112,8 +112,8 @@ - <STRONG>REQ_PREV_CHOICE</STRONG> assume that the possible values of a field - form an ordered set, and provide the forms user with a way - to move through the set. The <STRONG>set_fieldtype_choice</STRONG> func- -- tion allows forms programmers to define successor and -- predecessor functions for the field type. These functions -+ tion allows forms programmers to define successor and pre- -+ decessor functions for the field type. These functions - take the field pointer and an argument-block structure as - arguments. - -diff -Naur ncurses-5.9/doc/html/man/form_field_userptr.3x.html ncurses-5.9.patch/doc/html/man/form_field_userptr.3x.html ---- ncurses-5.9/doc/html/man/form_field_userptr.3x.html 2011-01-09 02:03:20.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/form_field_userptr.3x.html 2014-09-01 16:33:22.327792074 +0200 -@@ -1,4 +1,4 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - * t - **************************************************************************** -diff -Naur ncurses-5.9/doc/html/man/form_field_validation.3x.html ncurses-5.9.patch/doc/html/man/form_field_validation.3x.html ---- ncurses-5.9/doc/html/man/form_field_validation.3x.html 2011-01-09 02:03:20.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/form_field_validation.3x.html 2014-09-01 16:33:22.327792074 +0200 -@@ -1,4 +1,4 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - **************************************************************************** - * Copyright (c) 1998-2006,2010 Free Software Foundation, Inc. * -diff -Naur ncurses-5.9/doc/html/man/form_hook.3x.html ncurses-5.9.patch/doc/html/man/form_hook.3x.html ---- ncurses-5.9/doc/html/man/form_hook.3x.html 2011-01-09 02:03:20.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/form_hook.3x.html 2014-09-01 16:33:22.327792074 +0200 -@@ -1,4 +1,4 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - * t - **************************************************************************** -diff -Naur ncurses-5.9/doc/html/man/form_new.3x.html ncurses-5.9.patch/doc/html/man/form_new.3x.html ---- ncurses-5.9/doc/html/man/form_new.3x.html 2011-01-09 02:03:20.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/form_new.3x.html 2014-09-01 16:33:22.327792074 +0200 -@@ -1,4 +1,4 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - * t - **************************************************************************** -diff -Naur ncurses-5.9/doc/html/man/form_new_page.3x.html ncurses-5.9.patch/doc/html/man/form_new_page.3x.html ---- ncurses-5.9/doc/html/man/form_new_page.3x.html 2011-01-09 02:03:20.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/form_new_page.3x.html 2014-09-01 16:33:22.327792074 +0200 -@@ -1,4 +1,4 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - * t - **************************************************************************** -diff -Naur ncurses-5.9/doc/html/man/form_opts.3x.html ncurses-5.9.patch/doc/html/man/form_opts.3x.html ---- ncurses-5.9/doc/html/man/form_opts.3x.html 2011-01-09 02:03:21.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/form_opts.3x.html 2014-09-01 16:33:22.327792074 +0200 -@@ -1,4 +1,4 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - * t - **************************************************************************** -diff -Naur ncurses-5.9/doc/html/man/form_page.3x.html ncurses-5.9.patch/doc/html/man/form_page.3x.html ---- ncurses-5.9/doc/html/man/form_page.3x.html 2011-01-09 02:03:21.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/form_page.3x.html 2014-09-01 16:33:22.328792076 +0200 -@@ -1,4 +1,4 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - * t - **************************************************************************** -diff -Naur ncurses-5.9/doc/html/man/form_post.3x.html ncurses-5.9.patch/doc/html/man/form_post.3x.html ---- ncurses-5.9/doc/html/man/form_post.3x.html 2011-01-09 02:03:21.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/form_post.3x.html 2014-09-01 16:33:22.328792076 +0200 -@@ -1,4 +1,4 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - * t - **************************************************************************** -diff -Naur ncurses-5.9/doc/html/man/form_requestname.3x.html ncurses-5.9.patch/doc/html/man/form_requestname.3x.html ---- ncurses-5.9/doc/html/man/form_requestname.3x.html 2011-01-09 02:03:21.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/form_requestname.3x.html 2014-09-01 16:33:22.328792076 +0200 -@@ -1,4 +1,4 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - * t - **************************************************************************** -diff -Naur ncurses-5.9/doc/html/man/form_userptr.3x.html ncurses-5.9.patch/doc/html/man/form_userptr.3x.html ---- ncurses-5.9/doc/html/man/form_userptr.3x.html 2011-01-09 02:03:21.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/form_userptr.3x.html 2014-09-01 16:33:22.328792076 +0200 -@@ -1,4 +1,4 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - * t - **************************************************************************** -diff -Naur ncurses-5.9/doc/html/man/form_variables.3x.html ncurses-5.9.patch/doc/html/man/form_variables.3x.html ---- ncurses-5.9/doc/html/man/form_variables.3x.html 2011-01-09 02:03:21.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/form_variables.3x.html 2014-09-01 16:33:22.328792076 +0200 -@@ -1,7 +1,7 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - **************************************************************************** -- * Copyright (c) 2010 Free Software Foundation, Inc. * -+ * Copyright (c) 2010,2013 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -27,7 +27,7 @@ - * sale, use or other dealings in this Software without prior written * - * authorization. * - **************************************************************************** -- * @Id: form_variables.3x,v 1.3 2010/12/04 18:38:55 tom Exp @ -+ * @Id: form_variables.3x,v 1.4 2013/06/22 17:58:32 tom Exp @ - --> - <HTML> - <HEAD> -@@ -68,7 +68,7 @@ - </PRE> - <H2>DESCRIPTION</H2><PRE> - These are building blocks for the form library, defining -- fields that can be created using <STRONG><A HREF="set_fieldtype.3x.html">set_fieldtype(3x)</A></STRONG>. Each -+ fields that can be created using <STRONG><A HREF="form_fieldtype.3x.html">form_fieldtype(3x)</A></STRONG>. Each - provides functions for field- and character-validation, - according to the given datatype. - -diff -Naur ncurses-5.9/doc/html/man/form_win.3x.html ncurses-5.9.patch/doc/html/man/form_win.3x.html ---- ncurses-5.9/doc/html/man/form_win.3x.html 2011-01-09 02:03:22.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/form_win.3x.html 2014-09-01 16:33:22.328792076 +0200 -@@ -1,4 +1,4 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - * t - **************************************************************************** -diff -Naur ncurses-5.9/doc/html/man/index.html ncurses-5.9.patch/doc/html/man/index.html ---- ncurses-5.9/doc/html/man/index.html 2010-01-09 21:36:50.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/index.html 2014-09-01 16:33:22.328792076 +0200 -@@ -1,8 +1,7 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.0//EN"> - <!-- -- $Id: index.html,v 1.4 2010/01/09 20:36:50 tom Exp $ -+ $Id: index.html,v 1.7 2013/06/07 20:12:36 tom Exp $ - **************************************************************************** -- * Copyright (c) 1998-2006,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2010,2013 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -29,39 +28,83 @@ - * authorization. * - **************************************************************************** - --> --<HTML> --<HEAD> --<TITLE>NCURSES &ndash; Manual Pages</TITLE> --<LINK REV=MADE HREF="mailto:dickey@invisible-island.net"> --</HEAD> --<BODY> --<HR> --<ul> --<li>Programs: --<ul> --<li><a href = "captoinfo.1m.html">captoinfo &ndash; convert a termcap description into a terminfo description</a> --<li><a href = "clear.1.html">clear &ndash; clear the terminal screen</a> --<li><a href = "infocmp.1m.html">infocmp &ndash; compare or print out terminfo descriptions</a> --<li><a href = "infotocap.1m.html">infotocap &ndash; convert a terminfo description into a termcap description</a> --<li><a href = "tabs.1.html">tabs &ndash; set tabs on a terminal</a> --<li><a href = "tic.1m.html">tic &ndash; the terminfo entry-description compiler</a> --<li><a href = "toe.1m.html">toe &ndash; table of (terminfo) entries</a> --<li><a href = "tput.1.html">tput &ndash; initialize a terminal or query terminfo database</a> --<li><a href = "tset.1.html">tset &ndash; terminal initialization</a> --</ul> --<li>Libraries: --<ul> --<li><a href = "ncurses.3x.html">ncurses &ndash; CRT screen handling and optimization package</a> --<li><a href = "panel.3x.html">panel- panel stack extension for curses</a> --<li><a href = "form.3x.html">form &ndash; curses extension for programming forms</a> --<li><a href = "menu.3x.html">menu &ndash; curses extension for programming menus</a> --</ul> --<li>File formats: --<ul> --<li><a href = "terminfo.5.html">terminfo &ndash; terminal capability data base</a> --<li><a href = "term.5.html">term &ndash; format of compiled term file.</a> --<li><a href = "term.7.html">term &ndash; conventions for naming terminal types</a> --</ul> --</ul> --</BODY> --</HTML> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> -+ -+<html> -+<head> -+ <meta name="generator" content= -+ "HTML Tidy for Linux (vers 25 March 2009), see www.w3.org"> -+ -+ <title>NCURSES &ndash; Manual Pages</title> -+ <link rev="MADE" href="mailto:dickey@invisible-island.net"> -+ <meta http-equiv="Content-Type" content= -+ "text/html; charset=us-ascii"> -+</head> -+ -+<body> -+ <ul> -+ <li>Programs: -+ -+ <ul> -+ <li><a href="captoinfo.1m.html">captoinfo &ndash; convert a -+ termcap description into a terminfo description</a></li> -+ -+ <li><a href="clear.1.html">clear &ndash; clear the terminal -+ screen</a></li> -+ -+ <li><a href="infocmp.1m.html">infocmp &ndash; compare or -+ print out terminfo descriptions</a></li> -+ -+ <li><a href="infotocap.1m.html">infotocap &ndash; convert a -+ terminfo description into a termcap description</a></li> -+ -+ <li><a href="tabs.1.html">tabs &ndash; set tabs on a -+ terminal</a></li> -+ -+ <li><a href="tic.1m.html">tic &ndash; the terminfo -+ entry-description compiler</a></li> -+ -+ <li><a href="toe.1m.html">toe &ndash; table of (terminfo) -+ entries</a></li> -+ -+ <li><a href="tput.1.html">tput &ndash; initialize a -+ terminal or query terminfo database</a></li> -+ -+ <li><a href="tset.1.html">tset &ndash; terminal -+ initialization</a></li> -+ </ul> -+ </li> -+ -+ <li>Libraries: -+ -+ <ul> -+ <li><a href="ncurses.3x.html">ncurses &ndash; CRT screen -+ handling and optimization package</a></li> -+ -+ <li><a href="panel.3x.html">panel- panel stack extension -+ for curses</a></li> -+ -+ <li><a href="form.3x.html">form &ndash; curses extension -+ for programming forms</a></li> -+ -+ <li><a href="menu.3x.html">menu &ndash; curses extension -+ for programming menus</a></li> -+ </ul> -+ </li> -+ -+ <li>File formats: -+ -+ <ul> -+ <li><a href="terminfo.5.html">terminfo &ndash; terminal -+ capability data base</a></li> -+ -+ <li><a href="term.5.html">term &ndash; format of compiled -+ term file.</a></li> -+ -+ <li><a href="term.7.html">term &ndash; conventions for -+ naming terminal types</a></li> -+ </ul> -+ </li> -+ </ul> -+</body> -+</html> -diff -Naur ncurses-5.9/doc/html/man/infocmp.1m.html ncurses-5.9.patch/doc/html/man/infocmp.1m.html ---- ncurses-5.9/doc/html/man/infocmp.1m.html 2011-04-05 00:46:44.000000000 +0200 -+++ ncurses-5.9.patch/doc/html/man/infocmp.1m.html 2014-09-01 16:33:22.329792078 +0200 -@@ -1,8 +1,8 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - * t - **************************************************************************** -- * Copyright (c) 1998-2006,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -28,7 +28,7 @@ - * sale, use or other dealings in this Software without prior written * - * authorization. * - **************************************************************************** -- * @Id: infocmp.1m,v 1.46 2010/12/04 18:40:45 tom Exp @ -+ * @Id: infocmp.1m,v 1.53 2013/02/02 22:07:35 tom Exp @ - --> - <HTML> - <HEAD> -@@ -53,7 +53,7 @@ - - </PRE> - <H2>SYNOPSIS</H2><PRE> -- <STRONG>infocmp</STRONG> [<STRONG>-1CEFGILTUVcdegilnpqrtux</STRONG>] -+ <STRONG>infocmp</STRONG> [<STRONG>-1CDEFGIKLTUVcdegilnpqrtux</STRONG>] - [<STRONG>-v</STRONG> <EM>n</EM>] [<STRONG>-s</STRONG> <STRONG>d</STRONG>| <STRONG>i</STRONG>| <STRONG>l</STRONG>| <STRONG>c</STRONG>] [<STRONG>-R</STRONG> <STRONG>subset</STRONG>] - [<STRONG>-w</STRONG> <EM>width</EM>] [<STRONG>-A</STRONG> <EM>directory</EM>] [<STRONG>-B</STRONG> <EM>directory</EM>] - [<EM>termname</EM>...] -@@ -72,76 +72,91 @@ - <STRONG>Default</STRONG> <STRONG>Options</STRONG> - If no options are specified and zero or one <EM>termnames</EM> are - specified, the <STRONG>-I</STRONG> option will be assumed. If more than -- one <EM>termname</EM> is specified, the <STRONG>-d</STRONG> option will be assumed. -+ one <EM>termname</EM> is specified, the <STRONG>-d</STRONG> option will be assumed. - - <STRONG>Comparison</STRONG> <STRONG>Options</STRONG> <STRONG>[-d]</STRONG> <STRONG>[-c]</STRONG> <STRONG>[-n]</STRONG> -- <STRONG>infocmp</STRONG> compares the <STRONG>terminfo</STRONG> description of the first -- terminal <EM>termname</EM> with each of the descriptions given by -- the entries for the other terminal's <EM>termnames</EM>. If a -- capability is defined for only one of the terminals, the -- value returned will depend on the type of the capability: -- <STRONG>F</STRONG> for boolean variables, <STRONG>-1</STRONG> for integer variables, and -+ <STRONG>infocmp</STRONG> compares the <STRONG>terminfo</STRONG> description of the first -+ terminal <EM>termname</EM> with each of the descriptions given by -+ the entries for the other terminal's <EM>termnames</EM>. If a -+ capability is defined for only one of the terminals, the -+ value returned will depend on the type of the capability: -+ <STRONG>F</STRONG> for boolean variables, <STRONG>-1</STRONG> for integer variables, and - <STRONG>NULL</STRONG> for string variables. - -- The <STRONG>-d</STRONG> option produces a list of each capability that is -- different between two entries. This option is useful to -- show the difference between two entries, created by dif- -+ The <STRONG>-d</STRONG> option produces a list of each capability that is -+ different between two entries. This option is useful to -+ show the difference between two entries, created by dif- - ferent people, for the same or similar terminals. - -- The <STRONG>-c</STRONG> option produces a list of each capability that is -- common between two entries. Capabilities that are not set -- are ignored. This option can be used as a quick check to -- see if the <STRONG>-u</STRONG> option is worth using. -- -- The <STRONG>-n</STRONG> option produces a list of each capability that is -- in neither entry. If no <EM>termnames</EM> are given, the environ- -- ment variable <STRONG>TERM</STRONG> will be used for both of the <EM>termnames</EM>. -- This can be used as a quick check to see if anything was -- left out of a description. -+ The <STRONG>-c</STRONG> option produces a list of each capability that is -+ common between two or more entries. Capabilities that are -+ not set are ignored. This option can be used as a quick -+ check to see if the <STRONG>-u</STRONG> option is worth using. -+ -+ The <STRONG>-n</STRONG> option produces a list of each capability that is -+ in none of the given entries. If no <EM>termnames</EM> are given, -+ the environment variable <STRONG>TERM</STRONG> will be used for both of the -+ <EM>termnames</EM>. This can be used as a quick check to see if -+ anything was left out of a description. - - <STRONG>Source</STRONG> <STRONG>Listing</STRONG> <STRONG>Options</STRONG> <STRONG>[-I]</STRONG> <STRONG>[-L]</STRONG> <STRONG>[-C]</STRONG> <STRONG>[-r]</STRONG> -- The <STRONG>-I</STRONG>, <STRONG>-L</STRONG>, and <STRONG>-C</STRONG> options will produce a source listing -+ The <STRONG>-I</STRONG>, <STRONG>-L</STRONG>, and <STRONG>-C</STRONG> options will produce a source listing - for each terminal named. - - <STRONG>-I</STRONG> use the <STRONG>terminfo</STRONG> names - <STRONG>-L</STRONG> use the long C variable name listed in &lt;<STRONG>term.h</STRONG>&gt; - <STRONG>-C</STRONG> use the <STRONG>termcap</STRONG> names - <STRONG>-r</STRONG> when using <STRONG>-C</STRONG>, put out all capabilities in <STRONG>termcap</STRONG> form -+ <STRONG>-K</STRONG> modifies the <STRONG>-C</STRONG> option, improving BSD-compatibility. - -- If no <EM>termnames</EM> are given, the environment variable <STRONG>TERM</STRONG> -+ If no <EM>termnames</EM> are given, the environment variable <STRONG>TERM</STRONG> - will be used for the terminal name. - -- The source produced by the <STRONG>-C</STRONG> option may be used directly -- as a <STRONG>termcap</STRONG> entry, but not all parameterized strings can -+ The source produced by the <STRONG>-C</STRONG> option may be used directly -+ as a <STRONG>termcap</STRONG> entry, but not all parameterized strings can - be changed to the <STRONG>termcap</STRONG> format. <STRONG>infocmp</STRONG> will attempt to -- convert most of the parameterized information, and any- -- thing not converted will be plainly marked in the output -+ convert most of the parameterized information, and any- -+ thing not converted will be plainly marked in the output - and commented out. These should be edited by hand. - -- All padding information for strings will be collected -- together and placed at the beginning of the string where -- <STRONG>termcap</STRONG> expects it. Mandatory padding (padding informa- -+ For best results when converting to <STRONG>termcap</STRONG> format, you -+ should use both <STRONG>-C</STRONG> and <STRONG>-r</STRONG>. Normally a termcap description -+ is limited to 1023 bytes. infocmp trims away less essen- -+ tial parts to make it fit. If you are converting to one -+ of the (rare) termcap implementations which accept an -+ unlimited size of termcap, you may want to add the <STRONG>-T</STRONG> -+ option. More often however, you must help the termcap -+ implementation, and trim excess whitespace (use the <STRONG>-0</STRONG> -+ option for that). -+ -+ All padding information for strings will be collected -+ together and placed at the beginning of the string where -+ <STRONG>termcap</STRONG> expects it. Mandatory padding (padding informa- - tion with a trailing '/') will become optional. - - All <STRONG>termcap</STRONG> variables no longer supported by <STRONG>terminfo</STRONG>, but - which are derivable from other <STRONG>terminfo</STRONG> variables, will be - output. Not all <STRONG>terminfo</STRONG> capabilities will be translated; -- only those variables which were part of <STRONG>termcap</STRONG> will nor- -- mally be output. Specifying the <STRONG>-r</STRONG> option will take off -- this restriction, allowing all capabilities to be output -- in <EM>termcap</EM> form. -+ only those variables which were part of <STRONG>termcap</STRONG> will nor- -+ mally be output. Specifying the <STRONG>-r</STRONG> option will take off -+ this restriction, allowing all capabilities to be output -+ in <EM>termcap</EM> form. Normally you would use both the <STRONG>-C</STRONG> and -+ <STRONG>-r</STRONG> options. The actual format used incorporates some -+ improvements for escaped characters from terminfo format. -+ For a stricter BSD-compatible translation, use the <STRONG>-K</STRONG> -+ option rather than <STRONG>-C</STRONG>. - - Note that because padding is collected to the beginning of -- the capability, not all capabilities are output. Manda- -- tory padding is not supported. Because <STRONG>termcap</STRONG> strings -- are not as flexible, it is not always possible to convert -- a <STRONG>terminfo</STRONG> string capability into an equivalent <STRONG>termcap</STRONG> -- format. A subsequent conversion of the <STRONG>termcap</STRONG> file back -- into <STRONG>terminfo</STRONG> format will not necessarily reproduce the -+ the capability, not all capabilities are output. Manda- -+ tory padding is not supported. Because <STRONG>termcap</STRONG> strings -+ are not as flexible, it is not always possible to convert -+ a <STRONG>terminfo</STRONG> string capability into an equivalent <STRONG>termcap</STRONG> -+ format. A subsequent conversion of the <STRONG>termcap</STRONG> file back -+ into <STRONG>terminfo</STRONG> format will not necessarily reproduce the - original <STRONG>terminfo</STRONG> source. - -- Some common <STRONG>terminfo</STRONG> parameter sequences, their <STRONG>termcap</STRONG> -- equivalents, and some terminal types which commonly have -+ Some common <STRONG>terminfo</STRONG> parameter sequences, their <STRONG>termcap</STRONG> -+ equivalents, and some terminal types which commonly have - such sequences, are: - - <STRONG>terminfo</STRONG> <STRONG>termcap</STRONG> Representative Terminals -@@ -154,66 +169,77 @@ - <STRONG>%p2</STRONG> is printed before <STRONG>%p1</STRONG> <STRONG>%r</STRONG> hp - - <STRONG>Use=</STRONG> <STRONG>Option</STRONG> <STRONG>[-u]</STRONG> -- The <STRONG>-u</STRONG> option produces a <STRONG>terminfo</STRONG> source description of -- the first terminal <EM>termname</EM> which is relative to the sum -- of the descriptions given by the entries for the other -- terminals <EM>termnames</EM>. It does this by analyzing the dif- -- ferences between the first <EM>termname</EM> and the other -+ The <STRONG>-u</STRONG> option produces a <STRONG>terminfo</STRONG> source description of -+ the first terminal <EM>termname</EM> which is relative to the sum -+ of the descriptions given by the entries for the other -+ terminals <EM>termnames</EM>. It does this by analyzing the dif- -+ ferences between the first <EM>termname</EM> and the other - <EM>termnames</EM> and producing a description with <STRONG>use=</STRONG> fields for -- the other terminals. In this manner, it is possible to -- retrofit generic terminfo entries into a terminal's -+ the other terminals. In this manner, it is possible to -+ retrofit generic terminfo entries into a terminal's - description. Or, if two similar terminals exist, but were -- coded at different times or by different people so that -+ coded at different times or by different people so that - each description is a full description, using <STRONG>infocmp</STRONG> will - show what can be done to change one description to be rel- - ative to the other. - - A capability will get printed with an at-sign (@) if it no -- longer exists in the first <EM>termname</EM>, but one of the other -- <EM>termname</EM> entries contains a value for it. A capability's -- value gets printed if the value in the first <EM>termname</EM> is -- not found in any of the other <EM>termname</EM> entries, or if the -+ longer exists in the first <EM>termname</EM>, but one of the other -+ <EM>termname</EM> entries contains a value for it. A capability's -+ value gets printed if the value in the first <EM>termname</EM> is -+ not found in any of the other <EM>termname</EM> entries, or if the - first of the other <EM>termname</EM> entries that has this capabil- -- ity gives a different value for the capability than that -+ ity gives a different value for the capability than that - in the first <EM>termname</EM>. - -- The order of the other <EM>termname</EM> entries is significant. -- Since the terminfo compiler <STRONG>tic</STRONG> does a left-to-right scan -+ The order of the other <EM>termname</EM> entries is significant. -+ Since the terminfo compiler <STRONG>tic</STRONG> does a left-to-right scan - of the capabilities, specifying two <STRONG>use=</STRONG> entries that con- - tain differing entries for the same capabilities will pro- -- duce different results depending on the order that the -- entries are given in. <STRONG>infocmp</STRONG> will flag any such incon- -- sistencies between the other <EM>termname</EM> entries as they are -+ duce different results depending on the order that the -+ entries are given in. <STRONG>infocmp</STRONG> will flag any such incon- -+ sistencies between the other <EM>termname</EM> entries as they are - found. - -- Alternatively, specifying a capability <EM>after</EM> a <STRONG>use=</STRONG> entry -+ Alternatively, specifying a capability <EM>after</EM> a <STRONG>use=</STRONG> entry - that contains that capability will cause the second speci- -- fication to be ignored. Using <STRONG>infocmp</STRONG> to recreate a -+ fication to be ignored. Using <STRONG>infocmp</STRONG> to recreate a - description can be a useful check to make sure that every- -- thing was specified correctly in the original source -+ thing was specified correctly in the original source - description. - -- Another error that does not cause incorrect compiled -- files, but will slow down the compilation time, is speci- -- fying extra <STRONG>use=</STRONG> fields that are superfluous. <STRONG>infocmp</STRONG> -- will flag any other <EM>termname</EM> <EM>use=</EM> fields that were not -+ Another error that does not cause incorrect compiled -+ files, but will slow down the compilation time, is speci- -+ fying extra <STRONG>use=</STRONG> fields that are superfluous. <STRONG>infocmp</STRONG> -+ will flag any other <EM>termname</EM> <EM>use=</EM> fields that were not - needed. - - <STRONG>Changing</STRONG> <STRONG>Databases</STRONG> <STRONG>[-A</STRONG> <EM>directory</EM>] [-B <EM>directory</EM>] -- The location of the compiled <STRONG>terminfo</STRONG> database is taken -- from the environment variable <STRONG>TERMINFO</STRONG> . If the variable -- is not defined, or the terminal is not found in that loca- -- tion, the system <STRONG>terminfo</STRONG> database, in <STRONG>/usr/share/ter-</STRONG> -- <STRONG>minfo</STRONG>, will be used. The options <STRONG>-A</STRONG> and <STRONG>-B</STRONG> may be used to -- override this location. The <STRONG>-A</STRONG> option will set <STRONG>TERMINFO</STRONG> -- for the first <EM>termname</EM> and the <STRONG>-B</STRONG> option will set <STRONG>TERMINFO</STRONG> -- for the other <EM>termnames</EM>. With this, it is possible to -- compare descriptions for a terminal with the same name -- located in two different databases. This is useful for -- comparing descriptions for the same terminal created by -- different people. -+ Like other <STRONG>ncurses</STRONG> utilities, infocmp looks for the termi- -+ nal descriptions in several places. You can use the <STRONG>TER-</STRONG> -+ <STRONG>MINFO</STRONG> and <STRONG>TERMINFO_DIRS</STRONG> environment variables to override -+ the compiled-in default list of places to search (see -+ <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG> for details). -+ -+ You can also use the options <STRONG>-A</STRONG> and <STRONG>-B</STRONG> to override the -+ list of places to search when comparing terminal descrip- -+ tions: -+ -+ <STRONG>o</STRONG> The <STRONG>-A</STRONG> option sets the location for the first <EM>termname</EM> -+ -+ <STRONG>o</STRONG> The <STRONG>-B</STRONG> option sets the location for the other -+ <EM>termnames</EM>. -+ -+ Using these options, it is possible to compare descrip- -+ tions for a terminal with the same name located in two -+ different databases. For instance, you can use this fea- -+ ture for comparing descriptions for the same terminal cre- -+ ated by different people. - - <STRONG>Other</STRONG> <STRONG>Options</STRONG> -+ <STRONG>-0</STRONG> causes the fields to be printed on one line, without -+ wrapping. -+ - <STRONG>-1</STRONG> causes the fields to be printed out one to a line. - Otherwise, the fields will be printed several to a - line to a maximum width of 60 characters. -@@ -222,67 +248,71 @@ - rather than discarding them. Capabilities are com- - mented by prefixing them with a period. - -+ <STRONG>-D</STRONG> tells <STRONG>infocmp</STRONG> to print the database locations that it -+ knows about, and exit. -+ - <STRONG>-E</STRONG> Dump the capabilities of the given terminal as -- tables, needed in the C initializer for a TERMTYPE -- structure (the terminal capability structure in the -- <STRONG>&lt;term.h&gt;</STRONG>). This option is useful for preparing ver- -- sions of the curses library hardwired for a given -- terminal type. The tables are all declared static, -- and are named according to the type and the name of -+ tables, needed in the C initializer for a TERMTYPE -+ structure (the terminal capability structure in the -+ <STRONG>&lt;term.h&gt;</STRONG>). This option is useful for preparing ver- -+ sions of the curses library hardwired for a given -+ terminal type. The tables are all declared static, -+ and are named according to the type and the name of - the corresponding terminal entry. - -- Before ncurses 5.0, the split between the <STRONG>-e</STRONG> and <STRONG>-E</STRONG> -- options was not needed; but support for extended -+ Before ncurses 5.0, the split between the <STRONG>-e</STRONG> and <STRONG>-E</STRONG> -+ options was not needed; but support for extended - names required making the arrays of terminal capabil- - ities separate from the TERMTYPE structure. - -- <STRONG>-e</STRONG> Dump the capabilities of the given terminal as a C -- initializer for a TERMTYPE structure (the terminal -- capability structure in the <STRONG>&lt;term.h&gt;</STRONG>). This option -+ <STRONG>-e</STRONG> Dump the capabilities of the given terminal as a C -+ initializer for a TERMTYPE structure (the terminal -+ capability structure in the <STRONG>&lt;term.h&gt;</STRONG>). This option - is useful for preparing versions of the curses - library hardwired for a given terminal type. - -- <STRONG>-F</STRONG> compare terminfo files. This assumes that two fol- -- lowing arguments are filenames. The files are -- searched for pairwise matches between entries, with -+ <STRONG>-F</STRONG> compare terminfo files. This assumes that two fol- -+ lowing arguments are filenames. The files are -+ searched for pairwise matches between entries, with - two entries considered to match if any of their names -- do. The report printed to standard output lists -- entries with no matches in the other file, and -- entries with more than one match. For entries with -- exactly one match it includes a difference report. -- Normally, to reduce the volume of the report, use -- references are not resolved before looking for dif- -+ do. The report printed to standard output lists -+ entries with no matches in the other file, and -+ entries with more than one match. For entries with -+ exactly one match it includes a difference report. -+ Normally, to reduce the volume of the report, use -+ references are not resolved before looking for dif- - ferences, but resolution can be forced by also speci- - fying <STRONG>-r</STRONG>. - -- <STRONG>-f</STRONG> Display complex terminfo strings which contain -+ <STRONG>-f</STRONG> Display complex terminfo strings which contain - if/then/else/endif expressions indented for readabil- - ity. - - <STRONG>-G</STRONG> Display constant literals in decimal form rather than - their character equivalents. - -- <STRONG>-g</STRONG> Display constant character literals in quoted form -+ <STRONG>-g</STRONG> Display constant character literals in quoted form - rather than their decimal equivalents. - - <STRONG>-i</STRONG> Analyze the initialization (<STRONG>is1</STRONG>, <STRONG>is2</STRONG>, <STRONG>is3</STRONG>), and reset -- (<STRONG>rs1</STRONG>, <STRONG>rs2</STRONG>, <STRONG>rs3</STRONG>), strings in the entry. For each -- string, the code tries to analyze it into actions in -+ (<STRONG>rs1</STRONG>, <STRONG>rs2</STRONG>, <STRONG>rs3</STRONG>), strings in the entry. For each -+ string, the code tries to analyze it into actions in - terms of the other capabilities in the entry, certain -- X3.64/ISO 6429/ECMA-48 capabilities, and certain DEC -- VT-series private modes (the set of recognized spe- -- cial sequences has been selected for completeness -- over the existing terminfo database). Each report -- line consists of the capability name, followed by a -+ X3.64/ISO 6429/ECMA-48 capabilities, and certain DEC -+ VT-series private modes (the set of recognized spe- -+ cial sequences has been selected for completeness -+ over the existing terminfo database). Each report -+ line consists of the capability name, followed by a - colon and space, followed by a printable expansion of -- the capability string with sections matching recog- -- nized actions translated into {}-bracketed descrip- -- tions. Here is a list of the DEC/ANSI special -+ the capability string with sections matching recog- -+ nized actions translated into {}-bracketed descrip- -+ tions. Here is a list of the DEC/ANSI special - sequences recognized: i. - - Action Meaning - ----------------------------------------- - RIS full reset -+ - SC save cursor - RC restore cursor - LL home-down -@@ -310,17 +340,16 @@ - DEC[+-]CKM application cursor keys - DEC[+-]ANM set VT52 mode - DEC[+-]COLM 132-column mode -- - DEC[+-]SCLM smooth scroll - DEC[+-]SCNM reverse video mode - DEC[+-]OM origin mode - DEC[+-]AWM wraparound mode - DEC[+-]ARM auto-repeat mode - -- It also recognizes a SGR action corresponding to -- ANSI/ISO 6429/ECMA Set Graphics Rendition, with the -- values NORMAL, BOLD, UNDERLINE, BLINK, and REVERSE. -- All but NORMAL may be prefixed with `+' (turn on) or -+ It also recognizes a SGR action corresponding to -+ ANSI/ISO 6429/ECMA Set Graphics Rendition, with the -+ values NORMAL, BOLD, UNDERLINE, BLINK, and REVERSE. -+ All but NORMAL may be prefixed with `+' (turn on) or - `-' (turn off). - - An SGR0 designates an empty highlight sequence (equivalent -@@ -398,18 +427,19 @@ - - </PRE> - <H2>FILES</H2><PRE> -- /usr/share/terminfo Compiled terminal description -- database. -+ /usr/share/terminfo Compiled terminal description data- -+ base. - - - </PRE> - <H2>EXTENSIONS</H2><PRE> -- The <STRONG>-E</STRONG>, <STRONG>-F</STRONG>, <STRONG>-G</STRONG>, <STRONG>-R</STRONG>, <STRONG>-T</STRONG>, <STRONG>-V</STRONG>, <STRONG>-a</STRONG>, <STRONG>-e</STRONG>, <STRONG>-f</STRONG>, <STRONG>-g</STRONG>, <STRONG>-i</STRONG>, <STRONG>-l</STRONG>, <STRONG>-p</STRONG>, <STRONG>-q</STRONG> -- and <STRONG>-t</STRONG> options are not supported in SVr4 curses. -+ The <STRONG>-0</STRONG>, <STRONG>-1</STRONG>, <STRONG>-E</STRONG>, <STRONG>-F</STRONG>, <STRONG>-G</STRONG>, <STRONG>-R</STRONG>, <STRONG>-T</STRONG>, <STRONG>-V</STRONG>, <STRONG>-a</STRONG>, <STRONG>-e</STRONG>, <STRONG>-f</STRONG>, <STRONG>-g</STRONG>, <STRONG>-i</STRONG>, -+ <STRONG>-l</STRONG>, <STRONG>-p</STRONG>, <STRONG>-q</STRONG> and <STRONG>-t</STRONG> options are not supported in SVr4 -+ curses. - - The <STRONG>-r</STRONG> option's notion of `termcap' capabilities is System -- V Release 4's. Actual BSD curses versions will have a -- more restricted set. To see only the 4.4BSD set, use <STRONG>-r</STRONG> -+ V Release 4's. Actual BSD curses versions will have a -+ more restricted set. To see only the 4.4BSD set, use <STRONG>-r</STRONG> - <STRONG>-RBSD</STRONG>. - - -@@ -420,10 +450,12 @@ - - </PRE> - <H2>SEE ALSO</H2><PRE> -- <STRONG><A HREF="captoinfo.1m.html">captoinfo(1m)</A></STRONG>, <STRONG><A HREF="infotocap.1m.html">infotocap(1m)</A></STRONG>, <STRONG><A HREF="tic.1m.html">tic(1m)</A></STRONG>, <STRONG><A HREF="toe.1m.html">toe(1m)</A></STRONG>, -+ <STRONG><A HREF="captoinfo.1m.html">captoinfo(1m)</A></STRONG>, <STRONG><A HREF="infotocap.1m.html">infotocap(1m)</A></STRONG>, <STRONG><A HREF="tic.1m.html">tic(1m)</A></STRONG>, <STRONG><A HREF="toe.1m.html">toe(1m)</A></STRONG>, - <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>, <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG>. - -- This describes <STRONG>ncurses</STRONG> version 5.9 (patch 20110404). -+ http://invisible-island.net/ncurses/tctest.html -+ -+ This describes <STRONG>ncurses</STRONG> version 5.9 (patch 20131221). - - - </PRE> -diff -Naur ncurses-5.9/doc/html/man/infotocap.1m.html ncurses-5.9.patch/doc/html/man/infotocap.1m.html ---- ncurses-5.9/doc/html/man/infotocap.1m.html 2011-04-05 00:46:44.000000000 +0200 -+++ ncurses-5.9.patch/doc/html/man/infotocap.1m.html 2014-09-01 16:33:22.329792078 +0200 -@@ -1,4 +1,4 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - * t - **************************************************************************** -@@ -80,8 +80,8 @@ - - </PRE> - <H2>FILES</H2><PRE> -- /usr/share/terminfo Compiled terminal description -- database. -+ /usr/share/terminfo Compiled terminal description data- -+ base. - - - </PRE> -@@ -94,7 +94,7 @@ - <H2>SEE ALSO</H2><PRE> - <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>, <STRONG><A HREF="tic.1m.html">tic(1m)</A></STRONG>, <STRONG><A HREF="infocmp.1m.html">infocmp(1m)</A></STRONG>, <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG> - -- This describes <STRONG>ncurses</STRONG> version 5.9 (patch 20110404). -+ This describes <STRONG>ncurses</STRONG> version 5.9 (patch 20131221). - - - </PRE> -diff -Naur ncurses-5.9/doc/html/man/keybound.3x.html ncurses-5.9.patch/doc/html/man/keybound.3x.html ---- ncurses-5.9/doc/html/man/keybound.3x.html 2011-01-09 02:03:23.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/keybound.3x.html 2014-09-01 16:33:22.329792078 +0200 -@@ -1,4 +1,4 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - **************************************************************************** - * Copyright (c) 1999-2008,2010 Free Software Foundation, Inc. * -diff -Naur ncurses-5.9/doc/html/man/key_defined.3x.html ncurses-5.9.patch/doc/html/man/key_defined.3x.html ---- ncurses-5.9/doc/html/man/key_defined.3x.html 2011-01-09 02:03:23.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/key_defined.3x.html 2014-09-01 16:33:22.329792078 +0200 -@@ -1,4 +1,4 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - **************************************************************************** - * Copyright (c) 2003-2006,2010 Free Software Foundation, Inc. * -diff -Naur ncurses-5.9/doc/html/man/keyok.3x.html ncurses-5.9.patch/doc/html/man/keyok.3x.html ---- ncurses-5.9/doc/html/man/keyok.3x.html 2011-01-09 02:03:23.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/keyok.3x.html 2014-09-01 16:33:22.329792078 +0200 -@@ -1,4 +1,4 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - **************************************************************************** - * Copyright (c) 1998-2006,2010 Free Software Foundation, Inc. * -diff -Naur ncurses-5.9/doc/html/man/legacy_coding.3x.html ncurses-5.9.patch/doc/html/man/legacy_coding.3x.html ---- ncurses-5.9/doc/html/man/legacy_coding.3x.html 2011-01-09 02:03:23.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/legacy_coding.3x.html 2014-09-01 16:33:22.329792078 +0200 -@@ -1,4 +1,4 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - **************************************************************************** - * Copyright (c) 2005-2006,2010 Free Software Foundation, Inc. * -diff -Naur ncurses-5.9/doc/html/man/menu.3x.html ncurses-5.9.patch/doc/html/man/menu.3x.html ---- ncurses-5.9/doc/html/man/menu.3x.html 2011-04-05 00:46:45.000000000 +0200 -+++ ncurses-5.9.patch/doc/html/man/menu.3x.html 2014-09-01 16:33:22.329792078 +0200 -@@ -1,4 +1,4 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - * t - **************************************************************************** -@@ -226,7 +226,7 @@ - - </PRE> - <H2>SEE ALSO</H2><PRE> -- This describes <STRONG>ncurses</STRONG> version 5.9 (patch 20110404). -+ This describes <STRONG>ncurses</STRONG> version 5.9 (patch 20131221). - - - -diff -Naur ncurses-5.9/doc/html/man/menu_attributes.3x.html ncurses-5.9.patch/doc/html/man/menu_attributes.3x.html ---- ncurses-5.9/doc/html/man/menu_attributes.3x.html 2011-01-09 02:03:24.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/menu_attributes.3x.html 2014-09-01 16:33:22.329792078 +0200 -@@ -1,4 +1,4 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - * t - **************************************************************************** -diff -Naur ncurses-5.9/doc/html/man/menu_cursor.3x.html ncurses-5.9.patch/doc/html/man/menu_cursor.3x.html ---- ncurses-5.9/doc/html/man/menu_cursor.3x.html 2011-01-09 02:03:24.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/menu_cursor.3x.html 2014-09-01 16:33:22.330792079 +0200 -@@ -1,4 +1,4 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - * t - **************************************************************************** -diff -Naur ncurses-5.9/doc/html/man/menu_driver.3x.html ncurses-5.9.patch/doc/html/man/menu_driver.3x.html ---- ncurses-5.9/doc/html/man/menu_driver.3x.html 2011-02-26 00:25:05.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/menu_driver.3x.html 2014-09-01 16:33:22.330792079 +0200 -@@ -1,4 +1,4 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - **************************************************************************** - * Copyright (c) 1998-2008,2010 Free Software Foundation, Inc. * -@@ -119,8 +119,8 @@ - Clear the menu pattern buffer. - - REQ_BACK_PATTERN -- Delete the previous character from the pattern -- buffer. -+ Delete the previous character from the pattern buf- -+ fer. - - REQ_NEXT_MATCH - Move to the next item matching the pattern match. -@@ -128,20 +128,20 @@ - REQ_PREV_MATCH - Move to the previous item matching the pattern match. - -- If the second argument is a printable character, the code -- appends it to the pattern buffer and attempts to move to -- the next item matching the new pattern. If there is no -+ If the second argument is a printable character, the code -+ appends it to the pattern buffer and attempts to move to -+ the next item matching the new pattern. If there is no - such match, <STRONG>menu_driver</STRONG> returns <STRONG>E_NO_MATCH</STRONG> and deletes the - appended character from the buffer. - -- If the second argument is one of the above pre-defined -+ If the second argument is one of the above pre-defined - requests, the corresponding action is performed. - - <STRONG>MOUSE</STRONG> <STRONG>HANDLING</STRONG> -- If the second argument is the KEY_MOUSE special key, the -+ If the second argument is the KEY_MOUSE special key, the - associated mouse event is translated into one of the above -- pre-defined requests. Currently only clicks in the user -- window (e.g., inside the menu display area or the decora- -+ pre-defined requests. Currently only clicks in the user -+ window (e.g., inside the menu display area or the decora- - tion window) are handled. - - If you click above the display region of the menu: -@@ -160,32 +160,32 @@ - - <STRONG>o</STRONG> a REQ_LAST_ITEM is generated for a triple-click. - -- If you click at an item inside the display area of the -+ If you click at an item inside the display area of the - menu: - - <STRONG>o</STRONG> the menu cursor is positioned to that item. - -- <STRONG>o</STRONG> If you double-click an item a REQ_TOGGLE_ITEM is gen- -+ <STRONG>o</STRONG> If you double-click an item a REQ_TOGGLE_ITEM is gen- - erated and <STRONG>E_UNKNOWN_COMMAND</STRONG> is returned. This return -- value makes sense, because a double click usually -+ value makes sense, because a double click usually - means that an item-specific action should be returned. - It is exactly the purpose of this return value to sig- -- nal that an application specific command should be -+ nal that an application specific command should be - executed. - -- <STRONG>o</STRONG> If a translation into a request was done, <STRONG>menu_driver</STRONG> -+ <STRONG>o</STRONG> If a translation into a request was done, <STRONG>menu_driver</STRONG> - returns the result of this request. - -- If you clicked outside the user window or the mouse event -- could not be translated into a menu request an -+ If you clicked outside the user window or the mouse event -+ could not be translated into a menu request an - <STRONG>E_REQUEST_DENIED</STRONG> is returned. - - <STRONG>APPLICATION-DEFINED</STRONG> <STRONG>COMMANDS</STRONG> - If the second argument is neither printable nor one of the -- above pre-defined menu requests or KEY_MOUSE, the drive -- assumes it is an application-specific command and returns -+ above pre-defined menu requests or KEY_MOUSE, the drive -+ assumes it is an application-specific command and returns - <STRONG>E_UNKNOWN_COMMAND</STRONG>. Application-defined commands should be -- defined relative to <STRONG>MAX_COMMAND</STRONG>, the maximum value of -+ defined relative to <STRONG>MAX_COMMAND</STRONG>, the maximum value of - these pre-defined requests. - - -@@ -199,7 +199,7 @@ - System error occurred (see <STRONG>errno</STRONG>). - - <STRONG>E_BAD_ARGUMENT</STRONG> -- Routine detected an incorrect or out-of-range argu- -+ Routine detected an incorrect or out-of-range argu- - ment. - - <STRONG>E_BAD_STATE</STRONG> -@@ -221,7 +221,7 @@ - - </PRE> - <H2>SEE ALSO</H2><PRE> -- <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>, <STRONG><A HREF="menu.3x.html">menu(3x)</A></STRONG>, <STRONG><A HREF="getch.3x.html">getch(3x)</A></STRONG>. -+ <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>, <STRONG><A HREF="menu.3x.html">menu(3x)</A></STRONG>, <STRONG><A HREF="curs_getch.3x.html">curs_getch(3x)</A></STRONG>. - - - </PRE> -@@ -232,14 +232,14 @@ - - </PRE> - <H2>PORTABILITY</H2><PRE> -- These routines emulate the System V menu library. They -- were not supported on Version 7 or BSD versions. The sup- -+ These routines emulate the System V menu library. They -+ were not supported on Version 7 or BSD versions. The sup- - port for mouse events is ncurses specific. - - - </PRE> - <H2>AUTHORS</H2><PRE> -- Juergen Pfeifer. Manual pages and adaptation for new -+ Juergen Pfeifer. Manual pages and adaptation for new - curses by Eric S. Raymond. - - -diff -Naur ncurses-5.9/doc/html/man/menu_format.3x.html ncurses-5.9.patch/doc/html/man/menu_format.3x.html ---- ncurses-5.9/doc/html/man/menu_format.3x.html 2011-01-09 02:03:24.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/menu_format.3x.html 2014-09-01 16:33:22.330792079 +0200 -@@ -1,4 +1,4 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - * t - **************************************************************************** -diff -Naur ncurses-5.9/doc/html/man/menu_hook.3x.html ncurses-5.9.patch/doc/html/man/menu_hook.3x.html ---- ncurses-5.9/doc/html/man/menu_hook.3x.html 2011-01-09 02:03:24.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/menu_hook.3x.html 2014-09-01 16:33:22.330792079 +0200 -@@ -1,4 +1,4 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - * t - **************************************************************************** -diff -Naur ncurses-5.9/doc/html/man/menu_items.3x.html ncurses-5.9.patch/doc/html/man/menu_items.3x.html ---- ncurses-5.9/doc/html/man/menu_items.3x.html 2011-01-09 02:03:24.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/menu_items.3x.html 2014-09-01 16:33:22.330792079 +0200 -@@ -1,8 +1,8 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - * t - **************************************************************************** -- * Copyright (c) 1998-2006,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -28,7 +28,7 @@ - * sale, use or other dealings in this Software without prior written * - * authorization. * - **************************************************************************** -- * @Id: menu_items.3x,v 1.9 2010/12/04 18:40:45 tom Exp @ -+ * @Id: menu_items.3x,v 1.10 2012/11/03 23:03:59 tom Exp @ - --> - <HTML> - <HEAD> -@@ -74,7 +74,7 @@ - - - </PRE> --<H2>RETURN VALUES</H2><PRE> -+<H2>RETURN VALUE</H2><PRE> - The function <STRONG>menu_items</STRONG> returns a pointer (which may be - <STRONG>NULL</STRONG>). It does not set errno. - -diff -Naur ncurses-5.9/doc/html/man/menu_mark.3x.html ncurses-5.9.patch/doc/html/man/menu_mark.3x.html ---- ncurses-5.9/doc/html/man/menu_mark.3x.html 2011-01-09 02:03:24.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/menu_mark.3x.html 2014-09-01 16:33:22.330792079 +0200 -@@ -1,4 +1,4 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - * t - **************************************************************************** -diff -Naur ncurses-5.9/doc/html/man/menu_new.3x.html ncurses-5.9.patch/doc/html/man/menu_new.3x.html ---- ncurses-5.9/doc/html/man/menu_new.3x.html 2011-01-09 02:03:25.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/menu_new.3x.html 2014-09-01 16:33:22.330792079 +0200 -@@ -1,4 +1,4 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - * t - **************************************************************************** -diff -Naur ncurses-5.9/doc/html/man/menu_opts.3x.html ncurses-5.9.patch/doc/html/man/menu_opts.3x.html ---- ncurses-5.9/doc/html/man/menu_opts.3x.html 2011-01-09 02:03:25.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/menu_opts.3x.html 2014-09-01 16:33:22.330792079 +0200 -@@ -1,4 +1,4 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - * t - **************************************************************************** -diff -Naur ncurses-5.9/doc/html/man/menu_pattern.3x.html ncurses-5.9.patch/doc/html/man/menu_pattern.3x.html ---- ncurses-5.9/doc/html/man/menu_pattern.3x.html 2011-01-09 02:03:25.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/menu_pattern.3x.html 2014-09-01 16:33:22.331792081 +0200 -@@ -1,4 +1,4 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - **************************************************************************** - * Copyright (c) 1998-2008,2010 Free Software Foundation, Inc. * -diff -Naur ncurses-5.9/doc/html/man/menu_post.3x.html ncurses-5.9.patch/doc/html/man/menu_post.3x.html ---- ncurses-5.9/doc/html/man/menu_post.3x.html 2011-01-09 02:03:25.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/menu_post.3x.html 2014-09-01 16:33:22.331792081 +0200 -@@ -1,4 +1,4 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - * t - **************************************************************************** -diff -Naur ncurses-5.9/doc/html/man/menu_requestname.3x.html ncurses-5.9.patch/doc/html/man/menu_requestname.3x.html ---- ncurses-5.9/doc/html/man/menu_requestname.3x.html 2011-01-09 02:03:25.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/menu_requestname.3x.html 2014-09-01 16:33:22.331792081 +0200 -@@ -1,4 +1,4 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - * t - **************************************************************************** -diff -Naur ncurses-5.9/doc/html/man/menu_spacing.3x.html ncurses-5.9.patch/doc/html/man/menu_spacing.3x.html ---- ncurses-5.9/doc/html/man/menu_spacing.3x.html 2011-01-09 02:03:26.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/menu_spacing.3x.html 2014-09-01 16:33:22.331792081 +0200 -@@ -1,4 +1,4 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - * t - **************************************************************************** -diff -Naur ncurses-5.9/doc/html/man/menu_userptr.3x.html ncurses-5.9.patch/doc/html/man/menu_userptr.3x.html ---- ncurses-5.9/doc/html/man/menu_userptr.3x.html 2011-01-09 02:03:26.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/menu_userptr.3x.html 2014-09-01 16:33:22.331792081 +0200 -@@ -1,4 +1,4 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - * t - **************************************************************************** -diff -Naur ncurses-5.9/doc/html/man/menu_win.3x.html ncurses-5.9.patch/doc/html/man/menu_win.3x.html ---- ncurses-5.9/doc/html/man/menu_win.3x.html 2011-01-09 02:03:26.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/menu_win.3x.html 2014-09-01 16:33:22.331792081 +0200 -@@ -1,4 +1,4 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - * t - **************************************************************************** -diff -Naur ncurses-5.9/doc/html/man/mitem_current.3x.html ncurses-5.9.patch/doc/html/man/mitem_current.3x.html ---- ncurses-5.9/doc/html/man/mitem_current.3x.html 2011-01-09 02:03:26.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/mitem_current.3x.html 2014-09-01 16:33:22.331792081 +0200 -@@ -1,4 +1,4 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - * t - **************************************************************************** -diff -Naur ncurses-5.9/doc/html/man/mitem_name.3x.html ncurses-5.9.patch/doc/html/man/mitem_name.3x.html ---- ncurses-5.9/doc/html/man/mitem_name.3x.html 2011-01-09 02:03:26.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/mitem_name.3x.html 2014-09-01 16:33:22.331792081 +0200 -@@ -1,4 +1,4 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - * t - **************************************************************************** -diff -Naur ncurses-5.9/doc/html/man/mitem_new.3x.html ncurses-5.9.patch/doc/html/man/mitem_new.3x.html ---- ncurses-5.9/doc/html/man/mitem_new.3x.html 2011-01-09 02:03:27.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/mitem_new.3x.html 2014-09-01 16:33:22.331792081 +0200 -@@ -1,4 +1,4 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - * t - **************************************************************************** -diff -Naur ncurses-5.9/doc/html/man/mitem_opts.3x.html ncurses-5.9.patch/doc/html/man/mitem_opts.3x.html ---- ncurses-5.9/doc/html/man/mitem_opts.3x.html 2011-01-09 02:03:27.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/mitem_opts.3x.html 2014-09-01 16:33:22.331792081 +0200 -@@ -1,4 +1,4 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - * t - **************************************************************************** -diff -Naur ncurses-5.9/doc/html/man/mitem_userptr.3x.html ncurses-5.9.patch/doc/html/man/mitem_userptr.3x.html ---- ncurses-5.9/doc/html/man/mitem_userptr.3x.html 2011-01-09 02:03:27.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/mitem_userptr.3x.html 2014-09-01 16:33:22.332792083 +0200 -@@ -1,4 +1,4 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - * t - **************************************************************************** -diff -Naur ncurses-5.9/doc/html/man/mitem_value.3x.html ncurses-5.9.patch/doc/html/man/mitem_value.3x.html ---- ncurses-5.9/doc/html/man/mitem_value.3x.html 2011-01-09 02:03:27.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/mitem_value.3x.html 2014-09-01 16:33:22.332792083 +0200 -@@ -1,4 +1,4 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - **************************************************************************** - * Copyright (c) 1998-2006,2010 Free Software Foundation, Inc. * -diff -Naur ncurses-5.9/doc/html/man/mitem_visible.3x.html ncurses-5.9.patch/doc/html/man/mitem_visible.3x.html ---- ncurses-5.9/doc/html/man/mitem_visible.3x.html 2011-01-09 02:03:27.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/mitem_visible.3x.html 2014-09-01 16:33:22.332792083 +0200 -@@ -1,4 +1,4 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - * t - **************************************************************************** -diff -Naur ncurses-5.9/doc/html/man/ncurses.3x.html ncurses-5.9.patch/doc/html/man/ncurses.3x.html ---- ncurses-5.9/doc/html/man/ncurses.3x.html 2011-04-05 00:46:49.000000000 +0200 -+++ ncurses-5.9.patch/doc/html/man/ncurses.3x.html 2014-09-01 16:33:22.333792084 +0200 -@@ -1,8 +1,8 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - * t - **************************************************************************** -- * Copyright (c) 1998-2010,2011 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -28,7 +28,7 @@ - * sale, use or other dealings in this Software without prior written * - * authorization. * - **************************************************************************** -- * @Id: ncurses.3x,v 1.103 2011/02/05 23:21:29 tom Exp @ -+ * @Id: ncurses.3x,v 1.112 2013/07/20 19:29:59 tom Exp @ - --> - <HTML> - <HEAD> -@@ -60,10 +60,10 @@ - <H2>DESCRIPTION</H2><PRE> - The <STRONG>ncurses</STRONG> library routines give the user a terminal- - independent method of updating character screens with rea- -- sonable optimization. This implementation is ``new -- curses'' (ncurses) and is the approved replacement for -- 4.4BSD classic curses, which has been discontinued. This -- describes <STRONG>ncurses</STRONG> version 5.9 (patch 20110404). -+ sonable optimization. This implementation is "new curses" -+ (ncurses) and is the approved replacement for 4.4BSD clas- -+ sic curses, which has been discontinued. This describes -+ <STRONG>ncurses</STRONG> version 5.9 (patch 20131221). - - The <STRONG>ncurses</STRONG> library emulates the curses library of System - V Release 4 UNIX, and XPG4 (X/Open Portability Guide) -@@ -150,48 +150,48 @@ - Among those, the most basic routines are <STRONG>move</STRONG> and <STRONG>addch</STRONG>. - More general versions of these routines are included with - names beginning with <STRONG>w</STRONG>, allowing the user to specify a -- window. The routines not beginning with <STRONG>w</STRONG> affect <STRONG>stdscr</STRONG>. -+ window. The routines not beginning with <STRONG>w</STRONG> affect <STRONG>stdscr</STRONG>. - -- After using routines to manipulate a window, <STRONG>refresh</STRONG> is -- called, telling <STRONG>curses</STRONG> to make the user's CRT screen look -- like <STRONG>stdscr</STRONG>. The characters in a window are actually of -- type <STRONG>chtype</STRONG>, (character and attribute data) so that other -- information about the character may also be stored with -+ After using routines to manipulate a window, <STRONG>refresh</STRONG> is -+ called, telling <STRONG>curses</STRONG> to make the user's CRT screen look -+ like <STRONG>stdscr</STRONG>. The characters in a window are actually of -+ type <STRONG>chtype</STRONG>, (character and attribute data) so that other -+ information about the character may also be stored with - each character. - -- Special windows called <EM>pads</EM> may also be manipulated. -+ Special windows called <EM>pads</EM> may also be manipulated. - These are windows which are not constrained to the size of -- the screen and whose contents need not be completely dis- -+ the screen and whose contents need not be completely dis- - played. See <STRONG><A HREF="curs_pad.3x.html">curs_pad(3x)</A></STRONG> for more information. - -- In addition to drawing characters on the screen, video -- attributes and colors may be supported, causing the char- -- acters to show up in such modes as underlined, in reverse -- video, or in color on terminals that support such display -+ In addition to drawing characters on the screen, video -+ attributes and colors may be supported, causing the char- -+ acters to show up in such modes as underlined, in reverse -+ video, or in color on terminals that support such display - enhancements. Line drawing characters may be specified to -- be output. On input, <STRONG>curses</STRONG> is also able to translate -- arrow and function keys that transmit escape sequences -- into single values. The video attributes, line drawing -- characters, and input values use names, defined in -+ be output. On input, <STRONG>curses</STRONG> is also able to translate -+ arrow and function keys that transmit escape sequences -+ into single values. The video attributes, line drawing -+ characters, and input values use names, defined in - <STRONG>&lt;curses.h&gt;</STRONG>, such as <STRONG>A_REVERSE</STRONG>, <STRONG>ACS_HLINE</STRONG>, and <STRONG>KEY_LEFT</STRONG>. - - If the environment variables <STRONG>LINES</STRONG> and <STRONG>COLUMNS</STRONG> are set, or -- if the program is executing in a window environment, line -- and column information in the environment will override -+ if the program is executing in a window environment, line -+ and column information in the environment will override - information read by <EM>terminfo</EM>. This would affect a program -- running in an AT&amp;T 630 layer, for example, where the size -+ running in an AT&amp;T 630 layer, for example, where the size - of a screen is changeable (see <STRONG>ENVIRONMENT</STRONG>). - -- If the environment variable <STRONG>TERMINFO</STRONG> is defined, any pro- -- gram using <STRONG>curses</STRONG> checks for a local terminal definition -- before checking in the standard place. For example, if -+ If the environment variable <STRONG>TERMINFO</STRONG> is defined, any pro- -+ gram using <STRONG>curses</STRONG> checks for a local terminal definition -+ before checking in the standard place. For example, if - <STRONG>TERM</STRONG> is set to <STRONG>att4424</STRONG>, then the compiled terminal defini- - tion is found in - - <STRONG>/usr/share/terminfo/a/att4424</STRONG>. - - (The <STRONG>a</STRONG> is copied from the first letter of <STRONG>att4424</STRONG> to avoid -- creation of huge directories.) However, if <STRONG>TERMINFO</STRONG> is -+ creation of huge directories.) However, if <STRONG>TERMINFO</STRONG> is - set to <STRONG>$HOME/myterms</STRONG>, <STRONG>curses</STRONG> first checks - - <STRONG>$HOME/myterms/a/att4424</STRONG>, -@@ -200,119 +200,117 @@ - - <STRONG>/usr/share/terminfo/a/att4424</STRONG>. - -- This is useful for developing experimental definitions or -+ This is useful for developing experimental definitions or - when write permission in <STRONG>/usr/share/terminfo</STRONG> is not avail- - able. - -- The integer variables <STRONG>LINES</STRONG> and <STRONG>COLS</STRONG> are defined in -- <STRONG>&lt;curses.h&gt;</STRONG> and will be filled in by <STRONG>initscr</STRONG> with the size -+ The integer variables <STRONG>LINES</STRONG> and <STRONG>COLS</STRONG> are defined in -+ <STRONG>&lt;curses.h&gt;</STRONG> and will be filled in by <STRONG>initscr</STRONG> with the size - of the screen. The constants <STRONG>TRUE</STRONG> and <STRONG>FALSE</STRONG> have the val- - ues <STRONG>1</STRONG> and <STRONG>0</STRONG>, respectively. - -- The <STRONG>curses</STRONG> routines also define the <STRONG>WINDOW</STRONG> <STRONG>*</STRONG> variable -+ The <STRONG>curses</STRONG> routines also define the <STRONG>WINDOW</STRONG> <STRONG>*</STRONG> variable - <STRONG>curscr</STRONG> which is used for certain low-level operations like -- clearing and redrawing a screen containing garbage. The -+ clearing and redrawing a screen containing garbage. The - <STRONG>curscr</STRONG> can be used in only a few routines. - - <STRONG>Routine</STRONG> <STRONG>and</STRONG> <STRONG>Argument</STRONG> <STRONG>Names</STRONG> -- Many <STRONG>curses</STRONG> routines have two or more versions. The rou- -+ Many <STRONG>curses</STRONG> routines have two or more versions. The rou- - tines prefixed with <STRONG>w</STRONG> require a window argument. The rou- - tines prefixed with <STRONG>p</STRONG> require a pad argument. Those with- - out a prefix generally use <STRONG>stdscr</STRONG>. - - The routines prefixed with <STRONG>mv</STRONG> require a <EM>y</EM> and <EM>x</EM> coordinate -- to move to before performing the appropriate action. The -- <STRONG>mv</STRONG> routines imply a call to <STRONG>move</STRONG> before the call to the -- other routine. The coordinate <EM>y</EM> always refers to the row -- (of the window), and <EM>x</EM> always refers to the column. The -+ to move to before performing the appropriate action. The -+ <STRONG>mv</STRONG> routines imply a call to <STRONG>move</STRONG> before the call to the -+ other routine. The coordinate <EM>y</EM> always refers to the row -+ (of the window), and <EM>x</EM> always refers to the column. The - upper left-hand corner is always (0,0), not (1,1). - - The routines prefixed with <STRONG>mvw</STRONG> take both a window argument -- and <EM>x</EM> and <EM>y</EM> coordinates. The window argument is always -+ and <EM>x</EM> and <EM>y</EM> coordinates. The window argument is always - specified before the coordinates. - -- In each case, <EM>win</EM> is the window affected, and <EM>pad</EM> is the -+ In each case, <EM>win</EM> is the window affected, and <EM>pad</EM> is the - pad affected; <EM>win</EM> and <EM>pad</EM> are always pointers to type <STRONG>WIN-</STRONG> - <STRONG>DOW</STRONG>. - - Option setting routines require a Boolean flag <EM>bf</EM> with the -- value <STRONG>TRUE</STRONG> or <STRONG>FALSE</STRONG>; <EM>bf</EM> is always of type <STRONG>bool</STRONG>. Most of -- the data types used in the library routines, such as <STRONG>WIN-</STRONG> -- <STRONG>DOW</STRONG>, <STRONG>SCREEN</STRONG>, <STRONG>bool</STRONG>, and <STRONG>chtype</STRONG> are defined in <STRONG>&lt;curses.h&gt;</STRONG>. -- Types used for the terminfo routines such as <STRONG>TERMINAL</STRONG> are -+ value <STRONG>TRUE</STRONG> or <STRONG>FALSE</STRONG>; <EM>bf</EM> is always of type <STRONG>bool</STRONG>. Most of -+ the data types used in the library routines, such as <STRONG>WIN-</STRONG> -+ <STRONG>DOW</STRONG>, <STRONG>SCREEN</STRONG>, <STRONG>bool</STRONG>, and <STRONG>chtype</STRONG> are defined in <STRONG>&lt;curses.h&gt;</STRONG>. -+ Types used for the terminfo routines such as <STRONG>TERMINAL</STRONG> are - defined in <STRONG>&lt;term.h&gt;</STRONG>. - -- This manual page describes functions which may appear in -- any configuration of the library. There are two common -+ This manual page describes functions which may appear in -+ any configuration of the library. There are two common - configurations of the library: - - ncurses - the "normal" library, which handles 8-bit - characters. The normal (8-bit) library stores -- characters combined with attributes in <STRONG>chtype</STRONG> -+ characters combined with attributes in <STRONG>chtype</STRONG> - data. - -- Attributes alone (no corresponding character) -- may be stored in <STRONG>chtype</STRONG> or the equivalent -- <STRONG>attr_t</STRONG> data. In either case, the data is -+ Attributes alone (no corresponding character) -+ may be stored in <STRONG>chtype</STRONG> or the equivalent -+ <STRONG>attr_t</STRONG> data. In either case, the data is - stored in something like an integer. - -- Each cell (row and column) in a <STRONG>WINDOW</STRONG> is -+ Each cell (row and column) in a <STRONG>WINDOW</STRONG> is - stored as a <STRONG>chtype</STRONG>. - - ncursesw -- the so-called "wide" library, which handles -- multibyte characters (see the section on -+ the so-called "wide" library, which handles -+ multibyte characters (see the section on - <STRONG>ALTERNATE</STRONG> <STRONG>CONFIGURATIONS</STRONG>). The "wide" library -- includes all of the calls from the "normal" -- library. It adds about one third more calls -+ includes all of the calls from the "normal" -+ library. It adds about one third more calls - using data types which store multibyte charac- - ters: - - <STRONG>cchar_t</STRONG> -- corresponds to <STRONG>chtype</STRONG>. However it is a -- structure, because more data is stored -- than can fit into an integer. The char- -+ corresponds to <STRONG>chtype</STRONG>. However it is a -+ structure, because more data is stored -+ than can fit into an integer. The char- - acters are large enough to require a full -- integer value - and there may be more -- than one character per cell. The video -- attributes and color are stored in sepa- -+ integer value - and there may be more -+ than one character per cell. The video -+ attributes and color are stored in sepa- - rate fields of the structure. - - Each cell (row and column) in a <STRONG>WINDOW</STRONG> is - stored as a <STRONG>cchar_t</STRONG>. - - <STRONG>wchar_t</STRONG> -- stores a "wide" character. Like <STRONG>chtype</STRONG>, -+ stores a "wide" character. Like <STRONG>chtype</STRONG>, - this may be an integer. - - <STRONG>wint_t</STRONG> -- stores a <STRONG>wchar_t</STRONG> or <STRONG>WEOF</STRONG> - not the same, -+ stores a <STRONG>wchar_t</STRONG> or <STRONG>WEOF</STRONG> - not the same, - though both may have the same size. - - The "wide" library provides new functions -- which are analogous to functions in the "nor- -- mal" library. There is a naming convention -- which relates many of the normal/wide vari- -- ants: a "_w" is inserted into the name. For -+ which are analogous to functions in the "nor- -+ mal" library. There is a naming convention -+ which relates many of the normal/wide vari- -+ ants: a "_w" is inserted into the name. For - example, <STRONG>waddch</STRONG> becomes <STRONG>wadd_wch</STRONG>. - -- - <STRONG>Routine</STRONG> <STRONG>Name</STRONG> <STRONG>Index</STRONG> - The following table lists each <STRONG>curses</STRONG> routine and the name -- of the manual page on which it is described. Routines -- flagged with `*' are ncurses-specific, not described by -+ of the manual page on which it is described. Routines -+ flagged with `*' are ncurses-specific, not described by - XPG4 or present in SVr4. - -- - <STRONG>curses</STRONG> Routine Name Manual Page Name - -------------------------------------------- - COLOR_PAIR <STRONG><A HREF="curs_color.3x.html">curs_color(3x)</A></STRONG> - PAIR_NUMBER <STRONG><A HREF="curs_attr.3x.html">curs_attr(3x)</A></STRONG> - _nc_free_and_exit <STRONG><A HREF="curs_memleaks.3x.html">curs_memleaks(3x)</A></STRONG>* -- - _nc_freeall <STRONG><A HREF="curs_memleaks.3x.html">curs_memleaks(3x)</A></STRONG>* - _nc_tracebits <STRONG><A HREF="curs_trace.3x.html">curs_trace(3x)</A></STRONG>* -+ - _traceattr <STRONG><A HREF="curs_trace.3x.html">curs_trace(3x)</A></STRONG>* - _traceattr2 <STRONG><A HREF="curs_trace.3x.html">curs_trace(3x)</A></STRONG>* - _tracechar <STRONG><A HREF="curs_trace.3x.html">curs_trace(3x)</A></STRONG>* -@@ -376,9 +374,9 @@ - echo <STRONG><A HREF="curs_inopts.3x.html">curs_inopts(3x)</A></STRONG> - echo_wchar <STRONG><A HREF="curs_add_wch.3x.html">curs_add_wch(3x)</A></STRONG> - echochar <STRONG><A HREF="curs_addch.3x.html">curs_addch(3x)</A></STRONG> -- - endwin <STRONG><A HREF="curs_initscr.3x.html">curs_initscr(3x)</A></STRONG> - erase <STRONG><A HREF="curs_clear.3x.html">curs_clear(3x)</A></STRONG> -+ - erasechar <STRONG><A HREF="curs_termattrs.3x.html">curs_termattrs(3x)</A></STRONG> - erasewchar <STRONG><A HREF="curs_termattrs.3x.html">curs_termattrs(3x)</A></STRONG> - filter <STRONG><A HREF="curs_util.3x.html">curs_util(3x)</A></STRONG> -@@ -442,9 +440,9 @@ - intrflush <STRONG><A HREF="curs_inopts.3x.html">curs_inopts(3x)</A></STRONG> - inwstr <STRONG><A HREF="curs_inwstr.3x.html">curs_inwstr(3x)</A></STRONG> - is_cleared <STRONG><A HREF="curs_opaque.3x.html">curs_opaque(3x)</A></STRONG>* -- - is_idcok <STRONG><A HREF="curs_opaque.3x.html">curs_opaque(3x)</A></STRONG>* - is_idlok <STRONG><A HREF="curs_opaque.3x.html">curs_opaque(3x)</A></STRONG>* -+ - is_immedok <STRONG><A HREF="curs_opaque.3x.html">curs_opaque(3x)</A></STRONG>* - is_keypad <STRONG><A HREF="curs_opaque.3x.html">curs_opaque(3x)</A></STRONG>* - is_leaveok <STRONG><A HREF="curs_opaque.3x.html">curs_opaque(3x)</A></STRONG>* -@@ -508,9 +506,9 @@ - mvinsch <STRONG><A HREF="curs_insch.3x.html">curs_insch(3x)</A></STRONG> - mvinsnstr <STRONG><A HREF="curs_insstr.3x.html">curs_insstr(3x)</A></STRONG> - mvinsstr <STRONG><A HREF="curs_insstr.3x.html">curs_insstr(3x)</A></STRONG> -- - mvinstr <STRONG><A HREF="curs_instr.3x.html">curs_instr(3x)</A></STRONG> - mvinwstr <STRONG><A HREF="curs_inwstr.3x.html">curs_inwstr(3x)</A></STRONG> -+ - mvprintw <STRONG><A HREF="curs_printw.3x.html">curs_printw(3x)</A></STRONG> - mvscanw <STRONG><A HREF="curs_scanw.3x.html">curs_scanw(3x)</A></STRONG> - mvvline <STRONG><A HREF="curs_border.3x.html">curs_border(3x)</A></STRONG> -@@ -574,9 +572,9 @@ - pair_content <STRONG><A HREF="curs_color.3x.html">curs_color(3x)</A></STRONG> - pechochar <STRONG><A HREF="curs_pad.3x.html">curs_pad(3x)</A></STRONG> - pnoutrefresh <STRONG><A HREF="curs_pad.3x.html">curs_pad(3x)</A></STRONG> -- - prefresh <STRONG><A HREF="curs_pad.3x.html">curs_pad(3x)</A></STRONG> - printw <STRONG><A HREF="curs_printw.3x.html">curs_printw(3x)</A></STRONG> -+ - putp <STRONG><A HREF="curs_terminfo.3x.html">curs_terminfo(3x)</A></STRONG> - putwin <STRONG><A HREF="curs_util.3x.html">curs_util(3x)</A></STRONG> - qiflush <STRONG><A HREF="curs_inopts.3x.html">curs_inopts(3x)</A></STRONG> -@@ -640,9 +638,9 @@ - tigetstr <STRONG><A HREF="curs_terminfo.3x.html">curs_terminfo(3x)</A></STRONG> - timeout <STRONG><A HREF="curs_inopts.3x.html">curs_inopts(3x)</A></STRONG> - touchline <STRONG><A HREF="curs_touch.3x.html">curs_touch(3x)</A></STRONG> -- - touchwin <STRONG><A HREF="curs_touch.3x.html">curs_touch(3x)</A></STRONG> - tparm <STRONG><A HREF="curs_terminfo.3x.html">curs_terminfo(3x)</A></STRONG> -+ - tputs <STRONG><A HREF="curs_termcap.3x.html">curs_termcap(3x)</A></STRONG> - tputs <STRONG><A HREF="curs_terminfo.3x.html">curs_terminfo(3x)</A></STRONG> - trace <STRONG><A HREF="curs_trace.3x.html">curs_trace(3x)</A></STRONG>* -@@ -656,6 +654,7 @@ - use_env <STRONG><A HREF="curs_util.3x.html">curs_util(3x)</A></STRONG> - use_extended_names <STRONG><A HREF="curs_extend.3x.html">curs_extend(3x)</A></STRONG>* - use_legacy_coding <STRONG><A HREF="legacy_coding.3x.html">legacy_coding(3x)</A></STRONG>* -+ use_tioctl <STRONG><A HREF="curs_util.3x.html">curs_util(3x)</A></STRONG> - vid_attr <STRONG><A HREF="curs_terminfo.3x.html">curs_terminfo(3x)</A></STRONG> - vid_puts <STRONG><A HREF="curs_terminfo.3x.html">curs_terminfo(3x)</A></STRONG> - vidattr <STRONG><A HREF="curs_terminfo.3x.html">curs_terminfo(3x)</A></STRONG> -@@ -706,8 +705,8 @@ - wgetbkgrnd <STRONG><A HREF="curs_bkgrnd.3x.html">curs_bkgrnd(3x)</A></STRONG> - wgetch <STRONG><A HREF="curs_getch.3x.html">curs_getch(3x)</A></STRONG> - wgetn_wstr <STRONG><A HREF="curs_get_wstr.3x.html">curs_get_wstr(3x)</A></STRONG> -- - wgetnstr <STRONG><A HREF="curs_getstr.3x.html">curs_getstr(3x)</A></STRONG> -+ - wgetstr <STRONG><A HREF="curs_getstr.3x.html">curs_getstr(3x)</A></STRONG> - whline <STRONG><A HREF="curs_border.3x.html">curs_border(3x)</A></STRONG> - whline_set <STRONG><A HREF="curs_border_set.3x.html">curs_border_set(3x)</A></STRONG> -@@ -752,11 +751,14 @@ - - </PRE> - <H2>RETURN VALUE</H2><PRE> -- Routines that return an integer return <STRONG>ERR</STRONG> upon failure -- and an integer value other than <STRONG>ERR</STRONG> upon successful com- -- pletion, unless otherwise noted in the routine descrip- -+ Routines that return an integer return <STRONG>ERR</STRONG> upon failure -+ and an integer value other than <STRONG>ERR</STRONG> upon successful com- -+ pletion, unless otherwise noted in the routine descrip- - tions. - -+ As a general rule, routines check for null pointers passed -+ as parameters, and handle this as an error. -+ - All macros return the value of the <STRONG>w</STRONG> version, except - <STRONG>setscrreg</STRONG>, <STRONG>wsetscrreg</STRONG>, <STRONG>getyx</STRONG>, <STRONG>getbegyx</STRONG>, and <STRONG>getmaxyx</STRONG>. The - return values of <STRONG>setscrreg</STRONG>, <STRONG>wsetscrreg</STRONG>, <STRONG>getyx</STRONG>, <STRONG>getbegyx</STRONG>, -@@ -773,52 +775,56 @@ - important ones have been already discussed in detail. - - BAUDRATE -- The debugging library checks this environment symbol -- when the application has redirected output to a file. -- The symbol's numeric value is used for the baudrate. -- If no value is found, <STRONG>ncurses</STRONG> uses 9600. This allows -- testers to construct repeatable test-cases that take -- into account costs that depend on baudrate. -+ The debugging library checks this environment vari- -+ able when the application has redirected output to a -+ file. The variable's numeric value is used for the -+ baudrate. If no value is found, <STRONG>ncurses</STRONG> uses 9600. -+ This allows testers to construct repeatable test- -+ cases that take into account costs that depend on -+ baudrate. - - CC When set, change occurrences of the command_character -- (i.e., the <STRONG>cmdch</STRONG> capability) of the loaded terminfo -- entries to the value of this symbol. Very few ter- -+ (i.e., the <STRONG>cmdch</STRONG> capability) of the loaded terminfo -+ entries to the value of this variable. Very few ter- - minfo entries provide this feature. - -- Because this name is also used in development envi- -- ronments to represent the C compiler's name, <STRONG>ncurses</STRONG> -+ Because this name is also used in development envi- -+ ronments to represent the C compiler's name, <STRONG>ncurses</STRONG> - ignores it if it does not happen to be a single char- - acter. - - COLUMNS - Specify the width of the screen in characters. -- Applications running in a windowing environment usu- -- ally are able to obtain the width of the window in -- which they are executing. If neither the <STRONG>COLUMNS</STRONG> -- value nor the terminal's screen size is available, -- <STRONG>ncurses</STRONG> uses the size which may be specified in the -+ Applications running in a windowing environment usu- -+ ally are able to obtain the width of the window in -+ which they are executing. If neither the <STRONG>COLUMNS</STRONG> -+ value nor the terminal's screen size is available, -+ <STRONG>ncurses</STRONG> uses the size which may be specified in the - terminfo database (i.e., the <STRONG>cols</STRONG> capability). - -- It is important that your application use a correct -- size for the screen. This is not always possible -- because your application may be running on a host -- which does not honor NAWS (Negotiations About Window -- Size), or because you are temporarily running as -- another user. However, setting <STRONG>COLUMNS</STRONG> and/or <STRONG>LINES</STRONG> -+ It is important that your application use a correct -+ size for the screen. This is not always possible -+ because your application may be running on a host -+ which does not honor NAWS (Negotiations About Window -+ Size), or because you are temporarily running as -+ another user. However, setting <STRONG>COLUMNS</STRONG> and/or <STRONG>LINES</STRONG> - overrides the library's use of the screen size - obtained from the operating system. - -- Either <STRONG>COLUMNS</STRONG> or <STRONG>LINES</STRONG> symbols may be specified -- independently. This is mainly useful to circumvent -- legacy misfeatures of terminal descriptions, e.g., -+ Either <STRONG>COLUMNS</STRONG> or <STRONG>LINES</STRONG> symbols may be specified -+ independently. This is mainly useful to circumvent -+ legacy misfeatures of terminal descriptions, e.g., - xterm which commonly specifies a 65 line screen. For -- best results, <STRONG>lines</STRONG> and <STRONG>cols</STRONG> should not be specified -+ best results, <STRONG>lines</STRONG> and <STRONG>cols</STRONG> should not be specified - in a terminal description for terminals which are run - as emulations. - - Use the <STRONG>use_env</STRONG> function to disable all use of exter- -- nal environment (including system calls) to determine -- the screen size. -+ nal environment (but not including system calls) to -+ determine the screen size. Use the <STRONG>use_tioctl</STRONG> func- -+ tion to update <STRONG>COLUMNS</STRONG> or <STRONG>LINES</STRONG> to match the screen -+ size obtained from system calls or the terminal data- -+ base. - - ESCDELAY - Specifies the total time, in milliseconds, for which -@@ -858,234 +864,278 @@ - - LINES - Like COLUMNS, specify the height of the screen in -- characters. See COLUMNS for a detailed description. -+ characters. See COLUMNS for a detailed description. - - MOUSE_BUTTONS_123 - This applies only to the OS/2 EMX port. It specifies -- the order of buttons on the mouse. OS/2 numbers a -+ the order of buttons on the mouse. OS/2 numbers a - 3-button mouse inconsistently from other platforms: - - 1 = left - 2 = right - 3 = middle. - -- This symbol lets you customize the mouse. The symbol -- must be three numeric digits 1-3 in any order, e.g., -- 123 or 321. If it is not specified, <STRONG>ncurses</STRONG> uses -- 132. -+ This variable lets you customize the mouse. The -+ variable must be three numeric digits 1-3 in any -+ order, e.g., 123 or 321. If it is not specified, -+ <STRONG>ncurses</STRONG> uses 132. - - NCURSES_ASSUMED_COLORS -- Override the compiled-in assumption that the termi- -- nal's default colors are white-on-black (see -- <STRONG><A HREF="default_colors.3x.html">default_colors(3x)</A></STRONG>). You may set the foreground and -- background color values with this environment vari- -- able by proving a 2-element list: foreground,back- -- ground. For example, to tell ncurses to not assume -- anything about the colors, set this to "-1,-1". To -- make it green-on-black, set it to "2,0". Any posi- -+ Override the compiled-in assumption that the termi- -+ nal's default colors are white-on-black (see -+ <STRONG><A HREF="default_colors.3x.html">default_colors(3x)</A></STRONG>). You may set the foreground and -+ background color values with this environment vari- -+ able by proving a 2-element list: foreground,back- -+ ground. For example, to tell ncurses to not assume -+ anything about the colors, set this to "-1,-1". To -+ make it green-on-black, set it to "2,0". Any posi- - tive value from zero to the terminfo <STRONG>max_colors</STRONG> value - is allowed. - - NCURSES_GPM_TERMS -- This applies only to ncurses configured to use the -+ This applies only to ncurses configured to use the - GPM interface. - - If present, the environment variable is a list of one -- or more terminal names against which the TERM envi- -- ronment variable is matched. Setting it to an empty -- value disables the GPM interface; using the built-in -+ or more terminal names against which the TERM envi- -+ ronment variable is matched. Setting it to an empty -+ value disables the GPM interface; using the built-in - support for xterm, etc. - -- If the environment variable is absent, ncurses will -+ If the environment variable is absent, ncurses will - attempt to open GPM if TERM contains "linux". - - NCURSES_NO_HARD_TABS -- <STRONG>Ncurses</STRONG> may use tabs as part of the cursor movement -- optimization. In some cases, your terminal driver -- may not handle these properly. Set this environment -+ <STRONG>Ncurses</STRONG> may use tabs as part of the cursor movement -+ optimization. In some cases, your terminal driver -+ may not handle these properly. Set this environment - variable to disable the feature. You can also adjust - your <STRONG>stty</STRONG> settings to avoid the problem. - - NCURSES_NO_MAGIC_COOKIES - Some terminals use a magic-cookie feature which -- requires special handling to make highlighting and -- other video attributes display properly. You can -- suppress the highlighting entirely for these termi- -+ requires special handling to make highlighting and -+ other video attributes display properly. You can -+ suppress the highlighting entirely for these termi- - nals by setting this environment variable. - - NCURSES_NO_PADDING -- Most of the terminal descriptions in the terminfo -- database are written for real "hardware" terminals. -- Many people use terminal emulators which run in a -- windowing environment and use curses-based applica- -- tions. Terminal emulators can duplicate all of the -+ Most of the terminal descriptions in the terminfo -+ database are written for real "hardware" terminals. -+ Many people use terminal emulators which run in a -+ windowing environment and use curses-based applica- -+ tions. Terminal emulators can duplicate all of the - important aspects of a hardware terminal, but they do -- not have the same limitations. The chief limitation -- of a hardware terminal from the standpoint of your -+ not have the same limitations. The chief limitation -+ of a hardware terminal from the standpoint of your - application is the management of dataflow, i.e., tim- - ing. Unless a hardware terminal is interfaced into a -- terminal concentrator (which does flow control), it -- (or your application) must manage dataflow, prevent- -- ing overruns. The cheapest solution (no hardware -+ terminal concentrator (which does flow control), it -+ (or your application) must manage dataflow, prevent- -+ ing overruns. The cheapest solution (no hardware - cost) is for your program to do this by pausing after -- operations that the terminal does slowly, such as -+ operations that the terminal does slowly, such as - clearing the display. - -- As a result, many terminal descriptions (including -- the vt100) have delay times embedded. You may wish -- to use these descriptions, but not want to pay the -+ As a result, many terminal descriptions (including -+ the vt100) have delay times embedded. You may wish -+ to use these descriptions, but not want to pay the - performance penalty. - -- Set the NCURSES_NO_PADDING symbol to disable all but -- mandatory padding. Mandatory padding is used as a -- part of special control sequences such as <EM>flash</EM>. -+ Set the NCURSES_NO_PADDING environment variable to -+ disable all but mandatory padding. Mandatory padding -+ is used as a part of special control sequences such -+ as <EM>flash</EM>. - - NCURSES_NO_SETBUF -- Normally <STRONG>ncurses</STRONG> enables buffered output during ter- -- minal initialization. This is done (as in SVr4 -- curses) for performance reasons. For testing pur- -- poses, both of <STRONG>ncurses</STRONG> and certain applications, this -- feature is made optional. Setting the -- NCURSES_NO_SETBUF variable disables output buffering, -- leaving the output in the original (usually line -- buffered) mode. -+ This setting is obsolete. Before changes -+ -+ <STRONG>o</STRONG> started with 5.9 patch 20120825 and -+ -+ <STRONG>o</STRONG> continued though 5.9 patch 20130126 -+ -+ <STRONG>ncurses</STRONG> enabled buffered output during terminal ini- -+ tialization. This was done (as in SVr4 curses) for -+ performance reasons. For testing purposes, both of -+ <STRONG>ncurses</STRONG> and certain applications, this feature was -+ made optional. Setting the NCURSES_NO_SETBUF vari- -+ able disabled output buffering, leaving the output in -+ the original (usually line buffered) mode. -+ -+ In the current implementation, ncurses performs its -+ own buffering and does not require this workaround. -+ It does not modify the buffering of the standard out- -+ put. -+ -+ The reason for the change was to make the behavior -+ for interrupts and other signals more robust. One -+ drawback is that certain nonconventional programs -+ would mix ordinary stdio calls with ncurses calls and -+ (usually) work. This is no longer possible since -+ ncurses is not using the buffered standard output but -+ its own output (to the same file descriptor). As a -+ special case, the low-level calls such as <STRONG>putp</STRONG> still -+ use the standard output. But high-level curses calls -+ do not. - - NCURSES_NO_UTF8_ACS - During initialization, the <STRONG>ncurses</STRONG> library checks for -- special cases where VT100 line-drawing (and the cor- -- responding alternate character set capabilities) -- described in the terminfo are known to be missing. -- Specifically, when running in a UTF-8 locale, the -- Linux console emulator and the GNU screen program -- ignore these. Ncurses checks the TERM environment -- variable for these. For other special cases, you -- should set this environment variable. Doing this -- tells ncurses to use Unicode values which correspond -+ special cases where VT100 line-drawing (and the cor- -+ responding alternate character set capabilities) -+ described in the terminfo are known to be missing. -+ Specifically, when running in a UTF-8 locale, the -+ Linux console emulator and the GNU screen program -+ ignore these. Ncurses checks the TERM environment -+ variable for these. For other special cases, you -+ should set this environment variable. Doing this -+ tells ncurses to use Unicode values which correspond - to the VT100 line-drawing glyphs. That works for the - special cases cited, and is likely to work for termi- - nal emulators. - -- When setting this variable, you should set it to a -- nonzero value. Setting it to zero (or to a nonnum- -- ber) disables the special check for "linux" and -+ When setting this variable, you should set it to a -+ nonzero value. Setting it to zero (or to a nonnum- -+ ber) disables the special check for "linux" and - "screen". - -- As an alternative to the environment variable, -- ncurses checks for an extended terminfo capability -- <STRONG>U8</STRONG>. This is a numeric capability which can be com- -+ As an alternative to the environment variable, -+ ncurses checks for an extended terminfo capability -+ <STRONG>U8</STRONG>. This is a numeric capability which can be com- - piled using <STRONG>tic</STRONG> <STRONG>-x</STRONG>. For example - - # linux console, if patched to provide working - # VT100 shift-in/shift-out, with corresponding font. - linux-vt100|linux console with VT100 line-graphics, -- U8#0, use=linux, -+ U8#0, use=linux, - - # uxterm with vt100Graphics resource set to false - xterm-utf8|xterm relying on UTF-8 line-graphics, -- U8#1, use=xterm, -+ U8#1, use=xterm, - - The name "U8" is chosen to be two characters, to per- -- mit it to be used by applications that use ncurses' -+ mit it to be used by applications that use ncurses' - termcap interface. - - NCURSES_TRACE -- During initialization, the <STRONG>ncurses</STRONG> debugging library -- checks the NCURSES_TRACE symbol. If it is defined, -- to a numeric value, <STRONG>ncurses</STRONG> calls the <STRONG>trace</STRONG> function, -- using that value as the argument. -- -- The argument values, which are defined in <STRONG>curses.h</STRONG>, -- provide several types of information. When running -- with traces enabled, your application will write the -+ During initialization, the <STRONG>ncurses</STRONG> debugging library -+ checks the NCURSES_TRACE environment variable. If it -+ is defined, to a numeric value, <STRONG>ncurses</STRONG> calls the -+ <STRONG>trace</STRONG> function, using that value as the argument. -+ -+ The argument values, which are defined in <STRONG>curses.h</STRONG>, -+ provide several types of information. When running -+ with traces enabled, your application will write the - file <STRONG>trace</STRONG> to the current directory. - -- TERM Denotes your terminal type. Each terminal type is -+ TERM Denotes your terminal type. Each terminal type is - distinct, though many are similar. - - TERMCAP - If the <STRONG>ncurses</STRONG> library has been configured with <EM>term-</EM> -- <EM>cap</EM> support, <STRONG>ncurses</STRONG> will check for a terminal's -+ <EM>cap</EM> support, <STRONG>ncurses</STRONG> will check for a terminal's - description in termcap form if it is not available in - the terminfo database. - -- The TERMCAP symbol contains either a terminal -- description (with newlines stripped out), or a file -- name telling where the information denoted by the -- TERM symbol exists. In either case, setting it -- directs <STRONG>ncurses</STRONG> to ignore the usual place for this -- information, e.g., /etc/termcap. -+ The TERMCAP environment variable contains either a -+ terminal description (with newlines stripped out), or -+ a file name telling where the information denoted by -+ the TERM environment variable exists. In either -+ case, setting it directs <STRONG>ncurses</STRONG> to ignore the usual -+ place for this information, e.g., /etc/termcap. - - TERMINFO - Overrides the directory in which <STRONG>ncurses</STRONG> searches for - your terminal description. This is the simplest, but -- not the only way to change the list of directories. -+ not the only way to change the list of directories. - The complete list of directories in order follows: - -- <STRONG>o</STRONG> the last directory to which <STRONG>ncurses</STRONG> wrote, if -+ <STRONG>o</STRONG> the last directory to which <STRONG>ncurses</STRONG> wrote, if - any, is searched first - -- <STRONG>o</STRONG> the directory specified by the TERMINFO symbol -+ <STRONG>o</STRONG> the directory specified by the TERMINFO environ- -+ ment variable - - <STRONG>o</STRONG> $HOME/.terminfo - -- <STRONG>o</STRONG> directories listed in the TERMINFO_DIRS symbol -+ <STRONG>o</STRONG> directories listed in the TERMINFO_DIRS environ- -+ ment variable -+ -+ <STRONG>o</STRONG> one or more directories whose names are config- -+ ured and compiled into the ncurses library, i.e., - -- <STRONG>o</STRONG> one or more directories whose names are config- -- ured and compiled into the ncurses library, e.g., -- /usr/share/terminfo -+ <STRONG>o</STRONG> /usr/local/ncurses/share/ter- -+ minfo:/usr/share/terminfo (corresponding to -+ the TERMINFO_DIRS variable) -+ -+ <STRONG>o</STRONG> /usr/share/terminfo (corresponding to the -+ TERMINFO variable) - - TERMINFO_DIRS -- Specifies a list of directories to search for termi- -- nal descriptions. The list is separated by colons -- (i.e., ":") on Unix, semicolons on OS/2 EMX. All of -- the terminal descriptions are in terminfo form, which -- makes a subdirectory named for the first letter of -- the terminal names therein. -+ Specifies a list of directories to search for termi- -+ nal descriptions. The list is separated by colons -+ (i.e., ":") on Unix, semicolons on OS/2 EMX. -+ -+ All of the terminal descriptions are in terminfo -+ form. Normally these are stored in a directory tree, -+ using subdirectories named by the first letter of the -+ terminal names therein. -+ -+ If <STRONG>ncurses</STRONG> is built with a hashed database, then each -+ entry in this list can also be the path of the corre- -+ sponding database file. -+ -+ If <STRONG>ncurses</STRONG> is built with a support for reading term- -+ cap files directly, then an entry in this list may be -+ the path of a termcap file. - - TERMPATH -- If TERMCAP does not hold a file name then <STRONG>ncurses</STRONG> -- checks the TERMPATH symbol. This is a list of file- -- names separated by spaces or colons (i.e., ":") on -- Unix, semicolons on OS/2 EMX. If the TERMPATH symbol -- is not set, <STRONG>ncurses</STRONG> looks in the files /etc/termcap, -- /usr/share/misc/termcap and $HOME/.termcap, in that -+ If TERMCAP does not hold a file name then <STRONG>ncurses</STRONG> -+ checks the TERMPATH environment variable. This is a -+ list of filenames separated by spaces or colons -+ (i.e., ":") on Unix, semicolons on OS/2 EMX. -+ -+ If the TERMPATH environment variable is not set, -+ <STRONG>ncurses</STRONG> looks in the files /etc/termcap, -+ /usr/share/misc/termcap and $HOME/.termcap, in that - order. - -- The library may be configured to disregard the following -- variables when the current user is the superuser (root), -- or if the application uses setuid or setgid permissions: -- $TERMINFO, $TERMINFO_DIRS, $TERMPATH, as well as $HOME. -+ The library may be configured to disregard the following -+ variables when the current user is the superuser (root), -+ or if the application uses setuid or setgid permissions: -+ -+ $TERMINFO, $TERMINFO_DIRS, $TERMPATH, as well as -+ $HOME. - - - </PRE> - <H2>ALTERNATE CONFIGURATIONS</H2><PRE> -- Several different configurations are possible, depending -- on the configure script options used when building -- <STRONG>ncurses</STRONG>. There are a few main options whose effects are -+ Several different configurations are possible, depending -+ on the configure script options used when building -+ <STRONG>ncurses</STRONG>. There are a few main options whose effects are - visible to the applications developer using <STRONG>ncurses</STRONG>: - - --disable-overwrite -- The standard include for <STRONG>ncurses</STRONG> is as noted in <STRONG>SYN-</STRONG> -+ The standard include for <STRONG>ncurses</STRONG> is as noted in <STRONG>SYN-</STRONG> - <STRONG>OPSIS</STRONG>: - - <STRONG>#include</STRONG> <STRONG>&lt;curses.h&gt;</STRONG> - -- This option is used to avoid filename conflicts when -- <STRONG>ncurses</STRONG> is not the main implementation of curses of -- the computer. If <STRONG>ncurses</STRONG> is installed disabling -- overwrite, it puts its headers in a subdirectory, -+ This option is used to avoid filename conflicts when -+ <STRONG>ncurses</STRONG> is not the main implementation of curses of -+ the computer. If <STRONG>ncurses</STRONG> is installed disabling -+ overwrite, it puts its headers in a subdirectory, - e.g., - - <STRONG>#include</STRONG> <STRONG>&lt;ncurses/curses.h&gt;</STRONG> - -- It also omits a symbolic link which would allow you -+ It also omits a symbolic link which would allow you - to use <STRONG>-lcurses</STRONG> to build executables. - - --enable-widec -- The configure script renames the library and (if the -- <STRONG>--disable-overwrite</STRONG> option is used) puts the header -+ The configure script renames the library and (if the -+ <STRONG>--disable-overwrite</STRONG> option is used) puts the header - files in a different subdirectory. All of the -- library names have a "w" appended to them, i.e., -+ library names have a "w" appended to them, i.e., - instead of - - <STRONG>-lncurses</STRONG> -@@ -1095,16 +1145,16 @@ - <STRONG>-lncursesw</STRONG> - - You must also define <STRONG>_XOPEN_SOURCE_EXTENDED</STRONG> when com- -- piling for the wide-character library to use the -- extended (wide-character) functions. The <STRONG>curses.h</STRONG> -- file which is installed for the wide-character -- library is designed to be compatible with the normal -+ piling for the wide-character library to use the -+ extended (wide-character) functions. The <STRONG>curses.h</STRONG> -+ file which is installed for the wide-character -+ library is designed to be compatible with the normal - library's header. Only the size of the <STRONG>WINDOW</STRONG> struc- -- ture differs, and very few applications require more -- than a pointer to <STRONG>WINDOW</STRONG>s. If the headers are -- installed allowing overwrite, the wide-character -- library's headers should be installed last, to allow -- applications to be built using either library from -+ ture differs, and very few applications require more -+ than a pointer to <STRONG>WINDOW</STRONG>s. If the headers are -+ installed allowing overwrite, the wide-character -+ library's headers should be installed last, to allow -+ applications to be built using either library from - the same set of headers. - - --with-shared -@@ -1114,16 +1164,16 @@ - --with-debug - - --with-profile -- The shared and normal (static) library names differ -- by their suffixes, e.g., <STRONG>libncurses.so</STRONG> and -- <STRONG>libncurses.a</STRONG>. The debug and profiling libraries add -- a "_g" and a "_p" to the root names respectively, -- e.g., <STRONG>libncurses_g.a</STRONG> and <STRONG>libncurses_p.a</STRONG>. -+ The shared and normal (static) library names differ -+ by their suffixes, e.g., <STRONG>libncurses.so</STRONG> and <STRONG>libn-</STRONG> -+ <STRONG>curses.a</STRONG>. The debug and profiling libraries add a -+ "_g" and a "_p" to the root names respectively, e.g., -+ <STRONG>libncurses_g.a</STRONG> and <STRONG>libncurses_p.a</STRONG>. - - --with-trace -- The <STRONG>trace</STRONG> function normally resides in the debug -+ The <STRONG>trace</STRONG> function normally resides in the debug - library, but it is sometimes useful to configure this -- in the shared library. Configure scripts should -+ in the shared library. Configure scripts should - check for the function's existence rather than assum- - ing it is always in the debug library. - -@@ -1131,14 +1181,14 @@ - </PRE> - <H2>FILES</H2><PRE> - /usr/share/tabset -- directory containing initialization files for the -+ directory containing initialization files for the - terminal capability database /usr/share/terminfo ter- - minal capability database - - - </PRE> - <H2>SEE ALSO</H2><PRE> -- <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG> and related pages whose names begin "curs_" -+ <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG> and related pages whose names begin "curs_" - for detailed routine descriptions. - <STRONG><A HREF="curs_variables.3x.html">curs_variables(3x)</A></STRONG> - -@@ -1148,52 +1198,61 @@ - The <STRONG>ncurses</STRONG> library can be compiled with an option - (<STRONG>-DUSE_GETCAP</STRONG>) that falls back to the old-style /etc/term- - cap file if the terminal setup code cannot find a terminfo -- entry corresponding to <STRONG>TERM</STRONG>. Use of this feature is not -- recommended, as it essentially includes an entire termcap -- compiler in the <STRONG>ncurses</STRONG> startup code, at significant cost -+ entry corresponding to <STRONG>TERM</STRONG>. Use of this feature is not -+ recommended, as it essentially includes an entire termcap -+ compiler in the <STRONG>ncurses</STRONG> startup code, at significant cost - in core and startup cycles. - -- The <STRONG>ncurses</STRONG> library includes facilities for capturing -- mouse events on certain terminals (including xterm). See -+ The <STRONG>ncurses</STRONG> library includes facilities for capturing -+ mouse events on certain terminals (including xterm). See - the <STRONG><A HREF="curs_mouse.3x.html">curs_mouse(3x)</A></STRONG> manual page for details. - -- The <STRONG>ncurses</STRONG> library includes facilities for responding to -- window resizing events, e.g., when running in an xterm. -- See the <STRONG><A HREF="resizeterm.3x.html">resizeterm(3x)</A></STRONG> and <STRONG><A HREF="wresize.3x.html">wresize(3x)</A></STRONG> manual pages for -- details. In addition, the library may be configured with -+ The <STRONG>ncurses</STRONG> library includes facilities for responding to -+ window resizing events, e.g., when running in an xterm. -+ See the <STRONG><A HREF="resizeterm.3x.html">resizeterm(3x)</A></STRONG> and <STRONG><A HREF="wresize.3x.html">wresize(3x)</A></STRONG> manual pages for -+ details. In addition, the library may be configured with - a SIGWINCH handler. - -- The <STRONG>ncurses</STRONG> library extends the fixed set of function key -- capabilities of terminals by allowing the application -- designer to define additional key sequences at runtime. -+ The <STRONG>ncurses</STRONG> library extends the fixed set of function key -+ capabilities of terminals by allowing the application -+ designer to define additional key sequences at runtime. - See the <STRONG><A HREF="define_key.3x.html">define_key(3x)</A></STRONG> <STRONG><A HREF="key_defined.3x.html">key_defined(3x)</A></STRONG>, and <STRONG><A HREF="keyok.3x.html">keyok(3x)</A></STRONG> man- - ual pages for details. - - The <STRONG>ncurses</STRONG> library can exploit the capabilities of termi- -- nals which implement the ISO-6429 SGR 39 and SGR 49 con- -+ nals which implement the ISO-6429 SGR 39 and SGR 49 con- - trols, which allow an application to reset the terminal to -- its original foreground and background colors. From the -- users' perspective, the application is able to draw col- -- ored text on a background whose color is set indepen- -- dently, providing better control over color contrasts. -+ its original foreground and background colors. From the -+ users' perspective, the application is able to draw col- -+ ored text on a background whose color is set indepen- -+ dently, providing better control over color contrasts. - See the <STRONG><A HREF="default_colors.3x.html">default_colors(3x)</A></STRONG> manual page for details. - -- The <STRONG>ncurses</STRONG> library includes a function for directing -- application output to a printer attached to the terminal -+ The <STRONG>ncurses</STRONG> library includes a function for directing -+ application output to a printer attached to the terminal - device. See the <STRONG><A HREF="curs_print.3x.html">curs_print(3x)</A></STRONG> manual page for details. - - - </PRE> - <H2>PORTABILITY</H2><PRE> -- The <STRONG>ncurses</STRONG> library is intended to be BASE-level confor- -+ The <STRONG>ncurses</STRONG> library is intended to be BASE-level confor- - mant with XSI Curses. The EXTENDED XSI Curses functional- - ity (including color support) is supported. - -- A small number of local differences (that is, individual -- differences between the XSI Curses and <STRONG>ncurses</STRONG> calls) are -- described in <STRONG>PORTABILITY</STRONG> sections of the library man -+ A small number of local differences (that is, individual -+ differences between the XSI Curses and <STRONG>ncurses</STRONG> calls) are -+ described in <STRONG>PORTABILITY</STRONG> sections of the library man - pages. - -+ Unlike other implementations, this one checks parameters -+ such as pointers to WINDOW structures to ensure they are -+ not null. The main reason for providing this behavior is -+ to guard against programmer error. The standard interface -+ does not provide a way for the library to tell an applica- -+ tion which of several possible errors were detected. -+ Relying on this (or some other) extension will adversely -+ affect the portability of curses applications. -+ - This implementation also contains several extensions: - - <STRONG>o</STRONG> The routine <STRONG>has_key</STRONG> is not part of XPG4, nor is it -@@ -1227,31 +1286,31 @@ - - <STRONG>o</STRONG> This implementation can also be configured to provide - a set of functions which improve the ability to manage -- multiple screens. See <STRONG><A HREF="curs_sp_funcs.3x.html">curs_sp_funcs(3x)</A></STRONG> for details. -+ multiple screens. See <STRONG><A HREF="curs_sp_funcs.3x.html">curs_sp_funcs(3x)</A></STRONG> for details. - -- In historic curses versions, delays embedded in the capa- -+ In historic curses versions, delays embedded in the capa- - bilities <STRONG>cr</STRONG>, <STRONG>ind</STRONG>, <STRONG>cub1</STRONG>, <STRONG>ff</STRONG> and <STRONG>tab</STRONG> activated corresponding -- delay bits in the UNIX tty driver. In this implementa- -- tion, all padding is done by sending NUL bytes. This -- method is slightly more expensive, but narrows the inter- -- face to the UNIX kernel significantly and increases the -+ delay bits in the UNIX tty driver. In this implementa- -+ tion, all padding is done by sending NUL bytes. This -+ method is slightly more expensive, but narrows the inter- -+ face to the UNIX kernel significantly and increases the - package's portability correspondingly. - - - </PRE> - <H2>NOTES</H2><PRE> -- The header file <STRONG>&lt;curses.h&gt;</STRONG> automatically includes the -+ The header file <STRONG>&lt;curses.h&gt;</STRONG> automatically includes the - header files <STRONG>&lt;stdio.h&gt;</STRONG> and <STRONG>&lt;unctrl.h&gt;</STRONG>. - -- If standard output from a <STRONG>ncurses</STRONG> program is re-directed -- to something which is not a tty, screen updates will be -+ If standard output from a <STRONG>ncurses</STRONG> program is re-directed -+ to something which is not a tty, screen updates will be - directed to standard error. This was an undocumented fea- - ture of AT&amp;T System V Release 3 curses. - - - </PRE> - <H2>AUTHORS</H2><PRE> -- Zeyd M. Ben-Halim, Eric S. Raymond, Thomas E. Dickey. -+ Zeyd M. Ben-Halim, Eric S. Raymond, Thomas E. Dickey. - Based on pcurses by Pavel Curtis. - - -diff -Naur ncurses-5.9/doc/html/man/ncurses5-config.1.html ncurses-5.9.patch/doc/html/man/ncurses5-config.1.html ---- ncurses-5.9/doc/html/man/ncurses5-config.1.html 2011-04-05 00:46:49.000000000 +0200 -+++ ncurses-5.9.patch/doc/html/man/ncurses5-config.1.html 2014-09-01 16:33:22.333792084 +0200 -@@ -1,4 +1,4 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - **************************************************************************** - * Copyright (c) 2010 Free Software Foundation, Inc. * -@@ -105,10 +105,11 @@ - - <STRONG>--terminfo-dirs</STRONG> - echos the $TERMINFO_DIRS directory list, e.g., -- /usr/local/ncurses/lib/terminfo:/usr/share/terminfo -+ /usr/local/ncurses/share/terminfo:/usr/share/ter- -+ minfo - - <STRONG>--termpath</STRONG> -- echos the $TERMPATH termcap list, if support for -+ echos the $TERMPATH termcap list, if support for - termcap is configured. - - <STRONG>--help</STRONG> prints this message -@@ -118,7 +119,7 @@ - <H2>SEE ALSO</H2><PRE> - <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG> - -- This describes <STRONG>ncurses</STRONG> version 5.9 (patch 20110404). -+ This describes <STRONG>ncurses</STRONG> version 5.9 (patch 20131221). - - - -diff -Naur ncurses-5.9/doc/html/man/panel.3x.html ncurses-5.9.patch/doc/html/man/panel.3x.html ---- ncurses-5.9/doc/html/man/panel.3x.html 2011-04-05 00:46:49.000000000 +0200 -+++ ncurses-5.9.patch/doc/html/man/panel.3x.html 2014-09-01 16:33:22.333792084 +0200 -@@ -1,4 +1,4 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - **************************************************************************** - * Copyright (c) 1998-2007,2010 Free Software Foundation, Inc. * -@@ -174,35 +174,35 @@ - - </PRE> - <H2>DIAGNOSTICS</H2><PRE> -- Each routine that returns a pointer returns <STRONG>NULL</STRONG> if an -- error occurs. Each routine that returns an int value -+ Each routine that returns a pointer returns <STRONG>NULL</STRONG> if an -+ error occurs. Each routine that returns an int value - returns <STRONG>OK</STRONG> if it executes successfully and <STRONG>ERR</STRONG> if not. - - - </PRE> - <H2>COMPATIBILITY</H2><PRE> -- Reasonable care has been taken to ensure compatibility -- with the native panel facility introduced in SVr3.2 -- (inspection of the SVr4 manual pages suggests the -- programming interface is unchanged). The <STRONG>PANEL</STRONG> data -- structures are merely similar. The programmer is cau- -- tioned not to directly use <STRONG>PANEL</STRONG> fields. -+ Reasonable care has been taken to ensure compatibility -+ with the native panel facility introduced in SVr3.2 -+ (inspection of the SVr4 manual pages suggests the program- -+ ming interface is unchanged). The <STRONG>PANEL</STRONG> data structures -+ are merely similar. The programmer is cautioned not to -+ directly use <STRONG>PANEL</STRONG> fields. - -- The functions <STRONG>show_panel()</STRONG> and <STRONG>top_panel()</STRONG> are identical -- in this implementation, and work equally well with dis- -+ The functions <STRONG>show_panel()</STRONG> and <STRONG>top_panel()</STRONG> are identical -+ in this implementation, and work equally well with dis- - played or hidden panels. In the native System V implemen- - tation, <STRONG>show_panel()</STRONG> is intended for making a hidden panel -- visible (at the top of the stack) and <STRONG>top_panel()</STRONG> is -- intended for making an already-visible panel move to the -- top of the stack. You are cautioned to use the correct -- function to ensure compatibility with native panel -+ visible (at the top of the stack) and <STRONG>top_panel()</STRONG> is -+ intended for making an already-visible panel move to the -+ top of the stack. You are cautioned to use the correct -+ function to ensure compatibility with native panel - libraries. - - - </PRE> - <H2>NOTE</H2><PRE> -- In your library list, libpanel.a should be before libn- -- curses.a; that is, you want to say `-lpanel -lncurses', -+ In your library list, libpanel.a should be before libn- -+ curses.a; that is, you want to say `-lpanel -lncurses', - not the other way around (which would usually give a link- - error). - -@@ -218,14 +218,14 @@ - <H2>SEE ALSO</H2><PRE> - <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>, <STRONG><A HREF="curs_variables.3x.html">curs_variables(3x)</A></STRONG>, - -- This describes <STRONG>ncurses</STRONG> version 5.9 (patch 20110404). -+ This describes <STRONG>ncurses</STRONG> version 5.9 (patch 20131221). - - - </PRE> - <H2>AUTHOR</H2><PRE> -- Originally written by Warren Tucker &lt;wht@n4hgf.mt- -- park.ga.us&gt;, primarily to assist in porting u386mon to -- systems without a native panels library. Repackaged for -+ Originally written by Warren Tucker &lt;wht@n4hgf.mt- -+ park.ga.us&gt;, primarily to assist in porting u386mon to -+ systems without a native panels library. Repackaged for - ncurses by Zeyd ben-Halim. - - -diff -Naur ncurses-5.9/doc/html/man/resizeterm.3x.html ncurses-5.9.patch/doc/html/man/resizeterm.3x.html ---- ncurses-5.9/doc/html/man/resizeterm.3x.html 2011-01-09 02:03:28.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/resizeterm.3x.html 2014-09-01 16:33:22.333792084 +0200 -@@ -1,7 +1,7 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - **************************************************************************** -- * Copyright (c) 1998-2005,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -27,8 +27,8 @@ - * sale, use or other dealings in this Software without prior written * - * authorization. * - **************************************************************************** -- * Author: Thomas E. Dickey 1996-2005 -- * @Id: resizeterm.3x,v 1.14 2010/12/04 18:38:55 tom Exp @ -+ * Author: Thomas E. Dickey 1996-on -+ * @Id: resizeterm.3x,v 1.17 2013/06/22 20:41:54 tom Exp @ - --> - <HTML> - <HEAD> -@@ -69,28 +69,29 @@ - terminal (e.g., xterm). The function <STRONG>resizeterm</STRONG> resizes - the standard and current windows to the specified dimen- - sions, and adjusts other bookkeeping data used by the -- <STRONG>ncurses</STRONG> library that record the window dimensions. -+ <STRONG>ncurses</STRONG> library that record the window dimensions such as -+ the <STRONG>LINES</STRONG> and <STRONG>COLS</STRONG> variables. - -- Most of the work is done by the inner function -+ Most of the work is done by the inner function - <STRONG>resize_term</STRONG>. The outer function <STRONG>resizeterm</STRONG> adds bookkeep- -- ing for the SIGWINCH handler. When resizing the windows, -- <STRONG>resize_term</STRONG> blank-fills the areas that are extended. The -+ ing for the SIGWINCH handler. When resizing the windows, -+ <STRONG>resize_term</STRONG> blank-fills the areas that are extended. The - calling application should fill in these areas with appro- -- priate data. The <STRONG>resize_term</STRONG> function attempts to resize -- all windows. However, due to the calling convention of -- pads, it is not possible to resize these without addi- -+ priate data. The <STRONG>resize_term</STRONG> function attempts to resize -+ all windows. However, due to the calling convention of -+ pads, it is not possible to resize these without addi- - tional interaction with the application. - -- A support function <STRONG>is_term_resized</STRONG> is provided so that -- applications can check if the <STRONG>resize_term</STRONG> function would -+ A support function <STRONG>is_term_resized</STRONG> is provided so that -+ applications can check if the <STRONG>resize_term</STRONG> function would - modify the window structures. It returns TRUE if the win- - dows would be modified, and FALSE otherwise. - - - </PRE> - <H2>RETURN VALUE</H2><PRE> -- Except as notes, these function return the integer <STRONG>ERR</STRONG> -- upon failure and <STRONG>OK</STRONG> on success. They will fail if either -+ Except as noted, these functions return the integer <STRONG>ERR</STRONG> -+ upon failure and <STRONG>OK</STRONG> on success. They will fail if either - of the dimensions are less than or equal to zero, or if an - error occurs while (re)allocating memory for the windows. - -@@ -98,29 +99,27 @@ - </PRE> - <H2>NOTES</H2><PRE> - While these functions are intended to be used to support a -- signal handler (i.e., for SIGWINCH), care should be taken -- to avoid invoking them in a context where <STRONG>malloc</STRONG> or <STRONG>real-</STRONG> -- <STRONG>loc</STRONG> may have been interrupted, since it uses those func- -+ signal handler (i.e., for SIGWINCH), care should be taken -+ to avoid invoking them in a context where <STRONG>malloc</STRONG> or <STRONG>real-</STRONG> -+ <STRONG>loc</STRONG> may have been interrupted, since it uses those func- - tions. - -- If ncurses is configured to supply its own SIGWINCH han- -- dler, the <STRONG>resizeterm</STRONG> function ungetch's a <STRONG>KEY_RESIZE</STRONG> which -- will be read on the next call to <STRONG>getch</STRONG>. This is used to -+ If ncurses is configured to supply its own SIGWINCH han- -+ dler, the <STRONG>resizeterm</STRONG> function <STRONG>ungetch</STRONG>'s a <STRONG>KEY_RESIZE</STRONG> which -+ will be read on the next call to <STRONG>getch</STRONG>. This is used to - alert an application that the screen size has changed, and -- that it should repaint special features such as pads that -+ that it should repaint special features such as pads that - cannot be done automatically. - -- If the environment variables <STRONG>LINES</STRONG> or <STRONG>COLUMNS</STRONG> are set, -- this overrides the library's use of the window size -- obtained from the operating system. Thus, even if a SIG- -- WINCH is received, no screen size change may be recorded. -- In that case, no <STRONG>KEY_RESIZE</STRONG> is queued for the next call to -- <STRONG>getch</STRONG>; an <STRONG>ERR</STRONG> will be returned instead. -+ If the environment variables <STRONG>LINES</STRONG> or <STRONG>COLUMNS</STRONG> are set, -+ this overrides the library's use of the window size -+ obtained from the operating system. Thus, even if a SIG- -+ WINCH is received, no screen size change may be recorded. - - - </PRE> - <H2>SEE ALSO</H2><PRE> -- <STRONG><A HREF="curs_variables.3x.html">curs_variables(3x)</A></STRONG>, <STRONG><A HREF="wresize.3x.html">wresize(3x)</A></STRONG>. -+ <STRONG><A HREF="curs_getch.3x.html">curs_getch(3x)</A></STRONG>, <STRONG><A HREF="curs_variables.3x.html">curs_variables(3x)</A></STRONG>, <STRONG><A HREF="wresize.3x.html">wresize(3x)</A></STRONG>. - - - </PRE> -diff -Naur ncurses-5.9/doc/html/man/tabs.1.html ncurses-5.9.patch/doc/html/man/tabs.1.html ---- ncurses-5.9/doc/html/man/tabs.1.html 2011-04-05 00:46:50.000000000 +0200 -+++ ncurses-5.9.patch/doc/html/man/tabs.1.html 2014-09-01 16:33:22.333792084 +0200 -@@ -1,7 +1,7 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - **************************************************************************** -- * Copyright (c) 2008-2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 2008-2011,2013 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -27,7 +27,7 @@ - * sale, use or other dealings in this Software without prior written * - * authorization. * - **************************************************************************** -- * @Id: tabs.1,v 1.8 2010/12/04 18:40:45 tom Exp @ -+ * @Id: tabs.1,v 1.11 2013/06/22 18:11:57 tom Exp @ - --> - <HTML> - <HEAD> -@@ -52,7 +52,7 @@ - - </PRE> - <H2>SYNOPSIS</H2><PRE> -- <STRONG>tabs</STRONG> [<STRONG>-v</STRONG>[<EM>n</EM>]] [<STRONG>-ahuUV</STRONG>] <EM>file...</EM> -+ <STRONG>tabs</STRONG> [<EM>options</EM>]] <EM>[tabstop-list]</EM> - - - </PRE> -@@ -85,14 +85,17 @@ - any debugging option, but not to modify the terminal - settings. - -- The <STRONG>tabs</STRONG> program processes a single list of tab stops. -- The last option to be processed which defines a list is -+ <STRONG>-V</STRONG> reports the version of ncurses which was used in this -+ program, and exits. -+ -+ The <STRONG>tabs</STRONG> program processes a single list of tab stops. -+ The last option to be processed which defines a list is - the one that determines the list to be processed. - - <STRONG>Implicit</STRONG> <STRONG>Lists</STRONG> -- Use a single number as an option, e.g., "<STRONG>-5</STRONG>" to set tabs -- at the given interval (in this case 1, 6, 11, 16, 21, -- etc.). Tabs are repeated up to the right margin of the -+ Use a single number as an option, e.g., "<STRONG>-5</STRONG>" to set tabs -+ at the given interval (in this case 1, 6, 11, 16, 21, -+ etc.). Tabs are repeated up to the right margin of the - screen. - - Use "<STRONG>-0</STRONG>" to clear all tabs. -@@ -100,17 +103,18 @@ - Use "<STRONG>-8</STRONG>" to set tabs to the standard interval. - - <STRONG>Explicit</STRONG> <STRONG>Lists</STRONG> -- An explicit list can be defined after the options (this -- does not use a "-"). The values in the list must be in -+ An explicit list can be defined after the options (this -+ does not use a "-"). The values in the list must be in - increasing numeric order, and greater than zero. They are - separated by a comma or a blank, for example, - - tabs 1,6,11,16,21 - tabs 1 6 11 16 21 -- Use a '+' to treat a number as an increment relative to -+ Use a '+' to treat a number as an increment relative to - the previous value, e.g., - - tabs 1,+5,+5,+5,+5 -+ - which is equivalent to the 1,6,11,16,21 example. - - <STRONG>Predefined</STRONG> <STRONG>Tab-Stops</STRONG> -@@ -137,18 +141,18 @@ - - </PRE> - <H2>PORTABILITY</H2><PRE> -- X/Open describes a <STRONG>+m</STRONG> option, to set a terminal's left- -- margin. Very few of the entries in the terminal database -+ X/Open describes a <STRONG>+m</STRONG> option, to set a terminal's left- -+ margin. Very few of the entries in the terminal database - provide this capability. - -- The <STRONG>-d</STRONG> (debug) and <STRONG>-n</STRONG> (no-op) options are extensions not -+ The <STRONG>-d</STRONG> (debug) and <STRONG>-n</STRONG> (no-op) options are extensions not - provided by other implementations. - -- Documentation for other implementations states that there -- is a limit on the number of tab stops. While some termi- -+ Documentation for other implementations states that there -+ is a limit on the number of tab stops. While some termi- - nals may not accept an arbitrary number of tab stops, this -- implementation will attempt to set tab stops up to the -- right margin of the screen, if the given list happens to -+ implementation will attempt to set tab stops up to the -+ right margin of the screen, if the given list happens to - be that long. - - -@@ -156,7 +160,7 @@ - <H2>SEE ALSO</H2><PRE> - <STRONG><A HREF="tset.1.html">tset(1)</A></STRONG>, <STRONG><A HREF="infocmp.1m.html">infocmp(1m)</A></STRONG>, <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>, <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG>. - -- This describes <STRONG>ncurses</STRONG> version 5.9 (patch 20110404). -+ This describes <STRONG>ncurses</STRONG> version 5.9 (patch 20131221). - - - -diff -Naur ncurses-5.9/doc/html/man/term.5.html ncurses-5.9.patch/doc/html/man/term.5.html ---- ncurses-5.9/doc/html/man/term.5.html 2011-01-09 02:03:28.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/term.5.html 2014-09-01 16:33:22.333792084 +0200 -@@ -1,4 +1,4 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - **************************************************************************** - * Copyright (c) 1998-2006,2010 Free Software Foundation, Inc. * -diff -Naur ncurses-5.9/doc/html/man/term.7.html ncurses-5.9.patch/doc/html/man/term.7.html ---- ncurses-5.9/doc/html/man/term.7.html 2011-02-26 00:25:09.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/term.7.html 2014-09-01 16:33:22.333792084 +0200 -@@ -1,7 +1,7 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - **************************************************************************** -- * Copyright (c) 1998-2007,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2010,2011 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -27,7 +27,7 @@ - * sale, use or other dealings in this Software without prior written * - * authorization. * - **************************************************************************** -- * @Id: term.7,v 1.22 2010/12/04 18:41:07 tom Exp @ -+ * @Id: term.7,v 1.23 2011/12/17 23:32:17 tom Exp @ - --> - <HTML> - <HEAD> -@@ -85,9 +85,9 @@ - the tty device and baud rate. - - Setting your own <STRONG>TERM</STRONG> value may also be useful if you have -- created a custom entry incorporating options (such as -- visual bell or reverse-video) which you wish to override -- the system default type for your line. -+ created a custom entry incorporating options (such as vis- -+ ual bell or reverse-video) which you wish to override the -+ system default type for your line. - - Terminal type descriptions are stored as files of capabil- - ity data underneath /usr/share/terminfo. To browse a list -diff -Naur ncurses-5.9/doc/html/man/terminfo.5.html ncurses-5.9.patch/doc/html/man/terminfo.5.html ---- ncurses-5.9/doc/html/man/terminfo.5.html 2011-04-05 00:46:51.000000000 +0200 -+++ ncurses-5.9.patch/doc/html/man/terminfo.5.html 2014-09-01 16:33:22.335792088 +0200 -@@ -1,4 +1,4 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - * t - * DO NOT EDIT THIS FILE BY HAND! -@@ -6,7 +6,7 @@ - * Note: this must be run through tbl before nroff. - * The magic cookie on the first line triggers this under some man programs. - **************************************************************************** -- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -32,9 +32,9 @@ - * sale, use or other dealings in this Software without prior written * - * authorization. * - **************************************************************************** -- * @Id: terminfo.head,v 1.18 2010/07/31 16:08:48 tom Exp @ -+ * @Id: terminfo.head,v 1.21 2013/03/09 22:11:36 tom Exp @ - * Head of terminfo man page ends here -- * @Id: terminfo.tail,v 1.53 2010/12/04 18:38:55 tom Exp @ -+ * @Id: terminfo.tail,v 1.68 2013/11/09 15:20:48 tom Exp @ - * Beginning of terminfo.tail file - * This file is part of ncurses. - * See "terminfo.head" for copyright. -@@ -73,12 +73,12 @@ - </PRE> - <H2>DESCRIPTION</H2><PRE> - <EM>Terminfo</EM> is a data base describing terminals, used by -- screen-oriented programs such as <STRONG><A HREF="nvi.1.html">nvi(1)</A></STRONG>, <STRONG><A HREF="rogue.1.html">rogue(1)</A></STRONG> and -+ screen-oriented programs such as <STRONG>nvi(1)</STRONG>, <STRONG>rogue(1)</STRONG> and - libraries such as <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>. <EM>Terminfo</EM> describes termi- - nals by giving a set of capabilities which they have, by - specifying how to perform screen operations, and by speci- - fying padding requirements and initialization sequences. -- This describes <STRONG>ncurses</STRONG> version 5.9 (patch 20110404). -+ This describes <STRONG>ncurses</STRONG> version 5.9 (patch 20131221). - - Entries in <EM>terminfo</EM> consist of a sequence of `,' separated - fields (embedded commas may be escaped with a backslash or -@@ -106,14 +106,13 @@ - Terminal names (except for the last, verbose entry) should - be chosen using the following conventions. The particular - piece of hardware making up the terminal should have a -- root name, thus ``hp2621''. This name should not contain -+ root name, thus "hp2621". This name should not contain - hyphens. Modes that the hardware can be in, or user pref- - erences, should be indicated by appending a hyphen and a - mode suffix. Thus, a vt100 in 132 column mode would be - vt100-w. The following suffixes should be used where pos- - sible: - -- - <STRONG>Suffix</STRONG> <STRONG>Meaning</STRONG> <STRONG>Example</STRONG> - -<EM>nn</EM> Number of lines on the screen aaa-60 - -<EM>n</EM>p Number of pages of memory c100-4p -@@ -126,14 +125,14 @@ - -ns No status line hp2626-ns - -rv Reverse video c100-rv - -s Enable status line vt100-s -- - -vb Use visible bell instead of beep wy370-vb -+ - -w Wide mode (&gt; 80 columns, usually 132) vt100-w - - For more on terminal naming conventions, see the <STRONG>term(7)</STRONG> - manual page. - -- <STRONG>Capabilities</STRONG> -+ <STRONG>Predefined</STRONG> <STRONG>Capabilities</STRONG> - The following is a complete table of the capabilities - included in a terminfo description block and available to - terminfo-using code. In each line of the table, -@@ -176,133 +175,134 @@ - These are the boolean capabilities: - - -- <STRONG>Variable</STRONG> <STRONG>Cap-</STRONG> <STRONG>TCap</STRONG> <STRONG>Description</STRONG> -- <STRONG>Booleans</STRONG> <STRONG>name</STRONG> <STRONG>Code</STRONG> -- auto_left_margin bw bw cub1 wraps from col- -+ <STRONG>Variable</STRONG> <STRONG>Cap-</STRONG> <STRONG>TCap</STRONG> <STRONG>Description</STRONG> -+ <STRONG>Booleans</STRONG> <STRONG>name</STRONG> <STRONG>Code</STRONG> -+ auto_left_margin bw bw cub1 wraps from col- - umn 0 to last column -- auto_right_margin am am terminal has auto- -+ auto_right_margin am am terminal has auto- - matic margins -- back_color_erase bce ut screen erased with -+ back_color_erase bce ut screen erased with - background color -- can_change ccc cc terminal can re- -+ can_change ccc cc terminal can re- - define existing col- - ors -- ceol_standout_glitch xhp xs standout not erased -+ ceol_standout_glitch xhp xs standout not erased - by overwriting (hp) -- col_addr_glitch xhpa YA only positive motion -+ col_addr_glitch xhpa YA only positive motion - for hpa/mhpa caps - - -- cpi_changes_res cpix YF changing character -+ -+ cpi_changes_res cpix YF changing character - pitch changes reso- - lution -- cr_cancels_micro_mode crxm YB using cr turns off -+ cr_cancels_micro_mode crxm YB using cr turns off - micro mode -- dest_tabs_magic_smso xt xt tabs destructive, -+ dest_tabs_magic_smso xt xt tabs destructive, - magic so char - (t1061) -- eat_newline_glitch xenl xn newline ignored -+ eat_newline_glitch xenl xn newline ignored - after 80 cols (con- - cept) -- erase_overstrike eo eo can erase over- -+ erase_overstrike eo eo can erase over- - strikes with a blank -- generic_type gn gn generic line type -- hard_copy hc hc hardcopy terminal -- hard_cursor chts HC cursor is hard to -+ generic_type gn gn generic line type -+ hard_copy hc hc hardcopy terminal -+ hard_cursor chts HC cursor is hard to - see -- has_meta_key km km Has a meta key -+ has_meta_key km km Has a meta key - (i.e., sets 8th-bit) -- has_print_wheel daisy YC printer needs opera- -+ has_print_wheel daisy YC printer needs opera- - tor to change char- - acter set -- has_status_line hs hs has extra status -+ has_status_line hs hs has extra status - line -- hue_lightness_saturation hls hl terminal uses only -+ hue_lightness_saturation hls hl terminal uses only - HLS color notation - (Tektronix) -- insert_null_glitch in in insert mode distin- -+ insert_null_glitch in in insert mode distin- - guishes nulls -- lpi_changes_res lpix YG changing line pitch -+ lpi_changes_res lpix YG changing line pitch - changes resolution -- memory_above da da display may be -+ memory_above da da display may be - retained above the - screen -- memory_below db db display may be -+ memory_below db db display may be - retained below the - screen -- move_insert_mode mir mi safe to move while -+ move_insert_mode mir mi safe to move while - in insert mode -- move_standout_mode msgr ms safe to move while -+ move_standout_mode msgr ms safe to move while - in standout mode -- needs_xon_xoff nxon nx padding will not -+ needs_xon_xoff nxon nx padding will not - work, xon/xoff - required -- no_esc_ctlc xsb xb beehive (f1=escape, -+ no_esc_ctlc xsb xb beehive (f1=escape, - f2=ctrl C) -- no_pad_char npc NP pad character does -+ no_pad_char npc NP pad character does - not exist -- non_dest_scroll_region ndscr ND scrolling region is -+ non_dest_scroll_region ndscr ND scrolling region is - non-destructive -- non_rev_rmcup nrrmc NR smcup does not -+ non_rev_rmcup nrrmc NR smcup does not - reverse rmcup -- over_strike os os terminal can over- -+ over_strike os os terminal can over- - strike -- prtr_silent mc5i 5i printer will not -+ prtr_silent mc5i 5i printer will not - echo on screen -- row_addr_glitch xvpa YD only positive motion -+ row_addr_glitch xvpa YD only positive motion - for vpa/mvpa caps -- semi_auto_right_margin sam YE printing in last -+ semi_auto_right_margin sam YE printing in last - column causes cr -- status_line_esc_ok eslok es escape can be used -+ status_line_esc_ok eslok es escape can be used - on the status line -- tilde_glitch hz hz cannot print ~'s -+ tilde_glitch hz hz cannot print ~'s - (hazeltine) - - -- transparent_underline ul ul underline character -+ transparent_underline ul ul underline character - overstrikes -- xon_xoff xon xo terminal uses -+ xon_xoff xon xo terminal uses - xon/xoff handshaking - - These are the numeric capabilities: - - -- <STRONG>Variable</STRONG> <STRONG>Cap-</STRONG> <STRONG>TCap</STRONG> <STRONG>Description</STRONG> -- <STRONG>Numeric</STRONG> <STRONG>name</STRONG> <STRONG>Code</STRONG> -- columns cols co number of columns in -+ <STRONG>Variable</STRONG> <STRONG>Cap-</STRONG> <STRONG>TCap</STRONG> <STRONG>Description</STRONG> -+ <STRONG>Numeric</STRONG> <STRONG>name</STRONG> <STRONG>Code</STRONG> -+ columns cols co number of columns in - a line -- init_tabs it it tabs initially every -+ init_tabs it it tabs initially every - # spaces -- label_height lh lh rows in each label -- label_width lw lw columns in each -+ label_height lh lh rows in each label -+ label_width lw lw columns in each - label -- lines lines li number of lines on -+ lines lines li number of lines on - screen or page -- lines_of_memory lm lm lines of memory if &gt; -+ lines_of_memory lm lm lines of memory if &gt; - line. 0 means varies -- magic_cookie_glitch xmc sg number of blank -+ magic_cookie_glitch xmc sg number of blank - characters left by - smso or rmso -- max_attributes ma ma maximum combined -+ max_attributes ma ma maximum combined - attributes terminal - can handle -- max_colors colors Co maximum number of -+ max_colors colors Co maximum number of - colors on screen -- max_pairs pairs pa maximum number of -+ max_pairs pairs pa maximum number of - color-pairs on the - screen -- maximum_windows wnum MW maximum number of -+ maximum_windows wnum MW maximum number of - defineable windows -- no_color_video ncv NC video attributes -+ no_color_video ncv NC video attributes - that cannot be used - with colors -- num_labels nlab Nl number of labels on -+ num_labels nlab Nl number of labels on - screen -- padding_baud_rate pb pb lowest baud rate -+ padding_baud_rate pb pb lowest baud rate - where padding needed -- virtual_terminal vt vt virtual terminal -+ virtual_terminal vt vt virtual terminal - number (CB/unix) -- width_status_line wsl ws number of columns in -+ width_status_line wsl ws number of columns in - status line - - The following numeric capabilities are present in the -@@ -310,47 +310,47 @@ - man page. They came in with SVr4's printer support. - - -- <STRONG>Variable</STRONG> <STRONG>Cap-</STRONG> <STRONG>TCap</STRONG> <STRONG>Description</STRONG> -- <STRONG>Numeric</STRONG> <STRONG>name</STRONG> <STRONG>Code</STRONG> -- bit_image_entwining bitwin Yo number of passes for -+ <STRONG>Variable</STRONG> <STRONG>Cap-</STRONG> <STRONG>TCap</STRONG> <STRONG>Description</STRONG> -+ <STRONG>Numeric</STRONG> <STRONG>name</STRONG> <STRONG>Code</STRONG> -+ bit_image_entwining bitwin Yo number of passes for - each bit-image row -- bit_image_type bitype Yp type of bit-image -+ bit_image_type bitype Yp type of bit-image - device -- buffer_capacity bufsz Ya numbers of bytes -+ buffer_capacity bufsz Ya numbers of bytes - buffered before - printing -- buttons btns BT number of buttons on -+ buttons btns BT number of buttons on - mouse -- dot_horz_spacing spinh Yc spacing of dots hor- -+ dot_horz_spacing spinh Yc spacing of dots hor- - izontally in dots - per inch - -- dot_vert_spacing spinv Yb spacing of pins ver- -+ dot_vert_spacing spinv Yb spacing of pins ver- - tically in pins per - inch -- max_micro_address maddr Yd maximum value in -+ max_micro_address maddr Yd maximum value in - micro_..._address -- max_micro_jump mjump Ye maximum value in -+ max_micro_jump mjump Ye maximum value in - parm_..._micro -- micro_col_size mcs Yf character step size -+ micro_col_size mcs Yf character step size - when in micro mode -- micro_line_size mls Yg line step size when -+ micro_line_size mls Yg line step size when - in micro mode -- number_of_pins npins Yh numbers of pins in -+ number_of_pins npins Yh numbers of pins in - print-head -- output_res_char orc Yi horizontal resolu- -+ output_res_char orc Yi horizontal resolu- - tion in units per - line -- output_res_horz_inch orhi Yk horizontal resolu- -+ output_res_horz_inch orhi Yk horizontal resolu- - tion in units per - inch -- output_res_line orl Yj vertical resolution -+ output_res_line orl Yj vertical resolution - in units per line -- output_res_vert_inch orvi Yl vertical resolution -+ output_res_vert_inch orvi Yl vertical resolution - in units per inch -- print_rate cps Ym print rate in char- -+ print_rate cps Ym print rate in char- - acters per second -- wide_char_size widcs Yn character step size -+ wide_char_size widcs Yn character step size - when in double wide - mode - -@@ -402,8 +402,8 @@ - prototype !? - create_window cwin CW define a window #1 - from #2,#3 to #4,#5 -- cursor_address cup cm move to row #1 -- columns #2 -+ cursor_address cup cm move to row #1 col- -+ umns #2 - cursor_down cud1 do down one line - cursor_home home ho home cursor (if no - cup) -@@ -904,8 +904,8 @@ - zero_motion zerom Zx No motion for subse- - quent character - -- The following string capabilities are present in the -- SVr4.0 term structure, but were originally not documented -+ The following string capabilities are present in the -+ SVr4.0 term structure, but were originally not documented - in the man page. - - -@@ -989,13 +989,14 @@ - bottom margins to - #1, #2 - -- The XSI Curses standard added these. They are some -- post-4.1 versions of System V curses, e.g., Solaris 2.5 -- and IRIX 6.x. The <STRONG>ncurses</STRONG> termcap names for them are -- invented; according to the XSI Curses standard, they have -- no termcap names. If your compiled terminfo entries use -- these, they may not be binary-compatible with System V -- terminfo entries after SVr4.1; beware! -+ The XSI Curses standard added these hardcopy capabili- -+ ties. They were used in some post-4.1 versions of System -+ V curses, e.g., Solaris 2.5 and IRIX 6.x. Except for <STRONG>YI</STRONG>, -+ the <STRONG>ncurses</STRONG> termcap names for them are invented. Accord- -+ ing to the XSI Curses standard, they have no termcap -+ names. If your compiled terminfo entries use these, they -+ may not be binary-compatible with System V terminfo -+ entries after SVr4.1; beware! - - - <STRONG>Variable</STRONG> <STRONG>Cap-</STRONG> <STRONG>TCap</STRONG> <STRONG>Description</STRONG> -@@ -1015,123 +1016,210 @@ - set_a_attributes sgr1 sA Define second set of - video attributes - #1-#6 -- set_pglen_inch slengthsL YI Set page length -- to #1 hundredth of -- an inch -+ set_pglen_inch slengthYI Set page length to -+ #1 hundredth of an -+ inch (some implemen- -+ tations use sL for -+ termcap). -+ -+ <STRONG>User-Defined</STRONG> <STRONG>Capabilities</STRONG> -+ The preceding section listed the <EM>predefined</EM> capabilities. -+ They deal with some special features for terminals no -+ longer (or possibly never) produced. Occasionally there -+ are special features of newer terminals which are awkward -+ or impossible to represent by reusing the predefined capa- -+ bilities. -+ -+ <STRONG>ncurses</STRONG> addresses this limitation by allowing user-defined -+ capabilities. The <STRONG>tic</STRONG> and <STRONG>infocmp</STRONG> programs provide the <STRONG>-x</STRONG> -+ option for this purpose. When <STRONG>-x</STRONG> is set, <STRONG>tic</STRONG> treats -+ unknown capabilities as user-defined. That is, if <STRONG>tic</STRONG> -+ encounters a capability name which it does not recognize, -+ it infers its type (boolean, number or string) from the -+ syntax and makes an extended table entry for that capabil- -+ ity. The <STRONG>use_extended_names</STRONG> function makes this informa- -+ tion conditionally available to applications. The ncurses -+ library provides the data leaving most of the behavior to -+ applications: -+ -+ <STRONG>o</STRONG> User-defined capability strings whose name begins with -+ "k" are treated as function keys. -+ -+ <STRONG>o</STRONG> The types (boolean, number, string) determined by <STRONG>tic</STRONG> -+ can be inferred by successful calls on <STRONG>tigetflag</STRONG>, etc. -+ -+ <STRONG>o</STRONG> If the capability name happens to be two characters, -+ the capability is also available through the termcap -+ interface. -+ -+ While termcap is said to be extensible because it does not -+ use a predefined set of capabilities, in practice it has -+ been limited to the capabilities defined by terminfo -+ implementations. As a rule, user-defined capabilities -+ intended for use by termcap applications should be limited -+ to booleans and numbers to avoid running past the 1023 -+ byte limit assumed by termcap implementations and their -+ applications. In particular, providing extended sets of -+ function keys (past the 60 numbered keys and the handful -+ of special named keys) is best done using the longer names -+ available using terminfo. - - <STRONG>A</STRONG> <STRONG>Sample</STRONG> <STRONG>Entry</STRONG> - The following entry, describing an ANSI-standard terminal, -- is representative of what a <STRONG>terminfo</STRONG> entry for a modern -+ is representative of what a <STRONG>terminfo</STRONG> entry for a modern - terminal typically looks like. - -- ansi|ansi/pc-term compatible with color, -- mc5i, -- colors#8, ncv#3, pairs#64, -- cub=\E[%p1%dD, cud=\E[%p1%dB, cuf=\E[%p1%dC, -- cuu=\E[%p1%dA, dch=\E[%p1%dP, dl=\E[%p1%dM, -- ech=\E[%p1%dX, el1=\E[1K, hpa=\E[%p1%dG, ht=\E[I, -- ich=\E[%p1%d@, il=\E[%p1%dL, indn=\E[%p1%dS, .indn=\E[%p1%dT, -- kbs=^H, kcbt=\E[Z, kcub1=\E[D, kcud1=\E[B, -- kcuf1=\E[C, kcuu1=\E[A, kf1=\E[M, kf10=\E[V, -- kf11=\E[W, kf12=\E[X, kf2=\E[N, kf3=\E[O, kf4=\E[P, -- kf5=\E[Q, kf6=\E[R, kf7=\E[S, kf8=\E[T, kf9=\E[U, -- kich1=\E[L, mc4=\E[4i, mc5=\E[5i, nel=\r\E[S, -- op=\E[37;40m, rep=%p1%c\E[%p2%{1}%-%db, -- rin=\E[%p1%dT, s0ds=\E(B, s1ds=\E)B, s2ds=\E*B, -- s3ds=\E+B, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, -- setb=\E[4%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m, -- setf=\E[3%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m, -- sgr=\E[0;10%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;%?%p7%t;8%;%?%p8%t;11%;%?%p9%t;12%;m, -- sgr0=\E[0;10m, tbc=\E[2g, u6=\E[%d;%dR, u7=\E[6n, -- u8=\E[?%[;0123456789]c, u9=\E[c, vpa=\E[%p1%dd, -- -- Entries may continue onto multiple lines by placing white -- space at the beginning of each line except the first. -- Comments may be included on lines beginning with ``#''. -- Capabilities in <EM>terminfo</EM> are of three types: Boolean capa- -- bilities which indicate that the terminal has some partic- -- ular feature, numeric capabilities giving the size of the -- terminal or the size of particular delays, and string -- capabilities, which give a sequence which can be used to -- perform particular terminal operations. -+ ansi|ansi/pc-term compatible with color, -+ am, mc5i, mir, msgr, -+ colors#8, cols#80, it#8, lines#24, ncv#3, pairs#64, -+ acsc=+\020\,\021-\030.^Y0\333`\004a\261f\370g\361h\260 -+ j\331k\277l\332m\300n\305o~p\304q\304r\304s_t\303 -+ u\264v\301w\302x\263y\363z\362{\343|\330}\234~\376, -+ bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, clear=\E[H\E[J, -+ cr=^M, cub=\E[%p1%dD, cub1=\E[D, cud=\E[%p1%dB, cud1=\E[B, -+ cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, -+ cuu=\E[%p1%dA, cuu1=\E[A, dch=\E[%p1%dP, dch1=\E[P, -+ dl=\E[%p1%dM, dl1=\E[M, ech=\E[%p1%dX, ed=\E[J, el=\E[K, -+ el1=\E[1K, home=\E[H, hpa=\E[%i%p1%dG, ht=\E[I, hts=\EH, -+ ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[L, ind=^J, -+ indn=\E[%p1%dS, invis=\E[8m, kbs=^H, kcbt=\E[Z, kcub1=\E[D, -+ kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, khome=\E[H, kich1=\E[L, -+ mc4=\E[4i, mc5=\E[5i, nel=\r\E[S, op=\E[39;49m, -+ rep=%p1%c\E[%p2%{1}%-%db, rev=\E[7m, rin=\E[%p1%dT, -+ rmacs=\E[10m, rmpch=\E[10m, rmso=\E[m, rmul=\E[m, -+ s0ds=\E(B, s1ds=\E)B, s2ds=\E*B, s3ds=\E+B, -+ setab=\E[4%p1%dm, setaf=\E[3%p1%dm, -+ sgr=\E[0;10%?%p1%t;7%; -+ %?%p2%t;4%; -+ %?%p3%t;7%; -+ %?%p4%t;5%; -+ %?%p6%t;1%; -+ %?%p7%t;8%; -+ %?%p9%t;11%;m, -+ sgr0=\E[0;10m, smacs=\E[11m, smpch=\E[11m, smso=\E[7m, -+ smul=\E[4m, tbc=\E[3g, u6=\E[%i%d;%dR, u7=\E[6n, -+ u8=\E[?%[;0123456789]c, u9=\E[c, vpa=\E[%i%p1%dd, -+ -+ Entries may continue onto multiple lines by placing white -+ space at the beginning of each line except the first. -+ Comments may be included on lines beginning with "#". -+ Capabilities in <EM>terminfo</EM> are of three types: -+ -+ <STRONG>o</STRONG> Boolean capabilities which indicate that the terminal -+ has some particular feature, -+ -+ <STRONG>o</STRONG> numeric capabilities giving the size of the terminal -+ or the size of particular delays, and - -+ <STRONG>o</STRONG> string capabilities, which give a sequence which can -+ be used to perform particular terminal operations. - - <STRONG>Types</STRONG> <STRONG>of</STRONG> <STRONG>Capabilities</STRONG> -- All capabilities have names. For instance, the fact that -- ANSI-standard terminals have <EM>automatic</EM> <EM>margins</EM> (i.e., an -- automatic return and line-feed when the end of a line is -- reached) is indicated by the capability <STRONG>am</STRONG>. Hence the -+ All capabilities have names. For instance, the fact that -+ ANSI-standard terminals have <EM>automatic</EM> <EM>margins</EM> (i.e., an -+ automatic return and line-feed when the end of a line is -+ reached) is indicated by the capability <STRONG>am</STRONG>. Hence the - description of ansi includes <STRONG>am</STRONG>. Numeric capabilities are -- followed by the character `#' and then a positive value. -- Thus <STRONG>cols</STRONG>, which indicates the number of columns the ter- -- minal has, gives the value `80' for ansi. Values for -+ followed by the character "#" and then a positive value. -+ Thus <STRONG>cols</STRONG>, which indicates the number of columns the ter- -+ minal has, gives the value "80" for ansi. Values for - numeric capabilities may be specified in decimal, octal or -- hexadecimal, using the C programming language conventions -+ hexadecimal, using the C programming language conventions - (e.g., 255, 0377 and 0xff or 0xFF). - -- Finally, string valued capabilities, such as <STRONG>el</STRONG> (clear to -+ Finally, string valued capabilities, such as <STRONG>el</STRONG> (clear to - end of line sequence) are given by the two-character code, -- an `=', and then a string ending at the next following -- `,'. -+ an "=", and then a string ending at the next following -+ ",". - -- A number of escape sequences are provided in the string -+ A number of escape sequences are provided in the string - valued capabilities for easy encoding of characters there. -- Both <STRONG>\E</STRONG> and <STRONG>\e</STRONG> map to an ESCAPE character, <STRONG>^x</STRONG> maps to a -- control-x for any appropriate x, and the sequences <STRONG>\n</STRONG> <STRONG>\l</STRONG> -- <STRONG>\r</STRONG> <STRONG>\t</STRONG> <STRONG>\b</STRONG> <STRONG>\f</STRONG> <STRONG>\s</STRONG> give a newline, line-feed, return, tab, -- backspace, form-feed, and space. Other escapes include <STRONG>\^</STRONG> -- for <STRONG>^</STRONG>, <STRONG>\\</STRONG> for <STRONG>\</STRONG>, <STRONG>\</STRONG>, for comma, <STRONG>\:</STRONG> for <STRONG>:</STRONG>, and <STRONG>\0</STRONG> for null. -- (<STRONG>\0</STRONG> will produce \200, which does not terminate a string -- but behaves as a null character on most terminals, provid- -- ing CS7 is specified. See <STRONG><A HREF="stty.1.html">stty(1)</A></STRONG>.) Finally, characters -- may be given as three octal digits after a <STRONG>\</STRONG>. -- -- A delay in milliseconds may appear anywhere in a string -- capability, enclosed in $&lt;..&gt; brackets, as in <STRONG>el</STRONG>=\EK$&lt;5&gt;, -- and padding characters are supplied by <EM>tputs</EM> to provide -- this delay. The delay must be a number with at most one -+ Both <STRONG>\E</STRONG> and <STRONG>\e</STRONG> map to an ESCAPE character, <STRONG>^x</STRONG> maps to a -+ control-x for any appropriate x, and the sequences <STRONG>\n</STRONG> <STRONG>\l</STRONG> -+ <STRONG>\r</STRONG> <STRONG>\t</STRONG> <STRONG>\b</STRONG> <STRONG>\f</STRONG> <STRONG>\s</STRONG> give a newline, line-feed, return, tab, -+ backspace, form-feed, and space. Other escapes include -+ -+ <STRONG>o</STRONG> <STRONG>\^</STRONG> for <STRONG>^</STRONG>, -+ -+ <STRONG>o</STRONG> <STRONG>\\</STRONG> for <STRONG>\</STRONG>, -+ -+ <STRONG>o</STRONG> <STRONG>\</STRONG>, for comma, -+ -+ <STRONG>o</STRONG> <STRONG>\:</STRONG> for <STRONG>:</STRONG>, -+ -+ <STRONG>o</STRONG> and <STRONG>\0</STRONG> for null. -+ -+ <STRONG>\0</STRONG> will produce \200, which does not terminate a -+ string but behaves as a null character on most termi- -+ nals, providing CS7 is specified. See <STRONG>stty(1)</STRONG>. -+ -+ The reason for this quirk is to maintain binary com- -+ patibility of the compiled terminfo files with other -+ implementations, e.g., the SVr4 systems, which docu- -+ ment this. Compiled terminfo files use null-termi- -+ nated strings, with no lengths. Modifying this would -+ require a new binary format, which would not work with -+ other implementations. -+ -+ Finally, characters may be given as three octal digits -+ after a <STRONG>\</STRONG>. -+ -+ A delay in milliseconds may appear anywhere in a string -+ capability, enclosed in $&lt;..&gt; brackets, as in <STRONG>el</STRONG>=\EK$&lt;5&gt;, -+ and padding characters are supplied by <EM>tputs</EM> to provide -+ this delay. The delay must be a number with at most one - decimal place of precision; it may be followed by suffixes -- `*' or '/' or both. A `*' indicates that the padding -- required is proportional to the number of lines affected -- by the operation, and the amount given is the per- -- affected-unit padding required. (In the case of insert -+ "*" or "/" or both. A "*" indicates that the padding -+ required is proportional to the number of lines affected -+ by the operation, and the amount given is the per- -+ affected-unit padding required. (In the case of insert - character, the factor is still the number of <EM>lines</EM> -- affected.) Normally, padding is advisory if the device -- has the <STRONG>xon</STRONG> capability; it is used for cost computation -- but does not trigger delays. A `/' suffix indicates that -- the padding is mandatory and forces a delay of the given -- number of milliseconds even on devices for which <STRONG>xon</STRONG> is -+ affected.) Normally, padding is advisory if the device -+ has the <STRONG>xon</STRONG> capability; it is used for cost computation -+ but does not trigger delays. A "/" suffix indicates that -+ the padding is mandatory and forces a delay of the given -+ number of milliseconds even on devices for which <STRONG>xon</STRONG> is - present to indicate flow control. - -- Sometimes individual capabilities must be commented out. -- To do this, put a period before the capability name. For -+ Sometimes individual capabilities must be commented out. -+ To do this, put a period before the capability name. For - example, see the second <STRONG>ind</STRONG> in the example above. - -- - <STRONG>Fetching</STRONG> <STRONG>Compiled</STRONG> <STRONG>Descriptions</STRONG> -- If the environment variable TERMINFO is set, it is inter- -- preted as the pathname of a directory containing the com- -- piled description you are working on. Only that directory -- is searched. -- -- If TERMINFO is not set, the <STRONG>ncurses</STRONG> version of the ter- -- minfo reader code will instead look in the directory -- <STRONG>$HOME/.terminfo</STRONG> for a compiled description. If it fails -- to find one there, and the environment variable TER- -- MINFO_DIRS is set, it will interpret the contents of that -- variable as a list of colon- separated directories to be -- searched (an empty entry is interpreted as a command to -- search <EM>/usr/share/terminfo</EM>). If no description is found -- in any of the TERMINFO_DIRS directories, the fetch fails. -- -- If neither TERMINFO nor TERMINFO_DIRS is set, the last -- place tried will be the system terminfo directory, -- <EM>/usr/share/terminfo</EM>. -- -- (Neither the <STRONG>$HOME/.terminfo</STRONG> lookups nor TERMINFO_DIRS -- extensions are supported under stock System V ter- -- minfo/curses.) -+ The <STRONG>ncurses</STRONG> library searches for terminal descriptions in -+ several places. It uses only the first description found. -+ The library has a compiled-in list of places to search -+ which can be overridden by environment variables. Before -+ starting to search, <STRONG>ncurses</STRONG> eliminates duplicates in its -+ search list. -+ -+ <STRONG>o</STRONG> If the environment variable TERMINFO is set, it is -+ interpreted as the pathname of a directory containing -+ the compiled description you are working on. Only -+ that directory is searched. -+ -+ <STRONG>o</STRONG> If TERMINFO is not set, <STRONG>ncurses</STRONG> will instead look in -+ the directory <STRONG>$HOME/.terminfo</STRONG> for a compiled descrip- -+ tion. -+ -+ <STRONG>o</STRONG> Next, if the environment variable TERMINFO_DIRS is -+ set, <STRONG>ncurses</STRONG> will interpret the contents of that vari- -+ able as a list of colon-separated directories (or -+ database files) to be searched. -+ -+ An empty directory name (i.e., if the variable begins -+ or ends with a colon, or contains adacent colons) is -+ interpreted as the system location <EM>/usr/share/ter-</EM> -+ <EM>minfo</EM>. -+ -+ <STRONG>o</STRONG> Finally, <STRONG>ncurses</STRONG> searches these compiled-in locations: -+ -+ <STRONG>o</STRONG> a list of directories -+ (/usr/local/ncurses/share/terminfo:/usr/share/ter- -+ minfo), and - -+ <STRONG>o</STRONG> the system terminfo directory, <EM>/usr/share/terminfo</EM> -+ (the compiled-in default). - - <STRONG>Preparing</STRONG> <STRONG>Descriptions</STRONG> - We now outline how to prepare descriptions of terminals. -@@ -1147,12 +1235,11 @@ - To get the padding for insert line right (if the terminal - manufacturer did not document it) a severe test is to edit - a large file at 9600 baud, delete 16 or so lines from the -- middle of the screen, then hit the `u' key several times -+ middle of the screen, then hit the "u" key several times - quickly. If the terminal messes up, more padding is usu- - ally needed. A similar test can be used for insert char- - acter. - -- - <STRONG>Basic</STRONG> <STRONG>Capabilities</STRONG> - The number of columns on each line for the terminal is - given by the <STRONG>cols</STRONG> numeric capability. If the terminal is -@@ -1178,7 +1265,7 @@ - as <STRONG>cub1</STRONG>. Similarly, codes to move to the right, up, and - down should be given as <STRONG>cuf1</STRONG>, <STRONG>cuu1</STRONG>, and <STRONG>cud1</STRONG>. These local - cursor motions should not alter the text they pass over, -- for example, you would not normally use `<STRONG>cuf1</STRONG>= ' because -+ for example, you would not normally use "<STRONG>cuf1</STRONG>= " because - the space would erase the character moved over. - - A very important point here is that the local cursor -@@ -1190,137 +1277,135 @@ - left corner of the screen and send the <STRONG>ind</STRONG> (index) string. - - To scroll text down, a program goes to the top left corner -- of the screen and sends the <STRONG>ri</STRONG> (reverse index) string. -- The strings <STRONG>ind</STRONG> and <STRONG>ri</STRONG> are undefined when not on their -+ of the screen and sends the <STRONG>ri</STRONG> (reverse index) string. -+ The strings <STRONG>ind</STRONG> and <STRONG>ri</STRONG> are undefined when not on their - respective corners of the screen. - - Parameterized versions of the scrolling sequences are <STRONG>indn</STRONG> - and <STRONG>rin</STRONG> which have the same semantics as <STRONG>ind</STRONG> and <STRONG>ri</STRONG> except -- that they take one parameter, and scroll that many lines. -- They are also undefined except at the appropriate edge of -+ that they take one parameter, and scroll that many lines. -+ They are also undefined except at the appropriate edge of - the screen. - -- The <STRONG>am</STRONG> capability tells whether the cursor sticks at the -- right edge of the screen when text is output, but this -+ The <STRONG>am</STRONG> capability tells whether the cursor sticks at the -+ right edge of the screen when text is output, but this - does not necessarily apply to a <STRONG>cuf1</STRONG> from the last column. -- The only local motion which is defined from the left edge -- is if <STRONG>bw</STRONG> is given, then a <STRONG>cub1</STRONG> from the left edge will -- move to the right edge of the previous row. If <STRONG>bw</STRONG> is not -- given, the effect is undefined. This is useful for draw- -- ing a box around the edge of the screen, for example. If -- the terminal has switch selectable automatic margins, the -- <EM>terminfo</EM> file usually assumes that this is on; i.e., <STRONG>am</STRONG>. -- If the terminal has a command which moves to the first -- column of the next line, that command can be given as <STRONG>nel</STRONG> -- (newline). It does not matter if the command clears the -- remainder of the current line, so if the terminal has no -- <STRONG>cr</STRONG> and <STRONG>lf</STRONG> it may still be possible to craft a working <STRONG>nel</STRONG> -+ The only local motion which is defined from the left edge -+ is if <STRONG>bw</STRONG> is given, then a <STRONG>cub1</STRONG> from the left edge will -+ move to the right edge of the previous row. If <STRONG>bw</STRONG> is not -+ given, the effect is undefined. This is useful for draw- -+ ing a box around the edge of the screen, for example. If -+ the terminal has switch selectable automatic margins, the -+ <EM>terminfo</EM> file usually assumes that this is on; i.e., <STRONG>am</STRONG>. -+ If the terminal has a command which moves to the first -+ column of the next line, that command can be given as <STRONG>nel</STRONG> -+ (newline). It does not matter if the command clears the -+ remainder of the current line, so if the terminal has no -+ <STRONG>cr</STRONG> and <STRONG>lf</STRONG> it may still be possible to craft a working <STRONG>nel</STRONG> - out of one or both of them. - - These capabilities suffice to describe hard-copy and -- "glass-tty" terminals. Thus the model 33 teletype is -+ "glass-tty" terminals. Thus the model 33 teletype is - described as - - 33|tty33|tty|model 33 teletype, -- bel=^G, cols#72, cr=^M, cud1=^J, hc, ind=^J, os, -+ bel=^G, cols#72, cr=^M, cud1=^J, hc, ind=^J, os, - - while the Lear Siegler ADM-3 is described as - - adm3|3|lsi adm3, -- am, bel=^G, clear=^Z, cols#80, cr=^M, cub1=^H, cud1=^J, -- ind=^J, lines#24, -- -+ am, bel=^G, clear=^Z, cols#80, cr=^M, cub1=^H, cud1=^J, -+ ind=^J, lines#24, - - <STRONG>Parameterized</STRONG> <STRONG>Strings</STRONG> -- Cursor addressing and other strings requiring parameters -- in the terminal are described by a parameterized string -- capability, with <STRONG><A HREF="printf.3.html">printf(3)</A></STRONG> like escapes <STRONG>%x</STRONG> in it. For -- example, to address the cursor, the <STRONG>cup</STRONG> capability is -+ Cursor addressing and other strings requiring parameters -+ in the terminal are described by a parameterized string -+ capability, with <EM>printf</EM>-like escapes such as <EM>%x</EM> in it. -+ For example, to address the cursor, the <STRONG>cup</STRONG> capability is - given, using two parameters: the row and column to address - to. (Rows and columns are numbered from zero and refer to - the physical screen visible to the user, not to any unseen -- memory.) If the terminal has memory relative cursor -+ memory.) If the terminal has memory relative cursor - addressing, that can be indicated by <STRONG>mrcup</STRONG>. - -- The parameter mechanism uses a stack and special <STRONG>%</STRONG> codes -- to manipulate it. Typically a sequence will push one of -- the parameters onto the stack and then print it in some -- format. Print (e.g., "%d") is a special case. Other -- operations, including "%t" pop their operand from the -+ The parameter mechanism uses a stack and special <STRONG>%</STRONG> codes -+ to manipulate it. Typically a sequence will push one of -+ the parameters onto the stack and then print it in some -+ format. Print (e.g., "%d") is a special case. Other -+ operations, including "%t" pop their operand from the - stack. It is noted that more complex operations are often - necessary, e.g., in the <STRONG>sgr</STRONG> string. - - The <STRONG>%</STRONG> encodings have the following meanings: - -+ <STRONG>%%</STRONG> outputs "%" - -- %% outputs `%' -- -- %<EM>[[</EM>:<EM>]flags][width[.precision]][</EM>doxXs<EM>]</EM> -- as in <STRONG>printf</STRONG>, flags are [-+#] and space. Use a `:' -- to allow the next character to be a `-' flag, avoid- -+ <STRONG>%</STRONG><EM>[[</EM>:<EM>]flags][width[.precision]][</EM><STRONG>doxXs</STRONG><EM>]</EM> -+ as in <STRONG>printf</STRONG>, flags are <EM>[-+#]</EM> and <EM>space</EM>. Use a ":" -+ to allow the next character to be a "-" flag, avoid- - ing interpreting "%-" as an operator. - - %c print pop() like %c in <STRONG>printf</STRONG> - -- %s print pop() like %s in <STRONG>printf</STRONG> -+ <STRONG>%s</STRONG> print pop() like %s in <STRONG>printf</STRONG> - -- %p[1-9] -+ <STRONG>%p</STRONG><EM>[1-9]</EM> - push <EM>i</EM>'th parameter - -- %P[a-z] -- set dynamic variable [a-z] to pop() -+ <STRONG>%P</STRONG><EM>[a-z]</EM> -+ set dynamic variable <EM>[a-z]</EM> to pop() - -- %g[a-z] -- get dynamic variable [a-z] and push it -+ <STRONG>%g</STRONG><EM>[a-z]/</EM> -+ get dynamic variable <EM>[a-z]</EM> and push it - -- %P[A-Z] -- set static variable [a-z] to pop() -+ <STRONG>%P</STRONG><EM>[A-Z]</EM> -+ set static variable <EM>[a-z]</EM> to <EM>pop()</EM> - -- %g[A-Z] -- get static variable [a-z] and push it -- -- The terms "static" and "dynamic" are misleading. -- Historically, these are simply two different sets of -- variables, whose values are not reset between calls -- to <STRONG>tparm</STRONG>. However, that fact is not documented in -- other implementations. Relying on it will adversely -+ <STRONG>%g</STRONG><EM>[A-Z]</EM> -+ get static variable <EM>[a-z]</EM> and push it -+ -+ The terms "static" and "dynamic" are misleading. -+ Historically, these are simply two different sets of -+ variables, whose values are not reset between calls -+ to <STRONG>tparm</STRONG>. However, that fact is not documented in -+ other implementations. Relying on it will adversely - impact portability to other implementations. - -- %'<EM>c</EM>' char constant <EM>c</EM> -+ <STRONG>%'</STRONG><EM>c</EM><STRONG>'</STRONG> char constant <EM>c</EM> - -- %{<EM>nn</EM>} -+ <STRONG>%{</STRONG><EM>nn</EM><STRONG>}</STRONG> - integer constant <EM>nn</EM> - -- %l push strlen(pop) -+ <STRONG>%l</STRONG> push strlen(pop) - -- %+ %- %* %/ %m -- arithmetic (%m is mod): push(pop() op pop()) -+ <STRONG>%+</STRONG>, <STRONG>%-</STRONG>, <STRONG>%*</STRONG>, <STRONG>%/</STRONG>, <STRONG>%m</STRONG> -+ arithmetic (%m is mod): <EM>push(pop()</EM> <EM>op</EM> <EM>pop())</EM> - -- %&amp; %| %^ -- bit operations (AND, OR and exclusive-OR): push(pop() -- op pop()) -+ <STRONG>%&amp;</STRONG>, <STRONG>%|</STRONG>, <STRONG>%^</STRONG> -+ bit operations (AND, OR and exclusive-OR): <EM>push(pop()</EM> -+ <EM>op</EM> <EM>pop())</EM> - -- %= %&gt; %&lt; -- logical operations: push(pop() op pop()) -+ <STRONG>%=</STRONG>, <STRONG>%&gt;</STRONG>, <STRONG>%&lt;</STRONG> -+ logical operations: <EM>push(pop()</EM> <EM>op</EM> <EM>pop())</EM> - -- %A, %O -+ <STRONG>%A</STRONG>, <STRONG>%O</STRONG> - logical AND and OR operations (for conditionals) - -- %! %~ -- unary operations (logical and bit complement): -+ <STRONG>%!</STRONG>, <STRONG>%~</STRONG> -+ unary operations (logical and bit complement): - push(op pop()) - -- %i add 1 to first two parameters (for ANSI terminals) -+ <STRONG>%i</STRONG> add 1 to first two parameters (for ANSI terminals) - -- %? <EM>expr</EM> %t <EM>thenpart</EM> %e <EM>elsepart</EM> %; -- This forms an if-then-else. The %e <EM>elsepart</EM> is -- optional. Usually the %? <EM>expr</EM> part pushes a value -- onto the stack, and %t pops it from the stack, test- -- ing if it is nonzero (true). If it is zero (false), -- control passes to the %e (else) part. -+ <STRONG>%?</STRONG> <EM>expr</EM> <STRONG>%t</STRONG> <EM>thenpart</EM> <STRONG>%e</STRONG> <EM>elsepart</EM> <STRONG>%;</STRONG> -+ This forms an if-then-else. The <STRONG>%e</STRONG> <EM>elsepart</EM> is -+ optional. Usually the <STRONG>%?</STRONG> <EM>expr</EM> part pushes a value -+ onto the stack, and <STRONG>%t</STRONG> pops it from the stack, test- -+ ing if it is nonzero (true). If it is zero (false), -+ control passes to the <STRONG>%e</STRONG> (else) part. - - It is possible to form else-if's a la Algol 68: -- %? c1 %t b1 %e c2 %t b2 %e c3 %t b3 %e c4 %t b4 %e %; -+ <STRONG>%?</STRONG> c1 <STRONG>%t</STRONG> b1 <STRONG>%e</STRONG> c2 <STRONG>%t</STRONG> b2 <STRONG>%e</STRONG> c3 <STRONG>%t</STRONG> b3 <STRONG>%e</STRONG> c4 <STRONG>%t</STRONG> b4 <STRONG>%e</STRONG> <STRONG>%;</STRONG> - - where ci are conditions, bi are bodies. - -@@ -1332,7 +1417,7 @@ - - Binary operations are in postfix form with the operands in - the usual order. That is, to get x-5 one would use -- "%gx%{5}%-". %P and %g variables are persistent across -+ "%gx%{5}%-". <STRONG>%P</STRONG> and <STRONG>%g</STRONG> variables are persistent across - escape-string evaluations. - - Consider the HP2645, which, to get to row 3 and column 12, -@@ -1342,241 +1427,238 @@ - its. Thus its <STRONG>cup</STRONG> capability is "cup=6\E&amp;%p2%2dc%p1%2dY". - - The Microterm ACT-IV needs the current row and column sent -- preceded by a <STRONG>^T</STRONG>, with the row and column simply encoded -- in binary, "cup=^T%p1%c%p2%c". Terminals which use "%c" -- need to be able to backspace the cursor (<STRONG>cub1</STRONG>), and to -+ preceded by a <STRONG>^T</STRONG>, with the row and column simply encoded -+ in binary, "cup=^T%p1%c%p2%c". Terminals which use "%c" -+ need to be able to backspace the cursor (<STRONG>cub1</STRONG>), and to - move the cursor up one line on the screen (<STRONG>cuu1</STRONG>). This is -- necessary because it is not always safe to transmit <STRONG>\n</STRONG> <STRONG>^D</STRONG> -- and <STRONG>\r</STRONG>, as the system may change or discard them. (The -- library routines dealing with terminfo set tty modes so -+ necessary because it is not always safe to transmit <STRONG>\n</STRONG> <STRONG>^D</STRONG> -+ and <STRONG>\r</STRONG>, as the system may change or discard them. (The -+ library routines dealing with terminfo set tty modes so - that tabs are never expanded, so \t is safe to send. This - turns out to be essential for the Ann Arbor 4080.) - - A final example is the LSI ADM-3a, which uses row and col- - umn offset by a blank character, thus "cup=\E=%p1%' -- '%+%c%p2%' '%+%c". After sending `\E=', this pushes the -- first parameter, pushes the ASCII value for a space (32), -- adds them (pushing the sum on the stack in place of the -- two previous values) and outputs that value as a charac- -- ter. Then the same is done for the second parameter. -+ '%+%c%p2%' '%+%c". After sending "\E=", this pushes the -+ first parameter, pushes the ASCII value for a space (32), -+ adds them (pushing the sum on the stack in place of the -+ two previous values) and outputs that value as a charac- -+ ter. Then the same is done for the second parameter. - More complex arithmetic is possible using the stack. - -- - <STRONG>Cursor</STRONG> <STRONG>Motions</STRONG> - If the terminal has a fast way to home the cursor (to very -- upper left corner of screen) then this can be given as -- <STRONG>home</STRONG>; similarly a fast way of getting to the lower left- -- hand corner can be given as <STRONG>ll</STRONG>; this may involve going up -- with <STRONG>cuu1</STRONG> from the home position, but a program should -- never do this itself (unless <STRONG>ll</STRONG> does) because it can make -- no assumption about the effect of moving up from the home -- position. Note that the home position is the same as -+ upper left corner of screen) then this can be given as -+ <STRONG>home</STRONG>; similarly a fast way of getting to the lower left- -+ hand corner can be given as <STRONG>ll</STRONG>; this may involve going up -+ with <STRONG>cuu1</STRONG> from the home position, but a program should -+ never do this itself (unless <STRONG>ll</STRONG> does) because it can make -+ no assumption about the effect of moving up from the home -+ position. Note that the home position is the same as - addressing to (0,0): to the top left corner of the screen, -- not of memory. (Thus, the \EH sequence on HP terminals -+ not of memory. (Thus, the \EH sequence on HP terminals - cannot be used for <STRONG>home</STRONG>.) - - If the terminal has row or column absolute cursor address- -- ing, these can be given as single parameter capabilities -+ ing, these can be given as single parameter capabilities - <STRONG>hpa</STRONG> (horizontal position absolute) and <STRONG>vpa</STRONG> (vertical posi- - tion absolute). Sometimes these are shorter than the more -- general two parameter sequence (as with the hp2645) and -- can be used in preference to <STRONG>cup</STRONG>. If there are -- parameterized local motions (e.g., move <EM>n</EM> spaces to the -- right) these can be given as <STRONG>cud</STRONG>, <STRONG>cub</STRONG>, <STRONG>cuf</STRONG>, and <STRONG>cuu</STRONG> with a -- single parameter indicating how many spaces to move. -- These are primarily useful if the terminal does not have -- <STRONG>cup</STRONG>, such as the TEKTRONIX 4025. -+ general two parameter sequence (as with the hp2645) and -+ can be used in preference to <STRONG>cup</STRONG>. If there are parameter- -+ ized local motions (e.g., move <EM>n</EM> spaces to the right) -+ these can be given as <STRONG>cud</STRONG>, <STRONG>cub</STRONG>, <STRONG>cuf</STRONG>, and <STRONG>cuu</STRONG> with a single -+ parameter indicating how many spaces to move. These are -+ primarily useful if the terminal does not have <STRONG>cup</STRONG>, such -+ as the TEKTRONIX 4025. - - If the terminal needs to be in a special mode when running - a program that uses these capabilities, the codes to enter -- and exit this mode can be given as <STRONG>smcup</STRONG> and <STRONG>rmcup</STRONG>. This -- arises, for example, from terminals like the Concept with -- more than one page of memory. If the terminal has only -- memory relative cursor addressing and not screen relative -+ and exit this mode can be given as <STRONG>smcup</STRONG> and <STRONG>rmcup</STRONG>. This -+ arises, for example, from terminals like the Concept with -+ more than one page of memory. If the terminal has only -+ memory relative cursor addressing and not screen relative - cursor addressing, a one screen-sized window must be fixed -- into the terminal for cursor addressing to work properly. -+ into the terminal for cursor addressing to work properly. - This is also used for the TEKTRONIX 4025, where <STRONG>smcup</STRONG> sets -- the command character to be the one used by terminfo. If -- the <STRONG>smcup</STRONG> sequence will not restore the screen after an -+ the command character to be the one used by terminfo. If -+ the <STRONG>smcup</STRONG> sequence will not restore the screen after an - <STRONG>rmcup</STRONG> sequence is output (to the state prior to outputting - <STRONG>rmcup</STRONG>), specify <STRONG>nrrmc</STRONG>. - -- - <STRONG>Area</STRONG> <STRONG>Clears</STRONG> - If the terminal can clear from the current position to the -- end of the line, leaving the cursor where it is, this -+ end of the line, leaving the cursor where it is, this - should be given as <STRONG>el</STRONG>. If the terminal can clear from the -- beginning of the line to the current position inclusive, -- leaving the cursor where it is, this should be given as -- <STRONG>el1</STRONG>. If the terminal can clear from the current position -- to the end of the display, then this should be given as -- <STRONG>ed</STRONG>. <STRONG>Ed</STRONG> is only defined from the first column of a line. -- (Thus, it can be simulated by a request to delete a large -+ beginning of the line to the current position inclusive, -+ leaving the cursor where it is, this should be given as -+ <STRONG>el1</STRONG>. If the terminal can clear from the current position -+ to the end of the display, then this should be given as -+ <STRONG>ed</STRONG>. <STRONG>Ed</STRONG> is only defined from the first column of a line. -+ (Thus, it can be simulated by a request to delete a large - number of lines, if a true <STRONG>ed</STRONG> is not available.) - -- - <STRONG>Insert/delete</STRONG> <STRONG>line</STRONG> <STRONG>and</STRONG> <STRONG>vertical</STRONG> <STRONG>motions</STRONG> -- If the terminal can open a new blank line before the line -- where the cursor is, this should be given as <STRONG>il1</STRONG>; this is -- done only from the first position of a line. The cursor -+ If the terminal can open a new blank line before the line -+ where the cursor is, this should be given as <STRONG>il1</STRONG>; this is -+ done only from the first position of a line. The cursor - must then appear on the newly blank line. If the terminal -- can delete the line which the cursor is on, then this -- should be given as <STRONG>dl1</STRONG>; this is done only from the first -- position on the line to be deleted. Versions of <STRONG>il1</STRONG> and -- <STRONG>dl1</STRONG> which take a single parameter and insert or delete -+ can delete the line which the cursor is on, then this -+ should be given as <STRONG>dl1</STRONG>; this is done only from the first -+ position on the line to be deleted. Versions of <STRONG>il1</STRONG> and -+ <STRONG>dl1</STRONG> which take a single parameter and insert or delete - that many lines can be given as <STRONG>il</STRONG> and <STRONG>dl</STRONG>. - -- If the terminal has a settable scrolling region (like the -- vt100) the command to set this can be described with the -- <STRONG>csr</STRONG> capability, which takes two parameters: the top and -+ If the terminal has a settable scrolling region (like the -+ vt100) the command to set this can be described with the -+ <STRONG>csr</STRONG> capability, which takes two parameters: the top and - bottom lines of the scrolling region. The cursor position - is, alas, undefined after using this command. - -- It is possible to get the effect of insert or delete line -+ It is possible to get the effect of insert or delete line - using <STRONG>csr</STRONG> on a properly chosen region; the <STRONG>sc</STRONG> and <STRONG>rc</STRONG> (save -- and restore cursor) commands may be useful for ensuring -- that your synthesized insert/delete string does not move -- the cursor. (Note that the <STRONG><A HREF="ncurses.3x.html">ncurses(3x)</A></STRONG> library does this -- synthesis automatically, so you need not compose -+ and restore cursor) commands may be useful for ensuring -+ that your synthesized insert/delete string does not move -+ the cursor. (Note that the <STRONG><A HREF="ncurses.3x.html">ncurses(3x)</A></STRONG> library does this -+ synthesis automatically, so you need not compose - insert/delete strings for an entry with <STRONG>csr</STRONG>). - - Yet another way to construct insert and delete might be to -- use a combination of index with the memory-lock feature -- found on some terminals (like the HP-700/90 series, which -+ use a combination of index with the memory-lock feature -+ found on some terminals (like the HP-700/90 series, which - however also has insert/delete). - -- Inserting lines at the top or bottom of the screen can -- also be done using <STRONG>ri</STRONG> or <STRONG>ind</STRONG> on many terminals without a -- true insert/delete line, and is often faster even on ter- -+ Inserting lines at the top or bottom of the screen can -+ also be done using <STRONG>ri</STRONG> or <STRONG>ind</STRONG> on many terminals without a -+ true insert/delete line, and is often faster even on ter- - minals with those features. - -- The boolean <STRONG>non_dest_scroll_region</STRONG> should be set if each -- scrolling window is effectively a view port on a screen- -- sized canvas. To test for this capability, create a -- scrolling region in the middle of the screen, write some- -- thing to the bottom line, move the cursor to the top of -+ The boolean <STRONG>non_dest_scroll_region</STRONG> should be set if each -+ scrolling window is effectively a view port on a screen- -+ sized canvas. To test for this capability, create a -+ scrolling region in the middle of the screen, write some- -+ thing to the bottom line, move the cursor to the top of - the region, and do <STRONG>ri</STRONG> followed by <STRONG>dl1</STRONG> or <STRONG>ind</STRONG>. If the data -- scrolled off the bottom of the region by the <STRONG>ri</STRONG> re- -- appears, then scrolling is non-destructive. System V and -- XSI Curses expect that <STRONG>ind</STRONG>, <STRONG>ri</STRONG>, <STRONG>indn</STRONG>, and <STRONG>rin</STRONG> will simu- -- late destructive scrolling; their documentation cautions -- you not to define <STRONG>csr</STRONG> unless this is true. This <STRONG>curses</STRONG> -+ scrolled off the bottom of the region by the <STRONG>ri</STRONG> re- -+ appears, then scrolling is non-destructive. System V and -+ XSI Curses expect that <STRONG>ind</STRONG>, <STRONG>ri</STRONG>, <STRONG>indn</STRONG>, and <STRONG>rin</STRONG> will simu- -+ late destructive scrolling; their documentation cautions -+ you not to define <STRONG>csr</STRONG> unless this is true. This <STRONG>curses</STRONG> - implementation is more liberal and will do explicit erases - after scrolling if <STRONG>ndstr</STRONG> is defined. - - If the terminal has the ability to define a window as part -- of memory, which all commands affect, it should be given -+ of memory, which all commands affect, it should be given - as the parameterized string <STRONG>wind</STRONG>. The four parameters are -- the starting and ending lines in memory and the starting -+ the starting and ending lines in memory and the starting - and ending columns in memory, in that order. - -- If the terminal can retain display memory above, then the -- <STRONG>da</STRONG> capability should be given; if display memory can be -- retained below, then <STRONG>db</STRONG> should be given. These indicate -- that deleting a line or scrolling may bring non-blank -- lines up from below or that scrolling back with <STRONG>ri</STRONG> may -+ If the terminal can retain display memory above, then the -+ <STRONG>da</STRONG> capability should be given; if display memory can be -+ retained below, then <STRONG>db</STRONG> should be given. These indicate -+ that deleting a line or scrolling may bring non-blank -+ lines up from below or that scrolling back with <STRONG>ri</STRONG> may - bring down non-blank lines. - -- - <STRONG>Insert/Delete</STRONG> <STRONG>Character</STRONG> -- There are two basic kinds of intelligent terminals with -- respect to insert/delete character which can be described -- using <EM>terminfo.</EM> The most common insert/delete character -- operations affect only the characters on the current line -- and shift characters off the end of the line rigidly. -- Other terminals, such as the Concept 100 and the Perkin -- Elmer Owl, make a distinction between typed and untyped -- blanks on the screen, shifting upon an insert or delete -- only to an untyped blank on the screen which is either -- eliminated, or expanded to two untyped blanks. You can -- determine the kind of terminal you have by clearing the -- screen and then typing text separated by cursor motions. -- Type "abc def" using local cursor motions (not spaces) -- between the "abc" and the "def". Then position the cursor -- before the "abc" and put the terminal in insert mode. If -- typing characters causes the rest of the line to shift -- rigidly and characters to fall off the end, then your ter- -- minal does not distinguish between blanks and untyped -- positions. If the "abc" shifts over to the "def" which -- then move together around the end of the current line and -- onto the next as you insert, you have the second type of -- terminal, and should give the capability <STRONG>in</STRONG>, which stands -- for "insert null". While these are two logically separate -- attributes (one line versus multi-line insert mode, and -- special treatment of untyped spaces) we have seen no ter- -- minals whose insert mode cannot be described with the sin- -- gle attribute. -+ There are two basic kinds of intelligent terminals with -+ respect to insert/delete character which can be described -+ using <EM>terminfo.</EM> The most common insert/delete character -+ operations affect only the characters on the current line -+ and shift characters off the end of the line rigidly. -+ Other terminals, such as the Concept 100 and the Perkin -+ Elmer Owl, make a distinction between typed and untyped -+ blanks on the screen, shifting upon an insert or delete -+ only to an untyped blank on the screen which is either -+ eliminated, or expanded to two untyped blanks. -+ -+ You can determine the kind of terminal you have by clear- -+ ing the screen and then typing text separated by cursor -+ motions. Type "abc def" using local cursor motions -+ (not spaces) between the "abc" and the "def". Then posi- -+ tion the cursor before the "abc" and put the terminal in -+ insert mode. If typing characters causes the rest of the -+ line to shift rigidly and characters to fall off the end, -+ then your terminal does not distinguish between blanks and -+ untyped positions. If the "abc" shifts over to the "def" -+ which then move together around the end of the current -+ line and onto the next as you insert, you have the second -+ type of terminal, and should give the capability <STRONG>in</STRONG>, which -+ stands for "insert null". -+ -+ While these are two logically separate attributes (one -+ line versus multi-line insert mode, and special treatment -+ of untyped spaces) we have seen no terminals whose insert -+ mode cannot be described with the single attribute. - -- Terminfo can describe both terminals which have an insert -+ Terminfo can describe both terminals which have an insert - mode, and terminals which send a simple sequence to open a -- blank position on the current line. Give as <STRONG>smir</STRONG> the -- sequence to get into insert mode. Give as <STRONG>rmir</STRONG> the -- sequence to leave insert mode. Now give as <STRONG>ich1</STRONG> any -- sequence needed to be sent just before sending the -- character to be inserted. Most terminals with a true -- insert mode will not give <STRONG>ich1</STRONG>; terminals which send a -- sequence to open a screen position should give it here. -- -- If your terminal has both, insert mode is usually prefer- -- able to <STRONG>ich1</STRONG>. Technically, you should not give both -- unless the terminal actually requires both to be used in -- combination. Accordingly, some non-curses applications -- get confused if both are present; the symptom is doubled -+ blank position on the current line. Give as <STRONG>smir</STRONG> the -+ sequence to get into insert mode. Give as <STRONG>rmir</STRONG> the -+ sequence to leave insert mode. Now give as <STRONG>ich1</STRONG> any -+ sequence needed to be sent just before sending the charac- -+ ter to be inserted. Most terminals with a true insert -+ mode will not give <STRONG>ich1</STRONG>; terminals which send a sequence -+ to open a screen position should give it here. -+ -+ If your terminal has both, insert mode is usually prefer- -+ able to <STRONG>ich1</STRONG>. Technically, you should not give both -+ unless the terminal actually requires both to be used in -+ combination. Accordingly, some non-curses applications -+ get confused if both are present; the symptom is doubled - characters in an update using insert. This requirement is - now rare; most <STRONG>ich</STRONG> sequences do not require previous smir, - and most smir insert modes do not require <STRONG>ich1</STRONG> before each -- character. Therefore, the new <STRONG>curses</STRONG> actually assumes -- this is the case and uses either <STRONG>rmir</STRONG>/<STRONG>smir</STRONG> or <STRONG>ich</STRONG>/<STRONG>ich1</STRONG> as -+ character. Therefore, the new <STRONG>curses</STRONG> actually assumes -+ this is the case and uses either <STRONG>rmir</STRONG>/<STRONG>smir</STRONG> or <STRONG>ich</STRONG>/<STRONG>ich1</STRONG> as - appropriate (but not both). If you have to write an entry -- to be used under new curses for a terminal old enough to -+ to be used under new curses for a terminal old enough to - need both, include the <STRONG>rmir</STRONG>/<STRONG>smir</STRONG> sequences in <STRONG>ich1</STRONG>. - - If post insert padding is needed, give this as a number of -- milliseconds in <STRONG>ip</STRONG> (a string option). Any other sequence -- which may need to be sent after an insert of a single -+ milliseconds in <STRONG>ip</STRONG> (a string option). Any other sequence -+ which may need to be sent after an insert of a single - character may also be given in <STRONG>ip</STRONG>. If your terminal needs -- both to be placed into an `insert mode' and a special code -- to precede each inserted character, then both <STRONG>smir</STRONG>/<STRONG>rmir</STRONG> -- and <STRONG>ich1</STRONG> can be given, and both will be used. The <STRONG>ich</STRONG> -+ both to be placed into an "insert mode" and a special code -+ to precede each inserted character, then both <STRONG>smir</STRONG>/<STRONG>rmir</STRONG> -+ and <STRONG>ich1</STRONG> can be given, and both will be used. The <STRONG>ich</STRONG> - capability, with one parameter, <EM>n</EM>, will repeat the effects - of <STRONG>ich1</STRONG> <EM>n</EM> times. - - If padding is necessary between characters typed while not -- in insert mode, give this as a number of milliseconds -- padding in <STRONG>rmp</STRONG>. -+ in insert mode, give this as a number of milliseconds pad- -+ ding in <STRONG>rmp</STRONG>. - -- It is occasionally necessary to move around while in -- insert mode to delete characters on the same line (e.g., -- if there is a tab after the insertion position). If your -- terminal allows motion while in insert mode you can give -- the capability <STRONG>mir</STRONG> to speed up inserting in this case. -- Omitting <STRONG>mir</STRONG> will affect only speed. Some terminals -+ It is occasionally necessary to move around while in -+ insert mode to delete characters on the same line (e.g., -+ if there is a tab after the insertion position). If your -+ terminal allows motion while in insert mode you can give -+ the capability <STRONG>mir</STRONG> to speed up inserting in this case. -+ Omitting <STRONG>mir</STRONG> will affect only speed. Some terminals - (notably Datamedia's) must not have <STRONG>mir</STRONG> because of the way - their insert mode works. - -- Finally, you can specify <STRONG>dch1</STRONG> to delete a single charac- -- ter, <STRONG>dch</STRONG> with one parameter, <EM>n</EM>, to delete <EM>n</EM> <EM>characters,</EM> -- and delete mode by giving <STRONG>smdc</STRONG> and <STRONG>rmdc</STRONG> to enter and exit -- delete mode (any mode the terminal needs to be placed in -+ Finally, you can specify <STRONG>dch1</STRONG> to delete a single charac- -+ ter, <STRONG>dch</STRONG> with one parameter, <EM>n</EM>, to delete <EM>n</EM> <EM>characters,</EM> -+ and delete mode by giving <STRONG>smdc</STRONG> and <STRONG>rmdc</STRONG> to enter and exit -+ delete mode (any mode the terminal needs to be placed in - for <STRONG>dch1</STRONG> to work). - -- A command to erase <EM>n</EM> characters (equivalent to outputting -- <EM>n</EM> blanks without moving the cursor) can be given as <STRONG>ech</STRONG> -+ A command to erase <EM>n</EM> characters (equivalent to outputting -+ <EM>n</EM> blanks without moving the cursor) can be given as <STRONG>ech</STRONG> - with one parameter. - -- - <STRONG>Highlighting,</STRONG> <STRONG>Underlining,</STRONG> <STRONG>and</STRONG> <STRONG>Visible</STRONG> <STRONG>Bells</STRONG> - If your terminal has one or more kinds of display -- attributes, these can be represented in a number of dif- -+ attributes, these can be represented in a number of dif- - ferent ways. You should choose one display form as <EM>stand-</EM> - <EM>out</EM> <EM>mode</EM>, representing a good, high contrast, easy-on-the- -- eyes, format for highlighting error messages and other -- attention getters. (If you have a choice, reverse video -- plus half-bright is good, or reverse video alone.) The -- sequences to enter and exit standout mode are given as -- <STRONG>smso</STRONG> and <STRONG>rmso</STRONG>, respectively. If the code to change into -- or out of standout mode leaves one or even two blank -- spaces on the screen, as the TVI 912 and Teleray 1061 do, -+ eyes, format for highlighting error messages and other -+ attention getters. (If you have a choice, reverse video -+ plus half-bright is good, or reverse video alone.) The -+ sequences to enter and exit standout mode are given as -+ <STRONG>smso</STRONG> and <STRONG>rmso</STRONG>, respectively. If the code to change into -+ or out of standout mode leaves one or even two blank spa- -+ ces on the screen, as the TVI 912 and Teleray 1061 do, - then <STRONG>xmc</STRONG> should be given to tell how many spaces are left. - - Codes to begin underlining and end underlining can be -@@ -1605,19 +1687,18 @@ - - For example, the DEC vt220 supports most of the modes: - -+ <STRONG>tparm</STRONG> <STRONG>parameter</STRONG> <STRONG>attribute</STRONG> <STRONG>escape</STRONG> <STRONG>sequence</STRONG> - -- <STRONG>tparm</STRONG> <STRONG>parameter</STRONG> <STRONG>attribute</STRONG> <STRONG>escape</STRONG> <STRONG>sequence</STRONG> -- -- none none \E[0m -- p1 standout \E[0;1;7m -- p2 underline \E[0;4m -- p3 reverse \E[0;7m -- p4 blink \E[0;5m -- p5 dim not available -- p6 bold \E[0;1m -- p7 invis \E[0;8m -- p8 protect not used -- p9 altcharset ^O (off) ^N (on) -+ none none \E[0m -+ p1 standout \E[0;1;7m -+ p2 underline \E[0;4m -+ p3 reverse \E[0;7m -+ p4 blink \E[0;5m -+ p5 dim not available -+ p6 bold \E[0;1m -+ p7 invis \E[0;8m -+ p8 protect not used -+ p9 altcharset ^O (off) ^N (on) - - We begin each escape sequence by turning off any existing - modes, since there is no quick way to determine whether -@@ -1637,23 +1718,21 @@ - Writing out the above sequences, along with their depen- - dencies yields - -+ <STRONG>sequence</STRONG> <STRONG>when</STRONG> <STRONG>to</STRONG> <STRONG>output</STRONG> <STRONG>terminfo</STRONG> <STRONG>translation</STRONG> - -- <STRONG>sequence</STRONG> <STRONG>when</STRONG> <STRONG>to</STRONG> <STRONG>output</STRONG> <STRONG>terminfo</STRONG> <STRONG>translation</STRONG> -- -- \E[0 always \E[0 -- ;1 if p1 or p6 %?%p1%p6%|%t;1%; -- ;4 if p2 %?%p2%|%t;4%; -- ;5 if p4 %?%p4%|%t;5%; -- -- ;7 if p1 or p3 %?%p1%p3%|%t;7%; -- ;8 if p7 %?%p7%|%t;8%; -- m always m -- ^N or ^O if p9 ^N, else ^O %?%p9%t^N%e^O%; -+ \E[0 always \E[0 -+ ;1 if p1 or p6 %?%p1%p6%|%t;1%; -+ ;4 if p2 %?%p2%|%t;4%; -+ ;5 if p4 %?%p4%|%t;5%; -+ ;7 if p1 or p3 %?%p1%p3%|%t;7%; -+ ;8 if p7 %?%p7%|%t;8%; -+ m always m -+ ^N or ^O if p9 ^N, else ^O %?%p9%t^N%e^O%; - - Putting this all together into the sgr sequence gives: - -- sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%; -- %?%p4%t;5%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, -+ sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p4%t;5%; -+ %?%p1%p3%|%t;7%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, - - Remember that if you specify sgr, you must also specify - sgr0. Also, some implementations rely on sgr being given -@@ -1664,8 +1743,8 @@ - assumes that sgr0 does not exit alternate character set - mode. - -- Terminals with the ``magic cookie'' glitch (<STRONG>xmc</STRONG>) deposit -- special ``cookies'' when they receive mode-setting -+ Terminals with the "magic cookie" glitch (<STRONG>xmc</STRONG>) deposit -+ special "cookies" when they receive mode-setting - sequences, which affect the display algorithm rather than - having extra bits for each character. Some terminals, - such as the HP 2621, automatically leave standout mode -@@ -1695,7 +1774,6 @@ - erasable with a blank, then this should be indicated by - giving <STRONG>eo</STRONG>. - -- - <STRONG>Keypad</STRONG> <STRONG>and</STRONG> <STRONG>Function</STRONG> <STRONG>Keys</STRONG> - If the terminal has a keypad that transmits codes when the - keys are pressed, this information can be given. Note -@@ -1704,27 +1782,57 @@ - unshifted HP 2621 keys). If the keypad can be set to - transmit or not transmit, give these codes as <STRONG>smkx</STRONG> and - <STRONG>rmkx</STRONG>. Otherwise the keypad is assumed to always transmit. -- The codes sent by the left arrow, right arrow, up arrow, -- down arrow, and home keys can be given as <STRONG>kcub1,</STRONG> <STRONG>kcuf1,</STRONG> -- <STRONG>kcuu1,</STRONG> <STRONG>kcud1,</STRONG> and <STRONG>khome</STRONG> respectively. If there are func- -- tion keys such as f0, f1, ..., f10, the codes they send -- can be given as <STRONG>kf0,</STRONG> <STRONG>kf1,</STRONG> <STRONG>...,</STRONG> <STRONG>kf10</STRONG>. If these keys have -- labels other than the default f0 through f10, the labels -- can be given as <STRONG>lf0,</STRONG> <STRONG>lf1,</STRONG> <STRONG>...,</STRONG> <STRONG>lf10</STRONG>. The codes -- transmitted by certain other special keys can be given: -- <STRONG>kll</STRONG> (home down), <STRONG>kbs</STRONG> (backspace), <STRONG>ktbc</STRONG> (clear all tabs), -- <STRONG>kctab</STRONG> (clear the tab stop in this column), <STRONG>kclr</STRONG> (clear -- screen or erase key), <STRONG>kdch1</STRONG> (delete character), <STRONG>kdl1</STRONG> -- (delete line), <STRONG>krmir</STRONG> (exit insert mode), <STRONG>kel</STRONG> (clear to end -- of line), <STRONG>ked</STRONG> (clear to end of screen), <STRONG>kich1</STRONG> (insert -- character or enter insert mode), <STRONG>kil1</STRONG> (insert line), <STRONG>knp</STRONG> -- (next page), <STRONG>kpp</STRONG> (previous page), <STRONG>kind</STRONG> (scroll for- -- ward/down), <STRONG>kri</STRONG> (scroll backward/up), <STRONG>khts</STRONG> (set a tab stop -- in this column). In addition, if the keypad has a 3 by 3 -- array of keys including the four arrow keys, the other -- five keys can be given as <STRONG>ka1</STRONG>, <STRONG>ka3</STRONG>, <STRONG>kb2</STRONG>, <STRONG>kc1</STRONG>, and <STRONG>kc3</STRONG>. -- These keys are useful when the effects of a 3 by 3 direc- -- tional pad are needed. -+ -+ The codes sent by the left arrow, right arrow, up arrow, -+ down arrow, and home keys can be given as <STRONG>kcub1,</STRONG> <STRONG>kcuf1,</STRONG> -+ <STRONG>kcuu1,</STRONG> <STRONG>kcud1,</STRONG> and <STRONG>khome</STRONG> respectively. If there are func- -+ tion keys such as f0, f1, ..., f10, the codes they send -+ can be given as <STRONG>kf0,</STRONG> <STRONG>kf1,</STRONG> <STRONG>...,</STRONG> <STRONG>kf10</STRONG>. If these keys have -+ labels other than the default f0 through f10, the labels -+ can be given as <STRONG>lf0,</STRONG> <STRONG>lf1,</STRONG> <STRONG>...,</STRONG> <STRONG>lf10</STRONG>. -+ -+ The codes transmitted by certain other special keys can be -+ given: -+ -+ <STRONG>o</STRONG> <STRONG>kll</STRONG> (home down), -+ -+ <STRONG>o</STRONG> <STRONG>kbs</STRONG> (backspace), -+ -+ <STRONG>o</STRONG> <STRONG>ktbc</STRONG> (clear all tabs), -+ -+ <STRONG>o</STRONG> <STRONG>kctab</STRONG> (clear the tab stop in this column), -+ -+ <STRONG>o</STRONG> <STRONG>kclr</STRONG> (clear screen or erase key), -+ -+ <STRONG>o</STRONG> <STRONG>kdch1</STRONG> (delete character), -+ -+ <STRONG>o</STRONG> <STRONG>kdl1</STRONG> (delete line), -+ -+ <STRONG>o</STRONG> <STRONG>krmir</STRONG> (exit insert mode), -+ -+ <STRONG>o</STRONG> <STRONG>kel</STRONG> (clear to end of line), -+ -+ <STRONG>o</STRONG> <STRONG>ked</STRONG> (clear to end of screen), -+ -+ <STRONG>o</STRONG> <STRONG>kich1</STRONG> (insert character or enter insert mode), -+ -+ <STRONG>o</STRONG> <STRONG>kil1</STRONG> (insert line), -+ -+ <STRONG>o</STRONG> <STRONG>knp</STRONG> (next page), -+ -+ <STRONG>o</STRONG> <STRONG>kpp</STRONG> (previous page), -+ -+ <STRONG>o</STRONG> <STRONG>kind</STRONG> (scroll forward/down), -+ -+ <STRONG>o</STRONG> <STRONG>kri</STRONG> (scroll backward/up), -+ -+ <STRONG>o</STRONG> <STRONG>khts</STRONG> (set a tab stop in this column). -+ -+ In addition, if the keypad has a 3 by 3 array of keys -+ including the four arrow keys, the other five keys can be -+ given as <STRONG>ka1</STRONG>, <STRONG>ka3</STRONG>, <STRONG>kb2</STRONG>, <STRONG>kc1</STRONG>, and <STRONG>kc3</STRONG>. These keys are use- -+ ful when the effects of a 3 by 3 directional pad are -+ needed. - - Strings to program function keys can be given as <STRONG>pfkey</STRONG>, - <STRONG>pfloc</STRONG>, and <STRONG>pfx</STRONG>. A string to program screen labels should -@@ -1746,12 +1854,11 @@ - or more pln sequences to make sure that the change becomes - visible. - -- - <STRONG>Tabs</STRONG> <STRONG>and</STRONG> <STRONG>Initialization</STRONG> - If the terminal has hardware tabs, the command to advance - to the next tab stop can be given as <STRONG>ht</STRONG> (usually control -- I). A ``back-tab'' command which moves leftward to the -- preceding tab stop can be given as <STRONG>cbt</STRONG>. By convention, if -+ I). A "back-tab" command which moves leftward to the pre- -+ ceding tab stop can be given as <STRONG>cbt</STRONG>. By convention, if - the teletype modes indicate that tabs are being expanded - by the computer rather than being sent to the terminal, - programs should not use <STRONG>ht</STRONG> or <STRONG>cbt</STRONG> even if they are -@@ -1851,9 +1958,8 @@ - ter as a pad, then this can be given as <STRONG>pad</STRONG>. Only the - first character of the <STRONG>pad</STRONG> string is used. - -- - <STRONG>Status</STRONG> <STRONG>Lines</STRONG> -- Some terminals have an extra `status line' which is not -+ Some terminals have an extra "status line" which is not - normally used by software (and thus not counted in the - terminal's <STRONG>lines</STRONG> capability). - -@@ -1883,110 +1989,105 @@ - The boolean capability <STRONG>eslok</STRONG> specifies that escape - sequences, tabs, etc., work ordinarily in the status line. - -- The <STRONG>ncurses</STRONG> implementation does not yet use any of these -- capabilities. They are documented here in case they ever -+ The <STRONG>ncurses</STRONG> implementation does not yet use any of these -+ capabilities. They are documented here in case they ever - become important. - -- - <STRONG>Line</STRONG> <STRONG>Graphics</STRONG> -- Many terminals have alternate character sets useful for -- forms-drawing. Terminfo and <STRONG>curses</STRONG> build in support for -- the drawing characters supported by the VT100, with some -- characters from the AT&amp;T 4410v1 added. This alternate -+ Many terminals have alternate character sets useful for -+ forms-drawing. Terminfo and <STRONG>curses</STRONG> build in support for -+ the drawing characters supported by the VT100, with some -+ characters from the AT&amp;T 4410v1 added. This alternate - character set may be specified by the <STRONG>acsc</STRONG> capability. - -- -- <STRONG>Glyph</STRONG> <STRONG>ACS</STRONG> <STRONG>Ascii</STRONG> <STRONG>VT100</STRONG> -- <STRONG>Name</STRONG> <STRONG>Name</STRONG> <STRONG>Default</STRONG> <STRONG>Name</STRONG> -- UK pound sign ACS_STERLING f } -- arrow pointing down ACS_DARROW v . -- arrow pointing left ACS_LARROW &lt; , -- arrow pointing right ACS_RARROW &gt; + -- arrow pointing up ACS_UARROW ^ - -- board of squares ACS_BOARD # h -- bullet ACS_BULLET o ~ -- checker board (stipple) ACS_CKBOARD : a -- degree symbol ACS_DEGREE \ f -- diamond ACS_DIAMOND + ` -- greater-than-or-equal-to ACS_GEQUAL &gt; z -- greek pi ACS_PI * { -- horizontal line ACS_HLINE - q -- lantern symbol ACS_LANTERN # i -- large plus or crossover ACS_PLUS + n -- less-than-or-equal-to ACS_LEQUAL &lt; y -- -- lower left corner ACS_LLCORNER + m -- lower right corner ACS_LRCORNER + j -- not-equal ACS_NEQUAL ! | -- plus/minus ACS_PLMINUS # g -- scan line 1 ACS_S1 ~ o -- scan line 3 ACS_S3 - p -- scan line 7 ACS_S7 - r -- scan line 9 ACS_S9 _ s -- solid square block ACS_BLOCK # 0 -- tee pointing down ACS_TTEE + w -- tee pointing left ACS_RTEE + u -- tee pointing right ACS_LTEE + t -- tee pointing up ACS_BTEE + v -- upper left corner ACS_ULCORNER + l -- upper right corner ACS_URCORNER + k -- vertical line ACS_VLINE | x -- -- The best way to define a new device's graphics set is to -- add a column to a copy of this table for your terminal, -- giving the character which (when emitted between -- <STRONG>smacs</STRONG>/<STRONG>rmacs</STRONG> switches) will be rendered as the correspond- -- ing graphic. Then read off the VT100/your terminal char- -- acter pairs right to left in sequence; these become the -+ <STRONG>Glyph</STRONG> <STRONG>ACS</STRONG> <STRONG>Ascii</STRONG> <STRONG>VT100</STRONG> -+ <STRONG>Name</STRONG> <STRONG>Name</STRONG> <STRONG>Default</STRONG> <STRONG>Name</STRONG> -+ UK pound sign ACS_STERLING f } -+ arrow pointing down ACS_DARROW v . -+ arrow pointing left ACS_LARROW &lt; , -+ arrow pointing right ACS_RARROW &gt; + -+ arrow pointing up ACS_UARROW ^ - -+ board of squares ACS_BOARD # h -+ bullet ACS_BULLET o ~ -+ checker board (stipple) ACS_CKBOARD : a -+ degree symbol ACS_DEGREE \ f -+ diamond ACS_DIAMOND + ` -+ greater-than-or-equal-to ACS_GEQUAL &gt; z -+ greek pi ACS_PI * { -+ horizontal line ACS_HLINE - q -+ lantern symbol ACS_LANTERN # i -+ large plus or crossover ACS_PLUS + n -+ less-than-or-equal-to ACS_LEQUAL &lt; y -+ lower left corner ACS_LLCORNER + m -+ lower right corner ACS_LRCORNER + j -+ not-equal ACS_NEQUAL ! | -+ plus/minus ACS_PLMINUS # g -+ scan line 1 ACS_S1 ~ o -+ scan line 3 ACS_S3 - p -+ scan line 7 ACS_S7 - r -+ scan line 9 ACS_S9 _ s -+ solid square block ACS_BLOCK # 0 -+ tee pointing down ACS_TTEE + w -+ tee pointing left ACS_RTEE + u -+ tee pointing right ACS_LTEE + t -+ tee pointing up ACS_BTEE + v -+ upper left corner ACS_ULCORNER + l -+ upper right corner ACS_URCORNER + k -+ vertical line ACS_VLINE | x -+ -+ The best way to define a new device's graphics set is to -+ add a column to a copy of this table for your terminal, -+ giving the character which (when emitted between -+ <STRONG>smacs</STRONG>/<STRONG>rmacs</STRONG> switches) will be rendered as the correspond- -+ ing graphic. Then read off the VT100/your terminal char- -+ acter pairs right to left in sequence; these become the - ACSC string. - -- - <STRONG>Color</STRONG> <STRONG>Handling</STRONG> -- Most color terminals are either `Tektronix-like' or `HP- -- like'. Tektronix-like terminals have a predefined set of -- N colors (where N usually 8), and can set character-cell -+ Most color terminals are either "Tektronix-like" or "HP- -+ like". Tektronix-like terminals have a predefined set of -+ N colors (where N usually 8), and can set character-cell - foreground and background characters independently, mixing -- them into N * N color-pairs. On HP-like terminals, the -+ them into N * N color-pairs. On HP-like terminals, the - use must set each color pair up separately (foreground and -- background are not independently settable). Up to M -- color-pairs may be set up from 2*M different colors. -+ background are not independently settable). Up to M -+ color-pairs may be set up from 2*M different colors. - ANSI-compatible terminals are Tektronix-like. - - Some basic color capabilities are independent of the color - method. The numeric capabilities <STRONG>colors</STRONG> and <STRONG>pairs</STRONG> specify -- the maximum numbers of colors and color-pairs that can be -- displayed simultaneously. The <STRONG>op</STRONG> (original pair) string -- resets foreground and background colors to their default -- values for the terminal. The <STRONG>oc</STRONG> string resets all colors -- or color-pairs to their default values for the terminal. -- Some terminals (including many PC terminal emulators) -- erase screen areas with the current background color -- rather than the power-up default background; these should -+ the maximum numbers of colors and color-pairs that can be -+ displayed simultaneously. The <STRONG>op</STRONG> (original pair) string -+ resets foreground and background colors to their default -+ values for the terminal. The <STRONG>oc</STRONG> string resets all colors -+ or color-pairs to their default values for the terminal. -+ Some terminals (including many PC terminal emulators) -+ erase screen areas with the current background color -+ rather than the power-up default background; these should - have the boolean capability <STRONG>bce</STRONG>. - -- To change the current foreground or background color on a -- Tektronix-type terminal, use <STRONG>setaf</STRONG> (set ANSI foreground) -- and <STRONG>setab</STRONG> (set ANSI background) or <STRONG>setf</STRONG> (set foreground) -- and <STRONG>setb</STRONG> (set background). These take one parameter, the -+ To change the current foreground or background color on a -+ Tektronix-type terminal, use <STRONG>setaf</STRONG> (set ANSI foreground) -+ and <STRONG>setab</STRONG> (set ANSI background) or <STRONG>setf</STRONG> (set foreground) -+ and <STRONG>setb</STRONG> (set background). These take one parameter, the - color number. The SVr4 documentation describes only -- <STRONG>setaf</STRONG>/<STRONG>setab</STRONG>; the XPG4 draft says that "If the terminal -+ <STRONG>setaf</STRONG>/<STRONG>setab</STRONG>; the XPG4 draft says that "If the terminal - supports ANSI escape sequences to set background and fore- -- ground, they should be coded as <STRONG>setaf</STRONG> and <STRONG>setab</STRONG>, respec- -- tively. If the terminal supports other escape sequences -- to set background and foreground, they should be coded as -- <STRONG>setf</STRONG> and <STRONG>setb</STRONG>, respectively. The <EM>vidputs()</EM> function and -- the refresh functions use <STRONG>setaf</STRONG> and <STRONG>setab</STRONG> if they are -+ ground, they should be coded as <STRONG>setaf</STRONG> and <STRONG>setab</STRONG>, respec- -+ tively. If the terminal supports other escape sequences -+ to set background and foreground, they should be coded as -+ <STRONG>setf</STRONG> and <STRONG>setb</STRONG>, respectively. The <EM>vidputs()</EM> function and -+ the refresh functions use <STRONG>setaf</STRONG> and <STRONG>setab</STRONG> if they are - defined." - -- The <STRONG>setaf</STRONG>/<STRONG>setab</STRONG> and <STRONG>setf</STRONG>/<STRONG>setb</STRONG> capabilities take a single -+ The <STRONG>setaf</STRONG>/<STRONG>setab</STRONG> and <STRONG>setf</STRONG>/<STRONG>setb</STRONG> capabilities take a single - numeric argument each. Argument values 0-7 of <STRONG>setaf</STRONG>/<STRONG>setab</STRONG> -- are portably defined as follows (the middle column is the -+ are portably defined as follows (the middle column is the - symbolic #define available in the header for the <STRONG>curses</STRONG> or -- <STRONG>ncurses</STRONG> libraries). The terminal hardware is free to map -- these as it likes, but the RGB values indicate normal -+ <STRONG>ncurses</STRONG> libraries). The terminal hardware is free to map -+ these as it likes, but the RGB values indicate normal - locations in color space. - -- - <STRONG>Color</STRONG> <STRONG>#define</STRONG> <STRONG>Value</STRONG> <STRONG>RGB</STRONG> - black <STRONG>COLOR_BLACK</STRONG> 0 0, 0, 0 - red <STRONG>COLOR_RED</STRONG> 1 max,0,0 -@@ -1997,7 +2098,7 @@ - cyan <STRONG>COLOR_CYAN</STRONG> 6 0,max,max - white <STRONG>COLOR_WHITE</STRONG> 7 max,max,max - -- The argument values of <STRONG>setf</STRONG>/<STRONG>setb</STRONG> historically correspond -+ The argument values of <STRONG>setf</STRONG>/<STRONG>setb</STRONG> historically correspond - to a different mapping, i.e., - - <STRONG>Color</STRONG> <STRONG>#define</STRONG> <STRONG>Value</STRONG> <STRONG>RGB</STRONG> -@@ -2009,132 +2110,137 @@ - magenta <STRONG>COLOR_MAGENTA</STRONG> 5 max,0,max - yellow <STRONG>COLOR_YELLOW</STRONG> 6 max,max,0 - white <STRONG>COLOR_WHITE</STRONG> 7 max,max,max -+ - It is important to not confuse the two sets of color capa- -- bilities; otherwise red/blue will be interchanged on the -+ bilities; otherwise red/blue will be interchanged on the - display. - -- On an HP-like terminal, use <STRONG>scp</STRONG> with a color-pair number -+ On an HP-like terminal, use <STRONG>scp</STRONG> with a color-pair number - parameter to set which color pair is current. - -- On a Tektronix-like terminal, the capability <STRONG>ccc</STRONG> may be -- present to indicate that colors can be modified. If so, -+ On a Tektronix-like terminal, the capability <STRONG>ccc</STRONG> may be -+ present to indicate that colors can be modified. If so, - the <STRONG>initc</STRONG> capability will take a color number (0 to <STRONG>colors</STRONG> -- - 1)and three more parameters which describe the color. -+ - 1)and three more parameters which describe the color. - These three parameters default to being interpreted as RGB -- (Red, Green, Blue) values. If the boolean capability <STRONG>hls</STRONG> -+ (Red, Green, Blue) values. If the boolean capability <STRONG>hls</STRONG> - is present, they are instead as HLS (Hue, Lightness, Satu- - ration) indices. The ranges are terminal-dependent. - -- On an HP-like terminal, <STRONG>initp</STRONG> may give a capability for -- changing a color-pair value. It will take seven parame- -- ters; a color-pair number (0 to <STRONG>max_pairs</STRONG> - 1), and two -- triples describing first background and then foreground -- colors. These parameters must be (Red, Green, Blue) or -+ On an HP-like terminal, <STRONG>initp</STRONG> may give a capability for -+ changing a color-pair value. It will take seven parame- -+ ters; a color-pair number (0 to <STRONG>max_pairs</STRONG> - 1), and two -+ triples describing first background and then foreground -+ colors. These parameters must be (Red, Green, Blue) or - (Hue, Lightness, Saturation) depending on <STRONG>hls</STRONG>. - -- On some color terminals, colors collide with highlights. -+ On some color terminals, colors collide with highlights. - You can register these collisions with the <STRONG>ncv</STRONG> capability. -- This is a bit-mask of attributes not to be used when col- -- ors are enabled. The correspondence with the attributes -+ This is a bit-mask of attributes not to be used when col- -+ ors are enabled. The correspondence with the attributes - understood by <STRONG>curses</STRONG> is as follows: - -- -- <STRONG>Attribute</STRONG> <STRONG>Bit</STRONG> <STRONG>Decimal</STRONG> -- A_STANDOUT 0 1 -- A_UNDERLINE 1 2 -- A_REVERSE 2 4 -- A_BLINK 3 8 -- A_DIM 4 16 -- A_BOLD 5 32 -- A_INVIS 6 64 -- A_PROTECT 7 128 -- A_ALTCHARSET 8 256 -- -- For example, on many IBM PC consoles, the underline -- attribute collides with the foreground color blue and is -- not available in color mode. These should have an <STRONG>ncv</STRONG> -+ <STRONG>Attribute</STRONG> <STRONG>Bit</STRONG> <STRONG>Decimal</STRONG> <STRONG>Set</STRONG> <STRONG>by</STRONG> -+ A_STANDOUT 0 1 sgr -+ A_UNDERLINE 1 2 sgr -+ A_REVERSE 2 4 sgr -+ A_BLINK 3 8 sgr -+ A_DIM 4 16 sgr -+ A_BOLD 5 32 sgr -+ A_INVIS 6 64 sgr -+ A_PROTECT 7 128 sgr -+ A_ALTCHARSET 8 256 sgr -+ A_HORIZONTAL 9 512 sgr1 -+ A_LEFT 10 1024 sgr1 -+ A_LOW 11 2048 sgr1 -+ A_RIGHT 12 4096 sgr1 -+ A_TOP 13 8192 sgr1 -+ A_VERTICAL 14 16384 sgr1 -+ A_ITALIC 15 32768 sitm -+ -+ For example, on many IBM PC consoles, the underline -+ attribute collides with the foreground color blue and is -+ not available in color mode. These should have an <STRONG>ncv</STRONG> - capability of 2. - -- SVr4 curses does nothing with <STRONG>ncv</STRONG>, ncurses recognizes it -+ SVr4 curses does nothing with <STRONG>ncv</STRONG>, ncurses recognizes it - and optimizes the output in favor of colors. - -- - <STRONG>Miscellaneous</STRONG> -- If the terminal requires other than a null (zero) charac- -- ter as a pad, then this can be given as pad. Only the -- first character of the pad string is used. If the termi- -+ If the terminal requires other than a null (zero) charac- -+ ter as a pad, then this can be given as pad. Only the -+ first character of the pad string is used. If the termi- - nal does not have a pad character, specify npc. Note that -- ncurses implements the termcap-compatible <STRONG>PC</STRONG> variable; -- though the application may set this value to something -- other than a null, ncurses will test <STRONG>npc</STRONG> first and use -+ ncurses implements the termcap-compatible <STRONG>PC</STRONG> variable; -+ though the application may set this value to something -+ other than a null, ncurses will test <STRONG>npc</STRONG> first and use - napms if the terminal has no pad character. - -- If the terminal can move up or down half a line, this can -- be indicated with <STRONG>hu</STRONG> (half-line up) and <STRONG>hd</STRONG> (half-line -+ If the terminal can move up or down half a line, this can -+ be indicated with <STRONG>hu</STRONG> (half-line up) and <STRONG>hd</STRONG> (half-line - down). This is primarily useful for superscripts and sub- -- scripts on hard-copy terminals. If a hard-copy terminal -- can eject to the next page (form feed), give this as <STRONG>ff</STRONG> -+ scripts on hard-copy terminals. If a hard-copy terminal -+ can eject to the next page (form feed), give this as <STRONG>ff</STRONG> - (usually control L). - -- If there is a command to repeat a given character a given -- number of times (to save time transmitting a large number -- of identical characters) this can be indicated with the -- parameterized string <STRONG>rep</STRONG>. The first parameter is the -- character to be repeated and the second is the number of -- times to repeat it. Thus, tparm(repeat_char, 'x', 10) is -- the same as `xxxxxxxxxx'. -+ If there is a command to repeat a given character a given -+ number of times (to save time transmitting a large number -+ of identical characters) this can be indicated with the -+ parameterized string <STRONG>rep</STRONG>. The first parameter is the -+ character to be repeated and the second is the number of -+ times to repeat it. Thus, tparm(repeat_char, 'x', 10) is -+ the same as "xxxxxxxxxx". - -- If the terminal has a settable command character, such as -- the TEKTRONIX 4025, this can be indicated with <STRONG>cmdch</STRONG>. A -+ If the terminal has a settable command character, such as -+ the TEKTRONIX 4025, this can be indicated with <STRONG>cmdch</STRONG>. A - prototype command character is chosen which is used in all -- capabilities. This character is given in the <STRONG>cmdch</STRONG> capa- -- bility to identify it. The following convention is sup- -- ported on some UNIX systems: The environment is to be -- searched for a <STRONG>CC</STRONG> variable, and if found, all occurrences -+ capabilities. This character is given in the <STRONG>cmdch</STRONG> capa- -+ bility to identify it. The following convention is sup- -+ ported on some UNIX systems: The environment is to be -+ searched for a <STRONG>CC</STRONG> variable, and if found, all occurrences - of the prototype character are replaced with the character - in the environment variable. - -- Terminal descriptions that do not represent a specific -+ Terminal descriptions that do not represent a specific - kind of known terminal, such as <EM>switch</EM>, <EM>dialup</EM>, <EM>patch</EM>, and -- <EM>network</EM>, should include the <STRONG>gn</STRONG> (generic) capability so -- that programs can complain that they do not know how to -- talk to the terminal. (This capability does not apply to -- <EM>virtual</EM> terminal descriptions for which the escape -+ <EM>network</EM>, should include the <STRONG>gn</STRONG> (generic) capability so -+ that programs can complain that they do not know how to -+ talk to the terminal. (This capability does not apply to -+ <EM>virtual</EM> terminal descriptions for which the escape - sequences are known.) - -- If the terminal has a ``meta key'' which acts as a shift -- key, setting the 8th bit of any character transmitted, -- this fact can be indicated with <STRONG>km</STRONG>. Otherwise, software -+ If the terminal has a "meta key" which acts as a shift -+ key, setting the 8th bit of any character transmitted, -+ this fact can be indicated with <STRONG>km</STRONG>. Otherwise, software - will assume that the 8th bit is parity and it will usually -- be cleared. If strings exist to turn this ``meta mode'' -- on and off, they can be given as <STRONG>smm</STRONG> and <STRONG>rmm</STRONG>. -+ be cleared. If strings exist to turn this "meta mode" on -+ and off, they can be given as <STRONG>smm</STRONG> and <STRONG>rmm</STRONG>. - -- If the terminal has more lines of memory than will fit on -- the screen at once, the number of lines of memory can be -- indicated with <STRONG>lm</STRONG>. A value of <STRONG>lm</STRONG>#0 indicates that the -+ If the terminal has more lines of memory than will fit on -+ the screen at once, the number of lines of memory can be -+ indicated with <STRONG>lm</STRONG>. A value of <STRONG>lm</STRONG>#0 indicates that the - number of lines is not fixed, but that there is still more - memory than fits on the screen. - - If the terminal is one of those supported by the UNIX vir- -- tual terminal protocol, the terminal number can be given -+ tual terminal protocol, the terminal number can be given - as <STRONG>vt</STRONG>. - - Media copy strings which control an auxiliary printer con- - nected to the terminal can be given as <STRONG>mc0</STRONG>: print the con- -- tents of the screen, <STRONG>mc4</STRONG>: turn off the printer, and <STRONG>mc5</STRONG>: -- turn on the printer. When the printer is on, all text -- sent to the terminal will be sent to the printer. It is -+ tents of the screen, <STRONG>mc4</STRONG>: turn off the printer, and <STRONG>mc5</STRONG>: -+ turn on the printer. When the printer is on, all text -+ sent to the terminal will be sent to the printer. It is - undefined whether the text is also displayed on the termi- - nal screen when the printer is on. A variation <STRONG>mc5p</STRONG> takes - one parameter, and leaves the printer on for as many char- -- acters as the value of the parameter, then turns the -- printer off. The parameter should not exceed 255. All -+ acters as the value of the parameter, then turns the -+ printer off. The parameter should not exceed 255. All - text, including <STRONG>mc4</STRONG>, is transparently passed to the - printer while an <STRONG>mc5p</STRONG> is in effect. - -- - <STRONG>Glitches</STRONG> <STRONG>and</STRONG> <STRONG>Braindamage</STRONG> -- Hazeltine terminals, which do not allow `~' characters to -+ Hazeltine terminals, which do not allow "~" characters to - be displayed should indicate <STRONG>hz</STRONG>. - - Terminals which ignore a line-feed immediately after an <STRONG>am</STRONG> -@@ -2147,10 +2253,10 @@ - Teleray terminals, where tabs turn all characters moved - over to blanks, should indicate <STRONG>xt</STRONG> (destructive tabs). - Note: the variable indicating this is now -- `dest_tabs_magic_smso'; in older versions, it was tel- -+ "dest_tabs_magic_smso"; in older versions, it was tel- - eray_glitch. This glitch is also taken to mean that it is -- not possible to position the cursor on top of a ``magic -- cookie'', that to erase standout mode it is instead neces- -+ not possible to position the cursor on top of a "magic -+ cookie", that to erase standout mode it is instead neces- - sary to use delete and insert line. The ncurses implemen- - tation ignores this glitch. - -@@ -2159,13 +2265,12 @@ - ing that the f1 key is used for escape and f2 for control - C. (Only certain Superbees have this problem, depending - on the ROM.) Note that in older terminfo versions, this -- capability was called `beehive_glitch'; it is now -- `no_esc_ctl_c'. -+ capability was called "beehive_glitch"; it is now -+ "no_esc_ctl_c". - - Other specific terminal problems may be corrected by - adding more capabilities of the form <STRONG>x</STRONG><EM>x</EM>. - -- - <STRONG>Similar</STRONG> <STRONG>Terminals</STRONG> - If there are two very similar terminals, one (the variant) - can be defined as being just like the other (the base) -@@ -2183,14 +2288,13 @@ - the use reference that imports it, where <EM>xx</EM> is the capa- - bility. For example, the entry - -- 2621-nl, smkx@, rmkx@, use=2621, -+ 2621-nl, smkx@, rmkx@, use=2621, - - defines a 2621-nl that does not have the <STRONG>smkx</STRONG> or <STRONG>rmkx</STRONG> - capabilities, and hence does not turn on the function key - labels when in visual mode. This is useful for different - modes for a terminal, or for different user preferences. - -- - <STRONG>Pitfalls</STRONG> <STRONG>of</STRONG> <STRONG>Long</STRONG> <STRONG>Entries</STRONG> - Long terminfo entries are unlikely to be a problem; to - date, no entry has even approached terminfo's 4096-byte -@@ -2229,21 +2333,21 @@ - libraries strip off the final newline, too (GNU termcap - does not). Now suppose: - -- * a termcap entry before expansion is more than 1023 -- bytes long, -+ <STRONG>o</STRONG> a termcap entry before expansion is more than 1023 -+ bytes long, - -- * and the application has only allocated a 1k buffer, -+ <STRONG>o</STRONG> and the application has only allocated a 1k buffer, - -- * and the termcap library (like the one in BSD/OS 1.1 -- and GNU) reads the whole entry into the buffer, no -- matter what its length, to see if it is the entry it -- wants, -- -- * and <STRONG>tgetent()</STRONG> is searching for a terminal type that -- either is the long entry, appears in the termcap file -- after the long entry, or does not appear in the file -- at all (so that <STRONG>tgetent()</STRONG> has to search the whole -- termcap file). -+ <STRONG>o</STRONG> and the termcap library (like the one in BSD/OS 1.1 -+ and GNU) reads the whole entry into the buffer, no -+ matter what its length, to see if it is the entry it -+ wants, -+ -+ <STRONG>o</STRONG> and <STRONG>tgetent()</STRONG> is searching for a terminal type that -+ either is the long entry, appears in the termcap file -+ after the long entry, or does not appear in the file -+ at all (so that <STRONG>tgetent()</STRONG> has to search the whole -+ termcap file). - - Then <STRONG>tgetent()</STRONG> will overwrite memory, perhaps its stack, - and probably core dump the program. Programs like telnet -@@ -2288,61 +2392,72 @@ - - </PRE> - <H2>EXTENSIONS</H2><PRE> -- Some SVr4 <STRONG>curses</STRONG> implementations, and all previous to -- SVr4, do not interpret the %A and %O operators in parame- -+ Searching for terminal descriptions in <STRONG>$HOME/.terminfo</STRONG> and -+ TERMINFO_DIRS is not supported by older implementations. -+ -+ Some SVr4 <STRONG>curses</STRONG> implementations, and all previous to -+ SVr4, do not interpret the %A and %O operators in parame- - ter strings. - -- SVr4/XPG4 do not specify whether <STRONG>msgr</STRONG> licenses movement -- while in an alternate-character-set mode (such modes may, -- among other things, map CR and NL to characters that do -- not trigger local motions). The <STRONG>ncurses</STRONG> implementation -- ignores <STRONG>msgr</STRONG> in <STRONG>ALTCHARSET</STRONG> mode. This raises the possi- -- bility that an XPG4 implementation making the opposite -- interpretation may need terminfo entries made for <STRONG>ncurses</STRONG> -+ SVr4/XPG4 do not specify whether <STRONG>msgr</STRONG> licenses movement -+ while in an alternate-character-set mode (such modes may, -+ among other things, map CR and NL to characters that do -+ not trigger local motions). The <STRONG>ncurses</STRONG> implementation -+ ignores <STRONG>msgr</STRONG> in <STRONG>ALTCHARSET</STRONG> mode. This raises the possi- -+ bility that an XPG4 implementation making the opposite -+ interpretation may need terminfo entries made for <STRONG>ncurses</STRONG> - to have <STRONG>msgr</STRONG> turned off. - -- The <STRONG>ncurses</STRONG> library handles insert-character and insert- -+ The <STRONG>ncurses</STRONG> library handles insert-character and insert- - character modes in a slightly non-standard way to get bet- -- ter update efficiency. See the <STRONG>Insert/Delete</STRONG> <STRONG>Character</STRONG> -+ ter update efficiency. See the <STRONG>Insert/Delete</STRONG> <STRONG>Character</STRONG> - subsection above. - -- The parameter substitutions for <STRONG>set_clock</STRONG> and <STRONG>dis-</STRONG> -- <STRONG>play_clock</STRONG> are not documented in SVr4 or the XSI Curses -+ The parameter substitutions for <STRONG>set_clock</STRONG> and <STRONG>dis-</STRONG> -+ <STRONG>play_clock</STRONG> are not documented in SVr4 or the XSI Curses - standard. They are deduced from the documentation for the - AT&amp;T 505 terminal. - -- Be careful assigning the <STRONG>kmous</STRONG> capability. The <STRONG>ncurses</STRONG> -- wants to interpret it as <STRONG>KEY_MOUSE</STRONG>, for use by terminals -- and emulators like xterm that can return mouse-tracking -+ Be careful assigning the <STRONG>kmous</STRONG> capability. The <STRONG>ncurses</STRONG> -+ wants to interpret it as <STRONG>KEY_MOUSE</STRONG>, for use by terminals -+ and emulators like xterm that can return mouse-tracking - information in the keyboard-input stream. - -- Different commercial ports of terminfo and curses support -- different subsets of the XSI Curses standard and (in some -+ X/Open Curses does not mention italics. Portable applica- -+ tions must assume that numeric capabilities are signed -+ 16-bit values. This includes the <EM>no</EM><STRONG>_</STRONG><EM>color</EM><STRONG>_</STRONG><EM>video</EM> (ncv) -+ capability. The 32768 mask value used for italics with -+ ncv can be confused with an absent or cancelled ncv. If -+ italics should work with colors, then the ncv value must -+ be specified, even if it is zero. -+ -+ Different commercial ports of terminfo and curses support -+ different subsets of the XSI Curses standard and (in some - cases) different extension sets. Here is a summary, accu- - rate as of October 1995: - - <STRONG>SVR4,</STRONG> <STRONG>Solaris,</STRONG> <STRONG>ncurses</STRONG> -- These support all SVr4 capabili- - ties. - -- <STRONG>SGI</STRONG> -- Supports the SVr4 set, adds one undocumented -+ <STRONG>SGI</STRONG> -- Supports the SVr4 set, adds one undocumented - extended string capability (<STRONG>set_pglen</STRONG>). - -- <STRONG>SVr1,</STRONG> <STRONG>Ultrix</STRONG> -- These support a restricted subset of ter- -- minfo capabilities. The booleans end with <STRONG>xon_xoff</STRONG>; the -- numerics with <STRONG>width_status_line</STRONG>; and the strings with -+ <STRONG>SVr1,</STRONG> <STRONG>Ultrix</STRONG> -- These support a restricted subset of ter- -+ minfo capabilities. The booleans end with <STRONG>xon_xoff</STRONG>; the -+ numerics with <STRONG>width_status_line</STRONG>; and the strings with - <STRONG>prtr_non</STRONG>. - -- <STRONG>HP/UX</STRONG> -- Supports the SVr1 subset, plus the SVr[234] -+ <STRONG>HP/UX</STRONG> -- Supports the SVr1 subset, plus the SVr[234] - numerics <STRONG>num_labels</STRONG>, <STRONG>label_height</STRONG>, <STRONG>label_width</STRONG>, plus func- -- tion keys 11 through 63, plus <STRONG>plab_norm</STRONG>, <STRONG>label_on</STRONG>, and -+ tion keys 11 through 63, plus <STRONG>plab_norm</STRONG>, <STRONG>label_on</STRONG>, and - <STRONG>label_off</STRONG>, plus some incompatible extensions in the string - table. - -- <STRONG>AIX</STRONG> -- Supports the SVr1 subset, plus function keys 11 -- through 63, plus a number of incompatible string table -+ <STRONG>AIX</STRONG> -- Supports the SVr1 subset, plus function keys 11 -+ through 63, plus a number of incompatible string table - extensions. - -- <STRONG>OSF</STRONG> -- Supports both the SVr4 set and the AIX extensions. -+ <STRONG>OSF</STRONG> -- Supports both the SVr4 set and the AIX extensions. - - - </PRE> -@@ -2353,7 +2468,7 @@ - - </PRE> - <H2>SEE ALSO</H2><PRE> -- <STRONG><A HREF="tic.1m.html">tic(1m)</A></STRONG>, <STRONG><A HREF="infocmp.1m.html">infocmp(1m)</A></STRONG>, <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>, <STRONG><A HREF="printf.3.html">printf(3)</A></STRONG>, <STRONG><A HREF="term.5.html">term(5)</A></STRONG>. -+ <STRONG><A HREF="tic.1m.html">tic(1m)</A></STRONG>, <STRONG><A HREF="infocmp.1m.html">infocmp(1m)</A></STRONG>, <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>, <STRONG>printf(3)</STRONG>, <STRONG><A HREF="term.5.html">term(5)</A></STRONG>. - <STRONG><A HREF="term_variables.3x.html">term_variables(3x)</A></STRONG>. - - -diff -Naur ncurses-5.9/doc/html/man/term_variables.3x.html ncurses-5.9.patch/doc/html/man/term_variables.3x.html ---- ncurses-5.9/doc/html/man/term_variables.3x.html 2011-01-09 02:03:29.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/term_variables.3x.html 2014-09-01 16:33:22.334792086 +0200 -@@ -1,7 +1,7 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - **************************************************************************** -- * Copyright (c) 2010 Free Software Foundation, Inc. * -+ * Copyright (c) 2011,2013 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -27,7 +27,7 @@ - * sale, use or other dealings in this Software without prior written * - * authorization. * - **************************************************************************** -- * @Id: term_variables.3x,v 1.2 2010/12/04 18:38:55 tom Exp @ -+ * @Id: term_variables.3x,v 1.3 2011/12/17 23:31:50 tom Exp @ - --> - <HTML> - <HEAD> -@@ -99,8 +99,8 @@ - <STRONG>Current</STRONG> <STRONG>Terminal</STRONG> <STRONG>Data</STRONG> - After initializing the curses or terminfo interfaces, the - <STRONG>cur_term</STRONG> contains data describing the current terminal. -- This variable is also set as a side-effect of <STRONG><A HREF="set_term.3x.html">set_term(3x)</A></STRONG> -- and <STRONG><A HREF="delscreen.3x.html">delscreen(3x)</A></STRONG>. -+ This variable is also set as a side-effect of <STRONG><A HREF="curs_initscr.3x.html">curs_initscr(3x)</A></STRONG> -+ and <STRONG><A HREF="curs_initscr.3x.html">curs_initscr(3x)</A></STRONG>. - - It is possible to save a value of <STRONG>cur_term</STRONG> for subsequent - use as a parameter to <STRONG>set_term</STRONG>, for switching between -@@ -108,7 +108,7 @@ - from <STRONG>newterm</STRONG> or <STRONG>setupterm</STRONG> to reuse in <STRONG>set_term</STRONG>. - - <STRONG>Terminfo</STRONG> <STRONG>Names</STRONG> -- The <STRONG><A HREF="tic.1.html">tic(1)</A></STRONG> and <STRONG><A HREF="infocmp.1.html">infocmp(1)</A></STRONG> programs use lookup tables for -+ The <STRONG><A HREF="tic.1m.html">tic(1m)</A></STRONG> and <STRONG><A HREF="infocmp.1m.html">infocmp(1m)</A></STRONG> programs use lookup tables for - the long and short names of terminfo capabilities, as well - as the corresponding names for termcap capabilities. - These are available to other applications, though the -@@ -130,8 +130,8 @@ - - </PRE> - <H2>NOTES</H2><PRE> -- The low-level terminfo interface is initialized using <STRONG>se-</STRONG> -- <STRONG><A HREF="setupterm.3x.html">tupterm(3x)</A></STRONG>. The upper-level curses interface uses the -+ The low-level terminfo interface is initialized using -+ <STRONG><A HREF="curs_terminfo.3x.html">curs_terminfo(3x)</A></STRONG>. The upper-level curses interface uses the - low-level terminfo interface, internally. - - -@@ -149,8 +149,8 @@ - - </PRE> - <H2>SEE ALSO</H2><PRE> -- <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>, <STRONG><A HREF="curs_terminfo.3x.html">curs_terminfo(3x)</A></STRONG>, <STRONG><A HREF="curs_threads.3x.html">curs_threads(3x)</A></STRONG>, <STRONG>termin-</STRONG> -- <STRONG><A HREF="terminfo.3x.html">fo(3x)</A></STRONG>, <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG>. -+ <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>, <STRONG><A HREF="curs_terminfo.3x.html">curs_terminfo(3x)</A></STRONG>, <STRONG><A HREF="curs_threads.3x.html">curs_threads(3x)</A></STRONG>, -+ <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG>. - - - -diff -Naur ncurses-5.9/doc/html/man/tic.1m.html ncurses-5.9.patch/doc/html/man/tic.1m.html ---- ncurses-5.9/doc/html/man/tic.1m.html 2011-04-05 00:46:51.000000000 +0200 -+++ ncurses-5.9.patch/doc/html/man/tic.1m.html 2014-09-01 16:33:22.335792088 +0200 -@@ -1,7 +1,7 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - **************************************************************************** -- * Copyright (c) 1998-2006,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -27,7 +27,7 @@ - * sale, use or other dealings in this Software without prior written * - * authorization. * - **************************************************************************** -- * @Id: tic.1m,v 1.47 2010/12/04 18:38:55 tom Exp @ -+ * @Id: tic.1m,v 1.58 2013/07/20 19:31:25 tom Exp @ - --> - <HTML> - <HEAD> -@@ -52,84 +52,141 @@ - - </PRE> - <H2>SYNOPSIS</H2><PRE> -- <STRONG>tic</STRONG> [<STRONG>-1CGILNTUVacfgrstx</STRONG>] [<STRONG>-e</STRONG> <EM>names</EM>] [<STRONG>-o</STRONG> <EM>dir</EM>] [<STRONG>-R</STRONG> <EM>subset</EM>] -- [<STRONG>-v</STRONG>[<EM>n</EM>]] [<STRONG>-w</STRONG>[<EM>n</EM>]] <EM>file</EM> -+ <STRONG>tic</STRONG> [<STRONG>-01CDGIKLNTUVacfgrstx</STRONG>] [<STRONG>-e</STRONG> <EM>names</EM>] [<STRONG>-o</STRONG> <EM>dir</EM>] [<STRONG>-R</STRONG> <EM>sub-</EM> -+ <EM>set</EM>] [<STRONG>-v</STRONG>[<EM>n</EM>]] [<STRONG>-w</STRONG>[<EM>n</EM>]] <EM>file</EM> - - - </PRE> - <H2>DESCRIPTION</H2><PRE> -- The command <STRONG>tic</STRONG> translates a <STRONG>terminfo</STRONG> file from source -+ The <STRONG>tic</STRONG> command translates a <STRONG>terminfo</STRONG> file from source - format into compiled format. The compiled format is nec- - essary for use with the library routines in <STRONG><A HREF="ncurses.3x.html">ncurses(3x)</A></STRONG>. - -- The results are normally placed in the system terminfo -- directory <STRONG>/usr/share/terminfo</STRONG>. There are two ways to -- change this behavior. -+ As described in <STRONG><A HREF="term.5.html">term(5)</A></STRONG>, the database may be either a -+ directory tree (one file per terminal entry) or a hashed -+ database (one record per entry). The <STRONG>tic</STRONG> command writes -+ only one type of entry, depending on how it was built: -+ -+ <STRONG>o</STRONG> For directory trees, the top-level directory, e.g., -+ /usr/share/terminfo, specifies the location of the -+ database. -+ -+ <STRONG>o</STRONG> For hashed databases, a filename is needed. If the -+ given file is not found by that name, but can be found -+ by adding the suffix ".db", then that is used. -+ -+ The default name for the hashed database is the same -+ as the default directory name (only adding a ".db" -+ suffix). -+ -+ In either case (directory or hashed database), <STRONG>tic</STRONG> will -+ create the container if it does not exist. For a direc- -+ tory, this would be the "terminfo" leaf, versus a "ter- -+ minfo.db" file. - -- First, you may override the system default by setting the -- variable <STRONG>TERMINFO</STRONG> in your shell environment to a valid -- (existing) directory name. -- -- Secondly, if <STRONG>tic</STRONG> cannot get access to <EM>/usr/share/terminfo</EM> -- or your TERMINFO directory, it looks for the directory -- <EM>$HOME/.terminfo</EM>; if that directory exists, the entry is -- placed there. -+ The results are normally placed in the system terminfo -+ database <STRONG>/usr/share/terminfo</STRONG>. The compiled terminal -+ description can be placed in a different terminfo data- -+ base. There are two ways to achieve this: -+ -+ <STRONG>o</STRONG> First, you may override the system default either by -+ using the <STRONG>-o</STRONG> option, or by setting the variable <STRONG>TER-</STRONG> -+ <STRONG>MINFO</STRONG> in your shell environment to a valid database -+ location. -+ -+ <STRONG>o</STRONG> Secondly, if <STRONG>tic</STRONG> cannot write in <EM>/usr/share/terminfo</EM> -+ or the location specified using your TERMINFO vari- -+ able, it looks for the directory <EM>$HOME/.terminfo</EM> (or -+ hashed database <EM>$HOME/.terminfo.db)</EM>; if that location -+ exists, the entry is placed there. - - Libraries that read terminfo entries are expected to check -- for a TERMINFO directory first, look at <EM>$HOME/.terminfo</EM> if -- TERMINFO is not set, and finally look in <EM>/usr/share/ter-</EM> -- <EM>minfo</EM>. -+ in succession -+ -+ <STRONG>o</STRONG> a location specified with the TERMINFO environment -+ variable, -+ -+ <STRONG>o</STRONG> <EM>$HOME/.terminfo</EM>, -+ -+ <STRONG>o</STRONG> directories listed in the TERMINFO_DIRS environment -+ variable, -+ -+ <STRONG>o</STRONG> a compiled-in list of directories -+ (/usr/local/ncurses/share/terminfo:/usr/share/ter- -+ minfo), and -+ -+ <STRONG>o</STRONG> the system terminfo database (<EM>/usr/share/terminfo</EM>). -+ -+ <STRONG>OPTIONS</STRONG> -+ <STRONG>-0</STRONG> restricts the output to a single line - - <STRONG>-1</STRONG> restricts the output to a single column - - <STRONG>-a</STRONG> tells <STRONG>tic</STRONG> to retain commented-out capabilities - rather than discarding them. Capabilities are com- -- mented by prefixing them with a period. This sets -- the <STRONG>-x</STRONG> option, because it treats the commented-out -- entries as user-defined names. If the source is -- termcap, accept the 2-character names required by -+ mented by prefixing them with a period. This sets -+ the <STRONG>-x</STRONG> option, because it treats the commented-out -+ entries as user-defined names. If the source is -+ termcap, accept the 2-character names required by - version 6. Otherwise these are ignored. - -- <STRONG>-C</STRONG> Force source translation to termcap format. Note: -- this differs from the <STRONG>-C</STRONG> option of <STRONG><A HREF="infocmp.1m.html">infocmp(1m)</A></STRONG> in -+ <STRONG>-C</STRONG> Force source translation to termcap format. Note: -+ this differs from the <STRONG>-C</STRONG> option of <STRONG><A HREF="infocmp.1m.html">infocmp(1m)</A></STRONG> in - that it does not merely translate capability names, -- but also translates terminfo strings to termcap -+ but also translates terminfo strings to termcap - format. Capabilities that are not translatable are -- left in the entry under their terminfo names but -- commented out with two preceding dots. -+ left in the entry under their terminfo names but -+ commented out with two preceding dots. The actual -+ format used incorporates some improvements for -+ escaped characters from terminfo format. For a -+ stricter BSD-compatible translation, add the <STRONG>-K</STRONG> -+ option. - -- <STRONG>-c</STRONG> tells <STRONG>tic</STRONG> to only check <EM>file</EM> for errors, including -- syntax problems and bad use links. If you specify -+ <STRONG>-c</STRONG> tells <STRONG>tic</STRONG> to only check <EM>file</EM> for errors, including -+ syntax problems and bad use links. If you specify - <STRONG>-C</STRONG> (<STRONG>-I</STRONG>) with this option, the code will print warn- - ings about entries which, after use resolution, are -- more than 1023 (4096) bytes long. Due to a fixed -- buffer length in older termcap libraries (and a -- documented limit in terminfo), these entries may -- cause core dumps. -+ more than 1023 (4096) bytes long. Due to a fixed -+ buffer length in older termcap libraries, as well -+ as buggy checking for the buffer length (and a doc- -+ umented limit in terminfo), these entries may cause -+ core dumps with other implementations. -+ -+ <STRONG>-D</STRONG> tells <STRONG>tic</STRONG> to print the database locations that it -+ knows about, and exit. The first location shown is -+ the one to which it would write compiled terminal -+ descriptions. If <STRONG>tic</STRONG> is not able to find a -+ writable database location according to the rules -+ summarized above, it will print a diagnostic and -+ exit with an error rather than printing a list of -+ database locations. - - <STRONG>-e</STRONG> <EM>names</EM> -- Limit writes and translations to the following -- comma-separated list of terminals. If any name or -+ Limit writes and translations to the following -+ comma-separated list of terminals. If any name or - alias of a terminal matches one of the names in the -- list, the entry will be written or translated as -- normal. Otherwise no output will be generated for -+ list, the entry will be written or translated as -+ normal. Otherwise no output will be generated for - it. The option value is interpreted as a file con- -- taining the list if it contains a '/'. (Note: -- depending on how tic was compiled, this option may -+ taining the list if it contains a '/'. (Note: -+ depending on how tic was compiled, this option may - require <STRONG>-I</STRONG> or <STRONG>-C</STRONG>.) - - <STRONG>-f</STRONG> Display complex terminfo strings which contain -- if/then/else/endif expressions indented for read- -+ if/then/else/endif expressions indented for read- - ability. - -- <STRONG>-G</STRONG> Display constant literals in decimal form rather -+ <STRONG>-G</STRONG> Display constant literals in decimal form rather - than their character equivalents. - -- <STRONG>-g</STRONG> Display constant character literals in quoted form -+ <STRONG>-g</STRONG> Display constant character literals in quoted form - rather than their decimal equivalents. - - <STRONG>-I</STRONG> Force source translation to terminfo format. - -+ <STRONG>-K</STRONG> Suppress some longstanding ncurses extensions to -+ termcap format, e.g., "\s" for space. -+ - <STRONG>-L</STRONG> Force source translation to terminfo format using - the long C variable names listed in &lt;<STRONG>term.h</STRONG>&gt; - -@@ -145,8 +202,8 @@ - This option forces a more literal translation that - also preserves the obsolete capabilities. - -- <STRONG>-o</STRONG><EM>dir</EM> Write compiled entries to given directory. Over- -- rides the TERMINFO environment variable. -+ <STRONG>-o</STRONG><EM>dir</EM> Write compiled entries to given database location. -+ Overrides the TERMINFO environment variable. - - <STRONG>-R</STRONG><EM>subset</EM> - Restrict output to a given subset. This option is -@@ -160,15 +217,15 @@ - - <STRONG>-r</STRONG> Force entry resolution (so there are no remaining - tc capabilities) even when doing translation to -- termcap format. This may be needed if you are -- preparing a termcap file for a termcap library -- (such as GNU termcap through version 1.3 or BSD -- termcap through 4.3BSD) that does not handle multi- -- ple tc capabilities per entry. -- -- <STRONG>-s</STRONG> Summarize the compile by showing the directory into -- which entries are written, and the number of -- entries which are compiled. -+ termcap format. This may be needed if you are pre- -+ paring a termcap file for a termcap library (such -+ as GNU termcap through version 1.3 or BSD termcap -+ through 4.3BSD) that does not handle multiple tc -+ capabilities per entry. -+ -+ <STRONG>-s</STRONG> Summarize the compile by showing the database loca- -+ tion into which entries are written, and the number -+ of entries which are compiled. - - <STRONG>-T</STRONG> eliminates size-restrictions on the generated text. - This is mainly useful for testing and analysis, -@@ -195,41 +252,48 @@ - 1. If <EM>n</EM> is specified and greater than 1, the level - of detail is increased. - -- <STRONG>-w</STRONG><EM>n</EM> specifies the width of the output. The parameter is -- optional. If it is omitted, it defaults to 60. -+ The debug flag levels are as follows: - -- <STRONG>-x</STRONG> Treat unknown capabilities as user-defined. That is, -- if you supply a capability name which <STRONG>tic</STRONG> does not -- recognize, it will infer its type (boolean, number or -- string) from the syntax and make an extended table -- entry for that. User-defined capability strings -- whose name begins with ``k'' are treated as function -- keys. -+ 1 Names of files created and linked - -- <EM>file</EM> contains one or more <STRONG>terminfo</STRONG> terminal descriptions -- in source format [see <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG>]. Each description -- in the file describes the capabilities of a particu- -- lar terminal. -+ 2 Information related to the "use" facility - -- The debug flag levels are as follows: -+ 3 Statistics from the hashing algorithm - -- 1 Names of files created and linked -+ 5 String-table memory allocations - -- 2 Information related to the ``use'' facility -+ 7 Entries into the string-table - -- 3 Statistics from the hashing algorithm -+ 8 List of tokens encountered by scanner - -- 5 String-table memory allocations -+ 9 All values computed in construction of the -+ hash table - -- 7 Entries into the string-table -+ If the debug level <EM>n</EM> is not given, it is taken to be -+ one. - -- 8 List of tokens encountered by scanner -+ <STRONG>-w</STRONG><EM>n</EM> specifies the width of the output. The parameter is -+ optional. If it is omitted, it defaults to 60. - -- 9 All values computed in construction of the hash ta- -- ble -+ <STRONG>-x</STRONG> Treat unknown capabilities as user-defined. That is, -+ if you supply a capability name which <STRONG>tic</STRONG> does not -+ recognize, it will infer its type (boolean, number or -+ string) from the syntax and make an extended table -+ entry for that. User-defined capability strings -+ whose name begins with "k" are treated as function -+ keys. - -- If the debug level <EM>n</EM> is not given, it is taken to be one. -+ <STRONG>PARAMETERS</STRONG> -+ <EM>file</EM> contains one or more <STRONG>terminfo</STRONG> terminal descriptions -+ in source format [see <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG>]. Each descrip- -+ tion in the file describes the capabilities of a -+ particular terminal. -+ -+ If <EM>file</EM> is "-", then the data is read from the -+ standard input. The <EM>file</EM> parameter may also be the -+ path of a character-device. - -+ <STRONG>PROCESSING</STRONG> - All but one of the capabilities recognized by <STRONG>tic</STRONG> are doc- - umented in <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG>. The exception is the <STRONG>use</STRONG> capabil- - ity. -@@ -237,10 +301,8 @@ - When a <STRONG>use</STRONG>=<EM>entry</EM>-<EM>name</EM> field is discovered in a terminal - entry currently being compiled, <STRONG>tic</STRONG> reads in the binary - from <STRONG>/usr/share/terminfo</STRONG> to complete the entry. (Entries -- created from <EM>file</EM> will be used first. If the environment -- variable <STRONG>TERMINFO</STRONG> is set, that directory is searched -- instead of <STRONG>/usr/share/terminfo</STRONG>.) <STRONG>tic</STRONG> duplicates the capa- -- bilities in <EM>entry</EM>-<EM>name</EM> for the current entry, with the -+ created from <EM>file</EM> will be used first. <STRONG>tic</STRONG> duplicates the -+ capabilities in <EM>entry</EM>-<EM>name</EM> for the current entry, with the - exception of those capabilities that explicitly are - defined in the current entry. - -@@ -249,52 +311,49 @@ - <EM>entry</EM>_<EM>name</EM>_<EM>2</EM> must also appear in <STRONG>entry_name_1</STRONG> before <STRONG>use=</STRONG> - for these capabilities to be canceled in <STRONG>entry_name_1</STRONG>. - -- If the environment variable <STRONG>TERMINFO</STRONG> is set, the compiled -- results are placed there instead of <STRONG>/usr/share/terminfo</STRONG>. -- - Total compiled entries cannot exceed 4096 bytes. The name -- field cannot exceed 512 bytes. Terminal names exceeding -- the maximum alias length (32 characters on systems with -+ field cannot exceed 512 bytes. Terminal names exceeding -+ the maximum alias length (32 characters on systems with - long filenames, 14 characters otherwise) will be truncated -- to the maximum alias length and a warning message will be -+ to the maximum alias length and a warning message will be - printed. - - - </PRE> - <H2>COMPATIBILITY</H2><PRE> -- There is some evidence that historic <STRONG>tic</STRONG> implementations -- treated description fields with no whitespace in them as -- additional aliases or short names. This <STRONG>tic</STRONG> does not do -- that, but it does warn when description fields may be -- treated that way and check them for dangerous characters. -+ There is some evidence that historic <STRONG>tic</STRONG> implementations -+ treated description fields with no whitespace in them as -+ additional aliases or short names. This <STRONG>tic</STRONG> does not do -+ that, but it does warn when description fields may be -+ treated that way and check them for dangerous characters. - - - </PRE> - <H2>EXTENSIONS</H2><PRE> -- Unlike the stock SVr4 <STRONG>tic</STRONG> command, this implementation can -- actually compile termcap sources. In fact, entries in -- terminfo and termcap syntax can be mixed in a single -- source file. See <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG> for the list of termcap -- names taken to be equivalent to terminfo names. -+ Unlike the SVr4 <STRONG>tic</STRONG> command, this implementation can actu- -+ ally compile termcap sources. In fact, entries in ter- -+ minfo and termcap syntax can be mixed in a single source -+ file. See <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG> for the list of termcap names taken -+ to be equivalent to terminfo names. - - The SVr4 manual pages are not clear on the resolution - rules for <STRONG>use</STRONG> capabilities. This implementation of <STRONG>tic</STRONG> - will find <STRONG>use</STRONG> targets anywhere in the source file, or any- - where in the file tree rooted at <STRONG>TERMINFO</STRONG> (if <STRONG>TERMINFO</STRONG> is -- defined), or in the user's <EM>$HOME/.terminfo</EM> directory (if -- it exists), or (finally) anywhere in the system's file -- tree of compiled entries. -+ defined), or in the user's <EM>$HOME/.terminfo</EM> database (if it -+ exists), or (finally) anywhere in the system's file tree -+ of compiled entries. - - The error messages from this <STRONG>tic</STRONG> have the same format as - GNU C error messages, and can be parsed by GNU Emacs's - compile facility. - -- The <STRONG>-C</STRONG>, <STRONG>-G</STRONG>, <STRONG>-I</STRONG>, <STRONG>-N</STRONG>, <STRONG>-R</STRONG>, <STRONG>-T</STRONG>, <STRONG>-V</STRONG>, <STRONG>-a</STRONG>, <STRONG>-e</STRONG>, <STRONG>-f</STRONG>, <STRONG>-g</STRONG>, <STRONG>-o</STRONG>, <STRONG>-r</STRONG>, -- <STRONG>-s</STRONG>, <STRONG>-t</STRONG> and <STRONG>-x</STRONG> options are not supported under SVr4. The -- SVr4 <STRONG>-c</STRONG> mode does not report bad use links. -+ The <STRONG>-0</STRONG>, <STRONG>-1</STRONG>, <STRONG>-C</STRONG>, <STRONG>-G</STRONG>, <STRONG>-I</STRONG>, <STRONG>-N</STRONG>, <STRONG>-R</STRONG>, <STRONG>-T</STRONG>, <STRONG>-V</STRONG>, <STRONG>-a</STRONG>, <STRONG>-e</STRONG>, <STRONG>-f</STRONG>, <STRONG>-g</STRONG>, -+ <STRONG>-o</STRONG>, <STRONG>-r</STRONG>, <STRONG>-s</STRONG>, <STRONG>-t</STRONG> and <STRONG>-x</STRONG> options are not supported under -+ SVr4. The SVr4 <STRONG>-c</STRONG> mode does not report bad use links. - - System V does not compile entries to or read entries from -- your <EM>$HOME/.terminfo</EM> directory unless TERMINFO is explic- -+ your <EM>$HOME/.terminfo</EM> database unless TERMINFO is explic- - itly set to it. - - -@@ -307,9 +366,9 @@ - </PRE> - <H2>SEE ALSO</H2><PRE> - <STRONG><A HREF="infocmp.1m.html">infocmp(1m)</A></STRONG>, <STRONG><A HREF="captoinfo.1m.html">captoinfo(1m)</A></STRONG>, <STRONG><A HREF="infotocap.1m.html">infotocap(1m)</A></STRONG>, <STRONG><A HREF="toe.1m.html">toe(1m)</A></STRONG>, -- <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>, <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG>. -+ <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>, <STRONG><A HREF="term.5.html">term(5)</A></STRONG>. <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG>. - -- This describes <STRONG>ncurses</STRONG> version 5.9 (patch 20110404). -+ This describes <STRONG>ncurses</STRONG> version 5.9 (patch 20131221). - - - </PRE> -diff -Naur ncurses-5.9/doc/html/man/toe.1m.html ncurses-5.9.patch/doc/html/man/toe.1m.html ---- ncurses-5.9/doc/html/man/toe.1m.html 2011-04-05 00:46:51.000000000 +0200 -+++ ncurses-5.9.patch/doc/html/man/toe.1m.html 2014-09-01 16:33:22.335792088 +0200 -@@ -1,7 +1,7 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - **************************************************************************** -- * Copyright (c) 1998-2008,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2010,2011 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -27,7 +27,7 @@ - * sale, use or other dealings in this Software without prior written * - * authorization. * - **************************************************************************** -- * @Id: toe.1m,v 1.23 2010/12/04 18:40:45 tom Exp @ -+ * @Id: toe.1m,v 1.26 2012/01/01 00:40:51 tom Exp @ - --> - <HTML> - <HEAD> -@@ -52,7 +52,7 @@ - - </PRE> - <H2>SYNOPSIS</H2><PRE> -- <STRONG>toe</STRONG> [<STRONG>-v</STRONG>[<EM>n</EM>]] [<STRONG>-ahuUV</STRONG>] <EM>file...</EM> -+ <STRONG>toe</STRONG> [<STRONG>-v</STRONG>[<EM>n</EM>]] [<STRONG>-ahsuUV</STRONG>] <EM>file...</EM> - - - </PRE> -@@ -71,6 +71,14 @@ - ncurses would search, rather than only the first - one that it finds. - -+ If the <STRONG>-s</STRONG> is also given, <STRONG>toe</STRONG> adds a column to the -+ report, showing (like <STRONG>conflict(1)</STRONG>) which entries -+ which belong to a given terminal database. An "*" -+ marks entries which differ, and "+" marks equiva- -+ lent entries. -+ -+ <STRONG>-s</STRONG> sort the output by the entry names. -+ - <STRONG>-u</STRONG> <EM>file</EM> - says to write a report to the standard output, - listing dependencies in the given terminfo/termcap -@@ -111,7 +119,7 @@ - <STRONG><A HREF="tic.1m.html">tic(1m)</A></STRONG>, <STRONG><A HREF="infocmp.1m.html">infocmp(1m)</A></STRONG>, <STRONG><A HREF="captoinfo.1m.html">captoinfo(1m)</A></STRONG>, <STRONG><A HREF="infotocap.1m.html">infotocap(1m)</A></STRONG>, - <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>, <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG>. - -- This describes <STRONG>ncurses</STRONG> version 5.9 (patch 20110404). -+ This describes <STRONG>ncurses</STRONG> version 5.9 (patch 20131221). - - - -diff -Naur ncurses-5.9/doc/html/man/tput.1.html ncurses-5.9.patch/doc/html/man/tput.1.html ---- ncurses-5.9/doc/html/man/tput.1.html 2011-04-05 00:46:51.000000000 +0200 -+++ ncurses-5.9.patch/doc/html/man/tput.1.html 2014-09-01 16:33:22.336792090 +0200 -@@ -1,8 +1,8 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - * t - **************************************************************************** -- * Copyright (c) 1998-2006,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -28,7 +28,7 @@ - * sale, use or other dealings in this Software without prior written * - * authorization. * - **************************************************************************** -- * @Id: tput.1,v 1.29 2010/12/04 18:41:07 tom Exp @ -+ * @Id: tput.1,v 1.32 2012/07/14 21:06:45 tom Exp @ - --> - <HTML> - <HEAD> -@@ -66,7 +66,7 @@ - <H2>DESCRIPTION</H2><PRE> - The <STRONG>tput</STRONG> utility uses the <STRONG>terminfo</STRONG> database to make the - values of terminal-dependent capabilities and information -- available to the shell (see <STRONG><A HREF="sh.1.html">sh(1)</A></STRONG>), to initialize or reset -+ available to the shell (see <STRONG>sh(1)</STRONG>), to initialize or reset - the terminal, or return the long name of the requested - terminal type. The result depends upon the capability's - type: -@@ -87,7 +87,7 @@ - - Before using a value returned on the standard output, the - application should test the exit code (e.g., <STRONG>$?</STRONG>, see -- <STRONG><A HREF="sh.1.html">sh(1)</A></STRONG>) to be sure it is <STRONG>0</STRONG>. (See the <STRONG>EXIT</STRONG> <STRONG>CODES</STRONG> and <STRONG>DIAG-</STRONG> -+ <STRONG>sh(1)</STRONG>) to be sure it is <STRONG>0</STRONG>. (See the <STRONG>EXIT</STRONG> <STRONG>CODES</STRONG> and <STRONG>DIAG-</STRONG> - <STRONG>NOSTICS</STRONG> sections.) For a complete list of capabilities - and the <EM>capname</EM> associated with each, see <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG>. - -@@ -95,54 +95,53 @@ - option is unnecessary, because the default is taken - from the environment variable <STRONG>TERM</STRONG>. If <STRONG>-T</STRONG> is spec- - ified, then the shell variables <STRONG>LINES</STRONG> and <STRONG>COLUMNS</STRONG> -- will be ignored,and the operating system will not -- be queried for the actual screen size. -+ will also be ignored. - - <EM>capname</EM> -- indicates the capability from the <STRONG>terminfo</STRONG> -- database. When <STRONG>termcap</STRONG> support is compiled in, the -+ indicates the capability from the <STRONG>terminfo</STRONG> data- -+ base. When <STRONG>termcap</STRONG> support is compiled in, the - <STRONG>termcap</STRONG> name for the capability is also accepted. - -- <EM>parms</EM> If the capability is a string that takes parame- -+ <EM>parms</EM> If the capability is a string that takes parame- - ters, the arguments <EM>parms</EM> will be instantiated into - the string. - -- Most parameters are numbers. Only a few terminfo -+ Most parameters are numbers. Only a few terminfo - capabilities require string parameters; <STRONG>tput</STRONG> uses a - table to decide which to pass as strings. Normally -- <STRONG>tput</STRONG> uses <STRONG>tparm</STRONG> (3x) to perform the substitution. -+ <STRONG>tput</STRONG> uses <STRONG>tparm</STRONG> (3x) to perform the substitution. - If no parameters are given for the capability, <STRONG>tput</STRONG> -- writes the string without performing the -- substitution. -+ writes the string without performing the substitu- -+ tion. - -- <STRONG>-S</STRONG> allows more than one capability per invocation of -+ <STRONG>-S</STRONG> allows more than one capability per invocation of - <STRONG>tput</STRONG>. The capabilities must be passed to <STRONG>tput</STRONG> from - the standard input instead of from the command line -- (see example). Only one <EM>capname</EM> is allowed per -- line. The <STRONG>-S</STRONG> option changes the meaning of the <STRONG>0</STRONG> -- and <STRONG>1</STRONG> boolean and string exit codes (see the EXIT -+ (see example). Only one <EM>capname</EM> is allowed per -+ line. The <STRONG>-S</STRONG> option changes the meaning of the <STRONG>0</STRONG> -+ and <STRONG>1</STRONG> boolean and string exit codes (see the EXIT - CODES section). - - Again, <STRONG>tput</STRONG> uses a table and the presence of param- -- eters in its input to decide whether to use <STRONG>tparm</STRONG> -+ eters in its input to decide whether to use <STRONG>tparm</STRONG> - (3x), and how to interpret the parameters. - -- <STRONG>-V</STRONG> reports the version of ncurses which was used in -+ <STRONG>-V</STRONG> reports the version of ncurses which was used in - this program, and exits. - -- <STRONG>init</STRONG> If the <STRONG>terminfo</STRONG> database is present and an entry -+ <STRONG>init</STRONG> If the <STRONG>terminfo</STRONG> database is present and an entry - for the user's terminal exists (see <STRONG>-T</STRONG><EM>type</EM>, above), - the following will occur: - -- (1) if present, the terminal's initialization -- strings will be output as detailed in the -- <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG> section on <EM>Tabs</EM> <EM>and</EM> <EM>Initializa-</EM> -+ (1) if present, the terminal's initialization -+ strings will be output as detailed in the -+ <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG> section on <EM>Tabs</EM> <EM>and</EM> <EM>Initializa-</EM> - <EM>tion</EM>, - -- (2) any delays (e.g., newline) specified in the -+ (2) any delays (e.g., newline) specified in the - entry will be set in the tty driver, - -- (3) tabs expansion will be turned on or off -+ (3) tabs expansion will be turned on or off - according to the specification in the entry, - and - -@@ -153,22 +152,22 @@ - for any of the four above activities, that activity - will silently be skipped. - -- <STRONG>reset</STRONG> Instead of putting out initialization strings, the -- terminal's reset strings will be output if present -- (<STRONG>rs1</STRONG>, <STRONG>rs2</STRONG>, <STRONG>rs3</STRONG>, <STRONG>rf</STRONG>). If the reset strings are not -- present, but initialization strings are, the ini- -- tialization strings will be output. Otherwise, -+ <STRONG>reset</STRONG> Instead of putting out initialization strings, the -+ terminal's reset strings will be output if present -+ (<STRONG>rs1</STRONG>, <STRONG>rs2</STRONG>, <STRONG>rs3</STRONG>, <STRONG>rf</STRONG>). If the reset strings are not -+ present, but initialization strings are, the ini- -+ tialization strings will be output. Otherwise, - <STRONG>reset</STRONG> acts identically to <STRONG>init</STRONG>. - - <STRONG>longname</STRONG> -- If the <STRONG>terminfo</STRONG> database is present and an entry -- for the user's terminal exists (see <STRONG>-T</STRONG><EM>type</EM> above), -+ If the <STRONG>terminfo</STRONG> database is present and an entry -+ for the user's terminal exists (see <STRONG>-T</STRONG><EM>type</EM> above), - then the long name of the terminal will be put out. - The long name is the last name in the first line of - the terminal's description in the <STRONG>terminfo</STRONG> database - [see <STRONG><A HREF="term.5.html">term(5)</A></STRONG>]. - -- If <STRONG>tput</STRONG> is invoked by a link named <STRONG>reset</STRONG>, this has the -+ If <STRONG>tput</STRONG> is invoked by a link named <STRONG>reset</STRONG>, this has the - same effect as <STRONG>tput</STRONG> <STRONG>reset</STRONG>. See <STRONG>tset</STRONG> for comparison, which - has similar behavior. - -@@ -177,13 +176,13 @@ - <H2>EXAMPLES</H2><PRE> - <STRONG>tput</STRONG> <STRONG>init</STRONG> - Initialize the terminal according to the type of ter- -- minal in the environmental variable <STRONG>TERM</STRONG>. This com- -- mand should be included in everyone's .profile after -+ minal in the environmental variable <STRONG>TERM</STRONG>. This com- -+ mand should be included in everyone's .profile after - the environmental variable <STRONG>TERM</STRONG> has been exported, as -- illustrated on the <STRONG><A HREF="profile.5.html">profile(5)</A></STRONG> manual page. -+ illustrated on the <STRONG>profile(5)</STRONG> manual page. - - <STRONG>tput</STRONG> <STRONG>-T5620</STRONG> <STRONG>reset</STRONG> -- Reset an AT&amp;T 5620 terminal, overriding the type of -+ Reset an AT&amp;T 5620 terminal, overriding the type of - terminal in the environmental variable <STRONG>TERM</STRONG>. - - <STRONG>tput</STRONG> <STRONG>cup</STRONG> <STRONG>0</STRONG> <STRONG>0</STRONG> -@@ -263,29 +262,29 @@ - type of <EM>capname</EM>: - - <EM>boolean</EM> -- a value of <STRONG>0</STRONG> is set for TRUE and <STRONG>1</STRONG> for FALSE. -+ a value of <STRONG>0</STRONG> is set for TRUE and <STRONG>1</STRONG> for FALSE. - -- <EM>string</EM> a value of <STRONG>0</STRONG> is set if the <EM>capname</EM> is defined -- for this terminal <EM>type</EM> (the value of <EM>capname</EM> -- is returned on standard output); a value of <STRONG>1</STRONG> -+ <EM>string</EM> a value of <STRONG>0</STRONG> is set if the <EM>capname</EM> is defined -+ for this terminal <EM>type</EM> (the value of <EM>capname</EM> -+ is returned on standard output); a value of <STRONG>1</STRONG> - is set if <EM>capname</EM> is not defined for this ter- -- minal <EM>type</EM> (nothing is written to standard -+ minal <EM>type</EM> (nothing is written to standard - output). - - <EM>integer</EM> -- a value of <STRONG>0</STRONG> is always set, whether or not -+ a value of <STRONG>0</STRONG> is always set, whether or not - <EM>capname</EM> is defined for this terminal <EM>type</EM>. To -- determine if <EM>capname</EM> is defined for this ter- -+ determine if <EM>capname</EM> is defined for this ter- - minal <EM>type</EM>, the user must test the value writ- -- ten to standard output. A value of <STRONG>-1</STRONG> means -- that <EM>capname</EM> is not defined for this terminal -+ ten to standard output. A value of <STRONG>-1</STRONG> means -+ that <EM>capname</EM> is not defined for this terminal - <EM>type</EM>. - -- <EM>other</EM> <STRONG>reset</STRONG> or <STRONG>init</STRONG> may fail to find their respec- -- tive files. In that case, the exit code is -+ <EM>other</EM> <STRONG>reset</STRONG> or <STRONG>init</STRONG> may fail to find their respec- -+ tive files. In that case, the exit code is - set to 4 + <STRONG>errno</STRONG>. - -- Any other exit code indicates an error; see the DIAGNOS- -+ Any other exit code indicates an error; see the DIAGNOS- - TICS section. - - -@@ -294,11 +293,10 @@ - <STRONG>tput</STRONG> prints the following error messages and sets the cor- - responding exit codes. - -- - exit code error message - --------------------------------------------------------------------- -- <STRONG>0</STRONG> (<EM>capname</EM> is a numeric variable that is not specified in -- the <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG> database for this terminal type, e.g. -+ <STRONG>0</STRONG> (<EM>capname</EM> is a numeric variable that is not specified in -+ the <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG> database for this terminal type, e.g. - <STRONG>tput</STRONG> <STRONG>-T450</STRONG> <STRONG>lines</STRONG> and <STRONG>tput</STRONG> <STRONG>-T2621</STRONG> <STRONG>xmc</STRONG>) - <STRONG>1</STRONG> no error message is printed, see the <STRONG>EXIT</STRONG> <STRONG>CODES</STRONG> section. - <STRONG>2</STRONG> usage error -@@ -310,25 +308,37 @@ - - </PRE> - <H2>PORTABILITY</H2><PRE> -- The <STRONG>longname</STRONG> and <STRONG>-S</STRONG> options, and the parameter-substitu- -- tion features used in the <STRONG>cup</STRONG> example, are not supported -+ The <STRONG>longname</STRONG> and <STRONG>-S</STRONG> options, and the parameter-substitu- -+ tion features used in the <STRONG>cup</STRONG> example, are not supported - in BSD curses or in AT&amp;T/USL curses before SVr4. - -- X/Open documents only the operands for <STRONG>clear</STRONG>, <STRONG>init</STRONG> and -- <STRONG>reset</STRONG>. In this implementation, <STRONG>clear</STRONG> is part of the <EM>cap-</EM> -+ X/Open documents only the operands for <STRONG>clear</STRONG>, <STRONG>init</STRONG> and -+ <STRONG>reset</STRONG>. In this implementation, <STRONG>clear</STRONG> is part of the <EM>cap-</EM> - <EM>name</EM> support. Other implementations of <STRONG>tput</STRONG> on SVr4-based - systems such as Solaris, IRIX64 and HPUX as well as others -- such as AIX and Tru64 provide support for <EM>capname</EM> -- operands. A few platforms such as FreeBSD and NetBSD rec- -- ognize termcap names rather than terminfo capability names -- in their respective <STRONG>tput</STRONG> commands. -+ such as AIX and Tru64 provide support for <EM>capname</EM> oper- -+ ands. -+ -+ A few platforms such as FreeBSD and NetBSD recognize term- -+ cap names rather than terminfo capability names in their -+ respective <STRONG>tput</STRONG> commands. -+ -+ Most implementations which provide support for <EM>capname</EM> op- -+ erands use the <EM>tparm</EM> function to expand parameters in it. -+ That function expects a mixture of numeric and string -+ parameters, requiring <STRONG>tput</STRONG> to know which type to use. -+ This implementation uses a table to determine that for the -+ standard <EM>capname</EM> operands, and an internal library func- -+ tion to analyze nonstandard <EM>capname</EM> operands. Other -+ implementations may simply guess that an operand contain- -+ ing only digits is intended to be a number. - - - </PRE> - <H2>SEE ALSO</H2><PRE> -- <STRONG><A HREF="clear.1.html">clear(1)</A></STRONG>, <STRONG><A HREF="stty.1.html">stty(1)</A></STRONG>, <STRONG><A HREF="tabs.1.html">tabs(1)</A></STRONG>, <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG>. -+ <STRONG><A HREF="clear.1.html">clear(1)</A></STRONG>, <STRONG>stty(1)</STRONG>, <STRONG><A HREF="tabs.1.html">tabs(1)</A></STRONG>, <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG>, <STRONG><A HREF="curs_termcap.3x.html">curs_termcap(3x)</A></STRONG>. - -- This describes <STRONG>ncurses</STRONG> version 5.9 (patch 20110404). -+ This describes <STRONG>ncurses</STRONG> version 5.9 (patch 20131221). - - - -diff -Naur ncurses-5.9/doc/html/man/tset.1.html ncurses-5.9.patch/doc/html/man/tset.1.html ---- ncurses-5.9/doc/html/man/tset.1.html 2011-04-05 00:46:52.000000000 +0200 -+++ ncurses-5.9.patch/doc/html/man/tset.1.html 2014-09-01 16:33:22.336792090 +0200 -@@ -1,7 +1,7 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - **************************************************************************** -- * Copyright (c) 1998-2008,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2011,2013 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -27,7 +27,7 @@ - * sale, use or other dealings in this Software without prior written * - * authorization. * - **************************************************************************** -- * @Id: tset.1,v 1.25 2010/12/04 18:38:55 tom Exp @ -+ * @Id: tset.1,v 1.28 2013/07/20 19:40:55 tom Exp @ - --> - <HTML> - <HEAD> -@@ -74,14 +74,14 @@ - tion, <EM>getty</EM> does this job by setting <STRONG>TERM</STRONG> according to the - type passed to it by <EM>/etc/inittab</EM>.) - -- 4. The default terminal type, ``unknown''. -+ 4. The default terminal type, "unknown". - - If the terminal type was not specified on the command- - line, the <STRONG>-m</STRONG> option mappings are then applied (see the - section <STRONG>TERMINAL</STRONG> <STRONG>TYPE</STRONG> <STRONG>MAPPING</STRONG> for more information). - Then, if the terminal type begins with a question mark -- (``?''), the user is prompted for confirmation of the ter- -- minal type. An empty response confirms the type, or, -+ ("?"), the user is prompted for confirmation of the termi- -+ nal type. An empty response confirms the type, or, - another type can be entered to specify a new type. Once - the terminal type has been determined, the terminfo entry - for the terminal is retrieved. If no terminfo entry is -@@ -116,8 +116,9 @@ - - The options are as follows: - -- <STRONG>-c</STRONG> Set control characters and modes. <STRONG>-e</STRONG> Set the erase -- character to <EM>ch</EM>. -+ <STRONG>-c</STRONG> Set control characters and modes. -+ -+ <STRONG>-e</STRONG> Set the erase character to <EM>ch</EM>. - - <STRONG>-I</STRONG> Do not send the terminal or tab initialization - strings to the terminal. -@@ -126,36 +127,35 @@ - - <STRONG>-k</STRONG> Set the line kill character to <EM>ch</EM>. - -- <STRONG>-m</STRONG> Specify a mapping from a port type to a terminal. -+ <STRONG>-m</STRONG> Specify a mapping from a port type to a terminal. - See the section <STRONG>TERMINAL</STRONG> <STRONG>TYPE</STRONG> <STRONG>MAPPING</STRONG> for more infor- - mation. - -- <STRONG>-Q</STRONG> Do not display any values for the erase, interrupt -+ <STRONG>-Q</STRONG> Do not display any values for the erase, interrupt - and line kill characters. Normally <STRONG>tset</STRONG> displays the -- values for control characters which differ from the -+ values for control characters which differ from the - system's default values. - -- <STRONG>-q</STRONG> The terminal type is displayed to the standard out- -- put, and the terminal is not initialized in any way. -+ <STRONG>-q</STRONG> The terminal type is displayed to the standard out- -+ put, and the terminal is not initialized in any way. - The option `-' by itself is equivalent but archaic. - - <STRONG>-r</STRONG> Print the terminal type to the standard error output. - - <STRONG>-s</STRONG> Print the sequence of shell commands to initialize - the environment variable <STRONG>TERM</STRONG> to the standard output. -- See the section <STRONG>SETTING</STRONG> <STRONG>THE</STRONG> <STRONG>ENVIRONMENT</STRONG> for details. -+ See the section <STRONG>SETTING</STRONG> <STRONG>THE</STRONG> <STRONG>ENVIRONMENT</STRONG> for details. - - <STRONG>-V</STRONG> reports the version of ncurses which was used in this - program, and exits. - -- <STRONG>-w</STRONG> Resize the window to match the size deduced via -+ <STRONG>-w</STRONG> Resize the window to match the size deduced via - <STRONG>setupterm</STRONG>. Normally this has no effect, unless - <STRONG>setupterm</STRONG> is not able to detect the window size. - - The arguments for the <STRONG>-e</STRONG>, <STRONG>-i</STRONG>, and <STRONG>-k</STRONG> options may either be -- entered as actual characters or by using the `hat' nota- -- tion, i.e., control-h may be specified as ``^H'' or -- ``^h''. -+ entered as actual characters or by using the `hat' nota- -+ tion, i.e., control-h may be specified as "^H" or "^h". - - - </PRE> -@@ -167,7 +167,7 @@ - When the <STRONG>-s</STRONG> option is specified, the commands to enter the - information into the shell's environment are written to - the standard output. If the <STRONG>SHELL</STRONG> environmental variable -- ends in ``csh'', the commands are for <STRONG>csh</STRONG>, otherwise, they -+ ends in "csh", the commands are for <STRONG>csh</STRONG>, otherwise, they - are for <STRONG>sh</STRONG>. Note, the <STRONG>csh</STRONG> commands set and unset the - shell variable <STRONG>noglob</STRONG>, leaving it unset. The following - line in the <STRONG>.login</STRONG> or <STRONG>.profile</STRONG> files will initialize the -@@ -187,21 +187,21 @@ - terminal used on such ports. - - The purpose of the <STRONG>-m</STRONG> option is to map from some set of -- conditions to a terminal type, that is, to tell <STRONG>tset</STRONG> ``If -+ conditions to a terminal type, that is, to tell <STRONG>tset</STRONG> "If - I'm on this port at a particular speed, guess that I'm on -- that kind of terminal''. -+ that kind of terminal". - - The argument to the <STRONG>-m</STRONG> option consists of an optional port - type, an optional operator, an optional baud rate specifi- -- cation, an optional colon (``:'') character and a terminal -+ cation, an optional colon (":") character and a terminal - type. The port type is a string (delimited by either the - operator or the colon character). The operator may be any -- combination of ``&gt;'', ``&lt;'', ``@'', and ``!''; ``&gt;'' means -- greater than, ``&lt;'' means less than, ``@'' means equal to -- and ``!'' inverts the sense of the test. The baud rate is -- specified as a number and is compared with the speed of -- the standard error output (which should be the control -- terminal). The terminal type is a string. -+ combination of "&gt;", "&lt;", "@", and "!"; "&gt;" means greater -+ than, "&lt;" means less than, "@" means equal to and "!" -+ inverts the sense of the test. The baud rate is specified -+ as a number and is compared with the speed of the standard -+ error output (which should be the control terminal). The -+ terminal type is a string. - - If the terminal type is not specified on the command line, - the <STRONG>-m</STRONG> mappings are applied to the terminal type. If the -@@ -232,8 +232,8 @@ - argument. Also, to avoid problems with meta-characters, - it is suggested that the entire <STRONG>-m</STRONG> option argument be - placed within single quote characters, and that <STRONG>csh</STRONG> users -- insert a backslash character (``\'') before any exclama- -- tion marks (``!''). -+ insert a backslash character ("\") before any exclamation -+ marks ("!"). - - - </PRE> -@@ -248,14 +248,14 @@ - <H2>COMPATIBILITY</H2><PRE> - The <STRONG>tset</STRONG> utility has been provided for backward-compati- - bility with BSD environments (under most modern UNIXes, -- <STRONG>/etc/inittab</STRONG> and <STRONG><A HREF="getty.1.html">getty(1)</A></STRONG> can set <STRONG>TERM</STRONG> appropriately for -+ <STRONG>/etc/inittab</STRONG> and <STRONG>getty(1)</STRONG> can set <STRONG>TERM</STRONG> appropriately for - each dial-up line; this obviates what was <STRONG>tset</STRONG>'s most - important use). This implementation behaves like 4.4BSD - tset, with a few exceptions specified here. - - The <STRONG>-S</STRONG> option of BSD tset no longer works; it prints an - error message to stderr and dies. The <STRONG>-s</STRONG> option only sets -- <STRONG>TERM</STRONG>, not <STRONG>TERMCAP</STRONG>. Both these changes are because the -+ <STRONG>TERM</STRONG>, not <STRONG>TERMCAP</STRONG>. Both of these changes are because the - <STRONG>TERMCAP</STRONG> variable is no longer supported under terminfo- - based <STRONG>ncurses</STRONG>, which makes <STRONG>tset</STRONG> <STRONG>-S</STRONG> useless (we made it die - noisily rather than silently induce lossage). -@@ -316,10 +316,10 @@ - - </PRE> - <H2>SEE ALSO</H2><PRE> -- <STRONG><A HREF="csh.1.html">csh(1)</A></STRONG>, <STRONG><A HREF="sh.1.html">sh(1)</A></STRONG>, <STRONG><A HREF="stty.1.html">stty(1)</A></STRONG>, <STRONG><A HREF="curs_terminfo.3x.html">curs_terminfo(3x)</A></STRONG>, <STRONG><A HREF="tty.4.html">tty(4)</A></STRONG>, ter- -- <STRONG><A HREF="minfo.5.html">minfo(5)</A></STRONG>, <STRONG><A HREF="ttys.5.html">ttys(5)</A></STRONG>, <STRONG><A HREF="environ.7.html">environ(7)</A></STRONG> -+ <STRONG>csh(1)</STRONG>, <STRONG>sh(1)</STRONG>, <STRONG>stty(1)</STRONG>, <STRONG><A HREF="curs_terminfo.3x.html">curs_terminfo(3x)</A></STRONG>, <STRONG>tty(4)</STRONG>, -+ <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG>, <STRONG>ttys(5)</STRONG>, <STRONG>environ(7)</STRONG> - -- This describes <STRONG>ncurses</STRONG> version 5.9 (patch 20110404). -+ This describes <STRONG>ncurses</STRONG> version 5.9 (patch 20131221). - - - -diff -Naur ncurses-5.9/doc/html/man/wresize.3x.html ncurses-5.9.patch/doc/html/man/wresize.3x.html ---- ncurses-5.9/doc/html/man/wresize.3x.html 2011-01-09 02:03:30.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/man/wresize.3x.html 2014-09-01 16:33:22.336792090 +0200 -@@ -1,4 +1,4 @@ --<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- - **************************************************************************** - * Copyright (c) 1998-2006,2010 Free Software Foundation, Inc. * -diff -Naur ncurses-5.9/doc/html/ncurses-intro.html ncurses-5.9.patch/doc/html/ncurses-intro.html ---- ncurses-5.9/doc/html/ncurses-intro.html 2010-12-04 17:46:22.000000000 +0100 -+++ ncurses-5.9.patch/doc/html/ncurses-intro.html 2014-09-01 16:33:22.336792090 +0200 -@@ -1,8 +1,8 @@ --<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> -+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> - <!-- -- $Id: ncurses-intro.html,v 1.44 2010/12/04 16:46:22 tom Exp $ -+ $Id: ncurses-intro.html,v 1.46 2013/05/17 23:29:27 tom Exp $ - **************************************************************************** -- * Copyright (c) 1998-2007,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -431,6 +431,7 @@ - Here is a sample program to motivate the discussion: - - <PRE> -+#include &lt;stdlib.h&gt; - #include &lt;curses.h&gt; - #include &lt;signal.h&gt; - -diff -Naur ncurses-5.9/doc/html/NCURSES-Programming-HOWTO.html ncurses-5.9.patch/doc/html/NCURSES-Programming-HOWTO.html ---- ncurses-5.9/doc/html/NCURSES-Programming-HOWTO.html 2005-06-21 23:50:00.000000000 +0200 -+++ ncurses-5.9.patch/doc/html/NCURSES-Programming-HOWTO.html 2014-09-01 16:33:22.266791973 +0200 -@@ -1,516 +1,1282 @@ --<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> --<html> --<head> --<meta name="generator" content= --"HTML Tidy for Linux/x86 (vers 1st December 2004), see www.w3.org"> --<title>NCURSES Programming HOWTO</title> --<meta name="GENERATOR" content= --"Modular DocBook HTML Stylesheet Version 1.7"> --</head> --<body class="ARTICLE" bgcolor="#FFFFFF" text="#000000" link= --"#0000FF" vlink="#840084" alink="#0000FF"> --<div class="ARTICLE"> --<div class="TITLEPAGE"> --<h1 class="TITLE"><a name="AEN2" id="AEN2">NCURSES Programming --HOWTO</a></h1> --<h3 class="AUTHOR"><a name="AEN4" id="AEN4">Pradeep Padala</a></h3> --<div class="AFFILIATION"> --<div class="ADDRESS"> --<p class="ADDRESS"><code class="EMAIL">&lt;<a href= --"mailto:ppadala@gmail.com">ppadala@gmail.com</a>&gt;</code></p> --</div> --</div> --<p class="PUBDATE">v1.9, 2005-06-20<br></p> --<div class="REVHISTORY"> --<table width="100%" border="0"> --<tr> --<th align="left" valign="top" colspan="3"><b>Revision --History</b></th> --</tr> --<tr> --<td align="left">Revision 1.9</td> --<td align="left">2005-06-20</td> --<td align="left">Revised by: ppadala</td> --</tr> --<tr> --<td align="left" colspan="3">The license has been changed to the --MIT-style license used by NCURSES. Note that the programs are also --re-licensed under this.</td> --</tr> --<tr> --<td align="left">Revision 1.8</td> --<td align="left">2005-06-17</td> --<td align="left">Revised by: ppadala</td> --</tr> --<tr> --<td align="left" colspan="3">Lots of updates. Added references and --perl examples. Changes to examples. Many grammatical and stylistic --changes to the content. Changes to NCURSES history.</td> --</tr> --<tr> --<td align="left">Revision 1.7.1</td> --<td align="left">2002-06-25</td> --<td align="left">Revised by: ppadala</td> --</tr> --<tr> --<td align="left" colspan="3">Added a README file for building and --instructions for building from source.</td> --</tr> --<tr> --<td align="left">Revision 1.7</td> --<td align="left">2002-06-25</td> --<td align="left">Revised by: ppadala</td> --</tr> --<tr> --<td align="left" colspan="3">Added "Other formats" section and made --a lot of fancy changes to the programs. Inlining of programs is --gone.</td> --</tr> --<tr> --<td align="left">Revision 1.6.1</td> --<td align="left">2002-02-24</td> --<td align="left">Revised by: ppadala</td> --</tr> --<tr> --<td align="left" colspan="3">Removed the old Changelog section, --cleaned the makefiles</td> --</tr> --<tr> --<td align="left">Revision 1.6</td> --<td align="left">2002-02-16</td> --<td align="left">Revised by: ppadala</td> --</tr> --<tr> --<td align="left" colspan="3">Corrected a lot of spelling mistakes, --added ACS variables section</td> --</tr> --<tr> --<td align="left">Revision 1.5</td> --<td align="left">2002-01-05</td> --<td align="left">Revised by: ppadala</td> --</tr> --<tr> --<td align="left" colspan="3">Changed structure to present proper --TOC</td> --</tr> --<tr> --<td align="left">Revision 1.3.1</td> --<td align="left">2001-07-26</td> --<td align="left">Revised by: ppadala</td> --</tr> --<tr> --<td align="left" colspan="3">Corrected maintainers paragraph, --Corrected stable release number</td> --</tr> --<tr> --<td align="left">Revision 1.3</td> --<td align="left">2001-07-24</td> --<td align="left">Revised by: ppadala</td> --</tr> --<tr> --<td align="left" colspan="3">Added copyright notices to main --document (LDP license) and programs (GPL), Corrected --printw_example.</td> --</tr> --<tr> --<td align="left">Revision 1.2</td> --<td align="left">2001-06-05</td> --<td align="left">Revised by: ppadala</td> --</tr> --<tr> --<td align="left" colspan="3">Incorporated ravi's changes. Mainly to --introduction, menu, form, justforfun sections</td> --</tr> --<tr> --<td align="left">Revision 1.1</td> --<td align="left">2001-05-22</td> --<td align="left">Revised by: ppadala</td> --</tr> --<tr> --<td align="left" colspan="3">Added "a word about window" section, --Added scanw_example.</td> --</tr> --</table> --</div> --<div> --<div class="ABSTRACT"><a name="AEN67" id="AEN67"></a> --<p><em>This document is intended to be an "All in One" guide for --programming with ncurses and its sister libraries. We graduate from --a simple "Hello World" program to more complex form manipulation. --No prior experience in ncurses is assumed. Send comments to --<a href="mailto:ppadala@gmail.com" target="_top">this --address</a></em></p> --</div> --</div> --<hr></div> --<div class="TOC"> --<dl> --<dt><b>Table of Contents</b></dt> --<dt>1. <a href="#INTRO">Introduction</a></dt> --<dd> --<dl> --<dt>1.1. <a href="#WHATIS">What is NCURSES?</a></dt> --<dt>1.2. <a href="#WHATCANWEDO">What we can do with --NCURSES</a></dt> --<dt>1.3. <a href="#WHERETOGETIT">Where to get it</a></dt> --<dt>1.4. <a href="#PURPOSE">Purpose/Scope of the document</a></dt> --<dt>1.5. <a href="#ABOUTPROGRAMS">About the Programs</a></dt> --<dt>1.6. <a href="#OTHERFORMATS">Other Formats of the --document</a></dt> --<dt>1.7. <a href="#CREDITS">Credits</a></dt> --<dt>1.8. <a href="#WISHLIST">Wish List</a></dt> --<dt>1.9. <a href="#COPYRIGHT">Copyright</a></dt> --</dl> --</dd> --<dt>2. <a href="#HELLOWORLD">Hello World !!!</a></dt> --<dd> --<dl> --<dt>2.1. <a href="#COMPILECURSES">Compiling With the NCURSES --Library</a></dt> --<dt>2.2. <a href="#DISSECTION">Dissection</a></dt> --</dl> --</dd> --<dt>3. <a href="#GORY">The Gory Details</a></dt> --<dt>4. <a href="#INIT">Initialization</a></dt> --<dd> --<dl> --<dt>4.1. <a href="#ABOUTINIT">Initialization functions</a></dt> --<dt>4.2. <a href="#RAWCBREAK">raw() and cbreak()</a></dt> --<dt>4.3. <a href="#ECHONOECHO">echo() and noecho()</a></dt> --<dt>4.4. <a href="#KEYPAD">keypad()</a></dt> --<dt>4.5. <a href="#HALFDELAY">halfdelay()</a></dt> --<dt>4.6. <a href="#MISCINIT">Miscellaneous Initialization --functions</a></dt> --<dt>4.7. <a href="#INITEX">An Example</a></dt> --</dl> --</dd> --<dt>5. <a href="#AWORDWINDOWS">A Word about Windows</a></dt> --<dt>6. <a href="#PRINTW">Output functions</a></dt> --<dd> --<dl> --<dt>6.1. <a href="#ADDCHCLASS">addch() class of functions</a></dt> --<dt>6.2. <a href="#AEN298">mvaddch(), waddch() and --mvwaddch()</a></dt> --<dt>6.3. <a href="#PRINTWCLASS">printw() class of --functions</a></dt> --<dt>6.4. <a href="#ADDSTRCLASS">addstr() class of --functions</a></dt> --<dt>6.5. <a href="#ACAUTION">A word of caution</a></dt> --</dl> --</dd> --<dt>7. <a href="#SCANW">Input functions</a></dt> --<dd> --<dl> --<dt>7.1. <a href="#GETCHCLASS">getch() class of functions</a></dt> --<dt>7.2. <a href="#SCANWCLASS">scanw() class of functions</a></dt> --<dt>7.3. <a href="#GETSTRCLASS">getstr() class of --functions</a></dt> --<dt>7.4. <a href="#GETSTREX">Some examples</a></dt> --</dl> --</dd> --<dt>8. <a href="#ATTRIB">Attributes</a></dt> --<dd> --<dl> --<dt>8.1. <a href="#ATTRIBDETAILS">The details</a></dt> --<dt>8.2. <a href="#ATTRONVSATTRSET">attron() vs attrset()</a></dt> --<dt>8.3. <a href="#ATTR_GET">attr_get()</a></dt> --<dt>8.4. <a href="#ATTR_FUNCS">attr_ functions</a></dt> --<dt>8.5. <a href="#WATTRFUNCS">wattr functions</a></dt> --<dt>8.6. <a href="#CHGAT">chgat() functions</a></dt> --</dl> --</dd> --<dt>9. <a href="#WINDOWS">Windows</a></dt> --<dd> --<dl> --<dt>9.1. <a href="#WINDOWBASICS">The basics</a></dt> --<dt>9.2. <a href="#LETBEWINDOW">Let there be a Window !!!</a></dt> --<dt>9.3. <a href="#BORDEREXEXPL">Explanation</a></dt> --<dt>9.4. <a href="#OTHERSTUFF">The other stuff in the --example</a></dt> --<dt>9.5. <a href="#OTHERBORDERFUNCS">Other Border --functions</a></dt> --</dl> --</dd> --<dt>10. <a href="#COLOR">Colors</a></dt> --<dd> --<dl> --<dt>10.1. <a href="#COLORBASICS">The basics</a></dt> --<dt>10.2. <a href="#CHANGECOLORDEFS">Changing Color --Definitions</a></dt> --<dt>10.3. <a href="#COLORCONTENT">Color Content</a></dt> --</dl> --</dd> --<dt>11. <a href="#KEYS">Interfacing with the key board</a></dt> --<dd> --<dl> --<dt>11.1. <a href="#KEYSBASICS">The Basics</a></dt> --<dt>11.2. <a href="#SIMPLEKEYEX">A Simple Key Usage --example</a></dt> --</dl> --</dd> --<dt>12. <a href="#MOUSE">Interfacing with the mouse</a></dt> --<dd> --<dl> --<dt>12.1. <a href="#MOUSEBASICS">The Basics</a></dt> --<dt>12.2. <a href="#GETTINGEVENTS">Getting the events</a></dt> --<dt>12.3. <a href="#MOUSETOGETHER">Putting it all Together</a></dt> --<dt>12.4. <a href="#MISCMOUSEFUNCS">Miscellaneous --Functions</a></dt> --</dl> --</dd> --<dt>13. <a href="#SCREEN">Screen Manipulation</a></dt> --<dd> --<dl> --<dt>13.1. <a href="#GETYX">getyx() functions</a></dt> --<dt>13.2. <a href="#SCREENDUMP">Screen Dumping</a></dt> --<dt>13.3. <a href="#WINDOWDUMP">Window Dumping</a></dt> --</dl> --</dd> --<dt>14. <a href="#MISC">Miscellaneous features</a></dt> --<dd> --<dl> --<dt>14.1. <a href="#CURSSET">curs_set()</a></dt> --<dt>14.2. <a href="#TEMPLEAVE">Temporarily Leaving Curses --mode</a></dt> --<dt>14.3. <a href="#ACSVARS">ACS_ variables</a></dt> --</dl> --</dd> --<dt>15. <a href="#OTHERLIB">Other libraries</a></dt> --<dt>16. <a href="#PANELS">Panel Library</a></dt> --<dd> --<dl> --<dt>16.1. <a href="#PANELBASICS">The Basics</a></dt> --<dt>16.2. <a href="#COMPILEPANELS">Compiling With the Panels --Library</a></dt> --<dt>16.3. <a href="#PANELBROWSING">Panel Window Browsing</a></dt> --<dt>16.4. <a href="#USERPTRUSING">Using User Pointers</a></dt> --<dt>16.5. <a href="#PANELMOVERESIZE">Moving and Resizing --Panels</a></dt> --<dt>16.6. <a href="#PANELSHOWHIDE">Hiding and Showing --Panels</a></dt> --<dt>16.7. <a href="#PANELABOVE">panel_above() and panel_below() --Functions</a></dt> --</dl> --</dd> --<dt>17. <a href="#MENUS">Menus Library</a></dt> --<dd> --<dl> --<dt>17.1. <a href="#MENUBASICS">The Basics</a></dt> --<dt>17.2. <a href="#COMPILEMENUS">Compiling With the Menu --Library</a></dt> --<dt>17.3. <a href="#MENUDRIVER">Menu Driver: The work horse of the --menu system</a></dt> --<dt>17.4. <a href="#MENUWINDOWS">Menu Windows</a></dt> --<dt>17.5. <a href="#SCROLLMENUS">Scrolling Menus</a></dt> --<dt>17.6. <a href="#MULTICOLUMN">Multi Columnar Menus</a></dt> --<dt>17.7. <a href="#MULTIVALUEMENUS">Multi Valued Menus</a></dt> --<dt>17.8. <a href="#MENUOPT">Menu Options</a></dt> --<dt>17.9. <a href="#MENUUSERPTR">The useful User Pointer</a></dt> --</dl> --</dd> --<dt>18. <a href="#FORMS">Forms Library</a></dt> --<dd> --<dl> --<dt>18.1. <a href="#FORMBASICS">The Basics</a></dt> --<dt>18.2. <a href="#COMPILEFORMS">Compiling With the Forms --Library</a></dt> --<dt>18.3. <a href="#PLAYFIELDS">Playing with Fields</a></dt> --<dt>18.4. <a href="#FORMWINDOWS">Form Windows</a></dt> --<dt>18.5. <a href="#FILEDVALIDATE">Field Validation</a></dt> --<dt>18.6. <a href="#FORMDRIVER">Form Driver: The work horse of the --forms system</a></dt> --</dl> --</dd> --<dt>19. <a href="#TOOLS">Tools and Widget Libraries</a></dt> --<dd> --<dl> --<dt>19.1. <a href="#CDK">CDK (Curses Development Kit)</a></dt> --<dt>19.2. <a href="#DIALOG">The dialog</a></dt> --<dt>19.3. <a href="#PERLCURSES">Perl Curses Modules CURSES::FORM --and CURSES::WIDGETS</a></dt> --</dl> --</dd> --<dt>20. <a href="#JUSTFORFUN">Just For Fun !!!</a></dt> --<dd> --<dl> --<dt>20.1. <a href="#GAMEOFLIFE">The Game of Life</a></dt> --<dt>20.2. <a href="#MAGIC">Magic Square</a></dt> --<dt>20.3. <a href="#HANOI">Towers of Hanoi</a></dt> --<dt>20.4. <a href="#QUEENS">Queens Puzzle</a></dt> --<dt>20.5. <a href="#SHUFFLE">Shuffle</a></dt> --<dt>20.6. <a href="#TT">Typing Tutor</a></dt> --</dl> --</dd> --<dt>21. <a href="#REF">References</a></dt> --</dl> --</div> --<div class="SECT1"> --<h2 class="SECT1"><a name="INTRO" id="INTRO">1. --Introduction</a></h2> --<p>In the olden days of teletype terminals, terminals were away --from computers and were connected to them through serial cables. --The terminals could be configured by sending a series of bytes. All --the capabilities (such as moving the cursor to a new location, --erasing part of the screen, scrolling the screen, changing modes --etc.) of terminals could be accessed through these series of bytes. --These control seeuqnces are usually called escape sequences, --because they start with an escape(0x1B) character. Even today, with --proper emulation, we can send escape sequences to the emulator and --achieve the same effect on a terminal window.</p> --<p>Suppose you wanted to print a line in color. Try typing this on --your console.</p> --<table border="0" bgcolor="#E0E0E0" width="100%"> --<tr> --<td> --<pre class="PROGRAMLISTING"> --<font color="#000000">echo "^[[0;31;40mIn Color"</font> --</pre></td> --</tr> --</table> --<p>The first character is an escape character, which looks like two --characters ^ and [. To be able to print it, you have to press --CTRL+V and then the ESC key. All the others are normal printable --characters. You should be able to see the string "In Color" in red. --It stays that way and to revert back to the original mode type --this.</p> --<table border="0" bgcolor="#E0E0E0" width="100%"> --<tr> --<td> --<pre class="PROGRAMLISTING"> --<font color="#000000">echo "^[[0;37;40m"</font> --</pre></td> --</tr> --</table> --<p>Now, what do these magic characters mean? Difficult to --comprehend? They might even be different for different terminals. --So the designers of UNIX invented a mechanism named <var class= --"LITERAL">termcap</var>. It is a file that lists all the --capabilities of a particular terminal, along with the escape --sequences needed to achieve a particular effect. In the later --years, this was replaced by <var class="LITERAL">terminfo</var>. --Without delving too much into details, this mechanism allows --application programs to query the terminfo database and obtain the --control characters to be sent to a terminal or terminal --emulator.</p> --<div class="SECT2"> --<hr> --<h3 class="SECT2"><a name="WHATIS" id="WHATIS">1.1. What is --NCURSES?</a></h3> --<p>You might be wondering, what the import of all this technical --gibberish is. In the above scenario, every application program is --supposed to query the terminfo and perform the necessary stuff --(sending control characters etc.). It soon became difficult to --manage this complexity and this gave birth to 'CURSES'. Curses is a --pun on the name "cursor optimization". The Curses library forms a --wrapper over working with raw terminal codes, and provides highly --flexible and efficient API (Application Programming Interface). It --provides functions to move the cursor, create windows, produce --colors, play with mouse etc. The application programs need not --worry about the underlying terminal capabilities.</p> --<p>So what is NCURSES? NCURSES is a clone of the original System V --Release 4.0 (SVr4) curses. It is a freely distributable library, --fully compatible with older version of curses. In short, it is a --library of functions that manages an application's display on --character-cell terminals. In the remainder of the document, the --terms curses and ncurses are used interchangeably.</p> --<p>A detailed history of NCURSES can be found in the NEWS file from --the source distribution. The current package is maintained by --<a href="mailto:dickey@his.com" target="_top">Thomas Dickey</a>. --You can contact the maintainers at <a href= --"mailto:bug-ncurses@gnu.org" target= --"_top">bug-ncurses@gnu.org</a>.</p> --</div> --<div class="SECT2"> --<hr> --<h3 class="SECT2"><a name="WHATCANWEDO" id="WHATCANWEDO">1.2. What --we can do with NCURSES</a></h3> --<p>NCURSES not only creates a wrapper over terminal capabilities, --but also gives a robust framework to create nice looking UI (User --Interface)s in text mode. It provides functions to create windows --etc. Its sister libraries panel, menu and form provide an extension --to the basic curses library. These libraries usually come along --with curses. One can create applications that contain multiple --windows, menus, panels and forms. Windows can be managed --independently, can provide 'scrollability' and even can be --hidden.</p> --<p>Menus provide the user with an easy command selection option. --Forms allow the creation of easy-to-use data entry and display --windows. Panels extend the capabilities of ncurses to deal with --overlapping and stacked windows.</p> --<p>These are just some of the basic things we can do with ncurses. --As we move along, We will see all the capabilities of these --libraries.</p> --</div> --<div class="SECT2"> --<hr> --<h3 class="SECT2"><a name="WHERETOGETIT" id="WHERETOGETIT">1.3. --Where to get it</a></h3> --<p>All right, now that you know what you can do with ncurses, you --must be rearing to get started. NCURSES is usually shipped with --your installation. In case you don't have the library or want to --compile it on your own, read on.</p> --<p><em>Compiling the package</em></p> --<p>NCURSES can be obtained from <a href= --"ftp://ftp.gnu.org/pub/gnu/ncurses/ncurses.tar.gz" target= --"_top">ftp://ftp.gnu.org/pub/gnu/ncurses/ncurses.tar.gz</a> or any --of the ftp sites mentioned in <a href= --"http://www.gnu.org/order/ftp.html" target= --"_top">http://www.gnu.org/order/ftp.html</a>.</p> --<p>Read the README and INSTALL files for details on to how to --install it. It usually involves the following operations.</p> --<table border="0" bgcolor="#E0E0E0" width="100%"> --<tr> --<td> --<pre class="PROGRAMLISTING"> --<font color= --"#000000"> tar zxvf ncurses&lt;version&gt;.tar.gz # unzip and untar the archive -+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd"> -+<HTML -+><HEAD -+><TITLE -+> NCURSES Programming HOWTO </TITLE -+><META -+NAME="GENERATOR" -+CONTENT="Modular DocBook HTML Stylesheet Version 1.79"></HEAD -+><BODY -+CLASS="ARTICLE" -+BGCOLOR="#FFFFFF" -+TEXT="#000000" -+LINK="#0000FF" -+VLINK="#840084" -+ALINK="#0000FF" -+><DIV -+CLASS="ARTICLE" -+><DIV -+CLASS="TITLEPAGE" -+><H1 -+CLASS="TITLE" -+><A -+NAME="AEN2" -+>NCURSES Programming HOWTO</A -+></H1 -+><H3 -+CLASS="AUTHOR" -+><A -+NAME="AEN4" -+> Pradeep Padala </A -+></H3 -+><DIV -+CLASS="AFFILIATION" -+><DIV -+CLASS="ADDRESS" -+><P -+CLASS="ADDRESS" -+><CODE -+CLASS="EMAIL" -+>&#60;<A -+HREF="mailto:ppadala@gmail.com" -+>ppadala@gmail.com</A -+>&#62;</CODE -+></P -+></DIV -+></DIV -+><P -+CLASS="PUBDATE" -+>v1.9, 2005-06-20<BR></P -+><DIV -+CLASS="REVHISTORY" -+><TABLE -+WIDTH="100%" -+BORDER="0" -+><TR -+><TH -+ALIGN="LEFT" -+VALIGN="TOP" -+COLSPAN="3" -+><B -+>Revision History</B -+></TH -+></TR -+><TR -+><TD -+ALIGN="LEFT" -+>Revision 1.9</TD -+><TD -+ALIGN="LEFT" -+>2005-06-20</TD -+><TD -+ALIGN="LEFT" -+>Revised by: ppadala</TD -+></TR -+><TR -+><TD -+ALIGN="LEFT" -+COLSPAN="3" -+>The license has been changed to the MIT-style license used -+ by NCURSES. Note that the programs are also re-licensed under this.</TD -+></TR -+><TR -+><TD -+ALIGN="LEFT" -+>Revision 1.8</TD -+><TD -+ALIGN="LEFT" -+>2005-06-17</TD -+><TD -+ALIGN="LEFT" -+>Revised by: ppadala</TD -+></TR -+><TR -+><TD -+ALIGN="LEFT" -+COLSPAN="3" -+>Lots of updates. Added references and perl examples. -+ Changes to examples. Many grammatical and stylistic changes to the -+ content. Changes to NCURSES history.</TD -+></TR -+><TR -+><TD -+ALIGN="LEFT" -+>Revision 1.7.1</TD -+><TD -+ALIGN="LEFT" -+>2002-06-25</TD -+><TD -+ALIGN="LEFT" -+>Revised by: ppadala</TD -+></TR -+><TR -+><TD -+ALIGN="LEFT" -+COLSPAN="3" -+>Added a README file for building and instructions -+ for building from source.</TD -+></TR -+><TR -+><TD -+ALIGN="LEFT" -+>Revision 1.7</TD -+><TD -+ALIGN="LEFT" -+>2002-06-25</TD -+><TD -+ALIGN="LEFT" -+>Revised by: ppadala</TD -+></TR -+><TR -+><TD -+ALIGN="LEFT" -+COLSPAN="3" -+>Added "Other formats" section and made a lot of fancy -+ changes to the programs. Inlining of programs is gone.</TD -+></TR -+><TR -+><TD -+ALIGN="LEFT" -+>Revision 1.6.1</TD -+><TD -+ALIGN="LEFT" -+>2002-02-24</TD -+><TD -+ALIGN="LEFT" -+>Revised by: ppadala</TD -+></TR -+><TR -+><TD -+ALIGN="LEFT" -+COLSPAN="3" -+>Removed the old Changelog section, cleaned the makefiles</TD -+></TR -+><TR -+><TD -+ALIGN="LEFT" -+>Revision 1.6</TD -+><TD -+ALIGN="LEFT" -+>2002-02-16</TD -+><TD -+ALIGN="LEFT" -+>Revised by: ppadala</TD -+></TR -+><TR -+><TD -+ALIGN="LEFT" -+COLSPAN="3" -+>Corrected a lot of spelling mistakes, added ACS variables -+ section</TD -+></TR -+><TR -+><TD -+ALIGN="LEFT" -+>Revision 1.5</TD -+><TD -+ALIGN="LEFT" -+>2002-01-05</TD -+><TD -+ALIGN="LEFT" -+>Revised by: ppadala</TD -+></TR -+><TR -+><TD -+ALIGN="LEFT" -+COLSPAN="3" -+>Changed structure to present proper TOC</TD -+></TR -+><TR -+><TD -+ALIGN="LEFT" -+>Revision 1.3.1</TD -+><TD -+ALIGN="LEFT" -+>2001-07-26</TD -+><TD -+ALIGN="LEFT" -+>Revised by: ppadala</TD -+></TR -+><TR -+><TD -+ALIGN="LEFT" -+COLSPAN="3" -+>Corrected maintainers paragraph, Corrected stable release number</TD -+></TR -+><TR -+><TD -+ALIGN="LEFT" -+>Revision 1.3</TD -+><TD -+ALIGN="LEFT" -+>2001-07-24</TD -+><TD -+ALIGN="LEFT" -+>Revised by: ppadala</TD -+></TR -+><TR -+><TD -+ALIGN="LEFT" -+COLSPAN="3" -+>Added copyright notices to main document (LDP license) -+ and programs (GPL), Corrected -+ printw_example.</TD -+></TR -+><TR -+><TD -+ALIGN="LEFT" -+>Revision 1.2</TD -+><TD -+ALIGN="LEFT" -+>2001-06-05</TD -+><TD -+ALIGN="LEFT" -+>Revised by: ppadala</TD -+></TR -+><TR -+><TD -+ALIGN="LEFT" -+COLSPAN="3" -+>Incorporated ravi's changes. Mainly to introduction, menu, -+ form, justforfun sections</TD -+></TR -+><TR -+><TD -+ALIGN="LEFT" -+>Revision 1.1</TD -+><TD -+ALIGN="LEFT" -+>2001-05-22</TD -+><TD -+ALIGN="LEFT" -+>Revised by: ppadala</TD -+></TR -+><TR -+><TD -+ALIGN="LEFT" -+COLSPAN="3" -+>Added "a word about window" section, Added scanw_example.</TD -+></TR -+></TABLE -+></DIV -+><DIV -+><DIV -+CLASS="ABSTRACT" -+><P -+></P -+><A -+NAME="AEN67" -+></A -+><P -+> <SPAN -+CLASS="emphasis" -+><I -+CLASS="EMPHASIS" -+>This document is intended to be an "All in One" guide for programming with -+ncurses and its sister libraries. We graduate from a simple "Hello World" -+program to more complex form manipulation. No prior experience in ncurses is -+assumed. Send comments to <A -+HREF="mailto:ppadala@gmail.com" -+TARGET="_top" -+>this address</A -+> -+ </I -+></SPAN -+> -+ </P -+><P -+></P -+></DIV -+></DIV -+><HR></DIV -+><DIV -+CLASS="TOC" -+><DL -+><DT -+><B -+>Table of Contents</B -+></DT -+><DT -+>1. <A -+HREF="#INTRO" -+>Introduction</A -+></DT -+><DD -+><DL -+><DT -+>1.1. <A -+HREF="#WHATIS" -+>What is NCURSES?</A -+></DT -+><DT -+>1.2. <A -+HREF="#WHATCANWEDO" -+>What we can do with NCURSES</A -+></DT -+><DT -+>1.3. <A -+HREF="#WHERETOGETIT" -+>Where to get it</A -+></DT -+><DT -+>1.4. <A -+HREF="#PURPOSE" -+>Purpose/Scope of the document</A -+></DT -+><DT -+>1.5. <A -+HREF="#ABOUTPROGRAMS" -+>About the Programs</A -+></DT -+><DT -+>1.6. <A -+HREF="#OTHERFORMATS" -+>Other Formats of the document</A -+></DT -+><DD -+><DL -+><DT -+>1.6.1. <A -+HREF="#LISTFORMATS" -+>Readily available formats from tldp.org</A -+></DT -+><DT -+>1.6.2. <A -+HREF="#BUILDSOURCE" -+>Building from source</A -+></DT -+></DL -+></DD -+><DT -+>1.7. <A -+HREF="#CREDITS" -+>Credits</A -+></DT -+><DT -+>1.8. <A -+HREF="#WISHLIST" -+>Wish List</A -+></DT -+><DT -+>1.9. <A -+HREF="#COPYRIGHT" -+>Copyright</A -+></DT -+></DL -+></DD -+><DT -+>2. <A -+HREF="#HELLOWORLD" -+>Hello World !!!</A -+></DT -+><DD -+><DL -+><DT -+>2.1. <A -+HREF="#COMPILECURSES" -+>Compiling With the NCURSES Library</A -+></DT -+><DT -+>2.2. <A -+HREF="#DISSECTION" -+>Dissection</A -+></DT -+><DD -+><DL -+><DT -+>2.2.1. <A -+HREF="#ABOUT-INITSCR" -+>About initscr()</A -+></DT -+><DT -+>2.2.2. <A -+HREF="#MYST-REFRESH" -+>The mysterious refresh()</A -+></DT -+><DT -+>2.2.3. <A -+HREF="#ABOUT-ENDWIN" -+>About endwin()</A -+></DT -+></DL -+></DD -+></DL -+></DD -+><DT -+>3. <A -+HREF="#GORY" -+>The Gory Details</A -+></DT -+><DT -+>4. <A -+HREF="#INIT" -+>Initialization</A -+></DT -+><DD -+><DL -+><DT -+>4.1. <A -+HREF="#ABOUTINIT" -+>Initialization functions</A -+></DT -+><DT -+>4.2. <A -+HREF="#RAWCBREAK" -+>raw() and cbreak()</A -+></DT -+><DT -+>4.3. <A -+HREF="#ECHONOECHO" -+>echo() and noecho()</A -+></DT -+><DT -+>4.4. <A -+HREF="#KEYPAD" -+>keypad()</A -+></DT -+><DT -+>4.5. <A -+HREF="#HALFDELAY" -+>halfdelay()</A -+></DT -+><DT -+>4.6. <A -+HREF="#MISCINIT" -+>Miscellaneous Initialization functions</A -+></DT -+><DT -+>4.7. <A -+HREF="#INITEX" -+>An Example</A -+></DT -+></DL -+></DD -+><DT -+>5. <A -+HREF="#AWORDWINDOWS" -+>A Word about Windows</A -+></DT -+><DT -+>6. <A -+HREF="#PRINTW" -+>Output functions</A -+></DT -+><DD -+><DL -+><DT -+>6.1. <A -+HREF="#ADDCHCLASS" -+>addch() class of functions</A -+></DT -+><DT -+>6.2. <A -+HREF="#AEN298" -+>mvaddch(), waddch() and mvwaddch()</A -+></DT -+><DT -+>6.3. <A -+HREF="#PRINTWCLASS" -+>printw() class of functions</A -+></DT -+><DD -+><DL -+><DT -+>6.3.1. <A -+HREF="#PRINTWMVPRINTW" -+>printw() and mvprintw</A -+></DT -+><DT -+>6.3.2. <A -+HREF="#WPRINTWMVWPRINTW" -+>wprintw() and mvwprintw</A -+></DT -+><DT -+>6.3.3. <A -+HREF="#VWPRINTW" -+>vwprintw()</A -+></DT -+><DT -+>6.3.4. <A -+HREF="#SIMPLEPRINTWEX" -+>A Simple printw example</A -+></DT -+></DL -+></DD -+><DT -+>6.4. <A -+HREF="#ADDSTRCLASS" -+>addstr() class of functions</A -+></DT -+><DT -+>6.5. <A -+HREF="#ACAUTION" -+>A word of caution</A -+></DT -+></DL -+></DD -+><DT -+>7. <A -+HREF="#SCANW" -+>Input functions</A -+></DT -+><DD -+><DL -+><DT -+>7.1. <A -+HREF="#GETCHCLASS" -+>getch() class of functions</A -+></DT -+><DT -+>7.2. <A -+HREF="#SCANWCLASS" -+>scanw() class of functions</A -+></DT -+><DD -+><DL -+><DT -+>7.2.1. <A -+HREF="#SCANWMVSCANW" -+>scanw() and mvscanw</A -+></DT -+><DT -+>7.2.2. <A -+HREF="#WSCANWMVWSCANW" -+>wscanw() and mvwscanw()</A -+></DT -+><DT -+>7.2.3. <A -+HREF="#VWSCANW" -+>vwscanw()</A -+></DT -+></DL -+></DD -+><DT -+>7.3. <A -+HREF="#GETSTRCLASS" -+>getstr() class of functions</A -+></DT -+><DT -+>7.4. <A -+HREF="#GETSTREX" -+>Some examples</A -+></DT -+></DL -+></DD -+><DT -+>8. <A -+HREF="#ATTRIB" -+>Attributes</A -+></DT -+><DD -+><DL -+><DT -+>8.1. <A -+HREF="#ATTRIBDETAILS" -+>The details</A -+></DT -+><DT -+>8.2. <A -+HREF="#ATTRONVSATTRSET" -+>attron() vs attrset()</A -+></DT -+><DT -+>8.3. <A -+HREF="#ATTR_GET" -+>attr_get()</A -+></DT -+><DT -+>8.4. <A -+HREF="#ATTR_FUNCS" -+>attr_ functions</A -+></DT -+><DT -+>8.5. <A -+HREF="#WATTRFUNCS" -+>wattr functions</A -+></DT -+><DT -+>8.6. <A -+HREF="#CHGAT" -+>chgat() functions</A -+></DT -+></DL -+></DD -+><DT -+>9. <A -+HREF="#WINDOWS" -+>Windows</A -+></DT -+><DD -+><DL -+><DT -+>9.1. <A -+HREF="#WINDOWBASICS" -+>The basics</A -+></DT -+><DT -+>9.2. <A -+HREF="#LETBEWINDOW" -+>Let there be a Window !!!</A -+></DT -+><DT -+>9.3. <A -+HREF="#BORDEREXEXPL" -+>Explanation</A -+></DT -+><DT -+>9.4. <A -+HREF="#OTHERSTUFF" -+>The other stuff in the example</A -+></DT -+><DT -+>9.5. <A -+HREF="#OTHERBORDERFUNCS" -+>Other Border functions</A -+></DT -+></DL -+></DD -+><DT -+>10. <A -+HREF="#COLOR" -+>Colors</A -+></DT -+><DD -+><DL -+><DT -+>10.1. <A -+HREF="#COLORBASICS" -+>The basics</A -+></DT -+><DT -+>10.2. <A -+HREF="#CHANGECOLORDEFS" -+>Changing Color Definitions</A -+></DT -+><DT -+>10.3. <A -+HREF="#COLORCONTENT" -+>Color Content</A -+></DT -+></DL -+></DD -+><DT -+>11. <A -+HREF="#KEYS" -+>Interfacing with the key board</A -+></DT -+><DD -+><DL -+><DT -+>11.1. <A -+HREF="#KEYSBASICS" -+>The Basics</A -+></DT -+><DT -+>11.2. <A -+HREF="#SIMPLEKEYEX" -+>A Simple Key Usage example</A -+></DT -+></DL -+></DD -+><DT -+>12. <A -+HREF="#MOUSE" -+>Interfacing with the mouse</A -+></DT -+><DD -+><DL -+><DT -+>12.1. <A -+HREF="#MOUSEBASICS" -+>The Basics</A -+></DT -+><DT -+>12.2. <A -+HREF="#GETTINGEVENTS" -+>Getting the events</A -+></DT -+><DT -+>12.3. <A -+HREF="#MOUSETOGETHER" -+>Putting it all Together</A -+></DT -+><DT -+>12.4. <A -+HREF="#MISCMOUSEFUNCS" -+>Miscellaneous Functions</A -+></DT -+></DL -+></DD -+><DT -+>13. <A -+HREF="#SCREEN" -+>Screen Manipulation</A -+></DT -+><DD -+><DL -+><DT -+>13.1. <A -+HREF="#GETYX" -+>getyx() functions</A -+></DT -+><DT -+>13.2. <A -+HREF="#SCREENDUMP" -+>Screen Dumping</A -+></DT -+><DT -+>13.3. <A -+HREF="#WINDOWDUMP" -+>Window Dumping</A -+></DT -+></DL -+></DD -+><DT -+>14. <A -+HREF="#MISC" -+>Miscellaneous features</A -+></DT -+><DD -+><DL -+><DT -+>14.1. <A -+HREF="#CURSSET" -+>curs_set()</A -+></DT -+><DT -+>14.2. <A -+HREF="#TEMPLEAVE" -+>Temporarily Leaving Curses mode</A -+></DT -+><DT -+>14.3. <A -+HREF="#ACSVARS" -+>ACS_ variables</A -+></DT -+></DL -+></DD -+><DT -+>15. <A -+HREF="#OTHERLIB" -+>Other libraries</A -+></DT -+><DT -+>16. <A -+HREF="#PANELS" -+>Panel Library</A -+></DT -+><DD -+><DL -+><DT -+>16.1. <A -+HREF="#PANELBASICS" -+>The Basics</A -+></DT -+><DT -+>16.2. <A -+HREF="#COMPILEPANELS" -+>Compiling With the Panels Library</A -+></DT -+><DT -+>16.3. <A -+HREF="#PANELBROWSING" -+>Panel Window Browsing</A -+></DT -+><DT -+>16.4. <A -+HREF="#USERPTRUSING" -+>Using User Pointers</A -+></DT -+><DT -+>16.5. <A -+HREF="#PANELMOVERESIZE" -+>Moving and Resizing Panels</A -+></DT -+><DT -+>16.6. <A -+HREF="#PANELSHOWHIDE" -+>Hiding and Showing Panels</A -+></DT -+><DT -+>16.7. <A -+HREF="#PANELABOVE" -+>panel_above() and panel_below() Functions</A -+></DT -+></DL -+></DD -+><DT -+>17. <A -+HREF="#MENUS" -+>Menus Library</A -+></DT -+><DD -+><DL -+><DT -+>17.1. <A -+HREF="#MENUBASICS" -+>The Basics</A -+></DT -+><DT -+>17.2. <A -+HREF="#COMPILEMENUS" -+>Compiling With the Menu Library</A -+></DT -+><DT -+>17.3. <A -+HREF="#MENUDRIVER" -+>Menu Driver: The work horse of the menu system</A -+></DT -+><DT -+>17.4. <A -+HREF="#MENUWINDOWS" -+>Menu Windows</A -+></DT -+><DT -+>17.5. <A -+HREF="#SCROLLMENUS" -+>Scrolling Menus</A -+></DT -+><DT -+>17.6. <A -+HREF="#MULTICOLUMN" -+>Multi Columnar Menus</A -+></DT -+><DT -+>17.7. <A -+HREF="#MULTIVALUEMENUS" -+>Multi Valued Menus</A -+></DT -+><DT -+>17.8. <A -+HREF="#MENUOPT" -+>Menu Options</A -+></DT -+><DT -+>17.9. <A -+HREF="#MENUUSERPTR" -+>The useful User Pointer</A -+></DT -+></DL -+></DD -+><DT -+>18. <A -+HREF="#FORMS" -+>Forms Library</A -+></DT -+><DD -+><DL -+><DT -+>18.1. <A -+HREF="#FORMBASICS" -+>The Basics</A -+></DT -+><DT -+>18.2. <A -+HREF="#COMPILEFORMS" -+>Compiling With the Forms Library</A -+></DT -+><DT -+>18.3. <A -+HREF="#PLAYFIELDS" -+>Playing with Fields</A -+></DT -+><DD -+><DL -+><DT -+>18.3.1. <A -+HREF="#FETCHINFO" -+>Fetching Size and Location of Field</A -+></DT -+><DT -+>18.3.2. <A -+HREF="#MOVEFIELD" -+>Moving the field</A -+></DT -+><DT -+>18.3.3. <A -+HREF="#JUSTIFYFIELD" -+>Field Justification</A -+></DT -+><DT -+>18.3.4. <A -+HREF="#FIELDDISPATTRIB" -+>Field Display Attributes</A -+></DT -+><DT -+>18.3.5. <A -+HREF="#FIELDOPTIONBITS" -+>Field Option Bits</A -+></DT -+><DT -+>18.3.6. <A -+HREF="#FIELDSTATUS" -+>Field Status</A -+></DT -+><DT -+>18.3.7. <A -+HREF="#FIELDUSERPTR" -+>Field User Pointer</A -+></DT -+><DT -+>18.3.8. <A -+HREF="#VARIABLESIZEFIELDS" -+>Variable-Sized Fields</A -+></DT -+></DL -+></DD -+><DT -+>18.4. <A -+HREF="#FORMWINDOWS" -+>Form Windows</A -+></DT -+><DT -+>18.5. <A -+HREF="#FILEDVALIDATE" -+>Field Validation</A -+></DT -+><DT -+>18.6. <A -+HREF="#FORMDRIVER" -+>Form Driver: The work horse of the forms system</A -+></DT -+><DD -+><DL -+><DT -+>18.6.1. <A -+HREF="#PAGENAVREQ" -+>Page Navigation Requests</A -+></DT -+><DT -+>18.6.2. <A -+HREF="#INTERFIELDNAVREQ" -+>Inter-Field Navigation Requests</A -+></DT -+><DT -+>18.6.3. <A -+HREF="#INTRAFIELDNAVREQ" -+>Intra-Field Navigation Requests</A -+></DT -+><DT -+>18.6.4. <A -+HREF="#SCROLLREQ" -+>Scrolling Requests</A -+></DT -+><DT -+>18.6.5. <A -+HREF="#EDITREQ" -+>Editing Requests</A -+></DT -+><DT -+>18.6.6. <A -+HREF="#ORDERREQ" -+>Order Requests</A -+></DT -+><DT -+>18.6.7. <A -+HREF="#APPLICCOMMANDS" -+>Application Commands</A -+></DT -+></DL -+></DD -+></DL -+></DD -+><DT -+>19. <A -+HREF="#TOOLS" -+>Tools and Widget Libraries</A -+></DT -+><DD -+><DL -+><DT -+>19.1. <A -+HREF="#CDK" -+>CDK (Curses Development Kit)</A -+></DT -+><DD -+><DL -+><DT -+>19.1.1. <A -+HREF="#WIDGETLIST" -+>Widget List</A -+></DT -+><DT -+>19.1.2. <A -+HREF="#CDKATTRACT" -+>Some Attractive Features</A -+></DT -+><DT -+>19.1.3. <A -+HREF="#CDKCONCLUSION" -+>Conclusion</A -+></DT -+></DL -+></DD -+><DT -+>19.2. <A -+HREF="#DIALOG" -+>The dialog</A -+></DT -+><DT -+>19.3. <A -+HREF="#PERLCURSES" -+>Perl Curses Modules CURSES::FORM and CURSES::WIDGETS</A -+></DT -+></DL -+></DD -+><DT -+>20. <A -+HREF="#JUSTFORFUN" -+>Just For Fun !!!</A -+></DT -+><DD -+><DL -+><DT -+>20.1. <A -+HREF="#GAMEOFLIFE" -+>The Game of Life</A -+></DT -+><DT -+>20.2. <A -+HREF="#MAGIC" -+>Magic Square</A -+></DT -+><DT -+>20.3. <A -+HREF="#HANOI" -+>Towers of Hanoi</A -+></DT -+><DT -+>20.4. <A -+HREF="#QUEENS" -+>Queens Puzzle</A -+></DT -+><DT -+>20.5. <A -+HREF="#SHUFFLE" -+>Shuffle</A -+></DT -+><DT -+>20.6. <A -+HREF="#TT" -+>Typing Tutor</A -+></DT -+></DL -+></DD -+><DT -+>21. <A -+HREF="#REF" -+>References</A -+></DT -+></DL -+></DIV -+><DIV -+CLASS="SECT1" -+><H2 -+CLASS="SECT1" -+><A -+NAME="INTRO" -+>1. Introduction</A -+></H2 -+><P -+>In the olden days of teletype terminals, terminals were away from computers and -+were connected to them through serial cables. The terminals could be configured -+by sending a series of bytes. All the capabilities (such as -+moving the cursor to a new location, erasing part of the screen, scrolling the -+screen, changing modes etc.) of terminals could be accessed through these -+series of bytes. These control seeuqnces are usually called escape sequences, -+because they start -+with an escape(0x1B) character. Even today, with proper emulation, we can send -+escape sequences to the emulator and achieve the same effect on a terminal -+window.</P -+><P -+>Suppose you wanted to print a line in color. Try typing this on your console.</P -+><PRE -+CLASS="PROGRAMLISTING" -+>echo "^[[0;31;40mIn Color"</PRE -+><P -+>The first character is an escape character, which looks like two characters ^ -+and [. To be able to print it, you have to press CTRL+V and then the ESC key. -+All the others are normal printable characters. You should be able to see the -+string "In Color" in red. It stays that way and to revert back to the original -+mode type this.</P -+><PRE -+CLASS="PROGRAMLISTING" -+>echo "^[[0;37;40m"</PRE -+><P -+>Now, what do these magic characters mean? Difficult to comprehend? They might -+even be different for different terminals. So the designers of UNIX invented a -+mechanism named <TT -+CLASS="LITERAL" -+>termcap</TT -+>. It is a file that -+lists all the capabilities of a particular terminal, along with the escape -+sequences needed to achieve a particular effect. In the later years, this was -+replaced by <TT -+CLASS="LITERAL" -+>terminfo</TT -+>. Without delving too -+much into details, this mechanism allows application -+programs to query the terminfo database and obtain the control characters to be -+sent to a terminal or terminal emulator.</P -+><DIV -+CLASS="SECT2" -+><HR><H3 -+CLASS="SECT2" -+><A -+NAME="WHATIS" -+>1.1. What is NCURSES?</A -+></H3 -+><P -+> -+You might be wondering, what the import of all this technical gibberish is. In -+the above scenario, every application program is supposed to query the terminfo -+and perform the necessary stuff (sending control characters etc.). It soon became -+difficult to manage this complexity and this gave birth to 'CURSES'. Curses is -+a pun on the name "cursor optimization". The Curses library forms a wrapper -+over working with raw terminal codes, and provides highly flexible and -+efficient API (Application Programming Interface). It provides functions to -+move the cursor, create windows, produce colors, play with mouse etc. The -+application programs need not worry about the underlying terminal capabilities.</P -+><P -+>So what is NCURSES? NCURSES is a clone of the original System V Release 4.0 -+(SVr4) curses. It is a freely distributable library, fully compatible with -+older version of curses. In short, it is a library of functions that manages -+an application's display on character-cell terminals. In the remainder of the -+document, the terms curses and ncurses are used interchangeably. </P -+><P -+>A detailed history of NCURSES can be found in the NEWS file from the source -+distribution. The current package is maintained by -+<A -+HREF="mailto:dickey@his.com" -+TARGET="_top" -+>Thomas Dickey</A -+>. -+You can contact the maintainers at <A -+HREF="mailto:bug-ncurses@gnu.org" -+TARGET="_top" -+>bug-ncurses@gnu.org</A -+>.</P -+></DIV -+><DIV -+CLASS="SECT2" -+><HR><H3 -+CLASS="SECT2" -+><A -+NAME="WHATCANWEDO" -+>1.2. What we can do with NCURSES</A -+></H3 -+><P -+>NCURSES not only creates a wrapper over terminal capabilities, but also gives a -+robust framework to create nice looking UI (User Interface)s in text mode. It -+provides functions to create windows etc. Its sister libraries panel, menu and -+form provide an extension to the basic curses library. These libraries usually -+come along with curses. One can create applications that contain multiple -+windows, menus, panels and forms. Windows can be managed independently, can -+provide 'scrollability' and even can be hidden.</P -+><P -+> -+Menus provide the user with an easy command selection option. Forms allow the -+creation of easy-to-use data entry and display windows. Panels extend the -+capabilities of ncurses to deal with overlapping and stacked windows.</P -+><P -+>These are just some of the basic things we can do with ncurses. As we move -+along, We will see all the capabilities of these libraries. </P -+></DIV -+><DIV -+CLASS="SECT2" -+><HR><H3 -+CLASS="SECT2" -+><A -+NAME="WHERETOGETIT" -+>1.3. Where to get it</A -+></H3 -+><P -+>All right, now that you know what you can do with ncurses, you must be rearing -+to get started. NCURSES is usually shipped with your installation. In case -+you don't have the library or want to compile it on your own, read on.</P -+><P -+><SPAN -+CLASS="emphasis" -+><I -+CLASS="EMPHASIS" -+>Compiling the package</I -+></SPAN -+> </P -+><P -+>NCURSES can be obtained from <A -+HREF="ftp://ftp.gnu.org/pub/gnu/ncurses/ncurses.tar.gz" -+TARGET="_top" -+>ftp://ftp.gnu.org/pub/gnu/ncurses/ncurses.tar.gz</A -+> or any of the ftp -+sites mentioned in <A -+HREF="http://www.gnu.org/order/ftp.html" -+TARGET="_top" -+>http://www.gnu.org/order/ftp.html</A -+>. </P -+><P -+>Read the README and INSTALL files for details on to how to install it. It -+usually involves the following operations.</P -+><PRE -+CLASS="PROGRAMLISTING" -+> tar zxvf ncurses&lt;version&gt;.tar.gz # unzip and untar the archive - cd ncurses&lt;version&gt; # cd to the directory - ./configure # configure the build according to your - # environment - make # make it - su root # become root -- make install # install it</font> --</pre></td> --</tr> --</table> --<p><em>Using the RPM</em></p> --<p>NCURSES RPM can be found and downloaded from <a href= --"http://rpmfind.net" target="_top">http://rpmfind.net</a> . The RPM --can be installed with the following command after becoming --root.</p> --<table border="0" bgcolor="#E0E0E0" width="100%"> --<tr> --<td> --<pre class="PROGRAMLISTING"> --<font color="#000000"> rpm -i &lt;downloaded rpm&gt;</font> --</pre></td> --</tr> --</table> --</div> --<div class="SECT2"> --<hr> --<h3 class="SECT2"><a name="PURPOSE" id="PURPOSE">1.4. Purpose/Scope --of the document</a></h3> --<p>This document is intended to be a "All in One" guide for --programming with ncurses and its sister libraries. We graduate from --a simple "Hello World" program to more complex form manipulation. --No prior experience in ncurses is assumed. The writing is informal, --but a lot of detail is provided for each of the examples.</p> --</div> --<div class="SECT2"> --<hr> --<h3 class="SECT2"><a name="ABOUTPROGRAMS" id="ABOUTPROGRAMS">1.5. --About the Programs</a></h3> --<p>All the programs in the document are available in zipped form --<a href= --"http://www.tldp.org/HOWTO/NCURSES-Programming-HOWTO/ncurses_programs.tar.gz" --target="_top">here</a>. Unzip and untar it. The directory structure --looks like this.</p> --<table border="0" bgcolor="#E0E0E0" width="100%"> --<tr> --<td> --<pre class="PROGRAMLISTING"> --<font color="#000000">ncurses -+ make install # install it</PRE -+><P -+><SPAN -+CLASS="emphasis" -+><I -+CLASS="EMPHASIS" -+>Using the RPM </I -+></SPAN -+></P -+><P -+>NCURSES RPM can be found and downloaded from <A -+HREF="http://rpmfind.net" -+TARGET="_top" -+>http://rpmfind.net </A -+>. The RPM can be installed with the following -+command after becoming root.</P -+><PRE -+CLASS="PROGRAMLISTING" -+> rpm -i &lt;downloaded rpm&gt;</PRE -+></DIV -+><DIV -+CLASS="SECT2" -+><HR><H3 -+CLASS="SECT2" -+><A -+NAME="PURPOSE" -+>1.4. Purpose/Scope of the document</A -+></H3 -+><P -+>This document is intended to be a "All in One" guide for programming with -+ncurses and its sister libraries. We graduate from a simple "Hello World" -+program to more complex form manipulation. No prior experience in ncurses is -+assumed. The writing is informal, but a lot of detail is provided for -+each of the examples.</P -+></DIV -+><DIV -+CLASS="SECT2" -+><HR><H3 -+CLASS="SECT2" -+><A -+NAME="ABOUTPROGRAMS" -+>1.5. About the Programs</A -+></H3 -+><P -+>All the programs in the document are available in zipped form -+<A -+HREF="http://www.tldp.org/HOWTO/NCURSES-Programming-HOWTO/ncurses_programs.tar.gz" -+TARGET="_top" -+>here</A -+>. Unzip and untar it. The directory structure looks like this.</P -+><PRE -+CLASS="PROGRAMLISTING" -+>ncurses - | - |----&gt; JustForFun -- just for fun programs - |----&gt; basics -- basic programs -@@ -524,16 +1290,12 @@ - | by Anuradha Ratnaweera) - |----&gt; Makefile -- the top level Makefile - |----&gt; README -- the top level README file. contains instructions -- |----&gt; COPYING -- copyright notice</font> --</pre></td> --</tr> --</table> --<p>The individual directories contain the following files.</p> --<table border="0" bgcolor="#E0E0E0" width="100%"> --<tr> --<td> --<pre class="PROGRAMLISTING"> --<font color="#000000">Description of files in each directory -+ |----&gt; COPYING -- copyright notice</PRE -+><P -+>The individual directories contain the following files.</P -+><PRE -+CLASS="PROGRAMLISTING" -+>Description of files in each directory - -------------------------------------- - JustForFun - | -@@ -592,73 +1354,96 @@ - |----&gt; panel_simple.c -- A simple panel example - - perl -- |----&gt; 01-10.pl -- Perl equivalents of first ten example programs</font> --</pre></td> --</tr> --</table> --<p>There is a top level Makefile included in the main directory. It --builds all the files and puts the ready-to-use exes in demo/exe --directory. You can also do selective make by going into the --corresponding directory. Each directory contains a README file --explaining the purpose of each c file in the directory.</p> --<p>For every example, I have included path name for the file --relative to the examples directory.</p> --<p>If you prefer browsing individual programs, point your browser --to <a href= --"http://tldp.org/HOWTO/NCURSES-Programming-HOWTO/ncurses_programs/" --target= --"_top">http://tldp.org/HOWTO/NCURSES-Programming-HOWTO/ncurses_programs/</a></p> --<p>All the programs are released under the same license that is --used by ncurses (MIT-style). This gives you the ability to do --pretty much anything other than claiming them as yours. Feel free --to use them in your programs as appropriate.</p> --</div> --<div class="SECT2"> --<hr> --<h3 class="SECT2"><a name="OTHERFORMATS" id="OTHERFORMATS">1.6. --Other Formats of the document</a></h3> --<p>This howto is also availabe in various other formats on the --tldp.org site. Here are the links to other formats of this --document.</p> --<div class="SECT3"> --<hr> --<h4 class="SECT3"><a name="LISTFORMATS" id="LISTFORMATS">1.6.1. --Readily available formats from tldp.org</a></h4> --<ul> --<li> --<p><a href= --"http://www.ibiblio.org/pub/Linux/docs/HOWTO/other-formats/pdf/NCURSES-Programming-HOWTO.pdf" --target="_top">Acrobat PDF Format</a></p> --</li> --<li> --<p><a href= --"http://www.ibiblio.org/pub/Linux/docs/HOWTO/other-formats/ps/NCURSES-Programming-HOWTO.ps.gz" --target="_top">PostScript Format</a></p> --</li> --<li> --<p><a href= --"http://www.ibiblio.org/pub/Linux/docs/HOWTO/other-formats/html/NCURSES-Programming-HOWTO-html.tar.gz" --target="_top">In Multiple HTML pages</a></p> --</li> --<li> --<p><a href= --"http://www.ibiblio.org/pub/Linux/docs/HOWTO/other-formats/html_single/NCURSES-Programming-HOWTO.html" --target="_top">In One big HTML format</a></p> --</li> --</ul> --</div> --<div class="SECT3"> --<hr> --<h4 class="SECT3"><a name="BUILDSOURCE" id="BUILDSOURCE">1.6.2. --Building from source</a></h4> --<p>If above links are broken or if you want to experiment with sgml --read on.</p> --<table border="0" bgcolor="#E0E0E0" width="100%"> --<tr> --<td> --<pre class="PROGRAMLISTING"> --<font color= --"#000000">&#13; Get both the source and the tar,gzipped programs, available at -+ |----&gt; 01-10.pl -- Perl equivalents of first ten example programs</PRE -+><P -+>There is a top level Makefile included in the main directory. It builds all the -+files and puts the ready-to-use exes in demo/exe directory. You can also -+do selective make by going into the corresponding directory. Each directory -+contains a README file explaining the purpose of each c file in the directory.</P -+><P -+>For every example, I have included path name for the file relative to the -+examples directory. </P -+><P -+> If you prefer browsing individual programs, point your browser to -+<A -+HREF="http://tldp.org/HOWTO/NCURSES-Programming-HOWTO/ncurses_programs/" -+TARGET="_top" -+>http://tldp.org/HOWTO/NCURSES-Programming-HOWTO/ncurses_programs/</A -+></P -+><P -+>All the programs are released under the same license that is used by ncurses -+(MIT-style). This gives you the ability to do pretty much anything other than -+claiming them as yours. Feel free to use them in your programs as appropriate.</P -+></DIV -+><DIV -+CLASS="SECT2" -+><HR><H3 -+CLASS="SECT2" -+><A -+NAME="OTHERFORMATS" -+>1.6. Other Formats of the document</A -+></H3 -+><P -+>This howto is also availabe in various other formats on the tldp.org site. -+Here are the links to other formats of this document.</P -+><DIV -+CLASS="SECT3" -+><HR><H4 -+CLASS="SECT3" -+><A -+NAME="LISTFORMATS" -+>1.6.1. Readily available formats from tldp.org</A -+></H4 -+><P -+></P -+><UL -+><LI -+><P -+><A -+HREF="http://www.ibiblio.org/pub/Linux/docs/HOWTO/other-formats/pdf/NCURSES-Programming-HOWTO.pdf" -+TARGET="_top" -+>Acrobat PDF Format</A -+></P -+></LI -+><LI -+><P -+><A -+HREF="http://www.ibiblio.org/pub/Linux/docs/HOWTO/other-formats/ps/NCURSES-Programming-HOWTO.ps.gz" -+TARGET="_top" -+>PostScript Format</A -+></P -+></LI -+><LI -+><P -+><A -+HREF="http://www.ibiblio.org/pub/Linux/docs/HOWTO/other-formats/html/NCURSES-Programming-HOWTO-html.tar.gz" -+TARGET="_top" -+>In Multiple HTML pages</A -+></P -+></LI -+><LI -+><P -+><A -+HREF="http://www.ibiblio.org/pub/Linux/docs/HOWTO/other-formats/html_single/NCURSES-Programming-HOWTO.html" -+TARGET="_top" -+>In One big HTML format</A -+></P -+></LI -+></UL -+></DIV -+><DIV -+CLASS="SECT3" -+><HR><H4 -+CLASS="SECT3" -+><A -+NAME="BUILDSOURCE" -+>1.6.2. Building from source</A -+></H4 -+><P -+>If above links are broken or if you want to experiment with sgml read on. -+<PRE -+CLASS="PROGRAMLISTING" -+>&#13; Get both the source and the tar,gzipped programs, available at - http://cvsview.tldp.org/index.cgi/LDP/howto/docbook/ - NCURSES-HOWTO/NCURSES-Programming-HOWTO.sgml - http://cvsview.tldp.org/index.cgi/LDP/howto/docbook/ -@@ -679,588 +1464,862 @@ - NCURSES-ONE-BIG-FILE.html - for ps, you would use - htmldoc --size universal -t ps --firstpage p1 -f &lt;output file name.ps&gt; -- NCURSES-ONE-BIG-FILE.html</font> --</pre></td> --</tr> --</table> --<p>See <a href="http://www.tldp.org/LDP/LDP-Author-Guide/" target= --"_top">LDP Author guide</a> for more details. If all else failes, --mail me at <a href="ppadala@gmail.com" target= --"_top">ppadala@gmail.com</a></p> --</div> --</div> --<div class="SECT2"> --<hr> --<h3 class="SECT2"><a name="CREDITS" id="CREDITS">1.7. --Credits</a></h3> --<p>I thank <a href="mailto:sharath_1@usa.net" target= --"_top">Sharath</a> and Emre Akbas for helping me with few sections. --The introduction was initially written by sharath. I rewrote it --with few excerpts taken from his initial work. Emre helped in --writing printw and scanw sections.</p> --<p>Perl equivalents of the example programs are contributed by --<a href="mailto:Aratnaweera@virtusa.com" target="_top">Anuradha --Ratnaweera</a>.</p> --<p>Then comes <a href="mailto:parimi@ece.arizona.edu" target= --"_top">Ravi Parimi</a>, my dearest friend, who has been on this --project before even one line was written. He constantly bombarded --me with suggestions and patiently reviewed the whole text. He also --checked each program on Linux and Solaris.</p> --</div> --<div class="SECT2"> --<hr> --<h3 class="SECT2"><a name="WISHLIST" id="WISHLIST">1.8. Wish --List</a></h3> --<p>This is the wish list, in the order of priority. If you have a --wish or you want to work on completing the wish, mail <a href= --"mailto:ppadala@gmail.com" target="_top">me</a>.</p> --<ul> --<li> --<p>Add examples to last parts of forms section.</p> --</li> --<li> --<p>Prepare a Demo showing all the programs and allow the user to --browse through description of each program. Let the user compile --and see the program in action. A dialog based interface is --preferred.</p> --</li> --<li> --<p>Add debug info. _tracef, _tracemouse stuff.</p> --</li> --<li> --<p>Accessing termcap, terminfo using functions provided by ncurses --package.</p> --</li> --<li> --<p>Working on two terminals simultaneously.</p> --</li> --<li> --<p>Add more stuff to miscellaneous section.</p> --</li> --</ul> --</div> --<div class="SECT2"> --<hr> --<h3 class="SECT2"><a name="COPYRIGHT" id="COPYRIGHT">1.9. --Copyright</a></h3> --<p>Copyright &copy; 2001 by Pradeep Padala.</p> --<p>Permission is hereby granted, free of charge, to any person --obtaining a copy of this software and associated documentation --files (the "Software"), to deal in the Software without --restriction, including without limitation the rights to use, copy, --modify, merge, publish, distribute, distribute with modifications, --sublicense, and/or sell copies of the Software, and to permit --persons to whom the Software is furnished to do so, subject to the --following conditions:</p> --<p>The above copyright notice and this permission notice shall be --included in all copies or substantial portions of the Software.</p> --<p>THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, --EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND --NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE --LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN --ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN --CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE --SOFTWARE.</p> --<p>Except as contained in this notice, the name(s) of the above --copyright holders shall not be used in advertising or otherwise to --promote the sale, use or other dealings in this Software without --prior written authorization.</p> --</div> --</div> --<div class="SECT1"> --<hr> --<h2 class="SECT1"><a name="HELLOWORLD" id="HELLOWORLD">2. Hello --World !!!</a></h2> --<p>Welcome to the world of curses. Before we plunge into the --library and look into its various features, let's write a simple --program and say hello to the world.</p> --<div class="SECT2"> --<hr> --<h3 class="SECT2"><a name="COMPILECURSES" id="COMPILECURSES">2.1. --Compiling With the NCURSES Library</a></h3> --<p>To use ncurses library functions, you have to include ncurses.h --in your programs. To link the program with ncurses the flag ---lncurses should be added.</p> --<table border="0" bgcolor="#E0E0E0" width="100%"> --<tr> --<td> --<pre class="PROGRAMLISTING"> --<font color="#000000"> #include &lt;ncurses.h&gt; -+ NCURSES-ONE-BIG-FILE.html</PRE -+></P -+><P -+>See <A -+HREF="http://www.tldp.org/LDP/LDP-Author-Guide/" -+TARGET="_top" -+>LDP Author guide</A -+> for more details. If all else failes, mail me at -+<A -+HREF="ppadala@gmail.com" -+TARGET="_top" -+>ppadala@gmail.com</A -+></P -+></DIV -+></DIV -+><DIV -+CLASS="SECT2" -+><HR><H3 -+CLASS="SECT2" -+><A -+NAME="CREDITS" -+>1.7. Credits</A -+></H3 -+><P -+>I thank <A -+HREF="mailto:sharath_1@usa.net" -+TARGET="_top" -+>Sharath</A -+> and Emre Akbas for -+helping me with few sections. The introduction was initially written by sharath. -+I rewrote it with few excerpts taken from his initial work. Emre helped in -+writing printw and scanw sections.</P -+><P -+>Perl equivalents of the example programs are contributed by <A -+HREF="mailto:Aratnaweera@virtusa.com" -+TARGET="_top" -+>Anuradha Ratnaweera</A -+>. </P -+><P -+>Then comes <A -+HREF="mailto:parimi@ece.arizona.edu" -+TARGET="_top" -+>Ravi Parimi</A -+>, my -+dearest friend, who has been on this project before even one line was written. -+He constantly bombarded me with suggestions and patiently reviewed the whole -+text. He also checked each program on Linux and Solaris. </P -+></DIV -+><DIV -+CLASS="SECT2" -+><HR><H3 -+CLASS="SECT2" -+><A -+NAME="WISHLIST" -+>1.8. Wish List</A -+></H3 -+><P -+>This is the wish list, in the order of priority. If you have a wish or you want -+to work on completing the wish, mail <A -+HREF="mailto:ppadala@gmail.com" -+TARGET="_top" -+>me</A -+>. </P -+><P -+></P -+><UL -+><LI -+><P -+>Add examples to last parts of forms section.</P -+></LI -+><LI -+><P -+>Prepare a Demo showing all the programs and allow the user to browse through -+description of each program. Let the user compile and see the program in action. -+A dialog based interface is preferred.</P -+></LI -+><LI -+><P -+>Add debug info. _tracef, _tracemouse stuff.</P -+></LI -+><LI -+><P -+>Accessing termcap, terminfo using functions provided by ncurses -+package.</P -+></LI -+><LI -+><P -+>Working on two terminals simultaneously.</P -+></LI -+><LI -+><P -+>Add more stuff to miscellaneous section.</P -+></LI -+></UL -+></DIV -+><DIV -+CLASS="SECT2" -+><HR><H3 -+CLASS="SECT2" -+><A -+NAME="COPYRIGHT" -+>1.9. Copyright</A -+></H3 -+><P -+>Copyright &copy; 2001 by Pradeep Padala. </P -+><P -+>Permission is hereby granted, free of charge, to any person obtaining a copy -+of this software and associated documentation files (the "Software"), to deal -+in the Software without restriction, including without limitation the rights -+to use, copy, modify, merge, publish, distribute, distribute with -+modifications, sublicense, and/or sell copies of the Software, and to permit -+persons to whom the Software is furnished to do so, subject to the following -+conditions:</P -+><P -+>The above copyright notice and this permission notice shall be included in all -+copies or substantial portions of the Software.</P -+><P -+>THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -+ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR -+IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.</P -+><P -+>Except as contained in this notice, the name(s) of the above copyright holders -+shall not be used in advertising or otherwise to promote the sale, use or -+other dealings in this Software without prior written authorization. </P -+></DIV -+></DIV -+><DIV -+CLASS="SECT1" -+><HR><H2 -+CLASS="SECT1" -+><A -+NAME="HELLOWORLD" -+>2. Hello World !!!</A -+></H2 -+><P -+>Welcome to the world of curses. Before we plunge into the library and look into -+its various features, let's write a simple program and say -+hello to the world. </P -+><DIV -+CLASS="SECT2" -+><HR><H3 -+CLASS="SECT2" -+><A -+NAME="COMPILECURSES" -+>2.1. Compiling With the NCURSES Library</A -+></H3 -+><P -+>To use ncurses library functions, you have to include ncurses.h in your -+programs. To link the -+program with ncurses the flag -lncurses should be added.</P -+><PRE -+CLASS="PROGRAMLISTING" -+> #include &lt;ncurses.h&gt; - . - . - . - -- compile and link: gcc &lt;program file&gt; -lncurses</font> --</pre></td> --</tr> --</table> --<div class="EXAMPLE"><a name="BHW" id="BHW"></a> --<p><b>Example 1. The Hello World !!! Program</b></p> --<table border="0" bgcolor="#E0E0E0" width="100%"> --<tr> --<td> --<pre class="PROGRAMLISTING"> --<font color="#000000"><span class= --"INLINEMEDIAOBJECT">#include &lt;ncurses.h&gt; -+ compile and link: gcc &lt;program file&gt; -lncurses</PRE -+><DIV -+CLASS="EXAMPLE" -+><A -+NAME="BHW" -+></A -+><P -+><B -+>Example 1. The Hello World !!! Program </B -+></P -+><PRE -+CLASS="PROGRAMLISTING" -+><SPAN -+CLASS="INLINEMEDIAOBJECT" -+>#include &#60;ncurses.h&#62; - - int main() --{ -- initscr(); /* Start curses mode */ -- printw("Hello World !!!"); /* Print Hello World */ -- refresh(); /* Print it on to the real screen */ -- getch(); /* Wait for user input */ -- endwin(); /* End curses mode */ -- -- return 0; --}</span></font> --</pre></td> --</tr> --</table> --</div> --</div> --<div class="SECT2"> --<hr> --<h3 class="SECT2"><a name="DISSECTION" id="DISSECTION">2.2. --Dissection</a></h3> --<p>The above program prints "Hello World !!!" to the screen and --exits. This program shows how to initialize curses and do screen --manipulation and end curses mode. Let's dissect it line by --line.</p> --<div class="SECT3"> --<hr> --<h4 class="SECT3"><a name="ABOUT-INITSCR" id="ABOUT-INITSCR">2.2.1. --About initscr()</a></h4> --<p>The function initscr() initializes the terminal in curses mode. --In some implementations, it clears the screen and presents a blank --screen. To do any screen manipulation using curses package this has --to be called first. This function initializes the curses system and --allocates memory for our present window (called <var class= --"LITERAL">stdscr</var>) and some other data-structures. Under --extreme cases this function might fail due to insufficient memory --to allocate memory for curses library's data structures.</p> --<p>After this is done, we can do a variety of initializations to --customize our curses settings. These details will be explained --<a href="#INIT">later</a> .</p> --</div> --<div class="SECT3"> --<hr> --<h4 class="SECT3"><a name="MYST-REFRESH" id="MYST-REFRESH">2.2.2. --The mysterious refresh()</a></h4> --<p>The next line printw prints the string "Hello World !!!" on to --the screen. This function is analogous to normal printf in all --respects except that it prints the data on a window called stdscr --at the current (y,x) co-ordinates. Since our present co-ordinates --are at 0,0 the string is printed at the left hand corner of the --window.</p> --<p>This brings us to that mysterious refresh(). Well, when we --called printw the data is actually written to an imaginary window, --which is not updated on the screen yet. The job of printw is to --update a few flags and data structures and write the data to a --buffer corresponding to stdscr. In order to show it on the screen, --we need to call refresh() and tell the curses system to dump the --contents on the screen.</p> --<p>The philosophy behind all this is to allow the programmer to do --multiple updates on the imaginary screen or windows and do a --refresh once all his screen update is done. refresh() checks the --window and updates only the portion which has been changed. This --improves performance and offers greater flexibility too. But, it is --sometimes frustrating to beginners. A common mistake committed by --beginners is to forget to call refresh() after they did some update --through printw() class of functions. I still forget to add it --sometimes :-)</p> --</div> --<div class="SECT3"> --<hr> --<h4 class="SECT3"><a name="ABOUT-ENDWIN" id="ABOUT-ENDWIN">2.2.3. --About endwin()</a></h4> --<p>And finally don't forget to end the curses mode. Otherwise your --terminal might behave strangely after the program quits. endwin() --frees the memory taken by curses sub-system and its data structures --and puts the terminal in normal mode. This function must be called --after you are done with the curses mode.</p> --</div> --</div> --</div> --<div class="SECT1"> --<hr> --<h2 class="SECT1"><a name="GORY" id="GORY">3. The Gory --Details</a></h2> --<p>Now that we have seen how to write a simple curses program let's --get into the details. There are many functions that help customize --what you see on screen and many features which can be put to full --use.</p> --<p>Here we go...</p> --</div> --<div class="SECT1"> --<hr> --<h2 class="SECT1"><a name="INIT" id="INIT">4. --Initialization</a></h2> --<p>We now know that to initialize curses system the function --initscr() has to be called. There are functions which can be called --after this initialization to customize our curses session. We may --ask the curses system to set the terminal in raw mode or initialize --color or initialize the mouse etc.. Let's discuss some of the --functions that are normally called immediately after initscr();</p> --<div class="SECT2"> --<hr> --<h3 class="SECT2"><a name="ABOUTINIT" id="ABOUTINIT">4.1. --Initialization functions</a></h3> --</div> --<div class="SECT2"> --<hr> --<h3 class="SECT2"><a name="RAWCBREAK" id="RAWCBREAK">4.2. raw() and --cbreak()</a></h3> --<p>Normally the terminal driver buffers the characters a user types --until a new line or carriage return is encountered. But most --programs require that the characters be available as soon as the --user types them. The above two functions are used to disable line --buffering. The difference between these two functions is in the way --control characters like suspend (CTRL-Z), interrupt and quit --(CTRL-C) are passed to the program. In the raw() mode these --characters are directly passed to the program without generating a --signal. In the <var class="LITERAL">cbreak()</var> mode these --control characters are interpreted as any other character by the --terminal driver. I personally prefer to use raw() as I can exercise --greater control over what the user does.</p> --</div> --<div class="SECT2"> --<hr> --<h3 class="SECT2"><a name="ECHONOECHO" id="ECHONOECHO">4.3. echo() --and noecho()</a></h3> --<p>These functions control the echoing of characters typed by the --user to the terminal. <var class="LITERAL">noecho()</var> switches --off echoing. The reason you might want to do this is to gain more --control over echoing or to suppress unnecessary echoing while --taking input from the user through the getch() etc. functions. Most --of the interactive programs call <var class= --"LITERAL">noecho()</var> at initialization and do the echoing of --characters in a controlled manner. It gives the programmer the --flexibility of echoing characters at any place in the window --without updating current (y,x) co-ordinates.</p> --</div> --<div class="SECT2"> --<hr> --<h3 class="SECT2"><a name="KEYPAD" id="KEYPAD">4.4. --keypad()</a></h3> --<p>This is my favorite initialization function. It enables the --reading of function keys like F1, F2, arrow keys etc. Almost every --interactive program enables this, as arrow keys are a major part of --any User Interface. Do <var class="LITERAL">keypad(stdscr, --TRUE)</var> to enable this feature for the regular screen (stdscr). --You will learn more about key management in later sections of this --document.</p> --</div> --<div class="SECT2"> --<hr> --<h3 class="SECT2"><a name="HALFDELAY" id="HALFDELAY">4.5. --halfdelay()</a></h3> --<p>This function, though not used very often, is a useful one at --times. halfdelay()is called to enable the half-delay mode, which is --similar to the cbreak() mode in that characters typed are --immediately available to program. However, it waits for 'X' tenths --of a second for input and then returns ERR, if no input is --available. 'X' is the timeout value passed to the function --halfdelay(). This function is useful when you want to ask the user --for input, and if he doesn't respond with in certain time, we can --do some thing else. One possible example is a timeout at the --password prompt.</p> --</div> --<div class="SECT2"> --<hr> --<h3 class="SECT2"><a name="MISCINIT" id="MISCINIT">4.6. --Miscellaneous Initialization functions</a></h3> --<p>There are few more functions which are called at initialization --to customize curses behavior. They are not used as extensively as --those mentioned above. Some of them are explained where --appropriate.</p> --</div> --<div class="SECT2"> --<hr> --<h3 class="SECT2"><a name="INITEX" id="INITEX">4.7. An --Example</a></h3> --<p>Let's write a program which will clarify the usage of these --functions.</p> --<div class="EXAMPLE"><a name="BINFU" id="BINFU"></a> --<p><b>Example 2. Initialization Function Usage example</b></p> --<table border="0" bgcolor="#E0E0E0" width="100%"> --<tr> --<td> --<pre class="PROGRAMLISTING"> --<font color="#000000"><span class= --"INLINEMEDIAOBJECT">#include &lt;ncurses.h&gt; -+{ -+ initscr(); /* Start curses mode */ -+ printw("Hello World !!!"); /* Print Hello World */ -+ refresh(); /* Print it on to the real screen */ -+ getch(); /* Wait for user input */ -+ endwin(); /* End curses mode */ -+ -+ return 0; -+}</SPAN -+></PRE -+></DIV -+></DIV -+><DIV -+CLASS="SECT2" -+><HR><H3 -+CLASS="SECT2" -+><A -+NAME="DISSECTION" -+>2.2. Dissection</A -+></H3 -+><P -+> -+The above program prints "Hello World !!!" to the screen and exits. This -+program shows how to initialize curses and do screen manipulation and -+end curses mode. Let's dissect it line by line. </P -+><DIV -+CLASS="SECT3" -+><HR><H4 -+CLASS="SECT3" -+><A -+NAME="ABOUT-INITSCR" -+>2.2.1. About initscr()</A -+></H4 -+><P -+>The function initscr() initializes the terminal in curses mode. In some -+implementations, it clears the screen and presents a blank screen. To do any -+screen manipulation using curses package this has to be called first. This -+function initializes the curses system and allocates memory for our present -+window (called <TT -+CLASS="LITERAL" -+>stdscr</TT -+>) and some other data-structures. Under extreme -+cases this function might fail due to insufficient memory to allocate memory -+for curses library's data structures. </P -+><P -+> -+After this is done, we can do a variety of initializations to customize -+our curses settings. These details will be explained <A -+HREF="#INIT" -+>later </A -+>.</P -+></DIV -+><DIV -+CLASS="SECT3" -+><HR><H4 -+CLASS="SECT3" -+><A -+NAME="MYST-REFRESH" -+>2.2.2. The mysterious refresh()</A -+></H4 -+><P -+>The next line printw prints the string "Hello World !!!" on to the screen. This -+function is analogous to normal printf in all respects except that it prints -+the data on a window called stdscr at the current (y,x) co-ordinates. Since our -+present co-ordinates are at 0,0 the string is printed at the left hand corner -+of the window.</P -+><P -+>This brings us to that mysterious refresh(). Well, when we called printw -+the data is actually written to an imaginary window, which is not updated -+on the screen yet. The job of printw is to update a few flags -+and data structures and write the data to a buffer corresponding to stdscr. -+In order to show it on the screen, we need to call refresh() and tell the -+curses system to dump the contents on the screen.</P -+><P -+>The philosophy behind all this is to allow the programmer to do multiple updates -+on the imaginary screen or windows and do a refresh once all his screen update -+is done. refresh() checks the window and updates only the portion which has been -+changed. This improves performance and offers greater flexibility too. But, it is -+sometimes frustrating to beginners. A common mistake committed by beginners is -+to forget to call refresh() after they did some update through printw() class of -+functions. I still forget to add it sometimes :-) </P -+></DIV -+><DIV -+CLASS="SECT3" -+><HR><H4 -+CLASS="SECT3" -+><A -+NAME="ABOUT-ENDWIN" -+>2.2.3. About endwin()</A -+></H4 -+><P -+>And finally don't forget to end the curses mode. Otherwise your terminal might -+behave strangely after the program quits. endwin() frees the memory taken by -+curses sub-system and its data structures and puts the terminal in normal -+mode. This function must be called after you are done with the curses mode. </P -+></DIV -+></DIV -+></DIV -+><DIV -+CLASS="SECT1" -+><HR><H2 -+CLASS="SECT1" -+><A -+NAME="GORY" -+>3. The Gory Details</A -+></H2 -+><P -+>Now that we have seen how to write a simple curses program let's get into the -+details. There are many functions that help customize what you see on screen and -+many features which can be put to full use. </P -+><P -+>Here we go...</P -+></DIV -+><DIV -+CLASS="SECT1" -+><HR><H2 -+CLASS="SECT1" -+><A -+NAME="INIT" -+>4. Initialization</A -+></H2 -+><P -+>We now know that to initialize curses system the function initscr() has to be -+called. There are functions which can be called after this initialization to -+customize our curses session. We may ask the curses system to set the terminal -+in raw mode or initialize color or initialize the mouse etc.. Let's discuss some -+of the functions that are normally called immediately after initscr();</P -+><DIV -+CLASS="SECT2" -+><HR><H3 -+CLASS="SECT2" -+><A -+NAME="ABOUTINIT" -+>4.1. Initialization functions</A -+></H3 -+><P -+> </P -+></DIV -+><DIV -+CLASS="SECT2" -+><HR><H3 -+CLASS="SECT2" -+><A -+NAME="RAWCBREAK" -+>4.2. raw() and cbreak()</A -+></H3 -+><P -+>Normally the terminal driver buffers the characters a user types until a new -+line or carriage return is encountered. But most programs require that the -+characters be available as soon as the user types them. The above two functions -+are used to disable line buffering. The difference between these two functions -+is in the way control characters like suspend (CTRL-Z), interrupt and quit -+(CTRL-C) are passed to the program. In the raw() mode these characters are -+directly passed to the program without generating a signal. In the -+<TT -+CLASS="LITERAL" -+>cbreak()</TT -+> mode these control characters are -+interpreted as any other character by the terminal driver. I personally prefer -+to use raw() as I can exercise greater control over what the user does.</P -+></DIV -+><DIV -+CLASS="SECT2" -+><HR><H3 -+CLASS="SECT2" -+><A -+NAME="ECHONOECHO" -+>4.3. echo() and noecho()</A -+></H3 -+><P -+> -+These functions control the echoing of characters typed by the user to the -+terminal. <TT -+CLASS="LITERAL" -+>noecho()</TT -+> switches off echoing. The -+reason you might want to do this is to gain more control over echoing or to -+suppress unnecessary echoing while taking input from the user through the -+getch() etc. functions. Most of the interactive programs call -+<TT -+CLASS="LITERAL" -+>noecho()</TT -+> at initialization and do the echoing -+of characters in a controlled manner. It gives the programmer the flexibility -+of echoing characters at any place in the window without updating current (y,x) -+co-ordinates. </P -+></DIV -+><DIV -+CLASS="SECT2" -+><HR><H3 -+CLASS="SECT2" -+><A -+NAME="KEYPAD" -+>4.4. keypad()</A -+></H3 -+><P -+>This is my favorite initialization function. It enables the reading of function -+keys like F1, F2, arrow keys etc. Almost every interactive program enables this, -+as arrow keys are a major part of any User Interface. Do -+<TT -+CLASS="LITERAL" -+>keypad(stdscr, TRUE) </TT -+> to enable this feature -+for the regular screen (stdscr). You will learn more about key management in -+later sections of this document.</P -+></DIV -+><DIV -+CLASS="SECT2" -+><HR><H3 -+CLASS="SECT2" -+><A -+NAME="HALFDELAY" -+>4.5. halfdelay()</A -+></H3 -+><P -+>This function, though not used very often, is a useful one at times. -+halfdelay()is called to enable the half-delay mode, which is similar to the -+cbreak() mode in that characters typed are immediately available to program. -+However, it waits for 'X' tenths of a second for input and then returns ERR, if -+no input is available. 'X' is the timeout value passed to the function -+halfdelay(). This function is useful when you want to ask the user for input, -+and if he doesn't respond with in certain time, we can do some thing else. One -+possible example is a timeout at the password prompt. </P -+></DIV -+><DIV -+CLASS="SECT2" -+><HR><H3 -+CLASS="SECT2" -+><A -+NAME="MISCINIT" -+>4.6. Miscellaneous Initialization functions</A -+></H3 -+><P -+>There are few more functions which are called at initialization to -+customize curses behavior. They are not used as extensively as those mentioned -+above. Some of them are explained where appropriate.</P -+></DIV -+><DIV -+CLASS="SECT2" -+><HR><H3 -+CLASS="SECT2" -+><A -+NAME="INITEX" -+>4.7. An Example</A -+></H3 -+><P -+>Let's write a program which will clarify the usage of these functions.</P -+><DIV -+CLASS="EXAMPLE" -+><A -+NAME="BINFU" -+></A -+><P -+><B -+>Example 2. Initialization Function Usage example </B -+></P -+><PRE -+CLASS="PROGRAMLISTING" -+><SPAN -+CLASS="INLINEMEDIAOBJECT" -+>#include &#60;ncurses.h&#62; - - int main() --{ int ch; -+{ int ch; - -- initscr(); /* Start curses mode */ -- raw(); /* Line buffering disabled */ -- keypad(stdscr, TRUE); /* We get F1, F2 etc.. */ -- noecho(); /* Don't echo() while we do getch */ -- -- printw("Type any character to see it in bold\n"); -- ch = getch(); /* If raw() hadn't been called -- * we have to press enter before it -- * gets to the program */ -- if(ch == KEY_F(1)) /* Without keypad enabled this will */ -- printw("F1 Key pressed");/* not get to us either */ -- /* Without noecho() some ugly escape -- * charachters might have been printed -- * on screen */ -- else -- { printw("The pressed key is "); -- attron(A_BOLD); -- printw("%c", ch); -- attroff(A_BOLD); -- } -- refresh(); /* Print it on to the real screen */ -- getch(); /* Wait for user input */ -- endwin(); /* End curses mode */ -- -- return 0; --}</span></font> --</pre></td> --</tr> --</table> --</div> --<p>This program is self-explanatory. But I used functions which --aren't explained yet. The function <var class= --"LITERAL">getch()</var> is used to get a character from user. It is --equivalent to normal <var class="LITERAL">getchar()</var> except --that we can disable the line buffering to avoid &lt;enter&gt; after --input. Look for more about <var class="LITERAL">getch()</var>and --reading keys in the <a href="#KEYS">key management section</a> . --The functions attron and attroff are used to switch some attributes --on and off respectively. In the example I used them to print the --character in bold. These functions are explained in detail --later.</p> --</div> --</div> --<div class="SECT1"> --<hr> --<h2 class="SECT1"><a name="AWORDWINDOWS" id="AWORDWINDOWS">5. A --Word about Windows</a></h2> --<p>Before we plunge into the myriad ncurses functions, let me clear --few things about windows. Windows are explained in detail in --following <a href="#WINDOWS">sections</a></p> --<p>A Window is an imaginary screen defined by curses system. A --window does not mean a bordered window which you usually see on --Win9X platforms. When curses is initialized, it creates a default --window named <var class="LITERAL">stdscr</var> which represents --your 80x25 (or the size of window in which you are running) screen. --If you are doing simple tasks like printing few strings, reading --input etc., you can safely use this single window for all of your --purposes. You can also create windows and call functions which --explicitly work on the specified window.</p> --<p>For example, if you call</p> --<table border="0" bgcolor="#E0E0E0" width="100%"> --<tr> --<td> --<pre class="PROGRAMLISTING"> --<font color="#000000"> printw("Hi There !!!"); -- refresh();</font> --</pre></td> --</tr> --</table> --<p>It prints the string on stdscr at the present cursor position. --Similarly the call to refresh(), works on stdscr only.</p> --<p>Say you have created <a href="#WINDOWS">windows</a> then you --have to call a function with a 'w' added to the usual function.</p> --<table border="0" bgcolor="#E0E0E0" width="100%"> --<tr> --<td> --<pre class="PROGRAMLISTING"> --<font color="#000000"> wprintw(win, "Hi There !!!"); -- wrefresh(win);</font> --</pre></td> --</tr> --</table> --<p>As you will see in the rest of the document, naming of functions --follow the same convention. For each function there usually are --three more functions.</p> --<table border="0" bgcolor="#E0E0E0" width="100%"> --<tr> --<td> --<pre class="PROGRAMLISTING"> --<font color= --"#000000"> printw(string); /* Print on stdscr at present cursor position */ -+ initscr(); /* Start curses mode */ -+ raw(); /* Line buffering disabled */ -+ keypad(stdscr, TRUE); /* We get F1, F2 etc.. */ -+ noecho(); /* Don't echo() while we do getch */ -+ -+ printw("Type any character to see it in bold\n"); -+ ch = getch(); /* If raw() hadn't been called -+ * we have to press enter before it -+ * gets to the program */ -+ if(ch == KEY_F(1)) /* Without keypad enabled this will */ -+ printw("F1 Key pressed");/* not get to us either */ -+ /* Without noecho() some ugly escape -+ * charachters might have been printed -+ * on screen */ -+ else -+ { printw("The pressed key is "); -+ attron(A_BOLD); -+ printw("%c", ch); -+ attroff(A_BOLD); -+ } -+ refresh(); /* Print it on to the real screen */ -+ getch(); /* Wait for user input */ -+ endwin(); /* End curses mode */ -+ -+ return 0; -+}</SPAN -+></PRE -+></DIV -+><P -+>This program is self-explanatory. But I used functions which aren't explained -+yet. The function <TT -+CLASS="LITERAL" -+>getch()</TT -+> is used to get a -+character from user. It is equivalent to normal -+<TT -+CLASS="LITERAL" -+>getchar()</TT -+> except that we can disable the line -+buffering to avoid &lt;enter&gt; after input. Look for more about -+<TT -+CLASS="LITERAL" -+>getch()</TT -+>and reading keys in the <A -+HREF="#KEYS" -+> key management section </A -+>. The functions attron and attroff -+are used to switch some attributes on and off respectively. In the example I -+used them to print the character in bold. These functions are explained in detail -+later.</P -+></DIV -+></DIV -+><DIV -+CLASS="SECT1" -+><HR><H2 -+CLASS="SECT1" -+><A -+NAME="AWORDWINDOWS" -+>5. A Word about Windows</A -+></H2 -+><P -+> -+Before we plunge into the myriad ncurses functions, let me clear few things -+about windows. Windows are explained in detail in following <A -+HREF="#WINDOWS" -+> sections </A -+></P -+><P -+>A Window is an imaginary screen defined by curses system. A window does not mean -+a bordered window which you usually see on Win9X platforms. When curses is -+initialized, it creates a default window named -+<TT -+CLASS="LITERAL" -+>stdscr</TT -+> which represents your 80x25 (or the size -+of window in which you are running) screen. If you are doing simple tasks like -+printing few strings, reading input etc., you can safely use this single window -+for all of your purposes. You can also create windows and call functions which -+explicitly work on the specified window.</P -+><P -+>For example, if you call</P -+><PRE -+CLASS="PROGRAMLISTING" -+> printw("Hi There !!!"); -+ refresh();</PRE -+><P -+>It prints the string on stdscr at the present cursor position. Similarly the -+call to refresh(), works on stdscr only. </P -+><P -+>Say you have created <A -+HREF="#WINDOWS" -+>windows</A -+> then you have to -+call a function with a 'w' added to the usual function.</P -+><PRE -+CLASS="PROGRAMLISTING" -+> wprintw(win, "Hi There !!!"); -+ wrefresh(win);</PRE -+><P -+>As you will see in the rest of the document, naming of functions follow the -+same convention. For each function there usually are three more functions.</P -+><PRE -+CLASS="PROGRAMLISTING" -+> printw(string); /* Print on stdscr at present cursor position */ - mvprintw(y, x, string);/* Move to (y, x) then print string */ - wprintw(win, string); /* Print on window win at present cursor position */ - /* in the window */ - mvwprintw(win, y, x, string); /* Move to (y, x) relative to window */ -- /* co-ordinates and then print */</font> --</pre></td> --</tr> --</table> --<p>Usually the w-less functions are macros which expand to --corresponding w-function with stdscr as the window parameter.</p> --</div> --<div class="SECT1"> --<hr> --<h2 class="SECT1"><a name="PRINTW" id="PRINTW">6. Output --functions</a></h2> --<p>I guess you can't wait any more to see some action. Back to our --odyssey of curses functions. Now that curses is initialized, let's --interact with world.</p> --<p>There are three classes of functions which you can use to do --output on screen.</p> --<ol type="1"> --<li> --<p>addch() class: Print single character with attributes</p> --</li> --<li> --<p>printw() class: Print formatted output similar to printf()</p> --</li> --<li> --<p>addstr() class: Print strings</p> --</li> --</ol> --<p>These functions can be used interchangeably and it's a matter of --style as to which class is used. Let's see each one in detail.</p> --<div class="SECT2"> --<hr> --<h3 class="SECT2"><a name="ADDCHCLASS" id="ADDCHCLASS">6.1. addch() --class of functions</a></h3> --<p>These functions put a single character into the current cursor --location and advance the position of the cursor. You can give the --character to be printed but they usually are used to print a --character with some attributes. Attributes are explained in detail --in later <a href="#ATTRIB">sections</a> of the document. If a --character is associated with an attribute(bold, reverse video --etc.), when curses prints the character, it is printed in that --attribute.</p> --<p>In order to combine a character with some attributes, you have --two options:</p> --<ul> --<li> --<p>By OR'ing a single character with the desired attribute macros. --These attribute macros could be found in the header file --<var class="LITERAL">ncurses.h</var>. For example, you want to --print a character ch(of type char) bold and underlined, you would --call addch() as below.</p> --<table border="0" bgcolor="#E0E0E0" width="90%"> --<tr> --<td> --<pre class="PROGRAMLISTING"> --<font color="#000000"> addch(ch | A_BOLD | A_UNDERLINE);</font> --</pre></td> --</tr> --</table> --</li> --<li> --<p>By using functions like <var class= --"LITERAL">attrset(),attron(),attroff()</var>. These functions are --explained in the <a href="#ATTRIB">Attributes</a> section. Briefly, --they manipulate the current attributes of the given window. Once --set, the character printed in the window are associated with the --attributes until it is turned off.</p> --</li> --</ul> --<p>Additionally, <var class="LITERAL">curses</var> provides some --special characters for character-based graphics. You can draw --tables, horizontal or vertical lines, etc. You can find all --avaliable characters in the header file <var class= --"LITERAL">ncurses.h</var>. Try looking for macros beginning with --<var class="LITERAL">ACS_</var> in this file.</p> --</div> --<div class="SECT2"> --<hr> --<h3 class="SECT2"><a name="AEN298" id="AEN298">6.2. mvaddch(), --waddch() and mvwaddch()</a></h3> --<p><var class="LITERAL">mvaddch()</var> is used to move the cursor --to a given point, and then print. Thus, the calls:</p> --<table border="0" bgcolor="#E0E0E0" width="100%"> --<tr> --<td> --<pre class="PROGRAMLISTING"> --<font color= --"#000000"> move(row,col); /* moves the cursor to row<em>th</em> row and col<em>th</em> column */ -- addch(ch);</font> --</pre></td> --</tr> --</table> -+ /* co-ordinates and then print */</PRE -+><P -+>Usually the w-less functions are macros which expand to corresponding w-function -+with stdscr as the window parameter.</P -+></DIV -+><DIV -+CLASS="SECT1" -+><HR><H2 -+CLASS="SECT1" -+><A -+NAME="PRINTW" -+>6. Output functions</A -+></H2 -+><P -+>I guess you can't wait any more to see some action. Back to our odyssey of -+curses functions. Now that curses is initialized, let's interact with -+world.</P -+><P -+>There are three classes of functions which you can use to do output on screen. -+<P -+></P -+><OL -+TYPE="1" -+><LI -+><P -+>addch() class: Print single character with attributes </P -+></LI -+><LI -+><P -+>printw() class: Print formatted output similar to printf()</P -+></LI -+><LI -+><P -+>addstr() class: Print strings</P -+></LI -+></OL -+></P -+><P -+>These functions can be used interchangeably and it's a matter of style as to -+which class is used. Let's see each one in detail.</P -+><DIV -+CLASS="SECT2" -+><HR><H3 -+CLASS="SECT2" -+><A -+NAME="ADDCHCLASS" -+>6.1. addch() class of functions</A -+></H3 -+><P -+>These functions put a single character into the current cursor location and -+advance the position of the cursor. You can give the character to be printed but -+they usually are used to print a character with some attributes. Attributes are -+explained in detail in later <A -+HREF="#ATTRIB" -+> sections </A -+> of the -+document. If a character is associated with an attribute(bold, reverse video -+etc.), when curses prints the character, it is printed in that attribute.</P -+><P -+>In order to combine a character with some attributes, you have two options:</P -+><P -+></P -+><UL -+><LI -+><P -+>By OR'ing a single character with the desired attribute macros. These attribute -+macros could be found in the header file -+<TT -+CLASS="LITERAL" -+>ncurses.h</TT -+>. For example, you want to print a -+character ch(of type char) bold and underlined, you would call addch() as below. -+<PRE -+CLASS="PROGRAMLISTING" -+> addch(ch | A_BOLD | A_UNDERLINE);</PRE -+></P -+></LI -+><LI -+><P -+>By using functions like <TT -+CLASS="LITERAL" -+>attrset(),attron(),attroff()</TT -+>. These functions are explained in the <A -+HREF="#ATTRIB" -+>Attributes</A -+> section. Briefly, they manipulate the current attributes of -+the given window. Once set, the character printed in the window are associated -+with the attributes until it is turned off.</P -+></LI -+></UL -+><P -+>Additionally, <TT -+CLASS="LITERAL" -+>curses</TT -+> provides some special -+characters for character-based graphics. You can draw tables, horizontal or -+vertical lines, etc. You can find all avaliable characters in the header file -+<TT -+CLASS="LITERAL" -+>ncurses.h</TT -+>. Try looking for macros beginning -+with <TT -+CLASS="LITERAL" -+>ACS_</TT -+> in this file. </P -+></DIV -+><DIV -+CLASS="SECT2" -+><HR><H3 -+CLASS="SECT2" -+><A -+NAME="AEN298" -+>6.2. mvaddch(), waddch() and mvwaddch()</A -+></H3 -+><P -+><TT -+CLASS="LITERAL" -+>mvaddch()</TT -+> is used to move the cursor to a -+given point, and then print. Thus, the calls: -+<PRE -+CLASS="PROGRAMLISTING" -+> move(row,col); /* moves the cursor to row<SPAN -+CLASS="emphasis" -+><I -+CLASS="EMPHASIS" -+>th</I -+></SPAN -+> row and col<SPAN -+CLASS="emphasis" -+><I -+CLASS="EMPHASIS" -+>th</I -+></SPAN -+> column */ -+ addch(ch);</PRE -+> - can be replaced by --<table border="0" bgcolor="#E0E0E0" width="100%"> --<tr> --<td> --<pre class="PROGRAMLISTING"> --<font color="#000000"> mvaddch(row,col,ch);</font> --</pre></td> --</tr> --</table> --<p><var class="LITERAL">waddch()</var> is similar to <var class= --"LITERAL">addch()</var>, except that it adds a character into the --given window. (Note that <var class="LITERAL">addch()</var> adds a --character into the window <var class="LITERAL">stdscr</var>.)</p> --<p>In a similar fashion <var class="LITERAL">mvwaddch()</var> --function is used to add a character into the given window at the --given coordinates.</p> --<p>Now, we are familiar with the basic output function <var class= --"LITERAL">addch()</var>. But, if we want to print a string, it --would be very annoying to print it character by character. --Fortunately, <var class="LITERAL">ncurses</var> provides --<var class="LITERAL">printf</var><em>-like</em> or <var class= --"LITERAL">puts</var><em>-like</em> functions.</p> --</div> --<div class="SECT2"> --<hr> --<h3 class="SECT2"><a name="PRINTWCLASS" id="PRINTWCLASS">6.3. --printw() class of functions</a></h3> --<p>These functions are similar to <var class= --"LITERAL">printf()</var> with the added capability of printing at --any position on the screen.</p> --<div class="SECT3"> --<hr> --<h4 class="SECT3"><a name="PRINTWMVPRINTW" id= --"PRINTWMVPRINTW">6.3.1. printw() and mvprintw</a></h4> --<p>These two functions work much like <var class= --"LITERAL">printf()</var>. <var class="LITERAL">mvprintw()</var> can --be used to move the cursor to a position and then print. If you --want to move the cursor first and then print using <var class= --"LITERAL">printw()</var> function, use <var class= --"LITERAL">move()</var> first and then use <var class= --"LITERAL">printw()</var> though I see no point why one should avoid --using <var class="LITERAL">mvprintw()</var>, you have the --flexibility to manipulate.</p> --</div> --<div class="SECT3"> --<hr> --<h4 class="SECT3"><a name="WPRINTWMVWPRINTW" id= --"WPRINTWMVWPRINTW">6.3.2. wprintw() and mvwprintw</a></h4> --<p>These two functions are similar to above two except that they --print in the corresponding window given as argument.</p> --</div> --<div class="SECT3"> --<hr> --<h4 class="SECT3"><a name="VWPRINTW" id="VWPRINTW">6.3.3. --vwprintw()</a></h4> --<p>This function is similar to <var class= --"LITERAL">vprintf()</var>. This can be used when variable number of --arguments are to be printed.</p> --</div> --<div class="SECT3"> --<hr> --<h4 class="SECT3"><a name="SIMPLEPRINTWEX" id= --"SIMPLEPRINTWEX">6.3.4. A Simple printw example</a></h4> --<div class="EXAMPLE"><a name="BPREX" id="BPREX"></a> --<p><b>Example 3. A Simple printw example</b></p> --<table border="0" bgcolor="#E0E0E0" width="100%"> --<tr> --<td> --<pre class="PROGRAMLISTING"> --<font color="#000000"><span class= --"INLINEMEDIAOBJECT">#include &lt;ncurses.h&gt; /* ncurses.h includes stdio.h */ --#include &lt;string.h&gt; -+<PRE -+CLASS="PROGRAMLISTING" -+> mvaddch(row,col,ch);</PRE -+></P -+><P -+><TT -+CLASS="LITERAL" -+>waddch()</TT -+> is similar to -+<TT -+CLASS="LITERAL" -+>addch()</TT -+>, except that it adds a character into -+the given window. (Note that <TT -+CLASS="LITERAL" -+>addch()</TT -+> adds a -+character into the window <TT -+CLASS="LITERAL" -+>stdscr</TT -+>.)</P -+><P -+>In a similar fashion <TT -+CLASS="LITERAL" -+>mvwaddch()</TT -+> function is -+used to add a character into the given window at the given coordinates.</P -+><P -+>Now, we are familiar with the basic output function -+<TT -+CLASS="LITERAL" -+>addch()</TT -+>. But, if we want to print a string, it -+would be very annoying to print it character by character. Fortunately, -+<TT -+CLASS="LITERAL" -+>ncurses</TT -+> provides <TT -+CLASS="LITERAL" -+>printf</TT -+><SPAN -+CLASS="emphasis" -+><I -+CLASS="EMPHASIS" -+>-like</I -+></SPAN -+> or -+<TT -+CLASS="LITERAL" -+>puts</TT -+><SPAN -+CLASS="emphasis" -+><I -+CLASS="EMPHASIS" -+>-like</I -+></SPAN -+> functions.</P -+></DIV -+><DIV -+CLASS="SECT2" -+><HR><H3 -+CLASS="SECT2" -+><A -+NAME="PRINTWCLASS" -+>6.3. printw() class of functions</A -+></H3 -+><P -+>These functions are similar to <TT -+CLASS="LITERAL" -+>printf()</TT -+> with -+the added capability of printing at any position on the screen. </P -+><DIV -+CLASS="SECT3" -+><HR><H4 -+CLASS="SECT3" -+><A -+NAME="PRINTWMVPRINTW" -+>6.3.1. printw() and mvprintw</A -+></H4 -+><P -+>These two functions work much like <TT -+CLASS="LITERAL" -+>printf()</TT -+>. -+<TT -+CLASS="LITERAL" -+>mvprintw()</TT -+> can be used to move the cursor to a -+position and then print. If you want to move the cursor first and then print -+using <TT -+CLASS="LITERAL" -+>printw()</TT -+> function, use -+<TT -+CLASS="LITERAL" -+>move() </TT -+> first and then use -+<TT -+CLASS="LITERAL" -+>printw()</TT -+> though I see no point why one should -+avoid using <TT -+CLASS="LITERAL" -+>mvprintw()</TT -+>, you have the -+flexibility to manipulate. </P -+></DIV -+><DIV -+CLASS="SECT3" -+><HR><H4 -+CLASS="SECT3" -+><A -+NAME="WPRINTWMVWPRINTW" -+>6.3.2. wprintw() and mvwprintw</A -+></H4 -+><P -+>These two functions are similar to above two except that they print in the -+corresponding window given as argument. </P -+></DIV -+><DIV -+CLASS="SECT3" -+><HR><H4 -+CLASS="SECT3" -+><A -+NAME="VWPRINTW" -+>6.3.3. vwprintw()</A -+></H4 -+><P -+>This function is similar to <TT -+CLASS="LITERAL" -+>vprintf()</TT -+>. This can -+be used when variable number of arguments are to be printed.</P -+></DIV -+><DIV -+CLASS="SECT3" -+><HR><H4 -+CLASS="SECT3" -+><A -+NAME="SIMPLEPRINTWEX" -+>6.3.4. A Simple printw example</A -+></H4 -+><DIV -+CLASS="EXAMPLE" -+><A -+NAME="BPREX" -+></A -+><P -+><B -+>Example 3. A Simple printw example </B -+></P -+><PRE -+CLASS="PROGRAMLISTING" -+><SPAN -+CLASS="INLINEMEDIAOBJECT" -+>#include &#60;ncurses.h&#62; /* ncurses.h includes stdio.h */ -+#include &#60;string.h&#62; - - int main() - { -- char mesg[]="Just a string"; /* message to be appeared on the screen */ -- int row,col; /* to store the number of rows and * -- * the number of colums of the screen */ -- initscr(); /* start the curses mode */ -- getmaxyx(stdscr,row,col); /* get the number of rows and columns */ -+ char mesg[]="Just a string"; /* message to be appeared on the screen */ -+ int row,col; /* to store the number of rows and * -+ * the number of colums of the screen */ -+ initscr(); /* start the curses mode */ -+ getmaxyx(stdscr,row,col); /* get the number of rows and columns */ - mvprintw(row/2,(col-strlen(mesg))/2,"%s",mesg); -- /* print the message at the center of the screen */ -+ /* print the message at the center of the screen */ - mvprintw(row-2,0,"This screen has %d rows and %d columns\n",row,col); - printw("Try resizing your window(if possible) and then run this program again"); - refresh(); -@@ -1268,192 +2327,302 @@ - endwin(); - - return 0; --}</span></font> --</pre></td> --</tr> --</table> --</div> --<p>Above program demonstrates how easy it is to use <var class= --"LITERAL">printw</var>. You just feed the coordinates and the --message to be appeared on the screen, then it does what you --want.</p> --<p>The above program introduces us to a new function <var class= --"LITERAL">getmaxyx()</var>, a macro defined in <var class= --"LITERAL">ncurses.h</var>. It gives the number of columns and the --number of rows in a given window. <var class= --"LITERAL">getmaxyx()</var> does this by updating the variables --given to it. Since <var class="LITERAL">getmaxyx()</var> is not a --function we don't pass pointers to it, we just give two integer --variables.</p> --</div> --</div> --<div class="SECT2"> --<hr> --<h3 class="SECT2"><a name="ADDSTRCLASS" id="ADDSTRCLASS">6.4. --addstr() class of functions</a></h3> --<p><var class="LITERAL">addstr()</var> is used to put a character --string into a given window. This function is similar to calling --<var class="LITERAL">addch()</var> once for each character in a --given string. This is true for all output functions. There are --other functions from this family such as <var class= --"LITERAL">mvaddstr(),mvwaddstr()</var> and <var class= --"LITERAL">waddstr()</var>, which obey the naming convention of --curses.(e.g. mvaddstr() is similar to the respective calls move() --and then addstr().) Another function of this family is addnstr(), --which takes an integer parameter(say n) additionally. This function --puts at most n characters into the screen. If n is negative, then --the entire string will be added.</p> --</div> --<div class="SECT2"> --<hr> --<h3 class="SECT2"><a name="ACAUTION" id="ACAUTION">6.5. A word of --caution</a></h3> --<p>All these functions take y co-ordinate first and then x in their --arguments. A common mistake by beginners is to pass x,y in that --order. If you are doing too many manipulations of (y,x) --co-ordinates, think of dividing the screen into windows and --manipulate each one separately. Windows are explained in the --<a href="#WINDOWS">windows</a> section.</p> --</div> --</div> --<div class="SECT1"> --<hr> --<h2 class="SECT1"><a name="SCANW" id="SCANW">7. Input --functions</a></h2> --<p>Well, printing without taking input, is boring. Let's see --functions which allow us to get input from user. These functions --also can be divided into three categories.</p> --<ol type="1"> --<li> --<p>getch() class: Get a character</p> --</li> --<li> --<p>scanw() class: Get formatted input</p> --</li> --<li> --<p>getstr() class: Get strings</p> --</li> --</ol> --<div class="SECT2"> --<hr> --<h3 class="SECT2"><a name="GETCHCLASS" id="GETCHCLASS">7.1. getch() --class of functions</a></h3> --<p>These functions read a single character from the terminal. But --there are several subtle facts to consider. For example if you --don't use the function cbreak(), curses will not read your input --characters contiguously but will begin read them only after a new --line or an EOF is encountered. In order to avoid this, the cbreak() --function must used so that characters are immediately available to --your program. Another widely used function is noecho(). As the name --suggests, when this function is set (used), the characters that are --keyed in by the user will not show up on the screen. The two --functions cbreak() and noecho() are typical examples of key --management. Functions of this genre are explained in the <a href= --"#KEYS">key management section</a> .</p> --</div> --<div class="SECT2"> --<hr> --<h3 class="SECT2"><a name="SCANWCLASS" id="SCANWCLASS">7.2. scanw() --class of functions</a></h3> --<p>These functions are similar to <var class= --"LITERAL">scanf()</var> with the added capability of getting the --input from any location on the screen.</p> --<div class="SECT3"> --<hr> --<h4 class="SECT3"><a name="SCANWMVSCANW" id="SCANWMVSCANW">7.2.1. --scanw() and mvscanw</a></h4> --<p>The usage of these functions is similar to that of <var class= --"LITERAL">sscanf()</var>, where the line to be scanned is provided --by <var class="LITERAL">wgetstr()</var> function. That is, these --functions call to <var class="LITERAL">wgetstr()</var> --function(explained below) and uses the resulting line for a --scan.</p> --</div> --<div class="SECT3"> --<hr> --<h4 class="SECT3"><a name="WSCANWMVWSCANW" id= --"WSCANWMVWSCANW">7.2.2. wscanw() and mvwscanw()</a></h4> --<p>These are similar to above two functions except that they read --from a window, which is supplied as one of the arguments to these --functions.</p> --</div> --<div class="SECT3"> --<hr> --<h4 class="SECT3"><a name="VWSCANW" id="VWSCANW">7.2.3. --vwscanw()</a></h4> --<p>This function is similar to <var class="LITERAL">vscanf()</var>. --This can be used when a variable number of arguments are to be --scanned.</p> --</div> --</div> --<div class="SECT2"> --<hr> --<h3 class="SECT2"><a name="GETSTRCLASS" id="GETSTRCLASS">7.3. --getstr() class of functions</a></h3> --<p>These functions are used to get strings from the terminal. In --essence, this function performs the same task as would be achieved --by a series of calls to <var class="LITERAL">getch()</var> until a --newline, carriage return, or end-of-file is received. The resulting --string of characters are pointed to by <var class= --"LITERAL">str</var>, which is a character pointer provided by the --user.</p> --</div> --<div class="SECT2"> --<hr> --<h3 class="SECT2"><a name="GETSTREX" id="GETSTREX">7.4. Some --examples</a></h3> --<div class="EXAMPLE"><a name="BSCEX" id="BSCEX"></a> --<p><b>Example 4. A Simple scanw example</b></p> --<table border="0" bgcolor="#E0E0E0" width="100%"> --<tr> --<td> --<pre class="PROGRAMLISTING"> --<font color="#000000"><span class= --"INLINEMEDIAOBJECT">#include &lt;ncurses.h&gt; /* ncurses.h includes stdio.h */ --#include &lt;string.h&gt; -+}</SPAN -+></PRE -+></DIV -+><P -+>Above program demonstrates how easy it is to use <TT -+CLASS="LITERAL" -+>printw</TT -+>. You just feed the coordinates and the message to be appeared -+on the screen, then it does what you want.</P -+><P -+>The above program introduces us to a new function -+<TT -+CLASS="LITERAL" -+>getmaxyx()</TT -+>, a macro defined in -+<TT -+CLASS="LITERAL" -+>ncurses.h</TT -+>. It gives the number of columns and -+the number of rows in a given window. -+<TT -+CLASS="LITERAL" -+>getmaxyx()</TT -+> does this by updating the variables -+given to it. Since <TT -+CLASS="LITERAL" -+>getmaxyx()</TT -+> is not a function -+we don't pass pointers to it, we just give two integer variables. </P -+></DIV -+></DIV -+><DIV -+CLASS="SECT2" -+><HR><H3 -+CLASS="SECT2" -+><A -+NAME="ADDSTRCLASS" -+>6.4. addstr() class of functions</A -+></H3 -+><P -+><TT -+CLASS="LITERAL" -+>addstr()</TT -+> is used to put a character string into -+a given window. This function is similar to calling -+<TT -+CLASS="LITERAL" -+>addch()</TT -+> once for each character in a given -+string. This is true for all output functions. There are other functions from -+this family such as <TT -+CLASS="LITERAL" -+>mvaddstr(),mvwaddstr()</TT -+> and -+<TT -+CLASS="LITERAL" -+>waddstr()</TT -+>, which obey the naming convention of -+curses.(e.g. mvaddstr() is similar to the respective calls move() and then -+addstr().) Another function of this family is addnstr(), which takes an integer -+parameter(say n) additionally. This function puts at most n characters into the -+screen. If n is negative, then the entire string will be added. </P -+></DIV -+><DIV -+CLASS="SECT2" -+><HR><H3 -+CLASS="SECT2" -+><A -+NAME="ACAUTION" -+>6.5. A word of caution</A -+></H3 -+><P -+>All these functions take y co-ordinate first and then x in their arguments. -+A common mistake by beginners is to pass x,y in that order. If you are -+doing too many manipulations of (y,x) co-ordinates, think of dividing the -+screen into windows and manipulate each one separately. Windows are explained -+in the <A -+HREF="#WINDOWS" -+> windows </A -+> section.</P -+></DIV -+></DIV -+><DIV -+CLASS="SECT1" -+><HR><H2 -+CLASS="SECT1" -+><A -+NAME="SCANW" -+>7. Input functions</A -+></H2 -+><P -+>Well, printing without taking input, is boring. Let's see functions which -+allow us to get input from user. These functions also can be divided into -+three categories.</P -+><P -+></P -+><OL -+TYPE="1" -+><LI -+><P -+>getch() class: Get a character</P -+></LI -+><LI -+><P -+>scanw() class: Get formatted input</P -+></LI -+><LI -+><P -+>getstr() class: Get strings</P -+></LI -+></OL -+><DIV -+CLASS="SECT2" -+><HR><H3 -+CLASS="SECT2" -+><A -+NAME="GETCHCLASS" -+>7.1. getch() class of functions</A -+></H3 -+><P -+>These functions read a single character from the terminal. But there are several -+subtle facts to consider. For example if you don't use the function cbreak(), -+curses will not read your input characters contiguously but will begin read them -+only after a new line or an EOF is encountered. In order to avoid this, the -+cbreak() function must used so that characters are immediately available to your -+program. Another widely used function is noecho(). As the name suggests, when -+this function is set (used), the characters that are keyed in by the user will -+not show up on the screen. The two functions cbreak() and noecho() are typical -+examples of key management. Functions of this genre are explained in the -+<A -+HREF="#KEYS" -+>key management section </A -+>.</P -+></DIV -+><DIV -+CLASS="SECT2" -+><HR><H3 -+CLASS="SECT2" -+><A -+NAME="SCANWCLASS" -+>7.2. scanw() class of functions</A -+></H3 -+><P -+>These functions are similar to <TT -+CLASS="LITERAL" -+>scanf()</TT -+> with the -+added capability of getting the input from any location on the screen.</P -+><DIV -+CLASS="SECT3" -+><HR><H4 -+CLASS="SECT3" -+><A -+NAME="SCANWMVSCANW" -+>7.2.1. scanw() and mvscanw</A -+></H4 -+><P -+>The usage of these functions is similar to that of -+<TT -+CLASS="LITERAL" -+>sscanf()</TT -+>, where the line to be scanned is -+provided by <TT -+CLASS="LITERAL" -+>wgetstr()</TT -+> function. That is, these -+functions call to <TT -+CLASS="LITERAL" -+>wgetstr()</TT -+> function(explained -+below) and uses the resulting line for a scan. </P -+></DIV -+><DIV -+CLASS="SECT3" -+><HR><H4 -+CLASS="SECT3" -+><A -+NAME="WSCANWMVWSCANW" -+>7.2.2. wscanw() and mvwscanw()</A -+></H4 -+><P -+>These are similar to above two functions except that they read from a window, -+which is supplied as one of the arguments to these functions. </P -+></DIV -+><DIV -+CLASS="SECT3" -+><HR><H4 -+CLASS="SECT3" -+><A -+NAME="VWSCANW" -+>7.2.3. vwscanw()</A -+></H4 -+><P -+>This function is similar to <TT -+CLASS="LITERAL" -+>vscanf()</TT -+>. This can -+be used when a variable number of arguments are to be scanned.</P -+></DIV -+></DIV -+><DIV -+CLASS="SECT2" -+><HR><H3 -+CLASS="SECT2" -+><A -+NAME="GETSTRCLASS" -+>7.3. getstr() class of functions</A -+></H3 -+><P -+>These functions are used to get strings from the terminal. In essence, this -+function performs the same task as would be achieved by a series of calls to -+<TT -+CLASS="LITERAL" -+>getch()</TT -+> until a newline, carriage return, or -+end-of-file is received. The resulting string of characters are pointed to by -+<TT -+CLASS="LITERAL" -+>str</TT -+>, which is a character pointer provided by -+the user.</P -+></DIV -+><DIV -+CLASS="SECT2" -+><HR><H3 -+CLASS="SECT2" -+><A -+NAME="GETSTREX" -+>7.4. Some examples</A -+></H3 -+><DIV -+CLASS="EXAMPLE" -+><A -+NAME="BSCEX" -+></A -+><P -+><B -+>Example 4. A Simple scanw example </B -+></P -+><PRE -+CLASS="PROGRAMLISTING" -+><SPAN -+CLASS="INLINEMEDIAOBJECT" -+>#include &#60;ncurses.h&#62; /* ncurses.h includes stdio.h */ -+#include &#60;string.h&#62; - - int main() - { -- char mesg[]="Enter a string: "; /* message to be appeared on the screen */ -+ char mesg[]="Enter a string: "; /* message to be appeared on the screen */ - char str[80]; -- int row,col; /* to store the number of rows and * -- * the number of colums of the screen */ -- initscr(); /* start the curses mode */ -- getmaxyx(stdscr,row,col); /* get the number of rows and columns */ -+ int row,col; /* to store the number of rows and * -+ * the number of colums of the screen */ -+ initscr(); /* start the curses mode */ -+ getmaxyx(stdscr,row,col); /* get the number of rows and columns */ - mvprintw(row/2,(col-strlen(mesg))/2,"%s",mesg); -- /* print the message at the center of the screen */ -+ /* print the message at the center of the screen */ - getstr(str); - mvprintw(LINES - 2, 0, "You Entered: %s", str); - getch(); - endwin(); - - return 0; --}</span></font> --</pre></td> --</tr> --</table> --</div> --</div> --</div> --<div class="SECT1"> --<hr> --<h2 class="SECT1"><a name="ATTRIB" id="ATTRIB">8. --Attributes</a></h2> --<p>We have seen an example of how attributes can be used to print --characters with some special effects. Attributes, when set --prudently, can present information in an easy, understandable --manner. The following program takes a C file as input and prints --the file with comments in bold. Scan through the code.</p> --<div class="EXAMPLE"><a name="BSIAT" id="BSIAT"></a> --<p><b>Example 5. A Simple Attributes example</b></p> --<table border="0" bgcolor="#E0E0E0" width="100%"> --<tr> --<td> --<pre class="PROGRAMLISTING"> --<font color="#000000"><span class= --"INLINEMEDIAOBJECT">/* pager functionality by Joseph Spainhour" &lt;spainhou@bellsouth.net&gt; */ --#include &lt;ncurses.h&gt; --#include &lt;stdlib.h&gt; -+}</SPAN -+></PRE -+></DIV -+></DIV -+></DIV -+><DIV -+CLASS="SECT1" -+><HR><H2 -+CLASS="SECT1" -+><A -+NAME="ATTRIB" -+>8. Attributes</A -+></H2 -+><P -+>We have seen an example of how attributes can be used to print characters with -+some special effects. Attributes, when set prudently, can present information in -+an easy, understandable manner. The following program takes a C file as input -+and prints the file with comments in bold. Scan through the code. </P -+><DIV -+CLASS="EXAMPLE" -+><A -+NAME="BSIAT" -+></A -+><P -+><B -+>Example 5. A Simple Attributes example </B -+></P -+><PRE -+CLASS="PROGRAMLISTING" -+><SPAN -+CLASS="INLINEMEDIAOBJECT" -+>/* pager functionality by Joseph Spainhour" &#60;spainhou@bellsouth.net&#62; */ -+#include &#60;ncurses.h&#62; -+#include &#60;stdlib.h&#62; - - int main(int argc, char *argv[]) - { -@@ -1464,7 +2633,7 @@ - - if(argc != 2) - { -- printf("Usage: %s &lt;a c file name&gt;\n", argv[0]); -+ printf("Usage: %s &#60;a c file name&#62;\n", argv[0]); - exit(1); - } - fp = fopen(argv[1], "r"); -@@ -1473,77 +2642,101 @@ - perror("Cannot open input file"); - exit(1); - } -- initscr(); /* Start curses mode */ -- getmaxyx(stdscr, row, col); /* find the boundaries of the screeen */ -- while((ch = fgetc(fp)) != EOF) /* read the file till we reach the end */ -+ initscr(); /* Start curses mode */ -+ getmaxyx(stdscr, row, col); /* find the boundaries of the screeen */ -+ while((ch = fgetc(fp)) != EOF) /* read the file till we reach the end */ - { -- getyx(stdscr, y, x); /* get the current curser position */ -- if(y == (row - 1)) /* are we are at the end of the screen */ -+ getyx(stdscr, y, x); /* get the current curser position */ -+ if(y == (row - 1)) /* are we are at the end of the screen */ - { -- printw("&lt;-Press Any Key-&gt;"); /* tell the user to press a key */ -+ printw("&#60;-Press Any Key-&#62;"); /* tell the user to press a key */ - getch(); -- clear(); /* clear the screen */ -- move(0, 0); /* start at the beginning of the screen */ -+ clear(); /* clear the screen */ -+ move(0, 0); /* start at the beginning of the screen */ - } -- if(prev == '/' &amp;&amp; ch == '*') /* If it is / and * then only -- * switch bold on */ -+ if(prev == '/' &#38;&#38; ch == '*') /* If it is / and * then only -+ * switch bold on */ - { -- attron(A_BOLD); /* cut bold on */ -- getyx(stdscr, y, x); /* get the current curser position */ -- move(y, x - 1); /* back up one space */ -- printw("%c%c", '/', ch); /* The actual printing is done here */ -+ attron(A_BOLD); /* cut bold on */ -+ getyx(stdscr, y, x); /* get the current curser position */ -+ move(y, x - 1); /* back up one space */ -+ printw("%c%c", '/', ch); /* The actual printing is done here */ - } - else - printw("%c", ch); - refresh(); -- if(prev == '*' &amp;&amp; ch == '/') -- attroff(A_BOLD); /* Switch it off once we got * -- * and then / */ -+ if(prev == '*' &#38;&#38; ch == '/') -+ attroff(A_BOLD); /* Switch it off once we got * -+ * and then / */ - prev = ch; - } -- endwin(); /* End curses mode */ -+ endwin(); /* End curses mode */ - fclose(fp); - return 0; --}</span></font> --</pre></td> --</tr> --</table> --</div> --<p>Don't worry about all those initialization and other crap. --Concentrate on the while loop. It reads each character in the file --and searches for the pattern /*. Once it spots the pattern, it --switches the BOLD attribute on with <var class= --"LITERAL">attron()</var> . When we get the pattern */ it is --switched off by <var class="LITERAL">attroff()</var> .</p> --<p>The above program also introduces us to two useful functions --<var class="LITERAL">getyx()</var> and <var class= --"LITERAL">move()</var>. The first function gets the co-ordinates of --the present cursor into the variables y, x. Since getyx() is a -+}</SPAN -+></PRE -+></DIV -+><P -+> -+Don't worry about all those initialization and other crap. Concentrate on -+the while loop. It reads each character in the file and searches for the -+pattern /*. Once it spots the pattern, it switches the BOLD attribute on with -+<TT -+CLASS="LITERAL" -+> attron()</TT -+> . When we get the pattern */ it is -+switched off by <TT -+CLASS="LITERAL" -+> attroff()</TT -+> .</P -+><P -+> -+The above program also introduces us to two useful functions -+<TT -+CLASS="LITERAL" -+>getyx() </TT -+> and -+<TT -+CLASS="LITERAL" -+>move()</TT -+>. The first function gets the -+co-ordinates of the present cursor into the variables y, x. Since getyx() is a - macro we don't have to pass pointers to variables. The function --<var class="LITERAL">move()</var> moves the cursor to the --co-ordinates given to it.</p> --<p>The above program is really a simple one which doesn't do much. --On these lines one could write a more useful program which reads a --C file, parses it and prints it in different colors. One could even --extend it to other languages as well.</p> --<div class="SECT2"> --<hr> --<h3 class="SECT2"><a name="ATTRIBDETAILS" id="ATTRIBDETAILS">8.1. --The details</a></h3> --<p>Let's get into more details of attributes. The functions --<var class="LITERAL">attron(), attroff(), attrset()</var> , and --their sister functions <var class="LITERAL">attr_get()</var> etc.. --can be used to switch attributes on/off , get attributes and --produce a colorful display.</p> --<p>The functions attron and attroff take a bit-mask of attributes --and switch them on or off, respectively. The following video --attributes, which are defined in &lt;curses.h&gt; can be passed to --these functions.</p> --<table border="0" bgcolor="#E0E0E0" width="100%"> --<tr> --<td> --<pre class="PROGRAMLISTING"> --<font color="#000000"> -+<TT -+CLASS="LITERAL" -+>move()</TT -+> moves the cursor to the co-ordinates -+given to it. </P -+><P -+> -+The above program is really a simple one which doesn't do much. On these lines -+one could write a more useful program which reads a C file, parses it and prints -+it in different colors. One could even extend it to other languages as well.</P -+><DIV -+CLASS="SECT2" -+><HR><H3 -+CLASS="SECT2" -+><A -+NAME="ATTRIBDETAILS" -+>8.1. The details</A -+></H3 -+><P -+>Let's get into more details of attributes. The functions <TT -+CLASS="LITERAL" -+>attron(), attroff(), attrset() </TT -+>, and their sister functions -+<TT -+CLASS="LITERAL" -+> attr_get()</TT -+> etc.. can be used to switch -+attributes on/off , get attributes and produce a colorful display.</P -+><P -+>The functions attron and attroff take a bit-mask of attributes and switch them -+on or off, respectively. The following video attributes, which are defined in -+&lt;curses.h&gt; can be passed to these functions. </P -+><PRE -+CLASS="PROGRAMLISTING" -+> - A_NORMAL Normal display (no highlight) - A_STANDOUT Best highlighting mode of the terminal. - A_UNDERLINE Underlining -@@ -1556,368 +2749,445 @@ - A_ALTCHARSET Alternate character set - A_CHARTEXT Bit-mask to extract a character - COLOR_PAIR(n) Color-pair number n -- </font> --</pre></td> --</tr> --</table> --<p>The last one is the most colorful one :-) Colors are explained --in the <a href="#color" target="_top">next sections</a>.</p> --<p>We can OR(|) any number of above attributes to get a combined --effect. If you wanted reverse video with blinking characters you --can use</p> --<table border="0" bgcolor="#E0E0E0" width="100%"> --<tr> --<td> --<pre class="PROGRAMLISTING"> --<font color="#000000"> attron(A_REVERSE | A_BLINK);</font> --</pre></td> --</tr> --</table> --</div> --<div class="SECT2"> --<hr> --<h3 class="SECT2"><a name="ATTRONVSATTRSET" id= --"ATTRONVSATTRSET">8.2. attron() vs attrset()</a></h3> --<p>Then what is the difference between attron() and attrset()? --attrset sets the attributes of window whereas attron just switches --on the attribute given to it. So attrset() fully overrides whatever --attributes the window previously had and sets it to the new --attribute(s). Similarly attroff() just switches off the --attribute(s) given to it as an argument. This gives us the --flexibility of managing attributes easily.But if you use them --carelessly you may loose track of what attributes the window has --and garble the display. This is especially true while managing --menus with colors and highlighting. So decide on a consistent --policy and stick to it. You can always use <var class= --"LITERAL">standend()</var> which is equivalent to <var class= --"LITERAL">attrset(A_NORMAL)</var> which turns off all attributes --and brings you to normal mode.</p> --</div> --<div class="SECT2"> --<hr> --<h3 class="SECT2"><a name="ATTR_GET" id="ATTR_GET">8.3. --attr_get()</a></h3> --<p>The function attr_get() gets the current attributes and color --pair of the window. Though we might not use this as often as the --above functions, this is useful in scanning areas of screen. Say we --wanted to do some complex update on screen and we are not sure what --attribute each character is associated with. Then this function can --be used with either attrset or attron to produce the desired --effect.</p> --</div> --<div class="SECT2"> --<hr> --<h3 class="SECT2"><a name="ATTR_FUNCS" id="ATTR_FUNCS">8.4. attr_ --functions</a></h3> --<p>There are series of functions like attr_set(), attr_on etc.. --These are similar to above functions except that they take --parameters of type <var class="LITERAL">attr_t</var>.</p> --</div> --<div class="SECT2"> --<hr> --<h3 class="SECT2"><a name="WATTRFUNCS" id="WATTRFUNCS">8.5. wattr --functions</a></h3> --<p>For each of the above functions we have a corresponding function --with 'w' which operates on a particular window. The above functions --operate on stdscr.</p> --</div> --<div class="SECT2"> --<hr> --<h3 class="SECT2"><a name="CHGAT" id="CHGAT">8.6. chgat() --functions</a></h3> --<p>The function chgat() is listed in the end of the man page --curs_attr. It actually is a useful one. This function can be used --to set attributes for a group of characters without moving. I mean --it !!! without moving the cursor :-) It changes the attributes of a --given number of characters starting at the current cursor --location.</p> --<p>We can give -1 as the character count to update till end of --line. If you want to change attributes of characters from current --position to end of line, just use this.</p> --<table border="0" bgcolor="#E0E0E0" width="100%"> --<tr> --<td> --<pre class="PROGRAMLISTING"> --<font color="#000000"> chgat(-1, A_REVERSE, 0, NULL);</font> --</pre></td> --</tr> --</table> --<p>This function is useful when changing attributes for characters --that are already on the screen. Move to the character from which --you want to change and change the attribute.</p> --<p>Other functions wchgat(), mvchgat(), wchgat() behave similarly --except that the w functions operate on the particular window. The --mv functions first move the cursor then perform the work given to --them. Actually chgat is a macro which is replaced by a wchgat() --with stdscr as the window. Most of the "w-less" functions are --macros.</p> --<div class="EXAMPLE"><a name="BWICH" id="BWICH"></a> --<p><b>Example 6. Chgat() Usage example</b></p> --<table border="0" bgcolor="#E0E0E0" width="100%"> --<tr> --<td> --<pre class="PROGRAMLISTING"> --<font color="#000000"><span class= --"INLINEMEDIAOBJECT">#include &lt;ncurses.h&gt; -+ </PRE -+><P -+> -+The last one is the most colorful one :-) Colors are explained in the -+<A -+HREF="#color" -+TARGET="_top" -+>next sections</A -+>.</P -+><P -+>We can OR(|) any number of above attributes to get a combined effect. If you -+wanted reverse video with blinking characters you can use</P -+><PRE -+CLASS="PROGRAMLISTING" -+> attron(A_REVERSE | A_BLINK);</PRE -+></DIV -+><DIV -+CLASS="SECT2" -+><HR><H3 -+CLASS="SECT2" -+><A -+NAME="ATTRONVSATTRSET" -+>8.2. attron() vs attrset()</A -+></H3 -+><P -+>Then what is the difference between attron() and attrset()? attrset sets the -+attributes of window whereas attron just switches on the attribute given to it. -+So attrset() fully overrides whatever attributes the window previously had and -+sets it to the new attribute(s). Similarly attroff() just switches off the -+attribute(s) given to it as an argument. This gives us the flexibility of -+managing attributes easily.But if you use them carelessly you may loose track of -+what attributes the window has and garble the display. This is especially true -+while managing menus with colors and highlighting. So decide on a consistent -+policy and stick to it. You can always use <TT -+CLASS="LITERAL" -+> standend()</TT -+> which is equivalent to <TT -+CLASS="LITERAL" -+> attrset(A_NORMAL)</TT -+> which turns off all attributes and brings you to normal mode.</P -+></DIV -+><DIV -+CLASS="SECT2" -+><HR><H3 -+CLASS="SECT2" -+><A -+NAME="ATTR_GET" -+>8.3. attr_get()</A -+></H3 -+><P -+>&#13;The function attr_get() gets the current attributes and color pair of the -+window. Though we might not use this as often as the above functions, this is -+useful in scanning areas of screen. Say we wanted to do some complex update on -+screen and we are not sure what attribute each character is associated with. -+Then this function can be used with either attrset or attron to produce the -+desired effect.&#13;</P -+></DIV -+><DIV -+CLASS="SECT2" -+><HR><H3 -+CLASS="SECT2" -+><A -+NAME="ATTR_FUNCS" -+>8.4. attr_ functions</A -+></H3 -+><P -+>There are series of functions like attr_set(), attr_on etc.. These are similar -+to above functions except that they take parameters of type -+<TT -+CLASS="LITERAL" -+>attr_t</TT -+>.</P -+></DIV -+><DIV -+CLASS="SECT2" -+><HR><H3 -+CLASS="SECT2" -+><A -+NAME="WATTRFUNCS" -+>8.5. wattr functions</A -+></H3 -+><P -+>For each of the above functions we have a corresponding function with 'w' which -+operates on a particular window. The above functions operate on stdscr. </P -+></DIV -+><DIV -+CLASS="SECT2" -+><HR><H3 -+CLASS="SECT2" -+><A -+NAME="CHGAT" -+>8.6. chgat() functions</A -+></H3 -+><P -+>The function chgat() is listed in the end of the man page curs_attr. It actually -+is a useful one. This function can be used to set attributes for a group of -+characters without moving. I mean it !!! without moving the cursor :-) It -+changes the attributes of a given number of characters starting at the current -+cursor location.</P -+><P -+>We can give -1 as the character count to update till end of line. If you want to -+change attributes of characters from current position to end of line, just use -+this.</P -+><PRE -+CLASS="PROGRAMLISTING" -+> chgat(-1, A_REVERSE, 0, NULL);</PRE -+><P -+> -+This function is useful when changing attributes for characters that are -+already on the screen. Move to the character from which you want to change and -+change the attribute. </P -+><P -+>Other functions wchgat(), mvchgat(), wchgat() behave similarly except that the w -+functions operate on the particular window. The mv functions first move the -+cursor then perform the work given to them. Actually chgat is a macro which is -+replaced by a wchgat() with stdscr as the window. Most of the "w-less" functions -+are macros.</P -+><DIV -+CLASS="EXAMPLE" -+><A -+NAME="BWICH" -+></A -+><P -+><B -+>Example 6. Chgat() Usage example </B -+></P -+><PRE -+CLASS="PROGRAMLISTING" -+><SPAN -+CLASS="INLINEMEDIAOBJECT" -+>#include &#60;ncurses.h&#62; - - int main(int argc, char *argv[]) --{ initscr(); /* Start curses mode */ -- start_color(); /* Start color functionality */ -- -- init_pair(1, COLOR_CYAN, COLOR_BLACK); -- printw("A Big string which i didn't care to type fully "); -- mvchgat(0, 0, -1, A_BLINK, 1, NULL); -- /* -- * First two parameters specify the position at which to start -- * Third parameter number of characters to update. -1 means till -- * end of line -- * Forth parameter is the normal attribute you wanted to give -- * to the charcter -- * Fifth is the color index. It is the index given during init_pair() -- * use 0 if you didn't want color -- * Sixth one is always NULL -- */ -- refresh(); -- getch(); -- endwin(); /* End curses mode */ -- return 0; --}</span></font> --</pre></td> --</tr> --</table> --</div> --<p>This example also introduces us to the color world of curses. --Colors will be explained in detail later. Use 0 for no color.</p> --</div> --</div> --<div class="SECT1"> --<hr> --<h2 class="SECT1"><a name="WINDOWS" id="WINDOWS">9. --Windows</a></h2> --<p>Windows form the most important concept in curses. You have seen --the standard window stdscr above where all the functions implicitly --operated on this window. Now to make design even a simplest GUI, --you need to resort to windows. The main reason you may want to use --windows is to manipulate parts of the screen separately, for better --efficiency, by updating only the windows that need to be changed --and for a better design. I would say the last reason is the most --important in going for windows. You should always strive for a --better and easy-to-manage design in your programs. If you are --writing big, complex GUIs this is of pivotal importance before you --start doing anything.</p> --<div class="SECT2"> --<hr> --<h3 class="SECT2"><a name="WINDOWBASICS" id="WINDOWBASICS">9.1. The --basics</a></h3> --<p>A Window can be created by calling the function <var class= --"LITERAL">newwin()</var>. It doesn't create any thing on the screen --actually. It allocates memory for a structure to manipulate the --window and updates the structure with data regarding the window --like it's size, beginy, beginx etc.. Hence in curses, a window is --just an abstraction of an imaginary window, which can be --manipulated independent of other parts of screen. The function --newwin() returns a pointer to structure WINDOW, which can be passed --to window related functions like wprintw() etc.. Finally the window --can be destroyed with delwin(). It will deallocate the memory --associated with the window structure.</p> --</div> --<div class="SECT2"> --<hr> --<h3 class="SECT2"><a name="LETBEWINDOW" id="LETBEWINDOW">9.2. Let --there be a Window !!!</a></h3> --<p>What fun is it, if a window is created and we can't see it. So --the fun part begins by displaying the window. The function --<var class="LITERAL">box()</var> can be used to draw a border --around the window. Let's explore these functions in more detail in --this example.</p> --<div class="EXAMPLE"><a name="BWIBO" id="BWIBO"></a> --<p><b>Example 7. Window Border example</b></p> --<table border="0" bgcolor="#E0E0E0" width="100%"> --<tr> --<td> --<pre class="PROGRAMLISTING"> --<font color="#000000"><span class= --"INLINEMEDIAOBJECT">#include &lt;ncurses.h&gt; -+{ initscr(); /* Start curses mode */ -+ start_color(); /* Start color functionality */ -+ -+ init_pair(1, COLOR_CYAN, COLOR_BLACK); -+ printw("A Big string which i didn't care to type fully "); -+ mvchgat(0, 0, -1, A_BLINK, 1, NULL); -+ /* -+ * First two parameters specify the position at which to start -+ * Third parameter number of characters to update. -1 means till -+ * end of line -+ * Forth parameter is the normal attribute you wanted to give -+ * to the charcter -+ * Fifth is the color index. It is the index given during init_pair() -+ * use 0 if you didn't want color -+ * Sixth one is always NULL -+ */ -+ refresh(); -+ getch(); -+ endwin(); /* End curses mode */ -+ return 0; -+}</SPAN -+></PRE -+></DIV -+><P -+>This example also introduces us to the color world of curses. Colors will be -+explained in detail later. Use 0 for no color.</P -+></DIV -+></DIV -+><DIV -+CLASS="SECT1" -+><HR><H2 -+CLASS="SECT1" -+><A -+NAME="WINDOWS" -+>9. Windows</A -+></H2 -+><P -+>Windows form the most important concept in curses. You have seen the standard -+window stdscr above where all the functions implicitly operated on this window. -+Now to make design even a simplest GUI, you need to resort to windows. The main -+reason you may want to use windows is to manipulate parts of the screen -+separately, for better efficiency, by updating only the windows that need to be -+changed and for a better design. I would say the last reason is the most -+important in going for windows. You should always strive for a better and -+easy-to-manage design in your programs. If you are writing big, complex GUIs -+this is of pivotal importance before you start doing anything.</P -+><DIV -+CLASS="SECT2" -+><HR><H3 -+CLASS="SECT2" -+><A -+NAME="WINDOWBASICS" -+>9.1. The basics</A -+></H3 -+><P -+>A Window can be created by calling the function -+<TT -+CLASS="LITERAL" -+>newwin()</TT -+>. It doesn't create any thing on the -+screen actually. It allocates memory for a structure to manipulate the window -+and updates the structure with data regarding the window like it's size, beginy, -+beginx etc.. Hence in curses, a window is just an abstraction of an imaginary -+window, which can be manipulated independent of other parts of screen. The -+function newwin() returns a pointer to structure WINDOW, which can be passed to -+window related functions like wprintw() etc.. Finally the window can be -+destroyed with delwin(). It will deallocate the memory associated with the -+window structure.</P -+></DIV -+><DIV -+CLASS="SECT2" -+><HR><H3 -+CLASS="SECT2" -+><A -+NAME="LETBEWINDOW" -+>9.2. Let there be a Window !!!</A -+></H3 -+><P -+>What fun is it, if a window is created and we can't see it. So the fun part -+begins by displaying the window. The function -+<TT -+CLASS="LITERAL" -+>box()</TT -+> can be used to draw a border around the -+window. Let's explore these functions in more detail in this example.</P -+><DIV -+CLASS="EXAMPLE" -+><A -+NAME="BWIBO" -+></A -+><P -+><B -+>Example 7. Window Border example </B -+></P -+><PRE -+CLASS="PROGRAMLISTING" -+><SPAN -+CLASS="INLINEMEDIAOBJECT" -+>#include &#60;ncurses.h&#62; - - - WINDOW *create_newwin(int height, int width, int starty, int startx); - void destroy_win(WINDOW *local_win); - - int main(int argc, char *argv[]) --{ WINDOW *my_win; -- int startx, starty, width, height; -- int ch; -- -- initscr(); /* Start curses mode */ -- cbreak(); /* Line buffering disabled, Pass on -- * everty thing to me */ -- keypad(stdscr, TRUE); /* I need that nifty F1 */ -- -- height = 3; -- width = 10; -- starty = (LINES - height) / 2; /* Calculating for a center placement */ -- startx = (COLS - width) / 2; /* of the window */ -- printw("Press F1 to exit"); -- refresh(); -- my_win = create_newwin(height, width, starty, startx); -- -- while((ch = getch()) != KEY_F(1)) -- { switch(ch) -- { case KEY_LEFT: -- destroy_win(my_win); -- my_win = create_newwin(height, width, starty,--startx); -- break; -- case KEY_RIGHT: -- destroy_win(my_win); -- my_win = create_newwin(height, width, starty,++startx); -- break; -- case KEY_UP: -- destroy_win(my_win); -- my_win = create_newwin(height, width, --starty,startx); -- break; -- case KEY_DOWN: -- destroy_win(my_win); -- my_win = create_newwin(height, width, ++starty,startx); -- break; -- } -- } -- -- endwin(); /* End curses mode */ -- return 0; -+{ WINDOW *my_win; -+ int startx, starty, width, height; -+ int ch; -+ -+ initscr(); /* Start curses mode */ -+ cbreak(); /* Line buffering disabled, Pass on -+ * everty thing to me */ -+ keypad(stdscr, TRUE); /* I need that nifty F1 */ -+ -+ height = 3; -+ width = 10; -+ starty = (LINES - height) / 2; /* Calculating for a center placement */ -+ startx = (COLS - width) / 2; /* of the window */ -+ printw("Press F1 to exit"); -+ refresh(); -+ my_win = create_newwin(height, width, starty, startx); -+ -+ while((ch = getch()) != KEY_F(1)) -+ { switch(ch) -+ { case KEY_LEFT: -+ destroy_win(my_win); -+ my_win = create_newwin(height, width, starty,--startx); -+ break; -+ case KEY_RIGHT: -+ destroy_win(my_win); -+ my_win = create_newwin(height, width, starty,++startx); -+ break; -+ case KEY_UP: -+ destroy_win(my_win); -+ my_win = create_newwin(height, width, --starty,startx); -+ break; -+ case KEY_DOWN: -+ destroy_win(my_win); -+ my_win = create_newwin(height, width, ++starty,startx); -+ break; -+ } -+ } -+ -+ endwin(); /* End curses mode */ -+ return 0; - } - - WINDOW *create_newwin(int height, int width, int starty, int startx) --{ WINDOW *local_win; -+{ WINDOW *local_win; - -- local_win = newwin(height, width, starty, startx); -- box(local_win, 0 , 0); /* 0, 0 gives default characters -- * for the vertical and horizontal -- * lines */ -- wrefresh(local_win); /* Show that box */ -+ local_win = newwin(height, width, starty, startx); -+ box(local_win, 0 , 0); /* 0, 0 gives default characters -+ * for the vertical and horizontal -+ * lines */ -+ wrefresh(local_win); /* Show that box */ - -- return local_win; -+ return local_win; - } - - void destroy_win(WINDOW *local_win) --{ -- /* box(local_win, ' ', ' '); : This won't produce the desired -- * result of erasing the window. It will leave it's four corners -- * and so an ugly remnant of window. -- */ -- wborder(local_win, ' ', ' ', ' ',' ',' ',' ',' ',' '); -- /* The parameters taken are -- * 1. win: the window on which to operate -- * 2. ls: character to be used for the left side of the window -- * 3. rs: character to be used for the right side of the window -- * 4. ts: character to be used for the top side of the window -- * 5. bs: character to be used for the bottom side of the window -- * 6. tl: character to be used for the top left corner of the window -- * 7. tr: character to be used for the top right corner of the window -- * 8. bl: character to be used for the bottom left corner of the window -- * 9. br: character to be used for the bottom right corner of the window -- */ -- wrefresh(local_win); -- delwin(local_win); --}</span></font> --</pre></td> --</tr> --</table> --</div> --</div> --<div class="SECT2"> --<hr> --<h3 class="SECT2"><a name="BORDEREXEXPL" id="BORDEREXEXPL">9.3. --Explanation</a></h3> --<p>Don't scream. I know it's a big example. But I have to explain --some important things here :-). This program creates a rectangular --window that can be moved with left, right, up, down arrow keys. It --repeatedly creates and destroys windows as user press a key. Don't --go beyond the screen limits. Checking for those limits is left as --an exercise for the reader. Let's dissect it by line by line.</p> --<p>The <var class="LITERAL">create_newwin()</var> function creates --a window with <var class="LITERAL">newwin()</var> and displays a --border around it with box. The function <var class= --"LITERAL">destroy_win()</var> first erases the window from screen --by painting a border with ' ' character and then calling --<var class="LITERAL">delwin()</var> to deallocate memory related to --it. Depending on the key the user presses, starty or startx is --changed and a new window is created.</p> --<p>In the destroy_win, as you can see, I used wborder instead of --box. The reason is written in the comments (You missed it. I know. --Read the code :-)). wborder draws a border around the window with --the characters given to it as the 4 corner points and the 4 lines. --To put it clearly, if you have called wborder as below:</p> --<table border="0" bgcolor="#E0E0E0" width="100%"> --<tr> --<td> --<pre class="PROGRAMLISTING"> --<font color= --"#000000"> wborder(win, '|', '|', '-', '-', '+', '+', '+', '+');</font> --</pre></td> --</tr> --</table> --<p>it produces some thing like</p> --<table border="0" bgcolor="#E0E0E0" width="100%"> --<tr> --<td> --<pre class="PROGRAMLISTING"> --<font color="#000000"> +------------+ -+{ -+ /* box(local_win, ' ', ' '); : This won't produce the desired -+ * result of erasing the window. It will leave it's four corners -+ * and so an ugly remnant of window. -+ */ -+ wborder(local_win, ' ', ' ', ' ',' ',' ',' ',' ',' '); -+ /* The parameters taken are -+ * 1. win: the window on which to operate -+ * 2. ls: character to be used for the left side of the window -+ * 3. rs: character to be used for the right side of the window -+ * 4. ts: character to be used for the top side of the window -+ * 5. bs: character to be used for the bottom side of the window -+ * 6. tl: character to be used for the top left corner of the window -+ * 7. tr: character to be used for the top right corner of the window -+ * 8. bl: character to be used for the bottom left corner of the window -+ * 9. br: character to be used for the bottom right corner of the window -+ */ -+ wrefresh(local_win); -+ delwin(local_win); -+}</SPAN -+></PRE -+></DIV -+></DIV -+><DIV -+CLASS="SECT2" -+><HR><H3 -+CLASS="SECT2" -+><A -+NAME="BORDEREXEXPL" -+>9.3. Explanation</A -+></H3 -+><P -+>Don't scream. I know it's a big example. But I have to explain some important -+things here :-). This program creates a rectangular window that can be moved -+with left, right, up, down arrow keys. It repeatedly creates and destroys -+windows as user press a key. Don't go beyond the screen limits. Checking for -+those limits is left as an exercise for the reader. Let's dissect it by line by line.</P -+><P -+>The <TT -+CLASS="LITERAL" -+>create_newwin()</TT -+> function creates a window -+with <TT -+CLASS="LITERAL" -+>newwin() </TT -+> and displays a border around it -+with box. The function <TT -+CLASS="LITERAL" -+> destroy_win()</TT -+> first -+erases the window from screen by painting a border with ' ' character and then -+calling <TT -+CLASS="LITERAL" -+>delwin()</TT -+> to deallocate memory related -+to it. Depending on the key the user presses, starty or startx is changed and a -+new window is created.</P -+><P -+>In the destroy_win, as you can see, I used wborder instead of box. The reason is -+written in the comments (You missed it. I know. Read the code :-)). wborder -+draws a border around the window with the characters given to it as the 4 corner -+points and the 4 lines. To put it clearly, if you have called wborder as below: -+<PRE -+CLASS="PROGRAMLISTING" -+> wborder(win, '|', '|', '-', '-', '+', '+', '+', '+');</PRE -+></P -+><P -+>it produces some thing like </P -+><PRE -+CLASS="PROGRAMLISTING" -+> +------------+ - | | - | | - | | - | | - | | - | | -- +------------+</font> --</pre></td> --</tr> --</table> --</div> --<div class="SECT2"> --<hr> --<h3 class="SECT2"><a name="OTHERSTUFF" id="OTHERSTUFF">9.4. The --other stuff in the example</a></h3> --<p>You can also see in the above examples, that I have used the --variables COLS, LINES which are initialized to the screen sizes --after initscr(). They can be useful in finding screen dimensions --and finding the center co-ordinate of the screen as above. The --function <var class="LITERAL">getch()</var> as usual gets the key --from keyboard and according to the key it does the corresponding --work. This type of switch- case is very common in any GUI based --programs.</p> --</div> --<div class="SECT2"> --<hr> --<h3 class="SECT2"><a name="OTHERBORDERFUNCS" id= --"OTHERBORDERFUNCS">9.5. Other Border functions</a></h3> --<p>Above program is grossly inefficient in that with each press of --a key, a window is destroyed and another is created. So let's write --a more efficient program which uses other border related --functions.</p> --<p>The following program uses <var class="LITERAL">mvhline()</var> --and <var class="LITERAL">mvvline()</var> to achieve similar effect. --These two functions are simple. They create a horizontal or --vertical line of the specified length at the specified --position.</p> --<div class="EXAMPLE"><a name="BOTBO" id="BOTBO"></a> --<p><b>Example 8. More border functions</b></p> --<table border="0" bgcolor="#E0E0E0" width="100%"> --<tr> --<td> --<pre class="PROGRAMLISTING"> --<font color="#000000"><span class= --"INLINEMEDIAOBJECT">#include &lt;ncurses.h&gt; -+ +------------+</PRE -+></DIV -+><DIV -+CLASS="SECT2" -+><HR><H3 -+CLASS="SECT2" -+><A -+NAME="OTHERSTUFF" -+>9.4. The other stuff in the example</A -+></H3 -+><P -+>You can also see in the above examples, that I have used the variables COLS, -+LINES which are initialized to the screen sizes after initscr(). They can be -+useful in finding screen dimensions and finding the center co-ordinate of the -+screen as above. The function <TT -+CLASS="LITERAL" -+>getch()</TT -+> as usual -+gets the key from keyboard and according to the key it does the corresponding -+work. This type of switch- case is very common in any GUI based programs.</P -+></DIV -+><DIV -+CLASS="SECT2" -+><HR><H3 -+CLASS="SECT2" -+><A -+NAME="OTHERBORDERFUNCS" -+>9.5. Other Border functions</A -+></H3 -+><P -+>Above program is grossly inefficient in that with each press of a key, a window -+is destroyed and another is created. So let's write a more efficient program -+which uses other border related functions.</P -+><P -+>The following program uses <TT -+CLASS="LITERAL" -+>mvhline()</TT -+> and -+<TT -+CLASS="LITERAL" -+>mvvline()</TT -+> to achieve similar effect. These two -+functions are simple. They create a horizontal or vertical line of the specified -+length at the specified position.</P -+><DIV -+CLASS="EXAMPLE" -+><A -+NAME="BOTBO" -+></A -+><P -+><B -+>Example 8. More border functions</B -+></P -+><PRE -+CLASS="PROGRAMLISTING" -+><SPAN -+CLASS="INLINEMEDIAOBJECT" -+>#include &#60;ncurses.h&#62; - - typedef struct _win_border_struct { -- chtype ls, rs, ts, bs, -- tl, tr, bl, br; -+ chtype ls, rs, ts, bs, -+ tl, tr, bl, br; - }WIN_BORDER; - - typedef struct _WIN_struct { - -- int startx, starty; -- int height, width; -- WIN_BORDER border; -+ int startx, starty; -+ int height, width; -+ WIN_BORDER border; - }WIN; - - void init_win_params(WIN *p_win); -@@ -1925,319 +3195,380 @@ - void create_box(WIN *win, bool flag); - - int main(int argc, char *argv[]) --{ WIN win; -- int ch; -- -- initscr(); /* Start curses mode */ -- start_color(); /* Start the color functionality */ -- cbreak(); /* Line buffering disabled, Pass on -- * everty thing to me */ -- keypad(stdscr, TRUE); /* I need that nifty F1 */ -- noecho(); -- init_pair(1, COLOR_CYAN, COLOR_BLACK); -+{ WIN win; -+ int ch; - -- /* Initialize the window parameters */ -- init_win_params(&amp;win); -- print_win_params(&amp;win); -- -- attron(COLOR_PAIR(1)); -- printw("Press F1 to exit"); -- refresh(); -- attroff(COLOR_PAIR(1)); -- -- create_box(&amp;win, TRUE); -- while((ch = getch()) != KEY_F(1)) -- { switch(ch) -- { case KEY_LEFT: -- create_box(&amp;win, FALSE); -- --win.startx; -- create_box(&amp;win, TRUE); -- break; -- case KEY_RIGHT: -- create_box(&amp;win, FALSE); -- ++win.startx; -- create_box(&amp;win, TRUE); -- break; -- case KEY_UP: -- create_box(&amp;win, FALSE); -- --win.starty; -- create_box(&amp;win, TRUE); -- break; -- case KEY_DOWN: -- create_box(&amp;win, FALSE); -- ++win.starty; -- create_box(&amp;win, TRUE); -- break; -- } -- } -- endwin(); /* End curses mode */ -- return 0; -+ initscr(); /* Start curses mode */ -+ start_color(); /* Start the color functionality */ -+ cbreak(); /* Line buffering disabled, Pass on -+ * everty thing to me */ -+ keypad(stdscr, TRUE); /* I need that nifty F1 */ -+ noecho(); -+ init_pair(1, COLOR_CYAN, COLOR_BLACK); -+ -+ /* Initialize the window parameters */ -+ init_win_params(&#38;win); -+ print_win_params(&#38;win); -+ -+ attron(COLOR_PAIR(1)); -+ printw("Press F1 to exit"); -+ refresh(); -+ attroff(COLOR_PAIR(1)); -+ -+ create_box(&#38;win, TRUE); -+ while((ch = getch()) != KEY_F(1)) -+ { switch(ch) -+ { case KEY_LEFT: -+ create_box(&#38;win, FALSE); -+ --win.startx; -+ create_box(&#38;win, TRUE); -+ break; -+ case KEY_RIGHT: -+ create_box(&#38;win, FALSE); -+ ++win.startx; -+ create_box(&#38;win, TRUE); -+ break; -+ case KEY_UP: -+ create_box(&#38;win, FALSE); -+ --win.starty; -+ create_box(&#38;win, TRUE); -+ break; -+ case KEY_DOWN: -+ create_box(&#38;win, FALSE); -+ ++win.starty; -+ create_box(&#38;win, TRUE); -+ break; -+ } -+ } -+ endwin(); /* End curses mode */ -+ return 0; - } - void init_win_params(WIN *p_win) - { -- p_win-&gt;height = 3; -- p_win-&gt;width = 10; -- p_win-&gt;starty = (LINES - p_win-&gt;height)/2; -- p_win-&gt;startx = (COLS - p_win-&gt;width)/2; -- -- p_win-&gt;border.ls = '|'; -- p_win-&gt;border.rs = '|'; -- p_win-&gt;border.ts = '-'; -- p_win-&gt;border.bs = '-'; -- p_win-&gt;border.tl = '+'; -- p_win-&gt;border.tr = '+'; -- p_win-&gt;border.bl = '+'; -- p_win-&gt;border.br = '+'; -+ p_win-&#62;height = 3; -+ p_win-&#62;width = 10; -+ p_win-&#62;starty = (LINES - p_win-&#62;height)/2; -+ p_win-&#62;startx = (COLS - p_win-&#62;width)/2; -+ -+ p_win-&#62;border.ls = '|'; -+ p_win-&#62;border.rs = '|'; -+ p_win-&#62;border.ts = '-'; -+ p_win-&#62;border.bs = '-'; -+ p_win-&#62;border.tl = '+'; -+ p_win-&#62;border.tr = '+'; -+ p_win-&#62;border.bl = '+'; -+ p_win-&#62;border.br = '+'; - - } - void print_win_params(WIN *p_win) - { - #ifdef _DEBUG -- mvprintw(25, 0, "%d %d %d %d", p_win-&gt;startx, p_win-&gt;starty, -- p_win-&gt;width, p_win-&gt;height); -- refresh(); -+ mvprintw(25, 0, "%d %d %d %d", p_win-&#62;startx, p_win-&#62;starty, -+ p_win-&#62;width, p_win-&#62;height); -+ refresh(); - #endif - } - void create_box(WIN *p_win, bool flag) --{ int i, j; -- int x, y, w, h; -- -- x = p_win-&gt;startx; -- y = p_win-&gt;starty; -- w = p_win-&gt;width; -- h = p_win-&gt;height; -- -- if(flag == TRUE) -- { mvaddch(y, x, p_win-&gt;border.tl); -- mvaddch(y, x + w, p_win-&gt;border.tr); -- mvaddch(y + h, x, p_win-&gt;border.bl); -- mvaddch(y + h, x + w, p_win-&gt;border.br); -- mvhline(y, x + 1, p_win-&gt;border.ts, w - 1); -- mvhline(y + h, x + 1, p_win-&gt;border.bs, w - 1); -- mvvline(y + 1, x, p_win-&gt;border.ls, h - 1); -- mvvline(y + 1, x + w, p_win-&gt;border.rs, h - 1); -- -- } -- else -- for(j = y; j &lt;= y + h; ++j) -- for(i = x; i &lt;= x + w; ++i) -- mvaddch(j, i, ' '); -- -- refresh(); -+{ int i, j; -+ int x, y, w, h; - --}</span></font> --</pre></td> --</tr> --</table> --</div> --</div> --</div> --<div class="SECT1"> --<hr> --<h2 class="SECT1"><a name="COLOR" id="COLOR">10. Colors</a></h2> --<div class="SECT2"> --<h3 class="SECT2"><a name="COLORBASICS" id="COLORBASICS">10.1. The --basics</a></h3> --<p>Life seems dull with no colors. Curses has a nice mechanism to --handle colors. Let's get into the thick of the things with a small --program.</p> --<div class="EXAMPLE"><a name="BSICO" id="BSICO"></a> --<p><b>Example 9. A Simple Color example</b></p> --<table border="0" bgcolor="#E0E0E0" width="100%"> --<tr> --<td> --<pre class="PROGRAMLISTING"> --<font color="#000000"><span class= --"INLINEMEDIAOBJECT">#include &lt;ncurses.h&gt; -+ x = p_win-&#62;startx; -+ y = p_win-&#62;starty; -+ w = p_win-&#62;width; -+ h = p_win-&#62;height; -+ -+ if(flag == TRUE) -+ { mvaddch(y, x, p_win-&#62;border.tl); -+ mvaddch(y, x + w, p_win-&#62;border.tr); -+ mvaddch(y + h, x, p_win-&#62;border.bl); -+ mvaddch(y + h, x + w, p_win-&#62;border.br); -+ mvhline(y, x + 1, p_win-&#62;border.ts, w - 1); -+ mvhline(y + h, x + 1, p_win-&#62;border.bs, w - 1); -+ mvvline(y + 1, x, p_win-&#62;border.ls, h - 1); -+ mvvline(y + 1, x + w, p_win-&#62;border.rs, h - 1); -+ -+ } -+ else -+ for(j = y; j &#60;= y + h; ++j) -+ for(i = x; i &#60;= x + w; ++i) -+ mvaddch(j, i, ' '); -+ -+ refresh(); -+ -+}</SPAN -+></PRE -+></DIV -+></DIV -+></DIV -+><DIV -+CLASS="SECT1" -+><HR><H2 -+CLASS="SECT1" -+><A -+NAME="COLOR" -+>10. Colors</A -+></H2 -+><DIV -+CLASS="SECT2" -+><H3 -+CLASS="SECT2" -+><A -+NAME="COLORBASICS" -+>10.1. The basics</A -+></H3 -+><P -+>Life seems dull with no colors. Curses has a nice mechanism to handle colors. -+Let's get into the thick of the things with a small program.</P -+><DIV -+CLASS="EXAMPLE" -+><A -+NAME="BSICO" -+></A -+><P -+><B -+>Example 9. A Simple Color example </B -+></P -+><PRE -+CLASS="PROGRAMLISTING" -+><SPAN -+CLASS="INLINEMEDIAOBJECT" -+>#include &#60;ncurses.h&#62; - - void print_in_middle(WINDOW *win, int starty, int startx, int width, char *string); - int main(int argc, char *argv[]) --{ initscr(); /* Start curses mode */ -- if(has_colors() == FALSE) -- { endwin(); -- printf("Your terminal does not support color\n"); -- exit(1); -- } -- start_color(); /* Start color */ -- init_pair(1, COLOR_RED, COLOR_BLACK); -- -- attron(COLOR_PAIR(1)); -- print_in_middle(stdscr, LINES / 2, 0, 0, "Viola !!! In color ..."); -- attroff(COLOR_PAIR(1)); -- getch(); -- endwin(); -+{ initscr(); /* Start curses mode */ -+ if(has_colors() == FALSE) -+ { endwin(); -+ printf("Your terminal does not support color\n"); -+ exit(1); -+ } -+ start_color(); /* Start color */ -+ init_pair(1, COLOR_RED, COLOR_BLACK); -+ -+ attron(COLOR_PAIR(1)); -+ print_in_middle(stdscr, LINES / 2, 0, 0, "Viola !!! In color ..."); -+ attroff(COLOR_PAIR(1)); -+ getch(); -+ endwin(); - } - void print_in_middle(WINDOW *win, int starty, int startx, int width, char *string) --{ int length, x, y; -- float temp; -+{ int length, x, y; -+ float temp; - -- if(win == NULL) -- win = stdscr; -- getyx(win, y, x); -- if(startx != 0) -- x = startx; -- if(starty != 0) -- y = starty; -- if(width == 0) -- width = 80; -- -- length = strlen(string); -- temp = (width - length)/ 2; -- x = startx + (int)temp; -- mvwprintw(win, y, x, "%s", string); -- refresh(); -+ if(win == NULL) -+ win = stdscr; -+ getyx(win, y, x); -+ if(startx != 0) -+ x = startx; -+ if(starty != 0) -+ y = starty; -+ if(width == 0) -+ width = 80; -+ -+ length = strlen(string); -+ temp = (width - length)/ 2; -+ x = startx + (int)temp; -+ mvwprintw(win, y, x, "%s", string); -+ refresh(); - } --</span></font> --</pre></td> --</tr> --</table> --</div> --<p>As you can see, to start using color, you should first call the --function <var class="LITERAL">start_color()</var>. After that, you --can use color capabilities of your terminals using various --functions. To find out whether a terminal has color capabilities or --not, you can use <var class="LITERAL">has_colors()</var> function, --which returns FALSE if the terminal does not support color.</p> --<p>Curses initializes all the colors supported by terminal when --start_color() is called. These can be accessed by the define --constants like <var class="LITERAL">COLOR_BLACK</var> etc. Now to --actually start using colors, you have to define pairs. Colors are --always used in pairs. That means you have to use the function --<var class="LITERAL">init_pair()</var> to define the foreground and --background for the pair number you give. After that that pair --number can be used as a normal attribute with <var class= --"LITERAL">COLOR_PAIR()</var>function. This may seem to be --cumbersome at first. But this elegant solution allows us to manage --color pairs very easily. To appreciate it, you have to look into --the the source code of "dialog", a utility for displaying dialog --boxes from shell scripts. The developers have defined foreground --and background combinations for all the colors they might need and --initialized at the beginning. This makes it very easy to set --attributes just by accessing a pair which we already have defined --as a constant.</p> --<p>The following colors are defined in <var class= --"LITERAL">curses.h</var>. You can use these as parameters for --various color functions.</p> --<table border="0" bgcolor="#E0E0E0" width="100%"> --<tr> --<td> --<pre class="PROGRAMLISTING"> --<font color="#000000"> COLOR_BLACK 0 -+</SPAN -+></PRE -+></DIV -+><P -+>As you can see, to start using color, you should first call the function -+<TT -+CLASS="LITERAL" -+> start_color()</TT -+>. After that, you can use color -+capabilities of your terminals using various functions. To find out whether a -+terminal has color capabilities or not, you can use -+<TT -+CLASS="LITERAL" -+>has_colors()</TT -+> function, which returns FALSE if -+the terminal does not support color. </P -+><P -+>Curses initializes all the colors supported by terminal when start_color() is -+called. These can be accessed by the define constants like -+<TT -+CLASS="LITERAL" -+>COLOR_BLACK </TT -+> etc. Now to actually start using -+colors, you have to define pairs. Colors are always used in pairs. That means -+you have to use the function <TT -+CLASS="LITERAL" -+>init_pair() </TT -+> to -+define the foreground and background for the pair number you give. After that -+that pair number can be used as a normal attribute with <TT -+CLASS="LITERAL" -+>COLOR_PAIR()</TT -+>function. This may seem to be cumbersome at first. -+But this elegant solution allows us to manage color pairs very easily. To -+appreciate it, you have to look into the the source code of "dialog", a utility -+for displaying dialog boxes from shell scripts. The developers have defined -+foreground and background combinations for all the colors they might need and -+initialized at the beginning. This makes it very easy to set attributes just by -+accessing a pair which we already have defined as a constant.</P -+><P -+>The following colors are defined in <TT -+CLASS="LITERAL" -+>curses.h</TT -+>. -+You can use these as parameters for various color functions. -+<PRE -+CLASS="PROGRAMLISTING" -+> COLOR_BLACK 0 - COLOR_RED 1 - COLOR_GREEN 2 - COLOR_YELLOW 3 - COLOR_BLUE 4 - COLOR_MAGENTA 5 - COLOR_CYAN 6 -- COLOR_WHITE 7</font> --</pre></td> --</tr> --</table> --</div> --<div class="SECT2"> --<hr> --<h3 class="SECT2"><a name="CHANGECOLORDEFS" id= --"CHANGECOLORDEFS">10.2. Changing Color Definitions</a></h3> --<p>The function <var class="LITERAL">init_color()</var>can be used --to change the rgb values for the colors defined by curses --initially. Say you wanted to lighten the intensity of red color by --a minuscule. Then you can use this function as</p> --<table border="0" bgcolor="#E0E0E0" width="100%"> --<tr> --<td> --<pre class="PROGRAMLISTING"> --<font color="#000000"> init_color(COLOR_RED, 700, 0, 0); -+ COLOR_WHITE 7</PRE -+></P -+></DIV -+><DIV -+CLASS="SECT2" -+><HR><H3 -+CLASS="SECT2" -+><A -+NAME="CHANGECOLORDEFS" -+>10.2. Changing Color Definitions</A -+></H3 -+><P -+>The function <TT -+CLASS="LITERAL" -+>init_color()</TT -+>can be used to change -+the rgb values for the colors defined by curses initially. Say you wanted to -+lighten the intensity of red color by a minuscule. Then you can use this -+function as</P -+><PRE -+CLASS="PROGRAMLISTING" -+> init_color(COLOR_RED, 700, 0, 0); - /* param 1 : color name -- * param 2, 3, 4 : rgb content min = 0, max = 1000 */</font> --</pre></td> --</tr> --</table> --<p>If your terminal cannot change the color definitions, the --function returns ERR. The function <var class= --"LITERAL">can_change_color()</var> can be used to find out whether --the terminal has the capability of changing color content or not. --The rgb content is scaled from 0 to 1000. Initially RED color is --defined with content 1000(r), 0(g), 0(b).</p> --</div> --<div class="SECT2"> --<hr> --<h3 class="SECT2"><a name="COLORCONTENT" id="COLORCONTENT">10.3. --Color Content</a></h3> --<p>The functions <var class="LITERAL">color_content()</var> and --<var class="LITERAL">pair_content()</var> can be used to find the --color content and foreground, background combination for the --pair.</p> --</div> --</div> --<div class="SECT1"> --<hr> --<h2 class="SECT1"><a name="KEYS" id="KEYS">11. Interfacing with the --key board</a></h2> --<div class="SECT2"> --<h3 class="SECT2"><a name="KEYSBASICS" id="KEYSBASICS">11.1. The --Basics</a></h3> --<p>No GUI is complete without a strong user interface and to --interact with the user, a curses program should be sensitive to key --presses or the mouse actions done by the user. Let's deal with the --keys first.</p> --<p>As you have seen in almost all of the above examples, it's very --easy to get key input from the user. A simple way of getting key --presses is to use <var class="LITERAL">getch()</var> function. The --cbreak mode should be enabled to read keys when you are interested --in reading individual key hits rather than complete lines of text --(which usually end with a carriage return). keypad should be --enabled to get the Functions keys, arrow keys etc. See the --initialization section for details.</p> --<p><var class="LITERAL">getch()</var> returns an integer --corresponding to the key pressed. If it is a normal character, the --integer value will be equivalent to the character. Otherwise it --returns a number which can be matched with the constants defined in --<var class="LITERAL">curses.h</var>. For example if the user --presses F1, the integer returned is 265. This can be checked using --the macro KEY_F() defined in curses.h. This makes reading keys --portable and easy to manage.</p> --<p>For example, if you call getch() like this</p> --<table border="0" bgcolor="#E0E0E0" width="100%"> --<tr> --<td> --<pre class="PROGRAMLISTING"> --<font color="#000000"> int ch; -- -- ch = getch();</font> --</pre></td> --</tr> --</table> --<p>getch() will wait for the user to press a key, (unless you --specified a timeout) and when user presses a key, the corresponding --integer is returned. Then you can check the value returned with the --constants defined in curses.h to match against the keys you --want.</p> --<p>The following code piece will do that job.</p> --<table border="0" bgcolor="#E0E0E0" width="100%"> --<tr> --<td> --<pre class="PROGRAMLISTING"> --<font color="#000000"> if(ch == KEY_LEFT) -- printw("Left arrow is pressed\n");</font> --</pre></td> --</tr> --</table> --<p>Let's write a small program which creates a menu which can be --navigated by up and down arrows.</p> --</div> --<div class="SECT2"> --<hr> --<h3 class="SECT2"><a name="SIMPLEKEYEX" id="SIMPLEKEYEX">11.2. A --Simple Key Usage example</a></h3> --<div class="EXAMPLE"><a name="BSIKE" id="BSIKE"></a> --<p><b>Example 10. A Simple Key Usage example</b></p> --<table border="0" bgcolor="#E0E0E0" width="100%"> --<tr> --<td> --<pre class="PROGRAMLISTING"> --<font color="#000000"><span class= --"INLINEMEDIAOBJECT">#include &lt;stdio.h&gt; --#include &lt;ncurses.h&gt; -+ * param 2, 3, 4 : rgb content min = 0, max = 1000 */</PRE -+><P -+>If your terminal cannot change the color definitions, the function returns ERR. -+The function <TT -+CLASS="LITERAL" -+>can_change_color()</TT -+> can be used to -+find out whether the terminal has the capability of changing color content or -+not. The rgb content is scaled from 0 to 1000. Initially RED color is defined -+with content 1000(r), 0(g), 0(b). </P -+></DIV -+><DIV -+CLASS="SECT2" -+><HR><H3 -+CLASS="SECT2" -+><A -+NAME="COLORCONTENT" -+>10.3. Color Content</A -+></H3 -+><P -+>The functions <TT -+CLASS="LITERAL" -+>color_content()</TT -+> and -+<TT -+CLASS="LITERAL" -+>pair_content()</TT -+> can be used to find the color -+content and foreground, background combination for the pair. </P -+></DIV -+></DIV -+><DIV -+CLASS="SECT1" -+><HR><H2 -+CLASS="SECT1" -+><A -+NAME="KEYS" -+>11. Interfacing with the key board</A -+></H2 -+><DIV -+CLASS="SECT2" -+><H3 -+CLASS="SECT2" -+><A -+NAME="KEYSBASICS" -+>11.1. The Basics</A -+></H3 -+><P -+>No GUI is complete without a strong user interface and to interact with the -+user, a curses program should be sensitive to key presses or the mouse actions -+done by the user. Let's deal with the keys first.</P -+><P -+>As you have seen in almost all of the above examples, it's very easy to get key -+input from the user. A simple way of getting key presses is to use -+<TT -+CLASS="LITERAL" -+>getch()</TT -+> function. The cbreak mode should be -+enabled to read keys when you are interested in reading individual key hits -+rather than complete lines of text (which usually end with a carriage return). -+keypad should be enabled to get the Functions keys, arrow keys etc. See the -+initialization section for details.</P -+><P -+><TT -+CLASS="LITERAL" -+>getch()</TT -+> returns an integer corresponding to the -+key pressed. If it is a normal character, the integer value will be equivalent -+to the character. Otherwise it returns a number which can be matched with the -+constants defined in <TT -+CLASS="LITERAL" -+>curses.h</TT -+>. For example if -+the user presses F1, the integer returned is 265. This can be checked using the -+macro KEY_F() defined in curses.h. This makes reading keys portable and easy to -+manage.</P -+><P -+>For example, if you call getch() like this</P -+><PRE -+CLASS="PROGRAMLISTING" -+> int ch; -+ -+ ch = getch();</PRE -+><P -+>getch() will wait for the user to press a key, (unless you specified a timeout) -+and when user presses a key, the corresponding integer is returned. Then you can -+check the value returned with the constants defined in curses.h to match against -+the keys you want.</P -+><P -+>The following code piece will do that job.</P -+><PRE -+CLASS="PROGRAMLISTING" -+> if(ch == KEY_LEFT) -+ printw("Left arrow is pressed\n");</PRE -+><P -+>Let's write a small program which creates a menu which can be navigated by up -+and down arrows.</P -+></DIV -+><DIV -+CLASS="SECT2" -+><HR><H3 -+CLASS="SECT2" -+><A -+NAME="SIMPLEKEYEX" -+>11.2. A Simple Key Usage example</A -+></H3 -+><DIV -+CLASS="EXAMPLE" -+><A -+NAME="BSIKE" -+></A -+><P -+><B -+>Example 10. A Simple Key Usage example </B -+></P -+><PRE -+CLASS="PROGRAMLISTING" -+><SPAN -+CLASS="INLINEMEDIAOBJECT" -+>#include &#60;stdio.h&#62; -+#include &#60;ncurses.h&#62; - - #define WIDTH 30 - #define HEIGHT 10 -@@ -2246,127 +3577,132 @@ - int starty = 0; - - char *choices[] = { -- "Choice 1", -- "Choice 2", -- "Choice 3", -- "Choice 4", -- "Exit", -- }; -+ "Choice 1", -+ "Choice 2", -+ "Choice 3", -+ "Choice 4", -+ "Exit", -+ }; - int n_choices = sizeof(choices) / sizeof(char *); - void print_menu(WINDOW *menu_win, int highlight); - - int main() --{ WINDOW *menu_win; -- int highlight = 1; -- int choice = 0; -- int c; -- -- initscr(); -- clear(); -- noecho(); -- cbreak(); /* Line buffering disabled. pass on everything */ -- startx = (80 - WIDTH) / 2; -- starty = (24 - HEIGHT) / 2; -- -- menu_win = newwin(HEIGHT, WIDTH, starty, startx); -- keypad(menu_win, TRUE); -- mvprintw(0, 0, "Use arrow keys to go up and down, Press enter to select a choice"); -- refresh(); -- print_menu(menu_win, highlight); -- while(1) -- { c = wgetch(menu_win); -- switch(c) -- { case KEY_UP: -- if(highlight == 1) -- highlight = n_choices; -- else -- --highlight; -- break; -- case KEY_DOWN: -- if(highlight == n_choices) -- highlight = 1; -- else -- ++highlight; -- break; -- case 10: -- choice = highlight; -- break; -- default: -- mvprintw(24, 0, "Charcter pressed is = %3d Hopefully it can be printed as '%c'", c, c); -- refresh(); -- break; -- } -- print_menu(menu_win, highlight); -- if(choice != 0) /* User did a choice come out of the infinite loop */ -- break; -- } -- mvprintw(23, 0, "You chose choice %d with choice string %s\n", choice, choices[choice - 1]); -- clrtoeol(); -- refresh(); -- endwin(); -- return 0; -+{ WINDOW *menu_win; -+ int highlight = 1; -+ int choice = 0; -+ int c; -+ -+ initscr(); -+ clear(); -+ noecho(); -+ cbreak(); /* Line buffering disabled. pass on everything */ -+ startx = (80 - WIDTH) / 2; -+ starty = (24 - HEIGHT) / 2; -+ -+ menu_win = newwin(HEIGHT, WIDTH, starty, startx); -+ keypad(menu_win, TRUE); -+ mvprintw(0, 0, "Use arrow keys to go up and down, Press enter to select a choice"); -+ refresh(); -+ print_menu(menu_win, highlight); -+ while(1) -+ { c = wgetch(menu_win); -+ switch(c) -+ { case KEY_UP: -+ if(highlight == 1) -+ highlight = n_choices; -+ else -+ --highlight; -+ break; -+ case KEY_DOWN: -+ if(highlight == n_choices) -+ highlight = 1; -+ else -+ ++highlight; -+ break; -+ case 10: -+ choice = highlight; -+ break; -+ default: -+ mvprintw(24, 0, "Charcter pressed is = %3d Hopefully it can be printed as '%c'", c, c); -+ refresh(); -+ break; -+ } -+ print_menu(menu_win, highlight); -+ if(choice != 0) /* User did a choice come out of the infinite loop */ -+ break; -+ } -+ mvprintw(23, 0, "You chose choice %d with choice string %s\n", choice, choices[choice - 1]); -+ clrtoeol(); -+ refresh(); -+ endwin(); -+ return 0; - } - - - void print_menu(WINDOW *menu_win, int highlight) - { -- int x, y, i; -+ int x, y, i; - -- x = 2; -- y = 2; -- box(menu_win, 0, 0); -- for(i = 0; i &lt; n_choices; ++i) -- { if(highlight == i + 1) /* High light the present choice */ -- { wattron(menu_win, A_REVERSE); -- mvwprintw(menu_win, y, x, "%s", choices[i]); -- wattroff(menu_win, A_REVERSE); -- } -- else -- mvwprintw(menu_win, y, x, "%s", choices[i]); -- ++y; -- } -- wrefresh(menu_win); -+ x = 2; -+ y = 2; -+ box(menu_win, 0, 0); -+ for(i = 0; i &#60; n_choices; ++i) -+ { if(highlight == i + 1) /* High light the present choice */ -+ { wattron(menu_win, A_REVERSE); -+ mvwprintw(menu_win, y, x, "%s", choices[i]); -+ wattroff(menu_win, A_REVERSE); -+ } -+ else -+ mvwprintw(menu_win, y, x, "%s", choices[i]); -+ ++y; -+ } -+ wrefresh(menu_win); - } --</span></font> --</pre></td> --</tr> --</table> --</div> --</div> --</div> --<div class="SECT1"> --<hr> --<h2 class="SECT1"><a name="MOUSE" id="MOUSE">12. Interfacing with --the mouse</a></h2> --<p>Now that you have seen how to get keys, lets do the same thing --from mouse. Usually each UI allows the user to interact with both --keyboard and mouse.</p> --<div class="SECT2"> --<hr> --<h3 class="SECT2"><a name="MOUSEBASICS" id="MOUSEBASICS">12.1. The --Basics</a></h3> --<p>Before you do any thing else, the events you want to receive --have to be enabled with <var class="LITERAL">mousemask()</var>.</p> --<table border="0" bgcolor="#E0E0E0" width="100%"> --<tr> --<td> --<pre class="PROGRAMLISTING"> --<font color= --"#000000"> mousemask( mmask_t newmask, /* The events you want to listen to */ -- mmask_t *oldmask) /* The old events mask */</font> --</pre></td> --</tr> --</table> --<p>The first parameter to above function is a bit mask of events --you would like to listen. By default, all the events are turned --off. The bit mask <var class="LITERAL">ALL_MOUSE_EVENTS</var> can --be used to get all the events.</p> --<p>The following are all the event masks:</p> --<table border="0" bgcolor="#E0E0E0" width="100%"> --<tr> --<td> --<pre class="PROGRAMLISTING"> --<font color="#000000"> Name Description -+</SPAN -+></PRE -+></DIV -+></DIV -+></DIV -+><DIV -+CLASS="SECT1" -+><HR><H2 -+CLASS="SECT1" -+><A -+NAME="MOUSE" -+>12. Interfacing with the mouse</A -+></H2 -+><P -+>Now that you have seen how to get keys, lets do the same thing from mouse. -+Usually each UI allows the user to interact with both keyboard and mouse. </P -+><DIV -+CLASS="SECT2" -+><HR><H3 -+CLASS="SECT2" -+><A -+NAME="MOUSEBASICS" -+>12.1. The Basics</A -+></H3 -+><P -+>Before you do any thing else, the events you want to receive have to be enabled -+with <TT -+CLASS="LITERAL" -+>mousemask()</TT -+>.</P -+><PRE -+CLASS="PROGRAMLISTING" -+> mousemask( mmask_t newmask, /* The events you want to listen to */ -+ mmask_t *oldmask) /* The old events mask */</PRE -+><P -+>The first parameter to above function is a bit mask of events you would like to -+listen. By default, all the events are turned off. The bit mask <TT -+CLASS="LITERAL" -+> ALL_MOUSE_EVENTS</TT -+> can be used to get all the events.</P -+><P -+>The following are all the event masks:</P -+><PRE -+CLASS="PROGRAMLISTING" -+> Name Description - --------------------------------------------------------------------- - BUTTON1_PRESSED mouse button 1 down - BUTTON1_RELEASED mouse button 1 up -@@ -2392,79 +3728,85 @@ - BUTTON_CTRL control was down during button state change - BUTTON_ALT alt was down during button state change - ALL_MOUSE_EVENTS report all button state changes -- REPORT_MOUSE_POSITION report mouse movement</font> --</pre></td> --</tr> --</table> --</div> --<div class="SECT2"> --<hr> --<h3 class="SECT2"><a name="GETTINGEVENTS" id="GETTINGEVENTS">12.2. --Getting the events</a></h3> --<p>Once a class of mouse events have been enabled, getch() class of --functions return KEY_MOUSE every time some mouse event happens. --Then the mouse event can be retrieved with <var class= --"LITERAL">getmouse()</var>.</p> --<p>The code approximately looks like this:</p> --<table border="0" bgcolor="#E0E0E0" width="100%"> --<tr> --<td> --<pre class="PROGRAMLISTING"> --<font color="#000000"> MEVENT event; -+ REPORT_MOUSE_POSITION report mouse movement</PRE -+></DIV -+><DIV -+CLASS="SECT2" -+><HR><H3 -+CLASS="SECT2" -+><A -+NAME="GETTINGEVENTS" -+>12.2. Getting the events</A -+></H3 -+><P -+>Once a class of mouse events have been enabled, getch() class of functions -+return KEY_MOUSE every time some mouse event happens. Then the mouse event can -+be retrieved with <TT -+CLASS="LITERAL" -+>getmouse()</TT -+>.</P -+><P -+>The code approximately looks like this:</P -+><PRE -+CLASS="PROGRAMLISTING" -+> MEVENT event; - - ch = getch(); - if(ch == KEY_MOUSE) - if(getmouse(&amp;event) == OK) - . /* Do some thing with the event */ - . -- .</font> --</pre></td> --</tr> --</table> --<p>getmouse() returns the event into the pointer given to it. It's --a structure which contains</p> --<table border="0" bgcolor="#E0E0E0" width="100%"> --<tr> --<td> --<pre class="PROGRAMLISTING"> --<font color="#000000"> typedef struct -+ .</PRE -+><P -+> -+getmouse() returns the event into the pointer given to it. It's a structure -+which contains</P -+><PRE -+CLASS="PROGRAMLISTING" -+> typedef struct - { - short id; /* ID to distinguish multiple devices */ - int x, y, z; /* event coordinates */ - mmask_t bstate; /* button state bits */ -- } </font> --</pre></td> --</tr> --</table> --<p>The <var class="LITERAL">bstate</var> is the main variable we --are interested in. It tells the button state of the mouse.</p> --<p>Then with a code snippet like the following, we can find out --what happened.</p> --<table border="0" bgcolor="#E0E0E0" width="100%"> --<tr> --<td> --<pre class="PROGRAMLISTING"> --<font color="#000000"> if(event.bstate &amp; BUTTON1_PRESSED) -- printw("Left Button Pressed");</font> --</pre></td> --</tr> --</table> --</div> --<div class="SECT2"> --<hr> --<h3 class="SECT2"><a name="MOUSETOGETHER" id="MOUSETOGETHER">12.3. --Putting it all Together</a></h3> --<p>That's pretty much interfacing with mouse. Let's create the same --menu and enable mouse interaction. To make things simpler, key --handling is removed.</p> --<div class="EXAMPLE"><a name="BMOME" id="BMOME"></a> --<p><b>Example 11. Access the menu with mouse !!!</b></p> --<table border="0" bgcolor="#E0E0E0" width="100%"> --<tr> --<td> --<pre class="PROGRAMLISTING"> --<font color="#000000"><span class= --"INLINEMEDIAOBJECT">#include &lt;ncurses.h&gt; -+ } </PRE -+><P -+>The <TT -+CLASS="LITERAL" -+>bstate</TT -+> is the main variable we are -+interested in. It tells the button state of the mouse.</P -+><P -+>Then with a code snippet like the following, we can find out what happened.</P -+><PRE -+CLASS="PROGRAMLISTING" -+> if(event.bstate &amp; BUTTON1_PRESSED) -+ printw("Left Button Pressed");</PRE -+></DIV -+><DIV -+CLASS="SECT2" -+><HR><H3 -+CLASS="SECT2" -+><A -+NAME="MOUSETOGETHER" -+>12.3. Putting it all Together</A -+></H3 -+><P -+>That's pretty much interfacing with mouse. Let's create the same menu and enable -+mouse interaction. To make things simpler, key handling is removed.</P -+><DIV -+CLASS="EXAMPLE" -+><A -+NAME="BMOME" -+></A -+><P -+><B -+>Example 11. Access the menu with mouse !!! </B -+></P -+><PRE -+CLASS="PROGRAMLISTING" -+><SPAN -+CLASS="INLINEMEDIAOBJECT" -+>#include &#60;ncurses.h&#62; - - #define WIDTH 30 - #define HEIGHT 10 -@@ -2472,12 +3814,12 @@ - int startx = 0; - int starty = 0; - --char *choices[] = { "Choice 1", -- "Choice 2", -- "Choice 3", -- "Choice 4", -- "Exit", -- }; -+char *choices[] = { "Choice 1", -+ "Choice 2", -+ "Choice 3", -+ "Choice 4", -+ "Exit", -+ }; - - int n_choices = sizeof(choices) / sizeof(char *); - -@@ -2485,270 +3827,338 @@ - void report_choice(int mouse_x, int mouse_y, int *p_choice); - - int main() --{ int c, choice = 0; -- WINDOW *menu_win; -- MEVENT event; -- -- /* Initialize curses */ -- initscr(); -- clear(); -- noecho(); -- cbreak(); //Line buffering disabled. pass on everything -- -- /* Try to put the window in the middle of screen */ -- startx = (80 - WIDTH) / 2; -- starty = (24 - HEIGHT) / 2; -- -- attron(A_REVERSE); -- mvprintw(23, 1, "Click on Exit to quit (Works best in a virtual console)"); -- refresh(); -- attroff(A_REVERSE); -- -- /* Print the menu for the first time */ -- menu_win = newwin(HEIGHT, WIDTH, starty, startx); -- print_menu(menu_win, 1); -- /* Get all the mouse events */ -- mousemask(ALL_MOUSE_EVENTS, NULL); -- -- while(1) -- { c = wgetch(menu_win); -- switch(c) -- { case KEY_MOUSE: -- if(getmouse(&amp;event) == OK) -- { /* When the user clicks left mouse button */ -- if(event.bstate &amp; BUTTON1_PRESSED) -- { report_choice(event.x + 1, event.y + 1, &amp;choice); -- if(choice == -1) //Exit chosen -- goto end; -- mvprintw(22, 1, "Choice made is : %d String Chosen is \"%10s\"", choice, choices[choice - 1]); -- refresh(); -- } -- } -- print_menu(menu_win, choice); -- break; -- } -- } -+{ int c, choice = 0; -+ WINDOW *menu_win; -+ MEVENT event; -+ -+ /* Initialize curses */ -+ initscr(); -+ clear(); -+ noecho(); -+ cbreak(); //Line buffering disabled. pass on everything -+ -+ /* Try to put the window in the middle of screen */ -+ startx = (80 - WIDTH) / 2; -+ starty = (24 - HEIGHT) / 2; -+ -+ attron(A_REVERSE); -+ mvprintw(23, 1, "Click on Exit to quit (Works best in a virtual console)"); -+ refresh(); -+ attroff(A_REVERSE); -+ -+ /* Print the menu for the first time */ -+ menu_win = newwin(HEIGHT, WIDTH, starty, startx); -+ print_menu(menu_win, 1); -+ /* Get all the mouse events */ -+ mousemask(ALL_MOUSE_EVENTS, NULL); -+ -+ while(1) -+ { c = wgetch(menu_win); -+ switch(c) -+ { case KEY_MOUSE: -+ if(getmouse(&#38;event) == OK) -+ { /* When the user clicks left mouse button */ -+ if(event.bstate &#38; BUTTON1_PRESSED) -+ { report_choice(event.x + 1, event.y + 1, &#38;choice); -+ if(choice == -1) //Exit chosen -+ goto end; -+ mvprintw(22, 1, "Choice made is : %d String Chosen is \"%10s\"", choice, choices[choice - 1]); -+ refresh(); -+ } -+ } -+ print_menu(menu_win, choice); -+ break; -+ } -+ } - end: -- endwin(); -- return 0; -+ endwin(); -+ return 0; - } - - - void print_menu(WINDOW *menu_win, int highlight) - { -- int x, y, i; -+ int x, y, i; - -- x = 2; -- y = 2; -- box(menu_win, 0, 0); -- for(i = 0; i &lt; n_choices; ++i) -- { if(highlight == i + 1) -- { wattron(menu_win, A_REVERSE); -- mvwprintw(menu_win, y, x, "%s", choices[i]); -- wattroff(menu_win, A_REVERSE); -- } -- else -- mvwprintw(menu_win, y, x, "%s", choices[i]); -- ++y; -- } -- wrefresh(menu_win); -+ x = 2; -+ y = 2; -+ box(menu_win, 0, 0); -+ for(i = 0; i &#60; n_choices; ++i) -+ { if(highlight == i + 1) -+ { wattron(menu_win, A_REVERSE); -+ mvwprintw(menu_win, y, x, "%s", choices[i]); -+ wattroff(menu_win, A_REVERSE); -+ } -+ else -+ mvwprintw(menu_win, y, x, "%s", choices[i]); -+ ++y; -+ } -+ wrefresh(menu_win); - } - - /* Report the choice according to mouse position */ - void report_choice(int mouse_x, int mouse_y, int *p_choice) --{ int i,j, choice; -+{ int i,j, choice; - -- i = startx + 2; -- j = starty + 3; -- -- for(choice = 0; choice &lt; n_choices; ++choice) -- if(mouse_y == j + choice &amp;&amp; mouse_x &gt;= i &amp;&amp; mouse_x &lt;= i + strlen(choices[choice])) -- { if(choice == n_choices - 1) -- *p_choice = -1; -- else -- *p_choice = choice + 1; -- break; -- } --}</span></font> --</pre></td> --</tr> --</table> --</div> --</div> --<div class="SECT2"> --<hr> --<h3 class="SECT2"><a name="MISCMOUSEFUNCS" id= --"MISCMOUSEFUNCS">12.4. Miscellaneous Functions</a></h3> --<p>The functions mouse_trafo() and wmouse_trafo() can be used to --convert to mouse co-ordinates to screen relative co-ordinates. See --curs_mouse(3X) man page for details.</p> --<p>The mouseinterval function sets the maximum time (in thousands --of a second) that can elapse between press and release events in --order for them to be recognized as a click. This function returns --the previous interval value. The default is one fifth of a --second.</p> --</div> --</div> --<div class="SECT1"> --<hr> --<h2 class="SECT1"><a name="SCREEN" id="SCREEN">13. Screen --Manipulation</a></h2> --<p>In this section, we will look into some functions, which allow --us to manage the screen efficiently and to write some fancy --programs. This is especially important in writing games.</p> --<div class="SECT2"> --<hr> --<h3 class="SECT2"><a name="GETYX" id="GETYX">13.1. getyx() --functions</a></h3> --<p>The function <var class="LITERAL">getyx()</var> can be used to --find out the present cursor co-ordinates. It will fill the values --of x and y co-ordinates in the arguments given to it. Since getyx() --is a macro you don't have to pass the address of the variables. It --can be called as</p> --<table border="0" bgcolor="#E0E0E0" width="100%"> --<tr> --<td> --<pre class="PROGRAMLISTING"> --<font color="#000000"> getyx(win, y, x); -+ i = startx + 2; -+ j = starty + 3; -+ -+ for(choice = 0; choice &#60; n_choices; ++choice) -+ if(mouse_y == j + choice &#38;&#38; mouse_x &#62;= i &#38;&#38; mouse_x &#60;= i + strlen(choices[choice])) -+ { if(choice == n_choices - 1) -+ *p_choice = -1; -+ else -+ *p_choice = choice + 1; -+ break; -+ } -+}</SPAN -+></PRE -+></DIV -+></DIV -+><DIV -+CLASS="SECT2" -+><HR><H3 -+CLASS="SECT2" -+><A -+NAME="MISCMOUSEFUNCS" -+>12.4. Miscellaneous Functions</A -+></H3 -+><P -+>The functions mouse_trafo() and wmouse_trafo() can be used to convert to mouse -+co-ordinates to screen relative co-ordinates. See curs_mouse(3X) man page for details.</P -+><P -+>The mouseinterval function sets the maximum time (in thousands of a -+second) that can elapse between press and release events in order for -+them to be recognized as a click. This function returns the previous -+interval value. The default is one fifth of a second.</P -+></DIV -+></DIV -+><DIV -+CLASS="SECT1" -+><HR><H2 -+CLASS="SECT1" -+><A -+NAME="SCREEN" -+>13. Screen Manipulation</A -+></H2 -+><P -+>In this section, we will look into some functions, which allow us to manage the -+screen efficiently and to write some fancy programs. This is especially -+important in writing games. </P -+><DIV -+CLASS="SECT2" -+><HR><H3 -+CLASS="SECT2" -+><A -+NAME="GETYX" -+>13.1. getyx() functions</A -+></H3 -+><P -+>&#13;The function <TT -+CLASS="LITERAL" -+>getyx()</TT -+> can be used to find out -+the present cursor co-ordinates. It will fill the values of x and y co-ordinates -+in the arguments given to it. Since getyx() is a macro you don't have to pass -+the address of the variables. It can be called as</P -+><PRE -+CLASS="PROGRAMLISTING" -+> getyx(win, y, x); - /* win: window pointer - * y, x: y, x co-ordinates will be put into this variables -- */</font> --</pre></td> --</tr> --</table> --<p>The function getparyx() gets the beginning co-ordinates of the --sub window relative to the main window. This is some times useful --to update a sub window. When designing fancy stuff like writing --multiple menus, it becomes difficult to store the menu positions, --their first option co-ordinates etc. A simple solution to this --problem, is to create menus in sub windows and later find the --starting co-ordinates of the menus by using getparyx().</p> --<p>The functions getbegyx() and getmaxyx() store current window's --beginning and maximum co-ordinates. These functions are useful in --the same way as above in managing the windows and sub windows --effectively.</p> --</div> --<div class="SECT2"> --<hr> --<h3 class="SECT2"><a name="SCREENDUMP" id="SCREENDUMP">13.2. Screen --Dumping</a></h3> --<p>While writing games, some times it becomes necessary to store --the state of the screen and restore it back to the same state. The --function scr_dump() can be used to dump the screen contents to a --file given as an argument. Later it can be restored by scr_restore --function. These two simple functions can be used effectively to --maintain a fast moving game with changing scenarios.</p> --</div> --<div class="SECT2"> --<hr> --<h3 class="SECT2"><a name="WINDOWDUMP" id="WINDOWDUMP">13.3. Window --Dumping</a></h3> --<p>To store and restore windows, the functions <var class= --"LITERAL">putwin()</var> and <var class="LITERAL">getwin()</var> --can be used. <var class="LITERAL">putwin()</var> puts the present --window state into a file, which can be later restored by --<var class="LITERAL">getwin()</var>.</p> --<p>The function <var class="LITERAL">copywin()</var> can be used to --copy a window completely onto another window. It takes the source --and destination windows as parameters and according to the --rectangle specified, it copies the rectangular region from source --to destination window. It's last parameter specifies whether to --overwrite or just overlay the contents on to the destination --window. If this argument is true, then the copying is --non-destructive.</p> --</div> --</div> --<div class="SECT1"> --<hr> --<h2 class="SECT1"><a name="MISC" id="MISC">14. Miscellaneous --features</a></h2> --<p>Now you know enough features to write a good curses program, --with all bells and whistles. There are some miscellaneous functions --which are useful in various cases. Let's go headlong into some of --those.</p> --<div class="SECT2"> --<hr> --<h3 class="SECT2"><a name="CURSSET" id="CURSSET">14.1. --curs_set()</a></h3> --<p>This function can be used to make the cursor invisible. The --parameter to this function should be</p> --<table border="0" bgcolor="#E0E0E0" width="100%"> --<tr> --<td> --<pre class="PROGRAMLISTING"> --<font color="#000000"> 0 : invisible or -+ */</PRE -+><P -+>The function getparyx() gets the beginning co-ordinates of the sub window -+relative to the main window. This is some times useful to update a sub window. -+When designing fancy stuff like writing multiple menus, it becomes difficult to -+store the menu positions, their first option co-ordinates etc. A simple solution -+to this problem, is to create menus in sub windows and later find the starting -+co-ordinates of the menus by using getparyx().</P -+><P -+>The functions getbegyx() and getmaxyx() store current window's beginning and -+maximum co-ordinates. These functions are useful in the same way as above in -+managing the windows and sub windows effectively.</P -+></DIV -+><DIV -+CLASS="SECT2" -+><HR><H3 -+CLASS="SECT2" -+><A -+NAME="SCREENDUMP" -+>13.2. Screen Dumping</A -+></H3 -+><P -+>While writing games, some times it becomes necessary to store the state of the -+screen and restore it back to the same state. The function scr_dump() can be -+used to dump the screen contents to a file given as an argument. Later it can be -+restored by scr_restore function. These two simple functions can be used -+effectively to maintain a fast moving game with changing scenarios. </P -+></DIV -+><DIV -+CLASS="SECT2" -+><HR><H3 -+CLASS="SECT2" -+><A -+NAME="WINDOWDUMP" -+>13.3. Window Dumping</A -+></H3 -+><P -+>To store and restore windows, the functions -+<TT -+CLASS="LITERAL" -+>putwin()</TT -+> and <TT -+CLASS="LITERAL" -+>getwin()</TT -+> can be used. <TT -+CLASS="LITERAL" -+>putwin()</TT -+> puts -+the present window state into a file, which can be later restored by -+<TT -+CLASS="LITERAL" -+>getwin()</TT -+>.</P -+><P -+> -+The function <TT -+CLASS="LITERAL" -+>copywin()</TT -+> can be used to copy a -+window completely onto another window. It takes the source and destination -+windows as parameters and according to the rectangle specified, it copies the -+rectangular region from source to destination window. It's last parameter -+specifies whether to overwrite or just overlay the contents on to the -+destination window. If this argument is true, then the copying is -+non-destructive.</P -+></DIV -+></DIV -+><DIV -+CLASS="SECT1" -+><HR><H2 -+CLASS="SECT1" -+><A -+NAME="MISC" -+>14. Miscellaneous features</A -+></H2 -+><P -+>Now you know enough features to write a good curses program, with all bells and -+whistles. There are some miscellaneous functions which are useful in various -+cases. Let's go headlong into some of those.</P -+><DIV -+CLASS="SECT2" -+><HR><H3 -+CLASS="SECT2" -+><A -+NAME="CURSSET" -+>14.1. curs_set()</A -+></H3 -+><P -+>This function can be used to make the cursor invisible. The parameter to this -+function should be </P -+><PRE -+CLASS="PROGRAMLISTING" -+> 0 : invisible or - 1 : normal or -- 2 : very visible.</font> --</pre></td> --</tr> --</table> --</div> --<div class="SECT2"> --<hr> --<h3 class="SECT2"><a name="TEMPLEAVE" id="TEMPLEAVE">14.2. --Temporarily Leaving Curses mode</a></h3> --<p>Some times you may want to get back to cooked mode (normal line --buffering mode) temporarily. In such a case you will first need to --save the tty modes with a call to <var class= --"LITERAL">def_prog_mode()</var> and then call <var class= --"LITERAL">endwin()</var> to end the curses mode. This will leave --you in the original tty mode. To get back to curses once you are --done, call <var class="LITERAL">reset_prog_mode()</var> . This --function returns the tty to the state stored by <var class= --"LITERAL">def_prog_mode()</var>. Then do refresh(), and you are --back to the curses mode. Here is an example showing the sequence of --things to be done.</p> --<div class="EXAMPLE"><a name="BTELE" id="BTELE"></a> --<p><b>Example 12. Temporarily Leaving Curses Mode</b></p> --<table border="0" bgcolor="#E0E0E0" width="100%"> --<tr> --<td> --<pre class="PROGRAMLISTING"> --<font color="#000000"><span class= --"INLINEMEDIAOBJECT">#include &lt;ncurses.h&gt; -+ 2 : very visible.</PRE -+></DIV -+><DIV -+CLASS="SECT2" -+><HR><H3 -+CLASS="SECT2" -+><A -+NAME="TEMPLEAVE" -+>14.2. Temporarily Leaving Curses mode</A -+></H3 -+><P -+>Some times you may want to get back to cooked mode (normal line buffering mode) -+temporarily. In such a case you will first need to save the tty modes with a -+call to <TT -+CLASS="LITERAL" -+>def_prog_mode()</TT -+> and then call -+<TT -+CLASS="LITERAL" -+>endwin()</TT -+> to end the curses mode. This will -+leave you in the original tty mode. To get back to curses once you are done, -+call <TT -+CLASS="LITERAL" -+>reset_prog_mode() </TT -+>. This function returns -+the tty to the state stored by <TT -+CLASS="LITERAL" -+>def_prog_mode()</TT -+>. Then do refresh(), and you are back to the curses mode. Here -+is an example showing the sequence of things to be done.</P -+><DIV -+CLASS="EXAMPLE" -+><A -+NAME="BTELE" -+></A -+><P -+><B -+>Example 12. Temporarily Leaving Curses Mode </B -+></P -+><PRE -+CLASS="PROGRAMLISTING" -+><SPAN -+CLASS="INLINEMEDIAOBJECT" -+>#include &#60;ncurses.h&#62; - - int main() --{ -- initscr(); /* Start curses mode */ -- printw("Hello World !!!\n"); /* Print Hello World */ -- refresh(); /* Print it on to the real screen */ -- def_prog_mode(); /* Save the tty modes */ -- endwin(); /* End curses mode temporarily */ -- system("/bin/sh"); /* Do whatever you like in cooked mode */ -- reset_prog_mode(); /* Return to the previous tty mode*/ -- /* stored by def_prog_mode() */ -- refresh(); /* Do refresh() to restore the */ -- /* Screen contents */ -- printw("Another String\n"); /* Back to curses use the full */ -- refresh(); /* capabilities of curses */ -- endwin(); /* End curses mode */ -- -- return 0; --}</span></font> --</pre></td> --</tr> --</table> --</div> --</div> --<div class="SECT2"> --<hr> --<h3 class="SECT2"><a name="ACSVARS" id="ACSVARS">14.3. ACS_ --variables</a></h3> --<p>If you have ever programmed in DOS, you know about those nifty --characters in extended character set. They are printable only on --some terminals. NCURSES functions like <var class= --"LITERAL">box()</var> use these characters. All these variables --start with ACS meaning alternative character set. You might have --noticed me using these characters in some of the programs above. --Here's an example showing all the characters.</p> --<div class="EXAMPLE"><a name="BACSVARS" id="BACSVARS"></a> --<p><b>Example 13. ACS Variables Example</b></p> --<table border="0" bgcolor="#E0E0E0" width="100%"> --<tr> --<td> --<pre class="PROGRAMLISTING"> --<font color="#000000"><span class= --"INLINEMEDIAOBJECT">#include &lt;ncurses.h&gt; -+{ -+ initscr(); /* Start curses mode */ -+ printw("Hello World !!!\n"); /* Print Hello World */ -+ refresh(); /* Print it on to the real screen */ -+ def_prog_mode(); /* Save the tty modes */ -+ endwin(); /* End curses mode temporarily */ -+ system("/bin/sh"); /* Do whatever you like in cooked mode */ -+ reset_prog_mode(); /* Return to the previous tty mode*/ -+ /* stored by def_prog_mode() */ -+ refresh(); /* Do refresh() to restore the */ -+ /* Screen contents */ -+ printw("Another String\n"); /* Back to curses use the full */ -+ refresh(); /* capabilities of curses */ -+ endwin(); /* End curses mode */ -+ -+ return 0; -+}</SPAN -+></PRE -+></DIV -+></DIV -+><DIV -+CLASS="SECT2" -+><HR><H3 -+CLASS="SECT2" -+><A -+NAME="ACSVARS" -+>14.3. ACS_ variables</A -+></H3 -+><P -+>If you have ever programmed in DOS, you know about those nifty characters in -+extended character set. They are printable only on some terminals. NCURSES -+functions like <TT -+CLASS="LITERAL" -+>box()</TT -+> use these characters. All -+these variables start with ACS meaning alternative character set. You might have -+noticed me using these characters in some of the programs above. Here's an example -+showing all the characters.</P -+><DIV -+CLASS="EXAMPLE" -+><A -+NAME="BACSVARS" -+></A -+><P -+><B -+>Example 13. ACS Variables Example </B -+></P -+><PRE -+CLASS="PROGRAMLISTING" -+><SPAN -+CLASS="INLINEMEDIAOBJECT" -+>#include &#60;ncurses.h&#62; - - int main() - { -@@ -2790,181 +4200,218 @@ - getch(); - endwin(); - -- return 0; --}</span></font> --</pre></td> --</tr> --</table> --</div> --</div> --</div> --<div class="SECT1"> --<hr> --<h2 class="SECT1"><a name="OTHERLIB" id="OTHERLIB">15. Other --libraries</a></h2> --<p>Apart from the curses library, there are few text mode --libraries, which provide more functionality and a lot of features. --The following sections explain three standard libraries which are --usually distributed along with curses.</p> --</div> --<div class="SECT1"> --<hr> --<h2 class="SECT1"><a name="PANELS" id="PANELS">16. Panel --Library</a></h2> --<p>Now that you are proficient in curses, you wanted to do some --thing big. You created a lot of overlapping windows to give a --professional windows-type look. Unfortunately, it soon becomes --difficult to manage these. The multiple refreshes, updates plunge --you into a nightmare. The overlapping windows create blotches, --whenever you forget to refresh the windows in the proper order.</p> --<p>Don't despair. There's an elegant solution provided in panels --library. In the words of developers of ncurses</p> --<p><em>When your interface design is such that windows may dive --deeper into the visibility stack or pop to the top at runtime, the --resulting book-keeping can be tedious and difficult to get right. --Hence the panels library.</em></p> --<p>If you have lot of overlapping windows, then panels library is --the way to go. It obviates the need of doing series of --wnoutrefresh(), doupdate() and relieves the burden of doing it --correctly(bottom up). The library maintains information about the --order of windows, their overlapping and update the screen properly. --So why wait? Let's take a close peek into panels.</p> --<div class="SECT2"> --<hr> --<h3 class="SECT2"><a name="PANELBASICS" id="PANELBASICS">16.1. The --Basics</a></h3> --<p>Panel object is a window that is implicitly treated as part of a --deck including all other panel objects. The deck is treated as a --stack with the top panel being completely visible and the other --panels may or may not be obscured according to their positions. So --the basic idea is to create a stack of overlapping panels and use --panels library to display them correctly. There is a function --similar to refresh() which, when called , displays panels in the --correct order. Functions are provided to hide or show panels, move --panels, change its size etc.. The overlapping problem is managed by --the panels library during all the calls to these functions.</p> --<p>The general flow of a panel program goes like this:</p> --<ol type="1"> --<li> --<p>Create the windows (with newwin()) to be attached to the --panels.</p> --</li> --<li> --<p>Create panels with the chosen visibility order. Stack them up --according to the desired visibility. The function new_panel() is --used to created panels.</p> --</li> --<li> --<p>Call update_panels() to write the panels to the virtual screen --in correct visibility order. Do a doupdate() to show it on the --screen.</p> --</li> --<li> --<p>Mainpulate the panels with show_panel(), hide_panel(), --move_panel() etc. Make use of helper functions like panel_hidden() --and panel_window(). Make use of user pointer to store custom data --for a panel. Use the functions set_panel_userptr() and --panel_userptr() to set and get the user pointer for a panel.</p> --</li> --<li> --<p>When you are done with the panel use del_panel() to delete the --panel.</p> --</li> --</ol> --<p>Let's make the concepts clear, with some programs. The following --is a simple program which creates 3 overlapping panels and shows --them on the screen.</p> --</div> --<div class="SECT2"> --<hr> --<h3 class="SECT2"><a name="COMPILEPANELS" id="COMPILEPANELS">16.2. --Compiling With the Panels Library</a></h3> --<p>To use panels library functions, you have to include panel.h and --to link the program with panels library the flag -lpanel should be --added along with -lncurses in that order.</p> --<table border="0" bgcolor="#E0E0E0" width="100%"> --<tr> --<td> --<pre class="PROGRAMLISTING"> --<font color="#000000"> #include &lt;panel.h&gt; -+ return 0; -+}</SPAN -+></PRE -+></DIV -+></DIV -+></DIV -+><DIV -+CLASS="SECT1" -+><HR><H2 -+CLASS="SECT1" -+><A -+NAME="OTHERLIB" -+>15. Other libraries</A -+></H2 -+><P -+>Apart from the curses library, there are few text mode libraries, which provide -+more functionality and a lot of features. The following sections explain three -+standard libraries which are usually distributed along with curses. </P -+></DIV -+><DIV -+CLASS="SECT1" -+><HR><H2 -+CLASS="SECT1" -+><A -+NAME="PANELS" -+>16. Panel Library</A -+></H2 -+><P -+>Now that you are proficient in curses, you wanted to do some thing big. You -+created a lot of overlapping windows to give a professional windows-type look. -+Unfortunately, it soon becomes difficult to manage these. The multiple -+refreshes, updates plunge you into a nightmare. The overlapping windows create -+blotches, whenever you forget to refresh the windows in the proper order. </P -+><P -+>Don't despair. There's an elegant solution provided in panels library. In the -+words of developers of ncurses </P -+><P -+><SPAN -+CLASS="emphasis" -+><I -+CLASS="EMPHASIS" -+>When your interface design is such that windows may dive deeper into the -+visibility stack or pop to the top at runtime, the resulting book-keeping can be -+tedious and difficult to get right. Hence the panels library.</I -+></SPAN -+></P -+><P -+>If you have lot of overlapping windows, then panels library is the way to go. It -+obviates the need of doing series of wnoutrefresh(), doupdate() and relieves the -+burden of doing it correctly(bottom up). The library maintains information about -+the order of windows, their overlapping and update the screen properly. So why -+wait? Let's take a close peek into panels.</P -+><DIV -+CLASS="SECT2" -+><HR><H3 -+CLASS="SECT2" -+><A -+NAME="PANELBASICS" -+>16.1. The Basics</A -+></H3 -+><P -+>Panel object is a window that is implicitly treated as part of a deck including -+all other panel objects. The deck is treated as a stack with the top panel being -+completely visible and the other panels may or may not be obscured according to -+their positions. So the basic idea is to create a stack of overlapping panels -+and use panels library to display them correctly. There is a function similar to -+refresh() which, when called , displays panels in the correct order. Functions -+are provided to hide or show panels, move panels, change its size etc.. The -+overlapping problem is managed by the panels library during all the calls to -+these functions. </P -+><P -+>The general flow of a panel program goes like this: -+ -+<P -+></P -+><OL -+TYPE="1" -+><LI -+><P -+>Create the windows (with newwin()) to be attached to the panels.</P -+></LI -+><LI -+><P -+>Create panels with the chosen visibility order. Stack them up according to the -+desired visibility. The function new_panel() is used to created panels.</P -+></LI -+><LI -+><P -+>Call update_panels() to write the panels to the virtual screen in correct -+visibility order. Do a doupdate() to show it on the screen. </P -+></LI -+><LI -+><P -+>Mainpulate the panels with show_panel(), hide_panel(), move_panel() etc. Make -+use of helper functions like panel_hidden() and panel_window(). Make use of user -+pointer to store custom data for a panel. Use the functions set_panel_userptr() -+and panel_userptr() to set and get the user pointer for a panel.</P -+></LI -+><LI -+><P -+>When you are done with the panel use del_panel() to delete the panel.</P -+></LI -+></OL -+></P -+><P -+>Let's make the concepts clear, with some programs. The following is a simple -+program which creates 3 overlapping panels and shows them on the screen. </P -+></DIV -+><DIV -+CLASS="SECT2" -+><HR><H3 -+CLASS="SECT2" -+><A -+NAME="COMPILEPANELS" -+>16.2. Compiling With the Panels Library</A -+></H3 -+><P -+>To use panels library functions, you have to include panel.h and to link the -+program with panels library the flag -lpanel should be added along with -+-lncurses in that order.</P -+><PRE -+CLASS="PROGRAMLISTING" -+> #include &lt;panel.h&gt; - . - . - . - -- compile and link: gcc &lt;program file&gt; -lpanel -lncurses</font> --</pre></td> --</tr> --</table> --<div class="EXAMPLE"><a name="PPASI" id="PPASI"></a> --<p><b>Example 14. Panel basics</b></p> --<table border="0" bgcolor="#E0E0E0" width="100%"> --<tr> --<td> --<pre class="PROGRAMLISTING"> --<font color="#000000"><span class= --"INLINEMEDIAOBJECT">#include &lt;panel.h&gt; -+ compile and link: gcc &lt;program file&gt; -lpanel -lncurses</PRE -+><DIV -+CLASS="EXAMPLE" -+><A -+NAME="PPASI" -+></A -+><P -+><B -+>Example 14. Panel basics</B -+></P -+><PRE -+CLASS="PROGRAMLISTING" -+><SPAN -+CLASS="INLINEMEDIAOBJECT" -+>#include &#60;panel.h&#62; - - int main() --{ WINDOW *my_wins[3]; -- PANEL *my_panels[3]; -- int lines = 10, cols = 40, y = 2, x = 4, i; -- -- initscr(); -- cbreak(); -- noecho(); -- -- /* Create windows for the panels */ -- my_wins[0] = newwin(lines, cols, y, x); -- my_wins[1] = newwin(lines, cols, y + 1, x + 5); -- my_wins[2] = newwin(lines, cols, y + 2, x + 10); -- -- /* -- * Create borders around the windows so that you can see the effect -- * of panels -- */ -- for(i = 0; i &lt; 3; ++i) -- box(my_wins[i], 0, 0); -- -- /* Attach a panel to each window */ /* Order is bottom up */ -- my_panels[0] = new_panel(my_wins[0]); /* Push 0, order: stdscr-0 */ -- my_panels[1] = new_panel(my_wins[1]); /* Push 1, order: stdscr-0-1 */ -- my_panels[2] = new_panel(my_wins[2]); /* Push 2, order: stdscr-0-1-2 */ -- -- /* Update the stacking order. 2nd panel will be on top */ -- update_panels(); -- -- /* Show it on the screen */ -- doupdate(); -- -- getch(); -- endwin(); -+{ WINDOW *my_wins[3]; -+ PANEL *my_panels[3]; -+ int lines = 10, cols = 40, y = 2, x = 4, i; -+ -+ initscr(); -+ cbreak(); -+ noecho(); -+ -+ /* Create windows for the panels */ -+ my_wins[0] = newwin(lines, cols, y, x); -+ my_wins[1] = newwin(lines, cols, y + 1, x + 5); -+ my_wins[2] = newwin(lines, cols, y + 2, x + 10); -+ -+ /* -+ * Create borders around the windows so that you can see the effect -+ * of panels -+ */ -+ for(i = 0; i &#60; 3; ++i) -+ box(my_wins[i], 0, 0); -+ -+ /* Attach a panel to each window */ /* Order is bottom up */ -+ my_panels[0] = new_panel(my_wins[0]); /* Push 0, order: stdscr-0 */ -+ my_panels[1] = new_panel(my_wins[1]); /* Push 1, order: stdscr-0-1 */ -+ my_panels[2] = new_panel(my_wins[2]); /* Push 2, order: stdscr-0-1-2 */ -+ -+ /* Update the stacking order. 2nd panel will be on top */ -+ update_panels(); -+ -+ /* Show it on the screen */ -+ doupdate(); -+ -+ getch(); -+ endwin(); - } --</span></font> --</pre></td> --</tr> --</table> --</div> --<p>As you can see, above program follows a simple flow as --explained. The windows are created with newwin() and then they are --attached to panels with new_panel(). As we attach one panel after --another, the stack of panels gets updated. To put them on screen --update_panels() and doupdate() are called.</p> --</div> --<div class="SECT2"> --<hr> --<h3 class="SECT2"><a name="PANELBROWSING" id="PANELBROWSING">16.3. --Panel Window Browsing</a></h3> --<p>A slightly complicated example is given below. This program --creates 3 windows which can be cycled through using tab. Have a --look at the code.</p> --<div class="EXAMPLE"><a name="PPABR" id="PPABR"></a> --<p><b>Example 15. Panel Window Browsing Example</b></p> --<table border="0" bgcolor="#E0E0E0" width="100%"> --<tr> --<td> --<pre class="PROGRAMLISTING"> --<font color="#000000"><span class= --"INLINEMEDIAOBJECT">#include &lt;panel.h&gt; -+</SPAN -+></PRE -+></DIV -+><P -+>As you can see, above program follows a simple flow as explained. The windows -+are created with newwin() and then they are attached to panels with new_panel(). -+As we attach one panel after another, the stack of panels gets updated. To put -+them on screen update_panels() and doupdate() are called.</P -+></DIV -+><DIV -+CLASS="SECT2" -+><HR><H3 -+CLASS="SECT2" -+><A -+NAME="PANELBROWSING" -+>16.3. Panel Window Browsing</A -+></H3 -+><P -+>A slightly complicated example is given below. This program creates 3 -+windows which can be cycled through using tab. Have a look at the code.</P -+><DIV -+CLASS="EXAMPLE" -+><A -+NAME="PPABR" -+></A -+><P -+><B -+>Example 15. Panel Window Browsing Example </B -+></P -+><PRE -+CLASS="PROGRAMLISTING" -+><SPAN -+CLASS="INLINEMEDIAOBJECT" -+>#include &#60;panel.h&#62; - - #define NLINES 10 - #define NCOLS 40 -@@ -2974,172 +4421,191 @@ - void print_in_middle(WINDOW *win, int starty, int startx, int width, char *string, chtype color); - - int main() --{ WINDOW *my_wins[3]; -- PANEL *my_panels[3]; -- PANEL *top; -- int ch; -- -- /* Initialize curses */ -- initscr(); -- start_color(); -- cbreak(); -- noecho(); -- keypad(stdscr, TRUE); -- -- /* Initialize all the colors */ -- init_pair(1, COLOR_RED, COLOR_BLACK); -- init_pair(2, COLOR_GREEN, COLOR_BLACK); -- init_pair(3, COLOR_BLUE, COLOR_BLACK); -- init_pair(4, COLOR_CYAN, COLOR_BLACK); -- -- init_wins(my_wins, 3); -- -- /* Attach a panel to each window */ /* Order is bottom up */ -- my_panels[0] = new_panel(my_wins[0]); /* Push 0, order: stdscr-0 */ -- my_panels[1] = new_panel(my_wins[1]); /* Push 1, order: stdscr-0-1 */ -- my_panels[2] = new_panel(my_wins[2]); /* Push 2, order: stdscr-0-1-2 */ -- -- /* Set up the user pointers to the next panel */ -- set_panel_userptr(my_panels[0], my_panels[1]); -- set_panel_userptr(my_panels[1], my_panels[2]); -- set_panel_userptr(my_panels[2], my_panels[0]); -- -- /* Update the stacking order. 2nd panel will be on top */ -- update_panels(); -- -- /* Show it on the screen */ -- attron(COLOR_PAIR(4)); -- mvprintw(LINES - 2, 0, "Use tab to browse through the windows (F1 to Exit)"); -- attroff(COLOR_PAIR(4)); -- doupdate(); -- -- top = my_panels[2]; -- while((ch = getch()) != KEY_F(1)) -- { switch(ch) -- { case 9: -- top = (PANEL *)panel_userptr(top); -- top_panel(top); -- break; -- } -- update_panels(); -- doupdate(); -- } -- endwin(); -- return 0; -+{ WINDOW *my_wins[3]; -+ PANEL *my_panels[3]; -+ PANEL *top; -+ int ch; -+ -+ /* Initialize curses */ -+ initscr(); -+ start_color(); -+ cbreak(); -+ noecho(); -+ keypad(stdscr, TRUE); -+ -+ /* Initialize all the colors */ -+ init_pair(1, COLOR_RED, COLOR_BLACK); -+ init_pair(2, COLOR_GREEN, COLOR_BLACK); -+ init_pair(3, COLOR_BLUE, COLOR_BLACK); -+ init_pair(4, COLOR_CYAN, COLOR_BLACK); -+ -+ init_wins(my_wins, 3); -+ -+ /* Attach a panel to each window */ /* Order is bottom up */ -+ my_panels[0] = new_panel(my_wins[0]); /* Push 0, order: stdscr-0 */ -+ my_panels[1] = new_panel(my_wins[1]); /* Push 1, order: stdscr-0-1 */ -+ my_panels[2] = new_panel(my_wins[2]); /* Push 2, order: stdscr-0-1-2 */ -+ -+ /* Set up the user pointers to the next panel */ -+ set_panel_userptr(my_panels[0], my_panels[1]); -+ set_panel_userptr(my_panels[1], my_panels[2]); -+ set_panel_userptr(my_panels[2], my_panels[0]); -+ -+ /* Update the stacking order. 2nd panel will be on top */ -+ update_panels(); -+ -+ /* Show it on the screen */ -+ attron(COLOR_PAIR(4)); -+ mvprintw(LINES - 2, 0, "Use tab to browse through the windows (F1 to Exit)"); -+ attroff(COLOR_PAIR(4)); -+ doupdate(); -+ -+ top = my_panels[2]; -+ while((ch = getch()) != KEY_F(1)) -+ { switch(ch) -+ { case 9: -+ top = (PANEL *)panel_userptr(top); -+ top_panel(top); -+ break; -+ } -+ update_panels(); -+ doupdate(); -+ } -+ endwin(); -+ return 0; - } - - /* Put all the windows */ - void init_wins(WINDOW **wins, int n) --{ int x, y, i; -- char label[80]; -+{ int x, y, i; -+ char label[80]; - -- y = 2; -- x = 10; -- for(i = 0; i &lt; n; ++i) -- { wins[i] = newwin(NLINES, NCOLS, y, x); -- sprintf(label, "Window Number %d", i + 1); -- win_show(wins[i], label, i + 1); -- y += 3; -- x += 7; -- } -+ y = 2; -+ x = 10; -+ for(i = 0; i &#60; n; ++i) -+ { wins[i] = newwin(NLINES, NCOLS, y, x); -+ sprintf(label, "Window Number %d", i + 1); -+ win_show(wins[i], label, i + 1); -+ y += 3; -+ x += 7; -+ } - } - - /* Show the window with a border and a label */ - void win_show(WINDOW *win, char *label, int label_color) --{ int startx, starty, height, width; -+{ int startx, starty, height, width; - -- getbegyx(win, starty, startx); -- getmaxyx(win, height, width); -+ getbegyx(win, starty, startx); -+ getmaxyx(win, height, width); - -- box(win, 0, 0); -- mvwaddch(win, 2, 0, ACS_LTEE); -- mvwhline(win, 2, 1, ACS_HLINE, width - 2); -- mvwaddch(win, 2, width - 1, ACS_RTEE); -- -- print_in_middle(win, 1, 0, width, label, COLOR_PAIR(label_color)); -+ box(win, 0, 0); -+ mvwaddch(win, 2, 0, ACS_LTEE); -+ mvwhline(win, 2, 1, ACS_HLINE, width - 2); -+ mvwaddch(win, 2, width - 1, ACS_RTEE); -+ -+ print_in_middle(win, 1, 0, width, label, COLOR_PAIR(label_color)); - } - - void print_in_middle(WINDOW *win, int starty, int startx, int width, char *string, chtype color) --{ int length, x, y; -- float temp; -+{ int length, x, y; -+ float temp; - -- if(win == NULL) -- win = stdscr; -- getyx(win, y, x); -- if(startx != 0) -- x = startx; -- if(starty != 0) -- y = starty; -- if(width == 0) -- width = 80; -- -- length = strlen(string); -- temp = (width - length)/ 2; -- x = startx + (int)temp; -- wattron(win, color); -- mvwprintw(win, y, x, "%s", string); -- wattroff(win, color); -- refresh(); --}</span></font> --</pre></td> --</tr> --</table> --</div> --</div> --<div class="SECT2"> --<hr> --<h3 class="SECT2"><a name="USERPTRUSING" id="USERPTRUSING">16.4. --Using User Pointers</a></h3> --<p>In the above example I used user pointers to find out the next --window in the cycle. We can attach custom information to the panel --by specifying a user pointer, which can point to any information --you want to store. In this case I stored the pointer to the next --panel in the cycle. User pointer for a panel can be set with the --function <var class="LITERAL">set_panel_userptr()</var>. It can be --accessed using the function <var class= --"LITERAL">panel_userptr()</var> which will return the user pointer --for the panel given as argument. After finding the next panel in --the cycle It's brought to the top by the function top_panel(). This --function brings the panel given as argument to the top of the panel --stack.</p> --</div> --<div class="SECT2"> --<hr> --<h3 class="SECT2"><a name="PANELMOVERESIZE" id= --"PANELMOVERESIZE">16.5. Moving and Resizing Panels</a></h3> --<p>The function <var class="LITERAL">move_panel()</var> can be used --to move a panel to the desired location. It does not change the --position of the panel in the stack. Make sure that you use --move_panel() instead mvwin() on the window associated with the --panel.</p> --<p>Resizing a panel is slightly complex. There is no straight --forward function just to resize the window associated with a panel. --A solution to resize a panel is to create a new window with the --desired sizes, change the window associated with the panel using --replace_panel(). Don't forget to delete the old window. The window --associated with a panel can be found by using the function --panel_window().</p> --<p>The following program shows these concepts, in supposedly simple --program. You can cycle through the window with &lt;TAB&gt; as --usual. To resize or move the active panel press 'r' for resize 'm' --for moving. Then use arrow keys to resize or move it to the desired --way and press enter to end your resizing or moving. This example --makes use of user data to get the required data to do the --operations.</p> --<div class="EXAMPLE"><a name="PPARE" id="PPARE"></a> --<p><b>Example 16. Panel Moving and Resizing example</b></p> --<table border="0" bgcolor="#E0E0E0" width="100%"> --<tr> --<td> --<pre class="PROGRAMLISTING"> --<font color="#000000"><span class= --"INLINEMEDIAOBJECT">#include &lt;panel.h&gt; -+ if(win == NULL) -+ win = stdscr; -+ getyx(win, y, x); -+ if(startx != 0) -+ x = startx; -+ if(starty != 0) -+ y = starty; -+ if(width == 0) -+ width = 80; -+ -+ length = strlen(string); -+ temp = (width - length)/ 2; -+ x = startx + (int)temp; -+ wattron(win, color); -+ mvwprintw(win, y, x, "%s", string); -+ wattroff(win, color); -+ refresh(); -+}</SPAN -+></PRE -+></DIV -+></DIV -+><DIV -+CLASS="SECT2" -+><HR><H3 -+CLASS="SECT2" -+><A -+NAME="USERPTRUSING" -+>16.4. Using User Pointers</A -+></H3 -+><P -+>In the above example I used user pointers to find out the next window in the -+cycle. We can attach custom information to the panel by specifying a user -+pointer, which can point to any information you want to store. In this case I -+stored the pointer to the next panel in the cycle. User pointer for a panel can -+be set with the function <TT -+CLASS="LITERAL" -+> set_panel_userptr()</TT -+>. -+It can be accessed using the function <TT -+CLASS="LITERAL" -+>panel_userptr()</TT -+> which will return the user pointer for the panel given as -+argument. After finding the next panel in the cycle It's brought to the top by -+the function top_panel(). This function brings the panel given as argument to -+the top of the panel stack. </P -+></DIV -+><DIV -+CLASS="SECT2" -+><HR><H3 -+CLASS="SECT2" -+><A -+NAME="PANELMOVERESIZE" -+>16.5. Moving and Resizing Panels</A -+></H3 -+><P -+>The function <TT -+CLASS="LITERAL" -+>move_panel()</TT -+> can be used to move a -+panel to the desired location. It does not change the position of the panel in -+the stack. Make sure that you use move_panel() instead mvwin() on the window -+associated with the panel.</P -+><P -+>Resizing a panel is slightly complex. There is no straight forward function -+just to resize the window associated with a panel. A solution to resize a panel -+is to create a new window with the desired sizes, change the window associated -+with the panel using replace_panel(). Don't forget to delete the old window. The -+window associated with a panel can be found by using the function -+panel_window().</P -+><P -+>The following program shows these concepts, in supposedly simple program. You -+can cycle through the window with &lt;TAB&gt; as usual. To resize or move the -+active panel press 'r' for resize 'm' for moving. Then use arrow keys to resize -+or move it to the desired way and press enter to end your resizing or moving. -+This example makes use of user data to get the required data to do the -+operations. </P -+><DIV -+CLASS="EXAMPLE" -+><A -+NAME="PPARE" -+></A -+><P -+><B -+>Example 16. Panel Moving and Resizing example </B -+></P -+><PRE -+CLASS="PROGRAMLISTING" -+><SPAN -+CLASS="INLINEMEDIAOBJECT" -+>#include &#60;panel.h&#62; - - typedef struct _PANEL_DATA { -- int x, y, w, h; -- char label[80]; -- int label_color; -- PANEL *next; -+ int x, y, w, h; -+ char label[80]; -+ int label_color; -+ PANEL *next; - }PANEL_DATA; - - #define NLINES 10 -@@ -3151,275 +4617,289 @@ - void set_user_ptrs(PANEL **panels, int n); - - int main() --{ WINDOW *my_wins[3]; -- PANEL *my_panels[3]; -- PANEL_DATA *top; -- PANEL *stack_top; -- WINDOW *temp_win, *old_win; -- int ch; -- int newx, newy, neww, newh; -- int size = FALSE, move = FALSE; -- -- /* Initialize curses */ -- initscr(); -- start_color(); -- cbreak(); -- noecho(); -- keypad(stdscr, TRUE); -- -- /* Initialize all the colors */ -- init_pair(1, COLOR_RED, COLOR_BLACK); -- init_pair(2, COLOR_GREEN, COLOR_BLACK); -- init_pair(3, COLOR_BLUE, COLOR_BLACK); -- init_pair(4, COLOR_CYAN, COLOR_BLACK); -- -- init_wins(my_wins, 3); -- -- /* Attach a panel to each window */ /* Order is bottom up */ -- my_panels[0] = new_panel(my_wins[0]); /* Push 0, order: stdscr-0 */ -- my_panels[1] = new_panel(my_wins[1]); /* Push 1, order: stdscr-0-1 */ -- my_panels[2] = new_panel(my_wins[2]); /* Push 2, order: stdscr-0-1-2 */ -- -- set_user_ptrs(my_panels, 3); -- /* Update the stacking order. 2nd panel will be on top */ -- update_panels(); -- -- /* Show it on the screen */ -- attron(COLOR_PAIR(4)); -- mvprintw(LINES - 3, 0, "Use 'm' for moving, 'r' for resizing"); -- mvprintw(LINES - 2, 0, "Use tab to browse through the windows (F1 to Exit)"); -- attroff(COLOR_PAIR(4)); -- doupdate(); -- -- stack_top = my_panels[2]; -- top = (PANEL_DATA *)panel_userptr(stack_top); -- newx = top-&gt;x; -- newy = top-&gt;y; -- neww = top-&gt;w; -- newh = top-&gt;h; -- while((ch = getch()) != KEY_F(1)) -- { switch(ch) -- { case 9: /* Tab */ -- top = (PANEL_DATA *)panel_userptr(stack_top); -- top_panel(top-&gt;next); -- stack_top = top-&gt;next; -- top = (PANEL_DATA *)panel_userptr(stack_top); -- newx = top-&gt;x; -- newy = top-&gt;y; -- neww = top-&gt;w; -- newh = top-&gt;h; -- break; -- case 'r': /* Re-Size*/ -- size = TRUE; -- attron(COLOR_PAIR(4)); -- mvprintw(LINES - 4, 0, "Entered Resizing :Use Arrow Keys to resize and press &lt;ENTER&gt; to end resizing"); -- refresh(); -- attroff(COLOR_PAIR(4)); -- break; -- case 'm': /* Move */ -- attron(COLOR_PAIR(4)); -- mvprintw(LINES - 4, 0, "Entered Moving: Use Arrow Keys to Move and press &lt;ENTER&gt; to end moving"); -- refresh(); -- attroff(COLOR_PAIR(4)); -- move = TRUE; -- break; -- case KEY_LEFT: -- if(size == TRUE) -- { --newx; -- ++neww; -- } -- if(move == TRUE) -- --newx; -- break; -- case KEY_RIGHT: -- if(size == TRUE) -- { ++newx; -- --neww; -- } -- if(move == TRUE) -- ++newx; -- break; -- case KEY_UP: -- if(size == TRUE) -- { --newy; -- ++newh; -- } -- if(move == TRUE) -- --newy; -- break; -- case KEY_DOWN: -- if(size == TRUE) -- { ++newy; -- --newh; -- } -- if(move == TRUE) -- ++newy; -- break; -- case 10: /* Enter */ -- move(LINES - 4, 0); -- clrtoeol(); -- refresh(); -- if(size == TRUE) -- { old_win = panel_window(stack_top); -- temp_win = newwin(newh, neww, newy, newx); -- replace_panel(stack_top, temp_win); -- win_show(temp_win, top-&gt;label, top-&gt;label_color); -- delwin(old_win); -- size = FALSE; -- } -- if(move == TRUE) -- { move_panel(stack_top, newy, newx); -- move = FALSE; -- } -- break; -- -- } -- attron(COLOR_PAIR(4)); -- mvprintw(LINES - 3, 0, "Use 'm' for moving, 'r' for resizing"); -- mvprintw(LINES - 2, 0, "Use tab to browse through the windows (F1 to Exit)"); -- attroff(COLOR_PAIR(4)); -- refresh(); -- update_panels(); -- doupdate(); -- } -- endwin(); -- return 0; -+{ WINDOW *my_wins[3]; -+ PANEL *my_panels[3]; -+ PANEL_DATA *top; -+ PANEL *stack_top; -+ WINDOW *temp_win, *old_win; -+ int ch; -+ int newx, newy, neww, newh; -+ int size = FALSE, move = FALSE; -+ -+ /* Initialize curses */ -+ initscr(); -+ start_color(); -+ cbreak(); -+ noecho(); -+ keypad(stdscr, TRUE); -+ -+ /* Initialize all the colors */ -+ init_pair(1, COLOR_RED, COLOR_BLACK); -+ init_pair(2, COLOR_GREEN, COLOR_BLACK); -+ init_pair(3, COLOR_BLUE, COLOR_BLACK); -+ init_pair(4, COLOR_CYAN, COLOR_BLACK); -+ -+ init_wins(my_wins, 3); -+ -+ /* Attach a panel to each window */ /* Order is bottom up */ -+ my_panels[0] = new_panel(my_wins[0]); /* Push 0, order: stdscr-0 */ -+ my_panels[1] = new_panel(my_wins[1]); /* Push 1, order: stdscr-0-1 */ -+ my_panels[2] = new_panel(my_wins[2]); /* Push 2, order: stdscr-0-1-2 */ -+ -+ set_user_ptrs(my_panels, 3); -+ /* Update the stacking order. 2nd panel will be on top */ -+ update_panels(); -+ -+ /* Show it on the screen */ -+ attron(COLOR_PAIR(4)); -+ mvprintw(LINES - 3, 0, "Use 'm' for moving, 'r' for resizing"); -+ mvprintw(LINES - 2, 0, "Use tab to browse through the windows (F1 to Exit)"); -+ attroff(COLOR_PAIR(4)); -+ doupdate(); -+ -+ stack_top = my_panels[2]; -+ top = (PANEL_DATA *)panel_userptr(stack_top); -+ newx = top-&#62;x; -+ newy = top-&#62;y; -+ neww = top-&#62;w; -+ newh = top-&#62;h; -+ while((ch = getch()) != KEY_F(1)) -+ { switch(ch) -+ { case 9: /* Tab */ -+ top = (PANEL_DATA *)panel_userptr(stack_top); -+ top_panel(top-&#62;next); -+ stack_top = top-&#62;next; -+ top = (PANEL_DATA *)panel_userptr(stack_top); -+ newx = top-&#62;x; -+ newy = top-&#62;y; -+ neww = top-&#62;w; -+ newh = top-&#62;h; -+ break; -+ case 'r': /* Re-Size*/ -+ size = TRUE; -+ attron(COLOR_PAIR(4)); -+ mvprintw(LINES - 4, 0, "Entered Resizing :Use Arrow Keys to resize and press &#60;ENTER&#62; to end resizing"); -+ refresh(); -+ attroff(COLOR_PAIR(4)); -+ break; -+ case 'm': /* Move */ -+ attron(COLOR_PAIR(4)); -+ mvprintw(LINES - 4, 0, "Entered Moving: Use Arrow Keys to Move and press &#60;ENTER&#62; to end moving"); -+ refresh(); -+ attroff(COLOR_PAIR(4)); -+ move = TRUE; -+ break; -+ case KEY_LEFT: -+ if(size == TRUE) -+ { --newx; -+ ++neww; -+ } -+ if(move == TRUE) -+ --newx; -+ break; -+ case KEY_RIGHT: -+ if(size == TRUE) -+ { ++newx; -+ --neww; -+ } -+ if(move == TRUE) -+ ++newx; -+ break; -+ case KEY_UP: -+ if(size == TRUE) -+ { --newy; -+ ++newh; -+ } -+ if(move == TRUE) -+ --newy; -+ break; -+ case KEY_DOWN: -+ if(size == TRUE) -+ { ++newy; -+ --newh; -+ } -+ if(move == TRUE) -+ ++newy; -+ break; -+ case 10: /* Enter */ -+ move(LINES - 4, 0); -+ clrtoeol(); -+ refresh(); -+ if(size == TRUE) -+ { old_win = panel_window(stack_top); -+ temp_win = newwin(newh, neww, newy, newx); -+ replace_panel(stack_top, temp_win); -+ win_show(temp_win, top-&#62;label, top-&#62;label_color); -+ delwin(old_win); -+ size = FALSE; -+ } -+ if(move == TRUE) -+ { move_panel(stack_top, newy, newx); -+ move = FALSE; -+ } -+ break; -+ -+ } -+ attron(COLOR_PAIR(4)); -+ mvprintw(LINES - 3, 0, "Use 'm' for moving, 'r' for resizing"); -+ mvprintw(LINES - 2, 0, "Use tab to browse through the windows (F1 to Exit)"); -+ attroff(COLOR_PAIR(4)); -+ refresh(); -+ update_panels(); -+ doupdate(); -+ } -+ endwin(); -+ return 0; - } - - /* Put all the windows */ - void init_wins(WINDOW **wins, int n) --{ int x, y, i; -- char label[80]; -+{ int x, y, i; -+ char label[80]; - -- y = 2; -- x = 10; -- for(i = 0; i &lt; n; ++i) -- { wins[i] = newwin(NLINES, NCOLS, y, x); -- sprintf(label, "Window Number %d", i + 1); -- win_show(wins[i], label, i + 1); -- y += 3; -- x += 7; -- } -+ y = 2; -+ x = 10; -+ for(i = 0; i &#60; n; ++i) -+ { wins[i] = newwin(NLINES, NCOLS, y, x); -+ sprintf(label, "Window Number %d", i + 1); -+ win_show(wins[i], label, i + 1); -+ y += 3; -+ x += 7; -+ } - } - - /* Set the PANEL_DATA structures for individual panels */ - void set_user_ptrs(PANEL **panels, int n) --{ PANEL_DATA *ptrs; -- WINDOW *win; -- int x, y, w, h, i; -- char temp[80]; -- -- ptrs = (PANEL_DATA *)calloc(n, sizeof(PANEL_DATA)); -- -- for(i = 0;i &lt; n; ++i) -- { win = panel_window(panels[i]); -- getbegyx(win, y, x); -- getmaxyx(win, h, w); -- ptrs[i].x = x; -- ptrs[i].y = y; -- ptrs[i].w = w; -- ptrs[i].h = h; -- sprintf(temp, "Window Number %d", i + 1); -- strcpy(ptrs[i].label, temp); -- ptrs[i].label_color = i + 1; -- if(i + 1 == n) -- ptrs[i].next = panels[0]; -- else -- ptrs[i].next = panels[i + 1]; -- set_panel_userptr(panels[i], &amp;ptrs[i]); -- } -+{ PANEL_DATA *ptrs; -+ WINDOW *win; -+ int x, y, w, h, i; -+ char temp[80]; -+ -+ ptrs = (PANEL_DATA *)calloc(n, sizeof(PANEL_DATA)); -+ -+ for(i = 0;i &#60; n; ++i) -+ { win = panel_window(panels[i]); -+ getbegyx(win, y, x); -+ getmaxyx(win, h, w); -+ ptrs[i].x = x; -+ ptrs[i].y = y; -+ ptrs[i].w = w; -+ ptrs[i].h = h; -+ sprintf(temp, "Window Number %d", i + 1); -+ strcpy(ptrs[i].label, temp); -+ ptrs[i].label_color = i + 1; -+ if(i + 1 == n) -+ ptrs[i].next = panels[0]; -+ else -+ ptrs[i].next = panels[i + 1]; -+ set_panel_userptr(panels[i], &#38;ptrs[i]); -+ } - } - - /* Show the window with a border and a label */ - void win_show(WINDOW *win, char *label, int label_color) --{ int startx, starty, height, width; -+{ int startx, starty, height, width; - -- getbegyx(win, starty, startx); -- getmaxyx(win, height, width); -+ getbegyx(win, starty, startx); -+ getmaxyx(win, height, width); - -- box(win, 0, 0); -- mvwaddch(win, 2, 0, ACS_LTEE); -- mvwhline(win, 2, 1, ACS_HLINE, width - 2); -- mvwaddch(win, 2, width - 1, ACS_RTEE); -- -- print_in_middle(win, 1, 0, width, label, COLOR_PAIR(label_color)); -+ box(win, 0, 0); -+ mvwaddch(win, 2, 0, ACS_LTEE); -+ mvwhline(win, 2, 1, ACS_HLINE, width - 2); -+ mvwaddch(win, 2, width - 1, ACS_RTEE); -+ -+ print_in_middle(win, 1, 0, width, label, COLOR_PAIR(label_color)); - } - - void print_in_middle(WINDOW *win, int starty, int startx, int width, char *string, chtype color) --{ int length, x, y; -- float temp; -+{ int length, x, y; -+ float temp; - -- if(win == NULL) -- win = stdscr; -- getyx(win, y, x); -- if(startx != 0) -- x = startx; -- if(starty != 0) -- y = starty; -- if(width == 0) -- width = 80; -- -- length = strlen(string); -- temp = (width - length)/ 2; -- x = startx + (int)temp; -- wattron(win, color); -- mvwprintw(win, y, x, "%s", string); -- wattroff(win, color); -- refresh(); --}</span></font> --</pre></td> --</tr> --</table> --</div> --<p>Concentrate on the main while loop. Once it finds out the type --of key pressed, it takes appropriate action. If 'r' is pressed --resizing mode is started. After this the new sizes are updated as --the user presses the arrow keys. When the user presses --&lt;ENTER&gt; present selection ends and panel is resized by using --the concept explained. While in resizing mode the program doesn't --show how the window is getting resized. It's left as an exercise to --the reader to print a dotted border while it gets resized to a new --position.</p> --<p>When the user presses 'm' the move mode starts. This is a bit --simpler than resizing. As the arrow keys are pressed the new --position is updated and pressing of &lt;ENTER&gt; causes the panel --to be moved by calling the function move_panel().</p> --<p>In this program the user data which is represented as --PANEL_DATA, plays very important role in finding the associated --information with a panel. As written in the comments, the --PANEL_DATA stores the panel sizes, label, label color and a pointer --to the next panel in the cycle.</p> --</div> --<div class="SECT2"> --<hr> --<h3 class="SECT2"><a name="PANELSHOWHIDE" id="PANELSHOWHIDE">16.6. --Hiding and Showing Panels</a></h3> --<p>A Panel can be hidden by using the function hide_panel(). This --function merely removes it form the stack of panels, thus hiding it --on the screen once you do update_panels() and doupdate(). It --doesn't destroy the PANEL structure associated with the hidden --panel. It can be shown again by using the show_panel() --function.</p> --<p>The following program shows the hiding of panels. Press 'a' or --'b' or 'c' to show or hide first, second and third windows --respectively. It uses a user data with a small variable hide, which --keeps track of whether the window is hidden or not. For some reason --the function <var class="LITERAL">panel_hidden()</var> which tells --whether a panel is hidden or not is not working. A bug report was --also presented by Michael Andres <a href= --"http://www.geocrawler.com/archives/3/344/1999/9/0/2643549/" --target="_top">here</a></p> --<div class="EXAMPLE"><a name="PPAHI" id="PPAHI"></a> --<p><b>Example 17. Panel Hiding and Showing example</b></p> --<table border="0" bgcolor="#E0E0E0" width="100%"> --<tr> --<td> --<pre class="PROGRAMLISTING"> --<font color="#000000"><span class= --"INLINEMEDIAOBJECT">#include &lt;panel.h&gt; -+ if(win == NULL) -+ win = stdscr; -+ getyx(win, y, x); -+ if(startx != 0) -+ x = startx; -+ if(starty != 0) -+ y = starty; -+ if(width == 0) -+ width = 80; -+ -+ length = strlen(string); -+ temp = (width - length)/ 2; -+ x = startx + (int)temp; -+ wattron(win, color); -+ mvwprintw(win, y, x, "%s", string); -+ wattroff(win, color); -+ refresh(); -+}</SPAN -+></PRE -+></DIV -+><P -+>Concentrate on the main while loop. Once it finds out the type of key pressed, -+it takes appropriate action. If 'r' is pressed resizing mode is started. After -+this the new sizes are updated as the user presses the arrow keys. When the user -+presses &lt;ENTER&gt; present selection ends and panel is resized by using the -+concept explained. While in resizing mode the program doesn't show how the -+window is getting resized. It's left as an exercise to the reader to print a -+dotted border while it gets resized to a new position. </P -+><P -+>When the user presses 'm' the move mode starts. This is a bit simpler than -+resizing. As the arrow keys are pressed the new position is updated and -+pressing of &lt;ENTER&gt; causes the panel to be moved by calling the function -+move_panel().</P -+><P -+>In this program the user data which is represented as PANEL_DATA, plays very -+important role in finding the associated information with a panel. As written in -+the comments, the PANEL_DATA stores the panel sizes, label, label color and a -+pointer to the next panel in the cycle.</P -+></DIV -+><DIV -+CLASS="SECT2" -+><HR><H3 -+CLASS="SECT2" -+><A -+NAME="PANELSHOWHIDE" -+>16.6. Hiding and Showing Panels</A -+></H3 -+><P -+>A Panel can be hidden by using the function hide_panel(). This function merely -+removes it form the stack of panels, thus hiding it on the screen once you do -+update_panels() and doupdate(). It doesn't destroy the PANEL structure -+associated with the hidden panel. It can be shown again by using the -+show_panel() function.</P -+><P -+>The following program shows the hiding of panels. Press 'a' or 'b' or 'c' to -+show or hide first, second and third windows respectively. It uses a user data -+with a small variable hide, which keeps track of whether the window is hidden or -+not. For some reason the function -+<TT -+CLASS="LITERAL" -+>panel_hidden()</TT -+> which tells whether a panel is -+hidden or not is not working. A bug report was also presented by Michael Andres -+<A -+HREF="http://www.geocrawler.com/archives/3/344/1999/9/0/2643549/" -+TARGET="_top" -+> here</A -+></P -+><DIV -+CLASS="EXAMPLE" -+><A -+NAME="PPAHI" -+></A -+><P -+><B -+>Example 17. Panel Hiding and Showing example </B -+></P -+><PRE -+CLASS="PROGRAMLISTING" -+><SPAN -+CLASS="INLINEMEDIAOBJECT" -+>#include &#60;panel.h&#62; - - typedef struct _PANEL_DATA { -- int hide; /* TRUE if panel is hidden */ -+ int hide; /* TRUE if panel is hidden */ - }PANEL_DATA; - - #define NLINES 10 -@@ -3430,257 +4910,292 @@ - void print_in_middle(WINDOW *win, int starty, int startx, int width, char *string, chtype color); - - int main() --{ WINDOW *my_wins[3]; -- PANEL *my_panels[3]; -- PANEL_DATA panel_datas[3]; -- PANEL_DATA *temp; -- int ch; -- -- /* Initialize curses */ -- initscr(); -- start_color(); -- cbreak(); -- noecho(); -- keypad(stdscr, TRUE); -- -- /* Initialize all the colors */ -- init_pair(1, COLOR_RED, COLOR_BLACK); -- init_pair(2, COLOR_GREEN, COLOR_BLACK); -- init_pair(3, COLOR_BLUE, COLOR_BLACK); -- init_pair(4, COLOR_CYAN, COLOR_BLACK); -- -- init_wins(my_wins, 3); -- -- /* Attach a panel to each window */ /* Order is bottom up */ -- my_panels[0] = new_panel(my_wins[0]); /* Push 0, order: stdscr-0 */ -- my_panels[1] = new_panel(my_wins[1]); /* Push 1, order: stdscr-0-1 */ -- my_panels[2] = new_panel(my_wins[2]); /* Push 2, order: stdscr-0-1-2 */ -- -- /* Initialize panel datas saying that nothing is hidden */ -- panel_datas[0].hide = FALSE; -- panel_datas[1].hide = FALSE; -- panel_datas[2].hide = FALSE; -- -- set_panel_userptr(my_panels[0], &amp;panel_datas[0]); -- set_panel_userptr(my_panels[1], &amp;panel_datas[1]); -- set_panel_userptr(my_panels[2], &amp;panel_datas[2]); -- -- /* Update the stacking order. 2nd panel will be on top */ -- update_panels(); -- -- /* Show it on the screen */ -- attron(COLOR_PAIR(4)); -- mvprintw(LINES - 3, 0, "Show or Hide a window with 'a'(first window) 'b'(Second Window) 'c'(Third Window)"); -- mvprintw(LINES - 2, 0, "F1 to Exit"); -- -- attroff(COLOR_PAIR(4)); -- doupdate(); -- -- while((ch = getch()) != KEY_F(1)) -- { switch(ch) -- { case 'a': -- temp = (PANEL_DATA *)panel_userptr(my_panels[0]); -- if(temp-&gt;hide == FALSE) -- { hide_panel(my_panels[0]); -- temp-&gt;hide = TRUE; -- } -- else -- { show_panel(my_panels[0]); -- temp-&gt;hide = FALSE; -- } -- break; -- case 'b': -- temp = (PANEL_DATA *)panel_userptr(my_panels[1]); -- if(temp-&gt;hide == FALSE) -- { hide_panel(my_panels[1]); -- temp-&gt;hide = TRUE; -- } -- else -- { show_panel(my_panels[1]); -- temp-&gt;hide = FALSE; -- } -- break; -- case 'c': -- temp = (PANEL_DATA *)panel_userptr(my_panels[2]); -- if(temp-&gt;hide == FALSE) -- { hide_panel(my_panels[2]); -- temp-&gt;hide = TRUE; -- } -- else -- { show_panel(my_panels[2]); -- temp-&gt;hide = FALSE; -- } -- break; -- } -- update_panels(); -- doupdate(); -- } -- endwin(); -- return 0; -+{ WINDOW *my_wins[3]; -+ PANEL *my_panels[3]; -+ PANEL_DATA panel_datas[3]; -+ PANEL_DATA *temp; -+ int ch; -+ -+ /* Initialize curses */ -+ initscr(); -+ start_color(); -+ cbreak(); -+ noecho(); -+ keypad(stdscr, TRUE); -+ -+ /* Initialize all the colors */ -+ init_pair(1, COLOR_RED, COLOR_BLACK); -+ init_pair(2, COLOR_GREEN, COLOR_BLACK); -+ init_pair(3, COLOR_BLUE, COLOR_BLACK); -+ init_pair(4, COLOR_CYAN, COLOR_BLACK); -+ -+ init_wins(my_wins, 3); -+ -+ /* Attach a panel to each window */ /* Order is bottom up */ -+ my_panels[0] = new_panel(my_wins[0]); /* Push 0, order: stdscr-0 */ -+ my_panels[1] = new_panel(my_wins[1]); /* Push 1, order: stdscr-0-1 */ -+ my_panels[2] = new_panel(my_wins[2]); /* Push 2, order: stdscr-0-1-2 */ -+ -+ /* Initialize panel datas saying that nothing is hidden */ -+ panel_datas[0].hide = FALSE; -+ panel_datas[1].hide = FALSE; -+ panel_datas[2].hide = FALSE; -+ -+ set_panel_userptr(my_panels[0], &#38;panel_datas[0]); -+ set_panel_userptr(my_panels[1], &#38;panel_datas[1]); -+ set_panel_userptr(my_panels[2], &#38;panel_datas[2]); -+ -+ /* Update the stacking order. 2nd panel will be on top */ -+ update_panels(); -+ -+ /* Show it on the screen */ -+ attron(COLOR_PAIR(4)); -+ mvprintw(LINES - 3, 0, "Show or Hide a window with 'a'(first window) 'b'(Second Window) 'c'(Third Window)"); -+ mvprintw(LINES - 2, 0, "F1 to Exit"); -+ -+ attroff(COLOR_PAIR(4)); -+ doupdate(); -+ -+ while((ch = getch()) != KEY_F(1)) -+ { switch(ch) -+ { case 'a': -+ temp = (PANEL_DATA *)panel_userptr(my_panels[0]); -+ if(temp-&#62;hide == FALSE) -+ { hide_panel(my_panels[0]); -+ temp-&#62;hide = TRUE; -+ } -+ else -+ { show_panel(my_panels[0]); -+ temp-&#62;hide = FALSE; -+ } -+ break; -+ case 'b': -+ temp = (PANEL_DATA *)panel_userptr(my_panels[1]); -+ if(temp-&#62;hide == FALSE) -+ { hide_panel(my_panels[1]); -+ temp-&#62;hide = TRUE; -+ } -+ else -+ { show_panel(my_panels[1]); -+ temp-&#62;hide = FALSE; -+ } -+ break; -+ case 'c': -+ temp = (PANEL_DATA *)panel_userptr(my_panels[2]); -+ if(temp-&#62;hide == FALSE) -+ { hide_panel(my_panels[2]); -+ temp-&#62;hide = TRUE; -+ } -+ else -+ { show_panel(my_panels[2]); -+ temp-&#62;hide = FALSE; -+ } -+ break; -+ } -+ update_panels(); -+ doupdate(); -+ } -+ endwin(); -+ return 0; - } - - /* Put all the windows */ - void init_wins(WINDOW **wins, int n) --{ int x, y, i; -- char label[80]; -+{ int x, y, i; -+ char label[80]; - -- y = 2; -- x = 10; -- for(i = 0; i &lt; n; ++i) -- { wins[i] = newwin(NLINES, NCOLS, y, x); -- sprintf(label, "Window Number %d", i + 1); -- win_show(wins[i], label, i + 1); -- y += 3; -- x += 7; -- } -+ y = 2; -+ x = 10; -+ for(i = 0; i &#60; n; ++i) -+ { wins[i] = newwin(NLINES, NCOLS, y, x); -+ sprintf(label, "Window Number %d", i + 1); -+ win_show(wins[i], label, i + 1); -+ y += 3; -+ x += 7; -+ } - } - - /* Show the window with a border and a label */ - void win_show(WINDOW *win, char *label, int label_color) --{ int startx, starty, height, width; -+{ int startx, starty, height, width; - -- getbegyx(win, starty, startx); -- getmaxyx(win, height, width); -+ getbegyx(win, starty, startx); -+ getmaxyx(win, height, width); - -- box(win, 0, 0); -- mvwaddch(win, 2, 0, ACS_LTEE); -- mvwhline(win, 2, 1, ACS_HLINE, width - 2); -- mvwaddch(win, 2, width - 1, ACS_RTEE); -- -- print_in_middle(win, 1, 0, width, label, COLOR_PAIR(label_color)); -+ box(win, 0, 0); -+ mvwaddch(win, 2, 0, ACS_LTEE); -+ mvwhline(win, 2, 1, ACS_HLINE, width - 2); -+ mvwaddch(win, 2, width - 1, ACS_RTEE); -+ -+ print_in_middle(win, 1, 0, width, label, COLOR_PAIR(label_color)); - } - - void print_in_middle(WINDOW *win, int starty, int startx, int width, char *string, chtype color) --{ int length, x, y; -- float temp; -+{ int length, x, y; -+ float temp; - -- if(win == NULL) -- win = stdscr; -- getyx(win, y, x); -- if(startx != 0) -- x = startx; -- if(starty != 0) -- y = starty; -- if(width == 0) -- width = 80; -- -- length = strlen(string); -- temp = (width - length)/ 2; -- x = startx + (int)temp; -- wattron(win, color); -- mvwprintw(win, y, x, "%s", string); -- wattroff(win, color); -- refresh(); --}</span></font> --</pre></td> --</tr> --</table> --</div> --</div> --<div class="SECT2"> --<hr> --<h3 class="SECT2"><a name="PANELABOVE" id="PANELABOVE">16.7. --panel_above() and panel_below() Functions</a></h3> --<p>The functions <var class="LITERAL">panel_above()</var> and --<var class="LITERAL">panel_below()</var> can be used to find out --the panel above and below a panel. If the argument to these --functions is NULL, then they return a pointer to bottom panel and --top panel respectively.</p> --</div> --</div> --<div class="SECT1"> --<hr> --<h2 class="SECT1"><a name="MENUS" id="MENUS">17. Menus --Library</a></h2> --<p>The menus library provides a nice extension to basic curses, --through which you can create menus. It provides a set of functions --to create menus. But they have to be customized to give a nicer --look, with colors etc. Let's get into the details.</p> --<p>A menu is a screen display that assists the user to choose some --subset of a given set of items. To put it simple, a menu is a --collection of items from which one or more items can be chosen. --Some readers might not be aware of multiple item selection --capability. Menu library provides functionality to write menus from --which the user can chose more than one item as the preferred --choice. This is dealt with in a later section. Now it is time for --some rudiments.</p> --<div class="SECT2"> --<hr> --<h3 class="SECT2"><a name="MENUBASICS" id="MENUBASICS">17.1. The --Basics</a></h3> --<p>To create menus, you first create items, and then post the menu --to the display. After that, all the processing of user responses is --done in an elegant function menu_driver() which is the work horse --of any menu program.</p> --<p>The general flow of control of a menu program looks like --this.</p> --<ol type="1"> --<li> --<p>Initialize curses</p> --</li> --<li> --<p>Create items using new_item(). You can specify a name and --description for the items.</p> --</li> --<li> --<p>Create the menu with new_menu() by specifying the items to be --attached with.</p> --</li> --<li> --<p>Post the menu with menu_post() and refresh the screen.</p> --</li> --<li> --<p>Process the user requests with a loop and do necessary updates --to menu with menu_driver.</p> --</li> --<li> --<p>Unpost the menu with menu_unpost()</p> --</li> --<li> --<p>Free the memory allocated to menu by free_menu()</p> --</li> --<li> --<p>Free the memory allocated to the items with free_item()</p> --</li> --<li> --<p>End curses</p> --</li> --</ol> --<p>Let's see a program which prints a simple menu and updates the --current selection with up, down arrows.</p> --</div> --<div class="SECT2"> --<hr> --<h3 class="SECT2"><a name="COMPILEMENUS" id="COMPILEMENUS">17.2. --Compiling With the Menu Library</a></h3> --<p>To use menu library functions, you have to include menu.h and to --link the program with menu library the flag -lmenu should be added --along with -lncurses in that order.</p> --<table border="0" bgcolor="#E0E0E0" width="100%"> --<tr> --<td> --<pre class="PROGRAMLISTING"> --<font color="#000000"> #include &lt;menu.h&gt; -+ if(win == NULL) -+ win = stdscr; -+ getyx(win, y, x); -+ if(startx != 0) -+ x = startx; -+ if(starty != 0) -+ y = starty; -+ if(width == 0) -+ width = 80; -+ -+ length = strlen(string); -+ temp = (width - length)/ 2; -+ x = startx + (int)temp; -+ wattron(win, color); -+ mvwprintw(win, y, x, "%s", string); -+ wattroff(win, color); -+ refresh(); -+}</SPAN -+></PRE -+></DIV -+></DIV -+><DIV -+CLASS="SECT2" -+><HR><H3 -+CLASS="SECT2" -+><A -+NAME="PANELABOVE" -+>16.7. panel_above() and panel_below() Functions</A -+></H3 -+><P -+>The functions <TT -+CLASS="LITERAL" -+>panel_above()</TT -+> and -+<TT -+CLASS="LITERAL" -+>panel_below()</TT -+> can be used to find out the panel -+above and below a panel. If the argument to these functions is NULL, then they -+return a pointer to bottom panel and top panel respectively.</P -+></DIV -+></DIV -+><DIV -+CLASS="SECT1" -+><HR><H2 -+CLASS="SECT1" -+><A -+NAME="MENUS" -+>17. Menus Library</A -+></H2 -+><P -+>The menus library provides a nice extension to basic curses, through which you -+can create menus. It provides a set of functions to create menus. But they have -+to be customized to give a nicer look, with colors etc. Let's get into the -+details.</P -+><P -+>A menu is a screen display that assists the user to choose some subset of a -+given set of items. To put it simple, a menu is a collection of items from which -+one or more items can be chosen. Some readers might not be aware of multiple -+item selection capability. Menu library provides functionality to write menus -+from which the user can chose more than one item as the preferred choice. This -+is dealt with in a later section. Now it is time for some rudiments.</P -+><DIV -+CLASS="SECT2" -+><HR><H3 -+CLASS="SECT2" -+><A -+NAME="MENUBASICS" -+>17.1. The Basics</A -+></H3 -+><P -+>To create menus, you first create items, and then post the menu to the display. -+After that, all the processing of user responses is done in an elegant function -+menu_driver() which is the work horse of any menu program. </P -+><P -+>The general flow of control of a menu program looks like this. -+<P -+></P -+><OL -+TYPE="1" -+><LI -+><P -+>Initialize curses</P -+></LI -+><LI -+><P -+>Create items using new_item(). You can specify a name and description for the -+items.</P -+></LI -+><LI -+><P -+>Create the menu with new_menu() by specifying the items to be attached with.</P -+></LI -+><LI -+><P -+>Post the menu with menu_post() and refresh the screen.</P -+></LI -+><LI -+><P -+>Process the user requests with a loop and do necessary updates to menu with -+menu_driver.</P -+></LI -+><LI -+><P -+>Unpost the menu with menu_unpost()</P -+></LI -+><LI -+><P -+>Free the memory allocated to menu by free_menu()</P -+></LI -+><LI -+><P -+>Free the memory allocated to the items with free_item() </P -+></LI -+><LI -+><P -+>End curses </P -+></LI -+></OL -+></P -+><P -+>Let's see a program which prints a simple menu and updates the current selection -+with up, down arrows. </P -+></DIV -+><DIV -+CLASS="SECT2" -+><HR><H3 -+CLASS="SECT2" -+><A -+NAME="COMPILEMENUS" -+>17.2. Compiling With the Menu Library</A -+></H3 -+><P -+>To use menu library functions, you have to include menu.h and to link the -+program with menu library the flag -lmenu should be added along with -lncurses -+in that order.</P -+><PRE -+CLASS="PROGRAMLISTING" -+> #include &lt;menu.h&gt; - . - . - . - -- compile and link: gcc &lt;program file&gt; -lmenu -lncurses</font> --</pre></td> --</tr> --</table> --<div class="EXAMPLE"><a name="MMESI" id="MMESI"></a> --<p><b>Example 18. Menu Basics</b></p> --<table border="0" bgcolor="#E0E0E0" width="100%"> --<tr> --<td> --<pre class="PROGRAMLISTING"> --<font color="#000000"><span class= --"INLINEMEDIAOBJECT">#include &lt;curses.h&gt; --#include &lt;menu.h&gt; -+ compile and link: gcc &lt;program file&gt; -lmenu -lncurses</PRE -+><DIV -+CLASS="EXAMPLE" -+><A -+NAME="MMESI" -+></A -+><P -+><B -+>Example 18. Menu Basics </B -+></P -+><PRE -+CLASS="PROGRAMLISTING" -+><SPAN -+CLASS="INLINEMEDIAOBJECT" -+>#include &#60;curses.h&#62; -+#include &#60;menu.h&#62; - - #define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0])) --#define CTRLD 4 -+#define CTRLD 4 - - char *choices[] = { - "Choice 1", -@@ -3691,69 +5206,64 @@ - }; - - int main() --{ ITEM **my_items; -- int c; -- MENU *my_menu; -- int n_choices, i; -- ITEM *cur_item; -- -- -- initscr(); -- cbreak(); -- noecho(); -- keypad(stdscr, TRUE); -- -- n_choices = ARRAY_SIZE(choices); -- my_items = (ITEM **)calloc(n_choices + 1, sizeof(ITEM *)); -- -- for(i = 0; i &lt; n_choices; ++i) -- my_items[i] = new_item(choices[i], choices[i]); -- my_items[n_choices] = (ITEM *)NULL; -- -- my_menu = new_menu((ITEM **)my_items); -- mvprintw(LINES - 2, 0, "F1 to Exit"); -- post_menu(my_menu); -- refresh(); -- -- while((c = getch()) != KEY_F(1)) -- { switch(c) -- { case KEY_DOWN: -- menu_driver(my_menu, REQ_DOWN_ITEM); -- break; -- case KEY_UP: -- menu_driver(my_menu, REQ_UP_ITEM); -- break; -- } -- } -- -- free_item(my_items[0]); -- free_item(my_items[1]); -- free_menu(my_menu); -- endwin(); -+{ ITEM **my_items; -+ int c; -+ MENU *my_menu; -+ int n_choices, i; -+ ITEM *cur_item; -+ -+ -+ initscr(); -+ cbreak(); -+ noecho(); -+ keypad(stdscr, TRUE); -+ -+ n_choices = ARRAY_SIZE(choices); -+ my_items = (ITEM **)calloc(n_choices + 1, sizeof(ITEM *)); -+ -+ for(i = 0; i &#60; n_choices; ++i) -+ my_items[i] = new_item(choices[i], choices[i]); -+ my_items[n_choices] = (ITEM *)NULL; -+ -+ my_menu = new_menu((ITEM **)my_items); -+ mvprintw(LINES - 2, 0, "F1 to Exit"); -+ post_menu(my_menu); -+ refresh(); -+ -+ while((c = getch()) != KEY_F(1)) -+ { switch(c) -+ { case KEY_DOWN: -+ menu_driver(my_menu, REQ_DOWN_ITEM); -+ break; -+ case KEY_UP: -+ menu_driver(my_menu, REQ_UP_ITEM); -+ break; -+ } -+ } -+ -+ free_item(my_items[0]); -+ free_item(my_items[1]); -+ free_menu(my_menu); -+ endwin(); - } -- </span></font> --</pre></td> --</tr> --</table> --</div> --<p>This program demonstrates the basic concepts involved in --creating a menu using menus library. First we create the items --using new_item() and then attach them to the menu with new_menu() --function. After posting the menu and refreshing the screen, the --main processing loop starts. It reads user input and takes --corresponding action. The function menu_driver() is the main work --horse of the menu system. The second parameter to this function --tells what's to be done with the menu. According to the parameter, --menu_driver() does the corresponding task. The value can be either --a menu navigational request, an ascii character, or a KEY_MOUSE --special key associated with a mouse event.</p> --<p>The menu_driver accepts following navigational requests.</p> --<table border="0" bgcolor="#E0E0E0" width="100%"> --<tr> --<td> --<pre class="PROGRAMLISTING"> --<font color= --"#000000">&#13; REQ_LEFT_ITEM Move left to an item. -+ </SPAN -+></PRE -+></DIV -+><P -+>This program demonstrates the basic concepts involved in creating a menu using -+menus library. First we create the items using new_item() and then attach them -+to the menu with new_menu() function. After posting the menu and refreshing the -+screen, the main processing loop starts. It reads user input and takes -+corresponding action. The function menu_driver() is the main work horse of the -+menu system. The second parameter to this function tells what's to be done with -+the menu. According to the parameter, menu_driver() does the corresponding task. -+The value can be either a menu navigational request, an ascii character, or a -+KEY_MOUSE special key associated with a mouse event.</P -+><P -+>The menu_driver accepts following navigational requests. -+<PRE -+CLASS="PROGRAMLISTING" -+>&#13; REQ_LEFT_ITEM Move left to an item. - REQ_RIGHT_ITEM Move right to an item. - REQ_UP_ITEM Move up to an item. - REQ_DOWN_ITEM Move down to an item. -@@ -3769,87 +5279,144 @@ - REQ_CLEAR_PATTERN Clear the menu pattern buffer. - REQ_BACK_PATTERN Delete the previous character from the pattern buffer. - REQ_NEXT_MATCH Move to the next item matching the pattern match. -- REQ_PREV_MATCH Move to the previous item matching the pattern match.&#13;</font> --</pre></td> --</tr> --</table> --<p>Don't get overwhelmed by the number of options. We will see them --slowly one after another. The options of interest in this example --are REQ_UP_ITEM and REQ_DOWN_ITEM. These two options when passed to --menu_driver, menu driver updates the current item to one item up or --down respectively.</p> --</div> --<div class="SECT2"> --<hr> --<h3 class="SECT2"><a name="MENUDRIVER" id="MENUDRIVER">17.3. Menu --Driver: The work horse of the menu system</a></h3> --<p>As you have seen in the above example, menu_driver plays an --important role in updating the menu. It is very important to --understand various options it takes and what they do. As explained --above, the second parameter to menu_driver() can be either a --navigational request, a printable character or a KEY_MOUSE key. --Let's dissect the different navigational requests.</p> --<ul> --<li> --<p><em>REQ_LEFT_ITEM and REQ_RIGHT_ITEM</em></p> --<p>A Menu can be displayed with multiple columns for more than one --item. This can be done by using the <var class= --"LITERAL">menu_format()</var>function. When a multi columnar menu --is displayed these requests cause the menu driver to move the --current selection to left or right.</p> --</li> --<li> --<p><em>REQ_UP_ITEM and REQ_DOWN_ITEM</em></p> --<p>These two options you have seen in the above example. These --options when given, makes the menu_driver to move the current --selection to an item up or down.</p> --</li> --<li> --<p><em>REQ_SCR_* options</em></p> --<p>The four options REQ_SCR_ULINE, REQ_SCR_DLINE, REQ_SCR_DPAGE, --REQ_SCR_UPAGE are related to scrolling. If all the items in the --menu cannot be displayed in the menu sub window, then the menu is --scrollable. These requests can be given to the menu_driver to do --the scrolling either one line up, down or one page down or up --respectively.</p> --</li> --<li> --<p><em>REQ_FIRST_ITEM, REQ_LAST_ITEM, REQ_NEXT_ITEM and --REQ_PREV_ITEM</em></p> --<p>These requests are self explanatory.</p> --</li> --<li> --<p><em>REQ_TOGGLE_ITEM</em></p> --<p>This request when given, toggles the present selection. This --option is to be used only in a multi valued menu. So to use this --request the option O_ONEVALUE must be off. This option can be made --off or on with set_menu_opts().</p> --</li> --<li> --<p><em>Pattern Requests</em></p> --<p>Every menu has an associated pattern buffer, which is used to --find the nearest match to the ascii characters entered by the user. --Whenever ascii characters are given to menu_driver, it puts in to --the pattern buffer. It also tries to find the nearest match to the --pattern in the items list and moves current selection to that item. --The request REQ_CLEAR_PATTERN clears the pattern buffer. The --request REQ_BACK_PATTERN deletes the previous character in the --pattern buffer. In case the pattern matches more than one item then --the matched items can be cycled through REQ_NEXT_MATCH and --REQ_PREV_MATCH which move the current selection to the next and --previous matches respectively.</p> --</li> --<li> --<p><em>Mouse Requests</em></p> --<p>In case of KEY_MOUSE requests, according to the mouse position --an action is taken accordingly. The action to be taken is explained --in the man page as,</p> --<table border="0" bgcolor="#E0E0E0" width="90%"> --<tr> --<td> --<pre class="PROGRAMLISTING"> --<font color= --"#000000"><em> If the second argument is the KEY_MOUSE special key, the -+ REQ_PREV_MATCH Move to the previous item matching the pattern match.&#13;</PRE -+></P -+><P -+>Don't get overwhelmed by the number of options. We will see them slowly one -+after another. The options of interest in this example are REQ_UP_ITEM and -+REQ_DOWN_ITEM. These two options when passed to menu_driver, menu driver -+updates the current item to one item up or down respectively.</P -+></DIV -+><DIV -+CLASS="SECT2" -+><HR><H3 -+CLASS="SECT2" -+><A -+NAME="MENUDRIVER" -+>17.3. Menu Driver: The work horse of the menu system</A -+></H3 -+><P -+>As you have seen in the above example, menu_driver plays an important role in -+updating the menu. It is very important to understand various options it takes -+and what they do. As explained above, the second parameter to menu_driver() can -+be either a navigational request, a printable character or a KEY_MOUSE key. -+Let's dissect the different navigational requests.</P -+><P -+></P -+><UL -+><LI -+><P -+><SPAN -+CLASS="emphasis" -+><I -+CLASS="EMPHASIS" -+>REQ_LEFT_ITEM and REQ_RIGHT_ITEM</I -+></SPAN -+></P -+><P -+>A Menu can be displayed with multiple columns for more than one item. This can -+be done by using the <TT -+CLASS="LITERAL" -+>menu_format()</TT -+>function. -+When a multi columnar menu is displayed these requests cause the menu driver to -+move the current selection to left or right.</P -+></LI -+><LI -+><P -+><SPAN -+CLASS="emphasis" -+><I -+CLASS="EMPHASIS" -+>REQ_UP_ITEM and REQ_DOWN_ITEM </I -+></SPAN -+> </P -+><P -+>These two options you have seen in the above example. These options when given, -+makes the menu_driver to move the current selection to an item up or down.</P -+></LI -+><LI -+><P -+> <SPAN -+CLASS="emphasis" -+><I -+CLASS="EMPHASIS" -+>REQ_SCR_* options</I -+></SPAN -+> </P -+><P -+>The four options REQ_SCR_ULINE, REQ_SCR_DLINE, REQ_SCR_DPAGE, REQ_SCR_UPAGE are -+related to scrolling. If all the items in the menu cannot be displayed in the -+menu sub window, then the menu is scrollable. These requests can be given to the -+menu_driver to do the scrolling either one line up, down or one page down or up -+respectively. </P -+></LI -+><LI -+><P -+><SPAN -+CLASS="emphasis" -+><I -+CLASS="EMPHASIS" -+>REQ_FIRST_ITEM, REQ_LAST_ITEM, REQ_NEXT_ITEM and -+REQ_PREV_ITEM </I -+></SPAN -+> </P -+><P -+>These requests are self explanatory.</P -+></LI -+><LI -+><P -+> <SPAN -+CLASS="emphasis" -+><I -+CLASS="EMPHASIS" -+>REQ_TOGGLE_ITEM</I -+></SPAN -+> </P -+><P -+>This request when given, toggles the present selection. This option is to be -+used only in a multi valued menu. So to use this request the option O_ONEVALUE -+must be off. This option can be made off or on with set_menu_opts().</P -+></LI -+><LI -+><P -+> <SPAN -+CLASS="emphasis" -+><I -+CLASS="EMPHASIS" -+>Pattern Requests </I -+></SPAN -+></P -+><P -+>Every menu has an associated pattern buffer, which is used to find the nearest -+match to the ascii characters entered by the user. Whenever ascii characters are -+given to menu_driver, it puts in to the pattern buffer. It also tries to find -+the nearest match to the pattern in the items list and moves current selection -+to that item. The request REQ_CLEAR_PATTERN clears the pattern buffer. The -+request REQ_BACK_PATTERN deletes the previous character in the pattern buffer. -+In case the pattern matches more than one item then the matched items can be -+cycled through REQ_NEXT_MATCH and REQ_PREV_MATCH which move the current -+selection to the next and previous matches respectively.</P -+></LI -+><LI -+><P -+> <SPAN -+CLASS="emphasis" -+><I -+CLASS="EMPHASIS" -+>Mouse Requests</I -+></SPAN -+></P -+><P -+>In case of KEY_MOUSE requests, according to the mouse position an action is -+taken accordingly. The action to be taken is explained in the man page as, </P -+><PRE -+CLASS="PROGRAMLISTING" -+><SPAN -+CLASS="emphasis" -+><I -+CLASS="EMPHASIS" -+> If the second argument is the KEY_MOUSE special key, the - associated mouse event is translated into one of the above - pre-defined requests. Currently only clicks in the user - window (e.g. inside the menu display area or the decora&shy; -@@ -3861,39 +5428,49 @@ - generated, if you doubleclick a REQ_SCR_DPAGE is generated - and if you tripleclick a REQ_LAST_ITEM is generated. If - you click at an item inside the display area of the menu, -- the menu cursor is positioned to that item.</em></font> --</pre></td> --</tr> --</table> --</li> --</ul> --<p>Each of the above requests will be explained in the following --lines with several examples whenever appropriate.</p> --</div> --<div class="SECT2"> --<hr> --<h3 class="SECT2"><a name="MENUWINDOWS" id="MENUWINDOWS">17.4. Menu --Windows</a></h3> --<p>Every menu created is associated with a window and a sub window. --The menu window displays any title or border associated with the --menu. The menu sub window displays the menu items currently --available for selection. But we didn't specify any window or sub --window in the simple example. When a window is not specified, --stdscr is taken as the main window, and then menu system calculates --the sub window size required for the display of items. Then items --are displayed in the calculated sub window. So let's play with --these windows and display a menu with a border and a title.</p> --<div class="EXAMPLE"><a name="MMEWI" id="MMEWI"></a> --<p><b>Example 19. Menu Windows Usage example</b></p> --<table border="0" bgcolor="#E0E0E0" width="100%"> --<tr> --<td> --<pre class="PROGRAMLISTING"> --<font color="#000000"><span class= --"INLINEMEDIAOBJECT">#include &lt;menu.h&gt; -+ the menu cursor is positioned to that item.</I -+></SPAN -+></PRE -+></LI -+></UL -+><P -+>Each of the above requests will be explained in the following lines with several -+examples whenever appropriate.</P -+></DIV -+><DIV -+CLASS="SECT2" -+><HR><H3 -+CLASS="SECT2" -+><A -+NAME="MENUWINDOWS" -+>17.4. Menu Windows</A -+></H3 -+><P -+>Every menu created is associated with a window and a sub window. The menu window -+displays any title or border associated with the menu. The menu sub window -+displays the menu items currently available for selection. But we didn't specify -+any window or sub window in the simple example. When a window is not specified, -+stdscr is taken as the main window, and then menu system calculates the sub -+window size required for the display of items. Then items are displayed in the -+calculated sub window. So let's play with these windows and display a menu with -+a border and a title.</P -+><DIV -+CLASS="EXAMPLE" -+><A -+NAME="MMEWI" -+></A -+><P -+><B -+>Example 19. Menu Windows Usage example </B -+></P -+><PRE -+CLASS="PROGRAMLISTING" -+><SPAN -+CLASS="INLINEMEDIAOBJECT" -+>#include &#60;menu.h&#62; - - #define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0])) --#define CTRLD 4 -+#define CTRLD 4 - - char *choices[] = { - "Choice 1", -@@ -3906,392 +5483,403 @@ - void print_in_middle(WINDOW *win, int starty, int startx, int width, char *string, chtype color); - - int main() --{ ITEM **my_items; -- int c; -- MENU *my_menu; -+{ ITEM **my_items; -+ int c; -+ MENU *my_menu; - WINDOW *my_menu_win; - int n_choices, i; -- -- /* Initialize curses */ -- initscr(); -- start_color(); -+ -+ /* Initialize curses */ -+ initscr(); -+ start_color(); - cbreak(); - noecho(); -- keypad(stdscr, TRUE); -- init_pair(1, COLOR_RED, COLOR_BLACK); -+ keypad(stdscr, TRUE); -+ init_pair(1, COLOR_RED, COLOR_BLACK); - -- /* Create items */ -+ /* Create items */ - n_choices = ARRAY_SIZE(choices); - my_items = (ITEM **)calloc(n_choices, sizeof(ITEM *)); -- for(i = 0; i &lt; n_choices; ++i) -+ for(i = 0; i &#60; n_choices; ++i) - my_items[i] = new_item(choices[i], choices[i]); - -- /* Crate menu */ -- my_menu = new_menu((ITEM **)my_items); -+ /* Crate menu */ -+ my_menu = new_menu((ITEM **)my_items); - -- /* Create the window to be associated with the menu */ -+ /* Create the window to be associated with the menu */ - my_menu_win = newwin(10, 40, 4, 4); - keypad(my_menu_win, TRUE); - -- /* Set main window and sub window */ -+ /* Set main window and sub window */ - set_menu_win(my_menu, my_menu_win); - set_menu_sub(my_menu, derwin(my_menu_win, 6, 38, 3, 1)); - -- /* Set menu mark to the string " * " */ -+ /* Set menu mark to the string " * " */ - set_menu_mark(my_menu, " * "); - -- /* Print a border around the main window and print a title */ -+ /* Print a border around the main window and print a title */ - box(my_menu_win, 0, 0); -- print_in_middle(my_menu_win, 1, 0, 40, "My Menu", COLOR_PAIR(1)); -- mvwaddch(my_menu_win, 2, 0, ACS_LTEE); -- mvwhline(my_menu_win, 2, 1, ACS_HLINE, 38); -- mvwaddch(my_menu_win, 2, 39, ACS_RTEE); -- mvprintw(LINES - 2, 0, "F1 to exit"); -- refresh(); -+ print_in_middle(my_menu_win, 1, 0, 40, "My Menu", COLOR_PAIR(1)); -+ mvwaddch(my_menu_win, 2, 0, ACS_LTEE); -+ mvwhline(my_menu_win, 2, 1, ACS_HLINE, 38); -+ mvwaddch(my_menu_win, 2, 39, ACS_RTEE); -+ mvprintw(LINES - 2, 0, "F1 to exit"); -+ refresh(); - -- /* Post the menu */ -- post_menu(my_menu); -- wrefresh(my_menu_win); -- -- while((c = wgetch(my_menu_win)) != KEY_F(1)) -- { switch(c) -- { case KEY_DOWN: -- menu_driver(my_menu, REQ_DOWN_ITEM); -- break; -- case KEY_UP: -- menu_driver(my_menu, REQ_UP_ITEM); -- break; -- } -+ /* Post the menu */ -+ post_menu(my_menu); -+ wrefresh(my_menu_win); -+ -+ while((c = wgetch(my_menu_win)) != KEY_F(1)) -+ { switch(c) -+ { case KEY_DOWN: -+ menu_driver(my_menu, REQ_DOWN_ITEM); -+ break; -+ case KEY_UP: -+ menu_driver(my_menu, REQ_UP_ITEM); -+ break; -+ } - wrefresh(my_menu_win); -- } -+ } - -- /* Unpost and free all the memory taken up */ -+ /* Unpost and free all the memory taken up */ - unpost_menu(my_menu); - free_menu(my_menu); -- for(i = 0; i &lt; n_choices; ++i) -+ for(i = 0; i &#60; n_choices; ++i) - free_item(my_items[i]); -- endwin(); -+ endwin(); - } - - void print_in_middle(WINDOW *win, int starty, int startx, int width, char *string, chtype color) --{ int length, x, y; -- float temp; -+{ int length, x, y; -+ float temp; - -- if(win == NULL) -- win = stdscr; -- getyx(win, y, x); -- if(startx != 0) -- x = startx; -- if(starty != 0) -- y = starty; -- if(width == 0) -- width = 80; -- -- length = strlen(string); -- temp = (width - length)/ 2; -- x = startx + (int)temp; -- wattron(win, color); -- mvwprintw(win, y, x, "%s", string); -- wattroff(win, color); -- refresh(); --}</span></font> --</pre></td> --</tr> --</table> --</div> --<p>This example creates a menu with a title, border, a fancy line --separating title and the items. As you can see, in order to attach --a window to a menu the function set_menu_win() has to be used. Then --we attach the sub window also. This displays the items in the sub --window. You can also set the mark string which gets displayed to --the left of the selected item with set_menu_mark().</p> --</div> --<div class="SECT2"> --<hr> --<h3 class="SECT2"><a name="SCROLLMENUS" id="SCROLLMENUS">17.5. --Scrolling Menus</a></h3> --<p>If the sub window given for a window is not big enough to show --all the items, then the menu will be scrollable. When you are on --the last item in the present list, if you send REQ_DOWN_ITEM, it --gets translated into REQ_SCR_DLINE and the menu scrolls by one --item. You can manually give REQ_SCR_ operations to do scrolling. --Let's see how it can be done.</p> --<div class="EXAMPLE"><a name="MMESC" id="MMESC"></a> --<p><b>Example 20. Scrolling Menus example</b></p> --<table border="0" bgcolor="#E0E0E0" width="100%"> --<tr> --<td> --<pre class="PROGRAMLISTING"> --<font color="#000000"><span class= --"INLINEMEDIAOBJECT">#include &lt;curses.h&gt; --#include &lt;menu.h&gt; -+ if(win == NULL) -+ win = stdscr; -+ getyx(win, y, x); -+ if(startx != 0) -+ x = startx; -+ if(starty != 0) -+ y = starty; -+ if(width == 0) -+ width = 80; -+ -+ length = strlen(string); -+ temp = (width - length)/ 2; -+ x = startx + (int)temp; -+ wattron(win, color); -+ mvwprintw(win, y, x, "%s", string); -+ wattroff(win, color); -+ refresh(); -+}</SPAN -+></PRE -+></DIV -+><P -+>This example creates a menu with a title, border, a fancy line separating title -+and the items. As you can see, in order to attach a window to a menu the -+function set_menu_win() has to be used. Then we attach the sub window also. This -+displays the items in the sub window. You can also set the mark string which -+gets displayed to the left of the selected item with set_menu_mark().</P -+></DIV -+><DIV -+CLASS="SECT2" -+><HR><H3 -+CLASS="SECT2" -+><A -+NAME="SCROLLMENUS" -+>17.5. Scrolling Menus</A -+></H3 -+><P -+>If the sub window given for a window is not big enough to show all the items, -+then the menu will be scrollable. When you are on the last item in the present -+list, if you send REQ_DOWN_ITEM, it gets translated into REQ_SCR_DLINE and the -+menu scrolls by one item. You can manually give REQ_SCR_ operations to do -+scrolling. Let's see how it can be done.</P -+><DIV -+CLASS="EXAMPLE" -+><A -+NAME="MMESC" -+></A -+><P -+><B -+>Example 20. Scrolling Menus example </B -+></P -+><PRE -+CLASS="PROGRAMLISTING" -+><SPAN -+CLASS="INLINEMEDIAOBJECT" -+>#include &#60;curses.h&#62; -+#include &#60;menu.h&#62; - - #define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0])) --#define CTRLD 4 -+#define CTRLD 4 - - char *choices[] = { - "Choice 1", - "Choice 2", - "Choice 3", - "Choice 4", -- "Choice 5", -- "Choice 6", -- "Choice 7", -- "Choice 8", -- "Choice 9", -- "Choice 10", -+ "Choice 5", -+ "Choice 6", -+ "Choice 7", -+ "Choice 8", -+ "Choice 9", -+ "Choice 10", - "Exit", - (char *)NULL, - }; - void print_in_middle(WINDOW *win, int starty, int startx, int width, char *string, chtype color); - - int main() --{ ITEM **my_items; -- int c; -- MENU *my_menu; -+{ ITEM **my_items; -+ int c; -+ MENU *my_menu; - WINDOW *my_menu_win; - int n_choices, i; -- -- /* Initialize curses */ -- initscr(); -- start_color(); -+ -+ /* Initialize curses */ -+ initscr(); -+ start_color(); - cbreak(); - noecho(); -- keypad(stdscr, TRUE); -- init_pair(1, COLOR_RED, COLOR_BLACK); -- init_pair(2, COLOR_CYAN, COLOR_BLACK); -+ keypad(stdscr, TRUE); -+ init_pair(1, COLOR_RED, COLOR_BLACK); -+ init_pair(2, COLOR_CYAN, COLOR_BLACK); - -- /* Create items */ -+ /* Create items */ - n_choices = ARRAY_SIZE(choices); - my_items = (ITEM **)calloc(n_choices, sizeof(ITEM *)); -- for(i = 0; i &lt; n_choices; ++i) -+ for(i = 0; i &#60; n_choices; ++i) - my_items[i] = new_item(choices[i], choices[i]); - -- /* Crate menu */ -- my_menu = new_menu((ITEM **)my_items); -+ /* Crate menu */ -+ my_menu = new_menu((ITEM **)my_items); - -- /* Create the window to be associated with the menu */ -+ /* Create the window to be associated with the menu */ - my_menu_win = newwin(10, 40, 4, 4); - keypad(my_menu_win, TRUE); - -- /* Set main window and sub window */ -+ /* Set main window and sub window */ - set_menu_win(my_menu, my_menu_win); - set_menu_sub(my_menu, derwin(my_menu_win, 6, 38, 3, 1)); -- set_menu_format(my_menu, 5, 1); -- -- /* Set menu mark to the string " * " */ -+ set_menu_format(my_menu, 5, 1); -+ -+ /* Set menu mark to the string " * " */ - set_menu_mark(my_menu, " * "); - -- /* Print a border around the main window and print a title */ -+ /* Print a border around the main window and print a title */ - box(my_menu_win, 0, 0); -- print_in_middle(my_menu_win, 1, 0, 40, "My Menu", COLOR_PAIR(1)); -- mvwaddch(my_menu_win, 2, 0, ACS_LTEE); -- mvwhline(my_menu_win, 2, 1, ACS_HLINE, 38); -- mvwaddch(my_menu_win, 2, 39, ACS_RTEE); -+ print_in_middle(my_menu_win, 1, 0, 40, "My Menu", COLOR_PAIR(1)); -+ mvwaddch(my_menu_win, 2, 0, ACS_LTEE); -+ mvwhline(my_menu_win, 2, 1, ACS_HLINE, 38); -+ mvwaddch(my_menu_win, 2, 39, ACS_RTEE); - -- /* Post the menu */ -- post_menu(my_menu); -- wrefresh(my_menu_win); -- -- attron(COLOR_PAIR(2)); -- mvprintw(LINES - 2, 0, "Use PageUp and PageDown to scoll down or up a page of items"); -- mvprintw(LINES - 1, 0, "Arrow Keys to navigate (F1 to Exit)"); -- attroff(COLOR_PAIR(2)); -- refresh(); -- -- while((c = wgetch(my_menu_win)) != KEY_F(1)) -- { switch(c) -- { case KEY_DOWN: -- menu_driver(my_menu, REQ_DOWN_ITEM); -- break; -- case KEY_UP: -- menu_driver(my_menu, REQ_UP_ITEM); -- break; -- case KEY_NPAGE: -- menu_driver(my_menu, REQ_SCR_DPAGE); -- break; -- case KEY_PPAGE: -- menu_driver(my_menu, REQ_SCR_UPAGE); -- break; -- } -+ /* Post the menu */ -+ post_menu(my_menu); -+ wrefresh(my_menu_win); -+ -+ attron(COLOR_PAIR(2)); -+ mvprintw(LINES - 2, 0, "Use PageUp and PageDown to scoll down or up a page of items"); -+ mvprintw(LINES - 1, 0, "Arrow Keys to navigate (F1 to Exit)"); -+ attroff(COLOR_PAIR(2)); -+ refresh(); -+ -+ while((c = wgetch(my_menu_win)) != KEY_F(1)) -+ { switch(c) -+ { case KEY_DOWN: -+ menu_driver(my_menu, REQ_DOWN_ITEM); -+ break; -+ case KEY_UP: -+ menu_driver(my_menu, REQ_UP_ITEM); -+ break; -+ case KEY_NPAGE: -+ menu_driver(my_menu, REQ_SCR_DPAGE); -+ break; -+ case KEY_PPAGE: -+ menu_driver(my_menu, REQ_SCR_UPAGE); -+ break; -+ } - wrefresh(my_menu_win); -- } -+ } - -- /* Unpost and free all the memory taken up */ -+ /* Unpost and free all the memory taken up */ - unpost_menu(my_menu); - free_menu(my_menu); -- for(i = 0; i &lt; n_choices; ++i) -+ for(i = 0; i &#60; n_choices; ++i) - free_item(my_items[i]); -- endwin(); -+ endwin(); - } - - void print_in_middle(WINDOW *win, int starty, int startx, int width, char *string, chtype color) --{ int length, x, y; -- float temp; -+{ int length, x, y; -+ float temp; - -- if(win == NULL) -- win = stdscr; -- getyx(win, y, x); -- if(startx != 0) -- x = startx; -- if(starty != 0) -- y = starty; -- if(width == 0) -- width = 80; -- -- length = strlen(string); -- temp = (width - length)/ 2; -- x = startx + (int)temp; -- wattron(win, color); -- mvwprintw(win, y, x, "%s", string); -- wattroff(win, color); -- refresh(); --}</span></font> --</pre></td> --</tr> --</table> --</div> --<p>This program is self-explanatory. In this example the number of --choices has been increased to ten, which is larger than our sub --window size which can hold 6 items. This message has to be --explicitly conveyed to the menu system with the function --set_menu_format(). In here we specify the number of rows and --columns we want to be displayed for a single page. We can specify --any number of items to be shown, in the rows variables, if it is --less than the height of the sub window. If the key pressed by the --user is a PAGE UP or PAGE DOWN, the menu is scrolled a page due to --the requests (REQ_SCR_DPAGE and REQ_SCR_UPAGE) given to --menu_driver().</p> --</div> --<div class="SECT2"> --<hr> --<h3 class="SECT2"><a name="MULTICOLUMN" id="MULTICOLUMN">17.6. --Multi Columnar Menus</a></h3> --<p>In the above example you have seen how to use the function --set_menu_format(). I didn't mention what the cols variable (third --parameter) does. Well, If your sub window is wide enough, you can --opt to display more than one item per row. This can be specified in --the cols variable. To make things simpler, the following example --doesn't show descriptions for the items.</p> --<div class="EXAMPLE"><a name="MMEMUCO" id="MMEMUCO"></a> --<p><b>Example 21. Milt Columnar Menus Example</b></p> --<table border="0" bgcolor="#E0E0E0" width="100%"> --<tr> --<td> --<pre class="PROGRAMLISTING"> --<font color="#000000"><span class= --"INLINEMEDIAOBJECT">#include &lt;curses.h&gt; --#include &lt;menu.h&gt; -+ if(win == NULL) -+ win = stdscr; -+ getyx(win, y, x); -+ if(startx != 0) -+ x = startx; -+ if(starty != 0) -+ y = starty; -+ if(width == 0) -+ width = 80; -+ -+ length = strlen(string); -+ temp = (width - length)/ 2; -+ x = startx + (int)temp; -+ wattron(win, color); -+ mvwprintw(win, y, x, "%s", string); -+ wattroff(win, color); -+ refresh(); -+}</SPAN -+></PRE -+></DIV -+><P -+>This program is self-explanatory. In this example the number of choices has been -+increased to ten, which is larger than our sub window size which can hold 6 -+items. This message has to be explicitly conveyed to the menu system with the -+function set_menu_format(). In here we specify the number of rows and columns we -+want to be displayed for a single page. We can specify any number of items to be -+shown, in the rows variables, if it is less than the height of the sub window. -+If the key pressed by the user is a PAGE UP or PAGE DOWN, the menu is scrolled a -+page due to the requests (REQ_SCR_DPAGE and REQ_SCR_UPAGE) given to -+menu_driver().</P -+></DIV -+><DIV -+CLASS="SECT2" -+><HR><H3 -+CLASS="SECT2" -+><A -+NAME="MULTICOLUMN" -+>17.6. Multi Columnar Menus</A -+></H3 -+><P -+>In the above example you have seen how to use the function set_menu_format(). I -+didn't mention what the cols variable (third parameter) does. Well, If your sub -+window is wide enough, you can opt to display more than one item per row. This -+can be specified in the cols variable. To make things simpler, the following -+example doesn't show descriptions for the items.</P -+><DIV -+CLASS="EXAMPLE" -+><A -+NAME="MMEMUCO" -+></A -+><P -+><B -+>Example 21. Milt Columnar Menus Example </B -+></P -+><PRE -+CLASS="PROGRAMLISTING" -+><SPAN -+CLASS="INLINEMEDIAOBJECT" -+>#include &#60;curses.h&#62; -+#include &#60;menu.h&#62; - - #define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0])) --#define CTRLD 4 -+#define CTRLD 4 - - char *choices[] = { - "Choice 1", "Choice 2", "Choice 3", "Choice 4", "Choice 5", -- "Choice 6", "Choice 7", "Choice 8", "Choice 9", "Choice 10", -- "Choice 11", "Choice 12", "Choice 13", "Choice 14", "Choice 15", -- "Choice 16", "Choice 17", "Choice 18", "Choice 19", "Choice 20", -+ "Choice 6", "Choice 7", "Choice 8", "Choice 9", "Choice 10", -+ "Choice 11", "Choice 12", "Choice 13", "Choice 14", "Choice 15", -+ "Choice 16", "Choice 17", "Choice 18", "Choice 19", "Choice 20", - "Exit", - (char *)NULL, - }; - - int main() --{ ITEM **my_items; -- int c; -- MENU *my_menu; -+{ ITEM **my_items; -+ int c; -+ MENU *my_menu; - WINDOW *my_menu_win; - int n_choices, i; -- -- /* Initialize curses */ -- initscr(); -- start_color(); -+ -+ /* Initialize curses */ -+ initscr(); -+ start_color(); - cbreak(); - noecho(); -- keypad(stdscr, TRUE); -- init_pair(1, COLOR_RED, COLOR_BLACK); -- init_pair(2, COLOR_CYAN, COLOR_BLACK); -+ keypad(stdscr, TRUE); -+ init_pair(1, COLOR_RED, COLOR_BLACK); -+ init_pair(2, COLOR_CYAN, COLOR_BLACK); - -- /* Create items */ -+ /* Create items */ - n_choices = ARRAY_SIZE(choices); - my_items = (ITEM **)calloc(n_choices, sizeof(ITEM *)); -- for(i = 0; i &lt; n_choices; ++i) -+ for(i = 0; i &#60; n_choices; ++i) - my_items[i] = new_item(choices[i], choices[i]); - -- /* Crate menu */ -- my_menu = new_menu((ITEM **)my_items); -+ /* Crate menu */ -+ my_menu = new_menu((ITEM **)my_items); - -- /* Set menu option not to show the description */ -- menu_opts_off(my_menu, O_SHOWDESC); -+ /* Set menu option not to show the description */ -+ menu_opts_off(my_menu, O_SHOWDESC); - -- /* Create the window to be associated with the menu */ -+ /* Create the window to be associated with the menu */ - my_menu_win = newwin(10, 70, 4, 4); - keypad(my_menu_win, TRUE); - -- /* Set main window and sub window */ -+ /* Set main window and sub window */ - set_menu_win(my_menu, my_menu_win); - set_menu_sub(my_menu, derwin(my_menu_win, 6, 68, 3, 1)); -- set_menu_format(my_menu, 5, 3); -- set_menu_mark(my_menu, " * "); -+ set_menu_format(my_menu, 5, 3); -+ set_menu_mark(my_menu, " * "); - -- /* Print a border around the main window and print a title */ -+ /* Print a border around the main window and print a title */ - box(my_menu_win, 0, 0); -- -- attron(COLOR_PAIR(2)); -- mvprintw(LINES - 3, 0, "Use PageUp and PageDown to scroll"); -- mvprintw(LINES - 2, 0, "Use Arrow Keys to navigate (F1 to Exit)"); -- attroff(COLOR_PAIR(2)); -- refresh(); -- -- /* Post the menu */ -- post_menu(my_menu); -- wrefresh(my_menu_win); -- -- while((c = wgetch(my_menu_win)) != KEY_F(1)) -- { switch(c) -- { case KEY_DOWN: -- menu_driver(my_menu, REQ_DOWN_ITEM); -- break; -- case KEY_UP: -- menu_driver(my_menu, REQ_UP_ITEM); -- break; -- case KEY_LEFT: -- menu_driver(my_menu, REQ_LEFT_ITEM); -- break; -- case KEY_RIGHT: -- menu_driver(my_menu, REQ_RIGHT_ITEM); -- break; -- case KEY_NPAGE: -- menu_driver(my_menu, REQ_SCR_DPAGE); -- break; -- case KEY_PPAGE: -- menu_driver(my_menu, REQ_SCR_UPAGE); -- break; -- } -+ -+ attron(COLOR_PAIR(2)); -+ mvprintw(LINES - 3, 0, "Use PageUp and PageDown to scroll"); -+ mvprintw(LINES - 2, 0, "Use Arrow Keys to navigate (F1 to Exit)"); -+ attroff(COLOR_PAIR(2)); -+ refresh(); -+ -+ /* Post the menu */ -+ post_menu(my_menu); -+ wrefresh(my_menu_win); -+ -+ while((c = wgetch(my_menu_win)) != KEY_F(1)) -+ { switch(c) -+ { case KEY_DOWN: -+ menu_driver(my_menu, REQ_DOWN_ITEM); -+ break; -+ case KEY_UP: -+ menu_driver(my_menu, REQ_UP_ITEM); -+ break; -+ case KEY_LEFT: -+ menu_driver(my_menu, REQ_LEFT_ITEM); -+ break; -+ case KEY_RIGHT: -+ menu_driver(my_menu, REQ_RIGHT_ITEM); -+ break; -+ case KEY_NPAGE: -+ menu_driver(my_menu, REQ_SCR_DPAGE); -+ break; -+ case KEY_PPAGE: -+ menu_driver(my_menu, REQ_SCR_UPAGE); -+ break; -+ } - wrefresh(my_menu_win); -- } -+ } - -- /* Unpost and free all the memory taken up */ -+ /* Unpost and free all the memory taken up */ - unpost_menu(my_menu); - free_menu(my_menu); -- for(i = 0; i &lt; n_choices; ++i) -+ for(i = 0; i &#60; n_choices; ++i) - free_item(my_items[i]); -- endwin(); --}</span></font> --</pre></td> --</tr> --</table> --</div> --<p>Watch the function call to set_menu_format(). It specifies the --number of columns to be 3, thus displaying 3 items per row. We have --also switched off the showing descriptions with the function --menu_opts_off(). There are couple of functions set_menu_opts(), --menu_opts_on() and menu_opts() which can be used to manipulate menu --options. The following menu options can be specified.</p> --<table border="0" bgcolor="#E0E0E0" width="100%"> --<tr> --<td> --<pre class="PROGRAMLISTING"> --<font color="#000000"> O_ONEVALUE -+ endwin(); -+}</SPAN -+></PRE -+></DIV -+><P -+>Watch the function call to set_menu_format(). It specifies the number of columns -+to be 3, thus displaying 3 items per row. We have also switched off the showing -+descriptions with the function menu_opts_off(). There are couple of functions -+set_menu_opts(), menu_opts_on() and menu_opts() which can be used to manipulate -+menu options. The following menu options can be specified.</P -+><PRE -+CLASS="PROGRAMLISTING" -+> O_ONEVALUE - Only one item can be selected for this menu. - - O_SHOWDESC -@@ -4310,633 +5898,684 @@ - - O_NONCYCLIC - Don't wrap around next-item and previous-item, -- requests to the other end of the menu.</font> --</pre></td> --</tr> --</table> --<p>All options are on by default. You can switch specific --attributes on or off with menu_opts_on() and menu_opts_off() --functions. You can also use set_menu_opts() to directly specify the --options. The argument to this function should be a OR ed value of --some of those above constants. The function menu_opts() can be used --to find out a menu's present options.</p> --</div> --<div class="SECT2"> --<hr> --<h3 class="SECT2"><a name="MULTIVALUEMENUS" id= --"MULTIVALUEMENUS">17.7. Multi Valued Menus</a></h3> --<p>You might be wondering what if you switch off the option --O_ONEVALUE. Then the menu becomes multi-valued. That means you can --select more than one item. This brings us to the request --REQ_TOGGLE_ITEM. Let's see it in action.</p> --<div class="EXAMPLE"><a name="MMETO" id="MMETO"></a> --<p><b>Example 22. Multi Valued Menus example</b></p> --<table border="0" bgcolor="#E0E0E0" width="100%"> --<tr> --<td> --<pre class="PROGRAMLISTING"> --<font color="#000000"><span class= --"INLINEMEDIAOBJECT">#include &lt;curses.h&gt; --#include &lt;menu.h&gt; -+ requests to the other end of the menu.</PRE -+><P -+>All options are on by default. You can switch specific attributes on or off with -+menu_opts_on() and menu_opts_off() functions. You can also use set_menu_opts() -+to directly specify the options. The argument to this function should be a OR ed -+value of some of those above constants. The function menu_opts() can be used to -+find out a menu's present options. </P -+></DIV -+><DIV -+CLASS="SECT2" -+><HR><H3 -+CLASS="SECT2" -+><A -+NAME="MULTIVALUEMENUS" -+>17.7. Multi Valued Menus</A -+></H3 -+><P -+>You might be wondering what if you switch off the option O_ONEVALUE. Then the -+menu becomes multi-valued. That means you can select more than one item. This -+brings us to the request REQ_TOGGLE_ITEM. Let's see it in action.</P -+><DIV -+CLASS="EXAMPLE" -+><A -+NAME="MMETO" -+></A -+><P -+><B -+>Example 22. Multi Valued Menus example </B -+></P -+><PRE -+CLASS="PROGRAMLISTING" -+><SPAN -+CLASS="INLINEMEDIAOBJECT" -+>#include &#60;curses.h&#62; -+#include &#60;menu.h&#62; - - #define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0])) --#define CTRLD 4 -+#define CTRLD 4 - - char *choices[] = { - "Choice 1", - "Choice 2", - "Choice 3", - "Choice 4", -- "Choice 5", -- "Choice 6", -- "Choice 7", -+ "Choice 5", -+ "Choice 6", -+ "Choice 7", - "Exit", - }; - - int main() --{ ITEM **my_items; -- int c; -- MENU *my_menu; -+{ ITEM **my_items; -+ int c; -+ MENU *my_menu; - int n_choices, i; -- ITEM *cur_item; -- -- /* Initialize curses */ -- initscr(); -+ ITEM *cur_item; -+ -+ /* Initialize curses */ -+ initscr(); - cbreak(); - noecho(); -- keypad(stdscr, TRUE); -+ keypad(stdscr, TRUE); - -- /* Initialize items */ -+ /* Initialize items */ - n_choices = ARRAY_SIZE(choices); - my_items = (ITEM **)calloc(n_choices + 1, sizeof(ITEM *)); -- for(i = 0; i &lt; n_choices; ++i) -+ for(i = 0; i &#60; n_choices; ++i) - my_items[i] = new_item(choices[i], choices[i]); -- my_items[n_choices] = (ITEM *)NULL; -+ my_items[n_choices] = (ITEM *)NULL; - -- my_menu = new_menu((ITEM **)my_items); -+ my_menu = new_menu((ITEM **)my_items); - -- /* Make the menu multi valued */ -- menu_opts_off(my_menu, O_ONEVALUE); -+ /* Make the menu multi valued */ -+ menu_opts_off(my_menu, O_ONEVALUE); - -- mvprintw(LINES - 3, 0, "Use &lt;SPACE&gt; to select or unselect an item."); -- mvprintw(LINES - 2, 0, "&lt;ENTER&gt; to see presently selected items(F1 to Exit)"); -- post_menu(my_menu); -- refresh(); -- -- while((c = getch()) != KEY_F(1)) -- { switch(c) -- { case KEY_DOWN: -- menu_driver(my_menu, REQ_DOWN_ITEM); -- break; -- case KEY_UP: -- menu_driver(my_menu, REQ_UP_ITEM); -- break; -- case ' ': -- menu_driver(my_menu, REQ_TOGGLE_ITEM); -- break; -- case 10: /* Enter */ -- { char temp[200]; -- ITEM **items; -- -- items = menu_items(my_menu); -- temp[0] = '\0'; -- for(i = 0; i &lt; item_count(my_menu); ++i) -- if(item_value(items[i]) == TRUE) -- { strcat(temp, item_name(items[i])); -- strcat(temp, " "); -- } -- move(20, 0); -- clrtoeol(); -- mvprintw(20, 0, temp); -- refresh(); -- } -- break; -- } -- } -+ mvprintw(LINES - 3, 0, "Use &#60;SPACE&#62; to select or unselect an item."); -+ mvprintw(LINES - 2, 0, "&#60;ENTER&#62; to see presently selected items(F1 to Exit)"); -+ post_menu(my_menu); -+ refresh(); -+ -+ while((c = getch()) != KEY_F(1)) -+ { switch(c) -+ { case KEY_DOWN: -+ menu_driver(my_menu, REQ_DOWN_ITEM); -+ break; -+ case KEY_UP: -+ menu_driver(my_menu, REQ_UP_ITEM); -+ break; -+ case ' ': -+ menu_driver(my_menu, REQ_TOGGLE_ITEM); -+ break; -+ case 10: /* Enter */ -+ { char temp[200]; -+ ITEM **items; -+ -+ items = menu_items(my_menu); -+ temp[0] = '\0'; -+ for(i = 0; i &#60; item_count(my_menu); ++i) -+ if(item_value(items[i]) == TRUE) -+ { strcat(temp, item_name(items[i])); -+ strcat(temp, " "); -+ } -+ move(20, 0); -+ clrtoeol(); -+ mvprintw(20, 0, temp); -+ refresh(); -+ } -+ break; -+ } -+ } - -- free_item(my_items[0]); -+ free_item(my_items[0]); - free_item(my_items[1]); -- free_menu(my_menu); -- endwin(); -+ free_menu(my_menu); -+ endwin(); - } -- </span></font> --</pre></td> --</tr> --</table> --</div> --<p>Whew, A lot of new functions. Let's take them one after another. --Firstly, the REQ_TOGGLE_ITEM. In a multi-valued menu, the user --should be allowed to select or un select more than one item. The --request REQ_TOGGLE_ITEM toggles the present selection. In this case --when space is pressed REQ_TOGGLE_ITEM request is sent to --menu_driver to achieve the result.</p> --<p>Now when the user presses &lt;ENTER&gt; we show the items he --presently selected. First we find out the items associated with the --menu using the function menu_items(). Then we loop through the --items to find out if the item is selected or not. The function --item_value() returns TRUE if an item is selected. The function --item_count() returns the number of items in the menu. The item name --can be found with item_name(). You can also find the description --associated with an item using item_description().</p> --</div> --<div class="SECT2"> --<hr> --<h3 class="SECT2"><a name="MENUOPT" id="MENUOPT">17.8. Menu --Options</a></h3> --<p>Well, by this time you must be itching for some difference in --your menu, with lots of functionality. I know. You want Colors !!!. --You want to create nice menus similar to those text mode <a href= --"http://www.jersey.net/~debinjoe/games/" target="_top">dos --games</a>. The functions set_menu_fore() and set_menu_back() can be --used to change the attribute of the selected item and unselected --item. The names are misleading. They don't change menu's foreground --or background which would have been useless.</p> --<p>The function set_menu_grey() can be used to set the display --attribute for the non-selectable items in the menu. This brings us --to the interesting option for an item the one and only --O_SELECTABLE. We can turn it off by the function item_opts_off() --and after that that item is not selectable. It's like a grayed item --in those fancy windows menus. Let's put these concepts in practice --with this example</p> --<div class="EXAMPLE"><a name="MMEAT" id="MMEAT"></a> --<p><b>Example 23. Menu Options example</b></p> --<table border="0" bgcolor="#E0E0E0" width="100%"> --<tr> --<td> --<pre class="PROGRAMLISTING"> --<font color="#000000"><span class= --"INLINEMEDIAOBJECT">#include &lt;menu.h&gt; -+ </SPAN -+></PRE -+></DIV -+><P -+>Whew, A lot of new functions. Let's take them one after another. Firstly, the -+REQ_TOGGLE_ITEM. In a multi-valued menu, the user should be allowed to select -+or un select more than one item. The request REQ_TOGGLE_ITEM toggles the present -+selection. In this case when space is pressed REQ_TOGGLE_ITEM request is sent to -+menu_driver to achieve the result.</P -+><P -+>Now when the user presses &lt;ENTER&gt; we show the items he presently selected. -+First we find out the items associated with the menu using the function -+menu_items(). Then we loop through the items to find out if the item is selected -+or not. The function item_value() returns TRUE if an item is selected. The -+function item_count() returns the number of items in the menu. The item name can -+be found with item_name(). You can also find the description associated with an -+item using item_description().</P -+></DIV -+><DIV -+CLASS="SECT2" -+><HR><H3 -+CLASS="SECT2" -+><A -+NAME="MENUOPT" -+>17.8. Menu Options</A -+></H3 -+><P -+>Well, by this time you must be itching for some difference in your menu, with -+lots of functionality. I know. You want Colors !!!. You want to create nice -+menus similar to those text mode <A -+HREF="http://www.jersey.net/~debinjoe/games/" -+TARGET="_top" -+>dos games</A -+>. The functions -+set_menu_fore() and set_menu_back() can be used to change the attribute of the -+selected item and unselected item. The names are misleading. They don't change -+menu's foreground or background which would have been useless. </P -+><P -+>The function set_menu_grey() can be used to set the display attribute for the -+non-selectable items in the menu. This brings us to the interesting option for -+an item the one and only O_SELECTABLE. We can turn it off by the function -+item_opts_off() and after that that item is not selectable. It's like a grayed -+item in those fancy windows menus. Let's put these concepts in practice with -+this example</P -+><DIV -+CLASS="EXAMPLE" -+><A -+NAME="MMEAT" -+></A -+><P -+><B -+>Example 23. Menu Options example </B -+></P -+><PRE -+CLASS="PROGRAMLISTING" -+><SPAN -+CLASS="INLINEMEDIAOBJECT" -+>#include &#60;menu.h&#62; - - #define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0])) --#define CTRLD 4 -+#define CTRLD 4 - - char *choices[] = { - "Choice 1", - "Choice 2", - "Choice 3", - "Choice 4", -- "Choice 5", -- "Choice 6", -- "Choice 7", -+ "Choice 5", -+ "Choice 6", -+ "Choice 7", - "Exit", - }; - - int main() --{ ITEM **my_items; -- int c; -- MENU *my_menu; -+{ ITEM **my_items; -+ int c; -+ MENU *my_menu; - int n_choices, i; -- ITEM *cur_item; -- -- /* Initialize curses */ -- initscr(); -- start_color(); -+ ITEM *cur_item; -+ -+ /* Initialize curses */ -+ initscr(); -+ start_color(); - cbreak(); - noecho(); -- keypad(stdscr, TRUE); -- init_pair(1, COLOR_RED, COLOR_BLACK); -- init_pair(2, COLOR_GREEN, COLOR_BLACK); -- init_pair(3, COLOR_MAGENTA, COLOR_BLACK); -+ keypad(stdscr, TRUE); -+ init_pair(1, COLOR_RED, COLOR_BLACK); -+ init_pair(2, COLOR_GREEN, COLOR_BLACK); -+ init_pair(3, COLOR_MAGENTA, COLOR_BLACK); - -- /* Initialize items */ -+ /* Initialize items */ - n_choices = ARRAY_SIZE(choices); - my_items = (ITEM **)calloc(n_choices + 1, sizeof(ITEM *)); -- for(i = 0; i &lt; n_choices; ++i) -+ for(i = 0; i &#60; n_choices; ++i) - my_items[i] = new_item(choices[i], choices[i]); -- my_items[n_choices] = (ITEM *)NULL; -- item_opts_off(my_items[3], O_SELECTABLE); -- item_opts_off(my_items[6], O_SELECTABLE); -- -- /* Create menu */ -- my_menu = new_menu((ITEM **)my_items); -- -- /* Set fore ground and back ground of the menu */ -- set_menu_fore(my_menu, COLOR_PAIR(1) | A_REVERSE); -- set_menu_back(my_menu, COLOR_PAIR(2)); -- set_menu_grey(my_menu, COLOR_PAIR(3)); -- -- /* Post the menu */ -- mvprintw(LINES - 3, 0, "Press &lt;ENTER&gt; to see the option selected"); -- mvprintw(LINES - 2, 0, "Up and Down arrow keys to naviage (F1 to Exit)"); -- post_menu(my_menu); -- refresh(); -- -- while((c = getch()) != KEY_F(1)) -- { switch(c) -- { case KEY_DOWN: -- menu_driver(my_menu, REQ_DOWN_ITEM); -- break; -- case KEY_UP: -- menu_driver(my_menu, REQ_UP_ITEM); -- break; -- case 10: /* Enter */ -- move(20, 0); -- clrtoeol(); -- mvprintw(20, 0, "Item selected is : %s", -- item_name(current_item(my_menu))); -- pos_menu_cursor(my_menu); -- break; -- } -- } -- unpost_menu(my_menu); -- for(i = 0; i &lt; n_choices; ++i) -- free_item(my_items[i]); -- free_menu(my_menu); -- endwin(); -+ my_items[n_choices] = (ITEM *)NULL; -+ item_opts_off(my_items[3], O_SELECTABLE); -+ item_opts_off(my_items[6], O_SELECTABLE); -+ -+ /* Create menu */ -+ my_menu = new_menu((ITEM **)my_items); -+ -+ /* Set fore ground and back ground of the menu */ -+ set_menu_fore(my_menu, COLOR_PAIR(1) | A_REVERSE); -+ set_menu_back(my_menu, COLOR_PAIR(2)); -+ set_menu_grey(my_menu, COLOR_PAIR(3)); -+ -+ /* Post the menu */ -+ mvprintw(LINES - 3, 0, "Press &#60;ENTER&#62; to see the option selected"); -+ mvprintw(LINES - 2, 0, "Up and Down arrow keys to naviage (F1 to Exit)"); -+ post_menu(my_menu); -+ refresh(); -+ -+ while((c = getch()) != KEY_F(1)) -+ { switch(c) -+ { case KEY_DOWN: -+ menu_driver(my_menu, REQ_DOWN_ITEM); -+ break; -+ case KEY_UP: -+ menu_driver(my_menu, REQ_UP_ITEM); -+ break; -+ case 10: /* Enter */ -+ move(20, 0); -+ clrtoeol(); -+ mvprintw(20, 0, "Item selected is : %s", -+ item_name(current_item(my_menu))); -+ pos_menu_cursor(my_menu); -+ break; -+ } -+ } -+ unpost_menu(my_menu); -+ for(i = 0; i &#60; n_choices; ++i) -+ free_item(my_items[i]); -+ free_menu(my_menu); -+ endwin(); - } -- </span></font> --</pre></td> --</tr> --</table> --</div> --</div> --<div class="SECT2"> --<hr> --<h3 class="SECT2"><a name="MENUUSERPTR" id="MENUUSERPTR">17.9. The --useful User Pointer</a></h3> --<p>We can associate a user pointer with each item in the menu. It --works the same way as user pointer in panels. It's not touched by --menu system. You can store any thing you like in that. I usually --use it to store the function to be executed when the menu option is --chosen (It's selected and may be the user pressed --&lt;ENTER&gt;);</p> --<div class="EXAMPLE"><a name="MMEUS" id="MMEUS"></a> --<p><b>Example 24. Menu User Pointer Usage</b></p> --<table border="0" bgcolor="#E0E0E0" width="100%"> --<tr> --<td> --<pre class="PROGRAMLISTING"> --<font color="#000000"><span class= --"INLINEMEDIAOBJECT">#include &lt;curses.h&gt; --#include &lt;menu.h&gt; -+ </SPAN -+></PRE -+></DIV -+></DIV -+><DIV -+CLASS="SECT2" -+><HR><H3 -+CLASS="SECT2" -+><A -+NAME="MENUUSERPTR" -+>17.9. The useful User Pointer</A -+></H3 -+><P -+>We can associate a user pointer with each item in the menu. It works the same -+way as user pointer in panels. It's not touched by menu system. You can store -+any thing you like in that. I usually use it to store the function to be -+executed when the menu option is chosen (It's selected and may be the user -+pressed &lt;ENTER&gt;);</P -+><DIV -+CLASS="EXAMPLE" -+><A -+NAME="MMEUS" -+></A -+><P -+><B -+>Example 24. Menu User Pointer Usage </B -+></P -+><PRE -+CLASS="PROGRAMLISTING" -+><SPAN -+CLASS="INLINEMEDIAOBJECT" -+>#include &#60;curses.h&#62; -+#include &#60;menu.h&#62; - - #define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0])) --#define CTRLD 4 -+#define CTRLD 4 - - char *choices[] = { - "Choice 1", - "Choice 2", - "Choice 3", - "Choice 4", -- "Choice 5", -- "Choice 6", -- "Choice 7", -+ "Choice 5", -+ "Choice 6", -+ "Choice 7", - "Exit", - }; - void func(char *name); - - int main() --{ ITEM **my_items; -- int c; -- MENU *my_menu; -+{ ITEM **my_items; -+ int c; -+ MENU *my_menu; - int n_choices, i; -- ITEM *cur_item; -- -- /* Initialize curses */ -- initscr(); -- start_color(); -+ ITEM *cur_item; -+ -+ /* Initialize curses */ -+ initscr(); -+ start_color(); - cbreak(); - noecho(); -- keypad(stdscr, TRUE); -- init_pair(1, COLOR_RED, COLOR_BLACK); -- init_pair(2, COLOR_GREEN, COLOR_BLACK); -- init_pair(3, COLOR_MAGENTA, COLOR_BLACK); -+ keypad(stdscr, TRUE); -+ init_pair(1, COLOR_RED, COLOR_BLACK); -+ init_pair(2, COLOR_GREEN, COLOR_BLACK); -+ init_pair(3, COLOR_MAGENTA, COLOR_BLACK); - -- /* Initialize items */ -+ /* Initialize items */ - n_choices = ARRAY_SIZE(choices); - my_items = (ITEM **)calloc(n_choices + 1, sizeof(ITEM *)); -- for(i = 0; i &lt; n_choices; ++i) -- { my_items[i] = new_item(choices[i], choices[i]); -- /* Set the user pointer */ -- set_item_userptr(my_items[i], func); -- } -- my_items[n_choices] = (ITEM *)NULL; -- -- /* Create menu */ -- my_menu = new_menu((ITEM **)my_items); -- -- /* Post the menu */ -- mvprintw(LINES - 3, 0, "Press &lt;ENTER&gt; to see the option selected"); -- mvprintw(LINES - 2, 0, "Up and Down arrow keys to naviage (F1 to Exit)"); -- post_menu(my_menu); -- refresh(); -- -- while((c = getch()) != KEY_F(1)) -- { switch(c) -- { case KEY_DOWN: -- menu_driver(my_menu, REQ_DOWN_ITEM); -- break; -- case KEY_UP: -- menu_driver(my_menu, REQ_UP_ITEM); -- break; -- case 10: /* Enter */ -- { ITEM *cur; -- void (*p)(char *); -- -- cur = current_item(my_menu); -- p = item_userptr(cur); -- p((char *)item_name(cur)); -- pos_menu_cursor(my_menu); -- break; -- } -- break; -- } -- } -- unpost_menu(my_menu); -- for(i = 0; i &lt; n_choices; ++i) -- free_item(my_items[i]); -- free_menu(my_menu); -- endwin(); -+ for(i = 0; i &#60; n_choices; ++i) -+ { my_items[i] = new_item(choices[i], choices[i]); -+ /* Set the user pointer */ -+ set_item_userptr(my_items[i], func); -+ } -+ my_items[n_choices] = (ITEM *)NULL; -+ -+ /* Create menu */ -+ my_menu = new_menu((ITEM **)my_items); -+ -+ /* Post the menu */ -+ mvprintw(LINES - 3, 0, "Press &#60;ENTER&#62; to see the option selected"); -+ mvprintw(LINES - 2, 0, "Up and Down arrow keys to naviage (F1 to Exit)"); -+ post_menu(my_menu); -+ refresh(); -+ -+ while((c = getch()) != KEY_F(1)) -+ { switch(c) -+ { case KEY_DOWN: -+ menu_driver(my_menu, REQ_DOWN_ITEM); -+ break; -+ case KEY_UP: -+ menu_driver(my_menu, REQ_UP_ITEM); -+ break; -+ case 10: /* Enter */ -+ { ITEM *cur; -+ void (*p)(char *); -+ -+ cur = current_item(my_menu); -+ p = item_userptr(cur); -+ p((char *)item_name(cur)); -+ pos_menu_cursor(my_menu); -+ break; -+ } -+ break; -+ } -+ } -+ unpost_menu(my_menu); -+ for(i = 0; i &#60; n_choices; ++i) -+ free_item(my_items[i]); -+ free_menu(my_menu); -+ endwin(); - } - - void func(char *name) --{ move(20, 0); -- clrtoeol(); -- mvprintw(20, 0, "Item selected is : %s", name); --} </span></font> --</pre></td> --</tr> --</table> --</div> --</div> --</div> --<div class="SECT1"> --<hr> --<h2 class="SECT1"><a name="FORMS" id="FORMS">18. Forms --Library</a></h2> --<p>Well. If you have seen those forms on web pages which take input --from users and do various kinds of things, you might be wondering --how would any one create such forms in text mode display. It's --quite difficult to write those nifty forms in plain ncurses. Forms --library tries to provide a basic frame work to build and maintain --forms with ease. It has lot of features(functions) which manage --validation, dynamic expansion of fields etc.. Let's see it in full --flow.</p> --<p>A form is a collection of fields; each field can be either a --label(static text) or a data-entry location. The forms also library --provides functions to divide forms into multiple pages.</p> --<div class="SECT2"> --<hr> --<h3 class="SECT2"><a name="FORMBASICS" id="FORMBASICS">18.1. The --Basics</a></h3> --<p>Forms are created in much the same way as menus. First the --fields related to the form are created with new_field(). You can --set options for the fields, so that they can be displayed with some --fancy attributes, validated before the field looses focus etc.. --Then the fields are attached to form. After this, the form can be --posted to display and is ready to receive inputs. On the similar --lines to menu_driver(), the form is manipulated with form_driver(). --We can send requests to form_driver to move focus to a certain --field, move cursor to end of the field etc.. After the user enters --values in the fields and validation done, form can be unposted and --memory allocated can be freed.</p> --<p>The general flow of control of a forms program looks like --this.</p> --<ol type="1"> --<li> --<p>Initialize curses</p> --</li> --<li> --<p>Create fields using new_field(). You can specify the height and --width of the field, and its position on the form.</p> --</li> --<li> --<p>Create the forms with new_form() by specifying the fields to be --attached with.</p> --</li> --<li> --<p>Post the form with form_post() and refresh the screen.</p> --</li> --<li> --<p>Process the user requests with a loop and do necessary updates --to form with form_driver.</p> --</li> --<li> --<p>Unpost the menu with form_unpost()</p> --</li> --<li> --<p>Free the memory allocated to menu by free_form()</p> --</li> --<li> --<p>Free the memory allocated to the items with free_field()</p> --</li> --<li> --<p>End curses</p> --</li> --</ol> --<p>As you can see, working with forms library is much similar to --handling menu library. The following examples will explore various --aspects of form processing. Let's start the journey with a simple --example. first.</p> --</div> --<div class="SECT2"> --<hr> --<h3 class="SECT2"><a name="COMPILEFORMS" id="COMPILEFORMS">18.2. --Compiling With the Forms Library</a></h3> --<p>To use forms library functions, you have to include form.h and --to link the program with forms library the flag -lform should be --added along with -lncurses in that order.</p> --<table border="0" bgcolor="#E0E0E0" width="100%"> --<tr> --<td> --<pre class="PROGRAMLISTING"> --<font color="#000000"> #include &lt;form.h&gt; -+{ move(20, 0); -+ clrtoeol(); -+ mvprintw(20, 0, "Item selected is : %s", name); -+} </SPAN -+></PRE -+></DIV -+></DIV -+></DIV -+><DIV -+CLASS="SECT1" -+><HR><H2 -+CLASS="SECT1" -+><A -+NAME="FORMS" -+>18. Forms Library</A -+></H2 -+><P -+>Well. If you have seen those forms on web pages which take input from users and -+do various kinds of things, you might be wondering how would any one create such -+forms in text mode display. It's quite difficult to write those nifty forms in -+plain ncurses. Forms library tries to provide a basic frame work to build and -+maintain forms with ease. It has lot of features(functions) which manage -+validation, dynamic expansion of fields etc.. Let's see it in full flow.</P -+><P -+>A form is a collection of fields; each field can be either a label(static text) -+or a data-entry location. The forms also library provides functions to divide -+forms into multiple pages. </P -+><DIV -+CLASS="SECT2" -+><HR><H3 -+CLASS="SECT2" -+><A -+NAME="FORMBASICS" -+>18.1. The Basics</A -+></H3 -+><P -+>Forms are created in much the same way as menus. First the fields related to the -+form are created with new_field(). You can set options for the fields, so that -+they can be displayed with some fancy attributes, validated before the field -+looses focus etc.. Then the fields are attached to form. After this, the form -+can be posted to display and is ready to receive inputs. On the similar lines to -+menu_driver(), the form is manipulated with form_driver(). We can send requests -+to form_driver to move focus to a certain field, move cursor to end of the field -+etc.. After the user enters values in the fields and validation done, form can -+be unposted and memory allocated can be freed.</P -+><P -+>The general flow of control of a forms program looks like this. -+ -+<P -+></P -+><OL -+TYPE="1" -+><LI -+><P -+>Initialize curses</P -+></LI -+><LI -+><P -+>Create fields using new_field(). You can specify the height and -+width of the field, and its position on the form.</P -+></LI -+><LI -+><P -+>Create the forms with new_form() by specifying the fields to be -+attached with.</P -+></LI -+><LI -+><P -+>Post the form with form_post() and refresh the screen.</P -+></LI -+><LI -+><P -+>Process the user requests with a loop and do necessary updates -+to form with form_driver.</P -+></LI -+><LI -+><P -+>Unpost the menu with form_unpost()</P -+></LI -+><LI -+><P -+>Free the memory allocated to menu by free_form()</P -+></LI -+><LI -+><P -+>Free the memory allocated to the items with free_field()</P -+></LI -+><LI -+><P -+>End curses</P -+></LI -+></OL -+></P -+><P -+>As you can see, working with forms library is much similar to handling menu -+library. The following examples will explore various aspects of form -+processing. Let's start the journey with a simple example. first.</P -+></DIV -+><DIV -+CLASS="SECT2" -+><HR><H3 -+CLASS="SECT2" -+><A -+NAME="COMPILEFORMS" -+>18.2. Compiling With the Forms Library</A -+></H3 -+><P -+>To use forms library functions, you have to include form.h and to link the -+program with forms library the flag -lform should be added along with -lncurses -+in that order.</P -+><PRE -+CLASS="PROGRAMLISTING" -+> #include &lt;form.h&gt; - . - . - . - -- compile and link: gcc &lt;program file&gt; -lform -lncurses</font> --</pre></td> --</tr> --</table> --<div class="EXAMPLE"><a name="FFOSI" id="FFOSI"></a> --<p><b>Example 25. Forms Basics</b></p> --<table border="0" bgcolor="#E0E0E0" width="100%"> --<tr> --<td> --<pre class="PROGRAMLISTING"> --<font color="#000000"><span class= --"INLINEMEDIAOBJECT">#include &lt;form.h&gt; -+ compile and link: gcc &lt;program file&gt; -lform -lncurses</PRE -+><DIV -+CLASS="EXAMPLE" -+><A -+NAME="FFOSI" -+></A -+><P -+><B -+>Example 25. Forms Basics </B -+></P -+><PRE -+CLASS="PROGRAMLISTING" -+><SPAN -+CLASS="INLINEMEDIAOBJECT" -+>#include &#60;form.h&#62; - - int main() --{ FIELD *field[3]; -- FORM *my_form; -- int ch; -- -- /* Initialize curses */ -- initscr(); -- cbreak(); -- noecho(); -- keypad(stdscr, TRUE); -- -- /* Initialize the fields */ -- field[0] = new_field(1, 10, 4, 18, 0, 0); -- field[1] = new_field(1, 10, 6, 18, 0, 0); -- field[2] = NULL; -- -- /* Set field options */ -- set_field_back(field[0], A_UNDERLINE); /* Print a line for the option */ -- field_opts_off(field[0], O_AUTOSKIP); /* Don't go to next field when this */ -- /* Field is filled up */ -- set_field_back(field[1], A_UNDERLINE); -- field_opts_off(field[1], O_AUTOSKIP); -- -- /* Create the form and post it */ -- my_form = new_form(field); -- post_form(my_form); -- refresh(); -- -- mvprintw(4, 10, "Value 1:"); -- mvprintw(6, 10, "Value 2:"); -- refresh(); -- -- /* Loop through to get user requests */ -- while((ch = getch()) != KEY_F(1)) -- { switch(ch) -- { case KEY_DOWN: -- /* Go to next field */ -- form_driver(my_form, REQ_NEXT_FIELD); -- /* Go to the end of the present buffer */ -- /* Leaves nicely at the last character */ -- form_driver(my_form, REQ_END_LINE); -- break; -- case KEY_UP: -- /* Go to previous field */ -- form_driver(my_form, REQ_PREV_FIELD); -- form_driver(my_form, REQ_END_LINE); -- break; -- default: -- /* If this is a normal character, it gets */ -- /* Printed */ -- form_driver(my_form, ch); -- break; -- } -- } -- -- /* Un post form and free the memory */ -- unpost_form(my_form); -- free_form(my_form); -- free_field(field[0]); -- free_field(field[1]); -- -- endwin(); -- return 0; --}</span></font> --</pre></td> --</tr> --</table> --</div> --<p>Above example is pretty straight forward. It creates two fields --with <var class="LITERAL">new_field()</var>. new_field() takes --height, width, starty, startx, number of offscreen rows and number --of additional working buffers. The fifth argument number of --offscreen rows specifies how much of the field to be shown. If it --is zero, the entire field is always displayed otherwise the form --will be scrollable when the user accesses not displayed parts of --the field. The forms library allocates one buffer per field to --store the data user enters. Using the last parameter to new_field() --we can specify it to allocate some additional buffers. These can be --used for any purpose you like.</p> --<p>After creating the fields, back ground attribute of both of them --is set to an underscore with set_field_back(). The AUTOSKIP option --is turned off using field_opts_off(). If this option is turned on, --focus will move to the next field in the form once the active field --is filled up completely.</p> --<p>After attaching the fields to the form, it is posted. Here on, --user inputs are processed in the while loop, by making --corresponding requests to form_driver. The details of all the --requests to the form_driver() are explained later.</p> --</div> --<div class="SECT2"> --<hr> --<h3 class="SECT2"><a name="PLAYFIELDS" id="PLAYFIELDS">18.3. --Playing with Fields</a></h3> --<p>Each form field is associated with a lot of attributes. They can --be manipulated to get the required effect and to have fun !!!. So --why wait?</p> --<div class="SECT3"> --<hr> --<h4 class="SECT3"><a name="FETCHINFO" id="FETCHINFO">18.3.1. --Fetching Size and Location of Field</a></h4> --<p>The parameters we have given at the time of creation of a field --can be retrieved with field_info(). It returns height, width, --starty, startx, number of offscreen rows, and number of additional --buffers into the parameters given to it. It is a sort of inverse of --new_field().</p> --<table border="0" bgcolor="#E0E0E0" width="100%"> --<tr> --<td> --<pre class="PROGRAMLISTING"> --<font color= --"#000000">int field_info( FIELD *field, /* field from which to fetch */ -+{ FIELD *field[3]; -+ FORM *my_form; -+ int ch; -+ -+ /* Initialize curses */ -+ initscr(); -+ cbreak(); -+ noecho(); -+ keypad(stdscr, TRUE); -+ -+ /* Initialize the fields */ -+ field[0] = new_field(1, 10, 4, 18, 0, 0); -+ field[1] = new_field(1, 10, 6, 18, 0, 0); -+ field[2] = NULL; -+ -+ /* Set field options */ -+ set_field_back(field[0], A_UNDERLINE); /* Print a line for the option */ -+ field_opts_off(field[0], O_AUTOSKIP); /* Don't go to next field when this */ -+ /* Field is filled up */ -+ set_field_back(field[1], A_UNDERLINE); -+ field_opts_off(field[1], O_AUTOSKIP); -+ -+ /* Create the form and post it */ -+ my_form = new_form(field); -+ post_form(my_form); -+ refresh(); -+ -+ mvprintw(4, 10, "Value 1:"); -+ mvprintw(6, 10, "Value 2:"); -+ refresh(); -+ -+ /* Loop through to get user requests */ -+ while((ch = getch()) != KEY_F(1)) -+ { switch(ch) -+ { case KEY_DOWN: -+ /* Go to next field */ -+ form_driver(my_form, REQ_NEXT_FIELD); -+ /* Go to the end of the present buffer */ -+ /* Leaves nicely at the last character */ -+ form_driver(my_form, REQ_END_LINE); -+ break; -+ case KEY_UP: -+ /* Go to previous field */ -+ form_driver(my_form, REQ_PREV_FIELD); -+ form_driver(my_form, REQ_END_LINE); -+ break; -+ default: -+ /* If this is a normal character, it gets */ -+ /* Printed */ -+ form_driver(my_form, ch); -+ break; -+ } -+ } -+ -+ /* Un post form and free the memory */ -+ unpost_form(my_form); -+ free_form(my_form); -+ free_field(field[0]); -+ free_field(field[1]); -+ -+ endwin(); -+ return 0; -+}</SPAN -+></PRE -+></DIV -+><P -+>Above example is pretty straight forward. It creates two fields with -+<TT -+CLASS="LITERAL" -+>new_field()</TT -+>. new_field() takes height, width, -+starty, startx, number of offscreen rows and number of additional working -+buffers. The fifth argument number of offscreen rows specifies how much of the -+field to be shown. If it is zero, the entire field is always displayed otherwise -+the form will be scrollable when the user accesses not displayed parts of the -+field. The forms library allocates one buffer per field to store the data user -+enters. Using the last parameter to new_field() we can specify it to allocate -+some additional buffers. These can be used for any purpose you like.</P -+><P -+>After creating the fields, back ground attribute of both of them is set to an -+underscore with set_field_back(). The AUTOSKIP option is turned off using -+field_opts_off(). If this option is turned on, focus will move to the next -+field in the form once the active field is filled up completely.</P -+><P -+>After attaching the fields to the form, it is posted. Here on, user inputs are -+processed in the while loop, by making corresponding requests to form_driver. -+The details of all the requests to the form_driver() are explained later.</P -+></DIV -+><DIV -+CLASS="SECT2" -+><HR><H3 -+CLASS="SECT2" -+><A -+NAME="PLAYFIELDS" -+>18.3. Playing with Fields</A -+></H3 -+><P -+>Each form field is associated with a lot of attributes. They can be manipulated -+to get the required effect and to have fun !!!. So why wait? </P -+><DIV -+CLASS="SECT3" -+><HR><H4 -+CLASS="SECT3" -+><A -+NAME="FETCHINFO" -+>18.3.1. Fetching Size and Location of Field</A -+></H4 -+><P -+>The parameters we have given at the time of creation of a field can be retrieved -+with field_info(). It returns height, width, starty, startx, number of offscreen -+rows, and number of additional buffers into the parameters given to it. It is a -+sort of inverse of new_field().</P -+><PRE -+CLASS="PROGRAMLISTING" -+>int field_info( FIELD *field, /* field from which to fetch */ - int *height, *int width, /* field size */ - int *top, int *left, /* upper left corner */ - int *offscreen, /* number of offscreen rows */ -- int *nbuf); /* number of working buffers */</font> --</pre></td> --</tr> --</table> --</div> --<div class="SECT3"> --<hr> --<h4 class="SECT3"><a name="MOVEFIELD" id="MOVEFIELD">18.3.2. Moving --the field</a></h4> --<p>The location of the field can be moved to a different position --with move_field().</p> --<table border="0" bgcolor="#E0E0E0" width="100%"> --<tr> --<td> --<pre class="PROGRAMLISTING"> --<font color= --"#000000">int move_field( FIELD *field, /* field to alter */ -- int top, int left); /* new upper-left corner */</font> --</pre></td> --</tr> --</table> --<p>As usual, the changed position can be queried with --field_infor().</p> --</div> --<div class="SECT3"> --<hr> --<h4 class="SECT3"><a name="JUSTIFYFIELD" id="JUSTIFYFIELD">18.3.3. --Field Justification</a></h4> --<p>The justification to be done for the field can be fixed using --the function set_field_just().</p> --<table border="0" bgcolor="#E0E0E0" width="100%"> --<tr> --<td> --<pre class="PROGRAMLISTING"> --<font color= --"#000000"> int set_field_just(FIELD *field, /* field to alter */ -+ int *nbuf); /* number of working buffers */</PRE -+></DIV -+><DIV -+CLASS="SECT3" -+><HR><H4 -+CLASS="SECT3" -+><A -+NAME="MOVEFIELD" -+>18.3.2. Moving the field</A -+></H4 -+><P -+>The location of the field can be moved to a different position with -+move_field().</P -+><PRE -+CLASS="PROGRAMLISTING" -+>int move_field( FIELD *field, /* field to alter */ -+ int top, int left); /* new upper-left corner */</PRE -+><P -+>As usual, the changed position can be queried with field_infor().</P -+></DIV -+><DIV -+CLASS="SECT3" -+><HR><H4 -+CLASS="SECT3" -+><A -+NAME="JUSTIFYFIELD" -+>18.3.3. Field Justification</A -+></H4 -+><P -+>The justification to be done for the field can be fixed using the function -+set_field_just().</P -+><PRE -+CLASS="PROGRAMLISTING" -+> int set_field_just(FIELD *field, /* field to alter */ - int justmode); /* mode to set */ -- int field_just(FIELD *field); /* fetch justify mode of field */</font> --</pre></td> --</tr> --</table> --<p>The justification mode valued accepted and returned by these --functions are NO_JUSTIFICATION, JUSTIFY_RIGHT, JUSTIFY_LEFT, or --JUSTIFY_CENTER.</p> --</div> --<div class="SECT3"> --<hr> --<h4 class="SECT3"><a name="FIELDDISPATTRIB" id= --"FIELDDISPATTRIB">18.3.4. Field Display Attributes</a></h4> --<p>As you have seen, in the above example, display attribute for --the fields can be set with set_field_fore() and setfield_back(). --These functions set foreground and background attribute of the --fields. You can also specify a pad character which will be filled --in the unfilled portion of the field. The pad character is set with --a call to set_field_pad(). Default pad value is a space. The --functions field_fore(), field_back, field_pad() can be used to --query the present foreground, background attributes and pad --character for the field. The following list gives the usage of --functions.</p> --<table border="0" bgcolor="#E0E0E0" width="100%"> --<tr> --<td> --<pre class="PROGRAMLISTING"> --<font color= --"#000000">&#13;int set_field_fore(FIELD *field, /* field to alter */ -+ int field_just(FIELD *field); /* fetch justify mode of field */</PRE -+><P -+>The justification mode valued accepted and returned by these functions are -+NO_JUSTIFICATION, JUSTIFY_RIGHT, JUSTIFY_LEFT, or JUSTIFY_CENTER.</P -+></DIV -+><DIV -+CLASS="SECT3" -+><HR><H4 -+CLASS="SECT3" -+><A -+NAME="FIELDDISPATTRIB" -+>18.3.4. Field Display Attributes</A -+></H4 -+><P -+>As you have seen, in the above example, display attribute for the fields can be -+set with set_field_fore() and setfield_back(). These functions set foreground -+and background attribute of the fields. You can also specify a pad character -+which will be filled in the unfilled portion of the field. The pad character is -+set with a call to set_field_pad(). Default pad value is a space. The functions -+field_fore(), field_back, field_pad() can be used to query the present -+foreground, background attributes and pad character for the field. The following -+list gives the usage of functions.</P -+><PRE -+CLASS="PROGRAMLISTING" -+>&#13;int set_field_fore(FIELD *field, /* field to alter */ - chtype attr); /* attribute to set */ - - chtype field_fore(FIELD *field); /* field to query */ -@@ -4952,124 +6591,127 @@ - int pad); /* pad character to set */ - - chtype field_pad(FIELD *field); /* field to query */ -- /* returns present pad character */&#13;</font> --</pre></td> --</tr> --</table> --<p>Though above functions seem quite simple, using colors with --set_field_fore() may be frustrating in the beginning. Let me first --explain about foreground and background attributes of a field. The --foreground attribute is associated with the character. That means a --character in the field is printed with the attribute you have set --with set_field_fore(). Background attribute is the attribute used --to fill background of field, whether any character is there or not. --So what about colors? Since colors are always defined in pairs, --what is the right way to display colored fields? Here's an example --clarifying color attributes.</p> --<div class="EXAMPLE"><a name="FFOAT" id="FFOAT"></a> --<p><b>Example 26. Form Attributes example</b></p> --<table border="0" bgcolor="#E0E0E0" width="100%"> --<tr> --<td> --<pre class="PROGRAMLISTING"> --<font color="#000000"><span class= --"INLINEMEDIAOBJECT">#include &lt;form.h&gt; -+ /* returns present pad character */&#13;</PRE -+><P -+>Though above functions seem quite simple, using colors with set_field_fore() may -+be frustrating in the beginning. Let me first explain about foreground and -+background attributes of a field. The foreground attribute is associated with -+the character. That means a character in the field is printed with the attribute -+you have set with set_field_fore(). Background attribute is the attribute used -+to fill background of field, whether any character is there or not. So what -+about colors? Since colors are always defined in pairs, what is the right way to -+display colored fields? Here's an example clarifying color attributes.</P -+><DIV -+CLASS="EXAMPLE" -+><A -+NAME="FFOAT" -+></A -+><P -+><B -+>Example 26. Form Attributes example </B -+></P -+><PRE -+CLASS="PROGRAMLISTING" -+><SPAN -+CLASS="INLINEMEDIAOBJECT" -+>#include &#60;form.h&#62; - - int main() --{ FIELD *field[3]; -- FORM *my_form; -- int ch; -- -- /* Initialize curses */ -- initscr(); -- start_color(); -- cbreak(); -- noecho(); -- keypad(stdscr, TRUE); -- -- /* Initialize few color pairs */ -- init_pair(1, COLOR_WHITE, COLOR_BLUE); -- init_pair(2, COLOR_WHITE, COLOR_BLUE); -- -- /* Initialize the fields */ -- field[0] = new_field(1, 10, 4, 18, 0, 0); -- field[1] = new_field(1, 10, 6, 18, 0, 0); -- field[2] = NULL; -- -- /* Set field options */ -- set_field_fore(field[0], COLOR_PAIR(1));/* Put the field with blue background */ -- set_field_back(field[0], COLOR_PAIR(2));/* and white foreground (characters */ -- /* are printed in white */ -- field_opts_off(field[0], O_AUTOSKIP); /* Don't go to next field when this */ -- /* Field is filled up */ -- set_field_back(field[1], A_UNDERLINE); -- field_opts_off(field[1], O_AUTOSKIP); -- -- /* Create the form and post it */ -- my_form = new_form(field); -- post_form(my_form); -- refresh(); -- -- set_current_field(my_form, field[0]); /* Set focus to the colored field */ -- mvprintw(4, 10, "Value 1:"); -- mvprintw(6, 10, "Value 2:"); -- mvprintw(LINES - 2, 0, "Use UP, DOWN arrow keys to switch between fields"); -- refresh(); -- -- /* Loop through to get user requests */ -- while((ch = getch()) != KEY_F(1)) -- { switch(ch) -- { case KEY_DOWN: -- /* Go to next field */ -- form_driver(my_form, REQ_NEXT_FIELD); -- /* Go to the end of the present buffer */ -- /* Leaves nicely at the last character */ -- form_driver(my_form, REQ_END_LINE); -- break; -- case KEY_UP: -- /* Go to previous field */ -- form_driver(my_form, REQ_PREV_FIELD); -- form_driver(my_form, REQ_END_LINE); -- break; -- default: -- /* If this is a normal character, it gets */ -- /* Printed */ -- form_driver(my_form, ch); -- break; -- } -- } -- -- /* Un post form and free the memory */ -- unpost_form(my_form); -- free_form(my_form); -- free_field(field[0]); -- free_field(field[1]); -- -- endwin(); -- return 0; --}</span></font> --</pre></td> --</tr> --</table> --</div> --<p>Play with the color pairs and try to understand the foreground --and background attributes. In my programs using color attributes, I --usually set only the background with set_field_back(). Curses --simply doesn't allow defining individual color attributes.</p> --</div> --<div class="SECT3"> --<hr> --<h4 class="SECT3"><a name="FIELDOPTIONBITS" id= --"FIELDOPTIONBITS">18.3.5. Field Option Bits</a></h4> --<p>There is also a large collection of field option bits you can --set to control various aspects of forms processing. You can --manipulate them with these functions:</p> --<table border="0" bgcolor="#E0E0E0" width="100%"> --<tr> --<td> --<pre class="PROGRAMLISTING"> --<font color= --"#000000">int set_field_opts(FIELD *field, /* field to alter */ -+{ FIELD *field[3]; -+ FORM *my_form; -+ int ch; -+ -+ /* Initialize curses */ -+ initscr(); -+ start_color(); -+ cbreak(); -+ noecho(); -+ keypad(stdscr, TRUE); -+ -+ /* Initialize few color pairs */ -+ init_pair(1, COLOR_WHITE, COLOR_BLUE); -+ init_pair(2, COLOR_WHITE, COLOR_BLUE); -+ -+ /* Initialize the fields */ -+ field[0] = new_field(1, 10, 4, 18, 0, 0); -+ field[1] = new_field(1, 10, 6, 18, 0, 0); -+ field[2] = NULL; -+ -+ /* Set field options */ -+ set_field_fore(field[0], COLOR_PAIR(1));/* Put the field with blue background */ -+ set_field_back(field[0], COLOR_PAIR(2));/* and white foreground (characters */ -+ /* are printed in white */ -+ field_opts_off(field[0], O_AUTOSKIP); /* Don't go to next field when this */ -+ /* Field is filled up */ -+ set_field_back(field[1], A_UNDERLINE); -+ field_opts_off(field[1], O_AUTOSKIP); -+ -+ /* Create the form and post it */ -+ my_form = new_form(field); -+ post_form(my_form); -+ refresh(); -+ -+ set_current_field(my_form, field[0]); /* Set focus to the colored field */ -+ mvprintw(4, 10, "Value 1:"); -+ mvprintw(6, 10, "Value 2:"); -+ mvprintw(LINES - 2, 0, "Use UP, DOWN arrow keys to switch between fields"); -+ refresh(); -+ -+ /* Loop through to get user requests */ -+ while((ch = getch()) != KEY_F(1)) -+ { switch(ch) -+ { case KEY_DOWN: -+ /* Go to next field */ -+ form_driver(my_form, REQ_NEXT_FIELD); -+ /* Go to the end of the present buffer */ -+ /* Leaves nicely at the last character */ -+ form_driver(my_form, REQ_END_LINE); -+ break; -+ case KEY_UP: -+ /* Go to previous field */ -+ form_driver(my_form, REQ_PREV_FIELD); -+ form_driver(my_form, REQ_END_LINE); -+ break; -+ default: -+ /* If this is a normal character, it gets */ -+ /* Printed */ -+ form_driver(my_form, ch); -+ break; -+ } -+ } -+ -+ /* Un post form and free the memory */ -+ unpost_form(my_form); -+ free_form(my_form); -+ free_field(field[0]); -+ free_field(field[1]); -+ -+ endwin(); -+ return 0; -+}</SPAN -+></PRE -+></DIV -+><P -+>Play with the color pairs and try to understand the foreground and background -+attributes. In my programs using color attributes, I usually set only the -+background with set_field_back(). Curses simply doesn't allow defining -+individual color attributes. </P -+></DIV -+><DIV -+CLASS="SECT3" -+><HR><H4 -+CLASS="SECT3" -+><A -+NAME="FIELDOPTIONBITS" -+>18.3.5. Field Option Bits</A -+></H4 -+><P -+>There is also a large collection of field option bits you can set to control -+various aspects of forms processing. You can manipulate them with these -+functions:</P -+><PRE -+CLASS="PROGRAMLISTING" -+>int set_field_opts(FIELD *field, /* field to alter */ - int attr); /* attribute to set */ - - int field_opts_on(FIELD *field, /* field to alter */ -@@ -5078,108 +6720,134 @@ - int field_opts_off(FIELD *field, /* field to alter */ - int attr); /* attributes to turn off */ - --int field_opts(FIELD *field); /* field to query */ </font> --</pre></td> --</tr> --</table> --<p>The function set_field_opts() can be used to directly set --attributes of a field or you can choose to switch a few attributes --on and off with field_opts_on() and field_opts_off() selectively. --Anytime you can query the attributes of a field with field_opts(). --The following is the list of available options. By default, all --options are on.</p> --<div class="VARIABLELIST"> --<dl> --<dt>O_VISIBLE</dt> --<dd> --<p>Controls whether the field is visible on the screen. Can be used --during form processing to hide or pop up fields depending on the --value of parent fields.</p> --</dd> --<dt>O_ACTIVE</dt> --<dd> --<p>Controls whether the field is active during forms processing --(i.e. visited by form navigation keys). Can be used to make labels --or derived fields with buffer values alterable by the forms --application, not the user.</p> --</dd> --<dt>O_PUBLIC</dt> --<dd> --<p>Controls whether data is displayed during field entry. If this --option is turned off on a field, the library will accept and edit --data in that field, but it will not be displayed and the visible --field cursor will not move. You can turn off the O_PUBLIC bit to --define password fields.</p> --</dd> --<dt>O_EDIT</dt> --<dd> --<p>Controls whether the field's data can be modified. When this --option is off, all editing requests except <var class= --"LITERAL">REQ_PREV_CHOICE</var> and <var class= --"LITERAL">REQ_NEXT_CHOICE</var>will fail. Such read-only fields may --be useful for help messages.</p> --</dd> --<dt>O_WRAP</dt> --<dd> --<p>Controls word-wrapping in multi-line fields. Normally, when any --character of a (blank-separated) word reaches the end of the --current line, the entire word is wrapped to the next line (assuming --there is one). When this option is off, the word will be split --across the line break.</p> --</dd> --<dt>O_BLANK</dt> --<dd> --<p>Controls field blanking. When this option is on, entering a --character at the first field position erases the entire field --(except for the just-entered character).</p> --</dd> --<dt>O_AUTOSKIP</dt> --<dd> --<p>Controls automatic skip to next field when this one fills. --Normally, when the forms user tries to type more data into a field --than will fit, the editing location jumps to next field. When this --option is off, the user's cursor will hang at the end of the field. --This option is ignored in dynamic fields that have not reached --their size limit.</p> --</dd> --<dt>O_NULLOK</dt> --<dd> --<p>Controls whether validation is applied to blank fields. --Normally, it is not; the user can leave a field blank without --invoking the usual validation check on exit. If this option is off --on a field, exit from it will invoke a validation check.</p> --</dd> --<dt>O_PASSOK</dt> --<dd> --<p>Controls whether validation occurs on every exit, or only after --the field is modified. Normally the latter is true. Setting --O_PASSOK may be useful if your field's validation function may --change during forms processing.</p> --</dd> --<dt>O_STATIC</dt> --<dd> --<p>Controls whether the field is fixed to its initial dimensions. --If you turn this off, the field becomes dynamic and will stretch to --fit entered data.</p> --</dd> --</dl> --</div> --<p>A field's options cannot be changed while the field is currently --selected. However, options may be changed on posted fields that are --not current.</p> --<p>The option values are bit-masks and can be composed with --logical-or in the obvious way. You have seen the usage of switching --off O_AUTOSKIP option. The following example clarifies usage of --some more options. Other options are explained where --appropriate.</p> --<div class="EXAMPLE"><a name="FFOOP" id="FFOOP"></a> --<p><b>Example 27. Field Options Usage example</b></p> --<table border="0" bgcolor="#E0E0E0" width="100%"> --<tr> --<td> --<pre class="PROGRAMLISTING"> --<font color="#000000"><span class= --"INLINEMEDIAOBJECT">#include &lt;form.h&gt; -+int field_opts(FIELD *field); /* field to query */ </PRE -+><P -+>The function set_field_opts() can be used to directly set attributes of a field -+or you can choose to switch a few attributes on and off with field_opts_on() and -+field_opts_off() selectively. Anytime you can query the attributes of a field -+with field_opts(). The following is the list of available options. By default, -+all options are on.</P -+><P -+></P -+><DIV -+CLASS="VARIABLELIST" -+><DL -+><DT -+>O_VISIBLE</DT -+><DD -+><P -+>Controls whether the field is visible on the screen. Can be used -+during form processing to hide or pop up fields depending on the value -+of parent fields.</P -+></DD -+><DT -+>O_ACTIVE</DT -+><DD -+><P -+>Controls whether the field is active during forms processing (i.e. -+visited by form navigation keys). Can be used to make labels or derived -+fields with buffer values alterable by the forms application, not the user.</P -+></DD -+><DT -+>O_PUBLIC</DT -+><DD -+><P -+>Controls whether data is displayed during field entry. If this option is -+turned off on a field, the library will accept and edit data in that field, -+but it will not be displayed and the visible field cursor will not move. -+You can turn off the O_PUBLIC bit to define password fields.</P -+></DD -+><DT -+>O_EDIT</DT -+><DD -+><P -+>Controls whether the field's data can be modified. When this option is -+off, all editing requests except <TT -+CLASS="LITERAL" -+>REQ_PREV_CHOICE</TT -+> and <TT -+CLASS="LITERAL" -+>REQ_NEXT_CHOICE</TT -+>will -+fail. Such read-only fields may be useful for help messages.</P -+></DD -+><DT -+>O_WRAP</DT -+><DD -+><P -+>Controls word-wrapping in multi-line fields. Normally, when any -+character of a (blank-separated) word reaches the end of the current line, the -+entire word is wrapped to the next line (assuming there is one). When this -+option is off, the word will be split across the line break.</P -+></DD -+><DT -+>O_BLANK</DT -+><DD -+><P -+>Controls field blanking. When this option is on, entering a character at -+the first field position erases the entire field (except for the just-entered -+character).</P -+></DD -+><DT -+>O_AUTOSKIP</DT -+><DD -+><P -+>Controls automatic skip to next field when this one fills. Normally, -+when the forms user tries to type more data into a field than will fit, -+the editing location jumps to next field. When this option is off, the -+user's cursor will hang at the end of the field. This option is ignored -+in dynamic fields that have not reached their size limit.</P -+></DD -+><DT -+>O_NULLOK</DT -+><DD -+><P -+>Controls whether validation is applied to -+blank fields. Normally, it is not; the user can leave a field blank -+without invoking the usual validation check on exit. If this option is -+off on a field, exit from it will invoke a validation check.</P -+></DD -+><DT -+>O_PASSOK</DT -+><DD -+><P -+>Controls whether validation occurs on every exit, or only after -+the field is modified. Normally the latter is true. Setting O_PASSOK -+may be useful if your field's validation function may change during -+forms processing.</P -+></DD -+><DT -+>O_STATIC</DT -+><DD -+><P -+>Controls whether the field is fixed to its initial dimensions. If you -+turn this off, the field becomes dynamic and will -+stretch to fit entered data.</P -+></DD -+></DL -+></DIV -+><P -+>A field's options cannot be changed while the field is currently selected. -+However, options may be changed on posted fields that are not current. </P -+><P -+>The option values are bit-masks and can be composed with logical-or in -+the obvious way. You have seen the usage of switching off O_AUTOSKIP option. -+The following example clarifies usage of some more options. Other options -+are explained where appropriate.</P -+><DIV -+CLASS="EXAMPLE" -+><A -+NAME="FFOOP" -+></A -+><P -+><B -+>Example 27. Field Options Usage example </B -+></P -+><PRE -+CLASS="PROGRAMLISTING" -+><SPAN -+CLASS="INLINEMEDIAOBJECT" -+>#include &#60;form.h&#62; - - #define STARTX 15 - #define STARTY 4 -@@ -5188,975 +6856,1476 @@ - #define N_FIELDS 3 - - int main() --{ FIELD *field[N_FIELDS]; -- FORM *my_form; -- int ch, i; -- -- /* Initialize curses */ -- initscr(); -- cbreak(); -- noecho(); -- keypad(stdscr, TRUE); -- -- /* Initialize the fields */ -- for(i = 0; i &lt; N_FIELDS - 1; ++i) -- field[i] = new_field(1, WIDTH, STARTY + i * 2, STARTX, 0, 0); -- field[N_FIELDS - 1] = NULL; -- -- /* Set field options */ -- set_field_back(field[1], A_UNDERLINE); /* Print a line for the option */ -- -- field_opts_off(field[0], O_ACTIVE); /* This field is a static label */ -- field_opts_off(field[1], O_PUBLIC); /* This filed is like a password field*/ -- field_opts_off(field[1], O_AUTOSKIP); /* To avoid entering the same field */ -- /* after last character is entered */ -- -- /* Create the form and post it */ -- my_form = new_form(field); -- post_form(my_form); -- refresh(); -- -- set_field_just(field[0], JUSTIFY_CENTER); /* Center Justification */ -- set_field_buffer(field[0], 0, "This is a static Field"); -- /* Initialize the field */ -- mvprintw(STARTY, STARTX - 10, "Field 1:"); -- mvprintw(STARTY + 2, STARTX - 10, "Field 2:"); -- refresh(); -- -- /* Loop through to get user requests */ -- while((ch = getch()) != KEY_F(1)) -- { switch(ch) -- { case KEY_DOWN: -- /* Go to next field */ -- form_driver(my_form, REQ_NEXT_FIELD); -- /* Go to the end of the present buffer */ -- /* Leaves nicely at the last character */ -- form_driver(my_form, REQ_END_LINE); -- break; -- case KEY_UP: -- /* Go to previous field */ -- form_driver(my_form, REQ_PREV_FIELD); -- form_driver(my_form, REQ_END_LINE); -- break; -- default: -- /* If this is a normal character, it gets */ -- /* Printed */ -- form_driver(my_form, ch); -- break; -- } -- } -- -- /* Un post form and free the memory */ -- unpost_form(my_form); -- free_form(my_form); -- free_field(field[0]); -- free_field(field[1]); -- -- endwin(); -- return 0; --}</span></font> --</pre></td> --</tr> --</table> --</div> --<p>This example, though useless, shows the usage of options. If --used properly, they can present information very effectively in a --form. The second field being not O_PUBLIC, does not show the --characters you are typing.</p> --</div> --<div class="SECT3"> --<hr> --<h4 class="SECT3"><a name="FIELDSTATUS" id="FIELDSTATUS">18.3.6. --Field Status</a></h4> --<p>The field status specifies whether the field has got edited or --not. It is initially set to FALSE and when user enters something --and the data buffer gets modified it becomes TRUE. So a field's --status can be queried to find out whether it has been modified or --not. The following functions can assist in those operations.</p> --<table border="0" bgcolor="#E0E0E0" width="100%"> --<tr> --<td> --<pre class="PROGRAMLISTING"> --<font color= --"#000000">int set_field_status(FIELD *field, /* field to alter */ -+{ FIELD *field[N_FIELDS]; -+ FORM *my_form; -+ int ch, i; -+ -+ /* Initialize curses */ -+ initscr(); -+ cbreak(); -+ noecho(); -+ keypad(stdscr, TRUE); -+ -+ /* Initialize the fields */ -+ for(i = 0; i &#60; N_FIELDS - 1; ++i) -+ field[i] = new_field(1, WIDTH, STARTY + i * 2, STARTX, 0, 0); -+ field[N_FIELDS - 1] = NULL; -+ -+ /* Set field options */ -+ set_field_back(field[1], A_UNDERLINE); /* Print a line for the option */ -+ -+ field_opts_off(field[0], O_ACTIVE); /* This field is a static label */ -+ field_opts_off(field[1], O_PUBLIC); /* This filed is like a password field*/ -+ field_opts_off(field[1], O_AUTOSKIP); /* To avoid entering the same field */ -+ /* after last character is entered */ -+ -+ /* Create the form and post it */ -+ my_form = new_form(field); -+ post_form(my_form); -+ refresh(); -+ -+ set_field_just(field[0], JUSTIFY_CENTER); /* Center Justification */ -+ set_field_buffer(field[0], 0, "This is a static Field"); -+ /* Initialize the field */ -+ mvprintw(STARTY, STARTX - 10, "Field 1:"); -+ mvprintw(STARTY + 2, STARTX - 10, "Field 2:"); -+ refresh(); -+ -+ /* Loop through to get user requests */ -+ while((ch = getch()) != KEY_F(1)) -+ { switch(ch) -+ { case KEY_DOWN: -+ /* Go to next field */ -+ form_driver(my_form, REQ_NEXT_FIELD); -+ /* Go to the end of the present buffer */ -+ /* Leaves nicely at the last character */ -+ form_driver(my_form, REQ_END_LINE); -+ break; -+ case KEY_UP: -+ /* Go to previous field */ -+ form_driver(my_form, REQ_PREV_FIELD); -+ form_driver(my_form, REQ_END_LINE); -+ break; -+ default: -+ /* If this is a normal character, it gets */ -+ /* Printed */ -+ form_driver(my_form, ch); -+ break; -+ } -+ } -+ -+ /* Un post form and free the memory */ -+ unpost_form(my_form); -+ free_form(my_form); -+ free_field(field[0]); -+ free_field(field[1]); -+ -+ endwin(); -+ return 0; -+}</SPAN -+></PRE -+></DIV -+><P -+>This example, though useless, shows the usage of options. If used properly, they -+can present information very effectively in a form. The second field being not -+O_PUBLIC, does not show the characters you are typing.</P -+></DIV -+><DIV -+CLASS="SECT3" -+><HR><H4 -+CLASS="SECT3" -+><A -+NAME="FIELDSTATUS" -+>18.3.6. Field Status</A -+></H4 -+><P -+>The field status specifies whether the field has got edited or not. It is -+initially set to FALSE and when user enters something and the data buffer gets -+modified it becomes TRUE. So a field's status can be queried to find out whether -+it has been modified or not. The following functions can assist in those -+operations.</P -+><PRE -+CLASS="PROGRAMLISTING" -+>int set_field_status(FIELD *field, /* field to alter */ - int status); /* status to set */ - --int field_status(FIELD *field); /* fetch status of field */</font> --</pre></td> --</tr> --</table> --<p>It's better to check the field's status only after after leaving --the field, as data buffer might not have been updated yet as the --validation is still due. To guarantee that right status is --returned, call field_status() either (1) in the field's exit --validation check routine, (2) from the field's or form's --initialization or termination hooks, or (3) just after a --REQ_VALIDATION request has been processed by the forms driver</p> --</div> --<div class="SECT3"> --<hr> --<h4 class="SECT3"><a name="FIELDUSERPTR" id="FIELDUSERPTR">18.3.7. --Field User Pointer</a></h4> --<p>Every field structure contains one pointer that can be used by --the user for various purposes. It is not touched by forms library --and can be used for any purpose by the user. The following --functions set and fetch user pointer.</p> --<table border="0" bgcolor="#E0E0E0" width="100%"> --<tr> --<td> --<pre class="PROGRAMLISTING"> --<font color="#000000">int set_field_userptr(FIELD *field, -+int field_status(FIELD *field); /* fetch status of field */</PRE -+><P -+>It's better to check the field's status only after after leaving the field, as -+data buffer might not have been updated yet as the validation is still due. To -+guarantee that right status is returned, call field_status() either (1) in the -+field's exit validation check routine, (2) from the field's or form's -+initialization or termination hooks, or (3) just after a REQ_VALIDATION request -+has been processed by the forms driver</P -+></DIV -+><DIV -+CLASS="SECT3" -+><HR><H4 -+CLASS="SECT3" -+><A -+NAME="FIELDUSERPTR" -+>18.3.7. Field User Pointer</A -+></H4 -+><P -+>Every field structure contains one pointer that can be used by the user for -+various purposes. It is not touched by forms library and can be used for any -+purpose by the user. The following functions set and fetch user pointer.</P -+><PRE -+CLASS="PROGRAMLISTING" -+>int set_field_userptr(FIELD *field, - char *userptr); /* the user pointer you wish to associate */ - /* with the field */ - --char *field_userptr(FIELD *field); /* fetch user pointer of the field */</font> --</pre></td> --</tr> --</table> --</div> --<div class="SECT3"> --<hr> --<h4 class="SECT3"><a name="VARIABLESIZEFIELDS" id= --"VARIABLESIZEFIELDS">18.3.8. Variable-Sized Fields</a></h4> --<p>If you want a dynamically changing field with variable width, --this is the feature you want to put to full use. This will allow --the user to enter more data than the original size of the field and --let the field grow. According to the field orientation it will --scroll horizontally or vertically to incorporate the new data.</p> --<p>To make a field dynamically growable, the option O_STATIC should --be turned off. This can be done with a</p> --<table border="0" bgcolor="#E0E0E0" width="100%"> --<tr> --<td> --<pre class="PROGRAMLISTING"> --<font color= --"#000000"> field_opts_off(field_pointer, O_STATIC);</font> --</pre></td> --</tr> --</table> --<p>But it's usually not advisable to allow a field to grow --infinitely. You can set a maximum limit to the growth of the field --with</p> --<table border="0" bgcolor="#E0E0E0" width="100%"> --<tr> --<td> --<pre class="PROGRAMLISTING"> --<font color= --"#000000">int set_max_field(FIELD *field, /* Field on which to operate */ -- int max_growth); /* maximum growth allowed for the field */</font> --</pre></td> --</tr> --</table> --<p>The field info for a dynamically growable field can be retrieved --by</p> --<table border="0" bgcolor="#E0E0E0" width="100%"> --<tr> --<td> --<pre class="PROGRAMLISTING"> --<font color= --"#000000">int dynamic_field_info( FIELD *field, /* Field on which to operate */ -+char *field_userptr(FIELD *field); /* fetch user pointer of the field */</PRE -+></DIV -+><DIV -+CLASS="SECT3" -+><HR><H4 -+CLASS="SECT3" -+><A -+NAME="VARIABLESIZEFIELDS" -+>18.3.8. Variable-Sized Fields</A -+></H4 -+><P -+>If you want a dynamically changing field with variable width, this is the -+feature you want to put to full use. This will allow the user to enter more data -+than the original size of the field and let the field grow. According to the -+field orientation it will scroll horizontally or vertically to incorporate the -+new data.</P -+><P -+>To make a field dynamically growable, the option O_STATIC should be turned off. -+This can be done with a -+<PRE -+CLASS="PROGRAMLISTING" -+> field_opts_off(field_pointer, O_STATIC);</PRE -+></P -+><P -+>But it's usually not advisable to allow a field to grow infinitely. You can set -+a maximum limit to the growth of the field with -+<PRE -+CLASS="PROGRAMLISTING" -+>int set_max_field(FIELD *field, /* Field on which to operate */ -+ int max_growth); /* maximum growth allowed for the field */</PRE -+></P -+><P -+>The field info for a dynamically growable field can be retrieved by -+<PRE -+CLASS="PROGRAMLISTING" -+>int dynamic_field_info( FIELD *field, /* Field on which to operate */ - int *prows, /* number of rows will be filled in this */ - int *pcols, /* number of columns will be filled in this*/ - int *pmax) /* maximum allowable growth will be filled */ -- /* in this */</font> --</pre></td> --</tr> --</table> --Though field_info work as usual, it is advisable to use this --function to get the proper attributes of a dynamically growable --field. --<p>Recall the library routine new_field; a new field created with --height set to one will be defined to be a one line field. A new --field created with height greater than one will be defined to be a --multi line field.</p> --<p>A one line field with O_STATIC turned off (dynamically growable --field) will contain a single fixed row, but the number of columns --can increase if the user enters more data than the initial field --will hold. The number of columns displayed will remain fixed and --the additional data will scroll horizontally.</p> --<p>A multi line field with O_STATIC turned off (dynamically --growable field) will contain a fixed number of columns, but the --number of rows can increase if the user enters more data than the --initial field will hold. The number of rows displayed will remain --fixed and the additional data will scroll vertically.</p> --<p>The above two paragraphs pretty much describe a dynamically --growable field's behavior. The way other parts of forms library --behaves is described below:</p> --<ol type="1"> --<li> --<p>The field option O_AUTOSKIP will be ignored if the option --O_STATIC is off and there is no maximum growth specified for the --field. Currently, O_AUTOSKIP generates an automatic REQ_NEXT_FIELD --form driver request when the user types in the last character --position of a field. On a growable field with no maximum growth --specified, there is no last character position. If a maximum growth --is specified, the O_AUTOSKIP option will work as normal if the --field has grown to its maximum size.</p> --</li> --<li> --<p>The field justification will be ignored if the option O_STATIC --is off. Currently, set_field_just can be used to JUSTIFY_LEFT, --JUSTIFY_RIGHT, JUSTIFY_CENTER the contents of a one line field. A --growable one line field will, by definition, grow and scroll --horizontally and may contain more data than can be justified. The --return from field_just will be unchanged.</p> --</li> --<li> --<p>The overloaded form driver request REQ_NEW_LINE will operate the --same way regardless of the O_NL_OVERLOAD form option if the field --option O_STATIC is off and there is no maximum growth specified for --the field. Currently, if the form option O_NL_OVERLOAD is on, --REQ_NEW_LINE implicitly generates a REQ_NEXT_FIELD if called from --the last line of a field. If a field can grow without bound, there --is no last line, so REQ_NEW_LINE will never implicitly generate a --REQ_NEXT_FIELD. If a maximum growth limit is specified and the --O_NL_OVERLOAD form option is on, REQ_NEW_LINE will only implicitly --generate REQ_NEXT_FIELD if the field has grown to its maximum size --and the user is on the last line.</p> --</li> --<li> --<p>The library call dup_field will work as usual; it will duplicate --the field, including the current buffer size and contents of the --field being duplicated. Any specified maximum growth will also be --duplicated.</p> --</li> --<li> --<p>The library call link_field will work as usual; it will --duplicate all field attributes and share buffers with the field --being linked. If the O_STATIC field option is subsequently changed --by a field sharing buffers, how the system reacts to an attempt to --enter more data into the field than the buffer will currently hold --will depend on the setting of the option in the current field.</p> --</li> --<li> --<p>The library call field_info will work as usual; the variable --nrow will contain the value of the original call to new_field. The --user should use dynamic_field_info, described above, to query the --current size of the buffer.</p> --</li> --</ol> --<p>Some of the above points make sense only after explaining form --driver. We will be looking into that in next few sections.</p> --</div> --</div> --<div class="SECT2"> --<hr> --<h3 class="SECT2"><a name="FORMWINDOWS" id="FORMWINDOWS">18.4. Form --Windows</a></h3> --<p>The form windows concept is pretty much similar to menu windows. --Every form is associated with a main window and a sub window. The --form main window displays any title or border associated or --whatever the user wishes. Then the sub window contains all the --fields and displays them according to their position. This gives --the flexibility of manipulating fancy form displaying very --easily.</p> --<p>Since this is pretty much similar to menu windows, I am --providing an example with out much explanation. The functions are --similar and they work the same way.</p> --<div class="EXAMPLE"><a name="FFOWI" id="FFOWI"></a> --<p><b>Example 28. Form Windows Example</b></p> --<table border="0" bgcolor="#E0E0E0" width="100%"> --<tr> --<td> --<pre class="PROGRAMLISTING"> --<font color="#000000"><span class= --"INLINEMEDIAOBJECT">#include &lt;form.h&gt; -+ /* in this */</PRE -+> -+Though field_info work as usual, it is advisable to use this function to get the -+proper attributes of a dynamically growable field.</P -+><P -+>Recall the library routine new_field; a new field created with height set to one -+will be defined to be a one line field. A new field created with height greater -+than one will be defined to be a multi line field. </P -+><P -+>A one line field with O_STATIC turned off (dynamically growable field) will -+contain a single fixed row, but the number of columns can increase if the user -+enters more data than the initial field will hold. The number of columns -+displayed will remain fixed and the additional data will scroll horizontally. </P -+><P -+>A multi line field with O_STATIC turned off (dynamically growable field) will -+contain a fixed number of columns, but the number of rows can increase if the -+user enters more data than the initial field will hold. The number of rows -+displayed will remain fixed and the additional data will scroll vertically.</P -+><P -+>The above two paragraphs pretty much describe a dynamically growable field's -+behavior. The way other parts of forms library behaves is described below:</P -+><P -+></P -+><OL -+TYPE="1" -+><LI -+><P -+>The field option O_AUTOSKIP will be ignored if the option O_STATIC is off and -+there is no maximum growth specified for the field. Currently, O_AUTOSKIP -+generates an automatic REQ_NEXT_FIELD form driver request when the user types in -+the last character position of a field. On a growable field with no maximum -+growth specified, there is no last character position. If a maximum growth is -+specified, the O_AUTOSKIP option will work as normal if the field has grown to -+its maximum size. </P -+></LI -+><LI -+><P -+>The field justification will be ignored if the option O_STATIC is off. -+Currently, set_field_just can be used to JUSTIFY_LEFT, JUSTIFY_RIGHT, -+JUSTIFY_CENTER the contents of a one line field. A growable one line field will, -+by definition, grow and scroll horizontally and may contain more data than can -+be justified. The return from field_just will be unchanged. </P -+></LI -+><LI -+><P -+>The overloaded form driver request REQ_NEW_LINE will operate the same way -+regardless of the O_NL_OVERLOAD form option if the field option O_STATIC is off -+and there is no maximum growth specified for the field. Currently, if the form -+option O_NL_OVERLOAD is on, REQ_NEW_LINE implicitly generates a REQ_NEXT_FIELD -+if called from the last line of a field. If a field can grow without bound, -+there is no last line, so REQ_NEW_LINE will never implicitly generate a -+REQ_NEXT_FIELD. If a maximum growth limit is specified and the O_NL_OVERLOAD -+form option is on, REQ_NEW_LINE will only implicitly generate REQ_NEXT_FIELD if -+the field has grown to its maximum size and the user is on the last line. </P -+></LI -+><LI -+><P -+>The library call dup_field will work as usual; it will duplicate the field, -+including the current buffer size and contents of the field being duplicated. -+Any specified maximum growth will also be duplicated. </P -+></LI -+><LI -+><P -+>The library call link_field will work as usual; it will duplicate all field -+attributes and share buffers with the field being linked. If the O_STATIC field -+option is subsequently changed by a field sharing buffers, how the system reacts -+to an attempt to enter more data into the field than the buffer will currently -+hold will depend on the setting of the option in the current field. </P -+></LI -+><LI -+><P -+>The library call field_info will work as usual; the variable nrow will contain -+the value of the original call to new_field. The user should use -+dynamic_field_info, described above, to query the current size of the buffer.</P -+></LI -+></OL -+><P -+>Some of the above points make sense only after explaining form driver. We will -+be looking into that in next few sections.</P -+></DIV -+></DIV -+><DIV -+CLASS="SECT2" -+><HR><H3 -+CLASS="SECT2" -+><A -+NAME="FORMWINDOWS" -+>18.4. Form Windows</A -+></H3 -+><P -+>The form windows concept is pretty much similar to menu windows. Every form is -+associated with a main window and a sub window. The form main window displays -+any title or border associated or whatever the user wishes. Then the sub window -+contains all the fields and displays them according to their position. This -+gives the flexibility of manipulating fancy form displaying very easily. </P -+><P -+>Since this is pretty much similar to menu windows, I am providing an example -+with out much explanation. The functions are similar and they work the same way.</P -+><DIV -+CLASS="EXAMPLE" -+><A -+NAME="FFOWI" -+></A -+><P -+><B -+>Example 28. Form Windows Example </B -+></P -+><PRE -+CLASS="PROGRAMLISTING" -+><SPAN -+CLASS="INLINEMEDIAOBJECT" -+>#include &#60;form.h&#62; - - void print_in_middle(WINDOW *win, int starty, int startx, int width, char *string, chtype color); - - int main() - { -- FIELD *field[3]; -- FORM *my_form; -- WINDOW *my_form_win; -- int ch, rows, cols; -- -- /* Initialize curses */ -- initscr(); -- start_color(); -- cbreak(); -- noecho(); -- keypad(stdscr, TRUE); -- -- /* Initialize few color pairs */ -- init_pair(1, COLOR_RED, COLOR_BLACK); -- -- /* Initialize the fields */ -- field[0] = new_field(1, 10, 6, 1, 0, 0); -- field[1] = new_field(1, 10, 8, 1, 0, 0); -- field[2] = NULL; -- -- /* Set field options */ -- set_field_back(field[0], A_UNDERLINE); -- field_opts_off(field[0], O_AUTOSKIP); /* Don't go to next field when this */ -- /* Field is filled up */ -- set_field_back(field[1], A_UNDERLINE); -- field_opts_off(field[1], O_AUTOSKIP); -- -- /* Create the form and post it */ -- my_form = new_form(field); -- -- /* Calculate the area required for the form */ -- scale_form(my_form, &amp;rows, &amp;cols); -+ FIELD *field[3]; -+ FORM *my_form; -+ WINDOW *my_form_win; -+ int ch, rows, cols; -+ -+ /* Initialize curses */ -+ initscr(); -+ start_color(); -+ cbreak(); -+ noecho(); -+ keypad(stdscr, TRUE); -+ -+ /* Initialize few color pairs */ -+ init_pair(1, COLOR_RED, COLOR_BLACK); -+ -+ /* Initialize the fields */ -+ field[0] = new_field(1, 10, 6, 1, 0, 0); -+ field[1] = new_field(1, 10, 8, 1, 0, 0); -+ field[2] = NULL; -+ -+ /* Set field options */ -+ set_field_back(field[0], A_UNDERLINE); -+ field_opts_off(field[0], O_AUTOSKIP); /* Don't go to next field when this */ -+ /* Field is filled up */ -+ set_field_back(field[1], A_UNDERLINE); -+ field_opts_off(field[1], O_AUTOSKIP); -+ -+ /* Create the form and post it */ -+ my_form = new_form(field); -+ -+ /* Calculate the area required for the form */ -+ scale_form(my_form, &#38;rows, &#38;cols); - -- /* Create the window to be associated with the form */ -+ /* Create the window to be associated with the form */ - my_form_win = newwin(rows + 4, cols + 4, 4, 4); - keypad(my_form_win, TRUE); - -- /* Set main window and sub window */ -+ /* Set main window and sub window */ - set_form_win(my_form, my_form_win); - set_form_sub(my_form, derwin(my_form_win, rows, cols, 2, 2)); - -- /* Print a border around the main window and print a title */ -+ /* Print a border around the main window and print a title */ - box(my_form_win, 0, 0); -- print_in_middle(my_form_win, 1, 0, cols + 4, "My Form", COLOR_PAIR(1)); -- -- post_form(my_form); -- wrefresh(my_form_win); -- -- mvprintw(LINES - 2, 0, "Use UP, DOWN arrow keys to switch between fields"); -- refresh(); -+ print_in_middle(my_form_win, 1, 0, cols + 4, "My Form", COLOR_PAIR(1)); -+ -+ post_form(my_form); -+ wrefresh(my_form_win); -+ -+ mvprintw(LINES - 2, 0, "Use UP, DOWN arrow keys to switch between fields"); -+ refresh(); -+ -+ /* Loop through to get user requests */ -+ while((ch = wgetch(my_form_win)) != KEY_F(1)) -+ { switch(ch) -+ { case KEY_DOWN: -+ /* Go to next field */ -+ form_driver(my_form, REQ_NEXT_FIELD); -+ /* Go to the end of the present buffer */ -+ /* Leaves nicely at the last character */ -+ form_driver(my_form, REQ_END_LINE); -+ break; -+ case KEY_UP: -+ /* Go to previous field */ -+ form_driver(my_form, REQ_PREV_FIELD); -+ form_driver(my_form, REQ_END_LINE); -+ break; -+ default: -+ /* If this is a normal character, it gets */ -+ /* Printed */ -+ form_driver(my_form, ch); -+ break; -+ } -+ } -+ -+ /* Un post form and free the memory */ -+ unpost_form(my_form); -+ free_form(my_form); -+ free_field(field[0]); -+ free_field(field[1]); - -- /* Loop through to get user requests */ -- while((ch = wgetch(my_form_win)) != KEY_F(1)) -- { switch(ch) -- { case KEY_DOWN: -- /* Go to next field */ -- form_driver(my_form, REQ_NEXT_FIELD); -- /* Go to the end of the present buffer */ -- /* Leaves nicely at the last character */ -- form_driver(my_form, REQ_END_LINE); -- break; -- case KEY_UP: -- /* Go to previous field */ -- form_driver(my_form, REQ_PREV_FIELD); -- form_driver(my_form, REQ_END_LINE); -- break; -- default: -- /* If this is a normal character, it gets */ -- /* Printed */ -- form_driver(my_form, ch); -- break; -- } -- } -- -- /* Un post form and free the memory */ -- unpost_form(my_form); -- free_form(my_form); -- free_field(field[0]); -- free_field(field[1]); -- -- endwin(); -- return 0; -+ endwin(); -+ return 0; - } - - void print_in_middle(WINDOW *win, int starty, int startx, int width, char *string, chtype color) --{ int length, x, y; -- float temp; -+{ int length, x, y; -+ float temp; - -- if(win == NULL) -- win = stdscr; -- getyx(win, y, x); -- if(startx != 0) -- x = startx; -- if(starty != 0) -- y = starty; -- if(width == 0) -- width = 80; -- -- length = strlen(string); -- temp = (width - length)/ 2; -- x = startx + (int)temp; -- wattron(win, color); -- mvwprintw(win, y, x, "%s", string); -- wattroff(win, color); -- refresh(); --}</span></font> --</pre></td> --</tr> --</table> --</div> --</div> --<div class="SECT2"> --<hr> --<h3 class="SECT2"><a name="FILEDVALIDATE" id="FILEDVALIDATE">18.5. --Field Validation</a></h3> --<p>By default, a field will accept any data input by the user. It --is possible to attach validation to the field. Then any attempt by --the user to leave the field, while it contains data that doesn't --match the validation type will fail. Some validation types also --have a character-validity check for each time a character is --entered in the field.</p> --<p>Validation can be attached to a field with the following --function.</p> --<table border="0" bgcolor="#E0E0E0" width="100%"> --<tr> --<td> --<pre class="PROGRAMLISTING"> --<font color= --"#000000">int set_field_type(FIELD *field, /* field to alter */ -+ if(win == NULL) -+ win = stdscr; -+ getyx(win, y, x); -+ if(startx != 0) -+ x = startx; -+ if(starty != 0) -+ y = starty; -+ if(width == 0) -+ width = 80; -+ -+ length = strlen(string); -+ temp = (width - length)/ 2; -+ x = startx + (int)temp; -+ wattron(win, color); -+ mvwprintw(win, y, x, "%s", string); -+ wattroff(win, color); -+ refresh(); -+}</SPAN -+></PRE -+></DIV -+></DIV -+><DIV -+CLASS="SECT2" -+><HR><H3 -+CLASS="SECT2" -+><A -+NAME="FILEDVALIDATE" -+>18.5. Field Validation</A -+></H3 -+><P -+>By default, a field will accept any data input by the user. It is possible to -+attach validation to the field. Then any attempt by the user to leave the field, -+while it contains data that doesn't match the validation type will fail. Some -+validation types also have a character-validity check for each time a character -+is entered in the field.</P -+><P -+>Validation can be attached to a field with the following function. -+<PRE -+CLASS="PROGRAMLISTING" -+>int set_field_type(FIELD *field, /* field to alter */ - FIELDTYPE *ftype, /* type to associate */ -- ...); /* additional arguments*/</font> --</pre></td> --</tr> --</table> -+ ...); /* additional arguments*/</PRE -+> - Once set, the validation type for a field can be queried with --<table border="0" bgcolor="#E0E0E0" width="100%"> --<tr> --<td> --<pre class="PROGRAMLISTING"> --<font color= --"#000000">FIELDTYPE *field_type(FIELD *field); /* field to query */</font> --</pre></td> --</tr> --</table> --<p>The form driver validates the data in a field only when data is --entered by the end-user. Validation does not occur when</p> --<ul> --<li> --<p>the application program changes the field value by calling --set_field_buffer.</p> --</li> --<li> --<p>linked field values are changed indirectly -- by changing the --field to which they are linked</p> --</li> --</ul> --<p>The following are the pre-defined validation types. You can also --specify custom validation, though it's a bit tricky and --cumbersome.</p> --<h1 class="BRIDGEHEAD"><a name="AEN1069" id= --"AEN1069"></a>TYPE_ALPHA</h1> --<p>This field type accepts alphabetic data; no blanks, no digits, --no special characters (this is checked at character-entry time). It --is set up with:</p> --<table border="0" bgcolor="#E0E0E0" width="100%"> --<tr> --<td> --<pre class="PROGRAMLISTING"> --<font color= --"#000000">int set_field_type(FIELD *field, /* field to alter */ -+<PRE -+CLASS="PROGRAMLISTING" -+>FIELDTYPE *field_type(FIELD *field); /* field to query */</PRE -+></P -+><P -+>The form driver validates the data in a field only when data is entered by the -+end-user. Validation does not occur when </P -+><P -+></P -+><UL -+><LI -+><P -+>the application program changes the field value by calling set_field_buffer. </P -+></LI -+><LI -+><P -+>linked field values are changed indirectly -- by changing the field to which -+they are linked</P -+></LI -+></UL -+><P -+>The following are the pre-defined validation types. You can also specify custom -+validation, though it's a bit tricky and cumbersome.</P -+><H1 -+CLASS="BRIDGEHEAD" -+><A -+NAME="AEN1069" -+></A -+>TYPE_ALPHA</H1 -+><P -+>This field type accepts alphabetic data; no blanks, no digits, no special -+characters (this is checked at character-entry time). It is set up with: </P -+><PRE -+CLASS="PROGRAMLISTING" -+>int set_field_type(FIELD *field, /* field to alter */ - TYPE_ALPHA, /* type to associate */ -- int width); /* maximum width of field */</font> --</pre></td> --</tr> --</table> --<p>The width argument sets a minimum width of data. The user has to --enter at-least width number of characters before he can leave the --field. Typically you'll want to set this to the field width; if --it's greater than the field width, the validation check will always --fail. A minimum width of zero makes field completion optional.</p> --<h1 class="BRIDGEHEAD"><a name="AEN1073" id= --"AEN1073"></a>TYPE_ALNUM</h1> --<p>This field type accepts alphabetic data and digits; no blanks, --no special characters (this is checked at character-entry time). It --is set up with:</p> --<table border="0" bgcolor="#E0E0E0" width="100%"> --<tr> --<td> --<pre class="PROGRAMLISTING"> --<font color= --"#000000">int set_field_type(FIELD *field, /* field to alter */ -+ int width); /* maximum width of field */</PRE -+><P -+>The width argument sets a minimum width of data. The user has to enter at-least -+width number of characters before he can leave the field. Typically -+you'll want to set this to the field width; if it's greater than the -+field width, the validation check will always fail. A minimum width -+of zero makes field completion optional. </P -+><H1 -+CLASS="BRIDGEHEAD" -+><A -+NAME="AEN1073" -+></A -+>TYPE_ALNUM</H1 -+><P -+>This field type accepts alphabetic data and digits; no blanks, no special -+characters (this is checked at character-entry time). It is set up with: </P -+><PRE -+CLASS="PROGRAMLISTING" -+>int set_field_type(FIELD *field, /* field to alter */ - TYPE_ALNUM, /* type to associate */ -- int width); /* maximum width of field */</font> --</pre></td> --</tr> --</table> --<p>The width argument sets a minimum width of data. As with --TYPE_ALPHA, typically you'll want to set this to the field width; --if it's greater than the field width, the validation check will --always fail. A minimum width of zero makes field completion --optional.</p> --<h1 class="BRIDGEHEAD"><a name="AEN1077" id= --"AEN1077"></a>TYPE_ENUM</h1> --<p>This type allows you to restrict a field's values to be among a --specified set of string values (for example, the two-letter postal --codes for U.S. states). It is set up with:</p> --<table border="0" bgcolor="#E0E0E0" width="100%"> --<tr> --<td> --<pre class="PROGRAMLISTING"> --<font color= --"#000000">int set_field_type(FIELD *field, /* field to alter */ -+ int width); /* maximum width of field */</PRE -+><P -+>The width argument sets a minimum width of data. As with -+TYPE_ALPHA, typically you'll want to set this to the field width; if it's -+greater than the field width, the validation check will always fail. A -+minimum width of zero makes field completion optional. </P -+><H1 -+CLASS="BRIDGEHEAD" -+><A -+NAME="AEN1077" -+></A -+>TYPE_ENUM</H1 -+><P -+>This type allows you to restrict a field's values to be among a specified -+set of string values (for example, the two-letter postal codes for U.S. -+states). It is set up with: </P -+><PRE -+CLASS="PROGRAMLISTING" -+>int set_field_type(FIELD *field, /* field to alter */ - TYPE_ENUM, /* type to associate */ - char **valuelist; /* list of possible values */ - int checkcase; /* case-sensitive? */ -- int checkunique); /* must specify uniquely? */</font> --</pre></td> --</tr> --</table> --<p>The valuelist parameter must point at a NULL-terminated list of --valid strings. The checkcase argument, if true, makes comparison --with the string case-sensitive.</p> --<p>When the user exits a TYPE_ENUM field, the validation procedure --tries to complete the data in the buffer to a valid entry. If a --complete choice string has been entered, it is of course valid. But --it is also possible to enter a prefix of a valid string and have it --completed for you.</p> --<p>By default, if you enter such a prefix and it matches more than --one value in the string list, the prefix will be completed to the --first matching value. But the checkunique argument, if true, --requires prefix matches to be unique in order to be valid.</p> --<p>The REQ_NEXT_CHOICE and REQ_PREV_CHOICE input requests can be --particularly useful with these fields.</p> --<h1 class="BRIDGEHEAD"><a name="AEN1084" id= --"AEN1084"></a>TYPE_INTEGER</h1> --<p>This field type accepts an integer. It is set up as follows:</p> --<table border="0" bgcolor="#E0E0E0" width="100%"> --<tr> --<td> --<pre class="PROGRAMLISTING"> --<font color= --"#000000">int set_field_type(FIELD *field, /* field to alter */ -+ int checkunique); /* must specify uniquely? */</PRE -+><P -+>The valuelist parameter must point at a NULL-terminated list of -+valid strings. The checkcase argument, if true, makes comparison -+with the string case-sensitive. </P -+><P -+>When the user exits a TYPE_ENUM field, the validation procedure tries to -+complete the data in the buffer to a valid entry. If a complete choice string -+has been entered, it is of course valid. But it is also possible to enter a -+prefix of a valid string and have it completed for you. </P -+><P -+>By default, if you enter such a prefix and it matches more than one value -+in the string list, the prefix will be completed to the first matching -+value. But the checkunique argument, if true, requires prefix -+matches to be unique in order to be valid. </P -+><P -+>The REQ_NEXT_CHOICE and REQ_PREV_CHOICE input requests can be particularly -+useful with these fields. </P -+><H1 -+CLASS="BRIDGEHEAD" -+><A -+NAME="AEN1084" -+></A -+>TYPE_INTEGER</H1 -+><P -+>This field type accepts an integer. It is set up as follows: </P -+><PRE -+CLASS="PROGRAMLISTING" -+>int set_field_type(FIELD *field, /* field to alter */ - TYPE_INTEGER, /* type to associate */ - int padding, /* # places to zero-pad to */ -- int vmin, int vmax); /* valid range */</font> --</pre></td> --</tr> --</table> --<p>Valid characters consist of an optional leading minus and --digits. The range check is performed on exit. If the range maximum --is less than or equal to the minimum, the range is ignored.</p> --<p>If the value passes its range check, it is padded with as many --leading zero digits as necessary to meet the padding argument.</p> --<p>A TYPE_INTEGER value buffer can conveniently be interpreted with --the C library function atoi(3).</p> --<h1 class="BRIDGEHEAD"><a name="AEN1090" id= --"AEN1090"></a>TYPE_NUMERIC</h1> --<p>This field type accepts a decimal number. It is set up as --follows:</p> --<table border="0" bgcolor="#E0E0E0" width="100%"> --<tr> --<td> --<pre class="PROGRAMLISTING"> --<font color= --"#000000">int set_field_type(FIELD *field, /* field to alter */ -+ int vmin, int vmax); /* valid range */</PRE -+><P -+>Valid characters consist of an optional leading minus and digits. -+The range check is performed on exit. If the range maximum is less -+than or equal to the minimum, the range is ignored. </P -+><P -+>If the value passes its range check, it is padded with as many leading -+zero digits as necessary to meet the padding argument. </P -+><P -+>A TYPE_INTEGER value buffer can conveniently be interpreted with the C library -+function atoi(3).</P -+><H1 -+CLASS="BRIDGEHEAD" -+><A -+NAME="AEN1090" -+></A -+>TYPE_NUMERIC</H1 -+><P -+>This field type accepts a decimal number. It is set up as follows: </P -+><PRE -+CLASS="PROGRAMLISTING" -+>int set_field_type(FIELD *field, /* field to alter */ - TYPE_NUMERIC, /* type to associate */ - int padding, /* # places of precision */ -- int vmin, int vmax); /* valid range */</font> --</pre></td> --</tr> --</table> --<p>Valid characters consist of an optional leading minus and --digits. possibly including a decimal point. The range check is --performed on exit. If the range maximum is less than or equal to --the minimum, the range is ignored.</p> --<p>If the value passes its range check, it is padded with as many --trailing zero digits as necessary to meet the padding argument.</p> --<p>A TYPE_NUMERIC value buffer can conveniently be interpreted with --the C library function atof(3).</p> --<h1 class="BRIDGEHEAD"><a name="AEN1096" id= --"AEN1096"></a>TYPE_REGEXP</h1> --<p>This field type accepts data matching a regular expression. It --is set up as follows:</p> --<table border="0" bgcolor="#E0E0E0" width="100%"> --<tr> --<td> --<pre class="PROGRAMLISTING"> --<font color= --"#000000">int set_field_type(FIELD *field, /* field to alter */ -+ int vmin, int vmax); /* valid range */</PRE -+><P -+>Valid characters consist of an optional leading minus and digits. possibly -+including a decimal point. The range check is performed on exit. If the -+range maximum is less than or equal to the minimum, the range is -+ignored. </P -+><P -+>If the value passes its range check, it is padded with as many trailing -+zero digits as necessary to meet the padding argument. </P -+><P -+>A TYPE_NUMERIC value buffer can conveniently be interpreted with the C library -+function atof(3).</P -+><H1 -+CLASS="BRIDGEHEAD" -+><A -+NAME="AEN1096" -+></A -+>TYPE_REGEXP</H1 -+><P -+>This field type accepts data matching a regular expression. It is set up -+as follows: </P -+><PRE -+CLASS="PROGRAMLISTING" -+>int set_field_type(FIELD *field, /* field to alter */ - TYPE_REGEXP, /* type to associate */ -- char *regexp); /* expression to match */</font> --</pre></td> --</tr> --</table> --<p>The syntax for regular expressions is that of regcomp(3). The --check for regular-expression match is performed on exit.</p> --</div> --<div class="SECT2"> --<hr> --<h3 class="SECT2"><a name="FORMDRIVER" id="FORMDRIVER">18.6. Form --Driver: The work horse of the forms system</a></h3> --<p>As in the menu system, form_driver() plays a very important role --in forms system. All types of requests to forms system should be --funneled through form_driver().</p> --<table border="0" bgcolor="#E0E0E0" width="100%"> --<tr> --<td> --<pre class="PROGRAMLISTING"> --<font color= --"#000000">int form_driver(FORM *form, /* form on which to operate */ -- int request) /* form request code */</font> --</pre></td> --</tr> --</table> --<p>As you have seen some of the examples above, you have to be in a --loop looking for user input and then decide whether it's a field --data or a form request. The form requests are then passed to --form_driver() to do the work.</p> --<p>The requests roughly can be divided into following categories. --Different requests and their usage is explained below:</p> --<div class="SECT3"> --<hr> --<h4 class="SECT3"><a name="PAGENAVREQ" id="PAGENAVREQ">18.6.1. Page --Navigation Requests</a></h4> --<p>These requests cause page-level moves through the form, --triggering display of a new form screen. A form can be made of --multiple pages. If you have a big form with lot of fields and --logical sections, then you can divide the form into pages. The --function set_new_page() to set a new page at the field --specified.</p> --<table border="0" bgcolor="#E0E0E0" width="100%"> --<tr> --<td> --<pre class="PROGRAMLISTING"> --<font color= --"#000000">int set_new_page(FIELD *field,/* Field at which page break to be set or unset */ -- bool new_page_flag); /* should be TRUE to put a break */</font> --</pre></td> --</tr> --</table> --<p>The following requests allow you to move to different pages</p> --<ul> --<li> --<p><em>REQ_NEXT_PAGE</em> Move to the next form page.</p> --</li> --<li> --<p><em>REQ_PREV_PAGE</em> Move to the previous form page.</p> --</li> --<li> --<p><em>REQ_FIRST_PAGE</em> Move to the first form page.</p> --</li> --<li> --<p><em>REQ_LAST_PAGE</em> Move to the last form page.</p> --</li> --</ul> --<p>These requests treat the list as cyclic; that is, REQ_NEXT_PAGE --from the last page goes to the first, and REQ_PREV_PAGE from the --first page goes to the last.</p> --</div> --<div class="SECT3"> --<hr> --<h4 class="SECT3"><a name="INTERFIELDNAVREQ" id= --"INTERFIELDNAVREQ">18.6.2. Inter-Field Navigation Requests</a></h4> --<p>These requests handle navigation between fields on the same --page.</p> --<ul> --<li> --<p><em>REQ_NEXT_FIELD</em> Move to next field.</p> --</li> --<li> --<p><em>REQ_PREV_FIELD</em> Move to previous field.</p> --</li> --<li> --<p><em>REQ_FIRST_FIELD</em> Move to the first field.</p> --</li> --<li> --<p><em>REQ_LAST_FIELD</em> Move to the last field.</p> --</li> --<li> --<p><em>REQ_SNEXT_FIELD</em> Move to sorted next field.</p> --</li> --<li> --<p><em>REQ_SPREV_FIELD</em> Move to sorted previous field.</p> --</li> --<li> --<p><em>REQ_SFIRST_FIELD</em> Move to the sorted first field.</p> --</li> --<li> --<p><em>REQ_SLAST_FIELD</em> Move to the sorted last field.</p> --</li> --<li> --<p><em>REQ_LEFT_FIELD</em> Move left to field.</p> --</li> --<li> --<p><em>REQ_RIGHT_FIELD</em> Move right to field.</p> --</li> --<li> --<p><em>REQ_UP_FIELD</em> Move up to field.</p> --</li> --<li> --<p><em>REQ_DOWN_FIELD</em> Move down to field.</p> --</li> --</ul> --<p>These requests treat the list of fields on a page as cyclic; --that is, REQ_NEXT_FIELD from the last field goes to the first, and --REQ_PREV_FIELD from the first field goes to the last. The order of --the fields for these (and the REQ_FIRST_FIELD and REQ_LAST_FIELD --requests) is simply the order of the field pointers in the form --array (as set up by new_form() or set_form_fields()</p> --<p>It is also possible to traverse the fields as if they had been --sorted in screen-position order, so the sequence goes left-to-right --and top-to-bottom. To do this, use the second group of four --sorted-movement requests.</p> --<p>Finally, it is possible to move between fields using visual --directions up, down, right, and left. To accomplish this, use the --third group of four requests. Note, however, that the position of a --form for purposes of these requests is its upper-left corner.</p> --<p>For example, suppose you have a multi-line field B, and two --single-line fields A and C on the same line with B, with A to the --left of B and C to the right of B. A REQ_MOVE_RIGHT from A will go --to B only if A, B, and C all share the same first line; otherwise --it will skip over B to C.</p> --</div> --<div class="SECT3"> --<hr> --<h4 class="SECT3"><a name="INTRAFIELDNAVREQ" id= --"INTRAFIELDNAVREQ">18.6.3. Intra-Field Navigation Requests</a></h4> --<p>These requests drive movement of the edit cursor within the --currently selected field.</p> --<ul> --<li> --<p><em>REQ_NEXT_CHAR</em> Move to next character.</p> --</li> --<li> --<p><em>REQ_PREV_CHAR</em> Move to previous character.</p> --</li> --<li> --<p><em>REQ_NEXT_LINE</em> Move to next line.</p> --</li> --<li> --<p><em>REQ_PREV_LINE</em> Move to previous line.</p> --</li> --<li> --<p><em>REQ_NEXT_WORD</em> Move to next word.</p> --</li> --<li> --<p><em>REQ_PREV_WORD</em> Move to previous word.</p> --</li> --<li> --<p><em>REQ_BEG_FIELD</em> Move to beginning of field.</p> --</li> --<li> --<p><em>REQ_END_FIELD</em> Move to end of field.</p> --</li> --<li> --<p><em>REQ_BEG_LINE</em> Move to beginning of line.</p> --</li> --<li> --<p><em>REQ_END_LINE</em> Move to end of line.</p> --</li> --<li> --<p><em>REQ_LEFT_CHAR</em> Move left in field.</p> --</li> --<li> --<p><em>REQ_RIGHT_CHAR</em> Move right in field.</p> --</li> --<li> --<p><em>REQ_UP_CHAR</em> Move up in field.</p> --</li> --<li> --<p><em>REQ_DOWN_CHAR</em> Move down in field.</p> --</li> --</ul> --<p>Each word is separated from the previous and next characters by --whitespace. The commands to move to beginning and end of line or --field look for the first or last non-pad character in their --ranges.</p> --</div> --<div class="SECT3"> --<hr> --<h4 class="SECT3"><a name="SCROLLREQ" id="SCROLLREQ">18.6.4. --Scrolling Requests</a></h4> --<p>Fields that are dynamic and have grown and fields explicitly --created with offscreen rows are scrollable. One-line fields scroll --horizontally; multi-line fields scroll vertically. Most scrolling --is triggered by editing and intra-field movement (the library --scrolls the field to keep the cursor visible). It is possible to --explicitly request scrolling with the following requests:</p> --<ul> --<li> --<p><em>REQ_SCR_FLINE</em> Scroll vertically forward a line.</p> --</li> --<li> --<p><em>REQ_SCR_BLINE</em> Scroll vertically backward a line.</p> --</li> --<li> --<p><em>REQ_SCR_FPAGE</em> Scroll vertically forward a page.</p> --</li> --<li> --<p><em>REQ_SCR_BPAGE</em> Scroll vertically backward a page.</p> --</li> --<li> --<p><em>REQ_SCR_FHPAGE</em> Scroll vertically forward half a --page.</p> --</li> --<li> --<p><em>REQ_SCR_BHPAGE</em> Scroll vertically backward half a --page.</p> --</li> --<li> --<p><em>REQ_SCR_FCHAR</em> Scroll horizontally forward a --character.</p> --</li> --<li> --<p><em>REQ_SCR_BCHAR</em> Scroll horizontally backward a --character.</p> --</li> --<li> --<p><em>REQ_SCR_HFLINE</em> Scroll horizontally one field width --forward.</p> --</li> --<li> --<p><em>REQ_SCR_HBLINE</em> Scroll horizontally one field width --backward.</p> --</li> --<li> --<p><em>REQ_SCR_HFHALF</em> Scroll horizontally one half field width --forward.</p> --</li> --<li> --<p><em>REQ_SCR_HBHALF</em> Scroll horizontally one half field width --backward.</p> --</li> --</ul> --<p>For scrolling purposes, a page of a field is the height of its --visible part.</p> --</div> --<div class="SECT3"> --<hr> --<h4 class="SECT3"><a name="EDITREQ" id="EDITREQ">18.6.5. Editing --Requests</a></h4> --<p>When you pass the forms driver an ASCII character, it is treated --as a request to add the character to the field's data buffer. --Whether this is an insertion or a replacement depends on the --field's edit mode (insertion is the default.</p> --<p>The following requests support editing the field and changing --the edit mode:</p> --<ul> --<li> --<p><em>REQ_INS_MODE</em> Set insertion mode.</p> --</li> --<li> --<p><em>REQ_OVL_MODE</em> Set overlay mode.</p> --</li> --<li> --<p><em>REQ_NEW_LINE</em> New line request (see below for --explanation).</p> --</li> --<li> --<p><em>REQ_INS_CHAR</em> Insert space at character location.</p> --</li> --<li> --<p><em>REQ_INS_LINE</em> Insert blank line at character --location.</p> --</li> --<li> --<p><em>REQ_DEL_CHAR</em> Delete character at cursor.</p> --</li> --<li> --<p><em>REQ_DEL_PREV</em> Delete previous word at cursor.</p> --</li> --<li> --<p><em>REQ_DEL_LINE</em> Delete line at cursor.</p> --</li> --<li> --<p><em>REQ_DEL_WORD</em> Delete word at cursor.</p> --</li> --<li> --<p><em>REQ_CLR_EOL</em> Clear to end of line.</p> --</li> --<li> --<p><em>REQ_CLR_EOF</em> Clear to end of field.</p> --</li> --<li> --<p><em>REQ_CLR_FIELD</em> Clear entire field.</p> --</li> --</ul> --<p>The behavior of the REQ_NEW_LINE and REQ_DEL_PREV requests is --complicated and partly controlled by a pair of forms options. The --special cases are triggered when the cursor is at the beginning of --a field, or on the last line of the field.</p> --<p>First, we consider REQ_NEW_LINE:</p> --<p>The normal behavior of REQ_NEW_LINE in insert mode is to break --the current line at the position of the edit cursor, inserting the --portion of the current line after the cursor as a new line --following the current and moving the cursor to the beginning of --that new line (you may think of this as inserting a newline in the --field buffer).</p> --<p>The normal behavior of REQ_NEW_LINE in overlay mode is to clear --the current line from the position of the edit cursor to end of --line. The cursor is then moved to the beginning of the next --line.</p> --<p>However, REQ_NEW_LINE at the beginning of a field, or on the --last line of a field, instead does a REQ_NEXT_FIELD. O_NL_OVERLOAD --option is off, this special action is disabled.</p> --<p>Now, let us consider REQ_DEL_PREV:</p> --<p>The normal behavior of REQ_DEL_PREV is to delete the previous --character. If insert mode is on, and the cursor is at the start of --a line, and the text on that line will fit on the previous one, it --instead appends the contents of the current line to the previous --one and deletes the current line (you may think of this as deleting --a newline from the field buffer).</p> --<p>However, REQ_DEL_PREV at the beginning of a field is instead --treated as a REQ_PREV_FIELD.</p> --<p>If the O_BS_OVERLOAD option is off, this special action is --disabled and the forms driver just returns E_REQUEST_DENIED.</p> --</div> --<div class="SECT3"> --<hr> --<h4 class="SECT3"><a name="ORDERREQ" id="ORDERREQ">18.6.6. Order --Requests</a></h4> --<p>If the type of your field is ordered, and has associated --functions for getting the next and previous values of the type from --a given value, there are requests that can fetch that value into --the field buffer:</p> --<ul> --<li> --<p><em>REQ_NEXT_CHOICE</em> Place the successor value of the --current value in the buffer.</p> --</li> --<li> --<p><em>REQ_PREV_CHOICE</em> Place the predecessor value of the --current value in the buffer.</p> --</li> --</ul> --<p>Of the built-in field types, only TYPE_ENUM has built-in --successor and predecessor functions. When you define a field type --of your own (see Custom Validation Types), you can associate our --own ordering functions.</p> --</div> --<div class="SECT3"> --<hr> --<h4 class="SECT3"><a name="APPLICCOMMANDS" id= --"APPLICCOMMANDS">18.6.7. Application Commands</a></h4> --<p>Form requests are represented as integers above the curses value --greater than KEY_MAX and less than or equal to the constant --MAX_COMMAND. A value within this range gets ignored by --form_driver(). So this can be used for any purpose by the --application. It can be treated as an application specific action --and take corresponding action.</p> --</div> --</div> --</div> --<div class="SECT1"> --<hr> --<h2 class="SECT1"><a name="TOOLS" id="TOOLS">19. Tools and Widget --Libraries</a></h2> --<p>Now that you have seen the capabilities of ncurses and its --sister libraries, you are rolling your sleeves up and gearing for a --project that heavily manipulates screen. But wait.. It can be --pretty difficult to write and maintain complex GUI widgets in plain --ncurses or even with the additional libraries. There are some --ready-to-use tools and widget libraries that can be used instead of --writing your own widgets. You can use some of them, get ideas from --the code, or even extend them.</p> --<div class="SECT2"> --<hr> --<h3 class="SECT2"><a name="CDK" id="CDK">19.1. CDK (Curses --Development Kit)</a></h3> --<p>In the author's words</p> --<p><em>CDK stands for 'Curses Development Kit' and it currently --contains 21 ready to use widgets which facilitate the speedy --development of full screen curses programs.</em></p> --<p>The kit provides some useful widgets, which can be used in your --programs directly. It's pretty well written and the documentation --is very good. The examples in the examples directory can be a good --place to start for beginners. The CDK can be downloaded from --<a href="http://invisible-island.net/cdk/" target= --"_top">http://invisible-island.net/cdk/</a> . Follow the --instructions in README file to install it.</p> --<div class="SECT3"> --<hr> --<h4 class="SECT3"><a name="WIDGETLIST" id="WIDGETLIST">19.1.1. --Widget List</a></h4> --<p>The following is the list of widgets provided with cdk and their --description.</p> --<table border="0" bgcolor="#E0E0E0" width="100%"> --<tr> --<td> --<pre class="PROGRAMLISTING"> --<font color="#000000">Widget Type Quick Description -+ char *regexp); /* expression to match */</PRE -+><P -+>The syntax for regular expressions is that of regcomp(3). -+The check for regular-expression match is performed on exit.</P -+></DIV -+><DIV -+CLASS="SECT2" -+><HR><H3 -+CLASS="SECT2" -+><A -+NAME="FORMDRIVER" -+>18.6. Form Driver: The work horse of the forms system</A -+></H3 -+><P -+>As in the menu system, form_driver() plays a very important role in forms -+system. All types of requests to forms system should be funneled through -+form_driver().</P -+><PRE -+CLASS="PROGRAMLISTING" -+>int form_driver(FORM *form, /* form on which to operate */ -+ int request) /* form request code */</PRE -+><P -+>As you have seen some of the examples above, you have to be in a loop looking -+for user input and then decide whether it's a field data or a form request. The -+form requests are then passed to form_driver() to do the work.</P -+><P -+>The requests roughly can be divided into following categories. Different -+requests and their usage is explained below:</P -+><DIV -+CLASS="SECT3" -+><HR><H4 -+CLASS="SECT3" -+><A -+NAME="PAGENAVREQ" -+>18.6.1. Page Navigation Requests</A -+></H4 -+><P -+>These requests cause page-level moves through the form, triggering display of a -+new form screen. A form can be made of multiple pages. If you have a big form -+with lot of fields and logical sections, then you can divide the form into -+pages. The function set_new_page() to set a new page at the field specified.</P -+><PRE -+CLASS="PROGRAMLISTING" -+>int set_new_page(FIELD *field,/* Field at which page break to be set or unset */ -+ bool new_page_flag); /* should be TRUE to put a break */</PRE -+><P -+>The following requests allow you to move to different pages</P -+><P -+></P -+><UL -+><LI -+><P -+><SPAN -+CLASS="emphasis" -+><I -+CLASS="EMPHASIS" -+>REQ_NEXT_PAGE</I -+></SPAN -+> Move to the next form page.</P -+></LI -+><LI -+><P -+><SPAN -+CLASS="emphasis" -+><I -+CLASS="EMPHASIS" -+>REQ_PREV_PAGE</I -+></SPAN -+> Move to the previous -+form page.</P -+></LI -+><LI -+><P -+><SPAN -+CLASS="emphasis" -+><I -+CLASS="EMPHASIS" -+>REQ_FIRST_PAGE</I -+></SPAN -+> Move to the first form page.</P -+></LI -+><LI -+><P -+><SPAN -+CLASS="emphasis" -+><I -+CLASS="EMPHASIS" -+>REQ_LAST_PAGE</I -+></SPAN -+> Move to the last form page. </P -+></LI -+></UL -+><P -+>These requests treat the list as cyclic; that is, REQ_NEXT_PAGE from the -+last page goes to the first, and REQ_PREV_PAGE from the first page goes to -+the last.</P -+></DIV -+><DIV -+CLASS="SECT3" -+><HR><H4 -+CLASS="SECT3" -+><A -+NAME="INTERFIELDNAVREQ" -+>18.6.2. Inter-Field Navigation Requests</A -+></H4 -+><P -+>These requests handle navigation between fields on the same page.</P -+><P -+></P -+><UL -+><LI -+><P -+><SPAN -+CLASS="emphasis" -+><I -+CLASS="EMPHASIS" -+>REQ_NEXT_FIELD</I -+></SPAN -+> -+ Move to next field. </P -+></LI -+><LI -+><P -+><SPAN -+CLASS="emphasis" -+><I -+CLASS="EMPHASIS" -+>REQ_PREV_FIELD</I -+></SPAN -+> -+ Move to previous field. </P -+></LI -+><LI -+><P -+><SPAN -+CLASS="emphasis" -+><I -+CLASS="EMPHASIS" -+>REQ_FIRST_FIELD</I -+></SPAN -+> -+ Move to the first field. </P -+></LI -+><LI -+><P -+><SPAN -+CLASS="emphasis" -+><I -+CLASS="EMPHASIS" -+>REQ_LAST_FIELD</I -+></SPAN -+> -+ Move to the last field. </P -+></LI -+><LI -+><P -+><SPAN -+CLASS="emphasis" -+><I -+CLASS="EMPHASIS" -+>REQ_SNEXT_FIELD</I -+></SPAN -+> -+ Move to sorted next field. </P -+></LI -+><LI -+><P -+><SPAN -+CLASS="emphasis" -+><I -+CLASS="EMPHASIS" -+>REQ_SPREV_FIELD</I -+></SPAN -+> -+ Move to sorted previous field. </P -+></LI -+><LI -+><P -+><SPAN -+CLASS="emphasis" -+><I -+CLASS="EMPHASIS" -+>REQ_SFIRST_FIELD</I -+></SPAN -+> -+ Move to the sorted first field. </P -+></LI -+><LI -+><P -+><SPAN -+CLASS="emphasis" -+><I -+CLASS="EMPHASIS" -+>REQ_SLAST_FIELD</I -+></SPAN -+> -+ Move to the sorted last field. </P -+></LI -+><LI -+><P -+><SPAN -+CLASS="emphasis" -+><I -+CLASS="EMPHASIS" -+>REQ_LEFT_FIELD</I -+></SPAN -+> -+ Move left to field. </P -+></LI -+><LI -+><P -+><SPAN -+CLASS="emphasis" -+><I -+CLASS="EMPHASIS" -+>REQ_RIGHT_FIELD</I -+></SPAN -+> -+ Move right to field. </P -+></LI -+><LI -+><P -+><SPAN -+CLASS="emphasis" -+><I -+CLASS="EMPHASIS" -+>REQ_UP_FIELD</I -+></SPAN -+> -+ Move up to field. </P -+></LI -+><LI -+><P -+><SPAN -+CLASS="emphasis" -+><I -+CLASS="EMPHASIS" -+>REQ_DOWN_FIELD</I -+></SPAN -+> -+ Move down to field. </P -+></LI -+></UL -+><P -+>These requests treat the list of fields on a page as cyclic; that is, -+REQ_NEXT_FIELD from the last field goes to the first, and REQ_PREV_FIELD -+from the first field goes to the last. The order of the fields for these -+(and the REQ_FIRST_FIELD and REQ_LAST_FIELD requests) is simply the order of -+the field pointers in the form array (as set up by new_form() or -+set_form_fields()</P -+><P -+>It is also possible to traverse the fields as if they had been sorted in -+screen-position order, so the sequence goes left-to-right and top-to-bottom. -+To do this, use the second group of four sorted-movement requests.</P -+><P -+>Finally, it is possible to move between fields using visual directions up, -+down, right, and left. To accomplish this, use the third group of four -+requests. Note, however, that the position of a form for purposes of these -+requests is its upper-left corner.</P -+><P -+>For example, suppose you have a multi-line field B, and two single-line -+fields A and C on the same line with B, with A to the left of B and C to the -+right of B. A REQ_MOVE_RIGHT from A will go to B only if A, B, and C all -+share the same first line; otherwise it will skip over B to C.</P -+></DIV -+><DIV -+CLASS="SECT3" -+><HR><H4 -+CLASS="SECT3" -+><A -+NAME="INTRAFIELDNAVREQ" -+>18.6.3. Intra-Field Navigation Requests</A -+></H4 -+><P -+>These requests drive movement of the edit cursor within the currently -+selected field.</P -+><P -+></P -+><UL -+><LI -+><P -+><SPAN -+CLASS="emphasis" -+><I -+CLASS="EMPHASIS" -+>REQ_NEXT_CHAR</I -+></SPAN -+> -+ Move to next character. </P -+></LI -+><LI -+><P -+><SPAN -+CLASS="emphasis" -+><I -+CLASS="EMPHASIS" -+>REQ_PREV_CHAR</I -+></SPAN -+> -+ Move to previous character. </P -+></LI -+><LI -+><P -+><SPAN -+CLASS="emphasis" -+><I -+CLASS="EMPHASIS" -+>REQ_NEXT_LINE</I -+></SPAN -+> -+ Move to next line. </P -+></LI -+><LI -+><P -+><SPAN -+CLASS="emphasis" -+><I -+CLASS="EMPHASIS" -+>REQ_PREV_LINE</I -+></SPAN -+> -+ Move to previous line. </P -+></LI -+><LI -+><P -+><SPAN -+CLASS="emphasis" -+><I -+CLASS="EMPHASIS" -+>REQ_NEXT_WORD</I -+></SPAN -+> -+ Move to next word. </P -+></LI -+><LI -+><P -+><SPAN -+CLASS="emphasis" -+><I -+CLASS="EMPHASIS" -+>REQ_PREV_WORD</I -+></SPAN -+> -+ Move to previous word. </P -+></LI -+><LI -+><P -+><SPAN -+CLASS="emphasis" -+><I -+CLASS="EMPHASIS" -+>REQ_BEG_FIELD</I -+></SPAN -+> -+ Move to beginning of field. </P -+></LI -+><LI -+><P -+><SPAN -+CLASS="emphasis" -+><I -+CLASS="EMPHASIS" -+>REQ_END_FIELD</I -+></SPAN -+> -+ Move to end of field. </P -+></LI -+><LI -+><P -+><SPAN -+CLASS="emphasis" -+><I -+CLASS="EMPHASIS" -+>REQ_BEG_LINE</I -+></SPAN -+> -+ Move to beginning of line. </P -+></LI -+><LI -+><P -+><SPAN -+CLASS="emphasis" -+><I -+CLASS="EMPHASIS" -+>REQ_END_LINE</I -+></SPAN -+> -+ Move to end of line. </P -+></LI -+><LI -+><P -+><SPAN -+CLASS="emphasis" -+><I -+CLASS="EMPHASIS" -+>REQ_LEFT_CHAR</I -+></SPAN -+> -+ Move left in field. </P -+></LI -+><LI -+><P -+><SPAN -+CLASS="emphasis" -+><I -+CLASS="EMPHASIS" -+>REQ_RIGHT_CHAR</I -+></SPAN -+> -+ Move right in field. </P -+></LI -+><LI -+><P -+><SPAN -+CLASS="emphasis" -+><I -+CLASS="EMPHASIS" -+>REQ_UP_CHAR</I -+></SPAN -+> -+ Move up in field. </P -+></LI -+><LI -+><P -+><SPAN -+CLASS="emphasis" -+><I -+CLASS="EMPHASIS" -+>REQ_DOWN_CHAR</I -+></SPAN -+> -+ Move down in field. </P -+></LI -+></UL -+><P -+>Each word is separated from the previous and next characters by whitespace. -+The commands to move to beginning and end of line or field look for the -+first or last non-pad character in their ranges.</P -+></DIV -+><DIV -+CLASS="SECT3" -+><HR><H4 -+CLASS="SECT3" -+><A -+NAME="SCROLLREQ" -+>18.6.4. Scrolling Requests</A -+></H4 -+><P -+>Fields that are dynamic and have grown and fields explicitly created with -+offscreen rows are scrollable. One-line fields scroll horizontally; -+multi-line fields scroll vertically. Most scrolling is triggered by editing -+and intra-field movement (the library scrolls the field to keep the cursor -+visible). It is possible to explicitly request scrolling with the following -+requests:</P -+><P -+></P -+><UL -+><LI -+><P -+><SPAN -+CLASS="emphasis" -+><I -+CLASS="EMPHASIS" -+>REQ_SCR_FLINE</I -+></SPAN -+> -+ Scroll vertically forward a line. </P -+></LI -+><LI -+><P -+><SPAN -+CLASS="emphasis" -+><I -+CLASS="EMPHASIS" -+>REQ_SCR_BLINE</I -+></SPAN -+> -+ Scroll vertically backward a line. </P -+></LI -+><LI -+><P -+><SPAN -+CLASS="emphasis" -+><I -+CLASS="EMPHASIS" -+>REQ_SCR_FPAGE</I -+></SPAN -+> -+ Scroll vertically forward a page. </P -+></LI -+><LI -+><P -+><SPAN -+CLASS="emphasis" -+><I -+CLASS="EMPHASIS" -+>REQ_SCR_BPAGE</I -+></SPAN -+> -+ Scroll vertically backward a page. </P -+></LI -+><LI -+><P -+><SPAN -+CLASS="emphasis" -+><I -+CLASS="EMPHASIS" -+>REQ_SCR_FHPAGE</I -+></SPAN -+> -+ Scroll vertically forward half a page. </P -+></LI -+><LI -+><P -+><SPAN -+CLASS="emphasis" -+><I -+CLASS="EMPHASIS" -+>REQ_SCR_BHPAGE</I -+></SPAN -+> -+ Scroll vertically backward half a page. </P -+></LI -+><LI -+><P -+><SPAN -+CLASS="emphasis" -+><I -+CLASS="EMPHASIS" -+>REQ_SCR_FCHAR</I -+></SPAN -+> -+ Scroll horizontally forward a character. </P -+></LI -+><LI -+><P -+><SPAN -+CLASS="emphasis" -+><I -+CLASS="EMPHASIS" -+>REQ_SCR_BCHAR</I -+></SPAN -+> -+ Scroll horizontally backward a character. </P -+></LI -+><LI -+><P -+><SPAN -+CLASS="emphasis" -+><I -+CLASS="EMPHASIS" -+>REQ_SCR_HFLINE</I -+></SPAN -+> -+ Scroll horizontally one field width forward. </P -+></LI -+><LI -+><P -+><SPAN -+CLASS="emphasis" -+><I -+CLASS="EMPHASIS" -+>REQ_SCR_HBLINE</I -+></SPAN -+> -+ Scroll horizontally one field width backward. </P -+></LI -+><LI -+><P -+><SPAN -+CLASS="emphasis" -+><I -+CLASS="EMPHASIS" -+>REQ_SCR_HFHALF</I -+></SPAN -+> -+ Scroll horizontally one half field width forward. </P -+></LI -+><LI -+><P -+><SPAN -+CLASS="emphasis" -+><I -+CLASS="EMPHASIS" -+>REQ_SCR_HBHALF</I -+></SPAN -+> -+ Scroll horizontally one half field width backward. </P -+></LI -+></UL -+><P -+>For scrolling purposes, a page of a field is the height of its visible part.</P -+></DIV -+><DIV -+CLASS="SECT3" -+><HR><H4 -+CLASS="SECT3" -+><A -+NAME="EDITREQ" -+>18.6.5. Editing Requests</A -+></H4 -+><P -+>When you pass the forms driver an ASCII character, it is treated as a -+request to add the character to the field's data buffer. Whether this is an -+insertion or a replacement depends on the field's edit mode (insertion is -+the default.</P -+><P -+>The following requests support editing the field and changing the edit mode:</P -+><P -+></P -+><UL -+><LI -+><P -+><SPAN -+CLASS="emphasis" -+><I -+CLASS="EMPHASIS" -+>REQ_INS_MODE</I -+></SPAN -+> -+ Set insertion mode. </P -+></LI -+><LI -+><P -+><SPAN -+CLASS="emphasis" -+><I -+CLASS="EMPHASIS" -+>REQ_OVL_MODE</I -+></SPAN -+> -+ Set overlay mode. </P -+></LI -+><LI -+><P -+><SPAN -+CLASS="emphasis" -+><I -+CLASS="EMPHASIS" -+>REQ_NEW_LINE</I -+></SPAN -+> -+ New line request (see below for explanation). </P -+></LI -+><LI -+><P -+><SPAN -+CLASS="emphasis" -+><I -+CLASS="EMPHASIS" -+>REQ_INS_CHAR</I -+></SPAN -+> -+ Insert space at character location. </P -+></LI -+><LI -+><P -+><SPAN -+CLASS="emphasis" -+><I -+CLASS="EMPHASIS" -+>REQ_INS_LINE</I -+></SPAN -+> -+ Insert blank line at character location. </P -+></LI -+><LI -+><P -+><SPAN -+CLASS="emphasis" -+><I -+CLASS="EMPHASIS" -+>REQ_DEL_CHAR</I -+></SPAN -+> -+ Delete character at cursor. </P -+></LI -+><LI -+><P -+><SPAN -+CLASS="emphasis" -+><I -+CLASS="EMPHASIS" -+>REQ_DEL_PREV</I -+></SPAN -+> -+ Delete previous word at cursor. </P -+></LI -+><LI -+><P -+><SPAN -+CLASS="emphasis" -+><I -+CLASS="EMPHASIS" -+>REQ_DEL_LINE</I -+></SPAN -+> -+ Delete line at cursor. </P -+></LI -+><LI -+><P -+><SPAN -+CLASS="emphasis" -+><I -+CLASS="EMPHASIS" -+>REQ_DEL_WORD</I -+></SPAN -+> -+ Delete word at cursor. </P -+></LI -+><LI -+><P -+><SPAN -+CLASS="emphasis" -+><I -+CLASS="EMPHASIS" -+>REQ_CLR_EOL</I -+></SPAN -+> -+ Clear to end of line. </P -+></LI -+><LI -+><P -+><SPAN -+CLASS="emphasis" -+><I -+CLASS="EMPHASIS" -+>REQ_CLR_EOF</I -+></SPAN -+> -+ Clear to end of field. </P -+></LI -+><LI -+><P -+><SPAN -+CLASS="emphasis" -+><I -+CLASS="EMPHASIS" -+>REQ_CLR_FIELD</I -+></SPAN -+> -+ Clear entire field. </P -+></LI -+></UL -+><P -+>The behavior of the REQ_NEW_LINE and REQ_DEL_PREV requests is complicated -+and partly controlled by a pair of forms options. The special cases are -+triggered when the cursor is at the beginning of a field, or on the last -+line of the field.</P -+><P -+>First, we consider REQ_NEW_LINE:</P -+><P -+>The normal behavior of REQ_NEW_LINE in insert mode is to break the current -+line at the position of the edit cursor, inserting the portion of the -+current line after the cursor as a new line following the current and moving -+the cursor to the beginning of that new line (you may think of this as -+inserting a newline in the field buffer).</P -+><P -+>The normal behavior of REQ_NEW_LINE in overlay mode is to clear the current -+line from the position of the edit cursor to end of line. The cursor is then -+moved to the beginning of the next line.</P -+><P -+>However, REQ_NEW_LINE at the beginning of a field, or on the last line of a -+field, instead does a REQ_NEXT_FIELD. O_NL_OVERLOAD option is off, this -+special action is disabled.</P -+><P -+>Now, let us consider REQ_DEL_PREV:</P -+><P -+>The normal behavior of REQ_DEL_PREV is to delete the previous character. If -+insert mode is on, and the cursor is at the start of a line, and the text on -+that line will fit on the previous one, it instead appends the contents of -+the current line to the previous one and deletes the current line (you may -+think of this as deleting a newline from the field buffer).</P -+><P -+>However, REQ_DEL_PREV at the beginning of a field is instead treated as a -+REQ_PREV_FIELD.</P -+><P -+>If the O_BS_OVERLOAD option is off, this special action is disabled and the -+forms driver just returns E_REQUEST_DENIED.</P -+></DIV -+><DIV -+CLASS="SECT3" -+><HR><H4 -+CLASS="SECT3" -+><A -+NAME="ORDERREQ" -+>18.6.6. Order Requests</A -+></H4 -+><P -+>If the type of your field is ordered, and has associated functions for -+getting the next and previous values of the type from a given value, there -+are requests that can fetch that value into the field buffer:</P -+><P -+></P -+><UL -+><LI -+><P -+><SPAN -+CLASS="emphasis" -+><I -+CLASS="EMPHASIS" -+>REQ_NEXT_CHOICE</I -+></SPAN -+> -+ Place the successor value of the current value in the buffer. -+ </P -+></LI -+><LI -+><P -+><SPAN -+CLASS="emphasis" -+><I -+CLASS="EMPHASIS" -+>REQ_PREV_CHOICE</I -+></SPAN -+> -+ Place the predecessor value of the current value in the buffer. -+ </P -+></LI -+></UL -+><P -+>Of the built-in field types, only TYPE_ENUM has built-in successor and -+predecessor functions. When you define a field type of your own (see Custom -+Validation Types), you can associate our own ordering functions.</P -+></DIV -+><DIV -+CLASS="SECT3" -+><HR><H4 -+CLASS="SECT3" -+><A -+NAME="APPLICCOMMANDS" -+>18.6.7. Application Commands</A -+></H4 -+><P -+>Form requests are represented as integers above the curses value greater than -+KEY_MAX and less than or equal to the constant MAX_COMMAND. A value within this -+range gets ignored by form_driver(). So this can be used for any purpose by the -+application. It can be treated as an application specific action and take -+corresponding action.</P -+></DIV -+></DIV -+></DIV -+><DIV -+CLASS="SECT1" -+><HR><H2 -+CLASS="SECT1" -+><A -+NAME="TOOLS" -+>19. Tools and Widget Libraries</A -+></H2 -+><P -+> -+Now that you have seen the capabilities of ncurses and its sister libraries, you -+are rolling your sleeves up and gearing for a project that heavily manipulates -+screen. But wait.. It can be pretty difficult to write and maintain complex GUI -+widgets in plain ncurses or even with the additional libraries. There are some -+ready-to-use tools and widget libraries that can be used instead of writing your -+own widgets. You can use some of them, get ideas from the code, or even extend -+them.</P -+><DIV -+CLASS="SECT2" -+><HR><H3 -+CLASS="SECT2" -+><A -+NAME="CDK" -+>19.1. CDK (Curses Development Kit)</A -+></H3 -+><P -+>In the author's words </P -+><P -+><SPAN -+CLASS="emphasis" -+><I -+CLASS="EMPHASIS" -+> -+CDK stands for 'Curses Development Kit' and it currently contains 21 ready -+to use widgets which facilitate the speedy development of full screen -+curses programs. </I -+></SPAN -+></P -+><P -+>The kit provides some useful widgets, which can be used in your programs -+directly. It's pretty well written and the documentation is very good. The -+examples in the examples directory can be a good place to start for beginners. -+The CDK can be downloaded from <A -+HREF="http://invisible-island.net/cdk/" -+TARGET="_top" -+>http://invisible-island.net/cdk/</A -+> -+. Follow the instructions in -+README file to install it.</P -+><DIV -+CLASS="SECT3" -+><HR><H4 -+CLASS="SECT3" -+><A -+NAME="WIDGETLIST" -+>19.1.1. Widget List</A -+></H4 -+><P -+>The following is the list of widgets provided with cdk and their description.</P -+><PRE -+CLASS="PROGRAMLISTING" -+>Widget Type Quick Description - =========================================================================== - Alphalist Allows a user to select from a list of words, with - the ability to narrow the search list by typing in a -@@ -6199,215 +8368,346 @@ - dates and phone numbers. - Viewer This is a file/information viewer. Very useful - when you need to display loads of information. --===========================================================================</font> --</pre></td> --</tr> --</table> --<p>A few of the widgets are modified by Thomas Dickey in recent --versions.</p> --</div> --<div class="SECT3"> --<hr> --<h4 class="SECT3"><a name="CDKATTRACT" id="CDKATTRACT">19.1.2. Some --Attractive Features</a></h4> --<p>Apart from making our life easier with readily usable widgets, --cdk solves one frustrating problem with printing multi colored --strings, justified strings elegantly. Special formatting tags can --be embedded in the strings which are passed to CDK functions. For --Example</p> --<p>If the string</p> --<table border="0" bgcolor="#E0E0E0" width="100%"> --<tr> --<td> --<pre class="PROGRAMLISTING"> --<font color= --"#000000">"&lt;/B/1&gt;This line should have a yellow foreground and a blue --background.&lt;!1&gt;"</font> --</pre></td> --</tr> --</table> --<p>given as a parameter to newCDKLabel(), it prints the line with --yellow foreground and blue background. There are other tags --available for justifying string, embedding special drawing --characters etc.. Please refer to the man page cdk_display(3X) for --details. The man page explains the usage with nice examples.</p> --</div> --<div class="SECT3"> --<hr> --<h4 class="SECT3"><a name="CDKCONCLUSION" id= --"CDKCONCLUSION">19.1.3. Conclusion</a></h4> --<p>All in all, CDK is a well-written package of widgets, which if --used properly can form a strong frame work for developing complex --GUI.</p> --</div> --</div> --<div class="SECT2"> --<hr> --<h3 class="SECT2"><a name="DIALOG" id="DIALOG">19.2. The --dialog</a></h3> --<p>Long long ago, in September 1994, when few people knew linux, --Jeff Tranter wrote an <a href= --"http://www2.linuxjournal.com/lj-issues/issue5/2807.html" target= --"_top">article</a> on dialog in Linux Journal. He starts the --article with these words..</p> --<p><em>Linux is based on the Unix operating system, but also --features a number of unique and useful kernel features and --application programs that often go beyond what is available under --Unix. One little-known gem is "dialog", a utility for creating --professional-looking dialog boxes from within shell scripts. This --article presents a tutorial introduction to the dialog utility, and --shows examples of how and where it can be used</em></p> --<p>As he explains, dialog is a real gem in making --professional-looking dialog boxes with ease. It creates a variety --of dialog boxes, menus, check lists etc.. It is usually installed --by default. If not, you can download it from <a href= --"http://invisible-island.net/dialog/" target="_top">Thomas --Dickey</a>'s site.</p> --<p>The above-mentioned article gives a very good overview of its --uses and capabilites. The man page has more details. It can be used --in variety of situations. One good example is building of linux --kernel in text mode. Linux kernel uses a modified version of dialog --tailored for its needs.</p> --<p>dialog was initially designed to be used with shell scripts. If --you want to use its functionality in a c program, then you can use --libdialog. The documentation regarding this is sparse. Definitive --reference is the dialog.h header file which comes with the library. --You may need to hack here and there to get the required output. The --source is easily customizable. I have used it on a number of --occasions by modifying the code.</p> --</div> --<div class="SECT2"> --<hr> --<h3 class="SECT2"><a name="PERLCURSES" id="PERLCURSES">19.3. Perl --Curses Modules CURSES::FORM and CURSES::WIDGETS</a></h3> --<p>The perl module Curses, Curses::Form and Curses::Widgets give --access to curses from perl. If you have curses and basic perl is --installed, you can get these modules from <a href= --"http://www.cpan.org/modules/01modules.index.html" target= --"_top">CPAN All Modules page</a>. Get the three zipped modules in --the Curses category. Once installed you can use these modules from --perl scripts like any other module. For more information on perl --modules see perlmod man page. The above modules come with good --documentation and they have some demo scripts to test the --functionality. Though the widgets provided are very rudimentary, --these modules provide good access to curses library from perl.</p> --<p>Some of my code examples are converted to perl by Anuradha --Ratnaweera and they are available in the <var class= --"LITERAL">perl</var> directory.</p> --<p>For more information see man pages Curses(3) , Curses::Form(3) --and Curses::Widgets(3). These pages are installed only when the --above modules are acquired and installed.</p> --</div> --</div> --<div class="SECT1"> --<hr> --<h2 class="SECT1"><a name="JUSTFORFUN" id="JUSTFORFUN">20. Just For --Fun !!!</a></h2> --<p>This section contains few programs written by me just for fun. --They don't signify a better programming practice or the best way of --using ncurses. They are provided here so as to allow beginners to --get ideas and add more programs to this section. If you have --written a couple of nice, simple programs in curses and want them --to included here, contact <a href="mailto:ppadala@gmail.com" --target="_top">me</a>.</p> --<div class="SECT2"> --<hr> --<h3 class="SECT2"><a name="GAMEOFLIFE" id="GAMEOFLIFE">20.1. The --Game of Life</a></h3> --<p>Game of life is a wonder of math. In <a href= --"http://www.math.com/students/wonders/life/life.html" target= --"_top">Paul Callahan</a>'s words</p> --<table border="0" bgcolor="#E0E0E0" width="100%"> --<tr> --<td> --<pre class="PROGRAMLISTING"> --<font color= --"#000000"><em>The Game of Life (or simply Life) is not a game in the conventional sense. There -+===========================================================================</PRE -+><P -+>A few of the widgets are modified by Thomas Dickey in recent versions.</P -+></DIV -+><DIV -+CLASS="SECT3" -+><HR><H4 -+CLASS="SECT3" -+><A -+NAME="CDKATTRACT" -+>19.1.2. Some Attractive Features</A -+></H4 -+><P -+>Apart from making our life easier with readily usable widgets, cdk solves one -+frustrating problem with printing multi colored strings, justified strings -+elegantly. Special formatting tags can be embedded in the strings which are -+passed to CDK functions. For Example</P -+><P -+>If the string</P -+><PRE -+CLASS="PROGRAMLISTING" -+>"&lt;/B/1&gt;This line should have a yellow foreground and a blue -+background.&lt;!1&gt;"</PRE -+><P -+>given as a parameter to newCDKLabel(), it prints the line with yellow foreground -+and blue background. There are other tags available for justifying string, -+embedding special drawing characters etc.. Please refer to the man page -+cdk_display(3X) for details. The man page explains the usage with nice examples.</P -+></DIV -+><DIV -+CLASS="SECT3" -+><HR><H4 -+CLASS="SECT3" -+><A -+NAME="CDKCONCLUSION" -+>19.1.3. Conclusion</A -+></H4 -+><P -+>All in all, CDK is a well-written package of widgets, which if used properly can -+form a strong frame work for developing complex GUI.</P -+></DIV -+></DIV -+><DIV -+CLASS="SECT2" -+><HR><H3 -+CLASS="SECT2" -+><A -+NAME="DIALOG" -+>19.2. The dialog</A -+></H3 -+><P -+>Long long ago, in September 1994, when few people knew linux, Jeff Tranter wrote -+an <A -+HREF="http://www2.linuxjournal.com/lj-issues/issue5/2807.html" -+TARGET="_top" -+>article</A -+> on dialog in Linux Journal. He starts the article with these words..</P -+><P -+><SPAN -+CLASS="emphasis" -+><I -+CLASS="EMPHASIS" -+>Linux is based on the Unix operating system, but also features a number of -+unique and useful kernel features and application programs that often go beyond -+what is available under Unix. One little-known gem is "dialog", a utility for -+creating professional-looking dialog boxes from within shell scripts. This -+article presents a tutorial introduction to the dialog utility, and shows -+examples of how and where it can be used</I -+></SPAN -+></P -+><P -+> -+As he explains, dialog is a real gem in making professional-looking dialog boxes -+with ease. It creates a variety of dialog boxes, menus, check lists etc.. It is -+usually installed by default. If not, you can download it from <A -+HREF="http://invisible-island.net/dialog/" -+TARGET="_top" -+>Thomas Dickey</A -+>'s site. </P -+><P -+>The above-mentioned article gives a very good overview of its uses and -+capabilites. The man page has more details. It can be used in variety of -+situations. One good example is building of linux kernel in text mode. Linux -+kernel uses a modified version of dialog tailored for its needs. </P -+><P -+>dialog was initially designed to be used with shell scripts. If you want to use -+its functionality in a c program, then you can use libdialog. The documentation -+regarding this is sparse. Definitive reference is the dialog.h header file which -+comes with the library. You may need to hack here and there to get the required -+output. The source is easily customizable. I have used it on a number of -+occasions by modifying the code.</P -+></DIV -+><DIV -+CLASS="SECT2" -+><HR><H3 -+CLASS="SECT2" -+><A -+NAME="PERLCURSES" -+>19.3. Perl Curses Modules CURSES::FORM and CURSES::WIDGETS</A -+></H3 -+><P -+>The perl module Curses, Curses::Form and Curses::Widgets give access to curses -+from perl. If you have curses and basic perl is installed, you can get these -+modules from <A -+HREF="http://www.cpan.org/modules/01modules.index.html" -+TARGET="_top" -+> CPAN -+All Modules page</A -+>. Get the three zipped modules in the Curses category. -+Once installed you can use these modules from perl scripts like any other -+module. For more information on perl modules see perlmod man page. The above -+modules come with good documentation and they have some demo scripts to test the -+functionality. Though the widgets provided are very rudimentary, these modules -+provide good access to curses library from perl.</P -+><P -+>Some of my code examples are converted to perl by Anuradha Ratnaweera and they -+are available in the <TT -+CLASS="LITERAL" -+>perl</TT -+> directory.</P -+><P -+> -+For more information see man pages Curses(3) , Curses::Form(3) and -+Curses::Widgets(3). These pages are installed only when the above modules are -+acquired and installed.</P -+></DIV -+></DIV -+><DIV -+CLASS="SECT1" -+><HR><H2 -+CLASS="SECT1" -+><A -+NAME="JUSTFORFUN" -+>20. Just For Fun !!!</A -+></H2 -+><P -+>This section contains few programs written by me just for fun. They don't -+signify a better programming practice or the best way of using ncurses. They are -+provided here so as to allow beginners to get ideas and add more programs to -+this section. If you have written a couple of nice, simple programs in curses -+and want them to included here, contact <A -+HREF="mailto:ppadala@gmail.com" -+TARGET="_top" -+>me</A -+>.</P -+><DIV -+CLASS="SECT2" -+><HR><H3 -+CLASS="SECT2" -+><A -+NAME="GAMEOFLIFE" -+>20.1. The Game of Life</A -+></H3 -+><P -+>Game of life is a wonder of math. In -+<A -+HREF="http://www.math.com/students/wonders/life/life.html" -+TARGET="_top" -+>Paul Callahan</A -+>'s words</P -+><PRE -+CLASS="PROGRAMLISTING" -+><SPAN -+CLASS="emphasis" -+><I -+CLASS="EMPHASIS" -+>The Game of Life (or simply Life) is not a game in the conventional sense. There - are no players, and no winning or losing. Once the "pieces" are placed in the - starting position, the rules determine everything that happens later. - Nevertheless, Life is full of surprises! In most cases, it is impossible to look - at a starting position (or pattern) and see what will happen in the future. The --only way to find out is to follow the rules of the game.</em></font> --</pre></td> --</tr> --</table> --<p>This program starts with a simple inverted U pattern and shows --how wonderful life works. There is a lot of room for improvement in --the program. You can let the user enter pattern of his choice or --even take input from a file. You can also change rules and play --with a lot of variations. Search on <a href="http://www.google.com" --target="_top">google</a> for interesting information on game of --life.</p> --<p><em>File Path: JustForFun/life.c</em></p> --</div> --<div class="SECT2"> --<hr> --<h3 class="SECT2"><a name="MAGIC" id="MAGIC">20.2. Magic --Square</a></h3> --<p>Magic Square, another wonder of math, is very simple to --understand but very difficult to make. In a magic square sum of the --numbers in each row, each column is equal. Even diagnol sum can be --equal. There are many variations which have special properties.</p> --<p>This program creates a simple magic square of odd order.</p> --<p><em>File Path: JustForFun/magic.c</em></p> --</div> --<div class="SECT2"> --<hr> --<h3 class="SECT2"><a name="HANOI" id="HANOI">20.3. Towers of --Hanoi</a></h3> --<p>The famous towers of hanoi solver. The aim of the game is to --move the disks on the first peg to last peg, using middle peg as a --temporary stay. The catch is not to place a larger disk over a --small disk at any time.</p> --<p><em>File Path: JustForFun/hanoi.c</em></p> --</div> --<div class="SECT2"> --<hr> --<h3 class="SECT2"><a name="QUEENS" id="QUEENS">20.4. Queens --Puzzle</a></h3> --<p>The objective of the famous N-Queen puzzle is to put N queens on --a N X N chess board without attacking each other.</p> --<p>This program solves it with a simple backtracking technique.</p> --<p><em>File Path: JustForFun/queens.c</em></p> --</div> --<div class="SECT2"> --<hr> --<h3 class="SECT2"><a name="SHUFFLE" id="SHUFFLE">20.5. --Shuffle</a></h3> --<p>A fun game, if you have time to kill.</p> --<p><em>File Path: JustForFun/shuffle.c</em></p> --</div> --<div class="SECT2"> --<hr> --<h3 class="SECT2"><a name="TT" id="TT">20.6. Typing Tutor</a></h3> --<p>A simple typing tutor, I created more out of need than for ease --of use. If you know how to put your fingers correctly on the --keyboard, but lack practice, this can be helpful.</p> --<p><em>File Path: JustForFun/tt.c</em></p> --</div> --</div> --<div class="SECT1"> --<hr> --<h2 class="SECT1"><a name="REF" id="REF">21. References</a></h2> --<ul> --<li> --<p>NCURSES man pages</p> --</li> --<li> --<p>NCURSES FAQ at <a href= --"http://invisible-island.net/ncurses/ncurses.faq.html" target= --"_top">http://invisible-island.net/ncurses/ncurses.faq.html</a></p> --</li> --<li> --<p>Writing programs with NCURSES by Eric Raymond and Zeyd M. --Ben-Halim at <a href= --"http://invisible-island.net/ncurses/ncurses-intro.html" target= --"_top">http://invisible-island.net/ncurses/ncurses-intro.html</a> - --somewhat obsolete. I was inspired by this document and the --structure of this HOWTO follows from the original document</p> --</li> --</ul> --</div> --</div> --</body> --</html> -+only way to find out is to follow the rules of the game.</I -+></SPAN -+></PRE -+><P -+>This program starts with a simple inverted U pattern and shows how wonderful -+life works. There is a lot of room for improvement in the program. You can let -+the user enter pattern of his choice or even take input from a file. You can -+also change rules and play with a lot of variations. Search on <A -+HREF="http://www.google.com" -+TARGET="_top" -+>google</A -+> for interesting information on game -+of life.</P -+><P -+><SPAN -+CLASS="emphasis" -+><I -+CLASS="EMPHASIS" -+>File Path: JustForFun/life.c</I -+></SPAN -+></P -+></DIV -+><DIV -+CLASS="SECT2" -+><HR><H3 -+CLASS="SECT2" -+><A -+NAME="MAGIC" -+>20.2. Magic Square</A -+></H3 -+><P -+>Magic Square, another wonder of math, is very simple to understand but very -+difficult to make. In a magic square sum of the numbers in each row, each column -+is equal. Even diagnol sum can be equal. There are many variations which have -+special properties.</P -+><P -+>This program creates a simple magic square of odd order.</P -+><P -+><SPAN -+CLASS="emphasis" -+><I -+CLASS="EMPHASIS" -+>File Path: JustForFun/magic.c</I -+></SPAN -+></P -+></DIV -+><DIV -+CLASS="SECT2" -+><HR><H3 -+CLASS="SECT2" -+><A -+NAME="HANOI" -+>20.3. Towers of Hanoi</A -+></H3 -+><P -+>The famous towers of hanoi solver. The aim of the game is to move the disks on -+the first peg to last peg, using middle peg as a temporary stay. The catch is -+not to place a larger disk over a small disk at any time.</P -+><P -+><SPAN -+CLASS="emphasis" -+><I -+CLASS="EMPHASIS" -+>File Path: JustForFun/hanoi.c</I -+></SPAN -+></P -+></DIV -+><DIV -+CLASS="SECT2" -+><HR><H3 -+CLASS="SECT2" -+><A -+NAME="QUEENS" -+>20.4. Queens Puzzle</A -+></H3 -+><P -+>The objective of the famous N-Queen puzzle is to put N queens on a N X N chess -+board without attacking each other. </P -+><P -+>This program solves it with a simple backtracking technique.</P -+><P -+><SPAN -+CLASS="emphasis" -+><I -+CLASS="EMPHASIS" -+>File Path: JustForFun/queens.c</I -+></SPAN -+></P -+></DIV -+><DIV -+CLASS="SECT2" -+><HR><H3 -+CLASS="SECT2" -+><A -+NAME="SHUFFLE" -+>20.5. Shuffle</A -+></H3 -+><P -+>A fun game, if you have time to kill. </P -+><P -+><SPAN -+CLASS="emphasis" -+><I -+CLASS="EMPHASIS" -+>File Path: JustForFun/shuffle.c</I -+></SPAN -+></P -+></DIV -+><DIV -+CLASS="SECT2" -+><HR><H3 -+CLASS="SECT2" -+><A -+NAME="TT" -+>20.6. Typing Tutor</A -+></H3 -+><P -+>A simple typing tutor, I created more out of need than for ease of use. If you -+know how to put your fingers correctly on the keyboard, but lack practice, this -+can be helpful. </P -+><P -+><SPAN -+CLASS="emphasis" -+><I -+CLASS="EMPHASIS" -+>File Path: JustForFun/tt.c</I -+></SPAN -+></P -+></DIV -+></DIV -+><DIV -+CLASS="SECT1" -+><HR><H2 -+CLASS="SECT1" -+><A -+NAME="REF" -+>21. References</A -+></H2 -+><P -+></P -+><UL -+><LI -+><P -+>NCURSES man pages </P -+></LI -+><LI -+><P -+>NCURSES FAQ at <A -+HREF="http://invisible-island.net/ncurses/ncurses.faq.html" -+TARGET="_top" -+>http://invisible-island.net/ncurses/ncurses.faq.html</A -+> -+ </P -+></LI -+><LI -+><P -+>Writing programs with NCURSES by Eric Raymond and Zeyd M. -+Ben-Halim at -+<A -+HREF="http://invisible-island.net/ncurses/ncurses-intro.html" -+TARGET="_top" -+>http://invisible-island.net/ncurses/ncurses-intro.html</A -+> - somewhat -+obsolete. I was inspired by this document and the structure of this HOWTO -+follows from the original document</P -+></LI -+></UL -+></DIV -+></DIV -+></BODY -+></HTML -+> -\ Kein Zeilenumbruch am Dateiende. -diff -Naur ncurses-5.9/doc/ncurses-intro.doc ncurses-5.9.patch/doc/ncurses-intro.doc ---- ncurses-5.9/doc/ncurses-intro.doc 2007-03-04 00:45:04.000000000 +0100 -+++ ncurses-5.9.patch/doc/ncurses-intro.doc 2014-09-01 16:33:22.337792091 +0200 -@@ -333,6 +333,7 @@ - - Here is a sample program to motivate the discussion: - #include <curses.h> -+#include <curses.h> - #include <signal.h> - - static void finish(int sig); -diff -Naur ncurses-5.9/form/fld_arg.c ncurses-5.9.patch/form/fld_arg.c ---- ncurses-5.9/form/fld_arg.c 2010-01-23 22:14:35.000000000 +0100 -+++ ncurses-5.9.patch/form/fld_arg.c 2014-09-01 16:33:22.337792091 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2004,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -32,7 +32,7 @@ - - #include "form.priv.h" - --MODULE_ID("$Id: fld_arg.c,v 1.12 2010/01/23 21:14:35 tom Exp $") -+MODULE_ID("$Id: fld_arg.c,v 1.13 2012/06/10 00:27:49 tom Exp $") - - /*--------------------------------------------------------------------------- - | Facility : libnform -@@ -71,7 +71,7 @@ - - if (typ != 0 && make_arg != (void *)0) - { -- typ->status |= _HAS_ARGS; -+ SetStatus(typ, _HAS_ARGS); - typ->makearg = make_arg; - typ->copyarg = copy_arg; - typ->freearg = free_arg; -diff -Naur ncurses-5.9/form/fld_def.c ncurses-5.9.patch/form/fld_def.c ---- ncurses-5.9/form/fld_def.c 2010-01-23 22:14:35.000000000 +0100 -+++ ncurses-5.9.patch/form/fld_def.c 2014-09-01 16:33:22.337792091 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2007,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -32,7 +32,7 @@ - - #include "form.priv.h" - --MODULE_ID("$Id: fld_def.c,v 1.38 2010/01/23 21:14:35 tom Exp $") -+MODULE_ID("$Id: fld_def.c,v 1.40 2012/03/11 00:37:16 tom Exp $") - - /* this can't be readonly */ - static FIELD default_field = -@@ -65,8 +65,7 @@ - NCURSES_FIELD_EXTENSION - }; - --NCURSES_EXPORT_VAR(FIELD *) --_nc_Default_Field = &default_field; -+NCURSES_EXPORT_VAR(FIELD *) _nc_Default_Field = &default_field; - - /*--------------------------------------------------------------------------- - | Facility : libnform -@@ -186,10 +185,12 @@ - { - if ((typ->status & _LINKED_TYPE) != 0) - { -- assert(argp != 0); -- _nc_Free_Argument(typ->left, argp->left); -- _nc_Free_Argument(typ->right, argp->right); -- free(argp); -+ if (argp != 0) -+ { -+ _nc_Free_Argument(typ->left, argp->left); -+ _nc_Free_Argument(typ->right, argp->right); -+ free(argp); -+ } - } - else - { -@@ -293,14 +294,14 @@ - { - T((T_CREATE("field %p"), (void *)New_Field)); - *New_Field = default_field; -- New_Field->rows = rows; -- New_Field->cols = cols; -+ New_Field->rows = (short) rows; -+ New_Field->cols = (short) cols; - New_Field->drows = rows + nrow; - New_Field->dcols = cols; -- New_Field->frow = frow; -- New_Field->fcol = fcol; -+ New_Field->frow = (short) frow; -+ New_Field->fcol = (short) fcol; - New_Field->nrow = nrow; -- New_Field->nbuf = nbuf; -+ New_Field->nbuf = (short) nbuf; - New_Field->link = New_Field; - - #if USE_WIDEC_SUPPORT -diff -Naur ncurses-5.9/form/fld_dup.c ncurses-5.9.patch/form/fld_dup.c ---- ncurses-5.9/form/fld_dup.c 2010-01-23 22:14:35.000000000 +0100 -+++ ncurses-5.9.patch/form/fld_dup.c 2014-09-01 16:33:22.337792091 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2007,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -32,7 +32,7 @@ - - #include "form.priv.h" - --MODULE_ID("$Id: fld_dup.c,v 1.13 2010/01/23 21:14:35 tom Exp $") -+MODULE_ID("$Id: fld_dup.c,v 1.14 2012/03/11 00:37:16 tom Exp $") - - /*--------------------------------------------------------------------------- - | Facility : libnform -@@ -60,8 +60,8 @@ - { - T((T_CREATE("field %p"), (void *)New_Field)); - *New_Field = *_nc_Default_Field; -- New_Field->frow = frow; -- New_Field->fcol = fcol; -+ New_Field->frow = (short) frow; -+ New_Field->fcol = (short) fcol; - New_Field->link = New_Field; - New_Field->rows = field->rows; - New_Field->cols = field->cols; -diff -Naur ncurses-5.9/form/fld_ftchoice.c ncurses-5.9.patch/form/fld_ftchoice.c ---- ncurses-5.9/form/fld_ftchoice.c 2010-01-23 22:14:35.000000000 +0100 -+++ ncurses-5.9.patch/form/fld_ftchoice.c 2014-09-01 16:33:22.337792091 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -32,7 +32,7 @@ - - #include "form.priv.h" - --MODULE_ID("$Id: fld_ftchoice.c,v 1.12 2010/01/23 21:14:35 tom Exp $") -+MODULE_ID("$Id: fld_ftchoice.c,v 1.13 2012/06/10 00:27:49 tom Exp $") - - /*--------------------------------------------------------------------------- - | Facility : libnform -@@ -56,7 +56,7 @@ - if (!typ || !next_choice || !prev_choice) - RETURN(E_BAD_ARGUMENT); - -- typ->status |= _HAS_CHOICE; -+ SetStatus(typ, _HAS_CHOICE); - #if NCURSES_INTEROP_FUNCS - typ->enum_next.onext = next_choice; - typ->enum_prev.oprev = prev_choice; -diff -Naur ncurses-5.9/form/fld_ftlink.c ncurses-5.9.patch/form/fld_ftlink.c ---- ncurses-5.9/form/fld_ftlink.c 2010-01-23 22:14:35.000000000 +0100 -+++ ncurses-5.9.patch/form/fld_ftlink.c 2014-09-01 16:33:22.337792091 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2007,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -32,7 +32,7 @@ - - #include "form.priv.h" - --MODULE_ID("$Id: fld_ftlink.c,v 1.14 2010/01/23 21:14:35 tom Exp $") -+MODULE_ID("$Id: fld_ftlink.c,v 1.15 2012/06/10 00:27:49 tom Exp $") - - /*--------------------------------------------------------------------------- - | Facility : libnform -@@ -62,11 +62,11 @@ - { - T((T_CREATE("fieldtype %p"), (void *)nftyp)); - *nftyp = *_nc_Default_FieldType; -- nftyp->status |= _LINKED_TYPE; -+ SetStatus(nftyp, _LINKED_TYPE); - if ((type1->status & _HAS_ARGS) || (type2->status & _HAS_ARGS)) -- nftyp->status |= _HAS_ARGS; -+ SetStatus(nftyp, _HAS_ARGS); - if ((type1->status & _HAS_CHOICE) || (type2->status & _HAS_CHOICE)) -- nftyp->status |= _HAS_CHOICE; -+ SetStatus(nftyp, _HAS_CHOICE); - nftyp->left = type1; - nftyp->right = type2; - type1->ref++; -diff -Naur ncurses-5.9/form/fld_just.c ncurses-5.9.patch/form/fld_just.c ---- ncurses-5.9/form/fld_just.c 2010-01-23 22:14:35.000000000 +0100 -+++ ncurses-5.9.patch/form/fld_just.c 2014-09-01 16:33:22.338792092 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2004,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -32,7 +32,7 @@ - - #include "form.priv.h" - --MODULE_ID("$Id: fld_just.c,v 1.12 2010/01/23 21:14:35 tom Exp $") -+MODULE_ID("$Id: fld_just.c,v 1.13 2012/03/11 00:37:16 tom Exp $") - - /*--------------------------------------------------------------------------- - | Facility : libnform -@@ -59,7 +59,7 @@ - Normalize_Field(field); - if (field->just != just) - { -- field->just = just; -+ field->just = (short) just; - res = _nc_Synchronize_Attributes(field); - } - else -diff -Naur ncurses-5.9/form/fld_link.c ncurses-5.9.patch/form/fld_link.c ---- ncurses-5.9/form/fld_link.c 2010-01-23 22:14:35.000000000 +0100 -+++ ncurses-5.9.patch/form/fld_link.c 2014-09-01 16:33:22.338792092 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2007,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -32,7 +32,7 @@ - - #include "form.priv.h" - --MODULE_ID("$Id: fld_link.c,v 1.12 2010/01/23 21:14:35 tom Exp $") -+MODULE_ID("$Id: fld_link.c,v 1.13 2012/03/11 00:37:16 tom Exp $") - - /*--------------------------------------------------------------------------- - | Facility : libnform -@@ -61,8 +61,8 @@ - { - T((T_CREATE("field %p"), (void *)New_Field)); - *New_Field = *_nc_Default_Field; -- New_Field->frow = frow; -- New_Field->fcol = fcol; -+ New_Field->frow = (short) frow; -+ New_Field->fcol = (short) fcol; - - New_Field->link = field->link; - field->link = New_Field; -diff -Naur ncurses-5.9/form/fld_max.c ncurses-5.9.patch/form/fld_max.c ---- ncurses-5.9/form/fld_max.c 2010-01-23 22:14:36.000000000 +0100 -+++ ncurses-5.9.patch/form/fld_max.c 2014-09-01 16:33:22.338792092 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2004,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -32,7 +32,7 @@ - - #include "form.priv.h" - --MODULE_ID("$Id: fld_max.c,v 1.10 2010/01/23 21:14:36 tom Exp $") -+MODULE_ID("$Id: fld_max.c,v 1.13 2013/08/24 22:59:28 tom Exp $") - - /*--------------------------------------------------------------------------- - | Facility : libnform -@@ -62,13 +62,13 @@ - RETURN(E_BAD_ARGUMENT); - } - field->maxgrow = maxgrow; -- field->status &= ~_MAY_GROW; -- if (!(field->opts & O_STATIC)) -+ ClrStatus(field, _MAY_GROW); -+ if (!((unsigned)field->opts & O_STATIC)) - { - if ((maxgrow == 0) || - (single_line_field && (field->dcols < maxgrow)) || - (!single_line_field && (field->drows < maxgrow))) -- field->status |= _MAY_GROW; -+ SetStatus(field, _MAY_GROW); - } - } - RETURN(E_OK); -diff -Naur ncurses-5.9/form/fld_move.c ncurses-5.9.patch/form/fld_move.c ---- ncurses-5.9/form/fld_move.c 2010-01-23 22:14:36.000000000 +0100 -+++ ncurses-5.9.patch/form/fld_move.c 2014-09-01 16:33:22.338792092 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2004,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -32,7 +32,7 @@ - - #include "form.priv.h" - --MODULE_ID("$Id: fld_move.c,v 1.10 2010/01/23 21:14:36 tom Exp $") -+MODULE_ID("$Id: fld_move.c,v 1.11 2012/03/11 00:37:16 tom Exp $") - - /*--------------------------------------------------------------------------- - | Facility : libnform -@@ -56,8 +56,8 @@ - if (field->form) - RETURN(E_CONNECTED); - -- field->frow = frow; -- field->fcol = fcol; -+ field->frow = (short) frow; -+ field->fcol = (short) fcol; - RETURN(E_OK); - } - -diff -Naur ncurses-5.9/form/fld_page.c ncurses-5.9.patch/form/fld_page.c ---- ncurses-5.9/form/fld_page.c 2010-01-23 22:14:36.000000000 +0100 -+++ ncurses-5.9.patch/form/fld_page.c 2014-09-01 16:33:22.338792092 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2004,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -32,7 +32,7 @@ - - #include "form.priv.h" - --MODULE_ID("$Id: fld_page.c,v 1.10 2010/01/23 21:14:36 tom Exp $") -+MODULE_ID("$Id: fld_page.c,v 1.12 2012/06/10 00:12:47 tom Exp $") - - /*--------------------------------------------------------------------------- - | Facility : libnform -@@ -54,9 +54,9 @@ - RETURN(E_CONNECTED); - - if (new_page_flag) -- field->status |= _NEWPAGE; -+ SetStatus(field, _NEWPAGE); - else -- field->status &= ~_NEWPAGE; -+ ClrStatus(field, _NEWPAGE); - - RETURN(E_OK); - } -diff -Naur ncurses-5.9/form/fld_stat.c ncurses-5.9.patch/form/fld_stat.c ---- ncurses-5.9/form/fld_stat.c 2010-01-23 22:14:36.000000000 +0100 -+++ ncurses-5.9.patch/form/fld_stat.c 2014-09-01 16:33:22.338792092 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2004,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -32,7 +32,7 @@ - - #include "form.priv.h" - --MODULE_ID("$Id: fld_stat.c,v 1.12 2010/01/23 21:14:36 tom Exp $") -+MODULE_ID("$Id: fld_stat.c,v 1.14 2012/06/10 00:13:09 tom Exp $") - - /*--------------------------------------------------------------------------- - | Facility : libnform -@@ -51,9 +51,9 @@ - Normalize_Field(field); - - if (status) -- field->status |= _CHANGED; -+ SetStatus(field, _CHANGED); - else -- field->status &= ~_CHANGED; -+ ClrStatus(field, _CHANGED); - - RETURN(E_OK); - } -diff -Naur ncurses-5.9/form/form.h ncurses-5.9.patch/form/form.h ---- ncurses-5.9/form/form.h 2009-11-07 20:31:11.000000000 +0100 -+++ ncurses-5.9.patch/form/form.h 2014-09-01 16:33:22.338792092 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2004,2009 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2009,2013 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -30,7 +30,7 @@ - * Author: Juergen Pfeifer, 1995,1997 * - ****************************************************************************/ - --/* $Id: form.h,v 0.21 2009/11/07 19:31:11 tom Exp $ */ -+/* $Id: form.h,v 0.23 2013/12/07 17:57:32 tom Exp $ */ - - #ifndef FORM_H - #define FORM_H -@@ -396,6 +396,9 @@ - extern NCURSES_EXPORT(int) unpost_form (FORM *); - extern NCURSES_EXPORT(int) pos_form_cursor (FORM *); - extern NCURSES_EXPORT(int) form_driver (FORM *,int); -+# if NCURSES_WIDECHAR -+extern NCURSES_EXPORT(int) form_driver_w (FORM *,int,wchar_t); -+# endif - extern NCURSES_EXPORT(int) set_form_userptr (FORM *,void *); - extern NCURSES_EXPORT(int) set_form_opts (FORM *,Form_Options); - extern NCURSES_EXPORT(int) form_opts_on (FORM *,Form_Options); -diff -Naur ncurses-5.9/form/form.priv.h ncurses-5.9.patch/form/form.priv.h ---- ncurses-5.9/form/form.priv.h 2009-11-07 22:26:43.000000000 +0100 -+++ ncurses-5.9.patch/form/form.priv.h 2014-09-01 16:33:22.338792092 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2008,2009 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2009,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -30,11 +30,11 @@ - * Author: Juergen Pfeifer, 1995,1997 * - ****************************************************************************/ - --/* $Id: form.priv.h,v 0.32 2009/11/07 21:26:43 tom Exp $ */ -+/* $Id: form.priv.h,v 0.33 2012/03/11 00:37:46 tom Exp $ */ - - #ifndef FORM_PRIV_H - #define FORM_PRIV_H 1 -- -+/* *INDENT-OFF*/ - #include "curses.priv.h" - #include "mf_common.h" - -@@ -119,7 +119,7 @@ - - /* Calculate the total size of all buffers for this field */ - #define Total_Buffer_Size(field) \ -- ( (Buffer_Length(field) + 1) * (1+(field)->nbuf) * sizeof(FIELD_CELL) ) -+ ( (size_t)(Buffer_Length(field) + 1) * (size_t)(1+(field)->nbuf) * sizeof(FIELD_CELL) ) - - /* Logic to determine whether or not a field is single lined */ - #define Single_Line_Field(field) \ -@@ -293,5 +293,6 @@ - result = ((*buffer || (l < width)) ? FALSE : TRUE); \ - } - #endif -+/* *INDENT-ON*/ - - #endif /* FORM_PRIV_H */ -diff -Naur ncurses-5.9/form/frm_data.c ncurses-5.9.patch/form/frm_data.c ---- ncurses-5.9/form/frm_data.c 2010-01-23 22:14:36.000000000 +0100 -+++ ncurses-5.9.patch/form/frm_data.c 2014-09-01 16:33:22.338792092 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2005,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2010,2013 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -32,7 +32,7 @@ - - #include "form.priv.h" - --MODULE_ID("$Id: frm_data.c,v 1.15 2010/01/23 21:14:36 tom Exp $") -+MODULE_ID("$Id: frm_data.c,v 1.16 2013/08/24 22:44:05 tom Exp $") - - /*--------------------------------------------------------------------------- - | Facility : libnform -@@ -103,7 +103,7 @@ - } - } - #else -- cell = winch(w); -+ cell = (FIELD_CELL) winch(w); - if (ChCharOf(cell) != ChCharOf(pad)) - { - result = FALSE; -diff -Naur ncurses-5.9/form/frm_def.c ncurses-5.9.patch/form/frm_def.c ---- ncurses-5.9/form/frm_def.c 2010-01-23 22:14:36.000000000 +0100 -+++ ncurses-5.9.patch/form/frm_def.c 2014-09-01 16:33:22.339792094 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -32,7 +32,7 @@ - - #include "form.priv.h" - --MODULE_ID("$Id: frm_def.c,v 1.25 2010/01/23 21:14:36 tom Exp $") -+MODULE_ID("$Id: frm_def.c,v 1.26 2012/03/11 00:37:16 tom Exp $") - - /* this can't be readonly */ - static FORM default_form = -@@ -199,14 +199,14 @@ - for (j = 0; j < field_cnt; j++) - { - if (j == 0) -- pg->pmin = j; -+ pg->pmin = (short) j; - else - { - if (fields[j]->status & _NEWPAGE) - { -- pg->pmax = j - 1; -+ pg->pmax = (short) (j - 1); - pg++; -- pg->pmin = j; -+ pg->pmin = (short) j; - } - } - -@@ -214,14 +214,14 @@ - maximum_col_in_field = fields[j]->fcol + fields[j]->cols; - - if (form->rows < maximum_row_in_field) -- form->rows = maximum_row_in_field; -+ form->rows = (short) maximum_row_in_field; - if (form->cols < maximum_col_in_field) -- form->cols = maximum_col_in_field; -+ form->cols = (short) maximum_col_in_field; - } - -- pg->pmax = field_cnt - 1; -- form->maxfield = field_cnt; -- form->maxpage = page_nr; -+ pg->pmax = (short) (field_cnt - 1); -+ form->maxfield = (short) field_cnt; -+ form->maxpage = (short) page_nr; - - /* Sort fields on form pages */ - for (page_nr = 0; page_nr < form->maxpage; page_nr++) -@@ -230,8 +230,8 @@ - - for (j = form->page[page_nr].pmin; j <= form->page[page_nr].pmax; j++) - { -- fields[j]->index = j; -- fields[j]->page = page_nr; -+ fields[j]->index = (short) j; -+ fields[j]->page = (short) page_nr; - fld = Insert_Field_By_Position(fields[j], fld); - } - if (fld) -diff -Naur ncurses-5.9/form/frm_driver.c ncurses-5.9.patch/form/frm_driver.c ---- ncurses-5.9/form/frm_driver.c 2010-05-01 23:11:43.000000000 +0200 -+++ ncurses-5.9.patch/form/frm_driver.c 2014-09-01 16:33:22.339792094 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2013,2014 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -32,7 +32,7 @@ - - #include "form.priv.h" - --MODULE_ID("$Id: frm_driver.c,v 1.98 2010/05/01 21:11:43 tom Exp $") -+MODULE_ID("$Id: frm_driver.c,v 1.111 2014/03/08 22:08:20 Xin.Li Exp $") - - /*---------------------------------------------------------------------------- - This is the core module of the form library. It contains the majority -@@ -172,7 +172,7 @@ - instead of a derived window because it contains invisible parts. - This is true for non-public fields and for scrollable fields. */ - #define Has_Invisible_Parts(field) \ -- (!((field)->opts & O_PUBLIC) || \ -+ (!((unsigned)(field)->opts & O_PUBLIC) || \ - Is_Scroll_Field(field)) - - /* Logic to decide whether or not a field needs justification */ -@@ -180,21 +180,21 @@ - (((field)->just != NO_JUSTIFICATION) && \ - (Single_Line_Field(field)) && \ - (((field)->dcols == (field)->cols) && \ -- ((field)->opts & O_STATIC)) ) -+ ((unsigned)(field)->opts & O_STATIC))) - - /* Logic to determine whether or not a dynamic field may still grow */ - #define Growable(field) ((field)->status & _MAY_GROW) - - /* Macro to set the attributes for a fields window */ - #define Set_Field_Window_Attributes(field,win) \ --( wbkgdset((win),(chtype)((field)->pad | (field)->back)), \ -- (void) wattrset((win),(field)->fore) ) -+( wbkgdset((win),(chtype)((chtype)((field)->pad) | (field)->back)), \ -+ (void) wattrset((win), (int)(field)->fore) ) - - /* Logic to decide whether or not a field really appears on the form */ - #define Field_Really_Appears(field) \ - ((field->form) &&\ - (field->form->status & _POSTED) &&\ -- (field->opts & O_VISIBLE) &&\ -+ ((unsigned)field->opts & O_VISIBLE) &&\ - (field->page == field->form->curpage)) - - /* Logic to determine whether or not we are on the first position in the -@@ -601,8 +601,8 @@ - { - if (form->status & _WINDOW_MODIFIED) - { -- form->status &= ~_WINDOW_MODIFIED; -- form->status |= _FCHECK_REQUIRED; -+ ClrStatus(form, _WINDOW_MODIFIED); -+ SetStatus(form, _FCHECK_REQUIRED); - Window_To_Buffer(form, form->current); - wmove(form->w, form->currow, form->curcol); - } -@@ -653,7 +653,7 @@ - growth = Minimum(field->maxgrow - field->dcols, growth); - field->dcols += growth; - if (field->dcols == field->maxgrow) -- field->status &= ~_MAY_GROW; -+ ClrStatus(field, _MAY_GROW); - } - else - { -@@ -662,7 +662,7 @@ - growth = Minimum(field->maxgrow - field->drows, growth); - field->drows += growth; - if (field->drows == field->maxgrow) -- field->status &= ~_MAY_GROW; -+ ClrStatus(field, _MAY_GROW); - } - /* drows, dcols changed, so we get really the new buffer length */ - new_buflen = Buffer_Length(field); -@@ -674,7 +674,7 @@ - field->drows = old_drows; - if ((single_line_field && (field->dcols != field->maxgrow)) || - (!single_line_field && (field->drows != field->maxgrow))) -- field->status |= _MAY_GROW; -+ SetStatus(field, _MAY_GROW); - } - else - { -@@ -753,7 +753,7 @@ - (field->dcols != field->maxgrow)) || - (!single_line_field && - (field->drows != field->maxgrow))) -- field->status |= _MAY_GROW; -+ SetStatus(field, _MAY_GROW); - free(newbuf); - } - } -@@ -860,7 +860,7 @@ - field = form->current; - formwin = Get_Form_Window(form); - -- if (field->opts & O_PUBLIC) -+ if ((unsigned)field->opts & O_PUBLIC) - { - if (Is_Scroll_Field(field)) - { -@@ -897,19 +897,19 @@ - if (form->currow < form->toprow) - { - form->toprow = form->currow; -- field->status |= _NEWTOP; -+ SetStatus(field, _NEWTOP); - } - if (form->currow >= row_after_bottom) - { - form->toprow = form->currow - field->rows + 1; -- field->status |= _NEWTOP; -+ SetStatus(field, _NEWTOP); - } - if (field->status & _NEWTOP) - { - /* means we have to copy whole range */ - first_modified_row = form->toprow; - first_unmodified_row = first_modified_row + field->rows; -- field->status &= ~_NEWTOP; -+ ClrStatus(field, _NEWTOP); - } - else - { -@@ -1111,27 +1111,27 @@ - return E_SYSTEM_ERROR; - else - { -- if (field->opts & O_VISIBLE) -+ if ((unsigned)field->opts & O_VISIBLE) - { - Set_Field_Window_Attributes(field, win); - } - else - { -- (void)wattrset(win, WINDOW_ATTRS(fwin)); -+ (void)wattrset(win, (int)WINDOW_ATTRS(fwin)); - } - werase(win); - } - - if (!bEraseFlag) - { -- if (field->opts & O_PUBLIC) -+ if ((unsigned)field->opts & O_PUBLIC) - { - if (Justification_Allowed(field)) - Perform_Justification(field, win); - else - Buffer_To_Window(field, win); - } -- field->status &= ~_NEWTOP; -+ ClrStatus(field, _NEWTOP); - } - wsyncup(win); - delwin(win); -@@ -1170,18 +1170,18 @@ - form->currow = form->curcol = form->toprow = form->begincol = 0; - werase(form->w); - -- if ((field->opts & O_PUBLIC) && Justification_Allowed(field)) -+ if (((unsigned)field->opts & O_PUBLIC) && Justification_Allowed(field)) - Undo_Justification(field, form->w); - else - Buffer_To_Window(field, form->w); - -- field->status |= _NEWTOP; -+ SetStatus(field, _NEWTOP); - res = _nc_Refresh_Current_Field(form); - } - else - res = Display_Field(field); - } -- field->status |= _CHANGED; -+ SetStatus(field, _CHANGED); - return (res); - } - -@@ -1211,7 +1211,7 @@ - return (E_SYSTEM_ERROR); - - for (linked_field = field->link; -- linked_field != field; -+ (linked_field != field) && (linked_field != 0); - linked_field = linked_field->link) - { - if (((syncres = Synchronize_Field(linked_field)) != E_OK) && -@@ -1256,7 +1256,7 @@ - werase(form->w); - wmove(form->w, form->currow, form->curcol); - -- if (field->opts & O_PUBLIC) -+ if ((unsigned)field->opts & O_PUBLIC) - { - if (Justification_Allowed(field)) - Undo_Justification(field, form->w); -@@ -1272,7 +1272,7 @@ - field->rows - 1, field->cols - 1, 0); - wsyncup(formwin); - Buffer_To_Window(field, form->w); -- field->status |= _NEWTOP; /* fake refresh to paint all */ -+ SetStatus(field, _NEWTOP); /* fake refresh to paint all */ - _nc_Refresh_Current_Field(form); - } - } -@@ -1326,34 +1326,34 @@ - field->opts = oldopts; - returnCode(E_CURRENT); - } -- if ((form->curpage == field->page)) -+ if (form->curpage == field->page) - { -- if (changed_opts & O_VISIBLE) -+ if ((unsigned)changed_opts & O_VISIBLE) - { -- if (newopts & O_VISIBLE) -+ if ((unsigned)newopts & O_VISIBLE) - res = Display_Field(field); - else - res = Erase_Field(field); - } - else - { -- if ((changed_opts & O_PUBLIC) && -- (newopts & O_VISIBLE)) -+ if (((unsigned)changed_opts & O_PUBLIC) && -+ ((unsigned)newopts & O_VISIBLE)) - res = Display_Field(field); - } - } - } - } - -- if (changed_opts & O_STATIC) -+ if ((unsigned)changed_opts & O_STATIC) - { - bool single_line_field = Single_Line_Field(field); - int res2 = E_OK; - -- if (newopts & O_STATIC) -+ if ((unsigned)newopts & O_STATIC) - { - /* the field becomes now static */ -- field->status &= ~_MAY_GROW; -+ ClrStatus(field, _MAY_GROW); - /* if actually we have no hidden columns, justification may - occur again */ - if (single_line_field && -@@ -1371,7 +1371,7 @@ - (single_line_field && (field->dcols < field->maxgrow)) || - (!single_line_field && (field->drows < field->maxgrow))) - { -- field->status |= _MAY_GROW; -+ SetStatus(field, _MAY_GROW); - /* a field with justification now changes its behavior, - so we must redisplay it */ - if (single_line_field && -@@ -1424,18 +1424,18 @@ - !(form->status & _POSTED)) - { - if ((form->w) && -- (field->opts & O_VISIBLE) && -+ ((unsigned)field->opts & O_VISIBLE) && - (field->form->curpage == field->page)) - { - _nc_Refresh_Current_Field(form); -- if (field->opts & O_PUBLIC) -+ if ((unsigned)field->opts & O_PUBLIC) - { - if (field->drows > field->rows) - { - if (form->toprow == 0) -- field->status &= ~_NEWTOP; -+ ClrStatus(field, _NEWTOP); - else -- field->status |= _NEWTOP; -+ SetStatus(field, _NEWTOP); - } - else - { -@@ -1469,7 +1469,7 @@ - delwin(form->w); - form->w = new_window; - -- form->status &= ~_WINDOW_MODIFIED; -+ ClrStatus(form, _WINDOW_MODIFIED); - Set_Field_Window_Attributes(field, form->w); - - if (Has_Invisible_Parts(field)) -@@ -1998,7 +1998,7 @@ - { - res = fct(form); - if (res == E_OK) -- form->current->status |= _NEWTOP; -+ SetStatus(form, _NEWTOP); - } - return (res); - } -@@ -2430,7 +2430,7 @@ - int result = E_REQUEST_DENIED; - bool Last_Row = ((field->drows - 1) == form->currow); - -- if ((field->opts & O_WRAP) && /* wrapping wanted */ -+ if (((unsigned)field->opts & O_WRAP) && /* wrapping wanted */ - (!Single_Line_Field(field)) && /* must be multi-line */ - (There_Is_No_Room_For_A_Char_In_Line(form)) && /* line is full */ - (!Last_Row || Growable(field))) /* there are more lines */ -@@ -2513,7 +2513,7 @@ - editable fields. - */ - if ((fct == FE_Delete_Previous) && -- (form->opts & O_BS_OVERLOAD) && -+ ((unsigned)form->opts & O_BS_OVERLOAD) && - First_Position_In_Current_Field(form)) - { - res = Inter_Field_Navigation(FN_Previous_Field, form); -@@ -2522,7 +2522,7 @@ - { - if (fct == FE_New_Line) - { -- if ((form->opts & O_NL_OVERLOAD) && -+ if (((unsigned)form->opts & O_NL_OVERLOAD) && - First_Position_In_Current_Field(form)) - { - res = Inter_Field_Navigation(FN_Next_Field, form); -@@ -2534,11 +2534,11 @@ - else - { - /* From now on, everything must be editable */ -- if (form->current->opts & O_EDIT) -+ if ((unsigned)form->current->opts & O_EDIT) - { - res = fct(form); - if (res == E_OK) -- form->status |= _WINDOW_MODIFIED; -+ SetStatus(form, _WINDOW_MODIFIED); - } - } - } -@@ -2571,7 +2571,7 @@ - if (Last_Row && - (!(Growable(field) && !Single_Line_Field(field)))) - { -- if (!(form->opts & O_NL_OVERLOAD)) -+ if (!((unsigned)form->opts & O_NL_OVERLOAD)) - returnCode(E_REQUEST_DENIED); - wmove(form->w, form->currow, form->curcol); - wclrtoeol(form->w); -@@ -2579,7 +2579,7 @@ - handled in the generic routine. The reason is, - that FN_Next_Field may fail, but the form is - definitively changed */ -- form->status |= _WINDOW_MODIFIED; -+ SetStatus(form, _WINDOW_MODIFIED); - returnCode(Inter_Field_Navigation(FN_Next_Field, form)); - } - else -@@ -2595,7 +2595,7 @@ - wclrtoeol(form->w); - form->currow++; - form->curcol = 0; -- form->status |= _WINDOW_MODIFIED; -+ SetStatus(form, _WINDOW_MODIFIED); - returnCode(E_OK); - } - } -@@ -2605,7 +2605,7 @@ - if (Last_Row && - !(Growable(field) && !Single_Line_Field(field))) - { -- if (!(form->opts & O_NL_OVERLOAD)) -+ if (!((unsigned)form->opts & O_NL_OVERLOAD)) - returnCode(E_REQUEST_DENIED); - returnCode(Inter_Field_Navigation(FN_Next_Field, form)); - } -@@ -2627,7 +2627,7 @@ - wmove(form->w, form->currow, form->curcol); - winsertln(form->w); - myADDNSTR(form->w, bp, (int)(t - bp)); -- form->status |= _WINDOW_MODIFIED; -+ SetStatus(form, _WINDOW_MODIFIED); - returnCode(E_OK); - } - } -@@ -2926,7 +2926,7 @@ - EM_Overlay_Mode(FORM *form) - { - T((T_CALLED("EM_Overlay_Mode(%p)"), (void *)form)); -- form->status |= _OVLMODE; -+ SetStatus(form, _OVLMODE); - returnCode(E_OK); - } - -@@ -2942,7 +2942,7 @@ - EM_Insert_Mode(FORM *form) - { - T((T_CALLED("EM_Insert_Mode(%p)"), (void *)form)); -- form->status &= ~_OVLMODE; -+ ClrStatus(form, _OVLMODE); - returnCode(E_OK); - } - -@@ -3111,7 +3111,7 @@ - { - if (typ) - { -- if (field->opts & O_NULLOK) -+ if ((unsigned)field->opts & O_NULLOK) - { - FIELD_CELL *bp = field->buf; - -@@ -3168,12 +3168,12 @@ - - Synchronize_Buffer(form); - if ((form->status & _FCHECK_REQUIRED) || -- (!(field->opts & O_PASSOK))) -+ (!((unsigned)field->opts & O_PASSOK))) - { - if (!Check_Field(form, field->type, field, (TypeArgument *)(field->arg))) - return FALSE; -- form->status &= ~_FCHECK_REQUIRED; -- field->status |= _CHANGED; -+ ClrStatus(form, _FCHECK_REQUIRED); -+ SetStatus(field, _CHANGED); - Synchronize_Linked_Fields(field); - } - return TRUE; -@@ -3273,14 +3273,15 @@ - do - { - field = (field == last_on_page) ? first : field + 1; -- if (((*field)->opts & O_VISIBLE)) -+ if (((unsigned)(*field)->opts & O_VISIBLE)) - break; - } - while (proposed != (*field)); - - proposed = *field; - -- if ((proposed == *last_on_page) && !(proposed->opts & O_VISIBLE)) -+ if ((proposed == *last_on_page) && -+ !((unsigned)proposed->opts & O_VISIBLE)) - { - /* This means, there is also no visible field on the page. - So we propose the first one and hope the very best... -@@ -3816,11 +3817,11 @@ - FIELD *last_field, *field_on_page; - - werase(Get_Form_Window(form)); -- form->curpage = page; -+ form->curpage = (short)page; - last_field = field_on_page = form->field[form->page[page].smin]; - do - { -- if (field_on_page->opts & O_VISIBLE) -+ if ((unsigned)field_on_page->opts & O_VISIBLE) - if ((res = Display_Field(field_on_page)) != E_OK) - return (res); - field_on_page = field_on_page->snext; -@@ -3981,6 +3982,94 @@ - Helper routines for the core form driver. - --------------------------------------------------------------------------*/ - -+# if USE_WIDEC_SUPPORT -+/*--------------------------------------------------------------------------- -+| Facility : libnform -+| Function : static int Data_Entry_w(FORM * form, wchar_t c) -+| -+| Description : Enter the wide character c into at the current -+| position of the current field of the form. -+| -+| Return Values : E_OK - success -+| E_REQUEST_DENIED - driver could not process the request -+| E_SYSTEM_ERROR - -++--------------------------------------------------------------------------*/ -+static int -+Data_Entry_w(FORM *form, wchar_t c) -+{ -+ FIELD *field = form->current; -+ int result = E_REQUEST_DENIED; -+ -+ T((T_CALLED("Data_Entry(%p,%s)"), (void *)form, _tracechtype((chtype)c))); -+ if (((unsigned)field->opts & O_EDIT) -+#if FIX_FORM_INACTIVE_BUG -+ && ((unsigned)field->opts & O_ACTIVE) -+#endif -+ ) -+ { -+ wchar_t given[2]; -+ cchar_t temp_ch; -+ -+ given[0] = c; -+ given[1] = 1; -+ setcchar(&temp_ch, given, 0, 0, (void *)0); -+ if (((unsigned)field->opts & O_BLANK) && -+ First_Position_In_Current_Field(form) && -+ !(form->status & _FCHECK_REQUIRED) && -+ !(form->status & _WINDOW_MODIFIED)) -+ werase(form->w); -+ -+ if (form->status & _OVLMODE) -+ { -+ wadd_wch(form->w, &temp_ch); -+ } -+ else -+ /* no _OVLMODE */ -+ { -+ bool There_Is_Room = Is_There_Room_For_A_Char_In_Line(form); -+ -+ if (!(There_Is_Room || -+ ((Single_Line_Field(field) && Growable(field))))) -+ RETURN(E_REQUEST_DENIED); -+ -+ if (!There_Is_Room && !Field_Grown(field, 1)) -+ RETURN(E_SYSTEM_ERROR); -+ -+ wins_wch(form->w, &temp_ch); -+ } -+ -+ if ((result = Wrapping_Not_Necessary_Or_Wrapping_Ok(form)) == E_OK) -+ { -+ bool End_Of_Field = (((field->drows - 1) == form->currow) && -+ ((field->dcols - 1) == form->curcol)); -+ -+ form->status |= _WINDOW_MODIFIED; -+ if (End_Of_Field && !Growable(field) && ((unsigned)field->opts & O_AUTOSKIP)) -+ result = Inter_Field_Navigation(FN_Next_Field, form); -+ else -+ { -+ if (End_Of_Field && Growable(field) && !Field_Grown(field, 1)) -+ result = E_SYSTEM_ERROR; -+ else -+ { -+ /* -+ * We have just added a byte to the form field. It may have -+ * been part of a multibyte character. If it was, the -+ * addch_used field is nonzero and we should not try to move -+ * to a new column. -+ */ -+ if (WINDOW_EXT(form->w, addch_used) == 0) -+ IFN_Next_Character(form); -+ -+ result = E_OK; -+ } -+ } -+ } -+ } -+ RETURN(result); -+} -+# endif -+ - /*--------------------------------------------------------------------------- - | Facility : libnform - | Function : static int Data_Entry(FORM * form,int c) -@@ -3999,13 +4088,13 @@ - int result = E_REQUEST_DENIED; - - T((T_CALLED("Data_Entry(%p,%s)"), (void *)form, _tracechtype((chtype)c))); -- if ((field->opts & O_EDIT) -+ if (((unsigned)field->opts & O_EDIT) - #if FIX_FORM_INACTIVE_BUG -- && (field->opts & O_ACTIVE) -+ && ((unsigned)field->opts & O_ACTIVE) - #endif - ) - { -- if ((field->opts & O_BLANK) && -+ if (((unsigned)field->opts & O_BLANK) && - First_Position_In_Current_Field(form) && - !(form->status & _FCHECK_REQUIRED) && - !(form->status & _WINDOW_MODIFIED)) -@@ -4035,8 +4124,8 @@ - bool End_Of_Field = (((field->drows - 1) == form->currow) && - ((field->dcols - 1) == form->curcol)); - -- form->status |= _WINDOW_MODIFIED; -- if (End_Of_Field && !Growable(field) && (field->opts & O_AUTOSKIP)) -+ SetStatus(form, _WINDOW_MODIFIED); -+ if (End_Of_Field && !Growable(field) && ((unsigned)field->opts & O_AUTOSKIP)) - result = Inter_Field_Navigation(FN_Next_Field, form); - else - { -@@ -4228,7 +4317,10 @@ - - if ((c >= MIN_FORM_COMMAND && c <= MAX_FORM_COMMAND) && - ((bindings[c - MIN_FORM_COMMAND].keycode & Key_Mask) == c)) -- BI = &(bindings[c - MIN_FORM_COMMAND]); -+ { -+ TR(TRACE_CALLS, ("form_request %s", form_request_name(c))); -+ BI = &(bindings[c - MIN_FORM_COMMAND]); -+ } - - if (BI) - { -@@ -4246,7 +4338,7 @@ - NULL /* Choice Request is generic */ - }; - size_t nMethods = (sizeof(Generic_Methods) / sizeof(Generic_Methods[0])); -- size_t method = (BI->keycode >> ID_Shft) & 0xffff; /* see ID_Mask */ -+ size_t method = (size_t) ((BI->keycode >> ID_Shft) & 0xffff); /* see ID_Mask */ - - if ((method >= nMethods) || !(BI->cmd)) - res = E_SYSTEM_ERROR; -@@ -4255,9 +4347,13 @@ - Generic_Method fct = Generic_Methods[method]; - - if (fct) -- res = fct(BI->cmd, form); -+ { -+ res = fct(BI->cmd, form); -+ } - else -- res = (BI->cmd) (form); -+ { -+ res = (BI->cmd) (form); -+ } - } - } - #ifdef NCURSES_MOUSE_VERSION -@@ -4360,6 +4456,195 @@ - RETURN(res); - } - -+# if USE_WIDEC_SUPPORT -+/*--------------------------------------------------------------------------- -+| Facility : libnform -+| Function : int form_driver_w(FORM * form,int type,wchar_t c) -+| -+| Description : This is the workhorse of the forms system. -+| -+| Input is either a key code (request) or a wide char -+| returned by e.g. get_wch (). The type must be passed -+| as well,so that we are able to determine whether the char -+| is a multibyte char or a request. -+ -+| If it is a request, the form driver executes -+| the request and returns the result. If it is data -+| (printable character), it enters the data into the -+| current position in the current field. If it is not -+| recognized, the form driver assumes it is an application -+| defined command and returns E_UNKNOWN_COMMAND. -+| Application defined command should be defined relative -+| to MAX_FORM_COMMAND, the maximum value of a request. -+| -+| Return Values : E_OK - success -+| E_SYSTEM_ERROR - system error -+| E_BAD_ARGUMENT - an argument is incorrect -+| E_NOT_POSTED - form is not posted -+| E_INVALID_FIELD - field contents are invalid -+| E_BAD_STATE - called from inside a hook routine -+| E_REQUEST_DENIED - request failed -+| E_NOT_CONNECTED - no fields are connected to the form -+| E_UNKNOWN_COMMAND - command not known -++--------------------------------------------------------------------------*/ -+NCURSES_EXPORT(int) -+form_driver_w(FORM *form, int type, wchar_t c) -+{ -+ const Binding_Info *BI = (Binding_Info *) 0; -+ int res = E_UNKNOWN_COMMAND; -+ -+ T((T_CALLED("form_driver(%p,%d)"), (void *)form, (int)c)); -+ -+ if (!form) -+ RETURN(E_BAD_ARGUMENT); -+ -+ if (!(form->field)) -+ RETURN(E_NOT_CONNECTED); -+ -+ assert(form->page); -+ -+ if (c == (wchar_t)FIRST_ACTIVE_MAGIC) -+ { -+ form->current = _nc_First_Active_Field(form); -+ RETURN(E_OK); -+ } -+ -+ assert(form->current && -+ form->current->buf && -+ (form->current->form == form) -+ ); -+ -+ if (form->status & _IN_DRIVER) -+ RETURN(E_BAD_STATE); -+ -+ if (!(form->status & _POSTED)) -+ RETURN(E_NOT_POSTED); -+ -+ /* check if this is a keycode or a (wide) char */ -+ if (type == KEY_CODE_YES) -+ { -+ if ((c >= MIN_FORM_COMMAND && c <= MAX_FORM_COMMAND) && -+ ((bindings[c - MIN_FORM_COMMAND].keycode & Key_Mask) == c)) -+ BI = &(bindings[c - MIN_FORM_COMMAND]); -+ } -+ -+ if (BI) -+ { -+ typedef int (*Generic_Method) (int (*const) (FORM *), FORM *); -+ static const Generic_Method Generic_Methods[] = -+ { -+ Page_Navigation, /* overloaded to call field&form hooks */ -+ Inter_Field_Navigation, /* overloaded to call field hooks */ -+ NULL, /* Intra-Field is generic */ -+ Vertical_Scrolling, /* Overloaded to check multi-line */ -+ Horizontal_Scrolling, /* Overloaded to check single-line */ -+ Field_Editing, /* Overloaded to mark modification */ -+ NULL, /* Edit Mode is generic */ -+ NULL, /* Field Validation is generic */ -+ NULL /* Choice Request is generic */ -+ }; -+ size_t nMethods = (sizeof(Generic_Methods) / sizeof(Generic_Methods[0])); -+ size_t method = (size_t) (BI->keycode >> ID_Shft) & 0xffff; /* see ID_Mask */ -+ -+ if ((method >= nMethods) || !(BI->cmd)) -+ res = E_SYSTEM_ERROR; -+ else -+ { -+ Generic_Method fct = Generic_Methods[method]; -+ -+ if (fct) -+ res = fct(BI->cmd, form); -+ else -+ res = (BI->cmd) (form); -+ } -+ } -+#ifdef NCURSES_MOUSE_VERSION -+ else if (KEY_MOUSE == c) -+ { -+ MEVENT event; -+ WINDOW *win = form->win ? form->win : StdScreen(Get_Form_Screen(form)); -+ WINDOW *sub = form->sub ? form->sub : win; -+ -+ getmouse(&event); -+ if ((event.bstate & (BUTTON1_CLICKED | -+ BUTTON1_DOUBLE_CLICKED | -+ BUTTON1_TRIPLE_CLICKED)) -+ && wenclose(win, event.y, event.x)) -+ { /* we react only if the click was in the userwin, that means -+ * inside the form display area or at the decoration window. -+ */ -+ int ry = event.y, rx = event.x; /* screen coordinates */ -+ -+ res = E_REQUEST_DENIED; -+ if (mouse_trafo(&ry, &rx, FALSE)) -+ { /* rx, ry are now "curses" coordinates */ -+ if (ry < sub->_begy) -+ { /* we clicked above the display region; this is -+ * interpreted as "scroll up" request -+ */ -+ if (event.bstate & BUTTON1_CLICKED) -+ res = form_driver(form, REQ_PREV_FIELD); -+ else if (event.bstate & BUTTON1_DOUBLE_CLICKED) -+ res = form_driver(form, REQ_PREV_PAGE); -+ else if (event.bstate & BUTTON1_TRIPLE_CLICKED) -+ res = form_driver(form, REQ_FIRST_FIELD); -+ } -+ else if (ry > sub->_begy + sub->_maxy) -+ { /* we clicked below the display region; this is -+ * interpreted as "scroll down" request -+ */ -+ if (event.bstate & BUTTON1_CLICKED) -+ res = form_driver(form, REQ_NEXT_FIELD); -+ else if (event.bstate & BUTTON1_DOUBLE_CLICKED) -+ res = form_driver(form, REQ_NEXT_PAGE); -+ else if (event.bstate & BUTTON1_TRIPLE_CLICKED) -+ res = form_driver(form, REQ_LAST_FIELD); -+ } -+ else if (wenclose(sub, event.y, event.x)) -+ { /* Inside the area we try to find the hit item */ -+ int i; -+ -+ ry = event.y; -+ rx = event.x; -+ if (wmouse_trafo(sub, &ry, &rx, FALSE)) -+ { -+ int min_field = form->page[form->curpage].pmin; -+ int max_field = form->page[form->curpage].pmax; -+ -+ for (i = min_field; i <= max_field; ++i) -+ { -+ FIELD *field = form->field[i]; -+ -+ if (Field_Is_Selectable(field) -+ && Field_encloses(field, ry, rx) == E_OK) -+ { -+ res = _nc_Set_Current_Field(form, field); -+ if (res == E_OK) -+ res = _nc_Position_Form_Cursor(form); -+ if (res == E_OK -+ && (event.bstate & BUTTON1_DOUBLE_CLICKED)) -+ res = E_UNKNOWN_COMMAND; -+ break; -+ } -+ } -+ } -+ } -+ } -+ } -+ else -+ res = E_REQUEST_DENIED; -+ } -+#endif /* NCURSES_MOUSE_VERSION */ -+ else if (type == OK) -+ { -+ res = Data_Entry_w(form, c); -+ } -+ -+ _nc_Refresh_Current_Field(form); -+ RETURN(res); -+} -+# endif /* USE_WIDEC_SUPPORT */ -+ - /*---------------------------------------------------------------------------- - Field-Buffer manipulation routines. - The effects of setting a buffer are tightly coupled to the core of the form -@@ -4389,8 +4674,8 @@ - { - FIELD_CELL *p; - int res = E_OK; -- unsigned int i; -- unsigned int len; -+ int i; -+ int len; - - #if USE_WIDEC_SUPPORT - FIELD_CELL *widevalue = 0; -@@ -4408,7 +4693,7 @@ - /* for a growable field we must assume zero terminated strings, because - somehow we have to detect the length of what should be copied. - */ -- unsigned int vlen = strlen(value); -+ int vlen = (int)strlen(value); - - if (vlen > len) - { -@@ -4448,10 +4733,10 @@ - } - else - { -- for (i = 0; i < (unsigned)field->drows; ++i) -+ for (i = 0; i < field->drows; ++i) - { -- (void)mvwin_wchnstr(field->working, 0, i * field->dcols, -- widevalue + (i * field->dcols), -+ (void)mvwin_wchnstr(field->working, 0, (int)i * field->dcols, -+ widevalue + ((int)i * field->dcols), - field->dcols); - } - for (i = 0; i < len; ++i) -@@ -4512,7 +4797,7 @@ - { - #if USE_WIDEC_SUPPORT - FIELD_CELL *data = Address_Of_Nth_Buffer(field, buffer); -- unsigned need = 0; -+ size_t need = 0; - int size = Buffer_Length(field); - int n; - -@@ -4526,7 +4811,7 @@ - - init_mb(state); - next = _nc_wcrtomb(0, data[n].chars[0], &state); -- if (!isEILSEQ(next)) -+ if (next > 0) - need += next; - } - } -@@ -4613,7 +4898,7 @@ - { - result[need] = wch; - } -- passed += status; -+ passed += (size_t) status; - ++need; - } - else -@@ -4633,7 +4918,7 @@ - break; - result = typeCalloc(wchar_t, need); - -- *lengthp = need; -+ *lengthp = (int)need; - if (result == 0) - break; - } -diff -Naur ncurses-5.9/form/frm_hook.c ncurses-5.9.patch/form/frm_hook.c ---- ncurses-5.9/form/frm_hook.c 2010-01-23 22:12:08.000000000 +0100 -+++ ncurses-5.9.patch/form/frm_hook.c 2014-09-01 16:33:22.339792094 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2004,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -32,13 +32,13 @@ - - #include "form.priv.h" - --MODULE_ID("$Id: frm_hook.c,v 1.15 2010/01/23 21:12:08 tom Exp $") -+MODULE_ID("$Id: frm_hook.c,v 1.16 2012/03/11 00:37:16 tom Exp $") - - /* "Template" macro to generate function to set application specific hook */ - #define GEN_HOOK_SET_FUNCTION( typ, name ) \ - NCURSES_IMPEXP int NCURSES_API set_ ## typ ## _ ## name (FORM *form, Form_Hook func)\ - {\ -- T((T_CALLED("set_" #typ"_"#name"(%p,%p)"), form, func));\ -+ T((T_CALLED("set_" #typ"_"#name"(%p,%p)"), (void *) form, func));\ - (Normalize_Form( form ) -> typ ## name) = func ;\ - RETURN(E_OK);\ - } -diff -Naur ncurses-5.9/form/frm_opts.c ncurses-5.9.patch/form/frm_opts.c ---- ncurses-5.9/form/frm_opts.c 2010-01-23 22:14:36.000000000 +0100 -+++ ncurses-5.9.patch/form/frm_opts.c 2014-09-01 16:33:22.340792096 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2005,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -32,7 +32,7 @@ - - #include "form.priv.h" - --MODULE_ID("$Id: frm_opts.c,v 1.15 2010/01/23 21:14:36 tom Exp $") -+MODULE_ID("$Id: frm_opts.c,v 1.17 2013/08/24 22:58:47 tom Exp $") - - /*--------------------------------------------------------------------------- - | Facility : libnform -@@ -49,8 +49,8 @@ - { - T((T_CALLED("set_form_opts(%p,%d)"), (void *)form, opts)); - -- opts &= ALL_FORM_OPTS; -- if (opts & ~ALL_FORM_OPTS) -+ opts &= (Form_Options) ALL_FORM_OPTS; -+ if ((unsigned)opts & ~ALL_FORM_OPTS) - RETURN(E_BAD_ARGUMENT); - else - { -@@ -71,7 +71,7 @@ - form_opts(const FORM *form) - { - T((T_CALLED("form_opts(%p)"), (const void *)form)); -- returnCode((int)(Normalize_Form(form)->opts & ALL_FORM_OPTS)); -+ returnCode((Form_Options) ((unsigned)Normalize_Form(form)->opts & ALL_FORM_OPTS)); - } - - /*--------------------------------------------------------------------------- -@@ -89,8 +89,8 @@ - { - T((T_CALLED("form_opts_on(%p,%d)"), (void *)form, opts)); - -- opts &= ALL_FORM_OPTS; -- if (opts & ~ALL_FORM_OPTS) -+ opts &= (Form_Options) ALL_FORM_OPTS; -+ if ((unsigned)opts & ~ALL_FORM_OPTS) - RETURN(E_BAD_ARGUMENT); - else - { -@@ -114,8 +114,8 @@ - { - T((T_CALLED("form_opts_off(%p,%d)"), (void *)form, opts)); - -- opts &= ALL_FORM_OPTS; -- if (opts & ~ALL_FORM_OPTS) -+ opts &= (Form_Options) ALL_FORM_OPTS; -+ if ((unsigned)opts & ~ALL_FORM_OPTS) - RETURN(E_BAD_ARGUMENT); - else - { -diff -Naur ncurses-5.9/form/frm_page.c ncurses-5.9.patch/form/frm_page.c ---- ncurses-5.9/form/frm_page.c 2010-01-23 22:14:36.000000000 +0100 -+++ ncurses-5.9.patch/form/frm_page.c 2014-09-01 16:33:22.340792096 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2004,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -32,7 +32,7 @@ - - #include "form.priv.h" - --MODULE_ID("$Id: frm_page.c,v 1.11 2010/01/23 21:14:36 tom Exp $") -+MODULE_ID("$Id: frm_page.c,v 1.12 2012/06/10 00:28:04 tom Exp $") - - /*--------------------------------------------------------------------------- - | Facility : libnform -@@ -58,7 +58,7 @@ - - if (!(form->status & _POSTED)) - { -- form->curpage = page; -+ form->curpage = (short)page; - form->current = _nc_First_Active_Field(form); - } - else -diff -Naur ncurses-5.9/form/frm_post.c ncurses-5.9.patch/form/frm_post.c ---- ncurses-5.9/form/frm_post.c 2010-01-23 22:14:36.000000000 +0100 -+++ ncurses-5.9.patch/form/frm_post.c 2014-09-01 16:33:22.340792096 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2004,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -32,7 +32,7 @@ - - #include "form.priv.h" - --MODULE_ID("$Id: frm_post.c,v 1.10 2010/01/23 21:14:36 tom Exp $") -+MODULE_ID("$Id: frm_post.c,v 1.11 2012/06/10 00:27:49 tom Exp $") - - /*--------------------------------------------------------------------------- - | Facility : libnform -@@ -77,7 +77,7 @@ - if ((err = _nc_Set_Form_Page(form, page, form->current)) != E_OK) - RETURN(err); - -- form->status |= _POSTED; -+ SetStatus(form, _POSTED); - - Call_Hook(form, forminit); - Call_Hook(form, fieldinit); -@@ -117,7 +117,7 @@ - werase(Get_Form_Window(form)); - delwin(form->w); - form->w = (WINDOW *)0; -- form->status &= ~_POSTED; -+ ClrStatus(form, _POSTED); - RETURN(E_OK); - } - -diff -Naur ncurses-5.9/form/frm_req_name.c ncurses-5.9.patch/form/frm_req_name.c ---- ncurses-5.9/form/frm_req_name.c 2009-10-10 18:17:01.000000000 +0200 -+++ ncurses-5.9.patch/form/frm_req_name.c 2014-09-01 16:33:22.340792096 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2008,2009 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2009,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -37,7 +37,7 @@ - - #include "form.priv.h" - --MODULE_ID("$Id: frm_req_name.c,v 1.17 2009/10/10 16:17:01 tom Exp $") -+MODULE_ID("$Id: frm_req_name.c,v 1.18 2012/07/21 23:17:23 tom Exp $") - - static const char *request_names[MAX_FORM_COMMAND - MIN_FORM_COMMAND + 1] = - { -@@ -144,23 +144,26 @@ - /* because the table is so small, it doesn't really hurt - to run sequentially through it. - */ -- unsigned int i = 0; -- char buf[16]; -+ size_t i = 0; -+ char buf[16]; /* longest name is 10 chars */ - - T((T_CALLED("form_request_by_name(%s)"), _nc_visbuf(str))); - -- if (str) -+ if (str != 0 && (i = strlen(str)) != 0) - { -- strncpy(buf, str, sizeof(buf)); -- while ((i < sizeof(buf)) && (buf[i] != '\0')) -+ if (i > sizeof(buf) - 2) -+ i = sizeof(buf) - 2; -+ memcpy(buf, str, i); -+ buf[i] = '\0'; -+ -+ for (i = 0; buf[i] != '\0'; ++i) - { - buf[i] = (char)toupper(UChar(buf[i])); -- i++; - } - - for (i = 0; i < A_SIZE; i++) - { -- if (strncmp(request_names[i], buf, sizeof(buf)) == 0) -+ if (strcmp(request_names[i], buf) == 0) - returnCode(MIN_FORM_COMMAND + (int)i); - } - } -diff -Naur ncurses-5.9/form/fty_generic.c ncurses-5.9.patch/form/fty_generic.c ---- ncurses-5.9/form/fty_generic.c 2010-01-23 22:14:36.000000000 +0100 -+++ ncurses-5.9.patch/form/fty_generic.c 2014-09-01 16:33:22.340792096 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 2008-2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 2008-2010,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -34,7 +34,7 @@ - - #include "form.priv.h" - --MODULE_ID("$Id: fty_generic.c,v 1.5 2010/01/23 21:14:36 tom Exp $") -+MODULE_ID("$Id: fty_generic.c,v 1.6 2012/06/10 00:27:49 tom Exp $") - - /* - * This is not a full implementation of a field type, but adds some -@@ -119,7 +119,7 @@ - if (res) - { - *res = *_nc_Default_FieldType; -- res->status |= (_HAS_ARGS | _GENERIC); -+ SetStatus(res, (_HAS_ARGS | _GENERIC)); - res->fieldcheck.gfcheck = field_check; - res->charcheck.gccheck = char_check; - res->genericarg = Generic_This_Type; -diff -Naur ncurses-5.9/form/fty_int.c ncurses-5.9.patch/form/fty_int.c ---- ncurses-5.9/form/fty_int.c 2010-01-23 22:14:36.000000000 +0100 -+++ ncurses-5.9.patch/form/fty_int.c 2014-09-01 16:33:22.340792096 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -34,7 +34,7 @@ - - #include "form.priv.h" - --MODULE_ID("$Id: fty_int.c,v 1.25 2010/01/23 21:14:36 tom Exp $") -+MODULE_ID("$Id: fty_int.c,v 1.26 2012/02/23 10:02:15 tom Exp $") - - #if USE_WIDEC_SUPPORT - #define isDigit(c) (iswdigit((wint_t)(c)) || isdigit(UChar(c))) -@@ -233,7 +233,8 @@ - } - if (result) - { -- sprintf(buf, "%.*ld", (prec > 0 ? prec : 0), val); -+ _nc_SPRINTF(buf, _nc_SLIMIT(sizeof(buf)) -+ "%.*ld", (prec > 0 ? prec : 0), val); - set_field_buffer(field, 0, buf); - } - } -diff -Naur ncurses-5.9/form/fty_num.c ncurses-5.9.patch/form/fty_num.c ---- ncurses-5.9/form/fty_num.c 2010-01-23 22:14:36.000000000 +0100 -+++ ncurses-5.9.patch/form/fty_num.c 2014-09-01 16:33:22.340792096 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -34,7 +34,7 @@ - - #include "form.priv.h" - --MODULE_ID("$Id: fty_num.c,v 1.28 2010/01/23 21:14:36 tom Exp $") -+MODULE_ID("$Id: fty_num.c,v 1.29 2012/02/23 10:02:15 tom Exp $") - - #if HAVE_LOCALE_H - #include <locale.h> -@@ -271,7 +271,8 @@ - } - if (result) - { -- sprintf(buf, "%.*f", (prec > 0 ? prec : 0), val); -+ _nc_SPRINTF(buf, _nc_SLIMIT(sizeof(buf)) -+ "%.*f", (prec > 0 ? prec : 0), val); - set_field_buffer(field, 0, buf); - } - } -diff -Naur ncurses-5.9/form/fty_regex.c ncurses-5.9.patch/form/fty_regex.c ---- ncurses-5.9/form/fty_regex.c 2010-01-23 22:14:37.000000000 +0100 -+++ ncurses-5.9.patch/form/fty_regex.c 2014-09-01 16:33:22.340792096 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -34,7 +34,7 @@ - - #include "form.priv.h" - --MODULE_ID("$Id: fty_regex.c,v 1.24 2010/01/23 21:14:37 tom Exp $") -+MODULE_ID("$Id: fty_regex.c,v 1.25 2012/10/27 20:12:53 tom Exp $") - - #if HAVE_REGEX_H_FUNCS /* We prefer POSIX regex */ - #include <regex.h> -@@ -123,9 +123,8 @@ - (REG_EXTENDED | REG_NOSUB | REG_NEWLINE))) - { - T((T_CREATE("regex_t %p"), (void *)preg->pRegExp)); -- preg->refCount = typeMalloc(unsigned long, 1); -- -- *(preg->refCount) = 1; -+ if ((preg->refCount = typeMalloc(unsigned long, 1)) != 0) -+ *(preg->refCount) = 1; - } - else - { -@@ -151,9 +150,8 @@ - - T((T_CREATE("RegExp_Arg %p"), pArg)); - pArg->compiled_expression = NULL; -- pArg->refCount = typeMalloc(unsigned long, 1); -- -- *(pArg->refCount) = 1; -+ if ((pArg->refCount = typeMalloc(unsigned long, 1)) != 0) -+ *(pArg->refCount) = 1; - - do - { -diff -Naur ncurses-5.9/form/llib-lformtw ncurses-5.9.patch/form/llib-lformtw ---- ncurses-5.9/form/llib-lformtw 2010-01-09 23:01:40.000000000 +0100 -+++ ncurses-5.9.patch/form/llib-lformtw 2014-09-01 16:33:22.341792098 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 2010 Free Software Foundation, Inc. * -+ * Copyright (c) 2010,2013 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -27,7 +27,7 @@ - ****************************************************************************/ - - /**************************************************************************** -- * Author: Thomas E. Dickey 2010 * -+ * Author: Thomas E. Dickey 2010-on * - ****************************************************************************/ - /* LINTLIBRARY */ - -@@ -494,6 +494,13 @@ - int c) - { return(*(int *)0); } - -+#undef form_driver_w -+int form_driver_w( -+ FORM *form, -+ int type, -+ wchar_t c) -+ { return(*(int *)0); } -+ - #undef set_field_buffer - int set_field_buffer( - FIELD *field, -diff -Naur ncurses-5.9/form/llib-lformw ncurses-5.9.patch/form/llib-lformw ---- ncurses-5.9/form/llib-lformw 2010-01-09 22:54:33.000000000 +0100 -+++ ncurses-5.9.patch/form/llib-lformw 2014-09-01 16:33:22.341792098 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 2002-2005,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 2002-2010,2013 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -27,7 +27,7 @@ - ****************************************************************************/ - - /**************************************************************************** -- * Author: Thomas E. Dickey 2002-2005,2010 * -+ * Author: Thomas E. Dickey 2002-on * - ****************************************************************************/ - /* LINTLIBRARY */ - -@@ -494,6 +494,13 @@ - int c) - { return(*(int *)0); } - -+#undef form_driver_w -+int form_driver_w( -+ FORM *form, -+ int type, -+ wchar_t c) -+ { return(*(int *)0); } -+ - #undef set_field_buffer - int set_field_buffer( - FIELD *field, -diff -Naur ncurses-5.9/form/Makefile.in ncurses-5.9.patch/form/Makefile.in ---- ncurses-5.9/form/Makefile.in 2010-11-27 22:45:27.000000000 +0100 -+++ ncurses-5.9.patch/form/Makefile.in 2014-09-01 16:33:22.337792091 +0200 -@@ -1,6 +1,6 @@ --# $Id: Makefile.in,v 1.53 2010/11/27 21:45:27 tom Exp $ -+# $Id: Makefile.in,v 1.56 2013/08/04 20:23:20 tom Exp $ - ############################################################################## --# Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. # -+# Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. # - # # - # Permission is hereby granted, free of charge, to any person obtaining a # - # copy of this software and associated documentation files (the "Software"), # -@@ -57,6 +57,9 @@ - bindir = @bindir@ - libdir = @libdir@ - includedir = @includedir@ -+includesubdir = @includesubdir@ -+ -+INCLUDEDIR = $(DESTDIR)$(includedir)$(includesubdir) - - LIBTOOL = @LIBTOOL@ - LIBTOOL_CLEAN = @LIB_CLEAN@ -@@ -102,6 +105,7 @@ - SHLIB_DIRS = -L../lib - SHLIB_LIST = $(SHLIB_DIRS) -lncurses@LIB_SUFFIX@ @SHLIB_LIST@ - -+RPATH_LIST = @RPATH_LIST@ - MK_SHARED_LIB = @MK_SHARED_LIB@ - - NCURSES_MAJOR = @NCURSES_MAJOR@ -@@ -111,7 +115,7 @@ - - RANLIB = @LIB_PREP@ - --LIBRARIES = @LIBS_TO_MAKE@ -+LIBRARIES = @Libs_To_Make@ - - LINT = @LINT@ - LINT_OPTS = @LINT_OPTS@ -diff -Naur ncurses-5.9/include/Caps ncurses-5.9.patch/include/Caps ---- ncurses-5.9/include/Caps 2010-12-04 19:47:13.000000000 +0100 -+++ ncurses-5.9.patch/include/Caps 2014-09-01 16:33:22.341792098 +0200 -@@ -1,5 +1,5 @@ - ############################################################################## --# Copyright (c) 1998-2006,2010 Free Software Foundation, Inc. # -+# Copyright (c) 1998-2010,2011 Free Software Foundation, Inc. # - # # - # Permission is hereby granted, free of charge, to any person obtaining a # - # copy of this software and associated documentation files (the "Software"), # -@@ -29,7 +29,7 @@ - # Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 - # and: Eric S. Raymond <esr@snark.thyrsus.com> - # --# $Id: Caps,v 1.37 2010/12/04 18:47:13 tom Exp $ -+# $Id: Caps,v 1.38 2011/10/15 23:10:18 tom Exp $ - # - # This is the master termcap/terminfo capability table. - # -@@ -738,11 +738,13 @@ - #%.ad - #% - #%.in .8i --#%The XSI Curses standard added these. They are some post-4.1 --#%versions of System V curses, e.g., Solaris 2.5 and IRIX 6.x. --#%The \fBncurses\fR termcap names for them are invented; according to the --#%XSI Curses standard, they have no termcap names. If your compiled terminfo --#%entries use these, they may not be binary-compatible with System V terminfo -+#%The XSI Curses standard added these hardcopy capabilities. -+#%They were used in some post-4.1 versions of System V curses, -+#%e.g., Solaris 2.5 and IRIX 6.x. -+#%Except for \fBYI\fP, the \fBncurses\fR termcap names for them are invented. -+#%According to the XSI Curses standard, they have no termcap names. -+#%If your compiled terminfo entries use these, -+#%they may not be binary-compatible with System V terminfo - #%entries after SVr4.1; beware! - #% - #%.na -@@ -760,7 +762,7 @@ - enter_top_hl_mode ethlm str Xt - - ----- Enter top highlight mode - enter_vertical_hl_mode evhlm str Xv - - ----- Enter vertical highlight mode - set_a_attributes sgr1 str sA - - ----- Define second set of video attributes #1-#6 --set_pglen_inch slength str sL - - ----- YI Set page length to #1 hundredth of an inch -+set_pglen_inch slength str YI - - ----- Set page length to #1 hundredth of an inch (some implementations use sL for termcap). - #%.TE - #%.ad - # -diff -Naur ncurses-5.9/include/Caps.aix4 ncurses-5.9.patch/include/Caps.aix4 ---- ncurses-5.9/include/Caps.aix4 2010-12-04 19:47:13.000000000 +0100 -+++ ncurses-5.9.patch/include/Caps.aix4 2014-09-01 16:33:22.341792098 +0200 -@@ -1,5 +1,5 @@ - ############################################################################## --# Copyright (c) 2001-2006,2010 Free Software Foundation, Inc. # -+# Copyright (c) 2001-2010,2011 Free Software Foundation, Inc. # - # # - # Permission is hereby granted, free of charge, to any person obtaining a # - # copy of this software and associated documentation files (the "Software"), # -@@ -28,7 +28,7 @@ - # - # Author: Thomas Dickey - # --# $Id: Caps.aix4,v 1.8 2010/12/04 18:47:13 tom Exp $ -+# $Id: Caps.aix4,v 1.9 2011/10/15 23:19:16 tom Exp $ - # - # This is an adaptation of ncurses' termcap/terminfo capability table, which - # is designed to align with AIX 4.x's terminfo. -@@ -840,11 +840,13 @@ - #%.ad - #% - #%.in .8i --#%The XSI Curses standard added these. They are some post-4.1 --#%versions of System V curses, e.g., Solaris 2.5 and IRIX 6.x. --#%The \fBncurses\fR termcap names for them are invented; according to the --#%XSI Curses standard, they have no termcap names. If your compiled terminfo --#%entries use these, they may not be binary-compatible with System V terminfo -+#%The XSI Curses standard added these hardcopy capabilities. -+#%They were used in some post-4.1 versions of System V curses, -+#%e.g., Solaris 2.5 and IRIX 6.x. -+#%Except for \fBYI\fP, the \fBncurses\fR termcap names for them are invented. -+#%According to the XSI Curses standard, they have no termcap names. -+#%If your compiled terminfo entries use these, -+#%they may not be binary-compatible with System V terminfo - #%entries after SVr4.1; beware! - #% - #%.na -@@ -862,7 +864,7 @@ - enter_top_hl_mode ethlm str Xt - - ----- Enter top highlight mode - enter_vertical_hl_mode evhlm str Xv - - ----- Enter vertical highlight mode - set_a_attributes sgr1 str sA - - ----- Define second set of video attributes #1-#6 --set_pglen_inch slength str sL - - ----- YI Set page length to #1 hundredth of an inch -+set_pglen_inch slength str YI - - ----- Set page length to #1 hundredth of an inch (some implementations use sL for termcap). - #%.TE - #%.ad - # -diff -Naur ncurses-5.9/include/Caps.hpux11 ncurses-5.9.patch/include/Caps.hpux11 ---- ncurses-5.9/include/Caps.hpux11 2010-12-04 19:47:13.000000000 +0100 -+++ ncurses-5.9.patch/include/Caps.hpux11 2014-09-01 16:33:22.341792098 +0200 -@@ -1,5 +1,5 @@ - ############################################################################## --# Copyright (c) 2002-2006,2010 Free Software Foundation, Inc. # -+# Copyright (c) 2002-2010,2011 Free Software Foundation, Inc. # - # # - # Permission is hereby granted, free of charge, to any person obtaining a # - # copy of this software and associated documentation files (the "Software"), # -@@ -28,7 +28,7 @@ - # - # Author: Thomas Dickey - # --# $Id: Caps.hpux11,v 1.5 2010/12/04 18:47:13 tom Exp $ -+# $Id: Caps.hpux11,v 1.6 2011/10/15 23:20:04 tom Exp $ - # - # This is an adaptation of ncurses' termcap/terminfo capability table, which - # is designed to align with HPUX 11.x's terminfo. -@@ -746,11 +746,13 @@ - #%.ad - #% - #%.in .8i --#%The XSI Curses standard added these. They are some post-4.1 --#%versions of System V curses, e.g., Solaris 2.5 and IRIX 6.x. --#%The \fBncurses\fR termcap names for them are invented; according to the --#%XSI Curses standard, they have no termcap names. If your compiled terminfo --#%entries use these, they may not be binary-compatible with System V terminfo -+#%The XSI Curses standard added these hardcopy capabilities. -+#%They were used in some post-4.1 versions of System V curses, -+#%e.g., Solaris 2.5 and IRIX 6.x. -+#%Except for \fBYI\fP, the \fBncurses\fR termcap names for them are invented. -+#%According to the XSI Curses standard, they have no termcap names. -+#%If your compiled terminfo entries use these, -+#%they may not be binary-compatible with System V terminfo - #%entries after SVr4.1; beware! - #% - #%.na -@@ -761,7 +763,7 @@ - #%lw25 lw6 lw2 lw20. - #%\fBVariable Cap- TCap Description\fR - #%\fBString name Code\fR --set_pglen_inch slength str sL - - ----- YI Set page length to #1 hundredth of an inch -+set_pglen_inch slength str YI - - ----- Set page length to #1 hundredth of an inch (some implementations use sL for termcap). - enter_horizontal_hl_mode ehhlm str Xh - - ----- Enter horizontal highlight mode - enter_left_hl_mode elhlm str Xl - - ----- Enter left highlight mode - enter_low_hl_mode elohlm str Xo - - ----- Enter low highlight mode -diff -Naur ncurses-5.9/include/Caps.keys ncurses-5.9.patch/include/Caps.keys ---- ncurses-5.9/include/Caps.keys 2010-12-04 19:47:13.000000000 +0100 -+++ ncurses-5.9.patch/include/Caps.keys 2014-09-01 16:33:22.342792099 +0200 -@@ -1,5 +1,5 @@ - ############################################################################## --# Copyright (c) 2001-2006,2010 Free Software Foundation, Inc. # -+# Copyright (c) 2001-2011,2013 Free Software Foundation, Inc. # - # # - # Permission is hereby granted, free of charge, to any person obtaining a # - # copy of this software and associated documentation files (the "Software"), # -@@ -29,7 +29,7 @@ - # Author: Thomas Dickey - # and: Ilya Zakharevich - # --# $Id: Caps.keys,v 1.4 2010/12/04 18:47:13 tom Exp $ -+# $Id: Caps.keys,v 1.7 2013/07/20 17:59:24 tom Exp $ - # - # This is an adaptation of ncurses' termcap/terminfo capability table, which - # is illustrates an experimental extension to describe alt-, shift- and -@@ -229,11 +229,11 @@ - over_strike os bool os - - YBCG- terminal can overstrike - status_line_esc_ok eslok bool es - - YB-G- escape can be used on the status line - dest_tabs_magic_smso xt bool xt - - YBCGE tabs destructive, magic so char (t1061) --tilde_glitch hz bool hz - - YB-GE can't print ~'s (hazeltine) -+tilde_glitch hz bool hz - - YB-GE cannot print ~'s (hazeltine) - transparent_underline ul bool ul - - YBCGE underline character overstrikes - xon_xoff xon bool xo - - YB--- terminal uses xon/xoff handshaking --needs_xon_xoff nxon bool nx - - ----- padding won't work, xon/xoff required --prtr_silent mc5i bool 5i - - ----- printer won't echo on screen -+needs_xon_xoff nxon bool nx - - ----- padding will not work, xon/xoff required -+prtr_silent mc5i bool 5i - - ----- printer will not echo on screen - hard_cursor chts bool HC - - ----- cursor is hard to see - non_rev_rmcup nrrmc bool NR - - ----- smcup does not reverse rmcup - no_pad_char npc bool NP - - ----- pad character does not exist -@@ -277,7 +277,7 @@ - # These came in with SVr4's color support - max_colors colors num Co - - ----- maximum number of colors on screen - max_pairs pairs num pa - - ----- maximum number of color-pairs on the screen --no_color_video ncv num NC - - ----- video attributes that can't be used with colors -+no_color_video ncv num NC - - ----- video attributes that cannot be used with colors - #%.TE - #%.ad - #% -@@ -828,11 +828,13 @@ - #%.ad - #% - #%.in .8i --#%The XSI Curses standard added these. They are some post-4.1 --#%versions of System V curses, e.g., Solaris 2.5 and IRIX 6.x. --#%The \fBncurses\fR termcap names for them are invented; according to the --#%XSI Curses standard, they have no termcap names. If your compiled terminfo --#%entries use these, they may not be binary-compatible with System V terminfo -+#%The XSI Curses standard added these hardcopy capabilities. -+#%They were used in some post-4.1 versions of System V curses, -+#%e.g., Solaris 2.5 and IRIX 6.x. -+#%Except for \fBYI\fP, the \fBncurses\fR termcap names for them are invented. -+#%According to the XSI Curses standard, they have no termcap names. -+#%If your compiled terminfo entries use these, -+#%they may not be binary-compatible with System V terminfo - #%entries after SVr4.1; beware! - #% - #%.na -@@ -850,7 +852,7 @@ - enter_top_hl_mode ethlm str Xt - - ----- Enter top highlight mode - enter_vertical_hl_mode evhlm str Xv - - ----- Enter vertical highlight mode - set_a_attributes sgr1 str sA - - ----- Define second set of video attributes #1-#6 --set_pglen_inch slength str sL - - ----- YI Set page length to #1 hundredth of an inch -+set_pglen_inch slength str YI - - ----- Set page length to #1 hundredth of an inch (some implementations use sL for termcap). - #%.TE - #%.ad - # -diff -Naur ncurses-5.9/include/Caps.osf1r5 ncurses-5.9.patch/include/Caps.osf1r5 ---- ncurses-5.9/include/Caps.osf1r5 2010-12-04 19:47:13.000000000 +0100 -+++ ncurses-5.9.patch/include/Caps.osf1r5 2014-09-01 16:33:22.342792099 +0200 -@@ -1,5 +1,5 @@ - ############################################################################## --# Copyright (c) 2002-2006,2010 Free Software Foundation, Inc. # -+# Copyright (c) 2002-2010,2011 Free Software Foundation, Inc. # - # # - # Permission is hereby granted, free of charge, to any person obtaining a # - # copy of this software and associated documentation files (the "Software"), # -@@ -28,7 +28,7 @@ - # - # Author: Thomas Dickey - # --# $Id: Caps.osf1r5,v 1.5 2010/12/04 18:47:13 tom Exp $ -+# $Id: Caps.osf1r5,v 1.6 2011/10/15 22:52:09 tom Exp $ - # - # This is an adaptation of ncurses' termcap/terminfo capability table, which - # is designed to align with OSF/1 version 5 (Tru64) terminfo. -@@ -769,7 +769,7 @@ - xoff_character xoffc str XF - - ----- XOFF character - xon_character xonc str XN - - ----- XON character - zero_motion zerom str Zx - - ----- No motion for subsequent character --set_pglen_inch slength str sL - - ----- YI Set page length to #1 hundredth of an inch -+set_pglen_inch slength str YI - - ----- Set page length to #1 hundredth of an inch (some implementations use sL for termcap). - enter_horizontal_hl_mode ehhlm str Xh - - ----- Enter horizontal highlight mode - enter_left_hl_mode elhlm str Xl - - ----- Enter left highlight mode - enter_low_hl_mode elohlm str Xo - - ----- Enter low highlight mode -diff -Naur ncurses-5.9/include/curses.h.in ncurses-5.9.patch/include/curses.h.in ---- ncurses-5.9/include/curses.h.in 2011-01-22 20:47:20.000000000 +0100 -+++ ncurses-5.9.patch/include/curses.h.in 2014-09-01 16:34:19.469887090 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2010,2011 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2013,2014 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -32,7 +32,7 @@ - * and: Thomas E. Dickey 1996-on * - ****************************************************************************/ - --/* $Id: curses.h.in,v 1.220 2011/01/22 19:47:20 tom Exp $ */ -+/* $Id: curses.h.in,v 1.239 2014/03/22 22:57:35 tom Exp $ */ - - #ifndef __NCURSES_H - #define __NCURSES_H -@@ -59,6 +59,10 @@ - */ - #include <ncurses_dll.h> - -+#if @HAVE_STDINT_H@ -+#include <stdint.h> -+#endif -+ - /* - * User-definable tweak to disable the include of <stdbool.h>. - */ -@@ -91,11 +95,20 @@ - #define NCURSES_INLINE @NCURSES_INLINE@ - - /* -- * The internal type used for color values -+ * The internal type used for color values, and for color-pairs. The latter -+ * allows the curses library to enumerate the combinations of foreground and -+ * background colors used by an application, and is normally the product of the -+ * total foreground and background colors. -+ * -+ * X/Open uses "short" for both of these types, ultimately because they are -+ * numbers from the terminal database, which uses 16-bit signed values. - */ - #undef NCURSES_COLOR_T - #define NCURSES_COLOR_T short - -+#undef NCURSES_PAIRS_T -+#define NCURSES_PAIRS_T short -+ - /* - * Definition used to make WINDOW and similar structs opaque. - */ -@@ -129,6 +142,13 @@ - #define NCURSES_TPARM_VARARGS @NCURSES_TPARM_VARARGS@ - - /* -+ * Control type used for tparm's arguments. While X/Open equates long and -+ * char* values, this is not always workable for 64-bit platforms. -+ */ -+#undef NCURSES_TPARM_ARG -+#define NCURSES_TPARM_ARG @NCURSES_TPARM_ARG@ -+ -+/* - * NCURSES_CH_T is used in building the library, but not used otherwise in - * this header file, since that would make the normal/wide-character versions - * of the header incompatible. -@@ -140,8 +160,8 @@ - typedef unsigned chtype; - typedef unsigned mmask_t; - #else --typedef unsigned @cf_cv_typeof_chtype@ chtype; --typedef unsigned @cf_cv_typeof_mmask_t@ mmask_t; -+typedef @cf_cv_typeof_chtype@ chtype; -+typedef @cf_cv_typeof_mmask_t@ mmask_t; - #endif - - /* -@@ -151,15 +171,21 @@ - - /* - * With XPG4, you must define _XOPEN_SOURCE_EXTENDED, it is redundant (or -- * conflicting) when _XOPEN_SOURCE is 500 or greater. -+ * conflicting) when _XOPEN_SOURCE is 500 or greater. If NCURSES_WIDECHAR is -+ * not already defined, e.g., if the platform relies upon nonstandard feature -+ * test macros, define it at this point if the standard feature test macros -+ * indicate that it should be defined. - */ --#undef NCURSES_WIDECHAR --#if defined(_XOPEN_SOURCE_EXTENDED) || defined(_XPG5) --#define NCURSES_WIDECHAR -+#ifndef NCURSES_WIDECHAR -+#if defined(_XOPEN_SOURCE_EXTENDED) || (defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE - 0 >= 500)) -+#define NCURSES_WIDECHAR 1 -+#else -+#define NCURSES_WIDECHAR 0 - #endif -+#endif /* NCURSES_WIDECHAR */ - - #include <stdarg.h> /* we need va_list */ --#ifdef NCURSES_WIDECHAR -+#if NCURSES_WIDECHAR - #include <stddef.h> /* we want wchar_t */ - #endif - -@@ -231,6 +257,10 @@ - #define WA_TOP A_TOP - #define WA_VERTICAL A_VERTICAL - -+#if @NCURSES_EXT_FUNCS@ -+#define WA_ITALIC A_ITALIC /* ncurses extension */ -+#endif -+ - /* colors */ - #define COLOR_BLACK 0 - #define COLOR_RED 1 -@@ -250,7 +280,7 @@ - extern NCURSES_EXPORT_VAR(chtype) acs_map[]; - #endif - --#define NCURSES_ACS(c) (acs_map[NCURSES_CAST(unsigned char,c)]) -+#define NCURSES_ACS(c) (acs_map[NCURSES_CAST(unsigned char,(c))]) - - /* VT100 symbols begin here */ - #define ACS_ULCORNER NCURSES_ACS('l') /* upper left corner */ -@@ -342,7 +372,7 @@ - - typedef chtype attr_t; /* ...must be at least as wide as chtype */ - --#ifdef NCURSES_WIDECHAR -+#if NCURSES_WIDECHAR - - #if @NCURSES_LIBUTF8@ - #ifdef mblen /* libutf8.h defines it w/o undefining first */ -@@ -366,7 +396,7 @@ - /* - * cchar_t stores an array of CCHARW_MAX wide characters. The first is - * normally a spacing character. The others are non-spacing. If those -- * (spacing and nonspacing) do not fill the array, a null L'\0' follows. -+ * (spacing and nonspacing) do not fill the array, a null L'\0' follows. - * Otherwise, a null is assumed to follow when extracting via getcchar(). - */ - #define CCHARW_MAX @NCURSES_CCHARW_MAX@ -@@ -434,7 +464,7 @@ - - NCURSES_SIZE_T _yoffset; /* real begy is _begy + _yoffset */ - --#ifdef NCURSES_WIDECHAR -+#if NCURSES_WIDECHAR - cchar_t _bkgrnd; /* current background char/attribute pair */ - #if @NCURSES_EXT_COLORS@ - int _color; /* current color-pair for non-space character */ -@@ -556,10 +586,10 @@ - extern NCURSES_EXPORT(int) attroff (NCURSES_ATTR_T); /* generated */ - extern NCURSES_EXPORT(int) attron (NCURSES_ATTR_T); /* generated */ - extern NCURSES_EXPORT(int) attrset (NCURSES_ATTR_T); /* generated */ --extern NCURSES_EXPORT(int) attr_get (attr_t *, short *, void *); /* generated */ -+extern NCURSES_EXPORT(int) attr_get (attr_t *, NCURSES_PAIRS_T *, void *); /* generated */ - extern NCURSES_EXPORT(int) attr_off (attr_t, void *); /* generated */ - extern NCURSES_EXPORT(int) attr_on (attr_t, void *); /* generated */ --extern NCURSES_EXPORT(int) attr_set (attr_t, short, void *); /* generated */ -+extern NCURSES_EXPORT(int) attr_set (attr_t, NCURSES_PAIRS_T, void *); /* generated */ - extern NCURSES_EXPORT(int) baudrate (void); /* implemented */ - extern NCURSES_EXPORT(int) beep (void); /* implemented */ - extern NCURSES_EXPORT(int) bkgd (chtype); /* generated */ -@@ -568,13 +598,13 @@ - extern NCURSES_EXPORT(int) box (WINDOW *, chtype, chtype); /* generated */ - extern NCURSES_EXPORT(bool) can_change_color (void); /* implemented */ - extern NCURSES_EXPORT(int) cbreak (void); /* implemented */ --extern NCURSES_EXPORT(int) chgat (int, attr_t, short, const void *); /* generated */ -+extern NCURSES_EXPORT(int) chgat (int, attr_t, NCURSES_PAIRS_T, const void *); /* generated */ - extern NCURSES_EXPORT(int) clear (void); /* generated */ - extern NCURSES_EXPORT(int) clearok (WINDOW *,bool); /* implemented */ - extern NCURSES_EXPORT(int) clrtobot (void); /* generated */ - extern NCURSES_EXPORT(int) clrtoeol (void); /* generated */ --extern NCURSES_EXPORT(int) color_content (short,short*,short*,short*); /* implemented */ --extern NCURSES_EXPORT(int) color_set (short,void*); /* generated */ -+extern NCURSES_EXPORT(int) color_content (NCURSES_COLOR_T,NCURSES_COLOR_T*,NCURSES_COLOR_T*,NCURSES_COLOR_T*); /* implemented */ -+extern NCURSES_EXPORT(int) color_set (NCURSES_PAIRS_T,void*); /* generated */ - extern NCURSES_EXPORT(int) COLOR_PAIR (int); /* generated */ - extern NCURSES_EXPORT(int) copywin (const WINDOW*,WINDOW*,int,int,int,int,int,int,int); /* implemented */ - extern NCURSES_EXPORT(int) curs_set (int); /* implemented */ -@@ -613,8 +643,8 @@ - extern NCURSES_EXPORT(int) inchnstr (chtype *, int); /* generated */ - extern NCURSES_EXPORT(int) inchstr (chtype *); /* generated */ - extern NCURSES_EXPORT(WINDOW *) initscr (void); /* implemented */ --extern NCURSES_EXPORT(int) init_color (short,short,short,short); /* implemented */ --extern NCURSES_EXPORT(int) init_pair (short,short,short); /* implemented */ -+extern NCURSES_EXPORT(int) init_color (NCURSES_COLOR_T,NCURSES_COLOR_T,NCURSES_COLOR_T,NCURSES_COLOR_T); /* implemented */ -+extern NCURSES_EXPORT(int) init_pair (NCURSES_PAIRS_T,NCURSES_COLOR_T,NCURSES_COLOR_T); /* implemented */ - extern NCURSES_EXPORT(int) innstr (char *, int); /* generated */ - extern NCURSES_EXPORT(int) insch (chtype); /* generated */ - extern NCURSES_EXPORT(int) insdelln (int); /* generated */ -@@ -638,7 +668,7 @@ - extern NCURSES_EXPORT(int) mvaddchstr (int, int, const chtype *); /* generated */ - extern NCURSES_EXPORT(int) mvaddnstr (int, int, const char *, int); /* generated */ - extern NCURSES_EXPORT(int) mvaddstr (int, int, const char *); /* generated */ --extern NCURSES_EXPORT(int) mvchgat (int, int, int, attr_t, short, const void *); /* generated */ -+extern NCURSES_EXPORT(int) mvchgat (int, int, int, attr_t, NCURSES_PAIRS_T, const void *); /* generated */ - extern NCURSES_EXPORT(int) mvcur (int,int,int,int); /* implemented */ - extern NCURSES_EXPORT(int) mvdelch (int, int); /* generated */ - extern NCURSES_EXPORT(int) mvderwin (WINDOW *, int, int); /* implemented */ -@@ -664,7 +694,7 @@ - extern NCURSES_EXPORT(int) mvwaddchstr (WINDOW *, int, int, const chtype *); /* generated */ - extern NCURSES_EXPORT(int) mvwaddnstr (WINDOW *, int, int, const char *, int); /* generated */ - extern NCURSES_EXPORT(int) mvwaddstr (WINDOW *, int, int, const char *); /* generated */ --extern NCURSES_EXPORT(int) mvwchgat (WINDOW *, int, int, int, attr_t, short, const void *);/* generated */ -+extern NCURSES_EXPORT(int) mvwchgat (WINDOW *, int, int, int, attr_t, NCURSES_PAIRS_T, const void *);/* generated */ - extern NCURSES_EXPORT(int) mvwdelch (WINDOW *, int, int); /* generated */ - extern NCURSES_EXPORT(int) mvwgetch (WINDOW *, int, int); /* generated */ - extern NCURSES_EXPORT(int) mvwgetnstr (WINDOW *, int, int, char *, int); /* generated */ -@@ -698,7 +728,7 @@ - extern NCURSES_EXPORT(int) notimeout (WINDOW *,bool); /* implemented */ - extern NCURSES_EXPORT(int) overlay (const WINDOW*,WINDOW *); /* implemented */ - extern NCURSES_EXPORT(int) overwrite (const WINDOW*,WINDOW *); /* implemented */ --extern NCURSES_EXPORT(int) pair_content (short,short*,short*); /* implemented */ -+extern NCURSES_EXPORT(int) pair_content (NCURSES_PAIRS_T,NCURSES_COLOR_T*,NCURSES_COLOR_T*); /* implemented */ - extern NCURSES_EXPORT(int) PAIR_NUMBER (int); /* generated */ - extern NCURSES_EXPORT(int) pechochar (WINDOW *, const chtype); /* implemented */ - extern NCURSES_EXPORT(int) pnoutrefresh (WINDOW*,int,int,int,int,int,int);/* implemented */ -@@ -732,9 +762,9 @@ - extern NCURSES_EXPORT(int) slk_attr_on (attr_t,void*); /* generated:WIDEC */ - extern NCURSES_EXPORT(int) slk_attrset (const chtype); /* implemented */ - extern NCURSES_EXPORT(attr_t) slk_attr (void); /* implemented */ --extern NCURSES_EXPORT(int) slk_attr_set (const attr_t,short,void*); /* implemented */ -+extern NCURSES_EXPORT(int) slk_attr_set (const attr_t,NCURSES_PAIRS_T,void*); /* implemented */ - extern NCURSES_EXPORT(int) slk_clear (void); /* implemented */ --extern NCURSES_EXPORT(int) slk_color (short); /* implemented */ -+extern NCURSES_EXPORT(int) slk_color (NCURSES_PAIRS_T); /* implemented */ - extern NCURSES_EXPORT(int) slk_init (int); /* implemented */ - extern NCURSES_EXPORT(char *) slk_label (int); /* implemented */ - extern NCURSES_EXPORT(int) slk_noutrefresh (void); /* implemented */ -@@ -757,6 +787,7 @@ - extern NCURSES_EXPORT(int) ungetch (int); /* implemented */ - extern NCURSES_EXPORT(int) untouchwin (WINDOW *); /* generated */ - extern NCURSES_EXPORT(void) use_env (bool); /* implemented */ -+extern NCURSES_EXPORT(void) use_tioctl (bool); /* implemented */ - extern NCURSES_EXPORT(int) vidattr (chtype); /* implemented */ - extern NCURSES_EXPORT(int) vidputs (chtype, NCURSES_OUTC); /* implemented */ - extern NCURSES_EXPORT(int) vline (chtype, int); /* generated */ -@@ -772,18 +803,18 @@ - extern NCURSES_EXPORT(int) wattron (WINDOW *, int); /* generated */ - extern NCURSES_EXPORT(int) wattroff (WINDOW *, int); /* generated */ - extern NCURSES_EXPORT(int) wattrset (WINDOW *, int); /* generated */ --extern NCURSES_EXPORT(int) wattr_get (WINDOW *, attr_t *, short *, void *); /* generated */ -+extern NCURSES_EXPORT(int) wattr_get (WINDOW *, attr_t *, NCURSES_PAIRS_T *, void *); /* generated */ - extern NCURSES_EXPORT(int) wattr_on (WINDOW *, attr_t, void *); /* implemented */ - extern NCURSES_EXPORT(int) wattr_off (WINDOW *, attr_t, void *); /* implemented */ --extern NCURSES_EXPORT(int) wattr_set (WINDOW *, attr_t, short, void *); /* generated */ -+extern NCURSES_EXPORT(int) wattr_set (WINDOW *, attr_t, NCURSES_PAIRS_T, void *); /* generated */ - extern NCURSES_EXPORT(int) wbkgd (WINDOW *, chtype); /* implemented */ - extern NCURSES_EXPORT(void) wbkgdset (WINDOW *,chtype); /* implemented */ - extern NCURSES_EXPORT(int) wborder (WINDOW *,chtype,chtype,chtype,chtype,chtype,chtype,chtype,chtype); /* implemented */ --extern NCURSES_EXPORT(int) wchgat (WINDOW *, int, attr_t, short, const void *);/* implemented */ -+extern NCURSES_EXPORT(int) wchgat (WINDOW *, int, attr_t, NCURSES_PAIRS_T, const void *);/* implemented */ - extern NCURSES_EXPORT(int) wclear (WINDOW *); /* implemented */ - extern NCURSES_EXPORT(int) wclrtobot (WINDOW *); /* implemented */ - extern NCURSES_EXPORT(int) wclrtoeol (WINDOW *); /* implemented */ --extern NCURSES_EXPORT(int) wcolor_set (WINDOW*,short,void*); /* implemented */ -+extern NCURSES_EXPORT(int) wcolor_set (WINDOW*,NCURSES_PAIRS_T,void*); /* implemented */ - extern NCURSES_EXPORT(void) wcursyncup (WINDOW *); /* implemented */ - extern NCURSES_EXPORT(int) wdelch (WINDOW *); /* implemented */ - extern NCURSES_EXPORT(int) wdeleteln (WINDOW *); /* generated */ -@@ -832,7 +863,7 @@ - #if NCURSES_TPARM_VARARGS - extern NCURSES_EXPORT(char *) tparm (NCURSES_CONST char *, ...); /* special */ - #else --extern NCURSES_EXPORT(char *) tparm (NCURSES_CONST char *, long,long,long,long,long,long,long,long,long); /* special */ -+extern NCURSES_EXPORT(char *) tparm (NCURSES_CONST char *, NCURSES_TPARM_ARG,NCURSES_TPARM_ARG,NCURSES_TPARM_ARG,NCURSES_TPARM_ARG,NCURSES_TPARM_ARG,NCURSES_TPARM_ARG,NCURSES_TPARM_ARG,NCURSES_TPARM_ARG,NCURSES_TPARM_ARG); /* special */ - extern NCURSES_EXPORT(char *) tparm_varargs (NCURSES_CONST char *, ...); /* special */ - #endif - -@@ -854,7 +885,7 @@ - /* - * vid_attr() was implemented originally based on a draft of X/Open curses. - */ --#ifndef NCURSES_WIDECHAR -+#if !NCURSES_WIDECHAR - #define vid_attr(a,pair,opts) vidattr(a) - #endif - -@@ -903,6 +934,7 @@ - extern NCURSES_EXPORT(bool) is_scrollok (const WINDOW *); /* @GENERATED_EXT_FUNCS@ */ - extern NCURSES_EXPORT(bool) is_subwin (const WINDOW *); /* @GENERATED_EXT_FUNCS@ */ - extern NCURSES_EXPORT(bool) is_syncok (const WINDOW *); /* @GENERATED_EXT_FUNCS@ */ -+extern NCURSES_EXPORT(int) wgetdelay (const WINDOW *); /* @GENERATED_EXT_FUNCS@ */ - extern NCURSES_EXPORT(int) wgetscrreg (const WINDOW *, int *, int *); /* @GENERATED_EXT_FUNCS@ */ - - #else -@@ -929,7 +961,7 @@ - extern NCURSES_EXPORT(bool) NCURSES_SP_NAME(can_change_color) (SCREEN*); /* implemented:SP_FUNC */ - extern NCURSES_EXPORT(int) NCURSES_SP_NAME(cbreak) (SCREEN*); /* implemented:SP_FUNC */ - extern NCURSES_EXPORT(int) NCURSES_SP_NAME(curs_set) (SCREEN*, int); /* implemented:SP_FUNC */ --extern NCURSES_EXPORT(int) NCURSES_SP_NAME(color_content) (SCREEN*, short, short*, short*, short*); /* implemented:SP_FUNC */ -+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(color_content) (SCREEN*, NCURSES_PAIRS_T, NCURSES_COLOR_T*, NCURSES_COLOR_T*, NCURSES_COLOR_T*); /* implemented:SP_FUNC */ - extern NCURSES_EXPORT(int) NCURSES_SP_NAME(def_prog_mode) (SCREEN*); /* implemented:SP_FUNC */ - extern NCURSES_EXPORT(int) NCURSES_SP_NAME(def_shell_mode) (SCREEN*); /* implemented:SP_FUNC */ - extern NCURSES_EXPORT(int) NCURSES_SP_NAME(delay_output) (SCREEN*, int); /* implemented:SP_FUNC */ -@@ -945,8 +977,8 @@ - extern NCURSES_EXPORT(bool) NCURSES_SP_NAME(has_colors) (SCREEN*); /* implemented:SP_FUNC */ - extern NCURSES_EXPORT(bool) NCURSES_SP_NAME(has_ic) (SCREEN*); /* implemented:SP_FUNC */ - extern NCURSES_EXPORT(bool) NCURSES_SP_NAME(has_il) (SCREEN*); /* implemented:SP_FUNC */ --extern NCURSES_EXPORT(int) NCURSES_SP_NAME(init_color) (SCREEN*, short, short, short, short); /* implemented:SP_FUNC */ --extern NCURSES_EXPORT(int) NCURSES_SP_NAME(init_pair) (SCREEN*, short, short, short); /* implemented:SP_FUNC */ -+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(init_color) (SCREEN*, NCURSES_COLOR_T, NCURSES_COLOR_T, NCURSES_COLOR_T, NCURSES_COLOR_T); /* implemented:SP_FUNC */ -+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(init_pair) (SCREEN*, NCURSES_PAIRS_T, NCURSES_COLOR_T, NCURSES_COLOR_T); /* implemented:SP_FUNC */ - extern NCURSES_EXPORT(int) NCURSES_SP_NAME(intrflush) (SCREEN*, WINDOW*, bool); /* implemented:SP_FUNC */ - extern NCURSES_EXPORT(bool) NCURSES_SP_NAME(isendwin) (SCREEN*); /* implemented:SP_FUNC */ - extern NCURSES_EXPORT(NCURSES_CONST char *) NCURSES_SP_NAME(keyname) (SCREEN*, int); /* implemented:SP_FUNC */ -@@ -963,7 +995,7 @@ - extern NCURSES_EXPORT(int) NCURSES_SP_NAME(nonl) (SCREEN*); /* implemented:SP_FUNC */ - extern NCURSES_EXPORT(void) NCURSES_SP_NAME(noqiflush) (SCREEN*); /* implemented:SP_FUNC */ - extern NCURSES_EXPORT(int) NCURSES_SP_NAME(noraw) (SCREEN*); /* implemented:SP_FUNC */ --extern NCURSES_EXPORT(int) NCURSES_SP_NAME(pair_content) (SCREEN*, short, short*, short*); /* implemented:SP_FUNC */ -+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(pair_content) (SCREEN*, NCURSES_PAIRS_T, NCURSES_COLOR_T*, NCURSES_COLOR_T*); /* implemented:SP_FUNC */ - extern NCURSES_EXPORT(void) NCURSES_SP_NAME(qiflush) (SCREEN*); /* implemented:SP_FUNC */ - extern NCURSES_EXPORT(int) NCURSES_SP_NAME(raw) (SCREEN*); /* implemented:SP_FUNC */ - extern NCURSES_EXPORT(int) NCURSES_SP_NAME(reset_prog_mode) (SCREEN*); /* implemented:SP_FUNC */ -@@ -978,9 +1010,9 @@ - extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_attron) (SCREEN*, const chtype); /* implemented:SP_FUNC */ - extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_attrset) (SCREEN*, const chtype); /* implemented:SP_FUNC */ - extern NCURSES_EXPORT(attr_t) NCURSES_SP_NAME(slk_attr) (SCREEN*); /* implemented:SP_FUNC */ --extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_attr_set) (SCREEN*, const attr_t, short, void*); /* implemented:SP_FUNC */ -+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_attr_set) (SCREEN*, const attr_t, NCURSES_PAIRS_T, void*); /* implemented:SP_FUNC */ - extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_clear) (SCREEN*); /* implemented:SP_FUNC */ --extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_color) (SCREEN*, short); /* implemented:SP_FUNC */ -+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_color) (SCREEN*, NCURSES_PAIRS_T); /* implemented:SP_FUNC */ - extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_init) (SCREEN*, int); /* implemented:SP_FUNC */ - extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(slk_label) (SCREEN*, int); /* implemented:SP_FUNC */ - extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_noutrefresh) (SCREEN*); /* implemented:SP_FUNC */ -@@ -994,6 +1026,7 @@ - extern NCURSES_EXPORT(int) NCURSES_SP_NAME(typeahead) (SCREEN*, int); /* implemented:SP_FUNC */ - extern NCURSES_EXPORT(int) NCURSES_SP_NAME(ungetch) (SCREEN*, int); /* implemented:SP_FUNC */ - extern NCURSES_EXPORT(void) NCURSES_SP_NAME(use_env) (SCREEN*, bool); /* implemented:SP_FUNC */ -+extern NCURSES_EXPORT(void) NCURSES_SP_NAME(use_tioctl) (SCREEN*, bool); /* implemented:SP_FUNC */ - extern NCURSES_EXPORT(int) NCURSES_SP_NAME(vidattr) (SCREEN*, chtype); /* implemented:SP_FUNC */ - extern NCURSES_EXPORT(int) NCURSES_SP_NAME(vidputs) (SCREEN*, chtype, NCURSES_SP_OUTC); /* implemented:SP_FUNC */ - #if @NCURSES_EXT_FUNCS@ -@@ -1022,7 +1055,7 @@ - /* attributes */ - - #define NCURSES_ATTR_SHIFT 8 --#define NCURSES_BITS(mask,shift) ((mask) << ((shift) + NCURSES_ATTR_SHIFT)) -+#define NCURSES_BITS(mask,shift) (NCURSES_CAST(chtype,(mask)) << ((shift) + NCURSES_ATTR_SHIFT)) - - #define A_NORMAL (@cf_cv_1UL@ - @cf_cv_1UL@) - #define A_ATTRIBUTES NCURSES_BITS(~(@cf_cv_1UL@ - @cf_cv_1UL@),0) -@@ -1044,6 +1077,10 @@ - #define A_TOP NCURSES_BITS(@cf_cv_1UL@,21) - #define A_VERTICAL NCURSES_BITS(@cf_cv_1UL@,22) - -+#if @NCURSES_EXT_FUNCS@ -+#define A_ITALIC NCURSES_BITS(@cf_cv_1UL@,23) /* ncurses extension */ -+#endif -+ - /* - * Most of the pseudo functions are macros that either provide compatibility - * with older versions of curses, or provide inline functionality to improve -@@ -1084,7 +1121,7 @@ - */ - - #define wgetstr(w, s) wgetnstr(w, s, -1) --#define getnstr(s, n) wgetnstr(stdscr, s, n) -+#define getnstr(s, n) wgetnstr(stdscr, s, (n)) - - #define setterm(term) setupterm(term, 1, (int *)0) - -@@ -1115,7 +1152,7 @@ - #define wattroff(win,at) wattr_off(win, NCURSES_CAST(attr_t, at), NULL) - - #if !NCURSES_OPAQUE --#if defined(NCURSES_WIDECHAR) && @NCURSES_EXT_COLORS@ -+#if NCURSES_WIDECHAR && @NCURSES_EXT_COLORS@ - #define wattrset(win,at) ((win) \ - ? ((win)->_color = PAIR_NUMBER(at), \ - (win)->_attrs = NCURSES_CAST(attr_t, at), \ -@@ -1137,15 +1174,15 @@ - - #define box(win, v, h) wborder(win, v, v, h, h, 0, 0, 0, 0) - #define border(ls, rs, ts, bs, tl, tr, bl, br) wborder(stdscr, ls, rs, ts, bs, tl, tr, bl, br) --#define hline(ch, n) whline(stdscr, ch, n) --#define vline(ch, n) wvline(stdscr, ch, n) -+#define hline(ch, n) whline(stdscr, ch, (n)) -+#define vline(ch, n) wvline(stdscr, ch, (n)) - - #define winstr(w, s) winnstr(w, s, -1) - #define winchstr(w, s) winchnstr(w, s, -1) - #define winsstr(w, s) winsnstr(w, s, -1) - - #if !NCURSES_OPAQUE --#define redrawwin(win) wredrawln(win, 0, (win)->_maxy+1) -+#define redrawwin(win) wredrawln(win, 0, ((win) ? (win)->_maxy+1 : -1)) - #endif /* NCURSES_OPAQUE */ - - #define waddstr(win,str) waddnstr(win,str,-1) -@@ -1154,55 +1191,55 @@ - /* - * These apply to the first 256 color pairs. - */ --#define COLOR_PAIR(n) NCURSES_BITS(n, 0) --#define PAIR_NUMBER(a) (NCURSES_CAST(int,((NCURSES_CAST(unsigned long,a) & A_COLOR) >> NCURSES_ATTR_SHIFT))) -+#define COLOR_PAIR(n) NCURSES_BITS((n), 0) -+#define PAIR_NUMBER(a) (NCURSES_CAST(int,((NCURSES_CAST(unsigned long,(a)) & A_COLOR) >> NCURSES_ATTR_SHIFT))) - - /* - * pseudo functions for standard screen - */ - --#define addch(ch) waddch(stdscr,ch) --#define addchnstr(str,n) waddchnstr(stdscr,str,n) --#define addchstr(str) waddchstr(stdscr,str) --#define addnstr(str,n) waddnstr(stdscr,str,n) --#define addstr(str) waddnstr(stdscr,str,-1) --#define attroff(at) wattroff(stdscr,at) --#define attron(at) wattron(stdscr,at) --#define attrset(at) wattrset(stdscr,at) --#define attr_get(ap,cp,o) wattr_get(stdscr,ap,cp,o) --#define attr_off(a,o) wattr_off(stdscr,a,o) --#define attr_on(a,o) wattr_on(stdscr,a,o) --#define attr_set(a,c,o) wattr_set(stdscr,a,c,o) --#define bkgd(ch) wbkgd(stdscr,ch) --#define bkgdset(ch) wbkgdset(stdscr,ch) --#define chgat(n,a,c,o) wchgat(stdscr,n,a,c,o) -+#define addch(ch) waddch(stdscr,(ch)) -+#define addchnstr(str,n) waddchnstr(stdscr,(str),(n)) -+#define addchstr(str) waddchstr(stdscr,(str)) -+#define addnstr(str,n) waddnstr(stdscr,(str),(n)) -+#define addstr(str) waddnstr(stdscr,(str),-1) -+#define attroff(at) wattroff(stdscr,(at)) -+#define attron(at) wattron(stdscr,(at)) -+#define attrset(at) wattrset(stdscr,(at)) -+#define attr_get(ap,cp,o) wattr_get(stdscr,(ap),(cp),(o)) -+#define attr_off(a,o) wattr_off(stdscr,(a),(o)) -+#define attr_on(a,o) wattr_on(stdscr,(a),(o)) -+#define attr_set(a,c,o) wattr_set(stdscr,(a),(c),(o)) -+#define bkgd(ch) wbkgd(stdscr,(ch)) -+#define bkgdset(ch) wbkgdset(stdscr,(ch)) -+#define chgat(n,a,c,o) wchgat(stdscr,(n),(a),(c),(o)) - #define clear() wclear(stdscr) - #define clrtobot() wclrtobot(stdscr) - #define clrtoeol() wclrtoeol(stdscr) --#define color_set(c,o) wcolor_set(stdscr,c,o) -+#define color_set(c,o) wcolor_set(stdscr,(c),(o)) - #define delch() wdelch(stdscr) - #define deleteln() winsdelln(stdscr,-1) --#define echochar(c) wechochar(stdscr,c) -+#define echochar(c) wechochar(stdscr,(c)) - #define erase() werase(stdscr) - #define getch() wgetch(stdscr) --#define getstr(str) wgetstr(stdscr,str) -+#define getstr(str) wgetstr(stdscr,(str)) - #define inch() winch(stdscr) --#define inchnstr(s,n) winchnstr(stdscr,s,n) --#define inchstr(s) winchstr(stdscr,s) --#define innstr(s,n) winnstr(stdscr,s,n) --#define insch(c) winsch(stdscr,c) --#define insdelln(n) winsdelln(stdscr,n) -+#define inchnstr(s,n) winchnstr(stdscr,(s),(n)) -+#define inchstr(s) winchstr(stdscr,(s)) -+#define innstr(s,n) winnstr(stdscr,(s),(n)) -+#define insch(c) winsch(stdscr,(c)) -+#define insdelln(n) winsdelln(stdscr,(n)) - #define insertln() winsdelln(stdscr,1) --#define insnstr(s,n) winsnstr(stdscr,s,n) --#define insstr(s) winsstr(stdscr,s) --#define instr(s) winstr(stdscr,s) --#define move(y,x) wmove(stdscr,y,x) -+#define insnstr(s,n) winsnstr(stdscr,(s),(n)) -+#define insstr(s) winsstr(stdscr,(s)) -+#define instr(s) winstr(stdscr,(s)) -+#define move(y,x) wmove(stdscr,(y),(x)) - #define refresh() wrefresh(stdscr) --#define scrl(n) wscrl(stdscr,n) --#define setscrreg(t,b) wsetscrreg(stdscr,t,b) -+#define scrl(n) wscrl(stdscr,(n)) -+#define setscrreg(t,b) wsetscrreg(stdscr,(t),(b)) - #define standend() wstandend(stdscr) - #define standout() wstandout(stdscr) --#define timeout(delay) wtimeout(stdscr,delay) -+#define timeout(delay) wtimeout(stdscr,(delay)) - #define wdeleteln(win) winsdelln(win,-1) - #define winsertln(win) winsdelln(win,1) - -@@ -1210,70 +1247,75 @@ - * mv functions - */ - --#define mvwaddch(win,y,x,ch) (wmove(win,y,x) == ERR ? ERR : waddch(win,ch)) --#define mvwaddchnstr(win,y,x,str,n) (wmove(win,y,x) == ERR ? ERR : waddchnstr(win,str,n)) --#define mvwaddchstr(win,y,x,str) (wmove(win,y,x) == ERR ? ERR : waddchnstr(win,str,-1)) --#define mvwaddnstr(win,y,x,str,n) (wmove(win,y,x) == ERR ? ERR : waddnstr(win,str,n)) --#define mvwaddstr(win,y,x,str) (wmove(win,y,x) == ERR ? ERR : waddnstr(win,str,-1)) --#define mvwdelch(win,y,x) (wmove(win,y,x) == ERR ? ERR : wdelch(win)) --#define mvwchgat(win,y,x,n,a,c,o) (wmove(win,y,x) == ERR ? ERR : wchgat(win,n,a,c,o)) --#define mvwgetch(win,y,x) (wmove(win,y,x) == ERR ? ERR : wgetch(win)) --#define mvwgetnstr(win,y,x,str,n) (wmove(win,y,x) == ERR ? ERR : wgetnstr(win,str,n)) --#define mvwgetstr(win,y,x,str) (wmove(win,y,x) == ERR ? ERR : wgetstr(win,str)) --#define mvwhline(win,y,x,c,n) (wmove(win,y,x) == ERR ? ERR : whline(win,c,n)) --#define mvwinch(win,y,x) (wmove(win,y,x) == ERR ? NCURSES_CAST(chtype, ERR) : winch(win)) --#define mvwinchnstr(win,y,x,s,n) (wmove(win,y,x) == ERR ? ERR : winchnstr(win,s,n)) --#define mvwinchstr(win,y,x,s) (wmove(win,y,x) == ERR ? ERR : winchstr(win,s)) --#define mvwinnstr(win,y,x,s,n) (wmove(win,y,x) == ERR ? ERR : winnstr(win,s,n)) --#define mvwinsch(win,y,x,c) (wmove(win,y,x) == ERR ? ERR : winsch(win,c)) --#define mvwinsnstr(win,y,x,s,n) (wmove(win,y,x) == ERR ? ERR : winsnstr(win,s,n)) --#define mvwinsstr(win,y,x,s) (wmove(win,y,x) == ERR ? ERR : winsstr(win,s)) --#define mvwinstr(win,y,x,s) (wmove(win,y,x) == ERR ? ERR : winstr(win,s)) --#define mvwvline(win,y,x,c,n) (wmove(win,y,x) == ERR ? ERR : wvline(win,c,n)) -- --#define mvaddch(y,x,ch) mvwaddch(stdscr,y,x,ch) --#define mvaddchnstr(y,x,str,n) mvwaddchnstr(stdscr,y,x,str,n) --#define mvaddchstr(y,x,str) mvwaddchstr(stdscr,y,x,str) --#define mvaddnstr(y,x,str,n) mvwaddnstr(stdscr,y,x,str,n) --#define mvaddstr(y,x,str) mvwaddstr(stdscr,y,x,str) --#define mvchgat(y,x,n,a,c,o) mvwchgat(stdscr,y,x,n,a,c,o) --#define mvdelch(y,x) mvwdelch(stdscr,y,x) --#define mvgetch(y,x) mvwgetch(stdscr,y,x) --#define mvgetnstr(y,x,str,n) mvwgetnstr(stdscr,y,x,str,n) --#define mvgetstr(y,x,str) mvwgetstr(stdscr,y,x,str) --#define mvhline(y,x,c,n) mvwhline(stdscr,y,x,c,n) --#define mvinch(y,x) mvwinch(stdscr,y,x) --#define mvinchnstr(y,x,s,n) mvwinchnstr(stdscr,y,x,s,n) --#define mvinchstr(y,x,s) mvwinchstr(stdscr,y,x,s) --#define mvinnstr(y,x,s,n) mvwinnstr(stdscr,y,x,s,n) --#define mvinsch(y,x,c) mvwinsch(stdscr,y,x,c) --#define mvinsnstr(y,x,s,n) mvwinsnstr(stdscr,y,x,s,n) --#define mvinsstr(y,x,s) mvwinsstr(stdscr,y,x,s) --#define mvinstr(y,x,s) mvwinstr(stdscr,y,x,s) --#define mvvline(y,x,c,n) mvwvline(stdscr,y,x,c,n) -+#define mvwaddch(win,y,x,ch) (wmove((win),(y),(x)) == ERR ? ERR : waddch((win),(ch))) -+#define mvwaddchnstr(win,y,x,str,n) (wmove((win),(y),(x)) == ERR ? ERR : waddchnstr((win),(str),(n))) -+#define mvwaddchstr(win,y,x,str) (wmove((win),(y),(x)) == ERR ? ERR : waddchnstr((win),(str),-1)) -+#define mvwaddnstr(win,y,x,str,n) (wmove((win),(y),(x)) == ERR ? ERR : waddnstr((win),(str),(n))) -+#define mvwaddstr(win,y,x,str) (wmove((win),(y),(x)) == ERR ? ERR : waddnstr((win),(str),-1)) -+#define mvwdelch(win,y,x) (wmove((win),(y),(x)) == ERR ? ERR : wdelch(win)) -+#define mvwchgat(win,y,x,n,a,c,o) (wmove((win),(y),(x)) == ERR ? ERR : wchgat((win),(n),(a),(c),(o))) -+#define mvwgetch(win,y,x) (wmove((win),(y),(x)) == ERR ? ERR : wgetch(win)) -+#define mvwgetnstr(win,y,x,str,n) (wmove((win),(y),(x)) == ERR ? ERR : wgetnstr((win),(str),(n))) -+#define mvwgetstr(win,y,x,str) (wmove((win),(y),(x)) == ERR ? ERR : wgetstr((win),(str))) -+#define mvwhline(win,y,x,c,n) (wmove((win),(y),(x)) == ERR ? ERR : whline((win),(c),(n))) -+#define mvwinch(win,y,x) (wmove((win),(y),(x)) == ERR ? NCURSES_CAST(chtype, ERR) : winch(win)) -+#define mvwinchnstr(win,y,x,s,n) (wmove((win),(y),(x)) == ERR ? ERR : winchnstr((win),(s),(n))) -+#define mvwinchstr(win,y,x,s) (wmove((win),(y),(x)) == ERR ? ERR : winchstr((win),(s))) -+#define mvwinnstr(win,y,x,s,n) (wmove((win),(y),(x)) == ERR ? ERR : winnstr((win),(s),(n))) -+#define mvwinsch(win,y,x,c) (wmove((win),(y),(x)) == ERR ? ERR : winsch((win),(c))) -+#define mvwinsnstr(win,y,x,s,n) (wmove((win),(y),(x)) == ERR ? ERR : winsnstr((win),(s),(n))) -+#define mvwinsstr(win,y,x,s) (wmove((win),(y),(x)) == ERR ? ERR : winsstr((win),(s))) -+#define mvwinstr(win,y,x,s) (wmove((win),(y),(x)) == ERR ? ERR : winstr((win),(s))) -+#define mvwvline(win,y,x,c,n) (wmove((win),(y),(x)) == ERR ? ERR : wvline((win),(c),(n))) -+ -+#define mvaddch(y,x,ch) mvwaddch(stdscr,(y),(x),(ch)) -+#define mvaddchnstr(y,x,str,n) mvwaddchnstr(stdscr,(y),(x),(str),(n)) -+#define mvaddchstr(y,x,str) mvwaddchstr(stdscr,(y),(x),(str)) -+#define mvaddnstr(y,x,str,n) mvwaddnstr(stdscr,(y),(x),(str),(n)) -+#define mvaddstr(y,x,str) mvwaddstr(stdscr,(y),(x),(str)) -+#define mvchgat(y,x,n,a,c,o) mvwchgat(stdscr,(y),(x),(n),(a),(c),(o)) -+#define mvdelch(y,x) mvwdelch(stdscr,(y),(x)) -+#define mvgetch(y,x) mvwgetch(stdscr,(y),(x)) -+#define mvgetnstr(y,x,str,n) mvwgetnstr(stdscr,(y),(x),(str),(n)) -+#define mvgetstr(y,x,str) mvwgetstr(stdscr,(y),(x),(str)) -+#define mvhline(y,x,c,n) mvwhline(stdscr,(y),(x),(c),(n)) -+#define mvinch(y,x) mvwinch(stdscr,(y),(x)) -+#define mvinchnstr(y,x,s,n) mvwinchnstr(stdscr,(y),(x),(s),(n)) -+#define mvinchstr(y,x,s) mvwinchstr(stdscr,(y),(x),(s)) -+#define mvinnstr(y,x,s,n) mvwinnstr(stdscr,(y),(x),(s),(n)) -+#define mvinsch(y,x,c) mvwinsch(stdscr,(y),(x),(c)) -+#define mvinsnstr(y,x,s,n) mvwinsnstr(stdscr,(y),(x),(s),(n)) -+#define mvinsstr(y,x,s) mvwinsstr(stdscr,(y),(x),(s)) -+#define mvinstr(y,x,s) mvwinstr(stdscr,(y),(x),(s)) -+#define mvvline(y,x,c,n) mvwvline(stdscr,(y),(x),(c),(n)) - - /* - * Some wide-character functions can be implemented without the extensions. - */ - #if !NCURSES_OPAQUE --#define getbkgd(win) ((win)->_bkgd) -+#define getbkgd(win) ((win) ? ((win)->_bkgd) : 0) - #endif /* NCURSES_OPAQUE */ - - #define slk_attr_off(a,v) ((v) ? ERR : slk_attroff(a)) - #define slk_attr_on(a,v) ((v) ? ERR : slk_attron(a)) - - #if !NCURSES_OPAQUE --#if defined(NCURSES_WIDECHAR) && @NCURSES_EXT_COLORS@ --#define wattr_set(win,a,p,opts) ((win)->_attrs = ((a) & ~A_COLOR), \ -- (win)->_color = (p), \ -+#if NCURSES_WIDECHAR && @NCURSES_EXT_COLORS@ -+#define wattr_set(win,a,p,opts) (((win) \ -+ ? ((win)->_attrs = ((a) & ~A_COLOR), \ -+ (win)->_color = (p)) \ -+ : OK), \ - OK) --#define wattr_get(win,a,p,opts) ((void)((a) != (void *)0 && (*(a) = (win)->_attrs)), \ -- (void)((p) != (void *)0 && (*(p) = (short)(win)->_color)), \ -+#define wattr_get(win,a,p,opts) ((void)(((a) != (void *)0) ? (*(a) = (win) ? (win)->_attrs : 0) : OK), \ -+ (void)(((p) != (void *)0) ? (*(p) = (NCURSES_PAIRS_T) ((win) ? (win)->_color : 0)) : OK), \ - OK) - #else --#define wattr_set(win,a,p,opts) ((win)->_attrs = (((a) & ~A_COLOR) | (attr_t)COLOR_PAIR(p)), OK) --#define wattr_get(win,a,p,opts) ((void)((a) != (void *)0 && (*(a) = (win)->_attrs)), \ -- (void)((p) != (void *)0 && (*(p) = (short)PAIR_NUMBER((win)->_attrs))), \ -+#define wattr_set(win,a,p,opts) (((win) \ -+ ? ((win)->_attrs = (((a) & ~A_COLOR) | (attr_t)COLOR_PAIR(p))) \ -+ : OK), \ -+ OK) -+#define wattr_get(win,a,p,opts) ((void)(((a) != (void *)0) ? (*(a) = (win) ? (win)->_attrs : 0) : OK), \ -+ (void)(((p) != (void *)0) ? (*(p) = (NCURSES_PAIRS_T) ((win) ? PAIR_NUMBER((win)->_attrs) : 0)) : OK), \ - OK) - #endif - #endif /* NCURSES_OPAQUE */ -@@ -1312,6 +1354,7 @@ - #define is_scrollok(win) ((win) ? (win)->_scroll : FALSE) - #define is_subwin(win) ((win) ? ((win)->_flags & _SUBWIN) != 0 : FALSE) - #define is_syncok(win) ((win) ? (win)->_sync : FALSE) -+#define wgetdelay(win) ((win) ? (win)->_delay : 0) - #define wgetparent(win) ((win) ? (win)->_parent : 0) - #define wgetscrreg(win,t,b) ((win) ? (*(t) = (win)->_regtop, *(b) = (win)->_regbottom, OK) : ERR) - #endif -diff -Naur ncurses-5.9/include/curses.tail ncurses-5.9.patch/include/curses.tail ---- ncurses-5.9/include/curses.tail 2010-03-28 21:10:55.000000000 +0200 -+++ ncurses-5.9.patch/include/curses.tail 2014-09-01 16:33:22.343792101 +0200 -@@ -1,4 +1,4 @@ --/* $Id: curses.tail,v 1.20 2010/03/28 19:10:55 tom Exp $ */ -+/* $Id: curses.tail,v 1.21 2011/10/29 20:03:22 tom Exp $ */ - /* - * vile:cmode: - * This file is part of ncurses, designed to be appended after curses.h.in -@@ -133,7 +133,7 @@ - extern NCURSES_EXPORT(char *) _tracechar (int); - extern NCURSES_EXPORT(char *) _tracechtype (chtype); - extern NCURSES_EXPORT(char *) _tracechtype2 (int, chtype); --#ifdef NCURSES_WIDECHAR -+#if NCURSES_WIDECHAR - #define _tracech_t _tracecchar_t - extern NCURSES_EXPORT(char *) _tracecchar_t (const cchar_t *); - #define _tracech_t2 _tracecchar_t2 -diff -Naur ncurses-5.9/include/curses.wide ncurses-5.9.patch/include/curses.wide ---- ncurses-5.9/include/curses.wide 2010-03-30 02:39:41.000000000 +0200 -+++ ncurses-5.9.patch/include/curses.wide 2014-09-01 16:33:22.343792101 +0200 -@@ -1,4 +1,4 @@ --/* $Id: curses.wide,v 1.42 2010/03/30 00:39:41 tom Exp $ */ -+/* $Id: curses.wide,v 1.46 2014/02/01 22:00:32 tom Exp $ */ - /* - * vile:cmode: - * This file is part of ncurses, designed to be appended after curses.h.in -@@ -6,11 +6,11 @@ - */ - #define _XOPEN_CURSES 1 - --#ifdef NCURSES_WIDECHAR -+#if NCURSES_WIDECHAR - - extern NCURSES_EXPORT_VAR(cchar_t *) _nc_wacs; - --#define NCURSES_WACS(c) (&_nc_wacs[(unsigned char)c]) -+#define NCURSES_WACS(c) (&_nc_wacs[NCURSES_CAST(unsigned char,(c))]) - - #define WACS_BSSB NCURSES_WACS('l') - #define WACS_SSBB NCURSES_WACS('m') -@@ -135,7 +135,7 @@ - extern NCURSES_EXPORT(int) get_wch (wint_t *); /* generated:WIDEC */ - extern NCURSES_EXPORT(int) get_wstr (wint_t *); /* generated:WIDEC */ - extern NCURSES_EXPORT(int) getbkgrnd (cchar_t *); /* generated:WIDEC */ --extern NCURSES_EXPORT(int) getcchar (const cchar_t *, wchar_t*, attr_t*, short*, void*); /* implemented */ -+extern NCURSES_EXPORT(int) getcchar (const cchar_t *, wchar_t*, attr_t*, NCURSES_PAIRS_T*, void*); /* implemented */ - extern NCURSES_EXPORT(int) getn_wstr (wint_t *, int); /* generated:WIDEC */ - extern NCURSES_EXPORT(int) hline_set (const cchar_t *, int); /* generated:WIDEC */ - extern NCURSES_EXPORT(int) in_wch (cchar_t *); /* generated:WIDEC */ -@@ -185,12 +185,12 @@ - extern NCURSES_EXPORT(int) mvwinwstr (WINDOW *, int, int, wchar_t *); /* generated:WIDEC */ - extern NCURSES_EXPORT(int) mvwvline_set (WINDOW *, int,int, const cchar_t *,int); /* generated:WIDEC */ - extern NCURSES_EXPORT(int) pecho_wchar (WINDOW *, const cchar_t *); /* implemented */ --extern NCURSES_EXPORT(int) setcchar (cchar_t *, const wchar_t *, const attr_t, short, const void *); /* implemented */ -+extern NCURSES_EXPORT(int) setcchar (cchar_t *, const wchar_t *, const attr_t, NCURSES_PAIRS_T, const void *); /* implemented */ - extern NCURSES_EXPORT(int) slk_wset (int, const wchar_t *, int); /* implemented */ - extern NCURSES_EXPORT(attr_t) term_attrs (void); /* implemented */ - extern NCURSES_EXPORT(int) unget_wch (const wchar_t); /* implemented */ --extern NCURSES_EXPORT(int) vid_attr (attr_t, short, void *); /* implemented */ --extern NCURSES_EXPORT(int) vid_puts (attr_t, short, void *, NCURSES_OUTC); /* implemented */ -+extern NCURSES_EXPORT(int) vid_attr (attr_t, NCURSES_PAIRS_T, void *); /* implemented */ -+extern NCURSES_EXPORT(int) vid_puts (attr_t, NCURSES_PAIRS_T, void *, NCURSES_OUTC); /* implemented */ - extern NCURSES_EXPORT(int) vline_set (const cchar_t *, int); /* generated:WIDEC */ - extern NCURSES_EXPORT(int) wadd_wch (WINDOW *,const cchar_t *); /* implemented */ - extern NCURSES_EXPORT(int) wadd_wchnstr (WINDOW *,const cchar_t *,int); /* implemented */ -@@ -221,8 +221,8 @@ - extern NCURSES_EXPORT(attr_t) NCURSES_SP_NAME(term_attrs) (SCREEN*); /* implemented:SP_FUNC */ - extern NCURSES_EXPORT(int) NCURSES_SP_NAME(unget_wch) (SCREEN*, const wchar_t); /* implemented:SP_FUNC */ - extern NCURSES_EXPORT(wchar_t*) NCURSES_SP_NAME(wunctrl) (SCREEN*, cchar_t *); /* implemented:SP_FUNC */ --extern NCURSES_EXPORT(int) NCURSES_SP_NAME(vid_attr) (SCREEN*, attr_t, short, void *); /* implemented:SP_FUNC */ --extern NCURSES_EXPORT(int) NCURSES_SP_NAME(vid_puts) (SCREEN*, attr_t, short, void *, NCURSES_SP_OUTC); /* implemented:SP_FUNC */ -+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(vid_attr) (SCREEN*, attr_t, NCURSES_PAIRS_T, void *); /* implemented:SP_FUNC */ -+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(vid_puts) (SCREEN*, attr_t, NCURSES_PAIRS_T, void *, NCURSES_SP_OUTC); /* implemented:SP_FUNC */ - #endif - - #ifndef NCURSES_NOMACROS -@@ -230,77 +230,77 @@ - /* - * XSI curses macros for XPG4 conformance. - */ --#define add_wch(c) wadd_wch(stdscr,c) --#define add_wchnstr(str,n) wadd_wchnstr(stdscr,str,n) --#define add_wchstr(str) wadd_wchstr(stdscr,str) --#define addnwstr(wstr,n) waddnwstr(stdscr,wstr,n) --#define addwstr(wstr) waddwstr(stdscr,wstr) --#define bkgrnd(c) wbkgrnd(stdscr,c) --#define bkgrndset(c) wbkgrndset(stdscr,c) --#define border_set(l,r,t,b,tl,tr,bl,br) wborder_set(stdscr,l,r,t,b,tl,tr,bl,br) --#define box_set(w,v,h) wborder_set(w,v,v,h,h,0,0,0,0) --#define echo_wchar(c) wecho_wchar(stdscr,c) --#define get_wch(c) wget_wch(stdscr,c) --#define get_wstr(t) wget_wstr(stdscr,t) --#define getbkgrnd(wch) wgetbkgrnd(stdscr,wch) --#define getn_wstr(t,n) wgetn_wstr(stdscr,t,n) --#define hline_set(c,n) whline_set(stdscr,c,n) --#define in_wch(c) win_wch(stdscr,c) --#define in_wchnstr(c,n) win_wchnstr(stdscr,c,n) --#define in_wchstr(c) win_wchstr(stdscr,c) --#define innwstr(c,n) winnwstr(stdscr,c,n) --#define ins_nwstr(t,n) wins_nwstr(stdscr,t,n) --#define ins_wch(c) wins_wch(stdscr,c) --#define ins_wstr(t) wins_wstr(stdscr,t) --#define inwstr(c) winwstr(stdscr,c) --#define vline_set(c,n) wvline_set(stdscr,c,n) --#define wadd_wchstr(win,str) wadd_wchnstr(win,str,-1) --#define waddwstr(win,wstr) waddnwstr(win,wstr,-1) --#define wget_wstr(w,t) wgetn_wstr(w,t,-1) --#define win_wchstr(w,c) win_wchnstr(w,c,-1) --#define wins_wstr(w,t) wins_nwstr(w,t,-1) -+#define add_wch(c) wadd_wch(stdscr,(c)) -+#define add_wchnstr(str,n) wadd_wchnstr(stdscr,(str),(n)) -+#define add_wchstr(str) wadd_wchstr(stdscr,(str)) -+#define addnwstr(wstr,n) waddnwstr(stdscr,(wstr),(n)) -+#define addwstr(wstr) waddwstr(stdscr,(wstr)) -+#define bkgrnd(c) wbkgrnd(stdscr,(c)) -+#define bkgrndset(c) wbkgrndset(stdscr,(c)) -+#define border_set(l,r,t,b,tl,tr,bl,br) wborder_set(stdscr,(l),(r),(t),(b),tl,tr,bl,br) -+#define box_set(w,v,h) wborder_set((w),(v),(v),(h),(h),0,0,0,0) -+#define echo_wchar(c) wecho_wchar(stdscr,(c)) -+#define get_wch(c) wget_wch(stdscr,(c)) -+#define get_wstr(t) wget_wstr(stdscr,(t)) -+#define getbkgrnd(wch) wgetbkgrnd(stdscr,(wch)) -+#define getn_wstr(t,n) wgetn_wstr(stdscr,(t),(n)) -+#define hline_set(c,n) whline_set(stdscr,(c),(n)) -+#define in_wch(c) win_wch(stdscr,(c)) -+#define in_wchnstr(c,n) win_wchnstr(stdscr,(c),(n)) -+#define in_wchstr(c) win_wchstr(stdscr,(c)) -+#define innwstr(c,n) winnwstr(stdscr,(c),(n)) -+#define ins_nwstr(t,n) wins_nwstr(stdscr,(t),(n)) -+#define ins_wch(c) wins_wch(stdscr,(c)) -+#define ins_wstr(t) wins_wstr(stdscr,(t)) -+#define inwstr(c) winwstr(stdscr,(c)) -+#define vline_set(c,n) wvline_set(stdscr,(c),(n)) -+#define wadd_wchstr(win,str) wadd_wchnstr((win),(str),-1) -+#define waddwstr(win,wstr) waddnwstr((win),(wstr),-1) -+#define wget_wstr(w,t) wgetn_wstr((w),(t),-1) -+#define win_wchstr(w,c) win_wchnstr((w),(c),-1) -+#define wins_wstr(w,t) wins_nwstr((w),(t),-1) - - #if !NCURSES_OPAQUE --#define wgetbkgrnd(win,wch) (*wch = win->_bkgrnd, OK) -+#define wgetbkgrnd(win,wch) ((win) ? (*(wch) = (win)->_bkgrnd) : *(wch), OK) - #endif - --#define mvadd_wch(y,x,c) mvwadd_wch(stdscr,y,x,c) --#define mvadd_wchnstr(y,x,s,n) mvwadd_wchnstr(stdscr,y,x,s,n) --#define mvadd_wchstr(y,x,s) mvwadd_wchstr(stdscr,y,x,s) --#define mvaddnwstr(y,x,wstr,n) mvwaddnwstr(stdscr,y,x,wstr,n) --#define mvaddwstr(y,x,wstr) mvwaddwstr(stdscr,y,x,wstr) --#define mvget_wch(y,x,c) mvwget_wch(stdscr,y,x,c) --#define mvget_wstr(y,x,t) mvwget_wstr(stdscr,y,x,t) --#define mvgetn_wstr(y,x,t,n) mvwgetn_wstr(stdscr,y,x,t,n) --#define mvhline_set(y,x,c,n) mvwhline_set(stdscr,y,x,c,n) --#define mvin_wch(y,x,c) mvwin_wch(stdscr,y,x,c) --#define mvin_wchnstr(y,x,c,n) mvwin_wchnstr(stdscr,y,x,c,n) --#define mvin_wchstr(y,x,c) mvwin_wchstr(stdscr,y,x,c) --#define mvinnwstr(y,x,c,n) mvwinnwstr(stdscr,y,x,c,n) --#define mvins_nwstr(y,x,t,n) mvwins_nwstr(stdscr,y,x,t,n) --#define mvins_wch(y,x,c) mvwins_wch(stdscr,y,x,c) --#define mvins_wstr(y,x,t) mvwins_wstr(stdscr,y,x,t) --#define mvinwstr(y,x,c) mvwinwstr(stdscr,y,x,c) --#define mvvline_set(y,x,c,n) mvwvline_set(stdscr,y,x,c,n) -- --#define mvwadd_wch(win,y,x,c) (wmove(win,y,x) == ERR ? ERR : wadd_wch(win,c)) --#define mvwadd_wchnstr(win,y,x,s,n) (wmove(win,y,x) == ERR ? ERR : wadd_wchnstr(win,s,n)) --#define mvwadd_wchstr(win,y,x,s) (wmove(win,y,x) == ERR ? ERR : wadd_wchstr(win,s)) --#define mvwaddnwstr(win,y,x,wstr,n) (wmove(win,y,x) == ERR ? ERR : waddnwstr(win,wstr,n)) --#define mvwaddwstr(win,y,x,wstr) (wmove(win,y,x) == ERR ? ERR : waddwstr(win,wstr)) --#define mvwget_wch(win,y,x,c) (wmove(win,y,x) == ERR ? ERR : wget_wch(win,c)) --#define mvwget_wstr(win,y,x,t) (wmove(win,y,x) == ERR ? ERR : wget_wstr(win,t)) --#define mvwgetn_wstr(win,y,x,t,n) (wmove(win,y,x) == ERR ? ERR : wgetn_wstr(win,t,n)) --#define mvwhline_set(win,y,x,c,n) (wmove(win,y,x) == ERR ? ERR : whline_set(win,c,n)) --#define mvwin_wch(win,y,x,c) (wmove(win,y,x) == ERR ? ERR : win_wch(win,c)) --#define mvwin_wchnstr(win,y,x,c,n) (wmove(win,y,x) == ERR ? ERR : win_wchnstr(win,c,n)) --#define mvwin_wchstr(win,y,x,c) (wmove(win,y,x) == ERR ? ERR : win_wchstr(win,c)) --#define mvwinnwstr(win,y,x,c,n) (wmove(win,y,x) == ERR ? ERR : winnwstr(win,c,n)) --#define mvwins_nwstr(win,y,x,t,n) (wmove(win,y,x) == ERR ? ERR : wins_nwstr(win,t,n)) --#define mvwins_wch(win,y,x,c) (wmove(win,y,x) == ERR ? ERR : wins_wch(win,c)) --#define mvwins_wstr(win,y,x,t) (wmove(win,y,x) == ERR ? ERR : wins_wstr(win,t)) --#define mvwinwstr(win,y,x,c) (wmove(win,y,x) == ERR ? ERR : winwstr(win,c)) --#define mvwvline_set(win,y,x,c,n) (wmove(win,y,x) == ERR ? ERR : wvline_set(win,c,n)) -+#define mvadd_wch(y,x,c) mvwadd_wch(stdscr,(y),(x),(c)) -+#define mvadd_wchnstr(y,x,s,n) mvwadd_wchnstr(stdscr,(y),(x),(s),(n)) -+#define mvadd_wchstr(y,x,s) mvwadd_wchstr(stdscr,(y),(x),(s)) -+#define mvaddnwstr(y,x,wstr,n) mvwaddnwstr(stdscr,(y),(x),(wstr),(n)) -+#define mvaddwstr(y,x,wstr) mvwaddwstr(stdscr,(y),(x),(wstr)) -+#define mvget_wch(y,x,c) mvwget_wch(stdscr,(y),(x),(c)) -+#define mvget_wstr(y,x,t) mvwget_wstr(stdscr,(y),(x),(t)) -+#define mvgetn_wstr(y,x,t,n) mvwgetn_wstr(stdscr,(y),(x),(t),(n)) -+#define mvhline_set(y,x,c,n) mvwhline_set(stdscr,(y),(x),(c),(n)) -+#define mvin_wch(y,x,c) mvwin_wch(stdscr,(y),(x),(c)) -+#define mvin_wchnstr(y,x,c,n) mvwin_wchnstr(stdscr,(y),(x),(c),(n)) -+#define mvin_wchstr(y,x,c) mvwin_wchstr(stdscr,(y),(x),(c)) -+#define mvinnwstr(y,x,c,n) mvwinnwstr(stdscr,(y),(x),(c),(n)) -+#define mvins_nwstr(y,x,t,n) mvwins_nwstr(stdscr,(y),(x),(t),(n)) -+#define mvins_wch(y,x,c) mvwins_wch(stdscr,(y),(x),(c)) -+#define mvins_wstr(y,x,t) mvwins_wstr(stdscr,(y),(x),(t)) -+#define mvinwstr(y,x,c) mvwinwstr(stdscr,(y),(x),(c)) -+#define mvvline_set(y,x,c,n) mvwvline_set(stdscr,(y),(x),(c),(n)) -+ -+#define mvwadd_wch(win,y,x,c) (wmove(win,(y),(x)) == ERR ? ERR : wadd_wch((win),(c))) -+#define mvwadd_wchnstr(win,y,x,s,n) (wmove(win,(y),(x)) == ERR ? ERR : wadd_wchnstr((win),(s),(n))) -+#define mvwadd_wchstr(win,y,x,s) (wmove(win,(y),(x)) == ERR ? ERR : wadd_wchstr((win),(s))) -+#define mvwaddnwstr(win,y,x,wstr,n) (wmove(win,(y),(x)) == ERR ? ERR : waddnwstr((win),(wstr),(n))) -+#define mvwaddwstr(win,y,x,wstr) (wmove(win,(y),(x)) == ERR ? ERR : waddwstr((win),(wstr))) -+#define mvwget_wch(win,y,x,c) (wmove(win,(y),(x)) == ERR ? ERR : wget_wch((win),(c))) -+#define mvwget_wstr(win,y,x,t) (wmove(win,(y),(x)) == ERR ? ERR : wget_wstr((win),(t))) -+#define mvwgetn_wstr(win,y,x,t,n) (wmove(win,(y),(x)) == ERR ? ERR : wgetn_wstr((win),(t),(n))) -+#define mvwhline_set(win,y,x,c,n) (wmove(win,(y),(x)) == ERR ? ERR : whline_set((win),(c),(n))) -+#define mvwin_wch(win,y,x,c) (wmove(win,(y),(x)) == ERR ? ERR : win_wch((win),(c))) -+#define mvwin_wchnstr(win,y,x,c,n) (wmove(win,(y),(x)) == ERR ? ERR : win_wchnstr((win),(c),(n))) -+#define mvwin_wchstr(win,y,x,c) (wmove(win,(y),(x)) == ERR ? ERR : win_wchstr((win),(c))) -+#define mvwinnwstr(win,y,x,c,n) (wmove(win,(y),(x)) == ERR ? ERR : winnwstr((win),(c),(n))) -+#define mvwins_nwstr(win,y,x,t,n) (wmove(win,(y),(x)) == ERR ? ERR : wins_nwstr((win),(t),(n))) -+#define mvwins_wch(win,y,x,c) (wmove(win,(y),(x)) == ERR ? ERR : wins_wch((win),(c))) -+#define mvwins_wstr(win,y,x,t) (wmove(win,(y),(x)) == ERR ? ERR : wins_wstr((win),(t))) -+#define mvwinwstr(win,y,x,c) (wmove(win,(y),(x)) == ERR ? ERR : winwstr((win),(c))) -+#define mvwvline_set(win,y,x,c,n) (wmove(win,(y),(x)) == ERR ? ERR : wvline_set((win),(c),(n))) - - #endif /* NCURSES_NOMACROS */ - -diff -Naur ncurses-5.9/include/headers ncurses-5.9.patch/include/headers ---- ncurses-5.9/include/headers 2009-09-05 19:46:30.000000000 +0200 -+++ ncurses-5.9.patch/include/headers 2014-09-01 16:33:22.343792101 +0200 -@@ -1,6 +1,6 @@ --# $Id: headers,v 1.10 2009/09/05 17:46:30 tom Exp $ -+# $Id: headers,v 1.13 2013/10/20 00:32:21 tom Exp $ - ############################################################################## --# Copyright (c) 1998-2007,2009 Free Software Foundation, Inc. # -+# Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. # - # # - # Permission is hereby granted, free of charge, to any person obtaining a # - # copy of this software and associated documentation files (the "Software"), # -@@ -29,14 +29,24 @@ - # - # Author: Thomas E. Dickey 1996-on - # --term.h - curses.h - unctrl.h --termcap.h - ncurses_dll.h -+ -+# Support for termcap (and tic, etc.), which can be a separate library -+@ termlib -+term.h -+termcap.h -+ -+# Headers used only for tic, other programs using internal interfaces - @ ticlib - $(srcdir)/tic.h - $(srcdir)/term_entry.h - $(srcdir)/nc_tparm.h - -+# Porting -+@ port_win32con -+$(srcdir)/ncurses_mingw.h -+$(srcdir)/nc_mingw.h -+ - # vile:makemode -diff -Naur ncurses-5.9/include/Makefile.in ncurses-5.9.patch/include/Makefile.in ---- ncurses-5.9/include/Makefile.in 2010-11-27 22:45:27.000000000 +0100 -+++ ncurses-5.9.patch/include/Makefile.in 2014-09-01 16:33:22.342792099 +0200 -@@ -1,6 +1,6 @@ --# $Id: Makefile.in,v 1.40 2010/11/27 21:45:27 tom Exp $ -+# $Id: Makefile.in,v 1.41 2013/08/03 23:10:51 tom Exp $ - ############################################################################## --# Copyright (c) 1998,2009,2010 Free Software Foundation, Inc. # -+# Copyright (c) 1998-2010,2013 Free Software Foundation, Inc. # - # # - # Permission is hereby granted, free of charge, to any person obtaining a # - # copy of this software and associated documentation files (the "Software"), # -@@ -48,6 +48,9 @@ - prefix = @prefix@ - exec_prefix = @exec_prefix@ - includedir = @includedir@ -+includesubdir = @includesubdir@ -+ -+INCLUDEDIR = $(DESTDIR)$(includedir)$(includesubdir) - - INSTALL = @INSTALL@ - INSTALL_DATA = @INSTALL_DATA@ -diff -Naur ncurses-5.9/include/MKkey_defs.sh ncurses-5.9.patch/include/MKkey_defs.sh ---- ncurses-5.9/include/MKkey_defs.sh 2003-12-06 18:10:09.000000000 +0100 -+++ ncurses-5.9.patch/include/MKkey_defs.sh 2014-09-01 16:33:22.342792099 +0200 -@@ -1,7 +1,7 @@ - #! /bin/sh --# $Id: MKkey_defs.sh,v 1.14 2003/12/06 17:10:09 tom Exp $ -+# $Id: MKkey_defs.sh,v 1.15 2013/03/09 16:32:01 tom Exp $ - ############################################################################## --# Copyright (c) 2001-2002,2003 Free Software Foundation, Inc. # -+# Copyright (c) 2001-2003,2013 Free Software Foundation, Inc. # - # # - # Permission is hereby granted, free of charge, to any person obtaining a # - # copy of this software and associated documentation files (the "Software"), # -@@ -65,9 +65,12 @@ - key_event kv1 str V1 KEY_EVENT + ----- We were interrupted by an event - EOF - -+THIS=./`basename $0` -+PARM=./`basename $DATA` -+ - cat <<EOF - /* -- * These definitions were generated by $0 $DATA -+ * These definitions were generated by $THIS $PARM - */ - EOF - -diff -Naur ncurses-5.9/include/MKterm.h.awk.in ncurses-5.9.patch/include/MKterm.h.awk.in ---- ncurses-5.9/include/MKterm.h.awk.in 2010-01-09 20:53:26.000000000 +0100 -+++ ncurses-5.9.patch/include/MKterm.h.awk.in 2014-09-01 16:33:22.342792099 +0200 -@@ -1,7 +1,7 @@ - # vile:awkmode - BEGIN { - print "/****************************************************************************" -- print " * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. *" -+ print " * Copyright (c) 1998-2011,2013 Free Software Foundation, Inc. *" - print " * *" - print " * Permission is hereby granted, free of charge, to any person obtaining a *" - print " * copy of this software and associated documentation files (the *" -@@ -34,7 +34,7 @@ - print "/* and: Thomas E. Dickey 1995-on */" - print "/****************************************************************************/" - print "" -- print "/* $Id: MKterm.h.awk.in,v 1.58 2010/01/09 19:53:26 tom Exp $ */" -+ print "/* $Id: MKterm.h.awk.in,v 1.62 2013/08/17 19:21:56 tom Exp $ */" - print "" - print "/*" - print "** term.h -- Definition of struct term" -@@ -62,6 +62,12 @@ - print "#undef NCURSES_SBOOL" - print "#define NCURSES_SBOOL @NCURSES_SBOOL@" - print "" -+ print "#undef NCURSES_USE_DATABASE" -+ print "#define NCURSES_USE_DATABASE @NCURSES_USE_DATABASE@" -+ print "" -+ print "#undef NCURSES_USE_TERMCAP" -+ print "#define NCURSES_USE_TERMCAP @NCURSES_USE_TERMCAP@" -+ print "" - print "#undef NCURSES_XNAMES" - print "#define NCURSES_XNAMES @NCURSES_XNAMES@" - print "" -@@ -93,41 +99,6 @@ - print "#include <termio.h>" - print "#define TTY struct termio" - print "" -- print "/* Add definitions to make termio look like termios." -- print " * But ifdef it, since there are some implementations" -- print " * that try to do this for us in a fake <termio.h>." -- print " */" -- print "#ifndef TCSANOW" -- print "#define TCSANOW TCSETA" -- print "#endif" -- print "#ifndef TCSADRAIN" -- print "#define TCSADRAIN TCSETAW" -- print "#endif" -- print "#ifndef TCSAFLUSH" -- print "#define TCSAFLUSH TCSETAF" -- print "#endif" -- print "#ifndef tcsetattr" -- print "#define tcsetattr(fd, cmd, arg) ioctl(fd, cmd, arg)" -- print "#endif" -- print "#ifndef tcgetattr" -- print "#define tcgetattr(fd, arg) ioctl(fd, TCGETA, arg)" -- print "#endif" -- print "#ifndef cfgetospeed" -- print "#define cfgetospeed(t) ((t)->c_cflag & CBAUD)" -- print "#endif" -- print "#ifndef TCIFLUSH " -- print "#define TCIFLUSH 0" -- print "#endif" -- print "#ifndef TCOFLUSH " -- print "#define TCOFLUSH 1" -- print "#endif" -- print "#ifndef TCIOFLUSH " -- print "#define TCIOFLUSH 2" -- print "#endif" -- print "#ifndef tcflush" -- print "#define tcflush(fd, arg) ioctl(fd, TCFLSH, arg)" -- print "#endif" -- print "" - print "#else /* !HAVE_TERMIO_H */" - print "" - print "#if __MINGW32__" -@@ -281,6 +252,7 @@ - print "extern NCURSES_EXPORT(int) _nc_get_tty_mode (TTY *buf);" - print "extern NCURSES_EXPORT(int) _nc_read_entry (const char * const, char * const, TERMTYPE *const);" - print "extern NCURSES_EXPORT(int) _nc_read_file_entry (const char *const, TERMTYPE *);" -+ print "extern NCURSES_EXPORT(void) _nc_init_termtype (TERMTYPE *const);" - print "extern NCURSES_EXPORT(int) _nc_read_termtype (TERMTYPE *, char *, int);" - print "extern NCURSES_EXPORT(char *) _nc_first_name (const char *const);" - print "extern NCURSES_EXPORT(int) _nc_name_match (const char *const, const char *const, const char *const);" -diff -Naur ncurses-5.9/include/nc_alloc.h ncurses-5.9.patch/include/nc_alloc.h ---- ncurses-5.9/include/nc_alloc.h 2010-11-20 23:59:49.000000000 +0100 -+++ ncurses-5.9.patch/include/nc_alloc.h 2014-09-01 16:33:22.343792101 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -29,10 +29,11 @@ - /**************************************************************************** - * Author: Thomas E. Dickey 1996-on * - ****************************************************************************/ --/* $Id: nc_alloc.h,v 1.18 2010/11/20 22:59:49 tom Exp $ */ -+/* $Id: nc_alloc.h,v 1.22 2013/01/26 21:56:51 tom Exp $ */ - - #ifndef NC_ALLOC_included - #define NC_ALLOC_included 1 -+/* *INDENT-OFF* */ - - #ifdef __cplusplus - extern "C" { -@@ -94,6 +95,7 @@ - /* doalloc.c */ - extern NCURSES_EXPORT(void *) _nc_doalloc(void *, size_t); - #if !HAVE_STRDUP -+#undef strdup - #define strdup _nc_strdup - extern NCURSES_EXPORT(char *) _nc_strdup(const char *); - #endif -@@ -101,12 +103,14 @@ - /* entries.c */ - extern NCURSES_EXPORT(void) _nc_leaks_tinfo(void); - --#define typeMalloc(type,elts) (type *)malloc((elts)*sizeof(type)) --#define typeCalloc(type,elts) (type *)calloc((elts),sizeof(type)) --#define typeRealloc(type,elts,ptr) (type *)_nc_doalloc(ptr, (elts)*sizeof(type)) -+#define typeMalloc(type,elts) (type *)malloc((size_t)(elts)*sizeof(type)) -+#define typeCalloc(type,elts) (type *)calloc((size_t)(elts),sizeof(type)) -+#define typeRealloc(type,elts,ptr) (type *)_nc_doalloc(ptr, (size_t)(elts)*sizeof(type)) - - #ifdef __cplusplus - } - #endif - -+/* *INDENT-ON* */ -+ - #endif /* NC_ALLOC_included */ -diff -Naur ncurses-5.9/include/nc_string.h ncurses-5.9.patch/include/nc_string.h ---- ncurses-5.9/include/nc_string.h 1970-01-01 01:00:00.000000000 +0100 -+++ ncurses-5.9.patch/include/nc_string.h 2014-09-01 16:33:22.344792103 +0200 -@@ -0,0 +1,77 @@ -+/**************************************************************************** -+ * Copyright (c) 2012,2013 Free Software Foundation, Inc. * -+ * * -+ * Permission is hereby granted, free of charge, to any person obtaining a * -+ * copy of this software and associated documentation files (the * -+ * "Software"), to deal in the Software without restriction, including * -+ * without limitation the rights to use, copy, modify, merge, publish, * -+ * distribute, distribute with modifications, sublicense, and/or sell * -+ * copies of the Software, and to permit persons to whom the Software is * -+ * furnished to do so, subject to the following conditions: * -+ * * -+ * The above copyright notice and this permission notice shall be included * -+ * in all copies or substantial portions of the Software. * -+ * * -+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * -+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * -+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * -+ * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * -+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * -+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * -+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * -+ * * -+ * Except as contained in this notice, the name(s) of the above copyright * -+ * holders shall not be used in advertising or otherwise to promote the * -+ * sale, use or other dealings in this Software without prior written * -+ * authorization. * -+ ****************************************************************************/ -+ -+/**************************************************************************** -+ * Author: Thomas E. Dickey 2012 * -+ ****************************************************************************/ -+ -+#ifndef STRING_HACKS_H -+#define STRING_HACKS_H 1 -+ -+#include <ncurses_cfg.h> -+ -+/* -+ * $Id: nc_string.h,v 1.4 2013/12/15 01:09:19 tom Exp $ -+ * -+ * String-hacks. Use these macros to stifle warnings on (presumably) correct -+ * uses of strcat, strcpy and sprintf. -+ * -+ * By the way - -+ * A fundamental limitation of the interfaces (and frequent issue in bug -+ * reports using these functions) is that sizes are passed as unsigned values -+ * (with associated sign-extension problems), limiting their effectiveness -+ * when checking for buffer overflow. -+ */ -+ -+#ifdef __cplusplus -+#define NCURSES_VOID /* nothing */ -+#else -+#define NCURSES_VOID (void) -+#endif -+ -+#if USE_STRING_HACKS && HAVE_STRLCAT -+#define _nc_STRCAT(d,s,n) NCURSES_VOID strlcat((d),(s),NCURSES_CAST(size_t,n)) -+#else -+#define _nc_STRCAT(d,s,n) NCURSES_VOID strcat((d),(s)) -+#endif -+ -+#if USE_STRING_HACKS && HAVE_STRLCPY -+#define _nc_STRCPY(d,s,n) NCURSES_VOID strlcpy((d),(s),NCURSES_CAST(size_t,n)) -+#else -+#define _nc_STRCPY(d,s,n) NCURSES_VOID strcpy((d),(s)) -+#endif -+ -+#if USE_STRING_HACKS && HAVE_SNPRINTF -+#define _nc_SPRINTF NCURSES_VOID snprintf -+#define _nc_SLIMIT(n) NCURSES_CAST(size_t,n), -+#else -+#define _nc_SPRINTF NCURSES_VOID sprintf -+#define _nc_SLIMIT(n) /* nothing */ -+#endif -+ -+#endif /* STRING_HACKS_H */ -diff -Naur ncurses-5.9/include/nc_termios.h ncurses-5.9.patch/include/nc_termios.h ---- ncurses-5.9/include/nc_termios.h 1970-01-01 01:00:00.000000000 +0100 -+++ ncurses-5.9.patch/include/nc_termios.h 2014-09-01 16:33:22.344792103 +0200 -@@ -0,0 +1,171 @@ -+/**************************************************************************** -+ * Copyright (c) 2011 Free Software Foundation, Inc. * -+ * * -+ * Permission is hereby granted, free of charge, to any person obtaining a * -+ * copy of this software and associated documentation files (the * -+ * "Software"), to deal in the Software without restriction, including * -+ * without limitation the rights to use, copy, modify, merge, publish, * -+ * distribute, distribute with modifications, sublicense, and/or sell * -+ * copies of the Software, and to permit persons to whom the Software is * -+ * furnished to do so, subject to the following conditions: * -+ * * -+ * The above copyright notice and this permission notice shall be included * -+ * in all copies or substantial portions of the Software. * -+ * * -+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * -+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * -+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * -+ * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * -+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * -+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * -+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * -+ * * -+ * Except as contained in this notice, the name(s) of the above copyright * -+ * holders shall not be used in advertising or otherwise to promote the * -+ * sale, use or other dealings in this Software without prior written * -+ * authorization. * -+ ****************************************************************************/ -+ -+/**************************************************************************** -+ * Author: Thomas E. Dickey 2011 * -+ ****************************************************************************/ -+ -+/* $Id: nc_termios.h,v 1.2 2011/06/25 20:44:05 tom Exp $ */ -+ -+#ifndef NC_TERMIOS_included -+#define NC_TERMIOS_included 1 -+ -+#if HAVE_TERMIOS_H && HAVE_TCGETATTR -+ -+#else /* !HAVE_TERMIOS_H */ -+ -+#if HAVE_TERMIO_H -+ -+/* Add definitions to make termio look like termios. -+ * But ifdef it, since there are some implementations -+ * that try to do this for us in a fake <termio.h>. -+ */ -+#ifndef TCSADRAIN -+#define TCSADRAIN TCSETAW -+#endif -+#ifndef TCSAFLUSH -+#define TCSAFLUSH TCSETAF -+#endif -+#ifndef tcsetattr -+#define tcsetattr(fd, cmd, arg) ioctl(fd, cmd, arg) -+#endif -+#ifndef tcgetattr -+#define tcgetattr(fd, arg) ioctl(fd, TCGETA, arg) -+#endif -+#ifndef cfgetospeed -+#define cfgetospeed(t) ((t)->c_cflag & CBAUD) -+#endif -+#ifndef TCIFLUSH -+#define TCIFLUSH 0 -+#endif -+#ifndef tcflush -+#define tcflush(fd, arg) ioctl(fd, TCFLSH, arg) -+#endif -+ -+#else /* !HAVE_TERMIO_H */ -+ -+#if __MINGW32__ -+ -+/* c_cc chars */ -+#define VINTR 0 -+#define VQUIT 1 -+#define VERASE 2 -+#define VKILL 3 -+#define VEOF 4 -+#define VTIME 5 -+#define VMIN 6 -+ -+/* c_iflag bits */ -+#define ISTRIP 0000040 -+#define INLCR 0000100 -+#define IGNCR 0000200 -+#define ICRNL 0000400 -+#define BRKINT 0000002 -+#define PARMRK 0000010 -+#define IXON 0002000 -+#define IGNBRK 0000001 -+#define IGNPAR 0000004 -+#define INPCK 0000020 -+#define IXOFF 0010000 -+ -+/* c_oflag bits */ -+#define OPOST 0000001 -+ -+/* c_cflag bit meaning */ -+#define CBAUD 0010017 -+#define CSIZE 0000060 -+#define CS8 0000060 -+#define B0 0000000 -+#define B50 0000001 -+#define B75 0000002 -+#define B110 0000003 -+#define B134 0000004 -+#define B150 0000005 -+#define B200 0000006 -+#define B300 0000007 -+#define B600 0000010 -+#define B1200 0000011 -+#define B1800 0000012 -+#define B2400 0000013 -+#define B4800 0000014 -+#define B9600 0000015 -+#define CLOCAL 0004000 -+#define CREAD 0000200 -+#define CSTOPB 0000100 -+#define HUPCL 0002000 -+#define PARENB 0000400 -+#define PARODD 0001000 -+ -+/* c_lflag bits */ -+#define ECHO 0000010 -+#define ECHONL 0000100 -+#define ISIG 0000001 -+#define IEXTEN 0100000 -+#define ICANON 0000002 -+#define NOFLSH 0000200 -+#define ECHOE 0000020 -+#define ECHOK 0000040 -+ -+/* tcflush() */ -+#define TCIFLUSH 0 -+ -+/* tcsetattr uses these */ -+#define TCSADRAIN 1 -+ -+/* ioctls */ -+#define TCGETA 0x5405 -+#define TCFLSH 0x540B -+#define TIOCGWINSZ 0x5413 -+ -+#ifndef cfgetospeed -+#define cfgetospeed(t) ((t)->c_cflag & CBAUD) -+#endif -+ -+#ifndef tcsetattr -+#define tcsetattr(fd, cmd, arg) _nc_mingw_ioctl(fd, cmd, arg) -+#endif -+ -+#ifndef tcgetattr -+#define tcgetattr(fd, arg) _nc_mingw_ioctl(fd, TCGETA, arg) -+#endif -+ -+#ifndef tcflush -+#define tcflush(fd, arg) _nc_mingw_ioctl(fd, TCFLSH, arg) -+#endif -+ -+#undef ttyname -+#define ttyname(fd) NULL -+ -+#else -+ -+#endif /* __MINGW32__ */ -+#endif /* HAVE_TERMIO_H */ -+ -+#endif /* HAVE_TERMIOS_H */ -+ -+#endif /* NC_TERMIOS_included */ -diff -Naur ncurses-5.9/include/nc_tparm.h ncurses-5.9.patch/include/nc_tparm.h ---- ncurses-5.9/include/nc_tparm.h 2010-12-25 21:27:22.000000000 +0100 -+++ ncurses-5.9.patch/include/nc_tparm.h 2014-09-01 16:33:22.344792103 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 2006,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 2006-2010,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -30,7 +30,7 @@ - * Author: Thomas E. Dickey 2006 * - ****************************************************************************/ - --/* $Id: nc_tparm.h,v 1.5 2010/12/25 20:27:22 tom Exp $ */ -+/* $Id: nc_tparm.h,v 1.6 2012/02/18 21:34:42 tom Exp $ */ - - #ifndef NC_TPARM_included - #define NC_TPARM_included 1 -@@ -40,8 +40,12 @@ - * assumption of the varargs code. - */ - #ifndef TPARM_ARG -+#ifdef NCURSES_TPARM_ARG -+#define TPARM_ARG NCURSES_TPARM_ARG -+#else - #define TPARM_ARG long - #endif -+#endif /* TPARAM_ARG */ - - #define TPARM_N(n) (TPARM_ARG)(n) - -diff -Naur ncurses-5.9/include/ncurses_defs ncurses-5.9.patch/include/ncurses_defs ---- ncurses-5.9/include/ncurses_defs 2011-03-22 10:17:59.000000000 +0100 -+++ ncurses-5.9.patch/include/ncurses_defs 2014-09-01 16:33:22.344792103 +0200 -@@ -1,6 +1,6 @@ --# $Id: ncurses_defs,v 1.46 2011/03/22 09:17:59 tom Exp $ -+# $Id: ncurses_defs,v 1.62 2013/12/14 23:52:07 tom Exp $ - ############################################################################## --# Copyright (c) 2000-2010,2011 Free Software Foundation, Inc. # -+# Copyright (c) 2000-2012,2013 Free Software Foundation, Inc. # - # # - # Permission is hereby granted, free of charge, to any person obtaining a # - # copy of this software and associated documentation files (the "Software"), # -@@ -33,7 +33,7 @@ - - BROKEN_LINKER - BSD_TPUTS --CC_HAS_PROTOS -+CGETENT_CONST /* nothing */ - CPP_HAS_PARAM_INIT - CURSES_ACS_ARRAY acs_map - CURSES_WACS_ARRAY _nc_wacs -@@ -41,6 +41,7 @@ - ETIP_NEEDS_MATH_H - GCC_NORETURN /* nothing */ - GCC_UNUSED /* nothing */ -+HAVE_ASSUME_DEFAULT_COLORS - HAVE_BIG_CORE - HAVE_BSD_CGETENT - HAVE_BSD_SIGNAL_H -@@ -69,6 +70,7 @@ - HAVE_GPP_BUILTIN_H - HAVE_GXX_BUILTIN_H - HAVE_HAS_KEY -+HAVE_INTTYPES_H - HAVE_IOSTREAM - HAVE_ISASCII - HAVE_ISSETUGID -@@ -102,6 +104,7 @@ - HAVE_POLL - HAVE_POLL_H - HAVE_PURIFY -+HAVE_PUTENV - HAVE_PUTWC - HAVE_PUTWIN 1 - HAVE_REGEXPR_H_FUNCS -@@ -115,6 +118,7 @@ - HAVE_SELECT - HAVE_SETBUF - HAVE_SETBUFFER -+HAVE_SETENV - HAVE_SETUPTERM 1 - HAVE_SETVBUF - HAVE_SGTTY_H -@@ -123,7 +127,11 @@ - HAVE_SIZECHANGE - HAVE_SLK_COLOR - HAVE_SLK_INIT 1 -+HAVE_SNPRINTF -+HAVE_STDINT_H - HAVE_STRDUP -+HAVE_STRLCAT -+HAVE_STRLCPY - HAVE_STRSTR - HAVE_SYMLINK - HAVE_SYS_BSDTYPES_H -@@ -153,9 +161,12 @@ - HAVE_TYPEINFO - HAVE_TYPE_ATTR_T - HAVE_TYPE_SIGACTION -+HAVE_UNCTRL_H 1 - HAVE_UNISTD_H - HAVE_UNLINK - HAVE_USE_DEFAULT_COLORS -+HAVE_USE_SCREEN -+HAVE_USE_WINDOW - HAVE_VFSCANF - HAVE_VSNPRINTF - HAVE_VSSCANF -@@ -175,11 +186,12 @@ - NCURSES_EXT_COLORS - NCURSES_EXT_FUNCS - NCURSES_NO_PADDING -+NCURSES_OSPEED_COMPAT - NCURSES_PATHSEP ':' -+NCURSES_WIDECHAR - NEED_PTEM_H - NO_LEAKS - PURE_TERMINFO --RETSIGTYPE - STDC_HEADERS - SVR4_ACTION - SVR4_TERMIO -@@ -189,7 +201,6 @@ - TIME_WITH_SYS_TIME - TYPEOF_CHTYPE - USE_COLORFGBG --USE_DATABASE - USE_GETCAP - USE_GETCAP_CACHE - USE_HARD_TABS -@@ -205,9 +216,9 @@ - USE_SAFE_SPRINTF - USE_SCROLL_HINTS - USE_SIGWINCH -+USE_STRING_HACKS - USE_SYMLINKS - USE_SYSMOUSE --USE_TERMCAP - USE_WEAK_SYMBOLS - USE_WIDEC_SUPPORT - USE_XMC_SUPPORT -diff -Naur ncurses-5.9/include/ncurses_mingw.h ncurses-5.9.patch/include/ncurses_mingw.h ---- ncurses-5.9/include/ncurses_mingw.h 2008-12-14 20:22:16.000000000 +0100 -+++ ncurses-5.9.patch/include/ncurses_mingw.h 2014-09-01 16:33:22.344792103 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2008,2011 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -31,10 +31,10 @@ - * * - ****************************************************************************/ - --/* $Id: ncurses_mingw.h,v 1.1 2008/12/14 19:22:16 juergen Exp $ */ -+/* $Id: ncurses_mingw.h,v 1.2 2011/06/25 20:51:00 tom Exp $ */ - - /* -- * This is a placholder up to now and describes what needs to be implemented -+ * This is a placeholder up to now and describes what needs to be implemented - * to support I/O to external terminals with ncurses on the Windows OS. - */ - -@@ -67,98 +67,8 @@ - speed_t c_ospeed; /* c_ospeed */ - }; - --/* c_cc chars */ --#define VINTR 0 --#define VQUIT 1 --#define VERASE 2 --#define VKILL 3 --#define VEOF 4 --#define VTIME 5 --#define VMIN 6 -- --/* c_iflag bits */ --#define ISTRIP 0000040 --#define INLCR 0000100 --#define IGNCR 0000200 --#define ICRNL 0000400 --#define BRKINT 0000002 --#define PARMRK 0000010 --#define IXON 0002000 --#define IGNBRK 0000001 --#define IGNPAR 0000004 --#define INPCK 0000020 --#define IXOFF 0010000 -- --/* c_oflag bits */ --#define OPOST 0000001 -- --/* c_cflag bit meaning */ --#define CBAUD 0010017 --#define CSIZE 0000060 --#define CS8 0000060 --#define B0 0000000 --#define B50 0000001 --#define B75 0000002 --#define B110 0000003 --#define B134 0000004 --#define B150 0000005 --#define B200 0000006 --#define B300 0000007 --#define B600 0000010 --#define B1200 0000011 --#define B1800 0000012 --#define B2400 0000013 --#define B4800 0000014 --#define B9600 0000015 --#define CLOCAL 0004000 --#define CREAD 0000200 --#define CSTOPB 0000100 --#define HUPCL 0002000 --#define PARENB 0000400 --#define PARODD 0001000 -- --/* c_lflag bits */ --#define ECHO 0000010 --#define ECHONL 0000100 --#define ISIG 0000001 --#define IEXTEN 0100000 --#define ICANON 0000002 --#define NOFLSH 0000200 --#define ECHOE 0000020 --#define ECHOK 0000040 -- --/* tcflush() */ --#define TCIFLUSH 0 -- --/* tcsetattr uses these */ --#define TCSADRAIN 1 -- --/* ioctls */ --#define TCGETA 0x5405 --#define TCFLSH 0x540B --#define TIOCGWINSZ 0x5413 -- - extern int _nc_mingw_ioctl(int fd, long int request, struct termios* arg); - extern void _nc_set_term_driver(void* term); - --#ifndef cfgetospeed --#define cfgetospeed(t) ((t)->c_cflag & CBAUD) --#endif -- --#ifndef tcsetattr --#define tcsetattr(fd, cmd, arg) _nc_mingw_ioctl(fd, cmd, arg) --#endif -- --#ifndef tcgetattr --#define tcgetattr(fd, arg) _nc_mingw_ioctl(fd, TCGETA, arg) --#endif -- --#ifndef tcflush --#define tcflush(fd, arg) _nc_mingw_ioctl(fd, TCFLSH, arg) --#endif -- --#undef ttyname --#define ttyname(fd) NULL -- --#endif --#endif -+#endif /* _NC_MINGWH */ -+#endif /* __MINGW32__ */ -diff -Naur ncurses-5.9/include/term_entry.h ncurses-5.9.patch/include/term_entry.h ---- ncurses-5.9/include/term_entry.h 2009-07-11 18:52:29.000000000 +0200 -+++ ncurses-5.9.patch/include/term_entry.h 2014-09-01 16:33:22.344792103 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2008,2009 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -32,7 +32,7 @@ - * and: Thomas E. Dickey 1998-on * - ****************************************************************************/ - --/* $Id: term_entry.h,v 1.37 2009/07/11 16:52:29 tom Exp $ */ -+/* $Id: term_entry.h,v 1.44 2013/05/25 20:13:38 tom Exp $ */ - - /* - * term_entry.h -- interface to entry-manipulation code -@@ -47,28 +47,46 @@ - - #include <term.h> - -+ /* -+ * see db_iterator.c - this enumeration lists the places searched for a -+ * terminal description and defines the order in which they are searched. -+ */ -+ typedef enum { -+ dbdTIC = 0, /* special, used by tic when writing entry */ -+#if NCURSES_USE_DATABASE -+ dbdEnvOnce, /* the $TERMINFO environment variable */ -+ dbdHome, /* $HOME/.terminfo */ -+ dbdEnvList, /* the $TERMINFO_DIRS environment variable */ -+ dbdCfgList, /* the compiled-in TERMINFO_DIRS value */ -+ dbdCfgOnce, /* the compiled-in TERMINFO value */ -+#endif -+#if NCURSES_USE_TERMCAP -+ dbdEnvOnce2, /* the $TERMCAP environment variable */ -+ dbdEnvList2, /* the $TERMPATH environment variable */ -+ dbdCfgList2, /* the compiled-in TERMPATH */ -+#endif -+ dbdLAST -+ } DBDIRS; -+ - #define MAX_USES 32 - #define MAX_CROSSLINKS 16 - --typedef struct entry { -- TERMTYPE tterm; -- unsigned nuses; -- struct -- { -- char *name; -- struct entry *link; -- long line; -- } -- uses[MAX_USES]; -- int ncrosslinks; -- struct entry *crosslinks[MAX_CROSSLINKS]; -- long cstart, cend; -- long startline; -- struct entry *next; -- struct entry *last; --} --ENTRY; -- -+ typedef struct entry { -+ TERMTYPE tterm; -+ unsigned nuses; -+ struct { -+ char *name; -+ struct entry *link; -+ long line; -+ } uses[MAX_USES]; -+ int ncrosslinks; -+ struct entry *crosslinks[MAX_CROSSLINKS]; -+ long cstart, cend; -+ long startline; -+ struct entry *next; -+ struct entry *last; -+ } ENTRY; -+/* *INDENT-OFF* */ - #if NCURSES_XNAMES - #define NUM_BOOLEANS(tp) (tp)->num_Booleans - #define NUM_NUMBERS(tp) (tp)->num_Numbers -@@ -132,7 +150,7 @@ - - /* alloc_ttype.c: elementary allocation code */ - extern NCURSES_EXPORT(void) _nc_align_termtype (TERMTYPE *, TERMTYPE *); --extern NCURSES_EXPORT(void) _nc_copy_termtype (TERMTYPE *, TERMTYPE *); -+extern NCURSES_EXPORT(void) _nc_copy_termtype (TERMTYPE *, const TERMTYPE *); - - /* free_ttype.c: elementary allocation code */ - extern NCURSES_EXPORT(void) _nc_free_termtype (TERMTYPE *); -@@ -166,9 +184,9 @@ - - /* trace_xnames.c */ - extern NCURSES_EXPORT(void) _nc_trace_xnames (TERMTYPE *); -+/* *INDENT-ON* */ - - #ifdef __cplusplus - } - #endif -- --#endif /* NCURSES_TERM_ENTRY_H_incl */ -+#endif /* NCURSES_TERM_ENTRY_H_incl */ -diff -Naur ncurses-5.9/include/tic.h ncurses-5.9.patch/include/tic.h ---- ncurses-5.9/include/tic.h 2009-08-08 19:52:46.000000000 +0200 -+++ ncurses-5.9.patch/include/tic.h 2014-09-01 16:33:22.344792103 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2007,2009 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -33,14 +33,14 @@ - ****************************************************************************/ - - /* -- * $Id: tic.h,v 1.65 2009/08/08 17:52:46 tom Exp $ -+ * $Id: tic.h,v 1.69 2012/03/17 18:22:10 tom Exp $ - * tic.h - Global variables and structures for the terminfo - * compiler. - */ - - #ifndef __TIC_H - #define __TIC_H -- -+/* *INDENT-OFF* */ - #ifdef __cplusplus - extern "C" { - #endif -@@ -224,6 +224,12 @@ - - #define NOTFOUND ((struct name_table_entry *) 0) - -+/* -+ * The casts are required for correct sign-propagation with systems such as -+ * AIX, IRIX64, Solaris which default to unsigned characters. The C standard -+ * leaves this detail unspecified. -+ */ -+ - /* out-of-band values for representing absent capabilities */ - #define ABSENT_BOOLEAN ((signed char)-1) /* 255 */ - #define ABSENT_NUMERIC (-1) -@@ -248,6 +254,8 @@ - #define TERMINFO "/usr/share/terminfo" - #endif - -+#ifdef NCURSES_TERM_ENTRY_H_incl -+ - /* access.c */ - extern NCURSES_EXPORT(unsigned) _nc_pathlast (const char *); - extern NCURSES_EXPORT(bool) _nc_is_abs_path (const char *); -@@ -270,6 +278,7 @@ - extern NCURSES_EXPORT_VAR(int) _nc_curr_col; - extern NCURSES_EXPORT_VAR(int) _nc_curr_line; - extern NCURSES_EXPORT_VAR(int) _nc_syntax; -+extern NCURSES_EXPORT_VAR(int) _nc_strict_bsd; - extern NCURSES_EXPORT_VAR(long) _nc_comment_end; - extern NCURSES_EXPORT_VAR(long) _nc_comment_start; - extern NCURSES_EXPORT_VAR(long) _nc_curr_file_pos; -@@ -314,23 +323,6 @@ - extern const char * _nc_progname; - - /* db_iterator.c */ --typedef enum { -- dbdTIC = 0, --#if USE_DATABASE -- dbdEnvOnce, -- dbdHome, -- dbdEnvList, -- dbdCfgList, -- dbdCfgOnce, --#endif --#if USE_TERMCAP -- dbdEnvOnce2, -- dbdEnvList2, -- dbdCfgList2, --#endif -- dbdLAST --} DBDIRS; -- - extern NCURSES_EXPORT(const char *) _nc_next_db(DBDIRS *, int *); - extern NCURSES_EXPORT(const char *) _nc_tic_dir (const char *); - extern NCURSES_EXPORT(void) _nc_first_db(DBDIRS *, int *); -@@ -339,8 +331,11 @@ - /* write_entry.c */ - extern NCURSES_EXPORT(int) _nc_tic_written (void); - -+#endif /* NCURSES_TERM_ENTRY_H_incl */ -+ - #ifdef __cplusplus - } - #endif - -+/* *INDENT-ON* */ - #endif /* __TIC_H */ -diff -Naur ncurses-5.9/INSTALL ncurses-5.9.patch/INSTALL ---- ncurses-5.9/INSTALL 2011-03-31 10:27:24.000000000 +0200 -+++ ncurses-5.9.patch/INSTALL 2014-09-01 16:33:22.227791908 +0200 -@@ -1,5 +1,5 @@ - ------------------------------------------------------------------------------- ---- Copyright (c) 1998-2010,2011 Free Software Foundation, Inc. -- -+-- Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. -- - -- -- - -- Permission is hereby granted, free of charge, to any person obtaining a -- - -- copy of this software and associated documentation files (the -- -@@ -25,7 +25,7 @@ - -- sale, use or other dealings in this Software without prior written -- - -- authorization. -- - ------------------------------------------------------------------------------- ---- $Id: INSTALL,v 1.155 2011/03/31 08:27:24 tom Exp $ -+-- $Id: INSTALL,v 1.168 2013/08/03 23:15:23 tom Exp $ - --------------------------------------------------------------------- - How to install Ncurses/Terminfo on your system - --------------------------------------------------------------------- -@@ -315,6 +315,10 @@ - programs are useful in this configuration, e.g., reset and tput versus - infocmp and tic. - -+ --disable-db-install -+ Do not install the terminal database. This is used to omit features -+ for packages, as done with --without-progs. -+ - --disable-ext-funcs - Disable function-extensions. Configure ncurses without the functions - that are not specified by XSI. See ncurses/modules for the exact -@@ -407,13 +411,14 @@ - - --disable-tic-depends - When building shared libraries, normally the tic library is linked to -- depend upon the ncurses library (and in turn, on the term-library if -- the --with-termlib option was given). The tic- and term-libraries -- ABI does not depend on the --enable-widec option. Some packagers have -- used this to reduce the number of library files which are packaged -- by using only one copy of those libraries. To make this work properly, -+ depend upon the ncurses library (or equivalently, on the tinfo-library -+ if the --with-termlib option was given). The tic- and tinfo-library -+ ABIs do not depend on the --enable-widec option. Some packagers have -+ used this to reduce the number of library files which are packaged by -+ using only one copy of those libraries. To make this work properly, - the tic library must be built without an explicit dependency on the -- ncurses (or ncursesw) library. Use this configure option to do that. -+ underlying library (ncurses vs ncursesw, tinfo vs tinfow). Use this -+ configure option to do that. - For example - configure --with-ticlib --with-shared --disable-tic-depends - -@@ -555,6 +560,9 @@ - library by reducing global and static variables. This option is also - set if --with-pthread is used. - -+ Enabling this option adds a "t" to the library names, except for the -+ special case when --enable-weak-symbols is also used. -+ - --enable-rpath - Use rpath option when generating shared libraries, and (with some - restrictions) when linking the corresponding programs. This originally -@@ -595,6 +603,14 @@ - reducing the need for juggling the global SP value with set_term() and - delscreen(). - -+ --enable-string-hacks -+ Controls whether strlcat and strlcpy may be used. The same issue -+ applies to OpenBSD's warnings about snprintf, noting that this function -+ is weakly standardized. -+ -+ Aside from stifling these warnings, there is no functional improvement -+ in ncurses. -+ - --enable-symlinks - If your system supports symbolic links, make tic use symbolic links - rather than hard links to save diskspace when writing aliases in the -@@ -616,6 +632,12 @@ - match is found in the terminfo database. See also the --enable-getcap - and --enable-getcap-cache options. - -+ Termcap support requires run-time parsing rather than loading -+ predigested data. If you have specified --with-ticlib, then you -+ cannot have termcap support since run-time parsing is done in the -+ tic library, which is intentionally not part of normal linkage -+ dependencies. -+ - --enable-warnings - Turn on GCC compiler warnings. There should be only a few. - -@@ -740,6 +762,12 @@ - executables, e.g., by setting "--with-chtype=long" (the configure - script supplies "unsigned"). - -+ --with-cxx-shared -+ When --with-shared is set, build libncurses++ as a shared library. -+ This implicitly relies upon building with gcc/g++, since other -+ compiler suites may have differences in the way shared libraries are -+ built. libtool by the way has similar limitations. -+ - --with-database=XXX - Specify the terminfo source file to install. Usually you will wish - to install ncurses' default (misc/terminfo.src). Certain systems -@@ -824,7 +852,17 @@ - NOTE: a few systems build shared libraries with fixed pathnames; this - option probably will not work for those configurations. - -- --with-libtool[=XXX] -+ --with-lib-prefix=XXX -+ OS/2 EMX used a different naming convention from most Unix-like -+ platforms. It required that the "lib" part of a library name was -+ omitted. Newer EMX as part of eComStation does not follow that -+ convention. Use this option to override the configure script's -+ assumptions about the library-prefix. If this option is omitted, it -+ uses the original OS/2 EMX convention for that platform. Use -+ "--with-lib-prefix=lib" for the newer EMX in eComStation. Use -+ "--without-lib-prefix" to suppress it for other odd platforms. -+ -+ --with-libtool[=XXX] - Generate libraries with libtool. If this option is selected, then it - overrides all other library model specifications. Note that libtool - must already be installed, uses makefile rules dependent on GNU make, -@@ -904,6 +942,10 @@ - --with-pkg-config=[DIR] - Check for pkg-config, optionally specifying its path. - -+ --with-pkg-config-libdir=[DIR] -+ If pkg-config was found, override the automatic check for its library -+ path. -+ - --with-profile - Generate profile-libraries These are named by adding "_p" to the root, - e.g., libncurses_p.a -@@ -996,10 +1038,27 @@ - library dependencies for tic and other programs built with the tic - library. - -+ --with-tparm-arg[=XXX] -+ Override the type used for tparm() arguments, which normally is a -+ "long". However the function must assume that its arguments can hold a -+ pointer to char's which is not always workable for 64-bit platforms. A -+ better choice would be intptr_t, which was not available at the time -+ tparm's interface was defined. -+ -+ If the option is not given, this defaults to "long". -+ - --with-trace - Configure the trace() function as part of the all models of the ncurses - library. Normally it is part of the debug (libncurses_g) library only. - -+ --with-xterm-kbs=XXX -+ Configure xterm's terminfo entries to use either BS (^H, i.e., ASCII -+ backspace) or DEL (^?, or 127). XXX can be BS (or bs, 8) or DEL -+ (or del, 127). -+ -+ During installation, the makefile and scripts modifies the "xterm+kbs" -+ terminfo entry to use this setting. -+ - --with-valgrind - For testing, compile with debug option. - This also sets the --disable-leaks option. -@@ -1024,6 +1083,8 @@ - install as "ncurses.h" and modify the installed headers and manpages - accordingly. - -+ Likewise, do not install an alias "curses" for the ncurses manpage. -+ - --without-cxx - XSI curses declares "bool" as part of the interface. C++ also declares - "bool". Neither specifies the size and type of booleans, but both -@@ -1726,20 +1787,37 @@ - By default, there are no entries on the fallback list. After you have - built the ncurses suite for the first time, you can change the list - (the process needs infocmp(1)). To do so, use the script -- ncurses/tinfo/MKfallback.sh. A configure script option -+ ncurses/tinfo/MKfallback.sh. The configure script option - --with-fallbacks does this (it accepts a comma-separated list of the - names you wish, and does not require a rebuild). - - If you wanted (say) to have linux, vt100, and xterm fallbacks, you -- would use the commands -+ might use the commands - - cd ncurses; -- tinfo/MKfallback.sh linux vt100 xterm >fallback.c -+ tinfo/MKfallback.sh \ -+ $TERMINFO \ -+ ../misc/terminfo.src \ -+ `which tic` \ -+ linux vt100 xterm >fallback.c -+ -+ The first three parameters of the script are normally supplied by -+ the configured makefiles via the "--with-fallbacks" option. They -+ are -+ -+ 1) the location of the terminfo database -+ 2) the source for the terminfo entries -+ 3) the location of the tic program, used to create a terminfo -+ database. - - Then just rebuild and reinstall the library as you would normally. - You can restore the default empty fallback list with - -- tinfo/MKfallback.sh >fallback.c -+ tinfo/MKfallback.sh \ -+ $TERMINFO \ -+ ../misc/terminfo.src \ -+ `which tic` \ -+ >fallback.c - - The overhead for an empty fallback list is one trivial stub function. - Any non-empty fallback list is const-ed and therefore lives in sharable -diff -Naur ncurses-5.9/Makefile.in ncurses-5.9.patch/Makefile.in ---- ncurses-5.9/Makefile.in 2010-11-27 22:45:27.000000000 +0100 -+++ ncurses-5.9.patch/Makefile.in 2014-09-01 16:33:22.228791910 +0200 -@@ -1,6 +1,6 @@ --# $Id: Makefile.in,v 1.30 2010/11/27 21:45:27 tom Exp $ -+# $Id: Makefile.in,v 1.38 2014/01/18 20:19:45 tom Exp $ - ############################################################################## --# Copyright (c) 1998-2008,2010 Free Software Foundation, Inc. # -+# Copyright (c) 1998-2013,2014 Free Software Foundation, Inc. # - # # - # Permission is hereby granted, free of charge, to any person obtaining a # - # copy of this software and associated documentation files (the "Software"), # -@@ -27,7 +27,7 @@ - # authorization. # - ############################################################################## - # --# Author: Thomas E. Dickey <dickey@clark.net> 1996,1997 -+# Author: Thomas E. Dickey 1996-on - # - # Master Makefile for ncurses library. - -@@ -35,7 +35,8 @@ - VPATH = @srcdir@ - - DESTDIR=@DESTDIR@ --CF_MFLAGS = @cf_cv_makeflags@ DESTDIR="$(DESTDIR)" -+RPATH_LIST=@RPATH_LIST@ -+TOP_MFLAGS = @cf_cv_makeflags@ DESTDIR="$(DESTDIR)" RPATH_LIST="$(RPATH_LIST)" - - @SET_MAKE@ - -@@ -48,13 +49,17 @@ - - prefix = @prefix@ - exec_prefix = @exec_prefix@ -+datarootdir = @datarootdir@ - - bindir = @bindir@ - ticdir = @TERMINFO@ - includedir = @includedir@ -+includesubdir = @includesubdir@ - libdir = @libdir@ - mandir = @mandir@ - -+include_dir = ${includedir}${includesubdir} -+ - INSTALL = @INSTALL@ - INSTALL_DATA = @INSTALL_DATA@ - -@@ -74,25 +79,22 @@ - @ echo '' - @ echo ' bin directory: '$(bindir) - @ echo ' lib directory: '$(libdir) -- @ echo ' include directory: '$(includedir) -+ @ echo ' include directory: '$(include_dir) - @ echo ' man directory: '$(mandir) - @MAKE_TERMINFO@ @ echo ' terminfo directory: '$(ticdir) - @ echo '' -- @ test "$(includedir)" = "$(prefix)/include" || \ -+ @ test "$(include_dir)" = "$(prefix)/include" || \ - echo '** Include-directory is not in a standard location' -- @ test ! -f $(includedir)/termcap.h || \ -- fgrep NCURSES_VERSION $(includedir)/termcap.h >/dev/null || \ -+ @ test ! -f $(include_dir)/termcap.h || \ -+ fgrep NCURSES_VERSION $(include_dir)/termcap.h >/dev/null || \ - echo '** Will overwrite non-ncurses termcap.h' -- @ test ! -f $(includedir)/curses.h || \ -- fgrep NCURSES_VERSION $(includedir)/curses.h >/dev/null || \ -+ @ test ! -f $(include_dir)/curses.h || \ -+ fgrep NCURSES_VERSION $(include_dir)/curses.h >/dev/null || \ - echo '** Will overwrite non-ncurses curses.h' - --dlls: libs -- $(SHELL) $(srcdir)/mk-dlls.sh -- - distclean \ - realclean :: -- -rm -f mk-dlls.sh mingw_arch -+ - - # Put the common rules here so that we can easily construct the list of - # directories to visit. -diff -Naur ncurses-5.9/man/clear.1 ncurses-5.9.patch/man/clear.1 ---- ncurses-5.9/man/clear.1 2010-12-04 19:36:44.000000000 +0100 -+++ ncurses-5.9.patch/man/clear.1 2014-09-01 16:33:22.345792104 +0200 -@@ -1,5 +1,5 @@ - .\"*************************************************************************** --.\" Copyright (c) 1998-2006,2010 Free Software Foundation, Inc. * -+.\" Copyright (c) 1998-2010,2013 Free Software Foundation, Inc. * - .\" * - .\" Permission is hereby granted, free of charge, to any person obtaining a * - .\" copy of this software and associated documentation files (the * -@@ -26,7 +26,7 @@ - .\" authorization. * - .\"*************************************************************************** - .\" --.\" $Id: clear.1,v 1.8 2010/12/04 18:36:44 tom Exp $ -+.\" $Id: clear.1,v 1.10 2013/06/22 22:22:11 tom Exp $ - .TH @CLEAR@ 1 "" - .ds n 5 - .SH NAME -@@ -35,9 +35,10 @@ - \fB@CLEAR@\fR - .br - .SH DESCRIPTION --\fB@CLEAR@\fR clears your screen if this is possible. It looks in the --environment for the terminal type and then in the \fBterminfo\fR database to --figure out how to clear the screen. -+\fB@CLEAR@\fR clears your screen if this is possible, -+including its scrollback buffer (if the extended "E3" capability is defined). -+\fB@CLEAR@\fR looks in the environment for the terminal type and then in the -+\fBterminfo\fR database to determine how to clear the screen. - .PP - \fB@CLEAR@\fR ignores any command-line parameters that may be present. - .SH SEE ALSO -diff -Naur ncurses-5.9/man/curs_addchstr.3x ncurses-5.9.patch/man/curs_addchstr.3x ---- ncurses-5.9/man/curs_addchstr.3x 2010-12-04 19:36:44.000000000 +0100 -+++ ncurses-5.9.patch/man/curs_addchstr.3x 2014-09-01 16:33:22.345792104 +0200 -@@ -1,5 +1,5 @@ - .\"*************************************************************************** --.\" Copyright (c) 1998-2006,2010 Free Software Foundation, Inc. * -+.\" Copyright (c) 1998-2010,2012 Free Software Foundation, Inc. * - .\" * - .\" Permission is hereby granted, free of charge, to any person obtaining a * - .\" copy of this software and associated documentation files (the * -@@ -26,8 +26,11 @@ - .\" authorization. * - .\"*************************************************************************** - .\" --.\" $Id: curs_addchstr.3x,v 1.15 2010/12/04 18:36:44 tom Exp $ -+.\" $Id: curs_addchstr.3x,v 1.16 2012/11/03 22:54:43 tom Exp $ - .TH curs_addchstr 3X "" -+.de bP -+.IP \(bu 4 -+.. - .na - .hy 0 - .SH NAME -@@ -42,6 +45,7 @@ - .ad - .hy - .SH SYNOPSIS -+.nf - \fB#include <curses.h>\fR - .PP - \fBint addchstr(const chtype *chstr);\fR -@@ -59,24 +63,33 @@ - \fBint mvwaddchstr(WINDOW *win, int y, int x, const chtype *chstr);\fR - .br - \fBint mvwaddchnstr(WINDOW *win, int y, int x, const chtype *chstr, int n);\fR -+.fi - .SH DESCRIPTION --These routines copy \fIchstr\fR into the window image structure at and after --the current cursor position. The four routines with \fIn\fR as the last --argument copy at most \fIn\fR elements, but no more than will fit on the line. --If \fBn\fR=\fB\-1\fR then the whole string is copied, to the maximum number of --characters that will fit on the line. -+These functions copy the (null-terminated) -+\fIchstr\fR array -+into the window image structure -+starting at the current cursor position. -+The four functions with \fIn\fR as the last -+argument copy at most \fIn\fR elements, -+but no more than will fit on the line. -+If \fBn\fR=\fB\-1\fR then the whole array is copied, -+to the maximum number of characters that will fit on the line. - .PP --The window cursor is \fInot\fR advanced, and these routines work faster than --\fBwaddnstr\fR. On the other hand, they do not perform any kind of checking --(such as for the newline, backspace, or carriage return characters), they do not --advance the current cursor position, they do not expand other control characters --to ^-escapes, and they truncate the string if it crosses the right margin, -+The window cursor is \fInot\fR advanced. -+These functions work faster than \fBwaddnstr\fR. -+On the other hand: -+.bP -+they do not perform checking -+(such as for the newline, backspace, or carriage return characters), -+.bP -+they do not advance the current cursor position, -+.bP -+they do not expand other control characters to ^-escapes, and -+.bP -+they truncate the string if it crosses the right margin, - rather than wrapping it around to the new line. --.SH RETURN VALUES --All routines return the integer \fBERR\fR upon failure and \fBOK\fR on success --(the SVr4 manuals specify only "an integer value other than \fBERR\fR") upon --successful completion, unless otherwise noted in the preceding routine --descriptions. -+.SH RETURN VALUE -+All functions return the integer \fBERR\fR upon failure and \fBOK\fR on success. - .PP - X/Open does not define any error conditions. - This implementation returns an error -@@ -86,10 +99,11 @@ - \fBwmove\fP, and return an error if the position is outside the window, - or if the window pointer is null. - .SH NOTES --Note that all routines except \fBwaddchnstr\fR may be macros. -+All functions except \fBwaddchnstr\fR may be macros. - .SH PORTABILITY - These entry points are described in the XSI Curses standard, Issue 4. - .SH SEE ALSO -+\fBcurs_addstr\fR(3X), - \fBcurses\fR(3X). - .PP - Comparable functions in the wide-character (ncursesw) library are -diff -Naur ncurses-5.9/man/curs_addstr.3x ncurses-5.9.patch/man/curs_addstr.3x ---- ncurses-5.9/man/curs_addstr.3x 2010-12-04 19:36:44.000000000 +0100 -+++ ncurses-5.9.patch/man/curs_addstr.3x 2014-09-01 16:33:22.345792104 +0200 -@@ -1,5 +1,5 @@ - .\"*************************************************************************** --.\" Copyright (c) 1998-2005,2010 Free Software Foundation, Inc. * -+.\" Copyright (c) 1998-2010,2012 Free Software Foundation, Inc. * - .\" * - .\" Permission is hereby granted, free of charge, to any person obtaining a * - .\" copy of this software and associated documentation files (the * -@@ -26,8 +26,11 @@ - .\" authorization. * - .\"*************************************************************************** - .\" --.\" $Id: curs_addstr.3x,v 1.16 2010/12/04 18:36:44 tom Exp $ -+.\" $Id: curs_addstr.3x,v 1.17 2012/11/03 22:57:31 tom Exp $ - .TH curs_addstr 3X "" -+.de bP -+.IP \(bu 4 -+.. - .na - .hy 0 - .SH NAME -@@ -62,34 +65,37 @@ - \fBint mvwaddnstr(WINDOW *\fR\fIwin\fR\fB, int \fR\fIy\fR\fB, int \fR\fIx\fR\fB, const char *\fR\fIstr, int \fR\fIn\fR\fB);\fR - .fi - .SH DESCRIPTION --These routines write the characters of the (null-terminated) character string -+These functions write the (null-terminated) character string - \fIstr\fR on the given window. - It is similar to calling \fBwaddch\fR once for each character in the string. --The four routines with \fIn\fR as the last argument --write at most \fIn\fR characters. --If \fIn\fR is \-1, then the entire string will be added, --up to the maximum number of characters that will fit on the line, -+.PP -+The \fImv\fR functions perform cursor movement once, before writing any -+characters. -+Thereafter, the cursor is advanced as a side-effect of writing to the window. -+.PP -+The four functions with \fIn\fR as the last argument -+write at most \fIn\fR characters, - or until a terminating null is reached. -+If \fIn\fR is \-1, then the entire string will be added. - .SH RETURN VALUE --All routines return the integer \fBERR\fR upon failure and \fBOK\fR on success --(the SVr4 manuals specify only "an integer value other than \fBERR\fR") upon --successful completion. -+All functions return the integer \fBERR\fR upon failure and \fBOK\fR on success. - .PP - X/Open does not define any error conditions. - This implementation returns an error -+.bP - if the window pointer is null or -+.bP - if the string pointer is null or -+.bP - if the corresponding calls to \fBwaddch\fP return an error. - .PP - Functions with a "mv" prefix first perform a cursor movement using - \fBwmove\fP, and return an error if the position is outside the window, - or if the window pointer is null. - .SH NOTES --Note that all of these routines except \fBwaddstr\fR and \fBwaddnstr\fR may be --macros. -+All of these functions except \fBwaddnstr\fR may be macros. - .SH PORTABILITY --All these entry points are described in the XSI Curses standard, Issue 4. The --XSI errors EILSEQ and EOVERFLOW, associated with extended-level conformance, --are not yet detected. -+These functions are described in the XSI Curses standard, Issue 4. - .SH SEE ALSO --\fBcurses\fR(3X), \fBcurs_addch\fR(3X). -+\fBcurses\fR(3X), -+\fBcurs_addch\fR(3X). -diff -Naur ncurses-5.9/man/curs_add_wch.3x ncurses-5.9.patch/man/curs_add_wch.3x ---- ncurses-5.9/man/curs_add_wch.3x 2011-01-15 16:27:43.000000000 +0100 -+++ ncurses-5.9.patch/man/curs_add_wch.3x 2014-09-01 16:33:22.345792104 +0200 -@@ -1,5 +1,5 @@ - .\"*************************************************************************** --.\" Copyright (c) 2001-2010,2011 Free Software Foundation, Inc. * -+.\" Copyright (c) 2001-2011,2012 Free Software Foundation, Inc. * - .\" * - .\" Permission is hereby granted, free of charge, to any person obtaining a * - .\" copy of this software and associated documentation files (the * -@@ -26,7 +26,7 @@ - .\" authorization. * - .\"*************************************************************************** - .\" --.\" $Id: curs_add_wch.3x,v 1.14 2011/01/15 15:27:43 tom Exp $ -+.\" $Id: curs_add_wch.3x,v 1.15 2012/11/03 23:03:59 tom Exp $ - .TH curs_add_wch 3X "" - .de bP - .IP \(bu 4 -@@ -176,7 +176,7 @@ - WACS_D_VLINE 0x2551 | double vertical line - WACS_D_PLUS 0x256c + double large plus or crossover - .TE --.SH RETURN VALUES -+.SH RETURN VALUE - .PP - All routines return the integer \fBERR\fR upon failure and \fBOK\fR on success. - .PP -diff -Naur ncurses-5.9/man/curs_add_wchstr.3x ncurses-5.9.patch/man/curs_add_wchstr.3x ---- ncurses-5.9/man/curs_add_wchstr.3x 2010-12-04 19:36:44.000000000 +0100 -+++ ncurses-5.9.patch/man/curs_add_wchstr.3x 2014-09-01 16:33:22.345792104 +0200 -@@ -1,5 +1,5 @@ - .\"*************************************************************************** --.\" Copyright (c) 2002-2005,2010 Free Software Foundation, Inc. * -+.\" Copyright (c) 2002-2010,2012 Free Software Foundation, Inc. * - .\" * - .\" Permission is hereby granted, free of charge, to any person obtaining a * - .\" copy of this software and associated documentation files (the * -@@ -26,8 +26,13 @@ - .\" authorization. * - .\"*************************************************************************** - .\" --.\" $Id: curs_add_wchstr.3x,v 1.9 2010/12/04 18:36:44 tom Exp $ -+.\" $Id: curs_add_wchstr.3x,v 1.10 2012/11/03 22:54:43 tom Exp $ - .TH curs_add_wchstr 3X "" -+.de bP -+.IP \(bu 4 -+.. -+.na -+.hy 0 - .SH NAME - \fBadd_wchstr\fR, - \fBadd_wchnstr\fR, -@@ -37,10 +42,12 @@ - \fBmvadd_wchnstr\fR, - \fBmvwadd_wchstr\fR, - \fBmvwadd_wchnstr\fR \- add an array of complex characters (and attributes) to a curses window -+.ad -+.hy - .SH SYNOPSIS --.B #include <curses.h> --.PP - .nf -+\fB#include <curses.h>\fR -+.PP - \fBint add_wchstr(const cchar_t *\fR\fIwchstr\fR\fB);\fR - .br - \fBint add_wchnstr(const cchar_t *\fR\fIwchstr\fR\fB, int \fR\fIn\fR\fB);\fR -@@ -58,38 +65,53 @@ - \fBint mvwadd_wchnstr(WINDOW *\fR\fIwin\fR\fB, int \fR\fIy\fR\fB, int \fR\fIx\fR\fB, const cchar_t *\fR\fIwchstr\fR\fB, int \fR\fIn\fR\fB);\fR - .fi - .SH DESCRIPTION --These routines copy the array of complex characters \fIwchstr\fR --into the window image structure at and after the current cursor position. --The four routines with \fIn\fR as the last --argument copy at most \fIn\fR elements, but no more than will fit on the line. -+These functions copy the (null-terminated) -+array of complex characters \fIwchstr\fR -+into the window image structure -+starting at the current cursor position. -+The four functions with \fIn\fR as the last -+argument copy at most \fIn\fR elements, -+but no more than will fit on the line. - If \fBn\fR=\fB\-1\fR then the whole array is copied, - to the maximum number of characters that will fit on the line. - .PP - The window cursor is \fInot\fR advanced. --These routines work faster than \fBwaddnstr\fR. --On the other hand, they do not perform checking -+These functions work faster than \fBwaddnstr\fR. -+On the other hand: -+.bP -+they do not perform checking - (such as for the newline, backspace, or carriage return characters), -+.bP - they do not advance the current cursor position, --they do not expand other control characters to ^-escapes, --and they truncate the string if it crosses the right margin, -+.bP -+they do not expand other control characters to ^-escapes, and -+.bP -+they truncate the string if it crosses the right margin, - rather than wrapping it around to the new line. - .PP --These routines end successfully -+These functions end successfully - on encountering a null \fIcchar_t\fR, or - when they have filled the current line. - If a complex character cannot completely fit at the end of the current line, - the remaining columns are filled with the background character and rendition. --.SH NOTES --All functions except \fBwadd_wchnstr\fR may be macros. --.SH RETURN VALUES --All routines return the integer \fBERR\fR upon failure and \fBOK\fR on success. -+.SH RETURN VALUE -+All functions return the integer \fBERR\fR upon failure and \fBOK\fR on success. -+.PP -+X/Open does not define any error conditions. -+This implementation returns an error -+if the window pointer is null. - .PP - Functions with a "mv" prefix first perform a cursor movement using - \fBwmove\fP, and return an error if the position is outside the window, - or if the window pointer is null. -+.SH NOTES -+All functions except \fBwadd_wchnstr\fR may be macros. - .SH PORTABILITY --All these entry points are described in the XSI Curses standard, Issue 4. -+These entry points are described in the XSI Curses standard, Issue 4. - .SH SEE ALSO --\fBcurses\fR(3X), --\fBcurs_addchstr\fR(3X), --\fBcurs_addwstr\fR(3X) -+\fBcurs_addwstr\fR(3X), -+\fBcurses\fR(3X). -+.PP -+Comparable functions in the narrow-character (ncurses) library are -+described in -+\fBcurs_addchstr\fR(3X). -diff -Naur ncurses-5.9/man/curs_addwstr.3x ncurses-5.9.patch/man/curs_addwstr.3x ---- ncurses-5.9/man/curs_addwstr.3x 2010-12-04 19:36:44.000000000 +0100 -+++ ncurses-5.9.patch/man/curs_addwstr.3x 2014-09-01 16:33:22.345792104 +0200 -@@ -1,5 +1,5 @@ - .\"*************************************************************************** --.\" Copyright (c) 2002-2006,2010 Free Software Foundation, Inc. * -+.\" Copyright (c) 2002-2010,2012 Free Software Foundation, Inc. * - .\" * - .\" Permission is hereby granted, free of charge, to any person obtaining a * - .\" copy of this software and associated documentation files (the * -@@ -26,8 +26,11 @@ - .\" authorization. * - .\"*************************************************************************** - .\" --.\" $Id: curs_addwstr.3x,v 1.10 2010/12/04 18:36:44 tom Exp $ -+.\" $Id: curs_addwstr.3x,v 1.11 2012/11/03 22:57:31 tom Exp $ - .TH curs_addwstr 3X "" -+.de bP -+.IP \(bu 4 -+.. - .na - .hy 0 - .SH NAME -@@ -62,31 +65,39 @@ - \fBint mvwaddnwstr(WINDOW *\fR\fIwin\fR\fB, int \fR\fIy\fR\fB, int \fR\fIx\fR\fB, const wchar_t *\fR\fIwstr\fR\fB, int \fR\fIn\fR\fB);\fR - .fi - .SH DESCRIPTION --These routines write the characters of the -+These functions write the characters of the - (null-terminated) \fBwchar_t\fR character string - \fIwstr\fR on the given window. - It is similar to constructing a \fBcchar_t\fR for each wchar_t in the string, - then calling \fBwadd_wch\fR for the resulting \fBcchar_t\fR. - .PP --The \fImv\fR routines perform cursor movement once, before writing any -+The \fImv\fR functions perform cursor movement once, before writing any - characters. - Thereafter, the cursor is advanced as a side-effect of writing to the window. - .PP --The four routines with \fIn\fR as the last argument --write at most \fIn\fR \fBwchar_t\fR characters. --If \fIn\fR is \-1, then the entire string will be added, --up to the maximum number of characters that will fit on the line, -+The four functions with \fIn\fR as the last argument -+write at most \fIn\fR \fBwchar_t\fR characters, - or until a terminating null is reached. --.SH RETURN VALUES --All routines return the integer \fBERR\fR upon failure and \fBOK\fR on success. -+If \fIn\fR is \-1, then the entire string will be added. -+.SH RETURN VALUE -+All functions return the integer \fBERR\fR upon failure and \fBOK\fR on success. -+.PP -+X/Open does not define any error conditions. -+This implementation returns an error -+.bP -+if the window pointer is null or -+.bP -+if the string pointer is null or -+.bP -+if the corresponding calls to \fBwadd_wch\fP return an error. - .PP - Functions with a "mv" prefix first perform a cursor movement using - \fBwmove\fP, and return an error if the position is outside the window, - or if the window pointer is null. - .SH NOTES --Note that all of these routines except \fBwaddnwstr\fR may be macros. -+All of these functions except \fBwaddnwstr\fR may be macros. - .SH PORTABILITY --All these entry points are described in the XSI Curses standard, Issue 4. -+These functions are described in the XSI Curses standard, Issue 4. - .SH SEE ALSO - \fBcurses\fR(3X), - \fBcurs_add_wch\fR(3X) -diff -Naur ncurses-5.9/man/curs_attr.3x ncurses-5.9.patch/man/curs_attr.3x ---- ncurses-5.9/man/curs_attr.3x 2010-12-04 19:36:44.000000000 +0100 -+++ ncurses-5.9.patch/man/curs_attr.3x 2014-09-01 16:33:22.345792104 +0200 -@@ -1,6 +1,6 @@ - '\" t - .\"*************************************************************************** --.\" Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * -+.\" Copyright (c) 1998-2010,2013 Free Software Foundation, Inc. * - .\" * - .\" Permission is hereby granted, free of charge, to any person obtaining a * - .\" copy of this software and associated documentation files (the * -@@ -27,7 +27,7 @@ - .\" authorization. * - .\"*************************************************************************** - .\" --.\" $Id: curs_attr.3x,v 1.36 2010/12/04 18:36:44 tom Exp $ -+.\" $Id: curs_attr.3x,v 1.39 2013/09/21 20:39:49 Sven.Joachim Exp $ - .TH curs_attr 3X "" - .na - .hy 0 -@@ -164,9 +164,12 @@ - the routines \fBattron\fR, \fBattroff\fR, and \fBattrset\fR, or OR'd with the - characters passed to \fBaddch\fR. - .PP -+.RS - .TS --center ; -+l l -+_ _ _ - l l . -+\fIName\fR \fIDescription\fR - \fBA_NORMAL\fR Normal display (no highlight) - \fBA_STANDOUT\fR Best highlighting mode of the terminal. - \fBA_UNDERLINE\fR Underlining -@@ -177,9 +180,30 @@ - \fBA_PROTECT\fR Protected mode - \fBA_INVIS\fR Invisible or blank mode - \fBA_ALTCHARSET\fR Alternate character set -+\fBA_ITALIC\fR Italics (non-X/Open extension) - \fBA_CHARTEXT\fR Bit-mask to extract a character - \fBCOLOR_PAIR(\fR\fIn\fR\fB)\fR Color-pair number \fIn\fR - .TE -+.RE -+.PP -+These video attributes are supported by \fBattr_on\fP and related functions -+(which also support the attributes recognized by \fBattron\fP, etc.): -+.RS -+.TS -+l l -+_ _ _ -+l l . -+\fIName\fR \fIDescription\fR -+\fBWA_HORIZONTAL\fR Horizontal highlight -+\fBWA_LEFT\fR Left highlight -+\fBWA_LOW\fR Low highlight -+\fBWA_RIGHT\fR Right highlight -+\fBWA_TOP\fR Top highlight -+\fBWA_VERTICAL\fR Vertical highlight -+.TE -+.RE -+.PP -+For consistency - .PP - The following macro is the reverse of \fBCOLOR_PAIR(\fR\fIn\fR\fB)\fR: - .PP -@@ -214,19 +238,27 @@ - SVr4 curses, these functions correctly manipulate all other highlights - (specifically, \fBA_ALTCHARSET\fR, \fBA_PROTECT\fR, and \fBA_INVIS\fR). - .PP -+This implementation provides the \fBA_ITALIC\fP attribute for terminals -+which have the \fIenter_italics_mode\fP (sitm) and \fIexit_italics_mode\fP (ritm) capabilities. -+Italics are not mentioned in X/Open Curses. -+Unlike the other video attributes, \fBI_ITALIC\fP is unrelated -+to the \fIset_attributes\fP capabilities. -+This implementation makes the assumption that -+\fIexit_attribute_mode\fP may also reset italics. -+.PP - XSI Curses added the new entry points, \fBattr_get\fR, \fBattr_on\fR, - \fBattr_off\fR, \fBattr_set\fR, \fBwattr_on\fR, \fBwattr_off\fR, - \fBwattr_get\fR, \fBwattr_set\fR. These are intended to work with - a new series of highlight macros prefixed with \fBWA_\fR. -+The older macros have direct counterparts in the newer set of names: - .PP --Older versions of this library did not force an update of the screen --when changing the attributes. --Use \fBtouchwin\fR to force the screen to match the updated attributes. --.PP -+.RS - .ne 9 - .TS --center ; -+l l -+_ _ _ - l l . -+\fIName\fR \fIDescription\fR - \fBWA_NORMAL\fR Normal display (no highlight) - \fBWA_STANDOUT\fR Best highlighting mode of the terminal. - \fBWA_UNDERLINE\fR Underlining -@@ -236,6 +268,11 @@ - \fBWA_BOLD\fR Extra bright or bold - \fBWA_ALTCHARSET\fR Alternate character set - .TE -+.RE -+.PP -+Older versions of this library did not force an update of the screen -+when changing the attributes. -+Use \fBtouchwin\fR to force the screen to match the updated attributes. - .PP - The XSI curses standard specifies that each pair of corresponding \fBA_\fR - and \fBWA_\fR-using functions operates on the same current-highlight -@@ -243,8 +280,10 @@ - .PP - The XSI standard extended conformance level adds new highlights - \fBA_HORIZONTAL\fR, \fBA_LEFT\fR, \fBA_LOW\fR, \fBA_RIGHT\fR, \fBA_TOP\fR, --\fBA_VERTICAL\fR (and corresponding \fBWA_\fR macros for each) which this --implementation does not yet support. -+\fBA_VERTICAL\fR (and corresponding \fBWA_\fR macros for each). -+As of August 2013, -+no known terminal provides these highlights -+(i.e., via the \fBsgr1\fP capability). - .SH RETURN VALUE - All routines return the integer \fBOK\fR on success, or \fBERR\fP on failure. - .PP -diff -Naur ncurses-5.9/man/curs_bkgrnd.3x ncurses-5.9.patch/man/curs_bkgrnd.3x ---- ncurses-5.9/man/curs_bkgrnd.3x 2010-12-04 19:49:20.000000000 +0100 -+++ ncurses-5.9.patch/man/curs_bkgrnd.3x 2014-09-01 16:33:22.346792106 +0200 -@@ -1,5 +1,5 @@ - .\"*************************************************************************** --.\" Copyright (c) 2002-2006,2010 Free Software Foundation, Inc. * -+.\" Copyright (c) 2002-2010,2012 Free Software Foundation, Inc. * - .\" * - .\" Permission is hereby granted, free of charge, to any person obtaining a * - .\" copy of this software and associated documentation files (the * -@@ -26,7 +26,7 @@ - .\" authorization. * - .\"*************************************************************************** - .\" --.\" $Id: curs_bkgrnd.3x,v 1.4 2010/12/04 18:49:20 tom Exp $ -+.\" $Id: curs_bkgrnd.3x,v 1.5 2012/11/03 23:03:59 tom Exp $ - .TH curs_bkgrnd 3X "" - .SH NAME - \fBbkgrnd\fR, -@@ -89,7 +89,7 @@ - \fBbkgrndset\fR, and - \fBgetbkgrnd\fR - may be macros. --.SH RETURN VALUES -+.SH RETURN VALUE - The \fBbkgrndset\fR and \fBwbkgrndset\fR routines do not return a value. - .PP - Upon successful completion, the other functions return \fBOK\fR. -diff -Naur ncurses-5.9/man/curs_border_set.3x ncurses-5.9.patch/man/curs_border_set.3x ---- ncurses-5.9/man/curs_border_set.3x 2011-01-15 13:56:18.000000000 +0100 -+++ ncurses-5.9.patch/man/curs_border_set.3x 2014-09-01 16:33:22.346792106 +0200 -@@ -1,5 +1,5 @@ - .\"*************************************************************************** --.\" Copyright (c) 2002-2010,2011 Free Software Foundation, Inc. * -+.\" Copyright (c) 2002-2011,2012 Free Software Foundation, Inc. * - .\" * - .\" Permission is hereby granted, free of charge, to any person obtaining a * - .\" copy of this software and associated documentation files (the * -@@ -26,7 +26,7 @@ - .\" authorization. * - .\"*************************************************************************** - .\" --.\" $Id: curs_border_set.3x,v 1.10 2011/01/15 12:56:18 tom Exp $ -+.\" $Id: curs_border_set.3x,v 1.11 2012/11/03 23:03:59 tom Exp $ - .TH curs_border_set 3X "" - .na - .hy 0 -@@ -187,7 +187,7 @@ - \fBvline_set\fR - may be macros. - .br --.SH RETURN VALUES -+.SH RETURN VALUE - .PP - Upon successful completion, these functions return - \fBOK\fR. -diff -Naur ncurses-5.9/man/curs_getcchar.3x ncurses-5.9.patch/man/curs_getcchar.3x ---- ncurses-5.9/man/curs_getcchar.3x 2010-12-04 19:36:44.000000000 +0100 -+++ ncurses-5.9.patch/man/curs_getcchar.3x 2014-09-01 16:33:22.346792106 +0200 -@@ -1,5 +1,5 @@ - .\"*************************************************************************** --.\" Copyright (c) 2001-2009,2010 Free Software Foundation, Inc. * -+.\" Copyright (c) 2001-2010,2012 Free Software Foundation, Inc. * - .\" * - .\" Permission is hereby granted, free of charge, to any person obtaining a * - .\" copy of this software and associated documentation files (the * -@@ -26,7 +26,7 @@ - .\" authorization. * - .\"*************************************************************************** - .\" --.\" $Id: curs_getcchar.3x,v 1.15 2010/12/04 18:36:44 tom Exp $ -+.\" $Id: curs_getcchar.3x,v 1.16 2012/11/03 23:03:59 tom Exp $ - .TH curs_getcchar 3X "" - .de bP - .IP \(bu 4 -@@ -116,7 +116,7 @@ - The \fIwcval\fP argument may be a value generated by a call to - \fBsetcchar\fP or by a function that has a \fBcchar_t\fP output argument. - If \fIwcval\fP is constructed by any other means, the effect is unspecified. --.SH RETURN VALUES -+.SH RETURN VALUE - .PP - When \fIwch\fP is a null pointer, - \fBgetcchar\fP returns the number of wide characters referenced by -diff -Naur ncurses-5.9/man/curs_getch.3x ncurses-5.9.patch/man/curs_getch.3x ---- ncurses-5.9/man/curs_getch.3x 2011-01-22 20:38:51.000000000 +0100 -+++ ncurses-5.9.patch/man/curs_getch.3x 2014-09-01 16:33:22.346792106 +0200 -@@ -1,6 +1,6 @@ - '\" t - .\"*************************************************************************** --.\" Copyright (c) 1998-2010,2011 Free Software Foundation, Inc. * -+.\" Copyright (c) 1998-2011,2012 Free Software Foundation, Inc. * - .\" * - .\" Permission is hereby granted, free of charge, to any person obtaining a * - .\" copy of this software and associated documentation files (the * -@@ -27,7 +27,7 @@ - .\" authorization. * - .\"*************************************************************************** - .\" --.\" $Id: curs_getch.3x,v 1.36 2011/01/22 19:38:51 tom Exp $ -+.\" $Id: curs_getch.3x,v 1.37 2012/07/07 20:04:56 tom Exp $ - .TH curs_getch 3X "" - .na - .hy 0 -@@ -237,14 +237,14 @@ - All routines return the integer \fBERR\fR upon failure and an integer value - other than \fBERR\fR (\fBOK\fR in the case of ungetch()) upon successful - completion. --.RS -+.RS 3 - .TP 5 - \fBungetch\fP --returns an error -+returns ERR - if there is no more room in the FIFO. --.TP 5 -+.TP - \fBwgetch\fP --returns an error -+returns ERR - if the window pointer is null, or - if its timeout expires without having any data. - .RE -diff -Naur ncurses-5.9/man/curs_get_wch.3x ncurses-5.9.patch/man/curs_get_wch.3x ---- ncurses-5.9/man/curs_get_wch.3x 2010-08-15 01:31:42.000000000 +0200 -+++ ncurses-5.9.patch/man/curs_get_wch.3x 2014-09-01 16:33:22.346792106 +0200 -@@ -1,5 +1,5 @@ - .\"*************************************************************************** --.\" Copyright (c) 2002-2006,2010 Free Software Foundation, Inc. * -+.\" Copyright (c) 2002-2010,2012 Free Software Foundation, Inc. * - .\" * - .\" Permission is hereby granted, free of charge, to any person obtaining a * - .\" copy of this software and associated documentation files (the * -@@ -26,7 +26,7 @@ - .\" authorization. * - .\"*************************************************************************** - .\" --.\" $Id: curs_get_wch.3x,v 1.7 2010/08/14 23:31:42 tom Exp $ -+.\" $Id: curs_get_wch.3x,v 1.8 2012/11/03 23:03:59 tom Exp $ - .TH curs_get_wch 3X "" - .SH NAME - \fBget_wch\fR, -@@ -132,7 +132,7 @@ - .PP - All functions except \fBwget_wch\fR and \fBunget_wch\fR - may be macros. --.SH RETURN VALUES -+.SH RETURN VALUE - When - \fBget_wch\fR, - \fBwget_wch\fR, -diff -Naur ncurses-5.9/man/curs_get_wstr.3x ncurses-5.9.patch/man/curs_get_wstr.3x ---- ncurses-5.9/man/curs_get_wstr.3x 2010-12-04 19:36:44.000000000 +0100 -+++ ncurses-5.9.patch/man/curs_get_wstr.3x 2014-09-01 16:33:22.346792106 +0200 -@@ -1,5 +1,5 @@ - .\"*************************************************************************** --.\" Copyright (c) 2002-2006,2010 Free Software Foundation, Inc. * -+.\" Copyright (c) 2002-2010,2012 Free Software Foundation, Inc. * - .\" * - .\" Permission is hereby granted, free of charge, to any person obtaining a * - .\" copy of this software and associated documentation files (the * -@@ -26,7 +26,7 @@ - .\" authorization. * - .\"*************************************************************************** - .\" --.\" $Id: curs_get_wstr.3x,v 1.8 2010/12/04 18:36:44 tom Exp $ -+.\" $Id: curs_get_wstr.3x,v 1.9 2012/11/03 23:03:59 tom Exp $ - .TH curs_get_wstr 3X "" - .na - .hy 0 -@@ -144,7 +144,7 @@ - is no way to distinguish a \fBKEY_\fR value from a valid \fBwchar_t\fR value. - .PP - All of these routines except \fBwgetn_wstr\fR may be macros. --.SH RETURN VALUES -+.SH RETURN VALUE - All of these functions return \fBOK\fR upon successful completion. - Otherwise, they return \fBERR\fR. - .PP -diff -Naur ncurses-5.9/man/curs_initscr.3x ncurses-5.9.patch/man/curs_initscr.3x ---- ncurses-5.9/man/curs_initscr.3x 2010-12-04 19:36:58.000000000 +0100 -+++ ncurses-5.9.patch/man/curs_initscr.3x 2014-09-01 16:33:22.346792106 +0200 -@@ -1,5 +1,5 @@ - .\"*************************************************************************** --.\" Copyright (c) 1998-2005,2010 Free Software Foundation, Inc. * -+.\" Copyright (c) 1998-2013,2014 Free Software Foundation, Inc. * - .\" * - .\" Permission is hereby granted, free of charge, to any person obtaining a * - .\" copy of this software and associated documentation files (the * -@@ -26,8 +26,15 @@ - .\" authorization. * - .\"*************************************************************************** - .\" --.\" $Id: curs_initscr.3x,v 1.17 2010/12/04 18:36:58 tom Exp $ -+.\" $Id: curs_initscr.3x,v 1.20 2014/03/01 22:31:22 tom Exp $ - .TH curs_initscr 3X "" -+.de bP -+.IP \(bu 4 -+.. -+.ie \n(.g .ds `` \(lq -+.el .ds `` `` -+.ie \n(.g .ds '' \(rq -+.el .ds '' '' - .na - .hy 0 - .SH NAME -@@ -56,49 +63,71 @@ - .br - .SH DESCRIPTION - \fBinitscr\fR is normally the first \fBcurses\fR routine to call when --initializing a program. A few special routines sometimes need to be --called before it; these are \fBslk_init\fR, \fBfilter\fR, \fBripoffline\fR, --\fBuse_env\fR. For multiple-terminal applications, \fBnewterm\fR may be --called before \fBinitscr\fR. -+initializing a program. -+A few special routines sometimes need to be called before it; -+these are \fBslk_init\fR, \fBfilter\fR, \fBripoffline\fR, -+\fBuse_env\fR. -+For multiple-terminal applications, -+\fBnewterm\fR may be called before \fBinitscr\fR. - .PP - The initscr code determines the terminal type and initializes all \fBcurses\fR --data structures. \fBinitscr\fR also causes the first call to \fBrefresh\fR to --clear the screen. If errors occur, \fBinitscr\fR writes an appropriate error --message to standard error and exits; otherwise, a pointer is returned to --\fBstdscr\fR. -+data structures. -+\fBinitscr\fR also causes the first call to \fBrefresh\fR to clear the screen. -+If errors occur, \fBinitscr\fR writes an appropriate error -+message to standard error and exits; -+otherwise, a pointer is returned to \fBstdscr\fR. - .PP - A program that outputs to more than one terminal should use the \fBnewterm\fR --routine for each terminal instead of \fBinitscr\fR. A program that needs to --inspect capabilities, so it can continue to run in a line-oriented mode if the -+routine for each terminal instead of \fBinitscr\fR. -+A program that needs to inspect capabilities, -+so it can continue to run in a line-oriented mode if the - terminal cannot support a screen-oriented program, would also use --\fBnewterm\fR. The routine \fBnewterm\fR should be called once for each --terminal. It returns a variable of type \fBSCREEN *\fR which should be saved --as a reference to that terminal. The arguments are the \fItype\fR of the --terminal to be used in place of \fB$TERM\fR, a file pointer for output to the --terminal, and another file pointer for input from the terminal (if \fItype\fR --is \fBNULL\fR, \fB$TERM\fR will be used). The program must also call -+\fBnewterm\fR. -+The routine \fBnewterm\fR should be called once for each terminal. -+It returns a variable of type \fBSCREEN *\fR which should be saved -+as a reference to that terminal. -+\fBnewterm\fP's arguments are -+.bP -+the \fItype\fR of the terminal to be used in place of \fB$TERM\fR, -+.bP -+a file pointer for output to the terminal, and -+.bP -+another file pointer for input from the terminal -+.PP -+If the \fItype\fR parameter is \fBNULL\fR, \fB$TERM\fR will be used. -+.PP -+The program must also call - \fBendwin\fR for each terminal being used before exiting from \fBcurses\fR. - If \fBnewterm\fR is called more than once for the same terminal, the first - terminal referred to must be the last one for which \fBendwin\fR is called. - .PP - A program should always call \fBendwin\fR before exiting or escaping from --\fBcurses\fR mode temporarily. This routine restores tty modes, moves the --cursor to the lower left-hand corner of the screen and resets the terminal into --the proper non-visual mode. Calling \fBrefresh\fR or \fBdoupdate\fR after a -+\fBcurses\fR mode temporarily. -+This routine -+.bP -+restores tty modes, -+.bP -+moves the cursor to the lower left-hand corner of the screen and -+.bP -+resets the terminal into -+the proper non-visual mode. -+.PP -+Calling \fBrefresh\fR or \fBdoupdate\fR after a - temporary escape causes the program to resume visual mode. - .PP - The \fBisendwin\fR routine returns \fBTRUE\fR if \fBendwin\fR has been --called without any subsequent calls to \fBwrefresh\fR, and \fBFALSE\fR --otherwise. -+called without any subsequent calls to \fBwrefresh\fR, -+and \fBFALSE\fR otherwise. - .PP --The \fBset_term\fR routine is used to switch between different --terminals. The screen reference \fBnew\fR becomes the new current --terminal. The previous terminal is returned by the routine. This is --the only routine which manipulates \fBSCREEN\fR pointers; all other --routines affect only the current terminal. -+The \fBset_term\fR routine is used to switch between different terminals. -+The screen reference \fBnew\fR becomes the new current terminal. -+The previous terminal is returned by the routine. -+This is the only routine which manipulates \fBSCREEN\fR pointers; -+all other routines affect only the current terminal. - .PP - The \fBdelscreen\fR routine frees storage associated with the --\fBSCREEN\fR data structure. The \fBendwin\fR routine does not do -+\fBSCREEN\fR data structure. -+The \fBendwin\fR routine does not do - this, so \fBdelscreen\fR should be called after \fBendwin\fR if a - particular \fBSCREEN\fR is no longer needed. - .SH RETURN VALUE -@@ -109,22 +138,41 @@ - .PP - X/Open defines no error conditions. - In this implementation -+.bP - \fBendwin\fP returns an error if the terminal was not initialized. -+.bP -+\fBnewterm\fP -+returns an error if it cannot allocate the data structures for the screen, -+or for the top-level windows within the screen, -+i.e., -+\fBcurscr\fP, \fBnewscr\fP, or \fBstdscr\fP. -+.bP -+\fBset_term\fP -+returns no error. - .SH NOTES - Note that \fBinitscr\fR and \fBnewterm\fR may be macros. - .SH PORTABILITY --These functions are described in the XSI Curses standard, Issue 4. It --specifies that portable applications must not call \fBinitscr\fR more than --once. -+These functions are described in the XSI Curses standard, Issue 4. -+It specifies that portable applications must not -+call \fBinitscr\fR more than once. - .PP - Old versions of curses, e.g., BSD 4.4, may have returned a null pointer - from \fBinitscr\fR when an error is detected, rather than exiting. - It is safe but redundant to check the return value of \fBinitscr\fR - in XSI Curses. -+.PP -+If the TERM variable is missing or empty, \fBinitscr\fP uses the -+value \*(``unknown\*('', -+which normally corresponds to a terminal entry with the \fIgeneric\fP -+(\fIgn\fP) capability. -+Generic entries are detected by \fBsetupterm\fP(3X) and cannot be -+used for full-screen operation. -+Other implementations may handle a missing/empty TERM variable differently. - .SH SEE ALSO - \fBcurses\fR(3X), - \fBcurs_kernel\fR(3X), - \fBcurs_refresh\fR(3X), - \fBcurs_slk\fR(3X), -+\fBcurs_terminfo\fR(3X), - \fBcurs_util\fR(3X), - \fBcurs_variables\fR(3X). -diff -Naur ncurses-5.9/man/curs_inopts.3x ncurses-5.9.patch/man/curs_inopts.3x ---- ncurses-5.9/man/curs_inopts.3x 2010-12-04 19:40:45.000000000 +0100 -+++ ncurses-5.9.patch/man/curs_inopts.3x 2014-09-01 16:33:22.347792108 +0200 -@@ -1,5 +1,5 @@ - .\"*************************************************************************** --.\" Copyright (c) 1998-2005,2010 Free Software Foundation, Inc. * -+.\" Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. * - .\" * - .\" Permission is hereby granted, free of charge, to any person obtaining a * - .\" copy of this software and associated documentation files (the * -@@ -26,8 +26,12 @@ - .\" authorization. * - .\"*************************************************************************** - .\" --.\" $Id: curs_inopts.3x,v 1.15 2010/12/04 18:40:45 tom Exp $ -+.\" $Id: curs_inopts.3x,v 1.18 2013/07/20 19:42:02 tom Exp $ - .TH curs_inopts 3X "" -+.ie \n(.g .ds `` \(lq -+.el .ds `` `` -+.ie \n(.g .ds '' \(rq -+.el .ds '' '' - .na - .hy 0 - .SH NAME -@@ -188,11 +192,13 @@ - plus the additional capability of being able to block for only - \fIdelay\fR milliseconds (where \fIdelay\fR is positive). - .PP --The \fBcurses\fR library does ``line-breakout optimization'' by looking for --typeahead periodically while updating the screen. If input is found, --and it is coming from a tty, the current update is postponed until --\fBrefresh\fR or \fBdoupdate\fR is called again. This allows faster --response to commands typed in advance. Normally, the input FILE -+The \fBcurses\fR library does \*(``line-breakout optimization\*('' -+by looking for typeahead periodically while updating the screen. -+If input is found, and it is coming from a tty, -+the current update is postponed until -+\fBrefresh\fR or \fBdoupdate\fR is called again. -+This allows faster response to commands typed in advance. -+Normally, the input FILE - pointer passed to \fBnewterm\fR, or \fBstdin\fR in the case that - \fBinitscr\fR was used, will be used to do this typeahead checking. - The \fBtypeahead\fR routine specifies that the file descriptor -@@ -223,6 +229,42 @@ - left the echo bit on at initialization, but the BSD \fBraw\fR call turned it - off as a side-effect. For best portability, set echo or noecho explicitly - just after initialization, even if your program remains in cooked mode. -+.PP -+When \fBkeypad\fP is first enabled, -+ncurses loads the key-definitions for the current terminal description. -+If the terminal description includes extended string capabilities, -+e.g., from using the \fB\-x\fP option of @TIC@, -+then ncurses also defines keys for the capabilities whose names -+begin with "k". -+The corresponding keycodes are generated and (depending on previous -+loads of terminal descriptions) may differ from one execution of a -+program to the next. -+The generated keycodes are recognized by the \fBkeyname\fP function -+(which will then return a name beginning with "k" denoting the -+terminfo capability name rather than "K", used for curses key-names). -+On the other hand, an application can use \fBdefine_key\fP to establish -+a specific keycode for a given string. -+This makes it possible for an application to check for an extended -+capability's presence with \fItigetstr\fP, -+and reassign the keycode to match its own needs. -+.PP -+Low-level applications can use \fBtigetstr\fP to obtain the definition -+of any particular string capability. -+Higher-level applications which use the curses \fBwgetch\fP -+and similar functions to return keycodes rely upon the order in which -+the strings are loaded. -+If more than one key definition has the same string value, -+then \fBwgetch\fP can return only one keycode. -+Most curses implementations (including ncurses) -+load key definitions in the order -+defined by the array of string capability names. -+The last key to be loaded determines the keycode which will be returned. -+In ncurses, you may also have extended capabilities interpreted as -+key definitions. -+These are loaded after the predefined keys, -+and if a capability's value is the same as a previously-loaded -+key definition, -+the later definition is the one used. - .SH NOTES - Note that \fBecho\fR, \fBnoecho\fR, \fBhalfdelay\fR, \fBintrflush\fR, - \fBmeta\fR, \fBnodelay\fR, \fBnotimeout\fR, \fBnoqiflush\fR, -@@ -233,4 +275,9 @@ - respectively. Mixing raw/noraw and cbreak/nocbreak calls leads to tty driver - control states that are hard to predict or understand; it is not recommended. - .SH SEE ALSO --\fBcurses\fR(3X), \fBcurs_getch\fR(3X), \fBcurs_initscr\fR(3X), \fBtermio\fR(7) -+\fBcurses\fR(3X), -+\fBcurs_getch\fR(3X), -+\fBcurs_initscr\fR(3X), -+\fBcurs_util\fR(3X), -+\fBdefine_key\fR(3X), -+\fBtermio\fR(7) -diff -Naur ncurses-5.9/man/curs_ins_wstr.3x ncurses-5.9.patch/man/curs_ins_wstr.3x ---- ncurses-5.9/man/curs_ins_wstr.3x 2010-12-04 19:38:55.000000000 +0100 -+++ ncurses-5.9.patch/man/curs_ins_wstr.3x 2014-09-01 16:33:22.347792108 +0200 -@@ -1,5 +1,5 @@ - .\"*************************************************************************** --.\" Copyright (c) 2002-2005,2010 Free Software Foundation, Inc. * -+.\" Copyright (c) 2002-2010,2012 Free Software Foundation, Inc. * - .\" * - .\" Permission is hereby granted, free of charge, to any person obtaining a * - .\" copy of this software and associated documentation files (the * -@@ -26,7 +26,7 @@ - .\" authorization. * - .\"*************************************************************************** - .\" --.\" $Id: curs_ins_wstr.3x,v 1.6 2010/12/04 18:38:55 tom Exp $ -+.\" $Id: curs_ins_wstr.3x,v 1.7 2012/11/03 23:03:59 tom Exp $ - .TH curs_ins_wstr 3X "" - .na - .hy 0 -@@ -92,7 +92,7 @@ - functions will fail. - XSI does not define what will happen if a nonspacing character follows - a control character. --.SH RETURN VALUES -+.SH RETURN VALUE - Upon successful completion, these functions return OK. - Otherwise, they return ERR. - .PP -diff -Naur ncurses-5.9/man/curs_in_wchstr.3x ncurses-5.9.patch/man/curs_in_wchstr.3x ---- ncurses-5.9/man/curs_in_wchstr.3x 2010-12-04 19:36:44.000000000 +0100 -+++ ncurses-5.9.patch/man/curs_in_wchstr.3x 2014-09-01 16:33:22.346792106 +0200 -@@ -1,5 +1,5 @@ - .\"*************************************************************************** --.\" Copyright (c) 2002-2006,2010 Free Software Foundation, Inc. * -+.\" Copyright (c) 2002-2010,2012 Free Software Foundation, Inc. * - .\" * - .\" Permission is hereby granted, free of charge, to any person obtaining a * - .\" copy of this software and associated documentation files (the * -@@ -26,7 +26,7 @@ - .\" authorization. * - .\"*************************************************************************** - .\" --.\" $Id: curs_in_wchstr.3x,v 1.8 2010/12/04 18:36:44 tom Exp $ -+.\" $Id: curs_in_wchstr.3x,v 1.9 2012/11/03 23:03:59 tom Exp $ - .TH curs_in_wchstr 3X "" - .na - .hy 0 -@@ -98,7 +98,7 @@ - \fBmvwin_wchnstr\fR, or - \fBwin_wchnstr\fR - is recommended. --.SH RETURN VALUES -+.SH RETURN VALUE - Upon successful completion, these functions return - \fBOK\fR. - Otherwise, they return -diff -Naur ncurses-5.9/man/curs_inwstr.3x ncurses-5.9.patch/man/curs_inwstr.3x ---- ncurses-5.9/man/curs_inwstr.3x 2010-12-04 19:38:55.000000000 +0100 -+++ ncurses-5.9.patch/man/curs_inwstr.3x 2014-09-01 16:33:22.347792108 +0200 -@@ -1,5 +1,5 @@ - .\"*************************************************************************** --.\" Copyright (c) 2002-2006,2010 Free Software Foundation, Inc. * -+.\" Copyright (c) 2002-2010,2012 Free Software Foundation, Inc. * - .\" * - .\" Permission is hereby granted, free of charge, to any person obtaining a * - .\" copy of this software and associated documentation files (the * -@@ -26,7 +26,7 @@ - .\" authorization. * - .\"*************************************************************************** - .\" --.\" $Id: curs_inwstr.3x,v 1.7 2010/12/04 18:38:55 tom Exp $ -+.\" $Id: curs_inwstr.3x,v 1.8 2012/11/03 23:03:59 tom Exp $ - .TH curs_inwstr 3X "" - .SH NAME - \fBinwstr\fR, -@@ -72,7 +72,7 @@ - Note that all routines except - \fBwinnwstr\fR - may be macros. --.SH RETURN VALUES -+.SH RETURN VALUE - All routines return - \fBERR\fR - upon failure. Upon -diff -Naur ncurses-5.9/man/curs_mouse.3x ncurses-5.9.patch/man/curs_mouse.3x ---- ncurses-5.9/man/curs_mouse.3x 2010-12-04 19:38:55.000000000 +0100 -+++ ncurses-5.9.patch/man/curs_mouse.3x 2014-09-01 16:33:22.347792108 +0200 -@@ -1,6 +1,6 @@ - '\" t - .\"*************************************************************************** --.\" Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * -+.\" Copyright (c) 1998-2010,2013 Free Software Foundation, Inc. * - .\" * - .\" Permission is hereby granted, free of charge, to any person obtaining a * - .\" copy of this software and associated documentation files (the * -@@ -27,7 +27,7 @@ - .\" authorization. * - .\"*************************************************************************** - .\" --.\" $Id: curs_mouse.3x,v 1.38 2010/12/04 18:38:55 tom Exp $ -+.\" $Id: curs_mouse.3x,v 1.39 2013/06/22 18:09:42 tom Exp $ - .TH curs_mouse 3X "" - .na - .hy 0 -@@ -40,20 +40,18 @@ - .ad - .hy - .SH SYNOPSIS --.nf --\fB#include <curses.h> -+\fB#include <curses.h>\fR - .PP --\fBtypedef unsigned long mmask_t; -+\fBtypedef unsigned long mmask_t;\fR - .PP --typedef struct --{ -- short id; \fI/* ID to distinguish multiple devices */\fB -- int x, y, z; \fI/* event coordinates */\fB -- mmask_t bstate; \fI/* button state bits */\fB --} --MEVENT;\fR -+.nf -+\fBtypedef struct {\fR -+\fB short id; \fR\fI/* ID to distinguish multiple devices */\fR -+\fB int x, y, z; \fR\fI/* event coordinates */\fR -+\fB mmask_t bstate; \fR\fI/* button state bits */\fR -+\fB} MEVENT;\fR - .fi --.br -+.PP - \fBbool has_mouse(void);\fR - .br - \fBint getmouse(MEVENT *event);\fR -diff -Naur ncurses-5.9/man/curs_opaque.3x ncurses-5.9.patch/man/curs_opaque.3x ---- ncurses-5.9/man/curs_opaque.3x 2010-12-04 19:40:45.000000000 +0100 -+++ ncurses-5.9.patch/man/curs_opaque.3x 2014-09-01 16:34:19.462887222 +0200 -@@ -1,5 +1,5 @@ - .\"*************************************************************************** --.\" Copyright (c) 2007-2009,2010 Free Software Foundation, Inc. * -+.\" Copyright (c) 2007-2013,2014 Free Software Foundation, Inc. * - .\" * - .\" Permission is hereby granted, free of charge, to any person obtaining a * - .\" copy of this software and associated documentation files (the * -@@ -26,8 +26,12 @@ - .\" authorization. * - .\"*************************************************************************** - .\" --.\" $Id: curs_opaque.3x,v 1.9 2010/12/04 18:40:45 tom Exp $ -+.\" $Id: curs_opaque.3x,v 1.11 2014/03/15 19:24:23 tom Exp $ - .TH curs_opaque 3X "" -+.ie \n(.g .ds `` \(lq -+.el .ds `` `` -+.ie \n(.g .ds '' \(rq -+.el .ds '' '' - .na - .hy 0 - .SH NAME -@@ -74,11 +78,13 @@ - .br - \fBWINDOW * wgetparent(const WINDOW *win);\fR - .br -+\fBint wgetdelay(const WINDOW *win);\fR -+.br - \fBint wgetscrreg(const WINDOW *win, int *top, int *bottom);\fR - .br - .SH DESCRIPTION - This implementation provides functions which return properties --set in the WINDOW structure, allowing it to be ``opaque'' if -+set in the WINDOW structure, allowing it to be \*(``opaque\*('' if - the symbol \fBNCURSES_OPAQUE\fR is defined: - .TP 5 - \fBis_cleared\fR -@@ -119,12 +125,16 @@ - \fBis_syncok\fR - returns the value set in \fBsyncok\fR - .TP 5 -+\fBwgetdelay\fR -+returns the delay timeout as set in \fBwtimeout\fP. -+.TP 5 - \fBwgetparent\fR - returns the parent WINDOW pointer for subwindows, - or NULL for windows having no parent. - .TP 5 - \fBwgetscrreg\fR --returns the top and bottom rows for the scrolling margin as set in \fBwsetscrreg\fP. -+returns the top and bottom rows for the scrolling margin -+as set in \fBwsetscrreg\fP. - .SH RETURN VALUE - These functions all return TRUE or FALSE, except as noted. - .SH NOTES -diff -Naur ncurses-5.9/man/curs_overlay.3x ncurses-5.9.patch/man/curs_overlay.3x ---- ncurses-5.9/man/curs_overlay.3x 2010-12-04 19:40:45.000000000 +0100 -+++ ncurses-5.9.patch/man/curs_overlay.3x 2014-09-01 16:33:22.347792108 +0200 -@@ -1,5 +1,5 @@ - .\"*************************************************************************** --.\" Copyright (c) 1998-2006,2010 Free Software Foundation, Inc. * -+.\" Copyright (c) 1998-2010,2013 Free Software Foundation, Inc. * - .\" * - .\" Permission is hereby granted, free of charge, to any person obtaining a * - .\" copy of this software and associated documentation files (the * -@@ -26,7 +26,7 @@ - .\" authorization. * - .\"*************************************************************************** - .\" --.\" $Id: curs_overlay.3x,v 1.16 2010/12/04 18:40:45 tom Exp $ -+.\" $Id: curs_overlay.3x,v 1.17 2013/04/06 23:48:51 tom Exp $ - .TH curs_overlay 3X "" - .na - .hy 0 -@@ -48,18 +48,21 @@ - \fBint dmaxcol, int overlay);\fR - .SH DESCRIPTION - The \fBoverlay\fR and \fBoverwrite\fR routines overlay \fIsrcwin\fR on --top of \fIdstwin\fR. \fIscrwin\fR and \fIdstwin\fR are not required --to be the same size; only text where the two windows overlap is --copied. The difference is that \fBoverlay\fR is non-destructive -+top of \fIdstwin\fR. -+\fIscrwin\fR and \fIdstwin\fR are not required -+to be the same size; only text where the two windows overlap is copied. -+The difference is that \fBoverlay\fR is non-destructive - (blanks are not copied) whereas \fBoverwrite\fR is destructive. - .PP - The \fBcopywin\fR routine provides a finer granularity of control over the --\fBoverlay\fR and \fBoverwrite\fR routines. Like in the \fBprefresh\fR --routine, a rectangle is specified in the destination window, (\fIdminrow\fR, -+\fBoverlay\fR and \fBoverwrite\fR routines. -+As in the \fBprefresh\fR routine, -+a rectangle is specified in the destination window, (\fIdminrow\fR, - \fIdmincol\fR) and (\fIdmaxrow\fR, \fIdmaxcol\fR), and the upper-left-corner --coordinates of the source window, (\fIsminrow\fR, \fIsmincol\fR). If the --argument \fIoverlay\fR is \fBtrue\fR, then copying is non-destructive, as in --\fBoverlay\fR. -+coordinates of the source window, (\fIsminrow\fR, \fIsmincol\fR). -+If the argument \fIoverlay\fR is \fBtrue\fR, -+then copying is non-destructive, -+as in \fBoverlay\fR. - .SH RETURN VALUE - Routines that return an integer return \fBERR\fR upon failure, and \fBOK\fR - (SVr4 only specifies "an integer value other than \fBERR\fR") upon successful -@@ -75,7 +78,8 @@ - Note that \fBoverlay\fR and \fBoverwrite\fR may be macros. - .SH PORTABILITY - The XSI Curses standard, Issue 4 describes these functions (adding the const --qualifiers). It further specifies their behavior in the presence of characters -+qualifiers). -+It further specifies their behavior in the presence of characters - with multibyte renditions (not yet supported in this implementation). - .SH SEE ALSO - \fBcurses\fR(3X), \fBcurs_pad\fR(3X), \fBcurs_refresh\fR(3X) -diff -Naur ncurses-5.9/man/curs_sp_funcs.3x ncurses-5.9.patch/man/curs_sp_funcs.3x ---- ncurses-5.9/man/curs_sp_funcs.3x 2010-12-04 19:38:55.000000000 +0100 -+++ ncurses-5.9.patch/man/curs_sp_funcs.3x 2014-09-01 16:33:22.347792108 +0200 -@@ -1,5 +1,5 @@ - .\"*************************************************************************** --.\" Copyright (c) 2010 Free Software Foundation, Inc. * -+.\" Copyright (c) 2010,2013 Free Software Foundation, Inc. * - .\" * - .\" Permission is hereby granted, free of charge, to any person obtaining a * - .\" copy of this software and associated documentation files (the * -@@ -26,7 +26,7 @@ - .\" authorization. * - .\"*************************************************************************** - .\" --.\" $Id: curs_sp_funcs.3x,v 1.5 2010/12/04 18:38:55 tom Exp $ -+.\" $Id: curs_sp_funcs.3x,v 1.6 2013/06/22 17:53:59 tom Exp $ - .TH curs_sp_funcs 3X "" - .na - .hy 0 -@@ -186,7 +186,7 @@ - .br - \fBint slk_attrset_sp(SCREEN*, const chtype);\fR - .br --\fBint slk_attr_sp((SCREEN*);\fR -+\fBint slk_attr_sp(SCREEN*);\fR - .br - \fBint slk_clear_sp(SCREEN*);\fR - .br -diff -Naur ncurses-5.9/man/curs_termcap.3x ncurses-5.9.patch/man/curs_termcap.3x ---- ncurses-5.9/man/curs_termcap.3x 2010-12-04 19:38:55.000000000 +0100 -+++ ncurses-5.9.patch/man/curs_termcap.3x 2014-09-01 16:33:22.347792108 +0200 -@@ -1,5 +1,5 @@ - .\"*************************************************************************** --.\" Copyright (c) 1998-2007,2010 Free Software Foundation, Inc. * -+.\" Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. * - .\" * - .\" Permission is hereby granted, free of charge, to any person obtaining a * - .\" copy of this software and associated documentation files (the * -@@ -26,8 +26,11 @@ - .\" authorization. * - .\"*************************************************************************** - .\" --.\" $Id: curs_termcap.3x,v 1.26 2010/12/04 18:38:55 tom Exp $ -+.\" $Id: curs_termcap.3x,v 1.30 2013/01/19 15:58:48 tom Exp $ - .TH curs_termcap 3X "" -+.de bP -+.IP \(bu 4 -+.. - .na - .hy 0 - .ds n 5 -@@ -75,11 +78,39 @@ - routines are emulated using the \fIterminfo\fR database. Thus, they - can only be used to query the capabilities of entries for which a - terminfo entry has been compiled. -+.SS INITIALIZATION - .PP - The \fBtgetent\fR routine loads the entry for \fIname\fR. --It returns 1 on success, 0 if there is no such entry, and \-1 if the --terminfo database could not be found. -+It returns: -+.RS 3 -+.TP 3 -+1 -+on success, -+.TP 3 -+0 -+if there is no such entry -+(or that it is a generic type, having too little information for curses -+applications to run), and -+.TP 3 -+\-1 -+if the terminfo database could not be found. -+.RE -+.PP -+This differs from the \fItermcap\fP library in two ways: -+.RS 3 -+.bP - The emulation ignores the buffer pointer \fIbp\fR. -+The \fItermcap\fP library would store a copy of the terminal -+description in the area referenced by this pointer. -+However, ncurses stores its terminal descriptions in compiled -+binary form, which is not the same thing. -+.bP -+There is a difference in return codes. -+The \fItermcap\fP library does not check if the terminal -+description is marked with the \fIgeneric\fP capability, -+or if the terminal description has cursor-addressing. -+.RE -+.SS CAPABILITY VALUES - .PP - The \fBtgetflag\fR routine gets the boolean entry for \fIid\fR, - or zero if it is not available. -@@ -98,12 +129,14 @@ - \fBtgetflag\fR, - \fBtgetnum\fR and - \fBtgetstr\fR are compared in lookups. -+.SS FORMATTING CAPABILITIES - .PP - The \fBtgoto\fR routine instantiates the parameters into the given capability. - The output from this routine is to be passed to \fBtputs\fR. - .PP - The \fBtputs\fR routine is described on the \fBcurs_terminfo\fR(3X) manual - page. It can retrieve capabilities by either termcap or terminfo name. -+.SS GLOBAL VARIABLES - .PP - The variables - \fBPC\fR, -@@ -165,8 +198,28 @@ - e.g., not distinguishing between input and output. - In particular, some applications are reported to declare and/or - modify \fBospeed\fR. -+.PP -+The comment that only the first two characters of the \fBid\fR parameter -+are used escapes many application developers. -+The original BSD 4.2 termcap library (and historical relics thereof) -+did not require a trailing null NUL on the parameter name passed -+to \fBtgetstr\fP, \fBtgetnum\fP and \fBtgetflag\fP. -+Some applications assume that the termcap interface does not require -+the trailing NUL for the parameter name. -+Taking into account these issues: -+.bP -+As a special case, -+\fBtgetflag\fP matched against a single-character identifier -+provided that was at the end of the terminal description. -+You should not rely upon this behavior in portable programs. -+This implementation disallows matches against single-character capability names. -+.bP -+This implementation disallows matches by the termcap interface against -+extended capability names which are longer than two characters. - .SH SEE ALSO - \fBcurses\fR(3X), - \fBterminfo\fR(\*n), - \fBterm_variables\fR(3X), - \fBputc\fR(3). -+.sp -+http://invisible-island.net/ncurses/tctest.html -diff -Naur ncurses-5.9/man/curs_terminfo.3x ncurses-5.9.patch/man/curs_terminfo.3x ---- ncurses-5.9/man/curs_terminfo.3x 2010-12-04 19:38:55.000000000 +0100 -+++ ncurses-5.9.patch/man/curs_terminfo.3x 2014-09-01 16:33:22.348792109 +0200 -@@ -1,5 +1,5 @@ - .\"*************************************************************************** --.\" Copyright (c) 1999-2008,2010 Free Software Foundation, Inc. * -+.\" Copyright (c) 1999-2011,2013 Free Software Foundation, Inc. * - .\" * - .\" Permission is hereby granted, free of charge, to any person obtaining a * - .\" copy of this software and associated documentation files (the * -@@ -26,8 +26,15 @@ - .\" authorization. * - .\"*************************************************************************** - .\" --.\" $Id: curs_terminfo.3x,v 1.35 2010/12/04 18:38:55 tom Exp $ -+.\" $Id: curs_terminfo.3x,v 1.43 2013/07/20 19:29:59 tom Exp $ - .TH curs_terminfo 3X "" -+.ie \n(.g .ds `` \(lq -+.el .ds `` `` -+.ie \n(.g .ds '' \(rq -+.el .ds '' '' -+.de bP -+.IP \(bu 4 -+.. - .ds n 5 - .na - .hy 0 -@@ -77,7 +84,7 @@ - .br - \fBint vidattr(chtype \fR\fIattrs\fR\fB);\fR - .br --\fBint vid_puts(attr_t \fR\fIattrs\fR\fB, short \fR\fIpair\fR\fB, void *\fR\fIopts\fR\fB, int (*\fR\fIputc\fR\fB)(char));\fR -+\fBint vid_puts(attr_t \fR\fIattrs\fR\fB, short \fR\fIpair\fR\fB, void *\fR\fIopts\fR\fB, int (*\fR\fIputc\fR\fB)(int));\fR - .br - \fBint vid_attr(attr_t \fR\fIattrs\fR\fB, short \fR\fIpair\fR\fB, void *\fR\fIopts\fR\fB);\fR - .br -@@ -98,40 +105,54 @@ - capabilities, such as programming function keys. For all other - functionality, \fBcurses\fR routines are more suitable and their use is - recommended. -+.SS Initialization - .PP - Initially, \fBsetupterm\fR should be called. Note that - \fBsetupterm\fR is automatically called by \fBinitscr\fR and - \fBnewterm\fR. This defines the set of terminal-dependent variables - [listed in \fBterminfo\fR(\*n)]. -+.PP -+Each initialization routine provides applications with the -+terminal capabilities either directly (via header definitions), -+or by special functions. -+The header files \fBcurses.h\fR and \fBterm.h\fR should be included (in this -+order) to get the definitions for these strings, numbers, and flags. -+.PP - The \fBterminfo\fR variables - \fBlines\fR and \fBcolumns\fR are initialized by \fBsetupterm\fR as - follows: --.RS --.PP -+.bP - If \fBuse_env(FALSE)\fR has been called, values for - \fBlines\fR and \fBcolumns\fR specified in \fBterminfo\fR are used. --.PP -+.bP - Otherwise, if the environment variables \fBLINES\fR and \fBCOLUMNS\fR - exist, their values are used. If these environment variables do not - exist and the program is running in a window, the current window size - is used. Otherwise, if the environment variables do not exist, the - values for \fBlines\fR and \fBcolumns\fR specified in the - \fBterminfo\fR database are used. --.RE - .PP --The header files \fBcurses.h\fR and \fBterm.h\fR should be included (in this --order) to get the definitions for these strings, numbers, and flags. - Parameterized strings should be passed through \fBtparm\fR to instantiate them. - All \fBterminfo\fR strings [including the output of \fBtparm\fR] should be printed --with \fBtputs\fR or \fBputp\fR. Call the \fBreset_shell_mode\fR to restore the --tty modes before exiting [see \fBcurs_kernel\fR(3X)]. Programs which use --cursor addressing should output \fBenter_ca_mode\fR upon startup and should --output \fBexit_ca_mode\fR before exiting. Programs desiring shell escapes --should call --.PP --\fBreset_shell_mode\fR and output \fBexit_ca_mode\fR before the shell --is called and should output \fBenter_ca_mode\fR and call --\fBreset_prog_mode\fR after returning from the shell. -+with \fBtputs\fR or \fBputp\fR. -+Call \fBreset_shell_mode\fR to restore the -+tty modes before exiting [see \fBcurs_kernel\fR(3X)]. -+.PP -+Programs which use -+cursor addressing should -+.bP -+output \fBenter_ca_mode\fR upon startup and -+.bP -+output \fBexit_ca_mode\fR before exiting. -+.PP -+Programs which execute shell subprocesses should -+.bP -+call \fBreset_shell_mode\fR and -+output \fBexit_ca_mode\fR before the shell -+is called and -+.bP -+output \fBenter_ca_mode\fR and -+call \fBreset_prog_mode\fR after returning from the shell. - .PP - The \fBsetupterm\fR routine reads in the \fBterminfo\fR database, - initializing the \fBterminfo\fR structures, but does not set up the -@@ -146,19 +167,23 @@ - A return value of \fBOK\fR combined with status of \fB1\fR in \fIerrret\fR - is normal. - If \fBERR\fR is returned, examine \fIerrret\fR: --.RS - .TP 5 - .B 1 - means that the terminal is hardcopy, cannot be used for curses applications. -+.IP -+\fBsetupterm\fP determines if the entry is a hardcopy type by -+checking the \fIhc\fP (\fIhardcopy\fP) capability. - .TP 5 - .B 0 - means that the terminal could not be found, - or that it is a generic type, - having too little information for curses applications to run. -+.IP -+\fBsetupterm\fP determines if the entry is a generic type by -+checking the \fIgn\fP (\fIgeneric\fP) capability. - .TP 5 - .B \-1 - means that the \fBterminfo\fR database could not be found. --.RE - .PP - If \fIerrret\fR is - null, \fBsetupterm\fR prints an error message upon finding an error -@@ -168,18 +193,33 @@ - .sp - which uses all the defaults and sends the output to \fBstdout\fR. - .PP --The \fBsetterm\fR routine is being replaced by \fBsetupterm\fR. The call: -+The \fBsetterm\fR routine was replaced by \fBsetupterm\fR. The call: - .sp - \fBsetupterm(\fR\fIterm\fR\fB, 1, (int *)0)\fR - .sp - provides the same functionality as \fBsetterm(\fR\fIterm\fR\fB)\fR. --The \fBsetterm\fR routine is included here for BSD compatibility, and -+The \fBsetterm\fR routine is provided for BSD compatibility, and - is not recommended for new programs. -+.\" *************************************************************************** -+.SS The Terminal State -+.PP -+The \fBsetupterm\fR routine stores its information about the terminal -+in a \fBTERMINAL\fP structure pointed to by the global variable \fBcur_term\fP. -+If it detects an error, -+or decides that the terminal is unsuitable (hardcopy or generic), -+it discards this information, -+making it not available to applications. -+.PP -+If \fBsetupterm\fP is called repeatedly for the same terminal type, -+it will reuse the information. -+It maintains only one copy of a given terminal's capabilities in memory. -+If it is called for different terminal types, -+\fBsetupterm\fP allocates new storage for each set of terminal capabilities. - .PP --The \fBset_curterm\fR routine sets the variable \fBcur_term\fR to -+The \fBset_curterm\fR routine sets \fBcur_term\fR to - \fInterm\fR, and makes all of the \fBterminfo\fR boolean, numeric, and --string variables use the values from \fInterm\fR. It returns the old value --of \fBcur_term\fR. -+string variables use the values from \fInterm\fR. -+It returns the old value of \fBcur_term\fR. - .PP - The \fBdel_curterm\fR routine frees the space pointed to by - \fIoterm\fR and makes it available for further use. If \fIoterm\fR is -@@ -189,11 +229,14 @@ - .PP - The \fBrestartterm\fR routine is similar to \fBsetupterm\fR and \fBinitscr\fR, - except that it is called after restoring memory to a previous state (for --example, when reloading a game saved as a core image dump). It assumes that --the windows and the input and output options are the same as when memory was --saved, but the terminal type and baud rate may be different. Accordingly, --it saves various tty state bits, calls \fBsetupterm\fP, --and then restores the bits. -+example, when reloading a game saved as a core image dump). -+\fBrestartterm\fP assumes that the windows and the input and output options -+are the same as when memory was saved, -+but the terminal type and baud rate may be different. -+Accordingly, \fBrestartterm\fP saves various tty state bits, -+calls \fBsetupterm\fP, and then restores the bits. -+.\" *************************************************************************** -+.SS Formatting Output - .PP - The \fBtparm\fR routine instantiates the string \fIstr\fR with - parameters \fIpi\fR. A pointer is returned to the result of \fIstr\fR -@@ -202,6 +245,8 @@ - \fBtiparm\fP is a newer form of \fBtparm\fP which uses \fI<stdarg.h>\fP - rather than a fixed-parameter list. - Its numeric parameters are integers (int) rather than longs. -+.\" *************************************************************************** -+.SS Output Functions - .PP - The \fBtputs\fR routine applies padding information to the string - \fIstr\fR and outputs it. The \fIstr\fR must be a terminfo string -@@ -235,26 +280,48 @@ - .PP - The \fBmvcur\fR routine provides low-level cursor motion. It takes - effect immediately (rather than at the next refresh). -+.\" *************************************************************************** -+.SS Terminal Capability Functions - .PP - The \fBtigetflag\fR, \fBtigetnum\fR and \fBtigetstr\fR routines return - the value of the capability corresponding to the \fBterminfo\fR - \fIcapname\fR passed to them, such as \fBxenl\fR. -+The \fIcapname\fR for each capability is given in the table column entitled -+\fIcapname\fR code in the capabilities section of \fBterminfo\fR(\*n). - .PP --The \fBtigetflag\fR routine returns the value \fB\-1\fR if --\fIcapname\fR is not a boolean capability, --or \fB0\fR if it is canceled or absent from the terminal description. --.PP --The \fBtigetnum\fR routine returns the value \fB\-2\fR if --\fIcapname\fR is not a numeric capability, --or \fB\-1\fR if it is canceled or absent from the terminal description. -+These routines return special values to denote errors. - .PP --The \fBtigetstr\fR routine returns the value \fB(char *)\-1\fR -+The \fBtigetflag\fR routine returns -+.TP -+\fB\-1\fR -+if \fIcapname\fR is not a boolean capability, -+or -+.TP -+\fB0\fR -+if it is canceled or absent from the terminal description. -+.PP -+The \fBtigetnum\fR routine returns -+.TP -+\fB\-2\fR -+if \fIcapname\fR is not a numeric capability, or -+.TP -+\fB\-1\fR -+if it is canceled or absent from the terminal description. -+.PP -+The \fBtigetstr\fR routine returns -+.TP -+\fB(char *)\-1\fR - if \fIcapname\fR is not a string capability, --or \fB0\fR if it is canceled or absent from the terminal description. --.PP --The \fIcapname\fR for each capability is given in the table column entitled --\fIcapname\fR code in the capabilities section of \fBterminfo\fR(\*n). --.sp -+or -+.TP -+\fB0\fR -+if it is canceled or absent from the terminal description. -+.\" *************************************************************************** -+.SS Terminal Capability Names -+These null-terminated arrays contain -+the short terminfo names ("codes"), -+the \fBtermcap\fR names, and the long terminfo names ("fnames") -+for each of the predefined \fBterminfo\fR variables: - .RS - \fBchar *boolnames[]\fR, \fB*boolcodes[]\fR, \fB*boolfnames[]\fR - .sp -@@ -262,10 +329,6 @@ - .sp - \fBchar *strnames[]\fR, \fB*strcodes[]\fR, \fB*strfnames[]\fR - .RE --.PP --These null-terminated arrays contain the \fIcapnames\fR, the --\fBtermcap\fR codes, and the full C names, for each of the --\fBterminfo\fR variables. - .SH RETURN VALUE - Routines that return an integer return \fBERR\fR upon failure and \fBOK\fR - (SVr4 only specifies "an integer value other than \fBERR\fR") upon successful -@@ -275,7 +338,7 @@ - .PP - X/Open defines no error conditions. - In this implementation --.RS -+.RS 5 - .TP 5 - \fBdel_curterm\fP - returns an error -@@ -300,19 +363,41 @@ - X/Open states that \fBtputs\fP ignores the return value - of the output function \fIputc\fP. - .RE --.SH NOTES --The \fBsetupterm\fR routine should be used in place of \fBsetterm\fR. --It may be useful when you want to test for terminal capabilities without --committing to the allocation of storage involved in \fBinitscr\fR. --.PP --Note that \fBvidattr\fR and \fBvidputs\fR may be macros. - .SH PORTABILITY -+X/Open notes that \fBvidattr\fR and \fBvidputs\fR may be macros. -+.PP - The function \fBsetterm\fR is not described by X/Open and must --be considered non-portable. All other functions are as described by X/Open. -+be considered non-portable. -+All other functions are as described by X/Open. - .PP - \fBsetupterm\fP copies the terminal name to the array \fBttytype\fP. - This is not part of X/Open Curses, but is assumed by some applications. - .PP -+If configured to use the terminal-driver, -+e.g., for the MinGW port, -+.bP -+\fBsetupterm\fP interprets a missing/empty TERM variable as the -+special value \*(``unknown\*(''. -+.bP -+\fBsetupterm\fP allows explicit use of the -+the windows console driver by checking if $TERM is set to -+\*(``#win32con\*('' or an abbreviation of that string. -+.PP -+Older versions of \fBncurses\fP assumed that the file descriptor passed to -+\fBsetupterm\fP from \fBinitscr\fP or \fBnewterm\fP uses buffered I/O, -+and would write to the corresponding stream. -+In addition to the limitation that the terminal was left in block-buffered -+mode on exit (like SystemV curses), -+it was problematic because \fBncurses\fP -+did not allow a reliable way to cleanup on receiving SIGTSTP. -+The current version uses output buffers managed directly by \fBncurses\fP. -+Some of the low-level functions described in this manual page write -+to the standard output. -+They are not signal-safe. -+The high-level functions in \fBncurses\fP use -+alternate versions of these functions -+using the more reliable buffering scheme. -+.PP - In System V Release 4, \fBset_curterm\fR has an \fBint\fR return type and - returns \fBOK\fR or \fBERR\fR. We have chosen to implement the X/Open Curses - semantics. -@@ -332,12 +417,12 @@ - zeroes are fine for this purpose. - .PP - In response to comments by Thomas E. Dickey, --X/Open Curses Issue 7 proposed the \fBtiparam\fP function in mid-2009. -+X/Open Curses Issue 7 proposed the \fBtiparm\fP function in mid-2009. - .PP - X/Open notes that after calling \fBmvcur\fR, the curses state may not match the - actual terminal state, and that an application should touch and refresh - the window before resuming normal curses calls. --Both ncurses and System V Release 4 curses implement \fBmvcur\fR using -+Both \fBncurses\fP and System V Release 4 curses implement \fBmvcur\fR using - the SCREEN data allocated in either \fBinitscr\fR or \fBnewterm\fR. - So though it is documented as a terminfo function, - \fBmvcur\fR is really a curses function which is not well specified. -@@ -346,8 +431,12 @@ - This implementation allows the caller to use \-1's for the old ordinates. - In that case, the old location is unknown. - .PP --Extended terminal capability names, e.g., as defined by \fBtic\ \-x\fP, --are not stored in the arrays described in this section. -+Other implementions may not declare the capability name arrays. -+Some provide them without declaring them. -+X/Open does not specify them. -+.PP -+Extended terminal capability names, e.g., as defined by \fB@TIC@\ \-x\fP, -+are not stored in the arrays described here. - .SH SEE ALSO - \fBcurses\fR(3X), - \fBcurs_initscr\fR(3X), -diff -Naur ncurses-5.9/man/curs_threads.3x ncurses-5.9.patch/man/curs_threads.3x ---- ncurses-5.9/man/curs_threads.3x 2010-12-04 19:38:55.000000000 +0100 -+++ ncurses-5.9.patch/man/curs_threads.3x 2014-09-01 16:34:19.463887194 +0200 -@@ -1,5 +1,5 @@ - .\"*************************************************************************** --.\" Copyright (c) 2008,2010 Free Software Foundation, Inc. * -+.\" Copyright (c) 2008-2012,2014 Free Software Foundation, Inc. * - .\" * - .\" Permission is hereby granted, free of charge, to any person obtaining a * - .\" copy of this software and associated documentation files (the * -@@ -26,7 +26,7 @@ - .\" authorization. * - .\"*************************************************************************** - .\" --.\" $Id: curs_threads.3x,v 1.18 2010/12/04 18:38:55 tom Exp $ -+.\" $Id: curs_threads.3x,v 1.20 2014/03/15 19:25:28 tom Exp $ - .TH curs_threads 3X "" - .de bP - .IP \(bu 4 -@@ -51,9 +51,9 @@ - .br - \fBint set_tabsize(int size);\fR - .br --\fBint use_screen(SCREEN *scr, NCURSES_WINDOW_CB func, void *data);\fR -+\fBint use_screen(SCREEN *scr, NCURSES_SCREEN_CB func, void *data);\fR - .br --\fBint use_window(WINDOW *win, NCURSES_SCREEN_CB func, void *data);\fR -+\fBint use_window(WINDOW *win, NCURSES_WINDOW_CB func, void *data);\fR - .br - .SH DESCRIPTION - This implementation can be configured to provide rudimentary support -@@ -540,6 +540,7 @@ - wget_wstr/screen (input-operation) - wgetbkgrnd/window - wgetch/screen (input-operation) -+wgetdelay/window - wgetn_wstr/screen (input-operation) - wgetnstr/screen (input-operation) - wgetparent/window -diff -Naur ncurses-5.9/man/curs_util.3x ncurses-5.9.patch/man/curs_util.3x ---- ncurses-5.9/man/curs_util.3x 2010-12-04 19:38:55.000000000 +0100 -+++ ncurses-5.9.patch/man/curs_util.3x 2014-09-01 16:33:22.348792109 +0200 -@@ -1,5 +1,6 @@ -+'\" t - .\"*************************************************************************** --.\" Copyright (c) 1998-2008,2010 Free Software Foundation, Inc. * -+.\" Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. * - .\" * - .\" Permission is hereby granted, free of charge, to any person obtaining a * - .\" copy of this software and associated documentation files (the * -@@ -26,8 +27,12 @@ - .\" authorization. * - .\"*************************************************************************** - .\" --.\" $Id: curs_util.3x,v 1.32 2010/12/04 18:38:55 tom Exp $ -+.\" $Id: curs_util.3x,v 1.37 2013/07/20 19:43:45 tom Exp $ - .TH curs_util 3X "" -+.ie \n(.g .ds `` \(lq -+.el .ds `` `` -+.ie \n(.g .ds '' \(rq -+.el .ds '' '' - .de bP - .IP \(bu 4 - .. -@@ -44,6 +49,7 @@ - \fBputwin\fR, - \fBunctrl\fR, - \fBuse_env\fR, -+\fBuse_tioctl\fR, - \fBwunctrl\fR \- miscellaneous \fBcurses\fR utility routines - .ad - .hy -@@ -64,6 +70,8 @@ - .br - \fBvoid use_env(bool f);\fR - .br -+\fBvoid use_tioctl(bool f);\fR -+.br - \fBint putwin(WINDOW *win, FILE *filep);\fR - .br - \fBWINDOW *getwin(FILE *filep);\fR -@@ -80,10 +88,12 @@ - The corresponding \fBwunctrl\fR returns a printable representation of - a wide character. - .PP --The \fBkeyname\fR routine returns a character string corresponding to the key \fIc\fR: -+The \fBkeyname\fR routine returns a character string -+corresponding to the key \fIc\fR: - .RS 3 - .bP --Printable characters are displayed as themselves, e.g., a one-character string containing the key. -+Printable characters are displayed as themselves, -+e.g., a one-character string containing the key. - .bP - Control characters are displayed in the \fB^\fR\fIX\fR notation. - .bP -@@ -123,16 +133,70 @@ - The limitation arises because the \fBfilter\fP routine modifies the - in-memory copy of the terminal information. - .PP --The \fBuse_env\fR routine, if used, is called before \fBinitscr\fR or --\fBnewterm\fR are called. When called with \fBFALSE\fR as an --argument, the values of \fBlines\fR and \fBcolumns\fR specified in the --\fIterminfo\fR database will be used, even if environment variables --\fBLINES\fR and \fBCOLUMNS\fR (used by default) are set, or if --\fBcurses\fR is running in a window (in which case default behavior --would be to use the window size if \fBLINES\fR and \fBCOLUMNS\fR are --not set). --Note that setting \fBLINES\fR or \fBCOLUMNS\fR overrides the --corresponding size which may be obtained from the operating system. -+The \fBuse_env\fR routine, if used, -+should be called before \fBinitscr\fR or -+\fBnewterm\fR are called -+(because those compute the screen size). -+It modifies the way \fBncurses\fP treats environment variables -+when determining the screen size. -+.bP -+Normally ncurses looks first at the terminal database for the screen size. -+.IP -+If \fBuse_env\fP was called with \fBFALSE\fP for parameter, -+it stops here unless -+If \fBuse_tioctl\fP was also called with \fBTRUE\fP for parameter. -+.bP -+Then it asks for the screen size via operating system calls. -+If successful, -+it overrides the values from the terminal database. -+.bP -+Finally (unless \fBuse_env\fP was called with \fBFALSE\fP parameter), -+ncurses examines the \fBLINES\fR or \fBCOLUMNS\fR environment variables, -+using a value in those to override the results -+from the operating system or terminal database. -+.IP -+Ncurses also updates the screen size in response to SIGWINCH, -+unless overridden by the \fBLINES\fR or \fBCOLUMNS\fR environment variables, -+.PP -+The \fBuse_tioctl\fR routine, if used, -+should be called before \fBinitscr\fR or \fBnewterm\fR are called -+(because those compute the screen size). -+After \fBuse_tioctl\fR is called with \fBTRUE\fR as an argument, -+ncurses modifies the last step in its computation of screen size as follows: -+.bP -+checks if the \fBLINES\fR and \fBCOLUMNS\fR environment variables -+are set to a number greater than zero. -+.bP -+for each, ncurses updates the corresponding environment variable -+with the value that it has obtained via operating system call -+or from the terminal database. -+.bP -+ncurses re-fetches the value of the environment variables so that -+it is still the environment variables which set the screen size. -+.PP -+The \fBuse_env\fP and \fBuse_tioctl\fP routines combine as -+summarized here: -+.TS -+center tab(/); -+l l l -+_ _ _ -+lw7 lw7 lw40. -+\fIuse_env\fR/\fIuse_tioctl\fR/\fISummary\fR -+TRUE/FALSE/T{ -+This is the default behavior. -+ncurses uses operating system calls -+unless overridden by $LINES or $COLUMNS environment variables. -+T} -+TRUE/TRUE/T{ -+ncurses updates $LINES and $COLUMNS based on operating system calls. -+T} -+FALSE/TRUE/T{ -+ncurses ignores $LINES and $COLUMNS, uses operating system calls to obtain size. -+T} -+FALSE/FALSE/T{ -+ncurses relies on the terminal database to determine size. -+T} -+.TE - .PP - The \fBputwin\fR routine writes all data associated with window \fIwin\fR into - the file to which \fIfilep\fR points. This information can be later retrieved -@@ -145,7 +209,8 @@ - The \fBdelay_output\fR routine inserts an \fIms\fR millisecond pause - in output. This routine should not be used extensively because - padding characters are used rather than a CPU pause. --If no padding character is specified, this uses \fBnapms\fR to perform the delay. -+If no padding character is specified, -+this uses \fBnapms\fR to perform the delay. - .PP - The \fBflushinp\fR routine throws away any typeahead that has been typed by the - user and has not yet been read by the program. -@@ -183,12 +248,13 @@ - If \fBuse_legacy_coding\fP has been called with a \fB2\fP parameter, - \fBunctrl\fP returns the parameter, i.e., a one-character string with - the parameter as the first character. --Otherwise, it returns ``~@'', ``~A'', etc., analogous to ``^@'', ``^A'', C0 controls. -+Otherwise, it returns \*(``~@\*('', \*(``~A\*('', etc., -+analogous to \*(``^@\*('', \*(``^A\*('', C0 controls. - .IP - X/Open Curses does not document whether \fBunctrl\fP can be called before - initializing curses. - This implementation permits that, --and returns the ``~@'', etc., values in that case. -+and returns the \*(``~@\*('', etc., values in that case. - .bP - parameter values outside the 0 to 255 range. - \fBunctrl\fP returns a null pointer. -@@ -214,17 +280,17 @@ - Likewise, the \fBmeta\fP function allows the caller to change the - output of \fBkeyname\fP, i.e., - it determines whether to use the `M\-' prefix --for ``meta'' keys (codes in the range 128 to 255). -+for \*(``meta\*('' keys (codes in the range 128 to 255). - Both \fBuse_legacy_coding\fP and \fBmeta\fP succeed only after - curses is initialized. - X/Open Curses does not document the treatment of codes 128 to 159. --When treating them as ``meta'' keys -+When treating them as \*(``meta\*('' keys - (or if \fBkeyname\fP is called before initializing curses), --this implementation returns strings ``M\-^@'', ``M\-^A'', etc. -+this implementation returns strings \*(``M\-^@\*('', \*(``M\-^A\*('', etc. - .PP - The \fBkeyname\fP function may return the names of user-defined - string capabilities which are defined in the terminfo entry via the \fB\-x\fP --option of \fBtic\fP. -+option of \fB@TIC@\fP. - This implementation automatically assigns at run-time keycodes to - user-defined strings which begin with "k". - The keycodes start at KEY_MAX, but are not guaranteed to be -@@ -233,8 +299,8 @@ - The \fBuse_extended_names\fP function controls whether this data is - loaded when the terminal description is read by the library. - .PP --The \fBnofilter\fP routine is specific to ncurses. --It was not supported on Version 7, BSD or System V implementations. -+The \fBnofilter\fP and \fBuse_tioctl\fP routines are specific to ncurses. -+They were not supported on Version 7, BSD or System V implementations. - It is recommended that any code depending on ncurses extensions - be conditioned using NCURSES_VERSION. - .SH SEE ALSO -diff -Naur ncurses-5.9/man/curs_variables.3x ncurses-5.9.patch/man/curs_variables.3x ---- ncurses-5.9/man/curs_variables.3x 2010-12-04 19:38:55.000000000 +0100 -+++ ncurses-5.9.patch/man/curs_variables.3x 2014-09-01 16:33:22.348792109 +0200 -@@ -1,5 +1,5 @@ - .\"*************************************************************************** --.\" Copyright (c) 2010 Free Software Foundation, Inc. * -+.\" Copyright (c) 2010,2013 Free Software Foundation, Inc. * - .\" * - .\" Permission is hereby granted, free of charge, to any person obtaining a * - .\" copy of this software and associated documentation files (the * -@@ -26,7 +26,7 @@ - .\" authorization. * - .\"*************************************************************************** - .\" --.\" $Id: curs_variables.3x,v 1.4 2010/12/04 18:38:55 tom Exp $ -+.\" $Id: curs_variables.3x,v 1.6 2013/12/21 18:41:32 tom Exp $ - .TH curs_variables 3X "" - .de bP - .IP \(bu 4 -@@ -74,7 +74,7 @@ - A more complete description is given in the \fBcurses\fP(3X) manual page. - .PP - Depending on the configuration, these may be actual variables, --or macros (see \fBcurs_threads\fR(3X)) -+or macros (see \fBcurs_threads\fR(3X) and \fBcurs_opaque\fR(3X)) - which provide read-only access to \fIcurses\fP's state. - In either case, applications should treat them as read-only to avoid - confusing the library. -@@ -129,7 +129,8 @@ - not provided in most other implementations of curses. - .SH SEE ALSO - \fBcurses\fR(3X), -+\fBcurs_opaque\fR(3X), -+\fBcurs_terminfo\fR(3X), - \fBcurs_threads\fR(3X), - \fBterm_variables\fR(3X), --\fBterminfo\fR(3X), - \fBterminfo\fR(\*n). -diff -Naur ncurses-5.9/man/curs_window.3x ncurses-5.9.patch/man/curs_window.3x ---- ncurses-5.9/man/curs_window.3x 2010-12-04 19:38:55.000000000 +0100 -+++ ncurses-5.9.patch/man/curs_window.3x 2014-09-01 16:33:22.348792109 +0200 -@@ -1,5 +1,5 @@ - .\"*************************************************************************** --.\" Copyright (c) 1998-2006,2010 Free Software Foundation, Inc. * -+.\" Copyright (c) 1998-2010,2014 Free Software Foundation, Inc. * - .\" * - .\" Permission is hereby granted, free of charge, to any person obtaining a * - .\" copy of this software and associated documentation files (the * -@@ -26,7 +26,7 @@ - .\" authorization. * - .\"*************************************************************************** - .\" --.\" $Id: curs_window.3x,v 1.17 2010/12/04 18:38:55 tom Exp $ -+.\" $Id: curs_window.3x,v 1.18 2014/03/01 23:36:38 tom Exp $ - .TH curs_window 3X "" - .na - .hy 0 -@@ -47,17 +47,20 @@ - .SH SYNOPSIS - \fB#include <curses.h>\fR - .sp --\fBWINDOW *newwin(int nlines, int ncols, int begin_y,\fR -- \fBint begin_x);\fR -+\fBWINDOW *newwin(\fR -+ \fBint nlines, int ncols,\fR -+ \fBint begin_y, int begin_x);\fR - .br - \fBint delwin(WINDOW *win);\fR - .br - \fBint mvwin(WINDOW *win, int y, int x);\fR - .br --\fBWINDOW *subwin(WINDOW *orig, int nlines, int ncols,\fR -+\fBWINDOW *subwin(WINDOW *orig,\fR -+ \fBint nlines, int ncols,\fR - \fBint begin_y, int begin_x);\fR - .br --\fBWINDOW *derwin(WINDOW *orig, int nlines, int ncols,\fR -+\fBWINDOW *derwin(WINDOW *orig,\fR -+ \fBint nlines, int ncols,\fR - \fBint begin_y, int begin_x);\fR - .br - \fBint mvderwin(WINDOW *win, int par_y, int par_x);\fR -@@ -74,53 +77,70 @@ - .br - .SH DESCRIPTION - Calling \fBnewwin\fR creates and returns a pointer to a new window with the --given number of lines and columns. The upper left-hand corner of the window is --at line \fIbegin\fR_\fIy\fR, column \fIbegin\fR_\fIx\fR. If either --\fInlines\fR or \fIncols\fR is zero, they default to \fBLINES \-\fR --\fIbegin\fR_\fIy\fR and \fBCOLS \-\fR \fIbegin\fR_\fIx\fR. A new full-screen --window is created by calling \fBnewwin(0,0,0,0)\fR. -+given number of lines and columns. -+The upper left-hand corner of the window is -+at -+.RS -+line \fIbegin\fR_\fIy\fR, -+.br -+column \fIbegin\fR_\fIx\fR -+.RE -+.PP -+If either -+\fInlines\fR or \fIncols\fR is zero, they default to -+.RS -+\fBLINES \-\fR \fIbegin\fR_\fIy\fR and -+.br -+\fBCOLS \-\fR \fIbegin\fR_\fIx\fR. -+.RE -+.PP -+A new full-screen window is created by calling \fBnewwin(0,0,0,0)\fR. - .PP - Calling \fBdelwin\fR deletes the named window, freeing all memory - associated with it (it does not actually erase the window's screen --image). Subwindows must be deleted before the main window can be --deleted. -+image). -+Subwindows must be deleted before the main window can be deleted. - .PP - Calling \fBmvwin\fR moves the window so that the upper left-hand --corner is at position (\fIx\fR, \fIy\fR). If the move would cause the --window to be off the screen, it is an error and the window is not --moved. Moving subwindows is allowed, but should be avoided. -+corner is at position (\fIx\fR, \fIy\fR). -+If the move would cause the window to be off the screen, -+it is an error and the window is not moved. -+Moving subwindows is allowed, but should be avoided. - .PP - Calling \fBsubwin\fR creates and returns a pointer to a new window --with the given number of lines, \fInlines\fR, and columns, --\fIncols\fR. The window is at position (\fIbegin\fR_\fIy\fR, --\fIbegin\fR_\fIx\fR) on the screen. (This position is relative to the --screen, and not to the window \fIorig\fR.) The window is made in the --middle of the window \fIorig\fR, so that changes made to one window --will affect both windows. The subwindow shares memory with the window --\fIorig\fR. When using this routine, it is necessary to call -+with the given number of lines, \fInlines\fR, and columns, \fIncols\fR. -+The window is at position (\fIbegin\fR_\fIy\fR, -+\fIbegin\fR_\fIx\fR) on the screen. -+The subwindow shares memory with the window \fIorig\fR, -+so that changes made to one window -+will affect both windows. -+When using this routine, it is necessary to call - \fBtouchwin\fR or \fBtouchline\fR on \fIorig\fR before calling - \fBwrefresh\fR on the subwindow. - .PP - Calling \fBderwin\fR is the same as calling \fBsubwin,\fR except that - \fIbegin\fR_\fIy\fR and \fIbegin\fR_\fIx\fR are relative to the origin --of the window \fIorig\fR rather than the screen. There is no --difference between the subwindows and the derived windows. -+of the window \fIorig\fR rather than the screen. -+There is no difference between the subwindows and the derived windows. - .PP - Calling \fBmvderwin\fR moves a derived window (or subwindow) --inside its parent window. The screen-relative parameters of the --window are not changed. This routine is used to display different -+inside its parent window. -+The screen-relative parameters of the window are not changed. -+This routine is used to display different - parts of the parent window at the same physical position on the - screen. - .PP - Calling \fBdupwin\fR creates an exact duplicate of the window \fIwin\fR. - .PP - Calling \fBwsyncup\fR touches all locations in ancestors of \fIwin\fR that are --changed in \fIwin\fR. If \fBsyncok\fR is called with second argument -+changed in \fIwin\fR. -+If \fBsyncok\fR is called with second argument - \fBTRUE\fR then \fBwsyncup\fR is called automatically whenever there is a - change in the window. - .PP - The \fBwsyncdown\fR routine touches each location in \fIwin\fR that has been --touched in any of its ancestor windows. This routine is called by -+touched in any of its ancestor windows. -+This routine is called by - \fBwrefresh\fR, so it should almost never be necessary to call it manually. - .PP - The routine \fBwcursyncup\fR updates the current cursor position of all the -@@ -135,11 +155,18 @@ - .PP - X/Open defines no error conditions. - In this implementation --.RS - .TP 5 - \fBdelwin\fR - returns an error if the window pointer is null, or - if the window is the parent of another window. -+.TP 5 -+\fBderwin\fP -+returns an error if the parent window pointer is null, or -+if any of its ordinates or dimensions is negative, or -+if the resulting window does not fit inside the parent window. -+.TP 5 -+\fBdupwin\fP -+returns an error if the window pointer is null. - .IP - This implementation also maintains a list of windows, - and checks that the pointer passed to \fBdelwin\fP is one that -@@ -156,10 +183,23 @@ - if the window is really a pad, or - if some part of the window would be placed off-screen. - .TP 5 -+\fBnewwin\fP -+will fail if either of its beginning ordinates is negative, or -+if either the number of lines or columns is negative. -+.TP 5 - \fBsyncok\fP - returns an error - if the window pointer is null. --.RE -+.TP 5 -+\fBsubwin\fP -+returns an error if the parent window pointer is null, or -+if any of its ordinates or dimensions is negative, or -+if the resulting window does not fit inside the parent window. -+.PP -+The functions which return a window pointer -+may also fail if there is insufficient memory for its data structures. -+Any of these functions will fail if the screen has not been initialized, -+i.e., with \fBinitscr\fP or \fBnewterm\fP. - .SH NOTES - If many small changes are made to the window, the \fBwsyncup\fR option could - degrade performance. -@@ -171,11 +211,12 @@ - incompletely implemented, and not well tested. - .PP - The System V curses documentation is very unclear about what \fBwsyncup\fR --and \fBwsyncdown\fR actually do. It seems to imply that they are only -+and \fBwsyncdown\fR actually do. -+It seems to imply that they are only - supposed to touch exactly those lines that are affected by ancestor changes. - The language here, and the behavior of the \fBcurses\fR implementation, --is patterned on the XPG4 curses standard. The weaker XPG4 spec may result --in slower updates. -+is patterned on the XPG4 curses standard. -+The weaker XPG4 spec may result in slower updates. - .SH PORTABILITY - The XSI Curses standard, Issue 4 describes these functions. - .SH SEE ALSO -diff -Naur ncurses-5.9/man/form_field.3x ncurses-5.9.patch/man/form_field.3x ---- ncurses-5.9/man/form_field.3x 2010-12-04 19:40:45.000000000 +0100 -+++ ncurses-5.9.patch/man/form_field.3x 2014-09-01 16:33:22.348792109 +0200 -@@ -1,6 +1,6 @@ - '\" t - .\"*************************************************************************** --.\" Copyright (c) 1998-2006,2010 Free Software Foundation, Inc. * -+.\" Copyright (c) 1998-2010,2012 Free Software Foundation, Inc. * - .\" * - .\" Permission is hereby granted, free of charge, to any person obtaining a * - .\" copy of this software and associated documentation files (the * -@@ -27,7 +27,7 @@ - .\" authorization. * - .\"*************************************************************************** - .\" --.\" $Id: form_field.3x,v 1.10 2010/12/04 18:40:45 tom Exp $ -+.\" $Id: form_field.3x,v 1.11 2012/11/03 23:03:59 tom Exp $ - .TH form_field 3X "" - .SH NAME - \fBform_field\fR \- make and break connections between fields and forms -@@ -52,7 +52,7 @@ - .PP - The function \fBmove_field\fR moves the given field (which must be disconnected) - to a specified location on the screen. --.SH RETURN VALUES -+.SH RETURN VALUE - The function \fBform_fields\fR returns a pointer (which may be \fBNULL\fR). - It does not set errno. - .PP -diff -Naur ncurses-5.9/man/form_variables.3x ncurses-5.9.patch/man/form_variables.3x ---- ncurses-5.9/man/form_variables.3x 2010-12-04 19:38:55.000000000 +0100 -+++ ncurses-5.9.patch/man/form_variables.3x 2014-09-01 16:33:22.349792111 +0200 -@@ -1,5 +1,5 @@ - .\"*************************************************************************** --.\" Copyright (c) 2010 Free Software Foundation, Inc. * -+.\" Copyright (c) 2010,2013 Free Software Foundation, Inc. * - .\" * - .\" Permission is hereby granted, free of charge, to any person obtaining a * - .\" copy of this software and associated documentation files (the * -@@ -26,7 +26,7 @@ - .\" authorization. * - .\"*************************************************************************** - .\" --.\" $Id: form_variables.3x,v 1.3 2010/12/04 18:38:55 tom Exp $ -+.\" $Id: form_variables.3x,v 1.4 2013/06/22 17:58:32 tom Exp $ - .TH form_variables 3X "" - .ds n 5 - .na -@@ -45,7 +45,6 @@ - .SH SYNOPSIS - .nf - \fB#include <form.h>\fR --.br - .PP - \fBFIELDTYPE * TYPE_ALNUM;\fR - \fBFIELDTYPE * TYPE_ALPHA;\fR -@@ -54,7 +53,6 @@ - \fBFIELDTYPE * TYPE_IPV4;\fR - \fBFIELDTYPE * TYPE_NUMERIC;\fR - \fBFIELDTYPE * TYPE_REGEXP;\fR --.br - .fi - .SH DESCRIPTION - These are building blocks for the form library, -diff -Naur ncurses-5.9/man/infocmp.1m ncurses-5.9.patch/man/infocmp.1m ---- ncurses-5.9/man/infocmp.1m 2010-12-04 19:40:45.000000000 +0100 -+++ ncurses-5.9.patch/man/infocmp.1m 2014-09-01 16:33:22.349792111 +0200 -@@ -1,6 +1,6 @@ - '\" t - .\"*************************************************************************** --.\" Copyright (c) 1998-2006,2010 Free Software Foundation, Inc. * -+.\" Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. * - .\" * - .\" Permission is hereby granted, free of charge, to any person obtaining a * - .\" copy of this software and associated documentation files (the * -@@ -27,9 +27,12 @@ - .\" authorization. * - .\"*************************************************************************** - .\" --.\" $Id: infocmp.1m,v 1.46 2010/12/04 18:40:45 tom Exp $ -+.\" $Id: infocmp.1m,v 1.53 2013/02/02 22:07:35 tom Exp $ - .TH @INFOCMP@ 1M "" - .ds n 5 -+.de bP -+.IP \(bu 4 -+.. - .ds d @TERMINFO@ - .SH NAME - \fB@INFOCMP@\fR \- compare or print out \fIterminfo\fR descriptions -@@ -37,10 +40,12 @@ - \fB@INFOCMP@\fR [\fB\-\ - 1\ - C\ -+D\ - E\ - F\ - G\ - I\ -+K\ - L\ - T\ - U\ -@@ -69,32 +74,40 @@ - \fB@INFOCMP@\fR can be used to compare a binary \fBterminfo\fR entry with other - terminfo entries, rewrite a \fBterminfo\fR description to take advantage of the - \fBuse=\fR terminfo field, or print out a \fBterminfo\fR description from the --binary file (\fBterm\fR) in a variety of formats. In all cases, the boolean -+binary file (\fBterm\fR) in a variety of formats. -+In all cases, the boolean - fields will be printed first, followed by the numeric fields, followed by the - string fields. - .SS Default Options - If no options are specified and zero or one \fItermnames\fR are specified, the --\fB\-I\fR option will be assumed. If more than one \fItermname\fR is specified, -+\fB\-I\fR option will be assumed. -+If more than one \fItermname\fR is specified, - the \fB\-d\fR option will be assumed. - .SS Comparison Options [\-d] [\-c] [\-n] - \fB@INFOCMP@\fR compares the \fBterminfo\fR description of the first terminal - \fItermname\fR with each of the descriptions given by the entries for the other --terminal's \fItermnames\fR. If a capability is defined for only one of the -+terminal's \fItermnames\fR. -+If a capability is defined for only one of the - terminals, the value returned will depend on the type of the capability: - \fBF\fR for boolean variables, \fB\-1\fR for integer variables, and \fBNULL\fR - for string variables. - .PP - The \fB\-d\fR option produces a list of each capability that is different --between two entries. This option is useful to show the difference between two -+between two entries. -+This option is useful to show the difference between two - entries, created by different people, for the same or similar terminals. - .PP - The \fB\-c\fR option produces a list of each capability that is common between --two entries. Capabilities that are not set are ignored. This option can be -+two or more entries. -+Capabilities that are not set are ignored. -+This option can be - used as a quick check to see if the \fB\-u\fR option is worth using. - .PP --The \fB\-n\fR option produces a list of each capability that is in neither --entry. If no \fItermnames\fR are given, the environment variable \fBTERM\fR --will be used for both of the \fItermnames\fR. This can be used as a quick -+The \fB\-n\fR option produces a list of each capability that is in none of -+the given entries. -+If no \fItermnames\fR are given, the environment variable \fBTERM\fR -+will be used for both of the \fItermnames\fR. -+This can be used as a quick - check to see if anything was left out of a description. - .SS Source Listing Options [\-I] [\-L] [\-C] [\-r] - The \fB\-I\fR, \fB\-L\fR, and \fB\-C\fR options will produce a source listing for -@@ -107,6 +120,7 @@ - \fB\-L\fR/use the long C variable name listed in <\fBterm.h\fR> - \fB\-C\fR/use the \fBtermcap\fR names - \fB\-r\fR/when using \fB\-C\fR, put out all capabilities in \fBtermcap\fR form -+\fB\-K\fR/modifies the \fB\-C\fP option, improving BSD-compatibility. - .TE - .PP - If no \fItermnames\fR are given, the environment variable \fBTERM\fR will be -@@ -114,26 +128,48 @@ - .PP - The source produced by the \fB\-C\fR option may be used directly as a - \fBtermcap\fR entry, but not all parameterized strings can be changed to --the \fBtermcap\fR format. \fB@INFOCMP@\fR will attempt to convert most of the -+the \fBtermcap\fR format. -+\fB@INFOCMP@\fR will attempt to convert most of the - parameterized information, and anything not converted will be plainly marked in --the output and commented out. These should be edited by hand. -+the output and commented out. -+These should be edited by hand. -+.PP -+For best results when converting to \fBtermcap\fP format, -+you should use both \fB\-C\fP and \fB\-r\fP. -+Normally a termcap description is limited to 1023 bytes. -+@INFOCMP@ trims away less essential parts to make it fit. -+If you are converting to one of the (rare) termcap implementations -+which accept an unlimited size of termcap, -+you may want to add the \fB\-T\fP option. -+More often however, you must help the termcap implementation, -+and trim excess whitespace (use the \fB\-0\fP option for that). - .PP - All padding information for strings will be collected together and placed --at the beginning of the string where \fBtermcap\fR expects it. Mandatory -+at the beginning of the string where \fBtermcap\fR expects it. -+Mandatory - padding (padding information with a trailing '/') will become optional. - .PP - All \fBtermcap\fR variables no longer supported by \fBterminfo\fR, but which --are derivable from other \fBterminfo\fR variables, will be output. Not all -+are derivable from other \fBterminfo\fR variables, will be output. -+Not all - \fBterminfo\fR capabilities will be translated; only those variables which were --part of \fBtermcap\fR will normally be output. Specifying the \fB\-r\fR option -+part of \fBtermcap\fR will normally be output. -+Specifying the \fB\-r\fR option - will take off this restriction, allowing all capabilities to be output in - \fItermcap\fR form. -+Normally you would use both the \fB\-C\fP and \fB\-r\fP options. -+The actual format used incorporates some improvements for escaped characters -+from terminfo format. -+For a stricter BSD-compatible translation, use the \fB\-K\fR option -+rather than \fB\-C\fP. - .PP - Note that because padding is collected to the beginning of the capability, not --all capabilities are output. Mandatory padding is not supported. Because -+all capabilities are output. -+Mandatory padding is not supported. -+Because - \fBtermcap\fR strings are not as flexible, it is not always possible to convert --a \fBterminfo\fR string capability into an equivalent \fBtermcap\fR format. A --subsequent conversion of the \fBtermcap\fR file back into \fBterminfo\fR format -+a \fBterminfo\fR string capability into an equivalent \fBtermcap\fR format. -+A subsequent conversion of the \fBtermcap\fR file back into \fBterminfo\fR format - will not necessarily reproduce the original \fBterminfo\fR - source. - .PP -@@ -156,27 +192,33 @@ - .SS Use= Option [\-u] - The \fB\-u\fR option produces a \fBterminfo\fR source description of the first - terminal \fItermname\fR which is relative to the sum of the descriptions given --by the entries for the other terminals \fItermnames\fR. It does this by -+by the entries for the other terminals \fItermnames\fR. -+It does this by - analyzing the differences between the first \fItermname\fR and the other - \fItermnames\fR and producing a description with \fBuse=\fR fields for the --other terminals. In this manner, it is possible to retrofit generic terminfo --entries into a terminal's description. Or, if two similar terminals exist, but -+other terminals. -+In this manner, it is possible to retrofit generic terminfo -+entries into a terminal's description. -+Or, if two similar terminals exist, but - were coded at different times or by different people so that each description - is a full description, using \fB@INFOCMP@\fR will show what can be done to change - one description to be relative to the other. - .PP - A capability will get printed with an at-sign (@) if it no longer exists in the - first \fItermname\fR, but one of the other \fItermname\fR entries contains a --value for it. A capability's value gets printed if the value in the first -+value for it. -+A capability's value gets printed if the value in the first - \fItermname\fR is not found in any of the other \fItermname\fR entries, or if - the first of the other \fItermname\fR entries that has this capability gives a - different value for the capability than that in the first \fItermname\fR. - .PP --The order of the other \fItermname\fR entries is significant. Since the --terminfo compiler \fBtic\fR does a left-to-right scan of the capabilities, -+The order of the other \fItermname\fR entries is significant. -+Since the -+terminfo compiler \fB@TIC@\fR does a left-to-right scan of the capabilities, - specifying two \fBuse=\fR entries that contain differing entries for the same - capabilities will produce different results depending on the order that the --entries are given in. \fB@INFOCMP@\fR will flag any such inconsistencies between -+entries are given in. -+\fB@INFOCMP@\fR will flag any such inconsistencies between - the other \fItermname\fR entries as they are found. - .PP - Alternatively, specifying a capability \fIafter\fR a \fBuse=\fR entry that -@@ -187,29 +229,48 @@ - .PP - Another error that does not cause incorrect compiled files, but will slow down - the compilation time, is specifying extra \fBuse=\fR fields that are --superfluous. \fB@INFOCMP@\fR will flag any other \fItermname use=\fR fields that -+superfluous. -+\fB@INFOCMP@\fR will flag any other \fItermname use=\fR fields that - were not needed. - .SS Changing Databases [\-A \fIdirectory\fR] [\-B \fIdirectory\fR] --The location of the compiled \fBterminfo\fR database is taken from the --environment variable \fBTERMINFO\fR . If the variable is not defined, or the --terminal is not found in that location, the system \fBterminfo\fR database, --in \fB@TERMINFO@\fR, will be used. The options \fB\-A\fR --and \fB\-B\fR may be used to override this location. The \fB\-A\fR option will --set \fBTERMINFO\fR for the first \fItermname\fR and the \fB\-B\fR option will --set \fBTERMINFO\fR for the other \fItermnames\fR. With this, it is possible to -+Like other \fBncurses\fP utilities, -+@INFOCMP@ looks for the terminal descriptions in several places. -+You can use the \fBTERMINFO\fP and \fBTERMINFO_DIRS\fP environment variables -+to override the compiled-in default list of places to search -+(see \fBcurses\fP(3X) for details). -+.PP -+You can also use the options \fB\-A\fR -+and \fB\-B\fR to override the list of places to search -+when comparing terminal descriptions: -+.bP -+The \fB\-A\fR option sets the location for the first \fItermname\fR -+.bP -+The \fB\-B\fR option sets the location for the other \fItermnames\fR. -+.PP -+Using these options, it is possible to - compare descriptions for a terminal with the same name located in two different --databases. This is useful for comparing descriptions for the same terminal -+databases. -+For instance, -+you can use this feature for comparing descriptions for the same terminal - created by different people. - .SS Other Options - .TP 5 -+\fB\-0\fR -+causes the fields to be printed on one line, without wrapping. -+.TP 5 - \fB\-1\fR --causes the fields to be printed out one to a line. Otherwise, -+causes the fields to be printed out one to a line. -+Otherwise, - the fields will be printed several to a line to a maximum width - of 60 characters. - .TP - \fB\-a\fR - tells \fB@INFOCMP@\fP to retain commented-out capabilities rather than discarding --them. Capabilities are commented by prefixing them with a period. -+them. -+Capabilities are commented by prefixing them with a period. -+.TP -+\fB\-D\fR -+tells \fB@INFOCMP@\fP to print the database locations that it knows about, and exit. - .TP 5 - \fB\-E\fR - Dump the capabilities of the given terminal as tables, needed in -@@ -231,12 +292,15 @@ - for a given terminal type. - .TP 5 - \fB\-F\fR --compare terminfo files. This assumes that two following arguments are --filenames. The files are searched for pairwise matches between -+compare terminfo files. -+This assumes that two following arguments are filenames. -+The files are searched for pairwise matches between - entries, with two entries considered to match if any of their names do. - The report printed to standard output lists entries with no matches in --the other file, and entries with more than one match. For entries --with exactly one match it includes a difference report. Normally, -+the other file, and entries with more than one match. -+For entries -+with exactly one match it includes a difference report. -+Normally, - to reduce the volume of the report, use references are - not resolved before looking for differences, but resolution can be forced - by also specifying \fB\-r\fR. -@@ -255,14 +319,17 @@ - .TP 5 - \fB\-i\fR - Analyze the initialization (\fBis1\fR, \fBis2\fR, \fBis3\fR), and reset --(\fBrs1\fR, \fBrs2\fR, \fBrs3\fR), strings in the entry. For each string, the -+(\fBrs1\fR, \fBrs2\fR, \fBrs3\fR), strings in the entry. -+For each string, the - code tries to analyze it into actions in terms of the other capabilities in the - entry, certain X3.64/ISO 6429/ECMA\-48 capabilities, and certain DEC VT-series - private modes (the set of recognized special sequences has been selected for --completeness over the existing terminfo database). Each report line consists -+completeness over the existing terminfo database). -+Each report line consists - of the capability name, followed by a colon and space, followed by a printable - expansion of the capability string with sections matching recognized actions --translated into {}-bracketed descriptions. Here is a list of the DEC/ANSI -+translated into {}-bracketed descriptions. -+Here is a list of the DEC/ANSI - special sequences recognized: - i. - .TS -@@ -308,7 +375,8 @@ - .sp - It also recognizes a SGR action corresponding to ANSI/ISO 6429/ECMA Set - Graphics Rendition, with the values NORMAL, BOLD, UNDERLINE, BLINK, and --REVERSE. All but NORMAL may be prefixed with `+' (turn on) or `\-' (turn off). -+REVERSE. -+All but NORMAL may be prefixed with `+' (turn on) or `\-' (turn off). - .PP - An SGR0 designates an empty highlight sequence (equivalent to {SGR:NORMAL}). - .TP 5 -@@ -323,12 +391,15 @@ - "\-" for absent capabilities, "@" for canceled rather than "NULL". - .TP 5 - \fB\-R\fR\fIsubset\fR --Restrict output to a given subset. This option is for use with archaic -+Restrict output to a given subset. -+This option is for use with archaic - versions of terminfo like those on SVr1, Ultrix, or HP/UX that do not support - the full set of SVR4/XSI Curses terminfo; and variants such as AIX --that have their own extensions incompatible with SVr4/XSI. Available terminfo -+that have their own extensions incompatible with SVr4/XSI. -+Available terminfo - subsets are "SVr1", "Ultrix", "HP", and "AIX"; see \fBterminfo\fR(\*n) for --details. You can also choose the subset "BSD" which selects only capabilities -+details. -+You can also choose the subset "BSD" which selects only capabilities - with termcap equivalents recognized by 4.4BSD. - .TP - \fB\-s \fR\fI[d|i|l|c]\fR -@@ -362,7 +433,7 @@ - descriptions are limited (e.g., 1023 for termcap, 4096 for terminfo). - .TP - \fB\-t\fR --tells \fBtic\fP to discard commented-out capabilities. -+tells \fB@TIC@\fP to discard commented-out capabilities. - Normally when translating from terminfo to termcap, - untranslatable capabilities are commented-out. - .TP 5 -@@ -385,13 +456,15 @@ - \fB\-x\fR - print information for user-defined capabilities. - These are extensions to the terminfo repertoire which can be loaded --using the \fB\-x\fR option of \fBtic\fP. -+using the \fB\-x\fR option of \fB@TIC@\fP. - .SH FILES - .TP 20 - \*d - Compiled terminal description database. - .SH EXTENSIONS - The -+\fB\-0\fR, -+\fB\-1\fR, - \fB\-E\fR, - \fB\-F\fR, - \fB\-G\fR, -@@ -410,7 +483,8 @@ - options are not supported in SVr4 curses. - .PP - The \fB\-r\fR option's notion of `termcap' capabilities is System V Release 4's. --Actual BSD curses versions will have a more restricted set. To see only the -+Actual BSD curses versions will have a more restricted set. -+To see only the - 4.4BSD set, use \fB\-r\fR \fB\-RBSD\fR. - .SH BUGS - The \fB\-F\fR option of \fB@INFOCMP@\fR(1M) should be a \fB@TOE@\fR(1M) mode. -@@ -421,6 +495,8 @@ - \fB@TOE@\fR(1M), - \fBcurses\fR(3X), - \fBterminfo\fR(\*n). -+.sp -+http://invisible-island.net/ncurses/tctest.html - .PP - This describes \fBncurses\fR - version @NCURSES_MAJOR@.@NCURSES_MINOR@ (patch @NCURSES_PATCH@). -diff -Naur ncurses-5.9/man/Makefile.in ncurses-5.9.patch/man/Makefile.in ---- ncurses-5.9/man/Makefile.in 2010-11-27 22:45:27.000000000 +0100 -+++ ncurses-5.9.patch/man/Makefile.in 2014-09-01 16:33:22.344792103 +0200 -@@ -1,6 +1,6 @@ --# $Id: Makefile.in,v 1.45 2010/11/27 21:45:27 tom Exp $ -+# $Id: Makefile.in,v 1.47 2013/08/04 20:23:20 tom Exp $ - ############################################################################## --# Copyright (c) 1998-2007,2010 Free Software Foundation, Inc. # -+# Copyright (c) 1998-2010,2013 Free Software Foundation, Inc. # - # # - # Permission is hereby granted, free of charge, to any person obtaining a # - # copy of this software and associated documentation files (the "Software"), # -@@ -41,8 +41,12 @@ - srcdir = @srcdir@ - prefix = @prefix@ - exec_prefix = @exec_prefix@ -+datarootdir = @datarootdir@ - datadir = @datadir@ - mandir = @mandir@ -+includesubdir = @includesubdir@ -+ -+INCLUDEDIR = $(DESTDIR)$(includedir)$(includesubdir) - - INSTALL = @INSTALL@ - INSTALL_DATA = @INSTALL_DATA@ -diff -Naur ncurses-5.9/man/manhtml.aliases ncurses-5.9.patch/man/manhtml.aliases ---- ncurses-5.9/man/manhtml.aliases 1970-01-01 01:00:00.000000000 +0100 -+++ ncurses-5.9.patch/man/manhtml.aliases 2014-09-01 16:33:22.349792111 +0200 -@@ -0,0 +1,16 @@ -+# $Id: manhtml.aliases,v 1.1 2013/12/21 21:44:52 tom Exp $ -+# Items in this list will be linked to the corresponding manpages by man2html -+addch(3X) curs_addch(3X) -+delscreen(3X) curs_initscr(3X) -+filter(3X) curs_util(3X) -+form_fieldtype(3X) form_fieldtype(3X) -+getch(3X) curs_getch(3X) -+infocmp(1) infocmp(1M) -+initscr(3X) curs_initscr(3X) -+newterm(3X) curs_initscr(3X) -+set_fieldtype(3X) form_fieldtype(3X) -+set_term(3X) curs_initscr(3X) -+setupterm(3X) curs_terminfo(3X) -+tic(1) tic(1M) -+use_env(3X) curs_util(3X) -+vidputs(3X) curs_terminfo(3X) -diff -Naur ncurses-5.9/man/manhtml.externs ncurses-5.9.patch/man/manhtml.externs ---- ncurses-5.9/man/manhtml.externs 1970-01-01 01:00:00.000000000 +0100 -+++ ncurses-5.9.patch/man/manhtml.externs 2014-09-01 16:33:22.349792111 +0200 -@@ -0,0 +1,24 @@ -+# $Id: manhtml.externs,v 1.3 2013/12/21 22:11:29 tom Exp $ -+# Items in this list will not be linked by man2html -+conflict(1) -+csh(1) -+ded(1) -+environ(7) -+getty(1) -+nvi(1) -+printf(3) -+profile(5) -+putc(3) -+putwc(3) -+read(2) -+rogue(1) -+scanf(3) -+sh(1) -+sscanf(3) -+stdio(3) -+stty(1) -+system(3) -+termio(7) -+tty(4) -+ttys(5) -+wcwidth(3) -diff -Naur ncurses-5.9/man/menu_items.3x ncurses-5.9.patch/man/menu_items.3x ---- ncurses-5.9/man/menu_items.3x 2010-12-04 19:40:45.000000000 +0100 -+++ ncurses-5.9.patch/man/menu_items.3x 2014-09-01 16:33:22.349792111 +0200 -@@ -1,6 +1,6 @@ - '\" t - .\"*************************************************************************** --.\" Copyright (c) 1998-2006,2010 Free Software Foundation, Inc. * -+.\" Copyright (c) 1998-2010,2012 Free Software Foundation, Inc. * - .\" * - .\" Permission is hereby granted, free of charge, to any person obtaining a * - .\" copy of this software and associated documentation files (the * -@@ -27,7 +27,7 @@ - .\" authorization. * - .\"*************************************************************************** - .\" --.\" $Id: menu_items.3x,v 1.9 2010/12/04 18:40:45 tom Exp $ -+.\" $Id: menu_items.3x,v 1.10 2012/11/03 23:03:59 tom Exp $ - .TH menu_items 3X "" - .SH NAME - \fBmenu_items\fR \- make and break connections between items and menus -@@ -47,7 +47,7 @@ - The function \fBmenu_items\fR returns the item array of the given menu. - .PP - The function \fBitem_count\fR returns the count of items in \fImenu\fR. --.SH RETURN VALUES -+.SH RETURN VALUE - The function \fBmenu_items\fR returns a pointer (which may be \fBNULL\fR). - It does not set errno. - .PP -diff -Naur ncurses-5.9/man/ncurses.3x ncurses-5.9.patch/man/ncurses.3x ---- ncurses-5.9/man/ncurses.3x 2011-02-06 00:21:29.000000000 +0100 -+++ ncurses-5.9.patch/man/ncurses.3x 2014-09-01 16:34:19.463887194 +0200 -@@ -1,6 +1,6 @@ - '\" t - .\"*************************************************************************** --.\" Copyright (c) 1998-2010,2011 Free Software Foundation, Inc. * -+.\" Copyright (c) 1998-2013,2014 Free Software Foundation, Inc. * - .\" * - .\" Permission is hereby granted, free of charge, to any person obtaining a * - .\" copy of this software and associated documentation files (the * -@@ -27,9 +27,13 @@ - .\" authorization. * - .\"*************************************************************************** - .\" --.\" $Id: ncurses.3x,v 1.103 2011/02/05 23:21:29 tom Exp $ -+.\" $Id: ncurses.3x,v 1.116 2014/03/15 19:26:00 tom Exp $ - .hy 0 - .TH ncurses 3X "" -+.ie \n(.g .ds `` \(lq -+.el .ds `` `` -+.ie \n(.g .ds '' \(rq -+.el .ds '' '' - .de bP - .IP \(bu 4 - .. -@@ -43,7 +47,7 @@ - .SH DESCRIPTION - The \fBncurses\fR library routines give the user a terminal-independent method - of updating character screens with reasonable optimization. --This implementation is ``new curses'' (ncurses) and -+This implementation is \*(``new curses\*('' (ncurses) and - is the approved replacement for - 4.4BSD classic curses, which has been discontinued. - This describes \fBncurses\fR -@@ -55,8 +59,10 @@ - XSI stands for X/Open System Interfaces Extension. - The \fBncurses\fR library is freely redistributable in source form. - Differences from the SVr4 --curses are summarized under the \fBEXTENSIONS\fP and \fBPORTABILITY\fP sections below and --described in detail in the respective \fBEXTENSIONS\fP, \fBPORTABILITY\fP and \fBBUGS\fP sections -+curses are summarized under the -+\fBEXTENSIONS\fP and \fBPORTABILITY\fP sections below and -+described in detail in the respective -+\fBEXTENSIONS\fP, \fBPORTABILITY\fP and \fBBUGS\fP sections - of individual man pages. - .PP - The \fBncurses\fR library also provides many useful extensions, -@@ -108,9 +114,9 @@ - .sp - Before a \fBcurses\fR program is run, the tab stops of the terminal - should be set and its initialization strings, if defined, must be output. --This can be done by executing the \fBtput init\fR command -+This can be done by executing the \fB@TPUT@ init\fR command - after the shell environment variable \fBTERM\fR has been exported. --\fBtset(1)\fR is usually responsible for doing this. -+\fB@TSET@(1)\fR is usually responsible for doing this. - [See \fBterminfo\fR(\*n) for further details.] - .PP - The \fBncurses\fR library permits manipulation of data structures, -@@ -637,6 +643,7 @@ - use_env/\fBcurs_util\fR(3X) - use_extended_names/\fBcurs_extend\fR(3X)* - use_legacy_coding/\fBlegacy_coding\fR(3X)* -+use_tioctl/\fBcurs_util\fR(3X) - vid_attr/\fBcurs_terminfo\fR(3X) - vid_puts/\fBcurs_terminfo\fR(3X) - vidattr/\fBcurs_terminfo\fR(3X) -@@ -734,9 +741,16 @@ - integer value other than \fBERR\fR upon successful completion, unless - otherwise noted in the routine descriptions. - .PP -+As a general rule, routines check for null pointers passed as parameters, -+and handle this as an error. -+.PP - All macros return the value of the \fBw\fR version, except \fBsetscrreg\fR, - \fBwsetscrreg\fR, \fBgetyx\fR, \fBgetbegyx\fR, and \fBgetmaxyx\fR. --The return values of \fBsetscrreg\fR, \fBwsetscrreg\fR, \fBgetyx\fR, \fBgetbegyx\fR, and -+The return values of -+\fBsetscrreg\fR, -+\fBwsetscrreg\fR, -+\fBgetyx\fR, -+\fBgetbegyx\fR, and - \fBgetmaxyx\fR are undefined (i.e., these should not be used as the - right-hand side of assignment statements). - .PP -@@ -746,24 +760,24 @@ - runtime behavior of the \fBncurses\fR library. - The most important ones have been already discussed in detail. - .TP 5 --BAUDRATE --The debugging library checks this environment symbol when the application --has redirected output to a file. --The symbol's numeric value is used for the baudrate. --If no value is found, \fBncurses\fR uses 9600. --This allows testers to construct repeatable test-cases --that take into account costs that depend on baudrate. --.TP 5 - CC - When set, change occurrences of the command_character - (i.e., the \fBcmdch\fP capability) --of the loaded terminfo entries to the value of this symbol. -+of the loaded terminfo entries to the value of this variable. - Very few terminfo entries provide this feature. - .IP - Because this name is also used in development environments to represent - the C compiler's name, \fBncurses\fR ignores it if it does not happen to - be a single character. - .TP 5 -+BAUDRATE -+The debugging library checks this environment variable when the application -+has redirected output to a file. -+The variable's numeric value is used for the baudrate. -+If no value is found, \fBncurses\fR uses 9600. -+This allows testers to construct repeatable test-cases -+that take into account costs that depend on baudrate. -+.TP 5 - COLUMNS - Specify the width of the screen in characters. - Applications running in a windowing environment usually are able to -@@ -786,7 +800,9 @@ - a terminal description for terminals which are run as emulations. - .IP - Use the \fBuse_env\fR function to disable all use of external environment --(including system calls) to determine the screen size. -+(but not including system calls) to determine the screen size. -+Use the \fBuse_tioctl\fR function to update \fBCOLUMNS\fP or \fBLINES\fP -+to match the screen size obtained from system calls or the terminal database. - .TP 5 - ESCDELAY - Specifies the total time, in milliseconds, for which ncurses will -@@ -837,8 +853,8 @@ - .br - 3 = middle. - .sp --This symbol lets you customize the mouse. --The symbol must be three numeric digits 1\-3 in any order, e.g., 123 or 321. -+This variable lets you customize the mouse. -+The variable must be three numeric digits 1\-3 in any order, e.g., 123 or 321. - If it is not specified, \fBncurses\fR uses 132. - .TP 5 - NCURSES_ASSUMED_COLORS -@@ -852,6 +868,17 @@ - To make it green-on-black, set it to "2,0". - Any positive value from zero to the terminfo \fBmax_colors\fR value is allowed. - .TP 5 -+NCURSES_CONSOLE2 -+This applies only to the MinGW port of ncurses. -+.IP -+The \fBConsole2\fP program's handling of the Microsoft Console API call -+\fBCreateConsoleScreenBuffer\fP is defective. -+Applications which use this will hang. -+However, it is possible to simulate the action of this call by -+mapping coordinates, -+explicitly saving and restoring the original screen contents. -+Setting the environment variable \fBNCGDB\fP has the same effect. -+.TP 5 - NCURSES_GPM_TERMS - This applies only to ncurses configured to use the GPM interface. - .IP -@@ -899,19 +926,44 @@ - You may wish to use these descriptions, - but not want to pay the performance penalty. - .IP --Set the NCURSES_NO_PADDING symbol to disable all but mandatory -+Set the NCURSES_NO_PADDING environment variable to disable all but mandatory - padding. - Mandatory padding is used as a part of special control - sequences such as \fIflash\fR. - .TP 5 - NCURSES_NO_SETBUF --Normally \fBncurses\fR enables buffered output during terminal initialization. --This is done (as in SVr4 curses) for performance reasons. -+This setting is obsolete. -+Before changes -+.RS -+.bP -+started with 5.9 patch 20120825 -+and -+.bP -+continued -+though 5.9 patch 20130126 -+.RE -+.IP -+\fBncurses\fR enabled buffered output during terminal initialization. -+This was done (as in SVr4 curses) for performance reasons. - For testing purposes, both of \fBncurses\fR and certain applications, --this feature is made optional. -+this feature was made optional. - Setting the NCURSES_NO_SETBUF variable --disables output buffering, leaving the output in the original (usually -+disabled output buffering, leaving the output in the original (usually - line buffered) mode. -+.IP -+In the current implementation, -+ncurses performs its own buffering and does not require this workaround. -+It does not modify the buffering of the standard output. -+.IP -+The reason for the change was to make the behavior for interrupts and -+other signals more robust. -+One drawback is that certain nonconventional programs would mix -+ordinary stdio calls with ncurses calls and (usually) work. -+This is no longer possible since ncurses is not using -+the buffered standard output but its own output (to the same file descriptor). -+As a special case, the low-level calls such as \fBputp\fP still use the -+standard output. -+But high-level curses calls do not. - .TP 5 - NCURSES_NO_UTF8_ACS - During initialization, the \fBncurses\fR library -@@ -933,20 +985,22 @@ - .IP - As an alternative to the environment variable, - ncurses checks for an extended terminfo capability \fBU8\fP. --This is a numeric capability which can be compiled using \fBtic\ \-x\fP. -+This is a numeric capability which can be compiled using \fB@TIC@\ \-x\fP. - For example - .RS 5 -+.ft CW - .sp - .nf - # linux console, if patched to provide working - # VT100 shift-in/shift-out, with corresponding font. - linux-vt100|linux console with VT100 line-graphics, -- U8#0, use=linux, -+ U8#0, use=linux, - .sp - # uxterm with vt100Graphics resource set to false - xterm-utf8|xterm relying on UTF-8 line-graphics, -- U8#1, use=xterm, -+ U8#1, use=xterm, - .fi -+.ft - .RE - .IP - The name "U8" is chosen to be two characters, -@@ -955,7 +1009,7 @@ - .TP 5 - NCURSES_TRACE - During initialization, the \fBncurses\fR debugging library --checks the NCURSES_TRACE symbol. -+checks the NCURSES_TRACE environment variable. - If it is defined, to a numeric value, \fBncurses\fR calls the \fBtrace\fR - function, using that value as the argument. - .IP -@@ -973,9 +1027,10 @@ - support, \fBncurses\fR will check for a terminal's description in - termcap form if it is not available in the terminfo database. - .IP --The TERMCAP symbol contains either a terminal description (with -+The TERMCAP environment variable contains either a terminal description (with - newlines stripped out), --or a file name telling where the information denoted by the TERM symbol exists. -+or a file name telling where the information denoted by -+the TERM environment variable exists. - In either case, setting it directs \fBncurses\fR to ignore - the usual place for this information, e.g., /etc/termcap. - .TP 5 -@@ -988,33 +1043,51 @@ - .bP - the last directory to which \fBncurses\fR wrote, if any, is searched first - .bP --the directory specified by the TERMINFO symbol -+the directory specified by the TERMINFO environment variable - .bP - $HOME/.terminfo - .bP --directories listed in the TERMINFO_DIRS symbol -+directories listed in the TERMINFO_DIRS environment variable - .bP - one or more directories whose names are configured and compiled into the --ncurses library, e.g., --@TERMINFO@ -+ncurses library, i.e., -+.RS -+.bP -+@TERMINFO_DIRS@ (corresponding to the TERMINFO_DIRS variable) -+.bP -+@TERMINFO@ (corresponding to the TERMINFO variable) -+.RE - .RE - .TP 5 - TERMINFO_DIRS - Specifies a list of directories to search for terminal descriptions. - The list is separated by colons (i.e., ":") on Unix, semicolons on OS/2 EMX. --All of the terminal descriptions are in terminfo form, which makes --a subdirectory named for the first letter of the terminal names therein. -+.IP -+All of the terminal descriptions are in terminfo form. -+Normally these are stored in a directory tree, -+using subdirectories named by the first letter of the terminal names therein. -+.IP -+If \fBncurses\fP is built with a hashed database, -+then each entry in this list can also be the path of the corresponding -+database file. -+.IP -+If \fBncurses\fP is built with a support for reading termcap files -+directly, then an entry in this list may be the path of a termcap file. - .TP 5 - TERMPATH - If TERMCAP does not hold a file name then \fBncurses\fR checks --the TERMPATH symbol. --This is a list of filenames separated by spaces or colons (i.e., ":") on Unix, semicolons on OS/2 EMX. --If the TERMPATH symbol is not set, \fBncurses\fR looks in the files -+the TERMPATH environment variable. -+This is a list of filenames separated by spaces or colons (i.e., ":") on Unix, -+semicolons on OS/2 EMX. -+.IP -+If the TERMPATH environment variable is not set, -+\fBncurses\fR looks in the files - /etc/termcap, /usr/share/misc/termcap and $HOME/.termcap, in that order. - .PP - The library may be configured to disregard the following variables when the - current user is the superuser (root), or if the application uses setuid or - setgid permissions: -+.IP - $TERMINFO, $TERMINFO_DIRS, $TERMPATH, as well as $HOME. - .SH ALTERNATE CONFIGURATIONS - Several different configurations are possible, -@@ -1042,8 +1115,9 @@ - to build executables. - .TP 5 - \-\-enable\-widec --The configure script renames the library and (if the \fB\-\-disable\-overwrite\fP --option is used) puts the header files in a different subdirectory. -+The configure script renames the library and -+(if the \fB\-\-disable\-overwrite\fP option is used) -+puts the header files in a different subdirectory. - All of the library names have a "w" appended to them, - i.e., instead of - .RS -@@ -1068,6 +1142,16 @@ - to allow applications to be built using either library - from the same set of headers. - .TP 5 -+\-\-with\-pthread -+The configure script renames the library. -+All of the library names have a "t" appended to them -+(before any "w" added by \fB\-\-enable\-widec\fP). -+.IP -+The global variables such as \fBLINES\fP are replaced by macros to -+allow read-only access. -+At the same time, setter-functions are provided to set these values. -+Some applications (very few) may require changes to work with this convention. -+.TP 5 - \-\-with\-shared - .TP - \-\-with\-normal -@@ -1093,8 +1177,8 @@ - @TERMINFO@ - terminal capability database - .SH SEE ALSO --\fBterminfo\fR(\*n) and related pages whose names begin "curs_" for detailed routine --descriptions. -+\fBterminfo\fR(\*n) and related pages whose names begin -+"curs_" for detailed routine descriptions. - .br - \fBcurs_variables\fR(3X) - .SH EXTENSIONS -@@ -1144,6 +1228,15 @@ - the XSI Curses and \fBncurses\fR calls) are described in \fBPORTABILITY\fR - sections of the library man pages. - .PP -+Unlike other implementations, this one checks parameters such as pointers -+to WINDOW structures to ensure they are not null. -+The main reason for providing this behavior is to guard against programmer -+error. -+The standard interface does not provide a way for the library -+to tell an application which of several possible errors were detected. -+Relying on this (or some other) extension will adversely affect the -+portability of curses applications. -+.PP - This implementation also contains several extensions: - .bP - The routine \fBhas_key\fR is not part of XPG4, nor is it present in SVr4. -diff -Naur ncurses-5.9/man/resizeterm.3x ncurses-5.9.patch/man/resizeterm.3x ---- ncurses-5.9/man/resizeterm.3x 2010-12-04 19:38:55.000000000 +0100 -+++ ncurses-5.9.patch/man/resizeterm.3x 2014-09-01 16:33:22.350792113 +0200 -@@ -1,5 +1,5 @@ - .\"*************************************************************************** --.\" Copyright (c) 1998-2005,2010 Free Software Foundation, Inc. * -+.\" Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. * - .\" * - .\" Permission is hereby granted, free of charge, to any person obtaining a * - .\" copy of this software and associated documentation files (the * -@@ -26,9 +26,9 @@ - .\" authorization. * - .\"*************************************************************************** - .\" --.\" Author: Thomas E. Dickey 1996-2005 -+.\" Author: Thomas E. Dickey 1996-on - .\" --.\" $Id: resizeterm.3x,v 1.14 2010/12/04 18:38:55 tom Exp $ -+.\" $Id: resizeterm.3x,v 1.17 2013/06/22 20:41:54 tom Exp $ - .TH resizeterm 3X "" - .SH NAME - \fBis_term_resized\fR, -@@ -48,7 +48,8 @@ - primarily for use by programs running in an X Window terminal (e.g., xterm). - The function \fBresizeterm\fR resizes the standard and current windows - to the specified dimensions, and adjusts other bookkeeping data used by --the \fBncurses\fR library that record the window dimensions. -+the \fBncurses\fR library that record the window dimensions -+such as the \fBLINES\fP and \fBCOLS\fP variables. - .LP - Most of the work is done by the inner function \fBresize_term\fR. - The outer function \fBresizeterm\fR adds bookkeeping for the SIGWINCH handler. -@@ -64,7 +65,7 @@ - can check if the \fBresize_term\fR function would modify the window structures. - It returns TRUE if the windows would be modified, and FALSE otherwise. - .SH RETURN VALUE --Except as notes, these function return -+Except as noted, these functions return - the integer \fBERR\fR upon failure and \fBOK\fR on success. - They will fail if either of the dimensions are less than or equal to zero, - or if an error occurs while (re)allocating memory for the windows. -@@ -75,7 +76,7 @@ - since it uses those functions. - .PP - If ncurses is configured to supply its own SIGWINCH handler, --the \fBresizeterm\fR function ungetch's a \fBKEY_RESIZE\fR which -+the \fBresizeterm\fR function \fBungetch\fP's a \fBKEY_RESIZE\fR which - will be read on the next call to \fBgetch\fR. - This is used to alert an application that the screen size has changed, - and that it should repaint special features such as pads that cannot -@@ -86,9 +87,8 @@ - the operating system. - Thus, even if a SIGWINCH is received, - no screen size change may be recorded. --In that case, no \fBKEY_RESIZE\fP is queued for the next call to \fBgetch\fP; --an \fBERR\fP will be returned instead. - .SH SEE ALSO -+\fBcurs_getch\fR(3X), - \fBcurs_variables\fR(3X), - \fBwresize\fR(3X). - .SH AUTHOR -diff -Naur ncurses-5.9/man/tabs.1 ncurses-5.9.patch/man/tabs.1 ---- ncurses-5.9/man/tabs.1 2010-12-04 19:40:45.000000000 +0100 -+++ ncurses-5.9.patch/man/tabs.1 2014-09-01 16:33:22.350792113 +0200 -@@ -1,5 +1,5 @@ - .\"*************************************************************************** --.\" Copyright (c) 2008-2009,2010 Free Software Foundation, Inc. * -+.\" Copyright (c) 2008-2011,2013 Free Software Foundation, Inc. * - .\" * - .\" Permission is hereby granted, free of charge, to any person obtaining a * - .\" copy of this software and associated documentation files (the * -@@ -26,19 +26,18 @@ - .\" authorization. * - .\"*************************************************************************** - .\" --.\" $Id: tabs.1,v 1.8 2010/12/04 18:40:45 tom Exp $ -+.\" $Id: tabs.1,v 1.11 2013/06/22 18:11:57 tom Exp $ - .TH @TABS@ 1 "" - .ds n 5 - .SH NAME --\fBtabs\fR \- set tabs on a terminal -+\fB@TABS@\fR \- set tabs on a terminal - .SH SYNOPSIS --\fBtabs\fR [\fB\-v\fR[\fIn\fR]] [\fB\-ahuUV\fR] \fIfile...\fR --.br -+\fB@TABS@\fR [\fIoptions\fR]] \fI[tabstop-list]\fR - .SH DESCRIPTION - .PP --The \fBtabs\fP program clears and sets tab-stops on the terminal. -+The \fB@TABS@\fP program clears and sets tab-stops on the terminal. - This uses the terminfo \fIclear_all_tabs\fP and \fIset_tab\fP capabilities. --If either is absent, \fBtabs\fP is unable to clear/set tab-stops. -+If either is absent, \fB@TABS@\fP is unable to clear/set tab-stops. - The terminal should be configured to use hard tabs, e.g., - .sp - .RS -@@ -48,8 +47,8 @@ - .SS General Options - .TP 5 - .BI \-T "name" --Tell \fBtabs\fP which terminal type to use. --If this option is not given, \fBtabs\fP will use the \fB$TERM\fP -+Tell \fB@TABS@\fP which terminal type to use. -+If this option is not given, \fB@TABS@\fP will use the \fB$TERM\fP - environment variable. - If that is not set, it will use the \fIansi+tabs\fP entry. - .TP 5 -@@ -59,10 +58,13 @@ - The second data line shows the actual tab-stops, marked with asterisks. - .TP 5 - .B \-n --This option tells \fBtabs\fP to check the options and run any debugging -+This option tells \fB@TABS@\fP to check the options and run any debugging - option, but not to modify the terminal settings. -+.TP -+\fB\-V\fR -+reports the version of ncurses which was used in this program, and exits. - .PP --The \fBtabs\fP program processes a single list of tab stops. -+The \fB@TABS@\fP program processes a single list of tab stops. - The last option to be processed which defines a list is the one that - determines the list to be processed. - .SS Implicit Lists -diff -Naur ncurses-5.9/man/term.7 ncurses-5.9.patch/man/term.7 ---- ncurses-5.9/man/term.7 2010-12-04 19:41:07.000000000 +0100 -+++ ncurses-5.9.patch/man/term.7 2014-09-01 16:33:22.350792113 +0200 -@@ -1,5 +1,5 @@ - .\"*************************************************************************** --.\" Copyright (c) 1998-2007,2010 Free Software Foundation, Inc. * -+.\" Copyright (c) 1998-2010,2011 Free Software Foundation, Inc. * - .\" * - .\" Permission is hereby granted, free of charge, to any person obtaining a * - .\" copy of this software and associated documentation files (the * -@@ -26,7 +26,7 @@ - .\" authorization. * - .\"*************************************************************************** - .\" --.\" $Id: term.7,v 1.22 2010/12/04 18:41:07 tom Exp $ -+.\" $Id: term.7,v 1.23 2011/12/17 23:32:17 tom Exp $ - .TH term 7 - .ds n 5 - .ds d @TERMINFO@ -@@ -55,7 +55,7 @@ - are in fact using a VT100-superset console, terminal, or terminal emulator.) - .PP - In any case, you are free to override the system \fBTERM\fR setting to your --taste in your shell profile. The \fBtset\fP(1) utility may be of assistance; -+taste in your shell profile. The \fB@TSET@\fP(1) utility may be of assistance; - you can give it a set of rules for deducing or requesting a terminal type based - on the tty device and baud rate. - .PP -diff -Naur ncurses-5.9/man/terminfo.head ncurses-5.9.patch/man/terminfo.head ---- ncurses-5.9/man/terminfo.head 2010-07-31 18:08:48.000000000 +0200 -+++ ncurses-5.9.patch/man/terminfo.head 2014-09-01 16:33:22.350792113 +0200 -@@ -1,5 +1,5 @@ - .\"*************************************************************************** --.\" Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * -+.\" Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. * - .\" * - .\" Permission is hereby granted, free of charge, to any person obtaining a * - .\" copy of this software and associated documentation files (the * -@@ -26,10 +26,17 @@ - .\" authorization. * - .\"*************************************************************************** - .\" --.\" $Id: terminfo.head,v 1.18 2010/07/31 16:08:48 tom Exp $ -+.\" $Id: terminfo.head,v 1.21 2013/03/09 22:11:36 tom Exp $ - .TH terminfo 5 "" "" "File Formats" - .ds n 5 - .ds d @TERMINFO@ -+.ie \n(.g .ds `` \(lq -+.el .ds `` `` -+.ie \n(.g .ds '' \(rq -+.el .ds '' '' -+.de bP -+.IP \(bu 4 -+.. - .SH NAME - terminfo \- terminal capability data base - .SH SYNOPSIS -@@ -74,7 +81,7 @@ - Terminal names (except for the last, verbose entry) should - be chosen using the following conventions. - The particular piece of hardware making up the terminal should --have a root name, thus ``hp2621''. -+have a root name, thus \*(``hp2621\*(''. - This name should not contain hyphens. - Modes that the hardware can be in, or user preferences, should - be indicated by appending a hyphen and a mode suffix. -@@ -102,6 +109,6 @@ - .TE - .PP - For more on terminal naming conventions, see the \fBterm(7)\fR manual page. --.SS Capabilities -+.SS Predefined Capabilities - .\" Head of terminfo man page ends here - .ps -1 -diff -Naur ncurses-5.9/man/terminfo.tail ncurses-5.9.patch/man/terminfo.tail ---- ncurses-5.9/man/terminfo.tail 2010-12-04 19:38:55.000000000 +0100 -+++ ncurses-5.9.patch/man/terminfo.tail 2014-09-01 16:33:22.351792114 +0200 -@@ -1,8 +1,51 @@ --.\" $Id: terminfo.tail,v 1.53 2010/12/04 18:38:55 tom Exp $ -+.\" $Id: terminfo.tail,v 1.68 2013/11/09 15:20:48 tom Exp $ - .\" Beginning of terminfo.tail file - .\" This file is part of ncurses. - .\" See "terminfo.head" for copyright. - .ps +1 -+.SS User-Defined Capabilities -+. -+The preceding section listed the \fIpredefined\fP capabilities. -+They deal with some special features for terminals no longer -+(or possibly never) produced. -+Occasionally there are special features of newer terminals which -+are awkward or impossible to represent by reusing the predefined -+capabilities. -+.PP -+\fBncurses\fP addresses this limitation by allowing user-defined capabilities. -+The \fB@TIC@\fP and \fB@INFOCMP@\fP programs provide -+the \fB\-x\fP option for this purpose. -+When \fB\-x\fP is set, -+\fB@TIC@\fP treats unknown capabilities as user-defined. -+That is, if \fB@TIC@\fP encounters a capability name -+which it does not recognize, -+it infers its type (boolean, number or string) from the syntax -+and makes an extended table entry for that capability. -+The \fBuse_extended_names\fP function makes this information -+conditionally available to applications. -+The ncurses library provides the data leaving most of the behavior -+to applications: -+.bP -+User-defined capability strings whose name begins -+with \*(``k\*('' are treated as function keys. -+.bP -+The types (boolean, number, string) determined by \fB@TIC@\fP -+can be inferred by successful calls on \fBtigetflag\fP, etc. -+.bP -+If the capability name happens to be two characters, -+the capability is also available through the termcap interface. -+.PP -+While termcap is said to be extensible because it does not use a predefined set -+of capabilities, -+in practice it has been limited to the capabilities defined by -+terminfo implementations. -+As a rule, -+user-defined capabilities intended for use by termcap applications should -+be limited to booleans and numbers to avoid running past the 1023 byte -+limit assumed by termcap implementations and their applications. -+In particular, providing extended sets of function keys (past the 60 -+numbered keys and the handful of special named keys) is best done using -+the longer names available using terminfo. - . - .SS A Sample Entry - . -@@ -10,42 +53,54 @@ - of what a \fBterminfo\fR entry for a modern terminal typically looks like. - .PP - .nf --.in -2 --.ta .3i - .ft CW - \s-2ansi|ansi/pc-term compatible with color, -- mc5i, -- colors#8, ncv#3, pairs#64, -- cub=\\E[%p1%dD, cud=\\E[%p1%dB, cuf=\\E[%p1%dC, -- cuu=\\E[%p1%dA, dch=\\E[%p1%dP, dl=\\E[%p1%dM, -- ech=\\E[%p1%dX, el1=\\E[1K, hpa=\\E[%p1%dG, ht=\\E[I, -- ich=\\E[%p1%d@, il=\\E[%p1%dL, indn=\\E[%p1%dS, .indn=\\E[%p1%dT, -- kbs=^H, kcbt=\\E[Z, kcub1=\\E[D, kcud1=\\E[B, -- kcuf1=\\E[C, kcuu1=\\E[A, kf1=\\E[M, kf10=\\E[V, -- kf11=\\E[W, kf12=\\E[X, kf2=\\E[N, kf3=\\E[O, kf4=\\E[P, -- kf5=\\E[Q, kf6=\\E[R, kf7=\\E[S, kf8=\\E[T, kf9=\\E[U, -- kich1=\\E[L, mc4=\\E[4i, mc5=\\E[5i, nel=\\r\\E[S, -- op=\\E[37;40m, rep=%p1%c\\E[%p2%{1}%\-%db, -- rin=\\E[%p1%dT, s0ds=\\E(B, s1ds=\\E)B, s2ds=\\E*B, -- s3ds=\\E+B, setab=\\E[4%p1%dm, setaf=\\E[3%p1%dm, -- setb=\\E[4%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m, -- setf=\\E[3%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m, -- sgr=\\E[0;10%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;%?%p7%t;8%;%?%p8%t;11%;%?%p9%t;12%;m, -- sgr0=\\E[0;10m, tbc=\\E[2g, u6=\\E[%d;%dR, u7=\\E[6n, -- u8=\\E[?%[;0123456789]c, u9=\\E[c, vpa=\\E[%p1%dd,\s+2 --.in +2 -+ am, mc5i, mir, msgr, -+ colors#8, cols#80, it#8, lines#24, ncv#3, pairs#64, -+ acsc=+\\020\\,\\021-\\030.^Y0\\333`\\004a\\261f\\370g\\361h\\260 -+ j\\331k\\277l\\332m\\300n\\305o~p\\304q\\304r\\304s_t\\303 -+ u\\264v\\301w\\302x\\263y\\363z\\362{\\343|\\330}\\234~\\376, -+ bel=^G, blink=\\E[5m, bold=\\E[1m, cbt=\\E[Z, clear=\\E[H\\E[J, -+ cr=^M, cub=\\E[%p1%dD, cub1=\\E[D, cud=\\E[%p1%dB, cud1=\\E[B, -+ cuf=\\E[%p1%dC, cuf1=\\E[C, cup=\\E[%i%p1%d;%p2%dH, -+ cuu=\\E[%p1%dA, cuu1=\\E[A, dch=\\E[%p1%dP, dch1=\\E[P, -+ dl=\\E[%p1%dM, dl1=\\E[M, ech=\\E[%p1%dX, ed=\\E[J, el=\\E[K, -+ el1=\\E[1K, home=\\E[H, hpa=\\E[%i%p1%dG, ht=\\E[I, hts=\\EH, -+ ich=\\E[%p1%d@, il=\\E[%p1%dL, il1=\\E[L, ind=^J, -+ indn=\\E[%p1%dS, invis=\\E[8m, kbs=^H, kcbt=\\E[Z, kcub1=\\E[D, -+ kcud1=\\E[B, kcuf1=\\E[C, kcuu1=\\E[A, khome=\\E[H, kich1=\\E[L, -+ mc4=\\E[4i, mc5=\\E[5i, nel=\\r\\E[S, op=\\E[39;49m, -+ rep=%p1%c\\E[%p2%{1}%-%db, rev=\\E[7m, rin=\\E[%p1%dT, -+ rmacs=\\E[10m, rmpch=\\E[10m, rmso=\\E[m, rmul=\\E[m, -+ s0ds=\\E(B, s1ds=\\E)B, s2ds=\\E*B, s3ds=\\E+B, -+ setab=\\E[4%p1%dm, setaf=\\E[3%p1%dm, -+ sgr=\\E[0;10%?%p1%t;7%; -+ %?%p2%t;4%; -+ %?%p3%t;7%; -+ %?%p4%t;5%; -+ %?%p6%t;1%; -+ %?%p7%t;8%; -+ %?%p9%t;11%;m, -+ sgr0=\\E[0;10m, smacs=\\E[11m, smpch=\\E[11m, smso=\\E[7m, -+ smul=\\E[4m, tbc=\\E[3g, u6=\\E[%i%d;%dR, u7=\\E[6n, -+ u8=\\E[?%[;0123456789]c, u9=\\E[c, vpa=\\E[%i%p1%dd, - .fi - .ft R - .PP - Entries may continue onto multiple lines by placing white space at - the beginning of each line except the first. --Comments may be included on lines beginning with ``#''. -+Comments may be included on lines beginning with \*(``#\*(''. - Capabilities in - .I terminfo - are of three types: -+.bP - Boolean capabilities which indicate that the terminal has --some particular feature, numeric capabilities giving the size of the terminal --or the size of particular delays, and string -+some particular feature, -+.bP -+numeric capabilities giving the size of the terminal -+or the size of particular delays, and -+.bP -+string - capabilities, which give a sequence which can be used to perform particular - terminal operations. - .PP -@@ -58,15 +113,15 @@ - (i.e., an automatic return and line-feed - when the end of a line is reached) is indicated by the capability \fBam\fR. - Hence the description of ansi includes \fBam\fR. --Numeric capabilities are followed by the character `#' and then a positive value. -+Numeric capabilities are followed by the character \*(``#\*('' and then a positive value. - Thus \fBcols\fR, which indicates the number of columns the terminal has, --gives the value `80' for ansi. -+gives the value \*(``80\*('' for ansi. - Values for numeric capabilities may be specified in decimal, octal or hexadecimal, - using the C programming language conventions (e.g., 255, 0377 and 0xff or 0xFF). - .PP - Finally, string valued capabilities, such as \fBel\fR (clear to end of line --sequence) are given by the two-character code, an `=', and then a string --ending at the next following `,'. -+sequence) are given by the two-character code, an \*(``=\*('', and then a string -+ending at the next following \*(``,\*(''. - .PP - A number of escape sequences are provided in the string valued capabilities - for easy encoding of characters there. -@@ -75,14 +130,29 @@ - \fB^x\fR maps to a control-x for any appropriate x, and the sequences - \fB\en \el \er \et \eb \ef \es\fR give - a newline, line-feed, return, tab, backspace, form-feed, and space. --Other escapes include \fB\e^\fR for \fB^\fR, -+Other escapes include -+.bP -+\fB\e^\fR for \fB^\fR, -+.bP - \fB\e\e\fR for \fB\e\fR, -+.bP - \fB\e\fR, for comma, -+.bP - \fB\e:\fR for \fB:\fR, -+.bP - and \fB\e0\fR for null. --(\fB\e0\fR will produce \e200, which does not terminate a string but behaves -+.IP -+\fB\e0\fR will produce \e200, which does not terminate a string but behaves - as a null character on most terminals, providing CS7 is specified. --See stty(1).) -+See stty(1). -+.IP -+The reason for this quirk is to maintain binary compatibility of the -+compiled terminfo files with other implementations, -+e.g., the SVr4 systems, which document this. -+Compiled terminfo files use null-terminated strings, with no lengths. -+Modifying this would require a new binary format, -+which would not work with other implementations. -+.PP - Finally, characters may be given as three octal digits after a \fB\e\fR. - .PP - A delay in milliseconds may appear anywhere in a string capability, enclosed in -@@ -90,8 +160,8 @@ - .I tputs - to provide this delay. - The delay must be a number with at most one decimal --place of precision; it may be followed by suffixes `*' or '/' or both. --A `*' -+place of precision; it may be followed by suffixes \*(``*\*('' or \*(``/\*('' or both. -+A \*(``*\*('' - indicates that the padding required is proportional to the number of lines - affected by the operation, and the amount given is the per-affected-unit - padding required. -@@ -100,7 +170,7 @@ - .IR lines - affected.) Normally, padding is advisory if the device has the \fBxon\fR - capability; it is used for cost computation but does not trigger delays. --A `/' -+A \*(``/\*('' - suffix indicates that the padding is mandatory and forces a delay of the given - number of milliseconds even on devices for which \fBxon\fR is present to - indicate flow control. -@@ -115,27 +185,36 @@ - .PP - .SS Fetching Compiled Descriptions - .PP -+The \fBncurses\fP library searches for terminal descriptions in several places. -+It uses only the first description found. -+The library has a compiled-in list of places to search -+which can be overridden by environment variables. -+Before starting to search, -+\fBncurses\fP eliminates duplicates in its search list. -+.bP - If the environment variable TERMINFO is set, it is interpreted as the pathname - of a directory containing the compiled description you are working on. --Only --that directory is searched. --.PP --If TERMINFO is not set, the \fBncurses\fR version of the terminfo reader code --will instead look in the directory \fB$HOME/.terminfo\fR -+Only that directory is searched. -+.bP -+If TERMINFO is not set, -+\fBncurses\fR will instead look in the directory \fB$HOME/.terminfo\fR - for a compiled description. --If it fails to find one there, and the environment variable TERMINFO_DIRS is --set, it will interpret the contents of that variable as a list of colon- --separated directories to be searched (an empty entry is interpreted as a --command to search \fI\*d\fR). --If no description is found in any of the --TERMINFO_DIRS directories, the fetch fails. --.PP --If neither TERMINFO nor TERMINFO_DIRS is set, the last place tried will be the --system terminfo directory, \fI\*d\fR. --.PP --(Neither the \fB$HOME/.terminfo\fR lookups nor TERMINFO_DIRS extensions are --supported under stock System V terminfo/curses.) --.PP -+.bP -+Next, if the environment variable TERMINFO_DIRS is set, -+\fBncurses\fR will interpret the contents of that variable -+as a list of colon-separated directories (or database files) to be searched. -+.IP -+An empty directory name (i.e., if the variable begins or ends -+with a colon, or contains adacent colons) -+is interpreted as the system location \fI\*d\fR. -+.bP -+Finally, \fBncurses\fP searches these compiled-in locations: -+.RS -+.bP -+a list of directories (@TERMINFO_DIRS@), and -+.bP -+the system terminfo directory, \fI\*d\fR (the compiled-in default). -+.RE - .SS Preparing Descriptions - .PP - We now outline how to prepare descriptions of terminals. -@@ -154,7 +233,7 @@ - .PP - To get the padding for insert line right (if the terminal manufacturer - did not document it) a severe test is to edit a large file at 9600 baud, --delete 16 or so lines from the middle of the screen, then hit the `u' -+delete 16 or so lines from the middle of the screen, then hit the \*(``u\*('' - key several times quickly. - If the terminal messes up, more padding is usually needed. - A similar test can be used for insert character. -@@ -198,7 +277,7 @@ - and - .BR cud1 . - These local cursor motions should not alter the text they pass over, --for example, you would not normally use `\fBcuf1\fP=\ ' because the -+for example, you would not normally use \*(``\fBcuf1\fP=\ \*('' because the - space would erase the character moved over. - .PP - A very important point here is that the local cursor motions encoded -@@ -275,9 +354,10 @@ - .ft CW - .\".in -2 - \s-133\||\|tty33\||\|tty\||\|model 33 teletype, -- bel=^G, cols#72, cr=^M, cud1=^J, hc, ind=^J, os,\s+1 -+ bel=^G, cols#72, cr=^M, cud1=^J, hc, ind=^J, os,\s+1 - .\".in +2 - .ft R -+.fi - .PP - while the Lear Siegler \s-1ADM-3\s0 is described as - .PP -@@ -286,8 +366,8 @@ - .ft CW - .\".in -2 - \s-1adm3\||\|3\||\|lsi adm3, -- am, bel=^G, clear=^Z, cols#80, cr=^M, cub1=^H, cud1=^J, -- ind=^J, lines#24,\s+1 -+ am, bel=^G, clear=^Z, cols#80, cr=^M, cub1=^H, cud1=^J, -+ ind=^J, lines#24,\s+1 - .\".in +2 - .ft R - .fi -@@ -296,9 +376,8 @@ - .PP - Cursor addressing and other strings requiring parameters - in the terminal are described by a --parameterized string capability, with --.IR printf (3) --like escapes \fB%x\fR in it. -+parameterized string capability, -+with \fIprintf\fP-like escapes such as \fI%x\fR in it. - For example, to address the cursor, the - .B cup - capability is given, using two parameters: -@@ -321,34 +400,34 @@ - The \fB%\fR encodings have the following meanings: - .PP - .TP 5 --\s-1%% --outputs `%' -+\fB%%\fP -+outputs \*(``%\*('' - .TP --%\fI[[\fP:\fI]flags][width[.precision]][\fPdoxXs\fI]\fP --as in \fBprintf\fP, flags are [\-+#] and space. --Use a `:' to allow the next character to be a `\-' flag, -+\fB%\fP\fI[[\fP:\fI]flags][width[.precision]][\fP\fBdoxXs\fP\fI]\fP -+as in \fBprintf\fP, flags are \fI[\-+#]\fP and \fIspace\fP. -+Use a \*(``:\*('' to allow the next character to be a \*(``\-\*('' flag, - avoiding interpreting "%\-" as an operator. - .TP --%c -+\f(CW%c\fP - print pop() like %c in \fBprintf\fP - .TP --%s -+\fB%s\fP - print pop() like %s in \fBprintf\fP - .TP --%p[1\-9] -+\fB%p\fP\fI[1\-9]\fP - push \fIi\fP'th parameter - .TP --%P[a\-z] --set dynamic variable [a\-z] to pop() -+\fB%P\fP\fI[a\-z]\fP -+set dynamic variable \fI[a\-z]\fP to pop() - .TP --%g[a\-z] --get dynamic variable [a\-z] and push it -+\fB%g\fP\fI[a\-z]/\fP -+get dynamic variable \fI[a\-z]\fP and push it - .TP --%P[A\-Z] --set static variable [a\-z] to pop() -+\fB%P\fP\fI[A\-Z]\fP -+set static variable \fI[a\-z]\fP to \fIpop()\fP - .TP --%g[A\-Z] --get static variable [a\-z] and push it -+\fB%g\fP\fI[A\-Z]\fP -+get static variable \fI[a\-z]\fP and push it - .IP - The terms "static" and "dynamic" are misleading. - Historically, these are simply two different sets of variables, -@@ -356,48 +435,48 @@ - However, that fact is not documented in other implementations. - Relying on it will adversely impact portability to other implementations. - .TP --%'\fIc\fP' -+\fB%'\fP\fIc\fP\fB'\fP - char constant \fIc\fP - .TP --%{\fInn\fP} -+\fB%{\fP\fInn\fP\fB}\fP - integer constant \fInn\fP - .TP --%l -+\fB%l\fP - push strlen(pop) - .TP --%+ %\- %* %/ %m --arithmetic (%m is mod): push(pop() op pop()) -+\fB%+\fP, \fB%\-\fP, \fB%*\fP, \fB%/\fP, \fB%m\fP -+arithmetic (%m is mod): \fIpush(pop() op pop())\fP - .TP --%& %| %^ --bit operations (AND, OR and exclusive-OR): push(pop() op pop()) -+\fB%&\fP, \fB%|\fP, \fB%^\fP -+bit operations (AND, OR and exclusive-OR): \fIpush(pop() op pop())\fP - .TP --%= %> %< --logical operations: push(pop() op pop()) -+\fB%=\fP, \fB%>\fP, \fB%<\fP -+logical operations: \fIpush(pop() op pop())\fP - .TP --%A, %O -+\fB%A\fP, \fB%O\fP - logical AND and OR operations (for conditionals) - .TP --%! %~ -+\fB%!\fP, \fB%~\fP - unary operations (logical and bit complement): push(op pop()) - .TP --%i -+\fB%i\fP - add 1 to first two parameters (for ANSI terminals) - .TP --%? \fIexpr\fP %t \fIthenpart\fP %e \fIelsepart\fP %; -+\fB%?\fP \fIexpr\fP \fB%t\fP \fIthenpart\fP \fB%e\fP \fIelsepart\fP \fB%;\fP - This forms an if-then-else. --The %e \fIelsepart\fP is optional. --Usually the %? \fIexpr\fP part pushes a value onto the stack, --and %t pops it from the stack, testing if it is nonzero (true). --If it is zero (false), control passes to the %e (else) part. -+The \fB%e\fP \fIelsepart\fP is optional. -+Usually the \fB%?\fP \fIexpr\fP part pushes a value onto the stack, -+and \fB%t\fP pops it from the stack, testing if it is nonzero (true). -+If it is zero (false), control passes to the \fB%e\fP (else) part. - .IP - It is possible to form else-if's a la Algol 68: - .RS --%? c\d1\u %t b\d1\u %e c\d2\u %t b\d2\u %e c\d3\u %t b\d3\u %e c\d4\u %t b\d4\u %e %; -+\fB%?\fP c\d1\u \fB%t\fP b\d1\u \fB%e\fP c\d2\u \fB%t\fP b\d2\u \fB%e\fP c\d3\u \fB%t\fP b\d3\u \fB%e\fP c\d4\u \fB%t\fP b\d4\u \fB%e\fP \fB%;\fP - .RE - .IP - where c\di\u are conditions, b\di\u are bodies. - .IP --Use the \fB\-f\fP option of \fBtic\fP or \fB@INFOCMP@\fP to see -+Use the \fB\-f\fP option of \fB@TIC@\fP or \fB@INFOCMP@\fP to see - the structure of if-then-else's. - Some strings, e.g., \fBsgr\fP can be very complicated when written - on one line. -@@ -405,7 +484,7 @@ - .PP - Binary operations are in postfix form with the operands in the usual order. - That is, to get x\-5 one would use "%gx%{5}%-". --%P and %g variables are -+\fB%P\fP and \fB%g\fP variables are - persistent across escape-string evaluations. - .PP - Consider the HP2645, which, to get to row 3 and column 12, needs -@@ -429,7 +508,7 @@ - .PP - A final example is the \s-1LSI ADM\s0-3a, which uses row and column - offset by a blank character, thus \*(lqcup=\eE=%p1%' '%+%c%p2%' '%+%c\*(rq. --After sending `\eE=', this pushes the first parameter, pushes the -+After sending \*(``\eE=\*('', this pushes the first parameter, pushes the - ASCII value for a space (32), adds them (pushing the sum on the stack - in place of the two previous values) and outputs that value as a character. - Then the same is done for the second parameter. -@@ -593,6 +672,7 @@ - a distinction between typed and untyped blanks on the screen, shifting - upon an insert or delete only to an untyped blank on the screen which is - either eliminated, or expanded to two untyped blanks. -+.PP - You can determine the - kind of terminal you have by clearing the screen and then typing - text separated by cursor motions. -@@ -608,6 +688,7 @@ - current line and onto the next as you insert, you have the second type of - terminal, and should give the capability \fBin\fR, which stands for - \*(lqinsert null\*(rq. -+.PP - While these are two logically separate attributes (one line versus multi-line - insert mode, and special treatment of untyped spaces) we have seen no - terminals whose insert mode cannot be described with the single attribute. -@@ -642,7 +723,7 @@ - in \fBip\fR (a string option). - Any other sequence which may need to be - sent after an insert of a single character may also be given in \fBip\fR. --If your terminal needs both to be placed into an `insert mode' and -+If your terminal needs both to be placed into an \*(``insert mode\*('' and - a special code to precede each inserted character, then both - .BR smir / rmir - and -@@ -792,6 +873,7 @@ - .PP - Writing out the above sequences, along with their dependencies yields - .PP -+.ne 11 - .TS - center; - l l l -@@ -799,6 +881,7 @@ - lw18 lw14 lw18. - \fBsequence when to output terminfo translation\fP - -+.ft CW - \\E[0 always \\E[0 - ;1 if p1 or p6 %?%p1%p6%|%t;1%; - ;4 if p2 %?%p2%|%t;4%; -@@ -807,14 +890,17 @@ - ;8 if p7 %?%p7%|%t;8%; - m always m - ^N or ^O if p9 ^N, else ^O %?%p9%t^N%e^O%; -+.ft R - .TE - .PP - Putting this all together into the sgr sequence gives: - .PP -+.ft CW - .nf -- sgr=\\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%; -- %?%p4%t;5%;%?%p7%t;8%;m%?%p9%t\\016%e\\017%;, -+ sgr=\\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p4%t;5%; -+ %?%p1%p3%|%t;7%;%?%p7%t;8%;m%?%p9%t\\016%e\\017%;, - .fi -+.ft R - .PP - Remember that if you specify sgr, you must also specify sgr0. - Also, some implementations rely on sgr being given if sgr0 is, -@@ -824,9 +910,9 @@ - The only drawback to adding an sgr string is that termcap also - assumes that sgr0 does not exit alternate character set mode. - .PP --Terminals with the ``magic cookie'' glitch -+Terminals with the \*(``magic cookie\*('' glitch - .RB ( xmc ) --deposit special ``cookies'' when they receive mode-setting sequences, -+deposit special \*(``cookies\*('' when they receive mode-setting sequences, - which affect the display algorithm rather than having extra bits for - each character. - Some terminals, such as the HP 2621, automatically leave standout -@@ -871,6 +957,7 @@ - If the keypad can be set to transmit or not transmit, - give these codes as \fBsmkx\fR and \fBrmkx\fR. - Otherwise the keypad is assumed to always transmit. -+.PP - The codes sent by the left arrow, right arrow, up arrow, down arrow, - and home keys can be given as - \fBkcub1, kcuf1, kcuu1, kcud1, \fRand\fB khome\fR respectively. -@@ -878,41 +965,60 @@ - can be given as \fBkf0, kf1, ..., kf10\fR. - If these keys have labels other than the default f0 through f10, the labels - can be given as \fBlf0, lf1, ..., lf10\fR. -+.PP - The codes transmitted by certain other special keys can be given: -+.bP - .B kll - (home down), -+.bP - .B kbs - (backspace), -+.bP - .B ktbc - (clear all tabs), -+.bP - .B kctab - (clear the tab stop in this column), -+.bP - .B kclr - (clear screen or erase key), -+.bP - .B kdch1 - (delete character), -+.bP - .B kdl1 - (delete line), -+.bP - .B krmir - (exit insert mode), -+.bP - .B kel - (clear to end of line), -+.bP - .B ked - (clear to end of screen), -+.bP - .B kich1 - (insert character or enter insert mode), -+.bP - .B kil1 - (insert line), -+.bP - .B knp - (next page), -+.bP - .B kpp - (previous page), -+.bP - .B kind - (scroll forward/down), -+.bP - .B kri - (scroll backward/up), -+.bP - .B khts - (set a tab stop in this column). -+.PP - In addition, if the keypad has a 3 by 3 array of keys including the four - arrow keys, the other five keys can be given as - .BR ka1 , -@@ -956,7 +1062,7 @@ - tab stop can be given as - .B ht - (usually control I). --A ``back-tab'' command which moves leftward to the preceding tab stop can -+A \*(``back-tab\*('' command which moves leftward to the preceding tab stop can - be given as - .BR cbt . - By convention, if the teletype modes indicate that tabs are being -@@ -974,7 +1080,7 @@ - .B it - is given, showing the number of spaces the tabs are set to. - This is normally used by the --.IR tset -+.IR @TSET@ - command to determine whether to set the mode for hardware tab expansion, - and whether to set the tab stops. - If the terminal has tab stops that can be saved in non-volatile memory, -@@ -1131,7 +1237,7 @@ - string is used. - .PP - .SS Status Lines --Some terminals have an extra `status line' which is not normally used by -+Some terminals have an extra \*(``status line\*('' which is not normally used by - software (and thus not counted in the terminal's \fBlines\fR capability). - .PP - The simplest case is a status line which is cursor-addressable but not -@@ -1223,7 +1329,7 @@ - .PP - .SS Color Handling - .PP --Most color terminals are either `Tektronix-like' or `HP-like'. -+Most color terminals are either \*(``Tektronix-like\*('' or \*(``HP-like\*(''. - Tektronix-like - terminals have a predefined set of N colors (where N usually 8), and can set - character-cell foreground and background characters independently, mixing them -@@ -1303,6 +1409,7 @@ - yellow \fBCOLOR_YELLOW\fR 6 max,max,0 - white \fBCOLOR_WHITE\fR 7 max,max,max - .TE -+.PP - It is important to not confuse the two sets of color capabilities; - otherwise red/blue will be interchanged on the display. - .PP -@@ -1339,18 +1446,25 @@ - .PP - .TS - center; --l c c --lw25 lw2 lw10. --\fBAttribute Bit Decimal\fR --A_STANDOUT 0 1 --A_UNDERLINE 1 2 --A_REVERSE 2 4 --A_BLINK 3 8 --A_DIM 4 16 --A_BOLD 5 32 --A_INVIS 6 64 --A_PROTECT 7 128 --A_ALTCHARSET 8 256 -+l l l l -+lw20 lw2 lw10 lw10. -+\fBAttribute Bit Decimal Set by\fR -+A_STANDOUT 0 1 sgr -+A_UNDERLINE 1 2 sgr -+A_REVERSE 2 4 sgr -+A_BLINK 3 8 sgr -+A_DIM 4 16 sgr -+A_BOLD 5 32 sgr -+A_INVIS 6 64 sgr -+A_PROTECT 7 128 sgr -+A_ALTCHARSET 8 256 sgr -+A_HORIZONTAL 9 512 sgr1 -+A_LEFT 10 1024 sgr1 -+A_LOW 11 2048 sgr1 -+A_RIGHT 12 4096 sgr1 -+A_TOP 13 8192 sgr1 -+A_VERTICAL 14 16384 sgr1 -+A_ITALIC 15 32768 sitm - .TE - .PP - For example, on many IBM PC consoles, the underline attribute collides with the -@@ -1389,7 +1503,7 @@ - .BR rep . - The first parameter is the character to be repeated and the second - is the number of times to repeat it. --Thus, tparm(repeat_char, 'x', 10) is the same as `xxxxxxxxxx'. -+Thus, tparm(repeat_char, 'x', 10) is the same as \*(``xxxxxxxxxx\*(''. - .PP - If the terminal has a settable command character, such as the \s-1TEKTRONIX\s+1 4025, - this can be indicated with -@@ -1420,13 +1534,13 @@ - .I virtual - terminal descriptions for which the escape sequences are known.) - .PP --If the terminal has a ``meta key'' which acts as a shift key, -+If the terminal has a \*(``meta key\*('' which acts as a shift key, - setting the 8th bit of any character transmitted, this fact can - be indicated with - .BR km . - Otherwise, software will assume that the 8th bit is parity and it - will usually be cleared. --If strings exist to turn this ``meta mode'' on and off, they -+If strings exist to turn this \*(``meta mode\*('' on and off, they - can be given as - .B smm - and -@@ -1470,7 +1584,7 @@ - .PP - .SS Glitches and Braindamage - .PP --Hazeltine terminals, which do not allow `~' characters to be displayed should -+Hazeltine terminals, which do not allow \*(``~\*('' characters to be displayed should - indicate \fBhz\fR. - .PP - Terminals which ignore a line-feed immediately after an \fBam\fR wrap, -@@ -1485,10 +1599,10 @@ - .PP - Teleray terminals, where tabs turn all characters moved over to blanks, - should indicate \fBxt\fR (destructive tabs). --Note: the variable indicating this is now `dest_tabs_magic_smso'; in -+Note: the variable indicating this is now \*(``dest_tabs_magic_smso\*(''; in - older versions, it was teleray_glitch. - This glitch is also taken to mean that it is not possible to position --the cursor on top of a ``magic cookie'', -+the cursor on top of a \*(``magic cookie\*('', - that to erase standout mode it is instead necessary to use - delete and insert line. - The ncurses implementation ignores this glitch. -@@ -1499,7 +1613,7 @@ - indicating that the f1 key is used for escape and f2 for control C. - (Only certain Superbees have this problem, depending on the ROM.) - Note that in older terminfo versions, this capability was called --`beehive_glitch'; it is now `no_esc_ctl_c'. -+\*(``beehive_glitch\*(''; it is now \*(``no_esc_ctl_c\*(''. - .PP - Other specific terminal problems may be corrected by adding more - capabilities of the form \fBx\fR\fIx\fR. -@@ -1524,8 +1638,10 @@ - A capability can be canceled by placing \fBxx@\fR to the left of the - use reference that imports it, where \fIxx\fP is the capability. - For example, the entry -+.RS - .PP -- 2621\-nl, smkx@, rmkx@, use=2621, -+2621\-nl, smkx@, rmkx@, use=2621, -+.RE - .PP - defines a 2621\-nl that does not have the \fBsmkx\fR or \fBrmkx\fR capabilities, - and hence does not turn on the function key labels when in visual mode. -@@ -1570,19 +1686,15 @@ - backslash-newline pairs, which \fBtgetent()\fP strips out while reading it. - Some termcap libraries strip off the final newline, too (GNU termcap does not). - Now suppose: --.TP 5 --* -+.bP - a termcap entry before expansion is more than 1023 bytes long, --.TP 5 --* -+.bP - and the application has only allocated a 1k buffer, --.TP 5 --* -+.bP - and the termcap library (like the one in BSD/OS 1.1 and GNU) reads - the whole entry into the buffer, no matter what its length, to see - if it is the entry it wants, --.TP 5 --* -+.bP - and \fBtgetent()\fP is searching for a terminal type that either is the - long entry, appears in the termcap file after the long entry, or - does not appear in the file at all (so that \fBtgetent()\fP has to search -@@ -1625,6 +1737,11 @@ - SVr1, and have added extension capabilities to the string table that (in the - binary format) collide with System V and XSI Curses extensions. - .SH EXTENSIONS -+.PP -+Searching for terminal descriptions in -+\fB$HOME/.terminfo\fR and TERMINFO_DIRS -+is not supported by older implementations. -+.PP - Some SVr4 \fBcurses\fR implementations, and all previous to SVr4, do not - interpret the %A and %O operators in parameter strings. - .PP -@@ -1652,6 +1769,15 @@ - interpret it as \fBKEY_MOUSE\fR, for use by terminals and emulators like xterm - that can return mouse-tracking information in the keyboard-input stream. - .PP -+X/Open Curses does not mention italics. -+Portable applications must assume that numeric capabilities are -+signed 16-bit values. -+This includes the \fIno_color_video\fP (ncv) capability. -+The 32768 mask value used for italics with ncv can be confused with -+an absent or cancelled ncv. -+If italics should work with colors, -+then the ncv value must be specified, even if it is zero. -+.PP - Different commercial ports of terminfo and curses support different subsets of - the XSI Curses standard and (in some cases) different extension sets. - Here -@@ -1666,9 +1792,9 @@ - .PP - \fBSVr1, Ultrix\fR \-\- - These support a restricted subset of terminfo capabilities. --The booleans --end with \fBxon_xoff\fR; the numerics with \fBwidth_status_line\fR; and the --strings with \fBprtr_non\fR. -+The booleans end with \fBxon_xoff\fR; -+the numerics with \fBwidth_status_line\fR; -+and the strings with \fBprtr_non\fR. - .PP - \fBHP/UX\fR \-\- - Supports the SVr1 subset, plus the SVr[234] numerics \fBnum_labels\fR, -diff -Naur ncurses-5.9/man/term_variables.3x ncurses-5.9.patch/man/term_variables.3x ---- ncurses-5.9/man/term_variables.3x 2010-12-04 19:38:55.000000000 +0100 -+++ ncurses-5.9.patch/man/term_variables.3x 2014-09-01 16:33:22.350792113 +0200 -@@ -1,5 +1,5 @@ - .\"*************************************************************************** --.\" Copyright (c) 2010 Free Software Foundation, Inc. * -+.\" Copyright (c) 2011,2013 Free Software Foundation, Inc. * - .\" * - .\" Permission is hereby granted, free of charge, to any person obtaining a * - .\" copy of this software and associated documentation files (the * -@@ -26,7 +26,7 @@ - .\" authorization. * - .\"*************************************************************************** - .\" --.\" $Id: term_variables.3x,v 1.2 2010/12/04 18:38:55 tom Exp $ -+.\" $Id: term_variables.3x,v 1.4 2013/12/21 22:17:39 tom Exp $ - .TH term_variables 3X "" - .ds n 5 - .na -@@ -110,7 +110,7 @@ - Alternatively, one can save the return value from \fBnewterm\fP - or \fBsetupterm\fP to reuse in \fBset_term\fP. - .SS Terminfo Names --The \fBtic\fP(1) and \fBinfocmp\fP(1) programs use lookup tables for -+The \fB@TIC@\fP(1) and \fB@INFOCMP@\fP(1) programs use lookup tables for - the long and short names of terminfo capabilities, - as well as the corresponding names for termcap capabilities. - These are available to other applications, -@@ -134,7 +134,10 @@ - On initialization of the curses or terminfo interfaces, - \fBsetupterm\fP copies the terminal name to the array \fBttytype\fP. - .SH NOTES --The low-level terminfo interface is initialized using \fBsetupterm\fR(3X). -+The low-level terminfo interface is initialized using -+.hy 0 -+\fBsetupterm\fR(3X). -+.hy - The upper-level curses interface uses the low-level terminfo interface, - internally. - .SH PORTABILITY -@@ -146,8 +149,9 @@ - Some implementations provide the variables in their libraries, - but omit them from the header files. - .SH SEE ALSO -+.hy 0 - \fBcurses\fR(3X), - \fBcurs_terminfo\fR(3X), - \fBcurs_threads\fR(3X), --\fBterminfo\fR(3X), - \fBterminfo\fR(\*n). -+.hy -diff -Naur ncurses-5.9/man/tic.1m ncurses-5.9.patch/man/tic.1m ---- ncurses-5.9/man/tic.1m 2010-12-04 19:38:55.000000000 +0100 -+++ ncurses-5.9.patch/man/tic.1m 2014-09-01 16:33:22.351792114 +0200 -@@ -1,5 +1,5 @@ - .\"*************************************************************************** --.\" Copyright (c) 1998-2006,2010 Free Software Foundation, Inc. * -+.\" Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. * - .\" * - .\" Permission is hereby granted, free of charge, to any person obtaining a * - .\" copy of this software and associated documentation files (the * -@@ -26,19 +26,29 @@ - .\" authorization. * - .\"*************************************************************************** - .\" --.\" $Id: tic.1m,v 1.47 2010/12/04 18:38:55 tom Exp $ -+.\" $Id: tic.1m,v 1.58 2013/07/20 19:31:25 tom Exp $ - .TH @TIC@ 1M "" -+.ie \n(.g .ds `` \(lq -+.el .ds `` `` -+.ie \n(.g .ds '' \(rq -+.el .ds '' '' - .ds n 5 - .ds d @TERMINFO@ -+.de bP -+.IP \(bu 4 -+.. - .SH NAME --\fBtic\fR \- the \fIterminfo\fR entry-description compiler -+\fB@TIC@\fR \- the \fIterminfo\fR entry-description compiler - .SH SYNOPSIS --\fBtic\fR -+\fB@TIC@\fR - [\fB\-\ -+0\ - 1\ - C\ -+D\ - G\ - I\ -+K\ - L\ - N\ - T\ -@@ -61,31 +71,69 @@ - \fIfile\fR - .br - .SH DESCRIPTION --The command \fBtic\fR translates a \fBterminfo\fR file from source -+The \fB@TIC@\fR command translates a \fBterminfo\fR file from source - format into compiled format. - The compiled format is necessary for use with - the library routines in \fBncurses\fR(3X). - .PP --The results are normally placed in the system terminfo --directory \fB\*d\fR. --There are two ways to change this behavior. --.PP --First, you may override the system default by setting the variable --\fBTERMINFO\fR in your shell environment to a valid (existing) directory name. --.PP --Secondly, if \fBtic\fR cannot get access to \fI\*d\fR or your TERMINFO --directory, it looks for the directory \fI$HOME/.terminfo\fR; if that directory --exists, the entry is placed there. --.PP --Libraries that read terminfo entries are expected to check for a TERMINFO --directory first, look at \fI$HOME/.terminfo\fR if TERMINFO is not set, and --finally look in \fI\*d\fR. -+As described in \fBterm\fR(\*n), the database may be either a directory -+tree (one file per terminal entry) or a hashed database (one record per entry). -+The \fB@TIC@\fR command writes only one type of entry, -+depending on how it was built: -+.bP -+For directory trees, the top-level directory, e.g., /usr/share/terminfo, -+specifies the location of the database. -+.bP -+For hashed databases, a filename is needed. -+If the given file is not found by that name, -+but can be found by adding the suffix ".db", -+then that is used. -+.IP -+The default name for the hashed database is the same as the -+default directory name (only adding a ".db" suffix). -+.PP -+In either case (directory or hashed database), -+\fB@TIC@\fP will create the container if it does not exist. -+For a directory, this would be the "terminfo" leaf, -+versus a "terminfo.db" file. -+.PP -+The results are normally placed in the system terminfo database \fB\*d\fR. -+The compiled terminal description can be placed -+in a different terminfo database. -+There are two ways to achieve this: -+.bP -+First, you may override the system default either by -+using the \fB\-o\fP option, -+or by setting the variable \fBTERMINFO\fR -+in your shell environment to a valid database location. -+.bP -+Secondly, if \fB@TIC@\fR cannot write in \fI\*d\fR -+or the location specified using your TERMINFO variable, -+it looks for the directory \fI$HOME/.terminfo\fR -+(or hashed database \fI$HOME/.terminfo.db)\fR; -+if that location exists, the entry is placed there. -+.PP -+Libraries that read terminfo entries are expected to check in succession -+.bP -+a location specified with the TERMINFO environment variable, -+.bP -+\fI$HOME/.terminfo\fR, -+.bP -+directories listed in the TERMINFO_DIRS environment variable, -+.bP -+a compiled-in list of directories (@TERMINFO_DIRS@), and -+.bP -+the system terminfo database (\fI\*d\fR). -+.SS OPTIONS -+.TP -+\fB\-0\fR -+restricts the output to a single line - .TP - \fB\-1\fR - restricts the output to a single column - .TP - \fB\-a\fR --tells \fBtic\fP to retain commented-out capabilities rather than discarding -+tells \fB@TIC@\fP to retain commented-out capabilities rather than discarding - them. - Capabilities are commented by prefixing them with a period. - This sets the \fB\-x\fR option, because it treats the commented-out -@@ -101,16 +149,30 @@ - Capabilities - that are not translatable are left in the entry under their terminfo names - but commented out with two preceding dots. -+The actual format used incorporates some improvements for escaped characters -+from terminfo format. -+For a stricter BSD-compatible translation, add the \fB\-K\fR option. - .TP - \fB\-c\fR --tells \fBtic\fP to only check \fIfile\fR for errors, including syntax problems and -+tells \fB@TIC@\fP to only check \fIfile\fR for errors, including syntax problems and - bad use links. - If you specify \fB\-C\fR (\fB\-I\fR) with this option, the code - will print warnings about entries which, after use resolution, are more than - 1023 (4096) bytes long. --Due to a fixed buffer length in older termcap --libraries (and a documented limit in terminfo), these entries may cause core --dumps. -+Due to a fixed buffer length in older termcap libraries, -+as well as buggy checking for the buffer length -+(and a documented limit in terminfo), -+these entries may cause core -+dumps with other implementations. -+.TP -+\fB\-D\fR -+tells \fB@TIC@\fP to print the database locations that it knows about, and exit. -+The first location shown is the one to which it would write compiled -+terminal descriptions. -+If \fB@TIC@\fP is not able to find a writable database location -+according to the rules summarized above, -+it will print a diagnostic and exit with an error rather than -+printing a list of database locations. - .TP - \fB\-e \fR\fInames\fR - Limit writes and translations to the following comma-separated list of -@@ -137,6 +199,10 @@ - \fB\-I\fR - Force source translation to terminfo format. - .TP -+\fB\-K\fR -+Suppress some longstanding ncurses extensions to termcap format, -+e.g., "\\s" for space. -+.TP - \fB\-L\fR - Force source translation to terminfo format - using the long C variable names listed in <\fBterm.h\fR> -@@ -155,9 +221,8 @@ - obsolete capabilities. - .TP - \fB\-o\fR\fIdir\fR --Write compiled entries to given directory. --Overrides the TERMINFO environment --variable. -+Write compiled entries to given database location. -+Overrides the TERMINFO environment variable. - .TP - \fB\-R\fR\fIsubset\fR - Restrict output to a given subset. -@@ -177,7 +242,7 @@ - tc capabilities per entry. - .TP - \fB\-s\fR --Summarize the compile by showing the directory into which entries -+Summarize the compile by showing the database location into which entries - are written, and the number of entries which are compiled. - .TP - \fB\-T\fR -@@ -186,12 +251,12 @@ - descriptions are limited (e.g., 1023 for termcap, 4096 for terminfo). - .TP - \fB\-t\fR --tells \fBtic\fP to discard commented-out capabilities. -+tells \fB@TIC@\fP to discard commented-out capabilities. - Normally when translating from terminfo to termcap, - untranslatable capabilities are commented-out. - .TP 5 - \fB\-U\fR --tells \fBtic\fP to not post-process the data after parsing the source file. -+tells \fB@TIC@\fP to not post-process the data after parsing the source file. - Normally, it infers data which is commonly missing in older terminfo data, - or in termcaps. - .TP -@@ -200,31 +265,13 @@ - .TP - \fB\-v\fR\fIn\fR - specifies that (verbose) output be written to standard error trace --information showing \fBtic\fR's progress. -+information showing \fB@TIC@\fR's progress. - The optional parameter \fIn\fR is a number from 1 to 10, inclusive, - indicating the desired level of detail of information. - If \fIn\fR is omitted, the default level is 1. - If \fIn\fR is specified and greater than 1, the level of - detail is increased. --.TP --\fB\-w\fR\fIn\fR --specifies the width of the output. --The parameter is optional. --If it is omitted, it defaults to 60. --.TP --\fB\-x\fR --Treat unknown capabilities as user-defined. --That is, if you supply a capability name which \fBtic\fP does not recognize, --it will infer its type (boolean, number or string) from the syntax and --make an extended table entry for that. --User-defined capability strings --whose name begins with ``k'' are treated as function keys. --.TP --\fIfile\fR --contains one or more \fBterminfo\fR terminal descriptions in source --format [see \fBterminfo\fR(\*n)]. --Each description in the file --describes the capabilities of a particular terminal. -+.RS - .PP - The debug flag levels are as follows: - .TP -@@ -232,7 +279,7 @@ - Names of files created and linked - .TP - 2 --Information related to the ``use'' facility -+Information related to the \*(``use\*('' facility - .TP - 3 - Statistics from the hashing algorithm -@@ -250,19 +297,42 @@ - All values computed in construction of the hash table - .LP - If the debug level \fIn\fR is not given, it is taken to be one. -+.RE -+.TP -+\fB\-w\fR\fIn\fR -+specifies the width of the output. -+The parameter is optional. -+If it is omitted, it defaults to 60. -+.TP -+\fB\-x\fR -+Treat unknown capabilities as user-defined. -+That is, if you supply a capability name which \fB@TIC@\fP does not recognize, -+it will infer its type (boolean, number or string) from the syntax and -+make an extended table entry for that. -+User-defined capability strings -+whose name begins with \*(``k\*('' are treated as function keys. -+.SS PARAMETERS -+.TP -+\fIfile\fR -+contains one or more \fBterminfo\fR terminal descriptions in source -+format [see \fBterminfo\fR(\*n)]. -+Each description in the file -+describes the capabilities of a particular terminal. -+.IP -+If \fIfile\fR is \*(``-\*('', then the data is read from the standard input. -+The \fIfile\fR parameter may also be the path of a character-device. -+.SS PROCESSING - .PP --All but one of the capabilities recognized by \fBtic\fR are documented -+All but one of the capabilities recognized by \fB@TIC@\fR are documented - in \fBterminfo\fR(\*n). - The exception is the \fBuse\fR capability. - .PP - When a \fBuse\fR=\fIentry\fR\-\fIname\fR field is discovered in a --terminal entry currently being compiled, \fBtic\fR reads in the binary -+terminal entry currently being compiled, \fB@TIC@\fR reads in the binary - from \fB\*d\fR to complete the entry. - (Entries created from - \fIfile\fR will be used first. --If the environment variable --\fBTERMINFO\fR is set, that directory is searched instead of --\fB\*d\fR.) \fBtic\fR duplicates the capabilities in -+\fB@TIC@\fR duplicates the capabilities in - \fIentry\fR\-\fIname\fR for the current entry, with the exception of - those capabilities that explicitly are defined in the current entry. - .PP -@@ -272,9 +342,6 @@ - \fBentry_name_1\fR before \fBuse=\fR for these capabilities to be - canceled in \fBentry_name_1\fR. - .PP --If the environment variable \fBTERMINFO\fR is set, the compiled --results are placed there instead of \fB\*d\fR. --.PP - Total compiled entries cannot exceed 4096 bytes. - The name field cannot - exceed 512 bytes. -@@ -282,14 +349,14 @@ - (32 characters on systems with long filenames, 14 characters otherwise) - will be truncated to the maximum alias length and a warning message will be printed. - .SH COMPATIBILITY --There is some evidence that historic \fBtic\fR implementations treated -+There is some evidence that historic \fB@TIC@\fR implementations treated - description fields with no whitespace in them as additional aliases or - short names. --This \fBtic\fR does not do that, but it does warn when -+This \fB@TIC@\fR does not do that, but it does warn when - description fields may be treated that way and check them for dangerous - characters. - .SH EXTENSIONS --Unlike the stock SVr4 \fBtic\fR command, this implementation can actually -+Unlike the SVr4 \fB@TIC@\fR command, this implementation can actually - compile termcap sources. - In fact, entries in terminfo and termcap syntax can - be mixed in a single source file. -@@ -298,16 +365,20 @@ - .PP - The SVr4 manual pages are not clear on the resolution rules for \fBuse\fR - capabilities. --This implementation of \fBtic\fR will find \fBuse\fR targets anywhere -+This implementation of \fB@TIC@\fR will find \fBuse\fR targets anywhere - in the source file, or anywhere in the file tree rooted at \fBTERMINFO\fR (if --\fBTERMINFO\fR is defined), or in the user's \fI$HOME/.terminfo\fR directory --(if it exists), or (finally) anywhere in the system's file tree of -+\fBTERMINFO\fR is defined), -+or in the user's \fI$HOME/.terminfo\fR database -+(if it exists), -+or (finally) anywhere in the system's file tree of - compiled entries. - .PP --The error messages from this \fBtic\fR have the same format as GNU C -+The error messages from this \fB@TIC@\fR have the same format as GNU C - error messages, and can be parsed by GNU Emacs's compile facility. - .PP - The -+\fB\-0\fR, -+\fB\-1\fR, - \fB\-C\fR, - \fB\-G\fR, - \fB\-I\fR, -@@ -329,7 +400,7 @@ - The SVr4 \fB\-c\fR mode does not report bad use links. - .PP - System V does not compile entries to or read entries from your --\fI$HOME/.terminfo\fR directory unless TERMINFO is explicitly set to it. -+\fI$HOME/.terminfo\fR database unless TERMINFO is explicitly set to it. - .SH FILES - .TP 5 - \fB\*d/?/*\fR -@@ -340,6 +411,7 @@ - \fB@INFOTOCAP@\fR(1M), - \fB@TOE@\fR(1M), - \fBcurses\fR(3X), -+\fBterm\fR(\*n). - \fBterminfo\fR(\*n). - .PP - This describes \fBncurses\fR -diff -Naur ncurses-5.9/man/toe.1m ncurses-5.9.patch/man/toe.1m ---- ncurses-5.9/man/toe.1m 2010-12-04 19:40:45.000000000 +0100 -+++ ncurses-5.9.patch/man/toe.1m 2014-09-01 16:33:22.351792114 +0200 -@@ -1,5 +1,5 @@ - .\"*************************************************************************** --.\" Copyright (c) 1998-2008,2010 Free Software Foundation, Inc. * -+.\" Copyright (c) 1998-2010,2011 Free Software Foundation, Inc. * - .\" * - .\" Permission is hereby granted, free of charge, to any person obtaining a * - .\" copy of this software and associated documentation files (the * -@@ -26,19 +26,19 @@ - .\" authorization. * - .\"*************************************************************************** - .\" --.\" $Id: toe.1m,v 1.23 2010/12/04 18:40:45 tom Exp $ -+.\" $Id: toe.1m,v 1.26 2012/01/01 00:40:51 tom Exp $ - .TH @TOE@ 1M "" - .ds n 5 - .ds d @TERMINFO@ - .SH NAME --\fBtoe\fR \- table of (terminfo) entries -+\fB@TOE@\fR \- table of (terminfo) entries - .SH SYNOPSIS --\fBtoe\fR [\fB\-v\fR[\fIn\fR]] [\fB\-ahuUV\fR] \fIfile...\fR -+\fB@TOE@\fR [\fB\-v\fR[\fIn\fR]] [\fB\-ahsuUV\fR] \fIfile...\fR - .br - .SH DESCRIPTION - .PP - With no options, --\fBtoe\fR lists all available terminal types by primary name -+\fB@TOE@\fR lists all available terminal types by primary name - with descriptions. - File arguments specify the directories to be scanned; if no - such arguments are given, -@@ -52,6 +52,15 @@ - \fB\-a\fR - report on all of the terminal databases which ncurses would search, - rather than only the first one that it finds. -+.IP -+If the \fB\-s\fR is also given, \fB@TOE@\fR -+adds a column to the report, -+showing (like \fBconflict\fP(1)) which entries which -+belong to a given terminal database. -+An "*" marks entries which differ, and "+" marks equivalent entries. -+.TP -+\fB\-s\fR -+sort the output by the entry names. - .TP - \fB\-u\fR \fIfile\fR - says to write a report to the standard output, -@@ -78,7 +87,7 @@ - .TP - \fB\-v\fR\fIn\fR - specifies that (verbose) output be written to standard error, --showing \fBtoe\fR's progress. -+showing \fB@TOE@\fR's progress. - The optional parameter \fIn\fR is a number from 1 to 10, - interpreted as for \fB@TIC@\fR(1M). - .TP -diff -Naur ncurses-5.9/man/tput.1 ncurses-5.9.patch/man/tput.1 ---- ncurses-5.9/man/tput.1 2010-12-04 19:41:07.000000000 +0100 -+++ ncurses-5.9.patch/man/tput.1 2014-09-01 16:33:22.351792114 +0200 -@@ -1,6 +1,6 @@ - '\" t - .\"*************************************************************************** --.\" Copyright (c) 1998-2006,2010 Free Software Foundation, Inc. * -+.\" Copyright (c) 1998-2011,2012 Free Software Foundation, Inc. * - .\" * - .\" Permission is hereby granted, free of charge, to any person obtaining a * - .\" copy of this software and associated documentation files (the * -@@ -27,7 +27,7 @@ - .\" authorization. * - .\"*************************************************************************** - .\" --.\" $Id: tput.1,v 1.29 2010/12/04 18:41:07 tom Exp $ -+.\" $Id: tput.1,v 1.32 2012/07/14 21:06:45 tom Exp $ - .TH @TPUT@ 1 "" - .ds d @TERMINFO@ - .ds n 1 -@@ -77,11 +77,12 @@ - and the \fIcapname\fR associated with each, see \fBterminfo\fR(5). - .TP - \fB\-T\fR\fItype\fR --indicates the \fItype\fR of terminal. Normally this option is -+indicates the \fItype\fR of terminal. -+Normally this option is - unnecessary, because the default is taken from the environment --variable \fBTERM\fR. If \fB\-T\fR is specified, then the shell --variables \fBLINES\fR and \fBCOLUMNS\fR will be ignored,and the --operating system will not be queried for the actual screen size. -+variable \fBTERM\fR. -+If \fB\-T\fR is specified, then the shell -+variables \fBLINES\fR and \fBCOLUMNS\fR will also be ignored. - .TP - \fIcapname\fR - indicates the capability from the \fBterminfo\fR database. When -@@ -159,7 +160,7 @@ - .PP - If \fB@TPUT@\fR is invoked by a link named \fBreset\fR, this has the - same effect as \fB@TPUT@ reset\fR. --See \fBtset\fR for comparison, which has similar behavior. -+See \fB@TSET@\fR for comparison, which has similar behavior. - .SH EXAMPLES - .TP 5 - \fB@TPUT@ init\fR -@@ -275,7 +276,7 @@ - .PP - Any other exit code indicates an error; see the DIAGNOSTICS section. - .SH DIAGNOSTICS --\fBtput\fR prints the following error messages and sets the corresponding exit -+\fB@TPUT@\fR prints the following error messages and sets the corresponding exit - codes. - .PP - .ne 15 -@@ -303,17 +304,29 @@ - .PP - X/Open documents only the operands for \fBclear\fP, \fBinit\fP and \fBreset\fP. - In this implementation, \fBclear\fP is part of the \fIcapname\fR support. --Other implementations of \fBtput\fP on -+Other implementations of \fB@TPUT@\fP on - SVr4-based systems such as Solaris, IRIX64 and HPUX - as well as others such as AIX and Tru64 - provide support for \fIcapname\fR operands. -+.PP - A few platforms such as FreeBSD and NetBSD recognize termcap names rather --than terminfo capability names in their respective \fBtput\fP commands. -+than terminfo capability names in their respective \fB@TPUT@\fP commands. -+.PP -+Most implementations which provide support for \fIcapname\fR operands -+use the \fItparm\fP function to expand parameters in it. -+That function expects a mixture of numeric and string parameters, -+requiring \fB@TPUT@\fP to know which type to use. -+This implementation uses a table to determine that for -+the standard \fIcapname\fR operands, and an internal library -+function to analyze nonstandard \fIcapname\fR operands. -+Other implementations may simply guess that an operand containing only digits -+is intended to be a number. - .SH SEE ALSO - \fB@CLEAR@\fR(1), - \fBstty\fR(1), - \fBtabs\fR(\*n), --\fBterminfo\fR(5). -+\fBterminfo\fR(5), -+\fBcurs_termcap\fR(3X). - .PP - This describes \fBncurses\fR - version @NCURSES_MAJOR@.@NCURSES_MINOR@ (patch @NCURSES_PATCH@). -diff -Naur ncurses-5.9/man/tset.1 ncurses-5.9.patch/man/tset.1 ---- ncurses-5.9/man/tset.1 2010-12-04 19:38:55.000000000 +0100 -+++ ncurses-5.9.patch/man/tset.1 2014-09-01 16:33:22.351792114 +0200 -@@ -1,5 +1,5 @@ - .\"*************************************************************************** --.\" Copyright (c) 1998-2008,2010 Free Software Foundation, Inc. * -+.\" Copyright (c) 1998-2011,2013 Free Software Foundation, Inc. * - .\" * - .\" Permission is hereby granted, free of charge, to any person obtaining a * - .\" copy of this software and associated documentation files (the * -@@ -26,12 +26,16 @@ - .\" authorization. * - .\"*************************************************************************** - .\" --.\" $Id: tset.1,v 1.25 2010/12/04 18:38:55 tom Exp $ -+.\" $Id: tset.1,v 1.29 2013/12/21 22:15:53 tom Exp $ - .TH @TSET@ 1 "" -+.ie \n(.g .ds `` \(lq -+.el .ds `` `` -+.ie \n(.g .ds '' \(rq -+.el .ds '' '' - .SH NAME --\fBtset\fR, \fBreset\fR \- terminal initialization -+\fB@TSET@\fR, \fBreset\fR \- terminal initialization - .SH SYNOPSIS --\fBtset\fR [\fB\-IQVcqrsw\fR] [\fB\-\fR] [\fB\-e\fR \fIch\fR] [\fB\-i\fR \fIch\fR] [\fB\-k\fR \fIch\fR] [\fB\-m\fR \fImapping\fR] [\fIterminal\fR] -+\fB@TSET@\fR [\fB\-IQVcqrsw\fR] [\fB\-\fR] [\fB\-e\fR \fIch\fR] [\fB\-i\fR \fIch\fR] [\fB\-k\fR \fIch\fR] [\fB\-m\fR \fImapping\fR] [\fIterminal\fR] - .br - \fBreset\fR [\fB\-IQVcqrsw\fR] [\fB\-\fR] [\fB\-e\fR \fIch\fR] [\fB\-i\fR \fIch\fR] [\fB\-k\fR \fIch\fR] [\fB\-m\fR \fImapping\fR] [\fIterminal\fR] - .SH DESCRIPTION -@@ -49,13 +53,13 @@ - \fIgetty\fR does this job by setting - \fBTERM\fR according to the type passed to it by \fI/etc/inittab\fR.) - .PP --4. The default terminal type, ``unknown''. -+4. The default terminal type, \*(``unknown\*(''. - .PP - If the terminal type was not specified on the command-line, the \fB\-m\fR - option mappings are then applied (see the section - .B TERMINAL TYPE MAPPING - for more information). --Then, if the terminal type begins with a question mark (``?''), the -+Then, if the terminal type begins with a question mark (\*(``?\*(''), the - user is prompted for confirmation of the terminal type. An empty - response confirms the type, or, another type can be entered to specify - a new type. Once the terminal type has been determined, the terminfo -@@ -72,7 +76,7 @@ - versus the other initialization. - If neither option is given, both are assumed. - .PP --When invoked as \fBreset\fR, \fBtset\fR sets cooked and echo modes, -+When invoked as \fBreset\fR, \fB@TSET@\fR sets cooked and echo modes, - turns off cbreak and raw modes, turns on newline translation and - resets any unset special characters to their default values before - doing the terminal initialization described above. This is useful -@@ -89,6 +93,7 @@ - .TP 5 - .B \-c - Set control characters and modes. -+.TP 5 - .B \-e - Set the erase character to \fIch\fR. - .TP -@@ -109,7 +114,7 @@ - .TP - .B \-Q - Do not display any values for the erase, interrupt and line kill characters. --Normally \fBtset\fR displays the values for control characters which -+Normally \fB@TSET@\fR displays the values for control characters which - differ from the system's default values. - .TP - .B \-q -@@ -137,7 +142,7 @@ - .PP - The arguments for the \fB\-e\fR, \fB\-i\fR, and \fB\-k\fR - options may either be entered as actual characters or by using the `hat' --notation, i.e., control-h may be specified as ``^H'' or ``^h''. -+notation, i.e., control-h may be specified as \*(``^H\*('' or \*(``^h\*(''. - . - .SH SETTING THE ENVIRONMENT - It is often desirable to enter the terminal type and information about -@@ -146,35 +151,41 @@ - .PP - When the \fB\-s\fR option is specified, the commands to enter the information - into the shell's environment are written to the standard output. If --the \fBSHELL\fR environmental variable ends in ``csh'', the commands -+the \fBSHELL\fR environmental variable ends in \*(``csh\*('', the commands - are for \fBcsh\fR, otherwise, they are for \fBsh\fR. - Note, the \fBcsh\fR commands set and unset the shell variable - \fBnoglob\fR, leaving it unset. The following line in the \fB.login\fR - or \fB.profile\fR files will initialize the environment correctly: - .sp -- eval \`tset \-s options ... \` -+ eval \`@TSET@ \-s options ... \` - . - .SH TERMINAL TYPE MAPPING - When the terminal is not hardwired into the system (or the current - system information is incorrect) the terminal type derived from the - \fI/etc/ttys\fR file or the \fBTERM\fR environmental variable is often - something generic like \fBnetwork\fR, \fBdialup\fR, or \fBunknown\fR. --When \fBtset\fR is used in a startup script it is often desirable to -+When \fB@TSET@\fR is used in a startup script it is often desirable to - provide information about the type of terminal used on such ports. - .PP - The purpose of the \fB\-m\fR option is to map - from some set of conditions to a terminal type, that is, to --tell \fBtset\fR --``If I'm on this port at a particular speed, guess that I'm on that --kind of terminal''. -+tell \fB@TSET@\fR -+\*(``If I'm on this port at a particular speed, -+guess that I'm on that kind of terminal\*(''. - .PP - The argument to the \fB\-m\fR option consists of an optional port type, an - optional operator, an optional baud rate specification, an optional --colon (``:'') character and a terminal type. The port type is a --string (delimited by either the operator or the colon character). The --operator may be any combination of ``>'', ``<'', ``@'', and ``!''; ``>'' --means greater than, ``<'' means less than, ``@'' means equal to --and ``!'' inverts the sense of the test. -+colon (\*(``:\*('') character and a terminal type. The port type is a -+string (delimited by either the operator or the colon character). -+The operator may be any combination of -+\*(``>\*('', -+\*(``<\*('', -+\*(``@\*('', -+and \*(``!\*(''; -+\*(``>\*('' means greater than, -+\*(``<\*('' means less than, -+\*(``@\*('' means equal to and -+\*(``!\*('' inverts the sense of the test. - The baud rate is specified as a number and is compared with the speed - of the standard error output (which should be the control terminal). - The terminal type is a string. -@@ -204,53 +215,57 @@ - No whitespace characters are permitted in the \fB\-m\fR option argument. - Also, to avoid problems with meta-characters, it is suggested that the - entire \fB\-m\fR option argument be placed within single quote characters, --and that \fBcsh\fR users insert a backslash character (``\e'') before --any exclamation marks (``!''). -+and that \fBcsh\fR users insert a backslash character (\*(``\e\*('') before -+any exclamation marks (\*(``!\*(''). - .SH HISTORY --The \fBtset\fR command appeared in BSD 3.0. The \fBncurses\fR implementation -+The \fB@TSET@\fR command appeared in BSD 3.0. The \fBncurses\fR implementation - was lightly adapted from the 4.4BSD sources for a terminfo environment by Eric - S. Raymond <esr@snark.thyrsus.com>. - .SH COMPATIBILITY --The \fBtset\fR utility has been provided for backward-compatibility with BSD -+The \fB@TSET@\fR utility has been provided for backward-compatibility with BSD - environments (under most modern UNIXes, \fB/etc/inittab\fR and \fIgetty\fR(1) - can set \fBTERM\fR appropriately for each dial-up line; this obviates what was --\fBtset\fR's most important use). This implementation behaves like 4.4BSD -+\fB@TSET@\fR's most important use). This implementation behaves like 4.4BSD - tset, with a few exceptions specified here. - .PP --The \fB\-S\fR option of BSD tset no longer works; it prints an error message to stderr --and dies. The \fB\-s\fR option only sets \fBTERM\fR, not \fBTERMCAP\fP. Both these --changes are because the \fBTERMCAP\fR variable is no longer supported under --terminfo-based \fBncurses\fR, which makes \fBtset \-S\fR useless (we made it die --noisily rather than silently induce lossage). -+The \fB\-S\fR option of BSD tset no longer works; -+it prints an error message to stderr and dies. -+The \fB\-s\fR option only sets \fBTERM\fR, not \fBTERMCAP\fP. -+Both of these changes are because the \fBTERMCAP\fR variable -+is no longer supported under terminfo-based \fBncurses\fR, -+which makes \fB@TSET@ \-S\fR useless -+(we made it die noisily rather than silently induce lossage). - .PP - There was an undocumented 4.4BSD feature that invoking tset via a link named - `TSET` (or via any other name beginning with an upper-case letter) set the - terminal to use upper-case only. This feature has been omitted. - .PP - The \fB\-A\fR, \fB\-E\fR, \fB\-h\fR, \fB\-u\fR and \fB\-v\fR --options were deleted from the \fBtset\fR -+options were deleted from the \fB@TSET@\fR - utility in 4.4BSD. - None of them were documented in 4.3BSD and all are - of limited utility at best. - The \fB\-a\fR, \fB\-d\fR, and \fB\-p\fR options are similarly - not documented or useful, but were retained as they appear to be in - widespread use. It is strongly recommended that any usage of these --three options be changed to use the \fB\-m\fR option instead. The --\fB\-n\fP option remains, but has no effect. The \fB\-adnp\fR options are therefore --omitted from the usage summary above. --.PP --It is still permissible to specify the \fB\-e\fR, \fB\-i\fR, and \fB\-k\fR options without --arguments, although it is strongly recommended that such usage be fixed to -+three options be changed to use the \fB\-m\fR option instead. -+The \fB\-n\fP option remains, but has no effect. -+The \fB\-adnp\fR options are therefore omitted from the usage summary above. -+.PP -+It is still permissible to specify the \fB\-e\fR, \fB\-i\fR, -+and \fB\-k\fR options without arguments, -+although it is strongly recommended that such usage be fixed to - explicitly specify the character. - .PP --As of 4.4BSD, executing \fBtset\fR as \fBreset\fR no longer implies the \fB\-Q\fR --option. Also, the interaction between the \- option and the \fIterminal\fR --argument in some historic implementations of \fBtset\fR has been removed. -+As of 4.4BSD, -+executing \fB@TSET@\fR as \fBreset\fR no longer implies the \fB\-Q\fR option. -+Also, the interaction between the \- option and the \fIterminal\fR -+argument in some historic implementations of \fB@TSET@\fR has been removed. - .SH ENVIRONMENT --The \fBtset\fR command uses these environment variables: -+The \fB@TSET@\fR command uses these environment variables: - .TP 5 - SHELL --tells \fBtset\fP whether to initialize \fBTERM\fP using \fBsh\fP or -+tells \fB@TSET@\fP whether to initialize \fBTERM\fP using \fBsh\fP or - \fBcsh\fP syntax. - .TP 5 - TERM -@@ -260,7 +275,7 @@ - TERMCAP - may denote the location of a termcap database. - If it is not an absolute pathname, e.g., begins with a `/', --\fBtset\fP removes the variable from the environment before looking -+\fB@TSET@\fP removes the variable from the environment before looking - for the terminal description. - .SH FILES - .TP 5 -@@ -270,6 +285,7 @@ - @TERMINFO@ - terminal capability database - .SH SEE ALSO -+.hy 0 - csh(1), - sh(1), - stty(1), -@@ -278,6 +294,7 @@ - terminfo(5), - ttys(5), - environ(7) -+.hy - .PP - This describes \fBncurses\fR - version @NCURSES_MAJOR@.@NCURSES_MINOR@ (patch @NCURSES_PATCH@). -diff -Naur ncurses-5.9/MANIFEST ncurses-5.9.patch/MANIFEST ---- ncurses-5.9/MANIFEST 2011-03-28 02:29:04.000000000 +0200 -+++ ncurses-5.9.patch/MANIFEST 2014-09-01 16:33:22.228791910 +0200 -@@ -190,6 +190,7 @@ - ./Ada95/src/terminal_interface-curses-text_io.ads - ./Ada95/src/terminal_interface-curses-trace.adb_p - ./Ada95/src/terminal_interface.ads -+./COPYING - ./INSTALL - ./MANIFEST - ./Makefile.in -@@ -545,6 +546,8 @@ - ./include/nc_alloc.h - ./include/nc_mingw.h - ./include/nc_panel.h -+./include/nc_string.h -+./include/nc_termios.h - ./include/nc_tparm.h - ./include/ncurses_cfg.hin - ./include/ncurses_defs -@@ -656,6 +659,8 @@ - ./man/legacy_coding.3x - ./man/make_sed.sh - ./man/man_db.renames -+./man/manhtml.aliases -+./man/manhtml.externs - ./man/manlinks.sed - ./man/menu.3x - ./man/menu_attributes.3x -@@ -764,7 +769,6 @@ - ./mk-0th.awk - ./mk-1st.awk - ./mk-2nd.awk --./mk-dlls.sh.in - ./mk-hdr.awk - ./ncurses/Makefile.in - ./ncurses/README -@@ -850,7 +854,6 @@ - ./ncurses/base/lib_wattron.c - ./ncurses/base/lib_winch.c - ./ncurses/base/lib_window.c --./ncurses/base/memmove.c - ./ncurses/base/nc_panel.c - ./ncurses/base/resizeterm.c - ./ncurses/base/safe_sprintf.c -@@ -867,6 +870,14 @@ - ./ncurses/llib-lncursest - ./ncurses/llib-lncursestw - ./ncurses/llib-lncursesw -+./ncurses/llib-ltic -+./ncurses/llib-ltict -+./ncurses/llib-ltictw -+./ncurses/llib-lticw -+./ncurses/llib-ltinfo -+./ncurses/llib-ltinfot -+./ncurses/llib-ltinfotw -+./ncurses/llib-ltinfow - ./ncurses/modules - ./ncurses/tinfo/MKcaptab.awk - ./ncurses/tinfo/MKcaptab.sh -@@ -915,10 +926,10 @@ - ./ncurses/tinfo/make_hash.c - ./ncurses/tinfo/make_keys.c - ./ncurses/tinfo/name_match.c -+./ncurses/tinfo/obsolete.c - ./ncurses/tinfo/parse_entry.c - ./ncurses/tinfo/read_entry.c - ./ncurses/tinfo/read_termcap.c --./ncurses/tinfo/setbuf.c - ./ncurses/tinfo/strings.c - ./ncurses/tinfo/tinfo_driver.c - ./ncurses/tinfo/trim_sgr0.c -@@ -943,8 +954,6 @@ - ./ncurses/tty/lib_tstp.c - ./ncurses/tty/lib_twait.c - ./ncurses/tty/lib_vidattr.c --./ncurses/tty/tty_display.h --./ncurses/tty/tty_input.h - ./ncurses/tty/tty_update.c - ./ncurses/wcwidth.h - ./ncurses/widechar/charable.c -@@ -967,9 +976,34 @@ - ./ncurses/widechar/lib_vline_set.c - ./ncurses/widechar/lib_wacs.c - ./ncurses/widechar/lib_wunctrl.c -+./ncurses/widechar/widechars.c - ./ncurses/win32con/gettimeofday.c - ./ncurses/win32con/wcwidth.c - ./ncurses/win32con/win_driver.c -+./package/debian-mingw/changelog -+./package/debian-mingw/compat -+./package/debian-mingw/control -+./package/debian-mingw/copyright -+./package/debian-mingw/rules -+./package/debian-mingw/source/format -+./package/debian-mingw/watch -+./package/debian-mingw64/changelog -+./package/debian-mingw64/compat -+./package/debian-mingw64/control -+./package/debian-mingw64/copyright -+./package/debian-mingw64/rules -+./package/debian-mingw64/source/format -+./package/debian-mingw64/watch -+./package/debian/changelog -+./package/debian/compat -+./package/debian/control -+./package/debian/copyright -+./package/debian/rules -+./package/debian/source/format -+./package/debian/watch -+./package/mingw-ncurses.nsi -+./package/mingw-ncurses.spec -+./package/ncurses.spec - ./panel/Makefile.in - ./panel/headers - ./panel/llib-lpanel -@@ -1022,12 +1056,14 @@ - ./test/cardfile.dat - ./test/chgat.c - ./test/clip_printw.c -+./test/color_name.h - ./test/color_set.c - ./test/configure - ./test/configure.in - ./test/demo_altkeys.c - ./test/demo_defkey.c - ./test/demo_forms.c -+./test/demo_forms.txt - ./test/demo_keyok.c - ./test/demo_menus.c - ./test/demo_panels.c -@@ -1036,6 +1072,7 @@ - ./test/ditto.c - ./test/dots.c - ./test/dots_mvcur.c -+./test/dots_termcap.c - ./test/echochar.c - ./test/edit_field.c - ./test/edit_field.h -@@ -1043,6 +1080,7 @@ - ./test/firework.c - ./test/firstlast.c - ./test/foldkeys.c -+./test/form_driver_w.c - ./test/gdc.6 - ./test/gdc.c - ./test/hanoi.c -@@ -1073,6 +1111,7 @@ - ./test/package/debian/rules - ./test/package/debian/source/format - ./test/package/debian/watch -+./test/package/mingw-ncurses-examples.spec - ./test/package/ncurses-examples.spec - ./test/programs - ./test/railroad.c -@@ -1092,12 +1131,15 @@ - ./test/test_instr.c - ./test/test_inwstr.c - ./test/test_opaque.c -+./test/test_vid_puts.c -+./test/test_vidputs.c - ./test/testaddch.c - ./test/testcurs.c - ./test/testscanw.c - ./test/tracemunch - ./test/view.c - ./test/widechars-utf8.txt -+./test/widechars.h - ./test/worm.c - ./test/xmas.c - ./test/xterm-16color.dat -diff -Naur ncurses-5.9/menu/Makefile.in ncurses-5.9.patch/menu/Makefile.in ---- ncurses-5.9/menu/Makefile.in 2010-11-27 22:45:27.000000000 +0100 -+++ ncurses-5.9.patch/menu/Makefile.in 2014-09-01 16:33:22.351792114 +0200 -@@ -1,6 +1,6 @@ --# $Id: Makefile.in,v 1.54 2010/11/27 21:45:27 tom Exp $ -+# $Id: Makefile.in,v 1.57 2013/08/04 20:23:27 tom Exp $ - ############################################################################## --# Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. # -+# Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. # - # # - # Permission is hereby granted, free of charge, to any person obtaining a # - # copy of this software and associated documentation files (the "Software"), # -@@ -57,6 +57,9 @@ - bindir = @bindir@ - libdir = @libdir@ - includedir = @includedir@ -+includesubdir = @includesubdir@ -+ -+INCLUDEDIR = $(DESTDIR)$(includedir)$(includesubdir) - - LIBTOOL = @LIBTOOL@ - LIBTOOL_CLEAN = @LIB_CLEAN@ -@@ -102,6 +105,7 @@ - SHLIB_DIRS = -L../lib - SHLIB_LIST = $(SHLIB_DIRS) -lncurses@LIB_SUFFIX@ @SHLIB_LIST@ - -+RPATH_LIST = @RPATH_LIST@ - MK_SHARED_LIB = @MK_SHARED_LIB@ - - NCURSES_MAJOR = @NCURSES_MAJOR@ -@@ -111,7 +115,7 @@ - - RANLIB = @LIB_PREP@ - --LIBRARIES = @LIBS_TO_MAKE@ -+LIBRARIES = @Libs_To_Make@ - - LINT = @LINT@ - LINT_OPTS = @LINT_OPTS@ -diff -Naur ncurses-5.9/menu/m_attribs.c ncurses-5.9.patch/menu/m_attribs.c ---- ncurses-5.9/menu/m_attribs.c 2010-01-23 22:16:54.000000000 +0100 -+++ ncurses-5.9.patch/menu/m_attribs.c 2014-09-01 16:33:22.352792116 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2004,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -37,7 +37,7 @@ - - #include "menu.priv.h" - --MODULE_ID("$Id: m_attribs.c,v 1.16 2010/01/23 21:16:54 tom Exp $") -+MODULE_ID("$Id: m_attribs.c,v 1.17 2012/03/10 23:43:41 tom Exp $") - - /* Macro to redraw menu if it is posted and changed */ - #define Refresh_Menu(menu) \ -@@ -51,7 +51,7 @@ - #define GEN_MENU_ATTR_SET_FCT( name ) \ - NCURSES_IMPEXP int NCURSES_API set_menu_ ## name (MENU* menu, chtype attr) \ - {\ -- T((T_CALLED("set_menu_" #name "(%p,%s)"), menu, _traceattr(attr))); \ -+ T((T_CALLED("set_menu_" #name "(%p,%s)"), (void *) menu, _traceattr(attr))); \ - if (!(attr==A_NORMAL || (attr & A_ATTRIBUTES)==attr))\ - RETURN(E_BAD_ARGUMENT);\ - if (menu && ( menu -> name != attr))\ -diff -Naur ncurses-5.9/menu/m_driver.c ncurses-5.9.patch/menu/m_driver.c ---- ncurses-5.9/menu/m_driver.c 2010-01-23 22:20:10.000000000 +0100 -+++ ncurses-5.9.patch/menu/m_driver.c 2014-09-01 16:33:22.352792116 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -37,7 +37,7 @@ - - #include "menu.priv.h" - --MODULE_ID("$Id: m_driver.c,v 1.29 2010/01/23 21:20:10 tom Exp $") -+MODULE_ID("$Id: m_driver.c,v 1.31 2012/03/10 23:43:41 tom Exp $") - - /* Macros */ - -@@ -47,7 +47,7 @@ - - /* Add a new character to the match pattern buffer */ - #define Add_Character_To_Pattern(menu,ch) \ -- { (menu)->pattern[((menu)->pindex)++] = (ch);\ -+ { (menu)->pattern[((menu)->pindex)++] = (char) (ch);\ - (menu)->pattern[(menu)->pindex] = '\0'; } - - /*--------------------------------------------------------------------------- -@@ -537,7 +537,11 @@ - result = E_UNKNOWN_COMMAND; - } - -- if (E_OK == result) -+ if (item == 0) -+ { -+ result = E_BAD_STATE; -+ } -+ else if (E_OK == result) - { - /* Adjust the top row if it turns out that the current item unfortunately - doesn't appear in the menu window */ -diff -Naur ncurses-5.9/menu/menu.priv.h ncurses-5.9.patch/menu/menu.priv.h ---- ncurses-5.9/menu/menu.priv.h 2009-02-28 22:02:57.000000000 +0100 -+++ ncurses-5.9.patch/menu/menu.priv.h 2014-09-01 16:33:22.353792118 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2005,2009 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2009,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -30,7 +30,7 @@ - * Author: Juergen Pfeifer, 1995,1997 * - ****************************************************************************/ - --/* $Id: menu.priv.h,v 1.23 2009/02/28 21:02:57 juergen Exp $ */ -+/* $Id: menu.priv.h,v 1.24 2012/03/10 23:43:41 tom Exp $ */ - - /*************************************************************************** - * Module menu.priv.h * -@@ -39,6 +39,7 @@ - - #ifndef MENU_PRIV_H_incl - #define MENU_PRIV_H_incl 1 -+/* *INDENT-OFF* */ - - #include "curses.priv.h" - #include "mf_common.h" -@@ -99,10 +100,11 @@ - */ - #define Adjust_Current_Item(menu,row,item) \ - { if ((item)->y < row) \ -- row = (item)->y;\ -- if ( (item)->y >= (row + (menu)->arows) )\ -- row = ( (item)->y < ((menu)->rows - row) ) ? \ -- (item)->y : (menu)->rows - (menu)->arows;\ -+ row = (short) (item)->y; \ -+ if ( (item)->y >= (row + (menu)->arows) ) \ -+ row = (short) (( (item)->y < ((menu)->rows - row) ) \ -+ ? (item)->y \ -+ : (menu)->rows - (menu)->arows); \ - _nc_New_TopRow_and_CurrentItem(menu,row,item); } - - /* Reset the match pattern buffer */ -@@ -152,5 +154,6 @@ - #define returnMenuOpts(code) return code - - #endif /* TRACE/!TRACE */ -+/* *INDENT-ON* */ - - #endif /* MENU_PRIV_H_incl */ -diff -Naur ncurses-5.9/menu/mf_common.h ncurses-5.9.patch/menu/mf_common.h ---- ncurses-5.9/menu/mf_common.h 2005-11-26 16:26:52.000000000 +0100 -+++ ncurses-5.9.patch/menu/mf_common.h 2014-09-01 16:33:22.353792118 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2004,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -30,7 +30,7 @@ - * Author: Juergen Pfeifer, 1995,1997 * - ****************************************************************************/ - --/* $Id: mf_common.h,v 0.22 2005/11/26 15:26:52 tom Exp $ */ -+/* $Id: mf_common.h,v 0.24 2012/06/10 00:06:54 tom Exp $ */ - - /* Common internal header for menu and form library */ - -@@ -63,10 +63,9 @@ - #if USE_RCS_IDS - #define MODULE_ID(id) static const char Ident[] = id; - #else --#define MODULE_ID(id) /*nothing*/ -+#define MODULE_ID(id) /*nothing */ - #endif - -- - /* Maximum regular 8-bit character code */ - #define MAX_REGULAR_CHARACTER (0xff) - -@@ -80,16 +79,19 @@ - #endif - - /* The few common values in the status fields for menus and forms */ --#define _POSTED (0x01U) /* menu or form is posted */ --#define _IN_DRIVER (0x02U) /* menu or form is processing hook routine */ -+#define _POSTED (0x01U) /* menu or form is posted */ -+#define _IN_DRIVER (0x02U) /* menu or form is processing hook routine */ -+ -+#define SetStatus(target,mask) (target)->status |= (unsigned short) (mask) -+#define ClrStatus(target,mask) (target)->status = (unsigned short) (target->status & (~mask)) - - /* Call object hook */ - #define Call_Hook( object, handler ) \ - if ( (object) != 0 && ((object)->handler) != (void *) 0 )\ - {\ -- (object)->status |= _IN_DRIVER;\ -+ SetStatus(object, _IN_DRIVER);\ - (object)->handler(object);\ -- (object)->status &= ~_IN_DRIVER;\ -+ ClrStatus(object, _IN_DRIVER);\ - } - - #endif /* MF_COMMON_H_incl */ -diff -Naur ncurses-5.9/menu/m_format.c ncurses-5.9.patch/menu/m_format.c ---- ncurses-5.9/menu/m_format.c 2010-01-23 22:20:10.000000000 +0100 -+++ ncurses-5.9.patch/menu/m_format.c 2014-09-01 16:33:22.352792116 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2004,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -37,7 +37,7 @@ - - #include "menu.priv.h" - --MODULE_ID("$Id: m_format.c,v 1.16 2010/01/23 21:20:10 tom Exp $") -+MODULE_ID("$Id: m_format.c,v 1.18 2012/06/09 23:54:02 tom Exp $") - - #define minimum(a,b) ((a)<(b) ? (a): (b)) - -@@ -81,8 +81,8 @@ - if (menu->pattern) - Reset_Pattern(menu); - -- menu->frows = rows; -- menu->fcols = cols; -+ menu->frows = (short)rows; -+ menu->fcols = (short)cols; - - assert(rows > 0 && cols > 0); - total_rows = (menu->nitems - 1) / cols + 1; -@@ -90,21 +90,21 @@ - minimum(menu->nitems, cols) : - (menu->nitems - 1) / total_rows + 1; - -- menu->rows = total_rows; -- menu->cols = total_cols; -- menu->arows = minimum(total_rows, rows); -+ menu->rows = (short)total_rows; -+ menu->cols = (short)total_cols; -+ menu->arows = (short)minimum(total_rows, rows); - menu->toprow = 0; - menu->curitem = *(menu->items); - assert(menu->curitem); -- menu->status |= _LINK_NEEDED; -+ SetStatus(menu, _LINK_NEEDED); - _nc_Calculate_Item_Length_and_Width(menu); - } - else - { - if (rows > 0) -- _nc_Default_Menu.frows = rows; -+ _nc_Default_Menu.frows = (short)rows; - if (cols > 0) -- _nc_Default_Menu.fcols = cols; -+ _nc_Default_Menu.fcols = (short)cols; - } - - RETURN(E_OK); -diff -Naur ncurses-5.9/menu/m_global.c ncurses-5.9.patch/menu/m_global.c ---- ncurses-5.9/menu/m_global.c 2010-01-23 22:20:10.000000000 +0100 -+++ ncurses-5.9.patch/menu/m_global.c 2014-09-01 16:34:19.463887194 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2012,2014 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -37,7 +37,7 @@ - - #include "menu.priv.h" - --MODULE_ID("$Id: m_global.c,v 1.25 2010/01/23 21:20:10 tom Exp $") -+MODULE_ID("$Id: m_global.c,v 1.28 2014/03/15 20:37:22 tom Exp $") - - static char mark[] = "-"; - /* *INDENT-OFF* */ -@@ -117,17 +117,17 @@ - assert(menu && menu->items); - for (items = menu->items; *items; items++) - { -- check = _nc_Calculate_Text_Width(&((*items)->name)); -+ check = (unsigned)_nc_Calculate_Text_Width(&((*items)->name)); - if (check > MaximumNameLength) - MaximumNameLength = check; - -- check = _nc_Calculate_Text_Width(&((*items)->description)); -+ check = (unsigned)_nc_Calculate_Text_Width(&((*items)->description)); - if (check > MaximumDescriptionLength) - MaximumDescriptionLength = check; - } - -- menu->namelen = MaximumNameLength; -- menu->desclen = MaximumDescriptionLength; -+ menu->namelen = (short)MaximumNameLength; -+ menu->desclen = (short)MaximumDescriptionLength; - T(("ComputeMaximum_NameDesc_Lengths %d,%d", menu->namelen, menu->desclen)); - } - -@@ -195,7 +195,7 @@ - { - (*item)->value = FALSE; - } -- (*item)->index = ItemCount++; -+ (*item)->index = (short)ItemCount++; - (*item)->imenu = menu; - } - } -@@ -206,7 +206,7 @@ - if (ItemCount != 0) - { - menu->items = items; -- menu->nitems = ItemCount; -+ menu->nitems = (short)ItemCount; - ComputeMaximum_NameDesc_Lengths(menu); - if ((menu->pattern = typeMalloc(char, (unsigned)(1 + menu->namelen)))) - { -@@ -256,7 +256,7 @@ - T((T_CALLED("_nc_menu_text_width(%p)"), (const void *)item)); - if (result != 0 && item->str != 0) - { -- int count = mbstowcs(0, item->str, 0); -+ int count = (int)mbstowcs(0, item->str, 0); - wchar_t *temp = 0; - - if (count > 0 -@@ -343,7 +343,7 @@ - - assert(menu); - -- menu->height = 1 + menu->spc_rows * (menu->arows - 1); -+ menu->height = (short)(1 + menu->spc_rows * (menu->arows - 1)); - - l = calculate_actual_width(menu, TRUE); - l += menu->marklen; -@@ -354,10 +354,10 @@ - l += menu->spc_desc; - } - -- menu->itemlen = l; -+ menu->itemlen = (short)l; - l *= menu->cols; - l += (menu->cols - 1) * menu->spc_cols; /* for the padding between the columns */ -- menu->width = l; -+ menu->width = (short)l; - - T(("_nc_CalculateItem_Length_and_Width columns %d, item %d, width %d", - menu->cols, -@@ -388,7 +388,7 @@ - int Last_in_Column; - bool cycle = (menu->opt & O_NONCYCLIC) ? FALSE : TRUE; - -- menu->status &= ~_LINK_NEEDED; -+ ClrStatus(menu, _LINK_NEEDED); - - if (menu->opt & O_ROWMAJOR) - { -@@ -431,8 +431,8 @@ - (cycle ? menu->items[(row + 1) < menu->rows ? - Number_Of_Items - 1 : col] : - (ITEM *) 0); -- item->x = col; -- item->y = row; -+ item->x = (short)col; -+ item->y = (short)row; - if (++col == Number_Of_Columns) - { - row++; -@@ -482,8 +482,8 @@ - (ITEM *) 0 - ); - -- item->x = col; -- item->y = row; -+ item->x = (short)col; -+ item->y = (short)row; - if ((++row) == Number_Of_Rows) - { - col++; -@@ -568,7 +568,9 @@ - - cur_item = menu->curitem; - assert(cur_item); -- menu->toprow = new_toprow; -+ menu->toprow = (short)(((menu->rows - menu->frows) >= 0) -+ ? min(menu->rows - menu->frows, new_toprow) -+ : 0); - menu->curitem = new_current_item; - - if (mterm_called) -@@ -590,7 +592,9 @@ - } - else - { /* if we are not posted, this is quite simple */ -- menu->toprow = new_toprow; -+ menu->toprow = (short)(((menu->rows - menu->frows) >= 0) -+ ? min(menu->rows - menu->frows, new_toprow) -+ : 0); - menu->curitem = new_current_item; - } - } -diff -Naur ncurses-5.9/menu/m_hook.c ncurses-5.9.patch/menu/m_hook.c ---- ncurses-5.9/menu/m_hook.c 2010-01-23 22:16:54.000000000 +0100 -+++ ncurses-5.9.patch/menu/m_hook.c 2014-09-01 16:33:22.352792116 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2004,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -37,13 +37,13 @@ - - #include "menu.priv.h" - --MODULE_ID("$Id: m_hook.c,v 1.15 2010/01/23 21:16:54 tom Exp $") -+MODULE_ID("$Id: m_hook.c,v 1.16 2012/03/10 23:43:41 tom Exp $") - - /* "Template" macro to generate function to set application specific hook */ - #define GEN_HOOK_SET_FUNCTION( typ, name ) \ - NCURSES_IMPEXP int NCURSES_API set_ ## typ ## _ ## name (MENU *menu, Menu_Hook func )\ - {\ -- T((T_CALLED("set_" #typ "_" #name "(%p,%p)"), menu, func));\ -+ T((T_CALLED("set_" #typ "_" #name "(%p,%p)"), (void *) menu, func));\ - (Normalize_Menu(menu) -> typ ## name = func );\ - RETURN(E_OK);\ - } -diff -Naur ncurses-5.9/menu/m_item_new.c ncurses-5.9.patch/menu/m_item_new.c ---- ncurses-5.9/menu/m_item_new.c 2010-01-23 22:20:11.000000000 +0100 -+++ ncurses-5.9.patch/menu/m_item_new.c 2014-09-01 16:33:22.352792116 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -44,7 +44,7 @@ - #endif - #endif - --MODULE_ID("$Id: m_item_new.c,v 1.30 2010/01/23 21:20:11 tom Exp $") -+MODULE_ID("$Id: m_item_new.c,v 1.33 2012/06/09 23:55:15 tom Exp $") - - /*--------------------------------------------------------------------------- - | Facility : libnmenu -@@ -62,7 +62,7 @@ - int result = TRUE; - - #if USE_WIDEC_SUPPORT -- int count = mbstowcs(0, s, 0); -+ int count = (int)mbstowcs(0, s, 0); - wchar_t *temp = 0; - - assert(s); -@@ -127,13 +127,13 @@ - { - *item = _nc_Default_Item; /* hope we have struct assignment */ - -- item->name.length = strlen(name); -+ item->name.length = (unsigned short)strlen(name); - item->name.str = name; - - if (description && (*description != '\0') && - Is_Printable_String(description)) - { -- item->description.length = strlen(description); -+ item->description.length = (unsigned short)strlen(description); - item->description.str = description; - } - else -@@ -195,12 +195,12 @@ - NCURSES_EXPORT(int) - set_menu_mark(MENU * menu, const char *mark) - { -- unsigned l; -+ short l; - - T((T_CALLED("set_menu_mark(%p,%s)"), (void *)menu, _nc_visbuf(mark))); - - if (mark && (*mark != '\0') && Is_Printable_String(mark)) -- l = strlen(mark); -+ l = (short)strlen(mark); - else - l = 0; - -@@ -213,7 +213,7 @@ - { - /* If the menu is already posted, the geometry is fixed. Then - we can only accept a mark with exactly the same length */ -- if (menu->marklen != (int)l) -+ if (menu->marklen != l) - RETURN(E_BAD_ARGUMENT); - } - menu->marklen = l; -@@ -222,14 +222,13 @@ - menu->mark = strdup(mark); - if (menu->mark) - { -- strcpy(menu->mark, mark); - if (menu != &_nc_Default_Menu) -- menu->status |= _MARK_ALLOCATED; -+ SetStatus(menu, _MARK_ALLOCATED); - } - else - { - menu->mark = old_mark; -- menu->marklen = (old_mark != 0) ? strlen(old_mark) : 0; -+ menu->marklen = (short)((old_mark != 0) ? strlen(old_mark) : 0); - RETURN(E_SYSTEM_ERROR); - } - } -diff -Naur ncurses-5.9/menu/m_pad.c ncurses-5.9.patch/menu/m_pad.c ---- ncurses-5.9/menu/m_pad.c 2010-01-23 22:20:10.000000000 +0100 -+++ ncurses-5.9.patch/menu/m_pad.c 2014-09-01 16:33:22.352792116 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2004,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -37,7 +37,7 @@ - - #include "menu.priv.h" - --MODULE_ID("$Id: m_pad.c,v 1.12 2010/01/23 21:20:10 tom Exp $") -+MODULE_ID("$Id: m_pad.c,v 1.13 2012/03/10 23:43:41 tom Exp $") - - /* Macro to redraw menu if it is posted and changed */ - #define Refresh_Menu(menu) \ -@@ -69,7 +69,7 @@ - RETURN(E_BAD_ARGUMENT); - - Normalize_Menu(menu); -- menu->pad = pad; -+ menu->pad = (unsigned char)pad; - - if (do_refresh) - Refresh_Menu(menu); -diff -Naur ncurses-5.9/menu/m_post.c ncurses-5.9.patch/menu/m_post.c ---- ncurses-5.9/menu/m_post.c 2010-05-01 21:18:27.000000000 +0200 -+++ ncurses-5.9.patch/menu/m_post.c 2014-09-01 16:33:22.353792118 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -37,7 +37,7 @@ - - #include "menu.priv.h" - --MODULE_ID("$Id: m_post.c,v 1.29 2010/05/01 19:18:27 tom Exp $") -+MODULE_ID("$Id: m_post.c,v 1.31 2012/06/09 23:54:35 tom Exp $") - - /*--------------------------------------------------------------------------- - | Facility : libnmenu -@@ -67,7 +67,7 @@ - - it is a onevalued menu and it is the current item - - or it has a selection value - */ -- wattron(menu->win, menu->back); -+ wattron(menu->win, (int)menu->back); - if (item->value || (item == menu->curitem)) - { - if (menu->marklen) -@@ -79,13 +79,13 @@ - item. */ - if (!(menu->opt & O_ONEVALUE) && item->value && item != menu->curitem) - { -- wattron(menu->win, menu->fore); -+ wattron(menu->win, (int)menu->fore); - isfore = TRUE; - } - waddstr(menu->win, menu->mark); - if (isfore) - { -- wattron(menu->win, menu->fore); -+ wattron(menu->win, (int)menu->fore); - isfore = FALSE; - } - } -@@ -93,7 +93,7 @@ - else /* otherwise we have to wipe out the marker area */ - for (ch = ' ', i = menu->marklen; i > 0; i--) - waddch(menu->win, ch); -- wattroff(menu->win, menu->back); -+ wattroff(menu->win, (int)menu->back); - count += menu->marklen; - - /* First we have to calculate the attribute depending on selectability -@@ -101,19 +101,19 @@ - */ - if (!(item->opt & O_SELECTABLE)) - { -- wattron(menu->win, menu->grey); -+ wattron(menu->win, (int)menu->grey); - isgrey = TRUE; - } - else - { - if (item->value || item == menu->curitem) - { -- wattron(menu->win, menu->fore); -+ wattron(menu->win, (int)menu->fore); - isfore = TRUE; - } - else - { -- wattron(menu->win, menu->back); -+ wattron(menu->win, (int)menu->back); - isback = TRUE; - } - } -@@ -158,10 +158,10 @@ - assert(cx >= 0 && cy >= 0); - getyx(menu->win, ncy, ncx); - if (isgrey) -- wattroff(menu->win, menu->grey); -+ wattroff(menu->win, (int)menu->grey); - else if (isfore) -- wattroff(menu->win, menu->fore); -- wattron(menu->win, menu->back); -+ wattroff(menu->win, (int)menu->fore); -+ wattron(menu->win, (int)menu->back); - for (j = 1; j < menu->spc_rows; j++) - { - if ((item_y + j) < getmaxy(menu->win)) -@@ -175,17 +175,17 @@ - } - wmove(menu->win, ncy, ncx); - if (!isback) -- wattroff(menu->win, menu->back); -+ wattroff(menu->win, (int)menu->back); - } - } - - /* Remove attributes */ - if (isfore) -- wattroff(menu->win, menu->fore); -+ wattroff(menu->win, (int)menu->fore); - if (isback) -- wattroff(menu->win, menu->back); -+ wattroff(menu->win, (int)menu->back); - if (isgrey) -- wattroff(menu->win, menu->grey); -+ wattroff(menu->win, (int)menu->grey); - } - - /*--------------------------------------------------------------------------- -@@ -225,7 +225,7 @@ - { - _nc_Post_Item(menu, hitem); - -- wattron(menu->win, menu->back); -+ wattron(menu->win, (int)menu->back); - if (((hitem = hitem->right) != lasthor) && hitem) - { - int i, j, cy, cx; -@@ -244,7 +244,7 @@ - } - } - while (hitem && (hitem != lasthor)); -- wattroff(menu->win, menu->back); -+ wattroff(menu->win, (int)menu->back); - - item = item->down; - y += menu->spc_rows; -@@ -305,7 +305,7 @@ - else - RETURN(E_NOT_CONNECTED); - -- menu->status |= _POSTED; -+ SetStatus(menu, _POSTED); - - if (!(menu->opt & O_ONEVALUE)) - { -@@ -369,7 +369,7 @@ - delwin(menu->win); - menu->win = (WINDOW *)0; - -- menu->status &= ~_POSTED; -+ ClrStatus(menu, _POSTED); - - RETURN(E_OK); - } -diff -Naur ncurses-5.9/menu/m_req_name.c ncurses-5.9.patch/menu/m_req_name.c ---- ncurses-5.9/menu/m_req_name.c 2009-10-10 18:17:23.000000000 +0200 -+++ ncurses-5.9.patch/menu/m_req_name.c 2014-09-01 16:33:22.353792118 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2008,2009 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2009,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -37,7 +37,7 @@ - - #include "menu.priv.h" - --MODULE_ID("$Id: m_req_name.c,v 1.21 2009/10/10 16:17:23 tom Exp $") -+MODULE_ID("$Id: m_req_name.c,v 1.22 2012/07/21 23:27:32 tom Exp $") - - static const char *request_names[MAX_MENU_COMMAND - MIN_MENU_COMMAND + 1] = - { -@@ -99,23 +99,26 @@ - /* because the table is so small, it doesn't really hurt - to run sequentially through it. - */ -- unsigned int i = 0; -+ size_t i = 0; - char buf[16]; - - T((T_CALLED("menu_request_by_name(%s)"), _nc_visbuf(str))); - -- if (str) -+ if (str != 0 && (i = strlen(str)) != 0) - { -- strncpy(buf, str, sizeof(buf)); -- while ((i < sizeof(buf)) && (buf[i] != '\0')) -+ if (i > sizeof(buf) - 2) -+ i = sizeof(buf) - 2; -+ memcpy(buf, str, i); -+ buf[i] = '\0'; -+ -+ for (i = 0; buf[i] != '\0'; ++i) - { - buf[i] = (char)toupper(UChar(buf[i])); -- i++; - } - - for (i = 0; i < A_SIZE; i++) - { -- if (strncmp(request_names[i], buf, sizeof(buf)) == 0) -+ if (strcmp(request_names[i], buf) == 0) - returnCode(MIN_MENU_COMMAND + (int)i); - } - } -diff -Naur ncurses-5.9/menu/m_spacing.c ncurses-5.9.patch/menu/m_spacing.c ---- ncurses-5.9/menu/m_spacing.c 2010-01-23 22:20:10.000000000 +0100 -+++ ncurses-5.9.patch/menu/m_spacing.c 2014-09-01 16:33:22.353792118 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2004,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -37,7 +37,7 @@ - - #include "menu.priv.h" - --MODULE_ID("$Id: m_spacing.c,v 1.18 2010/01/23 21:20:10 tom Exp $") -+MODULE_ID("$Id: m_spacing.c,v 1.19 2012/03/10 23:43:41 tom Exp $") - - #define MAX_SPC_DESC ((TABSIZE) ? (TABSIZE) : 8) - #define MAX_SPC_COLS ((TABSIZE) ? (TABSIZE) : 8) -@@ -70,9 +70,9 @@ - ((s_col < 0) || (s_col > MAX_SPC_COLS))) - RETURN(E_BAD_ARGUMENT); - -- m->spc_desc = s_desc ? s_desc : 1; -- m->spc_rows = s_row ? s_row : 1; -- m->spc_cols = s_col ? s_col : 1; -+ m->spc_desc = (short)(s_desc ? s_desc : 1); -+ m->spc_rows = (short)(s_row ? s_row : 1); -+ m->spc_cols = (short)(s_col ? s_col : 1); - _nc_Calculate_Item_Length_and_Width(m); - - RETURN(E_OK); -diff -Naur ncurses-5.9/misc/gen_edit.sh ncurses-5.9.patch/misc/gen_edit.sh ---- ncurses-5.9/misc/gen_edit.sh 2004-07-11 17:01:29.000000000 +0200 -+++ ncurses-5.9.patch/misc/gen_edit.sh 2014-09-01 16:33:22.353792118 +0200 -@@ -1,6 +1,6 @@ - #!/bin/sh - ############################################################################## --# Copyright (c) 2004 Free Software Foundation, Inc. # -+# Copyright (c) 2004-2011,2012 Free Software Foundation, Inc. # - # # - # Permission is hereby granted, free of charge, to any person obtaining a # - # copy of this software and associated documentation files (the "Software"), # -@@ -29,7 +29,7 @@ - # - # Author: Thomas E. Dickey - # --# $Id: gen_edit.sh,v 1.1 2004/07/11 15:01:29 tom Exp $ -+# $Id: gen_edit.sh,v 1.5 2012/04/01 15:04:37 tom Exp $ - # Generate a sed-script for converting the terminfo.src to the form which will - # be installed. - # -@@ -37,22 +37,82 @@ - # The leaf directory names (lib, tabset, terminfo) - # - --: ${ticdir=@TERMINFO@} --: ${xterm_new=@WHICH_XTERM@} -+linux_dft=linux2.2 -+ -+: ${datadir=/usr/share} -+: ${WHICH_LINUX=$linux_dft} -+: ${WHICH_XTERM=xterm-new} -+: ${XTERM_KBS=BS} - - # If we're not installing into /usr/share/, we'll have to adjust the location - # of the tabset files in terminfo.src (which are in a parallel directory). --TABSET=`echo $ticdir | sed -e 's%/terminfo$%/tabset%'` -+TABSET=${datadir}/tabset - if test "x$TABSET" != "x/usr/share/tabset" ; then - cat <<EOF - s%/usr/share/tabset%$TABSET%g - EOF - fi - --if test "$xterm_new" != "xterm-new" ; then -+if test "$WHICH_XTERM" != "xterm-new" ; then -+echo "** using $WHICH_XTERM terminal description for XTerm entry" >&2 - cat <<EOF - /^# This is xterm for ncurses/,/^$/{ - s/use=xterm-new,/use=$WHICH_XTERM,/ - } - EOF - fi -+ -+if test "$XTERM_KBS" != "BS" ; then -+echo "** using DEL for XTerm backspace-key" >&2 -+cat <<EOF -+/^xterm+kbs|fragment for backspace key/,/^#/{ -+ s/kbs=^H,/kbs=^?,/ -+} -+EOF -+fi -+ -+# Work around incompatibities built into Linux console. The 2.6 series added -+# a patch to fixup the SI/SO behavior, which is closer to vt100, but the older -+# kernels do not recognize those controls. All of the kernels recognize the -+# older flavor of rmacs/smacs, but beginning in the late 1990s, changes made -+# as part of implementing UTF-8 prevent using those for line-drawing when the -+# console is in UTF-8 mode. Taking into account the fact that it took about -+# ten years to provide (and distribute) the 2.6 series' change for SI/SO, the -+# default remains "linux2.2". -+case x$WHICH_LINUX in #(vi -+xauto) -+ system=`uname -s 2>/dev/null` -+ if test "x$system" = xLinux -+ then -+ case x`uname -r` in -+ x1.*) -+ WHICH_LINUX=linux-c -+ ;; -+ x2.[0-4]*) -+ WHICH_LINUX=linux2.2 -+ ;; -+ *) -+ WHICH_LINUX=linux3.0 -+ ;; -+ esac -+ else -+ WHICH_LINUX=$linux_dft -+ fi -+ ;; -+xlinux*) -+ # allow specific setting -+ ;; -+*) -+ WHICH_LINUX=$linux_dft -+ ;; -+esac -+ -+if test $WHICH_LINUX != $linux_dft -+then -+echo "** using $WHICH_LINUX terminal description for Linux console" >&2 -+cat <<EOF -+/^# This is Linux console for ncurses/,/^$/{ -+ s/use=$linux_dft,/use=$WHICH_LINUX,/ -+} -+EOF -+fi -diff -Naur ncurses-5.9/misc/gen-pkgconfig.in ncurses-5.9.patch/misc/gen-pkgconfig.in ---- ncurses-5.9/misc/gen-pkgconfig.in 2010-02-06 23:12:07.000000000 +0100 -+++ ncurses-5.9.patch/misc/gen-pkgconfig.in 2014-09-01 16:33:22.353792118 +0200 -@@ -1,7 +1,7 @@ - #!@SHELL@ --# $Id: gen-pkgconfig.in,v 1.8 2010/02/06 22:12:07 Miroslav.Lichvar Exp $ -+# $Id: gen-pkgconfig.in,v 1.16 2014/01/18 20:21:45 tom Exp $ - ############################################################################## --# Copyright (c) 2009,2010 Free Software Foundation, Inc. # -+# Copyright (c) 2009-2013,2014 Free Software Foundation, Inc. # - # # - # Permission is hereby granted, free of charge, to any person obtaining a # - # copy of this software and associated documentation files (the "Software"), # -@@ -28,7 +28,7 @@ - # authorization. # - ############################################################################## - # --# Author: Thomas E. Dickey, 2009 -+# Author: Thomas E. Dickey - # - # The complete configure script for ncurses is the ncurses5-config (or similar - # name, depending on the flavor, e.g., ncursesw5-config, ncurses6-config, etc). -@@ -39,22 +39,22 @@ - # library, except that the tinfo library does not depend on ncurses. - LIB_NAME=@LIB_NAME@ - TINFO_NAME=@TINFO_NAME@ --PANEL_NAME=panel # @PANEL_NAME@ --MENU_NAME=menu # @MENU_NAME@ --FORM_NAME=form # @FORM_NAME@ --CXX_NAME=ncurses++ # @CXX_NAME@ -+PANEL_NAME=@PANEL_NAME@ -+MENU_NAME=@MENU_NAME@ -+FORM_NAME=@FORM_NAME@ -+CXX_NAME=@CXX_NAME@ - DFT_DEP_SUFFIX=@DFT_DEP_SUFFIX@ - TINFO_ARG_SUFFIX=@TINFO_ARG_SUFFIX@ - CXX_LIB_SUFFIX=@CXX_LIB_SUFFIX@ - - prefix="@prefix@" - exec_prefix="@exec_prefix@" --includedir="@includedir@" -+includedir="@includedir@@includesubdir@" - libdir="@libdir@" - - show_prefix='@prefix@' - show_exec_prefix='@exec_prefix@' --show_includedir='@includedir@' -+show_includedir='@includedir@@includesubdir@' - show_libdir='@libdir@' - - MAIN_LIBRARY="${LIB_NAME}@DFT_ARG_SUFFIX@" -@@ -63,59 +63,42 @@ - MENU_LIBRARY="${MENU_NAME}@DFT_ARG_SUFFIX@" - FORM_LIBRARY="${FORM_NAME}@DFT_ARG_SUFFIX@" - --SUB_LIBRARY_REQ=${SUB_LIBRARY} --if test $TINFO_NAME = $LIB_NAME ; then -- SUB_LIBRARY_REQ= -+if test "$includedir" = "/usr/include" ; then -+ CFLAGS= -+else -+ CFLAGS="-I\${includedir}" - fi - --for lib in ../lib/* --do -- name=`basename $lib` -- if test "$name" = "*" ; then -- break -- fi -- -- root=`basename $name "$DFT_DEP_SUFFIX"` -- if test "$name" = "$root" ; then -- root=`basename $name "$CXX_LIB_SUFFIX"` -- if test "$name" = "$root" ; then -- continue -- fi -- fi -+if test "$libdir" = "/usr/lib" ; then -+ LDFLAGS= -+else -+ LDFLAGS="-L\${libdir}" -+fi - -- name=`echo "$name" | sed -e 's/^lib//' -e 's/\..*$//'` -+for name in @PC_MODULES_TO_MAKE@ -+do -+ name="${name}" - - desc="ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" -+ reqs= -+ - if test $name = $MAIN_LIBRARY ; then -- reqs=$SUB_LIBRARY_REQ - desc="$desc library" - elif test $name = $SUB_LIBRARY ; then -- reqs= - desc="$desc terminal interface library" - elif expr $name : ".*${CXX_NAME}.*" >/dev/null ; then -- reqs="$PANEL_LIBRARY $MENU_LIBRARY $FORM_LIBRARY $MAIN_LIBRARY $SUB_LIBRARY_REQ" -+ reqs="$PANEL_LIBRARY, $MENU_LIBRARY, $FORM_LIBRARY, $MAIN_LIBRARY" - desc="$desc add-on library" - else -- reqs="$MAIN_LIBRARY $SUB_LIBRARY_REQ" -+ reqs="$MAIN_LIBRARY" - desc="$desc add-on library" - fi - -- if test "$includedir" = "/usr/include" ; then -- cflags= -- else -- cflags="-I\${includedir}" -- fi -- -- if test "$libdir" = "/usr/lib" ; then -- libs= -- else -- libs="-L\${libdir}" -- fi -- libs="$libs -l$name" -- -- # add dependencies that pkg-config cannot guess about -- if test -z "$reqs" ; then -- libs="$libs @LIBS@" -+ if test $name != $SUB_LIBRARY && test $SUB_LIBRARY != $MAIN_LIBRARY ; then -+ if test $name != $TINFO_NAME ; then -+ test -n "$reqs" && reqs="$reqs, " -+ reqs="${reqs}${SUB_LIBRARY}" -+ fi - fi - - echo "** creating ${name}.pc" -@@ -130,10 +113,13 @@ - Name: $name - Description: $desc - Version: \${version} --Requires: $reqs --Libs: $libs --Cflags: $cflags -+URL: http://invisible-island.net/ncurses -+Requires.private: $reqs -+Libs: $LDFLAGS -l$name -+Libs.private: @LIBS@ -+Cflags: $CFLAGS - EOF -- # pr -f ${name}.pc -+ -+ #pr -f ${name}.pc - done - # vile:shmode -diff -Naur ncurses-5.9/misc/Makefile.in ncurses-5.9.patch/misc/Makefile.in ---- ncurses-5.9/misc/Makefile.in 2011-02-21 02:09:31.000000000 +0100 -+++ ncurses-5.9.patch/misc/Makefile.in 2014-09-01 16:33:22.353792118 +0200 -@@ -1,6 +1,6 @@ --# $Id: Makefile.in,v 1.56 2011/02/21 01:09:31 tom Exp $ -+# $Id: Makefile.in,v 1.61 2013/08/04 20:23:20 tom Exp $ - ############################################################################## --# Copyright (c) 1998-2010,2011 Free Software Foundation, Inc. # -+# Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. # - # # - # Permission is hereby granted, free of charge, to any person obtaining a # - # copy of this software and associated documentation files (the "Software"), # -@@ -56,7 +56,11 @@ - exec_prefix = @exec_prefix@ - bindir = @bindir@ - libdir = @libdir@ -+datarootdir = @datarootdir@ - datadir = @datadir@ -+includesubdir = @includesubdir@ -+ -+INCLUDEDIR = $(DESTDIR)$(includedir)$(includesubdir) - - tabsetdir = $(datadir)/tabset - ticdir = @TERMINFO@ -@@ -120,7 +124,8 @@ - - run_tic.sed : - WHICH_XTERM=@WHICH_XTERM@ \ -- ticdir=${ticdir} \ -+ XTERM_KBS=@XTERM_KBS@ \ -+ datadir=${datadir} \ - $(SHELL) $(srcdir)/gen_edit.sh >$@ - - $(DESTDIR)$(bindir) \ -@@ -139,7 +144,7 @@ - - uninstall.libs : - -rm -f $(DESTDIR)$(bindir)/$(NCURSES_CONFIG) --@MAKE_PC_FILES@ $(SHELL) 'for name in *.pc; do rm -f $(DESTDIR)$(PKG_CONFIG_LIBDIR)/$$name; done' -+@MAKE_PC_FILES@ $(SHELL) -c 'for name in *.pc; do rm -f $(DESTDIR)$(PKG_CONFIG_LIBDIR)/$$name; done' - - tags : - -diff -Naur ncurses-5.9/misc/ncurses-config.in ncurses-5.9.patch/misc/ncurses-config.in ---- ncurses-5.9/misc/ncurses-config.in 2011-03-19 23:43:38.000000000 +0100 -+++ ncurses-5.9.patch/misc/ncurses-config.in 2014-09-01 16:33:22.354792119 +0200 -@@ -1,7 +1,7 @@ - #!@SHELL@ --# $Id: ncurses-config.in,v 1.25 2011/03/19 22:43:38 tom Exp $ -+# $Id: ncurses-config.in,v 1.30 2012/11/11 00:14:28 tom Exp $ - ############################################################################## --# Copyright (c) 2006-2010,2011 Free Software Foundation, Inc. # -+# Copyright (c) 2006-2011,2012 Free Software Foundation, Inc. # - # # - # Permission is hereby granted, free of charge, to any person obtaining a # - # copy of this software and associated documentation files (the "Software"), # -@@ -30,22 +30,48 @@ - # - # Author: Thomas E. Dickey, 2006-on - -+LANG=C; export LANG -+LANGUAGE=C; export LANGUAGE -+LC_ALL=C; export LC_ALL -+LC_CTYPE=C; export LC_CTYPE -+ - prefix="@prefix@" - exec_prefix="@exec_prefix@" - - bindir="@bindir@" - includedir="@includedir@" - libdir="@libdir@" -+datarootdir="@datarootdir@" - datadir="@datadir@" - mandir="@mandir@" - - THIS="@LIB_NAME@@DFT_ARG_SUFFIX@" - TINFO_LIB="@TINFO_ARG_SUFFIX@" -+RPATH_LIST="@RPATH_LIST@" - --LANG=C; export LANG --LANGUAGE=C; export LANGUAGE --LC_ALL=C; export LC_ALL --LC_CTYPE=C; export LC_CTYPE -+# Ensure that RPATH_LIST contains only absolute pathnames, if it is nonempty. -+# We cannot filter it out within the build-process since the variable is used -+# in some special cases of installation using a relative path. -+if test -n "$RPATH_LIST" -+then -+ save_IFS="$IFS" -+ IFS='@PATH_SEPARATOR@' -+ filtered= -+ for item in $RPATH_LIST -+ do -+ case "$item" in -+ ./*|../*|*/..|*/../*) -+ ;; -+ *) -+ test -n "$filtered" && filtered="${filtered}@PATH_SEPARATOR@" -+ filtered="${filtered}${item}" -+ ;; -+ esac -+ done -+ IFS="$save_IFS" -+ # if the result is empty, there is little we can do to fix it -+ RPATH_LIST="$filtered" -+fi - - # with --disable-overwrite, we installed into a subdirectory, but transformed - # the headers to include like this: -@@ -83,13 +109,19 @@ - ENDECHO - ;; - --libs) -+ if test "$libdir" = /usr/lib -+ then -+ LIBDIR= -+ else -+ LIBDIR=-L$libdir -+ fi - if test @TINFO_NAME@ = @LIB_NAME@ ; then - sed -e 's,^[ ]*,,' -e 's, [ ]*, ,g' -e 's,[ ]*$,,' <<-ENDECHO -- -L$libdir @EXTRA_LDFLAGS@ -l${THIS} @LIBS@ -+ $LIBDIR @EXTRA_LDFLAGS@ -l${THIS} @LIBS@ - ENDECHO - else - sed -e 's,^[ ]*,,' -e 's, [ ]*, ,g' -e 's,[ ]*$,,' <<-ENDECHO -- -L$libdir @EXTRA_LDFLAGS@ -l${THIS} -l${TINFO_LIB} @LIBS@ -+ $LIBDIR @EXTRA_LDFLAGS@ -l${THIS} -l${TINFO_LIB} @LIBS@ - ENDECHO - fi - ;; -@@ -163,4 +195,5 @@ - esac - shift - done -+# vi:ts=4 sw=4 - # vile:shmode -diff -Naur ncurses-5.9/misc/run_tic.in ncurses-5.9.patch/misc/run_tic.in ---- ncurses-5.9/misc/run_tic.in 2011-02-24 00:30:15.000000000 +0100 -+++ ncurses-5.9.patch/misc/run_tic.in 2014-09-01 16:33:22.354792119 +0200 -@@ -1,7 +1,7 @@ - #!@SHELL@ --# $Id: run_tic.in,v 1.32 2011/02/23 23:30:15 tom Exp $ -+# $Id: run_tic.in,v 1.34 2012/10/06 19:00:51 tom Exp $ - ############################################################################## --# Copyright (c) 1998-2010,2011 Free Software Foundation, Inc. # -+# Copyright (c) 1998-2011,2012 Free Software Foundation, Inc. # - # # - # Permission is hereby granted, free of charge, to any person obtaining a # - # copy of this software and associated documentation files (the "Software"), # -@@ -41,13 +41,14 @@ - # The script is designed to be run from the misc/Makefile as - # make install.data - --: ${suffix:=@PROG_EXT@} -+: ${suffix:=@EXEEXT@} - : ${DESTDIR:=@DESTDIR@} - : ${prefix:=@prefix@} - : ${exec_prefix:=@exec_prefix@} - : ${bindir:=@bindir@} - : ${top_srcdir:=@top_srcdir@} - : ${srcdir:=@srcdir@} -+: ${datarootdir:=@datarootdir@} - : ${datadir:=@datadir@} - : ${TIC_PATH:=@TIC_PATH@} - : ${ticdir:=@TERMINFO@} -diff -Naur ncurses-5.9/misc/terminfo.src ncurses-5.9.patch/misc/terminfo.src ---- ncurses-5.9/misc/terminfo.src 2011-02-20 21:46:53.000000000 +0100 -+++ ncurses-5.9.patch/misc/terminfo.src 2014-09-01 16:34:19.496887069 +0200 -@@ -6,8 +6,8 @@ - # Report bugs and new terminal descriptions to - # bug-ncurses@gnu.org - # --# $Revision: 1.383 $ --# $Date: 2011/02/20 20:46:53 $ -+# $Revision: 1.487 $ -+# $Date: 2014/03/23 20:45:15 $ - # - # The original header is preserved below for reference. It is noted that there - # is a "newer" version which differs in some cosmetic details (but actually -@@ -321,7 +321,7 @@ - # DEL and ^C are hardcoded to act as kill characters. - # ^D acts as a line break (just like newline). - # It also interprets --# \033];xxx\007 -+# \033];xxx\007 - # for compatibility with xterm -TD - 9term|Plan9 terminal emulator for X, - am, -@@ -376,11 +376,19 @@ - dim=\E[2m, - sgr=\E[%?%p1%t7;%;%?%p2%t4;%;%?%p3%t7;%;%?%p4%t5;%;%?%p5%t2;%;%?%p7%t8;%;m, - use=ansi+sgr, use=ansi+sgrso, use=ansi+sgrul, --ansi+pp|ansi printer port, -- mc0=\E[0i, mc4=\E[4i, mc5=\E[5i, - ansi+csr|ansi scroll-region plus cursor save & restore, - csr=\E[%i%p1%d;%p2%dr, rc=\E8, sc=\E7, - -+# The normal (ANSI) flavor of "media copy" building block asserts that -+# characters sent to the printer do not echo on the screen. DEC terminals -+# can also be put into autoprinter mode, where each line is sent to the -+# printer as you move off that line, e.g., by a carriage return. -+ansi+pp|ansi printer port, -+ mc5i, -+ mc0=\E[i, mc4=\E[4i, mc5=\E[5i, -+dec+pp|DEC autoprinter mode, -+ mc0=\E[i, mc4=\E[?4i, mc5=\E[?5i, -+ - # The IBM PC alternate character set. Plug this into any Intel console entry. - # We use \E[11m for rmacs rather than \E[12m so the <acsc> string can use the - # ROM graphics for control characters such as the diamond, up- and down-arrow. -@@ -456,9 +464,10 @@ - cud=\E[%p1%dB, cud1=\E[1B, cuf=\E[%p1%dC, cuf1=\E[1C, - cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[1A, - dch=\E[%p1%dP, dispc=\E=%p1%dg, ech=\E[%p1%dX, -- hpa=\E[%i%p1%dG, hts=\EH, ich=\E[%p1%d@, il=\E[%p1%dL, -- indn=\E[%p1%dS, rc=\E7, rin=\E[%p1%dT, rmam=\E[?7l, sc=\E7, -- smam=\E[?7h, tbc=\E[g, vpa=\E[%i%p1%dd, -+ hpa=\E[%i%p1%dG, hts=\EH, ich=\E[%p1%d@, ich1=\E[@, -+ il=\E[%p1%dL, indn=\E[%p1%dS, rc=\E7, rin=\E[%p1%dT, -+ rmam=\E[?7l, sc=\E7, smam=\E[?7h, tbc=\E[g, -+ vpa=\E[%i%p1%dd, - - #### ANSI/ECMA-48 terminals and terminal emulators - # -@@ -488,7 +497,7 @@ - # ansi-mtabs adds relative addressing and minimal tab support - ansi-mtabs|any ansi terminal with pessimistic assumptions, - it#8, -- ht=^I, use=ansi+local1, use=ansi-mini, -+ ht=^I, use=ansi-mini, use=ansi+local1, - - # ANSI X3.64 from emory!mlhhh (Hugh Hansard) via BRL - # -@@ -655,7 +664,7 @@ - kf42=\0m, kf43=\0n, kf44=\0o, kf45=\0p, kf46=\0q, - kf47=\0\213, kf48=\0\214, kf5=\0?, kf6=\0@, kf7=\0A, kf8=\0B, - kf9=\0C, khome=\0G, kich1=\0R, knp=\0Q, kpp=\0I, -- pfkey=\E[0;%?%p1%{11}%<%t%'\:'%e%?%p1%{13}%<%t%'z'%e%?%p1%{23}%<%t%'G'%e%?%p1%{25}%<%t%'p'%e%?%p1%'#'%<%t%'E'%e%?%p1%'%'%<%t%'f'%e%?%p1%'/'%<%t%'C'%e%{92}%;%;%;%;%;%;%;%p1%+%d;%p2"%s"p, -+ pfkey=\E[0;%?%p1%{11}%<%t%'\:'%e%p1%{13}%<%t%'z'%e%p1%{23}%<%t%'G'%e%p1%{25}%<%t%'p'%e%p1%'#'%<%t%'E'%e%p1%'%'%<%t%'f'%e%p1%'/'%<%t%'C'%e%{92}%;%p1%+%d;%p2"%s"p, - use=ansi.sys-old, - - # -@@ -689,12 +698,8 @@ - is2=U4 PC-DOS Public Domain NANSI.SYS with keypad redefined for vi 9-29-86\n\E[;75;8p, - use=ansi.sysk, - --#### ANSI console types --# -+#### Atari ST terminals - --############################################################################# --# --# Atari ST terminals. - # From Guido Flohr <gufl0000@stud.uni-sb.de>. - # - tw52|tw52-color|Toswin window manager with color, -@@ -799,9 +804,6 @@ - rmul=\EzH, rs1=\Ez_\Eb@\EcA, sgr0=\Ez_, smcup=\Ev\Ee\Ez_, - smso=\Ep, smul=\EyH, - --#### Atari ST --# -- - # From: Simson L. Garfinkel <simsong@media-lab.mit.edu> - atari-old|atari st, - OTbs, am, -@@ -835,16671 +837,16976 @@ - ri=\EI, rmcup=, rmso=\Eq, rs1=\Ez_\Eb@\EcA, sc=\Ej, sgr0=\Eq, - smcup=\Ee, smso=\Ep, - --#### BeOS --# --# BeOS entry for Terminal program Seems to be almost ANSI --beterm|BeOS Terminal, -- am, eo, mir, msgr, xenl, xon, -- colors#8, cols#80, it#8, lines#25, ncv#5, pairs#64, -- bel=^G, bold=\E[1m, clear=\E[H\E[J, cr=^M, -- csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, -- cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, -- cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, -- dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, -- ech=\E[%p1%dX, ed=\E[J, el=\E[K, el1=\E[1K, home=\E[H, -- hpa=\E[%i%p1%dG, ht=^I, hts=\EH, ich=\E[%p1%d@, ich1=\E[@, -- il=\E[%p1%dL, il1=\E[L, ind=^J, kbs=^H, kcub1=\E[D, -- kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[3~, -- kend=\E[4~, kf1=\E[11~, kf10=\E[20~, kf11=\E[21~, -- kf12=\E[22~, kf2=\E[12~, kf3=\E[13~, kf4=\E[14~, -- kf5=\E[15~, kf6=\E[16~, kf7=\E[17~, kf8=\E[18~, kf9=\E[19~, -- khome=\E[1~, kich1=\E[2~, knp=\E[6~, kpp=\E[5~, kspd=^Z, -- nel=^M^J, op=\E[m, rc=\E8, rev=\E[7m, ri=\EM, rmir=\E[4l, -- rmkx=\E[?4l, rmso=\E[m, rmul=\E[24m, rs1=\Ec, sc=\E7, -- setab=\E[4%p1%dm, setaf=\E[3%p1%dm, -- setb=\E[%p1%{40}%+%cm, setf=\E[%p1%{30}%+%cm, -- sgr0=\E[0;10m, smir=\E[4h, smkx=\E[?4h, smso=\E[7m, -- smul=\E[4m, u6=\E[%i%p1%d;%p2%dR, u7=\E[6n, -- vpa=\E[%i%p1%dd, -- --#### Linux consoles --# -+#### Apple Terminal.app - --# This entry is good for the 1.2.13 or later version of the Linux console. -+# nsterm*|Apple_Terminal - AppKit Terminal.app - # --# *************************************************************************** --# * * --# * WARNING: * --# * Linuxes come with a default keyboard mapping kcbt=^I. This entry, in * --# * response to user requests, assumes kcbt=\E[Z, the ANSI/ECMA reverse-tab * --# * character. Here are the keymap replacement lines that will set this up: * --# * * --# keycode 15 = Tab Tab --# alt keycode 15 = Meta_Tab --# shift keycode 15 = F26 --# string F26 ="\033[Z" --# * * --# * This has to use a key slot which is unfortunate (any unused one will * --# * do, F26 is the higher-numbered one). The change ought to be built * --# * into the kernel tables. * --# * * --# *************************************************************************** -+# Terminal.app is a Terminal emulator bundled with NeXT's NeXTStep and -+# OPENSTEP/Mach operating systems, and with Apple's Rhapsody, Mac OS X -+# Server and Mac OS X operating systems. There is also a -+# "terminal.app" in GNUStep, but I believe it to be an unrelated -+# codebase and I have not attempted to describe it here. - # --# All linux kernels since 1.2.13 (at least) set the screen size --# themselves; this entry assumes that capability. -+# For NeXTStep, OPENSTEP/Mach, Rhapsody and Mac OS X Server 1.0, you -+# are pretty much on your own. Use "nsterm-7-m" and hope for the best. -+# You might also try "nsterm-7" and "nsterm-old" if you suspect your -+# version supports color. - # --linux-basic|linux console, -- am, bce, eo, mir, msgr, xenl, xon, -- it#8, ncv#18, U8#1, -- acsc=+\020\,\021-\030.^Y0\333`\004a\261f\370g\361h\260i\316j\331k\277l\332m\300n\305o~p\304q\304r\304s_t\303u\264v\301w\302x\263y\363z\362{\343|\330}\234~\376, -- bel=^G, clear=\E[H\E[J, cr=^M, csr=\E[%i%p1%d;%p2%dr, -- cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=^J, -- cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, -- cuu=\E[%p1%dA, cuu1=\E[A, dch=\E[%p1%dP, dch1=\E[P, -- dim=\E[2m, dl=\E[%p1%dM, dl1=\E[M, ech=\E[%p1%dX, ed=\E[J, -- el=\E[K, el1=\E[1K, flash=\E[?5h\E[?5l$<200/>, home=\E[H, -- hpa=\E[%i%p1%dG, ht=^I, hts=\EH, ich=\E[%p1%d@, ich1=\E[@, -- il=\E[%p1%dL, il1=\E[L, ind=^J, kb2=\E[G, kbs=\177, -- kcbt=\E[Z, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, -- kdch1=\E[3~, kend=\E[4~, kf1=\E[[A, kf10=\E[21~, -- kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, -- kf15=\E[28~, kf16=\E[29~, kf17=\E[31~, kf18=\E[32~, -- kf19=\E[33~, kf2=\E[[B, kf20=\E[34~, kf3=\E[[C, kf4=\E[[D, -- kf5=\E[[E, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, -- khome=\E[1~, kich1=\E[2~, kmous=\E[M, knp=\E[6~, kpp=\E[5~, -- kspd=^Z, nel=^M^J, rc=\E8, rev=\E[7m, ri=\EM, rmam=\E[?7l, -- rmir=\E[4l, rmso=\E[27m, rmul=\E[24m, rs1=\Ec\E]R, sc=\E7, -- sgr=\E[0;10%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p5%t;2%;%?%p6%t;1%;%?%p7%t;8%;%?%p9%t;11%;m, -- smam=\E[?7h, smir=\E[4h, smul=\E[4m, tbc=\E[3g, -- vpa=\E[%i%p1%dd, use=vt102+enq, use=klone+sgr, -- use=ecma+color, -- --linux-m|Linux console no color, -- colors@, pairs@, -- setab@, setaf@, setb@, setf@, use=linux, -- --# The 1.3.x kernels add color-change capabilities; if yours doesn't have this --# and it matters, turn off <ccc>. The %02x escape used to implement this is --# not supposedly back-portable to older SV curses (although it has worked fine --# on Solaris for several years) and not supported in ncurses versions before --# 1.9.9. --linux-c-nc|linux console with color-change, -- ccc, -- initc=\E]P%p1%x%p2%{255}%*%{1000}%/%02x%p3%{255}%*%{1000}%/%02x%p4%{255}%*%{1000}%/%02x, -- oc=\E]R, use=linux-basic, --# From: Dennis Henriksen <opus@osrl.dk>, 9 July 1996 --linux-c|linux console 1.3.6+ for older ncurses, -- ccc, -- initc=\E]P%?%p1%{9}%>%t%p1%{10}%-%'a'%+%c%e%p1%d%;%p2%{255}%*%{1000}%/%Pr%gr%{16}%/%Px%?%gx%{9}%>%t%gx%{10}%-%'a'%+%c%e%gx%d%;%gr%{15}%&%Px%?%gx%{9}%>%t%gx%{10}%-%'a'%+%c%e%gx%d%;%p3%{255}%*%{1000}%/%Pr%gr%{16}%/%Px%?%gx%{9}%>%t%gx%{10}%-%'a'%+%c%e%gx%d%;%gr%{15}%&%Px%?%gx%{9}%>%t%gx%{10}%-%'a'%+%c%e%gx%d%;%p4%{255}%*%{1000}%/%Pr%gr%{16}%/%Px%?%gx%{9}%>%t%gx%{10}%-%'a'%+%c%e%gx%d%;%gr%{15}%&%Px%?%gx%{9}%>%t%gx%{10}%-%'a'%+%c%e%gx%d%;, -- oc=\E]R, use=linux-basic, -- --# The 2.2.x kernels add a private mode that sets the cursor type; use that to --# get a block cursor for cvvis. --# reported by Frank Heckenbach <frank@g-n-u.de>. --linux|linux console, -- civis=\E[?25l\E[?1c, cnorm=\E[?25h\E[?0c, -- cvvis=\E[?25h\E[?8c, use=linux-c-nc, -- --# Subject: linux 2.6.26 vt back_color_erase --# Changes to the Linux console driver broke bce model as reported in --# https://bugzilla.novell.com/show_bug.cgi?id=418613 --# apparently from --# http://lkml.org/lkml/2008/4/26/305 --# http://groups.google.com/group/fa.linux.kernel/browse_thread/thread/87f98338f0d636bb/aa96e8b86cee0d1e?lnk=st&q=#aa96e8b86cee0d1e --linux2.6.26|linux console w/o bce, -- bce@, use=linux, -- --# See the note on ICH/ICH1 VERSUS RMIR/SMIR near the end of file --linux-nic|linux with ich/ich1 suppressed for non-curses programs, -- ich@, ich1@, use=linux, -- --# This assumes you have used setfont(8) to load one of the Linux koi8-r fonts. --# acsc entry from Pavel Roskin" <pavel@absolute.spb.su>, 29 Sep 1997. --linux-koi8|linux with koi8 alternate character set, -- acsc=+\020\,\021-\030.^Y0\215`\004a\221f\234g\237h\220i\276j\205k\203l\202m\204n\212o~p\0q\0r\0s_t\206u\207v\211w\210x\201y\230z\231{\267|\274~\224, -- use=linux, use=klone+koi8acs, -- --# Another entry for KOI8-r with Qing Long's acsc. --# (which one better complies with the standard?) --linux-koi8r|linux with koi8-r alternate character set, -- use=linux, use=klone+koi8acs, -- --# Entry for the latin1 and latin2 fonts --linux-lat|linux with latin1 or latin2 alternate character set, -- acsc=+\020\,\021-\030.^Y0\333`\004a\013f\370g\361h\260i\316j\211k\214l\206m\203n\305o~p\304q\212r\304s_t\207u\215v\301w\302x\205y\363z\362{\343|\330}\234~\376, -- use=linux, -- --# This uses graphics from VT codeset instead of from cp437. --# reason: cp437 (aka "straight to font") is not functional under luit. --# from: Andrey V Lukyanov <land@long.yar.ru>. --linux-vt|linux console using VT codes for graphics, -- acsc=++\,\,--..00``aaffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz~~, -- rmacs=\E(K, rmpch@, sgr@, sgr0=\E[0m\E(K\017, smacs=\E(0, -- smpch@, use=linux, -- --# This is based on the Linux console (relies on the console to perform some --# of the functionality), but does not recognize as many control sequences. --# The program comes bundled with an old (circa 1998) copy of the Linux --# console terminfo. It recognizes some non-ANSI/VT100 sequences such as --# \E* move cursor to home, as as \E[H --# \E,X same as \E(X --# \EE move cursor to beginning of row --# \E[y,xf same as \E[y,xH -+# To determine the version of Terminal.app you're using by running: - # --# Note: The status-line support is buggy (dsl does not work). --kon|kon2|jfbterm|Kanji ON Linux console, -- ccc@, hs, -- civis@, cnorm@, cvvis@, dsl=\E[?H, flash@, fsl=\E[?F, initc@, -- initp@, kcbt@, oc@, op=\E[37;40m, rs1=\Ec, tsl=\E[?T, -- use=linux, -- --# 16-color linux console entry; this works with a 256-character --# console font but bright background colors turn into dim ones when --# you use a 512-character console font. This uses bold for bright --# foreground colors and blink for bright background colors. --linux-16color|linux console with 16 colors, -- colors#16, ncv#54, pairs#256, -- setab=\E[4%p1%{8}%m%d%?%p1%{8}%>%t;5%e%p1%{8}%=%t;2%e;25%;m, -- setaf=\E[3%p1%{8}%m%d%?%p1%{8}%>%t;1%e%p1%{8}%=%t;2%e;21%;m, -- use=linux, -- --# bterm (bogl 0.1.18) --# Implementation is in bogl-term.c --# Key capabilities from linux terminfo entry -+# echo "$TERM_PROGRAM" "$TERM_PROGRAM_VERSION" - # --# Notes: --# bterm only supports acs using wide-characters, has case for these: qjxamlkut --# bterm does not support sgr, since it only processes one parameter -TD --bterm|bogl virtual terminal, -- am, bce, -- colors#8, cols#80, lines#24, pairs#64, -- acsc=aajjkkllmmqqttuuxx, bold=\E[1m, civis=\E[?25l, -- clear=\E[H\E[2J, cnorm=\E[?25h, cr=^M, cub1=^H, cud1=^J, -- cup=\E[%i%p1%d;%p2%dH, ed=\E[J, el=\E[K, home=\E[H, ind=^J, -- kb2=\E[G, kbs=\177, kcbt=\E[Z, kcub1=\E[D, kcud1=\E[B, -- kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[3~, kend=\E[4~, kf1=\E[[A, -- kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, -- kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, kf17=\E[31~, -- kf18=\E[32~, kf19=\E[33~, kf2=\E[[B, kf20=\E[34~, -- kf3=\E[[C, kf4=\E[[D, kf5=\E[[E, kf6=\E[17~, kf7=\E[18~, -- kf8=\E[19~, kf9=\E[20~, khome=\E[1~, kich1=\E[2~, -- kmous=\E[M, knp=\E[6~, kpp=\E[5~, kspd=^Z, nel=^M^J, -- op=\E49;39m, rev=\E[7m, ri=\EM, rmacs=^O, rmso=\E[27m, -- rmul=\E[24m, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, -- sgr0=\E[0m, smacs=^N, smso=\E[7m, smul=\E[4m, -- --#### Mach -+# For Apple_Terminal v309+, use "nsterm-256color" (or "nsterm-bce") - # -- --# From: Matthew Vernon <mcv21@pick.sel.cam.ac.uk> --mach|Mach Console, -- am, km, -- cols#80, it#8, lines#25, -- bel=^G, blink=\E[5m, bold=\E[1m, clear=\Ec, cr=^M, -- cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=^J, -- cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, -- cuu=\E[%p1%dA, cuu1=\E[A, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, -- el=\E[K, home=\E[H, ht=^I, il=\E[%p1%dL, il1=\E[L, ind=^J, -- kbs=\177, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, -- kdch1=\E[9, kend=\E[Y, kf1=\EOP, kf10=\EOY, kf2=\EOQ, -- kf3=\EOR, kf4=\EOS, kf5=\EOT, kf6=\EOU, kf7=\EOV, kf8=\EOW, -- kf9=\EOX, khome=\E[H, kich1=\E[@, kll=\E[F, knp=\E[U, -- kpp=\E[V, rev=\E[7m, rmso=\E[0m, rmul=\E[24m, sgr0=\E[0m, -- smso=\E[7m, smul=\E[4m, --mach-bold|Mach Console with bold instead of underline, -- rmul=\E[0m, smul=\E[1m, use=mach, --mach-color|Mach Console with ANSI color, -- colors#8, pairs#64, -- dim=\E[2m, invis=\E[8m, op=\E[37;40m, rmso=\E[27m, -- setab=\E[4%p1%dm, setaf=\E[3%p1%dm, use=mach, -- --# From: Marcus Brinkmann --# http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/hurd/hurd/console/ -+# For Apple_Terminal v200+, use "nsterm-16color" (a.k.a. "nsterm") - # --# Comments in the original are summarized here: -+# For Apple_Terminal v71+/v100+, use "nsterm-bce". - # --# hurd uses 8-bit characters (km). -+# For Apple_Terminal v51+, use "nsterm-7-c" or "nsterm-7-c-s". - # --# Although it doesn't do XON/XOFF, we don't want padding characters (xon). -+# For Apple_Terminal v41+, use "nsterm-old", or "nsterm-s". - # --# Regarding compatibility to vt100: hurd doesn't specify <xenl>, as we don't --# have the eat_newline_glitch. It doesn't support setting or removing tab --# stops (hts/tbc). -+# For all earlier versions (Apple_Terminal), try "nsterm-7-m" -+# (monochrome) or "nsterm-7" (color); "nsterm-7-m-s" and "nsterm-7-s" -+# might work too, but really you're on your own here since these -+# systems are very obsolete and I can't test them. I do welcome -+# patches, though :). -+ -+# Other Terminals: - # --# hurd uses ^H instead of \E[D for cub1, as only ^H implements <bw> and it is --# one byte instead three. -+# For GNUstep_Terminal, you're probably best off using "linux" or -+# writing your own terminfo. -+ -+# For MacTelnet, you're on your own. It's a different codebase, and -+# seems to be somewhere between "vt102", "ncsa" and "xterm-color". -+ -+# For iTerm.app, see "iterm". -+ - # --# <ich1> is not included because hurd has insert mode. -+# The AppKit Terminal.app descriptions all have names beginning with -+# "nsterm". Note that the statusline (-s) versions use the window -+# titlebar as a phony status line, and may produce warnings during -+# compilation as a result ("tsl uses 0 parameters, expected 1".) -+# Ignore these warnings, or even ignore these entries entirely. Apps -+# which need to position the cursor or do other fancy stuff inside the -+# status line won't work with these entries. They're primarily useful -+# for programs like Pine which provide simple notifications in the -+# status line. Please note that non-ASCII characters don't work right -+# in the status line, since Terminal.app incorrectly interprets their -+# Unicode codepoints as MacRoman codepoints (in earlier Mac OS X -+# versions) or only accepts status lines consisting entirely of -+# characters from the first 256 Unicode positions (including C1 but -+# not C0 or DEL.) - # --# hurd doesn't use ^J for scrolling, because this could put things into the --# scrollback buffer. -+# The Mythology* of AppKit Terminal.app: - # --# gsbom/grbom are used to enable/disable real bold (not intensity bright) mode. --# This is a GNU extension. -+# In the days of NeXTSTep 0.x and 1.x there were two incompatible -+# bundled terminal emulators, Shell and Terminal. Scott Hess wrote a -+# shareware replacement for Terminal called "Stuart" which NeXT bought -+# and used as the basis for the Terminal.app in NeXTstep 2+, -+# OPENSTEP/Mach, Apple Rhapsody, Mac OS X Server 1.0, and Mac OS X. I -+# don't know the TERM_PROGRAM and TERM_PROGRAM_VERSION settings or -+# capabilities for the early versions, but I believe that the -+# TERM_PROGRAM_VERSION may have been reset at some point. - # --# The original has commented-out ncv, but is restored here. -+# The early versions were tailored to the NeXT character set. Sometime -+# after the Apple aquisition the encoding was swiched to MacRoman -+# (initally with serious altcharset bugs due to incomplete conversion -+# of the old NeXT code,) and then later to UTF-8. Alos sometime during -+# or just prior to the early days of Mac OS X, the Terminal grew ANSI -+# 8-color support (initially buggy when combined with attributes, but -+# that was later fixed.) More recently, around Mac OS X version 10.3 -+# or so (Terminal.app v100+) xterm-like 16-color support was added. In -+# some versions (for instance 133-1 which shipped with Mac OS X -+# version 10.4) this suffered from the <bce> bug, but that seems to -+# have been fixed in Mac OS X version 10.5 (Terminal.app v240.2+). - # --# Reading the source, RIS resets cnorm, but not xmous. --hurd|The GNU Hurd console server, -- am, bce, bw, eo, km, mir, msgr, xon, -- colors#8, it#8, ncv#18, pairs#64, -- acsc=++\,\,--..00``aaffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -- bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l, -- clear=\Ec, cnorm=\E[?25h, cr=^M, csr=\E[%i%p1%d;%p2%dr, -- cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=\E[B, -- cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, -- cuu=\E[%p1%dA, cuu1=\E[A, cvvis=\E[34l, dch=\E[%p1%dP, -- dch1=\E[P, dim=\E[2m, dl=\E[%p1%dM, dl1=\E[M, -- ech=\E[%p1%dX, ed=\E[J, el=\E[K, el1=\E[1K, flash=\Eg, -- home=\E[H, hpa=\E[%i%p1%dG, ht=^I, ich=\E[%p1%d@, -- il=\E[%p1%dL, il1=\E[L, ind=\E[S, indn=\E[%p1%dS, -- invis=\E[8m, kb2=\E[G, kbs=\177, kcbt=\E[Z, kcub1=\EOD, -- kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kdch1=\E[3~, -- kend=\E[4~, kf1=\EOP, kf10=\E[21~, kf11=\E[23~, -- kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, kf15=\E[28~, -- kf16=\E[29~, kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, -- kf2=\EOQ, kf20=\E[34~, kf3=\EOR, kf4=\EOS, kf5=\E[15~, -- kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, -- khome=\E[1~, kich1=\E[2~, kmous=\E[M, knp=\E[6~, kpp=\E[5~, -- kspd=^Z, nel=^M^J, op=\E[39;49m, rc=\E8, rev=\E[7m, ri=\E[T, -- rin=\E[%p1%dT, ritm=\E[23m, rmacs=\E[10m, rmir=\E[4l, -- rmso=\E[27m, rmul=\E[24m, rs1=\EM\E[?1000l, sc=\E7, -- setab=\E[4%p1%dm, setaf=\E[3%p1%dm, -- sgr=\E[0%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p5%t;2%;%?%p6%t;1%;%?%p7%t;8%;%?%p9%t;11%;m, -- sgr0=\E[0m, sitm=\E[3m, smacs=\E[11m, smir=\E[4h, -- smso=\E[7m, smul=\E[4m, vpa=\E[%i%p1%dd, grbom=\E[>1l, -- gsbom=\E[>1h, -- --#### OSF Unix -+# In the early days of Mac OS X the terminal was fairly buggy and -+# would routinely crash under load. Many of these bugs seem to have -+# been fixed around Mac OS X version 10.3 (Terminal.app v100+) but -+# some may still remain. This change seems to correspond to -+# Terminal.app reporting "xterm-color" as $TERM rather than "vt100" as -+# it did previously. - # -- --# OSF/1 1.1 Snapshot 2 --pmcons|pmconsole|PMAX console, -- am, -- cols#128, lines#57, -- bel=^G, clear=^L, cr=^M, cub1=^H, cud1=^J, cuu1=^K, ht=^I, -- ind=^J, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, -- kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, -- --# SCO console and SOS-Syscons console for 386bsd --# (scoansi: had unknown capabilities --# :Gc=N:Gd=K:Gh=M:Gl=L:Gu=J:Gv=\072:\ --# :GC=E:GD=B:GH=D:GL=\64:GU=A:GV=\63:GR=C: --# :G1=?:G2=Z:G3=@:G4=Y:G5=;:G6=I:G7=H:G8=<:\ --# :CW=\E[M:NU=\E[N:RF=\E[O:RC=\E[P:\ --# :WL=\E[S:WR=\E[T:CL=\E[U:CR=\E[V:\ --# I renamed GS/GE/HM/EN/PU/PD/RT and added klone+sgr-dumb, based --# on the <smacs>=\E[12m -- esr) -+# * This may correspond with what actually happened, but I don't -+# know. It is based on guesswork, hearsay, private correspondence, -+# my faulty memory, and the following online sources and references: - # --# klone+sgr-dumb is an error since the acsc does not match -TD -+# [1] "Three Scotts and a Duane" by Simson L. Garfinkel -+# http://www.nextcomputers.org/NeXTfiles/Articles/NeXTWORLD/93.8/93.8.Dec.Community1.html - # --# In this description based on SCO's keyboard(HW) manpage list of default --# function key values: --# F13-F24 are shifted F1-F12 --# F25-F36 are control F1-F12 --# F37-F48 are shift+control F1-F12 -+# [2] NeXTSTEP entry from Wikipedia, the free encyclopedia -+# https://secure.wikimedia.org/wikipedia/en/wiki/Nextstep - # --# hpa/vpa work in the console, but not in scoterm: --# hpa=\E[%p1%dG, --# vpa=\E[%p1%dd, -+# * Renamed the AppKit Terminal.app entry from "Apple_Terminal" to -+# "nsterm" to comply with the name length and case conventions and -+# limitations of various software packages [notably Solaris terminfo -+# and UNIX.] A single Apple_Terminal alias is retained for -+# backwards-compatbility. - # --# SCO's terminfo uses --# kLFT=\E[d, --# kRIT=\E[c, --# which do not work (console or scoterm). -+# * Added function key support (F1-F4). These only work in Terminal.app -+# version 51, hopefully the capabilities won't cause problems for people -+# using version 41. - # --# Console documents only 3 attributes can be set with SGR (so we don't use sgr). --scoansi-old|SCO Extended ANSI standard crt (5.0.5), -- OTbs, am, bce, eo, xon, -- colors#8, cols#80, it#8, lines#25, pairs#64, -- acsc=+/\,.-\230.\2310[5566778899\:\:;;<<==>>FFGGHHIIJJKKLLMMNNOOPPQQRRSSTTUUVVWWXX`\204a0fxgqh2jYk?lZm@nEqDtCu4vAwBx3yszr{c}\034~\207, -- bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, -- civis=\E[=14;12C, clear=\E[H\E[2J, cnorm=\E[=10;12C, -- cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=\E[B, -- cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, -- cuu=\E[%p1%dA, cuu1=\E[A, cvvis=\E[=0;12C, dch=\E[%p1%dP, -- dch1=\E[P, dispc=\E[=%p1%dg, dl=\E[%p1%dM, dl1=\E[M, -- ed=\E[m\E[J, el=\E[m\E[K, el1=\E[1K, home=\E[H, ht=^I, -- hts=\EH, ich=\E[%p1%d@, ich1=\E[@, il=\E[%p1%dL, il1=\E[L, -- ind=\E[S, indn=\E[%p1%dS, invis=\E[8m, kbeg=\E[E, kbs=^H, -- kcbt=\E[Z, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, -- kdch1=\177, kend=\E[F, kf1=\E[M, kf10=\E[V, kf11=\E[W, -- kf12=\E[X, kf13=\E[Y, kf15=\E[a, kf16=\E[b, kf17=\E[c, -- kf18=\E[d, kf19=\E[e, kf2=\E[N, kf20=\E[f, kf21=\E[g, -- kf22=\E[h, kf23=\E[i, kf24=\E[j, kf25=\E[k, kf26=\E[l, -- kf27=\E[m, kf28=\E[n, kf29=\E[o, kf3=\E[O, kf30=\E[p, -- kf31=\E[q, kf32=\E[r, kf33=\E[s, kf34=\E[t, kf35=\E[u, -- kf36=\E[v, kf37=\E[w, kf38=\E[x, kf39=\E[y, kf4=\E[P, -- kf40=\E[z, kf41=\E[@, kf42=\E[[, kf43=\E[\\, kf44=\E[], -- kf45=\E[\^, kf46=\E[_, kf47=\E[`, kf48=\E[{, kf5=\E[Q, -- kf6=\E[R, kf7=\E[S, kf8=\E[T, kf9=\E[U, khome=\E[H, -- kich1=\E[L, knp=\E[G, kpp=\E[I, op=\E[0;37;40m, rc=\E8, -- rev=\E[7m, ri=\E[T, rin=\E[%p1%dT, rmacs=\E[10m, -- rmam=\E[?7l, rmso=\E[m, rmul=\E[m, sc=\E7, -- setab=\E[4%p1%dm, setaf=\E[3%p1%dm, sgr0=\E[0;10m, -- smacs=\E[12m, smam=\E[?7h, smso=\E[7m, smul=\E[4m, --scoansi-new|SCO Extended ANSI standard crt (5.0.6), -- km, -- civis=\E[=0c, cnorm=\E[=1c, csr=\E[%i%p1%d;%p2%dr, -- cvvis=\E[=2c, mgc=\E[=r, oc=\E[51m, op=\E[50m, -- rep=\E[%p1%d;%p2%db, rmm=\E[=11L, -- sgr=\E[0%?%p1%p3%|%t;7%;%?%p2%t;4%;%?%p4%t;5%;%?%p6%t;1%;%?%p7%t;8%;%?%p9%t;12%;m, -- smgb=\E[=1;0m, smgbp=\E[=1;%i%p1%dm, -- smglp=\E[=2;%i%p1%dm, smgr=\E[=3;0m, -- smgrp=\E[=3;%i%p1%dm, smgt=\E[=0;0m, -- smgtp=\E[=0;%i%p1%dm, smm=\E[=10L, -- wind=\E[%i%p1%d;%p2%d;%i%p3%d;%p4%dr, -- use=scoansi-old, --# make this easy to change... --scoansi|SCO Extended ANSI standard crt, -- use=scoansi-old, -- --# This actually describes the generic SVr4 display driver for Intel boxes. --# The <dim=\E[2m> isn't documented and therefore may not be reliable. --# From: Eric Raymond <esr@snark.thyrsus.com> Mon Nov 27 19:00:53 EST 1995 --att6386|at386|386at|AT&T WGS 6386 console, -- am, bw, eo, xon, -- cols#80, it#8, lines#25, -- acsc=``a1fxgqh0jYk?lZm@nEooppqDrrsstCu4vAwBx3yyzz{{||}}~~, -- bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[=C, -- clear=\E[2J\E[H, cnorm=\E[=1C, cr=^M, cub=\E[%p1%dD, -- cub1=\E[D, cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, -- cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, -- cuu1=\E[A, dch=\E[%p1%dP, dch1=\E[P, dim=\E[2m, -- dl=\E[%p1%dM, dl1=\E[1M, ech=\E[%p1%dX, ed=\E[J, el=\E[K, -- home=\E[H, hpa=\E[%i%p1%dG, ht=^I, hts=\EH, ich=\E[%p1%d@, -- ich1=\E[1@, il=\E[%p1%dL, il1=\E[1L, ind=\E[S, -- indn=\E[%p1%dS, invis=\E[9m, is2=\E[0;10;39m, kbs=^H, -- kcbt=^], kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, -- kdch1=\E[P, kend=\E[Y, kf1=\EOP, kf10=\EOY, kf11=\EOZ, -- kf12=\EOA, kf2=\EOQ, kf3=\EOR, kf4=\EOS, kf5=\EOT, kf6=\EOU, -- kf7=\EOV, kf8=\EOW, kf9=\EOX, khome=\E[H, kich1=\E[@, -- knp=\E[U, kpp=\E[V, krmir=\E0, nel=\r\E[S, rc=\E8, rev=\E[7m, -- ri=\E[T, rin=\E[%p1%dT, rmacs=\E[10m, rmso=\E[m, rmul=\E[m, -- sc=\E7, -- sgr=\E[10m\E[0%?%p1%p3%|%t;7%;%?%p2%t;4%;%?%p4%t;5%;%?%p5%t;2%;%?%p6%t;1%;%?%p9%t;12%e;10%;%?%p7%t;9%;m, -- sgr0=\E[0;10m, smacs=\E[12m, smso=\E[7m, smul=\E[4m, -- tbc=\E[3g, vpa=\E[%i%p1%dd, use=klone+color, --# (pc6300plus: removed ":KM=/usr/lib/ua/kmap.s5:"; renamed BO/EE/CI/CV -- esr) --pc6300plus|AT&T 6300 plus, -- OTbs, am, xon, -- cols#80, lines#24, -- bel=^G, blink=\E[5m, bold=\E[1m, civis=\E[=C, -- clear=\E[2J\E[H, cnorm=\E[=1C, cr=^M, cub1=^H, cud1=\E[B, -- cuf1=\E[C, cup=\E[%i%p1%2d;%p2%2dH, cuu1=\E[A, -- dch1=\E[1P, dim=\E[2m, dl1=\E[1M, ed=\E[0J, el=\E[0K, -- home=\E[H, hts=\EH, ich1=\E[1@, il1=\E[1L, ind=^J, -- invis=\E[9m, kbs=^H, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, -- kcuu1=\E[A, kf1=\EOc, kf10=\EOu, kf2=\EOd, kf3=\EOe, -- kf4=\EOf, kf5=\EOg, kf6=\EOh, kf7=\EOi, kf8=\EOj, kf9=\EOk, -- nel=^M^J, rev=\E[7m, rmso=\E[m, rmul=\E[m, sgr0=\E[m, -- smso=\E[7m, smul=\E[4m, tbc=\E[3g, -+# * Added "full color" (-c) entries which support the 16-color mode in -+# version 51. -+# -+# * By default, version 51 uses UTF-8 encoding with broken altcharset -+# support, so "ASCII" (-7) entries without altcharset support were -+# added. - --# From: Benjamin C. W. Sittler <bsittler@nmt.edu> -+# nsterm - AppKit Terminal.app - # --# I have a UNIX PC which I use as a terminal attached to my Linux PC. --# Unfortunately, the UNIX PC terminfo entry that comes with ncurses --# is broken. All the special key sequences are broken, making it unusable --# with Emacs. The problem stems from the following: -+# Apple's Mac OS X includes a Terminal.app derived from the old NeXT -+# Terminal.app. It is a partial VT100 emulation with some xterm-like -+# extensions. This terminfo was written to describe versions 41 -+# (shipped with Mac OS X version 10.0) and 51 (shipped with Mac OS X -+# version 10.1) of Terminal.app. - # --# The UNIX PC has a plethora of keys (103 of them, and there's no numeric --# keypad!), loadable fonts, and strange highlighting modes ("dithered" --# half-intensity, "smeared" bold, and real strike-out, for example.) It also --# uses resizable terminal windows, but the bundled terminal program always --# uses an 80x24 window (and doesn't support seem to support a 132-column --# mode.) -+# Terminal.app runs under the Mac OS X Quartz windowing system (and -+# other AppKit-supported windowing systems.) On the Mac OS X machine I -+# use, the executable for Terminal.app is: -+# /Applications/Utilities/Terminal.app/Contents/MacOS/Terminal - # --# HISTORY: The UNIX PC was one of the first machines with a GUI, and used a --# library which was a superset of SVr3.5 curses (called tam, for "terminal --# access method".) tam includes support for real, overlapping windows, --# onscreen function key labels, and bitmap graphics. But since the primary --# user interface on the UNIX PC was a GUI program (ua, for "user --# assistant",) and remote administration was considered important for the --# machine, tam also supported VT100-compatible terminals attached to the --# serial port or used across the StarLan network. To simulate the extra keys --# not present on a VT100, users could press ESC and a two-letter sequence, --# such as u d (Undo) or U D (Shift-Undo.) These two-letter sequences, --# however, were not the same as those sent by the actual Undo key. The --# actual Undo key sends ESC 0 s unshifted, and ESC 0 S shifted, for example. --# (If you're interested in adding some of the tam calls to ncurses, btw, I --# have the full documentation and several programs which use tam. It also --# used an extended terminfo format to describe key sequences, special --# highlighting modes, etc.) -+# If you're looking for a description of the full-screen system -+# console which runs under Apple's Darwin operating system on PowerPC -+# platforms, see the "xnuppc" entry instead. - # --# KEYS: This means that ncurses would quite painful on the UNIX PC, since --# there are two sequences for every key-modifier combination (local keyboard --# sequence and remote "VT100" sequence.) But I doubt many people are trying --# to use ncurses on the UNIX PC, since ncurses doesn't properly handle the --# GUI. Unfortunately, the terminfo entry (and the termcap, too, I presume) --# seem to have been built from the manual describing the VT100 sequences. --# This means it doesn't work for a real live UNIX PC. -+# There were no function keys in version 41. In version 51, there are -+# four working function keys (F1, F2, F3 and F4.) The function keys -+# are included in all of these entries. - # --# FONTS: The UNIX PC also has a strange interpretation of "alternate --# character set". Rather than the VT100 graphics you might expect, it allows --# up to 8 custom fonts to be loaded at any given time. This means that --# programs expecting VT100 graphics will usually be disappointed. For this --# reason I have disabled the smacs/rmacs sequences, but they could easily be --# re-enabled. Here are the relevant control sequences (from the ESCAPE(7) --# manpage), should you wish to do so: -+# It does not support mouse pointer position reporting. Under some -+# circumstances the cursor can be positioned using option-click; this -+# works by comparing the cursor position and the selected position, -+# and simulating enough cursor-key presses to move the cursor to the -+# selected position. This technique fails in all but the simplest -+# applications. - # --# SGR10 - Select font 0 - ESC [ 10 m or SO --# SGR11 - Select font 1 - ESC [ 11 m or SI --# SGR12 - Select font 2 - ESC [ 12 m --# ... (etc.) --# SGR17 - Select font 7 - ESC [ 17 m -+# It provides partial ANSI color support (background colors interacted -+# badly with bold in version 41, though, as reflected in :ncv:.) The -+# monochrome (-m) entries are useful if you've disabled color support -+# or use a monochrome monitor. The full color (-c) entries are useful -+# in version 51, which doesn't exhibit the background color bug. They -+# also enable an xterm-compatible 16-color mode. - # --# Graphics for line drawing are not reliably found at *any* character --# location because the UNIX PC has dynamically reloadable fonts. I use font --# 0 for regular text and font 1 for italics, but this is by no means --# universal. So ASCII line drawing is in order if smacs/rmacs are enabled. -+# The configurable titlebar is set using xterm-compatible sequences; -+# it is used as a status bar in the statusline (-s) entries. Its width -+# depends on font sizes and window sizes, but 50 characters seems to -+# be the default for an 80x24 window. - # --# MISC: The cursor visible/cursor invisible sequences were swapped in the --# distributed terminfo. -+# The MacRoman character encoding is used for some of the alternate -+# characters in the "MacRoman" entries; the "ASCII" (-7) entries -+# disable alternate character set support entirely, and the "VT100" -+# (-acs) entries rely instead on Terminal.app's own buggy VT100 -+# graphics emulation, which seems to think the character encoding is -+# the old NeXT charset instead of MacRoman. The "ASCII" (-7) entries -+# are useful in Terminal.app version 51, which supports UTF-8 and -+# other ASCII-compatible character encodings but does not correctly -+# implement VT100 graphics; once VT100 graphics are correctly -+# implemented in Terminal.app, the "VT100" (-acs) entries should be -+# usable in any ASCII-compatible character encoding [except perhaps -+# in UTF-8, where some experts argue for disallowing alternate -+# characters entirely.] - # --# To ameliorate these problems (and fix a few highlighting bugs) I rewrote --# the UNIX PC terminfo entry. The modified version works great with Lynx, --# Emacs, and XEmacs running on my Linux PC and displaying on the UNIX PC --# attached by serial cable. In Emacs, even the Undo key works, and many --# applications can now use the F1-F8 keys. -+# Terminal.app reports "vt100" as the terminal type, but exports -+# several environment variables which may aid detection in a shell -+# profile (i.e. .profile or .login): - # --# esr's notes: --# Terminfo entry for the AT&T Unix PC 7300 --# from escape(7) in Unix PC 7300 Manual. --# Somewhat similar to a vt100-am (but different enough --# to redo this from scratch.) -+# TERM=vt100 -+# TERM_PROGRAM=Apple_Terminal -+# TERM_PROGRAM_VERSION=41 # in Terminal.app version 41 -+# TERM_PROGRAM_VERSION=51 # in Terminal.app version 51 - # --# /*************************************************************** --# * --# * FONT LOADING PROGRAM FOR THE UNIX PC --# * --# * This routine loads a font defined in the file ALTFONT --# * into font memory slot #1. Once the font has been loaded, --# * it can be used as an alternative character set. --# * --# * The call to ioctl with the argument WIOCLFONT is the key --# * to this routine. For more information, see window(7) in --# * the PC 7300 documentation. --# ***************************************************************/ --# #include <string.h> /* needed for strcpy call */ --# #include <sys/window.h> /* needed for ioctl call */ --# #define FNSIZE 60 /* font name size */ --# #define ALTFONT "/usr/lib/wfont/special.8.ft" /* font file */ --# /* --# * The file /usr/lib/wfont/special.8.ft comes with the --# * standard PC software. It defines a graphics character set --# * similar to that of the Teletype 5425 terminal. To view --# * this or other fonts in /usr/lib/wfont, use the command --# * cfont <filename>. For further information on fonts see --# * cfont(1) in the PC 7300 documentation. --# */ -+# For example, the following Bourne shell script would detect the -+# correct terminal type: - # --# struct altfdata /* structure for alt font data */ --# { --# short altf_slot; /* memory slot number */ --# char altf_name[FNSIZE]; /* font name (file name) */ --# }; --# ldfont() --# { --# int wd; /* window in which altfont will be */ --# struct altfdata altf; --# altf.altf_slot=1; --# strcpy(altf.altf_name,ALTFONT); --# for (wd =1; wd < 12; wd++) { --# ioctl(wd, WIOCLFONT,&altf); --# } --# } -+# if [ :"$TERM" = :"vt100" -a :"$TERM_PROGRAM" = :"Apple_Terminal" ] -+# then -+# export TERM -+# if [ :"$TERM_PROGRAM_VERSION" = :41 ] -+# then -+# TERM="nsterm-old" -+# else -+# TERM="nsterm-c-7" -+# fi -+# fi - # --# (att7300: added <civis>/<cnorm>/<ich1>/<invis> from the BSDI entry, --# they're confirmed by the man page for the System V display---esr) -+# In a C shell derivative, this would be accomplished by: - # --att7300|unixpc|pc7300|3b1|s4|AT&T UNIX PC Model 7300, -- am, xon, -- cols#80, it#8, lines#24, -- bel=^G, blink=\E[9m, bold=\E[1m, cbt=\E^I, civis=\E[=1C, -- clear=\E[2J\E[H, cnorm=\E[=0C, cr=^M, cub=\E[%p1%dD, -- cub1=^H, cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, -- cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, -- cuu1=\E[A, dch1=\E[P, dim=\E[2m, dl=\E[%p1%dM, dl1=\E[M, -- ed=\E[0J, el=\E[0K, home=\E[H, ich1=\E[@, il=\E[%p1%dL, -- il1=\E[L, ind=^J, invis=\E[9m, is1=\017\E[=1w, kBEG=\ENB, -- kCAN=\EOW, kCPY=\END, kCRT=\EON, kDC=\ENF, kDL=\ENE, -- kEND=\ENN, kEOL=\EOA, kFND=\EOX, kHLP=\EOM, kHOM=\ENM, -- kIC=\ENJ, kLFT=\ENK, kMOV=\ENC, kNXT=\ENH, kOPT=\EOR, -- kPRV=\ENG, kRDO=\EOT, kRIT=\ENL, kRPL=\EOY, kSAV=\EOO, -- kUND=\EOS, kbeg=\ENb, kbs=^H, kcan=\EOw, kcbt=\E[Z, -- kclo=\EOV, kclr=\E[J, kcmd=\EOu, kcpy=\ENd, kcrt=\EOn, -- kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=\ENf, -- ked=\E[J, kel=\EOa, kend=\E0, kext=\EOk, kf1=\EOc, kf2=\EOd, -- kf3=\EOe, kf4=\EOf, kf5=\EOg, kf6=\EOh, kf7=\EOi, kf8=\EOj, -- kfnd=\EOx, khlp=\EOm, khome=\E[H, kich1=\ENj, kind=\E[B, -- kmov=\ENc, kmrk=\ENi, knp=\E[U, knxt=\ENh, kopn=\EOv, -- kopt=\EOr, kpp=\E[V, kprt=\EOz, kprv=\ENg, krdo=\EOt, -- kref=\EOb, krfr=\ENa, kri=\E[A, krpl=\EOy, krst=\EOB, -- ksav=\EOo, kslt=\ENI, kund=\EOs, nel=\EE, rev=\E[7m, ri=\EM, -- rmso=\E[m, rmul=\E[m, sgr0=\E[0;10m, smso=\E[7m, -- smul=\E[4m, -+# if ( $?TERM && $?TERM_PROGRAM && $?TERM_PROGRAM_VERSION) then -+# if ( :"$TERM" == :"vt100" && :"$TERM_PROGRAM" == :"Apple_Terminal" ) then -+# if ( :"$TERM_PROGRAM_VERSION" == :41 ) then -+# setenv TERM "nsterm-old" -+# else -+# setenv TERM "nsterm-c-7" -+# endif -+# endif -+# endif - --# Sent by Stefan Stapelberg <stefan@rent-a-guru.de>, 24 Feb 1997, this is --# from SGI's terminfo database. SGI's entry shows F9-F12 with the codes --# for the application keypad mode. We have added iris-ansi-ap rather than --# change the original to keypad mode. --# --# (iris-ansi: added rmam/smam based on init string -- esr) --# --# This entry, and those derived from it, is used in xwsh (also known as --# winterm). Some capabilities that do not fit into the terminfo model --# include the shift- and control-functionkeys: --# --# F1-F12 generate different codes when shift or control modifiers are used. --# For example: --# F1 \E[001q --# shift F1 \E[013q --# control-F1 \E[025q --# --# In application keypad mode, F9-F12 generate codes like vt100 PF1-PF4, i.e., --# \EOP to \EOS. The shifted and control modifiers still do the same thing. --# --# The cursor keys also have different codes: --# control-up \E[162q --# control-down \E[165q --# control-left \E[159q --# control-right \E[168q --# --# shift-up \E[161q --# shift-down \E[164q --# shift-left \E[158q --# shift-right \E[167q --# --# control-tab \[072q --# --iris-ansi|iris-ansi-net|IRIS emulating 40 line ANSI terminal (almost VT100), -- am, -- cols#80, it#8, lines#40, -- bel=^G, bold=\E[1m, clear=\E[H\E[2J, -- cnorm=\E[9/y\E[12/y\E[=6l, cr=^M, cub=\E[%p1%dD, -- cub1=\E[D, cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, -- cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, -- cuu1=\E[A, cvvis=\E[10/y\E[=1h\E[=2l\E[=6h, -+# The '+' entries are building blocks -+nsterm+7|AppKit Terminal.app v41+ basic capabilities w/ASCII charset, -+ am, bw, msgr, xenl, xon, -+ cols#80, it#8, lines#24, -+ bel=^G, blink=\E[5m, bold=\E[1m, clear=\E[H\E[J, cr=^M, -+ csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, -+ cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, -+ cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, - dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[K, el1=\E[1K, -- home=\E[H, ht=^I, hts=\EH, il=\E[%p1%dL, il1=\E[L, ind=\ED, -- is2=\E[?1l\E>\E[?7h\E[100g\E[0m\E7\E[r\E8, kDC=\E[P, -- kEND=\E[147q, kHOM=\E[143q, kLFT=\E[158q, kPRT=\E[210q, -- kRIT=\E[167q, kSPD=\E[218q, kbs=^H, kcbt=\E[Z, kcub1=\E[D, -- kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=\177, -- kend=\E[146q, kent=^M, kf1=\E[001q, kf10=\E[010q, -- kf11=\E[011q, kf12=\E[012q, kf2=\E[002q, kf3=\E[003q, -- kf4=\E[004q, kf5=\E[005q, kf6=\E[006q, kf7=\E[007q, -- kf8=\E[008q, kf9=\E[009q, khome=\E[H, kich1=\E[139q, -- knp=\E[154q, kpp=\E[150q, kprt=\E[209q, krmir=\E[146q, -- kspd=\E[217q, nel=\EE, pfkey=\EP101;%p1%d.y%p2%s\E\\, -- rc=\E8, rev=\E[7m, ri=\EM, rmam=\E[?7l, rmso=\E[m, rmul=\E[m, -- sc=\E7, sgr0=\E[m, smam=\E[?7h, smso=\E[1;7m, smul=\E[4m, -- tbc=\E[3g, --iris-ansi-ap|IRIS ANSI in application-keypad mode, -- is2=\E[?1l\E=\E[?7h, kent=\EOM, kf10=\E[010q, -- kf11=\E[011q, kf12=\E[012q, kf9=\E[009q, use=iris-ansi, -- --# From the man-page, this is a quasi-vt100 emulator that runs on SGI's IRIX --# (T.Dickey 98/1/24) --iris-color|xwsh|IRIX ANSI with color, -- ncv#33, -- csr=\E[%i%p1%d;%p2%dr, dch=\E[%p1%dP, dim=\E[2m, -- ech=\E[%p1%dX, ich=\E[%p1%d@, rc=\E8, ritm=\E[23m, -- rmul=\E[24m, rs1=\Ec, -+ home=\E[H, ht=^I, hts=\EH, il=\E[%p1%dL, il1=\E[L, ind=^J, -+ invis=\E[8m, kbs=\177, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, -+ kcuu1=\EOA, kent=\EOM, rc=\E8, rev=\E[7m, ri=\EM, -+ rmam=\E[?7l, rmkx=\E[?1l\E>, rmso=\E[m, rmul=\E[m, - rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sc=\E7, -- sitm=\E[3m, use=vt100+enq, use=klone+color, -- use=iris-ansi-ap, -+ sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p7%t;8%;m, -+ sgr0=\E[m, smam=\E[?7h, smkx=\E[?1h\E=, smso=\E[7m, -+ smul=\E[4m, tbc=\E[3g, use=vt100+enq, use=vt100+pfkeys, - --# The following is a version of the ibm-pc entry distributed with PC/IX, --# (Interactive Systems' System 3 for the Big Blue), modified by Richard --# McIntosh at UCB/CSM. The :pt: and :uc: have been removed from the original, --# (the former is untrue, and the latter failed under UCB/man); standout and --# underline modes have been added. Note: this entry describes the "native" --# capabilities of the PC monochrome display, without ANY emulation; most --# communications packages (but NOT PC/IX connect) do some kind of emulation. --pcix|PC/IX console, -- am, bw, eo, -- cols#80, lines#24, -- clear=\Ec, cub1=^H, cud1=\E[B, cuf1=\E[C, -- cup=\E[%i%p1%2d;%p2%2dH, cuu1=\E[A, ed=\E[J, el=\E[K, -- home=\E[H, rmso=\E[m, rmul=\E[m, sgr0=\E[m, smso=\E[7m, -- smul=\E[4m, -+nsterm+acs|AppKit Terminal.app v41+ basic capabilities w/VT100 alternate-charset, -+ acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -+ enacs=\E(B\E)0, rmacs=^O, -+ sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, -+ sgr0=\E[m\017, smacs=^N, use=nsterm+7, - --# (ibmpcx: this entry used to be known as ibmx. --# It formerly included the following extension capabilities: --# :GC=b:GL=v:GR=t:RT=^J:\ --# :GH=\E[196g:GV=\E[179g:\ --# :GU=\E[193g:GD=\E[194g:\ --# :G1=\E[191g:G2=\E[218g:G3=\E[192g:G4=\E[217g:\ --# :CW=\E[E:NU=\E[F:RF=\E[G:RC=\E[H:\ --# :WL=\E[K:WR=\E[L:CL=\E[M:CR=\E[N:\ --# I renamed GS/GE/WL/WR/CL/CR/PU/PD/HM/EN; also, removed a duplicate --# ":kh=\E[Y:". Added IBM-PC forms characters and highlights, they match --# what was there before. -- esr) --ibmpcx|xenix|ibmx|IBM PC xenix console display, -- OTbs, am, msgr, -- cols#80, lines#25, -- clear=^L, cub1=^H, cud1=\E[B, cuf1=\E[C, -- cup=\E[%p1%d;%p2%dH, cuu1=\E[A, dch1=\E[P, dl1=\E[M, -- ed=\E[J, el=\E[K, home=\E[H, ich1=\E[@, il1=\E[L, kbs=^H, -- kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kend=\E[d, -- kf1=\E[K, kf2=\E[L, kf3=\E[M, kf4=\E[N, khome=\E[Y, knp=\E[e, -- kpp=\E[Z, use=klone+acs, use=klone+sgr8, -+nsterm+mac|AppKit Terminal.app v41+ basic capabilities w/MacRoman alternate-charset, -+ acsc=+\335\,\334-\366.\3770#`\327a\:f\241g\261h#i\360jjkkllmmnno\370p\370q\321rrssttuuvvwwxxy\262z\263{\271|\255}\243~\245, -+ enacs=\E(B\E)0, rmacs=^O, -+ sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, -+ sgr0=\E[m\017, smacs=^N, use=nsterm+7, - --#### QNX -+# compare with xterm+sl-twm -+nsterm+s|AppKit Terminal.app v41+ status-line (window titlebar) support, -+ wsl#50, use=xterm+sl-twm, -+ -+nsterm+c|AppKit Terminal.app v51+ full color support (including 16 colors), -+ op=\E[0m, use=ibm+16color, -+ -+nsterm+c41|AppKit Terminal.app v41 color support, -+ colors#8, ncv#37, pairs#64, -+ op=\E[0m, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, -+ -+# These are different combinations of the building blocks -+ -+# ASCII charset (-7) -+nsterm-m-7|nsterm-7-m|AppKit Terminal.app v41+ w/ASCII charset (monochrome), -+ use=nsterm+7, -+ -+nsterm-m-s-7|nsterm-7-m-s|AppKit Terminal.app v41+ w/ASCII charset (monochrome w/statusline), -+ use=nsterm+s, use=nsterm+7, -+ -+nsterm-7|AppKit Terminal.app v41+ w/ASCII charset (color), -+ use=nsterm+c41, use=nsterm+7, -+ -+nsterm-7-c|nsterm-c-7|AppKit Terminal.app v51+ w/ASCII charset (full color), -+ use=nsterm+c, use=nsterm+7, -+ -+nsterm-s-7|nsterm-7-s|AppKit Terminal.app v41+ w/ASCII charset (color w/statusline), -+ use=nsterm+s, use=nsterm+c41, use=nsterm+7, -+ -+nsterm-c-s-7|nsterm-7-c-s|AppKit Terminal.app v51+ w/ASCII charset (full color w/statusline), -+ use=nsterm+s, use=nsterm+c, use=nsterm+7, -+ -+# VT100 alternate-charset (-acs) -+nsterm-m-acs|nsterm-acs-m|AppKit Terminal.app v41+ w/VT100 alternate-charset (monochrome), -+ use=nsterm+acs, -+ -+nsterm-m-s-acs|nsterm-acs-m-s|AppKit Terminal.app v41+ w/VT100 alternate-charset (monochrome w/statusline), -+ use=nsterm+s, use=nsterm+acs, -+ -+nsterm-acs|AppKit Terminal.app v41+ w/VT100 alternate-charset (color), -+ use=nsterm+c41, use=nsterm+acs, -+ -+nsterm-c-acs|nsterm-acs-c|AppKit Terminal.app v51+ w/VT100 alternate-charset (full color), -+ use=nsterm+c, use=nsterm+acs, -+ -+nsterm-s-acs|nsterm-acs-s|AppKit Terminal.app v41+ w/VT100 alternate-charset (color w/statusline), -+ use=nsterm+s, use=nsterm+c41, use=nsterm+acs, -+ -+nsterm-c-s-acs|nsterm-acs-c-s|AppKit Terminal.app v51+ w/VT100 alternate-charset (full color w/statusline), -+ use=nsterm+s, use=nsterm+c, use=nsterm+acs, -+ -+# MacRoman charset -+nsterm-m|AppKit Terminal.app v41+ w/MacRoman charset (monochrome), -+ use=nsterm+mac, -+ -+nsterm-m-s|AppKit Terminal.app v41+ w/MacRoman charset (monochrome w/statusline), -+ use=nsterm+s, use=nsterm+mac, -+ -+nsterm-old|AppKit Terminal.app v41+ w/MacRoman charset (color), -+ use=nsterm+c41, use=nsterm+mac, -+ -+nsterm-c|AppKit Terminal.app v51+ w/MacRoman charset (full color), -+ use=nsterm+c, use=nsterm+mac, -+ -+nsterm-s|AppKit Terminal.app v41+ w/MacRoman charset (color w/statusline), -+ use=nsterm+s, use=nsterm+c41, use=nsterm+mac, -+ -+nsterm-c-s|AppKit Terminal.app v51+ w/MacRoman charset (full color w/statusline), -+ use=nsterm+s, use=nsterm+c, use=nsterm+mac, -+ -+# In Mac OS X version 10.5 the format of the preferences has changed -+# and a new, more complex technique is needed, e.g., -+# -+# python -c 'import sys,objc;NSUserDefaults=objc.lookUpClass( -+# "NSUserDefaults");ud=NSUserDefaults.alloc(); -+# ud.init();prefs=ud.persistentDomainForName_( -+# "com.apple.Terminal");prefs["Window Settings"][ -+# prefs["Default Window Settings"]]["TerminalType" -+# ]=sys.argv[1];ud.setPersistentDomain_forName_(prefs, -+# "com.apple.Terminal")' nsterm-16color -+# -+# and it is still not settable from the preferences dialog. This is -+# tracked under rdar://problem/7365108 and rdar://problem/7365134 -+# in Apple's bug reporter. - # -+# In OS X 10.7 (Leopard) the TERM which can be set in the preferences dialog -+# defaults to xterm-color. Alternative selections are ansi, dtterm, rxvt, -+# vt52, vt100, vt102 and xterm. -+nsterm-16color|AppKit Terminal.app v240.2+ with Mac OS X version 10.5, -+ bw@, mir, npc, -+ civis=\E[?25l, cnorm=\E[?25h, dch=\E[%p1%dP, dch1=\E[P, -+ flash=\E[?5h$<200/>\E[?5l, hpa=\E[%i%p1%dG, -+ ich=\E[%p1%d@, ich1=\E[@, kdch1=\E[3~, kend=\E[F, -+ kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, -+ kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, kf17=\E[31~, -+ kf18=\E[22~, kf19=\E[33~, kf20=\E[34~, kf5=\E[15~, -+ kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, khome=\E[H, -+ knp=\E[6~, kpp=\E[5~, rmcup=\E[2J\E[?47l\E8, rmir=\E[4l, -+ smcup=\E7\E[?47h, smir=\E[4h, vpa=\E[%i%p1%dd, -+ kLFT5=\E[5D, kRIT5=\E[5C, use=nsterm-c-s-acs, - --# QNX 4.0 Console --# Michael's original version of this entry had <am@>, <smcup=\Ei>, --# <rmcup=\Eh\ER>; this was so terminfo applications could write the lower --# right corner without triggering a scroll. The ncurses terminfo library can --# handle this case with the <ich1> capability, and prefers <am> for better --# optimization. Bug: The <op> capability resets attributes. --# From: Michael Hunter <mphunter@qnx.com> 30 Jul 1996 --# (removed: <sgr=%?%p1%t\E<%;%p2%t\E[%;%p3%t\E(%;%p4%t\E{%;%p6%t\E<%;,>) --qnx|qnx4|qnx console, -- daisy, km, mir, msgr, xhpa, xt, -- colors#8, cols#80, it#4, lines#25, ncv#3, pairs#8, -- acsc=O\333a\261j\331k\277l\332m\300n\305o\337q\304s\334t\303u\264v\301w\302x\263, -- bel=^G, blink=\E{, bold=\E<, civis=\Ey0, clear=\EH\EJ, -- cnorm=\Ey1, cr=^M, cub1=^H, cud1=^J, cuf1=\EC, -- cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, cvvis=\Ey2, -- dch1=\Ef, dl1=\EF, ed=\EJ, el=\EK, home=\EH, ht=^I, ich1=\Ee, -- il1=\EE, ind=^J, kBEG=\377\356, kCAN=\377\263, -- kCMD=\377\267, kCPY=\377\363, kCRT=\377\364, -- kDL=\377\366, kEND=\377\301, kEOL=\377\311, -- kEXT=\377\367, kFND=\377\370, kHLP=\377\371, -- kHOM=\377\260, kIC=\377\340, kLFT=\377\264, -- kMOV=\377\306, kMSG=\377\304, kNXT=\377\272, -- kOPT=\377\372, kPRT=\377\275, kPRV=\377\262, -- kRDO=\377\315, kRES=\377\374, kRIT=\377\266, -- kRPL=\377\373, kSAV=\377\307, kSPD=\377\303, -- kUND=\377\337, kbeg=\377\300, kcan=\377\243, kcbt=\377\0, -- kclo=\377\343, kclr=\377\341, kcmd=\377\245, -- kcpy=\377\265, kcrt=\377\305, kctab=\377\237, -- kcub1=\377\244, kcud1=\377\251, kcuf1=\377\246, -- kcuu1=\377\241, kdch1=\377\254, kdl1=\377\274, -- ked=\377\314, kel=\377\310, kend=\377\250, kent=\377\320, -- kext=\377\270, kf1=\377\201, kf10=\377\212, -- kf11=\377\256, kf12=\377\257, kf13=\377\213, -- kf14=\377\214, kf15=\377\215, kf16=\377\216, -- kf17=\377\217, kf18=\377\220, kf19=\377\221, -- kf2=\377\202, kf20=\377\222, kf21=\377\223, -- kf22=\377\224, kf23=\377\333, kf24=\377\334, -- kf25=\377\225, kf26=\377\226, kf27=\377\227, -- kf28=\377\230, kf29=\377\231, kf3=\377\203, -- kf30=\377\232, kf31=\377\233, kf32=\377\234, -- kf33=\377\235, kf34=\377\236, kf35=\377\276, -- kf36=\377\277, kf37=\377\321, kf38=\377\322, -- kf39=\377\323, kf4=\377\204, kf40=\377\324, -- kf41=\377\325, kf42=\377\326, kf43=\377\327, -- kf44=\377\330, kf45=\377\331, kf46=\377\332, -- kf47=\377\316, kf48=\377\317, kf5=\377\205, kf6=\377\206, -- kf7=\377\207, kf8=\377\210, kf9=\377\211, kfnd=\377\346, -- khlp=\377\350, khome=\377\240, khts=\377\342, -- kich1=\377\253, kil1=\377\273, kind=\377\261, -- kmov=\377\351, kmrk=\377\355, kmsg=\377\345, -- knp=\377\252, knxt=\377\312, kopn=\377\357, -- kopt=\377\353, kpp=\377\242, kprt=\377\255, -- kprv=\377\302, krdo=\377\336, kref=\377\354, -- kres=\377\360, krfr=\377\347, kri=\377\271, -- krmir=\377\313, krpl=\377\362, krst=\377\352, -- ksav=\377\361, kslt=\377\247, kspd=\377\335, -- ktbc=\377\344, kund=\377\365, mvpa=\E!%p1%02d, op=\ER, -- rep=\Eg%p2%{32}%+%c%p1%c, rev=\E(, ri=\EI, rmcup=\Eh\ER, -- rmso=\E), rmul=\E], rs1=\ER, setb=\E@%p1%Pb%gb%gf%d%d, -- setf=\E@%p1%Pf%gb%gf%d%d, sgr0=\E}\E]\E>\E), smcup=\Ei, -- smso=\E(, smul=\E[, -+# The versions of Terminal.app in Mac OS X version 10.3.x seem to have -+# the background color erase feature. The newer version 240.2 in Mac OS X -+# version 10.5 does not. - # -+# This entry is based on newsgroup comments by Alain Bench, Christian Ebert, -+# and D P Schreber comparing to nsterm-c-s-acs. - # --qnxt|qnxt4|QNX4 terminal, -- crxm, use=qnx4, -+# In Mac OS X version 10.4 and earlier, D P Schreber notes that $TERM -+# can be set in Terminal.app, e.g., - # --qnxm|QNX4 with mouse events, -- maddr#1, -- chr=\E/, cvr=\E", is1=\E/0t, mcub=\E/>1h, mcub1=\E/>7h, -- mcud=\E/>1h, mcud1=\E/>1l\E/>9h, mcuf=\E/>1h\E/>9l, -- mcuf1=\E/>7l, mcuu=\E/>6h, mcuu1=\E/>6l, rmicm=\E/>2l, -- smicm=\E/>2h, use=qnx4, -+# defaults write com.apple.Terminal TermCapString nsterm-bce - # --qnxw|QNX4 windows, -- xvpa, use=qnxm, -+# and that it is not set in Terminal's preferences dialog. - # --# Monochrome QNX4 terminal or console. Setting this terminal type will --# allow an application running on a color console to behave as if it --# were a monochrome terminal. Output will be through stdout instead of --# console writes because the term routines will recognize that the --# terminal name starts with 'qnxt'. -+# Modified for OS X 10.8, omitting bw based on testing with tack -TD - # --qnxtmono|Monochrome QNX4 terminal or console, -- colors@, pairs@, -- scp@, use=qnx4, -+# Notes: -+# * The terminal description matches the default settings. -+# * The keyboard is configurable via a dialog. -+# * By default khome, kend, knext and kprev are honored only with a -+# shift-modifier. -+# * There are bindings for control left/right arrow (but not up/down). -+# Added those to nsterm-16color, which is the version used for OS X 10.6 -+# * "Allow VT100 application keypage mode" is by default disabled. -+# There is no way to press keypad-comma unless application mode is enabled -+# and used. -+# * 132-column mode stopped working during vttest's tests. Consider it broken. -+# * CHT, REP, SU, SD are buggy. -+# * ECH works (also in Leopard), but is not used here for compatibility. -+# * The terminal preferences dialog replaces xterm-color by xterm-16color and -+# xterm-256color. However, it adds "nsterm", so it is possible to use the -+# nsterm entry from this file to override the MacPorts (20110404) or -+# system (20081102) copy of this file. -+# + In OS X 10.8 (Mountain Lion) the TERM which can be set in the preferences -+# dialog defaults to xterm-256color. Alternative selections are ansi, -+# dtterm, rxvt, vt52, vt100, vt102, xterm and xterm-16color. However, -+# the menu says "Declare terminal as" without promising to actually emulate -+# the corresponding terminals. Indeed, changing TERM does not affect the -+# emulation itself. This means that -+# + the function-keys do not match for dtterm for kf1-kf4 as well as -+# khome/kend -+# + the color model is the same for each setting of TERM (does not match -+# ansi or dtterm). -+# + the shift/control/meta key modifiers from rxvt and xterm variants are not -+# recognised except for a few special cases, i.e., kRIT5 and kLFT5. -+# + the vt52 emulation does not give a usable shell because screen-clearing -+# does not work as expected. -+# + selecting "xterm" or "xterm-16color" sets TERM to "xterm-256color". -+nsterm-bce|AppKit Terminal.app v71+/v100.1.8+ with Mac OS X version 10.3/10.4 (bce), -+ bce, use=nsterm-16color, - --# From: Federico Bianchi <bianchi@pc-arte2.arte.unipi.it>, 1 Jul 1998 --# (esr: commented out <scp> and <rmcup> to avoid warnings.) --# (TD: derive from original qnx4 entry) --qnxt2|qnx 2.15 serial terminal, -- am, -- civis@, cnorm@, cvvis@, dch1@, ich1@, kRES@, kRPL@, kUND@, kspd@, -- rep@, rmcup@, rmso=\E>, setb@, setf@, smcup@, smso=\E<, use=qnx4, -+# This is tested with OS X 10.8 (Mountain Lion), 2012/08/11 -+# TERM_PROGRAM_VERSION=309 -+# Earlier reports state that these differences also apply to OS X 10.7 (Lion), -+# TERM_PROGRAM_VERSION=303 -+nsterm-256color|Terminal.app in OS X 10.8, -+ ccc@, -+ initc@, use=xterm+256color, use=nsterm-bce, - --# QNX ANSI terminal definition --qansi-g|QNX ANSI, -- am, eslok, hs, xon, -- colors#8, cols#80, it#8, lines#25, ncv#19, pairs#64, wsl#80, -- acsc=Oa``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -- bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l, -- clear=\E[2J\E[H, cnorm=\E[?25h\E[?12l, cr=^M, -- csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=\E[D, -- cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, cuf1=\E[C, -- cup=\E[%i%p1%d;%p2%dH$<5>, cuu=\E[%p1%dA, cuu1=\E[A, -- cvvis=\E[?12;25h, dch=\E[%p1%dP, dch1=\E[P, dim=\E[2m, -- dl=\E[%p1%dM, dl1=\E[1M, dsl=\E[r, ech=\E[%p1%dX, ed=\E[J, -- el=\E[K, el1=\E[1K\E[X, flash=\E[?5h$<200>\E[?5l, -- fsl=\E[?6h\E8, home=\E[H, hpa=\E[%i%p1%dG, ht=^I, hts=\EH, -- ich=\E[%p1%d@, ich1=\E[1@, il=\E[%p1%dL, il1=\E[1L, -- ind=\E[S, indn=\E[%p1%dS, invis=\E[9m, -- is2=\E>\E[?1l\E[?7h\E[0;10;39;49m, is3=\E(B\E)0, -- kBEG=\ENn, kCAN=\E[s, kCMD=\E[t, kCPY=\ENs, kCRT=\ENt, -- kDL=\ENv, kEXT=\ENw, kFND=\ENx, kHLP=\ENy, kHOM=\E[h, -- kLFT=\E[d, kNXT=\E[u, kOPT=\ENz, kPRV=\E[v, kRIT=\E[c, -- kbs=^H, kcan=\E[S, kcbt=\E[Z, kclo=\ENc, kclr=\ENa, -- kcmd=\E[G, kcpy=\E[g, kctab=\E[z, kcub1=\E[D, kcud1=\E[B, -- kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[P, kdl1=\E[p, kend=\E[Y, -- kext=\E[y, kf1=\EOP, kf10=\EOY, kf11=\EOZ, kf12=\EOA, -- kf13=\EOp, kf14=\EOq, kf15=\EOr, kf16=\EOs, kf17=\EOt, -- kf18=\EOu, kf19=\EOv, kf2=\EOQ, kf20=\EOw, kf21=\EOx, -- kf22=\EOy, kf23=\EOz, kf24=\EOa, kf25=\E[1~, kf26=\E[2~, -- kf27=\E[3~, kf28=\E[4~, kf29=\E[5~, kf3=\EOR, kf30=\E[6~, -- kf31=\E[7~, kf32=\E[8~, kf33=\E[9~, kf34=\E[10~, -- kf35=\E[11~, kf36=\E[12~, kf37=\E[17~, kf38=\E[18~, -- kf39=\E[19~, kf4=\EOS, kf40=\E[20~, kf41=\E[21~, -- kf42=\E[22~, kf43=\E[23~, kf44=\E[24~, kf45=\E[25~, -- kf46=\E[26~, kf47=\E[27~, kf48=\E[28~, kf5=\EOT, kf6=\EOU, -- kf7=\EOV, kf8=\EOW, kf9=\EOX, kfnd=\ENf, khlp=\ENh, -- khome=\E[H, khts=\ENb, kich1=\E[@, kil1=\E[`, kind=\E[a, -- kmov=\ENi, kmrk=\ENm, kmsg=\ENe, knp=\E[U, kopn=\ENo, -- kopt=\ENk, kpp=\E[V, kref=\ENl, kres=\ENp, krfr=\ENg, -- kri=\E[b, krpl=\ENr, krst=\ENj, ksav=\ENq, kslt=\E[T, -- ktbc=\ENd, kund=\ENu, ll=\E[99H, nel=\EE, op=\E[39;49m, -- rep=%p1%c\E[%p2%{1}%-%db, rev=\E[7m, ri=\E[T, -- rin=\E[%p1%dT, rmacs=^O, rmam=\E[?7l, rmso=\E[27m, -- rmul=\E[24m, rs1=\017\E[?7h\E[0;39;49m$<2>\E>\E[?1l, -- rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, -- setb=\E[4%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m, -- setf=\E[3%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m, -- sgr=\E[0%?%p6%t;1%;%?%p5%t;2%;%?%p2%t;4%;%?%p4%t;5%;%?%p3%p1%|%t;7%;%?%p7%t;9%;m%?%p9%t\016%e\017%;, -- sgr0=\E[m\017, smacs=^N, smam=\E[?7h, smso=\E[7m, -- smul=\E[4m, tbc=\E[3g, -- tsl=\E7\E1;24r\E[?6l\E[25;%i%p1%dH, -+# This is an alias which should always point to the "current" version -+nsterm|Apple_Terminal|AppKit Terminal.app, -+ use=nsterm-256color, -+ -+# iTerm.app from http://iterm.sourceforge.net/ is an alternative (and -+# more featureful) terminal emulator for Mac OS X. It is similar -+# enough in capabilities to nsterm-16color that I have derived this -+# description from that one, but as far as I know they share no code. -+# Many of the features are user-configurable, but I attempt only to -+# describe the default configuration. - # --qansi|QNX ansi with console writes, -- daisy, xhpa, use=qansi-g, -+# NOTE: When tack tests (csr) + (nel) iTerm.app crashes, so (csr) is -+# disabled. -+iTerm.app|iTerm.app terminal emulator for Mac OS X, -+ bce, bw@, ccc@, -+ csr@, initc@, kend=\EOF, khome=\EOH, use=xterm+256color, -+ use=nsterm-16color, -+ -+# xnuppc - Darwin PowerPC Console (a.k.a. "darwin") - # --qansi-t|QNX ansi without console writes, -- crxm, use=qansi, -+# On PowerPC platforms, Apple's Darwin operating system uses a -+# full-screen system console derived from a NetBSD framebuffer -+# console. It is an ANSI-style terminal, and is not really VT-100 -+# compatible. - # --qansi-m|QNX ansi with mouse, -- maddr#1, -- chr=\E[, cvr=\E], is1=\E[0t, mcub=\E[>1h, mcub1=\E[>7h, -- mcud=\E[>1h, mcud1=\E[>1l\E[>9h, mcuf=\E[>1h\E[>9l, -- mcuf1=\E[>7l, mcuu=\E[>6h, mcuu1=\E[>6l, rmicm=\E[>2l, -- smicm=\E[>2h, use=qansi, -+# Under Mac OS X, this is the system console driver used while in -+# single-user mode [reachable by holding down Command-S during the -+# boot process] and when logged in using console mode [reachable by -+# typing ">console" at the graphical login prompt.] - # --qansi-w|QNX ansi for windows, -- xvpa, use=qansi-m, -- --#### NetBSD consoles -+# If you're looking for a description of the Terminal.app terminal -+# emulator which runs under the Mac OS X Quartz windowing system (and -+# other AppKit-supported windowing systems,) see the "nsterm" -+# entry instead. - # --# pcvt termcap database entries (corresponding to release 3.31) --# Author's last edit-date: [Fri Sep 15 20:29:10 1995] -+# NOTE: Under Mac OS X version 10.1, the default login window does not -+# prompt for user name, instead requiring an icon to be selected from -+# a list of known users. Since the special ">console" login is not in -+# this list, you must make one of two changes in the Login Window -+# panel of the Login section of System Prefs to make the special -+# ">console" login accessible. The first option is to enable 'Show -+# "Other User" in list for network users', which will add a special -+# "Other..." icon to the graphical login panel. Selecting "Other..." -+# will present the regular graphical login prompt. The second option -+# is to change the 'Display Login Window as:' setting to 'Name and -+# password entry fields', which replaces the login panel with a -+# graphical login prompt. - # --# (For the terminfo master file, I translated these into terminfo syntax. --# Then I dropped all the pseudo-HP entries. we don't want and can't use --# the :Xs: flag. Then I split :is: into a size-independent <is1> and a --# size-dependent <is2>. Finally, I added <rmam>/<smam> -- esr) -+# There are no function keys, at least not in Darwin 1.3. -+# -+# It has no mouse support. -+# -+# It has full ANSI color support, and color combines correctly with -+# all three supported attributes: bold, inverse-video and underline. -+# However, bold colored text is almost unreadable (bolding is -+# accomplished using shifting and or-ing, and looks smeared) so bold -+# has been excluded from the list of color-compatible attributes -+# [using (ncv)]. The monochrome entry (-m) is useful if you use a -+# monochrome monitor. -+# -+# There is one serious bug with this terminal emulation's color -+# support: repositioning the cursor onto a cell with non-matching -+# colors obliterates that cell's contents, replacing it with a blank -+# and displaying a colored cursor in the "current" colors. There is -+# no complete workaround at present [other than using the monochrome -+# (-m) entries,] but removing the (msgr) capability seemed to help. -+# -+# The "standout" chosen was simple reverse-video, although a colorful -+# standout might be more aesthetically pleasing. Similarly, the bold -+# chosen is the terminal's own smeared bold, although a simple -+# color-change might be more readable. The color-bold (-b) entries -+# uses magenta colored text for bolding instead. The fancy color (-f -+# and -f2) entries use color for bold, standout and underlined text -+# (underlined text is still underlined, though.) -+# -+# Apparently the terminal emulator does support a VT-100-style -+# alternate character set, but all the alternate character set -+# positions have been left blank in the font. For this reason, no -+# alternate character set capabilities have been included in this -+# description. The console driver appears to be ASCII-only, so (enacs) -+# has been excluded [although the VT-100 sequence does work.] -+# -+# The default Mac OS X and Darwin installation reports "vt100" as the -+# terminal type, and exports no helpful environment variables. To fix -+# this, change the "console" entry in /etc/ttys from "vt100" to -+# "xnuppc-WxH", where W and H are the character dimensions of your -+# console (see below.) -+# -+# The font used by the terminal emulator is apparently one originally -+# drawn by Ka-Ping Yee, and uses 8x16-pixel characters. This -+# file includes descriptions for the following geometries: -+# -+# Pixels Characters Entry Name (append -m for monochrome) -+# ------------------------------------------------------------------- -+# 640x400 80x25 xnuppc-80x25 -+# 640x480 80x30 xnuppc-80x30 -+# 720x480 90x30 xnuppc-90x30 -+# 800x600 100x37 xnuppc-100x37 -+# 896x600 112x37 xnuppc-112x37 -+# 1024x640 128x40 xnuppc-128x40 -+# 1024x768 128x48 xnuppc-128x48 -+# 1152x768 144x48 xnuppc-144x48 -+# 1280x1024 160x64 xnuppc-160x64 -+# 1600x1024 200x64 xnuppc-200x64 -+# 1600x1200 200x75 xnuppc-200x75 -+# 2048x1536 256x96 xnuppc-256x96 -+# -+# The basic "xnuppc" entry includes no size information, and the -+# emulator includes no reporting capability, so you'll be at the mercy -+# of the TTY device (which reports incorrectly on my hardware.) The -+# color-bold entries do not include size information. - --# NOTE: <ich1> has been taken out of this entry. for reference, it should --# be <ich1=\E[@>. For discussion, see ICH/ICH1 VERSUS RMIR/SMIR below. --# (esr: added <civis> and <cnorm> to resolve NetBSD Problem Report #4583) --pcvtXX|pcvt vt200 emulator (DEC VT220), -- am, km, mir, msgr, xenl, -- it#8, vt#3, -- acsc=++\,\,--..00``aaffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz~~, -- bel=^G, blink=\E[5m, bold=\E[1m, civis=\E[?25l, -- clear=\E[H\E[J, cnorm=\E[?25h, cr=^M, -- csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, -- cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, cuf1=\E[C, -- cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, -- dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, -- el=\E[K, el1=\E[1K, home=\E[H, ht=^I, hts=\EH, ich=\E[%p1%d@, -- il=\E[%p1%dL, il1=\E[L, ind=\ED, indn=\E[%p1%dS, -- is1=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, kbs=\177, -- kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, -- kdch1=\E[3~, kf1=\E[17~, kf2=\E[18~, kf3=\E[19~, -- kf4=\E[20~, kf5=\E[21~, kf6=\E[23~, kf7=\E[24~, kf8=\E[25~, -- khome=\E[1~, kich1=\E[2~, kll=\E[4~, knp=\E[6~, kpp=\E[5~, -- nel=\EE, rc=\E8, rev=\E[7m, rf=/usr/share/tabset/vt100, -- ri=\EM, rin=\E[%p1%dT, rmacs=\E(B, rmam=\E[?7l, rmir=\E[4l, -- rmkx=\E[?1l\E>, rmso=\E[27m, rmul=\E[24m, -- rs1=\Ec\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sc=\E7, -- sgr0=\E[m, smacs=\E(0, smam=\E[?7h, smir=\E[4h, -- smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, tbc=\E[3g, -+# The '+' entries are building blocks -+xnuppc+basic|Darwin PowerPC Console basic capabilities, -+ am, bce, mir, xenl, -+ it#8, -+ bold=\E[1m, clear=\E[H\E[J, cr=^M, csr=\E[%i%p1%d;%p2%dr, -+ cub=\E[%p1%dD, cub1=\E[D, cud=\E[%p1%dB, cud1=\E[B, -+ cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, -+ cuu=\E[%p1%dA, cuu1=\E[A, dsl=\E]2;\007, ed=\E[J, el=\E[K, -+ el1=\E[1K, home=\E[H, ht=^I, hts=\EH, ind=^J, kbs=\177, -+ kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, rc=\E8, -+ rev=\E[7m, ri=\EM, rmam=\E[?7l, rmkx=\E[?1l\E>, rmso=\E[m, -+ rmul=\E[m, rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, -+ sc=\E7, -+ sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;m, -+ sgr0=\E[m, smam=\E[?7h, smkx=\E[?1h\E=, smso=\E[7m, -+ smul=\E[4m, tbc=\E[3g, use=vt100+keypad, - --# NetBSD/FreeBSD vt220 terminal emulator console (pc keyboard & monitor) --# termcap entries for pure VT220-Emulation and 25, 28, 35, 40, 43 and --# 50 lines entries; 80 columns --pcvt25|dec vt220 emulation with 25 lines, -- cols#80, lines#25, -- is2=\E[1;25r\E[25;1H, use=pcvtXX, --pcvt28|dec vt220 emulation with 28 lines, -- cols#80, lines#28, -- is2=\E[1;28r\E[28;1H, use=pcvtXX, --pcvt35|dec vt220 emulation with 35 lines, -- cols#80, lines#35, -- is2=\E[1;35r\E[35;1H, use=pcvtXX, --pcvt40|dec vt220 emulation with 40 lines, -- cols#80, lines#40, -- is2=\E[1;40r\E[40;1H, use=pcvtXX, --pcvt43|dec vt220 emulation with 43 lines, -- cols#80, lines#43, -- is2=\E[1;43r\E[43;1H, use=pcvtXX, --pcvt50|dec vt220 emulation with 50 lines, -- cols#80, lines#50, -- is2=\E[1;50r\E[50;1H, use=pcvtXX, -+xnuppc+c|Darwin PowerPC Console ANSI color support, -+ colors#8, ncv#32, pairs#64, -+ op=\E[37;40m, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, - --# NetBSD/FreeBSD vt220 terminal emulator console (pc keyboard & monitor) --# termcap entries for pure VT220-Emulation and 25, 28, 35, 40, 43 and --# 50 lines entries; 132 columns --pcvt25w|dec vt220 emulation with 25 lines and 132 cols, -- cols#132, lines#25, -- is2=\E[1;25r\E[25;1H, use=pcvtXX, --pcvt28w|dec vt220 emulation with 28 lines and 132 cols, -- cols#132, lines#28, -- is2=\E[1;28r\E[28;1H, use=pcvtXX, --pcvt35w|dec vt220 emulation with 35 lines and 132 cols, -- cols#132, lines#35, -- is2=\E[1;35r\E[35;1H, use=pcvtXX, --pcvt40w|dec vt220 emulation with 40 lines and 132 cols, -- cols#132, lines#40, -- is2=\E[1;40r\E[40;1H, use=pcvtXX, --pcvt43w|dec vt220 emulation with 43 lines and 132 cols, -- cols#132, lines#43, -- is2=\E[1;43r\E[43;1H, use=pcvtXX, --pcvt50w|dec vt220 emulation with 50 lines and 132 cols, -- cols#132, lines#50, -- is2=\E[1;50r\E[50;1H, use=pcvtXX, -+xnuppc+b|Darwin PowerPC Console color-bold support, -+ ncv#32, -+ bold=\E[35m, -+ sgr=\E[0%?%p6%t;35%;%?%p2%t;4%;%?%p1%p3%|%t;7%;m, -+ use=xnuppc+basic, - --# OpenBSD implements a color variation --pcvt25-color|dec vt220 emulation with 25 lines and color, -+xnuppc+f|Darwin PowerPC Console fancy color support, -+ ncv#35, -+ sgr=\E[0%?%p6%t;35%;%?%p2%t;36;4%;%?%p1%t;33;44%;%?%p3%t;7%;m, -+ smso=\E[33;44m, smul=\E[36;4m, use=xnuppc+b, -+ -+xnuppc+f2|Darwin PowerPC Console alternate fancy color support, -+ ncv#35, -+ bold=\E[33m, -+ sgr=\E[0%?%p6%t;33%;%?%p2%t;34%;%?%p1%t;31;47%;%?%p3%t;7%;m, -+ smso=\E[31;47m, smul=\E[34m, use=xnuppc+basic, -+ -+# Building blocks for specific screen sizes -+xnuppc+80x25|Darwin PowerPC Console 80x25 support (640x400 pixels), - cols#80, lines#25, -- is2=\E[1;25r\E[25;1H, kf1=\EOP, kf10=\E[29~, kf11=\E[23~, -- kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, kf15=\E[28~, -- kf16=\E[29~, kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, -- kf2=\EOQ, kf20=\E[34~, kf3=\EOR, kf4=\EOS, kf5=\E[17~, -- kf6=\E[18~, kf7=\E[19~, kf8=\E[20~, kf9=\E[21~, use=pcvtXX, -- use=ecma+color, - --# Terminfo entries to enable the use of the ncurses library in colour on a --# NetBSD-arm32 console (only tested on a RiscPC). --# Created by Dave Millen <dmill@globalnet.co.uk> 22.07.98 --# modified codes for setf/setb to setaf/setab, then to klone+color, corrected --# typo in invis - TD --arm100|arm100-am|Arm(RiscPC) ncurses compatible (for 640x480), -- am, bce, msgr, xenl, xon, -- cols#80, it#8, lines#30, -- acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -- bel=^G, blink=\E[5m$<2>, bold=\E[1m$<2>, -- clear=\E[H\E[J$<50>, cr=^M, csr=\E[%i%p1%d;%p2%dr, -- cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=^J, -- cuf=\E[%p1%dC, cuf1=\E[C$<2>, -- cup=\E[%i%p1%d;%p2%dH$<5>, cuu=\E[%p1%dA, -- cuu1=\E[A$<2>, ed=\E[J$<50>, el=\E[K$<3>, el1=\E[1K$<3>, -- enacs=\E(B\E)0, home=\E[H, ht=^I, hts=\EH, ind=^J, -- invis=\E[8m$<2>, ka1=\E[q, ka3=\E[s, kb2=\E[r, kbs=^H, -- kc1=\E[p, kc3=\E[n, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, -- kcuu1=\E[A, kent=\E[M, kf0=\E[y, kf1=\E[P, kf10=\E[x, -- kf2=\E[Q, kf3=\E[R, kf4=\E[S, kf5=\E[t, kf6=\E[u, kf7=\E[v, -- kf8=\E[l, kf9=\E[w, rc=\E8, rev=\E[7m$<2>, ri=\EM$<5>, -- rmacs=^O, rmam=\E[?7l, rmkx=\E[?1l\E>, rmso=\E[m$<2>, -- rmul=\E[m$<2>, rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, -- sc=\E7, -- sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p7%t;8%;m%?%p9%t\016%e\017%;$<2>, -- sgr0=\E[m\017$<2>, smacs=^N, smam=\E[?7h, smkx=\E[?1h\E=, -- smso=\E[7m$<2>, smul=\E[4m$<2>, tbc=\E[3g, use=ecma+sgr, -- use=klone+color, -+xnuppc+80x30|Darwin PowerPC Console 80x30 support (640x480 pixels), -+ cols#80, lines#30, - --arm100-w|arm100-wam|Arm(RiscPC) ncurses compatible (for 1024x768), -- cols#132, lines#50, use=arm100, -+xnuppc+90x30|Darwin PowerPC Console 90x30 support (720x480 pixels), -+ cols#90, lines#30, - --# NetBSD/x68k console vt200 emulator. This port runs on a 68K machine --# manufactured by Sharp for the Japenese market. --# From Minoura Makoto <minoura@netlaputa.or.jp>, 12 May 1996 --x68k|x68k-ite|NetBSD/x68k ITE, -- cols#96, lines#32, -- kclr=\E[9~, khlp=\E[28~, use=vt220, -+xnuppc+100x37|Darwin PowerPC Console 100x37 support (800x600 pixels), -+ cols#100, lines#37, - --# <tv@pobox.com>: --# Entry for the DNARD OpenFirmware console, close to ANSI but not quite. --# --# (still unfinished, but good enough so far.) --ofcons|DNARD OpenFirmware console, -- bw, -- cols#80, lines#30, -- bel=^G, blink=\2337;2m, bold=\2331m, clear=^L, cr=^M, -- cub=\233%p1%dD, cub1=\233D, cud=\233%p1%dB, cud1=\233B, -- cuf=\233%p1%dC, cuf1=\233C, cup=\233%i%p1%d;%p2%dH, -- cuu=\233%p1%dA, cuu1=\233A, dch=\233%p1%dP, dch1=\233P, -- dim=\2332m, dl=\233%p1%dM, dl1=\233M, ed=\233J, el=\233K, -- flash=^G, ht=^I, ich=\233%p1%d@, ich1=\233@, il=\233%p1%dL, -- il1=\233L, ind=^J, invis=\2338m, kbs=^H, kcub1=\233D, -- kcud1=\233B, kcuf1=\233C, kcuu1=\233A, kdch1=\233P, -- kf1=\2330P, kf10=\2330M, kf2=\2330Q, kf3=\2330W, -- kf4=\2330x, kf5=\2330t, kf6=\2330u, kf7=\2330q, kf8=\2330r, -- kf9=\2330p, knp=\233/, kpp=\233?, nel=^M^J, rev=\2337m, -- rmso=\2330m, rmul=\2330m, -- sgr=\2330%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;m, -- sgr0=\2330m, -+xnuppc+112x37|Darwin PowerPC Console 112x37 support (896x600 pixels), -+ cols#112, lines#37, - --# NetBSD "wscons" emulator in vt220 mode. --# This entry is based on the NetBSD termcap entry, correcting the ncv value. --# The emulator renders underlined text in red. Colors are otherwise usable. --# --# Testing the emulator and reading the source code (NetBSD 2.0), it appears --# that "vt220" is inaccurate. There are a few vt220-features, but most of the --# vt220 screens in vttest do not work with this emulator. For instance, it --# identifies itself (primary DA response) as a vt220 with selective erase. But --# the selective erase feature does not work. The secondary response is copied --# from Kermit's emulation of vt220, does not correspond to actual vt220. At --# the level of detail in a termcap, it is a passable emulator, since ECH does --# work. Don't use it on a VMS system -TD --wsvt25|NetBSD wscons in 25 line DEC VT220 mode, -- bce, msgr, -- colors#8, cols#80, it#8, lines#25, ncv#2, pairs#64, -- is2=\E[r\E[25;1H, kend=\E[8~, kf1=\E[11~, kf10=\E[21~, -- kf11=\E[23~, kf12=\E[24~, kf2=\E[12~, kf3=\E[13~, -- kf4=\E[14~, kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, -- kf9=\E[20~, khome=\E[7~, op=\E[m, rs1=\Ec, -- setab=\E[4%p1%dm, setaf=\E[3%p1%dm, use=vt220, -+xnuppc+128x40|Darwin PowerPC Console 128x40 support (1024x640 pixels), -+ cols#128, lines#40, - --wsvt25m|NetBSD wscons in 25 line DEC VT220 mode with Meta, -- km, use=wsvt25, -+xnuppc+128x48|Darwin PowerPC Console 128x48 support (1024x768 pixels), -+ cols#128, lines#48, - --# `rasterconsole' provided by 4.4BSD, NetBSD and OpenBSD on SPARC, and --# DECstation/pmax. --rcons|BSD rasterconsole, -- use=sun-il, --# Color version of above. Color currently only provided by NetBSD. --rcons-color|BSD rasterconsole with ANSI color, -- bce, -- colors#8, pairs#64, -- op=\E[m, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, use=rcons, -+xnuppc+144x48|Darwin PowerPC Console 144x48 support (1152x768 pixels), -+ cols#144, lines#48, - --# mgterm -- MGL/MGL2, MobileGear Graphic Library --# for PocketBSD,PocketLinux,NetBSD/{hpcmips,mac68k} --# -- the setf/setb are probably incorrect, more likely setaf/setab -TD --# -- compare with cons25w --mgterm, -- OTbs, OTpt, am, bce, bw, eo, km, msgr, npc, -- colors#8, cols#80, it#8, lines#18, pairs#64, -- bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, clear=\E[H\E[J, -- cr=^M, csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, -- cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, cuf1=\E[C, -- cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, -- dch=\E[%p1%dP, dch1=\E[P, dim=\E[30;1m, dl=\E[%p1%dM, -- dl1=\E[M, ech=\E[%p1%dX, ed=\E[J, el=\E[K, el1=\E[1K, -- home=\E[H, hpa=\E[%i%p1%d`, ht=^I, ich=\E[%p1%d@, -- ich1=\E[@, il=\E[%p1%dL, il1=\E[L, ind=\E[S, -- indn=\E[%p1%dS, kb2=\E[E, kbs=^H, kcbt=\E[Z, kcub1=\E[D, -- kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=\177, kend=\E[F, -- kf1=\E[M, kf10=\E[V, kf11=\E[W, kf12=\E[X, kf2=\E[N, -- kf3=\E[O, kf4=\E[P, kf5=\E[Q, kf6=\E[R, kf7=\E[S, kf8=\E[T, -- kf9=\E[U, khome=\E[H, kich1=\E[L, knp=\E[G, kpp=\E[I, -- nel=\E[E, op=\E[x, rc=\E8, rev=\E[7m, ri=\E[T, rin=\E[%p1%dT, -- rmso=\E[m, rs2=\E[x\E[m\Ec, sc=\E7, setb=\E[4%p1%dm, -- setf=\E[3%p1%dm, sgr0=\E[m, smso=\E[7m, vpa=\E[%i%p1%dd, -+xnuppc+160x64|Darwin PowerPC Console 160x64 support (1280x1024 pixels), -+ cols#160, lines#64, - --#### FreeBSD console entries --# --# From: Andrey Chernov <ache@astral.msk.su> 29 Mar 1996 --# Andrey Chernov maintains the FreeBSD termcap distributions. --# --# Note: Users of FreeBSD 2.1.0 and older versions must either upgrade --# or comment out the :cb: capability in the console entry. --# --# Alexander Lukyanov reports: --# I have seen FreeBSD-2.1.5R... The old el1 bug changed, but it is still there. --# Now el1 clears not only to the line beginning, but also a large chunk --# of previous line. But there is another bug - ech does not work at all. --# -+xnuppc+200x64|Darwin PowerPC Console 200x64 support (1600x1024 pixels), -+ cols#200, lines#64, - --# for syscons --# common entry without semigraphics --# Bug: The <op> capability resets attributes. --# Bug? The ech and el1 attributes appear to move the cursor in some cases; for --# instance el1 does if the cursor is moved to the right margin first. Removed --# by T.Dickey 97/5/3 (ech=\E[%p1%dX, el1=\E[1K) --# --# Setting colors turns off reverse; we cannot guarantee order, so use ncv. --# Note that this disables standout with color. --# --# The emulator sends difference strings based on shift- and control-keys, --# like scoansi: --# F13-F24 are shifted F1-F12 --# F25-F36 are control F1-F12 --# F37-F48 are shift+control F1-F12 --cons25w|ansiw|ansi80x25-raw|freebsd console (25-line raw mode), -- am, bce, bw, eo, msgr, npc, -- colors#8, cols#80, it#8, lines#25, ncv#21, pairs#64, -- bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, clear=\E[H\E[J, -- cnorm=\E[=0C, cr=^M, cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, -- cud1=\E[B, cuf=\E[%p1%dC, cuf1=\E[C, -- cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, -- cvvis=\E[=1C, dch=\E[%p1%dP, dch1=\E[P, dim=\E[30;1m, -- dl=\E[%p1%dM, dl1=\E[M, ech=\E[%p1%dX, ed=\E[J, el=\E[K, -- home=\E[H, hpa=\E[%i%p1%d`, ht=^I, ich=\E[%p1%d@, -- ich1=\E[@, il=\E[%p1%dL, il1=\E[L, ind=\E[S, -- indn=\E[%p1%dS, kb2=\E[E, kbs=^H, kcbt=\E[Z, kcub1=\E[D, -- kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=\177, kend=\E[F, -- kf1=\E[M, kf10=\E[V, kf11=\E[W, kf12=\E[X, kf13=\E[Y, -- kf14=\E[Z, kf15=\E[a, kf16=\E[b, kf17=\E[c, kf18=\E[d, -- kf19=\E[e, kf2=\E[N, kf20=\E[f, kf21=\E[g, kf22=\E[h, -- kf23=\E[i, kf24=\E[j, kf25=\E[k, kf26=\E[l, kf27=\E[m, -- kf28=\E[n, kf29=\E[o, kf3=\E[O, kf30=\E[p, kf31=\E[q, -- kf32=\E[r, kf33=\E[s, kf34=\E[t, kf35=\E[u, kf36=\E[v, -- kf37=\E[w, kf38=\E[x, kf39=\E[y, kf4=\E[P, kf40=\E[z, -- kf41=\E[@, kf42=\E[[, kf43=\E[\\, kf44=\E[], kf45=\E[\^, -- kf46=\E[_, kf47=\E[`, kf48=\E[{, kf5=\E[Q, kf6=\E[R, -- kf7=\E[S, kf8=\E[T, kf9=\E[U, khome=\E[H, kich1=\E[L, -- knp=\E[G, kpp=\E[I, nel=\E[E, op=\E[x, rc=\E8, rev=\E[7m, -- ri=\E[T, rin=\E[%p1%dT, rmso=\E[m, rs2=\E[x\E[m\Ec, sc=\E7, -- setab=\E[4%p1%dm, setaf=\E[3%p1%dm, -- sgr=\E[0%?%p1%t;2;7%;%?%p3%t;7%;%?%p4%t;5%;%?%p5%t;30;1%;%?%p6%t;1%;m, -- sgr0=\E[m, smso=\E[7m, vpa=\E[%i%p1%dd, --cons25|ansis|ansi80x25|freebsd console (25-line ansi mode), -- acsc=-\030.^Y0\333`\004a\260f\370g\361h\261i\025j\331k\277l\332m\300n\305q\304t\303u\264v\301w\302x\263y\363z\362~\371, -- use=cons25w, --cons25-debian|freebsd console with debian backspace (25-line ansi mode), -- kbs=\177, kdch1=\E[3~, use=cons25, --cons25-m|ansis-mono|ansi80x25-mono|freebsd console (25-line mono ansi mode), -- colors@, pairs@, -- bold@, dim@, op@, rmul=\E[m, setab@, setaf@, -- sgr=\E[0%?%p1%t;2;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;m, -- smul=\E[4m, use=cons25, --cons30|ansi80x30|freebsd console (30-line ansi mode), -- lines#30, use=cons25, --cons30-m|ansi80x30-mono|freebsd console (30-line mono ansi mode), -- lines#30, use=cons25-m, --cons43|ansi80x43|freebsd console (43-line ansi mode), -- lines#43, use=cons25, --cons43-m|ansi80x43-mono|freebsd console (43-line mono ansi mode), -- lines#43, use=cons25-m, --cons50|ansil|ansi80x50|freebsd console (50-line ansi mode), -- lines#50, use=cons25, --cons50-m|ansil-mono|ansi80x50-mono|freebsd console (50-line mono ansi mode), -- lines#50, use=cons25-m, --cons60|ansi80x60|freebsd console (60-line ansi mode), -- lines#60, use=cons25, --cons60-m|ansi80x60-mono|freebsd console (60-line mono ansi mode), -- lines#60, use=cons25-m, --cons25r|pc3r|ibmpc3r|cons25-koi8-r|freebsd console w/koi8-r cyrillic, -- acsc=-\030.^Y0\215`\004a\220f\234h\221i\025j\205k\203l\202m\204n\212q\0t\206u\207v\211w\210x\201y\230z\231~\225, -- use=cons25w, --cons25r-m|pc3r-m|ibmpc3r-mono|cons25-koi8r-m|freebsd console w/koi8-r cyrillic (mono), -- colors@, pairs@, -- op@, rmul=\E[m, setab@, setaf@, -- sgr=\E[0%?%p1%t;2;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p5%t;30;1%;%?%p6%t;1%;m, -- smul=\E[4m, use=cons25r, --cons50r|cons50-koi8r|freebsd console w/koi8-r cyrillic (50 lines), -- lines#50, use=cons25r, --cons50r-m|cons50-koi8r-m|freebsd console w/koi8-r cyrillic (50-line mono), -- lines#50, use=cons25r-m, --cons60r|cons60-koi8r|freebsd console w/koi8-r cyrillic (60 lines), -- lines#60, use=cons25r, --cons60r-m|cons60-koi8r-m|freebsd console w/koi8-r cyrillic (60-line mono), -- lines#60, use=cons25r-m, --# ISO 8859-1 FreeBSD console --cons25l1|cons25-iso8859|freebsd console w/iso 8859-1 chars, -- acsc=+\253\,\273-\030.\031`\201a\202f\207g\210i\247j\213k\214l\215m\216n\217o\220p\221q\222r\223s\224t\225u\226v\227w\230x\231y\232z\233~\237, -- use=cons25w, --cons25l1-m|cons25-iso-m|freebsd console w/iso 8859-1 chars (mono), -- colors@, pairs@, -- bold@, dim@, op@, rmul=\E[m, setab@, setaf@, -- sgr=\E[0%?%p1%t;2;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;m, -- smul=\E[4m, use=cons25l1, --cons50l1|cons50-iso8859|freebsd console w/iso 8859-1 chars (50 lines), -- lines#50, use=cons25l1, --cons50l1-m|cons50-iso-m|freebsd console w/iso 8859-1 chars (50-line mono), -- lines#50, use=cons25l1-m, --cons60l1|cons60-iso|freebsd console w/iso 8859-1 chars (60 lines), -- lines#60, use=cons25l1, --cons60l1-m|cons60-iso-m|freebsd console w/iso 8859-1 chars (60-line mono), -- lines#60, use=cons25l1-m, -+xnuppc+200x75|Darwin PowerPC Console 200x75 support (1600x1200 pixels), -+ cols#200, lines#75, - --#### 386BSD and BSD/OS Consoles --# -+xnuppc+256x96|Darwin PowerPC Console 256x96 support (2048x1536 pixels), -+ cols#256, lines#96, - --# This was the original 386BSD console entry (I think). --# Some places it's named oldpc3|oldibmpc3. --# From: Alex R.N. Wetmore <aw2t@andrew.cmu.edu> --origpc3|origibmpc3|IBM PC 386BSD Console, -- OTbs, am, bw, eo, xon, -- cols#80, lines#25, -- acsc=j\331k\277l\332m\300n\305q\304t\303u\264v\301w\302x\263, -- bold=\E[7m, clear=\Ec, cub1=^H, cud1=\E[B, cuf1=\E[C, -- cup=\E[%i%p1%2d;%p2%2dH, cuu1=\E[A, ed=\E[J, el=\E[K, -- home=\E[H, ind=\E[S, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, -- kcuu1=\E[A, khome=\E[Y, ri=\E[T, rmso=\E[1;0x\E[2;7x, -- rmul=\E[1;0x\E[2;7x, sgr0=\E[m\E[1;0x\E[2;7x, -- smso=\E[1;7x\E[2;0x, smul=\E[1;7x\E[2;0x, -+# These are different combinations of the building blocks - --# description of BSD/386 console emulator in version 1.0 (supplied by BSDI) --oldpc3|oldibmpc3|old IBM PC BSD/386 Console, -- OTbs, km, -- lines#25, -- bel=^G, bold=\E[=15F, cr=^M, cud1=^J, dim=\E[=8F, dl1=\E[M, -- ht=^I, il1=\E[L, ind=^J, kbs=^H, kcub1=\E[D, kcud1=\E[B, -- kcuf1=\E[C, kcuu1=\E[A, khome=\E[H, kich1=\E[L, kll=\E[F, -- knp=\E[G, kpp=\E[I, nel=^M^J, sgr0=\E[=R, -+xnuppc-m|darwin-m|Darwin PowerPC Console (monochrome), -+ use=xnuppc+basic, - --# Description of BSD/OS console emulator in version 1.1, 2.0, 2.1 --# Note, the emulator supports many of the additional console features --# listed in the iBCS2 (e.g. character-set selection) though not all --# are described here. This entry really ought to be upgraded. --# Also note, the console will also work with fewer lines after doing --# "stty rows NN", e.g. to use 24 lines. --# (Color support from Kevin Rosenberg <kevin@cyberport.com>, 2 May 1996) --# Bug: The <op> capability resets attributes. --bsdos-pc|IBM PC BSD/OS Console, -- sgr=\E[0;10%?%p1%t;7%;%?%p2%t;1%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;%?%p7%t;8%;%?%p9%t;11%;m, -- use=bsdos-pc-nobold, -+xnuppc|darwin|Darwin PowerPC Console (color), -+ use=xnuppc+c, use=xnuppc+basic, - --bsdos-pc-nobold|BSD/OS PC console w/o bold, -- use=klone+color, use=bsdos-pc-m, -+xnuppc-m-b|darwin-m-b|Darwin PowerPC Console (monochrome w/color-bold), -+ use=xnuppc+b, - --bsdos-pc-m|bsdos-pc-mono|BSD/OS PC console mono, -- OTbs, am, eo, km, xon, -- cols#80, it#8, lines#25, -- bel=^G, clear=\Ec, cr=^M, cub=\E[%p1%dD, cub1=^H, -- cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, -- cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, -- dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[K, home=\E[H, ht=^I, -- il=\E[%p1%dL, il1=\E[L, ind=^J, kbs=^H, kcub1=\E[D, -- kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, khome=\E[H, kich1=\E[L, -- kll=\E[F, knp=\E[G, kpp=\E[I, nel=^M^J, rc=\E8, sc=\E7, -- sgr=\E[0;10%?%p1%t;7%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;%?%p7%t;8%;%?%p9%t;11%;m%?%p5%t\E[=8F%;, -- use=klone+sgr8, -+xnuppc-b|darwin-b|Darwin PowerPC Console (color w/color-bold), -+ use=xnuppc+b, use=xnuppc+c, - --# Old names for BSD/OS PC console used in releases before 4.1. --pc3|BSD/OS on the PC Console, -- use=bsdos-pc-nobold, --ibmpc3|pc3-bold|BSD/OS on the PC Console with bold instead of underline, -- use=bsdos-pc, -+xnuppc-m-f|darwin-m-f|Darwin PowerPC Console (fancy monochrome), -+ use=xnuppc+f, - --# BSD/OS on the SPARC --bsdos-sparc|Sun SPARC BSD/OS Console, -- use=sun, -+xnuppc-f|darwin-f|Darwin PowerPC Console (fancy color), -+ use=xnuppc+f, use=xnuppc+c, - --# BSD/OS on the PowerPC --bsdos-ppc|PowerPC BSD/OS Console, -- use=bsdos-pc, -+xnuppc-m-f2|darwin-m-f2|Darwin PowerPC Console (alternate fancy monochrome), -+ use=xnuppc+f2, - --#### DEC VT52 --# (<acsc>/<rmacs>/<smacs> capabilities aren't in DEC's official entry -- esr) --# --# Actually (TD pointed this out at the time the acsc string was added): --# vt52 shouldn't define full acsc since most of the cells don't match. --# see vt100 manual page A-31. This is the list that does match: --# f degree --# g plus/minus --# h right-arrow --# k down-arrow --# m scan-1 --# o scan-3 --# q scan-5 --# s scan-7 --# The line-drawing happens to work in several terminal emulators, but should --# not be used as a guide to the capabilities of the vt52. Note in particular --# that vt52 does not support line-drawing characters (the scan-X values refer --# to a crude plotting feature) -TD --vt52|dec vt52, -- OTbs, -- cols#80, it#8, lines#24, -- acsc=+h.k0affggolpnqprrss, bel=^G, clear=\EH\EJ, cr=^M, -- cub1=\ED, cud1=\EB, cuf1=\EC, -- cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, ed=\EJ, -- el=\EK, home=\EH, ht=^I, ind=^J, kbs=^H, kcub1=\ED, kcud1=\EB, -- kcuf1=\EC, kcuu1=\EA, nel=^M^J, ri=\EI, rmacs=\EG, smacs=\EF, -+xnuppc-f2|darwin-f2|Darwin PowerPC Console (alternate fancy color), -+ use=xnuppc+f2, use=xnuppc+c, - --#### DEC VT100 and compatibles --# --# DEC terminals from the vt100 forward are collected here. Older DEC terminals --# and micro consoles can be found in the `obsolete' section. More details on --# the relationship between the VT100 and ANSI X3.64/ISO 6429/ECMA-48 may be --# found near the end of this file. --# --# Except where noted, these entries are DEC's official terminfos. --# Contact Bill Hedberg <hedberg@hannah.enet.dec.com> of Terminal Support --# Engineering for more information. Updated terminfos and termcaps --# are kept available at ftp://gatekeeper.dec.com/pub/DEC/termcaps. --# --# In October 1995 DEC sold its terminals business, including the VT and Dorio --# line and trademark, to SunRiver Data Systems. SunRiver has since changed --# its name to Boundless Technologies; see http://www.boundless.com. --# -+# Combinations for specific screen sizes -+xnuppc-80x25-m|darwin-80x25-m|Darwin PowerPC Console (monochrome) 80x25, -+ use=xnuppc+80x25, use=xnuppc+basic, - --# NOTE: Any VT100 emulation, whether in hardware or software, almost --# certainly includes what DEC called the `Level 1 editing extension' codes; --# only the very oldest VT100s lacked these and there probably aren't any of --# those left alive. To capture these, use one of the VT102 entries. -+xnuppc-80x25|darwin-80x25|Darwin PowerPC Console (color) 80x25, -+ use=xnuppc+c, use=xnuppc+80x25, use=xnuppc+basic, -+ -+xnuppc-80x30-m|darwin-80x30-m|Darwin PowerPC Console (monochrome) 80x30, -+ use=xnuppc+80x30, use=xnuppc+basic, -+ -+xnuppc-80x30|darwin-80x30|Darwin PowerPC Console (color) 80x30, -+ use=xnuppc+c, use=xnuppc+80x30, use=xnuppc+basic, -+ -+xnuppc-90x30-m|darwin-90x30-m|Darwin PowerPC Console (monochrome) 90x30, -+ use=xnuppc+90x30, use=xnuppc+basic, -+ -+xnuppc-90x30|darwin-90x30|Darwin PowerPC Console (color) 90x30, -+ use=xnuppc+c, use=xnuppc+90x30, use=xnuppc+basic, -+ -+xnuppc-100x37-m|darwin-100x37-m|Darwin PowerPC Console (monochrome) 100x37, -+ use=xnuppc+100x37, use=xnuppc+basic, -+ -+xnuppc-100x37|darwin-100x37|Darwin PowerPC Console (color) 100x37, -+ use=xnuppc+c, use=xnuppc+100x37, use=xnuppc+basic, -+ -+xnuppc-112x37-m|darwin-112x37-m|Darwin PowerPC Console (monochrome) 112x37, -+ use=xnuppc+112x37, use=xnuppc+basic, -+ -+xnuppc-112x37|darwin-112x37|Darwin PowerPC Console (color) 112x37, -+ use=xnuppc+c, use=xnuppc+112x37, use=xnuppc+basic, -+ -+xnuppc-128x40-m|darwin-128x40-m|Darwin PowerPC Console (monochrome) 128x40, -+ use=xnuppc+128x40, use=xnuppc+basic, -+ -+xnuppc-128x40|darwin-128x40|Darwin PowerPC Console (color) 128x40, -+ use=xnuppc+c, use=xnuppc+128x40, use=xnuppc+basic, -+ -+xnuppc-128x48-m|darwin-128x48-m|Darwin PowerPC Console (monochrome) 128x48, -+ use=xnuppc+128x48, use=xnuppc+basic, -+ -+xnuppc-128x48|darwin-128x48|Darwin PowerPC Console (color) 128x48, -+ use=xnuppc+c, use=xnuppc+128x48, use=xnuppc+basic, -+ -+xnuppc-144x48-m|darwin-144x48-m|Darwin PowerPC Console (monochrome) 144x48, -+ use=xnuppc+144x48, use=xnuppc+basic, -+ -+xnuppc-144x48|darwin-144x48|Darwin PowerPC Console (color) 144x48, -+ use=xnuppc+c, use=xnuppc+144x48, use=xnuppc+basic, -+ -+xnuppc-160x64-m|darwin-160x64-m|Darwin PowerPC Console (monochrome) 160x64, -+ use=xnuppc+160x64, use=xnuppc+basic, -+ -+xnuppc-160x64|darwin-160x64|Darwin PowerPC Console (color) 160x64, -+ use=xnuppc+c, use=xnuppc+160x64, use=xnuppc+basic, -+ -+xnuppc-200x64-m|darwin-200x64-m|Darwin PowerPC Console (monochrome) 200x64, -+ use=xnuppc+200x64, use=xnuppc+basic, -+ -+xnuppc-200x64|darwin-200x64|Darwin PowerPC Console (color) 200x64, -+ use=xnuppc+c, use=xnuppc+200x64, use=xnuppc+basic, -+ -+xnuppc-200x75-m|darwin-200x75-m|Darwin PowerPC Console (monochrome) 200x75, -+ use=xnuppc+200x75, use=xnuppc+basic, -+ -+xnuppc-200x75|darwin-200x75|Darwin PowerPC Console (color) 200x75, -+ use=xnuppc+c, use=xnuppc+200x75, use=xnuppc+basic, -+ -+xnuppc-256x96-m|darwin-256x96-m|Darwin PowerPC Console (monochrome) 256x96, -+ use=xnuppc+256x96, use=xnuppc+basic, -+ -+xnuppc-256x96|darwin-256x96|Darwin PowerPC Console (color) 256x96, -+ use=xnuppc+c, use=xnuppc+256x96, use=xnuppc+basic, -+ -+ -+#### BeOS - # --# Note that the <xenl> glitch in vt100 is not quite the same as on the Concept, --# since the cursor is left in a different position while in the --# weird state (concept at beginning of next line, vt100 at end --# of this line) so all versions of vi before 3.7 don't handle --# <xenl> right on vt100. The correct way to handle <xenl> is when --# you output the char in column 80, immediately output CR LF --# and then assume you are in column 1 of the next line. If <xenl> --# is on, am should be on too. -+# BeOS entry for Terminal program Seems to be almost ANSI -+beterm|BeOS Terminal, -+ am, eo, mir, msgr, xenl, xon, -+ colors#8, cols#80, it#8, lines#25, ncv#5, pairs#64, -+ bel=^G, bold=\E[1m, clear=\E[H\E[J, cr=^M, -+ csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, -+ cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, -+ cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, -+ dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, -+ ech=\E[%p1%dX, ed=\E[J, el=\E[K, el1=\E[1K, home=\E[H, -+ hpa=\E[%i%p1%dG, ht=^I, hts=\EH, ich=\E[%p1%d@, ich1=\E[@, -+ il=\E[%p1%dL, il1=\E[L, ind=^J, kbs=^H, kcub1=\E[D, -+ kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[3~, -+ kend=\E[4~, kf1=\E[11~, kf10=\E[20~, kf11=\E[21~, -+ kf12=\E[22~, kf2=\E[12~, kf3=\E[13~, kf4=\E[14~, -+ kf5=\E[15~, kf6=\E[16~, kf7=\E[17~, kf8=\E[18~, kf9=\E[19~, -+ khome=\E[1~, kich1=\E[2~, knp=\E[6~, kpp=\E[5~, kspd=^Z, -+ nel=^M^J, op=\E[m, rc=\E8, rev=\E[7m, ri=\EM, rmir=\E[4l, -+ rmkx=\E[?4l, rmso=\E[m, rmul=\E[24m, rs1=\Ec, sc=\E7, -+ setab=\E[4%p1%dm, setaf=\E[3%p1%dm, -+ setb=\E[%p1%{40}%+%cm, setf=\E[%p1%{30}%+%cm, -+ sgr0=\E[0;10m, smir=\E[4h, smkx=\E[?4h, smso=\E[7m, -+ smul=\E[4m, u6=\E[%i%p1%d;%p2%dR, u7=\E[6n, -+ vpa=\E[%i%p1%dd, -+ -+#### Linux consoles - # --# I assume you have smooth scroll off or are at a slow enough baud --# rate that it doesn't matter (1200? or less). Also this assumes --# that you set auto-nl to "on", if you set it off use vt100-nam --# below. -+ -+# This entry is good for the 1.2.13 or later version of the Linux console. - # --# The padding requirements listed here are guesses. It is strongly --# recommended that xon/xoff be enabled, as this is assumed here. -+# *************************************************************************** -+# * * -+# * WARNING: * -+# * Linuxes come with a default keyboard mapping kcbt=^I. This entry, in * -+# * response to user requests, assumes kcbt=\E[Z, the ANSI/ECMA reverse-tab * -+# * character. Here are the keymap replacement lines that will set this up: * -+# * * -+# keycode 15 = Tab Tab -+# alt keycode 15 = Meta_Tab -+# shift keycode 15 = F26 -+# string F26 ="\033[Z" -+# * * -+# * This has to use a key slot which is unfortunate (any unused one will * -+# * do, F26 is the higher-numbered one). The change ought to be built * -+# * into the kernel tables. * -+# * * -+# *************************************************************************** - # --# The vt100 uses <rs2> and <rf> rather than <is2>/<tbc>/<hts> because the --# tab settings are in non-volatile memory and don't need to be --# reset upon login. Also setting the number of columns glitches --# the screen annoyingly. You can type "reset" to get them set. -+# All linux kernels since 1.2.13 (at least) set the screen size -+# themselves; this entry assumes that capability. - # --# The VT100 series terminals have cursor ("arrows") keys which can operate --# in two different modes: Cursor Mode and Application Mode. Cursor Mode --# is the reset state, and is assumed to be the normal state. Application --# Mode is the "set" state. In Cursor Mode, the cursor keys transmit --# "Esc [ {code}" sequences, conforming to ANSI standards. In Application --# Mode, the cursor keys transmit "Esc O <code>" sequences. Application Mode --# was provided primarily as an aid to the porting of VT52 applications. It is --# assumed that the cursor keys are normally in Cursor Mode, and expected that --# applications such as vi will always transmit the <smkx> string. Therefore, --# the definitions for the cursor keys are made to match what the terminal --# transmits after the <smkx> string is transmitted. If the <smkx> string --# is a null string or is not defined, then cursor keys are assumed to be in --# "Cursor Mode", and the cursor keys definitions should match that assumption, --# else the application may fail. It is also expected that applications will --# always transmit the <rmkx> string to the terminal before they exit. --# --# The VT100 series terminals have an auxiliary keypad, commonly referred to as --# the "Numeric Keypad", because it is a cluster of numeric and function keys. --# The Numeric Keypad which can operate in two different modes: Numeric Mode and --# Application Mode. Numeric Mode is the reset state, and is assumed to be --# the normal state. Application Mode is the "set" state. In Numeric Mode, --# the numeric and punctuation keys transmit ASCII 7-bit characters, and the --# Enter key transmits the same as the Return key (Note: the Return key --# can be configured to send either LF (\015) or CR LF). In Application Mode, --# all the keypad keys transmit "Esc O {code}" sequences. The PF1 - PF4 keys --# always send the same "Esc O {code}" sequences. It is assumed that the keypad --# is normally in Numeric Mode. If an application requires that the keypad be --# in Application Mode then it is expected that the user, or the application, --# will set the TERM environment variable to point to a terminfo entry which has --# defined the <smkx> string to include the codes that switch the keypad into --# Application Mode, and the terminfo entry will also define function key --# fields to match the Application Mode control codes. If the <smkx> string --# is a null string or is not defined, then the keypad is assumed to be in --# Numeric Mode. If the <smkx> string switches the keypad into Application --# Mode, it is expected that the <rmkx> string will contain the control codes --# necessary to reset the keypad to "Normal" mode, and it is also expected that --# applications which transmit the <smkx> string will also always transmit the --# <rmkx> string to the terminal before they exit. --# --# Here's a diagram of the VT100 keypad keys with their bindings. --# The top line is the name of the key (some DEC keyboards have the keys --# labelled somewhat differently, like GOLD instead of PF1, but this is --# the most "official" name). The second line is the escape sequence it --# generates in Application Keypad mode (where "$" means the ESC --# character). The third line contains two items, first the mapping of --# the key in terminfo, and then in termcap. --# _______________________________________ --# | PF1 | PF2 | PF3 | PF4 | --# | $OP | $OQ | $OR | $OS | --# |_kf1__k1_|_kf2__k2_|_kf3__k3_|_kf4__k4_| --# | 7 8 9 - | --# | $Ow | $Ox | $Oy | $Om | --# |_kf9__k9_|_kf10_k;_|_kf0__k0_|_________| --# | 4 | 5 | 6 | , | --# | $Ot | $Ou | $Ov | $Ol | --# |_kf5__k5_|_kf6__k6_|_kf7__k7_|_kf8__k8_| --# | 1 | 2 | 3 | | --# | $Oq | $Or | $Os | enter | --# |_ka1__K1_|_kb2__K2_|_ka3__K3_| $OM | --# | 0 | . | | --# | $Op | $On | | --# |___kc1_______K4____|_kc3__K5_|_kent_@8_| --# --# Note however, that the arrangement of the 5-key ka1-kc3 do not follow the --# terminfo guidelines. That is a compromise used to assign the remaining --# keys on the keypad to kf5-kf0, used on older systems with legacy termcap --# support: --vt100+keypad|dec vt100 numeric keypad no fkeys, -- ka1=\EOq, ka3=\EOs, kb2=\EOr, kc1=\EOp, kc3=\EOn, --vt100+pfkeys|dec vt100 numeric keypad, -- kent=\EOM, kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, -- use=vt100+keypad, --vt100+fnkeys|dec vt100 numeric keypad, -- kf0=\EOy, kf10=\EOx, kf5=\EOt, kf6=\EOu, kf7=\EOv, kf8=\EOl, -- kf9=\EOw, use=vt100+pfkeys, --# --# A better adaptation to modern keyboards such as the PC's, which have a dozen --# function keys and the keypad 2,4,6,8 keys are labeled with arrows keys, is to --# use the 5-key arrangement to model the arrow keys as suggested in the --# terminfo guidelines: --# _______________________________________ --# | PF1 | PF2 | PF3 | PF4 | --# | $OP | $OQ | $OR | $OS | --# |_kf1__k1_|_kf2__k2_|_kf3__k3_|_kf4__k4_| --# | 7 8 9 - | --# | $Ow | $Ox | $Oy | $Om | --# |_ka1__K1_|_________|_ka3__K3_|_________| --# | 4 | 5 | 6 | , | --# | $Ot | $Ou | $Ov | $Ol | --# |_________|_kb2__K2_|_________|_________| --# | 1 | 2 | 3 | | --# | $Oq | $Or | $Os | enter | --# |_kc1__K4_|_________|_kc3__K5_| $OM | --# | 0 | . | | --# | $Op | $On | | --# |___________________|_________|_kent_@8_| --# --vt220+keypad|dec vt220 numeric keypad, -- ka1=\EOw, ka3=\EOy, kb2=\EOu, kc1=\EOq, kc3=\EOs, kent=\EOM, -- kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, ka2=\EOx, kb1=\EOt, -- kb3=\EOv, kc2=\EOr, --# --vt100+enq|ncurses extension for vt100-style ENQ, -- u8=\E[?1;2c, use=ansi+enq, --vt102+enq|ncurses extension for vt102-style ENQ, -- u8=\E[?6c, use=ansi+enq, --# --# And here, for those of you with orphaned VT100s lacking documentation, is --# a description of the soft switches invoked when you do `Set Up'. --# --# Scroll 0-Jump Shifted 3 0-# --# | 1-Smooth | 1-British pound sign --# | Autorepeat 0-Off | Wrap Around 0-Off --# | | 1-On | | 1-On --# | | Screen 0-Dark Bkg | | New Line 0-Off --# | | | 1-Light Bkg | | | 1-On --# | | | Cursor 0-Underline | | | Interlace 0-Off --# | | | | 1-Block | | | | 1-On --# | | | | | | | | --# 1 1 0 1 1 1 1 1 0 1 0 0 0 0 1 0 <--Standard Settings --# | | | | | | | | --# | | | Auto XON/XOFF 0-Off | | | Power 0-60 Hz --# | | | 1-On | | | 1-50 Hz --# | | Ansi/VT52 0-VT52 | | Bits Per Char. 0-7 Bits --# | | 1-ANSI | | 1-8 Bits --# | Keyclick 0-Off | Parity 0-Off --# | 1-On | 1-On --# Margin Bell 0-Off Parity Sense 0-Odd --# 1-On 1-Even --# --# The following SET-UP modes are assumed for normal operation: --# ANSI_MODE AUTO_XON/XOFF_ON NEWLINE_OFF 80_COLUMNS --# WRAP_AROUND_ON JUMP_SCROLL_OFF --# Other SET-UP modes may be set for operator convenience or communication --# requirements; I recommend --# AUTOREPEAT_ON BLOCK_CURSOR MARGIN_BELL_OFF SHIFTED_3_# --# Unless you have a graphics add-on such as Digital Engineering's VT640 --# (and even then, whenever it can be arranged!) you should set --# INTERLACE_OFF --# --# (vt100: I added <rmam>/<smam> based on the init string, also <OTbs>. -- esr) --vt100|vt100-am|dec vt100 (w/advanced video), -- OTbs, am, mc5i, msgr, xenl, xon, -- cols#80, it#8, lines#24, vt#3, -- acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -- bel=^G, blink=\E[5m$<2>, bold=\E[1m$<2>, -- clear=\E[H\E[J$<50>, cr=^M, csr=\E[%i%p1%d;%p2%dr, -+linux-basic|linux console, -+ am, bce, eo, mir, msgr, xenl, xon, -+ it#8, ncv#18, U8#1, -+ acsc=+\020\,\021-\030.^Y0\333`\004a\261f\370g\361h\260i\316j\331k\277l\332m\300n\305o~p\304q\304r\304s_t\303u\264v\301w\302x\263y\363z\362{\343|\330}\234~\376, -+ bel=^G, clear=\E[H\E[J, cr=^M, csr=\E[%i%p1%d;%p2%dr, - cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=^J, -- cuf=\E[%p1%dC, cuf1=\E[C$<2>, -- cup=\E[%i%p1%d;%p2%dH$<5>, cuu=\E[%p1%dA, -- cuu1=\E[A$<2>, ed=\E[J$<50>, el=\E[K$<3>, el1=\E[1K$<3>, -- enacs=\E(B\E)0, home=\E[H, ht=^I, hts=\EH, ind=^J, kbs=^H, -- kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, lf1=pf1, -- lf2=pf2, lf3=pf3, lf4=pf4, mc0=\E[0i, mc4=\E[4i, mc5=\E[5i, -- rc=\E8, rev=\E[7m$<2>, ri=\EM$<5>, rmacs=^O, rmam=\E[?7l, -- rmkx=\E[?1l\E>, rmso=\E[m$<2>, rmul=\E[m$<2>, -- rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sc=\E7, -- sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;$<2>, -- sgr0=\E[m\017$<2>, smacs=^N, smam=\E[?7h, smkx=\E[?1h\E=, -- smso=\E[7m$<2>, smul=\E[4m$<2>, tbc=\E[3g, -- use=vt100+fnkeys, --vt100nam|vt100-nam|vt100 no automargins, -- am@, xenl@, use=vt100-am, --vt100-vb|dec vt100 (w/advanced video) & no beep, -- bel@, flash=\E[?5h\E[?5l, use=vt100, -+ cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, -+ cuu=\E[%p1%dA, cuu1=\E[A, dch=\E[%p1%dP, dch1=\E[P, -+ dim=\E[2m, dl=\E[%p1%dM, dl1=\E[M, ech=\E[%p1%dX, ed=\E[J, -+ el=\E[K, el1=\E[1K, flash=\E[?5h\E[?5l$<200/>, home=\E[H, -+ hpa=\E[%i%p1%dG, ht=^I, hts=\EH, ich=\E[%p1%d@, ich1=\E[@, -+ il=\E[%p1%dL, il1=\E[L, ind=^J, kb2=\E[G, kbs=\177, -+ kcbt=\E[Z, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, -+ kdch1=\E[3~, kend=\E[4~, kf1=\E[[A, kf10=\E[21~, -+ kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, -+ kf15=\E[28~, kf16=\E[29~, kf17=\E[31~, kf18=\E[32~, -+ kf19=\E[33~, kf2=\E[[B, kf20=\E[34~, kf3=\E[[C, kf4=\E[[D, -+ kf5=\E[[E, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, -+ khome=\E[1~, kich1=\E[2~, kmous=\E[M, knp=\E[6~, kpp=\E[5~, -+ kspd=^Z, nel=^M^J, rc=\E8, rev=\E[7m, ri=\EM, rmam=\E[?7l, -+ rmir=\E[4l, rmso=\E[27m, rmul=\E[24m, rs1=\Ec\E]R, sc=\E7, -+ sgr=\E[0;10%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p5%t;2%;%?%p6%t;1%;%?%p9%t;11%;m, -+ smam=\E[?7h, smir=\E[4h, smul=\E[4m, tbc=\E[3g, -+ vpa=\E[%i%p1%dd, use=vt102+enq, use=klone+sgr, -+ use=ecma+color, - --# Ordinary vt100 in 132 column ("wide") mode. --vt100-w|vt100-w-am|dec vt100 132 cols (w/advanced video), -- cols#132, lines#24, -- rs2=\E>\E[?3h\E[?4l\E[?5l\E[?8h, use=vt100-am, --vt100-w-nam|vt100-nam-w|dec vt100 132 cols (w/advanced video no automargin), -- cols#132, lines#14, vt@, -- rs2=\E>\E[?3h\E[?4l\E[?5l\E[?8h, use=vt100-nam, -+linux-m|Linux console no color, -+ colors@, pairs@, -+ setab@, setaf@, setb@, setf@, use=linux, - --# vt100 with no advanced video. --vt100-nav|vt100 without advanced video option, -- xmc#1, -- blink@, bold@, rev@, rmso=\E[m, rmul@, sgr@, sgr0@, smso=\E[7m, -- smul@, use=vt100, --vt100-nav-w|vt100-w-nav|dec vt100 132 cols 14 lines (no advanced video option), -- cols#132, lines#14, use=vt100-nav, -+# The 1.3.x kernels add color-change capabilities; if yours doesn't have this -+# and it matters, turn off <ccc>. The %02x escape used to implement this is -+# not supposedly back-portable to older SV curses (although it has worked fine -+# on Solaris for several years) and not supported in ncurses versions before -+# 1.9.9. -+linux-c-nc|linux console with color-change, -+ ccc, -+ initc=\E]P%p1%x%p2%{255}%*%{1000}%/%02x%p3%{255}%*%{1000}%/%02x%p4%{255}%*%{1000}%/%02x, -+ oc=\E]R, use=linux-basic, -+# From: Dennis Henriksen <opus@osrl.dk>, 9 July 1996 -+linux-c|linux console 1.3.6+ for older ncurses, -+ ccc, -+ initc=\E]P%?%p1%{9}%>%t%p1%{10}%-%'a'%+%c%e%p1%d%;%p2%{255}%*%{1000}%/%Pr%gr%{16}%/%Px%?%gx%{9}%>%t%gx%{10}%-%'a'%+%c%e%gx%d%;%gr%{15}%&%Px%?%gx%{9}%>%t%gx%{10}%-%'a'%+%c%e%gx%d%;%p3%{255}%*%{1000}%/%Pr%gr%{16}%/%Px%?%gx%{9}%>%t%gx%{10}%-%'a'%+%c%e%gx%d%;%gr%{15}%&%Px%?%gx%{9}%>%t%gx%{10}%-%'a'%+%c%e%gx%d%;%p4%{255}%*%{1000}%/%Pr%gr%{16}%/%Px%?%gx%{9}%>%t%gx%{10}%-%'a'%+%c%e%gx%d%;%gr%{15}%&%Px%?%gx%{9}%>%t%gx%{10}%-%'a'%+%c%e%gx%d%;, -+ oc=\E]R, use=linux-basic, - --# vt100 with one of the 24 lines used as a status line. --# We put the status line on the top. --vt100-s|vt100-s-top|vt100-top-s|vt100 for use with top sysline, -- eslok, hs, -- lines#23, -- clear=\E[2;1H\E[J$<50>, csr=\E[%i%i%p1%d;%p2%dr, -- cup=\E[%i%p1%{1}%+%d;%p2%dH$<5>, dsl=\E7\E[1;24r\E8, -- fsl=\E8, home=\E[2;1H, is2=\E7\E[2;24r\E8, -- tsl=\E7\E[1;%p1%dH\E[1K, use=vt100-am, -+# The 2.2.x kernels add a private mode that sets the cursor type; use that to -+# get a block cursor for cvvis. -+# reported by Frank Heckenbach <frank@g-n-u.de>. -+linux2.2|linux 2.2.x console, -+ civis=\E[?25l\E[?1c, cnorm=\E[?25h\E[?0c, -+ cvvis=\E[?25h\E[?8c, use=linux-c-nc, - --# Status line at bottom. --# Clearing the screen will clobber status line. --vt100-s-bot|vt100-bot-s|vt100 for use with bottom sysline, -- eslok, hs, -- lines#23, -- dsl=\E7\E[1;24r\E8, fsl=\E8, is2=\E[1;23r\E[23;1H, -- tsl=\E7\E[24;%p1%dH\E[1K, use=vt100-am, -+# Linux 2.6.x has a fix for SI/SO to work with UTF-8 encoding added here: -+# http://lkml.indiana.edu/hypermail/linux/kernel/0602.2/0868.html -+# Using SI/SO has the drawback that it confuses screen. SCS would work. -+# However, SCS is buggy (see comment in Debian #515609) -TD -+# Further, this breaks longstanding workarounds for Linux console's line -+# drawing (see Debian 665959) -TD -+linux2.6|linux 2.6.x console, -+ rmacs=^O, -+ sgr=\E[0;10%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p5%t;2%;%?%p6%t;1%;m%?%p9%t\016%e\017%;, -+ sgr0=\E[m\017, smacs=^N, use=linux2.2, -+ -+# The 3.0 kernel adds support for clearing scrollback buffer (capability E3). -+# It is the same as xterm's erase-saved-lines feature. -+linux3.0|linux 3.0 kernels, -+ E3=\E[3;J, use=linux2.6, - --# Most of the `vt100' emulators out there actually emulate a vt102 --# This entry (or vt102-nsgr) is probably the right thing to use for --# these. --vt102|dec vt102, -- dch1=\E[P, dl1=\E[M, il1=\E[L, rmir=\E[4l, smir=\E[4h, -- use=vt100, --vt102-w|dec vt102 in wide mode, -- cols#132, -- rs3=\E[?3h, use=vt102, -+# This is Linux console for ncurses. -+linux|linux console, -+ use=linux2.2, - --# Many brain-dead PC comm programs that pretend to be `vt100-compatible' --# fail to interpret the ^O and ^N escapes properly. Symptom: the <sgr0> --# string in the canonical vt100 entry above leaves the screen littered --# with little snowflake or star characters (IBM PC ROM character \017 = ^O) --# after highlight turnoffs. This entry should fix that, and even leave --# ACS support working, at the cost of making multiple-highlight changes --# slightly more expensive. --# From: Eric S. Raymond <esr@snark.thyrsus.com> July 22 1995 --vt102-nsgr|vt102 no sgr (use if you see snowflakes after highlight changes), -- sgr@, sgr0=\E[m, use=vt102, -+# Subject: linux 2.6.26 vt back_color_erase -+# Changes to the Linux console driver broke bce model as reported in -+# https://bugzilla.novell.com/show_bug.cgi?id=418613 -+# apparently from -+# http://lkml.org/lkml/2008/4/26/305 -+# http://lkml.org/lkml/2008/10/3/66 -+linux2.6.26|linux console w/o bce, -+ bce@, use=linux2.6, - --# VT125 Graphics CRT. Clear screen also erases graphics --# Some vt125's came configured with vt102 support. --vt125|vt125 graphics terminal, -- mir, -- clear=\E[H\E[2J\EPpS(E)\E\\$<50>, use=vt100, -+# See the note on ICH/ICH1 VERSUS RMIR/SMIR near the end of file -+linux-nic|linux with ich/ich1 suppressed for non-curses programs, -+ ich@, ich1@, use=linux, - --# This isn't a DEC entry, it came from University of Wisconsin. --# (vt131: I added <rmam>/<smam> based on the init string, also <OTbs> -- esr) --vt131|dec vt131, -- OTbs, am, xenl, -- cols#80, it#8, lines#24, vt#3, -- bel=^G, blink=\E[5m$<2/>, bold=\E[1m$<2/>, -- clear=\E[;H\E[2J$<50/>, cr=^M, csr=\E[%i%p1%d;%p2%dr, -- cub1=^H, cud1=^J, cuf1=\E[C$<2/>, -- cup=\E[%i%p1%d;%p2%dH$<5/>, cuu1=\E[A$<2/>, -- ed=\E[J$<50/>, el=\E[K$<3/>, home=\E[H, ht=^I, -- is2=\E[1;24r\E[24;1H, kbs=^H, kcub1=\EOD, kcud1=\EOB, -- kcuf1=\EOC, kcuu1=\EOA, kf1=\EOP, kf2=\EOQ, kf3=\EOR, -- kf4=\EOS, nel=^M^J, rc=\E8, rev=\E[7m$<2/>, ri=\EM$<5/>, -- rmam=\E[?7h, rmkx=\E[?1l\E>, rmso=\E[m$<2/>, -- rmul=\E[m$<2/>, -- rs1=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sc=\E7, -- sgr0=\E[m$<2/>, smam=\E[?7h, smkx=\E[?1h\E=, -- smso=\E[7m$<2/>, smul=\E[4m$<2/>, -+# This assumes you have used setfont(8) to load one of the Linux koi8-r fonts. -+# acsc entry from Pavel Roskin" <pavel@absolute.spb.su>, 29 Sep 1997. -+linux-koi8|linux with koi8 alternate character set, -+ acsc=+\020\,\021-\030.^Y0\215`\004a\221f\234g\237h\220i\276j\205k\203l\202m\204n\212o~p\0q\0r\0s_t\206u\207v\211w\210x\201y\230z\231{\267|\274~\224, -+ use=linux, use=klone+koi8acs, - --# vt132 - like vt100 but slower and has ins/del line and such. --# I'm told that <smir>/<rmir> are backwards in the terminal from the --# manual and from the ANSI standard, this describes the actual --# terminal. I've never actually used a vt132 myself, so this --# is untested. --# --vt132|DEC vt132, -- xenl, -- dch1=\E[P$<7>, dl1=\E[M$<99>, il1=\E[L$<99>, ind=\n$<30>, -- ip=$<7>, rmir=\E[4h, smir=\E[4l, use=vt100, -+# Another entry for KOI8-r with Qing Long's acsc. -+# (which one better complies with the standard?) -+linux-koi8r|linux with koi8-r alternate character set, -+ use=linux, use=klone+koi8acs, - --# This vt220 description maps F5--F9 to the second block of function keys --# at the top of the keyboard. The "DO" key is used as F10 to avoid conflict --# with the key marked (ESC) on the vt220. See vt220d for an alternate mapping. --# PF1--PF4 are used as F1--F4. -+# Entry for the latin1 and latin2 fonts -+linux-lat|linux with latin1 or latin2 alternate character set, -+ acsc=+\020\,\021-\030.^Y0\333`\004a\013f\370g\361h\260i\316j\211k\214l\206m\203n\305o~p\304q\212r\304s_t\207u\215v\301w\302x\205y\363z\362{\343|\330}\234~\376, -+ use=linux, -+ -+# This uses graphics from VT codeset instead of from cp437. -+# reason: cp437 (aka "straight to font") is not functional under luit. -+# from: Andrey V Lukyanov <land@long.yar.ru>. -+linux-vt|linux console using VT codes for graphics, -+ acsc=++\,\,--..00``aaffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz~~, -+ rmacs=\E(K, rmpch@, sgr@, sgr0=\E[0m\E(K\017, smacs=\E(0, -+ smpch@, use=linux, -+ -+# This is based on the Linux console (relies on the console to perform some -+# of the functionality), but does not recognize as many control sequences. -+# The program comes bundled with an old (circa 1998) copy of the Linux -+# console terminfo. It recognizes some non-ANSI/VT100 sequences such as -+# \E* move cursor to home, as as \E[H -+# \E,X same as \E(X -+# \EE move cursor to beginning of row -+# \E[y,xf same as \E[y,xH - # --vt220-old|vt200-old|DEC VT220 in vt100 emulation mode, -- OTbs, OTpt, am, mir, xenl, xon, -- cols#80, lines#24, vt#3, -- OTnl=^J, -- acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -- bel=^G, blink=\E[5m$<2>, bold=\E[1m$<2>, civis=\E[?25l, -- clear=\E[H\E[2J$<50>, cnorm=\E[?25h, cr=^M, -- csr=\E[%i%p1%d;%p2%dr, cub1=^H, cud1=\E[B, cuf1=\E[C, -- cup=\E[%i%p1%d;%p2%dH$<10>, cuu1=\E[A, dch1=\E[P, -- dl1=\E[M, ed=\E[J$<50>, el=\E[K$<3>, home=\E[H, ht=^I, -- if=/usr/share/tabset/vt100, il1=\E[L, ind=\ED$<20/>, -- is2=\E[1;24r\E[24;1H, kbs=^H, kcub1=\E[D, kcud1=\E[B, -- kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[3~, kend=\E[4~, kf1=\EOP, -- kf10=\E[29~, kf2=\EOQ, kf3=\EOR, kf4=\EOS, kf5=\E[17~, -- kf6=\E[18~, kf7=\E[19~, kf8=\E[20~, kf9=\E[21~, -- khome=\E[1~, kich1=\E[2~, knp=\E[6~, kpp=\E[5~, rc=\E8, -- rev=\E[7m$<2>, rf=/usr/share/tabset/vt100, -- ri=\EM$<14/>, rmacs=\E(B$<4>, rmam=\E[?7l, rmir=\E[4l, -- rmso=\E[27m, rmul=\E[24m, -- rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sc=\E7, -- sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p4%t;5%;%?%p1%p3%|%t;7%;m%?%p9%t\E(0%e\E(B%;$<2>, -- sgr0=\E[m$<2>, smacs=\E(0$<2>, smam=\E[?7h, smir=\E[4h, -- smso=\E[7m, smul=\E[4m, -+# Note: The status-line support is buggy (dsl does not work). -+kon|kon2|jfbterm|Kanji ON Linux console, -+ ccc@, hs, -+ civis@, cnorm@, cvvis@, dsl=\E[?H, flash@, fsl=\E[?F, initc@, -+ initp@, kcbt@, oc@, op=\E[37;40m, rs1=\Ec, tsl=\E[?T, -+ use=linux, - --# A much better description of the VT200/220; used to be vt220-8 --# changed rmacs/smacs from shift-in/shift-out to vt200-old's explicit G0/G1 --# designation to accommodate bug in pcvt -TD --vt220|vt200|dec vt220, -- OTbs, am, mc5i, mir, msgr, xenl, xon, -- cols#80, it#8, lines#24, vt#3, -- acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -- bel=^G, blink=\E[5m, bold=\E[1m, clear=\E[H\E[J, cr=^M, -- csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, -- cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, -- cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, -- dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, -- ech=\E[%p1%dX, ed=\E[J, el=\E[K, el1=\E[1K, enacs=\E)0, -- flash=\E[?5h$<200/>\E[?5l, home=\E[H, ht=^I, hts=\EH, -- ich=\E[%p1%d@, if=/usr/share/tabset/vt100, -- il=\E[%p1%dL, il1=\E[L, ind=\ED, -- is2=\E[?7h\E[>\E[?1h\E F\E[?4l, kbs=^H, kcub1=\E[D, -- kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kf1=\EOP, kf10=\E[21~, -- kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, -- kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, kf2=\EOQ, -- kf20=\E[34~, kf3=\EOR, kf4=\EOS, kf6=\E[17~, kf7=\E[18~, -- kf8=\E[19~, kf9=\E[20~, kfnd=\E[1~, khlp=\E[28~, -- kich1=\E[2~, knp=\E[6~, kpp=\E[5~, krdo=\E[29~, kslt=\E[4~, -- lf1=pf1, lf2=pf2, lf3=pf3, lf4=pf4, mc0=\E[i, mc4=\E[4i, -- mc5=\E[5i, nel=\EE, rc=\E8, rev=\E[7m, ri=\EM, -- rmacs=\E(B$<4>, rmam=\E[?7l, rmir=\E[4l, rmso=\E[27m, -- rmul=\E[24m, rs1=\E[?3l, sc=\E7, -- sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p4%t;5%;%?%p1%p3%|%t;7%;m%?%p9%t\E(0%e\E(B%;$<2>, -- sgr0=\E[m\E(B, smacs=\E(0$<2>, smam=\E[?7h, smir=\E[4h, -- smso=\E[7m, smul=\E[4m, tbc=\E[3g, --vt220-w|vt200-w|DEC vt220 in wide mode, -- cols#132, -- rs3=\E[?3h, use=vt220, --vt220-8bit|vt220-8|vt200-8bit|vt200-8|dec vt220/200 in 8-bit mode, -- OTbs, am, mc5i, mir, msgr, xenl, xon, -- cols#80, it#8, lines#24, vt#3, -- acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -- bel=^G, blink=\2335m, bold=\2331m, clear=\233H\233J, cr=^M, -- csr=\233%i%p1%d;%p2%dr, cub=\233%p1%dD, cub1=^H, -- cud=\233%p1%dB, cud1=^J, cuf=\233%p1%dC, cuf1=\233C, -- cup=\233%i%p1%d;%p2%dH, cuu=\233%p1%dA, cuu1=\233A, -- dch=\233%p1%dP, dch1=\233P, dl=\233%p1%dM, dl1=\233M, -- ech=\233%p1%dX, ed=\233J, el=\233K, el1=\2331K, enacs=\E)0, -- flash=\233?5h$<200/>\233?5l, home=\233H, ht=^I, hts=\EH, -- ich=\233%p1%d@, if=/usr/share/tabset/vt100, -- il=\233%p1%dL, il1=\233L, ind=\ED, -- is2=\233?7h\233>\233?1h\E F\233?4l, kbs=^H, -- kcub1=\233D, kcud1=\233B, kcuf1=\233C, kcuu1=\233A, -- kf1=\EOP, kf10=\23321~, kf11=\23323~, kf12=\23324~, -- kf13=\23325~, kf14=\23326~, kf17=\23331~, kf18=\23332~, -- kf19=\23333~, kf2=\EOQ, kf20=\23334~, kf3=\EOR, kf4=\EOS, -- kf6=\23317~, kf7=\23318~, kf8=\23319~, kf9=\23320~, -- kfnd=\2331~, khlp=\23328~, khome=\233H, kich1=\2332~, -- knp=\2336~, kpp=\2335~, krdo=\23329~, kslt=\2334~, lf1=pf1, -- lf2=pf2, lf3=pf3, lf4=pf4, mc0=\233i, mc4=\2334i, mc5=\2335i, -- nel=\EE, rc=\E8, rev=\2337m, ri=\EM, rmacs=\E(B, -- rmam=\233?7l, rmir=\2334l, rmso=\23327m, rmul=\23324m, -- rs1=\233?3l, sc=\E7, -- sgr=\2330%?%p6%t;1%;%?%p2%t;4%;%?%p4%t;5%;%?%p1%p3%|%t;7%;m%?%p9%t\E(0%e\E(B%;$<2>, -- sgr0=\2330m\E(B, smacs=\E(0, smam=\233?7h, smir=\2334h, -- smso=\2337m, smul=\2334m, tbc=\2333g, -+# 16-color linux console entry; this works with a 256-character -+# console font but bright background colors turn into dim ones when -+# you use a 512-character console font. This uses bold for bright -+# foreground colors and blink for bright background colors. -+linux-16color|linux console with 16 colors, -+ colors#16, ncv#63, pairs#256, -+ setab=\E[4%p1%{8}%m%d%?%p1%{7}%>%t;5%e;25%;m, -+ setaf=\E[3%p1%{8}%m%d%?%p1%{7}%>%t;1%e;21%;m, -+ use=linux, - --# vt220d: --# This vt220 description regards F6--F10 as the second block of function keys --# at the top of the keyboard. This mapping follows the description given --# in the VT220 Programmer Reference Manual and agrees with the labeling --# on some terminals that emulate the vt220. There is no support for an F5. --# See vt220 for an alternate mapping. -+# bterm (bogl 0.1.18) -+# Implementation is in bogl-term.c -+# Key capabilities from linux terminfo entry - # --vt220d|DEC VT220 in vt100 mode with DEC function key labeling, -+# Notes: -+# bterm only supports acs using wide-characters, has case for these: qjxamlkut -+# bterm does not support sgr, since it only processes one parameter -TD -+bterm|bogl virtual terminal, -+ am, bce, -+ colors#8, cols#80, lines#24, pairs#64, -+ acsc=aajjkkllmmqqttuuxx, bold=\E[1m, civis=\E[?25l, -+ clear=\E[H\E[2J, cnorm=\E[?25h, cr=^M, cub1=^H, cud1=^J, -+ cup=\E[%i%p1%d;%p2%dH, ed=\E[J, el=\E[K, home=\E[H, ind=^J, -+ kb2=\E[G, kbs=\177, kcbt=\E[Z, kcub1=\E[D, kcud1=\E[B, -+ kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[3~, kend=\E[4~, kf1=\E[[A, - kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, - kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, kf17=\E[31~, -- kf18=\E[32~, kf19=\E[33~, kf20=\E[34~, kf5@, kf6=\E[17~, -- kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, use=vt220-old, -+ kf18=\E[32~, kf19=\E[33~, kf2=\E[[B, kf20=\E[34~, -+ kf3=\E[[C, kf4=\E[[D, kf5=\E[[E, kf6=\E[17~, kf7=\E[18~, -+ kf8=\E[19~, kf9=\E[20~, khome=\E[1~, kich1=\E[2~, -+ kmous=\E[M, knp=\E[6~, kpp=\E[5~, kspd=^Z, nel=^M^J, -+ op=\E[49m\E[39m, rev=\E[7m, ri=\EM, rmacs=^O, rmso=\E[27m, -+ rmul=\E[24m, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, -+ sgr0=\E[0m, smacs=^N, smso=\E[7m, smul=\E[4m, - --vt220-nam|v200-nam|VT220 in vt100 mode with no auto margins, -- am@, -- rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7l\E[?8h, use=vt220, -+#### Mach -+# - --# vt220 termcap written Tue Oct 25 20:41:10 1988 by Alex Latzko --# (not an official DEC entry!) --# The problem with real vt220 terminals is they don't send escapes when in --# in vt220 mode. This can be gotten around two ways. 1> don't send --# escapes or 2> put the vt220 into vt100 mode and use all the nifty --# features of vt100 advanced video which it then has. -+# From: Matthew Vernon <mcv21@pick.sel.cam.ac.uk> -+mach|Mach Console, -+ am, km, -+ cols#80, it#8, lines#25, -+ bel=^G, blink=\E[5m, bold=\E[1m, clear=\Ec, cr=^M, -+ cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=^J, -+ cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, -+ cuu=\E[%p1%dA, cuu1=\E[A, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, -+ el=\E[K, home=\E[H, ht=^I, il=\E[%p1%dL, il1=\E[L, ind=^J, -+ kbs=\177, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, -+ kdch1=\E[9, kend=\E[Y, kf1=\EOP, kf10=\EOY, kf2=\EOQ, -+ kf3=\EOR, kf4=\EOS, kf5=\EOT, kf6=\EOU, kf7=\EOV, kf8=\EOW, -+ kf9=\EOX, khome=\E[H, kich1=\E[@, kll=\E[F, knp=\E[U, -+ kpp=\E[V, rev=\E[7m, rmso=\E[0m, rmul=\E[24m, sgr0=\E[0m, -+ smso=\E[7m, smul=\E[4m, -+mach-bold|Mach Console with bold instead of underline, -+ rmul=\E[0m, smul=\E[1m, use=mach, -+mach-color|Mach Console with ANSI color, -+ colors#8, pairs#64, -+ dim=\E[2m, invis=\E[8m, op=\E[37;40m, rmso=\E[27m, -+ setab=\E[4%p1%dm, setaf=\E[3%p1%dm, use=mach, -+ -+# From: Samuel Thibault -+# Source: git://git.sv.gnu.org/hurd/gnumach.git -+# Files: i386/i386at/kd.c -+# -+# Added nel, hpa, sgr and removed rmacs, smacs based on source -TD -+mach-gnu|GNU Mach, -+ acsc=+>\,<-\^.v0\333`+a\261f\370g\361h\260i#j\331k\277l\332m\300n\305o~p\304q\304r\304s_t\303u\264v\301w\302x\263y\363z\362{\343|\330}\234~\376, -+ dch=\E[%p1%dP, dch1=\E[P, dim=\E[2m, ech=\E[%p1%dX, -+ el1=\E[1K, hpa=\E[%i%p1%dG, ich=\E[%p1%d@, ich1=\E[@, -+ indn=\E[%p1%dS, invis=\E[8m, nel=\EE, rin=\E[%p1%dT, -+ sgr=\E[0%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p5%t;2%;%?%p6%t;1%;%?%p7%t;8%;m, -+ use=mach, -+ -+mach-gnu-color|Mach Console with ANSI color, -+ colors#8, pairs#64, -+ op=\E[37;40m, rmso=\E[27m, setab=\E[4%p1%dm, -+ setaf=\E[3%p1%dm, use=mach-gnu, -+ -+# From: Marcus Brinkmann -+# http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/hurd/hurd/console/ - # --# This entry takes the view of putting a vt220 into vt100 mode so --# you can use the escape key in emacs and everything else which needs it. -+# Comments in the original are summarized here: - # --# You probably don't want to use this on a VMS machine since VMS will think --# it has a vt220 and will get fouled up coming out of emacs -+# hurd uses 8-bit characters (km). - # --# From: Alexander Latzko <latzko@marsenius.rutgers.edu>, 30 Dec 1996 --# (Added vt100 <rc>,<sc> to quiet a tic warning -- esr) --vt200-js|vt220-js|dec vt200 series with jump scroll, -- am, -- cols#80, -- bel=^G, clear=\E[H\E[J, cr=^M, csr=\E[%i%p1%d;%p2%dr, -- cub1=^H, cud1=^J, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, -- cuu1=\E[A, dch1=\E[P, dl1=\E[M, ed=\E[J, el=\E[K, home=\E[H, -- ht=^I, il1=\E[L, ind=\ED, -- is2=\E[61"p\E[H\E[?3l\E[?4l\E[?1l\E[?5l\E[?6l\E[?7h\E[?8h\E[?25h\E>\E[m, -- kbs=^H, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, -- kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, nel=^M\ED, rc=\E8, -- rf=/usr/share/tabset/vt100, ri=\EM, rmdc=, rmir=\E[4l, -- rmkx=\E[?1l\E>, rmso=\E[27m$<5/>, rmul=\E[24m, -- rs1=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sc=\E7, smdc=, -- smir=\E[4h, smkx=\E[?1h\E=, smso=\E[7m$<5/>, smul=\E[4m, -- --# This was DEC's vt320. Use the purpose-built one below instead --#vt320|DEC VT320 in vt100 emulation mode, --# use=vt220, -- --# Use v320n for SCO's LYRIX. Otherwise, use Adam Thompson's vt320-nam. -+# Although it doesn't do XON/XOFF, we don't want padding characters (xon). - # --vt320nam|v320n|DEC VT320 in vt100 emul. mode with NO AUTO WRAP mode, -- am@, -- rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7l\E[?8h, use=vt220, -- --# These entries are not DEC's official ones, they were purpose-built for the --# VT320. Here are the designer's notes: --# <kel> is end on a PC kbd. Actually 'select' on a VT. Mapped to --# 'Erase to End of Field'... since nothing seems to use 'end' anyways... --# khome is Home on a PC kbd. Actually 'FIND' on a VT. --# Things that use <knxt> usually use tab anyways... and things that don't use --# tab usually use <knxt> instead... --# kprv is same as tab - Backtab is useless... --# I left out <sgr> because of its RIDICULOUS complexity, --# and the resulting fact that it causes the termcap translation of the entry --# to SMASH the 1k-barrier... --# From: Adam Thompson <athompso@pangea.ca> Sept 10 1995 --# (vt320: uncommented <fsl> --esr) --vt320|vt300|dec vt320 7 bit terminal, -- am, eslok, hs, mir, msgr, xenl, -- cols#80, lines#24, wsl#80, -- acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -- bel=^G, blink=\E[5m, bold=\E[1m, civis=\E[?25l, -- clear=\E[H\E[2J, cnorm=\E[?25h, cr=^M, -- csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, -- cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, -- cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, -- dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, -- ech=\E[%p1%dX, ed=\E[J, el=\E[K, el1=\E[1K, fsl=\E[0$}, -- home=\E[H, ht=^I, hts=\EH, ich=\E[%p1%d@, il=\E[%p1%dL, -- il1=\E[L, ind=\ED, -- is2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h\E[1;24r\E[24;1H, -- kbs=\177, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, -- kdch1=\E[3~, kel=\E[4~, kf10=\E[21~, kf11=\E[23~, -- kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, kf15=\E[28~, -- kf16=\E[29~, kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, -- kf20=\E[34~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, -- kf9=\E[20~, khome=\E[1~, kich1=\E[2~, knp=\E[6~, knxt=^I, -- kpp=\E[5~, kprv=\E[Z, kslt=\E[4~, mc0=\E[i, mc4=\E[?4i, -- mc5=\E[?5i, nel=\EE, rc=\E8, rev=\E[7m, -- rf=/usr/share/tabset/vt300, ri=\EM, rmacs=\E(B, -- rmam=\E[?7l, rmir=\E[4l, rmkx=\E[?1l\E>, rmso=\E[m, -- rmul=\E[m, -- rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h\E[1;24r\E[24;1H, -- sc=\E7, -- sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p4%t;5%;%?%p1%p3%|%t;7%;m%?%p9%t\E(0%e\E(B%;$<2>, -- sgr0=\E[m\E(B, smacs=\E(0, smam=\E[?7h, smir=\E[4h, -- smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, tbc=\E[3g, -- tsl=\E[1$}\E[H\E[K, use=vt220+keypad, --vt320-nam|vt300-nam|dec vt320 7 bit terminal with no am to make SAS happy, -- am@, -- is2=\E>\E[?3l\E[?4l\E[?5l\E[?7l\E[?8h\E[1;24r\E[24;1H, -- rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7l\E[?8h\E[1;24r\E[24;1H, -- use=vt320, --# We have to init 132-col mode, not 80-col mode. --vt320-w|vt300-w|dec vt320 wide 7 bit terminal, -- cols#132, wsl#132, -- is2=\E>\E[?3h\E[?4l\E[?5l\E[?7h\E[?8h\E[1;24r\E[24;1H, -- rs2=\E>\E[?3h\E[?4l\E[?5l\E[?7h\E[?8h\E[1;24r\E[24;1H, -- use=vt320, --vt320-w-nam|vt300-w-nam|dec vt320 wide 7 bit terminal with no am, -- am@, -- is2=\E>\E[?3h\E[?4l\E[?5l\E[?7l\E[?8h\E[1;24r\E[24;1H, -- rs2=\E>\E[?3h\E[?4l\E[?5l\E[?7l\E[?8h\E[1;24r\E[24;1H, -- use=vt320-w, -- --# VT330 and VT340 -- These are ReGIS and SIXEL graphics terminals --# which are pretty much a superset of the VT320. They have the --# host writable status line, yet another different DRCS matrix size, --# and such, but they add the DEC Technical character set, Multiple text --# pages, selectable length pages, and the like. The difference between --# the vt330 and vt340 is that the latter has only 2 planes and a monochrome --# monitor, the former has 4 planes and a color monitor. These terminals --# support VT131 and ANSI block mode, but as with much of these things, --# termcap/terminfo doesn't deal with these features. --# --# Note that this entry is are set up in what was the standard way for GNU --# Emacs v18 terminal modes to deal with the cursor keys in that the arrow --# keys were switched into application mode at the same time the numeric pad --# is switched into application mode. This changes the definitions of the --# arrow keys. Emacs v19 is smarter and mines its keys directly out of --# your termcap or terminfo entry, --# --# From: Daniel Glasser <dag@persoft.persoft.com>, 13 Oct 1993 --# (vt340: string capability "sb=\E[M" corrected to "sr"; --# also, added <rmam>/<smam> based on the init string -- esr) --vt340|dec-vt340|vt330|dec-vt330|dec vt340 graphics terminal with 24 line page, -- am, eslok, hs, mir, msgr, xenl, xon, -- cols#80, it#8, lines#24, vt#3, -- acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -- blink=\E[5m, bold=\E[1m, civis=\E[?25l, clear=\E[H\E[J, -- cnorm=\E[?25h, cr=^M, csr=\E[%i%p1%d;%p2%dr, -- cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=^J, -- cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, -- cuu=\E[%p1%dA, cuu1=\E[A, dch=\E[%p1%dP, dch1=\E[P, -- dl=\E[%p1%dM, dl1=\E[M, dsl=\E[2$~\r\E[1$}\E[K\E[$}, -- ed=\E[J, el=\E[K, flash=\E[?5h\E[?5l$<200/>, fsl=\E[$}, -- home=\E[H, ht=^I, hts=\EH, ich=\E[%p1%d@, il=\E[%p1%dL, -- il1=\E[L, ind=\ED, -- is2=\E<\E F\E>\E[?1h\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h\E[1;24r\E[24;1H, -- kbs=^H, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, -- kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, kf6=\E[17~, -- kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, lf1=pf1, lf2=pf2, -- lf3=pf3, lf4=pf4, nel=^M\ED, rc=\E8, rev=\E[7m, -- rf=/usr/share/tabset/vt300, ri=\EM, rmacs=\E(B, -- rmam=\E[?7l, rmir=\E[4l, rmkx=\E[?1l\E>, rmso=\E[27m, -- rmul=\E[24m, rs1=\E[?3l, sc=\E7, -- sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p4%t;5%;%?%p1%p3%|%t;7%;m%?%p9%t\E(0%e\E(B%;$<2>, -- sgr0=\E[m\E(B, smacs=\E(0, smam=\E[?7h, smir=\E[4h, -- smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, tbc=\E[3g, -- tsl=\E[2$~\E[1$}\E[1;%dH, -- --# DEC doesn't supply a vt400 description, so we add Daniel Glasser's --# (originally written with vt420 as its primary name, and usable for it). -+# Regarding compatibility to vt100: hurd doesn't specify <xenl>, as we don't -+# have the eat_newline_glitch. It doesn't support setting or removing tab -+# stops (hts/tbc). - # --# VT400/420 -- This terminal is a superset of the vt320. It adds the multiple --# text pages and long text pages with selectable length of the vt340, along --# with left and right margins, rectangular area text copy, fill, and erase --# operations, selected region character attribute change operations, --# page memory and rectangle checksums, insert/delete column, reception --# macros, and other features too numerous to remember right now. TERMCAP --# can only take advantage of a few of these added features. -+# hurd uses ^H instead of \E[D for cub1, as only ^H implements <bw> and it is -+# one byte instead three. - # --# Note that this entry is are set up in what was the standard way for GNU --# Emacs v18 terminal modes to deal with the cursor keys in that the arrow --# keys were switched into application mode at the same time the numeric pad --# is switched into application mode. This changes the definitions of the --# arrow keys. Emacs v19 is smarter and mines its keys directly out of --# your termcap entry, -+# <ich1> is not included because hurd has insert mode. - # --# From: Daniel Glasser <dag@persoft.persoft.com>, 13 Oct 1993 --# (vt400: string capability ":sb=\E[M:" corrected to ":sr=\E[M:"; --# also, added <rmam>/<smam> based on the init string -- esr) --vt400|vt400-24|dec-vt400|dec vt400 24x80 column autowrap, -- am, eslok, hs, mir, msgr, xenl, xon, -- cols#80, it#8, lines#24, vt#3, -- acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -- blink=\E[5m, bold=\E[1m, civis=\E[?25l, -- clear=\E[H\E[J$<10/>, cnorm=\E[?25h, cr=^M, -- csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, -- cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, -- cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, -- dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, -- dsl=\E[2$~\r\E[1$}\E[K\E[$}, ed=\E[J$<10/>, -- el=\E[K$<4/>, flash=\E[?5h\E[?5l$<200/>, fsl=\E[$}, -- home=\E[H, ht=^I, hts=\EH, ich=\E[%p1%d@, ich1=\E[@, -- il=\E[%p1%dL, il1=\E[L, ind=\ED, -- is2=\E<\E F\E>\E[?1h\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h\E[1;24r\E[24;1H, -- kbs=^H, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, -- kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, kf6=\E[17~, -- kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, lf1=pf1, lf2=pf2, -- lf3=pf3, lf4=pf4, nel=^M\ED, rc=\E8, rev=\E[7m, -- rf=/usr/share/tabset/vt300, ri=\EM, rmacs=\E(B, -- rmam=\E[?7l, rmir=\E[4l, rmkx=\E[?1l\E>, rmso=\E[27m, -- rmul=\E[24m, rs1=\E<\E[?3l\E[!p\E[?7h, sc=\E7, -- sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p4%t;5%;%?%p1%p3%|%t;7%;m%?%p9%t\E(0%e\E(B%;$<2>, -- sgr0=\E[m\E(B, smacs=\E(0, smam=\E[?7h, smir=\E[4h, -- smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, tbc=\E[3g, -- tsl=\E[2$~\E[1$}\E[1;%dH, -- --# (vt420: I removed <kf0>, it collided with <kf10>. I also restored --# a missing <sc> -- esr) --vt420|DEC VT420, -- am, mir, xenl, xon, -- cols#80, lines#24, vt#3, -- acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -- bel=^G, blink=\E[5m$<2>, bold=\E[1m$<2>, -- clear=\E[H\E[2J$<50>, cr=^M, csr=\E[%i%p1%d;%p2%dr, -- cub1=^H, cud1=\E[B, cuf1=\E[C, -- cup=\E[%i%p1%d;%p2%dH$<10>, cuu1=\E[A, dch1=\E[P, -- dl1=\E[M, ed=\E[J$<50>, el=\E[K$<3>, home=\E[H, ht=^I, -- if=/usr/share/tabset/vt300, il1=\E[L, ind=\ED, -- is2=\E[1;24r\E[24;1H, is3=\E[?67h\E[64;1"p, kbs=^H, -- kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, -- kdch1=\E[3~, kf1=\EOP, kf10=\E[29~, kf2=\EOQ, kf3=\EOR, -- kf4=\EOS, kf5=\E[17~, kf6=\E[18~, kf7=\E[19~, kf8=\E[20~, -- kf9=\E[21~, kfnd=\E[1~, kich1=\E[2~, knp=\E[6~, kpp=\E[5~, -- kslt=\E[4~, rc=\E8, rev=\E[7m$<2>, -- rf=/usr/share/tabset/vt300, ri=\EM, rmacs=\E(B$<4>, -- rmam=\E[?7l, rmir=\E[4l, rmkx=\E>, -- rmsc=\E[?0;0r\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, -- rmso=\E[m, rmul=\E[m, rs3=\E[?67h\E[64;1"p, sc=\E7, -- sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p4%t;5%;%?%p1%p3%|%t;7%;m%?%p9%t\E(0%e\E(B%;$<2>, -- sgr0=\E[m$<2>, smacs=\E(0$<2>, smam=\E[?7h, smir=\E[4h, -- smkx=\E=, smso=\E[7m, smul=\E[4m, -- --# DEC VT220 and up support DECUDK (user-defined keys). DECUDK (i.e., pfx) --# takes two parameters, the key and the string. Translating the key is --# straightforward (keys 1-5 are not defined on real terminals, though some --# emulators define these): -+# hurd doesn't use ^J for scrolling, because this could put things into the -+# scrollback buffer. - # --# if (key < 16) then value = key; --# else if (key < 21) then value = key + 1; --# else if (key < 25) then value = key + 2; --# else if (key < 27) then value = key + 3; --# else if (key < 30) then value = key + 4; --# else value = key + 5; -+# gsbom/grbom are used to enable/disable real bold (not intensity bright) mode. -+# This is a GNU extension. - # --# The string must be the hexadecimal equivalent, e.g., "5052494E" for "PRINT". --# There's no provision in terminfo for emitting a string in this format, so the --# application has to know it. -+# The original has commented-out ncv, but is restored here. - # --vt420pc|DEC VT420 w/PC keyboard, -- kdch1=\177, kend=\E[4~, kf1=\E[11~, kf10=\E[21~, -- kf11=\E[23~, kf12=\E[24~, kf13=\E[11;2~, kf14=\E[12;2~, -- kf15=\E[13;2~, kf16=\E[14;2~, kf17=\E[15;2~, -- kf18=\E[17;2~, kf19=\E[18;2~, kf2=\E[12~, kf20=\E[19;2~, -- kf21=\E[20;2~, kf22=\E[21;2~, kf23=\E[23;2~, -- kf24=\E[24;2~, kf25=\E[23~, kf26=\E[24~, kf27=\E[25~, -- kf28=\E[26~, kf29=\E[28~, kf3=\E[13~, kf30=\E[29~, -- kf31=\E[31~, kf32=\E[32~, kf33=\E[33~, kf34=\E[34~, -- kf35=\E[35~, kf36=\E[36~, kf37=\E[23;2~, kf38=\E[24;2~, -- kf39=\E[25;2~, kf4=\E[14~, kf40=\E[26;2~, kf41=\E[28;2~, -- kf42=\E[29;2~, kf43=\E[31;2~, kf44=\E[32;2~, -- kf45=\E[33;2~, kf46=\E[34;2~, kf47=\E[35;2~, -- kf48=\E[36;2~, kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, -- kf8=\E[19~, kf9=\E[20~, khome=\E[H, -- pctrm=USR_TERM\:vt420pcdos\:, -- pfx=\EP1;1|%?%{16}%p1%>%t%{0}%e%{21}%p1%>%t%{1}%e%{25}%p1%>%t%{2}%e%{27}%p1%>%t%{3}%e%{30}%p1%>%t%{4}%e%{5}%;%p1%+%d/%p2%s\E\\, -- use=vt420, -- --vt420pcdos|DEC VT420 w/PC for DOS Merge, -- lines#25, -- dispc=%?%p1%{19}%=%t\E\023\021%e%p1%{32}%<%t\E%p1%c%e%p1%{127}%=%t\E\177%e%p1%c%;, -- pctrm@, -- rmsc=\E[?0;0r\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sgr@, -- sgr0=\E[m, smsc=\E[?1;2r\E[34h, use=vt420pc, -- --vt420f|DEC VT420 with VT kbd; VT400 mode; F1-F5 used as Fkeys, -- kdch1=\177, kf1=\E[11~, kf10=\E[21~, kf11=\E[23~, -+# Reading the source, RIS resets cnorm, but not xmous. -+hurd|The GNU Hurd console server, -+ am, bce, bw, eo, km, mir, msgr, xenl, xon, -+ colors#8, it#8, ncv#18, pairs#64, -+ acsc=++\,\,--..00``aaffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -+ bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l, -+ clear=\Ec, cnorm=\E[?25h, cr=^M, csr=\E[%i%p1%d;%p2%dr, -+ cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=\E[B, -+ cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, -+ cuu=\E[%p1%dA, cuu1=\E[A, cvvis=\E[34l, dch=\E[%p1%dP, -+ dch1=\E[P, dim=\E[2m, dl=\E[%p1%dM, dl1=\E[M, -+ ech=\E[%p1%dX, ed=\E[J, el=\E[K, el1=\E[1K, flash=\Eg, -+ home=\E[H, hpa=\E[%i%p1%dG, ht=^I, ich=\E[%p1%d@, -+ il=\E[%p1%dL, il1=\E[L, ind=\E[S, indn=\E[%p1%dS, -+ invis=\E[8m, kb2=\E[G, kbs=\177, kcbt=\E[Z, kcub1=\EOD, -+ kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kdch1=\E[3~, -+ kend=\E[4~, kf1=\EOP, kf10=\E[21~, kf11=\E[23~, - kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, kf15=\E[28~, - kf16=\E[29~, kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, -- kf2=\E[12~, kf20=\E[34~, kf3=\E[13~, kf4=\E[14~, -- kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, -- khome=\E[H, lf1=\EOP, lf2=\EOQ, lf3=\EOR, lf4=\EOS, -- use=vt420, -- --vt510|DEC VT510, -- use=vt420, --vt510pc|DEC VT510 w/PC keyboard, -- use=vt420pc, --vt510pcdos|DEC VT510 w/PC for DOS Merge, -- use=vt420pcdos, -+ kf2=\EOQ, kf20=\E[34~, kf3=\EOR, kf4=\EOS, kf5=\E[15~, -+ kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, -+ khome=\E[1~, kich1=\E[2~, kmous=\E[M, knp=\E[6~, kpp=\E[5~, -+ kspd=^Z, nel=^M^J, op=\E[39;49m, rc=\E8, rev=\E[7m, ri=\E[T, -+ rin=\E[%p1%dT, ritm=\E[23m, rmacs=\E[10m, rmir=\E[4l, -+ rmso=\E[27m, rmul=\E[24m, rs1=\EM\E[?1000l, sc=\E7, -+ setab=\E[4%p1%dm, setaf=\E[3%p1%dm, -+ sgr=\E[0%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p5%t;2%;%?%p6%t;1%;%?%p7%t;8%;%?%p9%t;11%;m, -+ sgr0=\E[0m, sitm=\E[3m, smacs=\E[11m, smir=\E[4h, -+ smso=\E[7m, smul=\E[4m, vpa=\E[%i%p1%dd, grbom=\E[>1l, -+ gsbom=\E[>1h, - --# VT520/VT525 --# --# The VT520 is a monochrome text terminal capable of managing up to --# four independent sessions in the terminal. It has multiple ANSI --# emulations (VT520, VT420, VT320, VT220, VT100, VT PCTerm, SCO Console) --# and ASCII emulations (WY160/60, PCTerm, 50/50+, 150/120, TVI 950, --# 925 910+, ADDS A2). This terminfo data is for the ANSI emulations only. -+#### QNX - # --# Terminal Set-Up is entered by pressing [F3], [Caps Lock]/[F3] or --# [Alt]/[Print Screen] depending upon which keyboard and which --# terminal mode is being used. If Set-Up has been disabled or --# assigned to an unknown key, Set-Up may be entered by pressing --# [F3] as the first key after power up, regardless of keyboard type. --# (vt520: I added <rmam>/<smam> based on the init string, also <sc> -- esr) --vt520|DEC VT520, -- am, mir, xenl, xon, -- cols#80, lines#24, vt#3, -- acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -- bel=^G, blink=\E[5m$<2>, bold=\E[1m$<2>, -- clear=\E[H\E[2J$<50>, cr=^M, csr=\E[%i%p1%d;%p2%dr, -- cub1=^H, cud1=\E[B, cuf1=\E[C, -- cup=\E[%i%p1%d;%p2%dH$<10>, cuu1=\E[A, dch1=\E[P, -- dl1=\E[M, ed=\E[J$<50>, el=\E[K$<3>, home=\E[H, ht=^I, -- if=/usr/share/tabset/vt300, il1=\E[L, ind=\ED, -- is2=\E[1;24r\E[24;1H, is3=\E[?67h\E[64;1"p, kbs=^H, -- kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, -- kdch1=\E[3~, kf1=\EOP, kf10=\E[29~, kf2=\EOQ, kf3=\EOR, -- kf4=\EOS, kf5=\E[17~, kf6=\E[18~, kf7=\E[19~, kf8=\E[20~, -- kf9=\E[21~, kfnd=\E[1~, kich1=\E[2~, knp=\E[6~, kpp=\E[5~, -- kslt=\E[4~, -- pfx=\EP1;1|%?%{16}%p1%>%t%{0}%e%{21}%p1%>%t%{1}%e%{25}%p1%>%t%{2}%e%{27}%p1%>%t%{3}%e%{30}%p1%>%t%{4}%e%{5}%;%p1%+%d/%p2%s\E\\, -- rc=\E8, rev=\E[7m$<2>, rf=/usr/share/tabset/vt300, -- ri=\EM, rmacs=\E(B$<4>, rmam=\E[?7l, rmir=\E[4l, -- rmsc=\E[?0;0r\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, -- rmso=\E[m, rmul=\E[m, rs3=\E[?67h\E[64;1"p, sc=\E7, -- sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p4%t;5%;%?%p1%p3%|%t;7%;m%?%p9%t\E(0%e\E(B%;$<2>, -- sgr0=\E[m$<2>, smacs=\E(0$<2>, smam=\E[?7h, smir=\E[4h, -- smso=\E[7m, smul=\E[4m, -- --# (vt525: I added <rmam>/<smam> based on the init string; --# removed <rmso>=\E[m, <rmul>=\E[m, added <sc> -- esr) --vt525|DEC VT525, -- am, mir, xenl, xon, -- cols#80, lines#24, vt#3, -- acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -- bel=^G, blink=\E[5m$<2>, bold=\E[1m$<2>, -- clear=\E[H\E[2J$<50>, cr=^M, csr=\E[%i%p1%d;%p2%dr, -- cub1=^H, cud1=\E[B, cuf1=\E[C, -- cup=\E[%i%p1%d;%p2%dH$<10>, cuu1=\E[A, dch1=\E[P, -- dl1=\E[M, ed=\E[J$<50>, el=\E[K$<3>, home=\E[H, ht=^I, -- if=/usr/share/tabset/vt300, il1=\E[L, ind=\ED, -- is2=\E[1;24r\E[24;1H, is3=\E[?67h\E[64;1"p, kbs=^H, -- kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, -- kdch1=\E[3~, kf1=\EOP, kf10=\E[29~, kf2=\EOQ, kf3=\EOR, -- kf4=\EOS, kf5=\E[17~, kf6=\E[18~, kf7=\E[19~, kf8=\E[20~, -- kf9=\E[21~, kfnd=\E[1~, kich1=\E[2~, knp=\E[6~, kpp=\E[5~, -- kslt=\E[4~, -- pfx=\EP1;1|%?%{16}%p1%>%t%{0}%e%{21}%p1%>%t%{1}%e%{25}%p1%>%t%{2}%e%{27}%p1%>%t%{3}%e%{30}%p1%>%t%{4}%e%{5}%;%p1%+%d/%p2%s\E\\, -- rc=\E8, rev=\E[7m$<2>, rf=/usr/share/tabset/vt300, -- ri=\EM, rmacs=\E(B$<4>, rmam=\E[?7l, rmir=\E[4l, -- rmsc=\E[?0;0r\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, -- rmso=\E[m, rmul=\E[m, rs3=\E[?67h\E[64;1"p, sc=\E7, -- sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p4%t;5%;%?%p1%p3%|%t;7%;m%?%p9%t\E(0%e\E(B%;$<2>, -- sgr0=\E[m$<2>, smacs=\E(0$<2>, smam=\E[?7h, smir=\E[4h, -- smso=\E[7m, smul=\E[4m, - --#### VT100 emulations -+# QNX 4.0 Console -+# Michael's original version of this entry had <am@>, <smcup=\Ei>, -+# <rmcup=\Eh\ER>; this was so terminfo applications could write the lower -+# right corner without triggering a scroll. The ncurses terminfo library can -+# handle this case with the <ich1> capability, and prefers <am> for better -+# optimization. Bug: The <op> capability resets attributes. -+# From: Michael Hunter <mphunter@qnx.com> 30 Jul 1996 -+# (removed: <sgr=%?%p1%t\E<%;%p2%t\E[%;%p3%t\E(%;%p4%t\E{%;%p6%t\E<%;,>) -+qnx|qnx4|qnx console, -+ daisy, km, mir, msgr, xhpa, xt, -+ colors#8, cols#80, it#4, lines#25, ncv#3, pairs#8, -+ acsc=O\333a\261j\331k\277l\332m\300n\305o\337q\304s\334t\303u\264v\301w\302x\263, -+ bel=^G, blink=\E{, bold=\E<, civis=\Ey0, clear=\EH\EJ, -+ cnorm=\Ey1, cr=^M, cub1=^H, cud1=^J, cuf1=\EC, -+ cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, cvvis=\Ey2, -+ dch1=\Ef, dl1=\EF, ed=\EJ, el=\EK, home=\EH, ht=^I, ich1=\Ee, -+ il1=\EE, ind=^J, kBEG=\377\356, kCAN=\377\263, -+ kCMD=\377\267, kCPY=\377\363, kCRT=\377\364, -+ kDL=\377\366, kEND=\377\301, kEOL=\377\311, -+ kEXT=\377\367, kFND=\377\370, kHLP=\377\371, -+ kHOM=\377\260, kIC=\377\340, kLFT=\377\264, -+ kMOV=\377\306, kMSG=\377\304, kNXT=\377\272, -+ kOPT=\377\372, kPRT=\377\275, kPRV=\377\262, -+ kRDO=\377\315, kRES=\377\374, kRIT=\377\266, -+ kRPL=\377\373, kSAV=\377\307, kSPD=\377\303, -+ kUND=\377\337, kbeg=\377\300, kcan=\377\243, kcbt=\377\0, -+ kclo=\377\343, kclr=\377\341, kcmd=\377\245, -+ kcpy=\377\265, kcrt=\377\305, kctab=\377\237, -+ kcub1=\377\244, kcud1=\377\251, kcuf1=\377\246, -+ kcuu1=\377\241, kdch1=\377\254, kdl1=\377\274, -+ ked=\377\314, kel=\377\310, kend=\377\250, kent=\377\320, -+ kext=\377\270, kf1=\377\201, kf10=\377\212, -+ kf11=\377\256, kf12=\377\257, kf13=\377\213, -+ kf14=\377\214, kf15=\377\215, kf16=\377\216, -+ kf17=\377\217, kf18=\377\220, kf19=\377\221, -+ kf2=\377\202, kf20=\377\222, kf21=\377\223, -+ kf22=\377\224, kf23=\377\333, kf24=\377\334, -+ kf25=\377\225, kf26=\377\226, kf27=\377\227, -+ kf28=\377\230, kf29=\377\231, kf3=\377\203, -+ kf30=\377\232, kf31=\377\233, kf32=\377\234, -+ kf33=\377\235, kf34=\377\236, kf35=\377\276, -+ kf36=\377\277, kf37=\377\321, kf38=\377\322, -+ kf39=\377\323, kf4=\377\204, kf40=\377\324, -+ kf41=\377\325, kf42=\377\326, kf43=\377\327, -+ kf44=\377\330, kf45=\377\331, kf46=\377\332, -+ kf47=\377\316, kf48=\377\317, kf5=\377\205, kf6=\377\206, -+ kf7=\377\207, kf8=\377\210, kf9=\377\211, kfnd=\377\346, -+ khlp=\377\350, khome=\377\240, khts=\377\342, -+ kich1=\377\253, kil1=\377\273, kind=\377\261, -+ kmov=\377\351, kmrk=\377\355, kmsg=\377\345, -+ knp=\377\252, knxt=\377\312, kopn=\377\357, -+ kopt=\377\353, kpp=\377\242, kprt=\377\255, -+ kprv=\377\302, krdo=\377\336, kref=\377\354, -+ kres=\377\360, krfr=\377\347, kri=\377\271, -+ krmir=\377\313, krpl=\377\362, krst=\377\352, -+ ksav=\377\361, kslt=\377\247, kspd=\377\335, -+ ktbc=\377\344, kund=\377\365, mvpa=\E!%p1%02d, op=\ER, -+ rep=\Eg%p2%{32}%+%c%p1%c, rev=\E(, ri=\EI, rmcup=\Eh\ER, -+ rmso=\E), rmul=\E], rs1=\ER, setb=\E@%p1%Pb%gb%gf%d%d, -+ setf=\E@%p1%Pf%gb%gf%d%d, sgr0=\E}\E]\E>\E), smcup=\Ei, -+ smso=\E(, smul=\E[, - # -+# -+qnxt|qnxt4|QNX4 terminal, -+ crxm, use=qnx4, -+# -+qnxm|QNX4 with mouse events, -+ maddr#1, -+ chr=\E/, cvr=\E", is1=\E/0t, mcub=\E/>1h, mcub1=\E/>7h, -+ mcud=\E/>1h, mcud1=\E/>1l\E/>9h, mcuf=\E/>1h\E/>9l, -+ mcuf1=\E/>7l, mcuu=\E/>6h, mcuu1=\E/>6l, rmicm=\E/>2l, -+ smicm=\E/>2h, use=qnx4, -+# -+qnxw|QNX4 windows, -+ xvpa, use=qnxm, -+# -+# Monochrome QNX4 terminal or console. Setting this terminal type will -+# allow an application running on a color console to behave as if it -+# were a monochrome terminal. Output will be through stdout instead of -+# console writes because the term routines will recognize that the -+# terminal name starts with 'qnxt'. -+# -+qnxtmono|Monochrome QNX4 terminal or console, -+ colors@, pairs@, -+ scp@, use=qnx4, - --# John Hawkinson <jhawk@MIT.EDU> tells us that the EWAN telnet for Windows --# (the best Windows telnet as of September 1995) presents the name `dec-vt100' --# to telnetd. Michael Deutschmann <ldeutsch@mail.netshop.net> informs us --# that this works best with a stock vt100 entry. --dec-vt100|EWAN telnet's vt100 emulation, -- use=vt100, -- --# From: Adrian Garside <94ajg2@eng.cam.ac.uk>, 19 Nov 1996 --dec-vt220|DOS tnvt200 terminal emulator, -- am@, use=vt220, -- --# Zstem340 is an (IMHO) excellent VT emulator for PC's. I recommend it to --# anyone who needs PC VT340 emulation. (or anything below that level, for --# that matter -- DEC's ALL-in-1 seems happy with it, as does INFOPLUS's --# RDBM systems, it includes ReGIS and SiXel support! I'm impressed... --# I can send the address if requested. --# (z340: changed garbled \E[5?l to \E[?5l, DEC smooth scroll off -- esr) --# From: Adam Thompson <athompso@pangea.ca> Sept 10 1995 --z340|zstem vt340 terminal emulator 132col 42line, -- lines#42, -- is2=\E>\E[?3h\E[?4l\E[?5l\E[?7h\E[?8h\E[1;42r\E[42;1H, -- rs2=\E>\E[?3h\E[?4l\E[?5l\E[?7h\E[?8h\E[1;42r\E[42;1H, -- use=vt320-w, --z340-nam|zstem vt340 terminal emulator 132col 42line (no automatic margins), -- am@, -- is2=\E>\E[?3h\E[?4l\E[?5l\E[?7l\E[?8h\E[1;42r\E[42;1H, -- rs2=\E>\E[?3h\E[?4l\E[?5l\E[?7l\E[?8h\E[1;42r\E[42;1H, -- use=z340, -- --# CRT is shareware. It implements some xterm features, including mouse. --crt|crt-vt220|CRT 2.3 emulating VT220, -- bce, msgr, -- ncv@, -- hts=\EH, use=vt100+enq, use=vt220, use=ecma+color, -+# From: Federico Bianchi <bianchi@pc-arte2.arte.unipi.it>, 1 Jul 1998 -+# (esr: commented out <scp> and <rmcup> to avoid warnings.) -+# (TD: derive from original qnx4 entry) -+qnxt2|qnx 2.15 serial terminal, -+ am, -+ civis@, cnorm@, cvvis@, dch1@, ich1@, kRES@, kRPL@, kUND@, kspd@, -+ rep@, rmcup@, rmso=\E>, setb@, setf@, smcup@, smso=\E<, use=qnx4, - --# PuTTY 0.55 (released 3 August 2004) --# http://www.chiark.greenend.org.uk/~sgtatham/putty/ -+# QNX ANSI terminal definition -+qansi-g|QNX ANSI, -+ am, eslok, hs, xon, -+ colors#8, cols#80, it#8, lines#25, ncv#19, pairs#64, wsl#80, -+ acsc=Oa``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -+ bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l, -+ clear=\E[2J\E[H, cnorm=\E[?25h\E[?12l, cr=^M, -+ csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=\E[D, -+ cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, cuf1=\E[C, -+ cup=\E[%i%p1%d;%p2%dH$<5>, cuu=\E[%p1%dA, cuu1=\E[A, -+ cvvis=\E[?12;25h, dch=\E[%p1%dP, dch1=\E[P, dim=\E[2m, -+ dl=\E[%p1%dM, dl1=\E[1M, dsl=\E[r, ech=\E[%p1%dX, ed=\E[J, -+ el=\E[K, el1=\E[1K\E[X, flash=\E[?5h$<200>\E[?5l, -+ fsl=\E[?6h\E8, home=\E[H, hpa=\E[%i%p1%dG, ht=^I, hts=\EH, -+ ich=\E[%p1%d@, ich1=\E[1@, il=\E[%p1%dL, il1=\E[1L, -+ ind=\E[S, indn=\E[%p1%dS, invis=\E[9m, -+ is2=\E>\E[?1l\E[?7h\E[0;10;39;49m, is3=\E(B\E)0, -+ kBEG=\ENn, kCAN=\E[s, kCMD=\E[t, kCPY=\ENs, kCRT=\ENt, -+ kDL=\ENv, kEXT=\ENw, kFND=\ENx, kHLP=\ENy, kHOM=\E[h, -+ kLFT=\E[d, kNXT=\E[u, kOPT=\ENz, kPRV=\E[v, kRIT=\E[c, -+ kbs=^H, kcan=\E[S, kcbt=\E[Z, kclo=\ENc, kclr=\ENa, -+ kcmd=\E[G, kcpy=\E[g, kctab=\E[z, kcub1=\E[D, kcud1=\E[B, -+ kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[P, kdl1=\E[p, kend=\E[Y, -+ kext=\E[y, kf1=\EOP, kf10=\EOY, kf11=\EOZ, kf12=\EOA, -+ kf13=\EOp, kf14=\EOq, kf15=\EOr, kf16=\EOs, kf17=\EOt, -+ kf18=\EOu, kf19=\EOv, kf2=\EOQ, kf20=\EOw, kf21=\EOx, -+ kf22=\EOy, kf23=\EOz, kf24=\EOa, kf25=\E[1~, kf26=\E[2~, -+ kf27=\E[3~, kf28=\E[4~, kf29=\E[5~, kf3=\EOR, kf30=\E[6~, -+ kf31=\E[7~, kf32=\E[8~, kf33=\E[9~, kf34=\E[10~, -+ kf35=\E[11~, kf36=\E[12~, kf37=\E[17~, kf38=\E[18~, -+ kf39=\E[19~, kf4=\EOS, kf40=\E[20~, kf41=\E[21~, -+ kf42=\E[22~, kf43=\E[23~, kf44=\E[24~, kf45=\E[25~, -+ kf46=\E[26~, kf47=\E[27~, kf48=\E[28~, kf5=\EOT, kf6=\EOU, -+ kf7=\EOV, kf8=\EOW, kf9=\EOX, kfnd=\ENf, khlp=\ENh, -+ khome=\E[H, khts=\ENb, kich1=\E[@, kil1=\E[`, kind=\E[a, -+ kmov=\ENi, kmrk=\ENm, kmsg=\ENe, knp=\E[U, kopn=\ENo, -+ kopt=\ENk, kpp=\E[V, kref=\ENl, kres=\ENp, krfr=\ENg, -+ kri=\E[b, krpl=\ENr, krst=\ENj, ksav=\ENq, kslt=\E[T, -+ ktbc=\ENd, kund=\ENu, ll=\E[99H, nel=\EE, op=\E[39;49m, -+ rep=%p1%c\E[%p2%{1}%-%db, rev=\E[7m, ri=\E[T, -+ rin=\E[%p1%dT, rmacs=^O, rmam=\E[?7l, rmso=\E[27m, -+ rmul=\E[24m, rs1=\017\E[?7h\E[0;39;49m$<2>\E>\E[?1l, -+ rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, -+ setb=\E[4%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m, -+ setf=\E[3%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m, -+ sgr=\E[0%?%p6%t;1%;%?%p5%t;2%;%?%p2%t;4%;%?%p4%t;5%;%?%p3%p1%|%t;7%;%?%p7%t;9%;m%?%p9%t\016%e\017%;, -+ sgr0=\E[m\017, smacs=^N, smam=\E[?7h, smso=\E[7m, -+ smul=\E[4m, tbc=\E[3g, -+ tsl=\E7\E1;24r\E[?6l\E[25;%i%p1%dH, - # --# Comparing with 0.51, vttest is much better (only a few problems with the --# cursor position reports and wrapping). -+qansi|QNX ansi with console writes, -+ daisy, xhpa, use=qansi-g, - # --# PuTTY 0.51 (released 14 December 2000) -+qansi-t|QNX ansi without console writes, -+ crxm, use=qansi, - # --# This emulates vt100 + vt52 (plus a few vt220 features: ech, SRM, DECTCEM, as --# well as SCO and Atari, color palettes from Linux console). Reading the code, --# it is intended to be VT102 plus selected features. By default, it sets $TERM --# to xterm, which is incorrect, since several features are misimplemented: -+qansi-m|QNX ansi with mouse, -+ maddr#1, -+ chr=\E[, cvr=\E], is1=\E[0t, mcub=\E[>1h, mcub1=\E[>7h, -+ mcud=\E[>1h, mcud1=\E[>1l\E[>9h, mcuf=\E[>1h\E[>9l, -+ mcuf1=\E[>7l, mcuu=\E[>6h, mcuu1=\E[>6l, rmicm=\E[>2l, -+ smicm=\E[>2h, use=qansi, - # --# Alt+key always sends ESC+key, so 'km' capability is removed. -+qansi-w|QNX ansi for windows, -+ xvpa, use=qansi-m, -+ -+#### SCO consoles -+ -+# SCO console and SOS-Syscons console for 386bsd -+# (scoansi: had unknown capabilities -+# :Gc=N:Gd=K:Gh=M:Gl=L:Gu=J:Gv=\072:\ -+# :GC=E:GD=B:GH=D:GL=\64:GU=A:GV=\63:GR=C: -+# :G1=?:G2=Z:G3=@:G4=Y:G5=;:G6=I:G7=H:G8=<:\ -+# :CW=\E[M:NU=\E[N:RF=\E[O:RC=\E[P:\ -+# :WL=\E[S:WR=\E[T:CL=\E[U:CR=\E[V:\ -+# I renamed GS/GE/HM/EN/PU/PD/RT and added klone+sgr-dumb, based -+# on the <smacs>=\E[12m -- esr) - # --# Control responses, wrapping and tabs are buggy, failing a couple of --# screens in vttest. -+# klone+sgr-dumb is an error since the acsc does not match -TD - # --# xterm mouse support is not implemented (unrelease version may). -+# In this description based on SCO's keyboard(HW) manpage list of default -+# function key values: -+# F13-F24 are shifted F1-F12 -+# F25-F36 are control F1-F12 -+# F37-F48 are shift+control F1-F12 - # --# Several features such as backspace/delete are optional; this entry documents --# the default behavior -TD -- --putty|PuTTY terminal emulator, -- am, bce, bw, ccc, hs, mir, msgr, xenl, xon, XT, -- colors#8, it#8, ncv#22, pairs#64, U8#1, -- acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -- bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l, -- clear=\E[H\E[J, cnorm=\E[?25h, cr=^M, -- csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, -- cud=\E[%p1%dB, cud1=\ED, cuf=\E[%p1%dC, cuf1=\E[C, -- cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\EM, -- dch=\E[%p1%dP, dch1=\E[P, -- dispc=%?%p1%{8}%=%t\E%%G\342\227\230\E%%@%e%p1%{10}%=%t\E%%G\342\227\231\E%%@%e%p1%{12}%=%t\E%%G\342\231\0\E%%@%e%p1%{13}%=%t\E%%G\342\231\252\E%%@%e%p1%{14}%=%t\E%%G\342\231\253\E%%@%e%p1%{15}%=%t\E%%G\342\230\274\E%%@%e%p1%{27}%=%t\E%%G\342\206\220\E%%@%e%p1%{155}%=%t\E%%G\340\202\242\E%%@%e%p1%c%;, -- dl=\E[%p1%dM, dl1=\E[M, dsl=\E]0;\007, ech=\E[%p1%dX, -- ed=\E[J, el=\E[K, el1=\E[1K, enacs=\E(B\E)0, -- flash=\E[?5h\E[?5l, fsl=^G, home=\E[H, hpa=\E[%i%p1%dG, -- ht=^I, hts=\EH, il=\E[%p1%dL, il1=\E[L, ind=^J, -- indn=\E[%p1%dS, -- initc=\E]P%p1%x%p2%{255}%*%{1000}%/%02x%p3%{255}%*%{1000}%/%02x%p4%{255}%*%{1000}%/%02x, -- is2=\E7\E[r\E[m\E[?7h\E[?1;4;6l\E[4l\E8\E>\E]R, -- kb2=\E[G, kbs=\177, kcbt=\E[Z, kcub1=\E[D, kcud1=\E[B, -- kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[3~, kend=\E[4~, -- kf1=\E[11~, kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, -- kf13=\E[25~, kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, -- kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, kf2=\E[12~, -- kf20=\E[34~, kf3=\E[13~, kf4=\E[14~, kf5=\E[15~, -- kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, -- khome=\E[1~, kich1=\E[2~, kmous=\E[M, knp=\E[6~, kpp=\E[5~, -- kspd=^Z, nel=^M^J, oc=\E]R, op=\E[39;49m, rc=\E8, rev=\E[7m, -- ri=\EM, rin=\E[%p1%dT, rmacs=^O, rmam=\E[?7l, -- rmcup=\E[2J\E[?47l, rmir=\E[4l, rmpch=\E[10m, -- rmso=\E[27m, rmul=\E[24m, -- rs2=\E<\E["p\E[50;6"p\Ec\E[?3l\E]R\E[?1000l, -- s0ds=\E[10m, s1ds=\E[11m, s2ds=\E[12m, sc=\E7, -- setab=\E[4%p1%dm, setaf=\E[3%p1%dm, -- sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;, -- sgr0=\E[m\017, smacs=^N, smam=\E[?7h, smcup=\E[?47h, -- smir=\E[4h, smpch=\E[11m, smso=\E[7m, smul=\E[4m, -- tbc=\E[3g, tsl=\E]0;, vpa=\E[%i%p1%dd, use=vt102+enq, --vt100-putty|Reset PuTTY to pure vt100, -- rs2=\E<\E["p\Ec\E[?3l\E]R\E[40"p\E[61"p\E[50;1;2"p, -- use=vt100, --# palette is hardcoded... --putty-256color|PuTTY 0.58 with xterm 256-colors, -- initc@, use=xterm+256color, use=putty, -+# hpa/vpa work in the console, but not in scoterm: -+# hpa=\E[%p1%dG, -+# vpa=\E[%p1%dd, -+# -+# SCO's terminfo uses -+# kLFT=\E[d, -+# kRIT=\E[c, -+# which do not work (console or scoterm). -+# -+# Console documents only 3 attributes can be set with SGR (so we don't use sgr). -+scoansi-old|SCO Extended ANSI standard crt (5.0.5), -+ OTbs, am, bce, eo, xon, -+ colors#8, cols#80, it#8, lines#25, pairs#64, -+ acsc=+/\,.-\230.\2310[5566778899\:\:;;<<==>>FFGGHHIIJJKKLLMMNNOOPPQQRRSSTTUUVVWWXX`\204a0fxgqh2jYk?lZm@nEqDtCu4vAwBx3yszr{c}\034~\207, -+ bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, -+ civis=\E[=14;12C, clear=\E[H\E[2J, cnorm=\E[=10;12C, -+ cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=\E[B, -+ cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, -+ cuu=\E[%p1%dA, cuu1=\E[A, cvvis=\E[=0;12C, dch=\E[%p1%dP, -+ dch1=\E[P, dispc=\E[=%p1%dg, dl=\E[%p1%dM, dl1=\E[M, -+ ed=\E[m\E[J, el=\E[m\E[K, el1=\E[1K, home=\E[H, ht=^I, -+ hts=\EH, ich=\E[%p1%d@, ich1=\E[@, il=\E[%p1%dL, il1=\E[L, -+ ind=\E[S, indn=\E[%p1%dS, invis=\E[8m, kbeg=\E[E, kbs=^H, -+ kcbt=\E[Z, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, -+ kdch1=\177, kend=\E[F, kf1=\E[M, kf10=\E[V, kf11=\E[W, -+ kf12=\E[X, kf13=\E[Y, kf15=\E[a, kf16=\E[b, kf17=\E[c, -+ kf18=\E[d, kf19=\E[e, kf2=\E[N, kf20=\E[f, kf21=\E[g, -+ kf22=\E[h, kf23=\E[i, kf24=\E[j, kf25=\E[k, kf26=\E[l, -+ kf27=\E[m, kf28=\E[n, kf29=\E[o, kf3=\E[O, kf30=\E[p, -+ kf31=\E[q, kf32=\E[r, kf33=\E[s, kf34=\E[t, kf35=\E[u, -+ kf36=\E[v, kf37=\E[w, kf38=\E[x, kf39=\E[y, kf4=\E[P, -+ kf40=\E[z, kf41=\E[@, kf42=\E[[, kf43=\E[\\, kf44=\E[], -+ kf45=\E[\^, kf46=\E[_, kf47=\E[`, kf48=\E[{, kf5=\E[Q, -+ kf6=\E[R, kf7=\E[S, kf8=\E[T, kf9=\E[U, khome=\E[H, -+ kich1=\E[L, knp=\E[G, kpp=\E[I, op=\E[0;37;40m, rc=\E8, -+ rev=\E[7m, ri=\E[T, rin=\E[%p1%dT, rmacs=\E[10m, -+ rmam=\E[?7l, rmso=\E[m, rmul=\E[m, sc=\E7, -+ setab=\E[4%p1%dm, setaf=\E[3%p1%dm, sgr0=\E[0;10m, -+ smacs=\E[12m, smam=\E[?7h, smso=\E[7m, smul=\E[4m, -+scoansi-new|SCO Extended ANSI standard crt (5.0.6), -+ km, -+ civis=\E[=0c, cnorm=\E[=1c, csr=\E[%i%p1%d;%p2%dr, -+ cvvis=\E[=2c, mgc=\E[=r, oc=\E[51m, op=\E[50m, -+ rep=\E[%p1%d;%p2%db, rmm=\E[=11L, -+ sgr=\E[0%?%p1%p3%|%t;7%;%?%p2%t;4%;%?%p4%t;5%;%?%p6%t;1%;%?%p7%t;8%;%?%p9%t;12%e;10%;m, -+ smgb=\E[=1;0m, smgbp=\E[=1;%i%p1%dm, -+ smglp=\E[=2;%i%p1%dm, smgr=\E[=3;0m, -+ smgrp=\E[=3;%i%p1%dm, smgt=\E[=0;0m, -+ smgtp=\E[=0;%i%p1%dm, smm=\E[=10L, -+ wind=\E[%i%p1%d;%p2%d;%i%p3%d;%p4%dr, -+ use=scoansi-old, -+# make this easy to change... -+scoansi|SCO Extended ANSI standard crt, -+ use=scoansi-old, - --# One of the keyboard selections is "VT100+". --# pterm (the X11 port) uses shifted F1-F10 as F11-F20 --putty-vt100|VT100+ keyboard layout, -- kf1=\EOP, kf10=\EOY, kf11=\EOZ, kf12=\EO[, kf2=\EOQ, -- kf3=\EOR, kf4=\EOS, kf5=\EOT, kf6=\EOU, kf7=\EOV, kf8=\EOW, -- kf9=\EOX, use=putty, -+#### SGI consoles - --# This entry is for Tera Term Pro version 2.3, for MS-Windows 95/NT written by --# T. Teranishi dated Mar 10, 1998. It is a free software terminal emulator --# (communication program) which supports: -+# Sent by Stefan Stapelberg <stefan@rent-a-guru.de>, 24 Feb 1997, this is -+# from SGI's terminfo database. SGI's entry shows F9-F12 with the codes -+# for the application keypad mode. We have added iris-ansi-ap rather than -+# change the original to keypad mode. - # --# - Serial port connections. --# - TCP/IP (telnet) connections. --# - VT100 emulation, and selected VT200/300 emulation. --# - TEK4010 emulation. --# - File transfer protocols (Kermit, XMODEM, ZMODEM, B-PLUS and --# Quick-VAN). --# - Scripts using the "Tera Term Language". --# - Japanese and Russian character sets. -+# (iris-ansi: added rmam/smam based on init string -- esr) - # --# The program does not come with terminfo or termcap entries. However, the --# emulation (testing with vttest and ncurses) is reasonably close to vt100 (no --# vt52 or doublesize character support; blinking is done with color). Besides --# the HPA, VPA extensions it also implements CPL and CNL. -+# This entry, and those derived from it, is used in xwsh (also known as -+# winterm). Some capabilities that do not fit into the terminfo model -+# include the shift- and control-functionkeys: - # --# All of the function keys can be remapped. This description shows the default --# mapping, as installed. Both vt100 PF1-PF4 keys and quasi-vt220 F1-F4 keys --# are supported. F13-F20 are obtained by shifting F3-F10. The editing keypad --# is laid out like vt220, rather than the face codes on the PC keyboard, i.e, --# kfnd Insert --# kslt Delete --# kich1 Home --# kdch1 PageUp --# kpp End --# knp PageDown -+# F1-F12 generate different codes when shift or control modifiers are used. -+# For example: -+# F1 \E[001q -+# shift F1 \E[013q -+# control-F1 \E[025q - # --# ANSI colors are implemented, but cannot be combined with video attributes --# except for reverse. -+# In application keypad mode, F9-F12 generate codes like vt100 PF1-PF4, i.e., -+# \EOP to \EOS. The shifted and control modifiers still do the same thing. - # --# No fonts are supplied with the program, so the acsc string is chosen to --# correspond with the default Microsoft terminal font. -+# The cursor keys also have different codes: -+# control-up \E[162q -+# control-down \E[165q -+# control-left \E[159q -+# control-right \E[168q - # --# Tera Term recognizes some xterm sequences, including those for setting and --# retrieving the window title, and for setting the window size (i.e., using --# "resize -s"), though it does not pass SIGWINCH to the application if the --# user resizes the window with the mouse. --teraterm2.3|Tera Term Pro, -- km, xon@, -- ncv#43, vt@, -- acsc=+\020\,\021-\030.^Y0\333`\004a\261f\370g\361h\260i\316j\331k\277l\332m\300n\305o~p\304q\304r\304s_t\303u\264v\301w\302x\263y\363z\362{\343|\330}\234~\376, -- blink=\E[5m, bold=\E[1m, civis=\E[?25l, clear=\E[H\E[J, -- cnorm=\E[?25h, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, -- cuu1=\E[A, dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, -- dl1=\E[M, ech=\E[%p1%dX, ed=\E[J, el=\E[K, el1=\E[1K, -- flash=\E[?5h\E[?5l$<200/>, hpa=\E[%i%p1%dG, -- il=\E[%p1%dL, il1=\E[L, kdch1=\E[3~, kf1=\E[11~, -- kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, -- kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, kf17=\E[31~, -- kf18=\E[32~, kf19=\E[33~, kf2=\E[12~, kf20=\E[34~, -- kf3=\E[13~, kf4=\E[14~, kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, -- kf8=\E[19~, kf9=\E[20~, kfnd=\E[1~, kich1=\E[2~, knp=\E[6~, -- kpp=\E[5~, kslt=\E[4~, op=\E[100m, rev=\E[7m, ri=\EM, -- rmso=\E[27m, rmul=\E[24m, sgr0=\E[0m\017, smso=\E[7m, -- smul=\E[4m, vpa=\E[%i%p1%dd, use=vt100+enq, -- use=klone+color, use=vt100, -- --# Version 4.59 has regular vt100 line-drawing (so it is no longer necessary --# to choose a Windows OEM font). -+# shift-up \E[161q -+# shift-down \E[164q -+# shift-left \E[158q -+# shift-right \E[167q - # --# Testing with tack: --# - it does not have xenl (suppress that) --# - underline seems to work with color (modify ncv). --# Testing with vttest: --# - wrapping differs from vt100 (menu 1). --# - it recognizes xterm's X10 and normal mouse tracking, but none of the --# other flavors. --# - it recognizes the dtterm window controls for reporting size in --# characters and pixels. --# - it passes SIGWINCH. --teraterm4.59|Tera Term Pro, -- bce, xenl@, -- ncv#41, -- acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -- kmous=\E[M, use=teraterm2.3, -- --teraterm|Tera Term, -- use=teraterm4.59, -- --# Tested with WinNT 4.0, the telnet application assumes the screensize is --# 25x80. This entry uses the 'Terminal' font, to get line-drawing characters. -+# control-tab \[072q - # --# Other notes: --# a) Fails tack's cup (cursor-addressing) test, though cup works well enough --# for casual (occasional) use. Also fails several of the vttest screens, --# but that is not unusual for vt100 "emulators". --# b) Does not implement vt100 keypad --# c) Recognizes a subset of vt52 controls. --ms-vt100|MS telnet imitating dec vt100, -- lines#25, -- acsc=+\020\,\021-\030.^Y0\333`\004a\261f\370g\361h\260i\316j\331k\277l\332m\300n\305o~p\304q\304r\304s_t\303u\264v\301w\302x\263y\363z\362{\343|\330}\234~\376, -- ka1@, ka3@, kb2@, kc1@, kc3@, kent@, kf0@, kf1@, kf10@, kf2@, kf3@, kf4@, -- kf5@, kf6@, kf7@, kf8@, kf9@, tbc@, use=vt102+enq, use=vt100, -+iris-ansi|iris-ansi-net|IRIS emulating 40 line ANSI terminal (almost VT100), -+ am, -+ cols#80, it#8, lines#40, -+ bel=^G, bold=\E[1m, clear=\E[H\E[2J, -+ cnorm=\E[9/y\E[12/y\E[=6l, cr=^M, cub=\E[%p1%dD, -+ cub1=\E[D, cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, -+ cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, -+ cuu1=\E[A, cvvis=\E[10/y\E[=1h\E[=2l\E[=6h, -+ dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[K, el1=\E[1K, -+ home=\E[H, ht=^I, hts=\EH, il=\E[%p1%dL, il1=\E[L, ind=\ED, -+ is2=\E[?1l\E>\E[?7h\E[100g\E[0m\E7\E[r\E8, kDC=\E[P, -+ kEND=\E[147q, kHOM=\E[143q, kLFT=\E[158q, kPRT=\E[210q, -+ kRIT=\E[167q, kSPD=\E[218q, kbs=^H, kcbt=\E[Z, kcub1=\E[D, -+ kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=\177, -+ kend=\E[146q, kent=^M, kf1=\E[001q, kf10=\E[010q, -+ kf11=\E[011q, kf12=\E[012q, kf2=\E[002q, kf3=\E[003q, -+ kf4=\E[004q, kf5=\E[005q, kf6=\E[006q, kf7=\E[007q, -+ kf8=\E[008q, kf9=\E[009q, khome=\E[H, kich1=\E[139q, -+ knp=\E[154q, kpp=\E[150q, kprt=\E[209q, krmir=\E[146q, -+ kspd=\E[217q, nel=\EE, pfkey=\EP101;%p1%d.y%p2%s\E\\, -+ rc=\E8, rev=\E[7m, ri=\EM, rmam=\E[?7l, rmso=\E[m, rmul=\E[m, -+ sc=\E7, sgr0=\E[m, smam=\E[?7h, smso=\E[1;7m, smul=\E[4m, -+ tbc=\E[3g, -+iris-ansi-ap|IRIS ANSI in application-keypad mode, -+ is2=\E[?1l\E=\E[?7h, kent=\EOM, kf10=\E[010q, -+ kf11=\E[011q, kf12=\E[012q, kf9=\E[009q, use=iris-ansi, - --# Tested with Windows 2000, the telnet application runs in a console window, --# also using 'Terminal' font. --# --# Other notes: --# a) This version has no function keys or numeric keypad. Unlike the older --# version, the numeric keypad is entirely ignored. --# b) The program sets $TERM to "ansi", which of course is inaccurate. --ms-vt100-color|vtnt|windows 2000 ansi (sic), -- bce, -- dch=\E[%p1%dP, ich=\E[%p1%d@, use=ecma+color, -- use=ms-vt100, -+# From the man-page, this is a quasi-vt100 emulator that runs on SGI's IRIX -+# (T.Dickey 98/1/24) -+iris-color|xwsh|IRIX ANSI with color, -+ ncv#33, -+ csr=\E[%i%p1%d;%p2%dr, dch=\E[%p1%dP, dim=\E[2m, -+ ech=\E[%p1%dX, ich=\E[%p1%d@, rc=\E8, ritm=\E[23m, -+ rmul=\E[24m, rs1=\Ec, -+ rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sc=\E7, -+ sitm=\E[3m, use=vt100+enq, use=klone+color, -+ use=iris-ansi-ap, - --# Based on comments from Federico Bianchi: -+#### OpenBSD consoles - # --# vt100+ is basically a VT102-noSGR with ANSI.SYS colors and a different --# scheme for PF keys. -+# From: Alexei Malinin <Alexei.Malinin@mail.ru>; October, 2011. - # --# and PuTTY wishlist: -+# The following terminal descriptions for the AMD/Intel PC console -+# were prepared based on information contained in the OpenBSD-4.9 -+# termtypes.master and wscons(4) & vga(4) manuals (2010, November). - # --# The modifiers are represented as the codes listed above, prefixed to --# the normal sequences. If the modifier is pressed alone, its sequence --# is transmitted twice in succession. If multiple modifiers apply, --# they're transmitted in the order shift, control, alt. --# --# Shift \E^S --# Alt \E^A, --# Ctrl \E^C, --ms-vt100+|vt100+|windows XP vt100+ (sic), -- kdch1=\E-, kend=\Ek, kf1=\E1, kf10=\E0, kf11=\E!, kf12=\E@, -- kf13=\E\023\E1, kf14=\E\023\E2, kf15=\E\023\E3, -- kf16=\E\023\E4, kf17=\E\023\E5, kf18=\E\023\E6, -- kf19=\E\023\E7, kf2=\E2, kf20=\E\023\E8, kf21=\E\023\E9, -- kf22=\E\023\E0, kf23=\E\023\E!, kf24=\E\023\E@, -- kf25=\E\003\E1, kf26=\E\003\E2, kf27=\E\003\E3, -- kf28=\E\003\E4, kf29=\E\003\E5, kf3=\E3, kf30=\E\003\E6, -- kf31=\E\003\E7, kf32=\E\003\E8, kf33=\E\003\E9, -- kf34=\E\003\E0, kf35=\E\003\E!, kf36=\E\003\E@, -- kf37=\E\001\E1, kf38=\E\001\E2, kf39=\E\001\E3, kf4=\E4, -- kf40=\E\001\E4, kf41=\E\001\E5, kf42=\E\001\E6, -- kf43=\E\001\E7, kf44=\E\001\E8, kf45=\E\001\E9, -- kf46=\E\001\E0, kf47=\E\001\E!, kf48=\E\001\E@, kf5=\E5, -- kf6=\E6, kf7=\E7, kf8=\E8, kf9=\E9, khome=\Eh, kich1=\E+, -- knp=\E/, kpp=\E?, use=ms-vt100-color, -- --ms-vt-utf8|vt-utf8|UTF-8 flavor of vt100+, -- use=ms-vt100+, -- --# expect-5.44.1.15/example/tkterm --# a minimal subset of a vt100 (compare with "news-unk). -+# Added bce based on testing with tack -TD -+# Added several capabilities to pccon+base, reading wsemul_vt100_subr.c -TD -+# Changed kbs to DEL and removed keys that duplicate stty settings -TD - # --# The missing "=" in smkx is not a typo (here), but an error in tkterm. --tt|tkterm|Don Libes' tk text widget terminal emulator, -- clear=\E[H\E[J, cr=^M, cub1=^H, cud1=^J, cuf1=\E[C, -- cup=\E[%p1%d;%p2%dH, cuu1=\E[A, ind=^J, kf1=\EOP, kf2=\EOQ, -- kf3=\EOR, kf4=\EOS, kf5=\EOT, kf6=\EOU, kf7=\EOV, kf8=\EOW, -- kf9=\EOX, rmkx=\E[?1l\E>, rmso=\E[m, smkx=\E[?1h\E, -- smso=\E[7m, -+pccon+keys|OpenBSD PC keyboard keys, -+ kbs=\177, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, -+ kdch1=\E[3~, kend=\E[8~, kent=^M, kf1=\E[11~, kf10=\E[21~, -+ kf11=\E[23~, kf12=\E[24~, kf2=\E[12~, kf3=\E[13~, -+ kf4=\E[14~, kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, -+ kf9=\E[20~, khome=\E[7~, kich1=\E[2~, knp=\E[6~, kpp=\E[5~, -+ krfr=^R, -+pccon+sgr+acs0|sgr and simple ASCII pseudographics for OpenBSD PC console, -+ acsc=+>\,<-\^.v0#`+a\:f\\h#i#j+k+l+m+n+o~p-q-r-s_t+u+v+w+x|y#z#{*|!}#~o, -+ sgr=\E[0%?%p1%p3%|%t;7%;m, sgr0=\E[m, -+pccon+sgr+acs|sgr and default ASCII pseudographics for OpenBSD PC console, -+ acsc=++\,\,--..00``aaffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -+ enacs=\E)0$<5>, rmacs=\E(B$<5>, -+ sgr=\E[0%?%p1%p3%|%t;7%;m%?%p9%t\E(0%e\E(B%;$<5>, -+ sgr0=\E[m\E(B$<5>, smacs=\E(0$<5>, -+pccon+colors|ANSI colors for OpenBSD PC console, -+ bce, -+ colors#8, pairs#64, -+ op=\E[m, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, -+pccon+base|base capabilities for OpenBSD PC console, -+ am, km, mc5i, msgr, npc, nxon, xenl, xon, -+ cols#80, it#8, lines#24, -+ bel=^G, clear=\E[H\E[J, cr=^M, cub1=^H, cud1=^J, cuf1=\E[C, -+ cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, dch=\E[%p1%dP, -+ dch1=\E[P, dl1=\E[M, ech=\E[%p1%dX, ed=\E[J, el=\E[K, -+ el1=\E[1K, home=\E[H, ht=^I, hts=\EH, ich=\E[%p1%d@, -+ il1=\E[L, ind=\ED, nel=\EE, rev=\E[7m, ri=\EM, rmam=\E[?7l, -+ rmso=\E[m, rs2=\Ec$<50>, smam=\E[?7h, smso=\E[7m, -+ tbc=\E[3g, u6=\E[%i%d;%dR, u7=\E[6n, -+pccon0-m|OpenBSD PC console without colors & with simple ASCII pseudographics, -+ use=pccon+base, use=pccon+sgr+acs0, use=pccon+keys, -+pccon0|OpenBSD PC console with simple ASCII pseudographics, -+ use=pccon0-m, use=pccon+colors, -+pccon-m|OpenBSD PC console without colors, -+ use=pccon+base, use=pccon+sgr+acs, use=pccon+keys, -+pccon|OpenBSD PC console, -+ use=pccon-m, use=pccon+colors, - --#### X terminal emulators --# --# You can add the following line to your .Xdefaults to change the terminal type --# set by the xterms you start up to my-xterm: --# --# *termName: my-xterm -+#### NetBSD consoles - # --# System administrators can change the default entry for xterm instances --# by adding a similar line to /usr/X11/lib/X11/app-defaults/XTerm. In either --# case, xterm will detect and reject an invalid terminal type, falling back --# to the default of xterm. -+# pcvt termcap database entries (corresponding to release 3.31) -+# Author's last edit-date: [Fri Sep 15 20:29:10 1995] - # -+# (For the terminfo master file, I translated these into terminfo syntax. -+# Then I dropped all the pseudo-HP entries. we don't want and can't use -+# the :Xs: flag. Then I split :is: into a size-independent <is1> and a -+# size-dependent <is2>. Finally, I added <rmam>/<smam> -- esr) - --# X10/6.6 11/7/86, minus alternate screen, plus (csr) --# (xterm: ":MT:" changed to ":km:"; added <smam>/<rmam> based on init string; --# removed (hs, eslok, tsl=\E[?E\E[?%i%dT, fsl=\E[?F, dsl=\E[?E) --# as these seem not to work -- esr) --x10term|vs100-x10|xterm terminal emulator (X10 window system), -- OTbs, am, km, mir, msgr, xenl, xon, -- cols#80, it#8, lines#65, -- bold=\E[1m, clear=\E[H\E[2J, csr=\E[%i%p1%d;%p2%dr, -- cub1=^H, cud1=^J, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, -- cuu1=\E[A, dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, -- dl1=\E[M, ed=\E[J, el=\E[K, home=\E[H, ht=^I, il=\E[%p1%dL, -- il1=\E[L, ind=^J, is2=\E\E[m\E[?7h\E[?1;4l, kbs=^H, -- kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kf1=\EOP, -- kf2=\EOQ, kf3=\EOR, kf4=\EOS, rev=\E[7m, ri=\EM, rmam=\E[?7l, -- rmir=\E[4l, rmkx=\E[?1l\E>, rmso=\E[m, rmul=\E[m, -- sgr0=\E[m, smam=\E[?7h, smir=\E[4h, smkx=\E[?1h\E=, -- smso=\E[7m, smul=\E[4m, --# Compatible with the R5 xterm --# (from the XFree86 3.2 distribution, <blink=@> removed) --# added khome/kend, rmir/smir, rmul/smul, hts based on the R5 xterm code - TD --# corrected typos in rs2 string - TD --# added u6-u9 -TD --xterm-r5|xterm R5 version, -- OTbs, am, km, msgr, xenl, -- cols#80, it#8, lines#24, -- bel=^G, bold=\E[1m, clear=\E[H\E[2J, cr=^M, -- csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, -- cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, -- cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, -- dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, -- el=\E[K, home=\E[H, ht=^I, hts=\EH, ich=\E[%p1%d@, ich1=\E[@, -- il=\E[%p1%dL, il1=\E[L, ind=^J, kbs=^H, kcub1=\EOD, -- kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kdch1=\E[3~, -- kdl1=\E[31~, kel=\E[8~, kend=\E[4~, kf0=\EOq, kf1=\E[11~, -- kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf2=\E[12~, -- kf3=\E[13~, kf4=\E[14~, kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, -- kf8=\E[19~, kf9=\E[20~, khome=\E[1~, kich1=\E[2~, -- kil1=\E[30~, kmous=\E[M, knp=\E[6~, kpp=\E[5~, rc=\E8, -- rev=\E[7m, ri=\EM, rmir=\E[4l, rmkx=\E[?1l\E>, rmso=\E[m, -- rmul=\E[m, -- rs2=\E>\E[?1;3;4;5;6l\E[4l\E[?7h\E[m\E[r\E[2J\E[H, -- sc=\E7, -- sgr=\E[%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;m, -- sgr0=\E[m, smir=\E[4h, smkx=\E[?1h\E=, smso=\E[7m, -- smul=\E[4m, tbc=\E[3g, use=vt100+enq, --# Compatible with the R6 xterm --# (from XFree86 3.2 distribution, <acsc> and <it> added, <blink@> removed) --# added khome/kend, hts based on the R6 xterm code - TD --# (khome/kend do not actually work in X11R5 or X11R6, but many people use this --# for compatibility with other emulators). --xterm-r6|xterm-old|xterm X11R6 version, -- OTbs, am, km, mir, msgr, xenl, -- cols#80, it#8, lines#24, -- acsc=``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -- bel=^G, bold=\E[1m, clear=\E[H\E[2J, cr=^M, -+# NOTE: <ich1> has been taken out of this entry. for reference, it should -+# be <ich1=\E[@>. For discussion, see ICH/ICH1 VERSUS RMIR/SMIR below. -+# (esr: added <civis> and <cnorm> to resolve NetBSD Problem Report #4583) -+pcvtXX|pcvt vt200 emulator (DEC VT220), -+ am, km, mir, msgr, xenl, -+ it#8, vt#3, -+ acsc=++\,\,--..00``aaffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz~~, -+ bel=^G, blink=\E[5m, bold=\E[1m, civis=\E[?25l, -+ clear=\E[H\E[J, cnorm=\E[?25h, cr=^M, - csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, -- cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, -+ cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, cuf1=\E[C, - cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, - dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, -- el=\E[K, enacs=\E)0, home=\E[H, ht=^I, hts=\EH, il=\E[%p1%dL, -- il1=\E[L, ind=^J, -- is2=\E[m\E[?7h\E[4l\E>\E7\E[r\E[?1;3;4;6l\E8, kbs=^H, -+ el=\E[K, el1=\E[1K, home=\E[H, ht=^I, hts=\EH, ich=\E[%p1%d@, -+ il=\E[%p1%dL, il1=\E[L, ind=\ED, indn=\E[%p1%dS, -+ is1=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, kbs=\177, - kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, -- kdch1=\E[3~, kf1=\E[11~, kf10=\E[21~, kf11=\E[23~, -- kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, kf15=\E[28~, -- kf16=\E[29~, kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, -- kf2=\E[12~, kf20=\E[34~, kf3=\E[13~, kf4=\E[14~, -- kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, -- kfnd=\E[1~, kich1=\E[2~, kmous=\E[M, knp=\E[6~, kpp=\E[5~, -- kslt=\E[4~, meml=\El, memu=\Em, rc=\E8, rev=\E[7m, ri=\EM, -- rmacs=^O, rmcup=\E[2J\E[?47l\E8, rmir=\E[4l, -- rmkx=\E[?1l\E>, rmso=\E[m, rmul=\E[m, -- rs2=\E[m\E[?7h\E[4l\E>\E7\E[r\E[?1;3;4;6l\E8, sc=\E7, -- sgr0=\E[m, smacs=^N, smcup=\E7\E[?47h, smir=\E[4h, -+ kdch1=\E[3~, kf1=\E[17~, kf2=\E[18~, kf3=\E[19~, -+ kf4=\E[20~, kf5=\E[21~, kf6=\E[23~, kf7=\E[24~, kf8=\E[25~, -+ khome=\E[1~, kich1=\E[2~, kll=\E[4~, knp=\E[6~, kpp=\E[5~, -+ nel=\EE, rc=\E8, rev=\E[7m, rf=/usr/share/tabset/vt100, -+ ri=\EM, rin=\E[%p1%dT, rmacs=\E(B, rmam=\E[?7l, rmir=\E[4l, -+ rmkx=\E[?1l\E>, rmso=\E[27m, rmul=\E[24m, -+ rs1=\Ec\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sc=\E7, -+ sgr0=\E[m, smacs=\E(0, smam=\E[?7h, smir=\E[4h, - smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, tbc=\E[3g, -- use=vt100+enq, --# This is the base xterm entry for the xterm supplied with XFree86 3.2 & up. --# The name has been changed and some aliases have been removed. --xterm-xf86-v32|xterm terminal emulator (XFree86 3.2 Window System), -- OTbs, am, bce, km, mir, msgr, xenl, -- cols#80, it#8, lines#24, ncv@, -- acsc=``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -- bel=^G, bold=\E[1m, cbt=\E[Z, civis=\E[?25l, -- clear=\E[H\E[2J, cnorm=\E[?25h, cr=^M, -- csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, -- cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, -- cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, -- dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, -- ech=\E[%p1%dX, ed=\E[J, el=\E[K, el1=\E[1K, enacs=\E(B\E)0, -- flash=\E[?5h$<100/>\E[?5l, home=\E[H, hpa=\E[%i%p1%dG, -- ht=^I, hts=\EH, ich=\E[%p1%d@, ich1=\E[@, il=\E[%p1%dL, -- il1=\E[L, ind=^J, -- is2=\E7\E[r\E[m\E[?7h\E[?1;3;4;6l\E[4l\E8\E>, -- kbeg=\EOE, kbs=^H, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, -- kcuu1=\EOA, kdch1=\177, kend=\EOF, kf1=\E[11~, kf10=\E[21~, -- kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, -- kf15=\E[28~, kf16=\E[29~, kf17=\E[31~, kf18=\E[32~, -- kf19=\E[33~, kf2=\E[12~, kf20=\E[34~, kf3=\E[13~, -- kf4=\E[14~, kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, -- kf9=\E[20~, kfnd=\E[1~, khome=\EOH, kich1=\E[2~, -- kmous=\E[M, knp=\E[6~, kpp=\E[5~, kslt=\E[4~, meml=\El, -- memu=\Em, rc=\E8, rev=\E[7m, ri=\EM, rmacs=^O, rmam=\E[?7l, -- rmcup=\E[2J\E[?47l\E8, rmir=\E[4l, rmkx=\E[?1l\E>, -- rmso=\E[27m, rmul=\E[24m, rs1=^O, -- rs2=\E7\E[r\E8\E[m\E[?7h\E[?1;3;4;6l\E[4l\E>, sc=\E7, -- setb=\E[4%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m, -- setf=\E[3%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m, -- sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;, -- sgr0=\E[m\017, smacs=^N, smam=\E[?7h, smcup=\E7\E[?47h, -- smir=\E[4h, smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, -- tbc=\E[3g, vpa=\E[%i%p1%dd, use=vt100+enq, -- use=ecma+color, use=vt220+keypad, - --# This is the stock xterm entry supplied with XFree86 3.3, which uses VT100 --# codes for F1-F4 except while in VT220 mode. --xterm-xf86-v33|xterm terminal emulator (XFree86 3.3 Window System), -- kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, use=xterm-xf86-v32, -+# NetBSD/FreeBSD vt220 terminal emulator console (pc keyboard & monitor) -+# termcap entries for pure VT220-Emulation and 25, 28, 35, 40, 43 and -+# 50 lines entries; 80 columns -+pcvt25|dec vt220 emulation with 25 lines, -+ cols#80, lines#25, -+ is2=\E[1;25r\E[25;1H, use=pcvtXX, -+pcvt28|dec vt220 emulation with 28 lines, -+ cols#80, lines#28, -+ is2=\E[1;28r\E[28;1H, use=pcvtXX, -+pcvt35|dec vt220 emulation with 35 lines, -+ cols#80, lines#35, -+ is2=\E[1;35r\E[35;1H, use=pcvtXX, -+pcvt40|dec vt220 emulation with 40 lines, -+ cols#80, lines#40, -+ is2=\E[1;40r\E[40;1H, use=pcvtXX, -+pcvt43|dec vt220 emulation with 43 lines, -+ cols#80, lines#43, -+ is2=\E[1;43r\E[43;1H, use=pcvtXX, -+pcvt50|dec vt220 emulation with 50 lines, -+ cols#80, lines#50, -+ is2=\E[1;50r\E[50;1H, use=pcvtXX, - --# This version was released in XFree86 3.3.3 (November 1998). --# Besides providing printer support, it exploits a new feature that allows --# xterm to use terminfo-based descriptions with the titeInhibit resource. --# -- the distribution contained incorrect khome/kend values -TD --xterm-xf86-v333|xterm terminal emulator (XFree86 3.3.3 Window System), -- mc5i, -- blink=\E[5m, ich1@, invis=\E[8m, -- is2=\E[!p\E[?3;4l\E[4l\E>, kdch1=\E[3~, kfnd@, kslt@, -- mc0=\E[i, mc4=\E[4i, mc5=\E[5i, rmcup=\E[?1047l\E[?1048l, -- rs1=\Ec, rs2=\E[!p\E[?3;4l\E[4l\E>, -- sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, -- smcup=\E[?1048h\E[?1047h, use=xterm-xf86-v33, -+# NetBSD/FreeBSD vt220 terminal emulator console (pc keyboard & monitor) -+# termcap entries for pure VT220-Emulation and 25, 28, 35, 40, 43 and -+# 50 lines entries; 132 columns -+pcvt25w|dec vt220 emulation with 25 lines and 132 cols, -+ cols#132, lines#25, -+ is2=\E[1;25r\E[25;1H, use=pcvtXX, -+pcvt28w|dec vt220 emulation with 28 lines and 132 cols, -+ cols#132, lines#28, -+ is2=\E[1;28r\E[28;1H, use=pcvtXX, -+pcvt35w|dec vt220 emulation with 35 lines and 132 cols, -+ cols#132, lines#35, -+ is2=\E[1;35r\E[35;1H, use=pcvtXX, -+pcvt40w|dec vt220 emulation with 40 lines and 132 cols, -+ cols#132, lines#40, -+ is2=\E[1;40r\E[40;1H, use=pcvtXX, -+pcvt43w|dec vt220 emulation with 43 lines and 132 cols, -+ cols#132, lines#43, -+ is2=\E[1;43r\E[43;1H, use=pcvtXX, -+pcvt50w|dec vt220 emulation with 50 lines and 132 cols, -+ cols#132, lines#50, -+ is2=\E[1;50r\E[50;1H, use=pcvtXX, - --# This version was released in XFree86 4.0. --xterm-xf86-v40|xterm terminal emulator (XFree86 4.0 Window System), -- npc, -- kDC=\E[3;5~, kEND=\EO5F, kHOM=\EO5H, kIC=\E[2;5~, -- kLFT=\EO5D, kNXT=\E[6;5~, kPRV=\E[5;5~, kRIT=\EO5C, ka1@, -- ka3@, kb2=\EOE, kc1@, kc3@, kcbt=\E[Z, kdch1=\E[3~, kend=\EOF, -- kf13=\EO2P, kf14=\EO2Q, kf15=\EO2R, kf16=\EO2S, -- kf17=\E[15;2~, kf18=\E[17;2~, kf19=\E[18;2~, -- kf20=\E[19;2~, kf21=\E[20;2~, kf22=\E[21;2~, -- kf23=\E[23;2~, kf24=\E[24;2~, kf25=\EO5P, kf26=\EO5Q, -- kf27=\EO5R, kf28=\EO5S, kf29=\E[15;5~, kf30=\E[17;5~, -- kf31=\E[18;5~, kf32=\E[19;5~, kf33=\E[20;5~, -- kf34=\E[21;5~, kf35=\E[23;5~, kf36=\E[24;5~, kf37=\EO6P, -- kf38=\EO6Q, kf39=\EO6R, kf40=\EO6S, kf41=\E[15;6~, -- kf42=\E[17;6~, kf43=\E[18;6~, kf44=\E[19;6~, -- kf45=\E[20;6~, kf46=\E[21;6~, kf47=\E[23;6~, -- kf48=\E[24;6~, khome=\EOH, rmcup=\E[?1049l, -- sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;, -- smcup=\E[?1049h, use=xterm-xf86-v333, -+# OpenBSD implements a color variation -+pcvt25-color|dec vt220 emulation with 25 lines and color, -+ cols#80, lines#25, -+ is2=\E[1;25r\E[25;1H, kf1=\EOP, kf10=\E[29~, kf11=\E[23~, -+ kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, kf15=\E[28~, -+ kf16=\E[29~, kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, -+ kf2=\EOQ, kf20=\E[34~, kf3=\EOR, kf4=\EOS, kf5=\E[17~, -+ kf6=\E[18~, kf7=\E[19~, kf8=\E[20~, kf9=\E[21~, use=pcvtXX, -+ use=ecma+color, - --# This version was released in XFree86 4.3. --xterm-xf86-v43|xterm terminal emulator (XFree86 4.3 Window System), -- kDC=\E[3;2~, kEND=\E[1;2F, kHOM=\E[1;2H, kIC=\E[2;2~, -- kLFT=\E[1;2D, kNXT=\E[6;2~, kPRV=\E[5;2~, kRIT=\E[1;2C, -- kbeg@, -- sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, -- use=xterm-xf86-v40, -+# Terminfo entries to enable the use of the ncurses library in colour on a -+# NetBSD-arm32 console (only tested on a RiscPC). -+# Created by Dave Millen <dmill@globalnet.co.uk> 22.07.98 -+# modified codes for setf/setb to setaf/setab, then to klone+color, corrected -+# typo in invis - TD -+arm100|arm100-am|Arm(RiscPC) ncurses compatible (for 640x480), -+ am, bce, msgr, xenl, xon, -+ cols#80, it#8, lines#30, -+ acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -+ bel=^G, blink=\E[5m$<2>, bold=\E[1m$<2>, -+ clear=\E[H\E[J$<50>, cr=^M, csr=\E[%i%p1%d;%p2%dr, -+ cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=^J, -+ cuf=\E[%p1%dC, cuf1=\E[C$<2>, -+ cup=\E[%i%p1%d;%p2%dH$<5>, cuu=\E[%p1%dA, -+ cuu1=\E[A$<2>, ed=\E[J$<50>, el=\E[K$<3>, el1=\E[1K$<3>, -+ enacs=\E(B\E)0, home=\E[H, ht=^I, hts=\EH, ind=^J, -+ invis=\E[8m$<2>, ka1=\E[q, ka3=\E[s, kb2=\E[r, kbs=^H, -+ kc1=\E[p, kc3=\E[n, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, -+ kcuu1=\E[A, kent=\E[M, kf0=\E[y, kf1=\E[P, kf10=\E[x, -+ kf2=\E[Q, kf3=\E[R, kf4=\E[S, kf5=\E[t, kf6=\E[u, kf7=\E[v, -+ kf8=\E[l, kf9=\E[w, rc=\E8, rev=\E[7m$<2>, ri=\EM$<5>, -+ rmacs=^O, rmam=\E[?7l, rmkx=\E[?1l\E>, rmso=\E[m$<2>, -+ rmul=\E[m$<2>, rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, -+ sc=\E7, -+ sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p7%t;8%;m%?%p9%t\016%e\017%;$<2>, -+ sgr0=\E[m\017$<2>, smacs=^N, smam=\E[?7h, smkx=\E[?1h\E=, -+ smso=\E[7m$<2>, smul=\E[4m$<2>, tbc=\E[3g, use=ecma+sgr, -+ use=klone+color, - --# This version was released in XFree86 4.4. --xterm-xf86-v44|xterm terminal emulator (XFree86 4.4 Window System), -- cnorm=\E[?12l\E[?25h, cvvis=\E[?12;25h, indn=\E[%p1%dS, -- rin=\E[%p1%dT, use=xterm-xf86-v43, -+arm100-w|arm100-wam|Arm(RiscPC) ncurses compatible (for 1024x768), -+ cols#132, lines#50, use=arm100, - --xterm-xfree86|xterm terminal emulator (XFree86), -- use=xterm-xf86-v44, -+# NetBSD/x68k console vt200 emulator. This port runs on a 68K machine -+# manufactured by Sharp for the Japenese market. -+# From Minoura Makoto <minoura@netlaputa.or.jp>, 12 May 1996 -+x68k|x68k-ite|NetBSD/x68k ITE, -+ cols#96, lines#32, -+ kclr=\E[9~, khlp=\E[28~, use=vt220, - --# This version reflects the current xterm features. --xterm-new|modern xterm terminal emulator, -- npc, -- indn=\E[%p1%dS, kDC=\E[3;2~, kEND=\E[1;2F, kHOM=\E[1;2H, -- kIC=\E[2;2~, kNXT=\E[6;2~, kPRV=\E[5;2~, kb2=\EOE, -- kcbt=\E[Z, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, -- kend=\EOF, kent=\EOM, khome=\EOH, kich1=\E[2~, kmous=\E[M, -- knp=\E[6~, kpp=\E[5~, rin=\E[%p1%dT, use=xterm+pcfkeys, -- use=xterm-basic, --# --# This fragment describes as much of XFree86 xterm's "pc-style" function --# keys as will fit into terminfo's 60 function keys. --# From ctlseqs.ms: --# Code Modifiers --# --------------------------------- --# 2 Shift --# 3 Alt --# 4 Shift + Alt --# 5 Control --# 6 Shift + Control --# 7 Alt + Control --# 8 Shift + Alt + Control --# --------------------------------- --# The meta key may also be used as a modifier in this scheme, adding another --# bit to the parameter. --xterm+pcfkeys|fragment for PC-style fkeys, -- use=xterm+app, use=xterm+pcf2, use=xterm+pcc2, -- use=xterm+pce2, -+# <tv@pobox.com>: -+# Entry for the DNARD OpenFirmware console, close to ANSI but not quite. - # --xterm+noapp|fragment with cursor keys in normal mode, -- kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kend=\E[F, -- khome=\E[H, -+# (still unfinished, but good enough so far.) -+ofcons|DNARD OpenFirmware console, -+ bw, -+ cols#80, lines#30, -+ bel=^G, blink=\2335m, bold=\2331m, clear=^L, cr=^M, -+ cub=\233%p1%dD, cub1=\233D, cud=\233%p1%dB, cud1=\233B, -+ cuf=\233%p1%dC, cuf1=\233C, cup=\233%i%p1%d;%p2%dH, -+ cuu=\233%p1%dA, cuu1=\233A, dch=\233%p1%dP, dch1=\233P, -+ dim=\2332m, dl=\233%p1%dM, dl1=\233M, ed=\233J, el=\233K, -+ flash=^G, ht=^I, ich=\233%p1%d@, ich1=\233@, il=\233%p1%dL, -+ il1=\233L, ind=^J, invis=\2338m, kbs=^H, kcub1=\233D, -+ kcud1=\233B, kcuf1=\233C, kcuu1=\233A, kdch1=\233P, -+ kf1=\2330P, kf10=\2330M, kf2=\2330Q, kf3=\2330W, -+ kf4=\2330x, kf5=\2330t, kf6=\2330u, kf7=\2330q, kf8=\2330r, -+ kf9=\2330p, knp=\233/, kpp=\233?, nel=^M^J, rev=\2337m, -+ rmso=\2330m, rmul=\2330m, -+ sgr=\2330%?%p6%t;1%;%?%p2%t;4%;%?%p4%t;5%;%?%p5%t2%;%?%p7%t8%;%?%p1%p3%|%t;7%;m, -+ sgr0=\2330m, smso=\2337m, smul=\2334m, - --xterm+app|fragment with cursor keys in application mode, -- kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kend=\EOF, -- khome=\EOH, --# --# The "PC-style" modifier scheme was introduced in xterm patch #94 (1999/3/27) --# and revised in patch #167 (2002/8/24). Some other terminal emulators copied --# the earlier scheme, as noted in the "use=" clauses in this file. -+# NetBSD "wscons" emulator in vt220 mode. -+# This entry is based on the NetBSD termcap entry, correcting the ncv value. -+# The emulator renders underlined text in red. Colors are otherwise usable. - # --# The original assignments from patch #94 for cursor-keys had some technical --# issues: -+# Testing the emulator and reading the source code (NetBSD 2.0), it appears -+# that "vt220" is inaccurate. There are a few vt220-features, but most of the -+# vt220 screens in vttest do not work with this emulator. For instance, it -+# identifies itself (primary DA response) as a vt220 with selective erase. But -+# the selective erase feature does not work. The secondary response is copied -+# from Kermit's emulation of vt220, does not correspond to actual vt220. At -+# the level of detail in a termcap, it is a passable emulator, since ECH does -+# work. Don't use it on a VMS system -TD -+wsvt25|NetBSD wscons in 25 line DEC VT220 mode, -+ bce, msgr, -+ colors#8, cols#80, it#8, lines#25, ncv#2, pairs#64, -+ civis=\E[?25l, cnorm=\E[?25h, is2=\E[r\E[25;1H, -+ kdch1=\E[3~, kend=\E[8~, kf1=\E[11~, kf10=\E[21~, -+ kf11=\E[23~, kf12=\E[24~, kf2=\E[12~, kf3=\E[13~, -+ kf4=\E[14~, kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, -+ kf9=\E[20~, khome=\E[7~, op=\E[m, rs1=\Ec, -+ setab=\E[4%p1%dm, setaf=\E[3%p1%dm, use=vt220, -+ -+wsvt25m|NetBSD wscons in 25 line DEC VT220 mode with Meta, -+ km, use=wsvt25, -+ -+# NetBSD 6.x still uses wscons, with minor changes (2014/02/22) -TD - # --# A parameter for a function-key to represent a modifier is just more --# bits. But for a cursor-key it may change the behavior of the --# application. For instance, emacs decodes the first parameter of a --# cursor-key as a repeat count. -+# TERM is by default vt100 for the console, wsvt25 for other ttys. -+# Initial testing set TERM=xterm, based on comments by developers, found too -+# many differences to continue in that path. However, test-results may be -+# useful to people curious about compatibility with xterm. - # --# A parameterized string should (really) not begin with SS3 (\EO). --# Rather, CSI (\E[) should be used. -+# Testing with tack: -+# ----------------- -+# Failed: cbt, bel, flash, cvvis, smul (color), blink, invis -+# There is color-bleeding in the color-pairs screen. -+# Attributes do not work with color -+# Failed: vpa/hpa -+# Failed: kf1-kf4, kf13-kf48, khome, kend -+# (effectively xterm-r6 for function-keys) -+# None of the function or cursor key-modifiers are encoded. -+# Console hangs in the smm/rmm test if TERM=xterm, does not show test - # --# For these reasons, the original assignments were deprecated. For --# compatibility reasons, they are still available as a setting of xterm's --# modifyCursorKeys resource. These fragments list the modified cursor-keys --# that might apply to xterm+pcfkeys with different values of that resource. --xterm+pcc3|fragment with modifyCursorKeys:3, -- kLFT=\E[>1;2D, kRIT=\E[>1;2C, kind=\E[>1;2B, -- kri=\E[>1;2A, kDN=\E[>1;2B, kDN3=\E[>1;3B, kDN4=\E[>1;4B, -- kDN5=\E[>1;5B, kDN6=\E[>1;6B, kDN7=\E[>1;7B, -- kLFT3=\E[>1;3D, kLFT4=\E[>1;4D, kLFT5=\E[>1;5D, -- kLFT6=\E[>1;6D, kLFT7=\E[>1;7D, kRIT3=\E[>1;3C, -- kRIT4=\E[>1;4C, kRIT5=\E[>1;5C, kRIT6=\E[>1;6C, -- kRIT7=\E[>1;7C, kUP=\E[>1;2A, kUP3=\E[>1;3A, -- kUP4=\E[>1;4A, kUP5=\E[>1;5A, kUP6=\E[>1;6A, -- kUP7=\E[>1;7A, -- --xterm+pcc2|fragment with modifyCursorKeys:2, -- kLFT=\E[1;2D, kRIT=\E[1;2C, kind=\E[1;2B, kri=\E[1;2A, -- kDN=\E[1;2B, kDN3=\E[1;3B, kDN4=\E[1;4B, kDN5=\E[1;5B, -- kDN6=\E[1;6B, kDN7=\E[1;7B, kLFT3=\E[1;3D, kLFT4=\E[1;4D, -- kLFT5=\E[1;5D, kLFT6=\E[1;6D, kLFT7=\E[1;7D, -- kRIT3=\E[1;3C, kRIT4=\E[1;4C, kRIT5=\E[1;5C, -- kRIT6=\E[1;6C, kRIT7=\E[1;7C, kUP=\E[1;2A, kUP3=\E[1;3A, -- kUP4=\E[1;4A, kUP5=\E[1;5A, kUP6=\E[1;6A, kUP7=\E[1;7A, -+# Testing with vttest: -+# ------------------- -+# Identifies as vt220 with selective erase -+# (however, selective erase refers to DECSCA, SPA) -+# Does not implement vt52 -+# Uses spaces to simulate double-size characters -+# Does not support 8-bit controls -+# Does not support VT220 reports -+# Does not support send/receive mode -+# Supports ECH (like rxvt) -+# Does not support DECSCA -+# Does not support any of the ISO-6429 cursor-movement -+# Does not support any of the ISO-6429 miscellaneous tests -+# (SL/SR also leave unexpected char on screen too) -+# Background does not change in menu 11.6.9 (SGR 22-27) -+# None of the xterm special features tests work -+netbsd6|NetBSD wscons in 25 line DEC VT100 mode, -+ kbs=\177, use=wsvt25, - --xterm+pcc1|fragment with modifyCursorKeys:1, -- kLFT=\E[2D, kRIT=\E[2C, kind=\E[2B, kri=\E[2A, kDN=\E[2B, -- kDN3=\E[3B, kDN4=\E[4B, kDN5=\E[5B, kDN6=\E[6B, kDN7=\E[7B, -- kLFT3=\E[3D, kLFT4=\E[4D, kLFT5=\E[5D, kLFT6=\E[6D, -- kLFT7=\E[7D, kRIT3=\E[3C, kRIT4=\E[4C, kRIT5=\E[5C, -- kRIT6=\E[6C, kRIT7=\E[7C, kUP=\E[2A, kUP3=\E[3A, -- kUP4=\E[4A, kUP5=\E[5A, kUP6=\E[6A, kUP7=\E[7A, -+# `rasterconsole' provided by 4.4BSD, NetBSD and OpenBSD on SPARC, and -+# DECstation/pmax. -+rcons|BSD rasterconsole, -+ use=sun-il, -+# Color version of above. Color currently only provided by NetBSD. -+rcons-color|BSD rasterconsole with ANSI color, -+ bce, -+ colors#8, pairs#64, -+ op=\E[m, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, use=rcons, - --xterm+pcc0|fragment with modifyCursorKeys:0, -- kLFT=\EO2D, kRIT=\EO2C, kind=\EO2B, kri=\EO2A, kDN=\EO2B, -- kDN3=\EO3B, kDN4=\EO4B, kDN5=\EO5B, kDN6=\EO6B, kDN7=\EO7B, -- kLFT3=\EO3D, kLFT4=\EO4D, kLFT5=\EO5D, kLFT6=\EO6D, -- kLFT7=\EO7D, kRIT3=\EO3C, kRIT4=\EO4C, kRIT5=\EO5C, -- kRIT6=\EO6C, kRIT7=\EO7C, kUP=\EO2A, kUP3=\EO3A, -- kUP4=\EO4A, kUP5=\EO5A, kUP6=\EO6A, kUP7=\EO7A, -+# mgterm -- MGL/MGL2, MobileGear Graphic Library -+# for PocketBSD,PocketLinux,NetBSD/{hpcmips,mac68k} -+# -- the setf/setb are probably incorrect, more likely setaf/setab -TD -+# -- compare with cons25w -+mgterm, -+ OTbs, OTpt, am, bce, bw, eo, km, msgr, npc, -+ colors#8, cols#80, it#8, lines#18, pairs#64, -+ bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, clear=\E[H\E[J, -+ cr=^M, csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, -+ cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, cuf1=\E[C, -+ cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, -+ dch=\E[%p1%dP, dch1=\E[P, dim=\E[30;1m, dl=\E[%p1%dM, -+ dl1=\E[M, ech=\E[%p1%dX, ed=\E[J, el=\E[K, el1=\E[1K, -+ home=\E[H, hpa=\E[%i%p1%d`, ht=^I, ich=\E[%p1%d@, -+ ich1=\E[@, il=\E[%p1%dL, il1=\E[L, ind=\E[S, -+ indn=\E[%p1%dS, kb2=\E[E, kbs=^H, kcbt=\E[Z, kcub1=\E[D, -+ kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=\177, kend=\E[F, -+ kf1=\E[M, kf10=\E[V, kf11=\E[W, kf12=\E[X, kf2=\E[N, -+ kf3=\E[O, kf4=\E[P, kf5=\E[Q, kf6=\E[R, kf7=\E[S, kf8=\E[T, -+ kf9=\E[U, khome=\E[H, kich1=\E[L, knp=\E[G, kpp=\E[I, -+ nel=\E[E, op=\E[x, rc=\E8, rev=\E[7m, ri=\E[T, rin=\E[%p1%dT, -+ rmso=\E[m, rs2=\E[x\E[m\Ec, sc=\E7, setb=\E[4%p1%dm, -+ setf=\E[3%p1%dm, sgr0=\E[m, smso=\E[7m, vpa=\E[%i%p1%dd, - -+#### FreeBSD console entries - # --# Here are corresponding fragments from xterm patch #216: -+# From: Andrey Chernov <ache@astral.msk.su> 29 Mar 1996 -+# Andrey Chernov maintains the FreeBSD termcap distributions. - # --xterm+pcf0|fragment with modifyFunctionKeys:0, -- kf1=\EOP, kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, -- kf13=\EO2P, kf14=\EO2Q, kf15=\EO2R, kf16=\EO2S, -- kf17=\E[15;2~, kf18=\E[17;2~, kf19=\E[18;2~, kf2=\EOQ, -- kf20=\E[19;2~, kf21=\E[20;2~, kf22=\E[21;2~, -- kf23=\E[23;2~, kf24=\E[24;2~, kf25=\EO5P, kf26=\EO5Q, -- kf27=\EO5R, kf28=\EO5S, kf29=\E[15;5~, kf3=\EOR, -- kf30=\E[17;5~, kf31=\E[18;5~, kf32=\E[19;5~, -- kf33=\E[20;5~, kf34=\E[21;5~, kf35=\E[23;5~, -- kf36=\E[24;5~, kf37=\EO6P, kf38=\EO6Q, kf39=\EO6R, -- kf4=\EOS, kf40=\EO6S, kf41=\E[15;6~, kf42=\E[17;6~, -- kf43=\E[18;6~, kf44=\E[19;6~, kf45=\E[20;6~, -- kf46=\E[21;6~, kf47=\E[23;6~, kf48=\E[24;6~, kf49=\EO3P, -- kf5=\E[15~, kf50=\EO3Q, kf51=\EO3R, kf52=\EO3S, -- kf53=\E[15;3~, kf54=\E[17;3~, kf55=\E[18;3~, -- kf56=\E[19;3~, kf57=\E[20;3~, kf58=\E[21;3~, -- kf59=\E[23;3~, kf6=\E[17~, kf60=\E[24;3~, kf61=\EO4P, -- kf62=\EO4Q, kf63=\EO4R, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, -+# Note: Users of FreeBSD 2.1.0 and older versions must either upgrade -+# or comment out the :cb: capability in the console entry. - # --xterm+pcf2|fragment with modifyFunctionKeys:2, -- kf1=\EOP, kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, -- kf13=\E[1;2P, kf14=\E[1;2Q, kf15=\E[1;2R, kf16=\E[1;2S, -- kf17=\E[15;2~, kf18=\E[17;2~, kf19=\E[18;2~, kf2=\EOQ, -- kf20=\E[19;2~, kf21=\E[20;2~, kf22=\E[21;2~, -- kf23=\E[23;2~, kf24=\E[24;2~, kf25=\E[1;5P, kf26=\E[1;5Q, -- kf27=\E[1;5R, kf28=\E[1;5S, kf29=\E[15;5~, kf3=\EOR, -- kf30=\E[17;5~, kf31=\E[18;5~, kf32=\E[19;5~, -- kf33=\E[20;5~, kf34=\E[21;5~, kf35=\E[23;5~, -- kf36=\E[24;5~, kf37=\E[1;6P, kf38=\E[1;6Q, kf39=\E[1;6R, -- kf4=\EOS, kf40=\E[1;6S, kf41=\E[15;6~, kf42=\E[17;6~, -- kf43=\E[18;6~, kf44=\E[19;6~, kf45=\E[20;6~, -- kf46=\E[21;6~, kf47=\E[23;6~, kf48=\E[24;6~, -- kf49=\E[1;3P, kf5=\E[15~, kf50=\E[1;3Q, kf51=\E[1;3R, -- kf52=\E[1;3S, kf53=\E[15;3~, kf54=\E[17;3~, -- kf55=\E[18;3~, kf56=\E[19;3~, kf57=\E[20;3~, -- kf58=\E[21;3~, kf59=\E[23;3~, kf6=\E[17~, kf60=\E[24;3~, -- kf61=\E[1;4P, kf62=\E[1;4Q, kf63=\E[1;4R, kf7=\E[18~, -- kf8=\E[19~, kf9=\E[20~, -+# Alexander Lukyanov reports: -+# I have seen FreeBSD-2.1.5R... The old el1 bug changed, but it is still there. -+# Now el1 clears not only to the line beginning, but also a large chunk -+# of previous line. But there is another bug - ech does not work at all. - # --# Chunks from xterm #230: --xterm+pce2|fragment with modifyCursorKeys:2, -- kDC=\E[3;2~, kEND=\E[1;2F, kHOM=\E[1;2H, kIC=\E[2;2~, -- kNXT=\E[6;2~, kPRV=\E[5;2~, kich1=\E[2~, knp=\E[6~, -- kpp=\E[5~, kDC3=\E[3;3~, kDC4=\E[3;4~, kDC5=\E[3;5~, -- kDC6=\E[3;6~, kDC7=\E[3;7~, kEND3=\E[1;3F, kEND4=\E[1;4F, -- kEND5=\E[1;5F, kEND6=\E[1;6F, kEND7=\E[1;7F, -- kHOM3=\E[1;3H, kHOM4=\E[1;4H, kHOM5=\E[1;5H, -- kHOM6=\E[1;6H, kHOM7=\E[1;7H, kIC3=\E[2;3~, kIC4=\E[2;4~, -- kIC5=\E[2;5~, kIC6=\E[2;6~, kIC7=\E[2;7~, kNXT3=\E[6;3~, -- kNXT4=\E[6;4~, kNXT5=\E[6;5~, kNXT6=\E[6;6~, -- kNXT7=\E[6;7~, kPRV3=\E[5;3~, kPRV4=\E[5;4~, -- kPRV5=\E[5;5~, kPRV6=\E[5;6~, kPRV7=\E[5;7~, -- use=xterm+edit, -- --xterm+edit|fragment for 6-key editing-keypad, -- kdch1=\E[3~, kich1=\E[2~, knp=\E[6~, kpp=\E[5~, -- use=xterm+pc+edit, -- --xterm+pc+edit|fragment for pc-style editing keypad, -- kend=\E[4~, khome=\E[1~, -- --xterm+vt+edit|fragment for vt220-style editing keypad, -- kfnd=\E[1~, kslt=\E[4~, - -+# for syscons -+# common entry without semigraphics -+# Bug: The <op> capability resets attributes. -+# Bug? The ech and el1 attributes appear to move the cursor in some cases; for -+# instance el1 does if the cursor is moved to the right margin first. Removed -+# by T.Dickey 97/5/3 (ech=\E[%p1%dX, el1=\E[1K) - # --# Those chunks use the new-style (the xterm oldFunctionKeys resource is false). --# Alternatively, the same scheme with old-style function keys as in xterm-r6 --# is shown here (because that is used in mrxvt and mlterm): --xterm+r6f2|xterm with oldFunctionKeys and modifyFunctionKeys:2, -- kf1=\E[11~, kf13=\E[11;2~, kf14=\E[12;2~, kf15=\E[13;2~, -- kf16=\E[14;2~, kf2=\E[12~, kf25=\E[11;5~, kf26=\E[12;5~, -- kf27=\E[13;5~, kf28=\E[14;5~, kf3=\E[13~, kf37=\E[11;6~, -- kf38=\E[12;6~, kf39=\E[13;6~, kf4=\E[14~, kf40=\E[14;6~, -- kf49=\E[11;3~, kf50=\E[12;3~, kf51=\E[13;3~, -- kf52=\E[14;3~, kf61=\E[11;4~, kf62=\E[12;4~, -- kf63=\E[13;4~, use=xterm+pcf2, -+# Setting colors turns off reverse; we cannot guarantee order, so use ncv. -+# Note that this disables standout with color. - # --# This chunk is used for building the VT220/Sun/PC keyboard variants. --xterm-basic|modern xterm terminal emulator - common, -- OTbs, am, bce, km, mc5i, mir, msgr, xenl, AX, -- colors#8, cols#80, it#8, lines#24, pairs#64, -- acsc=``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -- bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l, -- clear=\E[H\E[2J, cnorm=\E[?12l\E[?25h, cr=^M, -- csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, -- cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, -+# The emulator sends difference strings based on shift- and control-keys, -+# like scoansi: -+# F13-F24 are shifted F1-F12 -+# F25-F36 are control F1-F12 -+# F37-F48 are shift+control F1-F12 -+cons25w|ansiw|ansi80x25-raw|freebsd console (25-line raw mode), -+ am, bce, bw, eo, msgr, npc, -+ colors#8, cols#80, it#8, lines#25, ncv#21, pairs#64, -+ bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, clear=\E[H\E[J, -+ cnorm=\E[=0C, cr=^M, cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, -+ cud1=\E[B, cuf=\E[%p1%dC, cuf1=\E[C, - cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, -- cvvis=\E[?12;25h, dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, -- dl1=\E[M, ech=\E[%p1%dX, ed=\E[J, el=\E[K, el1=\E[1K, -- flash=\E[?5h$<100/>\E[?5l, home=\E[H, hpa=\E[%i%p1%dG, -- ht=^I, hts=\EH, ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[L, -- ind=^J, invis=\E[8m, is2=\E[!p\E[?3;4l\E[4l\E>, kbs=^H, -- kmous=\E[M, mc0=\E[i, mc4=\E[4i, mc5=\E[5i, meml=\El, -- memu=\Em, op=\E[39;49m, rc=\E8, rev=\E[7m, ri=\EM, -- rmacs=\E(B, rmam=\E[?7l, rmcup=\E[?1049l, rmir=\E[4l, -- rmkx=\E[?1l\E>, rmm=\E[?1034l, rmso=\E[27m, rmul=\E[24m, -- rs1=\Ec, rs2=\E[!p\E[?3;4l\E[4l\E>, sc=\E7, -+ cvvis=\E[=1C, dch=\E[%p1%dP, dch1=\E[P, dim=\E[30;1m, -+ dl=\E[%p1%dM, dl1=\E[M, ech=\E[%p1%dX, ed=\E[J, el=\E[K, -+ home=\E[H, hpa=\E[%i%p1%d`, ht=^I, ich=\E[%p1%d@, -+ ich1=\E[@, il=\E[%p1%dL, il1=\E[L, ind=\E[S, -+ indn=\E[%p1%dS, kb2=\E[E, kbs=^H, kcbt=\E[Z, kcub1=\E[D, -+ kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=\177, kend=\E[F, -+ kf1=\E[M, kf10=\E[V, kf11=\E[W, kf12=\E[X, kf13=\E[Y, -+ kf14=\E[Z, kf15=\E[a, kf16=\E[b, kf17=\E[c, kf18=\E[d, -+ kf19=\E[e, kf2=\E[N, kf20=\E[f, kf21=\E[g, kf22=\E[h, -+ kf23=\E[i, kf24=\E[j, kf25=\E[k, kf26=\E[l, kf27=\E[m, -+ kf28=\E[n, kf29=\E[o, kf3=\E[O, kf30=\E[p, kf31=\E[q, -+ kf32=\E[r, kf33=\E[s, kf34=\E[t, kf35=\E[u, kf36=\E[v, -+ kf37=\E[w, kf38=\E[x, kf39=\E[y, kf4=\E[P, kf40=\E[z, -+ kf41=\E[@, kf42=\E[[, kf43=\E[\\, kf44=\E[], kf45=\E[\^, -+ kf46=\E[_, kf47=\E[`, kf48=\E[{, kf5=\E[Q, kf6=\E[R, -+ kf7=\E[S, kf8=\E[T, kf9=\E[U, khome=\E[H, kich1=\E[L, -+ knp=\E[G, kpp=\E[I, nel=\E[E, op=\E[x, rc=\E8, rev=\E[7m, -+ ri=\E[T, rin=\E[%p1%dT, rmso=\E[m, rs2=\E[x\E[m\Ec, sc=\E7, - setab=\E[4%p1%dm, setaf=\E[3%p1%dm, -- setb=\E[4%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m, -- setf=\E[3%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m, -- sgr=%?%p9%t\E(0%e\E(B%;\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p7%t;8%;m, -- sgr0=\E(B\E[m, smacs=\E(0, smam=\E[?7h, smcup=\E[?1049h, -- smir=\E[4h, smkx=\E[?1h\E=, smm=\E[?1034h, smso=\E[7m, -- smul=\E[4m, tbc=\E[3g, vpa=\E[%i%p1%dd, use=vt100+enq, -- --# From: David J. MacKenzie <djm@va.pubnix.com>, 14 Nov 1997 --# In retrospect, something like xterm-r6 was intended here -TD --xterm-xi|xterm on XI Graphics Accelerated X under BSD/OS 3.1, -- rmso=\E[m, rmul=\E[m, use=xterm-xf86-v33, -- --# 16-colors is one of the variants of XFree86 3.3 xterm, updated for 4.0 (T.Dickey) --# If configured to support 88- or 256-colors (which is fairly common in 2009), --# xterm also recognizes the control sequences for initc -TD --xterm-16color|xterm with 16 colors like aixterm, -- ccc, -- initc=\E]4;%p1%d;rgb\:%p2%{255}%*%{1000}%/%2.2X/%p3%{255}%*%{1000}%/%2.2X/%p4%{255}%*%{1000}%/%2.2X\E\\, -- use=ibm+16color, use=xterm-new, -- --# 256-colors is a compile-time feature of XFree86 xterm beginning with --# patch #111 (1999/7/10) -TD --xterm+256color|xterm 256-color feature, -- ccc, -- colors#256, pairs#32767, -- initc=\E]4;%p1%d;rgb\:%p2%{255}%*%{1000}%/%2.2X/%p3%{255}%*%{1000}%/%2.2X/%p4%{255}%*%{1000}%/%2.2X\E\\, -- setab=\E[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m, -- setaf=\E[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m, -- setb@, setf@, -+ sgr=\E[0%?%p1%t;2;7%;%?%p3%t;7%;%?%p4%t;5%;%?%p5%t;30;1%;%?%p6%t;1%;m, -+ sgr0=\E[m, smso=\E[7m, vpa=\E[%i%p1%dd, -+cons25|ansis|ansi80x25|freebsd console (25-line ansi mode), -+ acsc=-\030.^Y0\333`\004a\260f\370g\361h\261i\025j\331k\277l\332m\300n\305q\304t\303u\264v\301w\302x\263y\363z\362~\371, -+ use=cons25w, -+cons25-debian|freebsd console with debian backspace (25-line ansi mode), -+ kbs=\177, kdch1=\E[3~, use=cons25, -+cons25-m|ansis-mono|ansi80x25-mono|freebsd console (25-line mono ansi mode), -+ colors@, pairs@, -+ bold@, dim@, op@, rmul=\E[m, setab@, setaf@, -+ sgr=\E[0%?%p1%t;2;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;m, -+ smul=\E[4m, use=cons25, -+cons30|ansi80x30|freebsd console (30-line ansi mode), -+ lines#30, use=cons25, -+cons30-m|ansi80x30-mono|freebsd console (30-line mono ansi mode), -+ lines#30, use=cons25-m, -+cons43|ansi80x43|freebsd console (43-line ansi mode), -+ lines#43, use=cons25, -+cons43-m|ansi80x43-mono|freebsd console (43-line mono ansi mode), -+ lines#43, use=cons25-m, -+cons50|ansil|ansi80x50|freebsd console (50-line ansi mode), -+ lines#50, use=cons25, -+cons50-m|ansil-mono|ansi80x50-mono|freebsd console (50-line mono ansi mode), -+ lines#50, use=cons25-m, -+cons60|ansi80x60|freebsd console (60-line ansi mode), -+ lines#60, use=cons25, -+cons60-m|ansi80x60-mono|freebsd console (60-line mono ansi mode), -+ lines#60, use=cons25-m, -+cons25r|pc3r|ibmpc3r|cons25-koi8-r|freebsd console w/koi8-r cyrillic, -+ acsc=-\030.^Y0\215`\004a\220f\234h\221i\025j\205k\203l\202m\204n\212q\0t\206u\207v\211w\210x\201y\230z\231~\225, -+ use=cons25w, -+cons25r-m|pc3r-m|ibmpc3r-mono|cons25-koi8r-m|freebsd console w/koi8-r cyrillic (mono), -+ colors@, pairs@, -+ op@, rmul=\E[m, setab@, setaf@, -+ sgr=\E[0%?%p1%t;2;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p5%t;30;1%;%?%p6%t;1%;m, -+ smul=\E[4m, use=cons25r, -+cons50r|cons50-koi8r|freebsd console w/koi8-r cyrillic (50 lines), -+ lines#50, use=cons25r, -+cons50r-m|cons50-koi8r-m|freebsd console w/koi8-r cyrillic (50-line mono), -+ lines#50, use=cons25r-m, -+cons60r|cons60-koi8r|freebsd console w/koi8-r cyrillic (60 lines), -+ lines#60, use=cons25r, -+cons60r-m|cons60-koi8r-m|freebsd console w/koi8-r cyrillic (60-line mono), -+ lines#60, use=cons25r-m, -+# ISO 8859-1 FreeBSD console -+cons25l1|cons25-iso8859|freebsd console w/iso 8859-1 chars, -+ acsc=+\253\,\273-\030.\031`\201a\202f\207g\210i\247j\213k\214l\215m\216n\217o\220p\221q\222r\223s\224t\225u\226v\227w\230x\231y\232z\233~\237, -+ use=cons25w, -+cons25l1-m|cons25-iso-m|freebsd console w/iso 8859-1 chars (mono), -+ colors@, pairs@, -+ bold@, dim@, op@, rmul=\E[m, setab@, setaf@, -+ sgr=\E[0%?%p1%t;2;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;m, -+ smul=\E[4m, use=cons25l1, -+cons50l1|cons50-iso8859|freebsd console w/iso 8859-1 chars (50 lines), -+ lines#50, use=cons25l1, -+cons50l1-m|cons50-iso-m|freebsd console w/iso 8859-1 chars (50-line mono), -+ lines#50, use=cons25l1-m, -+cons60l1|cons60-iso|freebsd console w/iso 8859-1 chars (60 lines), -+ lines#60, use=cons25l1, -+cons60l1-m|cons60-iso-m|freebsd console w/iso 8859-1 chars (60-line mono), -+ lines#60, use=cons25l1-m, - --# 88-colors is a compile-time feature of XFree86 xterm beginning with --# patch #115 (1999/9/18) -TD -+# Starting with FreeBSD 8, an alternative configuration for syscons is provided, -+# which is intended to be xterm-compatible. See for example -+# http://svnweb.freebsd.org/base/stable/8/sys/dev/syscons/ -+# in particular scterm-teken.c - # --# Note that the escape sequences used are the same as for 256-colors - xterm --# has a different table of default color resource values. If built for --# 256-colors, it can still handle an 88-color palette by using the initc --# capability. -+# For FreeBSD 9 and 10: -+# -------------------- -+# The /etc/ttys entries for console and other ttys are all configured to set -+# TERM=xterm. - # --# At this time (2007/7/14), except for rxvt 2.7.x, none of the other terminals --# which support the xterm+256color feature support the associated initc --# capability. So it is cancelled in the entries which use this and/or the --# xterm+256color block. -+# Testing with tack: -+# There is no VT100 line-drawing (uses +'s and -'s) -+# Shifted f1-f12 give cons25 codes, rather than xterm function-keys - # --# The default color palette for the 256- and 88-colors are different. A --# given executable will have one palette (perhaps compiled-in). If the program --# supports xterm's control sequence, it can be programmed using initc. --xterm+88color|xterm 88-color feature, -- colors#88, pairs#7744, use=xterm+256color, -+# Testing with vttest: -+# Menu 2 diamonds don't work, blink ditto, light background ditto -+# The terminal identifies itself as VT100 with AVO -+# There is no VT52 support -+# There is no doublesize character support -+# The terminal supports ECH (like rxvt) -+# The terminal does not support send/receive mode -+# The terminal supports all of the ISO-6429 cursor-movement -+# The terminal supports some of the ISO-6429 miscellaneous tests -+# (SL/SR also leave unexpected char on screen too) -+# -+# Considering cons25 as a base, the line-drawing mostly works, but is missing -+# the cells which happen to have ASCII control-character values: -+# - ^X arrow pointing up -+# . ^Y arrow pointing down -+# i ^Y lantern -+# ` ^D diamond -+# -+# Those are removed from this entry's acsc string to avoid confusion. -+# The resulting description provides correct line-drawing and function-keys -TD -+teken|syscons with teken, -+ bw@, mir, xenl, -+ acsc=0\333a\260f\370g\361h\261j\331k\277l\332m\300n\305q\304t\303u\264v\301w\302x\263y\363z\362~\371, -+ civis=\E[?25l, cnorm=\E[?25h, cvvis@, hpa=\E[%i%p1%dG, -+ hts=\EH, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, -+ kdch1=\E[3~, kend=\E[F, kent=^M, kf1=\EOP, kf10=\E[21~, -+ kf11=\E[23~, kf12=\E[24~, kf2=\EOQ, kf3=\EOR, kf4=\EOS, -+ kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, -+ khome=\E[H, kich1=\E[2~, knp=\E[6~, kpp=\E[5~, rmir=\E[4l, -+ smir=\E[4h, tbc=\E[3g, u6=\E[%i%d;%dR, u7=\E[6n, -+ u8=\E[?1;2c, u9=\E[c, vpa=\E[%i%p1%dd, use=cons25, - --# These variants of XFree86 3.9.16 xterm are built as a configure option. --xterm-256color|xterm with 256 colors, -- use=xterm+256color, use=xterm-new, --xterm-88color|xterm with 88 colors, -- use=xterm+88color, use=xterm-256color, -+#### 386BSD and BSD/OS Consoles -+# - --# These two are used to demonstrate the any-event mouse support, i.e., by --# using an extended name "XM" which tells ncurses to put the terminal into --# a special mode when initializing the xterm mouse. --xterm-1002|testing xterm-mouse, -- XM=\E[?1002%?%p1%{1}%=%th%el%;, use=xterm-new, --xterm-1003|testing xterm-mouse, -- XM=\E[?1003%?%p1%{1}%=%th%el%;, use=xterm-new, -+# This was the original 386BSD console entry (I think). -+# Some places it's named oldpc3|oldibmpc3. -+# From: Alex R.N. Wetmore <aw2t@andrew.cmu.edu> -+origpc3|origibmpc3|IBM PC 386BSD Console, -+ OTbs, am, bw, eo, xon, -+ cols#80, lines#25, -+ acsc=j\331k\277l\332m\300n\305q\304t\303u\264v\301w\302x\263, -+ bold=\E[7m, clear=\Ec, cub1=^H, cud1=\E[B, cuf1=\E[C, -+ cup=\E[%i%p1%2d;%p2%2dH, cuu1=\E[A, ed=\E[J, el=\E[K, -+ home=\E[H, ind=\E[S, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, -+ kcuu1=\E[A, khome=\E[Y, ri=\E[T, rmso=\E[1;0x\E[2;7x, -+ rmul=\E[1;0x\E[2;7x, sgr0=\E[m\E[1;0x\E[2;7x, -+ smso=\E[1;7x\E[2;0x, smul=\E[1;7x\E[2;0x, - --# This is another variant, for XFree86 4.0 xterm (T.Dickey) --# This is an 8-bit version of xterm, which emulates DEC vt220 with ANSI color. --# To use it, your decTerminalID resource must be set to 200 or above. --# --# HTS \E H \210 --# RI \E M \215 --# SS3 \E O \217 --# CSI \E [ \233 --# --xterm-8bit|xterm terminal emulator 8-bit controls (X Window System), -- OTbs, am, bce, km, mc5i, mir, msgr, npc, xenl, AX, -- colors#8, cols#80, it#8, lines#24, pairs#64, -- acsc=``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -- bel=^G, blink=\2335m, bold=\2331m, cbt=\233Z, -- civis=\233?25l, clear=\233H\2332J, -- cnorm=\233?25l\233?25h, cr=^M, csr=\233%i%p1%d;%p2%dr, -- cub=\233%p1%dD, cub1=^H, cud=\233%p1%dB, cud1=^J, -- cuf=\233%p1%dC, cuf1=\233C, cup=\233%i%p1%d;%p2%dH, -- cuu=\233%p1%dA, cuu1=\233A, cvvis=\233?12;25h, -- dch=\233%p1%dP, dch1=\233P, dl=\233%p1%dM, dl1=\233M, -- ech=\233%p1%dX, ed=\233J, el=\233K, el1=\2331K, -- flash=\233?5h$<100/>\233?5l, home=\233H, -- hpa=\233%i%p1%dG, ht=^I, hts=\210, ich=\233%p1%d@, -- il=\233%p1%dL, il1=\233L, ind=^J, invis=\2338m, -- is2=\E[62"p\E G\233m\233?7h\E>\E7\233?1;3;4;6l\2334l\233r\E8, -- ka1=\217w, ka3=\217u, kb2=\217y, kbeg=\217E, kbs=^H, -- kc1=\217q, kc3=\217s, kcbt=\233Z, kcub1=\217D, kcud1=\217B, -- kcuf1=\217C, kcuu1=\217A, kdch1=\2333~, kend=\2334~, -- kent=\217M, kf1=\23311~, kf10=\23321~, kf11=\23323~, -- kf12=\23324~, kf13=\23325~, kf14=\23326~, kf15=\23328~, -- kf16=\23329~, kf17=\23331~, kf18=\23332~, kf19=\23333~, -- kf2=\23312~, kf20=\23334~, kf3=\23313~, kf4=\23314~, -- kf5=\23315~, kf6=\23317~, kf7=\23318~, kf8=\23319~, -- kf9=\23320~, khome=\2331~, kich1=\2332~, kmous=\233M, -- knp=\2336~, kpp=\2335~, mc0=\233i, mc4=\2334i, mc5=\2335i, -- meml=\El, memu=\Em, op=\23339;49m, rc=\E8, rev=\2337m, -- ri=\215, rmacs=\E(B, rmam=\233?7l, rmcup=\233?1049l, -- rmir=\2334l, rmkx=\233?1l\E>, rmso=\23327m, rmul=\23324m, -- rs1=\Ec, -- rs2=\E[62"p\E G\233m\233?7h\E>\E7\233?1;3;4;6l\2334l\233r\E8, -- sc=\E7, setab=\2334%p1%dm, setaf=\2333%p1%dm, -- setb=\2334%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m, -- setf=\2333%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m, -- sgr=\2330%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p7%t;8%;m%?%p9%t\E(0%e\E(B%;, -- sgr0=\2330m\E(B, smacs=\E(0, smam=\233?7h, -- smcup=\233?1049h, smir=\2334h, smkx=\233?1h\E=, -- smso=\2337m, smul=\2334m, tbc=\2333g, u6=\233[%i%d;%dR, -- u7=\E[6n, u8=\233[?1;2c, u9=\E[c, vpa=\233%i%p1%dd, -- --xterm-hp|xterm with hpterm function keys, -- kclr=\EJ, kcub1=\ED, kcud1=\EB, kcuf1=\EC, kcuu1=\EA, -- kdch1=\EP, kend=\EF, kf1=\Ep, kf2=\Eq, kf3=\Er, kf4=\Es, -- kf5=\Et, kf6=\Eu, kf7=\Ev, kf8=\Ew, khome=\Eh, kich1=\EQ, -- knp=\ES, kpp=\ET, use=xterm-basic, -- --xterm-sco|xterm with SCO function keys, -- kbeg=\E[E, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, -- kdch1=\177, kend=\E[F, kf1=\E[M, kf10=\E[V, kf11=\E[W, -- kf12=\E[X, kf13=\E[Y, kf14=\E[Z, kf15=\E[a, kf16=\E[b, -- kf17=\E[c, kf18=\E[d, kf19=\E[e, kf2=\E[N, kf20=\E[f, -- kf21=\E[g, kf22=\E[h, kf23=\E[i, kf24=\E[j, kf25=\E[k, -- kf26=\E[l, kf27=\E[m, kf28=\E[n, kf29=\E[o, kf3=\E[O, -- kf30=\E[p, kf31=\E[q, kf32=\E[r, kf33=\E[s, kf34=\E[t, -- kf35=\E[u, kf36=\E[v, kf37=\E[w, kf38=\E[x, kf39=\E[y, -- kf4=\E[P, kf40=\E[z, kf41=\E[@, kf42=\E[[, kf43=\E[\\, -- kf44=\E[], kf45=\E[\^, kf46=\E[_, kf47=\E[`, kf48=\E[{, -- kf5=\E[Q, kf6=\E[R, kf7=\E[S, kf8=\E[T, kf9=\E[U, khome=\E[H, -- kich1=\E[L, kmous=\E[>M, knp=\E[G, kpp=\E[I, -- use=xterm-basic, -+# description of BSD/386 console emulator in version 1.0 (supplied by BSDI) -+oldpc3|oldibmpc3|old IBM PC BSD/386 Console, -+ OTbs, km, -+ lines#25, -+ bel=^G, bold=\E[=15F, cr=^M, cud1=^J, dim=\E[=8F, dl1=\E[M, -+ ht=^I, il1=\E[L, ind=^J, kbs=^H, kcub1=\E[D, kcud1=\E[B, -+ kcuf1=\E[C, kcuu1=\E[A, khome=\E[H, kich1=\E[L, kll=\E[F, -+ knp=\E[G, kpp=\E[I, nel=^M^J, sgr0=\E[=R, - --# The xterm-new description has all of the features, but is not completely --# compatible with vt220. If you are using a Sun or PC keyboard, set the --# sunKeyboard resource to true: --# + maps the editing keypad --# + interprets control-function-key as a second array of keys, so a --# 12-fkey keyboard can support vt220's 20-fkeys. --# + maps numeric keypad "+" to ",". --# + uses DEC-style control sequences for the application keypad. --# --xterm-vt220|xterm emulating vt220, -- kcbt=\E[Z, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, -- kend=\E[4~, kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, -- kf13=\E[25~, kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, -- kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, kf20=\E[34~, -- kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, -- khome=\E[1~, kich1=\E[2~, kmous=\E[M, knp=\E[6~, kpp=\E[5~, -- use=xterm+app, use=xterm+edit, use=xterm-basic, -- use=vt220+keypad, -+# Description of BSD/OS console emulator in version 1.1, 2.0, 2.1 -+# Note, the emulator supports many of the additional console features -+# listed in the iBCS2 (e.g. character-set selection) though not all -+# are described here. This entry really ought to be upgraded. -+# Also note, the console will also work with fewer lines after doing -+# "stty rows NN", e.g. to use 24 lines. -+# (Color support from Kevin Rosenberg <kevin@cyberport.com>, 2 May 1996) -+# Bug: The <op> capability resets attributes. -+bsdos-pc|IBM PC BSD/OS Console, -+ sgr=\E[0;10%?%p1%t;7%;%?%p2%t;1%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;%?%p7%t;8%;%?%p9%t;11%;m, -+ use=bsdos-pc-nobold, - --xterm-vt52|xterm emulating dec vt52, -- cols#80, it#8, lines#24, -- acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -- bel=^G, clear=\EH\EJ, cr=^M, cub1=\ED, cud1=\EB, cuf1=\EC, -- cup=\EY%p1%' '%+%c%p2%' '%+%c, cuu1=\EA, ed=\EJ, el=\EK, -- home=\EH, ht=^I, ind=^J, kbs=^H, kcub1=\ED, kcud1=\EB, -- kcuf1=\EC, kcuu1=\EA, nel=^M^J, ri=\EI, rmacs=\EG, smacs=\EF, -+bsdos-pc-nobold|BSD/OS PC console w/o bold, -+ use=klone+color, use=bsdos-pc-m, - --xterm-noapp|xterm with cursor keys in normal mode, -- rmcup@, rmkx=\E>, smcup@, smkx=\E=, use=xterm+noapp, -- use=xterm, -+bsdos-pc-m|bsdos-pc-mono|BSD/OS PC console mono, -+ OTbs, am, eo, km, xon, -+ cols#80, it#8, lines#25, -+ bel=^G, clear=\Ec, cr=^M, cub=\E[%p1%dD, cub1=^H, -+ cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, -+ cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, -+ dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[K, home=\E[H, ht=^I, -+ il=\E[%p1%dL, il1=\E[L, ind=^J, kbs=^H, kcub1=\E[D, -+ kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, khome=\E[H, kich1=\E[L, -+ kll=\E[F, knp=\E[G, kpp=\E[I, nel=^M^J, rc=\E8, sc=\E7, -+ sgr=\E[0;10%?%p1%t;7%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;%?%p7%t;8%;%?%p9%t;11%;m%?%p5%t\E[=8F%;, -+ use=klone+sgr8, - --xterm-24|vs100|xterms|xterm terminal emulator (X Window System), -- lines#24, use=xterm-old, -+# Old names for BSD/OS PC console used in releases before 4.1. -+pc3|BSD/OS on the PC Console, -+ use=bsdos-pc-nobold, -+ibmpc3|pc3-bold|BSD/OS on the PC Console with bold instead of underline, -+ use=bsdos-pc, - --# This is xterm for ncurses. --xterm|xterm terminal emulator (X Window System), -- use=xterm-new, -+# BSD/OS on the SPARC -+bsdos-sparc|Sun SPARC BSD/OS Console, -+ use=sun, - --# This entry assumes that xterm's handling of VT100 SI/SO is disabled by --# setting the vt100Graphics resource to false. --xterm-utf8|xterm with no VT100 line-drawing in UTF-8 mode, -- U8#1, use=xterm, -+# BSD/OS on the PowerPC -+bsdos-ppc|PowerPC BSD/OS Console, -+ use=bsdos-pc, - --# These entries allow access to the X titlebar and icon name as a status line. --# Note that twm (and possibly window managers descended from it such as tvtwm, --# ctwm, and vtwm) track windows by icon-name; thus, you don't want to mess --# with it. --xterm+sl|access X title line and icon name, -- hs, -- wsl#40, -- dsl=\E]0;\007, fsl=^G, tsl=\E]0;, use=xterm, --xterm+sl-twm|access X title line (pacify twm-descended window managers), -- hs, -- wsl#40, -- dsl=\E]2;\007, fsl=^G, tsl=\E]2;, use=xterm, - -+#### DEC VT52 -+# (<acsc>/<rmacs>/<smacs> capabilities aren't in DEC's official entry -- esr) - # --# The following xterm variants don't depend on your base version --# --# xterm with bold instead of underline --xterm-bold|xterm terminal emulator (X11R6 Window System) standout w/bold, -- smso=\E[7m, smul=\E[1m, use=xterm-old, --# (kterm: this had extension capabilities ":KJ:TY=ascii:" -- esr) --# (kterm should not invoke DEC Graphics as the alternate character set --# -- Kenji Rikitake) --# (proper setting of enacs, smacs, rmacs makes kterm to use DEC Graphics --# -- MATSUMOTO Shoji) --# kterm implements acsc via built-in table of X Drawable's --kterm|kterm kanji terminal emulator (X window system), -- eslok, hs, XT, -- ncv@, -- acsc=``aajjkkllmmnnooppqqrrssttuuvvwwxx~~, -- csr=\E[%i%p1%d;%p2%dr, dsl=\E[?H, enacs=, fsl=\E[?F, -- kmous=\E[M, rc=\E8, rmacs=\E(B, rmam=\E[?7l, sc=\E7, -- sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;m%?%p9%t\E(0%e\E(B%;, -- sgr0=\E[m\E(B, smacs=\E(0, smam=\E[?7h, -- tsl=\E[?E\E[?%i%p1%dT, use=xterm-r6, use=ecma+color, --kterm-color|kterm-co|kterm with ANSI colors, -- ncv@, use=kterm, use=ecma+color, --# See the note on ICH/ICH1 VERSUS RMIR/SMIR near the end of file --xterm-nic|xterm with ich/ich1 suppressed for non-curses programs, -- ich@, ich1@, use=xterm, --# From: Mark Sheppard <kimble@mistral.co.uk>, 4 May 1996 --xterm1|xterm terminal emulator ignoring the alternate screen buffer, -- rmcup@, smcup@, use=xterm, -- --# This describes the capabilities of color_xterm, an xterm variant from --# before ECMA-64 color support was folded into the main-line xterm release. --# This entry is straight from color_xterm's maintainer. --# From: Jacob Mandelson <jlm@ugcs.caltech.edu>, 09 Nov 1996 --# The README's with the distribution also say that it supports SGR 21, 24, 25 --# and 27, but they are not present in the terminfo or termcap. --color_xterm|cx|cx100|color_xterm color terminal emulator for X, -- OTbs, am, km, mir, msgr, xenl, XT, -- cols#80, it#8, lines#65, ncv@, -- acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -- bel=^G, bold=\E[1m, clear=\E[H\E[2J, cr=^M, -- csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, -- cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, -- cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, -- dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, -- el=\E[K, el1=\E[1K, enacs=\E(B\E)0, home=\E[H, ht=^I, -- ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[L, ind=^J, -- is1=\E[r\E[m\E[?7h\E[?4;6l\E[4l, kbs=^H, kcub1=\EOD, -- kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kend=\E[8~, kf1=\E[11~, -- kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf2=\E[12~, -- kf3=\E[13~, kf4=\E[14~, kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, -- kf8=\E[19~, kf9=\E[20~, khome=\E[7~, kich1=\E[2~, -- kmous=\E[M, knp=\E[6~, kpp=\E[5~, rc=\E8, rev=\E[7m, ri=\EM, -- rmacs=^O, rmam=\E[?7l, rmcup=\E>\E[?41;1r, rmir=\E[4l, -- rmso=\E[27m, rmul=\E[24m, -- rs1=\E(B\017\E[r\E[m\E[2J\E[H\E[?7h\E[?1;3;4;6l\E[4l\E<, -- sc=\E7, -- sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;, -- sgr0=\E[0m\017, smacs=^N, smam=\E[?7h, -- smcup=\E[?1;41s\E[?1;41h\E=, smir=\E[4h, smso=\E[7m, -- smul=\E[4m, use=ecma+color, use=vt220+keypad, -+# Actually (TD pointed this out at the time the acsc string was added): -+# vt52 shouldn't define full acsc since most of the cells don't match. -+# see vt100 manual page A-31. This is the list that does match: -+# f degree -+# g plus/minus -+# h right-arrow -+# k down-arrow -+# m scan-1 -+# o scan-3 -+# q scan-5 -+# s scan-7 -+# The line-drawing happens to work in several terminal emulators, but should -+# not be used as a guide to the capabilities of the vt52. Note in particular -+# that vt52 does not support line-drawing characters (the scan-X values refer -+# to a crude plotting feature) -TD -+vt52|dec vt52, -+ OTbs, -+ cols#80, it#8, lines#24, -+ acsc=+h.k0affggolpnqprrss, bel=^G, clear=\EH\EJ, cr=^M, -+ cub1=\ED, cud1=\EB, cuf1=\EC, -+ cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, ed=\EJ, -+ el=\EK, home=\EH, ht=^I, ind=^J, kbs=^H, kcub1=\ED, kcud1=\EB, -+ kcuf1=\EC, kcuu1=\EA, nel=^M^J, ri=\EI, rmacs=\EG, smacs=\EF, - --# The 'nxterm' distributed with Redhat Linux 5.2 is a slight rehack of --# xterm-sb_right-ansi-3d, which implements ANSI colors, but does not support --# SGR 39 or 49. SGR 0 does reset colors (along with everything else). This --# description is "compatible" with color_xterm, rxvt and XFree86 xterm, except --# that each of those implements the home, end, delete keys differently. -+#### DEC VT100 and compatibles - # --# Redhat Linux 6.x distributes XFree86 xterm as "nxterm", which uses bce --# colors; note that this is not compatible with the 5.2 version. --# csw (2002-05-15): make xterm-color primary instead of nxterm, to --# match XFree86's xterm.terminfo usage and prevent circular links --xterm-color|nxterm|generic color xterm, -- ncv@, -- op=\E[m, use=xterm-r6, use=klone+color, -- --# this describes the alpha-version of Gnome terminal shipped with Redhat 6.0 --gnome-rh62|Gnome terminal, -- bce, -- kdch1=\177, kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, -- use=xterm-color, -- --# GNOME Terminal 1.4.0.4 (Redhat 7.2) -+# DEC terminals from the vt100 forward are collected here. Older DEC terminals -+# and micro consoles can be found in the `obsolete' section. More details on -+# the relationship between the VT100 and ANSI X3.64/ISO 6429/ECMA-48 may be -+# found near the end of this file. - # --# This implements a subset of vt102 with a random selection of features from --# other terminals such as color and function-keys. -+# Except where noted, these entries are DEC's official terminfos. -+# Contact Bill Hedberg <hedberg@hannah.enet.dec.com> of Terminal Support -+# Engineering for more information. Updated terminfos and termcaps -+# are kept available at ftp://gatekeeper.dec.com/pub/DEC/termcaps. - # --# shift-f1 to shift-f10 are f11 to f20 -+# In October 1995 DEC sold its terminals business, including the VT and Dorio -+# line and trademark, to SunRiver Data Systems. SunRiver has since changed -+# its name to Boundless Technologies; see http://www.boundless.com. - # --# NumLock changes the application keypad to approximate vt100 keypad, except --# that there is no escape sequence matching comma (,). -+ -+# NOTE: Any VT100 emulation, whether in hardware or software, almost -+# certainly includes what DEC called the `Level 1 editing extension' codes; -+# only the very oldest VT100s lacked these and there probably aren't any of -+# those left alive. To capture these, use one of the VT102 entries. - # --# Other defects observed: --# vt100 LNM mode is not implemented. --# vt100 80/132 column mode is not implemented. --# vt100 DECALN is not implemented. --# vt100 DECSCNM mode is not implemented, so flash does not work. --# vt100 TBC (tab reset) is not implemented. --# xterm alternate screen controls do not restore cursor position properly --# it hangs in tack after running function-keys test. --gnome-rh72|GNOME Terminal, -- bce, km@, -- civis=\E[?25l, cnorm=\E[?25h, kdch1=\E[3~, kf1=\EOP, -- kf2=\EOQ, kf3=\EOR, kf4=\EOS, rmam=\E[?7l, -- sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;m%?%p9%t\016%e\017%;, -- sgr0=\E[0m\017, smam=\E[?7h, tbc@, use=xterm-color, -- --# GNOME Terminal 2.0.1 (Redhat 8.0) -+# Note that the <xenl> glitch in vt100 is not quite the same as on the Concept, -+# since the cursor is left in a different position while in the -+# weird state (concept at beginning of next line, vt100 at end -+# of this line) so all versions of vi before 3.7 don't handle -+# <xenl> right on vt100. The correct way to handle <xenl> is when -+# you output the char in column 80, immediately output CR LF -+# and then assume you are in column 1 of the next line. If <xenl> -+# is on, am should be on too. - # --# Documentation now claims it implements vt220 (which is demonstrably false). --# However, it does implement ECH, which is a vt220 feature. And there are --# workable vt100 LNM, DECALN, DECSNM modes, making it possible to display --# more of its bugs using vttest. -+# I assume you have smooth scroll off or are at a slow enough baud -+# rate that it doesn't matter (1200? or less). Also this assumes -+# that you set auto-nl to "on", if you set it off use vt100-nam -+# below. - # --# However, note that bce and msgr are broken in this release. Tabs (tbc and --# hts) are broken as well. Sometimes flash (as in xterm-new) works. -+# The padding requirements listed here are guesses. It is strongly -+# recommended that xon/xoff be enabled, as this is assumed here. - # --# kf1 and kf10 are not tested since they're assigned (hardcoded?) to menu --# operations. Shift-tab generates a distinct sequence so it can be argued --# that it implements kcbt. --gnome-rh80|GNOME Terminal, -- bce@, msgr@, -- ech=\E[%p1%dX, flash=\E[?5h$<100/>\E[?5l, kbs=\177, -- kcbt=\E^I, op=\E[39;49m, use=gnome-rh72, -- --# GNOME Terminal 2.2.1 (Redhat 9.0) -+# The vt100 uses <rs2> and <rf> rather than <is2>/<tbc>/<hts> because the -+# tab settings are in non-volatile memory and don't need to be -+# reset upon login. Also setting the number of columns glitches -+# the screen annoyingly. You can type "reset" to get them set. - # --# bce and msgr are repaired. --gnome-rh90|GNOME Terminal, -- bce, msgr, -- hpa=\E[%i%p1%dG, kDC=\E[3;2~, kLFT=\EO2D, kRIT=\EO2C, -- kb2=\E[E, kcbt=\E[Z, kend=\EOF, khome=\EOH, tbc=\E[3g, -- vpa=\E[%i%p1%dd, use=xterm+pcf0, use=xterm+pcfkeys, -- use=gnome-rh80, -- --# GNOME Terminal 2.14.2 (Fedora Core 5) --# Ed Catmur notes that gnome-terminal has recognized soft-reset since May 2002. --gnome-fc5|GNOME Terminal, -- rs1=\Ec, -- rs2=\E7\E[r\E8\E[m\E[?7h\E[!p\E[?1;3;4;6l\E[4l\E>\E[?1000l\E[?25h, -- use=ansi+enq, use=xterm+pcc0, use=gnome-rh90, -- --# GNOME Terminal 2.18.1 (2007 snapshot) -+# The VT100 series terminals have cursor ("arrows") keys which can operate -+# in two different modes: Cursor Mode and Application Mode. Cursor Mode -+# is the reset state, and is assumed to be the normal state. Application -+# Mode is the "set" state. In Cursor Mode, the cursor keys transmit -+# "Esc [ {code}" sequences, conforming to ANSI standards. In Application -+# Mode, the cursor keys transmit "Esc O <code>" sequences. Application Mode -+# was provided primarily as an aid to the porting of VT52 applications. It is -+# assumed that the cursor keys are normally in Cursor Mode, and expected that -+# applications such as vi will always transmit the <smkx> string. Therefore, -+# the definitions for the cursor keys are made to match what the terminal -+# transmits after the <smkx> string is transmitted. If the <smkx> string -+# is a null string or is not defined, then cursor keys are assumed to be in -+# "Cursor Mode", and the cursor keys definitions should match that assumption, -+# else the application may fail. It is also expected that applications will -+# always transmit the <rmkx> string to the terminal before they exit. - # --# For any "recent" version of gnome-terminal, it is futile to attempt to --# support modifiers on cursor- and keypad keys because the program usually --# is hardcoded to set $TERM to "xterm", and on startup, it builds a subset --# of the keys (which more/less correspond to the termcap values), and will --# interpret those according to the $TERM value, but others not in the --# terminfo according to some constantly changing set of hacker guidelines -TD --vte-2007|VTE in GNOME Terminal snapshot 2.18.1, -- use=xterm+pcc2, use=gnome-fc5, --gnome-2007|GNOME Terminal snapshot 2.18.1, -- use=vte-2007, -- --# GNOME Terminal 2.22.3 (2008 snapshot) -+# The VT100 series terminals have an auxiliary keypad, commonly referred to as -+# the "Numeric Keypad", because it is a cluster of numeric and function keys. -+# The Numeric Keypad which can operate in two different modes: Numeric Mode and -+# Application Mode. Numeric Mode is the reset state, and is assumed to be -+# the normal state. Application Mode is the "set" state. In Numeric Mode, -+# the numeric and punctuation keys transmit ASCII 7-bit characters, and the -+# Enter key transmits the same as the Return key (Note: the Return key -+# can be configured to send either LF (\015) or CR LF). In Application Mode, -+# all the keypad keys transmit "Esc O {code}" sequences. The PF1 - PF4 keys -+# always send the same "Esc O {code}" sequences. It is assumed that the keypad -+# is normally in Numeric Mode. If an application requires that the keypad be -+# in Application Mode then it is expected that the user, or the application, -+# will set the TERM environment variable to point to a terminfo entry which has -+# defined the <smkx> string to include the codes that switch the keypad into -+# Application Mode, and the terminfo entry will also define function key -+# fields to match the Application Mode control codes. If the <smkx> string -+# is a null string or is not defined, then the keypad is assumed to be in -+# Numeric Mode. If the <smkx> string switches the keypad into Application -+# Mode, it is expected that the <rmkx> string will contain the control codes -+# necessary to reset the keypad to "Normal" mode, and it is also expected that -+# applications which transmit the <smkx> string will also always transmit the -+# <rmkx> string to the terminal before they exit. - # --# In vttest, it claims to be a vt220 with national replacement character-sets, --# but aside from the identifier string, implements only a small fraction of --# vt220's behavior, which will make it less usable on a VMS system (unclear --# what the intent of the developer is, since the NRC feature exposed in vttest --# by this change does not work). --vte-2008|VTE in GNOME Terminal snapshot 2.22.3, -- use=vte+pcfkeys, use=vte-2007, --gnome-2008|GNOME Terminal snapshot 2.22.3, -- use=vte-2008, -- --# GNOME terminal may automatically use the contents of the "xterm" terminfo to --# supply key information which is not built into the program. With 2.22.3, --# this list is built into the program (which addresses the inadvertant use of --# random terminfo data, though using a set of values which does not correspond --# to any that xterm produces - still not solving the problem that GNOME --# terminal hardcodes the $TERM variable as "xterm"). -+# Here's a diagram of the VT100 keypad keys with their bindings. -+# The top line is the name of the key (some DEC keyboards have the keys -+# labelled somewhat differently, like GOLD instead of PF1, but this is -+# the most "official" name). The second line is the escape sequence it -+# generates in Application Keypad mode (where "$" means the ESC -+# character). The third line contains two items, first the mapping of -+# the key in terminfo, and then in termcap. -+# _______________________________________ -+# | PF1 | PF2 | PF3 | PF4 | -+# | $OP | $OQ | $OR | $OS | -+# |_kf1__k1_|_kf2__k2_|_kf3__k3_|_kf4__k4_| -+# | 7 8 9 - | -+# | $Ow | $Ox | $Oy | $Om | -+# |_kf9__k9_|_kf10_k;_|_kf0__k0_|_________| -+# | 4 | 5 | 6 | , | -+# | $Ot | $Ou | $Ov | $Ol | -+# |_kf5__k5_|_kf6__k6_|_kf7__k7_|_kf8__k8_| -+# | 1 | 2 | 3 | | -+# | $Oq | $Or | $Os | enter | -+# |_ka1__K1_|_kb2__K2_|_ka3__K3_| $OM | -+# | 0 | . | | -+# | $Op | $On | | -+# |___kc1_______K4____|_kc3__K5_|_kent_@8_| - # --# terminfo modifier code keys --# kf13-kf24 shift 2 F1 to F12 --# kf25-kf36 control 5 F1 to F12 --# kf37-kf48 shift/control 6 F1 to F12 --# kf49-kf60 alt 3 F1 to F12 --# kf61-kf63 shift-alt 4 F1 to F3 -+# Note however, that the arrangement of the 5-key ka1-kc3 do not follow the -+# terminfo guidelines. That is a compromise used to assign the remaining -+# keys on the keypad to kf5-kf0, used on older systems with legacy termcap -+# support: -+vt100+keypad|dec vt100 numeric keypad no fkeys, -+ ka1=\EOq, ka3=\EOs, kb2=\EOr, kc1=\EOp, kc3=\EOn, -+vt100+pfkeys|dec vt100 numeric keypad, -+ kent=\EOM, kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, -+ use=vt100+keypad, -+vt100+fnkeys|dec vt100 numeric keypad, -+ kf0=\EOy, kf10=\EOx, kf5=\EOt, kf6=\EOu, kf7=\EOv, kf8=\EOl, -+ kf9=\EOw, use=vt100+pfkeys, - # --# The parameters with \EO (SS3) are technically an error, since SS3 should have --# no parameters. This appears to be rote copying based on xterm+pcc0. --vte+pcfkeys|VTE's variation on xterm+pcfkeys, -- kf1=\EOP, kf13=\EO1;2P, kf14=\EO1;2Q, kf15=\EO1;2R, -- kf16=\EO1;2S, kf2=\EOQ, kf25=\EO1;5P, kf26=\EO1;5Q, -- kf27=\EO1;5R, kf28=\EO1;5S, kf3=\EOR, kf37=\EO1;6P, -- kf38=\EO1;6Q, kf39=\EO1;6R, kf4=\EOS, kf40=\EO1;6S, -- kf49=\EO1;3P, kf50=\EO1;3Q, kf51=\EO1;3R, kf52=\EO1;3S, -- kf61=\EO1;4P, kf62=\EO1;4Q, kf63=\EO1;4R, -- use=xterm+pcfkeys, --gnome+pcfkeys|VTE's variation on xterm+pcfkeys, -- use=vte+pcfkeys, -- --vte|VTE aka GNOME Terminal, -- use=vte-2008, --gnome|GNOME Terminal, -- use=vte, -- --# palette is hardcoded... --vte-256color|VTE with xterm 256-colors, -- initc@, use=xterm+256color, use=vte, --gnome-256color|GNOME Terminal with xterm 256-colors, -- use=vte-256color, -- --# XFCE Terminal 0.2.5.4beta2 -+# A better adaptation to modern keyboards such as the PC's, which have a dozen -+# function keys and the keypad 2,4,6,8 keys are labeled with arrows keys, is to -+# use the 5-key arrangement to model the arrow keys as suggested in the -+# terminfo guidelines: -+# _______________________________________ -+# | PF1 | PF2 | PF3 | PF4 | -+# | $OP | $OQ | $OR | $OS | -+# |_kf1__k1_|_kf2__k2_|_kf3__k3_|_kf4__k4_| -+# | 7 8 9 - | -+# | $Ow | $Ox | $Oy | $Om | -+# |_ka1__K1_|_________|_ka3__K3_|_________| -+# | 4 | 5 | 6 | , | -+# | $Ot | $Ou | $Ov | $Ol | -+# |_________|_kb2__K2_|_________|_________| -+# | 1 | 2 | 3 | | -+# | $Oq | $Or | $Os | enter | -+# |_kc1__K4_|_________|_kc3__K5_| $OM | -+# | 0 | . | | -+# | $Op | $On | | -+# |___________________|_________|_kent_@8_| - # --# This is based on some of the same source code, e.g., the VTE library, as --# gnome-terminal, but has fewer features, fails more screens in vttest. --# Since most of the terminfo-related behavior is due to the VTE library, --# the terminfo is the same as gnome-terminal. --xfce|Xfce Terminal, -- use=vte, -- --# Multi-Gnome-Terminal 1.6.2 -+vt220+keypad|dec vt220 numeric keypad, -+ ka1=\EOw, ka3=\EOy, kb2=\EOu, kc1=\EOq, kc3=\EOs, kent=\EOM, -+ kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, ka2=\EOx, kb1=\EOt, -+ kb3=\EOv, kc2=\EOr, - # --# This does not use VTE, and does have different behavior (compare xfce and --# gnome). --mgt|Multi GNOME Terminal, -- indn=\E[%p1%dS, rin=\E[%p1%dT, use=xterm-xf86-v333, -- --# This is kvt 0-18.7, shipped with Redhat 6.0 (though whether it supports bce --# or not is debatable). --kvt|KDE terminal, -- bce, km@, -- kdch1=\177, kend=\E[F, khome=\E[H, use=xterm-color, -- --# Konsole 1.0.1 --# (formerly known as kvt) -+vt100+enq|ncurses extension for vt100-style ENQ, -+ u8=\E[?1;2c, use=ansi+enq, -+vt102+enq|ncurses extension for vt102-style ENQ, -+ u8=\E[?6c, use=ansi+enq, - # --# This program hardcodes $TERM to 'xterm', which is not accurate. However, to --# simplify this entry (and point out why konsole isn't xterm), we base this on --# xterm-r6. The default keyboard appears to be 'linux'. -+# And here, for those of you with orphaned VT100s lacking documentation, is -+# a description of the soft switches invoked when you do `Set Up'. - # --# Notes: --# a) konsole implements several features from XFree86 xterm, though none of --# that is documented - except of course in its source code - apparently --# because its implementors are unaccustomed to reading documentation - as --# evidenced by the sparse and poorly edited documentation distributed with --# konsole. Some features such as the 1049 private mode are recognized but --# incorrectly implemented as a duplicate of the 47 private mode. --# b) even with the "vt100 (historical)" keyboard setting, the numeric keypad --# sends PC-style escapes rather than vt100. --# c) fails vttest menu 3 (Test of character sets) because it does not properly --# parse some control sequences. Also fails vttest Primary Device Attributes --# by sending a bogus code (in the source it says it's supposed to be a --# vt220, which is doubly incorrect because it does not implement vt220 --# control sequences except for a few special cases). Treat it as a --# mildly-broken vt102. --# --# Update for konsole 1.3.2: --# The 1049 private mode works (but see the other xterm screens in vttest). --# Primary Device Attributes now returns the code for a vt100 with advanced --# video option. Perhaps that's intended to be a "mildly-broken vt102". --# --# Updated for konsole 1.6.4: --# add konsole-solaris -+# Scroll 0-Jump Shifted 3 0-# -+# | 1-Smooth | 1-British pound sign -+# | Autorepeat 0-Off | Wrap Around 0-Off -+# | | 1-On | | 1-On -+# | | Screen 0-Dark Bkg | | New Line 0-Off -+# | | | 1-Light Bkg | | | 1-On -+# | | | Cursor 0-Underline | | | Interlace 0-Off -+# | | | | 1-Block | | | | 1-On -+# | | | | | | | | -+# 1 1 0 1 1 1 1 1 0 1 0 0 0 0 1 0 <--Standard Settings -+# | | | | | | | | -+# | | | Auto XON/XOFF 0-Off | | | Power 0-60 Hz -+# | | | 1-On | | | 1-50 Hz -+# | | Ansi/VT52 0-VT52 | | Bits Per Char. 0-7 Bits -+# | | 1-ANSI | | 1-8 Bits -+# | Keyclick 0-Off | Parity 0-Off -+# | 1-On | 1-On -+# Margin Bell 0-Off Parity Sense 0-Odd -+# 1-On 1-Even - # --# Updated for konsole 1.6.6: --# add control-key modifiers for function-keys, etc. -+# The following SET-UP modes are assumed for normal operation: -+# ANSI_MODE AUTO_XON/XOFF_ON NEWLINE_OFF 80_COLUMNS -+# WRAP_AROUND_ON JUMP_SCROLL_OFF -+# Other SET-UP modes may be set for operator convenience or communication -+# requirements; I recommend -+# AUTOREPEAT_ON BLOCK_CURSOR MARGIN_BELL_OFF SHIFTED_3_# -+# Unless you have a graphics add-on such as Digital Engineering's VT640 -+# (and even then, whenever it can be arranged!) you should set -+# INTERLACE_OFF - # --# vttest menu 1 shows that both konsole and gnome terminal do wrapping --# different from xterm (and vt100's). They have the same behavior in this --# detail, but it is unclear which copies the other. --konsole-base|KDE console window, -- bce, km@, npc, XT, -- ncv@, -- bel@, blink=\E[5m, civis=\E[?25l, cnorm=\E[?25h, -- ech=\E[%p1%dX, flash=\E[?5h$<100/>\E[?5l, -- hpa=\E[%i%p1%dG, indn=\E[%p1%dS, kbs=\177, kdch1@, -- kend=\E[4~, kf1@, kf10@, kf11@, kf12@, kf13@, kf14@, kf15@, kf16@, -- kf17@, kf18@, kf19@, kf2@, kf20@, kf3@, kf4@, kf5@, kf6@, kf7@, kf8@, -- kf9@, kfnd@, khome=\E[1~, kslt@, rin=\E[%p1%dT, rmam=\E[?7l, -- rmso=\E[27m, rmul=\E[24m, -- rs2=\E7\E[r\E8\E[m\E[?7h\E[?1;3;4;6l\E[4l\E>\E[?1000l\E[?25h, -- sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;, -- sgr0=\E[0m\017, smam=\E[?7h, vpa=\E[%i%p1%dd, -- use=ecma+color, use=xterm-r6, --konsole-linux|KDE console window with linux keyboard, -- kdch1=\E[3~, kf1=\E[[A, kf10=\E[21~, kf11=\E[23~, -- kf12=\E[24~, kf13@, kf14@, kf15@, kf16@, kf17@, kf18@, kf19@, -- kf2=\E[[B, kf20@, kf3=\E[[C, kf4=\E[[D, kf5=\E[[E, -- kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, -- use=konsole-base, --konsole-solaris|KDE console window with Solaris keyboard, -- kbs=^H, kend=\E[4~, khome=\E[1~, use=konsole-vt100, --# KDE's "XFree86 3.x.x" keyboard is based on reading the xterm terminfo rather --# than testing the code. --konsole-xf3x|KDE console window with keyboard for XFree86 3.x xterm, -- kend=\E[4~, khome=\E[1~, use=konsole-vt100, --# The value for kbs reflects local customization rather than the settings used --# for XFree86 xterm. --konsole-xf4x|KDE console window with keyboard for XFree86 4.x xterm, -- kend=\EOF, khome=\EOH, use=konsole+pcfkeys, -- use=konsole-vt100, --# Konsole does not implement shifted cursor-keys. --konsole+pcfkeys|konsole subset of xterm+pcfkeys, -- kLFT@, kRIT@, kcbt=\E[Z, kind@, kri@, kDN@, kUP@, use=xterm+pcc2, -- use=xterm+pcf0, --# KDE's "vt100" keyboard has no relationship to any terminal that DEC made, but --# it is still useful for deriving the other entries. --konsole-vt100|KDE console window with vt100 (sic) keyboard, -- kbs=\177, kdch1=\E[3~, kend=\E[F, kf1=\E[11~, kf10=\E[21~, -- kf11=\E[23~, kf12=\E[24~, kf13@, kf14@, kf15@, kf16@, kf17@, -- kf18@, kf19@, kf2=\E[12~, kf20@, kf3=\E[13~, kf4=\E[14~, -- kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, -- khome=\E[H, use=konsole-base, --konsole-vt420pc|KDE console window with vt420 pc keyboard, -- kbs=^H, kdch1=\177, use=konsole-vt100, --konsole-16color|klone of xterm-16color, -- ncv#32, use=ibm+16color, use=konsole, --# make a default entry for konsole --konsole|KDE console window, -- use=konsole-xf4x, -+# (vt100: I added <rmam>/<smam> based on the init string, also <OTbs>. -- esr) -+vt100|vt100-am|dec vt100 (w/advanced video), -+ OTbs, am, mc5i, msgr, xenl, xon, -+ cols#80, it#8, lines#24, vt#3, -+ acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -+ bel=^G, blink=\E[5m$<2>, bold=\E[1m$<2>, -+ clear=\E[H\E[J$<50>, cr=^M, csr=\E[%i%p1%d;%p2%dr, -+ cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=^J, -+ cuf=\E[%p1%dC, cuf1=\E[C$<2>, -+ cup=\E[%i%p1%d;%p2%dH$<5>, cuu=\E[%p1%dA, -+ cuu1=\E[A$<2>, ed=\E[J$<50>, el=\E[K$<3>, el1=\E[1K$<3>, -+ enacs=\E(B\E)0, home=\E[H, ht=^I, hts=\EH, ind=^J, kbs=^H, -+ kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, lf1=pf1, -+ lf2=pf2, lf3=pf3, lf4=pf4, mc0=\E[0i, mc4=\E[4i, mc5=\E[5i, -+ rc=\E8, rev=\E[7m$<2>, ri=\EM$<5>, rmacs=^O, rmam=\E[?7l, -+ rmkx=\E[?1l\E>, rmso=\E[m$<2>, rmul=\E[m$<2>, -+ rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sc=\E7, -+ sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;$<2>, -+ sgr0=\E[m\017$<2>, smacs=^N, smam=\E[?7h, smkx=\E[?1h\E=, -+ smso=\E[7m$<2>, smul=\E[4m$<2>, tbc=\E[3g, -+ use=vt100+fnkeys, -+vt100nam|vt100-nam|vt100 no automargins, -+ am@, xenl@, use=vt100-am, -+vt100-vb|dec vt100 (w/advanced video) & no beep, -+ bel@, flash=\E[?5h\E[?5l, use=vt100, - --# palette is hardcoded... --konsole-256color|KDE console window with xterm 256-colors, -- initc@, use=xterm+256color, use=konsole, -+# Ordinary vt100 in 132 column ("wide") mode. -+vt100-w|vt100-w-am|dec vt100 132 cols (w/advanced video), -+ cols#132, lines#24, -+ rs2=\E>\E[?3h\E[?4l\E[?5l\E[?8h, use=vt100-am, -+vt100-w-nam|vt100-nam-w|dec vt100 132 cols (w/advanced video no automargin), -+ cols#132, lines#14, vt@, -+ rs2=\E>\E[?3h\E[?4l\E[?5l\E[?8h, use=vt100-nam, - --# This is mlterm 2.9.3's mlterm.ti, with some additions/corrections -TD --# --# It is nominally a vt102 emulator, with features borrowed from rxvt and --# xterm. --# --# The function keys are numbered based on shift/control/alt modifiers, except --# that the control-modifier itself is used to spawn a new copy of mlterm (the --# "-P" option). So control/F1 to control/F12 may not be usable, depending on --# how it is configured. --# --# kf1 to kf12 \E[11~ to \E[24~ --# shift kf1 to kf12 \E[11;2~ to \E[24;2~ --# alt kf1 to kf12 \E[11;3~ to \E[24;3~ --# shift/alt kf1 to kf12 \E[11;4~ to \E[24;4~ --# control kf1 to kf12 \E[11;5~ to \E[24;5~ (maybe) --# control/shift kf1 to kf12 \E[11;6~ to \E[24;6~ --# control/alt kf1 to kf12 \E[11;7~ to \E[24;7~ --# control/shift/alt kf1 to kf12 \E[11;8~ to \E[24;8~ --# --mlterm|multi lingual terminal emulator, -- am, eslok, km, mc5i, mir, msgr, npc, xenl, XT, -- colors#8, cols#80, it#8, lines#24, pairs#64, -- acsc=00``aaffgghhjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -- bel=^G, bold=\E[1m, cbt=\E[Z, civis=\E[?25l, -- clear=\E[H\E[2J, cnorm=\E[?25h, cr=^M, -- csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, -- cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, -- cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, -- dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, -- ech=\E[%p1%dX, ed=\E[J, el=\E[K, el1=\E[1K, enacs=, -- home=\E[H, hpa=\E[%i%p1%dG, ht=^I, hts=\EH, ich=\E[%p1%d@, -- ich1=\E[@, il=\E[%p1%dL, il1=\E[L, ind=^J, indn=\E[%p1%dS, -- is2=\E7\E[r\E[m\E[?7h\E[?1;3;4;6l\E[4l\E8\E>, -- kbs=\177, kcbt=\E[Z, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, -- kcuu1=\EOA, kdch1=\E[3~, kend=\EOF, kent=\EOM, kfnd=\E[1~, -- khome=\EOH, kich1=\E[2~, kind=\EO1;2B, kmous=\E[M, -- knp=\E[6~, kpp=\E[5~, kri=\EO1;2A, kslt=\E[4~, mc0=\E[i, -- nel=\EE, op=\E[39;49m, rc=\E8, rev=\E[7m, ri=\EM, -- rin=\E[%p1%dT, rmacs=\E(B, rmam=\E[?7l, rmcup=\E[?1049l, -- rmir=\E[4l, rmkx=\E[?1l\E>, rmso=\E[27m, rmul=\E[24m, -- rs2=\E7\E[r\E8\E[m\E[?7h\E[?1;3;4;6l\E[4l\E>\E[?1000l, -- sc=\E7, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, -- sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;m%?%p9%t\E(0%e\E(B%;, -- sgr0=\E[m\E(B, smacs=\E(0, smam=\E[?7h, smcup=\E[?1049h, -- smir=\E[4h, smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, -- tbc=\E[3g, u6=\E[%i%d;%dR, u7=\E[6n, u8=\E[?1;2c, u9=\E[c, -- vpa=\E[%i%p1%dd, use=mlterm+pcfkeys, use=xterm+r6f2, -+# vt100 with no advanced video. -+vt100-nav|vt100 without advanced video option, -+ xmc#1, -+ blink@, bold@, rev@, rmso=\E[m, rmul@, sgr@, sgr0@, smso=\E[7m, -+ smul@, use=vt100, -+vt100-nav-w|vt100-w-nav|dec vt100 132 cols 14 lines (no advanced video option), -+ cols#132, lines#14, use=vt100-nav, - --# The insert/delete/home/end keys do not respond to modifiers because mlterm --# looks in its termcap to decide which string to send. If it used terminfo --# (when available), it could use the extended names introduced for xterm. --mlterm+pcfkeys|fragment for PC-style fkeys, -- kLFT=\EO1;2D, kNXT=\E[6;2~, kPRV=\E[5;2~, kRIT=\EO1;2C, -- kDN=\EO1;2B, kDN3=\EO1;3B, kDN4=\EO1;4B, kDN5=\EO1;5B, -- kDN6=\EO1;6B, kDN7=\EO1;7B, kIC5=\E[2;5~, kIC6=\E[2;6~, -- kLFT3=\EO1;3D, kLFT4=\EO1;4D, kLFT5=\EO1;5D, -- kLFT6=\EO1;6D, kLFT7=\EO1;7D, kNXT5=\E[6;5~, -- kNXT6=\E[6;6~, kPRV5=\E[5;5~, kPRV6=\E[5;6~, -- kRIT3=\EO1;3C, kRIT4=\EO1;4C, kRIT5=\EO1;5C, -- kRIT6=\EO1;6C, kRIT7=\EO1;7C, kUP=\EO1;2A, kUP3=\EO1;3A, -- kUP4=\EO1;4A, kUP5=\EO1;5A, kUP6=\EO1;6A, kUP7=\EO1;7A, -+# vt100 with one of the 24 lines used as a status line. -+# We put the status line on the top. -+vt100-s|vt100-s-top|vt100-top-s|vt100 for use with top sysline, -+ eslok, hs, -+ lines#23, -+ clear=\E[2;1H\E[J$<50>, csr=\E[%i%i%p1%d;%p2%dr, -+ cup=\E[%i%p1%{1}%+%d;%p2%dH$<5>, dsl=\E7\E[1;24r\E8, -+ fsl=\E8, home=\E[2;1H, is2=\E7\E[2;24r\E8, -+ tsl=\E7\E[1;%p1%dH\E[1K, use=vt100-am, - --mlterm-256color|mlterm 3.0 with xterm 256-colors, -- use=xterm+256color, use=rxvt, -+# Status line at bottom. -+# Clearing the screen will clobber status line. -+vt100-s-bot|vt100-bot-s|vt100 for use with bottom sysline, -+ eslok, hs, -+ lines#23, -+ dsl=\E7\E[1;24r\E8, fsl=\E8, is2=\E[1;23r\E[23;1H, -+ tsl=\E7\E[24;%p1%dH\E[1K, use=vt100-am, - --# From: Thomas Dickey <dickey@clark.net> 04 Oct 1997 --# Updated: Oezguer Kesim <kesim@math.fu-berlin.de> 02 Nov 1997 --# Notes: --# rxvt 2.21b uses --# smacs=\E(B\E)U^N, rmacs=\E(B\E)0^O, --# but some applications don't work with that. --# It also has an AIX extension --# box2=lqkxjmwuvtn, --# and --# ech=\E[%p1%dX, --# but the latter does not work correctly. --# --# The distributed terminfo says it implements hpa and vpa, but they are not --# implemented correctly, using relative rather than absolute positioning. --# --# rxvt is normally configured to look for "xterm" or "xterm-color" as $TERM. --# Since rxvt is not really compatible with xterm, it should be configured as --# "rxvt" or "rxvt-color". --# --# removed dch/dch1 because they are inconsistent with bce/ech -TD --# remove km as per tack test -TD --rxvt-basic|rxvt terminal base (X Window System), -- OTbs, am, bce, eo, mir, msgr, xenl, xon, XT, -- cols#80, it#8, lines#24, -- acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -- bel=^G, blink=\E[5m, bold=\E[1m, civis=\E[?25l, -- clear=\E[H\E[2J, cnorm=\E[?25h, cr=^M, -- csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, -- cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, -- cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, -- dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[K, el1=\E[1K, -- enacs=\E(B\E)0, flash=\E[?5h\E[?5l, home=\E[H, ht=^I, -- hts=\EH, ich=\E[%p1%d@, ich1=\E[@, il=\E[%p1%dL, il1=\E[L, -- ind=^J, is1=\E[?47l\E=\E[?1l, -- is2=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;3;4;6l\E[4l, kbs=^H, -- kcbt=\E[Z, kmous=\E[M, rc=\E8, rev=\E[7m, ri=\EM, rmacs=^O, -- rmcup=\E[2J\E[?47l\E8, rmir=\E[4l, rmkx=\E>, rmso=\E[27m, -- rmul=\E[24m, -- rs1=\E>\E[1;3;4;5;6l\E[?7h\E[m\E[r\E[2J\E[H, -- rs2=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;3;4;6l\E[4l\E>\E[?1000l\E[?25h, -- s0ds=\E(B, s1ds=\E(0, sc=\E7, -- sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;, -- sgr0=\E[0m\017, smacs=^N, smcup=\E7\E[?47h, smir=\E[4h, -- smkx=\E=, smso=\E[7m, smul=\E[4m, tbc=\E[3g, use=vt100+enq, -- use=rxvt+pcfkeys, use=vt220+keypad, --# Key Codes from rxvt reference: --# --# Note: Shift + F1-F10 generates F11-F20 --# --# For the keypad, use Shift to temporarily override Application-Keypad --# setting use Num_Lock to toggle Application-Keypad setting if Num_Lock --# is off, escape sequences toggle Application-Keypad setting. --# Also note that values of Home, End, Delete may have been compiled --# differently on your system. --# --# Normal Shift Control Ctrl+Shift --# Tab ^I ESC [ Z ^I ESC [ Z --# BackSpace ^H ^? ^? ^? --# Find ESC [ 1 ~ ESC [ 1 $ ESC [ 1 ^ ESC [ 1 @ --# Insert ESC [ 2 ~ paste ESC [ 2 ^ ESC [ 2 @ --# Execute ESC [ 3 ~ ESC [ 3 $ ESC [ 3 ^ ESC [ 3 @ --# Select ESC [ 4 ~ ESC [ 4 $ ESC [ 4 ^ ESC [ 4 @ --# Prior ESC [ 5 ~ scroll-up ESC [ 5 ^ ESC [ 5 @ --# Next ESC [ 6 ~ scroll-down ESC [ 6 ^ ESC [ 6 @ --# Home ESC [ 7 ~ ESC [ 7 $ ESC [ 7 ^ ESC [ 7 @ --# End ESC [ 8 ~ ESC [ 8 $ ESC [ 8 ^ ESC [ 8 @ --# Delete ESC [ 3 ~ ESC [ 3 $ ESC [ 3 ^ ESC [ 3 @ --# F1 ESC [ 11 ~ ESC [ 23 ~ ESC [ 11 ^ ESC [ 23 ^ --# F2 ESC [ 12 ~ ESC [ 24 ~ ESC [ 12 ^ ESC [ 24 ^ --# F3 ESC [ 13 ~ ESC [ 25 ~ ESC [ 13 ^ ESC [ 25 ^ --# F4 ESC [ 14 ~ ESC [ 26 ~ ESC [ 14 ^ ESC [ 26 ^ --# F5 ESC [ 15 ~ ESC [ 28 ~ ESC [ 15 ^ ESC [ 28 ^ --# F6 ESC [ 17 ~ ESC [ 29 ~ ESC [ 17 ^ ESC [ 29 ^ --# F7 ESC [ 18 ~ ESC [ 31 ~ ESC [ 18 ^ ESC [ 31 ^ --# F8 ESC [ 19 ~ ESC [ 32 ~ ESC [ 19 ^ ESC [ 32 ^ --# F9 ESC [ 20 ~ ESC [ 33 ~ ESC [ 20 ^ ESC [ 33 ^ --# F10 ESC [ 21 ~ ESC [ 34 ~ ESC [ 21 ^ ESC [ 34 ^ --# F11 ESC [ 23 ~ ESC [ 23 $ ESC [ 23 ^ ESC [ 23 @ --# F12 ESC [ 24 ~ ESC [ 24 $ ESC [ 24 ^ ESC [ 24 @ --# F13 ESC [ 25 ~ ESC [ 25 $ ESC [ 25 ^ ESC [ 25 @ --# F14 ESC [ 26 ~ ESC [ 26 $ ESC [ 26 ^ ESC [ 26 @ --# F15 (Help) ESC [ 28 ~ ESC [ 28 $ ESC [ 28 ^ ESC [ 28 @ --# F16 (Menu) ESC [ 29 ~ ESC [ 29 $ ESC [ 29 ^ ESC [ 29 @ --# F17 ESC [ 31 ~ ESC [ 31 $ ESC [ 31 ^ ESC [ 31 @ --# F18 ESC [ 32 ~ ESC [ 32 $ ESC [ 32 ^ ESC [ 32 @ --# F19 ESC [ 33 ~ ESC [ 33 $ ESC [ 33 ^ ESC [ 33 @ --# F20 ESC [ 34 ~ ESC [ 34 $ ESC [ 34 ^ ESC [ 34 @ --# --# Application --# Up ESC [ A ESC [ a ESC O a ESC O A --# Down ESC [ B ESC [ b ESC O b ESC O B --# Right ESC [ C ESC [ c ESC O c ESC O C --# Left ESC [ D ESC [ d ESC O d ESC O D --# KP_Enter ^M ESC O M --# KP_F1 ESC O P ESC O P --# KP_F2 ESC O Q ESC O Q --# KP_F3 ESC O R ESC O R --# KP_F4 ESC O S ESC O S --# XK_KP_Multiply * ESC O j --# XK_KP_Add + ESC O k --# XK_KP_Separator , ESC O l --# XK_KP_Subtract - ESC O m --# XK_KP_Decimal . ESC O n --# XK_KP_Divide / ESC O o --# XK_KP_0 0 ESC O p --# XK_KP_1 1 ESC O q --# XK_KP_2 2 ESC O r --# XK_KP_3 3 ESC O s --# XK_KP_4 4 ESC O t --# XK_KP_5 5 ESC O u --# XK_KP_6 6 ESC O v --# XK_KP_7 7 ESC O w --# XK_KP_8 8 ESC O x --# XK_KP_9 9 ESC O y --# --# The source-code for rxvt actually defines mappings for F21-F35, using --# "ESC [ 35 ~" to "ESC [ 49 ~". Keyboards with more than 12 function keys --# are rare, so this entry uses the shift- and control-modifiers as in --# xterm+pcfkeys to define keys past F12. --# --# kIC is normally not used, since rxvt performs a paste for that (shifted --# insert), unless private mode 35 is set. --# --# kDN, kDN5, kDN6, etc are extensions based on the names from xterm+pcfkeys -TD --# Removed kDN6, etc (control+shift) since rxvt does not implement this -TD --rxvt+pcfkeys|fragment for PC-style fkeys, -- kDC=\E[3$, kEND=\E[8$, kHOM=\E[7$, kIC=\E[2$, kLFT=\E[d, -- kNXT=\E[6$, kPRV=\E[5$, kRIT=\E[c, kcub1=\E[D, kcud1=\E[B, -- kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[3~, kel=\E[8\^, -- kend=\E[8~, kf1=\E[11~, kf10=\E[21~, kf11=\E[23~, -- kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, kf15=\E[28~, -- kf16=\E[29~, kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, -- kf2=\E[12~, kf20=\E[34~, kf21=\E[23$, kf22=\E[24$, -- kf23=\E[11\^, kf24=\E[12\^, kf25=\E[13\^, kf26=\E[14\^, -- kf27=\E[15\^, kf28=\E[17\^, kf29=\E[18\^, kf3=\E[13~, -- kf30=\E[19\^, kf31=\E[20\^, kf32=\E[21\^, kf33=\E[23\^, -- kf34=\E[24\^, kf35=\E[25\^, kf36=\E[26\^, kf37=\E[28\^, -- kf38=\E[29\^, kf39=\E[31\^, kf4=\E[14~, kf40=\E[32\^, -- kf41=\E[33\^, kf42=\E[34\^, kf43=\E[23@, kf44=\E[24@, -- kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, -- kfnd=\E[1~, khome=\E[7~, kich1=\E[2~, kind=\E[a, knp=\E[6~, -- kpp=\E[5~, kri=\E[b, kslt=\E[4~, kDC5=\E[3\^, kDC6=\E[3@, -- kDN=\E[b, kDN5=\EOb, kEND5=\E[8\^, kEND6=\E[8@, -- kHOM5=\E[7\^, kHOM6=\E[7@, kIC5=\E[2\^, kIC6=\E[2@, -- kLFT5=\EOd, kNXT5=\E[6\^, kNXT6=\E[6@, kPRV5=\E[5\^, -- kPRV6=\E[5@, kRIT5=\EOc, kUP=\E[a, kUP5=\EOa, -+# Most of the `vt100' emulators out there actually emulate a vt102 -+# This entry (or vt102-nsgr) is probably the right thing to use for -+# these. -+vt102|dec vt102, -+ dch1=\E[P, dl1=\E[M, il1=\E[L, rmir=\E[4l, smir=\E[4h, -+ use=vt100, -+vt102-w|dec vt102 in wide mode, -+ cols#132, -+ rs3=\E[?3h, use=vt102, - --rxvt|rxvt terminal emulator (X Window System), -- ncv@, -- hpa=\E[%i%p1%dG, kf0=\E[21~, sgr0=\E[m\017, -- vpa=\E[%i%p1%dd, use=rxvt-basic, use=ecma+color, --rxvt-color|rxvt terminal emulator (X Window System), -- use=rxvt, --rxvt-256color|rxvt 2.7.9 with xterm 256-colors, -- use=xterm+256color, use=rxvt, --rxvt-88color|rxvt 2.7.9 with xterm 88-colors, -- use=xterm+88color, use=rxvt, --rxvt-xpm|rxvt terminal emulator (X Window System), -- use=rxvt, --rxvt-cygwin|rxvt terminal emulator (X Window System) on cygwin, -- acsc=+\257\,\256-\^0\333`\004a\261f\370g\361h\260j\331k\277l\332m\300n\305o~p\304q\304r\304s_t\303u\264v\301w\302x\263y\363z\362{\343|\330}\234~\376, -- use=rxvt, --rxvt-cygwin-native|rxvt terminal emulator (native MS Window System port) on cygwin, -- acsc=+\257\,\256-\^0\333`\004a\261f\370g\361h\260j\331k\277l\332m\300n\305o~p\304q\304r\304s_t\303u\264v\301w\302x\263y\363z\362{\343|\330~\376, -- use=rxvt-cygwin, -+# Many brain-dead PC comm programs that pretend to be `vt100-compatible' -+# fail to interpret the ^O and ^N escapes properly. Symptom: the <sgr0> -+# string in the canonical vt100 entry above leaves the screen littered -+# with little snowflake or star characters (IBM PC ROM character \017 = ^O) -+# after highlight turnoffs. This entry should fix that, and even leave -+# ACS support working, at the cost of making multiple-highlight changes -+# slightly more expensive. -+# From: Eric S. Raymond <esr@snark.thyrsus.com> July 22 1995 -+vt102-nsgr|vt102 no sgr (use if you see snowflakes after highlight changes), -+ sgr@, sgr0=\E[m, use=vt102, - --# This variant is supposed to work with rxvt 2.7.7 when compiled with --# NO_BRIGHTCOLOR defined. rxvt needs more work... --rxvt-16color|xterm with 16 colors like aixterm, -- ncv#32, use=ibm+16color, use=rxvt, -+# VT125 Graphics CRT. Clear screen also erases graphics -+# Some vt125's came configured with vt102 support. -+vt125|vt125 graphics terminal, -+ mir, -+ clear=\E[H\E[2J\EPpS(E)\E\\$<50>, use=vt100, - --# mrxvt 0.5.4 --# --# mrxvt is based on rxvt 2.7.11, but has by default XTERM_FKEYS defined, which --# makes its function-keys different from other flavors of rxvt -TD --mrxvt|multitabbed rxvt, -- XT, -- kEND=\E[8;2~, kHOM=\E[7;2~, kcub1=\E[D, kcud1=\E[B, -- kcuf1=\E[C, kcuu1=\E[A, kend=\E[8~, khome=\E[7~, -- kEND3=\E[8;3~, kEND4=\E[8;4~, kEND5=\E[8;5~, -- kEND6=\E[8;6~, kEND7=\E[8;7~, kHOM3=\E[7;3~, -- kHOM4=\E[7;4~, kHOM5=\E[7;5~, kHOM6=\E[7;6~, -- kHOM7=\E[7;7~, use=xterm+r6f2, use=xterm+pcfkeys, -- use=rxvt, -+# This isn't a DEC entry, it came from University of Wisconsin. -+# (vt131: I added <rmam>/<smam> based on the init string, also <OTbs> -- esr) -+vt131|dec vt131, -+ OTbs, am, xenl, -+ cols#80, it#8, lines#24, vt#3, -+ bel=^G, blink=\E[5m$<2/>, bold=\E[1m$<2/>, -+ clear=\E[;H\E[2J$<50/>, cr=^M, csr=\E[%i%p1%d;%p2%dr, -+ cub1=^H, cud1=^J, cuf1=\E[C$<2/>, -+ cup=\E[%i%p1%d;%p2%dH$<5/>, cuu1=\E[A$<2/>, -+ ed=\E[J$<50/>, el=\E[K$<3/>, home=\E[H, ht=^I, -+ is2=\E[1;24r\E[24;1H, kbs=^H, kcub1=\EOD, kcud1=\EOB, -+ kcuf1=\EOC, kcuu1=\EOA, kf1=\EOP, kf2=\EOQ, kf3=\EOR, -+ kf4=\EOS, nel=^M^J, rc=\E8, rev=\E[7m$<2/>, ri=\EM$<5/>, -+ rmam=\E[?7h, rmkx=\E[?1l\E>, rmso=\E[m$<2/>, -+ rmul=\E[m$<2/>, -+ rs1=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sc=\E7, -+ sgr0=\E[m$<2/>, smam=\E[?7h, smkx=\E[?1h\E=, -+ smso=\E[7m$<2/>, smul=\E[4m$<2/>, - --mrxvt-256color|multitabbed rxvt with 256 colors, -- use=xterm+256color, use=mrxvt, -+# vt132 - like vt100 but slower and has ins/del line and such. -+# I'm told that <smir>/<rmir> are backwards in the terminal from the -+# manual and from the ANSI standard, this describes the actual -+# terminal. I've never actually used a vt132 myself, so this -+# is untested. -+# -+vt132|DEC vt132, -+ xenl, -+ dch1=\E[P$<7>, dl1=\E[M$<99>, il1=\E[L$<99>, ind=\n$<30>, -+ ip=$<7>, rmir=\E[4h, smir=\E[4l, use=vt100, - --# From: Michael Jennings <mej@valinux.com> -+# This vt220 description maps F5--F9 to the second block of function keys -+# at the top of the keyboard. The "DO" key is used as F10 to avoid conflict -+# with the key marked (ESC) on the vt220. See vt220d for an alternate mapping. -+# PF1--PF4 are used as F1--F4. - # --# Eterm 0.9.3 -+# added msgr -TD -+vt220-old|vt200-old|DEC VT220 in vt100 emulation mode, -+ OTbs, OTpt, am, mir, msgr, xenl, xon, -+ cols#80, lines#24, vt#3, -+ OTnl=^J, -+ acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -+ bel=^G, blink=\E[5m$<2>, bold=\E[1m$<2>, civis=\E[?25l, -+ clear=\E[H\E[2J$<50>, cnorm=\E[?25h, cr=^M, -+ csr=\E[%i%p1%d;%p2%dr, cub1=^H, cud1=\E[B, cuf1=\E[C, -+ cup=\E[%i%p1%d;%p2%dH$<10>, cuu1=\E[A, dch1=\E[P, -+ dl1=\E[M, ed=\E[J$<50>, el=\E[K$<3>, home=\E[H, ht=^I, -+ if=/usr/share/tabset/vt100, il1=\E[L, ind=\ED$<20/>, -+ is2=\E[1;24r\E[24;1H, kbs=^H, kcub1=\E[D, kcud1=\E[B, -+ kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[3~, kend=\E[4~, kf1=\EOP, -+ kf10=\E[29~, kf2=\EOQ, kf3=\EOR, kf4=\EOS, kf5=\E[17~, -+ kf6=\E[18~, kf7=\E[19~, kf8=\E[20~, kf9=\E[21~, -+ khome=\E[1~, kich1=\E[2~, knp=\E[6~, kpp=\E[5~, rc=\E8, -+ rev=\E[7m$<2>, rf=/usr/share/tabset/vt100, -+ ri=\EM$<14/>, rmacs=\E(B$<4>, rmam=\E[?7l, rmir=\E[4l, -+ rmso=\E[27m, rmul=\E[24m, -+ rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sc=\E7, -+ sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p4%t;5%;%?%p1%p3%|%t;7%;m%?%p9%t\E(0%e\E(B%;$<2>, -+ sgr0=\E[m$<2>, smacs=\E(0$<2>, smam=\E[?7h, smir=\E[4h, -+ smso=\E[7m, smul=\E[4m, -+ -+# A much better description of the VT200/220; used to be vt220-8 -+# changed rmacs/smacs from shift-in/shift-out to vt200-old's explicit G0/G1 -+# designation to accommodate bug in pcvt -TD - # --# removed kf0 which conflicts with kf10 -TD --# remove cvvis which conflicts with cnorm -TD --# Eterm does not implement control/shift cursor keys such as kDN6, or kPRV/kNXT --# but does otherwise follow the rxvt+pcfkeys model -TD --# remove nonworking flash -TD --# remove km as per tack test -TD --Eterm|Eterm-color|Eterm with xterm-style color support (X Window System), -- am, bce, bw, eo, mc5i, mir, msgr, xenl, xon, XT, -- btns#5, cols#80, it#8, lines#24, lm#0, ncv@, -+# Here's a picture of the VT220 editing keypad: -+# +--------+--------+--------+ -+# | Find | Insert | Remove | -+# +--------+--------+--------+ -+# | Select | Prev | Next | -+# +--------+--------+--------+ -+vt220|vt200|dec vt220, -+ OTbs, am, mir, msgr, xenl, xon, -+ cols#80, it#8, lines#24, vt#3, - acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -- bel=^G, blink=\E[5m, bold=\E[1m, civis=\E[?25l, -- clear=\E[H\E[2J, cnorm=\E[?25h, cr=^M, -+ bel=^G, blink=\E[5m, bold=\E[1m, clear=\E[H\E[J, cr=^M, - csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, -- cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, cuf1=\E[C, -+ cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, - cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, - dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, - ech=\E[%p1%dX, ed=\E[J, el=\E[K, el1=\E[1K, enacs=\E)0, -- home=\E[H, hpa=\E[%i%p1%dG, ht=^I, hts=\EH, ich=\E[%p1%d@, -- ich1=\E[@, il=\E[%p1%dL, il1=\E[L, ind=^J, -- is1=\E[?47l\E>\E[?1l, -- is2=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;3;4;6l\E[4l, kNXT@, -- kPRV@, ka1=\E[7~, ka3=\E[5~, kb2=\EOu, kbeg=\EOu, kbs=^H, -- kc1=\E[8~, kc3=\E[6~, kent=\EOM, khlp=\E[28~, kmous=\E[M, -- mc4=\E[4i, mc5=\E[5i, rc=\E8, rev=\E[7m, ri=\EM, rmacs=^O, -- rmam=\E[?7l, rmcup=\E[2J\E[?47l\E8, rmir=\E[4l, rmkx=, -- rmso=\E[27m, rmul=\E[24m, -- rs1=\E>\E[1;3;4;5;6l\E[?7h\E[m\E[r\E[2J\E[H, -- rs2=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;3;4;6l\E[4l\E>\E[?1000l\E[?25h, -- sc=\E7, -- sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;, -- sgr0=\E[m\017, smacs=^N, smam=\E[?7h, smcup=\E7\E[?47h, -- smir=\E[4h, smkx=, smso=\E[7m, smul=\E[4m, tbc=\E[3g, -- vpa=\E[%i%p1%dd, use=vt100+enq, use=rxvt+pcfkeys, -- use=ecma+color, -- --Eterm-256color|Eterm with xterm 256-colors, -- use=xterm+256color, use=Eterm, -- --Eterm-88color|Eterm with 88 colors, -- use=xterm+88color, use=Eterm, -+ flash=\E[?5h$<200/>\E[?5l, home=\E[H, ht=^I, hts=\EH, -+ ich=\E[%p1%d@, if=/usr/share/tabset/vt100, -+ il=\E[%p1%dL, il1=\E[L, ind=\ED, -+ is2=\E[?7h\E[>\E[?1l\E F\E[?4l, kbs=^H, kcub1=\E[D, -+ kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[3~, kf1=\EOP, -+ kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, -+ kf14=\E[26~, kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, -+ kf2=\EOQ, kf20=\E[34~, kf3=\EOR, kf4=\EOS, kf6=\E[17~, -+ kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, kfnd=\E[1~, -+ khlp=\E[28~, kich1=\E[2~, knp=\E[6~, kpp=\E[5~, -+ krdo=\E[29~, kslt=\E[4~, lf1=pf1, lf2=pf2, lf3=pf3, lf4=pf4, -+ nel=\EE, rc=\E8, rev=\E[7m, ri=\EM, rmacs=\E(B$<4>, -+ rmam=\E[?7l, rmir=\E[4l, rmso=\E[27m, rmul=\E[24m, -+ rs1=\E[?3l, sc=\E7, -+ sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p4%t;5%;%?%p1%p3%|%t;7%;m%?%p9%t\E(0%e\E(B%;$<2>, -+ sgr0=\E[m\E(B, smacs=\E(0$<2>, smam=\E[?7h, smir=\E[4h, -+ smso=\E[7m, smul=\E[4m, tbc=\E[3g, use=ansi+pp, -+ use=ansi+enq, -+vt220-w|vt200-w|DEC vt220 in wide mode, -+ cols#132, -+ rs3=\E[?3h, use=vt220, -+vt220-8bit|vt220-8|vt200-8bit|vt200-8|dec vt220/200 in 8-bit mode, -+ OTbs, am, mc5i, mir, msgr, xenl, xon, -+ cols#80, it#8, lines#24, vt#3, -+ acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -+ bel=^G, blink=\2335m, bold=\2331m, clear=\233H\233J, cr=^M, -+ csr=\233%i%p1%d;%p2%dr, cub=\233%p1%dD, cub1=^H, -+ cud=\233%p1%dB, cud1=^J, cuf=\233%p1%dC, cuf1=\233C, -+ cup=\233%i%p1%d;%p2%dH, cuu=\233%p1%dA, cuu1=\233A, -+ dch=\233%p1%dP, dch1=\233P, dl=\233%p1%dM, dl1=\233M, -+ ech=\233%p1%dX, ed=\233J, el=\233K, el1=\2331K, enacs=\E)0, -+ flash=\233?5h$<200/>\233?5l, home=\233H, ht=^I, hts=\EH, -+ ich=\233%p1%d@, if=/usr/share/tabset/vt100, -+ il=\233%p1%dL, il1=\233L, ind=\ED, -+ is2=\233?7h\233>\233?1l\E F\233?4l, kbs=^H, -+ kcub1=\233D, kcud1=\233B, kcuf1=\233C, kcuu1=\233A, -+ kdch1=\2333~, kf1=\EOP, kf10=\23321~, kf11=\23323~, -+ kf12=\23324~, kf13=\23325~, kf14=\23326~, kf17=\23331~, -+ kf18=\23332~, kf19=\23333~, kf2=\EOQ, kf20=\23334~, -+ kf3=\EOR, kf4=\EOS, kf6=\23317~, kf7=\23318~, kf8=\23319~, -+ kf9=\23320~, kfnd=\2331~, khlp=\23328~, khome=\233H, -+ kich1=\2332~, knp=\2336~, kpp=\2335~, krdo=\23329~, -+ kslt=\2334~, lf1=pf1, lf2=pf2, lf3=pf3, lf4=pf4, mc0=\233i, -+ mc4=\2334i, mc5=\2335i, nel=\EE, rc=\E8, rev=\2337m, ri=\EM, -+ rmacs=\E(B, rmam=\233?7l, rmir=\2334l, rmso=\23327m, -+ rmul=\23324m, rs1=\233?3l, sc=\E7, -+ sgr=\2330%?%p6%t;1%;%?%p2%t;4%;%?%p4%t;5%;%?%p1%p3%|%t;7%;m%?%p9%t\E(0%e\E(B%;$<2>, -+ sgr0=\2330m\E(B, smacs=\E(0, smam=\233?7h, smir=\2334h, -+ smso=\2337m, smul=\2334m, tbc=\2333g, - --# Based on rxvt 2.4.8, it has a few differences in key bindings --aterm|AfterStep terminal, -- XT, -- kbs=\177, kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, use=rxvt, -+# vt220d: -+# This vt220 description regards F6--F10 as the second block of function keys -+# at the top of the keyboard. This mapping follows the description given -+# in the VT220 Programmer Reference Manual and agrees with the labeling -+# on some terminals that emulate the vt220. There is no support for an F5. -+# See vt220 for an alternate mapping. -+# -+vt220d|DEC VT220 in vt100 mode with DEC function key labeling, -+ kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, -+ kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, kf17=\E[31~, -+ kf18=\E[32~, kf19=\E[33~, kf20=\E[34~, kf5@, kf6=\E[17~, -+ kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, use=vt220-old, - --# xiterm 0.5-5.2 --# This is not based on xterm's source... --# vttest shows several problems with keyboard, cursor-movements. --# see also http://invisible-island.net/xterm/xterm.faq.html#bug_xiterm --xiterm|internationalized terminal emulator for X, -- km@, -- kbs=\177, kdch1=\E[3~, use=klone+color, use=xterm-r6, -+vt220-nam|v200-nam|VT220 in vt100 mode with no auto margins, -+ am@, -+ rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7l\E[?8h, use=vt220, - --# These (xtermc and xtermm) are distributed with Solaris. They refer to a --# variant of xterm which is apparently no longer supported, but are interesting --# because they illustrate SVr4 curses mouse controls - T.Dickey --xtermm|xterm terminal emulator (monocrome), -- OTbs, am, km, mir, msgr, xenl, -- btns#3, cols#80, it#8, lines#24, -+# vt220 termcap written Tue Oct 25 20:41:10 1988 by Alex Latzko -+# (not an official DEC entry!) -+# The problem with real vt220 terminals is they don't send escapes when in -+# in vt220 mode. This can be gotten around two ways. 1> don't send -+# escapes or 2> put the vt220 into vt100 mode and use all the nifty -+# features of vt100 advanced video which it then has. -+# -+# This entry takes the view of putting a vt220 into vt100 mode so -+# you can use the escape key in emacs and everything else which needs it. -+# -+# You probably don't want to use this on a VMS machine since VMS will think -+# it has a vt220 and will get fouled up coming out of emacs -+# -+# From: Alexander Latzko <latzko@marsenius.rutgers.edu>, 30 Dec 1996 -+# (Added vt100 <rc>,<sc> to quiet a tic warning -- esr) -+# added msgr -TD -+vt200-js|vt220-js|dec vt200 series with jump scroll, -+ am, msgr, -+ cols#80, -+ bel=^G, clear=\E[H\E[J, cr=^M, csr=\E[%i%p1%d;%p2%dr, -+ cub1=^H, cud1=^J, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, -+ cuu1=\E[A, dch1=\E[P, dl1=\E[M, ed=\E[J, el=\E[K, home=\E[H, -+ ht=^I, il1=\E[L, ind=\ED, -+ is2=\E[61"p\E[H\E[?3l\E[?4l\E[?1h\E[?5l\E[?6l\E[?7h\E[?8h\E[?25h\E>\E[m, -+ kbs=^H, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, -+ kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, nel=^M\ED, rc=\E8, -+ rf=/usr/share/tabset/vt100, ri=\EM, rmdc=, rmir=\E[4l, -+ rmkx=\E[?1l\E>, rmso=\E[27m$<5/>, rmul=\E[24m, -+ rs1=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sc=\E7, smdc=, -+ smir=\E[4h, smkx=\E[?1h\E=, smso=\E[7m$<5/>, smul=\E[4m, -+ -+# This was DEC's vt320. Use the purpose-built one below instead -+#vt320|DEC VT320 in vt100 emulation mode, -+# use=vt220, -+ -+# Use v320n for SCO's LYRIX. Otherwise, use Adam Thompson's vt320-nam. -+# -+vt320nam|v320n|DEC VT320 in vt100 emul. mode with NO AUTO WRAP mode, -+ am@, -+ rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7l\E[?8h, use=vt220, -+ -+# These entries are not DEC's official ones, they were purpose-built for the -+# VT320. Here are the designer's notes: -+# <kel> is end on a PC kbd. Actually 'select' on a VT. Mapped to -+# 'Erase to End of Field'... since nothing seems to use 'end' anyways... -+# khome is Home on a PC kbd. Actually 'FIND' on a VT. -+# Things that use <knxt> usually use tab anyways... and things that don't use -+# tab usually use <knxt> instead... -+# kprv is same as tab - Backtab is useless... -+# I left out <sgr> because of its RIDICULOUS complexity, -+# and the resulting fact that it causes the termcap translation of the entry -+# to SMASH the 1k-barrier... -+# From: Adam Thompson <athompso@pangea.ca> Sept 10 1995 -+# (vt320: uncommented <fsl> --esr) -+vt320|vt300|dec vt320 7 bit terminal, -+ am, hs, mir, msgr, xenl, -+ cols#80, lines#24, wsl#80, - acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -- bel=^G, blink@, bold=\E[1m, clear=\E[H\E[2J, cr=^M, -- csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=\E[D, -+ bel=^G, blink=\E[5m, bold=\E[1m, civis=\E[?25l, -+ clear=\E[H\E[2J, cnorm=\E[?25h, cr=^M, -+ csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, - cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, - cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, -- dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, -- el=\E[K, el1=\E[1K$<3>, enacs=\E(B\E)0, getm=\E[%p1%dY, -- home=\E[H, ht=^I, hts=\EH, ich=\E[%p1%d@, ich1=\E[@, -- il=\E[%p1%dL, il1=\E[L, ind=^J, kbs=^H, kcub1=\EOD, -- kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kend=\E[Y, kf0=\EOy, -- kf10=\EOY, kf11=\EOZ, kf12=\EOA, kf5=\EOT, kf6=\EOU, -- kf7=\EOV, kf8=\EOW, kf9=\EOX, khome=\E[H, kmous=\E[^_, -- knp=\E[U, kpp=\E[V, rc=\E8, reqmp=\E[492Z, rev=\E[7m, ri=\EM, -- rmacs=^O, rmcup=\E@0\E[?4r, rmso=\E[m, -- rs1=\E>\E[1;3;4;5;6l\E[?7h\E[m\E[r\E[2J\E[H, -- rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sc=\E7, -- sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;, -- sgr0=\E[m\017, smacs=^N, smcup=\E@0\E[?4s\E[?4h\E@1, -- smso=\E[7m, tbc=\E[3g, use=vt100+fnkeys, -- --xtermc|xterm terminal emulator (color), -- colors#8, ncv#7, pairs#64, -- op=\E[100m, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, -- setb=\E[4%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m, -- setf=\E[3%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m, -- use=xtermm, -+ dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, -+ ech=\E[%p1%dX, ed=\E[J, el=\E[K, el1=\E[1K, home=\E[H, ht=^I, -+ hts=\EH, ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[L, ind=\ED, -+ is2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h\E[1;24r\E[24;1H, -+ kbs=\177, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, -+ kdch1=\E[3~, kel=\E[4~, kf10=\E[21~, kf11=\E[23~, -+ kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, kf15=\E[28~, -+ kf16=\E[29~, kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, -+ kf20=\E[34~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, -+ kf9=\E[20~, khome=\E[1~, kich1=\E[2~, knp=\E[6~, knxt=^I, -+ kpp=\E[5~, kprv=\E[Z, kslt=\E[4~, nel=\EE, rc=\E8, rev=\E[7m, -+ rf=/usr/share/tabset/vt300, ri=\EM, rmacs=\E(B, -+ rmam=\E[?7l, rmir=\E[4l, rmkx=\E[?1l\E>, rmso=\E[m, -+ rmul=\E[m, -+ rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h\E[1;24r\E[24;1H, -+ sc=\E7, -+ sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p4%t;5%;%?%p1%p3%|%t;7%;m%?%p9%t\E(0%e\E(B%;$<2>, -+ sgr0=\E[m\E(B, smacs=\E(0, smam=\E[?7h, smir=\E[4h, -+ smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, tbc=\E[3g, -+ use=dec+pp, use=vt220+keypad, use=dec+sl, use=ansi+enq, -+vt320-nam|vt300-nam|dec vt320 7 bit terminal with no am to make SAS happy, -+ am@, -+ is2=\E>\E[?3l\E[?4l\E[?5l\E[?7l\E[?8h\E[1;24r\E[24;1H, -+ rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7l\E[?8h\E[1;24r\E[24;1H, -+ use=vt320, -+# We have to init 132-col mode, not 80-col mode. -+vt320-w|vt300-w|dec vt320 wide 7 bit terminal, -+ cols#132, wsl#132, -+ is2=\E>\E[?3h\E[?4l\E[?5l\E[?7h\E[?8h\E[1;24r\E[24;1H, -+ rs2=\E>\E[?3h\E[?4l\E[?5l\E[?7h\E[?8h\E[1;24r\E[24;1H, -+ use=vt320, -+vt320-w-nam|vt300-w-nam|dec vt320 wide 7 bit terminal with no am, -+ am@, -+ is2=\E>\E[?3h\E[?4l\E[?5l\E[?7l\E[?8h\E[1;24r\E[24;1H, -+ rs2=\E>\E[?3h\E[?4l\E[?5l\E[?7l\E[?8h\E[1;24r\E[24;1H, -+ use=vt320-w, - --# From: David J. MacKenzie <djm@va.pubnix.com> 20 Apr 1995 --# Here's a termcap entry I've been using for xterm_color, which comes --# with BSD/OS 2.0, and the X11R6 contrib tape too I think. Besides the --# color stuff, I also have a status line defined as the window manager --# title bar. [I have translated it to terminfo -- ESR] --xterm-pcolor|xterm with color used for highlights and status line, -- bold=\E[1m\E[43m, rev=\E[7m\E[34m, smso=\E[7m\E[31m, -- smul=\E[4m\E[42m, use=xterm+sl, use=xterm-r6, -+# VT330 and VT340 -- These are ReGIS and SIXEL graphics terminals -+# which are pretty much a superset of the VT320. They have the -+# host writable status line, yet another different DRCS matrix size, -+# and such, but they add the DEC Technical character set, Multiple text -+# pages, selectable length pages, and the like. The difference between -+# the vt330 and vt340 is that the latter has only 2 planes and a monochrome -+# monitor, the former has 4 planes and a color monitor. These terminals -+# support VT131 and ANSI block mode, but as with much of these things, -+# termcap/terminfo doesn't deal with these features. -+# -+# Note that this entry is are set up in what was the standard way for GNU -+# Emacs v18 terminal modes to deal with the cursor keys in that the arrow -+# keys were switched into application mode at the same time the numeric pad -+# is switched into application mode. This changes the definitions of the -+# arrow keys. Emacs v19 is smarter and mines its keys directly out of -+# your termcap or terminfo entry, -+# -+# From: Daniel Glasser <dag@persoft.persoft.com>, 13 Oct 1993 -+# (vt340: string capability "sb=\E[M" corrected to "sr"; -+# also, added <rmam>/<smam> based on the init string -- esr) -+vt340|dec-vt340|vt330|dec-vt330|dec vt340 graphics terminal with 24 line page, -+ am, eslok, hs, mir, msgr, xenl, xon, -+ cols#80, it#8, lines#24, vt#3, -+ acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -+ blink=\E[5m, bold=\E[1m, civis=\E[?25l, clear=\E[H\E[J, -+ cnorm=\E[?25h, cr=^M, csr=\E[%i%p1%d;%p2%dr, -+ cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=^J, -+ cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, -+ cuu=\E[%p1%dA, cuu1=\E[A, dch=\E[%p1%dP, dch1=\E[P, -+ dl=\E[%p1%dM, dl1=\E[M, dsl=\E[2$~\r\E[1$}\E[K\E[$}, -+ ed=\E[J, el=\E[K, flash=\E[?5h\E[?5l$<200/>, fsl=\E[$}, -+ home=\E[H, ht=^I, hts=\EH, ich=\E[%p1%d@, il=\E[%p1%dL, -+ il1=\E[L, ind=\ED, -+ is2=\E<\E F\E>\E[?1h\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h\E[1;24r\E[24;1H, -+ kbs=^H, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, -+ kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, kf6=\E[17~, -+ kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, lf1=pf1, lf2=pf2, -+ lf3=pf3, lf4=pf4, nel=^M\ED, rc=\E8, rev=\E[7m, -+ rf=/usr/share/tabset/vt300, ri=\EM, rmacs=\E(B, -+ rmam=\E[?7l, rmir=\E[4l, rmkx=\E[?1l\E>, rmso=\E[27m, -+ rmul=\E[24m, rs1=\E[?3l, sc=\E7, -+ sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p4%t;5%;%?%p1%p3%|%t;7%;m%?%p9%t\E(0%e\E(B%;$<2>, -+ sgr0=\E[m\E(B, smacs=\E(0, smam=\E[?7h, smir=\E[4h, -+ smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, tbc=\E[3g, -+ tsl=\E[2$~\E[1$}\E[1;%dH, - --# HP ships this (HPUX 9 and 10), except for the pb#9600 which was merged in --# from BSD termcap. (hpterm: added empty <acsc>, we have no idea what ACS --# chars look like --esr) --hpterm|X-hpterm|hp X11 terminal emulator, -- am, da, db, mir, xhp, -- cols#80, lh#2, lines#24, lm#0, lw#8, nlab#8, pb#9600, xmc#0, -- acsc=, bel=^G, bold=\E&dB, cbt=\Ei, clear=\E&a0y0C\EJ, cr=^M, -- cub1=^H, cud1=\EB, cuf1=\EC, cup=\E&a%p1%dy%p2%dC, -- cuu1=\EA, dch1=\EP, dim=\E&dH, dl1=\EM, ed=\EJ$<1>, el=\EK, -- hpa=\E&a%p1%dC, ht=^I, hts=\E1, il1=\EL, ind=^J, kbs=^H, -- kclr=\EJ, kctab=\E2, kcub1=\ED, kcud1=\EB, kcuf1=\EC, -- kcuu1=\EA, kdch1=\EP, kdl1=\EM, ked=\EJ, kel=\EK, kf1=\Ep, -- kf2=\Eq, kf3=\Er, kf4=\Es, kf5=\Et, kf6=\Eu, kf7=\Ev, kf8=\Ew, -- khome=\Eh, khts=\E1, kich1=\EQ, kil1=\EL, kind=\ES, kll=\EF, -- knp=\EU, kpp=\EV, kri=\ET, krmir=\ER, ktbc=\E3, meml=\El, -- memu=\Em, pfkey=\E&f%p1%dk%p2%l%dL%p2%s, -- pfloc=\E&f1a%p1%dk%p2%l%dL%p2%s, -- pfx=\E&f2a%p1%dk%p2%l%dL%p2%s, -- pln=\E&f%p1%dk%p2%l%dd0L%p2%s, rev=\E&dB, ri=\ET, -- rmacs=^O, rmir=\ER, rmkx=\E&s0A, rmln=\E&j@, rmso=\E&d@, -- rmul=\E&d@, -- sgr=\E&d%?%p7%t%{115}%c%;%p1%p3%|%p6%|%{2}%*%p2%{4}%*%+%p4%+%p5%{8}%*%+%{64}%+%c%?%p9%t%'\016'%c%e%'\017'%c%;, -- sgr0=\E&d@, smacs=^N, smir=\EQ, smkx=\E&s1A, smln=\E&jB, -- smso=\E&dJ, smul=\E&dD, tbc=\E3, vpa=\E&a%p1%dY, --# HPUX 11 provides a color version. --hpterm-color|HP X11 terminal emulator with color, -- ccc, -- colors#64, pairs#8, -- home=\E&a0y0C, -- initp=\E&v%p2%da%p3%db%p4%dc%p5%dx%p6%dy%p7%dz%p1%dI, -- op=\E&v0S, scp=\E&v%p1%dS, use=hpterm, -- --# This entry describes an xterm with Sun-style function keys enabled --# via the X resource setting "xterm*sunFunctionKeys:true" --# To understand <kf11>/<kf12> note that L1,L2 and F11,F12 are the same. --# The <kf13>...<kf20> keys are L3-L10. We don't set <kf16=\E[197z> --# because we want it to be seen as <kcpy>. --# The <kf31>...<kf45> keys are R1-R15. We treat some of these in accordance --# with their Sun keyboard labels instead. --# From: Simon J. Gerraty <sjg@zen.void.oz.au> 10 Jan 1996 --xterm-sun|xterm with sunFunctionKeys true, -- kb2=\E[218z, kcpy=\E[197z, kcub1=\EOD, kcud1=\EOB, -- kcuf1=\EOC, kcuu1=\EOA, kdch1=\E[3z, kend=\E[220z, -- kent=\EOM, kf1=\E[224z, kf10=\E[233z, kf11=\E[192z, -- kf12=\E[193z, kf13=\E[194z, kf14=\E[195z, kf15=\E[196z, -- kf17=\E[198z, kf18=\E[199z, kf19=\E[200z, kf2=\E[225z, -- kf20=\E[201z, kf3=\E[226z, kf31=\E[208z, kf32=\E[209z, -- kf33=\E[210z, kf34=\E[211z, kf35=\E[212z, kf36=\E[213z, -- kf38=\E[215z, kf4=\E[227z, kf40=\E[217z, kf42=\E[219z, -- kf44=\E[221z, kf45=\E[222z, kf46=\E[234z, kf47=\E[235z, -- kf5=\E[228z, kf6=\E[229z, kf7=\E[230z, kf8=\E[231z, -- kf9=\E[232z, kfnd=\E[200z, khlp=\E[196z, khome=\E[214z, -- kich1=\E[2z, knp=\E[222z, kpp=\E[216z, kund=\E[195z, -- use=xterm-basic, --xterms-sun|small (80x24) xterm with sunFunctionKeys true, -- cols#80, lines#24, use=xterm-sun, -- --# This is for the extensible terminal emulator on the X11R6 contrib tape. --# It corresponds to emu's internal emulation: --# emu -term emu --# emu's default sets TERM to "xterm", but that doesn't work well -TD --# fixes: remove bogus rmacs/smacs, change oc to op, add bce, am -TD --# fixes: add civis, cnorm, sgr -TD --emu|emu native mode, -- am, bce, mir, msgr, xon, -- colors#15, cols#80, it#8, lines#24, pairs#64, vt#200, -- acsc=61a\202f\260g2j\213k\214l\215m\216n\217o\220q\222s\224t\225u\226v\227w\230x\231~\244, -- bel=^G, blink=\EW, bold=\EU, civis=\EZ, clear=\EP\EE0;0;, -- cnorm=\Ea, cr=^M, csr=\Ek%p1%d;%p2%d;, cub=\Eq-%p1%d;, -- cub1=^H, cud=\Ep%p1%d;, cud1=\EB, cuf=\Eq%p1%d;, cuf1=\EC, -- cup=\EE%p1%d;%p2%d;, cuu=\Ep-%p1%d;, cuu1=\EA, -- dch=\EI%p1%d;, dch1=\EI1;, dl=\ER%p1%d;, dl1=\ER1;, -- ech=\Ej%p1%d;, ed=\EN, el=\EK, el1=\EL, home=\EE0;0;, ht=^I, -- hts=\Eh, il=\EQ%p1%d;, il1=\EQ1;, ind=\EG, -- is2=\ES\Er0;\Es0;, kbs=^H, kcub1=\EC, kcud1=\EB, kcuf1=\ED, -- kcuu1=\EA, kdch1=\177, kent=^M, kf0=\EF00, kf1=\EF01, -- kf10=\EF10, kf11=\EF11, kf12=\EF12, kf13=\EF13, kf14=\EF14, -- kf15=\EF15, kf16=\EF16, kf17=\EF17, kf18=\EF18, kf19=\EF19, -- kf2=\EF02, kf20=\EF20, kf3=\EF03, kf4=\EF04, kf5=\EF05, -- kf6=\EF06, kf7=\EF07, kf8=\EF08, kf9=\EF09, kfnd=\Efind, -- kich1=\Eins, knp=\Enext, kpp=\Eprior, kslt=\Esel, -- op=\Es0;\Er0;, rev=\ET, ri=\EF, rmir=\EX, rmso=\ES, rmul=\ES, -- rs2=\ES\Es0;\Er0;, setab=\Es%i%p1%d;, -- setaf=\Er%i%p1%d;, -- sgr=\ES%?%p1%t\ET%;%?%p2%t\EV%;%?%p3%t\ET%;%?%p4%t\EW%;%?%p6%t\EU%;, -- sgr0=\ES, smir=\EY, smso=\ET, smul=\EV, tbc=\Ej, -- --# vt220 Terminfo entry for the Emu emulation, corresponds to --# emu -term vt220 --# with NumLock set (to make the keypad transmit kf0-kf9). --# fixes: add am, xenl, corrected sgr0 -TD --emu-220|Emu-220 (vt200-7bit mode), -- am, xenl, xon, -- cols#80, it#8, lines#24, vt#200, -- acsc=aaffggjjkkllmmnnooqqssttuuvvwwxx~~, bel=^G, -- blink=\E[0;5m, bold=\E[0;1m, civis=\E[?25l, -- clear=\E[2J\E[H, cnorm=\E[?25h, cr=^M, -- csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=\E[1D, -- cud=\E[%p1%dB, cud1=\E[1B, cuf=\E[%p1%dC, cuf1=\E[1C, -- cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[1A, -- dch=\E[%p1%dP, dch1=\E[1P, dl=\E[%p1%dM, dl1=\E[1M, -- ed=\E[0J, el=\E[0K, el1=\E[1K, enacs=\E)0, home=\E[H, ht=^I, -- hts=\EH, if=/usr/share/tabset/vt300, il=\E[%p1%dL, -- il1=\E[1L, ind=\ED, is2=\E>\E[?1l\E[?3l\E[4l\E[?7h, -- kbs=^H, kcmd=\E[29~, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, -- kcuu1=\E[A, kdch1=\E[3~, kent=\EOM, kf0=\EOp, kf1=\EOq, -- kf10=\EOl, kf11=\EOm, kf12=\EOn, kf13=\EOP, kf14=\EOQ, -- kf15=\EOR, kf16=\EOS, kf2=\EOr, kf26=\E[17~, kf27=\E[18~, -- kf28=\E[19~, kf29=\E[20~, kf3=\EOs, kf30=\E[21~, -- kf34=\E[26~, kf37=\E[31~, kf38=\E[32~, kf39=\E[33~, -- kf4=\EOt, kf40=\E[34~, kf5=\EOu, kf6=\EOv, kf7=\EOw, -- kf8=\EOx, kf9=\EOy, kfnd=\E[1~, khlp=\E[28~, kich1=\E[2~, -- knp=\E[6~, kpp=\E[5~, kslt=\E[4~, rc=\E8, rev=\E[0;7m, -- ri=\EM, rmacs=^O, rmcup=\E>, rmkx=\E>, rmso=\E[m, rmul=\E[m, -- rs2=\E[4l\E[34l\E[?1l\E[?3l\E[?5l\E[?7h, sc=\E7, -- sgr=\E[0%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p5%t;2%;%?%p6%t;1%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, -- sgr0=\E[m, smacs=^N, smcup=\E[?1l\E=, smkx=\E=, -- smso=\E[0;7m, smul=\E[0;4m, tbc=\E[3g, --# A commercial product, Reportedly a version of Xterm with an OPEN LOOK UI, --# print interface, ANSI X3.64 colour escape sequences, etc. Newsgroup postings --# indicate that it emulates more than one terminal, but incompletely. -+# DEC doesn't supply a vt400 description, so we add Daniel Glasser's -+# (originally written with vt420 as its primary name, and usable for it). - # --# This is adapted from a FreeBSD bug-report by Daniel Rudy <dcrudy@pacbell.net> --# It is based on vt102's entry, with some subtle differences, but also --# has status line --# supports ANSI colors (except for 'op' string) --# apparently implements alternate screen like xterm --# does not use padding, of course. --mvterm|vv100|SwitchTerm aka mvTERM, -- am, eslok, hs, km, mir, msgr, xenl, -- colors#8, cols#80, it#8, lines#24, pairs#64, -+# VT400/420 -- This terminal is a superset of the vt320. It adds the multiple -+# text pages and long text pages with selectable length of the vt340, along -+# with left and right margins, rectangular area text copy, fill, and erase -+# operations, selected region character attribute change operations, -+# page memory and rectangle checksums, insert/delete column, reception -+# macros, and other features too numerous to remember right now. TERMCAP -+# can only take advantage of a few of these added features. -+# -+# Note that this entry is are set up in what was the standard way for GNU -+# Emacs v18 terminal modes to deal with the cursor keys in that the arrow -+# keys were switched into application mode at the same time the numeric pad -+# is switched into application mode. This changes the definitions of the -+# arrow keys. Emacs v19 is smarter and mines its keys directly out of -+# your termcap entry, -+# -+# From: Daniel Glasser <dag@persoft.persoft.com>, 13 Oct 1993 -+# (vt400: string capability ":sb=\E[M:" corrected to ":sr=\E[M:"; -+# also, added <rmam>/<smam> based on the init string -- esr) -+vt400|vt400-24|dec-vt400|dec vt400 24x80 column autowrap, -+ am, eslok, hs, mir, msgr, xenl, xon, -+ cols#80, it#8, lines#24, vt#3, - acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -- bel=^G, blink=\E[5m, bold=\E[1m, clear=\E[H\E[2J, cr=^M, -+ blink=\E[5m, bold=\E[1m, civis=\E[?25l, -+ clear=\E[H\E[J$<10/>, cnorm=\E[?25h, cr=^M, - csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, - cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, - cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, - dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, -- dsl=\E[?E, ed=\E[J, el=\E[K, el1=\E[1K$<3>, enacs=\E(B\E)0, -- fsl=\E[?F, home=\E[H, ht=^I, hts=\EH, ich=\E[%p1%d@, -- ich1=\E[@, il=\E[%p1%dL, il1=\E[L, ind=^J, kbs=^H, -- kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kf0=\EOy, -- kf10=\EOx, kf5=\EOt, kf6=\EOu, kf7=\EOv, kf8=\EOl, kf9=\EOw, -- op=\E[100m, rc=\E8, rev=\E[7m, ri=\EM, rmacs=^O, -- rmcup=\E[2J\E[?47l\E8, rmkx=\E[?1l\E>, rmso=\E[m, -- rmul=\E[m, -- rs2=\E>\E[1;3;4;5;6l\E[?7h\E[100m\E[m\E[r\E[2J\E[H, -- sc=\E7, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, -- sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;, -- sgr0=\E[m\017, smacs=^N, smcup=\E7\E[?47h, -+ dsl=\E[2$~\r\E[1$}\E[K\E[$}, ed=\E[J$<10/>, -+ el=\E[K$<4/>, flash=\E[?5h\E[?5l$<200/>, fsl=\E[$}, -+ home=\E[H, ht=^I, hts=\EH, ich=\E[%p1%d@, ich1=\E[@, -+ il=\E[%p1%dL, il1=\E[L, ind=\ED, -+ is2=\E<\E F\E>\E[?1h\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h\E[1;24r\E[24;1H, -+ kbs=^H, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, -+ kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, kf6=\E[17~, -+ kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, lf1=pf1, lf2=pf2, -+ lf3=pf3, lf4=pf4, nel=^M\ED, rc=\E8, rev=\E[7m, -+ rf=/usr/share/tabset/vt300, ri=\EM, rmacs=\E(B, -+ rmam=\E[?7l, rmir=\E[4l, rmkx=\E[?1l\E>, rmso=\E[27m, -+ rmul=\E[24m, rs1=\E<\E[?3l\E[!p\E[?7h, sc=\E7, -+ sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p4%t;5%;%?%p1%p3%|%t;7%;m%?%p9%t\E(0%e\E(B%;$<2>, -+ sgr0=\E[m\E(B, smacs=\E(0, smam=\E[?7h, smir=\E[4h, - smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, tbc=\E[3g, -- tsl=\E[?E\E[?%i%p1%dT, use=vt100+fnkeys, -- --### MTERM --# --# This application is available by email from <mouse@Rodents.Montreal.QC.CA>. --# --# "mterm -type ansi" sets $TERM to "ansi" --mterm-ansi|ANSI emulation, -- am, bw, mir, msgr, -- it#8, -- acsc=``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -- bel=^G, blink=\E[5m, bold=\E[1m, clear=\E[H\E[J, cr=^M, -- cub=\E[%p1%dD, cub1=\E[D, cud=\E[%p1%dB, cud1=\E[B, -- cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, -- cuu=\E[%p1%dA, cuu1=\E[A, dch=\E[%p1%dP, dch1=\E[P, -- dim=\E[2m, dl=\E[%p1%dM, dl1=\E[M, ech=\E[%p1%dX, ed=\E[J, -- el=\E[K, home=\E[H, hpa=\E[%i%p1%d`, ht=^I, ich1=, -- il=\E[%p1%dL, il1=\E[L, ind=\E[S, indn=\E[%p1%dS, -- invis=\E[8m, is2=\E)0\017, kbs=^H, nel=\EE, rev=\E[7m, -- ri=\E[T, rin=\E[%p1%dT, rmacs=^O, rmir=\E[4l, rmso=\E[27m, -- rmul=\E[24m, -- sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p5%t;2%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, -- sgr0=\E[m, smacs=^N, smir=\E[4h, smso=\E[7m, smul=\E[4m, -- vpa=\E[%i%p1%dd, --# mterm normally sets $TERM to "mterm" --mterm|mouse-sun|Der Mouse term, -- am, bw, mir, -- it#8, -- bel=^G, clear=^L, cr=^M, cub1=^H, cud1=^N, cuf1=^S, -- cup=\006%p1%d.%p2%d., cuu1=^X, dch1=^Y, dl1=^K, ed=^B, el=^C, -- home=^P, ht=^I, il1=^A, ind=^U, kbs=^H, ll=^R, nel=^M^U, ri=^W, -- rmir=^O, rmso=^T, smir=^Q, smso=^V, --# "mterm -type decansi" sets $TERM to "decansi" --# --# note: kdch1, kfnd, kslt are in the source code, but do not work -TD --decansi|ANSI emulation with DEC compatibility hacks, -- am, mir, msgr, xenl, -- colors#8, it#8, pairs#64, -- acsc=``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -- bel=^G, blink=\E[5m, bold=\E[1m, civis=\E[?25l, -- clear=\E[H\E[J, cnorm=\E[?25h, cr=^M, -- csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=\E[D, -- cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, cuf1=\E[C, -- cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, -- dch=\E[%p1%dP, dch1=\E[P, dim=\E[2m, dl=\E[%p1%dM, -- dl1=\E[M, ech=\E[%p1%dX, ed=\E[J, el=\E[K, enacs=\E(B\E)0, -- home=\E[H, hpa=\E[%i%p1%d`, ht=^I, ich1=, il=\E[%p1%dL, -- il1=\E[L, ind=\E[S, indn=\E[%p1%dS, invis=\E[8m, -- is2=\E)0\E[r\017, kbs=^H, kcub1=\EOD, kcud1=\EOB, -- kcuf1=\EOC, kcuu1=\EOA, kdch1=\E[3~, kf1=\E[11~, -- kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, -- kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, kf17=\E[31~, -- kf18=\E[32~, kf19=\E[33~, kf2=\E[12~, kf20=\E[34~, -- kf3=\E[13~, kf4=\E[14~, kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, -- kf8=\E[19~, kf9=\E[20~, kfnd=\E[1~, kich1=\E[2~, knp=\E[6~, -- kpp=\E[5~, kslt=\E[4~, nel=\EE, op=\E[0m, rc=\E8, rev=\E[7m, -- ri=\E[T, rin=\E[%p1%dT, rmacs=^O, rmam=\E[?7l, rmir=\E[4l, -- rmkx=\E[?1l\E>, rmso=\E[27m, rmul=\E[24m, sc=\E7, -- setab=\E[4%p1%dm, setaf=\E[3%p1%dm, -- sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p5%t;2%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, -- sgr0=\E[m, smacs=^N, smam=\E[?7h, smir=\E[4h, -- smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, u6=\E[%i%d;%dR, -- u7=\E[6n, vpa=\E[%i%p1%dd, -+ tsl=\E[2$~\E[1$}\E[1;%dH, use=dec+sl, - --#### VWM --# --# vwmterm is a terminal emulator written for the VWM console window manager --# --vwmterm|(vwm term), -- am, bce, ccc, mir, msgr, npc, xenl, xon, -- colors#8, pairs#64, -+# (vt420: I removed <kf0>, it collided with <kf10>. I also restored -+# a missing <sc> -- esr) -+# add msgr and other capabilities from vt220 -TD -+vt420|DEC VT420, -+ am, mir, msgr, xenl, xon, -+ cols#80, it#8, lines#24, vt#3, - acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -- bel=^G, blink=\E[5m, bold=\E[1m, civis=\E[?25l, -- clear=\E[H\E[J, cnorm=\E[?25h, cr=^M, cub=\E[%p1%dD, -- cub1=^H, cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, -- cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, -- cuu1=\E[A, cvvis=\E[?25h, dim=\E[2m, ed=\E[J, el=\E[K, -- home=\E[H, il1=\E[L, ind=^J, invis=\E[8m, kcub1=\E[D, -- kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[3~, -- kend=\E[4~, kf1=\E[[A, kf10=\E[21~, kf11=\E[22~, -- kf12=\E[23~, kf2=\E[[B, kf3=\E[[C, kf4=\E[[D, kf5=\E[[E, -- kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, -- khome=\E[1~, knp=\E[6~, kpp=\E[5~, rev=\E[7m, rmacs=\E[10m, -- rmam=\E[?7l, rmcup=\E[?1049l, rs1=\E[H\E[J\E[m\Ec, -- setab=\E[4%p1%dm, setaf=\E[3%p1%dm, -- sgr=\E[0;10%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;%?%p7%t;8%;%?%p9%t;11%;m, -- sgr0=\E[0;10m, smacs=\E[11m, smam=\E[?7h, -- smcup=\E[?1049h, smso=\E[3m, smul=\E[4m, -+ bel=^G, blink=\E[5m$<2>, bold=\E[1m$<2>, civis=\E[?25l, -+ clear=\E[H\E[2J$<50>, cnorm=\E[?25h, cr=^M, -+ csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, -+ cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, -+ cup=\E[%i%p1%d;%p2%dH$<10>, cuu=\E[%p1%dA, cuu1=\E[A, -+ dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, -+ ech=\E[%p1%dX, ed=\E[J$<50>, el=\E[K$<3>, el1=\E[1K, -+ enacs=\E)0, flash=\E[?5h$<200/>\E[?5l, home=\E[H, ht=^I, -+ hts=\EH, ich=\E[%p1%d@, if=/usr/share/tabset/vt300, -+ il=\E[%p1%dL, il1=\E[L, ind=\ED, is2=\E[1;24r\E[24;1H, -+ is3=\E[?67h\E[64;1"p, kbs=^H, kcub1=\E[D, kcud1=\E[B, -+ kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[3~, kf1=\EOP, kf10=\E[29~, -+ kf2=\EOQ, kf3=\EOR, kf4=\EOS, kf5=\E[17~, kf6=\E[18~, -+ kf7=\E[19~, kf8=\E[20~, kf9=\E[21~, kfnd=\E[1~, -+ kich1=\E[2~, knp=\E[6~, kpp=\E[5~, kslt=\E[4~, nel=\EE, -+ rc=\E8, rev=\E[7m$<2>, rf=/usr/share/tabset/vt300, -+ ri=\EM, rmacs=\E(B$<4>, rmam=\E[?7l, rmir=\E[4l, rmkx=\E>, -+ rmsc=\E[?0;0r\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, -+ rmso=\E[27m, rmul=\E[24m, rs3=\E[?67h\E[64;1"p, sc=\E7, -+ sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p4%t;5%;%?%p1%p3%|%t;7%;m%?%p9%t\E(0%e\E(B%;$<2>, -+ sgr0=\E[m\E(B$<2>, smacs=\E(0$<2>, smam=\E[?7h, -+ smir=\E[4h, smkx=\E=, smso=\E[7m, smul=\E[4m, tbc=\E[3g, -+ use=ansi+pp, use=dec+sl, use=ansi+enq, - --#### MGR -+# DEC VT220 and up support DECUDK (user-defined keys). DECUDK (i.e., pfx) -+# takes two parameters, the key and the string. Translating the key is -+# straightforward (keys 1-5 are not defined on real terminals, though some -+# emulators define these): - # --# MGR is a Bell Labs window system lighter-weight than X. --# These entries describe MGR's xterm-equivalent. --# They are courtesy of Vincent Broman <broman@nosc.mil> 14 Jan 1997 -+# if (key < 16) then value = key; -+# else if (key < 21) then value = key + 1; -+# else if (key < 25) then value = key + 2; -+# else if (key < 27) then value = key + 3; -+# else if (key < 30) then value = key + 4; -+# else value = key + 5; - # -- --mgr|Bellcore MGR (non X) window system terminal emulation, -- am, km, -- bel=^G, bold=\E2n, civis=\E9h, clear=^L, cnorm=\Eh, cr=^M, -- csr=\E%p1%d;%p2%dt, cub1=^H, cud1=\Ef, cuf1=\Er, -- cup=\E%p2%d;%p1%dM, cuu1=\Eu, cvvis=\E0h, -- dch=\E%p1%dE$<5>, dch1=\EE, dl=\E%p1%dd$<3*>, -- dl1=\Ed$<3>, ed=\EC, el=\Ec, hd=\E1;2f, ht=^I, hu=\E1;2u, -- ich=\E%p1%dA$<5>, ich1=\EA, il=\E%p1%da$<3*>, -- il1=\Ea$<3>, ind=^J, kbs=^H, kcub1=\E[D, kcud1=\E[B, -- kcuf1=\E[C, kcuu1=\E[A, nel=^M^J, rev=\E1n, rmam=\E5S, -- rmso=\E0n, rmul=\E0n, sgr0=\E0n, smam=\E5s, smso=\E1n, -- smul=\E4n, --mgr-sun|Mgr window with Sun keyboard, -- ka1=\E[214z, ka3=\E[216z, kb2=\E[218z, kc1=\E[220z, -- kc3=\E[222z, kcpy=\E[197z, kend=\E[220z, kent=\E[250z, -- kf1=\E[224z, kf10=\E[233z, kf11=\E[234z, kf12=\E[235z, -- kf2=\E[225z, kf3=\E[226z, kf4=\E[227z, kf5=\E[228z, -- kf6=\E[229z, kf7=\E[230z, kf8=\E[231z, kf9=\E[232z, -- kfnd=\E[200z, khlp=\E[207z, khome=\E[214z, knp=\E[222z, -- kopn=\E[198z, kpp=\E[216z, kund=\E[195z, use=mgr, --mgr-linux|Mgr window with Linux keyboard, -- ka1=\E[H, ka3=\E[5~, kb2=\E[G, kc1=\E[Y, kc3=\E[6~, -- kdch1=\E[3~, kend=\E[4~, kf0=\E[[J, kf1=\E[[A, kf10=\E[21~, -- kf11=\E[23~, kf12=\E[24~, kf2=\E[[B, kf3=\E[[C, kf4=\E[[D, -- kf5=\E[[E, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, -- khome=\E[1~, knp=\E[6~, kpp=\E[5~, use=mgr, -- --######## UNIX VIRTUAL TERMINALS, VIRTUAL CONSOLES, AND TELNET CLIENTS -+# The string must be the hexadecimal equivalent, e.g., "5052494E" for "PRINT". -+# There's no provision in terminfo for emitting a string in this format, so the -+# application has to know it. - # -+vt420pc|DEC VT420 w/PC keyboard, -+ kdch1=\177, kend=\E[4~, kf1=\E[11~, kf10=\E[21~, -+ kf11=\E[23~, kf12=\E[24~, kf13=\E[11;2~, kf14=\E[12;2~, -+ kf15=\E[13;2~, kf16=\E[14;2~, kf17=\E[15;2~, -+ kf18=\E[17;2~, kf19=\E[18;2~, kf2=\E[12~, kf20=\E[19;2~, -+ kf21=\E[20;2~, kf22=\E[21;2~, kf23=\E[23;2~, -+ kf24=\E[24;2~, kf25=\E[23~, kf26=\E[24~, kf27=\E[25~, -+ kf28=\E[26~, kf29=\E[28~, kf3=\E[13~, kf30=\E[29~, -+ kf31=\E[31~, kf32=\E[32~, kf33=\E[33~, kf34=\E[34~, -+ kf35=\E[35~, kf36=\E[36~, kf37=\E[23;2~, kf38=\E[24;2~, -+ kf39=\E[25;2~, kf4=\E[14~, kf40=\E[26;2~, kf41=\E[28;2~, -+ kf42=\E[29;2~, kf43=\E[31;2~, kf44=\E[32;2~, -+ kf45=\E[33;2~, kf46=\E[34;2~, kf47=\E[35;2~, -+ kf48=\E[36;2~, kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, -+ kf8=\E[19~, kf9=\E[20~, khome=\E[H, -+ pctrm=USR_TERM\:vt420pcdos\:, -+ pfx=\EP1;1|%?%{16}%p1%>%t%{0}%e%{21}%p1%>%t%{1}%e%{25}%p1%>%t%{2}%e%{27}%p1%>%t%{3}%e%{30}%p1%>%t%{4}%e%{5}%;%p1%+%d/%p2%s\E\\, -+ use=vt420, - --# Columbus UNIX virtual terminal. This terminal also appears in --# UNIX 4.0 and successors as line discipline 1 (?), but is --# undocumented and does not really work quite right. --cbunix|cb unix virtual terminal, -- OTbs, am, da, db, -- cols#80, lines#24, lm#0, -- bel=^G, clear=\EL, cr=^M, cub1=^H, cud1=^J, cuf1=\EC, -- cup=\EG%p2%c%p1%c, cuu1=\EA, dch1=\EM, dl1=\EN, ed=\EL, -- el=\EK, ich1=\EO, il1=\EP, ind=^J, kcub1=\ED, kcud1=\EB, -- kcuf1=\EC, kcuu1=\EA, khome=\EE, rmso=\Eb^D, rmul=\Eb^A, -- smso=\Ea^D, smul=\Ea^A, --# (vremote: removed obsolete ":nl@:" -- esr) --vremote|virtual remote terminal, -- am@, -- cols#79, use=cbunix, -- --pty|4bsd pseudo teletype, -- cup=\EG%p1%{32}%+%c%p2%{32}%+%c, rmso=\Eb$, rmul=\Eb!, -- smso=\Ea$, smul=\Ea!, use=cbunix, -+vt420pcdos|DEC VT420 w/PC for DOS Merge, -+ lines#25, -+ dispc=%?%p1%{19}%=%t\E\023\021%e%p1%{32}%<%t\E%p1%c%e%p1%{127}%=%t\E\177%e%p1%c%;, -+ pctrm@, -+ rmsc=\E[?0;0r\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sgr@, -+ sgr0=\E[m, smsc=\E[?1;2r\E[34h, use=vt420pc, - --# The codes supported by the term.el terminal emulation in GNU Emacs 19.30 --eterm|gnu emacs term.el terminal emulation, -- am, mir, xenl, -- cols#80, lines#24, -- bel=^G, bold=\E[1m, clear=\E[H\E[J, cr=^M, -- csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, -- cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, -- cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, -- dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, -- el=\E[K, el1=\E[1K, home=\E[H, ht=^I, ich=\E[%p1%d@, -- il=\E[%p1%dL, il1=\E[L, ind=^J, rev=\E[7m, -- rmcup=\E[2J\E[?47l\E8, rmir=\E[4l, rmso=\E[m, rmul=\E[m, -- sgr0=\E[m, smcup=\E7\E[?47h, smir=\E[4h, smso=\E[7m, -- smul=\E[4m, -+vt420f|DEC VT420 with VT kbd; VT400 mode; F1-F5 used as Fkeys, -+ kdch1=\177, kf1=\E[11~, kf10=\E[21~, kf11=\E[23~, -+ kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, kf15=\E[28~, -+ kf16=\E[29~, kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, -+ kf2=\E[12~, kf20=\E[34~, kf3=\E[13~, kf4=\E[14~, -+ kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, -+ khome=\E[H, lf1=\EOP, lf2=\EOQ, lf3=\EOR, lf4=\EOS, -+ use=vt420, - --# The codes supported by the term.el terminal emulation in GNU Emacs 22.2 --eterm-color|Emacs term.el terminal emulator term-protocol-version 0.96, -- am, mir, msgr, xenl, -- colors#8, cols#80, lines#24, pairs#64, -- bel=^G, blink=\E[5m, bold=\E[1m, clear=\E[H\E[J, cr=^M, -- csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, -- cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, -- cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, -- dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, -- el=\E[K, el1=\E[1K, home=\E[H, ht=^I, ich=\E[%p1%d@, -- il=\E[%p1%dL, il1=\E[L, ind=^J, invis=\E[8m, kbs=\177, -- kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, -- kdch1=\E[3~, kend=\E[4~, khome=\E[1~, kich1=\E[2~, -- knp=\E[6~, kpp=\E[5~, op=\E[39;49m, rc=\E8, rev=\E[7m, -- ri=\EM, rmir=\E[4l, rmso=\E[27m, rmul=\E[24m, rs1=\Ec, -- sc=\E7, setab=\E[%p1%'('%+%dm, setaf=\E[%p1%{30}%+%dm, -- sgr=\E[0%?%p1%p3%|%t;7%;%?%p2%t;4%;%?%p4%t;5%;%?%p6%t;1%;%?%p7%t;8%;m, -- sgr0=\E[m, smir=\E[4h, smso=\E[7m, smul=\E[4m, -- u6=\E[%i%d;%dR, u7=\E[6n, -+vt510|DEC VT510, -+ use=vt420, -+vt510pc|DEC VT510 w/PC keyboard, -+ use=vt420pc, -+vt510pcdos|DEC VT510 w/PC for DOS Merge, -+ use=vt420pcdos, - --# Entries for use by the `screen' program by Juergen Weigert, --# Michael Schroeder, Oliver Laumann. The screen and --# screen-w entries came with version 3.7.1. The screen2 and screen3 entries --# come from University of Wisconsin and may be older. --# (screen: added <cnorm> on ANSI model -- esr) -+# VT520/VT525 - # --# 'screen' defines extensions to termcap. Some are used in its terminal --# description: --# G0 (bool) Terminal can deal with ISO 2022 font selection sequences. --# AX (bool) Does understand ANSI set default fg/bg color --# (\E[39m / \E[49m). --# S0 (str) Switch charset 'G0' to the specified charset. --# E0 (str) Switch charset 'G0' back to standard charset. -+# The VT520 is a monochrome text terminal capable of managing up to -+# four independent sessions in the terminal. It has multiple ANSI -+# emulations (VT520, VT420, VT320, VT220, VT100, VT PCTerm, SCO Console) -+# and ASCII emulations (WY160/60, PCTerm, 50/50+, 150/120, TVI 950, -+# 925 910+, ADDS A2). This terminfo data is for the ANSI emulations only. - # --# tested with screen 3.09.08 --screen|VT 100/ANSI X3.64 virtual terminal, -- OTbs, OTpt, am, km, mir, msgr, xenl, G0, -- colors#8, cols#80, it#8, lines#24, ncv@, pairs#64, U8#1, -- acsc=++\,\,--..00``aaffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -- bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l, -- clear=\E[H\E[J, cnorm=\E[34h\E[?25h, cr=^M, -- csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, -- cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, -- cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\EM, -- cvvis=\E[34l, dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, -- dl1=\E[M, ed=\E[J, el=\E[K, el1=\E[1K, enacs=\E(B\E)0, -- flash=\Eg, home=\E[H, ht=^I, hts=\EH, ich=\E[%p1%d@, -- il=\E[%p1%dL, il1=\E[L, ind=^J, is2=\E)0, kbs=^H, kcbt=\E[Z, -- kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, -- kdch1=\E[3~, kend=\E[4~, kf1=\EOP, kf10=\E[21~, -- kf11=\E[23~, kf12=\E[24~, kf2=\EOQ, kf3=\EOR, kf4=\EOS, -- kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, -- khome=\E[1~, kich1=\E[2~, kmous=\E[M, knp=\E[6~, kpp=\E[5~, -- nel=\EE, rc=\E8, rev=\E[7m, ri=\EM, rmacs=^O, -- rmcup=\E[?1049l, rmir=\E[4l, rmkx=\E[?1l\E>, rmso=\E[23m, -- rmul=\E[24m, rs2=\Ec\E[?1000l\E[?25h, sc=\E7, -- sgr=\E[0%?%p6%t;1%;%?%p1%t;3%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;, -- sgr0=\E[m\017, smacs=^N, smcup=\E[?1049h, smir=\E[4h, -- smkx=\E[?1h\E=, smso=\E[3m, smul=\E[4m, tbc=\E[3g, E0=\E(B, -- S0=\E(%p1%c, use=ecma+color, --# The bce and status-line entries are from screen 3.9.13 (and require some --# changes to .screenrc). --screen-bce|VT 100/ANSI X3.64 virtual terminal with bce, -- bce, -- ech@, use=screen, --screen-s|VT 100/ANSI X3.64 virtual terminal with hardstatus line, -- dsl=\E_\E\\, fsl=\E\\, tsl=\E_, use=screen, -- --# ====================================================================== --# Entries for GNU Screen with 16 colors. --# Those variations permit to benefit from 16 colors palette, and from --# bold font and blink attribute separated from bright colors. But they --# are less portable than the generic "screen" 8 color entries: Their --# usage makes real sense only if the terminals you attach and reattach --# do all support 16 color palette. -- --screen-16color|GNU Screen with 16 colors, -- use=ibm+16color, use=screen, -- --screen-16color-s|GNU Screen with 16 colors and status line, -- use=ibm+16color, use=screen-s, -- --screen-16color-bce|GNU Screen with 16 colors and BCE, -- use=ibm+16color, use=screen-bce, -+# Terminal Set-Up is entered by pressing [F3], [Caps Lock]/[F3] or -+# [Alt]/[Print Screen] depending upon which keyboard and which -+# terminal mode is being used. If Set-Up has been disabled or -+# assigned to an unknown key, Set-Up may be entered by pressing -+# [F3] as the first key after power up, regardless of keyboard type. -+vt520|DEC VT520, -+ use=ansi+rca, use=vt420, use=ansi+tabs, - --screen-16color-bce-s|GNU Screen with 16 colors, BCE, and status line, -- bce, use=ibm+16color, use=screen-s, -+vt525|DEC VT525, -+ use=vt520, - --# ====================================================================== --# Entries for GNU Screen 4.02 with --enable-colors256. -+#### VT100 emulations -+# - --screen-256color|GNU Screen with 256 colors, -- ccc@, -- initc@, use=xterm+256color, use=screen, -+# John Hawkinson <jhawk@MIT.EDU> tells us that the EWAN telnet for Windows -+# (the best Windows telnet as of September 1995) presents the name `dec-vt100' -+# to telnetd. Michael Deutschmann <ldeutsch@mail.netshop.net> informs us -+# that this works best with a stock vt100 entry. -+dec-vt100|EWAN telnet's vt100 emulation, -+ use=vt100, - --screen-256color-s|GNU Screen with 256 colors and status line, -- ccc@, -- initc@, use=xterm+256color, use=screen-s, -+# From: Adrian Garside <94ajg2@eng.cam.ac.uk>, 19 Nov 1996 -+dec-vt220|DOS tnvt200 terminal emulator, -+ am@, use=vt220, - --screen-256color-bce|GNU Screen with 256 colors and BCE, -- ccc@, -- initc@, use=xterm+256color, use=screen-bce, -+# Zstem340 is an (IMHO) excellent VT emulator for PC's. I recommend it to -+# anyone who needs PC VT340 emulation. (or anything below that level, for -+# that matter -- DEC's ALL-in-1 seems happy with it, as does INFOPLUS's -+# RDBM systems, it includes ReGIS and SiXel support! I'm impressed... -+# I can send the address if requested. -+# (z340: changed garbled \E[5?l to \E[?5l, DEC smooth scroll off -- esr) -+# From: Adam Thompson <athompso@pangea.ca> Sept 10 1995 -+z340|zstem vt340 terminal emulator 132col 42line, -+ lines#42, -+ is2=\E>\E[?3h\E[?4l\E[?5l\E[?7h\E[?8h\E[1;42r\E[42;1H, -+ rs2=\E>\E[?3h\E[?4l\E[?5l\E[?7h\E[?8h\E[1;42r\E[42;1H, -+ use=vt320-w, -+z340-nam|zstem vt340 terminal emulator 132col 42line (no automatic margins), -+ am@, -+ is2=\E>\E[?3h\E[?4l\E[?5l\E[?7l\E[?8h\E[1;42r\E[42;1H, -+ rs2=\E>\E[?3h\E[?4l\E[?5l\E[?7l\E[?8h\E[1;42r\E[42;1H, -+ use=z340, - --screen-256color-bce-s|GNU Screen with 256 colors, BCE, and status line, -- bce, ccc@, -- initc@, use=xterm+256color, use=screen-s, -+# CRT is shareware. It implements some xterm features, including mouse. -+crt|crt-vt220|CRT 2.3 emulating VT220, -+ bce, msgr, -+ ncv@, -+ hts=\EH, use=vt100+enq, use=vt220, use=ecma+color, - --# ====================================================================== -- --# Read the fine manpage: --# When screen tries to figure out a terminal name for --# itself, it first looks for an entry named "screen.<term>", --# where <term> is the contents of your $TERM variable. If --# no such entry exists, screen tries "screen" (or "screen-w" --# if the terminal is wide (132 cols or more)). If even this --# entry cannot be found, "vt100" is used as a substitute. -+# PuTTY 0.55 (released 3 August 2004) -+# http://www.chiark.greenend.org.uk/~sgtatham/putty/ - # --# Notwithstanding the manpage, screen uses its own notion of the termcap --# and some keys from "screen.<term>" are ignored. Here is an entry which --# covers those (tested with screen 4.00.02) -TD --screen+fkeys|function-keys according to screen, -- kend=\E[4~, kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, kfnd@, -- khome=\E[1~, kslt@, -+# Comparing with 0.51, vttest is much better (only a few problems with the -+# cursor position reports and wrapping). - # --# Here are a few customized entries which are useful -TD -+# PuTTY 0.51 (released 14 December 2000) - # --# Notes: --# (a) screen does not support invis. --# (b) screen's implementation of bw is incorrect according to tack. --# (c) screen appears to hardcode the strings for khome/kend, making it --# necessary to override the "use=" clause's values (screen+fkeys). --# (d) screen sets $TERMCAP to a termcap-formatted copy of the 'screen' entry, --# which is NOT the same as the terminfo screen.<term>. --# (e) when screen finds one of these customized entries, it sets $TERM to --# match. Hence, no "screen.xterm" entry is provided, since that would --# create heartburn for people running remote xterm's. -+# This emulates vt100 + vt52 (plus a few vt220 features: ech, SRM, DECTCEM, as -+# well as SCO and Atari, color palettes from Linux console). Reading the code, -+# it is intended to be VT102 plus selected features. By default, it sets $TERM -+# to xterm, which is incorrect, since several features are misimplemented: - # --# xterm (-xfree86 or -r6) does not normally support kIC, kNXT and kPRV --# since the default translations override the built-in keycode --# translation. They are suppressed here to show what is tested by tack. --screen.xterm-xfree86|screen.xterm-new|screen customized for modern xterm, -- bce@, bw, -- invis@, kIC@, kNXT@, kPRV@, meml@, memu@, -- sgr=%?%p9%t\E(0%e\E(B%;\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m, -- use=screen+fkeys, use=xterm-new, --# xterm-r6 does not really support khome/kend unless it is propped up by --# the translations resource. --screen.xterm-r6|screen customized for X11R6 xterm, -- bw, use=screen+fkeys, use=xterm-r6, --# Color applications running in screen and TeraTerm do not play well together --# on Solaris because Sun's curses implementation gets confused. --screen.teraterm|disable ncv in teraterm, -- ncv#127, -- acsc=+\020\,\021-\030.^Y0\333`\004a\261f\370g\361h\260i\316j\331k\277l\332m\300n\305o~p\304q\304r\304s_t\303u\264v\301w\302x\263y\363z\362{\343|\330}\234~\376, -- use=screen+fkeys, use=screen, --# Other terminals --screen.rxvt|screen in rxvt, -- bw, XT, -- cvvis@, flash@, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, -- kcuu1=\EOA, use=screen+fkeys, use=vt100+enq, -- use=rxvt+pcfkeys, use=vt220+keypad, use=screen, --screen.Eterm|screen in Eterm, -- use=screen+fkeys, use=Eterm, --screen.mrxvt|screen in mrxvt, -- use=screen+fkeys, use=mrxvt, --screen.vte|screen in any VTE-based terminal, -- use=screen+fkeys, use=vte, --screen.gnome|screen in GNOME Terminal, -- use=screen+fkeys, use=gnome, --screen.konsole|screen in KDE console window, -- use=screen+fkeys, use=konsole, --# fix the backspace key --screen.linux|screen in linux console, -- bw, -- kbs=\177, kcbt@, use=screen+fkeys, use=screen, --screen.mlterm|screen in mlterm, -- use=screen+fkeys, use=mlterm, -- --# The default "screen" entry is reasonably portable, but not optimal for the --# most widely-used terminal emulators. The "bce" capability is supported in --# screen since 3.9.13, and when used, will require fewer characters to be sent --# to the terminal for updates. -+# Alt+key always sends ESC+key, so 'km' capability is removed. - # --# If you are using only terminals which support bce, then you can use this --# feature in your screen configuration. -+# Control responses, wrapping and tabs are buggy, failing a couple of -+# screens in vttest. - # --# Adding these lines to your ".screenrc" file will allow using these customized --# entries: --# term screen-bce --# bce on --# defbce on --screen-bce.xterm-new|screen optimized for modern xterm, -- bce, -- ech@, use=screen.xterm-new, --screen-bce.rxvt|screen optimized for rxvt, -- bce, -- ech@, use=screen.rxvt, --screen-bce.Eterm|screen optimized for Eterm, -- bce, -- ech@, use=screen.Eterm, --screen-bce.mrxvt|screen optimized for mrxvt, -- bce, -- ech@, use=screen.mrxvt, --screen-bce.gnome|screen optimized for GNOME-Terminal, -- bce, -- ech@, use=screen.gnome, --screen-bce.konsole|screen optimized for KDE console window, -- bce, -- ech@, use=screen.konsole, --screen-bce.linux|screen optimized for linux console, -- bce, -- ech@, use=screen.linux, --screen-bce.mlterm|screen optimized for mlterm, -- bce, -- ech@, use=screen.mlterm, -- --screen-w|VT 100/ANSI X3.64 virtual terminal with 132 cols, -- cols#132, use=screen, -+# xterm mouse support is not implemented (unrelease version may). -+# -+# Several features such as backspace/delete are optional; this entry documents -+# the default behavior -TD - --screen2|old VT 100/ANSI X3.64 virtual terminal, -- cols#80, it#8, lines#24, -- cbt=\E[Z, clear=\E[2J\E[H, cr=^M, cub=\E[%p1%dD, cub1=^H, -- cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, cuf1=\E[C, -- cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, -- dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, -- el=\E[K, ht=^I, hts=\EH, ich=\E[%p1%d@, ich1=, il=\E[%p1%dL, -- il1=\E[L, ind=^J, kbs=^H, kcub1=\ED, kcud1=\EB, kcuf1=\EC, -- kcuu1=\EA, kf0=\E~, kf1=\ES, kf2=\ET, kf3=\EU, kf4=\EV, -- kf5=\EW, kf6=\EP, kf7=\EQ, kf8=\ER, kf9=\E0I, khome=\EH, -- nel=^M^J, rc=\E8, ri=\EM, rmir=\E[4l, rmso=\E[23m, -- rmul=\E[24m, rs1=\Ec, sc=\E7, sgr0=\E[m, smir=\E[4h, -- smso=\E[3m, smul=\E[4m, tbc=\E[3g, --# (screen3: removed unknown ":xv:LP:G0:" -- esr) --screen3|older VT 100/ANSI X3.64 virtual terminal, -- km, mir, msgr, -- cols#80, it#8, lines#24, -- bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, clear=\E[H\E[J, -- cr=^M, csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, -- cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, -+putty|PuTTY terminal emulator, -+ am, bce, bw, ccc, mir, msgr, xenl, xon, XT, -+ colors#8, it#8, ncv#22, pairs#64, U8#1, -+ acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -+ bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l, -+ clear=\E[H\E[J, cnorm=\E[?25h, cr=^M, -+ csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, -+ cud=\E[%p1%dB, cud1=\ED, cuf=\E[%p1%dC, cuf1=\E[C, - cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\EM, -- dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, -- el=\E[K, home=\E[H, ht=^I, hts=\EH, ich=\E[%p1%d@, -- il=\E[%p1%dL, il1=\E[L, ind=^J, is2=\E)0, kbs=^H, kcub1=\EOD, -- kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kf1=\EOP, kf2=\EOQ, -- kf3=\EOR, kf4=\EOS, nel=\EE, rc=\E8, rev=\E[7m, ri=\EM, -- rmir=\E[4l, rmkx=\E>, rmso=\E[23m, rmul=\E[24m, rs1=\Ec, -- sc=\E7, sgr0=\E[m, smir=\E[4h, smkx=\E=, smso=\E[3m, -- smul=\E[4m, tbc=\E[3g, -+ dch=\E[%p1%dP, dch1=\E[P, -+ dispc=%?%p1%{8}%=%t\E%%G\342\227\230\E%%@%e%p1%{10}%=%t\E%%G\342\227\231\E%%@%e%p1%{12}%=%t\E%%G\342\231\0\E%%@%e%p1%{13}%=%t\E%%G\342\231\252\E%%@%e%p1%{14}%=%t\E%%G\342\231\253\E%%@%e%p1%{15}%=%t\E%%G\342\230\274\E%%@%e%p1%{27}%=%t\E%%G\342\206\220\E%%@%e%p1%{155}%=%t\E%%G\340\202\242\E%%@%e%p1%c%;, -+ dl=\E[%p1%dM, dl1=\E[M, ech=\E[%p1%dX, ed=\E[J, el=\E[K, -+ el1=\E[1K, enacs=\E(B\E)0, flash=\E[?5h\E[?5l, home=\E[H, -+ hpa=\E[%i%p1%dG, ht=^I, hts=\EH, il=\E[%p1%dL, il1=\E[L, -+ ind=^J, indn=\E[%p1%dS, -+ initc=\E]P%p1%x%p2%{255}%*%{1000}%/%02x%p3%{255}%*%{1000}%/%02x%p4%{255}%*%{1000}%/%02x, -+ is2=\E7\E[r\E[m\E[?7h\E[?1;4;6l\E[4l\E8\E>\E]R, -+ kb2=\E[G, kbs=\177, kcbt=\E[Z, kcub1=\E[D, kcud1=\E[B, -+ kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[3~, kend=\E[4~, -+ kf1=\E[11~, kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, -+ kf13=\E[25~, kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, -+ kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, kf2=\E[12~, -+ kf20=\E[34~, kf3=\E[13~, kf4=\E[14~, kf5=\E[15~, -+ kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, -+ khome=\E[1~, kich1=\E[2~, kmous=\E[M, knp=\E[6~, kpp=\E[5~, -+ kspd=^Z, nel=^M^J, oc=\E]R, op=\E[39;49m, rc=\E8, rev=\E[7m, -+ ri=\EM, rin=\E[%p1%dT, rmacs=^O, rmam=\E[?7l, -+ rmcup=\E[2J\E[?47l, rmir=\E[4l, rmpch=\E[10m, -+ rmso=\E[27m, rmul=\E[24m, -+ rs2=\E<\E["p\E[50;6"p\Ec\E[?3l\E]R\E[?1000l, -+ s0ds=\E[10m, s1ds=\E[11m, s2ds=\E[12m, sc=\E7, -+ setab=\E[4%p1%dm, setaf=\E[3%p1%dm, -+ sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;, -+ sgr0=\E[m\017, smacs=^N, smam=\E[?7h, smcup=\E[?47h, -+ smir=\E[4h, smpch=\E[11m, smso=\E[7m, smul=\E[4m, -+ tbc=\E[3g, vpa=\E[%i%p1%dd, E3=\E[3;J, use=vt102+enq, -+ use=xterm+sl, -+vt100-putty|Reset PuTTY to pure vt100, -+ rs2=\E<\E["p\Ec\E[?3l\E]R\E[40"p\E[61"p\E[50;1;2"p, -+ use=vt100, -+# palette is hardcoded... -+putty-256color|PuTTY 0.58 with xterm 256-colors, -+ initc@, use=xterm+256color, use=putty, - --# Francesco Potorti <F.Potorti@cnuce.cnr.it>: --# NCSA telnet is one of the most used telnet clients for the Macintosh. It has --# been maintained until recently by the National Center for Supercomputer --# Applications, and it is feature rich, stable and free. It can be downloaded --# from www.ncsa.edu. This terminfo description file is based on xterm-vt220, --# xterm+sl, and the docs at NCSA. It works well. -+# One of the keyboard selections is "VT100+". -+# pterm (the X11 port) uses shifted F1-F10 as F11-F20 -+putty-vt100|VT100+ keyboard layout, -+ kf1=\EOP, kf10=\EOY, kf11=\EOZ, kf12=\EO[, kf2=\EOQ, -+ kf3=\EOR, kf4=\EOS, kf5=\EOT, kf6=\EOU, kf7=\EOV, kf8=\EOW, -+ kf9=\EOX, use=putty, -+ -+# Unlike xterm-sco, this leaves kmous ambiguous with kf1. - # --# NCSA Telnet 2.6 for Macintosh in vt220 8-bit emulation mode --# The terminal options should be set as follows: --# Xterm sequences ON --# use VT wrap mode ON --# use Emacs arrow keys OFF --# CTRL-COMND is Emacs meta ON --# 8 bit mode ON --# answerback string: "ncsa-vt220-8" --# setup keys: all disabled -+# Use modifiers to obtain function keys past 12: -+# F1-F12 - normal -+# F13-F24 - shift -+# F25-F36 - control/alt -+# F37-F48 - control/shift - # --# Application mode is not used. -+putty-sco|putty with SCO function keys, -+ kbeg=\E[E, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, -+ kdch1=\177, kend=\E[F, kf1=\E[M, kf10=\E[V, kf11=\E[W, -+ kf12=\E[X, kf13=\E[Y, kf14=\E[Z, kf15=\E[a, kf16=\E[b, -+ kf17=\E[c, kf18=\E[d, kf19=\E[e, kf2=\E[N, kf20=\E[f, -+ kf21=\E[g, kf22=\E[h, kf23=\E[i, kf24=\E[j, kf25=\E[k, -+ kf26=\E[l, kf27=\E[m, kf28=\E[n, kf29=\E[o, kf3=\E[O, -+ kf30=\E[p, kf31=\E[q, kf32=\E[r, kf33=\E[s, kf34=\E[t, -+ kf35=\E[u, kf36=\E[v, kf37=\E[w, kf38=\E[x, kf39=\E[y, -+ kf4=\E[P, kf40=\E[z, kf41=\E[@, kf42=\E[[, kf43=\E[\\, -+ kf44=\E[], kf45=\E[\^, kf46=\E[_, kf47=\E[`, kf48=\E[{, -+ kf5=\E[Q, kf6=\E[R, kf7=\E[S, kf8=\E[T, kf9=\E[U, khome=\E[H, -+ kich1=\E[L, knp=\E[G, kpp=\E[I, use=putty, -+ -+# This entry is for Tera Term Pro version 2.3, for MS-Windows 95/NT written by -+# T. Teranishi dated Mar 10, 1998. It is a free software terminal emulator -+# (communication program) which supports: - # --# Other special mappings: --# Apple VT220 --# HELP Find --# HOME Insert here --# PAGEUP Remove --# DEL Select --# END Prev Screen --# PAGEDOWN Next Screen -+# - Serial port connections. -+# - TCP/IP (telnet) connections. -+# - VT100 emulation, and selected VT200/300 emulation. -+# - TEK4010 emulation. -+# - File transfer protocols (Kermit, XMODEM, ZMODEM, B-PLUS and -+# Quick-VAN). -+# - Scripts using the "Tera Term Language". -+# - Japanese and Russian character sets. - # --# Though it supports ANSI color, NCSA Telnet uses color to represent blinking --# text. -+# The program does not come with terminfo or termcap entries. However, the -+# emulation (testing with vttest and ncurses) is reasonably close to vt100 (no -+# vt52 or doublesize character support; blinking is done with color). Besides -+# the HPA, VPA extensions it also implements CPL and CNL. - # --# The status-line manipulation is a mapping of the xterm-compatible control --# sequences for setting the window-title. So you must use tsl and fsl in --# pairs, since the latter ends the string that is loaded to the window-title. --ncsa-m|ncsa-vt220-8|NCSA Telnet 2.6 for Macintosh in vt220-8 mode, -- am, hs, km, mir, msgr, xenl, -- acsc=``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -- bel=^G, blink=\E[5m, bold=\E[1m, civis=\E[?25l, -- clear=\E[H\E[2J, cnorm=\E[?25h, cr=^M, -- csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, -- cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, -- cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, -- dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, -- dsl=\E]0;\007, ed=\E[J, el=\E[K, el1=\E[1K, enacs=\E)0, -- flash=\E[?5h\E[?5l, fsl=^G, home=\E[H, ht=^I, hts=\EH, -- ich=\E[%p1%d@, if=/usr/share/tabset/vt100, -- il=\E[%p1%dL, il1=\E[L, ind=\n$<150*>, -- is2=\E7\E[r\E[m\E[?7h\E[?1;4;6l\E[4l\E8\E>, kbs=^H, -- kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, -- kdch1=\E[4~, kend=\E[5~, kf1=\E[17~, kf10=\E[28~, -- kf11=\E[29~, kf12=\E[31~, kf13=\E[32~, kf14=\E[33~, -- kf15=\E[34~, kf2=\E[18, kf3=\E[19~, kf4=\E[20~, kf5=\E[21~, -- kf6=\E[23~, kf7=\E[24~, kf8=\E[25~, kf9=\E[26~, khlp=\E[1~, -- khome=\E[2~, knp=\E[6~, kpp=\E[3~, mc4=\E[4i, mc5=\E[5i, -- rc=\E8, rev=\E[7m, rf=/usr/share/tabset/vt100, ri=\EM, -- rmacs=\E(B, rmam=\E[?7l, rmcup=\E[2J\E8, rmir=\E[4l, -- rmso=\E[27m, rmul=\E[24m, -- rs2=\E7\E[r\E8\E[m\E[?7h\E[?1;4;6l\E[4l\E>, sc=\E7, -- sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p4%t;5%;%?%p1%p3%|%t;7%;m%?%p9%t\E(0%e\E(B%;, -- sgr0=\E[m\E(B, smacs=\E(0, smam=\E[?7h, smcup=\E7, -- smir=\E[4h, smso=\E[7m, smul=\E[4m, tbc=\E[3g, tsl=\E]0;, -- u8=\E[?62;1;6c, use=ansi+enq, --ncsa|NCSA Telnet 2.7 for Macintosh in vt220-8 mode, -- use=ncsa-m, use=klone+color, --ncsa-ns|NCSA Telnet 2.7 for Macintosh in vt220-8 mode, -- hs@, -- dsl@, fsl@, tsl@, use=ncsa, --ncsa-m-ns|NCSA Telnet 2.6 for Macintosh in vt220-8 mode, -- hs@, -- dsl@, fsl@, tsl@, use=ncsa-m, --# alternate -TD: --# The documented function-key mapping refers to the Apple Extended Keyboard --# (e.g., NCSA Telnet's F1 corresponds to a VT220 F6). We use the VT220-style --# codes, however, since the numeric keypad (VT100) PF1-PF4 are available on --# some keyboards and many applications require these as F1-F4. -+# All of the function keys can be remapped. This description shows the default -+# mapping, as installed. Both vt100 PF1-PF4 keys and quasi-vt220 F1-F4 keys -+# are supported. F13-F20 are obtained by shifting F3-F10. The editing keypad -+# is laid out like vt220, rather than the face codes on the PC keyboard, i.e, -+# kfnd Insert -+# kslt Delete -+# kich1 Home -+# kdch1 PageUp -+# kpp End -+# knp PageDown - # --ncsa-vt220|NCSA Telnet using vt220-compatible function keys, -- kf1=\EOP, kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, -- kf13=\E[25~, kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, -- kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, kf2=\EOQ, -- kf20=\E[34~, kf3=\EOR, kf4=\EOS, kf6=\E[17~, kf7=\E[18~, -- kf8=\E[19~, kf9=\E[20~, use=ncsa, -- --#### Pilot Pro Palm-Top -+# ANSI colors are implemented, but cannot be combined with video attributes -+# except for reverse. - # --# Termcap for Top Gun Telnet and SSH on the Palm Pilot. --# http://www.ai/~iang/TGssh/ --pilot|tgtelnet|Top Gun Telnet on the Palm Pilot Professional, -- OTbs, am, xenl, -- cols#39, lines#16, -- bel=^G, clear=\Ec, cr=^M, cub1=^H, cud1=^J, -- cup=\Em%p1%{32}%+%c%p2%{32}%+%c, home=\Em\s\s, ht=^I, -- ind=^J, kbs=^H, kcub1=^H, kcud1=^J, knp=^L, kpp=^K, nel=\Em~\s, -- rmso=\EB, smso=\Eb, -- --# From: Federico Bianchi <bianchi@www.arte.unipi.it> --# These entries are for the Embeddable Linux Kernel System (ELKS) --# project - an heavily stripped down Linux to be run on 16 bit --# boxes or, eventually, to be used in embedded systems - and have been --# adapted from the stock ELKS termcap. The project itself looks stalled, --# and the latest improvements I know of date back to March 2000. -+# No fonts are supplied with the program, so the acsc string is chosen to -+# correspond with the default Microsoft terminal font. - # --# To cope with the ELKS dumb console I added an "elks-glasstty" entry; --# as an added bonus, this deals with all the capabilities common to --# both VT52 and ANSI (or, eventually, "special") modes. -- --elks-glasstty|ELKS glass-TTY capabilities, -- OTbs, am, -- cols#80, it#8, lines#25, -- bel=^G, cr=^M, ht=^I, ind=^J, kbs=^H, kcub1=^H, kcud1=^J, -- nel=^M^J, -- --elks-vt52|ELKS vt52 console, -- clear=\EH\EJ, cub1=\ED, cud1=\EB, cuf1=\EC, -- cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, el=\EK, -- home=\EH, use=elks-glasstty, -- --elks-ansi|ELKS ANSI console, -- clear=\E[H\E[2J, cub1=\E[D, cud1=\E[B, cuf1=\E[C, -- cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, el=\E[K, home=\E[H, -- rmso=\E[m, smso=\E[7m, use=elks-glasstty, -- --# As a matter of fact, ELKS 0.0.83 on PCs defaults to ANSI emulation --# instead of VT52, but the "elks" entry still refers to the latter. -+# Tera Term recognizes some xterm sequences, including those for setting and -+# retrieving the window title, and for setting the window size (i.e., using -+# "resize -s"), though it does not pass SIGWINCH to the application if the -+# user resizes the window with the mouse. -+teraterm2.3|Tera Term Pro, -+ km, xon@, -+ ncv#43, vt@, -+ acsc=+\020\,\021-\030.^Y0\333`\004a\261f\370g\361h\260i\316j\331k\277l\332m\300n\305o~p\304q\304r\304s_t\303u\264v\301w\302x\263y\363z\362{\343|\330}\234~\376, -+ blink=\E[5m, bold=\E[1m, civis=\E[?25l, clear=\E[H\E[J, -+ cnorm=\E[?25h, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, -+ cuu1=\E[A, dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, -+ dl1=\E[M, ech=\E[%p1%dX, ed=\E[J, el=\E[K, el1=\E[1K, -+ flash=\E[?5h\E[?5l$<200/>, hpa=\E[%i%p1%dG, -+ il=\E[%p1%dL, il1=\E[L, kdch1=\E[3~, kf1=\E[11~, -+ kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, -+ kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, kf17=\E[31~, -+ kf18=\E[32~, kf19=\E[33~, kf2=\E[12~, kf20=\E[34~, -+ kf3=\E[13~, kf4=\E[14~, kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, -+ kf8=\E[19~, kf9=\E[20~, kfnd=\E[1~, kich1=\E[2~, knp=\E[6~, -+ kpp=\E[5~, kslt=\E[4~, op=\E[100m, rev=\E[7m, ri=\EM, -+ rmso=\E[27m, rmul=\E[24m, sgr0=\E[0m\017, smso=\E[7m, -+ smul=\E[4m, vpa=\E[%i%p1%dd, use=vt100+enq, -+ use=klone+color, use=vt100, - --elks|default ELKS console, -- use=elks-vt52, -+# Version 4.59 has regular vt100 line-drawing (so it is no longer necessary -+# to choose a Windows OEM font). -+# -+# Testing with tack: -+# - it does not have xenl (suppress that) -+# - underline seems to work with color (modify ncv). -+# Testing with vttest: -+# - wrapping differs from vt100 (menu 1). -+# - it recognizes xterm's X10 and normal mouse tracking, but none of the -+# other flavors. -+# - it recognizes the dtterm window controls for reporting size in -+# characters and pixels. -+# - it passes SIGWINCH. -+teraterm4.59|Tera Term Pro, -+ bce, xenl@, -+ ncv#41, -+ acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -+ kmous=\E[M, use=teraterm2.3, - --# Project SIBO (for Psion 3 palmtops) console is identical to the ELKS --# one but in screen size -+teraterm|Tera Term, -+ use=teraterm4.59, - --sibo|ELKS SIBO console, -- cols#61, it#8, lines#20, use=elks-vt52, -+# Tested with WinNT 4.0, the telnet application assumes the screensize is -+# 25x80. This entry uses the 'Terminal' font, to get line-drawing characters. -+# -+# Other notes: -+# a) Fails tack's cup (cursor-addressing) test, though cup works well enough -+# for casual (occasional) use. Also fails several of the vttest screens, -+# but that is not unusual for vt100 "emulators". -+# b) Does not implement vt100 keypad -+# c) Recognizes a subset of vt52 controls. -+ms-vt100|MS telnet imitating dec vt100, -+ lines#25, -+ acsc=+\020\,\021-\030.^Y0\333`\004a\261f\370g\361h\260i\316j\331k\277l\332m\300n\305o~p\304q\304r\304s_t\303u\264v\301w\302x\263y\363z\362{\343|\330}\234~\376, -+ ka1@, ka3@, kb2@, kc1@, kc3@, kent@, kf0@, kf1@, kf10@, kf2@, kf3@, kf4@, -+ kf5@, kf6@, kf7@, kf8@, kf9@, tbc@, use=vt102+enq, use=vt100, - --######## COMMERCIAL WORKSTATION CONSOLES -+# Tested with Windows 2000, the telnet application runs in a console window, -+# also using 'Terminal' font. - # -+# Other notes: -+# a) This version has no function keys or numeric keypad. Unlike the older -+# version, the numeric keypad is entirely ignored. -+# b) The program sets $TERM to "ansi", which of course is inaccurate. -+ms-vt100-color|vtnt|windows 2000 ansi (sic), -+ bce, -+ dch=\E[%p1%dP, ich=\E[%p1%d@, use=ecma+color, -+ use=ms-vt100, - --#### Alpha consoles -+# Based on comments from Federico Bianchi: -+# -+# vt100+ is basically a VT102-noSGR with ANSI.SYS colors and a different -+# scheme for PF keys. -+# -+# and PuTTY wishlist: -+# -+# The modifiers are represented as the codes listed above, prefixed to -+# the normal sequences. If the modifier is pressed alone, its sequence -+# is transmitted twice in succession. If multiple modifiers apply, -+# they're transmitted in the order shift, control, alt. - # -+# Shift \E^S -+# Alt \E^A, -+# Ctrl \E^C, -+ms-vt100+|vt100+|windows XP vt100+ (sic), -+ kdch1=\E-, kend=\Ek, kf1=\E1, kf10=\E0, kf11=\E!, kf12=\E@, -+ kf13=\E\023\E1, kf14=\E\023\E2, kf15=\E\023\E3, -+ kf16=\E\023\E4, kf17=\E\023\E5, kf18=\E\023\E6, -+ kf19=\E\023\E7, kf2=\E2, kf20=\E\023\E8, kf21=\E\023\E9, -+ kf22=\E\023\E0, kf23=\E\023\E!, kf24=\E\023\E@, -+ kf25=\E\003\E1, kf26=\E\003\E2, kf27=\E\003\E3, -+ kf28=\E\003\E4, kf29=\E\003\E5, kf3=\E3, kf30=\E\003\E6, -+ kf31=\E\003\E7, kf32=\E\003\E8, kf33=\E\003\E9, -+ kf34=\E\003\E0, kf35=\E\003\E!, kf36=\E\003\E@, -+ kf37=\E\001\E1, kf38=\E\001\E2, kf39=\E\001\E3, kf4=\E4, -+ kf40=\E\001\E4, kf41=\E\001\E5, kf42=\E\001\E6, -+ kf43=\E\001\E7, kf44=\E\001\E8, kf45=\E\001\E9, -+ kf46=\E\001\E0, kf47=\E\001\E!, kf48=\E\001\E@, kf5=\E5, -+ kf6=\E6, kf7=\E7, kf8=\E8, kf9=\E9, khome=\Eh, kich1=\E+, -+ knp=\E/, kpp=\E?, use=ms-vt100-color, - --# This is from the OSF/1 Release 1.0 termcap file --pccons|pcconsole|ANSI (mostly) Alpha PC console terminal emulation, -- am, xon, -- cols#80, lines#25, -- bel=^G, clear=\E[H\E[2J, cr=^M, cub1=^H, cud1=^J, cuf1=\E[C, -- cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, dch1=\E[P, dl1=\E[M, -- el=\E[K, home=\E[H, ht=^I, ich1=\E[@, il1=\E[L, kbs=^H, -- kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, khome=\E[H, -- nel=^M^J, rev=\E[7m, rmso=\E[m, sgr0=\E[m, smso=\E[7m, -+ms-vt-utf8|vt-utf8|UTF-8 flavor of vt100+, -+ use=ms-vt100+, - --#### Sun consoles -+# expect-5.44.1.15/example/tkterm -+# a minimal subset of a vt100 (compare with "news-unk). - # -+# The missing "=" in smkx is not a typo (here), but an error in tkterm. -+tt|tkterm|Don Libes' tk text widget terminal emulator, -+ clear=\E[H\E[J, cr=^M, cub1=^H, cud1=^J, cuf1=\E[C, -+ cup=\E[%p1%d;%p2%dH, cuu1=\E[A, ind=^J, kf1=\EOP, kf2=\EOQ, -+ kf3=\EOR, kf4=\EOS, kf5=\EOT, kf6=\EOU, kf7=\EOV, kf8=\EOW, -+ kf9=\EOX, rmkx=\E[?1l\E>, rmso=\E[m, smkx=\E[?1h\E, -+ smso=\E[7m, - --# :is1: resets scrolling region in case a previous user had used "tset vt100" --oldsun|Sun Microsystems Workstation console, -- OTbs, am, km, mir, msgr, -- cols#80, it#8, lines#34, -- bel=^G, clear=^L, cr=^M, cub1=^H, cud1=\E[B, cuf1=\E[C, -- cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, dch=\E[%p1%dP, -- dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[K, ht=^I, -- ich=\E[%p1%d@, ich1=\E[@, il=\E[%p1%dL, il1=\E[L, ind=^J, -- is1=\E[1r, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, -- kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, khome=\E[H, -- rmso=\E[m, sgr0=\E[m, smso=\E[7m, --# From: Alexander Lukyanov <lav@video.yars.free.net>, 14 Nov 1995 --# <lines> capability later corrected by J.T. Conklin <jtc@cygnus.com> --# SGR 1, 4 aren't supported - removed bold/underline (T.Dickey 17 Jan 1998) --sun-il|Sun Microsystems console with working insert-line, -- am, km, msgr, -- cols#80, lines#34, -- bel=^G, clear=^L, cr=^M, cub1=^H, cud1=^J, cuf1=\E[C, -- cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, dch=\E[%p1%dP, -- dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[K, ht=^I, -- ich=\E[%p1%d@, ich1=\E[@, il=\E[%p1%dL, il1=\E[L, ind=^J, -- kb2=\E[218z, kbs=^H, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, -- kcuu1=\E[A, kdch1=\177, kend=\E[220z, kf1=\E[224z, -- kf10=\E[233z, kf11=\E[234z, kf12=\E[235z, kf2=\E[225z, -- kf3=\E[226z, kf4=\E[227z, kf5=\E[228z, kf6=\E[229z, -- kf7=\E[230z, kf8=\E[231z, kf9=\E[232z, khome=\E[214z, -- knp=\E[222z, kopt=\E[194z, kpp=\E[216z, kres=\E[193z, -- kund=\E[195z, rev=\E[7m, rmso=\E[m, rmul@, rs2=\E[s, -- sgr=\E[0%?%p1%p3%|%t;7%;m, sgr0=\E[m, smso=\E[7m, -- u8=\E[1t, u9=\E[11t, --# On some versions of CGSIX framebuffer firmware (SparcStation 5), <il1>/<il> --# flake out on the last line. Unfortunately, without them the terminal has no --# way to scroll. --sun-cgsix|sun-ss5|Sun SparcStation 5 console, -- il@, il1@, use=sun-il, --# If you are using an SS5, change the sun definition to use sun-ss5. --sun|sun1|sun2|Sun Microsystems Inc. workstation console, -- use=sun-il, -+######## X TERMINAL EMULATORS -+#### XTERM -+# -+# You can add the following line to your .Xdefaults to change the terminal type -+# set by the xterms you start up to my-xterm: -+# -+# *termName: my-xterm -+# -+# System administrators can change the default entry for xterm instances -+# by adding a similar line to /usr/X11/lib/X11/app-defaults/XTerm. In either -+# case, xterm will detect and reject an invalid terminal type, falling back -+# to the default of xterm. -+# - --# From: <john@ucbrenoir> Tue Sep 24 13:14:44 1985 --sun-s|Sun Microsystems Workstation window with status line, -- hs, -- dsl=\E]l\E\\, fsl=\E\\, tsl=\E]l, use=sun, --sun-e-s|sun-s-e|Sun Microsystems Workstation with status hacked for emacs, -- hs, -- dsl=\E]l\E\\, fsl=\E\\, tsl=\E]l, use=sun-e, --sun-48|Sun 48-line window, -- cols#80, lines#48, use=sun, --sun-34|Sun 34-line window, -- cols#80, lines#34, use=sun, --sun-24|Sun 24-line window, -- cols#80, lines#24, use=sun, --sun-17|Sun 17-line window, -- cols#80, lines#17, use=sun, --sun-12|Sun 12-line window, -- cols#80, lines#12, use=sun, --sun-1|Sun 1-line window for sysline, -- eslok, hs, -- cols#80, lines#1, -- dsl=^L, fsl=\E[K, tsl=^M, use=sun, --sun-e|sun-nic|sune|Sun Microsystems Workstation without insert character, -- ich1@, rmir@, smir@, use=sun, --sun-c|sun-cmd|Sun Microsystems Workstation console with scrollable history, -- lines#35, -- rmcup=\E[>4h, smcup=\E[>4l, use=sun, --sun-type4|Sun Workstation console with type 4 keyboard, -- kcub1=\E[217z, kcud1=\E[221z, kcuf1=\E[219z, -- kcuu1=\E[215z, use=sun-il, -- --# Most of the current references to sun-color are from users wondering why this --# is the default on install. Details from reading the wscons manpage, adding --# cub, etc., here (rather than in the base sun-il entry) since it is not clear --# when those were added -TD (2005-05-28) --# --# According to wscons manpage, color is supported only on IA systems. --# Sun's terminfo entry documents bold and smul/rmul capabilities, but wscons --# does not list these. It also sets ncv#3, however that corresponds to --# underline and standout. --# --# Since the documentation and terminfo do not agree, see also current code at --# http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/uts/common/io/tem_safe.c --# --# That (actually a different driver which "supports" sun-color) also supports --# these features: --# vpa=\E[%i%p1%dd --# hpa=\E[%i%p1%d` --# cbt=\E[Z --# dim=\E[2m --# blink=\E[5m --# It supports bold, but not underline -TD (2009-09-19) --sun-color|Sun Microsystems Workstation console with color support (IA systems), -- colors#8, ncv#3, pairs#64, -- cub=\E[%p1%dD, cud=\E[%p1%dB, cuf=\E[%p1%dC, -- cuu=\E[%p1%dA, home=\E[H, op=\E[0m, setab=\E[4%p1%dm, -- setaf=\E[3%p1%dm, -+# X10/6.6 11/7/86, minus alternate screen, plus (csr) -+# (xterm: ":MT:" changed to ":km:"; added <smam>/<rmam> based on init string; -+# removed (hs, eslok, tsl=\E[?E\E[?%i%dT, fsl=\E[?F, dsl=\E[?E) -+# as these seem not to work -- esr) -+x10term|vs100-x10|xterm terminal emulator (X10 window system), -+ OTbs, am, km, mir, msgr, xenl, xon, -+ cols#80, it#8, lines#65, -+ bold=\E[1m, clear=\E[H\E[2J, csr=\E[%i%p1%d;%p2%dr, -+ cub1=^H, cud1=^J, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, -+ cuu1=\E[A, dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, -+ dl1=\E[M, ed=\E[J, el=\E[K, home=\E[H, ht=^I, il=\E[%p1%dL, -+ il1=\E[L, ind=^J, is2=\E\E[m\E[?7h\E[?1;4l, kbs=^H, -+ kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kf1=\EOP, -+ kf2=\EOQ, kf3=\EOR, kf4=\EOS, rev=\E[7m, ri=\EM, rmam=\E[?7l, -+ rmir=\E[4l, rmkx=\E[?1l\E>, rmso=\E[m, rmul=\E[m, -+ sgr0=\E[m, smam=\E[?7h, smir=\E[4h, smkx=\E[?1h\E=, -+ smso=\E[7m, smul=\E[4m, -+# Compatible with the R5 xterm -+# (from the XFree86 3.2 distribution, <blink=@> removed) -+# added khome/kend, rmir/smir, rmul/smul, hts based on the R5 xterm code - TD -+# corrected typos in rs2 string - TD -+# added u6-u9 -TD -+xterm-r5|xterm R5 version, -+ OTbs, am, km, msgr, xenl, -+ cols#80, it#8, lines#24, -+ bel=^G, bold=\E[1m, clear=\E[H\E[2J, cr=^M, -+ csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, -+ cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, -+ cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, -+ dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, -+ el=\E[K, home=\E[H, ht=^I, hts=\EH, ich=\E[%p1%d@, ich1=\E[@, -+ il=\E[%p1%dL, il1=\E[L, ind=^J, kbs=^H, kcub1=\EOD, -+ kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kdch1=\E[3~, -+ kdl1=\E[31~, kel=\E[8~, kend=\E[4~, kf0=\EOq, kf1=\E[11~, -+ kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf2=\E[12~, -+ kf3=\E[13~, kf4=\E[14~, kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, -+ kf8=\E[19~, kf9=\E[20~, khome=\E[1~, kich1=\E[2~, -+ kil1=\E[30~, kmous=\E[M, knp=\E[6~, kpp=\E[5~, rc=\E8, -+ rev=\E[7m, ri=\EM, rmir=\E[4l, rmkx=\E[?1l\E>, rmso=\E[m, -+ rmul=\E[m, -+ rs2=\E>\E[?1;3;4;5;6l\E[4l\E[?7h\E[m\E[r\E[2J\E[H, -+ sc=\E7, -+ sgr=\E[%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;m, -+ sgr0=\E[m, smir=\E[4h, smkx=\E[?1h\E=, smso=\E[7m, -+ smul=\E[4m, tbc=\E[3g, use=vt100+enq, -+# Compatible with the R6 xterm -+# (from XFree86 3.2 distribution, <acsc> and <it> added, <blink@> removed) -+# added khome/kend, hts based on the R6 xterm code - TD -+# (khome/kend do not actually work in X11R5 or X11R6, but many people use this -+# for compatibility with other emulators). -+xterm-r6|xterm X11R6 version, -+ OTbs, am, km, mir, msgr, xenl, -+ cols#80, it#8, lines#24, -+ acsc=``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -+ bel=^G, bold=\E[1m, clear=\E[H\E[2J, cr=^M, -+ csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, -+ cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, -+ cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, -+ dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, -+ el=\E[K, enacs=\E)0, home=\E[H, ht=^I, hts=\EH, il=\E[%p1%dL, -+ il1=\E[L, ind=^J, -+ is2=\E[m\E[?7h\E[4l\E>\E7\E[r\E[?1;3;4;6l\E8, kbs=^H, -+ kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, -+ kdch1=\E[3~, kf1=\E[11~, kf10=\E[21~, kf11=\E[23~, -+ kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, kf15=\E[28~, -+ kf16=\E[29~, kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, -+ kf2=\E[12~, kf20=\E[34~, kf3=\E[13~, kf4=\E[14~, -+ kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, -+ kfnd=\E[1~, kich1=\E[2~, kmous=\E[M, knp=\E[6~, kpp=\E[5~, -+ kslt=\E[4~, meml=\El, memu=\Em, rc=\E8, rev=\E[7m, ri=\EM, -+ rmacs=^O, rmcup=\E[2J\E[?47l\E8, rmir=\E[4l, -+ rmkx=\E[?1l\E>, rmso=\E[m, rmul=\E[m, -+ rs2=\E[m\E[?7h\E[4l\E>\E7\E[r\E[?1;3;4;6l\E8, sc=\E7, -+ sgr0=\E[m, smacs=^N, smcup=\E7\E[?47h, smir=\E[4h, -+ smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, tbc=\E[3g, -+ use=vt100+enq, -+xterm-old|antique xterm version, -+ use=xterm-r6, -+# This is the base xterm entry for the xterm supplied with XFree86 3.2 & up. -+# The name has been changed and some aliases have been removed. -+xterm-xf86-v32|xterm terminal emulator (XFree86 3.2 Window System), -+ OTbs, am, bce, km, mir, msgr, xenl, XT, -+ cols#80, it#8, lines#24, ncv@, -+ acsc=``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -+ bel=^G, bold=\E[1m, cbt=\E[Z, civis=\E[?25l, -+ clear=\E[H\E[2J, cnorm=\E[?25h, cr=^M, -+ csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, -+ cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, -+ cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, -+ dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, -+ ech=\E[%p1%dX, ed=\E[J, el=\E[K, el1=\E[1K, enacs=\E(B\E)0, -+ flash=\E[?5h$<100/>\E[?5l, home=\E[H, hpa=\E[%i%p1%dG, -+ ht=^I, hts=\EH, ich=\E[%p1%d@, ich1=\E[@, il=\E[%p1%dL, -+ il1=\E[L, ind=^J, -+ is2=\E7\E[r\E[m\E[?7h\E[?1;3;4;6l\E[4l\E8\E>, -+ kbeg=\EOE, kbs=^H, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, -+ kcuu1=\EOA, kdch1=\177, kend=\EOF, kf1=\E[11~, kf10=\E[21~, -+ kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, -+ kf15=\E[28~, kf16=\E[29~, kf17=\E[31~, kf18=\E[32~, -+ kf19=\E[33~, kf2=\E[12~, kf20=\E[34~, kf3=\E[13~, -+ kf4=\E[14~, kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, -+ kf9=\E[20~, kfnd=\E[1~, khome=\EOH, kich1=\E[2~, -+ kmous=\E[M, knp=\E[6~, kpp=\E[5~, kslt=\E[4~, meml=\El, -+ memu=\Em, rc=\E8, rev=\E[7m, ri=\EM, rmacs=^O, rmam=\E[?7l, -+ rmcup=\E[2J\E[?47l\E8, rmir=\E[4l, rmkx=\E[?1l\E>, -+ rmso=\E[27m, rmul=\E[24m, rs1=^O, -+ rs2=\E7\E[r\E8\E[m\E[?7h\E[?1;3;4;6l\E[4l\E>, sc=\E7, - setb=\E[4%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m, - setf=\E[3%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m, -- use=sun, -- --#### Iris consoles --# -+ sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;, -+ sgr0=\E[m\017, smacs=^N, smam=\E[?7h, smcup=\E7\E[?47h, -+ smir=\E[4h, smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, -+ tbc=\E[3g, vpa=\E[%i%p1%dd, use=vt100+enq, -+ use=ecma+color, use=vt220+keypad, - --# (wsiris: this had extension capabilities --# :HS=\E7F2:HE=\E7F7:\ --# :CT#2:CZ=*Bblack,red,green,yellow,blue,magenta,cyan,*Fwhite: --# See the note on Iris extensions near the end of this file. --# Finally, removed suboptimal <clear>=\EH\EJ and added <cud1> & --# <flash> from BRL -- esr) --wsiris|iris40|iris emulating a 40 line visual 50 (approximately), -- OTbs, OTnc, OTpt, am, -- OTkn#3, cols#80, it#8, lines#40, -- OTnl=\EB, bel=^G, clear=\Ev, cnorm=\E>, cub1=^H, cud1=\EB, -- cuf1=\EC, cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, -- cvvis=\E;, dim=\E7F2, dl1=\EM, ed=\EJ, el=\EK, -- flash=\E7F4\E7B1\013\E7F7\E7B0, home=\EH, ht=^I, il1=\EL, -- ind=^J, is2=\E7B0\E7F7\E7C2\E7R3, kcub1=\ED, kcud1=\EB, -- kcuf1=\EC, kcuu1=\EA, kf0=\E0, kf1=\E1, kf2=\E2, kf3=\E3, -- kf4=\E4, kf5=\E5, kf6=\E6, kf7=\E7, kf8=\E8, kf9=\E9, ri=\EI, -- rmso=\E0@, rmul=\E7R3\E0@, sgr0=\E7F7, smso=\E9P, -- smul=\E7R2\E9P, -+# This is the stock xterm entry supplied with XFree86 3.3, which uses VT100 -+# codes for F1-F4 except while in VT220 mode. -+xterm-xf86-v33|xterm terminal emulator (XFree86 3.3 Window System), -+ kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, use=xterm-xf86-v32, - --#### NeWS consoles --# --# Console terminal windows under the NeWS (Sun's Display Postscript windowing --# environment). Note: these have nothing to do with Sony's News workstation --# line. --# -+# This version was released in XFree86 3.3.3 (November 1998). -+# Besides providing printer support, it exploits a new feature that allows -+# xterm to use terminfo-based descriptions with the titeInhibit resource. -+# -- the distribution contained incorrect khome/kend values -TD -+xterm-xf86-v333|xterm terminal emulator (XFree86 3.3.3 Window System), -+ blink=\E[5m, ich1@, invis=\E[8m, -+ is2=\E[!p\E[?3;4l\E[4l\E>, kdch1=\E[3~, kfnd@, kslt@, -+ rmcup=\E[?1047l\E[?1048l, rs1=\Ec, -+ rs2=\E[!p\E[?3;4l\E[4l\E>, -+ sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, -+ smcup=\E[?1048h\E[?1047h, use=ansi+pp, -+ use=xterm-xf86-v33, - --# Entry for NeWS's psterm from Eric Messick & Hugh Daniel --# (psterm: unknown ":sl=\EOl:el=\ENl:" removed -- esr) --psterm|psterm-basic|NeWS psterm-80x34, -- OTbs, am, hs, km, ul, -- cols#80, it#8, lines#34, -- blink=\EOb, bold=\EOd, clear=^L, csr=\EE%p1%d;%p2%d;, -- cub1=\ET, cud1=\EP, cuf1=\EV, cup=\E%p1%d;%p2%d;, cuu1=\EY, -- dch1=\EF, dl1=\EK, ed=\EB, el=\EC, flash=\EZ, fsl=\ENl, -- home=\ER, ht=^I, il1=\EA, ind=\EW, is1=\EN*, kcub1=\E[D, -- kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, ll=\EU, rc=^\, rev=\EOr, -- ri=\EX, rmcup=\ENt, rmir=\ENi, rmso=\ENo, rmul=\ENu, sc=^], -- sgr0=\EN*, smcup=\EOt, smir=\EOi, smso=\EOo, smul=\EOu, -- tsl=\EOl, --psterm-96x48|NeWS psterm 96x48, -- cols#96, lines#48, use=psterm, --psterm-90x28|NeWS psterm 90x28, -- cols#90, lines#28, use=psterm, --psterm-80x24|NeWS psterm 80x24, -- cols#80, lines#24, use=psterm, --# This is a faster termcap for psterm. Warning: if you use this termcap, --# some control characters you type will do strange things to the screen. --# (psterm-fast: unknown ":sl=^Ol:el=^Nl:" -- esr) --psterm-fast|NeWS psterm fast version (flaky ctrl chars), -- OTbs, am, hs, km, ul, -- cols#80, it#8, lines#34, -- blink=^Ob, bold=^Od, clear=^L, csr=\005%p1%d;%p2%d;, -- cub1=^T, cud1=^P, cuf1=^V, cup=\004%p1%d;%p2%d;, cuu1=^Y, -- dch1=^F, dl1=^K, ed=^B, el=^C, flash=^Z, fsl=^Nl, home=^R, ht=^I, -- il1=^A, ind=^W, is1=^N*, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, -- kcuu1=\E[A, ll=^U, rc=^\, rev=^Or, ri=^X, rmcup=^Nt, rmir=^Ni, -- rmso=^No, rmul=^Nu, sc=^], sgr0=^N*, smcup=^Ot, smir=^Oi, -- smso=^Oo, smul=^Ou, tsl=^Ol, -+# This version was released in XFree86 4.0. -+xterm-xf86-v40|xterm terminal emulator (XFree86 4.0 Window System), -+ npc, -+ kDC=\E[3;5~, kEND=\EO5F, kHOM=\EO5H, kIC=\E[2;5~, -+ kLFT=\EO5D, kNXT=\E[6;5~, kPRV=\E[5;5~, kRIT=\EO5C, ka1@, -+ ka3@, kb2=\EOE, kc1@, kc3@, kcbt=\E[Z, kdch1=\E[3~, kend=\EOF, -+ kf13=\EO2P, kf14=\EO2Q, kf15=\EO2R, kf16=\EO2S, -+ kf17=\E[15;2~, kf18=\E[17;2~, kf19=\E[18;2~, -+ kf20=\E[19;2~, kf21=\E[20;2~, kf22=\E[21;2~, -+ kf23=\E[23;2~, kf24=\E[24;2~, kf25=\EO5P, kf26=\EO5Q, -+ kf27=\EO5R, kf28=\EO5S, kf29=\E[15;5~, kf30=\E[17;5~, -+ kf31=\E[18;5~, kf32=\E[19;5~, kf33=\E[20;5~, -+ kf34=\E[21;5~, kf35=\E[23;5~, kf36=\E[24;5~, kf37=\EO6P, -+ kf38=\EO6Q, kf39=\EO6R, kf40=\EO6S, kf41=\E[15;6~, -+ kf42=\E[17;6~, kf43=\E[18;6~, kf44=\E[19;6~, -+ kf45=\E[20;6~, kf46=\E[21;6~, kf47=\E[23;6~, -+ kf48=\E[24;6~, khome=\EOH, rmcup=\E[?1049l, -+ sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;, -+ smcup=\E[?1049h, use=xterm-xf86-v333, - --#### NeXT consoles --# --# Use `glasstty' for the Workspace application --# -+# This version was released in XFree86 4.3. -+xterm-xf86-v43|xterm terminal emulator (XFree86 4.3 Window System), -+ kDC=\E[3;2~, kEND=\E[1;2F, kHOM=\E[1;2H, kIC=\E[2;2~, -+ kLFT=\E[1;2D, kNXT=\E[6;2~, kPRV=\E[5;2~, kRIT=\E[1;2C, -+ kbeg@, -+ sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, -+ use=xterm-xf86-v40, - --# From: Dave Wetzel <dave@turbocat.snafu.de> 22 Dec 1995 --next|NeXT console, -- am, xt, -- cols#80, it#8, lines#24, -- bel=^G, clear=^L, cr=^M, cub1=^H, cud1=^J, cuf1=\E[C, -- cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, el=\E[K, home=\E[H, -- ht=^I, ind=^J, kbs=^H, kcub1=^H, kcud1=^J, nel=^M^J, -- rmso=\E[4;1m, sgr0=\E[m, smso=\E[4;2m, --nextshell|NeXT Shell application, -- am, -- cols#80, -- bel=^G, cr=^M, cub1=^H, cud1=^J, ht=^I, kbs=^H, kcub1=^H, -- kcud1=^J, nel=^M^J, -+# This version was released in XFree86 4.4. -+xterm-xf86-v44|xterm terminal emulator (XFree86 4.4 Window System), -+ cnorm=\E[?12l\E[?25h, cvvis=\E[?12;25h, indn=\E[%p1%dS, -+ rin=\E[%p1%dT, use=xterm-xf86-v43, - --#### Sony NEWS workstations --# -+xterm-xfree86|xterm terminal emulator (XFree86), -+ use=xterm-xf86-v44, - --# (news-unk: this had :KB=news: -- esr) --news-unk|SONY NEWS vt100 emulator common entry, -- OTbs, OTpt, am, xenl, -- cols#80, -- OTnl=^J, bel=^G, blink=\E[5m, bold=\E[1m, clear=\E[H\E[2J, -- cr=^M, csr=\E[%i%p1%d;%p2%dr, cub1=^H, cud1=^J, cuf1=\E[C, -- cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, dl=\E[%p1%dM, dl1=\E[M, -- ed=\E[J, el=\E[K, home=\E[H, ht=^I, -- if=/usr/share/tabset/vt100, il=\E[%p1%dL, il1=\E[L, -- is2=\E[?7h\E[?1l\E[?3l\E7\E8, kbs=^H, kcub1=\EOD, -- kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kf0=\EOY, kf1=\EOP, -- kf2=\EOQ, kf3=\EOR, kf4=\EOS, kf5=\EOT, kf6=\EOU, kf7=\EOV, -- kf8=\EOW, kf9=\EOX, rc=\E8, rev=\E[7m, ri=\EM, -- rmkx=\E[?1l\E>, rmso=\E[m, rmul=\E[m, -- rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h\E[r, sc=\E7, -- sgr0=\E[m, smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, --# --# (news-29: this had :TY=ascii: --esr) --news-29, -- lines#29, use=news-unk, --# (news-29-euc: this had :TY=euc: --esr) --news-29-euc, -- use=news-29, --# (news-29-sjis: this had :TY=sjis: --esr) --news-29-sjis, -- use=news-29, --# --# (news-33: this had :TY=ascii: --esr) --news-33, -- lines#33, use=news-unk, --# (news-33-euc: this had :TY=euc: --esr) --news-33-euc, -- use=news-33, --# (news-33-sjis: this had :TY=sjis: --esr) --news-33-sjis, -- use=news-33, --# --# (news-42: this had :TY=ascii: --esr) --news-42, -- lines#42, use=news-unk, --# (news-42-euc: this had :TY=euc: --esr) --news-42-euc, -- use=news-42, --# (news-42-sjis: this had :TY=sjis: --esr) --news-42-sjis, -- use=news-42, -+# This version reflects the current xterm features. -+xterm-new|modern xterm terminal emulator, -+ npc, -+ indn=\E[%p1%dS, kb2=\EOE, kcbt=\E[Z, kent=\EOM, -+ rin=\E[%p1%dT, use=xterm+pcfkeys, use=xterm+tmux, -+ use=xterm-basic, -+ -+# This fragment is for people who cannot agree on what the backspace key -+# should send. -+xterm+kbs|fragment for backspace key, -+ kbs=^H, - # --# NEWS-OS old termcap entry -+# This fragment describes as much of XFree86 xterm's "pc-style" function -+# keys as will fit into terminfo's 60 function keys. -+# From ctlseqs.ms: -+# Code Modifiers -+# --------------------------------- -+# 2 Shift -+# 3 Alt -+# 4 Shift + Alt -+# 5 Control -+# 6 Shift + Control -+# 7 Alt + Control -+# 8 Shift + Alt + Control -+# --------------------------------- -+# The meta key may also be used as a modifier in this scheme, adding another -+# bit to the parameter. -+xterm+pcfkeys|fragment for PC-style fkeys, -+ use=xterm+app, use=xterm+pcf2, use=xterm+pcc2, -+ use=xterm+pce2, - # --# (news-old-unk: this had :KB=news:TY=sjis: --esr) --news-old-unk|SONY NEWS vt100 emulator common entry, -- OTbs, OTpt, am, xenl, -- cols#80, vt#3, -- OTnl=^J, bel=^G, blink=\E[5m, bold=\E[1m, clear=\E[;H\E[2J, -- cr=^M, csr=\E[%i%p1%d;%p2%dr, cub1=^H, cud1=^J, cuf1=\E[C, -- cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, ed=\E[J, el=\E[K, -- home=\E[H, ht=^I, if=/usr/share/tabset/vt100, kbs=^H, -- kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kf1=\EOP, -- kf2=\EOQ, kf3=\EOR, kf4=\EOS, rc=\E8, rev=\E[7m, ri=\EM, -- rmkx=\E[?1l\E>, rmso=\E[m, rmul=\E[m, -- rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sc=\E7, -- sgr0=\E[m, smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, -+xterm+noapp|fragment with cursor keys in normal mode, -+ kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kend=\E[F, -+ khome=\E[H, -+ -+xterm+app|fragment with cursor keys in application mode, -+ kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kend=\EOF, -+ khome=\EOH, - # --# (nwp512: this had :DE=^H:, which I think means <OTbs> --esr) --nwp512|news|nwp514|news40|vt100-bm|old sony vt100 emulator 40 lines, -- OTbs, -- lines#40, -- is2=\E7\E[r\E8\EE\EE\EE\EM\EM\EM\E[?7h\E[?1l\E[?3l\E7\E[1;40r\E8, -- use=news-old-unk, -+# The "PC-style" modifier scheme was introduced in xterm patch #94 (1999/3/27) -+# and revised in patch #167 (2002/8/24). Some other terminal emulators copied -+# the earlier scheme, as noted in the "use=" clauses in this file. - # --# (nwp512-a: this had :TY=ascii: and the alias vt100-bm --esr) --nwp512-a|nwp514-a|news-a|news42|news40-a|sony vt100 emulator 42 line, -- lines#42, -- is2=\E[?7h\E[?1l\E[?3l\E7\E[1;42r\E8, -- use=news-old-unk, -+# The original assignments from patch #94 for cursor-keys had some technical -+# issues: - # --# (nwp-512-o: this had :KB=nwp410:DE=^H: I interpret the latter as <OTbs>. --esr) --nwp512-o|nwp514-o|news-o|news40-o|vt100-bm-o|sony vt100 emulator 40 lines, -- OTbs, -- lines#40, -- is2=\E7\E[r\E8\EE\EE\EE\EM\EM\EM\E[?7h\E[?1l\E[?3l\E7\E[1;40r\E8, -- use=news-old-unk, -+# A parameter for a function-key to represent a modifier is just more -+# bits. But for a cursor-key it may change the behavior of the -+# application. For instance, emacs decodes the first parameter of a -+# cursor-key as a repeat count. - # --# (nwp513: this had :DE=^H: and the alias vt100-bm --esr) --nwp513|nwp518|nwe501|newscbm|news31|sony vt100 emulator 33 lines, -- OTbs, -- lines#31, -- is2=\E7\E[r\E8\EE\EE\EE\EM\EM\EM\E[?7h\E[?1l\E[?3l\E7\E[1;31r\E8, -- use=news-old-unk, -+# A parameterized string should (really) not begin with SS3 (\EO). -+# Rather, CSI (\E[) should be used. - # --# (nwp513-a: this had :TY=ascii: and :DE=^H:, which I interpret as <OTbs>; --esr) --# also the alias vt100-bm. --nwp513-a|nwp518-a|nwe501-a|nwp251-a|newscbm-a|news31-a|newscbm33|news33|old sony vt100 emulator 33 lines, -- OTbs, -- lines#33, -- is2=\E7\E[r\E8\EE\EE\EE\EM\EM\EM\E[?7h\E[?1l\E[?3l\E7\E[1;33r\E8, -- use=news-old-unk, -+# For these reasons, the original assignments were deprecated. For -+# compatibility reasons, they are still available as a setting of xterm's -+# modifyCursorKeys resource. These fragments list the modified cursor-keys -+# that might apply to xterm+pcfkeys with different values of that resource. -+xterm+pcc3|fragment with modifyCursorKeys:3, -+ kLFT=\E[>1;2D, kRIT=\E[>1;2C, kind=\E[>1;2B, -+ kri=\E[>1;2A, kDN=\E[>1;2B, kDN3=\E[>1;3B, kDN4=\E[>1;4B, -+ kDN5=\E[>1;5B, kDN6=\E[>1;6B, kDN7=\E[>1;7B, -+ kLFT3=\E[>1;3D, kLFT4=\E[>1;4D, kLFT5=\E[>1;5D, -+ kLFT6=\E[>1;6D, kLFT7=\E[>1;7D, kRIT3=\E[>1;3C, -+ kRIT4=\E[>1;4C, kRIT5=\E[>1;5C, kRIT6=\E[>1;6C, -+ kRIT7=\E[>1;7C, kUP=\E[>1;2A, kUP3=\E[>1;3A, -+ kUP4=\E[>1;4A, kUP5=\E[>1;5A, kUP6=\E[>1;6A, -+ kUP7=\E[>1;7A, -+ -+xterm+pcc2|fragment with modifyCursorKeys:2, -+ kLFT=\E[1;2D, kRIT=\E[1;2C, kind=\E[1;2B, kri=\E[1;2A, -+ kDN=\E[1;2B, kDN3=\E[1;3B, kDN4=\E[1;4B, kDN5=\E[1;5B, -+ kDN6=\E[1;6B, kDN7=\E[1;7B, kLFT3=\E[1;3D, kLFT4=\E[1;4D, -+ kLFT5=\E[1;5D, kLFT6=\E[1;6D, kLFT7=\E[1;7D, -+ kRIT3=\E[1;3C, kRIT4=\E[1;4C, kRIT5=\E[1;5C, -+ kRIT6=\E[1;6C, kRIT7=\E[1;7C, kUP=\E[1;2A, kUP3=\E[1;3A, -+ kUP4=\E[1;4A, kUP5=\E[1;5A, kUP6=\E[1;6A, kUP7=\E[1;7A, -+ -+xterm+pcc1|fragment with modifyCursorKeys:1, -+ kLFT=\E[2D, kRIT=\E[2C, kind=\E[2B, kri=\E[2A, kDN=\E[2B, -+ kDN3=\E[3B, kDN4=\E[4B, kDN5=\E[5B, kDN6=\E[6B, kDN7=\E[7B, -+ kLFT3=\E[3D, kLFT4=\E[4D, kLFT5=\E[5D, kLFT6=\E[6D, -+ kLFT7=\E[7D, kRIT3=\E[3C, kRIT4=\E[4C, kRIT5=\E[5C, -+ kRIT6=\E[6C, kRIT7=\E[7C, kUP=\E[2A, kUP3=\E[3A, -+ kUP4=\E[4A, kUP5=\E[5A, kUP6=\E[6A, kUP7=\E[7A, -+ -+xterm+pcc0|fragment with modifyCursorKeys:0, -+ kLFT=\EO2D, kRIT=\EO2C, kind=\EO2B, kri=\EO2A, kDN=\EO2B, -+ kDN3=\EO3B, kDN4=\EO4B, kDN5=\EO5B, kDN6=\EO6B, kDN7=\EO7B, -+ kLFT3=\EO3D, kLFT4=\EO4D, kLFT5=\EO5D, kLFT6=\EO6D, -+ kLFT7=\EO7D, kRIT3=\EO3C, kRIT4=\EO4C, kRIT5=\EO5C, -+ kRIT6=\EO6C, kRIT7=\EO7C, kUP=\EO2A, kUP3=\EO3A, -+ kUP4=\EO4A, kUP5=\EO5A, kUP6=\EO6A, kUP7=\EO7A, -+ - # --# (nwp513-o: had :DE=^H:, I think that's <OTbs>; also the alias vt100-bm --esr) --nwp513-o|nwp518-o|nwe501-o|nwp251-o|newscbm-o|news31-o|old sony vt100 emulator 33 lines, -- OTbs, -- lines#31, -- is2=\E7\E[r\E8\EE\EE\EE\EM\EM\EM\E[?7h\E[?1l\E[?3l\E7\E[1;31r\E8, -- use=news-old-unk, -+# Here are corresponding fragments from xterm patch #216: - # --# (news28: this had :DE=^H:, I think that's <OTbs>, and :KB=nws1200: --esr) --news28|sony vt100 emulator 28 lines, -- OTbs, -- lines#28, -- is2=\E7\E[r\E8\EE\EE\EE\EM\EM\EM\E[?7h\E[?1l\E[?3l\E7\E[1;28r\E8, -- use=news-old-unk, -+xterm+pcf0|fragment with modifyFunctionKeys:0, -+ kf1=\EOP, kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, -+ kf13=\EO2P, kf14=\EO2Q, kf15=\EO2R, kf16=\EO2S, -+ kf17=\E[15;2~, kf18=\E[17;2~, kf19=\E[18;2~, kf2=\EOQ, -+ kf20=\E[19;2~, kf21=\E[20;2~, kf22=\E[21;2~, -+ kf23=\E[23;2~, kf24=\E[24;2~, kf25=\EO5P, kf26=\EO5Q, -+ kf27=\EO5R, kf28=\EO5S, kf29=\E[15;5~, kf3=\EOR, -+ kf30=\E[17;5~, kf31=\E[18;5~, kf32=\E[19;5~, -+ kf33=\E[20;5~, kf34=\E[21;5~, kf35=\E[23;5~, -+ kf36=\E[24;5~, kf37=\EO6P, kf38=\EO6Q, kf39=\EO6R, -+ kf4=\EOS, kf40=\EO6S, kf41=\E[15;6~, kf42=\E[17;6~, -+ kf43=\E[18;6~, kf44=\E[19;6~, kf45=\E[20;6~, -+ kf46=\E[21;6~, kf47=\E[23;6~, kf48=\E[24;6~, kf49=\EO3P, -+ kf5=\E[15~, kf50=\EO3Q, kf51=\EO3R, kf52=\EO3S, -+ kf53=\E[15;3~, kf54=\E[17;3~, kf55=\E[18;3~, -+ kf56=\E[19;3~, kf57=\E[20;3~, kf58=\E[21;3~, -+ kf59=\E[23;3~, kf6=\E[17~, kf60=\E[24;3~, kf61=\EO4P, -+ kf62=\EO4Q, kf63=\EO4R, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, - # --# (news29: this had :TY=ascii:KB=nws1200:\ --esr) --news29|news28-a|sony vt100 emulator 29 lines, -- lines#29, -- is2=\E7\E[r\E8\EE\EE\EE\EM\EM\EM\E[?7h\E[?1l\E[?3l\E7\E[1;29r\E8, -- use=news-old-unk, -+xterm+pcf2|fragment with modifyFunctionKeys:2, -+ kf1=\EOP, kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, -+ kf13=\E[1;2P, kf14=\E[1;2Q, kf15=\E[1;2R, kf16=\E[1;2S, -+ kf17=\E[15;2~, kf18=\E[17;2~, kf19=\E[18;2~, kf2=\EOQ, -+ kf20=\E[19;2~, kf21=\E[20;2~, kf22=\E[21;2~, -+ kf23=\E[23;2~, kf24=\E[24;2~, kf25=\E[1;5P, kf26=\E[1;5Q, -+ kf27=\E[1;5R, kf28=\E[1;5S, kf29=\E[15;5~, kf3=\EOR, -+ kf30=\E[17;5~, kf31=\E[18;5~, kf32=\E[19;5~, -+ kf33=\E[20;5~, kf34=\E[21;5~, kf35=\E[23;5~, -+ kf36=\E[24;5~, kf37=\E[1;6P, kf38=\E[1;6Q, kf39=\E[1;6R, -+ kf4=\EOS, kf40=\E[1;6S, kf41=\E[15;6~, kf42=\E[17;6~, -+ kf43=\E[18;6~, kf44=\E[19;6~, kf45=\E[20;6~, -+ kf46=\E[21;6~, kf47=\E[23;6~, kf48=\E[24;6~, -+ kf49=\E[1;3P, kf5=\E[15~, kf50=\E[1;3Q, kf51=\E[1;3R, -+ kf52=\E[1;3S, kf53=\E[15;3~, kf54=\E[17;3~, -+ kf55=\E[18;3~, kf56=\E[19;3~, kf57=\E[20;3~, -+ kf58=\E[21;3~, kf59=\E[23;3~, kf6=\E[17~, kf60=\E[24;3~, -+ kf61=\E[1;4P, kf62=\E[1;4Q, kf63=\E[1;4R, kf7=\E[18~, -+ kf8=\E[19~, kf9=\E[20~, - # --# (news511: this had :TY=sjis: --esr) --nwp511|nwp-511|nwp-511 vt100, -- OTbs, OTpt, am, xenl, -- cols#80, lines#24, -- clear=\E[;H\E[2J$<20/>, cub1=\E[D, cud1=\E[B, cuf1=\E[C, -- cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A$<2/>, dl1=\E[M, -- ed=\E[J$<30/>, el=\E[K$<3/>, -- flash=\E[?5h\0\0\0\0\0\0\0\0\0\0\0\0\0\E[?5l, -- il1=\E[L, is2=\E[?5l\E[?1l\E>\E[?7h\E[?8h, kcub1=\E[D, -- kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kf1=\EOP, kf2=\EOQ, -- kf3=\EOR, kf4=\EOS, kf5=\EOT, kf6=\E#W, khome=\E[H, -- ri=\EM$<5/>, rmso=\E[m$<2/>, rmul=\E[m$<2/>, -- rs2=\E7\E[r\E8\E[?5l\E[?1l\E>\E[?7h\E[?8h, -- smso=\E[7m$<2/>, smul=\E[4m$<2/>, --# (news517: this had :TY=sjis:. --esr) --nwp517|nwp-517|nwp-517 vt200 80 cols 30 rows, -- eslok, hs, -- cols#80, lines#30, -- OTi2=\E[2$~\n, dsl=\E[1$~, fsl=\E[0$}, -- is2=\E7\E[r\E8\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, -- tsl=\E[1$}\E[;%df, use=vt200, --# (news517-w: this had :TY=sjis:. --esr) --nwp517-w|nwp-517-w|nwp-517 vt200 132 cols 50 rows, -- eslok, hs, -- cols#132, lines#50, -- OTi2=\E[2$~\n, dsl=\E[1$~, fsl=\E[0$}, -- is2=\E7\E[r\E8\E>\E[?3h\E[?4l\E[?5l\E[?7h\E[?8h, -- rs2=\E>\E[?3h\E[?4l\E[?5l\E[?7h\E[?8h, -- tsl=\E[1$}\E[;%df, use=vt200, -+# Chunks from xterm #230: -+xterm+pce2|fragment with modifyCursorKeys:2, -+ kDC=\E[3;2~, kEND=\E[1;2F, kHOM=\E[1;2H, kIC=\E[2;2~, -+ kNXT=\E[6;2~, kPRV=\E[5;2~, kich1=\E[2~, knp=\E[6~, -+ kpp=\E[5~, kDC3=\E[3;3~, kDC4=\E[3;4~, kDC5=\E[3;5~, -+ kDC6=\E[3;6~, kDC7=\E[3;7~, kEND3=\E[1;3F, kEND4=\E[1;4F, -+ kEND5=\E[1;5F, kEND6=\E[1;6F, kEND7=\E[1;7F, -+ kHOM3=\E[1;3H, kHOM4=\E[1;4H, kHOM5=\E[1;5H, -+ kHOM6=\E[1;6H, kHOM7=\E[1;7H, kIC3=\E[2;3~, kIC4=\E[2;4~, -+ kIC5=\E[2;5~, kIC6=\E[2;6~, kIC7=\E[2;7~, kNXT3=\E[6;3~, -+ kNXT4=\E[6;4~, kNXT5=\E[6;5~, kNXT6=\E[6;6~, -+ kNXT7=\E[6;7~, kPRV3=\E[5;3~, kPRV4=\E[5;4~, -+ kPRV5=\E[5;5~, kPRV6=\E[5;6~, kPRV7=\E[5;7~, -+ use=xterm+edit, - --#### Common Desktop Environment --# -+xterm+edit|fragment for 6-key editing-keypad, -+ kdch1=\E[3~, kich1=\E[2~, knp=\E[6~, kpp=\E[5~, -+ use=xterm+pc+edit, - --# This ships with Sun's CDE in Solaris 2.5 --# Corrected Sun Aug 9 1998 by Alexander V. Lukyanov <lav@video.yars.free.net> --dtterm|CDE desktop terminal, -- am, mir, msgr, xenl, xon, -- cols#80, it#8, lines#24, lm#0, ncv@, -- acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -- bel=^G, blink=\E[5m, bold=\E[1m, civis=\E[?25l, -- clear=\E[H\E[J, cnorm=\E[?25h, cr=^M, -+xterm+pc+edit|fragment for pc-style editing keypad, -+ kend=\E[4~, khome=\E[1~, -+ -+xterm+vt+edit|fragment for vt220-style editing keypad, -+ kfnd=\E[1~, kslt=\E[4~, -+ -+# -+# Those chunks use the new-style (the xterm oldFunctionKeys resource is false). -+# Alternatively, the same scheme with old-style function keys as in xterm-r6 -+# is shown here (because that is used in mrxvt and mlterm): -+xterm+r6f2|xterm with oldFunctionKeys and modifyFunctionKeys:2, -+ kf1=\E[11~, kf13=\E[11;2~, kf14=\E[12;2~, kf15=\E[13;2~, -+ kf16=\E[14;2~, kf2=\E[12~, kf25=\E[11;5~, kf26=\E[12;5~, -+ kf27=\E[13;5~, kf28=\E[14;5~, kf3=\E[13~, kf37=\E[11;6~, -+ kf38=\E[12;6~, kf39=\E[13;6~, kf4=\E[14~, kf40=\E[14;6~, -+ kf49=\E[11;3~, kf50=\E[12;3~, kf51=\E[13;3~, -+ kf52=\E[14;3~, kf61=\E[11;4~, kf62=\E[12;4~, -+ kf63=\E[13;4~, use=xterm+pcf2, -+# -+# This chunk is used for building the VT220/Sun/PC keyboard variants. -+xterm-basic|modern xterm terminal emulator - common, -+ OTbs, am, bce, km, mir, msgr, xenl, AX, XT, -+ colors#8, cols#80, it#8, lines#24, pairs#64, -+ acsc=``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -+ bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l, -+ clear=\E[H\E[2J, cnorm=\E[?12l\E[?25h, cr=^M, - csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, - cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, - cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, -- dch=\E[%p1%dP, dch1=\E[P, dim=\E[2m, dl=\E[%p1%dM, -+ cvvis=\E[?12;25h, dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, - dl1=\E[M, ech=\E[%p1%dX, ed=\E[J, el=\E[K, el1=\E[1K, -- enacs=\E(B\E)0, flash=\E[?5h$<200>\E[?5l, home=\E[H, -+ flash=\E[?5h$<100/>\E[?5l, home=\E[H, hpa=\E[%i%p1%dG, - ht=^I, hts=\EH, ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[L, -- ind=\ED, invis=\E[8m, is2=\E F\E>\E[?1l\E[?7h\E[?45l, -- kbs=^H, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, -- kdch1=\E[3~, kf1=\E[11~, kf10=\E[21~, kf11=\E[23~, -- kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, kf15=\E[28~, -- kf16=\E[29~, kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, -- kf2=\E[12~, kf20=\E[34~, kf3=\E[13~, kf4=\E[14~, -- kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, -- kfnd=\E[1~, khlp=\E[28~, kich1=\E[2~, knp=\E[6~, kpp=\E[5~, -- kslt=\E[4~, nel=\EE, rc=\E8, rev=\E[7m, ri=\EM, rmacs=^O, -- rmam=\E[?7l, rmir=\E[4l, rmso=\E[22;27m, rmul=\E[24m, -- sc=\E7, -- sgr=\E[0%?%p1%t;2;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p5%t;2%;%?%p6%t;1%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, -- sgr0=\E[m\017, smacs=^N, smam=\E[?7h, smir=\E[4h, -- smso=\E[2;7m, smul=\E[4m, tbc=\E[3g, use=ecma+color, -+ ind=^J, invis=\E[8m, is2=\E[!p\E[?3;4l\E[4l\E>, -+ kmous=\E[M, meml=\El, memu=\Em, op=\E[39;49m, rc=\E8, -+ rev=\E[7m, ri=\EM, rmacs=\E(B, rmam=\E[?7l, -+ rmcup=\E[?1049l, rmir=\E[4l, rmkx=\E[?1l\E>, -+ rmm=\E[?1034l, rmso=\E[27m, rmul=\E[24m, rs1=\Ec, -+ rs2=\E[!p\E[?3;4l\E[4l\E>, sc=\E7, setab=\E[4%p1%dm, -+ setaf=\E[3%p1%dm, -+ setb=\E[4%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m, -+ setf=\E[3%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m, -+ sgr=%?%p9%t\E(0%e\E(B%;\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p7%t;8%;m, -+ sgr0=\E(B\E[m, smacs=\E(0, smam=\E[?7h, smcup=\E[?1049h, -+ smir=\E[4h, smkx=\E[?1h\E=, smm=\E[?1034h, smso=\E[7m, -+ smul=\E[4m, tbc=\E[3g, vpa=\E[%i%p1%dd, E3=\E[3;J, -+ use=ansi+pp, use=xterm+kbs, use=vt100+enq, - --#### Non-Unix Consoles --# -+# From: David J. MacKenzie <djm@va.pubnix.com>, 14 Nov 1997 -+# In retrospect, something like xterm-r6 was intended here -TD -+xterm-xi|xterm on XI Graphics Accelerated X under BSD/OS 3.1, -+ rmso=\E[m, rmul=\E[m, use=xterm-xf86-v33, - --### EMX termcap.dat compatibility modes --# --# Also (possibly only EMX, so we don't put it in ansi.sys, etc): set the --# no_color_video to inform the application that standout(1), underline(2) --# reverse(4) and invisible(64) don't work with color. --emx-base|DOS special keys, -- bce, bw, -- it#8, ncv#71, -- bel=^G, use=ansi.sys, -+# 16-colors is one of the variants of XFree86 3.3 xterm, updated for 4.0 (T.Dickey) -+# If configured to support 88- or 256-colors (which is fairly common in 2009), -+# xterm also recognizes the control sequences for initc -TD -+xterm-16color|xterm with 16 colors like aixterm, -+ ccc, -+ initc=\E]4;%p1%d;rgb\:%p2%{255}%*%{1000}%/%2.2X/%p3%{255}%*%{1000}%/%2.2X/%p4%{255}%*%{1000}%/%2.2X\E\\, -+ use=ibm+16color, use=xterm-new, - --# Except for the "-emx" suffixes, these are as distributed with EMX 0.9b, --# a Unix-style environment used on OS/2. (Note that the suffix makes some --# names longer than 14 characters, the nominal maximum). -+# 256-colors is a compile-time feature of XFree86 xterm beginning with -+# patch #111 (1999/7/10) -TD -+xterm+256color|xterm 256-color feature, -+ ccc, -+ colors#256, pairs#32767, -+ initc=\E]4;%p1%d;rgb\:%p2%{255}%*%{1000}%/%2.2X/%p3%{255}%*%{1000}%/%2.2X/%p4%{255}%*%{1000}%/%2.2X\E\\, -+ setab=\E[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m, -+ setaf=\E[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m, -+ setb@, setf@, -+ -+# 88-colors is a compile-time feature of XFree86 xterm beginning with -+# patch #115 (1999/9/18) -TD - # --# Removed: rmacs=\E[10m, smacs=\E[11m, because OS/2 does not implement acs. --ansi-emx|ANSI.SYS color, -- am, bce, eo, mir, msgr, xon, -- colors#8, cols#80, it#8, lines#25, pairs#64, -- bel=^G, blink=\E[5m, bold=\E[1m, civis=\E[?25l, -- clear=\E[1;33;44m\E[H\E[J, cnorm=\E[?25h, cr=^M, cub1=^H, -- cud1=^J, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, -- dch=\E[%p1%dp, ed=\E[J, el=\E[K, flash=\E[?5h\E[?5l, -- home=\E[H, ht=^I, hts=\EH, ich=\E[%p1%d@, ich1=\E[@, ind=^J, -- kb2=\E[G, kbs=^H, kf0=\0D, kll=\0O, kspd=^Z, nel=^M^J, -- rev=\E[5;37;41m, rmir=\E[4l, rmpch=\E[10m, -- rmso=\E[0;44m\E[1;33m, rmul=\E[0;44m\E[1;33m, rs1=\Ec, -- setab=\E[4%p1%dm, setaf=\E[3%p1%dm, -- sgr0=\E[0m\E[1;33;44m, smir=\E[4h, smpch=\E[11m, -- smso=\E[0;31;47m, smul=\E[1;31;44m, tbc=\E[3g, u8=\E[?6c, -- u9=\E[c, use=emx-base, --# nice colors for Emacs (white on blue, mode line white on cyan) --ansi-color-2-emx|ANSI.SYS color 2, -- clear=\E[0;37;44m\E[H\E[J, rev=\E[1;37;46m, -- rmso=\E[0;37;44m, rmul=\E[0;37;44m, rs1=\Ec, -- setaf=\E[3%p1%dm, sgr0=\E[0;37;44m, smso=\E[1;37;46m, -- smul=\E[1;36;44m, use=ansi-emx, --# nice colors for Emacs (white on black, mode line black on cyan) --ansi-color-3-emx|ANSI.SYS color 3, -- clear=\E[0;37;40m\E[H\E[J, rev=\E[1;37;46m, -- rmso=\E[0;37;40m, rmul=\E[0;37;40m, rs1=\Ec, -- setaf=\E[3%p1%dm, sgr0=\E[0;10m, smso=\E[1;37;46m, -- smul=\E[0;36;40m, use=ansi-emx, --mono-emx|stupid monochrome ansi terminal with only one kind of emphasis, -- am, -- cols#80, it#8, lines#24, -- clear=\E[H\E[2J$<50>, cub1=\E[D, cud1=\E[B, cuf1=\E[C, -- cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, el=\E[K, home=\E[H, -- ht=^I, kb2=\E[G, kbs=^H, kcub1=\0K, kcud1=\0P, kcuf1=\0M, -- kcuu1=\0H, kf0=\0D, kf1=\0;, kf2=\0<, kf3=\0=, kf4=\0>, -- kf5=\0?, kf6=\0@, kf7=\0A, kf8=\0B, kf9=\0C, khome=\0G, -- kich1=\0R, kll=\0O, knp=\0Q, kpp=\0I, nel=^M^J, rev=\E[7m, -- sgr0=\E[0m, -+# Note that the escape sequences used are the same as for 256-colors - xterm -+# has a different table of default color resource values. If built for -+# 256-colors, it can still handle an 88-color palette by using the initc -+# capability. -+# -+# At this time (2007/7/14), except for rxvt 2.7.x, none of the other terminals -+# which support the xterm+256color feature support the associated initc -+# capability. So it is cancelled in the entries which use this and/or the -+# xterm+256color block. -+# -+# The default color palette for the 256- and 88-colors are different. A -+# given executable will have one palette (perhaps compiled-in). If the program -+# supports xterm's control sequence, it can be programmed using initc. -+xterm+88color|xterm 88-color feature, -+ colors#88, pairs#7744, use=xterm+256color, - --# Use this for cygwin32 (tested with beta 19.1) --# underline is colored bright magenta --# shifted kf1-kf12 are kf11-kf22 --cygwinB19|ansi emulation for cygwin32, -- kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, -- kdch1=\E[3~, kend=\E[4~, kf1=\E[[A, kf10=\E[21~, -- kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, -- kf15=\E[28~, kf16=\E[29~, kf17=\E[31~, kf18=\E[32~, -- kf19=\E[33~, kf2=\E[[B, kf20=\E[34~, kf3=\E[[C, kf4=\E[[D, -- kf5=\E[[E, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, -- khome=\E[1~, kich1=\E[2~, knp=\E[6~, kpp=\E[5~, rmam@, smam@, -- use=ansi.sys, -+# These variants of XFree86 3.9.16 xterm are built as a configure option. -+xterm-256color|xterm with 256 colors, -+ use=xterm+256color, use=xterm-new, -+xterm-88color|xterm with 88 colors, -+ use=xterm+88color, use=xterm-256color, - --# Use this for cygwin (tested with version 1.1.0). --# I've combined pcansi and linux. Some values of course were different and --# I've indicated which of these were and which I used. --# Cheers, earnie_boyd@yahoo.com --# several changes based on running with tack and comparing with older entry -TD --# more changes from csw: --# add cbt [backtab] --# remove eo [erase overstrike with blank] --# change clear was \E[H\E[J now \E[2J (faster?) --# remove cols --# remove lines --# remove ncv#3 [colors collide with highlights, bitmask] not applicable --# to MSDOS box? --# add cub [cursor back param] --# add cuf [cursor forward param] --# add cuu [cursor up param] --# add cud [cursor down param] --# add hs [has status line] --# add fsl [return from status line] --# add tsl [go to status line] --# add smacs [Start alt charset] (not sure if this works) --# add rmacs [End alt charset] (ditto) --# add smcup [enter_ca_mode] (save console; thanks Corinna) --# add rmcup [exit_ca_mode] (restore console; thanks Corinna) --# add kb2 [center of keypad] --# add u8 [user string 8] \E[?6c --# add el [clear to end of line] \E[K --# Notes: --# cnorm [make cursor normal] not implemented --# flash [flash] not implemented --# blink [blink] not implemented very usefully in cygwin? \E[5m --# dim [dim] not implemented very usefully in cygwin? \E[2m --# cub1 [cursor back 1] typically \E[D, but ^H is faster? --# kNXT [shifted next key] not implemented --# kPRV [shifted prev key] not implemented --# khome [home key] really is \E[1~ NOT \E[H --# tbc [clear tab stops] not implemented --# xenl [newline ignnored after 80 cols] messes up last line? Ehud Karni --# smpch [Start PC charset] is \E[11m, same as smacs --# rmpch [End PC charset] is \E[10m, same as rmacs --# mir [move in insert mode] fails in tack? --# bce [back color erase] causes problems with change background color? --# cvvis [make cursor very visible] causes a stackdump when testing with --# testcurs using the output option? \E[?25h\E[?8c --# civis [make cursor invisible] causes everything to stackdump? \E[?25l\E[?1c --# ech [erase characters param] broken \E[%p1%dX --# kcbt [back-tab key] not implemented in cygwin? \E[Z -+# These two are used to demonstrate the any-event mouse support, i.e., by -+# using an extended name "XM" which tells ncurses to put the terminal into -+# a special mode when initializing the xterm mouse. -+xterm+sm+1002|testing xterm-mouse, -+ XM=\E[?1002%?%p1%{1}%=%th%el%;, use=xterm-new, -+xterm+sm+1003|testing xterm-mouse, -+ XM=\E[?1003%?%p1%{1}%=%th%el%;, use=xterm-new, -+ -+xterm-1002|testing xterm-mouse, -+ use=xterm+sm+1002, use=xterm-new, -+xterm-1003|testing xterm-mouse, -+ use=xterm+sm+1003, use=xterm-new, -+ -+# This chunk is based on suggestions by Ailin Nemui and Nicholas Marriott, who -+# asked for some of xterm's advanced features to be added to its terminfo -+# entry. It defines extended capabilities not found in standard terminfo or -+# termcap. These are useful in tmux, for instance, hence the name. -+# -+# One caveat in adding extended capabilities in ncurses is that if the names -+# are longer than two characters, then they will not be visible through the -+# termcap interface. -+# -+# Ms modifies the selection/clipboard. Its parameters are -+# p1 = the storage unit (clipboard, selection or cut buffer) -+# p2 = the base64-encoded clipboard content. -+# -+# Ss is used to set the cursor style as described by the DECSCUSR -+# function to a block or underline. -+# Se resets the cursor style to the terminal power-on default. -+# -+# Cs and Cr set and reset the cursor colour. -+xterm+tmux|advanced xterm features used in tmux, -+ Cr=\E]112\007, Cs=\E]12;%p1%s\007, -+ Ms=\E]52;%p1%s;%p2%s\007, Se=\E[2 q, Ss=\E[%p1%d q, -+ -+# This is another variant, for XFree86 4.0 xterm (T.Dickey) -+# This is an 8-bit version of xterm, which emulates DEC vt220 with ANSI color. -+# To use it, your decTerminalID resource must be set to 200 or above. - # --# 2005/11/12 -TD --# Remove cbt since it does not work in current cygwin --# Add 'mir' and 'in' flags based on tack --cygwin|ansi emulation for Cygwin, -- am, hs, mir, msgr, xon, -- colors#8, it#8, pairs#64, -- acsc=+\020\,\021-\030.^Y0\333`\004a\261f\370g\361h\260j\331k\277l\332m\300n\305o~p\304q\304r\304s_t\303u\264v\301w\302x\263y\363z\362{\343|\330}\234~\376, -- bel=^G, bold=\E[1m, clear=\E[H\E[J, cr=^M, cub=\E[%p1%dD, -- cub1=^H, cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, -- cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, -- cuu1=\E[A, dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, -- dl1=\E[M, ed=\E[J, el=\E[K, el1=\E[1K, fsl=^G, home=\E[H, -- hpa=\E[%i%p1%dG, ht=^I, ich=\E[%p1%d@, ich1=\E[@, -- il=\E[%p1%dL, il1=\E[L, ind=^J, invis=\E[8m, kb2=\E[G, -- kbs=^H, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, -- kdch1=\E[3~, kend=\E[4~, kf1=\E[[A, kf10=\E[21~, -- kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, -- kf15=\E[28~, kf16=\E[29~, kf17=\E[31~, kf18=\E[32~, -- kf19=\E[33~, kf2=\E[[B, kf20=\E[34~, kf3=\E[[C, kf4=\E[[D, -- kf5=\E[[E, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, -- khome=\E[1~, kich1=\E[2~, knp=\E[6~, kpp=\E[5~, kspd=^Z, -- nel=^M^J, op=\E[39;49m, rc=\E8, rev=\E[7m, ri=\EM, -- rmacs=\E[10m, rmcup=\E[2J\E[?47l\E8, rmir=\E[4l, -- rmpch=\E[10m, rmso=\E[27m, rmul=\E[24m, rs1=\Ec\E]R, -- sc=\E7, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, -- sgr=\E[0;10%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;%?%p7%t;8%;%?%p9%t;11%;m, -- sgr0=\E[0;10m, smacs=\E[11m, smcup=\E7\E[?47h, -- smir=\E[4h, smpch=\E[11m, smso=\E[7m, smul=\E[4m, tsl=\E];, -- vpa=\E[%i%p1%dd, use=vt102+enq, -+# HTS \E H \210 -+# RI \E M \215 -+# SS3 \E O \217 -+# CSI \E [ \233 -+# -+xterm-8bit|xterm terminal emulator 8-bit controls (X Window System), -+ OTbs, am, bce, km, mc5i, mir, msgr, npc, xenl, AX, -+ colors#8, cols#80, it#8, lines#24, pairs#64, -+ acsc=``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -+ bel=^G, blink=\2335m, bold=\2331m, cbt=\233Z, -+ civis=\233?25l, clear=\233H\2332J, -+ cnorm=\233?25l\233?25h, cr=^M, csr=\233%i%p1%d;%p2%dr, -+ cub=\233%p1%dD, cub1=^H, cud=\233%p1%dB, cud1=^J, -+ cuf=\233%p1%dC, cuf1=\233C, cup=\233%i%p1%d;%p2%dH, -+ cuu=\233%p1%dA, cuu1=\233A, cvvis=\233?12;25h, -+ dch=\233%p1%dP, dch1=\233P, dl=\233%p1%dM, dl1=\233M, -+ ech=\233%p1%dX, ed=\233J, el=\233K, el1=\2331K, -+ flash=\233?5h$<100/>\233?5l, home=\233H, -+ hpa=\233%i%p1%dG, ht=^I, hts=\210, ich=\233%p1%d@, -+ il=\233%p1%dL, il1=\233L, ind=^J, invis=\2338m, -+ is2=\E[62"p\E G\233m\233?7h\E>\E7\233?1;3;4;6l\2334l\233r\E8, -+ ka1=\217w, ka3=\217u, kb2=\217y, kbeg=\217E, kc1=\217q, -+ kc3=\217s, kcbt=\233Z, kcub1=\217D, kcud1=\217B, -+ kcuf1=\217C, kcuu1=\217A, kdch1=\2333~, kend=\2334~, -+ kent=\217M, kf1=\23311~, kf10=\23321~, kf11=\23323~, -+ kf12=\23324~, kf13=\23325~, kf14=\23326~, kf15=\23328~, -+ kf16=\23329~, kf17=\23331~, kf18=\23332~, kf19=\23333~, -+ kf2=\23312~, kf20=\23334~, kf3=\23313~, kf4=\23314~, -+ kf5=\23315~, kf6=\23317~, kf7=\23318~, kf8=\23319~, -+ kf9=\23320~, khome=\2331~, kich1=\2332~, kmous=\233M, -+ knp=\2336~, kpp=\2335~, mc0=\233i, mc4=\2334i, mc5=\2335i, -+ meml=\El, memu=\Em, op=\23339;49m, rc=\E8, rev=\2337m, -+ ri=\215, rmacs=\E(B, rmam=\233?7l, rmcup=\233?1049l, -+ rmir=\2334l, rmkx=\233?1l\E>, rmso=\23327m, rmul=\23324m, -+ rs1=\Ec, -+ rs2=\E[62"p\E G\233m\233?7h\E>\E7\233?1;3;4;6l\2334l\233r\E8, -+ sc=\E7, setab=\2334%p1%dm, setaf=\2333%p1%dm, -+ setb=\2334%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m, -+ setf=\2333%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m, -+ sgr=\2330%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p7%t;8%;m%?%p9%t\E(0%e\E(B%;, -+ sgr0=\2330m\E(B, smacs=\E(0, smam=\233?7h, -+ smcup=\233?1049h, smir=\2334h, smkx=\233?1h\E=, -+ smso=\2337m, smul=\2334m, tbc=\2333g, u6=\233[%i%d;%dR, -+ u7=\E[6n, u8=\233[?1;2c, u9=\E[c, vpa=\233%i%p1%dd, -+ use=xterm+kbs, - --# I've supplied this so that you can help test new values and add other --# features. Cheers, earnie_boyd@yahoo.com. -+xterm-hp|xterm with hpterm function keys, -+ kclr=\EJ, kcub1=\ED, kcud1=\EB, kcuf1=\EC, kcuu1=\EA, -+ kdch1=\EP, kend=\EF, kf1=\Ep, kf2=\Eq, kf3=\Er, kf4=\Es, -+ kf5=\Et, kf6=\Eu, kf7=\Ev, kf8=\Ew, khome=\Eh, kich1=\EQ, -+ knp=\ES, kpp=\ET, use=xterm-basic, -+ -+xterm-sco|xterm with SCO function keys, -+ kbeg=\E[E, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, -+ kdch1=\177, kend=\E[F, kf1=\E[M, kf10=\E[V, kf11=\E[W, -+ kf12=\E[X, kf13=\E[Y, kf14=\E[Z, kf15=\E[a, kf16=\E[b, -+ kf17=\E[c, kf18=\E[d, kf19=\E[e, kf2=\E[N, kf20=\E[f, -+ kf21=\E[g, kf22=\E[h, kf23=\E[i, kf24=\E[j, kf25=\E[k, -+ kf26=\E[l, kf27=\E[m, kf28=\E[n, kf29=\E[o, kf3=\E[O, -+ kf30=\E[p, kf31=\E[q, kf32=\E[r, kf33=\E[s, kf34=\E[t, -+ kf35=\E[u, kf36=\E[v, kf37=\E[w, kf38=\E[x, kf39=\E[y, -+ kf4=\E[P, kf40=\E[z, kf41=\E[@, kf42=\E[[, kf43=\E[\\, -+ kf44=\E[], kf45=\E[\^, kf46=\E[_, kf47=\E[`, kf48=\E[{, -+ kf5=\E[Q, kf6=\E[R, kf7=\E[S, kf8=\E[T, kf9=\E[U, khome=\E[H, -+ kich1=\E[L, kmous=\E[>M, knp=\E[G, kpp=\E[I, -+ use=xterm-basic, -+ -+# The xterm-new description has all of the features, but is not completely -+# compatible with vt220. If you are using a Sun or PC keyboard, set the -+# sunKeyboard resource to true: -+# + maps the editing keypad -+# + interprets control-function-key as a second array of keys, so a -+# 12-fkey keyboard can support vt220's 20-fkeys. -+# + maps numeric keypad "+" to ",". -+# + uses DEC-style control sequences for the application keypad. - # --# Some features are from pcansi. The op value is from linux. Function-keys --# are from linux. These have been tested not to cause problems. xenl was in --# this list, but DOES cause problems so it has been removed --cygwinDBG|Debug Version for Cygwin, -- am, eo, mir, msgr, xon, -- colors#8, cols#80, it#8, lines#24, ncv#3, pairs#64, -- acsc=+\020\,\021-\030.^Y0\333`\004a\261f\370g\361h\260j\331k\277l\332m\300n\305o~p\304q\304r\304s_t\303u\264v\301w\302x\263y\363z\362{\343|\330}\234~\376, -- bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, clear=\E[H\E[J, -- cnorm=\E[?25h, cr=^M, cub=\E[%p1%dD, cub1=\E[D, -- cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, cuf1=\E[C, -- cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, -- dch=\E[%p1%dP, dch1=\E[P, dim=\E[2m, dl=\E[%p1%dM, -- dl1=\E[M, ed=\E[J, el=\E[K, el1=\E[1K, -- flash=\E[?5h\E[?5l$<200/>, home=\E[H, hpa=\E[%i%p1%dG, -- ht=^I, hts=\EH, ich=\E[%p1%d@, ich1=\E[@, il=\E[%p1%dL, -- il1=\E[L, ind=^J, invis=\E[8m, kNXT=\E[6$, kPRV=\E[5$, -- kb2=\E[G, kbs=^H, kcbt=\E[Z, kcub1=\E[D, kcud1=\E[B, -- kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[3~, kend=\E[4~, kf1=\E[[A, -- kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, -- kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, kf17=\E[31~, -- kf18=\E[32~, kf19=\E[33~, kf2=\E[[B, kf20=\E[34~, -- kf3=\E[[C, kf4=\E[[D, kf5=\E[[E, kf6=\E[17~, kf7=\E[18~, -- kf8=\E[19~, kf9=\E[20~, khome=\E[1~, kich1=\E[2~, -- knp=\E[6~, kpp=\E[5~, kspd=^Z, nel=^M^J, op=\E[39;49m, -- rc=\E8, rev=\E[7m, ri=\EM, rmacs=\E[10m, rmir=\E[4l, -- rmso=\E[m, rmul=\E[m, rs1=\Ec\E]R, sc=\E7, -- setab=\E[4%p1%dm, setaf=\E[3%p1%dm, -- sgr=\E[0;10%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;%?%p7%t;8%;%?%p9%t;12%;m, -- sgr0=\E[0;10m, smacs=\E[11m, smir=\E[4h, smso=\E[7m, -- smul=\E[4m, tbc=\E[3g, vpa=\E[%i%p1%dd, use=vt102+enq, -+xterm-vt220|xterm emulating vt220, -+ kcbt=\E[Z, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, -+ kend=\E[4~, kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, -+ kf13=\E[25~, kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, -+ kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, kf20=\E[34~, -+ kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, -+ khome=\E[1~, kich1=\E[2~, kmous=\E[M, knp=\E[6~, kpp=\E[5~, -+ use=xterm+app, use=xterm+edit, use=xterm-basic, -+ use=vt220+keypad, - --# Key definitions: --# The encodings for unshifted arrow keys, F1-F12, Home, Insert, etc. match the --# encodings used by other x86 environments. All others are invented for DJGPP. --# Oddly enough, while several combinations of modifiers are tabulated, there is --# none for shifted cursor keys. -+xterm-vt52|xterm emulating dec vt52, -+ cols#80, it#8, lines#24, -+ acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -+ bel=^G, clear=\EH\EJ, cr=^M, cub1=\ED, cud1=\EB, cuf1=\EC, -+ cup=\EY%p1%' '%+%c%p2%' '%+%c, cuu1=\EA, ed=\EJ, el=\EK, -+ home=\EH, ht=^I, ind=^J, kcub1=\ED, kcud1=\EB, kcuf1=\EC, -+ kcuu1=\EA, nel=^M^J, ri=\EI, rmacs=\EG, smacs=\EF, -+ use=xterm+kbs, -+ -+xterm-noapp|xterm with cursor keys in normal mode, -+ rmcup@, rmkx=\E>, smcup@, smkx=\E=, use=xterm+noapp, -+ use=xterm, -+ -+xterm-24|vs100|xterms|xterm terminal emulator (X Window System), -+ lines#24, use=xterm-old, -+ -+# This is xterm for ncurses. -+xterm|xterm terminal emulator (X Window System), -+ use=xterm-new, -+ -+# This entry assumes that xterm's handling of VT100 SI/SO is disabled by -+# setting the vt100Graphics resource to false. -+xterm-utf8|xterm with no VT100 line-drawing in UTF-8 mode, -+ U8#1, use=xterm, -+ -+# These building-blocks allow access to the X titlebar and icon name as a -+# status line. There are a few problems in using them in entries: - # --# F1 \E[[A --# F2 \E[[B --# F3 \E[[C --# F4 \E[[D --# F5 \E[[E --# F6 \E[17~ --# F7 \E[18~ --# F8 \E[19~ --# F9 \E[20~ --# F10 \E[21~ --# F11 \E[23~ --# F12 \E[24~ -+# a) tsl should have a parameter to denote the column on which to transfer to -+# the status line. -+# b) the "0" code for xterm updates both icon-title and window title. Some -+# window managers such as twm (and possibly window managers descended from -+# it such as tvtwm, ctwm, and vtwm) track windows by icon-name. Thus, you -+# don't want to mess with icon-name when using those window managers. - # --# Delete \E[3~ --# Down Arrow \E[B --# End \E[4~ --# Home \E[1~ --# Insert \E[2~ --# Left Arrow \E[D --# Page Down \E[6~ --# Page Up \E[5~ --# Right Arrow \E[C --# Up Arrow \E[A -+# The extension "TS" is preferable, because it does not accept a parameter. -+# However, if you are using a non-extended terminfo, "TS" is not visible. -+xterm+sl|access X title line and icon name, -+ hs, -+ dsl=\E]0;\007, fsl=^G, tsl=\E]0;, TS=\E]0;, -+xterm+sl-twm|access X title line (pacify twm-descended window managers), -+ hs, -+ dsl=\E]2;\007, fsl=^G, tsl=\E]2;, TS=\E]2;, -+ -+# In contrast, this block can be used for a DEC vt320 and up. There are two -+# controls used. - # --# Shift-F1 \E[25~ --# Shift-F2 \E[26~ --# Shift-F3 \E[27~ --# Shift-F4 \E[28~ --# Shift-F5 \E[29~ --# Shift-F6 \E[30~ --# Shift-F7 \E[31~ --# Shift-F8 \E[32~ --# Shift-F9 \E[33~ --# Shift-F10 \E[34~ --# Shift-F11 \E[35~ --# Shift-F12 \E[36~ -+# DECSASD (select active status display) -+# \E[0$} Main display -+# \E[1$} Status line -+# -+# DECSSDT (select status line type) -+# \E[0$~ No status line -+# \E[1$~ Indicator status line -+# \E[2$~ Host-writable status line -+# -+# The building block assumes that the terminal always shows something at the -+# status line (either the indicator, or status line). That is because if no -+# status line is used, then the terminal makes that line part of the user -+# window, changing its size without notice. -+# -+# Because there is no "esl" (enable status line) capability, the "tsl" -+# capability ensures that the status line is host-writable. A DEC terminal -+# will clear the status line when changing from indicator to host-writable -+# mode. -+# -+# Once on the status line, the row part of cursor addressing is ignored. Since -+# tsl expects a parameter (to specify the column), the shortest addressing that -+# can be used for this purpose is HPA, e.g., \E[5d to go to column 5. - # --# Ctrl-F1 \E[47~ --# Ctrl-F2 \E[48~ --# Ctrl-F3 \E[49~ --# Ctrl-F4 \E[50~ --# Ctrl-F5 \E[51~ --# Ctrl-F6 \E[52~ --# Ctrl-F7 \E[53~ --# Ctrl-F8 \E[54~ --# Ctrl-F9 \E[55~ --# Ctrl-F10 \E[56~ --# Ctrl-F11 \E[57~ --# Ctrl-F12 \E[58~ -+dec+sl|DEC VTxx status line, -+ eslok, hs, -+ dsl=\E[1$~, fsl=\E[0$}, tsl=\E[2$~\E[1$}\E[%i%p1%d`, -+ - # --# Ctrl-Delete \E[43~ --# Ctrl-Down Arrow \E[38~ --# Ctrl-End \E[44~ --# Ctrl-Home \E[41~ --# Ctrl-Insert \E[42~ --# Ctrl-Left Arrow \E[39~ --# Ctrl-Page Down \E[46~ --# Ctrl-Page Up \E[45~ --# Ctrl-Right Arrow \E[40~ --# Ctrl-Up Arrow \E[37~ -+# The following xterm variants don't depend on your base version - # --# Alt-F1 \E[59~ --# Alt-F2 \E[60~ --# Alt-F3 \E[61~ --# Alt-F4 \E[62~ --# Alt-F5 \E[63~ --# Alt-F6 \E[64~ --# Alt-F7 \E[65~ --# Alt-F8 \E[66~ --# Alt-F9 \E[67~ --# Alt-F10 \E[68~ --# Alt-F11 \E[79~ --# Alt-F12 \E[80~ --# --# Alt-Delete \E[65~ --# Alt-Down Arrow \E[60~ --# Alt-End \E[66~ --# Alt-Home \E[41~ --# Alt-Insert \E[64~ --# Alt-Left Arrow \E[61~ --# Alt-Page Down \E[68~ --# Alt-Page Up \E[67~ --# Alt-Right Arrow \E[62~ --# Alt-Up Arrow \E[59~ --# --# Also: --# Alt-A \E[82~ --# Alt-B \E[82~ --# Alt-C \E[83~ --# Alt-D \E[84~ --# Alt-E \E[85~ --# Alt-F \E[86~ --# Alt-G \E[87~ --# Alt-H \E[88~ --# Alt-I \E[89~ --# Alt-J \E[90~ --# Alt-K \E[91~ --# Alt-L \E[92~ --# Alt-M \E[93~ --# Alt-N \E[94~ --# Alt-O \E[95~ --# Alt-P \E[96~ --# Alt-Q \E[97~ --# Alt-R \E[98~ --# Alt-S \E[99~ --# Alt-T \E[100~ --# Alt-U \E[101~ --# Alt-V \E[102~ --# Alt-W \E[103~ --# Alt-X \E[104~ --# Alt-Y \E[105~ --# Alt-Z \E[106~ --djgpp|ansi emulation for DJGPP alpha, -- am, bce, msgr, xhp, xon, xt, -- colors#8, it#8, pairs#64, -- acsc=+\020\,\021-\030.^Y0\333`\004a\261f\370g\361h\260j\331k\277l\332m\300n\305o~p\304q\304r\304s_t\303u\264v\301w\302x\263y\363z\362{\343|\330}\234~\376, -- bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[1v, -- clear=\E[H\E[J, cnorm=\E[v, cr=^M, cub=\E[%p1%dD, cub1=^H, -- cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, cuf1=\E[C, -- cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, -- cvvis=\E[2v, dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, -- dl1=\E[M, ech=\E[%p1%dX, ed=\E[J, el=\E[K, el1=\E[1K, -- home=\E[H, hpa=\E[%i%p1%dG, ht=^I, ich=\E[%p1%d@, -- ich1=\E[@, il=\E[%p1%dL, il1=\E[L, ind=\E[S, -- indn=\E[%p1%dS, invis=\E[8m, kbs=^H, kcub1=\E[D, -- kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[3~, -- kend=\E[4~, kf1=\E[[A, kf10=\E[21~, kf11=\E[23~, -- kf12=\E[24~, kf2=\E[[B, kf3=\E[[C, kf4=\E[[D, kf5=\E[[E, -- kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, -- khome=\E[1~, kich1=\E[2~, knp=\E[6~, kpp=\E[5~, nel=^M^J, -- op=\E[37;40m, rev=\E[7m, ri=\E[T, rin=\E[%p1%dT, rmso=\E[m, -- setab=\E[4%p1%dm, setaf=\E[3%p1%dm, -- sgr=\E[0%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%e;25%;%?%p6%t;1%;%?%p7%t;8%;m, -- sgr0=\E[m, smso=\E[7m, smul=\E[4m, vpa=\E[%i%p1%dd, -- --djgpp203|Entry for DJGPP 2.03, -- OTbs, am, -- cols#80, it#8, lines#25, -- bel=^G, cr=^M, cub1=^H, cud1=^J, ht=^I, ind=^J, kbs=^H, kcub1=^H, -- kcud1=^J, nel=^M^J, -+# xterm with bold instead of underline -+xterm-bold|xterm terminal emulator (X11R6 Window System) standout w/bold, -+ sgr=%?%p9%t\016%e\017%;B\E[0%?%p6%t;1%;%?%p2%t;1%;%?%p1%p3%|%t;7%;m, -+ smso=\E[7m, smul=\E[1m, use=xterm-old, - --djgpp204|Entry for DJGPP 2.04, -- OTbs, am, AX, -- colors#8, cols#80, it#8, lines#25, ncv#3, pairs#64, -- bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[1v, -- clear=\E[H\E[2J, cnorm=\E[v, cr=^M, cub=\E[%p1%dD, -- cub1=\E[D, cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, -- cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, -- cuu1=\E[A, cvvis=\E[2v, dch=\E[%p1%dP, dch1=\E[P, -- dl=\E[%p1%dM, dl1=\E[M, ech=\E[%p1%dX, ed=\E[J, el=\E[K, -- home=\E[H, ht=^I, ich=\E[%p1%d@, ich1=\E[@, il=\E[%p1%dL, -- il1=\E[L, ind=\E[S, indn=\E[%p1%dS, invis=\E[8m, kbs=^H, -- kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, -- kdch1=\E[3~, kf0=\E[21~, kf1=\E[[A, kf10=\E[21~, kf2=\E[[B, -- kf3=\E[[C, kf4=\E[[D, kf5=\E[[E, kf6=\E[17~, kf7=\E[18~, -- kf8=\E[19~, kf9=\E[20~, khome=\E[1~, kich1=\E[2~, -- kll=\E[4~, knp=\E[6~, kpp=\E[5~, nel=^M^J, rev=\E[7m, -- ri=\E[T, rin=\E[%p1%dT, rmso=\E[m, setab=\E[4%p1%dm, -- setaf=\E[3%p1%dm, sgr0=\E[m, smso=\E[7m, smul=\E[4m, -+# See the note on ICH/ICH1 VERSUS RMIR/SMIR near the end of file -+xterm-nic|xterm with ich/ich1 suppressed for non-curses programs, -+ ich@, ich1@, use=xterm, -+# From: Mark Sheppard <kimble@mistral.co.uk>, 4 May 1996 -+xterm1|xterm terminal emulator ignoring the alternate screen buffer, -+ rmcup@, smcup@, use=xterm, - --# This is tested using U/Win's telnet. Scrolling is omitted because it is --# buggy. Another odd bug appears when displaying "~" in alternate character --# set (the emulator spits out error messages). Compare with att6386 -TD --uwin|U/Win 3.2 console, -- am, eo, in, msgr, xenl, xon, -- colors#8, it#8, ncv#58, pairs#64, -- acsc=+\020\,\021-\030.^Y0\333`\004a\261f\370g\361h\260i\316j\331k\277l\332m\300n\305o~p\304q\304r\304s_t\303u\264v\301w\302x\263y\363z\362{\343|\330}\234~\376, -- bel=^G, blink=\E[5m, bold=\E[1m, civis=\E[?25l, -- clear=\E[H\E[J, cnorm=\E[?25h, cr=^M, cub1=^H, cud1=^J, -- cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, -- dch=\E[%p1%dP, dch1=\E[P, dim=\E[2m, ech=\E[%p1%dX, -- ed=\E[J, el=\E[K, el1=\E[1K, home=\E[H, ht=^I, hts=\EH, -- ich=\E[%p1%d@, ich1=\E[@, kbs=^H, kcub1=\E[D, kcud1=\E[B, -- kcuf1=\E[C, kcuu1=\E[A, kdch1=\177, kend=\E[Y, kf1=\EOP, -- kf10=\EOY, kf11=\EOZ, kf12=\EOA, kf2=\EOQ, kf3=\EOR, -- kf4=\EOS, kf5=\EOT, kf6=\EOU, kf7=\EOV, kf8=\EOW, kf9=\EOX, -- khome=\E[H, kich1=\E[@, nel=^M^J, op=\E[39;49m, rc=\E8, -- rev=\E[7m, rmacs=\E[10m, rmir=\E[4l, rmpch=\E[10m, -- rmso=\E[27m, rmul=\E[m, rs1=\Ec\E]R, sc=\E7, -- setab=\E[4%p1%dm, setaf=\E[3%p1%dm, sgr0=\E[0;10m, -- smacs=\E[11m, smir=\E[4h, smpch=\E[11m, smso=\E[7m, -- smul=\E[4m, tbc=\E[3g, u6=\E[%i%d;%dR, u7=\E[6n, -+#### KTERM -+# (kterm: this had extension capabilities ":KJ:TY=ascii:" -- esr) -+# (kterm should not invoke DEC Graphics as the alternate character set -+# -- Kenji Rikitake) -+# (proper setting of enacs, smacs, rmacs makes kterm to use DEC Graphics -+# -- MATSUMOTO Shoji) -+# kterm implements acsc via built-in table of X Drawable's -+kterm|kterm kanji terminal emulator (X window system), -+ eslok, hs, XT, -+ ncv@, -+ acsc=``aajjkkllmmnnooppqqrrssttuuvvwwxx~~, -+ csr=\E[%i%p1%d;%p2%dr, dsl=\E[?H, enacs=, fsl=\E[?F, -+ kmous=\E[M, rc=\E8, rmacs=\E(B, rmam=\E[?7l, sc=\E7, -+ sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;m%?%p9%t\E(0%e\E(B%;, -+ sgr0=\E[m\E(B, smacs=\E(0, smam=\E[?7h, -+ tsl=\E[?E\E[?%i%p1%dT, use=xterm-r6, use=ecma+color, -+kterm-color|kterm-co|kterm with ANSI colors, -+ ncv@, use=kterm, use=ecma+color, - --# This entry fits the Windows NT console when the _POSIX_TERM environment --# variable is set to 'on'. While the Windows NT POSIX console is seldom used, --# the Telnet client supplied with both the Windows for WorkGroup 3.11 TCP/IP --# stack and the Win32 (i.e., Windows 95 and Windows NT 3.1 or later) operating --# systems is not, and (surprise!) they match very well. --# --# See: MS Knowledge Base item Q108581, dated 13-MAY-1997, titled "Setting Up --# VI POSIX Editor for Windows NT 3.1". True to Microsoft form, not only --# are the installation instructions a pile of mind-numbing bureaucratese, --# but the termcap entry is actually broken and unusable as given; the :do: --# capability is misspelled "d". --# --# To use this, you need to a bunch of environment variables: --# --# SET _POSIX_TERM=on --# SET TERM=ansi --# SET TERMCAP=location of termcap file in POSIX file format --# which is case-sensitive. --# e.g. SET TERMCAP=//D/RESKIT35/posix/termcap --# SET TMP=//C/TEMP --# --# Important note: setting the TMP environment variable in POSIX style renders --# it incompatible with a lot of other applications, including Visual C++. So --# you should have a separate command window just for vi. All the other --# variables may be permanently set in the Control Panel\System applet. --# --# You can find out more about the restrictions of this facility at --# <http://www.nentug.org/unix-to-nt/ntposix.htm>. --# --# From: Federico Bianchi <bianchi@magna.cisid.unipi.it>, 15 Jan 1997 --ansi-nt|psx_ansi|Microsoft Windows NT console POSIX ANSI mode, -- am, bw, msgr, -- cols#80, it#8, lines#25, -- bel=^G, clear=\E[2J, cr=^M, cub1=^H, cud1=^J, cuf1=\E[C, -- cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, ed=\E[J, el=\E[K, -- home=\E[H, ht=^I, ind=\E[S, kbs=^H, kcub1=\E[D, kcud1=\E[V, -- kcuf1=\E[C, kcuu1=\E[A, nel=\r\E[S, rc=\E[u, rev=\E[7m, -- ri=\E[T, rmso=\E[m, sc=\E[s, sgr0=\E[0m, smso=\E[7m, --# From: jew@venus.sunquest.com --# Date: 19 Feb 93 23:41:07 GMT --# Here's a combination of ansi and vt100 termcap --# entries that works nearly perfectly for me --# (Gateway 2000 Handbook and Microsoft Works 3.0): --pcmw|PC running Microsoft Works, -- am, xenl, -- cols#80, it#8, lines#24, vt#3, -- bel=^G, blink=\E[5m$<2/>, bold=\E[1m$<2/>, -- clear=\E[;H\E[2J$<50/>, cr=^M, cub1=^H, cud1=^J, -- cuf1=\E[C$<2/>, cup=\E[%i%p1%d;%p2%dH$<5/>, -- cuu1=\E[A$<2/>, ed=\E[J$<50/>, el=\E[K$<3/>, home=\E[H, -- ht=^I, hts=\EH$<2/>, ind=\ED$<5/>, is2=\E[1;24r\E[24;1H, -- kbs=^H, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, -- kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, nel=\r\ED$<5/>, -- rc=\E8, rev=\E[7m$<2/>, rf=/usr/share/lib/tabset/vt100, -- ri=\EM$<5/>, rmso=\E[m$<2/>, rmul=\E[m$<2/>, -+#### Other XTERM -+# These (xtermc and xtermm) are distributed with Solaris. They refer to a -+# variant of xterm which is apparently no longer supported, but are interesting -+# because they illustrate SVr4 curses mouse controls - T.Dickey -+xtermm|xterm terminal emulator (monocrome), -+ OTbs, am, km, mir, msgr, xenl, -+ btns#3, cols#80, it#8, lines#24, -+ acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -+ bel=^G, blink@, bold=\E[1m, clear=\E[H\E[2J, cr=^M, -+ csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=\E[D, -+ cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, -+ cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, -+ dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, -+ el=\E[K, el1=\E[1K$<3>, enacs=\E(B\E)0, getm=\E[%p1%dY, -+ home=\E[H, ht=^I, hts=\EH, ich=\E[%p1%d@, ich1=\E[@, -+ il=\E[%p1%dL, il1=\E[L, ind=^J, kbs=^H, kcub1=\EOD, -+ kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kend=\E[Y, kf0=\EOy, -+ kf10=\EOY, kf11=\EOZ, kf12=\EOA, kf5=\EOT, kf6=\EOU, -+ kf7=\EOV, kf8=\EOW, kf9=\EOX, khome=\E[H, kmous=\E[^_, -+ knp=\E[U, kpp=\E[V, rc=\E8, reqmp=\E[492Z, rev=\E[7m, ri=\EM, -+ rmacs=^O, rmcup=\E@0\E[?4r, rmso=\E[m, -+ rs1=\E>\E[1;3;4;5;6l\E[?7h\E[m\E[r\E[2J\E[H, - rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sc=\E7, -- sgr0=\E[m$<2/>, smso=\E[7m$<2/>, smul=\E[4m$<2/>, -- tbc=\E[3g$<2/>, -+ sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;, -+ sgr0=\E[m\017, smacs=^N, smcup=\E@0\E[?4s\E[?4h\E@1, -+ smso=\E[7m, tbc=\E[3g, use=vt100+fnkeys, - --# From: Federico Bianchi --# This is the entry for the OpenNT terminal. --# The ntconsole name is for backward compatability. --# This is for OpenNT 2.0 and later. --# Later OpenNT was renamed to Interix. --# --# Presently it is distributed by Microsoft as Services For Unix (SFU). --# The 3.5 beta contains ncurses 4.2 (that is header files and executables, --# the documentation dates from 1.9.9e) -TD -+xtermc|xterm terminal emulator (color), -+ colors#8, ncv#7, pairs#64, -+ op=\E[100m, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, -+ setb=\E[4%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m, -+ setf=\E[3%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m, -+ use=xtermm, - --interix|opennt|opennt-25|ntconsole|ntconsole-25|OpenNT-term compatible with color, -- am, bw, msgr, -- colors#8, cols#80, lines#25, ncv#3, pairs#64, -- acsc=+\020\,\021-\030.^Y0\333`\004a\261f\370g\361h\260j\331k\277l\332m\300n\305o~p\304q\304r\304s_t\303u\264v\301w\302x\263y\363z\362{\343|\330}\234~\376, -- bel=^G, bold=\E[1m, cbt=\E[Z, clear=\E[2J, cub=\E[%p1%dD, -- cub1=\E[D, cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, -- cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, -- cuu1=\E[A, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[K, -- home=\E[H, ht=^I, il=\E[%p1%dL, il1=\E[L, ind=\E[S, -- indn=\E[%p1%dS, kbs=^H, kcbt=\E[Z, kcub1=\E[D, kcud1=\E[B, -- kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[M, kend=\E[U, kf0=\EFA, -- kf1=\EF1, kf10=\EFA, kf11=\EFB, kf12=\EFC, kf13=\EFD, -- kf14=\EFE, kf15=\EFF, kf16=\EFG, kf17=\EFH, kf18=\EFI, -- kf19=\EFJ, kf2=\EF2, kf20=\EFK, kf21=\EFL, kf22=\EFM, -- kf23=\EFN, kf24=\EFO, kf25=\EFP, kf26=\EFQ, kf27=\EFR, -- kf28=\EFS, kf29=\EFT, kf3=\EF3, kf30=\EFU, kf31=\EFV, -- kf32=\EFW, kf33=\EFX, kf34=\EFY, kf35=\EFZ, kf36=\EFa, -- kf37=\EFb, kf38=\EFc, kf39=\EFd, kf4=\EF4, kf40=\EFe, -- kf41=\EFf, kf42=\EFg, kf43=\EFh, kf44=\EFi, kf45=\EFj, -- kf46=\EFk, kf47=\EFm, kf48=\EFn, kf49=\EFo, kf5=\EF5, -- kf50=\EFp, kf51=\EFq, kf52=\EFr, kf53=\EFs, kf54=\EFt, -- kf55=\EFu, kf56=\EFv, kf57=\EFw, kf58=\EFx, kf59=\EFy, -- kf6=\EF6, kf60=\EFz, kf61=\EF+, kf62=\EF-, -- kf63=\EF\014 kf64=\EF$, kf7=\EF7, kf8=\EF8, kf9=\EF9, -- kich1=\E[L, kll=\E[U, knp=\E[T, kpp=\E[S, ll=\E[U, nel=^M^J, -- op=\E[m, rc=\E[u, rev=\E[7m, ri=\E[T, rin=\E[%p1%dT, -- rmcup=\E[2b\E[u\r\E[K, rmso=\E[m, rmul=\E[m, rs1=\Ec, -- sc=\E[s, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, -- setb=\E[%p1%{40}%+%dm, setf=\E[%p1%{30}%+%dm, -- sgr0=\E[0m, smcup=\E[s\E[1b, smso=\E[7m, smul=\E[4m, -+# From: David J. MacKenzie <djm@va.pubnix.com> 20 Apr 1995 -+# Here's a termcap entry I've been using for xterm_color, which comes -+# with BSD/OS 2.0, and the X11R6 contrib tape too I think. Besides the -+# color stuff, I also have a status line defined as the window manager -+# title bar. [I have translated it to terminfo -- ESR] -+xterm-pcolor|xterm with color used for highlights and status line, -+ wsl#40, -+ bold=\E[1;43m, rev=\E[7;34m, -+ sgr=%?%p9%t\E(0%e\E(B%;\E[0%?%p6%t;1;43%;%?%p2%t;4;42%;%?%p1%t;7;31%;%?%p3%t;7;34%;%?%p4%t;5%;%?%p7%t;8%;m, -+ smso=\E[7;31m, smul=\E[4;42m, use=xterm+sl, use=xterm-r6, - --opennt-35|ntconsole-35|OpenNT-term35 compatible with color, -- lines#35, use=opennt, -+# This describes the capabilities of color_xterm, an xterm variant from -+# before ECMA-64 color support was folded into the main-line xterm release. -+# This entry is straight from color_xterm's maintainer. -+# From: Jacob Mandelson <jlm@ugcs.caltech.edu>, 09 Nov 1996 -+# The README's with the distribution also say that it supports SGR 21, 24, 25 -+# and 27, but they are not present in the terminfo or termcap. -+color_xterm|cx|cx100|color_xterm color terminal emulator for X, -+ OTbs, am, km, mir, msgr, xenl, XT, -+ cols#80, it#8, lines#65, ncv@, -+ acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -+ bel=^G, bold=\E[1m, clear=\E[H\E[2J, cr=^M, -+ csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, -+ cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, -+ cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, -+ dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, -+ el=\E[K, el1=\E[1K, enacs=\E(B\E)0, home=\E[H, ht=^I, -+ ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[L, ind=^J, -+ is1=\E[r\E[m\E[?7h\E[?4;6l\E[4l, kbs=^H, kcub1=\EOD, -+ kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kend=\E[8~, kf1=\E[11~, -+ kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf2=\E[12~, -+ kf3=\E[13~, kf4=\E[14~, kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, -+ kf8=\E[19~, kf9=\E[20~, khome=\E[7~, kich1=\E[2~, -+ kmous=\E[M, knp=\E[6~, kpp=\E[5~, rc=\E8, rev=\E[7m, ri=\EM, -+ rmacs=^O, rmam=\E[?7l, rmcup=\E>\E[?41;1r, rmir=\E[4l, -+ rmso=\E[27m, rmul=\E[24m, -+ rs1=\E(B\017\E[r\E[m\E[2J\E[H\E[?7h\E[?1;3;4;6l\E[4l\E<, -+ sc=\E7, -+ sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;, -+ sgr0=\E[0m\017, smacs=^N, smam=\E[?7h, -+ smcup=\E[?1;41s\E[?1;41h\E=, smir=\E[4h, smso=\E[7m, -+ smul=\E[4m, use=ecma+color, use=vt220+keypad, - --opennt-50|ntconsole-50|OpenNT-term50 compatible with color, -- lines#50, use=opennt, -+# The 'nxterm' distributed with Redhat Linux 5.2 is a slight rehack of -+# xterm-sb_right-ansi-3d, which implements ANSI colors, but does not support -+# SGR 39 or 49. SGR 0 does reset colors (along with everything else). This -+# description is "compatible" with color_xterm, rxvt and XFree86 xterm, except -+# that each of those implements the home, end, delete keys differently. -+# -+# Redhat Linux 6.x distributes XFree86 xterm as "nxterm", which uses bce -+# colors; note that this is not compatible with the 5.2 version. -+# csw (2002-05-15): make xterm-color primary instead of nxterm, to -+# match XFree86's xterm.terminfo usage and prevent circular links -+xterm-color|nxterm|generic color xterm, -+ ncv@, -+ op=\E[m, use=xterm-r6, use=klone+color, - --opennt-60|ntconsole-60|OpenNT-term60 compatible with color, -- lines#60, use=opennt, -+# This entry describes an xterm with Sun-style function keys enabled -+# via the X resource setting "xterm*sunFunctionKeys:true" -+# To understand <kf11>/<kf12> note that L1,L2 and F11,F12 are the same. -+# The <kf13>...<kf20> keys are L3-L10. We don't set <kf16=\E[197z> -+# because we want it to be seen as <kcpy>. -+# The <kf31>...<kf45> keys are R1-R15. We treat some of these in accordance -+# with their Sun keyboard labels instead. -+# From: Simon J. Gerraty <sjg@zen.void.oz.au> 10 Jan 1996 -+xterm-sun|xterm with sunFunctionKeys true, -+ kb2=\E[218z, kcpy=\E[197z, kcub1=\EOD, kcud1=\EOB, -+ kcuf1=\EOC, kcuu1=\EOA, kdch1=\E[3z, kend=\E[220z, -+ kent=\EOM, kf1=\E[224z, kf10=\E[233z, kf11=\E[192z, -+ kf12=\E[193z, kf13=\E[194z, kf14=\E[195z, kf15=\E[196z, -+ kf17=\E[198z, kf18=\E[199z, kf19=\E[200z, kf2=\E[225z, -+ kf20=\E[201z, kf3=\E[226z, kf31=\E[208z, kf32=\E[209z, -+ kf33=\E[210z, kf34=\E[211z, kf35=\E[212z, kf36=\E[213z, -+ kf38=\E[215z, kf4=\E[227z, kf40=\E[217z, kf42=\E[219z, -+ kf44=\E[221z, kf45=\E[222z, kf46=\E[234z, kf47=\E[235z, -+ kf5=\E[228z, kf6=\E[229z, kf7=\E[230z, kf8=\E[231z, -+ kf9=\E[232z, kfnd=\E[200z, khlp=\E[196z, khome=\E[214z, -+ kich1=\E[2z, knp=\E[222z, kpp=\E[216z, kund=\E[195z, -+ use=xterm-basic, -+xterms-sun|small (80x24) xterm with sunFunctionKeys true, -+ cols#80, lines#24, use=xterm-sun, - --opennt-100|ntconsole-100|OpenNT-term100 compatible with color, -- lines#100, use=opennt, -+#### GNOME (VTE) -+# this describes the alpha-version of Gnome terminal shipped with Redhat 6.0 -+gnome-rh62|Gnome terminal, -+ bce, -+ kdch1=\177, kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, -+ use=xterm-color, - --# OpenNT wide terminals --opennt-w|opennt-25-w|ntconsole-w|ntconsole-25-w|OpenNT-term-w compat with color, -- cols#125, use=opennt, -+# GNOME Terminal 1.4.0.4 (Redhat 7.2) -+# -+# This implements a subset of vt102 with a random selection of features from -+# other terminals such as color and function-keys. -+# -+# shift-f1 to shift-f10 are f11 to f20 -+# -+# NumLock changes the application keypad to approximate vt100 keypad, except -+# that there is no escape sequence matching comma (,). -+# -+# Other defects observed: -+# vt100 LNM mode is not implemented. -+# vt100 80/132 column mode is not implemented. -+# vt100 DECALN is not implemented. -+# vt100 DECSCNM mode is not implemented, so flash does not work. -+# vt100 TBC (tab reset) is not implemented. -+# xterm alternate screen controls do not restore cursor position properly -+# it hangs in tack after running function-keys test. -+gnome-rh72|GNOME Terminal, -+ bce, km@, -+ civis=\E[?25l, cnorm=\E[?25h, kdch1=\E[3~, kf1=\EOP, -+ kf2=\EOQ, kf3=\EOR, kf4=\EOS, rmam=\E[?7l, -+ sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;m%?%p9%t\016%e\017%;, -+ sgr0=\E[0m\017, smam=\E[?7h, tbc@, use=xterm-color, - --opennt-35-w|ntconsole-35-w|OpenNT-term35-w compatible with color, -- lines#35, use=opennt-w, -+# GNOME Terminal 2.0.1 (Redhat 8.0) -+# -+# Documentation now claims it implements vt220 (which is demonstrably false). -+# However, it does implement ECH, which is a vt220 feature. And there are -+# workable vt100 LNM, DECALN, DECSNM modes, making it possible to display -+# more of its bugs using vttest. -+# -+# However, note that bce and msgr are broken in this release. Tabs (tbc and -+# hts) are broken as well. Sometimes flash (as in xterm-new) works. -+# -+# kf1 and kf10 are not tested since they're assigned (hardcoded?) to menu -+# operations. Shift-tab generates a distinct sequence so it can be argued -+# that it implements kcbt. -+gnome-rh80|GNOME Terminal, -+ bce@, msgr@, -+ ech=\E[%p1%dX, flash=\E[?5h$<100/>\E[?5l, kbs=\177, -+ kcbt=\E^I, op=\E[39;49m, use=gnome-rh72, - --opennt-50-w|ntconsole-50-w|OpenNT-term50-w compatible with color, -- lines#50, use=opennt-w, -+# GNOME Terminal 2.2.1 (Redhat 9.0) -+# -+# bce and msgr are repaired. -+gnome-rh90|GNOME Terminal, -+ bce, msgr, XT, -+ hpa=\E[%i%p1%dG, kDC=\E[3;2~, kLFT=\EO2D, kRIT=\EO2C, -+ kb2=\E[E, kcbt=\E[Z, kend=\EOF, khome=\EOH, tbc=\E[3g, -+ vpa=\E[%i%p1%dd, use=xterm+pcf0, use=xterm+pcfkeys, -+ use=gnome-rh80, - --opennt-60-w|ntconsole-60-w|OpenNT-term60-w compatible with color, -- lines#60, use=opennt-w, -+# GNOME Terminal 2.14.2 (Fedora Core 5) -+# Ed Catmur notes that gnome-terminal has recognized soft-reset since May 2002. -+gnome-fc5|GNOME Terminal, -+ rs1=\Ec, -+ rs2=\E7\E[r\E8\E[m\E[?7h\E[!p\E[?1;3;4;6l\E[4l\E>\E[?1000l\E[?25h, -+ use=ansi+enq, use=xterm+pcc0, use=gnome-rh90, - --opennt-w-vt|opennt-25-w-vt|ntconsole-w-vt|ntconsole-25-w-vt|OpenNT-term-w-vt compat with color, -- cols#132, use=opennt, -+# GNOME Terminal 2.18.1 (2007 snapshot) -+# -+# For any "recent" version of gnome-terminal, it is futile to attempt to -+# support modifiers on cursor- and keypad keys because the program usually -+# is hardcoded to set $TERM to "xterm", and on startup, it builds a subset -+# of the keys (which more/less correspond to the termcap values), and will -+# interpret those according to the $TERM value, but others not in the -+# terminfo according to some constantly changing set of hacker guidelines -TD -+vte-2007|VTE in GNOME Terminal snapshot 2.18.1, -+ use=xterm+pcc2, use=gnome-fc5, -+gnome-2007|GNOME Terminal snapshot 2.18.1, -+ use=vte-2007, - --# OpenNT terminals with no smcup/rmcup (names match termcap entries) --interix-nti|opennt-nti|opennt-25-nti|ntconsole-25-nti|OpenNT-nti compatible with color, -- rmcup@, smcup@, use=opennt, -+# GNOME Terminal 2.22.3 (2008 snapshot) -+# -+# In vttest, it claims to be a vt220 with national replacement character-sets, -+# but aside from the identifier string, implements only a small fraction of -+# vt220's behavior, which will make it less usable on a VMS system (unclear -+# what the intent of the developer is, since the NRC feature exposed in vttest -+# by this change does not work). -+vte-2008|VTE in GNOME Terminal snapshot 2.22.3, -+ use=vte+pcfkeys, use=vte-2007, -+gnome-2008|GNOME Terminal snapshot 2.22.3, -+ use=vte-2008, - --opennt-35-nti|ntconsole-35-nti|OpenNT-term35-nti compatible with color, -- lines#35, use=opennt-nti, -+# GNOME Terminal 3.6.0 (2012) -+# VTE 0.34.1 was marked in git 2012-10-15 (three days after patch was applied -+# in ncurses). It inherited from gnome-fc5, which broke the modified forms -+# of f1-f4 -TD -+# -+# Testing with tack shows that flash does not/has not worked -TD -+vte-2012|VTE 0.34.1, -+ flash@, ritm=\E[23m, sitm=\E[3m, use=vte-2008, -+# Version 3.6.1 sets TERM to xterm-256color (still hardcoded), which has -+# 61 differences from a correct entry for gnome terminal. -+gnome-2012|GNOME Terminal 3.6.0, -+ use=vte-2012, - --opennt-50-nti|ntconsole-50-nti|OpenNT-term50-nti compatible with color, -- lines#50, use=opennt-nti, -+# GNOME terminal may automatically use the contents of the "xterm" terminfo to -+# supply key information which is not built into the program. With 2.22.3, -+# this list is built into the program (which addresses the inadvertant use of -+# random terminfo data, though using a set of values which does not correspond -+# to any that xterm produces - still not solving the problem that GNOME -+# terminal hardcodes the $TERM variable as "xterm"). -+# -+# terminfo modifier code keys -+# kf13-kf24 shift 2 F1 to F12 -+# kf25-kf36 control 5 F1 to F12 -+# kf37-kf48 shift/control 6 F1 to F12 -+# kf49-kf60 alt 3 F1 to F12 -+# kf61-kf63 shift-alt 4 F1 to F3 -+# -+# The parameters with \EO (SS3) are technically an error, since SS3 should have -+# no parameters. This appears to be rote copying based on xterm+pcc0. -+vte+pcfkeys|VTE's variation on xterm+pcfkeys, -+ kf1=\EOP, kf13=\EO1;2P, kf14=\EO1;2Q, kf15=\EO1;2R, -+ kf16=\EO1;2S, kf2=\EOQ, kf25=\EO1;5P, kf26=\EO1;5Q, -+ kf27=\EO1;5R, kf28=\EO1;5S, kf3=\EOR, kf37=\EO1;6P, -+ kf38=\EO1;6Q, kf39=\EO1;6R, kf4=\EOS, kf40=\EO1;6S, -+ kf49=\EO1;3P, kf50=\EO1;3Q, kf51=\EO1;3R, kf52=\EO1;3S, -+ kf61=\EO1;4P, kf62=\EO1;4Q, kf63=\EO1;4R, -+ use=xterm+pcfkeys, -+gnome+pcfkeys|VTE's variation on xterm+pcfkeys, -+ use=vte+pcfkeys, - --opennt-60-nti|ntconsole-60-nti|OpenNT-term60-nti compatible with color, -- lines#60, use=opennt-nti, -+vte|VTE aka GNOME Terminal, -+ use=vte-2012, -+gnome|GNOME Terminal, -+ use=vte, - --opennt-100-nti|ntconsole-100-nti|OpenNT-term100-nti compatible with color, -- lines#100, use=opennt-nti, -+# palette is hardcoded... -+vte-256color|VTE with xterm 256-colors, -+ use=xterm+256color, use=vte, -+gnome-256color|GNOME Terminal with xterm 256-colors, -+ use=vte-256color, - --######## COMMON TERMINAL TYPES -+# XFCE Terminal 0.2.5.4beta2 - # --# This section describes terminal classes and maker brands that are still --# quite common, but have proprietary command sets not blessed by ANSI. -+# This is based on some of the same source code, e.g., the VTE library, as -+# gnome-terminal, but has fewer features, fails more screens in vttest. -+# Since most of the terminfo-related behavior is due to the VTE library, -+# the terminfo is the same as gnome-terminal. -+xfce|Xfce Terminal, -+ use=vte-2008, -+ -+#### Other GNOME -+# Multi-Gnome-Terminal 1.6.2 - # -+# This does not use VTE, and does have different behavior (compare xfce and -+# gnome). -+mgt|Multi GNOME Terminal, -+ indn=\E[%p1%dS, rin=\E[%p1%dT, use=xterm-xf86-v333, - --#### Altos -+#### KDE -+# This is kvt 0-18.7, shipped with Redhat 6.0 (though whether it supports bce -+# or not is debatable). -+kvt|KDE terminal, -+ bce, km@, -+ kdch1=\177, kend=\E[F, khome=\E[H, use=xterm-color, -+ -+# Konsole 1.0.1 -+# (formerly known as kvt) - # --# Altos made a moderately successful line of UNIX boxes. In 1990 they were --# bought out by Acer, a major Taiwanese manufacturer of PC-clones. --# Acer has a web site at http://www.acer.com. -+# This program hardcodes $TERM to 'xterm', which is not accurate. However, to -+# simplify this entry (and point out why konsole isn't xterm), we base this on -+# xterm-r6. The default keyboard appears to be 'linux'. - # --# Altos descriptions from Ted Mittelstaedt <tedm@agora.rain.com> 4 Sep 1993 --# His comments suggest they were shipped with the system. --# -- --# (altos2: had extension capabilities --# :c0=^A`\r:c1=^Aa\r:c2=^Ab\r:c3=^Ac\r:\ --# :c4=^Ad\r:c5=^Ae\r:c6=^Af\r:c7=^Ag\r:\ --# :c8=^Ah\r:c9=^Ai\r:cA=^Aj\r:cB=^Ak\r:\ --# :cC=^Al\r:cD=^Am\r:cE=^An\r:cF=^Ao\r: --# :XU=^Aq\r:XD=^Ar\r:XR=^As\r:XL=^At\r:\ --# :YU=^AQ\r:YD=^AR\r:YR=^AS\r:YL=^AT\r:\ --# :HL=^AP\r:SP=\E[i:\ --# :IS=\E[@:DE=\E[P:IL=\E[L:NS=\E[S:PS=\E[T:\ --# :LO=\E[0q:LC=\E[5q:LL=\E[6q:\ --# Comparison with the k* capabilities makes it obvious that the c* things are --# shift keys. I have renamed them to keys 32 and up accordingly. Also, --# :sr: was given as a boolean-- esr) --altos2|alt2|altos-2|altos II, -- cols#80, it#8, lines#24, xmc#0, -- clear=\E[H\E[2J, cr=^M, cub1=^H, cud1=\E[1B, cuf1=\E[1C, -- cup=\E[%i%p1%d;%p2%dH, cuu1=\E[1A, dch1=\E[P, dl1=\E[M, -- ed=\E[J, el=\E[K, home=\E[H, ht=^I, ich1=\E[@, -- if=/usr/share/tabset/vt100, il1=\E[L, ind=^J, -- is2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, kDL=^Am\r, -- kEOL=^An\r, kbs=^H, kcbt=^AK\r, kclr=^AL\r, kcub1=\E[D, -- kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=^AM\r, kel=^AN\r, -- kf0=^AI\r, kf1=^A@\r, kf2=^AA\r, kf3=^AB\r, kf32=^A`\r, -- kf33=^Aa\r, kf34=^Ab\r, kf35=^Ac\r, kf36=^Ad\r, kf37=^Ae\r, -- kf38=^Af\r, kf39=^Ag\r, kf4=^AC\r, kf40=^Ah\r, kf41=^Ai\r, -- kf42=^Aj\r, kf43=^Ak\r, kf5=^AD\r, kf6=^AE\r, kf7=^AF\r, -- kf8=^AG\r, kf9=^AH\r, khome=\E[f, kil1=^AJ\r, kind=^AO\r, -- nel=^M^J, rmam=\E[?7l, rmso=\E[m, rmul=\E[m, sgr0=\E[m, -- smam=\E[?7h, smso=\E[7m, smul=\E[4m, --# (altos3: had extension capabilities --# :c0=^A`\r:c1=^Aa\r:c2=^Ab\r:c3=^Ac\r:\ --# :c4=^Ad\r:c5=^Ae\r:c6=^Af\r:c7=^Ag\r:\ --# :c8=^Ah\r:c9=^Ai\r:cA=^Aj\r:cB=^Ak\r:\ --# :cC=^Al\r:cD=^Am\r:cE=^An\r:cF=^Ao\r: --# :XU=^Aq\r:XD=^Ar\r:XR=^As\r:XL=^At\r:\ --# :HL=^AP\r:SP=\E[i:\ --# :IS=\E[@:DE=\E[P:IL=\E[L:NS=\E[S:PS=\E[T:\ --altos3|altos5|alt3|alt5|altos-3|altos-5|altos III or V, -- blink=\E[5p, ri=\EM, sgr0=\E[p, use=altos2, --altos4|alt4|altos-4|altos IV, -- use=wy50, --# (altos7: had extension capabilities: --# :GG#0:GI=\EH8:GF=\EH7:\ --# :c0=^A`\r:c1=^Aa\r:c2=^Ab\r:c3=^Ac\r:\ --# :c4=^Ad\r:c5=^Ae\r:c6=^Af\r:c7=^Ag\r:\ --# :c8=^Ah\r:c9=^Ai\r:cA=^Aj\r:cB=^Ak\r:\ --# :cC=^Al\r:cD=^Am\r:cE=^An\r:cF=^Ao\r: --# Comparison with the k* capabilities makes it obvious that the c* things are --# shift keys. I have renamed them to keys 32 and up accordingly. I have --# also made this entry relative to adm12 in order to give it an <sgr>. The --# <invis> imported by use=adm+sgr may work, let me know. -- esr) --altos7|alt7|altos VII, -- am, mir, -- cols#80, lines#24, xmc#0, -- acsc=j5k3l2m1n8q\:t4u9v=w0x6, blink=\EG2, bold=\EGt, -- clear=\E+^^, cr=^M, cub1=^H, cud1=^J, cuf1=^L, -- cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW, -- dim=\EGp, dl1=\ER, ed=\EY, el=\ET, home=^^, ht=^I, il1=\EE, -- ind=^J, invis=\EG1, -- is2=\E`\:\Ee(\EO\Ee6\Ec41\E~4\Ec21\Eu\E~2, kDL=^Am\r, -- kEOL=^An\r, kbs=^H, kcbt=^AK\r, kclr=^AL\r, kcub1=^H, -- kcud1=^J, kcuf1=^L, kcuu1=^K, kdch1=^AM\r, kel=^AN\r, -- kf0=^AI\r, kf1=^A@\r, kf2=^AA\r, kf3=^AB\r, kf32=^A`\r, -- kf33=^Aa\r, kf34=^Ab\r, kf35=^Ac\r, kf36=^Ad\r, kf37=^Ae\r, -- kf38=^Af\r, kf39=^Ag\r, kf4=^AC\r, kf40=^Ah\r, kf41=^Ai\r, -- kf42=^Aj\r, kf43=^Ak\r, kf5=^AD\r, kf6=^AE\r, kf7=^AF\r, -- kf8=^AG\r, kf9=^AH\r, khome=^^, kil1=^AJ\r, kind=^AO\r, -- knp=\EK, kpp=\EJ, mc4=\EJ, mc5=\Ed#, nel=^M^J, ri=\Ej, -- rmir=\Er, smir=\Eq, use=adm+sgr, --altos7pc|alt7pc|altos PC VII, -- kend=\ET, use=altos7, -- --#### Hewlett-Packard (hp) -+# Notes: -+# a) konsole implements several features from XFree86 xterm, though none of -+# that is documented - except of course in its source code - apparently -+# because its implementors are unaccustomed to reading documentation - as -+# evidenced by the sparse and poorly edited documentation distributed with -+# konsole. Some features such as the 1049 private mode are recognized but -+# incorrectly implemented as a duplicate of the 47 private mode. -+# b) even with the "vt100 (historical)" keyboard setting, the numeric keypad -+# sends PC-style escapes rather than vt100. -+# c) fails vttest menu 3 (Test of character sets) because it does not properly -+# parse some control sequences. Also fails vttest Primary Device Attributes -+# by sending a bogus code (in the source it says it's supposed to be a -+# vt220, which is doubly incorrect because it does not implement vt220 -+# control sequences except for a few special cases). Treat it as a -+# mildly-broken vt102. - # --# Hewlett-Packard --# 8000 Foothills Blvd --# Roseville, CA 95747 --# Vox: 1-(916)-785-4363 (Technical response line for VDTs) --# 1-(800)-633-3600 (General customer support) -+# Update for konsole 1.3.2: -+# The 1049 private mode works (but see the other xterm screens in vttest). -+# Primary Device Attributes now returns the code for a vt100 with advanced -+# video option. Perhaps that's intended to be a "mildly-broken vt102". - # -+# Updated for konsole 1.6.4: -+# add konsole-solaris - # --# As of March 1998, HP no longer has any terminals in production. --# The 700 series (22, 32, 41, 44, 92, 94, 96, 98) is still being --# supported (they still have parts). So are the 2392a and 2394a. --# See the WORKSTATION CONSOLES section for the 700s. -+# Updated for konsole 1.6.6: -+# add control-key modifiers for function-keys, etc. - # -+# vttest menu 1 shows that both konsole and gnome terminal do wrapping -+# different from xterm (and vt100's). They have the same behavior in this -+# detail, but it is unclear which copies the other. -+konsole-base|KDE console window, -+ bce, km@, npc, XT, -+ ncv@, -+ bel@, blink=\E[5m, civis=\E[?25l, cnorm=\E[?25h, -+ ech=\E[%p1%dX, flash=\E[?5h$<100/>\E[?5l, -+ hpa=\E[%i%p1%dG, indn=\E[%p1%dS, kbs=\177, kdch1=\E[3~, -+ kend=\E[4~, kf1@, kf10@, kf11@, kf12@, kf13@, kf14@, kf15@, kf16@, -+ kf17@, kf18@, kf19@, kf2@, kf20@, kf3@, kf4@, kf5@, kf6@, kf7@, kf8@, -+ kf9@, kfnd@, khome=\E[1~, kslt@, rin=\E[%p1%dT, rmam=\E[?7l, -+ rmso=\E[27m, rmul=\E[24m, -+ rs2=\E7\E[r\E8\E[m\E[?7h\E[?1;3;4;6l\E[4l\E>\E[?1000l\E[?25h, -+ sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;, -+ sgr0=\E[0m\017, smam=\E[?7h, vpa=\E[%i%p1%dd, -+ use=ecma+color, use=xterm-r6, -+konsole-linux|KDE console window with linux keyboard, -+ kf1=\E[[A, kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf13@, -+ kf14@, kf15@, kf16@, kf17@, kf18@, kf19@, kf2=\E[[B, kf20@, -+ kf3=\E[[C, kf4=\E[[D, kf5=\E[[E, kf6=\E[17~, kf7=\E[18~, -+ kf8=\E[19~, kf9=\E[20~, use=konsole-base, -+konsole-solaris|KDE console window with Solaris keyboard, -+ kbs=^H, kend=\E[4~, khome=\E[1~, use=konsole-vt100, -+# KDE's "XFree86 3.x.x" keyboard is based on reading the xterm terminfo rather -+# than testing the code. -+konsole-xf3x|KDE console window with keyboard for XFree86 3.x xterm, -+ kend=\E[4~, khome=\E[1~, use=konsole-vt100, -+# The value for kbs reflects local customization rather than the settings used -+# for XFree86 xterm. -+konsole-xf4x|KDE console window with keyboard for XFree86 4.x xterm, -+ kend=\EOF, khome=\EOH, use=konsole+pcfkeys, -+ use=konsole-vt100, -+# Konsole does not implement shifted cursor-keys. -+konsole+pcfkeys|konsole subset of xterm+pcfkeys, -+ kLFT@, kRIT@, kcbt=\E[Z, kind@, kri@, kDN@, kUP@, use=xterm+pcc2, -+ use=xterm+pcf0, -+# KDE's "vt100" keyboard has no relationship to any terminal that DEC made, but -+# it is still useful for deriving the other entries. -+konsole-vt100|KDE console window with vt100 (sic) keyboard, -+ kbs=\177, kdch1=\E[3~, kend=\E[F, kf1=\E[11~, kf10=\E[21~, -+ kf11=\E[23~, kf12=\E[24~, kf13@, kf14@, kf15@, kf16@, kf17@, -+ kf18@, kf19@, kf2=\E[12~, kf20@, kf3=\E[13~, kf4=\E[14~, -+ kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, -+ khome=\E[H, use=konsole-base, -+konsole-vt420pc|KDE console window with vt420 pc keyboard, -+ kbs=^H, kdch1=\177, use=konsole-vt100, -+konsole-16color|klone of xterm-16color, -+ ncv#32, use=ibm+16color, use=konsole, -+# make a default entry for konsole -+konsole|KDE console window, -+ use=konsole-xf4x, - --# Generic HP terminal - this should (hopefully) work on any HP terminal. --hpgeneric|hp|hewlett-packard generic terminal, -- OTbs, OTpt, am, da, db, mir, xhp, -- cols#80, lines#24, lm#0, vt#6, -- bel=^G, clear=\EH\EJ, cr=^M, cub1=^H, cud1=^J, cuf1=\EC, -- cup=\E&a%p2%dc%p1%dY$<6>, cuu1=\EA, dch1=\EP, dl1=\EM, -- ed=\EJ, el=\EK, hpa=\E&a%p1%dC, ht=^I, hts=\E1, il1=\EL, -- ind=^J, kbs=^H, kcbt=\Ei, rmir=\ER, rmso=\E&d@, rmul=\E&d@, -- sgr0=\E&d@, smir=\EQ, smso=\E&dJ, smul=\E&dD, tbc=\E3, -- vpa=\E&a%p1%dY, -- --hp110|hewlett-packard model 110 portable, -- lines#16, use=hpgeneric, -- --hp+pfk+cr|hp function keys with CR, -- kf1=\Ep\r, kf2=\Eq\r, kf3=\Er\r, kf4=\Es\r, kf5=\Et\r, -- kf6=\Eu\r, kf7=\Ev\r, kf8=\Ew\r, -+# palette is hardcoded... -+konsole-256color|KDE console window with xterm 256-colors, -+ initc@, use=xterm+256color, use=konsole, - --hp+pfk-cr|hp function keys w/o CR, -- kf1=\Ep, kf2=\Eq, kf3=\Er, kf4=\Es, kf5=\Et, kf6=\Eu, kf7=\Ev, -- kf8=\Ew, -+#### MLTERM -+# http://mlterm.sourceforge.net/ - --# The hp2621s use the same keys for the arrows and function keys, --# but not separate escape sequences. These definitions allow the --# user to use those keys as arrow keys rather than as function --# keys. --hp+pfk+arrows|hp alternate arrow definitions, -- kcub1=\Eu\r, kcud1=\Ew\r, kcuf1=\Ev\r, kcuu1=\Et\r, kf1@, -- kf2@, kf3@, kf4@, kf5@, kf6@, kf7@, kf8@, khome=\Ep\r, kind=\Er\r, -- kll=\Eq\r, kri=\Es\r, -+mlterm|multi lingual terminal emulator, -+ use=mlterm3, - --hp+arrows|hp arrow definitions, -- kcub1=\ED, kcud1=\EB, kcuf1=\EC, kcuu1=\EA, khome=\Eh, -- kind=\ES, kll=\EF, kri=\ET, -+# Tested mlterm 3.2.2: -+# mlterm 3.x has made changes, but they are not reflected in the included -+# mlterm.ti; this entry is based on testing with tack and vttest -TD -+mlterm3|multi lingual terminal emulator, -+ kf1=\E[11~, kf2=\E[12~, kf3=\E[13~, kf4=\E[14~, -+ use=xterm+app, use=xterm+pcf0, use=xterm+pcc2, -+ use=xterm+pce2, use=mlterm2, - --# Generic stuff from the HP 262x series -+# This is mlterm 2.9.3's mlterm.ti, with some additions/corrections -TD - # --hp262x|HP 262x terminals, -- xhp, -- blink=\E&dA, dch1=\EP$<2>, ed=\EJ, ht=\011$<2>, ind=\ES, -- invis=\E&dS, ip=$<2>, kcub1=\ED, kcud1=\EB, kcuf1=\EC, -- kcuu1=\EA, kdch1=\EP, kdl1=\EM, ked=\EJ, kel=\EK, khome=\Eh, -- kich1=\EQ, kil1=\EL, kind=\ES, knp=\EU, kpp=\EV, kri=\ET, -- krmir=\ER, rev=\E&dB, rmkx=\E&s0A, rmso=\E&d@, rmul=\E&d@, -- sgr=\E&d%{64}%?%p1%t%{66}%|%;%?%p2%t%{68}%|%;%?%p3%t%{66}%|%;%?%p4%t%{65}%|%;%c, -- sgr0=\E&d@, smkx=\E&s1A, smso=\E&dB, smul=\E&dD, -- --# Note: no <home> on HPs since that homes to top of memory, not screen. --# Due to severe 2621 braindamage, the only way to get the arrow keys to --# transmit anything at all is to turn on the function key labels --# with <smkx>, and even then the user has to hold down shift! --# The default 2621 turns off the labels except when it has to to --# enable the function keys. If your installation prefers labels --# on all the time, or off all the time (at the "expense" of the --# function keys), use 2621-nl or 2621-wl. -+# It is nominally a vt102 emulator, with features borrowed from rxvt and -+# xterm. - # --# Note: there are newer ROMs for 2621's that allow you to set --# strap A so the regular arrow keys xmit \EA, etc, as with the --# 2645. However, even with this strap set, the terminal stops --# xmitting if you reset it, until you unset and reset the strap! --# Since there is no way to set/unset the strap with an escape --# sequence, we don't use it in the default. --# If you like, you can use 2621-ba (brain-damaged arrow keys). --hp2621-ba|2621 w/new rom and strap A set, -- rmkx@, smkx@, use=hp+arrows, use=hp2621, -- --# hp2621 with function labels. Most of the time they are off, --# but inside vi, the function key labels appear. You have to --# hold down shift to get them to xmit. --hp2621|hp2621a|hp2621A|2621|2621a|2621A|hp2621-wl|2621-wl|hp 2621 w/labels, -- is2=\E&jA\r, rmkx=\E&jA, use=hp2621-fl, --hp2621-fl|hp 2621, -- xhp@, xon, -- pb#19200, -- cbt=\Ei, cup=\E&a%p2%dc%p1%dY, dch1=\EP$<2>, ht=\011$<2>, -- ip=$<2>, is2=\E&j@\r, rmkx=\E&j@, rmso=\E&d@, rmul=\E&d@, -- sgr0=\E&d@, smkx=\E&jB, smso=\E&dD, smul=\E&dD, -- use=hp+pfk+cr, use=hpgeneric, -- --# To use hp2621p printer, setenv TERM=2621p, PRINTER=2612p --hp2621p|hp 2621 with printer, -- mc4=\E&p13C, mc5=\E&p11C, use=hp2621, -- --hp2621p-a|hp2621p with fn as arrows, -- use=hp+pfk+arrows, use=hp2621p, -- --# hp2621 with k45 keyboard --hp2621-k45|hp2621k45|k45|hp 2621 with 45 keyboard, -- kbs=^H, kcub1=\ED, kcud1=\EB, kcuf1=\EC, kcuu1=\EA, -- khome=\Eh, rmkx=\E&s0A, smkx=\E&s1A, use=hp2621, -- --# 2621 using all 48 lines of memory, only 24 visible at any time. --hp2621-48|48 line 2621, -- lines#48, -- cup=\E&a%p2%dc%p1%dR, home=\EH, vpa=\E&a%p1%dR, -- use=hp2621, -- --# 2621 with no labels ever. Also prevents vi delays on escape. --hp2621-nl|hp 2621 with no labels, -- kcub1@, kcud1@, kcuf1@, kcuu1@, khome@, rmkx@, smkx@, -- use=hp2621-fl, -- --# Needed for UCB ARPAVAX console, since lsi-11 expands tabs --# (wrong). --# --hp2621-nt|hp 2621 w/no tabs, -- ht@, use=hp2621, -- --# Hp 2624 B with 4 or 10 pages of memory. -+# The function keys are numbered based on shift/control/alt modifiers, except -+# that the control-modifier itself is used to spawn a new copy of mlterm (the -+# "-P" option). So control/F1 to control/F12 may not be usable, depending on -+# how it is configured. - # --# Some assumptions are made with this entry. These settings are --# NOT set up by the initialization strings. -+# kf1 to kf12 \E[11~ to \E[24~ -+# shift kf1 to kf12 \E[11;2~ to \E[24;2~ -+# alt kf1 to kf12 \E[11;3~ to \E[24;3~ -+# shift/alt kf1 to kf12 \E[11;4~ to \E[24;4~ -+# control kf1 to kf12 \E[11;5~ to \E[24;5~ (maybe) -+# control/shift kf1 to kf12 \E[11;6~ to \E[24;6~ -+# control/alt kf1 to kf12 \E[11;7~ to \E[24;7~ -+# control/shift/alt kf1 to kf12 \E[11;8~ to \E[24;8~ - # --# Port Configuration --# RecvPace=Xon/Xoff --# XmitPace=Xon/Xoff --# StripNulDel=Yes -+mlterm2|multi lingual terminal emulator, -+ am, eslok, km, mc5i, mir, msgr, npc, xenl, XT, -+ colors#8, cols#80, it#8, lines#24, pairs#64, -+ acsc=00``aaffgghhjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -+ bel=^G, bold=\E[1m, cbt=\E[Z, civis=\E[?25l, -+ clear=\E[H\E[2J, cnorm=\E[?25h, cr=^M, -+ csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, -+ cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, -+ cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, -+ dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, -+ ech=\E[%p1%dX, ed=\E[J, el=\E[K, el1=\E[1K, enacs=, -+ home=\E[H, hpa=\E[%i%p1%dG, ht=^I, hts=\EH, ich=\E[%p1%d@, -+ ich1=\E[@, il=\E[%p1%dL, il1=\E[L, ind=^J, indn=\E[%p1%dS, -+ is2=\E7\E[r\E[m\E[?7h\E[?1;3;4;6l\E[4l\E8\E>, -+ kbs=\177, kcbt=\E[Z, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, -+ kcuu1=\EOA, kdch1=\E[3~, kend=\EOF, kent=\EOM, kfnd=\E[1~, -+ khome=\EOH, kich1=\E[2~, kind=\EO1;2B, kmous=\E[M, -+ knp=\E[6~, kpp=\E[5~, kri=\EO1;2A, kslt=\E[4~, mc0=\E[i, -+ nel=\EE, op=\E[39;49m, rc=\E8, rev=\E[7m, ri=\EM, -+ rin=\E[%p1%dT, rmacs=\E(B, rmam=\E[?7l, rmcup=\E[?1049l, -+ rmir=\E[4l, rmkx=\E[?1l\E>, rmso=\E[27m, rmul=\E[24m, -+ rs2=\E7\E[r\E8\E[m\E[?7h\E[?1;3;4;6l\E[4l\E>\E[?1000l, -+ sc=\E7, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, -+ sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;m%?%p9%t\E(0%e\E(B%;, -+ sgr0=\E[m\E(B, smacs=\E(0, smam=\E[?7h, smcup=\E[?1049h, -+ smir=\E[4h, smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, -+ tbc=\E[3g, u6=\E[%i%d;%dR, u7=\E[6n, u8=\E[?1;2c, u9=\E[c, -+ vpa=\E[%i%p1%dd, use=mlterm+pcfkeys, use=xterm+r6f2, -+ -+# The insert/delete/home/end keys do not respond to modifiers because mlterm -+# looks in its termcap to decide which string to send. If it used terminfo -+# (when available), it could use the extended names introduced for xterm. -+mlterm+pcfkeys|fragment for PC-style fkeys, -+ kLFT=\EO1;2D, kNXT=\E[6;2~, kPRV=\E[5;2~, kRIT=\EO1;2C, -+ kDN=\EO1;2B, kDN3=\EO1;3B, kDN4=\EO1;4B, kDN5=\EO1;5B, -+ kDN6=\EO1;6B, kDN7=\EO1;7B, kIC5=\E[2;5~, kIC6=\E[2;6~, -+ kLFT3=\EO1;3D, kLFT4=\EO1;4D, kLFT5=\EO1;5D, -+ kLFT6=\EO1;6D, kLFT7=\EO1;7D, kNXT5=\E[6;5~, -+ kNXT6=\E[6;6~, kPRV5=\E[5;5~, kPRV6=\E[5;6~, -+ kRIT3=\EO1;3C, kRIT4=\EO1;4C, kRIT5=\EO1;5C, -+ kRIT6=\EO1;6C, kRIT7=\EO1;7C, kUP=\EO1;2A, kUP3=\EO1;3A, -+ kUP4=\EO1;4A, kUP5=\EO1;5A, kUP6=\EO1;6A, kUP7=\EO1;7A, -+ -+mlterm-256color|mlterm 3.0 with xterm 256-colors, -+ use=xterm+256color, use=mlterm, -+ -+#### RXVT -+# From: Thomas Dickey <dickey@clark.net> 04 Oct 1997 -+# Updated: Oezguer Kesim <kesim@math.fu-berlin.de> 02 Nov 1997 -+# Notes: -+# rxvt 2.21b uses -+# smacs=\E(B\E)U^N, rmacs=\E(B\E)0^O, -+# but some applications don't work with that. -+# It also has an AIX extension -+# box2=lqkxjmwuvtn, -+# and -+# ech=\E[%p1%dX, -+# but the latter does not work correctly. - # --# Terminal Configuration --# InhHndShk=Yes --# InhDC2=Yes --# XmitFnctn(A)=No --# InhEolWrp=No -+# The distributed terminfo says it implements hpa and vpa, but they are not -+# implemented correctly, using relative rather than absolute positioning. - # --# Note: the 2624 DOES have a true <home>, believe it or not! -+# rxvt is normally configured to look for "xterm" or "xterm-color" as $TERM. -+# Since rxvt is not really compatible with xterm, it should be configured as -+# "rxvt" or "rxvt-color". - # --# The 2624 has an "error line" to which messages can be sent. --# This is CLOSE to what is expected for a "status line". However, --# after a message is sent to the "error line", the next carriage --# return is EATEN and the "error line" is turned back off again! --# So I guess we can't define <hs>, <eslok>, <wsl>, <dsl>, <fsl>, <tsl>. -+# removed dch/dch1 because they are inconsistent with bce/ech -TD -+# remove km as per tack test -TD -+rxvt-basic|rxvt terminal base (X Window System), -+ OTbs, am, bce, eo, mir, msgr, xenl, xon, XT, -+ cols#80, it#8, lines#24, -+ acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -+ bel=^G, blink=\E[5m, bold=\E[1m, civis=\E[?25l, -+ clear=\E[H\E[2J, cnorm=\E[?25h, cr=^M, -+ csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, -+ cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, -+ cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, -+ dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[K, el1=\E[1K, -+ enacs=\E(B\E)0, flash=\E[?5h\E[?5l, home=\E[H, ht=^I, -+ hts=\EH, ich=\E[%p1%d@, ich1=\E[@, il=\E[%p1%dL, il1=\E[L, -+ ind=^J, is1=\E[?47l\E=\E[?1l, -+ is2=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;3;4;6l\E[4l, kbs=^H, -+ kcbt=\E[Z, kmous=\E[M, rc=\E8, rev=\E[7m, ri=\EM, rmacs=^O, -+ rmcup=\E[2J\E[?47l\E8, rmir=\E[4l, rmkx=\E>, rmso=\E[27m, -+ rmul=\E[24m, -+ rs1=\E>\E[1;3;4;5;6l\E[?7h\E[m\E[r\E[2J\E[H, -+ rs2=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;3;4;6l\E[4l\E>\E[?1000l\E[?25h, -+ s0ds=\E(B, s1ds=\E(0, sc=\E7, -+ sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;, -+ sgr0=\E[0m\017, smacs=^N, smcup=\E7\E[?47h, smir=\E[4h, -+ smkx=\E=, smso=\E[7m, smul=\E[4m, tbc=\E[3g, use=vt100+enq, -+ use=rxvt+pcfkeys, use=vt220+keypad, -+# Key Codes from rxvt reference: - # --# This entry supports emacs (and any other program that uses raw --# mode) at 4800 baud and less. I couldn't get the padding right --# for 9600. -+# Note: Shift + F1-F10 generates F11-F20 - # --# (hp2624: replaced NUL sequences in flash with mandatory pauses -- esr) --hp2624|hp2624a|hp2624b|hp2624b-4p|Hewlett Packard 2624 B, -- da, db, -- lm#96, -- flash=\E&w13F$<66/>\E&w12F$<66/>\E&w13F$<66/>\E&w12F, -- use=hp+labels, use=scrhp, -- --# This hp2626 entry does not use any of the fancy windowing stuff --# of the 2626. -+# For the keypad, use Shift to temporarily override Application-Keypad -+# setting use Num_Lock to toggle Application-Keypad setting if Num_Lock -+# is off, escape sequences toggle Application-Keypad setting. -+# Also note that values of Home, End, Delete may have been compiled -+# differently on your system. - # --# Indeed, terminfo does not yet handle such stuff. Since changing --# any window clears memory, it is probably not possible to use --# this for screen opt. -+# Normal Shift Control Ctrl+Shift -+# Tab ^I ESC [ Z ^I ESC [ Z -+# BackSpace ^H ^? ^? ^? -+# Find ESC [ 1 ~ ESC [ 1 $ ESC [ 1 ^ ESC [ 1 @ -+# Insert ESC [ 2 ~ paste ESC [ 2 ^ ESC [ 2 @ -+# Execute ESC [ 3 ~ ESC [ 3 $ ESC [ 3 ^ ESC [ 3 @ -+# Select ESC [ 4 ~ ESC [ 4 $ ESC [ 4 ^ ESC [ 4 @ -+# Prior ESC [ 5 ~ scroll-up ESC [ 5 ^ ESC [ 5 @ -+# Next ESC [ 6 ~ scroll-down ESC [ 6 ^ ESC [ 6 @ -+# Home ESC [ 7 ~ ESC [ 7 $ ESC [ 7 ^ ESC [ 7 @ -+# End ESC [ 8 ~ ESC [ 8 $ ESC [ 8 ^ ESC [ 8 @ -+# Delete ESC [ 3 ~ ESC [ 3 $ ESC [ 3 ^ ESC [ 3 @ -+# F1 ESC [ 11 ~ ESC [ 23 ~ ESC [ 11 ^ ESC [ 23 ^ -+# F2 ESC [ 12 ~ ESC [ 24 ~ ESC [ 12 ^ ESC [ 24 ^ -+# F3 ESC [ 13 ~ ESC [ 25 ~ ESC [ 13 ^ ESC [ 25 ^ -+# F4 ESC [ 14 ~ ESC [ 26 ~ ESC [ 14 ^ ESC [ 26 ^ -+# F5 ESC [ 15 ~ ESC [ 28 ~ ESC [ 15 ^ ESC [ 28 ^ -+# F6 ESC [ 17 ~ ESC [ 29 ~ ESC [ 17 ^ ESC [ 29 ^ -+# F7 ESC [ 18 ~ ESC [ 31 ~ ESC [ 18 ^ ESC [ 31 ^ -+# F8 ESC [ 19 ~ ESC [ 32 ~ ESC [ 19 ^ ESC [ 32 ^ -+# F9 ESC [ 20 ~ ESC [ 33 ~ ESC [ 20 ^ ESC [ 33 ^ -+# F10 ESC [ 21 ~ ESC [ 34 ~ ESC [ 21 ^ ESC [ 34 ^ -+# F11 ESC [ 23 ~ ESC [ 23 $ ESC [ 23 ^ ESC [ 23 @ -+# F12 ESC [ 24 ~ ESC [ 24 $ ESC [ 24 ^ ESC [ 24 @ -+# F13 ESC [ 25 ~ ESC [ 25 $ ESC [ 25 ^ ESC [ 25 @ -+# F14 ESC [ 26 ~ ESC [ 26 $ ESC [ 26 ^ ESC [ 26 @ -+# F15 (Help) ESC [ 28 ~ ESC [ 28 $ ESC [ 28 ^ ESC [ 28 @ -+# F16 (Menu) ESC [ 29 ~ ESC [ 29 $ ESC [ 29 ^ ESC [ 29 @ -+# F17 ESC [ 31 ~ ESC [ 31 $ ESC [ 31 ^ ESC [ 31 @ -+# F18 ESC [ 32 ~ ESC [ 32 $ ESC [ 32 ^ ESC [ 32 @ -+# F19 ESC [ 33 ~ ESC [ 33 $ ESC [ 33 ^ ESC [ 33 @ -+# F20 ESC [ 34 ~ ESC [ 34 $ ESC [ 34 ^ ESC [ 34 @ - # --# ed is incredibly slow most of the time - I am guessing at the --# exact padding. Since the terminal uses xoff/xon this is intended --# only for cost computation, so that the terminal will prefer el --# or even dl1 which is probably faster! -+# Application -+# Up ESC [ A ESC [ a ESC O a ESC O A -+# Down ESC [ B ESC [ b ESC O b ESC O B -+# Right ESC [ C ESC [ c ESC O c ESC O C -+# Left ESC [ D ESC [ d ESC O d ESC O D -+# KP_Enter ^M ESC O M -+# KP_F1 ESC O P ESC O P -+# KP_F2 ESC O Q ESC O Q -+# KP_F3 ESC O R ESC O R -+# KP_F4 ESC O S ESC O S -+# XK_KP_Multiply * ESC O j -+# XK_KP_Add + ESC O k -+# XK_KP_Separator , ESC O l -+# XK_KP_Subtract - ESC O m -+# XK_KP_Decimal . ESC O n -+# XK_KP_Divide / ESC O o -+# XK_KP_0 0 ESC O p -+# XK_KP_1 1 ESC O q -+# XK_KP_2 2 ESC O r -+# XK_KP_3 3 ESC O s -+# XK_KP_4 4 ESC O t -+# XK_KP_5 5 ESC O u -+# XK_KP_6 6 ESC O v -+# XK_KP_7 7 ESC O w -+# XK_KP_8 8 ESC O x -+# XK_KP_9 9 ESC O y - # --# \ED\EJ\EC hack for ed from Ed Bradford - apparently ed is only --# extra slow on the last line of the window. -+# The source-code for rxvt actually defines mappings for F21-F35, using -+# "ESC [ 35 ~" to "ESC [ 49 ~". Keyboards with more than 12 function keys -+# are rare, so this entry uses the shift- and control-modifiers as in -+# xterm+pcfkeys to define keys past F12. - # --# The padding probably should be changed. -+# kIC is normally not used, since rxvt performs a paste for that (shifted -+# insert), unless private mode 35 is set. - # --hp2626|hp2626a|hp2626p|hp 2626, -- da, db, -- lm#0, pb#19200, -- ed=\ED\EJ$<500>\EC, indn=\E&r%p1%dD, ip=$<4>, -- is2=\E&j@\r, rin=\E&r%p1%dU, use=hp+pfk+cr, -- use=hp+labels, use=scrhp, -+# kDN, kDN5, kDN6, etc are extensions based on the names from xterm+pcfkeys -TD -+# Removed kDN6, etc (control+shift) since rxvt does not implement this -TD -+rxvt+pcfkeys|fragment for PC-style fkeys, -+ kDC=\E[3$, kEND=\E[8$, kHOM=\E[7$, kIC=\E[2$, kLFT=\E[d, -+ kNXT=\E[6$, kPRV=\E[5$, kRIT=\E[c, kcub1=\E[D, kcud1=\E[B, -+ kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[3~, kel=\E[8\^, -+ kend=\E[8~, kf1=\E[11~, kf10=\E[21~, kf11=\E[23~, -+ kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, kf15=\E[28~, -+ kf16=\E[29~, kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, -+ kf2=\E[12~, kf20=\E[34~, kf21=\E[23$, kf22=\E[24$, -+ kf23=\E[11\^, kf24=\E[12\^, kf25=\E[13\^, kf26=\E[14\^, -+ kf27=\E[15\^, kf28=\E[17\^, kf29=\E[18\^, kf3=\E[13~, -+ kf30=\E[19\^, kf31=\E[20\^, kf32=\E[21\^, kf33=\E[23\^, -+ kf34=\E[24\^, kf35=\E[25\^, kf36=\E[26\^, kf37=\E[28\^, -+ kf38=\E[29\^, kf39=\E[31\^, kf4=\E[14~, kf40=\E[32\^, -+ kf41=\E[33\^, kf42=\E[34\^, kf43=\E[23@, kf44=\E[24@, -+ kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, -+ kfnd=\E[1~, khome=\E[7~, kich1=\E[2~, kind=\E[a, knp=\E[6~, -+ kpp=\E[5~, kri=\E[b, kslt=\E[4~, kDC5=\E[3\^, kDC6=\E[3@, -+ kDN=\E[b, kDN5=\EOb, kEND5=\E[8\^, kEND6=\E[8@, -+ kHOM5=\E[7\^, kHOM6=\E[7@, kIC5=\E[2\^, kIC6=\E[2@, -+ kLFT5=\EOd, kNXT5=\E[6\^, kNXT6=\E[6@, kPRV5=\E[5\^, -+ kPRV6=\E[5@, kRIT5=\EOc, kUP=\E[a, kUP5=\EOa, - --# This entry is for sysline. It allocates a 23 line window with --# a 115 line workspace for regular use, and a 1 line window for --# the status line. --# --# This assumes port 2 is being used. --# Turn off horizontal line, Create ws #1 with 115 lines, --# Create ws #2 with 1 line, Create window #1 lines 1-23, --# Create window #2 lines 24-24, Attach cursor to workspace #1. --# Note that this clears the tabs so it must be done by tset before --# it sets the tabs. --# --hp2626-s|hp 2626 using only 23 lines, -- eslok, hs, -- lines#23, -- fsl=\E&d@\E&w7f2p1I\E&w4f1I, -- is1=\E&q3t0{0H \E&w0f115n1I \E&w0f1n2I \E&w2f1i0d0u22l0S \E&w2f2i0d23u23l0S \E&w7f2p1I \r, -- tsl=\E&w7f2p2I\E&w4f2I\r\EK\E&a%p1%dC, use=hp2626, --# Force terminal back to 24 lines after being 23. --hp2626-ns|hp 2626 using all 24 lines, -- is1=\E&q3t0{0H \E&w0f118n1I \E&w0f1n2I \E&w2f1i0d0u23l0S \E&w3f2I \E&w7f2p1I \r, -- use=hp2626, --# Various entries useful for small windows on 2626. --hp2626-12|hewlett-packard 2626 12 lines, -- lines#12, use=hp2626, --hp2626-12x40|hewlett-packard 2626 12 lines 40 columns, -- cols#40, lines#12, use=hp2626, --hp2626-x40|hewlett-packard 2626 40 columns, -- cols#40, use=hp2626, --hp2626-12-s|hewlett-packard 2626 11 lines plus status, -- lines#11, use=hp2626-s, -+rxvt|rxvt terminal emulator (X Window System), -+ ncv@, -+ hpa=\E[%i%p1%dG, kf0=\E[21~, sgr0=\E[m\017, -+ vpa=\E[%i%p1%dd, use=rxvt-basic, use=ecma+color, -+rxvt-color|rxvt terminal emulator (X Window System), -+ use=rxvt, -+rxvt-256color|rxvt 2.7.9 with xterm 256-colors, -+ use=xterm+256color, use=rxvt, -+rxvt-88color|rxvt 2.7.9 with xterm 88-colors, -+ use=xterm+88color, use=rxvt, -+rxvt-xpm|rxvt terminal emulator (X Window System), -+ use=rxvt, -+rxvt-cygwin|rxvt terminal emulator (X Window System) on cygwin, -+ acsc=+\257\,\256-\^0\333`\004a\261f\370g\361h\260j\331k\277l\332m\300n\305o~p\304q\304r\304s_t\303u\264v\301w\302x\263y\363z\362{\343|\330}\234~\376, -+ use=rxvt, -+rxvt-cygwin-native|rxvt terminal emulator (native MS Window System port) on cygwin, -+ acsc=+\257\,\256-\^0\333`\004a\261f\370g\361h\260j\331k\277l\332m\300n\305o~p\304q\304r\304s_t\303u\264v\301w\302x\263y\363z\362{\343|\330~\376, -+ use=rxvt-cygwin, - --# --# hp2627 color tubes from University of Wisconsin --# --hp2627a-rev|hp 2627 with reverse video colors, -- cr=^M, cud1=^J, ht=^I, ind=^J, -- is2=\E&v0m1a0b0c1x1y1z1i0a0b1c1x1y1z0i0S\E&j@\r\E3\r, -- kbs=^H, kcub1=^H, kcud1=^J, nel=^M^J, rmul=\E&v0S\E&d@, -- smul=\E&dD\E&v1S, use=hp2621-nl, --hp2627a|hp 2627 color terminal with no labels, -- cr=^M, cud1=^J, ht=^I, ind=^J, -- is2=\E&v0m1a1b0c1i0a1b1c2i1a0b0c0i0S\E&j@\r\E3\r, -- kbs=^H, kcub1=^H, kcud1=^J, nel=^M^J, rmso=\E&v0S, -- rmul=\E&v0S\E&d@, smso=\E&v2S, smul=\E&dD\E&v1S, -- use=hp2621-nl, --hp2627c|hp 2627 color (cyan) terminal with no labels, -- cr=^M, cud1=^J, ht=^I, ind=^J, -- is2=\E&v0m1a0b0c2i1a1b0c1i0a1b1c0i0S\E&j@\r\E3\r, -- kbs=^H, kcub1=^H, kcud1=^J, nel=^M^J, use=hp2627a, -+# This variant is supposed to work with rxvt 2.7.7 when compiled with -+# NO_BRIGHTCOLOR defined. rxvt needs more work... -+rxvt-16color|xterm with 16 colors like aixterm, -+ ncv#32, use=ibm+16color, use=rxvt, - --# hp2640a doesn't have the Y cursor addressing feature, and C is --# memory relative instead of screen relative, as we need. -+#### MRXVT -+# mrxvt 0.5.4 - # --hp2640a|hp 2640a, -- cup@, rmkx@, smkx@, use=hp2645, -- --hp2640b|hp2644a|hp 264x series, -- rmkx@, smkx@, use=hp2645, -- --# (hp2641a: removed unknown :gu: -- esr) --hp2641a|hp2645a|hp2647a|HP 264?A series BRL entry, -- am, da, db, mir, xhp, -- cols#80, lines#24, -- bel=^G, clear=\EH\EJ, cr=^M, cub1=^H, cud1=^J, cuf1=\EC, -- cup=\E&a%p2%2dc%p1%2dY, cuu1=\EA, dch1=\EP, dl1=\EM, -- ed=\EJ, el=\EK, hpa=\E&a%p1%2dC, ht=^I, -- if=/usr/share/tabset/std, il1=\EL, ind=^J, -- is2=\EE$<500/>, kbs=^H, kcub1=^H, kcud1=^J, nel=^M^J, -- rmir=\ER, rmso=\E&d@, smir=\EQ, smso=\E&dB, -- vpa=\E&a%p1%2dY, -- --# This terminal should be used at 4800 baud or less. It needs padding for --# plain characters at 9600, I guessed at an appropriate cr delay. It really --# wants ^E/^F handshaking, but that doesn't work well even if you write --# software to support it. --hp2645|hp45|HP 2645 series, -- pb#9600, -- blink=\E&dA, cr=\r$<20>, dim=\E&dH, kctab=\E2, kcub1=\ED, -- kcud1=\EB, kcuf1=\EC, kcuu1=\EA, kdch1=\EP, kdl1=\EM, -- ked=\EJ, kel=\EK, khome=\Eh, khts=\E1, kich1=\EQ, kil1=\EL, -- kind=\ES, knp=\EU, kpp=\EV, kri=\ET, krmir=\ER, rev=\E&dB, -- rmkx=\E&s0A, -- sgr=\E&d%{64}%?%p1%t%{66}%|%;%?%p2%t%{68}%|%;%?%p3%t%{66}%|%;%?%p4%t%{65}%|%;%?%p5%t%{72}%|%;%?%p6%t%{66}%|%;%c, -- sgr0=\E&d@, smkx=\E&s1A, smul=\E&dD, use=hpgeneric, --# You should use this terminal at 4800 baud or less. --hp2648|hp2648a|HP 2648a graphics terminal, -- clear=\EH\EJ$<50>, cup=\E&a%p2%dc%p1%dY$<20>, -- dch1=\EP$<7>, ip=$<5>, use=hp2645, -- --# The HP 150 terminal is a fairly vanilla HP terminal, with the --# clreol standout problem. It also has graphics capabilities and --# a touch screen, which we don't describe here. --hp150|hewlett packard Model 150, -- OTbs, use=hp2622, -+# mrxvt is based on rxvt 2.7.11, but has by default XTERM_FKEYS defined, which -+# makes its function-keys different from other flavors of rxvt -TD -+mrxvt|multitabbed rxvt, -+ XT, -+ kEND=\E[8;2~, kHOM=\E[7;2~, kcub1=\E[D, kcud1=\E[B, -+ kcuf1=\E[C, kcuu1=\E[A, kend=\E[8~, khome=\E[7~, -+ kEND3=\E[8;3~, kEND4=\E[8;4~, kEND5=\E[8;5~, -+ kEND6=\E[8;6~, kEND7=\E[8;7~, kHOM3=\E[7;3~, -+ kHOM4=\E[7;4~, kHOM5=\E[7;5~, kHOM6=\E[7;6~, -+ kHOM7=\E[7;7~, use=xterm+r6f2, use=xterm+pcfkeys, -+ use=rxvt, - --# HP 2382a terminals, "the little ones." They don't have any --# alternate character set support and sending out ^N/^O will --# leave the screen blank. --hp2382a|hp2382|hewlett packard 2382a, -- da, db, -- lh#1, lm#48, -- acsc@, -- pln=\E&f0a%p1%dk%p2%l%Pa%?%ga%t%ga%d%e1%;d0L%?%ga%!%t %;%p2%s, -- rmacs@, -- sgr=\E&d%{0}%Pa%?%p4%t%{1}%ga%+%Pa%;%?%p1%p3%|%p6%|%t%{2}%ga%+%Pa%;%?%p2%p6%|%t%{4}%ga%+%Pa%;%?%p1%p5%|%t%{8}%ga%+%Pa%;%?%p7%t%?%ga%ts%ga%{64}%+%e%{83}%;%e%?%ga%t%ga%{64}%+%e%{64}%;%;%c, -- sgr0=\E&d@, smacs@, use=hp+labels, use=scrhp, -+mrxvt-256color|multitabbed rxvt with 256 colors, -+ use=xterm+256color, use=mrxvt, - --hp2621-a|hp2621a-a|hp2621 with fn as arrows, -- use=hp+pfk+arrows, use=hp2621-fl, -+#### ETERM -+# From: Michael Jennings <mej@valinux.com> -+# -+# Eterm 0.9.3 -+# -+# removed kf0 which conflicts with kf10 -TD -+# remove cvvis which conflicts with cnorm -TD -+# Eterm does not implement control/shift cursor keys such as kDN6, or kPRV/kNXT -+# but does otherwise follow the rxvt+pcfkeys model -TD -+# remove nonworking flash -TD -+# remove km as per tack test -TD -+Eterm|Eterm-color|Eterm with xterm-style color support (X Window System), -+ am, bce, bw, eo, mc5i, mir, msgr, xenl, xon, XT, -+ btns#5, cols#80, it#8, lines#24, lm#0, ncv@, -+ acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -+ bel=^G, blink=\E[5m, bold=\E[1m, civis=\E[?25l, -+ clear=\E[H\E[2J, cnorm=\E[?25h, cr=^M, -+ csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, -+ cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, cuf1=\E[C, -+ cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, -+ dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, -+ ech=\E[%p1%dX, ed=\E[J, el=\E[K, el1=\E[1K, enacs=\E)0, -+ home=\E[H, hpa=\E[%i%p1%dG, ht=^I, hts=\EH, ich=\E[%p1%d@, -+ ich1=\E[@, il=\E[%p1%dL, il1=\E[L, ind=^J, -+ is1=\E[?47l\E>\E[?1l, -+ is2=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;3;4;6l\E[4l, kNXT@, -+ kPRV@, ka1=\E[7~, ka3=\E[5~, kb2=\EOu, kbeg=\EOu, kbs=^H, -+ kc1=\E[8~, kc3=\E[6~, kent=\EOM, khlp=\E[28~, kmous=\E[M, -+ mc4=\E[4i, mc5=\E[5i, rc=\E8, rev=\E[7m, ri=\EM, rmacs=^O, -+ rmam=\E[?7l, rmcup=\E[2J\E[?47l\E8, rmir=\E[4l, rmkx=, -+ rmso=\E[27m, rmul=\E[24m, -+ rs1=\E>\E[1;3;4;5;6l\E[?7h\E[m\E[r\E[2J\E[H, -+ rs2=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;3;4;6l\E[4l\E>\E[?1000l\E[?25h, -+ sc=\E7, -+ sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;, -+ sgr0=\E[m\017, smacs=^N, smam=\E[?7h, smcup=\E7\E[?47h, -+ smir=\E[4h, smkx=, smso=\E[7m, smul=\E[4m, tbc=\E[3g, -+ vpa=\E[%i%p1%dd, use=vt100+enq, use=rxvt+pcfkeys, -+ use=ecma+color, - --# newer hewlett packard terminals -+Eterm-256color|Eterm with xterm 256-colors, -+ use=xterm+256color, use=Eterm, - --newhpkeyboard|generic entry for HP extended keyboard, -- kbs=^H, kcbt=\Ei, kclr=\EJ, kcub1=\ED, kcud1=\EB, kcuf1=\EC, -- kcuu1=\EA, kdch1=\EP, kdl1=\EM, ked=\EJ, kel=\EK, khome=\Eh, -- kich1=\EQ, kil1=\EL, kind=\ET, kll=\EF, knp=\EU, kpp=\EV, -- kri=\ES, krmir=\ER, rmkx=\E&s0A, smkx=\E&s1A, -- use=hp+pfk-cr, -+Eterm-88color|Eterm with 88 colors, -+ use=xterm+88color, use=Eterm, - --newhp|generic entry for new hewlett packard terminals, -- am, bw, mir, xhp, xon, -- cols#80, lines#24, pb#4800, -- acsc=2[3@4>5I9(\:'JSKWLQMAO#P$Q;R!S"T1U2V4W3X\:Y+Z*dHjGkTlRmFn/q\,t5u6v8w7x., -- bel=^G, blink=\E&dA, bold=\E&dF, cbt=\Ei, cr=^M, cub1=^H, -- cud1=^J, cuf1=\EC, cuu1=\EA, dch1=\EP$<2>, dim=\E&dH, -- dl1=\EM, ed=\EJ, el=\EK, ht=\011$<2>, hts=\E1, il1=\EL, ind=^J, -- invis=\E&dS, ip=$<2>, is1=\E&jB$<8>, nel=^M^J, -- pfkey=\E&f0a%p1%dk0d%p2%l%dL%p2%s, -- pfloc=\E&f1a%p1%dk0d%p2%l%dL%p2%s, -- pfx=\E&f2a%p1%dk0d%p2%l%dL%p2%s, rev=\E&dB, ri=\ET, -- rmacs=^O, rmir=\ER, rmso=\E&d@, rmul=\E&d@, rs1=\Eg, -- sgr=\E&d%{0}%Pa%?%p4%t%{1}%ga%+%Pa%;%?%p1%p3%|%p6%|%t%{2}%ga%+%Pa%;%?%p2%p6%|%t%{4}%ga%+%Pa%;%?%p1%p5%|%t%{8}%ga%+%Pa%;%?%p7%t%?%ga%ts%ga%{64}%+%e%{83}%;%e%?%ga%t%ga%{64}%+%e%{64}%;%;%c%?%p9%t\016%e\017%;, -- sgr0=\E&d@\017, smacs=^N, smir=\EQ, smso=\E&dJ, smul=\E&dD, -- tbc=\E3, use=newhpkeyboard, -+#### ATERM -+# Based on rxvt 2.4.8, it has a few differences in key bindings -+aterm|AfterStep terminal, -+ XT, -+ kbs=\177, kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, use=rxvt, - --memhp|memory relative addressing for new HP ttys, -- vt#6, -- clear=\EH\EJ$<40>, cub=\E&a-%p1%dC, cud=\E&a+%p1%dR, -- cuf=\E&a+%p1%dC, cup=\E&a%p1%dr%p2%dC, cuu=\E&a-%p1%dR, -- home=\EH, hpa=\E&a%p1%dC, ll=\E&a23R\r, -- mrcup=\E&a%p1%dr%p2%dC, vpa=\E&a%p1%dR, use=newhp, -+#### XITERM -+# xiterm 0.5-5.2 -+# This is not based on xterm's source... -+# vttest shows several problems with keyboard, cursor-movements. -+# see also http://invisible-island.net/xterm/xterm.faq.html#bug_xiterm -+xiterm|internationalized terminal emulator for X, -+ km@, -+ kbs=\177, kdch1=\E[3~, use=klone+color, use=xterm-r6, - --scrhp|screen relative addressing for new HP ttys, -- clear=\E&a0c0Y\EJ$<40>, cub=\E&a-%p1%dC, -- cud=\E&a+%p1%dR, cuf=\E&a+%p1%dC, -- cup=\E&a%p1%dy%p2%dC$<10>, cuu=\E&a-%p1%dR, -- home=\E&a0y0C, hpa=\E&a%p1%dC, ll=\E&a0y0C\EA, -- mrcup=\E&a%p1%dr%p2%dC, vpa=\E&a%p1%dY, use=newhp, - --# (hp+labels: added label values from a BRL termcap -- esr) --hp+labels|"standard" label info for new HP ttys, -- lh#2, lw#8, nlab#8, -- lf0=f1, lf1=f2, lf2=f3, lf3=f4, lf4=f5, lf5=f6, lf6=f7, lf7=f8, -- pln=\E&f2a%p1%dk%p2%l%Pa%?%ga%t%ga%d%e1%;d0L%?%ga%!%t %;%p2%s, -- rmln=\E&j@, smln=\E&jB, -+#### HPTERM -+# HP ships this (HPUX 9 and 10), except for the pb#9600 which was merged in -+# from BSD termcap. (hpterm: added empty <acsc>, we have no idea what ACS -+# chars look like --esr) -+hpterm|X-hpterm|hp X11 terminal emulator, -+ am, da, db, mir, xhp, -+ cols#80, lh#2, lines#24, lm#0, lw#8, nlab#8, pb#9600, xmc#0, -+ acsc=, bel=^G, bold=\E&dB, cbt=\Ei, clear=\E&a0y0C\EJ, cr=^M, -+ cub1=^H, cud1=\EB, cuf1=\EC, cup=\E&a%p1%dy%p2%dC, -+ cuu1=\EA, dch1=\EP, dim=\E&dH, dl1=\EM, ed=\EJ$<1>, el=\EK, -+ hpa=\E&a%p1%dC, ht=^I, hts=\E1, il1=\EL, ind=^J, kbs=^H, -+ kclr=\EJ, kctab=\E2, kcub1=\ED, kcud1=\EB, kcuf1=\EC, -+ kcuu1=\EA, kdch1=\EP, kdl1=\EM, ked=\EJ, kel=\EK, kf1=\Ep, -+ kf2=\Eq, kf3=\Er, kf4=\Es, kf5=\Et, kf6=\Eu, kf7=\Ev, kf8=\Ew, -+ khome=\Eh, khts=\E1, kich1=\EQ, kil1=\EL, kind=\ES, kll=\EF, -+ knp=\EU, kpp=\EV, kri=\ET, krmir=\ER, ktbc=\E3, meml=\El, -+ memu=\Em, pfkey=\E&f%p1%dk%p2%l%dL%p2%s, -+ pfloc=\E&f1a%p1%dk%p2%l%dL%p2%s, -+ pfx=\E&f2a%p1%dk%p2%l%dL%p2%s, -+ pln=\E&f%p1%dk%p2%l%dd0L%p2%s, rev=\E&dB, ri=\ET, -+ rmacs=^O, rmir=\ER, rmkx=\E&s0A, rmln=\E&j@, rmso=\E&d@, -+ rmul=\E&d@, -+ sgr=\E&d%?%p7%t%{115}%c%;%p1%p3%|%p6%|%{2}%*%p2%{4}%*%+%p4%+%p5%{8}%*%+%{64}%+%c%?%p9%t%'\016'%c%e%'\017'%c%;, -+ sgr0=\E&d@, smacs=^N, smir=\EQ, smkx=\E&s1A, smln=\E&jB, -+ smso=\E&dJ, smul=\E&dD, tbc=\E3, vpa=\E&a%p1%dY, -+# HPUX 11 provides a color version. -+hpterm-color|HP X11 terminal emulator with color, -+ ccc, -+ colors#64, pairs#8, -+ home=\E&a0y0C, -+ initp=\E&v%p2%da%p3%db%p4%dc%p5%dx%p6%dy%p7%dz%p1%dI, -+ op=\E&v0S, scp=\E&v%p1%dS, use=hpterm, - --hp+printer|"standard" printer info for HP ttys, -- ff=\E&p4u0C, mc0=\EH\E&p4dF, mc4=\E&p13C, mc5=\E&p11C, -- -- --# The new hp2621b is kind of a cross between the old 2621 and the --# new 262x series of machines. It has dip-switched options. --# The firmware has a bug in it such that if you give it a null --# length label, the following character is eaten! --hp2621b|hp 2621b with old style keyboard, -- lh#1, lm#48, lw#8, nlab#8, -- kcub1=\ED, kcud1=\EB, kcuf1=\EC, kcuu1=\EA, khome=\Eh, -- kind=\ET, kll=\EF, kri=\ES, -- pln=\E&f0a%p1%dk%p2%l%Pa%?%ga%t%ga%d%e1%;d3L%?%ga%!%t%{32}%c%;%p2%s\E%{111}%p1%+%c\r, -- smln=\E&jB, use=hp2621, -- --hp2621b-p|hp 2621b with printer, -- use=hp+printer, use=hp2621b, -+#### EMU -+# This is for the extensible terminal emulator on the X11R6 contrib tape. -+# It corresponds to emu's internal emulation: -+# emu -term emu -+# emu's default sets TERM to "xterm", but that doesn't work well -TD -+# fixes: remove bogus rmacs/smacs, change oc to op, add bce, am -TD -+# fixes: add civis, cnorm, sgr -TD -+emu|emu native mode, -+ am, bce, mir, msgr, xon, -+ colors#15, cols#80, it#8, lines#24, pairs#64, vt#200, -+ acsc=61a\202f\260g2j\213k\214l\215m\216n\217o\220q\222s\224t\225u\226v\227w\230x\231~\244, -+ bel=^G, blink=\EW, bold=\EU, civis=\EZ, clear=\EP\EE0;0;, -+ cnorm=\Ea, cr=^M, csr=\Ek%p1%d;%p2%d;, cub=\Eq-%p1%d;, -+ cub1=^H, cud=\Ep%p1%d;, cud1=\EB, cuf=\Eq%p1%d;, cuf1=\EC, -+ cup=\EE%p1%d;%p2%d;, cuu=\Ep-%p1%d;, cuu1=\EA, -+ dch=\EI%p1%d;, dch1=\EI1;, dl=\ER%p1%d;, dl1=\ER1;, -+ ech=\Ej%p1%d;, ed=\EN, el=\EK, el1=\EL, home=\EE0;0;, ht=^I, -+ hts=\Eh, il=\EQ%p1%d;, il1=\EQ1;, ind=\EG, -+ is2=\ES\Er0;\Es0;, kbs=^H, kcub1=\EC, kcud1=\EB, kcuf1=\ED, -+ kcuu1=\EA, kdch1=\177, kent=^M, kf0=\EF00, kf1=\EF01, -+ kf10=\EF10, kf11=\EF11, kf12=\EF12, kf13=\EF13, kf14=\EF14, -+ kf15=\EF15, kf16=\EF16, kf17=\EF17, kf18=\EF18, kf19=\EF19, -+ kf2=\EF02, kf20=\EF20, kf3=\EF03, kf4=\EF04, kf5=\EF05, -+ kf6=\EF06, kf7=\EF07, kf8=\EF08, kf9=\EF09, kfnd=\Efind, -+ kich1=\Eins, knp=\Enext, kpp=\Eprior, kslt=\Esel, -+ op=\Es0;\Er0;, rev=\ET, ri=\EF, rmir=\EX, rmso=\ES, rmul=\ES, -+ rs2=\ES\Es0;\Er0;, setab=\Es%i%p1%d;, -+ setaf=\Er%i%p1%d;, -+ sgr=\ES%?%p1%t\ET%;%?%p2%t\EV%;%?%p3%t\ET%;%?%p4%t\EW%;%?%p6%t\EU%;, -+ sgr0=\ES, smir=\EY, smso=\ET, smul=\EV, tbc=\Ej, - --# hp2621b - new 2621b with new extended keyboard --# these are closer to the new 26xx series than the other 2621b --hp2621b-kx|hp 2621b with extended keyboard, -- use=newhpkeyboard, use=hp2621b, -+# vt220 Terminfo entry for the Emu emulation, corresponds to -+# emu -term vt220 -+# with NumLock set (to make the keypad transmit kf0-kf9). -+# fixes: add am, xenl, corrected sgr0 -TD -+emu-220|Emu-220 (vt200-7bit mode), -+ am, xenl, xon, -+ cols#80, it#8, lines#24, vt#200, -+ acsc=aaffggjjkkllmmnnooqqssttuuvvwwxx~~, bel=^G, -+ blink=\E[0;5m, bold=\E[0;1m, civis=\E[?25l, -+ clear=\E[2J\E[H, cnorm=\E[?25h, cr=^M, -+ csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=\E[1D, -+ cud=\E[%p1%dB, cud1=\E[1B, cuf=\E[%p1%dC, cuf1=\E[1C, -+ cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[1A, -+ dch=\E[%p1%dP, dch1=\E[1P, dl=\E[%p1%dM, dl1=\E[1M, -+ ed=\E[0J, el=\E[0K, el1=\E[1K, enacs=\E)0, home=\E[H, ht=^I, -+ hts=\EH, if=/usr/share/tabset/vt300, il=\E[%p1%dL, -+ il1=\E[1L, ind=\ED, is2=\E>\E[?1l\E[?3l\E[4l\E[?7h, -+ kbs=^H, kcmd=\E[29~, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, -+ kcuu1=\E[A, kdch1=\E[3~, kent=\EOM, kf0=\EOp, kf1=\EOq, -+ kf10=\EOl, kf11=\EOm, kf12=\EOn, kf13=\EOP, kf14=\EOQ, -+ kf15=\EOR, kf16=\EOS, kf2=\EOr, kf26=\E[17~, kf27=\E[18~, -+ kf28=\E[19~, kf29=\E[20~, kf3=\EOs, kf30=\E[21~, -+ kf34=\E[26~, kf37=\E[31~, kf38=\E[32~, kf39=\E[33~, -+ kf4=\EOt, kf40=\E[34~, kf5=\EOu, kf6=\EOv, kf7=\EOw, -+ kf8=\EOx, kf9=\EOy, kfnd=\E[1~, khlp=\E[28~, kich1=\E[2~, -+ knp=\E[6~, kpp=\E[5~, kslt=\E[4~, rc=\E8, rev=\E[0;7m, -+ ri=\EM, rmacs=^O, rmcup=\E>, rmkx=\E>, rmso=\E[m, rmul=\E[m, -+ rs2=\E[4l\E[34l\E[?1l\E[?3l\E[?5l\E[?7h, sc=\E7, -+ sgr=\E[0%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p5%t;2%;%?%p6%t;1%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, -+ sgr0=\E[m, smacs=^N, smcup=\E[?1l\E=, smkx=\E=, -+ smso=\E[0;7m, smul=\E[0;4m, tbc=\E[3g, - --hp2621b-kx-p|hp 2621b with new keyboard & printer, -- use=hp+printer, use=hp2621b-kx, -+#### MVTERM -+# A commercial product, Reportedly a version of Xterm with an OPEN LOOK UI, -+# print interface, ANSI X3.64 colour escape sequences, etc. Newsgroup postings -+# indicate that it emulates more than one terminal, but incompletely. -+# -+# This is adapted from a FreeBSD bug-report by Daniel Rudy <dcrudy@pacbell.net> -+# It is based on vt102's entry, with some subtle differences, but also -+# has status line -+# supports ANSI colors (except for 'op' string) -+# apparently implements alternate screen like xterm -+# does not use padding, of course. -+mvterm|vv100|SwitchTerm aka mvTERM, -+ am, eslok, hs, km, mir, msgr, xenl, -+ colors#8, cols#80, it#8, lines#24, pairs#64, -+ acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -+ bel=^G, blink=\E[5m, bold=\E[1m, clear=\E[H\E[2J, cr=^M, -+ csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, -+ cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, -+ cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, -+ dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, -+ dsl=\E[?E, ed=\E[J, el=\E[K, el1=\E[1K$<3>, enacs=\E(B\E)0, -+ fsl=\E[?F, home=\E[H, ht=^I, hts=\EH, ich=\E[%p1%d@, -+ ich1=\E[@, il=\E[%p1%dL, il1=\E[L, ind=^J, kbs=^H, -+ kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kf0=\EOy, -+ kf10=\EOx, kf5=\EOt, kf6=\EOu, kf7=\EOv, kf8=\EOl, kf9=\EOw, -+ op=\E[100m, rc=\E8, rev=\E[7m, ri=\EM, rmacs=^O, -+ rmcup=\E[2J\E[?47l\E8, rmkx=\E[?1l\E>, rmso=\E[m, -+ rmul=\E[m, -+ rs2=\E>\E[1;3;4;5;6l\E[?7h\E[100m\E[m\E[r\E[2J\E[H, -+ sc=\E7, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, -+ sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;, -+ sgr0=\E[m\017, smacs=^N, smcup=\E7\E[?47h, -+ smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, tbc=\E[3g, -+ tsl=\E[?E\E[?%i%p1%dT, use=vt100+fnkeys, - --# Some assumptions are made in the following entries. --# These settings are NOT set up by the initialization strings. -+#### MTERM - # --# Port Configuration --# RecvPace=Xon/Xoff XmitPace=Xon/Xoff StripNulDel=Yes -+# This application is available by email from <mouse@Rodents.Montreal.QC.CA>. - # --# Terminal Configuration --# InhHndShk(G)=Yes InhDC2(H)=Yes --# XmitFnctn(A)=No InhEolWrp=No -+# "mterm -type ansi" sets $TERM to "ansi" -+mterm-ansi|ANSI emulation, -+ am, bw, mir, msgr, -+ it#8, -+ acsc=``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -+ bel=^G, blink=\E[5m, bold=\E[1m, clear=\E[H\E[J, cr=^M, -+ cub=\E[%p1%dD, cub1=\E[D, cud=\E[%p1%dB, cud1=\E[B, -+ cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, -+ cuu=\E[%p1%dA, cuu1=\E[A, dch=\E[%p1%dP, dch1=\E[P, -+ dim=\E[2m, dl=\E[%p1%dM, dl1=\E[M, ech=\E[%p1%dX, ed=\E[J, -+ el=\E[K, home=\E[H, hpa=\E[%i%p1%d`, ht=^I, ich1=, -+ il=\E[%p1%dL, il1=\E[L, ind=\E[S, indn=\E[%p1%dS, -+ invis=\E[8m, is2=\E)0\017, kbs=^H, nel=\EE, rev=\E[7m, -+ ri=\E[T, rin=\E[%p1%dT, rmacs=^O, rmir=\E[4l, rmso=\E[27m, -+ rmul=\E[24m, -+ sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p5%t;2%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, -+ sgr0=\E[m, smacs=^N, smir=\E[4h, smso=\E[7m, smul=\E[4m, -+ vpa=\E[%i%p1%dd, -+# mterm normally sets $TERM to "mterm" -+mterm|mouse-sun|Der Mouse term, -+ am, bw, mir, -+ it#8, -+ bel=^G, clear=^L, cr=^M, cub1=^H, cud1=^N, cuf1=^S, -+ cup=\006%p1%d.%p2%d., cuu1=^X, dch1=^Y, dl1=^K, ed=^B, el=^C, -+ home=^P, ht=^I, il1=^A, ind=^U, kbs=^H, ll=^R, nel=^M^U, ri=^W, -+ rmir=^O, rmso=^T, smir=^Q, smso=^V, -+# "mterm -type decansi" sets $TERM to "decansi" - # -+# note: kdch1, kfnd, kslt are in the source code, but do not work -TD -+decansi|ANSI emulation with DEC compatibility hacks, -+ am, mir, msgr, xenl, -+ colors#8, it#8, pairs#64, -+ acsc=``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -+ bel=^G, blink=\E[5m, bold=\E[1m, civis=\E[?25l, -+ clear=\E[H\E[J, cnorm=\E[?25h, cr=^M, -+ csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=\E[D, -+ cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, cuf1=\E[C, -+ cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, -+ dch=\E[%p1%dP, dch1=\E[P, dim=\E[2m, dl=\E[%p1%dM, -+ dl1=\E[M, ech=\E[%p1%dX, ed=\E[J, el=\E[K, enacs=\E(B\E)0, -+ home=\E[H, hpa=\E[%i%p1%d`, ht=^I, ich1=, il=\E[%p1%dL, -+ il1=\E[L, ind=\E[S, indn=\E[%p1%dS, invis=\E[8m, -+ is2=\E)0\E[r\017, kbs=^H, kcub1=\EOD, kcud1=\EOB, -+ kcuf1=\EOC, kcuu1=\EOA, kdch1=\E[3~, kf1=\E[11~, -+ kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, -+ kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, kf17=\E[31~, -+ kf18=\E[32~, kf19=\E[33~, kf2=\E[12~, kf20=\E[34~, -+ kf3=\E[13~, kf4=\E[14~, kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, -+ kf8=\E[19~, kf9=\E[20~, kfnd=\E[1~, kich1=\E[2~, knp=\E[6~, -+ kpp=\E[5~, kslt=\E[4~, nel=\EE, op=\E[0m, rc=\E8, rev=\E[7m, -+ ri=\E[T, rin=\E[%p1%dT, rmacs=^O, rmam=\E[?7l, rmir=\E[4l, -+ rmkx=\E[?1l\E>, rmso=\E[27m, rmul=\E[24m, sc=\E7, -+ setab=\E[4%p1%dm, setaf=\E[3%p1%dm, -+ sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p5%t;2%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, -+ sgr0=\E[m, smacs=^N, smam=\E[?7h, smir=\E[4h, -+ smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, u6=\E[%i%d;%dR, -+ u7=\E[6n, vpa=\E[%i%p1%dd, -+ -+#### VWM - # --# Hp 2622a & hp2623a display and graphics terminals -+# vwmterm is a terminal emulator written for the VWM console window manager - # --hp2622|hp2622a|hp 2622, -- da, db, -- lm#0, pb#19200, -- is2=\E&dj@\r, use=hp+pfk+cr, use=hp+labels, use=scrhp, -+vwmterm|(vwm term), -+ am, bce, ccc, mir, msgr, npc, xenl, xon, -+ colors#8, pairs#64, -+ acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -+ bel=^G, blink=\E[5m, bold=\E[1m, civis=\E[?25l, -+ clear=\E[H\E[J, cnorm=\E[?25h, cr=^M, cub=\E[%p1%dD, -+ cub1=^H, cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, -+ cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, -+ cuu1=\E[A, cvvis=\E[?25h, dim=\E[2m, ed=\E[J, el=\E[K, -+ home=\E[H, il1=\E[L, ind=^J, invis=\E[8m, kcub1=\E[D, -+ kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[3~, -+ kend=\E[4~, kf1=\E[[A, kf10=\E[21~, kf11=\E[22~, -+ kf12=\E[23~, kf2=\E[[B, kf3=\E[[C, kf4=\E[[D, kf5=\E[[E, -+ kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, -+ khome=\E[1~, knp=\E[6~, kpp=\E[5~, rev=\E[7m, rmacs=\E[10m, -+ rmam=\E[?7l, rmcup=\E[?1049l, rs1=\E[H\E[J\E[m\Ec, -+ setab=\E[4%p1%dm, setaf=\E[3%p1%dm, -+ sgr=\E[0;10%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;%?%p7%t;8%;%?%p9%t;11%;m, -+ sgr0=\E[0;10m, smacs=\E[11m, smam=\E[?7h, -+ smcup=\E[?1049h, smso=\E[3m, smul=\E[4m, - --# The 2623 is a 2622 with extra graphics hardware. --hp2623|hp2623a|hp 2623, -- use=hp2622, -+#### MGR -+# -+# MGR is a Bell Labs window system lighter-weight than X. -+# These entries describe MGR's xterm-equivalent. -+# They are courtesy of Vincent Broman <broman@nosc.mil> 14 Jan 1997 -+# - --hp2624b-p|hp2624b-4p-p|hewlett packard 2624 B with printer, -- use=hp+printer, use=hp2624, -+mgr|Bellcore MGR (non X) window system terminal emulation, -+ am, km, -+ bel=^G, bold=\E2n, civis=\E9h, clear=^L, cnorm=\Eh, cr=^M, -+ csr=\E%p1%d;%p2%dt, cub1=^H, cud1=\Ef, cuf1=\Er, -+ cup=\E%p2%d;%p1%dM, cuu1=\Eu, cvvis=\E0h, -+ dch=\E%p1%dE$<5>, dch1=\EE, dl=\E%p1%dd$<3*>, -+ dl1=\Ed$<3>, ed=\EC, el=\Ec, hd=\E1;2f, ht=^I, hu=\E1;2u, -+ ich=\E%p1%dA$<5>, ich1=\EA, il=\E%p1%da$<3*>, -+ il1=\Ea$<3>, ind=^J, kbs=^H, kcub1=\E[D, kcud1=\E[B, -+ kcuf1=\E[C, kcuu1=\E[A, nel=^M^J, rev=\E1n, rmam=\E5S, -+ rmso=\E0n, rmul=\E0n, sgr0=\E0n, smam=\E5s, smso=\E1n, -+ smul=\E4n, -+mgr-sun|Mgr window with Sun keyboard, -+ ka1=\E[214z, ka3=\E[216z, kb2=\E[218z, kc1=\E[220z, -+ kc3=\E[222z, kcpy=\E[197z, kend=\E[220z, kent=\E[250z, -+ kf1=\E[224z, kf10=\E[233z, kf11=\E[234z, kf12=\E[235z, -+ kf2=\E[225z, kf3=\E[226z, kf4=\E[227z, kf5=\E[228z, -+ kf6=\E[229z, kf7=\E[230z, kf8=\E[231z, kf9=\E[232z, -+ kfnd=\E[200z, khlp=\E[207z, khome=\E[214z, knp=\E[222z, -+ kopn=\E[198z, kpp=\E[216z, kund=\E[195z, use=mgr, -+mgr-linux|Mgr window with Linux keyboard, -+ ka1=\E[H, ka3=\E[5~, kb2=\E[G, kc1=\E[Y, kc3=\E[6~, -+ kdch1=\E[3~, kend=\E[4~, kf0=\E[[J, kf1=\E[[A, kf10=\E[21~, -+ kf11=\E[23~, kf12=\E[24~, kf2=\E[[B, kf3=\E[[C, kf4=\E[[D, -+ kf5=\E[[E, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, -+ khome=\E[1~, knp=\E[6~, kpp=\E[5~, use=mgr, - --# The hewlett packard B can have an optional extra 6 pages of memory. --hp2624-10p|hp2624a-10p|hp2624b-10p|hewlett packard 2624 B w/ 10 pages of memory, -- lm#240, use=hp2624, -+#### SIMPLETERM -+# st.suckless.org -+# st-0.1.1 -+# -+# Note: the original terminfo description uses leading blank to persuade -+# ncurses to use "st" as its name. Proper fix for that is to use "st" as an -+# alias. -+# -+# Reading the code shows it should work for aixterm 16-colors -+# - added st-16color -+# -+# Using tack: -+# - set eo (erase-overstrike) -+# - set xenl -+# - tbc doesn't work -+# - hts works -+# - cbt doesn't work -+# - shifted cursor-keys send sequences like rxvt -+# - sgr referred to unimplemented "invis" mode. -+# Fixes: add eo and xenl per tack, remove nonworking cbt, hts and tbc, invis -+simpleterm|st| simpleterm, -+ am, eo, mir, msgr, ul, xenl, -+ colors#8, cols#80, it#8, lines#24, ncv#3, pairs#64, -+ acsc=``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -+ bel=^G, bold=\E[1m, civis=\E[?25l, clear=\E[H\E[2J, -+ cnorm=\E[?12l\E[?25h, cr=^M, csr=\E[%i%p1%d;%p2%dr, -+ cub1=^H, cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, -+ cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, -+ dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[K, -+ home=\E[H, hpa=\E[%i%p1%dG, ht=^I, ich=\E[%p1%d@, -+ il=\E[%p1%dL, il1=\E[L, ind=^J, indn=\E[%p1%dS, kbs=\177, -+ kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, -+ kdch1=\E[3~, kend=\E[4~, kf1=\EOP, kf10=\E[21~, -+ kf11=\E[23~, kf12=\E[24~, kf2=\EOQ, kf3=\EOR, kf4=\EOS, -+ kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, -+ khome=\E[1~, knp=\E[6~, kpp=\E[5~, op=\E[37;40m, rc=\E8, -+ rev=\E[7m, rmacs=\E(B, rmso=\E[m, rmul=\E[m, sc=\E7, -+ setab=\E[4%p1%dm, setaf=\E[3%p1%dm, -+ sgr=%?%p9%t\E(0%e\E(B%;\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;m, -+ sgr0=\E[0m, smacs=\E(0, smso=\E[7m, smul=\E[4m, -+st-16color|simpleterm with 16-colors, -+ use=ibm+16color, use=simpleterm, -+# 256 colors "works", but when running xterm's test-scripts, some garbage is -+# shown in the titlebar. -+st-256color|simpleterm with 256 colors, -+ ccc@, -+ initc@, use=xterm+256color, use=simpleterm, - --hp2624b-10p-p|hewlett packard 2624 B w/ extra memory & printer, -- lm#240, use=hp2624b-p, -+#### TERMINATOR -+# http://software.jessies.org/terminator/ -+# Tested using their Debian package org.jessies.terminator 6.104.3256 on 64-bit -+# Debian/current -TD (2011/8/20) -+# -+# There are some packaging problems: -+# a) using Java, the program starts off using 50Mb, and climbs from there, -+# up to 114Mb after testing (no scrollback). -+# b) it insists on reinstalling its terminal description in $HOME/.terminfo -+# (two copies, just in case the host happens to be Mac OS X). -+# I deleted this after testing with tack. -+# -+# Issues/features found with tack: -+# a) tbc does not work (implying that hts also is broken). -+# Comparing with the tabs utility shows a problem with the last tabstop on -+# a line. -+# b) has xterm-style shifted function-key strings -+# meta also is used, but control is ignored. -+# c) has xterm-style modifiers for cursor keys (shift, control, shift+control, meta) -+# d) some combinations of shift/control send xterm-style sequences for -+# insert/delete/home/end. -+# e) numeric keypad sends only numbers (compare with vttest). -+# f) meta mode (km) is not implemented. -+# -+# Issues found with ncurses test-program: -+# a) bce is inconsistently implemented -+# b) widths of Unicode values above 256 do not always agree with wcwidth. -+# -+# Checked with vttest, found low degree of compatibility there. -+# -+# Checked with xterm's scripts, found that the 256-color palette is fixed. -+# -+# Fixes: -+# a) add sgr string -+# b) corrected sgr0 to reset alternate character set -+# c) modified smacs/rmacs to use SCS rather than SI/SO -+# d) removed bce -+# e) removed km -+terminator|Terminator no line wrap, -+ eo, mir, msgr, xenl, xon, -+ colors#256, cols#80, it#8, lines#24, lm#0, pairs#32767, -+ acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -+ bold=\E[1m, civis=\E[?25l, clear=\E[H\E[2J, -+ cnorm=\E[?25h, cr=^M, csr=\E[%i%p1%d;%p2%dr, -+ cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=^J, -+ cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, -+ cuu=\E[%p1%dA, cuu1=\E[A, dch=\E[%p1%dP, dch1=\E[P, -+ dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[K, el1=\E[1K, -+ enacs=\E(B\E)0, flash=^G, home=\E[H, hpa=\E[%i%p1%dG, -+ ht=^I, hts=\EH, il=\E[%p1%dL, il1=\E[L, ind=^J, -+ is1=\E[?47l\E=\E[?1l, -+ is2=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;3;4;6l\E[4l, kbs=^H, -+ kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, -+ kdch1=\E[3~, kend=\E[4~, kf1=\EOP, kf10=\E[21~, -+ kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, -+ kf15=\E[28~, kf16=\E[29~, kf2=\EOQ, kf3=\EOR, kf4=\EOS, -+ kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, -+ khome=\E[1~, kich1=\E[2~, knp=\E[6~, kpp=\E[5~, -+ op=\E[39;49m, rc=\E8, rev=\E[7m, ri=\EM, rmacs=\E(B, -+ rmcup=\E[?47l\E8, rmir=\E[4l, rmso=\E[27m, rmul=\E[24m, -+ rs1=\E>\E[1;3;4;5;6l\E[?7h\E[m\E[r\E[2J\E[H, -+ rs2=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;3;4;6l\E[4l\E>, -+ s0ds=\E(B, s1ds=\E(0, sc=\E7, setab=\E[48;5;%p1%dm, -+ setaf=\E[38;5;%p1%dm, -+ sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;m%?%p9%t\E(0%e\E(B%;, -+ sgr0=\E[m\E(B, smacs=\E(0, smcup=\E7\E[?47h, smir=\E[4h, -+ smso=\E[7m, smul=\E[4m, tbc=\E[3g, vpa=\E[%i%p1%dd, -+ use=xterm+sl-twm, -+ -+#### TERMINOLOGY -+# http://enlightenment.org -+# -+# Tested terminology-0.3.0, using tack and vttest. This is not a vt100 -+# emulator, nor is it compatible with xterm, but it uses a few features from -+# both -TD -+# -+# General comments: -+# cursor does not fill on focus -+# there are pervasive problems with clearing/erasing parts of the screen -+# resizing the window causes it to stop listening to the keyboard -+# tack - -+# doesn't understand vt100 CPR needed for resize -+# no CBT -+# no cvvis -+# has invis -+# no blink -+# uses bce model for colors, but (see below) fails the vttest screens -+# has partial support for 256color feature. -+# tack cursor-keys: -+# ctrl+shift (ignored) -+# 2 shift -+# shift-alt modifier -> shift (2) -+# 3 alt -+# 4 -+# 5 ctrl -+# tack modifiers do not work for fkeys -+# ctrl + khome/kend works - none of the other modifiers do -+# vttest - -+# spits lots of messages from termptyesc.c especially in vttest. -+# no 132-column mode -+# fails menu 1, 2 (definitely not vt100-compatible) -+# primary and -+# secondary report says (perhaps... vt420): \E[>41;285;0c -+# CHA, HPR, VPA, CNL, CPL work -+# BCE with ED/EL - fail -+# BCE with ECH/indexing - fail -+# SD/SU work -+# unlike teken, background light/dark works -+# can set title -+# X10 and Normal mouse work -+# Any-event mouse works -+# Mouse button-event works -+terminology|EFL-based terminal emulator, -+ ccc@, mc5i@, xon@, -+ blink@, ed@, el@, el1@, initc@, invis=\E[8m, kLFT=\E[1;2D, -+ kRIT=\E[1;2C, kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, -+ kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, -+ kind=\E[1;2B, kri=\E[1;2A, -+ sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p7%t;8%;m%?%p9%t\016%e\017%;$<2>, -+ vpa=\E[%i%p1%dd, kDC3=\E[3;3~, kDC4=\E[3;4~, -+ kDC5=\E[3;5~, kDC6=\E[3;6~, kDC7=\E[3;7~, kDN=\E[1;2B, -+ kDN3=\E[1;3B, kDN4=\E[1;4B, kDN5=\E[1;5B, kDN6=\E[1;6B, -+ kDN7=\E[1;7B, kEND5=\E[1;5F, kHOM5=\E[1;5H, -+ kLFT3=\E[1;3D, kLFT4=\E[1;4D, kLFT5=\E[1;5D, -+ kLFT6=\E[1;6D, kLFT7=\E[1;7D, kRIT3=\E[1;3C, -+ kRIT4=\E[1;4C, kRIT5=\E[1;5C, kRIT6=\E[1;6C, -+ kRIT7=\E[1;7C, kUP=\E[1;2A, use=vt100, -+ use=xterm+256color, - --# Color manipulations for HP terminals --hp+color|hp with colors, -- ccc, -- colors#16, ncv#17, pairs#7, -- initp=\E&v%?%p2%{1000}%=%t1%e.%p2%d%;a%?%p3%{1000}%=%t1%e.%p3%d%;b%?%p4%{1000}%=%t1%e.%p4%d%;c%?%p5%{1000}%=%t1%e.%p5%d%;x%?%p6%{1000}%=%t1%e.%p6%d%;y%?%p7%{1000}%=%t1%e.%p7%d%;z%p1%dI, -- oc=\E&v0m1a1b1c0I\E&v1a1I\E&v1b2I\E&v1a1b3I\E&v1c4I\E&v1a1c5I\E&v1b1c6I\E&v1x1y7I, -- op=\E&v0S, scp=\E&v%p1%dS, -+######## UNIX VIRTUAL TERMINALS, VIRTUAL CONSOLES, AND TELNET CLIENTS -+# - --# <is2> sets the screen to be 80 columns wide --hp2397a|hp2397|hewlett packard 2397A color terminal, -- is2=\E&w6f80X, use=memhp, use=hp+labels, use=hp+color, -+# Columbus UNIX virtual terminal. This terminal also appears in -+# UNIX 4.0 and successors as line discipline 1 (?), but is -+# undocumented and does not really work quite right. -+cbunix|cb unix virtual terminal, -+ OTbs, am, da, db, -+ cols#80, lines#24, lm#0, -+ bel=^G, clear=\EL, cr=^M, cub1=^H, cud1=^J, cuf1=\EC, -+ cup=\EG%p2%c%p1%c, cuu1=\EA, dch1=\EM, dl1=\EN, ed=\EL, -+ el=\EK, ich1=\EO, il1=\EP, ind=^J, kcub1=\ED, kcud1=\EB, -+ kcuf1=\EC, kcuu1=\EA, khome=\EE, rmso=\Eb^D, rmul=\Eb^A, -+ smso=\Ea^D, smul=\Ea^A, -+# (vremote: removed obsolete ":nl@:" -- esr) -+vremote|virtual remote terminal, -+ am@, -+ cols#79, use=cbunix, - --# HP 700/44 Setup parameters: --# Terminal Mode HP-PCterm --# Inhibit Auto Wrap NO --# Status Line Host Writable --# PC Character Set YES --# Twenty-Five Line Mode YES --# XON/XOFF @128 or 64 (sc) --# Keycode Mode NO or YES (sc) --# Backspace Key BS or BS/DEL -+pty|4bsd pseudo teletype, -+ cup=\EG%p1%{32}%+%c%p2%{32}%+%c, rmso=\Eb$, rmul=\Eb!, -+ smso=\Ea$, smul=\Ea!, use=cbunix, -+ -+#### Emacs -+ -+# The codes supported by the term.el terminal emulation in GNU Emacs 19.30 -+eterm|gnu emacs term.el terminal emulation, -+ am, mir, xenl, -+ cols#80, lines#24, -+ bel=^G, bold=\E[1m, clear=\E[H\E[J, cr=^M, -+ csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, -+ cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, -+ cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, -+ dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, -+ el=\E[K, el1=\E[1K, home=\E[H, ht=^I, ich=\E[%p1%d@, -+ il=\E[%p1%dL, il1=\E[L, ind=^J, rev=\E[7m, -+ rmcup=\E[2J\E[?47l\E8, rmir=\E[4l, rmso=\E[m, rmul=\E[m, -+ sgr0=\E[m, smcup=\E7\E[?47h, smir=\E[4h, smso=\E[7m, -+ smul=\E[4m, -+ -+# The codes supported by the term.el terminal emulation in GNU Emacs 22.2 -+eterm-color|Emacs term.el terminal emulator term-protocol-version 0.96, -+ am, mir, msgr, xenl, -+ colors#8, cols#80, lines#24, pairs#64, -+ bel=^G, blink=\E[5m, bold=\E[1m, clear=\E[H\E[J, cr=^M, -+ csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, -+ cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, -+ cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, -+ dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, -+ el=\E[K, el1=\E[1K, home=\E[H, ht=^I, ich=\E[%p1%d@, -+ il=\E[%p1%dL, il1=\E[L, ind=^J, invis=\E[8m, kbs=\177, -+ kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, -+ kdch1=\E[3~, kend=\E[4~, khome=\E[1~, kich1=\E[2~, -+ knp=\E[6~, kpp=\E[5~, op=\E[39;49m, rc=\E8, rev=\E[7m, -+ ri=\EM, rmir=\E[4l, rmso=\E[27m, rmul=\E[24m, rs1=\Ec, -+ sc=\E7, setab=\E[%p1%'('%+%dm, setaf=\E[%p1%{30}%+%dm, -+ sgr=\E[0%?%p1%p3%|%t;7%;%?%p2%t;4%;%?%p4%t;5%;%?%p6%t;1%;%?%p7%t;8%;m, -+ sgr0=\E[m, smir=\E[4h, smso=\E[7m, smul=\E[4m, -+ u6=\E[%i%d;%dR, u7=\E[6n, -+ -+#### Screen -+ -+# Entries for use by the `screen' program by Juergen Weigert, -+# Michael Schroeder, Oliver Laumann. The screen and -+# screen-w entries came with version 3.7.1. The screen2 and screen3 entries -+# come from University of Wisconsin and may be older. -+# (screen: added <cnorm> on ANSI model -- esr) - # --# <is2> sets pcterm; autowrap; 25 lines; pc char set; prog DEL key; --# \E\\? does not turn off keycode mode --# <smsc> sets alternate start/stop; keycode on --hpansi|hp700|hewlett packard 700/44 in HP-PCterm mode, -- am, eo, xenl, xon, -- cols#80, lines#25, -- acsc=j\331k\277l\332m\300n\305q\304t\303u\264v\301w\302x\263, -- bel=^G, cbt=\E[Z, civis=\E[?25l, clear=\E[2J\E[H, -- cnorm=\E[?25h, cr=^M, cub1=\E[D, cud1=\E[B, cuf1=\E[C, -- cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, dch1=\E[P, dl1=\E[M, -- ed=\E[J, el=\E[K, home=\E[H, ht=^I, ich1=\E[@, il1=\E[L, -- ind=^J, -- is2=\E[44"p\E[?7h\E[>10h\E[>12h\EP1;1|3/7F\E\\, -- kbs=^H, kcbt=\E[Z, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, -- kcuu1=\E[A, kend=\E[4~, kf1=\E[17~, kf10=\E[28~, -- kf2=\E[18~, kf3=\E[19~, kf4=\E[20~, kf5=\E[21~, kf6=\E[23~, -- kf7=\E[24~, kf8=\E[25~, kf9=\E[26~, khome=\E[1~, knp=\E[6~, -- kpp=\E[5~, rmam=\E[?7l, -- rmsc=\E[>11l\EP1**x0/11;1/13\E[m\E\\, rmso=\E[m, -- rmul=\E[m, sgr0=\E[m, smam=\E[?7h, -- smsc=\E[>11h\EPO**x0/65;1/67\E\\$<250>, smso=\E[7m, -- smul=\E[4m, xoffc=g, xonc=e, -+# 'screen' defines extensions to termcap. Some are used in its terminal -+# description: -+# G0 (bool) Terminal can deal with ISO 2022 font selection sequences. -+# AX (bool) Does understand ANSI set default fg/bg color -+# (\E[39m / \E[49m). -+# S0 (str) Switch charset 'G0' to the specified charset. -+# E0 (str) Switch charset 'G0' back to standard charset. - # --# (hp2392: copied <rmir> here from hpex -- esr) --hp2392|239x series, -- cols#80, -- cbt=\Ei, cup=\E&a%p1%dy%p2%dC, kf1=\Ep\r, kf2=\Eq\r, -- kf3=\Er\r, kf4=\Es\r, kf5=\Et\r, kf6=\Eu\r, kf7=\Ev\r, -- kf8=\Ew\r, khome=\Eh, kind=\EU, knp=\Eu, kpp=\Ev, kri=\EV, -- rmir=\ER, rmul=\E&d@, smir=\EQ, smul=\E&dD, vpa=\E&a%p1%dY, -- use=hpsub, -+# tested with screen 3.09.08 -+screen|VT 100/ANSI X3.64 virtual terminal, -+ OTbs, OTpt, am, km, mir, msgr, xenl, G0, -+ colors#8, cols#80, it#8, lines#24, ncv@, pairs#64, U8#1, -+ acsc=++\,\,--..00``aaffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -+ bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l, -+ clear=\E[H\E[J, cnorm=\E[34h\E[?25h, cr=^M, -+ csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, -+ cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, -+ cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\EM, -+ cvvis=\E[34l, dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, -+ dl1=\E[M, ed=\E[J, el=\E[K, el1=\E[1K, enacs=\E(B\E)0, -+ flash=\Eg, home=\E[H, ht=^I, hts=\EH, ich=\E[%p1%d@, -+ il=\E[%p1%dL, il1=\E[L, ind=^J, is2=\E)0, kbs=^H, kcbt=\E[Z, -+ kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, -+ kdch1=\E[3~, kend=\E[4~, kf1=\EOP, kf10=\E[21~, -+ kf11=\E[23~, kf12=\E[24~, kf2=\EOQ, kf3=\EOR, kf4=\EOS, -+ kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, -+ khome=\E[1~, kich1=\E[2~, kmous=\E[M, knp=\E[6~, kpp=\E[5~, -+ nel=\EE, rc=\E8, rev=\E[7m, ri=\EM, rmacs=^O, -+ rmcup=\E[?1049l, rmir=\E[4l, rmkx=\E[?1l\E>, rmso=\E[23m, -+ rmul=\E[24m, rs2=\Ec\E[?1000l\E[?25h, sc=\E7, -+ sgr=\E[0%?%p6%t;1%;%?%p1%t;3%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;, -+ sgr0=\E[m\017, smacs=^N, smcup=\E[?1049h, smir=\E[4h, -+ smkx=\E[?1h\E=, smso=\E[3m, smul=\E[4m, tbc=\E[3g, E0=\E(B, -+ S0=\E(%p1%c, use=ecma+color, -+# The bce and status-line entries are from screen 3.9.13 (and require some -+# changes to .screenrc). -+screen-bce|VT 100/ANSI X3.64 virtual terminal with bce, -+ bce, -+ ech@, use=screen, -+screen-s|VT 100/ANSI X3.64 virtual terminal with hardstatus line, -+ dsl=\E_\E\\, fsl=\E\\, tsl=\E_, use=screen, - --hpsub|hp terminals -- capability subset, -- am, da, db, mir, xhp, xon, -- lines#24, -- bel=^G, clear=\EH\EJ, cr=^M, cub1=^H, cud1=\EB, cuf1=\EC, -- cuu1=\EA, dch1=\EP, dl1=\EM, ed=\EJ, el=\EK, hpa=\E&a%p1%dC, -- ht=^I, if=/usr/share/tabset/stdcrt, il1=\EL, ind=^J, -- is2=\E&s1A\E<\E&k0\\, kbs=^H, kcub1=\ED, kcud1=\EB, -- kcuf1=\EC, kcuu1=\EA, khome=\Eh, rmkx=\E&s0A, rmso=\E&d@, -- sgr0=\E&d@, smkx=\E&s1A, smso=\E&dB, -+# ====================================================================== -+# Entries for GNU Screen with 16 colors. -+# Those variations permit to benefit from 16 colors palette, and from -+# bold font and blink attribute separated from bright colors. But they -+# are less portable than the generic "screen" 8 color entries: Their -+# usage makes real sense only if the terminals you attach and reattach -+# do all support 16 color palette. - --# hpex: --# May be used for most 24 x 80 hp terminals, --# but has no padding added, so may allow runover in some terminals at high --# baud rates. Will not work for hp2640a or hp2640b terminals, hp98x6 and --# hp98x5 terminal emulators or hp98x6 consoles. --# Adds xy-cursor addressing, vertical cursor addressing, home, --# last line, and underline capabilities. --# --# (hpex: removed memory-lock capabilities ":ml=\El:mu=\Em:", --# moved <rmir> here from hpsub -- esr) --hpex|hp extended capabilites, -- cr=^M, cud1=^J, cup=\E&a%p1%dy%p2%dC, ht=^I, ind=^J, kbs=^H, -- kcub1=^H, kcud1=^J, nel=^M^J, rmir=\ER, rmul=\E&d@, smir=\EQ, -- smul=\E&dD, vpa=\E&a%p1%dY, use=hpsub, -+screen-16color|GNU Screen with 16 colors, -+ use=ibm+16color, use=screen, - --# From: Ville Sulko <Ville.Sulko@bip.atk.tpo.fi>, 05 Aug 1996 --hp2|hpex2|hewlett-packard extended capabilities newer version, -- am, da, db, mir, xhp, -- cols#80, lh#2, lines#24, lm#0, lw#8, nlab#8, xmc#0, -- bel=^G, clear=\E&a0y0C\EJ, cr=^M, cub1=^H, cud1=\EB, -- cuf1=\EC, cup=\E&a%p1%dy%p2%dC, cuu1=\EA, dch1=\EP, -- dl1=\EM, ed=\EJ, el=\EK, hpa=\E&a%p1%dC, ht=^I, hts=\E1, -- il1=\EL, ind=^J, kbs=^H, kclr=\EJ, kctab=\E2, kcub1=\ED, -- kcud1=\EB, kcuf1=\EC, kcuu1=\EA, kdch1=\EP, kdl1=\EM, -- ked=\EJ, kel=\EK, kf1=\Ep, kf2=\Eq, kf3=\Er, kf4=\Es, kf5=\Et, -- kf6=\Eu, kf7=\Ev, kf8=\Ew, khome=\Eh, khts=\E1, kich1=\EQ, -- kil1=\EL, kind=\ES, kll=\EF, knp=\EU, kpp=\EV, kri=\ET, -- krmir=\ER, ktbc=\E3, meml=\El, memu=\Em, -- pfkey=\E&f%p1%dk%p2%l%dL%p2%s, -- pfloc=\E&f1a%p1%dk%p2%l%dL%p2%s, -- pfx=\E&f2a%p1%dk%p2%l%dL%p2%s, -- pln=\E&f%p1%dk%p2%l%dd0L%p2%s, rmir=\ER, rmkx=\E&s0A, -- rmln=\E&j@, rmso=\E&d@, rmul=\E&d@, -- sgr=\E&d%?%p7%t%{115}%c%;%p1%p3%|%p6%|%{2}%*%p2%{4}%*%+%p4%+%p5%{8}%*%+%{64}%+%c%?%p9%t%'\016'%c%e%'\017'%c%;, -- sgr0=\E&d@, smir=\EQ, smkx=\E&s1A, smln=\E&jB, smso=\E&dB, -- smul=\E&dD, tbc=\E3, vpa=\E&a%p1%dY, -+screen-16color-s|GNU Screen with 16 colors and status line, -+ use=ibm+16color, use=screen-s, - --# HP 236 console --# From: <ddavis@ic.berkeley.edu> --hp236|hp236 internal terminal emulator, -- OTbs, am, -- cols#80, lines#24, -- clear=\EF, cnorm=\EDE, cub1=^H, -- cup=\EE%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, cvvis=\EDB, -- dch1=\EJ, dl1=\EH, el=\EK, ich1=\EI, il1=\EG, rmso=\ECI, -- sgr0=\ECI, smso=\EBI, -+screen-16color-bce|GNU Screen with 16 colors and BCE, -+ use=ibm+16color, use=screen-bce, - --# This works on a hp300 console running Utah 4.3 BSD --# From: Craig Leres <leres@okeeffe.berkeley.edu> --hp300h|HP Catseye console, -- OTbs, am, da, db, mir, xhp, -- cols#128, lines#51, lm#0, xmc#0, -- bel=^G, cbt=\Ei, clear=\E&a0y0C\EJ, cr=^M, cub1=^H, cud1=\EB, -- cuf1=\EC, cup=\E&a%p1%dy%p2%dC, cuu1=\EA, dch1=\EP, -- dl1=\EM, ed=\EJ, el=\EK, hpa=\E&a%p1%dC, ht=^I, -- if=/usr/share/tabset/stdcrt, il1=\EL, ind=^J, kbs=^H, -- kcub1=\ED, kcud1=\EB, kcuf1=\EC, kcuu1=\EA, khome=\Eh, -- rmir=\ER, rmkx=\E&s0A, rmso=\E&d@, rmul=\E&d@, sgr0=\E&d@, -- smir=\EQ, smkx=\E&s1A, smso=\E&dB, smul=\E&dD, tbc=\E3, -- vpa=\E&a%p1%dY, --# From: Greg Couch <gregc@ernie.berkeley.edu> --hp9837|hp98720|hp98721|HP 9000/300 workstations, -- OTbs, am, da, db, mir, xhp, -- cols#128, it#8, lines#46, lm#0, -- bel=^G, cbt=\Ei, clear=\E&a0y0C\EJ, cub1=^H, cud1=\EB, -- cuf1=\EC, cup=\E&a%p1%dy%p2%dC, cuu1=\EA, dch1=\EP, -- dl1=\EM, ed=\EJ, el=\EK, hpa=\E&a%p1%dC, ht=^I, hts=\E1, -- il1=\EL, ind=^J, is2=\E&v0m1b0i&j@, kbs=^H, kcub1=\ED, -- kcud1=\EB, kcuf1=\EC, kcuu1=\EA, kdch1=\EP, kdl1=\EM, -- ked=\EJ, kel=\EK, khome=\Eh, kich1=\EQ, kil1=\EL, knp=\EU, -- kpp=\EV, rmir=\ER, rmkx=\E&s0A, rmso=\E&v0S, rmul=\E&d@, -- sgr0=\E&d@, smir=\EQ, smkx=\E&s1A, smso=\E&v5S, smul=\E&dD, -- tbc=\E3, vpa=\E&a%p1%dY, --# HP 9845 desktop computer from BRL --# (hp9845: removed unknown capability :gu: -- esr) --hp9845|HP 9845, -- OTbs, am, da, db, eo, mir, xhp, -- cols#80, lines#21, -- OTbc=\ED, clear=\EH\EJ, cub1=\ED, cud1=\EB, cuf1=\EC, -- cup=\E&a%p2%2dc%p1%2dY, cuu1=\EA, dch1=\EP, dl1=\EM, -- ed=\EJ, el=\EK, if=/usr/share/tabset/std, il1=\EL, -- rmir=\ER, rmso=\E&d@, smir=\EQ, smso=\E&dB, --# From: Charles A. Finnell of MITRE <finnell@mitre.org>, developed 07SEP90 --# (hp98550: replaced /usr/share/tabset/9837 with std because <it#8>,<hts=\E1>; --# added empty <acsc> to avoid warnings re <smacs>/<rmacs> --esr) --hp98550|hp98550a|HP 9000 Series 300 color console, -- OTbs, am, da, db, mir, xhp, -- cols#128, it#8, lines#49, lm#0, -- acsc=, bel=^G, blink=\E&dA, bold=\E&dJ, cbt=\Ei, civis=\E*dR, -- clear=\EH\EJ, cnorm=\E*dQ, cr=^M, cub1=^H, cud1=^J, cuf1=\EC, -- cup=\E&a%p1%dy%p2%dC, cuu1=\EA, dch1=\EP, dim=\E&dH, -- dl1=\EM, ed=\EJ, el=\EK, hpa=\E&a%p1%dC, ht=^I, hts=\E1, -- if=/usr/share/tabset/std, il1=\EL, ind=^J, invis=\E&ds, -- kbs=^H, kclr=\EJ, kctab=\E2, kcub1=\ED, kcud1=\EB, kcuf1=\EC, -- kcuu1=\EA, kdch1=\EP, kdl1=\EM, ked=\EJ, kel=\EK, kf1=\Ep, -- kf2=\Eq, kf3=\Er, kf4=\Es, kf5=\Et, kf6=\Eu, kf7=\Ev, kf8=\Ew, -- khome=\Eh, khts=\E1, kich1=\EQ, kil1=\EL, kind=\ES, kll=\EF, -- knp=\EU, kpp=\EV, kri=\ET, krmir=\ER, ktbc=\E3, rev=\E&dJ, -- rmacs=^O, rmir=\ER, rmkx=\E&s0A, rmso=\E&d@, rmul=\E&d@, -- sgr0=\E&d@, smacs=^N, smir=\EQ, smkx=\E&s1A, smso=\E&dJ, -- smul=\E&dD, tbc=\E3, vpa=\E&a%p1%dY, --# From: Victor Duchovni <vic@fine.princeton.edu> --# (hp700-wy: removed obsolete ":nl=^J:"; --# replaced /usr/share/tabset/hp700-wy with std because <it#8>,<hts=\E1> -- esr) --hp700-wy|HP700/41 emulating wyse30, -- OTbs, am, bw, mir, msgr, -- cols#80, it#8, lines#24, xmc#1, -- cbt=\EI, clear=^Z, cr=^M, cub1=^H, cud1=^V, cuf1=^L, -- cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW, -- dl1=\ER, ed=\EY, el=\ET$<10/>, home=^^, ht=^I, hts=\E1, -- if=/usr/share/tabset/stdcrt, il1=\EE$<0.7*/>, -- is1=\E~"\EC\Er\E(\EG0\003\E`9\E`1, kbs=\177, kcbt=\EI, -- kclr=^Z, kcub1=^H, kcud1=^V, kcuf1=^L, kcuu1=^K, ked=\EY, -- kel=\ET, khome=^^, khts=\EI, kich1=\Eq, krmir=\Er, ll=^^^K, -- ri=\Ej, rmir=\Er, rmso=\EG0$<10/>, rmul=\EG0$<10/>, -- sgr0=\EG0$<10/>, smir=\Eq, smso=\EG4$<10/>, -- smul=\EG8$<10/>, tbc=\E0, vpa=\E[%p1%{32}%+%c, --hp70092|hp70092a|hp70092A|HP 700/92, -- am, da, db, xhp, -- cols#80, lh#2, lines#24, lm#0, lw#8, nlab#8, -- acsc=0cjgktlrmfn/q\,t5u6v8w7x., bel=^G, blink=\E&dA, -- bold=\E&dB, cbt=\Ei, clear=\E&a0y0C\EJ, cr=^M, cub1=^H, -- cud1=\EB, cuf1=\EC, cup=\E&a%p1%dy%p2%dC, cuu1=\EA, -- dch1=\EP, dim=\E&dH, dl1=\EM, el=\EK, hpa=\E&a%p1%dC, ht=^I, -- hts=\E1, il1=\EL, kbs=^H, kclr=\EJ, kctab=\E2, kcub1=\ED, -- kcud1=\EB, kcuf1=\EC, kcuu1=\EA, kdch1=\EP, kdl1=\EM, -- ked=\EJ, kel=\EK, kf1=\Ep, kf2=\Eq, kf3=\Er, kf4=\Es, kf5=\Et, -- kf6=\Eu, kf7=\Ev, kf8=\Ew, khome=\Eh, khts=\E1, kich1=\EQ, -- kil1=\EL, kind=\ES, kll=\EF, knp=\EU, kpp=\EV, kri=\ET, -- krmir=\ER, ktbc=\E3, rev=\E&dB, ri=\ET, rmacs=^O, rmir=\ER, -- rmkx=\E&s0A, rmln=\E&j@, rmso=\E&d@, rmul=\E&d@, -- sgr0=\E&d@, smacs=^N, smir=\EQ, smkx=\E&s1A, smln=\E&jB, -- smso=\E&dJ, smul=\E&dD, tbc=\E3, vpa=\E&a%p1%dY, -+screen-16color-bce-s|GNU Screen with 16 colors, BCE, and status line, -+ bce, use=ibm+16color, use=screen-s, - --bobcat|sbobcat|HP 9000 model 300 console, -- am, da, db, mir, xhp, -- cols#128, it#8, lines#47, xmc#0, -- cbt=\Ei, clear=\EH\EJ, cr=^M, cub1=^H, cud1=\EB, cuf1=\EC, -- cup=\E&a%p1%dy%p2%dC$<6/>, cuu1=\EA, dch1=\EP, -- dl1=\EM$<10*/>, ed=\EJ, el=\EK, hpa=\E&a%p1%dC$<6/>, ht=^I, -- il1=\EL$<10*/>, ind=^J, kbs=^H, kcub1=\ED, kcud1=\EB, -- kcuf1=\EC, kcuu1=\EA, khome=\Eh, nel=^M^J, rmir=\ER, -- rmkx=\E&s0A, rmso=\E&d@, rmul=\E&d@, sgr0=\E&d@, smir=\EQ, -- smkx=\E&s1A, smso=\E&dB, smul=\E&dD, vpa=\E&a%p1%dY$<6/>, --gator-t|HP 9000 model 237 emulating extra-tall AAA, -- lines#94, use=gator, --gator|HP 9000 model 237 emulating AAA, -- bw, km, mir, ul, -- cols#128, it#8, lines#47, -- bel=^G, cbt=\E[Z, clear=\E[H\E[J, cr=^M, cub1=^H, cud1=^J, -- cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu1=\EM, -- dch=\E[%p1%dP$<4/>, dch1=\E[P, dl=\E[%p1%dM$<1*/>, -- dl1=\E[M, ed=\E[J, el=\E[K, home=\E[H, hpa=\E[%i%p1%d`, -- ht=^I, ich=\E[%p1%d@$<4/>, ich1=\E[@, il=\E[%p1%dL$<1*/>, -- il1=\E[L, kbs=^H, kcub1=^H, kcud1=^J, nel=^M^J, -- rep=%p1%c\E[%p2%db$<1*/>, rev=\E[7m, rmso=\E[m, -- rmul=\E[m, sgr0=\E[m, smso=\E[7m, smul=\E[4m, --gator-52|HP 9000 model 237 emulating VT52, -- cols#128, lines#47, use=vt52, --gator-52t|HP 9000 model 237 emulating extra-tall VT52, -- lines#94, use=gator-52, -+# ====================================================================== -+# Entries for GNU Screen 4.02 with --enable-colors256. - --#### Honeywell-Bull --# --# From: Michael Haardt <michael@gandalf.moria> 11 Jan 93 --# -+screen-256color|GNU Screen with 256 colors, -+ ccc@, -+ initc@, use=xterm+256color, use=screen, - --# Honeywell Bull terminal. Its cursor and function keys send single --# control characters and it has standout/underline glitch. Most programs --# do not like these features/bugs. Visual bell is realized by flashing the --# "keyboard locked" LED. --dku7003-dumb|Honeywell Bull DKU 7003 dumb mode, -- cols#80, lines#25, -- clear=^]^_, cr=^M, cub1=^Y, cud1=^K, cuf1=^X, -- cup=\E[%i%p1%d;%p2%dH, cuu1=^Z, ed=^_, el=\E[K, -- flash=\E[2h\E[2l, home=^], ht=^I, ind=^J, kbs=^H, kcub1=^Y, -- kcud1=^K, kcuf1=^X, kcuu1=^Z, khome=^], nel=^M^J, --dku7003|Honeywell Bull DKU 7003 all features described, -- msgr, -- xmc#1, -- blink=\E[5m, bold=\E[7m, dim=\E[2m, rev=\E[7m, rmso=\E[m, -- rmul=\E[m, sgr0=\E[m, smso=\E[7m, smul=\E[4m, -- use=dku7003-dumb, -+screen-256color-s|GNU Screen with 256 colors and status line, -+ ccc@, -+ initc@, use=xterm+256color, use=screen-s, - --#### Lear-Siegler (adm) --# --# These guys are long since out of the terminals business, but --# in 1995 many current terminals still have an adm type as one of their --# emulations (usually their stupidest, and usually labeled adm3, though --# these `adm3' emulations normally have adm3a+ capabilities). --# --# WARNING: Some early ADM terminals (including the ADM3 and ADM5) had a --# `diagnostic feature' that sending them a ^G while pin 22 (`Ring Indicator') --# was being held to ground would trigger a send of the top line on the screen. --# A quick fix might be to drop back to a cheesy 4-wire cable with pin 22 --# hanging in the air. (Thanks to Eric Fischer, <eric@fudge.uchicago.edu>, --# for clearing up this point.) -+screen-256color-bce|GNU Screen with 256 colors and BCE, -+ ccc@, -+ initc@, use=xterm+256color, use=screen-bce, - --adm1a|adm1|lsi adm1a, -- am, -- cols#80, lines#24, -- bel=^G, clear=\E;$<1>, cr=^M, cub1=^H, cud1=^J, cuf1=^L, -- cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, home=^^, -- ind=^J, --adm2|lsi adm2, -- OTbs, am, -- cols#80, lines#24, -- bel=^G, clear=\E;, cr=^M, cub1=^H, cud1=^J, cuf1=^L, -- cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW, -- dl1=\ER, ed=\EY, el=\ET, home=^^, ich1=\EQ, il1=\EE, ind=^J, -- kcub1=^H, kcud1=^J, kcuf1=^L, kcuu1=^K, khome=^^, --# (adm3: removed obsolete ":ma=^K^P:" -- esr) --adm3|lsi adm3, -- OTbs, am, -- cols#80, lines#24, -- bel=^G, clear=^Z, cr=^M, cub1=^H, cud1=^J, ind=^J, --# The following ADM-3A switch settings are assumed for normal operation: --# SPACE U/L_DISP CLR_SCRN 24_LINE --# CUR_CTL LC_EN AUTO_NL FDX --# Other switches may be set for operator convenience or communication --# requirements. I recommend --# DISABLE_KB_LOCK LOCAL_OFF 103 202_OFF --# ETX_OFF EOT_OFF --# Most of these terminals required an option ROM to support lower case display. --# Open the case and look at the motherboard; if you see an open 24-pin DIP --# socket, you may be out of luck. -+screen-256color-bce-s|GNU Screen with 256 colors, BCE, and status line, -+ bce, ccc@, -+ initc@, use=xterm+256color, use=screen-s, -+ -+# ====================================================================== -+ -+# Read the fine manpage: -+# When screen tries to figure out a terminal name for -+# itself, it first looks for an entry named "screen.<term>", -+# where <term> is the contents of your $TERM variable. If -+# no such entry exists, screen tries "screen" (or "screen-w" -+# if the terminal is wide (132 cols or more)). If even this -+# entry cannot be found, "vt100" is used as a substitute. - # --# (adm3a: some capabilities merged in from BRl entry -- esr) --adm3a|lsi adm3a, -- OTbs, am, -- cols#80, lines#24, -- OTma=^K^P, OTnl=^J, bel=^G, clear=\032$<1/>, cr=^M, cub1=^H, -- cud1=^J, cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, -- cuu1=^K, home=^^, ind=^J, kcub1=^H, kcud1=^J, kcuf1=^L, -- kcuu1=^K, rs2=^N, --adm3a+|adm3a plus, -- kbs=^H, use=adm3a, --# (adm5: removed obsolete ":ma=^Hh^Jj^Kk^Ll^^H:" & duplicate ":do=^J:" -- esr) --adm5|lsi adm5, -- xmc#1, -- bel=^G, cr=^M, cud1=^J, ed=\EY, el=\ET, kbs=^H, khome=^^, -- rmso=\EG, smso=\EG, use=adm3a+, --# A lot of terminals other than adm11s use these. Wherever you see --# use=adm+sgr with some of its capabilities disabled, try the --# disabled ones. They may well work but not have been documented or --# expressed in the using entry. We'd like to cook up an <sgr> but the --# <rmacs>/<smacs> sequences of the using entries vary too much. --adm+sgr|adm style highlight capabilities, -- invis=\EG1, rev=\EG4, rmso=\EG0, rmul=\EG0, sgr0=\EG0, -- smso=\EG4, smul=\EG8, --# LSI ADM-11 from George William Hartwig, Jr. <geo@BRL-TGR.ARPA> via BRL --# Status line additions from Stephen J. Muir <stephen%comp.lancs.ac.uk@ucl-cs> --# <khome> from <stephen%comp.lancs.ac.uk@ucl-cs.arpa>. <clear> could also --# be ^Z, according to his entry. --# (adm11: <smul>=\EG4 was obviously erroneous because it also said --# <rev>=\EG4. Looking at other ADMs confirms this -- esr) --adm11|LSI ADM-11, -- OTbs, am, hs, -- OTkn#8, cols#80, lines#24, -- OTnl=^J, bel=^G, blink=\EG2, clear=\E*, cr=^M, cub1=^H, -- cud1=^J, cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, -- cuu1=^K, dsl=\Eh, ed=\EY, el=\ET, fsl=\E(\r, home=^^, ht=^I, -- kbs=^H, kcub1=^H, kcud1=^J, kcuf1=^L, kcuu1=^K, kf1=^A@\r, -- kf2=^AA\r, kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, kf6=^AE\r, -- kf7=^AF\r, kf8=^AG\r, khome=^^, nel=^M^J, tsl=\EF\E), -- use=adm+sgr, --# From: Andrew Scott Beals <bandy@lll-crg.ARPA> --# Corrected by Olaf Siebert <rhialto@polder.ubc.kun.nl>, 11 May 1995 --# Supervisor mode info by Ari Wuolle, <awuolle@delta.hut.fi>, 27 Aug 1996 --# (adm12: removed obsolete ":kn:ma=j^Jk^P^K^Pl ^R^L^L :". This formerly had --# <is2>=\Eq but that looked wrong; this <is2> is from Dave Yost <esquire!yost> --# via BRL. That entry asserted <xmc#1>, but I've left that out because --# neither earlier nor later ADMSs have it -- esr) -+# Notwithstanding the manpage, screen uses its own notion of the termcap -+# and some keys from "screen.<term>" are ignored. Here is an entry which -+# covers those (tested with screen 4.00.02) -TD -+screen+fkeys|function-keys according to screen, -+ kend=\E[4~, kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, kfnd@, -+ khome=\E[1~, kslt@, - # --# You will need to get into the supervisor setup before you can set --# baudrate etc. for your ADM-12+. Press Shift-Ctrl-Setup and you should --# see a lot more setup options. -+# Here are a few customized entries which are useful -TD - # --# While in supervisor setup you can also use following codes: -+# Notes: -+# (a) screen does not support invis. -+# (b) screen's implementation of bw is incorrect according to tack. -+# (c) screen appears to hardcode the strings for khome/kend, making it -+# necessary to override the "use=" clause's values (screen+fkeys). -+# (d) screen sets $TERMCAP to a termcap-formatted copy of the 'screen' entry, -+# which is NOT the same as the terminfo screen.<term>. -+# (e) when screen finds one of these customized entries, it sets $TERM to -+# match. Hence, no "screen.xterm" entry is provided, since that would -+# create heartburn for people running remote xterm's. - # --# Ctrl-P Personality character selections (configure for example what --# arrow keys send, if I recall correctly) --# Ctrl-T tabs 1-80 use left&right to move and up to set and --# Ctrl-V tabs 81-158 down to clear tab. Shift-Ctrl-M sets right margin at cursor --# Ctrl-B Binary setup (probably not needed. I think that everything can --# be set using normal setup) --# Ctrl-A Answerback mode (enter answerback message) --# Ctrl-U User friendly mode (normal setup) --# Ctrl-D Defaults entire setup and function keys from EPROM tables --# Ctrl-S Save both setup and functions keys. Takes from 6 to 10 seconds. --# Ctrl-R Reads both setup and functions keys from NVM. --# Shift-Ctrl-X Unlock keyboard and cancel received X-OFF status --# --# ADM-12+ supports hardware handshaking, but it is DTR/CTS as opposed to --# RTS/CTS used nowadays with virtually every modem and computer. 19200 --# bps works fine with hardware flow control. --# --# The following null-modem cable should fix this and enable you to use --# RTS/CTS handshaking (which Linux supports, use CRTSCTS setting). Also --# set ADM-12+ for DTR handshaking from supervisor setup. -+# xterm (-xfree86 or -r6) does not normally support kIC, kNXT and kPRV -+# since the default translations override the built-in keycode -+# translation. They are suppressed here to show what is tested by tack. -+screen.xterm-xfree86|screen.xterm-new|screen customized for modern xterm, -+ bce@, bw, -+ invis@, kIC@, kNXT@, kPRV@, meml@, memu@, -+ sgr=%?%p9%t\E(0%e\E(B%;\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m, -+ E3@, use=screen+fkeys, use=xterm-new, -+# xterm-r6 does not really support khome/kend unless it is propped up by -+# the translations resource. -+screen.xterm-r6|screen customized for X11R6 xterm, -+ bw, use=screen+fkeys, use=xterm-r6, -+# Color applications running in screen and TeraTerm do not play well together -+# on Solaris because Sun's curses implementation gets confused. -+screen.teraterm|disable ncv in teraterm, -+ ncv#127, -+ acsc=+\020\,\021-\030.^Y0\333`\004a\261f\370g\361h\260i\316j\331k\277l\332m\300n\305o~p\304q\304r\304s_t\303u\264v\301w\302x\263y\363z\362{\343|\330}\234~\376, -+ use=screen+fkeys, use=screen, -+# Other terminals -+screen.rxvt|screen in rxvt, -+ bw, XT, -+ cvvis@, flash@, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, -+ kcuu1=\EOA, use=screen+fkeys, use=vt100+enq, -+ use=rxvt+pcfkeys, use=vt220+keypad, use=screen, -+screen.Eterm|screen in Eterm, -+ use=screen+fkeys, use=Eterm, -+screen.mrxvt|screen in mrxvt, -+ use=screen+fkeys, use=mrxvt, -+screen.vte|screen in any VTE-based terminal, -+ use=screen+fkeys, use=vte, -+screen.gnome|screen in GNOME Terminal, -+ use=screen+fkeys, use=gnome, -+screen.konsole|screen in KDE console window, -+ use=screen+fkeys, use=konsole, -+# fix the backspace key -+screen.linux|screen in linux console, -+ bw, -+ kbs=\177, kcbt@, use=screen+fkeys, use=screen, -+screen.mlterm|screen in mlterm, -+ use=screen+fkeys, use=mlterm, -+ -+# The default "screen" entry is reasonably portable, but not optimal for the -+# most widely-used terminal emulators. The "bce" capability is supported in -+# screen since 3.9.13, and when used, will require fewer characters to be sent -+# to the terminal for updates. - # --# PC Serial ADM-12+ --# -------- ------- --# 2 - 3 --# 3 - 2 --# 4 - 5 --# 5 - 20 --# 6,8 - 4 --# 7 - 7 --# 20 - 6,8 -+# If you are using only terminals which support bce, then you can use this -+# feature in your screen configuration. - # --adm12|lsi adm12, -- OTbs, OTpt, am, mir, -- OTug#1, cols#80, it#8, lines#24, -- bel=^G, clear=^Z, cr=^M, cub1=^H, cud1=^J, cuf1=^L, -- cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW, -- dl1=\ER, ed=\EY, el=\ET, home=^^, hts=\E1, ich1=\EQ, il1=\EE, -- is2=\E0 \E1 \E1 \E1 \E1 \E1 \E1 \E1 \E1, -- kcub1=^H, kcud1=^J, kcuf1=^L, kcuu1=^K, kf0=^A0\r, kf1=^A1\r, -- kf2=^A2\r, kf3=^A3\r, kf4=^A4\r, kf5=^A5\r, kf6=^A6\r, -- kf7=^A7\r, kf8=^A8\r, kf9=^A9\r, rmir=\Er, smir=\Eq, tbc=\E0, -- use=adm+sgr, --# (adm20: removed obsolete ":kn#7:" -- esr) --adm20|lear siegler adm20, -- OTbs, am, -+# Adding these lines to your ".screenrc" file will allow using these customized -+# entries: -+# term screen-bce -+# bce on -+# defbce on -+screen-bce.xterm-new|screen optimized for modern xterm, -+ bce, -+ ech@, use=screen.xterm-new, -+screen-bce.rxvt|screen optimized for rxvt, -+ bce, -+ ech@, use=screen.rxvt, -+screen-bce.Eterm|screen optimized for Eterm, -+ bce, -+ ech@, use=screen.Eterm, -+screen-bce.mrxvt|screen optimized for mrxvt, -+ bce, -+ ech@, use=screen.mrxvt, -+screen-bce.gnome|screen optimized for GNOME-Terminal, -+ bce, -+ ech@, use=screen.gnome, -+screen-bce.konsole|screen optimized for KDE console window, -+ bce, -+ ech@, use=screen.konsole, -+screen-bce.linux|screen optimized for linux console, -+ bce, -+ ech@, use=screen.linux, -+screen-bce.mlterm|screen optimized for mlterm, -+ bce, -+ ech@, use=screen.mlterm, -+ -+screen-w|VT 100/ANSI X3.64 virtual terminal with 132 cols, -+ cols#132, use=screen, -+ -+screen2|old VT 100/ANSI X3.64 virtual terminal, - cols#80, it#8, lines#24, -- bel=^G, cbt=\EI, clear=^Z, cr=^M, cub1=^H, cuf1=^L, -- cup=\E=%i%p2%{31}%+%c%p1%{31}%+%c, cuu1=^K, dch1=\EW, -- dl1=\ER, ed=\EY, el=\ET, home=^^, ht=^I, ich1=\EQ, il1=\EE, -- kf1=^A, kf2=^B, kf3=^W, kf4=^D, kf5=^E, kf6=^X, kf7=^Z, rmso=\E(, -- sgr0=\E(, smso=\E), --adm21|lear siegler adm21, -- xmc#1, -- bel=^G, cr=^M, cud1=^J, dch1=\EW, dl1=30*\ER, ed=\EY, el=\ET, -- ich1=\EQ, il1=30*\EE, ind=^J, invis@, kbs=^H, kcub1=^H, -- kcud1=^J, kcuf1=^L, kcuu1=^K, khome=^^, use=adm+sgr, -- use=adm3a, --# (adm22: ":em=:" was an obvious typo for ":ei=:"; also, --# removed obsolete ":kn#7:ma=j^Jk^P^K^Pl ^R^L^L :"; --# removed bogus-looking \200 from before <cup>. -- esr) --adm22|lsi adm22, -- OTbs, am, -- cols#80, lines#24, -- bel=^G, cbt=\EI, clear=\E+, cr=^M, cub1=^H, cud1=^J, cuf1=^L, -- cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW, -- dl1=\ER, ed=\Ey, el=\Et, home=^^, ht=\Ei, ich1=\EQ, il1=\EE, -- is2=\E%\014\014\014\016\003\0\003\002\003\002\0\0\0\0\0\0\0\0\0\0\0, -- kbs=^H, kcub1=^H, kcud1=^J, kcuf1=^L, kcuu1=^K, kf1=^A@\r, -- kf2=^AA\r, kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, kf6=^AE\r, -- kf7=^AF\r, khome=^^, lf1=F1, lf2=F2, lf3=F3, lf4=F4, lf5=F5, -- lf6=F6, lf7=F7, rmso=\E(, sgr0=\E(, smso=\E), --# ADM 31 DIP Switches --# --# This information comes from two versions of the manual for the --# Lear-Siegler ADM 31. --# --# Main board: --# rear of case --# +-||||-------------------------------------+ --# + S1S2 ||S + --# + ||3 + --# + + --# + ||S + --# + ||4 + --# + + --# + + --# + + --# + + --# + + --# +-+ +-+ --# + + --# + S5 S6 S7 + --# + == == == + --# +----------------------------------------------+ --# front of case (keyboard) --# --# S1 - Data Rate - Modem --# S2 - Data Rate - Printer --# ------------------------ --# Data Rate Setting --# ------------------- --# 50 0 0 0 0 --# 75 1 0 0 0 --# 110 0 1 0 0 --# 134.5 1 1 0 0 --# 150 0 0 1 0 --# 300 1 0 1 0 --# 600 0 1 1 0 --# 1200 1 1 1 0 --# 1800 0 0 0 1 --# 2000 1 0 0 1 --# 2400 0 1 0 1 --# 3600 1 1 0 1 --# 4800 0 0 1 1 --# 7200 1 0 1 1 --# 9600 0 1 1 1 --# x 1 1 1 1 --# --# S3 - Interface/Printer/Attributes --# --------------------------------- --# Printer Busy Control --# sw1 sw2 sw3 --# --------------- --# off off off Busy not active, CD disabled --# off off on Busy not active, CD enabled --# off on off Busy active on J5-20, CD disabled --# on off off Busy active on J5-19, CD disabled - Factory Set. --# on off on Busy active on J5-19, CD enabled -+ cbt=\E[Z, clear=\E[2J\E[H, cr=^M, cub=\E[%p1%dD, cub1=^H, -+ cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, cuf1=\E[C, -+ cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, -+ dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, -+ el=\E[K, ht=^I, hts=\EH, ich=\E[%p1%d@, ich1=, il=\E[%p1%dL, -+ il1=\E[L, ind=^J, kbs=^H, kcub1=\ED, kcud1=\EB, kcuf1=\EC, -+ kcuu1=\EA, kf0=\E~, kf1=\ES, kf2=\ET, kf3=\EU, kf4=\EV, -+ kf5=\EW, kf6=\EP, kf7=\EQ, kf8=\ER, kf9=\E0I, khome=\EH, -+ nel=^M^J, rc=\E8, ri=\EM, rmir=\E[4l, rmso=\E[23m, -+ rmul=\E[24m, rs1=\Ec, sc=\E7, sgr0=\E[m, smir=\E[4h, -+ smso=\E[3m, smul=\E[4m, tbc=\E[3g, -+# (screen3: removed unknown ":xv:LP:G0:" -- esr) -+screen3|older VT 100/ANSI X3.64 virtual terminal, -+ km, mir, msgr, -+ cols#80, it#8, lines#24, -+ bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, clear=\E[H\E[J, -+ cr=^M, csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, -+ cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, -+ cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\EM, -+ dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, -+ el=\E[K, home=\E[H, ht=^I, hts=\EH, ich=\E[%p1%d@, -+ il=\E[%p1%dL, il1=\E[L, ind=^J, is2=\E)0, kbs=^H, kcub1=\EOD, -+ kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kf1=\EOP, kf2=\EOQ, -+ kf3=\EOR, kf4=\EOS, nel=\EE, rc=\E8, rev=\E[7m, ri=\EM, -+ rmir=\E[4l, rmkx=\E>, rmso=\E[23m, rmul=\E[24m, rs1=\Ec, -+ sc=\E7, sgr0=\E[m, smir=\E[4h, smkx=\E=, smso=\E[3m, -+ smul=\E[4m, tbc=\E[3g, -+ -+#### NCSA Telnet -+ -+# Francesco Potorti <F.Potorti@cnuce.cnr.it>: -+# NCSA telnet is one of the most used telnet clients for the Macintosh. It has -+# been maintained until recently by the National Center for Supercomputer -+# Applications, and it is feature rich, stable and free. It can be downloaded -+# from www.ncsa.edu. This terminfo description file is based on xterm-vt220, -+# xterm+sl, and the docs at NCSA. It works well. - # --# sw4 Used in conjuction with S4 for comm interface control - Fact 0 -+# NCSA Telnet 2.6 for Macintosh in vt220 8-bit emulation mode -+# The terminal options should be set as follows: -+# Xterm sequences ON -+# use VT wrap mode ON -+# use Emacs arrow keys OFF -+# CTRL-COMND is Emacs meta ON -+# 8 bit mode ON -+# answerback string: "ncsa-vt220-8" -+# setup keys: all disabled - # --# sw5 Secondary Channel Control (Hardware implementation only) - Fact 0 -+# Application mode is not used. - # --# sw6 ON enables printer BUSY active LOW - Factory Setting --# OFF enables printer BUSY active HIGH - If set to this, ADM31 senses -+# Other special mappings: -+# Apple VT220 -+# HELP Find -+# HOME Insert here -+# PAGEUP Remove -+# DEL Select -+# END Prev Screen -+# PAGEDOWN Next Screen - # --# sw7 ON - steady cursor - Factory Setting --# OFF - blinking cursor -+# Though it supports ANSI color, NCSA Telnet uses color to represent blinking -+# text. - # --# sw8 ON causes selected attribute character to be displayed --# OFF causes SPACE to be displayed instead - Factory Setting --# --# S4 - Interface --# -------------- --# Modem Interface --# S3 S4 S4 S4 S4 --# sw4 sw1 sw2 sw3 sw4 --# --------------------------- --# OFF ON OFF ON OFF Enable RS-232C interface, Direct Connect and --# Current Loop disabled - Factory Setting --# ON ON OFF ON OFF Enable Current Loop interface, Direct Connect --# disabled --# OFF OFF ON OFF ON Enable Direct Connect interface, RS-232C and --# Current Loop Disabled --# --# sw5 ON disables dot stretching mode - Factory Setting --# OFF enables dot stretching mode --# sw6 ON enables blanking function --# OFF enables underline function - Factory Setting --# sw7 ON causes NULLS to be displayed as NULLS --# OFF causes NULLS to be displayed as SPACES - Factory Setting --# --# S5 - Word Structure --# ------------------- --# sw1 ON enables BREAK key - Factory Setting --# OFF disables BREAK key --# sw2 ON selects 50Hz monitor refresh rate --# OFF selects 60Hz monitor refresh rate - Factory Setting --# --# Modem Port Selection --# sw3 sw4 sw5 --# --------------- --# ON ON ON Selects 7 DATA bits, even parity, 2 STOP bits --# OFF ON ON Selects 7 DATA bits, odd parity, 2 STOP bits --# ON OFF ON Selects 7 DATA bits, even parity, 1 STOP bit - Factory Set. --# OFF OFF ON Selects 7 DATA bits, odd parity, 1 STOP bit --# ON ON OFF Selects 8 DATA bits, no parity, 2 STOP bits --# OFF ON OFF Selects 8 DATA bits, no parity, 1 STOP bit --# ON OFF OFF Selects 8 DATA bits, even parity, 1 STOP bit --# OFF OFF OFF Selects 8 DATA bits, odd parity, 1 STOP bit --# --# sw6 ON sends bit 8 a 1 (mark) --# OFF sends bit 8 as 0 (space) - Factory Setting --# sw7 ON selects Block Mode --# OFF selects Conversation Mode - Factory Setting --# sw8 ON selects Full Duplex operation --# OFF selects Half Duplex operation - Factory Setting --# --# S6 - Printer --# ------------ --# sw1, sw2, sw6, sw7 Reserved - Factory 0 --# --# Printer Port Selection --# same as Modem above, bit 8 (when 8 DATA bits) is always = 0 --# --# sw8 ON enables Printer Port --# OFF disables Printer Port - Factory Setting --# --# S7 - Polling Address --# -------------------- --# sw1-7 Establish ASCII character which designates terminal polling address --# ON = logic 0 --# OFF = logic 1 - Factory Setting --# sw8 ON enables Polling Option --# OFF disables Polling Option - Factory Setting -+# The status-line manipulation is a mapping of the xterm-compatible control -+# sequences for setting the window-title. So you must use tsl and fsl in -+# pairs, since the latter ends the string that is loaded to the window-title. -+ncsa-m|ncsa-vt220-8|NCSA Telnet 2.6 for Macintosh in vt220-8 mode, -+ am, km, mir, msgr, xenl, -+ acsc=``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -+ bel=^G, blink=\E[5m, bold=\E[1m, civis=\E[?25l, -+ clear=\E[H\E[2J, cnorm=\E[?25h, cr=^M, -+ csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, -+ cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, -+ cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, -+ dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, -+ el=\E[K, el1=\E[1K, enacs=\E)0, flash=\E[?5h\E[?5l, -+ home=\E[H, ht=^I, hts=\EH, ich=\E[%p1%d@, -+ if=/usr/share/tabset/vt100, il=\E[%p1%dL, il1=\E[L, -+ ind=\n$<150*>, -+ is2=\E7\E[r\E[m\E[?7h\E[?1;4;6l\E[4l\E8\E>, kbs=^H, -+ kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, -+ kdch1=\E[4~, kend=\E[5~, kf1=\E[17~, kf10=\E[28~, -+ kf11=\E[29~, kf12=\E[31~, kf13=\E[32~, kf14=\E[33~, -+ kf15=\E[34~, kf2=\E[18, kf3=\E[19~, kf4=\E[20~, kf5=\E[21~, -+ kf6=\E[23~, kf7=\E[24~, kf8=\E[25~, kf9=\E[26~, khlp=\E[1~, -+ khome=\E[2~, knp=\E[6~, kpp=\E[3~, mc4=\E[4i, mc5=\E[5i, -+ rc=\E8, rev=\E[7m, rf=/usr/share/tabset/vt100, ri=\EM, -+ rmacs=\E(B, rmam=\E[?7l, rmcup=\E[2J\E8, rmir=\E[4l, -+ rmso=\E[27m, rmul=\E[24m, -+ rs2=\E7\E[r\E8\E[m\E[?7h\E[?1;4;6l\E[4l\E>, sc=\E7, -+ sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p4%t;5%;%?%p1%p3%|%t;7%;m%?%p9%t\E(0%e\E(B%;, -+ sgr0=\E[m\E(B, smacs=\E(0, smam=\E[?7h, smcup=\E7, -+ smir=\E[4h, smso=\E[7m, smul=\E[4m, tbc=\E[3g, -+ u8=\E[?62;1;6c, use=xterm+sl, use=ansi+enq, -+ncsa|NCSA Telnet 2.7 for Macintosh in vt220-8 mode, -+ use=ncsa-m, use=klone+color, -+ncsa-ns|NCSA Telnet 2.7 for Macintosh in vt220-8 mode, -+ hs@, -+ dsl@, fsl@, tsl@, use=ncsa, -+ncsa-m-ns|NCSA Telnet 2.6 for Macintosh in vt220-8 mode, -+ hs@, -+ dsl@, fsl@, tsl@, use=ncsa-m, -+# alternate -TD: -+# The documented function-key mapping refers to the Apple Extended Keyboard -+# (e.g., NCSA Telnet's F1 corresponds to a VT220 F6). We use the VT220-style -+# codes, however, since the numeric keypad (VT100) PF1-PF4 are available on -+# some keyboards and many applications require these as F1-F4. - # -+ncsa-vt220|NCSA Telnet using vt220-compatible function keys, -+ kf1=\EOP, kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, -+ kf13=\E[25~, kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, -+ kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, kf2=\EOQ, -+ kf20=\E[34~, kf3=\EOR, kf4=\EOS, kf6=\E[17~, kf7=\E[18~, -+ kf8=\E[19~, kf9=\E[20~, use=ncsa, -+ -+#### Pilot Pro Palm-Top - # --# On some older adm31s, S4 does not exist, and S5-sw6 is not defined. -+# Termcap for Top Gun Telnet and SSH on the Palm Pilot. -+# http://www.ai/~iang/TGssh/ -+pilot|tgtelnet|Top Gun Telnet on the Palm Pilot Professional, -+ OTbs, am, xenl, -+ cols#39, lines#16, -+ bel=^G, clear=\Ec, cr=^M, cub1=^H, cud1=^J, -+ cup=\Em%p1%{32}%+%c%p2%{32}%+%c, home=\Em\s\s, ht=^I, -+ ind=^J, kbs=^H, kcub1=^H, kcud1=^J, knp=^L, kpp=^K, nel=\Em~\s, -+ rmso=\EB, smso=\Eb, -+ -+# From: Federico Bianchi <bianchi@www.arte.unipi.it> -+# These entries are for the Embeddable Linux Kernel System (ELKS) -+# project - an heavily stripped down Linux to be run on 16 bit -+# boxes or, eventually, to be used in embedded systems - and have been -+# adapted from the stock ELKS termcap. The project itself looks stalled, -+# and the latest improvements I know of date back to March 2000. - # --# This adm31 entry uses underline as the standout mode. --# If the adm31 gives you trouble with standout mode, check the DIP switch in --# position 6, bank @c11, 25% from back end of the circuit board. Should be --# OFF. If there is no such switch, you have an old adm31 and must use oadm31. --# (adm31: removed obsolete ":ma=j^Jk^P^K^Pl ^R^L^L :" -- esr) --adm31|lsi adm31 with sw6 set for underline mode, -- OTbs, am, mir, -- cols#80, lines#24, -- bel=^G, clear=\E*, cr=^M, cub1=^H, cud1=^J, cuf1=^L, -- cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW, -- dl1=\ER, ed=\EY, el=\ET, home=^^, il1=\EE, ind=^J, is2=\Eu\E0, -- kcub1=^H, kcud1=^J, kcuf1=^L, kcuu1=^K, kf0=^A0\r, kf1=^A1\r, -- kf2=^A2\r, kf3=^A3\r, kf4=^A4\r, kf5=^A5\r, kf6=^A6\r, -- kf7=^A7\r, kf8=^A8\r, kf9=^A9\r, rmir=\Er, rmso=\EG0, -- rmul=\EG0, sgr0=\EG0, smir=\Eq, smso=\EG1, smul=\EG1, --adm31-old|o31|old adm31, -- rmul@, smso=\EG4, smul@, use=adm31, --# LSI ADM-36 from Col. George L. Sicherman <gloria!colonel> via BRL --adm36|LSI ADM36, -- OTbs, OTpt, -- OTkn#4, -- if=/usr/share/tabset/vt100, -- is2=\E<\E>\E[6;?2;?7;?8h\E[4;20;?1;?3;?4;?5;?6;?18;?19l, -- use=vt100, --# (adm42: removed obsolete ":ma=^K^P:" -- esr) --adm42|lsi adm42, -+# To cope with the ELKS dumb console I added an "elks-glasstty" entry; -+# as an added bonus, this deals with all the capabilities common to -+# both VT52 and ANSI (or, eventually, "special") modes. -+ -+elks-glasstty|ELKS glass-TTY capabilities, - OTbs, am, -- cols#80, lines#24, -- bel=^G, cbt=\EI, clear=\E;, cr=^M, cub1=^H, cud1=^J, cuf1=^L, -- cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, -- cvvis=\EC\E3 \E3(, dch1=\EW, dl1=\ER, ed=\EY, el=\ET, ht=^I, -- il1=\EE$<270>, ind=^J, invis@, ip=$<6*>, kcub1=^H, kcud1=^J, -- kcuf1=^L, kcuu1=^K, khome=^^, pad=\177, rmir=\Er, rmul@, -- smir=\Eq, smul@, use=adm+sgr, --# The following termcap for the Lear Siegler ADM-42 leaves the --# "system line" at the bottom of the screen blank (for those who --# find it distracting otherwise) --adm42-ns|lsi adm-42 with no system line, -- cbt=\EI\EF \011, clear=\E;\EF \011, -- cup=\E=%p1%{32}%+%c%p2%{32}%+%c$<6>\EF \011, -- dch1=\EW\EF \011, dl1=\ER\EF \011, ed=\EY\EF \011, -- el=\ET\EF \011, il1=\EE\EF \011, rmir=\Er\EF \011, -- smir=\Eq\EF \011, use=adm42, --# ADM 1178 terminal -- rather like an ADM-42. Manual is dated March 1 1985. --# The insert mode of this terminal is commented out because it's broken for our --# purposes in that it will shift the position of every character on the page, --# not just the cursor line! --# From: Michael Driscoll <fenris@lightspeed.net> 10 July 1996 --adm1178|1178|lsi adm1178, -- am, -- cols#80, lines#24, xmc#1, -- bel=^G, bold=\E(, cbt=\EI, clear=\E+, cr=^M, cub1=^H, cud1=^J, -- cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, -- cvvis=\EC\E3 \E3(, dch1=\EW, dl1=\ER, ed=\EY, el=\ET, -- home=^^, ht=^I, il1=\EE, ind=^J, ip=$<6*/>, kbs=^H, kcub1=^H, -- kcud1=^J, nel=^M^J, pad=\177, rev=\EG4, rmso=\EG0, rmul=\EG0, -- sgr0=\E), smso=\EG4, smul=\EG1, -+ cols#80, it#8, lines#25, -+ bel=^G, cr=^M, ht=^I, ind=^J, kbs=^H, kcub1=^H, kcud1=^J, -+ nel=^M^J, - --#### Prime --# --# Yes, Prime made terminals. These entries were posted by Kevin J. Cummings --# <cummings@primerd.prime.com> on 14 Dec 1992 and lightly edited by esr. --# Prime merged with ComputerVision in the late 1980s; you can reach them at: --# --# ComputerVision Services --# 500 Old Connecticut Path --# Framingham, Mass. --# -+elks-vt52|ELKS vt52 console, -+ clear=\EH\EJ, cub1=\ED, cud1=\EB, cuf1=\EC, -+ cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, el=\EK, -+ home=\EH, use=elks-glasstty, - --# Standout mode is dim reverse-video. --pt100|pt200|wren|fenix|prime pt100/pt200, -- am, bw, mir, msgr, -- cols#80, it#8, lines#24, -- cbt=\E[Z, clear=\E?, cr=^M, cub=\E[%p1%dD, cub1=^H, -- cud=\E[%p1%dB, cud1=\ED, cuf=\E[%p1%dC, cuf1=\E[C, -- cup=\E0%p1%{33}%+%c%p2%{33}%+%c, cuu=\E[%p1%dA, -- cuu1=\EM, dch=\E[%p1%dP, dch1=\E[P, dim=\E[2m, dl1=\E[M, -- ed=\E[J\E[r, el=\E[K\E[t, flash=\E$$<200/>\E$P, -- home=\E$B, ht=^I, il1=\E[L\E[t, ind=^J, kbs=^H, kcub1=\E[D, -- kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, khome=\E$A, nel=^M^J, -- rmcup=, rmir=\E[4l, rmkx=\E[>13l, rmso=\E[m, rmul=\E[m, -- sgr0=\E[m, -- smcup=\E[>1l\E[>2l\E[>16l\E[4l\E[>9l\E[20l\E[>3l\E[>7h\E[>12l\E[1Q, -- smir=\E[4h, smkx=\E[>13h, smso=\E[2;7m, smul=\E[4m, --pt100w|pt200w|wrenw|fenixw|prime pt100/pt200 in 132-column mode, -- cols#132, -- cup=\E[%i%p1%d;%p2%dH, use=pt100, --pt250|Prime PT250, -- rmso@, smso@, use=pt100, --pt250w|Prime PT250 in 132-column mode, -- rmso@, smso@, use=pt100w, -+elks-ansi|ELKS ANSI console, -+ clear=\E[H\E[2J, cub1=\E[D, cud1=\E[B, cuf1=\E[C, -+ cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, el=\E[K, home=\E[H, -+ rmso=\E[m, smso=\E[7m, use=elks-glasstty, - --#### Qume (qvt) -+# As a matter of fact, ELKS 0.0.83 on PCs defaults to ANSI emulation -+# instead of VT52, but the "elks" entry still refers to the latter. -+ -+elks|default ELKS console, -+ use=elks-vt52, -+ -+# Project SIBO (for Psion 3 palmtops) console is identical to the ELKS -+# one but in screen size -+ -+sibo|ELKS SIBO console, -+ cols#61, it#8, lines#20, use=elks-vt52, -+ -+######## COMMERCIAL WORKSTATION CONSOLES - # --# Qume, Inc. --# 3475-A North 1st Street --# San Jose CA 95134 --# Vox: (800)-457-4447 --# Fax: (408)-473-1510 --# Net: josed@techsupp.wyse.com (Jose D'Oliveira) -+ -+#### Alpha consoles - # --# Qume was bought by Wyse, but still (as of early 1995) has its own support --# group and production division. --# --# Discontinued Qume models: --# --# The qvt101 and qvt102 listed here are long obsolete; so is the qvt101+ --# built to replace them, and a qvt119+ which was a 101+ with available wide --# mode (132 columns). There was a qvt103 which added vt100/vt131 emulations --# and an ANSI-compatible qvt203 that replaced it. Qume started producing --# ANSI-compatible terminals with the qvt323 and qvt61. --# --# Current Qume models (as of February 1995): --# --# All current Qume terminals have ANSI-compatible operation modes. --# Qume is still producing the qvt62, which features emulations for other --# popular lines such as ADDS, and dual-host capabilities. The qvt82 is --# designed for use as a SCO ANSI terminal. The qvt70 is a color terminal --# with many emulations including Wyse370, Wyse 325, etc. Their newest --# model is the qvt520, which is vt420-compatible. --# --# There are some ancient printing Qume terminals under `Daisy Wheel Printers' --# --# If you inherit a Qume without docs, try Ctrl-Shift-Setup to enter its --# setup mode. Shift-s should be a configuration save to NVRAM. - --qvt101|qvt108|qume qvt 101 and QVT 108, -- xmc#1, use=qvt101+, -+# This is from the OSF/1 Release 1.0 termcap file -+pccons|pcconsole|ANSI (mostly) Alpha PC console terminal emulation, -+ am, xon, -+ cols#80, lines#25, -+ bel=^G, clear=\E[H\E[2J, cr=^M, cub1=^H, cud1=^J, cuf1=\E[C, -+ cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, dch1=\E[P, dl1=\E[M, -+ el=\E[K, home=\E[H, ht=^I, ich1=\E[@, il1=\E[L, kbs=^H, -+ kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, khome=\E[H, -+ nel=^M^J, rev=\E[7m, rmso=\E[m, sgr0=\E[m, smso=\E[7m, - --# This used to have <cvvis=\E.2> but no <cnorm> or <civis>. The BSD termcap --# file had <cvvis=\EM4 \200\200\200>. I've done the safe thing and yanked --# both. The <rev> is from BSD, which also claimed bold=\E( and dim=\E). --# What seems to be going on here is that this entry was designed so that --# the normal highlight is bold and standout is dim plus something else --# (reverse-video maybe? But then, are there two <rev> sequences?) --qvt101+|qvt101p|qume qvt 101 PLUS product, -- am, bw, hs, ul, -- cols#80, lines#24, xmc#0, -- bel=^G, cbt=\EI, clear=^Z, cnorm=\E.4, cr=^M, cub1=^H, cud1=^J, -- cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, -- dch1=\EW, dl1=\ER, dsl=\Eg\Ef\r, ed=\EY, el=\ET, -- flash=\Eb$<200>\Ed, fsl=^M, home=^^, ht=^I, hts=\E1, -- ich1=\EQ, il1=\EE, ind=^J, invis@, kbs=^H, kcbt=\EI, kcub1=^H, -- kcud1=^J, kcuf1=^L, kcuu1=^K, kdl1=\ER, ked=\EY, kel=\ET, -- kf1=^A@\r, kf10=^AI\r, kf2=^AA\r, kf3=^AB\r, kf4=^AC\r, -- kf5=^AD\r, kf6=^AE\r, kf7=^AF\r, kf8=^AG\r, kf9=^AH\r, -- khome=^^, kich1=\EQ, kil1=\EE, mc4=\EA, mc5=\E@, rmso=\E(, -- smso=\E0P\E), tbc=\E3, tsl=\Eg\Ef, use=adm+sgr, --qvt102|qume qvt 102, -- cnorm=\E., use=qvt101, --# (qvt103: added <rmam>/<smam> based on init string -- esr) --qvt103|qume qvt 103, -- am, xenl, xon, -- cols#80, it#8, lines#24, vt#3, -- bel=^G, blink=\E[5m$<2>, bold=\E[1m$<2>, -- clear=\E[H\E[2J$<50>, cr=^M, csr=\E[%i%p1%d;%p2%dr, -- cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=^J, -- cuf=\E[%p1%dC, cuf1=\E[C$<2>, -- cup=\E[%i%p1%d;%p2%dH$<5>, cuu=\E[%p1%dA, -- cuu1=\E[A$<2>, ed=\E[J$<50>, el=\E[K$<3>, home=\E[H, ht=^I, -- hts=\EH, ind=^J, kbs=^H, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, -- kcuu1=\EOA, kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, rc=\E8, -- rev=\E[7m$<2>, ri=\EM$<5>, rmam=\E[?7l, rmkx=\E[?1l\E>, -- rmso=\E[m$<2>, rmul=\E[m$<2>, -- rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sc=\E7, -- sgr=\E[%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;m$<2>, -- sgr0=\E[m$<2>, smam=\E[?7h, smkx=\E[?1h\E=, -- smso=\E[7m$<2>, smul=\E[4m$<2>, tbc=\E[3g, --qvt103-w|qume qvt103 132 cols, -- cols#132, lines#24, -- rs2=\E>\E[?3h\E[?4l\E[?5l\E[?8h, use=qvt103, --qvt119+|qvt119p|qvt119|qume qvt 119 and 119PLUS terminals, -- am, hs, mir, msgr, -- cols#80, lines#24, xmc#0, -- bel=^G, cbt=\EI, clear=\E*1, cnorm=\E.4, cr=^M, cub1=^H, -- cud1=^J, cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, -- cuu1=^K, cvvis=\E.2, dch1=\EW, dl1=\ER, dsl=\Eg\Ef\r, ed=\Ey, -- el=\Et, flash=\En0$<200>\En1, fsl=^M, home=^^, ht=^I, -- hts=\E1, il1=\EE, ind=^J, is2=\EDF\EC\EG0\Er\E(\E%EX, -- kbs=^H, kcub1=^H, kcud1=^J, kcuf1=^L, kcuu1=^K, kf0=^AI\r, -- kf1=^A@\r, kf2=^AA\r, kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, -- kf6=^AE\r, kf7=^AF\r, kf8=^AG\r, kf9=^AH\r, khome=^^, -- mc4=\EA, mc5=\E@, ri=\EJ, rmir=\Er, smir=\Eq, smul=\EG8, -- tbc=\E3, tsl=\Eg\Ef, use=adm+sgr, --qvt119+-25|qvt119p-25|QVT 119 PLUS with 25 data lines, -- lines#25, use=qvt119+, --qvt119+-w|qvt119p-w|qvt119-w|QVT 119 and 119 PLUS in 132 column mode, -- cols#132, -- is2=\EDF\EC\EG0\Er\E(\E%\EX\En4, use=qvt119+, --qvt119+-25-w|qvt119p-25-w|qvt119-25-w|QVT 119 and 119 PLUS 132 by 25, -- lines#25, use=qvt119+, --qvt203|qvt203+|qume qvt 203 Plus, -- dch1=\E[P$<7>, dl1=\E[M$<99>, il1=\E[L$<99>, ind=\n$<30>, -- ip=$<7>, kf0=\E[29~, kf1=\E[17~, kf2=\E[18~, kf3=\E[19~, -- kf4=\E[20~, kf5=\E[21~, kf6=\E[23~, kf7=\E[24~, kf8=\E[25~, -- kf9=\E[28~, rmir=\E[4l, smir=\E[4h, use=qvt103, --qvt203-w|qvt203-w-am|qume qvt 203 PLUS in 132 cols (w/advanced video), -- cols#132, lines#24, -- rs2=\E>\E[?3h\E[?4l\E[?5l\E[?8h, use=qvt203, --# --# Since a command is present for enabling 25 data lines, --# a specific terminfo entry may be generated for the 203. --# If one is desired for the QVT 119 PLUS then 25 lines must --# be selected in the status line (setup line 9). -+#### Sun consoles - # --qvt203-25|QVT 203 PLUS with 25 by 80 column mode, -- cols#80, lines#25, -- is2=\E[=40h\E[?3l, use=qvt203, --qvt203-25-w|QVT 203 PLUS with 25 by 132 columns, -- cols#132, lines#25, -- rs2=\E[?3h\E[=40h, use=qvt203, - --#### Televideo (tvi) -+# :is1: resets scrolling region in case a previous user had used "tset vt100" -+oldsun|Sun Microsystems Workstation console, -+ OTbs, am, km, mir, msgr, -+ cols#80, it#8, lines#34, -+ bel=^G, clear=^L, cr=^M, cub1=^H, cud1=\E[B, cuf1=\E[C, -+ cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, dch=\E[%p1%dP, -+ dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[K, ht=^I, -+ ich=\E[%p1%d@, ich1=\E[@, il=\E[%p1%dL, il1=\E[L, ind=^J, -+ is1=\E[1r, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, -+ kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, khome=\E[H, -+ rmso=\E[m, sgr0=\E[m, smso=\E[7m, -+# From: Alexander Lukyanov <lav@video.yars.free.net>, 14 Nov 1995 -+# <lines> capability later corrected by J.T. Conklin <jtc@cygnus.com> -+# SGR 1, 4 aren't supported - removed bold/underline (T.Dickey 17 Jan 1998) -+sun-il|Sun Microsystems console with working insert-line, -+ am, km, msgr, -+ cols#80, lines#34, -+ bel=^G, clear=^L, cr=^M, cub1=^H, cud1=^J, cuf1=\E[C, -+ cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, dch=\E[%p1%dP, -+ dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[K, ht=^I, -+ ich=\E[%p1%d@, ich1=\E[@, il=\E[%p1%dL, il1=\E[L, ind=^J, -+ kb2=\E[218z, kbs=^H, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, -+ kcuu1=\E[A, kdch1=\177, kend=\E[220z, kf1=\E[224z, -+ kf10=\E[233z, kf11=\E[234z, kf12=\E[235z, kf2=\E[225z, -+ kf3=\E[226z, kf4=\E[227z, kf5=\E[228z, kf6=\E[229z, -+ kf7=\E[230z, kf8=\E[231z, kf9=\E[232z, khome=\E[214z, -+ kich1=\E[247z, knp=\E[222z, kopt=\E[194z, kpp=\E[216z, -+ kres=\E[193z, kund=\E[195z, rev=\E[7m, rmso=\E[m, rmul@, -+ rs2=\E[s, sgr=\E[0%?%p1%p3%|%t;7%;m, sgr0=\E[m, -+ smso=\E[7m, u8=\E[1t, u9=\E[11t, -+# On some versions of CGSIX framebuffer firmware (SparcStation 5), <il1>/<il> -+# flake out on the last line. Unfortunately, without them the terminal has no -+# way to scroll. -+sun-cgsix|sun-ss5|Sun SparcStation 5 console, -+ il@, il1@, use=sun-il, -+# If you are using an SS5, change the sun definition to use sun-ss5. -+sun|sun1|sun2|Sun Microsystems Inc. workstation console, -+ use=sun-il, -+ -+sun+sl|Sun Workstation window status line, -+ hs, -+ dsl=\E]l\E\\, fsl=\E\\, tsl=\E]l, -+ -+# From: <john@ucbrenoir> Tue Sep 24 13:14:44 1985 -+sun-s|Sun Microsystems Workstation window with status line, -+ hs, -+ dsl=\E]l\E\\, fsl=\E\\, tsl=\E]l, use=sun, -+sun-e-s|sun-s-e|Sun Microsystems Workstation with status hacked for emacs, -+ hs, -+ dsl=\E]l\E\\, fsl=\E\\, tsl=\E]l, use=sun-e, -+sun-48|Sun 48-line window, -+ cols#80, lines#48, use=sun, -+sun-34|Sun 34-line window, -+ cols#80, lines#34, use=sun, -+sun-24|Sun 24-line window, -+ cols#80, lines#24, use=sun, -+sun-17|Sun 17-line window, -+ cols#80, lines#17, use=sun, -+sun-12|Sun 12-line window, -+ cols#80, lines#12, use=sun, -+sun-1|Sun 1-line window for sysline, -+ eslok, hs, -+ cols#80, lines#1, -+ dsl=^L, fsl=\E[K, tsl=^M, use=sun, -+sun-e|sun-nic|sune|Sun Microsystems Workstation without insert character, -+ ich1@, rmir@, smir@, use=sun, -+sun-c|sun-cmd|Sun Microsystems Workstation console with scrollable history, -+ lines#35, -+ rmcup=\E[>4h, smcup=\E[>4l, use=sun, -+sun-type4|Sun Workstation console with type 4 keyboard, -+ kcub1=\E[217z, kcud1=\E[221z, kcuf1=\E[219z, -+ kcuu1=\E[215z, use=sun-il, -+ -+# Most of the current references to sun-color are from users wondering why this -+# is the default on install. Details from reading the wscons manpage, adding -+# cub, etc., here (rather than in the base sun-il entry) since it is not clear -+# when those were added -TD (2005-05-28) - # --# TeleVideo --# 550 East Brokaw Road --# PO Box 49048 95161 --# San Jose CA 95112 --# Vox: (408)-954-8333 --# Fax: (408)-954-0623 -+# According to wscons manpage, color is supported only on IA systems. -+# Sun's terminfo entry documents bold and smul/rmul capabilities, but wscons -+# does not list these. It also sets ncv#3, however that corresponds to -+# underline and standout. - # -+# Since the documentation and terminfo do not agree, see also current code at -+# http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/uts/common/io/tem_safe.c - # --# These require incredible amounts of padding. -+# That (actually a different driver which "supports" sun-color) also supports -+# these features: -+# vpa=\E[%i%p1%dd -+# hpa=\E[%i%p1%d` -+# cbt=\E[Z -+# dim=\E[2m -+# blink=\E[5m -+# It supports bold, but not underline -TD (2009-09-19) -+sun-color|Sun Microsystems Workstation console with color support (IA systems), -+ colors#8, ncv#3, pairs#64, -+ bold=\E[1m, cub=\E[%p1%dD, cud=\E[%p1%dB, cuf=\E[%p1%dC, -+ cuu=\E[%p1%dA, home=\E[H, op=\E[0m, rs2=\E[s, -+ setab=\E[4%p1%dm, setaf=\E[3%p1%dm, -+ setb=\E[4%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m, -+ setf=\E[3%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m, -+ sgr=\E[0%?%p6%t;1%;%?%p1%p3%|%t;7%;m, sgr0=\E[m, -+ smso=\E[7m, use=sun, -+ -+#### Iris consoles - # --# All of these terminals (912 to 970 and the tvipt) are discontinued. Newer --# Televideo terminals are ANSI and PC-ANSI compatible. - --tvi803|televideo 803, -- clear=\E*$<10>, use=tvi950, -+# (wsiris: this had extension capabilities -+# :HS=\E7F2:HE=\E7F7:\ -+# :CT#2:CZ=*Bblack,red,green,yellow,blue,magenta,cyan,*Fwhite: -+# See the note on Iris extensions near the end of this file. -+# Finally, removed suboptimal <clear>=\EH\EJ and added <cud1> & -+# <flash> from BRL -- esr) -+wsiris|iris40|iris emulating a 40 line visual 50 (approximately), -+ OTbs, OTnc, OTpt, am, -+ OTkn#3, cols#80, it#8, lines#40, -+ OTnl=\EB, bel=^G, clear=\Ev, cnorm=\E>, cub1=^H, cud1=\EB, -+ cuf1=\EC, cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, -+ cvvis=\E;, dim=\E7F2, dl1=\EM, ed=\EJ, el=\EK, -+ flash=\E7F4\E7B1\013\E7F7\E7B0, home=\EH, ht=^I, il1=\EL, -+ ind=^J, is2=\E7B0\E7F7\E7C2\E7R3, kcub1=\ED, kcud1=\EB, -+ kcuf1=\EC, kcuu1=\EA, kf0=\E0, kf1=\E1, kf2=\E2, kf3=\E3, -+ kf4=\E4, kf5=\E5, kf6=\E6, kf7=\E7, kf8=\E8, kf9=\E9, ri=\EI, -+ rmso=\E0@, rmul=\E7R3\E0@, sgr0=\E7F7, smso=\E9P, -+ smul=\E7R2\E9P, - --# Vanilla tvi910 -- W. Gish <cswarren@violet> 10/29/86 --# Switch settings are: --# --# S1 1 2 3 4 --# D D D D 9600 --# D D D U 50 --# D D U D 75 --# D D U U 110 --# D U D D 135 --# D U D U 150 --# D U U D 300 --# D U U U 600 --# U D D D 1200 --# U D D U 1800 --# U D U D 2400 --# U D U U 3600 --# U U D D 4800 --# U U D U 7200 --# U U U D 9600 --# U U U U 19200 -+#### NeWS consoles - # --# S1 5 6 7 8 --# U D X D 7N1 (data bits, parity, stop bits) (X means ignored) --# U D X U 7N2 --# U U D D 7O1 --# U U D U 7O2 --# U U U D 7E1 --# U U U U 7E2 --# D D X D 8N1 --# D D X U 8N2 --# D U D D 8O1 --# D U U U 8E2 -+# Console terminal windows under the NeWS (Sun's Display Postscript windowing -+# environment). Note: these have nothing to do with Sony's News workstation -+# line. - # --# S1 9 Autowrap --# U on --# D off -+ -+# Entry for NeWS's psterm from Eric Messick & Hugh Daniel -+# (psterm: unknown ":sl=\EOl:el=\ENl:" removed -- esr) -+psterm|psterm-basic|NeWS psterm-80x34, -+ OTbs, am, hs, km, ul, -+ cols#80, it#8, lines#34, -+ blink=\EOb, bold=\EOd, clear=^L, csr=\EE%p1%d;%p2%d;, -+ cub1=\ET, cud1=\EP, cuf1=\EV, cup=\E%p1%d;%p2%d;, cuu1=\EY, -+ dch1=\EF, dl1=\EK, ed=\EB, el=\EC, flash=\EZ, fsl=\ENl, -+ home=\ER, ht=^I, il1=\EA, ind=\EW, is1=\EN*, kcub1=\E[D, -+ kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, ll=\EU, rc=^\, rev=\EOr, -+ ri=\EX, rmcup=\ENt, rmir=\ENi, rmso=\ENo, rmul=\ENu, sc=^], -+ sgr0=\EN*, smcup=\EOt, smir=\EOi, smso=\EOo, smul=\EOu, -+ tsl=\EOl, -+psterm-96x48|NeWS psterm 96x48, -+ cols#96, lines#48, use=psterm, -+psterm-90x28|NeWS psterm 90x28, -+ cols#90, lines#28, use=psterm, -+psterm-80x24|NeWS psterm 80x24, -+ cols#80, lines#24, use=psterm, -+# This is a faster termcap for psterm. Warning: if you use this termcap, -+# some control characters you type will do strange things to the screen. -+# (psterm-fast: unknown ":sl=^Ol:el=^Nl:" -- esr) -+psterm-fast|NeWS psterm fast version (flaky ctrl chars), -+ OTbs, am, hs, km, ul, -+ cols#80, it#8, lines#34, -+ blink=^Ob, bold=^Od, clear=^L, csr=\005%p1%d;%p2%d;, -+ cub1=^T, cud1=^P, cuf1=^V, cup=\004%p1%d;%p2%d;, cuu1=^Y, -+ dch1=^F, dl1=^K, ed=^B, el=^C, flash=^Z, fsl=^Nl, home=^R, ht=^I, -+ il1=^A, ind=^W, is1=^N*, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, -+ kcuu1=\E[A, ll=^U, rc=^\, rev=^Or, ri=^X, rmcup=^Nt, rmir=^Ni, -+ rmso=^No, rmul=^Nu, sc=^], sgr0=^N*, smcup=^Ot, smir=^Oi, -+ smso=^Oo, smul=^Ou, tsl=^Ol, -+ -+#### NeXT consoles - # --# S1 10 CR/LF --# U do CR/LF when CR received --# D do CR when CR received -+# Use `glasstty' for the Workspace application - # --# S2 1 Mode --# U block --# D conversational -+ -+# From: Dave Wetzel <dave@turbocat.snafu.de> 22 Dec 1995 -+next|NeXT console, -+ am, xt, -+ cols#80, it#8, lines#24, -+ bel=^G, clear=^L, cr=^M, cub1=^H, cud1=^J, cuf1=\E[C, -+ cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, el=\E[K, home=\E[H, -+ ht=^I, ind=^J, kbs=^H, kcub1=^H, kcud1=^J, nel=^M^J, -+ rmso=\E[4;1m, sgr0=\E[m, smso=\E[4;2m, -+nextshell|NeXT Shell application, -+ am, -+ cols#80, -+ bel=^G, cr=^M, cub1=^H, cud1=^J, ht=^I, kbs=^H, kcub1=^H, -+ kcud1=^J, nel=^M^J, -+ -+#### Sony NEWS workstations - # --# S2 2 Duplex --# U half --# D full -+ -+# (news-unk: this had :KB=news: -- esr) -+news-unk|SONY NEWS vt100 emulator common entry, -+ OTbs, OTpt, am, xenl, -+ cols#80, -+ OTnl=^J, bel=^G, blink=\E[5m, bold=\E[1m, clear=\E[H\E[2J, -+ cr=^M, csr=\E[%i%p1%d;%p2%dr, cub1=^H, cud1=^J, cuf1=\E[C, -+ cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, dl=\E[%p1%dM, dl1=\E[M, -+ ed=\E[J, el=\E[K, home=\E[H, ht=^I, -+ if=/usr/share/tabset/vt100, il=\E[%p1%dL, il1=\E[L, -+ is2=\E[?7h\E[?1h\E[?3l\E7\E8, kbs=^H, kcub1=\EOD, -+ kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kf0=\EOY, kf1=\EOP, -+ kf2=\EOQ, kf3=\EOR, kf4=\EOS, kf5=\EOT, kf6=\EOU, kf7=\EOV, -+ kf8=\EOW, kf9=\EOX, rc=\E8, rev=\E[7m, ri=\EM, -+ rmkx=\E[?1l\E>, rmso=\E[m, rmul=\E[m, -+ rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h\E[r, sc=\E7, -+ sgr0=\E[m, smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, - # --# S2 3 Hertz --# U 50 --# D 60 -+# (news-29: this had :TY=ascii: --esr) -+news-29, -+ lines#29, use=news-unk, -+# (news-29-euc: this had :TY=euc: --esr) -+news-29-euc, -+ use=news-29, -+# (news-29-sjis: this had :TY=sjis: --esr) -+news-29-sjis, -+ use=news-29, - # --# S2 4 Edit mode --# U local --# D duplex -+# (news-33: this had :TY=ascii: --esr) -+news-33, -+ lines#33, use=news-unk, -+# (news-33-euc: this had :TY=euc: --esr) -+news-33-euc, -+ use=news-33, -+# (news-33-sjis: this had :TY=sjis: --esr) -+news-33-sjis, -+ use=news-33, - # --# S2 5 Cursor type --# U underline --# D block -+# (news-42: this had :TY=ascii: --esr) -+news-42, -+ lines#42, use=news-unk, -+# (news-42-euc: this had :TY=euc: --esr) -+news-42-euc, -+ use=news-42, -+# (news-42-sjis: this had :TY=sjis: --esr) -+news-42-sjis, -+ use=news-42, - # --# S2 6 Cursor down key --# U send ^J --# D send ^V -+# NEWS-OS old termcap entry - # --# S2 7 Screen colour --# U green on black --# D black on green -+# (news-old-unk: this had :KB=news:TY=sjis: --esr) -+news-old-unk|SONY NEWS vt100 emulator common entry, -+ OTbs, OTpt, am, xenl, -+ cols#80, vt#3, -+ OTnl=^J, bel=^G, blink=\E[5m, bold=\E[1m, clear=\E[;H\E[2J, -+ cr=^M, csr=\E[%i%p1%d;%p2%dr, cub1=^H, cud1=^J, cuf1=\E[C, -+ cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, ed=\E[J, el=\E[K, -+ home=\E[H, ht=^I, if=/usr/share/tabset/vt100, kbs=^H, -+ kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kf1=\EOP, -+ kf2=\EOQ, kf3=\EOR, kf4=\EOS, rc=\E8, rev=\E[7m, ri=\EM, -+ rmkx=\E[?1l\E>, rmso=\E[m, rmul=\E[m, -+ rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sc=\E7, -+ sgr0=\E[m, smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, - # --# S2 8 DSR status (pin 6) --# U disconnected --# D connected -+# (nwp512: this had :DE=^H:, which I think means <OTbs> --esr) -+nwp512|news|nwp514|news40|vt100-bm|old sony vt100 emulator 40 lines, -+ OTbs, -+ lines#40, -+ is2=\E7\E[r\E8\EE\EE\EE\EM\EM\EM\E[?7h\E[?1l\E[?3l\E7\E[1;40r\E8, -+ use=news-old-unk, - # --# S2 9 DCD status (pin 8) --# U disconnected --# D duplex -+# (nwp512-a: this had :TY=ascii: and the alias vt100-bm --esr) -+nwp512-a|nwp514-a|news-a|news42|news40-a|sony vt100 emulator 42 line, -+ lines#42, -+ is2=\E[?7h\E[?1l\E[?3l\E7\E[1;42r\E8, -+ use=news-old-unk, - # --# S2 10 DTR status (pin 20) --# U disconnected --# D duplex --# (tvi910: removed obsolete ":ma=^Kk^Ll^R^L:"; added <khome>, <cub1>, <cud1>, --# <ind>, <hpa>, <vpa>, <am>, <msgr> from SCO entry -- esr) --tvi910|televideo model 910, -- OTbs, am, msgr, -- cols#80, it#8, lines#24, xmc#1, -- bel=^G, cbt=\EI, clear=^Z, cr=^M, cub1=^H, cud1=^J, cuf1=^L, -- cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, ed=\EY, el=\ET, -- home=\E=\001\001, hpa=\E]%p1%{32}%+%c, ht=^I, -- if=/usr/share/tabset/stdcrt, ind=^J, invis@, kbs=^H, -- kcub1=^H, kcud1=^J, kcuf1=^L, kcuu1=^K, kf0=^AI\r, kf1=^A@\r, -- kf2=^AA\r, kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, kf6=^AE\r, -- kf7=^AF\r, kf8=^AG\r, kf9=^AH\r, khome=^^, -- vpa=\E[%p1%{32}%+%c, use=adm+sgr, --# From: Alan R. Rogers <rogers%albany@csnet-relay> --# as subsequently hacked over by someone at SCO --# (tvi910+: removed obsolete ":ma=^K^P^L :" -- esr) -+# (nwp-512-o: this had :KB=nwp410:DE=^H: I interpret the latter as <OTbs>. --esr) -+nwp512-o|nwp514-o|news-o|news40-o|vt100-bm-o|sony vt100 emulator 40 lines, -+ OTbs, -+ lines#40, -+ is2=\E7\E[r\E8\EE\EE\EE\EM\EM\EM\E[?7h\E[?1l\E[?3l\E7\E[1;40r\E8, -+ use=news-old-unk, - # --# Here are the 910+'s DIP switches (U = up, D = down, X = don't care): -+# (nwp513: this had :DE=^H: and the alias vt100-bm --esr) -+nwp513|nwp518|nwe501|newscbm|news31|sony vt100 emulator 33 lines, -+ OTbs, -+ lines#31, -+ is2=\E7\E[r\E8\EE\EE\EE\EM\EM\EM\E[?7h\E[?1l\E[?3l\E7\E[1;31r\E8, -+ use=news-old-unk, - # --# S1 1 2 3 4: --# D D D D 9600 D D D U 50 D D U D 75 D D U U 110 --# D U D D 135 D U D U 150 D U U D 300 D U U U 600 --# U D D D 1200 U D D U 1800 U D U D 2400 U D U U 3600 --# U U D D 4800 U U D U 7200 U U U D 9600 U U U U 19200 -+# (nwp513-a: this had :TY=ascii: and :DE=^H:, which I interpret as <OTbs>; --esr) -+# also the alias vt100-bm. -+nwp513-a|nwp518-a|nwe501-a|nwp251-a|newscbm-a|news31-a|newscbm33|news33|old sony vt100 emulator 33 lines, -+ OTbs, -+ lines#33, -+ is2=\E7\E[r\E8\EE\EE\EE\EM\EM\EM\E[?7h\E[?1l\E[?3l\E7\E[1;33r\E8, -+ use=news-old-unk, - # --# S1 5 6 7 8: --# U D X D 7N1 U D X U 7N2 U U D D 7O1 U U D U 7O2 --# U U U D 7E1 U U U U 7E2 D D X D 8N1 D D X U 8N2 --# D U D D 8O1 D U U U 8E2 -+# (nwp513-o: had :DE=^H:, I think that's <OTbs>; also the alias vt100-bm --esr) -+nwp513-o|nwp518-o|nwe501-o|nwp251-o|newscbm-o|news31-o|old sony vt100 emulator 33 lines, -+ OTbs, -+ lines#31, -+ is2=\E7\E[r\E8\EE\EE\EE\EM\EM\EM\E[?7h\E[?1l\E[?3l\E7\E[1;31r\E8, -+ use=news-old-unk, - # --# S1 9 Autowrap (U = on, D = off) --# S1 10 CR/LF (U = CR/LF on CR received, D = CR on CR received) --# S2 1 Mode (U = block, D = conversational) --# S2 2 Duplex (U = half, D = full) --# S2 3 Hertz (U = 50, D = 60) --# S2 4 Edit mode (U = local, D = duplex) --# S2 5 Cursor type (U = underline, D = block) --# S2 6 Cursor down key (U = send ^J, D = send ^V) --# S2 7 Screen colour (U = green on black, D = black on green) --# S2 8 DSR status (pin 6) (U = disconnected, D = connected) --# S2 9 DCD status (pin 8) (U = disconnected, D = connected) --# S2 10 DTR status (pin 20) (U = disconnected, D = connected) -+# (news28: this had :DE=^H:, I think that's <OTbs>, and :KB=nws1200: --esr) -+news28|sony vt100 emulator 28 lines, -+ OTbs, -+ lines#28, -+ is2=\E7\E[r\E8\EE\EE\EE\EM\EM\EM\E[?7h\E[?1l\E[?3l\E7\E[1;28r\E8, -+ use=news-old-unk, - # --tvi910+|televideo 910+, -- dch1=\EW, dl1=\ER$<33*>, home=^^, ich1=\EQ, il1=\EE$<33*>, -- kf0=^A@\r, kf1=^AA\r, kf2=^AB\r, kf3=^AC\r, kf4=^AD\r, -- kf5=^AE\r, kf6=^AF\r, kf7=^AG\r, kf8=^AH\r, kf9=^AI\r, -- ll=\E=7\s, use=tvi910, -- --# (tvi912: removed obsolete ":ma=^K^P^L :", added <flash> and --# <khome> from BRL entry -- esr) --tvi912|tvi914|tvi920|old televideo 912/914/920, -- OTbs, OTpt, am, msgr, -- cols#80, it#8, lines#24, xmc#1, -- bel=^G, clear=^Z, cr=^M, cub1=^H, cud1=^J, cuf1=^L, -- cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW, -- dl1=\ER$<33*>, ed=\Ey, el=\ET, flash=\Eb$<50/>\Ed, home=^^, -- ht=^I, hts=\E1, ich1=\EQ, if=/usr/share/tabset/stdcrt, -- il1=\EE$<33*>, ind=^J, kbs=^H, kcub1=^H, kcud1=^J, kcuf1=^L, -- kcuu1=^K, kf0=^AI\r, kf1=^A@\r, kf2=^AA\r, kf3=^AB\r, -- kf4=^AC\r, kf5=^AD\r, kf6=^AE\r, kf7=^AF\r, kf8=^AG\r, -- kf9=^AH\r, khome=^^, rmso=\Ek, rmul=\Em, smso=\Ej, smul=\El, -- tbc=\E3, --# We got some new tvi912c terminals that act really weird on the regular --# termcap, so one of our gurus worked this up. Seems that cursor --# addressing is broken. --tvi912cc|tvi912 at cowell college, -- cup@, use=tvi912c, -- --# tvi{912,920}[bc] - TeleVideo TVI-912B/TVI-920B and TVI-912C/TVI-920C --# From: Benjamin C. W. Sittler --# --# Someone has put a scanned copy of the manual online at: --# http://vt100.net/televideo/912b-om/ --# --# These terminals were produced ca. 1979, and had a 12" monochrome --# screen, supported 75-9600 baud (no handshaking), monochrome, 7-bit --# ASCII, and were generally similar to adm3a but with attributes --# (including some with magic cookies), fancy half-duplex mode, and --# different bugs. --# --# Some operations reqire truly incredible amounts of padding. The --# insert_line (<il1>) and delete_line (<dl1>) operations in particular --# are so slow as to be nearly unusable. -+# (news29: this had :TY=ascii:KB=nws1200:\ --esr) -+news29|news28-a|sony vt100 emulator 29 lines, -+ lines#29, -+ is2=\E7\E[r\E8\EE\EE\EE\EM\EM\EM\E[?7h\E[?1l\E[?3l\E7\E[1;29r\E8, -+ use=news-old-unk, - # --# There may or may not have been a separate, earlier series of 912/920 --# terminals (without the "B" and "C" suffix); I have never seen one, --# and the manual only describes the "B" and "C" series. The 912 and 920 --# are quite distinct from the 914 and 924, which were much nicer non- --# magic-cookie terminals similar to the 950. -+# (news511: this had :TY=sjis: --esr) -+nwp511|nwp-511|nwp-511 vt100, -+ OTbs, OTpt, am, xenl, -+ cols#80, lines#24, -+ clear=\E[;H\E[2J$<20/>, cub1=\E[D, cud1=\E[B, cuf1=\E[C, -+ cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A$<2/>, dl1=\E[M, -+ ed=\E[J$<30/>, el=\E[K$<3/>, -+ flash=\E[?5h\0\0\0\0\0\0\0\0\0\0\0\0\0\E[?5l, -+ il1=\E[L, is2=\E[?5l\E[?1l\E>\E[?7h\E[?8h, kcub1=\E[D, -+ kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kf1=\EOP, kf2=\EOQ, -+ kf3=\EOR, kf4=\EOS, kf5=\EOT, kf6=\E#W, khome=\E[H, -+ ri=\EM$<5/>, rmso=\E[m$<2/>, rmul=\E[m$<2/>, -+ rs2=\E7\E[r\E8\E[?5l\E[?1l\E>\E[?7h\E[?8h, -+ smso=\E[7m$<2/>, smul=\E[4m$<2/>, -+# (news517: this had :TY=sjis:. --esr) -+nwp517|nwp-517|nwp-517 vt200 80 cols 30 rows, -+ eslok, hs, -+ cols#80, lines#30, -+ OTi2=\E[2$~\n, dsl=\E[1$~, fsl=\E[0$}, -+ is2=\E7\E[r\E8\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, -+ tsl=\E[1$}\E[;%df, use=vt200, -+# (news517-w: this had :TY=sjis:. --esr) -+nwp517-w|nwp-517-w|nwp-517 vt200 132 cols 50 rows, -+ eslok, hs, -+ cols#132, lines#50, -+ OTi2=\E[2$~\n, dsl=\E[1$~, fsl=\E[0$}, -+ is2=\E7\E[r\E8\E>\E[?3h\E[?4l\E[?5l\E[?7h\E[?8h, -+ rs2=\E>\E[?3h\E[?4l\E[?5l\E[?7h\E[?8h, -+ tsl=\E[1$}\E[;%df, use=vt200, -+ -+#### Common Desktop Environment - # --# This is a new description for the following TeleVideo terminals, --# distinguished chiefly by their keyboards: -+ -+# This ships with Sun's CDE in Solaris 2.5 -+# Corrected Sun Aug 9 1998 by Alexander V. Lukyanov <lav@video.yars.free.net> -+dtterm|CDE desktop terminal, -+ am, mir, msgr, xenl, xon, -+ cols#80, it#8, lines#24, lm#0, ncv@, -+ acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -+ bel=^G, blink=\E[5m, bold=\E[1m, civis=\E[?25l, -+ clear=\E[H\E[J, cnorm=\E[?25h, cr=^M, -+ csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, -+ cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, -+ cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, -+ dch=\E[%p1%dP, dch1=\E[P, dim=\E[2m, dl=\E[%p1%dM, -+ dl1=\E[M, ech=\E[%p1%dX, ed=\E[J, el=\E[K, el1=\E[1K, -+ enacs=\E(B\E)0, flash=\E[?5h$<200>\E[?5l, home=\E[H, -+ ht=^I, hts=\EH, ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[L, -+ ind=\ED, invis=\E[8m, is2=\E F\E>\E[?1l\E[?7h\E[?45l, -+ kbs=^H, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, -+ kdch1=\E[3~, kf1=\E[11~, kf10=\E[21~, kf11=\E[23~, -+ kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, kf15=\E[28~, -+ kf16=\E[29~, kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, -+ kf2=\E[12~, kf20=\E[34~, kf3=\E[13~, kf4=\E[14~, -+ kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, -+ kfnd=\E[1~, khlp=\E[28~, kich1=\E[2~, knp=\E[6~, kpp=\E[5~, -+ kslt=\E[4~, nel=\EE, rc=\E8, rev=\E[7m, ri=\EM, rmacs=^O, -+ rmam=\E[?7l, rmir=\E[4l, rmso=\E[22;27m, rmul=\E[24m, -+ sc=\E7, -+ sgr=\E[0%?%p1%t;2;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p5%t;2%;%?%p6%t;1%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, -+ sgr0=\E[m\017, smacs=^N, smam=\E[?7h, smir=\E[4h, -+ smso=\E[2;7m, smul=\E[4m, tbc=\E[3g, use=ecma+color, -+ -+######## Non-Unix Consoles - # --# TVI-912B - very odd layout, no function keys (84 keys) --# TVI-920B - typewriter layout, no function keys (103 keys) --# TVI-912C - very odd layout, function keys F1-F11 (82 keys) --# TVI-920C - typewriter layout, function keys F1-F11 (101 keys) -+ -+#### EMX termcap.dat compatibility modes - # --# To choose a setting for the TERM variable, start with the model: -+# Also (possibly only EMX, so we don't put it in ansi.sys, etc): set the -+# no_color_video to inform the application that standout(1), underline(2) -+# reverse(4) and invisible(64) don't work with color. -+emx-base|DOS special keys, -+ bce, bw, -+ it#8, ncv#71, -+ bel=^G, use=ansi.sys, -+ -+# Except for the "-emx" suffixes, these are as distributed with EMX 0.9b, -+# a Unix-style environment used on OS/2. (Note that the suffix makes some -+# names longer than 14 characters, the nominal maximum). - # --# Model || base name --# ----------||----------- --# TVI-912B || tvi912b --# TVI-912C || tvi912c --# TVI-920B || tvi920b --# TVI-920C || tvi920c -+# Removed: rmacs=\E[10m, smacs=\E[11m, because OS/2 does not implement acs. -+ansi-emx|ANSI.SYS color, -+ am, bce, eo, mir, msgr, xon, -+ colors#8, cols#80, it#8, lines#25, pairs#64, -+ bel=^G, blink=\E[5m, bold=\E[1m, civis=\E[?25l, -+ clear=\E[1;33;44m\E[H\E[J, cnorm=\E[?25h, cr=^M, cub1=^H, -+ cud1=^J, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, -+ dch=\E[%p1%dp, ed=\E[J, el=\E[K, flash=\E[?5h\E[?5l, -+ home=\E[H, ht=^I, hts=\EH, ich=\E[%p1%d@, ich1=\E[@, ind=^J, -+ kb2=\E[G, kbs=^H, kf0=\0D, kll=\0O, kspd=^Z, nel=^M^J, -+ rev=\E[5;37;41m, rmir=\E[4l, rmpch=\E[10m, -+ rmso=\E[0;44m\E[1;33m, rmul=\E[0;44m\E[1;33m, rs1=\Ec, -+ setab=\E[4%p1%dm, setaf=\E[3%p1%dm, -+ sgr0=\E[0m\E[1;33;44m, smir=\E[4h, smpch=\E[11m, -+ smso=\E[0;31;47m, smul=\E[1;31;44m, tbc=\E[3g, u8=\E[?6c, -+ u9=\E[c, use=emx-base, -+# nice colors for Emacs (white on blue, mode line white on cyan) -+ansi-color-2-emx|ANSI.SYS color 2, -+ clear=\E[0;37;44m\E[H\E[J, rev=\E[1;37;46m, -+ rmso=\E[0;37;44m, rmul=\E[0;37;44m, rs1=\Ec, -+ setaf=\E[3%p1%dm, sgr0=\E[0;37;44m, smso=\E[1;37;46m, -+ smul=\E[1;36;44m, use=ansi-emx, -+# nice colors for Emacs (white on black, mode line black on cyan) -+ansi-color-3-emx|ANSI.SYS color 3, -+ clear=\E[0;37;40m\E[H\E[J, rev=\E[1;37;46m, -+ rmso=\E[0;37;40m, rmul=\E[0;37;40m, rs1=\Ec, -+ setaf=\E[3%p1%dm, sgr0=\E[0;10m, smso=\E[1;37;46m, -+ smul=\E[0;36;40m, use=ansi-emx, -+mono-emx|stupid monochrome ansi terminal with only one kind of emphasis, -+ am, -+ cols#80, it#8, lines#24, -+ clear=\E[H\E[2J$<50>, cub1=\E[D, cud1=\E[B, cuf1=\E[C, -+ cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, el=\E[K, home=\E[H, -+ ht=^I, kb2=\E[G, kbs=^H, kcub1=\0K, kcud1=\0P, kcuf1=\0M, -+ kcuu1=\0H, kf0=\0D, kf1=\0;, kf2=\0<, kf3=\0=, kf4=\0>, -+ kf5=\0?, kf6=\0@, kf7=\0A, kf8=\0B, kf9=\0C, khome=\0G, -+ kich1=\0R, kll=\0O, knp=\0Q, kpp=\0I, nel=^M^J, rev=\E[7m, -+ sgr0=\E[0m, -+ -+#### Cygwin -+ -+# Use this for cygwin32 (tested with beta 19.1) -+# underline is colored bright magenta -+# shifted kf1-kf12 are kf11-kf22 -+cygwinB19|ansi emulation for cygwin32, -+ kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, -+ kdch1=\E[3~, kend=\E[4~, kf1=\E[[A, kf10=\E[21~, -+ kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, -+ kf15=\E[28~, kf16=\E[29~, kf17=\E[31~, kf18=\E[32~, -+ kf19=\E[33~, kf2=\E[[B, kf20=\E[34~, kf3=\E[[C, kf4=\E[[D, -+ kf5=\E[[E, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, -+ khome=\E[1~, kich1=\E[2~, knp=\E[6~, kpp=\E[5~, rmam@, smam@, -+ use=ansi.sys, -+ -+# Use this for cygwin (tested with version 1.1.0). -+# I've combined pcansi and linux. Some values of course were different and -+# I've indicated which of these were and which I used. -+# Cheers, earnie_boyd@yahoo.com -+# several changes based on running with tack and comparing with older entry -TD -+# more changes from csw: -+# add cbt [backtab] -+# remove eo [erase overstrike with blank] -+# change clear was \E[H\E[J now \E[2J (faster?) -+# remove cols -+# remove lines -+# remove ncv#3 [colors collide with highlights, bitmask] not applicable -+# to MSDOS box? -+# add cub [cursor back param] -+# add cuf [cursor forward param] -+# add cuu [cursor up param] -+# add cud [cursor down param] -+# add hs [has status line] -+# add fsl [return from status line] -+# add tsl [go to status line] -+# add smacs [Start alt charset] (not sure if this works) -+# add rmacs [End alt charset] (ditto) -+# add smcup [enter_ca_mode] (save console; thanks Corinna) -+# add rmcup [exit_ca_mode] (restore console; thanks Corinna) -+# add kb2 [center of keypad] -+# add u8 [user string 8] \E[?6c -+# add el [clear to end of line] \E[K -+# Notes: -+# cnorm [make cursor normal] not implemented -+# flash [flash] not implemented -+# blink [blink] not implemented very usefully in cygwin? \E[5m -+# dim [dim] not implemented very usefully in cygwin? \E[2m -+# cub1 [cursor back 1] typically \E[D, but ^H is faster? -+# kNXT [shifted next key] not implemented -+# kPRV [shifted prev key] not implemented -+# khome [home key] really is \E[1~ NOT \E[H -+# tbc [clear tab stops] not implemented -+# xenl [newline ignnored after 80 cols] messes up last line? Ehud Karni -+# smpch [Start PC charset] is \E[11m, same as smacs -+# rmpch [End PC charset] is \E[10m, same as rmacs -+# mir [move in insert mode] fails in tack? -+# bce [back color erase] causes problems with change background color? -+# cvvis [make cursor very visible] causes a stackdump when testing with -+# testcurs using the output option? \E[?25h\E[?8c -+# civis [make cursor invisible] causes everything to stackdump? \E[?25l\E[?1c -+# ech [erase characters param] broken \E[%p1%dX -+# kcbt [back-tab key] not implemented in cygwin? \E[Z - # --# Then add a suffix from the following table describing installed options --# and how you'd like to use the terminal: -+# 2005/11/12 -TD -+# Remove cbt since it does not work in current cygwin -+# Add 'mir' and 'in' flags based on tack -+cygwin|ansi emulation for Cygwin, -+ am, hs, mir, msgr, xon, -+ colors#8, it#8, pairs#64, -+ acsc=+\020\,\021-\030.^Y0\333`\004a\261f\370g\361h\260j\331k\277l\332m\300n\305o~p\304q\304r\304s_t\303u\264v\301w\302x\263y\363z\362{\343|\330}\234~\376, -+ bel=^G, bold=\E[1m, clear=\E[H\E[J, cr=^M, cub=\E[%p1%dD, -+ cub1=^H, cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, -+ cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, -+ cuu1=\E[A, dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, -+ dl1=\E[M, ed=\E[J, el=\E[K, el1=\E[1K, fsl=^G, home=\E[H, -+ hpa=\E[%i%p1%dG, ht=^I, ich=\E[%p1%d@, ich1=\E[@, -+ il=\E[%p1%dL, il1=\E[L, ind=^J, invis=\E[8m, kb2=\E[G, -+ kbs=^H, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, -+ kdch1=\E[3~, kend=\E[4~, kf1=\E[[A, kf10=\E[21~, -+ kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, -+ kf15=\E[28~, kf16=\E[29~, kf17=\E[31~, kf18=\E[32~, -+ kf19=\E[33~, kf2=\E[[B, kf20=\E[34~, kf3=\E[[C, kf4=\E[[D, -+ kf5=\E[[E, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, -+ khome=\E[1~, kich1=\E[2~, knp=\E[6~, kpp=\E[5~, kspd=^Z, -+ nel=^M^J, op=\E[39;49m, rc=\E8, rev=\E[7m, ri=\EM, -+ rmacs=\E[10m, rmcup=\E[2J\E[?47l\E8, rmir=\E[4l, -+ rmpch=\E[10m, rmso=\E[27m, rmul=\E[24m, rs1=\Ec\E]R, -+ sc=\E7, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, -+ sgr=\E[0;10%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p6%t;1%;%?%p7%t;8%;%?%p9%t;11%;m, -+ sgr0=\E[0;10m, smacs=\E[11m, smcup=\E7\E[?47h, -+ smir=\E[4h, smpch=\E[11m, smso=\E[7m, smul=\E[4m, tsl=\E];, -+ vpa=\E[%i%p1%dd, use=vt102+enq, -+ -+# I've supplied this so that you can help test new values and add other -+# features. Cheers, earnie_boyd@yahoo.com. - # --# Use Video | Second | Visual | Magic | Page || feature --# Attributes | Page | Bell | Cookies | Print || suffix --# ------------|--------|--------|---------|-------||--------- --# No | No | N/A | N/A | No || -unk --# No | No | N/A | N/A | Yes || -p --# No | Yes | No | N/A | No || -2p-unk --# No | Yes | No | N/A | Yes || -2p-p --# No | Yes | Yes | N/A | No || -vb-unk --# No | Yes | Yes | N/A | Yes || -vb-p --# Yes | No | N/A | No | N/A || --# Yes | No | N/A | Yes | N/A || -mc --# Yes | Yes | No | No | N/A || -2p --# Yes | Yes | No | Yes | N/A || -2p-mc --# Yes | Yes | Yes | No | N/A || -vb --# Yes | Yes | Yes | Yes | N/A || -vb-mc --# --# So e.g. a model 920 C with second page memory option, visual bell --# and no magic cookies would be tvi920c-vb; a model 912 B without the --# second page memory option and using magic cookies would be --# tvi912b-mc --# --# PADDING --# --# At 9600 baud, the terminal is prone to overflow its input buffer --# during complex operations (insert/delete --# character/line/screen/page), and it does not signal this over the --# RS232 cable. The typical symptom of an overrun is that the terminal --# starts beeping, and output becomes garbled. --# --# The padding delays in this terminfo were derived using tack(1) --# running on a Linux box connected to a TVI-920C with a later-model --# (A49C1-style) ROM running at 9600 baud, so your mileage may --# vary. The numbers below seem to give the terminal enough time so --# that it doesn't overflow its input buffer and start losing --# characters. --# --# KEYS --# --# If you want to use the FUNCT key on a tvi912[bc], use the --# corresponding tvi920[bc] terminfo with FUNCT + ... equivalents from --# the following table (these also work on the 920 series): --# --# Unshifted Function Keys: --# --# Key | capname|| Equivalent --# -----|--------||------------ --# F1 | <kf1> || FUNCT + @ --# F2 | <kf2> || FUNCT + A --# F3 | <kf3> || FUNCT + B --# F4 | <kf4> || FUNCT + C --# F5 | <kf5> || FUNCT + D --# F6 | <kf6> || FUNCT + E --# F7 | <kf7> || FUNCT + F --# F8 | <kf8> || FUNCT + G --# F9 | <kf9> || FUNCT + H --# F10 | <kf10> || FUNCT + I --# F11 | <kf11> || FUNCT + J --# --# Shifted Function Keys: --# --# SHIFT + Key | capname|| Equivalent --# -------------|--------||------------ --# SHIFT + F1 | <kf12> || FUNCT + ` --# SHIFT + F2 | <kf13> || FUNCT + a --# SHIFT + F3 | <kf14> || FUNCT + b --# SHIFT + F4 | <kf15> || FUNCT + c --# SHIFT + F5 | <kf16> || FUNCT + d --# SHIFT + F6 | <kf17> || FUNCT + e --# SHIFT + F7 | <kf18> || FUNCT + f --# SHIFT + F8 | <kf19> || FUNCT + g --# SHIFT + F9 | <kf20> || FUNCT + h --# SHIFT + F10 | <kf21> || FUNCT + i --# SHIFT + F11 | <kf22> || FUNCT + j --# --# PORTS AND SWITCH SETTINGS --# --# Here are the switch settings for the TVI-912B/TVI-920B and --# TVI-912C/TVI-920C: --# --# S1 (Line), and S3 (Printer) baud rates -- put one, and only one, switch down: --# 2: 9600 3: 4800 4: 2400 5: 1200 --# 6: 600 7: 300 8: 150 9: 75 --# 10: 110 --# --# S2 UART/Terminal options: --# Up Down --# 1: Not used Not allowed --# 2: Alternate character set Standard character set --# 3: Full duplex Half duplex --# 4: 50 Hz refresh 60 Hz refresh --# 5: No parity Send parity --# 6: 2 stop bits 1 stop bit --# 7: 8 data bits 7 data bits --# 8: Not used Not allowed on Rev E or lower --# 9: Even parity Odd parity --# 10: Steady cursor Blinking cursor --# (On Rev E or lower, use W25 instead of switch 10.) --# --# S5 UART/Terminal options: --# Open Closed --# 1: P3-6 Not connected DSR received on P3-6 --# 2: P3-8 Not connected DCD received on P3-8 --# --# 3 Open, 4 Open: P3-20 Not connected --# 3 Open, 4 Closed: DTR on when terminal is on --# 3 Closed, 4 Open: DTR is connected to RTS --# 3 Closed, 4 Closed: Not allowed --# --# 5 Closed: HDX printer (hardware control) Rev. K with extension port off, --# all data transmitted out of the modem port (P3) will also be --# transmitted out of the printer port (P4). --# --# 6 Open, 7 Open: Not allowed --# 6 Open, 7 Closed: 20ma current loop input --# 6 Closed, 7 Open: RS232 input --# 6 Closed, 7 Closed: Not allowed --# --# Jumper options: --# If the jumper is installed, the effect will occur (the next time the terminal --# is switched on). -+# Some features are from pcansi. The op value is from linux. Function-keys -+# are from linux. These have been tested not to cause problems. xenl was in -+# this list, but DOES cause problems so it has been removed -+cygwinDBG|Debug Version for Cygwin, -+ am, eo, mir, msgr, xon, -+ colors#8, cols#80, it#8, lines#24, ncv#3, pairs#64, -+ acsc=+\020\,\021-\030.^Y0\333`\004a\261f\370g\361h\260j\331k\277l\332m\300n\305o~p\304q\304r\304s_t\303u\264v\301w\302x\263y\363z\362{\343|\330}\234~\376, -+ bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, clear=\E[H\E[J, -+ cnorm=\E[?25h, cr=^M, cub=\E[%p1%dD, cub1=\E[D, -+ cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, cuf1=\E[C, -+ cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, -+ dch=\E[%p1%dP, dch1=\E[P, dim=\E[2m, dl=\E[%p1%dM, -+ dl1=\E[M, ed=\E[J, el=\E[K, el1=\E[1K, -+ flash=\E[?5h\E[?5l$<200/>, home=\E[H, hpa=\E[%i%p1%dG, -+ ht=^I, hts=\EH, ich=\E[%p1%d@, ich1=\E[@, il=\E[%p1%dL, -+ il1=\E[L, ind=^J, invis=\E[8m, kNXT=\E[6$, kPRV=\E[5$, -+ kb2=\E[G, kbs=^H, kcbt=\E[Z, kcub1=\E[D, kcud1=\E[B, -+ kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[3~, kend=\E[4~, kf1=\E[[A, -+ kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, -+ kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, kf17=\E[31~, -+ kf18=\E[32~, kf19=\E[33~, kf2=\E[[B, kf20=\E[34~, -+ kf3=\E[[C, kf4=\E[[D, kf5=\E[[E, kf6=\E[17~, kf7=\E[18~, -+ kf8=\E[19~, kf9=\E[20~, khome=\E[1~, kich1=\E[2~, -+ knp=\E[6~, kpp=\E[5~, kspd=^Z, nel=^M^J, op=\E[39;49m, -+ rc=\E8, rev=\E[7m, ri=\EM, rmacs=\E[10m, rmir=\E[4l, -+ rmso=\E[m, rmul=\E[m, rs1=\Ec\E]R, sc=\E7, -+ setab=\E[4%p1%dm, setaf=\E[3%p1%dm, -+ sgr=\E[0;10%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p5%t;2%;%?%p6%t;1%;%?%p7%t;8%;%?%p9%t;12%;m, -+ sgr0=\E[0;10m, smacs=\E[11m, smir=\E[4h, smso=\E[7m, -+ smul=\E[4m, tbc=\E[3g, vpa=\E[%i%p1%dd, use=vt102+enq, -+ -+#### DJGPP -+ -+# Key definitions: -+# The encodings for unshifted arrow keys, F1-F12, Home, Insert, etc. match the -+# encodings used by other x86 environments. All others are invented for DJGPP. -+# Oddly enough, while several combinations of modifiers are tabulated, there is -+# none for shifted cursor keys. - # --# S4/W31: Enables automatic LF upon receipt of CR from --# remote or keyboard. --# S4/W32: Enables transmission of EOT at the end of Send. If not --# installed, a carriage return is sent. --# S4/W33: Disables automatic carriage return in column 80. --# S4/W34: Selects Page Print Mode as initial condition. If not --# installed, Extension Mode is selected. -+# F1 \E[[A -+# F2 \E[[B -+# F3 \E[[C -+# F4 \E[[D -+# F5 \E[[E -+# F6 \E[17~ -+# F7 \E[18~ -+# F8 \E[19~ -+# F9 \E[20~ -+# F10 \E[21~ -+# F11 \E[23~ -+# F12 \E[24~ - # --# NON-STANDARD CAPABILITIES -+# Delete \E[3~ -+# Down Arrow \E[B -+# End \E[4~ -+# Home \E[1~ -+# Insert \E[2~ -+# Left Arrow \E[D -+# Page Down \E[6~ -+# Page Up \E[5~ -+# Right Arrow \E[C -+# Up Arrow \E[A - # --# Sending <u9> or <u7> returns a cursor position report in the format --# YX\r, where Y and X are as in <cup>. This format is described in --# <u8> and <u6>, but it's not clear how one should write an --# appropriate scanf string, since we need to subtract %' ' from the --# character after reading it. The <u9> capability is used by tack(1) --# to synchronize during padding tests, and seems to work for that --# purpose. -+# Shift-F1 \E[25~ -+# Shift-F2 \E[26~ -+# Shift-F3 \E[27~ -+# Shift-F4 \E[28~ -+# Shift-F5 \E[29~ -+# Shift-F6 \E[30~ -+# Shift-F7 \E[31~ -+# Shift-F8 \E[32~ -+# Shift-F9 \E[33~ -+# Shift-F10 \E[34~ -+# Shift-F11 \E[35~ -+# Shift-F12 \E[36~ - # --# This description also includes the obsolete termcap capabilities --# has_hardware_tabs (<OTpt>) and backspaces_with_bs (<OTbs>). -+# Ctrl-F1 \E[47~ -+# Ctrl-F2 \E[48~ -+# Ctrl-F3 \E[49~ -+# Ctrl-F4 \E[50~ -+# Ctrl-F5 \E[51~ -+# Ctrl-F6 \E[52~ -+# Ctrl-F7 \E[53~ -+# Ctrl-F8 \E[54~ -+# Ctrl-F9 \E[55~ -+# Ctrl-F10 \E[56~ -+# Ctrl-F11 \E[57~ -+# Ctrl-F12 \E[58~ - # --# FEATURES NOT YET DESCRIBED IN THIS TERMINFO -+# Ctrl-Delete \E[43~ -+# Ctrl-Down Arrow \E[38~ -+# Ctrl-End \E[44~ -+# Ctrl-Home \E[41~ -+# Ctrl-Insert \E[42~ -+# Ctrl-Left Arrow \E[39~ -+# Ctrl-Page Down \E[46~ -+# Ctrl-Page Up \E[45~ -+# Ctrl-Right Arrow \E[40~ -+# Ctrl-Up Arrow \E[37~ - # --# The FUNCT modifier actually works with every normal key by sending --# ^AX\r, where X is the sequence normally sent by that key. This is a --# sort of meta key not currently describable in terminfo. -+# Alt-F1 \E[59~ -+# Alt-F2 \E[60~ -+# Alt-F3 \E[61~ -+# Alt-F4 \E[62~ -+# Alt-F5 \E[63~ -+# Alt-F6 \E[64~ -+# Alt-F7 \E[65~ -+# Alt-F8 \E[66~ -+# Alt-F9 \E[67~ -+# Alt-F10 \E[68~ -+# Alt-F11 \E[79~ -+# Alt-F12 \E[80~ - # --# There are quite a few other keys (especially on the 920 models,) but --# they are for the most part only useful in block mode. -+# Alt-Delete \E[65~ -+# Alt-Down Arrow \E[60~ -+# Alt-End \E[66~ -+# Alt-Home \E[41~ -+# Alt-Insert \E[64~ -+# Alt-Left Arrow \E[61~ -+# Alt-Page Down \E[68~ -+# Alt-Page Up \E[67~ -+# Alt-Right Arrow \E[62~ -+# Alt-Up Arrow \E[59~ - # --# These terminals have lots of forms manipulation features, mainly --# useful in block mode, including "clear X to nulls" (vs. "clear X to --# spaces"; nulls are sentinels for "send X" operations); "send X" --# operations for uploading all or part of the screen; and block-mode --# editing keys (they don't send escape sequences, but manipulate video --# memory directly). Block mode is used for local editing, and protect --# mode (in conjunction with the "write protect" attribute, --# a.k.a. half-intensity outside of protect mode) is used to control --# which parts of the screen are edited/sent/printed (by <mc0>). --# --# There are at least two major families of ROM, "early" and --# A49B1/A49C1; the major difference seems to be that the latter ROMs --# support a few extra escape sequences for manipulating the off-screen --# memory page, and for sending whole pages back to the host (mainly --# useful in block mode.) The descriptions in this file don't use any --# of those sequences: set cursor position including page (\E-PYX, --# where P is \s for page 0 and ! for page 1 [actually only the LSB of --# P is taken into account, so e.g. 0 and 1 work too,] and Y and X are --# as in <cup>); read cursor position (\E/), which is analogous to <u9> --# and returns PYX\r, where P is \s for page 0 or ! for page 1, and YX --# are as in <cup>, and some "send page" features mainly useful for --# forms manipulation. --# --# The keyboard enable (\E") and disable (\E#) sequences are unused, --# except that a terminal reset (<is2>) enables the keyboard. -+# Also: -+# Alt-A \E[82~ -+# Alt-B \E[82~ -+# Alt-C \E[83~ -+# Alt-D \E[84~ -+# Alt-E \E[85~ -+# Alt-F \E[86~ -+# Alt-G \E[87~ -+# Alt-H \E[88~ -+# Alt-I \E[89~ -+# Alt-J \E[90~ -+# Alt-K \E[91~ -+# Alt-L \E[92~ -+# Alt-M \E[93~ -+# Alt-N \E[94~ -+# Alt-O \E[95~ -+# Alt-P \E[96~ -+# Alt-Q \E[97~ -+# Alt-R \E[98~ -+# Alt-S \E[99~ -+# Alt-T \E[100~ -+# Alt-U \E[101~ -+# Alt-V \E[102~ -+# Alt-W \E[103~ -+# Alt-X \E[104~ -+# Alt-Y \E[105~ -+# Alt-Z \E[106~ -+djgpp|ansi emulation for DJGPP alpha, -+ am, bce, msgr, xhp, xon, xt, -+ colors#8, it#8, pairs#64, -+ acsc=+\020\,\021-\030.^Y0\333`\004a\261f\370g\361h\260j\331k\277l\332m\300n\305o~p\304q\304r\304s_t\303u\264v\301w\302x\263y\363z\362{\343|\330}\234~\376, -+ bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[1v, -+ clear=\E[H\E[J, cnorm=\E[v, cr=^M, cub=\E[%p1%dD, cub1=^H, -+ cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, cuf1=\E[C, -+ cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, -+ cvvis=\E[2v, dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, -+ dl1=\E[M, ech=\E[%p1%dX, ed=\E[J, el=\E[K, el1=\E[1K, -+ home=\E[H, hpa=\E[%i%p1%dG, ht=^I, ich=\E[%p1%d@, -+ ich1=\E[@, il=\E[%p1%dL, il1=\E[L, ind=\E[S, -+ indn=\E[%p1%dS, invis=\E[8m, kbs=^H, kcub1=\E[D, -+ kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[3~, -+ kend=\E[4~, kf1=\E[[A, kf10=\E[21~, kf11=\E[23~, -+ kf12=\E[24~, kf2=\E[[B, kf3=\E[[C, kf4=\E[[D, kf5=\E[[E, -+ kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, -+ khome=\E[1~, kich1=\E[2~, knp=\E[6~, kpp=\E[5~, nel=^M^J, -+ op=\E[37;40m, rev=\E[7m, ri=\E[T, rin=\E[%p1%dT, rmso=\E[m, -+ setab=\E[4%p1%dm, setaf=\E[3%p1%dm, -+ sgr=\E[0%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%e;25%;%?%p6%t;1%;%?%p7%t;8%;m, -+ sgr0=\E[m, smso=\E[7m, smul=\E[4m, vpa=\E[%i%p1%dd, -+ -+djgpp203|Entry for DJGPP 2.03, -+ OTbs, am, -+ cols#80, it#8, lines#25, -+ bel=^G, cr=^M, cub1=^H, cud1=^J, ht=^I, ind=^J, kbs=^H, kcub1=^H, -+ kcud1=^J, nel=^M^J, -+ -+djgpp204|Entry for DJGPP 2.04, -+ OTbs, am, AX, -+ colors#8, cols#80, it#8, lines#25, ncv#3, pairs#64, -+ bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[1v, -+ clear=\E[H\E[2J, cnorm=\E[v, cr=^M, cub=\E[%p1%dD, -+ cub1=\E[D, cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, -+ cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, -+ cuu1=\E[A, cvvis=\E[2v, dch=\E[%p1%dP, dch1=\E[P, -+ dl=\E[%p1%dM, dl1=\E[M, ech=\E[%p1%dX, ed=\E[J, el=\E[K, -+ home=\E[H, ht=^I, ich=\E[%p1%d@, ich1=\E[@, il=\E[%p1%dL, -+ il1=\E[L, ind=\E[S, indn=\E[%p1%dS, invis=\E[8m, kbs=^H, -+ kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, -+ kdch1=\E[3~, kf0=\E[21~, kf1=\E[[A, kf10=\E[21~, kf2=\E[[B, -+ kf3=\E[[C, kf4=\E[[D, kf5=\E[[E, kf6=\E[17~, kf7=\E[18~, -+ kf8=\E[19~, kf9=\E[20~, khome=\E[1~, kich1=\E[2~, -+ kll=\E[4~, knp=\E[6~, kpp=\E[5~, nel=^M^J, rev=\E[7m, -+ ri=\E[T, rin=\E[%p1%dT, rmso=\E[m, setab=\E[4%p1%dm, -+ setaf=\E[3%p1%dm, sgr0=\E[m, smso=\E[7m, smul=\E[4m, -+ -+#### U/Win -+ -+# This is tested using U/Win's telnet. Scrolling is omitted because it is -+# buggy. Another odd bug appears when displaying "~" in alternate character -+# set (the emulator spits out error messages). Compare with att6386 -TD -+uwin|U/Win 3.2 console, -+ am, eo, in, msgr, xenl, xon, -+ colors#8, it#8, ncv#58, pairs#64, -+ acsc=+\020\,\021-\030.^Y0\333`\004a\261f\370g\361h\260i\316j\331k\277l\332m\300n\305o~p\304q\304r\304s_t\303u\264v\301w\302x\263y\363z\362{\343|\330}\234~\376, -+ bel=^G, blink=\E[5m, bold=\E[1m, civis=\E[?25l, -+ clear=\E[H\E[J, cnorm=\E[?25h, cr=^M, cub1=^H, cud1=^J, -+ cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, -+ dch=\E[%p1%dP, dch1=\E[P, dim=\E[2m, ech=\E[%p1%dX, -+ ed=\E[J, el=\E[K, el1=\E[1K, home=\E[H, ht=^I, hts=\EH, -+ ich=\E[%p1%d@, ich1=\E[@, kbs=^H, kcub1=\E[D, kcud1=\E[B, -+ kcuf1=\E[C, kcuu1=\E[A, kdch1=\177, kend=\E[Y, kf1=\EOP, -+ kf10=\EOY, kf11=\EOZ, kf12=\EOA, kf2=\EOQ, kf3=\EOR, -+ kf4=\EOS, kf5=\EOT, kf6=\EOU, kf7=\EOV, kf8=\EOW, kf9=\EOX, -+ khome=\E[H, kich1=\E[@, nel=^M^J, op=\E[39;49m, rc=\E8, -+ rev=\E[7m, rmacs=\E[10m, rmir=\E[4l, rmpch=\E[10m, -+ rmso=\E[27m, rmul=\E[m, rs1=\Ec\E]R, sc=\E7, -+ setab=\E[4%p1%dm, setaf=\E[3%p1%dm, sgr0=\E[0;10m, -+ smacs=\E[11m, smir=\E[4h, smpch=\E[11m, smso=\E[7m, -+ smul=\E[4m, tbc=\E[3g, u6=\E[%i%d;%dR, u7=\E[6n, -+ -+#### Microsoft (miscellaneous) -+ -+# This entry fits the Windows NT console when the _POSIX_TERM environment -+# variable is set to 'on'. While the Windows NT POSIX console is seldom used, -+# the Telnet client supplied with both the Windows for WorkGroup 3.11 TCP/IP -+# stack and the Win32 (i.e., Windows 95 and Windows NT 3.1 or later) operating -+# systems is not, and (surprise!) they match very well. - # --# Auto-flip mode (\Ev) is likely faster than the scrolling mode (\Ew) --# enabled in <is2>, but auto-flip is very jarring so we don't use it. -+# See: MS Knowledge Base item Q108581, dated 13-MAY-1997, titled "Setting Up -+# VI POSIX Editor for Windows NT 3.1". True to Microsoft form, not only -+# are the installation instructions a pile of mind-numbing bureaucratese, -+# but the termcap entry is actually broken and unusable as given; the :do: -+# capability is misspelled "d". - # --# BUGS -+# To use this, you need to a bunch of environment variables: - # --# At least up to the A49B1 and A49C1 ROMs, there are no \Eb and \Ed --# sequences (I infer that in some TeleVideo terminal they may invert --# and uninvert the display) so the <flash> sequence given here is a --# cheesy page-flip instead. -+# SET _POSIX_TERM=on -+# SET TERM=ansi -+# SET TERMCAP=location of termcap file in POSIX file format -+# which is case-sensitive. -+# e.g. SET TERMCAP=//D/RESKIT35/posix/termcap -+# SET TMP=//C/TEMP - # --# The back_tab (<cbt>) sequence (\EI) doesn't work according to --# tack(1), so it is not included in the descriptions below. -+# Important note: setting the TMP environment variable in POSIX style renders -+# it incompatible with a lot of other applications, including Visual C++. So -+# you should have a separate command window just for vi. All the other -+# variables may be permanently set in the Control Panel\System applet. - # --# It's not clear whether auto_left_margin (<bw>) flag should be set --# for these terminals; tack says yes, so it is set here, but this --# differs from other descriptions I've seen. -+# You can find out more about the restrictions of this facility at -+# <http://www.nentug.org/unix-to-nt/ntposix.htm>. - # --# Extension print mode (<mc5>) echoes all characters to the printer --# port [in addition to displaying them] except for the page print mode --# sequence (<mc4>); this is a slight violation of the terminfo --# definition for <mc5> but I don't expect it to cause problems. We --# reset to page print mode in <rs1> since it may have been enabled --# accidentally. -+# From: Federico Bianchi <bianchi@magna.cisid.unipi.it>, 15 Jan 1997 -+ansi-nt|psx_ansi|Microsoft Windows NT console POSIX ANSI mode, -+ am, bw, msgr, -+ cols#80, it#8, lines#25, -+ bel=^G, clear=\E[2J, cr=^M, cub1=^H, cud1=^J, cuf1=\E[C, -+ cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, ed=\E[J, el=\E[K, -+ home=\E[H, ht=^I, ind=\E[S, kbs=^H, kcub1=\E[D, kcud1=\E[V, -+ kcuf1=\E[C, kcuu1=\E[A, nel=\r\E[S, rc=\E[u, rev=\E[7m, -+ ri=\E[T, rmso=\E[m, sc=\E[s, sgr0=\E[0m, smso=\E[7m, -+# From: jew@venus.sunquest.com -+# Date: 19 Feb 93 23:41:07 GMT -+# Here's a combination of ansi and vt100 termcap -+# entries that works nearly perfectly for me -+# (Gateway 2000 Handbook and Microsoft Works 3.0): -+pcmw|PC running Microsoft Works, -+ am, xenl, -+ cols#80, it#8, lines#24, vt#3, -+ bel=^G, blink=\E[5m$<2/>, bold=\E[1m$<2/>, -+ clear=\E[;H\E[2J$<50/>, cr=^M, cub1=^H, cud1=^J, -+ cuf1=\E[C$<2/>, cup=\E[%i%p1%d;%p2%dH$<5/>, -+ cuu1=\E[A$<2/>, ed=\E[J$<50/>, el=\E[K$<3/>, home=\E[H, -+ ht=^I, hts=\EH$<2/>, ind=\ED$<5/>, is2=\E[1;24r\E[24;1H, -+ kbs=^H, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, -+ kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, nel=\r\ED$<5/>, -+ rc=\E8, rev=\E[7m$<2/>, rf=/usr/share/tabset/vt100, -+ ri=\EM$<5/>, rmso=\E[m$<2/>, rmul=\E[m$<2/>, -+ rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sc=\E7, -+ sgr0=\E[m$<2/>, smso=\E[7m$<2/>, smul=\E[4m$<2/>, -+ tbc=\E[3g$<2/>, -+ -+# From: Federico Bianchi -+# This is the entry for the OpenNT terminal. -+# The ntconsole name is for backward compatability. -+# This is for OpenNT 2.0 and later. -+# Later OpenNT was renamed to Interix. - # --# The descriptions with plus signs (+) are building blocks. -+# Presently it is distributed by Microsoft as Services For Unix (SFU). -+# The 3.5 beta contains ncurses 4.2 (that is header files and executables, -+# the documentation dates from 1.9.9e) -TD - --tvi912b-unk|tvi912c-unk|TeleVideo TVI-912B or TVI-912C (no attributes), -- OTbs, OTpt, am, bw, -- cols#80, it#8, lines#24, -- bel=^G, clear=\032$<50>, cr=^M, cub1=^H, cud1=^J, cuf1=^L, -- cup=\E=%p1%' '%+%c%p2%' '%+%c, cuu1=^K, dch1=\EW$<30>, -- dl1=\ER$<1*>$<100>, ed=\Ey$<2*>$<10>, el=\ET$<15>, -- home=^^, ht=^I, hts=\E1, ich1=\EQ$<30>, -- if=/usr/share/tabset/stdcrt, il1=\EE$<1*>$<100>, -- ind=\n$<10>, is2=\Ew\EA\E'\E"\E(, kcub1=^H, kcud1=^J, -- kcuf1=^L, kcuu1=^K, kdch1=\177, kent=^M, khome=^^, mc4=\EA, -- mc5=\E@, rs1=\Ek\010\Em\010\Eq\032, tbc=\E3, u6=%c%c\r, -- u7=\E?, u8=%c%c\r, u9=\E?, -+interix|opennt|opennt-25|ntconsole|ntconsole-25|OpenNT-term compatible with color, -+ am, bw, msgr, -+ colors#8, cols#80, lines#25, ncv#3, pairs#64, -+ acsc=+\020\,\021-\030.^Y0\333`\004a\261f\370g\361h\260j\331k\277l\332m\300n\305o~p\304q\304r\304s_t\303u\264v\301w\302x\263y\363z\362{\343|\330}\234~\376, -+ bel=^G, bold=\E[1m, cbt=\E[Z, clear=\E[2J, cub=\E[%p1%dD, -+ cub1=\E[D, cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, -+ cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, -+ cuu1=\E[A, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[K, -+ home=\E[H, ht=^I, il=\E[%p1%dL, il1=\E[L, ind=\E[S, -+ indn=\E[%p1%dS, kbs=^H, kcbt=\E[Z, kcub1=\E[D, kcud1=\E[B, -+ kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[M, kend=\E[U, kf0=\EFA, -+ kf1=\EF1, kf10=\EFA, kf11=\EFB, kf12=\EFC, kf13=\EFD, -+ kf14=\EFE, kf15=\EFF, kf16=\EFG, kf17=\EFH, kf18=\EFI, -+ kf19=\EFJ, kf2=\EF2, kf20=\EFK, kf21=\EFL, kf22=\EFM, -+ kf23=\EFN, kf24=\EFO, kf25=\EFP, kf26=\EFQ, kf27=\EFR, -+ kf28=\EFS, kf29=\EFT, kf3=\EF3, kf30=\EFU, kf31=\EFV, -+ kf32=\EFW, kf33=\EFX, kf34=\EFY, kf35=\EFZ, kf36=\EFa, -+ kf37=\EFb, kf38=\EFc, kf39=\EFd, kf4=\EF4, kf40=\EFe, -+ kf41=\EFf, kf42=\EFg, kf43=\EFh, kf44=\EFi, kf45=\EFj, -+ kf46=\EFk, kf47=\EFm, kf48=\EFn, kf49=\EFo, kf5=\EF5, -+ kf50=\EFp, kf51=\EFq, kf52=\EFr, kf53=\EFs, kf54=\EFt, -+ kf55=\EFu, kf56=\EFv, kf57=\EFw, kf58=\EFx, kf59=\EFy, -+ kf6=\EF6, kf60=\EFz, kf61=\EF+, kf62=\EF-, -+ kf63=\EF\014 kf64=\EF$, kf7=\EF7, kf8=\EF8, kf9=\EF9, -+ kich1=\E[L, kll=\E[U, knp=\E[T, kpp=\E[S, ll=\E[U, nel=^M^J, -+ op=\E[m, rc=\E[u, rev=\E[7m, ri=\E[T, rin=\E[%p1%dT, -+ rmcup=\E[2b\E[u\r\E[K, rmso=\E[m, rmul=\E[m, rs1=\Ec, -+ sc=\E[s, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, -+ setb=\E[%p1%{40}%+%dm, setf=\E[%p1%{30}%+%dm, -+ sgr0=\E[0m, smcup=\E[s\E[1b, smso=\E[7m, smul=\E[4m, - --# This isn't included in the basic capabilities because it is --# typically unusable in combination with the full range of video --# attributes, since the magic cookie attributes turn into ASCII --# control characters, and the half-intensity ("protected") attribute --# converts all affected characters to spaces. -+opennt-35|ntconsole-35|OpenNT-term35 compatible with color, -+ lines#35, use=opennt, - --tvi912b+printer|TeleVideo TVI-912B/TVI-920B and TVI-912C/TVI-920C page print support, -- mc0=\EP, -+opennt-50|ntconsole-50|OpenNT-term50 compatible with color, -+ lines#50, use=opennt, - --# This uses half-intensity mode (<dim>) for standout (<smso>), and --# exposes no other attributes (half-intensity is the only attribute --# that does not generate a magic cookie.) -- --tvi912b+dim|TeleVideo TVI-912B/TVI-920B and TVI-912C/TVI-920C half-intensity attribute support, -- msgr, -- dim=\E), rmso=\E(, sgr=\E%?%p1%p5%|%t)%e(%;, sgr0=\E(, -- smso=\E), -- --# Full magic-cookie attribute support, with half-intensity reverse --# video for standout. Note that we add a space in the <dim> sequence --# to give a consistent magic-cookie count. Also note that <sgr> uses --# backspacing (in the TVI-supported order) to apply all requested --# attributes with only a single magic cookie. -- --tvi912b+mc|TeleVideo TVI-912B/TVI-920B and TVI-912C/TVI-920C full magic-cookie attribute support, -- xmc#1, -- blink=\E\^, dim=\E)\s, invis=\E_, rev=\Ej, rmso=\E(\Ek, -- rmul=\Em, -- sgr=\E%?%p1%p5%|%t)%e(%; \010\E%?%p1%p3%|%tj%ek%;\010\E%?%p2%tl%em%;\010\E%?%p7%t_%e%?%p4%t\^%eq%;%;, -- sgr0=\E(\Ek\010\Em\010\Eq, smso=\E)\Ej, smul=\El, -+opennt-60|ntconsole-60|OpenNT-term60 compatible with color, -+ lines#60, use=opennt, - --# This uses the second page memory option to save & restore screen --# contents. If your terminal is missing the option, this description --# should still work, but that has not been tested. -+opennt-100|ntconsole-100|OpenNT-term100 compatible with color, -+ lines#100, use=opennt, - --tvi912b+2p|TeleVideo TVI-912B/TVI-920B and TVI-912C/TVI-920C second page memory option support, -- flash=\EK$<100>\EK, rmcup=\032$<50>\EK\E=7\s, -- smcup=\EK\032$<50>\E(\Ek\010\Em\010\Eq\032$<50>, -+# OpenNT wide terminals -+opennt-w|opennt-25-w|ntconsole-w|ntconsole-25-w|OpenNT-term-w compat with color, -+ cols#125, use=opennt, - --# This simulates flashing by briefly toggling to the other page --# (kludge!) -+opennt-35-w|ntconsole-35-w|OpenNT-term35-w compatible with color, -+ lines#35, use=opennt-w, - --tvi912b+vb|TeleVideo TVI-912B/TVI-920B and TVI-912C/TVI-920C second page memory option "visible bell" support, -- bel=\EK$<100>\EK, use=tvi912b+2p, -+opennt-50-w|ntconsole-50-w|OpenNT-term50-w compatible with color, -+ lines#50, use=opennt-w, - --# Function keys (<kf12> .. <kf22> are shifted <kf1> .. <kf11>) -+opennt-60-w|ntconsole-60-w|OpenNT-term60-w compatible with color, -+ lines#60, use=opennt-w, - --tvi920b+fn|TeleVideo TVI-920B and TVI-920C function key support, -- kf1=^A@\r, kf10=^AI\r, kf11=^AJ\r, kf12=^A`\r, kf13=^Aa\r, -- kf14=^Ab\r, kf15=^Ac\r, kf16=^Ad\r, kf17=^Ae\r, kf18=^Af\r, -- kf19=^Ag\r, kf2=^AA\r, kf20=^Ah\r, kf21=^Ai\r, kf22=^Aj\r, -- kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, kf6=^AE\r, kf7=^AF\r, -- kf8=^AG\r, kf9=^AH\r, -+opennt-w-vt|opennt-25-w-vt|ntconsole-w-vt|ntconsole-25-w-vt|OpenNT-term-w-vt compat with color, -+ cols#132, use=opennt, - --# Combinations of the basic building blocks -+# OpenNT terminals with no smcup/rmcup (names match termcap entries) -+interix-nti|opennt-nti|opennt-25-nti|ntconsole-25-nti|OpenNT-nti compatible with color, -+ rmcup@, smcup@, use=opennt, - --tvi912b-2p-unk|tvi912c-2p-unk|tvi912b-unk-2p|tvi912c-unk-2p|TeleVideo TVI-912B or TVI-912C (second page memory option; no attributes), -- use=tvi912b+2p, use=tvi912b-unk, -+opennt-35-nti|ntconsole-35-nti|OpenNT-term35-nti compatible with color, -+ lines#35, use=opennt-nti, - --tvi912b-vb-unk|tvi912c-vb-unk|tvi912b-unk-vb|tvi912c-unk-vb|TeleVideo TVI-912B or TVI-912C (second page memory option "visible bell"; no attributes), -- use=tvi912b+vb, use=tvi912b-unk, -+opennt-50-nti|ntconsole-50-nti|OpenNT-term50-nti compatible with color, -+ lines#50, use=opennt-nti, - --tvi912b-p|tvi912c-p|TeleVideo TVI-912B or TVI-912C (no attributes; page print), -- use=tvi912b+printer, use=tvi912b-unk, -+opennt-60-nti|ntconsole-60-nti|OpenNT-term60-nti compatible with color, -+ lines#60, use=opennt-nti, - --tvi912b-2p-p|tvi912c-2p-p|tvi912b-p-2p|tvi912c-p-2p|TeleVideo TVI-912B or TVI-912C (second page memory option; no attributes; page print), -- use=tvi912b+2p, use=tvi912b+printer, use=tvi912b-unk, -+opennt-100-nti|ntconsole-100-nti|OpenNT-term100-nti compatible with color, -+ lines#100, use=opennt-nti, - --tvi912b-vb-p|tvi912c-vb-p|tvi912b-p-vb|tvi912c-p-vb|TeleVideo TVI-912B or TVI-912C (second page memory option "visible bell"; no attributes; page print), -- use=tvi912b+vb, use=tvi912b+printer, use=tvi912b-unk, -+######## COMMON TERMINAL TYPES -+# -+# This section describes terminal classes and maker brands that are still -+# quite common, but have proprietary command sets not blessed by ANSI. -+# - --tvi912b-2p|tvi912c-2p|TeleVideo TVI-912B or TVI-912C (second page memory option; half-intensity attribute), -- use=tvi912b+2p, use=tvi912b+dim, use=tvi912b-unk, -+#### Altos -+# -+# Altos made a moderately successful line of UNIX boxes. In 1990 they were -+# bought out by Acer, a major Taiwanese manufacturer of PC-clones. -+# Acer has a web site at http://www.acer.com. -+# -+# Altos descriptions from Ted Mittelstaedt <tedm@agora.rain.com> 4 Sep 1993 -+# His comments suggest they were shipped with the system. -+# - --tvi912b-2p-mc|tvi912c-2p-mc|tvi912b-mc-2p|tvi912c-mc-2p|TeleVideo TVI-912B or TVI-912C (second page memory option; magic cookies), -- use=tvi912b+2p, use=tvi912b+mc, use=tvi912b-unk, -+# (altos2: had extension capabilities -+# :c0=^A`\r:c1=^Aa\r:c2=^Ab\r:c3=^Ac\r:\ -+# :c4=^Ad\r:c5=^Ae\r:c6=^Af\r:c7=^Ag\r:\ -+# :c8=^Ah\r:c9=^Ai\r:cA=^Aj\r:cB=^Ak\r:\ -+# :cC=^Al\r:cD=^Am\r:cE=^An\r:cF=^Ao\r: -+# :XU=^Aq\r:XD=^Ar\r:XR=^As\r:XL=^At\r:\ -+# :YU=^AQ\r:YD=^AR\r:YR=^AS\r:YL=^AT\r:\ -+# :HL=^AP\r:SP=\E[i:\ -+# :IS=\E[@:DE=\E[P:IL=\E[L:NS=\E[S:PS=\E[T:\ -+# :LO=\E[0q:LC=\E[5q:LL=\E[6q:\ -+# Comparison with the k* capabilities makes it obvious that the c* things are -+# shift keys. I have renamed them to keys 32 and up accordingly. Also, -+# :sr: was given as a boolean-- esr) -+altos2|alt2|altos-2|altos II, -+ cols#80, it#8, lines#24, xmc#0, -+ clear=\E[H\E[2J, cr=^M, cub1=^H, cud1=\E[1B, cuf1=\E[1C, -+ cup=\E[%i%p1%d;%p2%dH, cuu1=\E[1A, dch1=\E[P, dl1=\E[M, -+ ed=\E[J, el=\E[K, home=\E[H, ht=^I, ich1=\E[@, -+ if=/usr/share/tabset/vt100, il1=\E[L, ind=^J, -+ is2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, kDL=^Am\r, -+ kEOL=^An\r, kbs=^H, kcbt=^AK\r, kclr=^AL\r, kcub1=\E[D, -+ kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=^AM\r, kel=^AN\r, -+ kf0=^AI\r, kf1=^A@\r, kf2=^AA\r, kf3=^AB\r, kf32=^A`\r, -+ kf33=^Aa\r, kf34=^Ab\r, kf35=^Ac\r, kf36=^Ad\r, kf37=^Ae\r, -+ kf38=^Af\r, kf39=^Ag\r, kf4=^AC\r, kf40=^Ah\r, kf41=^Ai\r, -+ kf42=^Aj\r, kf43=^Ak\r, kf5=^AD\r, kf6=^AE\r, kf7=^AF\r, -+ kf8=^AG\r, kf9=^AH\r, khome=\E[f, kil1=^AJ\r, kind=^AO\r, -+ nel=^M^J, rmam=\E[?7l, rmso=\E[m, rmul=\E[m, sgr0=\E[m, -+ smam=\E[?7h, smso=\E[7m, smul=\E[4m, -+# (altos3: had extension capabilities -+# :c0=^A`\r:c1=^Aa\r:c2=^Ab\r:c3=^Ac\r:\ -+# :c4=^Ad\r:c5=^Ae\r:c6=^Af\r:c7=^Ag\r:\ -+# :c8=^Ah\r:c9=^Ai\r:cA=^Aj\r:cB=^Ak\r:\ -+# :cC=^Al\r:cD=^Am\r:cE=^An\r:cF=^Ao\r: -+# :XU=^Aq\r:XD=^Ar\r:XR=^As\r:XL=^At\r:\ -+# :HL=^AP\r:SP=\E[i:\ -+# :IS=\E[@:DE=\E[P:IL=\E[L:NS=\E[S:PS=\E[T: -+altos3|altos5|alt3|alt5|altos-3|altos-5|altos III or V, -+ blink=\E[5p, ri=\EM, sgr0=\E[p, use=altos2, -+altos4|alt4|altos-4|altos IV, -+ use=wy50, -+# (altos7: had extension capabilities: -+# :GG#0:GI=\EH8:GF=\EH7:\ -+# :c0=^A`\r:c1=^Aa\r:c2=^Ab\r:c3=^Ac\r:\ -+# :c4=^Ad\r:c5=^Ae\r:c6=^Af\r:c7=^Ag\r:\ -+# :c8=^Ah\r:c9=^Ai\r:cA=^Aj\r:cB=^Ak\r:\ -+# :cC=^Al\r:cD=^Am\r:cE=^An\r:cF=^Ao\r: -+# Comparison with the k* capabilities makes it obvious that the c* things are -+# shift keys. I have renamed them to keys 32 and up accordingly. I have -+# also made this entry relative to adm12 in order to give it an <sgr>. The -+# <invis> imported by use=adm+sgr may work, let me know. -- esr) -+altos7|alt7|altos VII, -+ am, mir, -+ cols#80, lines#24, xmc#0, -+ acsc=j5k3l2m1n8q\:t4u9v=w0x6, blink=\EG2, bold=\EGt, -+ clear=\E+^^, cr=^M, cub1=^H, cud1=^J, cuf1=^L, -+ cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW, -+ dim=\EGp, dl1=\ER, ed=\EY, el=\ET, home=^^, ht=^I, il1=\EE, -+ ind=^J, invis=\EG1, -+ is2=\E`\:\Ee(\EO\Ee6\Ec41\E~4\Ec21\Eu\E~2, kDL=^Am\r, -+ kEOL=^An\r, kbs=^H, kcbt=^AK\r, kclr=^AL\r, kcub1=^H, -+ kcud1=^J, kcuf1=^L, kcuu1=^K, kdch1=^AM\r, kel=^AN\r, -+ kf0=^AI\r, kf1=^A@\r, kf2=^AA\r, kf3=^AB\r, kf32=^A`\r, -+ kf33=^Aa\r, kf34=^Ab\r, kf35=^Ac\r, kf36=^Ad\r, kf37=^Ae\r, -+ kf38=^Af\r, kf39=^Ag\r, kf4=^AC\r, kf40=^Ah\r, kf41=^Ai\r, -+ kf42=^Aj\r, kf43=^Ak\r, kf5=^AD\r, kf6=^AE\r, kf7=^AF\r, -+ kf8=^AG\r, kf9=^AH\r, khome=^^, kil1=^AJ\r, kind=^AO\r, -+ knp=\EK, kpp=\EJ, mc4=\EJ, mc5=\Ed#, nel=^M^J, ri=\Ej, -+ rmir=\Er, smir=\Eq, use=adm+sgr, -+altos7pc|alt7pc|altos PC VII, -+ kend=\ET, use=altos7, - --tvi912b-vb|tvi912c-vb|TeleVideo TVI-912B or TVI-912C (second page memory option "visible bell"; half-intensity attribute), -- use=tvi912b+vb, use=tvi912b+dim, use=tvi912b-unk, -+#### Hewlett-Packard (hp) -+# -+# Hewlett-Packard -+# 8000 Foothills Blvd -+# Roseville, CA 95747 -+# Vox: 1-(916)-785-4363 (Technical response line for VDTs) -+# 1-(800)-633-3600 (General customer support) -+# -+# -+# As of March 1998, HP no longer has any terminals in production. -+# The 700 series (22, 32, 41, 44, 92, 94, 96, 98) is still being -+# supported (they still have parts). So are the 2392a and 2394a. -+# See the WORKSTATION CONSOLES section for the 700s. -+# - --tvi912b-vb-mc|tvi912c-vb-mc|tvi912b-mc-vb|tvi912c-mc-vb|TeleVideo TVI-912B or TVI-912C (second page memory option "visible bell"; magic cookies), -- use=tvi912b+vb, use=tvi912b+mc, use=tvi912b-unk, -+# Generic HP terminal - this should (hopefully) work on any HP terminal. -+hpgeneric|hp|hewlett-packard generic terminal, -+ OTbs, OTpt, am, da, db, mir, xhp, -+ cols#80, lines#24, lm#0, vt#6, -+ bel=^G, clear=\EH\EJ, cr=^M, cub1=^H, cud1=^J, cuf1=\EC, -+ cup=\E&a%p2%dc%p1%dY$<6>, cuu1=\EA, dch1=\EP, dl1=\EM, -+ ed=\EJ, el=\EK, hpa=\E&a%p1%dC, ht=^I, hts=\E1, il1=\EL, -+ ind=^J, kbs=^H, kcbt=\Ei, rmir=\ER, rmso=\E&d@, rmul=\E&d@, -+ sgr0=\E&d@, smir=\EQ, smso=\E&dJ, smul=\E&dD, tbc=\E3, -+ vpa=\E&a%p1%dY, - --tvi912b|tvi912c|TeleVideo TVI-912B or TVI-912C (half-intensity attribute), -- use=tvi912b+dim, use=tvi912b-unk, -+hp110|hewlett-packard model 110 portable, -+ lines#16, use=hpgeneric, - --tvi912b-mc|tvi912c-mc|TeleVideo TVI-912B or TVI-912C (magic cookies), -- use=tvi912b+mc, use=tvi912b-unk, -+hp+pfk+cr|hp function keys with CR, -+ kf1=\Ep\r, kf2=\Eq\r, kf3=\Er\r, kf4=\Es\r, kf5=\Et\r, -+ kf6=\Eu\r, kf7=\Ev\r, kf8=\Ew\r, - --tvi920b-unk|tvi920c-unk|TeleVideo TVI-920B or TVI-920C (no attributes), -- use=tvi920b+fn, use=tvi912b-unk, -+hp+pfk-cr|hp function keys w/o CR, -+ kf1=\Ep, kf2=\Eq, kf3=\Er, kf4=\Es, kf5=\Et, kf6=\Eu, kf7=\Ev, -+ kf8=\Ew, - --tvi920b-2p-unk|tvi920c-2p-unk|tvi920b-unk-2p|tvi920c-unk-2p|TeleVideo TVI-920B or TVI-920C (second page memory option; no attributes), -- use=tvi920b+fn, use=tvi912b+2p, use=tvi912b-unk, -+# The hp2621s use the same keys for the arrows and function keys, -+# but not separate escape sequences. These definitions allow the -+# user to use those keys as arrow keys rather than as function -+# keys. -+hp+pfk+arrows|hp alternate arrow definitions, -+ kcub1=\Eu\r, kcud1=\Ew\r, kcuf1=\Ev\r, kcuu1=\Et\r, kf1@, -+ kf2@, kf3@, kf4@, kf5@, kf6@, kf7@, kf8@, khome=\Ep\r, kind=\Er\r, -+ kll=\Eq\r, kri=\Es\r, - --tvi920b-vb-unk|tvi920c-vb-unk|tvi920b-unk-vb|tvi920c-unk-vb|TeleVideo TVI-920B or TVI-920C (second page memory option "visible bell"; no attributes), -- use=tvi920b+fn, use=tvi912b+vb, use=tvi912b-unk, -+hp+arrows|hp arrow definitions, -+ kcub1=\ED, kcud1=\EB, kcuf1=\EC, kcuu1=\EA, khome=\Eh, -+ kind=\ES, kll=\EF, kri=\ET, - --tvi920b-p|tvi920c-p|TeleVideo TVI-920B or TVI-920C (no attributes; page print), -- use=tvi920b+fn, use=tvi912b+printer, use=tvi912b-unk, -+# Generic stuff from the HP 262x series -+# -+hp262x|HP 262x terminals, -+ xhp, -+ blink=\E&dA, dch1=\EP$<2>, ed=\EJ, ht=\011$<2>, ind=\ES, -+ invis=\E&dS, ip=$<2>, kcub1=\ED, kcud1=\EB, kcuf1=\EC, -+ kcuu1=\EA, kdch1=\EP, kdl1=\EM, ked=\EJ, kel=\EK, khome=\Eh, -+ kich1=\EQ, kil1=\EL, kind=\ES, knp=\EU, kpp=\EV, kri=\ET, -+ krmir=\ER, rev=\E&dB, rmkx=\E&s0A, rmso=\E&d@, rmul=\E&d@, -+ sgr=\E&d%{64}%?%p1%t%{66}%|%;%?%p2%t%{68}%|%;%?%p3%t%{66}%|%;%?%p4%t%{65}%|%;%c, -+ sgr0=\E&d@, smkx=\E&s1A, smso=\E&dB, smul=\E&dD, - --tvi920b-2p-p|tvi920c-2p-p|tvi920b-p-2p|tvi920c-p-2p|TeleVideo TVI-920B or TVI-920C (second page memory option; no attributes; page print), -- use=tvi920b+fn, use=tvi912b+2p, use=tvi912b+printer, -- use=tvi912b-unk, -+# Note: no <home> on HPs since that homes to top of memory, not screen. -+# Due to severe 2621 braindamage, the only way to get the arrow keys to -+# transmit anything at all is to turn on the function key labels -+# with <smkx>, and even then the user has to hold down shift! -+# The default 2621 turns off the labels except when it has to to -+# enable the function keys. If your installation prefers labels -+# on all the time, or off all the time (at the "expense" of the -+# function keys), use 2621-nl or 2621-wl. -+# -+# Note: there are newer ROMs for 2621's that allow you to set -+# strap A so the regular arrow keys xmit \EA, etc, as with the -+# 2645. However, even with this strap set, the terminal stops -+# xmitting if you reset it, until you unset and reset the strap! -+# Since there is no way to set/unset the strap with an escape -+# sequence, we don't use it in the default. -+# If you like, you can use 2621-ba (brain-damaged arrow keys). -+hp2621-ba|2621 w/new rom and strap A set, -+ rmkx@, smkx@, use=hp+arrows, use=hp2621, - --tvi920b-vb-p|tvi920c-vb-p|tvi920b-p-vb|tvi920c-p-vb|TeleVideo TVI-920B or TVI-920C (second page memory option "visible bell"; no attributes; page print), -- use=tvi920b+fn, use=tvi912b+vb, use=tvi912b+printer, -- use=tvi912b-unk, -- --tvi920b-2p|tvi920c-2p|TeleVideo TVI-920B or TVI-920C (second page memory option; half-intensity attribute), -- use=tvi920b+fn, use=tvi912b+2p, use=tvi912b+dim, -- use=tvi912b-unk, -- --tvi920b-2p-mc|tvi920c-2p-mc|tvi920b-mc-2p|tvi920c-mc-2p|TeleVideo TVI-920B or TVI-920C (second page memory option; magic cookies), -- use=tvi920b+fn, use=tvi912b+2p, use=tvi912b+mc, -- use=tvi912b-unk, -+# hp2621 with function labels. Most of the time they are off, -+# but inside vi, the function key labels appear. You have to -+# hold down shift to get them to xmit. -+hp2621|hp2621a|hp2621A|2621|2621a|2621A|hp2621-wl|2621-wl|hp 2621 w/labels, -+ is2=\E&jA\r, rmkx=\E&jA, use=hp2621-fl, -+hp2621-fl|hp 2621, -+ xhp@, xon, -+ pb#19200, -+ cbt=\Ei, cup=\E&a%p2%dc%p1%dY, dch1=\EP$<2>, ht=\011$<2>, -+ ip=$<2>, is2=\E&j@\r, rmkx=\E&j@, rmso=\E&d@, rmul=\E&d@, -+ sgr0=\E&d@, smkx=\E&jB, smso=\E&dD, smul=\E&dD, -+ use=hp+pfk+cr, use=hpgeneric, - --tvi920b-vb|tvi920c-vb|TeleVideo TVI-920B or TVI-920C (second page memory option "visible bell"; half-intensity attribute), -- use=tvi920b+fn, use=tvi912b+vb, use=tvi912b+dim, -- use=tvi912b-unk, -+# To use hp2621p printer, setenv TERM=2621p, PRINTER=2612p -+hp2621p|hp 2621 with printer, -+ mc4=\E&p13C, mc5=\E&p11C, use=hp2621, - --tvi920b-vb-mc|tvi920c-vb-mc|tvi920b-mc-vb|tvi920c-mc-vb|TeleVideo TVI-920B or TVI-920C (second page memory option "visible bell"; magic cookies), -- use=tvi920b+fn, use=tvi912b+vb, use=tvi912b+mc, -- use=tvi912b-unk, -+hp2621p-a|hp2621p with fn as arrows, -+ use=hp+pfk+arrows, use=hp2621p, - --tvi920b|tvi920c|TeleVideo TVI-920B or TVI-920C (half-intensity attribute), -- use=tvi920b+fn, use=tvi912b+dim, use=tvi912b-unk, -+# hp2621 with k45 keyboard -+hp2621-k45|hp2621k45|k45|hp 2621 with 45 keyboard, -+ kbs=^H, kcub1=\ED, kcud1=\EB, kcuf1=\EC, kcuu1=\EA, -+ khome=\Eh, rmkx=\E&s0A, smkx=\E&s1A, use=hp2621, - --tvi920b-mc|tvi920c-mc|TeleVideo TVI-920B or TVI-920C (magic cookies), -- use=tvi920b+fn, use=tvi912b+mc, use=tvi912b-unk, -+# 2621 using all 48 lines of memory, only 24 visible at any time. -+hp2621-48|48 line 2621, -+ lines#48, -+ cup=\E&a%p2%dc%p1%dR, home=\EH, vpa=\E&a%p1%dR, -+ use=hp2621, - --# Televideo 921 and variants --# From: Tim Theisen <tim@cs.wisc.edu> 22 Sept 1995 --# (tvi921: removed :ko=bt: before translation, I see no backtab cap; --# also added empty <acsc> to suppress tic warning -- esr) --tvi921|televideo model 921 with sysline same as page & real vi function, -- OTbs, OTpt, am, hs, xenl, xhp, -- cols#80, lines#24, xmc#0, -- acsc=, clear=^Z, cnorm=\E.3, cr=^M, cub1=^H, cud1=^V, cuf1=^L, -- cup=\E=%p1%{32}%+%c%p2%{32}%+%c$<3/>, cuu1=^K, -- cvvis=\E.2, dch1=\EW, dl1=\ER$<1*/>, dsl=\Ef\r\Eg, ed=\EY, -- el=\ET, fsl=\Eg, home=^^, ht=^I, ich1=\EQ, -- if=/usr/share/tabset/stdcrt, il1=\EE, ind=^J, invis@, -- is2=\El\E"\EF1\E.3\017\EA\E<, kbs=^H, kclr=^Z, kcub1=^H, -- kcud1=^V, kcuf1=^L, kcuu1=^K, kdch1=\EW, kdl1=\ER$<1*/>, -- ked=\EY, kel=\ET, kich1=\EQ, kil1=\EE, nel=^M^J, rmacs=\E%%, -- rmir=, smacs=\E$, smir=, tsl=\Ef\EG0, use=adm+sgr, --# without the beeper --# (tvi92B: removed :ko=bt: before translation, I see no backtab cap; --# also added empty <acsc> to suppress tic warning -- esr) --tvi92B|televideo model 921 with sysline same as page & real vi function & no beeper, -- am, hs, xenl, xhp, -- cols#80, lines#24, xmc#0, -- acsc=, clear=^Z, cnorm=\E.3, cr=^M, cub1=^H, cud1=^V, cuf1=^L, -- cup=\E=%p1%{32}%+%c%p2%{32}%+%c$<3/>, cuu1=^K, -- cvvis=\E.2, dch1=\EW, dl1=\ER$<1*/>, dsl=\Ef\r\Eg, ed=\EY, -- el=\ET, flash=\Eb$<200/>\Ed, fsl=\Eg, home=^^, ht=^I, -- ich1=\EQ, if=/usr/share/tabset/stdcrt, il1=\EE, ind=^J, -- invis@, is2=\El\E"\EF1\E.3\017\EA\E<, kbs=^H, kclr=^Z, -- kcub1=^H, kcud1=^V, kcuf1=^L, kcuu1=^K, kdch1=\EW, -- kdl1=\ER$<1*/>, ked=\EY, kel=\ET, kich1=\EQ, kil1=\EE, -- nel=^M^J, rmacs=\E%%, smacs=\E$, tsl=\Ef\EG0, use=adm+sgr, --# (tvi92D: removed :ko=bt: before translation, I see no backtab cap -- esr) --tvi92D|tvi92B with DTR instead of XON/XOFF & better padding, -- dl1=\ER$<2*/>, il1=\EE$<2*/>, -- is2=\El\E"\EF1\E.3\016\EA\E<, kdl1=\ER$<2*/>, -- kil1=\EE$<2*/>, use=tvi92B, -+# 2621 with no labels ever. Also prevents vi delays on escape. -+hp2621-nl|hp 2621 with no labels, -+ kcub1@, kcud1@, kcuf1@, kcuu1@, khome@, rmkx@, smkx@, -+ use=hp2621-fl, - --# (tvi924: This used to have <dsl=\Es0>, <fsl=\031>. I put the new strings --# in from a BSD termcap file because it looks like they do something the --# old ones skip -- esr) --tvi924|televideo tvi924, -- am, bw, hs, in, mir, msgr, xenl, xon, -- cols#80, it#8, lines#24, wsl#80, xmc#0, -- bel=^G, blink=\EG2, cbt=\EI, civis=\E.0, clear=\E*0, -- cnorm=\E.3, cr=^M, csr=\E_%p1%{32}%+%c%p2%{32}%+%c, -- cub1=^H, cud1=^V, cuf1=^L, -- cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, cvvis=\E.1, -- dch1=\EW, dl1=\ER, dsl=\Es0\Ef\031, ed=\Ey, el=\Et, -- flash=\Eb$<200>\Ed, fsl=\031\Es1, home=^^, ht=^I, hts=\E1, -- ich1=\EQ, if=/usr/share/tabset/stdcrt, il1=\EE, ind=^J, -- invis@, is1=\017\E%\E'\E(\EDF\EC\EG0\EN0\Es0\Ev0, -- kbs=^H, kclr=\E*0, kcub1=^H, kcud1=^V, kcuf1=^L, kcuu1=^K, -- kdch1=\EW, kdl1=\ER, ked=\Ey, kel=\Et, kf0=^A@\r, kf1=^AA\r, -- kf10=^AJ\r, kf11=^AK\r, kf12=^AL\r, kf13=^AM\r, kf14=^AN\r, -- kf15=^AO\r, kf2=^AB\r, kf3=^AC\r, kf4=^AD\r, kf5=^AE\r, -- kf6=^AF\r, kf7=^AG\r, kf8=^AH\r, kf9=^AI\r, khome=^^, -- kich1=\EQ, kil1=\EE, lf0=F1, lf1=F2, lf10=F11, lf2=F3, lf3=F4, -- lf4=F5, lf5=F6, lf6=F7, lf7=F8, lf8=F9, lf9=F10, -- pfkey=\E|%p1%{49}%+%c%p2%s\031, ri=\Ej, tbc=\E3, tsl=\Ef, -- use=adm+sgr, -+# Needed for UCB ARPAVAX console, since lsi-11 expands tabs -+# (wrong). -+# -+hp2621-nt|hp 2621 w/no tabs, -+ ht@, use=hp2621, - --# TVI925 DIP switches. In each of these, D = Down and U = Up, -+# Hp 2624 B with 4 or 10 pages of memory. - # --# Here are the settings for the external (baud) switches (S1): -+# Some assumptions are made with this entry. These settings are -+# NOT set up by the initialization strings. - # --# Position Baud --# 7 8 9 10 [Printer] --# 1 2 3 4 [Main RS232] --# ----------------------------------------------------- --# D D D D 9600 --# D D D U 50 --# D D U D 75 --# D D U U 110 --# D U D D 135 --# D U D U 150 --# D U U D 300 --# D U U U 600 --# U D D D 1200 --# U D D U 1800 --# U D U D 2400 --# U D U U 3600 --# U U D D 4800 --# U U D U 7200 --# U U U D 9600 --# U U U U 19200 -+# Port Configuration -+# RecvPace=Xon/Xoff -+# XmitPace=Xon/Xoff -+# StripNulDel=Yes - # -+# Terminal Configuration -+# InhHndShk=Yes -+# InhDC2=Yes -+# XmitFnctn(A)=No -+# InhEolWrp=No - # --# Settings for word length and stop-bits (S1) -+# Note: the 2624 DOES have a true <home>, believe it or not! - # --# Position Description --# 5 6 --# --------------------------- --# U - 7-bit word --# D - 8-bit word --# - U 2 stop bits --# - D 1 stop bit -+# The 2624 has an "error line" to which messages can be sent. -+# This is CLOSE to what is expected for a "status line". However, -+# after a message is sent to the "error line", the next carriage -+# return is EATEN and the "error line" is turned back off again! -+# So I guess we can't define <hs>, <eslok>, <wsl>, <dsl>, <fsl>, <tsl>. - # -+# This entry supports emacs (and any other program that uses raw -+# mode) at 4800 baud and less. I couldn't get the padding right -+# for 9600. - # --# S2 (external) settings -+# (hp2624: replaced NUL sequences in flash with mandatory pauses -- esr) -+hp2624|hp2624a|hp2624b|hp2624b-4p|Hewlett Packard 2624 B, -+ da, db, -+ lm#96, -+ flash=\E&w13F$<66/>\E&w12F$<66/>\E&w13F$<66/>\E&w12F, -+ use=hp+labels, use=scrhp, -+ -+# This hp2626 entry does not use any of the fancy windowing stuff -+# of the 2626. - # --# Position Up Dn Description --# -------------------------------------------- --# 1 X Local edit --# X Duplex edit (transmit editing keys) --# -------------------------------------------- --# 2 X 912/920 emulation --# X 925 --# -------------------------------------------- --# 3 X --# 4 X No parity --# 5 X --# -------------------------------------------- --# 3 X --# 4 X Odd parity --# 5 X --# -------------------------------------------- --# 3 X --# 4 X Even parity --# 5 X --# -------------------------------------------- --# 3 X --# 4 X Mark parity --# 5 X --# -------------------------------------------- --# 3 X --# 4 X Space parity --# 5 X --# -------------------------------------------- --# 6 X White on black display --# X Black on white display --# -------------------------------------------- --# 7 X Half Duplex --# 8 X --# -------------------------------------------- --# 7 X Full Duplex --# 8 X --# -------------------------------------------- --# 7 X Block mode --# 8 X --# -------------------------------------------- --# 9 X 50 Hz --# X 60 Hz --# -------------------------------------------- --# 10 X CR/LF (Auto LF) --# X CR only -+# Indeed, terminfo does not yet handle such stuff. Since changing -+# any window clears memory, it is probably not possible to use -+# this for screen opt. - # --# S3 (internal switch) settings: -+# ed is incredibly slow most of the time - I am guessing at the -+# exact padding. Since the terminal uses xoff/xon this is intended -+# only for cost computation, so that the terminal will prefer el -+# or even dl1 which is probably faster! - # --# Position Up Dn Description --# -------------------------------------------- --# 1 X Keyclick off --# X Keyclick on --# -------------------------------------------- --# 2 X English --# 3 X --# -------------------------------------------- --# 2 X German --# 3 X --# -------------------------------------------- --# 2 X French --# 3 X --# -------------------------------------------- --# 2 X Spanish --# 3 X --# -------------------------------------------- --# 4 X Blinking block cursor --# 5 X --# -------------------------------------------- --# 4 X Blinking underline cursor --# 5 X --# -------------------------------------------- --# 4 X Steady block cursor --# 5 X --# -------------------------------------------- --# 4 X Steady underline cursor --# 5 X --# -------------------------------------------- --# 6 X Screen blanking timer (ON) --# X Screen blanking timer (OFF) --# -------------------------------------------- --# 7 X Page attributes --# X Line attributes --# -------------------------------------------- --# 8 X DCD disconnected --# X DCD connected --# -------------------------------------------- --# 9 X DSR disconnected --# X DSR connected --# -------------------------------------------- --# 10 X DTR Disconnected --# X DTR connected --# -------------------------------------------- --# --# (tvi925: BSD has <clear=\E*>. I got <is2> and <ri> from there -- esr) --tvi925|televideo 925, -- OTbs, am, bw, hs, ul, -- cols#80, lines#24, xmc#1, -- bel=^G, cbt=\EI, clear=^Z, cnorm=\E.4, cr=^M, cub1=^H, cud1=^V, -- cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, -- cvvis=\E.2, dch1=\EW, dl1=\ER, dsl=\Eh, ed=\EY, el=\ET, -- flash=\Eb$<200>\Ed, fsl=^M\Eg, home=^^, ht=^I, hts=\E1, -- ich1=\EQ, il1=\EE, ind=^J, invis@, is2=\El\E", kbs=^H, kclr=^Z, -- kcub1=^H, kcud1=^V, kcuf1=^L, kcuu1=^K, kdch1=\EW, kdl1=\ER, -- ked=\EY, kel=\ET, kf0=^AI\r, kf1=^A@\r, kf2=^AA\r, kf3=^AB\r, -- kf4=^AC\r, kf5=^AD\r, kf6=^AE\r, kf7=^AF\r, kf8=^AG\r, -- kf9=^AH\r, khome=^^, kich1=\EQ, kil1=\EE, ri=\Ej, tbc=\E3, -- tsl=\Eh\Ef, use=adm+sgr, --# TeleVideo 925 from Mitch Bradley <sun!wmb> via BRL --# to avoid "magic cookie" standout glitch: --tvi925-hi|TeleVideo Model 925 with half intensity standout mode, -- xmc@, -- kbs=^H, kcub1=^H, kcud1=^J, rmso=\E(, smso=\E), use=tvi925, -- --# From: Todd Litwin <litwin@litwin.jpl.nasa.gov> 28 May 1993 --# Originally Tim Curry, Univ. of Central Fla., <duke!ucf-cs!tim> 5/21/82 --# for additional capabilities, --# The following tvi descriptions from B:pjphar and virus!mike --# is for all 950s. It sets the following attributes: --# full duplex (\EDF) write protect off (\E() --# conversation mode (\EC) graphics mode off (\E%) --# white on black (\Ed) auto page flip off (\Ew) --# turn off status line (\Eg) clear status line (\Ef\r) --# normal video (\E0) monitor mode off (\EX or \Eu) --# edit mode (\Er) load blank char to space (\Ee\040) --# line edit mode (\EO) enable buffer control (^O) --# protect mode off (\E\047) duplex edit keys (\El) --# program unshifted send key to send line all (\E016) --# program shifted send key to send line unprotected (\E004) --# set the following to nulls: --# field delimiter (\Ex0\200\200) --# line delimiter (\Ex1\200\200) --# start-protected field delimiter (\Ex2\200\200) --# end-protected field delimiter (\Ex3\200\200) --# set end of text delimiter to carriage return/null (\Ex4\r\200) --# --# TVI 950 Switch Setting Reference Charts --# --# TABLE 1: --# --# S1 1 2 3 4 5 6 7 8 9 10 --# +-----------------------+-----+-----+-----------------------+ --# | Computer Baud Rate |Data |Stop | Printer Baud Rate | --# | |Bits |Bits | | --# +------+-----------------------+-----+-----+-----------------------+ --# | Up | See | 7 | 2 | See | --# +------+-----------------------+-----+-----+-----------------------+ --# | Down | TABLE 2 | 8 | 1 | TABLE 2 | --# +------+-----------------------+-----+-----+-----------------------+ --# --# --# S2 1 2 3 4 5 6 7 8 9 10 --# +-----+-----+-----------------+-----+-----------+-----+-----+ --# |Edit |Cursr| Parity |Video|Transmiss'n| Hz |Click| --# +------+-----+-----+-----------------+-----+-----------+-----+-----+ --# | Up | Dplx|Blink| See |GonBk| See | 60 | Off | --# +------+-----+-----+-----------------+-----+-----------+-----+-----+ --# | Down |Local|St'dy| TABLE 3 |BkonG| CHART | 50 | On | --# +------+-----+-----+-----------------+-----+-----------+-----+-----+ --# --# TABLE 2: --# --# +-----------+-----+-----+-----+-----+-----------+ --# | Display | 1 | 2 | 3 | 4 | Baud | --# +-----------+-----+-----+-----+-----+ | --# | Printer | 7 | 8 | 9 | 10 | Rate | --# +-----------+-----+-----+-----+-----+-----------+ --# | D | D | D | D | 9600 | --# | U | D | D | D | 50 | --# | D | U | D | D | 75 | --# | U | U | D | D | 110 | --# | D | D | U | D | 135 | --# | U | D | U | D | 150 | --# | D | U | U | D | 300 | --# | U | U | U | D | 600 | --# | D | D | D | U | 1200 | --# | U | D | D | U | 1800 | --# | D | U | D | U | 2400 | --# | U | U | D | U | 3600 | --# | D | D | U | U | 4800 | --# | U | D | U | U | 7200 | --# | D | U | U | U | 9600 | --# | U | U | U | U | 19200 | --# +-----+-----+-----+-----+-----------+ --# --# TABLE 3: --# +-----+-----+-----+-----------+ --# | 3 | 4 | 5 | Parity | --# +-----+-----+-----+-----------+ --# | X | X | D | None | --# | D | D | U | Odd | --# | D | U | U | Even | --# | U | D | U | Mark | --# | U | U | U | Space | --# +-----+-----+-----+-----------+ --# X = don't care --# --# CHART: --# +-----+-----+-----------------+ --# | 7 | 8 | Communication | --# +-----+-----+-----------------+ --# | D | D | Half Duplex | --# | D | U | Full Duplex | --# | U | D | Block | --# | U | U | Local | --# +-----+-----+-----------------+ --# --# (tvi950: early versions had obsolete ":ma=^Vj^Kk^Hh^Ll^^H:". --# I also inserted <ich1> and <kich1>; the :ko: string indicated that <ich> --# should be present and all tvi native modes use the same string for this. --# Finally, note that BSD has cud1=^V. -- esr) --tvi950|televideo 950, -- OTbs, am, hs, mir, msgr, xenl, xon, -- cols#80, it#8, lines#24, xmc#1, -- acsc=b\011c\014d\re\ni\013, bel=^G, cbt=\EI, clear=\E*, -- cr=^M, cub1=^H, cud1=^J, cuf1=^L, -- cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW, -- dl1=\ER, dsl=\Eg\Ef\r, ed=\Ey, el=\Et, flash=\Eb$<200/>\Ed, -- fsl=^M, home=^^, ht=^I, hts=\E1, ich1=\EQ, il1=\EE, ind=^J, -- invis@, -- is2=\EDF\EC\Ed\EG0\Eg\Er\EO\E'\E(\E%\Ew\EX\Ee \017\011\El\E016\E004\Ex0\0\0\Ex1\0\0\Ex2\0\0\011\Ex3\0\0\Ex4\r\0\Ef\r, -- kbs=^H, kcbt=\EI, kclr=\E*, kcub1=^H, kcud1=^V, kcuf1=^L, -- kcuu1=^K, kdch1=\EW, kdl1=\ER, ked=\Ey, kel=\Et, kf0=^A0\r, -- kf1=^A@\r, kf2=^AA\r, kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, -- kf6=^AE\r, kf7=^AF\r, kf8=^AG\r, kf9=^AH\r, khome=^^, -- kich1=\EQ, kil1=\EE, mc4=\Ea, mc5=\E`, ri=\Ej, rmacs=^X, -- rmir=\Er, smacs=^U, smir=\Eq, tbc=\E3, tsl=\Eg\Ef, -- use=adm+sgr, --# --# is for 950 with two pages adds the following: --# set 48 line page (\E\\2) --# place cursor at page 0, line 24, column 1 (\E-07 ) --# set local (no send) edit keys (\Ek) --# --# two page 950 adds the following: --# when entering ex, set 24 line page (\E\\1) --# when exiting ex, reset 48 line page (\E\\2) --# place cursor at 0,24,1 (\E-07 ) --# set duplex (send) edit keys (\El) when entering vi --# set local (no send) edit keys (\Ek) when exiting vi -+# \ED\EJ\EC hack for ed from Ed Bradford - apparently ed is only -+# extra slow on the last line of the window. - # --tvi950-2p|televideo950 w/2 pages, -- is2=\EDF\EC\Ed\EG0\Eg\Er\EO\E'\E(\E%\Ew\EX\Ee \017\011\Ek\E016\E004\Ex0\0\0\Ex1\0\0\Ex2\0\0\011\Ex3\0\0\Ex4\r\0\E\\2\E-07 \011, -- rmcup=\E\\2\E-07\s, rmkx=\Ek, smcup=\E\\1\E-07\s, -- smkx=\El, use=tvi950, -+# The padding probably should be changed. - # --# is for 950 with four pages adds the following: --# set 96 line page (\E\\3) --# place cursor at page 0, line 24, column 1 (\E-07 ) -+hp2626|hp2626a|hp2626p|hp 2626, -+ da, db, -+ lm#0, pb#19200, -+ ed=\ED\EJ$<500>\EC, indn=\E&r%p1%dD, ip=$<4>, -+ is2=\E&j@\r, rin=\E&r%p1%dU, use=hp+pfk-cr, -+ use=hp+labels, use=scrhp, -+ -+# This entry is for sysline. It allocates a 23 line window with -+# a 115 line workspace for regular use, and a 1 line window for -+# the status line. - # --# four page 950 adds the following: --# when entering ex, set 24 line page (\E\\1) --# when exiting ex, reset 96 line page (\E\\3) --# place cursor at 0,24,1 (\E-07 ) -+# This assumes port 2 is being used. -+# Turn off horizontal line, Create ws #1 with 115 lines, -+# Create ws #2 with 1 line, Create window #1 lines 1-23, -+# Create window #2 lines 24-24, Attach cursor to workspace #1. -+# Note that this clears the tabs so it must be done by tset before -+# it sets the tabs. - # --tvi950-4p|televideo950 w/4 pages, -- is2=\EDF\EC\Ed\EG0\Eg\Er\EO\E'\E(\E%\Ew\EX\Ee \017\011\Ek\E016\E004\Ex0\0\0\Ex1\0\0\Ex2\0\0\011\Ex3\0\0\Ex4\r\0\E\\3\E-07 \011, -- rmcup=\E\\3\E-07\s, rmkx=\Ek, smcup=\E\\1\E-07\s, -- smkx=\El, use=tvi950, -+hp2626-s|hp 2626 using only 23 lines, -+ eslok, hs, -+ lines#23, -+ fsl=\E&d@\E&w7f2p1I\E&w4f1I, -+ is1=\E&q3t0{0H \E&w0f115n1I \E&w0f1n2I \E&w2f1i0d0u22l0S \E&w2f2i0d23u23l0S \E&w7f2p1I \r, -+ tsl=\E&w7f2p2I\E&w4f2I\r\EK\E&a%p1%dC, use=hp2626, -+# Force terminal back to 24 lines after being 23. -+hp2626-ns|hp 2626 using all 24 lines, -+ is1=\E&q3t0{0H \E&w0f118n1I \E&w0f1n2I \E&w2f1i0d0u23l0S \E&w3f2I \E&w7f2p1I \r, -+ use=hp2626, -+# Various entries useful for small windows on 2626. -+hp2626-12|hewlett-packard 2626 12 lines, -+ lines#12, use=hp2626, -+hp2626-12x40|hewlett-packard 2626 12 lines 40 columns, -+ cols#40, lines#12, use=hp2626, -+hp2626-x40|hewlett-packard 2626 40 columns, -+ cols#40, use=hp2626, -+hp2626-12-s|hewlett-packard 2626 11 lines plus status, -+ lines#11, use=hp2626-s, -+ - # --# <is2> for reverse video 950 changes the following: --# set reverse video (\Ed) -+# hp2627 color tubes from University of Wisconsin - # --# set vb accordingly (\Ed ...delay... \Eb) -+hp2627a-rev|hp 2627 with reverse video colors, -+ cr=^M, cud1=^J, ht=^I, ind=^J, -+ is2=\E&v0m1a0b0c1x1y1z1i0a0b1c1x1y1z0i0S\E&j@\r\E3\r, -+ kbs=^H, kcub1=^H, kcud1=^J, nel=^M^J, rmul=\E&v0S\E&d@, -+ smul=\E&dD\E&v1S, use=hp2621-nl, -+hp2627a|hp 2627 color terminal with no labels, -+ cr=^M, cud1=^J, ht=^I, ind=^J, -+ is2=\E&v0m1a1b0c1i0a1b1c2i1a0b0c0i0S\E&j@\r\E3\r, -+ kbs=^H, kcub1=^H, kcud1=^J, nel=^M^J, rmso=\E&v0S, -+ rmul=\E&v0S\E&d@, smso=\E&v2S, smul=\E&dD\E&v1S, -+ use=hp2621-nl, -+hp2627c|hp 2627 color (cyan) terminal with no labels, -+ cr=^M, cud1=^J, ht=^I, ind=^J, -+ is2=\E&v0m1a0b0c2i1a1b0c1i0a1b1c0i0S\E&j@\r\E3\r, -+ kbs=^H, kcub1=^H, kcud1=^J, nel=^M^J, use=hp2627a, -+ -+# hp2640a doesn't have the Y cursor addressing feature, and C is -+# memory relative instead of screen relative, as we need. - # --tvi950-rv|televideo950 rev video, -- flash=\Ed$<200/>\Eb, -- is2=\EDF\EC\Eb\EG0\Eg\Er\EO\E'\E(\E%\Ew\EX\Ee \017\011\El\E016\E004\Ex0\0\0\Ex1\0\0\Ex2\0\0\011\Ex3\0\0\Ex4\r\0, -- use=tvi950, -+hp2640a|hp 2640a, -+ cup@, rmkx@, smkx@, use=hp2645, - --# tvi950-rv-2p uses the appropriate entries from 950-2p and 950-rv --tvi950-rv-2p|televideo950 rev video w/2 pages, -- flash=\Ed$<200/>\Eb, -- is2=\EDF\EC\Eb\EG0\Eg\Er\EO\E'\E(\E%\Ew\EX\Ee \017\011\Ek\E016\E004\Ex0\0\0\Ex1\0\0\Ex2\0\0\011\Ex3\0\0\Ex4\r\0\E\\2\E-07\s, -- rmcup=\E\\2\E-07\s, rmkx=\Ek, smcup=\E\\1\E-07\s, -- smkx=\El, use=tvi950, -+hp2640b|hp2644a|hp 264x series, -+ rmkx@, smkx@, use=hp2645, - --# tvi950-rv uses the appropriate entries from 950-4p and 950-rv --tvi950-rv-4p|televideo950 rev video w/4 pages, -- flash=\Ed$<200/>\Eb, -- is2=\EDF\EC\Eb\EG0\Er\EO\E'\E(\E%\Ew\EX\Ee \017\011\Ek\E016\E004\Ex0\0\0\Ex1\0\0\Ex2\0\0\011\Ex3\0\0\Ex4\r\0\E\\3\E-07\s, -- rmcup=\E\\3\E-07\s, rmkx=\Ek, smcup=\E\\1\E-07\s, -- smkx=\El, use=tvi950, --# From: Andreas Stolcke <stolcke@icsi.berkeley.edu> --# (tvi955: removed obsolete ":ma:=^Vj^Kk^Hh^Ll^^H"; --# removed incorrect (and overridden) ":do=^J:"; fixed broken continuations in --# the :rs: string, inserted the <ich> implied by the termcap :ko: string. Note --# the :ko: string had :cl: in it, which means that one of the original --# <clear=\E*>, <kclr=\EY> had to be wrong; set <kclr=\E*> because that's what --# the 950 has. Finally, corrected the <kel> string to match the 950 and what --# ko implies -- esr) --# If the BSD termcap file was right, <cup=\E=%p1%{32}%+%c%p2%{32}%+%c> would --# also work. --tvi955|televideo 955, -- OTbs, mc5i, msgr@, -- it#8, xmc@, -- acsc=0_`RjHkGlFmEnIoPqKsQtMuLvOwNxJ, blink=\EG2, -- civis=\E.0, cnorm=\E.2, cud1=^V, cup=\E[%i%p1%d;%p2%dH, -- cvvis=\E.1, dim=\E[=5h, ind@, invis=\EG1, -- is2=\E[=3l\EF1\Ed\EG0\E[=5l\E%\El, kctab=\E2, khts=\E1, -- knp=\EK, kpp=\EJ, krmir=\EQ, ktbc=\E3, mc0=\EP, rmacs=\E%%, -- rmam=\E[=7l, rmxon=^N, -- rs1=\EDF\EC\Eg\Er\EO\E'\E(\Ew\EX\Ee \017\E0P\E6\0\E0p\E4\0\Ef\r, -- sgr0=\EG0\E[=5l, smacs=\E$, smam=\E[=7h, smxon=^O, -- use=tvi950, --tvi955-w|955-w|televideo955 w/132 cols, -- cols#132, -- is2=\E[=3h\EF1\Ed\EG0\E[=5l\E%\El, use=tvi955, --# use half-intensity as normal mode, full intensity as <bold> --tvi955-hb|955-hb|televideo955 half-bright, -- bold=\E[=5l, dim@, is2=\E[=3l\EF1\Ed\EG0\E[=5h\E%\El, -- sgr0=\EG0\E[=5h, use=tvi955, --# From: Humberto Appleton <beto@cs.utexas.edu>, 880521 UT Austin --# (tvi970: removed ":sg#0:"; removed <rmso>=\E[m, <rmul>=\E[m; --# added <am>/<csr>/<home>/<hpa>/<vpa>/<smcup>/<rmcup> from BRL. --# According to BRL we could have <rmkx>=\E>, <smkx>=\E= but I'm not sure what --# it does to the function keys. I deduced <rmam>/<smam>. --# also added empty <acsc> to suppress tic warning, -- esr) --tvi970|televideo 970, -- OTbs, OTpt, am, da, db, mir, msgr, -- cols#80, it#8, lines#24, -- acsc=, cbt=\E[Z, clear=\E[H\E[2J, csr=\E[%i%p1%d;%p2%dr, -- cub1=^H, cud1=\ED, cuf1=\E[C, cup=\E[%i%p1%d;%p2%df, -- cuu1=\EM, cvvis=\E[1Q, dch1=\E[P, dl1=\E[M, dsl=\Eg\Ef\r, -- ed=\E[J, el=\E[K, flash=\E[5m$<200/>\E[m, home=\E[H, -- hpa=\E[%i%p1%dG, ht=^I, il1=\E[L, -- is2=\E<\E[?21l\E[19h\E[1Q\E[10l\E[7l\E[H\E[2J, -- kbs=^H, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, -- kf1=\E?a, kf2=\E?b, kf3=\E?c, kf4=\E?d, kf5=\E?e, kf6=\E?f, -- kf7=\E?g, kf8=\E?h, kf9=\E?i, khome=\E[H, ri=\EM, rmacs=\E(B, -- rmam=\E[?7h, rmcup=, rmir=\E[4l, rmso=\E[m, rmul=\E[m, -- sgr0=\E[m, smacs=\E(B, smam=\E[?7l, -- smcup=\E[?20l\E[?7h\E[1Q, smir=\E[4h, smso=\E[7m, -- smul=\E[4m, vpa=\E[%i%p1%dd, --tvi970-vb|televideo 970 with visual bell, -- flash=\E[?5h\0\0\0\0\0\0\0\0\0\0\0\0\0\E[?5l, -- use=tvi970, --tvi970-2p|televideo 970 with using 2 pages of memory, -- rmcup=\E[H\E[J\E[V, smcup=\E[U\E[?20l\E[?7h\E[1Q, -- use=tvi970, --# Works with vi and rogue. NOTE: Esc v sets autowrap on, Esc u sets 80 chars --# per line (rather than 40), Esc K chooses the normal character set. Not sure --# padding is needed, but adapted from the tvi920c termcap. The <smso> and --# <smul> strings are klutzy, but at least use no screen space. --# (tvipt: removed obsolete ":ma=^Kk^Ll^R^L:". I wish we knew <rmam>, --# its absence means <smam>=\Ev isn't safe to use. -- esr) --# From: Gene Rochlin <armsis@amber.berkeley.edu> 9/19/84. --# The <ed>/<kf0>/<kf1>/<khome>/<mc4>, and <mc5> caps are from BRL, which says: --# F1 and F2 should be programmed as ^A and ^B; required for UNIFY. --tvipt|televideo personal terminal, -- OTbs, am, -+# (hp2641a: removed unknown :gu: -- esr) -+hp2641a|hp2645a|hp2647a|HP 264?A series BRL entry, -+ am, da, db, mir, xhp, - cols#80, lines#24, -- cbt=\EI, clear=^Z, cub1=^H, cuf1=^L, -- cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dl1=\ER$<5*>, -- ed=\EY, el=\ET, home=^^, if=/usr/share/tabset/stdcrt, -- il1=\EE$<5*>, is2=\Ev\Eu\EK, kbs=^H, kcub1=^H, kcud1=^J, -- kcuf1=^L, kcuu1=^K, kf0=^A, kf1=^B, khome=^^, mc4=^T, mc5=^R, -- rmso=\EF, rmul=\EF, smso=\EG1@A\EH, smul=\EG1B@\EH, --# From: Nathan Peterson <nathan@sco.com>, 03 Sep 1996 --tvi9065|televideo 9065, -- am, bw, chts, hs, mc5i, mir, msgr, xenl, xon, -- cols#80, it#8, lh#1, lines#25, lm#0, lw#9, ma#4, nlab#8, vt#0, -- wnum#0, wsl#30, -- acsc='r0_jhkglfmeniopqksqtmulvownxj, bel=^G, -- blink=\EG2, bold=\EG\,, cbt=\EI, civis=\E.0, clear=^Z, -- cnorm=\E.3, cr=^M, csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, -- cub1=^H, cud=\E[%p1%dB, cud1=^V, cuf=\E[%p1%dC, cuf1=^L, -- cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu=\E[%p1%dA, -- cuu1=^K, cvvis=\E.2, dch=\E[%p1%dP, dch1=\EW, dim=\EGp, -- dl=\E[%p1%dM, dl1=\ER, dsl=\E_30\r, ech=\E[%p1%d@, ed=\EY, -- el=\ET, flash=\Eb$<15>\Ed, fsl=^M, home=^^, ht=^I, hts=\E1, -- ich=\E[%p1%d@, if=/usr/share/tabset/stdcrt, -- il=\E[%p1%dL, il1=\EE, ind=^J, indn=\E[%p1%dS, invis=\EG1, -- ip=$<3>, -- is1=\E"\E%\E'\E(\EG@\EO\EX\E[=5l\E[=6l\E[=7h\Ed\Er, -- is2=\EF2\EG0\E\\L, is3=\E<\E[=4l\E[=8h, kHOM=\E\s\s\s, -- kbs=^H, kcbt=\EI, kcub1=^H, kcud1=^V, kcuf1=^L, kcuu1=^K, -- kdch1=\EW, kf1=^A@\r, kf10=^AI\r, kf11=^AJ\r, kf12=^AK\r, -- kf2=^AA\r, kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, kf6=^AE\r, -- kf7=^AF\r, kf8=^AG\r, kf9=^AH\r, khome=^^, ll=\E[25;1H, -- mc0=\E[0;0i, mc4=\Ea, mc5=\E`, nel=^M^J, -- pfkey=\E|%p1%{48}%+%c3%p2%s\031, -- pfloc=\E|%p1%{48}%+%c2%p2%s\031, -- pfx=\E|%p1%{48}%+%c1%p2%s\031, -- pln=\E_%p1%{63}%+%c%p2%s\r, prot=\E&, -- rep=\E[%p2%db%p1%c, rev=\EG4, -- rf=/usr/share/tabset/stdcrt, ri=\Ej, rin=\E[%p1%dT, -- rmacs=\E%%, rmam=\E[=7l, rmcup=\E.3\Er\E[1;25r\E[25;0H, -- rmdc=\0, rmir=\Er, rmln=\E[4;1v, rmso=\EG0, rmul=\EG0, -- rmxon=^N, rs1=\EC\EDF\E[0;0v\E[8;1v\E[=65l, -- rs2=\E.b\E[10;20v\E[14;1v\E[3;0v\E[7;0v\E[=11.h\E[=12.h\E[=13.h\E[=14.h\E[=15l\E[=20h\E[=60l\E[=61h\E[=9l\E[=10l\E[=21l\E[=23l\E[=3l\E_40\E_50\En\Ew\Ee \Ex0\0\0\Ex1\0\0\Ex2\0\0\Ex3\0\0\Ex4\0\0\E1, -- rs3=\E[=19h\E.3\E9\E0O\0\0\0\0\0\E0o\0\0\0\0\0\E0J\177\0\0\0\0, -- sgr=\EG0%?%p1%t\EGt%;%?%p2%t\EG8%;%?%p3%t\EG4%;%?%p4%t\EG2%;%?%p5%t\EGp%;%?%p6%t\EG\,%;%?%p7%t\EG1%;%?%p9%t\E$%e\E%%%;, -- sgr0=\EG0, smacs=\E$, smam=\E=7h, smcup=\E.2, smdc=\Er, -- smir=\Eq, smln=\E[4;2v, smso=\EGt, smul=\EG8, smxon=^O, -- tbc=\E3, tsl=\E[4;1v\E_30, uc=\EG8\EG0, -+ bel=^G, clear=\EH\EJ, cr=^M, cub1=^H, cud1=^J, cuf1=\EC, -+ cup=\E&a%p2%2dc%p1%2dY, cuu1=\EA, dch1=\EP, dl1=\EM, -+ ed=\EJ, el=\EK, hpa=\E&a%p1%2dC, ht=^I, -+ if=/usr/share/tabset/std, il1=\EL, ind=^J, -+ is2=\EE$<500/>, kbs=^H, kcub1=^H, kcud1=^J, nel=^M^J, -+ rmir=\ER, rmso=\E&d@, smir=\EQ, smso=\E&dB, -+ vpa=\E&a%p1%2dY, - --#### Visual (vi) -+# This terminal should be used at 4800 baud or less. It needs padding for -+# plain characters at 9600, I guessed at an appropriate cr delay. It really -+# wants ^E/^F handshaking, but that doesn't work well even if you write -+# software to support it. -+hp2645|hp45|HP 2645 series, -+ pb#9600, -+ blink=\E&dA, cr=\r$<20>, dim=\E&dH, kctab=\E2, kcub1=\ED, -+ kcud1=\EB, kcuf1=\EC, kcuu1=\EA, kdch1=\EP, kdl1=\EM, -+ ked=\EJ, kel=\EK, khome=\Eh, khts=\E1, kich1=\EQ, kil1=\EL, -+ kind=\ES, knp=\EU, kpp=\EV, kri=\ET, krmir=\ER, rev=\E&dB, -+ rmkx=\E&s0A, -+ sgr=\E&d%{64}%?%p1%t%{66}%|%;%?%p2%t%{68}%|%;%?%p3%t%{66}%|%;%?%p4%t%{65}%|%;%?%p5%t%{72}%|%;%?%p6%t%{66}%|%;%c, -+ sgr0=\E&d@, smkx=\E&s1A, smul=\E&dD, use=hpgeneric, -+# You should use this terminal at 4800 baud or less. -+hp2648|hp2648a|HP 2648a graphics terminal, -+ clear=\EH\EJ$<50>, cup=\E&a%p2%dc%p1%dY$<20>, -+ dch1=\EP$<7>, ip=$<5>, use=hp2645, -+ -+# The HP 150 terminal is a fairly vanilla HP terminal, with the -+# clreol standout problem. It also has graphics capabilities and -+# a touch screen, which we don't describe here. -+hp150|hewlett packard Model 150, -+ OTbs, use=hp2622, -+ -+# HP 2382a terminals, "the little ones." They don't have any -+# alternate character set support and sending out ^N/^O will -+# leave the screen blank. -+hp2382a|hp2382|hewlett packard 2382a, -+ da, db, -+ lh#1, lm#48, -+ acsc@, -+ pln=\E&f0a%p1%dk%p2%l%Pa%?%ga%t%ga%d%e1%;d0L%?%ga%!%t %;%p2%s, -+ rmacs@, -+ sgr=\E&d%{0}%Pa%?%p4%t%{1}%ga%+%Pa%;%?%p1%p3%|%p6%|%t%{2}%ga%+%Pa%;%?%p2%p6%|%t%{4}%ga%+%Pa%;%?%p1%p5%|%t%{8}%ga%+%Pa%;%?%p7%t%?%ga%ts%ga%{64}%+%e%{83}%;%e%?%ga%t%ga%{64}%+%e%{64}%;%;%c, -+ sgr0=\E&d@, smacs@, use=hp+labels, use=scrhp, -+ -+hp2621-a|hp2621a-a|hp2621 with fn as arrows, -+ use=hp+pfk+arrows, use=hp2621-fl, -+ -+# newer hewlett packard terminals -+ -+newhpkeyboard|generic entry for HP extended keyboard, -+ kbs=^H, kcbt=\Ei, kclr=\EJ, kcub1=\ED, kcud1=\EB, kcuf1=\EC, -+ kcuu1=\EA, kdch1=\EP, kdl1=\EM, ked=\EJ, kel=\EK, khome=\Eh, -+ kich1=\EQ, kil1=\EL, kind=\ET, kll=\EF, knp=\EU, kpp=\EV, -+ kri=\ES, krmir=\ER, rmkx=\E&s0A, smkx=\E&s1A, -+ use=hp+pfk-cr, -+ -+newhp|generic entry for new hewlett packard terminals, -+ am, bw, mir, xhp, xon, -+ cols#80, lines#24, pb#4800, -+ acsc=2[3@4>5I9(\:'JSKWLQMAO#P$Q;R!S"T1U2V4W3X\:Y+Z*dHjGkTlRmFn/q\,t5u6v8w7x., -+ bel=^G, blink=\E&dA, bold=\E&dF, cbt=\Ei, cr=^M, cub1=^H, -+ cud1=^J, cuf1=\EC, cuu1=\EA, dch1=\EP$<2>, dim=\E&dH, -+ dl1=\EM, ed=\EJ, el=\EK, ht=\011$<2>, hts=\E1, il1=\EL, ind=^J, -+ invis=\E&dS, ip=$<2>, is1=\E&jB$<8>, nel=^M^J, -+ pfkey=\E&f0a%p1%dk0d%p2%l%dL%p2%s, -+ pfloc=\E&f1a%p1%dk0d%p2%l%dL%p2%s, -+ pfx=\E&f2a%p1%dk0d%p2%l%dL%p2%s, rev=\E&dB, ri=\ET, -+ rmacs=^O, rmir=\ER, rmso=\E&d@, rmul=\E&d@, rs1=\Eg, -+ sgr=\E&d%{0}%Pa%?%p4%t%{1}%ga%+%Pa%;%?%p1%p3%|%p6%|%t%{2}%ga%+%Pa%;%?%p2%p6%|%t%{4}%ga%+%Pa%;%?%p1%p5%|%t%{8}%ga%+%Pa%;%?%p7%t%?%ga%ts%ga%{64}%+%e%{83}%;%e%?%ga%t%ga%{64}%+%e%{64}%;%;%c%?%p9%t\016%e\017%;, -+ sgr0=\E&d@\017, smacs=^N, smir=\EQ, smso=\E&dJ, smul=\E&dD, -+ tbc=\E3, use=newhpkeyboard, -+ -+memhp|memory relative addressing for new HP ttys, -+ vt#6, -+ clear=\EH\EJ$<40>, cub=\E&a-%p1%dC, cud=\E&a+%p1%dR, -+ cuf=\E&a+%p1%dC, cup=\E&a%p1%dr%p2%dC, cuu=\E&a-%p1%dR, -+ home=\EH, hpa=\E&a%p1%dC, ll=\E&a23R\r, -+ mrcup=\E&a%p1%dr%p2%dC, vpa=\E&a%p1%dR, use=newhp, -+ -+scrhp|screen relative addressing for new HP ttys, -+ clear=\E&a0c0Y\EJ$<40>, cub=\E&a-%p1%dC, -+ cud=\E&a+%p1%dR, cuf=\E&a+%p1%dC, -+ cup=\E&a%p1%dy%p2%dC$<10>, cuu=\E&a-%p1%dR, -+ home=\E&a0y0C, hpa=\E&a%p1%dC, ll=\E&a0y0C\EA, -+ mrcup=\E&a%p1%dr%p2%dC, vpa=\E&a%p1%dY, use=newhp, -+ -+# (hp+labels: added label values from a BRL termcap -- esr) -+hp+labels|"standard" label info for new HP ttys, -+ lh#2, lw#8, nlab#8, -+ lf0=f1, lf1=f2, lf2=f3, lf3=f4, lf4=f5, lf5=f6, lf6=f7, lf7=f8, -+ pln=\E&f2a%p1%dk%p2%l%Pa%?%ga%t%ga%d%e1%;d0L%?%ga%!%t %;%p2%s, -+ rmln=\E&j@, smln=\E&jB, -+ -+hp+printer|"standard" printer info for HP ttys, -+ ff=\E&p4u0C, mc0=\EH\E&p4dF, mc4=\E&p13C, mc5=\E&p11C, -+ -+ -+# The new hp2621b is kind of a cross between the old 2621 and the -+# new 262x series of machines. It has dip-switched options. -+# The firmware has a bug in it such that if you give it a null -+# length label, the following character is eaten! -+hp2621b|hp 2621b with old style keyboard, -+ lh#1, lm#48, lw#8, nlab#8, -+ kcub1=\ED, kcud1=\EB, kcuf1=\EC, kcuu1=\EA, khome=\Eh, -+ kind=\ET, kll=\EF, kri=\ES, -+ pln=\E&f0a%p1%dk%p2%l%Pa%?%ga%t%ga%d%e1%;d3L%?%ga%!%t%{32}%c%;%p2%s\E%{111}%p1%+%c\r, -+ smln=\E&jB, use=hp2621, -+ -+hp2621b-p|hp 2621b with printer, -+ use=hp+printer, use=hp2621b, -+ -+# hp2621b - new 2621b with new extended keyboard -+# these are closer to the new 26xx series than the other 2621b -+hp2621b-kx|hp 2621b with extended keyboard, -+ use=newhpkeyboard, use=hp2621b, -+ -+hp2621b-kx-p|hp 2621b with new keyboard & printer, -+ use=hp+printer, use=hp2621b-kx, -+ -+# Some assumptions are made in the following entries. -+# These settings are NOT set up by the initialization strings. - # --# In September 1993, Visual Technology of Westboro, Massachusetts, --# merged with White Pine Software of Nashua, New Hampshire. -+# Port Configuration -+# RecvPace=Xon/Xoff XmitPace=Xon/Xoff StripNulDel=Yes -+# -+# Terminal Configuration -+# InhHndShk(G)=Yes InhDC2(H)=Yes -+# XmitFnctn(A)=No InhEolWrp=No - # --# White Pine Software may be contacted at +1 603/886-9050. --# Or visit White Pine on the World Wide Web at URL http://www.wpine.com. - # -+# Hp 2622a & hp2623a display and graphics terminals -+# -+hp2622|hp2622a|hp 2622, -+ da, db, -+ lm#0, pb#19200, -+ is2=\E&dj@\r, use=hp+pfk-cr, use=hp+labels, use=scrhp, - --# Visual 50 from Beau Shekita, BTL-Whippany <whuxlb!ejs> --# Recently I hacked together the following termcap for Visual --# Technology's Visual 50 terminal. It's a slight modification of --# the vt52 termcap. --# It's intended to run when the Visual 50 is in vt52 emulation mode --# (I know what you're thinking; if it's emulating a vt52, then why --# another termcap? Well, it turns out that the Visual 50 can handle --# <dl1> and db(?) among other things, which the vt52 can't) --# The termcap works OK for the most part. The only problem is on --# character inserts. The whole line gets painfully redrawn for each --# character typed. Any suggestions? --# Beau's entry is combined with the vi50 entry from University of Wisconsin. --# Note especially the <il1> function. <kf4>-<kf6> are really l4-l6 in --# disguise; <kf7>-<kf9> are really l1-l3. --vi50|visual 50, -- OTbs, OTpt, am, da, db, msgr, -- cols#80, it#8, lines#24, -- OTnl=^J, bel=^G, cbt=\Ez$<4/>, clear=\EH\EJ, cr=^M, cub1=^H, -- cud1=\EB, cuf1=\EC, cup=\EY%p1%{32}%+%c%p2%{32}%+%c, -- cuu1=\EA, dl1=\EM$<3*/>, ed=\EJ, el=\EK$<16/>, home=\EH, -- ht=^I, il1=\EL, ind=^J, kbs=^H, kcub1=\ED, kcud1=\EB, -- kcuf1=\EC, kcuu1=\EA, kf1=\EP, kf2=\EQ, kf3=\ER, kf4=\EV, -- kf5=\EE, kf6=\E], kf7=\EL, kf8=\Ev, kf9=\EM, khome=\EH, -- nel=^M^J, ri=\EI, rmso=\ET, rmul=\EW, smso=\EU, smul=\ES, --# this one was BSD & SCO's vi50 --vi50adm|visual 50 in adm3a mode, -- am, msgr, -- cols#80, it#8, lines#24, -- bel=^G, clear=^Z, cr=^M, cub1=^H, cud1=^J, cuf1=^L, -- cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dl1=\EM, -- ed=\Ek, el=\EK, home=\EH, ht=^I, il1=\EL, ind=^J, kbs=^H, -- kcub1=\ED, kcud1=\EB, kcuf1=\EC, kcuu1=\EA, khome=\EH, -- rmso=\ET, smso=\EU, --# From: Jeff Siegal <jbs@quiotix.com> --vi55|Visual 55, -- OTbs, am, mir, msgr, -- cols#80, it#8, lines#24, -- clear=\Ev, csr=\E_%p1%{65}%+%c%p2%{65}%+%c, cub1=^H, -- cud1=^J, cuf1=\EC, cup=\EY%p1%{32}%+%c%p2%{32}%+%c, -- cuu1=\EA, dch1=\Ew, dl1=\EM, ed=\EJ, el=\EK, home=\EH, ht=^I, -- il1=\EL, is2=\Ev\E_AX\Eb\EW\E9P\ET, kbs=^H, kcub1=\ED, -- kcud1=\EB, kcuf1=\EC, kcuu1=\EA, ri=\EI, rmir=\Eb, rmso=\ET, -- smir=\Ea, smso=\EU, -+# The 2623 is a 2622 with extra graphics hardware. -+hp2623|hp2623a|hp 2623, -+ use=hp2622, - --# Visual 200 from BRL --# The following switch settings are assumed for normal operation: --# FULL_DUPLEX SCROLL CR --# AUTO_NEW_LINE_ON VISUAL_200_EMULATION_MODE --# Other switches may be set for operator convenience or communication --# requirements. --# Character insertion is kludged in order to get around the "beep" misfeature. --# (This cap is commented out because <smir>/<rmir> is more efficient -- esr) --# Supposedly "4*" delays should be used for <il1>, <ed>, <clear>, <dch1>, --# and <dl1> strings, but we seem to get along fine without them. --vi200|visual 200, -- OTbs, OTpt, am, mir, msgr, -- OTkn#10, cols#80, it#8, lines#24, -- acsc=, bel=^G, cbt=\Ez, clear=\Ev, cnorm=\Ec, cr=^M, cub1=^H, -- cud1=^J, cuf1=\EC, cup=\EY%p1%{32}%+%c%p2%{32}%+%c, -- cuu1=\EA, cvvis=\Ed, dch1=\EO, dim=\E4, dl1=\EM, ed=\Ey, -- el=\Ex, home=\EH, ht=^I, hts=\E1, il1=\EL, ind=^J, invis=\Ea, -- kbs=^H, kclr=\Ev, kctab=\E2, kcub1=\ED, kcud1=\EB, kcuf1=\EC, -- kcuu1=\EA, kdch1=\EO, kdl1=\EM, ked=\EJ, kel=\Et, kf0=\E?p, -- kf1=\E?q, kf2=\E?r, kf3=\E?s, kf4=\E?t, kf5=\E?u, kf6=\E?v, -- kf7=\E?w, kf8=\E?x, kf9=\E?y, khome=\EH, khts=\E1, kich1=\Ei, -- kil1=\EL, krmir=\Ej, mc0=\EH\E], mc4=\EX, mc5=\EW, ri=\EI, -- rmacs=\EG, rmkx=\E>, rmso=\E3, -- rs1=\E3\Eb\Ej\E\El\EG\Ec\Ek\EX, sgr0=\E3\Eb, smacs=\EF, -- smkx=\E=, smso=\E4, tbc=\Eg, --# The older Visuals didn't come with function keys. This entry uses --# <smkx> and <rmkx> so that the keypad keys can be used as function keys. --# If your version of vi doesn't support function keys you may want --# to use vi200-f. --vi200-f|visual 200 no function keys, -- is2=\E3\Eb\Ej\E\\\El\EG\Ed\Ek, kf0=\E?p, kf1=\E?q, -- kf2=\E?r, kf3=\E?s, kf4=\E?t, kf5=\E?u, kf6=\E?v, kf7=\E?w, -- kf8=\E?x, kf9=\E?y, rmkx=\E>, rmso@, smkx=\E=, smso@, -- use=vi200, --vi200-rv|visual 200 reverse video, -- cnorm@, cvvis@, ri@, rmso=\E3, smso=\E4, use=vi200, -+hp2624b-p|hp2624b-4p-p|hewlett packard 2624 B with printer, -+ use=hp+printer, use=hp2624, - --# the function keys are programmable but we don't reprogram them to their --# default values with <is2> because programming them is very verbose. maybe --# an initialization file should be made for the 300 and they could be stuck --# in it. --# (vi300: added <rmam>/<smam> based on init string -- esr) --vi300|visual 300 ansi x3.64, -- am, bw, mir, xenl, -- cols#80, lines#24, -- bel=^G, cbt=\E[Z, clear=\E[H\E[2J, cr=^M, cub1=^H, cud1=\E[B, -- cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, -- dch1=\E[P$<40>, dl1=\E[M, ed=\E[J, el=\E[K, home=\E[H, ht=^I, -- il1=\E[L, ind=^J, -- is2=\E[7s\E[2;3;4;20;?5;?6l\E[12;?7h\E[1Q\E[0;1(D\E[8s, -- kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, -- kf1=\E_A\E\\, kf2=\E_B\E\\, kf3=\E_C\E\\, kf4=\E_D\E\\, -- kf5=\E_E\E\\, kf6=\E_F\E\\, kf7=\E_G\E\\, kf8=\E_H\E\\, -- kf9=\E_I\E\\, khome=\E[H, ri=\EM, rmam=\E[?7l, rmir=\E[4l, -- rmso=\E[m, rmul=\E[m, sgr0=\E[m, smam=\E[?7h, smir=\E[4h, -- smso=\E[1m, smul=\E[4m, --# some of the vi300s have older firmware that has the command --# sequence for setting editing extent reversed. --vi300-old|visual 300 with old firmware (set edit extent reversed), -- is2=\E[7s\E[2;3;4;20;?5;?6l\E[12;?7h\E[2Q\E[0;1(D\E[8s, -- use=vi300, -+# The hewlett packard B can have an optional extra 6 pages of memory. -+hp2624-10p|hp2624a-10p|hp2624b-10p|hewlett packard 2624 B w/ 10 pages of memory, -+ lm#240, use=hp2624, - --# Visual 500 prototype entry from University of Wisconsin. --# The best place to look for the escape sequences is page A1-1 of the --# Visual 500 manual. The initialization sequence given here may be --# overkill, but it does leave out some of the initializations which can --# be done with the menus in set-up mode. --# The :xp: line below is so that emacs can understand the padding requirements --# of this slow terminal. :xp: is 10 time the padding factor. --# (vi500: removed unknown :xp#4: termcap; --# also added empty <acsc> to suppress tic warning -- esr) --vi500|visual 500, -- am, mir, msgr, -- cols#80, it#8, lines#33, -- acsc=, cbt=\Ez$<4/>, clear=\Ev$<6*/>, cr=^M, -- csr=\E(%p1%{32}%+%c%p2%{32}%+%c, cub1=^H, cud1=\EB, -- cuf1=\EC, cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, -- dch1=\EO$<3*/>, dl1=\EM$<3*/>, ed=\Ey$<3*/>, -- el=\Ex$<16/>, home=\EH, ht=\011$<8/>, il1=\EL\Ex$<3*/>, -- ind=^J, -- is2=\E3\E\001\E\007\E\003\Ek\EG\Ed\EX\El\E>\Eb\E\\, -- kbs=^H, kcub1=\ED, kcud1=\EB, kcuf1=\EC, kcuu1=\EA, -- khome=\EH, nel=^M^J, rmacs=^O, rmir=\Ej, rmso=\E^G, -- rmul=\E^C, smacs=^N, smir=\Ei, smso=\E^H, smul=\E^D, -+hp2624b-10p-p|hewlett packard 2624 B w/ extra memory & printer, -+ lm#240, use=hp2624b-p, - --# The visual 550 is a visual 300 with tektronix graphics, --# and with 33 lines. clear screen is modified here to --# also clear the graphics. --vi550|visual 550 ansi x3.64, -- lines#33, -- clear=\030\E[H\E[2J, use=vi300, -+# Color manipulations for HP terminals -+hp+color|hp with colors, -+ ccc, -+ colors#16, ncv#17, pairs#7, -+ initp=\E&v%?%p2%{1000}%=%t1%e.%p2%d%;a%?%p3%{1000}%=%t1%e.%p3%d%;b%?%p4%{1000}%=%t1%e.%p4%d%;c%?%p5%{1000}%=%t1%e.%p5%d%;x%?%p6%{1000}%=%t1%e.%p6%d%;y%?%p7%{1000}%=%t1%e.%p7%d%;z%p1%dI, -+ oc=\E&v0m1a1b1c0I\E&v1a1I\E&v1b2I\E&v1a1b3I\E&v1c4I\E&v1a1c5I\E&v1b1c6I\E&v1x1y7I, -+ op=\E&v0S, scp=\E&v%p1%dS, - --vi603|visual603|visual 603, -- hs, mir, -- bel=^G, blink=\E[5m, bold=\E[1m, clear=\E[H\E[J, -- csr=\E[%i%p1%d;%p2%dr, cuf1=\E[C, -- cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, dch1=\E[P, dl1=\E[M, -- dsl=\EP2;1~\E\\, ed=\E[J, el=\E[K, fsl=\E\\, il1=\E[L, -- ind=\ED, is1=\E>\E[?3l\E[?4l\E[?7h\E[?8h\E[1;24r, -- rev=\E[7m, ri=\EM, rmir=\E[4l, rmso=\E[27m, rmul=\E[24m, -- sgr0=\E[m, smir=\E[4h, smso=\E[7m, smul=\E[4m, tsl=\EP2~, -- use=vt100, -+# <is2> sets the screen to be 80 columns wide -+hp2397a|hp2397|hewlett packard 2397A color terminal, -+ is2=\E&w6f80X, use=memhp, use=hp+labels, use=hp+color, - --#### Wyse (wy) --# --# Wyse Technology --# 3471 North First Street --# San Jose, CA 95134 --# Vox: (408)-473-1200 --# Fax: (408) 473-1222 --# Web: http://www.wyse.com --# --# Wyse sales can be reached by phone at 1-800-GET-WYSE. Tech support is at --# (800)-800-WYSE (option 5 gets you a human). There's a Web page at the --# obvious address, <http://www.wyse.com>. They keep terminfo entries at --# <http://www.wyse.co.uk/support/appnotes/idxappnt.htm>. --# --# Wyse bought out Link Technology, Inc. in 1990 and closed it down in 1995. --# They now own the Qume and Amdek brands, too. So these are the people to --# talk with about all Link, Qume, and Amdek terminals. --# --# These entries include a few small fixes. --# I canceled the bel capacities in the vb entries. --# I made two trivial syntax fixes in the wyse30 entry. --# I made some entries relative to adm+sgr. -+# HP 700/44 Setup parameters: -+# Terminal Mode HP-PCterm -+# Inhibit Auto Wrap NO -+# Status Line Host Writable -+# PC Character Set YES -+# Twenty-Five Line Mode YES -+# XON/XOFF @128 or 64 (sc) -+# Keycode Mode NO or YES (sc) -+# Backspace Key BS or BS/DEL - # -+# <is2> sets pcterm; autowrap; 25 lines; pc char set; prog DEL key; -+# \E\\? does not turn off keycode mode -+# <smsc> sets alternate start/stop; keycode on -+hpansi|hp700|hewlett packard 700/44 in HP-PCterm mode, -+ am, eo, xenl, xon, -+ cols#80, lines#25, -+ acsc=j\331k\277l\332m\300n\305q\304t\303u\264v\301w\302x\263, -+ bel=^G, cbt=\E[Z, civis=\E[?25l, clear=\E[2J\E[H, -+ cnorm=\E[?25h, cr=^M, cub1=\E[D, cud1=\E[B, cuf1=\E[C, -+ cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, dch1=\E[P, dl1=\E[M, -+ ed=\E[J, el=\E[K, home=\E[H, ht=^I, ich1=\E[@, il1=\E[L, -+ ind=^J, -+ is2=\E[44"p\E[?7h\E[>10h\E[>12h\EP1;1|3/7F\E\\, -+ kbs=^H, kcbt=\E[Z, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, -+ kcuu1=\E[A, kend=\E[4~, kf1=\E[17~, kf10=\E[28~, -+ kf2=\E[18~, kf3=\E[19~, kf4=\E[20~, kf5=\E[21~, kf6=\E[23~, -+ kf7=\E[24~, kf8=\E[25~, kf9=\E[26~, khome=\E[1~, knp=\E[6~, -+ kpp=\E[5~, rmam=\E[?7l, -+ rmsc=\E[>11l\EP1**x0/11;1/13\E[m\E\\, rmso=\E[m, -+ rmul=\E[m, sgr0=\E[m, smam=\E[?7h, -+ smsc=\E[>11h\EPO**x0/65;1/67\E\\$<250>, smso=\E[7m, -+ smul=\E[4m, xoffc=g, xonc=e, - # --# Note: The wyse75, wyse85, and wyse99 have been discontinued. -+# (hp2392: copied <rmir> here from hpex -- esr) -+hp2392|239x series, -+ cols#80, -+ cbt=\Ei, cup=\E&a%p1%dy%p2%dC, kf1=\Ep\r, kf2=\Eq\r, -+ kf3=\Er\r, kf4=\Es\r, kf5=\Et\r, kf6=\Eu\r, kf7=\Ev\r, -+ kf8=\Ew\r, khome=\Eh, kind=\EU, knp=\Eu, kpp=\Ev, kri=\EV, -+ rmir=\ER, rmul=\E&d@, smir=\EQ, smul=\E&dD, vpa=\E&a%p1%dY, -+ use=hpsub, - --# Although the Wyse 30 can support more than one attribute --# it requires magic cookies to do so. Many applications do not --# function well with magic cookies. The following terminfo uses --# the protect mode to support one attribute (dim) without cookies. --# If more than one attribute is needed then the wy30-mc terminfo --# should be used. -+hpsub|hp terminals -- capability subset, -+ am, da, db, mir, xhp, xon, -+ lines#24, -+ bel=^G, clear=\EH\EJ, cr=^M, cub1=^H, cud1=\EB, cuf1=\EC, -+ cuu1=\EA, dch1=\EP, dl1=\EM, ed=\EJ, el=\EK, hpa=\E&a%p1%dC, -+ ht=^I, if=/usr/share/tabset/stdcrt, il1=\EL, ind=^J, -+ is2=\E&s1A\E<\E&k0\\, kbs=^H, kcub1=\ED, kcud1=\EB, -+ kcuf1=\EC, kcuu1=\EA, khome=\Eh, rmkx=\E&s0A, rmso=\E&d@, -+ sgr0=\E&d@, smkx=\E&s1A, smso=\E&dB, -+ -+# hpex: -+# May be used for most 24 x 80 hp terminals, -+# but has no padding added, so may allow runover in some terminals at high -+# baud rates. Will not work for hp2640a or hp2640b terminals, hp98x6 and -+# hp98x5 terminal emulators or hp98x6 consoles. -+# Adds xy-cursor addressing, vertical cursor addressing, home, -+# last line, and underline capabilities. - # --wy30|wyse30|Wyse 30, -- am, bw, hs, mc5i, mir, msgr, xon, -- cols#80, lh#1, lines#24, lw#8, ma#1, nlab#8, wsl#45, -- acsc=0wa_h[jukslrmqnxqzttuyv]wpxv, bel=^G, cbt=\EI, -- civis=\E`0, clear=\E+$<80>, cnorm=\E`1, cr=^M, cub1=^H, -- cud1=^J, cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, -- cuu1=^K, dch1=\EW$<10>, dim=\E`7\E), dl1=\ER$<1>, -- dsl=\EF\r, ed=\EY$<80>, el=\ET, flash=\E`8$<100/>\E`9, -- fsl=^M, home=^^, ht=\011$<1>, hts=\E1, il1=\EE$<2>, -- ind=\n$<2>, ip=$<2>, is2=\E'\E(\E\^3\E`9\016\024, -- kHOM=\E{, kbs=^H, kcbt=\EI, kcub1=^H, kcud1=^J, kcuf1=^L, -- kcuu1=^K, kdch1=\EW, kdl1=\ER, ked=\EY, kel=\ET, kent=\E7, -- kf1=^A@\r, kf2=^AA\r, kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, -- kf6=^AE\r, kf7=^AF\r, kf8=^AG\r, khome=^^, kich1=\EQ, -- kil1=\EE, knp=\EK, kpp=\EJ, krpl=\Er, ll=^^^K, mc0=\EP, mc4=^T, -- mc5=^X, nel=^M^J, pfx=\Ez%p1%{63}%+%c%p2%s\177, -- pln=\Ez%p1%{47}%+%c%p2%s\r, prot=\E`7\E), ri=\Ej$<3>, -- rmacs=\EH^C, rmir=\Er, rmln=\EA11, rmso=\E(, -- sgr=%?%p1%p5%p8%|%|%t\E`7\E)%e\E(%;%?%p9%t\EH\002%e\EH\003%;, -- sgr0=\E(\EH\003, smacs=\EH^B, smir=\Eq, smln=\EA10, -- smso=\E`7\E), tbc=\E0, tsl=\EF, -+# (hpex: removed memory-lock capabilities ":ml=\El:mu=\Em:", -+# moved <rmir> here from hpsub -- esr) -+hpex|hp extended capabilites, -+ cr=^M, cud1=^J, cup=\E&a%p1%dy%p2%dC, ht=^I, ind=^J, kbs=^H, -+ kcub1=^H, kcud1=^J, nel=^M^J, rmir=\ER, rmul=\E&d@, smir=\EQ, -+ smul=\E&dD, vpa=\E&a%p1%dY, use=hpsub, -+ -+# From: Ville Sulko <Ville.Sulko@bip.atk.tpo.fi>, 05 Aug 1996 -+hp2|hpex2|hewlett-packard extended capabilities newer version, -+ am, da, db, mir, xhp, -+ cols#80, lh#2, lines#24, lm#0, lw#8, nlab#8, xmc#0, -+ bel=^G, clear=\E&a0y0C\EJ, cr=^M, cub1=^H, cud1=\EB, -+ cuf1=\EC, cup=\E&a%p1%dy%p2%dC, cuu1=\EA, dch1=\EP, -+ dl1=\EM, ed=\EJ, el=\EK, hpa=\E&a%p1%dC, ht=^I, hts=\E1, -+ il1=\EL, ind=^J, kbs=^H, kclr=\EJ, kctab=\E2, kcub1=\ED, -+ kcud1=\EB, kcuf1=\EC, kcuu1=\EA, kdch1=\EP, kdl1=\EM, -+ ked=\EJ, kel=\EK, kf1=\Ep, kf2=\Eq, kf3=\Er, kf4=\Es, kf5=\Et, -+ kf6=\Eu, kf7=\Ev, kf8=\Ew, khome=\Eh, khts=\E1, kich1=\EQ, -+ kil1=\EL, kind=\ES, kll=\EF, knp=\EU, kpp=\EV, kri=\ET, -+ krmir=\ER, ktbc=\E3, meml=\El, memu=\Em, -+ pfkey=\E&f%p1%dk%p2%l%dL%p2%s, -+ pfloc=\E&f1a%p1%dk%p2%l%dL%p2%s, -+ pfx=\E&f2a%p1%dk%p2%l%dL%p2%s, -+ pln=\E&f%p1%dk%p2%l%dd0L%p2%s, rmir=\ER, rmkx=\E&s0A, -+ rmln=\E&j@, rmso=\E&d@, rmul=\E&d@, -+ sgr=\E&d%?%p7%t%{115}%c%;%p1%p3%|%p6%|%{2}%*%p2%{4}%*%+%p4%+%p5%{8}%*%+%{64}%+%c%?%p9%t%'\016'%c%e%'\017'%c%;, -+ sgr0=\E&d@, smir=\EQ, smkx=\E&s1A, smln=\E&jB, smso=\E&dB, -+ smul=\E&dD, tbc=\E3, vpa=\E&a%p1%dY, -+ -+# HP 236 console -+# From: <ddavis@ic.berkeley.edu> -+hp236|hp236 internal terminal emulator, -+ OTbs, am, -+ cols#80, lines#24, -+ clear=\EF, cnorm=\EDE, cub1=^H, -+ cup=\EE%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, cvvis=\EDB, -+ dch1=\EJ, dl1=\EH, el=\EK, ich1=\EI, il1=\EG, rmso=\ECI, -+ sgr0=\ECI, smso=\EBI, -+ -+# This works on a hp300 console running Utah 4.3 BSD -+# From: Craig Leres <leres@okeeffe.berkeley.edu> -+hp300h|HP Catseye console, -+ OTbs, am, da, db, mir, xhp, -+ cols#128, lines#51, lm#0, xmc#0, -+ bel=^G, cbt=\Ei, clear=\E&a0y0C\EJ, cr=^M, cub1=^H, cud1=\EB, -+ cuf1=\EC, cup=\E&a%p1%dy%p2%dC, cuu1=\EA, dch1=\EP, -+ dl1=\EM, ed=\EJ, el=\EK, hpa=\E&a%p1%dC, ht=^I, -+ if=/usr/share/tabset/stdcrt, il1=\EL, ind=^J, kbs=^H, -+ kcub1=\ED, kcud1=\EB, kcuf1=\EC, kcuu1=\EA, khome=\Eh, -+ rmir=\ER, rmkx=\E&s0A, rmso=\E&d@, rmul=\E&d@, sgr0=\E&d@, -+ smir=\EQ, smkx=\E&s1A, smso=\E&dB, smul=\E&dD, tbc=\E3, -+ vpa=\E&a%p1%dY, -+# From: Greg Couch <gregc@ernie.berkeley.edu> -+hp9837|hp98720|hp98721|HP 9000/300 workstations, -+ OTbs, am, da, db, mir, xhp, -+ cols#128, it#8, lines#46, lm#0, -+ bel=^G, cbt=\Ei, clear=\E&a0y0C\EJ, cub1=^H, cud1=\EB, -+ cuf1=\EC, cup=\E&a%p1%dy%p2%dC, cuu1=\EA, dch1=\EP, -+ dl1=\EM, ed=\EJ, el=\EK, hpa=\E&a%p1%dC, ht=^I, hts=\E1, -+ il1=\EL, ind=^J, is2=\E&v0m1b0i&j@, kbs=^H, kcub1=\ED, -+ kcud1=\EB, kcuf1=\EC, kcuu1=\EA, kdch1=\EP, kdl1=\EM, -+ ked=\EJ, kel=\EK, khome=\Eh, kich1=\EQ, kil1=\EL, knp=\EU, -+ kpp=\EV, rmir=\ER, rmkx=\E&s0A, rmso=\E&v0S, rmul=\E&d@, -+ sgr0=\E&d@, smir=\EQ, smkx=\E&s1A, smso=\E&v5S, smul=\E&dD, -+ tbc=\E3, vpa=\E&a%p1%dY, -+# HP 9845 desktop computer from BRL -+# (hp9845: removed unknown capability :gu: -- esr) -+hp9845|HP 9845, -+ OTbs, am, da, db, eo, mir, xhp, -+ cols#80, lines#21, -+ OTbc=\ED, clear=\EH\EJ, cub1=\ED, cud1=\EB, cuf1=\EC, -+ cup=\E&a%p2%2dc%p1%2dY, cuu1=\EA, dch1=\EP, dl1=\EM, -+ ed=\EJ, el=\EK, if=/usr/share/tabset/std, il1=\EL, -+ rmir=\ER, rmso=\E&d@, smir=\EQ, smso=\E&dB, -+# From: Charles A. Finnell of MITRE <finnell@mitre.org>, developed 07SEP90 -+# (hp98550: replaced /usr/share/tabset/9837 with std because <it#8>,<hts=\E1>; -+# added empty <acsc> to avoid warnings re <smacs>/<rmacs> --esr) -+hp98550|hp98550a|HP 9000 Series 300 color console, -+ OTbs, am, da, db, mir, xhp, -+ cols#128, it#8, lines#49, lm#0, -+ acsc=, bel=^G, blink=\E&dA, bold=\E&dJ, cbt=\Ei, civis=\E*dR, -+ clear=\EH\EJ, cnorm=\E*dQ, cr=^M, cub1=^H, cud1=^J, cuf1=\EC, -+ cup=\E&a%p1%dy%p2%dC, cuu1=\EA, dch1=\EP, dim=\E&dH, -+ dl1=\EM, ed=\EJ, el=\EK, hpa=\E&a%p1%dC, ht=^I, hts=\E1, -+ if=/usr/share/tabset/std, il1=\EL, ind=^J, invis=\E&ds, -+ kbs=^H, kclr=\EJ, kctab=\E2, kcub1=\ED, kcud1=\EB, kcuf1=\EC, -+ kcuu1=\EA, kdch1=\EP, kdl1=\EM, ked=\EJ, kel=\EK, kf1=\Ep, -+ kf2=\Eq, kf3=\Er, kf4=\Es, kf5=\Et, kf6=\Eu, kf7=\Ev, kf8=\Ew, -+ khome=\Eh, khts=\E1, kich1=\EQ, kil1=\EL, kind=\ES, kll=\EF, -+ knp=\EU, kpp=\EV, kri=\ET, krmir=\ER, ktbc=\E3, rev=\E&dJ, -+ rmacs=^O, rmir=\ER, rmkx=\E&s0A, rmso=\E&d@, rmul=\E&d@, -+ sgr0=\E&d@, smacs=^N, smir=\EQ, smkx=\E&s1A, smso=\E&dJ, -+ smul=\E&dD, tbc=\E3, vpa=\E&a%p1%dY, -+# From: Victor Duchovni <vic@fine.princeton.edu> -+# (hp700-wy: removed obsolete ":nl=^J:"; -+# replaced /usr/share/tabset/hp700-wy with std because <it#8>,<hts=\E1> -- esr) -+hp700-wy|HP700/41 emulating wyse30, -+ OTbs, am, bw, mir, msgr, -+ cols#80, it#8, lines#24, xmc#1, -+ cbt=\EI, clear=^Z, cr=^M, cub1=^H, cud1=^V, cuf1=^L, -+ cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW, -+ dl1=\ER, ed=\EY, el=\ET$<10/>, home=^^, ht=^I, hts=\E1, -+ if=/usr/share/tabset/stdcrt, il1=\EE$<0.7*/>, -+ is1=\E~"\EC\Er\E(\EG0\003\E`9\E`1, kbs=\177, kcbt=\EI, -+ kclr=^Z, kcub1=^H, kcud1=^V, kcuf1=^L, kcuu1=^K, ked=\EY, -+ kel=\ET, khome=^^, khts=\EI, kich1=\Eq, krmir=\Er, ll=^^^K, -+ ri=\Ej, rmir=\Er, rmso=\EG0$<10/>, rmul=\EG0$<10/>, -+ sgr0=\EG0$<10/>, smir=\Eq, smso=\EG4$<10/>, -+ smul=\EG8$<10/>, tbc=\E0, vpa=\E[%p1%{32}%+%c, -+hp70092|hp70092a|hp70092A|HP 700/92, -+ am, da, db, xhp, -+ cols#80, lh#2, lines#24, lm#0, lw#8, nlab#8, -+ acsc=0cjgktlrmfn/q\,t5u6v8w7x., bel=^G, blink=\E&dA, -+ bold=\E&dB, cbt=\Ei, clear=\E&a0y0C\EJ, cr=^M, cub1=^H, -+ cud1=\EB, cuf1=\EC, cup=\E&a%p1%dy%p2%dC, cuu1=\EA, -+ dch1=\EP, dim=\E&dH, dl1=\EM, el=\EK, hpa=\E&a%p1%dC, ht=^I, -+ hts=\E1, il1=\EL, kbs=^H, kclr=\EJ, kctab=\E2, kcub1=\ED, -+ kcud1=\EB, kcuf1=\EC, kcuu1=\EA, kdch1=\EP, kdl1=\EM, -+ ked=\EJ, kel=\EK, kf1=\Ep, kf2=\Eq, kf3=\Er, kf4=\Es, kf5=\Et, -+ kf6=\Eu, kf7=\Ev, kf8=\Ew, khome=\Eh, khts=\E1, kich1=\EQ, -+ kil1=\EL, kind=\ES, kll=\EF, knp=\EU, kpp=\EV, kri=\ET, -+ krmir=\ER, ktbc=\E3, rev=\E&dB, ri=\ET, rmacs=^O, rmir=\ER, -+ rmkx=\E&s0A, rmln=\E&j@, rmso=\E&d@, rmul=\E&d@, -+ sgr0=\E&d@, smacs=^N, smir=\EQ, smkx=\E&s1A, smln=\E&jB, -+ smso=\E&dJ, smul=\E&dD, tbc=\E3, vpa=\E&a%p1%dY, -+ -+bobcat|sbobcat|HP 9000 model 300 console, -+ am, da, db, mir, xhp, -+ cols#128, it#8, lines#47, xmc#0, -+ cbt=\Ei, clear=\EH\EJ, cr=^M, cub1=^H, cud1=\EB, cuf1=\EC, -+ cup=\E&a%p1%dy%p2%dC$<6/>, cuu1=\EA, dch1=\EP, -+ dl1=\EM$<10*/>, ed=\EJ, el=\EK, hpa=\E&a%p1%dC$<6/>, ht=^I, -+ il1=\EL$<10*/>, ind=^J, kbs=^H, kcub1=\ED, kcud1=\EB, -+ kcuf1=\EC, kcuu1=\EA, khome=\Eh, nel=^M^J, rmir=\ER, -+ rmkx=\E&s0A, rmso=\E&d@, rmul=\E&d@, sgr0=\E&d@, smir=\EQ, -+ smkx=\E&s1A, smso=\E&dB, smul=\E&dD, vpa=\E&a%p1%dY$<6/>, -+gator-t|HP 9000 model 237 emulating extra-tall AAA, -+ lines#94, use=gator, -+gator|HP 9000 model 237 emulating AAA, -+ bw, km, mir, ul, -+ cols#128, it#8, lines#47, -+ bel=^G, cbt=\E[Z, clear=\E[H\E[J, cr=^M, cub1=^H, cud1=^J, -+ cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu1=\EM, -+ dch=\E[%p1%dP$<4/>, dch1=\E[P, dl=\E[%p1%dM$<1*/>, -+ dl1=\E[M, ed=\E[J, el=\E[K, home=\E[H, hpa=\E[%i%p1%d`, -+ ht=^I, ich=\E[%p1%d@$<4/>, ich1=\E[@, il=\E[%p1%dL$<1*/>, -+ il1=\E[L, kbs=^H, kcub1=^H, kcud1=^J, nel=^M^J, -+ rep=%p1%c\E[%p2%db$<1*/>, rev=\E[7m, rmso=\E[m, -+ rmul=\E[m, sgr0=\E[m, smso=\E[7m, smul=\E[4m, -+gator-52|HP 9000 model 237 emulating VT52, -+ cols#128, lines#47, use=vt52, -+gator-52t|HP 9000 model 237 emulating extra-tall VT52, -+ lines#94, use=gator-52, -+ -+#### Honeywell-Bull - # --# This terminal description uses the non-hidden attribute mode --# (with magic cookie). -+# From: Michael Haardt <michael@gandalf.moria> 11 Jan 93 - # --# (wy30-mc: added <smcup> to suppress tic warning --esr) --wy30-mc|wyse30-mc|wyse 30 with magic cookies, -- msgr@, -- ma@, xmc#1, -- blink=\EG2, dim=\EGp, prot=\EG0\E), rmacs=\EG0\EH\003, -- rmcup=\EG0, rmso=\EG0, -- sgr=\EG%{48}%?%p2%p6%|%t%{8}%|%;%?%p1%p3%|%p6%|%t%{4}%|%;%?%p4%t%{2}%|%;%?%p1%p5%|%t%{64}%|%;%?%p7%t%{1}%|%;%c%?%p8%t\E)%e\E(%;%?%p9%t\EH\002%e\EH\003%;, -- sgr0=\EG0\E(\EH\003, smacs=\EG0\EH\002, smcup=, -- smso=\EG4, use=wy30, use=adm+sgr, --# The mandatory pause used by <flash> does not work with --# older versions of terminfo. If you see this effect then --# unset xon and delete the / from the delay. --# i.e. change $<100/> to $<100> --wy30-vb|wyse30-vb|wyse 30 visible bell, -- bel@, use=wy30, -+ -+# Honeywell Bull terminal. Its cursor and function keys send single -+# control characters and it has standout/underline glitch. Most programs -+# do not like these features/bugs. Visual bell is realized by flashing the -+# "keyboard locked" LED. -+dku7003-dumb|Honeywell Bull DKU 7003 dumb mode, -+ cols#80, lines#25, -+ clear=^]^_, cr=^M, cub1=^Y, cud1=^K, cuf1=^X, -+ cup=\E[%i%p1%d;%p2%dH, cuu1=^Z, ed=^_, el=\E[K, -+ flash=\E[2h\E[2l, home=^], ht=^I, ind=^J, kbs=^H, kcub1=^Y, -+ kcud1=^K, kcuf1=^X, kcuu1=^Z, khome=^], nel=^M^J, -+dku7003|Honeywell Bull DKU 7003 all features described, -+ msgr, -+ xmc#1, -+ blink=\E[5m, bold=\E[7m, dim=\E[2m, rev=\E[7m, rmso=\E[m, -+ rmul=\E[m, sgr0=\E[m, smso=\E[7m, smul=\E[4m, -+ use=dku7003-dumb, -+ -+#### Lear-Siegler (adm) - # --# The Wyse 50 can support one attribute (e.g. Dim, Inverse, --# Normal) without magic cookies by using the protect mode. --# The following description uses this feature, but when more --# than one attribute is put on the screen at once, all attributes --# will be changed to be the same as the last attribute given. --# The Wyse 50 can support more attributes when used with magic --# cookies. The wy50-mc terminal description uses magic cookies --# to correctly handle multiple attributes on a screen. -+# These guys are long since out of the terminals business, but -+# in 1995 many current terminals still have an adm type as one of their -+# emulations (usually their stupidest, and usually labeled adm3, though -+# these `adm3' emulations normally have adm3a+ capabilities). - # --wy50|wyse50|Wyse 50, -- am, bw, hs, mc5i, mir, msgr, xon, -- cols#80, lh#1, lines#24, lw#8, ma#1, nlab#8, wsl#45, -- acsc=0wa_h[jukslrmqnxqzttuyv]wpxv, bel=^G, cbt=\EI, -- civis=\E`0, clear=\E+$<20>, cnorm=\E`1, cr=^M, cub1=^H, -+# WARNING: Some early ADM terminals (including the ADM3 and ADM5) had a -+# `diagnostic feature' that sending them a ^G while pin 22 (`Ring Indicator') -+# was being held to ground would trigger a send of the top line on the screen. -+# A quick fix might be to drop back to a cheesy 4-wire cable with pin 22 -+# hanging in the air. (Thanks to Eric Fischer, <eric@fudge.uchicago.edu>, -+# for clearing up this point.) -+ -+adm1a|adm1|lsi adm1a, -+ am, -+ cols#80, lines#24, -+ bel=^G, clear=\E;$<1>, cr=^M, cub1=^H, cud1=^J, cuf1=^L, -+ cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, home=^^, -+ ind=^J, -+adm2|lsi adm2, -+ OTbs, am, -+ cols#80, lines#24, -+ bel=^G, clear=\E;, cr=^M, cub1=^H, cud1=^J, cuf1=^L, -+ cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW, -+ dl1=\ER, ed=\EY, el=\ET, home=^^, ich1=\EQ, il1=\EE, ind=^J, -+ kcub1=^H, kcud1=^J, kcuf1=^L, kcuu1=^K, khome=^^, -+# (adm3: removed obsolete ":ma=^K^P:" -- esr) -+adm3|lsi adm3, -+ OTbs, am, -+ cols#80, lines#24, -+ bel=^G, clear=^Z, cr=^M, cub1=^H, cud1=^J, ind=^J, -+# The following ADM-3A switch settings are assumed for normal operation: -+# SPACE U/L_DISP CLR_SCRN 24_LINE -+# CUR_CTL LC_EN AUTO_NL FDX -+# Other switches may be set for operator convenience or communication -+# requirements. I recommend -+# DISABLE_KB_LOCK LOCAL_OFF 103 202_OFF -+# ETX_OFF EOT_OFF -+# Most of these terminals required an option ROM to support lower case display. -+# Open the case and look at the motherboard; if you see an open 24-pin DIP -+# socket, you may be out of luck. -+# -+# (adm3a: some capabilities merged in from BRl entry -- esr) -+adm3a|lsi adm3a, -+ OTbs, am, -+ cols#80, lines#24, -+ OTma=^K^P, OTnl=^J, bel=^G, clear=\032$<1/>, cr=^M, cub1=^H, - cud1=^J, cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, -- cuu1=^K, dch1=\EW$<1>, dim=\E`7\E), dl1=\ER, dsl=\EF\r, -- ed=\EY$<20>, el=\ET, flash=\E`8$<100/>\E`9, fsl=^M, -- home=^^, ht=^I, hts=\E1, il1=\EE, ind=\n$<2>, ip=$<1>, -- is1=\E`\:\E`9$<30>, is2=\016\024\E'\E(, kHOM=\E{, kbs=^H, -- kcbt=\EI, kcub1=^H, kcud1=^J, kcuf1=^L, kcuu1=^K, kdch1=\EW, -- kdl1=\ER, ked=\EY, kel=\ET, kent=\E7, kf1=^A@\r, kf10=^AI\r, -- kf11=^AJ\r, kf12=^AK\r, kf13=^AL\r, kf14=^AM\r, kf15=^AN\r, -- kf16=^AO\r, kf2=^AA\r, kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, -- kf6=^AE\r, kf7=^AF\r, kf8=^AG\r, kf9=^AH\r, khome=^^, -- kich1=\EQ, kil1=\EE, knp=\EK, kpp=\EJ, kprt=\EP, krpl=\Er, -- ll=^^^K, mc0=\EP, mc4=^T, mc5=^X, nel=^M^J, -- pfx=\Ez%p1%{63}%+%c%p2%s\177, -- pln=\Ez%p1%{47}%+%c%p2%s\r, prot=\E`7\E), rev=\E`6\E), -- ri=\Ej, rmacs=\EH^C, rmir=\Er, rmln=\EA11, rmso=\E(, -- sgr=%?%p1%p3%|%t\E`6\E)%e%p5%p8%|%t\E`7\E)%e\E(%;%?%p9%t\EH\002%e\EH\003%;, -- sgr0=\E(\EH\003, smacs=\EH^B, smir=\Eq, smln=\EA10, -- smso=\E`6\E), tbc=\E0, tsl=\EF, -+ cuu1=^K, home=^^, ind=^J, kcub1=^H, kcud1=^J, kcuf1=^L, -+ kcuu1=^K, rs2=^N, -+adm3a+|adm3a plus, -+ kbs=^H, use=adm3a, -+# (adm5: removed obsolete ":ma=^Hh^Jj^Kk^Ll^^H:" & duplicate ":do=^J:" -- esr) -+adm5|lsi adm5, -+ xmc#1, -+ bel=^G, cr=^M, cud1=^J, ed=\EY, el=\ET, kbs=^H, khome=^^, -+ rmso=\EG, smso=\EG, use=adm3a+, -+# A lot of terminals other than adm11s use these. Wherever you see -+# use=adm+sgr with some of its capabilities disabled, try the -+# disabled ones. They may well work but not have been documented or -+# expressed in the using entry. We'd like to cook up an <sgr> but the -+# <rmacs>/<smacs> sequences of the using entries vary too much. -+adm+sgr|adm style highlight capabilities, -+ invis=\EG1, rev=\EG4, rmso=\EG0, rmul=\EG0, sgr0=\EG0, -+ smso=\EG4, smul=\EG8, -+# LSI ADM-11 from George William Hartwig, Jr. <geo@BRL-TGR.ARPA> via BRL -+# Status line additions from Stephen J. Muir <stephen%comp.lancs.ac.uk@ucl-cs> -+# <khome> from <stephen%comp.lancs.ac.uk@ucl-cs.arpa>. <clear> could also -+# be ^Z, according to his entry. -+# (adm11: <smul>=\EG4 was obviously erroneous because it also said -+# <rev>=\EG4. Looking at other ADMs confirms this -- esr) -+adm11|LSI ADM-11, -+ OTbs, am, hs, -+ OTkn#8, cols#80, lines#24, -+ OTnl=^J, bel=^G, blink=\EG2, clear=\E*, cr=^M, cub1=^H, -+ cud1=^J, cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, -+ cuu1=^K, dsl=\Eh, ed=\EY, el=\ET, fsl=\E(\r, home=^^, ht=^I, -+ kbs=^H, kcub1=^H, kcud1=^J, kcuf1=^L, kcuu1=^K, kf1=^A@\r, -+ kf2=^AA\r, kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, kf6=^AE\r, -+ kf7=^AF\r, kf8=^AG\r, khome=^^, nel=^M^J, tsl=\EF\E), -+ use=adm+sgr, -+# From: Andrew Scott Beals <bandy@lll-crg.ARPA> -+# Corrected by Olaf Siebert <rhialto@polder.ubc.kun.nl>, 11 May 1995 -+# Supervisor mode info by Ari Wuolle, <awuolle@delta.hut.fi>, 27 Aug 1996 -+# (adm12: removed obsolete ":kn:ma=j^Jk^P^K^Pl ^R^L^L :". This formerly had -+# <is2>=\Eq but that looked wrong; this <is2> is from Dave Yost <esquire!yost> -+# via BRL. That entry asserted <xmc#1>, but I've left that out because -+# neither earlier nor later ADMSs have it -- esr) - # --# This terminal description uses the non-hidden attribute mode --# (with magic cookie). -+# You will need to get into the supervisor setup before you can set -+# baudrate etc. for your ADM-12+. Press Shift-Ctrl-Setup and you should -+# see a lot more setup options. - # --# The mandatory pause used by flash does not work with some --# older versions of terminfo. If you see this effect then --# unset <xon> and delete the / from the delay. --# i.e. change $<100/> to $<100> --# (wy50-mc: added <smcup> to suppress tic warning --esr) --wy50-mc|wyse50-mc|wyse 50 with magic cookies, -- msgr@, -- ma@, xmc#1, -- blink=\EG2, dim=\EGp, prot=\EG0\E), rev=\EG4, -- rmacs=\EG0\EH\003, rmcup=\EG0, rmso=\EG0, -- sgr=\EG%{48}%?%p2%p6%|%t%{8}%|%;%?%p1%p3%|%p6%|%t%{4}%|%;%?%p4%t%{2}%|%;%?%p1%p5%|%t%{64}%|%;%?%p7%t%{1}%|%;%c%?%p8%t\E)%e\E(%;%?%p9%t\EH\002%e\EH\003%;, -- sgr0=\EG0\E(\EH\003, smacs=\EG0\EH\002, smcup=, -- smso=\EGt, use=wy50, use=adm+sgr, --wy50-vb|wyse50-vb|wyse 50 visible bell, -- bel@, use=wy50, --wy50-w|wyse50-w|wyse 50 132-column, -- cols#132, lw#7, nlab#16, wsl#97, -- cup=\Ea%i%p1%dR%p2%dC, dch1=\EW$<2>, is1=\E`;\E`9$<30>, -- use=wy50, --wy50-wvb|wyse50-wvb|wyse 50 132-column visible bell, -- bel@, use=wy50-w, -- -+# While in supervisor setup you can also use following codes: - # --# The Wyse 350 is a Wyse 50 with color. --# Unfortunately this means that it has magic cookies. --# The color attributes are designed to overlap the reverse, dim and --# underline attributes. This is nice for monochrome applications --# because you can make underline stuff green (or any other color) --# but for true color applications it's not so hot because you cannot --# mix color with reverse, dim or underline. --# To further complicate things one of the attributes must be --# black (either the foreground or the background). In reverse video --# the background changes color with black letters. In normal video --# the foreground changes colors on a black background. --# This terminfo uses some of the more advanced features of curses --# to display both color and blink. In the final analysis I am not --# sure that the wy350 runs better with this terminfo than it does --# with the wy50 terminfo (with user adjusted colors). -+# Ctrl-P Personality character selections (configure for example what -+# arrow keys send, if I recall correctly) -+# Ctrl-T tabs 1-80 use left&right to move and up to set and -+# Ctrl-V tabs 81-158 down to clear tab. Shift-Ctrl-M sets right margin at cursor -+# Ctrl-B Binary setup (probably not needed. I think that everything can -+# be set using normal setup) -+# Ctrl-A Answerback mode (enter answerback message) -+# Ctrl-U User friendly mode (normal setup) -+# Ctrl-D Defaults entire setup and function keys from EPROM tables -+# Ctrl-S Save both setup and functions keys. Takes from 6 to 10 seconds. -+# Ctrl-R Reads both setup and functions keys from NVM. -+# Shift-Ctrl-X Unlock keyboard and cancel received X-OFF status - # --# The mandatory pause used by flash does not work with --# older versions of terminfo. If you see this effect then --# unset xon and delete the / from the delay. --# i.e. change $<100/> to $<100> -+# ADM-12+ supports hardware handshaking, but it is DTR/CTS as opposed to -+# RTS/CTS used nowadays with virtually every modem and computer. 19200 -+# bps works fine with hardware flow control. - # --# Bug: The <op> capability resets attributes. --wy350|wyse350|Wyse 350, -- am, bw, hs, mc5i, mir, xon, -- colors#8, cols#80, lh#1, lines#24, lw#8, ncv#55, nlab#8, pairs#8, -- wsl#45, xmc#1, -- acsc=0wa_h[jukslrmqnxqzttuyv]wpxv, bel=^G, blink=\EG2, -- cbt=\EI, civis=\E`0, clear=\E+$<20>, cnorm=\E`1, cr=^M, -- cub1=^H, cud1=^J, cuf1=^L, -- cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW$<1>, -- dim=\EGp, dl1=\ER, dsl=\EF\r, ed=\EY$<20>, el=\ET, -- flash=\E`8$<100/>\E`9, fsl=^M, home=^^, ht=^I, hts=\E1, -- il1=\EE, ind=\n$<2>, ip=$<1>, is1=\E`\:\E`9$<30>, -- is2=\016\024\E'\E(, is3=\E%?, kHOM=\E{, kbs=^H, kcbt=\EI, -- kcub1=^H, kcud1=^J, kcuf1=^L, kcuu1=^K, kdch1=\EW, kdl1=\ER, -- ked=\EY, kel=\ET, kent=\E7, kf1=^A@\r, kf10=^AI\r, -- kf11=^AJ\r, kf12=^AK\r, kf13=^AL\r, kf14=^AM\r, kf15=^AN\r, -- kf16=^AO\r, kf2=^AA\r, kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, -- kf6=^AE\r, kf7=^AF\r, kf8=^AG\r, kf9=^AH\r, khome=^^, -- kich1=\EQ, kil1=\EE, knp=\EK, kpp=\EJ, kprt=\EP, krpl=\Er, -- ll=^^^K, mc0=\EP, mc4=^T, mc5=^X, nel=^M^J, oc=\E%?, op=\EG0, -- pfx=\Ez%p1%{63}%+%c%p2%s\177, -- pln=\Ez%p1%{47}%+%c%p2%s\r, prot=\EG0\E), ri=\Ej, -- rmacs=\EG0\EH\003, rmir=\Er, rmln=\EA11, setb=, -- setf=%?%p1%{0}%=%t%{76}%e%p1%{1}%=%t%{64}%e%p1%{2}%=%t%{8}%e%p1%{3}%=%t%{72}%e%p1%{4}%=%t%{4}%e%p1%{5}%=%t%{68}%e%p1%{6}%=%t%{12}%e%p1%{7}%=%t%{0}%;%PC\EG%gC%gA%+%{48}%+%c, -- sgr=%{0}%?%p4%t%{2}%|%;%?%p7%t%{1}%|%;%PA\EG%?%gC%t%gC%e%{0}%?%p1%t%{4}%|%;%?%p2%t%{8}%|%;%?%p3%t%{4}%|%;%?%p5%t%{64}%|%;%;%gA%+%{48}%+%c%?%p8%t\E)%e\E(%;%?%p9%t\EH\002%e\EH\003%;, -- sgr0=\EG0\E(\EH\003%{0}%PA%{0}%PC, smacs=\EG0\EH\002, -- smir=\Eq, smln=\EA10, tbc=\E0, tsl=\EF, use=adm+sgr, --wy350-vb|wyse350-vb|wyse 350 visible bell, -- bel@, use=wy350, --wy350-w|wyse350-w|wyse 350 132-column, -- cols#132, lw#7, nlab#16, wsl#97, -- cup=\Ea%i%p1%dR%p2%dC, dch1=\EW$<2>, is1=\E`;\E`9$<30>, -- use=wy350, --wy350-wvb|wyse350-wvb|wyse 350 132-column visible bell, -- bel@, use=wy350-w, -+# The following null-modem cable should fix this and enable you to use -+# RTS/CTS handshaking (which Linux supports, use CRTSCTS setting). Also -+# set ADM-12+ for DTR handshaking from supervisor setup. - # --# This terminfo description is untested. --# The wyse100 emulates an adm31, so the adm31 entry should work. -+# PC Serial ADM-12+ -+# -------- ------- -+# 2 - 3 -+# 3 - 2 -+# 4 - 5 -+# 5 - 20 -+# 6,8 - 4 -+# 7 - 7 -+# 20 - 6,8 - # --wy100|wyse 100, -- hs, mir, -- cols#80, lines#24, xmc#1, -- bel=^G, clear=\E;, cr=^M, cub1=^H, cud1=^J, cuf1=^L, -+adm12|lsi adm12, -+ OTbs, OTpt, am, mir, -+ OTug#1, cols#80, it#8, lines#24, -+ bel=^G, clear=^Z, cr=^M, cub1=^H, cud1=^J, cuf1=^L, - cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW, -- dl1=\ER, dsl=\EA31, ed=\EY, el=\ET, fsl=^M, il1=\EE, ind=^J, -- invis@, is2=\Eu\E0, kbs=^H, kcub1=^H, kcud1=^J, kcuf1=^L, -- kcuu1=^K, kf1=^A@\r, kf2=^AA\r, kf3=^AB\r, kf4=^AC\r, -- kf5=^AD\r, kf6=^AE\r, kf7=^AF\r, kf8=^AG\r, khome=\E{, -- rmir=\Er, smir=\Eq, tsl=\EF, use=adm+sgr, --# --# The Wyse 120/150 has most of the features of the Wyse 60. --# This terminal does not need padding up to 9600 baud! --# <msgr> should be set but the clear screen fails when in --# alt-charset mode. Try \EcE\s\s\E+\s if the screen is really clear --# then set <msgr>. --# --wy120|wyse120|wy150|wyse150|Wyse 120/150, -- am, bw, hs, km, mc5i, mir, msgr, xon, -- cols#80, it#8, lh#1, lines#24, lw#8, nlab#8, pb#9601, wsl#45, -- acsc=+/\,.0[a2fxgqh1ihjYk?lZm@nEqDtCu4vAwBx3yszr{c~~, -- bel=^G, blink=\EG2, cbt=\EI, civis=\E`0, clear=\E+$<50>, -- cnorm=\E`1, cr=^M, cub1=^H, cud1=^J, cuf1=^L, -- cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW$<7>, -- dim=\EGp, dl1=\ER$<3>, dsl=\EF\r, ed=\EY$<50>, el=\ET$<4>, -- flash=\E`8$<100/>\E`9, fsl=^M, home=^^, ht=\011$<1>, -- hts=\E1, il1=\EE$<3>, ind=\n$<3>, ip=$<2>, is1=\EcB0\EcC1, -- is2=\Ed$\EcD\E'\Er\EH\003\Ed/\EO\Ee1\Ed*\E`@\E`9\E`1\016\024\El, -- is3=\EwJ\Ew1$<150>, kHOM=\E{, kbs=^H, kcbt=\EI, kcub1=^H, -- kcud1=^J, kcuf1=^L, kcuu1=^K, kdch1=\EW, kdl1=\ER, ked=\EY, -- kel=\ET, kent=\E7, kf1=^A@\r, kf10=^AI\r, kf11=^AJ\r, -- kf12=^AK\r, kf13=^AL\r, kf14=^AM\r, kf15=^AN\r, kf16=^AO\r, -+ dl1=\ER, ed=\EY, el=\ET, home=^^, hts=\E1, ich1=\EQ, il1=\EE, -+ is2=\E0 \E1 \E1 \E1 \E1 \E1 \E1 \E1 \E1, -+ kcub1=^H, kcud1=^J, kcuf1=^L, kcuu1=^K, kf0=^A0\r, kf1=^A1\r, -+ kf2=^A2\r, kf3=^A3\r, kf4=^A4\r, kf5=^A5\r, kf6=^A6\r, -+ kf7=^A7\r, kf8=^A8\r, kf9=^A9\r, rmir=\Er, smir=\Eq, tbc=\E0, -+ use=adm+sgr, -+# (adm20: removed obsolete ":kn#7:" -- esr) -+adm20|lear siegler adm20, -+ OTbs, am, -+ cols#80, it#8, lines#24, -+ bel=^G, cbt=\EI, clear=^Z, cr=^M, cub1=^H, cuf1=^L, -+ cup=\E=%i%p2%{31}%+%c%p1%{31}%+%c, cuu1=^K, dch1=\EW, -+ dl1=\ER, ed=\EY, el=\ET, home=^^, ht=^I, ich1=\EQ, il1=\EE, -+ kf1=^A, kf2=^B, kf3=^W, kf4=^D, kf5=^E, kf6=^X, kf7=^Z, rmso=\E(, -+ sgr0=\E(, smso=\E), -+adm21|lear siegler adm21, -+ xmc#1, -+ bel=^G, cr=^M, cud1=^J, dch1=\EW, dl1=30*\ER, ed=\EY, el=\ET, -+ ich1=\EQ, il1=30*\EE, ind=^J, invis@, kbs=^H, kcub1=^H, -+ kcud1=^J, kcuf1=^L, kcuu1=^K, khome=^^, use=adm+sgr, -+ use=adm3a, -+# (adm22: ":em=:" was an obvious typo for ":ei=:"; also, -+# removed obsolete ":kn#7:ma=j^Jk^P^K^Pl ^R^L^L :"; -+# removed bogus-looking \200 from before <cup>. -- esr) -+adm22|lsi adm22, -+ OTbs, am, -+ cols#80, lines#24, -+ bel=^G, cbt=\EI, clear=\E+, cr=^M, cub1=^H, cud1=^J, cuf1=^L, -+ cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW, -+ dl1=\ER, ed=\Ey, el=\Et, home=^^, ht=\Ei, ich1=\EQ, il1=\EE, -+ is2=\E%\014\014\014\016\003\0\003\002\003\002\0\0\0\0\0\0\0\0\0\0\0, -+ kbs=^H, kcub1=^H, kcud1=^J, kcuf1=^L, kcuu1=^K, kf1=^A@\r, - kf2=^AA\r, kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, kf6=^AE\r, -- kf7=^AF\r, kf8=^AG\r, kf9=^AH\r, khome=^^, kich1=\EQ, -- kil1=\EE, knp=\EK, kpp=\EJ, kprt=\EP, krpl=\Er, ll=^^^K, -- mc0=\EP, mc4=^T, mc5=\Ed#, nel=\r\n$<3>, -- pfloc=\EZ2%p1%{63}%+%c%p2%s\177, -- pfx=\EZ1%p1%{63}%+%c%p2%s\177, -- pln=\Ez%p1%{47}%+%c%p2%s\r, prot=\E), ri=\Ej$<2>, -- rmacs=\EcD, rmam=\Ed., rmcup=\Ew1, rmir=\Er, rmln=\EA11, -- rmxon=\Ec20, rs1=\E~!\E~4$<30>, rs2=\EeF\E`\:$<70>, -- rs3=\EwG\Ee($<100>, -- sgr=%?%p8%t\E)%e\E(%;%?%p9%t\EcE%e\EcD%;\EG%{48}%?%p2%t%{8}%|%;%?%p1%p3%|%p6%|%t%{4}%|%;%?%p4%t%{2}%|%;%?%p1%p5%|%t%{64}%|%;%?%p7%t%{1}%|%;%c, -- sgr0=\E(\EH\003\EG0\EcD, smacs=\EcE, smam=\Ed/, -- smcup=\Ew0, smir=\Eq, smln=\EA10, smso=\EGt, smxon=\Ec21, -- tbc=\E0, tsl=\EF, use=adm+sgr, -+ kf7=^AF\r, khome=^^, lf1=F1, lf2=F2, lf3=F3, lf4=F4, lf5=F5, -+ lf6=F6, lf7=F7, rmso=\E(, sgr0=\E(, smso=\E), -+# ADM 31 DIP Switches - # --wy120-w|wyse120-w|wy150-w|wyse150-w|wyse 120/150 132-column, -- cols#132, lw#7, nlab#16, wsl#97, -- cup=\Ea%i%p1%dR%p2%dC, dch1=\EW$<12>, ip=$<4>, -- rs2=\E`;$<70>, use=wy120, -+# This information comes from two versions of the manual for the -+# Lear-Siegler ADM 31. - # --wy120-25|wyse120-25|wy150-25|wyse150-25|wyse 120/150 80-column 25-lines, -- lh@, lines#25, lw@, nlab@, -- pln@, rs3=\EwG\Ee)$<100>, use=wy120, --# --wy120-25-w|wyse120-25-w|wy150-25-w|wyse150-25-w|wyse 120/150 132-column 25-lines, -- lh@, lines#25, lw@, nlab@, -- pln@, rs3=\EwG\Ee)$<100>, use=wy120-w, --# --wy120-vb|wyse120-vb|wy150-vb|wyse150-vb|Wyse 120/150 visible bell, -- bel@, use=wy120, --# --wy120-w-vb|wy120-wvb|wyse120-wvb|wy150-w-vb|wyse150-w-vb|Wyse 120/150 132-column visible bell, -- bel@, use=wy120-w, --# --# The Wyse 60 is like the Wyse 50 but with more padding. --# The reset strings are slow and the pad times very depending --# on other parameters such as font loading. I have tried --# to follow the following outline: -+# Main board: -+# rear of case -+# +-||||-------------------------------------+ -+# + S1S2 ||S + -+# + ||3 + -+# + + -+# + ||S + -+# + ||4 + -+# + + -+# + + -+# + + -+# + + -+# + + -+# +-+ +-+ -+# + + -+# + S5 S6 S7 + -+# + == == == + -+# +----------------------------------------------+ -+# front of case (keyboard) - # --# <rs1> -> set personality --# <rs2> -> set number of columns --# <rs3> -> set number of lines --# <is1> -> select the proper font --# <is2> -> do the initialization --# <is3> -> set up display memory (2 pages) -+# S1 - Data Rate - Modem -+# S2 - Data Rate - Printer -+# ------------------------ -+# Data Rate Setting -+# ------------------- -+# 50 0 0 0 0 -+# 75 1 0 0 0 -+# 110 0 1 0 0 -+# 134.5 1 1 0 0 -+# 150 0 0 1 0 -+# 300 1 0 1 0 -+# 600 0 1 1 0 -+# 1200 1 1 1 0 -+# 1800 0 0 0 1 -+# 2000 1 0 0 1 -+# 2400 0 1 0 1 -+# 3600 1 1 0 1 -+# 4800 0 0 1 1 -+# 7200 1 0 1 1 -+# 9600 0 1 1 1 -+# x 1 1 1 1 - # --# The Wyse 60's that have vt100 emulation are slower than the --# older Wyse 60's. This change happened mid-1987. --# The capabilities effected are <dch1> <dl1> <il1> <ind> <ri> -+# S3 - Interface/Printer/Attributes -+# --------------------------------- -+# Printer Busy Control -+# sw1 sw2 sw3 -+# --------------- -+# off off off Busy not active, CD disabled -+# off off on Busy not active, CD enabled -+# off on off Busy active on J5-20, CD disabled -+# on off off Busy active on J5-19, CD disabled - Factory Set. -+# on off on Busy active on J5-19, CD enabled - # --# The meta key is only half right. This terminal will return the --# high order bit set when you hit CTRL-function_key -+# sw4 Used in conjuction with S4 for comm interface control - Fact 0 - # --# It may be useful to assign two function keys with the --# values \E=(\s look at old data in page 1 --# \E=W, look at bottom of page 1 --# where \s is a space ( ). -+# sw5 Secondary Channel Control (Hardware implementation only) - Fact 0 - # --# Note: --# The Wyse 60 runs faster when the XON/XOFF --# handshake is turned off. -+# sw6 ON enables printer BUSY active LOW - Factory Setting -+# OFF enables printer BUSY active HIGH - If set to this, ADM31 senses - # --# (wy60: we use \E{ rather than ^^ for home (both are documented) to avoid --# a bug reported by Robert Dunn, <rcdii@inlink.com> -- esr) --wy60|wyse60|Wyse 60, -- am, bw, hs, km, mc5i, mir, msgr, -- cols#80, lh#1, lines#24, lw#8, nlab#8, wsl#45, -- acsc=+/\,.0[a2fxgqh1ihjYk?lZm@nEqDtCu4vAwBx3yszr{c~~, -- bel=^G, blink=\EG2, cbt=\EI, civis=\E`0, clear=\E+$<100>, -- cnorm=\E`1, cr=^M, cub1=^H, cud1=^J, cuf1=^L, -- cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, -- dch1=\EW$<11>, dclk=\E`b, dim=\EGp, dl1=\ER$<5>, dsl=\EF\r, -- ed=\EY$<100>, el=\ET, flash=\E`8$<100/>\E`9, fsl=^M, -- home=\E{, ht=\011$<1>, hts=\E1, il1=\EE$<4>, ind=\n$<5>, -- ip=$<3>, is1=\EcB0\EcC1, -- is2=\Ed$\EcD\E'\Er\EH\003\Ed/\EO\Ee1\Ed*\E`@\E`9\E`1\016\024\El, -- is3=\EwJ\Ew1$<150>, kHOM=\E{, kbs=^H, kcbt=\EI, kcub1=^H, -- kcud1=^J, kcuf1=^L, kcuu1=^K, kdch1=\EW, kdl1=\ER, ked=\EY, -- kel=\ET, kent=\E7, kf1=^A@\r, kf10=^AI\r, kf11=^AJ\r, -- kf12=^AK\r, kf13=^AL\r, kf14=^AM\r, kf15=^AN\r, kf16=^AO\r, -- kf2=^AA\r, kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, kf6=^AE\r, -- kf7=^AF\r, kf8=^AG\r, kf9=^AH\r, khome=^^, kich1=\EQ, -- kil1=\EE, knp=\EK, kpp=\EJ, kprt=\EP, krpl=\Er, ll=\E{^K, -- mc0=\EP, mc4=^T, mc5=\Ed#, nel=\r\n$<3>, -- pfloc=\EZ2%p1%{63}%+%c%p2%s\177, -- pfx=\EZ1%p1%{63}%+%c%p2%s\177, -- pln=\Ez%p1%{47}%+%c%p2%s\r, prot=\E), ri=\Ej$<7>, -- rmacs=\EcD, rmam=\Ed., rmclk=\E`c, rmcup=\Ew1, rmir=\Er, -- rmln=\EA11, rmxon=\Ec20, rs1=\E~!\E~4$<150>, -- rs2=\EeG$<150>, rs3=\EwG\Ee($<200>, -- sgr=%?%p8%t\E)%e\E(%;%?%p9%t\EcE%e\EcD%;\EG%{48}%?%p2%t%{8}%|%;%?%p1%p3%|%p6%|%t%{4}%|%;%?%p4%t%{2}%|%;%?%p1%p5%|%t%{64}%|%;%?%p7%t%{1}%|%;%c, -- sgr0=\E(\EH\003\EG0\EcD, smacs=\EcE, smam=\Ed/, -- smcup=\Ew0, smir=\Eq, smln=\EA10, smso=\EGt, smxon=\Ec21, -- tbc=\E0, tsl=\EF, use=adm+sgr, -+# sw7 ON - steady cursor - Factory Setting -+# OFF - blinking cursor - # --wy60-w|wyse60-w|wyse 60 132-column, -- cols#132, lw#7, nlab#16, wsl#97, -- cup=\Ea%i%p1%dR%p2%dC, dch1=\EW$<16>, ip=$<5>, -- rs2=\EeF$<150>\E`;$<150>, use=wy60, -+# sw8 ON causes selected attribute character to be displayed -+# OFF causes SPACE to be displayed instead - Factory Setting - # --wy60-25|wyse60-25|wyse 60 80-column 25-lines, -- lh@, lines#25, lw@, nlab@, -- pln@, rs3=\EwG\Ee)$<200>, use=wy60, --wy60-25-w|wyse60-25-w|wyse 60 132-column 25-lines, -- lh@, lines#25, lw@, nlab@, -- pln@, rs3=\EwG\Ee)$<200>, use=wy60-w, -+# S4 - Interface -+# -------------- -+# Modem Interface -+# S3 S4 S4 S4 S4 -+# sw4 sw1 sw2 sw3 sw4 -+# --------------------------- -+# OFF ON OFF ON OFF Enable RS-232C interface, Direct Connect and -+# Current Loop disabled - Factory Setting -+# ON ON OFF ON OFF Enable Current Loop interface, Direct Connect -+# disabled -+# OFF OFF ON OFF ON Enable Direct Connect interface, RS-232C and -+# Current Loop Disabled - # --wy60-42|wyse60-42|wyse 60 80-column 42-lines, -- lines#42, -- clear=\E+$<260>, cup=\E=%p1%{32}%+%c%p2%{32}%+%c$<2>, -- dch1=\EW$<16>, dl1=\ER$<11>, ed=\Ey$<260>, il1=\EE$<11>, -- ind=\n$<9>, ip=$<5>, is1=\EcB2\EcC3, nel=\r\n$<6>, -- ri=\Ej$<10>, rs3=\Ee*$<150>, use=wy60, --wy60-42-w|wyse60-42-w|wyse 60 132-column 42-lines, -- cols#132, lw#7, nlab#16, wsl#97, -- clear=\E+$<260>, cup=\Ea%i%p1%dR%p2%dC$<2>, -- dch1=\EW$<19>, ed=\Ey$<260>, home=\036$<2>, ip=$<6>, -- nel=\r\n$<11>, rs2=\EeF$<150>\E`;$<150>, use=wy60-42, -+# sw5 ON disables dot stretching mode - Factory Setting -+# OFF enables dot stretching mode -+# sw6 ON enables blanking function -+# OFF enables underline function - Factory Setting -+# sw7 ON causes NULLS to be displayed as NULLS -+# OFF causes NULLS to be displayed as SPACES - Factory Setting - # --wy60-43|wyse60-43|wyse 60 80-column 43-lines, -- lh@, lines#43, lw@, nlab@, -- pln@, rs3=\Ee+$<150>, use=wy60-42, --wy60-43-w|wyse60-43-w|wyse 60 132-column 43-lines, -- lh@, lines#43, lw@, nlab@, -- pln@, rs3=\Ee+$<150>, use=wy60-42-w, -+# S5 - Word Structure -+# ------------------- -+# sw1 ON enables BREAK key - Factory Setting -+# OFF disables BREAK key -+# sw2 ON selects 50Hz monitor refresh rate -+# OFF selects 60Hz monitor refresh rate - Factory Setting - # --wy60-vb|wyse60-vb|Wyse 60 visible bell, -- bel@, use=wy60, --wy60-w-vb|wy60-wvb|wyse60-wvb|Wyse 60 132-column visible bell, -- bel@, use=wy60-w, -- --# The Wyse-99GT looks at lot like the Wyse 60 except that it --# does not have the 42/43 line mode. In the Wyse-60 the "lines" --# setup parameter controls the number of lines on the screen. --# For the Wyse 99GT the "lines" setup parameter controls the --# number of lines in a page. The screen can display 25 lines max. --# The Wyse-99GT also has personalities for the VT220 and --# Tektronix 4014. But this has no bearing on the native mode. -+# Modem Port Selection -+# sw3 sw4 sw5 -+# --------------- -+# ON ON ON Selects 7 DATA bits, even parity, 2 STOP bits -+# OFF ON ON Selects 7 DATA bits, odd parity, 2 STOP bits -+# ON OFF ON Selects 7 DATA bits, even parity, 1 STOP bit - Factory Set. -+# OFF OFF ON Selects 7 DATA bits, odd parity, 1 STOP bit -+# ON ON OFF Selects 8 DATA bits, no parity, 2 STOP bits -+# OFF ON OFF Selects 8 DATA bits, no parity, 1 STOP bit -+# ON OFF OFF Selects 8 DATA bits, even parity, 1 STOP bit -+# OFF OFF OFF Selects 8 DATA bits, odd parity, 1 STOP bit - # --# (msgr) should be set but the clear screen fails when in --# alt-charset mode. Try \EcE\s\s\E+\s if the screen is really clear --# then set msgr, else use msgr@. -+# sw6 ON sends bit 8 a 1 (mark) -+# OFF sends bit 8 as 0 (space) - Factory Setting -+# sw7 ON selects Block Mode -+# OFF selects Conversation Mode - Factory Setting -+# sw8 ON selects Full Duplex operation -+# OFF selects Half Duplex operation - Factory Setting - # --# u0 -> enter Tektronix mode --# u1 -> exit Tektronix mode -+# S6 - Printer -+# ------------ -+# sw1, sw2, sw6, sw7 Reserved - Factory 0 - # --wy99gt|wyse99gt|Wyse 99gt, -- msgr@, -- clear=\E+$<130>, dch1=\EW$<7>, dl1=\ER$<4>, ed=\Ey$<130>, -- el=\Et$<5>, flash=\E`8$<100/>\E`9, ht=\011$<1>, -- il1=\EE$<4>, ind=\n$<4>, ip=$<2>, is3=\Ew0$<20>, nel@, -- ri=\Ej$<3>, rmcup=\Ew0, rs2=\E`\:$<150>, smcup=\Ew1, -- u0=\E~>\E8, u1=\E[42h, use=wy60, -+# Printer Port Selection -+# same as Modem above, bit 8 (when 8 DATA bits) is always = 0 - # --wy99gt-w|wyse99gt-w|wyse 99gt 132-column, -- cols#132, lw#7, nlab#16, wsl#97, -- clear=\E+$<160>, cup=\Ea%i%p1%dR%p2%dC$<2>, -- dch1=\EW$<9>, ed=\Ey$<160>, ip=$<4>, rs2=\E`;$<150>, -- use=wy99gt, -+# sw8 ON enables Printer Port -+# OFF disables Printer Port - Factory Setting - # --wy99gt-25|wyse99gt-25|wyse 99gt 80-column 25-lines, -- lh@, lines#25, lw@, nlab@, -- pln@, rs2=\E`\:$<150>, rs3=\EwG\Ee)$<200>, use=wy99gt, -+# S7 - Polling Address -+# -------------------- -+# sw1-7 Establish ASCII character which designates terminal polling address -+# ON = logic 0 -+# OFF = logic 1 - Factory Setting -+# sw8 ON enables Polling Option -+# OFF disables Polling Option - Factory Setting - # --wy99gt-25-w|wyse99gt-25-w|wyse 99gt 132-column 25-lines, -- lh@, lines#25, lw@, nlab@, -- pln@, rs2=\E`;$<150>, use=wy99gt-w, - # --wy99gt-vb|wyse99gt-vb|Wyse 99gt visible bell, -- bel@, use=wy99gt, -+# On some older adm31s, S4 does not exist, and S5-sw6 is not defined. - # --wy99gt-w-vb|wy99gt-wvb|wyse99gt-wvb|Wyse 99gt 132-column visible bell, -- bel@, use=wy99gt-w, -- --# Can't set tabs! Other bugs (ANSI mode only): --# - can't redefine function keys (anyway, key redefinition in ANSI mode --# is too much complex to be described); --# - meta key can't be described (the terminal forgets it when reset); --# The xon-xoff handshaking can't be disabled while in ansi personality, so --# emacs can't work at speed greater than 9600 baud. No padding is needed at --# this speed. --# dch1 has been commented out because it causes annoying glittering when --# vi deletes one character at the beginning of a line with tabs in it. --# dch makes sysgen(1M) have a horrible behaviour when deleting --# a screen and makes screen(1) behave badly, so it is disabled too. The nice --# thing is that vi goes crazy if smir-rmir are present and both dch-dch1 are --# not, so smir and rmir are commented out as well. --# From: Francesco Potorti` <F.Potorti@cnuce.cnr.it>, 24 Aug 1998 --wy99-ansi|Wyse WY-99GT in ansi mode (int'l PC keyboard), -- am, km, mc5i, mir, msgr, xenl, -- cols#80, it#8, lines#25, vt#3, -- acsc=``aaffggjjkkllmmnnooqqssttuuvvwwxx{{||}}~~, -- bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l, -- clear=\E[H\E[J$<200>, cnorm=\E[34h\E[?25h, cr=^M, -- csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD$<1>, -- cub1=\010$<1>, cud=\E[%p1%dB, cud1=\ED, -- cuf=\E[%p1%dC$<1>, cuf1=\E[C$<1>, -- cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\EM, -- cvvis=\E[34l\E[?25h, dim=\E[2m, dl=\E[%p1%dM, dl1=\E[M, -- ech=\E[%p1%dX, ed=\E[J$<8*>, el=\E[K$<1>, el1=\E[1K$<1>, -- enacs=\E)0, flash=\E[?5h$<30/>\E[?5l, home=\E[H, -- hpa=\E[%i%p1%dG, ht=^I, ich=\E[%p1%d@, il=\E[%p1%dL, -- il1=\E[L, ind=\n$<1>, invis=\E[8m, -- is2=\E7\E[1r\E8\E[2;3;4;13;20;34;39;36l\E[12;16;34h\E[?1;3;4;5;10;18l\E[?7;8;25h\E>\E[?5W\E(B\017\E[4i, -- kbs=^H, kcbt=\E[z, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, -- kcuu1=\EOA, kf1=\EOP, kf10=\E[21~, kf11=\E[23~, -- kf12=\E[24~, kf17=\E[K, kf18=\E[31~, kf19=\E[32~, kf2=\EOQ, -- kf20=\E[33~, kf21=\E[34~, kf22=\E[35~, kf23=\E[1~, -- kf24=\E[2~, kf3=\EOR, kf4=\EOS, kf5=\E[M, kf6=\E[17~, -- kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, ll=\E[24E, mc0=\E[?19h, -- mc4=\E[4i, mc5=\E[5i, nel=\EE, prot=\E[1"q, rc=\E8, -- rev=\E[7m, ri=\EM, rmacs=^O, rmam=\E[?7l, rmir=\E[4l, -- rmkx=\E[?1l, rmso=\E[27m, rmul=\E[24m, -- rs2=\E[61"p\E[40h\E[?6l\E[1r\E[2;3;4;13;20;34;39;36l\E[12;16;34h\E[?1;3;4;5;10;18l\E[?7;8;25h\E>\E[?5W\E(B\017\E[24E\E[4i, -- sc=\E7, -- sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%O%t;7%;%?%p4%t;5%;%?%p5%t;2%;%?%p7%t;8%;m\E[%?%p8%t1%;"q%?%p9%t\016%e\017%;, -- sgr0=\E[m\017\E["q, smacs=^N, smam=\E[?7h, smir=\E[4h, -- smkx=\E[?1h, smso=\E[7m, smul=\E[4m, vpa=\E[%i%p1%dd, -- --# This is the american terminal. Here tabs work fine. --# From: Francesco Potorti` <F.Potorti@cnuce.cnr.it>, 24 Aug 1998 --wy99a-ansi|Wyse WY-99GT in ansi mode (US PC keyboard), -- hts=\EH, is3=\E[?5l, rs3=\E[?5l, tbc=\E[3g, use=wy99-ansi, -- --# This terminal (firmware version 02) has a lot of bugs: --# - can't set tabs; --# - other bugs in ANSI modes (see above). --# This description disables handshaking when using cup. This is because --# GNU emacs doesn't like Xon-Xoff handshaking. This means the terminal --# cannot be used at speeds greater than 9600 baud, because at greater --# speeds handshaking is needed even for character sending. If you use --# DTR handshaking, you can use even greater speeds. --# From: Francesco Potorti` <F.Potorti@cnuce.cnr.it>, 24 Aug 1998 --wy99f|wy99fgt|wy-99fgt|Wyse WY-99GT (int'l PC keyboard), -- am, bw, hs, km, mc5i, mir, msgr, xon, -- cols#80, it#8, lines#25, wsl#46, -- acsc='x+y.w_vi~j(k'l&m%n)o9q*s8t-u.v\,w+x=, bel=^G, -- blink=\EG2, cbt=\EI, civis=\E`0, clear=\E'\E(\032, -- cnorm=\E`4\E`1, cr=^M, cub1=^H, cud1=\Ej, cuf1=^L, -+# This adm31 entry uses underline as the standout mode. -+# If the adm31 gives you trouble with standout mode, check the DIP switch in -+# position 6, bank @c11, 25% from back end of the circuit board. Should be -+# OFF. If there is no such switch, you have an old adm31 and must use oadm31. -+# (adm31: removed obsolete ":ma=j^Jk^P^K^Pl ^R^L^L :" -- esr) -+adm31|lsi adm31 with sw6 set for underline mode, -+ OTbs, am, mir, -+ cols#80, lines#24, -+ bel=^G, clear=\E*, cr=^M, cub1=^H, cud1=^J, cuf1=^L, -+ cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW, -+ dl1=\ER, ed=\EY, el=\ET, home=^^, il1=\EE, ind=^J, is2=\Eu\E0, -+ kcub1=^H, kcud1=^J, kcuf1=^L, kcuu1=^K, kf0=^A0\r, kf1=^A1\r, -+ kf2=^A2\r, kf3=^A3\r, kf4=^A4\r, kf5=^A5\r, kf6=^A6\r, -+ kf7=^A7\r, kf8=^A8\r, kf9=^A9\r, rmir=\Er, rmso=\EG0, -+ rmul=\EG0, sgr0=\EG0, smir=\Eq, smso=\EG1, smul=\EG1, -+adm31-old|o31|old adm31, -+ rmul@, smso=\EG4, smul@, use=adm31, -+# LSI ADM-36 from Col. George L. Sicherman <gloria!colonel> via BRL -+adm36|LSI ADM36, -+ OTbs, OTpt, -+ OTkn#4, -+ if=/usr/share/tabset/vt100, -+ is2=\E<\E>\E[6;?2;?7;?8h\E[4;20;?1;?3;?4;?5;?6;?18;?19l, -+ use=vt100, -+# (adm42: removed obsolete ":ma=^K^P:" -- esr) -+adm42|lsi adm42, -+ OTbs, am, -+ cols#80, lines#24, -+ bel=^G, cbt=\EI, clear=\E;, cr=^M, cub1=^H, cud1=^J, cuf1=^L, - cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, -- cvvis=\E`2\E`1, dch1=\EW, dim=\EGp, dl1=\ER, dsl=\EF\r, -- ed=\EY$<8*>, el=\ET$<8>, enacs=\Ec@1J$<2000>, -- flash=\E\^1$<30/>\E\^0, fsl=^M, home=^^, ht=^I, il1=\EE, -- ind=^J, invis=\EG3, -- is2=\Eu\Ee6\EC\EDF\Ec21\Ec31\Ec62\Ec72\Ee;\016\E'\EeL\E`9\E\^0\E`1\E`4\Ee.\E`\:\Ee1\EG0\E(\Ed/\Ee4\Ed*\EO\E`I\Er\Ee"\EcD\024, -- ka1=^^, ka3=\EJ, kbs=^H, kc1=\ET, kc3=\EK, kcbt=\EI, kcub1=^H, -- kcud1=^J, kcuf1=^L, kcuu1=^K, kf1=^A@\r, kf10=^AI\r, -- kf11=^AJ\r, kf12=^AK\r, kf13=^A`\r, kf14=^Aa\r, kf15=^Ab\r, -- kf16=^Ac\r, kf17=^Ad\r, kf18=^Ae\r, kf19=^Af\r, kf2=^AA\r, -- kf20=^Ag\r, kf21=^Ah\r, kf22=^Ai\r, kf23=^Aj\r, kf24=^Ak\r, -- kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, kf6=^AE\r, kf7=^AF\r, -- kf8=^AG\r, kf9=^AH\r, kprt=\EP, mc0=\EP, mc4=^T, mc5=\Ed#, -- nel=^_, prot=\E), rev=\EG4, ri=\Ej, rmacs=\EcD, rmam=\Ed., -- rmcup=\Ec21\Ec31, rmir=\Er, rmso=\EG0, rmxon=\Ec20\Ec30, -- rs2=\Eu\E~4\Ee6\EC\EDF\Ec21\Ec31\Ec62\Ec72\Ee;\016\E'\EeL\E`9\E\^0\E`1\E`4\Ee.\E`\:\Ee)\Ew\EwG\Ew0\Ee1\EG0\E(\Ed/\Ee4\Ed*\EO\E`I\Er\Ee"\Ec@0B\EcD\024, -- sgr=\E(\EG%{48}%?%p1%p3%O%t%{4}%+%;%?%p2%t%{8}%+%;%?%p4%t%{2}%+%;%?%p5%t%{64}%+%;%?%p7%t%{1}%+%;%c%?%p8%t\E)%;%?%p9%t\EcE%e\EcD%;, -- sgr0=\E(\EG0, smacs=\EcE, smam=\Ed/, smcup=\Ec20\Ec30, -- smir=\Eq, smso=\EG4, smxon=\Ec21\Ec31, tsl=\EF, -- --# This is the american terminal. Here tabs work. --# From: Francesco Potorti` <F.Potorti@cnuce.cnr.it>, 24 Aug 1998 --wy99fa|wy99fgta|wy-99fgta|Wyse WY-99GT (US PC keyboard), -- hts=\E1, tbc=\E0, use=wy99f, -+ cvvis=\EC\E3 \E3(, dch1=\EW, dl1=\ER, ed=\EY, el=\ET, ht=^I, -+ il1=\EE$<270>, ind=^J, invis@, ip=$<6*>, kcub1=^H, kcud1=^J, -+ kcuf1=^L, kcuu1=^K, khome=^^, pad=\177, rmir=\Er, rmul@, -+ smir=\Eq, smul@, use=adm+sgr, -+# The following termcap for the Lear Siegler ADM-42 leaves the -+# "system line" at the bottom of the screen blank (for those who -+# find it distracting otherwise) -+adm42-ns|lsi adm-42 with no system line, -+ cbt=\EI\EF \011, clear=\E;\EF \011, -+ cup=\E=%p1%{32}%+%c%p2%{32}%+%c$<6>\EF \011, -+ dch1=\EW\EF \011, dl1=\ER\EF \011, ed=\EY\EF \011, -+ el=\ET\EF \011, il1=\EE\EF \011, rmir=\Er\EF \011, -+ smir=\Eq\EF \011, use=adm42, -+# ADM 1178 terminal -- rather like an ADM-42. Manual is dated March 1 1985. -+# The insert mode of this terminal is commented out because it's broken for our -+# purposes in that it will shift the position of every character on the page, -+# not just the cursor line! -+# From: Michael Driscoll <fenris@lightspeed.net> 10 July 1996 -+adm1178|1178|lsi adm1178, -+ am, -+ cols#80, lines#24, xmc#1, -+ bel=^G, bold=\E(, cbt=\EI, clear=\E+, cr=^M, cub1=^H, cud1=^J, -+ cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, -+ cvvis=\EC\E3 \E3(, dch1=\EW, dl1=\ER, ed=\EY, el=\ET, -+ home=^^, ht=^I, il1=\EE, ind=^J, ip=$<6*/>, kbs=^H, kcub1=^H, -+ kcud1=^J, nel=^M^J, pad=\177, rev=\EG4, rmso=\EG0, rmul=\EG0, -+ sgr0=\E), smso=\EG4, smul=\EG1, - -+#### Prime - # --# The Wyse 160 is combination of the WY-60 and the WY-99gt. --# The reset strings are slow and the pad times very depending --# on other parameters such as font loading. I have tried --# to follow the following outline: -+# Yes, Prime made terminals. These entries were posted by Kevin J. Cummings -+# <cummings@primerd.prime.com> on 14 Dec 1992 and lightly edited by esr. -+# Prime merged with ComputerVision in the late 1980s; you can reach them at: - # --# <rs1> -> set personality --# <rs2> -> set number of columns --# <rs3> -> set number of lines --# <is1> -> select the proper font --# <is2> -> do the initialization --# <is3> -> set up display memory (2 pages) -+# ComputerVision Services -+# 500 Old Connecticut Path -+# Framingham, Mass. - # --# The display memory may be used for either text or graphics. --# When "Display Memory = Shared" the terminal will have more pages --# but garbage may be left on the screen when you switch from --# graphics to text. If "Display Memory = Unshared" then the --# text area will be only one page long. -+ -+# Standout mode is dim reverse-video. -+pt100|pt200|wren|fenix|prime pt100/pt200, -+ am, bw, mir, msgr, -+ cols#80, it#8, lines#24, -+ cbt=\E[Z, clear=\E?, cr=^M, cub=\E[%p1%dD, cub1=^H, -+ cud=\E[%p1%dB, cud1=\ED, cuf=\E[%p1%dC, cuf1=\E[C, -+ cup=\E0%p1%{33}%+%c%p2%{33}%+%c, cuu=\E[%p1%dA, -+ cuu1=\EM, dch=\E[%p1%dP, dch1=\E[P, dim=\E[2m, dl1=\E[M, -+ ed=\E[J\E[r, el=\E[K\E[t, flash=\E$$<200/>\E$P, -+ home=\E$B, ht=^I, il1=\E[L\E[t, ind=^J, kbs=^H, kcub1=\E[D, -+ kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, khome=\E$A, nel=^M^J, -+ rmcup=, rmir=\E[4l, rmkx=\E[>13l, rmso=\E[m, rmul=\E[m, -+ sgr0=\E[m, -+ smcup=\E[>1l\E[>2l\E[>16l\E[4l\E[>9l\E[20l\E[>3l\E[>7h\E[>12l\E[1Q, -+ smir=\E[4h, smkx=\E[>13h, smso=\E[2;7m, smul=\E[4m, -+pt100w|pt200w|wrenw|fenixw|prime pt100/pt200 in 132-column mode, -+ cols#132, -+ cup=\E[%i%p1%d;%p2%dH, use=pt100, -+pt250|Prime PT250, -+ rmso@, smso@, use=pt100, -+pt250w|Prime PT250 in 132-column mode, -+ rmso@, smso@, use=pt100w, -+ -+#### Qume (qvt) - # --# (wy160: we use \E{ rather than ^^ for home (both are documented) to avoid --# a bug reported by Robert Dunn, <rcdii@inlink.com> -- esr) --wy160|wyse160|Wyse 160, -- am, bw, hs, km, mc5i, mir, msgr, -- cols#80, lh#1, lines#24, lw#8, nlab#8, wsl#38, -- acsc=+/\,.0[a2fxgqh1ihjYk?lZm@nEqDtCu4vAwBx3yszr{c~~, -- bel=^G, blink=\EG2, cbt=\EI, civis=\E`0, clear=\E+$<30>, -- cnorm=\E`1, cr=^M, cub1=^H, cud1=^J, cuf1=^L, -- cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW$<5>, -- dclk=\E`b, dim=\EGp, dl1=\ER$<1>, dsl=\EF\r, ed=\EY$<30>, -- el=\ET$<5>, flash=\E`8$<100/>\E`9, fsl=^M, home=\E{, ht=^I, -- hts=\E1, il1=\EE$<1>, ind=\n$<1>, ip=$<2>, is1=\EcB0\EcC1, -- is2=\Ed$\EcD\E'\Er\EH\003\Ed/\EO\Ee1\Ed*\E`@\E`9\E`1\016\024\El, -- is3=\Ew0$<100>, kHOM=\E{, kbs=^H, kcbt=\EI, kcub1=^H, -- kcud1=^J, kcuf1=^L, kcuu1=^K, kdch1=\EW, kdl1=\ER, ked=\EY, -- kel=\ET, kent=\E7, kf1=^A@\r, kf10=^AI\r, kf11=^AJ\r, -- kf12=^AK\r, kf13=^AL\r, kf14=^AM\r, kf15=^AN\r, kf16=^AO\r, -- kf2=^AA\r, kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, kf6=^AE\r, -- kf7=^AF\r, kf8=^AG\r, kf9=^AH\r, khome=^^, kich1=\EQ, -- kil1=\EE, knp=\EK, kpp=\EJ, kprt=\EP, krpl=\Er, ll=\E{^K, -- mc0=\EP, mc4=^T, mc5=\Ed#, nel=\r\n$<1>, -- pfloc=\EZ2%p1%{63}%+%c%p2%s\177, -- pfx=\EZ1%p1%{63}%+%c%p2%s\177, -- pln=\Ez%p1%{47}%+%c%p2%s\r, prot=\E), ri=\Ej$<1>, -- rmacs=\EcD, rmam=\Ed., rmclk=\E`c, rmcup=\Ew0, rmir=\Er, -- rmln=\EA11, rmxon=\Ec20, rs1=\E~!\E~4$<70>, -- rs2=\E`\:$<100>, rs3=\EwG\Ee($<140>, -- sgr=%?%p8%t\E)%e\E(%;%?%p9%t\EcE%e\EcD%;\EG%{48}%?%p2%t%{8}%|%;%?%p1%p3%|%p6%|%t%{4}%|%;%?%p4%t%{2}%|%;%?%p1%p5%|%t%{64}%|%;%?%p7%t%{1}%|%;%c, -- sgr0=\E(\EH\003\EG0\EcD, smacs=\EcE, smam=\Ed/, -- smcup=\Ew1, smir=\Eq, smln=\EA10, smso=\EGt, smxon=\Ec21, -- tbc=\E0, tsl=\EF, use=adm+sgr, -+# Qume, Inc. -+# 3475-A North 1st Street -+# San Jose CA 95134 -+# Vox: (800)-457-4447 -+# Fax: (408)-473-1510 -+# Net: josed@techsupp.wyse.com (Jose D'Oliveira) - # --wy160-w|wyse160-w|wyse 160 132-column, -- cols#132, lw#7, nlab#16, wsl#90, -- cup=\Ea%i%p1%dR%p2%dC, dch1=\EW$<9>, -- rs2=\EeF$<150>\E`;$<150>, use=wy160, -+# Qume was bought by Wyse, but still (as of early 1995) has its own support -+# group and production division. - # --wy160-25|wyse160-25|wyse 160 80-column 25-lines, -- lh@, lines#25, lw@, nlab@, -- pln@, rs3=\EwG\Ee)$<200>, use=wy160, --wy160-25-w|wyse160-25-w|wyse 160 132-column 25-lines, -- lh@, lines#25, lw@, nlab@, -- pln@, rs3=\EwG\Ee)$<200>, use=wy160-w, -+# Discontinued Qume models: - # --wy160-42|wyse160-42|wyse 160 80-column 42-lines, -- lines#42, -- clear=\E+$<50>, dl1=\ER$<2>, ed=\Ey$<50>, il1=\EE$<2>, -- ind=\n$<2>, is1=\EcB2\EcC3, nel=\r\n$<2>, ri=\Ej$<2>, -- rs3=\Ee*$<150>, use=wy160, --wy160-42-w|wyse160-42-w|wyse 160 132-column 42-lines, -- cols#132, lw#7, nlab#16, wsl#90, -- cup=\Ea%i%p1%dR%p2%dC, dch1=\EW$<8>, ip=$<3>, -- rs2=\EeF$<150>\E`;$<150>, use=wy160-42, -+# The qvt101 and qvt102 listed here are long obsolete; so is the qvt101+ -+# built to replace them, and a qvt119+ which was a 101+ with available wide -+# mode (132 columns). There was a qvt103 which added vt100/vt131 emulations -+# and an ANSI-compatible qvt203 that replaced it. Qume started producing -+# ANSI-compatible terminals with the qvt323 and qvt61. - # --wy160-43|wyse160-43|wyse 160 80-column 43-lines, -- lh@, lines#43, lw@, nlab@, -- pln@, rs3=\Ee+$<150>, use=wy160-42, --wy160-43-w|wyse160-43-w|wyse 160 132-column 43-lines, -- lh@, lines#43, lw@, nlab@, -- pln@, rs3=\Ee+$<150>, use=wy160-42-w, -+# Current Qume models (as of February 1995): - # --wy160-vb|wyse160-vb|Wyse 160 visible bell, -- bel@, use=wy160, --wy160-w-vb|wy160-wvb|wyse160-wvb|Wyse 160 132-column visible bell, -- bel@, use=wy160-w, -+# All current Qume terminals have ANSI-compatible operation modes. -+# Qume is still producing the qvt62, which features emulations for other -+# popular lines such as ADDS, and dual-host capabilities. The qvt82 is -+# designed for use as a SCO ANSI terminal. The qvt70 is a color terminal -+# with many emulations including Wyse370, Wyse 325, etc. Their newest -+# model is the qvt520, which is vt420-compatible. - # --# The Wyse 75 is a vt100 lookalike without advanced video. -+# There are some ancient printing Qume terminals under `Daisy Wheel Printers' - # --# The Wyse 75 can support one attribute (e.g. Dim, Inverse, --# Underline) without magic cookies. The following description --# uses this capability, but when more than one attribute is --# put on the screen at once, all attributes will be changed --# to be the same as the last attribute given. --# The Wyse 75 can support more attributes when used with magic --# cookies. The wy75-mc terminal description uses magic cookies --# to correctly handle multiple attributes on a screen. -+# If you inherit a Qume without docs, try Ctrl-Shift-Setup to enter its -+# setup mode. Shift-s should be a configuration save to NVRAM. -+ -+qvt101|qvt108|qume qvt 101 and QVT 108, -+ xmc#1, use=qvt101+, -+ -+# This used to have <cvvis=\E.2> but no <cnorm> or <civis>. The BSD termcap -+# file had <cvvis=\EM4 \200\200\200>. I've done the safe thing and yanked -+# both. The <rev> is from BSD, which also claimed bold=\E( and dim=\E). -+# What seems to be going on here is that this entry was designed so that -+# the normal highlight is bold and standout is dim plus something else -+# (reverse-video maybe? But then, are there two <rev> sequences?) - # --wy75|wyse75|wyse 75, -- am, hs, mc5i, mir, msgr, xenl, xon, -- cols#80, lines#24, ma#1, pb#1201, wsl#78, -- acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -- bel=^G, cbt=\E[Z, civis=\E[?25l, clear=\E[H\E[J$<30>, -- cnorm=\E[?25h, cr=^M, csr=\E[%i%p1%d;%p2%dr$<2>, -+# Added kdch1, kil1, kdl1 based on screenshot -TD: -+# http://www.vintagecomputer.net/qume/qvt-108/qume_qvt-108_keyboard.jpg -+qvt101+|qvt101p|qume qvt 101 PLUS product, -+ am, bw, hs, ul, -+ cols#80, lines#24, xmc#0, -+ bel=^G, cbt=\EI, clear=^Z, cnorm=\E.4, cr=^M, cub1=^H, cud1=^J, -+ cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, -+ dch1=\EW, dl1=\ER, dsl=\Eg\Ef\r, ed=\EY, el=\ET, -+ flash=\Eb$<200>\Ed, fsl=^M, home=^^, ht=^I, hts=\E1, -+ ich1=\EQ, il1=\EE, ind=^J, invis@, kbs=^H, kcbt=\EI, kcub1=^H, -+ kcud1=^J, kcuf1=^L, kcuu1=^K, kdch1=\EW, kdl1=\ER, ked=\EY, -+ kel=\ET, kf1=^A@\r, kf10=^AI\r, kf2=^AA\r, kf3=^AB\r, -+ kf4=^AC\r, kf5=^AD\r, kf6=^AE\r, kf7=^AF\r, kf8=^AG\r, -+ kf9=^AH\r, khome=^^, kich1=\EQ, kil1=\EE, mc4=\EA, mc5=\E@, -+ rmso=\E(, smso=\E0P\E), tbc=\E3, tsl=\Eg\Ef, use=adm+sgr, -+qvt102|qume qvt 102, -+ cnorm=\E., use=qvt101, -+# (qvt103: added <rmam>/<smam> based on init string -- esr) -+qvt103|qume qvt 103, -+ am, xenl, xon, -+ cols#80, it#8, lines#24, vt#3, -+ bel=^G, blink=\E[5m$<2>, bold=\E[1m$<2>, -+ clear=\E[H\E[2J$<50>, cr=^M, csr=\E[%i%p1%d;%p2%dr, - cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=^J, -- cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, -- cuu=\E[%p1%dA, cuu1=\E[A, dch=\E[%p1%dP$<3*>, -- dch1=\E[P$<3>, dim=\E[0t\E[2m, dl=\E[%p1%dM$<1*>, -- dl1=\E[M, dsl=\E[>\,\001\001\E[>-\001\001, -- ech=\E[%p1%dX, ed=\E[J$<30>, el=\E[K$<3>, el1=\E[1K$<3>, -- enacs=\E)0, flash=\E[30h\E\,\E[30l$<250>, fsl=^A, -- home=\E[H, hpa=\E[%i%p1%dG, ht=^I, hts=\EH, -- ich=\E[%p1%d@$<1*>, il=\E[%p1%dL$<2*>, il1=\E[L$<2>, -- ind=\n$<2>, ip=$<1>, -- is1=\E[2;4;20;30l\E[?1;10l\E[12h\E[?7;8;25h, -- is2=\E>\E(B\E)0\017, is3=\E[m, kbs=^H, kcub1=\E[D, -- kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdl1=\E[M, kel=\E[K, -- kf1=\E[?5i, kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, -- kf13=\E[25~, kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, -- kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, kf2=\E[?3i, -- kf20=\E[34~, kf21=\E[35~, kf3=\E[2i, kf4=\E[@, kf5=\E[M, -- kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, kfnd=\E[1~, -- khlp=\E[28~, khome=\E[H, kich1=\E[@, kil1=\E[L, knp=\E[6~, -- kpp=\E[5~, kprt=\E[?5i, kslt=\E[4~, mc0=\E[0i, mc4=\E[4i, -- mc5=\E[5i, rc=\E8, rev=\E[1t\E[7m, ri=\EM$<2>, rmacs=^O, -- rmam=\E[?7l, rmir=\E[4l, rmkx=\E>, rmso=\E[m, rmul=\E[m, -- rs1=\E[13l\E[3l\E!p, rs2=\E[35h\E[?3l$<80>, rs3=\E[?5l, -- sc=\E7, -- sgr=%?%p5%t\E[0t%;%?%p3%p1%|%t\E[1t%;%?%p2%t\E[2t%;%?%p4%t\E[3t%;%?%p1%p2%p3%p4%p5%|%|%|%|%t\E[7m%e\E[m%;%?%p9%t\016%e\017%;, -- sgr0=\E[m\017, smacs=^N, smam=\E[?7h, smir=\E[4h, -- smkx=\E[?1l\E[?7h\E=, smso=\E[1t\E[7m, smul=\E[2t\E[4m, -- tbc=\E[3g, tsl=\E[>\,\001, use=vt220+keypad, -+ cuf=\E[%p1%dC, cuf1=\E[C$<2>, -+ cup=\E[%i%p1%d;%p2%dH$<5>, cuu=\E[%p1%dA, -+ cuu1=\E[A$<2>, ed=\E[J$<50>, el=\E[K$<3>, home=\E[H, ht=^I, -+ hts=\EH, ind=^J, kbs=^H, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, -+ kcuu1=\EOA, kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, rc=\E8, -+ rev=\E[7m$<2>, ri=\EM$<5>, rmam=\E[?7l, rmkx=\E[?1l\E>, -+ rmso=\E[m$<2>, rmul=\E[m$<2>, -+ rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sc=\E7, -+ sgr=\E[%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;m$<2>, -+ sgr0=\E[m$<2>, smam=\E[?7h, smkx=\E[?1h\E=, -+ smso=\E[7m$<2>, smul=\E[4m$<2>, tbc=\E[3g, -+qvt103-w|qume qvt103 132 cols, -+ cols#132, lines#24, -+ rs2=\E>\E[?3h\E[?4l\E[?5l\E[?8h, use=qvt103, -+qvt119+|qvt119p|qvt119|qume qvt 119 and 119PLUS terminals, -+ am, hs, mir, msgr, -+ cols#80, lines#24, xmc#0, -+ bel=^G, cbt=\EI, clear=\E*1, cnorm=\E.4, cr=^M, cub1=^H, -+ cud1=^J, cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, -+ cuu1=^K, cvvis=\E.2, dch1=\EW, dl1=\ER, dsl=\Eg\Ef\r, ed=\Ey, -+ el=\Et, flash=\En0$<200>\En1, fsl=^M, home=^^, ht=^I, -+ hts=\E1, il1=\EE, ind=^J, is2=\EDF\EC\EG0\Er\E(\E%EX, -+ kbs=^H, kcub1=^H, kcud1=^J, kcuf1=^L, kcuu1=^K, kf0=^AI\r, -+ kf1=^A@\r, kf2=^AA\r, kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, -+ kf6=^AE\r, kf7=^AF\r, kf8=^AG\r, kf9=^AH\r, khome=^^, -+ mc4=\EA, mc5=\E@, ri=\EJ, rmir=\Er, smir=\Eq, smul=\EG8, -+ tbc=\E3, tsl=\Eg\Ef, use=adm+sgr, -+qvt119+-25|qvt119p-25|QVT 119 PLUS with 25 data lines, -+ lines#25, use=qvt119+, -+qvt119+-w|qvt119p-w|qvt119-w|QVT 119 and 119 PLUS in 132 column mode, -+ cols#132, -+ is2=\EDF\EC\EG0\Er\E(\E%\EX\En4, use=qvt119+, -+qvt119+-25-w|qvt119p-25-w|qvt119-25-w|QVT 119 and 119 PLUS 132 by 25, -+ lines#25, use=qvt119+, -+qvt203|qvt203+|qume qvt 203 Plus, -+ dch1=\E[P$<7>, dl1=\E[M$<99>, il1=\E[L$<99>, ind=\n$<30>, -+ ip=$<7>, kf0=\E[29~, kf1=\E[17~, kf2=\E[18~, kf3=\E[19~, -+ kf4=\E[20~, kf5=\E[21~, kf6=\E[23~, kf7=\E[24~, kf8=\E[25~, -+ kf9=\E[28~, rmir=\E[4l, smir=\E[4h, use=qvt103, -+qvt203-w|qvt203-w-am|qume qvt 203 PLUS in 132 cols (w/advanced video), -+ cols#132, lines#24, -+ rs2=\E>\E[?3h\E[?4l\E[?5l\E[?8h, use=qvt203, - # --# This terminal description uses the non-hidden attribute mode --# (with magic cookie). -+# Since a command is present for enabling 25 data lines, -+# a specific terminfo entry may be generated for the 203. -+# If one is desired for the QVT 119 PLUS then 25 lines must -+# be selected in the status line (setup line 9). - # --wy75-mc|wyse75-mc|wyse 75 with magic cookies, -- msgr@, -- ma@, xmc#1, -- blink=\E[2p, dim=\E[1p, invis=\E[4p, is3=\E[m\E[p, -- rev=\E[16p, rmacs=\E[0p\017, rmso=\E[0p, rmul=\E[0p, -- sgr=\E[%{0}%?%p2%p6%|%t%{8}%|%;%?%p1%p3%|%p6%|%t%{16}%|%;%?%p4%t%{2}%|%;%?%p1%p5%|%t%{1}%|%;%?%p7%t%{4}%|%;%dp%?%p9%t\016%e\017%;, -- sgr0=\E[0p\017, smacs=\E[0p\016, smso=\E[17p, smul=\E[8p, -- use=wy75, --wy75-vb|wyse75-vb|wyse 75 with visible bell, -- pb@, -- bel@, use=wy75, --wy75-w|wyse75-w|wyse 75 in 132 column mode, -- cols#132, wsl#130, -- rs2=\E[35h\E[?3h$<80>, use=wy75, --wy75-wvb|wyse75-wvb|wyse 75 with visible bell 132 columns, -- pb@, -- bel@, use=wy75-w, -+qvt203-25|QVT 203 PLUS with 25 by 80 column mode, -+ cols#80, lines#25, -+ is2=\E[=40h\E[?3l, use=qvt203, -+qvt203-25-w|QVT 203 PLUS with 25 by 132 columns, -+ cols#132, lines#25, -+ rs2=\E[?3h\E[=40h, use=qvt203, -+ -+#### Televideo (tvi) - # --# Wyse 85 emulating a vt220 7 bit mode. --# 24 line screen with status line. -+# TeleVideo -+# 550 East Brokaw Road -+# PO Box 49048 95161 -+# San Jose CA 95112 -+# Vox: (408)-954-8333 -+# Fax: (408)-954-0623 - # --# The vt220 mode permits more function keys but it wipes out --# the escape key. I strongly recommend that <f11> be set to --# escape (esc). --# The terminal may have to be set for 8 data bits and 2 stop --# bits for the arrow keys to work. --# The Wyse 85 runs faster with XON/XOFF enabled. Also the --# <dch> and <ich> work best when XON/XOFF is set. <ich> and --# <dch> leave trash on the screen when used without XON/XOFF. - # --wy85|wyse85|wyse 85, -- am, hs, mc5i, mir, msgr, xenl, xon, -- cols#80, it#8, lines#24, wsl#80, -- acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -- bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l, -- clear=\E[H\E[J$<110>, cnorm=\E[?25h, cr=^M, -- csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, -- cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, -- cup=\E[%i%p1%d;%p2%dH$<1>, cuu=\E[%p1%dA, cuu1=\E[A, -- dch=\E[%p1%dP$<3*>, dch1=\E[P$<3>, dim=\E[2m, -- dl=\E[%p1%dM$<3*>, dl1=\E[M$<3>, dsl=\E[40l, -- ech=\E[%p1%dX, ed=\E[J$<110>, el=\E[K$<1>, el1=\E[1K, -- enacs=\E)0, flash=\E[30h\E\,\E[30l$<300>, -- fsl=\E[1;24r\E8, home=\E[H, ht=\011$<1>, hts=\EH, -- ich=\E[%p1%d@$<4*>, il=\E[%p1%dL$<5*>, il1=\E[L$<5>, -- ind=\n$<3>, invis=\E[8m, ip=$<3>, is1=\E[62;1"p\E[?5W, -- is2=\E[2;4;20;30l\E[?1;4;10;16l\E[12h\E[?7;8;25h$<16>, -- is3=\E>\E(B\E)0\017\E[m, kbs=^H, kcub1=\E[D, kcud1=\E[B, -- kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[3~, kf10=\E[21~, -- kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, -- kf15=\E[28~, kf16=\E[29~, kf17=\E[31~, kf18=\E[32~, -- kf19=\E[33~, kf20=\E[34~, kf6=\E[17~, kf7=\E[18~, -- kf8=\E[19~, kf9=\E[20~, kfnd=\E[1~, khlp=\E[28~, -- khome=\E[26~, kich1=\E[2~, knp=\E[6~, kpp=\E[5~, -- kslt=\E[4~, lf1=PF1, lf2=PF2, lf3=PF3, lf4=PF4, mc0=\E[0i, -- mc4=\E[4i, mc5=\E[5i, rc=\E8, rev=\E[7m, ri=\EM$<3>, -- rmacs=^O, rmam=\E[?7l, rmir=\E[4l, rmkx=\E>, rmso=\E[m, -- rmul=\E[m, rs1=\E[13l\E[3l\E!p, rs2=\E[35h\E[?3l$<70>, -- rs3=\E[?5l, sc=\E7, -- sgr=\E[0%?%p2%t;4%;%?%p3%p1%|%t;7%;%?%p4%t;5%;%?%p5%t;2%;%?%p6%t;1%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, -- sgr0=\E[m\017, smacs=^N, smam=\E[?7h, smir=\E[4h, -- smkx=\E[?1l\E=, smso=\E[7m, smul=\E[4m, tbc=\E[3g, -- tsl=\E[40h\E7\E[25;%i%p1%dH, use=vt220+keypad, -+# These require incredible amounts of padding. - # --# Wyse 85 with visual bell. --wy85-vb|wyse85-vb|wyse 85 with visible bell, -- bel@, flash=\E[30h\E\,\E[30l$<300>, use=wy85, -+# All of these terminals (912 to 970 and the tvipt) are discontinued. Newer -+# Televideo terminals are ANSI and PC-ANSI compatible. -+ -+tvi803|televideo 803, -+ clear=\E*$<10>, use=tvi950, -+ -+# Vanilla tvi910 -- W. Gish <cswarren@violet> 10/29/86 -+# Switch settings are: - # --# Wyse 85 in 132-column mode. --wy85-w|wyse85-w|wyse 85 in 132-column mode, -- cols#132, wsl#132, -- rs2=\E[35h\E[?3h$<70>, use=wy85, -+# S1 1 2 3 4 -+# D D D D 9600 -+# D D D U 50 -+# D D U D 75 -+# D D U U 110 -+# D U D D 135 -+# D U D U 150 -+# D U U D 300 -+# D U U U 600 -+# U D D D 1200 -+# U D D U 1800 -+# U D U D 2400 -+# U D U U 3600 -+# U U D D 4800 -+# U U D U 7200 -+# U U U D 9600 -+# U U U U 19200 - # --# Wyse 85 in 132-column mode with visual bell. --wy85-wvb|wyse85-wvb|wyse 85 with visible bell 132-columns, -- bel@, use=wy85-w, -- --# From: Kevin Turner <kevint@aracnet.com>, 12 Jul 1998 --# This copes with an apparent firmware bug in the wy85. He writes: --# "What I did was change leave the terminal cursor keys set to Normal --# (instead of application), and change \E[ to \233 for all the keys in --# terminfo. At one point, I found some reference indicating that this --# terminal bug (not sending \E[) was acknowledged by Wyse (so it's not just --# me), but I can't find that and the server under my bookmark to "Wyse --# Technical" isn't responding. So there's the question of wether the wy85 --# terminfo should reflect the manufactuer's intended behaviour of the terminal --# or the actual." --wy85-8bit|wyse85-8bit|wyse 85 in 8-bit mode, -- am, hs, mc5i, mir, msgr, xenl, xon, -- cols#80, it#8, lines#24, wsl#80, -- acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -- bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l, -- clear=\E[H\E[J$<110>, cnorm=\E[?25h, cr=^M, -- csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, -- cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, -- cup=\E[%i%p1%d;%p2%dH$<1>, cuu=\E[%p1%dA, cuu1=\E[A, -- dch=\E[%p1%dP$<3*>, dch1=\E[P$<3>, dim=\E[2m, -- dl=\E[%p1%dM$<3*>, dl1=\E[M$<3>, dsl=\E[40l, -- ech=\E[%p1%dX, ed=\E[J$<110>, el=\E[K$<1>, el1=\E[1K, -- enacs=\E)0, flash=\E[30h\E\,\E[30l$<300>, -- fsl=\E[1;24r\E8, home=\E[H, ht=\011$<1>, hts=\EH, -- ich=\E[%p1%d@$<4*>, il=\E[%p1%dL$<5*>, il1=\E[L$<5>, -- ind=\n$<3>, invis=\E[8m, ip=$<3>, is1=\E[62;1"p\E[?5W, -- is2=\E[2;4;20;30l\E[?1;4;10;16l\E[12h\E[?7;8;25h$<16>, -- is3=\E>\E(B\E)0\017\E[m, ka1=\EOw, ka3=\EOy, kb2=\EOu, -- kbs=^H, kc1=\EOq, kc3=\EOs, kcub1=\233D, kcud1=\233B, -- kcuf1=\233C, kcuu1=\233A, kdch1=\2333~, kent=\EOM, -- kf1=\EOP, kf10=\23321~, kf11=\23323~, kf12=\23324~, -- kf13=\23325~, kf14=\23326~, kf15=\23328~, kf16=\23329~, -- kf17=\23331~, kf18=\23332~, kf19=\23333~, kf2=\EOQ, -- kf20=\23334~, kf3=\EOR, kf4=\EOS, kf6=\23317~, kf7=\23318~, -- kf8=\23319~, kf9=\23320~, kfnd=\2331~, khlp=\23328~, -- khome=\23326~, kich1=\2332~, knp=\2336~, kpp=\2335~, -- kslt=\2334~, lf1=PF1, lf2=PF2, lf3=PF3, lf4=PF4, mc0=\E[0i, -- mc4=\E[4i, mc5=\E[5i, rc=\E8, rev=\E[7m, ri=\EM$<3>, -- rmacs=^O, rmam=\E[?7l, rmir=\E[4l, rmkx=\E>, rmso=\E[m, -- rmul=\E[m, rs1=\E[13l\E[3l\E!p, rs2=\E[35h\E[?3l$<70>, -- rs3=\E[?5l, sc=\E7, -- sgr=\E[0%?%p2%t;4%;%?%p3%p1%|%t;7%;%?%p4%t;5%;%?%p5%t;2%;%?%p6%t;1%;%?%p7%t;8%;+m%?%p9%t\016%e\017%;, -- sgr0=\E[m\017, smacs=^N, smam=\E[?7h, smir=\E[4h, -- smkx=\E[?1l\E=, smso=\E[7m, smul=\E[4m, tbc=\E[3g, -- tsl=\E[40h\E7\E[25;%i%p1%dH, -+# S1 5 6 7 8 -+# U D X D 7N1 (data bits, parity, stop bits) (X means ignored) -+# U D X U 7N2 -+# U U D D 7O1 -+# U U D U 7O2 -+# U U U D 7E1 -+# U U U U 7E2 -+# D D X D 8N1 -+# D D X U 8N2 -+# D U D D 8O1 -+# D U U U 8E2 - # --# Wyse 185 emulating a vt320 7 bit mode. -+# S1 9 Autowrap -+# U on -+# D off - # --# This terminal always displays 25 lines. These lines may be used --# as 24 data lines and a terminal status line (top or bottom) or --# 25 data lines. The 48 and 50 line modes change the page size --# and not the number of lines on the screen. -+# S1 10 CR/LF -+# U do CR/LF when CR received -+# D do CR when CR received - # --# The Compose Character key can be used as a meta key if changed --# by set-up. -+# S2 1 Mode -+# U block -+# D conversational - # --wy185|wyse185|wyse 185, -- am, hs, km, mc5i, mir, msgr, xenl, xon, -- cols#80, it#8, lines#24, wsl#80, -- acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -- bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l, -- clear=\E[H\E[J$<40>, cnorm=\E[34h\E[?25h, cr=^M, -- csr=\E[%i%p1%d;%p2%dr$<20>, cub=\E[%p1%dD, cub1=^H, -- cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, -- cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, -- cvvis=\E[?25h\E[34l, dch=\E[%p1%dP$<3>, dch1=\E[P$<3>, -- dim=\E[2m, dl=\E[%p1%dM$<2*>, dl1=\E[M$<2>, -- dsl=\E7\E[99;0H\E[K\E8, ech=\E[%p1%dX, ed=\E[J$<40>, -- el=\E[K, el1=\E[1K, enacs=\E)0, -- flash=\E[30h\E\,\E[30l$<100>, fsl=\E[1;24r\E8, -- home=\E[H, hpa=\E[%i%p1%d`, ht=^I, hts=\EH, -- ich=\E[%p1%d@$<2>, il=\E[%p1%dL$<3*>, il1=\E[L$<3>, -- ind=\n$<2>, invis=\E[8m, ip=$<4>, is1=\E[?5W, -- is2=\E[2;4;20;30l\E[?1;4;10;16l\E[12h\E[?7;8;25h, -- is3=\E>\E(B\E)0\017\E[m, kbs=^H, kcbt=\E[Z, kcub1=\E[D, -- kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[3~, kf1=\EOP, -- kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, -- kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, kf17=\E[31~, -- kf18=\E[32~, kf19=\E[33~, kf2=\EOQ, kf20=\E[34~, kf3=\EOR, -- kf4=\EOS, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, -- kfnd=\E[1~, khlp=\E[28~, khome=\E[26~, kich1=\E[2~, -- knp=\E[6~, kpp=\E[5~, kslt=\E[4~, lf1=PF1, lf2=PF2, lf3=PF3, -- lf4=PF4, mc0=\E[0i, mc4=\E[4i, mc5=\E[5i, rc=\E8, rev=\E[7m, -- ri=\EM$<2>, rmacs=^O, rmam=\E[?7l, rmcup=\E[ R, rmir=\E[4l, -- rmkx=\E>, rmso=\E[27m, rmul=\E[24m, -- rs1=\E[13l\E[3l\E\\\E[63;1"p\E[!p, rs2=\E[35h\E[?3l, -- rs3=\E[?5l\E[47h\E[40l\E[r, sc=\E7, -- sgr=\E[0%?%p2%t;4%;%?%p3%p1%|%t;7%;%?%p4%t;5%;%?%p5%t;2%;%?%p6%t;1%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, -- sgr0=\E[m\017, smacs=^N, smam=\E[?7h, smcup=\E[ Q, -- smir=\E[4h, smkx=\E[?1l\E=, smso=\E[7m, smul=\E[4m, -- tbc=\E[3g, tsl=\E7\E[99;%i%p1%dH, vpa=\E[%i%p1%dd, -- use=vt220+keypad, -+# S2 2 Duplex -+# U half -+# D full - # --# Wyse 185 with 24 data lines and top status (terminal status) --wy185-24|wyse185-24|wyse 185 with 24 data lines, -- hs@, -- dsl@, fsl@, rs3=\E[?5l\E[47h\E[40l\E[1;24r, tsl@, -- use=wy185, -+# S2 3 Hertz -+# U 50 -+# D 60 - # --# Wyse 185 with visual bell. --wy185-vb|wyse185-vb|wyse 185+flash, -- bel@, use=wy185, -+# S2 4 Edit mode -+# U local -+# D duplex - # --# Wyse 185 in 132-column mode. --wy185-w|wyse185-w|wyse 185 in 132-column mode, -- cols#132, wsl#132, -- dch=\E[%p1%dP$<7>, dch1=\E[P$<7>, ich=\E[%p1%d@$<7>, -- ip=$<7>, rs2=\E[35h\E[?3h, use=wy185, -+# S2 5 Cursor type -+# U underline -+# D block - # --# Wyse 185 in 132-column mode with visual bell. --wy185-wvb|wyse185-wvb|wyse 185+flash+132 cols, -- bel@, use=wy185-w, -- --# wy325 terminfo entries --# Done by Joe H. Davis 3-9-92 -- --# lines 25 columns 80 -+# S2 6 Cursor down key -+# U send ^J -+# D send ^V - # --wy325|wyse325|Wyse epc, -- am, bw, hs, mc5i, mir, -- cols#80, lh#1, lines#24, lw#8, nlab#8, pb#9601, wsl#45, -- acsc=+/\,.0[a2fxgqh1ihjYk?lZm@nEqDtCu4vAwBx3yszr{c~~, -- bel=^G, blink=\EG2, cbt=\EI, civis=\E`0, clear=\E+$<50>, -- cnorm=\E`1, cr=^M, cub1=^H, cud1=^J, cuf1=^L, -- cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW$<7>, -- dim=\EGp, dl1=\ER$<3>, dsl=\EF\r, ed=\EY$<50>, el=\ET$<4>, -- flash=\E`8$<100/>\E`9, fsl=^M, home=^^, ht=^I, hts=\E1, -- il1=\EE$<3>, ind=\n$<3>, ip=$<2>, is1=\EcB0\EcC1, -- is2=\EcD\E'\Er\EH\003\Ed/\EO\Ee1\Ed*\E`@\E`9\E`1\016\024\El, -- is3=\Ew0$<16>, kHOM=\E{, kbs=^H, kcbt=\EI, kcub1=^H, -- kcud1=^J, kcuf1=^L, kcuu1=^K, kdch1=\EW, kdl1=\ER, ked=\EY, -- kel=\ET, kent=\E7, kf1=^A@\r, kf10=^AI\r, kf11=^AJ\r, -- kf12=^AK\r, kf13=^AL\r, kf14=^AM\r, kf15=^AN\r, kf16=^AO\r, -- kf2=^AA\r, kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, kf6=^AE\r, -- kf7=^AF\r, kf8=^AG\r, kf9=^AH\r, khome=^^, kich1=\Eq, -- kil1=\EE, knp=\EK, kpp=\EJ, kprt=\EP, krpl=\Er, ll=^^^K, -- mc0=\EP, mc4=^T, mc5=\Ed#, -- pfloc=\EZ2%p1%{63}%+%c%p2%s\177, -- pfx=\EZ1%p1%{63}%+%c%p2%s\177, -- pln=\Ez%p1%{47}%+%c%p2%s\r, prot=\E), ri=\Ej$<2>, -- rmacs=\EcD, rmam=\Ed., rmcup=\Ew0, rmir=\Er, rmln=\EA11, -- rs1=\E~!\E~4$<30>, rs2=\EeF\E`\:$<70>, -- rs3=\EwG\Ee($<100>, -- sgr=%?%p8%t\E)%e\E(%;%?%p9%t\EcE%e\EcD%;\EG%{48}%?%p2%t%{8}%|%;%?%p1%p3%|%p6%|%t%{4}%|%;%?%p4%t%{2}%|%;%?%p1%p5%|%t%{64}%|%;%?%p7%t%{1}%|%;%c, -- sgr0=\E(\EH\003\EG0\EcD, smacs=\EcE, smam=\Ed/, -- smcup=\Ew1, smir=\Eq, smln=\EA10, smso=\EGt, tbc=\E0, -- tsl=\EF, use=adm+sgr, -- -+# S2 7 Screen colour -+# U green on black -+# D black on green - # --# lines 24 columns 80 vb -+# S2 8 DSR status (pin 6) -+# U disconnected -+# D connected - # --wy325-vb|wyse325-vb|wyse-325 with visual bell, -- bel@, use=wy325, -- -+# S2 9 DCD status (pin 8) -+# U disconnected -+# D duplex - # --# lines 24 columns 132 -+# S2 10 DTR status (pin 20) -+# U disconnected -+# D duplex -+# (tvi910: removed obsolete ":ma=^Kk^Ll^R^L:"; added <khome>, <cub1>, <cud1>, -+# <ind>, <hpa>, <vpa>, <am>, <msgr> from SCO entry -- esr) -+tvi910|televideo model 910, -+ OTbs, am, msgr, -+ cols#80, it#8, lines#24, xmc#1, -+ bel=^G, cbt=\EI, clear=^Z, cr=^M, cub1=^H, cud1=^J, cuf1=^L, -+ cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, ed=\EY, el=\ET, -+ home=\E=\001\001, hpa=\E]%p1%{32}%+%c, ht=^I, -+ if=/usr/share/tabset/stdcrt, ind=^J, invis@, kbs=^H, -+ kcub1=^H, kcud1=^J, kcuf1=^L, kcuu1=^K, kf0=^AI\r, kf1=^A@\r, -+ kf2=^AA\r, kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, kf6=^AE\r, -+ kf7=^AF\r, kf8=^AG\r, kf9=^AH\r, khome=^^, -+ vpa=\E[%p1%{32}%+%c, use=adm+sgr, -+# From: Alan R. Rogers <rogers%albany@csnet-relay> -+# as subsequently hacked over by someone at SCO -+# (tvi910+: removed obsolete ":ma=^K^P^L :" -- esr) - # --wy325-w|wyse325-w|wy325w-24|wyse-325 in wide mode, -- cols#132, lw#7, nlab#16, wsl#97, -- cup=\Ea%i%p1%dR%p2%dC, dch1=\EW$<12>, ip=$<4>, -- rs2=\E`;$<70>, use=wy325, -+# Here are the 910+'s DIP switches (U = up, D = down, X = don't care): - # --# lines 25 columns 80 -+# S1 1 2 3 4: -+# D D D D 9600 D D D U 50 D D U D 75 D D U U 110 -+# D U D D 135 D U D U 150 D U U D 300 D U U U 600 -+# U D D D 1200 U D D U 1800 U D U D 2400 U D U U 3600 -+# U U D D 4800 U U D U 7200 U U U D 9600 U U U U 19200 - # --wy325-25|wyse325-25|wy325-80|wyse-325|wyse-325 25 lines, -- lh@, lines#25, lw@, nlab@, -- pln@, rs3=\EwG\Ee)$<100>, use=wy325, -+# S1 5 6 7 8: -+# U D X D 7N1 U D X U 7N2 U U D D 7O1 U U D U 7O2 -+# U U U D 7E1 U U U U 7E2 D D X D 8N1 D D X U 8N2 -+# D U D D 8O1 D U U U 8E2 - # --# lines 25 columns 132 -+# S1 9 Autowrap (U = on, D = off) -+# S1 10 CR/LF (U = CR/LF on CR received, D = CR on CR received) -+# S2 1 Mode (U = block, D = conversational) -+# S2 2 Duplex (U = half, D = full) -+# S2 3 Hertz (U = 50, D = 60) -+# S2 4 Edit mode (U = local, D = duplex) -+# S2 5 Cursor type (U = underline, D = block) -+# S2 6 Cursor down key (U = send ^J, D = send ^V) -+# S2 7 Screen colour (U = green on black, D = black on green) -+# S2 8 DSR status (pin 6) (U = disconnected, D = connected) -+# S2 9 DCD status (pin 8) (U = disconnected, D = connected) -+# S2 10 DTR status (pin 20) (U = disconnected, D = connected) - # --wy325-25w|wyse325-25w|wy325 132 columns, -- lh@, lines#25, lw@, nlab@, -- pln@, rs3=\EwG\Ee)$<100>, use=wy325-w, -+tvi910+|televideo 910+, -+ dch1=\EW, dl1=\ER$<33*>, home=^^, ich1=\EQ, il1=\EE$<33*>, -+ kf0=^A@\r, kf1=^AA\r, kf2=^AB\r, kf3=^AC\r, kf4=^AD\r, -+ kf5=^AE\r, kf6=^AF\r, kf7=^AG\r, kf8=^AH\r, kf9=^AI\r, -+ ll=\E=7\s, use=tvi910, -+ -+# (tvi912: removed obsolete ":ma=^K^P^L :", added <flash> and -+# <khome> from BRL entry -- esr) -+tvi912|tvi914|tvi920|old televideo 912/914/920, -+ OTbs, OTpt, am, msgr, -+ cols#80, it#8, lines#24, xmc#1, -+ bel=^G, clear=^Z, cr=^M, cub1=^H, cud1=^J, cuf1=^L, -+ cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW, -+ dl1=\ER$<33*>, ed=\Ey, el=\ET, flash=\Eb$<50/>\Ed, home=^^, -+ ht=^I, hts=\E1, ich1=\EQ, if=/usr/share/tabset/stdcrt, -+ il1=\EE$<33*>, ind=^J, kbs=^H, kcub1=^H, kcud1=^J, kcuf1=^L, -+ kcuu1=^K, kf0=^AI\r, kf1=^A@\r, kf2=^AA\r, kf3=^AB\r, -+ kf4=^AC\r, kf5=^AD\r, kf6=^AE\r, kf7=^AF\r, kf8=^AG\r, -+ kf9=^AH\r, khome=^^, rmso=\Ek, rmul=\Em, smso=\Ej, smul=\El, -+ tbc=\E3, -+# We got some new tvi912c terminals that act really weird on the regular -+# termcap, so one of our gurus worked this up. Seems that cursor -+# addressing is broken. -+tvi912cc|tvi912 at cowell college, -+ cup@, use=tvi912c, -+ -+# tvi{912,920}[bc] - TeleVideo TVI-912B/TVI-920B and TVI-912C/TVI-920C -+# From: Benjamin C. W. Sittler - # --# lines 25 columns 132 vb -+# Someone has put a scanned copy of the manual online at: -+# http://vt100.net/televideo/912b-om/ - # --wy325-w-vb|wy325-wvb|wyse325-wvb|wyse-325 wide mode reverse video, -- bel@, use=wy325-w, -- --# --# lines 42 columns 80 -+# These terminals were produced ca. 1979, and had a 12" monochrome -+# screen, supported 75-9600 baud (no handshaking), monochrome, 7-bit -+# ASCII, and were generally similar to adm3a but with attributes -+# (including some with magic cookies), fancy half-duplex mode, and -+# different bugs. - # --wy325-42|wyse325-42|wyse-325 42 lines, -- lh@, lines#42, lw@, nlab@, -- pln@, rs3=\EwG\Ee)$<100>, use=wy325, -+# Some operations reqire truly incredible amounts of padding. The -+# insert_line (<il1>) and delete_line (<dl1>) operations in particular -+# are so slow as to be nearly unusable. - # --# lines 42 columns 132 -+# There may or may not have been a separate, earlier series of 912/920 -+# terminals (without the "B" and "C" suffix); I have never seen one, -+# and the manual only describes the "B" and "C" series. The 912 and 920 -+# are quite distinct from the 914 and 924, which were much nicer non- -+# magic-cookie terminals similar to the 950. - # --wy325-42w|wyse325-42w|wyse-325 42 lines wide mode, -- lh@, lines#42, lw@, nlab@, -- pln@, rs3=\EwG\Ee)$<100>, use=wy325-w, -+# This is a new description for the following TeleVideo terminals, -+# distinguished chiefly by their keyboards: - # --# lines 42 columns 132 vb -+# TVI-912B - very odd layout, no function keys (84 keys) -+# TVI-920B - typewriter layout, no function keys (103 keys) -+# TVI-912C - very odd layout, function keys F1-F11 (82 keys) -+# TVI-920C - typewriter layout, function keys F1-F11 (101 keys) - # --wy325-42w-vb|wy325-42wvb|wyse-325 42 lines wide mode visual bell, -- bel@, use=wy325-w, -+# To choose a setting for the TERM variable, start with the model: - # --# lines 43 columns 80 -+# Model || base name -+# ----------||----------- -+# TVI-912B || tvi912b -+# TVI-912C || tvi912c -+# TVI-920B || tvi920b -+# TVI-920C || tvi920c - # --wy325-43|wyse325-43|wyse-325 43 lines, -- lh@, lines#43, lw@, nlab@, -- pln@, use=wy325, -+# Then add a suffix from the following table describing installed options -+# and how you'd like to use the terminal: - # --# lines 43 columns 132 -+# Use Video | Second | Visual | Magic | Page || feature -+# Attributes | Page | Bell | Cookies | Print || suffix -+# ------------|--------|--------|---------|-------||--------- -+# No | No | N/A | N/A | No || -unk -+# No | No | N/A | N/A | Yes || -p -+# No | Yes | No | N/A | No || -2p-unk -+# No | Yes | No | N/A | Yes || -2p-p -+# No | Yes | Yes | N/A | No || -vb-unk -+# No | Yes | Yes | N/A | Yes || -vb-p -+# Yes | No | N/A | No | N/A || -+# Yes | No | N/A | Yes | N/A || -mc -+# Yes | Yes | No | No | N/A || -2p -+# Yes | Yes | No | Yes | N/A || -2p-mc -+# Yes | Yes | Yes | No | N/A || -vb -+# Yes | Yes | Yes | Yes | N/A || -vb-mc - # --wy325-43w|wyse325-43w|wyse-325 43 lines wide mode, -- lh@, lines#43, lw@, nlab@, -- pln@, rs3=\EwG\Ee)$<100>, use=wy325-w, -+# So e.g. a model 920 C with second page memory option, visual bell -+# and no magic cookies would be tvi920c-vb; a model 912 B without the -+# second page memory option and using magic cookies would be -+# tvi912b-mc - # --# lines 43 columns 132 vb -+# PADDING - # --wy325-43w-vb|wy325-43wvb|wyse-325 43 lines wide mode visual bell, -- bel@, use=wy325-w, -- --# Wyse 370 -- 24 line screen with status line. -+# At 9600 baud, the terminal is prone to overflow its input buffer -+# during complex operations (insert/delete -+# character/line/screen/page), and it does not signal this over the -+# RS232 cable. The typical symptom of an overrun is that the terminal -+# starts beeping, and output becomes garbled. - # --# The terminal may have to be set for 8 data bits and 2 stop --# bits for the arrow keys to work. -+# The padding delays in this terminfo were derived using tack(1) -+# running on a Linux box connected to a TVI-920C with a later-model -+# (A49C1-style) ROM running at 9600 baud, so your mileage may -+# vary. The numbers below seem to give the terminal enough time so -+# that it doesn't overflow its input buffer and start losing -+# characters. - # --# If you change keyboards the terminal will send different --# escape sequences. --# The following definition is for the basic terminal without --# function keys. -+# KEYS - # --# <u0> -> enter Tektronix 4010/4014 mode --# <u1> -> exit Tektronix 4010/4014 mode --# <u2> -> enter ASCII mode (from any ANSI mode) --# <u3> -> exit ASCII mode (goto native ANSI mode) --# <u4> -> enter Tek 4207 ANSI mode (from any ANSI mode) --# <u5> -> exit Tek 4207 mode (goto native ANSI mode) -+# If you want to use the FUNCT key on a tvi912[bc], use the -+# corresponding tvi920[bc] terminfo with FUNCT + ... equivalents from -+# the following table (these also work on the 920 series): - # --# Bug: The <op> capability resets attributes. --wy370-nk|wyse 370 without function keys, -- am, ccc, hs, mc5i, mir, msgr, xenl, xon, -- colors#64, cols#80, it#8, lines#24, ncv#48, pairs#64, wsl#80, -- acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -- bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l, -- clear=\E[H\E[J$<40>, cnorm=\E[34h\E[?25h, cr=^M, -- csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, -- cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, -- cup=\E[%i%p1%d;%p2%dH$<1>, cuu=\E[%p1%dA, cuu1=\E[A, -- cvvis=\E[?25h\E[34l, dch=\E[%p1%dP$<1*>, dch1=\E[P$<1>, -- dclk=\E[31h, dim=\E[2m, dl=\E[%p1%dM$<2*>, dl1=\E[M$<2>, -- dsl=\E[40l, ech=\E[%p1%dX$<.1*>, ed=\E[J$<40>, -- el=\E[K$<10>, el1=\E[1K$<12>, enacs=\E)0, -- flash=\E[30h\E\,\E[30l$<300>, fsl=\E[1;24r\E8, -- home=\E[H, hpa=\E[%i%p1%d`, ht=\011$<1>, hts=\EH, -- ich=\E[%p1%d@$<1*>, il=\E[%p1%dL$<2*>, il1=\E[L$<2>, -- ind=\n$<2>, -- initc=\E[66;%p1%d;%?%p2%{250}%<%t%{0}%e%p2%{500}%<%t%{16}%e%p2%{750}%<%t%{32}%e%{48}%;%?%p3%{250}%<%t%{0}%e%p3%{500}%<%t%{4}%e%p3%{750}%<%t%{8}%e%{12}%;%?%p4%{250}%<%t%{0}%e%p4%{500}%<%t%{1}%e%p4%{750}%<%t%{2}%e%{3}%;%{1}%+%+%+%dw, -- invis=\E[8m, ip=$<1>, is1=\E[90;1"p\E[?5W$<6>, -- is2=\E[2;4;20;30;40l\E[?1;10;16l\E[12h\E[?7;8;25h, -- is3=\E>\017\E)0\E(B\E[63;0w\E[m, mc0=\E[0i, mc4=\E[4i, -- mc5=\E[5i, -- oc=\E[60w\E[63;0w\E[66;1;4w\E[66;2;13w\E[66;3;16w\E[66;4;49w\E[66;5;51w\E[66;6;61w\E[66;7;64w, -- op=\E[m, rc=\E8, rev=\E[7m, ri=\EM$<2>, rmacs=^O, -- rmam=\E[?7l, rmclk=\E[31l, rmcup=\E[ R, rmir=\E[4l, -- rmkx=\E>, rmso=\E[27m, rmul=\E[24m, -- rs1=\E[13l\E[3l\E!p\E[?4i, rs2=\E[35h\E[?3l$<8>, -- rs3=\E[?5l, sc=\E7, setb=\E[62;%p1%dw, setf=\E[61;%p1%dw, -- sgr=\E[0%?%p2%t;4%;%?%p3%p1%|%t;7%;%?%p4%t;5%;%?%p5%t;2%;%?%p6%t;1%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, -- sgr0=\E[m\017, smacs=^N, smam=\E[?7h, smcup=\E[ Q, -- smir=\E[4h, smkx=\E[?1l\E=, smso=\E[7m, smul=\E[4m, -- tbc=\E[3g, tsl=\E[40l\E[40h\E7\E[99;%i%p1%dH, -- u0=\E[?38h\E8, u1=\E[?38l\E)0, u2=\E[92;52"p, u3=\E~B, -- u4=\E[92;76"p, u5=\E%!1\E[90;1"p, vpa=\E[%i%p1%dd, -+# Unshifted Function Keys: - # --# Function key set for the ASCII (wy-50 compatible) keyboard --# This is the default 370. -+# Key | capname|| Equivalent -+# -----|--------||------------ -+# F1 | <kf1> || FUNCT + @ -+# F2 | <kf2> || FUNCT + A -+# F3 | <kf3> || FUNCT + B -+# F4 | <kf4> || FUNCT + C -+# F5 | <kf5> || FUNCT + D -+# F6 | <kf6> || FUNCT + E -+# F7 | <kf7> || FUNCT + F -+# F8 | <kf8> || FUNCT + G -+# F9 | <kf9> || FUNCT + H -+# F10 | <kf10> || FUNCT + I -+# F11 | <kf11> || FUNCT + J - # --wy370|wyse370|wy370-101k|Wyse 370 with 101 key keyboard, -- kbs=^H, kcbt=\E[Z, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, -- kcuu1=\E[A, kdch1=\EOQ, kdl1=\EOQ, kent=\EOM, kf1=\E[?4i, -- kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, -- kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, kf2=\E[?3i, -- kf3=\E[2i, kf4=\E[@, kf5=\E[M, kf6=\E[17~, kf7=\E[18~, -- kf8=\E[19~, kf9=\E[20~, khome=\E[H, kich1=\EOP, kil1=\EOP, -- knp=\E[U, kpp=\E[V, use=wy370-nk, -+# Shifted Function Keys: - # --# Function key set for the VT-320 (and wy85) compatible keyboard -+# SHIFT + Key | capname|| Equivalent -+# -------------|--------||------------ -+# SHIFT + F1 | <kf12> || FUNCT + ` -+# SHIFT + F2 | <kf13> || FUNCT + a -+# SHIFT + F3 | <kf14> || FUNCT + b -+# SHIFT + F4 | <kf15> || FUNCT + c -+# SHIFT + F5 | <kf16> || FUNCT + d -+# SHIFT + F6 | <kf17> || FUNCT + e -+# SHIFT + F7 | <kf18> || FUNCT + f -+# SHIFT + F8 | <kf19> || FUNCT + g -+# SHIFT + F9 | <kf20> || FUNCT + h -+# SHIFT + F10 | <kf21> || FUNCT + i -+# SHIFT + F11 | <kf22> || FUNCT + j - # --wy370-105k|Wyse 370 with 105 key keyboard, -- kbs=^H, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, -- kdch1=\E[3~, kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, -- kf13=\E[25~, kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, -- kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, kf20=\E[34~, -- kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, kfnd=\E[1~, -- khlp=\E[28~, khome=\E[26~, kich1=\E[2~, knp=\E[6~, -- kpp=\E[5~, kslt=\E[4~, lf1=PF1, lf2=PF2, lf3=PF3, lf4=PF4, -- use=wy370-nk, use=vt220+keypad, -+# PORTS AND SWITCH SETTINGS - # --# Function key set for the PC compatible keyboard -+# Here are the switch settings for the TVI-912B/TVI-920B and -+# TVI-912C/TVI-920C: - # --wy370-EPC|Wyse 370 with 102 key keyboard, -- kbs=^H, kcbt=\E[Z, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, -- kcuu1=\E[A, kend=\E[1~, kent=\EOM, kf1=\EOP, kf10=\E[21~, -- kf11=\E[23~, kf12=\E[24~, kf2=\EOQ, kf3=\EOR, kf4=\EOS, -- kf5=\E[M, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, -- khome=\E[H, kich1=\E[2~, knp=\E[U, kpp=\E[V, use=wy370-nk, -+# S1 (Line), and S3 (Printer) baud rates -- put one, and only one, switch down: -+# 2: 9600 3: 4800 4: 2400 5: 1200 -+# 6: 600 7: 300 8: 150 9: 75 -+# 10: 110 - # --# Wyse 370 with visual bell. --wy370-vb|Wyse 370 with visible bell, -- bel@, use=wy370, -+# S2 UART/Terminal options: -+# Up Down -+# 1: Not used Not allowed -+# 2: Alternate character set Standard character set -+# 3: Full duplex Half duplex -+# 4: 50 Hz refresh 60 Hz refresh -+# 5: No parity Send parity -+# 6: 2 stop bits 1 stop bit -+# 7: 8 data bits 7 data bits -+# 8: Not used Not allowed on Rev E or lower -+# 9: Even parity Odd parity -+# 10: Steady cursor Blinking cursor -+# (On Rev E or lower, use W25 instead of switch 10.) - # --# Wyse 370 in 132-column mode. --wy370-w|Wyse 370 in 132-column mode, -- cols#132, wsl#132, -- rs2=\E[35h\E[?3h$<70>, use=wy370, -+# S5 UART/Terminal options: -+# Open Closed -+# 1: P3-6 Not connected DSR received on P3-6 -+# 2: P3-8 Not connected DCD received on P3-8 - # --# Wyse 370 in 132-column mode with visual bell. --wy370-wvb|Wyse 370 with visible bell 132-columns, -- flash=\E[30h\E\,\E[30l$<300>, use=wy370-w, --wy370-rv|Wyse 370 reverse video, -- rs3=\E[32h\E[?5h, use=wy370, -+# 3 Open, 4 Open: P3-20 Not connected -+# 3 Open, 4 Closed: DTR on when terminal is on -+# 3 Closed, 4 Open: DTR is connected to RTS -+# 3 Closed, 4 Closed: Not allowed - # --# Wyse 99gt Tektronix 4010/4014 emulator, -+# 5 Closed: HDX printer (hardware control) Rev. K with extension port off, -+# all data transmitted out of the modem port (P3) will also be -+# transmitted out of the printer port (P4). - # --wy99gt-tek|Wyse 99gt Tektronix 4010/4014 emulator, -- am, os, -- cols#74, lines#35, -- bel=^G, clear=\E^L, cr=^M, cub1=^H, cud1=^J, cuf1=\s, -- cup=\035%{3040}%{89}%p1%*%-%Py%p2%{55}%*%Px%gy%{128}%/%{31}%&%{32}%+%c%gy%{3}%&%{4}%*%gx%{3}%&%+%{96}%+%c%gy%{004}%/%{31}%&%{96}%+%c%gx%{128}%/%{31}%&%{32}%+%c%gx%{004}%/%{31}%&%{64}%+%c\037, -- cuu1=^K, ff=^L, -- hd=\036HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH\037, -- home=^]7`x @\037, -- hu=\036DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD\037, -- is2=\E8, nel=^M^J, u0=\E~>\E8, u1=\E[42h, -+# 6 Open, 7 Open: Not allowed -+# 6 Open, 7 Closed: 20ma current loop input -+# 6 Closed, 7 Open: RS232 input -+# 6 Closed, 7 Closed: Not allowed - # --# Wyse 160 Tektronix 4010/4014 emulator, -+# Jumper options: -+# If the jumper is installed, the effect will occur (the next time the terminal -+# is switched on). - # --wy160-tek|Wyse 160 Tektronix 4010/4014 emulator, -- cup=\035%{3103}%{91}%p1%*%-%Py%p2%{55}%*%Px%gy%{128}%/%{31}%&%{32}%+%c%gy%{3}%&%{4}%*%gx%{3}%&%+%{96}%+%c%gy%{004}%/%{31}%&%{96}%+%c%gx%{128}%/%{31}%&%{32}%+%c%gx%{004}%/%{31}%&%{64}%+%c\037, -- home=^]8`g @\037, use=wy99gt-tek, --# --# Wyse 370 Tektronix 4010/4014 emulator, --# --wy370-tek|Wyse 370 Tektronix 4010/4014 emulator, -- am, os, -- cols#80, lines#36, -- bel=^G, clear=\E^L, cr=^M, cub1=^H, cud1=^J, cuf1=\s, -- cup=\035%{775}%{108}%p1%*%{5}%/%-%Py%p2%{64}%*%{4}%+%{5}%/%Px%gy%{32}%/%{31}%&%{32}%+%c%gy%{31}%&%{96}%+%c%gx%{32}%/%{31}%&%{32}%+%c%gx%{31}%&%{64}%+%c\037, -- cuu1=^K, ff=^L, -- hd=\036HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH\037, -- home=^]8g @\037, -- hu=\036DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD\037, -- is2=\E8, kbs=^H, kcub1=^H, kcud1=^J, kcuf1=^I, kcuu1=^K, -- nel=^M^J, u0=\E[?38h\E8, u1=\E[?38l\E)0, -- --# Vendor-supplied Wyse entries end here. -- --# --#TITLE: TERMINFO ENTRY WY520 --#DATE: 8/5/93 --# The WY520 terminfo is based on the WY285 entry published on the WYSE --# BBS with the addition of more function keys and special keys. --# --# rs1 -> set personality --# rs2 -> set number of columns --# rs3 -> set number of lines --# is1 -> select the proper font --# is2 -> do the initialization --# is3 -> If this string is empty then rs3 gets sent. --# --# Wyse 520 emulating a vt420 7 bit mode with default ANSI keyboard --# - The BS key is programmed to generate BS in smcup since --# is2 doesn't seem to work. --# - Remove and shift/Remove: delete a character --# - Insert : enter insert mode --# - Find : delete to end of file --# - Select : clear a line --# - F11, F12, F13: send default sequences (not ESC, BS, LF) --# - F14 : Home key --# - Bottom status line (host writable line) is used. --# - smkx,rmkx are removed because this would put the numeric --# keypad in Dec application mode which doesn't seem to work --# with SCO applications. --# --wy520|wyse520|wyse 520, -- am, hs, km, mc5i, mir, xenl, xon, -- cols#80, it#8, lines#24, wsl#80, -- acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -- bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l, -- clear=\E[H\E[J$<40>, cnorm=\E[34h\E[?25h, cr=^M, -- csr=\E[%i%p1%d;%p2%dr$<20>, cub=\E[%p1%dD, cub1=^H, -- cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, -- cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, -- cvvis=\E[?25h\E[34l, dch=\E[%p1%dP$<3>, dch1=\E[P$<30>, -- dim=\E[2m, dl=\E[%p1%dM$<2*>, dl1=\E[M$<2>, dsl=\E[0$~, -- ech=\E[%p1%dX, ed=\E[J$<40>, el=\E[K, el1=\E[1K, -- enacs=\E)0, fsl=\E[0$}, home=\E[H, hpa=\E[%i%p1%d`, ht=^I, -- hts=\EH, ich=\E[%p1%d@$<2>, il=\E[%p1%dL$<3*>, -- il1=\E[L$<3>, ind=\n$<2>, invis=\E[8m, ip=$<4>, is1=\E[?5W, -- is2=\E[2;4;20;30l\E[?1;4;10;16l\E[12h\E[?7;8;25;67h, -- is3=\E>\E(B\E)0\017\E[m, kbs=^H, kcbt=\E[Z, kcub1=\E[D, -- kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[3~, ked=\E[1~, -- kel=\E[4~, kent=\EOM, kf10=\E[21~, kf11=\E[23~, -- kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, kf15=\E[28~, -- kf16=\E[29~, kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, -- kf20=\E[34~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, -- kf9=\E[20~, kfnd=\E[1~, khlp=\E[28~, khome=\E[26~, -- kich1=\E[2~, knp=\E[6~, kpp=\E[5~, kslt=\E[4~, lf1=PF1, -- lf2=PF2, lf3=PF3, lf4=PF4, mc0=\E[0i, mc4=\E[4i, mc5=\E[5i, -- rc=\E8, rev=\E[7m, ri=\EM$<2>, rmacs=^O, rmam=\E[?7l, -- rmcup=\E[ R, rmir=\E[4l, rmso=\E[m, rmul=\E[24m, -- rs1=\E[13l\E[3l\E\\\E[63;1"p\E[!p, rs2=\E[35h\E[?3l, -- rs3=\E[?5l\E[47h\E[40l\E[r, sc=\E7, -- sgr=\E[0%?%p2%t;4%;%?%p3%p1%|%t;7%;%?%p4%t;5%;%?%p5%t;2%;%?%p6%t;1%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, -- sgr0=\E[m\017, smacs=^N, smam=\E[?7h, -- smcup=\E[ Q\E[?67;8h, smir=\E[4h, smso=\E[7m, smul=\E[4m, -- tbc=\E[3g, tsl=\E[2$~\E[1$}\E[%i%p1%d`, -- vpa=\E[%i%p1%dd, use=vt220+keypad, --# --# Wyse 520 with 24 data lines and status (terminal status) --wy520-24|wyse520-24|wyse 520 with 24 data lines, -- hs@, -- dsl@, fsl@, rs3=\E[?5l\E[47h\E[40l\E[1;24r, tsl@, -- use=wy520, --# --# Wyse 520 with visual bell. --wy520-vb|wyse520-vb|wyse 520 with visible bell, -- flash=\E[30h\E\,\E[30l$<100>, use=wy520, --# --# Wyse 520 in 132-column mode. --wy520-w|wyse520-w|wyse 520 in 132-column mode, -- cols#132, wsl#132, -- dch=\E[%p1%dP$<7>, dch1=\E[P$<7>, ich=\E[%p1%d@$<7>, -- ip=$<7>, rs2=\E[35h\E[?3h, use=wy520, -+# S4/W31: Enables automatic LF upon receipt of CR from -+# remote or keyboard. -+# S4/W32: Enables transmission of EOT at the end of Send. If not -+# installed, a carriage return is sent. -+# S4/W33: Disables automatic carriage return in column 80. -+# S4/W34: Selects Page Print Mode as initial condition. If not -+# installed, Extension Mode is selected. - # --# Wyse 520 in 132-column mode with visual bell. --wy520-wvb|wyse520-wvb|wyse 520 with visible bell 132-columns, -- flash=\E[30h\E\,\E[30l$<100>, use=wy520-w, -+# NON-STANDARD CAPABILITIES - # -+# Sending <u9> or <u7> returns a cursor position report in the format -+# YX\r, where Y and X are as in <cup>. This format is described in -+# <u8> and <u6>, but it's not clear how one should write an -+# appropriate scanf string, since we need to subtract %' ' from the -+# character after reading it. The <u9> capability is used by tack(1) -+# to synchronize during padding tests, and seems to work for that -+# purpose. - # --# Wyse 520 emulating a vt420 7 bit mode. --# The DEL key is programmed to generate BS in is2. --# With EPC keyboard. --# - 'End' key will clear till end of line on EPC keyboard --# - Shift/End : ignored. --# - Insert : enter insert mode. --# - Delete : delete a character (have to change interrupt character --# to CTRL-C: stty intr '^c') for it to work since the --# Delete key sends 7FH. --wy520-epc|wyse520-epc|wyse 520 with EPC keyboard, -- kdch1=\177, kel=\E[4~, kend=\E[4~, kf0=\E[21~, kf1=\E[11~, -- kf2=\E[12~, kf3=\E[13~, kf4=\E[14~, kf5=\E[15~, khome=\E[H, -- use=wy520, -+# This description also includes the obsolete termcap capabilities -+# has_hardware_tabs (<OTpt>) and backspaces_with_bs (<OTbs>). - # --# Wyse 520 with 24 data lines and status (terminal status) --# with EPC keyboard. --wy520-epc-24|wyse520-pc-24|wyse 520 with 24 data lines and EPC keyboard, -- hs@, -- dsl@, fsl@, rs3=\E[?5l\E[47h\E[40l\E[1;24r, tsl@, -- use=wy520-epc, -+# FEATURES NOT YET DESCRIBED IN THIS TERMINFO - # --# Wyse 520 with visual bell. --wy520-epc-vb|wyse520-pc-vb|wyse 520 with visible bell and EPC keyboard, -- flash=\E[30h\E\,\E[30l$<100>, use=wy520-epc, -+# The FUNCT modifier actually works with every normal key by sending -+# ^AX\r, where X is the sequence normally sent by that key. This is a -+# sort of meta key not currently describable in terminfo. - # --# Wyse 520 in 132-column mode. --wy520-epc-w|wyse520-epc-w|wyse 520 in 132-column mode with EPC keyboard, -- cols#132, wsl#132, -- dch=\E[%p1%dP$<7>, dch1=\E[P$<7>, ich=\E[%p1%d@$<7>, -- ip=$<7>, rs2=\E[35h\E[?3h, use=wy520-epc, -+# There are quite a few other keys (especially on the 920 models,) but -+# they are for the most part only useful in block mode. - # --# Wyse 520 in 132-column mode with visual bell. --wy520-epc-wvb|wyse520-p-wvb|wyse 520 with visible bell 132-columns and EPC keyboard, -- flash=\E[30h\E\,\E[30l$<100>, use=wy520-epc-w, -+# These terminals have lots of forms manipulation features, mainly -+# useful in block mode, including "clear X to nulls" (vs. "clear X to -+# spaces"; nulls are sentinels for "send X" operations); "send X" -+# operations for uploading all or part of the screen; and block-mode -+# editing keys (they don't send escape sequences, but manipulate video -+# memory directly). Block mode is used for local editing, and protect -+# mode (in conjunction with the "write protect" attribute, -+# a.k.a. half-intensity outside of protect mode) is used to control -+# which parts of the screen are edited/sent/printed (by <mc0>). - # --# Wyse 520 in 80-column, 36 lines --wy520-36|wyse520-36|wyse 520 with 36 data lines, -- hs@, -- lines#36, -- dsl@, fsl@, rs3=\E[?5l\E[36*|\E[36t\E[40l\E[1;36r, tsl@, -- use=wy520, -+# There are at least two major families of ROM, "early" and -+# A49B1/A49C1; the major difference seems to be that the latter ROMs -+# support a few extra escape sequences for manipulating the off-screen -+# memory page, and for sending whole pages back to the host (mainly -+# useful in block mode.) The descriptions in this file don't use any -+# of those sequences: set cursor position including page (\E-PYX, -+# where P is \s for page 0 and ! for page 1 [actually only the LSB of -+# P is taken into account, so e.g. 0 and 1 work too,] and Y and X are -+# as in <cup>); read cursor position (\E/), which is analogous to <u9> -+# and returns PYX\r, where P is \s for page 0 or ! for page 1, and YX -+# are as in <cup>, and some "send page" features mainly useful for -+# forms manipulation. - # --# Wyse 520 in 80-column, 48 lines --wy520-48|wyse520-48|wyse 520 with 48 data lines, -- hs@, -- lines#48, -- dsl@, fsl@, rs3=\E[?5l\E[48*|\E[48t\E[40l\E[1;48r, tsl@, -- use=wy520, -+# The keyboard enable (\E") and disable (\E#) sequences are unused, -+# except that a terminal reset (<is2>) enables the keyboard. - # --# Wyse 520 in 132-column, 36 lines --wy520-36w|wyse520-36w|wyse 520 with 132 columns and 36 data lines, -- cols#132, wsl#132, -- rs2=\E[?3h, -- rs3=\E[?5l\E[36*|\E[36t\E[40l\E[1;36r\E[132$|, -- use=wy520-36, -+# Auto-flip mode (\Ev) is likely faster than the scrolling mode (\Ew) -+# enabled in <is2>, but auto-flip is very jarring so we don't use it. - # --# Wyse 520 in 132-column, 48 lines --wy520-48w|wyse520-48w|wyse 520 with 48 data lines, -- cols#132, wsl#132, -- rs2=\E[?3h, -- rs3=\E[?5l\E[48*|\E[48t\E[40l\E[1;48r\E[132$|, -- use=wy520-48, -+# BUGS - # -+# At least up to the A49B1 and A49C1 ROMs, there are no \Eb and \Ed -+# sequences (I infer that in some TeleVideo terminal they may invert -+# and uninvert the display) so the <flash> sequence given here is a -+# cheesy page-flip instead. - # --# Wyse 520 in 80-column, 36 lines with EPC keyboard --wy520-36pc|wyse520-36pc|wyse 520 with 36 data lines and EPC keyboard, -- hs@, -- lines#36, -- dsl@, fsl@, rs3=\E[?5l\E[36*|\E[36t\E[40l\E[1;36r, tsl@, -- use=wy520-epc, -+# The back_tab (<cbt>) sequence (\EI) doesn't work according to -+# tack(1), so it is not included in the descriptions below. - # --# Wyse 520 in 80-column, 48 lines with EPC keyboard --wy520-48pc|wyse520-48pc|wyse 520 with 48 data lines and EPC keyboard, -- hs@, -- lines#48, -- dsl@, fsl@, rs3=\E[?5l\E[48*|\E[48t\E[40l\E[1;48r, tsl@, -- use=wy520-epc, -+# It's not clear whether auto_left_margin (<bw>) flag should be set -+# for these terminals; tack says yes, so it is set here, but this -+# differs from other descriptions I've seen. - # --# Wyse 520 in 132-column, 36 lines with EPC keyboard --wy520-36wpc|wyse520-36wpc|wyse 520 with 36 data lines and EPC keyboard, -- cols#132, wsl#132, -- rs2=\E[?3h, -- rs3=\E[?5l\E[36*|\E[36t\E[40l\E[1;36r\E[132$|, -- use=wy520-36pc, -+# Extension print mode (<mc5>) echoes all characters to the printer -+# port [in addition to displaying them] except for the page print mode -+# sequence (<mc4>); this is a slight violation of the terminfo -+# definition for <mc5> but I don't expect it to cause problems. We -+# reset to page print mode in <rs1> since it may have been enabled -+# accidentally. - # --# Wyse 520 in 132-column, 48 lines with EPC keyboard --wy520-48wpc|wyse520-48wpc|wyse 520 with 48 data lines and EPC keyboard, -- cols#132, wsl#132, -- rs2=\E[?3h, -- rs3=\E[?5l\E[48*|\E[48t\E[40l\E[1;48r\E[132$|, -- use=wy520-48pc, -+# The descriptions with plus signs (+) are building blocks. - --# From: John Gilmore <hoptoad!gnu@lll-crg.arpa> --# (wyse-vp: removed <if=/usr/share/tabset/wyse-adds>, there's no such --# file and we don't know what <hts> is -- esr) --wyse-vp|Wyse 50 in ADDS Viewpoint emulation mode with "enhance" on, -- OTbs, am, -+tvi912b-unk|tvi912c-unk|TeleVideo TVI-912B or TVI-912C (no attributes), -+ OTbs, OTpt, am, bw, - cols#80, it#8, lines#24, -- bel=^G, clear=^L, cr=^M, cub1=^H, cud1=^J, cuf1=^F, -- cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=^Z, dch1=\EW, -- dl1=\El, ed=\Ek, el=\EK, home=^A, ht=^I, il1=\EM, ind=^J, -- is2=\E`\:\E`9\017\Er, kbs=^H, kcub1=^U, kcud1=^J, kcuf1=^F, -- kcuu1=^Z, khome=^A, ll=^A^Z, nel=^M^J, rmir=\Er, rmso=^O, -- rmul=^O, rs1=\E`\:\E`9\017\Er, sgr0=^O, smir=\Eq, smso=^N, -- smul=^N, -- --wy75ap|wyse75ap|wy-75ap|wyse-75ap|Wyse WY-75 Applications and Cursor keypad, -- is2=\E[1;24r\E[?10;3l\E[?1;25h\E[4l\E[m\E(B\E=, -- kbs=^H, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, -- khome=\EOH, rmkx=\E[?1l\E>$<10/>, smkx=\E[?1h\E=$<10/>, -- use=wy75, -+ bel=^G, clear=\032$<50>, cr=^M, cub1=^H, cud1=^J, cuf1=^L, -+ cup=\E=%p1%' '%+%c%p2%' '%+%c, cuu1=^K, dch1=\EW$<30>, -+ dl1=\ER$<1*>$<100>, ed=\Ey$<2*>$<10>, el=\ET$<15>, -+ home=^^, ht=^I, hts=\E1, ich1=\EQ$<30>, -+ if=/usr/share/tabset/stdcrt, il1=\EE$<1*>$<100>, -+ ind=\n$<10>, is2=\Ew\EA\E'\E"\E(, kcub1=^H, kcud1=^J, -+ kcuf1=^L, kcuu1=^K, kdch1=\177, kent=^M, khome=^^, mc4=\EA, -+ mc5=\E@, rs1=\Ek\010\Em\010\Eq\032, tbc=\E3, u6=%c%c\r, -+ u7=\E?, u8=%c%c\r, u9=\E?, - --# From: Eric Freudenthal <freudent@eric.ultra.nyu.edu> --wy100q|Wyse 100 for Quotron, -- OTbs, -- cols#80, lines#24, xmc#1, -- cbt=\EI, clear=^Z, cub1=^H, cud1=^J, cuf1=^L, -- cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW, -- dl1=\ER, ed=\EY, el=\ET, home=^^, il1=\EE, invis@, -- is2=\E`\:\0\EC\EDF\E0\E'\E(\EA21, kcub1=^H, kcud1=^J, -- kcuf1=^L, kcuu1=^K, ri=\Ej, rmir=\Er, smir=\Eq, use=adm+sgr, -+# This isn't included in the basic capabilities because it is -+# typically unusable in combination with the full range of video -+# attributes, since the magic cookie attributes turn into ASCII -+# control characters, and the half-intensity ("protected") attribute -+# converts all affected characters to spaces. - --#### Kermit terminal emulations --# --# Obsolete Kermit versions may be listed in the section describing obsolete --# non-ANSI terminal emulators later in the file. --# -+tvi912b+printer|TeleVideo TVI-912B/TVI-920B and TVI-912C/TVI-920C page print support, -+ mc0=\EP, - --# KERMIT standard all versions. --# Straight ascii keyboard. :sr=\EI: not avail. many versions + bug prone in vi. --# (kermit: removed obsolete ":ma=^Hh^Jj^Kk^Ll^^H:" -- esr) --# From: greg small <gts@populi.berkeley.edu> 9-25-84 --kermit|standard kermit, -- OTbs, -- cols#80, lines#24, -- clear=\EE, cub1=^H, cud1=\EB, cuf1=\EC, -- cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, ed=\EJ, -- el=\EK, home=\EH, is2=K0 Standard Kermit 9-25-84\n, -- kcub1=^H, kcud1=^J, kcuf1=^L, kcuu1=^K, khome=^^, --kermit-am|standard kermit plus auto-margin, -- am, -- is2=K1 Standard Kermit plus Automatic Margins\n, -- use=kermit, --# IBMPC Kermit 1.2. --# Bugs: <ed>, <el>: do not work except at beginning of line! <clear> does --# not work, but fake with :cl=\EH\EJ (since :cd=\EJ: works at beginning of --# line). --# From: greg small <gts@populi.berkeley.edu> 8-30-84 --pckermit|pckermit12|UCB IBMPC Kermit 1.2, -- am, -- lines#25, -- clear=\EH\EJ, ed@, el@, -- is2=K2 UCB IBMPC Kermit 1.2 8-30-84\n, use=kermit, --# IBMPC Kermit 1.20 --# Cannot use line 25, now acts funny like ansi special scrolling region. --# Initialization must escape from that region by cursor position to line 24. --# Cannot use character insert because 1.20 goes crazy if insert at col 80. --# Does not use :am: because autowrap is lost when kermit dropped and restarted. --# From: greg small <gts@populi.berkeley.edu> 12-19-84 --pckermit120|UCB IBMPC Kermit 1.20, -- it#8, lines#24, -- cud1=\EB, cvvis=\EO\Eq\EEK3, dch1=\EN, dl1=\EM, ht=^I, -- il1=\EL, -- is2=\EO\Eq\EJ\EY7 K3 UCB IBMPC Kermit 1.20 12-19-84\n, -- rmir@, rmso=\Eq, smir@, smso=\Ep, use=kermit, --# MS-DOS Kermit 2.27 for the IBMPC --# Straight ascii keyboard. :sr=\EI: not avail. many versions + bug prone in vi. --# Cannot use line 25, now acts funny like ansi special scrolling region. --# Initialization must escape from that region by cursor position to line 24. --# Does not use am: because autowrap is lost when kermit dropped and restarted. --# Reverse video for standout like H19. --# (msk227: removed obsolete ":ma=^Hh^Jj^Kk^Ll^^H:" -- esr) --# From: greg small <gts@populi.berkeley.edu> 3-17-85 --msk227|mskermit227|MS-DOS Kermit 2.27 for the IBMPC, -- OTbs, am@, -- cols#80, it#8, lines#24, -- clear=\EE, cub1=^H, cud1=\EB, cuf1=\EC, -- cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, -- cvvis=\EO\Eq\EG\EwK4, dch1=\EN, dl1=\EM, ed=\EJ, el=\EK, -- home=\EH, ht=^I, il1=\EL, -- is2=\EO\Eq\EG\Ew\EJ\EY7 K4 MS Kermit 2.27 for the IBMPC 3-17-85\n, -- kcub1=^H, kcud1=^J, kcuf1=^L, kcuu1=^K, khome=^^, rc=\Ek, -- rmir=\EO, rmso=\Eq, sc=\Ej, smir=\E@, smso=\Ep, --# MS-DOS Kermit 2.27 with automatic margins --# From: greg small <gts@populi.berkeley.edu> 3-17-85 --msk227am|mskermit227am|UCB MS-DOS Kermit 2.27 with automatic margins, -- am, -- cvvis=\EO\Eq\EG\EvK5, -- is2=\EO\Eq\EG\Ev\EJ\EY7 K5 MS Kermit 2.27 +automatic margins 3-17-85\n, -- use=msk227, --# MS-DOS Kermit 2.27 UCB 227.14 for the IBM PC --# Automatic margins now default. Use ansi <sgr> for highlights. --# Define function keys. --# (msk22714: removed obsolete ":kn#10:" -- esr) --# From: greg small <gts@populi.berkeley.edu> 3-17-85 --msk22714|mskermit22714|UCB MS-DOS Kermit 2.27 UCB 227.14 IBM PC, -- am, -- bold=\E[1m, cvvis=\EO\Eq\EG\EvK6, -- is2=\EO\Eq\EG\Ev\EJ\EY7 K6 MS Kermit 2.27 UCB 227.14 IBM PC 3-17-85\n, -- kf0=\E0, kf1=\E1, kf2=\E2, kf3=\E3, kf4=\E4, kf5=\E5, kf6=\E6, -- kf7=\E7, kf8=\E8, kf9=\E9, rev=\E[7m, rmso=\E[m, rmul=\E[m, -- sgr0=\E[m, smso=\E[1m, smul=\E[4m, use=mskermit227, --# This was designed for a VT320 emulator, but it is probably a good start --# at support for the VT320 itself. --# Please send changes with explanations to bug-gnu-emacs@prep.ai.mit.edu. --# (vt320-k3: I added <rmam>/<smam> based on the init string -- esr) --vt320-k3|MS-Kermit 3.00's vt320 emulation, -- am, eslok, hs, km, mir, msgr, xenl, -- cols#80, it#8, lines#49, pb#9600, vt#3, -- acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -- bel=^G, blink=\E[5m, bold=\E[1m, civis=\E[?25l, -- clear=\E[H\E[J, cmdch=\E, cnorm=\E[?25h, cr=^M, -- csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, -- cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, -- cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, -- dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, -- dsl=\E[0$~, ech=\E[%p1%dX, ed=\E[J, el=\E[K, -- flash=\E[?5h\E[?5l\E[?5h\E[?5l\E[?5h\E[?5l, -- fsl=\E[0$}, home=\E[H, hpa=\E[%i%p1%dG, ht=^I, hts=\EH, -- ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[L, ind=^J, -- is2=\E>\E F\E[?1l\E[?7h\E[r\E[2$~, kbs=^H, kcub1=\EOD, -- kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kdl1=\E[3~, kf0=\E[21~, -- kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, kf6=\E[17~, -- kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, kich1=\E[2~, knp=\E[6~, -- kpp=\E[5~, mc0=\E[0i, mc4=\E[4i, mc5=\E[5i, nel=^M^J, rc=\E8, -- rev=\E[7m, ri=\EM, rin=\E[%p1%dL, rmacs=\E(B, rmam=\E[?7l, -- rmir=\E[4l, rmkx=\E[?1l\E>, rmso=\E[27m, rmul=\E[24m, -- rs1=\E(B\E)B\E>\E F\E[4;20l\E[12h\E[?1;5;6;38;42l\E[?7;25h\E[4i\E[?4i\E[m\E[r\E[2$~, -- sc=\E7, sgr0=\E[m, smacs=\E(0, smam=\E[?7h, smir=\E[4h, -- smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, tbc=\E[3g, -- tsl=\E[1$}\r\E[K, vpa=\E[%i%p1%dd, --# From: Joseph Gil <yogi@cs.ubc.ca> 13 Dec 1991 --# ACS capabilities from Philippe De Muyter <phdm@info.ucl.ac.be> 30 May 1996 --# (I removed a bogus boolean :mo: and added <msgr>, <smam>, <rmam> -- esr) --vt320-k311|dec vt320 series as defined by kermit 3.11, -- am, eslok, hs, mir, msgr, xenl, xon, -- cols#80, it#8, lines#24, vt#3, -- acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -- bel=^G, blink=\E[5m, bold=\E[1m, civis=\E[?25l, -- clear=\E[;H\E[2J, cnorm=\E[?25h, cr=^M, -- csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, -- cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, -- cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, -- dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, -- dsl=\E[2$~\r\E[1$}\E[K\E[$}, ed=\E[J, el=\E[K, -- flash=\E[?5h\E[?5l, fsl=\E[$}, home=\E[H, ht=^I, hts=\EH, -- ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[L$<3/>, ind=\ED, -- is2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h\E[1;24r\E[24;1H, -- kbs=^H, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, -- kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, kf6=\E[17~, -- kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, lf1=pf1, lf2=pf2, -- lf3=pf3, lf4=pf4, nel=^M\ED, rc=\E8, rev=\E[7m, -- rf=/usr/share/tabset/vt100, ri=\EM, rmacs=^O, -- rmam=\E[?7l, rmir=\E[4l, rmkx=\E[?1l\E>, rmso=\E[27m, -- rmul=\E[24m, rs1=\E[?3l, sc=\E7, sgr0=\E[m, smacs=^N, -- smam=\E[?7h, smir=\E[4h, smkx=\E[?1h\E=, smso=\E[7m, -- smul=\E[4m, tbc=\E[3g, tsl=\E[2$~\E[1$}\E[1;%dH, -+# This uses half-intensity mode (<dim>) for standout (<smso>), and -+# exposes no other attributes (half-intensity is the only attribute -+# that does not generate a magic cookie.) - --######## NON-ANSI TERMINAL EMULATIONS --# -+tvi912b+dim|TeleVideo TVI-912B/TVI-920B and TVI-912C/TVI-920C half-intensity attribute support, -+ msgr, -+ dim=\E), rmso=\E(, sgr=\E%?%p1%p5%|%t)%e(%;, sgr0=\E(, -+ smso=\E), - --#### Avatar --# --# These entries attempt to describe Avatar, a terminal emulation used with --# MS-DOS bulletin-board systems. It was designed to give ANSI-like --# capabilities, but with cheaper (shorter) control sequences. Messy design, --# excessively dependent on PC idiosyncracies, but apparently rather popular --# in the BBS world. --# --# No color support. Avatar doesn't fit either of the Tektronix or HP color --# models that terminfo knows about. An Avatar color attribute is the --# low 7 bits of the IBM-PC display-memory attribute. Bletch. --# --# I wrote these entries while looking at the Avatar spec. I don't have --# the facilities to test them. Let me know if they work, or don't. --# --# Avatar escapes not used by these entries (because maybe you're smarter --# and more motivated than I am and can figure out how to wrap terminfo --# around some of them, and because they are weird enough to be funny): --# level 0: --# ^L -- clear window/reset current attribute to default --# ^V^A%p1%c -- set current color attribute, parameter decodes as follows: --# --# bit: 6 5 4 3 2 1 0 --# | | | | | --# +---+---+ | +---+---+ --# | | | --# | | foreground color --# | foreground intensity --# background color --# level 0+: --# ^V^J%p1%c%p2%c%p3%c%p4%c%p5%c -- scroll (p2,p3) to (p4,p5) up by p1 lines --# ^V^K%p1%c%p2%c%p3%c%p4%c%p5%c -- scroll (p2,p3) to (p4,p5) down by p1 lines --# ^V^L%p1%c%p2%c%p3%c -- clear p2 lines and p3 cols w/attr %p1 --# ^V^M%p1%c%p2%c%p3%c%p4%c -- fill p3 lines & p4 cols w/char p2+attr %p1 --# (^V^L and ^V^M set the current attribute as a side-effect.) --# ^V ^Y <a> [...] <c> -- repeat pattern. <a> specifies the number of bytes --# in the pattern, <c> the number of times the pattern --# should be repeated. If either value is 0, no-op. --# The pattern can contain Avatar console codes, --# including other ^V ^Y patterns. --# level 1: --# ^V^O -- clockwise mode on; turn print direction right each time you --# hit a window edge (yes, really). Turned off by CR --# ^V^P -- no-op --# ^V^Q%c -- query the driver --# ^V^R -- driver reset --# ^V^S -- Sound tone (PC-specific) --# ^V^T -- change highlight at current cursor poition to %c --# ^V^U%p1%c%p2%c -- highlight window <a> with attribute <b> --# ^V^V%p1%c%p2%c%p3%c%p4%c%p5%c --# -- define window --# --# From: Eric S. Raymond <esr@snark.thyrsus.com> 1 Nov 1995 --# (The <blink>/<bold>/<rev>/<smacs>/<smul>/<smso> capabilities exist only to --# tell ncurses that the corresponding highlights exist; it should use <sgr>, --# which is the only method that will actually work for multiple highlights.) --# --# Update by TD - 2004: half of this was inconsistent. Found documentation --# and repaired most of the damage. sgr0 is probably incorrect, but the --# available documentation gives no clues for a workable string. --avatar0|avatar terminal emulator level 0, -- am, bce, msgr, -- cols#80, it#8, lines#25, -- blink=^V^B, bold=^V^A^P, cr=^M, cub1=^V^E, cud1=^V^D, -- cuf1=^V^F, cup=\026\010%p1%c%p2%c, cuu1=^V^C, el=^V^G, -- ind=^J, invis=^V^A\0, rep=\031%p1%c%p2%c, rev=^V^Ap, -- rmacs@, rs2=^L, -- sgr=%?%p1%p2%|%p3%|%p6%|%p7%|%t\026\001%?%p7%t%{128}%e%{0}%?%p1%t%{112}%|%;%?%p2%t%{1}%|%;%?%p3%t%{112}%|%;%?%p6%t%{16}%|%;%;%c%;%?%p4%t\026\002%;, -- sgr0=^V^A^G, smacs@, smso=^V^Ap, smul=^V^A^A, -- use=klone+acs, --# From: Eric S. Raymond <esr@snark.thyrsus.com> 1 Nov 1995 --avatar0+|avatar terminal emulator level 0+, -- dch1=^V^N, rmir=\026\n\0\0\0\0, smir=^V^I, use=avatar0, --# From: Eric S. Raymond <esr@snark.thyrsus.com> 1 Nov 1995 --avatar|avatar1|avatar terminal emulator level 1, -- civis=^V'^B, cnorm=^V'^A, cvvis=^V^C, dl1=^V-, il1=^V+, -- rmam=^V", rmir=^V^P, smam=^V$, use=avatar0+, -+# Full magic-cookie attribute support, with half-intensity reverse -+# video for standout. Note that we add a space in the <dim> sequence -+# to give a consistent magic-cookie count. Also note that <sgr> uses -+# backspacing (in the TVI-supported order) to apply all requested -+# attributes with only a single magic cookie. - --#### RBcomm --# --# RBComm is a lean and mean terminal emulator written by the Interrupt List --# maintainer, Ralf Brown. It was fairly popular in the late DOS years (early --# '90s), especially in the BBS world, and still has some loyal users due to --# its very small memory footprint and to a cute macro language. --rbcomm|IBM PC with RBcomm and EMACS keybindings, -- am, bw, mir, msgr, xenl, -- cols#80, it#8, lines#25, -- bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l, -- clear=^L, cnorm=\E[?25h, cr=^M, csr=\E[%i%p1%d;%p2%dr, -- cub1=^H, cud1=^C, cuf1=^B, -- cup=\037%p2%{32}%+%c%p1%{32}%+%c, cuu1=^^, dch1=^W, -- dl=\E[%p1%dM, dl1=^Z, ech=\E[%p1%dX, ed=^F5, el=^P^P, ht=^I, -- il=\E[%p1%dL, il1=^K, ind=\ED, invis=\E[8m, -- is2=\017\035\E(B\E)0\E[?7h\E[?3l\E[>8g, kbs=^H, -- kcub1=^B, kcud1=^N, kcuf1=^F, kcuu1=^P, khome=^A, nel=^M\ED, -- rc=\E8, rep=\030%p1%c%p2%c, rev=^R, ri=\EM, rmcup=, rmdc=, -- rmir=^], rmkx=\E>, rmso=^U, rmul=^U, -- rs1=\017\E(B\E)0\025\E[?3l\E[>8g, sc=\E7, sgr0=\E[m, -- smcup=, smdc=, smir=^\, smkx=\E=, smso=^R, smul=^T, --rbcomm-nam|IBM PC with RBcomm without autowrap, -- am@, -- bel=^G, cr=^M, cud1=^J, ht=^I, ind=^J, -- is2=\017\035\E(B\E)0\E[?7l\E[?3l\E[>8g, kbs=^H, -- kcub1=^H, kcud1=^J, nel=^M^J, use=rbcomm, --rbcomm-w|IBM PC with RBcomm in 132 column mode, -- cols#132, -- bel=^G, cr=^M, cud1=^J, ht=^I, ind=^J, -- is2=\017\035\E(B\E)0\E[?7h\E[?3h\E[>8g, kbs=^H, -- kcub1=^H, kcud1=^J, nel=^M^J, use=rbcomm, -- --######## LCD DISPLAYS --# -+tvi912b+mc|TeleVideo TVI-912B/TVI-920B and TVI-912C/TVI-920C full magic-cookie attribute support, -+ xmc#1, -+ blink=\E\^, dim=\E)\s, invis=\E_, rev=\Ej, rmso=\E(\Ek, -+ rmul=\Em, -+ sgr=\E%?%p1%p5%|%t)%e(%; \010\E%?%p1%p3%|%tj%ek%;\010\E%?%p2%tl%em%;\010\E%?%p7%t_%e%?%p4%t\^%eq%;%;, -+ sgr0=\E(\Ek\010\Em\010\Eq, smso=\E)\Ej, smul=\El, - --#### Matrix Orbital --# from: Eric Z. Ayers (eric@ale.org) --# --# Matrix Orbital 20x4 LCD display --# Command Character is 0xFE (decimal 254, octal 376) --# --# On this device, cursor addressability isn't possible. The LCD expects: --# 0xfe G <col> <row> --# for cup: %p1 == row and %p2 is column --# --# This line: --# cup=\376G%p2%c%p1%c --# LOOKS like it will work, but sometimes only one of the two numbers is sent. --# See the terminfo (5) manpage commented regarding 'Terminals which use "%c"'. --# --# Alas, there is no cursor upline capability on this display. --# --# These entries add some 'sanity stuff' to the clear function. That is, it --# does a 'clear' and also turns OFF auto scroll, turns ON Auto Line Wrapping, --# and turns off the cursor blinking and stuff like that. --# --# NOTE: calling 'beep' turns on the backlight (bell) --# NOTE: calling 'flash' turns it on and back off (visual bell) --# --MtxOrb|Generic Matrix Orbital LCD display, -- bel=\376B^A, clear=\376X\376C\376R\376K\376T, -- cnorm=\376K\376T, cub1=\376L, cuf1=\376M, -- flash=\376B\001$<200>\376F, home=\376H, --MtxOrb204|20x4 Matrix Orbital LCD display, -- cols#20, lines#4, use=MtxOrb, --MtxOrb162|16x2 Matrix Orbital LCD display, -- cols#16, lines#2, use=MtxOrb, --# The end -+# This uses the second page memory option to save & restore screen -+# contents. If your terminal is missing the option, this description -+# should still work, but that has not been tested. - --######## OLDER TERMINAL TYPES --# --# This section is devoted to older commercial terminal brands that are now --# discontinued, but known to be still in use or represented by emulations. --# -+tvi912b+2p|TeleVideo TVI-912B/TVI-920B and TVI-912C/TVI-920C second page memory option support, -+ flash=\EK$<100>\EK, rmcup=\032$<50>\EK\E=7\s, -+ smcup=\EK\032$<50>\E(\Ek\010\Em\010\Eq\032$<50>, - --#### AT&T (att, tty) --# --# This section also includes Teletype-branded VDTs. --# --# The AT&T/Teletype terminals group was sold to SunRiver Data Systems (now --# Boundless Technologies); for details, see the header comment on the ADDS --# section. --# --# These are AT&T's official terminfo entries. All-caps aliases have been --# removed. --# --att2300|sv80|AT&T 2300 Video Information Terminal 80 column mode, -- am, eo, mir, msgr, xon, -- cols#80, it#8, lines#24, -- bel=^G, clear=\E[H\E[J, cr=^M, cub=\E[%p1%dD, cub1=^H, -- cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, -- cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, -- dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, -- el=\E[K, el1=\E[1K, home=\E[H, ht=^I, ich=\E[%p1%d@, -- il=\E[%p1%dL, il1=\E[L, ind=^J, kbs=^H, kcbt=\E[Z, kclr=\E[J, -- kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[P, -- kdl1=\E[M, kf1=\E[1r, kf10=\E[10r, kf11=\E[11r, -- kf12=\E[12r, kf13=\E[13r, kf14=\E[14r, kf15=\E[15r, -- kf16=\E[16r, kf2=\E[2r, kf3=\E[3r, kf4=\E[4r, kf5=\E[5r, -- kf6=\E[6r, kf7=\E[7r, kf8=\E[8r, kf9=\E[9r, khome=\E[H, -- kich1=\E[@, kil1=\E[L, mc0=\E[0i, mc4=\E[4i, mc5=\E[5i, -- rev=\E[7m, rmir=\E[4l, rmso=\E[m, sgr0=\E[m, smir=\E[4h, -- smso=\E[7m, --att2350|AT&T 2350 Video Information Terminal 80 column mode, -- mc0@, mc4@, mc5@, use=att2300, -+# This simulates flashing by briefly toggling to the other page -+# (kludge!) - --# Must setup RETURN KEY - CR, REC'VD LF - INDEX. --# Seems upward compatible with vt100, plus ins/del line/char. --# On sgr, the protection parameter is ignored. --# No check is made to make sure that only 3 parameters are output. --# standout= reverse + half-intensity = 3 | 5. --# bold= reverse + underline = 2 | 3. --# note that half-bright blinking doesn't look different from normal blinking. --# NOTE:you must program the function keys first, label second! --# (att4410: a BSD entry has been seen with the following capabilities: --# <is2=\E[?6l>, <kf1=\EOc>, <kf2=\EOd>, <kf3=\EOe>, <kf4=\EOg>, --# <kf6=\EOh>, <kf7=\EOi>, <kf8=\EOj>, -- esr) --att5410v1|att4410v1|tty5410v1|AT&T 4410/5410 80 columns - version 1, -- am, hs, mir, msgr, xon, -- cols#80, it#8, lh#2, lines#24, lw#8, nlab#8, wsl#80, -- acsc=++\,\,--..00``aaffgghhjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -- bel=^G, blink=\E[5m, bold=\E[2;7m, clear=\E[H\E[J, cr=^M, -- csr=\E[%i%p1%d;%p2%dr, cub1=^H, cud1=\E[B, cuf1=\E[C, -- cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, dch1=\E[P, dim=\E[2m, -- dl1=\E[M, ed=\E[J, el=\E[K, fsl=\E8, home=\E[H, ht=^I, -- ich1=\E[@, il1=\E[L, ind=^J, invis=\E[8m, is1=\E[?3l\E)0, -- is3=\E[1;03q f1 \EOP\E[2;03q f2 \EOQ\E[3;03q f3 \EOR\E[4;03q f4 \EOS\E[5;03q f5 \EOT\E[6;03q f6 \EOU\E[7;03q f7 \EOV\E[8;03q f8 \EOW, -- kbs=^H, kclr=\E[2J, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, -- kcuu1=\E[A, kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, kf5=\EOT, -- kf6=\EOU, kf7=\EOV, kf8=\EOW, khome=\E[H, kll=\E[24;1H, -- ll=\E[24H, nel=^M^J, -- pfx=\E[%p1%1d;%p2%l%2.2dq f%p1%1d %p2%s, -- pln=\E[%p1%d;00q%p2%:-16s, rc=\E8, rev=\E[7m, ri=\EM, -- rmacs=^O, rmso=\E[m, rmul=\E[m, rs2=\Ec\E[?3l\E[2;0y, -- sc=\E7, -- sgr=\E[0%?%p1%p5%|%t;2%;%?%p2%p6%|%t;4%;%?%p4%t;5%;%?%p3%p1%|%p6%|%t;7%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, -- sgr0=\E[m\017, smacs=^N, smso=\E[7m, smul=\E[4m, -- tsl=\E7\E[25;%p1%{1}%+%dH, -+tvi912b+vb|TeleVideo TVI-912B/TVI-920B and TVI-912C/TVI-920C second page memory option "visible bell" support, -+ bel=\EK$<100>\EK, use=tvi912b+2p, - --att4410v1-w|att5410v1-w|tty5410v1-w|AT&T 4410/5410 132 columns - version 1, -- cols#132, wsl#132, -- is1=\E[?3h\E)0, rs2=\Ec\E[?3h\E[2;0y, use=att5410v1, -+# Function keys (<kf12> .. <kf22> are shifted <kf1> .. <kf11>) - --att4410|att5410|tty5410|AT&T 4410/5410 80 columns - version 2, -- OTbs, -- pfx=\E[%p1%d;%p2%l%02dq f%p1%d %p2%s, -- use=att5410v1, -+tvi920b+fn|TeleVideo TVI-920B and TVI-920C function key support, -+ kf1=^A@\r, kf10=^AI\r, kf11=^AJ\r, kf12=^A`\r, kf13=^Aa\r, -+ kf14=^Ab\r, kf15=^Ac\r, kf16=^Ad\r, kf17=^Ae\r, kf18=^Af\r, -+ kf19=^Ag\r, kf2=^AA\r, kf20=^Ah\r, kf21=^Ai\r, kf22=^Aj\r, -+ kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, kf6=^AE\r, kf7=^AF\r, -+ kf8=^AG\r, kf9=^AH\r, - --att5410-w|att4410-w|4410-w|tty5410-w|5410-w|AT&T 4410/5410 in 132 column mode, -- cols#132, wsl#132, -- is1=\E[?3h\E)0, rs2=\Ec\E[?3h\E[2;0y, use=att4410, -+# Combinations of the basic building blocks - --# 5410 in terms of a vt100 --# (v5410: added <rmam>/<smam> based on init string -- esr) --v5410|att5410 in terms of a vt100, -- am, mir, msgr, xon, -- cols#80, it#8, lines#24, vt#3, -- acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -- bel=^G, blink=\E[5m$<2>, bold=\E[1m$<2>, -- clear=\E[H\E[J$<50>, cr=^M, csr=\E[%i%p1%d;%p2%dr, -- cub1=^H, cud1=^J, cuf1=\E[C$<2>, -- cup=\E[%i%p1%d;%p2%dH$<5>, cuu1=\E[A$<2>, dch1=\E[P, -- dl1=\E[M, ed=\E[J$<50>, el=\E[K$<3>, el1=\E[1K$<3>, -- enacs=\E(B\E)0, home=\E[H, ht=^I, hts=\EH, ich1=\E[@, -- il1=\E[L, ind=^J, kbs=^H, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, -- kcuu1=\EOA, rc=\E8, rev=\E[7m$<2>, ri=\EM$<5>, rmacs=^O, -- rmam=\E[?7l, rmkx=\E[?1l\E>, rmso=\E[m$<2>, -- rmul=\E[m$<2>, rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, -- sc=\E7, -- sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;$<2>, -- sgr0=\E[m\017$<2>, smacs=^N, smam=\E[?7h, smkx=\E[?1h\E=, -- smso=\E[1;7m$<2>, smul=\E[4m$<2>, tbc=\E[3g, -- use=vt100+fnkeys, -+tvi912b-2p-unk|tvi912c-2p-unk|tvi912b-unk-2p|tvi912c-unk-2p|TeleVideo TVI-912B or TVI-912C (second page memory option; no attributes), -+ use=tvi912b+2p, use=tvi912b-unk, - --# --# Teletype Model 5420 -- A souped up 5410, with multiple windows, --# even! the 5420 has three modes: scroll, window or page mode --# this terminfo should work in scroll or window mode, but doesn't --# take advantage of any of the differences between them. --# --# Has memory below (2 lines!) --# 3 pages of memory (plus some spare) --# The 5410 sequences for <cup>, <cvvis>, <dch>, <dl>, <ech>, <flash>, <home>, --# <hpa>, <hts> would work for these, but these work in both scroll and window --# mode... Unset insert character so insert mode works --# <is1> sets 80 column mode, --# <is2> escape sequence: --# 1) turn off all fonts --# 2) function keys off, keyboard lock off, control display off, --# insert mode off, erasure mode off, --# 3) full duplex, monitor mode off, send graphics off, nl on lf off --# 4) reset origin mode --# 5) set line wraparound --# 6) exit erasure mode, positional attribute mode, and erasure extent mode --# 7) clear margins --# 8) program ENTER to transmit ^J, --# We use \212 to program the ^J because a bare ^J will get translated by --# UNIX into a CR/LF. The enter key is needed for AT&T uOMS. --# 1 2 3 4 5 6 7 8 --# <is3> set screen color to black, --# No representation in terminfo for the delete word key: kdw1=\Ed --# Key capabilities assume the power-up send sequence... --# This <rmcup> is not strictly necessary, but it helps maximize --# memory usefulness: <rmcup=\Ez>, --# Alternate sgr0: <sgr0=\E[m\EW^O>, --# Alternate sgr: <sgr=\E[%?%p1%t2;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p5%t;2%;%?%p7%t;8%;m%?%p8%t\EV%;%?%p9%t^N%e^O%;>, --# smkx programs the SYS PF keys to send a set sequence. --# It also sets up labels f1, f2, ..., f8, and sends edit keys. --# This string causes them to send the strings <kf1>-<kf8> --# when pressed in SYS PF mode. --# (att4415: I added <rmam>/<smam> based on the init string -- esr) --att4415|tty5420|att5420|AT&T 4415/5420 80 cols, -- OTbs, db, mir, xon, -- lh#2, lm#78, lw#8, nlab#8, wsl#55, -- cbt=\E[Z, clear=\E[x\E[J, cnorm=\E[11;0j, cub=\E[%p1%dD, -- cud=\E[%p1%dB, cuf=\E[%p1%dC, cup=\E[%i%p1%d;%p2%dx, -- cuu=\E[%p1%dA, cvvis=\E[11;1j, dch=\E[%p1%dP, -- dl=\E[%p1%dM, ech=\E[%p1%ds\E[%p1%dD, -- flash=\E[?5h$<200>\E[?5l, home=\E[x, -- hpa=\E[%p1%{1}%+%dG, hts=\EH, ich=\E[%p1%d@, ich1@, -- il=\E[%p1%dL, indn=\E[%p1%dE, is1=\E[?3l$<100>, -- is2=\E[m\017\E[1;2;3;4;6l\E[12;13;14;20l\E[?6;97;99l\E[?7h\E[4i\Ex\E[21;1j\212, -- is3=\E[?5l, kbeg=\Et, kcbt=\E[Z, kdch1=\E[P, kdl1=\E[M, -- kel=\E[2K, kend=\Ez, kent=\Eent, kf1=\EOc, kf2=\EOd, -- kf3=\EOe, kf4=\EOf, kf5=\EOg, kf6=\EOh, kf7=\EOi, kf8=\EOj, -- kich1=\E[4h, kil1=\E[L, kind=\E[T, kll=\Eu, knp=\E[U, -- kpp=\E[V, kri=\E[S, lf1=F1, lf2=F2, lf3=F3, lf4=F4, lf5=F5, -- lf6=F6, lf7=F7, lf8=F8, ll=\Ew, mc0=\E[?2i, mc4=\E[?9i, -- mc5=\E[?4i, mrcup=\E[%i%p1%d;%p2%dt, -- pfx=\E[%p1%d;%p2%l%02dq F%p1%d %p2%s, -- pln=\E[%p1%d;0;0;0q%p2%:-16.16s, prot=\EV, -- rin=\E[%p1%dF, rmam=\E[?7l, rmir=\E[4l, -- rmkx=\E[19;0j\E[21;1j\212, rmln=\E|, -- sgr=\E[0%?%p1%p5%|%t;2%;%?%p2%p6%|%t;4%;%?%p4%t;5%;%?%p3%p1%|%p6%|%t;7%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, -- sgr0=\E[m\017, smam=\E[?7h, smir=\E[4h, -- smkx=\E[19;1j\E[21;4j\Eent, smln=\E~, tbc=\E[3g, -- tsl=\E7\E[25;%p1%{8}%+%dH, vpa=\E[%p1%{1}%+%dd, -- use=att4410, -+tvi912b-vb-unk|tvi912c-vb-unk|tvi912b-unk-vb|tvi912c-unk-vb|TeleVideo TVI-912B or TVI-912C (second page memory option "visible bell"; no attributes), -+ use=tvi912b+vb, use=tvi912b-unk, - --att4415-w|tty5420-w|att5420-w|AT&T 4415/5420 132 cols, -- cols#132, lm#54, wsl#97, -- is1=\E[?3h$<100>, use=att4415, -+tvi912b-p|tvi912c-p|TeleVideo TVI-912B or TVI-912C (no attributes; page print), -+ use=tvi912b+printer, use=tvi912b-unk, - --att4415-rv|tty5420-rv|att5420-rv|AT&T 4415/5420 80 cols/rv, -- flash=\E[?5l$<200>\E[?5h, is3=\E[?5h, use=att4415, -+tvi912b-2p-p|tvi912c-2p-p|tvi912b-p-2p|tvi912c-p-2p|TeleVideo TVI-912B or TVI-912C (second page memory option; no attributes; page print), -+ use=tvi912b+2p, use=tvi912b+printer, use=tvi912b-unk, - --att4415-w-rv|tty5420-w-rv|att5420-w-rv|AT&T 4415/5420 132 cols/rv, -- cols#132, lm#54, wsl#97, -- flash=\E[?5l$<200>\E[?5h, is1=\E[?3h$<100>, is3=\E[?5h, -- use=att4415, -+tvi912b-vb-p|tvi912c-vb-p|tvi912b-p-vb|tvi912c-p-vb|TeleVideo TVI-912B or TVI-912C (second page memory option "visible bell"; no attributes; page print), -+ use=tvi912b+vb, use=tvi912b+printer, use=tvi912b-unk, - --# Note that this mode permits programming USER PF KEYS and labels --# However, when you program user pf labels you have to reselect --# user pf keys to make them appear! --att4415+nl|tty5420+nl|att5420+nl|generic AT&T 4415/5420 changes for not changing labels, -- kf1@, kf2@, kf3@, kf4@, kf5@, kf6@, kf7@, kf8@, -- pfx=\E[%p1%d;%p2%l%02d;0;1q F%p1%d %p2%s, -- pln=\E[%p1%d;0;0;1q%p2%:-16.16s, -+tvi912b-2p|tvi912c-2p|TeleVideo TVI-912B or TVI-912C (second page memory option; half-intensity attribute), -+ use=tvi912b+2p, use=tvi912b+dim, use=tvi912b-unk, - --att4415-nl|tty5420-nl|att5420-nl|AT&T 4415/5420 without changing labels, -- kf1@, kf2@, kf3@, kf4@, kf5@, kf6@, kf7@, kf8@, use=att4415+nl, -- use=att4415, -+tvi912b-2p-mc|tvi912c-2p-mc|tvi912b-mc-2p|tvi912c-mc-2p|TeleVideo TVI-912B or TVI-912C (second page memory option; magic cookies), -+ use=tvi912b+2p, use=tvi912b+mc, use=tvi912b-unk, - --att4415-rv-nl|tty5420-rv-nl|att5420-rv-nl|AT&T 4415/5420 reverse video without changing labels, -- kf1@, kf2@, kf3@, kf4@, kf5@, kf6@, kf7@, kf8@, use=att4415+nl, -- use=att4415-rv, -+tvi912b-vb|tvi912c-vb|TeleVideo TVI-912B or TVI-912C (second page memory option "visible bell"; half-intensity attribute), -+ use=tvi912b+vb, use=tvi912b+dim, use=tvi912b-unk, - --att4415-w-nl|tty5420-w-nl|att5420-w-nl|AT&T 4415/5420 132 cols without changing labels, -- kf1@, kf2@, kf3@, kf4@, kf5@, kf6@, kf7@, kf8@, use=att4415+nl, -- use=att4415-w, -+tvi912b-vb-mc|tvi912c-vb-mc|tvi912b-mc-vb|tvi912c-mc-vb|TeleVideo TVI-912B or TVI-912C (second page memory option "visible bell"; magic cookies), -+ use=tvi912b+vb, use=tvi912b+mc, use=tvi912b-unk, - --att4415-w-rv-n|tty5420-w-rv-n|att5420-w-rv-n|AT&T 4415/5420 132 cols reverse without changing labels, -- kf1@, kf2@, kf3@, kf4@, kf5@, kf6@, kf7@, kf8@, use=att4415+nl, -- use=att4415-w-rv, -+tvi912b|tvi912c|TeleVideo TVI-912B or TVI-912C (half-intensity attribute), -+ use=tvi912b+dim, use=tvi912b-unk, - --att5420_2|AT&T 5420 model 2 80 cols, -- am, db, hs, mir, msgr, xon, -- cols#80, it#8, lh#2, lines#24, lm#78, lw#8, nlab#8, wsl#55, -- acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -- blink=\E[5m, cbt=\E[1Z, clear=\EH\EJ, cnorm=\E[11;0j, -- cr=\EG, csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, -- cud=\E[%p1%dB, cud1=\E[1B, cuf=\E[%p1%dC, cuf1=\E[1C, -- cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[1A, -- cvvis=\E[11;1j, dch=\E[%p1%dP, dch1=\E[P, dim=\E[2m, -- dl=\E[%p1%dM, dl1=\E[M, ech=\E[%p1%ds\E[%p1%dD, ed=\E[0J, -- el=\E[0K, el1=\E[1K, flash=\E[?5h$<200>\E[?5l, fsl=\E8, -- home=\E[H, hpa=\E[%p1%{1}%+%dG, ht=^I, hts=\EH, -- ich=\E[%p1%d@, ich1=\E[@, il=\E[%p1%dL, il1=\E[L, ind=^J, -- indn=\E[%p1%dE, invis=\E[8m, -- is1=\E[0;23r\Ex\Ey\E[2;0j\E[3;3j\E[4;0j\E[5;0j\E[6;0j\E[7;0j\E[8;0j\E[9;1j\E[10;0j\E[15;0j\E[16;1j\E[19;0j\E[20;1j\E[29;0j\E[1;24r, -- kbeg=\Et, kbs=^H, kcbt=\E[Z, kclr=\E[2J, kcub1=\E[D, -- kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[P, kdl1=\E[M, -- kel=\E[2K, kend=\Ez, kent=^J, kf1=\EOc, kf2=\EOd, kf3=\EOe, -- kf4=\EOf, kf5=\EOg, kf6=\EOh, kf7=\EOi, kf8=\EOj, khome=\E[H, -- kich1=\E[4h, kil1=\E[L, kind=\E[T, kll=\Eu, knp=\E[U, -- kpp=\E[V, kri=\E[S, lf1=F1, lf2=F2, lf3=F3, lf4=F4, lf5=F5, -- lf6=F6, lf7=F7, lf8=F8, ll=\Ew, mc0=\E[?;2i, mc4=\E[4i, -- mc5=\E[5i, mrcup=\E[%i%p1%d;%p2%dt, nel=^M^J, -- pfx=\E[%p1%d;%p2%l%02dq F%p1%d %p2%s\E~, -- pln=\E[%p1%d;0;0;0q%p2%:-16.16s\E~, prot=\EV, rc=\E8, -- rev=\E[7m, ri=\EM, rin=\E[%p1%dF, rmacs=^O, rmkx=\E[19;0j, -- rmln=\E|, rmso=\E[m, rmul=\E[m, rs2=\Ec\E[?3l\E[2;0y, -- sc=\E7, -- sgr=\E[0%?%p1%p5%|%t;2%;%?%p2%p6%|%t;4%;%?%p4%t;5%;%?%p3%p1%|%p6%|%t;7%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, -- sgr0=\E[m\017, smacs=^N, smkx=\E[19;1j, smln=\E~, -- smso=\E[7m, smul=\E[4m, tbc=\E[3g, -- tsl=\E7\E[25;%p1%{8}%+%dH, vpa=\E[%p1%{1}%+%dd, --att5420_2-w|AT&T 5420 model 2 in 132 column mode, -- cols#132, -- is1=\E[0;23r\Ex\Ey\E[2;0j\E[3;3j\E[4;0j\E[5;1j\E[6;0j\E[7;0j\E[8;0j\E[9;1j\E[10;0j\E[15;0j\E[16;1j\E[19;0j\E[20;1j\E[29;0j\E[1;24r, -- use=att5420_2, -+tvi912b-mc|tvi912c-mc|TeleVideo TVI-912B or TVI-912C (magic cookies), -+ use=tvi912b+mc, use=tvi912b-unk, - --att4418|att5418|AT&T 5418 80 cols, -- am, xon, -- cols#80, lines#24, -- acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -- bel=^G, blink=\E[5m, clear=\E[H\E[2J, cr=^M, cub=\E[%p1%dD, -- cub1=\E[D, cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, -- cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, -- cuu1=\E[A, dch=\E[%p1%dP, dch1=\E[1P, dim=\E[2m, -- dl=\E[%p1%dM, dl1=\E[M, ed=\E[0J, el=\E[0K, home=\E[H, -- ich=\E[%p1%d@, ich1=\E[1@, il=\E[%p1%dL, il1=\E[1L, ind=^J, -- is1=\E[?3l, is2=\E)0\E?6l\E?5l, kclr=\E[%%, kcub1=\E@, -- kcud1=\EU, kcuf1=\EA, kcuu1=\ES, kent=\E[, kf1=\E[h, -- kf10=\E[m, kf11=\E[n, kf12=\E[o, kf13=\E[H, kf14=\E[I, -- kf15=\E[J, kf18=\E[K, kf19=\E[L, kf2=\E[i, kf20=\E[E, -- kf21=\E[_, kf22=\E[M, kf23=\E[N, kf24=\E[O, kf3=\E[j, -- kf6=\E[k, kf7=\E[l, kf8=\E[f, kf9=\E[w, khome=\Ec, rc=\E8, -- rev=\E[7m, rmacs=^O, rmso=\E[m, rmul=\E[m, sc=\E7, -- sgr0=\E[m\017, smacs=^N, smso=\E[7m, smul=\E[4m, --att4418-w|att5418-w|AT&T 5418 132 cols, -- cols#132, -- is1=\E[?3h, use=att5418, -+tvi920b-unk|tvi920c-unk|TeleVideo TVI-920B or TVI-920C (no attributes), -+ use=tvi920b+fn, use=tvi912b-unk, - --att4420|tty4420|teletype 4420, -- OTbs, da, db, eo, msgr, ul, xon, -- cols#80, lines#24, lm#72, -- bel=^G, clear=\EH\EJ, cr=\EG, cub1=\ED, cud1=\EB, cuf1=\EC, -- cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, dch1=\EP, -- dl1=\EM, ed=\EJ, el=\Ez, home=\EH, il1=\EL, ind=\EH\EM\EY7\s, -- kcbt=\EO, kclr=\EJ, kcub1=^H, kcud1=\EB, kcuf1=\EC, -- kcuu1=\EA, kdch1=\EP, kdl1=\EM, kf0=\EU, kf3=\E@, khome=\EH, -- kich1=\E\^, kil1=\EL, kind=\ES, kri=\ET, -- lf0=segment advance, lf3=cursor tab, rmdc@, rmso=\E~, -- rmul=\EZ, smdc@, smso=\E}, smul=\E\\, -+tvi920b-2p-unk|tvi920c-2p-unk|tvi920b-unk-2p|tvi920c-unk-2p|TeleVideo TVI-920B or TVI-920C (second page memory option; no attributes), -+ use=tvi920b+fn, use=tvi912b+2p, use=tvi912b-unk, - --# The following is a terminfo entry for the Teletype 4424 --# asynchronous keyboard-display terminal. It supports --# the vi editor. The terminal must be set up as follows, --# --# HIGHLIGHT DEFINITION 3-TONE --# DISPLAY FUNCTION GROUP III --# --# The second entry below provides limited (a la adm3a) --# operation under GROUP II. --# --# This must be used with DISPLAY FUNCTION GROUP I or III --# and HIGHLIGHT DEFINITION 3-TONE --# The terminal has either bold or blink, depending on options --# --# (att4424: commented out <smcup>=\E[1m, we don't need bright locked on -- esr) --att4424|tty4424|teletype 4424, -- OTbs, am, xon, -- cols#80, lines#24, -- acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -- bel=^G, blink=\E3, bold=\E3, cbt=\EO, clear=\E[H\E[2J, cr=^M, -- csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, -- cud=\E[%p1%dB, cud1=\EB, cuf=\E[%p1%dC, cuf1=\EC, -- cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\EA, -- dch=\E[%p1%dP, dch1=\EP, dim=\EW, dl=\E[%p1%dM, dl1=\EM, -- ed=\EJ, el=\Ez, home=\E[H, ht=^I, hts=\EH, ich=\E[%p1%d@, -- ich1=\E\^, il=\E[%p1%dL, il1=\EL, ind=^J, is2=\E[20l\E[?7h, -- kbs=^H, kclr=\EJ, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, -- kcuu1=\E[A, kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, -- khome=\E[H, nel=\EE, rev=\E}, ri=\ET, rmacs=\E(B, rmso=\E~, -- rmul=\EZ, -- sgr=\E[%?%p1%t7%;%?%p2%t;4%;%?%p3%t;7%;%?%p6%t;1%;%?%p6%p4%|%t;5%;%?%p5%t;0%;m, -- sgr0=\EX\E~\EZ\E4\E(B, smacs=\E(0, smso=\E}, smul=\E\\, -- tbc=\EF, -+tvi920b-vb-unk|tvi920c-vb-unk|tvi920b-unk-vb|tvi920c-unk-vb|TeleVideo TVI-920B or TVI-920C (second page memory option "visible bell"; no attributes), -+ use=tvi920b+fn, use=tvi912b+vb, use=tvi912b-unk, - --att4424-1|tty4424-1|teletype 4424 in display function group I, -- kclr@, kcub1=\ED, kcud1=\EB, kcuf1=\EC, kcuu1=\EA, khome@, -- use=att4424, -+tvi920b-p|tvi920c-p|TeleVideo TVI-920B or TVI-920C (no attributes; page print), -+ use=tvi920b+fn, use=tvi912b+printer, use=tvi912b-unk, - --# This entry is not one of AT&T's official ones, it was translated from the --# 4.4BSD termcap file. The highlight strings are different from att4424. --# I have no idea why this is -- older firmware version, maybe? --# The following two lines are the comment originally attached to the entry: --# This entry appears to avoid the top line - I have no idea why. --# From: jwb Wed Mar 31 13:25:09 1982 remote from ihuxp --att4424m|tty4424m|teletype 4424M, -- am, da, db, mir, -- cols#80, it#8, lines#23, -- bel=^G, clear=\E[2;H\E[J, cr=^M, cub1=^H, cud1=^J, cuf1=\E[C, -- cup=\E[%i%p1%2d;%p2%2dH\E[B, cuu1=\E[A, dch1=\EP, -- dl1=\EM, el=\E[K, ht=^I, ich1=\E\^, il1=\EL, ind=^J, ip=$<2/>, -- is2=\E[m\E[2;24r, kbs=^H, kcub1=\E[D, kcud1=\E[B, -- kcuf1=\E[C, kcuu1=\E[A, kf1=\EOP, kf2=\EOQ, kf3=\EOR, -- kf4=\EOS, khome=\E[H, nel=^M^J, ri=\ET, rmso=\E[m, rmul=\E[m, -- sgr0=\E[m, smso=\E[7m, smul=\E[4m, -+tvi920b-2p-p|tvi920c-2p-p|tvi920b-p-2p|tvi920c-p-2p|TeleVideo TVI-920B or TVI-920C (second page memory option; no attributes; page print), -+ use=tvi920b+fn, use=tvi912b+2p, use=tvi912b+printer, -+ use=tvi912b-unk, - --# The Teletype 5425 is really version 2 of the Teletype 5420. It --# is quite similar, except for some minor differences. No page --# mode, for example, so all of the <cup> sequences used above have --# to change back to what's being used for the 5410. Many of the --# option settings have changed their numbering as well. --# --# This has been tested on a preliminary model. --# --# (att5425: added <rmam>/<smam> based on the init string -- esr) --att5425|tty5425|att4425|AT&T 4425/5425, -- am, da, db, hs, mir, msgr, xenl, xon, -- cols#80, it#8, lh#2, lines#24, lm#78, lw#8, nlab#8, wsl#55, -- acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -- bel=^G, blink=\E[5m, bold=\E[2;7m, cbt=\E[Z, -- clear=\E[H\E[J, cnorm=\E[12;0j, cr=^M, -- csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, -- cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, -- cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, -- cvvis=\E[12;1j, dch=\E[%p1%dP, dch1=\E[P, dim=\E[2m, -- dl=\E[%p1%dM, dl1=\E[M, ech=\E[%p1%ds\E[%p1%dD, ed=\E[J, -- el=\E[K, el1=\E[1K, enacs=\E(B\E)0, -- flash=\E[?5h$<200>\E[?5l, fsl=\E8, home=\E[H, -- hpa=\E[%p1%{1}%+%dG, ht=^I, hts=\EH, ich=\E[%p1%d@, -- il=\E[%p1%dL, il1=\E[L, ind=^J, indn=\E[%p1%dE, -- invis=\E[8m, is1=\E<\E[?3l$<100>, -- is2=\E[m\017\E[1;2;3;4;6l\E[12;13;14;20l\E[?6;97;99l\E[?7h\E[4i\Ex\E[25;1j\212, -- is3=\E[?5l, kbeg=\Et, kbs=^H, kcbt=\E[Z, kclr=\E[J, -- kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[P, -- kdl1=\E[M, kel=\E[2K, kend=\Ez, kent=\Eent, kf1=\EOc, -- kf2=\EOd, kf3=\EOe, kf4=\EOf, kf5=\EOg, kf6=\EOh, kf7=\EOi, -- kf8=\EOj, khome=\E[H, kich1=\E[4h, kil1=\E[L, kind=\E[T, -- kri=\E[S, ll=\E[24H, mc0=\E[?2i, mc4=\E[?9i, mc5=\E[?4i, -- nel=^M^J, -- pfx=\E[%p1%d;%p2%l%02dq F%p1%1d %p2%s, -- pln=\E[%p1%d;0;0;0q%p2%:-16.16s, prot=\EV, rc=\E8, -- rev=\E[7m, ri=\EM, rin=\E[%p1%dF, rmacs=^O, rmam=\E[?7l, -- rmir=\E[4l, rmkx=\E[21;0j\E[25;1j\212, rmln=\E|, -- rmso=\E[m, rmul=\E[m, rs2=\Ec\E[?3l\E[2;0y, sc=\E7, -- sgr=\E[0%?%p1%p5%|%t;2%;%?%p2%p6%|%t;4%;%?%p4%t;5%;%?%p3%p1%|%p6%|%t;7%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, -- sgr0=\E[m\017, smacs=^N, smam=\E[?7h, smir=\E[4h, -- smkx=\E[21;1j\E[25;4j\Eent\E~, smln=\E~, smso=\E[7m, -- smul=\E[4m, tbc=\E[3g, tsl=\E7\E[25;%p1%{8}%+%dH, -- vpa=\E[%p1%{1}%+%dd, -+tvi920b-vb-p|tvi920c-vb-p|tvi920b-p-vb|tvi920c-p-vb|TeleVideo TVI-920B or TVI-920C (second page memory option "visible bell"; no attributes; page print), -+ use=tvi920b+fn, use=tvi912b+vb, use=tvi912b+printer, -+ use=tvi912b-unk, - --att5425-nl|tty5425-nl|att4425-nl|AT&T 4425/5425 80 columns no labels, -- smkx=\E[21;1j\E[25;4j\Eent, use=att4425, -+tvi920b-2p|tvi920c-2p|TeleVideo TVI-920B or TVI-920C (second page memory option; half-intensity attribute), -+ use=tvi920b+fn, use=tvi912b+2p, use=tvi912b+dim, -+ use=tvi912b-unk, - --att5425-w|att4425-w|tty5425-w|teletype 4425/5425 in 132 column mode, -- cols#132, lm#54, wsl#97, -- is1=\E[?3h$<100>, use=tty5425, -+tvi920b-2p-mc|tvi920c-2p-mc|tvi920b-mc-2p|tvi920c-mc-2p|TeleVideo TVI-920B or TVI-920C (second page memory option; magic cookies), -+ use=tvi920b+fn, use=tvi912b+2p, use=tvi912b+mc, -+ use=tvi912b-unk, - --# (att4426: his had bogus capabilities: :ri=\EM:, :ri=\E[1U:. --# I also added <rmam>/<smam> -- esr) --att4426|tty4426|teletype 4426S, -- am, da, db, xon, -- cols#80, lines#24, lm#48, -- acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -- bel=^G, bold=\E[5m, clear=\E[H\E[2J\E[1U\E[H\E[2J\E[1V, -- cr=^M, cub=\E[%p1%dD, cub1=\E[D, cud=\E[%p1%dB, cud1=\E[B, -- cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, -- cuu=\E[%p1%dA, cuu1=\E[A, dch=\E[%p1%dP, dch1=\EP, -- dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[0K, home=\E[H, -- hpa=\E[%p1%dG, ht=^I, hts=\E1, ich=\E[%p1%d@, ich1=\E\^, -- il=\E[%p1%dL, il1=\EL, ind=^J, indn=\E[%p1%dS, -- is1=\Ec\E[?7h, is2=\E[m\E[1;24r, kbs=^H, kcbt=\EO, -- kclr=\E[2J, kcub1=\ED, kcud1=\EB, kcuf1=\EC, kcuu1=\EA, -- kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, kf5=\EOT, kf6=\EOU, -- kf7=\EOV, kf8=\EOW, khome=\E[H, kll=\E[24;1H, ll=\E[24H, -- nel=^M^J, rc=\E8, rev=\E[7m, ri=\ET, rin=\E[%p1%dT, -- rmacs=\E(B, rmam=\E[?7l, rmso=\E[m, rmul=\E[m, -- rs2=\Ec\E[?3l\E[2;0y, sc=\E7, sgr0=\E[m\E(B, smacs=\E(0, -- smam=\E[?7h, smso=\E[5m, smul=\E[4m, tbc=\E[3g, -- vpa=\E[%p1%dd, -+tvi920b-vb|tvi920c-vb|TeleVideo TVI-920B or TVI-920C (second page memory option "visible bell"; half-intensity attribute), -+ use=tvi920b+fn, use=tvi912b+vb, use=tvi912b+dim, -+ use=tvi912b-unk, - --# Terminfo entry for the AT&T 510 A Personal Terminal --# Function keys 9 - 16 are available only after the --# screen labeled (soft keys/action blocks) are labeled. Function key --# 9 corresponds to the leftmost touch target on the screen, --# function key 16 corresponds to the rightmost. --# --# This entry is based on one done by Ernie Rice at Summit, NJ and --# changed by Anne Gallup, Skokie, IL, ttrdc!anne --att510a|bct510a|AT&T 510A Personal Terminal, -- am, mir, msgr, xenl, xon, -- cols#80, lh#2, lines#24, lw#7, nlab#8, -- acsc=+g\,h-f.e`bhrisjjkkllmmnnqqttuuvvwwxx{{||}}~~, -- bel=^G, blink=\E[5m, bold=\E[2;7m, cbt=\E[Z, -- civis=\E[11;0|, clear=\E[H\E[J, cnorm=\E[11;3|, cr=^M, -- cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=\E[B, -- cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, -- cuu=\E[%p1%dA, cuu1=\E[A, cvvis=\E[11;2|, dch=\E[%p1%dP, -- dch1=\E[P, dim=\E[2m, dl=\E[%p1%dM, dl1=\E[M, ed=\E[0J, -- el=\E[0K, el1=\E[1K, enacs=\E(B\E)1, ff=^L, home=\E[H, ht=^I, -- hts=\EH, il=\E[%p1%dL, il1=\E[L, ind=^J, is1=\E(B\E)1\E[2l, -- is3=\E[21;1|\212, kLFT=\E[u, kRIT=\E[v, kbs=^H, kcbt=\E[Z, -- kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kf1=\EOm, -- kf10=\EOd, kf11=\EOe, kf12=\EOf, kf13=\EOg, kf14=\EOh, -- kf15=\EOi, kf16=\EOj, kf2=\EOV, kf3=\EOu, kf4=\ENj, kf5=\ENe, -- kf6=\ENf, kf7=\ENh, kf8=\E[H, kf9=\EOc, kind=\E[S, kri=\E[T, -- mc0=\E[0i, mc4=\E[?8i, mc5=\E[?4i, nel=\EE, -- pln=\E[%p1%dp%p2%:-16s, rc=\E8, rev=\E[7m, ri=\EM, -- rmacs=^O, rmkx=\E[19;0|, rmso=\E[m, rmul=\E[m, sc=\E7, -- sgr=\E[0%?%p5%p6%|%t;2%;%?%p2%t;4%;%?%p4%t;5%;%?%p3%p1%|%p6%|%t;7%;m%?%p9%t\016%e\017%;, -- sgr0=\E[m\017, smacs=^N, smkx=\E[19;1|, smso=\E[7m, -- smul=\E[4m, tbc=\E[3g, -+tvi920b-vb-mc|tvi920c-vb-mc|tvi920b-mc-vb|tvi920c-mc-vb|TeleVideo TVI-920B or TVI-920C (second page memory option "visible bell"; magic cookies), -+ use=tvi920b+fn, use=tvi912b+vb, use=tvi912b+mc, -+ use=tvi912b-unk, - --# Terminfo entry for the AT&T 510 D Personal Terminal --# Function keys 9 through 16 are accessed by bringing up the --# system blocks. --# Function key 9 corresponds to the leftmost touch target on the screen, --# function key 16 corresponds to the rightmost. --# --# There are problems with soft key labeling. These are due to --# strangenesses in the native terminal that are impossible to --# describe in a terminfo. --att510d|bct510d|AT&T 510D Personal Terminal, -- am, da, db, mir, msgr, xenl, xon, -- cols#80, lh#2, lines#24, lm#48, lw#7, nlab#8, -- acsc=+g\,h-f.e`bhrisjjkkllmmnnqqttuuvvwwxx{{||}}~~, -- bel=^G, blink=\E[5m, bold=\E[2;7m, cbt=\E[Z, -- clear=\E[H\E[J, cnorm=\E[11;3|, cr=^M, cub=\E[%p1%dD, -- cub1=^H, cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, -- cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, -- cuu1=\E[A, cvvis=\E[11;2|, dch=\E[%p1%dP, dch1=\E[P, -- dim=\E[2m, dl=\E[%p1%dM, dl1=\E[M, ed=\E[0J, el=\E[0K, -- el1=\E[1K, enacs=\E(B\E)1, ff=^L, home=\E[H, -- hpa=\E[%p1%{1}%+%dG, ht=^I, hts=\EH, ich=\E[%p1%d@, -- il=\E[%p1%dL, il1=\E[L, ind=^J, indn=\E[%p1%dS, -- invis=\E[8m, is1=\E(B\E)1\E[5;0|, is3=\E[21;1|\212, -- kLFT=\E[u, kRIT=\E[v, kbs=^H, kcbt=\E[Z, kcub1=\E[D, -- kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kf1=\EOm, kf10=\EOd, -- kf11=\EOe, kf12=\EOf, kf13=\EOg, kf14=\EOh, kf15=\EOi, -- kf16=\EOj, kf2=\EOV, kf3=\EOu, kf4=\ENj, kf5=\ENe, kf6=\ENf, -- kf7=\ENh, kf8=\E[H, kf9=\EOc, kind=\E[S, kri=\E[T, ll=\E#2, -- mc0=\E[0i, mc4=\E[?8i, mc5=\E[?4i, mgc=\E\:, nel=\EE, -- pln=\E[%p1%dp%p2%:-16s, rc=\E8, -- rep=%p1%c\E[%p2%{1}%-%db, rev=\E[7m, ri=\EM, -- rin=\E[%p1%dT, rmacs=^O, rmir=\E[4l, rmkx=\E[19;0|, -- rmln=\E<, rmso=\E[m, rmul=\E[m, rmxon=\E[29;1|, -- rs2=\E[5;0|, sc=\E7, -- sgr=\E[0%?%p5%p6%|%t;2%;%?%p2%t;4%;%?%p4%t;5%;%?%p3%p1%|%p6%|%t;7%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, -- sgr0=\E[m\017, smacs=^N, smgl=\E4, smgr=\E5, smir=\E[4h, -- smkx=\E[19;1|, smln=\E?, smso=\E[7m, smul=\E[4m, -- smxon=\E[29;0|, tbc=\E[3g, vpa=\E[%p1%{1}%+%dd, -+tvi920b|tvi920c|TeleVideo TVI-920B or TVI-920C (half-intensity attribute), -+ use=tvi920b+fn, use=tvi912b+dim, use=tvi912b-unk, - --# (att500: I merged this with the att513 entry, att500 just used att513 -- esr) --att500|att513|AT&T 513 using page mode, -- am, chts, mir, msgr, xenl, xon, -- cols#80, lh#2, lines#24, lw#8, nlab#8, -- acsc=+g\,h-f.e`bhrisjjkkllmmnnqqttuuvvwwxx{{||}}~~, -- bel=^G, blink=\E[5m, bold=\E[2;7m, cbt=\E[Z, -- clear=\E[H\E[J, cnorm=\E[11;0|, cr=^M, -- csr=%i\E[%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, -- cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, -- cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, -- cvvis=\E[11;1|, dch=\E[%p1%dP, dch1=\E[P$<1>, dim=\E[2m, -- dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[K, el1=\E[1K, -- enacs=\E(B\E)1, home=\E[H, hpa=\E[%p1%{1}%+%dG, ht=^I, -- hts=\EH, ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[L, ind=^J, -- indn=\E[%p1%dE, invis=\E[8m, -- is1=\E?\E[3;3|\E[10;0|\E[21;1|\212\E[6;1|\E[1{\E[?99l, -- kBEG=\ENB, kCAN=\EOW, kCMD=\EOU, kCPY=\END, kCRT=\EON, -- kDC=\ENF, kDL=\ENE, kEND=\ENN, kEOL=\EOA, kEXT=\EOK, -- kFND=\EOX, kHLP=\EOM, kHOM=\ENM, kIC=\ENJ, kLFT=\ENK, -- kMOV=\ENC, kMSG=\EOL, kNXT=\ENH, kOPT=\EOR, kPRT=\EOZ, -- kPRV=\ENG, kRDO=\EOT, kRES=\EOQ, kRIT=\ENL, kRPL=\EOY, -- kSAV=\EOO, kSPD=\EOP, kUND=\EOS, kbeg=\E9, kbs=^H, kcan=\EOw, -- kcbt=\E[Z, kclo=\EOV, kclr=\E[J, kcmd=\EOu, kcpy=\ENd, -- kcrt=\EOn, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, -- kdch1=\ENf, kdl1=\ENe, kel=\EOa, kend=\E0, kent=\Eent, -- kext=\EOk, kf1=\EOc, kf2=\EOd, kf3=\EOe, kf4=\EOf, kf5=\EOg, -- kf6=\EOh, kf7=\EOi, kf8=\EOj, kfnd=\EOx, khlp=\EOm, -- khome=\E[H, kich1=\ENj, kind=\E[S, kmov=\ENc, kmrk=\ENi, -- kmsg=\EOl, knp=\E[U, knxt=\ENh, kopn=\EOv, kopt=\EOr, -- kpp=\E[V, kprt=\EOz, kprv=\ENg, krdo=\EOt, kref=\EOb, -- kres=\EOq, krfr=\ENa, kri=\E[T, krpl=\EOy, krst=\EOB, -- ksav=\EOo, kslt=\ENI, kspd=\EOp, kund=\EOs, ll=\E#2, -- mc0=\E[?98l\E[0i, mc4=\E[?98l\E[?8i, mc5=\E[?98l\E[?4i, -- nel=\EE, -- pfkey=\E[%p1%d;%p2%l%d;3;0p F%p1%d %p2%s, -- pfloc=\E[%p1%d;%p2%l%d;2;0p F%p1%d %p2%s, -- pfx=\E[%p1%d;%p2%l%d;1;0p F%p1%d %p2%s, -- pln=\E[%p1%dp%p2%:-16s, rc=\E8, -- rep=%p1%c\E[%p2%{1}%-%db, rev=\E[7m, ri=\EM, -- rin=\E[%p1%dF, rmacs=^O, rmir=\E[4l, -- rmkx=\E[19;0|\E[21;1|\212, rmln=\E<, rmso=\E[m, -- rmul=\E[m, -- rs1=\E?\E[3;3|\E[10;0|\E[21;1|\212\E[6;1|\E[1{\E[?99l\E[2;0|\E[6;1|\E[8;0|\E[19;0|\E[1{\E[?99l, -- rs2=\E[5;0|, sc=\E7, -- sgr=\E[0%?%p1%p5%|%t;2%;%?%p2%p6%|%t;4%;%?%p4%t;5%;%?%p3%p1%|%p6%|%t;7%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, -- sgr0=\E[m\017, smacs=^N, smir=\E[4h, -- smkx=\E[19;1|\E[21;4|\Eent, smln=\E?, smso=\E[7m, -- smul=\E[4m, tbc=\E[3g, vpa=\E[%p1%{1}%+%dd, -+tvi920b-mc|tvi920c-mc|TeleVideo TVI-920B or TVI-920C (magic cookies), -+ use=tvi920b+fn, use=tvi912b+mc, use=tvi912b-unk, - --# 01-07-88 --# printer must be set to EMUL ANSI to accept ESC codes --# <cuu1> stops at top margin --# <is1> sets cpi 10,lpi 6,form 66,left 1,right 132,top 1,bottom 66,font --# and alt font ascii,wrap on,tabs cleared --# <is2> disables newline on LF,Emphasized off --# The <u0> capability sets form length --att5310|att5320|AT&T Model 53210 or 5320 matrix printer, -- xhpa, xvpa, -- bufsz#8192, cols#132, cps#120, it#8, lines#66, orc#10, -- orhi#100, orl#12, orvi#72, -- cpi=%?%p1%{10}%=%t\E[w%e%p1%{12}%=%t\E[2w%e%p1%{5}%=%t\E[5w%e%p1%{13}%=%p1%{14}%=%O%t\E[3w%e%p1%{16}%=%p1%{17}%=%O%t\E[4w%e%p1%{6}%=%t\E[6w%e%p1%{7}%=%t\E[7w%e%p1%{8}%=%t\E[8w%;, -- cr=^M, -- csnm=%?%p1%{0}%=%tusascii%e%p1%{1}%=%tenglish%e%p1%{2}%=%tfinnish%e%p1%{3}%=%tjapanese%e%p1%{4}%=%tnorwegian%e%p1%{5}%=%tswedish%e%p1%{6}%=%tgermanic%e%p1%{7}%=%tfrench%e%p1%{8}%=%tcanadian_french%e%p1%{9}%=%titalian%e%p1%{10}%=%tspanish%e%p1%{11}%=%tline%e%p1%{12}%=%tsecurity%e%p1%{13}%=%tebcdic%e%p1%{14}%=%tapl%e%p1%{15}%=%tmosaic%;, -- cud=\E[%p1%de, cud1=^J, cuf=\E[%p1%da, cuf1=\s, cuu1=\EM, -- ff=^L, hpa=\E[%p1%d`, ht=^I, is1=\Ec, is2=\E[20l\r, -- lpi=%?%p1%{2}%=%t\E[4z%e%p1%{3}%=%t\E[5z%e%p1%{4}%=%t\E[6z%e%p1%{6}%=%t\E[z%e%p1%{8}%=%t\E[2z%e%p1%{12}%=%t\E[3z%;, -- rshm=\E[m, -- scs=%?%p1%{0}%=%t\E(B%e%p1%{1}%=%t\E(A%e%p1%{2}%=%t\E(C%e%p1%{3}%=%t\E(D%e%p1%{4}%=%t\E(E%e%p1%{5}%=%t\E(H%e%p1%{6}%=%t\E(K%e%p1%{7}%=%t\E(R%e%p1%{8}%=%t\E(Q%e%p1%{9}%=%t\E(Y%e%p1%{10}%=%t\E(Z%e%p1%{11}%=%t\E(0%e%p1%{12}%=%t\E(1%e%p1%{13}%=%t\E(3%e%p1%{14}%=%t\E(8%e%p1%{15}%=%t\E(}%;, -- smgbp=\E[;%p1%dr, smglp=\E[%{1}%p1%+%ds, -- smgrp=\E[;%{1}%p1%+%ds, smgtp=\E[%p1%dr, sshm=\E[5m, -- u0=\E[%p1%dt, vpa=\E[%p1%dd, -+# Televideo 921 and variants -+# From: Tim Theisen <tim@cs.wisc.edu> 22 Sept 1995 -+# (tvi921: removed :ko=bt: before translation, I see no backtab cap; -+# also added empty <acsc> to suppress tic warning -- esr) -+tvi921|televideo model 921 with sysline same as page & real vi function, -+ OTbs, OTpt, am, hs, xenl, xhp, -+ cols#80, lines#24, xmc#0, -+ acsc=, clear=^Z, cnorm=\E.3, cr=^M, cub1=^H, cud1=^V, cuf1=^L, -+ cup=\E=%p1%{32}%+%c%p2%{32}%+%c$<3/>, cuu1=^K, -+ cvvis=\E.2, dch1=\EW, dl1=\ER$<1*/>, dsl=\Ef\r\Eg, ed=\EY, -+ el=\ET, fsl=\Eg, home=^^, ht=^I, ich1=\EQ, -+ if=/usr/share/tabset/stdcrt, il1=\EE, ind=^J, invis@, -+ is2=\El\E"\EF1\E.3\017\EA\E<, kbs=^H, kclr=^Z, kcub1=^H, -+ kcud1=^V, kcuf1=^L, kcuu1=^K, kdch1=\EW, kdl1=\ER$<1*/>, -+ ked=\EY, kel=\ET, kich1=\EQ, kil1=\EE, nel=^M^J, rmacs=\E%%, -+ rmir=, smacs=\E$, smir=, tsl=\Ef\EG0, use=adm+sgr, -+# without the beeper -+# (tvi92B: removed :ko=bt: before translation, I see no backtab cap; -+# also added empty <acsc> to suppress tic warning -- esr) -+tvi92B|televideo model 921 with sysline same as page & real vi function & no beeper, -+ am, hs, xenl, xhp, -+ cols#80, lines#24, xmc#0, -+ acsc=, clear=^Z, cnorm=\E.3, cr=^M, cub1=^H, cud1=^V, cuf1=^L, -+ cup=\E=%p1%{32}%+%c%p2%{32}%+%c$<3/>, cuu1=^K, -+ cvvis=\E.2, dch1=\EW, dl1=\ER$<1*/>, dsl=\Ef\r\Eg, ed=\EY, -+ el=\ET, flash=\Eb$<200/>\Ed, fsl=\Eg, home=^^, ht=^I, -+ ich1=\EQ, if=/usr/share/tabset/stdcrt, il1=\EE, ind=^J, -+ invis@, is2=\El\E"\EF1\E.3\017\EA\E<, kbs=^H, kclr=^Z, -+ kcub1=^H, kcud1=^V, kcuf1=^L, kcuu1=^K, kdch1=\EW, -+ kdl1=\ER$<1*/>, ked=\EY, kel=\ET, kich1=\EQ, kil1=\EE, -+ nel=^M^J, rmacs=\E%%, smacs=\E$, tsl=\Ef\EG0, use=adm+sgr, -+# (tvi92D: removed :ko=bt: before translation, I see no backtab cap -- esr) -+tvi92D|tvi92B with DTR instead of XON/XOFF & better padding, -+ dl1=\ER$<2*/>, il1=\EE$<2*/>, -+ is2=\El\E"\EF1\E.3\016\EA\E<, kdl1=\ER$<2*/>, -+ kil1=\EE$<2*/>, use=tvi92B, - --# Teletype 5620, firmware version 1.1 (8;7;3) or earlier from BRL --# The following SET-UP modes are assumed for normal operation: --# CR_DEF=CR NL_DEF=INDEX DUPLEX=FULL --# Other SET-UP modes may be set for operator convenience or communication --# requirements. This termcap description is for the Resident Terminal Mode. --# No delays specified; use "stty ixon -ixany" to enable DC3/DC1 flow control! --# The BRL entry also said: UNSAFE :ll=\E[70H: --att5620-1|tty5620-1|dmd1|Teletype 5620 with old ROMs, -- am, xon, -- cols#88, it#8, lines#70, vt#3, -- bel=^G, clear=\E[H\E[J, cr=^M, cub1=^H, cud1=^J, cuf1=\E[C, -- cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, dch=\E[%p1%dP, -- dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[K, -- home=\E[H, ht=^I, ich=\E[%p1%d@, ich1=\E[@, il=\E[%p1%dL, -- il1=\E[L, ind=^J, indn=\E[%p1%dS, kbs=^H, kclr=\E[2J, -- kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, khome=\E[H, -- kll=\E[70;1H, nel=^M^J, rc=\E8, ri=\E[T, rin=\E[%p1%dT, -- rs1=\Ec, sc=\E7, -+# (tvi924: This used to have <dsl=\Es0>, <fsl=\031>. I put the new strings -+# in from a BSD termcap file because it looks like they do something the -+# old ones skip -- esr) -+tvi924|televideo tvi924, -+ am, bw, hs, in, mir, msgr, xenl, xon, -+ cols#80, it#8, lines#24, wsl#80, xmc#0, -+ bel=^G, blink=\EG2, cbt=\EI, civis=\E.0, clear=\E*0, -+ cnorm=\E.3, cr=^M, csr=\E_%p1%{32}%+%c%p2%{32}%+%c, -+ cub1=^H, cud1=^V, cuf1=^L, -+ cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, cvvis=\E.1, -+ dch1=\EW, dl1=\ER, dsl=\Es0\Ef\031, ed=\Ey, el=\Et, -+ flash=\Eb$<200>\Ed, fsl=\031\Es1, home=^^, ht=^I, hts=\E1, -+ ich1=\EQ, if=/usr/share/tabset/stdcrt, il1=\EE, ind=^J, -+ invis@, is1=\017\E%\E'\E(\EDF\EC\EG0\EN0\Es0\Ev0, -+ kbs=^H, kclr=\E*0, kcub1=^H, kcud1=^V, kcuf1=^L, kcuu1=^K, -+ kdch1=\EW, kdl1=\ER, ked=\Ey, kel=\Et, kf0=^A@\r, kf1=^AA\r, -+ kf10=^AJ\r, kf11=^AK\r, kf12=^AL\r, kf13=^AM\r, kf14=^AN\r, -+ kf15=^AO\r, kf2=^AB\r, kf3=^AC\r, kf4=^AD\r, kf5=^AE\r, -+ kf6=^AF\r, kf7=^AG\r, kf8=^AH\r, kf9=^AI\r, khome=^^, -+ kich1=\EQ, kil1=\EE, lf0=F1, lf1=F2, lf10=F11, lf2=F3, lf3=F4, -+ lf4=F5, lf5=F6, lf6=F7, lf7=F8, lf8=F9, lf9=F10, -+ pfkey=\E|%p1%{49}%+%c%p2%s\031, ri=\Ej, tbc=\E3, tsl=\Ef, -+ use=adm+sgr, - --# 5620 terminfo (2.0 or later ROMS with char attributes) --# The following SET-UP modes are assumed for normal operation: --# DUPLEX=FULL GEN_FLOW=ON NEWLINE=INDEX RETURN=CR --# Other SET-UP modes may be set for operator convenience or communication --# requirements. This termcap description is for Resident Terminal Mode. No --# delays are specified; use "stty ixon -ixany" to enable DC3/DC1 flow control! --# assumptions: <ind> (scroll forward one line) is only done at screen bottom --# Be aware that older versions of the dmd have a firmware bug that affects --# parameter defaulting; for this terminal, the 0 in \E[0m is not optional. --# <msgr> is from an otherwise inferior BRL for this terminal. That entry --# also has <ll>=\E[70H commented out and marked unsafe. --# For more, see the 5620 FAQ maintained by David Breneman <daveb@dgtl.com>. --att5620|dmd|tty5620|ttydmd|5620|5620 terminal 88 columns, -- OTbs, am, msgr, npc, xon, -- cols#88, it#8, lines#70, -- bel=^G, bold=\E[2m, clear=\E[H\E[J, cr=^M, cub1=^H, -- cud1=\E[B, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, -- dch=\E[%p1%dP, dch1=\E[P, dim=\E[2m, dl=\E[%p1%dM, -- dl1=\E[M, ed=\E[J, el=\E[K, home=\E[H, ht=^I, ich=\E[%p1%d@, -- ich1=\E[@, il=\E[%p1%dL, il1=\E[L, ind=\E[S, -- indn=\E[%p1%dS, kbs=^H, kclr=\E[2J, kcub1=\E[D, kcud1=\E[B, -- kcuf1=\E[C, kcuu1=\E[A, khome=\E[H, kll=\E[70;1H, nel=^J, -- pfx=\E[%p1%d;%p2%l%dq%p2%s, rc=\E8, rev=\E[7m, ri=\E[T, -- rin=\E[%p1%dT, rmso=\E[0m, rmul=\E[0m, rs1=\Ec, sc=\E7, -- sgr0=\E[0m, smso=\E[7m, smul=\E[4m, --att5620-24|tty5620-24|dmd-24|teletype dmd 5620 in a 24x80 layer, -- lines#24, use=att5620, --att5620-34|tty5620-34|dmd-34|teletype dmd 5620 in a 34x80 layer, -- lines#34, use=att5620, --# 5620 layer running the "S" system's downloaded graphics handler: --att5620-s|tty5620-s|layer|vitty|5620 S layer, -- OTbs, OTpt, am, -- cols#80, it#8, lines#72, -- bel=^G, clear=^L, cr=^M, cub1=^H, cud1=^J, -- cup=\EY%p2%{32}%+%c%p1%{32}%+%c, cuu1=^K, dl1=\ED, -- el=\EK, flash=\E^G, ht=^I, il1=\EI, ind=^J, kbs=^H, kclr=\E[2J, -- kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, khome=\E[H, -- kll=\E[70;1H, -- --# Entries for <kf15> thru <kf28> refer to the shifted system pf keys. --# --# Entries for <kf29> thru <kf46> refer to the alternate keypad mode --# keys: = * / + 7 8 9 - 4 5 6 , 1 2 3 0 . ENTER --att605|AT&T 605 80 column 102key keyboard, -- am, eo, xon, -- cols#80, lines#24, lw#8, nlab#8, wsl#80, -- acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -- bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, clear=\E[H\E[J, -- cr=^M, cub1=^H, cud1=\E[B, cuf1=\E[C, -- cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, dch=\E[%p1%dP, -- dch1=\E[P, dim=\E[2m, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, -- el=\E[K, el1=\E[1K, fsl=\E8, ht=^I, ich=\E[%p1%d@, ich1=\E[@, -- il1=\E[L, ind=^J, invis=\E[8m, -- is1=\E[8;0|\E[?\E[13;20l\E[?\E[12h, is2=\E[m\017, -- kLFT=\E[ A, kRIT=\E[ @, kbs=^H, kcbt=\E[Z, kclr=\E[2J, -- kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[P, -- kdl1=\E[M, kend=\E[24;1H, kf1=\EOc, kf10=\ENp, kf11=\ENq, -- kf12=\ENr, kf13=\ENs, kf14=\ENt, kf15=\EOC, kf16=\EOD, -- kf17=\EOE, kf18=\EOF, kf19=\EOG, kf2=\EOd, kf20=\EOH, -- kf21=\EOI, kf22=\EOJ, kf23=\ENO, kf24=\ENP, kf25=\ENQ, -- kf26=\ENR, kf27=\ENS, kf28=\ENT, kf29=\EOP, kf3=\EOe, -- kf30=\EOQ, kf31=\EOR, kf32=\EOS, kf33=\EOw, kf34=\EOx, -- kf35=\EOy, kf36=\EOm, kf37=\EOt, kf38=\EOu, kf39=\EOv, -- kf4=\EOf, kf40=\EOl, kf41=\EOq, kf42=\EOr, kf43=\EOs, -- kf44=\EOp, kf45=\EOn, kf46=\EOM, kf5=\EOg, kf6=\EOh, -- kf7=\EOi, kf8=\EOj, kf9=\ENo, khome=\E[H, kich1=\E[@, -- kil1=\E[L, kind=\E[S, knp=\E[U, kpp=\E[V, ll=\E[24H, -- mc4=\E[?4i, mc5=\E[?5i, nel=\EE, -- pfx=\E[%p1%d;%p2%l%02dq F%p1%1d %p2%s, -- pln=\E[%p1%d;0;0;0q%p2%:-16.16s, rc=\E8, rev=\E[7m, -- rmacs=^O, rmir=\E[4l, rmln=\E[2p, rmso=\E[m, rmul=\E[m, -- rs2=\Ec\E[?3l, sc=\E7, sgr0=\E[m\017, smacs=\E)0\016, -- smir=\E[4h, smln=\E[p, smso=\E[7m, smul=\E[4m, -- tsl=\E7\E[25;%i%p1%dx, --att605-pc|ATT 605 in pc term mode, -- acsc=j\331k\277l\332m\300n\305q\304t\303u\264v\301w\302x\263, -- cbt=\E[Z, cub1=\E[D, cud1=\E[B, cuf1=\E[C, cuu1=\E[A, -- dch1=\E[P, dl1=\E[M, ich1=\E[@, il1=\E[L, kcbt=\E[Z, -- kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[P, -- kdl1=\E[M, kend=\E[F, kf1=\E[M, kf10=\E[V, kf2=\E[N, -- kf3=\E[O, kf4=\E[P, kf5=\E[Q, kf6=\E[R, kf7=\E[S, kf8=\E[T, -- kf9=\E[U, khome=\E[H, kich1=\E[@, knp=\E[G, kpp=\E[I, -- rmsc=400\E[50;0|, smsc=250\E[?11l\E[50;1|, xoffc=g, -- xonc=e, use=att605, --att605-w|AT&T 605-w 132 column 102 key keyboard, -- cols#132, wsl#132, -- is1=\E[8;0|\E[?4;5;13;15l\E[13;20l\E[?3;7h\E[12h\E(B\E)0, -- use=att605, --# (att610: I added <rmam>/<smam> based on the init string. I also --# added <indn> and <rin> because the BSD file says the att615s have them, --# and the 615 is like a 610 with a big keyboard, and most of their other --# smart terminals support the same sequence -- esr) --att610|AT&T 610; 80 column; 98key keyboard, -- am, eslok, hs, mir, msgr, xenl, xon, -- cols#80, it#8, lh#2, lines#24, lw#8, nlab#8, wsl#80, -- acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -- bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l, -- clear=\E[H\E[J, cnorm=\E[?25h\E[?12l, cr=^M, -- csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, -- cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, cuf1=\E[C, -- cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, -- cvvis=\E[?12;25h, dch=\E[%p1%dP, dch1=\E[P, dim=\E[2m, -- dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[K, el1=\E[1K, -- flash=\E[?5h$<200>\E[?5l, fsl=\E8, home=\E[H, ht=^I, -- ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[L, ind=\ED, -- indn=\E[%p1%dS, invis=\E[8m, -- is1=\E[8;0|\E[?3;4;5;13;15l\E[13;20l\E[?7h\E[12h\E(B\E)0, -- is2=\E[m\017, is3=\E(B\E)0, kLFT=\E[ @, kRIT=\E[ A, kbs=^H, -- kcbt=\E[Z, kclr=\E[2J, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, -- kcuu1=\E[A, kf1=\EOc, kf10=\ENp, kf11=\ENq, kf12=\ENr, -- kf13=\ENs, kf14=\ENt, kf2=\EOd, kf3=\EOe, kf4=\EOf, kf5=\EOg, -- kf6=\EOh, kf7=\EOi, kf8=\EOj, kf9=\ENo, khome=\E[H, -- kind=\E[S, kri=\E[T, ll=\E[24H, mc4=\E[?4i, mc5=\E[?5i, -- nel=\EE, -- pfx=\E[%p1%d;%p2%l%02dq F%p1%1d %p2%s, -- pln=\E[%p1%d;0;0;0q%p2%:-16.16s, rc=\E8, rev=\E[7m, -- ri=\EM, rin=\E[%p1%dT, rmacs=^O, rmam=\E[?7l, rmir=\E[4l, -- rmln=\E[2p, rmso=\E[m, rmul=\E[m, rs2=\Ec\E[?3l, sc=\E7, -- sgr=\E[0%?%p6%t;1%;%?%p5%t;2%;%?%p2%t;4%;%?%p4%t;5%;%?%p3%p1%|%t;7%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, -- sgr0=\E[m\017, smacs=^N, smam=\E[?7h, smir=\E[4h, -- smln=\E[p, smso=\E[7m, smul=\E[4m, tsl=\E7\E[25;%i%p1%dx, --att610-w|AT&T 610; 132 column; 98key keyboard, -- cols#132, wsl#132, -- is1=\E[8;0|\E[?4;5;13;15l\E[13;20l\E[?3;7h\E[12h, -- use=att610, -- --att610-103k|AT&T 610; 80 column; 103key keyboard, -- kBEG=\ENB, kCAN=\EOW, kCMD=\EOU, kCPY=\END, kCRT=\EON, -- kDC=\ENF, kDL=\ENE, kEND=\ENN, kEOL=\EOA, kEXT=\EOK, -- kFND=\EOX, kHLP=\EOM, kMOV=\ENC, kMSG=\EOL, kNXT=\ENH, -- kOPT=\EOR, kPRT=\EOZ, kPRV=\ENG, kRDO=\EOT, kRES=\EOQ, -- kRPL=\EOY, kSAV=\EOO, kSPD=\EOP, kUND=\EOS, kbeg=\E9, -- kcan=\EOw, kclo=\EOV, kcmd=\EOu, kcpy=\ENd, kcrt=\EOn, -- kdch1=\ENf, kdl1=\ENe, kel=\EOa, kend=\E0, kent=^M, -- kext=\EOk, kf10@, kf11@, kf12@, kf13@, kf14@, kf9@, kfnd=\EOx, -- khlp=\EOm, kich1=\ENj, kmov=\ENc, kmrk=\ENi, kmsg=\EOl, -- knp=\E[U, knxt=\ENh, kopn=\EOv, kopt=\EOr, kpp=\E[V, -- kprt=\EOz, kprv=\ENg, krdo=\EOt, kref=\EOb, kres=\EOq, -- krfr=\ENa, krmir=\ENj, krpl=\EOy, krst=\EOB, ksav=\EOo, -- kslt=\ENI, kspd=\EOp, kund=\EOs, use=att610, --att610-103k-w|AT&T 610; 132 column; 103key keyboard, -- cols#132, wsl#132, -- is1=\E[8;0|\E[?4;5;13;15l\E[13;20l\E[?3;7h\E[12h, -- use=att610-103k, --att615|AT&T 615; 80 column; 98key keyboard, -- kLFT=\E[ A, kRIT=\E[ @, kf15=\EOC, kf16=\EOD, kf17=\EOE, -- kf18=\EOF, kf19=\EOG, kf20=\EOH, kf21=\EOI, kf22=\EOJ, -- kf23=\ENO, kf24=\ENP, kf25=\ENQ, kf26=\ENR, kf27=\ENS, -- kf28=\ENT, kf29=\EOP, kf30=\EOQ, kf31=\EOR, kf32=\EOS, -- kf33=\EOw, kf34=\EOx, kf35=\EOy, kf36=\EOm, kf37=\EOt, -- kf38=\EOu, kf39=\EOv, kf40=\EOl, kf41=\EOq, kf42=\EOr, -- kf43=\EOs, kf44=\EOp, kf45=\EOn, kf46=\EOM, use=att610, --att615-w|AT&T 615; 132 column; 98key keyboard, -- kLFT=\E[ A, kRIT=\E[ @, kf15=\EOC, kf16=\EOD, kf17=\EOE, -- kf18=\EOF, kf19=\EOG, kf20=\EOH, kf21=\EOI, kf22=\EOJ, -- kf23=\ENO, kf24=\ENP, kf25=\ENQ, kf26=\ENR, kf27=\ENS, -- kf28=\ENT, kf29=\EOP, kf30=\EOQ, kf31=\EOR, kf32=\EOS, -- kf33=\EOw, kf34=\EOx, kf35=\EOy, kf36=\EOm, kf37=\EOt, -- kf38=\EOu, kf39=\EOv, kf40=\EOl, kf41=\EOq, kf42=\EOr, -- kf43=\EOs, kf44=\EOp, kf45=\EOn, kf46=\EOM, use=att610-w, --att615-103k|AT&T 615; 80 column; 103key keyboard, -- kLFT=\E[ A, kRIT=\E[ @, use=att610-103k, --att615-103k-w|AT&T 615; 132 column; 103key keyboard, -- kLFT=\E[ A, kRIT=\E[ @, use=att610-103k-w, --# (att620: I added <rmam>/<smam> based on the init string and --# <rin>/<indn> from a BSD termcap -- esr) --att620|AT&T 620; 80 column; 98key keyboard, -- am, eslok, hs, mir, msgr, xenl, xon, -- cols#80, it#8, lh#2, lines#24, lw#8, nlab#8, wsl#80, -- acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -- bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l, -- clear=\E[H\E[J, cnorm=\E[?25h\E[?12l, cr=^M, -- csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, -- cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, cuf1=\E[C, -- cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, -- cvvis=\E[?12;25h, dch=\E[%p1%dP, dch1=\E[P, dim=\E[2m, -- dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[K, el1=\E[1K, -- flash=\E[?5h$<200>\E[?5l, fsl=\E8, home=\E[H, ht=^I, -- ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[L, ind=\ED, -- indn=\E[%p1%dS, invis=\E[8m, -- is1=\E[8;0|\E[?3;4;5;13;15l\E[13;20l\E[?7h\E[12h, -- is2=\E[m\017, is3=\E(B\E)0, kLFT=\E[ A, kRIT=\E[ @, kbs=^H, -- kcbt=\E[Z, kclr=\E[2J, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, -- kcuu1=\E[A, kf1=\EOc, kf10=\ENp, kf11=\ENq, kf12=\ENr, -- kf13=\ENs, kf14=\ENt, kf15=\EOC, kf16=\EOD, kf17=\EOE, -- kf18=\EOF, kf19=\EOG, kf2=\EOd, kf20=\EOH, kf21=\EOI, -- kf22=\EOJ, kf23=\ENO, kf24=\ENP, kf25=\ENQ, kf26=\ENR, -- kf27=\ENS, kf28=\ENT, kf29=\EOP, kf3=\EOe, kf30=\EOQ, -- kf31=\EOR, kf32=\EOS, kf33=\EOw, kf34=\EOx, kf35=\EOy, -- kf36=\EOm, kf37=\EOt, kf38=\EOu, kf39=\EOv, kf4=\EOf, -- kf40=\EOl, kf41=\EOq, kf42=\EOr, kf43=\EOs, kf44=\EOp, -- kf45=\EOn, kf46=\EOM, kf5=\EOg, kf6=\EOh, kf7=\EOi, kf8=\EOj, -- kf9=\ENo, khome=\E[H, kind=\E[S, kri=\E[T, ll=\E[24H, -- mc4=\E[?4i, mc5=\E[?5i, nel=\EE, -- pfx=\E[%p1%d;%p2%l%02dq F%p1%1d %p2%s, -- pln=\E[%p1%d;0;0;0q%p2%:-16.16s, rc=\E8, rev=\E[7m, -- ri=\EM, rin=\E[%p1%dT, rmacs=\E(B\017, rmam=\E[?7l, -- rmir=\E[4l, rmln=\E[2p, rmso=\E[m, rmul=\E[m, -- rs2=\Ec\E[?3l, sc=\E7, -- sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p4%t;5%;%?%p3%p1%|%t;7%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, -- sgr0=\E[m\E(B\017, smacs=\E)0\016, smam=\E[?7h, -- smir=\E[4h, smln=\E[p, smso=\E[7m, smul=\E[4m, -- tsl=\E7\E[25;%i%p1%dx, --att620-w|AT&T 620; 132 column; 98key keyboard, -- cols#132, wsl#132, -- is1=\E[8;0|\E[?4;5;13;15l\E[13;20l\E[?3;7h\E[12h, -- use=att620, --att620-103k|AT&T 620; 80 column; 103key keyboard, -- kBEG=\ENB, kCAN=\EOW, kCMD=\EOU, kCPY=\END, kCRT=\EON, -- kDC=\ENF, kDL=\ENE, kEND=\ENN, kEOL=\EOA, kEXT=\EOK, -- kFND=\EOX, kHLP=\EOM, kMOV=\ENC, kMSG=\EOL, kNXT=\ENH, -- kOPT=\EOR, kPRT=\EOZ, kPRV=\ENG, kRDO=\EOT, kRES=\EOQ, -- kRPL=\EOY, kSAV=\EOO, kSPD=\EOP, kUND=\EOS, kbeg=\E9, -- kcan=\EOw, kclo=\EOV, kcmd=\EOu, kcpy=\ENd, kcrt=\EOn, -- kdch1=\ENf, kdl1=\ENe, kel=\EOa, kend=\E0, kent=^M, -- kext=\EOk, kf10@, kf11@, kf12@, kf13@, kf14@, kf15@, kf16@, kf17@, -- kf18@, kf19@, kf20@, kf21@, kf22@, kf23@, kf24@, kf25@, kf26@, kf27@, -- kf28@, kf29@, kf30@, kf31@, kf32@, kf33@, kf34@, kf35@, kf36@, kf37@, -- kf38@, kf39@, kf40@, kf41@, kf42@, kf43@, kf44@, kf45@, kf46@, kf9@, -- kfnd=\EOx, khlp=\EOm, kich1=\ENj, kmov=\ENc, kmrk=\ENi, -- kmsg=\EOl, knp=\E[U, knxt=\ENh, kopn=\EOv, kopt=\EOr, -- kpp=\E[V, kprt=\EOz, kprv=\ENg, krdo=\EOt, kref=\EOb, -- kres=\EOq, krfr=\ENa, krmir=\ENj, krpl=\EOy, krst=\EOB, -- ksav=\EOo, kslt=\ENI, kspd=\EOp, kund=\EOs, use=att620, -- --att620-103k-w|AT&T 620; 132 column; 103key keyboard, -- cols#132, wsl#132, -- is1=\E[8;0|\E[?4;5;13;15l\E[13;20l\E[?3;7h\E[12h, -- use=att620-103k, -- --# AT&T (formerly Teletype) 630 Multi-Tasking Graphics terminal --# The following SETUP modes are assumed for normal operation: --# Local_Echo=Off Gen_Flow=On Return=CR Received_Newline=LF --# Font_Size=Large Non-Layers_Window_Cols=80 --# Non-Layers_Window_Rows=60 --# Other SETUP modes may be set for operator convenience or communication --# requirements. Some capabilities assume a printer attached to the Aux EIA --# port. This termcap description is for the Fixed Non-Layers Window. No --# delays are specified; use "stty ixon -ixany" to enable DC3/DC1 flow control! --# (att630: added <ich1>, <blink> and <dim> from a BSD termcap file -- esr) --att630|AT&T 630 windowing terminal, -- OTbs, am, da, db, mir, msgr, npc, xon, -- cols#80, it#8, lines#60, lm#0, -- bel=^G, blink=\E[5m, cbt=\E[Z, clear=\E[H\E[J, cr=^M, -- cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=\E[B, -- cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, -- cuu=\E[%p1%dA, cuu1=\E[A, dch=\E[%p1%dP, dch1=\E[P, -- dim=\E[2m, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[K, -- el1=\E[1K, home=\E[H, ht=^I, ich=\E[%p1%d@, ich1=\E[@, -- il=\E[%p1%dL, il1=\E[L, ind=\ED, indn=\E[%p1%dS, is2=\E[m, -- kbs=^H, kcbt=\E[Z, kclr=\E[2J, kcub1=\E[D, kcud1=\E[B, -- kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[P, kdl1=\E[M, kent=^M, -- kf10=\ENp, kf11=\ENq, kf12=\ENr, kf13=\ENs, kf14=\ENt, -- kf15=\ENu, kf16=\ENv, kf17=\ENw, kf18=\ENx, kf19=\ENy, -- kf20=\ENz, kf21=\EN{, kf22=\EN|, kf23=\EN}, kf24=\EN~, -- kf9=\ENo, khome=\E[H, kich1=\E[@, kil1=\E[L, mc4=\E[?4i, -- mc5=\E[?5i, nel=^M^J, pfx=\E[%p1%d;%p2%l%dq%p2%s, rc=\E8, -- rev=\E[7m, ri=\EM, rin=\E[%p1%dT, rmir=\E[4l, rmso=\E[m, -- rmul=\E[m, rs2=\Ec, sc=\E7, -- sgr=\E[0%?%p2%t;4%;%?%p1%p3%|%p4%|%p5%|%t;7%;m, -- sgr0=\E[m, smir=\E[4h, smso=\E[7m, smul=\E[4m, --att630-24|5630-24|5630DMD-24|630MTG-24|AT&T 630 windowing terminal 24 lines, -- lines#24, use=att630, -- --# This is the att700 entry for 700 native emulation of the AT&T 700 --# terminal. Comments are relative to changes from the 605V2 entry and --# att730 on which the entry is based. Comments show the terminfo --# capability name, termcap name, and description. -+# TVI925 DIP switches. In each of these, D = Down and U = Up, - # --# Here is what's going onm in the init string: --# ESC [ 50;4| set 700 native mode (really is 605) --# x ESC [ 56;ps| set lines to 24: ps=0; 40: ps=1 (plus status line) --# ESC [ 53;0| set GenFlow to Xon/Xoff --# ESC [ 8 ;0| set CR on NL --# x ESC [ ? 3 l/h set workspace: 80 col(l); 132 col(h) --# ESC [ ? 4 l jump scroll --# ESC [ ? 5 l/h video: normal (l); reverse (h) --# ESC [ ?13 l Labels on --# ESC [ ?15 l parity check = no --# ESC [ 13 l monitor mode off --# ESC [ 20 l LF on NL (not CRLF on NL) --# ESC [ ? 7 h autowrap on --# ESC [ 12 h local echo off --# ESC ( B GO = ASCII --# ESC ) 0 G1 = Special Char & Line Drawing --# ESC [ ? 31 l Set 7 bit controls -+# Here are the settings for the external (baud) switches (S1): - # --# Note: Most terminals, especially the 600 family use Reverse Video for --# standout mode. DEC also uses reverse video. The VT100 uses bold in addition --# Assume we should stay with reverse video for 70.. However, the 605V2 exits --# standout mode with \E[m (all normal attributes). The 730 entry simply --# exits reverse video which would leave other current attributes intact. It --# was assumed the 730 entry to be more correct so rmso has changed. The --# 605V2 has no sequences to turn individual attributes off, thus its setting --# and the rmso/smso settings from the 730. -+# Position Baud -+# 7 8 9 10 [Printer] -+# 1 2 3 4 [Main RS232] -+# ----------------------------------------------------- -+# D D D D 9600 -+# D D D U 50 -+# D D U D 75 -+# D D U U 110 -+# D U D D 135 -+# D U D U 150 -+# D U U D 300 -+# D U U U 600 -+# U D D D 1200 -+# U D D U 1800 -+# U D U D 2400 -+# U D U U 3600 -+# U U D D 4800 -+# U U D U 7200 -+# U U U D 9600 -+# U U U U 19200 - # --# Note: For the same reason as above in rmso I changed exit under-score mode --# to specifically turn off underscore, rather than return to all normal --# attributes - # --# Note: The following pkey_xmit is taken from the 605V2 which contained the --# capability as pfxl. It was changed here to pfx since pfxl --# will only compile successfully with Unix 4.0 tic. Also note that pfx only --# allows strings to be parameters and label values must be programmed as --# constant strings. Supposedly the pfxl of Version 4.0 allows both labels --# and strings to be parameters. The 605V2 pfx entry should be examined later --# in this regard. For reference the 730 pfxl entry is shown here for comparison --# 730 pfx entry: --# pfxl=\E[%?%p1%{25}%<%t%p1%e%p1%{24}%-%;%d;%p2%l%02d%?%p1%{25}%<%tq\s\s\s --# SYS\s\s\s\s\sF%p1%:-2d\s\s%e;0;3q%;%p2%s, -+# Settings for word length and stop-bits (S1) - # --# (for 4.0 tic) --# pfxl=\E[%p1%d;%p2%l%02dq%?%p1%{9}%<%t F%p1%1d %;%p2%s, -+# Position Description -+# 5 6 -+# --------------------------- -+# U - 7-bit word -+# D - 8-bit word -+# - U 2 stop bits -+# - D 1 stop bit - # --# (for <4.0 tic) --# pfx=\E[%p1%d;%p2%l%02dq%?%p1%{9}%<%t F%p1%1d %;%p2%s, - # --# From the AT&T 705 Multi-tasking terminal user's guide Page 8-8,8-9 -+# S2 (external) settings - # --# Port1 Interface -+# Position Up Dn Description -+# -------------------------------------------- -+# 1 X Local edit -+# X Duplex edit (transmit editing keys) -+# -------------------------------------------- -+# 2 X 912/920 emulation -+# X 925 -+# -------------------------------------------- -+# 3 X -+# 4 X No parity -+# 5 X -+# -------------------------------------------- -+# 3 X -+# 4 X Odd parity -+# 5 X -+# -------------------------------------------- -+# 3 X -+# 4 X Even parity -+# 5 X -+# -------------------------------------------- -+# 3 X -+# 4 X Mark parity -+# 5 X -+# -------------------------------------------- -+# 3 X -+# 4 X Space parity -+# 5 X -+# -------------------------------------------- -+# 6 X White on black display -+# X Black on white display -+# -------------------------------------------- -+# 7 X Half Duplex -+# 8 X -+# -------------------------------------------- -+# 7 X Full Duplex -+# 8 X -+# -------------------------------------------- -+# 7 X Block mode -+# 8 X -+# -------------------------------------------- -+# 9 X 50 Hz -+# X 60 Hz -+# -------------------------------------------- -+# 10 X CR/LF (Auto LF) -+# X CR only - # --# modular 10 pin Connector --# Left side Right side --# Pin 1 2 3 4 5 6 7 8 9 10 -+# S3 (internal switch) settings: - # --# Key (notch) at bottom -+# Position Up Dn Description -+# -------------------------------------------- -+# 1 X Keyclick off -+# X Keyclick on -+# -------------------------------------------- -+# 2 X English -+# 3 X -+# -------------------------------------------- -+# 2 X German -+# 3 X -+# -------------------------------------------- -+# 2 X French -+# 3 X -+# -------------------------------------------- -+# 2 X Spanish -+# 3 X -+# -------------------------------------------- -+# 4 X Blinking block cursor -+# 5 X -+# -------------------------------------------- -+# 4 X Blinking underline cursor -+# 5 X -+# -------------------------------------------- -+# 4 X Steady block cursor -+# 5 X -+# -------------------------------------------- -+# 4 X Steady underline cursor -+# 5 X -+# -------------------------------------------- -+# 6 X Screen blanking timer (ON) -+# X Screen blanking timer (OFF) -+# -------------------------------------------- -+# 7 X Page attributes -+# X Line attributes -+# -------------------------------------------- -+# 8 X DCD disconnected -+# X DCD connected -+# -------------------------------------------- -+# 9 X DSR disconnected -+# X DSR connected -+# -------------------------------------------- -+# 10 X DTR Disconnected -+# X DTR connected -+# -------------------------------------------- - # --# Pin 1 DSR --# 3 DCD --# 4 DTR --# 5 Sig Ground --# 6 RD --# 7 SD --# 8 CTS --# 9 RTS --# 10 Frame Ground -+# (tvi925: BSD has <clear=\E*>. I got <is2> and <ri> from there -- esr) -+tvi925|televideo 925, -+ OTbs, am, bw, hs, ul, -+ cols#80, lines#24, xmc#1, -+ bel=^G, cbt=\EI, clear=^Z, cnorm=\E.4, cr=^M, cub1=^H, cud1=^V, -+ cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, -+ cvvis=\E.2, dch1=\EW, dl1=\ER, dsl=\Eh, ed=\EY, el=\ET, -+ flash=\Eb$<200>\Ed, fsl=^M\Eg, home=^^, ht=^I, hts=\E1, -+ ich1=\EQ, il1=\EE, ind=^J, invis@, is2=\El\E", kbs=^H, kclr=^Z, -+ kcub1=^H, kcud1=^V, kcuf1=^L, kcuu1=^K, kdch1=\EW, kdl1=\ER, -+ ked=\EY, kel=\ET, kf0=^AI\r, kf1=^A@\r, kf2=^AA\r, kf3=^AB\r, -+ kf4=^AC\r, kf5=^AD\r, kf6=^AE\r, kf7=^AF\r, kf8=^AG\r, -+ kf9=^AH\r, khome=^^, kich1=\EQ, kil1=\EE, ri=\Ej, tbc=\E3, -+ tsl=\Eh\Ef, use=adm+sgr, -+# TeleVideo 925 from Mitch Bradley <sun!wmb> via BRL -+# to avoid "magic cookie" standout glitch: -+tvi925-hi|TeleVideo Model 925 with half intensity standout mode, -+ xmc@, -+ kbs=^H, kcub1=^H, kcud1=^J, rmso=\E(, smso=\E), use=tvi925, -+ -+# From: Todd Litwin <litwin@litwin.jpl.nasa.gov> 28 May 1993 -+# Originally Tim Curry, Univ. of Central Fla., <duke!ucf-cs!tim> 5/21/82 -+# for additional capabilities, -+# The following tvi descriptions from B:pjphar and virus!mike -+# is for all 950s. It sets the following attributes: -+# full duplex (\EDF) write protect off (\E() -+# conversation mode (\EC) graphics mode off (\E%) -+# white on black (\Ed) auto page flip off (\Ew) -+# turn off status line (\Eg) clear status line (\Ef\r) -+# normal video (\E0) monitor mode off (\EX or \Eu) -+# edit mode (\Er) load blank char to space (\Ee\040) -+# line edit mode (\EO) enable buffer control (^O) -+# protect mode off (\E\047) duplex edit keys (\El) -+# program unshifted send key to send line all (\E016) -+# program shifted send key to send line unprotected (\E004) -+# set the following to nulls: -+# field delimiter (\Ex0\200\200) -+# line delimiter (\Ex1\200\200) -+# start-protected field delimiter (\Ex2\200\200) -+# end-protected field delimiter (\Ex3\200\200) -+# set end of text delimiter to carriage return/null (\Ex4\r\200) - # --# The manual is 189 pages and is loaded with details about the escape codes, --# etc..... Available from AT&T CIC 800-432-6600... --# ask for Document number 999-300-660.. -+# TVI 950 Switch Setting Reference Charts - # --att700|AT&T 700 24x80 column display w/102key keyboard, -- am, eslok, hs, mir, msgr, xenl, xon, -- cols#80, it#8, lh#2, lines#24, lw#8, nlab#8, wsl#80, -- acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -- bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l, -- clear=\E[H\E[J, cnorm=\E[?25h\E[?12l, cr=^M, -- csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, -- cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, cuf1=\E[C, -- cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, -- cvvis=\E[?12;25h, dch=\E[%p1%dP, dch1=\E[P, dim=\E[2m, -- dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[K, el1=\E[1K, -- enacs=\E(B\E)0, flash=\E[?5h$<200>\E[?5l, fln=4\,4, -- fsl=\E8, home=\E[H, ht=^I, hts=\EH, ich=\E[%p1%d@, -- il=\E[%p1%dL, il1=\E[L, ind=\ED, invis=\E[8m, -- is2=\E[50;4|\E[53;0|\E[8;0|\E[?4;13;15l\E[13;20l\E[?7h\E[12h\E(B\E)0\E[?31l\E[0m\017, -- is3=\E(B\E)0, kLFT=\E[ A, kRIT=\E[ @, kbs=^H, kcbt=\E[Z, -- kclr=\E[2J, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, -- kdch1=\E[P, kdl1=\E[M, kend=\E[24;1H, kf1=\EOc, kf10=\ENp, -- kf11=\ENq, kf12=\ENr, kf13=\ENs, kf14=\ENt, kf15=\EOC, -- kf16=\EOD, kf17=\EOE, kf18=\EOF, kf19=\EOG, kf2=\EOd, -- kf20=\EOH, kf21=\EOI, kf22=\EOJ, kf23=\ENO, kf24=\ENP, -- kf25=\ENQ, kf26=\ENR, kf27=\ENS, kf28=\ENT, kf29=\EOq, -- kf3=\EOe, kf30=\EOr, kf31=\EOs, kf32=\EOt, kf33=\EOu, -- kf34=\EOv, kf35=\EOw, kf36=\EOx, kf37=\EOy, kf38=\EOu, -- kf39=\EOv, kf4=\EOf, kf40=\EOl, kf41=\EOq, kf42=\EOr, -- kf43=\EOs, kf44=\EOp, kf45=\EOn, kf46=\EOM, kf5=\EOg, -- kf6=\EOh, kf7=\EOi, kf8=\EOj, kf9=\ENo, khome=\E[H, -- kich1=\E[@, kil1=\E[L, knp=\E[U, kpp=\E[V, ll=\E[24H, -- mc0=\E[i, mc4=\E[?4i, mc5=\E[?5i, nel=\EE, -- pfx=\E[%p1%d;%p2%l%02dq%?%p1%{9}%<%t F%p1%1d %;%p2%s, -- pln=\E[%p1%d;0;0;0q%p2%:-16.16s, rc=\E8, -- rep=%p1%c\E[%p2%{1}%-%db, rev=\E[7m, ri=\EM, rmacs=^O, -- rmir=\E[4l, rmln=\E[2p, rmso=\E[27m, rmul=\E[24m, -- rmxon=\E[53;3|, rs1=\Ec\E[?3;5l\E[56;0|, sc=\E7, -- sgr=\E[0%?%p6%t;1%;%?%p5%t;2%;%?%p2%t;4%;%?%p4%t;5%;%?%p3%p1%|%t;7%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, -- sgr0=\E[m\017, smacs=^N, smir=\E[4h, smln=\E[p, smso=\E[7m, -- smul=\E[4m, smxon=\E[53;0|, tbc=\E[3g, -- tsl=\E7\E[99;%i%p1%dx, -- --# This entry was modified 3/13/90 by JWE. --# fixes include additions of <enacs>, correcting <rep>, and modification --# of <kHOM>. (See comments below) --# att730 has status line of 80 chars --# These were commented out: <indn=\E[%p1%dS>, <rin=\E[%p1%dT>, --# the <kf25> and up keys are used for shifted system Fkeys --# NOTE: JWE 3/13/90 The 98 key keyboard translation for shift/HOME is --# currently the same as <khome> (unshifted HOME or \E[H). On the 102, 102+1 --# and 122 key keyboards, the 730's translation is \E[2J. For consistency --# <kHOM> has been commented out. The user can uncomment <kHOM> if using the --# 102, 102+1, or 122 key keyboards --# kHOM=\E[2J, --# (att730: I added <rmam>/<smam> based on the init string -- esr) --att730|AT&T 730 windowing terminal, -- am, da, db, eslok, hs, mir, msgr, npc, xenl, xon, -- cols#80, it#8, lh#2, lines#60, lm#0, lw#8, nlab#24, wsl#80, -- acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -- bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l, -- clear=\E[H\E[J, cnorm=\E[?25h\E[?12l, cr=^M, -- csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, -- cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, cuf1=\E[C, -- cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, -- cvvis=\E[?12;25h, dch=\E[%p1%dP, dch1=\E[P, dim=\E[2m, -- dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[K, el1=\E[1K, -- enacs=\E(B\E)0, flash=\E[?5h$<200>\E[?5l, fsl=\E8, -- home=\E[H, ht=^I, ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[L, -- ind=\ED, invis=\E[8m, -- is1=\E[8;0|\E[?3;4;5;13;15l\E[13;20l\E[?7h\E[12h\E(B\E)B, -- is2=\E[m\017, is3=\E(B\E)0, kLFT=\E[ @, kRIT=\E[ A, kbs=^H, -- kcbt=\E[Z, kclr=\E[2J, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, -- kcuu1=\E[A, kf1=\EOc, kf10=\ENp, kf11=\ENq, kf12=\ENr, -- kf13=\ENs, kf14=\ENt, kf15=\ENu, kf16=\ENv, kf17=\ENw, -- kf18=\ENx, kf19=\ENy, kf2=\EOd, kf20=\ENz, kf21=\EN{, -- kf22=\EN|, kf23=\EN}, kf24=\EN~, kf25=\EOC, kf26=\EOD, -- kf27=\EOE, kf28=\EOF, kf29=\EOG, kf3=\EOe, kf30=\EOH, -- kf31=\EOI, kf32=\EOJ, kf33=\ENO, kf34=\ENP, kf35=\ENQ, -- kf36=\ENR, kf37=\ENS, kf38=\ENT, kf39=\EOU, kf4=\EOf, -- kf40=\EOV, kf41=\EOW, kf42=\EOX, kf43=\EOY, kf44=\EOZ, -- kf45=\EO[, kf46=\EO\s, kf47=\EO], kf48=\EO\^, kf5=\EOg, -- kf6=\EOh, kf7=\EOi, kf8=\EOj, kf9=\ENo, khome=\E[H, -- kich1=\E[@, kil1=\E[L, kind=\E[S, kri=\E[T, -- mc0=\E[?19h\E[0i, mc4=\E[?4i, mc5=\E[?5i, nel=\EE, -- pfx=\E[%?%p1%{25}%<%t%p1%e%p1%{24}%-%;%d;%p2%l%02d%?%p1%{25}%<%tq SYS F%p1%:-2d %e;0;3q%;%p2%s, -- pfxl=\E[%p1%d;%p2%l%02d;0;0q%p3%:-16.16s%p2%s, -- pln=\E[%p1%d;0;0;0q%p2%:-16.16s, rc=\E8, -- rep=%p1%c\E[%p2%{1}%-%db, rev=\E[7m, ri=\EM, rmacs=^O, -- rmam=\E[?7l, rmir=\E[4l, rmln=\E[?13h, rmso=\E[27m, -- rmul=\E[24m, rmxon=\E[?21l, rs2=\Ec\E[?3l, sc=\E7, -- sgr=\E[0%?%p6%t;1%;%?%p5%t;2%;%?%p2%t;4%;%?%p4%t;5%;%?%p3%p1%|%t;7%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, -- sgr0=\E[m\017, smacs=^N, smam=\E[?7h, smir=\E[4h, -- smln=\E[?13l, smso=\E[7m, smul=\E[4m, smxon=\E[?21h, -- swidm=\E#6, tsl=\E7\E[;%i%p1%dx, --att730-41|730MTG-41|AT&T 730-41 windowing terminal Version, -- lines#41, use=att730, --att730-24|730MTG-24|AT&T 730-24 windowing terminal Version, -- lines#24, use=att730, --att730r|730MTGr|AT&T 730 rev video windowing terminal Version, -- flash=\E[?5l$<200>\E[?5h, -- is1=\E[8;0|\E[?3;4;13;15l\E[?5h\E[13;20l\E[?7h\E[12h\E(B\E)B, -- use=att730, --att730r-41|730MTG-41r|AT&T 730r-41 rev video windowing terminal Version, -- lines#41, use=att730r, --att730r-24|730MTGr-24|AT&T 730r-24 rev video windowing terminal Version, -- lines#24, use=att730r, -- --# The following represents the screen layout along with the associated --# bezel buttons for the 5430/pt505 terminal. The "kf" designations do --# not appear on the screen but are shown to reference the bezel buttons. --# The "CMD", "MAIL", and "REDRAW" buttons are shown in their approximate --# position relative to the screen. --# --# --# --# +----------------------------------------------------------------+ --# | | --# XXXX | kf0 kf24 | XXXX --# | | --# | | --# XXXX | kf1 kf23 | XXXX --# | | --# | | --# XXXX | kf2 kf22 | XXXX --# | | --# | | --# XXXX | kf3 kf21 | XXXX --# | | --# | | --# XXXX | kf4 kf20 | XXXX --# | | --# | | --# XXXX | kf5 kf19 | XXXX --# | | --# | | --# XXXX | kf6 kf18 | XXXX --# | | --# | | --# XXXX | | XXXX --# | | --# | | --# +----------------------------------------------------------------+ --# --# XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX --# --# Note: XXXX represents the screen buttons --# CMD REDRAW -+# TABLE 1: - # --# MAIL -+# S1 1 2 3 4 5 6 7 8 9 10 -+# +-----------------------+-----+-----+-----------------------+ -+# | Computer Baud Rate |Data |Stop | Printer Baud Rate | -+# | |Bits |Bits | | -+# +------+-----------------------+-----+-----+-----------------------+ -+# | Up | See | 7 | 2 | See | -+# +------+-----------------------+-----+-----+-----------------------+ -+# | Down | TABLE 2 | 8 | 1 | TABLE 2 | -+# +------+-----------------------+-----+-----+-----------------------+ - # --# version 1 note: --# The character string sent by key 'kf26' may be user programmable --# to send either \E[16s, or \E[26s. --# The character string sent by key 'krfr' may be user programmable --# to send either \E[17s, or \E[27s. - # --# Depression of the "CMD" key sends \E! (kcmd) --# Depression of the "MAIL" key sends \E[26s (kf26) --# "REDRAW" same as "REFRESH" (krfr) -+# S2 1 2 3 4 5 6 7 8 9 10 -+# +-----+-----+-----------------+-----+-----------+-----+-----+ -+# |Edit |Cursr| Parity |Video|Transmiss'n| Hz |Click| -+# +------+-----+-----+-----------------+-----+-----------+-----+-----+ -+# | Up | Dplx|Blink| See |GonBk| See | 60 | Off | -+# +------+-----+-----+-----------------+-----+-----------+-----+-----+ -+# | Down |Local|St'dy| TABLE 3 |BkonG| CHART | 50 | On | -+# +------+-----+-----+-----------------+-----+-----------+-----+-----+ - # --# "kf" functions adds carriage return to output string if terminal is in --# 'new line' mode. -+# TABLE 2: - # --# The following are functions not covered in the table above: -+# +-----------+-----+-----+-----+-----+-----------+ -+# | Display | 1 | 2 | 3 | 4 | Baud | -+# +-----------+-----+-----+-----+-----+ | -+# | Printer | 7 | 8 | 9 | 10 | Rate | -+# +-----------+-----+-----+-----+-----+-----------+ -+# | D | D | D | D | 9600 | -+# | U | D | D | D | 50 | -+# | D | U | D | D | 75 | -+# | U | U | D | D | 110 | -+# | D | D | U | D | 135 | -+# | U | D | U | D | 150 | -+# | D | U | U | D | 300 | -+# | U | U | U | D | 600 | -+# | D | D | D | U | 1200 | -+# | U | D | D | U | 1800 | -+# | D | U | D | U | 2400 | -+# | U | U | D | U | 3600 | -+# | D | D | U | U | 4800 | -+# | U | D | U | U | 7200 | -+# | D | U | U | U | 9600 | -+# | U | U | U | U | 19200 | -+# +-----+-----+-----+-----+-----------+ - # --# Set keyboard character (SKC): \EPn1;Pn2w --# Pn1= 0 Back Space key --# Pn1= 1 Break key --# Pn2= Program char (hex) -+# TABLE 3: -+# +-----+-----+-----+-----------+ -+# | 3 | 4 | 5 | Parity | -+# +-----+-----+-----+-----------+ -+# | X | X | D | None | -+# | D | D | U | Odd | -+# | D | U | U | Even | -+# | U | D | U | Mark | -+# | U | U | U | Space | -+# +-----+-----+-----+-----------+ -+# X = don't care - # --# Screen Definition (SDF): \E[Pn1;Pn2;Pn3;Pn4;Pn5t --# Pn1= Window number (1-39) --# Pn2-Pn5= Y;X;Y;X coordinates -+# CHART: -+# +-----+-----+-----------------+ -+# | 7 | 8 | Communication | -+# +-----+-----+-----------------+ -+# | D | D | Half Duplex | -+# | D | U | Full Duplex | -+# | U | D | Block | -+# | U | U | Local | -+# +-----+-----+-----------------+ - # --# Screen Selection (SSL): \E[Pnu --# Pn= Window number -+# (tvi950: early versions had obsolete ":ma=^Vj^Kk^Hh^Ll^^H:". -+# I also inserted <ich1> and <kich1>; the :ko: string indicated that <ich> -+# should be present and all tvi native modes use the same string for this. -+# Finally, note that BSD has cud1=^V. -- esr) -+tvi950|televideo 950, -+ OTbs, am, hs, mir, msgr, xenl, xon, -+ cols#80, it#8, lines#24, xmc#1, -+ acsc=b\011c\014d\re\ni\013, bel=^G, cbt=\EI, clear=\E*, -+ cr=^M, cub1=^H, cud1=^J, cuf1=^L, -+ cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW, -+ dl1=\ER, dsl=\Eg\Ef\r, ed=\Ey, el=\Et, flash=\Eb$<200/>\Ed, -+ fsl=^M, home=^^, ht=^I, hts=\E1, ich1=\EQ, il1=\EE, ind=^J, -+ invis@, -+ is2=\EDF\EC\Ed\EG0\Eg\Er\EO\E'\E(\E%\Ew\EX\Ee \017\011\El\E016\E004\Ex0\0\0\Ex1\0\0\Ex2\0\0\011\Ex3\0\0\Ex4\r\0\Ef\r, -+ kbs=^H, kcbt=\EI, kclr=\E*, kcub1=^H, kcud1=^V, kcuf1=^L, -+ kcuu1=^K, kdch1=\EW, kdl1=\ER, ked=\Ey, kel=\Et, kf0=^A0\r, -+ kf1=^A@\r, kf2=^AA\r, kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, -+ kf6=^AE\r, kf7=^AF\r, kf8=^AG\r, kf9=^AH\r, khome=^^, -+ kich1=\EQ, kil1=\EE, mc4=\Ea, mc5=\E`, ri=\Ej, rmacs=^X, -+ rmir=\Er, smacs=^U, smir=\Eq, tbc=\E3, tsl=\Eg\Ef, -+ use=adm+sgr, - # --# Set Terminal Modes (SM): \E[Pnh --# Pn= 3 Graphics mode --# Pn= > Cursor blink --# Pn= < Enter new line mode --# Pn= = Enter reverse insert/replace mode --# Pn= ? Enter no scroll mode -+# is for 950 with two pages adds the following: -+# set 48 line page (\E\\2) -+# place cursor at page 0, line 24, column 1 (\E-07 ) -+# set local (no send) edit keys (\Ek) - # --# Reset Terminal Mode (RM): \E[Pnl --# Pn= 3 Exit graphics mode --# Pn= > Exit cursor blink --# Pn= < Exit new line mode --# Pn= = Exit reverse insert/replace mode --# Pn= ? Exit no scroll mode -+# two page 950 adds the following: -+# when entering ex, set 24 line page (\E\\1) -+# when exiting ex, reset 48 line page (\E\\2) -+# place cursor at 0,24,1 (\E-07 ) -+# set duplex (send) edit keys (\El) when entering vi -+# set local (no send) edit keys (\Ek) when exiting vi - # --# Screen Status Report (SSR): \E[Pnp --# Pn= 0 Request current window number --# Pn= 1 Request current window dimensions -+tvi950-2p|televideo950 w/2 pages, -+ is2=\EDF\EC\Ed\EG0\Eg\Er\EO\E'\E(\E%\Ew\EX\Ee \017\011\Ek\E016\E004\Ex0\0\0\Ex1\0\0\Ex2\0\0\011\Ex3\0\0\Ex4\r\0\E\\2\E-07 \011, -+ rmcup=\E\\2\E-07\s, rmkx=\Ek, smcup=\E\\1\E-07\s, -+ smkx=\El, use=tvi950, - # --# Device Status Report (DSR): \E[6n Request cursor position -+# is for 950 with four pages adds the following: -+# set 96 line page (\E\\3) -+# place cursor at page 0, line 24, column 1 (\E-07 ) - # --# Call Status Report (CSR): \E[Pnv --# Pn= 0 Call failed --# Pn= 1 Call successful -+# four page 950 adds the following: -+# when entering ex, set 24 line page (\E\\1) -+# when exiting ex, reset 96 line page (\E\\3) -+# place cursor at 0,24,1 (\E-07 ) - # --# Transparent Button String (TBS): \E[Pn1;Pn2;Pn3;{string --# Pn1= Button number to be loaded --# Pn2= Character count of "string" --# Pn3= Key mode being loaded: --# 0= Unshifted --# 1= Shifted --# 2= Control --# String= Text string (15 chars max) -+tvi950-4p|televideo950 w/4 pages, -+ is2=\EDF\EC\Ed\EG0\Eg\Er\EO\E'\E(\E%\Ew\EX\Ee \017\011\Ek\E016\E004\Ex0\0\0\Ex1\0\0\Ex2\0\0\011\Ex3\0\0\Ex4\r\0\E\\3\E-07 \011, -+ rmcup=\E\\3\E-07\s, rmkx=\Ek, smcup=\E\\1\E-07\s, -+ smkx=\El, use=tvi950, - # --# Screen Number Report (SNR): \E[Pnp --# Pn= Screen number -+# <is2> for reverse video 950 changes the following: -+# set reverse video (\Ed) - # --# Screen Dimension Report (SDR): \E[Pn1;Pn2r --# Pn1= Number of rows available in window --# Pn2= Number of columns available in window --# --# Cursor Position Report (CPR): \E[Pn1;Pn2R --# Pn1= "Y" Position of cursor --# Pn2= "X" Position of cursor --# --# Request Answer Back (RAB): \E[c --# --# Answer Back Response (ABR): \E[?;*;30;VSV --# *= 0 No printer available --# *= 2 Printer available --# V= Software version number --# SV= Software sub version number --# (printer-available field not documented in v1) --# --# Screen Alignment Aid: \En --# --# Bell (lower pitch): \E[x --# --# Dial Phone Number: \EPdstring\ --# string= Phone number to be dialed --# --# Set Phone Labels: \EPpstring\ --# string= Label for phone buttons --# --# Set Clock: \EPchour;minute;second\ --# --# Position Clock: \EPsY;X\ --# Y= "Y" coordinate --# X= "X" coordinate --# --# Delete Clock: \Epr\ --# --# Programming The Function Buttons: \EPfPn;string\ --# Pn= Button number (00-06, 18-24) --# (kf00-kf06, kf18-kf24) --# string= Text to sent on button depression --# --# The following in version 2 only: --# --# Request For Local Directory Data: \EPp12;\ --# --# Local Directory Data to host: \EPp11;LOCAL...DIRECTORY...DATA\ --# --# Request for Local Directory Data in print format: \EPp13;\ --# --# Enable 'Prt on Line' mode: \022 (DC2) --# --# Disable 'Prt on Line' mode: \024 (DC4) -+# set vb accordingly (\Ed ...delay... \Eb) - # -+tvi950-rv|televideo950 rev video, -+ flash=\Ed$<200/>\Eb, -+ is2=\EDF\EC\Eb\EG0\Eg\Er\EO\E'\E(\E%\Ew\EX\Ee \017\011\El\E016\E004\Ex0\0\0\Ex1\0\0\Ex2\0\0\011\Ex3\0\0\Ex4\r\0, -+ use=tvi950, - --# 05-Aug-86: --# The following Terminfo entry describes functions which are supported by --# the AT&T 5430/pt505 terminal software version 2 and later. --att505|pt505|att5430|gs5430|AT&T Personal Terminal 505 or 5430 GETSET terminal, -- am, xon, -+# tvi950-rv-2p uses the appropriate entries from 950-2p and 950-rv -+tvi950-rv-2p|televideo950 rev video w/2 pages, -+ flash=\Ed$<200/>\Eb, -+ is2=\EDF\EC\Eb\EG0\Eg\Er\EO\E'\E(\E%\Ew\EX\Ee \017\011\Ek\E016\E004\Ex0\0\0\Ex1\0\0\Ex2\0\0\011\Ex3\0\0\Ex4\r\0\E\\2\E-07\s, -+ rmcup=\E\\2\E-07\s, rmkx=\Ek, smcup=\E\\1\E-07\s, -+ smkx=\El, use=tvi950, -+ -+# tvi950-rv uses the appropriate entries from 950-4p and 950-rv -+tvi950-rv-4p|televideo950 rev video w/4 pages, -+ flash=\Ed$<200/>\Eb, -+ is2=\EDF\EC\Eb\EG0\Er\EO\E'\E(\E%\Ew\EX\Ee \017\011\Ek\E016\E004\Ex0\0\0\Ex1\0\0\Ex2\0\0\011\Ex3\0\0\Ex4\r\0\E\\3\E-07\s, -+ rmcup=\E\\3\E-07\s, rmkx=\Ek, smcup=\E\\1\E-07\s, -+ smkx=\El, use=tvi950, -+# From: Andreas Stolcke <stolcke@icsi.berkeley.edu> -+# (tvi955: removed obsolete ":ma:=^Vj^Kk^Hh^Ll^^H"; -+# removed incorrect (and overridden) ":do=^J:"; fixed broken continuations in -+# the :rs: string, inserted the <ich> implied by the termcap :ko: string. Note -+# the :ko: string had :cl: in it, which means that one of the original -+# <clear=\E*>, <kclr=\EY> had to be wrong; set <kclr=\E*> because that's what -+# the 950 has. Finally, corrected the <kel> string to match the 950 and what -+# ko implies -- esr) -+# If the BSD termcap file was right, <cup=\E=%p1%{32}%+%c%p2%{32}%+%c> would -+# also work. -+tvi955|televideo 955, -+ OTbs, mc5i, msgr@, -+ it#8, xmc@, -+ acsc=0_`RjHkGlFmEnIoPqKsQtMuLvOwNxJ, blink=\EG2, -+ civis=\E.0, cnorm=\E.2, cud1=^V, cup=\E[%i%p1%d;%p2%dH, -+ cvvis=\E.1, dim=\E[=5h, ind@, invis=\EG1, -+ is2=\E[=3l\EF1\Ed\EG0\E[=5l\E%\El, kctab=\E2, khts=\E1, -+ knp=\EK, kpp=\EJ, krmir=\EQ, ktbc=\E3, mc0=\EP, rmacs=\E%%, -+ rmam=\E[=7l, rmxon=^N, -+ rs1=\EDF\EC\Eg\Er\EO\E'\E(\Ew\EX\Ee \017\E0P\E6\0\E0p\E4\0\Ef\r, -+ sgr0=\EG0\E[=5l, smacs=\E$, smam=\E[=7h, smxon=^O, -+ use=tvi950, -+tvi955-w|955-w|televideo955 w/132 cols, -+ cols#132, -+ is2=\E[=3h\EF1\Ed\EG0\E[=5l\E%\El, use=tvi955, -+# use half-intensity as normal mode, full intensity as <bold> -+tvi955-hb|955-hb|televideo955 half-bright, -+ bold=\E[=5l, dim@, is2=\E[=3l\EF1\Ed\EG0\E[=5h\E%\El, -+ sgr0=\EG0\E[=5h, use=tvi955, -+# From: Humberto Appleton <beto@cs.utexas.edu>, 880521 UT Austin -+# (tvi970: removed ":sg#0:"; removed <rmso>=\E[m, <rmul>=\E[m; -+# added <am>/<csr>/<home>/<hpa>/<vpa>/<smcup>/<rmcup> from BRL. -+# According to BRL we could have <rmkx>=\E>, <smkx>=\E= but I'm not sure what -+# it does to the function keys. I deduced <rmam>/<smam>. -+# also added empty <acsc> to suppress tic warning, -- esr) -+tvi970|televideo 970, -+ OTbs, OTpt, am, da, db, mir, msgr, - cols#80, it#8, lines#24, -- acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -- bel=^G, blink=\E[5m, bold=\E[1m, clear=\E[2J\E[H, -- cnorm=\E[>l, cr=^M, cub=\E[%p1%dD, cub1=\E[D, -- cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, cuf1=\E[C, -- cup=\E[%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, -- cvvis=\E[>h, dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, -- dl1=\E[M, ed=\E[0J, el=\E[0K, el1=\E[2K, home=\E[H, ht=^I, -- il=\E[%p1%dL, il1=\E[L, ind=^J, -- is1=\EPr\\E[0u\E[2J\E[0;0H\E[m\E[3l\E[<l\E[4l\E[>l\E[=l\E[?l, -- kbs=^H, kcmd=\E!, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, -- kcuu1=\E[A, kf0=\E[00s, kf1=\E[01s, kf18=\E[18s, -- kf19=\E[19s, kf2=\E[02s, kf20=\E[20s, kf21=\E[21s, -- kf22=\E[22s, kf23=\E[23s, kf24=\E[24s, kf26=\E[26s, -- kf3=\E[03s, kf4=\E[04s, kf5=\E[05s, kf6=\E[06s, -- krfr=\E[27s, mc4=\E[4i, mc5=\E[5i, rc=\E8, rev=\E[7m, -- rmacs=\E[10m, rmam=\E[11;1j, rmir=\E[4l, rmso=\E[m, -- rmul=\E[m, rs1=\Ec, sc=\E7, sgr0=\E[m, smacs=\E[11m, -- smam=\E[11;0j, smir=\E[4h, smso=\E[1m, smul=\E[4m, -+ acsc=, cbt=\E[Z, clear=\E[H\E[2J, csr=\E[%i%p1%d;%p2%dr, -+ cub1=^H, cud1=\ED, cuf1=\E[C, cup=\E[%i%p1%d;%p2%df, -+ cuu1=\EM, cvvis=\E[1Q, dch1=\E[P, dl1=\E[M, dsl=\Eg\Ef\r, -+ ed=\E[J, el=\E[K, flash=\E[5m$<200/>\E[m, home=\E[H, -+ hpa=\E[%i%p1%dG, ht=^I, il1=\E[L, -+ is2=\E<\E[?21l\E[19h\E[1Q\E[10l\E[7l\E[H\E[2J, -+ kbs=^H, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, -+ kf1=\E?a, kf2=\E?b, kf3=\E?c, kf4=\E?d, kf5=\E?e, kf6=\E?f, -+ kf7=\E?g, kf8=\E?h, kf9=\E?i, khome=\E[H, ri=\EM, rmacs=\E(B, -+ rmam=\E[?7h, rmcup=, rmir=\E[4l, rmso=\E[m, rmul=\E[m, -+ sgr0=\E[m, smacs=\E(B, smam=\E[?7l, -+ smcup=\E[?20l\E[?7h\E[1Q, smir=\E[4h, smso=\E[7m, -+ smul=\E[4m, vpa=\E[%i%p1%dd, -+tvi970-vb|televideo 970 with visual bell, -+ flash=\E[?5h\0\0\0\0\0\0\0\0\0\0\0\0\0\E[?5l, -+ use=tvi970, -+tvi970-2p|televideo 970 with using 2 pages of memory, -+ rmcup=\E[H\E[J\E[V, smcup=\E[U\E[?20l\E[?7h\E[1Q, -+ use=tvi970, -+# Works with vi and rogue. NOTE: Esc v sets autowrap on, Esc u sets 80 chars -+# per line (rather than 40), Esc K chooses the normal character set. Not sure -+# padding is needed, but adapted from the tvi920c termcap. The <smso> and -+# <smul> strings are klutzy, but at least use no screen space. -+# (tvipt: removed obsolete ":ma=^Kk^Ll^R^L:". I wish we knew <rmam>, -+# its absence means <smam>=\Ev isn't safe to use. -- esr) -+# From: Gene Rochlin <armsis@amber.berkeley.edu> 9/19/84. -+# The <ed>/<kf0>/<kf1>/<khome>/<mc4>, and <mc5> caps are from BRL, which says: -+# F1 and F2 should be programmed as ^A and ^B; required for UNIFY. -+tvipt|televideo personal terminal, -+ OTbs, am, -+ cols#80, lines#24, -+ cbt=\EI, clear=^Z, cub1=^H, cuf1=^L, -+ cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dl1=\ER$<5*>, -+ ed=\EY, el=\ET, home=^^, if=/usr/share/tabset/stdcrt, -+ il1=\EE$<5*>, is2=\Ev\Eu\EK, kbs=^H, kcub1=^H, kcud1=^J, -+ kcuf1=^L, kcuu1=^K, kf0=^A, kf1=^B, khome=^^, mc4=^T, mc5=^R, -+ rmso=\EF, rmul=\EF, smso=\EG1@A\EH, smul=\EG1B@\EH, -+# From: Nathan Peterson <nathan@sco.com>, 03 Sep 1996 -+tvi9065|televideo 9065, -+ am, bw, chts, hs, mc5i, mir, msgr, xenl, xon, -+ cols#80, it#8, lh#1, lines#25, lm#0, lw#9, ma#4, nlab#8, vt#0, -+ wnum#0, wsl#30, -+ acsc='r0_jhkglfmeniopqksqtmulvownxj, bel=^G, -+ blink=\EG2, bold=\EG\,, cbt=\EI, civis=\E.0, clear=^Z, -+ cnorm=\E.3, cr=^M, csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, -+ cub1=^H, cud=\E[%p1%dB, cud1=^V, cuf=\E[%p1%dC, cuf1=^L, -+ cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu=\E[%p1%dA, -+ cuu1=^K, cvvis=\E.2, dch=\E[%p1%dP, dch1=\EW, dim=\EGp, -+ dl=\E[%p1%dM, dl1=\ER, dsl=\E_30\r, ech=\E[%p1%d@, ed=\EY, -+ el=\ET, flash=\Eb$<15>\Ed, fsl=^M, home=^^, ht=^I, hts=\E1, -+ ich=\E[%p1%d@, if=/usr/share/tabset/stdcrt, -+ il=\E[%p1%dL, il1=\EE, ind=^J, indn=\E[%p1%dS, invis=\EG1, -+ ip=$<3>, -+ is1=\E"\E%\E'\E(\EG@\EO\EX\E[=5l\E[=6l\E[=7h\Ed\Er, -+ is2=\EF2\EG0\E\\L, is3=\E<\E[=4l\E[=8h, kHOM=\E\s\s\s, -+ kbs=^H, kcbt=\EI, kcub1=^H, kcud1=^V, kcuf1=^L, kcuu1=^K, -+ kdch1=\EW, kf1=^A@\r, kf10=^AI\r, kf11=^AJ\r, kf12=^AK\r, -+ kf2=^AA\r, kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, kf6=^AE\r, -+ kf7=^AF\r, kf8=^AG\r, kf9=^AH\r, khome=^^, ll=\E[25;1H, -+ mc0=\E[0;0i, mc4=\Ea, mc5=\E`, nel=^M^J, -+ pfkey=\E|%p1%{48}%+%c3%p2%s\031, -+ pfloc=\E|%p1%{48}%+%c2%p2%s\031, -+ pfx=\E|%p1%{48}%+%c1%p2%s\031, -+ pln=\E_%p1%{63}%+%c%p2%s\r, prot=\E&, -+ rep=\E[%p2%db%p1%c, rev=\EG4, -+ rf=/usr/share/tabset/stdcrt, ri=\Ej, rin=\E[%p1%dT, -+ rmacs=\E%%, rmam=\E[=7l, rmcup=\E.3\Er\E[1;25r\E[25;0H, -+ rmdc=\0, rmir=\Er, rmln=\E[4;1v, rmso=\EG0, rmul=\EG0, -+ rmxon=^N, rs1=\EC\EDF\E[0;0v\E[8;1v\E[=65l, -+ rs2=\E.b\E[10;20v\E[14;1v\E[3;0v\E[7;0v\E[=11.h\E[=12.h\E[=13.h\E[=14.h\E[=15l\E[=20h\E[=60l\E[=61h\E[=9l\E[=10l\E[=21l\E[=23l\E[=3l\E_40\E_50\En\Ew\Ee \Ex0\0\0\Ex1\0\0\Ex2\0\0\Ex3\0\0\Ex4\0\0\E1, -+ rs3=\E[=19h\E.3\E9\E0O\0\0\0\0\0\E0o\0\0\0\0\0\E0J\177\0\0\0\0, -+ sgr=\EG0%?%p1%t\EGt%;%?%p2%t\EG8%;%?%p3%t\EG4%;%?%p4%t\EG2%;%?%p5%t\EGp%;%?%p6%t\EG\,%;%?%p7%t\EG1%;%?%p8%t\E&%;%?%p9%t\E$%e\E%%%;, -+ sgr0=\EG0\E%, smacs=\E$, smam=\E=7h, smcup=\E.2, smdc=\Er, -+ smir=\Eq, smln=\E[4;2v, smso=\EGt, smul=\EG8, smxon=^O, -+ tbc=\E3, tsl=\E[4;1v\E_30, uc=\EG8\EG0, - --# The following Terminfo entry describes functions which are supported by --# the AT&T 5430/pt505 terminal software version 1. --att505-24|pt505-24|gs5430-24|AT&T PT505 or 5430 GETSET version 1 24 lines, -- lines#24, -- mc4@, mc5@, rc@, rmam@, sc@, smam@, use=att505, --tt505-22|pt505-22|gs5430-22|AT&T PT505 or 5430 GETSET version 1 22 lines, -- lines#22, use=att505, --# --#### ------------------ TERMINFO FILE CAN BE SPLIT HERE --------------------- --# This cut mark helps make life less painful for people running ncurses tic --# on machines with relatively little RAM. The file can be broken in half here --# cleanly and compiled in sections -- no `use' references cross this cut --# going forward. -+#### Visual (vi) - # -- --#### Ampex (Dialogue) -+# In September 1993, Visual Technology of Westboro, Massachusetts, -+# merged with White Pine Software of Nashua, New Hampshire. - # --# Yes, these are the same people who are better-known for making audio- and --# videotape. I'm told they are located in Redwood City, CA. -+# White Pine Software may be contacted at +1 603/886-9050. -+# Or visit White Pine on the World Wide Web at URL http://www.wpine.com. - # - --# From: <cbosg!ucbvax!SRC:george> Fri Sep 11 22:38:32 1981 --# (ampex80: some capabilities merged in from SCO's entry -- esr) --ampex80|a80|d80|dialogue|dialogue80|ampex dialogue 80, -- OTbs, am, bw, ul, -+# Visual 50 from Beau Shekita, BTL-Whippany <whuxlb!ejs> -+# Recently I hacked together the following termcap for Visual -+# Technology's Visual 50 terminal. It's a slight modification of -+# the vt52 termcap. -+# It's intended to run when the Visual 50 is in vt52 emulation mode -+# (I know what you're thinking; if it's emulating a vt52, then why -+# another termcap? Well, it turns out that the Visual 50 can handle -+# <dl1> and db(?) among other things, which the vt52 can't) -+# The termcap works OK for the most part. The only problem is on -+# character inserts. The whole line gets painfully redrawn for each -+# character typed. Any suggestions? -+# Beau's entry is combined with the vi50 entry from University of Wisconsin. -+# Note especially the <il1> function. <kf4>-<kf6> are really l4-l6 in -+# disguise; <kf7>-<kf9> are really l1-l3. -+vi50|visual 50, -+ OTbs, OTpt, am, da, db, msgr, - cols#80, it#8, lines#24, -- bel=^G, cbt=\EI, clear=\E*$<75>, cr=^M, cub1=^H, cud1=^J, -- cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, -- dch1=\EW, dl1=\ER$<5*>, ed=\Ey, el=\Et, ht=^I, hts=\E1, -- ich1=\EQ, il1=\EE$<5*>, ind=^J, is2=\EA, rmso=\Ek, rmul=\Em, -- smso=\Ej, smul=\El, tbc=\E3, --# This entry was from somebody anonymous, Tue Aug 9 20:11:37 1983, who wrote: --ampex175|ampex d175, -- am, -- cols#80, lines#24, -- bel=^G, clear=\E+, cr=^M, cub1=^H, cud1=^J, cuf1=^L, -- cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW, -- dl1=\ER, ed=\Ey, el=\Et, home=^^, ich1=\EQ, il1=\EE, ind=^J, -- is2=\EX\EA\EF, kcub1=^H, kcud1=^J, kcuf1=^L, kcuu1=^K, -- kdch1=\EW, kdl1=\ER, khome=^^, kich1=\EQ, kil1=\EE, ll=^^^K, -- rmcup=\EF, rmso=\Ek, rmul=\Em, smcup=\EN, smso=\Ej, smul=\El, --# No backspace key in the main QWERTY cluster. Fortunately, it has a --# NEWLINE/PAGE key just above RETURN that sends a strange single-character --# code. Given a suitable Unix (one that lets you set an echo-erase-as-BS-SP-BS --# mode), this key can be used as the erase key; I find I like this. Because --# some people and some systems may not, there is another termcap ("ampex175") --# that suppresses this little eccentricity by omitting the relevant capability. --ampex175-b|ampex d175 using left arrow for erase, -- kbs=^_, use=ampex175, --# From: Richard Bascove <atd!dsd!rcb@ucbvax.berkeley.edu> --# (ampex210: removed obsolete ":kn#10:" -- esr) --ampex210|a210|ampex a210, -- OTbs, am, hs, xenl, -- cols#80, it#8, lines#24, xmc#1, -- cbt=\EI, clear=\E*, cub1=^H, cuf1=^L, -- cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW, -- dl1=\ER, ed=\Ey, el=\Et, flash=\EU\EX\EU\EX\EU\EX\EU\EX, -- fsl=\E.2, home=^^, ht=^I, ich1=\EQ, -- if=/usr/share/tabset/std, il1=\EE, invis@, -- is2=\EC\Eu\E'\E(\El\EA\E%\E{\E.2\EG0\Ed\En, kcub1=^H, -- kcud1=^V, kcuf1=^L, kcuu1=^K, kf0=^A0\r, kf1=^A1\r, -- kf2=^A2\r, kf3=^A3\r, kf4=^A4\r, kf5=^A5\r, kf6=^A6\r, -- kf7=^A7\r, kf8=^A8\r, kf9=^A9\r, khome=^^, -- tsl=\E.0\Eg\E}\Ef, use=adm+sgr, --# (ampex219: I added <rmam>/<smam> based on the init string, added <cvvis> --# from ampex219w, added <cnorm>=\E[?3l, irresistibly suggested by <cvvis>, --# and moved the padding to be *after* the caps -- esr) --ampex219|ampex-219|amp219|Ampex with Automargins, -- hs, xenl, -+ OTnl=^J, bel=^G, cbt=\Ez$<4/>, clear=\EH\EJ, cr=^M, cub1=^H, -+ cud1=\EB, cuf1=\EC, cup=\EY%p1%{32}%+%c%p2%{32}%+%c, -+ cuu1=\EA, dl1=\EM$<3*/>, ed=\EJ, el=\EK$<16/>, home=\EH, -+ ht=^I, il1=\EL, ind=^J, kbs=^H, kcub1=\ED, kcud1=\EB, -+ kcuf1=\EC, kcuu1=\EA, kf1=\EP, kf2=\EQ, kf3=\ER, kf4=\EV, -+ kf5=\EE, kf6=\E], kf7=\EL, kf8=\Ev, kf9=\EM, khome=\EH, -+ nel=^M^J, ri=\EI, rmso=\ET, rmul=\EW, smso=\EU, smul=\ES, -+# this one was BSD & SCO's vi50 -+vi50adm|visual 50 in adm3a mode, -+ am, msgr, - cols#80, it#8, lines#24, -- bel=^G, blink=\E[5m$<2>, bold=\E[1m$<2>, cbt=\E[Z, -- clear=\E[H\E[2J$<50>, cnorm=\E[?3l, cr=^M, -- csr=%i\E[%p1%2d;%p2%2dr, cub1=^H, cud1=\E[B, -- cuf1=\E[C$<2>, cup=\E[%i%p1%d;%p2%dH$<5>, -- cuu1=\E[A$<2>, cvvis=\E[?3h, dim=\E[1m, ed=\E[J$<50>, -- el=\E[K$<3>, home=\E[H, ht=^I, ind=^J, -- is2=\E>\E[?1l\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, -- kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kf0=\E[21~, -- kf1=\E[7~, kf2=\E[8~, kf3=\E[9~, kf4=\E[10~, kf5=\E[11~, -- kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, khome=\E[H, -- rev=\E[7m, ri=\EM$<5>, rmam=\E[?7l, rmkx=\E>, -- rmso=\E[m$<2>, rmul=\E[m$<2>, sgr0=\E[m$<2>, smam=\E[?7h, -- smkx=\E=, smso=\E[7m$<2>, smul=\E[4m$<2>, --ampex219w|ampex-219w|amp219w|Ampex 132 cols, -- cols#132, lines#24, -- bel=^G, cr=^M, cud1=^J, ind=^J, -- is2=\E>\E[?3h\E[?4l\E[?5l\E[?7h\E[?8h, use=ampex219, --# (ampex232: removed <if=/usr/share/tabset/ampex>, no file and no <hts> --esr) --ampex232|ampex-232|Ampex Model 232, -- am, -- cols#80, lines#24, xmc#1, -- cbt=\EI, civis=\E.0, clear=\E+, cnorm=\E.4, cub1=^H, cud1=^V, -- cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, -- dch1=\EW, dl1=\ER$<5*/>, ed=\EY, el=\ET, -- flash=\Eb$<200/>\Ed, ht=^I, ich1=\EQ, il1=\EE$<5*/>, -- invis@, is2=\Eg\El, kbs=^H, kcub1=^H, kcud1=^V, kcuf1=^L, -- kcuu1=^K, kf0=^A@\r, kf1=^AA\r, kf2=^AB\r, kf3=^AC\r, -- kf4=^AD\r, kf5=^AE\r, kf6=^AF\r, kf7=^AG\r, kf8=^AH\r, -- kf9=^AI\r, khome=^^, use=adm+sgr, --# (ampex: removed <if=/usr/share/tabset/amp-132>, no file and no <hts> -- esr) --ampex232w|Ampex Model 232 / 132 columns, -- cols#132, lines#24, -- is2=\E\034Eg\El, use=ampex232, -+ bel=^G, clear=^Z, cr=^M, cub1=^H, cud1=^J, cuf1=^L, -+ cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dl1=\EM, -+ ed=\Ek, el=\EK, home=\EH, ht=^I, il1=\EL, ind=^J, kbs=^H, -+ kcub1=\ED, kcud1=\EB, kcuf1=\EC, kcuu1=\EA, khome=\EH, -+ rmso=\ET, smso=\EU, -+# From: Jeff Siegal <jbs@quiotix.com> -+vi55|Visual 55, -+ OTbs, am, mir, msgr, -+ cols#80, it#8, lines#24, -+ clear=\Ev, csr=\E_%p1%{65}%+%c%p2%{65}%+%c, cub1=^H, -+ cud1=^J, cuf1=\EC, cup=\EY%p1%{32}%+%c%p2%{32}%+%c, -+ cuu1=\EA, dch1=\Ew, dl1=\EM, ed=\EJ, el=\EK, home=\EH, ht=^I, -+ il1=\EL, is2=\Ev\E_AX\Eb\EW\E9P\ET, kbs=^H, kcub1=\ED, -+ kcud1=\EB, kcuf1=\EC, kcuu1=\EA, ri=\EI, rmir=\Eb, rmso=\ET, -+ smir=\Ea, smso=\EU, - --#### Ann Arbor (aa) --# --# Ann Arbor made dream terminals for hackers -- large screen sizes and huge --# numbers of function keys. At least some used monitors in portrait mode, --# allowing up to 76-character screen heights! They were reachable at: --# --# Ann Arbor Terminals --# 6175 Jackson Road --# Ann Arbor, MI 48103 --# (313)-663-8000 --# --# But in 1996 the phone number reaches some kitschy retail shop, and Ann Arbor --# can't be found on the Web; I fear they're long dead. R.I.P. --# -+# Visual 200 from BRL -+# The following switch settings are assumed for normal operation: -+# FULL_DUPLEX SCROLL CR -+# AUTO_NEW_LINE_ON VISUAL_200_EMULATION_MODE -+# Other switches may be set for operator convenience or communication -+# requirements. -+# Character insertion is kludged in order to get around the "beep" misfeature. -+# (This cap is commented out because <smir>/<rmir> is more efficient -- esr) -+# Supposedly "4*" delays should be used for <il1>, <ed>, <clear>, <dch1>, -+# and <dl1> strings, but we seem to get along fine without them. -+vi200|visual 200, -+ OTbs, OTpt, am, mir, msgr, -+ OTkn#10, cols#80, it#8, lines#24, -+ acsc=, bel=^G, cbt=\Ez, clear=\Ev, cnorm=\Ec, cr=^M, cub1=^H, -+ cud1=^J, cuf1=\EC, cup=\EY%p1%{32}%+%c%p2%{32}%+%c, -+ cuu1=\EA, cvvis=\Ed, dch1=\EO, dim=\E4, dl1=\EM, ed=\Ey, -+ el=\Ex, home=\EH, ht=^I, hts=\E1, il1=\EL, ind=^J, invis=\Ea, -+ kbs=^H, kclr=\Ev, kctab=\E2, kcub1=\ED, kcud1=\EB, kcuf1=\EC, -+ kcuu1=\EA, kdch1=\EO, kdl1=\EM, ked=\EJ, kel=\Et, kf0=\E?p, -+ kf1=\E?q, kf2=\E?r, kf3=\E?s, kf4=\E?t, kf5=\E?u, kf6=\E?v, -+ kf7=\E?w, kf8=\E?x, kf9=\E?y, khome=\EH, khts=\E1, kich1=\Ei, -+ kil1=\EL, krmir=\Ej, mc0=\EH\E], mc4=\EX, mc5=\EW, ri=\EI, -+ rmacs=\EG, rmkx=\E>, rmso=\E3, -+ rs1=\E3\Eb\Ej\E\El\EG\Ec\Ek\EX, sgr0=\E3\Eb, smacs=\EF, -+ smkx=\E=, smso=\E4, tbc=\Eg, -+# The older Visuals didn't come with function keys. This entry uses -+# <smkx> and <rmkx> so that the keypad keys can be used as function keys. -+# If your version of vi doesn't support function keys you may want -+# to use vi200-f. -+vi200-f|visual 200 no function keys, -+ is2=\E3\Eb\Ej\E\\\El\EG\Ed\Ek, kf0=\E?p, kf1=\E?q, -+ kf2=\E?r, kf3=\E?s, kf4=\E?t, kf5=\E?u, kf6=\E?v, kf7=\E?w, -+ kf8=\E?x, kf9=\E?y, rmkx=\E>, rmso@, smkx=\E=, smso@, -+ use=vi200, -+vi200-rv|visual 200 reverse video, -+ cnorm@, cvvis@, ri@, rmso=\E3, smso=\E4, use=vi200, - -+# the function keys are programmable but we don't reprogram them to their -+# default values with <is2> because programming them is very verbose. maybe -+# an initialization file should be made for the 300 and they could be stuck -+# in it. -+# (vi300: added <rmam>/<smam> based on init string -- esr) -+vi300|visual 300 ansi x3.64, -+ am, bw, mir, xenl, -+ cols#80, lines#24, -+ bel=^G, cbt=\E[Z, clear=\E[H\E[2J, cr=^M, cub1=^H, cud1=\E[B, -+ cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, -+ dch1=\E[P$<40>, dl1=\E[M, ed=\E[J, el=\E[K, home=\E[H, ht=^I, -+ il1=\E[L, ind=^J, -+ is2=\E[7s\E[2;3;4;20;?5;?6l\E[12;?7h\E[1Q\E[0;1(D\E[8s, -+ kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, -+ kf1=\E_A\E\\, kf2=\E_B\E\\, kf3=\E_C\E\\, kf4=\E_D\E\\, -+ kf5=\E_E\E\\, kf6=\E_F\E\\, kf7=\E_G\E\\, kf8=\E_H\E\\, -+ kf9=\E_I\E\\, khome=\E[H, ri=\EM, rmam=\E[?7l, rmir=\E[4l, -+ rmso=\E[m, rmul=\E[m, sgr0=\E[m, smam=\E[?7h, smir=\E[4h, -+ smso=\E[1m, smul=\E[4m, -+# some of the vi300s have older firmware that has the command -+# sequence for setting editing extent reversed. -+vi300-old|visual 300 with old firmware (set edit extent reversed), -+ is2=\E[7s\E[2;3;4;20;?5;?6l\E[12;?7h\E[2Q\E[0;1(D\E[8s, -+ use=vi300, - --# Originally from Mike O'Brien@Rand and Howard Katseff at Bell Labs. --# Highly modified 6/22 by Mike O'Brien. --# split out into several for the various screen sizes by dave-yost@rand --# Modifications made 3/82 by Mark Horton --# Modified by Tom Quarles at UCB for greater efficiency and more diversity --# status line moved to top of screen, <flash> removed 5/82 --# Some unknown person at SCO then hacked the init strings to make them more --# efficient. --# --# assumes the following setup: --# A menu: 0000 1010 0001 0000 --# B menu: 9600 0100 1000 0000 0000 1000 0000 17 19 --# C menu: 56 66 0 0 9600 0110 1100 --# D menu: 0110 1001 1 0 --# --# Briefly, the settings are for the following modes: --# (values are for bit set/clear with * indicating our preference --# and the value used to test these termcaps) --# Note that many of these settings are irrelevent to the terminfo --# and are just set to the default mode of the terminal as shipped --# by the factory. -+# Visual 500 prototype entry from University of Wisconsin. -+# The best place to look for the escape sequences is page A1-1 of the -+# Visual 500 manual. The initialization sequence given here may be -+# overkill, but it does leave out some of the initializations which can -+# be done with the menus in set-up mode. -+# The :xp: line below is so that emacs can understand the padding requirements -+# of this slow terminal. :xp: is 10 time the padding factor. -+# (vi500: removed unknown :xp#4: termcap; -+# also added empty <acsc> to suppress tic warning -- esr) -+vi500|visual 500, -+ am, mir, msgr, -+ cols#80, it#8, lines#33, -+ acsc=, cbt=\Ez$<4/>, clear=\Ev$<6*/>, cr=^M, -+ csr=\E(%p1%{32}%+%c%p2%{32}%+%c, cub1=^H, cud1=\EB, -+ cuf1=\EC, cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, -+ dch1=\EO$<3*/>, dl1=\EM$<3*/>, ed=\Ey$<3*/>, -+ el=\Ex$<16/>, home=\EH, ht=\011$<8/>, il1=\EL\Ex$<3*/>, -+ ind=^J, -+ is2=\E3\E\001\E\007\E\003\Ek\EG\Ed\EX\El\E>\Eb\E\\, -+ kbs=^H, kcub1=\ED, kcud1=\EB, kcuf1=\EC, kcuu1=\EA, -+ khome=\EH, nel=^M^J, rmacs=^O, rmir=\Ej, rmso=\E^G, -+ rmul=\E^C, smacs=^N, smir=\Ei, smso=\E^H, smul=\E^D, -+ -+# The visual 550 is a visual 300 with tektronix graphics, -+# and with 33 lines. clear screen is modified here to -+# also clear the graphics. -+vi550|visual 550 ansi x3.64, -+ lines#33, -+ clear=\030\E[H\E[2J, use=vi300, -+ -+vi603|visual603|visual 603, -+ hs, mir, -+ bel=^G, blink=\E[5m, bold=\E[1m, clear=\E[H\E[J, -+ csr=\E[%i%p1%d;%p2%dr, cuf1=\E[C, -+ cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, dch1=\E[P, dl1=\E[M, -+ dsl=\EP2;1~\E\\, ed=\E[J, el=\E[K, fsl=\E\\, il1=\E[L, -+ ind=\ED, is1=\E>\E[?3l\E[?4l\E[?7h\E[?8h\E[1;24r, -+ rev=\E[7m, ri=\EM, rmir=\E[4l, rmso=\E[27m, rmul=\E[24m, -+ sgr0=\E[m, smir=\E[4h, smso=\E[7m, smul=\E[4m, tsl=\EP2~, -+ use=vt100, -+ -+#### Wyse (wy) - # --# A menu: 0000 1010 0001 0000 --# Block/underline cursor* --# blinking/nonblinking cursor* --# key click/no key click* --# bell/no bell at column 72* -+# Wyse Technology -+# 3471 North First Street -+# San Jose, CA 95134 -+# Vox: (408)-473-1200 -+# Fax: (408) 473-1222 -+# Web: http://www.wyse.com - # --# key pad is cursor control*/key pad is numeric --# return and line feed/return for <cr> key * --# repeat after .5 sec*/no repeat --# repeat at 25/15 chars per sec. * -+# Wyse sales can be reached by phone at 1-800-GET-WYSE. Tech support is at -+# (800)-800-WYSE (option 5 gets you a human). There's a Web page at the -+# obvious address, <http://www.wyse.com>. They keep terminfo entries at -+# <http://www.wyse.co.uk/support/appnotes/idxappnt.htm>. - # --# hold data until pause pressed/process data unless pause pressed* --# slow scroll/no slow scroll* --# Hold in area/don't hold in area* --# functions keys have default*/function keys disabled on powerup -+# Wyse bought out Link Technology, Inc. in 1990 and closed it down in 1995. -+# They now own the Qume and Amdek brands, too. So these are the people to -+# talk with about all Link, Qume, and Amdek terminals. - # --# show/don't show position of cursor during page transmit* --# unused --# unused --# unused -+# These entries include a few small fixes. -+# I canceled the bel capacities in the vb entries. -+# I made two trivial syntax fixes in the wyse30 entry. -+# I made some entries relative to adm+sgr. - # --# B menu: 9600 0100 1000 0000 0000 1000 0000 17 19 --# Baud rate (9600*) - # --# 2 bits of parity - 00=odd,01=even*,10=space,11=mark --# 1 stop bit*/2 stop bits --# parity error detection off*/on --# --# keyboard local/on line* --# half/full duplex* --# disable/do not disable keyboard after data transmission* -+# Note: The wyse75, wyse85, and wyse99 have been discontinued. -+ -+# Although the Wyse 30 can support more than one attribute -+# it requires magic cookies to do so. Many applications do not -+# function well with magic cookies. The following terminfo uses -+# the protect mode to support one attribute (dim) without cookies. -+# If more than one attribute is needed then the wy30-mc terminfo -+# should be used. - # --# transmit entire page/stop transmission at cursor* --# transfer/do not transfer protected characters* --# transmit all characters/transmit only selected characters* --# transmit all selected areas/transmit only 1 selected area* -+wy30|wyse30|Wyse 30, -+ am, bw, hs, mc5i, mir, msgr, xon, -+ cols#80, lh#1, lines#24, lw#8, ma#1, nlab#8, wsl#45, -+ acsc=0wa_h[jukslrmqnxqzttuyv]wpxv, bel=^G, cbt=\EI, -+ civis=\E`0, clear=\E+$<80>, cnorm=\E`1, cr=^M, cub1=^H, -+ cud1=^J, cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, -+ cuu1=^K, dch1=\EW$<10>, dim=\E`7\E), dl1=\ER$<1>, -+ dsl=\EF\r, ed=\EY$<80>, el=\ET, flash=\E`8$<100/>\E`9, -+ fsl=^M, home=^^, ht=\011$<1>, hts=\E1, il1=\EE$<2>, -+ ind=\n$<2>, ip=$<2>, is2=\E'\E(\E\^3\E`9\016\024, -+ kHOM=\E{, kbs=^H, kcbt=\EI, kcub1=^H, kcud1=^J, kcuf1=^L, -+ kcuu1=^K, kdch1=\EW, kdl1=\ER, ked=\EY, kel=\ET, kent=\E7, -+ kf1=^A@\r, kf2=^AA\r, kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, -+ kf6=^AE\r, kf7=^AF\r, kf8=^AG\r, khome=^^, kich1=\EQ, -+ kil1=\EE, knp=\EK, kpp=\EJ, krpl=\Er, ll=^^^K, mc0=\EP, mc4=^T, -+ mc5=^X, nel=^M^J, pfx=\Ez%p1%{63}%+%c%p2%s\177, -+ pln=\Ez%p1%{47}%+%c%p2%s\r, prot=\E`7\E), ri=\Ej$<3>, -+ rmacs=\EH^C, rmir=\Er, rmln=\EA11, rmso=\E(, -+ sgr=%?%p1%p5%p8%|%|%t\E`7\E)%e\E(%;%?%p9%t\EH\002%e\EH\003%;, -+ sgr0=\E(\EH\003, smacs=\EH^B, smir=\Eq, smln=\EA10, -+ smso=\E`7\E), tbc=\E0, tsl=\EF, - # --# transmit/do not transmit line separators to host* --# transmit/do not transmit page tab stops tabs to host* --# transmit/do not transmit column tab stop tabs to host* --# transmit/do not transmit graphics control (underline,inverse..)* -+# This terminal description uses the non-hidden attribute mode -+# (with magic cookie). - # --# enable*/disable auto XON/XOFF control --# require/do not require receipt of a DC1 from host after each LF* --# pause key acts as a meta key/pause key is pause* --# unused -+# (wy30-mc: added <smcup> to suppress tic warning --esr) -+wy30-mc|wyse30-mc|wyse 30 with magic cookies, -+ msgr@, -+ ma@, xmc#1, -+ blink=\EG2, dim=\EGp, prot=\EG0\E), rmacs=\EG0\EH\003, -+ rmcup=\EG0, rmso=\EG0, -+ sgr=\EG%{48}%?%p2%p6%|%t%{8}%|%;%?%p1%p3%|%p6%|%t%{4}%|%;%?%p4%t%{2}%|%;%?%p1%p5%|%t%{64}%|%;%?%p7%t%{1}%|%;%c%?%p8%t\E)%e\E(%;%?%p9%t\EH\002%e\EH\003%;, -+ sgr0=\EG0\E(\EH\003, smacs=\EG0\EH\002, smcup=, -+ smso=\EG4, use=wy30, use=adm+sgr, -+# The mandatory pause used by <flash> does not work with -+# older versions of terminfo. If you see this effect then -+# unset xon and delete the / from the delay. -+# i.e. change $<100/> to $<100> -+wy30-vb|wyse30-vb|wyse 30 visible bell, -+ bel@, use=wy30, - # --# unused --# unused --# unused --# unused -+# The Wyse 50 can support one attribute (e.g. Dim, Inverse, -+# Normal) without magic cookies by using the protect mode. -+# The following description uses this feature, but when more -+# than one attribute is put on the screen at once, all attributes -+# will be changed to be the same as the last attribute given. -+# The Wyse 50 can support more attributes when used with magic -+# cookies. The wy50-mc terminal description uses magic cookies -+# to correctly handle multiple attributes on a screen. - # --# XON character (17*) --# XOFF character (19*) -+wy50|wyse50|Wyse 50, -+ am, bw, hs, mc5i, mir, msgr, xon, -+ cols#80, lh#1, lines#24, lw#8, ma#1, nlab#8, wsl#45, -+ acsc=0wa_h[jukslrmqnxqzttuyv]wpxv, bel=^G, cbt=\EI, -+ civis=\E`0, clear=\E+$<20>, cnorm=\E`1, cr=^M, cub1=^H, -+ cud1=^J, cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, -+ cuu1=^K, dch1=\EW$<1>, dim=\E`7\E), dl1=\ER, dsl=\EF\r, -+ ed=\EY$<20>, el=\ET, flash=\E`8$<100/>\E`9, fsl=^M, -+ home=^^, ht=^I, hts=\E1, il1=\EE, ind=\n$<2>, ip=$<1>, -+ is1=\E`\:\E`9$<30>, is2=\016\024\E'\E(, kHOM=\E{, kbs=^H, -+ kcbt=\EI, kcub1=^H, kcud1=^J, kcuf1=^L, kcuu1=^K, kdch1=\EW, -+ kdl1=\ER, ked=\EY, kel=\ET, kent=\E7, kf1=^A@\r, kf10=^AI\r, -+ kf11=^AJ\r, kf12=^AK\r, kf13=^AL\r, kf14=^AM\r, kf15=^AN\r, -+ kf16=^AO\r, kf2=^AA\r, kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, -+ kf6=^AE\r, kf7=^AF\r, kf8=^AG\r, kf9=^AH\r, khome=^^, -+ kich1=\EQ, kil1=\EE, knp=\EK, kpp=\EJ, kprt=\EP, krpl=\Er, -+ ll=^^^K, mc0=\EP, mc4=^T, mc5=^X, nel=^M^J, -+ pfx=\Ez%p1%{63}%+%c%p2%s\177, -+ pln=\Ez%p1%{47}%+%c%p2%s\r, prot=\E`7\E), rev=\E`6\E), -+ ri=\Ej, rmacs=\EH^C, rmir=\Er, rmln=\EA11, rmso=\E(, -+ sgr=%?%p1%p3%|%t\E`6\E)%e%p5%p8%|%t\E`7\E)%e\E(%;%?%p9%t\EH\002%e\EH\003%;, -+ sgr0=\E(\EH\003, smacs=\EH^B, smir=\Eq, smln=\EA10, -+ smso=\E`6\E), tbc=\E0, tsl=\EF, - # --# C menu: 56 66 0 0 9600 0110 1100 --# number of lines to print data on (printer) (56*) -+# This terminal description uses the non-hidden attribute mode -+# (with magic cookie). - # --# number of lines on a sheet of paper (printer) (66*) -+# The mandatory pause used by flash does not work with some -+# older versions of terminfo. If you see this effect then -+# unset <xon> and delete the / from the delay. -+# i.e. change $<100/> to $<100> -+# (wy50-mc: added <smcup> to suppress tic warning --esr) -+wy50-mc|wyse50-mc|wyse 50 with magic cookies, -+ msgr@, -+ ma@, xmc#1, -+ blink=\EG2, dim=\EGp, prot=\EG0\E), rev=\EG4, -+ rmacs=\EG0\EH\003, rmcup=\EG0, rmso=\EG0, -+ sgr=\EG%{48}%?%p2%p6%|%t%{8}%|%;%?%p1%p3%|%p6%|%t%{4}%|%;%?%p4%t%{2}%|%;%?%p1%p5%|%t%{64}%|%;%?%p7%t%{1}%|%;%c%?%p8%t\E)%e\E(%;%?%p9%t\EH\002%e\EH\003%;, -+ sgr0=\EG0\E(\EH\003, smacs=\EG0\EH\002, smcup=, -+ smso=\EGt, use=wy50, use=adm+sgr, -+wy50-vb|wyse50-vb|wyse 50 visible bell, -+ bel@, use=wy50, -+wy50-w|wyse50-w|wyse 50 132-column, -+ cols#132, lw#7, nlab#16, wsl#97, -+ cup=\Ea%i%p1%dR%p2%dC, dch1=\EW$<2>, is1=\E`;\E`9$<30>, -+ use=wy50, -+wy50-wvb|wyse50-wvb|wyse 50 132-column visible bell, -+ bel@, use=wy50-w, -+ - # --# left margin (printer) (0*) -+# The Wyse 350 is a Wyse 50 with color. -+# Unfortunately this means that it has magic cookies. -+# The color attributes are designed to overlap the reverse, dim and -+# underline attributes. This is nice for monochrome applications -+# because you can make underline stuff green (or any other color) -+# but for true color applications it's not so hot because you cannot -+# mix color with reverse, dim or underline. -+# To further complicate things one of the attributes must be -+# black (either the foreground or the background). In reverse video -+# the background changes color with black letters. In normal video -+# the foreground changes colors on a black background. -+# This terminfo uses some of the more advanced features of curses -+# to display both color and blink. In the final analysis I am not -+# sure that the wy350 runs better with this terminfo than it does -+# with the wy50 terminfo (with user adjusted colors). - # --# number of pad chars on new line to printer (0*) -+# The mandatory pause used by flash does not work with -+# older versions of terminfo. If you see this effect then -+# unset xon and delete the / from the delay. -+# i.e. change $<100/> to $<100> - # --# printer baud rate (9600*) -+# Bug: The <op> capability resets attributes. -+wy350|wyse350|Wyse 350, -+ am, bw, hs, mc5i, mir, xon, -+ colors#8, cols#80, lh#1, lines#24, lw#8, ncv#55, nlab#8, pairs#8, -+ wsl#45, xmc#1, -+ acsc=0wa_h[jukslrmqnxqzttuyv]wpxv, bel=^G, blink=\EG2, -+ cbt=\EI, civis=\E`0, clear=\E+$<20>, cnorm=\E`1, cr=^M, -+ cub1=^H, cud1=^J, cuf1=^L, -+ cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW$<1>, -+ dim=\EGp, dl1=\ER, dsl=\EF\r, ed=\EY$<20>, el=\ET, -+ flash=\E`8$<100/>\E`9, fsl=^M, home=^^, ht=^I, hts=\E1, -+ il1=\EE, ind=\n$<2>, ip=$<1>, is1=\E`\:\E`9$<30>, -+ is2=\016\024\E'\E(, is3=\E%?, kHOM=\E{, kbs=^H, kcbt=\EI, -+ kcub1=^H, kcud1=^J, kcuf1=^L, kcuu1=^K, kdch1=\EW, kdl1=\ER, -+ ked=\EY, kel=\ET, kent=\E7, kf1=^A@\r, kf10=^AI\r, -+ kf11=^AJ\r, kf12=^AK\r, kf13=^AL\r, kf14=^AM\r, kf15=^AN\r, -+ kf16=^AO\r, kf2=^AA\r, kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, -+ kf6=^AE\r, kf7=^AF\r, kf8=^AG\r, kf9=^AH\r, khome=^^, -+ kich1=\EQ, kil1=\EE, knp=\EK, kpp=\EJ, kprt=\EP, krpl=\Er, -+ ll=^^^K, mc0=\EP, mc4=^T, mc5=^X, nel=^M^J, oc=\E%?, op=\EG0, -+ pfx=\Ez%p1%{63}%+%c%p2%s\177, -+ pln=\Ez%p1%{47}%+%c%p2%s\r, prot=\EG0\E), ri=\Ej, -+ rmacs=\EG0\EH\003, rmir=\Er, rmln=\EA11, setb=, -+ setf=%?%p1%{0}%=%t%{76}%e%p1%{1}%=%t%{64}%e%p1%{2}%=%t%{8}%e%p1%{3}%=%t%{72}%e%p1%{4}%=%t%{4}%e%p1%{5}%=%t%{68}%e%p1%{6}%=%t%{12}%e%p1%{7}%=%t%{0}%;%PC\EG%gC%gA%+%{48}%+%c, -+ sgr=%{0}%?%p4%t%{2}%|%;%?%p7%t%{1}%|%;%PA\EG%?%gC%t%gC%e%{0}%?%p1%t%{4}%|%;%?%p2%t%{8}%|%;%?%p3%t%{4}%|%;%?%p5%t%{64}%|%;%;%gA%+%{48}%+%c%?%p8%t\E)%e\E(%;%?%p9%t\EH\002%e\EH\003%;, -+ sgr0=\EG0\E(\EH\003%{0}%PA%{0}%PC, smacs=\EG0\EH\002, -+ smir=\Eq, smln=\EA10, tbc=\E0, tsl=\EF, use=adm+sgr, -+wy350-vb|wyse350-vb|wyse 350 visible bell, -+ bel@, use=wy350, -+wy350-w|wyse350-w|wyse 350 132-column, -+ cols#132, lw#7, nlab#16, wsl#97, -+ cup=\Ea%i%p1%dR%p2%dC, dch1=\EW$<2>, is1=\E`;\E`9$<30>, -+ use=wy350, -+wy350-wvb|wyse350-wvb|wyse 350 132-column visible bell, -+ bel@, use=wy350-w, - # --# printer parity: 00=odd,01=even*,10=space,11=mark --# printer stop bits: 2*/1 --# print/do not print guarded areas* -+# This terminfo description is untested. -+# The wyse100 emulates an adm31, so the adm31 entry should work. - # --# new line is: 01=LF,10=CR,11=CRLF* --# unused --# unused -+wy100|wyse 100, -+ hs, mir, -+ cols#80, lines#24, xmc#1, -+ bel=^G, clear=\E;, cr=^M, cub1=^H, cud1=^J, cuf1=^L, -+ cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW, -+ dl1=\ER, dsl=\EA31, ed=\EY, el=\ET, fsl=^M, il1=\EE, ind=^J, -+ invis@, is2=\Eu\E0, kbs=^H, kcub1=^H, kcud1=^J, kcuf1=^L, -+ kcuu1=^K, kf1=^A@\r, kf2=^AA\r, kf3=^AB\r, kf4=^AC\r, -+ kf5=^AD\r, kf6=^AE\r, kf7=^AF\r, kf8=^AG\r, khome=\E{, -+ rmir=\Er, smir=\Eq, tsl=\EF, use=adm+sgr, - # --# D menu: 0110 1001 1 0 --# LF is newline/LF is down one line, same column* --# wrap to preceding line if move left from col 1*/don't wrap --# wrap to next line if move right from col 80*/don't wrap --# backspace is/is not destructive* -+# The Wyse 120/150 has most of the features of the Wyse 60. -+# This terminal does not need padding up to 9600 baud! -+# <msgr> should be set but the clear screen fails when in -+# alt-charset mode. Try \EcE\s\s\E+\s if the screen is really clear -+# then set <msgr>. - # --# display*/ignore DEL character --# display will not/will scroll* --# page/column tab stops* --# erase everything*/erase unprotected only -+wy120|wyse120|wy150|wyse150|Wyse 120/150, -+ am, bw, hs, km, mc5i, mir, msgr, xon, -+ cols#80, it#8, lh#1, lines#24, lw#8, nlab#8, pb#9601, wsl#45, -+ acsc=+/\,.0[a2fxgqh1ihjYk?lZm@nEqDtCu4vAwBx3yszr{c~~, -+ bel=^G, blink=\EG2, cbt=\EI, civis=\E`0, clear=\E+$<50>, -+ cnorm=\E`1, cr=^M, cub1=^H, cud1=^J, cuf1=^L, -+ cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW$<7>, -+ dim=\EGp, dl1=\ER$<3>, dsl=\EF\r, ed=\EY$<50>, el=\ET$<4>, -+ flash=\E`8$<100/>\E`9, fsl=^M, home=^^, ht=\011$<1>, -+ hts=\E1, il1=\EE$<3>, ind=\n$<3>, ip=$<2>, is1=\EcB0\EcC1, -+ is2=\Ed$\EcD\E'\Er\EH\003\Ed/\EO\Ee1\Ed*\E`@\E`9\E`1\016\024\El, -+ is3=\EwJ\Ew1$<150>, kHOM=\E{, kbs=^H, kcbt=\EI, kcub1=^H, -+ kcud1=^J, kcuf1=^L, kcuu1=^K, kdch1=\EW, kdl1=\ER, ked=\EY, -+ kel=\ET, kent=\E7, kf1=^A@\r, kf10=^AI\r, kf11=^AJ\r, -+ kf12=^AK\r, kf13=^AL\r, kf14=^AM\r, kf15=^AN\r, kf16=^AO\r, -+ kf2=^AA\r, kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, kf6=^AE\r, -+ kf7=^AF\r, kf8=^AG\r, kf9=^AH\r, khome=^^, kich1=\EQ, -+ kil1=\EE, knp=\EK, kpp=\EJ, kprt=\EP, krpl=\Er, ll=^^^K, -+ mc0=\EP, mc4=^T, mc5=\Ed#, nel=\r\n$<3>, -+ pfloc=\EZ2%p1%{63}%+%c%p2%s\177, -+ pfx=\EZ1%p1%{63}%+%c%p2%s\177, -+ pln=\Ez%p1%{47}%+%c%p2%s\r, prot=\E), ri=\Ej$<2>, -+ rmacs=\EcD, rmam=\Ed., rmcup=\Ew1, rmir=\Er, rmln=\EA11, -+ rmxon=\Ec20, rs1=\E~!\E~4$<30>, rs2=\EeF\E`\:$<70>, -+ rs3=\EwG\Ee($<100>, -+ sgr=%?%p8%t\E)%e\E(%;%?%p9%t\EcE%e\EcD%;\EG%{48}%?%p2%t%{8}%|%;%?%p1%p3%|%p6%|%t%{4}%|%;%?%p4%t%{2}%|%;%?%p1%p5%|%t%{64}%|%;%?%p7%t%{1}%|%;%c, -+ sgr0=\E(\EH\003\EG0\EcD, smacs=\EcE, smam=\Ed/, -+ smcup=\Ew0, smir=\Eq, smln=\EA10, smso=\EGt, smxon=\Ec21, -+ tbc=\E0, tsl=\EF, use=adm+sgr, - # --# editing extent: 0=display,1=line*,2=field,3=area -+wy120-w|wyse120-w|wy150-w|wyse150-w|wyse 120/150 132-column, -+ cols#132, lw#7, nlab#16, wsl#97, -+ cup=\Ea%i%p1%dR%p2%dC, dch1=\EW$<12>, ip=$<4>, -+ rs2=\E`;$<70>, use=wy120, - # --# unused -+wy120-25|wyse120-25|wy150-25|wyse150-25|wyse 120/150 80-column 25-lines, -+ lh@, lines#25, lw@, nlab@, -+ pln@, rs3=\EwG\Ee)$<100>, use=wy120, - # -+wy120-25-w|wyse120-25-w|wy150-25-w|wyse150-25-w|wyse 120/150 132-column 25-lines, -+ lh@, lines#25, lw@, nlab@, -+ pln@, rs3=\EwG\Ee)$<100>, use=wy120-w, -+# -+wy120-vb|wyse120-vb|wy150-vb|wyse150-vb|Wyse 120/150 visible bell, -+ bel@, use=wy120, -+# -+wy120-w-vb|wy120-wvb|wyse120-wvb|wy150-w-vb|wyse150-w-vb|Wyse 120/150 132-column visible bell, -+ bel@, use=wy120-w, -+# -+# The Wyse 60 is like the Wyse 50 but with more padding. -+# The reset strings are slow and the pad times very depending -+# on other parameters such as font loading. I have tried -+# to follow the following outline: -+# -+# <rs1> -> set personality -+# <rs2> -> set number of columns -+# <rs3> -> set number of lines -+# <is1> -> select the proper font -+# <is2> -> do the initialization -+# <is3> -> set up display memory (2 pages) -+# -+# The Wyse 60's that have vt100 emulation are slower than the -+# older Wyse 60's. This change happened mid-1987. -+# The capabilities effected are <dch1> <dl1> <il1> <ind> <ri> -+# -+# The meta key is only half right. This terminal will return the -+# high order bit set when you hit CTRL-function_key -+# -+# It may be useful to assign two function keys with the -+# values \E=(\s look at old data in page 1 -+# \E=W, look at bottom of page 1 -+# where \s is a space ( ). -+# -+# Note: -+# The Wyse 60 runs faster when the XON/XOFF -+# handshake is turned off. -+# -+# (wy60: we use \E{ rather than ^^ for home (both are documented) to avoid -+# a bug reported by Robert Dunn, <rcdii@inlink.com> -- esr) -+wy60|wyse60|Wyse 60, -+ am, bw, hs, km, mc5i, mir, msgr, -+ cols#80, lh#1, lines#24, lw#8, nlab#8, wsl#45, -+ acsc=+/\,.0[a2fxgqh1ihjYk?lZm@nEqDtCu4vAwBx3yszr{c~~, -+ bel=^G, blink=\EG2, cbt=\EI, civis=\E`0, clear=\E+$<100>, -+ cnorm=\E`1, cr=^M, cub1=^H, cud1=^J, cuf1=^L, -+ cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, -+ dch1=\EW$<11>, dclk=\E`b, dim=\EGp, dl1=\ER$<5>, dsl=\EF\r, -+ ed=\EY$<100>, el=\ET, flash=\E`8$<100/>\E`9, fsl=^M, -+ home=\E{, ht=\011$<1>, hts=\E1, il1=\EE$<4>, ind=\n$<5>, -+ ip=$<3>, is1=\EcB0\EcC1, -+ is2=\Ed$\EcD\E'\Er\EH\003\Ed/\EO\Ee1\Ed*\E`@\E`9\E`1\016\024\El, -+ is3=\EwJ\Ew1$<150>, kHOM=\E{, kbs=^H, kcbt=\EI, kcub1=^H, -+ kcud1=^J, kcuf1=^L, kcuu1=^K, kdch1=\EW, kdl1=\ER, ked=\EY, -+ kel=\ET, kent=\E7, kf1=^A@\r, kf10=^AI\r, kf11=^AJ\r, -+ kf12=^AK\r, kf13=^AL\r, kf14=^AM\r, kf15=^AN\r, kf16=^AO\r, -+ kf2=^AA\r, kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, kf6=^AE\r, -+ kf7=^AF\r, kf8=^AG\r, kf9=^AH\r, khome=^^, kich1=\EQ, -+ kil1=\EE, knp=\EK, kpp=\EJ, kprt=\EP, krpl=\Er, ll=\E{^K, -+ mc0=\EP, mc4=^T, mc5=\Ed#, nel=\r\n$<3>, -+ pfloc=\EZ2%p1%{63}%+%c%p2%s\177, -+ pfx=\EZ1%p1%{63}%+%c%p2%s\177, -+ pln=\Ez%p1%{47}%+%c%p2%s\r, prot=\E), ri=\Ej$<7>, -+ rmacs=\EcD, rmam=\Ed., rmclk=\E`c, rmcup=\Ew1, rmir=\Er, -+ rmln=\EA11, rmxon=\Ec20, rs1=\E~!\E~4$<150>, -+ rs2=\EeG$<150>, rs3=\EwG\Ee($<200>, -+ sgr=%?%p8%t\E)%e\E(%;%?%p9%t\EcE%e\EcD%;\EG%{48}%?%p2%t%{8}%|%;%?%p1%p3%|%p6%|%t%{4}%|%;%?%p4%t%{2}%|%;%?%p1%p5%|%t%{64}%|%;%?%p7%t%{1}%|%;%c, -+ sgr0=\E(\EH\003\EG0\EcD, smacs=\EcE, smam=\Ed/, -+ smcup=\Ew0, smir=\Eq, smln=\EA10, smso=\EGt, smxon=\Ec21, -+ tbc=\E0, tsl=\EF, use=adm+sgr, -+# -+wy60-w|wyse60-w|wyse 60 132-column, -+ cols#132, lw#7, nlab#16, wsl#97, -+ cup=\Ea%i%p1%dR%p2%dC, dch1=\EW$<16>, ip=$<5>, -+ rs2=\EeF$<150>\E`;$<150>, use=wy60, -+# -+wy60-25|wyse60-25|wyse 60 80-column 25-lines, -+ lh@, lines#25, lw@, nlab@, -+ pln@, rs3=\EwG\Ee)$<200>, use=wy60, -+wy60-25-w|wyse60-25-w|wyse 60 132-column 25-lines, -+ lh@, lines#25, lw@, nlab@, -+ pln@, rs3=\EwG\Ee)$<200>, use=wy60-w, -+# -+wy60-42|wyse60-42|wyse 60 80-column 42-lines, -+ lines#42, -+ clear=\E+$<260>, cup=\E=%p1%{32}%+%c%p2%{32}%+%c$<2>, -+ dch1=\EW$<16>, dl1=\ER$<11>, ed=\Ey$<260>, il1=\EE$<11>, -+ ind=\n$<9>, ip=$<5>, is1=\EcB2\EcC3, nel=\r\n$<6>, -+ ri=\Ej$<10>, rs3=\Ee*$<150>, use=wy60, -+wy60-42-w|wyse60-42-w|wyse 60 132-column 42-lines, -+ cols#132, lw#7, nlab#16, wsl#97, -+ clear=\E+$<260>, cup=\Ea%i%p1%dR%p2%dC$<2>, -+ dch1=\EW$<19>, ed=\Ey$<260>, home=\036$<2>, ip=$<6>, -+ nel=\r\n$<11>, rs2=\EeF$<150>\E`;$<150>, use=wy60-42, -+# -+wy60-43|wyse60-43|wyse 60 80-column 43-lines, -+ lh@, lines#43, lw@, nlab@, -+ pln@, rs3=\Ee+$<150>, use=wy60-42, -+wy60-43-w|wyse60-43-w|wyse 60 132-column 43-lines, -+ lh@, lines#43, lw@, nlab@, -+ pln@, rs3=\Ee+$<150>, use=wy60-42-w, -+# -+wy60-vb|wyse60-vb|Wyse 60 visible bell, -+ bel@, use=wy60, -+wy60-w-vb|wy60-wvb|wyse60-wvb|Wyse 60 132-column visible bell, -+ bel@, use=wy60-w, - --annarbor4080|aa4080|ann arbor 4080, -- OTbs, am, -- cols#80, lines#40, -- bel=^G, clear=\014$<2>, cr=^M, cub1=^H, cud1=^J, cuf1=^_, -- cup=\017%p2%{10}%/%{16}%*%p2%{10}%m%+%c%p1%?%p1%{19}%>%t%{12}%+%;%{64}%+%c, -- cuu1=^N, home=^K, ht=^I, hts=^]^P1, ind=^J, kbs=^^, kcub1=^H, -- kcud1=^J, kcuf1=^_, kcuu1=^N, khome=^K, tbc=^\^P^P, -+# The Wyse-99GT looks at lot like the Wyse 60 except that it -+# does not have the 42/43 line mode. In the Wyse-60 the "lines" -+# setup parameter controls the number of lines on the screen. -+# For the Wyse 99GT the "lines" setup parameter controls the -+# number of lines in a page. The screen can display 25 lines max. -+# The Wyse-99GT also has personalities for the VT220 and -+# Tektronix 4014. But this has no bearing on the native mode. -+# -+# (msgr) should be set but the clear screen fails when in -+# alt-charset mode. Try \EcE\s\s\E+\s if the screen is really clear -+# then set msgr, else use msgr@. -+# -+# u0 -> enter Tektronix mode -+# u1 -> exit Tektronix mode -+# -+wy99gt|wyse99gt|Wyse 99gt, -+ msgr@, -+ clear=\E+$<130>, dch1=\EW$<7>, dl1=\ER$<4>, ed=\Ey$<130>, -+ el=\Et$<5>, flash=\E`8$<100/>\E`9, ht=\011$<1>, -+ il1=\EE$<4>, ind=\n$<4>, ip=$<2>, is3=\Ew0$<20>, nel@, -+ ri=\Ej$<3>, rmcup=\Ew0, rs2=\E`\:$<150>, smcup=\Ew1, -+ u0=\E~>\E8, u1=\E[42h, use=wy60, -+# -+wy99gt-w|wyse99gt-w|wyse 99gt 132-column, -+ cols#132, lw#7, nlab#16, wsl#97, -+ clear=\E+$<160>, cup=\Ea%i%p1%dR%p2%dC$<2>, -+ dch1=\EW$<9>, ed=\Ey$<160>, ip=$<4>, rs2=\E`;$<150>, -+ use=wy99gt, -+# -+wy99gt-25|wyse99gt-25|wyse 99gt 80-column 25-lines, -+ lh@, lines#25, lw@, nlab@, -+ pln@, rs2=\E`\:$<150>, rs3=\EwG\Ee)$<200>, use=wy99gt, -+# -+wy99gt-25-w|wyse99gt-25-w|wyse 99gt 132-column 25-lines, -+ lh@, lines#25, lw@, nlab@, -+ pln@, rs2=\E`;$<150>, use=wy99gt-w, -+# -+wy99gt-vb|wyse99gt-vb|Wyse 99gt visible bell, -+ bel@, use=wy99gt, -+# -+wy99gt-w-vb|wy99gt-wvb|wyse99gt-wvb|Wyse 99gt 132-column visible bell, -+ bel@, use=wy99gt-w, - --# Strange Ann Arbor terminal from BRL --aas1901|Ann Arbor K4080 w/S1901 mod, -- am, -- cols#80, lines#40, -- bel=^G, clear=^L, cr=^M, cub1=^H, cud1=^J, cuf1=^_, cuu1=^N, -- home=^K, ht=^I, ind=^J, kbs=^H, kcub1=^H, kcud1=^J, ll=^O\0c, -- nel=^M^J, -+# Can't set tabs! Other bugs (ANSI mode only): -+# - can't redefine function keys (anyway, key redefinition in ANSI mode -+# is too much complex to be described); -+# - meta key can't be described (the terminal forgets it when reset); -+# The xon-xoff handshaking can't be disabled while in ansi personality, so -+# emacs can't work at speed greater than 9600 baud. No padding is needed at -+# this speed. -+# dch1 has been commented out because it causes annoying glittering when -+# vi deletes one character at the beginning of a line with tabs in it. -+# dch makes sysgen(1M) have a horrible behaviour when deleting -+# a screen and makes screen(1) behave badly, so it is disabled too. The nice -+# thing is that vi goes crazy if smir-rmir are present and both dch-dch1 are -+# not, so smir and rmir are commented out as well. -+# From: Francesco Potorti` <F.Potorti@cnuce.cnr.it>, 24 Aug 1998 -+wy99-ansi|Wyse WY-99GT in ansi mode (int'l PC keyboard), -+ am, km, mc5i, mir, msgr, xenl, -+ cols#80, it#8, lines#25, vt#3, -+ acsc=``aaffggjjkkllmmnnooqqssttuuvvwwxx{{||}}~~, -+ bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l, -+ clear=\E[H\E[J$<200>, cnorm=\E[34h\E[?25h, cr=^M, -+ csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD$<1>, -+ cub1=\010$<1>, cud=\E[%p1%dB, cud1=\ED, -+ cuf=\E[%p1%dC$<1>, cuf1=\E[C$<1>, -+ cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\EM, -+ cvvis=\E[34l\E[?25h, dim=\E[2m, dl=\E[%p1%dM, dl1=\E[M, -+ ech=\E[%p1%dX, ed=\E[J$<8*>, el=\E[K$<1>, el1=\E[1K$<1>, -+ enacs=\E)0, flash=\E[?5h$<30/>\E[?5l, home=\E[H, -+ hpa=\E[%i%p1%dG, ht=^I, ich=\E[%p1%d@, il=\E[%p1%dL, -+ il1=\E[L, ind=\n$<1>, invis=\E[8m, -+ is2=\E7\E[1r\E8\E[2;3;4;13;20;34;39;36l\E[12;16;34h\E[?1;3;4;5;10;18l\E[?7;8;25h\E>\E[?5W\E(B\017\E[4i, -+ kbs=^H, kcbt=\E[z, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, -+ kcuu1=\EOA, kf1=\EOP, kf10=\E[21~, kf11=\E[23~, -+ kf12=\E[24~, kf17=\E[K, kf18=\E[31~, kf19=\E[32~, kf2=\EOQ, -+ kf20=\E[33~, kf21=\E[34~, kf22=\E[35~, kf23=\E[1~, -+ kf24=\E[2~, kf3=\EOR, kf4=\EOS, kf5=\E[M, kf6=\E[17~, -+ kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, ll=\E[24E, mc0=\E[?19h, -+ mc4=\E[4i, mc5=\E[5i, nel=\EE, prot=\E[1"q, rc=\E8, -+ rev=\E[7m, ri=\EM, rmacs=^O, rmam=\E[?7l, rmir=\E[4l, -+ rmkx=\E[?1l, rmso=\E[27m, rmul=\E[24m, -+ rs2=\E[61"p\E[40h\E[?6l\E[1r\E[2;3;4;13;20;34;39;36l\E[12;16;34h\E[?1;3;4;5;10;18l\E[?7;8;25h\E>\E[?5W\E(B\017\E[24E\E[4i, -+ sc=\E7, -+ sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%O%t;7%;%?%p4%t;5%;%?%p5%t;2%;%?%p7%t;8%;m\E[%?%p8%t1%;"q%?%p9%t\016%e\017%;, -+ sgr0=\E[m\017\E["q, smacs=^N, smam=\E[?7h, smir=\E[4h, -+ smkx=\E[?1h, smso=\E[7m, smul=\E[4m, vpa=\E[%i%p1%dd, - --# If you're using the GNU termcap library, add --# :cS=\E[%p1%d;%p2%d;%p3%d;%p4%dp: --# to these capabilities. This is the nonstandard GNU termcap scrolling --# capability, arguments are: --# 1. Total number of lines on the screen. --# 2. Number of lines above desired scroll region. --# 3. Number of lines below (outside of) desired scroll region. --# 4. Total number of lines on the screen, the same as the first parameter. --# The generic Ann Arbor entry is the only one that uses this. --aaa+unk|aaa-unk|ann arbor ambassador (internal - don't use this directly), -- OTbs, am, km, mc5i, mir, xon, -- cols#80, it#8, -- bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, -- clear=\E[H\E[J$<156>, cr=^M, cub=\E[%p1%dD, cub1=^H, -- cud=\E[%p1%dB, cud1=^K, cuf=\E[%p1%dC, cuf1=\E[C, -- cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, -- dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, -- el=\E[K$<5>, home=\E[H, hpa=\E[%p1%{1}%+%dG, ht=^I, -- hts=\EH, ich=\E[%p1%d@$<4*>, ich1=\E[@$<4>, il=\E[%p1%dL, -- il1=\E[L$<3>, ind=^K, invis=\E[8m, is1=\E[m\E7\E[H\E9\E8, -- is3=\E[1Q\E[>20;30l\EP`+x~M\E\\, kbs=^H, kcbt=\E[Z, -- kclr=\E[J, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, -- kdch1=\E[P, kdl1=\E[M, kf1=\EOA, kf10=\EOJ, kf11=\EOK, -- kf12=\EOL, kf13=\EOM, kf14=\EON, kf15=\EOO, kf16=\EOP, -- kf17=\EOQ, kf18=\EOR, kf19=\EOS, kf2=\EOB, kf20=\EOT, -- kf21=\EOU, kf22=\EOV, kf23=\EOW, kf24=\EOX, kf3=\EOC, -- kf4=\EOD, kf5=\EOE, kf6=\EOF, kf7=\EOG, kf8=\EOH, kf9=\EOI, -- khome=\E[H, kich1=\E[@, kil1=\E[L, krmir=\E6, mc0=\E[0i, -- mc4=^C, mc5=\E[v, mc5p=\E[%p1%dv, rc=\E8, -- rep=%p1%c\E[%p2%{1}%-%db, rev=\E[7m, -- rmkx=\EP`>y~[[J`8xy~[[A`4xy~[[D`6xy~[[C`2xy~[[B\E\\, -- rmm=\E[>52l, rmso=\E[m, rmul=\E[m, sc=\E7, -- sgr=\E[%?%p1%t7;%;%?%p2%t4;%;%?%p3%t7;%;%?%p4%t5;%;%?%p6%t1;%;m, -- sgr0=\E[m, -- smkx=\EP`>z~[[J`8xz~[[A`4xz~[[D`6xz~[[C`2xz~[[B\E\\, -- smm=\E[>52h, smso=\E[7m, smul=\E[4m, tbc=\E[3g, -- vpa=\E[%p1%{1}%+%dd, -+# This is the american terminal. Here tabs work fine. -+# From: Francesco Potorti` <F.Potorti@cnuce.cnr.it>, 24 Aug 1998 -+wy99a-ansi|Wyse WY-99GT in ansi mode (US PC keyboard), -+ hts=\EH, is3=\E[?5l, rs3=\E[?5l, tbc=\E[3g, use=wy99-ansi, - --aaa+rv|ann arbor ambassador in reverse video, -- blink=\E[5;7m, bold=\E[1;7m, invis=\E[7;8m, -- is1=\E[7m\E7\E[H\E9\E8, rev=\E[m, rmso=\E[7m, rmul=\E[7m, -- rs1=\E[H\E[7m\E[J$<156>, -- sgr=\E[%?%p1%p3%|%!%t7;%;%?%p2%t4;%;%?%p4%t5;%;%?%p6%t1;%;%?%p7%t8;%;m, -- sgr0=\E[7m\016, smso=\E[m, smul=\E[4;7m, --# Ambassador with the DEC option, for partial vt100 compatibility. --aaa+dec|ann arbor ambassador in dec vt100 mode, -- acsc=aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}, -- csr=\E[%i%p1%d;%p2%dr, enacs=\E(0, rmacs=^N, -- sgr=\E[%?%p1%p3%|%!%t7;%;%?%p2%t4;%;%?%p4%t5;%;%?%p6%t1;%;%?%p7%t8;%;m%?%p9%t\017%e\016%;, -- smacs=^O, --aaa-18|ann arbor ambassador/18 lines, -- lines#18, -- is2=\E7\E[60;0;0;18p\E8, -- rmcup=\E[60;0;0;18p\E[60;1H\E[K, smcup=\E[18;0;0;18p, -- use=aaa+unk, --aaa-18-rv|ann arbor ambassador/18 lines+reverse video, -- use=aaa+rv, use=aaa-18, --aaa-20|ann arbor ambassador/20 lines, -- lines#20, -- is2=\E7\E[60;0;0;20p\E8, -- rmcup=\E[60;0;0;20p\E[60;1H\E[K, smcup=\E[20;0;0;20p, -- use=aaa+unk, --aaa-22|ann arbor ambassador/22 lines, -- lines#22, -- is2=\E7\E[60;0;0;22p\E8, -- rmcup=\E[60;0;0;22p\E[60;1H\E[K, smcup=\E[22;0;0;22p, -- use=aaa+unk, --aaa-24|ann arbor ambassador/24 lines, -- lines#24, -- is2=\E7\E[60;0;0;24p\E8, -- rmcup=\E[60;0;0;24p\E[60;1H\E[K, smcup=\E[24;0;0;24p, -- use=aaa+unk, --aaa-24-rv|ann arbor ambassador/24 lines+reverse video, -- use=aaa+rv, use=aaa-24, --aaa-26|ann arbor ambassador/26 lines, -- lines#26, -- is2=\E7\E[60;0;0;26p\E8, -- rmcup=\E[60;0;0;26p\E[26;1H\E[K, -- smcup=\E[H\E[J$<156>\E[26;0;0;26p, use=aaa+unk, --aaa-28|ann arbor ambassador/28 lines, -- lines#28, -- is2=\E7\E[60;0;0;28p\E8, -- rmcup=\E[60;0;0;28p\E[28;1H\E[K, -- smcup=\E[H\E[J$<156>\E[28;0;0;28p, use=aaa+unk, --aaa-30-s|aaa-s|ann arbor ambassador/30 lines w/status, -- eslok, hs, -- lines#29, -- dsl=\E7\E[60;0;0;30p\E[1;1H\E[K\E[H\E8\r\n\E[K, -- fsl=\E[>51l, is2=\r\n\E[A\E7\E[60;1;0;30p\E8, -- rmcup=\E[60;1;0;30p\E[29;1H\E[K, -- smcup=\E[H\E[J$<156>\E[30;1;0;30p\E[30;1H\E[K, -- tsl=\E[>51h\E[1;%p1%dH\E[2K, use=aaa+unk, --aaa-30-s-rv|aaa-s-rv|ann arbor ambassador/30 lines+status+reverse video, -- use=aaa+rv, use=aaa-30-s, --aaa-s-ctxt|aaa-30-s-ctxt|ann arbor ambassador/30 lines+status+save context, -- rmcup=\E[60;1;0;30p\E[59;1H\E[K, -- smcup=\E[30;1H\E[K\E[30;1;0;30p, use=aaa-30-s, --aaa-s-rv-ctxt|aaa-30-s-rv-ct|ann arbor ambassador/30 lines+status+save context+reverse video, -- rmcup=\E[60;1;0;30p\E[59;1H\E[K, -- smcup=\E[30;1H\E[K\E[30;1;0;30p, use=aaa-30-s-rv, --aaa|aaa-30|ambas|ambassador|ann arbor ambassador/30 lines, -- lines#30, -- is2=\E7\E[60;0;0;30p\E8, -- rmcup=\E[60;0;0;30p\E[30;1H\E[K, -- smcup=\E[H\E[J$<156>\E[30;0;0;30p, use=aaa+unk, --aaa-30-rv|aaa-rv|ann arbor ambassador/30 lines in reverse video, -- use=aaa+rv, use=aaa-30, --aaa-30-ctxt|aaa-ctxt|ann arbor ambassador/30 lines; saving context, -- rmcup=\E[60;0;0;30p\E[60;1H\E[K, smcup=\E[30;0;0;30p, -- use=aaa-30, --aaa-30-rv-ctxt|aaa-rv-ctxt|ann arbor ambassador/30 lines reverse video; saving context, -- rmcup=\E[60;0;0;30p\E[60;1H\E[K, smcup=\E[30;0;0;30p, -- use=aaa+rv, use=aaa-30, --aaa-36|ann arbor ambassador/36 lines, -- lines#36, -- is2=\E7\E[60;0;0;36p\E8, -- rmcup=\E[60;0;0;36p\E[36;1H\E[K, -- smcup=\E[H\E[J$<156>\E[36;0;0;36p, use=aaa+unk, --aaa-36-rv|ann arbor ambassador/36 lines+reverse video, -- use=aaa+rv, use=aaa-36, --aaa-40|ann arbor ambassador/40 lines, -- lines#40, -- is2=\E7\E[60;0;0;40p\E8, -- rmcup=\E[60;0;0;40p\E[40;1H\E[K, -- smcup=\E[H\E[J$<156>\E[40;0;0;40p, use=aaa+unk, --aaa-40-rv|ann arbor ambassador/40 lines+reverse video, -- use=aaa+rv, use=aaa-40, --aaa-48|ann arbor ambassador/48 lines, -- lines#48, -- is2=\E7\E[60;0;0;48p\E8, -- rmcup=\E[60;0;0;48p\E[48;1H\E[K, -- smcup=\E[H\E[J$<156>\E[48;0;0;48p, use=aaa+unk, --aaa-48-rv|ann arbor ambassador/48 lines+reverse video, -- use=aaa+rv, use=aaa-48, --aaa-60-s|ann arbor ambassador/59 lines+status, -- eslok, hs, -- lines#59, -- dsl=\E7\E[60;0;0;60p\E[1;1H\E[K\E[H\E8\r\n\E[K, -- fsl=\E[>51l, is2=\r\n\E[A\E7\E[60;1;0;60p\E8, -- tsl=\E[>51h\E[1;%p1%dH\E[2K, use=aaa+unk, --aaa-60-s-rv|ann arbor ambassador/59 lines+status+reverse video, -- use=aaa+rv, use=aaa-60-s, --aaa-60-dec-rv|ann arbor ambassador/dec mode+59 lines+status+rev video, -- use=aaa+dec, use=aaa+rv, use=aaa-60-s, --aaa-60|ann arbor ambassador/60 lines, -- lines#60, -- is2=\E7\E[60;0;0;60p\E[1Q\E[m\E[>20;30l\E8, -- use=aaa+unk, --aaa-60-rv|ann arbor ambassador/60 lines+reverse video, -- use=aaa+rv, use=aaa-60, --aaa-db|ann arbor ambassador 30/destructive backspace, -- OTbs@, -- cub1=\E[D, is3=\E[1Q\E[m\E[>20l\E[>30h, use=aaa-30, -+# This terminal (firmware version 02) has a lot of bugs: -+# - can't set tabs; -+# - other bugs in ANSI modes (see above). -+# This description disables handshaking when using cup. This is because -+# GNU emacs doesn't like Xon-Xoff handshaking. This means the terminal -+# cannot be used at speeds greater than 9600 baud, because at greater -+# speeds handshaking is needed even for character sending. If you use -+# DTR handshaking, you can use even greater speeds. -+# From: Francesco Potorti` <F.Potorti@cnuce.cnr.it>, 24 Aug 1998 -+wy99f|wy99fgt|wy-99fgt|Wyse WY-99GT (int'l PC keyboard), -+ am, bw, hs, km, mc5i, mir, msgr, xon, -+ cols#80, it#8, lines#25, wsl#46, -+ acsc='x+y.w_vi~j(k'l&m%n)o9q*s8t-u.v\,w+x=, bel=^G, -+ blink=\EG2, cbt=\EI, civis=\E`0, clear=\E'\E(\032, -+ cnorm=\E`4\E`1, cr=^M, cub1=^H, cud1=\Ej, cuf1=^L, -+ cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, -+ cvvis=\E`2\E`1, dch1=\EW, dim=\EGp, dl1=\ER, dsl=\EF\r, -+ ed=\EY$<8*>, el=\ET$<8>, enacs=\Ec@1J$<2000>, -+ flash=\E\^1$<30/>\E\^0, fsl=^M, home=^^, ht=^I, il1=\EE, -+ ind=^J, invis=\EG3, -+ is2=\Eu\Ee6\EC\EDF\Ec21\Ec31\Ec62\Ec72\Ee;\016\E'\EeL\E`9\E\^0\E`1\E`4\Ee.\E`\:\Ee1\EG0\E(\Ed/\Ee4\Ed*\EO\E`I\Er\Ee"\EcD\024, -+ ka1=^^, ka3=\EJ, kbs=^H, kc1=\ET, kc3=\EK, kcbt=\EI, kcub1=^H, -+ kcud1=^J, kcuf1=^L, kcuu1=^K, kf1=^A@\r, kf10=^AI\r, -+ kf11=^AJ\r, kf12=^AK\r, kf13=^A`\r, kf14=^Aa\r, kf15=^Ab\r, -+ kf16=^Ac\r, kf17=^Ad\r, kf18=^Ae\r, kf19=^Af\r, kf2=^AA\r, -+ kf20=^Ag\r, kf21=^Ah\r, kf22=^Ai\r, kf23=^Aj\r, kf24=^Ak\r, -+ kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, kf6=^AE\r, kf7=^AF\r, -+ kf8=^AG\r, kf9=^AH\r, kprt=\EP, mc0=\EP, mc4=^T, mc5=\Ed#, -+ nel=^_, prot=\E), rev=\EG4, ri=\Ej, rmacs=\EcD, rmam=\Ed., -+ rmcup=\Ec21\Ec31, rmir=\Er, rmso=\EG0, rmxon=\Ec20\Ec30, -+ rs2=\Eu\E~4\Ee6\EC\EDF\Ec21\Ec31\Ec62\Ec72\Ee;\016\E'\EeL\E`9\E\^0\E`1\E`4\Ee.\E`\:\Ee)\Ew\EwG\Ew0\Ee1\EG0\E(\Ed/\Ee4\Ed*\EO\E`I\Er\Ee"\Ec@0B\EcD\024, -+ sgr=\E(\EG%{48}%?%p1%p3%O%t%{4}%+%;%?%p2%t%{8}%+%;%?%p4%t%{2}%+%;%?%p5%t%{64}%+%;%?%p7%t%{1}%+%;%c%?%p8%t\E)%;%?%p9%t\EcE%e\EcD%;, -+ sgr0=\E(\EG0, smacs=\EcE, smam=\Ed/, smcup=\Ec20\Ec30, -+ smir=\Eq, smso=\EG4, smxon=\Ec21\Ec31, tsl=\EF, - --guru|guru-33|guru+unk|ann arbor guru/33 lines 80 cols, -- lines#33, -- flash=\E[>59h$<100>\E[>59l, -- is2=\E7\E[255;0;0;33;80;80p\E8\E[J, is3=\E[>59l, -- rmcup=\E[255p\E[255;1H\E[K, smcup=\E[33p, use=aaa+unk, --guru+rv|guru changes for reverse video, -- flash=\E[>59l$<100>\E[>59h, is3=\E[>59h, --guru-rv|guru-33-rv|ann arbor guru/33 lines+reverse video, -- use=guru+rv, use=guru-33, --guru+s|guru status line, -- eslok, hs, -- dsl=\E7\E[;0p\E[1;1H\E[K\E[H\E8\r\n\E[K, fsl=\E[>51l, -- rmcup=\E[255;1p\E[255;1H\E[K, smcup=, -- tsl=\E[>51h\E[1;%p1%dH\E[2K, --guru-nctxt|guru with no saved context, -- smcup=\E[H\E[J$<156>\E[33p\E[255;1H\E[K, use=guru, --guru-s|guru-33-s|ann arbor guru/33 lines+status, -- lines#32, -- is2=\r\n\E[A\E7\E[255;1;0;33;80;80p\E8\E[J, -- smcup=\E[33;1p\E[255;1H\E[K, use=guru+s, use=guru+unk, --guru-24|ann arbor guru 24 lines, -- cols#80, lines#24, -- is2=\E7\E[255;0;0;24;80;80p\E8\E[J, smcup=\E[24p, -- use=guru+unk, --guru-44|ann arbor guru 44 lines, -- cols#97, lines#44, -- is2=\E7\E[255;0;0;44;97;100p\E8\E[J, smcup=\E[44p, -- use=guru+unk, --guru-44-s|ann arbor guru/44 lines+status, -- lines#43, -- is2=\r\n\E[A\E7\E[255;1;0;44;80;80p\E8\E[J, -- smcup=\E[44;1p\E[255;1H\E[K, use=guru+s, use=guru+unk, --guru-76|guru with 76 lines by 89 cols, -- cols#89, lines#76, -- is2=\E7\E[255;0;0;76;89;100p\E8\E[J, smcup=\E[76p, -- use=guru+unk, --guru-76-s|ann arbor guru/76 lines+status, -- cols#89, lines#75, -- is2=\r\n\E[A\E7\E[255;1;0;76;89;100p\E8\E[J, -- smcup=\E[76;1p\E[255;1H\E[K, use=guru+s, use=guru+unk, --guru-76-lp|guru-lp|guru with page bigger than line printer, -- cols#134, lines#76, -- is2=\E7\E[255;0;0;76;134;134p\E8\E[J, smcup=\E[76p, -- use=guru+unk, --guru-76-w|guru 76 lines by 178 cols, -- cols#178, lines#76, -- is2=\E7\E[255;0;0;76;178;178p\E8\E[J, smcup=\E[76p, -- use=guru+unk, --guru-76-w-s|ann arbor guru/76 lines+status+wide, -- cols#178, lines#75, -- is2=\r\n\E[A\E7\E[255;1;0;76;178;178p\E8\E[J, -- smcup=\E[76;1p\E[255;1H\E[K, use=guru+s, use=guru+unk, --guru-76-wm|guru 76 lines by 178 cols with 255 cols memory, -- cols#178, lines#76, -- is2=\E7\E[255;0;0;76;178;255p\E8\E[J, smcup=\E[76p, -- use=guru+unk, --aaa-rv-unk|ann arbor unknown type, -- lh#0, lw#0, nlab#0, -- blink=\E[5;7m, bold=\E[1;7m, home=\E[H, invis=\E[7;8m, -- is1=\E[7m\E7\E[H\E9\E8, rev=\E[m, rmso=\E[7m, rmul=\E[7m, -- rs1=\E[H\E[7m\E[J, -- sgr=\E[%?%p1%!%t7;%;%?%p2%t4;%;%?%p3%t7;%;%?%p4%t5;%;%?%p6%t1;%;%?%p7%t8;%;m, -- sgr0=\E[7m, smso=\E[m, smul=\E[4;7m, -+# This is the american terminal. Here tabs work. -+# From: Francesco Potorti` <F.Potorti@cnuce.cnr.it>, 24 Aug 1998 -+wy99fa|wy99fgta|wy-99fgta|Wyse WY-99GT (US PC keyboard), -+ hts=\E1, tbc=\E0, use=wy99f, - --#### Applied Digital Data Systems (adds) - # --# ADDS itself is long gone. ADDS was bought by NCR, and the same group made --# ADDS and NCR terminals. When AT&T and NCR merged, the engineering for --# terminals was merged again. Then AT&T sold the terminal business to --# SunRiver, which later changed its name to Boundless Technologies. The --# engineers from Teletype, AT&T terminals, ADDS, and NCR (who are still there --# as of early 1995) are at: -+# The Wyse 160 is combination of the WY-60 and the WY-99gt. -+# The reset strings are slow and the pad times very depending -+# on other parameters such as font loading. I have tried -+# to follow the following outline: - # --# Boundless Technologies --# 100 Marcus Boulevard --# Hauppauge, NY 11788-3762 --# Vox: (800)-231-5445 --# Fax: (516)-342-7378 --# Web: http://boundless.com -+# <rs1> -> set personality -+# <rs2> -> set number of columns -+# <rs3> -> set number of lines -+# <is1> -> select the proper font -+# <is2> -> do the initialization -+# <is3> -> set up display memory (2 pages) - # --# Their voice mail used to describe the place as "SunRiver (formerly ADDS)". --# In 1995 Boundless acquired DEC's terminals business. -+# The display memory may be used for either text or graphics. -+# When "Display Memory = Shared" the terminal will have more pages -+# but garbage may be left on the screen when you switch from -+# graphics to text. If "Display Memory = Unshared" then the -+# text area will be only one page long. - # -- --# Regent: lowest common denominator, works on all regents. --# (regent: renamed ":bc:" to ":le:" -- esr) --regent|Adds Regent Series, -- OTbs, am, -- cols#80, lines#24, -- bel=^G, clear=^L, cr=^M, cub1=^U, cud1=^J, cuf1=^F, cuu1=^Z, -- home=\EY\s\s, ind=^J, ll=^A, --# Regent 100 has a bug where if computer sends escape when user is holding --# down shift key it gets confused, so we avoid escape. --regent100|Adds Regent 100, -- xmc#1, -- bel=^G, -- cup=\013%p1%' '%+%c\020%p2%{10}%/%{16}%*%p2%{10}%m%+%c, -- kf0=^B1\r, kf1=^B2\r, kf2=^B3\r, kf3=^B4\r, kf4=^B5\r, -- kf5=^B6\r, kf6=^B7\r, kf7=^B8\r, lf0=F1, lf1=F2, lf2=F3, -- lf3=F4, lf4=F5, lf5=F6, lf6=F7, lf7=F8, rmso=\E0@, rmul=\E0@, -- sgr0=\E0@, smso=\E0P, smul=\E0`, use=regent, --regent20|Adds Regent 20, -- bel=^G, cup=\EY%p1%{32}%+%c%p2%{32}%+%c, ed=\Ek, el=\EK, -- use=regent, --regent25|Adds Regent 25, -- bel=^G, kcub1=^U, kcud1=^J, kcuf1=^F, kcuu1=^Z, khome=^A, -- use=regent20, --regent40|Adds Regent 40, -- xmc#1, -- bel=^G, dl1=\El$<2*>, il1=\EM$<2*>, kf0=^B1\r, kf1=^B2\r, -- kf2=^B3\r, kf3=^B4\r, kf4=^B5\r, kf5=^B6\r, kf6=^B7\r, -- kf7=^B8\r, lf0=F1, lf1=F2, lf2=F3, lf3=F4, lf4=F5, lf5=F6, -- lf6=F7, lf7=F8, rmso=\E0@, rmul=\E0@, sgr0=\E0@, smso=\E0P, -- smul=\E0`, use=regent25, --regent40+|Adds Regent 40+, -- is2=\EB, use=regent40, --regent60|regent200|Adds Regent 60, -- dch1=\EE, is2=\EV\EB, kdch1=\EE, kich1=\EF, krmir=\EF, -- rmir=\EF, rmso=\ER\E0@\EV, smir=\EF, smso=\ER\E0P\EV, -- use=regent40+, --# From: <edward@onyx.berkeley.edu> Thu Jul 9 09:27:33 1981 --# (viewpoint: added <kcuf1>, function key, and <dl1> capabilities -- esr) --viewpoint|addsviewpoint|adds viewpoint, -- OTbs, am, -- cols#80, lines#24, -- bel=^G, clear=^L, cnorm=\017\E0`, cr=^M, cub1=^H, cud1=^J, -- cuf1=^F, cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=^Z, -- cvvis=\017\E0P, dl1=\El, ed=\Ek$<16.1*>, el=\EK$<16>, -- ind=^J, is2=\017\E0`, kcub1=^U, kcud1=^J, kcuf1=^F, kcuu1=^Z, -- kf0=^B1, kf2=^B2, kf3=^B!, kf4=^B", kf5=^B#, khome=^A, ll=^A, -- rmso=^O, rmul=^O, sgr0=^O, smso=^N, smul=^N, --# Some viewpoints have bad ROMs that foo up on ^O --screwpoint|adds viewpoint with ^O bug, -- cvvis@, rmso@, rmul@, smso@, smul@, use=viewpoint, -- --# From: Jay S. Rouman <jsr@dexter.mi.org> 5 Jul 92 --# The <civis>/<cnorm>/<sgr>/<sgr0> strings were added by ESR from specs. --# Theory; the vp3a+ wants \E0%c to set highlights, where normal=01000000, --# underline=01100000, rev=01010000, blink=01000010,dim=01000001, --# invis=01000100 and %c is the logical or of desired attributes. --# There is also a `tag bit' enabling attributes, set by \E) and unset by \E(. -+# (wy160: we use \E{ rather than ^^ for home (both are documented) to avoid -+# a bug reported by Robert Dunn, <rcdii@inlink.com> -- esr) -+wy160|wyse160|Wyse 160, -+ am, bw, hs, km, mc5i, mir, msgr, -+ cols#80, lh#1, lines#24, lw#8, nlab#8, wsl#38, -+ acsc=+/\,.0[a2fxgqh1ihjYk?lZm@nEqDtCu4vAwBx3yszr{c~~, -+ bel=^G, blink=\EG2, cbt=\EI, civis=\E`0, clear=\E+$<30>, -+ cnorm=\E`1, cr=^M, cub1=^H, cud1=^J, cuf1=^L, -+ cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW$<5>, -+ dclk=\E`b, dim=\EGp, dl1=\ER$<1>, dsl=\EF\r, ed=\EY$<30>, -+ el=\ET$<5>, flash=\E`8$<100/>\E`9, fsl=^M, home=\E{, ht=^I, -+ hts=\E1, il1=\EE$<1>, ind=\n$<1>, ip=$<2>, is1=\EcB0\EcC1, -+ is2=\Ed$\EcD\E'\Er\EH\003\Ed/\EO\Ee1\Ed*\E`@\E`9\E`1\016\024\El, -+ is3=\Ew0$<100>, kHOM=\E{, kbs=^H, kcbt=\EI, kcub1=^H, -+ kcud1=^J, kcuf1=^L, kcuu1=^K, kdch1=\EW, kdl1=\ER, ked=\EY, -+ kel=\ET, kent=\E7, kf1=^A@\r, kf10=^AI\r, kf11=^AJ\r, -+ kf12=^AK\r, kf13=^AL\r, kf14=^AM\r, kf15=^AN\r, kf16=^AO\r, -+ kf2=^AA\r, kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, kf6=^AE\r, -+ kf7=^AF\r, kf8=^AG\r, kf9=^AH\r, khome=^^, kich1=\EQ, -+ kil1=\EE, knp=\EK, kpp=\EJ, kprt=\EP, krpl=\Er, ll=\E{^K, -+ mc0=\EP, mc4=^T, mc5=\Ed#, nel=\r\n$<1>, -+ pfloc=\EZ2%p1%{63}%+%c%p2%s\177, -+ pfx=\EZ1%p1%{63}%+%c%p2%s\177, -+ pln=\Ez%p1%{47}%+%c%p2%s\r, prot=\E), ri=\Ej$<1>, -+ rmacs=\EcD, rmam=\Ed., rmclk=\E`c, rmcup=\Ew0, rmir=\Er, -+ rmln=\EA11, rmxon=\Ec20, rs1=\E~!\E~4$<70>, -+ rs2=\E`\:$<100>, rs3=\EwG\Ee($<140>, -+ sgr=%?%p8%t\E)%e\E(%;%?%p9%t\EcE%e\EcD%;\EG%{48}%?%p2%t%{8}%|%;%?%p1%p3%|%p6%|%t%{4}%|%;%?%p4%t%{2}%|%;%?%p1%p5%|%t%{64}%|%;%?%p7%t%{1}%|%;%c, -+ sgr0=\E(\EH\003\EG0\EcD, smacs=\EcE, smam=\Ed/, -+ smcup=\Ew1, smir=\Eq, smln=\EA10, smso=\EGt, smxon=\Ec21, -+ tbc=\E0, tsl=\EF, use=adm+sgr, - # --# Update by TD - 2004: --# Adapted from --# http://www.cs.utk.edu/~shuford/terminal/adds_viewpoint_news.txt -+wy160-w|wyse160-w|wyse 160 132-column, -+ cols#132, lw#7, nlab#16, wsl#90, -+ cup=\Ea%i%p1%dR%p2%dC, dch1=\EW$<9>, -+ rs2=\EeF$<150>\E`;$<150>, use=wy160, - # --# COMMANDS ASCII CODE -+wy160-25|wyse160-25|wyse 160 80-column 25-lines, -+ lh@, lines#25, lw@, nlab@, -+ pln@, rs3=\EwG\Ee)$<200>, use=wy160, -+wy160-25-w|wyse160-25-w|wyse 160 132-column 25-lines, -+ lh@, lines#25, lw@, nlab@, -+ pln@, rs3=\EwG\Ee)$<200>, use=wy160-w, - # --# Address, Absolute ESC,=,row,column --# Beep BEL --# Aux Port Enable ESC,@ --# Aux Port Disable ESC,A --# Backspace BS --# Cursor back BS --# Cursor down LF --# Cursor forward FF --# Cursor home RS --# Cursor up VT --# Cursor supress ETB --# Cursor enable CAN --# Erase to end of line ESC,T --# Erase to end of page ESC,Y --# Erase screen SUB --# Keyboard lock SI --# Keyboard unlock SO --# Read current cursor position ESC,? --# Set Attribute ESC,0,x (see below for values of x) --# Tag bit reset ESC,( --# Tag bit set ESC,) --# Transparent Print on ESC,3 --# Transparent Print off ESC,4 -+wy160-42|wyse160-42|wyse 160 80-column 42-lines, -+ lines#42, -+ clear=\E+$<50>, dl1=\ER$<2>, ed=\Ey$<50>, il1=\EE$<2>, -+ ind=\n$<2>, is1=\EcB2\EcC3, nel=\r\n$<2>, ri=\Ej$<2>, -+ rs3=\Ee*$<150>, use=wy160, -+wy160-42-w|wyse160-42-w|wyse 160 132-column 42-lines, -+ cols#132, lw#7, nlab#16, wsl#90, -+ cup=\Ea%i%p1%dR%p2%dC, dch1=\EW$<8>, ip=$<3>, -+ rs2=\EeF$<150>\E`;$<150>, use=wy160-42, - # -+wy160-43|wyse160-43|wyse 160 80-column 43-lines, -+ lh@, lines#43, lw@, nlab@, -+ pln@, rs3=\Ee+$<150>, use=wy160-42, -+wy160-43-w|wyse160-43-w|wyse 160 132-column 43-lines, -+ lh@, lines#43, lw@, nlab@, -+ pln@, rs3=\Ee+$<150>, use=wy160-42-w, - # --# ATTRIBUTES -+wy160-vb|wyse160-vb|Wyse 160 visible bell, -+ bel@, use=wy160, -+wy160-w-vb|wy160-wvb|wyse160-wvb|Wyse 160 132-column visible bell, -+ bel@, use=wy160-w, - # --# Normal @ 0100 --# Half Intensity A 0101 --# Blinking B 0102 --# Half Intensity Blinking C 0103 --# Reverse Video P 0120 --# Reverse Video Half Intensity Q 0121 --# Reverse Video Blinking R 0122 --# Reverse Video Half Intensity --# Blinking S 0123 --# Underlined ` 0140 --# Underlined Half Intensity a 0141 --# Underlined Blinking b 0142 --# Underlined Half Intensity --# Blinking c 0143 --# Video suppress D 0104 --vp3a+|viewpoint3a+|adds viewpoint 3a+, -- am, bw, -- cols#80, it#8, lines#24, -- blink=\E0B\E), civis=^W, clear=\E*$<80>, cnorm=^X, cr=^M, -- cub1=^H, cud1=^J, cuf1=^L, -- cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dim=\E0A\E), -- ed=\EY$<80>, el=\ET, home=^^, ht=^I, ind=^J, invis=\E0D\E), -- kbs=^H, kcub1=^H, kcud1=^J, kcuf1=^L, kcuu1=^K, khome=^^, -- nel=^M^J, rev=\E0P\E), rmso=\E(, -- sgr=%?%p1%p2%|%p3%|%p4%|%p5%|%p7%|%t\E0%{64}%?%p1%t%{17}%|%;%?%p2%t%{32}%|%;%?%p3%t%{16}%|%;%?%p4%t%{2}%|%;%?%p5%t%{1}%|%;%c%?%p7%tD%;\E)%e\E(%;, -- sgr0=\E(, smso=\E0Q\E), smul=\E0`\E), --vp60|viewpoint60|addsvp60|adds viewpoint60, -- use=regent40, -+# The Wyse 75 is a vt100 lookalike without advanced video. - # --# adds viewpoint 90 - from cornell --# Note: emacs sends ei occasionally to insure the terminal is out of --# insert mode. This unfortunately puts the viewpoint90 IN insert --# mode. A hack to get around this is <ich1=\EF\s\EF^U>. (Also, --# - :ei=:im=: must be present in the termcap translation.) --# - <xhp> indicates glitch that attributes stick to location --# - <msgr> means it's safe to move in standout mode --# - <clear=\EG\Ek>: clears screen and visual attributes without affecting --# the status line --# Function key and label capabilities merged in from SCO. --vp90|viewpoint90|adds viewpoint 90, -- OTbs, bw, msgr, xhp, -- cols#80, lines#24, -- clear=\EG\Ek, cub1=^H, cud1=^J, cuf1=^F, -- cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=^Z, dch1=\EE, -- dl1=\El, ed=\Ek, el=\EK, home=\EY\s\s, ht=^I, -- ich1=\EF \EF\025, ind=^J, kbs=^H, kcub1=^U, kcud1=^J, -- kcuf1=^F, kcuu1=^Z, kf0=^B1\r, kf1=^B2\r, kf10=^B;\r, -- kf2=^B3\r, kf3=^B4\r, kf4=^B5\r, kf5=^B6\r, kf6=^B7\r, -- kf7=^B8\r, kf8=^B9\r, kf9=^B\:\r, khome=^A, lf0=F1, lf1=F2, -- lf10=F11, lf2=F3, lf3=F4, lf4=F5, lf5=F6, lf6=F7, lf7=F8, lf8=F9, -- lf9=F10, ll=^A, rmso=\ER\E0@\EV, rmul=\ER\E0@\EV, -- sgr0=\ER\E0@\EV, smso=\ER\E0Q\EV, smul=\ER\E0`\EV, --# Note: if return acts weird on a980, check internal switch #2 --# on the top chip on the CONTROL pc board. --adds980|a980|adds consul 980, -- OTbs, am, -- cols#80, lines#24, -- bel=^G, clear=\014$<1>\013@, cr=^M, cub1=^H, cud1=^J, -- cuf1=\E^E01, cup=\013%p1%{64}%+%c\E\005%p2%2d, -- dl1=\E\017$<13>, il1=\E\016$<13>, ind=^J, kf0=\E0, kf1=\E1, -- kf2=\E2, kf3=\E3, kf4=\E4, kf5=\E5, kf6=\E6, kf7=\E7, kf8=\E8, -- kf9=\E9, rmso=^O, sgr0=^O, smso=^Y^^^N, -- --#### C. Itoh Electronics -+# The Wyse 75 can support one attribute (e.g. Dim, Inverse, -+# Underline) without magic cookies. The following description -+# uses this capability, but when more than one attribute is -+# put on the screen at once, all attributes will be changed -+# to be the same as the last attribute given. -+# The Wyse 75 can support more attributes when used with magic -+# cookies. The wy75-mc terminal description uses magic cookies -+# to correctly handle multiple attributes on a screen. - # --# As of 1995 these people no longer make terminals (they're still in the --# printer business). Their terminals were all clones of the DEC VT series. --# They're located in Orange County, CA. -+wy75|wyse75|wyse 75, -+ am, hs, mc5i, mir, msgr, xenl, xon, -+ cols#80, lines#24, ma#1, pb#1201, wsl#78, -+ acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -+ bel=^G, cbt=\E[Z, civis=\E[?25l, clear=\E[H\E[J$<30>, -+ cnorm=\E[?25h, cr=^M, csr=\E[%i%p1%d;%p2%dr$<2>, -+ cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=^J, -+ cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, -+ cuu=\E[%p1%dA, cuu1=\E[A, dch=\E[%p1%dP$<3*>, -+ dch1=\E[P$<3>, dim=\E[0t\E[2m, dl=\E[%p1%dM$<1*>, -+ dl1=\E[M, dsl=\E[>\,\001\001\E[>-\001\001, -+ ech=\E[%p1%dX, ed=\E[J$<30>, el=\E[K$<3>, el1=\E[1K$<3>, -+ enacs=\E)0, flash=\E[30h\E\,\E[30l$<250>, fsl=^A, -+ home=\E[H, hpa=\E[%i%p1%dG, ht=^I, hts=\EH, -+ ich=\E[%p1%d@$<1*>, il=\E[%p1%dL$<2*>, il1=\E[L$<2>, -+ ind=\n$<2>, ip=$<1>, -+ is1=\E[2;4;20;30l\E[?1;10l\E[12h\E[?7;8;25h, -+ is2=\E>\E(B\E)0\017, is3=\E[m, kbs=^H, kcub1=\E[D, -+ kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdl1=\E[M, kel=\E[K, -+ kf1=\E[?5i, kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, -+ kf13=\E[25~, kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, -+ kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, kf2=\E[?3i, -+ kf20=\E[34~, kf21=\E[35~, kf3=\E[2i, kf4=\E[@, kf5=\E[M, -+ kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, kfnd=\E[1~, -+ khlp=\E[28~, khome=\E[H, kich1=\E[@, kil1=\E[L, knp=\E[6~, -+ kpp=\E[5~, kprt=\E[?5i, kslt=\E[4~, mc0=\E[0i, mc4=\E[4i, -+ mc5=\E[5i, rc=\E8, rev=\E[1t\E[7m, ri=\EM$<2>, rmacs=^O, -+ rmam=\E[?7l, rmir=\E[4l, rmkx=\E>, rmso=\E[m, rmul=\E[m, -+ rs1=\E[13l\E[3l\E!p, rs2=\E[35h\E[?3l$<80>, rs3=\E[?5l, -+ sc=\E7, -+ sgr=%?%p5%t\E[0t%;%?%p3%p1%|%t\E[1t%;%?%p2%t\E[2t%;%?%p4%t\E[3t%;%?%p1%p2%p3%p4%p5%|%|%|%|%t\E[7m%e\E[m%;%?%p9%t\016%e\017%;, -+ sgr0=\E[m\017, smacs=^N, smam=\E[?7h, smir=\E[4h, -+ smkx=\E[?1l\E[?7h\E=, smso=\E[1t\E[7m, smul=\E[2t\E[4m, -+ tbc=\E[3g, tsl=\E[>\,\001, use=vt220+keypad, - # -- --# CIT 80 - vt-52 emulator, the termcap has been modified to remove --# the delay times and do an auto tab set rather than the indirect --# file used in vt100. --cit80|cit-80|citoh 80, -- OTbs, am, -- cols#80, lines#24, -- clear=\E[H\EJ, cr=^M, cub1=^H, cud1=\E[B, cuf1=\E[C, -- cup=\E[%i%p1%2d;%p2%2dH, cuu1=\E[A, ed=\EJ, el=\EK, ff=^L, -- ind=^J, is2=\E>, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, -- kcuu1=\EOA, rmkx=\E[?1l\E>, smkx=\E[?1h\E=, --# From: Tim Wood <mtxinu!sybase!tim> Fri Sep 27 09:39:12 PDT 1985 --# (cit101: added <rmam>/<smam> based on init string, merged this with c101 -- esr) --cit101|citc|C.itoh fast vt100, -- OTbs, am, xenl, -- cols#80, lines#24, -- bel=^G, clear=\E[H\E[2J, cnorm=\E[V\E8, cub1=^H, cud1=\E[B, -- cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, -- cvvis=\E7\E[U, dch1=\E[P, dl1=\E[M, ed=\E[J, el=\E[K, -- flash=\E[?5h$<200/>\E[?5l, ich1=\E[@, il1=\E[L, -- is2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h\E[3g\E[>5g, -- kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, -- rmam=\E[?7l, rmkx=\E[?1l\E>, rmso=\E[m, rmul=\E[m, -- sgr0=\E[m, smam=\E[?7h, smkx=\E[?1h\E=, smso=\E[7m, -- smul=\E[4m, --# CIE Terminals CIT-101e from Geoff Kuenning <callan!geoff> via BRL --# The following termcap entry was created from the Callan cd100 entry. The --# last two lines (with the capabilities in caps) are used by RM-cobol to allow --# full selection of combinations of reverse video, underline, and blink. --# (cit101e: removed unknown :f0=\EOp:f1=\EOq:f2=\EOr:f3=\EOs:f4=\EOt:f5=\EOu:\ --# f6=\EOv:f7=\EOw:f8=\EOx:f9=\EOy:AB=\E[0;5m:AL=\E[m:AR=\E[0;7m:AS=\E[0;5;7m:\ --# :NB=\E[0;1;5m:NM=\E[0;1m:NR=\E[0;1;7m:NS=\E[0;1;5;7m: -- esr) --cit101e|C. Itoh CIT-101e, -- OTbs, OTpt, am, mir, msgr, -- cols#80, it#8, lines#24, -- acsc=, clear=\E[H\E[J, cnorm=, csr=\E[%i%p1%2d;%p2%2dr, -- cub1=\E[D, cud1=\E[B, cuf1=\E[C, cup=\E[%i%p1%2d;%p2%2dH, -- cuu1=\E[A, cvvis=\E[?1l\E[?4l\E[?7h, dch1=\E[P, dl1=\E[M, -- ed=\E[J, el=\E[K, if=/usr/share/tabset/vt100, il1=\E[L, -- kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kf0=\EOT, -- kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, kf5=\EOm, kf6=\EOl, -- kf7=\EOM, kf8=\EOn, rc=\E8, ri=\EM, rmacs=^O, rmir=\E[4l, -- rmkx=\E>, rmso=\E[m, rmul=\E[m, sc=\E7, smacs=^N, smir=\E[4h, -- smkx=\E=, smso=\E[7m, smul=\E[4m, --# From: David S. Lawyer, June 1997: --# The CIT 101-e was made in Japan in 1983-4 and imported by CIE --# Terminals in Irvine, CA. It was part of CITOH Electronics. In the --# late 1980's CIT Terminals went out of business. --# There is no need to use the initialization string is=... (by invoking --# tset or setterm etc.) provided that the terminal has been manually set --# up (and the setup saved with ^S) to be compatible with this termcap. To be --# compatible it should be in ANSI mode (not VT52). A set-up that --# works is to set all the manually setable stuff to factory defaults --# by pressing ^D in set-up mode. Then increse the brighness with the --# up-arrow key since the factory default will likely be dim on an old --# terminal. Then change any options you want (provided that they are --# compatible with the termcap). For my terminal I set: Screen --# Background: light; Keyclicks: silent; Auto wraparound: on; CRT saver: --# on. I also set up mine for parity (but you may not need it). Then --# save the setup with ^S. --# (cit101e-rv: added empty <rmcup> to suppress a tic warning. --esr) --cit101e-rv|Citoh CIT-101e (sets reverse video), -- am, eo, mir, msgr, xenl, xon, -- cols#80, it#8, lines#24, -- OTnl=\EM, bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, -- civis=\E[1v, clear=\E[H\E[J, cnorm=\E[0;3;4v, cr=^M, -- csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, -- cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, cuf1=\E[C, -- cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, -- cvvis=\E[3;5v, dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, -- dl1=\E[M, ed=\E[J, el=\E[K, flash=\E[?5l\E[?5h$<200/>, -- home=\E[H, hpa=\E[%i%p1%dG, ht=^I, hts=\EH, ich=\E[%p1%d@, -- ich1=\E[@, il=\E[%p1%dL, il1=\E[L, ind=^J, indn=\E[%p1%dS, -- is2=\E<\E>\E[?1l\E[?3l\E[?4l\E[?5h\E[?7h\E[?8h\E[3g\E[>5g\E(B\E[m\E[20l\E[1;24r\E[24;1H, -- kbs=\177, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, -- kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, nel=\EE, rc=\E8, -- rev=\E[7m, ri=\EM, rin=\E[%p1%dT, rmcup=, rmir=\E[4l, -- rmso=\E[m, rmul=\E[m, rs1=\Ec\E[?7h\E[>5g, sc=\E7, -- sgr0=\E[m, smcup=\E[>5g\E[?7h\E[?5h, smir=\E[4h, -- smso=\E[7m, smul=\E[4m, tbc=\E[3g, u6=\E[%i%p1%d;%p2%dR, -- u7=\E[6n, u8=\E[?6c, u9=\E[c, --cit101e-n|CIT-101e w/o am, -- am@, -- cvvis=\E[?1l\E[?4l\E[?7l, kbs=^H, kcub1=^H, kcud1=^J, -- use=cit101e, --cit101e-132|CIT-101e with 132 cols, -- cols#132, -- kbs=^H, kcub1=^H, kcud1=^J, use=cit101e, --cit101e-n132|CIT-101e with 132 cols w/o am, -- am@, -- cols#132, -- cvvis=\E[?1l\E[?4l\E[?7l, kbs=^H, kcub1=^H, kcud1=^J, -- use=cit101e, --# CIE Terminals CIT-500 from BRL --# The following SET-UP modes are assumed for normal operation: --# GENERATE_XON/XOFF:YES DUPLEX:FULL NEWLINE:OFF --# AUTOWRAP:ON MODE:ANSI SCREEN_LENGTH:64_LINES --# DSPLY_CNTRL_CODES?NO PAGE_WIDTH:80 EDIT_MODE:OFF --# Other SET-UP modes may be set for operator convenience or communication --# requirements. --# Hardware tabs are assumed to be set every 8 columns; they can be set up --# by the "reset", "tset", or "tabs" utilities. No delays are specified; use --# "stty ixon -ixany" to enable DC3/DC1 flow control! --# (cit500: I added <rmam>/<smam> based on the init string -- esr) --cit500|CIE Terminals CIT-500, -- OTbs, OTpt, mir, msgr, xon, -- OTkn#10, cols#80, it#8, lines#64, vt#3, -- acsc=, bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, -- clear=\E[H\E[J, cr=^M, csr=\E[%i%p1%d;%p2%dr, -- cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=^J, -- cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, -- cuu=\E[%p1%dA, cuu1=\EM, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, -- ed=\EJ, el=\EK, home=\E[H, ht=^I, hts=\EH, il=\E[%p1%dL, -- il1=\E[L, ind=^J, is2=\E<\E)0, kbs=^H, kcbt=\E[Z, kcub1=\EOD, -- kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kdch1=\E[P, kdl1=\E[M, -- ked=\EJ, kel=\EK, kf0=\EOP, kf1=\EOQ, kf2=\EOR, kf3=\EOS, -- kf4=\EOU, kf5=\EOV, kf6=\EOW, kf7=\EOX, kf8=\EOY, kf9=\EOZ, -- khome=\E[H, kich1=\E[4h, kil1=\E[L, krmir=\E[4l, lf0=PF1, -- lf1=PF2, lf2=PF3, lf3=PF4, lf4=F15, lf5=F16, lf6=F17, lf7=F18, -- lf8=F19, lf9=F20, ll=\E[64H, nel=\EE, rc=\E8, rev=\E[7m, -- ri=\EM, rmacs=^O, rmam=\E[?7l, rmir=\E[4l, rmkx=\E[?1l\E>, -- rmso=\E[m, rmul=\E[m, -- rs1=\E<\E2\E[20l\E[?6l\E[r\E[m\E[q\E(B\017\E)0\E>, -- sc=\E7, sgr0=\E[m, smacs=^N, smam=\E[?7h, smir=\E[4h, -- smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, tbc=\E[3g, -- --# C. Itoh printers begin here --citoh|ci8510|8510|c.itoh 8510a, -- cols#80, it#8, -- bold=\E!, cub1@, -- is2=\E(009\,017\,025\,033\,041\,049\,057\,065\,073., -- rep=\ER%p2%03d%p1%c, ri=\Er, rmul=\EY, sgr0=\E"\EY, -- smul=\EX, use=lpr, --citoh-pica|citoh in pica, -- is1=\EN, use=citoh, --citoh-elite|citoh in elite, -- cols#96, -- is1=\EE, -- is2=\E(009\,017\,025\,033\,041\,049\,057\,065\,073\,081\,089., -- use=citoh, --citoh-comp|citoh in compressed, -- cols#136, -- is1=\EQ, -- is2=\E(009\,017\,025\,033\,041\,049\,057\,065\,073\,081\,089\,097\,105\,113\,121\,129., -- use=citoh, --# citoh has infinite cols because we don't want lp ever inserting \n\t**. --citoh-prop|citoh-ps|ips|citoh in proportional spacing mode, -- cols#32767, -- is1=\EP, use=citoh, --citoh-6lpi|citoh in 6 lines per inch mode, -- is3=\EA, use=citoh, --citoh-8lpi|citoh in 8 lines per inch mode, -- lines#88, -- is3=\EB, use=citoh, -- --#### Control Data (cdc) -+# This terminal description uses the non-hidden attribute mode -+# (with magic cookie). - # -- --cdc456|cdc 456 terminal, -- OTbs, am, -- cols#80, lines#24, -- bel=^G, clear=^Y^X, cr=^M, cub1=^H, cud1=^J, cuf1=^L, -- cup=\E1%p1%{32}%+%c%p2%{32}%+%c, cuu1=^Z, dl1=\EJ, ed=^X, -- el=^V, home=^Y, il1=\EL, ind=^J, -- --# Assorted CDC terminals from BRL (improvements by DAG & Ferd Brundick) --cdc721|CDC Viking, -- OTbs, am, -- cols#80, lines#24, -- clear=^L, cuf1=^X, cup=\002%p2%{32}%+%c%p1%{32}%+%c, -- cuu1=^W, el=^K, home=^Y, kcub1=^H, kcud1=^J, kcuf1=^I, -- kcuu1=^W, khome=^Y, --cdc721ll|CDC Vikingll, -- OTbs, am, -- cols#132, lines#24, -- clear=^L, cuf1=^X, cup=\002%p2%{32}%+%c%p1%{32}%+%c, -- cuu1=^W, el=^K, home=^Y, kcub1=^H, kcud1=^J, kcuf1=^I, -- kcuu1=^W, khome=^Y, --# (cdc752: the BRL entry had :ll=\E1 ^Z: commented out --cdc752|CDC 752, -- OTbs, am, bw, xhp, -- cols#80, lines#24, -- bel=^G, clear=\030\E1\s\s, cr=^M, cub1=^H, cud1=^J, cuf1=^U, -- cup=\E1%p2%{32}%+%c%p1%{32}%+%c, cuu1=^Z, el=^V, -- home=\E1\s\s, ind=^J, ll=^Y, rs1=\E1 \030\002\003\017, --# CDC 756 --# The following switch/key settings are assumed for normal operation: --# 96 chars SCROLL FULL duplex not BLOCK --# Other switches may be set according to communication requirements. --# Insert/delete-character cannot be used, as the whole display is affected. --# "so" & "se" are commented out until jove handles "sg" correctly. --cdc756|CDC 756, -- OTbs, am, bw, -- OTkn#10, cols#80, lines#24, -- bel=^G, clear=^Y^X, cr=^M, cub1=^H, cud1=^J, cuf1=^U, -- cup=\E1%p2%{32}%+%c%p1%{32}%+%c, cuu1=^Z, -- dl1=\EJ$<6*/>, ed=^X, el=^V, home=^Y, il1=\EL$<6*/>, ind=^J, -- kbs=^H, kcub1=^H, kcud1=^J, kcuf1=^U, kcuu1=^Z, kdch1=\EI, -- kdl1=\EL, ked=^X, kel=^V, kf0=\EA, kf1=\EB, kf2=\EC, kf3=\ED, -- kf4=\EE, kf5=\EF, kf6=\EG, kf7=\EH, kf8=\Ea, kf9=\Eb, khome=^Y, -- khts=^O, kich1=\EK, kil1=\EL, lf0=F1, lf1=F2, lf2=F3, lf3=F4, -- lf4=F5, lf5=F6, lf6=F7, lf7=F8, lf8=F9, lf9=F10, ll=^Y^Z, -- rs1=\031\030\002\003\017, -+wy75-mc|wyse75-mc|wyse 75 with magic cookies, -+ msgr@, -+ ma@, xmc#1, -+ blink=\E[2p, dim=\E[1p, invis=\E[4p, is3=\E[m\E[p, -+ rev=\E[16p, rmacs=\E[0p\017, rmso=\E[0p, rmul=\E[0p, -+ sgr=\E[%{0}%?%p2%p6%|%t%{8}%|%;%?%p1%p3%|%p6%|%t%{16}%|%;%?%p4%t%{2}%|%;%?%p1%p5%|%t%{1}%|%;%?%p7%t%{4}%|%;%dp%?%p9%t\016%e\017%;, -+ sgr0=\E[0p\017, smacs=\E[0p\016, smso=\E[17p, smul=\E[8p, -+ use=wy75, -+wy75-vb|wyse75-vb|wyse 75 with visible bell, -+ pb@, -+ bel@, use=wy75, -+wy75-w|wyse75-w|wyse 75 in 132 column mode, -+ cols#132, wsl#130, -+ rs2=\E[35h\E[?3h$<80>, use=wy75, -+wy75-wvb|wyse75-wvb|wyse 75 with visible bell 132 columns, -+ pb@, -+ bel@, use=wy75-w, - # --# CDC 721 from Robert Viduya, Ga. Tech. <ihnp4!gatech!gitpyr!robert> via BRL. -+# Wyse 85 emulating a vt220 7 bit mode. -+# 24 line screen with status line. - # --# Part of the long initialization string defines the "DOWN" key to the left --# of the tab key to send an ESC. The real ESC key is positioned way out --# in right field. -+# The vt220 mode permits more function keys but it wipes out -+# the escape key. I strongly recommend that <f11> be set to -+# escape (esc). -+# The terminal may have to be set for 8 data bits and 2 stop -+# bits for the arrow keys to work. -+# The Wyse 85 runs faster with XON/XOFF enabled. Also the -+# <dch> and <ich> work best when XON/XOFF is set. <ich> and -+# <dch> leave trash on the screen when used without XON/XOFF. - # --# The termcap won't work in 132 column mode due to the way it it moves the --# cursor. Termcap doesn't have the capability (as far as I could tell) to --# handle the 721 in 132 column mode. -+wy85|wyse85|wyse 85, -+ am, hs, mc5i, mir, msgr, xenl, xon, -+ cols#80, it#8, lines#24, wsl#80, -+ acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -+ bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l, -+ clear=\E[H\E[J$<110>, cnorm=\E[?25h, cr=^M, -+ csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, -+ cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, -+ cup=\E[%i%p1%d;%p2%dH$<1>, cuu=\E[%p1%dA, cuu1=\E[A, -+ dch=\E[%p1%dP$<3*>, dch1=\E[P$<3>, dim=\E[2m, -+ dl=\E[%p1%dM$<3*>, dl1=\E[M$<3>, dsl=\E[40l, -+ ech=\E[%p1%dX, ed=\E[J$<110>, el=\E[K$<1>, el1=\E[1K, -+ enacs=\E)0, flash=\E[30h\E\,\E[30l$<300>, -+ fsl=\E[1;24r\E8, home=\E[H, ht=\011$<1>, hts=\EH, -+ ich=\E[%p1%d@$<4*>, il=\E[%p1%dL$<5*>, il1=\E[L$<5>, -+ ind=\n$<3>, invis=\E[8m, ip=$<3>, is1=\E[62;1"p\E[?5W, -+ is2=\E[2;4;20;30l\E[?1;4;10;16l\E[12h\E[?7;8;25h$<16>, -+ is3=\E>\E(B\E)0\017\E[m, kbs=^H, kcub1=\E[D, kcud1=\E[B, -+ kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[3~, kf10=\E[21~, -+ kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, -+ kf15=\E[28~, kf16=\E[29~, kf17=\E[31~, kf18=\E[32~, -+ kf19=\E[33~, kf20=\E[34~, kf6=\E[17~, kf7=\E[18~, -+ kf8=\E[19~, kf9=\E[20~, kfnd=\E[1~, khlp=\E[28~, -+ khome=\E[26~, kich1=\E[2~, knp=\E[6~, kpp=\E[5~, -+ kslt=\E[4~, lf1=PF1, lf2=PF2, lf3=PF3, lf4=PF4, mc0=\E[0i, -+ mc4=\E[4i, mc5=\E[5i, rc=\E8, rev=\E[7m, ri=\EM$<3>, -+ rmacs=^O, rmam=\E[?7l, rmir=\E[4l, rmkx=\E>, rmso=\E[m, -+ rmul=\E[m, rs1=\E[13l\E[3l\E!p, rs2=\E[35h\E[?3l$<70>, -+ rs3=\E[?5l, sc=\E7, -+ sgr=\E[0%?%p2%t;4%;%?%p3%p1%|%t;7%;%?%p4%t;5%;%?%p5%t;2%;%?%p6%t;1%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, -+ sgr0=\E[m\017, smacs=^N, smam=\E[?7h, smir=\E[4h, -+ smkx=\E[?1l\E=, smso=\E[7m, smul=\E[4m, tbc=\E[3g, -+ tsl=\E[40h\E7\E[25;%i%p1%dH, use=vt220+keypad, - # --# (cdc721: changed :ri: to :sr: -- esr) --cdc721-esc|Control Data 721, -- OTbs, OTpt, am, bw, msgr, xon, -- OTkn#10, cols#80, it#8, lines#30, -- bel=^G, blink=^N, cbt=^^^K, clear=^L, cub1=^H, cud1=^Z, -- cuf1=^X, cup=\002%p2%{32}%+%c%p1%{32}%+%c, cuu1=^W, -- dch1=^^N, dim=^\, dl1=^^Q, ed=^^P, el=^K, home=^Y, hts=^^^RW, -- ich1=^^O, il1=^^R, ind=\036W =\036U, invis=^^^R[, -- is2=\036\022B\003\036\035\017\022\025\035\036E\036\022H\036\022J\036\022L\036\022N\036\022P\036\022Q\036\022\036\022\^\036\022b\036\022i\036W =\036\022Z\036\011C1-` `!k/o, -- kbs=^H, kcub1=^H, kcud1=^Z, kcuf1=^X, kcuu1=^W, kf0=^^q, -- kf1=^^r, kf2=^^s, kf3=^^t, kf4=^^u, kf5=^^v, kf6=^^w, kf7=^^x, -- kf8=^^y, kf9=^^z, khome=^Y, ll=^B =, rev=^^D, -- ri=\036W =\036V, rmir=, rmkx=^^^Rl, rmso=^^E, rmul=^], -- sgr0=\017\025\035\036E\036\022\\, smir=, smkx=^^^Rk, -- smso=^^D, smul=^\, tbc=^^^RY, -- --#### Getronics -+# Wyse 85 with visual bell. -+wy85-vb|wyse85-vb|wyse 85 with visible bell, -+ bel@, flash=\E[30h\E\,\E[30l$<300>, use=wy85, - # --# Getronics is a Dutch electronics company that at one time was called --# `Geveke' and made async terminals; but (according to the company itself!) --# they've lost all their documentation on the command set. The hardware --# documentation suggests the terminals were actually manufactured by a --# Taiwanese electronics company named Cal-Comp. There are known --# to have been at least two models, the 33 and the 50. -+# Wyse 85 in 132-column mode. -+wy85-w|wyse85-w|wyse 85 in 132-column mode, -+ cols#132, wsl#132, -+ rs2=\E[35h\E[?3h$<70>, use=wy85, - # -+# Wyse 85 in 132-column mode with visual bell. -+wy85-wvb|wyse85-wvb|wyse 85 with visible bell 132-columns, -+ bel@, use=wy85-w, - --# The 50 seems to be a top end vt220 clone, with the addition of a higher --# screen resolution, a larger screen, at least 1 page of memory above and --# below the screen, apparently pages of memory right and left of the screen --# which can be panned, and about 75 function keys (15 function keys x normal, --# shift, control, func A, func B). It also has more setup possibilities than --# the vt220. The monitor case is dated November 1978 and the keyboard case is --# May 1982. -+# From: Kevin Turner <kevint@aracnet.com>, 12 Jul 1998 -+# This copes with an apparent firmware bug in the wy85. He writes: -+# "What I did was change leave the terminal cursor keys set to Normal -+# (instead of application), and change \E[ to \233 for all the keys in -+# terminfo. At one point, I found some reference indicating that this -+# terminal bug (not sending \E[) was acknowledged by Wyse (so it's not just -+# me), but I can't find that and the server under my bookmark to "Wyse -+# Technical" isn't responding. So there's the question of wether the wy85 -+# terminfo should reflect the manufactuer's intended behaviour of the terminal -+# or the actual." -+wy85-8bit|wyse85-8bit|wyse 85 in 8-bit mode, -+ am, hs, mc5i, mir, msgr, xenl, xon, -+ cols#80, it#8, lines#24, wsl#80, -+ acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -+ bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l, -+ clear=\E[H\E[J$<110>, cnorm=\E[?25h, cr=^M, -+ csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, -+ cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, -+ cup=\E[%i%p1%d;%p2%dH$<1>, cuu=\E[%p1%dA, cuu1=\E[A, -+ dch=\E[%p1%dP$<3*>, dch1=\E[P$<3>, dim=\E[2m, -+ dl=\E[%p1%dM$<3*>, dl1=\E[M$<3>, dsl=\E[40l, -+ ech=\E[%p1%dX, ed=\E[J$<110>, el=\E[K$<1>, el1=\E[1K, -+ enacs=\E)0, flash=\E[30h\E\,\E[30l$<300>, -+ fsl=\E[1;24r\E8, home=\E[H, ht=\011$<1>, hts=\EH, -+ ich=\E[%p1%d@$<4*>, il=\E[%p1%dL$<5*>, il1=\E[L$<5>, -+ ind=\n$<3>, invis=\E[8m, ip=$<3>, is1=\E[62;1"p\E[?5W, -+ is2=\E[2;4;20;30l\E[?1;4;10;16l\E[12h\E[?7;8;25h$<16>, -+ is3=\E>\E(B\E)0\017\E[m, ka1=\EOw, ka3=\EOy, kb2=\EOu, -+ kbs=^H, kc1=\EOq, kc3=\EOs, kcub1=\233D, kcud1=\233B, -+ kcuf1=\233C, kcuu1=\233A, kdch1=\2333~, kent=\EOM, -+ kf1=\EOP, kf10=\23321~, kf11=\23323~, kf12=\23324~, -+ kf13=\23325~, kf14=\23326~, kf15=\23328~, kf16=\23329~, -+ kf17=\23331~, kf18=\23332~, kf19=\23333~, kf2=\EOQ, -+ kf20=\23334~, kf3=\EOR, kf4=\EOS, kf6=\23317~, kf7=\23318~, -+ kf8=\23319~, kf9=\23320~, kfnd=\2331~, khlp=\23328~, -+ khome=\23326~, kich1=\2332~, knp=\2336~, kpp=\2335~, -+ kslt=\2334~, lf1=PF1, lf2=PF2, lf3=PF3, lf4=PF4, mc0=\E[0i, -+ mc4=\E[4i, mc5=\E[5i, rc=\E8, rev=\E[7m, ri=\EM$<3>, -+ rmacs=^O, rmam=\E[?7l, rmir=\E[4l, rmkx=\E>, rmso=\E[m, -+ rmul=\E[m, rs1=\E[13l\E[3l\E!p, rs2=\E[35h\E[?3l$<70>, -+ rs3=\E[?5l, sc=\E7, -+ sgr=\E[0%?%p2%t;4%;%?%p3%p1%|%t;7%;%?%p4%t;5%;%?%p5%t;2%;%?%p6%t;1%;%?%p7%t;8%;+m%?%p9%t\016%e\017%;, -+ sgr0=\E[m\017, smacs=^N, smam=\E[?7h, smir=\E[4h, -+ smkx=\E[?1l\E=, smso=\E[7m, smul=\E[4m, tbc=\E[3g, -+ tsl=\E[40h\E7\E[25;%i%p1%dH, - # --# The vt100 emulation works as is. The entry below describes the rather --# non-conformant (but more featureful) ANSI mode. -+# Wyse 185 emulating a vt320 7 bit mode. - # --# From: Stephen Peterson <stv@utrecht.ow.nl>, 27 May 1995 --visa50|geveke visa 50 terminal in ansi 80 character mode, -- bw, mir, msgr, -- cols#80, lines#25, -- acsc=0_aaffggh jjkkllmmnnooqqssttuuvvwwxx, bel=^G, -- blink=\E[5m, bold=\E[1m, cbt=\E[Z, clear=\E[H\E[2J, cr=^M, -- csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=\E[D, -- cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, cuf1=\E[C, -+# This terminal always displays 25 lines. These lines may be used -+# as 24 data lines and a terminal status line (top or bottom) or -+# 25 data lines. The 48 and 50 line modes change the page size -+# and not the number of lines on the screen. -+# -+# The Compose Character key can be used as a meta key if changed -+# by set-up. -+# -+wy185|wyse185|wyse 185, -+ am, hs, km, mc5i, mir, msgr, xenl, xon, -+ cols#80, it#8, lines#24, wsl#80, -+ acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -+ bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l, -+ clear=\E[H\E[J$<40>, cnorm=\E[34h\E[?25h, cr=^M, -+ csr=\E[%i%p1%d;%p2%dr$<20>, cub=\E[%p1%dD, cub1=^H, -+ cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, - cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, -- dch=\E[%p1%dX, dch1=\E[X, dim=\E[2m, dl=\E[%p1%dM, -- dl1=\E[M, ed=\E[J, el=\E[K, flash=\E[?5h\E[?5l, home=\E[H, -- hpa=\E[%i%p1%dG, ht=^I, ich=\E[%p1%d@, ich1=\E[@, -- il=\E[%p1%dL, il1=\E[L, ind=^J, invis=\E[8m, -- is2=\E0;2m\E[1;25r\E[25;1H\E[?3l\E[?7h\E[?8h, -- ka1=\E[f, ka3=\EOQ, kb2=\EOP, kbs=^H, kc1=\EOR, kc3=\EOS, -- kcub1=\E[D, kcud1=\E[A, kcuf1=\E[C, kcuu1=\E[A, kdch1=\177, -- kdl1=\EOS, kf0=\E010, kf1=\E001, kf10=\E011, kf2=\E002, -- kf3=\E003, kf4=\E004, kf5=\E005, kf6=\E006, kf7=\E007, -- kf8=\E008, kf9=\E009, khome=\E[f, lf2=A delete char, -- lf3=A insert line, lf4=A delete line, lf5=A clear, -- lf6=A ce of/cf gn, lf7=A print, lf8=A on-line, -- lf9=A funcl0=A send, nel=^M^J, rev=\E[7m, rmacs=\E[3l, -- rmam=\E[?7l, rmir=\E[4l, rmkx=\E>, rmso=\E[0;2m, -- rmul=\E[0m, sgr0=\E[0;2m, smacs=\E3h, smam=\E?7h, -- smir=\E[4h, smkx=\E=, smso=\E[2;7m, smul=\E[4m, tbc=\E[3g, -- vpa=\E[%i%p1%dd, -- --#### Human Designed Systems (Concept) -+ cvvis=\E[?25h\E[34l, dch=\E[%p1%dP$<3>, dch1=\E[P$<3>, -+ dim=\E[2m, dl=\E[%p1%dM$<2*>, dl1=\E[M$<2>, -+ dsl=\E7\E[99;0H\E[K\E8, ech=\E[%p1%dX, ed=\E[J$<40>, -+ el=\E[K, el1=\E[1K, enacs=\E)0, -+ flash=\E[30h\E\,\E[30l$<100>, fsl=\E[1;24r\E8, -+ home=\E[H, hpa=\E[%i%p1%d`, ht=^I, hts=\EH, -+ ich=\E[%p1%d@$<2>, il=\E[%p1%dL$<3*>, il1=\E[L$<3>, -+ ind=\n$<2>, invis=\E[8m, ip=$<4>, is1=\E[?5W, -+ is2=\E[2;4;20;30l\E[?1;4;10;16l\E[12h\E[?7;8;25h, -+ is3=\E>\E(B\E)0\017\E[m, kbs=^H, kcbt=\E[Z, kcub1=\E[D, -+ kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[3~, kf1=\EOP, -+ kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, -+ kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, kf17=\E[31~, -+ kf18=\E[32~, kf19=\E[33~, kf2=\EOQ, kf20=\E[34~, kf3=\EOR, -+ kf4=\EOS, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, -+ kfnd=\E[1~, khlp=\E[28~, khome=\E[26~, kich1=\E[2~, -+ knp=\E[6~, kpp=\E[5~, kslt=\E[4~, lf1=PF1, lf2=PF2, lf3=PF3, -+ lf4=PF4, mc0=\E[0i, mc4=\E[4i, mc5=\E[5i, rc=\E8, rev=\E[7m, -+ ri=\EM$<2>, rmacs=^O, rmam=\E[?7l, rmcup=\E[ R, rmir=\E[4l, -+ rmkx=\E>, rmso=\E[27m, rmul=\E[24m, -+ rs1=\E[13l\E[3l\E\\\E[63;1"p\E[!p, rs2=\E[35h\E[?3l, -+ rs3=\E[?5l\E[47h\E[40l\E[r, sc=\E7, -+ sgr=\E[0%?%p2%t;4%;%?%p3%p1%|%t;7%;%?%p4%t;5%;%?%p5%t;2%;%?%p6%t;1%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, -+ sgr0=\E[m\017, smacs=^N, smam=\E[?7h, smcup=\E[ Q, -+ smir=\E[4h, smkx=\E[?1l\E=, smso=\E[7m, smul=\E[4m, -+ tbc=\E[3g, tsl=\E7\E[99;%i%p1%dH, vpa=\E[%i%p1%dd, -+ use=vt220+keypad, - # --# Human Designed Systems --# 400 Fehley Drive --# King of Prussia, PA 19406 --# Vox: (610)-277-8300 --# Fax: (610)-275-5739 --# Net: support@hds.com -+# Wyse 185 with 24 data lines and top status (terminal status) -+wy185-24|wyse185-24|wyse 185 with 24 data lines, -+ hs@, -+ dsl@, fsl@, rs3=\E[?5l\E[47h\E[40l\E[1;24r, tsl@, -+ use=wy185, - # --# John Martin <john@hds.com> is their termcap expert. They're mostly out of --# the character-terminal business now (1995) and making X terminals. In --# particular, the whole `Concept' line described here was discontinued long --# ago. -+# Wyse 185 with visual bell. -+wy185-vb|wyse185-vb|wyse 185+flash, -+ bel@, use=wy185, - # -+# Wyse 185 in 132-column mode. -+wy185-w|wyse185-w|wyse 185 in 132-column mode, -+ cols#132, wsl#132, -+ dch=\E[%p1%dP$<7>, dch1=\E[P$<7>, ich=\E[%p1%d@$<7>, -+ ip=$<7>, rs2=\E[35h\E[?3h, use=wy185, -+# -+# Wyse 185 in 132-column mode with visual bell. -+wy185-wvb|wyse185-wvb|wyse 185+flash+132 cols, -+ bel@, use=wy185-w, - --# From: <vax135!hpk> Sat Jun 27 07:41:20 1981 --# Extensive changes to c108 by arpavax:eric Feb 1982 --# Some unknown person at SCO then translated it to terminfo. -+# wy325 terminfo entries -+# Done by Joe H. Davis 3-9-92 -+ -+# lines 25 columns 80 - # --# There seem to be a number of different versions of the C108 PROMS --# (with bug fixes in its Z-80 program). -+wy325|wyse325|Wyse epc, -+ am, bw, hs, mc5i, mir, -+ cols#80, lh#1, lines#24, lw#8, nlab#8, pb#9601, wsl#45, -+ acsc=+/\,.0[a2fxgqh1ihjYk?lZm@nEqDtCu4vAwBx3yszr{c~~, -+ bel=^G, blink=\EG2, cbt=\EI, civis=\E`0, clear=\E+$<50>, -+ cnorm=\E`1, cr=^M, cub1=^H, cud1=^J, cuf1=^L, -+ cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW$<7>, -+ dim=\EGp, dl1=\ER$<3>, dsl=\EF\r, ed=\EY$<50>, el=\ET$<4>, -+ flash=\E`8$<100/>\E`9, fsl=^M, home=^^, ht=^I, hts=\E1, -+ il1=\EE$<3>, ind=\n$<3>, ip=$<2>, is1=\EcB0\EcC1, -+ is2=\EcD\E'\Er\EH\003\Ed/\EO\Ee1\Ed*\E`@\E`9\E`1\016\024\El, -+ is3=\Ew0$<16>, kHOM=\E{, kbs=^H, kcbt=\EI, kcub1=^H, -+ kcud1=^J, kcuf1=^L, kcuu1=^K, kdch1=\EW, kdl1=\ER, ked=\EY, -+ kel=\ET, kent=\E7, kf1=^A@\r, kf10=^AI\r, kf11=^AJ\r, -+ kf12=^AK\r, kf13=^AL\r, kf14=^AM\r, kf15=^AN\r, kf16=^AO\r, -+ kf2=^AA\r, kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, kf6=^AE\r, -+ kf7=^AF\r, kf8=^AG\r, kf9=^AH\r, khome=^^, kich1=\Eq, -+ kil1=\EE, knp=\EK, kpp=\EJ, kprt=\EP, krpl=\Er, ll=^^^K, -+ mc0=\EP, mc4=^T, mc5=\Ed#, -+ pfloc=\EZ2%p1%{63}%+%c%p2%s\177, -+ pfx=\EZ1%p1%{63}%+%c%p2%s\177, -+ pln=\Ez%p1%{47}%+%c%p2%s\r, prot=\E), ri=\Ej$<2>, -+ rmacs=\EcD, rmam=\Ed., rmcup=\Ew0, rmir=\Er, rmln=\EA11, -+ rs1=\E~!\E~4$<30>, rs2=\EeF\E`\:$<70>, -+ rs3=\EwG\Ee($<100>, -+ sgr=%?%p8%t\E)%e\E(%;%?%p9%t\EcE%e\EcD%;\EG%{48}%?%p2%t%{8}%|%;%?%p1%p3%|%p6%|%t%{4}%|%;%?%p4%t%{2}%|%;%?%p1%p5%|%t%{64}%|%;%?%p7%t%{1}%|%;%c, -+ sgr0=\E(\EH\003\EG0\EcD, smacs=\EcE, smam=\Ed/, -+ smcup=\Ew1, smir=\Eq, smln=\EA10, smso=\EGt, tbc=\E0, -+ tsl=\EF, use=adm+sgr, -+ - # --# The first one that we had would lock out the keyboard of you --# sent lots of short lines (like /usr/dict/words) at 9600 baud. --# Try that on your C108 and see if it sends a ^S when you type it. --# If so, you have an old version of the PROMs. -+# lines 24 columns 80 vb - # --# You should configure the C108 to send ^S/^Q before running this. --# It is much faster (at 9600 baud) than the c100 because the delays --# are not fixed. --# new status line display entries for c108-8p: --# <is3> - init str #3 - setup term for status display - --# set programmer mode, select window 2, define window at last --# line of memory, set bkgnd stat mesg there, select window 0. -+wy325-vb|wyse325-vb|wyse-325 with visual bell, -+ bel@, use=wy325, -+ - # --# <tsl> - to status line - select window 2, home cursor, erase to --# end-of-window, 1/2 bright on, goto(line#0, col#?) -+# lines 24 columns 132 - # --# <fsl> - from status line - 1/2 bright off, select window 0 -+wy325-w|wyse325-w|wy325w-24|wyse-325 in wide mode, -+ cols#132, lw#7, nlab#16, wsl#97, -+ cup=\Ea%i%p1%dR%p2%dC, dch1=\EW$<12>, ip=$<4>, -+ rs2=\E`;$<70>, use=wy325, - # --# <dsl> - disable status display - set bkgnd status mesg with --# illegal window # -+# lines 25 columns 80 - # --# There are probably more function keys that should be added but --# I don't know what they are. -+wy325-25|wyse325-25|wy325-80|wyse-325|wyse-325 25 lines, -+ lh@, lines#25, lw@, nlab@, -+ pln@, rs3=\EwG\Ee)$<100>, use=wy325, - # --# No delays needed on c108 because of ^S/^Q handshaking -+# lines 25 columns 132 - # --c108|concept108|c108-8p|concept108-8p|concept 108 w/8 pages, -- is3=\EU\E z"\Ev\001\177 !p\E ;"\E z \Ev \001\177p\Ep\n, -- rmcup=\Ev \001\177p\Ep\r\n, use=c108-4p, --c108-4p|concept108-4p|concept 108 w/4 pages, -- OTbs, eslok, hs, xon, -- pb@, -- acsc=jEkTl\\mMqLxU, cnorm=\Ew, cr=^M, -- cup=\Ea%p1%?%p1%{95}%>%t\001%{96}%-%;%{32}%+%c%p2%?%p2%{95}%>%t\001%{96}%-%;%{32}%+%c, -- cvvis=\EW, dch1=\E 1$<16*>, dsl=\E ;\177, fsl=\Ee\E z\s, -- ind=^J, is1=\EK\E!\E F, -- is3=\EU\E z"\Ev\177 !p\E ;"\E z \Ev \001 p\Ep\n, -- rmacs=\Ej\s, rmcup=\Ev \001 p\Ep\r\n, smacs=\Ej!, -- smcup=\EU\Ev 8p\Ep\r\E\025, -- tsl=\E z"\E?\E\005\EE\Ea %+\s, use=c100, --c108-rv|c108-rv-8p|concept 108 w/8 pages in reverse video, -- rmcup=\Ev \002 p\Ep\r\n, smcup=\EU\Ev 8p\Ep\r, -- use=c108-rv-4p, --c108-rv-4p|concept108rv4p|concept 108 w/4 pages in reverse video, -- flash=\EK$<200>\Ek, is1=\Ek, rmso=\Ee, smso=\EE, -- use=c108-4p, --c108-w|c108-w-8p|concept108-w-8|concept108-w8p|concept 108 w/8 pages in wide mode, -- cols#132, -- is1=\E F\E", rmcup=\Ev ^A0\001D\Ep\r\n, -- smcup=\EU\Ev 8\001D\Ep\r, use=c108-8p, -- --# Concept 100: --# These have only window relative cursor addressing, not screen --# relative. To get it to work right here, smcup/rmcup (which --# were invented for the concept) lock you into a one page --# window for screen style programs. -+wy325-25w|wyse325-25w|wy325 132 columns, -+ lh@, lines#25, lw@, nlab@, -+ pln@, rs3=\EwG\Ee)$<100>, use=wy325-w, - # --# To get out of the one page window, we use a clever trick: --# we set the window size to zero ("\Ev " in rmcup) which the --# terminal recognizes as an error and resets the window to all --# of memory. -+# lines 25 columns 132 vb - # --# This trick works on c100 but does not on c108, sigh. -+wy325-w-vb|wy325-wvb|wyse325-wvb|wyse-325 wide mode reverse video, -+ bel@, use=wy325-w, -+ - # --# Some tty drivers use cr3 for concept, others use nl3, hence --# the delays on cr and ind below. This padding is only needed at --# 9600 baud and up. One or the other is commented out depending on --# local conventions. -+# lines 42 columns 80 - # --# 2 ms padding on <rmcup> isn't always enough. 6 works fine. Maybe --# less than 6 but more than 2 will work. -+wy325-42|wyse325-42|wyse-325 42 lines, -+ lh@, lines#42, lw@, nlab@, -+ pln@, rs3=\EwG\Ee)$<100>, use=wy325, - # --# Note: can't use function keys f7-f10 because they are --# indistinguishable from arrow keys (!), also, del char and --# clear eol use xon/xoff so they probably won't work very well. -+# lines 42 columns 132 - # --# Also note that we don't define insrt/del char/delline/eop/send --# because they don't transmit unless we reset them - I figured --# it was a bad idea to clobber their definitions. -+wy325-42w|wyse325-42w|wyse-325 42 lines wide mode, -+ lh@, lines#42, lw@, nlab@, -+ pln@, rs3=\EwG\Ee)$<100>, use=wy325-w, - # --# The <mc5> sequence changes the escape character to ^^ so that --# escapes will be passed through to the printer. Only trouble --# is that ^^ won't be - ^^ was chosen to be unlikely. --# Unfortunately, if you're sending raster bits through to be --# plotted, any character you choose will be likely, so we lose. -+# lines 42 columns 132 vb - # --# \EQ"\EY(^W (send anything from printer to host, for xon/xoff) --# cannot be # in is2 because it will hang a c100 with no printer --# if sent twice. --c100|concept100|concept|c104|c100-4p|hds concept 100, -- OTbs, am, eo, mir, ul, xenl, -- cols#80, lines#24, pb#9600, vt#8, -- bel=^G, blink=\EC, clear=\E?\E\005$<2*>, cr=$<9>\r, -- cub1=^H, cud1=^J, cuf1=\E=, -- cup=\Ea%p1%{32}%+%c%p2%{32}%+%c, cuu1=\E;, -- dch1=\E\021$<16*>, dim=\EE, dl1=\E\002$<3*>, -- ed=\E\005$<16*>, el=\E\025$<16>, flash=\Ek$<200>\EK, -- ht=\011$<8>, il1=\E\022$<3*>, ind=^J, invis=\EH, ip=$<16*>, -- is1=\EK, -- is2=\EU\Ef\E7\E5\E8\El\ENH\E\0\Eo&\0\Eo'\E\Eo!\0\E\007!\E\010A@ \E4#\:"\E\:a\E4#;"\E\:b\E4#<"\E\:c, -- is3=\Ev $<6>\Ep\n, kbs=^H, kcbt=\E', kctab=\E_, -- kcub1=\E>, kcud1=\E<, kcuf1=\E=, kcuu1=\E;, kdch1=\E^Q, -- kdl1=\E^B, ked=\E^C, kel=\E^S, kf1=\E5, kf2=\E6, kf3=\E7, -- kf4=\E8, kf5=\E9, kf6=\E\:a, kf7=\E\:b, kf8=\E\:c, khome=\E?, -- khts=\E], kich1=\E^P, kil1=\E^R, kind=\E[, knp=\E-, kpp=\E., -- kri=\E\\, krmir=\E\0, mc4=\036o \E\EQ!\EYP\027, -- mc5=\EQ"\EY(\027\EYD\Eo \036, prot=\EI, -- rep=\Er%p1%c%p2%{32}%+%c$<.2*>, rev=\ED, -- rmcup=\Ev $<6>\Ep\r\n, rmir=\E\s\s, rmkx=\Ex, -- rmso=\Ed, rmul=\Eg, sgr0=\EN@, -- smcup=\EU\Ev 8p\Ep\r\E\025$<16>, smir=\E^P, smkx=\EX, -- smso=\ED, smul=\EG, --c100-rv|c100-rv-4p|concept100-rv|c100 rev video, -- cnorm@, cvvis@, flash=\EK$<200>\Ek, is1=\Ek, rmso=\Ee, -- smso=\EE, use=c100, --oc100|oconcept|c100-1p|old 1 page concept 100, -- in, -- is3@, use=c100, -- --# From: Walter Skorski <walt@genetics1.JMP.TJU.EDU>, 16-oct-1996. --# Lots of notes, originally inline, but ncurses doesn't grok that. -+wy325-42w-vb|wy325-42wvb|wyse-325 42 lines wide mode visual bell, -+ bel@, use=wy325-w, - # --# am: not available in power on mode, but turned on with \E[=107;207h in --# is2=. Also, \E=124l in is2= could have been used to prevent needing --# to specify xenl:, but that would have rendered the last space on the --# last line useless. --# bw: Not available in power on mode, but turned on with \E[=107;207h in --# is2=. --# clear: Could be done with \E[2J alone, except that vi (and probably most --# other programs) assume that this also homes the cursor. --# dsl: Go to window 2, go to the beginning of the line, use a line feed to --# scroll the window, and go back to window 1. --# is2: the string may cause a warning to be issued by tic that it --# found a very long line and that it suspects that a comma is missing --# somewhere. This warning can be ignored (unless it comes up more than --# once). The initialization string contains the following commands: -+# lines 43 columns 80 - # --# [Setup mode items changed from factory defaults:] --# \E)0 set alternate character set to --# graphics --# ^O set character set to default --# [In case it wasn't] --# \E[m turn off all attributes --# [In case they weren't off] --# \E[=107; cursor wrap and --# 207h character wrap on --# \E[90;3u set Fkey definitions to "transmit" --# defaults --# \E[92;3u set cursor key definitions to --# "transmit" defaults --# \E[43;1u set shift F13 to transmit... --# \177\E$P\177 --# \E[44;1u set shift F14 to transmit... --# \177\E$Q\177 --# \E[45;1u set shift F15 to transmit... --# \177\E$R\177 --# \E[46;1u set shift F16 to transmit... --# \177\E$S\177 --# \E[200;1u set shift up to transmit... --# \177\E$A\177 --# \E[201;1u set shift down to transmit... --# \177\E$B\177 --# \E[202;1u set shift right to transmit... --# \177\E$C\177 --# \E[203;1u set shift left to transmit... --# \177\E$D\177 --# \E[204;1u set shift home to transmit... --# \177\E$H\177 --# \E[212;1u set backtab to transmit... --# \177\E$I\177 --# \E[213;1u set shift backspace to transmit... --# \177\E$^H\177 --# \E[214;1u set shift del to transmit... --# "\E$\177" --# [Necessary items not mentioned in setup mode:] --# \E[2!w move to window 2 --# \E[25;25w define window as line 25 of memory --# \E[!w move to window 1 --# \E[2*w show current line of window 2 as --# status line --# \E[2+x set meta key to use high bit --# \E[;3+} move underline to bottom of character -+wy325-43|wyse325-43|wyse-325 43 lines, -+ lh@, lines#43, lw@, nlab@, -+ pln@, use=wy325, - # --# All Fkeys are set to their default transmit definitions with \E[90;3u --# in is2=. IMPORTANT: to use this terminal definition, the "quit" stty --# setting MUST be redefined or deactivated, because the default is --# contained in almost all of this terminal's Fkey strings! If for some --# reason "quit" cannot be altered, the Fkeys can, but it would be --# necessary to change ^| to ^] in all of these definitions, and add --# \E[2;029!t to is2. --# lines: is set to 24 because this terminal refuses to treat the 25th --# line normally. --# ll: Not available in power on mode, but turned on with \E[=107;207h in --# is2=. --# lm: Pointless, given that this definition locks a single screen of --# memory into view, but what the hey... --# rmso: Could use \E[1;7!{ to turn off only bold and reverse (leaving any --# other attributes alone), but some programs expect this to turn off --# everything. --# rmul: Could use \E[4!{ to turn off only underline (leaving any other --# attributes alone), but some programs expect this to turn off --# everything. --# sgr: Attributes are set on this terminal with the string \E[ followed by --# a list of attribute code numbers (in decimal, separated by --# semicolons), followed by the character m. The attribute code --# numbers are: --# 1 for bold; --# 2 for dim (which is ignored in power on mode); --# 4 for underline; --# 5 for blinking; --# 7 for inverse; --# 8 for not displayable; and --# =99 for protected (except that there are strange side --# effects to protected characters which make them inadvisable). --# The mapping of terminfo parameters to attributes is as follows: --# %p1 (standout) = bold and inverse together; --# %p2 (underline) = underline; --# %p3 (reverse) = inverse; --# %p4 (blink) = blinking; --# %p5 (dim) is ignored; --# %p6 (bold) = bold; --# %p7 (invisible) = not displayable; --# %p8 (protected) is ignored; and --# %p9 (alt char set) = alt char set. --# The code to do this is: --# \E[0 OUTPUT \E[0 --# %?%p1%p6%O IF (standout; bold) OR --# %t;1 THEN OUTPUT ;1 --# %; ENDIF --# %?%p2 IF underline --# %t;4 THEN OUTPUT ;4 --# %; ENDIF --# %?%p4 IF blink --# %t;5 THEN OUTPUT ;5 --# %; ENDIF --# %?%p1%p3%O IF (standout; reverse) OR --# %t;7 THEN OUTPUT ;7 --# %; ENDIF --# %?%p7 IF invisible --# %t;8 THEN OUTPUT ;8 --# %; ENDIF --# m OUTPUT m --# %?%p9 IF altcharset --# %t^N THEN OUTPUT ^N --# %e^O ELSE OUTPUT ^O --# %; ENDIF --# sgr0: Everything is turned off (including alternate character set), since --# there is no way of knowing what it is that the program wants turned --# off. --# smul: The "underline" attribute is reconfigurable to an overline or --# strikethru, or (as done with \E[;3+} in is2=), to a line at the true --# bottom of the character cell. This was done to allow for more readable --# underlined characters, and to be able to distinguish between an --# underlined space, an underscore, and an underlined underscore. --# xenl: Terminal can be configured to not need this, but this "glitch" --# behavior is actually preferable with autowrap terminals. -+# lines 43 columns 132 - # --# Parameters kf31= thru kf53= actually contain the strings sent by the shifted --# Fkeys. There are no parameters for shifted Fkeys in terminfo. The is2 --# string modifies the 'O' in kf43 to kf46 to a '$'. -+wy325-43w|wyse325-43w|wyse-325 43 lines wide mode, -+ lh@, lines#43, lw@, nlab@, -+ pln@, rs3=\EwG\Ee)$<100>, use=wy325-w, - # --# kcbt was originally ^I but redefined in is2=. --# kHOM was \E[H originally but redefined in is2=, as were a number of --# other keys. --# kDC was originally \177 but redefined in is2=. -+# lines 43 columns 132 vb - # --# kbs: Shift was also ^H originally but redefined as \E$^H in is2=. --# tsl: Go to window 2, then do an hpa=. -+wy325-43w-vb|wy325-43wvb|wyse-325 43 lines wide mode visual bell, -+ bel@, use=wy325-w, -+ -+# Wyse 370 -- 24 line screen with status line. - # --#------- flash=\E[8;3!}^G\E[3;3!} --#------- flash=\E[?5h$<100>\E[?5l --# There are two ways to flash the screen, both of which have their drawbacks. --# The first is to set the bell mode to video, transmit a bell character, and --# set the bell mode back - but to what? There is no way of knowing what the --# user's old bell setting was before we messed with it. Worse, the command to --# set the bell mode also sets the key click volume, and there is no way to say --# "leave that alone", or to know what it's set to, either. --# The second way to do a flash is to set the screen to inverse video, pad for a --# tenth of a second, and set it back - but like before, there's no way to know --# that the screen wasn't ALREADY in inverse video, or that the user may prefer --# it that way. The point is moot anyway, since vi (and probably other --# programs) assume that by defining flash=, you want the computer to use it --# INSTEAD of bel=, rather than as a secondary type of signal. -+# The terminal may have to be set for 8 data bits and 2 stop -+# bits for the arrow keys to work. - # --#------- cvvis=\E[+{ --# The is the power on setting, which is also as visible as the cursor --# gets. --#------- wind=\E[%i%p1%d;%p2%d;%p3%{1}%+%d;%p4%{1}%+%dw --# Windowing is possible, but not defined here because it is also used to --# emulate status line functions. Allowing a program to set a window could --# clobber the status line or render it unusable. There is additional memory, --# but screen scroll functions are destructive and do not make use of it. -+# If you change keyboards the terminal will send different -+# escape sequences. -+# The following definition is for the basic terminal without -+# function keys. - # --#------- dim= Not available in power on mode. --# You have a choice of defining low intensity characters as "half bright" and --# high intensity as "normal", or defining low as "normal" and high as "bold". --# No matter which you choose, only one of either "half bright" or "bold" is --# available at any time, so taking the time to override the default is --# pointless. -+# <u0> -> enter Tektronix 4010/4014 mode -+# <u1> -> exit Tektronix 4010/4014 mode -+# <u2> -> enter ASCII mode (from any ANSI mode) -+# <u3> -> exit ASCII mode (goto native ANSI mode) -+# <u4> -> enter Tek 4207 ANSI mode (from any ANSI mode) -+# <u5> -> exit Tek 4207 mode (goto native ANSI mode) - # --#------- prot=\E[=0;99m --# Not defined, because it appears to have some strange side effects. --#------- pfkey=%?%p1%{24}%<%p1%{30}%>%p1%{54}%<%A%O%t\E[%p1%du\177%p2%s\177%; --#------- pfloc=%?%p1%{24}%<%p1%{30}%>%p1%{54}%<%A%O%t\E[%p1%du\177%p2%s\177%; --#------- pfx=%?%p1%{24}%<%p1%{30}%>%p1%{54}%<%A%O%t\E[%p1%d;1u\177%p2%s\177%; --# Available, but making them available to programs is inadvisable. --# The code to do this is: --# %?%p1%{24}%< IF ((key; 24) <; --# %p1%{30}%> ((key; 30) >; --# %p1%{54}%< (key; 54) < --# %A ) AND --# %O ) OR --# [that is, "IF key < 24 OR (key > 30 AND key < 54)",] --# %t\E[ THEN OUTPUT \E[ --# %p1%d OUTPUT (key) as decimal --# [next line applies to pfx only] --# ;1 OUTPUT ;1 --# u OUTPUT u --# \177 OUTPUT \177 --# %p2%s OUTPUT (string) as string --# \177 OUTPUT \177 --# [DEL chosen as delimiter, but could be any character] --# [implied: ELSE do nothing] --# %; ENDIF -+# Bug: The <op> capability resets attributes. -+wy370-nk|wyse 370 without function keys, -+ am, ccc, hs, mc5i, mir, msgr, xenl, xon, -+ colors#64, cols#80, it#8, lines#24, ncv#48, pairs#64, wsl#80, -+ acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -+ bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l, -+ clear=\E[H\E[J$<40>, cnorm=\E[34h\E[?25h, cr=^M, -+ csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, -+ cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, -+ cup=\E[%i%p1%d;%p2%dH$<1>, cuu=\E[%p1%dA, cuu1=\E[A, -+ cvvis=\E[?25h\E[34l, dch=\E[%p1%dP$<1*>, dch1=\E[P$<1>, -+ dclk=\E[31h, dim=\E[2m, dl=\E[%p1%dM$<2*>, dl1=\E[M$<2>, -+ dsl=\E[40l, ech=\E[%p1%dX$<.1*>, ed=\E[J$<40>, -+ el=\E[K$<10>, el1=\E[1K$<12>, enacs=\E)0, -+ flash=\E[30h\E\,\E[30l$<300>, fsl=\E[1;24r\E8, -+ home=\E[H, hpa=\E[%i%p1%d`, ht=\011$<1>, hts=\EH, -+ ich=\E[%p1%d@$<1*>, il=\E[%p1%dL$<2*>, il1=\E[L$<2>, -+ ind=\n$<2>, -+ initc=\E[66;%p1%d;%?%p2%{250}%<%t%{0}%e%p2%{500}%<%t%{16}%e%p2%{750}%<%t%{32}%e%{48}%;%?%p3%{250}%<%t%{0}%e%p3%{500}%<%t%{4}%e%p3%{750}%<%t%{8}%e%{12}%;%?%p4%{250}%<%t%{0}%e%p4%{500}%<%t%{1}%e%p4%{750}%<%t%{2}%e%{3}%;%{1}%+%+%+%dw, -+ invis=\E[8m, ip=$<1>, is1=\E[90;1"p\E[?5W$<6>, -+ is2=\E[2;4;20;30;40l\E[?1;10;16l\E[12h\E[?7;8;25h, -+ is3=\E>\017\E)0\E(B\E[63;0w\E[m, mc0=\E[0i, mc4=\E[4i, -+ mc5=\E[5i, -+ oc=\E[60w\E[63;0w\E[66;1;4w\E[66;2;13w\E[66;3;16w\E[66;4;49w\E[66;5;51w\E[66;6;61w\E[66;7;64w, -+ op=\E[m, rc=\E8, rev=\E[7m, ri=\EM$<2>, rmacs=^O, -+ rmam=\E[?7l, rmclk=\E[31l, rmcup=\E[ R, rmir=\E[4l, -+ rmkx=\E>, rmso=\E[27m, rmul=\E[24m, -+ rs1=\E[13l\E[3l\E!p\E[?4i, rs2=\E[35h\E[?3l$<8>, -+ rs3=\E[?5l, sc=\E7, setb=\E[62;%p1%dw, setf=\E[61;%p1%dw, -+ sgr=\E[0%?%p2%t;4%;%?%p3%p1%|%t;7%;%?%p4%t;5%;%?%p5%t;2%;%?%p6%t;1%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, -+ sgr0=\E[m\017, smacs=^N, smam=\E[?7h, smcup=\E[ Q, -+ smir=\E[4h, smkx=\E[?1l\E=, smso=\E[7m, smul=\E[4m, -+ tbc=\E[3g, tsl=\E[40l\E[40h\E7\E[99;%i%p1%dH, -+ u0=\E[?38h\E8, u1=\E[?38l\E)0, u2=\E[92;52"p, u3=\E~B, -+ u4=\E[92;76"p, u5=\E%!1\E[90;1"p, vpa=\E[%i%p1%dd, - # --#------- rs2= --# Not defined since anything it might do could be done faster and easier with --# either Meta-Shift-Reset or the main power switch. -+# Function key set for the ASCII (wy-50 compatible) keyboard -+# This is the default 370. - # --#------- smkx=\E[1!z --#------- rmkx=\E[!z --# These sequences apply to the cursor and setup keys only, not to the --# numeric keypad. But it doesn't matter anyway, since making these --# available to programs is inadvisable. --# For the key definitions below, all sequences beginning with \E$ are --# custom and programmed into the terminal via is2. \E$ also has no --# meaning to any other terminal. -+wy370|wyse370|wy370-101k|Wyse 370 with 101 key keyboard, -+ kbs=^H, kcbt=\E[Z, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, -+ kcuu1=\E[A, kdch1=\EOQ, kdl1=\EOQ, kent=\EOM, kf1=\E[?4i, -+ kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, -+ kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, kf2=\E[?3i, -+ kf3=\E[2i, kf4=\E[@, kf5=\E[M, kf6=\E[17~, kf7=\E[18~, -+ kf8=\E[19~, kf9=\E[20~, khome=\E[H, kich1=\EOP, kil1=\EOP, -+ knp=\E[U, kpp=\E[V, use=wy370-nk, - # --#------- cmdch=\E[;%p1%d!t --# Available, but making it available to programs is inadvisable. --#------- smxon=\E[1*q --# Available, but making it available to programs is inadvisable. --# Terminal will send XON/XOFF on buffer overflow. --#------- rmxon=\E[*q --# Available, but making it available to programs is inadvisable. --# Terminal will not notify on buffer overflow. --#------- smm=\E[2+x --#------- rmm=\E[+x --# Available, but making them available to programs is inadvisable. -+# Function key set for the VT-320 (and wy85) compatible keyboard - # --# Printing: --# It's not made clear in the manuals, but based on other ansi/vt type --# terminals, it's a good guess that this terminal is capable of both --# "transparent print" (which doesn't copy data to the screen, and --# therefore needs mc5i: specified to say so) and "auxilliary print" --# (which does duplicate printed data on the screen, in which case mc4= --# and mc5= should use the \E[?4i and \E[?5i strings instead). -- --hds200|Human Designed Systems HDS200, -- am, bw, eslok, hs, km, mc5i, mir, msgr, xenl, xon, -- cols#80, it#8, lines#24, lm#0, -- acsc=``aaffggjjkkllmmnnooqqssttuuvvwwxx~~, bel=^G, -- blink=\E[0;5m, bold=\E[0;1m, cbt=\E[Z, civis=\E[6+{, -- clear=\E[H\E[J, cnorm=\E[+{, cr=^M, -- csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=\E[D, -- cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, cuf1=\E[C, -- cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, -- dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, -- dsl=\E[2!w\r\n\E[!w, ed=\E[J, el=\E[K, el1=\E[1K, -- fsl=\E[!w, home=\E[H, hpa=\E[%i%p1%dG, ht=^I, hts=\EH, -- ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[L, ind=\ED, -- invis=\E[0;8m, -- is2=\E)0\017\E[m\E[=107;207h\E[90;3u\E[92;3u\E[43;1u\177\E$P\177\E[44;1u\177\E$Q\177\E[45;1u\177\E$R\177\E[46;1u\177\E$S\177\E[200;1u\177\E$A\177\E[201;1u\177\E$B\177\E[202;1u\177\E$C\177\E[203;1u\177\E$D\177\E[204;1u\177\E$H\177\E[212;1u\177\E$I\177\E[213;1u\177\E$\010\177\E[214;1u"\E$\177"\E[2!w\E[25;25w\E[!w\E[2*w\E[2+x\E[;3+}, -- kDC=\E$\177, kHOM=\E$H, kLFT=\E$D, kRIT=\E$C, kbs=^H, -- kcbt=\E$I, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, -- kdch1=\177, kent=^M, kf1=^\001\r, kf10=^\010\r, -- kf11=^\011\r, kf12=^\012\r, kf13=\EOP, kf14=\EOQ, -- kf15=\EOR, kf16=\EOS, kf17=^\017\r, kf18=^\018\r, -- kf19=^\019\r, kf2=^\002\r, kf20=^\020\r, kf21=^\021\r, -- kf22=^\022\r, kf23=^\023\r, kf3=^\003\r, kf31=^\031\r, -- kf32=^\032\r, kf33=^\033\r, kf34=^\034\r, kf35=^\035\r, -- kf36=^\036\r, kf37=^\037\r, kf38=^\038\r, kf39=^\039\r, -- kf4=^\004\r, kf40=^\040\r, kf41=^\041\r, kf42=^\042\r, -- kf43=\E$P, kf44=\E$Q, kf45=\E$R, kf46=\E$S, kf47=^\047\r, -- kf48=^\048\r, kf49=^\049\r, kf5=^\005\r, kf50=^\050\r, -- kf51=^\051\r, kf52=^\052\r, kf53=^\053\r, kf6=^\006\r, -- kf7=^\007\r, kf8=^\008\r, kf9=^\009\r, khome=\E[H, -- kind=\E[T, knp=\E[U, kpp=\E[V, kri=\E[S, ll=\E[H\E[A, -- mc0=\E[i, mc4=\E[4i, mc5=\E[5i, nel=\E[E, rc=\E8, -- rev=\E[0;7m, ri=\EM, rmacs=^O, rmir=\E[4l, rmso=\E[m\017, -- rmul=\E[m\017, sc=\E7, -- sgr=\E[0%?%p1%p6%O%t;1%;%?%p2%t;4%;%?%p4%t;5%;%?%p1%p3%O%t;7%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, -- sgr0=\E[m\017, smacs=^N, smir=\E[4h, smso=\E[0;1;7m, -- smul=\E[0;4m, tbc=\E[3g, tsl=\E[2!w\E[%i%p1%dG, -- vpa=\E[%i%p1%dd, -- --# <ht> through <el> included to specify padding needed in raw mode. --# (avt-ns: added empty <acsc> to suppress a tic warning --esr) --avt-ns|concept avt no status line, -- OTbs, am, eo, mir, ul, xenl, xon, -- cols#80, it#8, lines#24, lm#192, -- acsc=, bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, -- clear=\E[H\E[J$<38>, cnorm=\E[=119l, cr=^M, -- csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, -- cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, -- cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, -- cvvis=\E[=119h, dch1=\E[P, dim=\E[1!{, dl=\E[%p1%dM$<4*>, -- dl1=\E[M$<4>, ed=\E[J$<96>, el=\E[K$<6>, home=\E[H, -- hpa=\E[%p1%{1}%+%dG, ht=\011$<4>, hts=\EH, ich=\E[%p1%d@, -- ich1=\E[@, il=\E[%p1%dL$<4*>, il1=\E[L$<4>, ind=\n$<8>, -- invis=\E[8m, ip=$<4>, is1=\E[=103l\E[=205l, -- is2=\E[1*q\E[2!t\E[7!t\E[=4;101;119;122l\E[=107;118;207h\E)1\E[1Q\EW\E[!y\E[!z\E>\E[0\:0\:32!r\E[0*w\E[w\E2\r\n\E[2;27!t, -+wy370-105k|Wyse 370 with 105 key keyboard, - kbs=^H, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, -- kdch1=\E^B\r, ked=\E^D\r, kf1=\EOP, kf2=\EOQ, kf3=\EOR, -- kf4=\EOS, khome=\E[H, kich1=\E^A\r, kil1=\E^C\r, ll=\E[24H, -- mc0=\E[0i, mc4=\E[4i, mc5=\E[5i, -- pfloc=\E[%p1%d;0u#%p2%s#, pfx=\E[%p1%d;1u#%p2%s#, -- prot=\E[99m, rc=\E8, rep=%p1%c\E[%p2%{1}%-%db, rev=\E[7m, -- ri=\EM$<4>, rmacs=\016$<1>, rmcup=\E[w\E2\r\n, -- rmir=\E[4l, rmkx=\E[!z\E[0;2u, rmso=\E[7!{, rmul=\E[4!{, -- sc=\E7, -- sgr=\E[%?%p1%t7;%;%?%p2%t4;%;%?%p3%t7;%;%?%p4%t5;%;%?%p6%t1;%;m, -- sgr0=\E[m, smacs=\017$<1>, smcup=\E[=4l\E[1;24w\E2\r, -- smir=\E[4h, smkx=\E[1!z\E[0;3u, smso=\E[7m, smul=\E[4m, -- tbc=\E[3g, vpa=\E[%p1%{1}%+%dd, --avt-rv-ns|concept avt in reverse video mode/no status line, -- flash=\E[=205l$<200>\E[=205h, is1=\E[=103l\E[=205h, -- use=avt-ns, --avt-w-ns|concept avt in 132 column mode/no status line, -- is1=\E[=103h\E[=205l, smcup=\E[H\E[1;24;1;132w, -- use=avt-ns, --avt-w-rv-ns|concept avt in 132 column mode/no status line/reverse video, -- flash=\E[=205l$<200>\E[=205h, is1=\E[=103h\E[=205h, -- smcup=\E[H\E[1;24;1;132w, use=avt-ns, -- --# Concept AVT with status line. We get the status line using the --# "Background status line" feature of the terminal. We swipe the --# first line of memory in window 2 for the status line, keeping --# 191 lines of memory and 24 screen lines for regular use. --# The first line is used instead of the last so that this works --# on both 4 and 8 page AVTs. (Note the lm#191 or 192 - this --# assumes an 8 page AVT but lm isn't currently used anywhere.) -+ kdch1=\E[3~, kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, -+ kf13=\E[25~, kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, -+ kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, kf20=\E[34~, -+ kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, kfnd=\E[1~, -+ khlp=\E[28~, khome=\E[26~, kich1=\E[2~, knp=\E[6~, -+ kpp=\E[5~, kslt=\E[4~, lf1=PF1, lf2=PF2, lf3=PF3, lf4=PF4, -+ use=wy370-nk, use=vt220+keypad, - # --avt+s|concept avt status line changes, -- eslok, hs, -- lm#191, -- dsl=\E[0*w, fsl=\E[1;1!w, -- is3=\E[2w\E[2!w\E[1;1;1;80w\E[H\E[2*w\E[1!w\E2\r\n, -- rmcup=\E[2w\E2\r\n, smcup=\E[2;25w\E2\r, -- tsl=\E[2;1!w\E[;%p1%dH\E[2K, --avt|avt-s|concept-avt|avt w/80 columns, -- use=avt+s, use=avt-ns, --avt-rv|avt-rv-s|avt reverse video w/sl, -- flash=\E[=205l$<200>\E[=205h, is1=\E[=103l\E[=205h, -- use=avt+s, use=avt-ns, --avt-w|avt-w-s|concept avt 132 cols+status, -- is1=\E[=103h\E[=205l, smcup=\E[H\E[1;24;1;132w, -- use=avt+s, use=avt-ns, --avt-w-rv|avt-w-rv-s|avt wide+status+rv, -- flash=\E[=205l$<200>\E[=205h, is1=\E[=103h\E[=205h, -- smcup=\E[H\E[1;24;1;132w, use=avt+s, use=avt-ns, -- --#### Contel Business Systems. -+# Function key set for the PC compatible keyboard - # -- --# Contel c300 and c320 terminals. --contel300|contel320|c300|Contel Business Systems C-300 or C-320, -- am, in, xon, -- cols#80, lines#24, xmc#1, -- bel=^G, clear=\EK, cr=^M, cub1=^H, cud1=^J, cuf1=\EC, -- cup=\EX%p1%{32}%+%c\EY%p2%{32}%+%c, cuu1=\EA, -- dch1=\EO$<5.5*>, dl1=\EM$<5.5*>, ed=\EJ$<5.5*>, -- el=\EI$<5.5>, flash=\020\002$<200/>\020\003, home=\EH, -- hts=\E1, ich1=\EN, il1=\EL$<5.5*>, ind=^J, ip=$<5.5*>, -- kbs=^H, kf0=\ERJ, kf1=\ERA, kf2=\ERB, kf3=\ERC, kf4=\ERD, -- kf5=\ERE, kf6=\ERF, kf7=\ERG, kf8=\ERH, kf9=\ERI, ll=\EH\EA, -- rmso=\E!\0, sgr0=\E!\0, smso=\E!\r, tbc=\E3, --# Contel c301 and c321 terminals. --contel301|contel321|c301|c321|Contel Business Systems C-301 or C-321, -- flash@, ich1@, ip@, rmso=\E!\0$<20>, smso=\E!\r$<20>, -- use=contel300, -- --#### Data General (dg) -+wy370-EPC|Wyse 370 with 102 key keyboard, -+ kbs=^H, kcbt=\E[Z, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, -+ kcuu1=\E[A, kend=\E[1~, kent=\EOM, kf1=\EOP, kf10=\E[21~, -+ kf11=\E[23~, kf12=\E[24~, kf2=\EOQ, kf3=\EOR, kf4=\EOS, -+ kf5=\E[M, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, -+ khome=\E[H, kich1=\E[2~, knp=\E[U, kpp=\E[V, use=wy370-nk, - # --# According to James Carlson <carlson@xylogics.com> writing in January 1995, --# the terminals group at Data General was shut down in 1991; all these --# terminals have thus been discontinued. -+# Wyse 370 with visual bell. -+wy370-vb|Wyse 370 with visible bell, -+ bel@, use=wy370, - # --# DG terminals have function keys that respond to the SHIFT and CTRL keys, --# e.g., SHIFT-F1 generates a different code from F1. To number the keys --# sequentially, first the unmodified key codes are listed as F1 through F15. --# Then their SHIFT versions are listed as F16 through F30, their CTRL versions --# are listed as F31 through F45, and their CTRL-SHIFT versions are listed as --# F46 through F60. This is done in the private "includes" below whose names --# start with "dgkeys+". -+# Wyse 370 in 132-column mode. -+wy370-w|Wyse 370 in 132-column mode, -+ cols#132, wsl#132, -+ rs2=\E[35h\E[?3h$<70>, use=wy370, - # --# DG terminals generally support 8 bit characters. For each of these terminals --# two descriptions are supplied: --# 1) A default description for 8 bits/character communications, which --# uses the default DG international character set and keyboard codes. --# 2) A description with suffix "-7b" for 7 bits/character communications. --# This description must use the NON-DEFAULT native keyboard language. -- --# Unmodified fkeys (kf1-kf11), Shift fkeys (kf12-kf22), Ctrl fkeys (kf23-kf33), --# Ctrl/Shift fdkeys (kf34-kf44). -- --dgkeys+8b|Private entry describing DG terminal 8-bit ANSI mode special keys, -- ka1=\233020z, ka3=\233021z, kc1=\233022z, kc3=\233023z, -- kclr=\2332J, kcub1=\233D, kcud1=\233B, kcuf1=\233C, -- kcuu1=\233A, kel=\233K, kf1=\233001z, kf10=\233010z, -- kf11=\233011z, kf12=\233012z, kf13=\233013z, -- kf14=\233014z, kf15=\233000z, kf16=\233101z, -- kf17=\233102z, kf18=\233103z, kf19=\233104z, -- kf2=\233002z, kf20=\233105z, kf21=\233106z, -- kf22=\233107z, kf23=\233108z, kf24=\233109z, -- kf25=\233110z, kf26=\233111z, kf27=\233112z, -- kf28=\233113z, kf29=\233114z, kf3=\233003z, -- kf30=\233100z, kf31=\233201z, kf32=\233202z, -- kf33=\233203z, kf34=\233204z, kf35=\233205z, -- kf36=\233206z, kf37=\233207z, kf38=\233208z, -- kf39=\233209z, kf4=\233004z, kf40=\233210z, -- kf41=\233211z, kf42=\233212z, kf43=\233213z, -- kf44=\233214z, kf45=\233200z, kf46=\233301z, -- kf47=\233302z, kf48=\233303z, kf49=\233304z, -- kf5=\233005z, kf50=\233305z, kf51=\233306z, -- kf52=\233307z, kf53=\233308z, kf54=\233309z, -- kf55=\233310z, kf56=\233311z, kf57=\233312z, -- kf58=\233313z, kf59=\233314z, kf6=\233006z, -- kf60=\233300z, kf7=\233007z, kf8=\233008z, kf9=\233009z, -- khome=\233H, kprt=\233i, -- --dgkeys+7b|Private entry describing DG terminal 7-bit ANSI mode special keys, -- ka1=\E[020z, ka3=\E[021z, kc1=\E[022z, kc3=\E[023z, -- kclr=\E[2J, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, -- kel=\E[K, kf1=\E[001z, kf10=\E[010z, kf11=\E[011z, -- kf12=\E[012z, kf13=\E[013z, kf14=\E[014z, kf15=\E[000z, -- kf16=\E[101z, kf17=\E[102z, kf18=\E[103z, kf19=\E[104z, -- kf2=\E[002z, kf20=\E[105z, kf21=\E[106z, kf22=\E[107z, -- kf23=\E[108z, kf24=\E[109z, kf25=\E[110z, kf26=\E[111z, -- kf27=\E[112z, kf28=\E[113z, kf29=\E[114z, kf3=\E[003z, -- kf30=\E[100z, kf31=\E[201z, kf32=\E[202z, kf33=\E[203z, -- kf34=\E[204z, kf35=\E[205z, kf36=\E[206z, kf37=\E[207z, -- kf38=\E[208z, kf39=\E[209z, kf4=\E[004z, kf40=\E[210z, -- kf41=\E[211z, kf42=\E[212z, kf43=\E[213z, kf44=\E[214z, -- kf45=\E[200z, kf46=\E[301z, kf47=\E[302z, kf48=\E[303z, -- kf49=\E[304z, kf5=\E[005z, kf50=\E[305z, kf51=\E[306z, -- kf52=\E[307z, kf53=\E[308z, kf54=\E[309z, kf55=\E[310z, -- kf56=\E[311z, kf57=\E[312z, kf58=\E[313z, kf59=\E[314z, -- kf6=\E[006z, kf60=\E[300z, kf7=\E[007z, kf8=\E[008z, -- kf9=\E[009z, khome=\E[H, kprt=\E[i, -- --dgkeys+11|Private entry describing 11 minimal-subset DG mode special keys, -- kclr=^L, kcub1=^Y, kcud1=^Z, kcuf1=^X, kcuu1=^W, kel=^K, -- kf1=^^q, kf10=^^z, kf11=^^{, kf12=^^a, kf13=^^b, kf14=^^c, -- kf15=^^d, kf16=^^e, kf17=^^f, kf18=^^g, kf19=^^h, kf2=^^r, -- kf20=^^i, kf21=^^j, kf22=^^k, kf23=^^1, kf24=^^2, kf25=^^3, -- kf26=^^4, kf27=^^5, kf28=^^6, kf29=^^7, kf3=^^s, kf30=^^8, -- kf31=^^9, kf32=^^\:, kf33=^^;, kf34=^^!, kf35=^^", kf36=^^#, -- kf37=^^$, kf38=^^%%, kf39=^^&, kf4=^^t, kf40=^^', kf41=^^(, -- kf42=^^), kf43=^^*, kf44=^^+, kf5=^^u, kf6=^^v, kf7=^^w, -- kf8=^^x, kf9=^^y, khome=^H, -- --dgkeys+15|Private entry describing 15 DG mode special keys, -- kHOM=^^^H, kLFT=^^^Y, kRIT=^^^X, ka1=^^\\, ka3=^^], kc1=^^\^, -- kc3=^^_, kf1=^^q, kf10=^^z, kf11=^^{, kf12=^^|, kf13=^^}, -- kf14=^^~, kf15=^^p, kf16=^^a, kf17=^^b, kf18=^^c, kf19=^^d, -- kf2=^^r, kf20=^^e, kf21=^^f, kf22=^^g, kf23=^^h, kf24=^^i, -- kf25=^^j, kf26=^^k, kf27=^^l, kf28=^^m, kf29=^^n, kf3=^^s, -- kf30=^^`, kf31=^^1, kf32=^^2, kf33=^^3, kf34=^^4, kf35=^^5, -- kf36=^^6, kf37=^^7, kf38=^^8, kf39=^^9, kf4=^^t, kf40=^^\:, -- kf41=^^;, kf42=^^<, kf43=^^=, kf44=^^>, kf45=^^0, kf46=^^!, -- kf47=^^", kf48=^^#, kf49=^^$, kf5=^^u, kf50=^^%%, kf51=^^&, -- kf52=^^', kf53=^^(, kf54=^^), kf55=^^*, kf56=^^+, kf57=^^\,, -- kf58=^^-, kf59=^^., kf6=^^v, kf60=^^\s, kf7=^^w, kf8=^^x, -- kf9=^^y, -- --# Data General color terminals use the "Tektronix" color model. The total --# number of colors varies with the terminal model, as does support for --# attributes used in conjunction with color. -- --# Removed u7, u8 definitions since they conflict with tack: --# Preserve user-defined colors in at least some cases. --# u7=^^Fh, --# Default is ACM mode. --# u8=^^F}20^^Fi^^F}21, -+# Wyse 370 in 132-column mode with visual bell. -+wy370-wvb|Wyse 370 with visible bell 132-columns, -+ flash=\E[30h\E\,\E[30l$<300>, use=wy370-w, -+wy370-rv|Wyse 370 reverse video, -+ rs3=\E[32h\E[?5h, use=wy370, - # --dgunix+fixed|Fixed color info for DG D430C terminals in DG-UNIX mode, -- bce, -- colors#16, ncv#53, pairs#256, -- op=\036Ad\036Bd, -- setab=\036B%p1%?%p1%{8}%<%t%{2}%&%?%p1%{1}%&%t%{4}%|%;%?%p1%{4}%&%t%{1}%|%;%;%{48}%+%c, -- setaf=\036A%p1%?%p1%{8}%<%t%{2}%&%?%p1%{1}%&%t%{4}%|%;%?%p1%{4}%&%t%{1}%|%;%;%{48}%+%c, -- setb=\036B%p1%{48}%+%c, setf=\036A%p1%{48}%+%c, -- --dg+fixed|Fixed color info for DG D430C terminals in DG mode, -- use=dgunix+fixed, -- --# Video attributes are coordinated using static variables set by "sgr", then --# checked by "op", "seta[bf]", and "set[bf]" to refresh the attribute settings. --# (D=dim, U=underline, B=blink, R=reverse.) --dg+color8|Color info for Data General D220 and D230C terminals in ANSI mode, -- bce, -- colors#8, ncv#16, pairs#64, -- op=\E[%?%gD%t2;%;%?%gU%t4;%;%?%gB%t5;%;%?%gR%t7;%;m, -- setab=\E[4%p1%d%?%gD%t;2%;%?%gU%t;4%;%?%gB%t;5%;%?%gR%t;7%;m, -- setaf=\E[3%p1%d%?%gD%t;2%;%?%gU%t;4%;%?%gB%t;5%;%?%gR%t;7%;m, -- setb=\E[4%p1%{2}%&%?%p1%{1}%&%t%{4}%|%;%?%p1%{4}%&%t%{1}%|%;%d%?%gD%t;2%;%?%gU%t;4%;%?%gB%t;5%;%?%gR%t;7%;m, -- setf=\E[3%p1%{2}%&%?%p1%{1}%&%t%{4}%|%;%?%p1%{4}%&%t%{1}%|%;%d%?%gD%t;2%;%?%gU%t;4%;%?%gB%t;5%;%?%gR%t;7%;m, -- --dg+color|Color info for Data General D470C terminals in ANSI mode, -- colors#16, ncv#53, pairs#256, -- setab=\E[%?%p1%{8}%<%t4%p1%e=%p1%{2}%&%?%p1%{1}%&%t%{4}%|%;%?%p1%{4}%&%t%{1}%|%;%;%d%?%gD%t;2%;%?%gU%t;4%;%?%gB%t;5%;%?%gR%t;7%;m, -- setaf=\E[%?%p1%{8}%<%t3%p1%e<%p1%{2}%&%?%p1%{1}%&%t%{4}%|%;%?%p1%{4}%&%t%{1}%|%;%;%d%?%gD%t;2%;%?%gU%t;4%;%?%gB%t;5%;%?%gR%t;7%;m, -- setb=\E[%?%p1%{8}%<%t4%e=%;%p1%{2}%&%?%p1%{1}%&%t%{4}%|%;%?%p1%{4}%&%t%{1}%|%;%d%?%gD%t;2%;%?%gU%t;4%;%?%gB%t;5%;%?%gR%t;7%;m, -- setf=\E[%?%p1%{8}%<%t3%e<%;%p1%{2}%&%?%p1%{1}%&%t%{4}%|%;%?%p1%{4}%&%t%{1}%|%;%d%?%gD%t;2%;%?%gU%t;4%;%?%gB%t;5%;%?%gR%t;7%;m, -- use=dg+color8, -- --dgmode+color8|Color info for Data General D220/D230C terminals in DG mode, -- bce, -- colors#8, ncv#16, pairs#64, -- op=\036Ad\036Bd, -- setab=\036B%p1%{2}%&%?%p1%{1}%&%t%{4}%|%;%?%p1%{4}%&%t%{1}%|%;%{48}%+%c, -- setaf=\036A%p1%{2}%&%?%p1%{1}%&%t%{4}%|%;%?%p1%{4}%&%t%{1}%|%;%{48}%+%c, -- setb=\036B%p1%{48}%+%c, setf=\036A%p1%{48}%+%c, -- --dgmode+color|Color info for Data General D470C terminals in DG mode, -- colors#16, pairs#256, -- setab=\036B%p1%?%p1%{8}%<%t%{2}%&%?%p1%{1}%&%t%{4}%|%;%?%p1%{4}%&%t%{1}%|%;%;%{48}%+%c, -- setaf=\036A%p1%?%p1%{8}%<%t%{2}%&%?%p1%{1}%&%t%{4}%|%;%?%p1%{4}%&%t%{1}%|%;%;%{48}%+%c, -- use=dgmode+color8, -- --dgunix+ccc|Configurable color info for DG D430C terminals in DG-UNIX mode, -- bce, ccc, -- colors#52, ncv#53, pairs#26, -- initp=\036RG0%p1%02X%p2%{255}%*%{1000}%/%02X%p3%{255}%*%{1000}%/%02X%p4%{255}%*%{1000}%/%02X%p5%{255}%*%{1000}%/%02X%p6%{255}%*%{1000}%/%02X%p7%{255}%*%{1000}%/%02X, -- oc=\036RG01A00FF00000000\036RG01B00000000FF00\036RG01C007F00000000\036RG01D000000007F00, -- op=\036RF4831A\036RF2E31B\036RF1D31C\036RF3F31D, -- scp=\036RG2%p1%02X, -- --# Colors are in the order: normal, reverse, dim, dim + reverse. --dg+ccc|Configurable color info for DG D430C terminals in DG mode, -- bce, ccc, -- colors#52, ncv#53, pairs#26, -- initp=\036RG0%p1%{16}%/%{48}%+%c%p1%{16}%m%{48}%+%c%p2%{255}%*%{1000}%/%Pa%ga%{16}%/%{48}%+%c%ga%{16}%m%{48}%+%c%p3%{255}%*%{1000}%/%Pa%ga%{16}%/%{48}%+%c%ga%{16}%m%{48}%+%c%p4%{255}%*%{1000}%/%Pa%ga%{16}%/%{48}%+%c%ga%{16}%m%{48}%+%c%p5%{255}%*%{1000}%/%Pa%ga%{16}%/%{48}%+%c%ga%{16}%m%{48}%+%c%p6%{255}%*%{1000}%/%Pa%ga%{16}%/%{48}%+%c%ga%{16}%m%{48}%+%c%p7%{255}%*%{1000}%/%Pa%ga%{16}%/%{48}%+%c%ga%{16}%m%{48}%+%c, -- oc=\036RG01\:00??00000000\036RG01;00000000??00\036RG01<007?00000000\036RG01=000000007?00, -- op=\036RF4831\:\036RF2>31;\036RF1=31<\036RF3?31=, -- scp=\036RG2%p1%{16}%/%{48}%+%c%p1%{16}%m%{48}%+%c, -- --# The generic DG terminal type (an 8-bit-clean subset of the 6053) --# Initialization string 1 sets: --# ^R - vertical scrolling enabled --# ^C - blinking enabled --dg-generic|Generic Data General terminal in DG mode, -- am, bw, msgr, xon, -- cols#80, lines#24, -- bel=^G, blink=^N, clear=^L, cr=^M, cub1=^Y, cud1=^Z, cuf1=^X, -- cup=\020%p2%c%p1%c, cuu1=^W, dim=^\, el=^K, ind=^J, is1=^R^C, -- mc0=^Q, nel=^J, rmso=^], rmul=^U, sgr0=^O^U^], smso=^\, -- smul=^T, use=dgkeys+11, -- --# According to the 4.4BSD termcap file, the dg200 <cup> should be the --# termcap equivalent of \020%p2%{128}%+%c%p1%{128}%+%c (in termcap --# notation that's "^P%r%+\200%+\200"). Those \200s are suspicious, --# maybe they were originally nuls (which would fit). -+# Wyse 99gt Tektronix 4010/4014 emulator, -+# -+wy99gt-tek|Wyse 99gt Tektronix 4010/4014 emulator, -+ am, os, -+ cols#74, lines#35, -+ bel=^G, clear=\E^L, cr=^M, cub1=^H, cud1=^J, cuf1=\s, -+ cup=\035%{3040}%{89}%p1%*%-%Py%p2%{55}%*%Px%gy%{128}%/%{31}%&%{32}%+%c%gy%{3}%&%{4}%*%gx%{3}%&%+%{96}%+%c%gy%{004}%/%{31}%&%{96}%+%c%gx%{128}%/%{31}%&%{32}%+%c%gx%{004}%/%{31}%&%{64}%+%c\037, -+ cuu1=^K, ff=^L, -+ hd=\036HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH\037, -+ home=^]7`x @\037, -+ hu=\036DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD\037, -+ is2=\E8, nel=^M^J, u0=\E~>\E8, u1=\E[42h, -+# -+# Wyse 160 Tektronix 4010/4014 emulator, -+# -+wy160-tek|Wyse 160 Tektronix 4010/4014 emulator, -+ cup=\035%{3103}%{91}%p1%*%-%Py%p2%{55}%*%Px%gy%{128}%/%{31}%&%{32}%+%c%gy%{3}%&%{4}%*%gx%{3}%&%+%{96}%+%c%gy%{004}%/%{31}%&%{96}%+%c%gx%{128}%/%{31}%&%{32}%+%c%gx%{004}%/%{31}%&%{64}%+%c\037, -+ home=^]8`g @\037, use=wy99gt-tek, -+# -+# Wyse 370 Tektronix 4010/4014 emulator, -+# -+wy370-tek|Wyse 370 Tektronix 4010/4014 emulator, -+ am, os, -+ cols#80, lines#36, -+ bel=^G, clear=\E^L, cr=^M, cub1=^H, cud1=^J, cuf1=\s, -+ cup=\035%{775}%{108}%p1%*%{5}%/%-%Py%p2%{64}%*%{4}%+%{5}%/%Px%gy%{32}%/%{31}%&%{32}%+%c%gy%{31}%&%{96}%+%c%gx%{32}%/%{31}%&%{32}%+%c%gx%{31}%&%{64}%+%c\037, -+ cuu1=^K, ff=^L, -+ hd=\036HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH\037, -+ home=^]8g @\037, -+ hu=\036DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD\037, -+ is2=\E8, kbs=^H, kcub1=^H, kcud1=^J, kcuf1=^I, kcuu1=^K, -+ nel=^M^J, u0=\E[?38h\E8, u1=\E[?38l\E)0, - --dg200|data general dasher 200, -- OTbs, am, bw, -- cols#80, lines#24, -- bel=^G, clear=^L, cr=^M, cub1=^Y, cud1=^Z, cuf1=^X, -- cup=\020%p2%c%p1%c, cuu1=^W, el=^K, home=^H, ind=^J, -- kcub1=^Y, kcud1=^Z, kcuf1=^X, kcuu1=^W, kf0=^^z, kf1=^^q, -- kf2=^^r, kf3=^^s, kf4=^^t, kf5=^^u, kf6=^^v, kf7=^^w, kf8=^^x, -- kf9=^^y, khome=^H, lf0=f10, nel=^J, rmso=^^E, rmul=^U, -- smso=^^D, smul=^T, -+# Vendor-supplied Wyse entries end here. - --# Data General 210/211 (and 410?) from Lee Pearson (umich!lp) via BRL --dg210|dg-ansi|Data General 210/211, -- am, -- cols#80, lines#24, -- OTnl=\E[B, clear=\E[2J, cub1=\E[D, cud1=\E[B, cuf1=\E[C, -- cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, ed=\E[J, el=\E[K, -- home=\E[H, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, -- khome=\E[H, nel=\r\E[H\E[A\n, rmso=\E[0;m, rmul=\E[0;m, -- smso=\E[7;m, smul=\E[4;m, --# From: Peter N. Wan <ihnp4!gatech!gacsr!wan> --# courtesy of Carlos Rucalde of Vantage Software, Inc. --# (dg211: this had <cup=\020%r%.%>., which was an ancient termcap hangover. --# I suspect the d200 function keys actually work on the dg211, check it out.) --dg211|Data General d211, -- cnorm=^L, cvvis=^L^R, ht=^I, ind@, kbs=^Y, kf0@, kf1@, kf2@, kf3@, -- kf4@, kf5@, kf6@, kf7@, kf8@, kf9@, lf0@, nel=^M^Z, rmcup=^L, -- rmso=\036E$<\0/>, smcup=^L^R, smso=\036D$<5/>, use=dg200, -- --# dg450 from Cornell (not official) --dg450|dg6134|data general 6134, -- cub1@, cuf1=^X, use=dg200, -- --# Not official... --# Note: lesser Dasher terminals will not work with vi because vi insists upon --# having a command to move straight down from any position on the bottom line --# and scroll the screen up, or a direct vertical scroll command. The 460 and --# above have both, the D210/211, for instance, has neither. We must use ANSI --# mode rather than DG mode because standard UNIX tty drivers assume that ^H is --# backspace on all terminals. This is not so in DG mode. --# (dg460-ansi: removed obsolete ":kn#6:"; also removed ":mu=\EW:", on the --# grounds that there is no matching ":ml:" --# fixed garbled ":k9=\E[00\:z:" capability -- esr) --dg460-ansi|Data General Dasher 460 in ANSI-mode, -- OTbs, am, msgr, ul, -- cols#80, it#8, lines#24, -- OTnl=\ED, blink=\E[5m, clear=\E[2J, cub1=^H, cud1=\E[B, -- cuf1=\E[C, cup=\E[%i%p1%2d;%p2%2dH, cuu1=\E[A, dch1=\E[P, -- dim=\E[2m, dl1=\E[M, ed=\E[J, el=\E[K, home=\E[H, ht=^I, -- ich1=\E[@, il1=\E[L, ind=\E[S, is2=^^F@, kbs=\E[D, -- kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, -- kf0=\E[001z, kf1=\E[002z, kf2=\E[003z, kf3=\E[004z, -- kf4=\E[005z, kf5=\E[006z, kf6=\E[007z, kf7=\E[008z, -- kf8=\E[009z, kf9=\E[010z, khome=\E[H, lf0=f1, lf1=f2, lf2=f3, -- lf3=f4, lf4=f5, lf5=f6, lf6=f7, lf7=f8, lf9=f10, rev=\E[7m, -- ri=\E[T, rmso=\E[m, rmul=\E[05, sgr0=\E[m, smso=\E[7m, -- smul=\E[4m, --# From: Wayne Throop <mcnc!rti-sel!rtp47!throopw> (not official) --# Data General 605x --# Ought to work for a Model 6242, Type D210 as well as a 605x. --# Note that the cursor-down key transmits ^Z. Job control users, beware! --# This also matches a posted description of something called a `Dasher 100' --# so there's a dg100 alias here. --# (dg6053: the 4.4BSD file had <cub1=^H>, <cud1=^J>, <cuf1=^S>. -- esr) --dg6053-old|dg100|data general 6053, -- OTbs, am, bw, ul, -- cols#80, lines#24, -- OTbc=^Y, bel=^G, clear=^L, cnorm=^L, cr=^M, cub1=^Y, cud1=^Z, -- cuf1=^X, cup=\020%p2%c%p1%c, cuu1=^W, cvvis=^L^R, el=^K, -- home=^H, ht=^I, is2=^R, kbs=^Y, kcub1=^Y, kcud1=^Z, kcuf1=^X, -- kcuu1=^W, kf0=^^q, kf1=^^r, kf2=^^s, kf3=^^t, kf4=^^u, kf5=^^v, -- kf6=^^w, kf7=^^x, kf8=^^y, kf9=^^z, khome=^H, rmcup=^L, -- rmso=\0^^E, rmul=^U, smcup=^L^R, smso=\0\0\0\0\0\036D, -- smul=^T, -- --# (Some performance can be gained over the generic DG terminal type) --dg6053|6053|6053-dg|dg605x|605x|605x-dg|d2|d2-dg|Data General DASHER 6053, -- xon@, -- home=^P\0\0, ll=^P\0^W, use=dg-generic, -- --# Like 6053, but adds reverse video and more keypad and function keys. --d200|d200-dg|Data General DASHER D200, -- bold=^^D^T, home@, ll@, rev=^^D, rmso=^^E^], -- sgr=\036%?%p1%p3%|%p6%|%tD%eE%;%?%p2%p6%|%t\024%e\025%;%?%p4%t\016%e\017%;%?%p1%p5%|%t\034%e\035%;, -- sgr0=\017\025\035\036E, smso=^^D^\, use=dgkeys+15, -- use=dg6053, -- --# DASHER D210 series terminals in ANSI mode. --# Reverse video, no insert/delete character/line, 7 bits/character only. - # --# Initialization string 1 sets: --# <0 - scrolling enabled --# <1 - blink enabled --# <4 - print characters regardless of attributes --d210|d214|Data General DASHER D210 series, -- am, bw, msgr, xon, -- cols#80, lines#24, -- bel=^G, blink=\E[5m, bold=\E[4;7m, clear=\E[2J, cr=^M, -- cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=\E[B, -- cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, -- cuu=\E[%p1%dA, cuu1=\E[A, dim=\E[2m, ed=\E[J, el=\E[K, -- el1=\E[1K, home=\E[H, ind=^J, is1=\E[<0;<1;<4l, -- ll=\E[H\E[A, nel=^J, rev=\E[7m, rmso=\E[m, rmul=\E[m, -- sgr=\E[%?%p1%p3%|%p6%|%t7;%;%?%p4%t5;%;%?%p2%p6%|%t4;%;%?%p1%p5%|%t2;%;m, -- sgr0=\E[m, smso=\E[2;7m, smul=\E[4m, use=dgkeys+7b, -- --# DASHER D210 series terminals in DG mode. --# Like D200, but adds clear to end-of-screen and needs XON/XOFF. --d210-dg|d214-dg|Data General DASHER D210 series in DG mode, -- xon, -- ed=^^FF, use=d200-dg, -- --# DASHER D211 series terminals in ANSI mode. --# Like the D210, but with 8-bit characters and local printer support. -+#TITLE: TERMINFO ENTRY WY520 -+#DATE: 8/5/93 -+# The WY520 terminfo is based on the WY285 entry published on the WYSE -+# BBS with the addition of more function keys and special keys. - # --# Initialization string 2 sets: --# \E[2;1;1;1v --# 2;1 - 8 bit operations --# 1;1 - 8 bit (international) keyboard language --# \E(B - default primary character set (U.S. ASCII) --# \E)4 - default secondary character set (international) --# ^O - primary character set -+# rs1 -> set personality -+# rs2 -> set number of columns -+# rs3 -> set number of lines -+# is1 -> select the proper font -+# is2 -> do the initialization -+# is3 -> If this string is empty then rs3 gets sent. - # --d211|d215|Data General DASHER D211 series, -- km, -- is2=\E[2;1;1;1v\E(B\E)4\017, mc0=\E[i, use=dgkeys+8b, -- use=d210, -- --# Initialization string 2 sets: --# \E[2;0;1;0v --# 2;0 - 7 bit operations --# 1;0 - 7 bit (native) keyboard language --# \E(0 - default character set (the keyboard native language) --# ^O - primary character set --d211-7b|d215-7b|Data General DASHER D211 series in 7 bit mode, -- km@, -- is2=\E[2;0;1;0v\E(0\017, use=dgkeys+7b, use=d211, -- --# Like the D210 series, but adds support for 8-bit characters. -+# Wyse 520 emulating a vt420 7 bit mode with default ANSI keyboard -+# - The BS key is programmed to generate BS in smcup since -+# is2 doesn't seem to work. -+# - Remove and shift/Remove: delete a character -+# - Insert : enter insert mode -+# - Find : delete to end of file -+# - Select : clear a line -+# - F11, F12, F13: send default sequences (not ESC, BS, LF) -+# - F14 : Home key -+# - Bottom status line (host writable line) is used. -+# - smkx,rmkx are removed because this would put the numeric -+# keypad in Dec application mode which doesn't seem to work -+# with SCO applications. - # --# Reset string 2 sets: --# ^^N - secondary character set --# ^^FS0> - 8 bit international character set --# ^^O - primary character set --# ^^FS00 - default character set (matching the native keyboard language) -+wy520|wyse520|wyse 520, -+ am, hs, km, mc5i, mir, xenl, xon, -+ cols#80, it#8, lines#24, wsl#80, -+ acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -+ bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l, -+ clear=\E[H\E[J$<40>, cnorm=\E[34h\E[?25h, cr=^M, -+ csr=\E[%i%p1%d;%p2%dr$<20>, cub=\E[%p1%dD, cub1=^H, -+ cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, -+ cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, -+ cvvis=\E[?25h\E[34l, dch=\E[%p1%dP$<3>, dch1=\E[P$<30>, -+ dim=\E[2m, dl=\E[%p1%dM$<2*>, dl1=\E[M$<2>, dsl=\E[0$~, -+ ech=\E[%p1%dX, ed=\E[J$<40>, el=\E[K, el1=\E[1K, -+ enacs=\E)0, fsl=\E[0$}, home=\E[H, hpa=\E[%i%p1%d`, ht=^I, -+ hts=\EH, ich=\E[%p1%d@$<2>, il=\E[%p1%dL$<3*>, -+ il1=\E[L$<3>, ind=\n$<2>, invis=\E[8m, ip=$<4>, is1=\E[?5W, -+ is2=\E[2;4;20;30l\E[?1;4;10;16l\E[12h\E[?7;8;25;67h, -+ is3=\E>\E(B\E)0\017\E[m, kbs=^H, kcbt=\E[Z, kcub1=\E[D, -+ kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[3~, ked=\E[1~, -+ kel=\E[4~, kent=\EOM, kf10=\E[21~, kf11=\E[23~, -+ kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, kf15=\E[28~, -+ kf16=\E[29~, kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, -+ kf20=\E[34~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, -+ kf9=\E[20~, kfnd=\E[1~, khlp=\E[28~, khome=\E[26~, -+ kich1=\E[2~, knp=\E[6~, kpp=\E[5~, kslt=\E[4~, lf1=PF1, -+ lf2=PF2, lf3=PF3, lf4=PF4, mc0=\E[0i, mc4=\E[4i, mc5=\E[5i, -+ rc=\E8, rev=\E[7m, ri=\EM$<2>, rmacs=^O, rmam=\E[?7l, -+ rmcup=\E[ R, rmir=\E[4l, rmso=\E[m, rmul=\E[24m, -+ rs1=\E[13l\E[3l\E\\\E[63;1"p\E[!p, rs2=\E[35h\E[?3l, -+ rs3=\E[?5l\E[47h\E[40l\E[r, sc=\E7, -+ sgr=\E[0%?%p2%t;4%;%?%p3%p1%|%t;7%;%?%p4%t;5%;%?%p5%t;2%;%?%p6%t;1%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, -+ sgr0=\E[m\017, smacs=^N, smam=\E[?7h, -+ smcup=\E[ Q\E[?67;8h, smir=\E[4h, smso=\E[7m, smul=\E[4m, -+ tbc=\E[3g, tsl=\E[2$~\E[1$}\E[%i%p1%d`, -+ vpa=\E[%i%p1%dd, use=vt220+keypad, - # --d211-dg|d215-dg|Data General DASHER D211 series in DG mode, -- km, -- rs2=\036N\036FS0>\036O\036FS00, use=d210-dg, -- --d216-dg|d216e-dg|d216+dg|d216e+dg|d217-dg|Data General DASHER D216 series in DG mode, -- use=d211-dg, -- --# Enhanced DG mode with changes to be more UNIX compatible. --d216-unix|d216e-unix|d216+|d216e+|Data General DASHER D216+ in DG-UNIX mode, -- mc5i, -- it#8, -- acsc=a\177j$k"l!m#n)q+t'u&v(w%x*, blink=^^PI, -- clear=^^PH, cub1=^^PD, cud1=^^PB, cuf1=^^PC, cuu1=^^PA, -- el=^^PE, home=^^PF, hpa=\020%p1%c\177, ht=^I, ind=^J, -- is1=\022\003\036P@1, is3=\036Fz0, kHOM=^^Pf, kLFT=^^Pd, -- kPRT=^^P1, kRIT=^^Pc, kclr=^^PH, kcub1=^^PD, kcud1=^^PB, -- kcuf1=^^PC, kcuu1=^^PA, kel=^^PE, khome=^^PF, kprt=^^P0, -- mc0=\036F?9, mc4=^^Fa, mc5=^^F`, rmacs=\036FS00, -- rs2=\036N\036FS0E\036O\036FS00, -- sgr=\036%?%p1%p3%|%p6%|%tD%eE%;%?%p2%p6%|%t\024%e\025%;\036P%?%p4%tI%eJ%;%?%p1%p5%|%t\034%e\035%;\036FS%?%p9%t11%e00%;, -- sgr0=\036PJ\025\035\036E\036FS00, smacs=\036FS11, -- vpa=\020\177%p1%c, use=dgkeys+15, use=d216-dg, --d216-unix-25|d216+25|Data General DASHER D216+ in DG-UNIX mode with 25 lines, -- lines#25, -- is3=\036Fz2, use=d216+, -- --d217-unix|Data General DASHER D217 in DG-UNIX mode, -- use=d216-unix, --d217-unix-25|Data General DASHER D217 in DG-UNIX mode with 25 lines, -- use=d216-unix-25, -- --# DASHER D220 color terminal in ANSI mode. --# Like the D470C but with fewer colors and screen editing features. -+# Wyse 520 with 24 data lines and status (terminal status) -+wy520-24|wyse520-24|wyse 520 with 24 data lines, -+ hs@, -+ dsl@, fsl@, rs3=\E[?5l\E[47h\E[40l\E[1;24r, tsl@, -+ use=wy520, - # --# Initialization string 1 sets: --# \E[<0;<1;<4l --# <0 - scrolling enabled --# <1 - blink enabled --# <4 - print characters regardless of attributes --# \E[m - all attributes off --# Reset string 1 sets: --# \Ec - initial mode defaults (RIS) -+# Wyse 520 with visual bell. -+wy520-vb|wyse520-vb|wyse 520 with visible bell, -+ flash=\E[30h\E\,\E[30l$<100>, use=wy520, - # --d220|Data General DASHER D220, -- mc5i@, -- dl@, dl1@, il@, il1@, is1=\E[<0;<1;<4l\E[m, mc4@, mc5@, rs1=\Ec, -- use=dg+color8, use=d470c, -- --d220-7b|Data General DASHER D220 in 7 bit mode, -- mc5i@, -- dl@, dl1@, il@, il1@, is1=\E[<0;<1;<4l\E[m, mc4@, mc5@, rs1=\Ec, -- use=dg+color8, use=d470c-7b, -- --# Initialization string 3 sets: --# - default cursor (solid rectangle) --# Reset string 2 sets: --# ^^N - secondary character set --# ^^FS0> - 8 bit international character set --# ^^O - primary character set --# ^^FS00 - default character set (matching the native keyboard language) -+# Wyse 520 in 132-column mode. -+wy520-w|wyse520-w|wyse 520 in 132-column mode, -+ cols#132, wsl#132, -+ dch=\E[%p1%dP$<7>, dch1=\E[P$<7>, ich=\E[%p1%d@$<7>, -+ ip=$<7>, rs2=\E[35h\E[?3h, use=wy520, - # --d220-dg|Data General DASHER D220 color terminal in DG mode, -- mc5i@, -- dl1@, home@, il1@, is2@, is3=\036FQ2, ll@, mc4@, mc5@, rs1@, -- rs2=\036N\036FS0>\036O\036FS00, use=dgmode+color8, -- use=d470c-dg, -- --# DASHER D230C color terminal in ANSI mode. --# Like the D220 but with minor ANSI compatibility improvements. -+# Wyse 520 in 132-column mode with visual bell. -+wy520-wvb|wyse520-wvb|wyse 520 with visible bell 132-columns, -+ flash=\E[30h\E\,\E[30l$<100>, use=wy520-w, - # --d230c|d230|Data General DASHER D230C, -- blink=\E[5;50m, bold=\E[4;7;50m, dim=\E[2;50m, nel=^M^J, -- rev=\E[7;50m, rmkx=\E[2;1v, rmso=\E[50m, rmul=\E[50m, -- sgr=\E[50%?%p1%p3%|%p6%|%t;7%{1}%e%{0}%;%PR%?%p4%t;5%{1}%e%{0}%;%PB%?%p2%p6%|%t;4%{1}%e%{0}%;%PU%?%p1%p5%|%t;2%{1}%e%{0}%;%PDm\E)%?%p9%t6\016%e4\017%;, -- sgr0=\E[50m\E)4\017, smkx=\E[2;0v, smso=\E[2;7;50m, -- smul=\E[4;50m, use=dgkeys+7b, use=d220, -- --d230c-dg|d230-dg|Data General DASHER D230C in DG mode, -- use=d220-dg, -- --# DASHER D400/D450 series terminals. --# These add intelligent features like insert/delete to the D200 series. - # --# Initialization string 2 sets: --# ^^FQ2 - default cursor (solid rectangle) --# ^^FW - character protection disabled --# ^^FJ - normal (80 column) mode --# ^^F\^ - horizontal scrolling enabled (for alignment) --# ^^FX004? - margins at columns 0 and 79 --# ^^F] - horizontal scrolling disabled --# ^^O - primary character set --# ^^FS00 - default character set (the keyboard native language) --# - (should reset scrolling regions, but that glitches the screen) --# Reset string 1 sets: --# ^^FA - all terminal defaults except scroll rate --# Reset string 2 sets: --# ^^F] - horizontal scrolling disabled --# ^^FT0 - jump scrolling -+# Wyse 520 emulating a vt420 7 bit mode. -+# The DEL key is programmed to generate BS in is2. -+# With EPC keyboard. -+# - 'End' key will clear till end of line on EPC keyboard -+# - Shift/End : ignored. -+# - Insert : enter insert mode. -+# - Delete : delete a character (have to change interrupt character -+# to CTRL-C: stty intr '^c') for it to work since the -+# Delete key sends 7FH. -+wy520-epc|wyse520-epc|wyse 520 with EPC keyboard, -+ kdch1=\177, kel=\E[4~, kend=\E[4~, kf0=\E[21~, kf1=\E[11~, -+ kf2=\E[12~, kf3=\E[13~, kf4=\E[14~, kf5=\E[15~, khome=\E[H, -+ use=wy520, - # --d400|d400-dg|d450|d450-dg|Data General DASHER D400/D450 series, -- mc5i, -- acsc=j$k"l!m#n)q+t'u&v(w%x*, civis=\036FQ0, -- cnorm=\036FQ2, dch1=^^K, dl1=^^FI, -- enacs=\036N\036FS11\036O, home=^^FG, hpa=\020%p1%c\177, -- ich1=^^J, il1=^^FH, -- is2=\036FQ2\036FW\036FJ\036F\^\036FX004?\036F]\036O\036FS00, -- ll=\036FG\027, mc4=^^Fa, mc5=^^F`, ri=^^I, rmacs=^^O, -- rs1=^^FA, rs2=\036F]\036FT0, -- sgr=\036%?%p1%p3%|%p6%|%tD%eE%;%?%p2%p6%|%t\024%e\025%;%?%p4%t\016%e\017%;%?%p1%p5%|%t\034%e\035%;\036%?%p9%tN%eO%;, -- sgr0=\017\025\035\036E\036O, smacs=^^N, -- vpa=\020\177%p1%c, use=d210-dg, -- --# DASHER D410/D460 series terminals in ANSI mode. --# These add a large number of intelligent terminal features. -+# Wyse 520 with 24 data lines and status (terminal status) -+# with EPC keyboard. -+wy520-epc-24|wyse520-pc-24|wyse 520 with 24 data lines and EPC keyboard, -+ hs@, -+ dsl@, fsl@, rs3=\E[?5l\E[47h\E[40l\E[1;24r, tsl@, -+ use=wy520-epc, - # --# Initialization string 1 sets: --# \E[<0;<1;<2;<4l --# <0 - scrolling enabled --# <1 - blink enabled --# <2 - horizontal scrolling enabled (for alignment) --# <4 - print characters regardless of attributes --# \E[5;0v - normal (80 column) mode --# \E[1;1;80w - margins at columns 1 and 80 --# \E[1;6;<2h --# 1 - print all characters even if protected --# 6 - character protection disabled --# <2 - horizontal scrolling disabled --# - (should reset scrolling regions, but that glitches the screen) -+# Wyse 520 with visual bell. -+wy520-epc-vb|wyse520-pc-vb|wyse 520 with visible bell and EPC keyboard, -+ flash=\E[30h\E\,\E[30l$<100>, use=wy520-epc, - # --# Initialization string 2 sets: --# \E[3;2;2;1;1;1v --# 3;2 - default cursor (solid rectangle) --# 2;1 - 8 bit operations --# 1;1 - international keyboard language --# \E(B - default primary character set (U.S. ASCII) --# \E)4 - default secondary character set (international) --# ^O - primary character set -+# Wyse 520 in 132-column mode. -+wy520-epc-w|wyse520-epc-w|wyse 520 in 132-column mode with EPC keyboard, -+ cols#132, wsl#132, -+ dch=\E[%p1%dP$<7>, dch1=\E[P$<7>, ich=\E[%p1%d@$<7>, -+ ip=$<7>, rs2=\E[35h\E[?3h, use=wy520-epc, - # --# Reset string 1 sets: --# \Ec - initial mode defaults (RIS) --# \E[<2h - horizontal scrolling disabled -+# Wyse 520 in 132-column mode with visual bell. -+wy520-epc-wvb|wyse520-p-wvb|wyse 520 with visible bell 132-columns and EPC keyboard, -+ flash=\E[30h\E\,\E[30l$<100>, use=wy520-epc-w, - # --# Reset string 2 sets: --# \E[4;0;2;1;1;1v --# 4;0 - jump scrolling --# 2;1 - 8 bit operations --# 1;1 - 8 bit (international) keyboard language --# \E(B - default primary character set (U.S. ASCII) --# \E)4 - default secondary character set (international) -+# Wyse 520 in 80-column, 36 lines -+wy520-36|wyse520-36|wyse 520 with 36 data lines, -+ hs@, -+ lines#36, -+ dsl@, fsl@, rs3=\E[?5l\E[36*|\E[36t\E[40l\E[1;36r, tsl@, -+ use=wy520, - # --d410|d411|d460|d461|Data General DASHER D410/D460 series, -- mc5i, -- acsc=j$k"l!m#n)q+t'u&v(w%x*, civis=\E[3;0v, -- cnorm=\E[3;2v, dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, -- dl1=\E[M, ich=\E[%p1%d@, ich1=\E[@, il=\E[%p1%dL, il1=\E[L, -- is1=\E[<0;<1;<2;<4l\E[5;0v\E[1;1;80w\E[1;6;<2h, -- is2=\E[3;2;2;1;1;1v\E(B\E)4\017, mc4=\E[4i, mc5=\E[5i, -- ri=\EM, rmacs=\E)4\017, rs1=\Ec\E[<2h, -- rs2=\E[4;0;2;1;1;1v\E(B\E)4, -- sgr=\E[%?%p1%p3%|%p6%|%t7;%;%?%p4%t5;%;%?%p2%p6%|%t4;%;%?%p1%p5%|%t2;%;m\E)%?%p9%t6\016%e4\017%;, -- sgr0=\E[m\E)4\017, smacs=\E)6\016, use=d211, -- --# Initialization string 2 sets: --# \E[3;2;2;0;1;0v --# 3;2 - default cursor (solid rectangle) --# 2;0 - 7 bit operations --# 1;0 - 7 bit (native) keyboard language --# \E(0 - default character set (the keyboard native language) --# ^O - primary character set -+# Wyse 520 in 80-column, 48 lines -+wy520-48|wyse520-48|wyse 520 with 48 data lines, -+ hs@, -+ lines#48, -+ dsl@, fsl@, rs3=\E[?5l\E[48*|\E[48t\E[40l\E[1;48r, tsl@, -+ use=wy520, - # --# Reset string 2 sets: --# \E[4;0;2;0;1;0v --# 4;0 - jump scrolling --# 2;0 - 7 bit operations --# 1;0 - 7 bit (native) keyboard language --# \E(0 - default character set (the keyboard native language) -+# Wyse 520 in 132-column, 36 lines -+wy520-36w|wyse520-36w|wyse 520 with 132 columns and 36 data lines, -+ cols#132, wsl#132, -+ rs2=\E[?3h, -+ rs3=\E[?5l\E[36*|\E[36t\E[40l\E[1;36r\E[132$|, -+ use=wy520-36, - # --d410-7b|d411-7b|d460-7b|d461-7b|Data General DASHER D410/D460 series in 7 bit mode, -- km@, -- enacs=\E)6, is2=\E[3;2;2;0;1;0v\E(0\017, rmacs=^O, -- rs2=\E[4;0;2;0;1;0v\E(0, -- sgr=\E[%?%p1%p3%|%p6%|%t7;%;%?%p4%t5;%;%?%p2%p6%|%t4;%;%?%p1%p5%|%t2;%;m%?%p9%t\016%e\017%;, -- sgr0=\E[m\017, smacs=^N, use=dgkeys+7b, use=d410, -- --d410-dg|d460-dg|d411-dg|d461-dg|Data General DASHER D410/D460 series in DG mode, -- km, -- enacs@, rmacs=\036FS00, -- sgr=\036%?%p1%p3%|%p6%|%tD%eE%;%?%p2%p6%|%t\024%e\025%;%?%p4%t\016%e\017%;%?%p1%p5%|%t\034%e\035%;\036FS%?%p9%t11%e00%;, -- sgr0=\017\025\035\036E\036FS00, smacs=\036FS11, -- use=d400-dg, -- --# DASHER D410/D460 series terminals in wide (126 columns) ANSI mode. -+# Wyse 520 in 132-column, 48 lines -+wy520-48w|wyse520-48w|wyse 520 with 48 data lines, -+ cols#132, wsl#132, -+ rs2=\E[?3h, -+ rs3=\E[?5l\E[48*|\E[48t\E[40l\E[1;48r\E[132$|, -+ use=wy520-48, - # --# Initialization string 1 sets: --# \E[<0;<1;<2;<4l --# <0 - scrolling enabled --# <1 - blink enabled --# <2 - horizontal scrolling enabled (for alignment) --# <4 - print characters regardless of attributes --# \E[5;1v - compressed (135 column) mode --# \E[1;1;126 - margins at columns 1 and 126 --# \E[1;6;<2h --# 1 - print all characters even if protected --# 6 - character protection disabled --# <2 - horizontal scrolling disabled --# - (should reset scrolling regions, but that glitches the screen) - # --# Reset string 1 sets: --# \Ec - initial mode defaults (RIS) --# \E[5;1v - compressed (135 column) mode --# \E[1;1;126w - margins at columns 1 and 126 --# \E[<2h - horizontal scrolling disabled -+# Wyse 520 in 80-column, 36 lines with EPC keyboard -+wy520-36pc|wyse520-36pc|wyse 520 with 36 data lines and EPC keyboard, -+ hs@, -+ lines#36, -+ dsl@, fsl@, rs3=\E[?5l\E[36*|\E[36t\E[40l\E[1;36r, tsl@, -+ use=wy520-epc, - # --d410-w|d411-w|d460-w|d461-w|Data General DASHER D410/D460 series in wide mode, -- cols#126, -- is1=\E[<0;<1;<2;<4l\E[5;1v\E[1;1;126w\E[1;6;<2h, -- rs1=\Ec\E[5;1v\E[1;1;126w\E[<2h, use=d410, -+# Wyse 520 in 80-column, 48 lines with EPC keyboard -+wy520-48pc|wyse520-48pc|wyse 520 with 48 data lines and EPC keyboard, -+ hs@, -+ lines#48, -+ dsl@, fsl@, rs3=\E[?5l\E[48*|\E[48t\E[40l\E[1;48r, tsl@, -+ use=wy520-epc, -+# -+# Wyse 520 in 132-column, 36 lines with EPC keyboard -+wy520-36wpc|wyse520-36wpc|wyse 520 with 36 data lines and EPC keyboard, -+ cols#132, wsl#132, -+ rs2=\E[?3h, -+ rs3=\E[?5l\E[36*|\E[36t\E[40l\E[1;36r\E[132$|, -+ use=wy520-36pc, -+# -+# Wyse 520 in 132-column, 48 lines with EPC keyboard -+wy520-48wpc|wyse520-48wpc|wyse 520 with 48 data lines and EPC keyboard, -+ cols#132, wsl#132, -+ rs2=\E[?3h, -+ rs3=\E[?5l\E[48*|\E[48t\E[40l\E[1;48r\E[132$|, -+ use=wy520-48pc, - --d410-7b-w|d411-7b-w|d460-7b-w|d461-7b-w|Data General DASHER D410/D460 series in wide 7 bit mode, -- cols#126, -- is1=\E[<0;<1;<2;<4l\E[5;1v\E[1;1;126w\E[1;6;<2h, -- rs1=\Ec\E[5;1v\E[1;1;126w\E[<2h, use=d410-7b, -+# From: John Gilmore <hoptoad!gnu@lll-crg.arpa> -+# (wyse-vp: removed <if=/usr/share/tabset/wyse-adds>, there's no such -+# file and we don't know what <hts> is -- esr) -+wyse-vp|Wyse 50 in ADDS Viewpoint emulation mode with "enhance" on, -+ OTbs, am, -+ cols#80, it#8, lines#24, -+ bel=^G, clear=^L, cr=^M, cub1=^H, cud1=^J, cuf1=^F, -+ cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=^Z, dch1=\EW, -+ dl1=\El, ed=\Ek, el=\EK, home=^A, ht=^I, il1=\EM, ind=^J, -+ is2=\E`\:\E`9\017\Er, kbs=^H, kcub1=^U, kcud1=^J, kcuf1=^F, -+ kcuu1=^Z, khome=^A, ll=^A^Z, nel=^M^J, rmir=\Er, rmso=^O, -+ rmul=^O, rs1=\E`\:\E`9\017\Er, sgr0=^O, smir=\Eq, smso=^N, -+ smul=^N, - --d412-dg|d462-dg|d462e-dg|d412+dg|d462+dg|d413-dg|d463-dg|Data General DASHER D412/D462 series in DG mode, -- use=d410-dg, -+wy75ap|wyse75ap|wy-75ap|wyse-75ap|Wyse WY-75 Applications and Cursor keypad, -+ is2=\E[1;24r\E[?10;3l\E[?1;25h\E[4l\E[m\E(B\E=, -+ kbs=^H, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, -+ khome=\EOH, rmkx=\E[?1l\E>$<10/>, smkx=\E[?1h\E=$<10/>, -+ use=wy75, - --# These add intelligent features like scrolling regions. --d412-unix|d462-unix|d412+|d462+|Data General DASHER D412+/D462+ series in Unix mode, -- civis=\036FQ0, clear=^^FE, cnorm=\036FQ5, -- cup=\036FP%p2%2.2X%p1%2.2X, dch1=^^K, dl1=^^FI, -- home=^^FG, hpa=\036FP%p1%2.2XFF, ich1=^^J, il1=^^FH, -- is2=\036FQ5\036FW\036FJ\036F\^\036FX004F\036O\036FS00, -- ll=\036FG\036PA, mc0=^A, rc=\036F}11, ri=^^I, -- rs1=\036FA\036FT0, rs2=\036P@1, sc=\036F}10, -- vpa=\036FPFF%p1%2.2X, -- wind=\036FB%?%p1%t%p1%2.2X0%;%p2%p1%-%{1}%+%2.2X0%?%{23}%p2%>%t000%;\036FX%p3%2.2X%p4%2.2X, -- use=d216+, --d412-unix-w|d462-unix-w|d412+w|d462+w|Data General DASHER D412+/D462+ series in wide Unix mode, -- cols#132, -- is2=\036FQ5\036FW\036FK\036F\^\036FX0083\036O\036FS00, -- rs2=\036P@1\036FK\036FX0083, -- wind=\036FB%?%p1%t%p1%2.2X1%;%p2%p1%-%{1}%+%2.2X1%?%{23}%p2%>%t001%;\036FX%p3%2.2X%p4%2.2X, -- use=d412-unix, --d412-unix-25|d462-unix-25|d412+25|d462+25|Data General DASHER D412+/D462+ series in Unix mode with 25 lines, -- lines#25, -- is3=\036Fz2, -- wind=\036FB%?%p1%t%p1%2.2X0%;%p2%p1%-%{1}%+%2.2X0%?%{24}%p2%>%t000%;\036FX%p3%2.2X%p4%2.2X, -- use=d462+, --d412-unix-s|d462-unix-s|d412+s|d462+s|Data General DASHER D412+/D462+ in Unix mode with status line, -- eslok, hs, -- clear=\036FG\036PH, fsl=\036F}01\022, -- is3=\036Fz2\036F}00\036FB180000\036F}01, ll@, -- tsl=\036F}00\036FP%p1%2.2X18\036PG, -- wind=\036FB%?%p1%t%p1%2.2X0%;%p2%p1%-%{1}%+%2.2X0%?%{23}%p2%>%t%{23}%p2%-%2.2X0%;000\036FX%p3%2.2X%p4%2.2X, -- use=d462+, -- --# Relative cursor motions are confined to the current window, --# which is not what the scrolling region specification expects. --# Thus, relative vertical cursor positioning must be deleted. --d412-unix-sr|d462-unix-sr|d412+sr|d462+sr|Data General DASHER D412+/D462+ in Unix mode with scrolling region, -- csr=\036FB%?%p1%t%p1%2.2X0%;%p2%p1%-%{1}%+%2.2X0%?%{23}%p2%>%t000%;, -- cud1@, cuu1@, ll@, use=d462+, -- --d413-unix|d463-unix|Data General DASHER D413/D463 series in DG-UNIX mode, -- use=d412-unix, --d413-unix-w|d463-unix-w|Data General DASHER D413/D463 series in wide DG-UNIX mode, -- use=d412-unix-w, --d413-unix-25|d463-unix-25|Data General DASHER D413/D463 series in DG-UNIX mode with 25 lines, -- use=d412-unix-25, --d413-unix-s|d463-unix-s|Data General DASHER D413/D463 in DG-UNIX mode with status line, -- use=d412-unix-s, --d413-unix-sr|d463-unix-sr|Data General DASHER D413/D463 in DG-UNIX mode with scrolling region, -- use=d412-unix-sr, -- --d414-unix|d464-unix|Data General D414/D464 in DG-UNIX mode, -- use=d413-unix, --d414-unix-w|d464-unix-w|Data General D414/D464 in wide DG-UNIX mode, -- use=d413-unix-w, --d414-unix-25|d464-unix-25|Data General D414/D464 in DG-UNIX mode with 25 lines, -- use=d413-unix-25, --d414-unix-s|d464-unix-s|Data General D414/D464 in DG-UNIX mode with status line, -- use=d413-unix-s, --d414-unix-sr|d464-unix-sr|Data General D414/D464 in DG-UNIX mode with scrolling region, -- use=d413-unix-sr, -- --d430c-dg|d430-dg|Data General D430C in DG mode, -- use=d413-dg, use=dg+fixed, --d430c-dg-ccc|d430-dg-ccc|Data General D430C in DG mode with configurable colors, -- use=d413-dg, use=dg+ccc, -- --d430c-unix|d430-unix|Data General D430C in DG-UNIX mode, -- use=d413-unix, use=dgunix+fixed, --d430c-unix-w|d430-unix-w|Data General D430C in wide DG-UNIX mode, -- use=d413-unix-w, use=dgunix+fixed, --d430c-unix-25|d430-unix-25|Data General D430C in DG-UNIX mode with 25 lines, -- use=d413-unix-25, use=dgunix+fixed, --d430c-unix-s|d430-unix-s|Data General D430C in DG-UNIX mode with status line, -- use=d413-unix-s, use=dgunix+fixed, --d430c-unix-sr|d430-unix-sr|Data General D430C in DG-UNIX mode with scrolling region, -- use=d413-unix-sr, use=dgunix+fixed, --d430c-unix-ccc|d430-unix-ccc|Data General D430C in DG-UNIX mode with configurable colors, -- use=d413-unix, use=dgunix+ccc, --d430c-unix-w-ccc|d430-unix-w-ccc|Data General D430C in wide DG-UNIX mode with configurable colors, -- use=d413-unix-w, use=dgunix+ccc, --d430c-unix-25-ccc|d430-unix-25-ccc|Data General D430C in DG-UNIX mode with 25 lines and configurable colors, -- use=d413-unix-25, use=dgunix+ccc, --d430c-unix-s-ccc|d430-unix-s-ccc|Data General D430C in DG-UNIX mode with status line and configurable colors, -- use=d413-unix-s, use=dgunix+ccc, --d430c-unix-sr-ccc|d430-unix-sr-ccc|Data General D430C in DG-UNIX mode with scrolling region and configurable colors, -- use=d413-unix-sr, use=dgunix+ccc, -+# From: Eric Freudenthal <freudent@eric.ultra.nyu.edu> -+wy100q|Wyse 100 for Quotron, -+ OTbs, -+ cols#80, lines#24, xmc#1, -+ cbt=\EI, clear=^Z, cub1=^H, cud1=^J, cuf1=^L, -+ cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW, -+ dl1=\ER, ed=\EY, el=\ET, home=^^, il1=\EE, invis@, -+ is2=\E`\:\0\EC\EDF\E0\E'\E(\EA21, kcub1=^H, kcud1=^J, -+ kcuf1=^L, kcuu1=^K, ri=\Ej, rmir=\Er, smir=\Eq, use=adm+sgr, - --# DASHER D470C color terminal in ANSI mode. --# Like the D460 but with 16 colors and without a compressed mode. -+#### Kermit terminal emulations - # --# Initialization string 1 sets: --# \E[<0;<1;<2;<4l --# <0 - scrolling enabled --# <1 - blink enabled --# <2 - horizontal scrolling enabled (for alignment) --# <4 - print characters regardless of attributes --# \E[1;1;80w - margins at columns 1 and 80 --# \E[1;6;<2h --# 1 - print all characters even if protected --# 6 - character protection disabled --# <2 - horizontal scrolling disabled --# - (should reset scrolling regions, but that glitches the screen) -+# Obsolete Kermit versions may be listed in the section describing obsolete -+# non-ANSI terminal emulators later in the file. - # --d470c|d470|Data General DASHER D470C, -- is1=\E[<0;<1;<2;<4l\E[1;1;80w\E[1;6;<2h, -- sgr=\E[%?%p1%p3%|%p6%|%t7;%{1}%e%{0}%;%PR%?%p4%t5;%{1}%e%{0}%;%PB%?%p2%p6%|%t4;%{1}%e%{0}%;%PU%?%p1%p5%|%t2;%{1}%e%{0}%;%PDm\E)%?%p9%t6\016%e4\017%;, -- use=dg+color, use=d460, - --d470c-7b|d470-7b|Data General DASHER D470C in 7 bit mode, -- is1=\E[<0;<1;<2;<4l\E[1;1;80w\E[1;6;<2h, -- sgr=\E[%?%p1%p3%|%p6%|%t7;%{1}%e%{0}%;%PR%?%p4%t5;%{1}%e%{0}%;%PB%?%p2%p6%|%t4;%{1}%e%{0}%;%PU%?%p1%p5%|%t2;%{1}%e%{0}%;%PDm%?%p9%t\016%e\017%;, -- use=dg+color, use=d460-7b, -+# KERMIT standard all versions. -+# Straight ascii keyboard. :sr=\EI: not avail. many versions + bug prone in vi. -+# (kermit: removed obsolete ":ma=^Hh^Jj^Kk^Ll^^H:" -- esr) -+# From: greg small <gts@populi.berkeley.edu> 9-25-84 -+kermit|standard kermit, -+ OTbs, -+ cols#80, lines#24, -+ clear=\EE, cub1=^H, cud1=\EB, cuf1=\EC, -+ cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, ed=\EJ, -+ el=\EK, home=\EH, is2=K0 Standard Kermit 9-25-84\n, -+ kcub1=^H, kcud1=^J, kcuf1=^L, kcuu1=^K, khome=^^, -+kermit-am|standard kermit plus auto-margin, -+ am, -+ is2=K1 Standard Kermit plus Automatic Margins\n, -+ use=kermit, -+# IBMPC Kermit 1.2. -+# Bugs: <ed>, <el>: do not work except at beginning of line! <clear> does -+# not work, but fake with :cl=\EH\EJ (since :cd=\EJ: works at beginning of -+# line). -+# From: greg small <gts@populi.berkeley.edu> 8-30-84 -+pckermit|pckermit12|UCB IBMPC Kermit 1.2, -+ am, -+ lines#25, -+ clear=\EH\EJ, ed@, el@, -+ is2=K2 UCB IBMPC Kermit 1.2 8-30-84\n, use=kermit, -+# IBMPC Kermit 1.20 -+# Cannot use line 25, now acts funny like ansi special scrolling region. -+# Initialization must escape from that region by cursor position to line 24. -+# Cannot use character insert because 1.20 goes crazy if insert at col 80. -+# Does not use :am: because autowrap is lost when kermit dropped and restarted. -+# From: greg small <gts@populi.berkeley.edu> 12-19-84 -+pckermit120|UCB IBMPC Kermit 1.20, -+ it#8, lines#24, -+ cud1=\EB, cvvis=\EO\Eq\EEK3, dch1=\EN, dl1=\EM, ht=^I, -+ il1=\EL, -+ is2=\EO\Eq\EJ\EY7 K3 UCB IBMPC Kermit 1.20 12-19-84\n, -+ rmir@, rmso=\Eq, smir@, smso=\Ep, use=kermit, -+# MS-DOS Kermit 2.27 for the IBMPC -+# Straight ascii keyboard. :sr=\EI: not avail. many versions + bug prone in vi. -+# Cannot use line 25, now acts funny like ansi special scrolling region. -+# Initialization must escape from that region by cursor position to line 24. -+# Does not use am: because autowrap is lost when kermit dropped and restarted. -+# Reverse video for standout like H19. -+# (msk227: removed obsolete ":ma=^Hh^Jj^Kk^Ll^^H:" -- esr) -+# From: greg small <gts@populi.berkeley.edu> 3-17-85 -+msk227|mskermit227|MS-DOS Kermit 2.27 for the IBMPC, -+ OTbs, am@, -+ cols#80, it#8, lines#24, -+ clear=\EE, cub1=^H, cud1=\EB, cuf1=\EC, -+ cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, -+ cvvis=\EO\Eq\EG\EwK4, dch1=\EN, dl1=\EM, ed=\EJ, el=\EK, -+ home=\EH, ht=^I, il1=\EL, -+ is2=\EO\Eq\EG\Ew\EJ\EY7 K4 MS Kermit 2.27 for the IBMPC 3-17-85\n, -+ kcub1=^H, kcud1=^J, kcuf1=^L, kcuu1=^K, khome=^^, rc=\Ek, -+ rmir=\EO, rmso=\Eq, sc=\Ej, smir=\E@, smso=\Ep, -+# MS-DOS Kermit 2.27 with automatic margins -+# From: greg small <gts@populi.berkeley.edu> 3-17-85 -+msk227am|mskermit227am|UCB MS-DOS Kermit 2.27 with automatic margins, -+ am, -+ cvvis=\EO\Eq\EG\EvK5, -+ is2=\EO\Eq\EG\Ev\EJ\EY7 K5 MS Kermit 2.27 +automatic margins 3-17-85\n, -+ use=msk227, -+# MS-DOS Kermit 2.27 UCB 227.14 for the IBM PC -+# Automatic margins now default. Use ansi <sgr> for highlights. -+# Define function keys. -+# (msk22714: removed obsolete ":kn#10:" -- esr) -+# From: greg small <gts@populi.berkeley.edu> 3-17-85 -+msk22714|mskermit22714|UCB MS-DOS Kermit 2.27 UCB 227.14 IBM PC, -+ am, -+ bold=\E[1m, cvvis=\EO\Eq\EG\EvK6, -+ is2=\EO\Eq\EG\Ev\EJ\EY7 K6 MS Kermit 2.27 UCB 227.14 IBM PC 3-17-85\n, -+ kf0=\E0, kf1=\E1, kf2=\E2, kf3=\E3, kf4=\E4, kf5=\E5, kf6=\E6, -+ kf7=\E7, kf8=\E8, kf9=\E9, rev=\E[7m, rmso=\E[m, rmul=\E[m, -+ sgr0=\E[m, smso=\E[1m, smul=\E[4m, use=mskermit227, -+# This was designed for a VT320 emulator, but it is probably a good start -+# at support for the VT320 itself. -+# Please send changes with explanations to bug-gnu-emacs@prep.ai.mit.edu. -+# (vt320-k3: I added <rmam>/<smam> based on the init string -- esr) -+vt320-k3|MS-Kermit 3.00's vt320 emulation, -+ am, eslok, hs, km, mir, msgr, xenl, -+ cols#80, it#8, lines#49, pb#9600, vt#3, -+ acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -+ bel=^G, blink=\E[5m, bold=\E[1m, civis=\E[?25l, -+ clear=\E[H\E[J, cmdch=\E, cnorm=\E[?25h, cr=^M, -+ csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, -+ cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, -+ cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, -+ dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, -+ dsl=\E[0$~, ech=\E[%p1%dX, ed=\E[J, el=\E[K, -+ flash=\E[?5h\E[?5l\E[?5h\E[?5l\E[?5h\E[?5l, -+ fsl=\E[0$}, home=\E[H, hpa=\E[%i%p1%dG, ht=^I, hts=\EH, -+ ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[L, ind=^J, -+ is2=\E>\E F\E[?1h\E[?7h\E[r\E[2$~, kbs=^H, kcub1=\EOD, -+ kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kdl1=\E[3~, kf0=\E[21~, -+ kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, kf6=\E[17~, -+ kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, kich1=\E[2~, knp=\E[6~, -+ kpp=\E[5~, mc0=\E[0i, mc4=\E[4i, mc5=\E[5i, nel=^M^J, rc=\E8, -+ rev=\E[7m, ri=\EM, rin=\E[%p1%dL, rmacs=\E(B, rmam=\E[?7l, -+ rmir=\E[4l, rmkx=\E[?1l\E>, rmso=\E[27m, rmul=\E[24m, -+ rs1=\E(B\E)B\E>\E F\E[4;20l\E[12h\E[?1;5;6;38;42l\E[?7;25h\E[4i\E[?4i\E[m\E[r\E[2$~, -+ sc=\E7, sgr0=\E[m, smacs=\E(0, smam=\E[?7h, smir=\E[4h, -+ smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, tbc=\E[3g, -+ tsl=\E[1$}\r\E[K, vpa=\E[%i%p1%dd, -+# From: Joseph Gil <yogi@cs.ubc.ca> 13 Dec 1991 -+# ACS capabilities from Philippe De Muyter <phdm@info.ucl.ac.be> 30 May 1996 -+# (I removed a bogus boolean :mo: and added <msgr>, <smam>, <rmam> -- esr) -+vt320-k311|dec vt320 series as defined by kermit 3.11, -+ am, eslok, hs, mir, msgr, xenl, xon, -+ cols#80, it#8, lines#24, vt#3, -+ acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -+ bel=^G, blink=\E[5m, bold=\E[1m, civis=\E[?25l, -+ clear=\E[;H\E[2J, cnorm=\E[?25h, cr=^M, -+ csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, -+ cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, -+ cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, -+ dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, -+ dsl=\E[2$~\r\E[1$}\E[K\E[$}, ed=\E[J, el=\E[K, -+ flash=\E[?5h\E[?5l, fsl=\E[$}, home=\E[H, ht=^I, hts=\EH, -+ ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[L$<3/>, ind=\ED, -+ is2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h\E[1;24r\E[24;1H, -+ kbs=^H, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, -+ kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, kf6=\E[17~, -+ kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, lf1=pf1, lf2=pf2, -+ lf3=pf3, lf4=pf4, nel=^M\ED, rc=\E8, rev=\E[7m, -+ rf=/usr/share/tabset/vt100, ri=\EM, rmacs=^O, -+ rmam=\E[?7l, rmir=\E[4l, rmkx=\E[?1l\E>, rmso=\E[27m, -+ rmul=\E[24m, rs1=\E[?3l, sc=\E7, sgr0=\E[m, smacs=^N, -+ smam=\E[?7h, smir=\E[4h, smkx=\E[?1h\E=, smso=\E[7m, -+ smul=\E[4m, tbc=\E[3g, tsl=\E[2$~\E[1$}\E[1;%dH, - --# Initialization string 2 sets: --# ^^FQ2 - default cursor (solid rectangle) --# ^^FW - character protection disabled --# ^^F\^ - horizontal scrolling enabled (for alignment) --# ^^FX004? - margins at columns 0 and 79 --# ^^F] - horizontal scrolling disabled --# ^^O - primary character set --# ^^FS00 - default character set (the keyboard native language) --# - (should reset scrolling regions, but that glitches the screen) -+######## NON-ANSI TERMINAL EMULATIONS - # --d470c-dg|d470-dg|Data General DASHER D470C in DG mode, -- is2=\036FQ2\036FW\036F\^\036FX004?\036F]\036O\036FS00, -- use=dgmode+color, use=d460-dg, -- --# DASHER D555 terminal in ANSI mode. --# Like a D411, but has an integrated phone. --d555|Data General DASHER D555, -- use=d411, --d555-7b|Data General DASHER D555 in 7-bit mode, -- use=d411-7b, --d555-w|Data General DASHER D555 in wide mode, -- use=d411-w, --d555-7b-w|Data General DASHER D555 in wide 7-bit mode, -- use=d411-7b-w, --d555-dg|Data General DASHER D555 series in DG mode, -- use=d411-dg, -- --# DASHER D577 terminal in ANSI mode. --# Like a D411, but acts as a keyboard for serial printers ("KSR" modes). --d577|Data General DASHER D577, -- use=d411, --d577-7b|Data General DASHER D577 in 7-bit mode, -- use=d411-7b, --d577-w|Data General DASHER D577 in wide mode, -- use=d411-w, --d577-7b-w|Data General DASHER D577 in wide 7-bit mode, -- use=d411-7b-w, - --d577-dg|d578-dg|Data General DASHER D577/D578 series in DG mode, -- use=d411-dg, -- --# DASHER D578 terminal. --# Like a D577, but without compressed mode; like a D470C in this respect. -+#### Avatar - # --# Initialization string 1 sets: --# \E[<0;<1;<2;<4l --# <0 - scrolling enabled --# <1 - blink enabled --# <2 - horizontal scrolling enabled (for alignment) --# <4 - print characters regardless of attributes --# \E[1;1;80w - margins at columns 1 and 80 --# \E[1;6;<2h --# 1 - print all characters even if protected --# 6 - character protection disabled --# <2 - horizontal scrolling disabled --# - (should reset scrolling regions, but that glitches the screen) -+# These entries attempt to describe Avatar, a terminal emulation used with -+# MS-DOS bulletin-board systems. It was designed to give ANSI-like -+# capabilities, but with cheaper (shorter) control sequences. Messy design, -+# excessively dependent on PC idiosyncracies, but apparently rather popular -+# in the BBS world. - # --d578|Data General DASHER D578, -- is1=\E[<0;<1;<2;<4l\E[1;1;80w\E[1;6;<2h, use=d577, --d578-7b|Data General DASHER D578 in 7-bit mode, -- is1=\E[<0;<1;<2;<4l\E[1;1;80w\E[1;6;<2h, use=d577-7b, -- --#### Datamedia (dm) -+# No color support. Avatar doesn't fit either of the Tektronix or HP color -+# models that terminfo knows about. An Avatar color attribute is the -+# low 7 bits of the IBM-PC display-memory attribute. Bletch. - # --# Datamedia was headquartered in Nashua, New Hampshire until it went --# out of business in 1993, but the ID plates on the terminals referred --# to the factory in Pennsauken, NJ. The factory was sold to a PCB board --# manufacturer which threw out all information about the terminals. -+# I wrote these entries while looking at the Avatar spec. I don't have -+# the facilities to test them. Let me know if they work, or don't. -+# -+# Avatar escapes not used by these entries (because maybe you're smarter -+# and more motivated than I am and can figure out how to wrap terminfo -+# around some of them, and because they are weird enough to be funny): -+# level 0: -+# ^L -- clear window/reset current attribute to default -+# ^V^A%p1%c -- set current color attribute, parameter decodes as follows: -+# -+# bit: 6 5 4 3 2 1 0 -+# | | | | | -+# +---+---+ | +---+---+ -+# | | | -+# | | foreground color -+# | foreground intensity -+# background color -+# level 0+: -+# ^V^J%p1%c%p2%c%p3%c%p4%c%p5%c -- scroll (p2,p3) to (p4,p5) up by p1 lines -+# ^V^K%p1%c%p2%c%p3%c%p4%c%p5%c -- scroll (p2,p3) to (p4,p5) down by p1 lines -+# ^V^L%p1%c%p2%c%p3%c -- clear p2 lines and p3 cols w/attr %p1 -+# ^V^M%p1%c%p2%c%p3%c%p4%c -- fill p3 lines & p4 cols w/char p2+attr %p1 -+# (^V^L and ^V^M set the current attribute as a side-effect.) -+# ^V ^Y <a> [...] <c> -- repeat pattern. <a> specifies the number of bytes -+# in the pattern, <c> the number of times the pattern -+# should be repeated. If either value is 0, no-op. -+# The pattern can contain Avatar console codes, -+# including other ^V ^Y patterns. -+# level 1: -+# ^V^O -- clockwise mode on; turn print direction right each time you -+# hit a window edge (yes, really). Turned off by CR -+# ^V^P -- no-op -+# ^V^Q%c -- query the driver -+# ^V^R -- driver reset -+# ^V^S -- Sound tone (PC-specific) -+# ^V^T -- change highlight at current cursor poition to %c -+# ^V^U%p1%c%p2%c -- highlight window <a> with attribute <b> -+# ^V^V%p1%c%p2%c%p3%c%p4%c%p5%c -+# -- define window -+# -+# From: Eric S. Raymond <esr@snark.thyrsus.com> 1 Nov 1995 -+# (The <blink>/<bold>/<rev>/<smacs>/<smul>/<smso> capabilities exist only to -+# tell ncurses that the corresponding highlights exist; it should use <sgr>, -+# which is the only method that will actually work for multiple highlights.) - # -+# Update by TD - 2004: half of this was inconsistent. Found documentation -+# and repaired most of the damage. sgr0 is probably incorrect, but the -+# available documentation gives no clues for a workable string. -+avatar0|avatar terminal emulator level 0, -+ am, bce, msgr, -+ cols#80, it#8, lines#25, -+ blink=^V^B, bold=^V^A^P, cr=^M, cub1=^V^E, cud1=^V^D, -+ cuf1=^V^F, cup=\026\010%p1%c%p2%c, cuu1=^V^C, el=^V^G, -+ ind=^J, invis=^V^A\0, rep=\031%p1%c%p2%c, rev=^V^Ap, -+ rmacs@, rs2=^L, -+ sgr=%?%p1%p2%|%p3%|%p6%|%p7%|%t\026\001%?%p7%t%{128}%e%{0}%?%p1%t%{112}%|%;%?%p2%t%{1}%|%;%?%p3%t%{112}%|%;%?%p6%t%{16}%|%;%;%c%;%?%p4%t\026\002%;, -+ sgr0=^V^A^G, smacs@, smso=^V^Ap, smul=^V^A^A, -+ use=klone+acs, -+# From: Eric S. Raymond <esr@snark.thyrsus.com> 1 Nov 1995 -+avatar0+|avatar terminal emulator level 0+, -+ dch1=^V^N, rmir=\026\n\0\0\0\0, smir=^V^I, use=avatar0, -+# From: Eric S. Raymond <esr@snark.thyrsus.com> 1 Nov 1995 -+avatar|avatar1|avatar terminal emulator level 1, -+ civis=^V'^B, cnorm=^V'^A, cvvis=^V^C, dl1=^V-, il1=^V+, -+ rmam=^V", rmir=^V^P, smam=^V$, use=avatar0+, - --cs10|colorscan|Datamedia Color Scan 10, -- msgr, -- cols#80, lines#24, -- bel=^G, clear=\E[H\E[J, cr=^M, cub1=^H, cud1=^J, cuf1=\E[C, -- cup=\E[%i%p1%02d;%p2%02dH, cuu1=\E[A, ed=\E[J, el=\E[K, -- ind=^J, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, -- kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, rmso=\E[m, rmul=\E[m, -- sgr0=\E[m, smso=\E[7m, smul=\E[4m, --cs10-w|Datamedia Color Scan 10 with 132 columns, -+#### RBcomm -+# -+# RBComm is a lean and mean terminal emulator written by the Interrupt List -+# maintainer, Ralf Brown. It was fairly popular in the late DOS years (early -+# '90s), especially in the BBS world, and still has some loyal users due to -+# its very small memory footprint and to a cute macro language. -+rbcomm|IBM PC with RBcomm and EMACS keybindings, -+ am, bw, mir, msgr, xenl, -+ cols#80, it#8, lines#25, -+ bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l, -+ clear=^L, cnorm=\E[?25h, cr=^M, csr=\E[%i%p1%d;%p2%dr, -+ cub1=^H, cud1=^C, cuf1=^B, -+ cup=\037%p2%{32}%+%c%p1%{32}%+%c, cuu1=^^, dch1=^W, -+ dl=\E[%p1%dM, dl1=^Z, ech=\E[%p1%dX, ed=^F5, el=^P^P, ht=^I, -+ il=\E[%p1%dL, il1=^K, ind=\ED, invis=\E[8m, -+ is2=\017\035\E(B\E)0\E[?7h\E[?3l\E[>8g, kbs=^H, -+ kcub1=^B, kcud1=^N, kcuf1=^F, kcuu1=^P, khome=^A, nel=^M\ED, -+ rc=\E8, rep=\030%p1%c%p2%c, rev=^R, ri=\EM, rmcup=, rmdc=, -+ rmir=^], rmkx=\E>, rmso=^U, rmul=^U, -+ rs1=\017\E(B\E)0\025\E[?3l\E[>8g, sc=\E7, sgr0=\E[m, -+ smcup=, smdc=, smir=^\, smkx=\E=, smso=^R, smul=^T, -+rbcomm-nam|IBM PC with RBcomm without autowrap, -+ am@, -+ bel=^G, cr=^M, cud1=^J, ht=^I, ind=^J, -+ is2=\017\035\E(B\E)0\E[?7l\E[?3l\E[>8g, kbs=^H, -+ kcub1=^H, kcud1=^J, nel=^M^J, use=rbcomm, -+rbcomm-w|IBM PC with RBcomm in 132 column mode, - cols#132, -- cup=\E[%i%p1%02d;%p2%03dH, use=cs10, -+ bel=^G, cr=^M, cud1=^J, ht=^I, ind=^J, -+ is2=\017\035\E(B\E)0\E[?7h\E[?3h\E[>8g, kbs=^H, -+ kcub1=^H, kcud1=^J, nel=^M^J, use=rbcomm, - --# (dm1520: removed obsolete ":ma=^\ ^_^P^YH:" -- esr) --dm1520|dm1521|datamedia 1520, -- OTbs, am, xenl, -- cols#80, it#8, lines#24, -- bel=^G, clear=^L, cr=^M, cub1=^H, cud1=^J, cuf1=^\, -- cup=\036%p2%{32}%+%c%p1%{32}%+%c, cuu1=^_, ed=^K, el=^], -- home=^Y, ht=^I, ind=^J, kcub1=^H, kcud1=^J, kcuf1=^\, kcuu1=^_, -- khome=^Y, --# dm2500: this terminal has both <ich> and <smir>. Applications using --# termcap/terminfo directly (rather than through ncurses) might be confused. --dm2500|datamedia2500|datamedia 2500, -- OTbs, OTnc, -- cols#80, lines#24, -- bel=^G, clear=^^^^\177, cub1=^H, cud1=^J, cuf1=^\, -- cup=\014%p2%{96}%^%c%p1%{96}%^%c, cuu1=^Z, -- dch1=\020\010\030\035$<10*>, -- dl1=\020\032\030\035$<10*>, el=^W, home=^B, -- ich1=\020\034\030\035$<10*>, -- il1=\020\n\030\035\030\035$<15>, ind=^J, pad=\377, -- rmdc=^X^], rmir=\377\377\030\035$<10>, rmso=^X^], -- smdc=^P, smir=^P, smso=^N, --# dmchat is like DM2500, but DOES need "all that padding" (jcm 1/31/82) --# also, has a meta-key. --# From: <goldberger@su-csli.arpa> --# (dmchat: ":MT:" changed to ":km:" -- esr) --dmchat|dmchat version of datamedia 2500, -- km, -- dl1=\020\032\030\035$<2/>, -- il1=\020\n\030\035\030\035$<1*/>, use=dm2500, --# (dm3025: ":MT:" changed to ":km:" -- esr) --dm3025|datamedia 3025a, -- OTbs, km, -- cols#80, it#8, lines#24, -- bel=^G, clear=\EM$<2>, cr=^M, cub1=^H, cud1=^J, cuf1=\EC, -- cup=\EY%p2%{32}%+%c%p1%{32}%+%c, cuu1=\EA, -- dch1=\010$<6>, dl1=\EP\EA\EQ$<130>, ed=\EJ$<2>, el=\EK, -- home=\EH, ht=^I, il1=\EP\n\EQ$<130>, ind=^J, ip=$<6>, -- is2=\EQ\EU\EV, rmdc=\EQ, rmir=\EQ, rmso=\EO0, smdc=\EP, -- smir=\EP, smso=\EO1, --dm3045|datamedia 3045a, -- OTbs, am, eo, km@, ul, xenl, -- dch1=\EB$<6>, dl1@, il1@, is2=\EU\EV, kcuf1=\EC, kcuu1=\EA, -- kf0=\Ey\r, kf1=\Ep\r, kf2=\Eq\r, kf3=\Er\r, kf4=\Es\r, -- kf5=\Et\r, kf6=\Eu\r, kf7=\Ev\r, kf8=\Ew\r, kf9=\Ex\r, -- khome=\EH, pad=\177, rmdc@, rmir=\EP, rmso@, smdc@, smso@, -- use=dm3025, --# Datamedia DT80 soft switches: --# 1 0=Jump 1=Smooth --# Autorepeat 0=off 1=on --# Screen 0=Dark 1=light --# Cursor 0=u/l 1=block -+######## LCD DISPLAYS - # --# 2 Margin Bell 0=off 1=on --# Keyclick 0=off 1=on --# Ansi/VT52 0=VT52 1=Ansi --# Xon/Xoff 0=Off 1=On -+ -+#### Matrix Orbital -+# from: Eric Z. Ayers (eric@ale.org) - # --# 3 Shift3 0=Hash 1=UK Pound --# Wrap 0=Off 1=On --# Newline 0=Off 1=On --# Interlace 0=Off 1=On -+# Matrix Orbital 20x4 LCD display -+# Command Character is 0xFE (decimal 254, octal 376) - # --# 4 Parity 0=Odd 1=Even --# Parity 0=Off 1=On --# Bits/Char 0=7 1=8 --# Power 0=60Hz 1=50Hz -+# On this device, cursor addressability isn't possible. The LCD expects: -+# 0xfe G <col> <row> -+# for cup: %p1 == row and %p2 is column - # --# 5 Line Interface 0=EIA 1=Loop --# Aux Interface 0=EIA 1=Loop --# Local Copy 0=Off 1=On --# Spare -+# This line: -+# cup=\376G%p2%c%p1%c -+# LOOKS like it will work, but sometimes only one of the two numbers is sent. -+# See the terminfo (5) manpage commented regarding 'Terminals which use "%c"'. - # --# 6 Aux Parity 0=Odd 1=Even --# Aux Parity 0=Off 1=On --# Aux Bits/Char 0=7 1=8 --# CRT Saver 0=Off 1=On --# dm80/1 is a vt100 lookalike, but it doesn't seem to need any padding. --dm80|dmdt80|dt80|datamedia dt80/1, -- clear=\E[2J\E[H, cud1=^J, cuf1=\E[C, -- cup=%i\E[%p1%d;%p2%dH, cuu1=\E[A, ed=\E[J, el=\E[K, -- home=\E[H, mc0=\E[0i, mc4=\E[4i, mc5=\E[5i, ri=\EM, -- rmso=\E[m, rmul=\E[m, sgr0=\E[m, smso=\E[7m, smul=\E[4m, -- use=vt100, --# except in 132 column mode, where it needs a little padding. --# This is still less padding than the vt100, and you can always turn on --# the ^S/^Q handshaking, so you can use vt100 flavors for things like --# reverse video. --dm80w|dmdt80w|dt80w|datamedia dt80/1 in 132 char mode, -- cols#132, -- clear=\E[H\E[2J$<50/>, cud1=^J, -- cup=\E[%i%p1%d;%p2%dH$<5/>, cuu1=\E[A$<5/>, -- ed=\E[0J$<20/>, el=\E[0K$<20/>, use=dm80, --# From: Adam Thompson <athompso@pangea.ca> Sept 10 1995 --dt80-sas|Datamedia DT803/DTX for SAS usage, -- am, bw, -- cols#80, lines#24, -- acsc=``a1fxgqh0jYk?lZm@nEooppqDrrsstCu4vAwBx3yyzz{{||}}~~, -- bel=^G, clear=^L, cr=^M, -- csr=\E=%p1%{32}%+%c%{32}%c\E#1\E=%p2%{32}%+%c%{32}%c\E#2, -- cub1=^H, cud1=\EB, cuf1=^\, -- cup=\E=%p2%{32}%+%c%p1%{32}%+%c, cuu1=^_, dl1=\EM, ed=^K, -- el=^], ff=^L, home=^Y, ht=^I, hts=\E'1, il1=\EL, ind=\EB, -- is2=\E)0\E<\EP\E'0\E$2, kclr=^L, kcub1=^H, kcud1=^J, -- kcuf1=^\, kcuu1=^_, ked=^K, kel=^], khome=^Y, mc4=^O, mc5=^N, -- rev=\E$2\004, ri=\EI, rmacs=\EG, rmso=^X, sgr0=^X, smacs=\EF, -- smso=\E$2\004, tbc=\E'0, -- --# Datamedia Excel 62, 64 from Gould/SEL UTX/32 via BRL --# These aren't end-all Excel termcaps; but do insert/delete char/line --# and name some of the extra function keys. (Mike Feldman ccvaxa!feldman) --# The naming convention has been bent somewhat, with the use of E? (where --# E is for 'Excel') as # a name. This was done to distinguish the entries --# from the other Datamedias in use here, and yet to associate a model of --# the Excel terminals with the regular datamedia terminals that share --# major characteristics. --excel62|excel64|datamedia Excel 62, -- dch1=\E[P, kbs=^H, kcub1=^H, kcud1=^J, kf5=\EOu, kf6=\EOv, -- kf7=\EOw, kf8=\EOx, kf9=\EOy, rmir=\E[4l, smir=\E[4h, -- use=dt80, --excel62-w|excel64-w|datamedia Excel 62 in 132 char mode, -- dch1=\E[P, kbs=^H, kcub1=^H, kcud1=^J, kf5=\EOu, kf6=\EOv, -- kf7=\EOw, kf8=\EOx, kf9=\EOy, rmir=\E[4l, smir=\E[4h, -- use=dt80w, --excel62-rv|excel64-rv|datamedia Excel 62 in reverse video mode, -- dch1=\E[P, flash=\E[?5l\E[?5h, kbs=^H, kcub1=^H, kcud1=^J, -- kf5=\EOu, kf6=\EOv, kf7=\EOw, kf8=\EOx, kf9=\EOy, rmir=\E[4l, -- smir=\E[4h, use=dt80, -- --#### Falco -+# Alas, there is no cursor upline capability on this display. - # --# Falco Data Products --# 440 Potrero Avenue --# Sunnyvale, CA 940864-196 --# Vox: (800)-325-2648 --# Fax: (408)-745-7860 --# Net: techsup@charm.sys.falco.com -+# These entries add some 'sanity stuff' to the clear function. That is, it -+# does a 'clear' and also turns OFF auto scroll, turns ON Auto Line Wrapping, -+# and turns off the cursor blinking and stuff like that. - # --# Current Falco models as of 1995 are generally ANSI-compatible and support --# emulations of DEC VT-series, Wyse, and Televideo types. -+# NOTE: calling 'beep' turns on the backlight (bell) -+# NOTE: calling 'flash' turns it on and back off (visual bell) - # -+MtxOrb|Generic Matrix Orbital LCD display, -+ bel=\376B^A, clear=\376X\376C\376R\376K\376T, -+ cnorm=\376K\376T, cub1=\376L, cuf1=\376M, -+ flash=\376B\001$<200>\376F, home=\376H, -+MtxOrb204|20x4 Matrix Orbital LCD display, -+ cols#20, lines#4, use=MtxOrb, -+MtxOrb162|16x2 Matrix Orbital LCD display, -+ cols#16, lines#2, use=MtxOrb, -+# The end - --# Test version for Falco ts-1. See <arpavax.hickman@ucb> for info --# This terminal was released around 1983 and was discontinued long ago. --# The standout and underline highlights are the same. --falco|ts1|ts-1|falco ts-1, -- OTbs, am, -- cols#80, it#8, lines#24, -- bel=^G, clear=\E*, cr=^M, cub1=^H, cud1=^J, cuf1=^L, -- cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW, -- dl1=\ER, ed=\EY, el=\ET\EG0\010, home=^^, ht=^I, il1=\EE, -- ind=^J, is2=\Eu\E3, kcub1=^H, kcud1=^J, kcuf1=^L, kcuu1=^K, -- kf0=^A0\r, rmir=\Er, rmso=\Eg0, rmul=\Eg0, sgr0=\Eg0, -- smir=\Eq, smso=\Eg1, smul=\Eg1, --falco-p|ts1p|ts-1p|falco ts-1 with paging option, -- OTbs, am, da, db, mir, msgr, ul, -+######## OLDER TERMINAL TYPES -+# -+# This section is devoted to older commercial terminal brands that are now -+# discontinued, but known to be still in use or represented by emulations. -+# -+ -+#### AT&T (att, tty) -+# -+# This section also includes Teletype-branded VDTs. -+# -+# The AT&T/Teletype terminals group was sold to SunRiver Data Systems (now -+# Boundless Technologies); for details, see the header comment on the ADDS -+# section. -+# -+# These are AT&T's official terminfo entries. All-caps aliases have been -+# removed. -+# -+att2300|sv80|AT&T 2300 Video Information Terminal 80 column mode, -+ am, eo, mir, msgr, xon, - cols#80, it#8, lines#24, -- bel=^G, cbt=\EI, clear=\E*, cr=^M, cub1=^H, cud1=\E[B, -- cuf1=\E[C, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=\E[A, -- dch1=\EW, dl1=\ER, ed=\EY, el=\ET\EG0\010\Eg0, ht=^I, -- il1=\EE, ind=^J, is2=\EZ\E3\E_c, kcub1=\E[D, kcud1=\E[B, -- kcuf1=\E[C, kcuu1=\E[A, khome=\E[H, rmcup=\E_b, rmir=\Er, -- rmso=\Eg0, rmul=\Eg0, sgr0=\Eg0, smcup=\E_d, smir=\Eq, -- smso=\Eg4, smul=\Eg1, --# (ts100: I added <rmam>/<smam> based on the init string -- esr) --ts100|ts100-sp|falco ts100-sp, -- am, mir, msgr, xenl, xon, -+ bel=^G, clear=\E[H\E[J, cr=^M, cub=\E[%p1%dD, cub1=^H, -+ cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, -+ cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, -+ dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, -+ el=\E[K, el1=\E[1K, home=\E[H, ht=^I, ich=\E[%p1%d@, -+ il=\E[%p1%dL, il1=\E[L, ind=^J, kbs=^H, kcbt=\E[Z, kclr=\E[J, -+ kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[P, -+ kdl1=\E[M, kf1=\E[1r, kf10=\E[10r, kf11=\E[11r, -+ kf12=\E[12r, kf13=\E[13r, kf14=\E[14r, kf15=\E[15r, -+ kf16=\E[16r, kf2=\E[2r, kf3=\E[3r, kf4=\E[4r, kf5=\E[5r, -+ kf6=\E[6r, kf7=\E[7r, kf8=\E[8r, kf9=\E[9r, khome=\E[H, -+ kich1=\E[@, kil1=\E[L, mc0=\E[0i, mc4=\E[4i, mc5=\E[5i, -+ rev=\E[7m, rmir=\E[4l, rmso=\E[m, sgr0=\E[m, smir=\E[4h, -+ smso=\E[7m, -+att2350|AT&T 2350 Video Information Terminal 80 column mode, -+ mc0@, mc4@, mc5@, use=att2300, -+ -+# Must setup RETURN KEY - CR, REC'VD LF - INDEX. -+# Seems upward compatible with vt100, plus ins/del line/char. -+# On sgr, the protection parameter is ignored. -+# No check is made to make sure that only 3 parameters are output. -+# standout= reverse + half-intensity = 3 | 5. -+# bold= reverse + underline = 2 | 3. -+# note that half-bright blinking doesn't look different from normal blinking. -+# NOTE:you must program the function keys first, label second! -+# (att4410: a BSD entry has been seen with the following capabilities: -+# <is2=\E[?6l>, <kf1=\EOc>, <kf2=\EOd>, <kf3=\EOe>, <kf4=\EOg>, -+# <kf6=\EOh>, <kf7=\EOi>, <kf8=\EOj>, -- esr) -+att5410v1|att4410v1|tty5410v1|AT&T 4410/5410 80 columns - version 1, -+ am, hs, mir, msgr, xon, -+ cols#80, it#8, lh#2, lines#24, lw#8, nlab#8, wsl#80, -+ acsc=++\,\,--..00``aaffgghhjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -+ bel=^G, blink=\E[5m, bold=\E[2;7m, clear=\E[H\E[J, cr=^M, -+ csr=\E[%i%p1%d;%p2%dr, cub1=^H, cud1=\E[B, cuf1=\E[C, -+ cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, dch1=\E[P, dim=\E[2m, -+ dl1=\E[M, ed=\E[J, el=\E[K, fsl=\E8, home=\E[H, ht=^I, -+ ich1=\E[@, il1=\E[L, ind=^J, invis=\E[8m, is1=\E[?3l\E)0, -+ is3=\E[1;03q f1 \EOP\E[2;03q f2 \EOQ\E[3;03q f3 \EOR\E[4;03q f4 \EOS\E[5;03q f5 \EOT\E[6;03q f6 \EOU\E[7;03q f7 \EOV\E[8;03q f8 \EOW, -+ kbs=^H, kclr=\E[2J, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, -+ kcuu1=\E[A, kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, kf5=\EOT, -+ kf6=\EOU, kf7=\EOV, kf8=\EOW, khome=\E[H, kll=\E[24;1H, -+ ll=\E[24H, nel=^M^J, -+ pfx=\E[%p1%1d;%p2%l%2.2dq f%p1%1d %p2%s, -+ pln=\E[%p1%d;00q%p2%:-16s, rc=\E8, rev=\E[7m, ri=\EM, -+ rmacs=^O, rmso=\E[m, rmul=\E[m, rs2=\Ec\E[?3l\E[2;0y, -+ sc=\E7, -+ sgr=\E[0%?%p1%p5%|%p6%|%t;2%;%?%p2%t;4%;%?%p4%t;5%;%?%p3%p1%|%p6%|%t;7%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, -+ sgr0=\E[m\017, smacs=^N, smso=\E[7m, smul=\E[4m, -+ tsl=\E7\E[25;%p1%{1}%+%dH, -+ -+att4410v1-w|att5410v1-w|tty5410v1-w|AT&T 4410/5410 132 columns - version 1, -+ cols#132, wsl#132, -+ is1=\E[?3h\E)0, rs2=\Ec\E[?3h\E[2;0y, use=att5410v1, -+ -+att4410|att5410|tty5410|AT&T 4410/5410 80 columns - version 2, -+ OTbs, -+ pfx=\E[%p1%d;%p2%l%02dq f%p1%d %p2%s, -+ use=att5410v1, -+ -+att5410-w|att4410-w|4410-w|tty5410-w|5410-w|AT&T 4410/5410 in 132 column mode, -+ cols#132, wsl#132, -+ is1=\E[?3h\E)0, rs2=\Ec\E[?3h\E[2;0y, use=att4410, -+ -+# 5410 in terms of a vt100 -+# (v5410: added <rmam>/<smam> based on init string -- esr) -+v5410|att5410 in terms of a vt100, -+ am, mir, msgr, xon, - cols#80, it#8, lines#24, vt#3, - acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, - bel=^G, blink=\E[5m$<2>, bold=\E[1m$<2>, - clear=\E[H\E[J$<50>, cr=^M, csr=\E[%i%p1%d;%p2%dr, -- cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=^J, -- cuf=\E[%p1%dC, cuf1=\E[C$<2>, -- cup=\E[%i%p1%d;%p2%dH$<5>, cuu=\E[%p1%dA, -- cuu1=\E[A$<2>, dch1=\E~W, dl1=\E~R, ed=\E[J$<50>, -- el=\E[K$<3>, el1=\E[1K$<3>, enacs=\E(B\E)0, home=\E[H, -- ht=^I, hts=\EH, ich1=\E~Q, il1=\E~E, ind=^J, is1=\E~)\E~ea, -- kbs=^H, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, -- rc=\E8, rev=\E[7m$<2>, ri=\EM$<5>, rmacs=^O, rmam=\E[?7l, -- rmkx=\E[?1l\E>, rmso=\E[m$<2>, rmul=\E[m$<2>, -- rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sc=\E7, -+ cub1=^H, cud1=^J, cuf1=\E[C$<2>, -+ cup=\E[%i%p1%d;%p2%dH$<5>, cuu1=\E[A$<2>, dch1=\E[P, -+ dl1=\E[M, ed=\E[J$<50>, el=\E[K$<3>, el1=\E[1K$<3>, -+ enacs=\E(B\E)0, home=\E[H, ht=^I, hts=\EH, ich1=\E[@, -+ il1=\E[L, ind=^J, kbs=^H, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, -+ kcuu1=\EOA, rc=\E8, rev=\E[7m$<2>, ri=\EM$<5>, rmacs=^O, -+ rmam=\E[?7l, rmkx=\E[?1l\E>, rmso=\E[m$<2>, -+ rmul=\E[m$<2>, rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, -+ sc=\E7, - sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;$<2>, - sgr0=\E[m\017$<2>, smacs=^N, smam=\E[?7h, smkx=\E[?1h\E=, - smso=\E[1;7m$<2>, smul=\E[4m$<2>, tbc=\E[3g, - use=vt100+fnkeys, --ts100-ctxt|falco ts-100 saving context, -- rmcup=\E~_b, smcup=\E~_d\E[2J, use=ts100, - --#### Florida Computer Graphics - # -+# Teletype Model 5420 -- A souped up 5410, with multiple windows, -+# even! the 5420 has three modes: scroll, window or page mode -+# this terminfo should work in scroll or window mode, but doesn't -+# take advantage of any of the differences between them. -+# -+# Has memory below (2 lines!) -+# 3 pages of memory (plus some spare) -+# The 5410 sequences for <cup>, <cvvis>, <dch>, <dl>, <ech>, <flash>, <home>, -+# <hpa>, <hts> would work for these, but these work in both scroll and window -+# mode... Unset insert character so insert mode works -+# <is1> sets 80 column mode, -+# <is2> escape sequence: -+# 1) turn off all fonts -+# 2) function keys off, keyboard lock off, control display off, -+# insert mode off, erasure mode off, -+# 3) full duplex, monitor mode off, send graphics off, nl on lf off -+# 4) reset origin mode -+# 5) set line wraparound -+# 6) exit erasure mode, positional attribute mode, and erasure extent mode -+# 7) clear margins -+# 8) program ENTER to transmit ^J, -+# We use \212 to program the ^J because a bare ^J will get translated by -+# UNIX into a CR/LF. The enter key is needed for AT&T uOMS. -+# 1 2 3 4 5 6 7 8 -+# <is3> set screen color to black, -+# No representation in terminfo for the delete word key: kdw1=\Ed -+# Key capabilities assume the power-up send sequence... -+# This <rmcup> is not strictly necessary, but it helps maximize -+# memory usefulness: <rmcup=\Ez>, -+# Alternate sgr0: <sgr0=\E[m\EW^O>, -+# Alternate sgr: <sgr=\E[%?%p1%t2;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p5%t;2%;%?%p7%t;8%;m%?%p8%t\EV%;%?%p9%t^N%e^O%;>, -+# smkx programs the SYS PF keys to send a set sequence. -+# It also sets up labels f1, f2, ..., f8, and sends edit keys. -+# This string causes them to send the strings <kf1>-<kf8> -+# when pressed in SYS PF mode. -+# (att4415: I added <rmam>/<smam> based on the init string -- esr) -+att4415|tty5420|att5420|AT&T 4415/5420 80 cols, -+ OTbs, db, mir, xon, -+ lh#2, lm#78, lw#8, nlab#8, wsl#55, -+ cbt=\E[Z, clear=\E[x\E[J, cnorm=\E[11;0j, cub=\E[%p1%dD, -+ cud=\E[%p1%dB, cuf=\E[%p1%dC, cup=\E[%i%p1%d;%p2%dx, -+ cuu=\E[%p1%dA, cvvis=\E[11;1j, dch=\E[%p1%dP, -+ dl=\E[%p1%dM, ech=\E[%p1%ds\E[%p1%dD, -+ flash=\E[?5h$<200>\E[?5l, home=\E[x, -+ hpa=\E[%p1%{1}%+%dG, hts=\EH, ich=\E[%p1%d@, ich1@, -+ il=\E[%p1%dL, indn=\E[%p1%dE, is1=\E[?3l$<100>, -+ is2=\E[m\017\E[1;2;3;4;6l\E[12;13;14;20l\E[?6;97;99l\E[?7h\E[4i\Ex\E[21;1j\212, -+ is3=\E[?5l, kbeg=\Et, kcbt=\E[Z, kdch1=\E[P, kdl1=\E[M, -+ kel=\E[2K, kend=\Ez, kent=\Eent, kf1=\EOc, kf2=\EOd, -+ kf3=\EOe, kf4=\EOf, kf5=\EOg, kf6=\EOh, kf7=\EOi, kf8=\EOj, -+ kich1=\E[4h, kil1=\E[L, kind=\E[T, kll=\Eu, knp=\E[U, -+ kpp=\E[V, kri=\E[S, lf1=F1, lf2=F2, lf3=F3, lf4=F4, lf5=F5, -+ lf6=F6, lf7=F7, lf8=F8, ll=\Ew, mc0=\E[?2i, mc4=\E[?9i, -+ mc5=\E[?4i, mrcup=\E[%i%p1%d;%p2%dt, -+ pfx=\E[%p1%d;%p2%l%02dq F%p1%d %p2%s, -+ pln=\E[%p1%d;0;0;0q%p2%:-16.16s, prot=\EV, -+ rin=\E[%p1%dF, rmam=\E[?7l, rmir=\E[4l, -+ rmkx=\E[19;0j\E[21;1j\212, rmln=\E|, -+ sgr=\E[0%?%p1%p5%|%p6%|%t;2%;%?%p2%t;4%;%?%p4%t;5%;%?%p3%p1%|%p6%|%t;7%;%?%p7%t;8%;m%?%p8%t\EV%;%?%p9%t\016%e\017%;, -+ sgr0=\E[m\017, smam=\E[?7h, smir=\E[4h, -+ smkx=\E[19;1j\E[21;4j\Eent, smln=\E~, tbc=\E[3g, -+ tsl=\E7\E[25;%p1%{8}%+%dH, vpa=\E[%p1%{1}%+%dd, -+ use=att4410, - --# Florida Computer Graphics Beacon System, using terminal emulator program --# "host.com", as provided by FCG. This description is for an early release --# of the "host" program. Known bug: <ed> clears the whole screen, so it's --# commented out. -+att4415-w|tty5420-w|att5420-w|AT&T 4415/5420 132 cols, -+ cols#132, lm#54, wsl#97, -+ is1=\E[?3h$<100>, use=att4415, - --# From: David Bryant <cbosg!djb> 1/7/83 --beacon|FCG Beacon System, -- am, da, db, -- cols#80, lines#32, -- bel=\ESTART\r\E37\r\EEND\r$<1>, -- blink=\ESTART\r\E61\,1\r\EEND\r, clear=\EZ$<10>, cr=^M, -- cub1=^H, cud1=^J, cuf1=\EV, -- cup=\E=%p1%{32}%+%c%p2%{32}%+%c$<20>, cuu1=\EU, -- dch1=\EW, dl1=\ER, el=\ET, home=\EH$<10>, ich1=\EQ, il1=\EE, -- ind=^J, rev=\ESTART\r\E59\,1\r\EEND\r, rmcup=, -- rmso=\ESTART\r\E70\,0\r\EEND\r$<20>, -- rmul=\ESTART\r\E60\,0\r\EEND\r, -- sgr0=\ESTART\r\E78\r\E70\,0\r\EEND\r$<20>, -- smcup=\ESTART\r\E2\,0\r\E12\r\EEND\r$<10>, -- smso=\ESTART\r\E70\,6\r\EEND\r$<20>, -- smul=\ESTART\r\E60\,1\r\EEND\r, -+att4415-rv|tty5420-rv|att5420-rv|AT&T 4415/5420 80 cols/rv, -+ flash=\E[?5l$<200>\E[?5h, is3=\E[?5h, use=att4415, - --#### Fluke --# -+att4415-w-rv|tty5420-w-rv|att5420-w-rv|AT&T 4415/5420 132 cols/rv, -+ cols#132, lm#54, wsl#97, -+ flash=\E[?5l$<200>\E[?5h, is1=\E[?3h$<100>, is3=\E[?5h, -+ use=att4415, - --# The f1720a differences from ANSI: no auto margin, destructive --# tabs, # of lines, funny highlighting and underlining --f1720|f1720a|fluke 1720A, -- xt, -- cols#80, lines#16, xmc#1, -- bel=^G, clear=\E[H\E[2J, cr=^M, cub1=^H, cud1=\E[B, -- cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, ed=\E[J, -- el=\E[K, ind=\ED, is2=\E[H\E[2J, kcub1=^_, kcud1=^], -- kcuf1=^^, kcuu1=^\, ri=\EM, rmso=\E[m, rmul=\E[m, sgr0=\E[m, -- smso=\E[7m, smul=\E[4m, -+# Note that this mode permits programming USER PF KEYS and labels -+# However, when you program user pf labels you have to reselect -+# user pf keys to make them appear! -+att4415+nl|tty5420+nl|att5420+nl|generic AT&T 4415/5420 changes for not changing labels, -+ kf1@, kf2@, kf3@, kf4@, kf5@, kf6@, kf7@, kf8@, -+ pfx=\E[%p1%d;%p2%l%02d;0;1q F%p1%d %p2%s, -+ pln=\E[%p1%d;0;0;1q%p2%:-16.16s, - --#### Liberty Electronics (Freedom) --# --# Liberty Electronics --# 48089 Fremont Blvd --# Fremont CA 94538 --# Vox: (510)-623-6000 --# Fax: (510)-623-7021 -+att4415-nl|tty5420-nl|att5420-nl|AT&T 4415/5420 without changing labels, -+ kf1@, kf2@, kf3@, kf4@, kf5@, kf6@, kf7@, kf8@, use=att4415+nl, -+ use=att4415, - --# From: <faletti@berkeley.edu> --# (f100: added empty <acsc> to suppress a tic warning; --# made this relative to adm+sgr -- note that <invis> isn't --# known to work for f100 but does on the f110. --esr) --f100|freedom|freedom100|freedom model 100, -- OTbs, am, bw, hs, mir, msgr, xon, -- cols#80, lines#24, -- acsc=, bel=^G, cbt=\EI, clear=^Z, cr=^M, cub1=^H, cud1=^J, -- cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, -- dch1=\EW, dl1=\ER$<11.5*>, dsl=\Eg\Ef\r, ed=\EY, el=\ET, -- flash=\Eb$<200>\Ed, fsl=^M, home=^^, hpa=\E]%p1%{32}%+%c, -- ht=^I, hts=\E1, il1=\EE$<8.5*>, ind=^J, ip=$<6>, -- is2=\Eg\Ef\r\Ed, kbs=^H, kcbt=\EI, kcub1=^H, kcud1=^V, -- kcuf1=^L, kcuu1=^K, kf1=^A@\r, kf10=^AI\r, kf2=^AA\r, -- kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, kf6=^AE\r, kf7=^AF\r, -- kf8=^AG\r, kf9=^AH\r, khome=^^, ri=\Ej, rmacs=\E$, rmir=\Er, -- smacs=\E%%, smir=\Eq, tbc=\E3, tsl=\Eg\Ef, -- vpa=\E[%p1%{32}%+%c, use=adm+sgr, --f100-rv|freedom-rv|freedom 100 in reverse video, -- flash=\Ed$<200>\Eb, is2=\Eg\Ef\r\Eb, use=f100, --# The f110 and f200 have problems with vi(1). They use the ^V --# code for the down cursor key. When kcud1 is defined in terminfo --# as ^V, the Control Character Quoting capability (^V in insert mode) --# is lost! It cannot be remapped in vi because it is necessary to enter --# a ^V to to quote the ^V that is being remapped!!! --# --# f110/f200 users will have to decide whether --# to lose the down cursor key or the quoting capability. We will opt --# initially for leaving the quoting capability out, since use of VI --# is not generally applicable to most interactive applications --# (f110: added <ht>, <khome> & <kcbt> from f100 -- esr) --f110|freedom110|Liberty Freedom 110, -- bw@, eslok, -- it#8, wsl#80, -- blink=\EG2, bold=\EG0, civis=\E.1, cnorm=\E.2, cud1=^V, -- dim=\EG@, dl1=\ER, dsl=\Ef\r, flash=\Eb$<200/>\Ed, il1=\EE, -- ip@, is2@, kclr=^^, kdch1=\EW, kdl1=\ER, ked=\EY, kel=\ET, -- kf0=^AI\r, kf10@, kich1=\EQ, kil1=\EE, mc4=\Ea, mc5=\E`, -- ri=\EJ, rmacs=\E%%, rmir=\Er\EO, smacs=\E$, smir=\EO\Eq, -- smso=\EG<, tsl=\Ef, use=f100, --f110-14|Liberty Freedom 110 14inch, -- dch1@, use=f110, --f110-w|Liberty Freedom 110 - 132 cols, -- cols#132, use=f110, --f110-14w|Liberty Freedom 110 14in/132 cols, -+att4415-rv-nl|tty5420-rv-nl|att5420-rv-nl|AT&T 4415/5420 reverse video without changing labels, -+ kf1@, kf2@, kf3@, kf4@, kf5@, kf6@, kf7@, kf8@, use=att4415+nl, -+ use=att4415-rv, -+ -+att4415-w-nl|tty5420-w-nl|att5420-w-nl|AT&T 4415/5420 132 cols without changing labels, -+ kf1@, kf2@, kf3@, kf4@, kf5@, kf6@, kf7@, kf8@, use=att4415+nl, -+ use=att4415-w, -+ -+att4415-w-rv-n|tty5420-w-rv-n|att5420-w-rv-n|AT&T 4415/5420 132 cols reverse without changing labels, -+ kf1@, kf2@, kf3@, kf4@, kf5@, kf6@, kf7@, kf8@, use=att4415+nl, -+ use=att4415-w-rv, -+ -+att5420_2|AT&T 5420 model 2 80 cols, -+ am, db, hs, mir, msgr, xon, -+ cols#80, it#8, lh#2, lines#24, lm#78, lw#8, nlab#8, wsl#55, -+ acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -+ blink=\E[5m, cbt=\E[1Z, clear=\EH\EJ, cnorm=\E[11;0j, -+ cr=\EG, csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, -+ cud=\E[%p1%dB, cud1=\E[1B, cuf=\E[%p1%dC, cuf1=\E[1C, -+ cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[1A, -+ cvvis=\E[11;1j, dch=\E[%p1%dP, dch1=\E[P, dim=\E[2m, -+ dl=\E[%p1%dM, dl1=\E[M, ech=\E[%p1%ds\E[%p1%dD, ed=\E[0J, -+ el=\E[0K, el1=\E[1K, flash=\E[?5h$<200>\E[?5l, fsl=\E8, -+ home=\E[H, hpa=\E[%p1%{1}%+%dG, ht=^I, hts=\EH, -+ ich=\E[%p1%d@, ich1=\E[@, il=\E[%p1%dL, il1=\E[L, ind=^J, -+ indn=\E[%p1%dE, invis=\E[8m, -+ is1=\E[0;23r\Ex\Ey\E[2;0j\E[3;3j\E[4;0j\E[5;0j\E[6;0j\E[7;0j\E[8;0j\E[9;1j\E[10;0j\E[15;0j\E[16;1j\E[19;0j\E[20;1j\E[29;0j\E[1;24r, -+ kbeg=\Et, kbs=^H, kcbt=\E[Z, kclr=\E[2J, kcub1=\E[D, -+ kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[P, kdl1=\E[M, -+ kel=\E[2K, kend=\Ez, kent=^J, kf1=\EOc, kf2=\EOd, kf3=\EOe, -+ kf4=\EOf, kf5=\EOg, kf6=\EOh, kf7=\EOi, kf8=\EOj, khome=\E[H, -+ kich1=\E[4h, kil1=\E[L, kind=\E[T, kll=\Eu, knp=\E[U, -+ kpp=\E[V, kri=\E[S, lf1=F1, lf2=F2, lf3=F3, lf4=F4, lf5=F5, -+ lf6=F6, lf7=F7, lf8=F8, ll=\Ew, mc0=\E[?;2i, mc4=\E[4i, -+ mc5=\E[5i, mrcup=\E[%i%p1%d;%p2%dt, nel=^M^J, -+ pfx=\E[%p1%d;%p2%l%02dq F%p1%d %p2%s\E~, -+ pln=\E[%p1%d;0;0;0q%p2%:-16.16s\E~, prot=\EV, rc=\E8, -+ rev=\E[7m, ri=\EM, rin=\E[%p1%dF, rmacs=^O, rmkx=\E[19;0j, -+ rmln=\E|, rmso=\E[m, rmul=\E[m, rs2=\Ec\E[?3l\E[2;0y, -+ sc=\E7, -+ sgr=\E[0%?%p1%p5%|%t;2%;%?%p2%p6%|%t;4%;%?%p4%t;5%;%?%p3%p1%|%p6%|%t;7%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, -+ sgr0=\E[m\017, smacs=^N, smkx=\E[19;1j, smln=\E~, -+ smso=\E[7m, smul=\E[4m, tbc=\E[3g, -+ tsl=\E7\E[25;%p1%{8}%+%dH, vpa=\E[%p1%{1}%+%dd, -+att5420_2-w|AT&T 5420 model 2 in 132 column mode, - cols#132, -- dch1@, use=f110, --# (f200: added <acsc> to suppress tic warnings re <smacs>/<rmacs> --esr) --f200|freedom200|Liberty Freedom 200, -- OTbs, am, eslok, hs, mir, msgr, xon, -- cols#80, it#8, lines#24, wsl#80, -- acsc=, bel=^G, blink=\EG2, bold=\EG0, cbt=\EI, civis=\E.0, -- clear=^Z, cnorm=\E.1, cr=^M, -- csr=\Em0%p1%{32}%+%c%p2%{32}%+%c, cub1=^H, cud1=^V, -- cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, -- dch1=\EW, dim=\EG@, dl1=\ER, dsl=\Ef\r, ed=\EY, el=\ET, -- flash=\Eo$<200/>\En, fsl=^M, home=^^, -- hpa=\E]%p1%{32}%+%c, hts=\E1, il1=\EE, ind=^J, kbs=^H, -- kclr=^^, kcub1=^H, kcud1=^V, kcuf1=^L, kcuu1=^K, kdch1=\EW, -- kdl1=\ER, ked=\EY, kel=\ET, kf0=^AI\r, kf1=^A@\r, kf2=^AA\r, -- kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, kf6=^AE\r, kf7=^AF\r, -- kf8=^AG\r, kf9=^AH\r, kich1=\EQ, kil1=\EE, mc4=\Ea, mc5=\E`, -- ri=\EJ, rmacs=\E%%, rmir=\Er, smacs=\E$, smir=\Eq, smso=\EG<, -- tbc=\E3, tsl=\Ef, vpa=\E[%p1%{32}%+%c, use=adm+sgr, --f200-w|Liberty Freedom 200 - 132 cols, -- cols#132, use=f200, --# The f200 has the ability to reprogram the down cursor key. The key is --# reprogrammed to ^J (linefeed). This value is remembered in non-volatile RAM, --# so powering the terminal off and on will not cause the change to be lost. --f200vi|Liberty Freedom 200 for vi, -- flash=\Eb$<200/>\Ed, kcud1=^J, use=f200, --f200vi-w|Liberty Freedom 200 - 132 cols for vi, -- cols#132, use=f200vi, -+ is1=\E[0;23r\Ex\Ey\E[2;0j\E[3;3j\E[4;0j\E[5;1j\E[6;0j\E[7;0j\E[8;0j\E[9;1j\E[10;0j\E[15;0j\E[16;1j\E[19;0j\E[20;1j\E[29;0j\E[1;24r, -+ use=att5420_2, - --#### GraphOn (go) --# --# Graphon Corporation --# 544 Division Street --# Campbell, CA 95008 --# Vox: (408)-370-4080 --# Fax: (408)-370-5047 --# Net: troy@graphon.com (Troy Morrison) --# --# --# The go140 and go225 have been discontinued. GraphOn now makes X terminals, --# including one odd hybrid that starts out life on power-up as a character --# terminal, than can be switched to X graphics mode (driven over the serial --# line) by an escape sequence. No info on this beast yet. --# (go140: I added <rmam>/<smam> based on the init string -- esr) --go140|graphon go-140, -- OTbs, -- cols#80, it#8, lines#24, -- clear=\E[H\E[2J$<10/>, cub1=^H, cud1=\E[B, cuf1=\E[C, -- cup=\E[%i%p1%2d;%p2%2dH, cuu1=\E[A, dch1=\E[P, dl1=\E[M, -- ed=\E[J$<10/>, el=\E[K, ht=^I, -- if=/usr/share/tabset/vt100, il1=\E[L, -- is2=\E<\E=\E[?3l\E[?7l\E(B\E[J\E7\E[;r\E8\E[m\E[q, -- kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kf1=\EOP, -- kf2=\EOQ, kf3=\EOR, kf4=\EOS, khome=\E[H, ri=\EM, -- rmam=\E[?7l, rmir=\E[4l, rmkx=\E[?1l\E>, rmso=\E[m, -- rmul=\E[m, sgr0=\E[m, smam=\E[?7h, smir=\E[4h, -- smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, --go140w|graphon go-140 in 132 column mode, -- am, -+att4418|att5418|AT&T 5418 80 cols, -+ am, xon, -+ cols#80, lines#24, -+ acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -+ bel=^G, blink=\E[5m, clear=\E[H\E[2J, cr=^M, cub=\E[%p1%dD, -+ cub1=\E[D, cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, -+ cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, -+ cuu1=\E[A, dch=\E[%p1%dP, dch1=\E[1P, dim=\E[2m, -+ dl=\E[%p1%dM, dl1=\E[M, ed=\E[0J, el=\E[0K, home=\E[H, -+ ich=\E[%p1%d@, ich1=\E[1@, il=\E[%p1%dL, il1=\E[1L, ind=^J, -+ is1=\E[?3l, is2=\E)0\E?6l\E?5l, kclr=\E[%%, kcub1=\E@, -+ kcud1=\EU, kcuf1=\EA, kcuu1=\ES, kent=\E[, kf1=\E[h, -+ kf10=\E[m, kf11=\E[n, kf12=\E[o, kf13=\E[H, kf14=\E[I, -+ kf15=\E[J, kf18=\E[K, kf19=\E[L, kf2=\E[i, kf20=\E[E, -+ kf21=\E[_, kf22=\E[M, kf23=\E[N, kf24=\E[O, kf3=\E[j, -+ kf6=\E[k, kf7=\E[l, kf8=\E[f, kf9=\E[w, khome=\Ec, rc=\E8, -+ rev=\E[7m, rmacs=^O, rmso=\E[m, rmul=\E[m, sc=\E7, -+ sgr0=\E[m\017, smacs=^N, smso=\E[7m, smul=\E[4m, -+att4418-w|att5418-w|AT&T 5418 132 cols, - cols#132, -- is2=\E<\E=\E[?3h\E[?7h\E(B\E[J\E7\E[;r\E8\E[m\E[q, -- use=go140, --# Hacked up vt200 termcap to handle GO-225/VT220 --# From: <edm@nwnexus.WA.COM> --# (go225: I added <rmam>/<smam> based on the init string -- esr) --go225|go-225|Graphon 225, -- OTbs, am, mir, xenl, -- cols#80, it#8, lines#25, vt#3, -- blink=\E[5m, bold=\E[1m, clear=\E[H\E[J, -- csr=\E[%i%p1%d;%p2%dr, cub1=^H, cud1=^J, cuf1=\E[C, -- cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, dch1=\E[P, dl1=\E[M, -- ed=\E[J, el=\E[K, home=\E[H, ht=^I, il1=\E[L, ind=\ED, -- is2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, kbs=^H, -- kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kf1=\EOP, -- kf2=\EOQ, kf3=\EOR, kf4=\EOS, khome=\E[H, rc=\E8, rev=\E[7m, -- rf=/usr/share/tabset/vt100, ri=\EM, rmam=\E[?7l, -- rmcup=\E[!p\E[?7h\E[2;1;1#w, rmir=\E[4l, rmkx=\E>, -- rmso=\E[27m, rmul=\E[24m, rs1=\E[!p\E[?7h\E[2;1;1#w, -- sc=\E7, sgr0=\E[m, smam=\E[?7h, smcup=\E[2;0#w\E[1;25r, -- smir=\E[4h, smkx=\E=, smso=\E[7m, smul=\E[4m, -+ is1=\E[?3h, use=att5418, - --#### Harris (Beehive) -+att4420|tty4420|teletype 4420, -+ OTbs, da, db, eo, msgr, ul, xon, -+ cols#80, lines#24, lm#72, -+ bel=^G, clear=\EH\EJ, cr=\EG, cub1=\ED, cud1=\EB, cuf1=\EC, -+ cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, dch1=\EP, -+ dl1=\EM, ed=\EJ, el=\Ez, home=\EH, il1=\EL, ind=\EH\EM\EY7\s, -+ kcbt=\EO, kclr=\EJ, kcub1=^H, kcud1=\EB, kcuf1=\EC, -+ kcuu1=\EA, kdch1=\EP, kdl1=\EM, kf0=\EU, kf3=\E@, khome=\EH, -+ kich1=\E\^, kil1=\EL, kind=\ES, kri=\ET, -+ lf0=segment advance, lf3=cursor tab, rmdc@, rmso=\E~, -+ rmul=\EZ, smdc@, smso=\E}, smul=\E\\, -+ -+# The following is a terminfo entry for the Teletype 4424 -+# asynchronous keyboard-display terminal. It supports -+# the vi editor. The terminal must be set up as follows, - # --# Bletch. These guys shared the Terminal Brain Damage laurels with Hazeltine. --# Their terminal group is ancient history now (1995) though the parent --# company is still in business. -+# HIGHLIGHT DEFINITION 3-TONE -+# DISPLAY FUNCTION GROUP III - # -- --# Beehive documentation is undated and marked Preliminary and has no figures --# so we must have early Superbee2 (Model 600, according to phone conversation --# with mfr.). It has proved reliable except for some missing padding --# (notably after \EK and <nl> at bottom of screen). -+# The second entry below provides limited (a la adm3a) -+# operation under GROUP II. - # --# The key idea is that AEP mode is poison for <cup> & that US's in --# the local memory should be avoided like the plague. That means --# that the 2048 character local buffer is used as 25 lines of 80 --# characters, period. No scrolling local memory, folks. It also --# appears that we cannot use naked INS LINE feature since it uses --# US. The sbi fakes <il1> with an 80-space insert that may be too --# slow at low speeds; also spaces get converted to \040 which is --# too long for some programs (not vi). DEL LINE is ok but slow. --# --# The <nl> string is designed for last line of screen ONLY; cup to --# 25th line corrects the motion inherent in scrolling to Page 1. --# --# There is one understood bug. It is that the screen appears to --# pop to a new (blank) page after a <nel>, or leave a half-line --# ellipsis to a quad that is the extra 48 memory locations. The --# data received is dumped into memory but not displayed. Not to --# worry if <cup> is being used; the lines not displayed will be, --# whenever the cursor is moved up there. Since <cup> is addressed --# relative to MEMORY of window, nothing is lost; but beware of --# relative cursor motion (<cuu1>,<cud1>,<cuf1>,<cub1>). Recommended, --# therefore, is setenv MORE -c . --# --# WARNING: Not all features tested. --# --# Timings are assembled from 3 sources. Some timings may reflect --# SB2/Model 300 that were used if more conservative. --# Tested on a Model 600 at 1200 and 9600 bd. --# --# The BACKSPACEkb option is cute. The NEWLINE key, so cleverly --# placed on the keyboard and useless because of AEP, is made --# into a backspace key. In use ESC must be pressed twice (to send) --# and sending ^C must be prefixed by ESC to avoid that weird --# transmit mode associated with ENTER key. --# --# IF TERMINAL EVER GOES CATATONIC with the cursor buzzing across --# the screen, then it has dropped into ENTER mode; hit --# RESET--ONLINE--!tset. --# --# As delivered this machine has a FATAL feature that will throw --# it into that strange transmit state (SPOW) if the space bar is --# hit after a CR is received, but before receiving a LF (or a --# few others). --# --# The circuits MUST be modified to eliminate the SPOW latch. --# This is done by strapping on chip A46 of the I/O board; cut --# the p.c. connection to Pin 5 and strap Pin 5 to Pin 8 of that --# chip. This mod has been checked out on a Mod 600 of Superbee II. --# With this modification absurdly high timings on cr are --# unnecessary. --# --# NOTE WELL that the rear panel switch should be set to CR/LF, --# not AEP! -+# This must be used with DISPLAY FUNCTION GROUP I or III -+# and HIGHLIGHT DEFINITION 3-TONE -+# The terminal has either bold or blink, depending on options - # --sb1|beehive superbee, -- OTbs, am, bw, da, db, mir, ul, xsb, -- cols#80, lines#25, xmc#1, -- bel=^G, cbt=\E`$<650>, clear=\EH$<1>\EJ$<3>, cr=$<1>\r, -- cub1=^H, cud1=^J, cuf1=\EC$<3>, cup=\EF%p2%03d%p1%03d, -- cuu1=\EA$<3>, dch1=\EP$<3>, dl1=\EM$<100>, ed=\EJ$<3>, -- el=\EK$<3>, home=\EH$<1>, ht=^I, hts=\E1, -- il1=\EN\EL$<3>\EQ \EP$<3> \EO\ER\EA$<3>, -- ind=^J, is2=\EE$<3>\EX\EZ\EO\Eb\Eg\ER, kbs=^_, kcub1=\ED, -- kcud1=\EB, kcuf1=\EC, kcuu1=\EA, kdl1=\EM, ked=\EJ, kel=\EK, -- kf0=\E2, kf1=\Ep, kf2=\Eq, kf3=\Er, kf4=\Es, kf5=\Et, kf6=\Eu, -- kf7=\Ev, kf8=\Ew, kf9=\E1, khome=\EH, kich1=\EQ\EO, -- krmir=\ER, lf0=TAB CLEAR, lf9=TAB SET, rmcup=, rmir=\ER, -- rmso=\E_3, rmul=\E_3, sgr0=\E_3, smcup=\EO, smir=\EQ\EO, -- smso=\E_1, smul=\E_0, tbc=\E3, --sbi|superbee|beehive superbee at Indiana U., -- xsb, -- cr=\r$<1>, il1=1\EN\EL$<9>\EQ \EP$<9> \EO\ER\EA, -- use=sb1, --# Alternate (older) description of Superbee - f1=escape, f2=^C. --# Note: there are at least 3 kinds of superbees in the world. The sb1 --# holds onto escapes and botches ^C's. The sb2 is the best of the 3. --# The sb3 puts garbage on the bottom of the screen when you scroll with --# the switch in the back set to CRLF instead of AEP. This description --# is tested on the sb2 but should work on all with either switch setting. --# The f1/f2 business is for the sb1 and the <xsb> can be taken out for --# the other two if you want to try to hit that tiny escape key. --# This description is tricky: being able to use cup depends on there being --# 2048 bytes of memory and the hairy <nl> string. --superbee-xsb|beehive super bee, -- am, da, db, xsb, -- cols#80, it#8, lines#25, -- clear=\EH\EJ$<3>, cnorm=^J, cr=\r$<1000>, cub1=^H, cud1=^J, -- cuf1=\EC, cup=\EF%p2%3d%p1%3d, cuu1=\EA$<3>, -- dch1=\EP$<3>, dl1=\EM$<100>, ed=\EJ$<3>, el=\EK$<3>, -- home=\EH, ht=^I, hts=\E1, -- ind=\n\0\0\0\n\0\0\0\EA\EK\0\0\0\ET\ET, is2=\EH\EJ, -- kcub1=\ED, kcud1=\EB, kcuf1=\EC, kcuu1=\EA, kf1=\Ep, kf2=\Eq, -- kf3=\Er, kf4=\Es, kf5=\Et, kf6=\Eu, kf7=\Ev, kf8=\Ew, -- khome=\EH, rmso=\E_3, sgr0=\E_3, smso=\E_1, tbc=\E3, --# This loses on lines > 80 chars long, use at your own risk --superbeeic|super bee with insert char, -- ich1=, rmir=\ER, smir=\EQ, use=superbee-xsb, --sb2|sb3|fixed superbee, -- xsb@, use=superbee, -+# (att4424: commented out <smcup>=\E[1m, we don't need bright locked on -- esr) -+att4424|tty4424|teletype 4424, -+ OTbs, am, xon, -+ cols#80, lines#24, -+ acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -+ bel=^G, blink=\E3, bold=\E3, cbt=\EO, clear=\E[H\E[2J, cr=^M, -+ csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, -+ cud=\E[%p1%dB, cud1=\EB, cuf=\E[%p1%dC, cuf1=\EC, -+ cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\EA, -+ dch=\E[%p1%dP, dch1=\EP, dim=\EW, dl=\E[%p1%dM, dl1=\EM, -+ ed=\EJ, el=\Ez, home=\E[H, ht=^I, hts=\EH, ich=\E[%p1%d@, -+ ich1=\E\^, il=\E[%p1%dL, il1=\EL, ind=^J, is2=\E[20l\E[?7h, -+ kbs=^H, kclr=\EJ, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, -+ kcuu1=\E[A, kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, -+ khome=\E[H, nel=\EE, rev=\E}, ri=\ET, rmacs=\E(B, rmso=\E~, -+ rmul=\EZ, -+ sgr=\E[%?%p1%t7%;%?%p2%t;4%;%?%p3%t;7%;%?%p6%t;1%;%?%p6%p4%|%t;5%;%?%p5%t;0%;m, -+ sgr0=\EX\E~\EZ\E4\E(B, smacs=\E(0, smso=\E}, smul=\E\\, -+ tbc=\EF, - --#### Beehive Medical Electronics --# --# Steve Seymour <srseymour@mindspring.com> writes (Wed, 03 Feb 1999): --# Regarding your question though; Beehive terminals weren't made by Harris. --# They were made by Beehive Medical Electronics in Utah. They went out of --# business in the early '80s. -+att4424-1|tty4424-1|teletype 4424 in display function group I, -+ kclr@, kcub1=\ED, kcud1=\EB, kcuf1=\EC, kcuu1=\EA, khome@, -+ use=att4424, -+ -+# This entry is not one of AT&T's official ones, it was translated from the -+# 4.4BSD termcap file. The highlight strings are different from att4424. -+# I have no idea why this is -- older firmware version, maybe? -+# The following two lines are the comment originally attached to the entry: -+# This entry appears to avoid the top line - I have no idea why. -+# From: jwb Wed Mar 31 13:25:09 1982 remote from ihuxp -+att4424m|tty4424m|teletype 4424M, -+ am, da, db, mir, -+ cols#80, it#8, lines#23, -+ bel=^G, clear=\E[2;H\E[J, cr=^M, cub1=^H, cud1=^J, cuf1=\E[C, -+ cup=\E[%i%p1%2d;%p2%2dH\E[B, cuu1=\E[A, dch1=\EP, -+ dl1=\EM, el=\E[K, ht=^I, ich1=\E\^, il1=\EL, ind=^J, ip=$<2/>, -+ is2=\E[m\E[2;24r, kbs=^H, kcub1=\E[D, kcud1=\E[B, -+ kcuf1=\E[C, kcuu1=\E[A, kf1=\EOP, kf2=\EOQ, kf3=\EOR, -+ kf4=\EOS, khome=\E[H, nel=^M^J, ri=\ET, rmso=\E[m, rmul=\E[m, -+ sgr0=\E[m, smso=\E[7m, smul=\E[4m, -+ -+# The Teletype 5425 is really version 2 of the Teletype 5420. It -+# is quite similar, except for some minor differences. No page -+# mode, for example, so all of the <cup> sequences used above have -+# to change back to what's being used for the 5410. Many of the -+# option settings have changed their numbering as well. - # --# (OK, then, I don't know why a couple of these say "harris beehive".) -+# This has been tested on a preliminary model. - # -+# (att5425: added <rmam>/<smam> based on the init string -- esr) -+att5425|tty5425|att4425|AT&T 4425/5425, -+ am, da, db, hs, mir, msgr, xenl, xon, -+ cols#80, it#8, lh#2, lines#24, lm#78, lw#8, nlab#8, wsl#55, -+ acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -+ bel=^G, blink=\E[5m, bold=\E[2;7m, cbt=\E[Z, -+ clear=\E[H\E[J, cnorm=\E[12;0j, cr=^M, -+ csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, -+ cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, -+ cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, -+ cvvis=\E[12;1j, dch=\E[%p1%dP, dch1=\E[P, dim=\E[2m, -+ dl=\E[%p1%dM, dl1=\E[M, ech=\E[%p1%ds\E[%p1%dD, ed=\E[J, -+ el=\E[K, el1=\E[1K, enacs=\E(B\E)0, -+ flash=\E[?5h$<200>\E[?5l, fsl=\E8, home=\E[H, -+ hpa=\E[%p1%{1}%+%dG, ht=^I, hts=\EH, ich=\E[%p1%d@, -+ il=\E[%p1%dL, il1=\E[L, ind=^J, indn=\E[%p1%dE, -+ invis=\E[8m, is1=\E<\E[?3l$<100>, -+ is2=\E[m\017\E[1;2;3;4;6l\E[12;13;14;20l\E[?6;97;99l\E[?7h\E[4i\Ex\E[25;1j\212, -+ is3=\E[?5l, kbeg=\Et, kbs=^H, kcbt=\E[Z, kclr=\E[J, -+ kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[P, -+ kdl1=\E[M, kel=\E[2K, kend=\Ez, kent=\Eent, kf1=\EOc, -+ kf2=\EOd, kf3=\EOe, kf4=\EOf, kf5=\EOg, kf6=\EOh, kf7=\EOi, -+ kf8=\EOj, khome=\E[H, kich1=\E[4h, kil1=\E[L, kind=\E[T, -+ kri=\E[S, ll=\E[24H, mc0=\E[?2i, mc4=\E[?9i, mc5=\E[?4i, -+ nel=^M^J, -+ pfx=\E[%p1%d;%p2%l%02dq F%p1%1d %p2%s, -+ pln=\E[%p1%d;0;0;0q%p2%:-16.16s, prot=\EV, rc=\E8, -+ rev=\E[7m, ri=\EM, rin=\E[%p1%dF, rmacs=^O, rmam=\E[?7l, -+ rmir=\E[4l, rmkx=\E[21;0j\E[25;1j\212, rmln=\E|, -+ rmso=\E[m, rmul=\E[m, rs2=\Ec\E[?3l\E[2;0y, sc=\E7, -+ sgr=\E[0%?%p5%p6%|%t;2%;%?%p2%t;4%;%?%p4%t;5%;%?%p3%p1%|%p6%|%t;7%;%?%p7%t;8%;m%?%p8%t\EV%;%?%p9%t\016%e\017%;, -+ sgr0=\E[m\017, smacs=^N, smam=\E[?7h, smir=\E[4h, -+ smkx=\E[21;1j\E[25;4j\Eent\E~, smln=\E~, smso=\E[7m, -+ smul=\E[4m, tbc=\E[3g, tsl=\E7\E[25;%p1%{8}%+%dH, -+ vpa=\E[%p1%{1}%+%dd, - --# Reports are that most of these Beehive entries (except superbee) have not --# been tested and do not work right. <rmso> is a trouble spot. Be warned. -- --# (bee: <ich1> was empty, which is obviously bogus -- esr) --beehive|bee|harris beehive, -- OTbs, am, mir, -- cols#80, lines#24, -- cbt=\E>, clear=\EE, cub1=^H, cud1=\EB, cuf1=\EC, -- cup=\EF%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, dch1=\EP, -- dl1=\EM, ed=\EJ, el=\EK, home=\EH, il1=\EL, kbs=^H, kcbt=\E>, -- kclr=\EE, kcub1=\ED, kcud1=\EB, kcuf1=\EC, kcuu1=\EA, -- kdch1=\EP, kdl1=\EM, kel=\EK, khome=\EH, kich1=\EQ, kil1=\EL, -- krmir=\E@, rmir=\E@, rmso=\Ed@, rmul=\Ed@, sgr0=\Ed@, -- smir=\EQ, smso=\EdP, smul=\Ed`, --# set tab is ^F, clear (one) tab is ^V, no way to clear all tabs. --# good grief - does this entry make :sg:/:ug: when it doesn't have to? --# look at those spaces in <rmso>/<smso>. Seems strange to me... --# (beehive: <if=/usr/share/tabset/beehive> removed, no such file. If you --# really care, cook up one using ^F -- esr) --beehive3|bh3m|beehiveIIIm|harris beehive 3m, -- OTbs, am, -- cols#80, it#8, lines#20, -- bel=^G, clear=^E^R, cr=^M, cub1=^H, cud1=^J, cuf1=^L, cuu1=^K, -- dl1=\021$<350>, ed=^R, el=^P, home=^E, ht=^I, hts=^F, -- il1=\023$<160>, ind=^J, ll=^E^K, rmso=\s^_, smso=^]\s, --beehive4|bh4|beehive 4, -- am, -- cols#80, lines#24, -- bel=^G, clear=\EE, cr=^M, cub1=\ED, cud1=^J, cuf1=\EC, -- cuu1=\EA, ed=\EJ, el=\EK, home=\EH, ind=^J, --# There was an early Australian kit-built computer called a "Microbee". --# It's not clear whether this is for one of those or for a relative --# of the Beehive. --microb|microbee|micro bee series, -- OTbs, am, -- cols#80, it#8, lines#24, -- bel=^G, clear=\EE, cr=^M, cub1=^H, cud1=^J, cuf1=\EC, -- cup=\EF%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, ed=\EJ, -- el=\EK, ht=^I, ind=^J, kcub1=\ED, kcud1=\EB, kcuf1=\EC, -- kcuu1=\EA, kf1=\Ep, kf2=\Eq, kf3=\Er, kf4=\Es, kf5=\Et, -- kf6=\Eu, kf7=\Ev, kf8=\Ew, kf9=\Ex, khome=\EH, rmso=\Ed@, -- rmul=\Ed@, sgr0=\Ed@, smso=\s\EdP, smul=\Ed`, -+att5425-nl|tty5425-nl|att4425-nl|AT&T 4425/5425 80 columns no labels, -+ smkx=\E[21;1j\E[25;4j\Eent, use=att4425, - --# 8675, 8686, and bee from Cyrus Rahman --# (8675: changed k10, k11...k16 to k;, F1...F6 -- esr) --ha8675|harris 8675, -- is2=\ES\E#\E*\Eh\Em\E?\E1\E9\E@\EX\EU, kf1=^F, -- kf10=\Ed, kf11=^W, kf12=\ER, kf13=\EE, kf14=\EI, kf15=\Ei, -- kf16=\Eg, kf2=^P, kf3=^N, kf4=^V, kf5=^J, kf6=^T, kf7=^H, -- kf8=\177, kf9=\Ee, use=bee, --# (8686: changed k10, k11...k16 to k;, F1...F6; fixed broken continuation --# in :is: -- esr) --ha8686|harris 8686, -- is2=\ES\E#\E*\Eh\Em\E?\E1\E9\E@\EX\EU\E"*Z01\E"8F35021B7C83#\E"8F45021B7D83#\E"8F55021B7E83#\E"8F65021B7F83#\E"8F75021B7383#\E"8F851BD7#\E"8F95021B7083#\E"8FA5021B7183#\E"8FB5021B7283#, -- kf1=\002\Ep\003, kf10=\Ej, kf11=\EW, kf12=\002\E{\003, -- kf13=\002\E|\003, kf14=\002\E}\003, kf15=\002\E~\003, -- kf16=\002\E\177\003, kf2=\002\Eq\003, kf3=\002\Er\003, -- kf4=\002\Es\003, kf5=\E3, kf6=\EI, kf7=\ER, kf8=\EJ, kf9=\E(, -- use=bee, -+att5425-w|att4425-w|tty5425-w|teletype 4425/5425 in 132 column mode, -+ cols#132, lm#54, wsl#97, -+ is1=\E[?3h$<100>, use=tty5425, - --#### Hazeltine --# --# Hazeltine appears to be out of the terminal business as of 1995. These --# guys were co-owners of the Terminal Brain Damage Hall Of Fame along with --# Harris. They have a hazeltine.com domain (but no web page there ) and can --# be reached at: --# --# Hazeltine --# 450 East Pulaski Road --# Greenlawn, New York 11740 --# --# As late as 1993, manuals for the terminal product line could still be --# purchased from: --# --# TRW Customer Service Division --# 15 Law Drive --# P.O. Box 2076 --# Fairfield, NJ 07007-2078 --# --# They're now (1998) a subsidiary of General Electric, operating under the --# marque "GEC-Marconi Hazeltine" and doing military avionics. Web page --# at <http://www.gec.com/cpd/1ncpd.htm#1.55>. --# -+# (att4426: his had bogus capabilities: :ri=\EM:, :ri=\E[1U:. -+# I also added <rmam>/<smam> -- esr) -+att4426|tty4426|teletype 4426S, -+ am, da, db, xon, -+ cols#80, lines#24, lm#48, -+ acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -+ bel=^G, bold=\E[5m, clear=\E[H\E[2J\E[1U\E[H\E[2J\E[1V, -+ cr=^M, cub=\E[%p1%dD, cub1=\E[D, cud=\E[%p1%dB, cud1=\E[B, -+ cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, -+ cuu=\E[%p1%dA, cuu1=\E[A, dch=\E[%p1%dP, dch1=\EP, -+ dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[0K, home=\E[H, -+ hpa=\E[%p1%dG, ht=^I, hts=\E1, ich=\E[%p1%d@, ich1=\E\^, -+ il=\E[%p1%dL, il1=\EL, ind=^J, indn=\E[%p1%dS, -+ is1=\Ec\E[?7h, is2=\E[m\E[1;24r, kbs=^H, kcbt=\EO, -+ kclr=\E[2J, kcub1=\ED, kcud1=\EB, kcuf1=\EC, kcuu1=\EA, -+ kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, kf5=\EOT, kf6=\EOU, -+ kf7=\EOV, kf8=\EOW, khome=\E[H, kll=\E[24;1H, ll=\E[24H, -+ nel=^M^J, rc=\E8, rev=\E[7m, ri=\ET, rin=\E[%p1%dT, -+ rmacs=\E(B, rmam=\E[?7l, rmso=\E[m, rmul=\E[m, -+ rs2=\Ec\E[?3l\E[2;0y, sc=\E7, sgr0=\E[m\E(B, smacs=\E(0, -+ smam=\E[?7h, smso=\E[5m, smul=\E[4m, tbc=\E[3g, -+ vpa=\E[%p1%dd, - --# Since <cuf1> is blank, when you want to erase something you --# are out of luck. You will have to do ^L's a lot to --# redraw the screen. h1000 is untested. It doesn't work in --# vi - this terminal is too dumb for even vi. (The code is --# there but it isn't debugged for this case.) --hz1000|hazeltine 1000, -- OTbs, -- cols#80, lines#12, -- bel=^G, clear=^L, cr=^M, cub1=^H, cud1=^J, cuf1=\s, home=^K, -- ind=^J, --# From: <cbosg!ucbvax!pur-ee!cincy!chris> Thu Aug 20 09:09:18 1981 --hz1420|hazeltine 1420, -- OTbs, am, -- cols#80, lines#24, -- bel=^G, clear=\E^\, cr=^M, cub1=^H, cud1=^J, cuf1=^P, -- cup=\E\021%p2%c%p1%{32}%+%c, cuu1=\E^L, dl1=\E^S, -- ed=\E^X, el=\E^O, ht=^N, il1=\E^Z, ind=^J, rmso=\E^Y, -- smso=\E^_, --# New "safe" cursor movement (11/87) from <cgs@umd5.umd.edu>. Prevents --# freakout with out-of-range args and tn3270. No hz since it needs to --# receive tildes. --hz1500|hazeltine 1500, -- OTbs, am, hz, -- cols#80, lines#24, -- bel=^G, clear=~^\, cr=^M, cub1=^H, cud1=~^K, cuf1=^P, -- cup=~\021%p2%p2%?%{30}%>%t%{32}%+%;%{96}%+%c%p1%{96}%+%c, -- cuu1=~^L, dl1=~\023$<40>, ed=~\030$<10>, el=~^O, home=~^R, -- il1=~\032$<40>, ind=^J, kcub1=^H, kcud1=^J, kcuf1=^P, -- kcuu1=~^L, khome=~^R, rmso=~^Y, smso=~^_, --# h1510 assumed to be in sane escape mode. Else use h1500. --# (h1510: early versions of this entry apparently had "<rmso=\E^_>, --# <smso=\E^Y>, but these caps were commented out in 8.3; also, --# removed incorrect and overridden ":do=^J:" -- esr) --hz1510|hazeltine 1510, -- OTbs, am, -- cols#80, lines#24, -- bel=^G, clear=\E^\, cr=^M, cub1=^H, cud1=\E^K, cuf1=^P, -- cup=\E\021%p2%c%p1%c, cuu1=\E^L, dl1=\E^S, ed=\E^X, -- el=\E^O, il1=\E^Z, ind=^J, --# Hazeltine 1520 --# The following switch settings are assumed for normal operation: --# FULL CR U/L_CASE ESCAPE --# FORMAT_OFF EOM_A_OFF EOM_B_OFF WRAPAROUND_ON --# Other switches may be set for operator convenience or communication --# requirements. --hz1520|Hazeltine 1520, -- OTbs, am, bw, msgr, -- cols#80, lines#24, -- bel=^G, bold=\E^_, clear=\E^\, cr=^M, cub1=^H, cud1=^J, -- cuf1=^P, cup=\E\021%p2%c%p1%c, cuu1=\E^L, dl1=\E^S, -- ed=\E^X, el=\E^O, home=\E^R, il1=\E^Z, ind=^J, kbs=^H, -- kclr=\E^\, kcub1=^H, kcud1=\E^K, kcuf1=^P, kcuu1=\E^L, -- kdl1=\E^S, ked=\E^X, kel=\E^O, khome=\E^R, kil1=\E^Z, -- rmso=\E^Y, rs1=\E$\E\005\E?\E\031, sgr0=\E^Y, smso=\E^_, --# This version works with the escape switch off --# (h1520: removed incorrect and overridden ":do=^J:" -- esr) --hz1520-noesc|hazeltine 1520, -- am, hz, -- cols#80, lines#24, -- bel=^G, clear=~^\, cr=^M, cub1=^H, cud1=~^K, cuf1=^P, -- cup=~\021%p2%c%p1%c$<1>, cuu1=~^L, dl1=~^S, ed=~^X, el=~^O, -- home=~^R, il1=~^Z, ind=^J, rmso=~^Y, smso=~^_, --# Note: the h1552 appears to be the first Hazeltine terminal which --# is not braindamaged. It has tildes and backprimes and everything! --# Be sure the auto lf/cr switch is set to cr. --hz1552|hazeltine 1552, -- OTbs, -- cud1=^J, dl1=\EO, il1=\EE, kf1=\EP, kf2=\EQ, kf3=\ER, lf1=blue, -- lf2=red, lf3=green, use=vt52, --hz1552-rv|hazeltine 1552 reverse video, -- cud1=^J, rmso=\ET, smso=\ES, use=hz1552, --# Note: h2000 won't work well because of a clash between upper case and ~'s. --hz2000|hazeltine 2000, -- OTbs, OTnc, am, -- cols#74, lines#27, -- bel=^G, clear=~\034$<6>, cub1=^H, cud1=^J, -- cup=~\021%p2%c%p1%c, dl1=~\023$<6>, home=~^R, -- il1=~\032$<6>, ind=^J, pad=\177, --# Date: Fri Jul 23 10:27:53 1982. Some unknown person wrote: --# I tested this termcap entry for the Hazeltine Esprit with vi. It seems --# to work ok. There is one problem though if one types a lot of garbage --# characters very fast vi seems not able to keep up and hangs while trying --# to insert. That's in insert mode while trying to insert in the middle of --# a line. It might be because the Esprit doesn't have insert char and delete --# char as a built in function. Vi has to delete to end of line and then --# redraw the rest of the line. --esprit|Hazeltine Esprit I, -- OTbs, am, bw, -- cols#80, lines#24, -- bel=^G, cbt=\E^T, clear=\E^\, cr=^M, cub1=^H, cud1=\E^K, -- cuf1=^P, cup=\E\021%p2%c%p1%c, cuu1=\E^L, dl1=\E^S, -- ed=\E^W, el=\E^O, home=\E^R, il1=\E^Z, ind=^J, is2=\E?, kbs=^H, -- kcub1=^H, kcud1=\E^K, kcuf1=^P, kcuu1=\E^L, kf0=^B0^J, -- kf1=^B1^J, kf2=^B2^J, kf3=^B3^J, kf4=^B4^J, kf5=^B5^J, -- kf6=^B6^J, kf7=^B7^J, kf8=^B8^J, kf9=^B9^J, khome=\E^R, -- lf0=0, lf1=1, lf2=2, lf3=3, lf4=4, lf5=5, lf6=6, lf7=7, lf8=8, lf9=9, -- rmkx=\E>, rmso=\E^Y, smkx=\E<, smso=\E^_, --esprit-am|hazeltine esprit auto-margin, -- am, use=esprit, --# Hazeltine Modular-1 from Cliff Shackelton <ittvax!ittral!shackelt> via BRL --# Vi it seems always wants to send a control J for "do" and it turned out --# that the terminal would work somewhat if the auto LF/CR was turned off. --# (hmod1: removed :dn=~^K: -- esr) --hmod1|Hazeltine Modular 1, -- OTbs, am, hz, -- cols#80, lines#24, -- bel=^G, cbt=~^T, clear=~^\, cr=^M, cub1=^H, cud1=~^K, cuf1=^P, -- cup=~\021%p2%c%p1%c, cuu1=~^L, dl1=~^S, home=~^R, il1=~^Z, -- ind=^J, kcub1=^H, kcud1=~^K, kcuf1=^P, kcuu1=~^L, khome=~^R, -- rc=~^Q, rmso=~^Y, sc=~^E, sgr0=~^Y, smso=~^_, -+# Terminfo entry for the AT&T 510 A Personal Terminal -+# Function keys 9 - 16 are available only after the -+# screen labeled (soft keys/action blocks) are labeled. Function key -+# 9 corresponds to the leftmost touch target on the screen, -+# function key 16 corresponds to the rightmost. - # --# Hazeltine Executive 80 Model 30 (1554?) --# from Will Martin <control@ALMSA-1.ARPA> via BRL --# Like VT100, except for different "am" behavior. --hazel|exec80|h80|he80|Hazeltine Executive 80, -- OTbs, OTpt, am, -- cols#80, it#8, lines#24, vt#3, -- OTnl=^J, bel=^G, blink=\E[5m$<2/>, bold=\E[1m$<2/>, -- clear=\E[;H\E[2J$<50/>, cr=^M, csr=\E[%i%p1%d;%p2%dr, -- cub1=^H, cud1=^J, cuf1=\E[C$<2/>, -- cup=\E[%i%p1%d;%p2%dH$<5/>, cuu1=\E[A$<2/>, -- ed=\E[J$<50/>, el=\E[K$<3/>, home=\E[H, ht=^I, -- is2=\E[1;24r\E[24;1H, kbs=^H, kcub1=\EOD, kcud1=\EOB, -- kcuf1=\EOC, kcuu1=\EOA, kf1=\EOP, kf2=\EOQ, kf3=\EOR, -- kf4=\EOS, rc=\E8, rev=\E[7m$<2/>, -- rf=/usr/share/tabset/vt100, ri=\EM$<5/>, -- rmkx=\E[?1l\E>, rmso=\E[m$<2/>, rmul=\E[m$<2/>, -- rs1=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sc=\E7, -- sgr0=\E[m$<2/>, smkx=\E[?1h\E=, smso=\E[7m$<2/>, -- smul=\E[4m$<2/>, -+# This entry is based on one done by Ernie Rice at Summit, NJ and -+# changed by Anne Gallup, Skokie, IL, ttrdc!anne -+att510a|bct510a|AT&T 510A Personal Terminal, -+ am, mir, msgr, xenl, xon, -+ cols#80, lh#2, lines#24, lw#7, nlab#8, -+ acsc=+g\,h-f.e`bhrisjjkkllmmnnqqttuuvvwwxx{{||}}~~, -+ bel=^G, blink=\E[5m, bold=\E[2;7m, cbt=\E[Z, -+ civis=\E[11;0|, clear=\E[H\E[J, cnorm=\E[11;3|, cr=^M, -+ cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=\E[B, -+ cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, -+ cuu=\E[%p1%dA, cuu1=\E[A, cvvis=\E[11;2|, dch=\E[%p1%dP, -+ dch1=\E[P, dim=\E[2m, dl=\E[%p1%dM, dl1=\E[M, ed=\E[0J, -+ el=\E[0K, el1=\E[1K, enacs=\E(B\E)1, ff=^L, home=\E[H, ht=^I, -+ hts=\EH, il=\E[%p1%dL, il1=\E[L, ind=^J, is1=\E(B\E)1\E[2l, -+ is3=\E[21;1|\212, kLFT=\E[u, kRIT=\E[v, kbs=^H, kcbt=\E[Z, -+ kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kf1=\EOm, -+ kf10=\EOd, kf11=\EOe, kf12=\EOf, kf13=\EOg, kf14=\EOh, -+ kf15=\EOi, kf16=\EOj, kf2=\EOV, kf3=\EOu, kf4=\ENj, kf5=\ENe, -+ kf6=\ENf, kf7=\ENh, kf8=\E[H, kf9=\EOc, kind=\E[S, kri=\E[T, -+ mc0=\E[0i, mc4=\E[?8i, mc5=\E[?4i, nel=\EE, -+ pln=\E[%p1%dp%p2%:-16s, rc=\E8, rev=\E[7m, ri=\EM, -+ rmacs=^O, rmkx=\E[19;0|, rmso=\E[m, rmul=\E[m, sc=\E7, -+ sgr=\E[0%?%p5%p6%|%t;2%;%?%p2%t;4%;%?%p4%t;5%;%?%p3%p1%|%p6%|%t;7%;m%?%p9%t\016%e\017%;, -+ sgr0=\E[m\017, smacs=^N, smkx=\E[19;1|, smso=\E[7m, -+ smul=\E[4m, tbc=\E[3g, - --#### IBM -+# Terminfo entry for the AT&T 510 D Personal Terminal -+# Function keys 9 through 16 are accessed by bringing up the -+# system blocks. -+# Function key 9 corresponds to the leftmost touch target on the screen, -+# function key 16 corresponds to the rightmost. - # -+# There are problems with soft key labeling. These are due to -+# strangenesses in the native terminal that are impossible to -+# describe in a terminfo. -+att510d|bct510d|AT&T 510D Personal Terminal, -+ am, da, db, mir, msgr, xenl, xon, -+ cols#80, lh#2, lines#24, lm#48, lw#7, nlab#8, -+ acsc=+g\,h-f.e`bhrisjjkkllmmnnqqttuuvvwwxx{{||}}~~, -+ bel=^G, blink=\E[5m, bold=\E[2;7m, cbt=\E[Z, -+ clear=\E[H\E[J, cnorm=\E[11;3|, cr=^M, cub=\E[%p1%dD, -+ cub1=^H, cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, -+ cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, -+ cuu1=\E[A, cvvis=\E[11;2|, dch=\E[%p1%dP, dch1=\E[P, -+ dim=\E[2m, dl=\E[%p1%dM, dl1=\E[M, ed=\E[0J, el=\E[0K, -+ el1=\E[1K, enacs=\E(B\E)1, ff=^L, home=\E[H, -+ hpa=\E[%p1%{1}%+%dG, ht=^I, hts=\EH, ich=\E[%p1%d@, -+ il=\E[%p1%dL, il1=\E[L, ind=^J, indn=\E[%p1%dS, -+ invis=\E[8m, is1=\E(B\E)1\E[5;0|, is3=\E[21;1|\212, -+ kLFT=\E[u, kRIT=\E[v, kbs=^H, kcbt=\E[Z, kcub1=\E[D, -+ kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kf1=\EOm, kf10=\EOd, -+ kf11=\EOe, kf12=\EOf, kf13=\EOg, kf14=\EOh, kf15=\EOi, -+ kf16=\EOj, kf2=\EOV, kf3=\EOu, kf4=\ENj, kf5=\ENe, kf6=\ENf, -+ kf7=\ENh, kf8=\E[H, kf9=\EOc, kind=\E[S, kri=\E[T, ll=\E#2, -+ mc0=\E[0i, mc4=\E[?8i, mc5=\E[?4i, mgc=\E\:, nel=\EE, -+ pln=\E[%p1%dp%p2%:-16s, rc=\E8, -+ rep=%p1%c\E[%p2%{1}%-%db, rev=\E[7m, ri=\EM, -+ rin=\E[%p1%dT, rmacs=^O, rmir=\E[4l, rmkx=\E[19;0|, -+ rmln=\E<, rmso=\E[m, rmul=\E[m, rmxon=\E[29;1|, -+ rs2=\E[5;0|, sc=\E7, -+ sgr=\E[0%?%p5%p6%|%t;2%;%?%p2%t;4%;%?%p4%t;5%;%?%p3%p1%|%p6%|%t;7%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, -+ sgr0=\E[m\017, smacs=^N, smgl=\E4, smgr=\E5, smir=\E[4h, -+ smkx=\E[19;1|, smln=\E?, smso=\E[7m, smul=\E[4m, -+ smxon=\E[29;0|, tbc=\E[3g, vpa=\E[%p1%{1}%+%dd, - --ibm327x|line mode IBM 3270 style, -- gn, -- clear=^M^J, el=^M, home=^M, -- --ibm3101|i3101|IBM 3101-10, -- OTbs, am, xon, -- cols#80, lines#24, -- bel=^G, clear=\EK, cr=^M, cub1=^H, cud1=^J, cuf1=\EC, -- cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, ed=\EJ, -- el=\EI, home=\EH, hts=\E0, ind=^J, kcub1=\ED, kcud1=\EB, -- kcuf1=\EC, kcuu1=\EA, nel=^M^J, tbc=\EH, --ibm3151|IBM 3151 display, -- is2=\E S, rmacs=\E>B, rmcup=\E>B, rs2=\E S, s0ds=\E>B, -- sgr=\E4%{64}%?%p1%t%{65}%|%;%?%p2%t%{66}%|%;%?%p3%t%{65}%|%;%?%p4%t%{68}%|%;%?%p5%t%{64}%|%;%?%p6%t%{72}%|%;%?%p7%t%{80}%|%;%c%?%p9%t\E>A%e\E>B%;, -- sgr0=\E4@\E>B, smacs=\E>A, smcup=\E>B, use=ibm3162, --# From: Mark Easter <marke@fsi-ssd.csg.ssd.fsi.com> 29 Oct 1992 --# removed kend, knp, kpp -TD --ibm3161|ibm3163|wy60-316X|wyse60-316X|IBM 3161/3163 display, -- OTbs, am, mir, msgr, -- cols#80, it#8, lines#24, -- acsc=j\352k\353l\354m\355n\356q\361t\364u\365v\366w\367x\370, -- bel=^G, blink=\E4D, bold=\E4H, clear=\EH\EJ, cr=^M, cub1=\ED, -- cud1=\EB, cuf1=\EC, cup=\EY%p1%{32}%+%c%p2%{32}%+%c, -- cuu1=\EA, dch1=\EQ, dl1=\EO, ed=\EJ, el=\EI, home=\EH, ind=^J, -- invis=\E4P, kbs=^H, kcbt=\E2, kclr=\EL\r, kctab=\E1, -- kcub1=\ED, kcud1=\EB, kcuf1=\EC, kcuu1=\EA, kdch1=\EQ, -- kdl1=\EO, ked=\EJ, kel=\EI, kf1=\Ea\r, kf10=\Ej\r, -- kf11=\Ek\r, kf12=\El\r, kf13=\E!a\r, kf14=\E!b\r, -- kf15=\E!c\r, kf16=\E!d\r, kf17=\E!e\r, kf18=\E!f\r, -- kf19=\E!g\r, kf2=\Eb\r, kf20=\E!h\r, kf21=\E!i\r, -- kf22=\E!j\r, kf23=\E!k\r, kf24=\E!l\r, kf3=\Ec\r, -- kf4=\Ed\r, kf5=\Ee\r, kf6=\Ef\r, kf7=\Eg\r, kf8=\Eh\r, -- kf9=\Ei\r, khome=\EH, khts=\E0, kich1=\EP \010, kil1=\EN, -- ktbc=\E 1, mc4=^P^T, mc5=^P^R, rev=\E4A, rmcup=\E>A, -- rmso=\E4@, rmul=\E4@, -- sgr=\E4%{64}%?%p1%t%{65}%|%;%?%p2%t%{66}%|%;%?%p3%t%{65}%|%;%?%p4%t%{68}%|%;%?%p5%t%{64}%|%;%?%p6%t%{72}%|%;%?%p7%t%{80}%|%;%c%?%p9%t\E>A%e\E<@%;, -- sgr0=\E4@\E<@, smcup=\E>A, smso=\E4A, smul=\E4B, -+# (att500: I merged this with the att513 entry, att500 just used att513 -- esr) -+att500|att513|AT&T 513 using page mode, -+ am, chts, mir, msgr, xenl, xon, -+ cols#80, lh#2, lines#24, lw#8, nlab#8, -+ acsc=+g\,h-f.e`bhrisjjkkllmmnnqqttuuvvwwxx{{||}}~~, -+ bel=^G, blink=\E[5m, bold=\E[2;7m, cbt=\E[Z, -+ clear=\E[H\E[J, cnorm=\E[11;0|, cr=^M, -+ csr=%i\E[%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, -+ cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, -+ cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, -+ cvvis=\E[11;1|, dch=\E[%p1%dP, dch1=\E[P$<1>, dim=\E[2m, -+ dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[K, el1=\E[1K, -+ enacs=\E(B\E)1, home=\E[H, hpa=\E[%p1%{1}%+%dG, ht=^I, -+ hts=\EH, ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[L, ind=^J, -+ indn=\E[%p1%dE, invis=\E[8m, -+ is1=\E?\E[3;3|\E[10;0|\E[21;1|\212\E[6;1|\E[1{\E[?99l, -+ kBEG=\ENB, kCAN=\EOW, kCMD=\EOU, kCPY=\END, kCRT=\EON, -+ kDC=\ENF, kDL=\ENE, kEND=\ENN, kEOL=\EOA, kEXT=\EOK, -+ kFND=\EOX, kHLP=\EOM, kHOM=\ENM, kIC=\ENJ, kLFT=\ENK, -+ kMOV=\ENC, kMSG=\EOL, kNXT=\ENH, kOPT=\EOR, kPRT=\EOZ, -+ kPRV=\ENG, kRDO=\EOT, kRES=\EOQ, kRIT=\ENL, kRPL=\EOY, -+ kSAV=\EOO, kSPD=\EOP, kUND=\EOS, kbeg=\E9, kbs=^H, kcan=\EOw, -+ kcbt=\E[Z, kclo=\EOV, kclr=\E[J, kcmd=\EOu, kcpy=\ENd, -+ kcrt=\EOn, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, -+ kdch1=\ENf, kdl1=\ENe, kel=\EOa, kend=\E0, kent=\Eent, -+ kext=\EOk, kf1=\EOc, kf2=\EOd, kf3=\EOe, kf4=\EOf, kf5=\EOg, -+ kf6=\EOh, kf7=\EOi, kf8=\EOj, kfnd=\EOx, khlp=\EOm, -+ khome=\E[H, kich1=\ENj, kind=\E[S, kmov=\ENc, kmrk=\ENi, -+ kmsg=\EOl, knp=\E[U, knxt=\ENh, kopn=\EOv, kopt=\EOr, -+ kpp=\E[V, kprt=\EOz, kprv=\ENg, krdo=\EOt, kref=\EOb, -+ kres=\EOq, krfr=\ENa, kri=\E[T, krpl=\EOy, krst=\EOB, -+ ksav=\EOo, kslt=\ENI, kspd=\EOp, kund=\EOs, ll=\E#2, -+ mc0=\E[?98l\E[0i, mc4=\E[?98l\E[?8i, mc5=\E[?98l\E[?4i, -+ nel=\EE, -+ pfkey=\E[%p1%d;%p2%l%d;3;0p F%p1%d %p2%s, -+ pfloc=\E[%p1%d;%p2%l%d;2;0p F%p1%d %p2%s, -+ pfx=\E[%p1%d;%p2%l%d;1;0p F%p1%d %p2%s, -+ pln=\E[%p1%dp%p2%:-16s, rc=\E8, -+ rep=%p1%c\E[%p2%{1}%-%db, rev=\E[7m, ri=\EM, -+ rin=\E[%p1%dF, rmacs=^O, rmir=\E[4l, -+ rmkx=\E[19;0|\E[21;1|\212, rmln=\E<, rmso=\E[m, -+ rmul=\E[m, -+ rs1=\E?\E[3;3|\E[10;0|\E[21;1|\212\E[6;1|\E[1{\E[?99l\E[2;0|\E[6;1|\E[8;0|\E[19;0|\E[1{\E[?99l, -+ rs2=\E[5;0|, sc=\E7, -+ sgr=\E[0%?%p1%p5%|%t;2%;%?%p2%p6%|%t;4%;%?%p4%t;5%;%?%p3%p1%|%p6%|%t;7%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, -+ sgr0=\E[m\017, smacs=^N, smir=\E[4h, -+ smkx=\E[19;1|\E[21;4|\Eent, smln=\E?, smso=\E[7m, -+ smul=\E[4m, tbc=\E[3g, vpa=\E[%p1%{1}%+%dd, - --ibm3161-C|IBM 3161-C NLS terminal using cartridge, -- rmcup=\E>B, s0ds=\E>B, s1ds=\E>A, smcup=\E>B, use=ibm3161, --ibm3162|IBM 3162 display, -- blink=\E4$a, bold=\E4(a, il1=\EN, invis=\E40a, rev=\E4!a, -- rmso=\E4>b, rmul=\E4=b, sgr0=\E4@, smso=\E4!a, smul=\E4"a, -- use=ibm3161-C, -+# 01-07-88 -+# printer must be set to EMUL ANSI to accept ESC codes -+# <cuu1> stops at top margin -+# <is1> sets cpi 10,lpi 6,form 66,left 1,right 132,top 1,bottom 66,font -+# and alt font ascii,wrap on,tabs cleared -+# <is2> disables newline on LF,Emphasized off -+# The <u0> capability sets form length -+att5310|att5320|AT&T Model 53210 or 5320 matrix printer, -+ xhpa, xvpa, -+ bufsz#8192, cols#132, cps#120, it#8, lines#66, orc#10, -+ orhi#100, orl#12, orvi#72, -+ cpi=%?%p1%{10}%=%t\E[w%e%p1%{12}%=%t\E[2w%e%p1%{5}%=%t\E[5w%e%p1%{13}%=%p1%{14}%=%O%t\E[3w%e%p1%{16}%=%p1%{17}%=%O%t\E[4w%e%p1%{6}%=%t\E[6w%e%p1%{7}%=%t\E[7w%e%p1%{8}%=%t\E[8w%;, -+ cr=^M, -+ csnm=%?%p1%{0}%=%tusascii%e%p1%{1}%=%tenglish%e%p1%{2}%=%tfinnish%e%p1%{3}%=%tjapanese%e%p1%{4}%=%tnorwegian%e%p1%{5}%=%tswedish%e%p1%{6}%=%tgermanic%e%p1%{7}%=%tfrench%e%p1%{8}%=%tcanadian_french%e%p1%{9}%=%titalian%e%p1%{10}%=%tspanish%e%p1%{11}%=%tline%e%p1%{12}%=%tsecurity%e%p1%{13}%=%tebcdic%e%p1%{14}%=%tapl%e%p1%{15}%=%tmosaic%;, -+ cud=\E[%p1%de, cud1=^J, cuf=\E[%p1%da, cuf1=\s, cuu1=\EM, -+ ff=^L, hpa=\E[%p1%d`, ht=^I, is1=\Ec, is2=\E[20l\r, -+ lpi=%?%p1%{2}%=%t\E[4z%e%p1%{3}%=%t\E[5z%e%p1%{4}%=%t\E[6z%e%p1%{6}%=%t\E[z%e%p1%{8}%=%t\E[2z%e%p1%{12}%=%t\E[3z%;, -+ rshm=\E[m, -+ scs=%?%p1%{0}%=%t\E(B%e%p1%{1}%=%t\E(A%e%p1%{2}%=%t\E(C%e%p1%{3}%=%t\E(D%e%p1%{4}%=%t\E(E%e%p1%{5}%=%t\E(H%e%p1%{6}%=%t\E(K%e%p1%{7}%=%t\E(R%e%p1%{8}%=%t\E(Q%e%p1%{9}%=%t\E(Y%e%p1%{10}%=%t\E(Z%e%p1%{11}%=%t\E(0%e%p1%{12}%=%t\E(1%e%p1%{13}%=%t\E(3%e%p1%{14}%=%t\E(8%e%p1%{15}%=%t\E(}%;, -+ smgbp=\E[;%p1%dr, smglp=\E[%{1}%p1%+%ds, -+ smgrp=\E[;%{1}%p1%+%ds, smgtp=\E[%p1%dr, sshm=\E[5m, -+ u0=\E[%p1%dt, vpa=\E[%p1%dd, - --# This really should not use setab/setaf, but it is clear that the --# original terminfo does not toggle red/blue colors as in setb/setf. --ibm3164|i3164|IBM 3164, -- msgr, -- colors#8, pairs#64, -- op=\E4 "@, rmcup=\E!9(N\E>B, s0ds=\E>B, s1ds=\E>A, -- setab=\E4 %p1%{64}%+%c, -- setaf=\E4%?%p1%t %p1%{32}%+%c%e!'%;@, -- smcup=\E!9/N\E>B, use=ibm3161, -+# Teletype 5620, firmware version 1.1 (8;7;3) or earlier from BRL -+# The following SET-UP modes are assumed for normal operation: -+# CR_DEF=CR NL_DEF=INDEX DUPLEX=FULL -+# Other SET-UP modes may be set for operator convenience or communication -+# requirements. This termcap description is for the Resident Terminal Mode. -+# No delays specified; use "stty ixon -ixany" to enable DC3/DC1 flow control! -+# The BRL entry also said: UNSAFE :ll=\E[70H: -+att5620-1|tty5620-1|dmd1|Teletype 5620 with old ROMs, -+ am, xon, -+ cols#88, it#8, lines#70, vt#3, -+ bel=^G, clear=\E[H\E[J, cr=^M, cub1=^H, cud1=^J, cuf1=\E[C, -+ cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, dch=\E[%p1%dP, -+ dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[K, -+ home=\E[H, ht=^I, ich=\E[%p1%d@, ich1=\E[@, il=\E[%p1%dL, -+ il1=\E[L, ind=^J, indn=\E[%p1%dS, kbs=^H, kclr=\E[2J, -+ kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, khome=\E[H, -+ kll=\E[70;1H, nel=^M^J, rc=\E8, ri=\E[T, rin=\E[%p1%dT, -+ rs1=\Ec, sc=\E7, - --ibm5151|wy60-AT|wyse60-AT|IBM 5151 Monochrome display, -- am, bw, msgr, xon, -- cols#80, it#8, lines#25, -- acsc=j\331k\277l\332m\300n\305q\304t\303u\264v\301w\302x\263, -- bel=^G, blink=\E[5m, bold=\E[1m, clear=\E[H\E[J, cr=^M, -- cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=^J, -- cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, -- cuu=\E[%p1%dA, cuu1=\E[A, dch1=\E[P, dl=\E[%p1%dM, -- dl1=\E[M, ech=\E[%p1%dX, ed=\E[J, el=\E[K, home=\E[H, -- hpa=\E[%i%p1%dG, il=\E[%p1%dL, il1=\E[L, ind=\E[S, -- indn=\E[%p1%dS, invis=\E[8m, is2=\Ec, kbs=^H, kcbt=\E[Z, -- kclr=\E[144q, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, -- kcuu1=\E[A, kdch1=\E[P, ked=\E[148q, kel=\E[142q, -- kend=\E[146q, kf1=\E[001q, kf10=\E[010q, kf11=\E[011q, -- kf12=\E[012q, kf13=\E[013q, kf14=\E[014q, kf15=\E[015q, -- kf16=\E[016q, kf17=\E[017q, kf18=\E[018q, kf19=\E[019q, -- kf2=\E[002q, kf20=\E[020q, kf21=\E[021q, kf22=\E[022q, -- kf23=\E[023q, kf24=\E[024q, kf25=\E[025q, kf26=\E[026q, -- kf27=\E[027q, kf28=\E[028q, kf29=\E[029q, kf3=\E[003q, -- kf30=\E[030q, kf31=\E[031q, kf32=\E[032q, kf33=\E[033q, -- kf34=\E[034q, kf35=\E[035q, kf36=\E[036q, kf4=\E[004q, -- kf5=\E[005q, kf6=\E[006q, kf7=\E[007q, kf8=\E[008q, -- kf9=\E[009q, khome=\E[H, kich1=\E[139q, kil1=\E[140q, -- kind=\E[151q, knp=\E[154q, kpp=\E[150q, kri=\E[155q, -- krmir=\E[4l, rev=\E[7m, ri=\E[T, rin=\E[%p1%dT, rmir=\E[4l, -- rmso=\E[m, rmul=\E[m, rs2=\Ec, -- sgr=\E[%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;%?%p7%t;8%;m, -- sgr0=\E[0m, smir=\E[4h, smso=\E[7m, smul=\E[4m, -+# 5620 terminfo (2.0 or later ROMS with char attributes) -+# The following SET-UP modes are assumed for normal operation: -+# DUPLEX=FULL GEN_FLOW=ON NEWLINE=INDEX RETURN=CR -+# Other SET-UP modes may be set for operator convenience or communication -+# requirements. This termcap description is for Resident Terminal Mode. No -+# delays are specified; use "stty ixon -ixany" to enable DC3/DC1 flow control! -+# assumptions: <ind> (scroll forward one line) is only done at screen bottom -+# Be aware that older versions of the dmd have a firmware bug that affects -+# parameter defaulting; for this terminal, the 0 in \E[0m is not optional. -+# <msgr> is from an otherwise inferior BRL for this terminal. That entry -+# also has <ll>=\E[70H commented out and marked unsafe. -+# For more, see the 5620 FAQ maintained by David Breneman <daveb@dgtl.com>. -+att5620|dmd|tty5620|ttydmd|5620|5620 terminal 88 columns, -+ OTbs, am, msgr, npc, xon, -+ cols#88, it#8, lines#70, -+ bel=^G, bold=\E[2m, clear=\E[H\E[J, cr=^M, cub1=^H, -+ cud1=\E[B, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, -+ dch=\E[%p1%dP, dch1=\E[P, dim=\E[2m, dl=\E[%p1%dM, -+ dl1=\E[M, ed=\E[J, el=\E[K, home=\E[H, ht=^I, ich=\E[%p1%d@, -+ ich1=\E[@, il=\E[%p1%dL, il1=\E[L, ind=\E[S, -+ indn=\E[%p1%dS, kbs=^H, kclr=\E[2J, kcub1=\E[D, kcud1=\E[B, -+ kcuf1=\E[C, kcuu1=\E[A, khome=\E[H, kll=\E[70;1H, nel=^J, -+ pfx=\E[%p1%d;%p2%l%dq%p2%s, rc=\E8, rev=\E[7m, ri=\E[T, -+ rin=\E[%p1%dT, rmso=\E[0m, rmul=\E[0m, rs1=\Ec, sc=\E7, -+ sgr0=\E[0m, smso=\E[7m, smul=\E[4m, -+att5620-24|tty5620-24|dmd-24|teletype dmd 5620 in a 24x80 layer, -+ lines#24, use=att5620, -+att5620-34|tty5620-34|dmd-34|teletype dmd 5620 in a 34x80 layer, -+ lines#34, use=att5620, -+# 5620 layer running the "S" system's downloaded graphics handler: -+att5620-s|tty5620-s|layer|vitty|5620 S layer, -+ OTbs, OTpt, am, -+ cols#80, it#8, lines#72, -+ bel=^G, clear=^L, cr=^M, cub1=^H, cud1=^J, -+ cup=\EY%p2%{32}%+%c%p1%{32}%+%c, cuu1=^K, dl1=\ED, -+ el=\EK, flash=\E^G, ht=^I, il1=\EI, ind=^J, kbs=^H, kclr=\E[2J, -+ kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, khome=\E[H, -+ kll=\E[70;1H, - --ibmaed|IBM Experimental display, -- OTbs, am, eo, msgr, -- cols#80, it#8, lines#52, -- clear=\EH\EK, cub1=^H, cud1=\EB, cuf1=\EC, -- cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, dch1=\EQ, -- dl1=\EO, ed=\EJ, el=\EI, flash=\EG, home=\EH, ht=^I, ich1=\EP, -- il1=\EN, kbs=^H, kcub1=\ED, kcud1=\EB, kcuf1=\EC, kcuu1=\EA, -- rmso=\E0, sgr0=\E0, smso=\E0, --ibm-apl|apl|IBM apl terminal simulator, -- lines#25, use=dm1520, --# (ibmmono: this had an unknown `sb' boolean, I changed it to `bs'. --# Also it had ":I0=f10:" which pretty obviously should be "l0=f10" -- esr) --ibmmono|IBM workstation monochrome, -- eslok, hs, -- bold=\EZ, dl1=\EM, dsl=\Ej\EY8 \EI\Ek, fsl=\Ek, il1=\EL, -- invis=\EF\Ef0;\Eb0;, kbs=^H, kf0=\E<, kf1=\ES, kf2=\ET, -- kf3=\EU, kf4=\EV, kf5=\EW, kf6=\EP, kf7=\EQ, kf8=\ER, kf9=\EY, -- khome=\EH, kich1=\0, kind=\EE, knp=\EE, kpp=\Eg, kri=\EG, -- lf0=f10, rev=\Ep, ri=\EA, rmso=\Ez, rmul=\Ew, -- sgr0=\Ew\Eq\Ez\EB, smso=\EZ, smul=\EW, tsl=\Ej\EY8%+ \Eo, -- use=ibm3101, --ibmega|IBM Enhanced Color Display, -- cr=^M, cud1=^J, ht=^I, ind=^J, kbs=^H, kcub1=^H, kcud1=^J, -- nel=^M^J, use=ibmmono, --# This color scheme is assumed in some recent IBM terminal descriptions --# (green on black, emulated on a 16-color terminal). --ibm+color|IBM color definitions, -- colors#8, ncv#3, pairs#64, -- op=\E[32m\E[40m, -- setb=\E[%?%p1%{0}%=%t40m%e%p1%{1}%=%t41m%e%p1%{2}%=%t42m%e%p1%{3}%=%t43m%e%p1%{4}%=%t44m%e%p1%{5}%=%t45m%e%p1%{6}%=%t46m%e%p1%{7}%=%t107m%;, -- setf=\E[%?%p1%{0}%=%t30m%e%p1%{1}%=%t31m%e%p1%{2}%=%t32m%e%p1%{3}%=%t33m%e%p1%{4}%=%t34m%e%p1%{5}%=%t35m%e%p1%{6}%=%t36m%e%p1%{7}%=%t97m%;, --ibm+16color|IBM aixterm color definitions, -- colors#16, pairs#256, -- setab=\E[%?%p1%{8}%<%t%p1%{40}%+%e%p1%{92}%+%;%dm, -- setaf=\E[%?%p1%{8}%<%t%p1%{30}%+%e%p1%{82}%+%;%dm, -- setb=%p1%{8}%/%{6}%*%{4}%+\E[%d%p1%{8}%m%Pa%?%ga%{1}%=%t4%e%ga%{3}%=%t6%e%ga%{4}%=%t1%e%ga%{6}%=%t3%e%ga%d%;m, -- setf=%p1%{8}%/%{6}%*%{3}%+\E[%d%p1%{8}%m%Pa%?%ga%{1}%=%t4%e%ga%{3}%=%t6%e%ga%{4}%=%t1%e%ga%{6}%=%t3%e%ga%d%;m, --ibm5154|IBM 5154 Color display, -- colors#8, ncv@, pairs#64, -- bold@, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, use=ibm5151, -- use=ibm+color, --ibmega-c|ibm5154-c|IBM Enhanced Color Display with standout and underline, -- rmso=\EB, rmul=\EB, smso=\EF\Ef3;, smul=\EF\Ef2;, -- use=ibmmono, --ibmvga-c|IBM VGA display color termcap, -- cr=^M, cud1=^J, ht=^I, ind=^J, kbs=^H, kcub1=^H, kcud1=^J, -- nel=^M^J, use=ibmega-c, --ibmvga|IBM VGA display, -- cr=^M, cud1=^J, ht=^I, ind=^J, kbs=^H, kcub1=^H, kcud1=^J, -- nel=^M^J, use=ibmega, --# ibmapa* and ibmmono entries come from ACIS 4.3 distribution --rtpc|ibmapa16|IBM 6155 Extended Monochrome Graphics Display, -- lines#32, -- dsl=\Ej\EY@ \EI\Ek, tsl=\Ej\EY@%+ \Eo, use=ibmmono, --ibm6155|IBM 6155 Black & White display, -- blink@, bold@, use=ibm5151, --# Advanced Monochrome (6153) and Color (6154) Graphics Display: --ibmapa8c|ibmapa8|IBM 6154 Advanced Graphics Display, -- lines#31, -- dsl=\Ej\EY? \EI\Ek, tsl=\Ej\EY?%+ \Eo, use=ibmmono, --ibmapa8c-c|ibm6154-c|IBM 6154 Advanced Color Graphics Display, -- lines#31, -- dim=\EF\Ef7;, dsl=\Ej\EY? \EI\Ek, tsl=\Ej\EY?%+ \Eo, -- use=ibmega-c, --ibm6154|IBM 6154 Color displays, -- blink@, bold=\E[12m, s0ds=\E[10m, s1ds=\E[11m, s2ds=\E[12m, -- sgr=\E[%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;12%;m, -- sgr0=\E[0;10m, use=ibm5154, --ibm6153|IBM 6153 Black & White display, -- blink@, bold=\E[12m, s0ds=\E[10m, s1ds=\E[11m, s2ds=\E[12m, -- sgr=\E[%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;12%;m, -- sgr0=\E[0;10m, use=ibm5151, --ibm6153-90|IBM 6153 Black & White display, -- cols#90, lines#36, -- blink@, bold@, use=ibm5151, --ibm6153-40|IBM 6153 Black & White display, -- cols#40, lines#12, use=ibm6153-90, --ibm8512|ibm8513|IBM color VGA Terminal, -- am, mir, msgr, -- cols#80, it#8, lines#25, -- acsc=jjkkllmmnnqqttuuvvwwxx, blink=\E[5m, bold=\E[1m, -- clear=\E[H\E[J, cub1=\E[D, cud1=^J, cuf1=\E[C, -- cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, dl=\E[%p1%dM, dl1=\E[M, -- ech=\E[%p1%dX, ed=\E[J, el=\E[K, home=\E[H, il=\E[%p1%dL, -- il1=\E[L, is2=\Eb\E[m\017\E[?7h, kcud1=\E[B, kcuu1=\E[A, -- kf0=\E[010q, kf1=\E[001q, kf2=\E[002q, kf3=\E[003q, -- kf4=\E[004q, kf5=\E[005q, kf6=\E[006q, kf7=\E[007q, -- kf8=\E[008q, kf9=\E[009q, khome=\E[H, rc=\E[u, rev=\E[7m, -- rmacs=^O, rmam=\E[?7l, rmcup=\E[20h, rmdc=\E[4l, -- rmir=\E[4l, rmso=\E[m, rmul=\E[m, -- rs1=\Eb\E[m\017\E[?7h\E[H\E[J, sc=\E[s, sgr0=\E[m, -- smacs=^N, smam=\E[?7h, smcup=\E[20;4l\E[?7h\Eb, -- smdc=\E[4h, smir=\E[4h, smso=\E[7m, smul=\E[4m, -- use=ibm8503, --hft-c|HFT with Color, -- colors#8, pairs#64, -- acsc=jjkkllmmnnqqttuuvvwwxx, s0ds=\E(B, s1ds=\E(0, -- setab=\E[4%p1%dm, setaf=\E[3%p1%dm, sgr0=\E[0m\E(B, -- use=ibm5151, use=ibm+color, --hft-c-old|HFT with Color PC850, -- colors#8, pairs#64, -- setab=\E[4%p1%dm, setaf=\E[3%p1%dm, use=ibm5151, -- use=ibm+color, --hft-old|AIWS High Function Terminal, -- am, xon, -- cols#80, lines#25, -- bel=^G, blink=\E[5m, bold=\E[1m, clear=\E[H\E[J, cr=^M, -- cub1=^H, cud1=^J, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, -- cuu1=\E[A, dch1=\E[P, dl1=\E[M, ed=\E[J, el=\E[K, home=\E[H, -- ht=^I, ich1=\E[@, il1=\E[L, ind=^J, invis=\E[8m, kbs=^H, -- kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, -- kf1=\E[001q, kf2=\E[002q, kf3=\E[003q, kf4=\E[004q, -- kf5=\E[005q, kf6=\E[006q, kf7=\E[007q, kf8=\E[008q, -- kf9=\E[009q, khome=\E[H, knp=\E[153q, kpp=\E[159q, -- ktbc=\E[010q, rev=\E[7m, rmir=\E6, rmso=\E[m, rmul=\E[m, -- sgr0=\E[m, smir=\E6, smso=\E[7m, smul=\E[4m, use=ibm+color, --ibm-system1|system1|ibm system/1 computer, -- am, xt, -- cols#80, lines#24, -- bel=^G, clear=^Z, cub1=^H, cuf1=^\, -- cup=\005%p1%{32}%+%c%p2%{32}%+%c, cuu1=^^, home=^K, -- ind=^J, --# lft-pc850 : IBM Low Function Terminal Device --# lft "supports" underline, bold, and blink in the sense that the lft code --# sets all the right bits. HOWEVER, depending upon the adapter, these --# attributes may or may not be supported by the device driver. --lft|lft-pc850|LFT-PC850|IBM LFT PC850 Device, -- am, bw, msgr, xon, -- cols#80, it#8, lines#25, -- acsc=j\331k\277l\332m\300n\305q\304t\303u\264v\301w\302x\263, -- bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, clear=\E[H\E[J, -- cr=^M, cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=^J, -- cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, -- cuu=\E[%p1%dA, cuu1=\E[A, dch=\E[%p1%dP, dch1=\E[P, -- dl=\E[%p1%dM, dl1=\E[M, ech=\E[%p1%dX, ed=\E[2J, el=\E[0K, -- home=\E[H, hpa=\E[%i%p1%dG, ich=\E[%p1%d@, il=\E[%p1%dL, -- il1=\E[L, ind=\ED, indn=\E[%p1%dS, invis=\E[8m, is2=\Ec, -- kbs=^H, kcbt=\E[Z, kclr=\E[144q, kcub1=\E[D, kcud1=\E[B, -- kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[P, ked=\E[148q, -- kel=\E[142q, kend=\E[146q, kf1=\E[001q, kf10=\E[010q, -- kf11=\E[011q, kf12=\E[012q, kf13=\E[013q, kf14=\E[014q, -- kf15=\E[015q, kf16=\E[016q, kf17=\E[017q, kf18=\E[018q, -- kf19=\E[019q, kf2=\E[002q, kf20=\E[020q, kf21=\E[021q, -- kf22=\E[022q, kf23=\E[023q, kf24=\E[024q, kf25=\E[025q, -- kf26=\E[026q, kf27=\E[027q, kf28=\E[028q, kf29=\E[029q, -- kf3=\E[003q, kf30=\E[030q, kf31=\E[031q, kf32=\E[032q, -- kf33=\E[033q, kf34=\E[034q, kf35=\E[035q, kf36=\E[036q, -- kf4=\E[004q, kf5=\E[005q, kf6=\E[006q, kf7=\E[007q, -- kf8=\E[008q, kf9=\E[009q, khome=\E[H, kich1=\E[139q, -- kil1=\E[140q, kind=\E[151q, knp=\E[154q, kpp=\E[150q, -- kri=\E[155q, krmir=\E[4l, rev=\E[7m, ri=\EL, rin=\E[%p1%dT, -- rmacs=\E(B, rmir=\E[4l, rmso=\E[0m, rmul=\E[0m, rs2=\Ec, -- sgr=\E[%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;%?%p7%t;8%;m%?%p9%t\E(0%e\E(B%;, -- sgr0=\E[0m, smacs=\E(0, smir=\E[4h, smso=\E[7m, smul=\E[4m, -- tbc=\E[3g, --ibm5081|hft|IBM Megapel Color display, -- acsc=jjkkllmmnnqqttuuvvwwxx, blink@, bold@, s0ds=\E(B, -- s1ds=\E(0, sgr0=\E[0m\E(B, use=ibm5154, --ibm5081-c|ibmmpel-c|IBM 5081 1024x1024 256/4096 Megapel enhanced color display, -- eslok, hs, -- lines#33, -- dsl=\Ej\EYA \EI\Ek, fsl=\Ek, tsl=\Ej\EYA%+ \Eo, -- use=ibmega-c, --ibm8503|ibm8507|ibm8604|IBM 8503 B & W VGA display, -- use=hft-c, --ibm8514|IBM 8514/a color VGA display, -- eslok, hs, -- dsl=\Ej\EYI \EI\Ek, fsl=\Ek, tsl=\Ej\EYI%+ \Eo, use=hft, --ibm8514-c|IBM 8514 color display with standout and underline, -- eslok, hs, -- lines#41, -- cr=^M, cud1=^J, dsl=\Ej\EYI \EI\Ek, fsl=\Ek, ht=^I, ind=^J, -- kbs=^H, kcub1=^H, kcud1=^J, nel=^M^J, tsl=\Ej\EYI%+ \Eo, -- use=ibmega-c, -- --# --# AIX entries. IBM ships these with AIX 3.2.5. --# -- added rc, sc based on manpage -TD --# Note that we could use ibm+16color, but that is not how IBM defines this one. --aixterm|IBM Aixterm Terminal Emulator, -- eslok, hs, -- acsc=jjkkllmmnnqqttuuvvwwxx, bold=\E[1m, dsl=\E[?E, -- fsl=\E[?F, rc=\E8, ri@, s0ds=\E(B, s1ds=\E(0, sc=\E7, -- sgr=\E[%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;%?%p7%t;8%;m%?%p9%t\E(0%e\E(B%;, -- sgr0=\E[0;10m\E(B, tsl=\E[?%p1%dT, use=ibm6154, --aixterm-m|IBM AIXterm Monochrome Terminal Emulator, -- eslok, hs, -- acsc=jjkkllmmnnqqttuuvvwwxx, bold=\E[1m, dsl=\E[?E, -- fsl=\E[?F, ri@, s0ds=\E(B, s1ds=\E(0, -- sgr=\E[%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;m, -- sgr0=\E[0;10m\E(B, tsl=\E[?%p1%dT, use=ibm6153, --aixterm-m-old|old IBM AIXterm Monochrome Terminal Emulator, -- eslok, hs, -- bold=\E[1m, dsl=\E[?E, fsl=\E[?F, ri@, -- sgr=\E[%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;m, -- tsl=\E[?%p1%dT, use=ibm6153, --jaixterm|IBM Kanji Aixterm Terminal Eemulator, -- acsc@, use=aixterm, --jaixterm-m|IBM Kanji AIXterm Monochrome Terminal Emulator, -- acsc@, use=aixterm-m, -- --# This flavor is adapted from xterm, in turn from aixterm documentation -TD --aixterm-16color|IBM Aixterm Terminal Emulator with 16 colors, -- use=ibm+16color, use=aixterm, -- --#### Infoton/General Terminal Corp. -+# Entries for <kf15> thru <kf28> refer to the shifted system pf keys. - # -+# Entries for <kf29> thru <kf46> refer to the alternate keypad mode -+# keys: = * / + 7 8 9 - 4 5 6 , 1 2 3 0 . ENTER -+att605|AT&T 605 80 column 102key keyboard, -+ am, eo, xon, -+ cols#80, lines#24, lw#8, nlab#8, wsl#80, -+ acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -+ bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, clear=\E[H\E[J, -+ cr=^M, cub1=^H, cud1=\E[B, cuf1=\E[C, -+ cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, dch=\E[%p1%dP, -+ dch1=\E[P, dim=\E[2m, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, -+ el=\E[K, el1=\E[1K, fsl=\E8, ht=^I, ich=\E[%p1%d@, ich1=\E[@, -+ il1=\E[L, ind=^J, invis=\E[8m, -+ is1=\E[8;0|\E[?\E[13;20l\E[?\E[12h, is2=\E[m\017, -+ kLFT=\E[ A, kRIT=\E[ @, kbs=^H, kcbt=\E[Z, kclr=\E[2J, -+ kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[P, -+ kdl1=\E[M, kend=\E[24;1H, kf1=\EOc, kf10=\ENp, kf11=\ENq, -+ kf12=\ENr, kf13=\ENs, kf14=\ENt, kf15=\EOC, kf16=\EOD, -+ kf17=\EOE, kf18=\EOF, kf19=\EOG, kf2=\EOd, kf20=\EOH, -+ kf21=\EOI, kf22=\EOJ, kf23=\ENO, kf24=\ENP, kf25=\ENQ, -+ kf26=\ENR, kf27=\ENS, kf28=\ENT, kf29=\EOP, kf3=\EOe, -+ kf30=\EOQ, kf31=\EOR, kf32=\EOS, kf33=\EOw, kf34=\EOx, -+ kf35=\EOy, kf36=\EOm, kf37=\EOt, kf38=\EOu, kf39=\EOv, -+ kf4=\EOf, kf40=\EOl, kf41=\EOq, kf42=\EOr, kf43=\EOs, -+ kf44=\EOp, kf45=\EOn, kf46=\EOM, kf5=\EOg, kf6=\EOh, -+ kf7=\EOi, kf8=\EOj, kf9=\ENo, khome=\E[H, kich1=\E[@, -+ kil1=\E[L, kind=\E[S, knp=\E[U, kpp=\E[V, ll=\E[24H, -+ mc4=\E[?4i, mc5=\E[?5i, nel=\EE, -+ pfx=\E[%p1%d;%p2%l%02dq F%p1%1d %p2%s, -+ pln=\E[%p1%d;0;0;0q%p2%:-16.16s, rc=\E8, rev=\E[7m, -+ rmacs=^O, rmir=\E[4l, rmln=\E[2p, rmso=\E[m, rmul=\E[m, -+ rs2=\Ec\E[?3l, sc=\E7, sgr0=\E[m\017, smacs=\E)0\016, -+ smir=\E[4h, smln=\E[p, smso=\E[7m, smul=\E[4m, -+ tsl=\E7\E[25;%i%p1%dx, -+att605-pc|ATT 605 in pc term mode, -+ acsc=j\331k\277l\332m\300n\305q\304t\303u\264v\301w\302x\263, -+ cbt=\E[Z, cub1=\E[D, cud1=\E[B, cuf1=\E[C, cuu1=\E[A, -+ dch1=\E[P, dl1=\E[M, ich1=\E[@, il1=\E[L, kcbt=\E[Z, -+ kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[P, -+ kdl1=\E[M, kend=\E[F, kf1=\E[M, kf10=\E[V, kf2=\E[N, -+ kf3=\E[O, kf4=\E[P, kf5=\E[Q, kf6=\E[R, kf7=\E[S, kf8=\E[T, -+ kf9=\E[U, khome=\E[H, kich1=\E[@, knp=\E[G, kpp=\E[I, -+ rmsc=400\E[50;0|, smsc=250\E[?11l\E[50;1|, xoffc=g, -+ xonc=e, use=att605, -+att605-w|AT&T 605-w 132 column 102 key keyboard, -+ cols#132, wsl#132, -+ is1=\E[8;0|\E[?4;5;13;15l\E[13;20l\E[?3;7h\E[12h\E(B\E)0, -+ use=att605, -+# (att610: I added <rmam>/<smam> based on the init string. I also -+# added <indn> and <rin> because the BSD file says the att615s have them, -+# and the 615 is like a 610 with a big keyboard, and most of their other -+# smart terminals support the same sequence -- esr) -+att610|AT&T 610; 80 column; 98key keyboard, -+ am, eslok, hs, mir, msgr, xenl, xon, -+ cols#80, it#8, lh#2, lines#24, lw#8, nlab#8, wsl#80, -+ acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -+ bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l, -+ clear=\E[H\E[J, cnorm=\E[?25h\E[?12l, cr=^M, -+ csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, -+ cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, cuf1=\E[C, -+ cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, -+ cvvis=\E[?12;25h, dch=\E[%p1%dP, dch1=\E[P, dim=\E[2m, -+ dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[K, el1=\E[1K, -+ flash=\E[?5h$<200>\E[?5l, fsl=\E8, home=\E[H, ht=^I, -+ ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[L, ind=\ED, -+ indn=\E[%p1%dS, invis=\E[8m, -+ is1=\E[8;0|\E[?3;4;5;13;15l\E[13;20l\E[?7h\E[12h\E(B\E)0, -+ is2=\E[m\017, is3=\E(B\E)0, kLFT=\E[ @, kRIT=\E[ A, kbs=^H, -+ kcbt=\E[Z, kclr=\E[2J, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, -+ kcuu1=\E[A, kf1=\EOc, kf10=\ENp, kf11=\ENq, kf12=\ENr, -+ kf13=\ENs, kf14=\ENt, kf2=\EOd, kf3=\EOe, kf4=\EOf, kf5=\EOg, -+ kf6=\EOh, kf7=\EOi, kf8=\EOj, kf9=\ENo, khome=\E[H, -+ kind=\E[S, kri=\E[T, ll=\E[24H, mc4=\E[?4i, mc5=\E[?5i, -+ nel=\EE, -+ pfx=\E[%p1%d;%p2%l%02dq F%p1%1d %p2%s, -+ pln=\E[%p1%d;0;0;0q%p2%:-16.16s, rc=\E8, rev=\E[7m, -+ ri=\EM, rin=\E[%p1%dT, rmacs=^O, rmam=\E[?7l, rmir=\E[4l, -+ rmln=\E[2p, rmso=\E[m, rmul=\E[m, rs2=\Ec\E[?3l, sc=\E7, -+ sgr=\E[0%?%p6%t;1%;%?%p5%t;2%;%?%p2%t;4%;%?%p4%t;5%;%?%p3%p1%|%t;7%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, -+ sgr0=\E[m\017, smacs=^N, smam=\E[?7h, smir=\E[4h, -+ smln=\E[p, smso=\E[7m, smul=\E[4m, tsl=\E7\E[25;%i%p1%dx, -+att610-w|AT&T 610; 132 column; 98key keyboard, -+ cols#132, wsl#132, -+ is1=\E[8;0|\E[?4;5;13;15l\E[13;20l\E[?3;7h\E[12h, -+ use=att610, - --# gt100 sounds like something DEC would come out with. Let's hope they don't. --i100|gt100|gt100a|General Terminal 100A (formerly Infoton 100), -- OTbs, am, -- cols#80, lines#24, -- bel=^G, clear=^L, cr=^M, cub1=^H, cud1=^J, cuf1=\EC, -- cup=\Ef%p2%{32}%+%c%p1%{32}%+%c, cuu1=\EA, dl1=\EM, -- ed=\EJ, el=\EK, flash=\Eb$<200/>\Ea, home=\EH, il1=\EL, -- ind=^J, rmso=\Ea, smso=\Eb, --i400|infoton 400, -- OTbs, am, -- cols#80, lines#25, -- bel=^G, clear=\E[2J, cr=^M, cub1=^H, cud1=^J, cuf1=\E[C, -- cup=\E[%i%p1%3d;%p2%3dH, cuu1=\E[A, -- dch1=\E[4h\E[2Q\E[P\E[4l\E[0Q, dl1=\E[M, el=\E[N, -- il1=\E[L, ind=^J, rmir=\E[4l\E[0Q, smir=\E[4h\E[2Q, --# (addrinfo: removed obsolete ":bc=^Z:" -- esr) --addrinfo, -- am, -- cols#80, lines#24, -- bel=^G, clear=^L, cr=^M, cub1=^Z, cud1=^J, cuf1=^Y, -- cup=\037%p1%c%p2%c, cuu1=^\, ed=^K, home=^H, ind=^J, ll=^H^\, --# (infoton: used to have the no-ops <lh#0>, <lw#0>, <nlab#0> -- esr) --infoton, -- am, -- cols#80, lines#24, -- bel=^G, clear=^L, cr=^M, cub1=^Z, cud1=^J, cuf1=^Y, cuu1=^\, -- ed=^K, ind=^J, ll=^H^\, -- --# The ICL6402 was actually the Kokusai Display System 6402. --# The 6404 was the KDS7372 (color version of the 6402). --# --# ICL6404 control codes follow: --# --#code function --#~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --#ctrl-A set SOM position at cursor position --#ctrl-G Bell --#ctrl-H Backspace --#ctrl-I Horiz tab --#ctrl-J Linefeed --#ctrl-K Cursor up --#ctrl-L Cursor right --#ctrl-M Carriage return --#ctrl-N Disable xon/xoff to host --#ctrl-O Enable xon/xoff to host --#ctrl-R Enable bidirectional mode --#ctrl-T Disable bidirectional mode --#ctrl-V Cursor down --#ctrl-Z Clear unprotected data to insert char --#ctrl-^ Cursor home --#ctrl-_ Newline -+att610-103k|AT&T 610; 80 column; 103key keyboard, -+ kBEG=\ENB, kCAN=\EOW, kCMD=\EOU, kCPY=\END, kCRT=\EON, -+ kDC=\ENF, kDL=\ENE, kEND=\ENN, kEOL=\EOA, kEXT=\EOK, -+ kFND=\EOX, kHLP=\EOM, kMOV=\ENC, kMSG=\EOL, kNXT=\ENH, -+ kOPT=\EOR, kPRT=\EOZ, kPRV=\ENG, kRDO=\EOT, kRES=\EOQ, -+ kRPL=\EOY, kSAV=\EOO, kSPD=\EOP, kUND=\EOS, kbeg=\E9, -+ kcan=\EOw, kclo=\EOV, kcmd=\EOu, kcpy=\ENd, kcrt=\EOn, -+ kdch1=\ENf, kdl1=\ENe, kel=\EOa, kend=\E0, kent=^M, -+ kext=\EOk, kf10@, kf11@, kf12@, kf13@, kf14@, kf9@, kfnd=\EOx, -+ khlp=\EOm, kich1=\ENj, kmov=\ENc, kmrk=\ENi, kmsg=\EOl, -+ knp=\E[U, knxt=\ENh, kopn=\EOv, kopt=\EOr, kpp=\E[V, -+ kprt=\EOz, kprv=\ENg, krdo=\EOt, kref=\EOb, kres=\EOq, -+ krfr=\ENa, krmir=\ENj, krpl=\EOy, krst=\EOB, ksav=\EOo, -+ kslt=\ENI, kspd=\EOp, kund=\EOs, use=att610, -+att610-103k-w|AT&T 610; 132 column; 103key keyboard, -+ cols#132, wsl#132, -+ is1=\E[8;0|\E[?4;5;13;15l\E[13;20l\E[?3;7h\E[12h, -+ use=att610-103k, -+att615|AT&T 615; 80 column; 98key keyboard, -+ kLFT=\E[ A, kRIT=\E[ @, kf15=\EOC, kf16=\EOD, kf17=\EOE, -+ kf18=\EOF, kf19=\EOG, kf20=\EOH, kf21=\EOI, kf22=\EOJ, -+ kf23=\ENO, kf24=\ENP, kf25=\ENQ, kf26=\ENR, kf27=\ENS, -+ kf28=\ENT, kf29=\EOP, kf30=\EOQ, kf31=\EOR, kf32=\EOS, -+ kf33=\EOw, kf34=\EOx, kf35=\EOy, kf36=\EOm, kf37=\EOt, -+ kf38=\EOu, kf39=\EOv, kf40=\EOl, kf41=\EOq, kf42=\EOr, -+ kf43=\EOs, kf44=\EOp, kf45=\EOn, kf46=\EOM, use=att610, -+att615-w|AT&T 615; 132 column; 98key keyboard, -+ kLFT=\E[ A, kRIT=\E[ @, kf15=\EOC, kf16=\EOD, kf17=\EOE, -+ kf18=\EOF, kf19=\EOG, kf20=\EOH, kf21=\EOI, kf22=\EOJ, -+ kf23=\ENO, kf24=\ENP, kf25=\ENQ, kf26=\ENR, kf27=\ENS, -+ kf28=\ENT, kf29=\EOP, kf30=\EOQ, kf31=\EOR, kf32=\EOS, -+ kf33=\EOw, kf34=\EOx, kf35=\EOy, kf36=\EOm, kf37=\EOt, -+ kf38=\EOu, kf39=\EOv, kf40=\EOl, kf41=\EOq, kf42=\EOr, -+ kf43=\EOs, kf44=\EOp, kf45=\EOn, kf46=\EOM, use=att610-w, -+att615-103k|AT&T 615; 80 column; 103key keyboard, -+ kLFT=\E[ A, kRIT=\E[ @, use=att610-103k, -+att615-103k-w|AT&T 615; 132 column; 103key keyboard, -+ kLFT=\E[ A, kRIT=\E[ @, use=att610-103k-w, -+# (att620: I added <rmam>/<smam> based on the init string and -+# <rin>/<indn> from a BSD termcap -- esr) -+att620|AT&T 620; 80 column; 98key keyboard, -+ am, eslok, hs, mir, msgr, xenl, xon, -+ cols#80, it#8, lh#2, lines#24, lw#8, nlab#8, wsl#80, -+ acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -+ bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l, -+ clear=\E[H\E[J, cnorm=\E[?25h\E[?12l, cr=^M, -+ csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, -+ cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, cuf1=\E[C, -+ cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, -+ cvvis=\E[?12;25h, dch=\E[%p1%dP, dch1=\E[P, dim=\E[2m, -+ dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[K, el1=\E[1K, -+ flash=\E[?5h$<200>\E[?5l, fsl=\E8, home=\E[H, ht=^I, -+ ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[L, ind=\ED, -+ indn=\E[%p1%dS, invis=\E[8m, -+ is1=\E[8;0|\E[?3;4;5;13;15l\E[13;20l\E[?7h\E[12h, -+ is2=\E[m\017, is3=\E(B\E)0, kLFT=\E[ A, kRIT=\E[ @, kbs=^H, -+ kcbt=\E[Z, kclr=\E[2J, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, -+ kcuu1=\E[A, kf1=\EOc, kf10=\ENp, kf11=\ENq, kf12=\ENr, -+ kf13=\ENs, kf14=\ENt, kf15=\EOC, kf16=\EOD, kf17=\EOE, -+ kf18=\EOF, kf19=\EOG, kf2=\EOd, kf20=\EOH, kf21=\EOI, -+ kf22=\EOJ, kf23=\ENO, kf24=\ENP, kf25=\ENQ, kf26=\ENR, -+ kf27=\ENS, kf28=\ENT, kf29=\EOP, kf3=\EOe, kf30=\EOQ, -+ kf31=\EOR, kf32=\EOS, kf33=\EOw, kf34=\EOx, kf35=\EOy, -+ kf36=\EOm, kf37=\EOt, kf38=\EOu, kf39=\EOv, kf4=\EOf, -+ kf40=\EOl, kf41=\EOq, kf42=\EOr, kf43=\EOs, kf44=\EOp, -+ kf45=\EOn, kf46=\EOM, kf5=\EOg, kf6=\EOh, kf7=\EOi, kf8=\EOj, -+ kf9=\ENo, khome=\E[H, kind=\E[S, kri=\E[T, ll=\E[24H, -+ mc4=\E[?4i, mc5=\E[?5i, nel=\EE, -+ pfx=\E[%p1%d;%p2%l%02dq F%p1%1d %p2%s, -+ pln=\E[%p1%d;0;0;0q%p2%:-16.16s, rc=\E8, rev=\E[7m, -+ ri=\EM, rin=\E[%p1%dT, rmacs=\E(B\017, rmam=\E[?7l, -+ rmir=\E[4l, rmln=\E[2p, rmso=\E[m, rmul=\E[m, -+ rs2=\Ec\E[?3l, sc=\E7, -+ sgr=\E[0%?%p6%t;1%;%?%p5%t;2%;%?%p2%t;4%;%?%p4%t;5%;%?%p3%p1%|%t;7%;%?%p7%t;8%;m%?%p9%t\E)0\016%e\E(B\017%;, -+ sgr0=\E[m\E(B\017, smacs=\E)0\016, smam=\E[?7h, -+ smir=\E[4h, smln=\E[p, smso=\E[7m, smul=\E[4m, -+ tsl=\E7\E[25;%i%p1%dx, -+att620-w|AT&T 620; 132 column; 98key keyboard, -+ cols#132, wsl#132, -+ is1=\E[8;0|\E[?4;5;13;15l\E[13;20l\E[?3;7h\E[12h, -+ use=att620, -+att620-103k|AT&T 620; 80 column; 103key keyboard, -+ kBEG=\ENB, kCAN=\EOW, kCMD=\EOU, kCPY=\END, kCRT=\EON, -+ kDC=\ENF, kDL=\ENE, kEND=\ENN, kEOL=\EOA, kEXT=\EOK, -+ kFND=\EOX, kHLP=\EOM, kMOV=\ENC, kMSG=\EOL, kNXT=\ENH, -+ kOPT=\EOR, kPRT=\EOZ, kPRV=\ENG, kRDO=\EOT, kRES=\EOQ, -+ kRPL=\EOY, kSAV=\EOO, kSPD=\EOP, kUND=\EOS, kbeg=\E9, -+ kcan=\EOw, kclo=\EOV, kcmd=\EOu, kcpy=\ENd, kcrt=\EOn, -+ kdch1=\ENf, kdl1=\ENe, kel=\EOa, kend=\E0, kent=^M, -+ kext=\EOk, kf10@, kf11@, kf12@, kf13@, kf14@, kf15@, kf16@, kf17@, -+ kf18@, kf19@, kf20@, kf21@, kf22@, kf23@, kf24@, kf25@, kf26@, kf27@, -+ kf28@, kf29@, kf30@, kf31@, kf32@, kf33@, kf34@, kf35@, kf36@, kf37@, -+ kf38@, kf39@, kf40@, kf41@, kf42@, kf43@, kf44@, kf45@, kf46@, kf9@, -+ kfnd=\EOx, khlp=\EOm, kich1=\ENj, kmov=\ENc, kmrk=\ENi, -+ kmsg=\EOl, knp=\E[U, knxt=\ENh, kopn=\EOv, kopt=\EOr, -+ kpp=\E[V, kprt=\EOz, kprv=\ENg, krdo=\EOt, kref=\EOb, -+ kres=\EOq, krfr=\ENa, krmir=\ENj, krpl=\EOy, krst=\EOB, -+ ksav=\EOo, kslt=\ENI, kspd=\EOp, kund=\EOs, use=att620, -+ -+att620-103k-w|AT&T 620; 132 column; 103key keyboard, -+ cols#132, wsl#132, -+ is1=\E[8;0|\E[?4;5;13;15l\E[13;20l\E[?3;7h\E[12h, -+ use=att620-103k, -+ -+# AT&T (formerly Teletype) 630 Multi-Tasking Graphics terminal -+# The following SETUP modes are assumed for normal operation: -+# Local_Echo=Off Gen_Flow=On Return=CR Received_Newline=LF -+# Font_Size=Large Non-Layers_Window_Cols=80 -+# Non-Layers_Window_Rows=60 -+# Other SETUP modes may be set for operator convenience or communication -+# requirements. Some capabilities assume a printer attached to the Aux EIA -+# port. This termcap description is for the Fixed Non-Layers Window. No -+# delays are specified; use "stty ixon -ixany" to enable DC3/DC1 flow control! -+# (att630: added <ich1>, <blink> and <dim> from a BSD termcap file -- esr) -+att630|AT&T 630 windowing terminal, -+ OTbs, am, da, db, mir, msgr, npc, xon, -+ cols#80, it#8, lines#60, lm#0, -+ bel=^G, blink=\E[5m, cbt=\E[Z, clear=\E[H\E[J, cr=^M, -+ cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=\E[B, -+ cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, -+ cuu=\E[%p1%dA, cuu1=\E[A, dch=\E[%p1%dP, dch1=\E[P, -+ dim=\E[2m, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[K, -+ el1=\E[1K, home=\E[H, ht=^I, ich=\E[%p1%d@, ich1=\E[@, -+ il=\E[%p1%dL, il1=\E[L, ind=\ED, indn=\E[%p1%dS, is2=\E[m, -+ kbs=^H, kcbt=\E[Z, kclr=\E[2J, kcub1=\E[D, kcud1=\E[B, -+ kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[P, kdl1=\E[M, kent=^M, -+ kf10=\ENp, kf11=\ENq, kf12=\ENr, kf13=\ENs, kf14=\ENt, -+ kf15=\ENu, kf16=\ENv, kf17=\ENw, kf18=\ENx, kf19=\ENy, -+ kf20=\ENz, kf21=\EN{, kf22=\EN|, kf23=\EN}, kf24=\EN~, -+ kf9=\ENo, khome=\E[H, kich1=\E[@, kil1=\E[L, mc4=\E[?4i, -+ mc5=\E[?5i, nel=^M^J, pfx=\E[%p1%d;%p2%l%dq%p2%s, rc=\E8, -+ rev=\E[7m, ri=\EM, rin=\E[%p1%dT, rmir=\E[4l, rmso=\E[m, -+ rmul=\E[m, rs2=\Ec, sc=\E7, -+ sgr=\E[0%?%p5%t;2%;%?%p2%t;4%;%?%p4%t;5%;%?%p1%p3%|%p4%|%t;7%;m, -+ sgr0=\E[m, smir=\E[4h, smso=\E[7m, smul=\E[4m, -+att630-24|5630-24|5630DMD-24|630MTG-24|AT&T 630 windowing terminal 24 lines, -+ lines#24, use=att630, -+ -+# This is the att700 entry for 700 native emulation of the AT&T 700 -+# terminal. Comments are relative to changes from the 605V2 entry and -+# att730 on which the entry is based. Comments show the terminfo -+# capability name, termcap name, and description. - # --#ESC lead-in char for multiple character command -+# Here is what's going onm in the init string: -+# ESC [ 50;4| set 700 native mode (really is 605) -+# x ESC [ 56;ps| set lines to 24: ps=0; 40: ps=1 (plus status line) -+# ESC [ 53;0| set GenFlow to Xon/Xoff -+# ESC [ 8 ;0| set CR on NL -+# x ESC [ ? 3 l/h set workspace: 80 col(l); 132 col(h) -+# ESC [ ? 4 l jump scroll -+# ESC [ ? 5 l/h video: normal (l); reverse (h) -+# ESC [ ?13 l Labels on -+# ESC [ ?15 l parity check = no -+# ESC [ 13 l monitor mode off -+# ESC [ 20 l LF on NL (not CRLF on NL) -+# ESC [ ? 7 h autowrap on -+# ESC [ 12 h local echo off -+# ESC ( B GO = ASCII -+# ESC ) 0 G1 = Special Char & Line Drawing -+# ESC [ ? 31 l Set 7 bit controls - # --#ESC space R execute power on sequence --#ESC ! p1 p2 define scroll region: --# p1 = scroll top line: 20h - 37h --# p1 = scroll bottom line: 20h - 37h --#ESC " unlock keyboard --#ESC # lock keyboard --#ESC $ Semi-graphics mode on --#ESC % Semi-graphics mode off --#ESC & protect mode on --#ESC ' protect mode off --#ESC ( write protect mode off (full intensity) --#ESC ) write protect mode on (half intensity) -+# Note: Most terminals, especially the 600 family use Reverse Video for -+# standout mode. DEC also uses reverse video. The VT100 uses bold in addition -+# Assume we should stay with reverse video for 70.. However, the 605V2 exits -+# standout mode with \E[m (all normal attributes). The 730 entry simply -+# exits reverse video which would leave other current attributes intact. It -+# was assumed the 730 entry to be more correct so rmso has changed. The -+# 605V2 has no sequences to turn individual attributes off, thus its setting -+# and the rmso/smso settings from the 730. - # --#ESC * clear screen --#ESC + clear unprotected data to insert char --#ESC , clear unprotected data to half intensity spaces --#ESC - p1 p2 p3 p4 address cursor to page, row, column: --# p1 = page number 0 - 3 --# p2 = row 20h - 7fh --# p3 = column (lo) 20h - 7fh --# p4 = column (hi) 20h - 21h (only 132 col) --#ESC . p1 set cursor style: --# p1 = 0 invisible cursor --# p1 = 1 block blinking cursor --# p1 = 2 block steady cursor --# p1 = 3 underline blinking cursor --# p1 = 4 underline steady cursor --#ESC / transmit cursor location (page, row, column) --#ESC 0 p1 p2 p3 p4 program edit key: --# p1 = edit key code: '@'-'S', '`'-'s' --# p2 p3 p4 = program data (3 bytes) -+# Note: For the same reason as above in rmso I changed exit under-score mode -+# to specifically turn off underscore, rather than return to all normal -+# attributes - # --#ESC 1 set tab --#ESC 2 clear tab at cursor --#ESC 3 clear all tabs --#ESC 4 send unprotect line to cursor --#ESC 5 send unprotect page to cursor --#ESC 6 send line to cursor --#ESC 7 send page to cursor --#ESC 8 n set scroll mode: --# n = 0 set jump scroll --# n = 1 set smooth scroll --#ESC 9 n control display: --# n = 0 display off --# n = 1 display on --#ESC : clear unprotected data to null --#ESC ; clear unprotected data to insert char -+# Note: The following pkey_xmit is taken from the 605V2 which contained the -+# capability as pfxl. It was changed here to pfx since pfxl -+# will only compile successfully with Unix 4.0 tic. Also note that pfx only -+# allows strings to be parameters and label values must be programmed as -+# constant strings. Supposedly the pfxl of Version 4.0 allows both labels -+# and strings to be parameters. The 605V2 pfx entry should be examined later -+# in this regard. For reference the 730 pfxl entry is shown here for comparison -+# 730 pfx entry: -+# pfxl=\E[%?%p1%{25}%<%t%p1%e%p1%{24}%-%;%d;%p2%l%02d%?%p1%{25}%<%tq\s\s\s -+# SYS\s\s\s\s\sF%p1%:-2d\s\s%e;0;3q%;%p2%s, - # --#ESC < keyclick on --#ESC = p1 p2 address cursor to row, column --# p1 = row 20h - 7fh --# p2 = column (lo) 20h - 7fh --# p3 = column (hi) 20h - 21h (only 132 col) --#ESC > keyclick off --#ESC ? transmit cursor location (row, column) -+# (for 4.0 tic) -+# pfxl=\E[%p1%d;%p2%l%02dq%?%p1%{9}%<%t F%p1%1d %;%p2%s, - # --#ESC @ copy print mode on --#ESC A copy print mode off --#ESC B block mode on --#ESC C block mode off (conversation mode) --#ESC D F set full duplex --#ESC D H set half duplex --#ESC E line insert --#ESC F p1 p2 set page colour (p1 = f/grnd, p2 = b/grnd) --# 0 = black, 1 = red, 2 = green, 3 = yellow --# 4 = blue, 5 = magenta, 6 = cyan, 7 = white --#ESC G n set serial field attribute (n = 30h - 3Fh) --#ESC H n full graphics mode: --# n = 0 exit full graphics mode --# n = 1 enter full graphics mode --#ESC I back tab --#ESC J back page --#ESC K forward page --# --#ESC L unformatted page print --#ESC M L move window left (132 col mode only) --#ESC M R move window right (132 col mode only) --#ESC N set page edit (clear line edit) --#ESC O set line edit (clear page edit) --#ESC P formatted page print --#ESC Q character insert --#ESC R line delete --#ESC S send message unprotected only --#ESC T erase line to insert char --#ESC U set monitor mode (see ESC X, ESC u) -+# (for <4.0 tic) -+# pfx=\E[%p1%d;%p2%l%02dq%?%p1%{9}%<%t F%p1%1d %;%p2%s, - # --#ESC V n select video attribute mode: --# n = 0 serial field attribute mode --# n = 1 parallel character attribute mode --#ESC V 2 n define line attribute: --# n = 0 single width single height --# n = 1 single width double height --# n = 2 double width single height --# n = 3 double width double height --#ESC V 3 n select character font: --# n = 0 system font --# n = 1 user defined font --#ESC V 4 n select screen mode: --# n = 0 page screen mode --# n = 1 virtual screen mode --#ESC V 5 n control mouse mode: --# n = 0 disable mouse --# n = 1 enable sample mode --# n = 2 send mouse information --# n = 3 enable request mode --#ESC W character delete --#ESC X clear monitor mode (see ESC U, ESC u) --#ESC Y erase page to insert char -+# From the AT&T 705 Multi-tasking terminal user's guide Page 8-8,8-9 - # --#ESC Z n send user/status line: --# n = 0 send user line --# n = 1 send status line --# n = 2 send terminal ID --#ESC [ p1 p2 p3 set character attribute (parallel char mode): --# p1: 0 = normal --# 1 = blank --# 2 = blink --# 3 = blink blank (= blank) --# 4 = reverse --# 5 = reverse blank --# 6 = reverse blink --# 7 = reverse blink blank (= reverse blank) --# 8 = underline --# 9 = underline blank --# : = underline blink --# ; = underline blink blank --# < = reverse underline --# = = reverse underline blank --# > = reverse underline blink --# ? = reverse underline blink blank --# p2, p3: f/grnd, b/grnd colour --# (see ESC F for colours) --# use ZZ for mono, eg. --# ESC [ 0 Z Z for normal --# ESC [ 4 Z Z for inverse etc. -+# Port1 Interface - # --#ESC \ n set page size: --# n = 1 24 lines/page --# n = 2 48 lines/page --# n = 3 72 lines/page --# n = 4 96 lines/page --#ESC ] n set Wordstar mode: --# n = 0 normal (KDS7372) mode --# n = 1 Wordstar mode -+# modular 10 pin Connector -+# Left side Right side -+# Pin 1 2 3 4 5 6 7 8 9 10 - # --#ESC b set foreground colour screen -+# Key (notch) at bottom - # --#ESC c n enter self-test mode: --# n = 0 exit self test mode --# n = 1 ROM test --# n = 2 RAM test --# n = 3 NVRAM test --# n = 4 screen display test --# n = 5 main/printer port test --# n = 6 mouse port test --# n = 7 graphics board test --# n = 8 graphics memory test --# n = 9 display all 'E' --# n = : display all 'H' --#ESC d set background colour screen -+# Pin 1 DSR -+# 3 DCD -+# 4 DTR -+# 5 Sig Ground -+# 6 RD -+# 7 SD -+# 8 CTS -+# 9 RTS -+# 10 Frame Ground - # --#ESC e n program insert char (n = insert char) --#ESC f text CR load user status line with 'text' -+# The manual is 189 pages and is loaded with details about the escape codes, -+# etc..... Available from AT&T CIC 800-432-6600... -+# ask for Document number 999-300-660.. - # --#ESC g display user status line on 25th line --#ESC h display system status line on 25th line --#ESC i tab --#ESC j reverse linefeed --#ESC k n duplex/local edit mode: --# n = 0 duplex edit mode --# n = 1 local edit mode --#ESC l n select virtual screen: --# n = 0 screen 1 --# n = 1 screen 2 --#ESC m save current config to NVRAM --#ESC n p1 select display screen: --# p1 = 0 screen 1 --# p1 = 1 screen 2 --# p1 = 2 screen 3 --# p1 = 3 screen 4 --#ESC o p1 p2 set characters/line and attribute: --# p1 = 0 80 chars/line -+att700|AT&T 700 24x80 column display w/102key keyboard, -+ am, eslok, hs, mir, msgr, xenl, xon, -+ cols#80, it#8, lh#2, lines#24, lw#8, nlab#8, wsl#80, -+ acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -+ bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l, -+ clear=\E[H\E[J, cnorm=\E[?25h\E[?12l, cr=^M, -+ csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, -+ cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, cuf1=\E[C, -+ cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, -+ cvvis=\E[?12;25h, dch=\E[%p1%dP, dch1=\E[P, dim=\E[2m, -+ dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[K, el1=\E[1K, -+ enacs=\E(B\E)0, flash=\E[?5h$<200>\E[?5l, fln=4\,4, -+ fsl=\E8, home=\E[H, ht=^I, hts=\EH, ich=\E[%p1%d@, -+ il=\E[%p1%dL, il1=\E[L, ind=\ED, invis=\E[8m, -+ is2=\E[50;4|\E[53;0|\E[8;0|\E[?4;13;15l\E[13;20l\E[?7h\E[12h\E(B\E)0\E[?31l\E[0m\017, -+ is3=\E(B\E)0, kLFT=\E[ A, kRIT=\E[ @, kbs=^H, kcbt=\E[Z, -+ kclr=\E[2J, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, -+ kdch1=\E[P, kdl1=\E[M, kend=\E[24;1H, kf1=\EOc, kf10=\ENp, -+ kf11=\ENq, kf12=\ENr, kf13=\ENs, kf14=\ENt, kf15=\EOC, -+ kf16=\EOD, kf17=\EOE, kf18=\EOF, kf19=\EOG, kf2=\EOd, -+ kf20=\EOH, kf21=\EOI, kf22=\EOJ, kf23=\ENO, kf24=\ENP, -+ kf25=\ENQ, kf26=\ENR, kf27=\ENS, kf28=\ENT, kf29=\EOq, -+ kf3=\EOe, kf30=\EOr, kf31=\EOs, kf32=\EOt, kf33=\EOu, -+ kf34=\EOv, kf35=\EOw, kf36=\EOx, kf37=\EOy, kf38=\EOu, -+ kf39=\EOv, kf4=\EOf, kf40=\EOl, kf41=\EOq, kf42=\EOr, -+ kf43=\EOs, kf44=\EOp, kf45=\EOn, kf46=\EOM, kf5=\EOg, -+ kf6=\EOh, kf7=\EOi, kf8=\EOj, kf9=\ENo, khome=\E[H, -+ kich1=\E[@, kil1=\E[L, knp=\E[U, kpp=\E[V, ll=\E[24H, -+ mc0=\E[i, mc4=\E[?4i, mc5=\E[?5i, nel=\EE, -+ pfx=\E[%p1%d;%p2%l%02dq%?%p1%{9}%<%t F%p1%1d %;%p2%s, -+ pln=\E[%p1%d;0;0;0q%p2%:-16.16s, rc=\E8, -+ rep=%p1%c\E[%p2%{1}%-%db, rev=\E[7m, ri=\EM, rmacs=^O, -+ rmir=\E[4l, rmln=\E[2p, rmso=\E[27m, rmul=\E[24m, -+ rmxon=\E[53;3|, rs1=\Ec\E[?3;5l\E[56;0|, sc=\E7, -+ sgr=\E[0%?%p6%t;1%;%?%p5%t;2%;%?%p2%t;4%;%?%p4%t;5%;%?%p3%p1%|%t;7%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, -+ sgr0=\E[m\017, smacs=^N, smir=\E[4h, smln=\E[p, smso=\E[7m, -+ smul=\E[4m, smxon=\E[53;0|, tbc=\E[3g, -+ tsl=\E7\E[99;%i%p1%dx, -+ -+# This entry was modified 3/13/90 by JWE. -+# fixes include additions of <enacs>, correcting <rep>, and modification -+# of <kHOM>. (See comments below) -+# att730 has status line of 80 chars -+# These were commented out: <indn=\E[%p1%dS>, <rin=\E[%p1%dT>, -+# the <kf25> and up keys are used for shifted system Fkeys -+# NOTE: JWE 3/13/90 The 98 key keyboard translation for shift/HOME is -+# currently the same as <khome> (unshifted HOME or \E[H). On the 102, 102+1 -+# and 122 key keyboards, the 730's translation is \E[2J. For consistency -+# <kHOM> has been commented out. The user can uncomment <kHOM> if using the -+# 102, 102+1, or 122 key keyboards -+# kHOM=\E[2J, -+# (att730: I added <rmam>/<smam> based on the init string -- esr) -+att730|AT&T 730 windowing terminal, -+ am, da, db, eslok, hs, mir, msgr, npc, xenl, xon, -+ cols#80, it#8, lh#2, lines#60, lm#0, lw#8, nlab#24, wsl#80, -+ acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -+ bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l, -+ clear=\E[H\E[J, cnorm=\E[?25h\E[?12l, cr=^M, -+ csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, -+ cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, cuf1=\E[C, -+ cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, -+ cvvis=\E[?12;25h, dch=\E[%p1%dP, dch1=\E[P, dim=\E[2m, -+ dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[K, el1=\E[1K, -+ enacs=\E(B\E)0, flash=\E[?5h$<200>\E[?5l, fsl=\E8, -+ home=\E[H, ht=^I, ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[L, -+ ind=\ED, invis=\E[8m, -+ is1=\E[8;0|\E[?3;4;5;13;15l\E[13;20l\E[?7h\E[12h\E(B\E)B, -+ is2=\E[m\017, is3=\E(B\E)0, kLFT=\E[ @, kRIT=\E[ A, kbs=^H, -+ kcbt=\E[Z, kclr=\E[2J, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, -+ kcuu1=\E[A, kf1=\EOc, kf10=\ENp, kf11=\ENq, kf12=\ENr, -+ kf13=\ENs, kf14=\ENt, kf15=\ENu, kf16=\ENv, kf17=\ENw, -+ kf18=\ENx, kf19=\ENy, kf2=\EOd, kf20=\ENz, kf21=\EN{, -+ kf22=\EN|, kf23=\EN}, kf24=\EN~, kf25=\EOC, kf26=\EOD, -+ kf27=\EOE, kf28=\EOF, kf29=\EOG, kf3=\EOe, kf30=\EOH, -+ kf31=\EOI, kf32=\EOJ, kf33=\ENO, kf34=\ENP, kf35=\ENQ, -+ kf36=\ENR, kf37=\ENS, kf38=\ENT, kf39=\EOU, kf4=\EOf, -+ kf40=\EOV, kf41=\EOW, kf42=\EOX, kf43=\EOY, kf44=\EOZ, -+ kf45=\EO[, kf46=\EO\s, kf47=\EO], kf48=\EO\^, kf5=\EOg, -+ kf6=\EOh, kf7=\EOi, kf8=\EOj, kf9=\ENo, khome=\E[H, -+ kich1=\E[@, kil1=\E[L, kind=\E[S, kri=\E[T, -+ mc0=\E[?19h\E[0i, mc4=\E[?4i, mc5=\E[?5i, nel=\EE, -+ pfx=\E[%?%p1%{25}%<%t%p1%e%p1%{24}%-%;%d;%p2%l%02d%?%p1%{25}%<%tq SYS F%p1%:-2d %e;0;3q%;%p2%s, -+ pfxl=\E[%p1%d;%p2%l%02d;0;0q%p3%:-16.16s%p2%s, -+ pln=\E[%p1%d;0;0;0q%p2%:-16.16s, rc=\E8, -+ rep=%p1%c\E[%p2%{1}%-%db, rev=\E[7m, ri=\EM, rmacs=^O, -+ rmam=\E[?7l, rmir=\E[4l, rmln=\E[?13h, rmso=\E[27m, -+ rmul=\E[24m, rmxon=\E[?21l, rs2=\Ec\E[?3l, sc=\E7, -+ sgr=\E[0%?%p6%t;1%;%?%p5%t;2%;%?%p2%t;4%;%?%p4%t;5%;%?%p3%p1%|%t;7%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, -+ sgr0=\E[m\017, smacs=^N, smam=\E[?7h, smir=\E[4h, -+ smln=\E[?13l, smso=\E[7m, smul=\E[4m, smxon=\E[?21h, -+ swidm=\E#6, tsl=\E7\E[;%i%p1%dx, -+att730-41|730MTG-41|AT&T 730-41 windowing terminal Version, -+ lines#41, use=att730, -+att730-24|730MTG-24|AT&T 730-24 windowing terminal Version, -+ lines#24, use=att730, -+att730r|730MTGr|AT&T 730 rev video windowing terminal Version, -+ flash=\E[?5l$<200>\E[?5h, -+ is1=\E[8;0|\E[?3;4;13;15l\E[?5h\E[13;20l\E[?7h\E[12h\E(B\E)B, -+ use=att730, -+att730r-41|730MTG-41r|AT&T 730r-41 rev video windowing terminal Version, -+ lines#41, use=att730r, -+att730r-24|730MTGr-24|AT&T 730r-24 rev video windowing terminal Version, -+ lines#24, use=att730r, -+ -+# The following represents the screen layout along with the associated -+# bezel buttons for the 5430/pt505 terminal. The "kf" designations do -+# not appear on the screen but are shown to reference the bezel buttons. -+# The "CMD", "MAIL", and "REDRAW" buttons are shown in their approximate -+# position relative to the screen. - # --#ESC o p1 p2 set characters/line and attribute: --# p1 = 0 80 chars/line --# p1 = 1 132 chars/line --# p2 = 0 single width single height --# p2 = 1 single width double height --# p2 = 2 double width single height --# p2 = 3 double width double height - # --#ESC q insert mode on --#ESC r edit mode on --#ESC s send message all --#ESC t erase line to null --#ESC u clear monitor mode (see ESC U, ESC X) --#ESC v autopage mode on --#ESC w autopage mode off --#ESC x p1 p2 p3 define delimiter code... --#ESC y erase page to null - # --#ESC z 2 p1 p2 p3 p4 draw quadrangle: --# p1 = starting row --# p2 = starting column --# p3 = end row --# p4 = end column -+# +----------------------------------------------------------------+ -+# | | -+# XXXX | kf0 kf24 | XXXX -+# | | -+# | | -+# XXXX | kf1 kf23 | XXXX -+# | | -+# | | -+# XXXX | kf2 kf22 | XXXX -+# | | -+# | | -+# XXXX | kf3 kf21 | XXXX -+# | | -+# | | -+# XXXX | kf4 kf20 | XXXX -+# | | -+# | | -+# XXXX | kf5 kf19 | XXXX -+# | | -+# | | -+# XXXX | kf6 kf18 | XXXX -+# | | -+# | | -+# XXXX | | XXXX -+# | | -+# | | -+# +----------------------------------------------------------------+ - # --#ESC { p1 p2 p3 p4 configure main port --# (baud, stop bits, parity, word length) -+# XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX - # --#ESC | p1 p2 text Ctrl-Y program function key with 'text': --# p1 = function key code: --# '1' - ';' normal f1- f11 --# '<' - 'F' shifted f1 - f11 --# p2 = program mode: --# 1 = FDX --# 2 = LOC --# 3 = HDX --# Ctrl-Y = terminator --# (use Ctrl-P to escape ^P, ^Y ) -+# Note: XXXX represents the screen buttons -+# CMD REDRAW - # --#ESC } p1 p2 p3 p4 configure printer port --# (baud, stop bits, parity, word length) --#ESC ~ send system status -+# MAIL - # --# Codes and info from Peter Disdale <pete@pdlmail.demon.co.uk> 12 May 1997 -+# version 1 note: -+# The character string sent by key 'kf26' may be user programmable -+# to send either \E[16s, or \E[26s. -+# The character string sent by key 'krfr' may be user programmable -+# to send either \E[17s, or \E[27s. - # --# Entry is by esr going solely on above information and is UNTESTED. --# This actually looks a lot like a Televideo 9xx. --# This entry uses page 0 and is monochrome; I'm not brave enough to try --# to make color work without a test terminal. The <am> capability is a guess. --# The initialization string sets conversation mode, blinking underline cursor, --# full duplex, parallel attribute mode, display user status line, white --# foreground, black background, normal highlight. -+# Depression of the "CMD" key sends \E! (kcmd) -+# Depression of the "MAIL" key sends \E[26s (kf26) -+# "REDRAW" same as "REFRESH" (krfr) - # --icl6404|kds7372|icl6402|kds6402|ICL 6404 aka Kokusai Display Systems 7372, -- OTbs, am, hs, -- cols#80, lines#24, -- bel=^G, blink=\E[2ZZ, cbt=\EI, civis=\E.0, clear=\E*, -- cnorm=\E.3, cr=^M, -- csr=\E!%+%p1%{32}%+%p2%{32} cud1=\026, cuf1=^L, -- cup=\E=%p1%{32}%+%c%p2%{80}%m%{32}%+%c%p2%{80}%>%{32}%+%c, -- cuu1=^K, cvvis=\E.1, dch1=\EW, dl1=\ER, home=^^, ht=^I, -- hts=\E1, il1=\EE, invis=\E[1ZZ, -- is1=\EC\E.3\EDF\EV1\Eg\E[0ZZ, nel=^_, rev=\E[4ZZ, -- rmir=\Er, rmso=\E[%gh%{4}%^%Ph%gh%dZZ, -- rmul=\E[%gh%{8}%^%Ph%gh%dZZ, rs2=\Eo1, -- sgr=\E[%{0}%?%p1%t%{4}%|%;%?%p2%t%{8}%|%;%?%p3%t%{4}%|%;%?%p4%t%{2}%|%;%?%p7%t%{1}%|%;ZZ, -- sgr0=\E[0ZZ, smir=\Eq, smso=\E[8ZZ, smul=\E[8ZZ, tbc=\E3, --icl6404-w|kds7372-w|ICL 6404 aka Kokusai Display Systems 7372 132 cols, -- rs2=\Eo1, use=icl6404, -- --#### Interactive Systems Corp -+# "kf" functions adds carriage return to output string if terminal is in -+# 'new line' mode. - # --# ISC used to sell OEMed and customized hardware to support ISC UNIX. --# ISC UNIX still exists in 1995, but ISC itself is no more; they got --# bought out by Sun. -+# The following are functions not covered in the table above: - # -- --# From: <cithep!eric> Wed Sep 16 08:06:44 1981 --# (intext: removed obsolete ":ma=^K^P^R^L^L ::bc=^_:", also the --# ":le=^_:" later overridden -- esr) --intext|Interactive Systems Corporation modified owl 1200, -- OTbs, am, -- cols#80, it#8, lines#24, xmc#1, -- bel=^G, cbt=^Y, clear=\014$<132>, cr=^M, cub1=^H, cud1=^J, -- cuf1=^^, cup=\017%p1%{32}%+%c%p2%{32}%+%c, cuu1=^\, -- dch1=\022$<5.5*>, dl1=\021$<5.5*>, ed=\026J$<5.5*>, -- el=^Kp^R, ht=^I, il1=\020$<5.5*>, ind=^J, ip=$<5.5*>, kbs=^H, -- kcub1=^_, kcud1=^J, kcuf1=^^, kcuu1=^\, kf0=^VJ\r, kf1=^VA\r, -- kf2=^VB\r, kf3=^VC\r, kf4=^VD\r, kf5=^VE\r, kf6=^VF\r, -- kf7=^VG\r, kf8=^VH\r, kf9=^VI\r, khome=^Z, rmir=^V<, -- rmkx=^V9, rmso=^V#\s, smir=^V;, smkx=\036\:\264\026%%, -- smso=^V$\,, --intext2|intextii|INTERACTIVE modified owl 1251, -- am, bw, ul, -- cols#80, lines#24, xmc#0, -- bel=^G, cbt=\E[Z, clear=\E[H\E[2J, cr=^M, cub1=\E[D, -- cud1=\E[B, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, -- dch1=\E[P, dl1=\E[M, ed=\E[J, el=\E[K, -- flash=\E[;;;;;;;;;2;;u$<200/>\E[;;;;;;;;;1;;u, -- hpa=\E[%p1%{1}%+%dG, ht=^I, ich1=\E[@, il1=\E[L, ind=\E[S, -- kbs=^H, kcub1=\ED\r, kcud1=\EB\r, kcuf1=\EC\r, kcuu1=\EA\r, -- kf0=\E@\r, kf1=\EP\r, kf2=\EQ\r, kf3=\ES\r, kf4=\ET\r, -- kf5=\EU\r, kf6=\EV\r, kf7=\EW\r, kf8=\EX\r, kf9=\EY\r, -- khome=\ER\r, lf0=REFRSH, lf1=DEL CH, lf2=TABSET, lf3=GOTO, -- lf4=+PAGE, lf5=+SRCH, lf6=-PAGE, lf7=-SRCH, lf8=LEFT, -- lf9=RIGHT, ri=\E[T, rmso=\E[2 D, rmul=\E[2 D, smso=\E[6 D, -- smul=\E[18 D, -- --#### Kimtron (abm, kt) -+# Set keyboard character (SKC): \EPn1;Pn2w -+# Pn1= 0 Back Space key -+# Pn1= 1 Break key -+# Pn2= Program char (hex) - # --# Kimtron seems to be history, but as March 1998 these people are still --# offering repair services for Kimtron equipment: -+# Screen Definition (SDF): \E[Pn1;Pn2;Pn3;Pn4;Pn5t -+# Pn1= Window number (1-39) -+# Pn2-Pn5= Y;X;Y;X coordinates - # --# Com/Pair Monitor Service --# 1105 N. Cliff Ave. --# Sioux Falls, South Dakota 57103 -+# Screen Selection (SSL): \E[Pnu -+# Pn= Window number - # --# WATS voice: 1-800/398-4946 --# POTS fax: +1 605/338-8709 --# POTS voice: +1 605/338-9650 --# Email: <compair@sd.cybernex.net> --# Internet/Web: <http://www.com-pair.com> -+# Set Terminal Modes (SM): \E[Pnh -+# Pn= 3 Graphics mode -+# Pn= > Cursor blink -+# Pn= < Enter new line mode -+# Pn= = Enter reverse insert/replace mode -+# Pn= ? Enter no scroll mode - # --# Kimtron entries include (undocumented) codes for: enter dim mode, --# enter bold mode, enter reverse mode, turn off all attributes. -+# Reset Terminal Mode (RM): \E[Pnl -+# Pn= 3 Exit graphics mode -+# Pn= > Exit cursor blink -+# Pn= < Exit new line mode -+# Pn= = Exit reverse insert/replace mode -+# Pn= ? Exit no scroll mode - # -- --# Kimtron ABM 85 added by Dual Systems --# (abm85: removed duplicated ":kd=^J:" -- esr) --abm85|Kimtron ABM 85, -- OTbs, am, bw, msgr, -- cols#80, it#8, lines#24, xmc#1, -- cbt=\EI, clear=\E*, cub1=^H, cud1=^J, cuf1=^L, -- cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW, -- dl1=\ER, ed=\Ey, el=\Et, ht=^I, -- if=/usr/share/tabset/stdcrt, il1=\EE, -- is2=\EC\EX\Eg\En\E%\Er\E(\Ek\Em\Eq, kbs=^H, kcub1=^H, -- kcud1=^J, kcuf1=^L, kcuu1=^K, khome=^^, rmir=\Er, rmso=\Ek, -- rmul=\Em, smir=\EQ, smso=\Ej, smul=\El, --# Kimtron ABM 85H added by Dual Systems. --# Some notes about the abm85h entries: --# 1) there are several firmware revs of 85H in the world. Use abm85h-old for --# firmware revs prior to SP51 --# 2) Make sure to use abm85h entry if the terminal is in 85h mode and the --# abm85e entry if it is in tvi920 emulation mode. They are incompatible --# in some places and NOT software settable i.e., <is2> can't fix it) --# 3) In 85h mode, the arrow keys and special functions transmit when --# the terminal is in dup-edit, and work only locally in local-edit. --# Vi won't swallow `del char' for instance, but <smcup> turns on --# dup-edit anyway so that the arrow keys will work right. If the --# arrow keys don't work the way you like, change <smcup>, <rmcup>, and --# <is2>. Note that 920E mode does not have software commands to toggle --# between dup and local edit, so you get whatever was set last on the --# terminal. --# 4) <flash> attribute is nice, but seems too slow to work correctly --# (\Eb<pad>\Ed) --# 5) Make sure `hidden' attributes are selected. If `embedded' attributes --# are selected, the <xmc@> entry should be removed. --# 6) auto new-line should be on (selectable from setup mode only) -+# Screen Status Report (SSR): \E[Pnp -+# Pn= 0 Request current window number -+# Pn= 1 Request current window dimensions - # --# From: Erik Fair <fair@ucbarpa> Sun Oct 27 07:21:05 1985 --abm85h|Kimtron ABM 85H native mode, -- hs, -- xmc@, -- bel=^G, cnorm=\E.4, cvvis=\E.2, dim=\E), dsl=\Ee, flash@, -- fsl=^M, invis@, -- is2=\EC\EN\EX\024\016\EA\Ea\E%\E9\Ee\Er\En\E"\E}\E'\E(\Ef\r\EG0\Ed\E.4\El, -- kcud1=^V, sgr0=\E(\EG0, smir=\EZ, tsl=\Eg\Ef, use=adm+sgr, -- use=abm85, --abm85e|Kimtron ABM 85H in 920E mode, -- xmc@, -- bel=^G, dim=\E), flash@, -- is2=\EC\EX\EA\E%\E9\Ee\Er\En\E"\E}\E'\E(\Ef\r\Ek\Eq\Em, -- rev=\Ej, sgr0=\E(\Ek, smir=\EZ, use=abm85, --abm85h-old|oabm85h|o85h|Kimtron ABM 85H with old firmware rev., -- xmc@, -- bel=^G, dim=\E), -- is2=\E}\EC\EX\Ee\En\E%\Er\E(\Ek\Em\Eq\Ed\ET\EC\E9\EF, -- rev=\Ej, sgr0=\E(\Ek, smir=\EZ, use=abm85, --# From: <malman@bbn-vax.arpa> --# (kt7: removed obsolete :ma=^V^J^L :" -- esr) --kt7|kimtron model kt-7, -- OTbs, am, -- cols#80, it#8, lines#24, -- cbt=\EI, clear=^Z, cub1=^H, cud1=^V, cuf1=^L, -- cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW, -- dl1=\ER, ed=\EY, el=\ET, fsl=\Eg, home=^^, ht=^I, ich1=\EQ, -- if=/usr/share/tabset/stdcrt, il1=\EE, invis@, is2=\El\E", -- kbs=^H, kcbt=\EI, kclr=^Z, kcub1=^H, kcud1=^V, kcuf1=^L, -- kcuu1=^K, kdch1=\EW, kdl1=\ER, ked=\EY, kel=\ET, kf0=^AI\r, -- kf1=^A@\r, kf2=^AA\r, kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, -- kf6=^AE\r, kf7=^AF\r, kf8=^AG\r, kf9=^AH\r, khome=^^, -- kich1=\EQ, kil1=\EE, tsl=\Ef, use=adm+sgr, --# Renamed TB=^I to :ta:, BE=^G to :bl:, BS=^H to :kb:, N to :kS: (based on the --# other kt7 entry and the adjacent key capabilities). Removed EE which is --# identical to :mh:. Removed :ES=\EGD: which is some kind of highlight --# but we can't figure out what. --kt7ix|kimtron model kt-7 or 70 in IX mode, -- am, bw, -- cols#80, it#8, lines#25, -- acsc=jYk?lZm@nEqDt4uCvAwBx3, bel=^G, blink=\EG2, cbt=\EI, -- civis=\E.0, clear=\E*, cnorm=\E.3, cr=^M, cub1=^H, cud1=^V, -- cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, -- dch1=\EW, dim=\EG@, dl1=\ER, dsl=\Ef\r, ed=\EY, el=\ET, fsl=^M, -- home=^^, ht=^I, ich1=\EQ, il1=\EE, ind=^J, -- is2=\EG0\E s\017\E~, kbs=^H, kcbt=\EI, kclr=\E*, -- kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdl1=\ER, -- ked=\EY, kel=\ET, kend=\EY, kf0=^AI\r, kf1=^A@\r, kf2=^AA\r, -- kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, kf6=^AE\r, kf7=^AF\r, -- kf8=^AG\r, kf9=^AH\r, khome=^^, kich1=\EQ, kil1=\EE, knp=\EJ, -- nel=^M^J, pulse=\EK, rmacs=\E%%, rmir=, rmso=\EG0, rmul=\EG0, -- sgr0=\EG0, smacs=\E$, smir=, smso=\EG4, smul=\EG8, tsl=\Ef, -- --#### Microdata/MDIS -+# Device Status Report (DSR): \E[6n Request cursor position - # --# This was a line of terminals made by McDonnell-Douglas Information Systems. --# These entries come direct from MDIS documentation. I have edited them only --# to move primary names of the form p[0-9] * to aliases, and to comment out --# <rmacs>/<smacs> in a couple of entries without <acsc> strings. I have --# also removed the change history; the last version indicates this is --# version 4.3 by A.Barkus, September 1990 (earliest entry is October 1989). -+# Call Status Report (CSR): \E[Pnv -+# Pn= 0 Call failed -+# Pn= 1 Call successful - # -- --# McDonnell Information Systems Terminal Family History --# ========================================= --# --# Prism-1, Prism-2 and P99: --# Ancient Microdata and CMC terminals, vaguely like Adds Regent 25. --# --# Prism-4 and Prism-5: --# Slightly less ancient range of Microdata terminals. Follow-on from --# Prism-2, but with many enhancements. P5 has eight display pages. --# --# Prism-6: --# A special terminal for use with library systems, primarily in Germany. --# Limited numbers. Similar functionality to P5 (except attributes?). -+# Transparent Button String (TBS): \E[Pn1;Pn2;Pn3;{string -+# Pn1= Button number to be loaded -+# Pn2= Character count of "string" -+# Pn3= Key mode being loaded: -+# 0= Unshifted -+# 1= Shifted -+# 2= Control -+# String= Text string (15 chars max) - # --# Prism-7, Prism-8 and Prism-9: --# More recent range of MDIS terminals, in which P7 and P8 --# replace the P4 & P5, with added functionality, and P9 is the flagship. --# The P9 has two emulation modes - P8 and ANSI - and includes a --# large number of the DEC VT220 control sequences. Both --# P8 and P9 support 80c/24ln/8pg and 132cl/24li/4pg formats. -+# Screen Number Report (SNR): \E[Pnp -+# Pn= Screen number - # --# Prism-12 and Prism-14: --# Latest range, functionally very similar to the P9. The P14 has a --# black-on-white overscanning screen. -+# Screen Dimension Report (SDR): \E[Pn1;Pn2r -+# Pn1= Number of rows available in window -+# Pn2= Number of columns available in window - # --# The terminfo definitions given here are: -+# Cursor Position Report (CPR): \E[Pn1;Pn2R -+# Pn1= "Y" Position of cursor -+# Pn2= "X" Position of cursor - # --# p2 - Prism-2 (or Prism-1 or P99). -+# Request Answer Back (RAB): \E[c - # --# p4 - Prism-4 (and older P7s & P8s). --# p5 - Prism-5 (or Prism-6). -+# Answer Back Response (ABR): \E[?;*;30;VSV -+# *= 0 No printer available -+# *= 2 Printer available -+# V= Software version number -+# SV= Software sub version number -+# (printer-available field not documented in v1) - # --# p7 - Prism-7. --# p8 - Prism-8 (in national or multinational mode). --# p8-w - 132 column version of p8. --# p9 - Prism-9 in ANSI mode. --# p9-w - 132 column version of p9. --# p9-8 - Prism-9 in Prism-8 emulation mode. --# p9-8-w - As p9-8, but with 132 columns. -+# Screen Alignment Aid: \En - # --# p12 - Prism-12 in ANSI mode. --# p12-w - 132 column version of p12. --# p12-m - Prism-12 in MDC emulation mode. --# p12-m-w - As p12-m, but with 132 columns. --# p14 - Prism-14 in ANSI mode. --# p14-w - 132 column version of p14. --# p14-m - Prism-14 in MDC emulation mode. --# p14-m-w - As p14-m, but with 132 columns. -+# Bell (lower pitch): \E[x - # --# p2: Prism-2 --# ----------- -+# Dial Phone Number: \EPdstring\ -+# string= Phone number to be dialed - # --# Includes Prism-1 and basic P99 without SP or MP loaded. --# The simplest form of Prism-type terminal. --# Basic cursor movement and clearing operations only. --# No video attributes. --# Notes: --# Horizontal cursor qualifiers of NUL, XON and XOFF are mapped to the next --# value up, followed by backspace. -+# Set Phone Labels: \EPpstring\ -+# string= Label for phone buttons - # --prism2|MDC Prism-2, -- am, bw, msgr, -- cols#80, lines#24, -- bel=^G, clear=\014$<20>, cr=^M, cub1=^H, cud1=^J, cuf1=^F, -- cup=\013%p1%{32}%+%c\020%p2%{10}%/%{16}%*%p2%{10}%m%+%Pc%?%{17}%gc%=%{19}%gc%=%|%gc%!%|%t%{1}%gc%+%c%{8}%e%gc%;%c, -- cuu1=^Z, ed=\EJ, el=\EK, home=^A, -- hpa=\020%p1%{10}%/%{16}%*%p1%{10}%m%+%Pc%?%{17}%gc%=%{19}%gc%=%|%gc%!%|%t%{1}%gc%+%c%{8}%e%gc%;%c, -- ind=^J, kbs=^H, khome=^A, vpa=\013%p1%{32}%+%c, -- --# p4: Prism-4 --# ----------- -+# Set Clock: \EPchour;minute;second\ - # --# Includes early versions of P7 & P8. --# Basic family definition for most Prisms (except P2 and P9 ANSI). --# Notes: --# Horizontal cursor qualifiers of NUL, XON and XOFF are mapped to the next --# value up, followed by backspace. --# Cursor key definitions removed because they interfere with vi and csh keys. -+# Position Clock: \EPsY;X\ -+# Y= "Y" coordinate -+# X= "X" coordinate - # --prism4|p4|P4|MDC Prism-4, -- am, bw, hs, mc5i, msgr, -- cols#80, lines#24, wsl#72, xmc#1, -- bel=^G, blink=^CB, civis=^]\344, clear=\014$<20>, -- cnorm=^]\342, cr=^M, cub1=^H, cud1=^J, cuf1=^F, -- cup=\013%p1%{32}%+%c\020%p2%{10}%/%{16}%*%p2%{10}%m%+%Pc%?%{17}%gc%=%{19}%gc%=%|%gc%!%|%t%{1}%gc%+%c%{8}%e%gc%;%c, -- cuu1=^Z, dim=^CA, dsl=\035\343\035\345, ed=\EJ, el=\EK, -- fsl=^]\345, home=^A, -- hpa=\020%p1%{10}%/%{16}%*%p1%{10}%m%+%Pc%?%{17}%gc%=%{19}%gc%=%|%gc%!%|%t%{1}%gc%+%c%{8}%e%gc%;%c, -- ind=^J, invis=^CH, kbs=^H, khome=^A, mc0=\EU, mc4=\ET, mc5=\ER, -- rev=^CD, rmso=^C\s, rmul=^C\s, -- sgr=\003%{64}%?%p1%p3%|%t%{4}%+%;%?%p2%t%{16}%+%;%?%p4%t%{2}%+%;%?%p5%t%{1}%+%;%?%p7%t%{8}%+%;%c%?%p9%t\016%e\017%;, -- sgr0=^C\s, smso=^CD, smul=^CP, tsl=^]\343, -- vpa=\013%p1%{32}%+%c, -- --# p5: Prism-5 --# ----------- -+# Delete Clock: \Epr\ - # --# Same definition as p4. Includes Prism-6 (not tested!). --# Does not use any multi-page features. -+# Programming The Function Buttons: \EPfPn;string\ -+# Pn= Button number (00-06, 18-24) -+# (kf00-kf06, kf18-kf24) -+# string= Text to sent on button depression - # --prism5|p5|P5|MDC Prism-5, -- use=p4, -- --# p7: Prism-7 --# ----------- -+# The following in version 2 only: - # --# Similar definition to p4. Uses ANSI cursor motion to avoid network problems. --# Notes: --# Use p4 for very early models of P7. --# Rev-index removed; can't send nulls to terminal in 8-bit modes. -+# Request For Local Directory Data: \EPp12;\ - # --prism7|p7|P7|MDC Prism-7, -- cup=\E[%i%p1%d;%p2%dH, hpa@, vpa@, use=p4, -- --# p8: Prism-8 --# ----------- -+# Local Directory Data to host: \EPp11;LOCAL...DIRECTORY...DATA\ - # --# Similar definition to p7. Uses ANSI cursor motion to avoid network problems. --# Supports national and multinational character sets. --# Notes: --# Alternate char set operations only work in multinational mode. --# Use p4 for very early models of P8. --# Rev-index removed; can't send nulls to terminal in 8-bit modes. --# (esr: commented out <smacs>/<rmacs> because there's no <acsc>) -+# Request for Local Directory Data in print format: \EPp13;\ - # --prism8|p8|P8|MDC Prism-8, -- cup=\E[%i%p1%d;%p2%dH, hpa=\E[%i%p1%d`, is2=\E[<12h, -- vpa=\E[%i%p1%dd, use=p4, -- --# p8-w: Prism-8 in 132 column mode --# -------------------------------- -+# Enable 'Prt on Line' mode: \022 (DC2) - # --# 'Wide' version of p8. --# Notes: --# Rev-index removed; can't send nulls to terminal in 8-bit modes. -+# Disable 'Prt on Line' mode: \024 (DC4) - # --prism8-w|p8-w|P8-W|MDC Prism-8 in 132 column mode, -- cols#132, -- is2=\E[<12h\E[<14h, use=p8, - --# p9: Prism-9 in ANSI mode --# ------------------------- --# --# The "flagship" model of this generation of terminals. --# ANSI X3.64 (ISO 6429) standard sequences, plus many DEC VT220 ones. --# Notes: --# Tabs only reset by "reset". Otherwise assumes default (8 cols). --# Fixes to deal with terminal firmware bugs: --# . 'ri' uses insert-line since rev index doesn't always --# . 'sgr0' has extra '0' since esc[m fails --# . 'fsl' & 'dsl' use illegal char since cr is actioned wrong on line 25 --# Not covered in the current definition: --# . Labels --# . Programming Fn keys --# . Graphic characters (defaults correctly to vt100) --# . Padding values (sets xon) --# (esr: commented out <smacs>/<rmacs> because there's no <acsc>) --# --prism9|p9|P9|MDC Prism-9 in ANSII mode, -- am, bw, hs, mc5i, msgr, xenl, xon, -- cols#80, it#8, lines#24, vt#3, wsl#72, -- bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[<4l, -- clear=^L, cnorm=\E[<4h, cr=^M, csr=\E[%i%p1%d;%p2%d%%v, -- cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=^J, -- cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, -- cuu=\E[%p1%dA, cuu1=\E[A, dch=\E[%p1%dP, dch1=\E[P, -- dl=\E[%p1%dM, dl1=\E[M, dsl=\E[%}\024, ech=\E[%p1%dX, -- ed=\E[J$<10>, el=\E[K, fsl=^T, home=\E[H, hpa=\E[%i%p1%d`, -- ht=^I, hts=\EH, il=\E[%p1%dL, il1=\E[L, ind=^J, -- is2=\E[&p\E[<12l\E F, kbs=^H, kclr=^L, kcub1=\E[D, -- kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kf1=\E[11~, -- kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, -- kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, kf17=\E[31~, -- kf18=\E[32~, kf2=\E[12~, kf3=\E[13~, kf4=\E[14~, -- kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, -- khome=\E[H, mc0=\E[i, mc4=\E[4i, mc5=\E[5i, nel=^M^J, -- prot=\E[32%{, rc=\E[%z, rep=\E[%p2%db%p1%c, rev=\E[7m, -- ri=\E[L, rmir=\E[4l, rmso=\E[27m, rmul=\E[24m, -- rs2=\E[&p\E[<12l\E F\E[3g\E[9;17;25;33;41;49;57;65;73 N, -- sc=\E[%y, -- sgr=\E[%{0}%?%p1%p3%|%t%{7}%+%;%?%p2%t%{2}%+%;%?%p4%t%{5}%+%;%?%p6%t%{1}%+%;m%?%p8%t\E[%{32}%+%d%%{%;%?%p9%t\016%e\017%;, -- sgr0=\E[0m\017, smir=\E[4h, smso=\E[7m, smul=\E[4m, -- tbc=\E[3g, tsl=\E[%i%p1%d%%}, vpa=\E[%i%p1%dd, -+# 05-Aug-86: -+# The following Terminfo entry describes functions which are supported by -+# the AT&T 5430/pt505 terminal software version 2 and later. -+att505|pt505|att5430|gs5430|AT&T Personal Terminal 505 or 5430 GETSET terminal, -+ am, xon, -+ cols#80, it#8, lines#24, -+ acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -+ bel=^G, blink=\E[5m, bold=\E[1m, clear=\E[2J\E[H, -+ cnorm=\E[>l, cr=^M, cub=\E[%p1%dD, cub1=\E[D, -+ cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, cuf1=\E[C, -+ cup=\E[%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, -+ cvvis=\E[>h, dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, -+ dl1=\E[M, ed=\E[0J, el=\E[0K, el1=\E[2K, home=\E[H, ht=^I, -+ il=\E[%p1%dL, il1=\E[L, ind=^J, -+ is1=\EPr\\E[0u\E[2J\E[0;0H\E[m\E[3l\E[<l\E[4l\E[>l\E[=l\E[?l, -+ kbs=^H, kcmd=\E!, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, -+ kcuu1=\E[A, kf0=\E[00s, kf1=\E[01s, kf18=\E[18s, -+ kf19=\E[19s, kf2=\E[02s, kf20=\E[20s, kf21=\E[21s, -+ kf22=\E[22s, kf23=\E[23s, kf24=\E[24s, kf26=\E[26s, -+ kf3=\E[03s, kf4=\E[04s, kf5=\E[05s, kf6=\E[06s, -+ krfr=\E[27s, mc4=\E[4i, mc5=\E[5i, rc=\E8, rev=\E[7m, -+ rmacs=\E[10m, rmam=\E[11;1j, rmir=\E[4l, rmso=\E[m, -+ rmul=\E[m, rs1=\Ec, sc=\E7, sgr0=\E[m, smacs=\E[11m, -+ smam=\E[11;0j, smir=\E[4h, smso=\E[1m, smul=\E[4m, - --# p9-w: Prism-9 in 132 column mode --# -------------------------------- -+# The following Terminfo entry describes functions which are supported by -+# the AT&T 5430/pt505 terminal software version 1. -+att505-24|pt505-24|gs5430-24|AT&T PT505 or 5430 GETSET version 1 24 lines, -+ lines#24, -+ mc4@, mc5@, rc@, rmam@, sc@, smam@, use=att505, -+tt505-22|pt505-22|gs5430-22|AT&T PT505 or 5430 GETSET version 1 22 lines, -+ lines#22, use=att505, - # --# 'Wide' version of p9. -+#### ------------------ TERMINFO FILE CAN BE SPLIT HERE --------------------- -+# This cut mark helps make life less painful for people running ncurses tic -+# on machines with relatively little RAM. The file can be broken in half here -+# cleanly and compiled in sections -- no `use' references cross this cut -+# going forward. - # --prism9-w|p9-w|P9-W|MDC Prism-9 in 132 column mode, -- cols#132, -- is2=\E[&p\E[<12l\E F\E[<14h, -- rs2=\E[&p\E[<12l\E F\E[<14h, use=p9, - --# p9-8: Prism-9 in P8 mode --# ------------------------ -+#### Ampex (Dialogue) - # --# P9 terminal in P8 emulation mode. --# Similar to p8 definition. --# Insertion and deletion operations possible. -+# Yes, these are the same people who are better-known for making audio- and -+# videotape. I'm told they are located in Redwood City, CA. - # --prism9-8|p9-8|P9-8|MDC Prism-9 in P8 mode, -- dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, -- ich=\E[%p1%d@, ich1=\E[@, il=\E[%p1%dL, il1=\E[L, use=p8, - --# p9-8-w: Prism-9 in P8 and 132 column modes --# ------------------------------------------ -+# From: <cbosg!ucbvax!SRC:george> Fri Sep 11 22:38:32 1981 -+# (ampex80: some capabilities merged in from SCO's entry -- esr) -+ampex80|a80|d80|dialogue|dialogue80|ampex dialogue 80, -+ OTbs, am, bw, ul, -+ cols#80, it#8, lines#24, -+ bel=^G, cbt=\EI, clear=\E*$<75>, cr=^M, cub1=^H, cud1=^J, -+ cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, -+ dch1=\EW, dl1=\ER$<5*>, ed=\Ey, el=\Et, ht=^I, hts=\E1, -+ ich1=\EQ, il1=\EE$<5*>, ind=^J, is2=\EA, rmso=\Ek, rmul=\Em, -+ smso=\Ej, smul=\El, tbc=\E3, -+# This entry was from somebody anonymous, Tue Aug 9 20:11:37 1983, who wrote: -+ampex175|ampex d175, -+ am, -+ cols#80, lines#24, -+ bel=^G, clear=\E+, cr=^M, cub1=^H, cud1=^J, cuf1=^L, -+ cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW, -+ dl1=\ER, ed=\Ey, el=\Et, home=^^, ich1=\EQ, il1=\EE, ind=^J, -+ is2=\EX\EA\EF, kcub1=^H, kcud1=^J, kcuf1=^L, kcuu1=^K, -+ kdch1=\EW, kdl1=\ER, khome=^^, kich1=\EQ, kil1=\EE, ll=^^^K, -+ rmcup=\EF, rmso=\Ek, rmul=\Em, smcup=\EN, smso=\Ej, smul=\El, -+# No backspace key in the main QWERTY cluster. Fortunately, it has a -+# NEWLINE/PAGE key just above RETURN that sends a strange single-character -+# code. Given a suitable Unix (one that lets you set an echo-erase-as-BS-SP-BS -+# mode), this key can be used as the erase key; I find I like this. Because -+# some people and some systems may not, there is another termcap ("ampex175") -+# that suppresses this little eccentricity by omitting the relevant capability. -+ampex175-b|ampex d175 using left arrow for erase, -+ kbs=^_, use=ampex175, -+# From: Richard Bascove <atd!dsd!rcb@ucbvax.berkeley.edu> -+# (ampex210: removed obsolete ":kn#10:" -- esr) -+ampex210|a210|ampex a210, -+ OTbs, am, hs, xenl, -+ cols#80, it#8, lines#24, xmc#1, -+ cbt=\EI, clear=\E*, cub1=^H, cuf1=^L, -+ cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW, -+ dl1=\ER, ed=\Ey, el=\Et, flash=\EU\EX\EU\EX\EU\EX\EU\EX, -+ fsl=\E.2, home=^^, ht=^I, ich1=\EQ, -+ if=/usr/share/tabset/std, il1=\EE, invis@, -+ is2=\EC\Eu\E'\E(\El\EA\E%\E{\E.2\EG0\Ed\En, kcub1=^H, -+ kcud1=^V, kcuf1=^L, kcuu1=^K, kf0=^A0\r, kf1=^A1\r, -+ kf2=^A2\r, kf3=^A3\r, kf4=^A4\r, kf5=^A5\r, kf6=^A6\r, -+ kf7=^A7\r, kf8=^A8\r, kf9=^A9\r, khome=^^, -+ tsl=\E.0\Eg\E}\Ef, use=adm+sgr, -+# (ampex219: I added <rmam>/<smam> based on the init string, added <cvvis> -+# from ampex219w, added <cnorm>=\E[?3l, irresistibly suggested by <cvvis>, -+# and moved the padding to be *after* the caps -- esr) -+ampex219|ampex-219|amp219|Ampex with Automargins, -+ hs, xenl, -+ cols#80, it#8, lines#24, -+ bel=^G, blink=\E[5m$<2>, bold=\E[1m$<2>, cbt=\E[Z, -+ clear=\E[H\E[2J$<50>, cnorm=\E[?3l, cr=^M, -+ csr=%i\E[%p1%2d;%p2%2dr, cub1=^H, cud1=\E[B, -+ cuf1=\E[C$<2>, cup=\E[%i%p1%d;%p2%dH$<5>, -+ cuu1=\E[A$<2>, cvvis=\E[?3h, dim=\E[1m, ed=\E[J$<50>, -+ el=\E[K$<3>, home=\E[H, ht=^I, ind=^J, -+ is2=\E>\E[?1l\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, -+ kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kf0=\E[21~, -+ kf1=\E[7~, kf2=\E[8~, kf3=\E[9~, kf4=\E[10~, kf5=\E[11~, -+ kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, khome=\E[H, -+ rev=\E[7m, ri=\EM$<5>, rmam=\E[?7l, rmkx=\E>, -+ rmso=\E[m$<2>, rmul=\E[m$<2>, sgr0=\E[m$<2>, smam=\E[?7h, -+ smkx=\E=, smso=\E[7m$<2>, smul=\E[4m$<2>, -+ampex219w|ampex-219w|amp219w|Ampex 132 cols, -+ cols#132, lines#24, -+ bel=^G, cr=^M, cud1=^J, ind=^J, -+ is2=\E>\E[?3h\E[?4l\E[?5l\E[?7h\E[?8h, use=ampex219, -+# (ampex232: removed <if=/usr/share/tabset/ampex>, no file and no <hts> --esr) -+ampex232|ampex-232|Ampex Model 232, -+ am, -+ cols#80, lines#24, xmc#1, -+ cbt=\EI, civis=\E.0, clear=\E+, cnorm=\E.4, cub1=^H, cud1=^V, -+ cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, -+ dch1=\EW, dl1=\ER$<5*/>, ed=\EY, el=\ET, -+ flash=\Eb$<200/>\Ed, ht=^I, ich1=\EQ, il1=\EE$<5*/>, -+ invis@, is2=\Eg\El, kbs=^H, kcub1=^H, kcud1=^V, kcuf1=^L, -+ kcuu1=^K, kf0=^A@\r, kf1=^AA\r, kf2=^AB\r, kf3=^AC\r, -+ kf4=^AD\r, kf5=^AE\r, kf6=^AF\r, kf7=^AG\r, kf8=^AH\r, -+ kf9=^AI\r, khome=^^, use=adm+sgr, -+# (ampex: removed <if=/usr/share/tabset/amp-132>, no file and no <hts> -- esr) -+ampex232w|Ampex Model 232 / 132 columns, -+ cols#132, lines#24, -+ is2=\E\034Eg\El, use=ampex232, -+ -+#### Ann Arbor (aa) - # --# P9 terminal in P8 emulation mode and 132 column mode. -+# Ann Arbor made dream terminals for hackers -- large screen sizes and huge -+# numbers of function keys. At least some used monitors in portrait mode, -+# allowing up to 76-character screen heights! They were reachable at: - # --prism9-8-w|p9-8-w|P9-8-W|MDC Prism-9 in Prism 8 emulation and 132 column mode, -- dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, -- ich=\E[%p1%d@, ich1=\E[@, il=\E[%p1%dL, il1=\E[L, use=p8-w, -- --# p12: Prism-12 in ANSI mode --# --------------------------- -+# Ann Arbor Terminals -+# 6175 Jackson Road -+# Ann Arbor, MI 48103 -+# (313)-663-8000 - # --# See p9 definition. -+# But in 1996 the phone number reaches some kitschy retail shop, and Ann Arbor -+# can't be found on the Web; I fear they're long dead. R.I.P. - # --prism12|p12|P12|MDC Prism-12 in ANSI mode, -- use=p9, - --# p12-w: Prism-12 in 132 column mode --# ---------------------------------- -+ -+# Originally from Mike O'Brien@Rand and Howard Katseff at Bell Labs. -+# Highly modified 6/22 by Mike O'Brien. -+# split out into several for the various screen sizes by dave-yost@rand -+# Modifications made 3/82 by Mark Horton -+# Modified by Tom Quarles at UCB for greater efficiency and more diversity -+# status line moved to top of screen, <flash> removed 5/82 -+# Some unknown person at SCO then hacked the init strings to make them more -+# efficient. - # --# 'Wide' version of p12. -+# assumes the following setup: -+# A menu: 0000 1010 0001 0000 -+# B menu: 9600 0100 1000 0000 0000 1000 0000 17 19 -+# C menu: 56 66 0 0 9600 0110 1100 -+# D menu: 0110 1001 1 0 - # --prism12-w|p12-w|P12-W|MDC Prism-12 in 132 column mode, -- use=p9-w, -- --# p12-m: Prism-12 in MDC emulation mode --# ------------------------------------- -+# Briefly, the settings are for the following modes: -+# (values are for bit set/clear with * indicating our preference -+# and the value used to test these termcaps) -+# Note that many of these settings are irrelevent to the terminfo -+# and are just set to the default mode of the terminal as shipped -+# by the factory. - # --# P12 terminal in MDC emulation mode. --# Similar to p8 definition. --# Insertion and deletion operations possible. -+# A menu: 0000 1010 0001 0000 -+# Block/underline cursor* -+# blinking/nonblinking cursor* -+# key click/no key click* -+# bell/no bell at column 72* - # --prism12-m|p12-m|P12-M|MDC Prism-12 in MDC emulation mode, -- use=p9-8, -- --# p12-m-w: Prism-12 in MDC emulation and 132 column modes --# ------------------------------------------------------- -+# key pad is cursor control*/key pad is numeric -+# return and line feed/return for <cr> key * -+# repeat after .5 sec*/no repeat -+# repeat at 25/15 chars per sec. * - # --# P12 terminal in MDC emulation mode and 132 column mode. -+# hold data until pause pressed/process data unless pause pressed* -+# slow scroll/no slow scroll* -+# Hold in area/don't hold in area* -+# functions keys have default*/function keys disabled on powerup - # --prism12-m-w|p12-m-w|P12-M-W|MDC Prism-12 in MDC emulation and 132 column mode, -- use=p9-8-w, -- --# p14: Prism-14 in ANSII mode --# --------------------------- -+# show/don't show position of cursor during page transmit* -+# unused -+# unused -+# unused - # --# See p9 definition. -+# B menu: 9600 0100 1000 0000 0000 1000 0000 17 19 -+# Baud rate (9600*) - # --prism14|p14|P14|MDC Prism-14 in ANSII mode, -- use=p9, -- --# p14-w: Prism-14 in 132 column mode --# ---------------------------------- -+# 2 bits of parity - 00=odd,01=even*,10=space,11=mark -+# 1 stop bit*/2 stop bits -+# parity error detection off*/on - # --# 'Wide' version of p14. -+# keyboard local/on line* -+# half/full duplex* -+# disable/do not disable keyboard after data transmission* - # --prism14-w|p14-w|P14-W|MDC Prism-14 in 132 column mode, -- use=p9-w, -- --# p14-m: Prism-14 in MDC emulation mode --# ------------------------------------- -+# transmit entire page/stop transmission at cursor* -+# transfer/do not transfer protected characters* -+# transmit all characters/transmit only selected characters* -+# transmit all selected areas/transmit only 1 selected area* - # --# P14 terminal in MDC emulation mode. --# Similar to p8 definition. --# Insertion and deletion operations possible. -+# transmit/do not transmit line separators to host* -+# transmit/do not transmit page tab stops tabs to host* -+# transmit/do not transmit column tab stop tabs to host* -+# transmit/do not transmit graphics control (underline,inverse..)* - # --prism14-m|p14-m|P14-M|MDC Prism-14 in MDC emulation mode, -- use=p9-8, -- --# p14-m-w: Prism-14 in MDC emulation and 132 column modes --# ------------------------------------------------------- -+# enable*/disable auto XON/XOFF control -+# require/do not require receipt of a DC1 from host after each LF* -+# pause key acts as a meta key/pause key is pause* -+# unused - # --# P14 terminal in MDC emulation mode and 132 column mode. -+# unused -+# unused -+# unused -+# unused - # --prism14-m-w|p14-m-w|P14-M-W|MDC Prism-14 in MDC emulation and 132 column mode, -- use=p9-8-w, -- --# End of McDonnell Information Systems Prism definitions -- --# These things were popular in the Pick database community at one time --# From: George Land <georgeland@aol.com> 24 Sep 1996 --p8gl|prism8gl|McDonnell-Douglas Prism-8 alternate definition, -- am, bw, hs, mir, -- cols#80, lines#24, ma#1, wsl#78, xmc#1, -- bel=^G, blink=^CB, clear=^L, cr=^M, cub1=^U, cud1=^J, cuf1=^F, -- cup=\E[%i%p1%d;%p2%dH, cuu1=^Z, dch1=\s^H, dim=^CA, dl1=^P, -- ed=\EJ, el=\EK, home=^A, ind=^J, invis=^CH, kbs=^H, kcub1=^U, -- kcud1=^J, kcuf1=^F, kcuu1=^Z, kdch1=\s^H, kdl1=^P, ked=\EJ, -- kel=\EK, kf1=^A@\r, kf10=^AI\r, kf12=^AJ\r, kf13=^AK\r, -- kf14=^AL\r, kf15=^AM\r, kf16=^AN\r, kf17=^AO\r, kf2=^AA\r, -- kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, kf6=^AE\r, kf7=^AF\r, -- kf8=^AG\r, kf9=^AH\r, khome=^A, lf1=F1, lf10=F10, lf2=F2, -- lf3=F3, lf4=F4, lf5=F5, lf6=F6, lf7=F7, lf8=F8, lf9=F9, nel=^J^M, -- pad=\0, rev=^CD, rmso=^C\s, rmul=^C\s, sgr0=^C\s, smso=^CE, -- smul=^C0, -- --#### Microterm (act, mime) -+# XON character (17*) -+# XOFF character (19*) - # --# The mime1 entries refer to the Microterm Mime I or Mime II. --# The default mime is assumed to be in enhanced act iv mode. -+# C menu: 56 66 0 0 9600 0110 1100 -+# number of lines to print data on (printer) (56*) - # -- --# New "safe" cursor movement (5/87) from <reuss@umd5.umd.edu>. Prevents --# freakout with out-of-range args on Sytek multiplexors. No <smso=^N> and --# <rmso=^N> since it gets confused and it's too dim anyway. No <ich1> --# since Sytek insists ^S means xoff. --# (act4: found ":ic=2^S:ei=:im=:ip=.1*^V:" commented out in 8.3 -- esr) --act4|microterm|microterm act iv, -- OTbs, am, -- cols#80, lines#24, -- bel=^G, clear=\014$<12/>, cr=^M, cub1=^H, cud1=^K, cuf1=^X, -- cup=\024%p1%{24}%+%c%p2%p2%?%{47}%>%t%{48}%+%;%{80}%+%c, -- cuu1=^Z, dch1=\004$<.1*/>, dl1=\027$<2.3*/>, -- ed=\037$<2.2*/>, el=\036$<.1*/>, home=^], -- il1=\001<2.3*/>, ind=^J, kcub1=^H, kcud1=^K, kcuf1=^X, -- kcuu1=^Z, --# The padding on :sr: and :ta: for act5 and mime is a guess and not final. --# The act 5 has hardware tabs, but they are in columns 8, 16, 24, 32, 41 (!)... --# (microterm5: removed obsolete ":ma==^Z^P^Xl^Kj:" -- esr) --act5|microterm5|microterm act v, -- kcub1=^H, kcud1=^K, kcuf1=^X, kcuu1=^Z, ri=\EH$<3>, uc=^H\EA, -- use=act4, --# Mimes using brightness for standout. Half bright is really dim unless --# you turn up the brightness so far that lines show up on the screen. --mime-fb|full bright mime1, -- is2=^S\E, rmso=^S, smso=^Y, use=mime, --mime-hb|half bright mime1, -- is2=^Y\E, rmso=^Y, smso=^S, use=mime, --# (mime: removed obsolete ":ma=^X ^K^J^Z^P:"; removed ":do=^K:" that overrode --# the more plausible ":do=^J:" -- esr) --# uc was at one time disabled to get around a curses bug, be wary of it --mime|mime1|mime2|mimei|mimeii|microterm mime1, -- OTbs, am, -- cols#80, it#8, lines#24, vt#9, -- bel=^G, clear=^]^C, cr=^M, cub1=^H, cud1=^J, cuf1=^X, -- cup=\024%p1%{24}%+%c%p2%p2%?%{32}%>%t%{48}%+%;%{80}%+%c, -- cuu1=^Z, dl1=\027$<80>, ed=^_, el=^^, home=^], ht=\011$<2>, -- il1=\001$<80>, ind=^J, is2=^S\E^Q, kcub1=^H, kcud1=^K, -- kcuf1=^X, kcuu1=^Z, ri=\022$<3>, uc=^U, --# These termcaps (for mime2a) put the terminal in low intensity mode --# since high intensity mode is so obnoxious. --mime2a-s|microterm mime2a (emulating an enhanced soroc iq120), -- OTbs, am, -- cols#80, lines#24, -- bel=^G, clear=\EL, cr=^M, cub1=^H, cud1=^J, cuf1=^L, -- cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EI, dch1=\ED, -- dl1=\027$<20*>, ed=\EJ$<20*>, el=\EK, home=^^, -- il1=\001$<20*>, ind=^J, ip=$<2>, is2=\E), kcub1=^H, kcud1=^J, -- kcuf1=^L, kcuu1=^K, ri=\EI, rmir=^Z, rmso=\E;, rmul=\E7, -- smir=\EE, smso=\E\:, smul=\E6, --# This is the preferred mode (but ^X can't be used as a kill character) --mime2a|mime2a-v|microterm mime2a (emulating an enhanced vt52), -- OTbs, -- cols#80, it#8, lines#24, -- bel=^G, clear=\EL, cr=^M, cub1=^H, cud1=^J, cuf1=\EC, -- cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, dch1=^N, -- dl1=\027$<20*>, ed=\EQ$<20*>, el=\EP, home=\EH, ht=^I, -- il1=\001$<20*>, ind=^J, ip=$<2>, is2=^Y, kcub1=\ED, -- kcud1=\EB, kcuf1=\EC, kcuu1=\EA, ri=\EA, rmir=^Z, rmso=\E9, -- rmul=\E5, smir=^O, smso=\E8, smul=\E4, --# (mime3a: removed obsolete ":ma=^X ^K^J^Z^P:" -- esr) --mime3a|mime1 emulating 3a, -- am@, -- kcub1=^H, kcud1=^K, kcuf1=^X, kcuu1=^Z, use=adm3a, --mime3ax|mime-3ax|mime1 emulating enhanced 3a, -- it#8, -- dl1=\027$<80>, ed=^_, el=^X, ht=\011$<3>, il1=\001$<80>, -- use=mime3a, --# Wed Mar 9 18:53:21 1983 --# We run our terminals at 2400 baud, so there might be some timing problems at --# higher speeds. The major improvements in this model are the terminal now --# scrolls down and insert mode works without redrawing the rest of the line --# to the right of the cursor. This is done with a bit of a kludge using the --# exit graphics mode to get out of insert, but it does not appear to hurt --# anything when using vi at least. If you have some users using act4s with --# programs that use curses and graphics mode this could be a problem. --mime314|mm314|mime 314, -- am, -- cols#80, lines#24, -- clear=^L, cub1=^H, cuf1=^X, cup=\024%p1%c%p2%c, cuu1=^Z, -- dch1=^D, dl1=^W, ed=^_, el=^^, home=^], ht=^I, il1=^A, kcub1=^H, -- kcud1=^K, kcuf1=^X, kcuu1=^Z, rmir=^V, smir=^S, --# Microterm mime 340 from University of Wisconsin --mm340|mime340|mime 340, -- cols#80, lines#24, -- clear=\032$<12/>, cr=^M, cub1=^H, cud1=^J, cuf1=^L, -- cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, -- dch1=\E#$<2.1*/>, dl1=\EV$<49.6/>, ed=\037$<2*/>, -- el=\EL$<2.1/>, ht=^I, il1=\EU$<46/>, ind=^J, is2=\E\,, -- kbs=^H, kcub1=^H, kcud1=^J, kcuu1=^K, nel=^M^J, --# This came from University of Wisconsin marked "astro termcap for jooss". --# (mt4520-rv: removed obsolete ":kn#4:" and incorrect ":ri=\E[C:"; --# also added <rmam>/<smam> based on the init string -- esr) --mt4520-rv|micro-term 4520 reverse video, -- am, hs, msgr, xenl, xon, -- cols#80, it#8, lines#24, wsl#80, -- bel=^G, clear=\E[H\E[J, cnorm=\E[0V\E8, cr=^M, -- csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=\E[D, -- cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, cuf1=\E[C, -- cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, -- cvvis=\E7\E[0U, dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, -- dl1=\E[M, ed=\E[J, el=\E[K, flash=\E[?5l$<200/>\E[?5h, -- fsl=\E[?5l\E[?5h, home=\E[H, ht=^I, hts=\EH, ich=\E[%p1%d@, -- ich1=\E[@, il=\E[%p1%dL, il1=\E[L, ind=\ED, -- is2=\E(B\E[2l\E>\E[20l\E[?3l\E[?5h\E[?7h\E[1;24r\E[24;1H\E[H\E[J, -- kbs=^H, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, -- kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, khome=\E[H, -- ll=\E[24;1H, nel=\EE, rc=\E8, rf=/usr/share/tabset/vt100, -- ri=\EM, rmam=\E[?7l, rmso=\E[0m, rmul=\E[24m, -- rs1=\E(B\E[2l\E>\E[20l\E[?3l\E[?5h\E[?7h\E[H\E[J, -- sc=\E7, sgr0=\E[m, smam=\E[?7h, smso=\E[7m, smul=\E[4m, -- tbc=\E[g, tsl=\E[25;1H, -- --# Fri Aug 5 08:11:57 1983 --# This entry works for the ergo 4000 with the following setups: --# ansi,wraparound,newline disabled, xon/xoff disabled in both --# setup a & c. -+# number of lines on a sheet of paper (printer) (66*) - # --# WARNING!!! There are multiple versions of ERGO 4000 microcode --# Be advised that very early versions DO NOT WORK RIGHT !! --# Microterm does have a ROM exchange program- use it or lose big --# (ergo400: added <rmam>/<smam> based on the init string -- esr) --ergo4000|microterm ergo 4000, -- da, db, msgr, -- cols#80, lines#66, -- bel=^G, clear=\E[H\E[2J$<80>, cr=^M, cub1=^H, cud1=\E[B, -- cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, -- dch1=\E[1P$<80>, dl1=\E[1M$<5*>, ed=\E[0J$<15>, -- el=\E[0K$<13>, ht=^I, il1=\E[1L$<5*>, ind=\ED$<20*>, -- is2=\E<\E=\E[?1l\E[?4l\E[?5l\E[?7h\E[?8h$<300>, -- kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kf1=\EOP, -- kf2=\EOQ, kf3=\EOR, kf4=\EOS, lf1=pf1, lf2=pf2, lf3=pf3, -- lf4=pf4, ri=\EM$<20*>, rmam=\E[?7l, rmir=\E[4l, -- rmkx=\E=$<4>, rmso=\E[m$<20>, sgr0=\E[m$<20>, -- smam=\E[?7m, smir=\E[4h$<6>, smkx=\E=$<4>, -- smso=\E[7m$<20>, -- --#### NCR -+# left margin (printer) (0*) - # --# NCR's terminal group was merged with AT&T's when AT&T bought the company. --# For what happened to that group, see the ADDS section. -+# number of pad chars on new line to printer (0*) - # --# There is an NCR4103 terminal that's just a re-badged Wyse-50. -+# printer baud rate (9600*) - # -- --# The following vendor-supplied termcaps were captured from the Boundless --# Technologies site, 8 March 1998. I removed all-upper-case names that were --# identical, except for case, to lower-case ones. I also uncommented the acsc --# capabilities.X -+# printer parity: 00=odd,01=even*,10=space,11=mark -+# printer stop bits: 2*/1 -+# print/do not print guarded areas* - # --# The Intecolor emulation of the NCR 2900/260C color terminal is basically a --# DEC vt200/300 with color capabilities added. --ncr260intan|NCR Intecolor emulation of the 2900_260C with an ANSI keyboard, -- colors#8, pairs#64, -- op=\E[0m, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, -- use=ncr260vt300an, --# The Intecolor emulation of the NCR 2900/260C color terminal is basically a --# DEC vt200/300 with color capabilities added. --ncr260intwan|NCR Intecolor emulation of the 2900_260C with an ANSI keyboard, -- colors#8, pairs#64, -- op=\E[0m, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, -- use=ncr260vt300wan, --# The Intecolor emulation of the NCR 2900/260C color terminal is basically a --# DEC vt200/300 with color capabilities added. --ncr260intpp|NCR Intecolor emulation of the 2900_260C with a PC+ keyboard, -- colors#8, pairs#64, -- op=\E[0m, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, -- use=ncr260vt300pp, --# The Intecolor emulation of the NCR 2900/260C color terminal is basicly a --# DEC vt200/300 with color capabilities added. --ncr260intwpp|NCR Intecolor emulation of the 2900_260C with a PC+ keyboard in 132 column mode, -- colors#8, pairs#64, -- op=\E[0m, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, -- use=ncr260vt300wpp, --# This definition for ViewPoint supports several attributes. This means --# that it has magic cookies (extra spaces where the attributes begin). --# Some applications do not function well with magic cookies. The System --# Administrator's Shell in NCR Unix SVR4 1.03 is one such application. --# If supporting various attributes is not vital, 'xmc#1' and the extra --# attributes can be removed. --# Mapping to ASCII character set ('acsc' capability) can also be --# restored if needed. --ncr260vppp|NCR 2900_260 viewpoint, -- am, bw, hs, km, mc5i, mir, msgr, xon, -- cols#80, lines#24, nlab#32, xmc#1, -- acsc=07a?h;j5k3l2m1n8q\:t4u9v=w0x6, bel=^G, blink=\EG2, -- cbt=\EI, civis=\E`0, clear=\014$<40>, cnorm=\E`5, -- cr=\r$<2>, cub1=\010$<2>, cud1=\n$<2>, cuf1=\006$<2>, -- cup=\EY%p1%{32}%+%c%p2%{32}%+%c$<5>, cuu1=\032$<2>, -- dch1=\EW$<2>, dim=\EGp, dl1=\El$<2>, dsl=\E`c, ed=\Ek$<2>, -- el=\EK$<2>, fsl=^M, home=\036$<2>, ht=^I, hts=\E1, -- il1=\EM$<2>, ind=\n$<2>, invis=\EG1, -- is2=\Ee6\E~%$<100>\E+\E`\:\Ed/\E`1\EO\Ee4\Ec@0@\Ec@1A\EcB0\EcC1\Ee7$<100>, -- kDC=\El, kEND=\Ek, kHOM=^A, kPRT=\E7, kRIT=^F, ka1=^A, ka3=\EJ, -- kbs=^H, kc1=\ET, kc3=\EJ, kcub1=^U, kcud1=^J, kcuf1=^F, -- kcuu1=^Z, kdch1=\EW, kend=\EK, kf1=^B1\r, kf10=^B\:\r, -- kf11=^B;\r, kf12=^B<\r, kf13=^B=\r, kf14=^B>\r, kf15=^B?\r, -- kf16=^B@\r, kf17=^B!\r, kf18=^B"\r, kf19=^B#\r, kf2=^B2\r, -- kf20=^B$\r, kf21=\002%^M, kf22=^B&\r, kf23=^B'\r, -- kf24=^B(\r, kf25=^B)\r, kf26=^B*\r, kf27=^B+\r, -- kf28=^B\,\r, kf29=^B-\r, kf3=^B3\r, kf30=^B.\r, kf31=^B/\r, -- kf32=^B0\r, kf4=^B4\r, kf5=^B5\r, kf6=^B6\r, kf7=^B7\r, -- kf8=^B8\r, kf9=^B9\r, khome=^A, kich1=\Eq, knp=\EJ, kpp=\EJ, -- kprt=\EP, ll=\001$<5>, mc0=\EP$<100>, mc4=^T, mc5=^R, -- mrcup=\Ew@%p1%{48}%+%c%p2%{32}%+%c%p3%{32}%+%c$<5>, -- nel=\037$<2>, rev=\EG4, ri=\Ej$<2>, rmacs=\EcB0\EH\003, -- rmir=\Er, rmso=\EG0, rmul=\EG0, rmxon=\Ec20, -- rs2=\Ee6\E~%$<100>\E+\E`\:\Ed/\E`1\EO\Ee4\Ec@0@\Ec@1A\EcB0\EcC1\Ee7$<100>, -- sgr0=\EG0\EH\003, smacs=\EcB1\EH\002, smir=\Eq, -- smso=\EG4, smul=\EG8, smxon=\Ec21, tsl=\EF, --ncr260vpwpp|NCR 2900_260 viewpoint wide mode, -- cols#132, -- cup=\Ea%i%p1%dR%p2%dC$<30>, -- is2=\Ee6\E~%$<100>\E+\E`;\Ed/\E`1\EO\Ee4\Ec@0@\Ec@1A\EcB0\EcC1\Ee7$<100>, -- rs2=\Ee6\E~%$<100>\E+\E`;\Ed/\E`1\EO\Ee4\Ec@0@\Ec@1A\EcB0\EcC1\Ee7$<100>, -- use=ncr260vppp, --ncr260vt100an|NCR 2900_260 vt100 with ansi kybd, -- am, hs, mir, msgr, xenl, xon, -- cols#80, lines#24, nlab#32, -- acsc=``aaffggjjkkllmmnnooqqssttuuvvwwxx~~, bel=^G, -- blink=\E[5m, bold=\E[1m, civis=\E[?25l, -- clear=\E[2J\E[1;1H$<20>, cnorm=\E[?25h, cr=\r$<1>, -- csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD$<5>, -- cub1=\E[D$<5>, cud=\E[%p1%dB$<5>, cud1=\E[B$<5>, -- cuf=\E[%p1%dC$<5>, cuf1=\E[C$<5>, -- cup=\E[%i%p1%d;%p2%dH$<10>, cuu=\E[%p1%dA$<5>, -- cuu1=\E[A$<5>, dch=\E[%p1%dP$<5>, dch1=\E[1P$<5>, -- dl=\E[%p1%dM$<5>, dl1=\E[M$<5>, dsl=\E[0$~\E[1$~, -- ech=\E[%p1%dX, ed=\E[0J$<5>, el=\E[0K$<3>, el1=\E[1K$<3>, -- fsl=\E[0$}, home=\E[H$<1>, hpa=\E[%p1%dG$<40>, ht=^I, -- hts=\EH, ich=\E[%p1%d@$<5>, il=\E[%p1%dL$<5>, -- il1=\E[L$<5>, ind=\ED$<5>, indn=\E[%p1%dE$<5>, -- invis=\E[8m, -- is2=\E[!p\E[?7;19;67h\E[?1;3;4l\E(B\E)0\017\E[2J\E[1;1H\E>$<200>, -- kbs=^H, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, -- kdch1=\E[3~, kfnd=\E[1~, khlp=\E[28~, kich1=\E[2~, -- knp=\E[6~, kpp=\E[5~, krdo=\E[29~, kslt=\E[4~, nel=\EE$<5>, -- rc=\E8, rev=\E[7m, ri=\EM$<5>, rmacs=^O, rmir=\E[4l, -- rmkx=\E[?1l\E>, rmso=\E[0m, rmul=\E[0m, -- rs2=\E[!p\E[?7;19;67h\E[?1;3;4l\E(B\E)0\017\E[2J\E[1;1H\E>$<200>, -- sc=\E7, -- sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;$<20>, -- sgr0=\E[0m\017$<20>, smacs=^N, smir=\E[4h, -- smkx=\E[?1h\E=, smso=\E[1;7m, smul=\E[4m, tbc=\E[3g, -- tsl=\E[2$~\E[1$}, vpa=\E[%p1%dd$<40>, use=vt220+keypad, --ncr260vt100wan|NCR 2900_260 vt100 wide mode ansi kybd, -- cols#132, -- cup=\E[%i%p1%d;%p2%dH$<30>, -- is2=\E[!p\E[?3;7;19;67h\E[?1;4l\E(B\E)0\017\E[2J\E[1;1H\E>$<200>, -- rs2=\E[!p\E[?3;7;19;67h\E[?1;4l\E(B\E)0\017\E[2J\E[1;1H\E>$<200>, -- use=ncr260vt100an, --ncr260vt100pp|NCR 2900_260 vt100 with PC+ kybd, -- is2=\E[!p\E[?7;19;67h\E[?1;3;4l\E(B\E)0\017\E[2J\E[1;1H\E>$<200>, -- ka1=\E[H, ka3=\EOu, kb2=\E[V, kc3=\E[U, kcub1=\E[D, -- kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[4~, -- kend=\E[5~, khome=\E[2~, kich1=\E[1~, knp=\E[6~, kpp=\E[3~, -- lf1=pf1, lf2=pf2, lf3=pf3, lf4=pf4, rmkx=\E>, -- rs2=\E[!p\E[?7;19;67h\E[?1;3;4l\E(B\E)0\017\E[2J\E[1;1H\E>$<200>, -- smkx=\E=, use=ncr260vt100an, --ncr260vt100wpp|NCR 2900_260 vt100 wide mode pc+ kybd, -- cols#132, -- cup=\E[%i%p1%d;%p2%dH$<30>, -- is2=\E[!p\E[?3;7;19;67h\E[?1;4l\E(B\E)0\017\E[2J\E[1;1H\E>$<200>, -- rs2=\E[!p\E[?3;7;19;67h\E[?1;4l\E(B\E)0\017\E[2J\E[1;1H\E>$<200>, -- use=ncr260vt100pp, --ncr260vt200an|NCR 2900_260 vt200 with ansi kybd, -- am, hs, mir, msgr, xenl, xon, -- cols#80, lines#24, nlab#32, -- acsc=``aaffggjjkkllmmnnooqqssttuuvvwwxx~~, bel=^G, -- blink=\E[5m, bold=\E[1m, civis=\E[?25l, -- clear=\E[2J\E[1;1H$<20>, cnorm=\E[?25h, cr=\r$<1>, -- csr=\E[%i%p1%d;%p2%dr$<5>, cub=\E[%p1%dD$<5>, -- cub1=\E[D$<5>, cud=\E[%p1%dB$<5>, cud1=\E[B$<5>, -- cuf=\E[%p1%dC$<5>, cuf1=\E[C$<5>, -- cup=\E[%i%p1%d;%p2%dH$<10>, cuu=\E[%p1%dA$<5>, -- cuu1=\E[A$<5>, dch=\E[%p1%dP$<5>, dch1=\E[1P$<5>, -- dl=\E[%p1%dM$<5>, dl1=\E[M$<5>, dsl=\E[0$~\E[1$~, -- ech=\E[%p1%dX$<5>, ed=\E[0J, el=\E[0K$<5>, el1=\E[1K$<5>, -- fsl=\E[0$}, home=\E[H, hpa=\E[%p1%dG$<40>, ht=^I, hts=\EH, -- ich=\E[%p1%d@$<5>, il=\E[%p1%dL$<5>, il1=\E[L$<5>, -- ind=\ED$<5>, indn=\E[%p1%dE$<5>, invis=\E[8m, -- is2=\E[!p\E[?7;19;67h\E[?1;3;4l\E(B\E)0\017\E[2J\E[1;1H\E>$<200>, -- kbs=^H, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, -- kdch1=\E[3~, kf0=\EOy, kf10=\E[21~, kf11=\E[23~, -- kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, kf15=\E[28~, -- kf16=\E[29~, kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, -- kf2=\EOQ, kf20=\E[34~, kf21=\E[31~, kf22=\E[32~, -- kf23=\E[33~, kf24=\E[34~, kf25=\E[35~, kf26=\E[1~, -- kf27=\E[2~, kf28=\E[3~, kf29=\E[4~, kf3=\EOR, kf30=\E[5~, -- kf31=\E[6~, kf32=\E[7~, kf33=\E[8~, kf34=\E[9~, -- kf35=\E[10~, kf4=\EOS, kf5=\E[M, kf6=\E[17~, kf7=\E[18~, -- kf8=\E[19~, kf9=\E[20~, kfnd=\E[1~, khlp=\E[28~, -- kich1=\E[2~, knp=\E[6~, kpp=\E[5~, krdo=\E[29~, kslt=\E[4~, -- mc0=\E[i, mc4=\E[4i, mc5=\E[5i, nel=\EE, rc=\E8, rev=\E[7m, -- ri=\EM$<5>, rmacs=\017$<20>, rmam=\E[?7l, rmir=\E[4l, -- rmkx=\E[?1l\E>, rmso=\E[27m, rmul=\E[24m, -- rs2=\E[!p\E[?7;19;67h\E[?1;3;4l\E(B\E)0\017\E[2J\E[1;1H\E>$<200>, -- sc=\E7, -- sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;$<20>, -- sgr0=\E[0m\017$<20>, smacs=\016$<20>, smam=\E[?7h, -- smir=\E[4h, smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, -- tbc=\E[3g, tsl=\E[2$~\E[1$}, vpa=\E[%p1%dd$<40>, -- use=vt220+keypad, --ncr260vt200wan|NCR 2900_260 vt200 wide mode ansi kybd, -- cols#132, -- cup=\E[%i%p1%d;%p2%dH$<30>, -- is2=\E[!p\E[?3;7;19;67h\E[?4l\E(B\E)0\017\E[2J\E[1;1H$<200>, -- rs2=\E[!p\E[?3;7;19;67h\E[?4l\E(B\E)0\017\E[2J\E[1;1H$<200>, -- use=ncr260vt200an, --ncr260vt200pp|NCR 2900_260 vt200 with pc+ kybd, -- ka1=\E[H, ka3=\EOu, kb2=\E[V, kc3=\E[U, kcub1=\E[D, -- kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[4~, -- kend=\E[1~, khome=\E[H, kich1=\E[2~, knp=\E[6~, kpp=\E[5~, -- lf1=pf1, lf2=pf2, lf3=pf3, lf4=pf4, rmkx=\E>, smkx=\E=, -- use=ncr260vt200an, --ncr260vt200wpp|NCR 2900_260 vt200 wide mode pc+ kybd, -- cols#132, -- cup=\E[%i%p1%d;%p2%dH$<30>, -- is2=\E[!p\E[?3;7;19;67h\E[?1;4l\E(B\E)0\017\E[2J\E[1;1H\E>$<200>, -- rs2=\E[!p\E[?3;7;19;67h\E[?1;4l\E(B\E)0\017\E[2J\E[1;1H\E>$<200>, -- use=ncr260vt200pp, --ncr260vt300an|NCR 2900_260 vt300 with ansi kybd, -- am, hs, mir, msgr, xenl, xon, -- cols#80, lines#24, nlab#32, -- acsc=``aaffggjjkkllmmnnooqqssttuuvvwwxx~~, bel=^G, -- blink=\E[5m, bold=\E[1m, civis=\E[?25l, -- clear=\E[2J\E[1;1H$<20>, cnorm=\E[?25h, cr=\r$<1>, -- csr=\E[%i%p1%d;%p2%dr$<5>, cub=\E[%p1%dD$<5>, -- cub1=\E[D$<5>, cud=\E[%p1%dB$<5>, cud1=\E[B$<5>, -- cuf=\E[%p1%dC$<5>, cuf1=\E[C$<5>, -- cup=\E[%i%p1%d;%p2%dH$<10>, cuu=\E[%p1%dA$<5>, -- cuu1=\E[A$<5>, dch=\E[%p1%dP$<5>, dch1=\E[1P$<5>, -- dl=\E[%p1%dM$<5>, dl1=\E[M$<5>, dsl=\E[0$~\E[1$~, -- ech=\E[%p1%dX$<5>, ed=\E[0J, el=\E[0K$<5>, el1=\E[1K$<5>, -- fsl=\E[0$}, home=\E[H, hpa=\E[%p1%dG$<40>, ht=^I, hts=\EH, -- ich=\E[%p1%d@$<5>, il=\E[%p1%dL$<5>, il1=\E[L$<5>, -- ind=\ED$<5>, indn=\E[%p1%dE$<5>, invis=\E[8m, -- is2=\E[!p\E[?7;19;67h\E[?1;3;4l\E[1;0%w\E(B\E)0\017\E[2J\E[1;1H\E>$<200>, -- kbs=^H, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, -- kdch1=\E[3~, kf0=\EOy, kf10=\E[21~, kf11=\E[23~, -- kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, kf15=\E[28~, -- kf16=\E[29~, kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, -- kf20=\E[34~, kf21=\E[31~, kf22=\E[32~, kf23=\E[33~, -- kf24=\E[34~, kf25=\E[35~, kf26=\E[1~, kf27=\E[2~, -- kf28=\E[3~, kf29=\E[4~, kf30=\E[5~, kf31=\E[6~, kf32=\E[7~, -- kf33=\E[8~, kf34=\E[9~, kf35=\E[10~, kf5=\E[M, kf6=\E[17~, -- kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, kfnd=\E[1~, -- khlp=\E[28~, kich1=\E[2~, knp=\E[6~, kpp=\E[5~, -- krdo=\E[29~, kslt=\E[4~, mc0=\E[i, mc4=\E[4i, mc5=\E[5i, -- nel=\EE, rc=\E8, rev=\E[7m, ri=\EM$<5>, rmacs=\017$<20>, -- rmam=\E[?7l, rmir=\E[4l, rmkx=\E[?1l\E>, rmso=\E[27m, -- rmul=\E[24m, -- rs2=\E[!p\E[?7;19;67h\E[?1;3;4l\E[1;0%w\E(B\E)0\017\E[2J\E[1;1H\E>$<200>, -- sc=\E7, -- sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;$<20>, -- sgr0=\E[0m\017$<20>, smacs=\016$<20>, smam=\E[?7h, -- smir=\E[4h, smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, -- tbc=\E[3g, tsl=\E[2$~\E[1$}, vpa=\E[%p1%dd$<40>, -- use=vt220+keypad, --ncr260vt300wan|NCR 2900_260 vt300 wide mode ansi kybd, -- cols#132, -- cup=\E[%i%p1%d;%p2%dH$<30>, -- is2=\E[!p\E[?3;7;19;67h\E[?4l\E[1;0%w\E(B\E)0\017\E[2J\E[1;1H$<200>, -- rs2=\E[!p\E[?3;7;19;67h\E[?4l\E[1;0%w\E(B\E)0\017\E[2J\E[1;1H$<200>, -- use=ncr260vt300an, --ncr260vt300pp|NCR 2900_260 vt300 with pc+ kybd, -- ka1=\E[H, ka3=\EOu, kb2=\E[V, kc3=\E[U, kcub1=\E[D, -- kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[4~, -- kend=\E[1~, khome=\E[H, kich1=\E[2~, knp=\E[6~, kpp=\E[5~, -- lf1=pf1, lf2=pf2, lf3=pf3, lf4=pf4, rmkx=\E>, smkx=\E=, -- use=ncr260vt300an, --NCR260VT300WPP|ncr260vt300wpp|NCR 2900_260 vt300 wide mode pc+ kybd, -- cols#132, -- cup=\E[%i%p1%d;%p2%dH$<30>, -- is2=\E[!p\E[?3;7;19;67h\E[?1;4l\E[1;0%w\E(B\E)0\017\E[2J\E[1;1H\E>$<200>, -- rs2=\E[!p\E[?3;7;19;67h\E[?1;4l\E[1;0%w\E(B\E)0\017\E[2J\E[1;1H\E>$<200>, -- use=ncr260vt300pp, --# This terminfo file contains color capabilities for the Wyse325 emulation of --# the NCR 2900/260C color terminal. Because of the structure of the command --# (escape sequence) used to set color attributes, one of the fore/background --# colors must be preset to a given value. I have set the background color to --# black. The user can change this setup by altering the last section of the --# 'setf' definition. The escape sequence to set color attributes is --# ESC d y <foreground_color> <background_color> 1 --# In addition, the background color can be changed through the desk accessories. --# The capablitiy 'op' sets colors to green on black (default combination). -+# new line is: 01=LF,10=CR,11=CRLF* -+# unused -+# unused - # --# NOTE: The NCR Unix System Administrator's Shell will not function properly --# if the 'pairs' capability is defined. Un-Comment the 'pairs' --# capability and recompile if you wish to have it included. -+# D menu: 0110 1001 1 0 -+# LF is newline/LF is down one line, same column* -+# wrap to preceding line if move left from col 1*/don't wrap -+# wrap to next line if move right from col 80*/don't wrap -+# backspace is/is not destructive* - # --ncr260wy325pp|NCR 2900_260 wyse 325, -- am, bw, hs, km, mc5i, mir, msgr, xon, -- colors#16, cols#80, lines#24, ncv#33, nlab#32, -- acsc=07a?h;j5k3l2m1n8q\:t4u9v=w0x6, bel=^G, blink=\EG2, -- cbt=\EI, civis=\E`0, clear=\E*$<10>, cnorm=\E`1, cr=^M, -- cub1=\010$<5>, cud1=\n$<5>, cuf1=\014$<5>, -- cup=\E=%p1%{32}%+%c%p2%{32}%+%c$<10>, cuu1=\013$<5>, -- cvvis=\E`5, dch1=\EW$<50>, dl1=\ER$<5>, dsl=\E`c, -- ed=\Ey$<5>, el=\Et$<5>, fsl=^M, home=\036$<5>, ht=^I, -- hts=\E1, il1=\EE$<5>, ind=\n$<5>, invis=\EG1, -- is2=\Ee6\Ed/\Ee1\Ed*\Er\EO\E`1\E`\:\E`@\E~!\E"\Ee4\Ex@\E`9\Ee7$<100>, -- kDC=\ER, kEND=\EY, kHOM=\E{, kNXT=\EK, kPRT=\E7, kPRV=\EJ, -- kRIT=^L, ka1=^^, kb2=\EJ, kbs=^H, kc1=\ET, kc3=\EK, kcbt=\EI, -- kcub1=^H, kcud1=^J, kcuf1=^L, kcuu1=^K, kdch1=\EW, kend=\ET, -- kf1=^A@\r, kf10=^AI\r, kf11=^AJ\r, kf12=^AK\r, kf13=^AL\r, -- kf14=^AM\r, kf15=^AN\r, kf16=^AO\r, kf17=^A`\r, kf18=^Aa\r, -- kf19=^Ab\r, kf2=^AA\r, kf20=^Ac\r, kf21=^Ad\r, kf22=^Ae\r, -- kf23=^Af\r, kf24=^Ag\r, kf25=^Ah\r, kf26=^Ai\r, kf27=^Aj\r, -- kf28=^Ak\r, kf29=^Al\r, kf3=^AB\r, kf30=^Am\r, kf31=^An\r, -- kf32=^Ao\r, kf4=^AC\r, kf5=^AD\r, kf6=^AE\r, kf7=^AF\r, -- kf8=^AG\r, kf9=^AH\r, khome=^^, kich1=\Eq, knp=\EK, kpp=\EJ, -- kprt=\EP, mc0=\EP, mc4=^T, mc5=^R, -- mrcup=\Ew@%p1%{48}%+%c%p2%{32}%+%c%p3%{32}%+%c$<10>, -- nel=\037$<5>, rev=\EG4, ri=\Ej$<5>, rmacs=\EH\003\EcB0, -- rmam=\Ed., rmir=\Er, rmso=\EG0, rmul=\EG0, rmxon=\Ec20, -- rs2=\Ee6\Ed/\Ee1\Ed*\Er\EO\E`1\E`\:\E`@\E~!\E"\Ee4\Ex@\E`9\Ee7$<100>, -- setb=\s, -- setf=%?%p1%{0}%=%t%{49}%e%p1%{1}%=%t%{50}%e%p1%{2}%=%t%{51}%e%p1%{3}%=%t%{52}%e%p1%{4}%=%t%{53}%e%p1%{5}%=%t%{54}%e%p1%{6}%=%t%{55}%e%p1%{7}%=%t%{64}%e%p1%{8}%=%t%{57}%e%p1%{9}%=%t%{58}%e%p1%{10}%=%t%{59}%e%p1%{11}%=%t%{60}%e%p1%{12}%=%t%{61}%e%p1%{13}%=%t%{62}%e%p1%{14}%=%t%{63}%e%p1%{15}%=%t%{56}%;\Edy%c11$<100>, -- sgr0=\EG0\EcB0\EcD$<15>, smacs=\EH\002\EcB1, smam=\Ed/, -- smir=\Eq, smso=\EGt, smul=\EG8, smxon=\Ec21, tbc=\E0, -- tsl=\EF, --ncr260wy325wpp|NCR 2900_260 wyse 325 wide mode, -- cols#132, -- cup=\Ea%i%p1%dR%p2%dC$<30>, -- is2=\Ee6\Ed/\Ee1\Ed*\Er\EO\E`1\E`;\E`@\E~!\E"\Ee4\Ex@\E`9\Ee7$<100>, -- rs2=\Ee6\Ed/\Ee1\Ed*\Er\EO\E`1\E`;\E`@\E~!\E"\Ee4\Ex@\E`9\Ee7$<100>, -- use=ncr260wy325pp, --# This definition for Wyse 350 supports several attributes. This means --# that it has magic cookies (extra spaces where the attributes begin). --# Some applications do not function well with magic cookies. The System --# Administrator's Shell in NCR Unix SVR4 1.03 is one such application. --# If supporting various attributes is not vital, 'xmc#1' and the extra --# attributes can be removed. --# Mapping to ASCII character set ('acsc' capability) can also be --# restored if needed. --# In addition, color capabilities have been added to this file. The drawback, --# however, is that the background color has to be black. The foreground colors --# are numbered 0 through 15. -+# display*/ignore DEL character -+# display will not/will scroll* -+# page/column tab stops* -+# erase everything*/erase unprotected only - # --# NOTE: The NCR Unix System Administrator's Shell does not function properly --# with the 'pairs' capability defined as below. If you wish to --# have it included, Un-comment it and recompile (using 'tic'). -+# editing extent: 0=display,1=line*,2=field,3=area - # --ncr260wy350pp|NCR 2900_260 wyse 350, -- am, bw, hs, km, mc5i, mir, msgr, xon, -- colors#16, cols#80, lines#24, ncv#33, nlab#32, pairs#16, xmc#1, -- acsc=07a?h;j5k3l2m1n8q\:t4u9v=w0x6, bel=^G, blink=\EG2, -- cbt=\EI, civis=\E`0, clear=\E+$<20>, cnorm=\E`1, cr=^M, -- cub1=\010$<5>, cud1=\n$<5>, cuf1=\014$<5>, -- cup=\E=%p1%{32}%+%c%p2%{32}%+%c$<40>, cuu1=\013$<5>, -- cvvis=\E`5, dch1=\EW$<50>, dim=\EGp, dl1=\ER$<5>, dsl=\E`c, -- ed=\Ey$<5>, el=\Et$<5>, fsl=^M, home=\036$<10>, ht=^I, -- hts=\E1, il1=\EE$<5>, ind=\n$<5>, invis=\EG1, -- is2=\Ee6\Ed/\Ee1\Ed*\Er\EO\E`1\E`\:\E`@\E~!\E"\Ee4\Ex@\E`9\Ee7$<100>, -- kDC=\ER, kEND=\EY, kHOM=\E{, kPRT=\E7, kRIT=^L, ka1=^^, kbs=^H, -- kc1=\ET, kc3=\EK, kcbt=\EI, kcub1=^H, kcud1=^J, kcuf1=^L, -- kcuu1=^K, kdch1=\EW, kend=\ET, kf1=^A@\r, kf10=^AI\r, -- kf11=^AJ\r, kf12=^AK\r, kf13=^AL\r, kf14=^AM\r, kf15=^AN\r, -- kf16=^AO\r, kf17=^A`\r, kf18=^Aa\r, kf19=^Ab\r, kf2=^AA\r, -- kf20=^Ac\r, kf21=^Ad\r, kf22=^Ae\r, kf23=^Af\r, kf24=^Ag\r, -- kf25=^Ah\r, kf26=^Ai\r, kf27=^Aj\r, kf28=^Ak\r, kf29=^Al\r, -- kf3=^AB\r, kf30=^Am\r, kf31=^An\r, kf32=^Ao\r, kf4=^AC\r, -- kf5=^AD\r, kf6=^AE\r, kf7=^AF\r, kf8=^AG\r, kf9=^AH\r, -- khome=^^, kich1=\Eq, knp=\EK, kpp=\EJ, kprt=\EP, -- mc0=\EP$<10>, mc4=^T, mc5=^R, -- mrcup=\Ew@%p1%{48}%+%c%p2%{32}%+%c%p3%{32}%+%c$<20>, -- nel=\037$<5>, rev=\EG4, ri=\Ej$<5>, rmacs=\EH\003\EcB0, -- rmam=\Ed., rmir=\Er, rmso=\EG0, rmul=\EG0, rmxon=\Ec20, -- rs2=\Ee6\Ed/\Ee1\Ed*\Er\EO\E`1\E`\:\E`@\E~!\E"\Ee4\Ex@\E`9\Ee7$<100>, -- setb=\s, -- setf=%?%p1%{0}%=%t%{49}%e%p1%{1}%=%t%{50}%e%p1%{2}%=%t%{51}%e%p1%{3}%=%t%{52}%e%p1%{4}%=%t%{53}%e%p1%{5}%=%t%{54}%e%p1%{6}%=%t%{55}%e%p1%{7}%=%t%{102}%e%p1%{8}%=%t%{97}%e%p1%{9}%=%t%{98}%e%p1%{10}%=%t%{99}%e%p1%{11}%=%t%{101}%e%p1%{12}%=%t%{106}%e%p1%{13}%=%t%{110}%e%p1%{14}%=%t%{111}%e%p1%{15}%=%t%{56}%;\Em0%c$<100>, -- sgr0=\EG0\EH\003\EcD, smacs=\EH\002\EcB1, smam=\Ed/, -- smir=\Eq, smso=\EGt, smul=\EG8, smxon=\Ec21, tbc=\E0, -- tsl=\EF, --ncr260wy350wpp|NCR 2900_260 wyse 350 wide mode, -- cols#132, -- cup=\Ea%i%p1%dR%p2%dC$<30>, -- is2=\Ee6\Ed/\Ee1\Ed*\Er\EO\E`1\E`;\E`@\E~!\E"\Ee4\Ex@\E`9\Ee7$<200>, -- rs2=\Ee6\Ed/\Ee1\Ed*\Er\EO\E`1\E`;\E`@\E~!\E"\Ee4\Ex@\E`9\Ee7$<200>, -- use=ncr260wy350pp, --# This definition for Wyse 50+ supports several attributes. This means --# that it has magic cookies (extra spaces where the attributes begin). --# Some applications do not function well with magic cookies. The System --# Administrator's Shell in NCR Unix SVR4 1.03 is one such application. --# If supporting various attributes is not vital, 'xmc#1' and the extra --# attributes can be removed. --# Mapping to ASCII character set ('acsc' capability) can also be --# restored if needed. --# (ncr260wy50+pp: originally contained commented-out --# <acsc=j5k3l2m1n8q:t4u9v=w0x6>, as well as the commented-out one there -- esr) --ncr260wy50+pp|NCR 2900_260 wyse 50+, -- am, bw, hs, km, mc5i, mir, msgr, xon, -- cols#80, lines#24, nlab#32, xmc#1, -- acsc=0wa_h[jukslrmqnxqzttuyv]wpxv, bel=^G, blink=\EG2, -- cbt=\EI$<5>, civis=\E`0, clear=\E+$<20>, cnorm=\E`1, cr=^M, -- cub1=\010$<5>, cud1=\n$<5>, cuf1=\014$<5>, -- cup=\E=%p1%{32}%+%c%p2%{32}%+%c$<30>, cuu1=\013$<5>, -- cvvis=\E`5, dch1=\EW$<50>, dim=\EGp, dl1=\ER$<5>, dsl=\E`c, -- ed=\EY$<5>, el=\ET$<5>, fsl=^M, home=\036$<10>, -- ht=\011$<5>, hts=\E1$<5>, il1=\EE$<5>, ind=\n$<5>, -- invis=\EG1, -- is2=\Ee6\E~"$<100>\E+\Ed/\Ee1\Ed*\Er\EO\E`1\E`\:\E`@\E~!\E"\Ee4\Ex@\E`9\Ee7$<100>, -- kDC=\ER, kEND=\EY, kHOM=\E{, kPRT=\E7, kRIT=^L, ka1=^^, kbs=^H, -- kc1=\ET, kc3=\EK, kcbt=\EI, kcub1=^H, kcud1=^J, kcuf1=^L, -- kcuu1=^K, kdch1=\EW, kend=\ET, kf1=^A@\r, kf10=^AI\r, -- kf11=^AJ\r, kf12=^AK\r, kf13=^AL\r, kf14=^AM\r, kf15=^AN\r, -- kf16=^AO\r, kf17=^A`\r, kf18=^Aa\r, kf19=^Ab\r, kf2=^AA\r, -- kf20=^Ac\r, kf21=^Ad\r, kf22=^Ae\r, kf23=^Af\r, kf24=^Ag\r, -- kf25=^Ah\r, kf26=^Ai\r, kf27=^Aj\r, kf28=^Ak\r, kf29=^Al\r, -- kf3=^AB\r, kf30=^Am\r, kf31=^An\r, kf32=^Ao\r, kf4=^AC\r, -- kf5=^AD\r, kf6=^AE\r, kf7=^AF\r, kf8=^AG\r, kf9=^AH\r, -- khome=^^, kich1=\Eq, knp=\EK, kpp=\EJ, kprt=\EP, -- mc0=\EP$<10>, mc4=^T, mc5=^R, -- mrcup=\Ew@%p1%{48}%+%c%p2%{32}%+%c%p3%{32}%+%c$<10>, -- nel=\037$<5>, rev=\EG4, ri=\Ej$<5>, rmacs=\EH^C, rmam=\Ed., -- rmir=\Er, rmso=\EG0, rmul=\EG0, rmxon=\Ec20, -- rs2=\Ee6\E~"$<100>\E+\Ed/\Ee1\Ed*\Er\EO\E`1\E`\:\E`@\E~!\E"\Ee4\Ex@\E`9\Ee7$<100>, -- sgr0=\EG0\EH\003$<15>, smacs=\EH^B, smam=\Ed/, smir=\Eq, -- smso=\EGt, smul=\EG8, smxon=\Ec21, tbc=\E0$<5>, tsl=\EF, --ncr260wy50+wpp|NCR 2900_260 wyse 50+ wide mode, -- cols#132, -- cup=\Ea%i%p1%dR%p2%dC$<30>, -- is2=\Ee6\E~"$<100>\E+\Ed/\Ee1\Ed*\Er\EO\E`1\E`;\E`@\E~!\E"\Ee4\Ex@\E`9\Ee7$<200>, -- rs2=\Ee6\E~"$<100>\E+\Ed/\Ee1\Ed*\Er\EO\E`1\E`;\E`@\E~!\E"\Ee4\Ex@\E`9\Ee7$<200>, -- use=ncr260wy50+pp, --ncr260wy60pp|NCR 2900_260 wyse 60, -- am, bw, hs, km, mc5i, mir, msgr, xon, -- cols#80, lines#24, nlab#32, -- acsc=07a?h;j5k3l2m1n8q\:t4u9v=w0x6, bel=^G, blink=\EG2, -- cbt=\EI$<15>, civis=\E`0, clear=\E*$<100>, cnorm=\E`1, -- cr=^M, cub1=\010$<5>, cud1=\n$<5>, cuf1=\014$<5>, -- cup=\E=%p1%{32}%+%c%p2%{32}%+%c$<10>, cuu1=\013$<5>, -- cvvis=\E`5, dch1=\EW$<50>, dl1=\ER$<5>, dsl=\E`c, -- ed=\Ey$<5>, el=\Et$<5>, fsl=^M, home=\036$<25>, -- ht=\011$<15>, hts=\E1$<15>, il1=\EE$<5>, ind=\n$<5>, -- invis=\EG1, -- is2=\Ee6\E~4$<100>\E+\Ed/\Ee1\Ed*\Er\EO\E`1\E`\:\E`@\E~!\E"\Ee4\Ex@\E`9\Ee7$<100>, -- kDC=\ER, kEND=\EY, kHOM=\E{, kNXT=\EK, kPRT=\E7, kPRV=\EJ, -- kRIT=^L, ka1=^^, kb2=\EJ, kbs=^H, kc1=\ET, kc3=\EK, -- kcbt=\EI$<15>, kcub1=^H, kcud1=^J, kcuf1=^L, kcuu1=^K, -- kdch1=\EW, kend=\ET, kf1=^A@\r, kf10=^AI\r, kf11=^AJ\r, -- kf12=^AK\r, kf13=^AL\r, kf14=^AM\r, kf15=^AN\r, kf16=^AO\r, -- kf17=^A`\r, kf18=^Aa\r, kf19=^Ab\r, kf2=^AA\r, kf20=^Ac\r, -- kf21=^Ad\r, kf22=^Ae\r, kf23=^Af\r, kf24=^Ag\r, kf25=^Ah\r, -- kf26=^Ai\r, kf27=^Aj\r, kf28=^Ak\r, kf29=^Al\r, kf3=^AB\r, -- kf30=^Am\r, kf31=^An\r, kf32=^Ao\r, kf4=^AC\r, kf5=^AD\r, -- kf6=^AE\r, kf7=^AF\r, kf8=^AG\r, kf9=^AH\r, khome=^^, -- kich1=\Eq, knp=\EK, kpp=\EJ, kprt=\EP, mc0=\EP, mc4=^T, mc5=^R, -- mrcup=\Ew@%p1%{48}%+%c%p2%{32}%+%c%p3%{32}%+%c$<30>, -- nel=\037$<5>, rev=\EG4, ri=\Ej$<5>, rmacs=\EH^C, rmam=\Ed., -- rmir=\Er, rmso=\EG0, rmul=\EG0, rmxon=\Ec20, -- rs2=\Ee6\E~4$<100>\E+\Ed/\Ee1\Ed*\Er\EO\E`1\E`\:\E`@\E~!\E"\Ee4\Ex@\E`9\Ee7$<100>, -- sgr0=\EG0\EcB0\EcD$<15>, smacs=\EH^B, smam=\Ed/, -- smir=\Eq, smso=\EGt, smul=\EG8, smxon=\Ec21, tbc=\E0$<15>, -- tsl=\EF, --ncr260wy60wpp|NCR 2900_260 wyse 60 wide mode, -- cols#132, -- cup=\Ea%i%p1%dR%p2%dC$<30>, -- is2=\Ee6\E~4$<100>\E+\Ed/\Ee1\Ed*\Er\EO\E`1\E`;\E`@\E~!\E"\Ee4\Ex@\E`9\Ee7$<100>, -- rs2=\Ee6\E~4$<100>\E+\Ed/\Ee1\Ed*\Er\EO\E`1\E`;\E`@\E~!\E"\Ee4\Ex@\E`9\Ee7$<100>, -- use=ncr260wy60pp, --ncr160vppp|NCR 2900_160 viewpoint, -- use=ncr260vppp, --ncr160vpwpp|NCR 2900_160 viewpoint wide mode, -- use=ncr260vpwpp, --ncr160vt100an|NCR 2900_160 vt100 with ansi kybd, -- use=ncr260vt100an, --ncr160vt100pp|NCR 2900_160 vt100 with PC+ kybd, -- use=ncr260vt100pp, --ncr160vt100wan|NCR 2900_160 vt100 wide mode ansi kybd, -- use=ncr260vt100wan, --ncr160vt100wpp|NCR 2900_160 vt100 wide mode pc+ kybd, -- use=ncr260vt100wpp, --ncr160vt200an|NCR 2900_160 vt200 with ansi kybd, -- use=ncr260vt200an, --ncr160vt200pp|NCR 2900_160 vt200 with pc+ kybd, -- use=ncr260vt200pp, --ncr160vt200wan|NCR 2900_160 vt200 wide mode ansi kybd, -- use=ncr260vt200wan, --ncr160vt200wpp|NCR 2900_160 vt200 wide mode pc+ kybd, -- use=ncr260vt200wpp, --ncr160vt300an|NCR 2900_160 vt300 with ansi kybd, -- use=ncr260vt300an, --ncr160vt300pp|NCR 2900_160 vt300 with pc+ kybd, -- use=ncr260vt300pp, --ncr160vt300wan|NCR 2900_160 vt300 wide mode ansi kybd, -- use=ncr260vt300wan, --ncr160vt300wpp|NCR 2900_160 vt300 wide mode pc+ kybd, -- use=ncr260vt300wpp, --ncr160wy50+pp|NCR 2900_160 wyse 50+, -- use=ncr260wy50+pp, --ncr160wy50+wpp|NCR 2900_160 wyse 50+ wide mode, -- use=ncr260wy50+wpp, --ncr160wy60pp|NCR 2900_160 wyse 60, -- use=ncr260wy60pp, --ncr160wy60wpp|NCR 2900_160 wyse 60 wide mode, -- use=ncr260wy60wpp, --ncrvt100an|ncrvt100pp|NCR vt100 for the 2900 terminal, -- am, hs, mc5i, mir, msgr, xon, -- cols#80, it#8, lines#24, nlab#32, -- acsc=``aaffgghhiijjkkllmmnnqqttuuvvwwxxyyzz~~, -- bel=^G, blink=\E[5m$<30>, bold=\E[1m$<30>, -- clear=\E[2J\E[1;1H$<300>, cr=^M, -- csr=\E[%i%p1%d;%p2%dr$<100>, cub=\E[%p1%dD$<30>, -- cub1=\E[D$<2>, cud=\E[%p1%dB$<30>, cud1=\E[B$<2>, -- cuf=\E[%p1%dC$<30>, cuf1=\E[C$<2>, -- cup=\E[%i%p1%d;%p2%dH$<100>, cuu=\E[%p1%dA$<30>, -- cuu1=\E[A$<2>, dch=\E[%p1%dP$<40>, dch1=\E[1P$<10>, -- dl=\E[%p1%dM$<70>, dl1=\E[M$<40>, dsl=\E[31l$<25>, -- ed=\E[0J$<300>, el=\E[0K$<30>, el1=\E[1K$<30>, -- enacs=\E(B\E)0$<40>, fsl=1$<10>, home=\E[H$<2>$<80>, -- ht=^I, hts=\EH, il=\E[%p1%dL$<80>, il1=\E[B\E[L$<80>, -- ind=\ED, -- is2=\E[12h\E[?10l\E%/0n\E[P\031\E[?3l\E(B\E)0$<200>, -- kLFT=\E[D, kRIT=\E[C, ka1=\E[H, kbs=^H, kcub1=\E[D, -- kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kent=^M, kf1=\EOP, -- kf2=\EOQ, kf3=\EOR, kf4=\EOS, mc0=\E[i$<100>, nel=\EE, -- rc=\E8, rev=\E[7m$<30>, ri=\EM$<50>, rmacs=\017$<90>, -- rmir=\E[4l$<80>, rmso=\E[0m$<30>, rmul=\E[0m$<30>, -- rs2=\Ec\E[12;31h\E[?3;4;5;10l\E[?6;7;19;25h\E[33;34l\E[0m\E(B\E)0\E%/0n\E[P\031$<200>, -- sc=\E7, -- sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;$<100>, -- sgr0=\017\E[0m$<120>, smacs=\016$<90>, smir=\E[4h$<80>, -- smso=\E[7m$<30>, smul=\E[4m$<30>, tbc=\E[3g$<40>, -- tsl=\E[>+1$<70>, --ncrvt100wan|NCRVT100WPP|ncrvt100wpp|NCR VT100 emulation of the 2900 terminal, -- cols#132, -- is2=\E[12h\E[?10l\E%/0n\E[P\031\E[?3h\E(B\E)0$<200>, -- rs2=\Ec\E[12;31h\E[?4;5;10l\E?3;6;7;19;25h\E[33;34l\E[0m\E(B\E)0\E%/0n\E[P\031$<200>, -- use=ncrvt100an, -+# unused - # --# Vendor-supplied NCR termcaps end here - --# NCR7900 DIP switches: --# --# Switch A: --# 1-4 - Baud Rate --# 5 - Parity (Odd/Even) --# 6 - Don't Send or Do Send Spaces --# 7 - Parity Enable --# 8 - Stop Bits (One/Two) --# --# Switch B: --# 1 - Upper/Lower Shift --# 2 - Typewriter Shift --# 3 - Half Duplex / Full Duplex --# 4 - Light/Dark Background --# 5-6 - Carriage Return Without / With Line Feed --# 7 - Extended Mode --# 8 - Suppress Keyboard Display --# --# Switch C: --# 1 - End of line entry disabled/enabled --# 2 - Conversational mode / (Local?) Mode --# 3 - Control characters displayed / not displayed --# 4 - (2-wire?) / 4-wire communications --# 5 - RTS on and off for each character --# 6 - (50Hz?) / 60 Hz --# 7 - Exit after level zero diagnostics --# 8 - RS-232 interface --# --# Switch D: --# 1 - Reverse Channel (yes / no) --# 2 - Manual answer (no / yes) --# 3-4 - Cursor appearance --# 5 - Communication Rate --# 6 - Enable / Disable EXT turnoff --# 7 - Enable / Disable CR turnoff --# 8 - Enable / Disable backspace --# --# Since each attribute parameter is 0 or 1, we shift each attribute (standout, --# reverse, blink, dim, and underline) the appropriate number of bits (by --# multiplying the 0 or 1 by a correct factor to shift) so the bias character, --# '@' is (effectively) "or"ed with each attribute to generate the proper third --# character in the <ESC>0 sequence. The <sgr> string implements the following --# equation: -+annarbor4080|aa4080|ann arbor 4080, -+ OTbs, am, -+ cols#80, lines#40, -+ bel=^G, clear=\014$<2>, cr=^M, cub1=^H, cud1=^J, cuf1=^_, -+ cup=\017%p2%{10}%/%{16}%*%p2%{10}%m%+%c%p1%?%p1%{19}%>%t%{12}%+%;%{64}%+%c, -+ cuu1=^N, home=^K, ht=^I, hts=^]^P1, ind=^J, kbs=^^, kcub1=^H, -+ kcud1=^J, kcuf1=^_, kcuu1=^N, khome=^K, tbc=^\^P^P, -+ -+# Strange Ann Arbor terminal from BRL -+aas1901|Ann Arbor K4080 w/S1901 mod, -+ am, -+ cols#80, lines#40, -+ bel=^G, clear=^L, cr=^M, cub1=^H, cud1=^J, cuf1=^_, cuu1=^N, -+ home=^K, ht=^I, ind=^J, kbs=^H, kcub1=^H, kcud1=^J, ll=^O\0c, -+ nel=^M^J, -+ -+# If you're using the GNU termcap library, add -+# :cS=\E[%p1%d;%p2%d;%p3%d;%p4%dp: -+# to these capabilities. This is the nonstandard GNU termcap scrolling -+# capability, arguments are: -+# 1. Total number of lines on the screen. -+# 2. Number of lines above desired scroll region. -+# 3. Number of lines below (outside of) desired scroll region. -+# 4. Total number of lines on the screen, the same as the first parameter. -+# The generic Ann Arbor entry is the only one that uses this. -+aaa+unk|aaa-unk|ann arbor ambassador (internal - don't use this directly), -+ OTbs, am, km, mc5i, mir, xon, -+ cols#80, it#8, -+ bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, -+ clear=\E[H\E[J$<156>, cr=^M, cub=\E[%p1%dD, cub1=^H, -+ cud=\E[%p1%dB, cud1=^K, cuf=\E[%p1%dC, cuf1=\E[C, -+ cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, -+ dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, -+ el=\E[K$<5>, home=\E[H, hpa=\E[%p1%{1}%+%dG, ht=^I, -+ hts=\EH, ich=\E[%p1%d@$<4*>, ich1=\E[@$<4>, il=\E[%p1%dL, -+ il1=\E[L$<3>, ind=^K, invis=\E[8m, is1=\E[m\E7\E[H\E9\E8, -+ is3=\E[1Q\E[>20;30l\EP`+x~M\E\\, kbs=^H, kcbt=\E[Z, -+ kclr=\E[J, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, -+ kdch1=\E[P, kdl1=\E[M, kf1=\EOA, kf10=\EOJ, kf11=\EOK, -+ kf12=\EOL, kf13=\EOM, kf14=\EON, kf15=\EOO, kf16=\EOP, -+ kf17=\EOQ, kf18=\EOR, kf19=\EOS, kf2=\EOB, kf20=\EOT, -+ kf21=\EOU, kf22=\EOV, kf23=\EOW, kf24=\EOX, kf3=\EOC, -+ kf4=\EOD, kf5=\EOE, kf6=\EOF, kf7=\EOG, kf8=\EOH, kf9=\EOI, -+ khome=\E[H, kich1=\E[@, kil1=\E[L, krmir=\E6, mc0=\E[0i, -+ mc4=^C, mc5=\E[v, mc5p=\E[%p1%dv, rc=\E8, -+ rep=%p1%c\E[%p2%{1}%-%db, rev=\E[7m, -+ rmkx=\EP`>y~[[J`8xy~[[A`4xy~[[D`6xy~[[C`2xy~[[B\E\\, -+ rmm=\E[>52l, rmso=\E[m, rmul=\E[m, sc=\E7, -+ sgr=\E[%?%p1%t7;%;%?%p2%t4;%;%?%p3%t7;%;%?%p4%t5;%;%?%p6%t1;%;%?%p7%t8;%;m, -+ sgr0=\E[m, -+ smkx=\EP`>z~[[J`8xz~[[A`4xz~[[D`6xz~[[C`2xz~[[B\E\\, -+ smm=\E[>52h, smso=\E[7m, smul=\E[4m, tbc=\E[3g, -+ vpa=\E[%p1%{1}%+%dd, -+ -+aaa+rv|ann arbor ambassador in reverse video, -+ blink=\E[5;7m, bold=\E[1;7m, invis=\E[7;8m, -+ is1=\E[7m\E7\E[H\E9\E8, rev=\E[m, rmso=\E[7m, rmul=\E[7m, -+ rs1=\E[H\E[7m\E[J$<156>, -+ sgr=\E[%?%p2%t4;%;%?%p4%t5;%;%?%p6%t1;%;%?%p1%p2%|%p3%!%t7;%;%?%p7%t8;%;m\016, -+ sgr0=\E[7m\016, smso=\E[m, smul=\E[4;7m, -+# Ambassador with the DEC option, for partial vt100 compatibility. -+aaa+dec|ann arbor ambassador in dec vt100 mode, -+ acsc=aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}, -+ csr=\E[%i%p1%d;%p2%dr, enacs=\E(0, rmacs=^N, -+ sgr=\E[%?%p2%t4;%;%?%p4%t5;%;%?%p6%t1;%;%?%p1%p3%|%!%t7;%;%?%p7%t8;%;m%?%p9%t\017%e\016%;, -+ smacs=^O, -+aaa-18|ann arbor ambassador/18 lines, -+ lines#18, -+ is2=\E7\E[60;0;0;18p\E8, -+ rmcup=\E[60;0;0;18p\E[60;1H\E[K, smcup=\E[18;0;0;18p, -+ use=aaa+unk, -+aaa-18-rv|ann arbor ambassador/18 lines+reverse video, -+ use=aaa+rv, use=aaa-18, -+aaa-20|ann arbor ambassador/20 lines, -+ lines#20, -+ is2=\E7\E[60;0;0;20p\E8, -+ rmcup=\E[60;0;0;20p\E[60;1H\E[K, smcup=\E[20;0;0;20p, -+ use=aaa+unk, -+aaa-22|ann arbor ambassador/22 lines, -+ lines#22, -+ is2=\E7\E[60;0;0;22p\E8, -+ rmcup=\E[60;0;0;22p\E[60;1H\E[K, smcup=\E[22;0;0;22p, -+ use=aaa+unk, -+aaa-24|ann arbor ambassador/24 lines, -+ lines#24, -+ is2=\E7\E[60;0;0;24p\E8, -+ rmcup=\E[60;0;0;24p\E[60;1H\E[K, smcup=\E[24;0;0;24p, -+ use=aaa+unk, -+aaa-24-rv|ann arbor ambassador/24 lines+reverse video, -+ use=aaa+rv, use=aaa-24, -+aaa-26|ann arbor ambassador/26 lines, -+ lines#26, -+ is2=\E7\E[60;0;0;26p\E8, -+ rmcup=\E[60;0;0;26p\E[26;1H\E[K, -+ smcup=\E[H\E[J$<156>\E[26;0;0;26p, use=aaa+unk, -+aaa-28|ann arbor ambassador/28 lines, -+ lines#28, -+ is2=\E7\E[60;0;0;28p\E8, -+ rmcup=\E[60;0;0;28p\E[28;1H\E[K, -+ smcup=\E[H\E[J$<156>\E[28;0;0;28p, use=aaa+unk, -+aaa-30-s|aaa-s|ann arbor ambassador/30 lines w/status, -+ eslok, hs, -+ lines#29, -+ dsl=\E7\E[60;0;0;30p\E[1;1H\E[K\E[H\E8\r\n\E[K, -+ fsl=\E[>51l, is2=\r\n\E[A\E7\E[60;1;0;30p\E8, -+ rmcup=\E[60;1;0;30p\E[29;1H\E[K, -+ smcup=\E[H\E[J$<156>\E[30;1;0;30p\E[30;1H\E[K, -+ tsl=\E[>51h\E[1;%p1%dH\E[2K, use=aaa+unk, -+aaa-30-s-rv|aaa-s-rv|ann arbor ambassador/30 lines+status+reverse video, -+ use=aaa+rv, use=aaa-30-s, -+aaa-s-ctxt|aaa-30-s-ctxt|ann arbor ambassador/30 lines+status+save context, -+ rmcup=\E[60;1;0;30p\E[59;1H\E[K, -+ smcup=\E[30;1H\E[K\E[30;1;0;30p, use=aaa-30-s, -+aaa-s-rv-ctxt|aaa-30-s-rv-ct|ann arbor ambassador/30 lines+status+save context+reverse video, -+ rmcup=\E[60;1;0;30p\E[59;1H\E[K, -+ smcup=\E[30;1H\E[K\E[30;1;0;30p, use=aaa-30-s-rv, -+aaa|aaa-30|ambas|ambassador|ann arbor ambassador/30 lines, -+ lines#30, -+ is2=\E7\E[60;0;0;30p\E8, -+ rmcup=\E[60;0;0;30p\E[30;1H\E[K, -+ smcup=\E[H\E[J$<156>\E[30;0;0;30p, use=aaa+unk, -+aaa-30-rv|aaa-rv|ann arbor ambassador/30 lines in reverse video, -+ use=aaa+rv, use=aaa-30, -+aaa-30-ctxt|aaa-ctxt|ann arbor ambassador/30 lines; saving context, -+ rmcup=\E[60;0;0;30p\E[60;1H\E[K, smcup=\E[30;0;0;30p, -+ use=aaa-30, -+aaa-30-rv-ctxt|aaa-rv-ctxt|ann arbor ambassador/30 lines reverse video; saving context, -+ rmcup=\E[60;0;0;30p\E[60;1H\E[K, smcup=\E[30;0;0;30p, -+ use=aaa+rv, use=aaa-30, -+aaa-36|ann arbor ambassador/36 lines, -+ lines#36, -+ is2=\E7\E[60;0;0;36p\E8, -+ rmcup=\E[60;0;0;36p\E[36;1H\E[K, -+ smcup=\E[H\E[J$<156>\E[36;0;0;36p, use=aaa+unk, -+aaa-36-rv|ann arbor ambassador/36 lines+reverse video, -+ use=aaa+rv, use=aaa-36, -+aaa-40|ann arbor ambassador/40 lines, -+ lines#40, -+ is2=\E7\E[60;0;0;40p\E8, -+ rmcup=\E[60;0;0;40p\E[40;1H\E[K, -+ smcup=\E[H\E[J$<156>\E[40;0;0;40p, use=aaa+unk, -+aaa-40-rv|ann arbor ambassador/40 lines+reverse video, -+ use=aaa+rv, use=aaa-40, -+aaa-48|ann arbor ambassador/48 lines, -+ lines#48, -+ is2=\E7\E[60;0;0;48p\E8, -+ rmcup=\E[60;0;0;48p\E[48;1H\E[K, -+ smcup=\E[H\E[J$<156>\E[48;0;0;48p, use=aaa+unk, -+aaa-48-rv|ann arbor ambassador/48 lines+reverse video, -+ use=aaa+rv, use=aaa-48, -+aaa-60-s|ann arbor ambassador/59 lines+status, -+ eslok, hs, -+ lines#59, -+ dsl=\E7\E[60;0;0;60p\E[1;1H\E[K\E[H\E8\r\n\E[K, -+ fsl=\E[>51l, is2=\r\n\E[A\E7\E[60;1;0;60p\E8, -+ tsl=\E[>51h\E[1;%p1%dH\E[2K, use=aaa+unk, -+aaa-60-s-rv|ann arbor ambassador/59 lines+status+reverse video, -+ use=aaa+rv, use=aaa-60-s, -+aaa-60-dec-rv|ann arbor ambassador/dec mode+59 lines+status+rev video, -+ use=aaa+dec, use=aaa+rv, use=aaa-60-s, -+aaa-60|ann arbor ambassador/60 lines, -+ lines#60, -+ is2=\E7\E[60;0;0;60p\E[1Q\E[m\E[>20;30l\E8, -+ use=aaa+unk, -+aaa-60-rv|ann arbor ambassador/60 lines+reverse video, -+ use=aaa+rv, use=aaa-60, -+aaa-db|ann arbor ambassador 30/destructive backspace, -+ OTbs@, -+ cub1=\E[D, is3=\E[1Q\E[m\E[>20l\E[>30h, use=aaa-30, -+ -+guru|guru-33|guru+unk|ann arbor guru/33 lines 80 cols, -+ lines#33, -+ flash=\E[>59h$<100>\E[>59l, -+ is2=\E7\E[255;0;0;33;80;80p\E8\E[J, is3=\E[>59l, -+ rmcup=\E[255p\E[255;1H\E[K, smcup=\E[33p, use=aaa+unk, -+guru+rv|guru changes for reverse video, -+ flash=\E[>59l$<100>\E[>59h, is3=\E[>59h, -+guru-rv|guru-33-rv|ann arbor guru/33 lines+reverse video, -+ use=guru+rv, use=guru-33, -+guru+s|guru status line, -+ eslok, hs, -+ dsl=\E7\E[;0p\E[1;1H\E[K\E[H\E8\r\n\E[K, fsl=\E[>51l, -+ rmcup=\E[255;1p\E[255;1H\E[K, smcup=, -+ tsl=\E[>51h\E[1;%p1%dH\E[2K, -+guru-nctxt|guru with no saved context, -+ smcup=\E[H\E[J$<156>\E[33p\E[255;1H\E[K, use=guru, -+guru-s|guru-33-s|ann arbor guru/33 lines+status, -+ lines#32, -+ is2=\r\n\E[A\E7\E[255;1;0;33;80;80p\E8\E[J, -+ smcup=\E[33;1p\E[255;1H\E[K, use=guru+s, use=guru+unk, -+guru-24|ann arbor guru 24 lines, -+ cols#80, lines#24, -+ is2=\E7\E[255;0;0;24;80;80p\E8\E[J, smcup=\E[24p, -+ use=guru+unk, -+guru-44|ann arbor guru 44 lines, -+ cols#97, lines#44, -+ is2=\E7\E[255;0;0;44;97;100p\E8\E[J, smcup=\E[44p, -+ use=guru+unk, -+guru-44-s|ann arbor guru/44 lines+status, -+ lines#43, -+ is2=\r\n\E[A\E7\E[255;1;0;44;80;80p\E8\E[J, -+ smcup=\E[44;1p\E[255;1H\E[K, use=guru+s, use=guru+unk, -+guru-76|guru with 76 lines by 89 cols, -+ cols#89, lines#76, -+ is2=\E7\E[255;0;0;76;89;100p\E8\E[J, smcup=\E[76p, -+ use=guru+unk, -+guru-76-s|ann arbor guru/76 lines+status, -+ cols#89, lines#75, -+ is2=\r\n\E[A\E7\E[255;1;0;76;89;100p\E8\E[J, -+ smcup=\E[76;1p\E[255;1H\E[K, use=guru+s, use=guru+unk, -+guru-76-lp|guru-lp|guru with page bigger than line printer, -+ cols#134, lines#76, -+ is2=\E7\E[255;0;0;76;134;134p\E8\E[J, smcup=\E[76p, -+ use=guru+unk, -+guru-76-w|guru 76 lines by 178 cols, -+ cols#178, lines#76, -+ is2=\E7\E[255;0;0;76;178;178p\E8\E[J, smcup=\E[76p, -+ use=guru+unk, -+guru-76-w-s|ann arbor guru/76 lines+status+wide, -+ cols#178, lines#75, -+ is2=\r\n\E[A\E7\E[255;1;0;76;178;178p\E8\E[J, -+ smcup=\E[76;1p\E[255;1H\E[K, use=guru+s, use=guru+unk, -+guru-76-wm|guru 76 lines by 178 cols with 255 cols memory, -+ cols#178, lines#76, -+ is2=\E7\E[255;0;0;76;178;255p\E8\E[J, smcup=\E[76p, -+ use=guru+unk, -+aaa-rv-unk|ann arbor unknown type, -+ lh#0, lw#0, nlab#0, -+ blink=\E[5;7m, bold=\E[1;7m, home=\E[H, invis=\E[7;8m, -+ is1=\E[7m\E7\E[H\E9\E8, rev=\E[m, rmso=\E[7m, rmul=\E[7m, -+ rs1=\E[H\E[7m\E[J, -+ sgr=\E[%?%p6%t1;%;%?%p2%t4;%;%?%p3%t7;%;%?%p4%t5;%;%?%p1%!%t7;%;%?%p7%t8;%;m, -+ sgr0=\E[7m, smso=\E[m, smul=\E[4;7m, -+ -+#### Applied Digital Data Systems (adds) -+# -+# ADDS itself is long gone. ADDS was bought by NCR, and the same group made -+# ADDS and NCR terminals. When AT&T and NCR merged, the engineering for -+# terminals was merged again. Then AT&T sold the terminal business to -+# SunRiver, which later changed its name to Boundless Technologies. The -+# engineers from Teletype, AT&T terminals, ADDS, and NCR (who are still there -+# as of early 1995) are at: -+# -+# Boundless Technologies -+# 100 Marcus Boulevard -+# Hauppauge, NY 11788-3762 -+# Vox: (800)-231-5445 -+# Fax: (516)-342-7378 -+# Web: http://boundless.com -+# -+# Their voice mail used to describe the place as "SunRiver (formerly ADDS)". -+# In 1995 Boundless acquired DEC's terminals business. -+# -+ -+# Regent: lowest common denominator, works on all regents. -+# (regent: renamed ":bc:" to ":le:" -- esr) -+regent|Adds Regent Series, -+ OTbs, am, -+ cols#80, lines#24, -+ bel=^G, clear=^L, cr=^M, cub1=^U, cud1=^J, cuf1=^F, cuu1=^Z, -+ home=\EY\s\s, ind=^J, ll=^A, -+# Regent 100 has a bug where if computer sends escape when user is holding -+# down shift key it gets confused, so we avoid escape. -+regent100|Adds Regent 100, -+ xmc#1, -+ bel=^G, -+ cup=\013%p1%' '%+%c\020%p2%{10}%/%{16}%*%p2%{10}%m%+%c, -+ kf0=^B1\r, kf1=^B2\r, kf2=^B3\r, kf3=^B4\r, kf4=^B5\r, -+ kf5=^B6\r, kf6=^B7\r, kf7=^B8\r, lf0=F1, lf1=F2, lf2=F3, -+ lf3=F4, lf4=F5, lf5=F6, lf6=F7, lf7=F8, rmso=\E0@, rmul=\E0@, -+ sgr0=\E0@, smso=\E0P, smul=\E0`, use=regent, -+regent20|Adds Regent 20, -+ bel=^G, cup=\EY%p1%{32}%+%c%p2%{32}%+%c, ed=\Ek, el=\EK, -+ use=regent, -+regent25|Adds Regent 25, -+ bel=^G, kcub1=^U, kcud1=^J, kcuf1=^F, kcuu1=^Z, khome=^A, -+ use=regent20, -+regent40|Adds Regent 40, -+ xmc#1, -+ bel=^G, dl1=\El$<2*>, il1=\EM$<2*>, kf0=^B1\r, kf1=^B2\r, -+ kf2=^B3\r, kf3=^B4\r, kf4=^B5\r, kf5=^B6\r, kf6=^B7\r, -+ kf7=^B8\r, lf0=F1, lf1=F2, lf2=F3, lf3=F4, lf4=F5, lf5=F6, -+ lf6=F7, lf7=F8, rmso=\E0@, rmul=\E0@, sgr0=\E0@, smso=\E0P, -+ smul=\E0`, use=regent25, -+regent40+|Adds Regent 40+, -+ is2=\EB, use=regent40, -+regent60|regent200|Adds Regent 60, -+ dch1=\EE, is2=\EV\EB, kdch1=\EE, kich1=\EF, krmir=\EF, -+ rmir=\EF, rmso=\ER\E0@\EV, smir=\EF, smso=\ER\E0P\EV, -+ use=regent40+, -+# From: <edward@onyx.berkeley.edu> Thu Jul 9 09:27:33 1981 -+# (viewpoint: added <kcuf1>, function key, and <dl1> capabilities -- esr) -+viewpoint|addsviewpoint|adds viewpoint, -+ OTbs, am, -+ cols#80, lines#24, -+ bel=^G, clear=^L, cnorm=\017\E0`, cr=^M, cub1=^H, cud1=^J, -+ cuf1=^F, cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=^Z, -+ cvvis=\017\E0P, dl1=\El, ed=\Ek$<16.1*>, el=\EK$<16>, -+ ind=^J, is2=\017\E0`, kcub1=^U, kcud1=^J, kcuf1=^F, kcuu1=^Z, -+ kf0=^B1, kf2=^B2, kf3=^B!, kf4=^B", kf5=^B#, khome=^A, ll=^A, -+ rmso=^O, rmul=^O, sgr0=^O, smso=^N, smul=^N, -+# Some viewpoints have bad ROMs that foo up on ^O -+screwpoint|adds viewpoint with ^O bug, -+ cvvis@, rmso@, rmul@, smso@, smul@, use=viewpoint, -+ -+# From: Jay S. Rouman <jsr@dexter.mi.org> 5 Jul 92 -+# The <civis>/<cnorm>/<sgr>/<sgr0> strings were added by ESR from specs. -+# Theory; the vp3a+ wants \E0%c to set highlights, where normal=01000000, -+# underline=01100000, rev=01010000, blink=01000010,dim=01000001, -+# invis=01000100 and %c is the logical or of desired attributes. -+# There is also a `tag bit' enabling attributes, set by \E) and unset by \E(. -+# -+# Update by TD - 2004: -+# Adapted from -+# http://www.cs.utk.edu/~shuford/terminal/adds_viewpoint_news.txt -+# -+# COMMANDS ASCII CODE -+# -+# Address, Absolute ESC,=,row,column -+# Beep BEL -+# Aux Port Enable ESC,@ -+# Aux Port Disable ESC,A -+# Backspace BS -+# Cursor back BS -+# Cursor down LF -+# Cursor forward FF -+# Cursor home RS -+# Cursor up VT -+# Cursor supress ETB -+# Cursor enable CAN -+# Erase to end of line ESC,T -+# Erase to end of page ESC,Y -+# Erase screen SUB -+# Keyboard lock SI -+# Keyboard unlock SO -+# Read current cursor position ESC,? -+# Set Attribute ESC,0,x (see below for values of x) -+# Tag bit reset ESC,( -+# Tag bit set ESC,) -+# Transparent Print on ESC,3 -+# Transparent Print off ESC,4 -+# -+# -+# ATTRIBUTES -+# -+# Normal @ 0100 -+# Half Intensity A 0101 -+# Blinking B 0102 -+# Half Intensity Blinking C 0103 -+# Reverse Video P 0120 -+# Reverse Video Half Intensity Q 0121 -+# Reverse Video Blinking R 0122 -+# Reverse Video Half Intensity -+# Blinking S 0123 -+# Underlined ` 0140 -+# Underlined Half Intensity a 0141 -+# Underlined Blinking b 0142 -+# Underlined Half Intensity -+# Blinking c 0143 -+# Video suppress D 0104 -+vp3a+|viewpoint3a+|adds viewpoint 3a+, -+ am, bw, -+ cols#80, it#8, lines#24, -+ blink=\E0B\E), civis=^W, clear=\E*$<80>, cnorm=^X, cr=^M, -+ cub1=^H, cud1=^J, cuf1=^L, -+ cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dim=\E0A\E), -+ ed=\EY$<80>, el=\ET, home=^^, ht=^I, ind=^J, invis=\E0D\E), -+ kbs=^H, kcub1=^H, kcud1=^J, kcuf1=^L, kcuu1=^K, khome=^^, -+ nel=^M^J, rev=\E0P\E), rmso=\E(, -+ sgr=%?%p1%p2%|%p3%|%p4%|%p5%|%p7%|%t\E0%{64}%?%p1%t%{17}%|%;%?%p2%t%{32}%|%;%?%p3%t%{16}%|%;%?%p4%t%{2}%|%;%?%p5%t%{1}%|%;%c%?%p7%tD%;\E)%e\E(%;, -+ sgr0=\E(, smso=\E0Q\E), smul=\E0`\E), -+vp60|viewpoint60|addsvp60|adds viewpoint60, -+ use=regent40, -+# -+# adds viewpoint 90 - from cornell -+# Note: emacs sends ei occasionally to insure the terminal is out of -+# insert mode. This unfortunately puts the viewpoint90 IN insert -+# mode. A hack to get around this is <ich1=\EF\s\EF^U>. (Also, -+# - :ei=:im=: must be present in the termcap translation.) -+# - <xhp> indicates glitch that attributes stick to location -+# - <msgr> means it's safe to move in standout mode -+# - <clear=\EG\Ek>: clears screen and visual attributes without affecting -+# the status line -+# Function key and label capabilities merged in from SCO. -+vp90|viewpoint90|adds viewpoint 90, -+ OTbs, bw, msgr, xhp, -+ cols#80, lines#24, -+ clear=\EG\Ek, cub1=^H, cud1=^J, cuf1=^F, -+ cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=^Z, dch1=\EE, -+ dl1=\El, ed=\Ek, el=\EK, home=\EY\s\s, ht=^I, -+ ich1=\EF \EF\025, ind=^J, kbs=^H, kcub1=^U, kcud1=^J, -+ kcuf1=^F, kcuu1=^Z, kf0=^B1\r, kf1=^B2\r, kf10=^B;\r, -+ kf2=^B3\r, kf3=^B4\r, kf4=^B5\r, kf5=^B6\r, kf6=^B7\r, -+ kf7=^B8\r, kf8=^B9\r, kf9=^B\:\r, khome=^A, lf0=F1, lf1=F2, -+ lf10=F11, lf2=F3, lf3=F4, lf4=F5, lf5=F6, lf6=F7, lf7=F8, lf8=F9, -+ lf9=F10, ll=^A, rmso=\ER\E0@\EV, rmul=\ER\E0@\EV, -+ sgr0=\ER\E0@\EV, smso=\ER\E0Q\EV, smul=\ER\E0`\EV, -+# Note: if return acts weird on a980, check internal switch #2 -+# on the top chip on the CONTROL pc board. -+adds980|a980|adds consul 980, -+ OTbs, am, -+ cols#80, lines#24, -+ bel=^G, clear=\014$<1>\013@, cr=^M, cub1=^H, cud1=^J, -+ cuf1=\E^E01, cup=\013%p1%{64}%+%c\E\005%p2%2d, -+ dl1=\E\017$<13>, il1=\E\016$<13>, ind=^J, kf0=\E0, kf1=\E1, -+ kf2=\E2, kf3=\E3, kf4=\E4, kf5=\E5, kf6=\E6, kf7=\E7, kf8=\E8, -+ kf9=\E9, rmso=^O, sgr0=^O, smso=^Y^^^N, -+ -+#### C. Itoh Electronics -+# -+# As of 1995 these people no longer make terminals (they're still in the -+# printer business). Their terminals were all clones of the DEC VT series. -+# They're located in Orange County, CA. -+# -+ -+# CIT 80 - vt-52 emulator, the termcap has been modified to remove -+# the delay times and do an auto tab set rather than the indirect -+# file used in vt100. -+cit80|cit-80|citoh 80, -+ OTbs, am, -+ cols#80, lines#24, -+ clear=\E[H\EJ, cr=^M, cub1=^H, cud1=\E[B, cuf1=\E[C, -+ cup=\E[%i%p1%2d;%p2%2dH, cuu1=\E[A, ed=\EJ, el=\EK, ff=^L, -+ ind=^J, is2=\E>, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, -+ kcuu1=\EOA, rmkx=\E[?1l\E>, smkx=\E[?1h\E=, -+# From: Tim Wood <mtxinu!sybase!tim> Fri Sep 27 09:39:12 PDT 1985 -+# (cit101: added <rmam>/<smam> based on init string, merged this with c101 -- esr) -+cit101|citc|C.itoh fast vt100, -+ OTbs, am, xenl, -+ cols#80, lines#24, -+ bel=^G, clear=\E[H\E[2J, cnorm=\E[V\E8, cub1=^H, cud1=\E[B, -+ cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, -+ cvvis=\E7\E[U, dch1=\E[P, dl1=\E[M, ed=\E[J, el=\E[K, -+ flash=\E[?5h$<200/>\E[?5l, ich1=\E[@, il1=\E[L, -+ is2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h\E[3g\E[>5g, -+ kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, -+ rmam=\E[?7l, rmkx=\E[?1l\E>, rmso=\E[m, rmul=\E[m, -+ sgr0=\E[m, smam=\E[?7h, smkx=\E[?1h\E=, smso=\E[7m, -+ smul=\E[4m, -+# CIE Terminals CIT-101e from Geoff Kuenning <callan!geoff> via BRL -+# The following termcap entry was created from the Callan cd100 entry. The -+# last two lines (with the capabilities in caps) are used by RM-cobol to allow -+# full selection of combinations of reverse video, underline, and blink. -+# (cit101e: removed unknown :f0=\EOp:f1=\EOq:f2=\EOr:f3=\EOs:f4=\EOt:f5=\EOu:\ -+# f6=\EOv:f7=\EOw:f8=\EOx:f9=\EOy:AB=\E[0;5m:AL=\E[m:AR=\E[0;7m:AS=\E[0;5;7m:\ -+# :NB=\E[0;1;5m:NM=\E[0;1m:NR=\E[0;1;7m:NS=\E[0;1;5;7m: -- esr) -+cit101e|C. Itoh CIT-101e, -+ OTbs, OTpt, am, mir, msgr, -+ cols#80, it#8, lines#24, -+ acsc=, clear=\E[H\E[J, cnorm=, csr=\E[%i%p1%2d;%p2%2dr, -+ cub1=\E[D, cud1=\E[B, cuf1=\E[C, cup=\E[%i%p1%2d;%p2%2dH, -+ cuu1=\E[A, cvvis=\E[?1l\E[?4l\E[?7h, dch1=\E[P, dl1=\E[M, -+ ed=\E[J, el=\E[K, if=/usr/share/tabset/vt100, il1=\E[L, -+ kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kf0=\EOT, -+ kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, kf5=\EOm, kf6=\EOl, -+ kf7=\EOM, kf8=\EOn, rc=\E8, ri=\EM, rmacs=^O, rmir=\E[4l, -+ rmkx=\E>, rmso=\E[m, rmul=\E[m, sc=\E7, smacs=^N, smir=\E[4h, -+ smkx=\E=, smso=\E[7m, smul=\E[4m, -+# From: David S. Lawyer, June 1997: -+# The CIT 101-e was made in Japan in 1983-4 and imported by CIE -+# Terminals in Irvine, CA. It was part of CITOH Electronics. In the -+# late 1980's CIT Terminals went out of business. -+# There is no need to use the initialization string is=... (by invoking -+# tset or setterm etc.) provided that the terminal has been manually set -+# up (and the setup saved with ^S) to be compatible with this termcap. To be -+# compatible it should be in ANSI mode (not VT52). A set-up that -+# works is to set all the manually setable stuff to factory defaults -+# by pressing ^D in set-up mode. Then increse the brighness with the -+# up-arrow key since the factory default will likely be dim on an old -+# terminal. Then change any options you want (provided that they are -+# compatible with the termcap). For my terminal I set: Screen -+# Background: light; Keyclicks: silent; Auto wraparound: on; CRT saver: -+# on. I also set up mine for parity (but you may not need it). Then -+# save the setup with ^S. -+# (cit101e-rv: added empty <rmcup> to suppress a tic warning. --esr) -+cit101e-rv|Citoh CIT-101e (sets reverse video), -+ am, eo, mir, msgr, xenl, xon, -+ cols#80, it#8, lines#24, -+ OTnl=\EM, bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, -+ civis=\E[1v, clear=\E[H\E[J, cnorm=\E[0;3;4v, cr=^M, -+ csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, -+ cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, cuf1=\E[C, -+ cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, -+ cvvis=\E[3;5v, dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, -+ dl1=\E[M, ed=\E[J, el=\E[K, flash=\E[?5l\E[?5h$<200/>, -+ home=\E[H, hpa=\E[%i%p1%dG, ht=^I, hts=\EH, ich=\E[%p1%d@, -+ ich1=\E[@, il=\E[%p1%dL, il1=\E[L, ind=^J, indn=\E[%p1%dS, -+ is2=\E<\E>\E[?1l\E[?3l\E[?4l\E[?5h\E[?7h\E[?8h\E[3g\E[>5g\E(B\E[m\E[20l\E[1;24r\E[24;1H, -+ kbs=\177, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, -+ kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, nel=\EE, rc=\E8, -+ rev=\E[7m, ri=\EM, rin=\E[%p1%dT, rmcup=, rmir=\E[4l, -+ rmso=\E[m, rmul=\E[m, rs1=\Ec\E[?7h\E[>5g, sc=\E7, -+ sgr0=\E[m, smcup=\E[>5g\E[?7h\E[?5h, smir=\E[4h, -+ smso=\E[7m, smul=\E[4m, tbc=\E[3g, u6=\E[%i%p1%d;%p2%dR, -+ u7=\E[6n, u8=\E[?6c, u9=\E[c, -+cit101e-n|CIT-101e w/o am, -+ am@, -+ cvvis=\E[?1l\E[?4l\E[?7l, kbs=^H, kcub1=^H, kcud1=^J, -+ use=cit101e, -+cit101e-132|CIT-101e with 132 cols, -+ cols#132, -+ kbs=^H, kcub1=^H, kcud1=^J, use=cit101e, -+cit101e-n132|CIT-101e with 132 cols w/o am, -+ am@, -+ cols#132, -+ cvvis=\E[?1l\E[?4l\E[?7l, kbs=^H, kcub1=^H, kcud1=^J, -+ use=cit101e, -+# CIE Terminals CIT-500 from BRL -+# The following SET-UP modes are assumed for normal operation: -+# GENERATE_XON/XOFF:YES DUPLEX:FULL NEWLINE:OFF -+# AUTOWRAP:ON MODE:ANSI SCREEN_LENGTH:64_LINES -+# DSPLY_CNTRL_CODES?NO PAGE_WIDTH:80 EDIT_MODE:OFF -+# Other SET-UP modes may be set for operator convenience or communication -+# requirements. -+# Hardware tabs are assumed to be set every 8 columns; they can be set up -+# by the "reset", "tset", or "tabs" utilities. No delays are specified; use -+# "stty ixon -ixany" to enable DC3/DC1 flow control! -+# (cit500: I added <rmam>/<smam> based on the init string -- esr) -+cit500|CIE Terminals CIT-500, -+ OTbs, OTpt, mir, msgr, xon, -+ OTkn#10, cols#80, it#8, lines#64, vt#3, -+ acsc=, bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, -+ clear=\E[H\E[J, cr=^M, csr=\E[%i%p1%d;%p2%dr, -+ cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=^J, -+ cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, -+ cuu=\E[%p1%dA, cuu1=\EM, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, -+ ed=\EJ, el=\EK, home=\E[H, ht=^I, hts=\EH, il=\E[%p1%dL, -+ il1=\E[L, ind=^J, is2=\E<\E)0, kbs=^H, kcbt=\E[Z, kcub1=\EOD, -+ kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kdch1=\E[P, kdl1=\E[M, -+ ked=\EJ, kel=\EK, kf0=\EOP, kf1=\EOQ, kf2=\EOR, kf3=\EOS, -+ kf4=\EOU, kf5=\EOV, kf6=\EOW, kf7=\EOX, kf8=\EOY, kf9=\EOZ, -+ khome=\E[H, kich1=\E[4h, kil1=\E[L, krmir=\E[4l, lf0=PF1, -+ lf1=PF2, lf2=PF3, lf3=PF4, lf4=F15, lf5=F16, lf6=F17, lf7=F18, -+ lf8=F19, lf9=F20, ll=\E[64H, nel=\EE, rc=\E8, rev=\E[7m, -+ ri=\EM, rmacs=^O, rmam=\E[?7l, rmir=\E[4l, rmkx=\E[?1l\E>, -+ rmso=\E[m, rmul=\E[m, -+ rs1=\E<\E2\E[20l\E[?6l\E[r\E[m\E[q\E(B\017\E)0\E>, -+ sc=\E7, sgr0=\E[m, smacs=^N, smam=\E[?7h, smir=\E[4h, -+ smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, tbc=\E[3g, -+ -+# C. Itoh printers begin here -+citoh|ci8510|8510|c.itoh 8510a, -+ cols#80, it#8, -+ bold=\E!, cub1@, -+ is2=\E(009\,017\,025\,033\,041\,049\,057\,065\,073., -+ rep=\ER%p2%03d%p1%c, ri=\Er, rmul=\EY, sgr0=\E"\EY, -+ smul=\EX, use=lpr, -+citoh-pica|citoh in pica, -+ is1=\EN, use=citoh, -+citoh-elite|citoh in elite, -+ cols#96, -+ is1=\EE, -+ is2=\E(009\,017\,025\,033\,041\,049\,057\,065\,073\,081\,089., -+ use=citoh, -+citoh-comp|citoh in compressed, -+ cols#136, -+ is1=\EQ, -+ is2=\E(009\,017\,025\,033\,041\,049\,057\,065\,073\,081\,089\,097\,105\,113\,121\,129., -+ use=citoh, -+# citoh has infinite cols because we don't want lp ever inserting \n\t**. -+citoh-prop|citoh-ps|ips|citoh in proportional spacing mode, -+ cols#32767, -+ is1=\EP, use=citoh, -+citoh-6lpi|citoh in 6 lines per inch mode, -+ is3=\EA, use=citoh, -+citoh-8lpi|citoh in 8 lines per inch mode, -+ lines#88, -+ is3=\EB, use=citoh, -+ -+#### Control Data (cdc) -+# -+ -+cdc456|cdc 456 terminal, -+ OTbs, am, -+ cols#80, lines#24, -+ bel=^G, clear=^Y^X, cr=^M, cub1=^H, cud1=^J, cuf1=^L, -+ cup=\E1%p1%{32}%+%c%p2%{32}%+%c, cuu1=^Z, dl1=\EJ, ed=^X, -+ el=^V, home=^Y, il1=\EL, ind=^J, -+ -+# Assorted CDC terminals from BRL (improvements by DAG & Ferd Brundick) -+cdc721|CDC Viking, -+ OTbs, am, -+ cols#80, lines#24, -+ clear=^L, cuf1=^X, cup=\002%p2%{32}%+%c%p1%{32}%+%c, -+ cuu1=^W, el=^K, home=^Y, kcub1=^H, kcud1=^J, kcuf1=^I, -+ kcuu1=^W, khome=^Y, -+cdc721ll|CDC Vikingll, -+ OTbs, am, -+ cols#132, lines#24, -+ clear=^L, cuf1=^X, cup=\002%p2%{32}%+%c%p1%{32}%+%c, -+ cuu1=^W, el=^K, home=^Y, kcub1=^H, kcud1=^J, kcuf1=^I, -+ kcuu1=^W, khome=^Y, -+# (cdc752: the BRL entry had :ll=\E1 ^Z: commented out -+cdc752|CDC 752, -+ OTbs, am, bw, xhp, -+ cols#80, lines#24, -+ bel=^G, clear=\030\E1\s\s, cr=^M, cub1=^H, cud1=^J, cuf1=^U, -+ cup=\E1%p2%{32}%+%c%p1%{32}%+%c, cuu1=^Z, el=^V, -+ home=\E1\s\s, ind=^J, ll=^Y, rs1=\E1 \030\002\003\017, -+# CDC 756 -+# The following switch/key settings are assumed for normal operation: -+# 96 chars SCROLL FULL duplex not BLOCK -+# Other switches may be set according to communication requirements. -+# Insert/delete-character cannot be used, as the whole display is affected. -+# "so" & "se" are commented out until jove handles "sg" correctly. -+cdc756|CDC 756, -+ OTbs, am, bw, -+ OTkn#10, cols#80, lines#24, -+ bel=^G, clear=^Y^X, cr=^M, cub1=^H, cud1=^J, cuf1=^U, -+ cup=\E1%p2%{32}%+%c%p1%{32}%+%c, cuu1=^Z, -+ dl1=\EJ$<6*/>, ed=^X, el=^V, home=^Y, il1=\EL$<6*/>, ind=^J, -+ kbs=^H, kcub1=^H, kcud1=^J, kcuf1=^U, kcuu1=^Z, kdch1=\EI, -+ kdl1=\EL, ked=^X, kel=^V, kf0=\EA, kf1=\EB, kf2=\EC, kf3=\ED, -+ kf4=\EE, kf5=\EF, kf6=\EG, kf7=\EH, kf8=\Ea, kf9=\Eb, khome=^Y, -+ khts=^O, kich1=\EK, kil1=\EL, lf0=F1, lf1=F2, lf2=F3, lf3=F4, -+ lf4=F5, lf5=F6, lf6=F7, lf7=F8, lf8=F9, lf9=F10, ll=^Y^Z, -+ rs1=\031\030\002\003\017, -+# -+# CDC 721 from Robert Viduya, Ga. Tech. <ihnp4!gatech!gitpyr!robert> via BRL. -+# -+# Part of the long initialization string defines the "DOWN" key to the left -+# of the tab key to send an ESC. The real ESC key is positioned way out -+# in right field. -+# -+# The termcap won't work in 132 column mode due to the way it it moves the -+# cursor. Termcap doesn't have the capability (as far as I could tell) to -+# handle the 721 in 132 column mode. -+# -+# (cdc721: changed :ri: to :sr: -- esr) -+cdc721-esc|Control Data 721, -+ OTbs, OTpt, am, bw, msgr, xon, -+ OTkn#10, cols#80, it#8, lines#30, -+ bel=^G, blink=^N, cbt=^^^K, clear=^L, cub1=^H, cud1=^Z, -+ cuf1=^X, cup=\002%p2%{32}%+%c%p1%{32}%+%c, cuu1=^W, -+ dch1=^^N, dim=^\, dl1=^^Q, ed=^^P, el=^K, home=^Y, hts=^^^RW, -+ ich1=^^O, il1=^^R, ind=\036W =\036U, invis=^^^R[, -+ is2=\036\022B\003\036\035\017\022\025\035\036E\036\022H\036\022J\036\022L\036\022N\036\022P\036\022Q\036\022\036\022\^\036\022b\036\022i\036W =\036\022Z\036\011C1-` `!k/o, -+ kbs=^H, kcub1=^H, kcud1=^Z, kcuf1=^X, kcuu1=^W, kf0=^^q, -+ kf1=^^r, kf2=^^s, kf3=^^t, kf4=^^u, kf5=^^v, kf6=^^w, kf7=^^x, -+ kf8=^^y, kf9=^^z, khome=^Y, ll=^B =, rev=^^D, -+ ri=\036W =\036V, rmir=, rmkx=^^^Rl, rmso=^^E, rmul=^], -+ sgr0=\017\025\035\036E\036\022\\, smir=, smkx=^^^Rk, -+ smso=^^D, smul=^\, tbc=^^^RY, -+ -+#### Getronics -+# -+# Getronics is a Dutch electronics company that at one time was called -+# `Geveke' and made async terminals; but (according to the company itself!) -+# they've lost all their documentation on the command set. The hardware -+# documentation suggests the terminals were actually manufactured by a -+# Taiwanese electronics company named Cal-Comp. There are known -+# to have been at least two models, the 33 and the 50. -+# -+ -+# The 50 seems to be a top end vt220 clone, with the addition of a higher -+# screen resolution, a larger screen, at least 1 page of memory above and -+# below the screen, apparently pages of memory right and left of the screen -+# which can be panned, and about 75 function keys (15 function keys x normal, -+# shift, control, func A, func B). It also has more setup possibilities than -+# the vt220. The monitor case is dated November 1978 and the keyboard case is -+# May 1982. -+# -+# The vt100 emulation works as is. The entry below describes the rather -+# non-conformant (but more featureful) ANSI mode. -+# -+# From: Stephen Peterson <stv@utrecht.ow.nl>, 27 May 1995 -+visa50|geveke visa 50 terminal in ansi 80 character mode, -+ bw, mir, msgr, -+ cols#80, lines#25, -+ acsc=0_aaffggh jjkkllmmnnooqqssttuuvvwwxx, bel=^G, -+ blink=\E[5m, bold=\E[1m, cbt=\E[Z, clear=\E[H\E[2J, cr=^M, -+ csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=\E[D, -+ cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, cuf1=\E[C, -+ cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, -+ dch=\E[%p1%dX, dch1=\E[X, dim=\E[2m, dl=\E[%p1%dM, -+ dl1=\E[M, ed=\E[J, el=\E[K, flash=\E[?5h\E[?5l, home=\E[H, -+ hpa=\E[%i%p1%dG, ht=^I, ich=\E[%p1%d@, ich1=\E[@, -+ il=\E[%p1%dL, il1=\E[L, ind=^J, invis=\E[8m, -+ is2=\E0;2m\E[1;25r\E[25;1H\E[?3l\E[?7h\E[?8h, -+ ka1=\E[f, ka3=\EOQ, kb2=\EOP, kbs=^H, kc1=\EOR, kc3=\EOS, -+ kcub1=\E[D, kcud1=\E[A, kcuf1=\E[C, kcuu1=\E[A, kdch1=\177, -+ kdl1=\EOS, kf0=\E010, kf1=\E001, kf10=\E011, kf2=\E002, -+ kf3=\E003, kf4=\E004, kf5=\E005, kf6=\E006, kf7=\E007, -+ kf8=\E008, kf9=\E009, khome=\E[f, lf2=A delete char, -+ lf3=A insert line, lf4=A delete line, lf5=A clear, -+ lf6=A ce of/cf gn, lf7=A print, lf8=A on-line, -+ lf9=A funcl0=A send, nel=^M^J, rev=\E[7m, rmacs=\E[3l, -+ rmam=\E[?7l, rmir=\E[4l, rmkx=\E>, rmso=\E[0;2m, -+ rmul=\E[0m, sgr0=\E[0;2m, smacs=\E3h, smam=\E?7h, -+ smir=\E[4h, smkx=\E=, smso=\E[2;7m, smul=\E[4m, tbc=\E[3g, -+ vpa=\E[%i%p1%dd, -+ -+#### Human Designed Systems (Concept) -+# -+# Human Designed Systems -+# 400 Fehley Drive -+# King of Prussia, PA 19406 -+# Vox: (610)-277-8300 -+# Fax: (610)-275-5739 -+# Net: support@hds.com -+# -+# John Martin <john@hds.com> is their termcap expert. They're mostly out of -+# the character-terminal business now (1995) and making X terminals. In -+# particular, the whole `Concept' line described here was discontinued long -+# ago. -+# -+ -+# From: <vax135!hpk> Sat Jun 27 07:41:20 1981 -+# Extensive changes to c108 by arpavax:eric Feb 1982 -+# Some unknown person at SCO then translated it to terminfo. -+# -+# There seem to be a number of different versions of the C108 PROMS -+# (with bug fixes in its Z-80 program). -+# -+# The first one that we had would lock out the keyboard of you -+# sent lots of short lines (like /usr/dict/words) at 9600 baud. -+# Try that on your C108 and see if it sends a ^S when you type it. -+# If so, you have an old version of the PROMs. -+# -+# You should configure the C108 to send ^S/^Q before running this. -+# It is much faster (at 9600 baud) than the c100 because the delays -+# are not fixed. -+# new status line display entries for c108-8p: -+# <is3> - init str #3 - setup term for status display - -+# set programmer mode, select window 2, define window at last -+# line of memory, set bkgnd stat mesg there, select window 0. -+# -+# <tsl> - to status line - select window 2, home cursor, erase to -+# end-of-window, 1/2 bright on, goto(line#0, col#?) -+# -+# <fsl> - from status line - 1/2 bright off, select window 0 -+# -+# <dsl> - disable status display - set bkgnd status mesg with -+# illegal window # -+# -+# There are probably more function keys that should be added but -+# I don't know what they are. -+# -+# No delays needed on c108 because of ^S/^Q handshaking -+# -+c108|concept108|c108-8p|concept108-8p|concept 108 w/8 pages, -+ is3=\EU\E z"\Ev\001\177 !p\E ;"\E z \Ev \001\177p\Ep\n, -+ rmcup=\Ev \001\177p\Ep\r\n, use=c108-4p, -+c108-4p|concept108-4p|concept 108 w/4 pages, -+ OTbs, eslok, hs, xon, -+ pb@, -+ acsc=jEkTl\\mMqLxU, cnorm=\Ew, cr=^M, -+ cup=\Ea%p1%?%p1%{95}%>%t\001%{96}%-%;%{32}%+%c%p2%?%p2%{95}%>%t\001%{96}%-%;%{32}%+%c, -+ cvvis=\EW, dch1=\E 1$<16*>, dsl=\E ;\177, fsl=\Ee\E z\s, -+ ind=^J, is1=\EK\E!\E F, -+ is3=\EU\E z"\Ev\177 !p\E ;"\E z \Ev \001 p\Ep\n, -+ rmacs=\Ej\s, rmcup=\Ev \001 p\Ep\r\n, smacs=\Ej!, -+ smcup=\EU\Ev 8p\Ep\r\E\025, -+ tsl=\E z"\E?\E\005\EE\Ea %+\s, use=c100, -+c108-rv|c108-rv-8p|concept 108 w/8 pages in reverse video, -+ rmcup=\Ev \002 p\Ep\r\n, smcup=\EU\Ev 8p\Ep\r, -+ use=c108-rv-4p, -+c108-rv-4p|concept108rv4p|concept 108 w/4 pages in reverse video, -+ flash=\EK$<200>\Ek, is1=\Ek, rmso=\Ee, smso=\EE, -+ use=c108-4p, -+c108-w|c108-w-8p|concept108-w-8|concept108-w8p|concept 108 w/8 pages in wide mode, -+ cols#132, -+ is1=\E F\E", rmcup=\Ev ^A0\001D\Ep\r\n, -+ smcup=\EU\Ev 8\001D\Ep\r, use=c108-8p, -+ -+# Concept 100: -+# These have only window relative cursor addressing, not screen -+# relative. To get it to work right here, smcup/rmcup (which -+# were invented for the concept) lock you into a one page -+# window for screen style programs. -+# -+# To get out of the one page window, we use a clever trick: -+# we set the window size to zero ("\Ev " in rmcup) which the -+# terminal recognizes as an error and resets the window to all -+# of memory. -+# -+# This trick works on c100 but does not on c108, sigh. -+# -+# Some tty drivers use cr3 for concept, others use nl3, hence -+# the delays on cr and ind below. This padding is only needed at -+# 9600 baud and up. One or the other is commented out depending on -+# local conventions. -+# -+# 2 ms padding on <rmcup> isn't always enough. 6 works fine. Maybe -+# less than 6 but more than 2 will work. -+# -+# Note: can't use function keys f7-f10 because they are -+# indistinguishable from arrow keys (!), also, del char and -+# clear eol use xon/xoff so they probably won't work very well. -+# -+# Also note that we don't define insrt/del char/delline/eop/send -+# because they don't transmit unless we reset them - I figured -+# it was a bad idea to clobber their definitions. -+# -+# The <mc5> sequence changes the escape character to ^^ so that -+# escapes will be passed through to the printer. Only trouble -+# is that ^^ won't be - ^^ was chosen to be unlikely. -+# Unfortunately, if you're sending raster bits through to be -+# plotted, any character you choose will be likely, so we lose. -+# -+# \EQ"\EY(^W (send anything from printer to host, for xon/xoff) -+# cannot be # in is2 because it will hang a c100 with no printer -+# if sent twice. -+c100|concept100|concept|c104|c100-4p|hds concept 100, -+ OTbs, am, eo, mir, ul, xenl, -+ cols#80, lines#24, pb#9600, vt#8, -+ bel=^G, blink=\EC, clear=\E?\E\005$<2*>, cr=$<9>\r, -+ cub1=^H, cud1=^J, cuf1=\E=, -+ cup=\Ea%p1%{32}%+%c%p2%{32}%+%c, cuu1=\E;, -+ dch1=\E\021$<16*>, dim=\EE, dl1=\E\002$<3*>, -+ ed=\E\005$<16*>, el=\E\025$<16>, flash=\Ek$<200>\EK, -+ ht=\011$<8>, il1=\E\022$<3*>, ind=^J, invis=\EH, ip=$<16*>, -+ is1=\EK, -+ is2=\EU\Ef\E7\E5\E8\El\ENH\E\0\Eo&\0\Eo'\E\Eo!\0\E\007!\E\010A@ \E4#\:"\E\:a\E4#;"\E\:b\E4#<"\E\:c, -+ is3=\Ev $<6>\Ep\n, kbs=^H, kcbt=\E', kctab=\E_, -+ kcub1=\E>, kcud1=\E<, kcuf1=\E=, kcuu1=\E;, kdch1=\E^Q, -+ kdl1=\E^B, ked=\E^C, kel=\E^S, kf1=\E5, kf2=\E6, kf3=\E7, -+ kf4=\E8, kf5=\E9, kf6=\E\:a, kf7=\E\:b, kf8=\E\:c, khome=\E?, -+ khts=\E], kich1=\E^P, kil1=\E^R, kind=\E[, knp=\E-, kpp=\E., -+ kri=\E\\, krmir=\E\0, mc4=\036o \E\EQ!\EYP\027, -+ mc5=\EQ"\EY(\027\EYD\Eo \036, prot=\EI, -+ rep=\Er%p1%c%p2%{32}%+%c$<.2*>, rev=\ED, -+ rmcup=\Ev $<6>\Ep\r\n, rmir=\E\s\s, rmkx=\Ex, -+ rmso=\Ed, rmul=\Eg, sgr0=\EN@, -+ smcup=\EU\Ev 8p\Ep\r\E\025$<16>, smir=\E^P, smkx=\EX, -+ smso=\ED, smul=\EG, -+c100-rv|c100-rv-4p|concept100-rv|c100 rev video, -+ cnorm@, cvvis@, flash=\EK$<200>\Ek, is1=\Ek, rmso=\Ee, -+ smso=\EE, use=c100, -+oc100|oconcept|c100-1p|old 1 page concept 100, -+ in, -+ is3@, use=c100, -+ -+# From: Walter Skorski <walt@genetics1.JMP.TJU.EDU>, 16-oct-1996. -+# Lots of notes, originally inline, but ncurses doesn't grok that. -+# -+# am: not available in power on mode, but turned on with \E[=107;207h in -+# is2=. Also, \E=124l in is2= could have been used to prevent needing -+# to specify xenl:, but that would have rendered the last space on the -+# last line useless. -+# bw: Not available in power on mode, but turned on with \E[=107;207h in -+# is2=. -+# clear: Could be done with \E[2J alone, except that vi (and probably most -+# other programs) assume that this also homes the cursor. -+# dsl: Go to window 2, go to the beginning of the line, use a line feed to -+# scroll the window, and go back to window 1. -+# is2: the string may cause a warning to be issued by tic that it -+# found a very long line and that it suspects that a comma is missing -+# somewhere. This warning can be ignored (unless it comes up more than -+# once). The initialization string contains the following commands: -+# -+# [Setup mode items changed from factory defaults:] -+# \E)0 set alternate character set to -+# graphics -+# ^O set character set to default -+# [In case it wasn't] -+# \E[m turn off all attributes -+# [In case they weren't off] -+# \E[=107; cursor wrap and -+# 207h character wrap on -+# \E[90;3u set Fkey definitions to "transmit" -+# defaults -+# \E[92;3u set cursor key definitions to -+# "transmit" defaults -+# \E[43;1u set shift F13 to transmit... -+# \177\E$P\177 -+# \E[44;1u set shift F14 to transmit... -+# \177\E$Q\177 -+# \E[45;1u set shift F15 to transmit... -+# \177\E$R\177 -+# \E[46;1u set shift F16 to transmit... -+# \177\E$S\177 -+# \E[200;1u set shift up to transmit... -+# \177\E$A\177 -+# \E[201;1u set shift down to transmit... -+# \177\E$B\177 -+# \E[202;1u set shift right to transmit... -+# \177\E$C\177 -+# \E[203;1u set shift left to transmit... -+# \177\E$D\177 -+# \E[204;1u set shift home to transmit... -+# \177\E$H\177 -+# \E[212;1u set backtab to transmit... -+# \177\E$I\177 -+# \E[213;1u set shift backspace to transmit... -+# \177\E$^H\177 -+# \E[214;1u set shift del to transmit... -+# "\E$\177" -+# [Necessary items not mentioned in setup mode:] -+# \E[2!w move to window 2 -+# \E[25;25w define window as line 25 of memory -+# \E[!w move to window 1 -+# \E[2*w show current line of window 2 as -+# status line -+# \E[2+x set meta key to use high bit -+# \E[;3+} move underline to bottom of character -+# -+# All Fkeys are set to their default transmit definitions with \E[90;3u -+# in is2=. IMPORTANT: to use this terminal definition, the "quit" stty -+# setting MUST be redefined or deactivated, because the default is -+# contained in almost all of this terminal's Fkey strings! If for some -+# reason "quit" cannot be altered, the Fkeys can, but it would be -+# necessary to change ^| to ^] in all of these definitions, and add -+# \E[2;029!t to is2. -+# lines: is set to 24 because this terminal refuses to treat the 25th -+# line normally. -+# ll: Not available in power on mode, but turned on with \E[=107;207h in -+# is2=. -+# lm: Pointless, given that this definition locks a single screen of -+# memory into view, but what the hey... -+# rmso: Could use \E[1;7!{ to turn off only bold and reverse (leaving any -+# other attributes alone), but some programs expect this to turn off -+# everything. -+# rmul: Could use \E[4!{ to turn off only underline (leaving any other -+# attributes alone), but some programs expect this to turn off -+# everything. -+# sgr: Attributes are set on this terminal with the string \E[ followed by -+# a list of attribute code numbers (in decimal, separated by -+# semicolons), followed by the character m. The attribute code -+# numbers are: -+# 1 for bold; -+# 2 for dim (which is ignored in power on mode); -+# 4 for underline; -+# 5 for blinking; -+# 7 for inverse; -+# 8 for not displayable; and -+# =99 for protected (except that there are strange side -+# effects to protected characters which make them inadvisable). -+# The mapping of terminfo parameters to attributes is as follows: -+# %p1 (standout) = bold and inverse together; -+# %p2 (underline) = underline; -+# %p3 (reverse) = inverse; -+# %p4 (blink) = blinking; -+# %p5 (dim) is ignored; -+# %p6 (bold) = bold; -+# %p7 (invisible) = not displayable; -+# %p8 (protected) is ignored; and -+# %p9 (alt char set) = alt char set. -+# The code to do this is: -+# \E[0 OUTPUT \E[0 -+# %?%p1%p6%O IF (standout; bold) OR -+# %t;1 THEN OUTPUT ;1 -+# %; ENDIF -+# %?%p2 IF underline -+# %t;4 THEN OUTPUT ;4 -+# %; ENDIF -+# %?%p4 IF blink -+# %t;5 THEN OUTPUT ;5 -+# %; ENDIF -+# %?%p1%p3%O IF (standout; reverse) OR -+# %t;7 THEN OUTPUT ;7 -+# %; ENDIF -+# %?%p7 IF invisible -+# %t;8 THEN OUTPUT ;8 -+# %; ENDIF -+# m OUTPUT m -+# %?%p9 IF altcharset -+# %t^N THEN OUTPUT ^N -+# %e^O ELSE OUTPUT ^O -+# %; ENDIF -+# sgr0: Everything is turned off (including alternate character set), since -+# there is no way of knowing what it is that the program wants turned -+# off. -+# smul: The "underline" attribute is reconfigurable to an overline or -+# strikethru, or (as done with \E[;3+} in is2=), to a line at the true -+# bottom of the character cell. This was done to allow for more readable -+# underlined characters, and to be able to distinguish between an -+# underlined space, an underscore, and an underlined underscore. -+# xenl: Terminal can be configured to not need this, but this "glitch" -+# behavior is actually preferable with autowrap terminals. -+# -+# Parameters kf31= thru kf53= actually contain the strings sent by the shifted -+# Fkeys. There are no parameters for shifted Fkeys in terminfo. The is2 -+# string modifies the 'O' in kf43 to kf46 to a '$'. -+# -+# kcbt was originally ^I but redefined in is2=. -+# kHOM was \E[H originally but redefined in is2=, as were a number of -+# other keys. -+# kDC was originally \177 but redefined in is2=. -+# -+# kbs: Shift was also ^H originally but redefined as \E$^H in is2=. -+# tsl: Go to window 2, then do an hpa=. -+# -+#------- flash=\E[8;3!}^G\E[3;3!} -+#------- flash=\E[?5h$<100>\E[?5l -+# There are two ways to flash the screen, both of which have their drawbacks. -+# The first is to set the bell mode to video, transmit a bell character, and -+# set the bell mode back - but to what? There is no way of knowing what the -+# user's old bell setting was before we messed with it. Worse, the command to -+# set the bell mode also sets the key click volume, and there is no way to say -+# "leave that alone", or to know what it's set to, either. -+# The second way to do a flash is to set the screen to inverse video, pad for a -+# tenth of a second, and set it back - but like before, there's no way to know -+# that the screen wasn't ALREADY in inverse video, or that the user may prefer -+# it that way. The point is moot anyway, since vi (and probably other -+# programs) assume that by defining flash=, you want the computer to use it -+# INSTEAD of bel=, rather than as a secondary type of signal. -+# -+#------- cvvis=\E[+{ -+# The is the power on setting, which is also as visible as the cursor -+# gets. -+#------- wind=\E[%i%p1%d;%p2%d;%p3%{1}%+%d;%p4%{1}%+%dw -+# Windowing is possible, but not defined here because it is also used to -+# emulate status line functions. Allowing a program to set a window could -+# clobber the status line or render it unusable. There is additional memory, -+# but screen scroll functions are destructive and do not make use of it. -+# -+#------- dim= Not available in power on mode. -+# You have a choice of defining low intensity characters as "half bright" and -+# high intensity as "normal", or defining low as "normal" and high as "bold". -+# No matter which you choose, only one of either "half bright" or "bold" is -+# available at any time, so taking the time to override the default is -+# pointless. -+# -+#------- prot=\E[=0;99m -+# Not defined, because it appears to have some strange side effects. -+#------- pfkey=%?%p1%{24}%<%p1%{30}%>%p1%{54}%<%A%O%t\E[%p1%du\177%p2%s\177%; -+#------- pfloc=%?%p1%{24}%<%p1%{30}%>%p1%{54}%<%A%O%t\E[%p1%du\177%p2%s\177%; -+#------- pfx=%?%p1%{24}%<%p1%{30}%>%p1%{54}%<%A%O%t\E[%p1%d;1u\177%p2%s\177%; -+# Available, but making them available to programs is inadvisable. -+# The code to do this is: -+# %?%p1%{24}%< IF ((key; 24) <; -+# %p1%{30}%> ((key; 30) >; -+# %p1%{54}%< (key; 54) < -+# %A ) AND -+# %O ) OR -+# [that is, "IF key < 24 OR (key > 30 AND key < 54)",] -+# %t\E[ THEN OUTPUT \E[ -+# %p1%d OUTPUT (key) as decimal -+# [next line applies to pfx only] -+# ;1 OUTPUT ;1 -+# u OUTPUT u -+# \177 OUTPUT \177 -+# %p2%s OUTPUT (string) as string -+# \177 OUTPUT \177 -+# [DEL chosen as delimiter, but could be any character] -+# [implied: ELSE do nothing] -+# %; ENDIF -+# -+#------- rs2= -+# Not defined since anything it might do could be done faster and easier with -+# either Meta-Shift-Reset or the main power switch. -+# -+#------- smkx=\E[1!z -+#------- rmkx=\E[!z -+# These sequences apply to the cursor and setup keys only, not to the -+# numeric keypad. But it doesn't matter anyway, since making these -+# available to programs is inadvisable. -+# For the key definitions below, all sequences beginning with \E$ are -+# custom and programmed into the terminal via is2. \E$ also has no -+# meaning to any other terminal. -+# -+#------- cmdch=\E[;%p1%d!t -+# Available, but making it available to programs is inadvisable. -+#------- smxon=\E[1*q -+# Available, but making it available to programs is inadvisable. -+# Terminal will send XON/XOFF on buffer overflow. -+#------- rmxon=\E[*q -+# Available, but making it available to programs is inadvisable. -+# Terminal will not notify on buffer overflow. -+#------- smm=\E[2+x -+#------- rmm=\E[+x -+# Available, but making them available to programs is inadvisable. -+# -+# Printing: -+# It's not made clear in the manuals, but based on other ansi/vt type -+# terminals, it's a good guess that this terminal is capable of both -+# "transparent print" (which doesn't copy data to the screen, and -+# therefore needs mc5i: specified to say so) and "auxilliary print" -+# (which does duplicate printed data on the screen, in which case mc4= -+# and mc5= should use the \E[?4i and \E[?5i strings instead). -+ -+hds200|Human Designed Systems HDS200, -+ am, bw, eslok, hs, km, mir, msgr, xenl, xon, -+ cols#80, it#8, lines#24, lm#0, -+ acsc=``aaffggjjkkllmmnnooqqssttuuvvwwxx~~, bel=^G, -+ blink=\E[0;5m, bold=\E[0;1m, cbt=\E[Z, civis=\E[6+{, -+ clear=\E[H\E[J, cnorm=\E[+{, cr=^M, -+ csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=\E[D, -+ cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, cuf1=\E[C, -+ cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, -+ dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, -+ dsl=\E[2!w\r\n\E[!w, ed=\E[J, el=\E[K, el1=\E[1K, -+ fsl=\E[!w, home=\E[H, hpa=\E[%i%p1%dG, ht=^I, hts=\EH, -+ ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[L, ind=\ED, -+ invis=\E[0;8m, -+ is2=\E)0\017\E[m\E[=107;207h\E[90;3u\E[92;3u\E[43;1u\177\E$P\177\E[44;1u\177\E$Q\177\E[45;1u\177\E$R\177\E[46;1u\177\E$S\177\E[200;1u\177\E$A\177\E[201;1u\177\E$B\177\E[202;1u\177\E$C\177\E[203;1u\177\E$D\177\E[204;1u\177\E$H\177\E[212;1u\177\E$I\177\E[213;1u\177\E$\010\177\E[214;1u"\E$\177"\E[2!w\E[25;25w\E[!w\E[2*w\E[2+x\E[;3+}, -+ kDC=\E$\177, kHOM=\E$H, kLFT=\E$D, kRIT=\E$C, kbs=^H, -+ kcbt=\E$I, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, -+ kdch1=\177, kent=^M, kf1=^\001\r, kf10=^\010\r, -+ kf11=^\011\r, kf12=^\012\r, kf13=\EOP, kf14=\EOQ, -+ kf15=\EOR, kf16=\EOS, kf17=^\017\r, kf18=^\018\r, -+ kf19=^\019\r, kf2=^\002\r, kf20=^\020\r, kf21=^\021\r, -+ kf22=^\022\r, kf23=^\023\r, kf3=^\003\r, kf31=^\031\r, -+ kf32=^\032\r, kf33=^\033\r, kf34=^\034\r, kf35=^\035\r, -+ kf36=^\036\r, kf37=^\037\r, kf38=^\038\r, kf39=^\039\r, -+ kf4=^\004\r, kf40=^\040\r, kf41=^\041\r, kf42=^\042\r, -+ kf43=\E$P, kf44=\E$Q, kf45=\E$R, kf46=\E$S, kf47=^\047\r, -+ kf48=^\048\r, kf49=^\049\r, kf5=^\005\r, kf50=^\050\r, -+ kf51=^\051\r, kf52=^\052\r, kf53=^\053\r, kf6=^\006\r, -+ kf7=^\007\r, kf8=^\008\r, kf9=^\009\r, khome=\E[H, -+ kind=\E[T, knp=\E[U, kpp=\E[V, kri=\E[S, ll=\E[H\E[A, -+ nel=\E[E, rc=\E8, rev=\E[0;7m, ri=\EM, rmacs=^O, rmir=\E[4l, -+ rmso=\E[m\017, rmul=\E[m\017, sc=\E7, -+ sgr=\E[0%?%p1%p6%O%t;1%;%?%p2%t;4%;%?%p4%t;5%;%?%p1%p3%O%t;7%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, -+ sgr0=\E[m\017, smacs=^N, smir=\E[4h, smso=\E[0;1;7m, -+ smul=\E[0;4m, tbc=\E[3g, tsl=\E[2!w\E[%i%p1%dG, -+ vpa=\E[%i%p1%dd, use=ansi+pp, -+ -+# <ht> through <el> included to specify padding needed in raw mode. -+# (avt-ns: added empty <acsc> to suppress a tic warning --esr) -+avt-ns|concept avt no status line, -+ OTbs, am, eo, mir, ul, xenl, xon, -+ cols#80, it#8, lines#24, lm#192, -+ acsc=, bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, -+ clear=\E[H\E[J$<38>, cnorm=\E[=119l, cr=^M, -+ csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, -+ cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, -+ cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, -+ cvvis=\E[=119h, dch1=\E[P, dim=\E[1!{, dl=\E[%p1%dM$<4*>, -+ dl1=\E[M$<4>, ed=\E[J$<96>, el=\E[K$<6>, home=\E[H, -+ hpa=\E[%p1%{1}%+%dG, ht=\011$<4>, hts=\EH, ich=\E[%p1%d@, -+ ich1=\E[@, il=\E[%p1%dL$<4*>, il1=\E[L$<4>, ind=\n$<8>, -+ invis=\E[8m, ip=$<4>, is1=\E[=103l\E[=205l, -+ is2=\E[1*q\E[2!t\E[7!t\E[=4;101;119;122l\E[=107;118;207h\E)1\E[1Q\EW\E[!y\E[!z\E>\E[0\:0\:32!r\E[0*w\E[w\E2\r\n\E[2;27!t, -+ kbs=^H, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, -+ kdch1=\E^B\r, ked=\E^D\r, kf1=\EOP, kf2=\EOQ, kf3=\EOR, -+ kf4=\EOS, khome=\E[H, kich1=\E^A\r, kil1=\E^C\r, ll=\E[24H, -+ mc0=\E[0i, mc4=\E[4i, mc5=\E[5i, -+ pfloc=\E[%p1%d;0u#%p2%s#, pfx=\E[%p1%d;1u#%p2%s#, -+ prot=\E[99m, rc=\E8, rep=%p1%c\E[%p2%{1}%-%db, rev=\E[7m, -+ ri=\EM$<4>, rmacs=\016$<1>, rmcup=\E[w\E2\r\n, -+ rmir=\E[4l, rmkx=\E[!z\E[0;2u, rmso=\E[7!{, rmul=\E[4!{, -+ sc=\E7, -+ sgr=\E[%?%p1%t7;%;%?%p2%t4;%;%?%p3%t7;%;%?%p4%t5;%;%?%p6%t1;%;%?%p7%t8;%;%?%p8%t99;%;m%?%p5%t\E[1!{%;%?%p9%t\017%e\016%;$<1>, -+ sgr0=\E[m\016$<1>, smacs=\017$<1>, -+ smcup=\E[=4l\E[1;24w\E2\r, smir=\E[4h, -+ smkx=\E[1!z\E[0;3u, smso=\E[7m, smul=\E[4m, tbc=\E[3g, -+ vpa=\E[%p1%{1}%+%dd, -+avt-rv-ns|concept avt in reverse video mode/no status line, -+ flash=\E[=205l$<200>\E[=205h, is1=\E[=103l\E[=205h, -+ use=avt-ns, -+avt-w-ns|concept avt in 132 column mode/no status line, -+ is1=\E[=103h\E[=205l, smcup=\E[H\E[1;24;1;132w, -+ use=avt-ns, -+avt-w-rv-ns|concept avt in 132 column mode/no status line/reverse video, -+ flash=\E[=205l$<200>\E[=205h, is1=\E[=103h\E[=205h, -+ smcup=\E[H\E[1;24;1;132w, use=avt-ns, -+ -+# Concept AVT with status line. We get the status line using the -+# "Background status line" feature of the terminal. We swipe the -+# first line of memory in window 2 for the status line, keeping -+# 191 lines of memory and 24 screen lines for regular use. -+# The first line is used instead of the last so that this works -+# on both 4 and 8 page AVTs. (Note the lm#191 or 192 - this -+# assumes an 8 page AVT but lm isn't currently used anywhere.) -+# -+avt+s|concept avt status line changes, -+ eslok, hs, -+ lm#191, -+ dsl=\E[0*w, fsl=\E[1;1!w, -+ is3=\E[2w\E[2!w\E[1;1;1;80w\E[H\E[2*w\E[1!w\E2\r\n, -+ rmcup=\E[2w\E2\r\n, smcup=\E[2;25w\E2\r, -+ tsl=\E[2;1!w\E[;%p1%dH\E[2K, -+avt|avt-s|concept-avt|avt w/80 columns, -+ use=avt+s, use=avt-ns, -+avt-rv|avt-rv-s|avt reverse video w/sl, -+ flash=\E[=205l$<200>\E[=205h, is1=\E[=103l\E[=205h, -+ use=avt+s, use=avt-ns, -+avt-w|avt-w-s|concept avt 132 cols+status, -+ is1=\E[=103h\E[=205l, smcup=\E[H\E[1;24;1;132w, -+ use=avt+s, use=avt-ns, -+avt-w-rv|avt-w-rv-s|avt wide+status+rv, -+ flash=\E[=205l$<200>\E[=205h, is1=\E[=103h\E[=205h, -+ smcup=\E[H\E[1;24;1;132w, use=avt+s, use=avt-ns, -+ -+#### Contel Business Systems. -+# -+ -+# Contel c300 and c320 terminals. -+contel300|contel320|c300|Contel Business Systems C-300 or C-320, -+ am, in, xon, -+ cols#80, lines#24, xmc#1, -+ bel=^G, clear=\EK, cr=^M, cub1=^H, cud1=^J, cuf1=\EC, -+ cup=\EX%p1%{32}%+%c\EY%p2%{32}%+%c, cuu1=\EA, -+ dch1=\EO$<5.5*>, dl1=\EM$<5.5*>, ed=\EJ$<5.5*>, -+ el=\EI$<5.5>, flash=\020\002$<200/>\020\003, home=\EH, -+ hts=\E1, ich1=\EN, il1=\EL$<5.5*>, ind=^J, ip=$<5.5*>, -+ kbs=^H, kf0=\ERJ, kf1=\ERA, kf2=\ERB, kf3=\ERC, kf4=\ERD, -+ kf5=\ERE, kf6=\ERF, kf7=\ERG, kf8=\ERH, kf9=\ERI, ll=\EH\EA, -+ rmso=\E!\0, sgr0=\E!\0, smso=\E!\r, tbc=\E3, -+# Contel c301 and c321 terminals. -+contel301|contel321|c301|c321|Contel Business Systems C-301 or C-321, -+ flash@, ich1@, ip@, rmso=\E!\0$<20>, smso=\E!\r$<20>, -+ use=contel300, -+ -+#### Data General (dg) -+# -+# According to James Carlson <carlson@xylogics.com> writing in January 1995, -+# the terminals group at Data General was shut down in 1991; all these -+# terminals have thus been discontinued. -+# -+# DG terminals have function keys that respond to the SHIFT and CTRL keys, -+# e.g., SHIFT-F1 generates a different code from F1. To number the keys -+# sequentially, first the unmodified key codes are listed as F1 through F15. -+# Then their SHIFT versions are listed as F16 through F30, their CTRL versions -+# are listed as F31 through F45, and their CTRL-SHIFT versions are listed as -+# F46 through F60. This is done in the private "includes" below whose names -+# start with "dgkeys+". -+# -+# DG terminals generally support 8 bit characters. For each of these terminals -+# two descriptions are supplied: -+# 1) A default description for 8 bits/character communications, which -+# uses the default DG international character set and keyboard codes. -+# 2) A description with suffix "-7b" for 7 bits/character communications. -+# This description must use the NON-DEFAULT native keyboard language. -+ -+# Unmodified fkeys (kf1-kf11), Shift fkeys (kf12-kf22), Ctrl fkeys (kf23-kf33), -+# Ctrl/Shift fdkeys (kf34-kf44). -+ -+dgkeys+8b|Private entry describing DG terminal 8-bit ANSI mode special keys, -+ ka1=\233020z, ka3=\233021z, kc1=\233022z, kc3=\233023z, -+ kclr=\2332J, kcub1=\233D, kcud1=\233B, kcuf1=\233C, -+ kcuu1=\233A, kel=\233K, kf1=\233001z, kf10=\233010z, -+ kf11=\233011z, kf12=\233012z, kf13=\233013z, -+ kf14=\233014z, kf15=\233000z, kf16=\233101z, -+ kf17=\233102z, kf18=\233103z, kf19=\233104z, -+ kf2=\233002z, kf20=\233105z, kf21=\233106z, -+ kf22=\233107z, kf23=\233108z, kf24=\233109z, -+ kf25=\233110z, kf26=\233111z, kf27=\233112z, -+ kf28=\233113z, kf29=\233114z, kf3=\233003z, -+ kf30=\233100z, kf31=\233201z, kf32=\233202z, -+ kf33=\233203z, kf34=\233204z, kf35=\233205z, -+ kf36=\233206z, kf37=\233207z, kf38=\233208z, -+ kf39=\233209z, kf4=\233004z, kf40=\233210z, -+ kf41=\233211z, kf42=\233212z, kf43=\233213z, -+ kf44=\233214z, kf45=\233200z, kf46=\233301z, -+ kf47=\233302z, kf48=\233303z, kf49=\233304z, -+ kf5=\233005z, kf50=\233305z, kf51=\233306z, -+ kf52=\233307z, kf53=\233308z, kf54=\233309z, -+ kf55=\233310z, kf56=\233311z, kf57=\233312z, -+ kf58=\233313z, kf59=\233314z, kf6=\233006z, -+ kf60=\233300z, kf7=\233007z, kf8=\233008z, kf9=\233009z, -+ khome=\233H, kprt=\233i, -+ -+dgkeys+7b|Private entry describing DG terminal 7-bit ANSI mode special keys, -+ ka1=\E[020z, ka3=\E[021z, kc1=\E[022z, kc3=\E[023z, -+ kclr=\E[2J, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, -+ kel=\E[K, kf1=\E[001z, kf10=\E[010z, kf11=\E[011z, -+ kf12=\E[012z, kf13=\E[013z, kf14=\E[014z, kf15=\E[000z, -+ kf16=\E[101z, kf17=\E[102z, kf18=\E[103z, kf19=\E[104z, -+ kf2=\E[002z, kf20=\E[105z, kf21=\E[106z, kf22=\E[107z, -+ kf23=\E[108z, kf24=\E[109z, kf25=\E[110z, kf26=\E[111z, -+ kf27=\E[112z, kf28=\E[113z, kf29=\E[114z, kf3=\E[003z, -+ kf30=\E[100z, kf31=\E[201z, kf32=\E[202z, kf33=\E[203z, -+ kf34=\E[204z, kf35=\E[205z, kf36=\E[206z, kf37=\E[207z, -+ kf38=\E[208z, kf39=\E[209z, kf4=\E[004z, kf40=\E[210z, -+ kf41=\E[211z, kf42=\E[212z, kf43=\E[213z, kf44=\E[214z, -+ kf45=\E[200z, kf46=\E[301z, kf47=\E[302z, kf48=\E[303z, -+ kf49=\E[304z, kf5=\E[005z, kf50=\E[305z, kf51=\E[306z, -+ kf52=\E[307z, kf53=\E[308z, kf54=\E[309z, kf55=\E[310z, -+ kf56=\E[311z, kf57=\E[312z, kf58=\E[313z, kf59=\E[314z, -+ kf6=\E[006z, kf60=\E[300z, kf7=\E[007z, kf8=\E[008z, -+ kf9=\E[009z, khome=\E[H, kprt=\E[i, -+ -+dgkeys+11|Private entry describing 11 minimal-subset DG mode special keys, -+ kclr=^L, kcub1=^Y, kcud1=^Z, kcuf1=^X, kcuu1=^W, kel=^K, -+ kf1=^^q, kf10=^^z, kf11=^^{, kf12=^^a, kf13=^^b, kf14=^^c, -+ kf15=^^d, kf16=^^e, kf17=^^f, kf18=^^g, kf19=^^h, kf2=^^r, -+ kf20=^^i, kf21=^^j, kf22=^^k, kf23=^^1, kf24=^^2, kf25=^^3, -+ kf26=^^4, kf27=^^5, kf28=^^6, kf29=^^7, kf3=^^s, kf30=^^8, -+ kf31=^^9, kf32=^^\:, kf33=^^;, kf34=^^!, kf35=^^", kf36=^^#, -+ kf37=^^$, kf38=^^%%, kf39=^^&, kf4=^^t, kf40=^^', kf41=^^(, -+ kf42=^^), kf43=^^*, kf44=^^+, kf5=^^u, kf6=^^v, kf7=^^w, -+ kf8=^^x, kf9=^^y, khome=^H, -+ -+dgkeys+15|Private entry describing 15 DG mode special keys, -+ kHOM=^^^H, kLFT=^^^Y, kRIT=^^^X, ka1=^^\\, ka3=^^], kc1=^^\^, -+ kc3=^^_, kf1=^^q, kf10=^^z, kf11=^^{, kf12=^^|, kf13=^^}, -+ kf14=^^~, kf15=^^p, kf16=^^a, kf17=^^b, kf18=^^c, kf19=^^d, -+ kf2=^^r, kf20=^^e, kf21=^^f, kf22=^^g, kf23=^^h, kf24=^^i, -+ kf25=^^j, kf26=^^k, kf27=^^l, kf28=^^m, kf29=^^n, kf3=^^s, -+ kf30=^^`, kf31=^^1, kf32=^^2, kf33=^^3, kf34=^^4, kf35=^^5, -+ kf36=^^6, kf37=^^7, kf38=^^8, kf39=^^9, kf4=^^t, kf40=^^\:, -+ kf41=^^;, kf42=^^<, kf43=^^=, kf44=^^>, kf45=^^0, kf46=^^!, -+ kf47=^^", kf48=^^#, kf49=^^$, kf5=^^u, kf50=^^%%, kf51=^^&, -+ kf52=^^', kf53=^^(, kf54=^^), kf55=^^*, kf56=^^+, kf57=^^\,, -+ kf58=^^-, kf59=^^., kf6=^^v, kf60=^^\s, kf7=^^w, kf8=^^x, -+ kf9=^^y, -+ -+# Data General color terminals use the "Tektronix" color model. The total -+# number of colors varies with the terminal model, as does support for -+# attributes used in conjunction with color. -+ -+# Removed u7, u8 definitions since they conflict with tack: -+# Preserve user-defined colors in at least some cases. -+# u7=^^Fh, -+# Default is ACM mode. -+# u8=^^F}20^^Fi^^F}21, -+# -+dgunix+fixed|Fixed color info for DG D430C terminals in DG-UNIX mode, -+ bce, -+ colors#16, ncv#53, pairs#256, -+ op=\036Ad\036Bd, -+ setab=\036B%p1%?%p1%{8}%<%t%{2}%&%?%p1%{1}%&%t%{4}%|%;%?%p1%{4}%&%t%{1}%|%;%;%{48}%+%c, -+ setaf=\036A%p1%?%p1%{8}%<%t%{2}%&%?%p1%{1}%&%t%{4}%|%;%?%p1%{4}%&%t%{1}%|%;%;%{48}%+%c, -+ setb=\036B%p1%{48}%+%c, setf=\036A%p1%{48}%+%c, -+ -+dg+fixed|Fixed color info for DG D430C terminals in DG mode, -+ use=dgunix+fixed, -+ -+# Video attributes are coordinated using static variables set by "sgr", then -+# checked by "op", "seta[bf]", and "set[bf]" to refresh the attribute settings. -+# (D=dim, U=underline, B=blink, R=reverse.) -+dg+color8|Color info for Data General D220 and D230C terminals in ANSI mode, -+ bce, -+ colors#8, ncv#16, pairs#64, -+ op=\E[%?%gD%t2;%;%?%gU%t4;%;%?%gB%t5;%;%?%gR%t7;%;m, -+ setab=\E[4%p1%d%?%gD%t;2%;%?%gU%t;4%;%?%gB%t;5%;%?%gR%t;7%;m, -+ setaf=\E[3%p1%d%?%gD%t;2%;%?%gU%t;4%;%?%gB%t;5%;%?%gR%t;7%;m, -+ setb=\E[4%p1%{2}%&%?%p1%{1}%&%t%{4}%|%;%?%p1%{4}%&%t%{1}%|%;%d%?%gD%t;2%;%?%gU%t;4%;%?%gB%t;5%;%?%gR%t;7%;m, -+ setf=\E[3%p1%{2}%&%?%p1%{1}%&%t%{4}%|%;%?%p1%{4}%&%t%{1}%|%;%d%?%gD%t;2%;%?%gU%t;4%;%?%gB%t;5%;%?%gR%t;7%;m, -+ -+dg+color|Color info for Data General D470C terminals in ANSI mode, -+ colors#16, ncv#53, pairs#256, -+ setab=\E[%?%p1%{8}%<%t4%p1%e=%p1%{2}%&%?%p1%{1}%&%t%{4}%|%;%?%p1%{4}%&%t%{1}%|%;%;%d%?%gD%t;2%;%?%gU%t;4%;%?%gB%t;5%;%?%gR%t;7%;m, -+ setaf=\E[%?%p1%{8}%<%t3%p1%e<%p1%{2}%&%?%p1%{1}%&%t%{4}%|%;%?%p1%{4}%&%t%{1}%|%;%;%d%?%gD%t;2%;%?%gU%t;4%;%?%gB%t;5%;%?%gR%t;7%;m, -+ setb=\E[%?%p1%{8}%<%t4%e=%;%p1%{2}%&%?%p1%{1}%&%t%{4}%|%;%?%p1%{4}%&%t%{1}%|%;%d%?%gD%t;2%;%?%gU%t;4%;%?%gB%t;5%;%?%gR%t;7%;m, -+ setf=\E[%?%p1%{8}%<%t3%e<%;%p1%{2}%&%?%p1%{1}%&%t%{4}%|%;%?%p1%{4}%&%t%{1}%|%;%d%?%gD%t;2%;%?%gU%t;4%;%?%gB%t;5%;%?%gR%t;7%;m, -+ use=dg+color8, -+ -+dgmode+color8|Color info for Data General D220/D230C terminals in DG mode, -+ bce, -+ colors#8, ncv#16, pairs#64, -+ op=\036Ad\036Bd, -+ setab=\036B%p1%{2}%&%?%p1%{1}%&%t%{4}%|%;%?%p1%{4}%&%t%{1}%|%;%{48}%+%c, -+ setaf=\036A%p1%{2}%&%?%p1%{1}%&%t%{4}%|%;%?%p1%{4}%&%t%{1}%|%;%{48}%+%c, -+ setb=\036B%p1%{48}%+%c, setf=\036A%p1%{48}%+%c, -+ -+dgmode+color|Color info for Data General D470C terminals in DG mode, -+ colors#16, pairs#256, -+ setab=\036B%p1%?%p1%{8}%<%t%{2}%&%?%p1%{1}%&%t%{4}%|%;%?%p1%{4}%&%t%{1}%|%;%;%{48}%+%c, -+ setaf=\036A%p1%?%p1%{8}%<%t%{2}%&%?%p1%{1}%&%t%{4}%|%;%?%p1%{4}%&%t%{1}%|%;%;%{48}%+%c, -+ use=dgmode+color8, -+ -+dgunix+ccc|Configurable color info for DG D430C terminals in DG-UNIX mode, -+ bce, ccc, -+ colors#52, ncv#53, pairs#26, -+ initp=\036RG0%p1%02X%p2%{255}%*%{1000}%/%02X%p3%{255}%*%{1000}%/%02X%p4%{255}%*%{1000}%/%02X%p5%{255}%*%{1000}%/%02X%p6%{255}%*%{1000}%/%02X%p7%{255}%*%{1000}%/%02X, -+ oc=\036RG01A00FF00000000\036RG01B00000000FF00\036RG01C007F00000000\036RG01D000000007F00, -+ op=\036RF4831A\036RF2E31B\036RF1D31C\036RF3F31D, -+ scp=\036RG2%p1%02X, -+ -+# Colors are in the order: normal, reverse, dim, dim + reverse. -+dg+ccc|Configurable color info for DG D430C terminals in DG mode, -+ bce, ccc, -+ colors#52, ncv#53, pairs#26, -+ initp=\036RG0%p1%{16}%/%{48}%+%c%p1%{16}%m%{48}%+%c%p2%{255}%*%{1000}%/%Pa%ga%{16}%/%{48}%+%c%ga%{16}%m%{48}%+%c%p3%{255}%*%{1000}%/%Pa%ga%{16}%/%{48}%+%c%ga%{16}%m%{48}%+%c%p4%{255}%*%{1000}%/%Pa%ga%{16}%/%{48}%+%c%ga%{16}%m%{48}%+%c%p5%{255}%*%{1000}%/%Pa%ga%{16}%/%{48}%+%c%ga%{16}%m%{48}%+%c%p6%{255}%*%{1000}%/%Pa%ga%{16}%/%{48}%+%c%ga%{16}%m%{48}%+%c%p7%{255}%*%{1000}%/%Pa%ga%{16}%/%{48}%+%c%ga%{16}%m%{48}%+%c, -+ oc=\036RG01\:00??00000000\036RG01;00000000??00\036RG01<007?00000000\036RG01=000000007?00, -+ op=\036RF4831\:\036RF2>31;\036RF1=31<\036RF3?31=, -+ scp=\036RG2%p1%{16}%/%{48}%+%c%p1%{16}%m%{48}%+%c, -+ -+# The generic DG terminal type (an 8-bit-clean subset of the 6053) -+# Initialization string 1 sets: -+# ^R - vertical scrolling enabled -+# ^C - blinking enabled -+dg-generic|Generic Data General terminal in DG mode, -+ am, bw, msgr, xon, -+ cols#80, lines#24, -+ bel=^G, blink=^N, clear=^L, cr=^M, cub1=^Y, cud1=^Z, cuf1=^X, -+ cup=\020%p2%c%p1%c, cuu1=^W, dim=^\, el=^K, ind=^J, is1=^R^C, -+ mc0=^Q, nel=^J, rmso=^], rmul=^U, sgr0=^O^U^], smso=^\, -+ smul=^T, use=dgkeys+11, -+ -+# According to the 4.4BSD termcap file, the dg200 <cup> should be the -+# termcap equivalent of \020%p2%{128}%+%c%p1%{128}%+%c (in termcap -+# notation that's "^P%r%+\200%+\200"). Those \200s are suspicious, -+# maybe they were originally nuls (which would fit). -+ -+dg200|data general dasher 200, -+ OTbs, am, bw, -+ cols#80, lines#24, -+ bel=^G, clear=^L, cr=^M, cub1=^Y, cud1=^Z, cuf1=^X, -+ cup=\020%p2%c%p1%c, cuu1=^W, el=^K, home=^H, ind=^J, -+ kcub1=^Y, kcud1=^Z, kcuf1=^X, kcuu1=^W, kf0=^^z, kf1=^^q, -+ kf2=^^r, kf3=^^s, kf4=^^t, kf5=^^u, kf6=^^v, kf7=^^w, kf8=^^x, -+ kf9=^^y, khome=^H, lf0=f10, nel=^J, rmso=^^E, rmul=^U, -+ smso=^^D, smul=^T, -+ -+# Data General 210/211 (and 410?) from Lee Pearson (umich!lp) via BRL -+dg210|dg-ansi|Data General 210/211, -+ am, -+ cols#80, lines#24, -+ OTnl=\E[B, clear=\E[2J, cub1=\E[D, cud1=\E[B, cuf1=\E[C, -+ cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, ed=\E[J, el=\E[K, -+ home=\E[H, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, -+ khome=\E[H, nel=\r\E[H\E[A\n, rmso=\E[0;m, rmul=\E[0;m, -+ smso=\E[7;m, smul=\E[4;m, -+# From: Peter N. Wan <ihnp4!gatech!gacsr!wan> -+# courtesy of Carlos Rucalde of Vantage Software, Inc. -+# (dg211: this had <cup=\020%r%.%>., which was an ancient termcap hangover. -+# I suspect the d200 function keys actually work on the dg211, check it out.) -+dg211|Data General d211, -+ cnorm=^L, cvvis=^L^R, ht=^I, ind@, kbs=^Y, kf0@, kf1@, kf2@, kf3@, -+ kf4@, kf5@, kf6@, kf7@, kf8@, kf9@, lf0@, nel=^M^Z, rmcup=^L, -+ rmso=\036E$<\0/>, smcup=^L^R, smso=\036D$<5/>, use=dg200, -+ -+# dg450 from Cornell (not official) -+dg450|dg6134|data general 6134, -+ cub1@, cuf1=^X, use=dg200, -+ -+# Not official... -+# Note: lesser Dasher terminals will not work with vi because vi insists upon -+# having a command to move straight down from any position on the bottom line -+# and scroll the screen up, or a direct vertical scroll command. The 460 and -+# above have both, the D210/211, for instance, has neither. We must use ANSI -+# mode rather than DG mode because standard UNIX tty drivers assume that ^H is -+# backspace on all terminals. This is not so in DG mode. -+# (dg460-ansi: removed obsolete ":kn#6:"; also removed ":mu=\EW:", on the -+# grounds that there is no matching ":ml:" -+dg460-ansi|Data General Dasher 460 in ANSI-mode, -+ OTbs, am, msgr, ul, -+ cols#80, it#8, lines#24, -+ OTnl=\ED, blink=\E[5m, clear=\E[2J, cub1=^H, cud1=\E[B, -+ cuf1=\E[C, cup=\E[%i%p1%2d;%p2%2dH, cuu1=\E[A, dch1=\E[P, -+ dim=\E[2m, dl1=\E[M, ed=\E[J, el=\E[K, home=\E[H, ht=^I, -+ ich1=\E[@, il1=\E[L, ind=\E[S, is2=^^F@, kbs=\E[D, -+ kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, -+ kf0=\E[001z, kf1=\E[002z, kf2=\E[003z, kf3=\E[004z, -+ kf4=\E[005z, kf5=\E[006z, kf6=\E[007z, kf7=\E[008z, -+ kf8=\E[009z, kf9=\E[00\:z, khome=\E[H, lf0=f1, lf1=f2, -+ lf2=f3, lf3=f4, lf4=f5, lf5=f6, lf6=f7, lf7=f8, lf9=f10, -+ mc0=\E[i, rev=\E[7m, ri=\E[T, rmso=\E[m, rmul=\E[05, -+ sgr=%?%p9%t\E(0%e\E(B%;\E[0%?%p5%t;2%;%?%p2%t;4%;%?%p4%t;5%;%?%p1%p3%|%t;7%;m, -+ sgr0=\E(B\E[m, smso=\E[7m, smul=\E[4m, u6=\E[%d;%dR, -+ u7=\E[6n, u8=\E[5n, u9=\E[0n, -+# From: Wayne Throop <mcnc!rti-sel!rtp47!throopw> (not official) -+# Data General 605x -+# Ought to work for a Model 6242, Type D210 as well as a 605x. -+# Note that the cursor-down key transmits ^Z. Job control users, beware! -+# This also matches a posted description of something called a `Dasher 100' -+# so there's a dg100 alias here. -+# (dg6053: the 4.4BSD file had <cub1=^H>, <cud1=^J>, <cuf1=^S>. -- esr) -+dg6053-old|dg100|data general 6053, -+ OTbs, am, bw, ul, -+ cols#80, lines#24, -+ OTbc=^Y, bel=^G, clear=^L, cnorm=^L, cr=^M, cub1=^Y, cud1=^Z, -+ cuf1=^X, cup=\020%p2%c%p1%c, cuu1=^W, cvvis=^L^R, el=^K, -+ home=^H, ht=^I, is2=^R, kbs=^Y, kcub1=^Y, kcud1=^Z, kcuf1=^X, -+ kcuu1=^W, kf0=^^q, kf1=^^r, kf2=^^s, kf3=^^t, kf4=^^u, kf5=^^v, -+ kf6=^^w, kf7=^^x, kf8=^^y, kf9=^^z, khome=^H, rmcup=^L, -+ rmso=\0^^E, rmul=^U, smcup=^L^R, smso=\0\0\0\0\0\036D, -+ smul=^T, -+ -+# (Some performance can be gained over the generic DG terminal type) -+dg6053|6053|6053-dg|dg605x|605x|605x-dg|d2|d2-dg|Data General DASHER 6053, -+ xon@, -+ home=^P\0\0, ll=^P\0^W, use=dg-generic, -+ -+# Like 6053, but adds reverse video and more keypad and function keys. -+d200|d200-dg|Data General DASHER D200, -+ bold=^^D^T, home@, ll@, rev=^^D, rmso=^^E^], -+ sgr=\036%?%p1%p3%|%p6%|%tD%eE%;%?%p2%p6%|%t\024%e\025%;%?%p4%t\016%e\017%;%?%p1%p5%|%t\034%e\035%;, -+ sgr0=\017\025\035\036E, smso=^^D^\, use=dgkeys+15, -+ use=dg6053, -+ -+# DASHER D210 series terminals in ANSI mode. -+# Reverse video, no insert/delete character/line, 7 bits/character only. -+# -+# Initialization string 1 sets: -+# <0 - scrolling enabled -+# <1 - blink enabled -+# <4 - print characters regardless of attributes -+d210|d214|Data General DASHER D210 series, -+ am, bw, msgr, xon, -+ cols#80, lines#24, -+ bel=^G, blink=\E[5m, bold=\E[4;7m, clear=\E[2J, cr=^M, -+ cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=\E[B, -+ cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, -+ cuu=\E[%p1%dA, cuu1=\E[A, dim=\E[2m, ed=\E[J, el=\E[K, -+ el1=\E[1K, home=\E[H, ind=^J, is1=\E[<0;<1;<4l, -+ ll=\E[H\E[A, nel=^J, rev=\E[7m, rmso=\E[m, rmul=\E[m, -+ sgr=\E[%?%p4%t5;%;%?%p2%p6%|%t4;%;%?%p1%p5%|%t2;%;%?%p1%p3%|%p6%|%t7;%;m, -+ sgr0=\E[m, smso=\E[2;7m, smul=\E[4m, use=dgkeys+7b, -+ -+# DASHER D210 series terminals in DG mode. -+# Like D200, but adds clear to end-of-screen and needs XON/XOFF. -+d210-dg|d214-dg|Data General DASHER D210 series in DG mode, -+ xon, -+ ed=^^FF, use=d200-dg, -+ -+# DASHER D211 series terminals in ANSI mode. -+# Like the D210, but with 8-bit characters and local printer support. -+# -+# Initialization string 2 sets: -+# \E[2;1;1;1v -+# 2;1 - 8 bit operations -+# 1;1 - 8 bit (international) keyboard language -+# \E(B - default primary character set (U.S. ASCII) -+# \E)4 - default secondary character set (international) -+# ^O - primary character set -+# -+d211|d215|Data General DASHER D211 series, -+ km, -+ is2=\E[2;1;1;1v\E(B\E)4\017, mc0=\E[i, use=dgkeys+8b, -+ use=d210, -+ -+# Initialization string 2 sets: -+# \E[2;0;1;0v -+# 2;0 - 7 bit operations -+# 1;0 - 7 bit (native) keyboard language -+# \E(0 - default character set (the keyboard native language) -+# ^O - primary character set -+d211-7b|d215-7b|Data General DASHER D211 series in 7 bit mode, -+ km@, -+ is2=\E[2;0;1;0v\E(0\017, use=dgkeys+7b, use=d211, -+ -+# Like the D210 series, but adds support for 8-bit characters. -+# -+# Reset string 2 sets: -+# ^^N - secondary character set -+# ^^FS0> - 8 bit international character set -+# ^^O - primary character set -+# ^^FS00 - default character set (matching the native keyboard language) -+# -+d211-dg|d215-dg|Data General DASHER D211 series in DG mode, -+ km, -+ rs2=\036N\036FS0>\036O\036FS00, use=d210-dg, -+ -+d216-dg|d216e-dg|d216+dg|d216e+dg|d217-dg|Data General DASHER D216 series in DG mode, -+ use=d211-dg, -+ -+# Enhanced DG mode with changes to be more UNIX compatible. -+d216-unix|d216e-unix|d216+|d216e+|Data General DASHER D216+ in DG-UNIX mode, -+ mc5i, -+ it#8, -+ acsc=a\177j$k"l!m#n)q+t'u&v(w%x*, blink=^^PI, -+ clear=^^PH, cub1=^^PD, cud1=^^PB, cuf1=^^PC, cuu1=^^PA, -+ el=^^PE, home=^^PF, hpa=\020%p1%c\177, ht=^I, ind=^J, -+ is1=\022\003\036P@1, is3=\036Fz0, kHOM=^^Pf, kLFT=^^Pd, -+ kPRT=^^P1, kRIT=^^Pc, kclr=^^PH, kcub1=^^PD, kcud1=^^PB, -+ kcuf1=^^PC, kcuu1=^^PA, kel=^^PE, khome=^^PF, kprt=^^P0, -+ mc0=\036F?9, mc4=^^Fa, mc5=^^F`, rmacs=\036FS00, -+ rs2=\036N\036FS0E\036O\036FS00, -+ sgr=\036%?%p1%p3%|%p6%|%tD%eE%;%?%p2%p6%|%t\024%e\025%;\036P%?%p4%tI%eJ%;%?%p1%p5%|%t\034%e\035%;\036FS%?%p9%t11%e00%;, -+ sgr0=\036PJ\025\035\036E\036FS00, smacs=\036FS11, -+ vpa=\020\177%p1%c, use=dgkeys+15, use=d216-dg, -+d216-unix-25|d216+25|Data General DASHER D216+ in DG-UNIX mode with 25 lines, -+ lines#25, -+ is3=\036Fz2, use=d216+, -+ -+d217-unix|Data General DASHER D217 in DG-UNIX mode, -+ use=d216-unix, -+d217-unix-25|Data General DASHER D217 in DG-UNIX mode with 25 lines, -+ use=d216-unix-25, -+ -+# DASHER D220 color terminal in ANSI mode. -+# Like the D470C but with fewer colors and screen editing features. -+# -+# Initialization string 1 sets: -+# \E[<0;<1;<4l -+# <0 - scrolling enabled -+# <1 - blink enabled -+# <4 - print characters regardless of attributes -+# \E[m - all attributes off -+# Reset string 1 sets: -+# \Ec - initial mode defaults (RIS) -+# -+d220|Data General DASHER D220, -+ mc5i@, -+ dl@, dl1@, il@, il1@, is1=\E[<0;<1;<4l\E[m, mc4@, mc5@, rs1=\Ec, -+ use=dg+color8, use=d470c, -+ -+d220-7b|Data General DASHER D220 in 7 bit mode, -+ mc5i@, -+ dl@, dl1@, il@, il1@, is1=\E[<0;<1;<4l\E[m, mc4@, mc5@, rs1=\Ec, -+ use=dg+color8, use=d470c-7b, -+ -+# Initialization string 3 sets: -+# - default cursor (solid rectangle) -+# Reset string 2 sets: -+# ^^N - secondary character set -+# ^^FS0> - 8 bit international character set -+# ^^O - primary character set -+# ^^FS00 - default character set (matching the native keyboard language) -+# -+d220-dg|Data General DASHER D220 color terminal in DG mode, -+ mc5i@, -+ dl1@, home@, il1@, is2@, is3=\036FQ2, ll@, mc4@, mc5@, rs1@, -+ rs2=\036N\036FS0>\036O\036FS00, use=dgmode+color8, -+ use=d470c-dg, -+ -+# DASHER D230C color terminal in ANSI mode. -+# Like the D220 but with minor ANSI compatibility improvements. -+# -+d230c|d230|Data General DASHER D230C, -+ blink=\E[5;50m, bold=\E[4;7;50m, dim=\E[2;50m, nel=^M^J, -+ rev=\E[7;50m, rmkx=\E[2;1v, rmso=\E[50m, rmul=\E[50m, -+ sgr=\E[50%?%p1%p3%|%p6%|%t;7%{1}%e%{0}%;%PR%?%p4%t;5%{1}%e%{0}%;%PB%?%p2%p6%|%t;4%{1}%e%{0}%;%PU%?%p1%p5%|%t;2%{1}%e%{0}%;%PDm\E)%?%p9%t6\016%e4\017%;, -+ sgr0=\E[50m\E)4\017, smkx=\E[2;0v, smso=\E[2;7;50m, -+ smul=\E[4;50m, use=dgkeys+7b, use=d220, -+ -+d230c-dg|d230-dg|Data General DASHER D230C in DG mode, -+ use=d220-dg, -+ -+# DASHER D400/D450 series terminals. -+# These add intelligent features like insert/delete to the D200 series. -+# -+# Initialization string 2 sets: -+# ^^FQ2 - default cursor (solid rectangle) -+# ^^FW - character protection disabled -+# ^^FJ - normal (80 column) mode -+# ^^F\^ - horizontal scrolling enabled (for alignment) -+# ^^FX004? - margins at columns 0 and 79 -+# ^^F] - horizontal scrolling disabled -+# ^^O - primary character set -+# ^^FS00 - default character set (the keyboard native language) -+# - (should reset scrolling regions, but that glitches the screen) -+# Reset string 1 sets: -+# ^^FA - all terminal defaults except scroll rate -+# Reset string 2 sets: -+# ^^F] - horizontal scrolling disabled -+# ^^FT0 - jump scrolling -+# -+d400|d400-dg|d450|d450-dg|Data General DASHER D400/D450 series, -+ mc5i, -+ acsc=j$k"l!m#n)q+t'u&v(w%x*, civis=\036FQ0, -+ cnorm=\036FQ2, dch1=^^K, dl1=^^FI, -+ enacs=\036N\036FS11\036O, home=^^FG, hpa=\020%p1%c\177, -+ ich1=^^J, il1=^^FH, -+ is2=\036FQ2\036FW\036FJ\036F\^\036FX004?\036F]\036O\036FS00, -+ ll=\036FG\027, mc4=^^Fa, mc5=^^F`, ri=^^I, rmacs=^^O, -+ rs1=^^FA, rs2=\036F]\036FT0, -+ sgr=\036%?%p1%p3%|%p6%|%tD%eE%;%?%p2%p6%|%t\024%e\025%;%?%p4%t\016%e\017%;%?%p1%p5%|%t\034%e\035%;\036%?%p9%tN%eO%;, -+ sgr0=\017\025\035\036E\036O, smacs=^^N, -+ vpa=\020\177%p1%c, use=d210-dg, -+ -+# DASHER D410/D460 series terminals in ANSI mode. -+# These add a large number of intelligent terminal features. -+# -+# Initialization string 1 sets: -+# \E[<0;<1;<2;<4l -+# <0 - scrolling enabled -+# <1 - blink enabled -+# <2 - horizontal scrolling enabled (for alignment) -+# <4 - print characters regardless of attributes -+# \E[5;0v - normal (80 column) mode -+# \E[1;1;80w - margins at columns 1 and 80 -+# \E[1;6;<2h -+# 1 - print all characters even if protected -+# 6 - character protection disabled -+# <2 - horizontal scrolling disabled -+# - (should reset scrolling regions, but that glitches the screen) -+# -+# Initialization string 2 sets: -+# \E[3;2;2;1;1;1v -+# 3;2 - default cursor (solid rectangle) -+# 2;1 - 8 bit operations -+# 1;1 - international keyboard language -+# \E(B - default primary character set (U.S. ASCII) -+# \E)4 - default secondary character set (international) -+# ^O - primary character set -+# -+# Reset string 1 sets: -+# \Ec - initial mode defaults (RIS) -+# \E[<2h - horizontal scrolling disabled -+# -+# Reset string 2 sets: -+# \E[4;0;2;1;1;1v -+# 4;0 - jump scrolling -+# 2;1 - 8 bit operations -+# 1;1 - 8 bit (international) keyboard language -+# \E(B - default primary character set (U.S. ASCII) -+# \E)4 - default secondary character set (international) -+# -+d410|d411|d460|d461|Data General DASHER D410/D460 series, -+ mc5i, -+ acsc=j$k"l!m#n)q+t'u&v(w%x*, civis=\E[3;0v, -+ cnorm=\E[3;2v, dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, -+ dl1=\E[M, ich=\E[%p1%d@, ich1=\E[@, il=\E[%p1%dL, il1=\E[L, -+ is1=\E[<0;<1;<2;<4l\E[5;0v\E[1;1;80w\E[1;6;<2h, -+ is2=\E[3;2;2;1;1;1v\E(B\E)4\017, mc4=\E[4i, mc5=\E[5i, -+ ri=\EM, rmacs=\E)4\017, rs1=\Ec\E[<2h, -+ rs2=\E[4;0;2;1;1;1v\E(B\E)4, -+ sgr=\E[%?%p1%t2;7%;%?%p3%t7;%;%?%p4%t5;%;%?%p2%t4;%;%?%p1%p5%|%t2;%;%?%p6%t4;7;%;m\E)%?%p9%t6\016%e4\017%;, -+ sgr0=\E[m\E)4\017, smacs=\E)6\016, use=d211, -+ -+# Initialization string 2 sets: -+# \E[3;2;2;0;1;0v -+# 3;2 - default cursor (solid rectangle) -+# 2;0 - 7 bit operations -+# 1;0 - 7 bit (native) keyboard language -+# \E(0 - default character set (the keyboard native language) -+# ^O - primary character set -+# -+# Reset string 2 sets: -+# \E[4;0;2;0;1;0v -+# 4;0 - jump scrolling -+# 2;0 - 7 bit operations -+# 1;0 - 7 bit (native) keyboard language -+# \E(0 - default character set (the keyboard native language) -+# -+d410-7b|d411-7b|d460-7b|d461-7b|Data General DASHER D410/D460 series in 7 bit mode, -+ km@, -+ enacs=\E)6, is2=\E[3;2;2;0;1;0v\E(0\017, rmacs=^O, -+ rs2=\E[4;0;2;0;1;0v\E(0, -+ sgr=\E[%?%p1%p3%|%p6%|%t7;%;%?%p4%t5;%;%?%p2%p6%|%t4;%;%?%p1%p5%|%t2;%;m%?%p9%t\016%e\017%;, -+ sgr0=\E[m\017, smacs=^N, use=dgkeys+7b, use=d410, -+ -+d410-dg|d460-dg|d411-dg|d461-dg|Data General DASHER D410/D460 series in DG mode, -+ km, -+ enacs@, rmacs=\036FS00, -+ sgr=\036%?%p1%p3%|%p6%|%tD%eE%;%?%p2%p6%|%t\024%e\025%;%?%p4%t\016%e\017%;%?%p1%p5%|%t\034%e\035%;\036FS%?%p9%t11%e00%;, -+ sgr0=\017\025\035\036E\036FS00, smacs=\036FS11, -+ use=d400-dg, -+ -+# DASHER D410/D460 series terminals in wide (126 columns) ANSI mode. -+# -+# Initialization string 1 sets: -+# \E[<0;<1;<2;<4l -+# <0 - scrolling enabled -+# <1 - blink enabled -+# <2 - horizontal scrolling enabled (for alignment) -+# <4 - print characters regardless of attributes -+# \E[5;1v - compressed (135 column) mode -+# \E[1;1;126 - margins at columns 1 and 126 -+# \E[1;6;<2h -+# 1 - print all characters even if protected -+# 6 - character protection disabled -+# <2 - horizontal scrolling disabled -+# - (should reset scrolling regions, but that glitches the screen) -+# -+# Reset string 1 sets: -+# \Ec - initial mode defaults (RIS) -+# \E[5;1v - compressed (135 column) mode -+# \E[1;1;126w - margins at columns 1 and 126 -+# \E[<2h - horizontal scrolling disabled -+# -+d410-w|d411-w|d460-w|d461-w|Data General DASHER D410/D460 series in wide mode, -+ cols#126, -+ is1=\E[<0;<1;<2;<4l\E[5;1v\E[1;1;126w\E[1;6;<2h, -+ rs1=\Ec\E[5;1v\E[1;1;126w\E[<2h, use=d410, -+ -+d410-7b-w|d411-7b-w|d460-7b-w|d461-7b-w|Data General DASHER D410/D460 series in wide 7 bit mode, -+ cols#126, -+ is1=\E[<0;<1;<2;<4l\E[5;1v\E[1;1;126w\E[1;6;<2h, -+ rs1=\Ec\E[5;1v\E[1;1;126w\E[<2h, use=d410-7b, -+ -+d412-dg|d462-dg|d462e-dg|d412+dg|d462+dg|d413-dg|d463-dg|Data General DASHER D412/D462 series in DG mode, -+ use=d410-dg, -+ -+# These add intelligent features like scrolling regions. -+d412-unix|d462-unix|d412+|d462+|Data General DASHER D412+/D462+ series in Unix mode, -+ civis=\036FQ0, clear=^^FE, cnorm=\036FQ5, -+ cup=\036FP%p2%2.2X%p1%2.2X, dch1=^^K, dl1=^^FI, -+ home=^^FG, hpa=\036FP%p1%2.2XFF, ich1=^^J, il1=^^FH, -+ is2=\036FQ5\036FW\036FJ\036F\^\036FX004F\036O\036FS00, -+ ll=\036FG\036PA, mc0=^A, rc=\036F}11, ri=^^I, -+ rs1=\036FA\036FT0, rs2=\036P@1, sc=\036F}10, -+ vpa=\036FPFF%p1%2.2X, -+ wind=\036FB%?%p1%t%p1%2.2X0%;%p2%p1%-%{1}%+%2.2X0%?%{23}%p2%>%t000%;\036FX%p3%2.2X%p4%2.2X, -+ use=d216+, -+d412-unix-w|d462-unix-w|d412+w|d462+w|Data General DASHER D412+/D462+ series in wide Unix mode, -+ cols#132, -+ is2=\036FQ5\036FW\036FK\036F\^\036FX0083\036O\036FS00, -+ rs2=\036P@1\036FK\036FX0083, -+ wind=\036FB%?%p1%t%p1%2.2X1%;%p2%p1%-%{1}%+%2.2X1%?%{23}%p2%>%t001%;\036FX%p3%2.2X%p4%2.2X, -+ use=d412-unix, -+d412-unix-25|d462-unix-25|d412+25|d462+25|Data General DASHER D412+/D462+ series in Unix mode with 25 lines, -+ lines#25, -+ is3=\036Fz2, -+ wind=\036FB%?%p1%t%p1%2.2X0%;%p2%p1%-%{1}%+%2.2X0%?%{24}%p2%>%t000%;\036FX%p3%2.2X%p4%2.2X, -+ use=d462+, -+d412-unix-s|d462-unix-s|d412+s|d462+s|Data General DASHER D412+/D462+ in Unix mode with status line, -+ eslok, hs, -+ clear=\036FG\036PH, fsl=\036F}01\022, -+ is3=\036Fz2\036F}00\036FB180000\036F}01, ll@, -+ tsl=\036F}00\036FP%p1%2.2X18\036PG, -+ wind=\036FB%?%p1%t%p1%2.2X0%;%p2%p1%-%{1}%+%2.2X0%?%{23}%p2%>%t%{23}%p2%-%2.2X0%;000\036FX%p3%2.2X%p4%2.2X, -+ use=d462+, -+ -+# Relative cursor motions are confined to the current window, -+# which is not what the scrolling region specification expects. -+# Thus, relative vertical cursor positioning must be deleted. -+d412-unix-sr|d462-unix-sr|d412+sr|d462+sr|Data General DASHER D412+/D462+ in Unix mode with scrolling region, -+ csr=\036FB%?%p1%t%p1%2.2X0%;%p2%p1%-%{1}%+%2.2X0%?%{23}%p2%>%t000%;, -+ cud1@, cuu1@, ll@, use=d462+, -+ -+d413-unix|d463-unix|Data General DASHER D413/D463 series in DG-UNIX mode, -+ use=d412-unix, -+d413-unix-w|d463-unix-w|Data General DASHER D413/D463 series in wide DG-UNIX mode, -+ use=d412-unix-w, -+d413-unix-25|d463-unix-25|Data General DASHER D413/D463 series in DG-UNIX mode with 25 lines, -+ use=d412-unix-25, -+d413-unix-s|d463-unix-s|Data General DASHER D413/D463 in DG-UNIX mode with status line, -+ use=d412-unix-s, -+d413-unix-sr|d463-unix-sr|Data General DASHER D413/D463 in DG-UNIX mode with scrolling region, -+ use=d412-unix-sr, -+ -+d414-unix|d464-unix|Data General D414/D464 in DG-UNIX mode, -+ use=d413-unix, -+d414-unix-w|d464-unix-w|Data General D414/D464 in wide DG-UNIX mode, -+ use=d413-unix-w, -+d414-unix-25|d464-unix-25|Data General D414/D464 in DG-UNIX mode with 25 lines, -+ use=d413-unix-25, -+d414-unix-s|d464-unix-s|Data General D414/D464 in DG-UNIX mode with status line, -+ use=d413-unix-s, -+d414-unix-sr|d464-unix-sr|Data General D414/D464 in DG-UNIX mode with scrolling region, -+ use=d413-unix-sr, -+ -+d430c-dg|d430-dg|Data General D430C in DG mode, -+ use=d413-dg, use=dg+fixed, -+d430c-dg-ccc|d430-dg-ccc|Data General D430C in DG mode with configurable colors, -+ use=d413-dg, use=dg+ccc, -+ -+d430c-unix|d430-unix|Data General D430C in DG-UNIX mode, -+ use=d413-unix, use=dgunix+fixed, -+d430c-unix-w|d430-unix-w|Data General D430C in wide DG-UNIX mode, -+ use=d413-unix-w, use=dgunix+fixed, -+d430c-unix-25|d430-unix-25|Data General D430C in DG-UNIX mode with 25 lines, -+ use=d413-unix-25, use=dgunix+fixed, -+d430c-unix-s|d430-unix-s|Data General D430C in DG-UNIX mode with status line, -+ use=d413-unix-s, use=dgunix+fixed, -+d430c-unix-sr|d430-unix-sr|Data General D430C in DG-UNIX mode with scrolling region, -+ use=d413-unix-sr, use=dgunix+fixed, -+d430c-unix-ccc|d430-unix-ccc|Data General D430C in DG-UNIX mode with configurable colors, -+ use=d413-unix, use=dgunix+ccc, -+d430c-unix-w-ccc|d430-unix-w-ccc|Data General D430C in wide DG-UNIX mode with configurable colors, -+ use=d413-unix-w, use=dgunix+ccc, -+d430c-unix-25-ccc|d430-unix-25-ccc|Data General D430C in DG-UNIX mode with 25 lines and configurable colors, -+ use=d413-unix-25, use=dgunix+ccc, -+d430c-unix-s-ccc|d430-unix-s-ccc|Data General D430C in DG-UNIX mode with status line and configurable colors, -+ use=d413-unix-s, use=dgunix+ccc, -+d430c-unix-sr-ccc|d430-unix-sr-ccc|Data General D430C in DG-UNIX mode with scrolling region and configurable colors, -+ use=d413-unix-sr, use=dgunix+ccc, -+ -+# DASHER D470C color terminal in ANSI mode. -+# Like the D460 but with 16 colors and without a compressed mode. -+# -+# Initialization string 1 sets: -+# \E[<0;<1;<2;<4l -+# <0 - scrolling enabled -+# <1 - blink enabled -+# <2 - horizontal scrolling enabled (for alignment) -+# <4 - print characters regardless of attributes -+# \E[1;1;80w - margins at columns 1 and 80 -+# \E[1;6;<2h -+# 1 - print all characters even if protected -+# 6 - character protection disabled -+# <2 - horizontal scrolling disabled -+# - (should reset scrolling regions, but that glitches the screen) -+# -+d470c|d470|Data General DASHER D470C, -+ is1=\E[<0;<1;<2;<4l\E[1;1;80w\E[1;6;<2h, -+ sgr=\E[%?%p3%t7;%;%?%p4%t5;%;%?%p2%t4;%;%?%p6%t4;7;%;%?%p1%t2;7;%;%?%p5%t2;%;m\E)%?%p9%t6\016%e4\017%;, -+ use=dg+color, use=d460, -+ -+d470c-7b|d470-7b|Data General DASHER D470C in 7 bit mode, -+ is1=\E[<0;<1;<2;<4l\E[1;1;80w\E[1;6;<2h, -+ sgr=\E[%?%p3%t7;%;%?%p4%t5;%;%?%p2%t4;%;%?%p6%t4;7;%;%?%p1%t2;7;%;%?%p5%t2;%;m%?%p9%t\016%e\017%;, -+ use=dg+color, use=d460-7b, -+ -+# Initialization string 2 sets: -+# ^^FQ2 - default cursor (solid rectangle) -+# ^^FW - character protection disabled -+# ^^F\^ - horizontal scrolling enabled (for alignment) -+# ^^FX004? - margins at columns 0 and 79 -+# ^^F] - horizontal scrolling disabled -+# ^^O - primary character set -+# ^^FS00 - default character set (the keyboard native language) -+# - (should reset scrolling regions, but that glitches the screen) -+# -+d470c-dg|d470-dg|Data General DASHER D470C in DG mode, -+ is2=\036FQ2\036FW\036F\^\036FX004?\036F]\036O\036FS00, -+ use=dgmode+color, use=d460-dg, -+ -+# DASHER D555 terminal in ANSI mode. -+# Like a D411, but has an integrated phone. -+d555|Data General DASHER D555, -+ use=d411, -+d555-7b|Data General DASHER D555 in 7-bit mode, -+ use=d411-7b, -+d555-w|Data General DASHER D555 in wide mode, -+ use=d411-w, -+d555-7b-w|Data General DASHER D555 in wide 7-bit mode, -+ use=d411-7b-w, -+d555-dg|Data General DASHER D555 series in DG mode, -+ use=d411-dg, -+ -+# DASHER D577 terminal in ANSI mode. -+# Like a D411, but acts as a keyboard for serial printers ("KSR" modes). -+d577|Data General DASHER D577, -+ use=d411, -+d577-7b|Data General DASHER D577 in 7-bit mode, -+ use=d411-7b, -+d577-w|Data General DASHER D577 in wide mode, -+ use=d411-w, -+d577-7b-w|Data General DASHER D577 in wide 7-bit mode, -+ use=d411-7b-w, -+ -+d577-dg|d578-dg|Data General DASHER D577/D578 series in DG mode, -+ use=d411-dg, -+ -+# DASHER D578 terminal. -+# Like a D577, but without compressed mode; like a D470C in this respect. -+# -+# Initialization string 1 sets: -+# \E[<0;<1;<2;<4l -+# <0 - scrolling enabled -+# <1 - blink enabled -+# <2 - horizontal scrolling enabled (for alignment) -+# <4 - print characters regardless of attributes -+# \E[1;1;80w - margins at columns 1 and 80 -+# \E[1;6;<2h -+# 1 - print all characters even if protected -+# 6 - character protection disabled -+# <2 - horizontal scrolling disabled -+# - (should reset scrolling regions, but that glitches the screen) -+# -+d578|Data General DASHER D578, -+ is1=\E[<0;<1;<2;<4l\E[1;1;80w\E[1;6;<2h, use=d577, -+d578-7b|Data General DASHER D578 in 7-bit mode, -+ is1=\E[<0;<1;<2;<4l\E[1;1;80w\E[1;6;<2h, use=d577-7b, -+ -+#### Datamedia (dm) -+# -+# Datamedia was headquartered in Nashua, New Hampshire until it went -+# out of business in 1993, but the ID plates on the terminals referred -+# to the factory in Pennsauken, NJ. The factory was sold to a PCB board -+# manufacturer which threw out all information about the terminals. -+# -+ -+cs10|colorscan|Datamedia Color Scan 10, -+ msgr, -+ cols#80, lines#24, -+ bel=^G, clear=\E[H\E[J, cr=^M, cub1=^H, cud1=^J, cuf1=\E[C, -+ cup=\E[%i%p1%02d;%p2%02dH, cuu1=\E[A, ed=\E[J, el=\E[K, -+ ind=^J, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, -+ kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, rmso=\E[m, rmul=\E[m, -+ sgr0=\E[m, smso=\E[7m, smul=\E[4m, -+cs10-w|Datamedia Color Scan 10 with 132 columns, -+ cols#132, -+ cup=\E[%i%p1%02d;%p2%03dH, use=cs10, -+ -+# (dm1520: removed obsolete ":ma=^\ ^_^P^YH:" -- esr) -+dm1520|dm1521|datamedia 1520, -+ OTbs, am, xenl, -+ cols#80, it#8, lines#24, -+ bel=^G, clear=^L, cr=^M, cub1=^H, cud1=^J, cuf1=^\, -+ cup=\036%p2%{32}%+%c%p1%{32}%+%c, cuu1=^_, ed=^K, el=^], -+ home=^Y, ht=^I, ind=^J, kcub1=^H, kcud1=^J, kcuf1=^\, kcuu1=^_, -+ khome=^Y, -+# dm2500: this terminal has both <ich> and <smir>. Applications using -+# termcap/terminfo directly (rather than through ncurses) might be confused. -+dm2500|datamedia2500|datamedia 2500, -+ OTbs, OTnc, -+ cols#80, lines#24, -+ bel=^G, clear=^^^^\177, cub1=^H, cud1=^J, cuf1=^\, -+ cup=\014%p2%{96}%^%c%p1%{96}%^%c, cuu1=^Z, -+ dch1=\020\010\030\035$<10*>, -+ dl1=\020\032\030\035$<10*>, el=^W, home=^B, -+ ich1=\020\034\030\035$<10*>, -+ il1=\020\n\030\035\030\035$<15>, ind=^J, pad=\377, -+ rmdc=^X^], rmir=\377\377\030\035$<10>, rmso=^X^], -+ smdc=^P, smir=^P, smso=^N, -+# dmchat is like DM2500, but DOES need "all that padding" (jcm 1/31/82) -+# also, has a meta-key. -+# From: <goldberger@su-csli.arpa> -+# (dmchat: ":MT:" changed to ":km:" -- esr) -+dmchat|dmchat version of datamedia 2500, -+ km, -+ dl1=\020\032\030\035$<2/>, -+ il1=\020\n\030\035\030\035$<1*/>, use=dm2500, -+# (dm3025: ":MT:" changed to ":km:" -- esr) -+dm3025|datamedia 3025a, -+ OTbs, km, -+ cols#80, it#8, lines#24, -+ bel=^G, clear=\EM$<2>, cr=^M, cub1=^H, cud1=^J, cuf1=\EC, -+ cup=\EY%p2%{32}%+%c%p1%{32}%+%c, cuu1=\EA, -+ dch1=\010$<6>, dl1=\EP\EA\EQ$<130>, ed=\EJ$<2>, el=\EK, -+ home=\EH, ht=^I, il1=\EP\n\EQ$<130>, ind=^J, ip=$<6>, -+ is2=\EQ\EU\EV, rmdc=\EQ, rmir=\EQ, rmso=\EO0, smdc=\EP, -+ smir=\EP, smso=\EO1, -+dm3045|datamedia 3045a, -+ OTbs, am, eo, km@, ul, xenl, -+ dch1=\EB$<6>, dl1@, il1@, is2=\EU\EV, kcuf1=\EC, kcuu1=\EA, -+ kf0=\Ey\r, kf1=\Ep\r, kf2=\Eq\r, kf3=\Er\r, kf4=\Es\r, -+ kf5=\Et\r, kf6=\Eu\r, kf7=\Ev\r, kf8=\Ew\r, kf9=\Ex\r, -+ khome=\EH, pad=\177, rmdc@, rmir=\EP, rmso@, smdc@, smso@, -+ use=dm3025, -+# Datamedia DT80 soft switches: -+# 1 0=Jump 1=Smooth -+# Autorepeat 0=off 1=on -+# Screen 0=Dark 1=light -+# Cursor 0=u/l 1=block -+# -+# 2 Margin Bell 0=off 1=on -+# Keyclick 0=off 1=on -+# Ansi/VT52 0=VT52 1=Ansi -+# Xon/Xoff 0=Off 1=On -+# -+# 3 Shift3 0=Hash 1=UK Pound -+# Wrap 0=Off 1=On -+# Newline 0=Off 1=On -+# Interlace 0=Off 1=On -+# -+# 4 Parity 0=Odd 1=Even -+# Parity 0=Off 1=On -+# Bits/Char 0=7 1=8 -+# Power 0=60Hz 1=50Hz -+# -+# 5 Line Interface 0=EIA 1=Loop -+# Aux Interface 0=EIA 1=Loop -+# Local Copy 0=Off 1=On -+# Spare -+# -+# 6 Aux Parity 0=Odd 1=Even -+# Aux Parity 0=Off 1=On -+# Aux Bits/Char 0=7 1=8 -+# CRT Saver 0=Off 1=On -+# dm80/1 is a vt100 lookalike, but it doesn't seem to need any padding. -+dm80|dmdt80|dt80|datamedia dt80/1, -+ clear=\E[2J\E[H, cud1=^J, cuf1=\E[C, -+ cup=%i\E[%p1%d;%p2%dH, cuu1=\E[A, ed=\E[J, el=\E[K, -+ home=\E[H, mc0=\E[0i, mc4=\E[4i, mc5=\E[5i, ri=\EM, -+ rmso=\E[m, rmul=\E[m, sgr0=\E[m, smso=\E[7m, smul=\E[4m, -+ use=vt100, -+# except in 132 column mode, where it needs a little padding. -+# This is still less padding than the vt100, and you can always turn on -+# the ^S/^Q handshaking, so you can use vt100 flavors for things like -+# reverse video. -+dm80w|dmdt80w|dt80w|datamedia dt80/1 in 132 char mode, -+ cols#132, -+ clear=\E[H\E[2J$<50/>, cud1=^J, -+ cup=\E[%i%p1%d;%p2%dH$<5/>, cuu1=\E[A$<5/>, -+ ed=\E[0J$<20/>, el=\E[0K$<20/>, use=dm80, -+# From: Adam Thompson <athompso@pangea.ca> Sept 10 1995 -+dt80-sas|Datamedia DT803/DTX for SAS usage, -+ am, bw, -+ cols#80, lines#24, -+ acsc=``a1fxgqh0jYk?lZm@nEooppqDrrsstCu4vAwBx3yyzz{{||}}~~, -+ bel=^G, clear=^L, cr=^M, -+ csr=\E=%p1%{32}%+%c%{32}%c\E#1\E=%p2%{32}%+%c%{32}%c\E#2, -+ cub1=^H, cud1=\EB, cuf1=^\, -+ cup=\E=%p2%{32}%+%c%p1%{32}%+%c, cuu1=^_, dl1=\EM, ed=^K, -+ el=^], ff=^L, home=^Y, ht=^I, hts=\E'1, il1=\EL, ind=\EB, -+ is2=\E)0\E<\EP\E'0\E$2, kclr=^L, kcub1=^H, kcud1=^J, -+ kcuf1=^\, kcuu1=^_, ked=^K, kel=^], khome=^Y, mc4=^O, mc5=^N, -+ rev=\E$2\004, ri=\EI, rmacs=\EG, rmso=^X, sgr0=^X, smacs=\EF, -+ smso=\E$2\004, tbc=\E'0, -+ -+# Datamedia Excel 62, 64 from Gould/SEL UTX/32 via BRL -+# These aren't end-all Excel termcaps; but do insert/delete char/line -+# and name some of the extra function keys. (Mike Feldman ccvaxa!feldman) -+# The naming convention has been bent somewhat, with the use of E? (where -+# E is for 'Excel') as # a name. This was done to distinguish the entries -+# from the other Datamedias in use here, and yet to associate a model of -+# the Excel terminals with the regular datamedia terminals that share -+# major characteristics. -+excel62|excel64|datamedia Excel 62, -+ dch1=\E[P, kbs=^H, kcub1=^H, kcud1=^J, kf5=\EOu, kf6=\EOv, -+ kf7=\EOw, kf8=\EOx, kf9=\EOy, rmir=\E[4l, smir=\E[4h, -+ use=dt80, -+excel62-w|excel64-w|datamedia Excel 62 in 132 char mode, -+ dch1=\E[P, kbs=^H, kcub1=^H, kcud1=^J, kf5=\EOu, kf6=\EOv, -+ kf7=\EOw, kf8=\EOx, kf9=\EOy, rmir=\E[4l, smir=\E[4h, -+ use=dt80w, -+excel62-rv|excel64-rv|datamedia Excel 62 in reverse video mode, -+ dch1=\E[P, flash=\E[?5l\E[?5h, kbs=^H, kcub1=^H, kcud1=^J, -+ kf5=\EOu, kf6=\EOv, kf7=\EOw, kf8=\EOx, kf9=\EOy, rmir=\E[4l, -+ smir=\E[4h, use=dt80, -+ -+#### Falco -+# -+# Falco Data Products -+# 440 Potrero Avenue -+# Sunnyvale, CA 940864-196 -+# Vox: (800)-325-2648 -+# Fax: (408)-745-7860 -+# Net: techsup@charm.sys.falco.com -+# -+# Current Falco models as of 1995 are generally ANSI-compatible and support -+# emulations of DEC VT-series, Wyse, and Televideo types. -+# -+ -+# Test version for Falco ts-1. See <arpavax.hickman@ucb> for info -+# This terminal was released around 1983 and was discontinued long ago. -+# The standout and underline highlights are the same. -+falco|ts1|ts-1|falco ts-1, -+ OTbs, am, -+ cols#80, it#8, lines#24, -+ bel=^G, clear=\E*, cr=^M, cub1=^H, cud1=^J, cuf1=^L, -+ cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW, -+ dl1=\ER, ed=\EY, el=\ET\EG0\010, home=^^, ht=^I, il1=\EE, -+ ind=^J, is2=\Eu\E3, kcub1=^H, kcud1=^J, kcuf1=^L, kcuu1=^K, -+ kf0=^A0\r, rmir=\Er, rmso=\Eg0, rmul=\Eg0, sgr0=\Eg0, -+ smir=\Eq, smso=\Eg1, smul=\Eg1, -+falco-p|ts1p|ts-1p|falco ts-1 with paging option, -+ OTbs, am, da, db, mir, msgr, ul, -+ cols#80, it#8, lines#24, -+ bel=^G, cbt=\EI, clear=\E*, cr=^M, cub1=^H, cud1=\E[B, -+ cuf1=\E[C, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=\E[A, -+ dch1=\EW, dl1=\ER, ed=\EY, el=\ET\EG0\010\Eg0, ht=^I, -+ il1=\EE, ind=^J, is2=\EZ\E3\E_c, kcub1=\E[D, kcud1=\E[B, -+ kcuf1=\E[C, kcuu1=\E[A, khome=\E[H, rmcup=\E_b, rmir=\Er, -+ rmso=\Eg0, rmul=\Eg0, sgr0=\Eg0, smcup=\E_d, smir=\Eq, -+ smso=\Eg4, smul=\Eg1, -+# (ts100: I added <rmam>/<smam> based on the init string -- esr) -+ts100|ts100-sp|falco ts100-sp, -+ am, mir, msgr, xenl, xon, -+ cols#80, it#8, lines#24, vt#3, -+ acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -+ bel=^G, blink=\E[5m$<2>, bold=\E[1m$<2>, -+ clear=\E[H\E[J$<50>, cr=^M, csr=\E[%i%p1%d;%p2%dr, -+ cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=^J, -+ cuf=\E[%p1%dC, cuf1=\E[C$<2>, -+ cup=\E[%i%p1%d;%p2%dH$<5>, cuu=\E[%p1%dA, -+ cuu1=\E[A$<2>, dch1=\E~W, dl1=\E~R, ed=\E[J$<50>, -+ el=\E[K$<3>, el1=\E[1K$<3>, enacs=\E(B\E)0, home=\E[H, -+ ht=^I, hts=\EH, ich1=\E~Q, il1=\E~E, ind=^J, is1=\E~)\E~ea, -+ kbs=^H, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, -+ rc=\E8, rev=\E[7m$<2>, ri=\EM$<5>, rmacs=^O, rmam=\E[?7l, -+ rmkx=\E[?1l\E>, rmso=\E[m$<2>, rmul=\E[m$<2>, -+ rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sc=\E7, -+ sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;$<2>, -+ sgr0=\E[m\017$<2>, smacs=^N, smam=\E[?7h, smkx=\E[?1h\E=, -+ smso=\E[1;7m$<2>, smul=\E[4m$<2>, tbc=\E[3g, -+ use=vt100+fnkeys, -+ts100-ctxt|falco ts-100 saving context, -+ rmcup=\E~_b, smcup=\E~_d\E[2J, use=ts100, -+ -+#### Florida Computer Graphics -+# -+ -+# Florida Computer Graphics Beacon System, using terminal emulator program -+# "host.com", as provided by FCG. This description is for an early release -+# of the "host" program. Known bug: <ed> clears the whole screen, so it's -+# commented out. -+ -+# From: David Bryant <cbosg!djb> 1/7/83 -+beacon|FCG Beacon System, -+ am, da, db, -+ cols#80, lines#32, -+ bel=\ESTART\r\E37\r\EEND\r$<1>, -+ blink=\ESTART\r\E61\,1\r\EEND\r, clear=\EZ$<10>, cr=^M, -+ cub1=^H, cud1=^J, cuf1=\EV, -+ cup=\E=%p1%{32}%+%c%p2%{32}%+%c$<20>, cuu1=\EU, -+ dch1=\EW, dl1=\ER, el=\ET, home=\EH$<10>, ich1=\EQ, il1=\EE, -+ ind=^J, rev=\ESTART\r\E59\,1\r\EEND\r, rmcup=, -+ rmso=\ESTART\r\E70\,0\r\EEND\r$<20>, -+ rmul=\ESTART\r\E60\,0\r\EEND\r, -+ sgr0=\ESTART\r\E78\r\E70\,0\r\EEND\r$<20>, -+ smcup=\ESTART\r\E2\,0\r\E12\r\EEND\r$<10>, -+ smso=\ESTART\r\E70\,6\r\EEND\r$<20>, -+ smul=\ESTART\r\E60\,1\r\EEND\r, -+ -+#### Fluke -+# -+ -+# The f1720a differences from ANSI: no auto margin, destructive -+# tabs, # of lines, funny highlighting and underlining -+f1720|f1720a|fluke 1720A, -+ xt, -+ cols#80, lines#16, xmc#1, -+ bel=^G, clear=\E[H\E[2J, cr=^M, cub1=^H, cud1=\E[B, -+ cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, ed=\E[J, -+ el=\E[K, ind=\ED, is2=\E[H\E[2J, kcub1=^_, kcud1=^], -+ kcuf1=^^, kcuu1=^\, ri=\EM, rmso=\E[m, rmul=\E[m, sgr0=\E[m, -+ smso=\E[7m, smul=\E[4m, -+ -+#### Liberty Electronics (Freedom) -+# -+# Liberty Electronics -+# 48089 Fremont Blvd -+# Fremont CA 94538 -+# Vox: (510)-623-6000 -+# Fax: (510)-623-7021 -+ -+# From: <faletti@berkeley.edu> -+# (f100: added empty <acsc> to suppress a tic warning; -+# made this relative to adm+sgr -- note that <invis> isn't -+# known to work for f100 but does on the f110. --esr) -+f100|freedom|freedom100|freedom model 100, -+ OTbs, am, bw, hs, mir, msgr, xon, -+ cols#80, lines#24, -+ acsc=, bel=^G, cbt=\EI, clear=^Z, cr=^M, cub1=^H, cud1=^J, -+ cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, -+ dch1=\EW, dl1=\ER$<11.5*>, dsl=\Eg\Ef\r, ed=\EY, el=\ET, -+ flash=\Eb$<200>\Ed, fsl=^M, home=^^, hpa=\E]%p1%{32}%+%c, -+ ht=^I, hts=\E1, il1=\EE$<8.5*>, ind=^J, ip=$<6>, -+ is2=\Eg\Ef\r\Ed, kbs=^H, kcbt=\EI, kcub1=^H, kcud1=^V, -+ kcuf1=^L, kcuu1=^K, kf1=^A@\r, kf10=^AI\r, kf2=^AA\r, -+ kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, kf6=^AE\r, kf7=^AF\r, -+ kf8=^AG\r, kf9=^AH\r, khome=^^, ri=\Ej, rmacs=\E$, rmir=\Er, -+ smacs=\E%%, smir=\Eq, tbc=\E3, tsl=\Eg\Ef, -+ vpa=\E[%p1%{32}%+%c, use=adm+sgr, -+f100-rv|freedom-rv|freedom 100 in reverse video, -+ flash=\Ed$<200>\Eb, is2=\Eg\Ef\r\Eb, use=f100, -+# The f110 and f200 have problems with vi(1). They use the ^V -+# code for the down cursor key. When kcud1 is defined in terminfo -+# as ^V, the Control Character Quoting capability (^V in insert mode) -+# is lost! It cannot be remapped in vi because it is necessary to enter -+# a ^V to to quote the ^V that is being remapped!!! -+# -+# f110/f200 users will have to decide whether -+# to lose the down cursor key or the quoting capability. We will opt -+# initially for leaving the quoting capability out, since use of VI -+# is not generally applicable to most interactive applications -+# (f110: added <ht>, <khome> & <kcbt> from f100 -- esr) -+f110|freedom110|Liberty Freedom 110, -+ bw@, eslok, -+ it#8, wsl#80, -+ blink=\EG2, bold=\EG0, civis=\E.1, cnorm=\E.2, cud1=^V, -+ dim=\EG@, dl1=\ER, dsl=\Ef\r, flash=\Eb$<200/>\Ed, il1=\EE, -+ ip@, is2@, kclr=^^, kdch1=\EW, kdl1=\ER, ked=\EY, kel=\ET, -+ kf0=^AI\r, kf10@, kich1=\EQ, kil1=\EE, mc4=\Ea, mc5=\E`, -+ ri=\EJ, rmacs=\E%%, rmir=\Er\EO, smacs=\E$, smir=\EO\Eq, -+ smso=\EG<, tsl=\Ef, use=f100, -+f110-14|Liberty Freedom 110 14inch, -+ dch1@, use=f110, -+f110-w|Liberty Freedom 110 - 132 cols, -+ cols#132, use=f110, -+f110-14w|Liberty Freedom 110 14in/132 cols, -+ cols#132, -+ dch1@, use=f110, -+# (f200: added <acsc> to suppress tic warnings re <smacs>/<rmacs> --esr) -+f200|freedom200|Liberty Freedom 200, -+ OTbs, am, eslok, hs, mir, msgr, xon, -+ cols#80, it#8, lines#24, wsl#80, -+ acsc=, bel=^G, blink=\EG2, bold=\EG0, cbt=\EI, civis=\E.0, -+ clear=^Z, cnorm=\E.1, cr=^M, -+ csr=\Em0%p1%{32}%+%c%p2%{32}%+%c, cub1=^H, cud1=^V, -+ cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, -+ dch1=\EW, dim=\EG@, dl1=\ER, dsl=\Ef\r, ed=\EY, el=\ET, -+ flash=\Eo$<200/>\En, fsl=^M, home=^^, -+ hpa=\E]%p1%{32}%+%c, hts=\E1, il1=\EE, ind=^J, kbs=^H, -+ kclr=^^, kcub1=^H, kcud1=^V, kcuf1=^L, kcuu1=^K, kdch1=\EW, -+ kdl1=\ER, ked=\EY, kel=\ET, kf0=^AI\r, kf1=^A@\r, kf2=^AA\r, -+ kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, kf6=^AE\r, kf7=^AF\r, -+ kf8=^AG\r, kf9=^AH\r, kich1=\EQ, kil1=\EE, mc4=\Ea, mc5=\E`, -+ ri=\EJ, rmacs=\E%%, rmir=\Er, smacs=\E$, smir=\Eq, smso=\EG<, -+ tbc=\E3, tsl=\Ef, vpa=\E[%p1%{32}%+%c, use=adm+sgr, -+f200-w|Liberty Freedom 200 - 132 cols, -+ cols#132, use=f200, -+# The f200 has the ability to reprogram the down cursor key. The key is -+# reprogrammed to ^J (linefeed). This value is remembered in non-volatile RAM, -+# so powering the terminal off and on will not cause the change to be lost. -+f200vi|Liberty Freedom 200 for vi, -+ flash=\Eb$<200/>\Ed, kcud1=^J, use=f200, -+f200vi-w|Liberty Freedom 200 - 132 cols for vi, -+ cols#132, use=f200vi, -+ -+#### GraphOn (go) -+# -+# Graphon Corporation -+# 544 Division Street -+# Campbell, CA 95008 -+# Vox: (408)-370-4080 -+# Fax: (408)-370-5047 -+# Net: troy@graphon.com (Troy Morrison) -+# -+# -+# The go140 and go225 have been discontinued. GraphOn now makes X terminals, -+# including one odd hybrid that starts out life on power-up as a character -+# terminal, than can be switched to X graphics mode (driven over the serial -+# line) by an escape sequence. No info on this beast yet. -+# (go140: I added <rmam>/<smam> based on the init string -- esr) -+go140|graphon go-140, -+ OTbs, -+ cols#80, it#8, lines#24, -+ clear=\E[H\E[2J$<10/>, cub1=^H, cud1=\E[B, cuf1=\E[C, -+ cup=\E[%i%p1%2d;%p2%2dH, cuu1=\E[A, dch1=\E[P, dl1=\E[M, -+ ed=\E[J$<10/>, el=\E[K, ht=^I, -+ if=/usr/share/tabset/vt100, il1=\E[L, -+ is2=\E<\E=\E[?3l\E[?7l\E(B\E[J\E7\E[;r\E8\E[m\E[q, -+ kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kf1=\EOP, -+ kf2=\EOQ, kf3=\EOR, kf4=\EOS, khome=\E[H, ri=\EM, -+ rmam=\E[?7l, rmir=\E[4l, rmkx=\E[?1l\E>, rmso=\E[m, -+ rmul=\E[m, sgr0=\E[m, smam=\E[?7h, smir=\E[4h, -+ smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, -+go140w|graphon go-140 in 132 column mode, -+ am, -+ cols#132, -+ is2=\E<\E=\E[?3h\E[?7h\E(B\E[J\E7\E[;r\E8\E[m\E[q, -+ use=go140, -+# Hacked up vt200 termcap to handle GO-225/VT220 -+# From: <edm@nwnexus.WA.COM> -+# (go225: I added <rmam>/<smam> based on the init string -- esr) -+go225|go-225|Graphon 225, -+ OTbs, am, mir, xenl, -+ cols#80, it#8, lines#25, vt#3, -+ blink=\E[5m, bold=\E[1m, clear=\E[H\E[J, -+ csr=\E[%i%p1%d;%p2%dr, cub1=^H, cud1=^J, cuf1=\E[C, -+ cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, dch1=\E[P, dl1=\E[M, -+ ed=\E[J, el=\E[K, home=\E[H, ht=^I, il1=\E[L, ind=\ED, -+ is2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, kbs=^H, -+ kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kf1=\EOP, -+ kf2=\EOQ, kf3=\EOR, kf4=\EOS, khome=\E[H, rc=\E8, rev=\E[7m, -+ rf=/usr/share/tabset/vt100, ri=\EM, rmam=\E[?7l, -+ rmcup=\E[!p\E[?7h\E[2;1;1#w, rmir=\E[4l, rmkx=\E>, -+ rmso=\E[27m, rmul=\E[24m, rs1=\E[!p\E[?7h\E[2;1;1#w, -+ sc=\E7, sgr0=\E[m, smam=\E[?7h, smcup=\E[2;0#w\E[1;25r, -+ smir=\E[4h, smkx=\E=, smso=\E[7m, smul=\E[4m, -+ -+#### Harris (Beehive) -+# -+# Bletch. These guys shared the Terminal Brain Damage laurels with Hazeltine. -+# Their terminal group is ancient history now (1995) though the parent -+# company is still in business. -+# -+ -+# Beehive documentation is undated and marked Preliminary and has no figures -+# so we must have early Superbee2 (Model 600, according to phone conversation -+# with mfr.). It has proved reliable except for some missing padding -+# (notably after \EK and <nl> at bottom of screen). -+# -+# The key idea is that AEP mode is poison for <cup> & that US's in -+# the local memory should be avoided like the plague. That means -+# that the 2048 character local buffer is used as 25 lines of 80 -+# characters, period. No scrolling local memory, folks. It also -+# appears that we cannot use naked INS LINE feature since it uses -+# US. The sbi fakes <il1> with an 80-space insert that may be too -+# slow at low speeds; also spaces get converted to \040 which is -+# too long for some programs (not vi). DEL LINE is ok but slow. -+# -+# The <nl> string is designed for last line of screen ONLY; cup to -+# 25th line corrects the motion inherent in scrolling to Page 1. -+# -+# There is one understood bug. It is that the screen appears to -+# pop to a new (blank) page after a <nel>, or leave a half-line -+# ellipsis to a quad that is the extra 48 memory locations. The -+# data received is dumped into memory but not displayed. Not to -+# worry if <cup> is being used; the lines not displayed will be, -+# whenever the cursor is moved up there. Since <cup> is addressed -+# relative to MEMORY of window, nothing is lost; but beware of -+# relative cursor motion (<cuu1>,<cud1>,<cuf1>,<cub1>). Recommended, -+# therefore, is setenv MORE -c . -+# -+# WARNING: Not all features tested. -+# -+# Timings are assembled from 3 sources. Some timings may reflect -+# SB2/Model 300 that were used if more conservative. -+# Tested on a Model 600 at 1200 and 9600 bd. -+# -+# The BACKSPACEkb option is cute. The NEWLINE key, so cleverly -+# placed on the keyboard and useless because of AEP, is made -+# into a backspace key. In use ESC must be pressed twice (to send) -+# and sending ^C must be prefixed by ESC to avoid that weird -+# transmit mode associated with ENTER key. -+# -+# IF TERMINAL EVER GOES CATATONIC with the cursor buzzing across -+# the screen, then it has dropped into ENTER mode; hit -+# RESET--ONLINE--!tset. -+# -+# As delivered this machine has a FATAL feature that will throw -+# it into that strange transmit state (SPOW) if the space bar is -+# hit after a CR is received, but before receiving a LF (or a -+# few others). -+# -+# The circuits MUST be modified to eliminate the SPOW latch. -+# This is done by strapping on chip A46 of the I/O board; cut -+# the p.c. connection to Pin 5 and strap Pin 5 to Pin 8 of that -+# chip. This mod has been checked out on a Mod 600 of Superbee II. -+# With this modification absurdly high timings on cr are -+# unnecessary. -+# -+# NOTE WELL that the rear panel switch should be set to CR/LF, -+# not AEP! -+# -+sb1|beehive superbee, -+ OTbs, am, bw, da, db, mir, ul, xsb, -+ cols#80, lines#25, xmc#1, -+ bel=^G, cbt=\E`$<650>, clear=\EH$<1>\EJ$<3>, cr=$<1>\r, -+ cub1=^H, cud1=^J, cuf1=\EC$<3>, cup=\EF%p2%03d%p1%03d, -+ cuu1=\EA$<3>, dch1=\EP$<3>, dl1=\EM$<100>, ed=\EJ$<3>, -+ el=\EK$<3>, home=\EH$<1>, ht=^I, hts=\E1, -+ il1=\EN\EL$<3>\EQ \EP$<3> \EO\ER\EA$<3>, -+ ind=^J, is2=\EE$<3>\EX\EZ\EO\Eb\Eg\ER, kbs=^_, kcub1=\ED, -+ kcud1=\EB, kcuf1=\EC, kcuu1=\EA, kdl1=\EM, ked=\EJ, kel=\EK, -+ kf0=\E2, kf1=\Ep, kf2=\Eq, kf3=\Er, kf4=\Es, kf5=\Et, kf6=\Eu, -+ kf7=\Ev, kf8=\Ew, kf9=\E1, khome=\EH, kich1=\EQ\EO, -+ krmir=\ER, lf0=TAB CLEAR, lf9=TAB SET, rmcup=, rmir=\ER, -+ rmso=\E_3, rmul=\E_3, sgr0=\E_3, smcup=\EO, smir=\EQ\EO, -+ smso=\E_1, smul=\E_0, tbc=\E3, -+sbi|superbee|beehive superbee at Indiana U., -+ xsb, -+ cr=\r$<1>, il1=1\EN\EL$<9>\EQ \EP$<9> \EO\ER\EA, -+ use=sb1, -+# Alternate (older) description of Superbee - f1=escape, f2=^C. -+# Note: there are at least 3 kinds of superbees in the world. The sb1 -+# holds onto escapes and botches ^C's. The sb2 is the best of the 3. -+# The sb3 puts garbage on the bottom of the screen when you scroll with -+# the switch in the back set to CRLF instead of AEP. This description -+# is tested on the sb2 but should work on all with either switch setting. -+# The f1/f2 business is for the sb1 and the <xsb> can be taken out for -+# the other two if you want to try to hit that tiny escape key. -+# This description is tricky: being able to use cup depends on there being -+# 2048 bytes of memory and the hairy <nl> string. -+superbee-xsb|beehive super bee, -+ am, da, db, xsb, -+ cols#80, it#8, lines#25, -+ clear=\EH\EJ$<3>, cnorm=^J, cr=\r$<1000>, cub1=^H, cud1=^J, -+ cuf1=\EC, cup=\EF%p2%3d%p1%3d, cuu1=\EA$<3>, -+ dch1=\EP$<3>, dl1=\EM$<100>, ed=\EJ$<3>, el=\EK$<3>, -+ home=\EH, ht=^I, hts=\E1, -+ ind=\n\0\0\0\n\0\0\0\EA\EK\0\0\0\ET\ET, is2=\EH\EJ, -+ kcub1=\ED, kcud1=\EB, kcuf1=\EC, kcuu1=\EA, kf1=\Ep, kf2=\Eq, -+ kf3=\Er, kf4=\Es, kf5=\Et, kf6=\Eu, kf7=\Ev, kf8=\Ew, -+ khome=\EH, rmso=\E_3, sgr0=\E_3, smso=\E_1, tbc=\E3, -+# This loses on lines > 80 chars long, use at your own risk -+superbeeic|super bee with insert char, -+ ich1=, rmir=\ER, smir=\EQ, use=superbee-xsb, -+sb2|sb3|fixed superbee, -+ xsb@, use=superbee, -+ -+#### Beehive Medical Electronics -+# -+# Steve Seymour <srseymour@mindspring.com> writes (Wed, 03 Feb 1999): -+# Regarding your question though; Beehive terminals weren't made by Harris. -+# They were made by Beehive Medical Electronics in Utah. They went out of -+# business in the early '80s. -+# -+# (OK, then, I don't know why a couple of these say "harris beehive".) -+# -+ -+# Reports are that most of these Beehive entries (except superbee) have not -+# been tested and do not work right. <rmso> is a trouble spot. Be warned. -+ -+# (bee: <ich1> was empty, which is obviously bogus -- esr) -+beehive|bee|harris beehive, -+ OTbs, am, mir, -+ cols#80, lines#24, -+ cbt=\E>, clear=\EE, cub1=^H, cud1=\EB, cuf1=\EC, -+ cup=\EF%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, dch1=\EP, -+ dl1=\EM, ed=\EJ, el=\EK, home=\EH, il1=\EL, kbs=^H, kcbt=\E>, -+ kclr=\EE, kcub1=\ED, kcud1=\EB, kcuf1=\EC, kcuu1=\EA, -+ kdch1=\EP, kdl1=\EM, kel=\EK, khome=\EH, kich1=\EQ, kil1=\EL, -+ krmir=\E@, rmir=\E@, rmso=\Ed@, rmul=\Ed@, sgr0=\Ed@, -+ smir=\EQ, smso=\EdP, smul=\Ed`, -+# set tab is ^F, clear (one) tab is ^V, no way to clear all tabs. -+# good grief - does this entry make :sg:/:ug: when it doesn't have to? -+# look at those spaces in <rmso>/<smso>. Seems strange to me... -+# (beehive: <if=/usr/share/tabset/beehive> removed, no such file. If you -+# really care, cook up one using ^F -- esr) -+beehive3|bh3m|beehiveIIIm|harris beehive 3m, -+ OTbs, am, -+ cols#80, it#8, lines#20, -+ bel=^G, clear=^E^R, cr=^M, cub1=^H, cud1=^J, cuf1=^L, cuu1=^K, -+ dl1=\021$<350>, ed=^R, el=^P, home=^E, ht=^I, hts=^F, -+ il1=\023$<160>, ind=^J, ll=^E^K, rmso=\s^_, smso=^]\s, -+beehive4|bh4|beehive 4, -+ am, -+ cols#80, lines#24, -+ bel=^G, clear=\EE, cr=^M, cub1=\ED, cud1=^J, cuf1=\EC, -+ cuu1=\EA, ed=\EJ, el=\EK, home=\EH, ind=^J, -+# There was an early Australian kit-built computer called a "Microbee". -+# It's not clear whether this is for one of those or for a relative -+# of the Beehive. -+microb|microbee|micro bee series, -+ OTbs, am, -+ cols#80, it#8, lines#24, -+ bel=^G, clear=\EE, cr=^M, cub1=^H, cud1=^J, cuf1=\EC, -+ cup=\EF%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, ed=\EJ, -+ el=\EK, ht=^I, ind=^J, kcub1=\ED, kcud1=\EB, kcuf1=\EC, -+ kcuu1=\EA, kf1=\Ep, kf2=\Eq, kf3=\Er, kf4=\Es, kf5=\Et, -+ kf6=\Eu, kf7=\Ev, kf8=\Ew, kf9=\Ex, khome=\EH, rmso=\Ed@, -+ rmul=\Ed@, sgr0=\Ed@, smso=\s\EdP, smul=\Ed`, -+ -+# 8675, 8686, and bee from Cyrus Rahman -+# (8675: changed k10, k11...k16 to k;, F1...F6 -- esr) -+ha8675|harris 8675, -+ is2=\ES\E#\E*\Eh\Em\E?\E1\E9\E@\EX\EU, kf1=^F, -+ kf10=\Ed, kf11=^W, kf12=\ER, kf13=\EE, kf14=\EI, kf15=\Ei, -+ kf16=\Eg, kf2=^P, kf3=^N, kf4=^V, kf5=^J, kf6=^T, kf7=^H, -+ kf8=\177, kf9=\Ee, use=bee, -+# (8686: changed k10, k11...k16 to k;, F1...F6; fixed broken continuation -+# in :is: -- esr) -+ha8686|harris 8686, -+ is2=\ES\E#\E*\Eh\Em\E?\E1\E9\E@\EX\EU\E"*Z01\E"8F35021B7C83#\E"8F45021B7D83#\E"8F55021B7E83#\E"8F65021B7F83#\E"8F75021B7383#\E"8F851BD7#\E"8F95021B7083#\E"8FA5021B7183#\E"8FB5021B7283#, -+ kf1=\002\Ep\003, kf10=\Ej, kf11=\EW, kf12=\002\E{\003, -+ kf13=\002\E|\003, kf14=\002\E}\003, kf15=\002\E~\003, -+ kf16=\002\E\177\003, kf2=\002\Eq\003, kf3=\002\Er\003, -+ kf4=\002\Es\003, kf5=\E3, kf6=\EI, kf7=\ER, kf8=\EJ, kf9=\E(, -+ use=bee, -+ -+#### Hazeltine -+# -+# Hazeltine appears to be out of the terminal business as of 1995. These -+# guys were co-owners of the Terminal Brain Damage Hall Of Fame along with -+# Harris. They have a hazeltine.com domain (but no web page there ) and can -+# be reached at: -+# -+# Hazeltine -+# 450 East Pulaski Road -+# Greenlawn, New York 11740 -+# -+# As late as 1993, manuals for the terminal product line could still be -+# purchased from: -+# -+# TRW Customer Service Division -+# 15 Law Drive -+# P.O. Box 2076 -+# Fairfield, NJ 07007-2078 -+# -+# They're now (1998) a subsidiary of General Electric, operating under the -+# marque "GEC-Marconi Hazeltine" and doing military avionics. Web page -+# at <http://www.gec.com/cpd/1ncpd.htm#1.55>. -+# -+ -+# Since <cuf1> is blank, when you want to erase something you -+# are out of luck. You will have to do ^L's a lot to -+# redraw the screen. h1000 is untested. It doesn't work in -+# vi - this terminal is too dumb for even vi. (The code is -+# there but it isn't debugged for this case.) -+hz1000|hazeltine 1000, -+ OTbs, -+ cols#80, lines#12, -+ bel=^G, clear=^L, cr=^M, cub1=^H, cud1=^J, cuf1=\s, home=^K, -+ ind=^J, -+# From: <cbosg!ucbvax!pur-ee!cincy!chris> Thu Aug 20 09:09:18 1981 -+hz1420|hazeltine 1420, -+ OTbs, am, -+ cols#80, lines#24, -+ bel=^G, clear=\E^\, cr=^M, cub1=^H, cud1=^J, cuf1=^P, -+ cup=\E\021%p2%c%p1%{32}%+%c, cuu1=\E^L, dl1=\E^S, -+ ed=\E^X, el=\E^O, ht=^N, il1=\E^Z, ind=^J, rmso=\E^Y, -+ smso=\E^_, -+# New "safe" cursor movement (11/87) from <cgs@umd5.umd.edu>. Prevents -+# freakout with out-of-range args and tn3270. No hz since it needs to -+# receive tildes. -+hz1500|hazeltine 1500, -+ OTbs, am, hz, -+ cols#80, lines#24, -+ bel=^G, clear=~^\, cr=^M, cub1=^H, cud1=~^K, cuf1=^P, -+ cup=~\021%p2%p2%?%{30}%>%t%{32}%+%;%{96}%+%c%p1%{96}%+%c, -+ cuu1=~^L, dl1=~\023$<40>, ed=~\030$<10>, el=~^O, home=~^R, -+ il1=~\032$<40>, ind=^J, kcub1=^H, kcud1=^J, kcuf1=^P, -+ kcuu1=~^L, khome=~^R, rmso=~^Y, smso=~^_, -+# h1510 assumed to be in sane escape mode. Else use h1500. -+# (h1510: early versions of this entry apparently had "<rmso=\E^_>, -+# <smso=\E^Y>, but these caps were commented out in 8.3; also, -+# removed incorrect and overridden ":do=^J:" -- esr) -+hz1510|hazeltine 1510, -+ OTbs, am, -+ cols#80, lines#24, -+ bel=^G, clear=\E^\, cr=^M, cub1=^H, cud1=\E^K, cuf1=^P, -+ cup=\E\021%p2%c%p1%c, cuu1=\E^L, dl1=\E^S, ed=\E^X, -+ el=\E^O, il1=\E^Z, ind=^J, -+# Hazeltine 1520 -+# The following switch settings are assumed for normal operation: -+# FULL CR U/L_CASE ESCAPE -+# FORMAT_OFF EOM_A_OFF EOM_B_OFF WRAPAROUND_ON -+# Other switches may be set for operator convenience or communication -+# requirements. -+hz1520|Hazeltine 1520, -+ OTbs, am, bw, msgr, -+ cols#80, lines#24, -+ bel=^G, bold=\E^_, clear=\E^\, cr=^M, cub1=^H, cud1=^J, -+ cuf1=^P, cup=\E\021%p2%c%p1%c, cuu1=\E^L, dl1=\E^S, -+ ed=\E^X, el=\E^O, home=\E^R, il1=\E^Z, ind=^J, kbs=^H, -+ kclr=\E^\, kcub1=^H, kcud1=\E^K, kcuf1=^P, kcuu1=\E^L, -+ kdl1=\E^S, ked=\E^X, kel=\E^O, khome=\E^R, kil1=\E^Z, -+ rmso=\E^Y, rs1=\E$\E\005\E?\E\031, sgr0=\E^Y, smso=\E^_, -+# This version works with the escape switch off -+# (h1520: removed incorrect and overridden ":do=^J:" -- esr) -+hz1520-noesc|hazeltine 1520, -+ am, hz, -+ cols#80, lines#24, -+ bel=^G, clear=~^\, cr=^M, cub1=^H, cud1=~^K, cuf1=^P, -+ cup=~\021%p2%c%p1%c$<1>, cuu1=~^L, dl1=~^S, ed=~^X, el=~^O, -+ home=~^R, il1=~^Z, ind=^J, rmso=~^Y, smso=~^_, -+# Note: the h1552 appears to be the first Hazeltine terminal which -+# is not braindamaged. It has tildes and backprimes and everything! -+# Be sure the auto lf/cr switch is set to cr. -+hz1552|hazeltine 1552, -+ OTbs, -+ cud1=^J, dl1=\EO, il1=\EE, kf1=\EP, kf2=\EQ, kf3=\ER, lf1=blue, -+ lf2=red, lf3=green, use=vt52, -+hz1552-rv|hazeltine 1552 reverse video, -+ cud1=^J, rmso=\ET, smso=\ES, use=hz1552, -+# Note: h2000 won't work well because of a clash between upper case and ~'s. -+hz2000|hazeltine 2000, -+ OTbs, OTnc, am, -+ cols#74, lines#27, -+ bel=^G, clear=~\034$<6>, cub1=^H, cud1=^J, -+ cup=~\021%p2%c%p1%c, dl1=~\023$<6>, home=~^R, -+ il1=~\032$<6>, ind=^J, pad=\177, -+# Date: Fri Jul 23 10:27:53 1982. Some unknown person wrote: -+# I tested this termcap entry for the Hazeltine Esprit with vi. It seems -+# to work ok. There is one problem though if one types a lot of garbage -+# characters very fast vi seems not able to keep up and hangs while trying -+# to insert. That's in insert mode while trying to insert in the middle of -+# a line. It might be because the Esprit doesn't have insert char and delete -+# char as a built in function. Vi has to delete to end of line and then -+# redraw the rest of the line. -+esprit|Hazeltine Esprit I, -+ OTbs, am, bw, -+ cols#80, lines#24, -+ bel=^G, cbt=\E^T, clear=\E^\, cr=^M, cub1=^H, cud1=\E^K, -+ cuf1=^P, cup=\E\021%p2%c%p1%c, cuu1=\E^L, dl1=\E^S, -+ ed=\E^W, el=\E^O, home=\E^R, il1=\E^Z, ind=^J, is2=\E?, kbs=^H, -+ kcub1=^H, kcud1=\E^K, kcuf1=^P, kcuu1=\E^L, kf0=^B0^J, -+ kf1=^B1^J, kf2=^B2^J, kf3=^B3^J, kf4=^B4^J, kf5=^B5^J, -+ kf6=^B6^J, kf7=^B7^J, kf8=^B8^J, kf9=^B9^J, khome=\E^R, -+ lf0=0, lf1=1, lf2=2, lf3=3, lf4=4, lf5=5, lf6=6, lf7=7, lf8=8, lf9=9, -+ rmkx=\E>, rmso=\E^Y, smkx=\E<, smso=\E^_, -+esprit-am|hazeltine esprit auto-margin, -+ am, use=esprit, -+# Hazeltine Modular-1 from Cliff Shackelton <ittvax!ittral!shackelt> via BRL -+# Vi it seems always wants to send a control J for "do" and it turned out -+# that the terminal would work somewhat if the auto LF/CR was turned off. -+# (hmod1: removed :dn=~^K: -- esr) -+hmod1|Hazeltine Modular 1, -+ OTbs, am, hz, -+ cols#80, lines#24, -+ bel=^G, cbt=~^T, clear=~^\, cr=^M, cub1=^H, cud1=~^K, cuf1=^P, -+ cup=~\021%p2%c%p1%c, cuu1=~^L, dl1=~^S, home=~^R, il1=~^Z, -+ ind=^J, kcub1=^H, kcud1=~^K, kcuf1=^P, kcuu1=~^L, khome=~^R, -+ rc=~^Q, rmso=~^Y, sc=~^E, sgr0=~^Y, smso=~^_, -+# -+# Hazeltine Executive 80 Model 30 (1554?) -+# from Will Martin <control@ALMSA-1.ARPA> via BRL -+# Like VT100, except for different "am" behavior. -+hazel|exec80|h80|he80|Hazeltine Executive 80, -+ OTbs, OTpt, am, -+ cols#80, it#8, lines#24, vt#3, -+ OTnl=^J, bel=^G, blink=\E[5m$<2/>, bold=\E[1m$<2/>, -+ clear=\E[;H\E[2J$<50/>, cr=^M, csr=\E[%i%p1%d;%p2%dr, -+ cub1=^H, cud1=^J, cuf1=\E[C$<2/>, -+ cup=\E[%i%p1%d;%p2%dH$<5/>, cuu1=\E[A$<2/>, -+ ed=\E[J$<50/>, el=\E[K$<3/>, home=\E[H, ht=^I, -+ is2=\E[1;24r\E[24;1H, kbs=^H, kcub1=\EOD, kcud1=\EOB, -+ kcuf1=\EOC, kcuu1=\EOA, kf1=\EOP, kf2=\EOQ, kf3=\EOR, -+ kf4=\EOS, rc=\E8, rev=\E[7m$<2/>, -+ rf=/usr/share/tabset/vt100, ri=\EM$<5/>, -+ rmkx=\E[?1l\E>, rmso=\E[m$<2/>, rmul=\E[m$<2/>, -+ rs1=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sc=\E7, -+ sgr0=\E[m$<2/>, smkx=\E[?1h\E=, smso=\E[7m$<2/>, -+ smul=\E[4m$<2/>, -+ -+#### IBM -+# -+ -+ibm327x|line mode IBM 3270 style, -+ gn, -+ clear=^M^J, el=^M, home=^M, -+ -+ibm3101|i3101|IBM 3101-10, -+ OTbs, am, xon, -+ cols#80, lines#24, -+ bel=^G, clear=\EK, cr=^M, cub1=^H, cud1=^J, cuf1=\EC, -+ cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, ed=\EJ, -+ el=\EI, home=\EH, hts=\E0, ind=^J, kcub1=\ED, kcud1=\EB, -+ kcuf1=\EC, kcuu1=\EA, nel=^M^J, tbc=\EH, -+ibm3151|IBM 3151 display, -+ is2=\E S, rmacs=\E>B, rmcup=\E>B, rs2=\E S, s0ds=\E>B, -+ sgr=\E4%{64}%?%p1%t%{65}%|%;%?%p2%t%{66}%|%;%?%p3%t%{65}%|%;%?%p4%t%{68}%|%;%?%p5%t%{64}%|%;%?%p6%t%{72}%|%;%?%p7%t%{80}%|%;%c%?%p9%t\E>A%e\E>B%;, -+ sgr0=\E4@\E>B, smacs=\E>A, smcup=\E>B, use=ibm3162, -+# From: Mark Easter <marke@fsi-ssd.csg.ssd.fsi.com> 29 Oct 1992 -+# removed kend, knp, kpp -TD -+ibm3161|ibm3163|wy60-316X|wyse60-316X|IBM 3161/3163 display, -+ OTbs, am, mir, msgr, -+ cols#80, it#8, lines#24, -+ acsc=j\352k\353l\354m\355n\356q\361t\364u\365v\366w\367x\370, -+ bel=^G, blink=\E4D, bold=\E4H, clear=\EH\EJ, cr=^M, cub1=\ED, -+ cud1=\EB, cuf1=\EC, cup=\EY%p1%{32}%+%c%p2%{32}%+%c, -+ cuu1=\EA, dch1=\EQ, dl1=\EO, ed=\EJ, el=\EI, home=\EH, ind=^J, -+ invis=\E4P, kbs=^H, kcbt=\E2, kclr=\EL\r, kctab=\E1, -+ kcub1=\ED, kcud1=\EB, kcuf1=\EC, kcuu1=\EA, kdch1=\EQ, -+ kdl1=\EO, ked=\EJ, kel=\EI, kf1=\Ea\r, kf10=\Ej\r, -+ kf11=\Ek\r, kf12=\El\r, kf13=\E!a\r, kf14=\E!b\r, -+ kf15=\E!c\r, kf16=\E!d\r, kf17=\E!e\r, kf18=\E!f\r, -+ kf19=\E!g\r, kf2=\Eb\r, kf20=\E!h\r, kf21=\E!i\r, -+ kf22=\E!j\r, kf23=\E!k\r, kf24=\E!l\r, kf3=\Ec\r, -+ kf4=\Ed\r, kf5=\Ee\r, kf6=\Ef\r, kf7=\Eg\r, kf8=\Eh\r, -+ kf9=\Ei\r, khome=\EH, khts=\E0, kich1=\EP \010, kil1=\EN, -+ ktbc=\E 1, mc4=^P^T, mc5=^P^R, rev=\E4A, rmcup=\E>A, -+ rmso=\E4@, rmul=\E4@, -+ sgr=\E4%{64}%?%p1%t%{65}%|%;%?%p2%t%{66}%|%;%?%p3%t%{65}%|%;%?%p4%t%{68}%|%;%?%p5%t%{64}%|%;%?%p6%t%{72}%|%;%?%p7%t%{80}%|%;%c%?%p9%t\E>A%e\E<@%;, -+ sgr0=\E4@\E<@, smcup=\E>A, smso=\E4A, smul=\E4B, -+ -+ibm3161-C|IBM 3161-C NLS terminal using cartridge, -+ rmcup=\E>B, s0ds=\E>B, s1ds=\E>A, smcup=\E>B, use=ibm3161, -+ibm3162|IBM 3162 display, -+ blink=\E4$a, bold=\E4(a, il1=\EN, invis=\E40a, rev=\E4!a, -+ rmso=\E4>b, rmul=\E4=b, sgr0=\E4@, smso=\E4!a, smul=\E4"a, -+ use=ibm3161-C, -+ -+# This really should not use setab/setaf, but it is clear that the -+# original terminfo does not toggle red/blue colors as in setb/setf. -+ibm3164|i3164|IBM 3164, -+ msgr, -+ colors#8, pairs#64, -+ op=\E4 "@, rmcup=\E!9(N\E>B, s0ds=\E>B, s1ds=\E>A, -+ setab=\E4 %p1%{64}%+%c, -+ setaf=\E4%?%p1%t %p1%{32}%+%c%e!'%;@, -+ smcup=\E!9/N\E>B, use=ibm3161, -+ -+ibm5151|wy60-AT|wyse60-AT|IBM 5151 Monochrome display, -+ am, bw, msgr, xon, -+ cols#80, it#8, lines#25, -+ acsc=j\331k\277l\332m\300n\305q\304t\303u\264v\301w\302x\263, -+ bel=^G, blink=\E[5m, bold=\E[1m, clear=\E[H\E[J, cr=^M, -+ cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=^J, -+ cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, -+ cuu=\E[%p1%dA, cuu1=\E[A, dch1=\E[P, dl=\E[%p1%dM, -+ dl1=\E[M, ech=\E[%p1%dX, ed=\E[J, el=\E[K, home=\E[H, -+ hpa=\E[%i%p1%dG, il=\E[%p1%dL, il1=\E[L, ind=\E[S, -+ indn=\E[%p1%dS, invis=\E[8m, is2=\Ec, kbs=^H, kcbt=\E[Z, -+ kclr=\E[144q, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, -+ kcuu1=\E[A, kdch1=\E[P, ked=\E[148q, kel=\E[142q, -+ kend=\E[146q, kf1=\E[001q, kf10=\E[010q, kf11=\E[011q, -+ kf12=\E[012q, kf13=\E[013q, kf14=\E[014q, kf15=\E[015q, -+ kf16=\E[016q, kf17=\E[017q, kf18=\E[018q, kf19=\E[019q, -+ kf2=\E[002q, kf20=\E[020q, kf21=\E[021q, kf22=\E[022q, -+ kf23=\E[023q, kf24=\E[024q, kf25=\E[025q, kf26=\E[026q, -+ kf27=\E[027q, kf28=\E[028q, kf29=\E[029q, kf3=\E[003q, -+ kf30=\E[030q, kf31=\E[031q, kf32=\E[032q, kf33=\E[033q, -+ kf34=\E[034q, kf35=\E[035q, kf36=\E[036q, kf4=\E[004q, -+ kf5=\E[005q, kf6=\E[006q, kf7=\E[007q, kf8=\E[008q, -+ kf9=\E[009q, khome=\E[H, kich1=\E[139q, kil1=\E[140q, -+ kind=\E[151q, knp=\E[154q, kpp=\E[150q, kri=\E[155q, -+ krmir=\E[4l, rev=\E[7m, ri=\E[T, rin=\E[%p1%dT, rmir=\E[4l, -+ rmso=\E[m, rmul=\E[m, rs2=\Ec, -+ sgr=\E[%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;%?%p7%t;8%;m, -+ sgr0=\E[0m, smir=\E[4h, smso=\E[7m, smul=\E[4m, -+ -+ibmaed|IBM Experimental display, -+ OTbs, am, eo, msgr, -+ cols#80, it#8, lines#52, -+ clear=\EH\EK, cub1=^H, cud1=\EB, cuf1=\EC, -+ cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, dch1=\EQ, -+ dl1=\EO, ed=\EJ, el=\EI, flash=\EG, home=\EH, ht=^I, ich1=\EP, -+ il1=\EN, kbs=^H, kcub1=\ED, kcud1=\EB, kcuf1=\EC, kcuu1=\EA, -+ rmso=\E0, sgr0=\E0, smso=\E0, -+ibm-apl|apl|IBM apl terminal simulator, -+ lines#25, use=dm1520, -+# (ibmmono: this had an unknown `sb' boolean, I changed it to `bs'. -+# Also it had ":I0=f10:" which pretty obviously should be "l0=f10" -- esr) -+ibmmono|IBM workstation monochrome, -+ eslok, hs, -+ bold=\EZ, dl1=\EM, dsl=\Ej\EY8 \EI\Ek, fsl=\Ek, il1=\EL, -+ invis=\EF\Ef0;\Eb0;, kbs=^H, kf0=\E<, kf1=\ES, kf2=\ET, -+ kf3=\EU, kf4=\EV, kf5=\EW, kf6=\EP, kf7=\EQ, kf8=\ER, kf9=\EY, -+ khome=\EH, kich1=\0, kind=\EE, knp=\EE, kpp=\Eg, kri=\EG, -+ lf0=f10, rev=\Ep, ri=\EA, rmso=\Ez, rmul=\Ew, -+ sgr0=\Ew\Eq\Ez\EB, smso=\EZ, smul=\EW, tsl=\Ej\EY8%+ \Eo, -+ use=ibm3101, -+ibmega|IBM Enhanced Color Display, -+ cr=^M, cud1=^J, ht=^I, ind=^J, kbs=^H, kcub1=^H, kcud1=^J, -+ nel=^M^J, use=ibmmono, -+# This color scheme is assumed in some recent IBM terminal descriptions -+# (green on black, emulated on a 16-color terminal). -+ibm+color|IBM color definitions, -+ colors#8, ncv#3, pairs#64, -+ op=\E[32m\E[40m, -+ setb=\E[%?%p1%{0}%=%t40m%e%p1%{1}%=%t41m%e%p1%{2}%=%t42m%e%p1%{3}%=%t43m%e%p1%{4}%=%t44m%e%p1%{5}%=%t45m%e%p1%{6}%=%t46m%e%p1%{7}%=%t107m%;, -+ setf=\E[%?%p1%{0}%=%t30m%e%p1%{1}%=%t31m%e%p1%{2}%=%t32m%e%p1%{3}%=%t33m%e%p1%{4}%=%t34m%e%p1%{5}%=%t35m%e%p1%{6}%=%t36m%e%p1%{7}%=%t97m%;, -+ibm+16color|IBM aixterm color definitions, -+ colors#16, pairs#256, -+ setab=\E[%?%p1%{8}%<%t%p1%{40}%+%e%p1%{92}%+%;%dm, -+ setaf=\E[%?%p1%{8}%<%t%p1%{30}%+%e%p1%{82}%+%;%dm, -+ setb=%p1%{8}%/%{6}%*%{4}%+\E[%d%p1%{8}%m%Pa%?%ga%{1}%=%t4%e%ga%{3}%=%t6%e%ga%{4}%=%t1%e%ga%{6}%=%t3%e%ga%d%;m, -+ setf=%p1%{8}%/%{6}%*%{3}%+\E[%d%p1%{8}%m%Pa%?%ga%{1}%=%t4%e%ga%{3}%=%t6%e%ga%{4}%=%t1%e%ga%{6}%=%t3%e%ga%d%;m, -+ibm5154|IBM 5154 Color display, -+ colors#8, ncv@, pairs#64, -+ bold@, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, use=ibm5151, -+ use=ibm+color, -+ibmega-c|ibm5154-c|IBM Enhanced Color Display with standout and underline, -+ rmso=\EB, rmul=\EB, smso=\EF\Ef3;, smul=\EF\Ef2;, -+ use=ibmmono, -+ibmvga-c|IBM VGA display color termcap, -+ cr=^M, cud1=^J, ht=^I, ind=^J, kbs=^H, kcub1=^H, kcud1=^J, -+ nel=^M^J, use=ibmega-c, -+ibmvga|IBM VGA display, -+ cr=^M, cud1=^J, ht=^I, ind=^J, kbs=^H, kcub1=^H, kcud1=^J, -+ nel=^M^J, use=ibmega, -+# ibmapa* and ibmmono entries come from ACIS 4.3 distribution -+rtpc|ibmapa16|IBM 6155 Extended Monochrome Graphics Display, -+ lines#32, -+ dsl=\Ej\EY@ \EI\Ek, tsl=\Ej\EY@%+ \Eo, use=ibmmono, -+ibm6155|IBM 6155 Black & White display, -+ blink@, bold@, use=ibm5151, -+# Advanced Monochrome (6153) and Color (6154) Graphics Display: -+ibmapa8c|ibmapa8|IBM 6154 Advanced Graphics Display, -+ lines#31, -+ dsl=\Ej\EY? \EI\Ek, tsl=\Ej\EY?%+ \Eo, use=ibmmono, -+ibmapa8c-c|ibm6154-c|IBM 6154 Advanced Color Graphics Display, -+ lines#31, -+ dim=\EF\Ef7;, dsl=\Ej\EY? \EI\Ek, tsl=\Ej\EY?%+ \Eo, -+ use=ibmega-c, -+ibm6154|IBM 6154 Color displays, -+ blink@, bold=\E[12m, s0ds=\E[10m, s1ds=\E[11m, s2ds=\E[12m, -+ sgr=\E[%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;12%;m, -+ sgr0=\E[0;10m, use=ibm5154, -+ibm6153|IBM 6153 Black & White display, -+ blink@, bold=\E[12m, s0ds=\E[10m, s1ds=\E[11m, s2ds=\E[12m, -+ sgr=\E[%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;12%;m, -+ sgr0=\E[0;10m, use=ibm5151, -+ibm6153-90|IBM 6153 Black & White display, -+ cols#90, lines#36, -+ blink@, bold@, use=ibm5151, -+ibm6153-40|IBM 6153 Black & White display, -+ cols#40, lines#12, use=ibm6153-90, -+ibm8512|ibm8513|IBM color VGA Terminal, -+ am, mir, msgr, -+ cols#80, it#8, lines#25, -+ acsc=jjkkllmmnnqqttuuvvwwxx, blink=\E[5m, bold=\E[1m, -+ clear=\E[H\E[J, cub1=\E[D, cud1=^J, cuf1=\E[C, -+ cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, dl=\E[%p1%dM, dl1=\E[M, -+ ech=\E[%p1%dX, ed=\E[J, el=\E[K, home=\E[H, il=\E[%p1%dL, -+ il1=\E[L, is2=\Eb\E[m\017\E[?7h, kcud1=\E[B, kcuu1=\E[A, -+ kf0=\E[010q, kf1=\E[001q, kf2=\E[002q, kf3=\E[003q, -+ kf4=\E[004q, kf5=\E[005q, kf6=\E[006q, kf7=\E[007q, -+ kf8=\E[008q, kf9=\E[009q, khome=\E[H, rc=\E[u, rev=\E[7m, -+ rmacs=^O, rmam=\E[?7l, rmcup=\E[20h, rmdc=\E[4l, -+ rmir=\E[4l, rmso=\E[m, rmul=\E[m, -+ rs1=\Eb\E[m\017\E[?7h\E[H\E[J, sc=\E[s, sgr0=\E[m, -+ smacs=^N, smam=\E[?7h, smcup=\E[20;4l\E[?7h\Eb, -+ smdc=\E[4h, smir=\E[4h, smso=\E[7m, smul=\E[4m, -+ use=ibm8503, -+hft-c|HFT with Color, -+ colors#8, pairs#64, -+ acsc=jjkkllmmnnqqttuuvvwwxx, s0ds=\E(B, s1ds=\E(0, -+ setab=\E[4%p1%dm, setaf=\E[3%p1%dm, sgr0=\E[0m\E(B, -+ use=ibm5151, use=ibm+color, -+hft-c-old|HFT with Color PC850, -+ colors#8, pairs#64, -+ setab=\E[4%p1%dm, setaf=\E[3%p1%dm, use=ibm5151, -+ use=ibm+color, -+hft-old|AIWS High Function Terminal, -+ am, xon, -+ cols#80, lines#25, -+ bel=^G, blink=\E[5m, bold=\E[1m, clear=\E[H\E[J, cr=^M, -+ cub1=^H, cud1=^J, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, -+ cuu1=\E[A, dch1=\E[P, dl1=\E[M, ed=\E[J, el=\E[K, home=\E[H, -+ ht=^I, ich1=\E[@, il1=\E[L, ind=^J, invis=\E[8m, kbs=^H, -+ kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, -+ kf1=\E[001q, kf2=\E[002q, kf3=\E[003q, kf4=\E[004q, -+ kf5=\E[005q, kf6=\E[006q, kf7=\E[007q, kf8=\E[008q, -+ kf9=\E[009q, khome=\E[H, knp=\E[153q, kpp=\E[159q, -+ ktbc=\E[010q, rev=\E[7m, rmir=\E6, rmso=\E[m, rmul=\E[m, -+ sgr0=\E[m, smir=\E6, smso=\E[7m, smul=\E[4m, use=ibm+color, -+ibm-system1|system1|ibm system/1 computer, -+ am, xt, -+ cols#80, lines#24, -+ bel=^G, clear=^Z, cub1=^H, cuf1=^\, -+ cup=\005%p1%{32}%+%c%p2%{32}%+%c, cuu1=^^, home=^K, -+ ind=^J, -+# lft-pc850 : IBM Low Function Terminal Device -+# lft "supports" underline, bold, and blink in the sense that the lft code -+# sets all the right bits. HOWEVER, depending upon the adapter, these -+# attributes may or may not be supported by the device driver. -+lft|lft-pc850|LFT-PC850|IBM LFT PC850 Device, -+ am, bw, msgr, xon, -+ cols#80, it#8, lines#25, -+ acsc=j\331k\277l\332m\300n\305q\304t\303u\264v\301w\302x\263, -+ bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, clear=\E[H\E[J, -+ cr=^M, cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=^J, -+ cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, -+ cuu=\E[%p1%dA, cuu1=\E[A, dch=\E[%p1%dP, dch1=\E[P, -+ dl=\E[%p1%dM, dl1=\E[M, ech=\E[%p1%dX, ed=\E[2J, el=\E[0K, -+ home=\E[H, hpa=\E[%i%p1%dG, ich=\E[%p1%d@, il=\E[%p1%dL, -+ il1=\E[L, ind=\ED, indn=\E[%p1%dS, invis=\E[8m, is2=\Ec, -+ kbs=^H, kcbt=\E[Z, kclr=\E[144q, kcub1=\E[D, kcud1=\E[B, -+ kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[P, ked=\E[148q, -+ kel=\E[142q, kend=\E[146q, kf1=\E[001q, kf10=\E[010q, -+ kf11=\E[011q, kf12=\E[012q, kf13=\E[013q, kf14=\E[014q, -+ kf15=\E[015q, kf16=\E[016q, kf17=\E[017q, kf18=\E[018q, -+ kf19=\E[019q, kf2=\E[002q, kf20=\E[020q, kf21=\E[021q, -+ kf22=\E[022q, kf23=\E[023q, kf24=\E[024q, kf25=\E[025q, -+ kf26=\E[026q, kf27=\E[027q, kf28=\E[028q, kf29=\E[029q, -+ kf3=\E[003q, kf30=\E[030q, kf31=\E[031q, kf32=\E[032q, -+ kf33=\E[033q, kf34=\E[034q, kf35=\E[035q, kf36=\E[036q, -+ kf4=\E[004q, kf5=\E[005q, kf6=\E[006q, kf7=\E[007q, -+ kf8=\E[008q, kf9=\E[009q, khome=\E[H, kich1=\E[139q, -+ kil1=\E[140q, kind=\E[151q, knp=\E[154q, kpp=\E[150q, -+ kri=\E[155q, krmir=\E[4l, rev=\E[7m, ri=\EL, rin=\E[%p1%dT, -+ rmacs=\E(B, rmir=\E[4l, rmso=\E[0m, rmul=\E[0m, rs2=\Ec, -+ sgr=\E[%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;%?%p7%t;8%;m%?%p9%t\E(0%e\E(B%;, -+ sgr0=\E[0m, smacs=\E(0, smir=\E[4h, smso=\E[7m, smul=\E[4m, -+ tbc=\E[3g, -+# "Megapel" refers to the display adapter, which was used with the IBM RT -+# aka IBM 6150. -+ibm5081|hft|IBM Megapel Color display, -+ acsc=jjkkllmmnnqqttuuvvwwxx, blink@, bold@, s0ds=\E(B, -+ s1ds=\E(0, sgr0=\E[0m\E(B, use=ibm5154, -+ibm5081-c|ibmmpel-c|IBM 5081 1024x1024 256/4096 Megapel enhanced color display, -+ eslok, hs, -+ lines#33, -+ dsl=\Ej\EYA \EI\Ek, fsl=\Ek, tsl=\Ej\EYA%+ \Eo, -+ use=ibmega-c, -+ibm8503|ibm8507|ibm8604|IBM 8503 B & W VGA display, -+ use=hft-c, -+ibm8514|IBM 8514/a color VGA display, -+ eslok, hs, -+ dsl=\Ej\EYI \EI\Ek, fsl=\Ek, tsl=\Ej\EYI%+ \Eo, use=hft, -+ibm8514-c|IBM 8514 color display with standout and underline, -+ eslok, hs, -+ lines#41, -+ cr=^M, cud1=^J, dsl=\Ej\EYI \EI\Ek, fsl=\Ek, ht=^I, ind=^J, -+ kbs=^H, kcub1=^H, kcud1=^J, nel=^M^J, tsl=\Ej\EYI%+ \Eo, -+ use=ibmega-c, -+ - # --# ((((('@' + P5) | (P4 << 1)) | (P3 << 3)) | (P2 << 4)) | (p1 * 17)) => --# ((((('@' + P5) + (P4 << 1)) + (P3 << 3)) + (P2 << 4)) + (p1 * 17)) -+# AIX entries. IBM ships these with AIX 3.2.5. -+# -- added rc, sc based on manpage -TD -+# Note that we could use ibm+16color, but that is not how IBM defines this one. -+aixterm|IBM Aixterm Terminal Emulator, -+ eslok, hs, -+ acsc=jjkkllmmnnqqttuuvvwwxx, bold=\E[1m, dsl=\E[?E, -+ fsl=\E[?F, rc=\E8, ri@, s0ds=\E(B, s1ds=\E(0, sc=\E7, -+ sgr=\E[%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;%?%p7%t;8%;m%?%p9%t\E(0%e\E(B%;, -+ sgr0=\E[0;10m\E(B, tsl=\E[?%p1%dT, use=ibm6154, -+aixterm-m|IBM AIXterm Monochrome Terminal Emulator, -+ eslok, hs, -+ acsc=jjkkllmmnnqqttuuvvwwxx, bold=\E[1m, dsl=\E[?E, -+ fsl=\E[?F, ri@, s0ds=\E(B, s1ds=\E(0, -+ sgr=\E[%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;m, -+ sgr0=\E[0;10m\E(B, tsl=\E[?%p1%dT, use=ibm6153, -+aixterm-m-old|old IBM AIXterm Monochrome Terminal Emulator, -+ eslok, hs, -+ bold=\E[1m, dsl=\E[?E, fsl=\E[?F, ri@, -+ sgr=\E[%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;m, -+ tsl=\E[?%p1%dT, use=ibm6153, -+jaixterm|IBM Kanji Aixterm Terminal Eemulator, -+ acsc@, use=aixterm, -+jaixterm-m|IBM Kanji AIXterm Monochrome Terminal Emulator, -+ acsc@, use=aixterm-m, -+ -+# This flavor is adapted from xterm, in turn from aixterm documentation -TD -+aixterm-16color|IBM Aixterm Terminal Emulator with 16 colors, -+ use=ibm+16color, use=aixterm, -+ -+#### Infoton/General Terminal Corp. - # --# Where: P1 <==> Standout attribute parameter --# P2 <==> Underline attribute parameter --# P3 <==> Reverse attribute parameter --# P4 <==> Blink attribute parameter --# P5 <==> Dim attribute parameter --# From <root@goliath.un.atlantaga.NCR.COM>, init string hacked by SCO. --ncr7900i|ncr7900|ncr 7900 model 1, -- am, bw, ul, -- cols#80, lines#24, xmc#1, -- bel=^G, blink=\E0B, clear=^L, cr=^M, cub1=^H, cud1=^J, cuf1=^F, -- cup=\E1%p2%c%p1%c, cuu1=^Z, dim=\E0A, ed=\Ek, el=\EK, ind=^J, -- is2=\E0@\010\E3\E4\E7, kcub1=^U, kcud1=^J, kcuf1=^F, -- kcuu1=^Z, khome=^A, ll=^A, mc4=^T, mc5=^R, rev=\E0P, rmso=\E0@, -- rmul=\E0@, -- sgr=\E0%p5%{64}%+%p4%{2}%*%+%p3%{16}%*%+%p2%{32}%*%+%p1%{17}%*%+%c, -- sgr0=\E0@, smso=\E0Q, smul=\E0`, --ncr7900iv|ncr 7900 model 4, -- am, bw, eslok, hs, -+ -+# gt100 sounds like something DEC would come out with. Let's hope they don't. -+i100|gt100|gt100a|General Terminal 100A (formerly Infoton 100), -+ OTbs, am, - cols#80, lines#24, -- bel=^G, clear=^L, cr=^M, cub1=^H, cud1=^J, -- cup=\013%p1%{64}%+%c\E\005%p2%02d, dl1=\E^O, dsl=\Ey1, -- fsl=\Ek\Ey5, home=\013@\E^E00, il1=\E^N, ind=^J, kbs=^H, -- kcub1=\ED, kcud1=\EB, kcuf1=\EC, kcuu1=\EA, kf1=\ES, kf2=\ET, -- kf3=\EU, kf4=\EV, kf5=\EW, kf6=\EP, kf7=\EQ, kf8=\ER, -- khome=\EH, lf6=blue, lf7=red, lf8=white, nel=^M^J, -- tsl=\Ej\Ex5\Ex1\EY8%p1%{32}%+%c\Eo, --# Warning: This terminal will lock out the keyboard when it receives a CTRL-D. --# The user can enter a CTRL-B to get out of this locked state. --# In <hpa>, we want to output the character given by the formula: --# ((col / 10) * 16) + (col % 10) where "col" is "p1" --ncr7901|ncr 7901 model, -- am, bw, ul, -+ bel=^G, clear=^L, cr=^M, cub1=^H, cud1=^J, cuf1=\EC, -+ cup=\Ef%p2%{32}%+%c%p1%{32}%+%c, cuu1=\EA, dl1=\EM, -+ ed=\EJ, el=\EK, flash=\Eb$<200/>\Ea, home=\EH, il1=\EL, -+ ind=^J, rmso=\Ea, smso=\Eb, -+i400|infoton 400, -+ OTbs, am, -+ cols#80, lines#25, -+ bel=^G, clear=\E[2J, cr=^M, cub1=^H, cud1=^J, cuf1=\E[C, -+ cup=\E[%i%p1%3d;%p2%3dH, cuu1=\E[A, -+ dch1=\E[4h\E[2Q\E[P\E[4l\E[0Q, dl1=\E[M, el=\E[N, -+ il1=\E[L, ind=^J, rmir=\E[4l\E[0Q, smir=\E[4h\E[2Q, -+# (addrinfo: removed obsolete ":bc=^Z:" -- esr) -+addrinfo, -+ am, - cols#80, lines#24, -- bel=^G, blink=\E0B, civis=^W, clear=^L, cnorm=^X, cr=^M, -- cub1=^H, cud1=^J, cuf1=^F, -- cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=^Z, dim=\E0A, -- ed=\Ek, el=\EK, -- hpa=\020%p1%{10}%/%{16}%*%p1%{10}%m%+%c, ind=^J, -- is2=\E4^O, kclr=^L, kcub1=^U, kcud1=^J, kcuf1=^F, kcuu1=^Z, -- khome=^H, ll=^A, mc4=^T, mc5=^R, rev=\E0P, rmso=^O, rmul=^O, -- sgr=\E0%p5%{64}%+%p4%{2}%*%+%p3%{16}%*%+%p2%{32}%*%+%p1%{17}%*%+%c\016, -- sgr0=^O, smso=\E0Q\016, smul=\E0`\016, -- vpa=\013%p1%{64}%+%c, -+ bel=^G, clear=^L, cr=^M, cub1=^Z, cud1=^J, cuf1=^Y, -+ cup=\037%p1%c%p2%c, cuu1=^\, ed=^K, home=^H, ind=^J, ll=^H^\, -+# (infoton: used to have the no-ops <lh#0>, <lw#0>, <nlab#0> -- esr) -+infoton, -+ am, -+ cols#80, lines#24, -+ bel=^G, clear=^L, cr=^M, cub1=^Z, cud1=^J, cuf1=^Y, cuu1=^\, -+ ed=^K, ind=^J, ll=^H^\, - --# Newbury Data Recording Limited (Newbury Data) -+# The ICL6402 was actually the Kokusai Display System 6402. -+# The 6404 was the KDS7372 (color version of the 6402). - # --# Have been manufacturing and reselling various peripherals for a long time --# They don't make terminals anymore, but are still in business (in 2007). --# Their e-mail address is at ndsales@newburydata.co.uk --# and their post address is: -+# ICL6404 control codes follow: - # --# Newbury Data Recording Ltd, --# Premier Park, Road One, --# Winsford, Cheshire, CW7 3PT -+#code function -+#~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+#ctrl-A set SOM position at cursor position -+#ctrl-G Bell -+#ctrl-H Backspace -+#ctrl-I Horiz tab -+#ctrl-J Linefeed -+#ctrl-K Cursor up -+#ctrl-L Cursor right -+#ctrl-M Carriage return -+#ctrl-N Disable xon/xoff to host -+#ctrl-O Enable xon/xoff to host -+#ctrl-R Enable bidirectional mode -+#ctrl-T Disable bidirectional mode -+#ctrl-V Cursor down -+#ctrl-Z Clear unprotected data to insert char -+#ctrl-^ Cursor home -+#ctrl-_ Newline - # --# Their technical support is still good, they sent me for free a printed copy --# of the 9500 user manual and I got it just 1 week after I first contacted them --# (in 2005)! -- --# NDR 9500 --# Manufactured in the early/mid eighties, behaves almost the same as a --# Televideo 950. Take a 950, change its cabinet for a more 80s-ish one (but --# keep the same keyboard layout), add an optional 25-line mode, replace the DIP --# switches with a menu and remove the "lock line" feature (ESC ! 1 and ESC ! --# 2), here is the NDR 9500. Even the line-lock, albeit disabled, is --# recognized: if you type in "ESC !", the next (third) character is not --# echoed, showing that the terminal was actually waiting for a parameter! --ndr9500|nd9500|Newbury Data 9500, -- am, bw, hs, mc5i, mir, msgr, ul, xon, -- cols#80, lines#24, wsl#79, -- acsc=jDkClBmAnIqKtMuLvOwNxJ, bel=^G, cbt=\EI, civis=\E.0, -- clear=\E;, cnorm=\E.1, cr=^M, cub1=^H, cud1=^V, cuf1=^L, -- cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW, -- dim=\E), dl1=\ER, dsl=\Eh, ed=\EY, el=\ET, -- flash=\Eb$<50/>\Ed, fsl=^M, home=^^, ht=^I, hts=\E1, -- ich1=\EQ, il1=\EE, ind=^J, is2=\Ew\E'\EDF\El\Er\EO, -- kDC=\Er, kDL=\EO, kEOL=\Et, kIC=\Eq, kcbt=\EI, kclr=^Z, -- kcub1=^H, kcud1=^V, kcuf1=^L, kcuu1=^K, kdch1=\EW, kdl1=\ER, -- ked=\EY, kel=\ET, kent=^M, kf1=^A@\r, kf10=^AI\r, kf11=^AJ\r, -- kf12=^A`\r, kf13=^Aa\r, kf14=^Ab\r, kf15=^Ac\r, kf16=^Ad\r, -- kf17=^Ae\r, kf18=^Af\r, kf19=^Ag\r, kf2=^AA\r, kf20=^Ah\r, -- kf21=^Ai\r, kf22=^Aj\r, kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, -- kf6=^AE\r, kf7=^AF\r, kf8=^AG\r, kf9=^AH\r, khome=^^, -- kich1=\EQ, kil1=\EE, kprt=\EP, mc4=\Ea, mc5=\E`, nel=^_, -- pfloc=\E|%{48}%p1%+%c2%p2\031, -- pfx=\E|%{48}%p1%+%c1%p2\031, prot=\E), ri=\Ej, -- rmacs=\E%%, rmir=\Er, rmso=\E(, rmxon=^N, -- sgr=\E%%\E(%?%p1%p5%p8%|%|%t\E)%;%?%p9%t\E$%;, -- sgr0=\EG0\E%%\E(, smacs=\E$, smir=\Eq, smso=\E), smxon=^O, -- tbc=\E3, tsl=\Eg\Ef\011%p1%{32}%+%c, .kbs=^H, -- --ndr9500-nl|NDR 9500 with no status line, -- hs@, -- wsl@, -- dsl@, fsl@, tsl@, use=ndr9500, -- --ndr9500-25|NDR 9500 with 25th line enabled, -- lines#25, use=ndr9500, -- --ndr9500-25-nl|NDR 9500 with 25 lines and no status line, -- lines#25, use=ndr9500-nl, -- --ndr9500-mc|NDR 9500 with magic cookies (enables underline inverse video invisible and blink), -- msgr@, -- xmc#1, -- blink=\EG2, invis=\EG1, rev=\EG4, rmso=\EG0, rmul=\EG0, -- sgr=\E%%\E(%?%p5%p8%|%t\E)%;%?%p9%t\E$%;\EG%{48}%?%p7%t%{1}%+%;%?%p4%t%{2}%+%;%?%p3%p1%|%t%{4}%+%;%?%p2%t%{8}%+%;%c, -- sgr0=\EG0\E%%\E(, smso=\EG4, smul=\EG8, use=ndr9500, -- --ndr9500-25-mc|NDR 500 with 25 lines and magic cookies, -- lines#25, use=ndr9500-mc, -- --ndr9500-mc-nl|NDR 9500 with magic cookies and no status line, -- hs@, -- wsl@, -- dsl@, fsl@, tsl@, use=ndr9500-mc, -- --ndr9500-25-mc-nl|NDR 9500 with 25 lines and magic cookies and no status line, -- lines#25, use=ndr9500-mc-nl, -- --#### Perkin-Elmer (Owl) -+#ESC lead-in char for multiple character command -+# -+#ESC space R execute power on sequence -+#ESC ! p1 p2 define scroll region: -+# p1 = scroll top line: 20h - 37h -+# p1 = scroll bottom line: 20h - 37h -+#ESC " unlock keyboard -+#ESC # lock keyboard -+#ESC $ Semi-graphics mode on -+#ESC % Semi-graphics mode off -+#ESC & protect mode on -+#ESC ' protect mode off -+#ESC ( write protect mode off (full intensity) -+#ESC ) write protect mode on (half intensity) -+# -+#ESC * clear screen -+#ESC + clear unprotected data to insert char -+#ESC , clear unprotected data to half intensity spaces -+#ESC - p1 p2 p3 p4 address cursor to page, row, column: -+# p1 = page number 0 - 3 -+# p2 = row 20h - 7fh -+# p3 = column (lo) 20h - 7fh -+# p4 = column (hi) 20h - 21h (only 132 col) -+#ESC . p1 set cursor style: -+# p1 = 0 invisible cursor -+# p1 = 1 block blinking cursor -+# p1 = 2 block steady cursor -+# p1 = 3 underline blinking cursor -+# p1 = 4 underline steady cursor -+#ESC / transmit cursor location (page, row, column) -+#ESC 0 p1 p2 p3 p4 program edit key: -+# p1 = edit key code: '@'-'S', '`'-'s' -+# p2 p3 p4 = program data (3 bytes) -+# -+#ESC 1 set tab -+#ESC 2 clear tab at cursor -+#ESC 3 clear all tabs -+#ESC 4 send unprotect line to cursor -+#ESC 5 send unprotect page to cursor -+#ESC 6 send line to cursor -+#ESC 7 send page to cursor -+#ESC 8 n set scroll mode: -+# n = 0 set jump scroll -+# n = 1 set smooth scroll -+#ESC 9 n control display: -+# n = 0 display off -+# n = 1 display on -+#ESC : clear unprotected data to null -+#ESC ; clear unprotected data to insert char -+# -+#ESC < keyclick on -+#ESC = p1 p2 address cursor to row, column -+# p1 = row 20h - 7fh -+# p2 = column (lo) 20h - 7fh -+# p3 = column (hi) 20h - 21h (only 132 col) -+#ESC > keyclick off -+#ESC ? transmit cursor location (row, column) - # --# These are official terminfo entries from within Perkin-Elmer. -+#ESC @ copy print mode on -+#ESC A copy print mode off -+#ESC B block mode on -+#ESC C block mode off (conversation mode) -+#ESC D F set full duplex -+#ESC D H set half duplex -+#ESC E line insert -+#ESC F p1 p2 set page colour (p1 = f/grnd, p2 = b/grnd) -+# 0 = black, 1 = red, 2 = green, 3 = yellow -+# 4 = blue, 5 = magenta, 6 = cyan, 7 = white -+#ESC G n set serial field attribute (n = 30h - 3Fh) -+#ESC H n full graphics mode: -+# n = 0 exit full graphics mode -+# n = 1 enter full graphics mode -+#ESC I back tab -+#ESC J back page -+#ESC K forward page - # -- --bantam|pe550|pe6100|perkin elmer 550, -- OTbs, -- cols#80, lines#24, -- bel=^G, clear=\EK$<20>, cr=^M, cub1=^H, cud1=^J, cuf1=\EC, -- cup=\EX%p1%{32}%+%c\EY%p2%{32}%+%c, cuu1=\EA, -- el=\EI$<20>, home=\EH, ind=^J, ll=\EH\EA, --fox|pe1100|perkin elmer 1100, -- OTbs, am, -- cols#80, lines#24, -- bel=^G, clear=\EH\EJ$<132>, cr=^M, cub1=^H, cud1=^J, -- cuf1=\EC, cup=\EX%p1%{32}%+%c\EY%p2%{32}%+%c, cuu1=\EA, -- ed=\EJ$<5.5*>, el=\EI, flash=\020\002$<200/>\020\003, -- home=\EH, hts=\E1, ind=^J, ll=\EH\EA, tbc=\E3, --owl|pe1200|perkin elmer 1200, -- OTbs, am, in, -- cols#80, lines#24, -- bel=^G, clear=\EH\EJ$<132>, cr=^M, cub1=^H, cud1=^J, -- cuf1=\EC, cup=\EX%p1%{32}%+%c\EY%p2%{32}%+%c, cuu1=\EA, -- dch1=\EO$<5.5*>, dl1=\EM$<5.5*>, ed=\EJ$<5.5*>, -- el=\EI$<5.5>, flash=\020\002$<200/>\020\003, home=\EH, -- hts=\E1, ich1=\EN, il1=\EL$<5.5*>, ind=^J, ip=$<5.5*>, -- kbs=^H, kf0=\ERJ, kf1=\ERA, kf2=\ERB, kf3=\ERC, kf4=\ERD, -- kf5=\ERE, kf6=\ERF, kf7=\ERG, kf8=\ERH, kf9=\ERI, ll=\EH\EA, -- rmso=\E!\0, sgr0=\E!\0, smso=\E!^H, tbc=\E3, --pe1251|pe6300|pe6312|perkin elmer 1251, -- am, -- cols#80, it#8, lines#24, pb#300, vt#8, xmc#1, -- bel=^G, clear=\EK$<332>, cr=^M, cub1=\ED, cud1=\EB, cuf1=\EC, -- cup=\EX%p1%{32}%+%c\EY%p2%{32}%+%c, cuu1=\EA, -- ed=\EJ$<20*>, el=\EI$<10*>, home=\EH, hts=\E1, ind=^J, -- kf0=\ERA, kf1=\ERB, kf10=\ERK, kf2=\ERC, kf3=\ERD, kf4=\ERE, -- kf5=\ERF, kf6=\ERG, kf7=\ERH, kf8=\ERI, kf9=\ERJ, tbc=\E3, --# (pe7000m: this had --# rmul=\E!\0, smul=\E!\040, --# which is probably wrong, it collides with kf0 --pe7000m|perkin elmer 7000 series monochrome monitor, -- am, -- cols#80, lines#24, -- bel=^G, cbt=\E!Y, clear=\EK, cr=^M, cub1=\ED, cud1=\EB, -- cuf1=\EC, cup=\ES%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, -- ed=\EJ, el=\EI, home=\EH, ind=^J, -- is1=\E!\0\EW 7o\Egf\ES7\s, kbs=^H, kcub1=\E!V, -- kcud1=\E!U, kcuf1=\E!W, kcuu1=\E!T, kf0=\E!\0, kf1=\E!^A, -- kf10=\E!^J, kf2=\E!^B, kf3=\E!^C, kf4=\E!^D, kf5=\E!^E, -- kf6=\E!^F, kf7=\E!^G, kf8=\E!^H, kf9=\E!^I, khome=\E!S, -- ll=\ES7\s, ri=\ER, --pe7000c|perkin elmer 7000 series colour monitor, -- is1=\E!\0\EW 7o\Egf\Eb0\Ec7\ES7\s, rmso=\Eb0, -- rmul=\E!\0, smso=\Eb2, smul=\E!\s, use=pe7000m, -- --#### Sperry Univac -+#ESC L unformatted page print -+#ESC M L move window left (132 col mode only) -+#ESC M R move window right (132 col mode only) -+#ESC N set page edit (clear line edit) -+#ESC O set line edit (clear page edit) -+#ESC P formatted page print -+#ESC Q character insert -+#ESC R line delete -+#ESC S send message unprotected only -+#ESC T erase line to insert char -+#ESC U set monitor mode (see ESC X, ESC u) - # --# Sperry Univac has merged with Burroughs to form Unisys. -+#ESC V n select video attribute mode: -+# n = 0 serial field attribute mode -+# n = 1 parallel character attribute mode -+#ESC V 2 n define line attribute: -+# n = 0 single width single height -+# n = 1 single width double height -+# n = 2 double width single height -+# n = 3 double width double height -+#ESC V 3 n select character font: -+# n = 0 system font -+# n = 1 user defined font -+#ESC V 4 n select screen mode: -+# n = 0 page screen mode -+# n = 1 virtual screen mode -+#ESC V 5 n control mouse mode: -+# n = 0 disable mouse -+# n = 1 enable sample mode -+# n = 2 send mouse information -+# n = 3 enable request mode -+#ESC W character delete -+#ESC X clear monitor mode (see ESC U, ESC u) -+#ESC Y erase page to insert char - # -- --# This entry is for the Sperry UTS30 terminal running the TTY --# utility under control of CP/M Plus 1R1. The functionality --# provided is comparable to the DEC vt100. --# (uts30: I added <rmam>/<smam> based on the init string -- esr) --uts30|sperry uts30 with cp/m@1R1, -- am, bw, hs, -- cols#80, lines#24, wsl#40, -- acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -- bel=^G, blink=\E[5m, bold=\E[1m, civis=\ER, clear=^L, -- cnorm=\ES, cr=^M, csr=\EU%p1%{32}%+%c%p2%{32}%+%c, -- cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=\E[B, -- cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, -- cuu=\E[%p1%dA, cuu1=\E[A, dch=\E[%p1%dP, dch1=\EM, -- dl=\E[%p1%dM, dl1=\EL, ed=\E[J, el=\E[K, fsl=^M, home=\E[H, -- ht=^I, ich=\E[%p1%d@, ich1=\EO, il=\E[%p1%dL, il1=\EN, -- ind=^J, indn=\E[%p1%dB, is2=\E[U 7\E[24;1H, kbs=^H, -- kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, khome=\E[H, -- rc=\EX, rev=\E[7m, rf=/usr/share/tabset/vt100, ri=\EI, -- rin=\E[%p1%dA, rmacs=\Ed, rmam=\E[?7l, rmso=\E[m, -- rmul=\E[m, rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, -- sc=\EW, sgr0=\E[m, smacs=\EF, smam=\E[?7m, smso=\E[7m, -- smul=\E[4m, tsl=\E], uc=\EPB, -- --#### Tandem -+#ESC Z n send user/status line: -+# n = 0 send user line -+# n = 1 send status line -+# n = 2 send terminal ID -+#ESC [ p1 p2 p3 set character attribute (parallel char mode): -+# p1: 0 = normal -+# 1 = blank -+# 2 = blink -+# 3 = blink blank (= blank) -+# 4 = reverse -+# 5 = reverse blank -+# 6 = reverse blink -+# 7 = reverse blink blank (= reverse blank) -+# 8 = underline -+# 9 = underline blank -+# : = underline blink -+# ; = underline blink blank -+# < = reverse underline -+# = = reverse underline blank -+# > = reverse underline blink -+# ? = reverse underline blink blank -+# p2, p3: f/grnd, b/grnd colour -+# (see ESC F for colours) -+# use ZZ for mono, eg. -+# ESC [ 0 Z Z for normal -+# ESC [ 4 Z Z for inverse etc. - # --# Tandem builds these things for use with its line of fault-tolerant --# transaction-processing computers. They aren't generally available --# on the merchant market, and so are fairly uncommon. -+#ESC \ n set page size: -+# n = 1 24 lines/page -+# n = 2 48 lines/page -+# n = 3 72 lines/page -+# n = 4 96 lines/page -+#ESC ] n set Wordstar mode: -+# n = 0 normal (KDS7372) mode -+# n = 1 Wordstar mode - # -- --tandem6510|adm3a repackaged by Tandem, -- use=adm3a, -- --# A funny series of terminal that TANDEM uses. The actual model numbers --# have a fourth digit after 653 that designates minor variants. These are --# natively block-mode and rather ugly, but they have a character mode which --# this doubtless(?) exploits. There is a 6520 that is slightly dumber. --# (tandem653: had ":sb=\ES:", probably someone's mistake for sf; also, --# removed <if=/usr/share/tabset/tandem653>, no such file -- esr) --tandem653|t653x|Tandem 653x multipage terminal, -- OTbs, am, da, db, hs, -- cols#80, lines#24, wsl#64, xmc#1, -- clear=\EI, cub1=^H, cud1=^J, cuf1=\EC, -- cup=\023%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, dsl=\Eo\r, -- ed=\EJ, el=\EK, fsl=^M, home=\EH, ind=\ES, ri=\ET, rmso=\E6\s, -- rmul=\E6\s, sgr0=\E6\s, smso=\E6$, smul=\E60, tsl=\Eo, -- --#### Tandy/Radio Shack -+#ESC b set foreground colour screen - # --# Tandy has a line of VDTs distinct from its microcomputers. -+#ESC c n enter self-test mode: -+# n = 0 exit self test mode -+# n = 1 ROM test -+# n = 2 RAM test -+# n = 3 NVRAM test -+# n = 4 screen display test -+# n = 5 main/printer port test -+# n = 6 mouse port test -+# n = 7 graphics board test -+# n = 8 graphics memory test -+# n = 9 display all 'E' -+# n = : display all 'H' -+#ESC d set background colour screen - # -- --dmterm|deskmate terminal, -- am, bw, -- cols#80, lines#24, -- bel=^G, civis=\EG5, clear=\Ej, cnorm=\EG6, cr=^M, cub1=^H, -- cud1=\EB, cuf1=\EC, cup=\EY%p1%{32}%+%c%p2%{32}%+%c, -- cuu1=\EA, dch1=\ES, dl1=\ER, ed=\EJ, el=\EK, home=\EH, ht=^I, -- ich1=\EQ, il1=\EP, ind=\EX, invis@, kcub1=\ED, kcud1=\EB, -- kcuf1=\EC, kcuu1=\EA, kf0=\E1, kf1=\E2, kf2=\E3, kf3=\E4, -- kf4=\E5, kf5=\E6, kf6=\E7, kf7=\E8, kf8=\E9, kf9=\E0, -- khome=\EH, lf0=f1, lf1=f2, lf2=f3, lf3=f4, lf4=f5, lf5=f6, -- lf6=f7, lf7=f8, lf8=f9, lf9=f10, ll=\EE, rmul@, smul@, -- use=adm+sgr, --dt100|dt-100|Tandy DT-100 terminal, -- xon, -- cols#80, lines#24, xmc#1, -- acsc=jjkkllmmnnqqttuuvvwwxx, bel=^G, civis=\E[?25l, -- clear=\E[H\E[2J, cnorm=\E[?25h, cr=^M, -- csr=\E[%p1%2d;%p2%2dr, cub1=^H, cud1=\E[B, cuf1=\E[C, -- cup=\010\E[%i%p1%d;%p2%dH, cuu1=\E[A, dch1=\E[P, -- dl1=\E[M, ed=\E[J, el=\E[K, home=\E[H, ht=^I, ich1=\E[@, -- il1=\E[L, ind=^J, is2=\E[?3l\E)0\E(B, kcub1=\E[D, -- kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kf1=\E[?3i, -- kf10=\E[?5i, kf2=\E[2i, kf3=\E[@, kf4=\E[M, kf5=\E[17~, -- kf6=\E[18~, kf7=\E[19~, kf8=\E[20~, kf9=\E[21~, khome=\E[H, -- knp=\E[29~, kpp=\E[28~, lf1=f1, lf2=f2, lf3=f3, lf4=f4, lf5=f5, -- lf6=f6, lf7=f7, lf8=f8, ri=\EM, rmacs=^O, rmso=\E[m, rmul=\E[m, -- sgr0=\E[m, smacs=^N, smso=\E[7m, smul=\E[4m, --dt100w|dt-100w|Tandy DT-100 terminal (wide mode), -- cols#132, use=dt100, --dt110|Tandy DT-110 emulating ansi, -- xon, -- cols#80, lines#24, -- acsc=jjkkllmmnnqqttuuvvwwxx, bel=^G, civis=\E[?25l, -- clear=\E[H\E[2J, cnorm=\E[?25h, cr=^M, -- csr=\E[%i%p1%d;%p2%dr, cub1=^H, cud1=\E[B, cuf1=\E[C, -- cup=\010\E[%i%p1%d;%p2%dH, cuu1=\E[A, dch1=\E[0P, -- dl1=\E[0M, ed=\E[0J, el=\E[0K, enacs=\E(B\E)0, home=\E[H, -- ht=^I, ich1=\E[0@, il1=\E[0L, ind=^J, is2=\E[?3l\E)0\E(B, -- kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kend=\E[K, -- kf1=\E[1~, kf10=\E[10~, kf2=\E[2~, kf3=\E[3~, kf4=\E[4~, -- kf5=\E[5~, kf6=\E[6~, kf7=\E[7~, kf8=\E[8~, kf9=\E[9~, -- khome=\E[G, kich1=\E[@, knp=\E[26~, kpp=\E[25~, lf0=f1, -- lf1=f2, lf2=f3, lf3=f4, lf4=f5, lf5=f6, lf6=f7, lf7=f8, lf8=f9, -- lf9=f10, ri=\EM, rmacs=^O, rmso=\E[m, rmul=\E[m, sgr0=\E[m, -- smacs=^N, smso=\E[7m, smul=\E[4m, --pt210|TRS-80 PT-210 printing terminal, -- hc, os, -- cols#80, -- bel=^G, cr=^M, cud1=^J, ind=^J, -- --#### Tektronix (tek) -+#ESC e n program insert char (n = insert char) -+#ESC f text CR load user status line with 'text' -+# -+#ESC g display user status line on 25th line -+#ESC h display system status line on 25th line -+#ESC i tab -+#ESC j reverse linefeed -+#ESC k n duplex/local edit mode: -+# n = 0 duplex edit mode -+# n = 1 local edit mode -+#ESC l n select virtual screen: -+# n = 0 screen 1 -+# n = 1 screen 2 -+#ESC m save current config to NVRAM -+#ESC n p1 select display screen: -+# p1 = 0 screen 1 -+# p1 = 1 screen 2 -+# p1 = 2 screen 3 -+# p1 = 3 screen 4 -+#ESC o p1 p2 set characters/line and attribute: -+# p1 = 0 80 chars/line - # --# Tektronix tubes are graphics terminals. Most of them use modified --# oscilloscope technology incorporating a long-persistence green phosphor, --# and support vector graphics on a main screen with an attached "dialogue --# area" for interactive text. -+#ESC o p1 p2 set characters/line and attribute: -+# p1 = 0 80 chars/line -+# p1 = 1 132 chars/line -+# p2 = 0 single width single height -+# p2 = 1 single width double height -+# p2 = 2 double width single height -+# p2 = 3 double width double height - # -- --tek|tek4012|tektronix 4012, -- OTbs, os, -- cols#75, lines#35, -- bel=^G, clear=\E\014$<1000>, cr=^M, cub1=^H, cud1=^J, -- ff=\014$<1000>, is2=\E^O, --# (tek4013: added <acsc> to suppress tic warnings re <smacs>/<rmacs> --esr) --tek4013|tektronix 4013, -- acsc=, rmacs=\E^O, smacs=\E^N, use=tek4012, --tek4014|tektronix 4014, -- cols#81, lines#38, -- is2=\E\017\E9, use=tek4012, --# (tek4015: added <acsc> to suppress tic warnings re <smacs>/<rmacs> --esr) --tek4015|tektronix 4015, -- acsc=, rmacs=\E^O, smacs=\E^N, use=tek4014, --tek4014-sm|tektronix 4014 in small font, -- cols#121, lines#58, -- is2=\E\017\E\:, use=tek4014, --# (tek4015-sm: added <acsc> to suppress tic warnings re <smacs>/<rmacs> --esr) --tek4015-sm|tektronix 4015 in small font, -- acsc=, rmacs=\E^O, smacs=\E^N, use=tek4014-sm, --# Tektronix 4023 from Andrew Klossner <orca!andrew.tektronix@csnet-relay> -+#ESC q insert mode on -+#ESC r edit mode on -+#ESC s send message all -+#ESC t erase line to null -+#ESC u clear monitor mode (see ESC U, ESC X) -+#ESC v autopage mode on -+#ESC w autopage mode off -+#ESC x p1 p2 p3 define delimiter code... -+#ESC y erase page to null - # --# You need to have "stty nl2" in effect. Some versions of tset(1) know --# how to set it for you. -+#ESC z 2 p1 p2 p3 p4 draw quadrangle: -+# p1 = starting row -+# p2 = starting column -+# p3 = end row -+# p4 = end column - # --# It's got the Magic Cookie problem around stand-out mode. If you can't --# live with Magic Cookie, remove the :so: and :se: fields and do without --# reverse video. If you like reverse video stand-out mode but don't want --# it to flash, change the letter 'H' to 'P' in the :so: field. --tek4023|tektronix 4023, -- OTbs, am, -- OTdN#4, cols#80, lines#24, vt#4, xmc#1, -- OTnl=^J, bel=^G, clear=\E\014$<4/>, cr=^M, cub1=^H, cud1=^J, -- cuf1=^I, cup=\034%p2%{32}%+%c%p1%{32}%+%c, kbs=^H, -- rmso=^_@, smso=^_P, --# It is recommended that you run the 4025 at 4800 baud or less; --# various bugs in the terminal appear at 9600. It wedges at the --# bottom of memory (try "cat /usr/dict/words"); ^S and ^Q typed --# on keyboard don't work. You have to hit BREAK twice to get --# one break at any speed - this is a documented feature. --# Can't use cursor motion because it's memory relative, and --# because it only works in the workspace, not the monitor. --# Same for home. Likewise, standout only works in the workspace. -+#ESC { p1 p2 p3 p4 configure main port -+# (baud, stop bits, parity, word length) - # --# <el> was commented out since vi and rogue seem to work better --# simulating it with lots of spaces! -+#ESC | p1 p2 text Ctrl-Y program function key with 'text': -+# p1 = function key code: -+# '1' - ';' normal f1- f11 -+# '<' - 'F' shifted f1 - f11 -+# p2 = program mode: -+# 1 = FDX -+# 2 = LOC -+# 3 = HDX -+# Ctrl-Y = terminator -+# (use Ctrl-P to escape ^P, ^Y ) - # --# <il1> and <il> had 145ms of padding, but that slowed down vi's ^U --# and didn't seem necessary. -+#ESC } p1 p2 p3 p4 configure printer port -+# (baud, stop bits, parity, word length) -+#ESC ~ send system status - # --tek4024|tek4025|tek4027|tektronix 4024/4025/4027, -- OTbs, am, da, db, -- cols#80, it#8, lines#34, lm#0, -- bel=^G, clear=\037era\r\n\n, cmdch=^_, cr=^M, -- cub=\037lef %p1%d\r, cub1=^H, cud=\037dow %p1%d\r, -- cud1=^F^J, cuf=\037rig %p1%d\r, cuf1=\037rig\r, -- cuu=\037up %p1%d\r, cuu1=^K, dch1=\037dch\r, -- dl=\037dli %p1%d\r\006, dl1=\037dli\r\006, -- ed=\037dli 50\r, ht=^I, ich1=\037ich\r \010, -- il=\037up\r\037ili %p1%d\r, il1=\037up\r\037ili\r, -- ind=^F^J, -- is2=!com 31\r\n\037sto 9 17 25 33 41 49 57 65 73\r, -- rmkx=\037lea p2\r\037lea p4\r\037lea p6\r\037lea p8\r\037lea f5\r, -- smkx=\037lea p4 /h/\r\037lea p8 /k/\r\037lea p6 / /\r\037lea p2 /j/\r\037lea f5 /H/\r, --tek4025-17|tek 4025 17 line window, -- lines#17, use=tek4025, --tek4025-17-ws|tek 4025 17 line window in workspace, -- is2=!com 31\r\n\037sto 9 17 25 33 41 49 57 65 73\r\037wor 17\r\037mon 17\r, -- rmcup=\037mon h\r, rmso=\037att s\r, smcup=\037wor h\r, -- smso=\037att e\r, use=tek4025-17, --tek4025-ex|tek4027-ex|tek 4025/4027 w/!, -- is2=\037com 33\r\n!sto 9 17 25 33 41 49 57 65 73\r, -- rmcup=\037com 33\r, smcup=!com 31\r, use=tek4025, --# Tektronix 4025a --# From: Doug Gwyn <gwyn@brl-smoke.ARPA> --# The following status modes are assumed for normal operation (replace the --# initial "!" by whatever the current command character is): --# !COM 29 # NOTE: changes command character to GS (^]) --# ^]DUP --# ^]ECH R --# ^]EOL --# ^]RSS T --# ^]SNO N --# ^]STO 9 17 25 33 41 49 57 65 73 --# Other modes may be set according to communication requirements. --# If the command character is inadvertently changed, termcap can't restore it. --# Insert-character cannot be made to work on both top and bottom rows. --# Clear-to-end-of-display emulation via !DLI 988 is too grotty to use, alas. --# There also seems to be a problem with vertical motion, perhaps involving --# delete/insert-line, following a typed carriage return. This terminal sucks. --# Delays not specified; use "stty ixon -ixany" to enable DC3/DC1 flow control! --# (tek4025a: removed obsolete ":xx:". This may mean the tek4025a entry won't --# work any more. -- esr) --tek4025a|Tektronix 4025A, -- OTbs, OTpt, am, bw, da, db, xon, -- cols#80, it#8, lines#34, -- bel=^G, cbt=\035bac;, clear=\035era;\n\035rup;, cmdch=^], -- cr=^M, cub=\035lef %p1%d;, cub1=^H, cud=\035dow %p1%d;, -- cud1=^J, cuf=\035rig %p1%d;, cuf1=\035rig;, -- cuu=\035up %p1%d;, cuu1=^K, dch=\035dch %p1%d;, -- dch1=\035dch;, dl=\035dli %p1%d;, dl1=\035dli;, -- el=\035dch 80;, hpa=\r\035rig %p1%d;, ht=^I, -- il1=\013\035ili;, ind=^J, indn=\035dow %p1%d;, -- rs2=!com 29\035del 0\035rss t\035buf\035buf n\035cle\035dis\035dup\035ech r\035eol\035era g\035for n\035pad 203\035pad 209\035sno n\035sto 9 17 25 33 41 49 57 65 73\035wor 0;, -- tbc=\035sto;, --# From: cbosg!teklabs!davem Wed Sep 16 21:11:41 1981 --# Here's the command file that I use to get rogue to work on the 4025. --# It should work with any program using the old curses (e.g. it better --# not try to scroll, or cursor addressing won't work. Also, you can't --# see the cursor.) --# (This "learns" the arrow keys for rogue. I have adapted it for termcap - mrh) --tek4025-cr|tek 4025 for curses and rogue, -- OTbs, am, -- cols#80, it#8, lines#33, -- clear=\037era;, cub1=^H, cud1=^F^J, cuf1=\037rig;, -- cup=\037jum%i%p1%d\,%p2%d;, cuu1=^K, ht=^I, ind=^F^J, -- is2=!com 31\r\n\037sto 9 17 25 33 41 49 57 65 73\r, -- rmcup=\037wor 0, smcup=\037wor 33h, --# next two lines commented out since curses only allows 128 chars, sigh. --# :ti=\037lea p1/b/\037lea p2/j/\037lea p3/n/\037lea p4/h/\037lea p5/ /\037lea p6/l/\037lea p7/y/\037lea p8/k/\037lea p9/u/\037lea p./f/\037lea pt/`era w/13\037lea p0/s/\037wor 33h:\ --# :te=\037lea p1\037lea p2\037lea p3\037lea p4\037lea pt\037lea p5\037lea p6\037lea p7\037lea p8\037lea p9/la/13\037lea p.\037lea p0\037wor 0: --tek4025ex|4025ex|4027ex|tek 4025 w/!, -- is2=\037com 33\r\n!sto 9\,17\,25\,33\,41\,49\,57\,65\,73\r, -- rmcup=\037com 33\r, smcup=!com 31\r, use=tek4025, --tek4105|tektronix 4105, -- OTbs, am, mir, msgr, ul, xenl, xt, -- cols#79, it#8, lines#29, -- acsc=, bel=^G, blink=\E[=3;<7m, bold=\E[=7;<4m, cbt=\E[Z, -- clear=\E[2J\E[H, cr=^M, cub1=\E[1D, cud1=\E[1B, cuf1=\E[1C, -- cup=\E[%i%p1%2d;%p2%2dH, cuu1=\E[1A, dch1=\E[1P, -- dim=\E[=1;<6m, dl1=\E[1M, ed=\E[J, el=\E[K, home=\E[H, ht=^I, -- il1=\E[1L, ind=\E[S, invis=\E[=6;<5, is1=\E%!1\E[m, -- is2=\E%!1\E[?6141\E[m, kbs=^H, kcub1=\E[1D, kcud1=\E[1B, -- kcuf1=\E[1C, kcuu1=\E[1A, rev=\E[=1;<3m, ri=\E[T, -- rmacs=\E[m, rmcup=, rmir=\E[4l, rmso=\E[=0;<1m, -- rmul=\E[=0;<1m, sgr0=\E[=0;<1m, smacs=\E[1m, -- smcup=\E%!1\E[?6l\E[2J, smir=\E[4h, smso=\E[=2;<3m, -- smul=\E[=5;<2m, tbc=\E[1g, -+# Codes and info from Peter Disdale <pete@pdlmail.demon.co.uk> 12 May 1997 -+# -+# Entry is by esr going solely on above information and is UNTESTED. -+# This actually looks a lot like a Televideo 9xx. -+# This entry uses page 0 and is monochrome; I'm not brave enough to try -+# to make color work without a test terminal. The <am> capability is a guess. -+# The initialization string sets conversation mode, blinking underline cursor, -+# full duplex, parallel attribute mode, display user status line, white -+# foreground, black background, normal highlight. -+# -+icl6404|kds7372|icl6402|kds6402|ICL 6404 aka Kokusai Display Systems 7372, -+ OTbs, am, hs, -+ cols#80, lines#24, -+ bel=^G, blink=\E[2ZZ, cbt=\EI, civis=\E.0, clear=\E*, -+ cnorm=\E.3, cr=^M, -+ csr=\E!%+%p1%{32}%+%p2%{32} cud1=\026, cuf1=^L, -+ cup=\E=%p1%{32}%+%c%p2%{80}%m%{32}%+%c%p2%{80}%>%{32}%+%c, -+ cuu1=^K, cvvis=\E.1, dch1=\EW, dl1=\ER, home=^^, ht=^I, -+ hts=\E1, il1=\EE, invis=\E[1ZZ, -+ is1=\EC\E.3\EDF\EV1\Eg\E[0ZZ, nel=^_, rev=\E[4ZZ, -+ rmir=\Er, rmso=\E[%gh%{4}%^%Ph%gh%dZZ, -+ rmul=\E[%gh%{8}%^%Ph%gh%dZZ, rs2=\Eo1, -+ sgr=\E[%'0'%?%p1%t%'8'%|%;%?%p2%t%'8'%|%;%?%p3%t%'4'%|%;%?%p4%t%'2'%|%;%?%p7%t%'1'%|%;%cZZ, -+ sgr0=\E[0ZZ, smir=\Eq, smso=\E[8ZZ, smul=\E[8ZZ, tbc=\E3, -+icl6404-w|kds7372-w|ICL 6404 aka Kokusai Display Systems 7372 132 cols, -+ rs2=\Eo1, use=icl6404, - --# (tek4105-30: I added <rmam>/<smam> based on the init string -- esr) --tek4105-30|4015 emulating 30 line vt100, -- am, mir, msgr, xenl, xon, -- cols#80, it#8, lines#30, vt#3, -- acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -- bel=^G, blink=\E[5m$<2>, bold=\E[1m$<2>, -- clear=\E[H\E[J$<50>, cr=^M, csr=\E[%i%p1%d;%p2%dr, -- cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=^J, -- cuf=\E[%p1%dC, cuf1=\E[C$<2>, -- cup=\E[%i%p1%d;%p2%dH$<5>, cuu=\E[%p1%dA, -- cuu1=\E[A$<2>, ed=\E[J$<50>, el=\E[K$<3>, el1=\E[1K$<3>, -- enacs=\E(B\E)0, home=\E[H, ht=^I, hts=\EH, ind=^J, kbs=^H, -- kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, rc=\E8, -- rev=\E[7m$<2>, ri=\EM$<5>, rmacs=^O, rmam=\E[?7l, -- rmkx=\E[?1l\E>, rmso=\E[m$<2>, rmul=\E[m$<2>, -- rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sc=\E7, -- sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;$<2>, -- sgr0=\E[m\017$<2>, smacs=^N, smam=\E[?7h, smkx=\E[?1h\E=, -- smso=\E[1;7m$<2>, smul=\E[4m$<2>, tbc=\E[3g, -- use=vt100+fnkeys, -+#### Interactive Systems Corp -+# -+# ISC used to sell OEMed and customized hardware to support ISC UNIX. -+# ISC UNIX still exists in 1995, but ISC itself is no more; they got -+# bought out by Sun. -+# -+ -+# From: <cithep!eric> Wed Sep 16 08:06:44 1981 -+# (intext: removed obsolete ":ma=^K^P^R^L^L ::bc=^_:", also the -+# ":le=^_:" later overridden -- esr) -+intext|Interactive Systems Corporation modified owl 1200, -+ OTbs, am, -+ cols#80, it#8, lines#24, xmc#1, -+ bel=^G, cbt=^Y, clear=\014$<132>, cr=^M, cub1=^H, cud1=^J, -+ cuf1=^^, cup=\017%p1%{32}%+%c%p2%{32}%+%c, cuu1=^\, -+ dch1=\022$<5.5*>, dl1=\021$<5.5*>, ed=\026J$<5.5*>, -+ el=^Kp^R, ht=^I, il1=\020$<5.5*>, ind=^J, ip=$<5.5*>, kbs=^H, -+ kcub1=^_, kcud1=^J, kcuf1=^^, kcuu1=^\, kf0=^VJ\r, kf1=^VA\r, -+ kf2=^VB\r, kf3=^VC\r, kf4=^VD\r, kf5=^VE\r, kf6=^VF\r, -+ kf7=^VG\r, kf8=^VH\r, kf9=^VI\r, khome=^Z, rmir=^V<, -+ rmkx=^V9, rmso=^V#\s, smir=^V;, smkx=\036\:\264\026%%, -+ smso=^V$\,, -+intext2|intextii|INTERACTIVE modified owl 1251, -+ am, bw, ul, -+ cols#80, lines#24, xmc#0, -+ bel=^G, cbt=\E[Z, clear=\E[H\E[2J, cr=^M, cub1=\E[D, -+ cud1=\E[B, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, -+ dch1=\E[P, dl1=\E[M, ed=\E[J, el=\E[K, -+ flash=\E[;;;;;;;;;2;;u$<200/>\E[;;;;;;;;;1;;u, -+ hpa=\E[%p1%{1}%+%dG, ht=^I, ich1=\E[@, il1=\E[L, ind=\E[S, -+ kbs=^H, kcub1=\ED\r, kcud1=\EB\r, kcuf1=\EC\r, kcuu1=\EA\r, -+ kf0=\E@\r, kf1=\EP\r, kf2=\EQ\r, kf3=\ES\r, kf4=\ET\r, -+ kf5=\EU\r, kf6=\EV\r, kf7=\EW\r, kf8=\EX\r, kf9=\EY\r, -+ khome=\ER\r, lf0=REFRSH, lf1=DEL CH, lf2=TABSET, lf3=GOTO, -+ lf4=+PAGE, lf5=+SRCH, lf6=-PAGE, lf7=-SRCH, lf8=LEFT, -+ lf9=RIGHT, ri=\E[T, rmso=\E[2 D, rmul=\E[2 D, smso=\E[6 D, -+ smul=\E[18 D, - --# Tektronix 4105 from BRL --# The following setup modes are assumed for normal operation: --# CODE ansi CRLF no DABUFFER 141 --# DAENABLE yes DALINES 30 DAMODE replace --# DAVISIBILITY yes ECHO no EDITMARGINS 1 30 --# FLAGGING input INSERTREPLACE replace LFCR no --# ORIGINMODE relative PROMPTMODE no SELECTCHARSET G0 B --# SELECTCHARSET G1 0 TABS -2 --# Other setup modes may be set for operator convenience or communication --# requirements; I recommend --# ACURSOR 1 0 AUTOREPEAT yes AUTOWRAP yes --# BYPASSCANCEL <LF> CURSORKEYMODE no DAINDEX 1 0 0 --# EOFSTRING '' EOLSTRING <CR> EOMCHARS <CR> <NU> --# GAMODE overstrike GCURSOR 0 100 0 GSPEED 10 1 --# IGNOREDEL no KEYEXCHAR <DL> NVDEFINE -53 "<NU>" --# PROMPTSTRING '' QUEUESIZE 2460 WINDOW 0 0 4095 3132 --# XMTDELAY 0 --# and factory color maps. After setting these modes, save them with NVSAVE. No --# delays are specified; use "stty ixon -ixany" to enable DC3/DC1 flow control! --# "IC" cannot be used in combination with "im" & "ei". --# "tek4105a" is just a guess: --tek4105a|Tektronix 4105, -- OTbs, OTpt, msgr, xon, -- OTkn#8, cols#80, it#8, lines#30, vt#3, -- acsc=, bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, -- civis=\E%!0\ETD00\E%!1, clear=\E[H\E[J, -- cnorm=\E%!0\ETD10\E%!1, cr=^M, csr=\E[%i%p1%d;%p2%dr, -- cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=^J, -- cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, -- cuu=\E[%p1%dA, cuu1=\EM, cvvis=\E%!0\ETD70\E%!1, -- dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, -- ech=\E[%p1%dX, ed=\E[J, el=\E[K, home=\E[H, ht=^I, hts=\EH, -- il=\E[%p1%dL, il1=\E[L, ind=^J, indn=\E[%p1%dS, is2=\E%!1, -- kbs=^H, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, -- kf0=\EOA, kf1=\EOB, kf2=\EOC, kf3=\EOD, kf4=\EOP, kf5=\EOQ, -- kf6=\EOR, kf7=\EOS, lf0=F1, lf1=F2, lf2=F3, lf3=F4, lf4=F5, -- lf5=F6, lf6=F8, ll=\E[30;H, nel=\EE, rc=\E8, rev=\E[7m, ri=\EM, -- rin=\E[%p1%dT, rmacs=^O, rmcup=\E%!0\ELBH=\E%!1, -- rmir=\E[4l, rmkx=\E[?1l\E>, rmso=\E[m, rmul=\E[m, -- rs2=\030\E%!0\EKC\E\014\EKR0\EKF0\ENM0\ELBH=\ETF8000010F40\ELI100\ELLA>\ELM0\EKE0\ENF1\EKS0\END0\E%!1\Ec\E[?3;5l\E[?7;8h\E[r\E[m\E>, -- sc=\E7, sgr0=\E[m, smacs=^N, smcup=\E[?6l, smir=\E[4h, -- smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, tbc=\E[3g, -+#### Kimtron (abm, kt) -+# -+# Kimtron seems to be history, but as March 1998 these people are still -+# offering repair services for Kimtron equipment: -+# -+# Com/Pair Monitor Service -+# 1105 N. Cliff Ave. -+# Sioux Falls, South Dakota 57103 -+# -+# WATS voice: 1-800/398-4946 -+# POTS fax: +1 605/338-8709 -+# POTS voice: +1 605/338-9650 -+# Email: <compair@sd.cybernex.net> -+# Internet/Web: <http://www.com-pair.com> -+# -+# Kimtron entries include (undocumented) codes for: enter dim mode, -+# enter bold mode, enter reverse mode, turn off all attributes. -+# - -+# Kimtron ABM 85 added by Dual Systems -+# (abm85: removed duplicated ":kd=^J:" -- esr) -+abm85|Kimtron ABM 85, -+ OTbs, am, bw, msgr, -+ cols#80, it#8, lines#24, xmc#1, -+ cbt=\EI, clear=\E*, cub1=^H, cud1=^J, cuf1=^L, -+ cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW, -+ dl1=\ER, ed=\Ey, el=\Et, ht=^I, -+ if=/usr/share/tabset/stdcrt, il1=\EE, -+ is2=\EC\EX\Eg\En\E%\Er\E(\Ek\Em\Eq, kbs=^H, kcub1=^H, -+ kcud1=^J, kcuf1=^L, kcuu1=^K, khome=^^, rmir=\Er, rmso=\Ek, -+ rmul=\Em, smir=\EQ, smso=\Ej, smul=\El, -+# Kimtron ABM 85H added by Dual Systems. -+# Some notes about the abm85h entries: -+# 1) there are several firmware revs of 85H in the world. Use abm85h-old for -+# firmware revs prior to SP51 -+# 2) Make sure to use abm85h entry if the terminal is in 85h mode and the -+# abm85e entry if it is in tvi920 emulation mode. They are incompatible -+# in some places and NOT software settable i.e., <is2> can't fix it) -+# 3) In 85h mode, the arrow keys and special functions transmit when -+# the terminal is in dup-edit, and work only locally in local-edit. -+# Vi won't swallow `del char' for instance, but <smcup> turns on -+# dup-edit anyway so that the arrow keys will work right. If the -+# arrow keys don't work the way you like, change <smcup>, <rmcup>, and -+# <is2>. Note that 920E mode does not have software commands to toggle -+# between dup and local edit, so you get whatever was set last on the -+# terminal. -+# 4) <flash> attribute is nice, but seems too slow to work correctly -+# (\Eb<pad>\Ed) -+# 5) Make sure `hidden' attributes are selected. If `embedded' attributes -+# are selected, the <xmc@> entry should be removed. -+# 6) auto new-line should be on (selectable from setup mode only) - # --# Tektronix 4106/4107/4109 from BRL --# The following setup modes are assumed for normal operation: --# CODE ansi COLUMNMODE 80 CRLF no --# DABUFFER 141 DAENABLE yes DALINES 32 --# DAMODE replace DAVISIBILITY yes ECHO no --# EDITMARGINS 1 32 FLAGGING input INSERTREPLACE replace --# LFCR no LOCKKEYBOARD no ORIGINMODE relative --# PROMPTMODE no SELECTCHARSET G0 B SELECTCHARSET G1 0 --# TABS -2 --# Other setup modes may be set for operator convenience or communication --# requirements; I recommend --# ACURSOR 1 0 AUTOREPEAT yes AUTOWRAP yes --# BYPASSCANCEL <LF> CURSORKEYMODE no DAINDEX 1 0 0 --# EOFSTRING '' EOLSTRING <CR> EOMCHARS <CR> <NU> --# GAMODE overstrike GCURSOR 0 100 0 GSPEED 9 3 --# IGNOREDEL no KEYEXCHAR <DL> NVDEFINE -53 "<NU>" --# PROMPTSTRING '' QUEUESIZE 2620 WINDOW 0 0 4095 3132 --# XMTDELAY 0 --# and factory color maps. After setting these modes, save them with NVSAVE. No --# delays are specified; use "stty ixon -ixany" to enable DC3/DC1 flow control! --# "IC" cannot be used in combination with "im" & "ei". --tek4106brl|tek4107brl|tek4109brl|Tektronix 4106 4107 or 4109, -- msgr, xon, -- cols#80, it#8, lines#32, vt#3, -- acsc=, bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, -- civis=\E%!0\ETD00\E%!1, clear=\E[H\E[J, -- cnorm=\E%!0\ETD10\E%!1, cr=^M, csr=\E[%i%p1%d;%p2%dr, -- cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=^J, -- cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, -- cuu=\E[%p1%dA, cuu1=\EM, cvvis=\E%!0\ETD70\E%!1, -- dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, -- ech=\E[%p1%dX, ed=\E[J, el=\E[K, home=\E[H, ht=^I, hts=\EH, -- il=\E[%p1%dL, il1=\E[L, ind=^J, indn=\E[%p1%dS, is2=\E%!1, -- kbs=^H, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, -- kf0=\EOA, kf1=\EOB, kf2=\EOC, kf3=\EOD, kf4=\EOP, kf5=\EOQ, -- kf6=\EOR, kf7=\EOS, lf0=F1, lf1=F2, lf2=F3, lf3=F4, lf4=F5, -- lf5=F6, lf6=F8, ll=\E[32;H, nel=\EE, rc=\E8, rev=\E[7m, ri=\EM, -- rin=\E[%p1%dT, rmacs=^O, rmcup=\E%!0\ELBH=\E%!1, -- rmir=\E[4l, rmkx=\E[?1l\E>, rmso=\E[m, rmul=\E[m, -- rs1=\030\E%!0\EKC\E\014\EKR0\EKF0\ENM0\ELBH=\ETF8000010F40\ELI100\ELLB0\ELM0\EKE0\ENF1\EKS0\END0\ERE0\E%!1\Ec\E[?3;5l\E[?7;8h\E[r\E[m\E>, -- sc=\E7, sgr0=\E[m, smacs=^N, smcup=\E[?6l, smir=\E[4h, -- smkx=\E[?1h\E=, smso=\E[7;42m, smul=\E[4m, tbc=\E[3g, -+# From: Erik Fair <fair@ucbarpa> Sun Oct 27 07:21:05 1985 -+abm85h|Kimtron ABM 85H native mode, -+ hs, -+ xmc@, -+ bel=^G, cnorm=\E.4, cvvis=\E.2, dim=\E), dsl=\Ee, flash@, -+ fsl=^M, invis@, -+ is2=\EC\EN\EX\024\016\EA\Ea\E%\E9\Ee\Er\En\E"\E}\E'\E(\Ef\r\EG0\Ed\E.4\El, -+ kcud1=^V, sgr0=\E(\EG0, smir=\EZ, tsl=\Eg\Ef, use=adm+sgr, -+ use=abm85, -+abm85e|Kimtron ABM 85H in 920E mode, -+ xmc@, -+ bel=^G, dim=\E), flash@, -+ is2=\EC\EX\EA\E%\E9\Ee\Er\En\E"\E}\E'\E(\Ef\r\Ek\Eq\Em, -+ rev=\Ej, sgr0=\E(\Ek, smir=\EZ, use=abm85, -+abm85h-old|oabm85h|o85h|Kimtron ABM 85H with old firmware rev., -+ xmc@, -+ bel=^G, dim=\E), -+ is2=\E}\EC\EX\Ee\En\E%\Er\E(\Ek\Em\Eq\Ed\ET\EC\E9\EF, -+ rev=\Ej, sgr0=\E(\Ek, smir=\EZ, use=abm85, -+# From: <malman@bbn-vax.arpa> -+# (kt7: removed obsolete :ma=^V^J^L :" -- esr) -+kt7|kimtron model kt-7, -+ OTbs, am, -+ cols#80, it#8, lines#24, -+ cbt=\EI, clear=^Z, cub1=^H, cud1=^V, cuf1=^L, -+ cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW, -+ dl1=\ER, ed=\EY, el=\ET, fsl=\Eg, home=^^, ht=^I, ich1=\EQ, -+ if=/usr/share/tabset/stdcrt, il1=\EE, invis@, is2=\El\E", -+ kbs=^H, kcbt=\EI, kclr=^Z, kcub1=^H, kcud1=^V, kcuf1=^L, -+ kcuu1=^K, kdch1=\EW, kdl1=\ER, ked=\EY, kel=\ET, kf0=^AI\r, -+ kf1=^A@\r, kf2=^AA\r, kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, -+ kf6=^AE\r, kf7=^AF\r, kf8=^AG\r, kf9=^AH\r, khome=^^, -+ kich1=\EQ, kil1=\EE, tsl=\Ef, use=adm+sgr, -+# Renamed TB=^I to :ta:, BE=^G to :bl:, BS=^H to :kb:, N to :kS: (based on the -+# other kt7 entry and the adjacent key capabilities). Removed EE which is -+# identical to :mh:. Removed :ES=\EGD: which is some kind of highlight -+# but we can't figure out what. -+kt7ix|kimtron model kt-7 or 70 in IX mode, -+ am, bw, -+ cols#80, it#8, lines#25, -+ acsc=jYk?lZm@nEqDt4uCvAwBx3, bel=^G, blink=\EG2, cbt=\EI, -+ civis=\E.0, clear=\E*, cnorm=\E.3, cr=^M, cub1=^H, cud1=^V, -+ cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, -+ dch1=\EW, dim=\EG@, dl1=\ER, dsl=\Ef\r, ed=\EY, el=\ET, fsl=^M, -+ home=^^, ht=^I, ich1=\EQ, il1=\EE, ind=^J, -+ is2=\EG0\E s\017\E~, kbs=^H, kcbt=\EI, kclr=\E*, -+ kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdl1=\ER, -+ ked=\EY, kel=\ET, kend=\EY, kf0=^AI\r, kf1=^A@\r, kf2=^AA\r, -+ kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, kf6=^AE\r, kf7=^AF\r, -+ kf8=^AG\r, kf9=^AH\r, khome=^^, kich1=\EQ, kil1=\EE, knp=\EJ, -+ nel=^M^J, pulse=\EK, rmacs=\E%%, rmir=, rmso=\EG0, rmul=\EG0, -+ sgr0=\EG0, smacs=\E$, smir=, smso=\EG4, smul=\EG8, tsl=\Ef, - --# Tektronix 4107/4109 interpret 4 modes using "\E%!" followed by a code: --# 0 selects Tek mode, i.e., \E%!0 --# 1 selects ANSI mode --# 2 selects ANSI edit-mode --# 3 selects VT52 mode -+#### Microdata/MDIS -+# -+# This was a line of terminals made by McDonnell-Douglas Information Systems. -+# These entries come direct from MDIS documentation. I have edited them only -+# to move primary names of the form p[0-9] * to aliases, and to comment out -+# <rmacs>/<smacs> in a couple of entries without <acsc> strings. I have -+# also removed the change history; the last version indicates this is -+# version 4.3 by A.Barkus, September 1990 (earliest entry is October 1989). - # --# One odd thing about the description (which has been unchanged since the 90s) --# is that the cursor addressing is using VT52 mode, and a few others use the --# VT52's non-CSI versions of ANSI, e.g., \EJ. --tek4107|tek4109|tektronix terminals 4107 4109, -- OTbs, am, mir, msgr, ul, xenl, xt, -- cols#79, it#8, lines#29, -- bel=^G, blink=\E%!1\E[5m$<2>\E%!0, -- bold=\E%!1\E[1m$<2>\E%!0, clear=\ELZ, cnorm=\E%!0, cr=^M, -- cub1=^H, cud1=^J, cuf1=\EC, -- cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, cvvis=\E%!3, -- dim=\E%!1\E[<0m$<2>\E%!0, ed=\EJ, el=\EK, ht=^I, ind=^J, -- kbs=^H, kcub1=\ED, kcud1=\EB, kcuf1=\EC, kcuu1=\EA, -- rev=\E%!1\E[7m$<2>\E%!0, ri=\EI, -- rmso=\E%!1\E[m$<2>\E%!0, rmul=\E%!1\E[m$<2>\E%!0, -- sgr=\E%%!1\E[%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;m$<2>\E%%!0, -- sgr0=\E%!1\E[m$<2>\E%!0, smso=\E%!1\E[7;5m$<2>\E%!0, -- smul=\E%!1\E[4m$<2>\E%!0, --# Tektronix 4207 with sysline. In the ancestral termcap file this was 4107-s; --# see the note attached to tek4207. --tek4207-s|Tektronix 4207 with sysline but no memory, -- eslok, hs, -- dsl=\E7\E[?6l\E[2K\E[?6h\E8, fsl=\E[?6h\E8, -- is1=\E%!1\E[2;32r\E[132D\E[2g\EH\E[8C\EH\E[8C\EH\E[8C\EH\E[8C\EH\E[8C\EH\E[8C\EH\E[8C\EH\E[8C\EH\E[8C\EH\E[J, -- is2=\E7\E[?6l\E[2K\E[?6h\E8, -- tsl=\E7\E[?6l\E[2K\E[;%i%df, use=tek4107, - --# The 4110 series may be a wonderful graphics series, but they make the 4025 --# look good for screen editing. In the dialog area, you can't move the cursor --# off the bottom line. Out of the dialog area, ^K moves it up, but there --# is no way to scroll. -+# McDonnell Information Systems Terminal Family History -+# ========================================= -+# -+# Prism-1, Prism-2 and P99: -+# Ancient Microdata and CMC terminals, vaguely like Adds Regent 25. -+# -+# Prism-4 and Prism-5: -+# Slightly less ancient range of Microdata terminals. Follow-on from -+# Prism-2, but with many enhancements. P5 has eight display pages. -+# -+# Prism-6: -+# A special terminal for use with library systems, primarily in Germany. -+# Limited numbers. Similar functionality to P5 (except attributes?). - # --# Note that there is a floppy for free from Tek that makes the --# 4112 emulate the vt52 (use the vt52 termcap). There is also --# an expected enhancement that will use ANSI standard sequences. -+# Prism-7, Prism-8 and Prism-9: -+# More recent range of MDIS terminals, in which P7 and P8 -+# replace the P4 & P5, with added functionality, and P9 is the flagship. -+# The P9 has two emulation modes - P8 and ANSI - and includes a -+# large number of the DEC VT220 control sequences. Both -+# P8 and P9 support 80c/24ln/8pg and 132cl/24li/4pg formats. - # --# 4112 in non-dialog area pretending to scroll. It really wraps --# but vi is said to work (more or less) in this mode. -+# Prism-12 and Prism-14: -+# Latest range, functionally very similar to the P9. The P14 has a -+# black-on-white overscanning screen. - # --# 'vi' works reasonably well with this entry. -+# The terminfo definitions given here are: - # --otek4112|o4112-nd|otek4113|otek4114|old tektronix 4110 series, -- am, -- cols#80, lines#34, -- bel=^G, clear=\E^L, cr=^M, cub1=^H, cud1=^J, cuu1=^K, ind=^J, -- rmcup=\EKA1\ELV1, smcup=\EKA0\ELV0\EMG0, --# The 4112 with the ANSI compatibility enhancement --tek4112|tek4114|tektronix 4110 series, -- OTbs, am, db, -- cols#80, lines#34, -- cbt=\E[Z, clear=\E[2J\E[0;0H, cub1=^H, cud1=\E[B, -- cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu1=\EM, dch1=\E[P, -- dl1=\E[M, ed=\E[0J, el=\E[0K, ich1=\E[@, il1=\E[L, -- ind=\E7\E[0;0H\E[M\E8, is2=\E3!1, ri=\E7\E[0;0H\E[L\E8, -- rmso=\E[m, rmul=\E[m, sgr0=\E[m, smso=\E[7m, smul=\E[4m, --tek4112-nd|4112 not in dialog area, -- OTns, -- cuu1=^K, use=tek4112, --tek4112-5|4112 in 5 line dialog area, -- lines#5, use=tek4112, --# (tek4113: this used to have "<cuf1=\LM1\s\LM0>", someone's mistake; --# removed "<smacs=\E^N>, <rmacs=\E^O>", which had been commented out in 8.3. --# Note, the !0 and !1 sequences in <rmcup>/<smcup>/<cnorm>/<civis> were --# previously \0410 and \0411 sequences...I don't *think* they were supposed --# to be 4-digit octal -- esr) --tek4113|tektronix 4113 color graphics with 5 line dialog area, -- OTbs, am, da, eo, -- cols#80, lines#5, -- clear=\ELZ, cub1=^H, cud1=^J, cuf1=\ELM1 \ELM0, -- flash=\ERBA4\ERBA4\ERBA4\ERBA4\ERBA4\ERBA4\ERBA4\ERBA4\ERBA4\ERBA4\ERB0, -- is2=\EKA1\ELL5\ELV0\ELV1, uc=\010\ELM1_\ELM0, --tek4113-34|tektronix 4113 color graphics with 34 line dialog area, -- lines#34, -- is2=\EKA1\ELLB2\ELV0\ELV1, use=tek4113, --# :ns: left off to allow vi visual mode. APL font (:as=\E^N:/:ae=\E^O:) not --# supported here. :uc: is slow, but looks nice. Suggest setenv MORE -up . --# :vb: needs enough delay to let you see the background color being toggled. --tek4113-nd|tektronix 4113 color graphics with no dialog area, -- OTbs, am, eo, -- cols#80, it#8, lines#34, -- clear=\E^L, cub1=^H, cud1=^J, cuf1=^I, cuu1=^K, -- cvvis=\ELZ\EKA0, -- flash=\ERBA4\ERBA4\ERBA4\ERBA4\ERBA4\ERBA4\ERBA4\ERBA4\ERBA4\ERBA4\ERB0, -- home=\ELF7l\177 @, ht=^I, is2=\ELZ\EKA0\ELF7l\177 @, -- ll=\ELF hl @, rmso=\EMT1, smso=\EMT2, uc=\010\EMG1_\EMG0, --# This entry is from Tek. Inc. (Brian Biehl) --# (tek4115: :bc: renamed to :le:, <rmam>/<smam> added based on init string -- esr) --otek4115|Tektronix 4115, -- OTbs, am, da, db, eo, -- cols#80, it#8, lines#34, -- cbt=\E[Z, clear=\E[H\E[2J, -- cnorm=\E%!0\ELBG8\E%!1\E[34;1H, cub1=\E[D, cud1=\E[B, -- cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, -- cvvis=\E%!0\ELBB2\E%!1, dch1=\E[P, dl1=\E[M, ed=\E[J, -- el=\E[K, home=\E[H, ht=^I, if=/usr/share/tabset/vt100, -- il1=\E[L, -- is2=\E%!0\E%\014\ELV0\EKA1\ELBB2\ENU@=\ELLB2\ELM0\ELV1\EKYA?\E%!1\E[<1l\E[?7h\E[?8h\E[34;1H\E[34B\E[m, -- kbs=^H, ri=\EM, rmam=\E[?7l, -- rmcup=\E%!0\ELBG8\E%!1\E[34;1H\E[J, rmir=\E[4l, -- rmkx=\E>, rmso=\E[m, rmul=\E[m, sgr0=\E[m, smam=\E[?7h, -- smcup=\E%!0\ELBB2\E%!1, smir=\E[4h, smkx=\E=, smso=\E[7m, -- smul=\E[4m, --tek4115|newer tektronix 4115 entry with more ANSI capabilities, -- am, xon, -- cols#80, lines#34, -- bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, clear=\E[H\E[J, -- cr=^M, cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=^J, -- cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, -- cuu=\E[%p1%dA, cuu1=\E[A, dch1=\E[P, dl=\E[%p1%dM, -- dl1=\E[M, ed=\E[J, el=\E[K, home=\E[H, hpa=\E[%p1%{1}%+%dG, -- ht=^I, hts=\EH, ich=\E[%p1%d@, ich1=\E[@, il=\E[%p1%dL, -- il1=\E[L, ind=^J, invis=\E[8m, kbs=^H, kcub1=\E[D, -- kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, khome=\E[H, -- rep=%p1%c\E[%p2%{1}%-%db, rev=\E[7m, rmam=\E[?7l, -- rmso=\E[m, rmul=\E[m, -- sgr=\E[%?%p1%t7;%;%?%p2%t4;%;%?%p3%t7;%;%?%p4%t5;%;%?%p6%t1;%;%?%p7%t8;%;m, -- sgr0=\E[m, smam=\E[?7h, smso=\E[7m, smul=\E[4m, tbc=\E[3g, -- vpa=\E[%p1%{1}%+%dd, --# The tek4125 emulates a vt100 incorrectly - the scrolling region --# command is ignored. The following entry replaces <csr> with the needed --# <il>, <il>, and <smir>; removes some cursor pad commands that the tek4125 --# chokes on; and adds a lot of initialization for the tek dialog area. --# Note that this entry uses all 34 lines and sets the cursor color to green. --# Steve Jacobson 8/85 --# (tek4125: there were two "\!"s in the is that I replaced with "\E!"; --# commented out, <smir>=\E1 because there's no <rmir> -- esr) --tek4125|tektronix 4125, -- lines#34, -- csr@, dl1=\E[1M, il1=\E[1L, -- is2=\E%\E!0\EQD1\EUX03\EKA\ELBB2\ELCE0\ELI100\ELJ2\ELLB2\ELM0\ELS1\ELX00\ELV1\E%\E!1\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, -- rc@, sc@, smkx=\E=, use=vt100, -- --# From: <jcoker@ucbic> --# (tek4207: This was the termcap file's entry for the 4107/4207, but SCO --# supplied another, less capable 4107 entry. So we'll use that for 4107 and --# note that if jcoker wasn't confused you may be able to use this one. --# I merged in <msgr>,<ind>,<ri>,<invis>,<tbc> from a BRL entry -- esr) --tek4207|Tektronix 4207 graphics terminal with memory, -- am, bw, mir, msgr, ul, xenl, -- cols#80, it#8, lines#32, -- blink=\E[5m, bold=\E[1m, cbt=\E[Z, clear=\E[H\E[J$<156/>, -- cub1=^H, cud1=^J, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, -- cuu1=\EM, dch1=\E[P$<4/>, dl1=\E[M$<3/>, ed=\E[J, -- el=\E[K$<5/>, home=\E[H, ht=^I, ich1=\E[@$<4/>, -- il1=\E[L$<3/>, ind=\E[S, invis=\E[=6;<5, -- is2=\E%!0\ELBP0\E%!1\E[H\E[2g\EH\E[8C\EH\E[8C\EH\E[8C\EH\E[8C\EH\E[8C\EH\E[8C\EH\E[8C\EH\E[8C\EH\E[8C\EH\E[J, -- kcub1=\E[D, kcud1=\ED, kcuf1=\E[C, kcuu1=\EM, khome=\E[H, -- rev=\E[7m, ri=\E[T, -- rmcup=\E[?6h\E%!0\ELBP0\E%!1\E[32;1f, rmso=\E[m, -- rmul=\E[m, sgr0=\E[m, smcup=\E[?6l\E[H\E[J, smso=\E[7m, -- smul=\E[4m, tbc=\E[1g, -- --# From: <carolyn@dali.berkeley.edu> Thu Oct 31 12:54:27 1985 --# (tek4404: There was a "\!" in <smcup> that I replaced with "\E!". --# Tab had been given as \E2I,that must be the tab-set capability -- esr) --tek4404|tektronix 4404, -- OTbs, -- cols#80, it#8, lines#32, -- blink=\E[5m, bold=\E[1m, clear=\E[H\E[2J, -- csr=\E[%i%p1%d;%p2%dr, cub1=^H, cud1=^J, cuf1=\E[C, -- cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, dch1=\E[P, dl1=\E[1M, -- ed=\E[J, el=\E[K, home=\E[H, ht=^I, hts=\E[2I, il1=\E[1L, -- kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, rc=\E8, -- rmcup=\E[1;1H\E[0J\E[?6h\E[?1l, rmir=\E[4l, -- rmkx=\E[?1h, rmso=\E[27m, rmul=\E[m, sc=\E7, sgr0=\E[m, -- smcup=\E%\E!1\E[1;32r\E[?6l\E>, smir=\E[4h, -- smkx=\E[?1l, smso=\E[7m, smul=\E[4m, --# Some unknown person wrote: --# I added the is string - straight Unix has ESC ; in the login --# string which sets a ct8500 into monitor mode (aka 4025 snoopy --# mode). The is string here cleans up a few things (but not --# everything). --ct8500|tektronix ct8500, -- am, bw, da, db, -- cols#80, lines#25, -- bel=^G, cbt=\E^I, clear=\E^E, cr=^M, cub1=^H, cud1=^J, -- cuf1=\ES, cup=\E|%p1%{32}%+%c%p2%{32}%+%c, cuu1=\ER, -- dch1=\E^], dl1=\E^M, ed=\E^U, el=\E^T, ht=^I, ich1=\E^\, -- il1=\E^L, ind=^J, is2=\037\EZ\Ek, ri=\E^A, rmso=\E\s, -- rmul=\E\s, sgr0=\E\s, smso=\E$, smul=\E!, -+# p2 - Prism-2 (or Prism-1 or P99). -+# -+# p4 - Prism-4 (and older P7s & P8s). -+# p5 - Prism-5 (or Prism-6). -+# -+# p7 - Prism-7. -+# p8 - Prism-8 (in national or multinational mode). -+# p8-w - 132 column version of p8. -+# p9 - Prism-9 in ANSI mode. -+# p9-w - 132 column version of p9. -+# p9-8 - Prism-9 in Prism-8 emulation mode. -+# p9-8-w - As p9-8, but with 132 columns. -+# -+# p12 - Prism-12 in ANSI mode. -+# p12-w - 132 column version of p12. -+# p12-m - Prism-12 in MDC emulation mode. -+# p12-m-w - As p12-m, but with 132 columns. -+# p14 - Prism-14 in ANSI mode. -+# p14-w - 132 column version of p14. -+# p14-m - Prism-14 in MDC emulation mode. -+# p14-m-w - As p14-m, but with 132 columns. -+# -+# p2: Prism-2 -+# ----------- -+# -+# Includes Prism-1 and basic P99 without SP or MP loaded. -+# The simplest form of Prism-type terminal. -+# Basic cursor movement and clearing operations only. -+# No video attributes. -+# Notes: -+# Horizontal cursor qualifiers of NUL, XON and XOFF are mapped to the next -+# value up, followed by backspace. -+# -+prism2|MDC Prism-2, -+ am, bw, msgr, -+ cols#80, lines#24, -+ bel=^G, clear=\014$<20>, cr=^M, cub1=^H, cud1=^J, cuf1=^F, -+ cup=\013%p1%{32}%+%c\020%p2%{10}%/%{16}%*%p2%{10}%m%+%Pc%?%{17}%gc%=%{19}%gc%=%|%gc%!%|%t%{1}%gc%+%c%{8}%e%gc%;%c, -+ cuu1=^Z, ed=\EJ, el=\EK, home=^A, -+ hpa=\020%p1%{10}%/%{16}%*%p1%{10}%m%+%Pc%?%{17}%gc%=%{19}%gc%=%|%gc%!%|%t%{1}%gc%+%c%{8}%e%gc%;%c, -+ ind=^J, kbs=^H, khome=^A, vpa=\013%p1%{32}%+%c, - --# Tektronix 4205 terminal. -+# p4: Prism-4 -+# ----------- - # --# am is not defined because the wrap around occurs not when the char. --# is placed in the 80'th column, but when we are attempting to type --# the 81'st character on the line. (esr: hmm, this is like the vt100 --# version of xenl, perhaps am + xenl would work!) -+# Includes early versions of P7 & P8. -+# Basic family definition for most Prisms (except P2 and P9 ANSI). -+# Notes: -+# Horizontal cursor qualifiers of NUL, XON and XOFF are mapped to the next -+# value up, followed by backspace. -+# Cursor key definitions removed because they interfere with vi and csh keys. - # --# Bold, dim, and standout are simulated by colors and thus not allowed --# with colors. The tektronix color table is mapped into the RGB color --# table by setf/setb. All colors are reset to factory specifications by oc. --# The <initc> cap uses RGB notation to define colors. for arguments 1-3 the --# interval (0-1000) is broken into 8 smaller sub-intervals (125). Each sub- --# interval then maps into pre-defined value. --tek4205|tektronix 4205, -- ccc, mir, msgr, -- colors#8, cols#80, it#8, lines#30, ncv#49, pairs#63, -- acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -- bel=^G, blink=\E[5m, bold=\E[=7;<4m, cbt=\E[Z, -- clear=\E[2J\E[H, cr=^M, cub=\E[%p1%dD, cub1=\E[D, -- cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, cuf1=\E[C, -- cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, -- dch1=\E[1P, dim=\E[=1;<6m, dl1=\E[1M, ech=\E%p1%dX, -- ed=\E[J, el=\E[K, el1=\E[1K, enacs=\E)0, home=\E[H, ht=^I, -- ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[1L, ind=\ED, -- initc=\E%%!0\ETF4%?%p1%{0}%=%t0%e%p1%{1}%=%t4%e%p1%{2}%=%t3%e%p1%{3}%=%t5%e%p1%{4}%=%t2%e%p1%{5}%=%t6%e%p1%{6}%=%t7%e1%;%?%p2%{125}%<%t0%e%p2%{250}%<%tA2%e%p2%{375}%<%tA?%e%p2%{500}%<%tC8%e%p2%{625}%<%tD4%e%p2%{750}%<%tE1%e%p2%{875}%<%tE\:%eF4%;%?%p3%{125}%<%t0%e%p3%{250}%<%tA2%e%p3%{375}%<%tA?%e%p3%{500}%<%tC8%e%p3%{625}%<%tD4%e%p3%{750}%<%tE1%e%p3%{875}%<%tE\:%eF4%;%?%p4%{125}%<%t0%e%p4%{250}%<%tA2%e%p4%{375}%<%tA?%e%p4%{500}%<%tC8%e%p4%{625}%<%tD4%e%p4%{750}%<%tE1%e%p4%{875}%<%tE\:%eF4%;\E%%!1, -- invis=\E[=6;<5, is1=\E%!0\ETM1\E%!1\E[m, kbs=^H, -- kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kf0=\EOA, -- kf1=\EOB, kf2=\EOC, kf3=\EOD, kf4=\EP, kf5=\EQ, kf6=\ER, -- kf7=\ES, -- oc=\E%!0\ETFB000001F4F4F42F40030F404A4C<F450F4F46F40F47F4F40\E%!1, -- op=\E[39;40m, rev=\E[7m, ri=\EM, rmacs=^O, rmcup=, -- rmir=\E[4l, rmso=\E[=0;<1m, rmul=\E[24m, -- setb=\E[=%?%p1%{0}%=%t0m%e%p1%{1}%=%t4m%e%p1%{2}%=%t3m%e%p1%{3}%=%t5m%e%p1%{4}%=%t2m%e%p1%{5}%=%t6m%e%p1%{6}%=%t7m%e1m%;, -- setf=\E[<%?%p1%{0}%=%t0m%e%p1%{1}%=%t4m%e%p1%{2}%=%t3m%e%p1%{3}%=%t5m%e%p1%{4}%=%t2m%e%p1%{5}%=%t6m%e%p1%{6}%=%t7m%e1m%;, -- sgr0=\E[=0;<1m\E[24;25;27m\017, smacs=^N, -- smcup=\E%%!1\E[?6l\E[2J, smir=\E[4h, smso=\E[=2;<3m, -- smul=\E[4m, tbc=\E[1g, -+prism4|p4|P4|MDC Prism-4, -+ am, bw, hs, mc5i, msgr, -+ cols#80, lines#24, wsl#72, xmc#1, -+ bel=^G, blink=^CB, civis=^]\344, clear=\014$<20>, -+ cnorm=^]\342, cr=^M, cub1=^H, cud1=^J, cuf1=^F, -+ cup=\013%p1%{32}%+%c\020%p2%{10}%/%{16}%*%p2%{10}%m%+%Pc%?%{17}%gc%=%{19}%gc%=%|%gc%!%|%t%{1}%gc%+%c%{8}%e%gc%;%c, -+ cuu1=^Z, dim=^CA, dsl=\035\343\035\345, ed=\EJ, el=\EK, -+ fsl=^]\345, home=^A, -+ hpa=\020%p1%{10}%/%{16}%*%p1%{10}%m%+%Pc%?%{17}%gc%=%{19}%gc%=%|%gc%!%|%t%{1}%gc%+%c%{8}%e%gc%;%c, -+ ind=^J, invis=^CH, kbs=^H, khome=^A, mc0=\EU, mc4=\ET, mc5=\ER, -+ rev=^CD, rmso=^C\s, rmul=^C\s, -+ sgr=\003%{64}%?%p1%p3%|%t%{4}%+%;%?%p2%t%{16}%+%;%?%p4%t%{2}%+%;%?%p5%t%{1}%+%;%?%p7%t%{8}%+%;%c%?%p9%t\016%e\017%;, -+ sgr0=^C\s, smso=^CD, smul=^CP, tsl=^]\343, -+ vpa=\013%p1%{32}%+%c, - --#### Teletype (tty) -+# p5: Prism-5 -+# ----------- -+# -+# Same definition as p4. Includes Prism-6 (not tested!). -+# Does not use any multi-page features. - # --# These are the hardcopy Teletypes from before AT&T bought the company, --# clattering electromechanical dinosaurs in Bakelite cases that printed on --# pulpy yellow roll paper. If you remember these you go back a ways. --# Teletype-branded VDTs are listed in the AT&T section. -+prism5|p5|P5|MDC Prism-5, -+ use=p4, -+ -+# p7: Prism-7 -+# ----------- - # --# The earliest UNIXes were designed to use these clunkers; nroff and a few --# other programs still default to emitting codes for the Model 37. -+# Similar definition to p4. Uses ANSI cursor motion to avoid network problems. -+# Notes: -+# Use p4 for very early models of P7. -+# Rev-index removed; can't send nulls to terminal in 8-bit modes. - # -+prism7|p7|P7|MDC Prism-7, -+ cup=\E[%i%p1%d;%p2%dH, hpa@, vpa@, use=p4, - --tty33|tty35|model 33 or 35 teletype, -- hc, os, xon, -- cols#72, -- bel=^G, cr=^M, cud1=^J, ind=^J, --tty37|model 37 teletype, -- OTbs, hc, os, xon, -- bel=^G, cr=^M, cub1=^H, cud1=^J, cuu1=\E7, hd=\E9, hu=\E8, -- ind=^J, -+# p8: Prism-8 -+# ----------- -+# -+# Similar definition to p7. Uses ANSI cursor motion to avoid network problems. -+# Supports national and multinational character sets. -+# Notes: -+# Alternate char set operations only work in multinational mode. -+# Use p4 for very early models of P8. -+# Rev-index removed; can't send nulls to terminal in 8-bit modes. -+# (esr: commented out <smacs>/<rmacs> because there's no <acsc>) -+# -+prism8|p8|P8|MDC Prism-8, -+ cup=\E[%i%p1%d;%p2%dH, hpa=\E[%i%p1%d`, is2=\E[<12h, -+ vpa=\E[%i%p1%dd, use=p4, - --# There are known to be at least three flavors of the tty40, all seem more --# like IBM half duplex forms fillers than ASCII terminals. They have lots of --# awful braindamage, such as printing a visible newline indicator after each --# newline. The 40-1 is a half duplex terminal and is hopeless. The 40-2 is --# braindamaged but has hope and is described here. The 40-4 is a 3270 --# lookalike and beyond hope. The terminal has visible bell but I don't know --# it - it's null here to prevent it from showing the BL character. --# There is an \EG in <nl> because of a bug in old vi (if stty says you have --# a "newline" style terminal (-crmode) vi figures all it needs is nl --# to get crlf, even if <cr> is not ^M.) --# (tty40: removed obsolete ":nl=\EG\EB:", it's just do+cr -- esr) --tty40|ds40|ds40-2|dataspeed40|teletype dataspeed 40/2, -- OTbs, xon, -- cols#80, lines#24, -- clear=\EH$<20>\EJ$<80>, cr=\EG, cub1=^H, cud1=\EB, -- cuf1=\EC, cuu1=\E7, dch1=\EP$<50>, dl1=\EM$<50>, -- ed=\EJ$<75>, home=\EH$<10>, ht=\E@$<10>, hts=\E1, -- ich1=\E\^$<50>, il1=\EL$<50>, ind=\ES$<20>, kbs=^], -- kcub1=^H, mc4=^T, mc5=\022$<2000>, ri=\ET$<10>, rmso=\E4, -- rs2=\023\ER$<60>, smso=\E3, tbc=\EH\E2$<80>, --tty43|model 43 teletype, -- OTbs, am, hc, os, xon, -+# p8-w: Prism-8 in 132 column mode -+# -------------------------------- -+# -+# 'Wide' version of p8. -+# Notes: -+# Rev-index removed; can't send nulls to terminal in 8-bit modes. -+# -+prism8-w|p8-w|P8-W|MDC Prism-8 in 132 column mode, - cols#132, -- bel=^G, cr=^M, cub1=^H, cud1=^J, ind=^J, kbs=^H, -+ is2=\E[<12h\E[<14h, use=p8, - --#### Tymshare -+# p9: Prism-9 in ANSI mode -+# ------------------------- - # -+# The "flagship" model of this generation of terminals. -+# ANSI X3.64 (ISO 6429) standard sequences, plus many DEC VT220 ones. -+# Notes: -+# Tabs only reset by "reset". Otherwise assumes default (8 cols). -+# Fixes to deal with terminal firmware bugs: -+# . 'ri' uses insert-line since rev index doesn't always -+# . 'sgr0' has extra '0' since esc[m fails -+# . 'fsl' & 'dsl' use illegal char since cr is actioned wrong on line 25 -+# Not covered in the current definition: -+# . Labels -+# . Programming Fn keys -+# . Graphic characters (defaults correctly to vt100) -+# . Padding values (sets xon) -+# (esr: commented out <smacs>/<rmacs> because there's no <acsc>) -+# -+prism9|p9|P9|MDC Prism-9 in ANSII mode, -+ am, bw, hs, msgr, xenl, xon, -+ cols#80, it#8, lines#24, vt#3, wsl#72, -+ bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[<4l, -+ clear=^L, cnorm=\E[<4h, cr=^M, csr=\E[%i%p1%d;%p2%d%%v, -+ cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=^J, -+ cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, -+ cuu=\E[%p1%dA, cuu1=\E[A, dch=\E[%p1%dP, dch1=\E[P, -+ dl=\E[%p1%dM, dl1=\E[M, dsl=\E[%}\024, ech=\E[%p1%dX, -+ ed=\E[J$<10>, el=\E[K, fsl=^T, home=\E[H, hpa=\E[%i%p1%d`, -+ ht=^I, hts=\EH, il=\E[%p1%dL, il1=\E[L, ind=^J, -+ is2=\E[&p\E[<12l\E F, kbs=^H, kclr=^L, kcub1=\E[D, -+ kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kf1=\E[11~, -+ kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, -+ kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, kf17=\E[31~, -+ kf18=\E[32~, kf2=\E[12~, kf3=\E[13~, kf4=\E[14~, -+ kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, -+ khome=\E[H, nel=^M^J, prot=\E[32%{, rc=\E[%z, -+ rep=\E[%p2%db%p1%c, rev=\E[7m, ri=\E[L, rmir=\E[4l, -+ rmso=\E[27m, rmul=\E[24m, -+ rs2=\E[&p\E[<12l\E F\E[3g\E[9;17;25;33;41;49;57;65;73 N, -+ sc=\E[%y, -+ sgr=\E[0%?%p1%p3%|%t;7%;%?%p2%t;4%;%?%p4%t;5%;%?%p6%t;1%;m%?%p8%t\E[32%%{%;%?%p9%t\016%e\017%;, -+ sgr0=\E[0m\017, smir=\E[4h, smso=\E[7m, smul=\E[4m, -+ tbc=\E[3g, tsl=\E[%i%p1%d%%}, vpa=\E[%i%p1%dd, -+ use=ansi+pp, - --# You can add <is2=\E<> to put this 40-column mode, though I can't --# for the life of me think why anyone would want to. --scanset|sc410|sc415|Tymshare Scan Set, -- am, bw, msgr, -- cols#80, lines#24, -- acsc=j%k4l<m-q\,x5, bel=^G, clear=\EH\EJ, cr=^M, cub1=^H, -- cud1=^J, cuf1=^I, cup=\EY%p1%{32}%+%c%p2%{32}%+%c, -- cuu1=^K, ed=\EJ, el=\EK, home=\EH, ind=^J, kcub1=\ED, -- kcud1=\EB, kcuf1=\EC, kcuu1=\EA, mc0=\E;3, mc4=\E;0, -- mc5=\E;0, rc=^C, rmacs=^O, rs1=\E>, sc=^B, smacs=^N, -- --#### Volker-Craig (vc) -+# p9-w: Prism-9 in 132 column mode -+# -------------------------------- - # --# If you saw a Byte Magazine cover with a terminal on it during the early --# 1980s, it was probably one of these. Carl Helmers liked them because --# they could crank 19.2 and were cheap (that is, he liked them until he tried --# to program one...) -+# 'Wide' version of p9. - # -+prism9-w|p9-w|P9-W|MDC Prism-9 in 132 column mode, -+ cols#132, -+ is2=\E[&p\E[<12l\E F\E[<14h, -+ rs2=\E[&p\E[<12l\E F\E[<14h, use=p9, - --# Missing in vc303a and vc303 descriptions: they scroll 2 lines at a time --# every other linefeed. --vc303|vc103|vc203|volker-craig 303, -- OTbs, OTns, am, -- cols#80, lines#24, -- bel=^G, clear=\014$<40>, cr=^M, cub1=^H, cud1=^J, cuf1=^I, -- cuu1=^N, home=\013$<40>, kcub1=^H, kcud1=^J, kcuf1=^I, -- kcuu1=^N, ll=\017$<1>W, --vc303a|vc403a|volker-craig 303a, -- clear=\030$<40>, cuf1=^U, cuu1=^Z, el=\026$<20>, -- home=\031$<40>, kcuf1=^U, kcuu1=^Z, ll=^P, use=vc303, --# (vc404: removed obsolete ":ma=^Z^P^U :" -- esr) --vc404|volker-craig 404, -- OTbs, am, -- cols#80, lines#24, -- bel=^G, clear=\030$<40>, cr=^M, cub1=^H, cud1=^J, cuf1=^U, -- cup=\020%p1%{32}%+%c%p2%{32}%+%c, cuu1=^Z, -- ed=\027$<40>, el=\026$<20>, home=\031$<40>, ind=^J, -- kcub1=^H, kcud1=^J, kcuf1=^U, kcuu1=^Z, --vc404-s|volker-craig 404 w/standout mode, -- cud1=^J, rmso=^O, smso=^N, use=vc404, --# From: <wolfgang@cs.sfu.ca> --# (vc414: merged in cup/dl1/home from an old vc414h-noxon) --vc414|vc414h|Volker-Craig 414H in sane escape mode., -- OTbs, am, -- cols#80, lines#24, -- clear=\E\034$<40>, cud1=\E^K, cuf1=^P, -- cup=\E\021%p2%c%p1%c$<40>, cuu1=\E^L, dch1=\E3, -- dl1=\E\023$<40>, ed=\E^X, el=\E\017$<10/>, home=\E^R, -- ich1=\E\:, il1=\E\032$<40>, kcub1=^H, kcud1=\E^K, kcuf1=^P, -- kcuu1=\E^L, kf0=\EA, kf1=\EB, kf2=\EC, kf3=\ED, kf4=\EE, -- kf5=\EF, kf6=\EG, kf7=\EH, khome=\E^R, lf0=PF1, lf1=PF2, -- lf2=PF3, lf3=PF4, lf4=PF5, lf5=PF6, lf6=PF7, lf7=PF8, -- rmso=\E^_, smso=\E^Y, --vc415|volker-craig 415, -- clear=^L, use=vc404, -- --######## OBSOLETE PERSONAL-MICRO CONSOLES AND EMULATIONS -+# p9-8: Prism-9 in P8 mode -+# ------------------------ -+# -+# P9 terminal in P8 emulation mode. -+# Similar to p8 definition. -+# Insertion and deletion operations possible. - # -+prism9-8|p9-8|P9-8|MDC Prism-9 in P8 mode, -+ dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, -+ ich=\E[%p1%d@, ich1=\E[@, il=\E[%p1%dL, il1=\E[L, use=p8, - --#### IBM PC and clones -+# p9-8-w: Prism-9 in P8 and 132 column modes -+# ------------------------------------------ -+# -+# P9 terminal in P8 emulation mode and 132 column mode. - # -+prism9-8-w|p9-8-w|P9-8-W|MDC Prism-9 in Prism 8 emulation and 132 column mode, -+ dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, -+ ich=\E[%p1%d@, ich1=\E[@, il=\E[%p1%dL, il1=\E[L, use=p8-w, - --# The pcplot IBM-PC terminal emulation program is really messed up. It is --# supposed to emulate a vt-100, but emulates the wraparound bug incorrectly, --# doesn't support scrolling regions, ignores add line commands, and ignores --# delete line commands. Consequently, the resulting behavior looks like a --# crude adm3a-type terminal. --# Steve Jacobson 8/85 --pcplot|pc-plot terminal emulation program, -- xenl@, -- csr@, dl@, dl1@, il@, il1@, rc@, sc@, use=vt100, --# KayPro II from Richard G Turner <rturner at Darcom-Hq.ARPA> --# I've found that my KayPro II, running MDM730, continues to emulate an --# ADM-3A terminal, just like I was running TERM.COM. On our 4.2 UNIX --# system the following termcap entry works well: --# I have noticed a couple of minor glitches, but nothing I can't work --# around. (I added two capabilities from the BRL entry -- esr) --kaypro|kaypro2|kaypro II, -- OTbs, am, -- cols#80, lines#24, -- bel=^G, clear=\032$<1/>, cr=^M, cud1=^J, cuf1=^L, -- cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dl1=\ER, ed=^W, -- el=^X, home=^^, il1=\EE, ind=^J, kcud1=^J, kcuf1=^L, kcuu1=^K, -+# p12: Prism-12 in ANSI mode -+# --------------------------- -+# -+# See p9 definition. -+# -+prism12|p12|P12|MDC Prism-12 in ANSI mode, -+ use=p9, - --# From IBM, Thu May 5 19:35:27 1983 --# (ibmpc: commented out <smir>=\200R because we don't know <rmir> -- esr) --ibm-pc|ibm5051|5051|IBM Personal Computer (no ANSI.SYS), -- OTbs, am, -- cols#80, lines#24, -- bel=^G, clear=^L^K, cr=^M^^, cub1=^], cud1=^J, cuf1=^\, -- cuu1=^^, home=^K, ind=\n$<10>, kcud1=^_, -+# p12-w: Prism-12 in 132 column mode -+# ---------------------------------- -+# -+# 'Wide' version of p12. -+# -+prism12-w|p12-w|P12-W|MDC Prism-12 in 132 column mode, -+ use=p9-w, - --ibmpc|wy60-PC|wyse60-PC|IBM PC/XT running PC/IX, -- OTbs, am, bw, eo, hs, km, msgr, ul, -- cols#80, it#8, lines#24, -- acsc=j\331k\277l\332m\300n\305q\304t\303u\264v\301w\302x\263, -- bel=^G, blink=\E[5m, bold=\E[1m, clear=\Ec, cr=^M, -- cub=\E[%p1%dD, cub1=\E[D, cud=\E[%p1%dB, cud1=\E[B, -- cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, -- cuu=\E[%p1%dA, cuu1=\E[A, ech=\E[%p1%dX, ed=\E[J, el=\E[K, -- home=\E[H, hpa=\E[%i%p1%dG, ind=\E[S\E[B, -- indn=\E[%p1%dS\E[%p1%dB, invis=\E[30;40m, kbs=^H, -- kcbt=^], kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, -- kdch1=\177, kend=\E[Y, kf1=\240, kf10=\251, kf2=\241, -- kf3=\242, kf4=\243, kf5=\244, kf6=\245, kf7=\246, kf8=\247, -- kf9=\250, khome=\E[H, kich1=\E[^H, knp=\E[U, kpp=\E[V, -- ll=\E[24;1H, nel=^M, rev=\E[7m, ri=\E[T\E[A, -- rin=\E[%p1%dT\E[%p1%dA, rmso=\E[m, rmul=\E[m, -- sgr=\E[%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;m, -- sgr0=\E[m, smso=\E[7m, smul=\E[4m, -+# p12-m: Prism-12 in MDC emulation mode -+# ------------------------------------- -+# -+# P12 terminal in MDC emulation mode. -+# Similar to p8 definition. -+# Insertion and deletion operations possible. -+# -+prism12-m|p12-m|P12-M|MDC Prism-12 in MDC emulation mode, -+ use=p9-8, - --#### Apple II -+# p12-m-w: Prism-12 in MDC emulation and 132 column modes -+# ------------------------------------------------------- - # --# Apple II firmware console first, then various 80-column cards and --# terminal emulators. For two cents I'd toss all these in the UFO file --# along with the 40-column apple entries. -+# P12 terminal in MDC emulation mode and 132 column mode. - # -+prism12-m-w|p12-m-w|P12-M-W|MDC Prism-12 in MDC emulation and 132 column mode, -+ use=p9-8-w, - --# From: brsmith@umn-cs.cs.umn.edu (Brian R. Smith) via BRL --# 'it#8' tells UNIX that you have tabs every 8 columns. This is a --# function of TIC, not the firmware. --# The clear key on a IIgs will do something like clear-screen, --# depending on what you're in. --appleIIgs|appleIIe|appleIIc|Apple 80 column firmware interface, -- OTbs, am, bw, eo, msgr, -- cols#80, it#8, lines#24, -- bel=^G, clear=^L, cr=^M, cub1=^H, cud1=^J, cuf1=^\, -- cup=\036%p2%{32}%+%c%p1%{32}%+%c, cuu1=^_, ed=^K, el=^], -- home=^Y, ht=^I, ind=^W, kbs=^H, kclr=^X, kcub1=^H, kcud1=^J, -- kcuf1=^U, kcuu1=^K, kdch1=\177, nel=^M^W, ri=^V, rmso=^N, -- smso=^O, --# Apple //e with 80-column card, entry from BRL --# The modem interface is permitted to discard LF (maybe DC1), otherwise --# passing characters to the 80-column firmware via COUT (PR#3 assumed). --# Auto-wrap does not work right due to newline scrolling delay, which also --# requires that you set "stty cr2". --# Note: Cursor addressing is only available via the Pascal V1.1 entry, --# not via the BASIC PR#3 hook. All this nonsense can be avoided only by --# using a terminal emulation program instead of the built-in firmware. --apple2e|Apple //e, -- bw, msgr, -- cols#80, lines#24, -- bel=^G, clear=\014$<100/>, cub1=^H, cud1=^J, cuu1=^_, -- ed=\013$<4*/>, el=\035$<4/>, home=^Y, ht=^I, ind=^W, -- is2=^R^N, kbs=^H, kcub1=^H, kcud1=^J, kcuf1=^U, kcuu1=^K, -- nel=\r$<100/>, rev=^O, ri=^V, rmso=^N, rs1=^R^N, sgr0=^N, -- smso=^O, --# mcvax!vu44!vu45!wilcke uses the "ap" entry together with Ascii Express Pro --# 4.20, with incoming and outgoing terminals both on 0, emulation On. --apple2e-p|Apple //e via Pascal, -- cup=\036%p2%{32}%+%c%p1%{32}%+%c, kbs=^H, kcub1=^H, -- kcud1=^J, use=apple2e, --# (ASCII Express) MouseTalk "Standard Apple //" emulation from BRL --# Enable DC3/DC1 flow control with "stty ixon -ixany". --apple-ae|ASCII Express, -- OTbs, am, bw, msgr, nxon, xon, -- cols#80, it#8, lines#24, -- bel=\007$<500/>, clear=^L, cr=^M, cub1=^H, cud1=^J, cuf1=^U, -- cup=\036%p2%{32}%+%c%p1%{32}%+%c, cuu1=^_, ed=^K, el=^], -- home=^Y, ind=^W, is2=^R^N, kclr=^X, kcub1=^H, kcud1=^J, -- kcuf1=^U, kcuu1=^K, rev=^O, ri=^V, rmso=^N, rs1=^R^N, sgr0=^N, -- smso=^O, --appleII|apple ii plus, -- OTbs, am, -- cols#80, it#8, lines#24, -- clear=^L, cnorm=^TC2, cub1=^H, cud1=^J, cuf1=^\, -- cup=\036%p2%{32}%+%c%p1%{32}%+%c, cuu1=^_, cvvis=^TC6, -- ed=^K, el=^], flash=\024G1$<200/>\024T1, home=\E^Y, ht=^I, -- is2=\024T1\016, kcud1=^J, kcuf1=^U, rmso=^N, sgr0=^N, -- smso=^O, --# Originally by Gary Ford 21NOV83 --# From: <ee178aci%sdcc7@SDCSVAX.ARPA> Fri Oct 11 21:27:00 1985 --apple-80|apple II with smarterm 80 col, -- OTbs, am, bw, -- cols#80, lines#24, -- cbt=^R, clear=\014$<10*/>, cr=\r$<10*/>, cub1=^H, cud1=^J, -- cuf1=^\, cup=\036%p2%{32}%+%c%p1%{32}%+%c, cuu1=^_, -- ed=\013$<10*/>, el=\035$<10/>, home=^Y, --apple-soroc|apple emulating soroc 120, -- am, -- cols#80, lines#24, -- bel=^G, clear=\E*$<300>, cr=^M, cub1=^H, cud1=^J, cuf1=^L, -- cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, ed=\EY, el=\ET, -- home=^^, ind=^J, kcub1=^H, kcud1=^J, kcuf1=^L, kcuu1=^K, --# From Peter Harrison, Computer Graphics Lab, San Francisco --# ucbvax!ucsfmis!harrison .....uucp --# ucbvax!ucsfmis!harrison@BERKELEY .......ARPA --# "These two work. If you don't have the inverse video chip for the --# Apple with videx then remove the :so: and :se: fields." --# (apple-videx: this used to be called DaleApple -- esr) --apple-videx|Apple with videx videoterm 80 column board with inverse video, -- OTbs, am, xenl, -- cols#80, it#8, lines#24, -- clear=\014$<300/>, cub1=^H, cud1=^J, cuf1=^\, -- cup=\036%p2%{32}%+%c%p1%{32}%+%c, cuu1=^_, ed=^K, el=^], -- home=^Y, ht=^I, kcub1=^H, kcud1=^J, kcuf1=^U, khome=^Y, -- rmso=^Z2, sgr0=^Z2, smso=^Z3, --# My system [for reference] : Apple ][+, 64K, Ultraterm display card, --# Apple Cat ][ 212 modem, + more all --# controlled by ASCII Express: Pro. --# From Dave Shaver <isucs1!shaver> --apple-uterm-vb|Videx Ultraterm for Apple micros with Visible Bell, -- OTbs, am, eo, xt, -- cols#80, lines#24, -- acsc=, clear=^L, cuf1=^\, -- cup=\036%p2%{32}%+%c%p1%{32}%+%c, cuu1=^_, ed=^K, el=^], -- flash=^W35^W06, home=^Y, -- is2=^V4^W06\017\rVisible Bell Installed.\016\r\n, -- rmso=^N, smso=^O, --apple-uterm|Ultraterm for Apple micros, -- OTbs, am, eo, xt, -- cols#80, lines#24, -- acsc=, clear=^L, cuf1=^\, -- cup=\036%p2%{32}%+%c%p1%{32}%+%c, cuu1=^_, ed=^K, el=^], -- home=^Y, is2=^V4^W06\016, rmso=^N, smso=^O, --# from trwrba!bwong (Bradley W. Wong): -+# p14: Prism-14 in ANSII mode -+# --------------------------- - # --# This entry assumes that you are using an apple with the UCSD Pascal --# language card. SYSTEM.MISCINFO is assumed to be the same as that --# supplied with the standard apple except that screenwidth should be set --# using SETUP to 80 columns. Note that the right arrow is not mapped in --# this termcap entry. This is because that key, on the Apple, transmits --# a ^U and would thus preempt the more useful "up" function of vi. -+# See p9 definition. - # --# HMH 2/23/81 --apple80p|80-column apple with Pascal card, -- am, bw, -- cols#80, lines#24, -- clear=^Y^L, cuf1=^\\:, -- cup=\036%p2%{32}%+%c%p1%{32}%+%c, cuu1=^_, ed=^K, el=^], -- home=^Y, kcub1=^H, -+prism14|p14|P14|MDC Prism-14 in ANSII mode, -+ use=p9, -+ -+# p14-w: Prism-14 in 132 column mode -+# ---------------------------------- - # --# Apple II+ equipped with Videx 80 column card -+# 'Wide' version of p14. - # --# Terminfo from ihnp4!ihu1g!djc1 (Dave Christensen) via BRL; --# manually converted by D A Gwyn -+prism14-w|p14-w|P14-W|MDC Prism-14 in 132 column mode, -+ use=p9-w, -+ -+# p14-m: Prism-14 in MDC emulation mode -+# ------------------------------------- - # --# DO NOT use any terminal emulation with this data base, it works directly --# with the Videx card. This has been tested with vi 1200 baud and works fine. -+# P14 terminal in MDC emulation mode. -+# Similar to p8 definition. -+# Insertion and deletion operations possible. - # --# This works great for vi, except I've noticed in pre-R2, ^U will scroll back --# 1 screen, while in R2 ^U doesn't. --# For inverse alternate character set add: --# <smacs>=^O:<rmacs>=^N: --# (apple-v: added it#8 -- esr) --apple-videx2|Apple II+ w/ Videx card (similar to Datamedia h1520), -- am, xenl, -- cols#80, it#8, lines#24, -- bel=\007$<100/>, clear=\014$<16*/>, cr=^M, cub1=^H, -- cud1=^J, cuf1=^\, cup=\036%p2%{32}%+%c%p1%{32}%+%c, -- cuu1=^_, ed=\013$<16*/>, el=^], home=^Y, ht=\011$<8/>, -- ind=^J, kbs=^H, kcub1=^H, kcud1=^J, kcuf1=^\, kcuu1=^_, -- khome=^Y, rmso=^Z2, smso=^Z3, --apple-videx3|vapple|Apple II with 80 col card, -+prism14-m|p14-m|P14-M|MDC Prism-14 in MDC emulation mode, -+ use=p9-8, -+ -+# p14-m-w: Prism-14 in MDC emulation and 132 column modes -+# ------------------------------------------------------- -+# -+# P14 terminal in MDC emulation mode and 132 column mode. -+# -+prism14-m-w|p14-m-w|P14-M-W|MDC Prism-14 in MDC emulation and 132 column mode, -+ use=p9-8-w, -+ -+# End of McDonnell Information Systems Prism definitions -+ -+# These things were popular in the Pick database community at one time -+# From: George Land <georgeland@aol.com> 24 Sep 1996 -+p8gl|prism8gl|McDonnell-Douglas Prism-8 alternate definition, -+ am, bw, hs, mir, -+ cols#80, lines#24, ma#1, wsl#78, xmc#1, -+ bel=^G, blink=^CB, clear=^L, cr=^M, cub1=^U, cud1=^J, cuf1=^F, -+ cup=\E[%i%p1%d;%p2%dH, cuu1=^Z, dch1=\s^H, dim=^CA, dl1=^P, -+ ed=\EJ, el=\EK, home=^A, ind=^J, invis=^CH, kbs=^H, kcub1=^U, -+ kcud1=^J, kcuf1=^F, kcuu1=^Z, kdch1=\s^H, kdl1=^P, ked=\EJ, -+ kel=\EK, kf1=^A@\r, kf10=^AI\r, kf12=^AJ\r, kf13=^AK\r, -+ kf14=^AL\r, kf15=^AM\r, kf16=^AN\r, kf17=^AO\r, kf2=^AA\r, -+ kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, kf6=^AE\r, kf7=^AF\r, -+ kf8=^AG\r, kf9=^AH\r, khome=^A, lf1=F1, lf10=F10, lf2=F2, -+ lf3=F3, lf4=F4, lf5=F5, lf6=F6, lf7=F7, lf8=F8, lf9=F9, nel=^J^M, -+ pad=\0, rev=^CD, rmso=^C\s, rmul=^C\s, sgr0=^C\s, smso=^CE, -+ smul=^C0, -+ -+#### Microterm (act, mime) -+# -+# The mime1 entries refer to the Microterm Mime I or Mime II. -+# The default mime is assumed to be in enhanced act iv mode. -+# -+ -+# New "safe" cursor movement (5/87) from <reuss@umd5.umd.edu>. Prevents -+# freakout with out-of-range args on Sytek multiplexors. No <smso=^N> and -+# <rmso=^N> since it gets confused and it's too dim anyway. No <ich1> -+# since Sytek insists ^S means xoff. -+# (act4: found ":ic=2^S:ei=:im=:ip=.1*^V:" commented out in 8.3 -- esr) -+act4|microterm|microterm act iv, - OTbs, am, - cols#80, lines#24, -- clear=\Ev, cub1=\ED, cud1=\EB, cuf1=\EC, -- cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, el=\Ex, -- home=\EH, kcub1=\ED, kcud1=\EB, kcuf1=\EC, kcuu1=\EA, -- kf0=\EP, kf1=\EQ, kf2=\ER, kf3=\E\s, kf4=\E!, kf5=\E", kf6=\E#, -- kf7=\E$, kf8=\E%%, kf9=\E&, khome=\EH, --#From: decvax!cbosgd!cbdkc1!mww Mike Warren via BRL --aepro|Apple II+ running ASCII Express Pro--vt52, -+ bel=^G, clear=\014$<12/>, cr=^M, cub1=^H, cud1=^K, cuf1=^X, -+ cup=\024%p1%{24}%+%c%p2%p2%?%{47}%>%t%{48}%+%;%{80}%+%c, -+ cuu1=^Z, dch1=\004$<.1*/>, dl1=\027$<2.3*/>, -+ ed=\037$<2.2*/>, el=\036$<.1*/>, home=^], -+ il1=\001<2.3*/>, ind=^J, kcub1=^H, kcud1=^K, kcuf1=^X, -+ kcuu1=^Z, -+# The padding on :sr: and :ta: for act5 and mime is a guess and not final. -+# The act 5 has hardware tabs, but they are in columns 8, 16, 24, 32, 41 (!)... -+# (microterm5: removed obsolete ":ma==^Z^P^Xl^Kj:" -- esr) -+act5|microterm5|microterm act v, -+ kcub1=^H, kcud1=^K, kcuf1=^X, kcuu1=^Z, ri=\EH$<3>, uc=^H\EA, -+ use=act4, -+# Mimes using brightness for standout. Half bright is really dim unless -+# you turn up the brightness so far that lines show up on the screen. -+mime-fb|full bright mime1, -+ is2=^S\E, rmso=^S, smso=^Y, use=mime, -+mime-hb|half bright mime1, -+ is2=^Y\E, rmso=^Y, smso=^S, use=mime, -+# (mime: removed obsolete ":ma=^X ^K^J^Z^P:"; removed ":do=^K:" that overrode -+# the more plausible ":do=^J:" -- esr) -+# uc was at one time disabled to get around a curses bug, be wary of it -+mime|mime1|mime2|mimei|mimeii|microterm mime1, -+ OTbs, am, -+ cols#80, it#8, lines#24, vt#9, -+ bel=^G, clear=^]^C, cr=^M, cub1=^H, cud1=^J, cuf1=^X, -+ cup=\024%p1%{24}%+%c%p2%p2%?%{32}%>%t%{48}%+%;%{80}%+%c, -+ cuu1=^Z, dl1=\027$<80>, ed=^_, el=^^, home=^], ht=\011$<2>, -+ il1=\001$<80>, ind=^J, is2=^S\E^Q, kcub1=^H, kcud1=^K, -+ kcuf1=^X, kcuu1=^Z, ri=\022$<3>, uc=^U, -+# These termcaps (for mime2a) put the terminal in low intensity mode -+# since high intensity mode is so obnoxious. -+mime2a-s|microterm mime2a (emulating an enhanced soroc iq120), -+ OTbs, am, -+ cols#80, lines#24, -+ bel=^G, clear=\EL, cr=^M, cub1=^H, cud1=^J, cuf1=^L, -+ cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EI, dch1=\ED, -+ dl1=\027$<20*>, ed=\EJ$<20*>, el=\EK, home=^^, -+ il1=\001$<20*>, ind=^J, ip=$<2>, is2=\E), kcub1=^H, kcud1=^J, -+ kcuf1=^L, kcuu1=^K, ri=\EI, rmir=^Z, rmso=\E;, rmul=\E7, -+ smir=\EE, smso=\E\:, smul=\E6, -+# This is the preferred mode (but ^X can't be used as a kill character) -+mime2a|mime2a-v|microterm mime2a (emulating an enhanced vt52), - OTbs, -+ cols#80, it#8, lines#24, -+ bel=^G, clear=\EL, cr=^M, cub1=^H, cud1=^J, cuf1=\EC, -+ cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, dch1=^N, -+ dl1=\027$<20*>, ed=\EQ$<20*>, el=\EP, home=\EH, ht=^I, -+ il1=\001$<20*>, ind=^J, ip=$<2>, is2=^Y, kcub1=\ED, -+ kcud1=\EB, kcuf1=\EC, kcuu1=\EA, ri=\EA, rmir=^Z, rmso=\E9, -+ rmul=\E5, smir=^O, smso=\E8, smul=\E4, -+# (mime3a: removed obsolete ":ma=^X ^K^J^Z^P:" -- esr) -+mime3a|mime1 emulating 3a, -+ am@, -+ kcub1=^H, kcud1=^K, kcuf1=^X, kcuu1=^Z, use=adm3a, -+mime3ax|mime-3ax|mime1 emulating enhanced 3a, -+ it#8, -+ dl1=\027$<80>, ed=^_, el=^X, ht=\011$<3>, il1=\001$<80>, -+ use=mime3a, -+# Wed Mar 9 18:53:21 1983 -+# We run our terminals at 2400 baud, so there might be some timing problems at -+# higher speeds. The major improvements in this model are the terminal now -+# scrolls down and insert mode works without redrawing the rest of the line -+# to the right of the cursor. This is done with a bit of a kludge using the -+# exit graphics mode to get out of insert, but it does not appear to hurt -+# anything when using vi at least. If you have some users using act4s with -+# programs that use curses and graphics mode this could be a problem. -+mime314|mm314|mime 314, -+ am, - cols#80, lines#24, -- clear=\014$<300/>, cub1=\ED, cud1=\EB, cuf1=\EC, -- cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, ed=\EJ, -- el=\EK, home=\EH, --# UCSD addition: Yet another termcap from Brian Kantor's Micro Munger Factory --apple-vm80|ap-vm80|apple with viewmax-80, -- OTbs, -+ clear=^L, cub1=^H, cuf1=^X, cup=\024%p1%c%p2%c, cuu1=^Z, -+ dch1=^D, dl1=^W, ed=^_, el=^^, home=^], ht=^I, il1=^A, kcub1=^H, -+ kcud1=^K, kcuf1=^X, kcuu1=^Z, rmir=^V, smir=^S, -+# Microterm mime 340 from University of Wisconsin -+mm340|mime340|mime 340, - cols#80, lines#24, -- clear=\014$<300/>, cuf1=^\\:, -- cup=\036%p1%{32}%+%c%p2%{32}%+%c$<100/>, cuu1=^_, -- ed=\013$<300/>, el=^], home=\031$<200/>, -+ clear=\032$<12/>, cr=^M, cub1=^H, cud1=^J, cuf1=^L, -+ cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, -+ dch1=\E#$<2.1*/>, dl1=\EV$<49.6/>, ed=\037$<2*/>, -+ el=\EL$<2.1/>, ht=^I, il1=\EU$<46/>, ind=^J, is2=\E\,, -+ kbs=^H, kcub1=^H, kcud1=^J, kcuu1=^K, nel=^M^J, -+# This came from University of Wisconsin marked "astro termcap for jooss". -+# (mt4520-rv: removed obsolete ":kn#4:" and incorrect ":ri=\E[C:"; -+# also added <rmam>/<smam> based on the init string -- esr) -+mt4520-rv|micro-term 4520 reverse video, -+ am, hs, msgr, xenl, xon, -+ cols#80, it#8, lines#24, wsl#80, -+ bel=^G, clear=\E[H\E[J, cnorm=\E[0V\E8, cr=^M, -+ csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=\E[D, -+ cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, cuf1=\E[C, -+ cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, -+ cvvis=\E7\E[0U, dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, -+ dl1=\E[M, ed=\E[J, el=\E[K, flash=\E[?5l$<200/>\E[?5h, -+ fsl=\E[?5l\E[?5h, home=\E[H, ht=^I, hts=\EH, ich=\E[%p1%d@, -+ ich1=\E[@, il=\E[%p1%dL, il1=\E[L, ind=\ED, -+ is2=\E(B\E[2l\E>\E[20l\E[?3l\E[?5h\E[?7h\E[1;24r\E[24;1H\E[H\E[J, -+ kbs=^H, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, -+ kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, khome=\E[H, -+ ll=\E[24;1H, nel=\EE, rc=\E8, rf=/usr/share/tabset/vt100, -+ ri=\EM, rmam=\E[?7l, rmso=\E[0m, rmul=\E[24m, -+ rs1=\E(B\E[2l\E>\E[20l\E[?3l\E[?5h\E[?7h\E[H\E[J, -+ sc=\E7, sgr0=\E[m, smam=\E[?7h, smso=\E[7m, smul=\E[4m, -+ tbc=\E[g, tsl=\E[25;1H, - --#### Apple Lisa & Macintosh -+# Fri Aug 5 08:11:57 1983 -+# This entry works for the ergo 4000 with the following setups: -+# ansi,wraparound,newline disabled, xon/xoff disabled in both -+# setup a & c. - # -+# WARNING!!! There are multiple versions of ERGO 4000 microcode -+# Be advised that very early versions DO NOT WORK RIGHT !! -+# Microterm does have a ROM exchange program- use it or lose big -+# (ergo400: added <rmam>/<smam> based on the init string -- esr) -+ergo4000|microterm ergo 4000, -+ da, db, msgr, -+ cols#80, lines#66, -+ bel=^G, clear=\E[H\E[2J$<80>, cr=^M, cub1=^H, cud1=\E[B, -+ cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, -+ dch1=\E[1P$<80>, dl1=\E[1M$<5*>, ed=\E[0J$<15>, -+ el=\E[0K$<13>, ht=^I, il1=\E[1L$<5*>, ind=\ED$<20*>, -+ is2=\E<\E=\E[?1l\E[?4l\E[?5l\E[?7h\E[?8h$<300>, -+ kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kf1=\EOP, -+ kf2=\EOQ, kf3=\EOR, kf4=\EOS, lf1=pf1, lf2=pf2, lf3=pf3, -+ lf4=pf4, ri=\EM$<20*>, rmam=\E[?7l, rmir=\E[4l, -+ rmkx=\E=$<4>, rmso=\E[m$<20>, sgr0=\E[m$<20>, -+ smam=\E[?7m, smir=\E[4h$<6>, smkx=\E=$<4>, -+ smso=\E[7m$<20>, - --# (lisa: changed <cvvis> to <cnorm> -- esr) --lisa|apple lisa console display (black on white), -- OTbs, am, eo, msgr, -- cols#88, it#8, lines#32, -- acsc=jdkclfmenbqattuvvuwsx`, civis=\E[5h, clear=^L, -- cnorm=\E[5l, cub1=^H, cud1=\E[B, cuf1=\E[C, -- cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, dch1=\E[P, dl1=\E[M, -- ed=\E[J, el=\E[K, home=\E[H, ht=^I, ich1=\E[@, il1=\E[L, -- is2=\E>\E[m\014, kbs=^H, kcub1=\E[D, kcud1=\E[B, -- kcuf1=\E[C, kcuu1=\E[A, rmacs=\E[10m, rmso=\E[m, rmul=\E[m, -- sgr0=\E[m, smacs=\E[11m, smso=\E[7m, smul=\E[4m, --liswb|apple lisa console display (white on black), -- is2=\E>\E[0;7m\014, rmso=\E[0;7m, rmul=\E[0;7m, -- smso=\E[m, smul=\E[4m, use=lisa, -- --# lisaterm from ulysses!gamma!epsilon!mb2c!jed (John E. Duncan III) via BRL; --# <is2> revised by Ferd Brundick <fsbrn@BRL.ARPA> -+#### NCR - # --# These entries assume that the 'Auto Wraparound' is enabled. --# Xon-Xoff flow control should also be enabled. -+# NCR's terminal group was merged with AT&T's when AT&T bought the company. -+# For what happened to that group, see the ADDS section. - # --# The vt100 uses :rs2: and :rf: rather than :is2:/:tbc:/:hts: because the tab --# settings are in non-volatile memory and don't need to be reset upon login. --# Also setting the number of columns glitches the screen annoyingly. --# You can type "reset" to get them set. -+# There is an NCR4103 terminal that's just a re-badged Wyse-50. - # --lisaterm|Apple Lisa or Lisa/2 running LisaTerm vt100 emulation, -- OTbs, OTpt, am, xenl, xon, -- OTkn#4, cols#80, it#8, lines#24, vt#3, -- bel=^G, blink=\E[5m, bold=\E[1m, clear=\E[H\E[2J, cr=^M, -- csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, -- cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, -- cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, ed=\E[J, -- el=\E[K, home=\E[H, ht=^I, hts=\EH, ind=^J, kbs=^H, kcub1=\EOD, -- kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kf0=\EOP, kf1=\EOQ, -- kf2=\EOR, kf3=\EOS, lf0=F1, lf1=F2, lf2=F3, lf3=F4, rc=\E8, -- rev=\E[7m, ri=\EM, rmkx=\E[?1l\E>, rmso=\E[m, rmul=\E[m, -- rs1=\E>\E[?1l\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h\E[1;24r, -- sc=\E7, sgr0=\E[m, smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, -- tbc=\E[3g, --# Lisaterm in 132 column ("wide") mode. --lisaterm-w|Apple Lisa with Lisaterm in 132 column mode, -+ -+# The following vendor-supplied termcaps were captured from the Boundless -+# Technologies site, 8 March 1998. I removed all-upper-case names that were -+# identical, except for case, to lower-case ones. I also uncommented the acsc -+# capabilities.X -+# -+# The Intecolor emulation of the NCR 2900/260C color terminal is basically a -+# DEC vt200/300 with color capabilities added. -+ncr260intan|NCR Intecolor emulation of the 2900_260C with an ANSI keyboard, -+ colors#8, pairs#64, -+ op=\E[0m, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, -+ use=ncr260vt300an, -+# The Intecolor emulation of the NCR 2900/260C color terminal is basically a -+# DEC vt200/300 with color capabilities added. -+ncr260intwan|NCR Intecolor emulation of the 2900_260C with an ANSI keyboard, -+ colors#8, pairs#64, -+ op=\E[0m, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, -+ use=ncr260vt300wan, -+# The Intecolor emulation of the NCR 2900/260C color terminal is basically a -+# DEC vt200/300 with color capabilities added. -+ncr260intpp|NCR Intecolor emulation of the 2900_260C with a PC+ keyboard, -+ colors#8, pairs#64, -+ op=\E[0m, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, -+ use=ncr260vt300pp, -+# The Intecolor emulation of the NCR 2900/260C color terminal is basicly a -+# DEC vt200/300 with color capabilities added. -+ncr260intwpp|NCR Intecolor emulation of the 2900_260C with a PC+ keyboard in 132 column mode, -+ colors#8, pairs#64, -+ op=\E[0m, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, -+ use=ncr260vt300wpp, -+# This definition for ViewPoint supports several attributes. This means -+# that it has magic cookies (extra spaces where the attributes begin). -+# Some applications do not function well with magic cookies. The System -+# Administrator's Shell in NCR Unix SVR4 1.03 is one such application. -+# If supporting various attributes is not vital, 'xmc#1' and the extra -+# attributes can be removed. -+# Mapping to ASCII character set ('acsc' capability) can also be -+# restored if needed. -+ncr260vppp|NCR 2900_260 viewpoint, -+ am, bw, hs, km, mc5i, mir, msgr, xon, -+ cols#80, lines#24, nlab#32, xmc#1, -+ acsc=07a?h;j5k3l2m1n8q\:t4u9v=w0x6, bel=^G, blink=\EG2, -+ cbt=\EI, civis=\E`0, clear=\014$<40>, cnorm=\E`5, -+ cr=\r$<2>, cub1=\010$<2>, cud1=\n$<2>, cuf1=\006$<2>, -+ cup=\EY%p1%{32}%+%c%p2%{32}%+%c$<5>, cuu1=\032$<2>, -+ dch1=\EW$<2>, dim=\EGp, dl1=\El$<2>, dsl=\E`c, ed=\Ek$<2>, -+ el=\EK$<2>, fsl=^M, home=\036$<2>, ht=^I, hts=\E1, -+ il1=\EM$<2>, ind=\n$<2>, invis=\EG1, -+ is2=\Ee6\E~%$<100>\E+\E`\:\Ed/\E`1\EO\Ee4\Ec@0@\Ec@1A\EcB0\EcC1\Ee7$<100>, -+ kDC=\El, kEND=\Ek, kHOM=^A, kPRT=\E7, kRIT=^F, ka1=^A, ka3=\EJ, -+ kbs=^H, kc1=\ET, kc3=\EJ, kcub1=^U, kcud1=^J, kcuf1=^F, -+ kcuu1=^Z, kdch1=\EW, kend=\EK, kf1=^B1\r, kf10=^B\:\r, -+ kf11=^B;\r, kf12=^B<\r, kf13=^B=\r, kf14=^B>\r, kf15=^B?\r, -+ kf16=^B@\r, kf17=^B!\r, kf18=^B"\r, kf19=^B#\r, kf2=^B2\r, -+ kf20=^B$\r, kf21=\002%^M, kf22=^B&\r, kf23=^B'\r, -+ kf24=^B(\r, kf25=^B)\r, kf26=^B*\r, kf27=^B+\r, -+ kf28=^B\,\r, kf29=^B-\r, kf3=^B3\r, kf30=^B.\r, kf31=^B/\r, -+ kf32=^B0\r, kf4=^B4\r, kf5=^B5\r, kf6=^B6\r, kf7=^B7\r, -+ kf8=^B8\r, kf9=^B9\r, khome=^A, kich1=\Eq, knp=\EJ, kpp=\EJ, -+ kprt=\EP, ll=\001$<5>, mc0=\EP$<100>, mc4=^T, mc5=^R, -+ mrcup=\Ew@%p1%{48}%+%c%p2%{32}%+%c%p3%{32}%+%c$<5>, -+ nel=\037$<2>, rev=\EG4, ri=\Ej$<2>, rmacs=\EcB0\EH\003, -+ rmir=\Er, rmso=\EG0, rmul=\EG0, rmxon=\Ec20, -+ rs2=\Ee6\E~%$<100>\E+\E`\:\Ed/\E`1\EO\Ee4\Ec@0@\Ec@1A\EcB0\EcC1\Ee7$<100>, -+ sgr0=\EG0\EH\003, smacs=\EcB1\EH\002, smir=\Eq, -+ smso=\EG4, smul=\EG8, smxon=\Ec21, tsl=\EF, -+ncr260vpwpp|NCR 2900_260 viewpoint wide mode, -+ cols#132, -+ cup=\Ea%i%p1%dR%p2%dC$<30>, -+ is2=\Ee6\E~%$<100>\E+\E`;\Ed/\E`1\EO\Ee4\Ec@0@\Ec@1A\EcB0\EcC1\Ee7$<100>, -+ rs2=\Ee6\E~%$<100>\E+\E`;\Ed/\E`1\EO\Ee4\Ec@0@\Ec@1A\EcB0\EcC1\Ee7$<100>, -+ use=ncr260vppp, -+ncr260vt100an|NCR 2900_260 vt100 with ansi kybd, -+ am, hs, mir, msgr, xenl, xon, -+ cols#80, lines#24, nlab#32, -+ acsc=``aaffggjjkkllmmnnooqqssttuuvvwwxx~~, bel=^G, -+ blink=\E[5m, bold=\E[1m, civis=\E[?25l, -+ clear=\E[2J\E[1;1H$<20>, cnorm=\E[?25h, cr=\r$<1>, -+ csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD$<5>, -+ cub1=\E[D$<5>, cud=\E[%p1%dB$<5>, cud1=\E[B$<5>, -+ cuf=\E[%p1%dC$<5>, cuf1=\E[C$<5>, -+ cup=\E[%i%p1%d;%p2%dH$<10>, cuu=\E[%p1%dA$<5>, -+ cuu1=\E[A$<5>, dch=\E[%p1%dP$<5>, dch1=\E[1P$<5>, -+ dl=\E[%p1%dM$<5>, dl1=\E[M$<5>, dsl=\E[0$~\E[1$~, -+ ech=\E[%p1%dX, ed=\E[0J$<5>, el=\E[0K$<3>, el1=\E[1K$<3>, -+ fsl=\E[0$}, home=\E[H$<1>, hpa=\E[%p1%dG$<40>, ht=^I, -+ hts=\EH, ich=\E[%p1%d@$<5>, il=\E[%p1%dL$<5>, -+ il1=\E[L$<5>, ind=\ED$<5>, indn=\E[%p1%dE$<5>, -+ invis=\E[8m, -+ is2=\E[!p\E[?7;19;67h\E[?1;3;4l\E(B\E)0\017\E[2J\E[1;1H\E>$<200>, -+ kbs=^H, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, -+ kdch1=\E[3~, kfnd=\E[1~, khlp=\E[28~, kich1=\E[2~, -+ knp=\E[6~, kpp=\E[5~, krdo=\E[29~, kslt=\E[4~, nel=\EE$<5>, -+ rc=\E8, rev=\E[7m, ri=\EM$<5>, rmacs=^O, rmir=\E[4l, -+ rmkx=\E[?1l\E>, rmso=\E[0m, rmul=\E[0m, -+ rs2=\E[!p\E[?7;19;67h\E[?1;3;4l\E(B\E)0\017\E[2J\E[1;1H\E>$<200>, -+ sc=\E7, -+ sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p7%t;8%;m%?%p9%t\016%e\017%;$<20>, -+ sgr0=\E[0m\017$<20>, smacs=^N, smir=\E[4h, -+ smkx=\E[?1h\E=, smso=\E[1;7m, smul=\E[4m, tbc=\E[3g, -+ tsl=\E[2$~\E[1$}, vpa=\E[%p1%dd$<40>, use=vt220+keypad, -+ncr260vt100wan|NCR 2900_260 vt100 wide mode ansi kybd, -+ cols#132, -+ cup=\E[%i%p1%d;%p2%dH$<30>, -+ is2=\E[!p\E[?3;7;19;67h\E[?1;4l\E(B\E)0\017\E[2J\E[1;1H\E>$<200>, -+ rs2=\E[!p\E[?3;7;19;67h\E[?1;4l\E(B\E)0\017\E[2J\E[1;1H\E>$<200>, -+ use=ncr260vt100an, -+ncr260vt100pp|NCR 2900_260 vt100 with PC+ kybd, -+ is2=\E[!p\E[?7;19;67h\E[?1;3;4l\E(B\E)0\017\E[2J\E[1;1H\E>$<200>, -+ ka1=\E[H, ka3=\EOu, kb2=\E[V, kc3=\E[U, kcub1=\E[D, -+ kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[4~, -+ kend=\E[5~, khome=\E[2~, kich1=\E[1~, knp=\E[6~, kpp=\E[3~, -+ lf1=pf1, lf2=pf2, lf3=pf3, lf4=pf4, rmkx=\E>, -+ rs2=\E[!p\E[?7;19;67h\E[?1;3;4l\E(B\E)0\017\E[2J\E[1;1H\E>$<200>, -+ smkx=\E=, use=ncr260vt100an, -+ncr260vt100wpp|NCR 2900_260 vt100 wide mode pc+ kybd, -+ cols#132, -+ cup=\E[%i%p1%d;%p2%dH$<30>, -+ is2=\E[!p\E[?3;7;19;67h\E[?1;4l\E(B\E)0\017\E[2J\E[1;1H\E>$<200>, -+ rs2=\E[!p\E[?3;7;19;67h\E[?1;4l\E(B\E)0\017\E[2J\E[1;1H\E>$<200>, -+ use=ncr260vt100pp, -+ncr260vt200an|NCR 2900_260 vt200 with ansi kybd, -+ am, hs, mir, msgr, xenl, xon, -+ cols#80, lines#24, nlab#32, -+ acsc=``aaffggjjkkllmmnnooqqssttuuvvwwxx~~, bel=^G, -+ blink=\E[5m, bold=\E[1m, civis=\E[?25l, -+ clear=\E[2J\E[1;1H$<20>, cnorm=\E[?25h, cr=\r$<1>, -+ csr=\E[%i%p1%d;%p2%dr$<5>, cub=\E[%p1%dD$<5>, -+ cub1=\E[D$<5>, cud=\E[%p1%dB$<5>, cud1=\E[B$<5>, -+ cuf=\E[%p1%dC$<5>, cuf1=\E[C$<5>, -+ cup=\E[%i%p1%d;%p2%dH$<10>, cuu=\E[%p1%dA$<5>, -+ cuu1=\E[A$<5>, dch=\E[%p1%dP$<5>, dch1=\E[1P$<5>, -+ dl=\E[%p1%dM$<5>, dl1=\E[M$<5>, dsl=\E[0$~\E[1$~, -+ ech=\E[%p1%dX$<5>, ed=\E[0J, el=\E[0K$<5>, el1=\E[1K$<5>, -+ fsl=\E[0$}, home=\E[H, hpa=\E[%p1%dG$<40>, ht=^I, hts=\EH, -+ ich=\E[%p1%d@$<5>, il=\E[%p1%dL$<5>, il1=\E[L$<5>, -+ ind=\ED$<5>, indn=\E[%p1%dE$<5>, invis=\E[8m, -+ is2=\E[!p\E[?7;19;67h\E[?1;3;4l\E(B\E)0\017\E[2J\E[1;1H\E>$<200>, -+ kbs=^H, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, -+ kdch1=\E[3~, kf0=\EOy, kf10=\E[21~, kf11=\E[23~, -+ kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, kf15=\E[28~, -+ kf16=\E[29~, kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, -+ kf2=\EOQ, kf20=\E[34~, kf21=\E[31~, kf22=\E[32~, -+ kf23=\E[33~, kf24=\E[34~, kf25=\E[35~, kf26=\E[1~, -+ kf27=\E[2~, kf28=\E[3~, kf29=\E[4~, kf3=\EOR, kf30=\E[5~, -+ kf31=\E[6~, kf32=\E[7~, kf33=\E[8~, kf34=\E[9~, -+ kf35=\E[10~, kf4=\EOS, kf5=\E[M, kf6=\E[17~, kf7=\E[18~, -+ kf8=\E[19~, kf9=\E[20~, kfnd=\E[1~, khlp=\E[28~, -+ kich1=\E[2~, knp=\E[6~, kpp=\E[5~, krdo=\E[29~, kslt=\E[4~, -+ mc0=\E[i, mc4=\E[4i, mc5=\E[5i, nel=\EE, rc=\E8, rev=\E[7m, -+ ri=\EM$<5>, rmacs=\017$<20>, rmam=\E[?7l, rmir=\E[4l, -+ rmkx=\E[?1l\E>, rmso=\E[27m, rmul=\E[24m, -+ rs2=\E[!p\E[?7;19;67h\E[?1;3;4l\E(B\E)0\017\E[2J\E[1;1H\E>$<200>, -+ sc=\E7, -+ sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p7%t;8%;m%?%p9%t\016%e\017%;$<20>, -+ sgr0=\E[0m\017$<20>, smacs=\016$<20>, smam=\E[?7h, -+ smir=\E[4h, smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, -+ tbc=\E[3g, tsl=\E[2$~\E[1$}, vpa=\E[%p1%dd$<40>, -+ use=vt220+keypad, -+ncr260vt200wan|NCR 2900_260 vt200 wide mode ansi kybd, - cols#132, -- kbs=^H, kcub1=^H, kcud1=^J, use=lisaterm, --# Although MacTerminal has insert/delete line, it is commented out here --# since it is much faster and cleaner to use the "lock scrolling region" --# method of inserting and deleting lines due to the MacTerminal implementation. --# Also, the "Insert/delete ch" strings have an extra character appended to them --# due to a bug in MacTerminal V1.1. Blink is disabled since it is not --# supported by MacTerminal. --mac|macintosh|Macintosh with MacTerminal, -- xenl, -- OTdN#30, -- blink@, dch1=\E[P$<7/>, ich1=\E[@$<9/>, ip=$<7/>, use=lisa, --# Lisaterm in 132 column ("wide") mode. --mac-w|macterminal-w|Apple Macintosh with Macterminal in 132 column mode, -- cols#132, use=mac, -- --# nsterm*|Apple_Terminal - AppKit Terminal.app --# --# Terminal.app is a Terminal emulator bundled with NeXT's NeXTStep and --# OPENSTEP/Mach operating systems, and with Apple's Rhapsody, Mac OS X --# Server and Mac OS X operating systems. There is also a --# "terminal.app" in GNUStep, but I believe it to be an unrelated --# codebase and I have not attempted to describe it here. --# --# For NeXTStep, OPENSTEP/Mach, Rhapsody and Mac OS X Server 1.0, you --# are pretty much on your own. Use "nsterm-7-m" and hope for the best. --# You might also try "nsterm-7" and "nsterm-old" if you suspect your --# version supports color. --# --# To determine the version of Terminal.app you're using by running: --# --# echo "$TERM_PROGRAM" "$TERM_PROGRAM_VERSION" --# --# For Apple_Terminal v200+, use "nsterm-16color" (a.k.a. "nsterm") --# --# For Apple_Terminal v71+/v100+, use "nsterm-bce". --# --# For Apple_Terminal v51+, use "nsterm-7-c" or "nsterm-7-c-s". --# --# For Apple_Terminal v41+, use "nsterm-old", or "nsterm-s". --# --# For all earlier versions (Apple_Terminal), try "nsterm-7-m" --# (monochrome) or "nsterm-7" (color); "nsterm-7-m-s" and "nsterm-7-s" --# might work too, but really you're on your own here since these --# systems are very obsolete and I can't test them. I do welcome --# patches, though :). -- --# Other Terminals: --# --# For GNUstep_Terminal, you're probably best off using "linux" or --# writing your own terminfo. -- --# For MacTelnet, you're on your own. It's a different codebase, and --# seems to be somewhere between "vt102", "ncsa" and "xterm-color". -- --# For iTerm.app, see "iterm". -- --# --# The AppKit Terminal.app descriptions all have names beginning with --# "nsterm". Note that the statusline (-s) versions use the window --# titlebar as a phony status line, and may produce warnings during --# compilation as a result ("tsl uses 0 parameters, expected 1".) --# Ignore these warnings, or even ignore these entries entirely. Apps --# which need to position the cursor or do other fancy stuff inside the --# status line won't work with these entries. They're primarily useful --# for programs like Pine which provide simple notifications in the --# status line. Please note that non-ASCII characters don't work right --# in the status line, since Terminal.app incorrectly interprets their --# Unicode codepoints as MacRoman codepoints (in earlier Mac OS X --# versions) or only accepts status lines consisting entirely of --# characters from the first 256 Unicode positions (including C1 but --# not C0 or DEL.) --# --# The Mythology* of AppKit Terminal.app: --# --# In the days of NeXTSTep 0.x and 1.x there were two incompatible --# bundled terminal emulators, Shell and Terminal. Scott Hess wrote a --# shareware replacement for Terminal called "Stuart" which NeXT bought --# and used as the basis for the Terminal.app in NeXTstep 2+, --# OPENSTEP/Mach, Apple Rhapsody, Mac OS X Server 1.0, and Mac OS X. I --# don't know the TERM_PROGRAM and TERM_PROGRAM_VERSION settings or --# capabilities for the early versions, but I believe that the --# TERM_PROGRAM_VERSION may have been reset at some point. --# --# The early versions were tailored to the NeXT character set. Sometime --# after the Apple aquisition the encoding was swiched to MacRoman --# (initally with serious altcharset bugs due to incomplete conversion --# of the old NeXT code,) and then later to UTF-8. Alos sometime during --# or just prior to the early days of Mac OS X, the Terminal grew ANSI --# 8-color support (initially buggy when combined with attributes, but --# that was later fixed.) More recently, around Mac OS X version 10.3 --# or so (Terminal.app v100+) xterm-like 16-color support was added. In --# some versions (for instance 133-1 which shipped with Mac OS X --# version 10.4) this suffered from the <bce> bug, but that seems to --# have been fixed in Mac OS X version 10.5 (Terminal.app v240.2+). --# --# In the early days of Mac OS X the terminal was fairly buggy and --# would routinely crash under load. Many of these bugs seem to have --# been fixed around Mac OS X version 10.3 (Terminal.app v100+) but --# some may still remain. This change seems to correspond to --# Terminal.app reporting "xterm-color" as $TERM rather than "vt100" as --# it did previously. --# --# * This may correspond with what actually happened, but I don't --# know. It is based on guesswork, hearsay, private correspondence, --# my faulty memory, and the following online sources and references: --# --# [1] "Three Scotts and a Duane" by Simson L. Garfinkel --# http://www.nextcomputers.org/NeXTfiles/Articles/NeXTWORLD/93.8/93.8.Dec.Community1.html -+ cup=\E[%i%p1%d;%p2%dH$<30>, -+ is2=\E[!p\E[?3;7;19;67h\E[?4l\E(B\E)0\017\E[2J\E[1;1H$<200>, -+ rs2=\E[!p\E[?3;7;19;67h\E[?4l\E(B\E)0\017\E[2J\E[1;1H$<200>, -+ use=ncr260vt200an, -+ncr260vt200pp|NCR 2900_260 vt200 with pc+ kybd, -+ ka1=\E[H, ka3=\EOu, kb2=\E[V, kc3=\E[U, kcub1=\E[D, -+ kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[4~, -+ kend=\E[1~, khome=\E[H, kich1=\E[2~, knp=\E[6~, kpp=\E[5~, -+ lf1=pf1, lf2=pf2, lf3=pf3, lf4=pf4, rmkx=\E>, smkx=\E=, -+ use=ncr260vt200an, -+ncr260vt200wpp|NCR 2900_260 vt200 wide mode pc+ kybd, -+ cols#132, -+ cup=\E[%i%p1%d;%p2%dH$<30>, -+ is2=\E[!p\E[?3;7;19;67h\E[?1;4l\E(B\E)0\017\E[2J\E[1;1H\E>$<200>, -+ rs2=\E[!p\E[?3;7;19;67h\E[?1;4l\E(B\E)0\017\E[2J\E[1;1H\E>$<200>, -+ use=ncr260vt200pp, -+ncr260vt300an|NCR 2900_260 vt300 with ansi kybd, -+ am, hs, mir, msgr, xenl, xon, -+ cols#80, lines#24, nlab#32, -+ acsc=``aaffggjjkkllmmnnooqqssttuuvvwwxx~~, bel=^G, -+ blink=\E[5m, bold=\E[1m, civis=\E[?25l, -+ clear=\E[2J\E[1;1H$<20>, cnorm=\E[?25h, cr=\r$<1>, -+ csr=\E[%i%p1%d;%p2%dr$<5>, cub=\E[%p1%dD$<5>, -+ cub1=\E[D$<5>, cud=\E[%p1%dB$<5>, cud1=\E[B$<5>, -+ cuf=\E[%p1%dC$<5>, cuf1=\E[C$<5>, -+ cup=\E[%i%p1%d;%p2%dH$<10>, cuu=\E[%p1%dA$<5>, -+ cuu1=\E[A$<5>, dch=\E[%p1%dP$<5>, dch1=\E[1P$<5>, -+ dl=\E[%p1%dM$<5>, dl1=\E[M$<5>, dsl=\E[0$~\E[1$~, -+ ech=\E[%p1%dX$<5>, ed=\E[0J, el=\E[0K$<5>, el1=\E[1K$<5>, -+ fsl=\E[0$}, home=\E[H, hpa=\E[%p1%dG$<40>, ht=^I, hts=\EH, -+ ich=\E[%p1%d@$<5>, il=\E[%p1%dL$<5>, il1=\E[L$<5>, -+ ind=\ED$<5>, indn=\E[%p1%dE$<5>, invis=\E[8m, -+ is2=\E[!p\E[?7;19;67h\E[?1;3;4l\E[1;0%w\E(B\E)0\017\E[2J\E[1;1H\E>$<200>, -+ kbs=^H, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, -+ kdch1=\E[3~, kf0=\EOy, kf10=\E[21~, kf11=\E[23~, -+ kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, kf15=\E[28~, -+ kf16=\E[29~, kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, -+ kf20=\E[34~, kf21=\E[31~, kf22=\E[32~, kf23=\E[33~, -+ kf24=\E[34~, kf25=\E[35~, kf26=\E[1~, kf27=\E[2~, -+ kf28=\E[3~, kf29=\E[4~, kf30=\E[5~, kf31=\E[6~, kf32=\E[7~, -+ kf33=\E[8~, kf34=\E[9~, kf35=\E[10~, kf5=\E[M, kf6=\E[17~, -+ kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, kfnd=\E[1~, -+ khlp=\E[28~, kich1=\E[2~, knp=\E[6~, kpp=\E[5~, -+ krdo=\E[29~, kslt=\E[4~, mc0=\E[i, mc4=\E[4i, mc5=\E[5i, -+ nel=\EE, rc=\E8, rev=\E[7m, ri=\EM$<5>, rmacs=\017$<20>, -+ rmam=\E[?7l, rmir=\E[4l, rmkx=\E[?1l\E>, rmso=\E[27m, -+ rmul=\E[24m, -+ rs2=\E[!p\E[?7;19;67h\E[?1;3;4l\E[1;0%w\E(B\E)0\017\E[2J\E[1;1H\E>$<200>, -+ sc=\E7, -+ sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p7%t;8%;m%?%p9%t\016%e\017%;$<20>, -+ sgr0=\E[0m\017$<20>, smacs=\016$<20>, smam=\E[?7h, -+ smir=\E[4h, smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, -+ tbc=\E[3g, tsl=\E[2$~\E[1$}, vpa=\E[%p1%dd$<40>, -+ use=vt220+keypad, -+ncr260vt300wan|NCR 2900_260 vt300 wide mode ansi kybd, -+ cols#132, -+ cup=\E[%i%p1%d;%p2%dH$<30>, -+ is2=\E[!p\E[?3;7;19;67h\E[?4l\E[1;0%w\E(B\E)0\017\E[2J\E[1;1H$<200>, -+ rs2=\E[!p\E[?3;7;19;67h\E[?4l\E[1;0%w\E(B\E)0\017\E[2J\E[1;1H$<200>, -+ use=ncr260vt300an, -+ncr260vt300pp|NCR 2900_260 vt300 with pc+ kybd, -+ ka1=\E[H, ka3=\EOu, kb2=\E[V, kc3=\E[U, kcub1=\E[D, -+ kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[4~, -+ kend=\E[1~, khome=\E[H, kich1=\E[2~, knp=\E[6~, kpp=\E[5~, -+ lf1=pf1, lf2=pf2, lf3=pf3, lf4=pf4, rmkx=\E>, smkx=\E=, -+ use=ncr260vt300an, -+NCR260VT300WPP|ncr260vt300wpp|NCR 2900_260 vt300 wide mode pc+ kybd, -+ cols#132, -+ cup=\E[%i%p1%d;%p2%dH$<30>, -+ is2=\E[!p\E[?3;7;19;67h\E[?1;4l\E[1;0%w\E(B\E)0\017\E[2J\E[1;1H\E>$<200>, -+ rs2=\E[!p\E[?3;7;19;67h\E[?1;4l\E[1;0%w\E(B\E)0\017\E[2J\E[1;1H\E>$<200>, -+ use=ncr260vt300pp, -+# This terminfo file contains color capabilities for the Wyse325 emulation of -+# the NCR 2900/260C color terminal. Because of the structure of the command -+# (escape sequence) used to set color attributes, one of the fore/background -+# colors must be preset to a given value. I have set the background color to -+# black. The user can change this setup by altering the last section of the -+# 'setf' definition. The escape sequence to set color attributes is -+# ESC d y <foreground_color> <background_color> 1 -+# In addition, the background color can be changed through the desk accessories. -+# The capablitiy 'op' sets colors to green on black (default combination). - # --# [2] NeXTSTEP entry from Wikipedia, the free encyclopedia --# https://secure.wikimedia.org/wikipedia/en/wiki/Nextstep -+# NOTE: The NCR Unix System Administrator's Shell will not function properly -+# if the 'pairs' capability is defined. Un-Comment the 'pairs' -+# capability and recompile if you wish to have it included. - # --# * Renamed the AppKit Terminal.app entry from "Apple_Terminal" to --# "nsterm" to comply with the name length and case conventions and --# limitations of various software packages [notably Solaris terminfo --# and UNIX.] A single Apple_Terminal alias is retained for --# backwards-compatbility. -+ncr260wy325pp|NCR 2900_260 wyse 325, -+ am, bw, hs, km, mc5i, mir, msgr, xon, -+ colors#16, cols#80, lines#24, ncv#33, nlab#32, -+ acsc=07a?h;j5k3l2m1n8q\:t4u9v=w0x6, bel=^G, blink=\EG2, -+ cbt=\EI, civis=\E`0, clear=\E*$<10>, cnorm=\E`1, cr=^M, -+ cub1=\010$<5>, cud1=\n$<5>, cuf1=\014$<5>, -+ cup=\E=%p1%{32}%+%c%p2%{32}%+%c$<10>, cuu1=\013$<5>, -+ cvvis=\E`5, dch1=\EW$<50>, dl1=\ER$<5>, dsl=\E`c, -+ ed=\Ey$<5>, el=\Et$<5>, fsl=^M, home=\036$<5>, ht=^I, -+ hts=\E1, il1=\EE$<5>, ind=\n$<5>, invis=\EG1, -+ is2=\Ee6\Ed/\Ee1\Ed*\Er\EO\E`1\E`\:\E`@\E~!\E"\Ee4\Ex@\E`9\Ee7$<100>, -+ kDC=\ER, kEND=\EY, kHOM=\E{, kNXT=\EK, kPRT=\E7, kPRV=\EJ, -+ kRIT=^L, ka1=^^, kb2=\EJ, kbs=^H, kc1=\ET, kc3=\EK, kcbt=\EI, -+ kcub1=^H, kcud1=^J, kcuf1=^L, kcuu1=^K, kdch1=\EW, kend=\ET, -+ kf1=^A@\r, kf10=^AI\r, kf11=^AJ\r, kf12=^AK\r, kf13=^AL\r, -+ kf14=^AM\r, kf15=^AN\r, kf16=^AO\r, kf17=^A`\r, kf18=^Aa\r, -+ kf19=^Ab\r, kf2=^AA\r, kf20=^Ac\r, kf21=^Ad\r, kf22=^Ae\r, -+ kf23=^Af\r, kf24=^Ag\r, kf25=^Ah\r, kf26=^Ai\r, kf27=^Aj\r, -+ kf28=^Ak\r, kf29=^Al\r, kf3=^AB\r, kf30=^Am\r, kf31=^An\r, -+ kf32=^Ao\r, kf4=^AC\r, kf5=^AD\r, kf6=^AE\r, kf7=^AF\r, -+ kf8=^AG\r, kf9=^AH\r, khome=^^, kich1=\Eq, knp=\EK, kpp=\EJ, -+ kprt=\EP, mc0=\EP, mc4=^T, mc5=^R, -+ mrcup=\Ew@%p1%{48}%+%c%p2%{32}%+%c%p3%{32}%+%c$<10>, -+ nel=\037$<5>, rev=\EG4, ri=\Ej$<5>, rmacs=\EH\003\EcB0, -+ rmam=\Ed., rmir=\Er, rmso=\EG0, rmul=\EG0, rmxon=\Ec20, -+ rs2=\Ee6\Ed/\Ee1\Ed*\Er\EO\E`1\E`\:\E`@\E~!\E"\Ee4\Ex@\E`9\Ee7$<100>, -+ setb=\s, -+ setf=%?%p1%{0}%=%t%{49}%e%p1%{1}%=%t%{50}%e%p1%{2}%=%t%{51}%e%p1%{3}%=%t%{52}%e%p1%{4}%=%t%{53}%e%p1%{5}%=%t%{54}%e%p1%{6}%=%t%{55}%e%p1%{7}%=%t%{64}%e%p1%{8}%=%t%{57}%e%p1%{9}%=%t%{58}%e%p1%{10}%=%t%{59}%e%p1%{11}%=%t%{60}%e%p1%{12}%=%t%{61}%e%p1%{13}%=%t%{62}%e%p1%{14}%=%t%{63}%e%p1%{15}%=%t%{56}%;\Edy%c11$<100>, -+ sgr0=\EG0\EcB0\EcD$<15>, smacs=\EH\002\EcB1, smam=\Ed/, -+ smir=\Eq, smso=\EGt, smul=\EG8, smxon=\Ec21, tbc=\E0, -+ tsl=\EF, -+ncr260wy325wpp|NCR 2900_260 wyse 325 wide mode, -+ cols#132, -+ cup=\Ea%i%p1%dR%p2%dC$<30>, -+ is2=\Ee6\Ed/\Ee1\Ed*\Er\EO\E`1\E`;\E`@\E~!\E"\Ee4\Ex@\E`9\Ee7$<100>, -+ rs2=\Ee6\Ed/\Ee1\Ed*\Er\EO\E`1\E`;\E`@\E~!\E"\Ee4\Ex@\E`9\Ee7$<100>, -+ use=ncr260wy325pp, -+# This definition for Wyse 350 supports several attributes. This means -+# that it has magic cookies (extra spaces where the attributes begin). -+# Some applications do not function well with magic cookies. The System -+# Administrator's Shell in NCR Unix SVR4 1.03 is one such application. -+# If supporting various attributes is not vital, 'xmc#1' and the extra -+# attributes can be removed. -+# Mapping to ASCII character set ('acsc' capability) can also be -+# restored if needed. -+# In addition, color capabilities have been added to this file. The drawback, -+# however, is that the background color has to be black. The foreground colors -+# are numbered 0 through 15. - # --# * Added function key support (F1-F4). These only work in Terminal.app --# version 51, hopefully the capabilities won't cause problems for people --# using version 41. -+# NOTE: The NCR Unix System Administrator's Shell does not function properly -+# with the 'pairs' capability defined as below. If you wish to -+# have it included, Un-comment it and recompile (using 'tic'). - # --# * Added "full color" (-c) entries which support the 16-color mode in --# version 51. -+ncr260wy350pp|NCR 2900_260 wyse 350, -+ am, bw, hs, km, mc5i, mir, msgr, xon, -+ colors#16, cols#80, lines#24, ncv#33, nlab#32, pairs#16, xmc#1, -+ acsc=07a?h;j5k3l2m1n8q\:t4u9v=w0x6, bel=^G, blink=\EG2, -+ cbt=\EI, civis=\E`0, clear=\E+$<20>, cnorm=\E`1, cr=^M, -+ cub1=\010$<5>, cud1=\n$<5>, cuf1=\014$<5>, -+ cup=\E=%p1%{32}%+%c%p2%{32}%+%c$<40>, cuu1=\013$<5>, -+ cvvis=\E`5, dch1=\EW$<50>, dim=\EGp, dl1=\ER$<5>, dsl=\E`c, -+ ed=\Ey$<5>, el=\Et$<5>, fsl=^M, home=\036$<10>, ht=^I, -+ hts=\E1, il1=\EE$<5>, ind=\n$<5>, invis=\EG1, -+ is2=\Ee6\Ed/\Ee1\Ed*\Er\EO\E`1\E`\:\E`@\E~!\E"\Ee4\Ex@\E`9\Ee7$<100>, -+ kDC=\ER, kEND=\EY, kHOM=\E{, kPRT=\E7, kRIT=^L, ka1=^^, kbs=^H, -+ kc1=\ET, kc3=\EK, kcbt=\EI, kcub1=^H, kcud1=^J, kcuf1=^L, -+ kcuu1=^K, kdch1=\EW, kend=\ET, kf1=^A@\r, kf10=^AI\r, -+ kf11=^AJ\r, kf12=^AK\r, kf13=^AL\r, kf14=^AM\r, kf15=^AN\r, -+ kf16=^AO\r, kf17=^A`\r, kf18=^Aa\r, kf19=^Ab\r, kf2=^AA\r, -+ kf20=^Ac\r, kf21=^Ad\r, kf22=^Ae\r, kf23=^Af\r, kf24=^Ag\r, -+ kf25=^Ah\r, kf26=^Ai\r, kf27=^Aj\r, kf28=^Ak\r, kf29=^Al\r, -+ kf3=^AB\r, kf30=^Am\r, kf31=^An\r, kf32=^Ao\r, kf4=^AC\r, -+ kf5=^AD\r, kf6=^AE\r, kf7=^AF\r, kf8=^AG\r, kf9=^AH\r, -+ khome=^^, kich1=\Eq, knp=\EK, kpp=\EJ, kprt=\EP, -+ mc0=\EP$<10>, mc4=^T, mc5=^R, -+ mrcup=\Ew@%p1%{48}%+%c%p2%{32}%+%c%p3%{32}%+%c$<20>, -+ nel=\037$<5>, rev=\EG4, ri=\Ej$<5>, rmacs=\EH\003\EcB0, -+ rmam=\Ed., rmir=\Er, rmso=\EG0, rmul=\EG0, rmxon=\Ec20, -+ rs2=\Ee6\Ed/\Ee1\Ed*\Er\EO\E`1\E`\:\E`@\E~!\E"\Ee4\Ex@\E`9\Ee7$<100>, -+ setb=\s, -+ setf=%?%p1%{0}%=%t%{49}%e%p1%{1}%=%t%{50}%e%p1%{2}%=%t%{51}%e%p1%{3}%=%t%{52}%e%p1%{4}%=%t%{53}%e%p1%{5}%=%t%{54}%e%p1%{6}%=%t%{55}%e%p1%{7}%=%t%{102}%e%p1%{8}%=%t%{97}%e%p1%{9}%=%t%{98}%e%p1%{10}%=%t%{99}%e%p1%{11}%=%t%{101}%e%p1%{12}%=%t%{106}%e%p1%{13}%=%t%{110}%e%p1%{14}%=%t%{111}%e%p1%{15}%=%t%{56}%;\Em0%c$<100>, -+ sgr0=\EG0\EH\003\EcD, smacs=\EH\002\EcB1, smam=\Ed/, -+ smir=\Eq, smso=\EGt, smul=\EG8, smxon=\Ec21, tbc=\E0, -+ tsl=\EF, -+ncr260wy350wpp|NCR 2900_260 wyse 350 wide mode, -+ cols#132, -+ cup=\Ea%i%p1%dR%p2%dC$<30>, -+ is2=\Ee6\Ed/\Ee1\Ed*\Er\EO\E`1\E`;\E`@\E~!\E"\Ee4\Ex@\E`9\Ee7$<200>, -+ rs2=\Ee6\Ed/\Ee1\Ed*\Er\EO\E`1\E`;\E`@\E~!\E"\Ee4\Ex@\E`9\Ee7$<200>, -+ use=ncr260wy350pp, -+# This definition for Wyse 50+ supports several attributes. This means -+# that it has magic cookies (extra spaces where the attributes begin). -+# Some applications do not function well with magic cookies. The System -+# Administrator's Shell in NCR Unix SVR4 1.03 is one such application. -+# If supporting various attributes is not vital, 'xmc#1' and the extra -+# attributes can be removed. -+# Mapping to ASCII character set ('acsc' capability) can also be -+# restored if needed. -+# (ncr260wy50+pp: originally contained commented-out -+# <acsc=j5k3l2m1n8q:t4u9v=w0x6>, as well as the commented-out one there -- esr) -+ncr260wy50+pp|NCR 2900_260 wyse 50+, -+ am, bw, hs, km, mc5i, mir, msgr, xon, -+ cols#80, lines#24, nlab#32, xmc#1, -+ acsc=0wa_h[jukslrmqnxqzttuyv]wpxv, bel=^G, blink=\EG2, -+ cbt=\EI$<5>, civis=\E`0, clear=\E+$<20>, cnorm=\E`1, cr=^M, -+ cub1=\010$<5>, cud1=\n$<5>, cuf1=\014$<5>, -+ cup=\E=%p1%{32}%+%c%p2%{32}%+%c$<30>, cuu1=\013$<5>, -+ cvvis=\E`5, dch1=\EW$<50>, dim=\EGp, dl1=\ER$<5>, dsl=\E`c, -+ ed=\EY$<5>, el=\ET$<5>, fsl=^M, home=\036$<10>, -+ ht=\011$<5>, hts=\E1$<5>, il1=\EE$<5>, ind=\n$<5>, -+ invis=\EG1, -+ is2=\Ee6\E~"$<100>\E+\Ed/\Ee1\Ed*\Er\EO\E`1\E`\:\E`@\E~!\E"\Ee4\Ex@\E`9\Ee7$<100>, -+ kDC=\ER, kEND=\EY, kHOM=\E{, kPRT=\E7, kRIT=^L, ka1=^^, kbs=^H, -+ kc1=\ET, kc3=\EK, kcbt=\EI, kcub1=^H, kcud1=^J, kcuf1=^L, -+ kcuu1=^K, kdch1=\EW, kend=\ET, kf1=^A@\r, kf10=^AI\r, -+ kf11=^AJ\r, kf12=^AK\r, kf13=^AL\r, kf14=^AM\r, kf15=^AN\r, -+ kf16=^AO\r, kf17=^A`\r, kf18=^Aa\r, kf19=^Ab\r, kf2=^AA\r, -+ kf20=^Ac\r, kf21=^Ad\r, kf22=^Ae\r, kf23=^Af\r, kf24=^Ag\r, -+ kf25=^Ah\r, kf26=^Ai\r, kf27=^Aj\r, kf28=^Ak\r, kf29=^Al\r, -+ kf3=^AB\r, kf30=^Am\r, kf31=^An\r, kf32=^Ao\r, kf4=^AC\r, -+ kf5=^AD\r, kf6=^AE\r, kf7=^AF\r, kf8=^AG\r, kf9=^AH\r, -+ khome=^^, kich1=\Eq, knp=\EK, kpp=\EJ, kprt=\EP, -+ mc0=\EP$<10>, mc4=^T, mc5=^R, -+ mrcup=\Ew@%p1%{48}%+%c%p2%{32}%+%c%p3%{32}%+%c$<10>, -+ nel=\037$<5>, rev=\EG4, ri=\Ej$<5>, rmacs=\EH^C, rmam=\Ed., -+ rmir=\Er, rmso=\EG0, rmul=\EG0, rmxon=\Ec20, -+ rs2=\Ee6\E~"$<100>\E+\Ed/\Ee1\Ed*\Er\EO\E`1\E`\:\E`@\E~!\E"\Ee4\Ex@\E`9\Ee7$<100>, -+ sgr0=\EG0\EH\003$<15>, smacs=\EH^B, smam=\Ed/, smir=\Eq, -+ smso=\EGt, smul=\EG8, smxon=\Ec21, tbc=\E0$<5>, tsl=\EF, -+ncr260wy50+wpp|NCR 2900_260 wyse 50+ wide mode, -+ cols#132, -+ cup=\Ea%i%p1%dR%p2%dC$<30>, -+ is2=\Ee6\E~"$<100>\E+\Ed/\Ee1\Ed*\Er\EO\E`1\E`;\E`@\E~!\E"\Ee4\Ex@\E`9\Ee7$<200>, -+ rs2=\Ee6\E~"$<100>\E+\Ed/\Ee1\Ed*\Er\EO\E`1\E`;\E`@\E~!\E"\Ee4\Ex@\E`9\Ee7$<200>, -+ use=ncr260wy50+pp, -+ncr260wy60pp|NCR 2900_260 wyse 60, -+ am, bw, hs, km, mc5i, mir, msgr, xon, -+ cols#80, lines#24, nlab#32, -+ acsc=07a?h;j5k3l2m1n8q\:t4u9v=w0x6, bel=^G, blink=\EG2, -+ cbt=\EI$<15>, civis=\E`0, clear=\E*$<100>, cnorm=\E`1, -+ cr=^M, cub1=\010$<5>, cud1=\n$<5>, cuf1=\014$<5>, -+ cup=\E=%p1%{32}%+%c%p2%{32}%+%c$<10>, cuu1=\013$<5>, -+ cvvis=\E`5, dch1=\EW$<50>, dl1=\ER$<5>, dsl=\E`c, -+ ed=\Ey$<5>, el=\Et$<5>, fsl=^M, home=\036$<25>, -+ ht=\011$<15>, hts=\E1$<15>, il1=\EE$<5>, ind=\n$<5>, -+ invis=\EG1, -+ is2=\Ee6\E~4$<100>\E+\Ed/\Ee1\Ed*\Er\EO\E`1\E`\:\E`@\E~!\E"\Ee4\Ex@\E`9\Ee7$<100>, -+ kDC=\ER, kEND=\EY, kHOM=\E{, kNXT=\EK, kPRT=\E7, kPRV=\EJ, -+ kRIT=^L, ka1=^^, kb2=\EJ, kbs=^H, kc1=\ET, kc3=\EK, -+ kcbt=\EI$<15>, kcub1=^H, kcud1=^J, kcuf1=^L, kcuu1=^K, -+ kdch1=\EW, kend=\ET, kf1=^A@\r, kf10=^AI\r, kf11=^AJ\r, -+ kf12=^AK\r, kf13=^AL\r, kf14=^AM\r, kf15=^AN\r, kf16=^AO\r, -+ kf17=^A`\r, kf18=^Aa\r, kf19=^Ab\r, kf2=^AA\r, kf20=^Ac\r, -+ kf21=^Ad\r, kf22=^Ae\r, kf23=^Af\r, kf24=^Ag\r, kf25=^Ah\r, -+ kf26=^Ai\r, kf27=^Aj\r, kf28=^Ak\r, kf29=^Al\r, kf3=^AB\r, -+ kf30=^Am\r, kf31=^An\r, kf32=^Ao\r, kf4=^AC\r, kf5=^AD\r, -+ kf6=^AE\r, kf7=^AF\r, kf8=^AG\r, kf9=^AH\r, khome=^^, -+ kich1=\Eq, knp=\EK, kpp=\EJ, kprt=\EP, mc0=\EP, mc4=^T, mc5=^R, -+ mrcup=\Ew@%p1%{48}%+%c%p2%{32}%+%c%p3%{32}%+%c$<30>, -+ nel=\037$<5>, rev=\EG4, ri=\Ej$<5>, rmacs=\EH^C, rmam=\Ed., -+ rmir=\Er, rmso=\EG0, rmul=\EG0, rmxon=\Ec20, -+ rs2=\Ee6\E~4$<100>\E+\Ed/\Ee1\Ed*\Er\EO\E`1\E`\:\E`@\E~!\E"\Ee4\Ex@\E`9\Ee7$<100>, -+ sgr0=\EG0\EcB0\EcD$<15>, smacs=\EH^B, smam=\Ed/, -+ smir=\Eq, smso=\EGt, smul=\EG8, smxon=\Ec21, tbc=\E0$<15>, -+ tsl=\EF, -+ncr260wy60wpp|NCR 2900_260 wyse 60 wide mode, -+ cols#132, -+ cup=\Ea%i%p1%dR%p2%dC$<30>, -+ is2=\Ee6\E~4$<100>\E+\Ed/\Ee1\Ed*\Er\EO\E`1\E`;\E`@\E~!\E"\Ee4\Ex@\E`9\Ee7$<100>, -+ rs2=\Ee6\E~4$<100>\E+\Ed/\Ee1\Ed*\Er\EO\E`1\E`;\E`@\E~!\E"\Ee4\Ex@\E`9\Ee7$<100>, -+ use=ncr260wy60pp, -+ncr160vppp|NCR 2900_160 viewpoint, -+ use=ncr260vppp, -+ncr160vpwpp|NCR 2900_160 viewpoint wide mode, -+ use=ncr260vpwpp, -+ncr160vt100an|NCR 2900_160 vt100 with ansi kybd, -+ use=ncr260vt100an, -+ncr160vt100pp|NCR 2900_160 vt100 with PC+ kybd, -+ use=ncr260vt100pp, -+ncr160vt100wan|NCR 2900_160 vt100 wide mode ansi kybd, -+ use=ncr260vt100wan, -+ncr160vt100wpp|NCR 2900_160 vt100 wide mode pc+ kybd, -+ use=ncr260vt100wpp, -+ncr160vt200an|NCR 2900_160 vt200 with ansi kybd, -+ use=ncr260vt200an, -+ncr160vt200pp|NCR 2900_160 vt200 with pc+ kybd, -+ use=ncr260vt200pp, -+ncr160vt200wan|NCR 2900_160 vt200 wide mode ansi kybd, -+ use=ncr260vt200wan, -+ncr160vt200wpp|NCR 2900_160 vt200 wide mode pc+ kybd, -+ use=ncr260vt200wpp, -+ncr160vt300an|NCR 2900_160 vt300 with ansi kybd, -+ use=ncr260vt300an, -+ncr160vt300pp|NCR 2900_160 vt300 with pc+ kybd, -+ use=ncr260vt300pp, -+ncr160vt300wan|NCR 2900_160 vt300 wide mode ansi kybd, -+ use=ncr260vt300wan, -+ncr160vt300wpp|NCR 2900_160 vt300 wide mode pc+ kybd, -+ use=ncr260vt300wpp, -+ncr160wy50+pp|NCR 2900_160 wyse 50+, -+ use=ncr260wy50+pp, -+ncr160wy50+wpp|NCR 2900_160 wyse 50+ wide mode, -+ use=ncr260wy50+wpp, -+ncr160wy60pp|NCR 2900_160 wyse 60, -+ use=ncr260wy60pp, -+ncr160wy60wpp|NCR 2900_160 wyse 60 wide mode, -+ use=ncr260wy60wpp, -+ncrvt100an|ncrvt100pp|NCR vt100 for the 2900 terminal, -+ am, hs, mc5i, mir, msgr, xon, -+ cols#80, it#8, lines#24, nlab#32, -+ acsc=``aaffgghhiijjkkllmmnnqqttuuvvwwxxyyzz~~, -+ bel=^G, blink=\E[5m$<30>, bold=\E[1m$<30>, -+ clear=\E[2J\E[1;1H$<300>, cr=^M, -+ csr=\E[%i%p1%d;%p2%dr$<100>, cub=\E[%p1%dD$<30>, -+ cub1=\E[D$<2>, cud=\E[%p1%dB$<30>, cud1=\E[B$<2>, -+ cuf=\E[%p1%dC$<30>, cuf1=\E[C$<2>, -+ cup=\E[%i%p1%d;%p2%dH$<100>, cuu=\E[%p1%dA$<30>, -+ cuu1=\E[A$<2>, dch=\E[%p1%dP$<40>, dch1=\E[1P$<10>, -+ dl=\E[%p1%dM$<70>, dl1=\E[M$<40>, dsl=\E[31l$<25>, -+ ed=\E[0J$<300>, el=\E[0K$<30>, el1=\E[1K$<30>, -+ enacs=\E(B\E)0$<40>, fsl=1$<10>, home=\E[H$<2>$<80>, -+ ht=^I, hts=\EH, il=\E[%p1%dL$<80>, il1=\E[B\E[L$<80>, -+ ind=\ED, -+ is2=\E[12h\E[?10l\E%/0n\E[P\031\E[?3l\E(B\E)0$<200>, -+ kLFT=\E[D, kRIT=\E[C, ka1=\E[H, kbs=^H, kcub1=\E[D, -+ kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kent=^M, kf1=\EOP, -+ kf2=\EOQ, kf3=\EOR, kf4=\EOS, mc0=\E[i$<100>, nel=\EE, -+ rc=\E8, rev=\E[7m$<30>, ri=\EM$<50>, rmacs=\017$<90>, -+ rmir=\E[4l$<80>, rmso=\E[0m$<30>, rmul=\E[0m$<30>, -+ rs2=\Ec\E[12;31h\E[?3;4;5;10l\E[?6;7;19;25h\E[33;34l\E[0m\E(B\E)0\E%/0n\E[P\031$<200>, -+ sc=\E7, -+ sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;$<100>, -+ sgr0=\017\E[0m$<120>, smacs=\016$<90>, smir=\E[4h$<80>, -+ smso=\E[7m$<30>, smul=\E[4m$<30>, tbc=\E[3g$<40>, -+ tsl=\E[>+1$<70>, -+ncrvt100wan|NCRVT100WPP|ncrvt100wpp|NCR VT100 emulation of the 2900 terminal, -+ cols#132, -+ is2=\E[12h\E[?10l\E%/0n\E[P\031\E[?3h\E(B\E)0$<200>, -+ rs2=\Ec\E[12;31h\E[?4;5;10l\E?3;6;7;19;25h\E[33;34l\E[0m\E(B\E)0\E%/0n\E[P\031$<200>, -+ use=ncrvt100an, - # --# * By default, version 51 uses UTF-8 encoding with broken altcharset --# support, so "ASCII" (-7) entries without altcharset support were --# added. -+# Vendor-supplied NCR termcaps end here - --# nsterm - AppKit Terminal.app --# --# Apple's Mac OS X includes a Terminal.app derived from the old NeXT --# Terminal.app. It is a partial VT100 emulation with some xterm-like --# extensions. This terminfo was written to describe versions 41 --# (shipped with Mac OS X version 10.0) and 51 (shipped with Mac OS X --# version 10.1) of Terminal.app. --# --# Terminal.app runs under the Mac OS X Quartz windowing system (and --# other AppKit-supported windowing systems.) On the Mac OS X machine I --# use, the executable for Terminal.app is: --# /Applications/Utilities/Terminal.app/Contents/MacOS/Terminal --# --# If you're looking for a description of the full-screen system --# console which runs under Apple's Darwin operating system on PowerPC --# platforms, see the "xnuppc" entry instead. --# --# There were no function keys in version 41. In version 51, there are --# four working function keys (F1, F2, F3 and F4.) The function keys --# are included in all of these entries. --# --# It does not support mouse pointer position reporting. Under some --# circumstances the cursor can be positioned using option-click; this --# works by comparing the cursor position and the selected position, --# and simulating enough cursor-key presses to move the cursor to the --# selected position. This technique fails in all but the simplest --# applications. --# --# It provides partial ANSI color support (background colors interacted --# badly with bold in version 41, though, as reflected in :ncv:.) The --# monochrome (-m) entries are useful if you've disabled color support --# or use a monochrome monitor. The full color (-c) entries are useful --# in version 51, which doesn't exhibit the background color bug. They --# also enable an xterm-compatible 16-color mode. --# --# The configurable titlebar is set using xterm-compatible sequences; --# it is used as a status bar in the statusline (-s) entries. Its width --# depends on font sizes and window sizes, but 50 characters seems to --# be the default for an 80x24 window. -+# NCR7900 DIP switches: - # --# The MacRoman character encoding is used for some of the alternate --# characters in the "MacRoman" entries; the "ASCII" (-7) entries --# disable alternate character set support entirely, and the "VT100" --# (-acs) entries rely instead on Terminal.app's own buggy VT100 --# graphics emulation, which seems to think the character encoding is --# the old NeXT charset instead of MacRoman. The "ASCII" (-7) entries --# are useful in Terminal.app version 51, which supports UTF-8 and --# other ASCII-compatible character encodings but does not correctly --# implement VT100 graphics; once VT100 graphics are correctly --# implemented in Terminal.app, the "VT100" (-acs) entries should be --# usable in any ASCII-compatible character encoding [except perhaps --# in UTF-8, where some experts argue for disallowing alternate --# characters entirely.] -+# Switch A: -+# 1-4 - Baud Rate -+# 5 - Parity (Odd/Even) -+# 6 - Don't Send or Do Send Spaces -+# 7 - Parity Enable -+# 8 - Stop Bits (One/Two) - # --# Terminal.app reports "vt100" as the terminal type, but exports --# several environment variables which may aid detection in a shell --# profile (i.e. .profile or .login): -+# Switch B: -+# 1 - Upper/Lower Shift -+# 2 - Typewriter Shift -+# 3 - Half Duplex / Full Duplex -+# 4 - Light/Dark Background -+# 5-6 - Carriage Return Without / With Line Feed -+# 7 - Extended Mode -+# 8 - Suppress Keyboard Display - # --# TERM=vt100 --# TERM_PROGRAM=Apple_Terminal --# TERM_PROGRAM_VERSION=41 # in Terminal.app version 41 --# TERM_PROGRAM_VERSION=51 # in Terminal.app version 51 -+# Switch C: -+# 1 - End of line entry disabled/enabled -+# 2 - Conversational mode / (Local?) Mode -+# 3 - Control characters displayed / not displayed -+# 4 - (2-wire?) / 4-wire communications -+# 5 - RTS on and off for each character -+# 6 - (50Hz?) / 60 Hz -+# 7 - Exit after level zero diagnostics -+# 8 - RS-232 interface - # --# For example, the following Bourne shell script would detect the --# correct terminal type: -+# Switch D: -+# 1 - Reverse Channel (yes / no) -+# 2 - Manual answer (no / yes) -+# 3-4 - Cursor appearance -+# 5 - Communication Rate -+# 6 - Enable / Disable EXT turnoff -+# 7 - Enable / Disable CR turnoff -+# 8 - Enable / Disable backspace - # --# if [ :"$TERM" = :"vt100" -a :"$TERM_PROGRAM" = :"Apple_Terminal" ] --# then --# export TERM --# if [ :"$TERM_PROGRAM_VERSION" = :41 ] --# then --# TERM="nsterm-old" --# else --# TERM="nsterm-c-7" --# fi --# fi -+# Since each attribute parameter is 0 or 1, we shift each attribute (standout, -+# reverse, blink, dim, and underline) the appropriate number of bits (by -+# multiplying the 0 or 1 by a correct factor to shift) so the bias character, -+# '@' is (effectively) "or"ed with each attribute to generate the proper third -+# character in the <ESC>0 sequence. The <sgr> string implements the following -+# equation: - # --# In a C shell derivative, this would be accomplished by: -+# ((((('@' + P5) | (P4 << 1)) | (P3 << 3)) | (P2 << 4)) | (p1 * 17)) => -+# ((((('@' + P5) + (P4 << 1)) + (P3 << 3)) + (P2 << 4)) + (p1 * 17)) - # --# if ( $?TERM && $?TERM_PROGRAM && $?TERM_PROGRAM_VERSION) then --# if ( :"$TERM" == :"vt100" && :"$TERM_PROGRAM" == :"Apple_Terminal" ) then --# if ( :"$TERM_PROGRAM_VERSION" == :41 ) then --# setenv TERM "nsterm-old" --# else --# setenv TERM "nsterm-c-7" --# endif --# endif --# endif -- --# The '+' entries are building blocks --nsterm+7|AppKit Terminal.app v41+ basic capabilities w/ASCII charset, -- am, bw, msgr, xenl, xon, -- cols#80, it#8, lines#24, -- bel=^G, blink=\E[5m, bold=\E[1m, clear=\E[H\E[J, cr=^M, -- csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, -- cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, -- cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, -- dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[K, el1=\E[1K, -- home=\E[H, ht=^I, hts=\EH, il=\E[%p1%dL, il1=\E[L, ind=^J, -- invis=\E[8m, kbs=\177, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, -- kcuu1=\EOA, kent=\EOM, rc=\E8, rev=\E[7m, ri=\EM, -- rmam=\E[?7l, rmkx=\E[?1l\E>, rmso=\E[m, rmul=\E[m, -- rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sc=\E7, -- sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p7%t;8%;m, -- sgr0=\E[m, smam=\E[?7h, smkx=\E[?1h\E=, smso=\E[7m, -- smul=\E[4m, tbc=\E[3g, use=vt100+enq, use=vt100+pfkeys, -- --nsterm+acs|AppKit Terminal.app v41+ basic capabilities w/VT100 alternate-charset, -- acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -- enacs=\E(B\E)0, rmacs=^O, -- sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, -- sgr0=\E[m\017, smacs=^N, use=nsterm+7, -- --nsterm+mac|AppKit Terminal.app v41+ basic capabilities w/MacRoman alternate-charset, -- acsc=+\335\,\334-\366.\3770#`\327a\:f\241g\261h#i\360jjkkllmmnno\370p\370q\321rrssttuuvvwwxxy\262z\263{\271|\255}\243~\245, -- enacs=\E(B\E)0, rmacs=^O, -- sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, -- sgr0=\E[m\017, smacs=^N, use=nsterm+7, -- --nsterm+s|AppKit Terminal.app v41+ status-line (window titlebar) support, -- hs, -- wsl#50, -- dsl=\E]2;\007, fsl=^G, tsl=\E]2;, -- --nsterm+c|AppKit Terminal.app v51+ full color support (including 16 colors), -- op=\E[0m, use=ibm+16color, -- --nsterm+c41|AppKit Terminal.app v41 color support, -- colors#8, ncv#37, pairs#64, -- op=\E[0m, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, -- --# These are different combinations of the building blocks -- --# ASCII charset (-7) --nsterm-m-7|nsterm-7-m|AppKit Terminal.app v41+ w/ASCII charset (monochrome), -- use=nsterm+7, -- --nsterm-m-s-7|nsterm-7-m-s|AppKit Terminal.app v41+ w/ASCII charset (monochrome w/statusline), -- use=nsterm+s, use=nsterm+7, -- --nsterm-7|AppKit Terminal.app v41+ w/ASCII charset (color), -- use=nsterm+c41, use=nsterm+7, -- --nsterm-7-c|nsterm-c-7|AppKit Terminal.app v51+ w/ASCII charset (full color), -- use=nsterm+c, use=nsterm+7, -- --nsterm-s-7|nsterm-7-s|AppKit Terminal.app v41+ w/ASCII charset (color w/statusline), -- use=nsterm+s, use=nsterm+c41, use=nsterm+7, -- --nsterm-c-s-7|nsterm-7-c-s|AppKit Terminal.app v51+ w/ASCII charset (full color w/statusline), -- use=nsterm+s, use=nsterm+c, use=nsterm+7, -- --# VT100 alternate-charset (-acs) --nsterm-m-acs|nsterm-acs-m|AppKit Terminal.app v41+ w/VT100 alternate-charset (monochrome), -- use=nsterm+acs, -- --nsterm-m-s-acs|nsterm-acs-m-s|AppKit Terminal.app v41+ w/VT100 alternate-charset (monochrome w/statusline), -- use=nsterm+s, use=nsterm+acs, -- --nsterm-acs|AppKit Terminal.app v41+ w/VT100 alternate-charset (color), -- use=nsterm+c41, use=nsterm+acs, -+# Where: P1 <==> Standout attribute parameter -+# P2 <==> Underline attribute parameter -+# P3 <==> Reverse attribute parameter -+# P4 <==> Blink attribute parameter -+# P5 <==> Dim attribute parameter -+# From <root@goliath.un.atlantaga.NCR.COM>, init string hacked by SCO. -+ncr7900i|ncr7900|ncr 7900 model 1, -+ am, bw, ul, -+ cols#80, lines#24, xmc#1, -+ bel=^G, blink=\E0B, clear=^L, cr=^M, cub1=^H, cud1=^J, cuf1=^F, -+ cup=\E1%p2%c%p1%c, cuu1=^Z, dim=\E0A, ed=\Ek, el=\EK, ind=^J, -+ is2=\E0@\010\E3\E4\E7, kcub1=^U, kcud1=^J, kcuf1=^F, -+ kcuu1=^Z, khome=^A, ll=^A, mc4=^T, mc5=^R, rev=\E0P, rmso=\E0@, -+ rmul=\E0@, -+ sgr=\E0%p5%{64}%+%p4%{2}%*%+%p3%{16}%*%+%p2%{32}%*%+%p1%{17}%*%+%c, -+ sgr0=\E0@, smso=\E0Q, smul=\E0`, -+ncr7900iv|ncr 7900 model 4, -+ am, bw, eslok, hs, -+ cols#80, lines#24, -+ bel=^G, clear=^L, cr=^M, cub1=^H, cud1=^J, -+ cup=\013%p1%{64}%+%c\E\005%p2%02d, dl1=\E^O, dsl=\Ey1, -+ fsl=\Ek\Ey5, home=\013@\E^E00, il1=\E^N, ind=^J, kbs=^H, -+ kcub1=\ED, kcud1=\EB, kcuf1=\EC, kcuu1=\EA, kf1=\ES, kf2=\ET, -+ kf3=\EU, kf4=\EV, kf5=\EW, kf6=\EP, kf7=\EQ, kf8=\ER, -+ khome=\EH, lf6=blue, lf7=red, lf8=white, nel=^M^J, -+ tsl=\Ej\Ex5\Ex1\EY8%p1%{32}%+%c\Eo, -+# Warning: This terminal will lock out the keyboard when it receives a CTRL-D. -+# The user can enter a CTRL-B to get out of this locked state. -+# In <hpa>, we want to output the character given by the formula: -+# ((col / 10) * 16) + (col % 10) where "col" is "p1" -+ncr7901|ncr 7901 model, -+ am, bw, ul, -+ cols#80, lines#24, -+ bel=^G, blink=\E0B, civis=^W, clear=^L, cnorm=^X, cr=^M, -+ cub1=^H, cud1=^J, cuf1=^F, -+ cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=^Z, dim=\E0A, -+ ed=\Ek, el=\EK, -+ hpa=\020%p1%{10}%/%{16}%*%p1%{10}%m%+%c, ind=^J, -+ is2=\E4^O, kclr=^L, kcub1=^U, kcud1=^J, kcuf1=^F, kcuu1=^Z, -+ khome=^H, ll=^A, mc4=^T, mc5=^R, rev=\E0P, rmso=^O, rmul=^O, -+ sgr=\E0%p5%{64}%+%p4%{2}%*%+%p3%{16}%*%+%p2%{32}%*%+%p1%{17}%*%+%c\016, -+ sgr0=^O, smso=\E0Q\016, smul=\E0`\016, -+ vpa=\013%p1%{64}%+%c, - --nsterm-c-acs|nsterm-acs-c|AppKit Terminal.app v51+ w/VT100 alternate-charset (full color), -- use=nsterm+c, use=nsterm+acs, -+# Newbury Data Recording Limited (Newbury Data) -+# -+# Have been manufacturing and reselling various peripherals for a long time -+# They don't make terminals anymore, but are still in business (in 2007). -+# Their e-mail address is at ndsales@newburydata.co.uk -+# and their post address is: -+# -+# Newbury Data Recording Ltd, -+# Premier Park, Road One, -+# Winsford, Cheshire, CW7 3PT -+# -+# Their technical support is still good, they sent me for free a printed copy -+# of the 9500 user manual and I got it just 1 week after I first contacted them -+# (in 2005)! - --nsterm-s-acs|nsterm-acs-s|AppKit Terminal.app v41+ w/VT100 alternate-charset (color w/statusline), -- use=nsterm+s, use=nsterm+c41, use=nsterm+acs, -+# NDR 9500 -+# Manufactured in the early/mid eighties, behaves almost the same as a -+# Televideo 950. Take a 950, change its cabinet for a more 80s-ish one (but -+# keep the same keyboard layout), add an optional 25-line mode, replace the DIP -+# switches with a menu and remove the "lock line" feature (ESC ! 1 and ESC ! -+# 2), here is the NDR 9500. Even the line-lock, albeit disabled, is -+# recognized: if you type in "ESC !", the next (third) character is not -+# echoed, showing that the terminal was actually waiting for a parameter! -+ndr9500|nd9500|Newbury Data 9500, -+ am, bw, hs, mc5i, mir, msgr, ul, xon, -+ cols#80, lines#24, wsl#79, -+ acsc=jDkClBmAnIqKtMuLvOwNxJ, bel=^G, cbt=\EI, civis=\E.0, -+ clear=\E;, cnorm=\E.1, cr=^M, cub1=^H, cud1=^V, cuf1=^L, -+ cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW, -+ dim=\E), dl1=\ER, dsl=\Eh, ed=\EY, el=\ET, -+ flash=\Eb$<50/>\Ed, fsl=^M, home=^^, ht=^I, hts=\E1, -+ ich1=\EQ, il1=\EE, ind=^J, is2=\Ew\E'\EDF\El\Er\EO, -+ kDC=\Er, kDL=\EO, kEOL=\Et, kIC=\Eq, kcbt=\EI, kclr=^Z, -+ kcub1=^H, kcud1=^V, kcuf1=^L, kcuu1=^K, kdch1=\EW, kdl1=\ER, -+ ked=\EY, kel=\ET, kent=^M, kf1=^A@\r, kf10=^AI\r, kf11=^AJ\r, -+ kf12=^A`\r, kf13=^Aa\r, kf14=^Ab\r, kf15=^Ac\r, kf16=^Ad\r, -+ kf17=^Ae\r, kf18=^Af\r, kf19=^Ag\r, kf2=^AA\r, kf20=^Ah\r, -+ kf21=^Ai\r, kf22=^Aj\r, kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, -+ kf6=^AE\r, kf7=^AF\r, kf8=^AG\r, kf9=^AH\r, khome=^^, -+ kich1=\EQ, kil1=\EE, kprt=\EP, mc4=\Ea, mc5=\E`, nel=^_, -+ pfloc=\E|%{48}%p1%+%c2%p2\031, -+ pfx=\E|%{48}%p1%+%c1%p2\031, prot=\E), ri=\Ej, -+ rmacs=\E%%, rmir=\Er, rmso=\E(, rmxon=^N, -+ sgr=\EG0\E%%%%\E(%?%p1%p5%p8%|%|%t\E)%;%?%p9%t\E$%;, -+ sgr0=\EG0\E%%\E(, smacs=\E$, smir=\Eq, smso=\E), smxon=^O, -+ tbc=\E3, tsl=\Eg\Ef\011%p1%{32}%+%c, .kbs=^H, - --nsterm-c-s-acs|nsterm-acs-c-s|AppKit Terminal.app v51+ w/VT100 alternate-charset (full color w/statusline), -- use=nsterm+s, use=nsterm+c, use=nsterm+acs, -+ndr9500-nl|NDR 9500 with no status line, -+ hs@, -+ wsl@, -+ dsl@, fsl@, tsl@, use=ndr9500, - --# MacRoman charset --nsterm-m|AppKit Terminal.app v41+ w/MacRoman charset (monochrome), -- use=nsterm+mac, -+ndr9500-25|NDR 9500 with 25th line enabled, -+ lines#25, use=ndr9500, - --nsterm-m-s|AppKit Terminal.app v41+ w/MacRoman charset (monochrome w/statusline), -- use=nsterm+s, use=nsterm+mac, -+ndr9500-25-nl|NDR 9500 with 25 lines and no status line, -+ lines#25, use=ndr9500-nl, - --nsterm-old|AppKit Terminal.app v41+ w/MacRoman charset (color), -- use=nsterm+c41, use=nsterm+mac, -+ndr9500-mc|NDR 9500 with magic cookies (enables underline inverse video invisible and blink), -+ msgr@, -+ xmc#1, -+ blink=\EG2, invis=\EG1, rev=\EG4, rmso=\EG0, rmul=\EG0, -+ sgr=\E%%\E(%?%p5%p8%|%t\E)%;%?%p9%t\E$%;\EG%{48}%?%p7%t%{1}%+%;%?%p4%t%{2}%+%;%?%p3%p1%|%t%{4}%+%;%?%p2%t%{8}%+%;%c, -+ sgr0=\EG0\E%%\E(, smso=\EG4, smul=\EG8, use=ndr9500, - --nsterm-c|AppKit Terminal.app v51+ w/MacRoman charset (full color), -- use=nsterm+c, use=nsterm+mac, -+ndr9500-25-mc|NDR 500 with 25 lines and magic cookies, -+ lines#25, use=ndr9500-mc, - --nsterm-s|AppKit Terminal.app v41+ w/MacRoman charset (color w/statusline), -- use=nsterm+s, use=nsterm+c41, use=nsterm+mac, -+ndr9500-mc-nl|NDR 9500 with magic cookies and no status line, -+ hs@, -+ wsl@, -+ dsl@, fsl@, tsl@, use=ndr9500-mc, - --nsterm-c-s|AppKit Terminal.app v51+ w/MacRoman charset (full color w/statusline), -- use=nsterm+s, use=nsterm+c, use=nsterm+mac, -+ndr9500-25-mc-nl|NDR 9500 with 25 lines and magic cookies and no status line, -+ lines#25, use=ndr9500-mc-nl, - --# In Mac OS X version 10.5 the format of the preferences has changed --# and a new, more complex technique is needed, e.g., -+#### Perkin-Elmer (Owl) - # --# python -c 'import sys,objc;NSUserDefaults=objc.lookUpClass( --# "NSUserDefaults");ud=NSUserDefaults.alloc(); --# ud.init();prefs=ud.persistentDomainForName_( --# "com.apple.Terminal");prefs["Window Settings"][ --# prefs["Default Window Settings"]]["TerminalType" --# ]=sys.argv[1];ud.setPersistentDomain_forName_(prefs, --# "com.apple.Terminal")' nsterm-16color -+# These are official terminfo entries from within Perkin-Elmer. - # --# and it is still not settable from the preferences dialog. This is --# tracked under rdar://problem/7365108 and rdar://problem/7365134 --# in Apple's bug reporter. --nsterm-16color|AppKit Terminal.app v240.2+ with Mac OS X version 10.5, -- bw@, mir, npc, -- civis=\E[?25l, cnorm=\E[?25h, dch=\E[%p1%dP, dch1=\E[P, -- flash=\E[?5h$<200/>\E[?5l, hpa=\E[%i%p1%dG, -- ich=\E[%p1%d@, ich1=\E[@, kdch1=\E[3~, kend=\E[F, -- kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, -- kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, kf17=\E[31~, -- kf18=\E[22~, kf19=\E[33~, kf20=\E[34~, kf5=\E[15~, -- kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, khome=\E[H, -- knp=\E[6~, kpp=\E[5~, rmcup=\E[2J\E[?47l\E8, rmir=\E[4l, -- smcup=\E7\E[?47h, smir=\E[4h, vpa=\E[%i%p1%dd, -- use=nsterm-c-s-acs, - --# The versions of Terminal.app in Mac OS X version 10.3.x seem to have --# the background color erase bug. The newer version 240.2 in Mac OS X --# version 10.5 does not. -+bantam|pe550|pe6100|perkin elmer 550, -+ OTbs, -+ cols#80, lines#24, -+ bel=^G, clear=\EK$<20>, cr=^M, cub1=^H, cud1=^J, cuf1=\EC, -+ cup=\EX%p1%{32}%+%c\EY%p2%{32}%+%c, cuu1=\EA, -+ el=\EI$<20>, home=\EH, ind=^J, ll=\EH\EA, -+fox|pe1100|perkin elmer 1100, -+ OTbs, am, -+ cols#80, lines#24, -+ bel=^G, clear=\EH\EJ$<132>, cr=^M, cub1=^H, cud1=^J, -+ cuf1=\EC, cup=\EX%p1%{32}%+%c\EY%p2%{32}%+%c, cuu1=\EA, -+ ed=\EJ$<5.5*>, el=\EI, flash=\020\002$<200/>\020\003, -+ home=\EH, hts=\E1, ind=^J, ll=\EH\EA, tbc=\E3, -+owl|pe1200|perkin elmer 1200, -+ OTbs, am, in, -+ cols#80, lines#24, -+ bel=^G, clear=\EH\EJ$<132>, cr=^M, cub1=^H, cud1=^J, -+ cuf1=\EC, cup=\EX%p1%{32}%+%c\EY%p2%{32}%+%c, cuu1=\EA, -+ dch1=\EO$<5.5*>, dl1=\EM$<5.5*>, ed=\EJ$<5.5*>, -+ el=\EI$<5.5>, flash=\020\002$<200/>\020\003, home=\EH, -+ hts=\E1, ich1=\EN, il1=\EL$<5.5*>, ind=^J, ip=$<5.5*>, -+ kbs=^H, kf0=\ERJ, kf1=\ERA, kf2=\ERB, kf3=\ERC, kf4=\ERD, -+ kf5=\ERE, kf6=\ERF, kf7=\ERG, kf8=\ERH, kf9=\ERI, ll=\EH\EA, -+ rmso=\E!\0, sgr0=\E!\0, smso=\E!^H, tbc=\E3, -+pe1251|pe6300|pe6312|perkin elmer 1251, -+ am, -+ cols#80, it#8, lines#24, pb#300, vt#8, xmc#1, -+ bel=^G, clear=\EK$<332>, cr=^M, cub1=\ED, cud1=\EB, cuf1=\EC, -+ cup=\EX%p1%{32}%+%c\EY%p2%{32}%+%c, cuu1=\EA, -+ ed=\EJ$<20*>, el=\EI$<10*>, home=\EH, hts=\E1, ind=^J, -+ kf0=\ERA, kf1=\ERB, kf10=\ERK, kf2=\ERC, kf3=\ERD, kf4=\ERE, -+ kf5=\ERF, kf6=\ERG, kf7=\ERH, kf8=\ERI, kf9=\ERJ, tbc=\E3, -+# (pe7000m: this had -+# rmul=\E!\0, smul=\E!\040, -+# which is probably wrong, it collides with kf0 -+pe7000m|perkin elmer 7000 series monochrome monitor, -+ am, -+ cols#80, lines#24, -+ bel=^G, cbt=\E!Y, clear=\EK, cr=^M, cub1=\ED, cud1=\EB, -+ cuf1=\EC, cup=\ES%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, -+ ed=\EJ, el=\EI, home=\EH, ind=^J, -+ is1=\E!\0\EW 7o\Egf\ES7\s, kbs=^H, kcub1=\E!V, -+ kcud1=\E!U, kcuf1=\E!W, kcuu1=\E!T, kf0=\E!\0, kf1=\E!^A, -+ kf10=\E!^J, kf2=\E!^B, kf3=\E!^C, kf4=\E!^D, kf5=\E!^E, -+ kf6=\E!^F, kf7=\E!^G, kf8=\E!^H, kf9=\E!^I, khome=\E!S, -+ ll=\ES7\s, ri=\ER, -+pe7000c|perkin elmer 7000 series colour monitor, -+ is1=\E!\0\EW 7o\Egf\Eb0\Ec7\ES7\s, rmso=\Eb0, -+ rmul=\E!\0, smso=\Eb2, smul=\E!\s, use=pe7000m, -+ -+#### Sperry Univac - # --# This entry is based on newsgroup comments by Alain Bench, Christian Ebert, --# and D P Schreber comparing to nsterm-c-s-acs. -+# Sperry Univac has merged with Burroughs to form Unisys. - # --# In Mac OS X version 10.4 and earlier, D P Schreber notes that $TERM --# can be set in Terminal.app, e.g., -+ -+# This entry is for the Sperry UTS30 terminal running the TTY -+# utility under control of CP/M Plus 1R1. The functionality -+# provided is comparable to the DEC vt100. -+# (uts30: I added <rmam>/<smam> based on the init string -- esr) -+uts30|sperry uts30 with cp/m@1R1, -+ am, bw, hs, -+ cols#80, lines#24, wsl#40, -+ acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -+ bel=^G, blink=\E[5m, bold=\E[1m, civis=\ER, clear=^L, -+ cnorm=\ES, cr=^M, csr=\EU%p1%{32}%+%c%p2%{32}%+%c, -+ cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=\E[B, -+ cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, -+ cuu=\E[%p1%dA, cuu1=\E[A, dch=\E[%p1%dP, dch1=\EM, -+ dl=\E[%p1%dM, dl1=\EL, ed=\E[J, el=\E[K, fsl=^M, home=\E[H, -+ ht=^I, ich=\E[%p1%d@, ich1=\EO, il=\E[%p1%dL, il1=\EN, -+ ind=^J, indn=\E[%p1%dB, is2=\E[U 7\E[24;1H, kbs=^H, -+ kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, khome=\E[H, -+ rc=\EX, rev=\E[7m, rf=/usr/share/tabset/vt100, ri=\EI, -+ rin=\E[%p1%dA, rmacs=\Ed, rmam=\E[?7l, rmso=\E[m, -+ rmul=\E[m, rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, -+ sc=\EW, sgr0=\E[m, smacs=\EF, smam=\E[?7m, smso=\E[7m, -+ smul=\E[4m, tsl=\E], uc=\EPB, -+ -+#### Tandem - # --# defaults write com.apple.Terminal TermCapString nsterm-bce -+# Tandem builds these things for use with its line of fault-tolerant -+# transaction-processing computers. They aren't generally available -+# on the merchant market, and so are fairly uncommon. - # --# and that it is not set in Terminal's preferences dialog. --nsterm-bce|AppKit Terminal.app v71+/v100.1.8+ with Mac OS X version 10.3/10.4 (bce), -- bce, bw, use=nsterm-16color, - --# This is an alias which should always point to the "current" version --nsterm|Apple_Terminal|AppKit Terminal.app, -- use=nsterm-16color, -+tandem6510|adm3a repackaged by Tandem, -+ use=adm3a, - --# iTerm.app from http://iterm.sourceforge.net/ is an alternative (and --# more featureful) terminal emulator for Mac OS X. It is similar --# enough in capabilities to nsterm-16color that I have derived this --# description from that one, but as far as I know they share no code. --# Many of the features are user-configurable, but I attempt only to --# describe the default configuration. --# --# NOTE: When tack tests (csr) + (nel) iTerm.app crashes, so (csr) is --# disabled. --iTerm.app|iTerm.app terminal emulator for Mac OS X, -- bce, bw@, ccc@, -- csr@, initc@, kend=\EOF, khome=\EOH, use=xterm+256color, -- use=nsterm-16color, -+# A funny series of terminal that TANDEM uses. The actual model numbers -+# have a fourth digit after 653 that designates minor variants. These are -+# natively block-mode and rather ugly, but they have a character mode which -+# this doubtless(?) exploits. There is a 6520 that is slightly dumber. -+# (tandem653: had ":sb=\ES:", probably someone's mistake for sf; also, -+# removed <if=/usr/share/tabset/tandem653>, no such file -- esr) -+tandem653|t653x|Tandem 653x multipage terminal, -+ OTbs, am, da, db, hs, -+ cols#80, lines#24, wsl#64, xmc#1, -+ clear=\EI, cub1=^H, cud1=^J, cuf1=\EC, -+ cup=\023%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, dsl=\Eo\r, -+ ed=\EJ, el=\EK, fsl=^M, home=\EH, ind=\ES, ri=\ET, rmso=\E6\s, -+ rmul=\E6\s, sgr0=\E6\s, smso=\E6$, smul=\E60, tsl=\Eo, - --# xnuppc - Darwin PowerPC Console (a.k.a. "darwin") -+#### Tandy/Radio Shack - # --# On PowerPC platforms, Apple's Darwin operating system uses a --# full-screen system console derived from a NetBSD framebuffer --# console. It is an ANSI-style terminal, and is not really VT-100 --# compatible. -+# Tandy has a line of VDTs distinct from its microcomputers. - # --# Under Mac OS X, this is the system console driver used while in --# single-user mode [reachable by holding down Command-S during the --# boot process] and when logged in using console mode [reachable by --# typing ">console" at the graphical login prompt.] -+ -+dmterm|deskmate terminal, -+ am, bw, -+ cols#80, lines#24, -+ bel=^G, civis=\EG5, clear=\Ej, cnorm=\EG6, cr=^M, cub1=^H, -+ cud1=\EB, cuf1=\EC, cup=\EY%p1%{32}%+%c%p2%{32}%+%c, -+ cuu1=\EA, dch1=\ES, dl1=\ER, ed=\EJ, el=\EK, home=\EH, ht=^I, -+ ich1=\EQ, il1=\EP, ind=\EX, invis@, kcub1=\ED, kcud1=\EB, -+ kcuf1=\EC, kcuu1=\EA, kf0=\E1, kf1=\E2, kf2=\E3, kf3=\E4, -+ kf4=\E5, kf5=\E6, kf6=\E7, kf7=\E8, kf8=\E9, kf9=\E0, -+ khome=\EH, lf0=f1, lf1=f2, lf2=f3, lf3=f4, lf4=f5, lf5=f6, -+ lf6=f7, lf7=f8, lf8=f9, lf9=f10, ll=\EE, rmul@, smul@, -+ use=adm+sgr, -+dt100|dt-100|Tandy DT-100 terminal, -+ xon, -+ cols#80, lines#24, xmc#1, -+ acsc=jjkkllmmnnqqttuuvvwwxx, bel=^G, civis=\E[?25l, -+ clear=\E[H\E[2J, cnorm=\E[?25h, cr=^M, -+ csr=\E[%p1%2d;%p2%2dr, cub1=^H, cud1=\E[B, cuf1=\E[C, -+ cup=\010\E[%i%p1%d;%p2%dH, cuu1=\E[A, dch1=\E[P, -+ dl1=\E[M, ed=\E[J, el=\E[K, home=\E[H, ht=^I, ich1=\E[@, -+ il1=\E[L, ind=^J, is2=\E[?3l\E)0\E(B, kcub1=\E[D, -+ kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kf1=\E[?3i, -+ kf10=\E[?5i, kf2=\E[2i, kf3=\E[@, kf4=\E[M, kf5=\E[17~, -+ kf6=\E[18~, kf7=\E[19~, kf8=\E[20~, kf9=\E[21~, khome=\E[H, -+ knp=\E[29~, kpp=\E[28~, lf1=f1, lf2=f2, lf3=f3, lf4=f4, lf5=f5, -+ lf6=f6, lf7=f7, lf8=f8, ri=\EM, rmacs=^O, rmso=\E[m, rmul=\E[m, -+ sgr0=\E[m, smacs=^N, smso=\E[7m, smul=\E[4m, -+dt100w|dt-100w|Tandy DT-100 terminal (wide mode), -+ cols#132, use=dt100, -+dt110|Tandy DT-110 emulating ansi, -+ xon, -+ cols#80, lines#24, -+ acsc=jjkkllmmnnqqttuuvvwwxx, bel=^G, civis=\E[?25l, -+ clear=\E[H\E[2J, cnorm=\E[?25h, cr=^M, -+ csr=\E[%i%p1%d;%p2%dr, cub1=^H, cud1=\E[B, cuf1=\E[C, -+ cup=\010\E[%i%p1%d;%p2%dH, cuu1=\E[A, dch1=\E[0P, -+ dl1=\E[0M, ed=\E[0J, el=\E[0K, enacs=\E(B\E)0, home=\E[H, -+ ht=^I, ich1=\E[0@, il1=\E[0L, ind=^J, is2=\E[?3l\E)0\E(B, -+ kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kend=\E[K, -+ kf1=\E[1~, kf10=\E[10~, kf2=\E[2~, kf3=\E[3~, kf4=\E[4~, -+ kf5=\E[5~, kf6=\E[6~, kf7=\E[7~, kf8=\E[8~, kf9=\E[9~, -+ khome=\E[G, kich1=\E[@, knp=\E[26~, kpp=\E[25~, lf0=f1, -+ lf1=f2, lf2=f3, lf3=f4, lf4=f5, lf5=f6, lf6=f7, lf7=f8, lf8=f9, -+ lf9=f10, ri=\EM, rmacs=^O, rmso=\E[m, rmul=\E[m, sgr0=\E[m, -+ smacs=^N, smso=\E[7m, smul=\E[4m, -+pt210|TRS-80 PT-210 printing terminal, -+ hc, os, -+ cols#80, -+ bel=^G, cr=^M, cud1=^J, ind=^J, -+ -+#### Tektronix (tek) - # --# If you're looking for a description of the Terminal.app terminal --# emulator which runs under the Mac OS X Quartz windowing system (and --# other AppKit-supported windowing systems,) see the "nsterm" --# entry instead. -+# Tektronix tubes are graphics terminals. Most of them use modified -+# oscilloscope technology incorporating a long-persistence green phosphor, -+# and support vector graphics on a main screen with an attached "dialogue -+# area" for interactive text. -+# -+ -+tek|tek4012|tektronix 4012, -+ OTbs, os, -+ cols#75, lines#35, -+ bel=^G, clear=\E\014$<1000>, cr=^M, cub1=^H, cud1=^J, -+ ff=\014$<1000>, is2=\E^O, -+# (tek4013: added <acsc> to suppress tic warnings re <smacs>/<rmacs> --esr) -+tek4013|tektronix 4013, -+ acsc=, rmacs=\E^O, smacs=\E^N, use=tek4012, -+tek4014|tektronix 4014, -+ cols#81, lines#38, -+ is2=\E\017\E9, use=tek4012, -+# (tek4015: added <acsc> to suppress tic warnings re <smacs>/<rmacs> --esr) -+tek4015|tektronix 4015, -+ acsc=, rmacs=\E^O, smacs=\E^N, use=tek4014, -+tek4014-sm|tektronix 4014 in small font, -+ cols#121, lines#58, -+ is2=\E\017\E\:, use=tek4014, -+# (tek4015-sm: added <acsc> to suppress tic warnings re <smacs>/<rmacs> --esr) -+tek4015-sm|tektronix 4015 in small font, -+ acsc=, rmacs=\E^O, smacs=\E^N, use=tek4014-sm, -+# Tektronix 4023 from Andrew Klossner <orca!andrew.tektronix@csnet-relay> - # --# NOTE: Under Mac OS X version 10.1, the default login window does not --# prompt for user name, instead requiring an icon to be selected from --# a list of known users. Since the special ">console" login is not in --# this list, you must make one of two changes in the Login Window --# panel of the Login section of System Prefs to make the special --# ">console" login accessible. The first option is to enable 'Show --# "Other User" in list for network users', which will add a special --# "Other..." icon to the graphical login panel. Selecting "Other..." --# will present the regular graphical login prompt. The second option --# is to change the 'Display Login Window as:' setting to 'Name and --# password entry fields', which replaces the login panel with a --# graphical login prompt. -+# You need to have "stty nl2" in effect. Some versions of tset(1) know -+# how to set it for you. - # --# There are no function keys, at least not in Darwin 1.3. -+# It's got the Magic Cookie problem around stand-out mode. If you can't -+# live with Magic Cookie, remove the :so: and :se: fields and do without -+# reverse video. If you like reverse video stand-out mode but don't want -+# it to flash, change the letter 'H' to 'P' in the :so: field. -+tek4023|tektronix 4023, -+ OTbs, am, -+ OTdN#4, cols#80, lines#24, vt#4, xmc#1, -+ OTnl=^J, bel=^G, clear=\E\014$<4/>, cr=^M, cub1=^H, cud1=^J, -+ cuf1=^I, cup=\034%p2%{32}%+%c%p1%{32}%+%c, kbs=^H, -+ rmso=^_@, smso=^_P, -+# It is recommended that you run the 4025 at 4800 baud or less; -+# various bugs in the terminal appear at 9600. It wedges at the -+# bottom of memory (try "cat /usr/dict/words"); ^S and ^Q typed -+# on keyboard don't work. You have to hit BREAK twice to get -+# one break at any speed - this is a documented feature. -+# Can't use cursor motion because it's memory relative, and -+# because it only works in the workspace, not the monitor. -+# Same for home. Likewise, standout only works in the workspace. - # --# It has no mouse support. -+# <el> was commented out since vi and rogue seem to work better -+# simulating it with lots of spaces! - # --# It has full ANSI color support, and color combines correctly with --# all three supported attributes: bold, inverse-video and underline. --# However, bold colored text is almost unreadable (bolding is --# accomplished using shifting and or-ing, and looks smeared) so bold --# has been excluded from the list of color-compatible attributes --# [using (ncv)]. The monochrome entry (-m) is useful if you use a --# monochrome monitor. -+# <il1> and <il> had 145ms of padding, but that slowed down vi's ^U -+# and didn't seem necessary. - # --# There is one serious bug with this terminal emulation's color --# support: repositioning the cursor onto a cell with non-matching --# colors obliterates that cell's contents, replacing it with a blank --# and displaying a colored cursor in the "current" colors. There is --# no complete workaround at present [other than using the monochrome --# (-m) entries,] but removing the (msgr) capability seemed to help. -+tek4024|tek4025|tek4027|tektronix 4024/4025/4027, -+ OTbs, am, da, db, -+ cols#80, it#8, lines#34, lm#0, -+ bel=^G, clear=\037era\r\n\n, cmdch=^_, cr=^M, -+ cub=\037lef %p1%d\r, cub1=^H, cud=\037dow %p1%d\r, -+ cud1=^F^J, cuf=\037rig %p1%d\r, cuf1=\037rig\r, -+ cuu=\037up %p1%d\r, cuu1=^K, dch1=\037dch\r, -+ dl=\037dli %p1%d\r\006, dl1=\037dli\r\006, -+ ed=\037dli 50\r, ht=^I, ich1=\037ich\r \010, -+ il=\037up\r\037ili %p1%d\r, il1=\037up\r\037ili\r, -+ ind=^F^J, -+ is2=!com 31\r\n\037sto 9 17 25 33 41 49 57 65 73\r, -+ rmkx=\037lea p2\r\037lea p4\r\037lea p6\r\037lea p8\r\037lea f5\r, -+ smkx=\037lea p4 /h/\r\037lea p8 /k/\r\037lea p6 / /\r\037lea p2 /j/\r\037lea f5 /H/\r, -+tek4025-17|tek 4025 17 line window, -+ lines#17, use=tek4025, -+tek4025-17-ws|tek 4025 17 line window in workspace, -+ is2=!com 31\r\n\037sto 9 17 25 33 41 49 57 65 73\r\037wor 17\r\037mon 17\r, -+ rmcup=\037mon h\r, rmso=\037att s\r, smcup=\037wor h\r, -+ smso=\037att e\r, use=tek4025-17, -+tek4025-ex|tek4027-ex|tek 4025/4027 w/!, -+ is2=\037com 33\r\n!sto 9 17 25 33 41 49 57 65 73\r, -+ rmcup=\037com 33\r, smcup=!com 31\r, use=tek4025, -+# Tektronix 4025a -+# From: Doug Gwyn <gwyn@brl-smoke.ARPA> -+# The following status modes are assumed for normal operation (replace the -+# initial "!" by whatever the current command character is): -+# !COM 29 # NOTE: changes command character to GS (^]) -+# ^]DUP -+# ^]ECH R -+# ^]EOL -+# ^]RSS T -+# ^]SNO N -+# ^]STO 9 17 25 33 41 49 57 65 73 -+# Other modes may be set according to communication requirements. -+# If the command character is inadvertently changed, termcap can't restore it. -+# Insert-character cannot be made to work on both top and bottom rows. -+# Clear-to-end-of-display emulation via !DLI 988 is too grotty to use, alas. -+# There also seems to be a problem with vertical motion, perhaps involving -+# delete/insert-line, following a typed carriage return. This terminal sucks. -+# Delays not specified; use "stty ixon -ixany" to enable DC3/DC1 flow control! -+# (tek4025a: removed obsolete ":xx:". This may mean the tek4025a entry won't -+# work any more. -- esr) -+tek4025a|Tektronix 4025A, -+ OTbs, OTpt, am, bw, da, db, xon, -+ cols#80, it#8, lines#34, -+ bel=^G, cbt=\035bac;, clear=\035era;\n\035rup;, cmdch=^], -+ cr=^M, cub=\035lef %p1%d;, cub1=^H, cud=\035dow %p1%d;, -+ cud1=^J, cuf=\035rig %p1%d;, cuf1=\035rig;, -+ cuu=\035up %p1%d;, cuu1=^K, dch=\035dch %p1%d;, -+ dch1=\035dch;, dl=\035dli %p1%d;, dl1=\035dli;, -+ el=\035dch 80;, hpa=\r\035rig %p1%d;, ht=^I, -+ il1=\013\035ili;, ind=^J, indn=\035dow %p1%d;, -+ rs2=!com 29\035del 0\035rss t\035buf\035buf n\035cle\035dis\035dup\035ech r\035eol\035era g\035for n\035pad 203\035pad 209\035sno n\035sto 9 17 25 33 41 49 57 65 73\035wor 0;, -+ tbc=\035sto;, -+# From: cbosg!teklabs!davem Wed Sep 16 21:11:41 1981 -+# Here's the command file that I use to get rogue to work on the 4025. -+# It should work with any program using the old curses (e.g. it better -+# not try to scroll, or cursor addressing won't work. Also, you can't -+# see the cursor.) -+# (This "learns" the arrow keys for rogue. I have adapted it for termcap - mrh) -+tek4025-cr|tek 4025 for curses and rogue, -+ OTbs, am, -+ cols#80, it#8, lines#33, -+ clear=\037era;, cub1=^H, cud1=^F^J, cuf1=\037rig;, -+ cup=\037jum%i%p1%d\,%p2%d;, cuu1=^K, ht=^I, ind=^F^J, -+ is2=!com 31\r\n\037sto 9 17 25 33 41 49 57 65 73\r, -+ rmcup=\037wor 0, smcup=\037wor 33h, -+# next two lines commented out since curses only allows 128 chars, sigh. -+# :ti=\037lea p1/b/\037lea p2/j/\037lea p3/n/\037lea p4/h/\037lea p5/ /\037lea p6/l/\037lea p7/y/\037lea p8/k/\037lea p9/u/\037lea p./f/\037lea pt/`era w/13\037lea p0/s/\037wor 33h:\ -+# :te=\037lea p1\037lea p2\037lea p3\037lea p4\037lea pt\037lea p5\037lea p6\037lea p7\037lea p8\037lea p9/la/13\037lea p.\037lea p0\037wor 0: -+tek4025ex|4025ex|4027ex|tek 4025 w/!, -+ is2=\037com 33\r\n!sto 9\,17\,25\,33\,41\,49\,57\,65\,73\r, -+ rmcup=\037com 33\r, smcup=!com 31\r, use=tek4025, -+tek4105|tektronix 4105, -+ OTbs, am, mir, msgr, ul, xenl, xt, -+ cols#79, it#8, lines#29, -+ acsc=, bel=^G, blink=\E[=3;<7m, bold=\E[=7;<4m, cbt=\E[Z, -+ clear=\E[2J\E[H, cr=^M, cub1=\E[1D, cud1=\E[1B, cuf1=\E[1C, -+ cup=\E[%i%p1%2d;%p2%2dH, cuu1=\E[1A, dch1=\E[1P, -+ dim=\E[=1;<6m, dl1=\E[1M, ed=\E[J, el=\E[K, home=\E[H, ht=^I, -+ il1=\E[1L, ind=\E[S, invis=\E[=6;<5, is1=\E%!1\E[m, -+ is2=\E%!1\E[?6141\E[m, kbs=^H, kcub1=\E[1D, kcud1=\E[1B, -+ kcuf1=\E[1C, kcuu1=\E[1A, rev=\E[=1;<3m, ri=\E[T, -+ rmacs=\E[m, rmcup=, rmir=\E[4l, rmso=\E[=0;<1m, -+ rmul=\E[=0;<1m, sgr0=\E[=0;<1m, smacs=\E[1m, -+ smcup=\E%!1\E[?6l\E[2J, smir=\E[4h, smso=\E[=2;<3m, -+ smul=\E[=5;<2m, tbc=\E[1g, -+ -+# (tek4105-30: I added <rmam>/<smam> based on the init string -- esr) -+tek4105-30|4015 emulating 30 line vt100, -+ am, mir, msgr, xenl, xon, -+ cols#80, it#8, lines#30, vt#3, -+ acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -+ bel=^G, blink=\E[5m$<2>, bold=\E[1m$<2>, -+ clear=\E[H\E[J$<50>, cr=^M, csr=\E[%i%p1%d;%p2%dr, -+ cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=^J, -+ cuf=\E[%p1%dC, cuf1=\E[C$<2>, -+ cup=\E[%i%p1%d;%p2%dH$<5>, cuu=\E[%p1%dA, -+ cuu1=\E[A$<2>, ed=\E[J$<50>, el=\E[K$<3>, el1=\E[1K$<3>, -+ enacs=\E(B\E)0, home=\E[H, ht=^I, hts=\EH, ind=^J, kbs=^H, -+ kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, rc=\E8, -+ rev=\E[7m$<2>, ri=\EM$<5>, rmacs=^O, rmam=\E[?7l, -+ rmkx=\E[?1l\E>, rmso=\E[m$<2>, rmul=\E[m$<2>, -+ rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sc=\E7, -+ sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;$<2>, -+ sgr0=\E[m\017$<2>, smacs=^N, smam=\E[?7h, smkx=\E[?1h\E=, -+ smso=\E[1;7m$<2>, smul=\E[4m$<2>, tbc=\E[3g, -+ use=vt100+fnkeys, -+ -+# Tektronix 4105 from BRL -+# The following setup modes are assumed for normal operation: -+# CODE ansi CRLF no DABUFFER 141 -+# DAENABLE yes DALINES 30 DAMODE replace -+# DAVISIBILITY yes ECHO no EDITMARGINS 1 30 -+# FLAGGING input INSERTREPLACE replace LFCR no -+# ORIGINMODE relative PROMPTMODE no SELECTCHARSET G0 B -+# SELECTCHARSET G1 0 TABS -2 -+# Other setup modes may be set for operator convenience or communication -+# requirements; I recommend -+# ACURSOR 1 0 AUTOREPEAT yes AUTOWRAP yes -+# BYPASSCANCEL <LF> CURSORKEYMODE no DAINDEX 1 0 0 -+# EOFSTRING '' EOLSTRING <CR> EOMCHARS <CR> <NU> -+# GAMODE overstrike GCURSOR 0 100 0 GSPEED 10 1 -+# IGNOREDEL no KEYEXCHAR <DL> NVDEFINE -53 "<NU>" -+# PROMPTSTRING '' QUEUESIZE 2460 WINDOW 0 0 4095 3132 -+# XMTDELAY 0 -+# and factory color maps. After setting these modes, save them with NVSAVE. No -+# delays are specified; use "stty ixon -ixany" to enable DC3/DC1 flow control! -+# "IC" cannot be used in combination with "im" & "ei". -+# "tek4105a" is just a guess: -+tek4105a|Tektronix 4105, -+ OTbs, OTpt, msgr, xon, -+ OTkn#8, cols#80, it#8, lines#30, vt#3, -+ acsc=, bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, -+ civis=\E%!0\ETD00\E%!1, clear=\E[H\E[J, -+ cnorm=\E%!0\ETD10\E%!1, cr=^M, csr=\E[%i%p1%d;%p2%dr, -+ cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=^J, -+ cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, -+ cuu=\E[%p1%dA, cuu1=\EM, cvvis=\E%!0\ETD70\E%!1, -+ dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, -+ ech=\E[%p1%dX, ed=\E[J, el=\E[K, home=\E[H, ht=^I, hts=\EH, -+ il=\E[%p1%dL, il1=\E[L, ind=^J, indn=\E[%p1%dS, is2=\E%!1, -+ kbs=^H, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, -+ kf0=\EOA, kf1=\EOB, kf2=\EOC, kf3=\EOD, kf4=\EOP, kf5=\EOQ, -+ kf6=\EOR, kf7=\EOS, lf0=F1, lf1=F2, lf2=F3, lf3=F4, lf4=F5, -+ lf5=F6, lf6=F8, ll=\E[30;H, nel=\EE, rc=\E8, rev=\E[7m, ri=\EM, -+ rin=\E[%p1%dT, rmacs=^O, rmcup=\E%!0\ELBH=\E%!1, -+ rmir=\E[4l, rmkx=\E[?1l\E>, rmso=\E[m, rmul=\E[m, -+ rs2=\030\E%!0\EKC\E\014\EKR0\EKF0\ENM0\ELBH=\ETF8000010F40\ELI100\ELLA>\ELM0\EKE0\ENF1\EKS0\END0\E%!1\Ec\E[?3;5l\E[?7;8h\E[r\E[m\E>, -+ sc=\E7, sgr0=\E[m, smacs=^N, smcup=\E[?6l, smir=\E[4h, -+ smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, tbc=\E[3g, -+ - # --# The "standout" chosen was simple reverse-video, although a colorful --# standout might be more aesthetically pleasing. Similarly, the bold --# chosen is the terminal's own smeared bold, although a simple --# color-change might be more readable. The color-bold (-b) entries --# uses magenta colored text for bolding instead. The fancy color (-f --# and -f2) entries use color for bold, standout and underlined text --# (underlined text is still underlined, though.) -+# Tektronix 4106/4107/4109 from BRL -+# The following setup modes are assumed for normal operation: -+# CODE ansi COLUMNMODE 80 CRLF no -+# DABUFFER 141 DAENABLE yes DALINES 32 -+# DAMODE replace DAVISIBILITY yes ECHO no -+# EDITMARGINS 1 32 FLAGGING input INSERTREPLACE replace -+# LFCR no LOCKKEYBOARD no ORIGINMODE relative -+# PROMPTMODE no SELECTCHARSET G0 B SELECTCHARSET G1 0 -+# TABS -2 -+# Other setup modes may be set for operator convenience or communication -+# requirements; I recommend -+# ACURSOR 1 0 AUTOREPEAT yes AUTOWRAP yes -+# BYPASSCANCEL <LF> CURSORKEYMODE no DAINDEX 1 0 0 -+# EOFSTRING '' EOLSTRING <CR> EOMCHARS <CR> <NU> -+# GAMODE overstrike GCURSOR 0 100 0 GSPEED 9 3 -+# IGNOREDEL no KEYEXCHAR <DL> NVDEFINE -53 "<NU>" -+# PROMPTSTRING '' QUEUESIZE 2620 WINDOW 0 0 4095 3132 -+# XMTDELAY 0 -+# and factory color maps. After setting these modes, save them with NVSAVE. No -+# delays are specified; use "stty ixon -ixany" to enable DC3/DC1 flow control! -+# "IC" cannot be used in combination with "im" & "ei". -+tek4106brl|tek4107brl|tek4109brl|Tektronix 4106 4107 or 4109, -+ msgr, xon, -+ cols#80, it#8, lines#32, vt#3, -+ acsc=, bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, -+ civis=\E%!0\ETD00\E%!1, clear=\E[H\E[J, -+ cnorm=\E%!0\ETD10\E%!1, cr=^M, csr=\E[%i%p1%d;%p2%dr, -+ cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=^J, -+ cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, -+ cuu=\E[%p1%dA, cuu1=\EM, cvvis=\E%!0\ETD70\E%!1, -+ dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, -+ ech=\E[%p1%dX, ed=\E[J, el=\E[K, home=\E[H, ht=^I, hts=\EH, -+ il=\E[%p1%dL, il1=\E[L, ind=^J, indn=\E[%p1%dS, is2=\E%!1, -+ kbs=^H, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, -+ kf0=\EOA, kf1=\EOB, kf2=\EOC, kf3=\EOD, kf4=\EOP, kf5=\EOQ, -+ kf6=\EOR, kf7=\EOS, lf0=F1, lf1=F2, lf2=F3, lf3=F4, lf4=F5, -+ lf5=F6, lf6=F8, ll=\E[32;H, nel=\EE, rc=\E8, rev=\E[7m, ri=\EM, -+ rin=\E[%p1%dT, rmacs=^O, rmcup=\E%!0\ELBH=\E%!1, -+ rmir=\E[4l, rmkx=\E[?1l\E>, rmso=\E[m, rmul=\E[m, -+ rs1=\030\E%!0\EKC\E\014\EKR0\EKF0\ENM0\ELBH=\ETF8000010F40\ELI100\ELLB0\ELM0\EKE0\ENF1\EKS0\END0\ERE0\E%!1\Ec\E[?3;5l\E[?7;8h\E[r\E[m\E>, -+ sc=\E7, sgr0=\E[m, smacs=^N, smcup=\E[?6l, smir=\E[4h, -+ smkx=\E[?1h\E=, smso=\E[7;42m, smul=\E[4m, tbc=\E[3g, -+ -+# Tektronix 4107/4109 interpret 4 modes using "\E%!" followed by a code: -+# 0 selects Tek mode, i.e., \E%!0 -+# 1 selects ANSI mode -+# 2 selects ANSI edit-mode -+# 3 selects VT52 mode - # --# Apparently the terminal emulator does support a VT-100-style --# alternate character set, but all the alternate character set --# positions have been left blank in the font. For this reason, no --# alternate character set capabilities have been included in this --# description. The console driver appears to be ASCII-only, so (enacs) --# has been excluded [although the VT-100 sequence does work.] -+# One odd thing about the description (which has been unchanged since the 90s) -+# is that the cursor addressing is using VT52 mode, and a few others use the -+# VT52's non-CSI versions of ANSI, e.g., \EJ. -+tek4107|tek4109|tektronix terminals 4107 4109, -+ OTbs, am, mir, msgr, ul, xenl, xt, -+ cols#79, it#8, lines#29, -+ bel=^G, blink=\E%!1\E[5m$<2>\E%!0, -+ bold=\E%!1\E[1m$<2>\E%!0, clear=\ELZ, cnorm=\E%!0, cr=^M, -+ cub1=^H, cud1=^J, cuf1=\EC, -+ cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, cvvis=\E%!3, -+ dim=\E%!1\E[<0m$<2>\E%!0, ed=\EJ, el=\EK, ht=^I, ind=^J, -+ kbs=^H, kcub1=\ED, kcud1=\EB, kcuf1=\EC, kcuu1=\EA, -+ rev=\E%!1\E[7m$<2>\E%!0, ri=\EI, -+ rmso=\E%!1\E[m$<2>\E%!0, rmul=\E%!1\E[m$<2>\E%!0, -+ sgr=\E%%!1\E[%?%p1%t;7;5%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p5%t<0%;%?%p6%t;1%;m$<2>\E%%!0, -+ sgr0=\E%!1\E[m$<2>\E%!0, smso=\E%!1\E[7;5m$<2>\E%!0, -+ smul=\E%!1\E[4m$<2>\E%!0, -+# Tektronix 4207 with sysline. In the ancestral termcap file this was 4107-s; -+# see the note attached to tek4207. -+tek4207-s|Tektronix 4207 with sysline but no memory, -+ eslok, hs, -+ dsl=\E7\E[?6l\E[2K\E[?6h\E8, fsl=\E[?6h\E8, -+ is1=\E%!1\E[2;32r\E[132D\E[2g\EH\E[8C\EH\E[8C\EH\E[8C\EH\E[8C\EH\E[8C\EH\E[8C\EH\E[8C\EH\E[8C\EH\E[8C\EH\E[J, -+ is2=\E7\E[?6l\E[2K\E[?6h\E8, -+ tsl=\E7\E[?6l\E[2K\E[;%i%df, use=tek4107, -+ -+# The 4110 series may be a wonderful graphics series, but they make the 4025 -+# look good for screen editing. In the dialog area, you can't move the cursor -+# off the bottom line. Out of the dialog area, ^K moves it up, but there -+# is no way to scroll. - # --# The default Mac OS X and Darwin installation reports "vt100" as the --# terminal type, and exports no helpful environment variables. To fix --# this, change the "console" entry in /etc/ttys from "vt100" to --# "xnuppc-WxH", where W and H are the character dimensions of your --# console (see below.) -+# Note that there is a floppy for free from Tek that makes the -+# 4112 emulate the vt52 (use the vt52 termcap). There is also -+# an expected enhancement that will use ANSI standard sequences. - # --# The font used by the terminal emulator is apparently one originally --# drawn by Ka-Ping Yee, and uses 8x16-pixel characters. This --# file includes descriptions for the following geometries: -+# 4112 in non-dialog area pretending to scroll. It really wraps -+# but vi is said to work (more or less) in this mode. - # --# Pixels Characters Entry Name (append -m for monochrome) --# ------------------------------------------------------------------- --# 640x400 80x25 xnuppc-80x25 --# 640x480 80x30 xnuppc-80x30 --# 720x480 90x30 xnuppc-90x30 --# 800x600 100x37 xnuppc-100x37 --# 896x600 112x37 xnuppc-112x37 --# 1024x640 128x40 xnuppc-128x40 --# 1024x768 128x48 xnuppc-128x48 --# 1152x768 144x48 xnuppc-144x48 --# 1280x1024 160x64 xnuppc-160x64 --# 1600x1024 200x64 xnuppc-200x64 --# 1600x1200 200x75 xnuppc-200x75 --# 2048x1536 256x96 xnuppc-256x96 -+# 'vi' works reasonably well with this entry. - # --# The basic "xnuppc" entry includes no size information, and the --# emulator includes no reporting capability, so you'll be at the mercy --# of the TTY device (which reports incorrectly on my hardware.) The --# color-bold entries do not include size information. -- --# The '+' entries are building blocks --xnuppc+basic|Darwin PowerPC Console basic capabilities, -- am, bce, mir, xenl, -- it#8, -- bold=\E[1m, clear=\E[H\E[J, cr=^M, csr=\E[%i%p1%d;%p2%dr, -- cub=\E[%p1%dD, cub1=\E[D, cud=\E[%p1%dB, cud1=\E[B, -+otek4112|o4112-nd|otek4113|otek4114|old tektronix 4110 series, -+ am, -+ cols#80, lines#34, -+ bel=^G, clear=\E^L, cr=^M, cub1=^H, cud1=^J, cuu1=^K, ind=^J, -+ rmcup=\EKA1\ELV1, smcup=\EKA0\ELV0\EMG0, -+# The 4112 with the ANSI compatibility enhancement -+tek4112|tek4114|tektronix 4110 series, -+ OTbs, am, db, -+ cols#80, lines#34, -+ cbt=\E[Z, clear=\E[2J\E[0;0H, cub1=^H, cud1=\E[B, -+ cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu1=\EM, dch1=\E[P, -+ dl1=\E[M, ed=\E[0J, el=\E[0K, ich1=\E[@, il1=\E[L, -+ ind=\E7\E[0;0H\E[M\E8, is2=\E3!1, ri=\E7\E[0;0H\E[L\E8, -+ rmso=\E[m, rmul=\E[m, sgr0=\E[m, smso=\E[7m, smul=\E[4m, -+tek4112-nd|4112 not in dialog area, -+ OTns, -+ cuu1=^K, use=tek4112, -+tek4112-5|4112 in 5 line dialog area, -+ lines#5, use=tek4112, -+# (tek4113: this used to have "<cuf1=\LM1\s\LM0>", someone's mistake; -+# removed "<smacs=\E^N>, <rmacs=\E^O>", which had been commented out in 8.3. -+# Note, the !0 and !1 sequences in <rmcup>/<smcup>/<cnorm>/<civis> were -+# previously \0410 and \0411 sequences...I don't *think* they were supposed -+# to be 4-digit octal -- esr) -+tek4113|tektronix 4113 color graphics with 5 line dialog area, -+ OTbs, am, da, eo, -+ cols#80, lines#5, -+ clear=\ELZ, cub1=^H, cud1=^J, cuf1=\ELM1 \ELM0, -+ flash=\ERBA4\ERBA4\ERBA4\ERBA4\ERBA4\ERBA4\ERBA4\ERBA4\ERBA4\ERBA4\ERB0, -+ is2=\EKA1\ELL5\ELV0\ELV1, uc=\010\ELM1_\ELM0, -+tek4113-34|tektronix 4113 color graphics with 34 line dialog area, -+ lines#34, -+ is2=\EKA1\ELLB2\ELV0\ELV1, use=tek4113, -+# :ns: left off to allow vi visual mode. APL font (:as=\E^N:/:ae=\E^O:) not -+# supported here. :uc: is slow, but looks nice. Suggest setenv MORE -up . -+# :vb: needs enough delay to let you see the background color being toggled. -+tek4113-nd|tektronix 4113 color graphics with no dialog area, -+ OTbs, am, eo, -+ cols#80, it#8, lines#34, -+ clear=\E^L, cub1=^H, cud1=^J, cuf1=^I, cuu1=^K, -+ cvvis=\ELZ\EKA0, -+ flash=\ERBA4\ERBA4\ERBA4\ERBA4\ERBA4\ERBA4\ERBA4\ERBA4\ERBA4\ERBA4\ERB0, -+ home=\ELF7l\177 @, ht=^I, is2=\ELZ\EKA0\ELF7l\177 @, -+ ll=\ELF hl @, rmso=\EMT1, smso=\EMT2, uc=\010\EMG1_\EMG0, -+# This entry is from Tek. Inc. (Brian Biehl) -+# (tek4115: :bc: renamed to :le:, <rmam>/<smam> added based on init string -- esr) -+otek4115|Tektronix 4115, -+ OTbs, am, da, db, eo, -+ cols#80, it#8, lines#34, -+ cbt=\E[Z, clear=\E[H\E[2J, -+ cnorm=\E%!0\ELBG8\E%!1\E[34;1H, cub1=\E[D, cud1=\E[B, -+ cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, -+ cvvis=\E%!0\ELBB2\E%!1, dch1=\E[P, dl1=\E[M, ed=\E[J, -+ el=\E[K, home=\E[H, ht=^I, if=/usr/share/tabset/vt100, -+ il1=\E[L, -+ is2=\E%!0\E%\014\ELV0\EKA1\ELBB2\ENU@=\ELLB2\ELM0\ELV1\EKYA?\E%!1\E[<1l\E[?7h\E[?8h\E[34;1H\E[34B\E[m, -+ kbs=^H, ri=\EM, rmam=\E[?7l, -+ rmcup=\E%!0\ELBG8\E%!1\E[34;1H\E[J, rmir=\E[4l, -+ rmkx=\E>, rmso=\E[m, rmul=\E[m, sgr0=\E[m, smam=\E[?7h, -+ smcup=\E%!0\ELBB2\E%!1, smir=\E[4h, smkx=\E=, smso=\E[7m, -+ smul=\E[4m, -+tek4115|newer tektronix 4115 entry with more ANSI capabilities, -+ am, xon, -+ cols#80, lines#34, -+ bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, clear=\E[H\E[J, -+ cr=^M, cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=^J, - cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, -- cuu=\E[%p1%dA, cuu1=\E[A, dsl=\E]2;\007, ed=\E[J, el=\E[K, -- el1=\E[1K, home=\E[H, ht=^I, hts=\EH, ind=^J, kbs=\177, -- kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, rc=\E8, -- rev=\E[7m, ri=\EM, rmam=\E[?7l, rmkx=\E[?1l\E>, rmso=\E[m, -- rmul=\E[m, rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, -- sc=\E7, -- sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;m, -- sgr0=\E[m, smam=\E[?7h, smkx=\E[?1h\E=, smso=\E[7m, -- smul=\E[4m, tbc=\E[3g, use=vt100+keypad, -- --xnuppc+c|Darwin PowerPC Console ANSI color support, -- colors#8, ncv#32, pairs#64, -- op=\E[37;40m, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, -- --xnuppc+b|Darwin PowerPC Console color-bold support, -- ncv#32, -- bold=\E[35m, -- sgr=\E[0%?%p6%t;35%;%?%p2%t;4%;%?%p1%p3%|%t;7%;m, -- use=xnuppc+basic, -- --xnuppc+f|Darwin PowerPC Console fancy color support, -- ncv#35, -- sgr=\E[0%?%p6%t;35%;%?%p2%t;36;4%;%?%p1%t;33;44%;%?%p3%t;7%;m, -- smso=\E[33;44m, smul=\E[36;4m, use=xnuppc+b, -- --xnuppc+f2|Darwin PowerPC Console alternate fancy color support, -- ncv#35, -- bold=\E[33m, -- sgr=\E[0%?%p6%t;33%;%?%p2%t;34%;%?%p1%t;31;47%;%?%p3%t;7%;m, -- smso=\E[31;47m, smul=\E[34m, use=xnuppc+basic, -- --# Building blocks for specific screen sizes --xnuppc+80x25|Darwin PowerPC Console 80x25 support (640x400 pixels), -- cols#80, lines#25, -- --xnuppc+80x30|Darwin PowerPC Console 80x30 support (640x480 pixels), -- cols#80, lines#30, -- --xnuppc+90x30|Darwin PowerPC Console 90x30 support (720x480 pixels), -- cols#90, lines#30, -- --xnuppc+100x37|Darwin PowerPC Console 100x37 support (800x600 pixels), -- cols#100, lines#37, -- --xnuppc+112x37|Darwin PowerPC Console 112x37 support (896x600 pixels), -- cols#112, lines#37, -- --xnuppc+128x40|Darwin PowerPC Console 128x40 support (1024x640 pixels), -- cols#128, lines#40, -- --xnuppc+128x48|Darwin PowerPC Console 128x48 support (1024x768 pixels), -- cols#128, lines#48, -- --xnuppc+144x48|Darwin PowerPC Console 144x48 support (1152x768 pixels), -- cols#144, lines#48, -- --xnuppc+160x64|Darwin PowerPC Console 160x64 support (1280x1024 pixels), -- cols#160, lines#64, -- --xnuppc+200x64|Darwin PowerPC Console 200x64 support (1600x1024 pixels), -- cols#200, lines#64, -- --xnuppc+200x75|Darwin PowerPC Console 200x75 support (1600x1200 pixels), -- cols#200, lines#75, -- --xnuppc+256x96|Darwin PowerPC Console 256x96 support (2048x1536 pixels), -- cols#256, lines#96, -- --# These are different combinations of the building blocks -- --xnuppc-m|darwin-m|Darwin PowerPC Console (monochrome), -- use=xnuppc+basic, -- --xnuppc|darwin|Darwin PowerPC Console (color), -- use=xnuppc+c, use=xnuppc+basic, -- --xnuppc-m-b|darwin-m-b|Darwin PowerPC Console (monochrome w/color-bold), -- use=xnuppc+b, -- --xnuppc-b|darwin-b|Darwin PowerPC Console (color w/color-bold), -- use=xnuppc+b, use=xnuppc+c, -- --xnuppc-m-f|darwin-m-f|Darwin PowerPC Console (fancy monochrome), -- use=xnuppc+f, -- --xnuppc-f|darwin-f|Darwin PowerPC Console (fancy color), -- use=xnuppc+f, use=xnuppc+c, -- --xnuppc-m-f2|darwin-m-f2|Darwin PowerPC Console (alternate fancy monochrome), -- use=xnuppc+f2, -- --xnuppc-f2|darwin-f2|Darwin PowerPC Console (alternate fancy color), -- use=xnuppc+f2, use=xnuppc+c, -- --# Combinations for specific screen sizes --xnuppc-80x25-m|darwin-80x25-m|Darwin PowerPC Console (monochrome) 80x25, -- use=xnuppc+80x25, use=xnuppc+basic, -- --xnuppc-80x25|darwin-80x25|Darwin PowerPC Console (color) 80x25, -- use=xnuppc+c, use=xnuppc+80x25, use=xnuppc+basic, -- --xnuppc-80x30-m|darwin-80x30-m|Darwin PowerPC Console (monochrome) 80x30, -- use=xnuppc+80x30, use=xnuppc+basic, -- --xnuppc-80x30|darwin-80x30|Darwin PowerPC Console (color) 80x30, -- use=xnuppc+c, use=xnuppc+80x30, use=xnuppc+basic, -+ cuu=\E[%p1%dA, cuu1=\E[A, dch1=\E[P, dl=\E[%p1%dM, -+ dl1=\E[M, ed=\E[J, el=\E[K, home=\E[H, hpa=\E[%p1%{1}%+%dG, -+ ht=^I, hts=\EH, ich=\E[%p1%d@, ich1=\E[@, il=\E[%p1%dL, -+ il1=\E[L, ind=^J, invis=\E[8m, kbs=^H, kcub1=\E[D, -+ kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, khome=\E[H, -+ rep=%p1%c\E[%p2%{1}%-%db, rev=\E[7m, rmam=\E[?7l, -+ rmso=\E[m, rmul=\E[m, -+ sgr=\E[%?%p1%t7;%;%?%p2%t4;%;%?%p3%t7;%;%?%p4%t5;%;%?%p6%t1;%;%?%p7%t8;%;m, -+ sgr0=\E[m, smam=\E[?7h, smso=\E[7m, smul=\E[4m, tbc=\E[3g, -+ vpa=\E[%p1%{1}%+%dd, -+# The tek4125 emulates a vt100 incorrectly - the scrolling region -+# command is ignored. The following entry replaces <csr> with the needed -+# <il>, <il>, and <smir>; removes some cursor pad commands that the tek4125 -+# chokes on; and adds a lot of initialization for the tek dialog area. -+# Note that this entry uses all 34 lines and sets the cursor color to green. -+# Steve Jacobson 8/85 -+# (tek4125: there were two "\!"s in the is that I replaced with "\E!"; -+# commented out, <smir>=\E1 because there's no <rmir> -- esr) -+tek4125|tektronix 4125, -+ lines#34, -+ csr@, dl1=\E[1M, il1=\E[1L, -+ is2=\E%\E!0\EQD1\EUX03\EKA\ELBB2\ELCE0\ELI100\ELJ2\ELLB2\ELM0\ELS1\ELX00\ELV1\E%\E!1\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, -+ rc@, sc@, smkx=\E=, use=vt100, - --xnuppc-90x30-m|darwin-90x30-m|Darwin PowerPC Console (monochrome) 90x30, -- use=xnuppc+90x30, use=xnuppc+basic, -+# From: <jcoker@ucbic> -+# (tek4207: This was the termcap file's entry for the 4107/4207, but SCO -+# supplied another, less capable 4107 entry. So we'll use that for 4107 and -+# note that if jcoker wasn't confused you may be able to use this one. -+# I merged in <msgr>,<ind>,<ri>,<invis>,<tbc> from a BRL entry -- esr) -+tek4207|Tektronix 4207 graphics terminal with memory, -+ am, bw, mir, msgr, ul, xenl, -+ cols#80, it#8, lines#32, -+ blink=\E[5m, bold=\E[1m, cbt=\E[Z, clear=\E[H\E[J$<156/>, -+ cub1=^H, cud1=^J, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, -+ cuu1=\EM, dch1=\E[P$<4/>, dl1=\E[M$<3/>, ed=\E[J, -+ el=\E[K$<5/>, home=\E[H, ht=^I, ich1=\E[@$<4/>, -+ il1=\E[L$<3/>, ind=\E[S, invis=\E[=6;<5, -+ is2=\E%!0\ELBP0\E%!1\E[H\E[2g\EH\E[8C\EH\E[8C\EH\E[8C\EH\E[8C\EH\E[8C\EH\E[8C\EH\E[8C\EH\E[8C\EH\E[8C\EH\E[J, -+ kcub1=\E[D, kcud1=\ED, kcuf1=\E[C, kcuu1=\EM, khome=\E[H, -+ rev=\E[7m, ri=\E[T, -+ rmcup=\E[?6h\E%!0\ELBP0\E%!1\E[32;1f, rmso=\E[m, -+ rmul=\E[m, sgr0=\E[m, smcup=\E[?6l\E[H\E[J, smso=\E[7m, -+ smul=\E[4m, tbc=\E[1g, - --xnuppc-90x30|darwin-90x30|Darwin PowerPC Console (color) 90x30, -- use=xnuppc+c, use=xnuppc+90x30, use=xnuppc+basic, -+# From: <carolyn@dali.berkeley.edu> Thu Oct 31 12:54:27 1985 -+# (tek4404: There was a "\!" in <smcup> that I replaced with "\E!". -+# Tab had been given as \E2I,that must be the tab-set capability -- esr) -+tek4404|tektronix 4404, -+ OTbs, -+ cols#80, it#8, lines#32, -+ blink=\E[5m, bold=\E[1m, clear=\E[H\E[2J, -+ csr=\E[%i%p1%d;%p2%dr, cub1=^H, cud1=^J, cuf1=\E[C, -+ cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, dch1=\E[P, dl1=\E[1M, -+ ed=\E[J, el=\E[K, home=\E[H, ht=^I, hts=\E[2I, il1=\E[1L, -+ kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, rc=\E8, -+ rmcup=\E[1;1H\E[0J\E[?6h\E[?1l, rmir=\E[4l, -+ rmkx=\E[?1h, rmso=\E[27m, rmul=\E[m, sc=\E7, sgr0=\E[m, -+ smcup=\E%\E!1\E[1;32r\E[?6l\E>, smir=\E[4h, -+ smkx=\E[?1l, smso=\E[7m, smul=\E[4m, -+# Some unknown person wrote: -+# I added the is string - straight Unix has ESC ; in the login -+# string which sets a ct8500 into monitor mode (aka 4025 snoopy -+# mode). The is string here cleans up a few things (but not -+# everything). -+ct8500|tektronix ct8500, -+ am, bw, da, db, -+ cols#80, lines#25, -+ bel=^G, cbt=\E^I, clear=\E^E, cr=^M, cub1=^H, cud1=^J, -+ cuf1=\ES, cup=\E|%p1%{32}%+%c%p2%{32}%+%c, cuu1=\ER, -+ dch1=\E^], dl1=\E^M, ed=\E^U, el=\E^T, ht=^I, ich1=\E^\, -+ il1=\E^L, ind=^J, is2=\037\EZ\Ek, ri=\E^A, rmso=\E\s, -+ rmul=\E\s, sgr0=\E\s, smso=\E$, smul=\E!, - --xnuppc-100x37-m|darwin-100x37-m|Darwin PowerPC Console (monochrome) 100x37, -- use=xnuppc+100x37, use=xnuppc+basic, -+# Tektronix 4205 terminal. -+# -+# am is not defined because the wrap around occurs not when the char. -+# is placed in the 80'th column, but when we are attempting to type -+# the 81'st character on the line. (esr: hmm, this is like the vt100 -+# version of xenl, perhaps am + xenl would work!) -+# -+# Bold, dim, and standout are simulated by colors and thus not allowed -+# with colors. The tektronix color table is mapped into the RGB color -+# table by setf/setb. All colors are reset to factory specifications by oc. -+# The <initc> cap uses RGB notation to define colors. for arguments 1-3 the -+# interval (0-1000) is broken into 8 smaller sub-intervals (125). Each sub- -+# interval then maps into pre-defined value. -+tek4205|tektronix 4205, -+ ccc, mir, msgr, -+ colors#8, cols#80, it#8, lines#30, ncv#49, pairs#63, -+ acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, -+ bel=^G, blink=\E[5m, bold=\E[=7;<4m, cbt=\E[Z, -+ clear=\E[2J\E[H, cr=^M, cub=\E[%p1%dD, cub1=\E[D, -+ cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, cuf1=\E[C, -+ cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, -+ dch1=\E[1P, dim=\E[=1;<6m, dl=\E[%p1%dM, dl1=\E[1M, -+ ech=\E%p1%dX, ed=\E[J, el=\E[K, el1=\E[1K, enacs=\E)0, -+ home=\E[H, ht=^I, ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[1L, -+ ind=\ED, -+ initc=\E%%!0\ETF4%?%p1%{0}%=%t0%e%p1%{1}%=%t4%e%p1%{2}%=%t3%e%p1%{3}%=%t5%e%p1%{4}%=%t2%e%p1%{5}%=%t6%e%p1%{6}%=%t7%e1%;%?%p2%{125}%<%t0%e%p2%{250}%<%tA2%e%p2%{375}%<%tA?%e%p2%{500}%<%tC8%e%p2%{625}%<%tD4%e%p2%{750}%<%tE1%e%p2%{875}%<%tE\:%eF4%;%?%p3%{125}%<%t0%e%p3%{250}%<%tA2%e%p3%{375}%<%tA?%e%p3%{500}%<%tC8%e%p3%{625}%<%tD4%e%p3%{750}%<%tE1%e%p3%{875}%<%tE\:%eF4%;%?%p4%{125}%<%t0%e%p4%{250}%<%tA2%e%p4%{375}%<%tA?%e%p4%{500}%<%tC8%e%p4%{625}%<%tD4%e%p4%{750}%<%tE1%e%p4%{875}%<%tE\:%eF4%;\E%%!1, -+ invis=\E[=6;<5, is1=\E%!0\ETM1\E%!1\E[m, kbs=^H, -+ kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kf0=\EOA, -+ kf1=\EOB, kf2=\EOC, kf3=\EOD, kf4=\EP, kf5=\EQ, kf6=\ER, -+ kf7=\ES, -+ oc=\E%!0\ETFB000001F4F4F42F40030F404A4C<F450F4F46F40F47F4F40\E%!1, -+ op=\E[39;40m, rev=\E[7m, ri=\EM, rmacs=^O, rmcup=, -+ rmir=\E[4l, rmso=\E[=0;<1m, rmul=\E[24m, -+ setb=\E[=%?%p1%{0}%=%t0m%e%p1%{1}%=%t4m%e%p1%{2}%=%t3m%e%p1%{3}%=%t5m%e%p1%{4}%=%t2m%e%p1%{5}%=%t6m%e%p1%{6}%=%t7m%e1m%;, -+ setf=\E[<%?%p1%{0}%=%t0m%e%p1%{1}%=%t4m%e%p1%{2}%=%t3m%e%p1%{3}%=%t5m%e%p1%{4}%=%t2m%e%p1%{5}%=%t6m%e%p1%{6}%=%t7m%e1m%;, -+ sgr0=\E[=0;<1m\E[24;25;27m\017, smacs=^N, -+ smcup=\E%%!1\E[?6l\E[2J, smir=\E[4h, smso=\E[=2;<3m, -+ smul=\E[4m, tbc=\E[1g, - --xnuppc-100x37|darwin-100x37|Darwin PowerPC Console (color) 100x37, -- use=xnuppc+c, use=xnuppc+100x37, use=xnuppc+basic, -+#### Teletype (tty) -+# -+# These are the hardcopy Teletypes from before AT&T bought the company, -+# clattering electromechanical dinosaurs in Bakelite cases that printed on -+# pulpy yellow roll paper. If you remember these you go back a ways. -+# Teletype-branded VDTs are listed in the AT&T section. -+# -+# The earliest UNIXes were designed to use these clunkers; nroff and a few -+# other programs still default to emitting codes for the Model 37. -+# - --xnuppc-112x37-m|darwin-112x37-m|Darwin PowerPC Console (monochrome) 112x37, -- use=xnuppc+112x37, use=xnuppc+basic, -+tty33|tty35|model 33 or 35 teletype, -+ hc, os, xon, -+ cols#72, -+ bel=^G, cr=^M, cud1=^J, ind=^J, -+tty37|model 37 teletype, -+ OTbs, hc, os, xon, -+ bel=^G, cr=^M, cub1=^H, cud1=^J, cuu1=\E7, hd=\E9, hu=\E8, -+ ind=^J, - --xnuppc-112x37|darwin-112x37|Darwin PowerPC Console (color) 112x37, -- use=xnuppc+c, use=xnuppc+112x37, use=xnuppc+basic, -+# There are known to be at least three flavors of the tty40, all seem more -+# like IBM half duplex forms fillers than ASCII terminals. They have lots of -+# awful braindamage, such as printing a visible newline indicator after each -+# newline. The 40-1 is a half duplex terminal and is hopeless. The 40-2 is -+# braindamaged but has hope and is described here. The 40-4 is a 3270 -+# lookalike and beyond hope. The terminal has visible bell but I don't know -+# it - it's null here to prevent it from showing the BL character. -+# There is an \EG in <nl> because of a bug in old vi (if stty says you have -+# a "newline" style terminal (-crmode) vi figures all it needs is nl -+# to get crlf, even if <cr> is not ^M.) -+# (tty40: removed obsolete ":nl=\EG\EB:", it's just do+cr -- esr) -+tty40|ds40|ds40-2|dataspeed40|teletype dataspeed 40/2, -+ OTbs, xon, -+ cols#80, lines#24, -+ clear=\EH$<20>\EJ$<80>, cr=\EG, cub1=^H, cud1=\EB, -+ cuf1=\EC, cuu1=\E7, dch1=\EP$<50>, dl1=\EM$<50>, -+ ed=\EJ$<75>, home=\EH$<10>, ht=\E@$<10>, hts=\E1, -+ ich1=\E\^$<50>, il1=\EL$<50>, ind=\ES$<20>, kbs=^], -+ kcub1=^H, mc4=^T, mc5=\022$<2000>, ri=\ET$<10>, rmso=\E4, -+ rs2=\023\ER$<60>, smso=\E3, tbc=\EH\E2$<80>, -+tty43|model 43 teletype, -+ OTbs, am, hc, os, xon, -+ cols#132, -+ bel=^G, cr=^M, cub1=^H, cud1=^J, ind=^J, kbs=^H, - --xnuppc-128x40-m|darwin-128x40-m|Darwin PowerPC Console (monochrome) 128x40, -- use=xnuppc+128x40, use=xnuppc+basic, -+#### Tymshare -+# - --xnuppc-128x40|darwin-128x40|Darwin PowerPC Console (color) 128x40, -- use=xnuppc+c, use=xnuppc+128x40, use=xnuppc+basic, -+# You can add <is2=\E<> to put this 40-column mode, though I can't -+# for the life of me think why anyone would want to. -+scanset|sc410|sc415|Tymshare Scan Set, -+ am, bw, msgr, -+ cols#80, lines#24, -+ acsc=j%k4l<m-q\,x5, bel=^G, clear=\EH\EJ, cr=^M, cub1=^H, -+ cud1=^J, cuf1=^I, cup=\EY%p1%{32}%+%c%p2%{32}%+%c, -+ cuu1=^K, ed=\EJ, el=\EK, home=\EH, ind=^J, kcub1=\ED, -+ kcud1=\EB, kcuf1=\EC, kcuu1=\EA, mc0=\E;3, mc4=\E;0, -+ mc5=\E;0, rc=^C, rmacs=^O, rs1=\E>, sc=^B, smacs=^N, - --xnuppc-128x48-m|darwin-128x48-m|Darwin PowerPC Console (monochrome) 128x48, -- use=xnuppc+128x48, use=xnuppc+basic, -+#### Volker-Craig (vc) -+# -+# If you saw a Byte Magazine cover with a terminal on it during the early -+# 1980s, it was probably one of these. Carl Helmers liked them because -+# they could crank 19.2 and were cheap (that is, he liked them until he tried -+# to program one...) -+# - --xnuppc-128x48|darwin-128x48|Darwin PowerPC Console (color) 128x48, -- use=xnuppc+c, use=xnuppc+128x48, use=xnuppc+basic, -+# Missing in vc303a and vc303 descriptions: they scroll 2 lines at a time -+# every other linefeed. -+vc303|vc103|vc203|volker-craig 303, -+ OTbs, OTns, am, -+ cols#80, lines#24, -+ bel=^G, clear=\014$<40>, cr=^M, cub1=^H, cud1=^J, cuf1=^I, -+ cuu1=^N, home=\013$<40>, kcub1=^H, kcud1=^J, kcuf1=^I, -+ kcuu1=^N, ll=\017$<1>W, -+vc303a|vc403a|volker-craig 303a, -+ clear=\030$<40>, cuf1=^U, cuu1=^Z, el=\026$<20>, -+ home=\031$<40>, kcuf1=^U, kcuu1=^Z, ll=^P, use=vc303, -+# (vc404: removed obsolete ":ma=^Z^P^U :" -- esr) -+vc404|volker-craig 404, -+ OTbs, am, -+ cols#80, lines#24, -+ bel=^G, clear=\030$<40>, cr=^M, cub1=^H, cud1=^J, cuf1=^U, -+ cup=\020%p1%{32}%+%c%p2%{32}%+%c, cuu1=^Z, -+ ed=\027$<40>, el=\026$<20>, home=\031$<40>, ind=^J, -+ kcub1=^H, kcud1=^J, kcuf1=^U, kcuu1=^Z, -+vc404-s|volker-craig 404 w/standout mode, -+ cud1=^J, rmso=^O, smso=^N, use=vc404, -+# From: <wolfgang@cs.sfu.ca> -+# (vc414: merged in cup/dl1/home from an old vc414h-noxon) -+vc414|vc414h|Volker-Craig 414H in sane escape mode., -+ OTbs, am, -+ cols#80, lines#24, -+ clear=\E\034$<40>, cud1=\E^K, cuf1=^P, -+ cup=\E\021%p2%c%p1%c$<40>, cuu1=\E^L, dch1=\E3, -+ dl1=\E\023$<40>, ed=\E^X, el=\E\017$<10/>, home=\E^R, -+ ich1=\E\:, il1=\E\032$<40>, kcub1=^H, kcud1=\E^K, kcuf1=^P, -+ kcuu1=\E^L, kf0=\EA, kf1=\EB, kf2=\EC, kf3=\ED, kf4=\EE, -+ kf5=\EF, kf6=\EG, kf7=\EH, khome=\E^R, lf0=PF1, lf1=PF2, -+ lf2=PF3, lf3=PF4, lf4=PF5, lf5=PF6, lf6=PF7, lf7=PF8, -+ rmso=\E^_, smso=\E^Y, -+vc415|volker-craig 415, -+ clear=^L, use=vc404, - --xnuppc-144x48-m|darwin-144x48-m|Darwin PowerPC Console (monochrome) 144x48, -- use=xnuppc+144x48, use=xnuppc+basic, -+######## OBSOLETE PERSONAL-MICRO CONSOLES AND EMULATIONS -+# - --xnuppc-144x48|darwin-144x48|Darwin PowerPC Console (color) 144x48, -- use=xnuppc+c, use=xnuppc+144x48, use=xnuppc+basic, -+#### IBM PC and clones -+# - --xnuppc-160x64-m|darwin-160x64-m|Darwin PowerPC Console (monochrome) 160x64, -- use=xnuppc+160x64, use=xnuppc+basic, -+# The pcplot IBM-PC terminal emulation program is really messed up. It is -+# supposed to emulate a vt-100, but emulates the wraparound bug incorrectly, -+# doesn't support scrolling regions, ignores add line commands, and ignores -+# delete line commands. Consequently, the resulting behavior looks like a -+# crude adm3a-type terminal. -+# Steve Jacobson 8/85 -+pcplot|pc-plot terminal emulation program, -+ xenl@, -+ csr@, dl@, dl1@, il@, il1@, rc@, sc@, use=vt100, -+# KayPro II from Richard G Turner <rturner at Darcom-Hq.ARPA> -+# I've found that my KayPro II, running MDM730, continues to emulate an -+# ADM-3A terminal, just like I was running TERM.COM. On our 4.2 UNIX -+# system the following termcap entry works well: -+# I have noticed a couple of minor glitches, but nothing I can't work -+# around. (I added two capabilities from the BRL entry -- esr) -+kaypro|kaypro2|kaypro II, -+ OTbs, am, -+ cols#80, lines#24, -+ bel=^G, clear=\032$<1/>, cr=^M, cud1=^J, cuf1=^L, -+ cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dl1=\ER, ed=^W, -+ el=^X, home=^^, il1=\EE, ind=^J, kcud1=^J, kcuf1=^L, kcuu1=^K, - --xnuppc-160x64|darwin-160x64|Darwin PowerPC Console (color) 160x64, -- use=xnuppc+c, use=xnuppc+160x64, use=xnuppc+basic, -+# From IBM, Thu May 5 19:35:27 1983 -+# (ibmpc: commented out <smir>=\200R because we don't know <rmir> -- esr) -+ibm-pc|ibm5051|5051|IBM Personal Computer (no ANSI.SYS), -+ OTbs, am, -+ cols#80, lines#24, -+ bel=^G, clear=^L^K, cr=^M^^, cub1=^], cud1=^J, cuf1=^\, -+ cuu1=^^, home=^K, ind=\n$<10>, kcud1=^_, - --xnuppc-200x64-m|darwin-200x64-m|Darwin PowerPC Console (monochrome) 200x64, -- use=xnuppc+200x64, use=xnuppc+basic, -+ibmpc|wy60-PC|wyse60-PC|IBM PC/XT running PC/IX, -+ OTbs, am, bw, eo, hs, km, msgr, ul, -+ cols#80, it#8, lines#24, -+ acsc=j\331k\277l\332m\300n\305q\304t\303u\264v\301w\302x\263, -+ bel=^G, blink=\E[5m, bold=\E[1m, clear=\Ec, cr=^M, -+ cub=\E[%p1%dD, cub1=\E[D, cud=\E[%p1%dB, cud1=\E[B, -+ cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, -+ cuu=\E[%p1%dA, cuu1=\E[A, ech=\E[%p1%dX, ed=\E[J, el=\E[K, -+ home=\E[H, hpa=\E[%i%p1%dG, ind=\E[S\E[B, -+ indn=\E[%p1%dS\E[%p1%dB, invis=\E[30;40m, kbs=^H, -+ kcbt=^], kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, -+ kdch1=\177, kend=\E[Y, kf1=\240, kf10=\251, kf2=\241, -+ kf3=\242, kf4=\243, kf5=\244, kf6=\245, kf7=\246, kf8=\247, -+ kf9=\250, khome=\E[H, kich1=\E[^H, knp=\E[U, kpp=\E[V, -+ ll=\E[24;1H, nel=^M, rev=\E[7m, ri=\E[T\E[A, -+ rin=\E[%p1%dT\E[%p1%dA, rmso=\E[m, rmul=\E[m, -+ sgr=\E[%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;%?%p7%t30;40%;m, -+ sgr0=\E[m, smso=\E[7m, smul=\E[4m, - --xnuppc-200x64|darwin-200x64|Darwin PowerPC Console (color) 200x64, -- use=xnuppc+c, use=xnuppc+200x64, use=xnuppc+basic, -+#### Apple II -+# -+# Apple II firmware console first, then various 80-column cards and -+# terminal emulators. For two cents I'd toss all these in the UFO file -+# along with the 40-column apple entries. -+# - --xnuppc-200x75-m|darwin-200x75-m|Darwin PowerPC Console (monochrome) 200x75, -- use=xnuppc+200x75, use=xnuppc+basic, -+# From: brsmith@umn-cs.cs.umn.edu (Brian R. Smith) via BRL -+# 'it#8' tells UNIX that you have tabs every 8 columns. This is a -+# function of TIC, not the firmware. -+# The clear key on a IIgs will do something like clear-screen, -+# depending on what you're in. -+appleIIgs|appleIIe|appleIIc|Apple 80 column firmware interface, -+ OTbs, am, bw, eo, msgr, -+ cols#80, it#8, lines#24, -+ bel=^G, clear=^L, cr=^M, cub1=^H, cud1=^J, cuf1=^\, -+ cup=\036%p2%{32}%+%c%p1%{32}%+%c, cuu1=^_, ed=^K, el=^], -+ home=^Y, ht=^I, ind=^W, kbs=^H, kclr=^X, kcub1=^H, kcud1=^J, -+ kcuf1=^U, kcuu1=^K, kdch1=\177, nel=^M^W, ri=^V, rmso=^N, -+ smso=^O, -+# Apple //e with 80-column card, entry from BRL -+# The modem interface is permitted to discard LF (maybe DC1), otherwise -+# passing characters to the 80-column firmware via COUT (PR#3 assumed). -+# Auto-wrap does not work right due to newline scrolling delay, which also -+# requires that you set "stty cr2". -+# Note: Cursor addressing is only available via the Pascal V1.1 entry, -+# not via the BASIC PR#3 hook. All this nonsense can be avoided only by -+# using a terminal emulation program instead of the built-in firmware. -+apple2e|Apple //e, -+ bw, msgr, -+ cols#80, lines#24, -+ bel=^G, clear=\014$<100/>, cub1=^H, cud1=^J, cuu1=^_, -+ ed=\013$<4*/>, el=\035$<4/>, home=^Y, ht=^I, ind=^W, -+ is2=^R^N, kbs=^H, kcub1=^H, kcud1=^J, kcuf1=^U, kcuu1=^K, -+ nel=\r$<100/>, rev=^O, ri=^V, rmso=^N, rs1=^R^N, sgr0=^N, -+ smso=^O, -+# mcvax!vu44!vu45!wilcke uses the "ap" entry together with Ascii Express Pro -+# 4.20, with incoming and outgoing terminals both on 0, emulation On. -+apple2e-p|Apple //e via Pascal, -+ cup=\036%p2%{32}%+%c%p1%{32}%+%c, kbs=^H, kcub1=^H, -+ kcud1=^J, use=apple2e, -+# (ASCII Express) MouseTalk "Standard Apple //" emulation from BRL -+# Enable DC3/DC1 flow control with "stty ixon -ixany". -+apple-ae|ASCII Express, -+ OTbs, am, bw, msgr, nxon, xon, -+ cols#80, it#8, lines#24, -+ bel=\007$<500/>, clear=^L, cr=^M, cub1=^H, cud1=^J, cuf1=^U, -+ cup=\036%p2%{32}%+%c%p1%{32}%+%c, cuu1=^_, ed=^K, el=^], -+ home=^Y, ind=^W, is2=^R^N, kclr=^X, kcub1=^H, kcud1=^J, -+ kcuf1=^U, kcuu1=^K, rev=^O, ri=^V, rmso=^N, rs1=^R^N, sgr0=^N, -+ smso=^O, -+appleII|apple ii plus, -+ OTbs, am, -+ cols#80, it#8, lines#24, -+ clear=^L, cnorm=^TC2, cub1=^H, cud1=^J, cuf1=^\, -+ cup=\036%p2%{32}%+%c%p1%{32}%+%c, cuu1=^_, cvvis=^TC6, -+ ed=^K, el=^], flash=\024G1$<200/>\024T1, home=\E^Y, ht=^I, -+ is2=\024T1\016, kcud1=^J, kcuf1=^U, rmso=^N, sgr0=^N, -+ smso=^O, -+# Originally by Gary Ford 21NOV83 -+# From: <ee178aci%sdcc7@SDCSVAX.ARPA> Fri Oct 11 21:27:00 1985 -+apple-80|apple II with smarterm 80 col, -+ OTbs, am, bw, -+ cols#80, lines#24, -+ cbt=^R, clear=\014$<10*/>, cr=\r$<10*/>, cub1=^H, cud1=^J, -+ cuf1=^\, cup=\036%p2%{32}%+%c%p1%{32}%+%c, cuu1=^_, -+ ed=\013$<10*/>, el=\035$<10/>, home=^Y, -+apple-soroc|apple emulating soroc 120, -+ am, -+ cols#80, lines#24, -+ bel=^G, clear=\E*$<300>, cr=^M, cub1=^H, cud1=^J, cuf1=^L, -+ cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, ed=\EY, el=\ET, -+ home=^^, ind=^J, kcub1=^H, kcud1=^J, kcuf1=^L, kcuu1=^K, -+# From Peter Harrison, Computer Graphics Lab, San Francisco -+# ucbvax!ucsfmis!harrison .....uucp -+# ucbvax!ucsfmis!harrison@BERKELEY .......ARPA -+# "These two work. If you don't have the inverse video chip for the -+# Apple with videx then remove the :so: and :se: fields." -+# (apple-videx: this used to be called DaleApple -- esr) -+apple-videx|Apple with videx videoterm 80 column board with inverse video, -+ OTbs, am, xenl, -+ cols#80, it#8, lines#24, -+ clear=\014$<300/>, cub1=^H, cud1=^J, cuf1=^\, -+ cup=\036%p2%{32}%+%c%p1%{32}%+%c, cuu1=^_, ed=^K, el=^], -+ home=^Y, ht=^I, kcub1=^H, kcud1=^J, kcuf1=^U, khome=^Y, -+ rmso=^Z2, sgr0=^Z2, smso=^Z3, -+# My system [for reference] : Apple ][+, 64K, Ultraterm display card, -+# Apple Cat ][ 212 modem, + more all -+# controlled by ASCII Express: Pro. -+# From Dave Shaver <isucs1!shaver> -+apple-uterm-vb|Videx Ultraterm for Apple micros with Visible Bell, -+ OTbs, am, eo, xt, -+ cols#80, lines#24, -+ acsc=, clear=^L, cuf1=^\, -+ cup=\036%p2%{32}%+%c%p1%{32}%+%c, cuu1=^_, ed=^K, el=^], -+ flash=^W35^W06, home=^Y, -+ is2=^V4^W06\017\rVisible Bell Installed.\016\r\n, -+ rmso=^N, smso=^O, -+apple-uterm|Ultraterm for Apple micros, -+ OTbs, am, eo, xt, -+ cols#80, lines#24, -+ acsc=, clear=^L, cuf1=^\, -+ cup=\036%p2%{32}%+%c%p1%{32}%+%c, cuu1=^_, ed=^K, el=^], -+ home=^Y, is2=^V4^W06\016, rmso=^N, smso=^O, -+# from trwrba!bwong (Bradley W. Wong): -+# -+# This entry assumes that you are using an apple with the UCSD Pascal -+# language card. SYSTEM.MISCINFO is assumed to be the same as that -+# supplied with the standard apple except that screenwidth should be set -+# using SETUP to 80 columns. Note that the right arrow is not mapped in -+# this termcap entry. This is because that key, on the Apple, transmits -+# a ^U and would thus preempt the more useful "up" function of vi. -+# -+# HMH 2/23/81 -+apple80p|80-column apple with Pascal card, -+ am, bw, -+ cols#80, lines#24, -+ clear=^Y^L, cuf1=^\\:, -+ cup=\036%p2%{32}%+%c%p1%{32}%+%c, cuu1=^_, ed=^K, el=^], -+ home=^Y, kcub1=^H, -+# -+# Apple II+ equipped with Videx 80 column card -+# -+# Terminfo from ihnp4!ihu1g!djc1 (Dave Christensen) via BRL; -+# manually converted by D A Gwyn -+# -+# DO NOT use any terminal emulation with this data base, it works directly -+# with the Videx card. This has been tested with vi 1200 baud and works fine. -+# -+# This works great for vi, except I've noticed in pre-R2, ^U will scroll back -+# 1 screen, while in R2 ^U doesn't. -+# For inverse alternate character set add: -+# <smacs>=^O:<rmacs>=^N: -+# (apple-v: added it#8 -- esr) -+apple-videx2|Apple II+ w/ Videx card (similar to Datamedia h1520), -+ am, xenl, -+ cols#80, it#8, lines#24, -+ bel=\007$<100/>, clear=\014$<16*/>, cr=^M, cub1=^H, -+ cud1=^J, cuf1=^\, cup=\036%p2%{32}%+%c%p1%{32}%+%c, -+ cuu1=^_, ed=\013$<16*/>, el=^], home=^Y, ht=\011$<8/>, -+ ind=^J, kbs=^H, kcub1=^H, kcud1=^J, kcuf1=^\, kcuu1=^_, -+ khome=^Y, rmso=^Z2, smso=^Z3, -+apple-videx3|vapple|Apple II with 80 col card, -+ OTbs, am, -+ cols#80, lines#24, -+ clear=\Ev, cub1=\ED, cud1=\EB, cuf1=\EC, -+ cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, el=\Ex, -+ home=\EH, kcub1=\ED, kcud1=\EB, kcuf1=\EC, kcuu1=\EA, -+ kf0=\EP, kf1=\EQ, kf2=\ER, kf3=\E\s, kf4=\E!, kf5=\E", kf6=\E#, -+ kf7=\E$, kf8=\E%%, kf9=\E&, khome=\EH, -+#From: decvax!cbosgd!cbdkc1!mww Mike Warren via BRL -+aepro|Apple II+ running ASCII Express Pro--vt52, -+ OTbs, -+ cols#80, lines#24, -+ clear=\014$<300/>, cub1=\ED, cud1=\EB, cuf1=\EC, -+ cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, ed=\EJ, -+ el=\EK, home=\EH, -+# UCSD addition: Yet another termcap from Brian Kantor's Micro Munger Factory -+apple-vm80|ap-vm80|apple with viewmax-80, -+ OTbs, -+ cols#80, lines#24, -+ clear=\014$<300/>, cuf1=^\\:, -+ cup=\036%p1%{32}%+%c%p2%{32}%+%c$<100/>, cuu1=^_, -+ ed=\013$<300/>, el=^], home=\031$<200/>, - --xnuppc-200x75|darwin-200x75|Darwin PowerPC Console (color) 200x75, -- use=xnuppc+c, use=xnuppc+200x75, use=xnuppc+basic, -+#### Apple Lisa & Macintosh -+# - --xnuppc-256x96-m|darwin-256x96-m|Darwin PowerPC Console (monochrome) 256x96, -- use=xnuppc+256x96, use=xnuppc+basic, -+# (lisa: changed <cvvis> to <cnorm> -- esr) -+lisa|apple lisa console display (black on white), -+ OTbs, am, eo, msgr, -+ cols#88, it#8, lines#32, -+ acsc=jdkclfmenbqattuvvuwsx`, civis=\E[5h, clear=^L, -+ cnorm=\E[5l, cub1=^H, cud1=\E[B, cuf1=\E[C, -+ cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, dch1=\E[P, dl1=\E[M, -+ ed=\E[J, el=\E[K, home=\E[H, ht=^I, ich1=\E[@, il1=\E[L, -+ is2=\E>\E[m\014, kbs=^H, kcub1=\E[D, kcud1=\E[B, -+ kcuf1=\E[C, kcuu1=\E[A, rmacs=\E[10m, rmso=\E[m, rmul=\E[m, -+ sgr0=\E[m, smacs=\E[11m, smso=\E[7m, smul=\E[4m, -+liswb|apple lisa console display (white on black), -+ is2=\E>\E[0;7m\014, rmso=\E[0;7m, rmul=\E[0;7m, -+ smso=\E[m, smul=\E[4m, use=lisa, - --xnuppc-256x96|darwin-256x96|Darwin PowerPC Console (color) 256x96, -- use=xnuppc+c, use=xnuppc+256x96, use=xnuppc+basic, -+# lisaterm from ulysses!gamma!epsilon!mb2c!jed (John E. Duncan III) via BRL; -+# <is2> revised by Ferd Brundick <fsbrn@BRL.ARPA> -+# -+# These entries assume that the 'Auto Wraparound' is enabled. -+# Xon-Xoff flow control should also be enabled. -+# -+# The vt100 uses :rs2: and :rf: rather than :is2:/:tbc:/:hts: because the tab -+# settings are in non-volatile memory and don't need to be reset upon login. -+# Also setting the number of columns glitches the screen annoyingly. -+# You can type "reset" to get them set. -+# -+lisaterm|Apple Lisa or Lisa/2 running LisaTerm vt100 emulation, -+ OTbs, OTpt, am, xenl, xon, -+ OTkn#4, cols#80, it#8, lines#24, vt#3, -+ bel=^G, blink=\E[5m, bold=\E[1m, clear=\E[H\E[2J, cr=^M, -+ csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, -+ cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, -+ cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, ed=\E[J, -+ el=\E[K, home=\E[H, ht=^I, hts=\EH, ind=^J, kbs=^H, kcub1=\EOD, -+ kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kf0=\EOP, kf1=\EOQ, -+ kf2=\EOR, kf3=\EOS, lf0=F1, lf1=F2, lf2=F3, lf3=F4, rc=\E8, -+ rev=\E[7m, ri=\EM, rmkx=\E[?1l\E>, rmso=\E[m, rmul=\E[m, -+ rs1=\E>\E[?1l\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h\E[1;24r, -+ sc=\E7, sgr0=\E[m, smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, -+ tbc=\E[3g, -+# Lisaterm in 132 column ("wide") mode. -+lisaterm-w|Apple Lisa with Lisaterm in 132 column mode, -+ cols#132, -+ kbs=^H, kcub1=^H, kcud1=^J, use=lisaterm, -+# Although MacTerminal has insert/delete line, it is commented out here -+# since it is much faster and cleaner to use the "lock scrolling region" -+# method of inserting and deleting lines due to the MacTerminal implementation. -+# Also, the "Insert/delete ch" strings have an extra character appended to them -+# due to a bug in MacTerminal V1.1. Blink is disabled since it is not -+# supported by MacTerminal. -+mac|macintosh|Macintosh with MacTerminal, -+ xenl, -+ OTdN#30, -+ blink@, dch1=\E[P$<7/>, ich1=\E[@$<9/>, ip=$<7/>, use=lisa, -+# Lisaterm in 132 column ("wide") mode. -+mac-w|macterminal-w|Apple Macintosh with Macterminal in 132 column mode, -+ cols#132, use=mac, - - #### Radio Shack/Tandy - # -@@ -17752,6 +18059,23 @@ - # See - # http://www.minix3.org/manpages/man4/console.4.html - minix|minix console (v3), -+ acsc=+\020\,\021-\030.^Y0\333`\004a\261f\370g\361h\260j\331k\277l\332m\300n\305o~p\304q\304r\304s_t\303u\264v\301w\302x\263y\363z\362{\343|\330}\234~\376, -+ kdch1=\177, kend=\E[Y, kf0=\E[21~, kf1=\E[11~, kf10=\E[21~, -+ kf11=\E[11;2~, kf12=\E[12;2~, kf13=\E[13;2~, -+ kf14=\E[14;2~, kf15=\E[15;2~, kf16=\E[17;2~, -+ kf17=\E[18;2~, kf18=\E[19;2~, kf19=\E[20;2~, kf2=\E[12~, -+ kf20=\E[21;2~, kf21=\E[11;5~, kf22=\E[12;5~, -+ kf23=\E[13;5~, kf24=\E[14;5~, kf25=\E[15;5~, -+ kf26=\E[17;5~, kf27=\E[18;5~, kf28=\E[19;5~, -+ kf29=\E[20;5~, kf3=\E[13~, kf30=\E[21;5~, kf31=\E[11;6~, -+ kf32=\E[12;6~, kf33=\E[13;6~, kf34=\E[14;6~, -+ kf35=\E[15;6~, kf36=\E[17;6~, kf37=\E[18;6~, -+ kf38=\E[19;6~, kf39=\E[20;6~, kf4=\E[14~, kf40=\E[21;6~, -+ kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, -+ kich1=\E[@, knp=\E[U, kpp=\E[V, lf0@, lf1@, lf2@, lf3@, lf4@, lf5@, -+ use=minix-3.0, -+ -+minix-3.0|minix console (v3.0), - use=ecma+color, use=minix-1.7, - - # See -@@ -17792,7 +18116,7 @@ - am, use=minix-old, - - pc-minix|minix console on an Intel box, -- use=klone+acs, use=minix, -+ use=klone+acs, use=minix-3.0, - - # According to the Coherent 2.3 manual, the PC console is similar - # to a z19. The differences seem to be (1) 25 lines, (2) no status -@@ -18195,6 +18519,7 @@ - use=tws-generic, - dku7202|BULL Questar 200 DKU7202 (colour/character attributes), - blink=\E[0;2;4m, dim=\E[0;5m, ht=^I, is3=\E[?3h\Eb, -+ sgr=\E[0%?%p1%t;2;4;5;7%;%?%p3%t;7%;%?%p2%t;2%;%?%p4%t;2;4%;%?%p5%t;5%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, - smso=\E[0;4;5;7m, smul=\E[0;2m, use=tws-generic, - - #=========================================================# -@@ -18274,7 +18599,7 @@ - - # This entry covers BQ303, BQ306, BQ310, Q303, Q306, Q310 - bq300|Bull vt320 ISO Latin 1 80 columns terminal, -- am, eo, eslok, hs, km, mc5i, mir, msgr, xenl, xon, -+ am, eo, eslok, hs, km, mir, msgr, xenl, xon, - cols#80, it#8, lines#24, vt#3, wsl#80, - acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, - bel=^G, blink=\E[5m, bold=\E[1m, civis=\E[?25l, -@@ -18298,14 +18623,14 @@ - kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, kfnd=\E[1~, - khlp=\E[28~, kich1=\E[2~, knp=\E[6~, kpp=\E[5~, - krdo=\E[29~, kslt=\E[4~, lf1=pf1, lf2=pf2, lf3=pf3, lf4=pf4, -- mc0=\E[i, mc4=\E[4i, mc5=\E[5i, nel=\EE, rc=\E8, rev=\E[7m, -- ri=\EM, rmacs=\E(B, rmam=\E[?7l, rmcup=\E[?7h, rmir=\E[4l, -- rmkx=\E[?1l\E>, rmso=\E[27m, rmul=\E[24m, rs1=\E[!p, -- rs2=\E[?3l, s0ds=\E(B, s1ds=\E(0, sc=\E7, -+ nel=\EE, rc=\E8, rev=\E[7m, ri=\EM, rmacs=\E(B, rmam=\E[?7l, -+ rmcup=\E[?7h, rmir=\E[4l, rmkx=\E[?1l\E>, rmso=\E[27m, -+ rmul=\E[24m, rs1=\E[!p, rs2=\E[?3l, s0ds=\E(B, s1ds=\E(0, -+ sc=\E7, - sgr=\E[%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;m%?%p9%t\E(0%e\E(B%;, - sgr0=\E[0m\E(B, smacs=\E(0, smam=\E[?7h, - smcup=\E[?7l\E[?1l\E(B, smir=\E[4h, smso=\E[7m, -- smul=\E[4m, tbc=\E[3g, tsl=\E[1$}\E[2$~, -+ smul=\E[4m, tbc=\E[3g, tsl=\E[1$}\E[2$~, use=ansi+pp, - bq300-rv|Bull vt320 reverse 80 columns, - flash=\E[?5l$<50>\E[?5h, - is2=\E[?2h\E[?3l\E[?5h\E[?7h\E[?8h\E>\E[?1l\E F\E[?42l\E[?4l, -@@ -18383,12 +18708,12 @@ - csr=\233%i%p1%d;%p2%dr, cub=\233%p1%dD, cub1=\2331D, - cud=\233%p1%dB, cud1=\2331B, cuf=\233%p1%dC, cuf1=\2331C, - cup=\233%i%p1%d;%p2%dH, cuu=\233%p1%dA, cuu1=\2331A, -- dch=\233%p1%dP, dch1=\233P, dl=\233%p1%dM, -+ dch=\233%p1%dP, dch1=\233P, dl=\233%p1%dM, dl1=\233M, - dsl=\2331$}\2332$~\n\2330$}, ech=\233%p1%dX, ed=\233J, - el=\233K, el1=\2331K, enacs=\E(B\E)0, - flash=\233?5h$<50>\233?5l, fsl=\2330$}, home=\233H, -- ht=^I, hts=\EH, ich=\233%p1%d@, il=\233%p1%dL, ind=\ED, -- is1=\E[63;2"p\E[2h, -+ ht=^I, hts=\EH, ich=\233%p1%d@, il=\233%p1%dL, il1=\233L, -+ ind=\ED, is1=\E[63;2"p\E[2h, - is2=\E[?2h\E[?3l\E[?5l\E[?7h\E[?8h\E>\E[?1l\E G\E[?42l\E[?4l, - is3=\2330$}\233?25h\2332l\233H\233J, ka1=\217w, - ka3=\217y, kb2=\217u, kbs=^H, kc1=\217q, kc3=\217s, -@@ -18401,11 +18726,12 @@ - khlp=\23328~, kich1=\2332~, knp=\2336~, kpp=\2335~, - krdo=\23329~, kslt=\2334~, lf1=pf1, lf2=pf2, lf3=pf3, - lf4=pf4, mc0=\233i, mc4=\2334i, mc5=\2335i, nel=\EE, rc=\E8, -- rev=\2337m, ri=\EM, rmacs=^O, rmam=\233?7l, rmcup=\233?7h, -- rmir=\2334l, rmkx=\233?1l\E>, rmso=\23327m, rmul=\23324m, -- rs1=\E[!p, rs2=\E[?3l, s0ds=\E(B, s1ds=\E(0, sc=\E7, -+ rev=\2337m, ri=\EM, rmacs=\E(B, rmam=\233?7l, -+ rmcup=\233?7h, rmir=\2334l, rmkx=\233?1l\E>, -+ rmso=\23327m, rmul=\23324m, rs1=\E[!p, rs2=\E[?3l, -+ s0ds=\E(B, s1ds=\E(0, sc=\E7, - sgr=\233%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;m%?%p9%t\E(0%e\E(B%;, -- sgr0=\2330m\E(B, smacs=^N, smam=\233?7h, -+ sgr0=\2330m\E(B, smacs=\E(0, smam=\233?7h, - smcup=\233?7l\233?1l\E(B, smir=\2334h, smso=\2337m, - smul=\2334m, tbc=\2333g, tsl=\2331$}\2332$~, - bq300-8rv|Bull vt320 8-bit reverse mode 80 columns, -@@ -19010,14 +19336,14 @@ - cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, - cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, - dch=\E[%p1%dP, dch1=\E[1P, dim=\E[2m, dl=\E[%p1%dM, -- dsl=\E[>1l, ed=\E[J, el=\E[K, fsl=\E[u\E[>5l, home=\E[H, -- ht=^I, hts=\EH, if=/usr/share/tabset/vt100, il=\E[%p1%dL, -- ind=\ED, kbs=^H, kclr=\E[J, kcub1=\EOD, kcud1=\EOB, -- kcuf1=\EOC, kcuu1=\EOA, ked=\E[J, kf0=\E[~, kf1=\EOS, -- kf2=\EOT, kf3=\EOU, kf4=\EOV, kf5=\EOW, kf6=\EOP, kf7=\EOQ, -- kf8=\EOR, kf9=\EOX, khome=\E[H, lf0=help, mc0=\E#7, -- nel=^M\ED, rc=\E[r, rev=\E[7m, ri=\EM, rmcup=\E[?7h, -- rmso=\E[m, rmul=\E[m, -+ dl1=\E[M, dsl=\E[>1l, ed=\E[J, el=\E[K, fsl=\E[u\E[>5l, -+ home=\E[H, ht=^I, hts=\EH, if=/usr/share/tabset/vt100, -+ il=\E[%p1%dL, il1=\E[L, ind=\ED, kbs=^H, kclr=\E[J, -+ kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, ked=\E[J, -+ kf0=\E[~, kf1=\EOS, kf2=\EOT, kf3=\EOU, kf4=\EOV, kf5=\EOW, -+ kf6=\EOP, kf7=\EOQ, kf8=\EOR, kf9=\EOX, khome=\E[H, lf0=help, -+ mc0=\E#7, nel=^M\ED, rc=\E[r, rev=\E[7m, ri=\EM, -+ rmcup=\E[?7h, rmso=\E[m, rmul=\E[m, - rs1=\E<\E[1;24r\E[24;1H\E[?7h\E[>4h\E[>1;2;3;5;6;7;8;9l\E[m\E[11m, - sc=\E[s, sgr0=\E[m, smcup=\E[?7l, smso=\E[7;2m, smul=\E[4m, - tbc=\E[3g, tsl=\E[s\E[>5;1h\E[25;%i%dH\E[1K, -@@ -19818,6 +20144,193 @@ - apollo_color|apollo color display, - rmir@, smir@, use=vt132, - -+#### AT&T consoles -+ -+# This actually describes the generic SVr4 display driver for Intel boxes. -+# The <dim=\E[2m> isn't documented and therefore may not be reliable. -+# From: Eric Raymond <esr@snark.thyrsus.com> Mon Nov 27 19:00:53 EST 1995 -+att6386|at386|386at|AT&T WGS 6386 console, -+ am, bw, eo, xon, -+ cols#80, it#8, lines#25, -+ acsc=``a1fxgqh0jYk?lZm@nEooppqDrrsstCu4vAwBx3yyzz{{||}}~~, -+ bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[=C, -+ clear=\E[2J\E[H, cnorm=\E[=1C, cr=^M, cub=\E[%p1%dD, -+ cub1=\E[D, cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, -+ cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, -+ cuu1=\E[A, dch=\E[%p1%dP, dch1=\E[P, dim=\E[2m, -+ dl=\E[%p1%dM, dl1=\E[1M, ech=\E[%p1%dX, ed=\E[J, el=\E[K, -+ home=\E[H, hpa=\E[%i%p1%dG, ht=^I, hts=\EH, ich=\E[%p1%d@, -+ ich1=\E[1@, il=\E[%p1%dL, il1=\E[1L, ind=\E[S, -+ indn=\E[%p1%dS, invis=\E[9m, is2=\E[0;10;39m, kbs=^H, -+ kcbt=^], kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, -+ kdch1=\E[P, kend=\E[Y, kf1=\EOP, kf10=\EOY, kf11=\EOZ, -+ kf12=\EOA, kf2=\EOQ, kf3=\EOR, kf4=\EOS, kf5=\EOT, kf6=\EOU, -+ kf7=\EOV, kf8=\EOW, kf9=\EOX, khome=\E[H, kich1=\E[@, -+ knp=\E[U, kpp=\E[V, krmir=\E0, nel=\r\E[S, rc=\E8, rev=\E[7m, -+ ri=\E[T, rin=\E[%p1%dT, rmacs=\E[10m, rmso=\E[m, rmul=\E[m, -+ sc=\E7, -+ sgr=\E[10m\E[0%?%p1%p3%|%t;7%;%?%p2%t;4%;%?%p4%t;5%;%?%p5%t;2%;%?%p6%t;1%;%?%p9%t;12%e;10%;%?%p7%t;9%;m, -+ sgr0=\E[0;10m, smacs=\E[12m, smso=\E[7m, smul=\E[4m, -+ tbc=\E[3g, vpa=\E[%i%p1%dd, use=klone+color, -+# (pc6300plus: removed ":KM=/usr/lib/ua/kmap.s5:"; renamed BO/EE/CI/CV -- esr) -+pc6300plus|AT&T 6300 plus, -+ OTbs, am, xon, -+ cols#80, lines#24, -+ bel=^G, blink=\E[5m, bold=\E[1m, civis=\E[=C, -+ clear=\E[2J\E[H, cnorm=\E[=1C, cr=^M, cub1=^H, cud1=\E[B, -+ cuf1=\E[C, cup=\E[%i%p1%2d;%p2%2dH, cuu1=\E[A, -+ dch1=\E[1P, dim=\E[2m, dl1=\E[1M, ed=\E[0J, el=\E[0K, -+ home=\E[H, hts=\EH, ich1=\E[1@, il1=\E[1L, ind=^J, -+ invis=\E[9m, kbs=^H, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, -+ kcuu1=\E[A, kf1=\EOc, kf10=\EOu, kf2=\EOd, kf3=\EOe, -+ kf4=\EOf, kf5=\EOg, kf6=\EOh, kf7=\EOi, kf8=\EOj, kf9=\EOk, -+ nel=^M^J, rev=\E[7m, rmso=\E[m, rmul=\E[m, sgr0=\E[m, -+ smso=\E[7m, smul=\E[4m, tbc=\E[3g, -+ -+# From: Benjamin C. W. Sittler <bsittler@nmt.edu> -+# -+# I have a UNIX PC which I use as a terminal attached to my Linux PC. -+# Unfortunately, the UNIX PC terminfo entry that comes with ncurses -+# is broken. All the special key sequences are broken, making it unusable -+# with Emacs. The problem stems from the following: -+# -+# The UNIX PC has a plethora of keys (103 of them, and there's no numeric -+# keypad!), loadable fonts, and strange highlighting modes ("dithered" -+# half-intensity, "smeared" bold, and real strike-out, for example.) It also -+# uses resizable terminal windows, but the bundled terminal program always -+# uses an 80x24 window (and doesn't support seem to support a 132-column -+# mode.) -+# -+# HISTORY: The UNIX PC was one of the first machines with a GUI, and used a -+# library which was a superset of SVr3.5 curses (called tam, for "terminal -+# access method".) tam includes support for real, overlapping windows, -+# onscreen function key labels, and bitmap graphics. But since the primary -+# user interface on the UNIX PC was a GUI program (ua, for "user -+# assistant",) and remote administration was considered important for the -+# machine, tam also supported VT100-compatible terminals attached to the -+# serial port or used across the StarLan network. To simulate the extra keys -+# not present on a VT100, users could press ESC and a two-letter sequence, -+# such as u d (Undo) or U D (Shift-Undo.) These two-letter sequences, -+# however, were not the same as those sent by the actual Undo key. The -+# actual Undo key sends ESC 0 s unshifted, and ESC 0 S shifted, for example. -+# (If you're interested in adding some of the tam calls to ncurses, btw, I -+# have the full documentation and several programs which use tam. It also -+# used an extended terminfo format to describe key sequences, special -+# highlighting modes, etc.) -+# -+# KEYS: This means that ncurses would quite painful on the UNIX PC, since -+# there are two sequences for every key-modifier combination (local keyboard -+# sequence and remote "VT100" sequence.) But I doubt many people are trying -+# to use ncurses on the UNIX PC, since ncurses doesn't properly handle the -+# GUI. Unfortunately, the terminfo entry (and the termcap, too, I presume) -+# seem to have been built from the manual describing the VT100 sequences. -+# This means it doesn't work for a real live UNIX PC. -+# -+# FONTS: The UNIX PC also has a strange interpretation of "alternate -+# character set". Rather than the VT100 graphics you might expect, it allows -+# up to 8 custom fonts to be loaded at any given time. This means that -+# programs expecting VT100 graphics will usually be disappointed. For this -+# reason I have disabled the smacs/rmacs sequences, but they could easily be -+# re-enabled. Here are the relevant control sequences (from the ESCAPE(7) -+# manpage), should you wish to do so: -+# -+# SGR10 - Select font 0 - ESC [ 10 m or SO -+# SGR11 - Select font 1 - ESC [ 11 m or SI -+# SGR12 - Select font 2 - ESC [ 12 m -+# ... (etc.) -+# SGR17 - Select font 7 - ESC [ 17 m -+# -+# Graphics for line drawing are not reliably found at *any* character -+# location because the UNIX PC has dynamically reloadable fonts. I use font -+# 0 for regular text and font 1 for italics, but this is by no means -+# universal. So ASCII line drawing is in order if smacs/rmacs are enabled. -+# -+# MISC: The cursor visible/cursor invisible sequences were swapped in the -+# distributed terminfo. -+# -+# To ameliorate these problems (and fix a few highlighting bugs) I rewrote -+# the UNIX PC terminfo entry. The modified version works great with Lynx, -+# Emacs, and XEmacs running on my Linux PC and displaying on the UNIX PC -+# attached by serial cable. In Emacs, even the Undo key works, and many -+# applications can now use the F1-F8 keys. -+# -+# esr's notes: -+# Terminfo entry for the AT&T Unix PC 7300 -+# from escape(7) in Unix PC 7300 Manual. -+# Somewhat similar to a vt100-am (but different enough -+# to redo this from scratch.) -+# -+# /*************************************************************** -+# * -+# * FONT LOADING PROGRAM FOR THE UNIX PC -+# * -+# * This routine loads a font defined in the file ALTFONT -+# * into font memory slot #1. Once the font has been loaded, -+# * it can be used as an alternative character set. -+# * -+# * The call to ioctl with the argument WIOCLFONT is the key -+# * to this routine. For more information, see window(7) in -+# * the PC 7300 documentation. -+# ***************************************************************/ -+# #include <string.h> /* needed for strcpy call */ -+# #include <sys/window.h> /* needed for ioctl call */ -+# #define FNSIZE 60 /* font name size */ -+# #define ALTFONT "/usr/lib/wfont/special.8.ft" /* font file */ -+# /* -+# * The file /usr/lib/wfont/special.8.ft comes with the -+# * standard PC software. It defines a graphics character set -+# * similar to that of the Teletype 5425 terminal. To view -+# * this or other fonts in /usr/lib/wfont, use the command -+# * cfont <filename>. For further information on fonts see -+# * cfont(1) in the PC 7300 documentation. -+# */ -+# -+# struct altfdata /* structure for alt font data */ -+# { -+# short altf_slot; /* memory slot number */ -+# char altf_name[FNSIZE]; /* font name (file name) */ -+# }; -+# ldfont() -+# { -+# int wd; /* window in which altfont will be */ -+# struct altfdata altf; -+# altf.altf_slot=1; -+# strcpy(altf.altf_name,ALTFONT); -+# for (wd =1; wd < 12; wd++) { -+# ioctl(wd, WIOCLFONT,&altf); -+# } -+# } -+# -+# (att7300: added <civis>/<cnorm>/<ich1>/<invis> from the BSDI entry, -+# they're confirmed by the man page for the System V display---esr) -+# -+att7300|unixpc|pc7300|3b1|s4|AT&T UNIX PC Model 7300, -+ am, xon, -+ cols#80, it#8, lines#24, -+ bel=^G, blink=\E[9m, bold=\E[1m, cbt=\E^I, civis=\E[=1C, -+ clear=\E[2J\E[H, cnorm=\E[=0C, cr=^M, cub=\E[%p1%dD, -+ cub1=^H, cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, -+ cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, -+ cuu1=\E[A, dch1=\E[P, dim=\E[2m, dl=\E[%p1%dM, dl1=\E[M, -+ ed=\E[0J, el=\E[0K, home=\E[H, ich1=\E[@, il=\E[%p1%dL, -+ il1=\E[L, ind=^J, invis=\E[9m, is1=\017\E[=1w, kBEG=\ENB, -+ kCAN=\EOW, kCPY=\END, kCRT=\EON, kDC=\ENF, kDL=\ENE, -+ kEND=\ENN, kEOL=\EOA, kFND=\EOX, kHLP=\EOM, kHOM=\ENM, -+ kIC=\ENJ, kLFT=\ENK, kMOV=\ENC, kNXT=\ENH, kOPT=\EOR, -+ kPRV=\ENG, kRDO=\EOT, kRIT=\ENL, kRPL=\EOY, kSAV=\EOO, -+ kUND=\EOS, kbeg=\ENb, kbs=^H, kcan=\EOw, kcbt=\E[Z, -+ kclo=\EOV, kclr=\E[J, kcmd=\EOu, kcpy=\ENd, kcrt=\EOn, -+ kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=\ENf, -+ ked=\E[J, kel=\EOa, kend=\E0, kext=\EOk, kf1=\EOc, kf2=\EOd, -+ kf3=\EOe, kf4=\EOf, kf5=\EOg, kf6=\EOh, kf7=\EOi, kf8=\EOj, -+ kfnd=\EOx, khlp=\EOm, khome=\E[H, kich1=\ENj, kind=\E[B, -+ kmov=\ENc, kmrk=\ENi, knp=\E[U, knxt=\ENh, kopn=\EOv, -+ kopt=\EOr, kpp=\E[V, kprt=\EOz, kprv=\ENg, krdo=\EOt, -+ kref=\EOb, krfr=\ENa, kri=\E[A, krpl=\EOy, krst=\EOB, -+ ksav=\EOo, kslt=\ENI, kund=\EOs, nel=\EE, rev=\E[7m, ri=\EM, -+ rmso=\E[m, rmul=\E[m, sgr0=\E[0;10m, smso=\E[7m, -+ smul=\E[4m, -+ - #### Convergent Technology - # - # Burroughs bought Convergent shortly before it merged with Univac. -@@ -19923,6 +20436,54 @@ - masscomp2|masscomp large screen version 2, - cols#64, lines#21, use=masscomp, - -+#### OSF Unix -+# -+ -+# OSF/1 1.1 Snapshot 2 -+pmcons|pmconsole|PMAX console, -+ am, -+ cols#128, lines#57, -+ bel=^G, clear=^L, cr=^M, cub1=^H, cud1=^J, cuu1=^K, ht=^I, -+ ind=^J, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, -+ kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, -+ -+#### Other consoles -+# The following is a version of the ibm-pc entry distributed with PC/IX, -+# (Interactive Systems' System 3 for the Big Blue), modified by Richard -+# McIntosh at UCB/CSM. The :pt: and :uc: have been removed from the original, -+# (the former is untrue, and the latter failed under UCB/man); standout and -+# underline modes have been added. Note: this entry describes the "native" -+# capabilities of the PC monochrome display, without ANY emulation; most -+# communications packages (but NOT PC/IX connect) do some kind of emulation. -+pcix|PC/IX console, -+ am, bw, eo, -+ cols#80, lines#24, -+ clear=\Ec, cub1=^H, cud1=\E[B, cuf1=\E[C, -+ cup=\E[%i%p1%2d;%p2%2dH, cuu1=\E[A, ed=\E[J, el=\E[K, -+ home=\E[H, rmso=\E[m, rmul=\E[m, sgr0=\E[m, smso=\E[7m, -+ smul=\E[4m, -+ -+# (ibmpcx: this entry used to be known as ibmx. -+# It formerly included the following extension capabilities: -+# :GC=b:GL=v:GR=t:RT=^J:\ -+# :GH=\E[196g:GV=\E[179g:\ -+# :GU=\E[193g:GD=\E[194g:\ -+# :G1=\E[191g:G2=\E[218g:G3=\E[192g:G4=\E[217g:\ -+# :CW=\E[E:NU=\E[F:RF=\E[G:RC=\E[H:\ -+# :WL=\E[K:WR=\E[L:CL=\E[M:CR=\E[N:\ -+# I renamed GS/GE/WL/WR/CL/CR/PU/PD/HM/EN; also, removed a duplicate -+# ":kh=\E[Y:". Added IBM-PC forms characters and highlights, they match -+# what was there before. -- esr) -+ibmpcx|xenix|ibmx|IBM PC xenix console display, -+ OTbs, am, msgr, -+ cols#80, lines#25, -+ clear=^L, cub1=^H, cud1=\E[B, cuf1=\E[C, -+ cup=\E[%p1%d;%p2%dH, cuu1=\E[A, dch1=\E[P, dl1=\E[M, -+ ed=\E[J, el=\E[K, home=\E[H, ich1=\E[@, il1=\E[L, kbs=^H, -+ kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kend=\E[d, -+ kf1=\E[K, kf2=\E[L, kf3=\E[M, kf4=\E[N, khome=\E[Y, knp=\E[e, -+ kpp=\E[Z, use=klone+acs, use=klone+sgr8, -+ - ######## OTHER OBSOLETE TYPES - # - # These terminals are *long* dead -- these entries are retained for -@@ -20217,9 +20778,9 @@ - sgr0=\EX, smacs=\EF, smso=\ET, - env230|envision230|envision 230 graphics terminal, - xenl@, -- mc0=\E[0i, mc4=\E[4i, mc5=\E[5i, -- sgr=\E[%?%p1%t;1%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;m$<2>, -- use=vt100, -+ enacs@, mc0=\E[0i, mc4=\E[4i, mc5=\E[5i, rmacs@, -+ sgr=\E[0%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;m$<2>, -+ sgr0=\E[0m$<2>, smacs@, use=vt100, - # These execuports were impact-printer ttys with a 30- or maybe 15-cps acoustic - # coupler attached, the whole rig fitting in a suitcase and more or less - # portable. Hot stuff for c.1977 :-) -- esr -@@ -20274,7 +20835,7 @@ - rmacs=\EH^C, rmam=\Ed., rmcup=, rmir=\Er, rmln=\EA11, - rmxon=\Ec20, rs1=\E~!\E~4$<150>, rs2=\EeF$<150>, - rs3=\EwG\Ee($<150>, -- sgr=%?%p8%t\E)%e\E(%;%?%p9%t\EH\002%e\EH\003%;\EG%{48}%?%p2%p6%|%t%{8}%|%;%?%p1%p3%|%p6%|%t%{4}%|%;%?%p4%t%{2}%|%;%?%p1%p5%|%t%{64}%|%;%?%p7%t%{1}%|%;%c, -+ sgr=%?%p8%t\E)%e\E(%;%?%p9%t\EH\002%e\EH\003%;\EG%{48}%?%p2%t%{8}%|%;%?%p1%p3%|%t%{4}%|%;%?%p4%t%{2}%|%;%?%p1%p5%|%t%{64}%|%;%?%p7%t%{1}%|%;%c, - sgr0=\E(\EH\003\EG0\EcD, smacs=\EH^B, smam=\Ed/, - smcup=\Ezz&\E[A\177\Ezz'\E[B\177\Ezz(\E[D\177\Ezz)\E[C\177\Ezz<\E[Q\177, - smir=\Eq, smln=\EA10, smxon=\Ec21, tbc=\E0, tsl=\Ez(, -@@ -20881,7 +21442,7 @@ - # assigned in System V terminfo. There are some variant extension sets out - # there. We try to describe them here. - # --# XENIX extensions: -+#### XENIX extensions: - # - # The XENIX extensions include a set of function-key capabilities as follows: - # -@@ -20946,7 +21507,7 @@ - # When translating a termcap file, ncurses tic will do this automatically. - # The double forms characters don't fit the SVr4 terminfo model. - # --# AT&T Extensions: -+#### AT&T Extensions: - # - # The old AT&T 5410, 5420, 5425, pc6300plus, 610, and s4 entries used a set of - # nonstandard capabilities. Its signature is the KM capability, used to name -@@ -20957,7 +21518,7 @@ - # FL=:LO: (enable soft labels), FE=:LF: (disable soft labels), CI=:vi: (make - # cursor invisible), and CV=:ve: (make cursor normal). - # --# HP Extensions -+#### HP Extensions - # - # The HP library (as of mid-1995, their term.h file version 70.1) appears to - # have the System V capabilities up to SVr1 level. After that, it supports -@@ -20966,7 +21527,7 @@ - # label_off, and key_f11..key_f63 capabilities like SVr4's. This makes the - # HP binary format incompatible with SVr4's. - # --# IBM Extensions -+#### IBM Extensions - # - # There is a set of nonstandard terminfos used by IBM's AIX operating system. - # The AIX terminfo library diverged from SVr1 terminfo, and replaces all -@@ -20994,7 +21555,7 @@ - # The box2 characters are the double-line versions of these forms graphics. - # The AIX binary terminfo format is incompatible with SVr4's. - # --# Iris console extensions: -+#### Iris console extensions: - # - # HS is half-intensity start; HE is half-intensity end - # CT is color terminal type (for Curses & rogue) -@@ -21003,7 +21564,7 @@ - # - # The ncurses tic utility recognizes HS as an alias for mh <dim>. - # --# TC Extensions: -+#### TC Extensions: - # - # There is a set of extended termcaps associated with something - # called the "Terminal Control" or TC package created by MainStream Systems, -@@ -21011,11 +21572,112 @@ - # CF for civis and CO for cvvis. Finally, they define a boolean :ct: - # that flags color terminals. - # -+######## NCURSES USER-DEFINABLE CAPABILITIES -+# -+# Extensions added after ncurses 5.0 generally use the "-x" option of tic and -+# infocmp to manipulate user-definable capabilities. Those that are intended -+# for use in either terminfo or termcap use 2-character names. Extended -+# function keys do not use 2-character names, and are available only with -+# terminfo. -+# -+# As of mid-2012, no other terminfo/termcap implementation than ncurses -+# supports this extension; termcap libraries can as noted above make limited -+# use of the feature. -+# -+# ncurses makes explicit checks for a few user-definable capabilities: AX, U8, -+# XM. -+# -+#### SCREEN Extensions: -+# -+# The screen program uses the termcap interface. It recognizes a few useful -+# nonstandard capabilities. Those are used in this file. -+# -+# AX (bool) Does understand ANSI set default fg/bg color (\E[39m / -+# \E[49m). -+# G0 (bool) Terminal can deal with ISO 2022 font selection sequences. -+# E0 (str) Switch charset 'G0' back to standard charset. -+# S0 (str) Switch charset 'G0' to the specified charset. -+# XT (bool) Terminal understands special xterm sequences (OSC, mouse -+# tracking). -+# -+# AX is relatively straightforward; it is interpreted by ncurses to say that -+# SGR 39/49 reset the terminal's foreground and background colors to their -+# "default". -+# -+# XT is harder, since screen's manpage does not give more details. For that, -+# we must read screen's source-code. When XT is set, screen assumes -+# -+# a) OSC 1 sets the title string, e.g., for the icon. Recent versions of -+# screen may also set the terminal's name, which is (for xterm) distinct -+# from the icon name. -+# b) OSC 20 sets the background pixmap. This is an rxvt feature. -+# c) OSC 39 and OSC 49 set the default foreground/background colors. Again -+# this is an rxvt feature. -+# d) certain mode settings enable the mouse: 9, 1000, 1001, 1002, 1003. -+# These are from xterm, although xterm accepts mouse codes that may not be -+# recognized by screen, e.g., 1005, 1006. -+# e) colors beyond 0..7 are implemented by xterm's aixterm-like 16-color -+# sequence. However, because screen uses only termcap, the values returned -+# by Af/Ab are not usable because they rely on expressions that termcap -+# does not support. Therefore, screen uses a hardcoded string to work -+# around the limitation. -+# f) all entries named "*xterm*" or "*rxvt*" have the bce flag set. -+# -+# The other ISO-2022 features are rarely used, but provided here to make -+# screen's termcap features available. -+# -+#### XTERM Extensions: -+# -+# Most of the xterm extensions are for function-keys. Since patch #94 (in -+# 1999), xterm has supported shift/control/alt/meta modifiers which produce -+# additional function-key strings. Some other developers copied the feature, -+# though they did not follow xterm's lead in patch #167 (in 2002), to make -+# these key definitions less ambiguous. -+# -+# A few terminals provide similar functionality (sending distinct keys when -+# a modifier is used), including rxvt. -+# -+# These are the extended keys defined in this file: -+# -+# kDC3 kDC4 kDC5 kDC6 kDC7 kDN kDN3 kDN4 kDN5 kDN6 kDN7 kEND3 kEND4 kEND5 kEND6 -+# kEND7 kHOM3 kHOM4 kHOM5 kHOM6 kHOM7 kIC3 kIC4 kIC5 kIC6 kIC7 kLFT3 kLFT4 -+# kLFT5 kLFT6 kLFT7 kNXT3 kNXT4 kNXT5 kNXT6 kNXT7 kPRV3 kPRV4 kPRV5 kPRV6 kPRV7 -+# kRIT3 kRIT4 kRIT5 kRIT6 kRIT7 kUP kUP3 kUP4 kUP5 kUP6 kUP7 ka2 kb1 kb3 kc2 -+# -+# Here are the other xterm-related extensions which are used in this file: -+# -+# Cr is a string capability which resets the cursor color -+# Cs is a string capability which sets the cursor color to a given value. -+# The single string parameter is the color name/number, according to the -+# implementation. -+# Ms modifies the selection/clipboard. Its parameters are -+# p1 = the storage unit (clipboard, selection or cut buffer) -+# p2 = the base64-encoded clipboard content. -+# Se resets the cursor style to the terminal power-on default. -+# Ss is a string capability with one numeric parameter. It is used to set the -+# cursor style as described by the DECSCUSR function to a block or -+# underline. -+# TS is a string capability which acts like "tsl", but uses no parameter and -+# goes to the first column of the "status line". -+# XM is a string capability which overrides ncurses's built-in string which -+# enables xterm mouse mode. -+# -+#### Miscellaneous extensions: -+# -+# gsbom/grbom are used to enable/disable real bold (not intensity bright) mode. -+# This was implemented for the Hurd. -+# E3 clears the terminal's scrollback buffer. This was implemented in the -+# Linux 3.0 kernel as a security feature. It matches a feature which was -+# added in xterm patch #107. -+# U8 is a numeric capability which denotes a terminal emulator which does not -+# support VT100 SI/SO when processing UTF-8 encoding. Set this to a nonzero -+# value to enable it. -+# - ######## CHANGE HISTORY - # - # The last /etc/termcap version maintained by John Kunze was 8.3, dated 8/5/94. --# Releases 9 and up are maintained by Eric S. Raymond as part of the ncurses --# project. -+# Releases 9 and 10 (up until the release of ncurses 4.2 in 1998) were -+# maintained by Eric S. Raymond as part of the ncurses project. - # - # This file contains all the capability information present in John Kunze's - # last version of the termcap master file, except as noted in the change -@@ -21115,7 +21777,7 @@ - # * Replaced HP entries up to hpsub with purpose-built ones. - # * Blank rmir/smir/rmdc/smdc capabilities removed. - # * Small fixes merged in from SCO entries for lpr, fos, tvi910+, tvi924. --# 9.4.8 (Fri Apr 7 09:36:34 EDT 199): -+# 9.4.8 (Fri Apr 7 09:36:34 EDT 1995): - # * Replaced the Ann Arbor entries with SCO's, the init strings are - # more efficient (but the entries otherwise identical). - # * Added dg211 from Shuford archive. -@@ -22224,7 +22886,7 @@ - # * add screen.rxvt -TD - # - # 2008-04-28 --# * add screen+fkeys (prompted by Debian # 478094) -TD -+# * add screen+fkeys (prompted by Debian #478094) -TD - # - # 2008-06-28 - # * add screen.mlterm -TD -@@ -22280,7 +22942,7 @@ - # 2009-12-12 - # * updated nsterm* entries (Benjamin Sittler, Emanuele Giaquinta) - # --# 2009-12-12 -+# 2009-12-19 - # * add bw (auto-left-margin) to nsterm* entries (Benjamin Sittler) - # * rename minix to minix-1.7, add minix entry for Minux3 -TD - # -@@ -22354,6 +23016,195 @@ - # * add xterm-utf8 as a demo of the U8 feature -TD - # - # 2011-02-20 --# * add cons25-debian entry (Brian M Carlson, Debina #607662). -+# * add cons25-debian entry (Brian M Carlson, Debian #607662). -+# -+# 2011-06-11 -+# * update minix entry to minix 3.2 (Thomas Cort). -+# -+# 2011-07-09 -+# * fix inconsistent tabset path in pcmw (Todd C. Miller). -+# * remove a backslash which continued comment, obscuring altos3 -+# definition with OpenBSD toolset (Nicholas Marriott). -+# -+# 2011-07-16 -+# * add/use xterm+tmux chunk from xterm #271 -TD -+# * resync xterm-new entry from xterm #271 -TD -+# * add E3 extended capability to linux-basic (Miroslav Lichvar) -+# * add linux2.2, linux2.6, linux3.0 entries to give context for E3 -TD -+# * add SI/SO change to linux2.6 entry (Debian #515609) -TD -+# -+# 2011-07-21 -+# * add kich1 to sun (Yuri Pankov) -+# * use bold rather than reverse for smso in sun-color (Yuri Pankov). -+# -+# 2011-08-06 -+# * corrected k9 in dg460-ansi, add other features based on manuals -TD -+# -+# 2011-08-20 -+# * minor cleanup of X-terminal emulator section -TD -+# * add terminator entry -TD -+# * add simpleterm entry -TD -+# -+# 2011-09-10 -+# * add xterm+kbs fragment from xterm #272 -TD -+# -+# 2011-11-12 -+# * add pccon entries for OpenBSD console (Alexei Malinin) -+# -+# 2011-12-17 -+# * corrected old changelog comments -TD -+# -+# 2011-11-24 -+# * add putty-sco -TD -+# -+# 2012-01-28 -+# * add mach-gnu (Samuel Thibault) -+# * add mach-gnu-color, tweaks to mach-gnu -TD -+# * make sgr for sun-color agree with smso -TD -+# * make sgr for prism9 agree with other caps -TD -+# * make sgr for icl6404 agree with other caps -TD -+# * make sgr for ofcons agree with other caps -TD -+# * make sgr for att5410v1, att4415, att620 agree with other caps -TD -+# * make sgr for aaa-unk, aaa-rv agree with other caps -TD -+# * make sgr for avt-ns agree with other caps -TD -+# -+# 2012-02-11 -+# * make sgr for xterm-pcolor agree with other caps -TD -+# * make sgr for att5425 agree with other caps -TD -+# * make sgr for att630 agree with other caps -TD -+# * make sgr for linux entries agree with other caps -TD -+# * make sgr for tvi9065 agree with other caps -TD -+# * make sgr for ncr260vt200an agree with other caps -TD -+# * make sgr for ncr160vt100pp agree with other caps -TD -+# * make sgr for ncr260vt300an agree with other caps -TD -+# * make sgr for aaa-60-dec-rv, aaa+dec agree with other caps -TD -+# * make sgr for cygwin, cygwinDBG agree with other caps -TD -+# -+# 2012-03-31 -+# * correct order of use-clauses in st-256color -TD -+# -+# 2012-04-01 -+# * revert 2011-07-16 change to "linux" alias, return to "linux2.2" -TD -+# -+# 2012-04-14 -+# * document all of the user-defined capabilities in one place -TD -+# * add XT to some places to improve usefulness for other applications -+# than screen, which would like to pretend that xterm's title is -+# a status-line. -TD -+# * change use-clauses in ansi-mtabs, hp2626, and hp2622 based on review -+# of ordering and overrides -TD -+# -+# 2012-04-21 -+# * add msgr to vt420, similar DEC vtXXX entries -TD -+# * add several missing vt420 capabilities from vt220 -TD -+# * factor out ansi+pp from several entries -TD -+# * change xterm+sl and xterm+sl-twm to include only the status-line -+# capabilities and not "use=xterm", making them more generally useful -+# as building-blocks -TD -+# * add dec+sl building block, as example -TD -+# -+# 2012-04-28 -+# * fix some inconsistencies between vt320/vt420, e.g., cnorm/civis -TD -+# * add eslok flag to dec+sl -TD -+# * dec+sl applies to vt320 and up -TD -+# * drop wsl width from xterm+sl -TD -+# * reuse xterm+sl in putty and nsca-m -TD -+# * add ansi+tabs to vt520 -TD -+# * add ansi+enq to vt220-vt520 -TD -+# -+# 2012-05-05 -+# * remove p6 (bold) from opus3n1+ for consistency -TD -+# * remove acs stuff from env230 per clues in Ingres termcap -TD -+# * modify env230 sgr/sgr0 to match other capabilities -TD -+# * modify smacs/rmacs in bq300-8 to match sgr/sgr0 -TD -+# * make sgr for dku7202 agree with other caps -TD -+# * make sgr for ibmpc agree with other caps -TD -+# * make sgr for tek4107 agree with other caps -TD -+# * make sgr for ndr9500 agree with other caps -TD -+# * make sgr for sco-ansi agree with other caps -TD -+# * make sgr for d410 agree with other caps -TD -+# * make sgr for d210 agree with other caps -TD -+# * make sgr for d470c, d470c-7b agree with other caps -TD -+# -+# 2012-05-12 -+# * rewrite vt520 entry based on vt420 -TD -+# * corrected 'op' for bterm (report by Samuel Thibault) -TD -+# -+# 2012-06-02 -+# * add kdch1 to wsvt25 entry from NetBSD CVS (reported by David Lord, -+# analysis by Martin Husemann). -+# * add cnorm/civis to wsvt25 entry from NetBSD CVS (report/analysis by -+# Onno van der Linden). -+# * add kdch1 aka "Remove" to vt220 and vt220-8 entries -TD -+# * add kdch1, etc., to qvt108 -TD -+# * add dl1/il1 to some entries based on dl/il values -TD -+# * add dl to simpleterm -TD -+# -+# 2012-06-10 -+# * modify some older xterm entries to align with xterm source -TD -+# * separate "xterm-old" alias from "xterm-r6" -TD -+# -+# 2012-07-28 -+# * add E3 to xterm-basic and putty -TD -+# -+# 2012-08-11 -+# * add nsterm-256color, make this the default nsterm -TD -+# * remove bw from nsterm-bce, per testing with tack -TD -+# -+# 2012-10-12 -+# * add vte-2012, gnome-2012, making these the defaults for vte/gnome -+# (patch by Christian Persch). -+# -+# 2012-11-02 -+# * reviewed vte-2012, reverted most of the change since it was incorrect -+# based on testing with tack -TD -+# * un-cancel the initc in vte-256color, since this was implemented -+# starting with version 0.20 in 2009 -TD -+# -+# 2013-03-16 -+# * correct typo in sgr string for sun-color, -+# add bold for consistency with sgr, -+# change smso for consistency with sgr -TD -+# * correct typo in sgr string for terminator -TD -+# * add blink to the attributes masked by ncv in linux-16color (report -+# by Benjamin Sittler) -+# -+# 2013-03-23 -+# * change initialization for vt220, similar entries for consistency -+# with cursor-key strings (NetBSD #47674) -TD -+# * further improvements to linux-16color (Benjamin Sittler) -+# -+# 2013-05-11 -+# * move nsterm-related entries out of "obsolete" section to more -+# plausible "ansi consoles" -TD -+# * additional cleanup of table-of-contents by reordering -TD -+# -+# 2013-06-07 -+# * added note to clarify Terminal.app's non-emulation of the various -+# terminal types listed in the preferences dialog -TD -+# -+# 2013-11-02 -+# * use TS extension to describe xterm's title-escapes -TD -+# * modify terminator and nsterm-s to use xterm+sl-twm building block -TD -+# * update hurd.ti, add xenl to reflect 2011-03-06 change in -+# http://git.savannah.gnu.org/cgit/hurd/hurd.git/log/console/display.c -+# (Debian #727119). -+# * simplify pfkey expression in ansi.sys -TD -+# -+# 2013-11-10 -+# * split-out building blocks xterm+sm+1002 and xterm+sm+1003 -TD -+# -+# 2014-02-22 -+# * updated notes for wsvt25 based on tack and vttest -TD -+# * add teken entry to show actual properties of FreeBSD's "xterm" -+# console -TD -+# -+# 2014-03-22 -+# * add terminology entry -TD -+# * add mlterm3 entry, use that as "mlterm" -TD -+# * inherit mlterm-256color from mlterm -TD -+# -+# 2014-03-23 -+# * fix typo in "mlterm" entry (report by Gabriele Balducci) -TD - # - ######## SHANTIH! SHANTIH! SHANTIH! -diff -Naur ncurses-5.9/mk-0th.awk ncurses-5.9.patch/mk-0th.awk ---- ncurses-5.9/mk-0th.awk 2010-01-09 22:45:41.000000000 +0100 -+++ ncurses-5.9.patch/mk-0th.awk 2014-09-01 16:33:22.368792143 +0200 -@@ -1,6 +1,6 @@ --# $Id: mk-0th.awk,v 1.18 2010/01/09 21:45:41 tom Exp $ -+# $Id: mk-0th.awk,v 1.22 2012/06/30 20:56:11 tom Exp $ - ############################################################################## --# Copyright (c) 1998-2005,2010 Free Software Foundation, Inc. # -+# Copyright (c) 1998-2010,2012 Free Software Foundation, Inc. # - # # - # Permission is hereby granted, free of charge, to any person obtaining a # - # copy of this software and associated documentation files (the "Software"), # -@@ -34,14 +34,62 @@ - # Variables: - # libname (library name, e.g., "ncurses", "panel", "forms", "menus") - # subsets (is used here to decide if wide-character code is used) -+# ticlib (library name for libtic, e.g., "tic") -+# termlib (library name for libtinfo, e.g., "tinfo") - # -+function make_lintlib(name,sources) { -+ print "" -+ print "clean ::" -+ printf "\trm -f llib-l%s.*\n", name -+ print "" -+ print "realclean ::" -+ printf "\trm -f llib-l%s\n", name -+ print "" -+ printf "llib-l%s : %s\n", name, sources -+ printf "\tcproto -a -l -DNCURSES_ENABLE_STDBOOL_H=0 -DLINT $(CPPFLAGS) %s >$@\n", sources -+ print "" -+ print "lintlib ::" -+ printf "\tsh $(srcdir)/../misc/makellib %s $(CPPFLAGS)\n", name -+ print "" -+ print "lint ::" -+ printf "\t$(LINT) $(LINT_OPTS) $(CPPFLAGS) %s $(LINT_LIBS)\n", sources -+} -+ -+# A blank in "subsets" indicates a split-off of the library into a separate -+# file, e.g., for libtic or libtinfo. They are all logical parts of the same -+# library. -+function which_library() { -+ if ( ( which == "ticlib" ) && ( subsets ~ /ticlib / ) ) { -+ return ticlib; -+ } else if ( ( which == "termlib" || which == "ext_tinfo" ) && ( subsets ~ /[[:space:]]base/ ) ) { -+ return termlib; -+ } else { -+ return libname; -+ } -+} -+ -+function show_list(name, len, list) { -+ if ( len > 0 ) { -+ printf "\n%s_SRC =", toupper(name); -+ for (n = 0; n < len; ++n) -+ printf " \\\n\t%s", list[n]; -+ print ""; -+ make_lintlib(name, sprintf("$(%s_SRC)", toupper(name))); -+ } -+} -+ - BEGIN { - which = libname; - using = 0; - found = 0; -+ count_ticlib = 0; -+ count_termlib = 0; -+ count_library = 0; - } - /^@/ { - which = $0; -+ sub(/^@[[:blank:]]+/, "", which); -+ sub(/[[:blank:]]+$/, "", which); - } - !/^[@#]/ { - if (using == 0) -@@ -50,6 +98,10 @@ - print "# generated by mk-0th.awk" - printf "# libname: %s\n", libname - printf "# subsets: %s\n", subsets -+ if ( libname ~ /ncurses/ ) { -+ printf "# ticlib: %s\n", ticlib -+ printf "# termlib: %s\n", termlib -+ } - print "" - print ".SUFFIXES: .c .cc .h .i .ii" - print ".c.i :" -@@ -80,9 +132,18 @@ - found = 2 - } - if ( libname == "c++" || libname == "c++w" ) { -- printf " \\\n\t%s/%s.cc", $3, $1 -+ srcname = sprintf("%s/%s.cc", $3, $1); -+ printf " \\\n\t%s", srcname; - } else if ( widechar == 1 || $3 != "$(wide)" ) { -- printf " \\\n\t%s/%s.c", $3, $1 -+ srcname = sprintf("%s/%s.c", $3, $1); -+ printf " \\\n\t%s", srcname; -+ if ( which_library() == libname ) { -+ list_library[count_library++] = srcname; -+ } else if ( which_library() == ticlib ) { -+ list_ticlib[count_ticlib++] = srcname; -+ } else { -+ list_termlib[count_termlib++] = srcname; -+ } - } - } - } -@@ -91,22 +152,11 @@ - if ( found == 1 ) - { - print "" -- printf "# Producing llib-l%s is time-consuming, so there's no direct-dependency for\n", libname -- print "# it in the lintlib rule. We'll only remove in the cleanest setup." -- print "clean ::" -- printf "\trm -f llib-l%s.*\n", libname -- print "" -- print "realclean ::" -- printf "\trm -f llib-l%s\n", libname -- print "" -- printf "llib-l%s : $(C_SRC)\n", libname -- printf "\tcproto -a -l -DNCURSES_ENABLE_STDBOOL_H=0 -DLINT $(CPPFLAGS) $(C_SRC) >$@\n" -- print "" -- print "lintlib :" -- printf "\tsh $(srcdir)/../misc/makellib %s $(CPPFLAGS)", libname -- print "" -- print "lint :" -- print "\t$(LINT) $(LINT_OPTS) $(CPPFLAGS) $(C_SRC) $(LINT_LIBS)" -+ printf "# Producing llib-l%s is time-consuming, so there's no direct-dependency for\n", libname; -+ print "# it in the lintlib rule. We'll only remove in the cleanest setup."; -+ show_list(libname, count_library, list_library); -+ show_list(ticlib, count_ticlib, list_ticlib); -+ show_list(termlib, count_termlib, list_termlib); - } - else - { -@@ -115,3 +165,4 @@ - print "\t@echo no action needed" - } - } -+# vile:ts=4 sw=4 -diff -Naur ncurses-5.9/mk-1st.awk ncurses-5.9.patch/mk-1st.awk ---- ncurses-5.9/mk-1st.awk 2010-08-07 22:42:30.000000000 +0200 -+++ ncurses-5.9.patch/mk-1st.awk 2014-09-01 16:33:22.369792144 +0200 -@@ -1,6 +1,6 @@ --# $Id: mk-1st.awk,v 1.85 2010/08/07 20:42:30 Gabriele.Balducci Exp $ -+# $Id: mk-1st.awk,v 1.96 2013/09/07 17:54:05 Alexey.Pavlov Exp $ - ############################################################################## --# Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. # -+# Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. # - # # - # Permission is hereby granted, free of charge, to any person obtaining a # - # copy of this software and associated documentation files (the "Software"), # -@@ -34,10 +34,12 @@ - # name (library name, e.g., "ncurses", "panel", "forms", "menus") - # traces ("all" or "DEBUG", to control whether tracing is compiled in) - # MODEL (e.g., "DEBUG", uppercase; toupper is not portable) -+# CXX_MODEL (e.g., "DEBUG", uppercase) - # model (directory into which we compile, e.g., "obj") - # prefix (e.g., "lib", for Unix-style libraries) - # suffix (e.g., "_g.a", for debug libraries) - # subset ("none", "base", "base+ext_funcs" or "termlib", etc.) -+# driver ("yes" or "no", depends on --enable-term-driver) - # ShlibVer ("rel", "abi" or "auto", to augment DoLinks variable) - # ShlibVerInfix ("yes" or "no", determines location of version #) - # SymLink ("ln -s", etc) -@@ -69,7 +71,7 @@ - } - # see imp_name - function imp_name_of(a_name) { -- if (ShlibVerInfix == "cygdll") { -+ if (ShlibVerInfix == "cygdll" || ShlibVerInfix == "msysdll" || ShlibVerInfix == "mingw") { - result = sprintf("%s%s%s.a", prefix, a_name, suffix); - } else { - result = ""; -@@ -80,6 +82,10 @@ - function abi_name_of(a_name) { - if (ShlibVerInfix == "cygdll") { - result = sprintf("%s%s$(ABI_VERSION)%s", "cyg", a_name, suffix); -+ } else if (ShlibVerInfix == "msysdll") { -+ result = sprintf("%s%s$(ABI_VERSION)%s", "msys-", a_name, suffix); -+ } else if (ShlibVerInfix == "mingw") { -+ result = sprintf("%s%s$(ABI_VERSION)%s", prefix, a_name, suffix); - } else if (ShlibVerInfix == "yes") { - result = sprintf("%s%s.$(ABI_VERSION)%s", prefix, a_name, suffix); - } else { -@@ -91,6 +97,10 @@ - function rel_name_of(a_name) { - if (ShlibVerInfix == "cygdll") { - result = sprintf("%s%s$(REL_VERSION)%s", "cyg", a_name, suffix); -+ } else if (ShlibVerInfix == "msysdll") { -+ result = sprintf("%s%s$(ABI_VERSION)%s", "msys-", a_name, suffix); -+ } else if (ShlibVerInfix == "mingw") { -+ result = sprintf("%s%s$(REL_VERSION)%s", prefix, a_name, suffix); - } else if (ShlibVerInfix == "yes") { - result = sprintf("%s%s.$(REL_VERSION)%s", prefix, a_name, suffix); - } else { -@@ -107,7 +117,7 @@ - } else { - if ( ShlibVer == "rel" ) { - result = rel_name_of(a_name); -- } else if ( ShlibVer == "abi" || ShlibVer == "cygdll" ) { -+ } else if ( ShlibVer == "abi" || ShlibVer == "cygdll" || ShlibVer == "msysdll" || ShlibVer == "mingw" ) { - result = abi_name_of(a_name); - } else { - result = lib_name_of(a_name); -@@ -124,23 +134,38 @@ - } - } - function rmlink(directory, dst) { -- printf "\t-rm -f %s/%s\n", directory, dst -+ if ( dst != "" ) { -+ printf "\t-rm -f %s/%s\n", directory, dst -+ } - } - function removelinks(directory) { -- rmlink(directory, end_name); -+ nlinks = 0; -+ links[nlinks++] = end_name; - if ( DoLinks == "reverse" ) { - if ( ShlibVer == "rel" ) { -- rmlink(directory, abi_name); -- rmlink(directory, rel_name); -+ links[nlinks++] = abi_name; -+ links[nlinks++] = rel_name; - } else if ( ShlibVer == "abi" ) { -- rmlink(directory, abi_name); -+ links[nlinks++] = abi_name; - } - } else { - if ( ShlibVer == "rel" ) { -- rmlink(directory, abi_name); -- rmlink(directory, lib_name); -+ links[nlinks++] = abi_name; -+ links[nlinks++] = lib_name; - } else if ( ShlibVer == "abi" ) { -- rmlink(directory, lib_name); -+ links[nlinks++] = lib_name; -+ } -+ } -+ for (j = 0; j < nlinks; ++j) { -+ found = 0; -+ for (k = 0; k < j; ++k ) { -+ if ( links[j] == links[k] ) { -+ found = 1; -+ break; -+ } -+ } -+ if ( !found ) { -+ rmlink(directory, links[j]); - } - } - } -@@ -148,7 +173,7 @@ - printf "\t$(MK_SHARED_LIB) $(%s_OBJS) $(%s) $(LDFLAGS)\n", objs, shlib_list - } - function sharedlinks(directory) { -- if ( ShlibVer != "auto" && ShlibVer != "cygdll" ) { -+ if ( ShlibVer != "auto" && ShlibVer != "cygdll" && ShlibVer != "msysdll" && ShlibVer != "mingw" ) { - printf "\tcd %s && (", directory - if ( DoLinks == "reverse" ) { - if ( ShlibVer == "rel" ) { -@@ -181,6 +206,11 @@ - dst_libs = sprintf("%s/%s", directory, end_name); - printf "%s : \\\n", dst_libs - printf "\t\t%s \\\n", directory -+ if (subset == "ticlib" && driver == "yes" ) { -+ base = name; -+ sub(/^tic/, "ncurses", base); # workaround for "w" -+ printf "\t\t%s/%s \\\n", directory, end_name_of(base); -+ } - if (subset ~ /^base/ || subset == "ticlib" ) { - save_suffix = suffix - sub(/^[^.]\./,".",suffix) -@@ -223,8 +253,9 @@ - printf "\t%s %s %s\n", program, src_name, dst_name - } - BEGIN { -- found = 0 -- using = 0 -+ TOOL_PREFIX = ""; -+ found = 0; -+ using = 0; - } - /^@/ { - using = 0 -@@ -233,15 +264,26 @@ - } else if (index(subset,$2) > 0) { - if (using == 0) { - if (found == 0) { -+ if ( name ~ /^.*\+\+.*/ ) { -+ if ( CXX_MODEL == "NORMAL" && MODEL == "SHARED" ) { -+ print "" -+ printf "# overriding model from %s to match CXX_MODEL\n", MODEL; -+ MODEL = "NORMAL"; -+ suffix = ".a"; -+ DoLinks = "no"; -+ } -+ } - print "" - printf "# generated by mk-1st.awk (subset=%s)\n", subset - printf "# name: %s\n", name - printf "# traces: %s\n", traces - printf "# MODEL: %s\n", MODEL -+ printf "# CXX_MODEL: %s\n", CXX_MODEL - printf "# model: %s\n", model - printf "# prefix: %s\n", prefix - printf "# suffix: %s\n", suffix - printf "# subset: %s\n", subset -+ printf "# driver: %s\n", driver - printf "# ShlibVer: %s\n", ShlibVer - printf "# ShlibVerInfix: %s\n", ShlibVerInfix - printf "# SymLink: %s\n", SymLink -@@ -285,12 +327,23 @@ - if ( found == 0 ) - { - printf "%s_OBJS =", OBJS -- if ( $2 == "lib" ) -- found = 1 -- else -- found = 2 -+ if ( $2 == "lib" ) { -+ found = 1; -+ } else if ( $2 == "c++" ) { -+ TOOL_PREFIX = "CXX_"; -+ found = 1; -+ } else { -+ found = 2; -+ } -+ if ( $2 == "c++" ) { -+ CC_NAME="CXX" -+ CC_FLAG="CXXFLAGS" -+ } else { -+ CC_NAME="CC" -+ CC_FLAG="CFLAGS" -+ } - } -- printf " \\\n\t../%s/%s$o", model, $1 -+ printf " \\\n\t../%s/%s$o", model, $1; - } - } - END { -@@ -316,7 +369,7 @@ - print "install \\" - print "install.libs \\" - -- if ( ShlibVer == "cygdll" ) { -+ if ( ShlibVer == "cygdll" || ShlibVer == "msysdll" || ShlibVer == "mingw") { - - dst_dirs = "$(DESTDIR)$(bindir) $(DESTDIR)$(libdir)"; - printf "install.%s :: %s $(LIBRARIES)\n", name, dst_dirs -@@ -337,7 +390,7 @@ - - if ( overwrite == "yes" && name == "ncurses" ) - { -- if ( ShlibVer == "cygdll" ) { -+ if ( ShlibVer == "cygdll" || ShlibVer == "msysdll" || ShlibVer == "mingw") { - ovr_name = sprintf("libcurses%s.a", suffix) - printf "\t@echo linking %s to %s\n", imp_name, ovr_name - printf "\tcd $(DESTDIR)$(libdir) && (" -@@ -358,7 +411,7 @@ - print "uninstall \\" - print "uninstall.libs \\" - printf "uninstall.%s ::\n", name -- if ( ShlibVer == "cygdll" ) { -+ if ( ShlibVer == "cygdll" || ShlibVer == "msysdll" || ShlibVer == "mingw") { - - printf "\t@echo uninstalling $(DESTDIR)$(bindir)/%s\n", end_name - printf "\t-@rm -f $(DESTDIR)$(bindir)/%s\n", end_name -@@ -371,11 +424,7 @@ - removelinks("$(DESTDIR)$(libdir)") - if ( overwrite == "yes" && name == "ncurses" ) - { -- if ( ShlibVer == "cygdll" ) { -- ovr_name = sprintf("libcurses%s.a", suffix) -- } else { -- ovr_name = sprintf("libcurses%s", suffix) -- } -+ ovr_name = sprintf("libcurses%s", suffix) - printf "\t-@rm -f $(DESTDIR)$(libdir)/%s\n", ovr_name - } - } -@@ -388,20 +437,19 @@ - } - else if ( MODEL == "LIBTOOL" ) - { -- if ( $2 == "c++" ) { -- compile="CXX" -- } else { -- compile="CC" -- } - end_name = lib_name; - printf "../lib/%s : $(%s_OBJS)\n", lib_name, OBJS - if ( is_ticlib() ) { -- printf "\tcd ../lib && $(LIBTOOL_LINK) $(%s) -o %s $(%s_OBJS:$o=.lo) -rpath $(DESTDIR)$(libdir) %s $(NCURSES_MAJOR):$(NCURSES_MINOR) $(LT_UNDEF) $(TICS_LIST)\n", compile, lib_name, OBJS, libtool_version -+ which_list = "TICS_LIST"; - } else if ( is_termlib() ) { -- printf "\tcd ../lib && $(LIBTOOL_LINK) $(%s) -o %s $(%s_OBJS:$o=.lo) -rpath $(DESTDIR)$(libdir) %s $(NCURSES_MAJOR):$(NCURSES_MINOR) $(LT_UNDEF) $(TINFO_LIST)\n", compile, lib_name, OBJS, libtool_version -+ which_list = "TINFO_LIST"; - } else { -- printf "\tcd ../lib && $(LIBTOOL_LINK) $(%s) -o %s $(%s_OBJS:$o=.lo) -rpath $(DESTDIR)$(libdir) %s $(NCURSES_MAJOR):$(NCURSES_MINOR) $(LT_UNDEF) $(SHLIB_LIST)\n", compile, lib_name, OBJS, libtool_version -+ which_list = "SHLIB_LIST"; - } -+ printf "\tcd ../lib && $(LIBTOOL_LINK) $(%s) $(%s) \\\n", CC_NAME, CC_FLAG; -+ printf "\t\t-o %s $(%s_OBJS:$o=.lo) \\\n", lib_name, OBJS; -+ printf "\t\t-rpath $(DESTDIR)$(libdir) \\\n"; -+ printf "\t\t%s $(NCURSES_MAJOR):$(NCURSES_MINOR) $(LT_UNDEF) $(%s) $(LDFLAGS)\n", libtool_version, which_list; - print "" - print "install \\" - print "install.libs \\" -@@ -419,7 +467,7 @@ - { - end_name = lib_name; - printf "../lib/%s : $(%s_OBJS)\n", lib_name, OBJS -- printf "\t$(AR) $(ARFLAGS) $@ $?\n" -+ printf "\t$(%sAR) $(%sARFLAGS) $@ $?\n", TOOL_PREFIX, TOOL_PREFIX; - printf "\t$(RANLIB) $@\n" - if ( host == "vxworks" ) - { -diff -Naur ncurses-5.9/mk-dlls.sh.in ncurses-5.9.patch/mk-dlls.sh.in ---- ncurses-5.9/mk-dlls.sh.in 2010-12-25 23:25:41.000000000 +0100 -+++ ncurses-5.9.patch/mk-dlls.sh.in 1970-01-01 01:00:00.000000000 +0100 -@@ -1,114 +0,0 @@ --#!/bin/sh --# $Id: mk-dlls.sh.in,v 1.3 2010/12/25 22:25:41 tom Exp $ --############################################################################## --# Copyright (c) 2008,2010 Free Software Foundation, Inc. # --# # --# Permission is hereby granted, free of charge, to any person obtaining a # --# copy of this software and associated documentation files (the "Software"), # --# to deal in the Software without restriction, including without limitation # --# the rights to use, copy, modify, merge, publish, distribute, distribute # --# with modifications, sublicense, and/or sell copies of the Software, and to # --# permit persons to whom the Software is furnished to do so, subject to the # --# following conditions: # --# # --# The above copyright notice and this permission notice shall be included in # --# all copies or substantial portions of the Software. # --# # --# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # --# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # --# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL # --# THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # --# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # --# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER # --# DEALINGS IN THE SOFTWARE. # --# # --# Except as contained in this notice, the name(s) of the above copyright # --# holders shall not be used in advertising or otherwise to promote the sale, # --# use or other dealings in this Software without prior written # --# authorization. # --############################################################################## --# --# Author: Juergen Pfeifer --# --# Build DLLs on MinGW --# --LC_ALL=C @CC@ -v 2>&1 | grep Target | grep mingw --if [ $? -eq 1 ]; then -- echo "$0 requires a mingw environment" >&2 --else -- mkdir "$TEMP/tmp-dll" -- cat > "$TEMP/tmp-dll/arch.c" <<EOF --#include <stdio.h> --int main() --{ -- printf("%d",8*sizeof(void*)); -- return(0); --} --EOF -- pushd "$TEMP/tmp-dll" -- @CC@ -o arch arch.c -- ARCH=`./arch` -- cd .. -- rm -rf tmp-dll -- popd -- echo $ARCH > mingw_arch -- echo Building DLLs and Import Libraries for Win${ARCH} -- -- if [ -d lib ]; then -- cf="-shared" -- lf="--enable-auto-import" -- pushd lib 2>&1 >/dev/null -- for t in "" "t" -- do -- for m in "" "_g" -- do -- if [ -f libncurses${t}${m}.a ]; then -- f=libncurses${t}${m}.a -- g=ncurses${t}${m} -- gi=libw${g}.dll.a -- td=$TEMP/tmp-${g} -- bd=`pwd` -- rm -rf "${td}" -- mkdir "${td}" -- pushd "${td}" -- ar x "${bd}/${f}" `ar t "${bd}/${f}"` -- @CC@ $cf -o w${g}.dll -Wl,--out-implib,${gi} -Wl,--output-def,w${g}.def -Wl,$lf `ar t "${bd}/$f"` @LIBS@ -- lib //NOLOGO /MACHINE:i386 /DEF:w${g}.def -- rm -f `ar t "${bd}/$f"` -- mv w${g}.dll "${bd}" -- mv w${g}.lib "${bd}" -- mv ${gi} "${bd}" -- popd -- rm -rf "${td}" -- -- for l in panel menu form -- do -- for f in lib${l}${t}${m}.a -- do -- g=${l}${t}${m} -- td=$TEMP/tmp-${g} -- gi2=libw${g}.dll.a -- bd=`pwd` -- rm -rf "${td}" -- mkdir "${td}" -- echo $g -- pushd "${td}" -- ar x "${bd}/$f" `ar t "${bd}/$f"` -- @CC@ $cf -o w${g}.dll -Wl,--out-implib,${gi2} -Wl,--output-def,w${g}.def -Wl,$lf `ar t "${bd}/$f"` "${bd}/${gi}" @LIBS@ -- lib //NOLOGO /MACHINE:i386 /DEF:w${g}.def -- rm -f `ar t "${bd}/$f"` -- mv w${g}.dll "${bd}" -- mv w${g}.lib "${bd}" -- mv ${gi2} "${bd}" -- popd -- rm -rf "${td}" -- done -- done -- fi -- done -- done -- popd -- else -- echo lib has not been built >&2 -- fi --fi -diff -Naur ncurses-5.9/mk-hdr.awk ncurses-5.9.patch/mk-hdr.awk ---- ncurses-5.9/mk-hdr.awk 2010-05-15 22:10:42.000000000 +0200 -+++ ncurses-5.9.patch/mk-hdr.awk 2014-09-01 16:33:22.369792144 +0200 -@@ -1,6 +1,6 @@ --# $Id: mk-hdr.awk,v 1.3 2010/05/15 20:10:42 tom Exp $ -+# $Id: mk-hdr.awk,v 1.4 2013/08/03 23:09:42 tom Exp $ - ############################################################################## --# Copyright (c) 2007,2010 Free Software Foundation, Inc. # -+# Copyright (c) 2007-2010,2013 Free Software Foundation, Inc. # - # # - # Permission is hereby granted, free of charge, to any person obtaining a # - # copy of this software and associated documentation files (the "Software"), # -@@ -73,12 +73,12 @@ - END { - if ( count > 0 ) - { -- print "${DESTDIR}${includedir} :" -+ print "${INCLUDEDIR} :" - print " mkdir -p $@" - print "" - print "install \\" - print "install.libs \\" -- print "install.includes :: ${AUTO_SRC} ${DESTDIR}${includedir} \\" -+ print "install.includes :: ${AUTO_SRC} ${INCLUDEDIR} \\" - - for (i = 0; i < count - 1; ++i) { - printf " %s \\\n", data[i] -@@ -86,9 +86,9 @@ - printf " %s\n", data[count - 1] - - for (i = 0; i < count; ++i) { -- printf " @ (cd ${DESTDIR}${includedir} && rm -f %s) ; ../headers.sh ${INSTALL_DATA} ${DESTDIR}${includedir} ${srcdir} %s\n", basename(data[i]), data[i] -+ printf " @ (cd ${INCLUDEDIR} && rm -f %s) ; ../headers.sh ${INSTALL_DATA} ${INCLUDEDIR} ${srcdir} %s\n", basename(data[i]), data[i] - if (data[i] == "curses.h" && compat == "yes") { -- printf " @ (cd ${DESTDIR}${includedir} && rm -f ncurses.h && ${LN_S} %s ncurses.h)\n", data[i] -+ printf " @ (cd ${INCLUDEDIR} && rm -f ncurses.h && ${LN_S} %s ncurses.h)\n", data[i] - } - } - print "" -@@ -97,9 +97,9 @@ - print "uninstall.includes ::" - - for (i = 0; i < count; ++i) { -- printf " -@ (cd ${DESTDIR}${includedir} && rm -f %s)\n", basename(data[i]) -+ printf " -@ (cd ${INCLUDEDIR} && rm -f %s)\n", basename(data[i]) - if (data[i] == "curses.h" && compat == "yes") { -- printf " -@ (cd ${DESTDIR}${includedir} && rm -f ncurses.h)\n" -+ printf " -@ (cd ${INCLUDEDIR} && rm -f ncurses.h)\n" - } - } - } -diff -Naur ncurses-5.9/ncurses/base/define_key.c ncurses-5.9.patch/ncurses/base/define_key.c ---- ncurses-5.9/ncurses/base/define_key.c 2009-11-28 23:53:17.000000000 +0100 -+++ ncurses-5.9.patch/ncurses/base/define_key.c 2014-09-01 16:33:22.370792146 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2006,2009 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2009,2014 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -33,7 +33,7 @@ - - #include <curses.priv.h> - --MODULE_ID("$Id: define_key.c,v 1.20 2009/11/28 22:53:17 tom Exp $") -+MODULE_ID("$Id: define_key.c,v 1.21 2014/03/08 20:32:59 tom Exp $") - - NCURSES_EXPORT(int) - NCURSES_SP_NAME(define_key) (NCURSES_SP_DCLx const char *str, int keycode) -@@ -47,7 +47,7 @@ - unsigned ukey = (unsigned) keycode; - - #ifdef USE_TERM_DRIVER --#define CallHasKey(keycode) CallDriver_1(SP_PARM, kyExist, keycode) -+#define CallHasKey(keycode) CallDriver_1(SP_PARM, td_kyExist, keycode) - #else - #define CallHasKey(keycode) NCURSES_SP_NAME(has_key)(NCURSES_SP_ARGx keycode) - #endif -diff -Naur ncurses-5.9/ncurses/base/keybound.c ncurses-5.9.patch/ncurses/base/keybound.c ---- ncurses-5.9/ncurses/base/keybound.c 2009-10-25 00:15:47.000000000 +0200 -+++ ncurses-5.9.patch/ncurses/base/keybound.c 2014-09-01 16:33:22.370792146 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1999-2006,2009 Free Software Foundation, Inc. * -+ * Copyright (c) 1999-2009,2011 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -33,7 +33,7 @@ - - #include <curses.priv.h> - --MODULE_ID("$Id: keybound.c,v 1.10 2009/10/24 22:15:47 tom Exp $") -+MODULE_ID("$Id: keybound.c,v 1.11 2011/10/22 16:47:05 tom Exp $") - - /* - * Returns the count'th string definition which is associated with the -@@ -46,7 +46,10 @@ - - T((T_CALLED("keybound(%p, %d,%d)"), (void *) SP_PARM, code, count)); - if (SP_PARM != 0 && code >= 0) { -- result = _nc_expand_try(SP_PARM->_keytry, (unsigned) code, &count, 0); -+ result = _nc_expand_try(SP_PARM->_keytry, -+ (unsigned) code, -+ &count, -+ (size_t) 0); - } - returnPtr(result); - } -diff -Naur ncurses-5.9/ncurses/base/keyok.c ncurses-5.9.patch/ncurses/base/keyok.c ---- ncurses-5.9/ncurses/base/keyok.c 2009-10-25 00:15:47.000000000 +0200 -+++ ncurses-5.9.patch/ncurses/base/keyok.c 2014-09-01 16:33:22.370792146 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2006,2009 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2012,2014 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -33,7 +33,7 @@ - - #include <curses.priv.h> - --MODULE_ID("$Id: keyok.c,v 1.10 2009/10/24 22:15:47 tom Exp $") -+MODULE_ID("$Id: keyok.c,v 1.14 2014/03/08 20:32:59 tom Exp $") - - /* - * Enable (or disable) ncurses' interpretation of a keycode by adding (or -@@ -50,37 +50,47 @@ - { - int code = ERR; - -- T((T_CALLED("keyok(%p, %d,%d)"), (void *) SP_PARM, c, flag)); -+ if (HasTerminal(SP_PARM)) { -+ T((T_CALLED("keyok(%p, %d,%d)"), (void *) SP_PARM, c, flag)); - #ifdef USE_TERM_DRIVER -- code = CallDriver_2(sp, kyOk, c, flag); -+ code = CallDriver_2(sp, td_kyOk, c, flag); - #else -- T((T_CALLED("keyok(%d,%d)"), c, flag)); -- if (c >= 0) { -- int count = 0; -- char *s; -- unsigned ch = (unsigned) c; -- -- if (flag) { -- while ((s = _nc_expand_try(SP_PARM->_key_ok, ch, &count, 0)) != 0 -- && _nc_remove_key(&(SP_PARM->_key_ok), ch)) { -- code = _nc_add_to_try(&(SP_PARM->_keytry), s, ch); -- free(s); -- count = 0; -- if (code != OK) -- break; -- } -- } else { -- while ((s = _nc_expand_try(SP_PARM->_keytry, ch, &count, 0)) != 0 -- && _nc_remove_key(&(SP_PARM->_keytry), ch)) { -- code = _nc_add_to_try(&(SP_PARM->_key_ok), s, ch); -- free(s); -- count = 0; -- if (code != OK) -- break; -+ T((T_CALLED("keyok(%d,%d)"), c, flag)); -+ if (c >= 0) { -+ int count = 0; -+ char *s; -+ unsigned ch = (unsigned) c; -+ -+ if (flag) { -+ while ((s = _nc_expand_try(SP_PARM->_key_ok, -+ ch, &count, (size_t) 0)) != 0) { -+ if (_nc_remove_key(&(SP_PARM->_key_ok), ch)) { -+ code = _nc_add_to_try(&(SP_PARM->_keytry), s, ch); -+ free(s); -+ count = 0; -+ if (code != OK) -+ break; -+ } else { -+ free(s); -+ } -+ } -+ } else { -+ while ((s = _nc_expand_try(SP_PARM->_keytry, -+ ch, &count, (size_t) 0)) != 0) { -+ if (_nc_remove_key(&(SP_PARM->_keytry), ch)) { -+ code = _nc_add_to_try(&(SP_PARM->_key_ok), s, ch); -+ free(s); -+ count = 0; -+ if (code != OK) -+ break; -+ } else { -+ free(s); -+ } -+ } - } - } -- } - #endif -+ } - returnCode(code); - } - -diff -Naur ncurses-5.9/ncurses/base/lib_addch.c ncurses-5.9.patch/ncurses/base/lib_addch.c ---- ncurses-5.9/ncurses/base/lib_addch.c 2010-04-25 00:41:05.000000000 +0200 -+++ ncurses-5.9.patch/ncurses/base/lib_addch.c 2014-09-01 16:33:22.370792146 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2013,2014 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -36,7 +36,7 @@ - #include <curses.priv.h> - #include <ctype.h> - --MODULE_ID("$Id: lib_addch.c,v 1.124 2010/04/24 22:41:05 tom Exp $") -+MODULE_ID("$Id: lib_addch.c,v 1.128 2014/02/23 01:21:08 tom Exp $") - - static const NCURSES_CH_T blankchar = NewChar(BLANK_TEXT); - -@@ -209,7 +209,8 @@ - buffer[WINDOW_EXT(win, addch_used)] = '\0'; - if ((len = (int) mbrtowc(&result, - buffer, -- WINDOW_EXT(win, addch_used), &state)) > 0) { -+ (size_t) WINDOW_EXT(win, addch_used), -+ &state)) > 0) { - attr_t attrs = AttrOf(CHDEREF(ch)); - if_EXT_COLORS(int pair = GetPair(CHDEREF(ch))); - SetChar(CHDEREF(ch), result, attrs); -@@ -411,10 +412,12 @@ - #endif - const char *s = NCURSES_SP_NAME(unctrl) (NCURSES_SP_ARGx t); - int tabsize = 8; -+ - /* - * If we are using the alternate character set, forget about locale. - * Otherwise, if unctrl() returns a single-character or the locale -- * claims the code is printable, treat it that way. -+ * claims the code is printable (and not also a control character), -+ * treat it that way. - */ - if ((AttrOf(ch) & A_ALTCHARSET) - || ( -@@ -424,14 +427,15 @@ - s[1] == 0 - ) - || ( -- isprint(t) -+ (isprint((int)t) && !iscntrl((int)t)) - #if USE_WIDEC_SUPPORT - || ((sp == 0 || !sp->_legacy_coding) && - (WINDOW_EXT(win, addch_used) - || !_nc_is_charable(CharOf(ch)))) - #endif -- )) -+ )) { - return waddch_literal(win, ch); -+ } - - /* - * Handle carriage control and other codes that are not printable, or are -diff -Naur ncurses-5.9/ncurses/base/lib_addstr.c ncurses-5.9.patch/ncurses/base/lib_addstr.c ---- ncurses-5.9/ncurses/base/lib_addstr.c 2010-12-19 02:22:58.000000000 +0100 -+++ ncurses-5.9.patch/ncurses/base/lib_addstr.c 2014-09-01 16:33:22.370792146 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2010,2011 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -44,7 +44,7 @@ - - #include <curses.priv.h> - --MODULE_ID("$Id: lib_addstr.c,v 1.51 2010/12/19 01:22:58 tom Exp $") -+MODULE_ID("$Id: lib_addstr.c,v 1.52 2011/05/28 23:02:09 tom Exp $") - - NCURSES_EXPORT(int) - waddnstr(WINDOW *win, const char *astr, int n) -@@ -119,8 +119,10 @@ - _nc_wchstrlen(const cchar_t *s) - { - int result = 0; -- while (CharOf(s[result]) != L'\0') { -- result++; -+ if (s != 0) { -+ while (CharOf(s[result]) != L'\0') { -+ result++; -+ } - } - return result; - } -diff -Naur ncurses-5.9/ncurses/base/lib_beep.c ncurses-5.9.patch/ncurses/base/lib_beep.c ---- ncurses-5.9/ncurses/base/lib_beep.c 2009-10-25 00:02:14.000000000 +0200 -+++ ncurses-5.9.patch/ncurses/base/lib_beep.c 2014-09-01 16:33:22.370792146 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2008,2009 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2013,2014 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -46,7 +46,7 @@ - #define CUR SP_TERMTYPE - #endif - --MODULE_ID("$Id: lib_beep.c,v 1.15 2009/10/24 22:02:14 tom Exp $") -+MODULE_ID("$Id: lib_beep.c,v 1.17 2014/03/08 20:32:59 tom Exp $") - - /* - * beep() -@@ -65,18 +65,15 @@ - - #ifdef USE_TERM_DRIVER - if (SP_PARM != 0) -- res = CallDriver_1(SP_PARM, doBeepOrFlash, TRUE); -+ res = CallDriver_1(SP_PARM, td_doBeepOrFlash, TRUE); - #else - /* FIXME: should make sure that we are not in altchar mode */ - if (cur_term == 0) { - res = ERR; - } else if (bell) { -- TPUTS_TRACE("bell"); -- res = putp(bell); -- _nc_flush(); -+ res = NCURSES_PUTP2_FLUSH("bell", bell); - } else if (flash_screen) { -- TPUTS_TRACE("flash_screen"); -- res = putp(flash_screen); -+ res = NCURSES_PUTP2_FLUSH("flash_screen", flash_screen); - _nc_flush(); - } - #endif -diff -Naur ncurses-5.9/ncurses/base/lib_bkgd.c ncurses-5.9.patch/ncurses/base/lib_bkgd.c ---- ncurses-5.9/ncurses/base/lib_bkgd.c 2011-01-22 20:47:37.000000000 +0100 -+++ ncurses-5.9.patch/ncurses/base/lib_bkgd.c 2014-09-01 16:33:22.370792146 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2010,2011 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -36,7 +36,7 @@ - - #include <curses.priv.h> - --MODULE_ID("$Id: lib_bkgd.c,v 1.43 2011/01/22 19:47:37 tom Exp $") -+MODULE_ID("$Id: lib_bkgd.c,v 1.48 2012/12/09 01:01:19 tom Exp $") - - /* - * Set the window's background information. -@@ -85,6 +85,7 @@ - cchar_t wch; - int tmp; - -+ memset(&wch, 0, sizeof(wch)); - (void) wgetbkgrnd(win, &wch); - tmp = _nc_to_char((wint_t) CharOf(wch)); - -@@ -118,16 +119,18 @@ - { - int code = ERR; - int x, y; -- NCURSES_CH_T new_bkgd = CHDEREF(ch); - - T((T_CALLED("wbkgd(%p,%s)"), (void *) win, _tracech_t(ch))); - - if (win) { -+ NCURSES_CH_T new_bkgd = CHDEREF(ch); - NCURSES_CH_T old_bkgrnd; -+ -+ memset(&old_bkgrnd, 0, sizeof(old_bkgrnd)); - wgetbkgrnd(win, &old_bkgrnd); - - (void) wbkgrndset(win, CHREF(new_bkgd)); -- (void) wattrset(win, AttrOf(win->_nc_bkgd)); -+ (void) wattrset(win, (int) AttrOf(win->_nc_bkgd)); - - for (y = 0; y <= win->_maxy; y++) { - for (x = 0; x <= win->_maxx; x++) { -diff -Naur ncurses-5.9/ncurses/base/lib_chgat.c ncurses-5.9.patch/ncurses/base/lib_chgat.c ---- ncurses-5.9/ncurses/base/lib_chgat.c 2010-04-01 01:38:02.000000000 +0200 -+++ ncurses-5.9.patch/ncurses/base/lib_chgat.c 2014-09-01 16:33:22.370792146 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2010,2014 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -42,14 +42,22 @@ - - #include <curses.priv.h> - --MODULE_ID("$Id: lib_chgat.c,v 1.9 2010/03/31 23:38:02 tom Exp $") -+MODULE_ID("$Id: lib_chgat.c,v 1.10 2014/02/01 22:13:31 tom Exp $") - - NCURSES_EXPORT(int) --wchgat(WINDOW *win, int n, attr_t attr, short color, const void *opts GCC_UNUSED) -+wchgat(WINDOW *win, -+ int n, -+ attr_t attr, -+ NCURSES_PAIRS_T color, -+ const void *opts GCC_UNUSED) - { - int i; - -- T((T_CALLED("wchgat(%p,%d,%s,%d)"), (void *) win, n, _traceattr(attr), color)); -+ T((T_CALLED("wchgat(%p,%d,%s,%d)"), -+ (void *) win, -+ n, -+ _traceattr(attr), -+ (int) color)); - - if (win) { - struct ldat *line = &(win->_line[win->_cury]); -diff -Naur ncurses-5.9/ncurses/base/lib_color.c ncurses-5.9.patch/ncurses/base/lib_color.c ---- ncurses-5.9/ncurses/base/lib_color.c 2010-04-25 00:57:53.000000000 +0200 -+++ ncurses-5.9.patch/ncurses/base/lib_color.c 2014-09-01 16:33:22.371792147 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2013,2014 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -45,7 +45,7 @@ - #define CUR SP_TERMTYPE - #endif - --MODULE_ID("$Id: lib_color.c,v 1.98 2010/04/24 22:57:53 tom Exp $") -+MODULE_ID("$Id: lib_color.c,v 1.110 2014/03/08 20:04:44 tom Exp $") - - #ifdef USE_TERM_DRIVER - #define CanChange InfoOf(SP_PARM).canchange -@@ -188,7 +188,7 @@ - set_background_color(NCURSES_SP_DCLx int bg, NCURSES_SP_OUTC outc) - { - #ifdef USE_TERM_DRIVER -- CallDriver_3(SP_PARM, color, FALSE, bg, outc); -+ CallDriver_3(SP_PARM, td_color, FALSE, bg, outc); - #else - if (set_a_background) { - TPUTS_TRACE("set_a_background"); -@@ -208,7 +208,7 @@ - set_foreground_color(NCURSES_SP_DCLx int fg, NCURSES_SP_OUTC outc) - { - #ifdef USE_TERM_DRIVER -- CallDriver_3(SP_PARM, color, TRUE, fg, outc); -+ CallDriver_3(SP_PARM, td_color, TRUE, fg, outc); - #else - if (set_a_foreground) { - TPUTS_TRACE("set_a_foreground"); -@@ -258,14 +258,13 @@ - reset_color_pair(NCURSES_SP_DCL0) - { - #ifdef USE_TERM_DRIVER -- return CallDriver(SP_PARM, rescol); -+ return CallDriver(SP_PARM, td_rescol); - #else - bool result = FALSE; - - (void) SP_PARM; - if (orig_pair != 0) { -- TPUTS_TRACE("orig_pair"); -- putp(orig_pair); -+ (void) NCURSES_PUTP2("orig_pair", orig_pair); - result = TRUE; - } - return result; -@@ -289,11 +288,10 @@ - result = TRUE; - - #ifdef USE_TERM_DRIVER -- result = CallDriver(SP_PARM, rescolors); -+ result = CallDriver(SP_PARM, td_rescolors); - #else - if (orig_colors != 0) { -- TPUTS_TRACE("orig_colors"); -- putp(orig_colors); -+ NCURSES_PUTP2("orig_colors", orig_colors); - result = TRUE; - } - #endif -@@ -331,6 +329,13 @@ - default_bg(NCURSES_SP_ARG), - NCURSES_SP_NAME(_nc_outch)); - } -+#if !NCURSES_EXT_COLORS -+ /* -+ * Without ext-colors, we cannot represent more than 256 color pairs. -+ */ -+ if (maxpairs > 256) -+ maxpairs = 256; -+#endif - - if (maxpairs > 0 && maxcolors > 0) { - SP_PARM->_pair_limit = maxpairs; -@@ -383,10 +388,10 @@ - - /* This function was originally written by Daniel Weaver <danw@znyx.com> */ - static void --rgb2hls(short r, short g, short b, short *h, short *l, short *s) -+rgb2hls(int r, int g, int b, NCURSES_COLOR_T *h, NCURSES_COLOR_T *l, NCURSES_COLOR_T *s) - /* convert RGB to HLS system */ - { -- short min, max, t; -+ int min, max, t; - - if ((min = g < r ? g : r) > b) - min = b; -@@ -394,7 +399,7 @@ - max = b; - - /* calculate lightness */ -- *l = (short) ((min + max) / 20); -+ *l = (NCURSES_COLOR_T) ((min + max) / 20); - - if (min == max) { /* black, white and all shades of gray */ - *h = 0; -@@ -404,19 +409,19 @@ - - /* calculate saturation */ - if (*l < 50) -- *s = (short) (((max - min) * 100) / (max + min)); -+ *s = (NCURSES_COLOR_T) (((max - min) * 100) / (max + min)); - else -- *s = (short) (((max - min) * 100) / (2000 - max - min)); -+ *s = (NCURSES_COLOR_T) (((max - min) * 100) / (2000 - max - min)); - - /* calculate hue */ - if (r == max) -- t = (short) (120 + ((g - b) * 60) / (max - min)); -+ t = (NCURSES_COLOR_T) (120 + ((g - b) * 60) / (max - min)); - else if (g == max) -- t = (short) (240 + ((b - r) * 60) / (max - min)); -+ t = (NCURSES_COLOR_T) (240 + ((b - r) * 60) / (max - min)); - else -- t = (short) (360 + ((r - g) * 60) / (max - min)); -+ t = (NCURSES_COLOR_T) (360 + ((r - g) * 60) / (max - min)); - -- *h = t % 360; -+ *h = (NCURSES_COLOR_T) (t % 360); - } - - /* -@@ -424,13 +429,20 @@ - * values. - */ - NCURSES_EXPORT(int) --NCURSES_SP_NAME(init_pair) (NCURSES_SP_DCLx short pair, short f, short b) -+NCURSES_SP_NAME(init_pair) (NCURSES_SP_DCLx -+ NCURSES_PAIRS_T pair, -+ NCURSES_COLOR_T f, -+ NCURSES_COLOR_T b) - { - colorpair_t result; - colorpair_t previous; - int maxcolors; - -- T((T_CALLED("init_pair(%p,%d,%d,%d)"), (void *) SP_PARM, pair, f, b)); -+ T((T_CALLED("init_pair(%p,%d,%d,%d)"), -+ (void *) SP_PARM, -+ (int) pair, -+ (int) f, -+ (int) b)); - - if (!ValidPair(pair)) - returnCode(ERR); -@@ -439,7 +451,7 @@ - - previous = SP_PARM->_color_pairs[pair]; - #if NCURSES_EXT_FUNCS -- if (SP_PARM->_default_color) { -+ if (SP_PARM->_default_color || SP_PARM->_assumed_color) { - bool isDefault = FALSE; - bool wasDefault = FALSE; - int default_pairs = SP_PARM->_default_pairs; -@@ -498,8 +510,9 @@ - { - if ((f < 0) || !OkColorHi(f) - || (b < 0) || !OkColorHi(b) -- || (pair < 1)) -+ || (pair < 1)) { - returnCode(ERR); -+ } - } - - /* -@@ -534,22 +547,26 @@ - SET_SCREEN_PAIR(SP_PARM, (chtype) (~0)); /* force attribute update */ - - #ifdef USE_TERM_DRIVER -- CallDriver_3(SP_PARM, initpair, pair, f, b); -+ CallDriver_3(SP_PARM, td_initpair, pair, f, b); - #else - if (initialize_pair && InPalette(f) && InPalette(b)) { - const color_t *tp = DefaultPalette; - - TR(TRACE_ATTRS, - ("initializing pair: pair = %d, fg=(%d,%d,%d), bg=(%d,%d,%d)", -- pair, -- tp[f].red, tp[f].green, tp[f].blue, -- tp[b].red, tp[b].green, tp[b].blue)); -- -- TPUTS_TRACE("initialize_pair"); -- putp(TPARM_7(initialize_pair, -- pair, -- tp[f].red, tp[f].green, tp[f].blue, -- tp[b].red, tp[b].green, tp[b].blue)); -+ (int) pair, -+ (int) tp[f].red, (int) tp[f].green, (int) tp[f].blue, -+ (int) tp[b].red, (int) tp[b].green, (int) tp[b].blue)); -+ -+ NCURSES_PUTP2("initialize_pair", -+ TPARM_7(initialize_pair, -+ pair, -+ (int) tp[f].red, -+ (int) tp[f].green, -+ (int) tp[f].blue, -+ (int) tp[b].red, -+ (int) tp[b].green, -+ (int) tp[b].blue)); - } - #endif - -@@ -558,7 +575,7 @@ - - #if NCURSES_SP_FUNCS - NCURSES_EXPORT(int) --init_pair(short pair, short f, short b) -+init_pair(NCURSES_COLOR_T pair, NCURSES_COLOR_T f, NCURSES_COLOR_T b) - { - return NCURSES_SP_NAME(init_pair) (CURRENT_SCREEN, pair, f, b); - } -@@ -568,7 +585,10 @@ - - NCURSES_EXPORT(int) - NCURSES_SP_NAME(init_color) (NCURSES_SP_DCLx -- short color, short r, short g, short b) -+ NCURSES_COLOR_T color, -+ NCURSES_COLOR_T r, -+ NCURSES_COLOR_T g, -+ NCURSES_COLOR_T b) - { - int result = ERR; - int maxcolors; -@@ -605,10 +625,10 @@ - } - - #ifdef USE_TERM_DRIVER -- CallDriver_4(SP_PARM, initcolor, color, r, g, b); -+ CallDriver_4(SP_PARM, td_initcolor, color, r, g, b); - #else -- TPUTS_TRACE("initialize_color"); -- putp(TPARM_4(initialize_color, color, r, g, b)); -+ NCURSES_PUTP2("initialize_color", -+ TPARM_4(initialize_color, color, r, g, b)); - #endif - SP_PARM->_color_defs = max(color + 1, SP_PARM->_color_defs); - -@@ -619,7 +639,10 @@ - - #if NCURSES_SP_FUNCS - NCURSES_EXPORT(int) --init_color(short color, short r, short g, short b) -+init_color(NCURSES_COLOR_T color, -+ NCURSES_COLOR_T r, -+ NCURSES_COLOR_T g, -+ NCURSES_COLOR_T b) - { - return NCURSES_SP_NAME(init_color) (CURRENT_SCREEN, color, r, g, b); - } -@@ -628,8 +651,15 @@ - NCURSES_EXPORT(bool) - NCURSES_SP_NAME(can_change_color) (NCURSES_SP_DCL) - { -+ int result = FALSE; -+ - T((T_CALLED("can_change_color(%p)"), (void *) SP_PARM)); -- returnCode((CanChange != 0) ? TRUE : FALSE); -+ -+ if (HasTerminal(SP_PARM) && (CanChange != 0)) { -+ result = TRUE; -+ } -+ -+ returnCode(result); - } - - #if NCURSES_SP_FUNCS -@@ -643,20 +673,22 @@ - NCURSES_EXPORT(bool) - NCURSES_SP_NAME(has_colors) (NCURSES_SP_DCL0) - { -- int code; -+ int code = FALSE; - - (void) SP_PARM; - T((T_CALLED("has_colors()"))); -+ if (HasTerminal(SP_PARM)) { - #ifdef USE_TERM_DRIVER -- code = HasColor; -+ code = HasColor; - #else -- code = ((VALID_NUMERIC(max_colors) && VALID_NUMERIC(max_pairs) -- && (((set_foreground != NULL) -- && (set_background != NULL)) -- || ((set_a_foreground != NULL) -- && (set_a_background != NULL)) -- || set_color_pair)) ? TRUE : FALSE); -+ code = ((VALID_NUMERIC(max_colors) && VALID_NUMERIC(max_pairs) -+ && (((set_foreground != NULL) -+ && (set_background != NULL)) -+ || ((set_a_foreground != NULL) -+ && (set_a_background != NULL)) -+ || set_color_pair)) ? TRUE : FALSE); - #endif -+ } - returnCode(code); - } - -@@ -670,7 +702,10 @@ - - NCURSES_EXPORT(int) - NCURSES_SP_NAME(color_content) (NCURSES_SP_DCLx -- short color, short *r, short *g, short *b) -+ NCURSES_COLOR_T color, -+ NCURSES_COLOR_T *r, -+ NCURSES_COLOR_T *g, -+ NCURSES_COLOR_T *b) - { - int result = ERR; - int maxcolors; -@@ -710,7 +745,10 @@ - - #if NCURSES_SP_FUNCS - NCURSES_EXPORT(int) --color_content(short color, short *r, short *g, short *b) -+color_content(NCURSES_COLOR_T color, -+ NCURSES_COLOR_T *r, -+ NCURSES_COLOR_T *g, -+ NCURSES_COLOR_T *b) - { - return NCURSES_SP_NAME(color_content) (CURRENT_SCREEN, color, r, g, b); - } -@@ -718,21 +756,23 @@ - - NCURSES_EXPORT(int) - NCURSES_SP_NAME(pair_content) (NCURSES_SP_DCLx -- short pair, short *f, short *b) -+ NCURSES_PAIRS_T pair, -+ NCURSES_COLOR_T *f, -+ NCURSES_COLOR_T *b) - { - int result; - - T((T_CALLED("pair_content(%p,%d,%p,%p)"), - (void *) SP_PARM, -- pair, -+ (int) pair, - (void *) f, - (void *) b)); - - if (!ValidPair(pair)) { - result = ERR; - } else { -- NCURSES_COLOR_T fg = FORE_OF(SP_PARM->_color_pairs[pair]); -- NCURSES_COLOR_T bg = BACK_OF(SP_PARM->_color_pairs[pair]); -+ NCURSES_COLOR_T fg = (NCURSES_COLOR_T) FORE_OF(SP_PARM->_color_pairs[pair]); -+ NCURSES_COLOR_T bg = (NCURSES_COLOR_T) BACK_OF(SP_PARM->_color_pairs[pair]); - - #if NCURSES_EXT_FUNCS - if (fg == COLOR_DEFAULT) -@@ -748,8 +788,8 @@ - - TR(TRACE_ATTRS, ("...pair_content(%p,%d,%d,%d)", - (void *) SP_PARM, -- pair, -- fg, bg)); -+ (int) pair, -+ (int) fg, (int) bg)); - result = OK; - } - returnCode(result); -@@ -757,7 +797,7 @@ - - #if NCURSES_SP_FUNCS - NCURSES_EXPORT(int) --pair_content(short pair, short *f, short *b) -+pair_content(NCURSES_COLOR_T pair, NCURSES_COLOR_T *f, NCURSES_COLOR_T *b) - { - return NCURSES_SP_NAME(pair_content) (CURRENT_SCREEN, pair, f, b); - } -@@ -765,17 +805,18 @@ - - NCURSES_EXPORT(void) - NCURSES_SP_NAME(_nc_do_color) (NCURSES_SP_DCLx -- short old_pair, -- short pair, -- bool reverse, -+ int old_pair, -+ int pair, -+ int reverse, - NCURSES_SP_OUTC outc) - { - #ifdef USE_TERM_DRIVER -- CallDriver_4(SP_PARM, docolor, old_pair, pair, reverse, outc); -+ CallDriver_4(SP_PARM, td_docolor, old_pair, pair, reverse, outc); - #else - NCURSES_COLOR_T fg = COLOR_DEFAULT; - NCURSES_COLOR_T bg = COLOR_DEFAULT; -- NCURSES_COLOR_T old_fg, old_bg; -+ NCURSES_COLOR_T old_fg = -1; -+ NCURSES_COLOR_T old_bg = -1; - - if (!ValidPair(pair)) { - return; -@@ -787,13 +828,14 @@ - 1, outc); - return; - } else if (SP_PARM != 0) { -- pair_content((short) pair, &fg, &bg); -+ if (pair_content((NCURSES_COLOR_T) pair, &fg, &bg) == ERR) -+ return; - } - } - - if (old_pair >= 0 - && SP_PARM != 0 -- && pair_content(old_pair, &old_fg, &old_bg) != ERR) { -+ && pair_content((NCURSES_COLOR_T) old_pair, &old_fg, &old_bg) != ERR) { - if ((isDefaultColor(fg) && !isDefaultColor(old_fg)) - || (isDefaultColor(bg) && !isDefaultColor(old_bg))) { - #if NCURSES_EXT_FUNCS -@@ -822,9 +864,9 @@ - - #if NCURSES_EXT_FUNCS - if (isDefaultColor(fg)) -- fg = (short) default_fg(NCURSES_SP_ARG); -+ fg = (NCURSES_COLOR_T) default_fg(NCURSES_SP_ARG); - if (isDefaultColor(bg)) -- bg = (short) default_bg(NCURSES_SP_ARG); -+ bg = (NCURSES_COLOR_T) default_bg(NCURSES_SP_ARG); - #endif - - if (reverse) { -@@ -847,7 +889,7 @@ - - #if NCURSES_SP_FUNCS - NCURSES_EXPORT(void) --_nc_do_color(short old_pair, short pair, bool reverse, NCURSES_OUTC outc) -+_nc_do_color(int old_pair, int pair, int reverse, NCURSES_OUTC outc) - { - SetSafeOutcWrapper(outc); - NCURSES_SP_NAME(_nc_do_color) (CURRENT_SCREEN, -diff -Naur ncurses-5.9/ncurses/base/lib_colorset.c ncurses-5.9.patch/ncurses/base/lib_colorset.c ---- ncurses-5.9/ncurses/base/lib_colorset.c 2009-10-25 00:02:14.000000000 +0200 -+++ ncurses-5.9.patch/ncurses/base/lib_colorset.c 2014-09-01 16:33:22.371792147 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2005,2009 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2009,2014 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -41,14 +41,14 @@ - #include <curses.priv.h> - #include <ctype.h> - --MODULE_ID("$Id: lib_colorset.c,v 1.13 2009/10/24 22:02:14 tom Exp $") -+MODULE_ID("$Id: lib_colorset.c,v 1.14 2014/02/01 22:10:42 tom Exp $") - - NCURSES_EXPORT(int) --wcolor_set(WINDOW *win, short color_pair_number, void *opts) -+wcolor_set(WINDOW *win, NCURSES_PAIRS_T color_pair_number, void *opts) - { - int code = ERR; - -- T((T_CALLED("wcolor_set(%p,%d)"), (void *) win, color_pair_number)); -+ T((T_CALLED("wcolor_set(%p,%d)"), (void *) win, (int) color_pair_number)); - if (win - && !opts - && (SP != 0) -diff -Naur ncurses-5.9/ncurses/base/lib_dft_fgbg.c ncurses-5.9.patch/ncurses/base/lib_dft_fgbg.c ---- ncurses-5.9/ncurses/base/lib_dft_fgbg.c 2009-10-25 00:15:00.000000000 +0200 -+++ ncurses-5.9.patch/ncurses/base/lib_dft_fgbg.c 2014-09-01 16:33:22.371792147 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2005,2009 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2011,2014 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -37,7 +37,7 @@ - #define CUR SP_TERMTYPE - #endif - --MODULE_ID("$Id: lib_dft_fgbg.c,v 1.25 2009/10/24 22:15:00 tom Exp $") -+MODULE_ID("$Id: lib_dft_fgbg.c,v 1.27 2014/03/08 20:32:59 tom Exp $") - - /* - * Modify the behavior of color-pair 0 so that the library doesn't assume that -@@ -70,7 +70,7 @@ - T((T_CALLED("assume_default_colors(%p,%d,%d)"), (void *) SP_PARM, fg, bg)); - #ifdef USE_TERM_DRIVER - if (sp != 0) -- code = CallDriver_2(sp, defaultcolors, fg, bg); -+ code = CallDriver_2(sp, td_defaultcolors, fg, bg); - #else - if ((orig_pair || orig_colors) && !initialize_pair) { - -@@ -80,6 +80,7 @@ - SP_PARM->_default_bg = isDefaultColor(bg) ? COLOR_DEFAULT : (bg & C_MASK); - if (SP_PARM->_color_pairs != 0) { - bool save = SP_PARM->_default_color; -+ SP_PARM->_assumed_color = TRUE; - SP_PARM->_default_color = TRUE; - init_pair(0, (short) fg, (short) bg); - SP_PARM->_default_color = save; -diff -Naur ncurses-5.9/ncurses/base/lib_driver.c ncurses-5.9.patch/ncurses/base/lib_driver.c ---- ncurses-5.9/ncurses/base/lib_driver.c 2010-12-20 01:29:17.000000000 +0100 -+++ ncurses-5.9.patch/ncurses/base/lib_driver.c 2014-09-01 16:33:22.371792147 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 2008-2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 2008-2012,2014 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -33,7 +33,7 @@ - - #include <curses.priv.h> - --MODULE_ID("$Id: lib_driver.c,v 1.3 2010/12/20 00:29:17 tom Exp $") -+MODULE_ID("$Id: lib_driver.c,v 1.5 2014/03/08 20:32:59 tom Exp $") - - typedef struct DriverEntry { - const char *name; -@@ -43,9 +43,9 @@ - static DRIVER_ENTRY DriverTable[] = - { - #ifdef __MINGW32__ -- {"win", &_nc_WIN_DRIVER}, -+ {"win32con", &_nc_WIN_DRIVER}, - #endif -- {"tinfo", &_nc_TINFO_DRIVER} -+ {"tinfo", &_nc_TINFO_DRIVER} /* must be last */ - }; - - NCURSES_EXPORT(int) -@@ -63,7 +63,21 @@ - - for (i = 0; i < SIZEOF(DriverTable); i++) { - res = DriverTable[i].driver; -- if (res->CanHandle(TCB, name, errret)) { -+ /* -+ * Use "#" (a character which cannot begin a terminal's name) to -+ * select specific driver from the table. -+ * -+ * In principle, we could have more than one non-terminfo driver, -+ * e.g., "win32gui". -+ */ -+ if (name != 0 && *name == '#') { -+ size_t n = strlen(name + 1); -+ if (n != 0 -+ && strncmp(name + 1, DriverTable[i].name, n)) { -+ continue; -+ } -+ } -+ if (res->td_CanHandle(TCB, name, errret)) { - use = res; - break; - } -@@ -79,7 +93,7 @@ - NCURSES_SP_NAME(has_key) (SCREEN *sp, int keycode) - { - T((T_CALLED("has_key(%p, %d)"), (void *) sp, keycode)); -- returnCode(IsValidTIScreen(sp) ? CallDriver_1(sp, kyExist, keycode) : FALSE); -+ returnCode(IsValidTIScreen(sp) ? CallDriver_1(sp, td_kyExist, keycode) : FALSE); - } - - NCURSES_EXPORT(int) -@@ -94,7 +108,7 @@ - int code = ERR; - - if (0 != TerminalOf(sp)) -- code = CallDriver_2(sp, print, data, len); -+ code = CallDriver_2(sp, td_print, data, len); - return (code); - } - -@@ -112,7 +126,7 @@ - T((T_CALLED("doupdate(%p)"), (void *) sp)); - - if (IsValidScreen(sp)) -- code = CallDriver(sp, update); -+ code = CallDriver(sp, td_update); - - returnCode(code); - } -@@ -130,7 +144,7 @@ - TR(TRACE_CALLS | TRACE_MOVE, (T_CALLED("mvcur(%p,%d,%d,%d,%d)"), - (void *) sp, yold, xold, ynew, xnew)); - if (HasTerminal(sp)) { -- code = CallDriver_4(sp, hwcur, yold, xold, ynew, xnew); -+ code = CallDriver_4(sp, td_hwcur, yold, xold, ynew, xnew); - } - returnCode(code); - } -diff -Naur ncurses-5.9/ncurses/base/lib_endwin.c ncurses-5.9.patch/ncurses/base/lib_endwin.c ---- ncurses-5.9/ncurses/base/lib_endwin.c 2009-10-25 00:02:14.000000000 +0200 -+++ ncurses-5.9.patch/ncurses/base/lib_endwin.c 2014-09-01 16:33:22.371792147 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2008,2009 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2009,2014 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -42,7 +42,7 @@ - - #include <curses.priv.h> - --MODULE_ID("$Id: lib_endwin.c,v 1.22 2009/10/24 22:02:14 tom Exp $") -+MODULE_ID("$Id: lib_endwin.c,v 1.23 2014/03/08 20:32:59 tom Exp $") - - NCURSES_EXPORT(int) - NCURSES_SP_NAME(endwin) (NCURSES_SP_DCL0) -@@ -56,8 +56,8 @@ - TERMINAL_CONTROL_BLOCK *TCB = TCBOf(SP_PARM); - - SP_PARM->_endwin = TRUE; -- if (TCB && TCB->drv && TCB->drv->scexit) -- TCB->drv->scexit(SP_PARM); -+ if (TCB && TCB->drv && TCB->drv->td_scexit) -+ TCB->drv->td_scexit(SP_PARM); - #else - SP_PARM->_endwin = TRUE; - SP_PARM->_mouse_wrap(SP_PARM); -diff -Naur ncurses-5.9/ncurses/base/lib_flash.c ncurses-5.9.patch/ncurses/base/lib_flash.c ---- ncurses-5.9/ncurses/base/lib_flash.c 2009-10-25 00:02:14.000000000 +0200 -+++ ncurses-5.9.patch/ncurses/base/lib_flash.c 2014-09-01 16:33:22.372792149 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2000,2009 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2013,2014 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -46,7 +46,7 @@ - #define CUR SP_TERMTYPE - #endif - --MODULE_ID("$Id: lib_flash.c,v 1.11 2009/10/24 22:02:14 tom Exp $") -+MODULE_ID("$Id: lib_flash.c,v 1.14 2014/03/08 20:32:59 tom Exp $") - - /* - * flash() -@@ -64,17 +64,15 @@ - T((T_CALLED("flash(%p)"), (void *) SP_PARM)); - #ifdef USE_TERM_DRIVER - if (SP_PARM != 0) -- res = CallDriver_1(SP_PARM, doBeepOrFlash, FALSE); -+ res = CallDriver_1(SP_PARM, td_doBeepOrFlash, FALSE); - #else -- /* FIXME: should make sure that we are not in altchar mode */ -- if (flash_screen) { -- TPUTS_TRACE("flash_screen"); -- res = putp(flash_screen); -- _nc_flush(); -- } else if (bell) { -- TPUTS_TRACE("bell"); -- res = putp(bell); -- _nc_flush(); -+ if (HasTerminal(SP_PARM)) { -+ /* FIXME: should make sure that we are not in altchar mode */ -+ if (flash_screen) { -+ res = NCURSES_PUTP2_FLUSH("flash_screen", flash_screen); -+ } else if (bell) { -+ res = NCURSES_PUTP2_FLUSH("bell", bell); -+ } - } - #endif - returnCode(res); -diff -Naur ncurses-5.9/ncurses/base/lib_freeall.c ncurses-5.9.patch/ncurses/base/lib_freeall.c ---- ncurses-5.9/ncurses/base/lib_freeall.c 2010-01-23 18:57:43.000000000 +0100 -+++ ncurses-5.9.patch/ncurses/base/lib_freeall.c 2014-09-01 16:33:22.372792149 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -39,7 +39,7 @@ - extern int malloc_errfd; /* FIXME */ - #endif - --MODULE_ID("$Id: lib_freeall.c,v 1.59 2010/01/23 17:57:43 tom Exp $") -+MODULE_ID("$Id: lib_freeall.c,v 1.62 2012/11/17 23:53:03 tom Exp $") - - /* - * Free all ncurses data. This is used for testing only (there's no practical -@@ -70,19 +70,21 @@ - - /* Delete only windows that're not a parent */ - for (each_window(SP_PARM, p)) { -+ WINDOW *p_win = &(p->win); - bool found = FALSE; - - for (each_window(SP_PARM, q)) { -+ WINDOW *q_win = &(q->win); - if ((p != q) -- && (q->win._flags & _SUBWIN) -- && (&(p->win) == q->win._parent)) { -+ && (q_win->_flags & _SUBWIN) -+ && (p_win == q_win->_parent)) { - found = TRUE; - break; - } - } - - if (!found) { -- if (delwin(&(p->win)) != ERR) -+ if (delwin(p_win) != ERR) - deleted = TRUE; - break; - } -@@ -100,7 +102,7 @@ - - (void) _nc_printf_string(0, empty_va); - #ifdef TRACE -- (void) _nc_trace_buf(-1, 0); -+ (void) _nc_trace_buf(-1, (size_t) 0); - #endif - #if USE_WIDEC_SUPPORT - FreeIfNeeded(_nc_wacs); -@@ -129,8 +131,9 @@ - NCURSES_EXPORT(void) - NCURSES_SP_NAME(_nc_free_and_exit) (NCURSES_SP_DCLx int code) - { -- char *last_setbuf = (SP_PARM != 0) ? SP_PARM->_setbuf : 0; -+ char *last_buffer = (SP_PARM != 0) ? SP_PARM->out_buffer : 0; - -+ NCURSES_SP_NAME(_nc_flush) (NCURSES_SP_ARG); - NCURSES_SP_NAME(_nc_freeall) (NCURSES_SP_ARG); - #ifdef TRACE - trace(0); /* close trace file, freeing its setbuf */ -@@ -139,8 +142,7 @@ - free(_nc_varargs("?", fake)); - } - #endif -- fclose(stdout); -- FreeIfNeeded(last_setbuf); -+ FreeIfNeeded(last_buffer); - exit(code); - } - -diff -Naur ncurses-5.9/ncurses/base/lib_getch.c ncurses-5.9.patch/ncurses/base/lib_getch.c ---- ncurses-5.9/ncurses/base/lib_getch.c 2010-12-26 00:24:04.000000000 +0100 -+++ ncurses-5.9.patch/ncurses/base/lib_getch.c 2014-09-01 16:33:22.372792149 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2013,2014 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -42,7 +42,7 @@ - - #include <curses.priv.h> - --MODULE_ID("$Id: lib_getch.c,v 1.121 2010/12/25 23:24:04 tom Exp $") -+MODULE_ID("$Id: lib_getch.c,v 1.127 2014/03/08 20:32:59 tom Exp $") - - #include <fifo_defs.h> - -@@ -133,7 +133,7 @@ - int rc; - - #ifdef USE_TERM_DRIVER -- rc = TCBOf(sp)->drv->testmouse(TCBOf(sp), delay); -+ rc = TCBOf(sp)->drv->td_testmouse(TCBOf(sp), delay EVENTLIST_2nd(evl)); - #else - #if USE_SYSMOUSE - if ((sp->_mouse_type == M_SYSMOUSE) -@@ -163,7 +163,7 @@ - static NCURSES_INLINE int - fifo_peek(SCREEN *sp) - { -- int ch = sp->_fifo[peek]; -+ int ch = (peek >= 0) ? sp->_fifo[peek] : ERR; - TR(TRACE_IEVENT, ("peeking at %d", peek)); - - p_inc(); -@@ -173,15 +173,16 @@ - static NCURSES_INLINE int - fifo_pull(SCREEN *sp) - { -- int ch; -- ch = sp->_fifo[head]; -+ int ch = (head >= 0) ? sp->_fifo[head] : ERR; -+ - TR(TRACE_IEVENT, ("pulling %s from %d", _nc_tracechar(sp, ch), head)); - - if (peek == head) { - h_inc(); - peek = head; -- } else -+ } else { - h_inc(); -+ } - - #ifdef TRACE - if (USE_TRACEF(TRACE_IEVENT)) { -@@ -200,7 +201,7 @@ - int mask = 0; - - (void) mask; -- if (tail == -1) -+ if (tail < 0) - return ERR; - - #ifdef HIDE_EINTR -@@ -257,10 +258,17 @@ - n = 1; - } else - #endif -+#if USE_KLIBC_KBD -+ if (isatty(sp->_ifd) && sp->_cbreak) { -+ ch = _read_kbd(0, 1, !sp->_raw); -+ n = (ch == -1) ? -1 : 1; -+ sp->_extended_key = (ch == 0); -+ } else -+#endif - { /* Can block... */ - #ifdef USE_TERM_DRIVER - int buf; -- n = CallDriver_1(sp, read, &buf); -+ n = CallDriver_1(sp, td_read, &buf); - ch = buf; - #else - unsigned char c2 = 0; -@@ -270,7 +278,7 @@ - # endif - _nc_globals.read_thread = pthread_self(); - # endif -- n = (int) read(sp->_ifd, &c2, 1); -+ n = (int) read(sp->_ifd, &c2, (size_t) 1); - #if USE_PTHREADS_EINTR - _nc_globals.read_thread = 0; - #endif -@@ -431,11 +439,11 @@ - /* ungetch in reverse order */ - #ifdef NCURSES_WGETCH_EVENTS - rc = recur_wgetnstr(win, buf); -- if (rc != KEY_EVENT) -+ if (rc != KEY_EVENT && rc != ERR) - safe_ungetch(sp, '\n'); - #else -- (void) recur_wgetnstr(win, buf); -- safe_ungetch(sp, '\n'); -+ if (recur_wgetnstr(win, buf) != ERR) -+ safe_ungetch(sp, '\n'); - #endif - for (bufp = buf + strlen(buf); bufp > buf; bufp--) - safe_ungetch(sp, bufp[-1]); -@@ -569,7 +577,7 @@ - * - * If carriage return is defined as a function key in the - * terminfo, e.g., kent, then Solaris may return either ^J (or ^M -- * if nonl() is set) or KEY_ENTER depending on the echo() mode. -+ * if nonl() is set) or KEY_ENTER depending on the echo() mode. - * We echo before translating carriage return based on nonl(), - * since the visual result simply moves the cursor to column 0. - * -@@ -709,10 +717,11 @@ - - if (ptr->value != 0) { /* sequence terminated */ - TR(TRACE_IEVENT, ("end of sequence")); -- if (peek == tail) -+ if (peek == tail) { - fifo_clear(sp); -- else -+ } else { - head = peek; -+ } - return (ptr->value); - } - -diff -Naur ncurses-5.9/ncurses/base/lib_getstr.c ncurses-5.9.patch/ncurses/base/lib_getstr.c ---- ncurses-5.9/ncurses/base/lib_getstr.c 2009-10-24 23:59:02.000000000 +0200 -+++ ncurses-5.9.patch/ncurses/base/lib_getstr.c 2014-09-01 16:33:22.372792149 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2008,2009 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2009,2011 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -40,14 +40,14 @@ - - #include <curses.priv.h> - --MODULE_ID("$Id: lib_getstr.c,v 1.29 2009/10/24 21:59:02 tom Exp $") -+MODULE_ID("$Id: lib_getstr.c,v 1.30 2011/10/22 16:31:35 tom Exp $") - - /* - * This wipes out the last character, no matter whether it was a tab, control - * or other character, and handles reverse wraparound. - */ - static char * --WipeOut(WINDOW *win, int y, int x, char *first, char *last, bool echoed) -+WipeOut(WINDOW *win, int y, int x, char *first, char *last, int echoed) - { - if (last > first) { - *--last = '\0'; -diff -Naur ncurses-5.9/ncurses/base/lib_insch.c ncurses-5.9.patch/ncurses/base/lib_insch.c ---- ncurses-5.9/ncurses/base/lib_insch.c 2009-10-25 00:04:35.000000000 +0200 -+++ ncurses-5.9.patch/ncurses/base/lib_insch.c 2014-09-01 16:33:22.372792149 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2008,2009 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -43,7 +43,7 @@ - #include <curses.priv.h> - #include <ctype.h> - --MODULE_ID("$Id: lib_insch.c,v 1.32 2009/10/24 22:04:35 tom Exp $") -+MODULE_ID("$Id: lib_insch.c,v 1.35 2013/05/18 21:58:56 tom Exp $") - - /* - * Insert the given character, updating the current location to simplify -@@ -53,6 +53,7 @@ - _nc_insert_ch(SCREEN *sp, WINDOW *win, chtype ch) - { - int code = OK; -+ int ch8 = (int) ChCharOf(ch); - NCURSES_CH_T wch; - int count; - NCURSES_CONST char *s; -@@ -82,10 +83,9 @@ - #if USE_WIDEC_SUPPORT - WINDOW_EXT(win, addch_used) == 0 && - #endif -- is8bits(ChCharOf(ch)) && -- (isprint(ChCharOf(ch)) || -+ (isprint(ch8) || - (ChAttrOf(ch) & A_ALTCHARSET) || -- (sp != 0 && sp->_legacy_coding && !iscntrl(ChCharOf(ch))))) { -+ (sp != 0 && sp->_legacy_coding && !iscntrl(ch8)))) { - if (win->_curx <= win->_maxx) { - struct ldat *line = &(win->_line[win->_cury]); - NCURSES_CH_T *end = &(line->text[win->_curx]); -@@ -101,8 +101,8 @@ - *temp1 = _nc_render(win, wch); - win->_curx++; - } -- } else if (is8bits(ChCharOf(ch)) && iscntrl(ChCharOf(ch))) { -- s = NCURSES_SP_NAME(unctrl) (NCURSES_SP_ARGx ChCharOf(ch)); -+ } else if (iscntrl(ch8)) { -+ s = NCURSES_SP_NAME(unctrl) (NCURSES_SP_ARGx (chtype) ch8); - while (*s != '\0') { - code = _nc_insert_ch(sp, win, ChAttrOf(ch) | UChar(*s)); - if (code != OK) -@@ -122,18 +122,14 @@ - code = _nc_insert_wch(win, &wch); - } else if (count == -1) { - /* handle EILSEQ */ -- if (is8bits(ch)) { -- s = NCURSES_SP_NAME(unctrl) (NCURSES_SP_ARGx ChCharOf(ch)); -- if (strlen(s) > 1) { -- while (*s != '\0') { -- code = _nc_insert_ch(sp, win, -- ChAttrOf(ch) | UChar(*s)); -- if (code != OK) -- break; -- ++s; -- } -- } else { -- code = ERR; -+ s = NCURSES_SP_NAME(unctrl) (NCURSES_SP_ARGx (chtype) ch8); -+ if (strlen(s) > 1) { -+ while (*s != '\0') { -+ code = _nc_insert_ch(sp, win, -+ ChAttrOf(ch) | UChar(*s)); -+ if (code != OK) -+ break; -+ ++s; - } - } else { - code = ERR; -diff -Naur ncurses-5.9/ncurses/base/lib_instr.c ncurses-5.9.patch/ncurses/base/lib_instr.c ---- ncurses-5.9/ncurses/base/lib_instr.c 2009-10-25 00:55:45.000000000 +0200 -+++ ncurses-5.9.patch/ncurses/base/lib_instr.c 2014-09-01 16:33:22.372792149 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2007,2009 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2013,2014 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -41,7 +41,7 @@ - - #include <curses.priv.h> - --MODULE_ID("$Id: lib_instr.c,v 1.17 2009/10/24 22:55:45 tom Exp $") -+MODULE_ID("$Id: lib_instr.c,v 1.21 2014/02/01 22:09:27 tom Exp $") - - NCURSES_EXPORT(int) - winnstr(WINDOW *win, char *str, int n) -@@ -64,7 +64,7 @@ - cchar_t *cell = &(win->_line[row].text[col]); - wchar_t *wch; - attr_t attrs; -- short pair; -+ NCURSES_PAIRS_T pair; - int n2; - bool done = FALSE; - mbstate_t state; -@@ -78,11 +78,15 @@ - if (getcchar(cell, wch, &attrs, &pair, 0) == OK) { - - init_mb(state); -- n3 = wcstombs(0, wch, 0); -+ n3 = wcstombs(0, wch, (size_t) 0); - if (!isEILSEQ(n3) && (n3 != 0)) { -- if (((int) n3 + i) > n) { -+ size_t need = n3 + 10 + (size_t) i; -+ int have = (int) n3 + i; -+ -+ /* check for loop-done as well as overflow */ -+ if (have > n || (int) need <= 0) { - done = TRUE; -- } else if ((tmp = typeCalloc(char, n3 + 10)) == 0) { -+ } else if ((tmp = typeCalloc(char, need)) == 0) { - done = TRUE; - } else { - init_mb(state); -diff -Naur ncurses-5.9/ncurses/base/lib_mouse.c ncurses-5.9.patch/ncurses/base/lib_mouse.c ---- ncurses-5.9/ncurses/base/lib_mouse.c 2011-01-22 20:47:47.000000000 +0100 -+++ ncurses-5.9.patch/ncurses/base/lib_mouse.c 2014-09-01 16:33:22.373792151 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2010,2011 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2013,2014 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -84,7 +84,7 @@ - #define CUR SP_TERMTYPE - #endif - --MODULE_ID("$Id: lib_mouse.c,v 1.121 2011/01/22 19:47:47 tom Exp $") -+MODULE_ID("$Id: lib_mouse.c,v 1.142 2014/03/08 20:32:59 tom Exp $") - - #include <tic.h> - -@@ -112,7 +112,7 @@ - #undef buttons /* symbol conflict in consio.h */ - #undef mouse_info /* symbol conflict in consio.h */ - #include <osreldate.h> --#if (__FreeBSD_version >= 400017) -+#if defined(__DragonFly_version) || (defined(__FreeBSD__) && (__FreeBSD_version >= 400017)) - #include <sys/consio.h> - #include <sys/fbio.h> - #else -@@ -120,6 +120,17 @@ - #endif - #endif /* use_SYSMOUSE */ - -+#if USE_KLIBC_MOUSE -+#include <sys/socket.h> -+#define pipe(handles) socketpair(AF_LOCAL, SOCK_STREAM, 0, handles) -+#define DosWrite(hfile, pbuffer, cbwrite, pcbactual) \ -+ write(hfile, pbuffer, cbwrite) -+#define DosExit(action, result ) /* do nothing */ -+#define DosCreateThread(ptid, pfn, param, flag, cbStack) \ -+ (*(ptid) = _beginthread(pfn, NULL, cbStack, \ -+ (void *)param), (*(ptid) == -1)) -+#endif -+ - #define MY_TRACE TRACE_ICALLS|TRACE_IEVENT - - #define MASK_RELEASE(x) (mmask_t) NCURSES_MOUSE_MASK(x, 001) -@@ -148,6 +159,9 @@ - #define INVALID_EVENT -1 - #define NORMAL_EVENT 0 - -+#define ValidEvent(ep) ((ep)->id != INVALID_EVENT) -+#define Invalidate(ep) (ep)->id = INVALID_EVENT -+ - #if USE_GPM_SUPPORT - - #ifndef LIBGPM_SONAME -@@ -211,7 +225,7 @@ - char buf[6]; - unsigned long ignore; - -- strncpy(buf, key_mouse, 3); /* should be "\033[M" */ -+ strcpy(buf, "\033[M"); /* should be the same as key_mouse */ - buf[3] = ' ' + (button - 1) + (down ? 0 : 0x40); - buf[4] = ' ' + x - LEFT_COL + 1; - buf[5] = ' ' + y - TOP_ROW + 1; -@@ -219,7 +233,11 @@ - } - - static void -+#if USE_KLIBC_MOUSE -+mouse_server(void *param) -+#else - mouse_server(unsigned long param) -+#endif - { - SCREEN *sp = (SCREEN *) param; - unsigned short fWait = MOU_WAIT; -@@ -245,7 +263,8 @@ - /* sit and wait on the event queue */ - rc = MouReadEventQue(&mouev, &fWait, hmou); - if (rc) { -- sprintf(err, "Error reading mouse queue, rc=%lu.\r\n", rc); -+ _nc_SPRINTF(err, _nc_SLIMIT(sizeof(err)) -+ "Error reading mouse queue, rc=%lu.\r\n", rc); - break; - } - if (!sp->_emxmouse_activated) -@@ -271,9 +290,11 @@ - finish: - oldstate = mouev.fs; - } -- } else -- sprintf(err, "Error setting event mask, buttons=%d, rc=%lu.\r\n", -- nbuttons, rc); -+ } else { -+ _nc_SPRINTF(err, _nc_SLIMIT(sizeof(err)) -+ "Error setting event mask, buttons=%d, rc=%lu.\r\n", -+ nbuttons, rc); -+ } - - DosWrite(2, err, strlen(err), &rc); - MouClose(hmou); -@@ -367,20 +388,26 @@ - #if USE_EMX_MOUSE - sp->_emxmouse_activated = enable; - #else -- NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx -- "xterm-mouse", -- TPARM_1(sp->_mouse_xtermcap, enable)); -+ NCURSES_PUTP2("xterm-mouse", TPARM_1(sp->_mouse_xtermcap, enable)); - #endif - sp->_mouse_active = enable; - } - - #if USE_GPM_SUPPORT - static bool --allow_gpm_mouse(void) -+allow_gpm_mouse(SCREEN *sp) - { - bool result = FALSE; - -- /* GPM does printf's without checking if stdout is a terminal */ -+#if USE_WEAK_SYMBOLS -+ /* Danger Robinson: do not use dlopen for libgpm if already loaded */ -+ if ((Gpm_Wgetch)) { -+ if (!sp->_mouse_gpm_loaded) { -+ T(("GPM library was already dlopen'd, not by us")); -+ } -+ } else -+#endif -+ /* GPM does printf's without checking if stdout is a terminal */ - if (isatty(fileno(stdout))) { - char *list = getenv("NCURSES_GPM_TERMS"); - char *env = getenv("TERM"); -@@ -506,7 +533,7 @@ - - /* Try gpm first, because gpm may be configured to run in xterm */ - #if USE_GPM_SUPPORT -- if (allow_gpm_mouse()) { -+ if (allow_gpm_mouse(sp)) { - if (!sp->_mouse_gpm_loaded) { - #ifdef HAVE_LIBDL - load_gpm_library(sp); -@@ -641,7 +668,7 @@ - #endif /* USE_SYSMOUSE */ - - #ifdef USE_TERM_DRIVER -- CallDriver(sp, initmouse); -+ CallDriver(sp, td_initmouse); - #else - /* we know how to recognize mouse events under "xterm" */ - if (key_mouse != 0) { -@@ -673,7 +700,7 @@ - - sp->_mouse_eventp = FirstEV(sp); - for (i = 0; i < EV_MAX; i++) -- sp->_mouse_events[i].id = INVALID_EVENT; -+ Invalidate(sp->_mouse_events + i); - - initialize_mousetype(sp); - -@@ -750,6 +777,7 @@ - eventp->bstate |= BUTTON3_RELEASED; - break; - default: -+ eventp->bstate |= REPORT_MOUSE_POSITION; - break; - } - -@@ -830,7 +858,6 @@ - - if (sp->_mouse_type == M_XTERM) { - unsigned char kbuf[4]; -- mmask_t prev; - size_t grabbed; - int res; - -@@ -896,35 +923,51 @@ - - /* processing code goes here */ - eventp->bstate = 0; -- prev = PREV(eventp)->bstate; - - #if USE_EMX_MOUSE - #define PRESS_POSITION(n) \ -- eventp->bstate = MASK_PRESS(n); \ -- if (kbuf[0] & 0x40) \ -- eventp->bstate = MASK_RELEASE(n) -+ do { \ -+ eventp->bstate = MASK_PRESS(n); \ -+ sp->_mouse_bstate |= MASK_PRESS(n); \ -+ if (kbuf[0] & 0x40) { \ -+ eventp->bstate = MASK_RELEASE(n); \ -+ sp->_mouse_bstate &= ~MASK_PRESS(n); \ -+ } \ -+ } while (0) - #else - #define PRESS_POSITION(n) \ -- eventp->bstate = (mmask_t) (prev & MASK_PRESS(n) \ -- ? REPORT_MOUSE_POSITION \ -- : MASK_PRESS(n)) -+ do { \ -+ eventp->bstate = (mmask_t) (sp->_mouse_bstate & MASK_PRESS(n) \ -+ ? REPORT_MOUSE_POSITION \ -+ : MASK_PRESS(n)); \ -+ sp->_mouse_bstate |= MASK_PRESS(n); \ -+ } while (0) - #endif - - switch (kbuf[0] & 0x3) { - case 0x0: -- if (kbuf[0] & 64) -+ if ((kbuf[0] & 96) == 96) { - eventp->bstate = MASK_PRESS(4); -- else -+ /* Do not record in sp->_mouse_bstate; there will be no -+ * corresponding release event. -+ */ -+ } else { - PRESS_POSITION(1); -+ } - break; - - case 0x1: -+ if ((kbuf[0] & 96) == 96) { - #if NCURSES_MOUSE_VERSION == 2 -- if (kbuf[0] & 64) - eventp->bstate = MASK_PRESS(5); -- else -+ /* See comment above for button 4 */ -+#else -+ /* Ignore this event as it is not a true press of the button */ -+ eventp->bstate = REPORT_MOUSE_POSITION; - #endif -+ } else { - PRESS_POSITION(2); -+ } - break; - - case 0x2: -@@ -939,12 +982,13 @@ - * release, we can infer the button actually released by looking at - * the previous event. - */ -- if (prev & (BUTTON_PRESSED | BUTTON_RELEASED)) { -+ if (sp->_mouse_bstate & BUTTON_PRESSED) { - eventp->bstate = BUTTON_RELEASED; - for (b = 1; b <= MAX_BUTTONS; ++b) { -- if (!(prev & MASK_PRESS(b))) -+ if (!(sp->_mouse_bstate & MASK_PRESS(b))) - eventp->bstate &= ~MASK_RELEASE(b); - } -+ sp->_mouse_bstate = 0; - } else { - /* - * XFree86 xterm will return a stream of release-events to -@@ -985,7 +1029,7 @@ - } - - static void --mouse_activate(SCREEN *sp, bool on) -+mouse_activate(SCREEN *sp, int on) - { - if (!on && !sp->_mouse_initialized) - return; -@@ -994,7 +1038,7 @@ - return; - - if (on) { -- -+ sp->_mouse_bstate = 0; - switch (sp->_mouse_type) { - case M_XTERM: - #if NCURSES_EXT_FUNCS -@@ -1074,10 +1118,13 @@ - /* parse a run of atomic mouse events into a gesture */ - { - MEVENT *eventp = sp->_mouse_eventp; -- MEVENT *ep, *runp, *next, *prev = PREV(eventp); -+ MEVENT *next, *ep; -+ MEVENT *first_valid = NULL; -+ MEVENT *first_invalid = NULL; - int n; - int b; - bool merge; -+ bool endLoop; - - TR(MY_TRACE, ("_nc_mouse_parse(%d) called", runcount)); - -@@ -1094,7 +1141,8 @@ - * - * It's possible that the run may not resolve to a single event (for - * example, if the user quadruple-clicks). If so, leading events -- * in the run are ignored. -+ * in the run are ignored if user does not call getmouse in a loop (getting -+ * them from newest to older). - * - * Note that this routine is independent of the format of the specific - * format of the pointing-device's reports. We can use it to parse -@@ -1102,79 +1150,110 @@ - * button basis, as long as the device-dependent mouse code puts stuff - * on the queue in MEVENT format. - */ -- if (runcount == 1) { -- TR(MY_TRACE, -- ("_nc_mouse_parse: returning simple mouse event %s at slot %ld", -- _nc_tracemouse(sp, prev), -- (long) IndexEV(sp, prev))); -- return (prev->id >= NORMAL_EVENT) -- ? ((prev->bstate & sp->_mouse_mask) ? TRUE : FALSE) -- : FALSE; -- } - -- /* find the start of the run */ -- runp = eventp; -- for (n = runcount; n > 0; n--) { -- runp = PREV(runp); -+ /* -+ * Reset all events that were not set, in case the user sometimes calls -+ * getmouse only once and other times until there are no more events in -+ * queue. -+ * -+ * This also allows reaching the beginning of the run. -+ */ -+ ep = eventp; -+ for (n = runcount; n < EV_MAX; n++) { -+ Invalidate(ep); -+ ep = NEXT(ep); - } - - #ifdef TRACE - if (USE_TRACEF(TRACE_IEVENT)) { - _trace_slot(sp, "before mouse press/release merge:"); - _tracef("_nc_mouse_parse: run starts at %ld, ends at %ld, count %d", -- RunParams(sp, eventp, runp), -+ RunParams(sp, eventp, ep), - runcount); - _nc_unlock_global(tracef); - } - #endif /* TRACE */ - - /* first pass; merge press/release pairs */ -- do { -- merge = FALSE; -- for (ep = runp; (next = NEXT(ep)) != eventp; ep = next) { -+ endLoop = FALSE; -+ while (!endLoop) { -+ next = NEXT(ep); -+ if (next == eventp) { -+ /* Will end the loop, but compact before */ -+ endLoop = TRUE; -+ } else { - - #define MASK_CHANGED(x) (!(ep->bstate & MASK_PRESS(x)) \ - == !(next->bstate & MASK_RELEASE(x))) - -- if (ep->x == next->x && ep->y == next->y -+ if (ValidEvent(ep) && ValidEvent(next) -+ && ep->x == next->x && ep->y == next->y - && (ep->bstate & BUTTON_PRESSED) -- && MASK_CHANGED(1) -- && MASK_CHANGED(2) -- && MASK_CHANGED(3) -- && MASK_CHANGED(4) --#if NCURSES_MOUSE_VERSION == 2 -- && MASK_CHANGED(5) --#endif -- ) { -+ && (!(next->bstate & BUTTON_PRESSED))) { -+ bool changed = TRUE; -+ - for (b = 1; b <= MAX_BUTTONS; ++b) { -- if ((sp->_mouse_mask & MASK_CLICK(b)) -- && (ep->bstate & MASK_PRESS(b))) { -- ep->bstate &= ~MASK_PRESS(b); -- ep->bstate |= MASK_CLICK(b); -- merge = TRUE; -+ if (!MASK_CHANGED(b)) { -+ changed = FALSE; -+ break; -+ } -+ } -+ -+ if (changed) { -+ merge = FALSE; -+ for (b = 1; b <= MAX_BUTTONS; ++b) { -+ if ((sp->_mouse_mask & MASK_CLICK(b)) -+ && (ep->bstate & MASK_PRESS(b))) { -+ next->bstate &= ~MASK_RELEASE(b); -+ next->bstate |= MASK_CLICK(b); -+ merge = TRUE; -+ } -+ } -+ if (merge) { -+ Invalidate(ep); - } - } -- if (merge) -- next->id = INVALID_EVENT; - } - } -- } while -- (merge); - -+ /* Compact valid events */ -+ if (!ValidEvent(ep)) { -+ if ((first_valid != NULL) && (first_invalid == NULL)) { -+ first_invalid = ep; -+ } -+ } else { -+ if (first_valid == NULL) { -+ first_valid = ep; -+ } else if (first_invalid != NULL) { -+ *first_invalid = *ep; -+ Invalidate(ep); -+ first_invalid = NEXT(first_invalid); -+ } -+ } -+ -+ ep = next; -+ } -+ -+ if (first_invalid != NULL) { -+ eventp = first_invalid; -+ } - #ifdef TRACE - if (USE_TRACEF(TRACE_IEVENT)) { - _trace_slot(sp, "before mouse click merge:"); -- _tracef("_nc_mouse_parse: run starts at %ld, ends at %ld, count %d", -- RunParams(sp, eventp, runp), -- runcount); -- _nc_unlock_global(tracef); -+ if (first_valid == NULL) { -+ _tracef("_nc_mouse_parse: no valid event"); -+ } else { -+ _tracef("_nc_mouse_parse: run starts at %ld, ends at %ld, count %d", -+ RunParams(sp, eventp, first_valid), -+ runcount); -+ _nc_unlock_global(tracef); -+ } - } - #endif /* TRACE */ - - /* -- * Second pass; merge click runs. At this point, click events are -- * each followed by one invalid event. We merge click events -- * forward in the queue. -+ * Second pass; merge click runs. We merge click events forward in the -+ * queue. For example, double click can be changed to triple click. - * - * NOTE: There is a problem with this design! If the application - * allows enough click events to pile up in the circular queue so -@@ -1187,87 +1266,102 @@ - * but the timer element would have to have sub-second resolution, - * which would get us into portability trouble. - */ -- do { -- MEVENT *follower; -- -- merge = FALSE; -- for (ep = runp; (next = NEXT(ep)) != eventp; ep = next) -- if (ep->id != INVALID_EVENT) { -- if (next->id != INVALID_EVENT) -- continue; -- follower = NEXT(next); -- if (follower->id == INVALID_EVENT) -- continue; -- -- /* merge click events forward */ -- if ((ep->bstate & BUTTON_CLICKED) -- && (follower->bstate & BUTTON_CLICKED)) { -- for (b = 1; b <= MAX_BUTTONS; ++b) { -- if ((sp->_mouse_mask & MASK_DOUBLE_CLICK(b)) -- && (follower->bstate & MASK_CLICK(b))) { -- follower->bstate &= ~MASK_CLICK(b); -- follower->bstate |= MASK_DOUBLE_CLICK(b); -- merge = TRUE; -- } -+ first_invalid = NULL; -+ endLoop = (first_valid == NULL); -+ ep = first_valid; -+ while (!endLoop) { -+ next = NEXT(ep); -+ -+ if (next == eventp) { -+ /* Will end the loop, but check event type and compact before */ -+ endLoop = TRUE; -+ } else if (!ValidEvent(next)) { -+ continue; -+ } else { -+ /* merge click events forward */ -+ if ((ep->bstate & BUTTON_CLICKED) -+ && (next->bstate & BUTTON_CLICKED)) { -+ merge = FALSE; -+ for (b = 1; b <= MAX_BUTTONS; ++b) { -+ if ((sp->_mouse_mask & MASK_DOUBLE_CLICK(b)) -+ && (ep->bstate & MASK_CLICK(b)) -+ && (next->bstate & MASK_CLICK(b))) { -+ next->bstate &= ~MASK_CLICK(b); -+ next->bstate |= MASK_DOUBLE_CLICK(b); -+ merge = TRUE; - } -- if (merge) -- ep->id = INVALID_EVENT; - } -+ if (merge) { -+ Invalidate(ep); -+ } -+ } - -- /* merge double-click events forward */ -- if ((ep->bstate & BUTTON_DOUBLE_CLICKED) -- && (follower->bstate & BUTTON_CLICKED)) { -- for (b = 1; b <= MAX_BUTTONS; ++b) { -- if ((sp->_mouse_mask & MASK_TRIPLE_CLICK(b)) -- && (follower->bstate & MASK_CLICK(b))) { -- follower->bstate &= ~MASK_CLICK(b); -- follower->bstate |= MASK_TRIPLE_CLICK(b); -- merge = TRUE; -- } -+ /* merge double-click events forward */ -+ if ((ep->bstate & BUTTON_DOUBLE_CLICKED) -+ && (next->bstate & BUTTON_CLICKED)) { -+ merge = FALSE; -+ for (b = 1; b <= MAX_BUTTONS; ++b) { -+ if ((sp->_mouse_mask & MASK_TRIPLE_CLICK(b)) -+ && (ep->bstate & MASK_DOUBLE_CLICK(b)) -+ && (next->bstate & MASK_CLICK(b))) { -+ next->bstate &= ~MASK_CLICK(b); -+ next->bstate |= MASK_TRIPLE_CLICK(b); -+ merge = TRUE; - } -- if (merge) -- ep->id = INVALID_EVENT; -+ } -+ if (merge) { -+ Invalidate(ep); - } - } -- } while -- (merge); -+ } - --#ifdef TRACE -- if (USE_TRACEF(TRACE_IEVENT)) { -- _trace_slot(sp, "before mouse event queue compaction:"); -- _tracef("_nc_mouse_parse: run starts at %ld, ends at %ld, count %d", -- RunParams(sp, eventp, runp), -- runcount); -- _nc_unlock_global(tracef); -- } --#endif /* TRACE */ -+ /* Discard event if it does not match event mask */ -+ if (!(ep->bstate & sp->_mouse_mask2)) { -+ Invalidate(ep); -+ } - -- /* -- * Now try to throw away trailing events flagged invalid, or that -- * don't match the current event mask. -- */ -- for (; runcount; prev = PREV(eventp), runcount--) -- if (prev->id == INVALID_EVENT || !(prev->bstate & sp->_mouse_mask)) { -- sp->_mouse_eventp = eventp = prev; -+ /* Compact valid events */ -+ if (!ValidEvent(ep)) { -+ if (ep == first_valid) { -+ first_valid = next; -+ } else if (first_invalid == NULL) { -+ first_invalid = ep; -+ } -+ } else if (first_invalid != NULL) { -+ *first_invalid = *ep; -+ Invalidate(ep); -+ first_invalid = NEXT(first_invalid); - } -+ -+ ep = next; -+ } -+ -+ if (first_invalid == NULL) { -+ first_invalid = eventp; -+ } -+ sp->_mouse_eventp = first_invalid; -+ - #ifdef TRACE -- if (USE_TRACEF(TRACE_IEVENT)) { -- _trace_slot(sp, "after mouse event queue compaction:"); -- _tracef("_nc_mouse_parse: run starts at %ld, ends at %ld, count %d", -- RunParams(sp, eventp, runp), -- runcount); -- _nc_unlock_global(tracef); -+ if (first_valid != NULL) { -+ if (USE_TRACEF(TRACE_IEVENT)) { -+ _trace_slot(sp, "after mouse event queue compaction:"); -+ _tracef("_nc_mouse_parse: run starts at %ld, ends at %ld, count %d", -+ RunParams(sp, first_invalid, first_valid), -+ runcount); -+ _nc_unlock_global(tracef); -+ } -+ for (ep = first_valid; ep != first_invalid; ep = NEXT(ep)) { -+ if (ValidEvent(ep)) -+ TR(MY_TRACE, -+ ("_nc_mouse_parse: returning composite mouse event %s at slot %ld", -+ _nc_tracemouse(sp, ep), -+ (long) IndexEV(sp, ep))); -+ } - } -- for (ep = runp; ep != eventp; ep = NEXT(ep)) -- if (ep->id != INVALID_EVENT) -- TR(MY_TRACE, -- ("_nc_mouse_parse: returning composite mouse event %s at slot %ld", -- _nc_tracemouse(sp, ep), -- (long) IndexEV(sp, ep))); - #endif /* TRACE */ - - /* after all this, do we have a valid event? */ -- return (PREV(eventp)->id != INVALID_EVENT); -+ return ValidEvent(PREV(first_invalid)); - } - - static void -@@ -1359,7 +1453,16 @@ - /* compute the current-event pointer */ - MEVENT *prev = PREV(eventp); - -- if (prev->id != INVALID_EVENT) { -+ /* -+ * Discard events not matching mask (there could be still some if -+ * _nc_mouse_parse was not called, e.g., when _nc_mouse_inline returns -+ * false). -+ */ -+ while (ValidEvent(prev) && (!(prev->bstate & SP_PARM->_mouse_mask2))) { -+ Invalidate(prev); -+ prev = PREV(prev); -+ } -+ if (ValidEvent(prev)) { - /* copy the event we find there */ - *aevent = *prev; - -@@ -1367,9 +1470,16 @@ - _nc_tracemouse(SP_PARM, prev), - (long) IndexEV(SP_PARM, prev))); - -- prev->id = INVALID_EVENT; /* so the queue slot becomes free */ -- SP_PARM->_mouse_eventp = PREV(prev); -+ Invalidate(prev); /* so the queue slot becomes free */ -+ SP_PARM->_mouse_eventp = prev; - result = OK; -+ } else { -+ /* Reset the provided event */ -+ aevent->bstate = 0; -+ Invalidate(aevent); -+ aevent->x = 0; -+ aevent->y = 0; -+ aevent->z = 0; - } - } - returnCode(result); -@@ -1420,6 +1530,7 @@ - /* set the mouse event mask */ - { - mmask_t result = 0; -+ int b; - - T((T_CALLED("mousemask(%p,%#lx,%p)"), - (void *) SP_PARM, -@@ -1447,6 +1558,22 @@ - mouse_activate(SP_PARM, (bool) (result != 0)); - - SP_PARM->_mouse_mask = result; -+ SP_PARM->_mouse_mask2 = result; -+ -+ /* -+ * Make a mask corresponding to the states we will need to -+ * retain (temporarily) while building up the state that the -+ * user asked for. -+ */ -+ for (b = 1; b <= MAX_BUTTONS; ++b) { -+ if (SP_PARM->_mouse_mask2 & MASK_TRIPLE_CLICK(b)) -+ SP_PARM->_mouse_mask2 |= MASK_DOUBLE_CLICK(b); -+ if (SP_PARM->_mouse_mask2 & MASK_DOUBLE_CLICK(b)) -+ SP_PARM->_mouse_mask2 |= MASK_CLICK(b); -+ if (SP_PARM->_mouse_mask2 & MASK_CLICK(b)) -+ SP_PARM->_mouse_mask2 |= (MASK_PRESS(b) | -+ MASK_RELEASE(b)); -+ } - } - } - } -diff -Naur ncurses-5.9/ncurses/base/lib_newterm.c ncurses-5.9.patch/ncurses/base/lib_newterm.c ---- ncurses-5.9/ncurses/base/lib_newterm.c 2010-05-21 01:25:18.000000000 +0200 -+++ ncurses-5.9.patch/ncurses/base/lib_newterm.c 2014-09-01 16:33:22.373792151 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2013,2014 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -42,17 +42,13 @@ - - #include <curses.priv.h> - --#if SVR4_TERMIO && !defined(_POSIX_SOURCE) --#define _POSIX_SOURCE --#endif -- - #ifndef CUR - #define CUR SP_TERMTYPE - #endif - - #include <tic.h> - --MODULE_ID("$Id: lib_newterm.c,v 1.86 2010/05/20 23:25:18 tom Exp $") -+MODULE_ID("$Id: lib_newterm.c,v 1.91 2014/03/08 20:32:59 tom Exp $") - - #ifdef USE_TERM_DRIVER - #define NumLabels InfoOf(SP_PARM).numlabels -@@ -185,7 +181,7 @@ - START_TRACE(); - T((T_CALLED("newterm(%p, \"%s\", %p,%p)"), - (void *) SP_PARM, -- name, -+ (name ? name : ""), - (void *) ofp, - (void *) ifp)); - -@@ -283,7 +279,8 @@ - NCURSES_SP_NAME(typeahead) (NCURSES_SP_ARGx fileno(_ifp)); - #ifdef TERMIOS - SP_PARM->_use_meta = ((new_term->Ottyb.c_cflag & CSIZE) == CS8 && -- !(new_term->Ottyb.c_iflag & ISTRIP)); -+ !(new_term->Ottyb.c_iflag & ISTRIP)) || -+ USE_KLIBC_KBD; - #else - SP_PARM->_use_meta = FALSE; - #endif -@@ -309,8 +306,8 @@ - - /* compute movement costs so we can do better move optimization */ - #ifdef USE_TERM_DRIVER -- TCBOf(SP_PARM)->drv->scinit(SP_PARM); --#else -+ TCBOf(SP_PARM)->drv->td_scinit(SP_PARM); -+#else /* ! USE_TERM_DRIVER */ - /* - * Check for mismatched graphic-rendition capabilities. Most SVr4 - * terminfo trees contain entries that have rmul or rmso equated to -@@ -323,13 +320,16 @@ - #define SGR0_TEST(mode) (mode != 0) && (exit_attribute_mode == 0 || strcmp(mode, exit_attribute_mode)) - SP_PARM->_use_rmso = SGR0_TEST(exit_standout_mode); - SP_PARM->_use_rmul = SGR0_TEST(exit_underline_mode); -+#if USE_ITALIC -+ SP_PARM->_use_ritm = SGR0_TEST(exit_italics_mode); -+#endif - - /* compute movement costs so we can do better move optimization */ - _nc_mvcur_init(); - - /* initialize terminal to a sane state */ - _nc_screen_init(); --#endif -+#endif /* USE_TERM_DRIVER */ - - /* Initialize the terminal line settings. */ - _nc_initscr(NCURSES_SP_ARG); -diff -Naur ncurses-5.9/ncurses/base/lib_newwin.c ncurses-5.9.patch/ncurses/base/lib_newwin.c ---- ncurses-5.9/ncurses/base/lib_newwin.c 2011-03-07 22:58:17.000000000 +0100 -+++ ncurses-5.9.patch/ncurses/base/lib_newwin.c 2014-09-01 16:33:22.373792151 +0200 -@@ -43,7 +43,7 @@ - #include <curses.priv.h> - #include <stddef.h> - --MODULE_ID("$Id: lib_newwin.c,v 1.69 2011/03/07 21:58:17 tom Exp $") -+MODULE_ID("$Id: lib_newwin.c,v 1.71 2011/05/28 21:32:51 tom Exp $") - - #define window_is(name) ((sp)->_##name == win) - -@@ -141,7 +141,11 @@ - T((T_CALLED("newwin(%p, %d,%d,%d,%d)"), (void *) SP_PARM, num_lines, num_columns, - begy, begx)); - -- if (begy < 0 || begx < 0 || num_lines < 0 || num_columns < 0) -+ if (begy < 0 -+ || begx < 0 -+ || num_lines < 0 -+ || num_columns < 0 -+ || SP_PARM == 0) - returnWin(0); - - if (num_lines == 0) -@@ -235,10 +239,15 @@ - NCURSES_EXPORT(WINDOW *) - subwin(WINDOW *w, int l, int c, int y, int x) - { -+ WINDOW *result = 0; -+ - T((T_CALLED("subwin(%p, %d, %d, %d, %d)"), (void *) w, l, c, y, x)); -- T(("parent has begy = %ld, begx = %ld", (long) w->_begy, (long) w->_begx)); -+ if (w != 0) { -+ T(("parent has begy = %ld, begx = %ld", (long) w->_begy, (long) w->_begx)); - -- returnWin(derwin(w, l, c, y - w->_begy, x - w->_begx)); -+ result = derwin(w, l, c, y - w->_begy, x - w->_begx); -+ } -+ returnWin(result); - } - - static bool -diff -Naur ncurses-5.9/ncurses/base/lib_overlay.c ncurses-5.9.patch/ncurses/base/lib_overlay.c ---- ncurses-5.9/ncurses/base/lib_overlay.c 2009-10-25 01:21:31.000000000 +0200 -+++ ncurses-5.9.patch/ncurses/base/lib_overlay.c 2014-09-01 16:33:22.373792151 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2008,2009 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2009,2013 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -40,7 +40,7 @@ - - #include <curses.priv.h> - --MODULE_ID("$Id: lib_overlay.c,v 1.29 2009/10/24 23:21:31 tom Exp $") -+MODULE_ID("$Id: lib_overlay.c,v 1.31 2013/04/06 23:47:13 tom Exp $") - - static int - overlap(const WINDOW *const src, WINDOW *const dst, int const flag) -@@ -151,7 +151,10 @@ - dminrow, dmincol, - dmaxrow, dmaxcol, over)); - -- if (src && dst) { -+ if (src != 0 -+ && dst != 0 -+ && dmaxrow >= dminrow -+ && dmaxcol >= dmincol) { - _nc_lock_global(curses); - - bk = AttrOf(dst->_nc_bkgd); -@@ -160,6 +163,7 @@ - /* make sure rectangle exists in source */ - if ((sminrow + dmaxrow - dminrow) <= (src->_maxy + 1) && - (smincol + dmaxcol - dmincol) <= (src->_maxx + 1)) { -+ bool copied = FALSE; - - T(("rectangle exists in source")); - -@@ -172,10 +176,18 @@ - dy <= dmaxrow; - sy++, dy++) { - -+ if (dy < 0 || sy < 0) -+ continue; -+ - touched = FALSE; - for (dx = dmincol, sx = smincol; - dx <= dmaxcol; - sx++, dx++) { -+ -+ if (dx < 0 || sx < 0) -+ continue; -+ copied = TRUE; -+ - if (over) { - if ((CharOf(src->_line[sy].text[sx]) != L(' ')) && - (!CharEq(dst->_line[dy].text[dx], -@@ -201,7 +213,8 @@ - } - } - T(("finished copywin")); -- rc = OK; -+ if (copied) -+ rc = OK; - } - } - _nc_unlock_global(curses); -diff -Naur ncurses-5.9/ncurses/base/lib_printw.c ncurses-5.9.patch/ncurses/base/lib_printw.c ---- ncurses-5.9/ncurses/base/lib_printw.c 2009-10-25 00:07:03.000000000 +0200 -+++ ncurses-5.9.patch/ncurses/base/lib_printw.c 2014-09-01 16:33:22.373792151 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2005,2009 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2009,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -27,7 +27,7 @@ - ****************************************************************************/ - - /**************************************************************************** -- * Author: Thomas E. Dickey <dickey@clark.net> 1997 * -+ * Author: Thomas E. Dickey 1997-on * - ****************************************************************************/ - - /* -@@ -39,7 +39,7 @@ - - #include <curses.priv.h> - --MODULE_ID("$Id: lib_printw.c,v 1.20 2009/10/24 22:07:03 tom Exp $") -+MODULE_ID("$Id: lib_printw.c,v 1.23 2012/09/03 17:55:28 tom Exp $") - - NCURSES_EXPORT(int) - printw(const char *fmt,...) -@@ -48,10 +48,11 @@ - int code; - - #ifdef TRACE -- va_start(argp, fmt); -+ va_list argq; -+ va_start(argq, fmt); - T((T_CALLED("printw(%s%s)"), -- _nc_visbuf(fmt), _nc_varargs(fmt, argp))); -- va_end(argp); -+ _nc_visbuf(fmt), _nc_varargs(fmt, argq))); -+ va_end(argq); - #endif - - va_start(argp, fmt); -@@ -68,10 +69,11 @@ - int code; - - #ifdef TRACE -- va_start(argp, fmt); -+ va_list argq; -+ va_start(argq, fmt); - T((T_CALLED("wprintw(%p,%s%s)"), -- (void *) win, _nc_visbuf(fmt), _nc_varargs(fmt, argp))); -- va_end(argp); -+ (void *) win, _nc_visbuf(fmt), _nc_varargs(fmt, argq))); -+ va_end(argq); - #endif - - va_start(argp, fmt); -@@ -88,10 +90,11 @@ - int code; - - #ifdef TRACE -- va_start(argp, fmt); -+ va_list argq; -+ va_start(argq, fmt); - T((T_CALLED("mvprintw(%d,%d,%s%s)"), -- y, x, _nc_visbuf(fmt), _nc_varargs(fmt, argp))); -- va_end(argp); -+ y, x, _nc_visbuf(fmt), _nc_varargs(fmt, argq))); -+ va_end(argq); - #endif - - if ((code = move(y, x)) != ERR) { -@@ -109,10 +112,11 @@ - int code; - - #ifdef TRACE -- va_start(argp, fmt); -+ va_list argq; -+ va_start(argq, fmt); - T((T_CALLED("mvwprintw(%d,%d,%p,%s%s)"), -- y, x, (void *) win, _nc_visbuf(fmt), _nc_varargs(fmt, argp))); -- va_end(argp); -+ y, x, (void *) win, _nc_visbuf(fmt), _nc_varargs(fmt, argq))); -+ va_end(argq); - #endif - - if ((code = wmove(win, y, x)) != ERR) { -diff -Naur ncurses-5.9/ncurses/base/lib_refresh.c ncurses-5.9.patch/ncurses/base/lib_refresh.c ---- ncurses-5.9/ncurses/base/lib_refresh.c 2010-12-19 02:22:58.000000000 +0100 -+++ ncurses-5.9.patch/ncurses/base/lib_refresh.c 2014-09-01 16:33:22.374792153 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2010,2011 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -42,7 +42,7 @@ - - #include <curses.priv.h> - --MODULE_ID("$Id: lib_refresh.c,v 1.44 2010/12/19 01:22:58 tom Exp $") -+MODULE_ID("$Id: lib_refresh.c,v 1.45 2011/06/25 19:02:22 Vassili.Courzakis Exp $") - - NCURSES_EXPORT(int) - wrefresh(WINDOW *win) -@@ -90,12 +90,6 @@ - #endif - - T((T_CALLED("wnoutrefresh(%p)"), (void *) win)); --#ifdef TRACE -- if (USE_TRACEF(TRACE_UPDATE)) { -- _tracedump("...win", win); -- _nc_unlock_global(tracef); -- } --#endif /* TRACE */ - - /* - * This function will break badly if we try to refresh a pad. -@@ -104,6 +98,13 @@ - || (win->_flags & _ISPAD)) - returnCode(ERR); - -+#ifdef TRACE -+ if (USE_TRACEF(TRACE_UPDATE)) { -+ _tracedump("...win", win); -+ _nc_unlock_global(tracef); -+ } -+#endif /* TRACE */ -+ - /* put them here so "win == 0" won't break our code */ - begx = win->_begx; - begy = win->_begy; -diff -Naur ncurses-5.9/ncurses/base/lib_restart.c ncurses-5.9.patch/ncurses/base/lib_restart.c ---- ncurses-5.9/ncurses/base/lib_restart.c 2009-10-25 00:47:43.000000000 +0200 -+++ ncurses-5.9.patch/ncurses/base/lib_restart.c 2014-09-01 16:33:22.411792212 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2008,2009 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -41,11 +41,7 @@ - - #include <curses.priv.h> - --#if SVR4_TERMIO && !defined(_POSIX_SOURCE) --#define _POSIX_SOURCE --#endif -- --MODULE_ID("$Id: lib_restart.c,v 1.13 2009/10/24 22:47:43 tom Exp $") -+MODULE_ID("$Id: lib_restart.c,v 1.15 2012/12/08 20:40:06 tom Exp $") - - NCURSES_EXPORT(int) - NCURSES_SP_NAME(restartterm) (NCURSES_SP_DCLx -@@ -55,7 +51,7 @@ - { - int result; - #ifdef USE_TERM_DRIVER -- TERMINAL *new_term; -+ TERMINAL *new_term = 0; - #endif - - T((T_CALLED("restartterm(%p,%s,%d,%p)"), -diff -Naur ncurses-5.9/ncurses/base/lib_scanw.c ncurses-5.9.patch/ncurses/base/lib_scanw.c ---- ncurses-5.9/ncurses/base/lib_scanw.c 2009-10-25 00:35:14.000000000 +0200 -+++ ncurses-5.9.patch/ncurses/base/lib_scanw.c 2014-09-01 16:33:22.411792212 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2001,2009 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2009,2011 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -40,14 +40,14 @@ - - #include <curses.priv.h> - --MODULE_ID("$Id: lib_scanw.c,v 1.12 2009/10/24 22:35:14 tom Exp $") -+MODULE_ID("$Id: lib_scanw.c,v 1.13 2011/10/22 16:31:35 tom Exp $") - - NCURSES_EXPORT(int) - vwscanw(WINDOW *win, NCURSES_CONST char *fmt, va_list argp) - { - char buf[BUFSIZ]; - -- if (wgetnstr(win, buf, sizeof(buf) - 1) == ERR) -+ if (wgetnstr(win, buf, (int) sizeof(buf) - 1) == ERR) - return (ERR); - - return (vsscanf(buf, fmt, argp)); -diff -Naur ncurses-5.9/ncurses/base/lib_screen.c ncurses-5.9.patch/ncurses/base/lib_screen.c ---- ncurses-5.9/ncurses/base/lib_screen.c 2009-10-25 00:08:55.000000000 +0200 -+++ ncurses-5.9.patch/ncurses/base/lib_screen.c 2014-09-01 16:33:22.412792214 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2008,2009 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2009,2011 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -39,7 +39,7 @@ - #define CUR SP_TERMTYPE - #endif - --MODULE_ID("$Id: lib_screen.c,v 1.38 2009/10/24 22:08:55 tom Exp $") -+MODULE_ID("$Id: lib_screen.c,v 1.41 2011/10/22 15:03:11 tom Exp $") - - #define MAX_SIZE 0x3fff /* 16k is big enough for a window or pad */ - -@@ -51,8 +51,11 @@ - - T((T_CALLED("getwin(%p)"), (void *) filep)); - -+ if (filep == 0) { -+ returnWin(0); -+ } - clearerr(filep); -- if (fread(&tmp, 1, sizeof(WINDOW), filep) < sizeof(WINDOW) -+ if (fread(&tmp, (size_t) 1, sizeof(WINDOW), filep) < sizeof(WINDOW) - || ferror(filep) - || tmp._maxy == 0 - || tmp._maxy > MAX_SIZE -@@ -110,7 +113,7 @@ - - for (n = 0; n <= nwin->_maxy; n++) { - clearerr(filep); -- if (fread(nwin->_line[n].text, 1, linesize, filep) < linesize -+ if (fread(nwin->_line[n].text, (size_t) 1, linesize, filep) < linesize - || ferror(filep)) { - delwin(nwin); - returnWin(0); -@@ -141,7 +144,7 @@ - size_t len = (size_t) (win->_maxx + 1); - - clearerr(filep); -- if (fwrite(win, sizeof(WINDOW), 1, filep) != 1 -+ if (fwrite(win, sizeof(WINDOW), (size_t) 1, filep) != 1 - || ferror(filep)) - returnCode(code); - -@@ -189,18 +192,20 @@ - NCURSES_EXPORT(int) - scr_dump(const char *file) - { -+ int result; - FILE *fp = 0; - - T((T_CALLED("scr_dump(%s)"), _nc_visbuf(file))); - - if (_nc_access(file, W_OK) < 0 - || (fp = fopen(file, "wb")) == 0) { -- returnCode(ERR); -+ result = ERR; - } else { - (void) putwin(newscr, fp); - (void) fclose(fp); -- returnCode(OK); -+ result = OK; - } -+ returnCode(result); - } - - NCURSES_EXPORT(int) -diff -Naur ncurses-5.9/ncurses/base/lib_scroll.c ncurses-5.9.patch/ncurses/base/lib_scroll.c ---- ncurses-5.9/ncurses/base/lib_scroll.c 2010-12-19 02:48:09.000000000 +0100 -+++ ncurses-5.9.patch/ncurses/base/lib_scroll.c 2014-09-01 16:33:22.412792214 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2010,2011 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -43,13 +43,13 @@ - - #include <curses.priv.h> - --MODULE_ID("$Id: lib_scroll.c,v 1.28 2010/12/19 01:48:09 tom Exp $") -+MODULE_ID("$Id: lib_scroll.c,v 1.29 2011/10/22 16:34:50 tom Exp $") - - NCURSES_EXPORT(void) - _nc_scroll_window(WINDOW *win, - int const n, -- NCURSES_SIZE_T const top, -- NCURSES_SIZE_T const bottom, -+ int const top, -+ int const bottom, - NCURSES_CH_T blank) - { - int limit; -diff -Naur ncurses-5.9/ncurses/base/lib_set_term.c ncurses-5.9.patch/ncurses/base/lib_set_term.c ---- ncurses-5.9/ncurses/base/lib_set_term.c 2010-12-20 01:42:20.000000000 +0100 -+++ ncurses-5.9.patch/ncurses/base/lib_set_term.c 2014-09-01 16:33:22.412792214 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2013,2014 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -47,7 +47,7 @@ - #define CUR SP_TERMTYPE - #endif - --MODULE_ID("$Id: lib_set_term.c,v 1.138 2010/12/20 00:42:20 tom Exp $") -+MODULE_ID("$Id: lib_set_term.c,v 1.149 2014/03/08 20:32:59 tom Exp $") - - #ifdef USE_TERM_DRIVER - #define MaxColors InfoOf(sp).maxcolors -@@ -188,18 +188,7 @@ - FreeIfNeeded(sp->_acs_map); - FreeIfNeeded(sp->_screen_acs_map); - -- /* -- * If the associated output stream has been closed, we can discard the -- * set-buffer. Limit the error check to EBADF, since fflush may fail -- * for other reasons than trying to operate upon a closed stream. -- */ -- if (sp->_ofp != 0 -- && sp->_setbuf != 0 -- && fflush(sp->_ofp) != 0 -- && errno == EBADF) { -- free(sp->_setbuf); -- } -- -+ NCURSES_SP_NAME(_nc_flush) (NCURSES_SP_ARG); - NCURSES_SP_NAME(del_curterm) (NCURSES_SP_ARGx sp->_term); - free(sp); - -@@ -272,8 +261,8 @@ - } - #endif - --#define ReturnScreenError() _nc_set_screen(0); \ -- returnCode(ERR) -+#define ReturnScreenError() { _nc_set_screen(0); \ -+ returnCode(ERR); } while (0) - - /* OS-independent screen initializations */ - NCURSES_EXPORT(int) -@@ -284,7 +273,7 @@ - int slines, - int scolumns, - FILE *output, -- bool filtered, -+ int filtered, - int slk_format) - { - char *env; -@@ -362,7 +351,7 @@ - slines = 1; - SET_LINES(slines); - #ifdef USE_TERM_DRIVER -- CallDriver(sp, setfilter); -+ CallDriver(sp, td_setfilter); - #else - clear_screen = 0; - cursor_down = parm_down_cursor = 0; -@@ -383,7 +372,15 @@ - sp->_lines = (NCURSES_SIZE_T) slines; - sp->_lines_avail = (NCURSES_SIZE_T) slines; - sp->_columns = (NCURSES_SIZE_T) scolumns; -+ -+ fflush(output); -+ sp->_ofd = output ? fileno(output) : -1; - sp->_ofp = output; -+ sp->out_limit = (size_t) ((2 + slines) * (6 + scolumns)); -+ if ((sp->out_buffer = malloc(sp->out_limit)) == 0) -+ sp->out_limit = 0; -+ sp->out_inuse = 0; -+ - SP_PRE_INIT(sp); - SetNoPadding(sp); - -@@ -510,16 +507,7 @@ - - if (magic_cookie_glitch > 0) { /* tvi, wyse */ - -- sp->_xmc_triggers = sp->_ok_attributes & ( -- A_STANDOUT | -- A_UNDERLINE | -- A_REVERSE | -- A_BLINK | -- A_DIM | -- A_BOLD | -- A_INVIS | -- A_PROTECT -- ); -+ sp->_xmc_triggers = sp->_ok_attributes & XMC_CONFLICT; - #if 0 - /* - * We "should" treat colors as an attribute. The wyse350 (and its -@@ -584,9 +572,13 @@ - - NCURSES_SP_NAME(_nc_init_acs) (NCURSES_SP_ARG); - #if USE_WIDEC_SUPPORT -+ sp->_screen_unicode = _nc_unicode_locale(); - _nc_init_wacs(); -+ if (_nc_wacs == 0) { -+ ReturnScreenError(); -+ } - -- sp->_screen_acs_fix = (_nc_unicode_locale() -+ sp->_screen_acs_fix = (sp->_screen_unicode - && _nc_locale_breaks_acs(sp->_term)); - #endif - env = _nc_get_locale(); -@@ -619,6 +611,7 @@ - #endif - #if USE_SIZECHANGE - sp->_resize = NCURSES_SP_NAME(resizeterm); -+ sp->_ungetch = safe_ungetch; - #endif - - NewScreen(sp)->_clear = TRUE; -@@ -695,7 +688,7 @@ - _nc_setupscreen(int slines GCC_UNUSED, - int scolumns GCC_UNUSED, - FILE *output, -- bool filtered, -+ int filtered, - int slk_format) - { - SCREEN *sp = 0; -@@ -759,6 +752,7 @@ - int line, - int (*init) (WINDOW *, int)) - { -+ START_TRACE(); - return NCURSES_SP_NAME(_nc_ripoffline) (NCURSES_SP_ARGx - (line < 0) ? -1 : 1, - init); -diff -Naur ncurses-5.9/ncurses/base/lib_slkatr_set.c ncurses-5.9.patch/ncurses/base/lib_slkatr_set.c ---- ncurses-5.9/ncurses/base/lib_slkatr_set.c 2009-10-25 00:47:03.000000000 +0200 -+++ ncurses-5.9.patch/ncurses/base/lib_slkatr_set.c 2014-09-01 16:33:22.412792214 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2005,2009 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2009,2014 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -38,12 +38,12 @@ - */ - #include <curses.priv.h> - --MODULE_ID("$Id: lib_slkatr_set.c,v 1.14 2009/10/24 22:47:03 tom Exp $") -+MODULE_ID("$Id: lib_slkatr_set.c,v 1.15 2014/02/01 22:10:42 tom Exp $") - - NCURSES_EXPORT(int) - NCURSES_SP_NAME(slk_attr_set) (NCURSES_SP_DCLx - const attr_t attr, -- short color_pair_number, -+ NCURSES_PAIRS_T color_pair_number, - void *opts) - { - int code = ERR; -@@ -51,7 +51,7 @@ - T((T_CALLED("slk_attr_set(%p,%s,%d)"), - (void *) SP_PARM, - _traceattr(attr), -- color_pair_number)); -+ (int) color_pair_number)); - - if (SP_PARM != 0 - && SP_PARM->_slk != 0 -@@ -71,7 +71,7 @@ - - #if NCURSES_SP_FUNCS - NCURSES_EXPORT(int) --slk_attr_set(const attr_t attr, short color_pair_number, void *opts) -+slk_attr_set(const attr_t attr, NCURSES_COLOR_T color_pair_number, void *opts) - { - return NCURSES_SP_NAME(slk_attr_set) (CURRENT_SCREEN, attr, - color_pair_number, opts); -diff -Naur ncurses-5.9/ncurses/base/lib_slkcolor.c ncurses-5.9.patch/ncurses/base/lib_slkcolor.c ---- ncurses-5.9/ncurses/base/lib_slkcolor.c 2009-10-25 00:12:21.000000000 +0200 -+++ ncurses-5.9.patch/ncurses/base/lib_slkcolor.c 2014-09-01 16:33:22.412792214 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2005,2009 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2009,2014 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -38,14 +38,14 @@ - */ - #include <curses.priv.h> - --MODULE_ID("$Id: lib_slkcolor.c,v 1.16 2009/10/24 22:12:21 tom Exp $") -+MODULE_ID("$Id: lib_slkcolor.c,v 1.17 2014/02/01 22:10:42 tom Exp $") - - NCURSES_EXPORT(int) --NCURSES_SP_NAME(slk_color) (NCURSES_SP_DCLx short color_pair_number) -+NCURSES_SP_NAME(slk_color) (NCURSES_SP_DCLx NCURSES_PAIRS_T color_pair_number) - { - int code = ERR; - -- T((T_CALLED("slk_color(%p,%d)"), (void *) SP_PARM, color_pair_number)); -+ T((T_CALLED("slk_color(%p,%d)"), (void *) SP_PARM, (int) color_pair_number)); - - if (SP_PARM != 0 - && SP_PARM->_slk != 0 -@@ -61,7 +61,7 @@ - - #if NCURSES_SP_FUNCS - NCURSES_EXPORT(int) --slk_color(short color_pair_number) -+slk_color(NCURSES_PAIRS_T color_pair_number) - { - return NCURSES_SP_NAME(slk_color) (CURRENT_SCREEN, color_pair_number); - } -diff -Naur ncurses-5.9/ncurses/base/lib_slkrefr.c ncurses-5.9.patch/ncurses/base/lib_slkrefr.c ---- ncurses-5.9/ncurses/base/lib_slkrefr.c 2010-05-01 21:17:28.000000000 +0200 -+++ ncurses-5.9.patch/ncurses/base/lib_slkrefr.c 2014-09-01 16:33:22.412792214 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2013,2014 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -43,7 +43,7 @@ - #define CUR SP_TERMTYPE - #endif - --MODULE_ID("$Id: lib_slkrefr.c,v 1.26 2010/05/01 19:17:28 tom Exp $") -+MODULE_ID("$Id: lib_slkrefr.c,v 1.30 2014/03/08 20:32:59 tom Exp $") - - #ifdef USE_TERM_DRIVER - #define NumLabels InfoOf(SP_PARM).numlabels -@@ -97,25 +97,25 @@ - if (slk->ent[i].visible) { - if (numlab > 0 && SLK_STDFMT(fmt)) { - #ifdef USE_TERM_DRIVER -- CallDriver_2(sp, hwlabel, i + 1, slk->ent[i].form_text); -+ CallDriver_2(sp, td_hwlabel, i + 1, slk->ent[i].form_text); - #else - if (i < num_labels) { -- TPUTS_TRACE("plab_norm"); -- putp(TPARM_2(plab_norm, i + 1, slk->ent[i].form_text)); -+ NCURSES_PUTP2("plab_norm", -+ TPARM_2(plab_norm, -+ i + 1, -+ slk->ent[i].form_text)); - } - #endif - } else { - if (fmt == 4) - slk_paint_info(slk->win); - wmove(slk->win, SLK_LINES(fmt) - 1, slk->ent[i].ent_x); -- if (sp->_slk) { -- (void) wattrset(slk->win, AttrOf(sp->_slk->attr)); -- } -+ (void) wattrset(slk->win, (int) AttrOf(slk->attr)); - waddstr(slk->win, slk->ent[i].form_text); - /* if we simulate SLK's, it's looking much more - natural to use the current ATTRIBUTE also - for the label window */ -- (void) wattrset(slk->win, WINDOW_ATTRS(StdScreen(sp))); -+ (void) wattrset(slk->win, (int) WINDOW_ATTRS(StdScreen(sp))); - } - } - slk->ent[i].dirty = FALSE; -@@ -125,14 +125,12 @@ - - if (numlab > 0) { - #ifdef USE_TERM_DRIVER -- CallDriver_1(sp, hwlabelOnOff, slk->hidden ? FALSE : TRUE); -+ CallDriver_1(sp, td_hwlabelOnOff, slk->hidden ? FALSE : TRUE); - #else - if (slk->hidden) { -- TPUTS_TRACE("label_off"); -- putp(label_off); -+ NCURSES_PUTP2("label_off", label_off); - } else { -- TPUTS_TRACE("label_on"); -- putp(label_on); -+ NCURSES_PUTP2("label_on", label_on); - } - #endif - } -diff -Naur ncurses-5.9/ncurses/base/lib_slkset.c ncurses-5.9.patch/ncurses/base/lib_slkset.c ---- ncurses-5.9/ncurses/base/lib_slkset.c 2010-12-26 00:43:58.000000000 +0100 -+++ ncurses-5.9.patch/ncurses/base/lib_slkset.c 2014-09-01 16:33:22.412792214 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -44,13 +44,13 @@ - #endif - #endif - --MODULE_ID("$Id: lib_slkset.c,v 1.21 2010/12/25 23:43:58 tom Exp $") -+MODULE_ID("$Id: lib_slkset.c,v 1.24 2012/12/08 23:09:25 tom Exp $") - - NCURSES_EXPORT(int) - NCURSES_SP_NAME(slk_set) (NCURSES_SP_DCLx int i, const char *astr, int format) - { - SLK *slk; -- int offset; -+ int offset = 0; - int numchrs; - int numcols; - int limit; -@@ -111,13 +111,12 @@ - slk->ent[i].ent_text[numchrs] = '\0'; - - if ((slk->ent[i].form_text = (char *) _nc_doalloc(slk->ent[i].form_text, -- (unsigned) (limit + -- numchrs + 1)) -+ (size_t) (limit + -+ numchrs + 1)) - ) == 0) - returnCode(ERR); - - switch (format) { -- default: - case 0: /* left-justified */ - offset = 0; - break; -@@ -131,16 +130,16 @@ - if (offset <= 0) - offset = 0; - else -- memset(slk->ent[i].form_text, ' ', (unsigned) offset); -+ memset(slk->ent[i].form_text, ' ', (size_t) offset); - - memcpy(slk->ent[i].form_text + offset, - slk->ent[i].ent_text, -- (unsigned) numchrs); -+ (size_t) numchrs); - - if (offset < limit) { - memset(slk->ent[i].form_text + offset + numchrs, - ' ', -- (unsigned) (limit - (offset + numcols))); -+ (size_t) (limit - (offset + numcols))); - } - - slk->ent[i].form_text[numchrs - numcols + limit] = 0; -diff -Naur ncurses-5.9/ncurses/base/lib_touch.c ncurses-5.9.patch/ncurses/base/lib_touch.c ---- ncurses-5.9/ncurses/base/lib_touch.c 2010-12-19 02:22:58.000000000 +0100 -+++ ncurses-5.9.patch/ncurses/base/lib_touch.c 2014-09-01 16:33:22.413792217 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -43,7 +43,7 @@ - - #include <curses.priv.h> - --MODULE_ID("$Id: lib_touch.c,v 1.11 2010/12/19 01:22:58 tom Exp $") -+MODULE_ID("$Id: lib_touch.c,v 1.12 2012/06/09 20:29:33 tom Exp $") - - NCURSES_EXPORT(bool) - is_linetouched(WINDOW *win, int line) -@@ -84,7 +84,7 @@ - for (i = y; i < y + n; i++) { - if (i > win->_maxy) - break; -- win->_line[i].firstchar = changed ? 0 : _NOCHANGE; -+ win->_line[i].firstchar = (NCURSES_SIZE_T) (changed ? 0 : _NOCHANGE); - win->_line[i].lastchar = (NCURSES_SIZE_T) (changed - ? win->_maxx - : _NOCHANGE); -diff -Naur ncurses-5.9/ncurses/base/lib_ungetch.c ncurses-5.9.patch/ncurses/base/lib_ungetch.c ---- ncurses-5.9/ncurses/base/lib_ungetch.c 2009-10-25 00:12:21.000000000 +0200 -+++ ncurses-5.9.patch/ncurses/base/lib_ungetch.c 2014-09-01 16:33:22.413792217 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2008,2009 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -42,7 +42,7 @@ - - #include <curses.priv.h> - --MODULE_ID("$Id: lib_ungetch.c,v 1.14 2009/10/24 22:12:21 tom Exp $") -+MODULE_ID("$Id: lib_ungetch.c,v 1.16 2012/08/04 17:38:53 tom Exp $") - - #include <fifo_defs.h> - -@@ -64,13 +64,14 @@ - - T((T_CALLED("ungetch(%p,%s)"), (void *) sp, _nc_tracechar(sp, ch))); - -- if (tail != -1) { -- if (head == -1) { -+ if (sp != 0 && tail >= 0) { -+ if (head < 0) { - head = 0; - t_inc(); - peek = tail; /* no raw keys */ -- } else -+ } else { - h_dec(); -+ } - - sp->_fifo[head] = ch; - T(("ungetch %s ok", _nc_tracechar(sp, ch))); -diff -Naur ncurses-5.9/ncurses/base/memmove.c ncurses-5.9.patch/ncurses/base/memmove.c ---- ncurses-5.9/ncurses/base/memmove.c 2007-08-11 19:12:43.000000000 +0200 -+++ ncurses-5.9.patch/ncurses/base/memmove.c 1970-01-01 01:00:00.000000000 +0100 -@@ -1,69 +0,0 @@ --/**************************************************************************** -- * Copyright (c) 1998-2000,2007 Free Software Foundation, Inc. * -- * * -- * Permission is hereby granted, free of charge, to any person obtaining a * -- * copy of this software and associated documentation files (the * -- * "Software"), to deal in the Software without restriction, including * -- * without limitation the rights to use, copy, modify, merge, publish, * -- * distribute, distribute with modifications, sublicense, and/or sell * -- * copies of the Software, and to permit persons to whom the Software is * -- * furnished to do so, subject to the following conditions: * -- * * -- * The above copyright notice and this permission notice shall be included * -- * in all copies or substantial portions of the Software. * -- * * -- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * -- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * -- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * -- * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * -- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * -- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * -- * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * -- * * -- * Except as contained in this notice, the name(s) of the above copyright * -- * holders shall not be used in advertising or otherwise to promote the * -- * sale, use or other dealings in this Software without prior written * -- * authorization. * -- ****************************************************************************/ -- --#include <curses.priv.h> -- --MODULE_ID("$Id: memmove.c,v 1.5 2007/08/11 17:12:43 tom Exp $") -- --/**************************************************************************** -- * Author: Thomas E. Dickey <dickey@clark.net> 1998 * -- ****************************************************************************/ -- --#if USE_MY_MEMMOVE --#define DST ((char *)s1) --#define SRC ((const char *)s2) --NCURSES_EXPORT(void *) --_nc_memmove(void *s1, const void *s2, size_t n) --{ -- if (n != 0) { -- if ((DST + n > SRC) && (SRC + n > DST)) { -- static char *bfr; -- static size_t length; -- register size_t j; -- if (length < n) { -- length = (n * 3) / 2; -- bfr = typeRealloc(char, length, bfr); -- } -- for (j = 0; j < n; j++) -- bfr[j] = SRC[j]; -- s2 = bfr; -- } -- while (n-- != 0) -- DST[n] = SRC[n]; -- } -- return s1; --} --#else --extern --NCURSES_EXPORT(void) --_nc_memmove(void); /* quiet's gcc warning */ --NCURSES_EXPORT(void) --_nc_memmove(void) --{ --} /* nonempty for strict ANSI compilers */ --#endif /* USE_MY_MEMMOVE */ -diff -Naur ncurses-5.9/ncurses/base/MKkeyname.awk ncurses-5.9.patch/ncurses/base/MKkeyname.awk ---- ncurses-5.9/ncurses/base/MKkeyname.awk 2010-12-19 02:36:14.000000000 +0100 -+++ ncurses-5.9.patch/ncurses/base/MKkeyname.awk 2014-09-01 16:33:22.369792144 +0200 -@@ -1,6 +1,6 @@ --# $Id: MKkeyname.awk,v 1.45 2010/12/19 01:36:14 tom Exp $ -+# $Id: MKkeyname.awk,v 1.48 2013/08/24 17:37:22 tom Exp $ - ############################################################################## --# Copyright (c) 1999-2009,2010 Free Software Foundation, Inc. # -+# Copyright (c) 1999-2012,2013 Free Software Foundation, Inc. # - # # - # Permission is hereby granted, free of charge, to any person obtaining a # - # copy of this software and associated documentation files (the "Software"), # -@@ -65,6 +65,7 @@ - print "" - print "#define SIZEOF_TABLE 256" - print "#define MyTable _nc_globals.keyname_table" -+ print "#define MyInit _nc_globals.init_keyname" - print "" - print "NCURSES_EXPORT(NCURSES_CONST char *)" - print "safe_keyname (SCREEN *sp, int c)" -@@ -96,21 +97,36 @@ - print " if (result == 0 && (c >= 0 && c < SIZEOF_TABLE)) {" - print " if (MyTable == 0)" - print " MyTable = typeCalloc(char *, SIZEOF_TABLE);" -+ print "" - print " if (MyTable != 0) {" -+ print " int m_prefix = (sp == 0 || sp->_use_meta);" -+ print "" -+ print " /* if sense of meta() changed, discard cached data */" -+ print " if (MyInit != (m_prefix + 1)) {" -+ print " MyInit = m_prefix + 1;" -+ print " for (i = 0; i < SIZEOF_TABLE; ++i) {" -+ print " if (MyTable[i]) {" -+ print " FreeAndNull(MyTable[i]);" -+ print " }" -+ print " }" -+ print " }" -+ print "" -+ print " /* create and cache result as needed */" - print " if (MyTable[c] == 0) {" - print " int cc = c;" - print " p = name;" -- print " if (cc >= 128 && (sp == 0 || sp->_use_meta)) {" -- print " strcpy(p, \"M-\");" -+ print "#define P_LIMIT (sizeof(name) - (size_t) (p - name))" -+ print " if (cc >= 128 && m_prefix) {" -+ print " _nc_STRCPY(p, \"M-\", P_LIMIT);" - print " p += 2;" - print " cc -= 128;" - print " }" - print " if (cc < 32)" -- print " sprintf(p, \"^%c\", cc + '@');" -+ print " _nc_SPRINTF(p, _nc_SLIMIT(P_LIMIT) \"^%c\", cc + '@');" - print " else if (cc == 127)" -- print " strcpy(p, \"^?\");" -+ print " _nc_STRCPY(p, \"^?\", P_LIMIT);" - print " else" -- print " sprintf(p, \"%c\", cc);" -+ print " _nc_SPRINTF(p, _nc_SLIMIT(P_LIMIT) \"%c\", cc);" - print " MyTable[c] = strdup(name);" - print " }" - print " result = MyTable[c];" -diff -Naur ncurses-5.9/ncurses/base/MKlib_gen.sh ncurses-5.9.patch/ncurses/base/MKlib_gen.sh ---- ncurses-5.9/ncurses/base/MKlib_gen.sh 2011-01-22 20:47:29.000000000 +0100 -+++ ncurses-5.9.patch/ncurses/base/MKlib_gen.sh 2014-09-01 16:33:22.369792144 +0200 -@@ -2,7 +2,7 @@ - # - # MKlib_gen.sh -- generate sources from curses.h macro definitions - # --# ($Id: MKlib_gen.sh,v 1.43 2011/01/22 19:47:29 tom Exp $) -+# ($Id: MKlib_gen.sh,v 1.46 2011/06/04 19:14:08 tom Exp $) - # - ############################################################################## - # Copyright (c) 1998-2010,2011 Free Software Foundation, Inc. # -@@ -410,10 +410,45 @@ - print "#undef vwprintw" - } - /^DECLARATIONS/ {start = 1; next;} -- {if (start) print \$0;} -+ { -+ if (start) { -+ if ( "$USE" == "generated" ) { -+ print \$0; -+ } else if ( \$0 ~ /^[{}]?\$/ ) { -+ print \$0; -+ } else if ( \$0 ~ /;/ ) { -+ print \$0; -+ } else { -+ calls[start] = \$0; -+ print \$0; -+ start++; -+ } -+ } -+ } - END { - if ( "$USE" != "generated" ) { -- print "int main(void) { return 0; }" -+ print "int main(void)" -+ print "{" -+ for (n = 1; n < start; ++n) { -+ value = calls[n]; -+ if ( value !~ /P_POUNDC/ ) { -+ gsub(/[[:blank:]]+/," ",value); -+ sub(/^[[:alnum:]_]+ /,"",value); -+ sub(/^\* /,"",value); -+ gsub(/[[:alnum:]_]+ \* /,"",value); -+ gsub(/ (const) /," ",value); -+ gsub(/ (int|short|attr_t|chtype|wchar_t|NCURSES_BOOL|NCURSES_OUTC|NCURSES_OUTC_sp|va_list) /," ",value); -+ gsub(/ void /,"",value); -+ sub(/^/,"call_",value); -+ gsub(/ (a[[:digit:]]|z) /, " 0 ", value); -+ gsub(/ int[[:blank:]]*[(][^)]+[)][(][^)]+[)]/, "0", value); -+ printf "\t%s;\n", value; -+ } else { -+ print value; -+ } -+ } -+ print " return 0;" -+ print "}" - } - } - EOF1 -@@ -422,6 +457,8 @@ - #include <ncurses_cfg.h> - #undef NCURSES_NOMACROS - #include <curses.h> -+#include <term.h> -+#include <unctrl.h> - - DECLARATIONS - -diff -Naur ncurses-5.9/ncurses/base/MKunctrl.awk ncurses-5.9.patch/ncurses/base/MKunctrl.awk ---- ncurses-5.9/ncurses/base/MKunctrl.awk 2009-07-05 00:05:15.000000000 +0200 -+++ ncurses-5.9.patch/ncurses/base/MKunctrl.awk 2014-09-01 16:33:22.369792144 +0200 -@@ -1,6 +1,6 @@ --# $Id: MKunctrl.awk,v 1.26 2009/07/04 22:05:15 Clemens.Ladisch Exp $ -+# $Id: MKunctrl.awk,v 1.27 2012/06/09 20:29:33 tom Exp $ - ############################################################################## --# Copyright (c) 1998-2008,2009 Free Software Foundation, Inc. # -+# Copyright (c) 1998-2009,2012 Free Software Foundation, Inc. # - # # - # Permission is hereby granted, free of charge, to any person obtaining a # - # copy of this software and associated documentation files (the "Software"), # -@@ -140,7 +140,7 @@ - } else { - stringname = "unctrl" - } -- print "\tint check = ChCharOf(ch);" -+ print "\tint check = (int) ChCharOf(ch);" - print "\tconst char *result;" - print "" - print "\tif (check >= 0 && check < (int)SIZEOF(unctrl_table)) {" -diff -Naur ncurses-5.9/ncurses/base/resizeterm.c ncurses-5.9.patch/ncurses/base/resizeterm.c ---- ncurses-5.9/ncurses/base/resizeterm.c 2011-01-10 02:34:49.000000000 +0100 -+++ ncurses-5.9.patch/ncurses/base/resizeterm.c 2014-09-01 16:33:22.413792217 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2009,2011 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2011,2014 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -45,7 +45,7 @@ - #define CUR SP_TERMTYPE - #endif - --MODULE_ID("$Id: resizeterm.c,v 1.43 2011/01/10 01:34:49 tom Exp $") -+MODULE_ID("$Id: resizeterm.c,v 1.46 2014/03/08 20:32:59 tom Exp $") - - /* - * If we're trying to be reentrant, do not want any local statics. -@@ -365,58 +365,71 @@ - } - #endif - if (ToLines > screen_lines(SP_PARM)) { -- increase_size(NCURSES_SP_ARGx -- myLines = ToLines, myCols, was_stolen EXTRA_ARGS); -+ result = increase_size(NCURSES_SP_ARGx -+ myLines = ToLines, -+ myCols, -+ was_stolen EXTRA_ARGS); - CurLines = myLines; - CurCols = myCols; - } - -- if (ToCols > screen_columns(SP_PARM)) { -- increase_size(NCURSES_SP_ARGx -- myLines, myCols = ToCols, was_stolen EXTRA_ARGS); -+ if ((result == OK) -+ && (ToCols > screen_columns(SP_PARM))) { -+ result = increase_size(NCURSES_SP_ARGx -+ myLines, -+ myCols = ToCols, -+ was_stolen EXTRA_ARGS); - CurLines = myLines; - CurCols = myCols; - } - -- if (ToLines < myLines || -- ToCols < myCols) { -- decrease_size(NCURSES_SP_ARGx ToLines, ToCols, was_stolen EXTRA_ARGS); -+ if ((result == OK) -+ && (ToLines < myLines || -+ ToCols < myCols)) { -+ result = decrease_size(NCURSES_SP_ARGx -+ ToLines, -+ ToCols, -+ was_stolen EXTRA_ARGS); - } - -- screen_lines(SP_PARM) = (NCURSES_SIZE_T) ToLines; -- screen_columns(SP_PARM) = (NCURSES_SIZE_T) ToCols; -+ if (result == OK) { -+ screen_lines(SP_PARM) = (NCURSES_SIZE_T) ToLines; -+ screen_columns(SP_PARM) = (NCURSES_SIZE_T) ToCols; - - #ifdef USE_TERM_DRIVER -- CallDriver_2(SP_PARM, setsize, ToLines, ToCols); -+ CallDriver_2(SP_PARM, td_setsize, ToLines, ToCols); - #else -- lines = (NCURSES_SIZE_T) ToLines; -- columns = (NCURSES_SIZE_T) ToCols; -+ lines = (NCURSES_SIZE_T) ToLines; -+ columns = (NCURSES_SIZE_T) ToCols; - #endif - -- SP_PARM->_lines_avail = (NCURSES_SIZE_T) (ToLines - was_stolen); -+ SP_PARM->_lines_avail = (NCURSES_SIZE_T) (ToLines - was_stolen); - -- if (SP_PARM->oldhash) { -- FreeAndNull(SP_PARM->oldhash); -- } -- if (SP_PARM->newhash) { -- FreeAndNull(SP_PARM->newhash); -- } -+ if (SP_PARM->oldhash) { -+ FreeAndNull(SP_PARM->oldhash); -+ } -+ if (SP_PARM->newhash) { -+ FreeAndNull(SP_PARM->newhash); -+ } - #ifdef TRACE -- if (USE_TRACEF(TRACE_UPDATE)) { -- SET_LINES(ToLines - was_stolen); -- SET_COLS(ToCols); -- show_window_sizes("after"); -- _nc_unlock_global(tracef); -- } -+ if (USE_TRACEF(TRACE_UPDATE)) { -+ SET_LINES(ToLines - was_stolen); -+ SET_COLS(ToCols); -+ show_window_sizes("after"); -+ _nc_unlock_global(tracef); -+ } - #endif -+ } - } - -- /* -- * Always update LINES, to allow for call from lib_doupdate.c which -- * needs to have the count adjusted by the stolen (ripped off) lines. -- */ -- SET_LINES(ToLines - was_stolen); -- SET_COLS(ToCols); -+ if (result == OK) { -+ /* -+ * Always update LINES, to allow for call from lib_doupdate.c which -+ * needs to have the count adjusted by the stolen (ripped off) lines. -+ */ -+ SET_LINES(ToLines - was_stolen); -+ SET_COLS(ToCols); -+ } - - _nc_nonsp_unlock_global(curses); - -@@ -471,7 +484,6 @@ - result = NCURSES_SP_NAME(resize_term) (NCURSES_SP_ARGx ToLines, ToCols); - - #if USE_SIGWINCH -- safe_ungetch(SP_PARM, KEY_RESIZE); /* so application can know this */ - clearok(CurScreen(SP_PARM), TRUE); /* screen contents are unknown */ - - /* ripped-off lines are a special case: if we did not lengthen -@@ -501,6 +513,9 @@ - } - #endif - } -+#if USE_SIGWINCH -+ safe_ungetch(SP_PARM, KEY_RESIZE); /* so application can know this */ -+#endif - } - - returnCode(result); -diff -Naur ncurses-5.9/ncurses/base/safe_sprintf.c ncurses-5.9.patch/ncurses/base/safe_sprintf.c ---- ncurses-5.9/ncurses/base/safe_sprintf.c 2010-06-06 00:22:27.000000000 +0200 -+++ ncurses-5.9.patch/ncurses/base/safe_sprintf.c 2014-09-01 16:33:22.413792217 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -27,13 +27,13 @@ - ****************************************************************************/ - - /**************************************************************************** -- * Author: Thomas E. Dickey <dickey@clark.net> 1997 * -+ * Author: Thomas E. Dickey 1997-on * - ****************************************************************************/ - - #include <curses.priv.h> - #include <ctype.h> - --MODULE_ID("$Id: safe_sprintf.c,v 1.24 2010/06/05 22:22:27 tom Exp $") -+MODULE_ID("$Id: safe_sprintf.c,v 1.27 2013/01/20 01:04:32 tom Exp $") - - #if USE_SAFE_SPRINTF - -@@ -109,12 +109,16 @@ - } else if (state == Prec) { - prec = ival; - } -- sprintf(fmt_arg, "%d", ival); -+ _nc_SPRINTF(fmt_arg, -+ _nc_SLIMIT(sizeof(fmt_arg)) -+ "%d", ival); - fmt_len += strlen(fmt_arg); - if ((format = _nc_doalloc(format, fmt_len)) == 0) { -+ free(buffer); - return -1; - } -- strcpy(&format[--f], fmt_arg); -+ --f; -+ _nc_STRCPY(&format[f], fmt_arg, fmt_len - f); - f = strlen(format); - } else if (isalpha(UChar(*fmt))) { - done = TRUE; -@@ -185,13 +189,13 @@ - format[f] = '\0'; - switch (used) { - case 'i': -- sprintf(buffer, format, ival); -+ _nc_SPRINTF(buffer, _nc_SLIMIT(length) format, ival); - break; - case 'f': -- sprintf(buffer, format, fval); -+ _nc_SPRINTF(buffer, _nc_SLIMIT(length) format, fval); - break; - default: -- sprintf(buffer, format, pval); -+ _nc_SPRINTF(buffer, _nc_SLIMIT(length) format, pval); - break; - } - len += (int) strlen(buffer); -diff -Naur ncurses-5.9/ncurses/base/vsscanf.c ncurses-5.9.patch/ncurses/base/vsscanf.c ---- ncurses-5.9/ncurses/base/vsscanf.c 2004-04-03 22:27:02.000000000 +0200 -+++ ncurses-5.9.patch/ncurses/base/vsscanf.c 2014-09-01 16:33:22.413792217 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2004,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -38,7 +38,7 @@ - - #if !HAVE_VSSCANF - --MODULE_ID("$Id: vsscanf.c,v 1.18 2004/04/03 20:27:02 tom Exp $") -+MODULE_ID("$Id: vsscanf.c,v 1.20 2012/02/22 22:26:58 tom Exp $") - - #if !(HAVE_VFSCANF || HAVE__DOSCAN) - -@@ -293,12 +293,12 @@ - - /* add %n, if the format was not that */ - if (chunk != cAssigned) { -- strcat(my_fmt, "%n"); -+ _nc_STRCAT(my_fmt, "%n", len_fmt); - } - - switch (chunk) { - case cAssigned: -- strcat(my_fmt, "%n"); -+ _nc_STRCAT(my_fmt, "%n", len_fmt); - pointer = &eaten; - break; - case cInt: -diff -Naur ncurses-5.9/ncurses/base/wresize.c ncurses-5.9.patch/ncurses/base/wresize.c ---- ncurses-5.9/ncurses/base/wresize.c 2010-06-06 00:36:26.000000000 +0200 -+++ ncurses-5.9.patch/ncurses/base/wresize.c 2014-09-01 16:33:22.413792217 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2010,2011 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -33,7 +33,7 @@ - - #include <curses.priv.h> - --MODULE_ID("$Id: wresize.c,v 1.34 2010/06/05 22:36:26 tom Exp $") -+MODULE_ID("$Id: wresize.c,v 1.35 2011/05/21 18:55:07 tom Exp $") - - static int - cleanup_lines(struct ldat *data, int length) -@@ -175,9 +175,10 @@ - for (col = 0; col <= ToCols; ++col) - s[col] = win->_nc_bkgd; - } -- } else { -- assert(pline != 0); -+ } else if (pline != 0 && pline[win->_pary + row].text != 0) { - s = &pline[win->_pary + row].text[win->_parx]; -+ } else { -+ s = 0; - } - - if_USE_SCROLL_HINTS(new_lines[row].oldindex = row); -diff -Naur ncurses-5.9/ncurses/build.priv.h ncurses-5.9.patch/ncurses/build.priv.h ---- ncurses-5.9/ncurses/build.priv.h 2010-05-22 22:30:35.000000000 +0200 -+++ ncurses-5.9.patch/ncurses/build.priv.h 2014-09-01 16:33:22.413792217 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 2010 Free Software Foundation, Inc. * -+ * Copyright (c) 2010,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -30,9 +30,8 @@ - * Author: Thomas E. Dickey 2010 * - ****************************************************************************/ - -- - /* -- * $Id: build.priv.h,v 1.6 2010/05/22 20:30:35 tom Exp $ -+ * $Id: build.priv.h,v 1.9 2012/02/22 22:17:02 tom Exp $ - * - * build.priv.h - * -@@ -83,6 +82,7 @@ - #define SIZEOF(v) (sizeof(v) / sizeof(v[0])) - - #include <nc_alloc.h> -+#include <nc_string.h> - - /* declare these, to avoid needing term.h */ - #if BROKEN_LINKER || USE_REENTRANT -diff -Naur ncurses-5.9/ncurses/curses.priv.h ncurses-5.9.patch/ncurses/curses.priv.h ---- ncurses-5.9/ncurses/curses.priv.h 2011-01-22 22:10:19.000000000 +0100 -+++ ncurses-5.9.patch/ncurses/curses.priv.h 2014-09-01 16:33:22.414792220 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2010,2011 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2013,2014 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -34,7 +34,7 @@ - ****************************************************************************/ - - /* -- * $Id: curses.priv.h,v 1.475 2011/01/22 21:10:19 tom Exp $ -+ * $Id: curses.priv.h,v 1.531 2014/03/08 19:58:54 tom Exp $ - * - * curses.priv.h - * -@@ -65,6 +65,7 @@ - #include <stdlib.h> - #include <string.h> - #include <sys/types.h> -+#include <sys/stat.h> - - #if HAVE_UNISTD_H - #include <unistd.h> -@@ -85,6 +86,12 @@ - - #include <errno.h> - -+#if defined __hpux -+# ifndef EILSEQ -+# define EILSEQ 47 -+# endif -+#endif -+ - #ifndef PATH_MAX - # if defined(_POSIX_PATH_MAX) - # define PATH_MAX _POSIX_PATH_MAX -@@ -111,6 +118,14 @@ - #define USE_FUNC_POLL 0 - #endif - -+#if HAVE_INTTYPES_H -+# include <inttypes.h> -+#else -+# if HAVE_STDINT_H -+# include <stdint.h> -+# endif -+#endif -+ - /* include signal.h before curses.h to work-around defect in glibc 2.1.3 */ - #include <signal.h> - -@@ -135,6 +150,15 @@ - #define USE_EMX_MOUSE 0 - #endif - -+/* kLIBC keyboard/mouse support */ -+#if defined(__OS2__) && defined(__KLIBC__) -+#define USE_KLIBC_KBD 1 -+#define USE_KLIBC_MOUSE 1 -+#else -+#define USE_KLIBC_KBD 0 -+#define USE_KLIBC_MOUSE 0 -+#endif -+ - #define DEFAULT_MAXCLICK 166 - #define EV_MAX 8 /* size of mouse circular event queue */ - -@@ -192,6 +216,18 @@ - #endif - - /* -+ * Either/both S_ISxxx and/or S_IFxxx are defined in sys/types.h; some systems -+ * lack one or the other. -+ */ -+#ifndef S_ISDIR -+#define S_ISDIR(mode) ((mode & S_IFMT) == S_IFDIR) -+#endif -+ -+#ifndef S_ISREG -+#define S_ISREG(mode) ((mode & S_IFMT) == S_IFREG) -+#endif -+ -+/* - * Scroll hints are useless when hashmap is used - */ - #if !USE_SCROLL_HINTS -@@ -208,6 +244,8 @@ - #define if_USE_SCROLL_HINTS(stmt) /*nothing*/ - #endif - -+#include <nc_string.h> -+ - /* - * Options for terminal drivers, etc... - */ -@@ -250,14 +288,6 @@ - * Structure for palette tables - */ - --typedef struct --{ -- short red, green, blue; /* what color_content() returns */ -- short r, g, b; /* params to init_color() */ -- int init; /* true if we called init_color() */ --} --color_t; -- - #define MAXCOLUMNS 135 - #define MAXLINES 66 - #define FIFO_SIZE MAXCOLUMNS+2 /* for nocbreak mode input */ -@@ -282,6 +312,14 @@ - - #include <curses.h> /* we'll use -Ipath directive to get the right one! */ - -+typedef struct -+{ -+ NCURSES_COLOR_T red, green, blue; /* what color_content() returns */ -+ NCURSES_COLOR_T r, g, b; /* params to init_color() */ -+ int init; /* true if we called init_color() */ -+} -+color_t; -+ - /* - * If curses.h did not expose the SCREEN-functions, then we do not need the - * parameter in the corresponding unextended functions. -@@ -312,7 +350,7 @@ - #define HasTerminal(sp) (((sp) != 0) && (0 != ((sp)->_term))) - #define IsValidScreen(sp) (HasTerminal(sp) && !IsPreScreen(sp)) - --#if BROKEN_LINKER || USE_REENTRANT -+#if USE_REENTRANT - #define CurTerm _nc_prescreen._cur_term - #else - #define CurTerm cur_term -@@ -325,6 +363,7 @@ - #endif - - #include <term.h> -+#include <nc_termios.h> - - /* - * Reduce dependency on cur_term global by using terminfo data from SCREEN's -@@ -341,6 +380,16 @@ - #include <nc_tparm.h> - - /* -+ * Simplify ifdef's for the "*_ATTR" macros in case italics are not configured. -+ */ -+#ifdef A_ITALIC -+#define USE_ITALIC 1 -+#else -+#define USE_ITALIC 0 -+#define A_ITALIC 0 -+#endif -+ -+/* - * Use these macros internally, to make tracing less verbose. But leave the - * option for compiling the tracing into the library. - */ -@@ -365,7 +414,7 @@ - #define if_EXT_COLORS(stmt) stmt - #define SetPair(value,p) SetPair2((value).ext_color, AttrOf(value), p) - #define SetPair2(c,a,p) c = (p), \ -- a = (unColor2(a) | (A_COLOR & ColorPair(oldColor(c)))) -+ a = (unColor2(a) | (A_COLOR & (unsigned) ColorPair(oldColor(c)))) - #define GetPair(value) GetPair2((value).ext_color, AttrOf(value)) - #define GetPair2(c,a) ((c) ? (c) : PairNumber(a)) - #define oldColor(p) (((p) > 255) ? 255 : (p)) -@@ -373,11 +422,7 @@ - #define SET_WINDOW_PAIR(w,p) (w)->_color = (p) - #define SameAttrOf(a,b) (AttrOf(a) == AttrOf(b) && GetPair(a) == GetPair(b)) - --#if NCURSES_SP_FUNCS --#define VIDATTR(sp,attr,pair) NCURSES_SP_NAME(vid_attr)(sp, attr, pair, 0) --#else --#define VIDATTR(sp,attr,pair) vid_attr(attr, pair, 0) --#endif -+#define VIDATTR(sp,attr,pair) NCURSES_SP_NAME(vid_puts)(NCURSES_SP_ARGx attr, (short) pair, 0, NCURSES_OUTC_FUNC) - - #else /* !NCURSES_EXT_COLORS */ - -@@ -390,14 +435,14 @@ - WINDOW_ATTRS(w) |= (A_COLOR & (attr_t) ColorPair(p)) - #define SameAttrOf(a,b) (AttrOf(a) == AttrOf(b)) - --#if NCURSES_SP_FUNCS --#define VIDATTR(sp,attr,pair) NCURSES_SP_NAME(vidattr)(sp, attr) --#else --#define VIDATTR(sp,attr,pair) vidattr(attr) --#endif -+#define VIDATTR(sp,attr,pair) NCURSES_SP_NAME(vidputs)(NCURSES_SP_ARGx attr, NCURSES_OUTC_FUNC) - - #endif /* NCURSES_EXT_COLORS */ - -+#define NCURSES_OUTC_FUNC NCURSES_SP_NAME(_nc_outch) -+#define NCURSES_PUTP2(name,value) NCURSES_SP_NAME(_nc_putp)(NCURSES_SP_ARGx name, value) -+#define NCURSES_PUTP2_FLUSH(name,value) NCURSES_SP_NAME(_nc_putp_flush)(NCURSES_SP_ARGx name, value) -+ - #if NCURSES_NO_PADDING - #define GetNoPadding(sp) ((sp) ? (sp)->_no_padding : _nc_prescreen._no_padding) - #define SetNoPadding(sp) _nc_set_no_padding(sp) -@@ -467,6 +512,9 @@ - # endif - # define _declare(name) __extension__ extern __typeof__(name) name - # define weak_symbol(name) _weak_pragma(name) _declare(name) __attribute__((weak)) -+#else -+# undef USE_WEAK_SYMBOLS -+# define USE_WEAK_SYMBOLS 0 - #endif - #endif - -@@ -665,6 +713,9 @@ - #if USE_GPM_SUPPORT - #undef buttons /* term.h defines this, and gpm uses it! */ - #include <gpm.h> -+#if USE_WEAK_SYMBOLS -+weak_symbol(Gpm_Wgetch); -+#endif - - #ifdef HAVE_LIBDL - /* link dynamically to GPM */ -@@ -766,17 +817,23 @@ - #define INIT_TERM_DRIVER() /* nothing */ - #endif - -+typedef struct { -+ const char *name; -+ char *value; -+} ITERATOR_VARS; -+ - /* - * Global data which is not specific to a screen. - */ - typedef struct { -+ SIG_ATOMIC_T have_sigtstp; - SIG_ATOMIC_T have_sigwinch; - SIG_ATOMIC_T cleanup_nested; - - bool init_signals; - bool init_screen; - -- const char *comp_sourcename; -+ char *comp_sourcename; - char *comp_termtype; - - bool have_tic_directory; -@@ -788,6 +845,7 @@ - - char *first_name; - char **keyname_table; -+ int init_keyname; - - int slk_format; - -@@ -798,6 +856,12 @@ - int tgetent_index; - long tgetent_sequence; - -+ char *dbd_blob; /* string-heap for dbd_list[] */ -+ char **dbd_list; /* distinct places to look for data */ -+ int dbd_size; /* length of dbd_list[] */ -+ time_t dbd_time; /* cache last updated */ -+ ITERATOR_VARS dbd_vars[dbdLAST]; -+ - #ifndef USE_SP_WINDOWLIST - WINDOWLIST *_nc_windowlist; - #define WindowList(sp) _nc_globals._nc_windowlist -@@ -891,6 +955,7 @@ - const char *_tputs_trace; - #endif - #endif -+ bool use_tioctl; - } NCURSES_PRESCREEN; - - /* -@@ -911,11 +976,13 @@ - */ - - struct screen { -- int _ifd; /* input file ptr for screen */ -+ int _ifd; /* input file descriptor for screen */ -+ int _ofd; /* output file descriptor for screen */ - FILE *_ofp; /* output file ptr for screen */ -- char *_setbuf; /* buffered I/O for output */ -+ char *out_buffer; /* output buffer */ -+ size_t out_limit; /* output buffer size */ -+ size_t out_inuse; /* output buffer current use */ - bool _filtered; /* filter() was called */ -- bool _buffered; /* setvbuf uses _setbuf data */ - bool _prescreen; /* is in prescreen phase */ - bool _use_env; /* LINES & COLS from environment? */ - int _checkfd; /* filedesc for typeahead check */ -@@ -1015,6 +1082,7 @@ - int _pair_count; /* count of color pairs */ - int _pair_limit; /* actual limit of color-pairs */ - #if NCURSES_EXT_FUNCS -+ bool _assumed_color; /* use assumed colors */ - bool _default_color; /* use default colors */ - bool _has_sgr_39_49; /* has ECMA default color support */ - int _default_fg; /* assumed default foreground */ -@@ -1031,6 +1099,13 @@ - /* used in lib_vidattr.c */ - bool _use_rmso; /* true if we may use 'rmso' */ - bool _use_rmul; /* true if we may use 'rmul' */ -+#if USE_ITALIC -+ bool _use_ritm; /* true if we may use 'ritm' */ -+#endif -+ -+#if USE_KLIBC_KBD -+ bool _extended_key; /* true if an extended key */ -+#endif - - /* - * These data correspond to the state of the idcok() and idlok() -@@ -1055,7 +1130,9 @@ - void (*_mouse_wrap) (SCREEN *); - int _mouse_fd; /* file-descriptor, if any */ - bool _mouse_active; /* true if initialized */ -- mmask_t _mouse_mask; -+ mmask_t _mouse_mask; /* set via mousemask() */ -+ mmask_t _mouse_mask2; /* OR's in press/release bits */ -+ mmask_t _mouse_bstate; - NCURSES_CONST char *_mouse_xtermcap; /* string to enable/disable mouse */ - MEVENT _mouse_events[EV_MAX]; /* hold the last mouse event seen */ - MEVENT *_mouse_eventp; /* next free slot in event queue */ -@@ -1102,6 +1179,7 @@ - */ - #if USE_SIZECHANGE - int (*_resize)(NCURSES_SP_DCLx int y, int x); -+ int (*_ungetch)(SCREEN *, int); - #endif - - /* -@@ -1120,7 +1198,6 @@ - int *_oldnum_list; - int _oldnum_size; - -- bool _cleanup; /* cleanup after int/quit signal */ - NCURSES_SP_OUTC _outch; /* output handler if not putc */ - - int _legacy_coding; /* see use_legacy_coding() */ -@@ -1158,7 +1235,10 @@ - * UTF-8, but do not permit ACS at the same time (see tty_update.c). - */ - bool _screen_acs_fix; -+ bool _screen_unicode; - #endif -+ -+ bool _use_tioctl; - }; - - extern NCURSES_EXPORT_VAR(SCREEN *) _nc_screen_chain; -@@ -1168,7 +1248,7 @@ - WINDOWLIST *next; - SCREEN *screen; /* screen containing the window */ - WINDOW win; /* WINDOW_EXT() needs to account for offset */ --#ifdef NCURSES_WIDECHAR -+#if NCURSES_WIDECHAR - char addch_work[(MB_LEN_MAX * 9) + 1]; - unsigned addch_used; /* number of bytes in addch_work[] */ - int addch_x; /* x-position for addch_work[] */ -@@ -1189,7 +1269,7 @@ - sp->_endwin = TRUE; \ - sp->_cursor = -1; \ - WindowList(sp) = 0; \ -- sp->_outch = NCURSES_SP_NAME(_nc_outch); \ -+ sp->_outch = NCURSES_OUTC_FUNC; \ - sp->jump = 0 \ - - /* usually in <limits.h> */ -@@ -1267,8 +1347,8 @@ - - #define UChar(c) ((unsigned char)(c)) - #define UShort(c) ((unsigned short)(c)) --#define ChCharOf(c) ((c) & (chtype)A_CHARTEXT) --#define ChAttrOf(c) ((c) & (chtype)A_ATTRIBUTES) -+#define ChCharOf(c) ((chtype)(c) & (chtype)A_CHARTEXT) -+#define ChAttrOf(c) ((chtype)(c) & (chtype)A_ATTRIBUTES) - - #ifndef MB_LEN_MAX - #define MB_LEN_MAX 8 /* should be >= MB_CUR_MAX, but that may be a function */ -@@ -1322,9 +1402,9 @@ - #define PUTC_DATA char PUTC_buf[MB_LEN_MAX]; int PUTC_i, PUTC_n; \ - mbstate_t PUT_st; wchar_t PUTC_ch - #define PUTC_INIT init_mb (PUT_st) --#define PUTC(ch,b) do { if(!isWidecExt(ch)) { \ -+#define PUTC(ch) do { if(!isWidecExt(ch)) { \ - if (Charable(ch)) { \ -- fputc(CharOf(ch), b); \ -+ NCURSES_OUTC_FUNC (NCURSES_SP_ARGx CharOf(ch)); \ - COUNT_OUTCHARS(1); \ - } else { \ - PUTC_INIT; \ -@@ -1336,10 +1416,14 @@ - (ch).chars[PUTC_i], &PUT_st); \ - if (PUTC_n <= 0) { \ - if (PUTC_ch && is8bits(PUTC_ch) && PUTC_i == 0) \ -- putc(PUTC_ch,b); \ -+ NCURSES_OUTC_FUNC (NCURSES_SP_ARGx CharOf(ch)); \ - break; \ -+ } else { \ -+ int PUTC_j; \ -+ for (PUTC_j = 0; PUTC_j < PUTC_n; ++PUTC_j) { \ -+ NCURSES_OUTC_FUNC (NCURSES_SP_ARGx PUTC_buf[PUTC_j]); \ -+ } \ - } \ -- IGNORE_RC(fwrite(PUTC_buf, (unsigned) PUTC_n, 1, b)); \ - } \ - COUNT_OUTCHARS(PUTC_i); \ - } } } while (0) -@@ -1362,7 +1446,7 @@ - AttrOf(dst) |= (attr_t) (ext + 1) - - #define if_WIDEC(code) code --#define Charable(ch) ((SP_PARM != 0 && SP_PARM->_legacy_coding) \ -+#define Charable(ch) ((SP_PARM->_legacy_coding) \ - || (AttrOf(ch) & A_ALTCHARSET) \ - || (!isWidecExt(ch) && \ - (ch).chars[1] == L'\0' && \ -@@ -1383,8 +1467,8 @@ - #define CHDEREF(wch) wch - #define ARG_CH_T NCURSES_CH_T - #define CARG_CH_T NCURSES_CH_T --#define PUTC_DATA int data = 0 --#define PUTC(ch,b) do { data = CharOf(ch); putc(data,b); } while (0) -+#define PUTC_DATA /* nothing */ -+#define PUTC(ch) NCURSES_OUTC_FUNC (NCURSES_SP_ARGx (int) ch) - - #define BLANK (' '|A_NORMAL) - #define ZEROS ('\0'|A_NORMAL) -@@ -1412,25 +1496,25 @@ - - #define CHANGED_CELL(line,col) \ - if (line->firstchar == _NOCHANGE) \ -- line->firstchar = line->lastchar = (NCURSES_SIZE_T) col; \ -+ line->firstchar = line->lastchar = (NCURSES_SIZE_T) (col); \ - else if ((col) < line->firstchar) \ -- line->firstchar = (NCURSES_SIZE_T) col; \ -+ line->firstchar = (NCURSES_SIZE_T) (col); \ - else if ((col) > line->lastchar) \ -- line->lastchar = (NCURSES_SIZE_T) col -+ line->lastchar = (NCURSES_SIZE_T) (col) - - #define CHANGED_RANGE(line,start,end) \ - if (line->firstchar == _NOCHANGE \ - || line->firstchar > (start)) \ -- line->firstchar = (NCURSES_SIZE_T) start; \ -+ line->firstchar = (NCURSES_SIZE_T) (start); \ - if (line->lastchar == _NOCHANGE \ - || line->lastchar < (end)) \ -- line->lastchar = (NCURSES_SIZE_T) end -+ line->lastchar = (NCURSES_SIZE_T) (end) - - #define CHANGED_TO_EOL(line,start,end) \ - if (line->firstchar == _NOCHANGE \ - || line->firstchar > (start)) \ -- line->firstchar = (NCURSES_SIZE_T) start; \ -- line->lastchar = (NCURSES_SIZE_T) end -+ line->firstchar = (NCURSES_SIZE_T) (start); \ -+ line->lastchar = (NCURSES_SIZE_T) (end) - - #define SIZEOF(v) (sizeof(v)/sizeof(v[0])) - -@@ -1444,6 +1528,20 @@ - #include <nc_alloc.h> - - /* -+ * Use these for tic/infocmp malloc failures. Generally the ncurses library -+ * tries to limp along after a failure. -+ */ -+#define TYPE_MALLOC(type, size, name) \ -+ name = typeMalloc(type, size); \ -+ if (name == 0) \ -+ _nc_err_abort(MSG_NO_MEMORY) -+ -+#define TYPE_REALLOC(type, size, name) \ -+ name = typeRealloc(type, size, name); \ -+ if (name == 0) \ -+ _nc_err_abort(MSG_NO_MEMORY) -+ -+/* - * TTY bit definition for converting tabs to spaces. - */ - #ifdef TAB3 -@@ -1528,7 +1626,7 @@ - #define returnVoidPtr(code) TRACE_RETURN(code,void_ptr) - #define returnWin(code) TRACE_RETURN(code,win) - --extern NCURSES_EXPORT(NCURSES_BOOL) _nc_retrace_bool (NCURSES_BOOL); -+extern NCURSES_EXPORT(NCURSES_BOOL) _nc_retrace_bool (int); - extern NCURSES_EXPORT(NCURSES_CONST void *) _nc_retrace_cvoid_ptr (NCURSES_CONST void *); - extern NCURSES_EXPORT(SCREEN *) _nc_retrace_sp (SCREEN *); - extern NCURSES_EXPORT(WINDOW *) _nc_retrace_win (WINDOW *); -@@ -1539,7 +1637,7 @@ - extern NCURSES_EXPORT(chtype) _nc_retrace_chtype (chtype); - extern NCURSES_EXPORT(const char *) _nc_altcharset_name(attr_t, chtype); - extern NCURSES_EXPORT(const char *) _nc_retrace_cptr (const char *); --extern NCURSES_EXPORT(char) _nc_retrace_char (char); -+extern NCURSES_EXPORT(char) _nc_retrace_char (int); - extern NCURSES_EXPORT(int) _nc_retrace_int (int); - extern NCURSES_EXPORT(int) _nc_retrace_int_attr_t (attr_t); - extern NCURSES_EXPORT(mmask_t) _nc_retrace_mmask_t (SCREEN *, mmask_t); -@@ -1619,7 +1717,9 @@ - NCURSES_EXPORT(void) name (void) { } - - #define ALL_BUT_COLOR ((chtype)~(A_COLOR)) --#define NONBLANK_ATTR (A_NORMAL|A_BOLD|A_DIM|A_BLINK) -+#define NONBLANK_ATTR (A_BOLD | A_DIM | A_BLINK | A_ITALIC) -+#define TPARM_ATTR (A_STANDOUT | A_UNDERLINE | A_REVERSE | A_BLINK | A_DIM | A_BOLD | A_ALTCHARSET | A_INVIS | A_PROTECT) -+#define XMC_CONFLICT (A_STANDOUT | A_UNDERLINE | A_REVERSE | A_BLINK | A_DIM | A_BOLD | A_INVIS | A_PROTECT | A_ITALIC) - #define XMC_CHANGES(c) ((c) & SP_PARM->_xmc_suppress) - - #define toggle_attr_on(S,at) {\ -@@ -1795,6 +1895,8 @@ - /* lib_mvcur.c */ - #define INFINITY 1000000 /* cost: too high to use */ - -+extern NCURSES_EXPORT(int) _nc_mvcur(int yold, int xold, int ynew, int xnew); -+ - extern NCURSES_EXPORT(void) _nc_mvcur_init (void); - extern NCURSES_EXPORT(void) _nc_mvcur_resume (void); - extern NCURSES_EXPORT(void) _nc_mvcur_wrap (void); -@@ -1816,12 +1918,31 @@ - extern NCURSES_EXPORT(char *) _nc_get_locale(void); - extern NCURSES_EXPORT(int) _nc_unicode_locale(void); - extern NCURSES_EXPORT(int) _nc_locale_breaks_acs(TERMINAL *); --extern NCURSES_EXPORT(int) _nc_setupterm(NCURSES_CONST char *, int, int *, bool); --extern NCURSES_EXPORT(void) _nc_tinfo_cmdch(TERMINAL *, char); -+extern NCURSES_EXPORT(int) _nc_setupterm(NCURSES_CONST char *, int, int *, int); -+extern NCURSES_EXPORT(void) _nc_tinfo_cmdch(TERMINAL *, int); - - /* lib_set_term.c */ - extern NCURSES_EXPORT(int) _nc_ripoffline(int, int(*)(WINDOW*, int)); - -+/* lib_setup.c */ -+#define ret_error(code, fmt, arg) if (errret) {\ -+ *errret = code;\ -+ returnCode(ERR);\ -+ } else {\ -+ fprintf(stderr, fmt, arg);\ -+ exit(EXIT_FAILURE);\ -+ } -+ -+#define ret_error1(code, fmt, arg) ret_error(code, "'%s': " fmt, arg) -+ -+#define ret_error0(code, msg) if (errret) {\ -+ *errret = code;\ -+ returnCode(ERR);\ -+ } else {\ -+ fprintf(stderr, msg);\ -+ exit(EXIT_FAILURE);\ -+ } -+ - /* lib_tstp.c */ - #if USE_SIGWINCH - extern NCURSES_EXPORT(int) _nc_handle_sigwinch(SCREEN *); -@@ -1875,16 +1996,17 @@ - extern NCURSES_EXPORT(int) _nc_baudrate (int); - extern NCURSES_EXPORT(int) _nc_freewin (WINDOW *); - extern NCURSES_EXPORT(int) _nc_getenv_num (const char *); --extern NCURSES_EXPORT(int) _nc_keypad (SCREEN *, bool); -+extern NCURSES_EXPORT(int) _nc_keypad (SCREEN *, int); - extern NCURSES_EXPORT(int) _nc_ospeed (int); - extern NCURSES_EXPORT(int) _nc_outch (int); -+extern NCURSES_EXPORT(int) _nc_putchar (int); - extern NCURSES_EXPORT(int) _nc_putp(const char *, const char *); - extern NCURSES_EXPORT(int) _nc_putp_flush(const char *, const char *); - extern NCURSES_EXPORT(int) _nc_read_termcap_entry (const char *const, TERMTYPE *const); --extern NCURSES_EXPORT(int) _nc_setupscreen (int, int, FILE *, bool, int); - extern NCURSES_EXPORT(int) _nc_setup_tinfo(const char *, TERMTYPE *); -+extern NCURSES_EXPORT(int) _nc_setupscreen (int, int, FILE *, int, int); - extern NCURSES_EXPORT(int) _nc_timed_wait (SCREEN *, int, int, int * EVENTLIST_2nd(_nc_eventlist *)); --extern NCURSES_EXPORT(void) _nc_do_color (short, short, bool, NCURSES_OUTC); -+extern NCURSES_EXPORT(void) _nc_do_color (int, int, int, NCURSES_OUTC); - extern NCURSES_EXPORT(void) _nc_flush (void); - extern NCURSES_EXPORT(void) _nc_free_and_exit (int) GCC_NORETURN; - extern NCURSES_EXPORT(void) _nc_free_entry (ENTRY *, TERMTYPE *); -@@ -1895,8 +2017,9 @@ - extern NCURSES_EXPORT(void) _nc_make_oldhash (int i); - extern NCURSES_EXPORT(void) _nc_scroll_oldhash (int n, int top, int bot); - extern NCURSES_EXPORT(void) _nc_scroll_optimize (void); --extern NCURSES_EXPORT(void) _nc_set_buffer (FILE *, bool); --extern NCURSES_EXPORT(void) _nc_signal_handler (bool); -+extern NCURSES_EXPORT(void) _nc_set_buffer (FILE *, int); -+extern NCURSES_EXPORT(void) _nc_setenv_num (const char *, int); -+extern NCURSES_EXPORT(void) _nc_signal_handler (int); - extern NCURSES_EXPORT(void) _nc_synchook (WINDOW *); - extern NCURSES_EXPORT(void) _nc_trace_tries (TRIES *); - -@@ -1905,7 +2028,9 @@ - extern NCURSES_EXPORT(void) _nc_captoinfo_leaks(void); - extern NCURSES_EXPORT(void) _nc_codes_leaks(void); - extern NCURSES_EXPORT(void) _nc_comp_captab_leaks(void); -+extern NCURSES_EXPORT(void) _nc_comp_error_leaks(void); - extern NCURSES_EXPORT(void) _nc_comp_scan_leaks(void); -+extern NCURSES_EXPORT(void) _nc_db_iterator_leaks(void); - extern NCURSES_EXPORT(void) _nc_keyname_leaks(void); - extern NCURSES_EXPORT(void) _nc_names_leaks(void); - extern NCURSES_EXPORT(void) _nc_tgetent_leaks(void); -@@ -1914,7 +2039,7 @@ - #if !(defined(USE_TERMLIB) || defined(USE_BUILD_CC)) - extern NCURSES_EXPORT(NCURSES_CH_T) _nc_render (WINDOW *, NCURSES_CH_T); - extern NCURSES_EXPORT(int) _nc_waddch_nosync (WINDOW *, const NCURSES_CH_T); --extern NCURSES_EXPORT(void) _nc_scroll_window (WINDOW *, int const, NCURSES_SIZE_T const, NCURSES_SIZE_T const, NCURSES_CH_T); -+extern NCURSES_EXPORT(void) _nc_scroll_window (WINDOW *, int const, int const, int const, NCURSES_CH_T); - #endif - - #if USE_WIDEC_SUPPORT -@@ -1946,8 +2071,26 @@ - * Wide-character macros to hide some platform-differences. - */ - #if USE_WIDEC_SUPPORT -+ -+#if defined(__MINGW32__) -+/* -+ * MinGW has wide-character functions, but they do not work correctly. -+ */ -+ -+extern int __MINGW_NOTHROW _nc_wctomb(char *, wchar_t); -+#define wctomb(s,wc) _nc_wctomb(s,wc) -+#define wcrtomb(s,wc,n) _nc_wctomb(s,wc) -+ -+extern int __MINGW_NOTHROW _nc_mbtowc(wchar_t *, const char *, size_t); -+#define mbtowc(pwc,s,n) _nc_mbtowc(pwc,s,n) -+ -+extern int __MINGW_NOTHROW _nc_mblen(const char *, size_t); -+#define mblen(s,n) _nc_mblen(s, n) -+ -+#endif /* __MINGW32__ */ -+ - #if HAVE_MBTOWC && HAVE_MBLEN --#define reset_mbytes(state) IGNORE_RC(mblen(NULL, 0)), IGNORE_RC(mbtowc(NULL, NULL, 0)) -+#define reset_mbytes(state) IGNORE_RC(mblen(NULL, (size_t) 0)), IGNORE_RC(mbtowc(NULL, NULL, (size_t) 0)) - #define count_mbytes(buffer,length,state) mblen(buffer,length) - #define check_mbytes(wch,buffer,length,state) \ - (int) mbtowc(&wch, buffer, length) -@@ -1960,7 +2103,8 @@ - #else - make an error - #endif --#endif -+ -+#endif /* USE_WIDEC_SUPPORT */ - - /* - * Not everyone has vsscanf(), but we'd like to use it for scanw(). -@@ -1974,8 +2118,6 @@ - - #define USE_SETBUF_0 0 - --#define NC_BUFFERED(sp,flag) NCURSES_SP_NAME(_nc_set_buffer)(NCURSES_SP_ARGx sp->_ofp, flag) -- - #define NC_OUTPUT(sp) ((sp != 0) ? sp->_ofp : stdout) - - /* -@@ -2049,9 +2191,9 @@ - - #define SetSafeOutcWrapper(outc) \ - SCREEN* sp = CURRENT_SCREEN; \ -+ struct screen outc_wrapper; \ - if (sp==0) { \ -- struct screen dummy; \ -- sp = &dummy; \ -+ sp = &outc_wrapper; \ - memset(sp,0,sizeof(struct screen)); \ - sp->_outch = _nc_outc_wrapper; \ - }\ -@@ -2084,40 +2226,40 @@ - - typedef struct term_driver { - bool isTerminfo; -- bool (*CanHandle)(struct DriverTCB*,const char*,int*); -- void (*init)(struct DriverTCB*); -- void (*release)(struct DriverTCB*); -- int (*size)(struct DriverTCB*, int* Line, int *Cols); -- int (*sgmode)(struct DriverTCB*, bool setFlag, TTY*); -- chtype (*conattr)(struct DriverTCB*); -- int (*hwcur)(struct DriverTCB*, int yold, int xold, int y, int x); -- int (*mode)(struct DriverTCB*, bool progFlag, bool defFlag); -- bool (*rescol)(struct DriverTCB*); -- bool (*rescolors)(struct DriverTCB*); -- void (*color)(struct DriverTCB*,bool fore, int color, int(*)(SCREEN*,int)); -- int (*doBeepOrFlash)(struct DriverTCB*, bool); -- void (*initpair)(struct DriverTCB*,short,short,short); -- void (*initcolor)(struct DriverTCB*,short,short,short,short); -- void (*docolor)(struct DriverTCB*,short,short,bool,int(*)(SCREEN*,int)); -- void (*initmouse)(struct DriverTCB*); -- int (*testmouse)(struct DriverTCB*,int); -- void (*setfilter)(struct DriverTCB*); -- void (*hwlabel)(struct DriverTCB*,int,char*); -- void (*hwlabelOnOff)(struct DriverTCB*,bool); -- int (*update)(struct DriverTCB*); -- int (*defaultcolors)(struct DriverTCB*,int,int); -- int (*print)(struct DriverTCB*,char*,int); -- int (*getsize)(struct DriverTCB*,int*,int*); -- int (*setsize)(struct DriverTCB*,int,int); -- void (*initacs)(struct DriverTCB*,chtype*,chtype*); -- void (*scinit)(SCREEN *); -- void (*scexit)(SCREEN *); -- int (*twait)(struct DriverTCB*,int,int,int* EVENTLIST_2nd(_nc_eventlist*)); -- int (*read)(struct DriverTCB*,int*); -- int (*nap)(struct DriverTCB*,int); -- int (*kpad)(struct DriverTCB*, bool); -- int (*kyOk)(struct DriverTCB*, int, bool); -- bool (*kyExist)(struct DriverTCB*, int); -+ bool (*td_CanHandle)(struct DriverTCB*, const char*, int*); -+ void (*td_init)(struct DriverTCB*); -+ void (*td_release)(struct DriverTCB*); -+ int (*td_size)(struct DriverTCB*, int* Line, int *Cols); -+ int (*td_sgmode)(struct DriverTCB*, int setFlag, TTY*); -+ chtype (*td_conattr)(struct DriverTCB*); -+ int (*td_hwcur)(struct DriverTCB*, int yold, int xold, int y, int x); -+ int (*td_mode)(struct DriverTCB*, int progFlag, int defFlag); -+ bool (*td_rescol)(struct DriverTCB*); -+ bool (*td_rescolors)(struct DriverTCB*); -+ void (*td_color)(struct DriverTCB*, int fore, int color, int(*)(SCREEN*, int)); -+ int (*td_doBeepOrFlash)(struct DriverTCB*, int); -+ void (*td_initpair)(struct DriverTCB*, int, int, int); -+ void (*td_initcolor)(struct DriverTCB*, int, int, int, int); -+ void (*td_docolor)(struct DriverTCB*, int, int, int, int(*)(SCREEN*, int)); -+ void (*td_initmouse)(struct DriverTCB*); -+ int (*td_testmouse)(struct DriverTCB*, int EVENTLIST_2nd(_nc_eventlist*)); -+ void (*td_setfilter)(struct DriverTCB*); -+ void (*td_hwlabel)(struct DriverTCB*, int, char*); -+ void (*td_hwlabelOnOff)(struct DriverTCB*, int); -+ int (*td_update)(struct DriverTCB*); -+ int (*td_defaultcolors)(struct DriverTCB*, int, int); -+ int (*td_print)(struct DriverTCB*, char*, int); -+ int (*td_getsize)(struct DriverTCB*, int*, int*); -+ int (*td_setsize)(struct DriverTCB*, int, int); -+ void (*td_initacs)(struct DriverTCB*, chtype*, chtype*); -+ void (*td_scinit)(SCREEN *); -+ void (*td_scexit)(SCREEN *); -+ int (*td_twait)(struct DriverTCB*, int, int, int* EVENTLIST_2nd(_nc_eventlist*)); -+ int (*td_read)(struct DriverTCB*, int*); -+ int (*td_nap)(struct DriverTCB*, int); -+ int (*td_kpad)(struct DriverTCB*, int); -+ int (*td_kyOk)(struct DriverTCB*, int, int); -+ bool (*td_kyExist)(struct DriverTCB*, int); - } TERM_DRIVER; - - typedef struct DriverTCB -@@ -2166,7 +2308,7 @@ - #else - #define TINFO_HAS_KEY NCURSES_SP_NAME(has_key) - #define TINFO_DOUPDATE NCURSES_SP_NAME(doupdate) --#define TINFO_MVCUR NCURSES_SP_NAME(mvcur) -+#define TINFO_MVCUR NCURSES_SP_NAME(_nc_mvcur) - #endif - - /* -@@ -2174,7 +2316,7 @@ - */ - #ifdef USE_TERM_DRIVER - extern NCURSES_EXPORT(void) _nc_get_screensize(SCREEN *, TERMINAL *, int *, int *); --extern NCURSES_EXPORT(int) _nc_setupterm_ex(TERMINAL **, NCURSES_CONST char *, int , int *, bool); -+extern NCURSES_EXPORT(int) _nc_setupterm_ex(TERMINAL **, NCURSES_CONST char *, int , int *, int); - #define TINFO_GET_SIZE(sp, tp, lp, cp) \ - _nc_get_screensize(sp, tp, lp, cp) - #define TINFO_SET_CURTERM(sp, tp) \ -@@ -2200,12 +2342,13 @@ - #endif - - #ifdef USE_TERM_DRIVER --#define IsTermInfo(sp) (TCBOf(sp) && ((TCBOf(sp)->drv->isTerminfo))) -+#define IsTermInfo(sp) ((TCBOf(sp) != 0) && ((TCBOf(sp)->drv->isTerminfo))) -+#define HasTInfoTerminal(sp) ((0 != TerminalOf(sp)) && IsTermInfo(sp)) - #else - #define IsTermInfo(sp) TRUE -+#define HasTInfoTerminal(sp) (0 != TerminalOf(sp)) - #endif - --#define HasTInfoTerminal(sp) ((0 != TerminalOf(sp)) && IsTermInfo(sp)) - #define IsValidTIScreen(sp) (HasTInfoTerminal(sp)) - - /* -@@ -2239,7 +2382,9 @@ - extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_get_tty_mode)(SCREEN*,TTY*); - extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_mcprint)(SCREEN*,char*, int); - extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_msec_cost)(SCREEN*, const char *, int); -+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_mvcur)(SCREEN*, int, int, int, int); - extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_outch)(SCREEN*, int); -+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_putchar)(SCREEN*, int); - extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_putp)(SCREEN*, const char *, const char*); - extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_putp_flush)(SCREEN*, const char *, const char *); - extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_resetty)(SCREEN*); -@@ -2250,12 +2395,12 @@ - extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_scr_restore)(SCREEN*, const char*); - extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_scrolln)(SCREEN*, int, int, int, int); - extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_set_tty_mode)(SCREEN*, TTY*); --extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_setupscreen)(SCREEN**, int, int, FILE *, bool, int); -+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_setupscreen)(SCREEN**, int, int, FILE *, int, int); - extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_tgetent)(SCREEN*,char*,const char *); - extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_tigetnum)(SCREEN*,NCURSES_CONST char*); --extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_vid_attr)(SCREEN *, attr_t, short, void *); -+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_vid_attr)(SCREEN *, attr_t, NCURSES_COLOR_T, void *); - extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_vidputs)(SCREEN*,chtype,int(*) (SCREEN*, int)); --extern NCURSES_EXPORT(void) NCURSES_SP_NAME(_nc_do_color)(SCREEN*, short, short, bool, NCURSES_SP_OUTC); -+extern NCURSES_EXPORT(void) NCURSES_SP_NAME(_nc_do_color)(SCREEN*, int, int, int, NCURSES_SP_OUTC); - extern NCURSES_EXPORT(void) NCURSES_SP_NAME(_nc_do_xmc_glitch)(SCREEN*, attr_t); - extern NCURSES_EXPORT(void) NCURSES_SP_NAME(_nc_flush)(SCREEN*); - extern NCURSES_EXPORT(void) NCURSES_SP_NAME(_nc_free_and_exit)(SCREEN*, int) GCC_NORETURN; -@@ -2271,7 +2416,7 @@ - extern NCURSES_EXPORT(void) NCURSES_SP_NAME(_nc_screen_wrap)(SCREEN*); - extern NCURSES_EXPORT(void) NCURSES_SP_NAME(_nc_scroll_oldhash)(SCREEN*, int n, int top, int bot); - extern NCURSES_EXPORT(void) NCURSES_SP_NAME(_nc_scroll_optimize)(SCREEN*); --extern NCURSES_EXPORT(void) NCURSES_SP_NAME(_nc_set_buffer)(SCREEN*, FILE *, bool); -+extern NCURSES_EXPORT(void) NCURSES_SP_NAME(_nc_set_buffer)(SCREEN*, FILE *, int); - - extern NCURSES_EXPORT(void) _nc_cookie_init(SCREEN *sp); - -diff -Naur ncurses-5.9/ncurses/fifo_defs.h ncurses-5.9.patch/ncurses/fifo_defs.h ---- ncurses-5.9/ncurses/fifo_defs.h 2008-06-28 17:52:32.000000000 +0200 -+++ ncurses-5.9.patch/ncurses/fifo_defs.h 2014-09-01 16:33:22.414792220 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2002,2008 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2008,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -34,7 +34,7 @@ - /* - * Common macros for lib_getch.c, lib_ungetch.c - * -- * $Id: fifo_defs.h,v 1.6 2008/06/28 15:52:32 tom Exp $ -+ * $Id: fifo_defs.h,v 1.7 2012/08/04 15:59:17 tom Exp $ - */ - - #ifndef FIFO_DEFS_H -@@ -45,14 +45,42 @@ - /* peek points to next uninterpreted character */ - #define peek sp->_fifopeek - --#define h_inc() { head == FIFO_SIZE-1 ? head = 0 : head++; if (head == tail) head = -1, tail = 0;} --#define h_dec() { head == 0 ? head = FIFO_SIZE-1 : head--; if (head == tail) tail = -1;} --#define t_inc() { tail == FIFO_SIZE-1 ? tail = 0 : tail++; if (tail == head) tail = -1;} --#define t_dec() { tail == 0 ? tail = FIFO_SIZE-1 : tail--; if (head == tail) fifo_clear(sp);} --#define p_inc() { peek == FIFO_SIZE-1 ? peek = 0 : peek++;} -+#define h_inc() { \ -+ (head >= FIFO_SIZE-1) \ -+ ? head = 0 \ -+ : head++; \ -+ if (head == tail) \ -+ head = -1, tail = 0; \ -+ } -+#define h_dec() { \ -+ (head <= 0) \ -+ ? head = FIFO_SIZE-1 \ -+ : head--; \ -+ if (head == tail) \ -+ tail = -1; \ -+ } -+#define t_inc() { \ -+ (tail >= FIFO_SIZE-1) \ -+ ? tail = 0 \ -+ : tail++; \ -+ if (tail == head) \ -+ tail = -1; \ -+ } -+#define t_dec() { \ -+ (tail <= 0) \ -+ ? tail = FIFO_SIZE-1 \ -+ : tail--; \ -+ if (head == tail) \ -+ fifo_clear(sp); \ -+ } -+#define p_inc() { \ -+ (peek >= FIFO_SIZE-1) \ -+ ? peek = 0 \ -+ : peek++; \ -+ } - --#define cooked_key_in_fifo() ((head != -1) && (peek != head)) --#define raw_key_in_fifo() ((head != -1) && (peek != tail)) -+#define cooked_key_in_fifo() ((head >= 0) && (peek != head)) -+#define raw_key_in_fifo() ((head >= 0) && (peek != tail)) - - #undef HIDE_EINTR - -diff -Naur ncurses-5.9/ncurses/llib-lncurses ncurses-5.9.patch/ncurses/llib-lncurses ---- ncurses-5.9/ncurses/llib-lncurses 2011-01-08 19:57:00.000000000 +0100 -+++ ncurses-5.9.patch/ncurses/llib-lncurses 2014-09-01 16:33:22.415792222 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2010,2011 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2011,2013 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -27,7 +27,7 @@ - ****************************************************************************/ - - /**************************************************************************** -- * Author: Thomas E. Dickey 1996-2010,2011 * -+ * Author: Thomas E. Dickey 1996-on * - ****************************************************************************/ - /* LINTLIBRARY */ - -@@ -95,8 +95,6 @@ - - /* ./base/lib_addch.c */ - --#include <ctype.h> -- - #undef _nc_render - chtype _nc_render( - WINDOW *win, -@@ -219,8 +217,6 @@ - - /* ./base/lib_color.c */ - --#include <tic.h> -- - #undef COLOR_PAIRS - int COLOR_PAIRS; - #undef COLORS -@@ -329,17 +325,17 @@ - #undef _nc_do_color_sp - void _nc_do_color_sp( - SCREEN *sp, -- short old_pair, -- short pair, -- NCURSES_BOOL reverse, -+ int old_pair, -+ int pair, -+ int reverse, - NCURSES_OUTC_sp outc) - { /* void */ } - - #undef _nc_do_color - void _nc_do_color( -- short old_pair, -- short pair, -- NCURSES_BOOL reverse, -+ int old_pair, -+ int pair, -+ int reverse, - NCURSES_OUTC outc) - { /* void */ } - -@@ -418,85 +414,85 @@ - /* ./lib_gen.c */ - - #undef addch --int addch( -+int (addch)( - const chtype z) - { return(*(int *)0); } - - #undef addchnstr --int addchnstr( -+int (addchnstr)( - const chtype *a1, - int z) - { return(*(int *)0); } - - #undef addchstr --int addchstr( -+int (addchstr)( - const chtype *z) - { return(*(int *)0); } - - #undef addnstr --int addnstr( -+int (addnstr)( - const char *a1, - int z) - { return(*(int *)0); } - - #undef addstr --int addstr( -+int (addstr)( - const char *z) - { return(*(int *)0); } - - #undef attroff --int attroff( -+int (attroff)( - NCURSES_ATTR_T z) - { return(*(int *)0); } - - #undef attron --int attron( -+int (attron)( - NCURSES_ATTR_T z) - { return(*(int *)0); } - - #undef attrset --int attrset( -+int (attrset)( - NCURSES_ATTR_T z) - { return(*(int *)0); } - - #undef attr_get --int attr_get( -+int (attr_get)( - attr_t *a1, - short *a2, - void *z) - { return(*(int *)0); } - - #undef attr_off --int attr_off( -+int (attr_off)( - attr_t a1, - void *z) - { return(*(int *)0); } - - #undef attr_on --int attr_on( -+int (attr_on)( - attr_t a1, - void *z) - { return(*(int *)0); } - - #undef attr_set --int attr_set( -+int (attr_set)( - attr_t a1, - short a2, - void *z) - { return(*(int *)0); } - - #undef bkgd --int bkgd( -+int (bkgd)( - chtype z) - { return(*(int *)0); } - - #undef bkgdset --void bkgdset( -+void (bkgdset)( - chtype z) - { /* void */ } - - #undef border --int border( -+int (border)( - chtype a1, - chtype a2, - chtype a3, -@@ -508,14 +504,14 @@ - { return(*(int *)0); } - - #undef box --int box( -+int (box)( - WINDOW *a1, - chtype a2, - chtype z) - { return(*(int *)0); } - - #undef chgat --int chgat( -+int (chgat)( - int a1, - attr_t a2, - short a3, -@@ -523,137 +519,137 @@ - { return(*(int *)0); } - - #undef clear --int clear(void) -+int (clear)(void) - { return(*(int *)0); } - - #undef clrtobot --int clrtobot(void) -+int (clrtobot)(void) - { return(*(int *)0); } - - #undef clrtoeol --int clrtoeol(void) -+int (clrtoeol)(void) - { return(*(int *)0); } - - #undef color_set --int color_set( -+int (color_set)( - short a1, - void *z) - { return(*(int *)0); } - - #undef COLOR_PAIR --int COLOR_PAIR( -+int (COLOR_PAIR)( - int z) - { return(*(int *)0); } - - #undef delch --int delch(void) -+int (delch)(void) - { return(*(int *)0); } - - #undef deleteln --int deleteln(void) -+int (deleteln)(void) - { return(*(int *)0); } - - #undef echochar --int echochar( -+int (echochar)( - const chtype z) - { return(*(int *)0); } - - #undef erase --int erase(void) -+int (erase)(void) - { return(*(int *)0); } - - #undef getbkgd --chtype getbkgd( -+chtype (getbkgd)( - WINDOW *z) - { return(*(chtype *)0); } - - #undef getch --int getch(void) -+int (getch)(void) - { return(*(int *)0); } - - #undef getnstr --int getnstr( -+int (getnstr)( - char *a1, - int z) - { return(*(int *)0); } - - #undef getstr --int getstr( -+int (getstr)( - char *z) - { return(*(int *)0); } - - #undef hline --int hline( -+int (hline)( - chtype a1, - int z) - { return(*(int *)0); } - - #undef inch --chtype inch(void) -+chtype (inch)(void) - { return(*(chtype *)0); } - - #undef inchnstr --int inchnstr( -+int (inchnstr)( - chtype *a1, - int z) - { return(*(int *)0); } - - #undef inchstr --int inchstr( -+int (inchstr)( - chtype *z) - { return(*(int *)0); } - - #undef innstr --int innstr( -+int (innstr)( - char *a1, - int z) - { return(*(int *)0); } - - #undef insch --int insch( -+int (insch)( - chtype z) - { return(*(int *)0); } - - #undef insdelln --int insdelln( -+int (insdelln)( - int z) - { return(*(int *)0); } - - #undef insertln --int insertln(void) -+int (insertln)(void) - { return(*(int *)0); } - - #undef insnstr --int insnstr( -+int (insnstr)( - const char *a1, - int z) - { return(*(int *)0); } - - #undef insstr --int insstr( -+int (insstr)( - const char *z) - { return(*(int *)0); } - - #undef instr --int instr( -+int (instr)( - char *z) - { return(*(int *)0); } - - #undef move --int move( -+int (move)( - int a1, - int z) - { return(*(int *)0); } - - #undef mvaddch --int mvaddch( -+int (mvaddch)( - int a1, - int a2, - const chtype z) - { return(*(int *)0); } - - #undef mvaddchnstr --int mvaddchnstr( -+int (mvaddchnstr)( - int a1, - int a2, - const chtype *a3, -@@ -661,14 +657,14 @@ - { return(*(int *)0); } - - #undef mvaddchstr --int mvaddchstr( -+int (mvaddchstr)( - int a1, - int a2, - const chtype *z) - { return(*(int *)0); } - - #undef mvaddnstr --int mvaddnstr( -+int (mvaddnstr)( - int a1, - int a2, - const char *a3, -@@ -676,14 +672,14 @@ - { return(*(int *)0); } - - #undef mvaddstr --int mvaddstr( -+int (mvaddstr)( - int a1, - int a2, - const char *z) - { return(*(int *)0); } - - #undef mvchgat --int mvchgat( -+int (mvchgat)( - int a1, - int a2, - int a3, -@@ -693,19 +689,19 @@ - { return(*(int *)0); } - - #undef mvdelch --int mvdelch( -+int (mvdelch)( - int a1, - int z) - { return(*(int *)0); } - - #undef mvgetch --int mvgetch( -+int (mvgetch)( - int a1, - int z) - { return(*(int *)0); } - - #undef mvgetnstr --int mvgetnstr( -+int (mvgetnstr)( - int a1, - int a2, - char *a3, -@@ -713,14 +709,14 @@ - { return(*(int *)0); } - - #undef mvgetstr --int mvgetstr( -+int (mvgetstr)( - int a1, - int a2, - char *z) - { return(*(int *)0); } - - #undef mvhline --int mvhline( -+int (mvhline)( - int a1, - int a2, - chtype a3, -@@ -728,13 +724,13 @@ - { return(*(int *)0); } - - #undef mvinch --chtype mvinch( -+chtype (mvinch)( - int a1, - int z) - { return(*(chtype *)0); } - - #undef mvinchnstr --int mvinchnstr( -+int (mvinchnstr)( - int a1, - int a2, - chtype *a3, -@@ -742,14 +738,14 @@ - { return(*(int *)0); } - - #undef mvinchstr --int mvinchstr( -+int (mvinchstr)( - int a1, - int a2, - chtype *z) - { return(*(int *)0); } - - #undef mvinnstr --int mvinnstr( -+int (mvinnstr)( - int a1, - int a2, - char *a3, -@@ -757,14 +753,14 @@ - { return(*(int *)0); } - - #undef mvinsch --int mvinsch( -+int (mvinsch)( - int a1, - int a2, - chtype z) - { return(*(int *)0); } - - #undef mvinsnstr --int mvinsnstr( -+int (mvinsnstr)( - int a1, - int a2, - const char *a3, -@@ -772,21 +768,21 @@ - { return(*(int *)0); } - - #undef mvinsstr --int mvinsstr( -+int (mvinsstr)( - int a1, - int a2, - const char *z) - { return(*(int *)0); } - - #undef mvinstr --int mvinstr( -+int (mvinstr)( - int a1, - int a2, - char *z) - { return(*(int *)0); } - - #undef mvvline --int mvvline( -+int (mvvline)( - int a1, - int a2, - chtype a3, -@@ -794,7 +790,7 @@ - { return(*(int *)0); } - - #undef mvwaddch --int mvwaddch( -+int (mvwaddch)( - WINDOW *a1, - int a2, - int a3, -@@ -802,7 +798,7 @@ - { return(*(int *)0); } - - #undef mvwaddchnstr --int mvwaddchnstr( -+int (mvwaddchnstr)( - WINDOW *a1, - int a2, - int a3, -@@ -811,7 +807,7 @@ - { return(*(int *)0); } - - #undef mvwaddchstr --int mvwaddchstr( -+int (mvwaddchstr)( - WINDOW *a1, - int a2, - int a3, -@@ -819,7 +815,7 @@ - { return(*(int *)0); } - - #undef mvwaddnstr --int mvwaddnstr( -+int (mvwaddnstr)( - WINDOW *a1, - int a2, - int a3, -@@ -828,7 +824,7 @@ - { return(*(int *)0); } - - #undef mvwaddstr --int mvwaddstr( -+int (mvwaddstr)( - WINDOW *a1, - int a2, - int a3, -@@ -836,7 +832,7 @@ - { return(*(int *)0); } - - #undef mvwchgat --int mvwchgat( -+int (mvwchgat)( - WINDOW *a1, - int a2, - int a3, -@@ -847,21 +843,21 @@ - { return(*(int *)0); } - - #undef mvwdelch --int mvwdelch( -+int (mvwdelch)( - WINDOW *a1, - int a2, - int z) - { return(*(int *)0); } - - #undef mvwgetch --int mvwgetch( -+int (mvwgetch)( - WINDOW *a1, - int a2, - int z) - { return(*(int *)0); } - - #undef mvwgetnstr --int mvwgetnstr( -+int (mvwgetnstr)( - WINDOW *a1, - int a2, - int a3, -@@ -870,7 +866,7 @@ - { return(*(int *)0); } - - #undef mvwgetstr --int mvwgetstr( -+int (mvwgetstr)( - WINDOW *a1, - int a2, - int a3, -@@ -878,7 +874,7 @@ - { return(*(int *)0); } - - #undef mvwhline --int mvwhline( -+int (mvwhline)( - WINDOW *a1, - int a2, - int a3, -@@ -887,14 +883,14 @@ - { return(*(int *)0); } - - #undef mvwinch --chtype mvwinch( -+chtype (mvwinch)( - WINDOW *a1, - int a2, - int z) - { return(*(chtype *)0); } - - #undef mvwinchnstr --int mvwinchnstr( -+int (mvwinchnstr)( - WINDOW *a1, - int a2, - int a3, -@@ -903,7 +899,7 @@ - { return(*(int *)0); } - - #undef mvwinchstr --int mvwinchstr( -+int (mvwinchstr)( - WINDOW *a1, - int a2, - int a3, -@@ -911,7 +907,7 @@ - { return(*(int *)0); } - - #undef mvwinnstr --int mvwinnstr( -+int (mvwinnstr)( - WINDOW *a1, - int a2, - int a3, -@@ -920,7 +916,7 @@ - { return(*(int *)0); } - - #undef mvwinsch --int mvwinsch( -+int (mvwinsch)( - WINDOW *a1, - int a2, - int a3, -@@ -928,7 +924,7 @@ - { return(*(int *)0); } - - #undef mvwinsnstr --int mvwinsnstr( -+int (mvwinsnstr)( - WINDOW *a1, - int a2, - int a3, -@@ -937,7 +933,7 @@ - { return(*(int *)0); } - - #undef mvwinsstr --int mvwinsstr( -+int (mvwinsstr)( - WINDOW *a1, - int a2, - int a3, -@@ -945,7 +941,7 @@ - { return(*(int *)0); } - - #undef mvwinstr --int mvwinstr( -+int (mvwinstr)( - WINDOW *a1, - int a2, - int a3, -@@ -953,7 +949,7 @@ - { return(*(int *)0); } - - #undef mvwvline --int mvwvline( -+int (mvwvline)( - WINDOW *a1, - int a2, - int a3, -@@ -962,117 +958,117 @@ - { return(*(int *)0); } - - #undef PAIR_NUMBER --int PAIR_NUMBER( -+int (PAIR_NUMBER)( - int z) - { return(*(int *)0); } - - #undef redrawwin --int redrawwin( -+int (redrawwin)( - WINDOW *z) - { return(*(int *)0); } - - #undef refresh --int refresh(void) -+int (refresh)(void) - { return(*(int *)0); } - - #undef scrl --int scrl( -+int (scrl)( - int z) - { return(*(int *)0); } - - #undef scroll --int scroll( -+int (scroll)( - WINDOW *z) - { return(*(int *)0); } - - #undef setscrreg --int setscrreg( -+int (setscrreg)( - int a1, - int z) - { return(*(int *)0); } - - #undef standout --int standout(void) -+int (standout)(void) - { return(*(int *)0); } - - #undef standend --int standend(void) -+int (standend)(void) - { return(*(int *)0); } - - #undef timeout --void timeout( -+void (timeout)( - int z) - { /* void */ } - - #undef touchline --int touchline( -+int (touchline)( - WINDOW *a1, - int a2, - int z) - { return(*(int *)0); } - - #undef touchwin --int touchwin( -+int (touchwin)( - WINDOW *z) - { return(*(int *)0); } - - #undef untouchwin --int untouchwin( -+int (untouchwin)( - WINDOW *z) - { return(*(int *)0); } - - #undef vline --int vline( -+int (vline)( - chtype a1, - int z) - { return(*(int *)0); } - - #undef vw_printw --int vw_printw( -+int (vw_printw)( - WINDOW *a1, - const char *a2, - va_list z) - { return(*(int *)0); } - - #undef vw_scanw --int vw_scanw( -+int (vw_scanw)( - WINDOW *a1, - char *a2, - va_list z) - { return(*(int *)0); } - - #undef waddchstr --int waddchstr( -+int (waddchstr)( - WINDOW *a1, - const chtype *z) - { return(*(int *)0); } - - #undef waddstr --int waddstr( -+int (waddstr)( - WINDOW *a1, - const char *z) - { return(*(int *)0); } - - #undef wattron --int wattron( -+int (wattron)( - WINDOW *a1, - int z) - { return(*(int *)0); } - - #undef wattroff --int wattroff( -+int (wattroff)( - WINDOW *a1, - int z) - { return(*(int *)0); } - - #undef wattrset --int wattrset( -+int (wattrset)( - WINDOW *a1, - int z) - { return(*(int *)0); } - - #undef wattr_get --int wattr_get( -+int (wattr_get)( - WINDOW *a1, - attr_t *a2, - short *a3, -@@ -1080,7 +1076,7 @@ - { return(*(int *)0); } - - #undef wattr_set --int wattr_set( -+int (wattr_set)( - WINDOW *a1, - attr_t a2, - short a3, -@@ -1088,168 +1084,168 @@ - { return(*(int *)0); } - - #undef wdeleteln --int wdeleteln( -+int (wdeleteln)( - WINDOW *z) - { return(*(int *)0); } - - #undef wgetstr --int wgetstr( -+int (wgetstr)( - WINDOW *a1, - char *z) - { return(*(int *)0); } - - #undef winchstr --int winchstr( -+int (winchstr)( - WINDOW *a1, - chtype *z) - { return(*(int *)0); } - - #undef winsertln --int winsertln( -+int (winsertln)( - WINDOW *z) - { return(*(int *)0); } - - #undef winsstr --int winsstr( -+int (winsstr)( - WINDOW *a1, - const char *z) - { return(*(int *)0); } - - #undef winstr --int winstr( -+int (winstr)( - WINDOW *a1, - char *z) - { return(*(int *)0); } - - #undef wstandout --int wstandout( -+int (wstandout)( - WINDOW *z) - { return(*(int *)0); } - - #undef wstandend --int wstandend( -+int (wstandend)( - WINDOW *z) - { return(*(int *)0); } - - #undef getattrs --int getattrs( -+int (getattrs)( - const WINDOW *z) - { return(*(int *)0); } - - #undef getcurx --int getcurx( -+int (getcurx)( - const WINDOW *z) - { return(*(int *)0); } - - #undef getcury --int getcury( -+int (getcury)( - const WINDOW *z) - { return(*(int *)0); } - - #undef getbegx --int getbegx( -+int (getbegx)( - const WINDOW *z) - { return(*(int *)0); } - - #undef getbegy --int getbegy( -+int (getbegy)( - const WINDOW *z) - { return(*(int *)0); } - - #undef getmaxx --int getmaxx( -+int (getmaxx)( - const WINDOW *z) - { return(*(int *)0); } - - #undef getmaxy --int getmaxy( -+int (getmaxy)( - const WINDOW *z) - { return(*(int *)0); } - - #undef getparx --int getparx( -+int (getparx)( - const WINDOW *z) - { return(*(int *)0); } - - #undef getpary --int getpary( -+int (getpary)( - const WINDOW *z) - { return(*(int *)0); } - - #undef wgetparent --WINDOW *wgetparent( -+WINDOW *(wgetparent)( - const WINDOW *z) - { return(*(WINDOW **)0); } - - #undef is_cleared --NCURSES_BOOL is_cleared( -+NCURSES_BOOL (is_cleared)( - const WINDOW *z) - { return(*(NCURSES_BOOL *)0); } - - #undef is_idcok --NCURSES_BOOL is_idcok( -+NCURSES_BOOL (is_idcok)( - const WINDOW *z) - { return(*(NCURSES_BOOL *)0); } - - #undef is_idlok --NCURSES_BOOL is_idlok( -+NCURSES_BOOL (is_idlok)( - const WINDOW *z) - { return(*(NCURSES_BOOL *)0); } - - #undef is_immedok --NCURSES_BOOL is_immedok( -+NCURSES_BOOL (is_immedok)( - const WINDOW *z) - { return(*(NCURSES_BOOL *)0); } - - #undef is_keypad --NCURSES_BOOL is_keypad( -+NCURSES_BOOL (is_keypad)( - const WINDOW *z) - { return(*(NCURSES_BOOL *)0); } - - #undef is_leaveok --NCURSES_BOOL is_leaveok( -+NCURSES_BOOL (is_leaveok)( - const WINDOW *z) - { return(*(NCURSES_BOOL *)0); } - - #undef is_nodelay --NCURSES_BOOL is_nodelay( -+NCURSES_BOOL (is_nodelay)( - const WINDOW *z) - { return(*(NCURSES_BOOL *)0); } - - #undef is_notimeout --NCURSES_BOOL is_notimeout( -+NCURSES_BOOL (is_notimeout)( - const WINDOW *z) - { return(*(NCURSES_BOOL *)0); } - - #undef is_pad --NCURSES_BOOL is_pad( -+NCURSES_BOOL (is_pad)( - const WINDOW *z) - { return(*(NCURSES_BOOL *)0); } - - #undef is_scrollok --NCURSES_BOOL is_scrollok( -+NCURSES_BOOL (is_scrollok)( - const WINDOW *z) - { return(*(NCURSES_BOOL *)0); } - - #undef is_subwin --NCURSES_BOOL is_subwin( -+NCURSES_BOOL (is_subwin)( - const WINDOW *z) - { return(*(NCURSES_BOOL *)0); } - - #undef is_syncok --NCURSES_BOOL is_syncok( -+NCURSES_BOOL (is_syncok)( - const WINDOW *z) - { return(*(NCURSES_BOOL *)0); } - - #undef wgetscrreg --int wgetscrreg( -+int (wgetscrreg)( - const WINDOW *a1, - int *a2, - int *z) - { return(*(int *)0); } - - #undef mouse_trafo --NCURSES_BOOL mouse_trafo( -+NCURSES_BOOL (mouse_trafo)( - int *a1, - int *a2, - NCURSES_BOOL z) -@@ -1257,8 +1253,6 @@ - - /* ./base/lib_getch.c */ - --#include <fifo_defs.h> -- - #undef ESCDELAY - int ESCDELAY; - -@@ -1523,6 +1517,23 @@ - void _nc_mvcur_wrap(void) - { /* void */ } - -+#undef _nc_mvcur_sp -+int _nc_mvcur_sp( -+ SCREEN *sp, -+ int yold, -+ int xold, -+ int ynew, -+ int xnew) -+ { return(*(int *)0); } -+ -+#undef _nc_mvcur -+int _nc_mvcur( -+ int yold, -+ int xold, -+ int ynew, -+ int xnew) -+ { return(*(int *)0); } -+ - #undef mvcur_sp - int mvcur_sp( - SCREEN *sp, -@@ -1932,8 +1943,8 @@ - void _nc_scroll_window( - WINDOW *win, - int const n, -- short const top, -- short const bottom, -+ int const top, -+ int const bottom, - chtype blank) - { /* void */ } - -@@ -1978,7 +1989,7 @@ - int slines, - int scolumns, - FILE *output, -- NCURSES_BOOL filtered, -+ int filtered, - int slk_format) - { return(*(int *)0); } - -@@ -1987,7 +1998,7 @@ - int slines, - int scolumns, - FILE *output, -- NCURSES_BOOL filtered, -+ int filtered, - int slk_format) - { return(*(int *)0); } - -@@ -2263,11 +2274,9 @@ - - /* ./tty/lib_tstp.c */ - --#include <SigAction.h> -- - #undef _nc_signal_handler - void _nc_signal_handler( -- NCURSES_BOOL enable) -+ int enable) - { /* void */ } - - /* ./base/lib_ungetch.c */ -@@ -2425,9 +2434,6 @@ - - /* ./tty/tty_update.c */ - --#include <sys/time.h> --#include <sys/times.h> -- - #undef doupdate_sp - int doupdate_sp( - SCREEN *sp) -@@ -2504,12 +2510,6 @@ - va_list ap) - { return(*(char **)0); } - --/* ./base/memmove.c */ -- --#undef _nc_memmove --void _nc_memmove(void) -- { /* void */ } -- - /* ./base/vsscanf.c */ - - #undef _nc_vsscanf -@@ -2769,7 +2769,7 @@ - #undef _nc_copy_termtype - void _nc_copy_termtype( - TERMTYPE *dst, -- TERMTYPE *src) -+ const TERMTYPE *src) - { /* void */ } - - /* ./codes.c */ -@@ -2783,8 +2783,6 @@ - - /* ./comp_captab.c */ - --#include <hashsize.h> -- - #undef _nc_get_table - const struct name_table_entry *_nc_get_table( - NCURSES_BOOL termcap) -@@ -2959,6 +2957,12 @@ - const char *name) - { return(*(int *)0); } - -+#undef _nc_setenv_num -+void _nc_setenv_num( -+ const char *name, -+ int value) -+ { /* void */ } -+ - /* ./tinfo/home_terminfo.c */ - - #undef _nc_home_terminfo -@@ -2967,15 +2971,6 @@ - - /* ./tinfo/init_keytry.c */ - --#if 0 -- --#include <init_keytry.h> -- --#undef _nc_tinfo_fkeys --const struct tinfo_fkeys _nc_tinfo_fkeys[] = {0}; -- --#endif -- - #undef _nc_init_keytry - void _nc_init_keytry( - SCREEN *sp) -@@ -2997,8 +2992,6 @@ - - /* ./tinfo/lib_baudrate.c */ - --#include <termcap.h> -- - struct speed { - int s; - int sp; -@@ -3144,8 +3137,6 @@ - - /* ./tinfo/lib_napms.c */ - --#include <time.h> -- - #undef napms_sp - int napms_sp( - SCREEN *sp, -@@ -3255,7 +3246,7 @@ - #undef _nc_keypad - int _nc_keypad( - SCREEN *sp, -- NCURSES_BOOL flag) -+ int flag) - { return(*(int *)0); } - - /* ./tinfo/lib_raw.c */ -@@ -3329,10 +3320,6 @@ - - /* ./tinfo/lib_setup.c */ - --#include <locale.h> --#include <sys/ioctl.h> --#include <langinfo.h> -- - #undef ttytype - char ttytype[256]; - #undef LINES -@@ -3364,11 +3351,22 @@ - NCURSES_BOOL f) - { /* void */ } - -+#undef use_tioctl_sp -+void use_tioctl_sp( -+ SCREEN *sp, -+ NCURSES_BOOL f) -+ { /* void */ } -+ - #undef use_env - void use_env( - NCURSES_BOOL f) - { /* void */ } - -+#undef use_tioctl -+void use_tioctl( -+ NCURSES_BOOL f) -+ { /* void */ } -+ - #undef _nc_get_screensize - void _nc_get_screensize( - SCREEN *sp, -@@ -3390,7 +3388,7 @@ - #undef _nc_tinfo_cmdch - void _nc_tinfo_cmdch( - TERMINAL *termp, -- char proto) -+ int proto) - { /* void */ } - - #undef _nc_get_locale -@@ -3411,7 +3409,7 @@ - char *tname, - int Filedes, - int *errret, -- NCURSES_BOOL reuse) -+ int reuse) - { return(*(int *)0); } - - #undef new_prescr -@@ -3439,12 +3437,6 @@ - const char *name) - { return(*(int *)0); } - --#if 0 -- --#include <capdefaults.c> -- --#endif -- - #undef tgetent - int tgetent( - char *bufp, -@@ -3550,7 +3542,7 @@ - int _nc_tparm_analyze( - const char *string, - char *p_is_s[9], -- int *popcount) -+ int *_nc_popcount) - { return(*(int *)0); } - - #undef tparm -@@ -3570,7 +3562,7 @@ - #undef PC - char PC; - #undef ospeed --NCURSES_OSPEED ospeed; -+short ospeed; - #undef _nc_nulls_sent - int _nc_nulls_sent; - -@@ -3610,12 +3602,28 @@ - int ch) - { return(*(int *)0); } - -+#undef _nc_putchar_sp -+int _nc_putchar_sp( -+ SCREEN *sp, -+ int ch) -+ { return(*(int *)0); } -+ -+#undef _nc_putchar -+int _nc_putchar( -+ int ch) -+ { return(*(int *)0); } -+ - #undef putp_sp - int putp_sp( - SCREEN *sp, - const char *string) - { return(*(int *)0); } - -+#undef putp -+int putp( -+ const char *string) -+ { return(*(int *)0); } -+ - #undef _nc_putp_sp - int _nc_putp_sp( - SCREEN *sp, -@@ -3623,11 +3631,6 @@ - const char *string) - { return(*(int *)0); } - --#undef putp --int putp( -- const char *string) -- { return(*(int *)0); } -- - #undef _nc_putp - int _nc_putp( - const char *name, -@@ -3678,12 +3681,12 @@ - - #undef _nc_retrace_bool - NCURSES_BOOL _nc_retrace_bool( -- NCURSES_BOOL code) -+ int code) - { return(*(NCURSES_BOOL *)0); } - - #undef _nc_retrace_char - char _nc_retrace_char( -- char code) -+ int code) - { return(*(char *)0); } - - #undef _nc_retrace_int -@@ -3917,9 +3920,27 @@ - #undef strfnames - char *const strfnames[] = {0}; - -+/* ./tinfo/obsolete.c */ -+ -+#undef _nc_set_buffer_sp -+void _nc_set_buffer_sp( -+ SCREEN *sp, -+ FILE *ofp, -+ int buffered) -+ { /* void */ } -+ -+#undef _nc_set_buffer -+void _nc_set_buffer( -+ FILE *ofp, -+ int buffered) -+ { /* void */ } -+ - /* ./tinfo/read_entry.c */ - --#include <hashed_db.h> -+#undef _nc_init_termtype -+void _nc_init_termtype( -+ TERMTYPE *const tp) -+ { /* void */ } - - #undef _nc_read_termtype - int _nc_read_termtype( -@@ -3943,27 +3964,8 @@ - - /* ./tinfo/read_termcap.c */ - --#include <sys/types.h> -- --#undef _nc_read_termcap_entry --int _nc_read_termcap_entry( -- const char *const tn, -- TERMTYPE *const tp) -- { return(*(int *)0); } -- --/* ./tinfo/setbuf.c */ -- --#undef _nc_set_buffer_sp --void _nc_set_buffer_sp( -- SCREEN *sp, -- FILE *ofp, -- NCURSES_BOOL buffered) -- { /* void */ } -- --#undef _nc_set_buffer --void _nc_set_buffer( -- FILE *ofp, -- NCURSES_BOOL buffered) -+#undef _nc_read_termcap -+void _nc_read_termcap(void) - { /* void */ } - - /* ./tinfo/strings.c */ -@@ -4189,6 +4191,8 @@ - - #undef _nc_syntax - int _nc_syntax; -+#undef _nc_strict_bsd -+int _nc_strict_bsd; - #undef _nc_curr_file_pos - long _nc_curr_file_pos; - #undef _nc_comment_start -diff -Naur ncurses-5.9/ncurses/llib-lncursest ncurses-5.9.patch/ncurses/llib-lncursest ---- ncurses-5.9/ncurses/llib-lncursest 2011-01-08 20:03:20.000000000 +0100 -+++ ncurses-5.9.patch/ncurses/llib-lncursest 2014-09-01 16:33:22.415792222 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 2008-2010,2011 Free Software Foundation, Inc. * -+ * Copyright (c) 2008-2011,2013 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -332,17 +332,17 @@ - #undef _nc_do_color_sp - void _nc_do_color_sp( - SCREEN *sp, -- short old_pair, -- short pair, -- NCURSES_BOOL reverse, -+ int old_pair, -+ int pair, -+ int reverse, - NCURSES_OUTC_sp outc) - { /* void */ } - - #undef _nc_do_color - void _nc_do_color( -- short old_pair, -- short pair, -- NCURSES_BOOL reverse, -+ int old_pair, -+ int pair, -+ int reverse, - NCURSES_OUTC outc) - { /* void */ } - -@@ -420,86 +420,88 @@ - - /* ./lib_gen.c */ - -+#include <ncurses_cfg.h> -+ - #undef addch --int addch( -+int (addch)( - const chtype z) - { return(*(int *)0); } - - #undef addchnstr --int addchnstr( -+int (addchnstr)( - const chtype *a1, - int z) - { return(*(int *)0); } - - #undef addchstr --int addchstr( -+int (addchstr)( - const chtype *z) - { return(*(int *)0); } - - #undef addnstr --int addnstr( -+int (addnstr)( - const char *a1, - int z) - { return(*(int *)0); } - - #undef addstr --int addstr( -+int (addstr)( - const char *z) - { return(*(int *)0); } - - #undef attroff --int attroff( -- NCURSES_ATTR_T z) -+int (attroff)( -+ int z) - { return(*(int *)0); } - - #undef attron --int attron( -- NCURSES_ATTR_T z) -+int (attron)( -+ int z) - { return(*(int *)0); } - - #undef attrset --int attrset( -- NCURSES_ATTR_T z) -+int (attrset)( -+ int z) - { return(*(int *)0); } - - #undef attr_get --int attr_get( -+int (attr_get)( - attr_t *a1, - short *a2, - void *z) - { return(*(int *)0); } - - #undef attr_off --int attr_off( -+int (attr_off)( - attr_t a1, - void *z) - { return(*(int *)0); } - - #undef attr_on --int attr_on( -+int (attr_on)( - attr_t a1, - void *z) - { return(*(int *)0); } - - #undef attr_set --int attr_set( -+int (attr_set)( - attr_t a1, - short a2, - void *z) - { return(*(int *)0); } - - #undef bkgd --int bkgd( -+int (bkgd)( - chtype z) - { return(*(int *)0); } - - #undef bkgdset --void bkgdset( -+void (bkgdset)( - chtype z) - { /* void */ } - - #undef border --int border( -+int (border)( - chtype a1, - chtype a2, - chtype a3, -@@ -511,14 +513,14 @@ - { return(*(int *)0); } - - #undef box --int box( -+int (box)( - WINDOW *a1, - chtype a2, - chtype z) - { return(*(int *)0); } - - #undef chgat --int chgat( -+int (chgat)( - int a1, - attr_t a2, - short a3, -@@ -526,137 +528,137 @@ - { return(*(int *)0); } - - #undef clear --int clear(void) -+int (clear)(void) - { return(*(int *)0); } - - #undef clrtobot --int clrtobot(void) -+int (clrtobot)(void) - { return(*(int *)0); } - - #undef clrtoeol --int clrtoeol(void) -+int (clrtoeol)(void) - { return(*(int *)0); } - - #undef color_set --int color_set( -+int (color_set)( - short a1, - void *z) - { return(*(int *)0); } - - #undef COLOR_PAIR --int COLOR_PAIR( -+int (COLOR_PAIR)( - int z) - { return(*(int *)0); } - - #undef delch --int delch(void) -+int (delch)(void) - { return(*(int *)0); } - - #undef deleteln --int deleteln(void) -+int (deleteln)(void) - { return(*(int *)0); } - - #undef echochar --int echochar( -+int (echochar)( - const chtype z) - { return(*(int *)0); } - - #undef erase --int erase(void) -+int (erase)(void) - { return(*(int *)0); } - - #undef getbkgd --chtype getbkgd( -+chtype (getbkgd)( - WINDOW *z) - { return(*(chtype *)0); } - - #undef getch --int getch(void) -+int (getch)(void) - { return(*(int *)0); } - - #undef getnstr --int getnstr( -+int (getnstr)( - char *a1, - int z) - { return(*(int *)0); } - - #undef getstr --int getstr( -+int (getstr)( - char *z) - { return(*(int *)0); } - - #undef hline --int hline( -+int (hline)( - chtype a1, - int z) - { return(*(int *)0); } - - #undef inch --chtype inch(void) -+chtype (inch)(void) - { return(*(chtype *)0); } - - #undef inchnstr --int inchnstr( -+int (inchnstr)( - chtype *a1, - int z) - { return(*(int *)0); } - - #undef inchstr --int inchstr( -+int (inchstr)( - chtype *z) - { return(*(int *)0); } - - #undef innstr --int innstr( -+int (innstr)( - char *a1, - int z) - { return(*(int *)0); } - - #undef insch --int insch( -+int (insch)( - chtype z) - { return(*(int *)0); } - - #undef insdelln --int insdelln( -+int (insdelln)( - int z) - { return(*(int *)0); } - - #undef insertln --int insertln(void) -+int (insertln)(void) - { return(*(int *)0); } - - #undef insnstr --int insnstr( -+int (insnstr)( - const char *a1, - int z) - { return(*(int *)0); } - - #undef insstr --int insstr( -+int (insstr)( - const char *z) - { return(*(int *)0); } - - #undef instr --int instr( -+int (instr)( - char *z) - { return(*(int *)0); } - - #undef move --int move( -+int (move)( - int a1, - int z) - { return(*(int *)0); } - - #undef mvaddch --int mvaddch( -+int (mvaddch)( - int a1, - int a2, - const chtype z) - { return(*(int *)0); } - - #undef mvaddchnstr --int mvaddchnstr( -+int (mvaddchnstr)( - int a1, - int a2, - const chtype *a3, -@@ -664,14 +666,14 @@ - { return(*(int *)0); } - - #undef mvaddchstr --int mvaddchstr( -+int (mvaddchstr)( - int a1, - int a2, - const chtype *z) - { return(*(int *)0); } - - #undef mvaddnstr --int mvaddnstr( -+int (mvaddnstr)( - int a1, - int a2, - const char *a3, -@@ -679,14 +681,14 @@ - { return(*(int *)0); } - - #undef mvaddstr --int mvaddstr( -+int (mvaddstr)( - int a1, - int a2, - const char *z) - { return(*(int *)0); } - - #undef mvchgat --int mvchgat( -+int (mvchgat)( - int a1, - int a2, - int a3, -@@ -696,19 +698,19 @@ - { return(*(int *)0); } - - #undef mvdelch --int mvdelch( -+int (mvdelch)( - int a1, - int z) - { return(*(int *)0); } - - #undef mvgetch --int mvgetch( -+int (mvgetch)( - int a1, - int z) - { return(*(int *)0); } - - #undef mvgetnstr --int mvgetnstr( -+int (mvgetnstr)( - int a1, - int a2, - char *a3, -@@ -716,14 +718,14 @@ - { return(*(int *)0); } - - #undef mvgetstr --int mvgetstr( -+int (mvgetstr)( - int a1, - int a2, - char *z) - { return(*(int *)0); } - - #undef mvhline --int mvhline( -+int (mvhline)( - int a1, - int a2, - chtype a3, -@@ -731,13 +733,13 @@ - { return(*(int *)0); } - - #undef mvinch --chtype mvinch( -+chtype (mvinch)( - int a1, - int z) - { return(*(chtype *)0); } - - #undef mvinchnstr --int mvinchnstr( -+int (mvinchnstr)( - int a1, - int a2, - chtype *a3, -@@ -745,14 +747,14 @@ - { return(*(int *)0); } - - #undef mvinchstr --int mvinchstr( -+int (mvinchstr)( - int a1, - int a2, - chtype *z) - { return(*(int *)0); } - - #undef mvinnstr --int mvinnstr( -+int (mvinnstr)( - int a1, - int a2, - char *a3, -@@ -760,14 +762,14 @@ - { return(*(int *)0); } - - #undef mvinsch --int mvinsch( -+int (mvinsch)( - int a1, - int a2, - chtype z) - { return(*(int *)0); } - - #undef mvinsnstr --int mvinsnstr( -+int (mvinsnstr)( - int a1, - int a2, - const char *a3, -@@ -775,21 +777,21 @@ - { return(*(int *)0); } - - #undef mvinsstr --int mvinsstr( -+int (mvinsstr)( - int a1, - int a2, - const char *z) - { return(*(int *)0); } - - #undef mvinstr --int mvinstr( -+int (mvinstr)( - int a1, - int a2, - char *z) - { return(*(int *)0); } - - #undef mvvline --int mvvline( -+int (mvvline)( - int a1, - int a2, - chtype a3, -@@ -797,7 +799,7 @@ - { return(*(int *)0); } - - #undef mvwaddch --int mvwaddch( -+int (mvwaddch)( - WINDOW *a1, - int a2, - int a3, -@@ -805,7 +807,7 @@ - { return(*(int *)0); } - - #undef mvwaddchnstr --int mvwaddchnstr( -+int (mvwaddchnstr)( - WINDOW *a1, - int a2, - int a3, -@@ -814,7 +816,7 @@ - { return(*(int *)0); } - - #undef mvwaddchstr --int mvwaddchstr( -+int (mvwaddchstr)( - WINDOW *a1, - int a2, - int a3, -@@ -822,7 +824,7 @@ - { return(*(int *)0); } - - #undef mvwaddnstr --int mvwaddnstr( -+int (mvwaddnstr)( - WINDOW *a1, - int a2, - int a3, -@@ -831,7 +833,7 @@ - { return(*(int *)0); } - - #undef mvwaddstr --int mvwaddstr( -+int (mvwaddstr)( - WINDOW *a1, - int a2, - int a3, -@@ -839,7 +841,7 @@ - { return(*(int *)0); } - - #undef mvwchgat --int mvwchgat( -+int (mvwchgat)( - WINDOW *a1, - int a2, - int a3, -@@ -850,21 +852,21 @@ - { return(*(int *)0); } - - #undef mvwdelch --int mvwdelch( -+int (mvwdelch)( - WINDOW *a1, - int a2, - int z) - { return(*(int *)0); } - - #undef mvwgetch --int mvwgetch( -+int (mvwgetch)( - WINDOW *a1, - int a2, - int z) - { return(*(int *)0); } - - #undef mvwgetnstr --int mvwgetnstr( -+int (mvwgetnstr)( - WINDOW *a1, - int a2, - int a3, -@@ -873,7 +875,7 @@ - { return(*(int *)0); } - - #undef mvwgetstr --int mvwgetstr( -+int (mvwgetstr)( - WINDOW *a1, - int a2, - int a3, -@@ -881,7 +883,7 @@ - { return(*(int *)0); } - - #undef mvwhline --int mvwhline( -+int (mvwhline)( - WINDOW *a1, - int a2, - int a3, -@@ -890,14 +892,14 @@ - { return(*(int *)0); } - - #undef mvwinch --chtype mvwinch( -+chtype (mvwinch)( - WINDOW *a1, - int a2, - int z) - { return(*(chtype *)0); } - - #undef mvwinchnstr --int mvwinchnstr( -+int (mvwinchnstr)( - WINDOW *a1, - int a2, - int a3, -@@ -906,7 +908,7 @@ - { return(*(int *)0); } - - #undef mvwinchstr --int mvwinchstr( -+int (mvwinchstr)( - WINDOW *a1, - int a2, - int a3, -@@ -914,7 +916,7 @@ - { return(*(int *)0); } - - #undef mvwinnstr --int mvwinnstr( -+int (mvwinnstr)( - WINDOW *a1, - int a2, - int a3, -@@ -923,7 +925,7 @@ - { return(*(int *)0); } - - #undef mvwinsch --int mvwinsch( -+int (mvwinsch)( - WINDOW *a1, - int a2, - int a3, -@@ -931,7 +933,7 @@ - { return(*(int *)0); } - - #undef mvwinsnstr --int mvwinsnstr( -+int (mvwinsnstr)( - WINDOW *a1, - int a2, - int a3, -@@ -940,7 +942,7 @@ - { return(*(int *)0); } - - #undef mvwinsstr --int mvwinsstr( -+int (mvwinsstr)( - WINDOW *a1, - int a2, - int a3, -@@ -948,7 +950,7 @@ - { return(*(int *)0); } - - #undef mvwinstr --int mvwinstr( -+int (mvwinstr)( - WINDOW *a1, - int a2, - int a3, -@@ -956,7 +958,7 @@ - { return(*(int *)0); } - - #undef mvwvline --int mvwvline( -+int (mvwvline)( - WINDOW *a1, - int a2, - int a3, -@@ -965,117 +967,117 @@ - { return(*(int *)0); } - - #undef PAIR_NUMBER --int PAIR_NUMBER( -+int (PAIR_NUMBER)( - int z) - { return(*(int *)0); } - - #undef redrawwin --int redrawwin( -+int (redrawwin)( - WINDOW *z) - { return(*(int *)0); } - - #undef refresh --int refresh(void) -+int (refresh)(void) - { return(*(int *)0); } - - #undef scrl --int scrl( -+int (scrl)( - int z) - { return(*(int *)0); } - - #undef scroll --int scroll( -+int (scroll)( - WINDOW *z) - { return(*(int *)0); } - - #undef setscrreg --int setscrreg( -+int (setscrreg)( - int a1, - int z) - { return(*(int *)0); } - - #undef standout --int standout(void) -+int (standout)(void) - { return(*(int *)0); } - - #undef standend --int standend(void) -+int (standend)(void) - { return(*(int *)0); } - - #undef timeout --void timeout( -+void (timeout)( - int z) - { /* void */ } - - #undef touchline --int touchline( -+int (touchline)( - WINDOW *a1, - int a2, - int z) - { return(*(int *)0); } - - #undef touchwin --int touchwin( -+int (touchwin)( - WINDOW *z) - { return(*(int *)0); } - - #undef untouchwin --int untouchwin( -+int (untouchwin)( - WINDOW *z) - { return(*(int *)0); } - - #undef vline --int vline( -+int (vline)( - chtype a1, - int z) - { return(*(int *)0); } - - #undef vw_printw --int vw_printw( -+int (vw_printw)( - WINDOW *a1, - const char *a2, - va_list z) - { return(*(int *)0); } - - #undef vw_scanw --int vw_scanw( -+int (vw_scanw)( - WINDOW *a1, - char *a2, - va_list z) - { return(*(int *)0); } - - #undef waddchstr --int waddchstr( -+int (waddchstr)( - WINDOW *a1, - const chtype *z) - { return(*(int *)0); } - - #undef waddstr --int waddstr( -+int (waddstr)( - WINDOW *a1, - const char *z) - { return(*(int *)0); } - - #undef wattron --int wattron( -+int (wattron)( - WINDOW *a1, - int z) - { return(*(int *)0); } - - #undef wattroff --int wattroff( -+int (wattroff)( - WINDOW *a1, - int z) - { return(*(int *)0); } - - #undef wattrset --int wattrset( -+int (wattrset)( - WINDOW *a1, - int z) - { return(*(int *)0); } - - #undef wattr_get --int wattr_get( -+int (wattr_get)( - WINDOW *a1, - attr_t *a2, - short *a3, -@@ -1083,7 +1085,7 @@ - { return(*(int *)0); } - - #undef wattr_set --int wattr_set( -+int (wattr_set)( - WINDOW *a1, - attr_t a2, - short a3, -@@ -1091,168 +1093,168 @@ - { return(*(int *)0); } - - #undef wdeleteln --int wdeleteln( -+int (wdeleteln)( - WINDOW *z) - { return(*(int *)0); } - - #undef wgetstr --int wgetstr( -+int (wgetstr)( - WINDOW *a1, - char *z) - { return(*(int *)0); } - - #undef winchstr --int winchstr( -+int (winchstr)( - WINDOW *a1, - chtype *z) - { return(*(int *)0); } - - #undef winsertln --int winsertln( -+int (winsertln)( - WINDOW *z) - { return(*(int *)0); } - - #undef winsstr --int winsstr( -+int (winsstr)( - WINDOW *a1, - const char *z) - { return(*(int *)0); } - - #undef winstr --int winstr( -+int (winstr)( - WINDOW *a1, - char *z) - { return(*(int *)0); } - - #undef wstandout --int wstandout( -+int (wstandout)( - WINDOW *z) - { return(*(int *)0); } - - #undef wstandend --int wstandend( -+int (wstandend)( - WINDOW *z) - { return(*(int *)0); } - - #undef getattrs --int getattrs( -+int (getattrs)( - const WINDOW *z) - { return(*(int *)0); } - - #undef getcurx --int getcurx( -+int (getcurx)( - const WINDOW *z) - { return(*(int *)0); } - - #undef getcury --int getcury( -+int (getcury)( - const WINDOW *z) - { return(*(int *)0); } - - #undef getbegx --int getbegx( -+int (getbegx)( - const WINDOW *z) - { return(*(int *)0); } - - #undef getbegy --int getbegy( -+int (getbegy)( - const WINDOW *z) - { return(*(int *)0); } - - #undef getmaxx --int getmaxx( -+int (getmaxx)( - const WINDOW *z) - { return(*(int *)0); } - - #undef getmaxy --int getmaxy( -+int (getmaxy)( - const WINDOW *z) - { return(*(int *)0); } - - #undef getparx --int getparx( -+int (getparx)( - const WINDOW *z) - { return(*(int *)0); } - - #undef getpary --int getpary( -+int (getpary)( - const WINDOW *z) - { return(*(int *)0); } - - #undef wgetparent --WINDOW *wgetparent( -+WINDOW *(wgetparent)( - const WINDOW *z) - { return(*(WINDOW **)0); } - - #undef is_cleared --NCURSES_BOOL is_cleared( -+NCURSES_BOOL (is_cleared)( - const WINDOW *z) - { return(*(NCURSES_BOOL *)0); } - - #undef is_idcok --NCURSES_BOOL is_idcok( -+NCURSES_BOOL (is_idcok)( - const WINDOW *z) - { return(*(NCURSES_BOOL *)0); } - - #undef is_idlok --NCURSES_BOOL is_idlok( -+NCURSES_BOOL (is_idlok)( - const WINDOW *z) - { return(*(NCURSES_BOOL *)0); } - - #undef is_immedok --NCURSES_BOOL is_immedok( -+NCURSES_BOOL (is_immedok)( - const WINDOW *z) - { return(*(NCURSES_BOOL *)0); } - - #undef is_keypad --NCURSES_BOOL is_keypad( -+NCURSES_BOOL (is_keypad)( - const WINDOW *z) - { return(*(NCURSES_BOOL *)0); } - - #undef is_leaveok --NCURSES_BOOL is_leaveok( -+NCURSES_BOOL (is_leaveok)( - const WINDOW *z) - { return(*(NCURSES_BOOL *)0); } - - #undef is_nodelay --NCURSES_BOOL is_nodelay( -+NCURSES_BOOL (is_nodelay)( - const WINDOW *z) - { return(*(NCURSES_BOOL *)0); } - - #undef is_notimeout --NCURSES_BOOL is_notimeout( -+NCURSES_BOOL (is_notimeout)( - const WINDOW *z) - { return(*(NCURSES_BOOL *)0); } - - #undef is_pad --NCURSES_BOOL is_pad( -+NCURSES_BOOL (is_pad)( - const WINDOW *z) - { return(*(NCURSES_BOOL *)0); } - - #undef is_scrollok --NCURSES_BOOL is_scrollok( -+NCURSES_BOOL (is_scrollok)( - const WINDOW *z) - { return(*(NCURSES_BOOL *)0); } - - #undef is_subwin --NCURSES_BOOL is_subwin( -+NCURSES_BOOL (is_subwin)( - const WINDOW *z) - { return(*(NCURSES_BOOL *)0); } - - #undef is_syncok --NCURSES_BOOL is_syncok( -+NCURSES_BOOL (is_syncok)( - const WINDOW *z) - { return(*(NCURSES_BOOL *)0); } - - #undef wgetscrreg --int wgetscrreg( -+int (wgetscrreg)( - const WINDOW *a1, - int *a2, - int *z) - { return(*(int *)0); } - - #undef mouse_trafo --NCURSES_BOOL mouse_trafo( -+NCURSES_BOOL (mouse_trafo)( - int *a1, - int *a2, - NCURSES_BOOL z) -@@ -1532,6 +1534,23 @@ - void _nc_mvcur_wrap(void) - { /* void */ } - -+#undef _nc_mvcur_sp -+int _nc_mvcur_sp( -+ SCREEN *sp, -+ int yold, -+ int xold, -+ int ynew, -+ int xnew) -+ { return(*(int *)0); } -+ -+#undef _nc_mvcur -+int _nc_mvcur( -+ int yold, -+ int xold, -+ int ynew, -+ int xnew) -+ { return(*(int *)0); } -+ - #undef mvcur_sp - int mvcur_sp( - SCREEN *sp, -@@ -1598,6 +1617,8 @@ - - /* ./base/lib_newwin.c */ - -+#include "/usr/lib/gcc/x86_64-linux-gnu/4.4.5/include/stddef.h" -+ - #undef _nc_freewin - int _nc_freewin( - WINDOW *win) -@@ -1987,7 +2008,7 @@ - int slines, - int scolumns, - FILE *output, -- NCURSES_BOOL filtered, -+ int filtered, - int slk_format) - { return(*(int *)0); } - -@@ -1996,7 +2017,7 @@ - int slines, - int scolumns, - FILE *output, -- NCURSES_BOOL filtered, -+ int filtered, - int slk_format) - { return(*(int *)0); } - -@@ -2276,7 +2297,7 @@ - - #undef _nc_signal_handler - void _nc_signal_handler( -- NCURSES_BOOL enable) -+ int enable) - { /* void */ } - - /* ./base/lib_ungetch.c */ -@@ -2513,12 +2534,6 @@ - va_list ap) - { return(*(char **)0); } - --/* ./base/memmove.c */ -- --#undef _nc_memmove --void _nc_memmove(void) -- { /* void */ } -- - /* ./base/vsscanf.c */ - - #undef _nc_vsscanf -@@ -2778,7 +2793,7 @@ - #undef _nc_copy_termtype - void _nc_copy_termtype( - TERMTYPE *dst, -- TERMTYPE *src) -+ const TERMTYPE *src) - { /* void */ } - - /* ./codes.c */ -@@ -2882,6 +2897,8 @@ - - /* ./tinfo/db_iterator.c */ - -+#include <time.h> -+ - #undef _nc_tic_dir - const char *_nc_tic_dir( - const char *path) -@@ -2973,6 +2990,12 @@ - const char *name) - { return(*(int *)0); } - -+#undef _nc_setenv_num -+void _nc_setenv_num( -+ const char *name, -+ int value) -+ { /* void */ } -+ - /* ./tinfo/home_terminfo.c */ - - #undef _nc_home_terminfo -@@ -3313,7 +3336,7 @@ - #undef _nc_keypad - int _nc_keypad( - SCREEN *sp, -- NCURSES_BOOL flag) -+ int flag) - { return(*(int *)0); } - - /* ./tinfo/lib_raw.c */ -@@ -3444,11 +3467,22 @@ - NCURSES_BOOL f) - { /* void */ } - -+#undef use_tioctl_sp -+void use_tioctl_sp( -+ SCREEN *sp, -+ NCURSES_BOOL f) -+ { /* void */ } -+ - #undef use_env - void use_env( - NCURSES_BOOL f) - { /* void */ } - -+#undef use_tioctl -+void use_tioctl( -+ NCURSES_BOOL f) -+ { /* void */ } -+ - #undef _nc_get_screensize - void _nc_get_screensize( - SCREEN *sp, -@@ -3470,7 +3504,7 @@ - #undef _nc_tinfo_cmdch - void _nc_tinfo_cmdch( - TERMINAL *termp, -- char proto) -+ int proto) - { /* void */ } - - #undef _nc_get_locale -@@ -3491,7 +3525,7 @@ - char *tname, - int Filedes, - int *errret, -- NCURSES_BOOL reuse) -+ int reuse) - { return(*(int *)0); } - - #undef new_prescr -@@ -3630,7 +3664,7 @@ - int _nc_tparm_analyze( - const char *string, - char *p_is_s[9], -- int *popcount) -+ int *_nc_popcount) - { return(*(int *)0); } - - #undef tparm -@@ -3650,7 +3684,7 @@ - #undef PC - char PC; - #undef ospeed --NCURSES_OSPEED ospeed; -+short ospeed; - #undef _nc_nulls_sent - int _nc_nulls_sent; - -@@ -3690,12 +3724,28 @@ - int ch) - { return(*(int *)0); } - -+#undef _nc_putchar_sp -+int _nc_putchar_sp( -+ SCREEN *sp, -+ int ch) -+ { return(*(int *)0); } -+ -+#undef _nc_putchar -+int _nc_putchar( -+ int ch) -+ { return(*(int *)0); } -+ - #undef putp_sp - int putp_sp( - SCREEN *sp, - const char *string) - { return(*(int *)0); } - -+#undef putp -+int putp( -+ const char *string) -+ { return(*(int *)0); } -+ - #undef _nc_putp_sp - int _nc_putp_sp( - SCREEN *sp, -@@ -3703,11 +3753,6 @@ - const char *string) - { return(*(int *)0); } - --#undef putp --int putp( -- const char *string) -- { return(*(int *)0); } -- - #undef _nc_putp - int _nc_putp( - const char *name, -@@ -3772,12 +3817,12 @@ - - #undef _nc_retrace_bool - NCURSES_BOOL _nc_retrace_bool( -- NCURSES_BOOL code) -+ int code) - { return(*(NCURSES_BOOL *)0); } - - #undef _nc_retrace_char - char _nc_retrace_char( -- char code) -+ int code) - { return(*(char *)0); } - - #undef _nc_retrace_int -@@ -4033,10 +4078,30 @@ - char *const *_nc_strfnames(void) - { return(*(char **)0); } - -+/* ./tinfo/obsolete.c */ -+ -+#undef _nc_set_buffer_sp -+void _nc_set_buffer_sp( -+ SCREEN *sp, -+ FILE *ofp, -+ int buffered) -+ { /* void */ } -+ -+#undef _nc_set_buffer -+void _nc_set_buffer( -+ FILE *ofp, -+ int buffered) -+ { /* void */ } -+ - /* ./tinfo/read_entry.c */ - - #include <hashed_db.h> - -+#undef _nc_init_termtype -+void _nc_init_termtype( -+ TERMTYPE *const tp) -+ { /* void */ } -+ - #undef _nc_read_termtype - int _nc_read_termtype( - TERMTYPE *ptr, -@@ -4061,25 +4126,8 @@ - - #include <sys/types.h> - --#undef _nc_read_termcap_entry --int _nc_read_termcap_entry( -- const char *const tn, -- TERMTYPE *const tp) -- { return(*(int *)0); } -- --/* ./tinfo/setbuf.c */ -- --#undef _nc_set_buffer_sp --void _nc_set_buffer_sp( -- SCREEN *sp, -- FILE *ofp, -- NCURSES_BOOL buffered) -- { /* void */ } -- --#undef _nc_set_buffer --void _nc_set_buffer( -- FILE *ofp, -- NCURSES_BOOL buffered) -+#undef _nc_read_termcap -+void _nc_read_termcap(void) - { /* void */ } - - /* ./tinfo/strings.c */ -@@ -4305,6 +4353,8 @@ - - #undef _nc_syntax - int _nc_syntax; -+#undef _nc_strict_bsd -+int _nc_strict_bsd; - #undef _nc_curr_file_pos - long _nc_curr_file_pos; - #undef _nc_comment_start -diff -Naur ncurses-5.9/ncurses/llib-lncursestw ncurses-5.9.patch/ncurses/llib-lncursestw ---- ncurses-5.9/ncurses/llib-lncursestw 2011-01-08 20:11:35.000000000 +0100 -+++ ncurses-5.9.patch/ncurses/llib-lncursestw 2014-09-01 16:33:22.416792223 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 2009-2010,2011 Free Software Foundation, Inc. * -+ * Copyright (c) 2009-2011,2013 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -27,7 +27,7 @@ - ****************************************************************************/ - - /**************************************************************************** -- * Author: Thomas E. Dickey 2009-2010,2011 * -+ * Author: Thomas E. Dickey 2009-on * - ****************************************************************************/ - /* LINTLIBRARY */ - -@@ -369,17 +369,17 @@ - #undef _nc_do_color_sp - void _nc_do_color_sp( - SCREEN *sp, -- short old_pair, -- short pair, -- NCURSES_BOOL reverse, -+ int old_pair, -+ int pair, -+ int reverse, - NCURSES_OUTC_sp outc) - { /* void */ } - - #undef _nc_do_color - void _nc_do_color( -- short old_pair, -- short pair, -- NCURSES_BOOL reverse, -+ int old_pair, -+ int pair, -+ int reverse, - NCURSES_OUTC outc) - { /* void */ } - -@@ -457,86 +457,88 @@ - - /* ./lib_gen.c */ - -+#include <ncurses_cfg.h> -+ - #undef addch --int addch( -+int (addch)( - const chtype z) - { return(*(int *)0); } - - #undef addchnstr --int addchnstr( -+int (addchnstr)( - const chtype *a1, - int z) - { return(*(int *)0); } - - #undef addchstr --int addchstr( -+int (addchstr)( - const chtype *z) - { return(*(int *)0); } - - #undef addnstr --int addnstr( -+int (addnstr)( - const char *a1, - int z) - { return(*(int *)0); } - - #undef addstr --int addstr( -+int (addstr)( - const char *z) - { return(*(int *)0); } - - #undef attroff --int attroff( -- NCURSES_ATTR_T z) -+int (attroff)( -+ int z) - { return(*(int *)0); } - - #undef attron --int attron( -- NCURSES_ATTR_T z) -+int (attron)( -+ int z) - { return(*(int *)0); } - - #undef attrset --int attrset( -- NCURSES_ATTR_T z) -+int (attrset)( -+ int z) - { return(*(int *)0); } - - #undef attr_get --int attr_get( -+int (attr_get)( - attr_t *a1, - short *a2, - void *z) - { return(*(int *)0); } - - #undef attr_off --int attr_off( -+int (attr_off)( - attr_t a1, - void *z) - { return(*(int *)0); } - - #undef attr_on --int attr_on( -+int (attr_on)( - attr_t a1, - void *z) - { return(*(int *)0); } - - #undef attr_set --int attr_set( -+int (attr_set)( - attr_t a1, - short a2, - void *z) - { return(*(int *)0); } - - #undef bkgd --int bkgd( -+int (bkgd)( - chtype z) - { return(*(int *)0); } - - #undef bkgdset --void bkgdset( -+void (bkgdset)( - chtype z) - { /* void */ } - - #undef border --int border( -+int (border)( - chtype a1, - chtype a2, - chtype a3, -@@ -548,14 +550,14 @@ - { return(*(int *)0); } - - #undef box --int box( -+int (box)( - WINDOW *a1, - chtype a2, - chtype z) - { return(*(int *)0); } - - #undef chgat --int chgat( -+int (chgat)( - int a1, - attr_t a2, - short a3, -@@ -563,137 +565,137 @@ - { return(*(int *)0); } - - #undef clear --int clear(void) -+int (clear)(void) - { return(*(int *)0); } - - #undef clrtobot --int clrtobot(void) -+int (clrtobot)(void) - { return(*(int *)0); } - - #undef clrtoeol --int clrtoeol(void) -+int (clrtoeol)(void) - { return(*(int *)0); } - - #undef color_set --int color_set( -+int (color_set)( - short a1, - void *z) - { return(*(int *)0); } - - #undef COLOR_PAIR --int COLOR_PAIR( -+int (COLOR_PAIR)( - int z) - { return(*(int *)0); } - - #undef delch --int delch(void) -+int (delch)(void) - { return(*(int *)0); } - - #undef deleteln --int deleteln(void) -+int (deleteln)(void) - { return(*(int *)0); } - - #undef echochar --int echochar( -+int (echochar)( - const chtype z) - { return(*(int *)0); } - - #undef erase --int erase(void) -+int (erase)(void) - { return(*(int *)0); } - - #undef getbkgd --chtype getbkgd( -+chtype (getbkgd)( - WINDOW *z) - { return(*(chtype *)0); } - - #undef getch --int getch(void) -+int (getch)(void) - { return(*(int *)0); } - - #undef getnstr --int getnstr( -+int (getnstr)( - char *a1, - int z) - { return(*(int *)0); } - - #undef getstr --int getstr( -+int (getstr)( - char *z) - { return(*(int *)0); } - - #undef hline --int hline( -+int (hline)( - chtype a1, - int z) - { return(*(int *)0); } - - #undef inch --chtype inch(void) -+chtype (inch)(void) - { return(*(chtype *)0); } - - #undef inchnstr --int inchnstr( -+int (inchnstr)( - chtype *a1, - int z) - { return(*(int *)0); } - - #undef inchstr --int inchstr( -+int (inchstr)( - chtype *z) - { return(*(int *)0); } - - #undef innstr --int innstr( -+int (innstr)( - char *a1, - int z) - { return(*(int *)0); } - - #undef insch --int insch( -+int (insch)( - chtype z) - { return(*(int *)0); } - - #undef insdelln --int insdelln( -+int (insdelln)( - int z) - { return(*(int *)0); } - - #undef insertln --int insertln(void) -+int (insertln)(void) - { return(*(int *)0); } - - #undef insnstr --int insnstr( -+int (insnstr)( - const char *a1, - int z) - { return(*(int *)0); } - - #undef insstr --int insstr( -+int (insstr)( - const char *z) - { return(*(int *)0); } - - #undef instr --int instr( -+int (instr)( - char *z) - { return(*(int *)0); } - - #undef move --int move( -+int (move)( - int a1, - int z) - { return(*(int *)0); } - - #undef mvaddch --int mvaddch( -+int (mvaddch)( - int a1, - int a2, - const chtype z) - { return(*(int *)0); } - - #undef mvaddchnstr --int mvaddchnstr( -+int (mvaddchnstr)( - int a1, - int a2, - const chtype *a3, -@@ -701,14 +703,14 @@ - { return(*(int *)0); } - - #undef mvaddchstr --int mvaddchstr( -+int (mvaddchstr)( - int a1, - int a2, - const chtype *z) - { return(*(int *)0); } - - #undef mvaddnstr --int mvaddnstr( -+int (mvaddnstr)( - int a1, - int a2, - const char *a3, -@@ -716,14 +718,14 @@ - { return(*(int *)0); } - - #undef mvaddstr --int mvaddstr( -+int (mvaddstr)( - int a1, - int a2, - const char *z) - { return(*(int *)0); } - - #undef mvchgat --int mvchgat( -+int (mvchgat)( - int a1, - int a2, - int a3, -@@ -733,19 +735,19 @@ - { return(*(int *)0); } - - #undef mvdelch --int mvdelch( -+int (mvdelch)( - int a1, - int z) - { return(*(int *)0); } - - #undef mvgetch --int mvgetch( -+int (mvgetch)( - int a1, - int z) - { return(*(int *)0); } - - #undef mvgetnstr --int mvgetnstr( -+int (mvgetnstr)( - int a1, - int a2, - char *a3, -@@ -753,14 +755,14 @@ - { return(*(int *)0); } - - #undef mvgetstr --int mvgetstr( -+int (mvgetstr)( - int a1, - int a2, - char *z) - { return(*(int *)0); } - - #undef mvhline --int mvhline( -+int (mvhline)( - int a1, - int a2, - chtype a3, -@@ -768,13 +770,13 @@ - { return(*(int *)0); } - - #undef mvinch --chtype mvinch( -+chtype (mvinch)( - int a1, - int z) - { return(*(chtype *)0); } - - #undef mvinchnstr --int mvinchnstr( -+int (mvinchnstr)( - int a1, - int a2, - chtype *a3, -@@ -782,14 +784,14 @@ - { return(*(int *)0); } - - #undef mvinchstr --int mvinchstr( -+int (mvinchstr)( - int a1, - int a2, - chtype *z) - { return(*(int *)0); } - - #undef mvinnstr --int mvinnstr( -+int (mvinnstr)( - int a1, - int a2, - char *a3, -@@ -797,14 +799,14 @@ - { return(*(int *)0); } - - #undef mvinsch --int mvinsch( -+int (mvinsch)( - int a1, - int a2, - chtype z) - { return(*(int *)0); } - - #undef mvinsnstr --int mvinsnstr( -+int (mvinsnstr)( - int a1, - int a2, - const char *a3, -@@ -812,21 +814,21 @@ - { return(*(int *)0); } - - #undef mvinsstr --int mvinsstr( -+int (mvinsstr)( - int a1, - int a2, - const char *z) - { return(*(int *)0); } - - #undef mvinstr --int mvinstr( -+int (mvinstr)( - int a1, - int a2, - char *z) - { return(*(int *)0); } - - #undef mvvline --int mvvline( -+int (mvvline)( - int a1, - int a2, - chtype a3, -@@ -834,7 +836,7 @@ - { return(*(int *)0); } - - #undef mvwaddch --int mvwaddch( -+int (mvwaddch)( - WINDOW *a1, - int a2, - int a3, -@@ -842,7 +844,7 @@ - { return(*(int *)0); } - - #undef mvwaddchnstr --int mvwaddchnstr( -+int (mvwaddchnstr)( - WINDOW *a1, - int a2, - int a3, -@@ -851,7 +853,7 @@ - { return(*(int *)0); } - - #undef mvwaddchstr --int mvwaddchstr( -+int (mvwaddchstr)( - WINDOW *a1, - int a2, - int a3, -@@ -859,7 +861,7 @@ - { return(*(int *)0); } - - #undef mvwaddnstr --int mvwaddnstr( -+int (mvwaddnstr)( - WINDOW *a1, - int a2, - int a3, -@@ -868,7 +870,7 @@ - { return(*(int *)0); } - - #undef mvwaddstr --int mvwaddstr( -+int (mvwaddstr)( - WINDOW *a1, - int a2, - int a3, -@@ -876,7 +878,7 @@ - { return(*(int *)0); } - - #undef mvwchgat --int mvwchgat( -+int (mvwchgat)( - WINDOW *a1, - int a2, - int a3, -@@ -887,21 +889,21 @@ - { return(*(int *)0); } - - #undef mvwdelch --int mvwdelch( -+int (mvwdelch)( - WINDOW *a1, - int a2, - int z) - { return(*(int *)0); } - - #undef mvwgetch --int mvwgetch( -+int (mvwgetch)( - WINDOW *a1, - int a2, - int z) - { return(*(int *)0); } - - #undef mvwgetnstr --int mvwgetnstr( -+int (mvwgetnstr)( - WINDOW *a1, - int a2, - int a3, -@@ -910,7 +912,7 @@ - { return(*(int *)0); } - - #undef mvwgetstr --int mvwgetstr( -+int (mvwgetstr)( - WINDOW *a1, - int a2, - int a3, -@@ -918,7 +920,7 @@ - { return(*(int *)0); } - - #undef mvwhline --int mvwhline( -+int (mvwhline)( - WINDOW *a1, - int a2, - int a3, -@@ -927,14 +929,14 @@ - { return(*(int *)0); } - - #undef mvwinch --chtype mvwinch( -+chtype (mvwinch)( - WINDOW *a1, - int a2, - int z) - { return(*(chtype *)0); } - - #undef mvwinchnstr --int mvwinchnstr( -+int (mvwinchnstr)( - WINDOW *a1, - int a2, - int a3, -@@ -943,7 +945,7 @@ - { return(*(int *)0); } - - #undef mvwinchstr --int mvwinchstr( -+int (mvwinchstr)( - WINDOW *a1, - int a2, - int a3, -@@ -951,7 +953,7 @@ - { return(*(int *)0); } - - #undef mvwinnstr --int mvwinnstr( -+int (mvwinnstr)( - WINDOW *a1, - int a2, - int a3, -@@ -960,7 +962,7 @@ - { return(*(int *)0); } - - #undef mvwinsch --int mvwinsch( -+int (mvwinsch)( - WINDOW *a1, - int a2, - int a3, -@@ -968,7 +970,7 @@ - { return(*(int *)0); } - - #undef mvwinsnstr --int mvwinsnstr( -+int (mvwinsnstr)( - WINDOW *a1, - int a2, - int a3, -@@ -977,7 +979,7 @@ - { return(*(int *)0); } - - #undef mvwinsstr --int mvwinsstr( -+int (mvwinsstr)( - WINDOW *a1, - int a2, - int a3, -@@ -985,7 +987,7 @@ - { return(*(int *)0); } - - #undef mvwinstr --int mvwinstr( -+int (mvwinstr)( - WINDOW *a1, - int a2, - int a3, -@@ -993,7 +995,7 @@ - { return(*(int *)0); } - - #undef mvwvline --int mvwvline( -+int (mvwvline)( - WINDOW *a1, - int a2, - int a3, -@@ -1002,129 +1004,129 @@ - { return(*(int *)0); } - - #undef PAIR_NUMBER --int PAIR_NUMBER( -+int (PAIR_NUMBER)( - int z) - { return(*(int *)0); } - - #undef redrawwin --int redrawwin( -+int (redrawwin)( - WINDOW *z) - { return(*(int *)0); } - - #undef refresh --int refresh(void) -+int (refresh)(void) - { return(*(int *)0); } - - #undef scrl --int scrl( -+int (scrl)( - int z) - { return(*(int *)0); } - - #undef scroll --int scroll( -+int (scroll)( - WINDOW *z) - { return(*(int *)0); } - - #undef setscrreg --int setscrreg( -+int (setscrreg)( - int a1, - int z) - { return(*(int *)0); } - - #undef slk_attr_off --int slk_attr_off( -+int (slk_attr_off)( - const attr_t a1, - void *z) - { return(*(int *)0); } - - #undef slk_attr_on --int slk_attr_on( -+int (slk_attr_on)( - attr_t a1, - void *z) - { return(*(int *)0); } - - #undef standout --int standout(void) -+int (standout)(void) - { return(*(int *)0); } - - #undef standend --int standend(void) -+int (standend)(void) - { return(*(int *)0); } - - #undef timeout --void timeout( -+void (timeout)( - int z) - { /* void */ } - - #undef touchline --int touchline( -+int (touchline)( - WINDOW *a1, - int a2, - int z) - { return(*(int *)0); } - - #undef touchwin --int touchwin( -+int (touchwin)( - WINDOW *z) - { return(*(int *)0); } - - #undef untouchwin --int untouchwin( -+int (untouchwin)( - WINDOW *z) - { return(*(int *)0); } - - #undef vline --int vline( -+int (vline)( - chtype a1, - int z) - { return(*(int *)0); } - - #undef vw_printw --int vw_printw( -+int (vw_printw)( - WINDOW *a1, - const char *a2, - va_list z) - { return(*(int *)0); } - - #undef vw_scanw --int vw_scanw( -+int (vw_scanw)( - WINDOW *a1, - char *a2, - va_list z) - { return(*(int *)0); } - - #undef waddchstr --int waddchstr( -+int (waddchstr)( - WINDOW *a1, - const chtype *z) - { return(*(int *)0); } - - #undef waddstr --int waddstr( -+int (waddstr)( - WINDOW *a1, - const char *z) - { return(*(int *)0); } - - #undef wattron --int wattron( -+int (wattron)( - WINDOW *a1, - int z) - { return(*(int *)0); } - - #undef wattroff --int wattroff( -+int (wattroff)( - WINDOW *a1, - int z) - { return(*(int *)0); } - - #undef wattrset --int wattrset( -+int (wattrset)( - WINDOW *a1, - int z) - { return(*(int *)0); } - - #undef wattr_get --int wattr_get( -+int (wattr_get)( - WINDOW *a1, - attr_t *a2, - short *a3, -@@ -1132,7 +1134,7 @@ - { return(*(int *)0); } - - #undef wattr_set --int wattr_set( -+int (wattr_set)( - WINDOW *a1, - attr_t a2, - short a3, -@@ -1140,205 +1142,205 @@ - { return(*(int *)0); } - - #undef wdeleteln --int wdeleteln( -+int (wdeleteln)( - WINDOW *z) - { return(*(int *)0); } - - #undef wgetstr --int wgetstr( -+int (wgetstr)( - WINDOW *a1, - char *z) - { return(*(int *)0); } - - #undef winchstr --int winchstr( -+int (winchstr)( - WINDOW *a1, - chtype *z) - { return(*(int *)0); } - - #undef winsertln --int winsertln( -+int (winsertln)( - WINDOW *z) - { return(*(int *)0); } - - #undef winsstr --int winsstr( -+int (winsstr)( - WINDOW *a1, - const char *z) - { return(*(int *)0); } - - #undef winstr --int winstr( -+int (winstr)( - WINDOW *a1, - char *z) - { return(*(int *)0); } - - #undef wstandout --int wstandout( -+int (wstandout)( - WINDOW *z) - { return(*(int *)0); } - - #undef wstandend --int wstandend( -+int (wstandend)( - WINDOW *z) - { return(*(int *)0); } - - #undef getattrs --int getattrs( -+int (getattrs)( - const WINDOW *z) - { return(*(int *)0); } - - #undef getcurx --int getcurx( -+int (getcurx)( - const WINDOW *z) - { return(*(int *)0); } - - #undef getcury --int getcury( -+int (getcury)( - const WINDOW *z) - { return(*(int *)0); } - - #undef getbegx --int getbegx( -+int (getbegx)( - const WINDOW *z) - { return(*(int *)0); } - - #undef getbegy --int getbegy( -+int (getbegy)( - const WINDOW *z) - { return(*(int *)0); } - - #undef getmaxx --int getmaxx( -+int (getmaxx)( - const WINDOW *z) - { return(*(int *)0); } - - #undef getmaxy --int getmaxy( -+int (getmaxy)( - const WINDOW *z) - { return(*(int *)0); } - - #undef getparx --int getparx( -+int (getparx)( - const WINDOW *z) - { return(*(int *)0); } - - #undef getpary --int getpary( -+int (getpary)( - const WINDOW *z) - { return(*(int *)0); } - - #undef wgetparent --WINDOW *wgetparent( -+WINDOW *(wgetparent)( - const WINDOW *z) - { return(*(WINDOW **)0); } - - #undef is_cleared --NCURSES_BOOL is_cleared( -+NCURSES_BOOL (is_cleared)( - const WINDOW *z) - { return(*(NCURSES_BOOL *)0); } - - #undef is_idcok --NCURSES_BOOL is_idcok( -+NCURSES_BOOL (is_idcok)( - const WINDOW *z) - { return(*(NCURSES_BOOL *)0); } - - #undef is_idlok --NCURSES_BOOL is_idlok( -+NCURSES_BOOL (is_idlok)( - const WINDOW *z) - { return(*(NCURSES_BOOL *)0); } - - #undef is_immedok --NCURSES_BOOL is_immedok( -+NCURSES_BOOL (is_immedok)( - const WINDOW *z) - { return(*(NCURSES_BOOL *)0); } - - #undef is_keypad --NCURSES_BOOL is_keypad( -+NCURSES_BOOL (is_keypad)( - const WINDOW *z) - { return(*(NCURSES_BOOL *)0); } - - #undef is_leaveok --NCURSES_BOOL is_leaveok( -+NCURSES_BOOL (is_leaveok)( - const WINDOW *z) - { return(*(NCURSES_BOOL *)0); } - - #undef is_nodelay --NCURSES_BOOL is_nodelay( -+NCURSES_BOOL (is_nodelay)( - const WINDOW *z) - { return(*(NCURSES_BOOL *)0); } - - #undef is_notimeout --NCURSES_BOOL is_notimeout( -+NCURSES_BOOL (is_notimeout)( - const WINDOW *z) - { return(*(NCURSES_BOOL *)0); } - - #undef is_pad --NCURSES_BOOL is_pad( -+NCURSES_BOOL (is_pad)( - const WINDOW *z) - { return(*(NCURSES_BOOL *)0); } - - #undef is_scrollok --NCURSES_BOOL is_scrollok( -+NCURSES_BOOL (is_scrollok)( - const WINDOW *z) - { return(*(NCURSES_BOOL *)0); } - - #undef is_subwin --NCURSES_BOOL is_subwin( -+NCURSES_BOOL (is_subwin)( - const WINDOW *z) - { return(*(NCURSES_BOOL *)0); } - - #undef is_syncok --NCURSES_BOOL is_syncok( -+NCURSES_BOOL (is_syncok)( - const WINDOW *z) - { return(*(NCURSES_BOOL *)0); } - - #undef wgetscrreg --int wgetscrreg( -+int (wgetscrreg)( - const WINDOW *a1, - int *a2, - int *z) - { return(*(int *)0); } - - #undef add_wch --int add_wch( -+int (add_wch)( - const cchar_t *z) - { return(*(int *)0); } - - #undef add_wchnstr --int add_wchnstr( -+int (add_wchnstr)( - const cchar_t *a1, - int z) - { return(*(int *)0); } - - #undef add_wchstr --int add_wchstr( -+int (add_wchstr)( - const cchar_t *z) - { return(*(int *)0); } - - #undef addnwstr --int addnwstr( -+int (addnwstr)( - const wchar_t *a1, - int z) - { return(*(int *)0); } - - #undef addwstr --int addwstr( -+int (addwstr)( - const wchar_t *z) - { return(*(int *)0); } - - #undef bkgrnd --int bkgrnd( -+int (bkgrnd)( - const cchar_t *z) - { return(*(int *)0); } - - #undef bkgrndset --void bkgrndset( -+void (bkgrndset)( - const cchar_t *z) - { /* void */ } - - #undef border_set --int border_set( -+int (border_set)( - const cchar_t *a1, - const cchar_t *a2, - const cchar_t *a3, -@@ -1350,96 +1352,96 @@ - { return(*(int *)0); } - - #undef box_set --int box_set( -+int (box_set)( - WINDOW *a1, - const cchar_t *a2, - const cchar_t *z) - { return(*(int *)0); } - - #undef echo_wchar --int echo_wchar( -+int (echo_wchar)( - const cchar_t *z) - { return(*(int *)0); } - - #undef get_wch --int get_wch( -+int (get_wch)( - wint_t *z) - { return(*(int *)0); } - - #undef get_wstr --int get_wstr( -+int (get_wstr)( - wint_t *z) - { return(*(int *)0); } - - #undef getbkgrnd --int getbkgrnd( -+int (getbkgrnd)( - cchar_t *z) - { return(*(int *)0); } - - #undef getn_wstr --int getn_wstr( -+int (getn_wstr)( - wint_t *a1, - int z) - { return(*(int *)0); } - - #undef hline_set --int hline_set( -+int (hline_set)( - const cchar_t *a1, - int z) - { return(*(int *)0); } - - #undef in_wch --int in_wch( -+int (in_wch)( - cchar_t *z) - { return(*(int *)0); } - - #undef in_wchnstr --int in_wchnstr( -+int (in_wchnstr)( - cchar_t *a1, - int z) - { return(*(int *)0); } - - #undef in_wchstr --int in_wchstr( -+int (in_wchstr)( - cchar_t *z) - { return(*(int *)0); } - - #undef innwstr --int innwstr( -+int (innwstr)( - wchar_t *a1, - int z) - { return(*(int *)0); } - - #undef ins_nwstr --int ins_nwstr( -+int (ins_nwstr)( - const wchar_t *a1, - int z) - { return(*(int *)0); } - - #undef ins_wch --int ins_wch( -+int (ins_wch)( - const cchar_t *z) - { return(*(int *)0); } - - #undef ins_wstr --int ins_wstr( -+int (ins_wstr)( - const wchar_t *z) - { return(*(int *)0); } - - #undef inwstr --int inwstr( -+int (inwstr)( - wchar_t *z) - { return(*(int *)0); } - - #undef mvadd_wch --int mvadd_wch( -+int (mvadd_wch)( - int a1, - int a2, - const cchar_t *z) - { return(*(int *)0); } - - #undef mvadd_wchnstr --int mvadd_wchnstr( -+int (mvadd_wchnstr)( - int a1, - int a2, - const cchar_t *a3, -@@ -1447,14 +1449,14 @@ - { return(*(int *)0); } - - #undef mvadd_wchstr --int mvadd_wchstr( -+int (mvadd_wchstr)( - int a1, - int a2, - const cchar_t *z) - { return(*(int *)0); } - - #undef mvaddnwstr --int mvaddnwstr( -+int (mvaddnwstr)( - int a1, - int a2, - const wchar_t *a3, -@@ -1462,28 +1464,28 @@ - { return(*(int *)0); } - - #undef mvaddwstr --int mvaddwstr( -+int (mvaddwstr)( - int a1, - int a2, - const wchar_t *z) - { return(*(int *)0); } - - #undef mvget_wch --int mvget_wch( -+int (mvget_wch)( - int a1, - int a2, - wint_t *z) - { return(*(int *)0); } - - #undef mvget_wstr --int mvget_wstr( -+int (mvget_wstr)( - int a1, - int a2, - wint_t *z) - { return(*(int *)0); } - - #undef mvgetn_wstr --int mvgetn_wstr( -+int (mvgetn_wstr)( - int a1, - int a2, - wint_t *a3, -@@ -1491,7 +1493,7 @@ - { return(*(int *)0); } - - #undef mvhline_set --int mvhline_set( -+int (mvhline_set)( - int a1, - int a2, - const cchar_t *a3, -@@ -1499,14 +1501,14 @@ - { return(*(int *)0); } - - #undef mvin_wch --int mvin_wch( -+int (mvin_wch)( - int a1, - int a2, - cchar_t *z) - { return(*(int *)0); } - - #undef mvin_wchnstr --int mvin_wchnstr( -+int (mvin_wchnstr)( - int a1, - int a2, - cchar_t *a3, -@@ -1514,14 +1516,14 @@ - { return(*(int *)0); } - - #undef mvin_wchstr --int mvin_wchstr( -+int (mvin_wchstr)( - int a1, - int a2, - cchar_t *z) - { return(*(int *)0); } - - #undef mvinnwstr --int mvinnwstr( -+int (mvinnwstr)( - int a1, - int a2, - wchar_t *a3, -@@ -1529,7 +1531,7 @@ - { return(*(int *)0); } - - #undef mvins_nwstr --int mvins_nwstr( -+int (mvins_nwstr)( - int a1, - int a2, - const wchar_t *a3, -@@ -1537,28 +1539,28 @@ - { return(*(int *)0); } - - #undef mvins_wch --int mvins_wch( -+int (mvins_wch)( - int a1, - int a2, - const cchar_t *z) - { return(*(int *)0); } - - #undef mvins_wstr --int mvins_wstr( -+int (mvins_wstr)( - int a1, - int a2, - const wchar_t *z) - { return(*(int *)0); } - - #undef mvinwstr --int mvinwstr( -+int (mvinwstr)( - int a1, - int a2, - wchar_t *z) - { return(*(int *)0); } - - #undef mvvline_set --int mvvline_set( -+int (mvvline_set)( - int a1, - int a2, - const cchar_t *a3, -@@ -1566,7 +1568,7 @@ - { return(*(int *)0); } - - #undef mvwadd_wch --int mvwadd_wch( -+int (mvwadd_wch)( - WINDOW *a1, - int a2, - int a3, -@@ -1574,7 +1576,7 @@ - { return(*(int *)0); } - - #undef mvwadd_wchnstr --int mvwadd_wchnstr( -+int (mvwadd_wchnstr)( - WINDOW *a1, - int a2, - int a3, -@@ -1583,7 +1585,7 @@ - { return(*(int *)0); } - - #undef mvwadd_wchstr --int mvwadd_wchstr( -+int (mvwadd_wchstr)( - WINDOW *a1, - int a2, - int a3, -@@ -1591,7 +1593,7 @@ - { return(*(int *)0); } - - #undef mvwaddnwstr --int mvwaddnwstr( -+int (mvwaddnwstr)( - WINDOW *a1, - int a2, - int a3, -@@ -1600,7 +1602,7 @@ - { return(*(int *)0); } - - #undef mvwaddwstr --int mvwaddwstr( -+int (mvwaddwstr)( - WINDOW *a1, - int a2, - int a3, -@@ -1608,7 +1610,7 @@ - { return(*(int *)0); } - - #undef mvwget_wch --int mvwget_wch( -+int (mvwget_wch)( - WINDOW *a1, - int a2, - int a3, -@@ -1616,7 +1618,7 @@ - { return(*(int *)0); } - - #undef mvwget_wstr --int mvwget_wstr( -+int (mvwget_wstr)( - WINDOW *a1, - int a2, - int a3, -@@ -1624,7 +1626,7 @@ - { return(*(int *)0); } - - #undef mvwgetn_wstr --int mvwgetn_wstr( -+int (mvwgetn_wstr)( - WINDOW *a1, - int a2, - int a3, -@@ -1633,7 +1635,7 @@ - { return(*(int *)0); } - - #undef mvwhline_set --int mvwhline_set( -+int (mvwhline_set)( - WINDOW *a1, - int a2, - int a3, -@@ -1642,7 +1644,7 @@ - { return(*(int *)0); } - - #undef mvwin_wch --int mvwin_wch( -+int (mvwin_wch)( - WINDOW *a1, - int a2, - int a3, -@@ -1650,7 +1652,7 @@ - { return(*(int *)0); } - - #undef mvwin_wchnstr --int mvwin_wchnstr( -+int (mvwin_wchnstr)( - WINDOW *a1, - int a2, - int a3, -@@ -1659,7 +1661,7 @@ - { return(*(int *)0); } - - #undef mvwin_wchstr --int mvwin_wchstr( -+int (mvwin_wchstr)( - WINDOW *a1, - int a2, - int a3, -@@ -1667,7 +1669,7 @@ - { return(*(int *)0); } - - #undef mvwinnwstr --int mvwinnwstr( -+int (mvwinnwstr)( - WINDOW *a1, - int a2, - int a3, -@@ -1676,7 +1678,7 @@ - { return(*(int *)0); } - - #undef mvwins_nwstr --int mvwins_nwstr( -+int (mvwins_nwstr)( - WINDOW *a1, - int a2, - int a3, -@@ -1685,7 +1687,7 @@ - { return(*(int *)0); } - - #undef mvwins_wch --int mvwins_wch( -+int (mvwins_wch)( - WINDOW *a1, - int a2, - int a3, -@@ -1693,7 +1695,7 @@ - { return(*(int *)0); } - - #undef mvwins_wstr --int mvwins_wstr( -+int (mvwins_wstr)( - WINDOW *a1, - int a2, - int a3, -@@ -1701,7 +1703,7 @@ - { return(*(int *)0); } - - #undef mvwinwstr --int mvwinwstr( -+int (mvwinwstr)( - WINDOW *a1, - int a2, - int a3, -@@ -1709,7 +1711,7 @@ - { return(*(int *)0); } - - #undef mvwvline_set --int mvwvline_set( -+int (mvwvline_set)( - WINDOW *a1, - int a2, - int a3, -@@ -1718,49 +1720,49 @@ - { return(*(int *)0); } - - #undef vline_set --int vline_set( -+int (vline_set)( - const cchar_t *a1, - int z) - { return(*(int *)0); } - - #undef wadd_wchstr --int wadd_wchstr( -+int (wadd_wchstr)( - WINDOW *a1, - const cchar_t *z) - { return(*(int *)0); } - - #undef waddwstr --int waddwstr( -+int (waddwstr)( - WINDOW *a1, - const wchar_t *z) - { return(*(int *)0); } - - #undef wget_wstr --int wget_wstr( -+int (wget_wstr)( - WINDOW *a1, - wint_t *z) - { return(*(int *)0); } - - #undef wgetbkgrnd --int wgetbkgrnd( -+int (wgetbkgrnd)( - WINDOW *a1, - cchar_t *z) - { return(*(int *)0); } - - #undef win_wchstr --int win_wchstr( -+int (win_wchstr)( - WINDOW *a1, - cchar_t *z) - { return(*(int *)0); } - - #undef wins_wstr --int wins_wstr( -+int (wins_wstr)( - WINDOW *a1, - const wchar_t *z) - { return(*(int *)0); } - - #undef mouse_trafo --NCURSES_BOOL mouse_trafo( -+NCURSES_BOOL (mouse_trafo)( - int *a1, - int *a2, - NCURSES_BOOL z) -@@ -2040,6 +2042,23 @@ - void _nc_mvcur_wrap(void) - { /* void */ } - -+#undef _nc_mvcur_sp -+int _nc_mvcur_sp( -+ SCREEN *sp, -+ int yold, -+ int xold, -+ int ynew, -+ int xnew) -+ { return(*(int *)0); } -+ -+#undef _nc_mvcur -+int _nc_mvcur( -+ int yold, -+ int xold, -+ int ynew, -+ int xnew) -+ { return(*(int *)0); } -+ - #undef mvcur_sp - int mvcur_sp( - SCREEN *sp, -@@ -2106,6 +2125,8 @@ - - /* ./base/lib_newwin.c */ - -+#include "/usr/lib/gcc/x86_64-linux-gnu/4.4.5/include/stddef.h" -+ - #undef _nc_freewin - int _nc_freewin( - WINDOW *win) -@@ -2495,7 +2516,7 @@ - int slines, - int scolumns, - FILE *output, -- NCURSES_BOOL filtered, -+ int filtered, - int slk_format) - { return(*(int *)0); } - -@@ -2504,7 +2525,7 @@ - int slines, - int scolumns, - FILE *output, -- NCURSES_BOOL filtered, -+ int filtered, - int slk_format) - { return(*(int *)0); } - -@@ -2786,7 +2807,7 @@ - - #undef _nc_signal_handler - void _nc_signal_handler( -- NCURSES_BOOL enable) -+ int enable) - { /* void */ } - - /* ./base/lib_ungetch.c */ -@@ -3023,12 +3044,6 @@ - va_list ap) - { return(*(char **)0); } - --/* ./base/memmove.c */ -- --#undef _nc_memmove --void _nc_memmove(void) -- { /* void */ } -- - /* ./base/vsscanf.c */ - - #undef _nc_vsscanf -@@ -3563,7 +3578,7 @@ - #undef _nc_copy_termtype - void _nc_copy_termtype( - TERMTYPE *dst, -- TERMTYPE *src) -+ const TERMTYPE *src) - { /* void */ } - - /* ./codes.c */ -@@ -3667,6 +3682,8 @@ - - /* ./tinfo/db_iterator.c */ - -+#include <time.h> -+ - #undef _nc_tic_dir - const char *_nc_tic_dir( - const char *path) -@@ -3758,6 +3775,12 @@ - const char *name) - { return(*(int *)0); } - -+#undef _nc_setenv_num -+void _nc_setenv_num( -+ const char *name, -+ int value) -+ { /* void */ } -+ - /* ./tinfo/home_terminfo.c */ - - #undef _nc_home_terminfo -@@ -4098,7 +4121,7 @@ - #undef _nc_keypad - int _nc_keypad( - SCREEN *sp, -- NCURSES_BOOL flag) -+ int flag) - { return(*(int *)0); } - - /* ./tinfo/lib_raw.c */ -@@ -4229,11 +4252,22 @@ - NCURSES_BOOL f) - { /* void */ } - -+#undef use_tioctl_sp -+void use_tioctl_sp( -+ SCREEN *sp, -+ NCURSES_BOOL f) -+ { /* void */ } -+ - #undef use_env - void use_env( - NCURSES_BOOL f) - { /* void */ } - -+#undef use_tioctl -+void use_tioctl( -+ NCURSES_BOOL f) -+ { /* void */ } -+ - #undef _nc_get_screensize - void _nc_get_screensize( - SCREEN *sp, -@@ -4255,7 +4289,7 @@ - #undef _nc_tinfo_cmdch - void _nc_tinfo_cmdch( - TERMINAL *termp, -- char proto) -+ int proto) - { /* void */ } - - #undef _nc_get_locale -@@ -4276,7 +4310,7 @@ - char *tname, - int Filedes, - int *errret, -- NCURSES_BOOL reuse) -+ int reuse) - { return(*(int *)0); } - - #undef new_prescr -@@ -4415,7 +4449,7 @@ - int _nc_tparm_analyze( - const char *string, - char *p_is_s[9], -- int *popcount) -+ int *_nc_popcount) - { return(*(int *)0); } - - #undef tparm -@@ -4435,7 +4469,7 @@ - #undef PC - char PC; - #undef ospeed --NCURSES_OSPEED ospeed; -+short ospeed; - #undef _nc_nulls_sent - int _nc_nulls_sent; - -@@ -4475,12 +4509,28 @@ - int ch) - { return(*(int *)0); } - -+#undef _nc_putchar_sp -+int _nc_putchar_sp( -+ SCREEN *sp, -+ int ch) -+ { return(*(int *)0); } -+ -+#undef _nc_putchar -+int _nc_putchar( -+ int ch) -+ { return(*(int *)0); } -+ - #undef putp_sp - int putp_sp( - SCREEN *sp, - const char *string) - { return(*(int *)0); } - -+#undef putp -+int putp( -+ const char *string) -+ { return(*(int *)0); } -+ - #undef _nc_putp_sp - int _nc_putp_sp( - SCREEN *sp, -@@ -4488,11 +4538,6 @@ - const char *string) - { return(*(int *)0); } - --#undef putp --int putp( -- const char *string) -- { return(*(int *)0); } -- - #undef _nc_putp - int _nc_putp( - const char *name, -@@ -4557,12 +4602,12 @@ - - #undef _nc_retrace_bool - NCURSES_BOOL _nc_retrace_bool( -- NCURSES_BOOL code) -+ int code) - { return(*(NCURSES_BOOL *)0); } - - #undef _nc_retrace_char - char _nc_retrace_char( -- char code) -+ int code) - { return(*(char *)0); } - - #undef _nc_retrace_int -@@ -4829,10 +4874,30 @@ - char *const *_nc_strfnames(void) - { return(*(char **)0); } - -+/* ./tinfo/obsolete.c */ -+ -+#undef _nc_set_buffer_sp -+void _nc_set_buffer_sp( -+ SCREEN *sp, -+ FILE *ofp, -+ int buffered) -+ { /* void */ } -+ -+#undef _nc_set_buffer -+void _nc_set_buffer( -+ FILE *ofp, -+ int buffered) -+ { /* void */ } -+ - /* ./tinfo/read_entry.c */ - - #include <hashed_db.h> - -+#undef _nc_init_termtype -+void _nc_init_termtype( -+ TERMTYPE *const tp) -+ { /* void */ } -+ - #undef _nc_read_termtype - int _nc_read_termtype( - TERMTYPE *ptr, -@@ -4857,25 +4922,8 @@ - - #include <sys/types.h> - --#undef _nc_read_termcap_entry --int _nc_read_termcap_entry( -- const char *const tn, -- TERMTYPE *const tp) -- { return(*(int *)0); } -- --/* ./tinfo/setbuf.c */ -- --#undef _nc_set_buffer_sp --void _nc_set_buffer_sp( -- SCREEN *sp, -- FILE *ofp, -- NCURSES_BOOL buffered) -- { /* void */ } -- --#undef _nc_set_buffer --void _nc_set_buffer( -- FILE *ofp, -- NCURSES_BOOL buffered) -+#undef _nc_read_termcap -+void _nc_read_termcap(void) - { /* void */ } - - /* ./tinfo/strings.c */ -@@ -5123,6 +5171,8 @@ - - #undef _nc_syntax - int _nc_syntax; -+#undef _nc_strict_bsd -+int _nc_strict_bsd; - #undef _nc_curr_file_pos - long _nc_curr_file_pos; - #undef _nc_comment_start -diff -Naur ncurses-5.9/ncurses/llib-lncursesw ncurses-5.9.patch/ncurses/llib-lncursesw ---- ncurses-5.9/ncurses/llib-lncursesw 2011-01-08 20:01:11.000000000 +0100 -+++ ncurses-5.9.patch/ncurses/llib-lncursesw 2014-09-01 16:33:22.417792224 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 2001-2010,2011 Free Software Foundation, Inc. * -+ * Copyright (c) 2001-2011,2013 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -27,7 +27,7 @@ - ****************************************************************************/ - - /**************************************************************************** -- * Author: Thomas E. Dickey 2001-2010,2011 * -+ * Author: Thomas E. Dickey 2001-on * - ****************************************************************************/ - /* LINTLIBRARY */ - -@@ -366,17 +366,17 @@ - #undef _nc_do_color_sp - void _nc_do_color_sp( - SCREEN *sp, -- short old_pair, -- short pair, -- NCURSES_BOOL reverse, -+ int old_pair, -+ int pair, -+ int reverse, - NCURSES_OUTC_sp outc) - { /* void */ } - - #undef _nc_do_color - void _nc_do_color( -- short old_pair, -- short pair, -- NCURSES_BOOL reverse, -+ int old_pair, -+ int pair, -+ int reverse, - NCURSES_OUTC outc) - { /* void */ } - -@@ -454,86 +454,88 @@ - - /* ./lib_gen.c */ - -+#include <ncurses_cfg.h> -+ - #undef addch --int addch( -+int (addch)( - const chtype z) - { return(*(int *)0); } - - #undef addchnstr --int addchnstr( -+int (addchnstr)( - const chtype *a1, - int z) - { return(*(int *)0); } - - #undef addchstr --int addchstr( -+int (addchstr)( - const chtype *z) - { return(*(int *)0); } - - #undef addnstr --int addnstr( -+int (addnstr)( - const char *a1, - int z) - { return(*(int *)0); } - - #undef addstr --int addstr( -+int (addstr)( - const char *z) - { return(*(int *)0); } - - #undef attroff --int attroff( -- NCURSES_ATTR_T z) -+int (attroff)( -+ int z) - { return(*(int *)0); } - - #undef attron --int attron( -- NCURSES_ATTR_T z) -+int (attron)( -+ int z) - { return(*(int *)0); } - - #undef attrset --int attrset( -- NCURSES_ATTR_T z) -+int (attrset)( -+ int z) - { return(*(int *)0); } - - #undef attr_get --int attr_get( -+int (attr_get)( - attr_t *a1, - short *a2, - void *z) - { return(*(int *)0); } - - #undef attr_off --int attr_off( -+int (attr_off)( - attr_t a1, - void *z) - { return(*(int *)0); } - - #undef attr_on --int attr_on( -+int (attr_on)( - attr_t a1, - void *z) - { return(*(int *)0); } - - #undef attr_set --int attr_set( -+int (attr_set)( - attr_t a1, - short a2, - void *z) - { return(*(int *)0); } - - #undef bkgd --int bkgd( -+int (bkgd)( - chtype z) - { return(*(int *)0); } - - #undef bkgdset --void bkgdset( -+void (bkgdset)( - chtype z) - { /* void */ } - - #undef border --int border( -+int (border)( - chtype a1, - chtype a2, - chtype a3, -@@ -545,14 +547,14 @@ - { return(*(int *)0); } - - #undef box --int box( -+int (box)( - WINDOW *a1, - chtype a2, - chtype z) - { return(*(int *)0); } - - #undef chgat --int chgat( -+int (chgat)( - int a1, - attr_t a2, - short a3, -@@ -560,137 +562,137 @@ - { return(*(int *)0); } - - #undef clear --int clear(void) -+int (clear)(void) - { return(*(int *)0); } - - #undef clrtobot --int clrtobot(void) -+int (clrtobot)(void) - { return(*(int *)0); } - - #undef clrtoeol --int clrtoeol(void) -+int (clrtoeol)(void) - { return(*(int *)0); } - - #undef color_set --int color_set( -+int (color_set)( - short a1, - void *z) - { return(*(int *)0); } - - #undef COLOR_PAIR --int COLOR_PAIR( -+int (COLOR_PAIR)( - int z) - { return(*(int *)0); } - - #undef delch --int delch(void) -+int (delch)(void) - { return(*(int *)0); } - - #undef deleteln --int deleteln(void) -+int (deleteln)(void) - { return(*(int *)0); } - - #undef echochar --int echochar( -+int (echochar)( - const chtype z) - { return(*(int *)0); } - - #undef erase --int erase(void) -+int (erase)(void) - { return(*(int *)0); } - - #undef getbkgd --chtype getbkgd( -+chtype (getbkgd)( - WINDOW *z) - { return(*(chtype *)0); } - - #undef getch --int getch(void) -+int (getch)(void) - { return(*(int *)0); } - - #undef getnstr --int getnstr( -+int (getnstr)( - char *a1, - int z) - { return(*(int *)0); } - - #undef getstr --int getstr( -+int (getstr)( - char *z) - { return(*(int *)0); } - - #undef hline --int hline( -+int (hline)( - chtype a1, - int z) - { return(*(int *)0); } - - #undef inch --chtype inch(void) -+chtype (inch)(void) - { return(*(chtype *)0); } - - #undef inchnstr --int inchnstr( -+int (inchnstr)( - chtype *a1, - int z) - { return(*(int *)0); } - - #undef inchstr --int inchstr( -+int (inchstr)( - chtype *z) - { return(*(int *)0); } - - #undef innstr --int innstr( -+int (innstr)( - char *a1, - int z) - { return(*(int *)0); } - - #undef insch --int insch( -+int (insch)( - chtype z) - { return(*(int *)0); } - - #undef insdelln --int insdelln( -+int (insdelln)( - int z) - { return(*(int *)0); } - - #undef insertln --int insertln(void) -+int (insertln)(void) - { return(*(int *)0); } - - #undef insnstr --int insnstr( -+int (insnstr)( - const char *a1, - int z) - { return(*(int *)0); } - - #undef insstr --int insstr( -+int (insstr)( - const char *z) - { return(*(int *)0); } - - #undef instr --int instr( -+int (instr)( - char *z) - { return(*(int *)0); } - - #undef move --int move( -+int (move)( - int a1, - int z) - { return(*(int *)0); } - - #undef mvaddch --int mvaddch( -+int (mvaddch)( - int a1, - int a2, - const chtype z) - { return(*(int *)0); } - - #undef mvaddchnstr --int mvaddchnstr( -+int (mvaddchnstr)( - int a1, - int a2, - const chtype *a3, -@@ -698,14 +700,14 @@ - { return(*(int *)0); } - - #undef mvaddchstr --int mvaddchstr( -+int (mvaddchstr)( - int a1, - int a2, - const chtype *z) - { return(*(int *)0); } - - #undef mvaddnstr --int mvaddnstr( -+int (mvaddnstr)( - int a1, - int a2, - const char *a3, -@@ -713,14 +715,14 @@ - { return(*(int *)0); } - - #undef mvaddstr --int mvaddstr( -+int (mvaddstr)( - int a1, - int a2, - const char *z) - { return(*(int *)0); } - - #undef mvchgat --int mvchgat( -+int (mvchgat)( - int a1, - int a2, - int a3, -@@ -730,19 +732,19 @@ - { return(*(int *)0); } - - #undef mvdelch --int mvdelch( -+int (mvdelch)( - int a1, - int z) - { return(*(int *)0); } - - #undef mvgetch --int mvgetch( -+int (mvgetch)( - int a1, - int z) - { return(*(int *)0); } - - #undef mvgetnstr --int mvgetnstr( -+int (mvgetnstr)( - int a1, - int a2, - char *a3, -@@ -750,14 +752,14 @@ - { return(*(int *)0); } - - #undef mvgetstr --int mvgetstr( -+int (mvgetstr)( - int a1, - int a2, - char *z) - { return(*(int *)0); } - - #undef mvhline --int mvhline( -+int (mvhline)( - int a1, - int a2, - chtype a3, -@@ -765,13 +767,13 @@ - { return(*(int *)0); } - - #undef mvinch --chtype mvinch( -+chtype (mvinch)( - int a1, - int z) - { return(*(chtype *)0); } - - #undef mvinchnstr --int mvinchnstr( -+int (mvinchnstr)( - int a1, - int a2, - chtype *a3, -@@ -779,14 +781,14 @@ - { return(*(int *)0); } - - #undef mvinchstr --int mvinchstr( -+int (mvinchstr)( - int a1, - int a2, - chtype *z) - { return(*(int *)0); } - - #undef mvinnstr --int mvinnstr( -+int (mvinnstr)( - int a1, - int a2, - char *a3, -@@ -794,14 +796,14 @@ - { return(*(int *)0); } - - #undef mvinsch --int mvinsch( -+int (mvinsch)( - int a1, - int a2, - chtype z) - { return(*(int *)0); } - - #undef mvinsnstr --int mvinsnstr( -+int (mvinsnstr)( - int a1, - int a2, - const char *a3, -@@ -809,21 +811,21 @@ - { return(*(int *)0); } - - #undef mvinsstr --int mvinsstr( -+int (mvinsstr)( - int a1, - int a2, - const char *z) - { return(*(int *)0); } - - #undef mvinstr --int mvinstr( -+int (mvinstr)( - int a1, - int a2, - char *z) - { return(*(int *)0); } - - #undef mvvline --int mvvline( -+int (mvvline)( - int a1, - int a2, - chtype a3, -@@ -831,7 +833,7 @@ - { return(*(int *)0); } - - #undef mvwaddch --int mvwaddch( -+int (mvwaddch)( - WINDOW *a1, - int a2, - int a3, -@@ -839,7 +841,7 @@ - { return(*(int *)0); } - - #undef mvwaddchnstr --int mvwaddchnstr( -+int (mvwaddchnstr)( - WINDOW *a1, - int a2, - int a3, -@@ -848,7 +850,7 @@ - { return(*(int *)0); } - - #undef mvwaddchstr --int mvwaddchstr( -+int (mvwaddchstr)( - WINDOW *a1, - int a2, - int a3, -@@ -856,7 +858,7 @@ - { return(*(int *)0); } - - #undef mvwaddnstr --int mvwaddnstr( -+int (mvwaddnstr)( - WINDOW *a1, - int a2, - int a3, -@@ -865,7 +867,7 @@ - { return(*(int *)0); } - - #undef mvwaddstr --int mvwaddstr( -+int (mvwaddstr)( - WINDOW *a1, - int a2, - int a3, -@@ -873,7 +875,7 @@ - { return(*(int *)0); } - - #undef mvwchgat --int mvwchgat( -+int (mvwchgat)( - WINDOW *a1, - int a2, - int a3, -@@ -884,21 +886,21 @@ - { return(*(int *)0); } - - #undef mvwdelch --int mvwdelch( -+int (mvwdelch)( - WINDOW *a1, - int a2, - int z) - { return(*(int *)0); } - - #undef mvwgetch --int mvwgetch( -+int (mvwgetch)( - WINDOW *a1, - int a2, - int z) - { return(*(int *)0); } - - #undef mvwgetnstr --int mvwgetnstr( -+int (mvwgetnstr)( - WINDOW *a1, - int a2, - int a3, -@@ -907,7 +909,7 @@ - { return(*(int *)0); } - - #undef mvwgetstr --int mvwgetstr( -+int (mvwgetstr)( - WINDOW *a1, - int a2, - int a3, -@@ -915,7 +917,7 @@ - { return(*(int *)0); } - - #undef mvwhline --int mvwhline( -+int (mvwhline)( - WINDOW *a1, - int a2, - int a3, -@@ -924,14 +926,14 @@ - { return(*(int *)0); } - - #undef mvwinch --chtype mvwinch( -+chtype (mvwinch)( - WINDOW *a1, - int a2, - int z) - { return(*(chtype *)0); } - - #undef mvwinchnstr --int mvwinchnstr( -+int (mvwinchnstr)( - WINDOW *a1, - int a2, - int a3, -@@ -940,7 +942,7 @@ - { return(*(int *)0); } - - #undef mvwinchstr --int mvwinchstr( -+int (mvwinchstr)( - WINDOW *a1, - int a2, - int a3, -@@ -948,7 +950,7 @@ - { return(*(int *)0); } - - #undef mvwinnstr --int mvwinnstr( -+int (mvwinnstr)( - WINDOW *a1, - int a2, - int a3, -@@ -957,7 +959,7 @@ - { return(*(int *)0); } - - #undef mvwinsch --int mvwinsch( -+int (mvwinsch)( - WINDOW *a1, - int a2, - int a3, -@@ -965,7 +967,7 @@ - { return(*(int *)0); } - - #undef mvwinsnstr --int mvwinsnstr( -+int (mvwinsnstr)( - WINDOW *a1, - int a2, - int a3, -@@ -974,7 +976,7 @@ - { return(*(int *)0); } - - #undef mvwinsstr --int mvwinsstr( -+int (mvwinsstr)( - WINDOW *a1, - int a2, - int a3, -@@ -982,7 +984,7 @@ - { return(*(int *)0); } - - #undef mvwinstr --int mvwinstr( -+int (mvwinstr)( - WINDOW *a1, - int a2, - int a3, -@@ -990,7 +992,7 @@ - { return(*(int *)0); } - - #undef mvwvline --int mvwvline( -+int (mvwvline)( - WINDOW *a1, - int a2, - int a3, -@@ -999,129 +1001,129 @@ - { return(*(int *)0); } - - #undef PAIR_NUMBER --int PAIR_NUMBER( -+int (PAIR_NUMBER)( - int z) - { return(*(int *)0); } - - #undef redrawwin --int redrawwin( -+int (redrawwin)( - WINDOW *z) - { return(*(int *)0); } - - #undef refresh --int refresh(void) -+int (refresh)(void) - { return(*(int *)0); } - - #undef scrl --int scrl( -+int (scrl)( - int z) - { return(*(int *)0); } - - #undef scroll --int scroll( -+int (scroll)( - WINDOW *z) - { return(*(int *)0); } - - #undef setscrreg --int setscrreg( -+int (setscrreg)( - int a1, - int z) - { return(*(int *)0); } - - #undef slk_attr_off --int slk_attr_off( -+int (slk_attr_off)( - const attr_t a1, - void *z) - { return(*(int *)0); } - - #undef slk_attr_on --int slk_attr_on( -+int (slk_attr_on)( - attr_t a1, - void *z) - { return(*(int *)0); } - - #undef standout --int standout(void) -+int (standout)(void) - { return(*(int *)0); } - - #undef standend --int standend(void) -+int (standend)(void) - { return(*(int *)0); } - - #undef timeout --void timeout( -+void (timeout)( - int z) - { /* void */ } - - #undef touchline --int touchline( -+int (touchline)( - WINDOW *a1, - int a2, - int z) - { return(*(int *)0); } - - #undef touchwin --int touchwin( -+int (touchwin)( - WINDOW *z) - { return(*(int *)0); } - - #undef untouchwin --int untouchwin( -+int (untouchwin)( - WINDOW *z) - { return(*(int *)0); } - - #undef vline --int vline( -+int (vline)( - chtype a1, - int z) - { return(*(int *)0); } - - #undef vw_printw --int vw_printw( -+int (vw_printw)( - WINDOW *a1, - const char *a2, - va_list z) - { return(*(int *)0); } - - #undef vw_scanw --int vw_scanw( -+int (vw_scanw)( - WINDOW *a1, - char *a2, - va_list z) - { return(*(int *)0); } - - #undef waddchstr --int waddchstr( -+int (waddchstr)( - WINDOW *a1, - const chtype *z) - { return(*(int *)0); } - - #undef waddstr --int waddstr( -+int (waddstr)( - WINDOW *a1, - const char *z) - { return(*(int *)0); } - - #undef wattron --int wattron( -+int (wattron)( - WINDOW *a1, - int z) - { return(*(int *)0); } - - #undef wattroff --int wattroff( -+int (wattroff)( - WINDOW *a1, - int z) - { return(*(int *)0); } - - #undef wattrset --int wattrset( -+int (wattrset)( - WINDOW *a1, - int z) - { return(*(int *)0); } - - #undef wattr_get --int wattr_get( -+int (wattr_get)( - WINDOW *a1, - attr_t *a2, - short *a3, -@@ -1129,7 +1131,7 @@ - { return(*(int *)0); } - - #undef wattr_set --int wattr_set( -+int (wattr_set)( - WINDOW *a1, - attr_t a2, - short a3, -@@ -1137,205 +1139,205 @@ - { return(*(int *)0); } - - #undef wdeleteln --int wdeleteln( -+int (wdeleteln)( - WINDOW *z) - { return(*(int *)0); } - - #undef wgetstr --int wgetstr( -+int (wgetstr)( - WINDOW *a1, - char *z) - { return(*(int *)0); } - - #undef winchstr --int winchstr( -+int (winchstr)( - WINDOW *a1, - chtype *z) - { return(*(int *)0); } - - #undef winsertln --int winsertln( -+int (winsertln)( - WINDOW *z) - { return(*(int *)0); } - - #undef winsstr --int winsstr( -+int (winsstr)( - WINDOW *a1, - const char *z) - { return(*(int *)0); } - - #undef winstr --int winstr( -+int (winstr)( - WINDOW *a1, - char *z) - { return(*(int *)0); } - - #undef wstandout --int wstandout( -+int (wstandout)( - WINDOW *z) - { return(*(int *)0); } - - #undef wstandend --int wstandend( -+int (wstandend)( - WINDOW *z) - { return(*(int *)0); } - - #undef getattrs --int getattrs( -+int (getattrs)( - const WINDOW *z) - { return(*(int *)0); } - - #undef getcurx --int getcurx( -+int (getcurx)( - const WINDOW *z) - { return(*(int *)0); } - - #undef getcury --int getcury( -+int (getcury)( - const WINDOW *z) - { return(*(int *)0); } - - #undef getbegx --int getbegx( -+int (getbegx)( - const WINDOW *z) - { return(*(int *)0); } - - #undef getbegy --int getbegy( -+int (getbegy)( - const WINDOW *z) - { return(*(int *)0); } - - #undef getmaxx --int getmaxx( -+int (getmaxx)( - const WINDOW *z) - { return(*(int *)0); } - - #undef getmaxy --int getmaxy( -+int (getmaxy)( - const WINDOW *z) - { return(*(int *)0); } - - #undef getparx --int getparx( -+int (getparx)( - const WINDOW *z) - { return(*(int *)0); } - - #undef getpary --int getpary( -+int (getpary)( - const WINDOW *z) - { return(*(int *)0); } - - #undef wgetparent --WINDOW *wgetparent( -+WINDOW *(wgetparent)( - const WINDOW *z) - { return(*(WINDOW **)0); } - - #undef is_cleared --NCURSES_BOOL is_cleared( -+NCURSES_BOOL (is_cleared)( - const WINDOW *z) - { return(*(NCURSES_BOOL *)0); } - - #undef is_idcok --NCURSES_BOOL is_idcok( -+NCURSES_BOOL (is_idcok)( - const WINDOW *z) - { return(*(NCURSES_BOOL *)0); } - - #undef is_idlok --NCURSES_BOOL is_idlok( -+NCURSES_BOOL (is_idlok)( - const WINDOW *z) - { return(*(NCURSES_BOOL *)0); } - - #undef is_immedok --NCURSES_BOOL is_immedok( -+NCURSES_BOOL (is_immedok)( - const WINDOW *z) - { return(*(NCURSES_BOOL *)0); } - - #undef is_keypad --NCURSES_BOOL is_keypad( -+NCURSES_BOOL (is_keypad)( - const WINDOW *z) - { return(*(NCURSES_BOOL *)0); } - - #undef is_leaveok --NCURSES_BOOL is_leaveok( -+NCURSES_BOOL (is_leaveok)( - const WINDOW *z) - { return(*(NCURSES_BOOL *)0); } - - #undef is_nodelay --NCURSES_BOOL is_nodelay( -+NCURSES_BOOL (is_nodelay)( - const WINDOW *z) - { return(*(NCURSES_BOOL *)0); } - - #undef is_notimeout --NCURSES_BOOL is_notimeout( -+NCURSES_BOOL (is_notimeout)( - const WINDOW *z) - { return(*(NCURSES_BOOL *)0); } - - #undef is_pad --NCURSES_BOOL is_pad( -+NCURSES_BOOL (is_pad)( - const WINDOW *z) - { return(*(NCURSES_BOOL *)0); } - - #undef is_scrollok --NCURSES_BOOL is_scrollok( -+NCURSES_BOOL (is_scrollok)( - const WINDOW *z) - { return(*(NCURSES_BOOL *)0); } - - #undef is_subwin --NCURSES_BOOL is_subwin( -+NCURSES_BOOL (is_subwin)( - const WINDOW *z) - { return(*(NCURSES_BOOL *)0); } - - #undef is_syncok --NCURSES_BOOL is_syncok( -+NCURSES_BOOL (is_syncok)( - const WINDOW *z) - { return(*(NCURSES_BOOL *)0); } - - #undef wgetscrreg --int wgetscrreg( -+int (wgetscrreg)( - const WINDOW *a1, - int *a2, - int *z) - { return(*(int *)0); } - - #undef add_wch --int add_wch( -+int (add_wch)( - const cchar_t *z) - { return(*(int *)0); } - - #undef add_wchnstr --int add_wchnstr( -+int (add_wchnstr)( - const cchar_t *a1, - int z) - { return(*(int *)0); } - - #undef add_wchstr --int add_wchstr( -+int (add_wchstr)( - const cchar_t *z) - { return(*(int *)0); } - - #undef addnwstr --int addnwstr( -+int (addnwstr)( - const wchar_t *a1, - int z) - { return(*(int *)0); } - - #undef addwstr --int addwstr( -+int (addwstr)( - const wchar_t *z) - { return(*(int *)0); } - - #undef bkgrnd --int bkgrnd( -+int (bkgrnd)( - const cchar_t *z) - { return(*(int *)0); } - - #undef bkgrndset --void bkgrndset( -+void (bkgrndset)( - const cchar_t *z) - { /* void */ } - - #undef border_set --int border_set( -+int (border_set)( - const cchar_t *a1, - const cchar_t *a2, - const cchar_t *a3, -@@ -1347,96 +1349,96 @@ - { return(*(int *)0); } - - #undef box_set --int box_set( -+int (box_set)( - WINDOW *a1, - const cchar_t *a2, - const cchar_t *z) - { return(*(int *)0); } - - #undef echo_wchar --int echo_wchar( -+int (echo_wchar)( - const cchar_t *z) - { return(*(int *)0); } - - #undef get_wch --int get_wch( -+int (get_wch)( - wint_t *z) - { return(*(int *)0); } - - #undef get_wstr --int get_wstr( -+int (get_wstr)( - wint_t *z) - { return(*(int *)0); } - - #undef getbkgrnd --int getbkgrnd( -+int (getbkgrnd)( - cchar_t *z) - { return(*(int *)0); } - - #undef getn_wstr --int getn_wstr( -+int (getn_wstr)( - wint_t *a1, - int z) - { return(*(int *)0); } - - #undef hline_set --int hline_set( -+int (hline_set)( - const cchar_t *a1, - int z) - { return(*(int *)0); } - - #undef in_wch --int in_wch( -+int (in_wch)( - cchar_t *z) - { return(*(int *)0); } - - #undef in_wchnstr --int in_wchnstr( -+int (in_wchnstr)( - cchar_t *a1, - int z) - { return(*(int *)0); } - - #undef in_wchstr --int in_wchstr( -+int (in_wchstr)( - cchar_t *z) - { return(*(int *)0); } - - #undef innwstr --int innwstr( -+int (innwstr)( - wchar_t *a1, - int z) - { return(*(int *)0); } - - #undef ins_nwstr --int ins_nwstr( -+int (ins_nwstr)( - const wchar_t *a1, - int z) - { return(*(int *)0); } - - #undef ins_wch --int ins_wch( -+int (ins_wch)( - const cchar_t *z) - { return(*(int *)0); } - - #undef ins_wstr --int ins_wstr( -+int (ins_wstr)( - const wchar_t *z) - { return(*(int *)0); } - - #undef inwstr --int inwstr( -+int (inwstr)( - wchar_t *z) - { return(*(int *)0); } - - #undef mvadd_wch --int mvadd_wch( -+int (mvadd_wch)( - int a1, - int a2, - const cchar_t *z) - { return(*(int *)0); } - - #undef mvadd_wchnstr --int mvadd_wchnstr( -+int (mvadd_wchnstr)( - int a1, - int a2, - const cchar_t *a3, -@@ -1444,14 +1446,14 @@ - { return(*(int *)0); } - - #undef mvadd_wchstr --int mvadd_wchstr( -+int (mvadd_wchstr)( - int a1, - int a2, - const cchar_t *z) - { return(*(int *)0); } - - #undef mvaddnwstr --int mvaddnwstr( -+int (mvaddnwstr)( - int a1, - int a2, - const wchar_t *a3, -@@ -1459,28 +1461,28 @@ - { return(*(int *)0); } - - #undef mvaddwstr --int mvaddwstr( -+int (mvaddwstr)( - int a1, - int a2, - const wchar_t *z) - { return(*(int *)0); } - - #undef mvget_wch --int mvget_wch( -+int (mvget_wch)( - int a1, - int a2, - wint_t *z) - { return(*(int *)0); } - - #undef mvget_wstr --int mvget_wstr( -+int (mvget_wstr)( - int a1, - int a2, - wint_t *z) - { return(*(int *)0); } - - #undef mvgetn_wstr --int mvgetn_wstr( -+int (mvgetn_wstr)( - int a1, - int a2, - wint_t *a3, -@@ -1488,7 +1490,7 @@ - { return(*(int *)0); } - - #undef mvhline_set --int mvhline_set( -+int (mvhline_set)( - int a1, - int a2, - const cchar_t *a3, -@@ -1496,14 +1498,14 @@ - { return(*(int *)0); } - - #undef mvin_wch --int mvin_wch( -+int (mvin_wch)( - int a1, - int a2, - cchar_t *z) - { return(*(int *)0); } - - #undef mvin_wchnstr --int mvin_wchnstr( -+int (mvin_wchnstr)( - int a1, - int a2, - cchar_t *a3, -@@ -1511,14 +1513,14 @@ - { return(*(int *)0); } - - #undef mvin_wchstr --int mvin_wchstr( -+int (mvin_wchstr)( - int a1, - int a2, - cchar_t *z) - { return(*(int *)0); } - - #undef mvinnwstr --int mvinnwstr( -+int (mvinnwstr)( - int a1, - int a2, - wchar_t *a3, -@@ -1526,7 +1528,7 @@ - { return(*(int *)0); } - - #undef mvins_nwstr --int mvins_nwstr( -+int (mvins_nwstr)( - int a1, - int a2, - const wchar_t *a3, -@@ -1534,28 +1536,28 @@ - { return(*(int *)0); } - - #undef mvins_wch --int mvins_wch( -+int (mvins_wch)( - int a1, - int a2, - const cchar_t *z) - { return(*(int *)0); } - - #undef mvins_wstr --int mvins_wstr( -+int (mvins_wstr)( - int a1, - int a2, - const wchar_t *z) - { return(*(int *)0); } - - #undef mvinwstr --int mvinwstr( -+int (mvinwstr)( - int a1, - int a2, - wchar_t *z) - { return(*(int *)0); } - - #undef mvvline_set --int mvvline_set( -+int (mvvline_set)( - int a1, - int a2, - const cchar_t *a3, -@@ -1563,7 +1565,7 @@ - { return(*(int *)0); } - - #undef mvwadd_wch --int mvwadd_wch( -+int (mvwadd_wch)( - WINDOW *a1, - int a2, - int a3, -@@ -1571,7 +1573,7 @@ - { return(*(int *)0); } - - #undef mvwadd_wchnstr --int mvwadd_wchnstr( -+int (mvwadd_wchnstr)( - WINDOW *a1, - int a2, - int a3, -@@ -1580,7 +1582,7 @@ - { return(*(int *)0); } - - #undef mvwadd_wchstr --int mvwadd_wchstr( -+int (mvwadd_wchstr)( - WINDOW *a1, - int a2, - int a3, -@@ -1588,7 +1590,7 @@ - { return(*(int *)0); } - - #undef mvwaddnwstr --int mvwaddnwstr( -+int (mvwaddnwstr)( - WINDOW *a1, - int a2, - int a3, -@@ -1597,7 +1599,7 @@ - { return(*(int *)0); } - - #undef mvwaddwstr --int mvwaddwstr( -+int (mvwaddwstr)( - WINDOW *a1, - int a2, - int a3, -@@ -1605,7 +1607,7 @@ - { return(*(int *)0); } - - #undef mvwget_wch --int mvwget_wch( -+int (mvwget_wch)( - WINDOW *a1, - int a2, - int a3, -@@ -1613,7 +1615,7 @@ - { return(*(int *)0); } - - #undef mvwget_wstr --int mvwget_wstr( -+int (mvwget_wstr)( - WINDOW *a1, - int a2, - int a3, -@@ -1621,7 +1623,7 @@ - { return(*(int *)0); } - - #undef mvwgetn_wstr --int mvwgetn_wstr( -+int (mvwgetn_wstr)( - WINDOW *a1, - int a2, - int a3, -@@ -1630,7 +1632,7 @@ - { return(*(int *)0); } - - #undef mvwhline_set --int mvwhline_set( -+int (mvwhline_set)( - WINDOW *a1, - int a2, - int a3, -@@ -1639,7 +1641,7 @@ - { return(*(int *)0); } - - #undef mvwin_wch --int mvwin_wch( -+int (mvwin_wch)( - WINDOW *a1, - int a2, - int a3, -@@ -1647,7 +1649,7 @@ - { return(*(int *)0); } - - #undef mvwin_wchnstr --int mvwin_wchnstr( -+int (mvwin_wchnstr)( - WINDOW *a1, - int a2, - int a3, -@@ -1656,7 +1658,7 @@ - { return(*(int *)0); } - - #undef mvwin_wchstr --int mvwin_wchstr( -+int (mvwin_wchstr)( - WINDOW *a1, - int a2, - int a3, -@@ -1664,7 +1666,7 @@ - { return(*(int *)0); } - - #undef mvwinnwstr --int mvwinnwstr( -+int (mvwinnwstr)( - WINDOW *a1, - int a2, - int a3, -@@ -1673,7 +1675,7 @@ - { return(*(int *)0); } - - #undef mvwins_nwstr --int mvwins_nwstr( -+int (mvwins_nwstr)( - WINDOW *a1, - int a2, - int a3, -@@ -1682,7 +1684,7 @@ - { return(*(int *)0); } - - #undef mvwins_wch --int mvwins_wch( -+int (mvwins_wch)( - WINDOW *a1, - int a2, - int a3, -@@ -1690,7 +1692,7 @@ - { return(*(int *)0); } - - #undef mvwins_wstr --int mvwins_wstr( -+int (mvwins_wstr)( - WINDOW *a1, - int a2, - int a3, -@@ -1698,7 +1700,7 @@ - { return(*(int *)0); } - - #undef mvwinwstr --int mvwinwstr( -+int (mvwinwstr)( - WINDOW *a1, - int a2, - int a3, -@@ -1706,7 +1708,7 @@ - { return(*(int *)0); } - - #undef mvwvline_set --int mvwvline_set( -+int (mvwvline_set)( - WINDOW *a1, - int a2, - int a3, -@@ -1715,49 +1717,49 @@ - { return(*(int *)0); } - - #undef vline_set --int vline_set( -+int (vline_set)( - const cchar_t *a1, - int z) - { return(*(int *)0); } - - #undef wadd_wchstr --int wadd_wchstr( -+int (wadd_wchstr)( - WINDOW *a1, - const cchar_t *z) - { return(*(int *)0); } - - #undef waddwstr --int waddwstr( -+int (waddwstr)( - WINDOW *a1, - const wchar_t *z) - { return(*(int *)0); } - - #undef wget_wstr --int wget_wstr( -+int (wget_wstr)( - WINDOW *a1, - wint_t *z) - { return(*(int *)0); } - - #undef wgetbkgrnd --int wgetbkgrnd( -+int (wgetbkgrnd)( - WINDOW *a1, - cchar_t *z) - { return(*(int *)0); } - - #undef win_wchstr --int win_wchstr( -+int (win_wchstr)( - WINDOW *a1, - cchar_t *z) - { return(*(int *)0); } - - #undef wins_wstr --int wins_wstr( -+int (wins_wstr)( - WINDOW *a1, - const wchar_t *z) - { return(*(int *)0); } - - #undef mouse_trafo --NCURSES_BOOL mouse_trafo( -+NCURSES_BOOL (mouse_trafo)( - int *a1, - int *a2, - NCURSES_BOOL z) -@@ -2031,6 +2033,23 @@ - void _nc_mvcur_wrap(void) - { /* void */ } - -+#undef _nc_mvcur_sp -+int _nc_mvcur_sp( -+ SCREEN *sp, -+ int yold, -+ int xold, -+ int ynew, -+ int xnew) -+ { return(*(int *)0); } -+ -+#undef _nc_mvcur -+int _nc_mvcur( -+ int yold, -+ int xold, -+ int ynew, -+ int xnew) -+ { return(*(int *)0); } -+ - #undef mvcur_sp - int mvcur_sp( - SCREEN *sp, -@@ -2097,6 +2116,8 @@ - - /* ./base/lib_newwin.c */ - -+#include "/usr/lib/gcc/x86_64-linux-gnu/4.4.5/include/stddef.h" -+ - #undef _nc_freewin - int _nc_freewin( - WINDOW *win) -@@ -2440,8 +2461,8 @@ - void _nc_scroll_window( - WINDOW *win, - int const n, -- short const top, -- short const bottom, -+ int const top, -+ int const bottom, - cchar_t blank) - { /* void */ } - -@@ -2486,7 +2507,7 @@ - int slines, - int scolumns, - FILE *output, -- NCURSES_BOOL filtered, -+ int filtered, - int slk_format) - { return(*(int *)0); } - -@@ -2495,7 +2516,7 @@ - int slines, - int scolumns, - FILE *output, -- NCURSES_BOOL filtered, -+ int filtered, - int slk_format) - { return(*(int *)0); } - -@@ -2777,7 +2798,7 @@ - - #undef _nc_signal_handler - void _nc_signal_handler( -- NCURSES_BOOL enable) -+ int enable) - { /* void */ } - - /* ./base/lib_ungetch.c */ -@@ -3014,12 +3035,6 @@ - va_list ap) - { return(*(char **)0); } - --/* ./base/memmove.c */ -- --#undef _nc_memmove --void _nc_memmove(void) -- { /* void */ } -- - /* ./base/vsscanf.c */ - - #undef _nc_vsscanf -@@ -3554,7 +3569,7 @@ - #undef _nc_copy_termtype - void _nc_copy_termtype( - TERMTYPE *dst, -- TERMTYPE *src) -+ const TERMTYPE *src) - { /* void */ } - - /* ./codes.c */ -@@ -3653,6 +3668,8 @@ - - /* ./tinfo/db_iterator.c */ - -+#include <time.h> -+ - #undef _nc_tic_dir - const char *_nc_tic_dir( - const char *path) -@@ -3744,6 +3761,12 @@ - const char *name) - { return(*(int *)0); } - -+#undef _nc_setenv_num -+void _nc_setenv_num( -+ const char *name, -+ int value) -+ { /* void */ } -+ - /* ./tinfo/home_terminfo.c */ - - #undef _nc_home_terminfo -@@ -3929,8 +3952,6 @@ - - /* ./tinfo/lib_napms.c */ - --#include <time.h> -- - #undef napms_sp - int napms_sp( - SCREEN *sp, -@@ -4040,7 +4061,7 @@ - #undef _nc_keypad - int _nc_keypad( - SCREEN *sp, -- NCURSES_BOOL flag) -+ int flag) - { return(*(int *)0); } - - /* ./tinfo/lib_raw.c */ -@@ -4149,11 +4170,22 @@ - NCURSES_BOOL f) - { /* void */ } - -+#undef use_tioctl_sp -+void use_tioctl_sp( -+ SCREEN *sp, -+ NCURSES_BOOL f) -+ { /* void */ } -+ - #undef use_env - void use_env( - NCURSES_BOOL f) - { /* void */ } - -+#undef use_tioctl -+void use_tioctl( -+ NCURSES_BOOL f) -+ { /* void */ } -+ - #undef _nc_get_screensize - void _nc_get_screensize( - SCREEN *sp, -@@ -4175,7 +4207,7 @@ - #undef _nc_tinfo_cmdch - void _nc_tinfo_cmdch( - TERMINAL *termp, -- char proto) -+ int proto) - { /* void */ } - - #undef _nc_get_locale -@@ -4196,7 +4228,7 @@ - char *tname, - int Filedes, - int *errret, -- NCURSES_BOOL reuse) -+ int reuse) - { return(*(int *)0); } - - #undef new_prescr -@@ -4335,7 +4367,7 @@ - int _nc_tparm_analyze( - const char *string, - char *p_is_s[9], -- int *popcount) -+ int *_nc_popcount) - { return(*(int *)0); } - - #undef tparm -@@ -4355,7 +4387,7 @@ - #undef PC - char PC; - #undef ospeed --NCURSES_OSPEED ospeed; -+short ospeed; - #undef _nc_nulls_sent - int _nc_nulls_sent; - -@@ -4395,12 +4427,28 @@ - int ch) - { return(*(int *)0); } - -+#undef _nc_putchar_sp -+int _nc_putchar_sp( -+ SCREEN *sp, -+ int ch) -+ { return(*(int *)0); } -+ -+#undef _nc_putchar -+int _nc_putchar( -+ int ch) -+ { return(*(int *)0); } -+ - #undef putp_sp - int putp_sp( - SCREEN *sp, - const char *string) - { return(*(int *)0); } - -+#undef putp -+int putp( -+ const char *string) -+ { return(*(int *)0); } -+ - #undef _nc_putp_sp - int _nc_putp_sp( - SCREEN *sp, -@@ -4408,11 +4456,6 @@ - const char *string) - { return(*(int *)0); } - --#undef putp --int putp( -- const char *string) -- { return(*(int *)0); } -- - #undef _nc_putp - int _nc_putp( - const char *name, -@@ -4463,12 +4506,12 @@ - - #undef _nc_retrace_bool - NCURSES_BOOL _nc_retrace_bool( -- NCURSES_BOOL code) -+ int code) - { return(*(NCURSES_BOOL *)0); } - - #undef _nc_retrace_char - char _nc_retrace_char( -- char code) -+ int code) - { return(*(char *)0); } - - #undef _nc_retrace_int -@@ -4713,10 +4756,30 @@ - #undef strfnames - char *const strfnames[] = {0}; - -+/* ./tinfo/obsolete.c */ -+ -+#undef _nc_set_buffer_sp -+void _nc_set_buffer_sp( -+ SCREEN *sp, -+ FILE *ofp, -+ int buffered) -+ { /* void */ } -+ -+#undef _nc_set_buffer -+void _nc_set_buffer( -+ FILE *ofp, -+ int buffered) -+ { /* void */ } -+ - /* ./tinfo/read_entry.c */ - - #include <hashed_db.h> - -+#undef _nc_init_termtype -+void _nc_init_termtype( -+ TERMTYPE *const tp) -+ { /* void */ } -+ - #undef _nc_read_termtype - int _nc_read_termtype( - TERMTYPE *ptr, -@@ -4741,25 +4804,8 @@ - - #include <sys/types.h> - --#undef _nc_read_termcap_entry --int _nc_read_termcap_entry( -- const char *const tn, -- TERMTYPE *const tp) -- { return(*(int *)0); } -- --/* ./tinfo/setbuf.c */ -- --#undef _nc_set_buffer_sp --void _nc_set_buffer_sp( -- SCREEN *sp, -- FILE *ofp, -- NCURSES_BOOL buffered) -- { /* void */ } -- --#undef _nc_set_buffer --void _nc_set_buffer( -- FILE *ofp, -- NCURSES_BOOL buffered) -+#undef _nc_read_termcap -+void _nc_read_termcap(void) - { /* void */ } - - /* ./tinfo/strings.c */ -@@ -5007,6 +5053,8 @@ - - #undef _nc_syntax - int _nc_syntax; -+#undef _nc_strict_bsd -+int _nc_strict_bsd; - #undef _nc_curr_file_pos - long _nc_curr_file_pos; - #undef _nc_comment_start -diff -Naur ncurses-5.9/ncurses/llib-ltic ncurses-5.9.patch/ncurses/llib-ltic ---- ncurses-5.9/ncurses/llib-ltic 1970-01-01 01:00:00.000000000 +0100 -+++ ncurses-5.9.patch/ncurses/llib-ltic 2014-09-01 16:33:22.417792224 +0200 -@@ -0,0 +1,212 @@ -+/**************************************************************************** -+ * Copyright (c) 2012 Free Software Foundation, Inc. * -+ * * -+ * Permission is hereby granted, free of charge, to any person obtaining a * -+ * copy of this software and associated documentation files (the * -+ * "Software"), to deal in the Software without restriction, including * -+ * without limitation the rights to use, copy, modify, merge, publish, * -+ * distribute, distribute with modifications, sublicense, and/or sell * -+ * copies of the Software, and to permit persons to whom the Software is * -+ * furnished to do so, subject to the following conditions: * -+ * * -+ * The above copyright notice and this permission notice shall be included * -+ * in all copies or substantial portions of the Software. * -+ * * -+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * -+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * -+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * -+ * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * -+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * -+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * -+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * -+ * * -+ * Except as contained in this notice, the name(s) of the above copyright * -+ * holders shall not be used in advertising or otherwise to promote the * -+ * sale, use or other dealings in this Software without prior written * -+ * authorization. * -+ ****************************************************************************/ -+ -+/**************************************************************************** -+ * Author: Thomas E. Dickey 2012 * -+ ****************************************************************************/ -+/* LINTLIBRARY */ -+ -+/* ./tinfo/alloc_entry.c */ -+ -+#include <curses.priv.h> -+#include <tic.h> -+ -+#undef _nc_init_entry -+void _nc_init_entry( -+ TERMTYPE *const tp) -+ { /* void */ } -+ -+#undef _nc_copy_entry -+ENTRY *_nc_copy_entry( -+ ENTRY *oldp) -+ { return(*(ENTRY **)0); } -+ -+#undef _nc_save_str -+char *_nc_save_str( -+ const char *const string) -+ { return(*(char **)0); } -+ -+#undef _nc_wrap_entry -+void _nc_wrap_entry( -+ ENTRY *const ep, -+ NCURSES_BOOL copy_strings) -+ { /* void */ } -+ -+#undef _nc_merge_entry -+void _nc_merge_entry( -+ TERMTYPE *const to, -+ TERMTYPE *const from) -+ { /* void */ } -+ -+/* ./tinfo/captoinfo.c */ -+ -+#include <ctype.h> -+ -+#undef _nc_captoinfo -+char *_nc_captoinfo( -+ const char *cap, -+ const char *s, -+ int const parameterized) -+ { return(*(char **)0); } -+ -+#undef _nc_infotocap -+char *_nc_infotocap( -+ const char *cap, -+ const char *str, -+ int const parameterized) -+ { return(*(char **)0); } -+ -+/* ./tinfo/comp_expand.c */ -+ -+#undef _nc_tic_expand -+char *_nc_tic_expand( -+ const char *srcp, -+ NCURSES_BOOL tic_format, -+ int numbers) -+ { return(*(char **)0); } -+ -+/* ./tinfo/comp_parse.c */ -+ -+#undef _nc_check_termtype2 -+void (*_nc_check_termtype2)( -+ TERMTYPE *p1, -+ NCURSES_BOOL p2); -+#undef _nc_check_termtype -+void (*_nc_check_termtype)( -+ TERMTYPE *p1); -+ -+#undef _nc_entry_match -+NCURSES_BOOL _nc_entry_match( -+ char *n1, -+ char *n2) -+ { return(*(NCURSES_BOOL *)0); } -+ -+#undef _nc_read_entry_source -+void _nc_read_entry_source( -+ FILE *fp, -+ char *buf, -+ int literal, -+ NCURSES_BOOL silent, -+ NCURSES_BOOL (*hook)( -+ ENTRY *p1)) -+ { /* void */ } -+ -+#undef _nc_resolve_uses2 -+int _nc_resolve_uses2( -+ NCURSES_BOOL fullresolve, -+ NCURSES_BOOL literal) -+ { return(*(int *)0); } -+ -+#undef _nc_resolve_uses -+int _nc_resolve_uses( -+ NCURSES_BOOL fullresolve) -+ { return(*(int *)0); } -+ -+/* ./tinfo/comp_scan.c */ -+ -+#undef _nc_syntax -+int _nc_syntax; -+#undef _nc_strict_bsd -+int _nc_strict_bsd; -+#undef _nc_curr_file_pos -+long _nc_curr_file_pos; -+#undef _nc_comment_start -+long _nc_comment_start; -+#undef _nc_comment_end -+long _nc_comment_end; -+#undef _nc_start_line -+long _nc_start_line; -+#undef _nc_curr_token -+struct token _nc_curr_token; -+#undef _nc_disable_period -+NCURSES_BOOL _nc_disable_period; -+ -+#undef _nc_reset_input -+void _nc_reset_input( -+ FILE *fp, -+ char *buf) -+ { /* void */ } -+ -+#undef _nc_get_token -+int _nc_get_token( -+ NCURSES_BOOL silent) -+ { return(*(int *)0); } -+ -+#undef _nc_trans_string -+int _nc_trans_string( -+ char *ptr, -+ char *last) -+ { return(*(int *)0); } -+ -+#undef _nc_push_token -+void _nc_push_token( -+ int tokclass) -+ { /* void */ } -+ -+#undef _nc_panic_mode -+void _nc_panic_mode( -+ char ch) -+ { /* void */ } -+ -+/* ./tinfo/parse_entry.c */ -+ -+#undef _nc_parse_entry -+int _nc_parse_entry( -+ struct entry *entryp, -+ int literal, -+ NCURSES_BOOL silent) -+ { return(*(int *)0); } -+ -+#undef _nc_capcmp -+int _nc_capcmp( -+ const char *s, -+ const char *t) -+ { return(*(int *)0); } -+ -+typedef struct { -+ const char *from; -+ const char *to; -+} assoc; -+ -+/* ./tinfo/write_entry.c */ -+ -+#include <hashed_db.h> -+ -+#undef _nc_set_writedir -+void _nc_set_writedir( -+ char *dir) -+ { /* void */ } -+ -+#undef _nc_write_entry -+void _nc_write_entry( -+ TERMTYPE *const tp) -+ { /* void */ } -+ -+#undef _nc_tic_written -+int _nc_tic_written(void) -+ { return(*(int *)0); } -diff -Naur ncurses-5.9/ncurses/llib-ltict ncurses-5.9.patch/ncurses/llib-ltict ---- ncurses-5.9/ncurses/llib-ltict 1970-01-01 01:00:00.000000000 +0100 -+++ ncurses-5.9.patch/ncurses/llib-ltict 2014-09-01 16:33:22.417792224 +0200 -@@ -0,0 +1,212 @@ -+/**************************************************************************** -+ * Copyright (c) 2013 Free Software Foundation, Inc. * -+ * * -+ * Permission is hereby granted, free of charge, to any person obtaining a * -+ * copy of this software and associated documentation files (the * -+ * "Software"), to deal in the Software without restriction, including * -+ * without limitation the rights to use, copy, modify, merge, publish, * -+ * distribute, distribute with modifications, sublicense, and/or sell * -+ * copies of the Software, and to permit persons to whom the Software is * -+ * furnished to do so, subject to the following conditions: * -+ * * -+ * The above copyright notice and this permission notice shall be included * -+ * in all copies or substantial portions of the Software. * -+ * * -+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * -+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * -+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * -+ * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * -+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * -+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * -+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * -+ * * -+ * Except as contained in this notice, the name(s) of the above copyright * -+ * holders shall not be used in advertising or otherwise to promote the * -+ * sale, use or other dealings in this Software without prior written * -+ * authorization. * -+ ****************************************************************************/ -+ -+/**************************************************************************** -+ * Author: Thomas E. Dickey 2013 * -+ ****************************************************************************/ -+/* LINTLIBRARY */ -+ -+/* ./tinfo/alloc_entry.c */ -+ -+#include <curses.priv.h> -+#include <tic.h> -+ -+#undef _nc_init_entry -+void _nc_init_entry( -+ TERMTYPE *const tp) -+ { /* void */ } -+ -+#undef _nc_copy_entry -+ENTRY *_nc_copy_entry( -+ ENTRY *oldp) -+ { return(*(ENTRY **)0); } -+ -+#undef _nc_save_str -+char *_nc_save_str( -+ const char *const string) -+ { return(*(char **)0); } -+ -+#undef _nc_wrap_entry -+void _nc_wrap_entry( -+ ENTRY *const ep, -+ NCURSES_BOOL copy_strings) -+ { /* void */ } -+ -+#undef _nc_merge_entry -+void _nc_merge_entry( -+ TERMTYPE *const to, -+ TERMTYPE *const from) -+ { /* void */ } -+ -+/* ./tinfo/captoinfo.c */ -+ -+#include <ctype.h> -+ -+#undef _nc_captoinfo -+char *_nc_captoinfo( -+ const char *cap, -+ const char *s, -+ int const parameterized) -+ { return(*(char **)0); } -+ -+#undef _nc_infotocap -+char *_nc_infotocap( -+ const char *cap, -+ const char *str, -+ int const parameterized) -+ { return(*(char **)0); } -+ -+/* ./tinfo/comp_expand.c */ -+ -+#undef _nc_tic_expand -+char *_nc_tic_expand( -+ const char *srcp, -+ NCURSES_BOOL tic_format, -+ int numbers) -+ { return(*(char **)0); } -+ -+/* ./tinfo/comp_parse.c */ -+ -+#undef _nc_check_termtype2 -+void (*_nc_check_termtype2)( -+ TERMTYPE *p1, -+ NCURSES_BOOL p2); -+#undef _nc_check_termtype -+void (*_nc_check_termtype)( -+ TERMTYPE *p1); -+ -+#undef _nc_entry_match -+NCURSES_BOOL _nc_entry_match( -+ char *n1, -+ char *n2) -+ { return(*(NCURSES_BOOL *)0); } -+ -+#undef _nc_read_entry_source -+void _nc_read_entry_source( -+ FILE *fp, -+ char *buf, -+ int literal, -+ NCURSES_BOOL silent, -+ NCURSES_BOOL (*hook)( -+ ENTRY *p1)) -+ { /* void */ } -+ -+#undef _nc_resolve_uses2 -+int _nc_resolve_uses2( -+ NCURSES_BOOL fullresolve, -+ NCURSES_BOOL literal) -+ { return(*(int *)0); } -+ -+#undef _nc_resolve_uses -+int _nc_resolve_uses( -+ NCURSES_BOOL fullresolve) -+ { return(*(int *)0); } -+ -+/* ./tinfo/comp_scan.c */ -+ -+#undef _nc_syntax -+int _nc_syntax; -+#undef _nc_strict_bsd -+int _nc_strict_bsd; -+#undef _nc_curr_file_pos -+long _nc_curr_file_pos; -+#undef _nc_comment_start -+long _nc_comment_start; -+#undef _nc_comment_end -+long _nc_comment_end; -+#undef _nc_start_line -+long _nc_start_line; -+#undef _nc_curr_token -+struct token _nc_curr_token; -+#undef _nc_disable_period -+NCURSES_BOOL _nc_disable_period; -+ -+#undef _nc_reset_input -+void _nc_reset_input( -+ FILE *fp, -+ char *buf) -+ { /* void */ } -+ -+#undef _nc_get_token -+int _nc_get_token( -+ NCURSES_BOOL silent) -+ { return(*(int *)0); } -+ -+#undef _nc_trans_string -+int _nc_trans_string( -+ char *ptr, -+ char *last) -+ { return(*(int *)0); } -+ -+#undef _nc_push_token -+void _nc_push_token( -+ int tokclass) -+ { /* void */ } -+ -+#undef _nc_panic_mode -+void _nc_panic_mode( -+ char ch) -+ { /* void */ } -+ -+/* ./tinfo/parse_entry.c */ -+ -+#undef _nc_parse_entry -+int _nc_parse_entry( -+ struct entry *entryp, -+ int literal, -+ NCURSES_BOOL silent) -+ { return(*(int *)0); } -+ -+#undef _nc_capcmp -+int _nc_capcmp( -+ const char *s, -+ const char *t) -+ { return(*(int *)0); } -+ -+typedef struct { -+ const char *from; -+ const char *to; -+} assoc; -+ -+/* ./tinfo/write_entry.c */ -+ -+#include <hashed_db.h> -+ -+#undef _nc_set_writedir -+void _nc_set_writedir( -+ char *dir) -+ { /* void */ } -+ -+#undef _nc_write_entry -+void _nc_write_entry( -+ TERMTYPE *const tp) -+ { /* void */ } -+ -+#undef _nc_tic_written -+int _nc_tic_written(void) -+ { return(*(int *)0); } -diff -Naur ncurses-5.9/ncurses/llib-ltictw ncurses-5.9.patch/ncurses/llib-ltictw ---- ncurses-5.9/ncurses/llib-ltictw 1970-01-01 01:00:00.000000000 +0100 -+++ ncurses-5.9.patch/ncurses/llib-ltictw 2014-09-01 16:33:22.417792224 +0200 -@@ -0,0 +1,212 @@ -+/**************************************************************************** -+ * Copyright (c) 2012 Free Software Foundation, Inc. * -+ * * -+ * Permission is hereby granted, free of charge, to any person obtaining a * -+ * copy of this software and associated documentation files (the * -+ * "Software"), to deal in the Software without restriction, including * -+ * without limitation the rights to use, copy, modify, merge, publish, * -+ * distribute, distribute with modifications, sublicense, and/or sell * -+ * copies of the Software, and to permit persons to whom the Software is * -+ * furnished to do so, subject to the following conditions: * -+ * * -+ * The above copyright notice and this permission notice shall be included * -+ * in all copies or substantial portions of the Software. * -+ * * -+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * -+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * -+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * -+ * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * -+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * -+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * -+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * -+ * * -+ * Except as contained in this notice, the name(s) of the above copyright * -+ * holders shall not be used in advertising or otherwise to promote the * -+ * sale, use or other dealings in this Software without prior written * -+ * authorization. * -+ ****************************************************************************/ -+ -+/**************************************************************************** -+ * Author: Thomas E. Dickey 2012 * -+ ****************************************************************************/ -+/* LINTLIBRARY */ -+ -+/* ./tinfo/alloc_entry.c */ -+ -+#include <curses.priv.h> -+#include <tic.h> -+ -+#undef _nc_init_entry -+void _nc_init_entry( -+ TERMTYPE *const tp) -+ { /* void */ } -+ -+#undef _nc_copy_entry -+ENTRY *_nc_copy_entry( -+ ENTRY *oldp) -+ { return(*(ENTRY **)0); } -+ -+#undef _nc_save_str -+char *_nc_save_str( -+ const char *const string) -+ { return(*(char **)0); } -+ -+#undef _nc_wrap_entry -+void _nc_wrap_entry( -+ ENTRY *const ep, -+ NCURSES_BOOL copy_strings) -+ { /* void */ } -+ -+#undef _nc_merge_entry -+void _nc_merge_entry( -+ TERMTYPE *const to, -+ TERMTYPE *const from) -+ { /* void */ } -+ -+/* ./tinfo/captoinfo.c */ -+ -+#include <ctype.h> -+ -+#undef _nc_captoinfo -+char *_nc_captoinfo( -+ const char *cap, -+ const char *s, -+ int const parameterized) -+ { return(*(char **)0); } -+ -+#undef _nc_infotocap -+char *_nc_infotocap( -+ const char *cap, -+ const char *str, -+ int const parameterized) -+ { return(*(char **)0); } -+ -+/* ./tinfo/comp_expand.c */ -+ -+#undef _nc_tic_expand -+char *_nc_tic_expand( -+ const char *srcp, -+ NCURSES_BOOL tic_format, -+ int numbers) -+ { return(*(char **)0); } -+ -+/* ./tinfo/comp_parse.c */ -+ -+#undef _nc_check_termtype2 -+void (*_nc_check_termtype2)( -+ TERMTYPE *p1, -+ NCURSES_BOOL p2); -+#undef _nc_check_termtype -+void (*_nc_check_termtype)( -+ TERMTYPE *p1); -+ -+#undef _nc_entry_match -+NCURSES_BOOL _nc_entry_match( -+ char *n1, -+ char *n2) -+ { return(*(NCURSES_BOOL *)0); } -+ -+#undef _nc_read_entry_source -+void _nc_read_entry_source( -+ FILE *fp, -+ char *buf, -+ int literal, -+ NCURSES_BOOL silent, -+ NCURSES_BOOL (*hook)( -+ ENTRY *p1)) -+ { /* void */ } -+ -+#undef _nc_resolve_uses2 -+int _nc_resolve_uses2( -+ NCURSES_BOOL fullresolve, -+ NCURSES_BOOL literal) -+ { return(*(int *)0); } -+ -+#undef _nc_resolve_uses -+int _nc_resolve_uses( -+ NCURSES_BOOL fullresolve) -+ { return(*(int *)0); } -+ -+/* ./tinfo/comp_scan.c */ -+ -+#undef _nc_syntax -+int _nc_syntax; -+#undef _nc_strict_bsd -+int _nc_strict_bsd; -+#undef _nc_curr_file_pos -+long _nc_curr_file_pos; -+#undef _nc_comment_start -+long _nc_comment_start; -+#undef _nc_comment_end -+long _nc_comment_end; -+#undef _nc_start_line -+long _nc_start_line; -+#undef _nc_curr_token -+struct token _nc_curr_token; -+#undef _nc_disable_period -+NCURSES_BOOL _nc_disable_period; -+ -+#undef _nc_reset_input -+void _nc_reset_input( -+ FILE *fp, -+ char *buf) -+ { /* void */ } -+ -+#undef _nc_get_token -+int _nc_get_token( -+ NCURSES_BOOL silent) -+ { return(*(int *)0); } -+ -+#undef _nc_trans_string -+int _nc_trans_string( -+ char *ptr, -+ char *last) -+ { return(*(int *)0); } -+ -+#undef _nc_push_token -+void _nc_push_token( -+ int tokclass) -+ { /* void */ } -+ -+#undef _nc_panic_mode -+void _nc_panic_mode( -+ char ch) -+ { /* void */ } -+ -+/* ./tinfo/parse_entry.c */ -+ -+#undef _nc_parse_entry -+int _nc_parse_entry( -+ struct entry *entryp, -+ int literal, -+ NCURSES_BOOL silent) -+ { return(*(int *)0); } -+ -+#undef _nc_capcmp -+int _nc_capcmp( -+ const char *s, -+ const char *t) -+ { return(*(int *)0); } -+ -+typedef struct { -+ const char *from; -+ const char *to; -+} assoc; -+ -+/* ./tinfo/write_entry.c */ -+ -+#include <hashed_db.h> -+ -+#undef _nc_set_writedir -+void _nc_set_writedir( -+ char *dir) -+ { /* void */ } -+ -+#undef _nc_write_entry -+void _nc_write_entry( -+ TERMTYPE *const tp) -+ { /* void */ } -+ -+#undef _nc_tic_written -+int _nc_tic_written(void) -+ { return(*(int *)0); } -diff -Naur ncurses-5.9/ncurses/llib-lticw ncurses-5.9.patch/ncurses/llib-lticw ---- ncurses-5.9/ncurses/llib-lticw 1970-01-01 01:00:00.000000000 +0100 -+++ ncurses-5.9.patch/ncurses/llib-lticw 2014-09-01 16:33:22.417792224 +0200 -@@ -0,0 +1,212 @@ -+/**************************************************************************** -+ * Copyright (c) 2012 Free Software Foundation, Inc. * -+ * * -+ * Permission is hereby granted, free of charge, to any person obtaining a * -+ * copy of this software and associated documentation files (the * -+ * "Software"), to deal in the Software without restriction, including * -+ * without limitation the rights to use, copy, modify, merge, publish, * -+ * distribute, distribute with modifications, sublicense, and/or sell * -+ * copies of the Software, and to permit persons to whom the Software is * -+ * furnished to do so, subject to the following conditions: * -+ * * -+ * The above copyright notice and this permission notice shall be included * -+ * in all copies or substantial portions of the Software. * -+ * * -+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * -+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * -+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * -+ * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * -+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * -+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * -+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * -+ * * -+ * Except as contained in this notice, the name(s) of the above copyright * -+ * holders shall not be used in advertising or otherwise to promote the * -+ * sale, use or other dealings in this Software without prior written * -+ * authorization. * -+ ****************************************************************************/ -+ -+/**************************************************************************** -+ * Author: Thomas E. Dickey 2012 * -+ ****************************************************************************/ -+/* LINTLIBRARY */ -+ -+/* ./tinfo/alloc_entry.c */ -+ -+#include <curses.priv.h> -+#include <tic.h> -+ -+#undef _nc_init_entry -+void _nc_init_entry( -+ TERMTYPE *const tp) -+ { /* void */ } -+ -+#undef _nc_copy_entry -+ENTRY *_nc_copy_entry( -+ ENTRY *oldp) -+ { return(*(ENTRY **)0); } -+ -+#undef _nc_save_str -+char *_nc_save_str( -+ const char *const string) -+ { return(*(char **)0); } -+ -+#undef _nc_wrap_entry -+void _nc_wrap_entry( -+ ENTRY *const ep, -+ NCURSES_BOOL copy_strings) -+ { /* void */ } -+ -+#undef _nc_merge_entry -+void _nc_merge_entry( -+ TERMTYPE *const to, -+ TERMTYPE *const from) -+ { /* void */ } -+ -+/* ./tinfo/captoinfo.c */ -+ -+#include <ctype.h> -+ -+#undef _nc_captoinfo -+char *_nc_captoinfo( -+ const char *cap, -+ const char *s, -+ int const parameterized) -+ { return(*(char **)0); } -+ -+#undef _nc_infotocap -+char *_nc_infotocap( -+ const char *cap, -+ const char *str, -+ int const parameterized) -+ { return(*(char **)0); } -+ -+/* ./tinfo/comp_expand.c */ -+ -+#undef _nc_tic_expand -+char *_nc_tic_expand( -+ const char *srcp, -+ NCURSES_BOOL tic_format, -+ int numbers) -+ { return(*(char **)0); } -+ -+/* ./tinfo/comp_parse.c */ -+ -+#undef _nc_check_termtype2 -+void (*_nc_check_termtype2)( -+ TERMTYPE *p1, -+ NCURSES_BOOL p2); -+#undef _nc_check_termtype -+void (*_nc_check_termtype)( -+ TERMTYPE *p1); -+ -+#undef _nc_entry_match -+NCURSES_BOOL _nc_entry_match( -+ char *n1, -+ char *n2) -+ { return(*(NCURSES_BOOL *)0); } -+ -+#undef _nc_read_entry_source -+void _nc_read_entry_source( -+ FILE *fp, -+ char *buf, -+ int literal, -+ NCURSES_BOOL silent, -+ NCURSES_BOOL (*hook)( -+ ENTRY *p1)) -+ { /* void */ } -+ -+#undef _nc_resolve_uses2 -+int _nc_resolve_uses2( -+ NCURSES_BOOL fullresolve, -+ NCURSES_BOOL literal) -+ { return(*(int *)0); } -+ -+#undef _nc_resolve_uses -+int _nc_resolve_uses( -+ NCURSES_BOOL fullresolve) -+ { return(*(int *)0); } -+ -+/* ./tinfo/comp_scan.c */ -+ -+#undef _nc_syntax -+int _nc_syntax; -+#undef _nc_strict_bsd -+int _nc_strict_bsd; -+#undef _nc_curr_file_pos -+long _nc_curr_file_pos; -+#undef _nc_comment_start -+long _nc_comment_start; -+#undef _nc_comment_end -+long _nc_comment_end; -+#undef _nc_start_line -+long _nc_start_line; -+#undef _nc_curr_token -+struct token _nc_curr_token; -+#undef _nc_disable_period -+NCURSES_BOOL _nc_disable_period; -+ -+#undef _nc_reset_input -+void _nc_reset_input( -+ FILE *fp, -+ char *buf) -+ { /* void */ } -+ -+#undef _nc_get_token -+int _nc_get_token( -+ NCURSES_BOOL silent) -+ { return(*(int *)0); } -+ -+#undef _nc_trans_string -+int _nc_trans_string( -+ char *ptr, -+ char *last) -+ { return(*(int *)0); } -+ -+#undef _nc_push_token -+void _nc_push_token( -+ int tokclass) -+ { /* void */ } -+ -+#undef _nc_panic_mode -+void _nc_panic_mode( -+ char ch) -+ { /* void */ } -+ -+/* ./tinfo/parse_entry.c */ -+ -+#undef _nc_parse_entry -+int _nc_parse_entry( -+ struct entry *entryp, -+ int literal, -+ NCURSES_BOOL silent) -+ { return(*(int *)0); } -+ -+#undef _nc_capcmp -+int _nc_capcmp( -+ const char *s, -+ const char *t) -+ { return(*(int *)0); } -+ -+typedef struct { -+ const char *from; -+ const char *to; -+} assoc; -+ -+/* ./tinfo/write_entry.c */ -+ -+#include <hashed_db.h> -+ -+#undef _nc_set_writedir -+void _nc_set_writedir( -+ char *dir) -+ { /* void */ } -+ -+#undef _nc_write_entry -+void _nc_write_entry( -+ TERMTYPE *const tp) -+ { /* void */ } -+ -+#undef _nc_tic_written -+int _nc_tic_written(void) -+ { return(*(int *)0); } -diff -Naur ncurses-5.9/ncurses/llib-ltinfo ncurses-5.9.patch/ncurses/llib-ltinfo ---- ncurses-5.9/ncurses/llib-ltinfo 1970-01-01 01:00:00.000000000 +0100 -+++ ncurses-5.9.patch/ncurses/llib-ltinfo 2014-09-01 16:33:22.418792225 +0200 -@@ -0,0 +1,1526 @@ -+/**************************************************************************** -+ * Copyright (c) 2012,2013 Free Software Foundation, Inc. * -+ * * -+ * Permission is hereby granted, free of charge, to any person obtaining a * -+ * copy of this software and associated documentation files (the * -+ * "Software"), to deal in the Software without restriction, including * -+ * without limitation the rights to use, copy, modify, merge, publish, * -+ * distribute, distribute with modifications, sublicense, and/or sell * -+ * copies of the Software, and to permit persons to whom the Software is * -+ * furnished to do so, subject to the following conditions: * -+ * * -+ * The above copyright notice and this permission notice shall be included * -+ * in all copies or substantial portions of the Software. * -+ * * -+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * -+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * -+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * -+ * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * -+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * -+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * -+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * -+ * * -+ * Except as contained in this notice, the name(s) of the above copyright * -+ * holders shall not be used in advertising or otherwise to promote the * -+ * sale, use or other dealings in this Software without prior written * -+ * authorization. * -+ ****************************************************************************/ -+ -+/**************************************************************************** -+ * Author: Thomas E. Dickey 2012 * -+ ****************************************************************************/ -+/* LINTLIBRARY */ -+ -+/* ./tinfo/access.c */ -+ -+#include <curses.priv.h> -+#include <ctype.h> -+#include <tic.h> -+ -+#undef _nc_rootname -+char *_nc_rootname( -+ char *path) -+ { return(*(char **)0); } -+ -+#undef _nc_is_abs_path -+NCURSES_BOOL _nc_is_abs_path( -+ const char *path) -+ { return(*(NCURSES_BOOL *)0); } -+ -+#undef _nc_pathlast -+unsigned _nc_pathlast( -+ const char *path) -+ { return(*(unsigned *)0); } -+ -+#undef _nc_basename -+char *_nc_basename( -+ char *path) -+ { return(*(char **)0); } -+ -+#undef _nc_access -+int _nc_access( -+ const char *path, -+ int mode) -+ { return(*(int *)0); } -+ -+#undef _nc_is_dir_path -+NCURSES_BOOL _nc_is_dir_path( -+ const char *path) -+ { return(*(NCURSES_BOOL *)0); } -+ -+#undef _nc_is_file_path -+NCURSES_BOOL _nc_is_file_path( -+ const char *path) -+ { return(*(NCURSES_BOOL *)0); } -+ -+#undef _nc_env_access -+int _nc_env_access(void) -+ { return(*(int *)0); } -+ -+/* ./tinfo/add_tries.c */ -+ -+#undef _nc_add_to_try -+int _nc_add_to_try( -+ TRIES **tree, -+ const char *str, -+ unsigned code) -+ { return(*(int *)0); } -+ -+/* ./tinfo/alloc_ttype.c */ -+ -+#undef _nc_align_termtype -+void _nc_align_termtype( -+ TERMTYPE *to, -+ TERMTYPE *from) -+ { /* void */ } -+ -+#undef _nc_copy_termtype -+void _nc_copy_termtype( -+ TERMTYPE *dst, -+ const TERMTYPE *src) -+ { /* void */ } -+ -+/* ./codes.c */ -+ -+#undef boolcodes -+char *const boolcodes[] = {0}; -+#undef numcodes -+char *const numcodes[] = {0}; -+#undef strcodes -+char *const strcodes[] = {0}; -+ -+/* ./comp_captab.c */ -+ -+#include <hashsize.h> -+ -+#undef _nc_get_table -+const struct name_table_entry *_nc_get_table( -+ NCURSES_BOOL termcap) -+ { return(*(const struct name_table_entry **)0); } -+ -+#undef _nc_get_hash_table -+const HashValue *_nc_get_hash_table( -+ NCURSES_BOOL termcap) -+ { return(*(const HashValue **)0); } -+ -+#undef _nc_get_alias_table -+const struct alias *_nc_get_alias_table( -+ NCURSES_BOOL termcap) -+ { return(*(const struct alias **)0); } -+ -+#undef _nc_get_hash_info -+const HashData *_nc_get_hash_info( -+ NCURSES_BOOL termcap) -+ { return(*(const HashData **)0); } -+ -+/* ./tinfo/comp_error.c */ -+ -+#undef _nc_suppress_warnings -+NCURSES_BOOL _nc_suppress_warnings; -+#undef _nc_curr_line -+int _nc_curr_line; -+#undef _nc_curr_col -+int _nc_curr_col; -+ -+#undef _nc_get_source -+const char *_nc_get_source(void) -+ { return(*(const char **)0); } -+ -+#undef _nc_set_source -+void _nc_set_source( -+ const char *const name) -+ { /* void */ } -+ -+#undef _nc_set_type -+void _nc_set_type( -+ const char *const name) -+ { /* void */ } -+ -+#undef _nc_get_type -+void _nc_get_type( -+ char *name) -+ { /* void */ } -+ -+#undef _nc_warning -+void _nc_warning( -+ const char *const fmt, -+ ...) -+ { /* void */ } -+ -+#undef _nc_err_abort -+void _nc_err_abort( -+ const char *const fmt, -+ ...) -+ { /* void */ } -+ -+#undef _nc_syserr_abort -+void _nc_syserr_abort( -+ const char *const fmt, -+ ...) -+ { /* void */ } -+ -+/* ./tinfo/comp_hash.c */ -+ -+#undef _nc_find_entry -+struct name_table_entry const *_nc_find_entry( -+ const char *string, -+ const HashValue *hash_table) -+ { return(*(struct name_table_entry const **)0); } -+ -+#undef _nc_find_type_entry -+struct name_table_entry const *_nc_find_type_entry( -+ const char *string, -+ int type, -+ NCURSES_BOOL termcap) -+ { return(*(struct name_table_entry const **)0); } -+ -+/* ./tinfo/db_iterator.c */ -+ -+#include <time.h> -+ -+#undef _nc_tic_dir -+const char *_nc_tic_dir( -+ const char *path) -+ { return(*(const char **)0); } -+ -+#undef _nc_keep_tic_dir -+void _nc_keep_tic_dir( -+ const char *path) -+ { /* void */ } -+ -+#undef _nc_last_db -+void _nc_last_db(void) -+ { /* void */ } -+ -+#undef _nc_next_db -+const char *_nc_next_db( -+ DBDIRS *state, -+ int *offset) -+ { return(*(const char **)0); } -+ -+#undef _nc_first_db -+void _nc_first_db( -+ DBDIRS *state, -+ int *offset) -+ { /* void */ } -+ -+/* ./tinfo/doalloc.c */ -+ -+#undef _nc_doalloc -+void *_nc_doalloc( -+ void *oldp, -+ size_t amount) -+ { return(*(void **)0); } -+ -+/* ./tinfo/entries.c */ -+ -+#undef _nc_head -+ENTRY *_nc_head; -+#undef _nc_tail -+ENTRY *_nc_tail; -+ -+#undef _nc_free_entry -+void _nc_free_entry( -+ ENTRY *headp, -+ TERMTYPE *tterm) -+ { /* void */ } -+ -+#undef _nc_free_entries -+void _nc_free_entries( -+ ENTRY *headp) -+ { /* void */ } -+ -+#undef _nc_delink_entry -+ENTRY *_nc_delink_entry( -+ ENTRY *headp, -+ TERMTYPE *tterm) -+ { return(*(ENTRY **)0); } -+ -+#undef _nc_leaks_tinfo -+void _nc_leaks_tinfo(void) -+ { /* void */ } -+ -+/* ./fallback.c */ -+ -+#undef _nc_fallback -+const TERMTYPE *_nc_fallback( -+ const char *name) -+ { return(*(const TERMTYPE **)0); } -+ -+/* ./tinfo/free_ttype.c */ -+ -+#undef _nc_free_termtype -+void _nc_free_termtype( -+ TERMTYPE *ptr) -+ { /* void */ } -+ -+#undef _nc_user_definable -+NCURSES_BOOL _nc_user_definable; -+ -+#undef use_extended_names -+int use_extended_names( -+ NCURSES_BOOL flag) -+ { return(*(int *)0); } -+ -+/* ./tinfo/getenv_num.c */ -+ -+#undef _nc_getenv_num -+int _nc_getenv_num( -+ const char *name) -+ { return(*(int *)0); } -+ -+#undef _nc_setenv_num -+void _nc_setenv_num( -+ const char *name, -+ int value) -+ { /* void */ } -+ -+/* ./tinfo/home_terminfo.c */ -+ -+#undef _nc_home_terminfo -+char *_nc_home_terminfo(void) -+ { return(*(char **)0); } -+ -+/* ./tinfo/init_keytry.c */ -+ -+#if 0 -+ -+#include <init_keytry.h> -+ -+#undef _nc_tinfo_fkeys -+const struct tinfo_fkeys _nc_tinfo_fkeys[] = {0}; -+ -+#endif -+ -+#undef _nc_init_keytry -+void _nc_init_keytry( -+ SCREEN *sp) -+ { /* void */ } -+ -+/* ./tinfo/lib_acs.c */ -+ -+#undef acs_map -+chtype acs_map[128]; -+ -+#undef _nc_init_acs_sp -+void _nc_init_acs_sp( -+ SCREEN *sp) -+ { /* void */ } -+ -+#undef _nc_init_acs -+void _nc_init_acs(void) -+ { /* void */ } -+ -+/* ./tinfo/lib_baudrate.c */ -+ -+#include <termcap.h> -+ -+struct speed { -+ int s; -+ int sp; -+}; -+ -+#undef _nc_baudrate -+int _nc_baudrate( -+ int OSpeed) -+ { return(*(int *)0); } -+ -+#undef _nc_ospeed -+int _nc_ospeed( -+ int BaudRate) -+ { return(*(int *)0); } -+ -+#undef baudrate_sp -+int baudrate_sp( -+ SCREEN *sp) -+ { return(*(int *)0); } -+ -+#undef baudrate -+int baudrate(void) -+ { return(*(int *)0); } -+ -+/* ./tinfo/lib_cur_term.c */ -+ -+#undef cur_term -+TERMINAL *cur_term; -+ -+#undef set_curterm_sp -+TERMINAL *set_curterm_sp( -+ SCREEN *sp, -+ TERMINAL *termp) -+ { return(*(TERMINAL **)0); } -+ -+#undef set_curterm -+TERMINAL *set_curterm( -+ TERMINAL *termp) -+ { return(*(TERMINAL **)0); } -+ -+#undef del_curterm_sp -+int del_curterm_sp( -+ SCREEN *sp, -+ TERMINAL *termp) -+ { return(*(int *)0); } -+ -+#undef del_curterm -+int del_curterm( -+ TERMINAL *termp) -+ { return(*(int *)0); } -+ -+/* ./tinfo/lib_data.c */ -+ -+#undef stdscr -+WINDOW *stdscr; -+#undef curscr -+WINDOW *curscr; -+#undef newscr -+WINDOW *newscr; -+#undef _nc_screen_chain -+SCREEN *_nc_screen_chain; -+#undef SP -+SCREEN *SP; -+#undef _nc_globals -+NCURSES_GLOBALS _nc_globals; -+#undef _nc_prescreen -+NCURSES_PRESCREEN _nc_prescreen; -+ -+#undef _nc_screen_of -+SCREEN *_nc_screen_of( -+ WINDOW *win) -+ { return(*(SCREEN **)0); } -+ -+/* ./tinfo/lib_has_cap.c */ -+ -+#undef has_ic_sp -+NCURSES_BOOL has_ic_sp( -+ SCREEN *sp) -+ { return(*(NCURSES_BOOL *)0); } -+ -+#undef has_ic -+NCURSES_BOOL has_ic(void) -+ { return(*(NCURSES_BOOL *)0); } -+ -+#undef has_il_sp -+NCURSES_BOOL has_il_sp( -+ SCREEN *sp) -+ { return(*(NCURSES_BOOL *)0); } -+ -+#undef has_il -+NCURSES_BOOL has_il(void) -+ { return(*(NCURSES_BOOL *)0); } -+ -+/* ./tinfo/lib_kernel.c */ -+ -+#undef erasechar_sp -+char erasechar_sp( -+ SCREEN *sp) -+ { return(*(char *)0); } -+ -+#undef erasechar -+char erasechar(void) -+ { return(*(char *)0); } -+ -+#undef killchar_sp -+char killchar_sp( -+ SCREEN *sp) -+ { return(*(char *)0); } -+ -+#undef killchar -+char killchar(void) -+ { return(*(char *)0); } -+ -+#undef flushinp_sp -+int flushinp_sp( -+ SCREEN *sp) -+ { return(*(int *)0); } -+ -+#undef flushinp -+int flushinp(void) -+ { return(*(int *)0); } -+ -+/* ./lib_keyname.c */ -+ -+struct kn { short offset; int code; }; -+ -+#undef keyname_sp -+char *keyname_sp( -+ SCREEN *sp, -+ int c) -+ { return(*(char **)0); } -+ -+#undef keyname -+char *keyname( -+ int c) -+ { return(*(char **)0); } -+ -+/* ./tinfo/lib_longname.c */ -+ -+#undef longname -+char *longname(void) -+ { return(*(char **)0); } -+ -+/* ./tinfo/lib_napms.c */ -+ -+#include <sys/time.h> -+ -+#undef napms_sp -+int napms_sp( -+ SCREEN *sp, -+ int ms) -+ { return(*(int *)0); } -+ -+#undef napms -+int napms( -+ int ms) -+ { return(*(int *)0); } -+ -+/* ./tinfo/lib_options.c */ -+ -+#undef idlok -+int idlok( -+ WINDOW *win, -+ NCURSES_BOOL flag) -+ { return(*(int *)0); } -+ -+#undef idcok -+void idcok( -+ WINDOW *win, -+ NCURSES_BOOL flag) -+ { /* void */ } -+ -+#undef halfdelay_sp -+int halfdelay_sp( -+ SCREEN *sp, -+ int t) -+ { return(*(int *)0); } -+ -+#undef halfdelay -+int halfdelay( -+ int t) -+ { return(*(int *)0); } -+ -+#undef nodelay -+int nodelay( -+ WINDOW *win, -+ NCURSES_BOOL flag) -+ { return(*(int *)0); } -+ -+#undef notimeout -+int notimeout( -+ WINDOW *win, -+ NCURSES_BOOL f) -+ { return(*(int *)0); } -+ -+#undef wtimeout -+void wtimeout( -+ WINDOW *win, -+ int delay) -+ { /* void */ } -+ -+#undef keypad -+int keypad( -+ WINDOW *win, -+ NCURSES_BOOL flag) -+ { return(*(int *)0); } -+ -+#undef meta -+int meta( -+ WINDOW *win, -+ NCURSES_BOOL flag) -+ { return(*(int *)0); } -+ -+#undef curs_set_sp -+int curs_set_sp( -+ SCREEN *sp, -+ int vis) -+ { return(*(int *)0); } -+ -+#undef curs_set -+int curs_set( -+ int vis) -+ { return(*(int *)0); } -+ -+#undef typeahead_sp -+int typeahead_sp( -+ SCREEN *sp, -+ int fd) -+ { return(*(int *)0); } -+ -+#undef typeahead -+int typeahead( -+ int fd) -+ { return(*(int *)0); } -+ -+#undef has_key_sp -+int has_key_sp( -+ SCREEN *sp, -+ int keycode) -+ { return(*(int *)0); } -+ -+#undef has_key -+int has_key( -+ int keycode) -+ { return(*(int *)0); } -+ -+#undef _nc_putp_flush_sp -+int _nc_putp_flush_sp( -+ SCREEN *sp, -+ const char *name, -+ const char *value) -+ { return(*(int *)0); } -+ -+#undef _nc_keypad -+int _nc_keypad( -+ SCREEN *sp, -+ int flag) -+ { return(*(int *)0); } -+ -+/* ./tinfo/lib_raw.c */ -+ -+#undef raw_sp -+int raw_sp( -+ SCREEN *sp) -+ { return(*(int *)0); } -+ -+#undef raw -+int raw(void) -+ { return(*(int *)0); } -+ -+#undef cbreak_sp -+int cbreak_sp( -+ SCREEN *sp) -+ { return(*(int *)0); } -+ -+#undef cbreak -+int cbreak(void) -+ { return(*(int *)0); } -+ -+#undef qiflush_sp -+void qiflush_sp( -+ SCREEN *sp) -+ { /* void */ } -+ -+#undef qiflush -+void qiflush(void) -+ { /* void */ } -+ -+#undef noraw_sp -+int noraw_sp( -+ SCREEN *sp) -+ { return(*(int *)0); } -+ -+#undef noraw -+int noraw(void) -+ { return(*(int *)0); } -+ -+#undef nocbreak_sp -+int nocbreak_sp( -+ SCREEN *sp) -+ { return(*(int *)0); } -+ -+#undef nocbreak -+int nocbreak(void) -+ { return(*(int *)0); } -+ -+#undef noqiflush_sp -+void noqiflush_sp( -+ SCREEN *sp) -+ { /* void */ } -+ -+#undef noqiflush -+void noqiflush(void) -+ { /* void */ } -+ -+#undef intrflush_sp -+int intrflush_sp( -+ SCREEN *sp, -+ WINDOW *win, -+ NCURSES_BOOL flag) -+ { return(*(int *)0); } -+ -+#undef intrflush -+int intrflush( -+ WINDOW *win, -+ NCURSES_BOOL flag) -+ { return(*(int *)0); } -+ -+/* ./tinfo/lib_setup.c */ -+ -+#include <locale.h> -+#include <sys/ioctl.h> -+#include <langinfo.h> -+ -+#undef ttytype -+char ttytype[256]; -+#undef LINES -+int LINES; -+#undef COLS -+int COLS; -+#undef TABSIZE -+int TABSIZE; -+ -+#undef set_tabsize_sp -+int set_tabsize_sp( -+ SCREEN *sp, -+ int value) -+ { return(*(int *)0); } -+ -+#undef set_tabsize -+int set_tabsize( -+ int value) -+ { return(*(int *)0); } -+ -+#undef _nc_handle_sigwinch -+int _nc_handle_sigwinch( -+ SCREEN *sp) -+ { return(*(int *)0); } -+ -+#undef use_env_sp -+void use_env_sp( -+ SCREEN *sp, -+ NCURSES_BOOL f) -+ { /* void */ } -+ -+#undef use_tioctl_sp -+void use_tioctl_sp( -+ SCREEN *sp, -+ NCURSES_BOOL f) -+ { /* void */ } -+ -+#undef use_env -+void use_env( -+ NCURSES_BOOL f) -+ { /* void */ } -+ -+#undef use_tioctl -+void use_tioctl( -+ NCURSES_BOOL f) -+ { /* void */ } -+ -+#undef _nc_get_screensize -+void _nc_get_screensize( -+ SCREEN *sp, -+ int *linep, -+ int *colp) -+ { /* void */ } -+ -+#undef _nc_update_screensize -+void _nc_update_screensize( -+ SCREEN *sp) -+ { /* void */ } -+ -+#undef _nc_setup_tinfo -+int _nc_setup_tinfo( -+ const char *const tn, -+ TERMTYPE *const tp) -+ { return(*(int *)0); } -+ -+#undef _nc_tinfo_cmdch -+void _nc_tinfo_cmdch( -+ TERMINAL *termp, -+ int proto) -+ { /* void */ } -+ -+#undef _nc_get_locale -+char *_nc_get_locale(void) -+ { return(*(char **)0); } -+ -+#undef _nc_unicode_locale -+int _nc_unicode_locale(void) -+ { return(*(int *)0); } -+ -+#undef _nc_locale_breaks_acs -+int _nc_locale_breaks_acs( -+ TERMINAL *termp) -+ { return(*(int *)0); } -+ -+#undef _nc_setupterm -+int _nc_setupterm( -+ char *tname, -+ int Filedes, -+ int *errret, -+ int reuse) -+ { return(*(int *)0); } -+ -+#undef new_prescr -+SCREEN *new_prescr(void) -+ { return(*(SCREEN **)0); } -+ -+#undef setupterm -+int setupterm( -+ char *tname, -+ int Filedes, -+ int *errret) -+ { return(*(int *)0); } -+ -+/* ./tinfo/lib_termcap.c */ -+ -+#undef UP -+char *UP; -+#undef BC -+char *BC; -+ -+#undef tgetent_sp -+int tgetent_sp( -+ SCREEN *sp, -+ char *bufp, -+ const char *name) -+ { return(*(int *)0); } -+ -+#if 0 -+ -+#include <capdefaults.c> -+ -+#endif -+ -+#undef tgetent -+int tgetent( -+ char *bufp, -+ const char *name) -+ { return(*(int *)0); } -+ -+#undef tgetflag_sp -+int tgetflag_sp( -+ SCREEN *sp, -+ char *id) -+ { return(*(int *)0); } -+ -+#undef tgetflag -+int tgetflag( -+ char *id) -+ { return(*(int *)0); } -+ -+#undef tgetnum_sp -+int tgetnum_sp( -+ SCREEN *sp, -+ char *id) -+ { return(*(int *)0); } -+ -+#undef tgetnum -+int tgetnum( -+ char *id) -+ { return(*(int *)0); } -+ -+#undef tgetstr_sp -+char *tgetstr_sp( -+ SCREEN *sp, -+ char *id, -+ char **area) -+ { return(*(char **)0); } -+ -+#undef tgetstr -+char *tgetstr( -+ char *id, -+ char **area) -+ { return(*(char **)0); } -+ -+/* ./tinfo/lib_termname.c */ -+ -+#undef termname_sp -+char *termname_sp( -+ SCREEN *sp) -+ { return(*(char **)0); } -+ -+#undef termname -+char *termname(void) -+ { return(*(char **)0); } -+ -+/* ./tinfo/lib_tgoto.c */ -+ -+#undef tgoto -+char *tgoto( -+ const char *string, -+ int x, -+ int y) -+ { return(*(char **)0); } -+ -+/* ./tinfo/lib_ti.c */ -+ -+#undef tigetflag_sp -+int tigetflag_sp( -+ SCREEN *sp, -+ char *str) -+ { return(*(int *)0); } -+ -+#undef tigetflag -+int tigetflag( -+ char *str) -+ { return(*(int *)0); } -+ -+#undef tigetnum_sp -+int tigetnum_sp( -+ SCREEN *sp, -+ char *str) -+ { return(*(int *)0); } -+ -+#undef tigetnum -+int tigetnum( -+ char *str) -+ { return(*(int *)0); } -+ -+#undef tigetstr_sp -+char *tigetstr_sp( -+ SCREEN *sp, -+ char *str) -+ { return(*(char **)0); } -+ -+#undef tigetstr -+char *tigetstr( -+ char *str) -+ { return(*(char **)0); } -+ -+/* ./tinfo/lib_tparm.c */ -+ -+#undef _nc_tparm_err -+int _nc_tparm_err; -+ -+#undef _nc_tparm_analyze -+int _nc_tparm_analyze( -+ const char *string, -+ char *p_is_s[9], -+ int *_nc_popcount) -+ { return(*(int *)0); } -+ -+#undef tparm -+char *tparm( -+ char *string, -+ ...) -+ { return(*(char **)0); } -+ -+#undef tiparm -+char *tiparm( -+ const char *string, -+ ...) -+ { return(*(char **)0); } -+ -+/* ./tinfo/lib_tputs.c */ -+ -+#undef PC -+char PC; -+#undef ospeed -+short ospeed; -+#undef _nc_nulls_sent -+int _nc_nulls_sent; -+ -+#undef _nc_set_no_padding -+void _nc_set_no_padding( -+ SCREEN *sp) -+ { /* void */ } -+ -+#undef delay_output_sp -+int delay_output_sp( -+ SCREEN *sp, -+ int ms) -+ { return(*(int *)0); } -+ -+#undef delay_output -+int delay_output( -+ int ms) -+ { return(*(int *)0); } -+ -+#undef _nc_flush_sp -+void _nc_flush_sp( -+ SCREEN *sp) -+ { /* void */ } -+ -+#undef _nc_flush -+void _nc_flush(void) -+ { /* void */ } -+ -+#undef _nc_outch_sp -+int _nc_outch_sp( -+ SCREEN *sp, -+ int ch) -+ { return(*(int *)0); } -+ -+#undef _nc_outch -+int _nc_outch( -+ int ch) -+ { return(*(int *)0); } -+ -+#undef _nc_putchar_sp -+int _nc_putchar_sp( -+ SCREEN *sp, -+ int ch) -+ { return(*(int *)0); } -+ -+#undef _nc_putchar -+int _nc_putchar( -+ int ch) -+ { return(*(int *)0); } -+ -+#undef putp_sp -+int putp_sp( -+ SCREEN *sp, -+ const char *string) -+ { return(*(int *)0); } -+ -+#undef putp -+int putp( -+ const char *string) -+ { return(*(int *)0); } -+ -+#undef _nc_putp_sp -+int _nc_putp_sp( -+ SCREEN *sp, -+ const char *name, -+ const char *string) -+ { return(*(int *)0); } -+ -+#undef _nc_putp -+int _nc_putp( -+ const char *name, -+ const char *string) -+ { return(*(int *)0); } -+ -+#undef tputs_sp -+int tputs_sp( -+ SCREEN *sp, -+ const char *string, -+ int affcnt, -+ NCURSES_OUTC_sp outc) -+ { return(*(int *)0); } -+ -+#undef _nc_outc_wrapper -+int _nc_outc_wrapper( -+ SCREEN *sp, -+ int c) -+ { return(*(int *)0); } -+ -+#undef tputs -+int tputs( -+ const char *string, -+ int affcnt, -+ int (*outc)( -+ int p1)) -+ { return(*(int *)0); } -+ -+/* ./trace/lib_trace.c */ -+ -+#undef _nc_tracing -+unsigned _nc_tracing; -+#undef _nc_tputs_trace -+const char *_nc_tputs_trace = {0}; -+#undef _nc_outchars -+long _nc_outchars; -+ -+#undef trace -+void trace( -+ const unsigned int tracelevel) -+ { /* void */ } -+ -+#undef _tracef -+void _tracef( -+ const char *fmt, -+ ...) -+ { /* void */ } -+ -+#undef _nc_retrace_bool -+NCURSES_BOOL _nc_retrace_bool( -+ int code) -+ { return(*(NCURSES_BOOL *)0); } -+ -+#undef _nc_retrace_char -+char _nc_retrace_char( -+ int code) -+ { return(*(char *)0); } -+ -+#undef _nc_retrace_int -+int _nc_retrace_int( -+ int code) -+ { return(*(int *)0); } -+ -+#undef _nc_retrace_unsigned -+unsigned _nc_retrace_unsigned( -+ unsigned code) -+ { return(*(unsigned *)0); } -+ -+#undef _nc_retrace_ptr -+char *_nc_retrace_ptr( -+ char *code) -+ { return(*(char **)0); } -+ -+#undef _nc_retrace_cptr -+const char *_nc_retrace_cptr( -+ const char *code) -+ { return(*(const char **)0); } -+ -+#undef _nc_retrace_cvoid_ptr -+void *_nc_retrace_cvoid_ptr( -+ void *code) -+ { return(*(void **)0); } -+ -+#undef _nc_retrace_void_ptr -+void *_nc_retrace_void_ptr( -+ void *code) -+ { return(*(void **)0); } -+ -+#undef _nc_retrace_sp -+SCREEN *_nc_retrace_sp( -+ SCREEN *code) -+ { return(*(SCREEN **)0); } -+ -+#undef _nc_retrace_win -+WINDOW *_nc_retrace_win( -+ WINDOW *code) -+ { return(*(WINDOW **)0); } -+ -+/* ./trace/lib_traceatr.c */ -+ -+#undef _traceattr2 -+char *_traceattr2( -+ int bufnum, -+ chtype newmode) -+ { return(*(char **)0); } -+ -+#undef _traceattr -+char *_traceattr( -+ attr_t newmode) -+ { return(*(char **)0); } -+ -+#undef _nc_retrace_int_attr_t -+int _nc_retrace_int_attr_t( -+ attr_t code) -+ { return(*(int *)0); } -+ -+#undef _nc_retrace_attr_t -+attr_t _nc_retrace_attr_t( -+ attr_t code) -+ { return(*(attr_t *)0); } -+ -+#undef _nc_altcharset_name -+const char *_nc_altcharset_name( -+ attr_t attr, -+ chtype ch) -+ { return(*(const char **)0); } -+ -+#undef _tracechtype2 -+char *_tracechtype2( -+ int bufnum, -+ chtype ch) -+ { return(*(char **)0); } -+ -+#undef _tracechtype -+char *_tracechtype( -+ chtype ch) -+ { return(*(char **)0); } -+ -+#undef _nc_retrace_chtype -+chtype _nc_retrace_chtype( -+ chtype code) -+ { return(*(chtype *)0); } -+ -+/* ./trace/lib_tracebits.c */ -+ -+typedef struct { -+ unsigned int val; -+ const char *name; -+} BITNAMES; -+ -+#undef _nc_trace_ttymode -+char *_nc_trace_ttymode( -+ struct termios *tty) -+ { return(*(char **)0); } -+ -+#undef _nc_tracebits -+char *_nc_tracebits(void) -+ { return(*(char **)0); } -+ -+/* ./trace/lib_tracechr.c */ -+ -+#undef _nc_tracechar -+char *_nc_tracechar( -+ SCREEN *sp, -+ int ch) -+ { return(*(char **)0); } -+ -+#undef _tracechar -+char *_tracechar( -+ int ch) -+ { return(*(char **)0); } -+ -+/* ./tinfo/lib_ttyflags.c */ -+ -+#undef _nc_get_tty_mode_sp -+int _nc_get_tty_mode_sp( -+ SCREEN *sp, -+ struct termios *buf) -+ { return(*(int *)0); } -+ -+#undef _nc_get_tty_mode -+int _nc_get_tty_mode( -+ struct termios *buf) -+ { return(*(int *)0); } -+ -+#undef _nc_set_tty_mode_sp -+int _nc_set_tty_mode_sp( -+ SCREEN *sp, -+ struct termios *buf) -+ { return(*(int *)0); } -+ -+#undef _nc_set_tty_mode -+int _nc_set_tty_mode( -+ struct termios *buf) -+ { return(*(int *)0); } -+ -+#undef def_shell_mode_sp -+int def_shell_mode_sp( -+ SCREEN *sp) -+ { return(*(int *)0); } -+ -+#undef def_shell_mode -+int def_shell_mode(void) -+ { return(*(int *)0); } -+ -+#undef def_prog_mode_sp -+int def_prog_mode_sp( -+ SCREEN *sp) -+ { return(*(int *)0); } -+ -+#undef def_prog_mode -+int def_prog_mode(void) -+ { return(*(int *)0); } -+ -+#undef reset_prog_mode_sp -+int reset_prog_mode_sp( -+ SCREEN *sp) -+ { return(*(int *)0); } -+ -+#undef reset_prog_mode -+int reset_prog_mode(void) -+ { return(*(int *)0); } -+ -+#undef reset_shell_mode_sp -+int reset_shell_mode_sp( -+ SCREEN *sp) -+ { return(*(int *)0); } -+ -+#undef reset_shell_mode -+int reset_shell_mode(void) -+ { return(*(int *)0); } -+ -+#undef savetty_sp -+int savetty_sp( -+ SCREEN *sp) -+ { return(*(int *)0); } -+ -+#undef savetty -+int savetty(void) -+ { return(*(int *)0); } -+ -+#undef resetty_sp -+int resetty_sp( -+ SCREEN *sp) -+ { return(*(int *)0); } -+ -+#undef resetty -+int resetty(void) -+ { return(*(int *)0); } -+ -+/* ./tty/lib_twait.c */ -+ -+#undef _nc_timed_wait -+int _nc_timed_wait( -+ SCREEN *sp, -+ int mode, -+ int milliseconds, -+ int *timeleft) -+ { return(*(int *)0); } -+ -+/* ./tinfo/name_match.c */ -+ -+#undef _nc_first_name -+char *_nc_first_name( -+ const char *const sp) -+ { return(*(char **)0); } -+ -+#undef _nc_name_match -+int _nc_name_match( -+ const char *const namelst, -+ const char *const name, -+ const char *const delim) -+ { return(*(int *)0); } -+ -+/* ./names.c */ -+ -+#undef boolnames -+char *const boolnames[] = {0}; -+#undef boolfnames -+char *const boolfnames[] = {0}; -+#undef numnames -+char *const numnames[] = {0}; -+#undef numfnames -+char *const numfnames[] = {0}; -+#undef strnames -+char *const strnames[] = {0}; -+#undef strfnames -+char *const strfnames[] = {0}; -+ -+/* ./tinfo/obsolete.c */ -+ -+#undef _nc_set_buffer_sp -+void _nc_set_buffer_sp( -+ SCREEN *sp, -+ FILE *ofp, -+ int buffered) -+ { /* void */ } -+ -+#undef _nc_set_buffer -+void _nc_set_buffer( -+ FILE *ofp, -+ int buffered) -+ { /* void */ } -+ -+/* ./tinfo/read_entry.c */ -+ -+#include <hashed_db.h> -+ -+#undef _nc_init_termtype -+void _nc_init_termtype( -+ TERMTYPE *const tp) -+ { /* void */ } -+ -+#undef _nc_read_termtype -+int _nc_read_termtype( -+ TERMTYPE *ptr, -+ char *buffer, -+ int limit) -+ { return(*(int *)0); } -+ -+#undef _nc_read_file_entry -+int _nc_read_file_entry( -+ const char *const filename, -+ TERMTYPE *ptr) -+ { return(*(int *)0); } -+ -+#undef _nc_read_entry -+int _nc_read_entry( -+ const char *const name, -+ char *const filename, -+ TERMTYPE *const tp) -+ { return(*(int *)0); } -+ -+/* ./tinfo/read_termcap.c */ -+ -+#include <sys/types.h> -+ -+#undef _nc_read_termcap -+void _nc_read_termcap(void) -+ { /* void */ } -+ -+/* ./tinfo/strings.c */ -+ -+#undef _nc_str_init -+string_desc *_nc_str_init( -+ string_desc *dst, -+ char *src, -+ size_t len) -+ { return(*(string_desc **)0); } -+ -+#undef _nc_str_null -+string_desc *_nc_str_null( -+ string_desc *dst, -+ size_t len) -+ { return(*(string_desc **)0); } -+ -+#undef _nc_str_copy -+string_desc *_nc_str_copy( -+ string_desc *dst, -+ string_desc *src) -+ { return(*(string_desc **)0); } -+ -+#undef _nc_safe_strcat -+NCURSES_BOOL _nc_safe_strcat( -+ string_desc *dst, -+ const char *src) -+ { return(*(NCURSES_BOOL *)0); } -+ -+#undef _nc_safe_strcpy -+NCURSES_BOOL _nc_safe_strcpy( -+ string_desc *dst, -+ const char *src) -+ { return(*(NCURSES_BOOL *)0); } -+ -+/* ./trace/trace_buf.c */ -+ -+#undef _nc_trace_buf -+char *_nc_trace_buf( -+ int bufnum, -+ size_t want) -+ { return(*(char **)0); } -+ -+#undef _nc_trace_bufcat -+char *_nc_trace_bufcat( -+ int bufnum, -+ const char *value) -+ { return(*(char **)0); } -+ -+/* ./trace/trace_tries.c */ -+ -+#undef _nc_trace_tries -+void _nc_trace_tries( -+ TRIES *tree) -+ { /* void */ } -+ -+/* ./base/tries.c */ -+ -+#undef _nc_expand_try -+char *_nc_expand_try( -+ TRIES *tree, -+ unsigned code, -+ int *count, -+ size_t len) -+ { return(*(char **)0); } -+ -+#undef _nc_remove_key -+int _nc_remove_key( -+ TRIES **tree, -+ unsigned code) -+ { return(*(int *)0); } -+ -+#undef _nc_remove_string -+int _nc_remove_string( -+ TRIES **tree, -+ const char *string) -+ { return(*(int *)0); } -+ -+/* ./tinfo/trim_sgr0.c */ -+ -+#undef _nc_trim_sgr0 -+char *_nc_trim_sgr0( -+ TERMTYPE *tp) -+ { return(*(char **)0); } -+ -+/* ./unctrl.c */ -+ -+#undef unctrl_sp -+char *unctrl_sp( -+ SCREEN *sp, -+ chtype ch) -+ { return(*(char **)0); } -+ -+#undef unctrl -+char *unctrl( -+ chtype ch) -+ { return(*(char **)0); } -+ -+/* ./trace/visbuf.c */ -+ -+#undef _nc_visbuf2 -+const char *_nc_visbuf2( -+ int bufnum, -+ const char *buf) -+ { return(*(const char **)0); } -+ -+#undef _nc_visbuf -+const char *_nc_visbuf( -+ const char *buf) -+ { return(*(const char **)0); } -+ -+#undef _nc_visbufn -+const char *_nc_visbufn( -+ const char *buf, -+ int len) -+ { return(*(const char **)0); } -+ -+#undef _nc_viscbuf2 -+const char *_nc_viscbuf2( -+ int bufnum, -+ const chtype *buf, -+ int len) -+ { return(*(const char **)0); } -+ -+#undef _nc_viscbuf -+const char *_nc_viscbuf( -+ const chtype *buf, -+ int len) -+ { return(*(const char **)0); } -+ -+/* ./base/define_key.c */ -+ -+#undef define_key_sp -+int define_key_sp( -+ SCREEN *sp, -+ const char *str, -+ int keycode) -+ { return(*(int *)0); } -+ -+#undef define_key -+int define_key( -+ const char *str, -+ int keycode) -+ { return(*(int *)0); } -+ -+/* ./tinfo/hashed_db.c */ -+ -+#undef _nc_hashed_db -+void _nc_hashed_db(void) -+ { /* void */ } -+ -+/* ./base/key_defined.c */ -+ -+#undef key_defined_sp -+int key_defined_sp( -+ SCREEN *sp, -+ const char *str) -+ { return(*(int *)0); } -+ -+#undef key_defined -+int key_defined( -+ const char *str) -+ { return(*(int *)0); } -+ -+/* ./base/keybound.c */ -+ -+#undef keybound_sp -+char *keybound_sp( -+ SCREEN *sp, -+ int code, -+ int count) -+ { return(*(char **)0); } -+ -+#undef keybound -+char *keybound( -+ int code, -+ int count) -+ { return(*(char **)0); } -+ -+/* ./base/keyok.c */ -+ -+#undef keyok_sp -+int keyok_sp( -+ SCREEN *sp, -+ int c, -+ NCURSES_BOOL flag) -+ { return(*(int *)0); } -+ -+#undef keyok -+int keyok( -+ int c, -+ NCURSES_BOOL flag) -+ { return(*(int *)0); } -+ -+/* ./base/version.c */ -+ -+#undef curses_version -+const char *curses_version(void) -+ { return(*(const char **)0); } -diff -Naur ncurses-5.9/ncurses/llib-ltinfot ncurses-5.9.patch/ncurses/llib-ltinfot ---- ncurses-5.9/ncurses/llib-ltinfot 1970-01-01 01:00:00.000000000 +0100 -+++ ncurses-5.9.patch/ncurses/llib-ltinfot 2014-09-01 16:33:22.418792225 +0200 -@@ -0,0 +1,1635 @@ -+/**************************************************************************** -+ * Copyright (c) 2013 Free Software Foundation, Inc. * -+ * * -+ * Permission is hereby granted, free of charge, to any person obtaining a * -+ * copy of this software and associated documentation files (the * -+ * "Software"), to deal in the Software without restriction, including * -+ * without limitation the rights to use, copy, modify, merge, publish, * -+ * distribute, distribute with modifications, sublicense, and/or sell * -+ * copies of the Software, and to permit persons to whom the Software is * -+ * furnished to do so, subject to the following conditions: * -+ * * -+ * The above copyright notice and this permission notice shall be included * -+ * in all copies or substantial portions of the Software. * -+ * * -+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * -+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * -+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * -+ * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * -+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * -+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * -+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * -+ * * -+ * Except as contained in this notice, the name(s) of the above copyright * -+ * holders shall not be used in advertising or otherwise to promote the * -+ * sale, use or other dealings in this Software without prior written * -+ * authorization. * -+ ****************************************************************************/ -+ -+/**************************************************************************** -+ * Author: Thomas E. Dickey 2013 * -+ ****************************************************************************/ -+/* LINTLIBRARY */ -+ -+/* ./tinfo/access.c */ -+ -+#include <curses.priv.h> -+#include <ctype.h> -+#include <tic.h> -+ -+#undef _nc_rootname -+char *_nc_rootname( -+ char *path) -+ { return(*(char **)0); } -+ -+#undef _nc_is_abs_path -+NCURSES_BOOL _nc_is_abs_path( -+ const char *path) -+ { return(*(NCURSES_BOOL *)0); } -+ -+#undef _nc_pathlast -+unsigned _nc_pathlast( -+ const char *path) -+ { return(*(unsigned *)0); } -+ -+#undef _nc_basename -+char *_nc_basename( -+ char *path) -+ { return(*(char **)0); } -+ -+#undef _nc_access -+int _nc_access( -+ const char *path, -+ int mode) -+ { return(*(int *)0); } -+ -+#undef _nc_is_dir_path -+NCURSES_BOOL _nc_is_dir_path( -+ const char *path) -+ { return(*(NCURSES_BOOL *)0); } -+ -+#undef _nc_is_file_path -+NCURSES_BOOL _nc_is_file_path( -+ const char *path) -+ { return(*(NCURSES_BOOL *)0); } -+ -+#undef _nc_env_access -+int _nc_env_access(void) -+ { return(*(int *)0); } -+ -+/* ./tinfo/add_tries.c */ -+ -+#undef _nc_add_to_try -+int _nc_add_to_try( -+ TRIES **tree, -+ const char *str, -+ unsigned code) -+ { return(*(int *)0); } -+ -+/* ./tinfo/alloc_ttype.c */ -+ -+#undef _nc_align_termtype -+void _nc_align_termtype( -+ TERMTYPE *to, -+ TERMTYPE *from) -+ { /* void */ } -+ -+#undef _nc_copy_termtype -+void _nc_copy_termtype( -+ TERMTYPE *dst, -+ const TERMTYPE *src) -+ { /* void */ } -+ -+/* ./codes.c */ -+ -+#undef _nc_boolcodes -+char *const *_nc_boolcodes(void) -+ { return(*(char **)0); } -+ -+#undef _nc_numcodes -+char *const *_nc_numcodes(void) -+ { return(*(char **)0); } -+ -+#undef _nc_strcodes -+char *const *_nc_strcodes(void) -+ { return(*(char **)0); } -+ -+/* ./comp_captab.c */ -+ -+#include <hashsize.h> -+ -+#undef _nc_get_table -+const struct name_table_entry *_nc_get_table( -+ NCURSES_BOOL termcap) -+ { return(*(const struct name_table_entry **)0); } -+ -+#undef _nc_get_hash_table -+const HashValue *_nc_get_hash_table( -+ NCURSES_BOOL termcap) -+ { return(*(const HashValue **)0); } -+ -+#undef _nc_get_alias_table -+const struct alias *_nc_get_alias_table( -+ NCURSES_BOOL termcap) -+ { return(*(const struct alias **)0); } -+ -+#undef _nc_get_hash_info -+const HashData *_nc_get_hash_info( -+ NCURSES_BOOL termcap) -+ { return(*(const HashData **)0); } -+ -+/* ./tinfo/comp_error.c */ -+ -+#undef _nc_suppress_warnings -+NCURSES_BOOL _nc_suppress_warnings; -+#undef _nc_curr_line -+int _nc_curr_line; -+#undef _nc_curr_col -+int _nc_curr_col; -+ -+#undef _nc_get_source -+const char *_nc_get_source(void) -+ { return(*(const char **)0); } -+ -+#undef _nc_set_source -+void _nc_set_source( -+ const char *const name) -+ { /* void */ } -+ -+#undef _nc_set_type -+void _nc_set_type( -+ const char *const name) -+ { /* void */ } -+ -+#undef _nc_get_type -+void _nc_get_type( -+ char *name) -+ { /* void */ } -+ -+#undef _nc_warning -+void _nc_warning( -+ const char *const fmt, -+ ...) -+ { /* void */ } -+ -+#undef _nc_err_abort -+void _nc_err_abort( -+ const char *const fmt, -+ ...) -+ { /* void */ } -+ -+#undef _nc_syserr_abort -+void _nc_syserr_abort( -+ const char *const fmt, -+ ...) -+ { /* void */ } -+ -+/* ./tinfo/comp_hash.c */ -+ -+#undef _nc_find_entry -+struct name_table_entry const *_nc_find_entry( -+ const char *string, -+ const HashValue *hash_table) -+ { return(*(struct name_table_entry const **)0); } -+ -+#undef _nc_find_type_entry -+struct name_table_entry const *_nc_find_type_entry( -+ const char *string, -+ int type, -+ NCURSES_BOOL termcap) -+ { return(*(struct name_table_entry const **)0); } -+ -+/* ./tinfo/db_iterator.c */ -+ -+#include <time.h> -+ -+#undef _nc_tic_dir -+const char *_nc_tic_dir( -+ const char *path) -+ { return(*(const char **)0); } -+ -+#undef _nc_keep_tic_dir -+void _nc_keep_tic_dir( -+ const char *path) -+ { /* void */ } -+ -+#undef _nc_last_db -+void _nc_last_db(void) -+ { /* void */ } -+ -+#undef _nc_next_db -+const char *_nc_next_db( -+ DBDIRS *state, -+ int *offset) -+ { return(*(const char **)0); } -+ -+#undef _nc_first_db -+void _nc_first_db( -+ DBDIRS *state, -+ int *offset) -+ { /* void */ } -+ -+/* ./tinfo/doalloc.c */ -+ -+#undef _nc_doalloc -+void *_nc_doalloc( -+ void *oldp, -+ size_t amount) -+ { return(*(void **)0); } -+ -+/* ./tinfo/entries.c */ -+ -+#undef _nc_head -+ENTRY *_nc_head; -+#undef _nc_tail -+ENTRY *_nc_tail; -+ -+#undef _nc_free_entry -+void _nc_free_entry( -+ ENTRY *headp, -+ TERMTYPE *tterm) -+ { /* void */ } -+ -+#undef _nc_free_entries -+void _nc_free_entries( -+ ENTRY *headp) -+ { /* void */ } -+ -+#undef _nc_delink_entry -+ENTRY *_nc_delink_entry( -+ ENTRY *headp, -+ TERMTYPE *tterm) -+ { return(*(ENTRY **)0); } -+ -+#undef _nc_leaks_tinfo -+void _nc_leaks_tinfo(void) -+ { /* void */ } -+ -+/* ./fallback.c */ -+ -+#undef _nc_fallback -+const TERMTYPE *_nc_fallback( -+ const char *name) -+ { return(*(const TERMTYPE **)0); } -+ -+/* ./tinfo/free_ttype.c */ -+ -+#undef _nc_free_termtype -+void _nc_free_termtype( -+ TERMTYPE *ptr) -+ { /* void */ } -+ -+#undef _nc_user_definable -+NCURSES_BOOL _nc_user_definable; -+ -+#undef use_extended_names -+int use_extended_names( -+ NCURSES_BOOL flag) -+ { return(*(int *)0); } -+ -+/* ./tinfo/getenv_num.c */ -+ -+#undef _nc_getenv_num -+int _nc_getenv_num( -+ const char *name) -+ { return(*(int *)0); } -+ -+#undef _nc_setenv_num -+void _nc_setenv_num( -+ const char *name, -+ int value) -+ { /* void */ } -+ -+/* ./tinfo/home_terminfo.c */ -+ -+#undef _nc_home_terminfo -+char *_nc_home_terminfo(void) -+ { return(*(char **)0); } -+ -+/* ./tinfo/init_keytry.c */ -+ -+#if 0 -+ -+#include <init_keytry.h> -+ -+#undef _nc_tinfo_fkeys -+const struct tinfo_fkeys _nc_tinfo_fkeys[] = {0}; -+ -+#endif -+ -+#undef _nc_init_keytry -+void _nc_init_keytry( -+ SCREEN *sp) -+ { /* void */ } -+ -+/* ./tinfo/lib_acs.c */ -+ -+#undef _nc_acs_map -+chtype *_nc_acs_map(void) -+ { return(*(chtype **)0); } -+ -+#undef _nc_init_acs_sp -+void _nc_init_acs_sp( -+ SCREEN *sp) -+ { /* void */ } -+ -+#undef _nc_init_acs -+void _nc_init_acs(void) -+ { /* void */ } -+ -+/* ./tinfo/lib_baudrate.c */ -+ -+#include <termcap.h> -+ -+struct speed { -+ int s; -+ int sp; -+}; -+ -+#undef _nc_baudrate -+int _nc_baudrate( -+ int OSpeed) -+ { return(*(int *)0); } -+ -+#undef _nc_ospeed -+int _nc_ospeed( -+ int BaudRate) -+ { return(*(int *)0); } -+ -+#undef baudrate_sp -+int baudrate_sp( -+ SCREEN *sp) -+ { return(*(int *)0); } -+ -+#undef baudrate -+int baudrate(void) -+ { return(*(int *)0); } -+ -+/* ./tinfo/lib_cur_term.c */ -+ -+#undef _nc_get_cur_term_sp -+TERMINAL *_nc_get_cur_term_sp( -+ SCREEN *sp) -+ { return(*(TERMINAL **)0); } -+ -+#undef _nc_get_cur_term -+TERMINAL *_nc_get_cur_term(void) -+ { return(*(TERMINAL **)0); } -+ -+#undef _nc_cur_term -+TERMINAL *_nc_cur_term(void) -+ { return(*(TERMINAL **)0); } -+ -+#undef set_curterm_sp -+TERMINAL *set_curterm_sp( -+ SCREEN *sp, -+ TERMINAL *termp) -+ { return(*(TERMINAL **)0); } -+ -+#undef set_curterm -+TERMINAL *set_curterm( -+ TERMINAL *termp) -+ { return(*(TERMINAL **)0); } -+ -+#undef del_curterm_sp -+int del_curterm_sp( -+ SCREEN *sp, -+ TERMINAL *termp) -+ { return(*(int *)0); } -+ -+#undef del_curterm -+int del_curterm( -+ TERMINAL *termp) -+ { return(*(int *)0); } -+ -+/* ./tinfo/lib_data.c */ -+ -+#undef _nc_stdscr -+WINDOW *_nc_stdscr(void) -+ { return(*(WINDOW **)0); } -+ -+#undef _nc_curscr -+WINDOW *_nc_curscr(void) -+ { return(*(WINDOW **)0); } -+ -+#undef _nc_newscr -+WINDOW *_nc_newscr(void) -+ { return(*(WINDOW **)0); } -+ -+#undef _nc_screen_chain -+SCREEN *_nc_screen_chain; -+#undef SP -+SCREEN *SP; -+#undef _nc_globals -+NCURSES_GLOBALS _nc_globals; -+#undef _nc_prescreen -+NCURSES_PRESCREEN _nc_prescreen; -+ -+#undef _nc_screen_of -+SCREEN *_nc_screen_of( -+ WINDOW *win) -+ { return(*(SCREEN **)0); } -+ -+#undef _nc_init_pthreads -+void _nc_init_pthreads(void) -+ { /* void */ } -+ -+#undef _nc_mutex_init -+void _nc_mutex_init( -+ pthread_mutex_t *obj) -+ { /* void */ } -+ -+#undef _nc_mutex_lock -+int _nc_mutex_lock( -+ pthread_mutex_t *obj) -+ { return(*(int *)0); } -+ -+#undef _nc_mutex_trylock -+int _nc_mutex_trylock( -+ pthread_mutex_t *obj) -+ { return(*(int *)0); } -+ -+#undef _nc_mutex_unlock -+int _nc_mutex_unlock( -+ pthread_mutex_t *obj) -+ { return(*(int *)0); } -+ -+/* ./tinfo/lib_has_cap.c */ -+ -+#undef has_ic_sp -+NCURSES_BOOL has_ic_sp( -+ SCREEN *sp) -+ { return(*(NCURSES_BOOL *)0); } -+ -+#undef has_ic -+NCURSES_BOOL has_ic(void) -+ { return(*(NCURSES_BOOL *)0); } -+ -+#undef has_il_sp -+NCURSES_BOOL has_il_sp( -+ SCREEN *sp) -+ { return(*(NCURSES_BOOL *)0); } -+ -+#undef has_il -+NCURSES_BOOL has_il(void) -+ { return(*(NCURSES_BOOL *)0); } -+ -+/* ./tinfo/lib_kernel.c */ -+ -+#undef erasechar_sp -+char erasechar_sp( -+ SCREEN *sp) -+ { return(*(char *)0); } -+ -+#undef erasechar -+char erasechar(void) -+ { return(*(char *)0); } -+ -+#undef killchar_sp -+char killchar_sp( -+ SCREEN *sp) -+ { return(*(char *)0); } -+ -+#undef killchar -+char killchar(void) -+ { return(*(char *)0); } -+ -+#undef flushinp_sp -+int flushinp_sp( -+ SCREEN *sp) -+ { return(*(int *)0); } -+ -+#undef flushinp -+int flushinp(void) -+ { return(*(int *)0); } -+ -+/* ./lib_keyname.c */ -+ -+struct kn { short offset; int code; }; -+ -+#undef keyname_sp -+char *keyname_sp( -+ SCREEN *sp, -+ int c) -+ { return(*(char **)0); } -+ -+#undef keyname -+char *keyname( -+ int c) -+ { return(*(char **)0); } -+ -+/* ./tinfo/lib_longname.c */ -+ -+#undef longname_sp -+char *longname_sp( -+ SCREEN *sp) -+ { return(*(char **)0); } -+ -+#undef longname -+char *longname(void) -+ { return(*(char **)0); } -+ -+/* ./tinfo/lib_napms.c */ -+ -+#undef napms_sp -+int napms_sp( -+ SCREEN *sp, -+ int ms) -+ { return(*(int *)0); } -+ -+#undef napms -+int napms( -+ int ms) -+ { return(*(int *)0); } -+ -+/* ./tinfo/lib_options.c */ -+ -+#undef idlok -+int idlok( -+ WINDOW *win, -+ NCURSES_BOOL flag) -+ { return(*(int *)0); } -+ -+#undef idcok -+void idcok( -+ WINDOW *win, -+ NCURSES_BOOL flag) -+ { /* void */ } -+ -+#undef halfdelay_sp -+int halfdelay_sp( -+ SCREEN *sp, -+ int t) -+ { return(*(int *)0); } -+ -+#undef halfdelay -+int halfdelay( -+ int t) -+ { return(*(int *)0); } -+ -+#undef nodelay -+int nodelay( -+ WINDOW *win, -+ NCURSES_BOOL flag) -+ { return(*(int *)0); } -+ -+#undef notimeout -+int notimeout( -+ WINDOW *win, -+ NCURSES_BOOL f) -+ { return(*(int *)0); } -+ -+#undef wtimeout -+void wtimeout( -+ WINDOW *win, -+ int delay) -+ { /* void */ } -+ -+#undef keypad -+int keypad( -+ WINDOW *win, -+ NCURSES_BOOL flag) -+ { return(*(int *)0); } -+ -+#undef meta -+int meta( -+ WINDOW *win, -+ NCURSES_BOOL flag) -+ { return(*(int *)0); } -+ -+#undef curs_set_sp -+int curs_set_sp( -+ SCREEN *sp, -+ int vis) -+ { return(*(int *)0); } -+ -+#undef curs_set -+int curs_set( -+ int vis) -+ { return(*(int *)0); } -+ -+#undef typeahead_sp -+int typeahead_sp( -+ SCREEN *sp, -+ int fd) -+ { return(*(int *)0); } -+ -+#undef typeahead -+int typeahead( -+ int fd) -+ { return(*(int *)0); } -+ -+#undef has_key_sp -+int has_key_sp( -+ SCREEN *sp, -+ int keycode) -+ { return(*(int *)0); } -+ -+#undef has_key -+int has_key( -+ int keycode) -+ { return(*(int *)0); } -+ -+#undef _nc_putp_flush_sp -+int _nc_putp_flush_sp( -+ SCREEN *sp, -+ const char *name, -+ const char *value) -+ { return(*(int *)0); } -+ -+#undef _nc_keypad -+int _nc_keypad( -+ SCREEN *sp, -+ int flag) -+ { return(*(int *)0); } -+ -+/* ./tinfo/lib_raw.c */ -+ -+#undef raw_sp -+int raw_sp( -+ SCREEN *sp) -+ { return(*(int *)0); } -+ -+#undef raw -+int raw(void) -+ { return(*(int *)0); } -+ -+#undef cbreak_sp -+int cbreak_sp( -+ SCREEN *sp) -+ { return(*(int *)0); } -+ -+#undef cbreak -+int cbreak(void) -+ { return(*(int *)0); } -+ -+#undef qiflush_sp -+void qiflush_sp( -+ SCREEN *sp) -+ { /* void */ } -+ -+#undef qiflush -+void qiflush(void) -+ { /* void */ } -+ -+#undef noraw_sp -+int noraw_sp( -+ SCREEN *sp) -+ { return(*(int *)0); } -+ -+#undef noraw -+int noraw(void) -+ { return(*(int *)0); } -+ -+#undef nocbreak_sp -+int nocbreak_sp( -+ SCREEN *sp) -+ { return(*(int *)0); } -+ -+#undef nocbreak -+int nocbreak(void) -+ { return(*(int *)0); } -+ -+#undef noqiflush_sp -+void noqiflush_sp( -+ SCREEN *sp) -+ { /* void */ } -+ -+#undef noqiflush -+void noqiflush(void) -+ { /* void */ } -+ -+#undef intrflush_sp -+int intrflush_sp( -+ SCREEN *sp, -+ WINDOW *win, -+ NCURSES_BOOL flag) -+ { return(*(int *)0); } -+ -+#undef intrflush -+int intrflush( -+ WINDOW *win, -+ NCURSES_BOOL flag) -+ { return(*(int *)0); } -+ -+/* ./tinfo/lib_setup.c */ -+ -+#include <locale.h> -+#include <sys/ioctl.h> -+#include <langinfo.h> -+ -+#undef _nc_ttytype -+char *_nc_ttytype(void) -+ { return(*(char **)0); } -+ -+#undef _nc_ptr_Lines -+int *_nc_ptr_Lines( -+ SCREEN *sp) -+ { return(*(int **)0); } -+ -+#undef _nc_LINES -+int _nc_LINES(void) -+ { return(*(int *)0); } -+ -+#undef _nc_ptr_Cols -+int *_nc_ptr_Cols( -+ SCREEN *sp) -+ { return(*(int **)0); } -+ -+#undef _nc_COLS -+int _nc_COLS(void) -+ { return(*(int *)0); } -+ -+#undef _nc_ptr_Tabsize -+int *_nc_ptr_Tabsize( -+ SCREEN *sp) -+ { return(*(int **)0); } -+ -+#undef _nc_TABSIZE -+int _nc_TABSIZE(void) -+ { return(*(int *)0); } -+ -+#undef set_tabsize_sp -+int set_tabsize_sp( -+ SCREEN *sp, -+ int value) -+ { return(*(int *)0); } -+ -+#undef set_tabsize -+int set_tabsize( -+ int value) -+ { return(*(int *)0); } -+ -+#undef _nc_handle_sigwinch -+int _nc_handle_sigwinch( -+ SCREEN *sp) -+ { return(*(int *)0); } -+ -+#undef use_env_sp -+void use_env_sp( -+ SCREEN *sp, -+ NCURSES_BOOL f) -+ { /* void */ } -+ -+#undef use_tioctl_sp -+void use_tioctl_sp( -+ SCREEN *sp, -+ NCURSES_BOOL f) -+ { /* void */ } -+ -+#undef use_env -+void use_env( -+ NCURSES_BOOL f) -+ { /* void */ } -+ -+#undef use_tioctl -+void use_tioctl( -+ NCURSES_BOOL f) -+ { /* void */ } -+ -+#undef _nc_get_screensize -+void _nc_get_screensize( -+ SCREEN *sp, -+ int *linep, -+ int *colp) -+ { /* void */ } -+ -+#undef _nc_update_screensize -+void _nc_update_screensize( -+ SCREEN *sp) -+ { /* void */ } -+ -+#undef _nc_setup_tinfo -+int _nc_setup_tinfo( -+ const char *const tn, -+ TERMTYPE *const tp) -+ { return(*(int *)0); } -+ -+#undef _nc_tinfo_cmdch -+void _nc_tinfo_cmdch( -+ TERMINAL *termp, -+ int proto) -+ { /* void */ } -+ -+#undef _nc_get_locale -+char *_nc_get_locale(void) -+ { return(*(char **)0); } -+ -+#undef _nc_unicode_locale -+int _nc_unicode_locale(void) -+ { return(*(int *)0); } -+ -+#undef _nc_locale_breaks_acs -+int _nc_locale_breaks_acs( -+ TERMINAL *termp) -+ { return(*(int *)0); } -+ -+#undef _nc_setupterm -+int _nc_setupterm( -+ char *tname, -+ int Filedes, -+ int *errret, -+ int reuse) -+ { return(*(int *)0); } -+ -+#undef new_prescr -+SCREEN *new_prescr(void) -+ { return(*(SCREEN **)0); } -+ -+#undef setupterm -+int setupterm( -+ char *tname, -+ int Filedes, -+ int *errret) -+ { return(*(int *)0); } -+ -+/* ./tinfo/lib_termcap.c */ -+ -+#undef UP -+char *UP; -+#undef BC -+char *BC; -+ -+#undef tgetent_sp -+int tgetent_sp( -+ SCREEN *sp, -+ char *bufp, -+ const char *name) -+ { return(*(int *)0); } -+ -+#if 0 -+ -+#include <capdefaults.c> -+ -+#endif -+ -+#undef tgetent -+int tgetent( -+ char *bufp, -+ const char *name) -+ { return(*(int *)0); } -+ -+#undef tgetflag_sp -+int tgetflag_sp( -+ SCREEN *sp, -+ char *id) -+ { return(*(int *)0); } -+ -+#undef tgetflag -+int tgetflag( -+ char *id) -+ { return(*(int *)0); } -+ -+#undef tgetnum_sp -+int tgetnum_sp( -+ SCREEN *sp, -+ char *id) -+ { return(*(int *)0); } -+ -+#undef tgetnum -+int tgetnum( -+ char *id) -+ { return(*(int *)0); } -+ -+#undef tgetstr_sp -+char *tgetstr_sp( -+ SCREEN *sp, -+ char *id, -+ char **area) -+ { return(*(char **)0); } -+ -+#undef tgetstr -+char *tgetstr( -+ char *id, -+ char **area) -+ { return(*(char **)0); } -+ -+/* ./tinfo/lib_termname.c */ -+ -+#undef termname_sp -+char *termname_sp( -+ SCREEN *sp) -+ { return(*(char **)0); } -+ -+#undef termname -+char *termname(void) -+ { return(*(char **)0); } -+ -+/* ./tinfo/lib_tgoto.c */ -+ -+#undef tgoto -+char *tgoto( -+ const char *string, -+ int x, -+ int y) -+ { return(*(char **)0); } -+ -+/* ./tinfo/lib_ti.c */ -+ -+#undef tigetflag_sp -+int tigetflag_sp( -+ SCREEN *sp, -+ char *str) -+ { return(*(int *)0); } -+ -+#undef tigetflag -+int tigetflag( -+ char *str) -+ { return(*(int *)0); } -+ -+#undef tigetnum_sp -+int tigetnum_sp( -+ SCREEN *sp, -+ char *str) -+ { return(*(int *)0); } -+ -+#undef tigetnum -+int tigetnum( -+ char *str) -+ { return(*(int *)0); } -+ -+#undef tigetstr_sp -+char *tigetstr_sp( -+ SCREEN *sp, -+ char *str) -+ { return(*(char **)0); } -+ -+#undef tigetstr -+char *tigetstr( -+ char *str) -+ { return(*(char **)0); } -+ -+/* ./tinfo/lib_tparm.c */ -+ -+#undef _nc_tparm_err -+int _nc_tparm_err; -+ -+#undef _nc_tparm_analyze -+int _nc_tparm_analyze( -+ const char *string, -+ char *p_is_s[9], -+ int *_nc_popcount) -+ { return(*(int *)0); } -+ -+#undef tparm -+char *tparm( -+ char *string, -+ ...) -+ { return(*(char **)0); } -+ -+#undef tiparm -+char *tiparm( -+ const char *string, -+ ...) -+ { return(*(char **)0); } -+ -+/* ./tinfo/lib_tputs.c */ -+ -+#undef PC -+char PC; -+#undef ospeed -+short ospeed; -+#undef _nc_nulls_sent -+int _nc_nulls_sent; -+ -+#undef _nc_set_no_padding -+void _nc_set_no_padding( -+ SCREEN *sp) -+ { /* void */ } -+ -+#undef delay_output_sp -+int delay_output_sp( -+ SCREEN *sp, -+ int ms) -+ { return(*(int *)0); } -+ -+#undef delay_output -+int delay_output( -+ int ms) -+ { return(*(int *)0); } -+ -+#undef _nc_flush_sp -+void _nc_flush_sp( -+ SCREEN *sp) -+ { /* void */ } -+ -+#undef _nc_flush -+void _nc_flush(void) -+ { /* void */ } -+ -+#undef _nc_outch_sp -+int _nc_outch_sp( -+ SCREEN *sp, -+ int ch) -+ { return(*(int *)0); } -+ -+#undef _nc_outch -+int _nc_outch( -+ int ch) -+ { return(*(int *)0); } -+ -+#undef _nc_putchar_sp -+int _nc_putchar_sp( -+ SCREEN *sp, -+ int ch) -+ { return(*(int *)0); } -+ -+#undef _nc_putchar -+int _nc_putchar( -+ int ch) -+ { return(*(int *)0); } -+ -+#undef putp_sp -+int putp_sp( -+ SCREEN *sp, -+ const char *string) -+ { return(*(int *)0); } -+ -+#undef putp -+int putp( -+ const char *string) -+ { return(*(int *)0); } -+ -+#undef _nc_putp_sp -+int _nc_putp_sp( -+ SCREEN *sp, -+ const char *name, -+ const char *string) -+ { return(*(int *)0); } -+ -+#undef _nc_putp -+int _nc_putp( -+ const char *name, -+ const char *string) -+ { return(*(int *)0); } -+ -+#undef tputs_sp -+int tputs_sp( -+ SCREEN *sp, -+ const char *string, -+ int affcnt, -+ NCURSES_OUTC_sp outc) -+ { return(*(int *)0); } -+ -+#undef _nc_outc_wrapper -+int _nc_outc_wrapper( -+ SCREEN *sp, -+ int c) -+ { return(*(int *)0); } -+ -+#undef tputs -+int tputs( -+ const char *string, -+ int affcnt, -+ int (*outc)( -+ int p1)) -+ { return(*(int *)0); } -+ -+/* ./trace/lib_trace.c */ -+ -+#undef _nc_tracing -+unsigned _nc_tracing; -+ -+#undef _nc__nc_tputs_trace -+const char *_nc__nc_tputs_trace(void) -+ { return(*(const char **)0); } -+ -+#undef _nc__nc_outchars -+long _nc__nc_outchars(void) -+ { return(*(long *)0); } -+ -+#undef _nc_set_tputs_trace -+void _nc_set_tputs_trace( -+ const char *s) -+ { /* void */ } -+ -+#undef _nc_count_outchars -+void _nc_count_outchars( -+ long increment) -+ { /* void */ } -+ -+#undef trace -+void trace( -+ const unsigned int tracelevel) -+ { /* void */ } -+ -+#undef _tracef -+void _tracef( -+ const char *fmt, -+ ...) -+ { /* void */ } -+ -+#undef _nc_retrace_bool -+NCURSES_BOOL _nc_retrace_bool( -+ int code) -+ { return(*(NCURSES_BOOL *)0); } -+ -+#undef _nc_retrace_char -+char _nc_retrace_char( -+ int code) -+ { return(*(char *)0); } -+ -+#undef _nc_retrace_int -+int _nc_retrace_int( -+ int code) -+ { return(*(int *)0); } -+ -+#undef _nc_retrace_unsigned -+unsigned _nc_retrace_unsigned( -+ unsigned code) -+ { return(*(unsigned *)0); } -+ -+#undef _nc_retrace_ptr -+char *_nc_retrace_ptr( -+ char *code) -+ { return(*(char **)0); } -+ -+#undef _nc_retrace_cptr -+const char *_nc_retrace_cptr( -+ const char *code) -+ { return(*(const char **)0); } -+ -+#undef _nc_retrace_cvoid_ptr -+void *_nc_retrace_cvoid_ptr( -+ void *code) -+ { return(*(void **)0); } -+ -+#undef _nc_retrace_void_ptr -+void *_nc_retrace_void_ptr( -+ void *code) -+ { return(*(void **)0); } -+ -+#undef _nc_retrace_sp -+SCREEN *_nc_retrace_sp( -+ SCREEN *code) -+ { return(*(SCREEN **)0); } -+ -+#undef _nc_retrace_win -+WINDOW *_nc_retrace_win( -+ WINDOW *code) -+ { return(*(WINDOW **)0); } -+ -+#undef _nc_use_tracef -+int _nc_use_tracef( -+ unsigned mask) -+ { return(*(int *)0); } -+ -+#undef _nc_locked_tracef -+void _nc_locked_tracef( -+ const char *fmt, -+ ...) -+ { /* void */ } -+ -+/* ./trace/lib_traceatr.c */ -+ -+#undef _traceattr2 -+char *_traceattr2( -+ int bufnum, -+ chtype newmode) -+ { return(*(char **)0); } -+ -+#undef _traceattr -+char *_traceattr( -+ attr_t newmode) -+ { return(*(char **)0); } -+ -+#undef _nc_retrace_int_attr_t -+int _nc_retrace_int_attr_t( -+ attr_t code) -+ { return(*(int *)0); } -+ -+#undef _nc_retrace_attr_t -+attr_t _nc_retrace_attr_t( -+ attr_t code) -+ { return(*(attr_t *)0); } -+ -+#undef _nc_altcharset_name -+const char *_nc_altcharset_name( -+ attr_t attr, -+ chtype ch) -+ { return(*(const char **)0); } -+ -+#undef _tracechtype2 -+char *_tracechtype2( -+ int bufnum, -+ chtype ch) -+ { return(*(char **)0); } -+ -+#undef _tracechtype -+char *_tracechtype( -+ chtype ch) -+ { return(*(char **)0); } -+ -+#undef _nc_retrace_chtype -+chtype _nc_retrace_chtype( -+ chtype code) -+ { return(*(chtype *)0); } -+ -+/* ./trace/lib_tracebits.c */ -+ -+typedef struct { -+ unsigned int val; -+ const char *name; -+} BITNAMES; -+ -+#undef _nc_trace_ttymode -+char *_nc_trace_ttymode( -+ struct termios *tty) -+ { return(*(char **)0); } -+ -+#undef _nc_tracebits -+char *_nc_tracebits(void) -+ { return(*(char **)0); } -+ -+/* ./trace/lib_tracechr.c */ -+ -+#undef _nc_tracechar -+char *_nc_tracechar( -+ SCREEN *sp, -+ int ch) -+ { return(*(char **)0); } -+ -+#undef _tracechar -+char *_tracechar( -+ int ch) -+ { return(*(char **)0); } -+ -+/* ./tinfo/lib_ttyflags.c */ -+ -+#undef _nc_get_tty_mode_sp -+int _nc_get_tty_mode_sp( -+ SCREEN *sp, -+ struct termios *buf) -+ { return(*(int *)0); } -+ -+#undef _nc_get_tty_mode -+int _nc_get_tty_mode( -+ struct termios *buf) -+ { return(*(int *)0); } -+ -+#undef _nc_set_tty_mode_sp -+int _nc_set_tty_mode_sp( -+ SCREEN *sp, -+ struct termios *buf) -+ { return(*(int *)0); } -+ -+#undef _nc_set_tty_mode -+int _nc_set_tty_mode( -+ struct termios *buf) -+ { return(*(int *)0); } -+ -+#undef def_shell_mode_sp -+int def_shell_mode_sp( -+ SCREEN *sp) -+ { return(*(int *)0); } -+ -+#undef def_shell_mode -+int def_shell_mode(void) -+ { return(*(int *)0); } -+ -+#undef def_prog_mode_sp -+int def_prog_mode_sp( -+ SCREEN *sp) -+ { return(*(int *)0); } -+ -+#undef def_prog_mode -+int def_prog_mode(void) -+ { return(*(int *)0); } -+ -+#undef reset_prog_mode_sp -+int reset_prog_mode_sp( -+ SCREEN *sp) -+ { return(*(int *)0); } -+ -+#undef reset_prog_mode -+int reset_prog_mode(void) -+ { return(*(int *)0); } -+ -+#undef reset_shell_mode_sp -+int reset_shell_mode_sp( -+ SCREEN *sp) -+ { return(*(int *)0); } -+ -+#undef reset_shell_mode -+int reset_shell_mode(void) -+ { return(*(int *)0); } -+ -+#undef savetty_sp -+int savetty_sp( -+ SCREEN *sp) -+ { return(*(int *)0); } -+ -+#undef savetty -+int savetty(void) -+ { return(*(int *)0); } -+ -+#undef resetty_sp -+int resetty_sp( -+ SCREEN *sp) -+ { return(*(int *)0); } -+ -+#undef resetty -+int resetty(void) -+ { return(*(int *)0); } -+ -+/* ./tty/lib_twait.c */ -+ -+#include <sys/time.h> -+ -+#undef _nc_timed_wait -+int _nc_timed_wait( -+ SCREEN *sp, -+ int mode, -+ int milliseconds, -+ int *timeleft) -+ { return(*(int *)0); } -+ -+/* ./tinfo/name_match.c */ -+ -+#undef _nc_first_name -+char *_nc_first_name( -+ const char *const sp) -+ { return(*(char **)0); } -+ -+#undef _nc_name_match -+int _nc_name_match( -+ const char *const namelst, -+ const char *const name, -+ const char *const delim) -+ { return(*(int *)0); } -+ -+/* ./names.c */ -+ -+#undef _nc_boolnames -+char *const *_nc_boolnames(void) -+ { return(*(char **)0); } -+ -+#undef _nc_boolfnames -+char *const *_nc_boolfnames(void) -+ { return(*(char **)0); } -+ -+#undef _nc_numnames -+char *const *_nc_numnames(void) -+ { return(*(char **)0); } -+ -+#undef _nc_numfnames -+char *const *_nc_numfnames(void) -+ { return(*(char **)0); } -+ -+#undef _nc_strnames -+char *const *_nc_strnames(void) -+ { return(*(char **)0); } -+ -+#undef _nc_strfnames -+char *const *_nc_strfnames(void) -+ { return(*(char **)0); } -+ -+/* ./tinfo/obsolete.c */ -+ -+#undef _nc_set_buffer_sp -+void _nc_set_buffer_sp( -+ SCREEN *sp, -+ FILE *ofp, -+ int buffered) -+ { /* void */ } -+ -+#undef _nc_set_buffer -+void _nc_set_buffer( -+ FILE *ofp, -+ int buffered) -+ { /* void */ } -+ -+/* ./tinfo/read_entry.c */ -+ -+#include <hashed_db.h> -+ -+#undef _nc_init_termtype -+void _nc_init_termtype( -+ TERMTYPE *const tp) -+ { /* void */ } -+ -+#undef _nc_read_termtype -+int _nc_read_termtype( -+ TERMTYPE *ptr, -+ char *buffer, -+ int limit) -+ { return(*(int *)0); } -+ -+#undef _nc_read_file_entry -+int _nc_read_file_entry( -+ const char *const filename, -+ TERMTYPE *ptr) -+ { return(*(int *)0); } -+ -+#undef _nc_read_entry -+int _nc_read_entry( -+ const char *const name, -+ char *const filename, -+ TERMTYPE *const tp) -+ { return(*(int *)0); } -+ -+/* ./tinfo/read_termcap.c */ -+ -+#include <sys/types.h> -+ -+#undef _nc_read_termcap -+void _nc_read_termcap(void) -+ { /* void */ } -+ -+/* ./tinfo/strings.c */ -+ -+#undef _nc_str_init -+string_desc *_nc_str_init( -+ string_desc *dst, -+ char *src, -+ size_t len) -+ { return(*(string_desc **)0); } -+ -+#undef _nc_str_null -+string_desc *_nc_str_null( -+ string_desc *dst, -+ size_t len) -+ { return(*(string_desc **)0); } -+ -+#undef _nc_str_copy -+string_desc *_nc_str_copy( -+ string_desc *dst, -+ string_desc *src) -+ { return(*(string_desc **)0); } -+ -+#undef _nc_safe_strcat -+NCURSES_BOOL _nc_safe_strcat( -+ string_desc *dst, -+ const char *src) -+ { return(*(NCURSES_BOOL *)0); } -+ -+#undef _nc_safe_strcpy -+NCURSES_BOOL _nc_safe_strcpy( -+ string_desc *dst, -+ const char *src) -+ { return(*(NCURSES_BOOL *)0); } -+ -+/* ./trace/trace_buf.c */ -+ -+#undef _nc_trace_buf -+char *_nc_trace_buf( -+ int bufnum, -+ size_t want) -+ { return(*(char **)0); } -+ -+#undef _nc_trace_bufcat -+char *_nc_trace_bufcat( -+ int bufnum, -+ const char *value) -+ { return(*(char **)0); } -+ -+/* ./trace/trace_tries.c */ -+ -+#undef _nc_trace_tries -+void _nc_trace_tries( -+ TRIES *tree) -+ { /* void */ } -+ -+/* ./base/tries.c */ -+ -+#undef _nc_expand_try -+char *_nc_expand_try( -+ TRIES *tree, -+ unsigned code, -+ int *count, -+ size_t len) -+ { return(*(char **)0); } -+ -+#undef _nc_remove_key -+int _nc_remove_key( -+ TRIES **tree, -+ unsigned code) -+ { return(*(int *)0); } -+ -+#undef _nc_remove_string -+int _nc_remove_string( -+ TRIES **tree, -+ const char *string) -+ { return(*(int *)0); } -+ -+/* ./tinfo/trim_sgr0.c */ -+ -+#undef _nc_trim_sgr0 -+char *_nc_trim_sgr0( -+ TERMTYPE *tp) -+ { return(*(char **)0); } -+ -+/* ./unctrl.c */ -+ -+#undef unctrl_sp -+char *unctrl_sp( -+ SCREEN *sp, -+ chtype ch) -+ { return(*(char **)0); } -+ -+#undef unctrl -+char *unctrl( -+ chtype ch) -+ { return(*(char **)0); } -+ -+/* ./trace/visbuf.c */ -+ -+#undef _nc_visbuf2 -+const char *_nc_visbuf2( -+ int bufnum, -+ const char *buf) -+ { return(*(const char **)0); } -+ -+#undef _nc_visbuf -+const char *_nc_visbuf( -+ const char *buf) -+ { return(*(const char **)0); } -+ -+#undef _nc_visbufn -+const char *_nc_visbufn( -+ const char *buf, -+ int len) -+ { return(*(const char **)0); } -+ -+#undef _nc_viscbuf2 -+const char *_nc_viscbuf2( -+ int bufnum, -+ const chtype *buf, -+ int len) -+ { return(*(const char **)0); } -+ -+#undef _nc_viscbuf -+const char *_nc_viscbuf( -+ const chtype *buf, -+ int len) -+ { return(*(const char **)0); } -+ -+/* ./base/define_key.c */ -+ -+#undef define_key_sp -+int define_key_sp( -+ SCREEN *sp, -+ const char *str, -+ int keycode) -+ { return(*(int *)0); } -+ -+#undef define_key -+int define_key( -+ const char *str, -+ int keycode) -+ { return(*(int *)0); } -+ -+/* ./tinfo/hashed_db.c */ -+ -+#undef _nc_hashed_db -+void _nc_hashed_db(void) -+ { /* void */ } -+ -+/* ./base/key_defined.c */ -+ -+#undef key_defined_sp -+int key_defined_sp( -+ SCREEN *sp, -+ const char *str) -+ { return(*(int *)0); } -+ -+#undef key_defined -+int key_defined( -+ const char *str) -+ { return(*(int *)0); } -+ -+/* ./base/keybound.c */ -+ -+#undef keybound_sp -+char *keybound_sp( -+ SCREEN *sp, -+ int code, -+ int count) -+ { return(*(char **)0); } -+ -+#undef keybound -+char *keybound( -+ int code, -+ int count) -+ { return(*(char **)0); } -+ -+/* ./base/keyok.c */ -+ -+#undef keyok_sp -+int keyok_sp( -+ SCREEN *sp, -+ int c, -+ NCURSES_BOOL flag) -+ { return(*(int *)0); } -+ -+#undef keyok -+int keyok( -+ int c, -+ NCURSES_BOOL flag) -+ { return(*(int *)0); } -+ -+/* ./base/version.c */ -+ -+#undef curses_version -+const char *curses_version(void) -+ { return(*(const char **)0); } -diff -Naur ncurses-5.9/ncurses/llib-ltinfotw ncurses-5.9.patch/ncurses/llib-ltinfotw ---- ncurses-5.9/ncurses/llib-ltinfotw 1970-01-01 01:00:00.000000000 +0100 -+++ ncurses-5.9.patch/ncurses/llib-ltinfotw 2014-09-01 16:33:22.418792225 +0200 -@@ -0,0 +1,1668 @@ -+/**************************************************************************** -+ * Copyright (c) 2012,2013 Free Software Foundation, Inc. * -+ * * -+ * Permission is hereby granted, free of charge, to any person obtaining a * -+ * copy of this software and associated documentation files (the * -+ * "Software"), to deal in the Software without restriction, including * -+ * without limitation the rights to use, copy, modify, merge, publish, * -+ * distribute, distribute with modifications, sublicense, and/or sell * -+ * copies of the Software, and to permit persons to whom the Software is * -+ * furnished to do so, subject to the following conditions: * -+ * * -+ * The above copyright notice and this permission notice shall be included * -+ * in all copies or substantial portions of the Software. * -+ * * -+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * -+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * -+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * -+ * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * -+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * -+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * -+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * -+ * * -+ * Except as contained in this notice, the name(s) of the above copyright * -+ * holders shall not be used in advertising or otherwise to promote the * -+ * sale, use or other dealings in this Software without prior written * -+ * authorization. * -+ ****************************************************************************/ -+ -+/**************************************************************************** -+ * Author: Thomas E. Dickey 2012 * -+ ****************************************************************************/ -+/* LINTLIBRARY */ -+ -+/* ./tinfo/access.c */ -+ -+#include <curses.priv.h> -+#include <ctype.h> -+#include <tic.h> -+ -+#undef _nc_rootname -+char *_nc_rootname( -+ char *path) -+ { return(*(char **)0); } -+ -+#undef _nc_is_abs_path -+NCURSES_BOOL _nc_is_abs_path( -+ const char *path) -+ { return(*(NCURSES_BOOL *)0); } -+ -+#undef _nc_pathlast -+unsigned _nc_pathlast( -+ const char *path) -+ { return(*(unsigned *)0); } -+ -+#undef _nc_basename -+char *_nc_basename( -+ char *path) -+ { return(*(char **)0); } -+ -+#undef _nc_access -+int _nc_access( -+ const char *path, -+ int mode) -+ { return(*(int *)0); } -+ -+#undef _nc_is_dir_path -+NCURSES_BOOL _nc_is_dir_path( -+ const char *path) -+ { return(*(NCURSES_BOOL *)0); } -+ -+#undef _nc_is_file_path -+NCURSES_BOOL _nc_is_file_path( -+ const char *path) -+ { return(*(NCURSES_BOOL *)0); } -+ -+#undef _nc_env_access -+int _nc_env_access(void) -+ { return(*(int *)0); } -+ -+/* ./tinfo/add_tries.c */ -+ -+#undef _nc_add_to_try -+int _nc_add_to_try( -+ TRIES **tree, -+ const char *str, -+ unsigned code) -+ { return(*(int *)0); } -+ -+/* ./tinfo/alloc_ttype.c */ -+ -+#undef _nc_align_termtype -+void _nc_align_termtype( -+ TERMTYPE *to, -+ TERMTYPE *from) -+ { /* void */ } -+ -+#undef _nc_copy_termtype -+void _nc_copy_termtype( -+ TERMTYPE *dst, -+ const TERMTYPE *src) -+ { /* void */ } -+ -+/* ./codes.c */ -+ -+#undef _nc_boolcodes -+char *const *_nc_boolcodes(void) -+ { return(*(char **)0); } -+ -+#undef _nc_numcodes -+char *const *_nc_numcodes(void) -+ { return(*(char **)0); } -+ -+#undef _nc_strcodes -+char *const *_nc_strcodes(void) -+ { return(*(char **)0); } -+ -+/* ./comp_captab.c */ -+ -+#include <hashsize.h> -+ -+#undef _nc_get_table -+const struct name_table_entry *_nc_get_table( -+ NCURSES_BOOL termcap) -+ { return(*(const struct name_table_entry **)0); } -+ -+#undef _nc_get_hash_table -+const HashValue *_nc_get_hash_table( -+ NCURSES_BOOL termcap) -+ { return(*(const HashValue **)0); } -+ -+#undef _nc_get_alias_table -+const struct alias *_nc_get_alias_table( -+ NCURSES_BOOL termcap) -+ { return(*(const struct alias **)0); } -+ -+#undef _nc_get_hash_info -+const HashData *_nc_get_hash_info( -+ NCURSES_BOOL termcap) -+ { return(*(const HashData **)0); } -+ -+/* ./tinfo/comp_error.c */ -+ -+#undef _nc_suppress_warnings -+NCURSES_BOOL _nc_suppress_warnings; -+#undef _nc_curr_line -+int _nc_curr_line; -+#undef _nc_curr_col -+int _nc_curr_col; -+ -+#undef _nc_get_source -+const char *_nc_get_source(void) -+ { return(*(const char **)0); } -+ -+#undef _nc_set_source -+void _nc_set_source( -+ const char *const name) -+ { /* void */ } -+ -+#undef _nc_set_type -+void _nc_set_type( -+ const char *const name) -+ { /* void */ } -+ -+#undef _nc_get_type -+void _nc_get_type( -+ char *name) -+ { /* void */ } -+ -+#undef _nc_warning -+void _nc_warning( -+ const char *const fmt, -+ ...) -+ { /* void */ } -+ -+#undef _nc_err_abort -+void _nc_err_abort( -+ const char *const fmt, -+ ...) -+ { /* void */ } -+ -+#undef _nc_syserr_abort -+void _nc_syserr_abort( -+ const char *const fmt, -+ ...) -+ { /* void */ } -+ -+/* ./tinfo/comp_hash.c */ -+ -+#undef _nc_find_entry -+struct name_table_entry const *_nc_find_entry( -+ const char *string, -+ const HashValue *hash_table) -+ { return(*(struct name_table_entry const **)0); } -+ -+#undef _nc_find_type_entry -+struct name_table_entry const *_nc_find_type_entry( -+ const char *string, -+ int type, -+ NCURSES_BOOL termcap) -+ { return(*(struct name_table_entry const **)0); } -+ -+/* ./tinfo/db_iterator.c */ -+ -+#include <time.h> -+ -+#undef _nc_tic_dir -+const char *_nc_tic_dir( -+ const char *path) -+ { return(*(const char **)0); } -+ -+#undef _nc_keep_tic_dir -+void _nc_keep_tic_dir( -+ const char *path) -+ { /* void */ } -+ -+#undef _nc_last_db -+void _nc_last_db(void) -+ { /* void */ } -+ -+#undef _nc_next_db -+const char *_nc_next_db( -+ DBDIRS *state, -+ int *offset) -+ { return(*(const char **)0); } -+ -+#undef _nc_first_db -+void _nc_first_db( -+ DBDIRS *state, -+ int *offset) -+ { /* void */ } -+ -+/* ./tinfo/doalloc.c */ -+ -+#undef _nc_doalloc -+void *_nc_doalloc( -+ void *oldp, -+ size_t amount) -+ { return(*(void **)0); } -+ -+/* ./tinfo/entries.c */ -+ -+#undef _nc_head -+ENTRY *_nc_head; -+#undef _nc_tail -+ENTRY *_nc_tail; -+ -+#undef _nc_free_entry -+void _nc_free_entry( -+ ENTRY *headp, -+ TERMTYPE *tterm) -+ { /* void */ } -+ -+#undef _nc_free_entries -+void _nc_free_entries( -+ ENTRY *headp) -+ { /* void */ } -+ -+#undef _nc_delink_entry -+ENTRY *_nc_delink_entry( -+ ENTRY *headp, -+ TERMTYPE *tterm) -+ { return(*(ENTRY **)0); } -+ -+#undef _nc_leaks_tinfo -+void _nc_leaks_tinfo(void) -+ { /* void */ } -+ -+/* ./fallback.c */ -+ -+#undef _nc_fallback -+const TERMTYPE *_nc_fallback( -+ const char *name) -+ { return(*(const TERMTYPE **)0); } -+ -+/* ./tinfo/free_ttype.c */ -+ -+#undef _nc_free_termtype -+void _nc_free_termtype( -+ TERMTYPE *ptr) -+ { /* void */ } -+ -+#undef _nc_user_definable -+NCURSES_BOOL _nc_user_definable; -+ -+#undef use_extended_names -+int use_extended_names( -+ NCURSES_BOOL flag) -+ { return(*(int *)0); } -+ -+/* ./tinfo/getenv_num.c */ -+ -+#undef _nc_getenv_num -+int _nc_getenv_num( -+ const char *name) -+ { return(*(int *)0); } -+ -+#undef _nc_setenv_num -+void _nc_setenv_num( -+ const char *name, -+ int value) -+ { /* void */ } -+ -+/* ./tinfo/home_terminfo.c */ -+ -+#undef _nc_home_terminfo -+char *_nc_home_terminfo(void) -+ { return(*(char **)0); } -+ -+/* ./tinfo/init_keytry.c */ -+ -+#if 0 -+ -+#include <init_keytry.h> -+ -+#undef _nc_tinfo_fkeys -+const struct tinfo_fkeys _nc_tinfo_fkeys[] = {0}; -+ -+#endif -+ -+#undef _nc_init_keytry -+void _nc_init_keytry( -+ SCREEN *sp) -+ { /* void */ } -+ -+/* ./tinfo/lib_acs.c */ -+ -+#undef _nc_acs_map -+chtype *_nc_acs_map(void) -+ { return(*(chtype **)0); } -+ -+#undef _nc_init_acs_sp -+void _nc_init_acs_sp( -+ SCREEN *sp) -+ { /* void */ } -+ -+#undef _nc_init_acs -+void _nc_init_acs(void) -+ { /* void */ } -+ -+/* ./tinfo/lib_baudrate.c */ -+ -+#include <termcap.h> -+ -+struct speed { -+ int s; -+ int sp; -+}; -+ -+#undef _nc_baudrate -+int _nc_baudrate( -+ int OSpeed) -+ { return(*(int *)0); } -+ -+#undef _nc_ospeed -+int _nc_ospeed( -+ int BaudRate) -+ { return(*(int *)0); } -+ -+#undef baudrate_sp -+int baudrate_sp( -+ SCREEN *sp) -+ { return(*(int *)0); } -+ -+#undef baudrate -+int baudrate(void) -+ { return(*(int *)0); } -+ -+/* ./tinfo/lib_cur_term.c */ -+ -+#undef _nc_get_cur_term_sp -+TERMINAL *_nc_get_cur_term_sp( -+ SCREEN *sp) -+ { return(*(TERMINAL **)0); } -+ -+#undef _nc_get_cur_term -+TERMINAL *_nc_get_cur_term(void) -+ { return(*(TERMINAL **)0); } -+ -+#undef _nc_cur_term -+TERMINAL *_nc_cur_term(void) -+ { return(*(TERMINAL **)0); } -+ -+#undef set_curterm_sp -+TERMINAL *set_curterm_sp( -+ SCREEN *sp, -+ TERMINAL *termp) -+ { return(*(TERMINAL **)0); } -+ -+#undef set_curterm -+TERMINAL *set_curterm( -+ TERMINAL *termp) -+ { return(*(TERMINAL **)0); } -+ -+#undef del_curterm_sp -+int del_curterm_sp( -+ SCREEN *sp, -+ TERMINAL *termp) -+ { return(*(int *)0); } -+ -+#undef del_curterm -+int del_curterm( -+ TERMINAL *termp) -+ { return(*(int *)0); } -+ -+/* ./tinfo/lib_data.c */ -+ -+#undef _nc_stdscr -+WINDOW *_nc_stdscr(void) -+ { return(*(WINDOW **)0); } -+ -+#undef _nc_curscr -+WINDOW *_nc_curscr(void) -+ { return(*(WINDOW **)0); } -+ -+#undef _nc_newscr -+WINDOW *_nc_newscr(void) -+ { return(*(WINDOW **)0); } -+ -+#undef _nc_screen_chain -+SCREEN *_nc_screen_chain; -+#undef SP -+SCREEN *SP; -+#undef _nc_globals -+NCURSES_GLOBALS _nc_globals; -+#undef _nc_prescreen -+NCURSES_PRESCREEN _nc_prescreen; -+ -+#undef _nc_screen_of -+SCREEN *_nc_screen_of( -+ WINDOW *win) -+ { return(*(SCREEN **)0); } -+ -+#undef _nc_init_pthreads -+void _nc_init_pthreads(void) -+ { /* void */ } -+ -+#undef _nc_mutex_init -+void _nc_mutex_init( -+ pthread_mutex_t *obj) -+ { /* void */ } -+ -+#undef _nc_mutex_lock -+int _nc_mutex_lock( -+ pthread_mutex_t *obj) -+ { return(*(int *)0); } -+ -+#undef _nc_mutex_trylock -+int _nc_mutex_trylock( -+ pthread_mutex_t *obj) -+ { return(*(int *)0); } -+ -+#undef _nc_mutex_unlock -+int _nc_mutex_unlock( -+ pthread_mutex_t *obj) -+ { return(*(int *)0); } -+ -+/* ./tinfo/lib_has_cap.c */ -+ -+#undef has_ic_sp -+NCURSES_BOOL has_ic_sp( -+ SCREEN *sp) -+ { return(*(NCURSES_BOOL *)0); } -+ -+#undef has_ic -+NCURSES_BOOL has_ic(void) -+ { return(*(NCURSES_BOOL *)0); } -+ -+#undef has_il_sp -+NCURSES_BOOL has_il_sp( -+ SCREEN *sp) -+ { return(*(NCURSES_BOOL *)0); } -+ -+#undef has_il -+NCURSES_BOOL has_il(void) -+ { return(*(NCURSES_BOOL *)0); } -+ -+/* ./tinfo/lib_kernel.c */ -+ -+#undef erasechar_sp -+char erasechar_sp( -+ SCREEN *sp) -+ { return(*(char *)0); } -+ -+#undef erasechar -+char erasechar(void) -+ { return(*(char *)0); } -+ -+#undef killchar_sp -+char killchar_sp( -+ SCREEN *sp) -+ { return(*(char *)0); } -+ -+#undef killchar -+char killchar(void) -+ { return(*(char *)0); } -+ -+#undef flushinp_sp -+int flushinp_sp( -+ SCREEN *sp) -+ { return(*(int *)0); } -+ -+#undef flushinp -+int flushinp(void) -+ { return(*(int *)0); } -+ -+/* ./lib_keyname.c */ -+ -+struct kn { short offset; int code; }; -+ -+#undef keyname_sp -+char *keyname_sp( -+ SCREEN *sp, -+ int c) -+ { return(*(char **)0); } -+ -+#undef keyname -+char *keyname( -+ int c) -+ { return(*(char **)0); } -+ -+/* ./tinfo/lib_longname.c */ -+ -+#undef longname_sp -+char *longname_sp( -+ SCREEN *sp) -+ { return(*(char **)0); } -+ -+#undef longname -+char *longname(void) -+ { return(*(char **)0); } -+ -+/* ./tinfo/lib_napms.c */ -+ -+#undef napms_sp -+int napms_sp( -+ SCREEN *sp, -+ int ms) -+ { return(*(int *)0); } -+ -+#undef napms -+int napms( -+ int ms) -+ { return(*(int *)0); } -+ -+/* ./tinfo/lib_options.c */ -+ -+#undef idlok -+int idlok( -+ WINDOW *win, -+ NCURSES_BOOL flag) -+ { return(*(int *)0); } -+ -+#undef idcok -+void idcok( -+ WINDOW *win, -+ NCURSES_BOOL flag) -+ { /* void */ } -+ -+#undef halfdelay_sp -+int halfdelay_sp( -+ SCREEN *sp, -+ int t) -+ { return(*(int *)0); } -+ -+#undef halfdelay -+int halfdelay( -+ int t) -+ { return(*(int *)0); } -+ -+#undef nodelay -+int nodelay( -+ WINDOW *win, -+ NCURSES_BOOL flag) -+ { return(*(int *)0); } -+ -+#undef notimeout -+int notimeout( -+ WINDOW *win, -+ NCURSES_BOOL f) -+ { return(*(int *)0); } -+ -+#undef wtimeout -+void wtimeout( -+ WINDOW *win, -+ int delay) -+ { /* void */ } -+ -+#undef keypad -+int keypad( -+ WINDOW *win, -+ NCURSES_BOOL flag) -+ { return(*(int *)0); } -+ -+#undef meta -+int meta( -+ WINDOW *win, -+ NCURSES_BOOL flag) -+ { return(*(int *)0); } -+ -+#undef curs_set_sp -+int curs_set_sp( -+ SCREEN *sp, -+ int vis) -+ { return(*(int *)0); } -+ -+#undef curs_set -+int curs_set( -+ int vis) -+ { return(*(int *)0); } -+ -+#undef typeahead_sp -+int typeahead_sp( -+ SCREEN *sp, -+ int fd) -+ { return(*(int *)0); } -+ -+#undef typeahead -+int typeahead( -+ int fd) -+ { return(*(int *)0); } -+ -+#undef has_key_sp -+int has_key_sp( -+ SCREEN *sp, -+ int keycode) -+ { return(*(int *)0); } -+ -+#undef has_key -+int has_key( -+ int keycode) -+ { return(*(int *)0); } -+ -+#undef _nc_putp_flush_sp -+int _nc_putp_flush_sp( -+ SCREEN *sp, -+ const char *name, -+ const char *value) -+ { return(*(int *)0); } -+ -+#undef _nc_keypad -+int _nc_keypad( -+ SCREEN *sp, -+ int flag) -+ { return(*(int *)0); } -+ -+/* ./tinfo/lib_raw.c */ -+ -+#undef raw_sp -+int raw_sp( -+ SCREEN *sp) -+ { return(*(int *)0); } -+ -+#undef raw -+int raw(void) -+ { return(*(int *)0); } -+ -+#undef cbreak_sp -+int cbreak_sp( -+ SCREEN *sp) -+ { return(*(int *)0); } -+ -+#undef cbreak -+int cbreak(void) -+ { return(*(int *)0); } -+ -+#undef qiflush_sp -+void qiflush_sp( -+ SCREEN *sp) -+ { /* void */ } -+ -+#undef qiflush -+void qiflush(void) -+ { /* void */ } -+ -+#undef noraw_sp -+int noraw_sp( -+ SCREEN *sp) -+ { return(*(int *)0); } -+ -+#undef noraw -+int noraw(void) -+ { return(*(int *)0); } -+ -+#undef nocbreak_sp -+int nocbreak_sp( -+ SCREEN *sp) -+ { return(*(int *)0); } -+ -+#undef nocbreak -+int nocbreak(void) -+ { return(*(int *)0); } -+ -+#undef noqiflush_sp -+void noqiflush_sp( -+ SCREEN *sp) -+ { /* void */ } -+ -+#undef noqiflush -+void noqiflush(void) -+ { /* void */ } -+ -+#undef intrflush_sp -+int intrflush_sp( -+ SCREEN *sp, -+ WINDOW *win, -+ NCURSES_BOOL flag) -+ { return(*(int *)0); } -+ -+#undef intrflush -+int intrflush( -+ WINDOW *win, -+ NCURSES_BOOL flag) -+ { return(*(int *)0); } -+ -+/* ./tinfo/lib_setup.c */ -+ -+#include <locale.h> -+#include <sys/ioctl.h> -+#include <langinfo.h> -+ -+#undef _nc_ttytype -+char *_nc_ttytype(void) -+ { return(*(char **)0); } -+ -+#undef _nc_ptr_Lines -+int *_nc_ptr_Lines( -+ SCREEN *sp) -+ { return(*(int **)0); } -+ -+#undef _nc_LINES -+int _nc_LINES(void) -+ { return(*(int *)0); } -+ -+#undef _nc_ptr_Cols -+int *_nc_ptr_Cols( -+ SCREEN *sp) -+ { return(*(int **)0); } -+ -+#undef _nc_COLS -+int _nc_COLS(void) -+ { return(*(int *)0); } -+ -+#undef _nc_ptr_Tabsize -+int *_nc_ptr_Tabsize( -+ SCREEN *sp) -+ { return(*(int **)0); } -+ -+#undef _nc_TABSIZE -+int _nc_TABSIZE(void) -+ { return(*(int *)0); } -+ -+#undef set_tabsize_sp -+int set_tabsize_sp( -+ SCREEN *sp, -+ int value) -+ { return(*(int *)0); } -+ -+#undef set_tabsize -+int set_tabsize( -+ int value) -+ { return(*(int *)0); } -+ -+#undef _nc_handle_sigwinch -+int _nc_handle_sigwinch( -+ SCREEN *sp) -+ { return(*(int *)0); } -+ -+#undef use_env_sp -+void use_env_sp( -+ SCREEN *sp, -+ NCURSES_BOOL f) -+ { /* void */ } -+ -+#undef use_tioctl_sp -+void use_tioctl_sp( -+ SCREEN *sp, -+ NCURSES_BOOL f) -+ { /* void */ } -+ -+#undef use_env -+void use_env( -+ NCURSES_BOOL f) -+ { /* void */ } -+ -+#undef use_tioctl -+void use_tioctl( -+ NCURSES_BOOL f) -+ { /* void */ } -+ -+#undef _nc_get_screensize -+void _nc_get_screensize( -+ SCREEN *sp, -+ int *linep, -+ int *colp) -+ { /* void */ } -+ -+#undef _nc_update_screensize -+void _nc_update_screensize( -+ SCREEN *sp) -+ { /* void */ } -+ -+#undef _nc_setup_tinfo -+int _nc_setup_tinfo( -+ const char *const tn, -+ TERMTYPE *const tp) -+ { return(*(int *)0); } -+ -+#undef _nc_tinfo_cmdch -+void _nc_tinfo_cmdch( -+ TERMINAL *termp, -+ int proto) -+ { /* void */ } -+ -+#undef _nc_get_locale -+char *_nc_get_locale(void) -+ { return(*(char **)0); } -+ -+#undef _nc_unicode_locale -+int _nc_unicode_locale(void) -+ { return(*(int *)0); } -+ -+#undef _nc_locale_breaks_acs -+int _nc_locale_breaks_acs( -+ TERMINAL *termp) -+ { return(*(int *)0); } -+ -+#undef _nc_setupterm -+int _nc_setupterm( -+ char *tname, -+ int Filedes, -+ int *errret, -+ int reuse) -+ { return(*(int *)0); } -+ -+#undef new_prescr -+SCREEN *new_prescr(void) -+ { return(*(SCREEN **)0); } -+ -+#undef setupterm -+int setupterm( -+ char *tname, -+ int Filedes, -+ int *errret) -+ { return(*(int *)0); } -+ -+/* ./tinfo/lib_termcap.c */ -+ -+#undef UP -+char *UP; -+#undef BC -+char *BC; -+ -+#undef tgetent_sp -+int tgetent_sp( -+ SCREEN *sp, -+ char *bufp, -+ const char *name) -+ { return(*(int *)0); } -+ -+#if 0 -+ -+#include <capdefaults.c> -+ -+#endif -+ -+#undef tgetent -+int tgetent( -+ char *bufp, -+ const char *name) -+ { return(*(int *)0); } -+ -+#undef tgetflag_sp -+int tgetflag_sp( -+ SCREEN *sp, -+ char *id) -+ { return(*(int *)0); } -+ -+#undef tgetflag -+int tgetflag( -+ char *id) -+ { return(*(int *)0); } -+ -+#undef tgetnum_sp -+int tgetnum_sp( -+ SCREEN *sp, -+ char *id) -+ { return(*(int *)0); } -+ -+#undef tgetnum -+int tgetnum( -+ char *id) -+ { return(*(int *)0); } -+ -+#undef tgetstr_sp -+char *tgetstr_sp( -+ SCREEN *sp, -+ char *id, -+ char **area) -+ { return(*(char **)0); } -+ -+#undef tgetstr -+char *tgetstr( -+ char *id, -+ char **area) -+ { return(*(char **)0); } -+ -+/* ./tinfo/lib_termname.c */ -+ -+#undef termname_sp -+char *termname_sp( -+ SCREEN *sp) -+ { return(*(char **)0); } -+ -+#undef termname -+char *termname(void) -+ { return(*(char **)0); } -+ -+/* ./tinfo/lib_tgoto.c */ -+ -+#undef tgoto -+char *tgoto( -+ const char *string, -+ int x, -+ int y) -+ { return(*(char **)0); } -+ -+/* ./tinfo/lib_ti.c */ -+ -+#undef tigetflag_sp -+int tigetflag_sp( -+ SCREEN *sp, -+ char *str) -+ { return(*(int *)0); } -+ -+#undef tigetflag -+int tigetflag( -+ char *str) -+ { return(*(int *)0); } -+ -+#undef tigetnum_sp -+int tigetnum_sp( -+ SCREEN *sp, -+ char *str) -+ { return(*(int *)0); } -+ -+#undef tigetnum -+int tigetnum( -+ char *str) -+ { return(*(int *)0); } -+ -+#undef tigetstr_sp -+char *tigetstr_sp( -+ SCREEN *sp, -+ char *str) -+ { return(*(char **)0); } -+ -+#undef tigetstr -+char *tigetstr( -+ char *str) -+ { return(*(char **)0); } -+ -+/* ./tinfo/lib_tparm.c */ -+ -+#undef _nc_tparm_err -+int _nc_tparm_err; -+ -+#undef _nc_tparm_analyze -+int _nc_tparm_analyze( -+ const char *string, -+ char *p_is_s[9], -+ int *_nc_popcount) -+ { return(*(int *)0); } -+ -+#undef tparm -+char *tparm( -+ char *string, -+ ...) -+ { return(*(char **)0); } -+ -+#undef tiparm -+char *tiparm( -+ const char *string, -+ ...) -+ { return(*(char **)0); } -+ -+/* ./tinfo/lib_tputs.c */ -+ -+#undef PC -+char PC; -+#undef ospeed -+short ospeed; -+#undef _nc_nulls_sent -+int _nc_nulls_sent; -+ -+#undef _nc_set_no_padding -+void _nc_set_no_padding( -+ SCREEN *sp) -+ { /* void */ } -+ -+#undef delay_output_sp -+int delay_output_sp( -+ SCREEN *sp, -+ int ms) -+ { return(*(int *)0); } -+ -+#undef delay_output -+int delay_output( -+ int ms) -+ { return(*(int *)0); } -+ -+#undef _nc_flush_sp -+void _nc_flush_sp( -+ SCREEN *sp) -+ { /* void */ } -+ -+#undef _nc_flush -+void _nc_flush(void) -+ { /* void */ } -+ -+#undef _nc_outch_sp -+int _nc_outch_sp( -+ SCREEN *sp, -+ int ch) -+ { return(*(int *)0); } -+ -+#undef _nc_outch -+int _nc_outch( -+ int ch) -+ { return(*(int *)0); } -+ -+#undef _nc_putchar_sp -+int _nc_putchar_sp( -+ SCREEN *sp, -+ int ch) -+ { return(*(int *)0); } -+ -+#undef _nc_putchar -+int _nc_putchar( -+ int ch) -+ { return(*(int *)0); } -+ -+#undef putp_sp -+int putp_sp( -+ SCREEN *sp, -+ const char *string) -+ { return(*(int *)0); } -+ -+#undef putp -+int putp( -+ const char *string) -+ { return(*(int *)0); } -+ -+#undef _nc_putp_sp -+int _nc_putp_sp( -+ SCREEN *sp, -+ const char *name, -+ const char *string) -+ { return(*(int *)0); } -+ -+#undef _nc_putp -+int _nc_putp( -+ const char *name, -+ const char *string) -+ { return(*(int *)0); } -+ -+#undef tputs_sp -+int tputs_sp( -+ SCREEN *sp, -+ const char *string, -+ int affcnt, -+ NCURSES_OUTC_sp outc) -+ { return(*(int *)0); } -+ -+#undef _nc_outc_wrapper -+int _nc_outc_wrapper( -+ SCREEN *sp, -+ int c) -+ { return(*(int *)0); } -+ -+#undef tputs -+int tputs( -+ const char *string, -+ int affcnt, -+ int (*outc)( -+ int p1)) -+ { return(*(int *)0); } -+ -+/* ./trace/lib_trace.c */ -+ -+#undef _nc_tracing -+unsigned _nc_tracing; -+ -+#undef _nc__nc_tputs_trace -+const char *_nc__nc_tputs_trace(void) -+ { return(*(const char **)0); } -+ -+#undef _nc__nc_outchars -+long _nc__nc_outchars(void) -+ { return(*(long *)0); } -+ -+#undef _nc_set_tputs_trace -+void _nc_set_tputs_trace( -+ const char *s) -+ { /* void */ } -+ -+#undef _nc_count_outchars -+void _nc_count_outchars( -+ long increment) -+ { /* void */ } -+ -+#undef trace -+void trace( -+ const unsigned int tracelevel) -+ { /* void */ } -+ -+#undef _tracef -+void _tracef( -+ const char *fmt, -+ ...) -+ { /* void */ } -+ -+#undef _nc_retrace_bool -+NCURSES_BOOL _nc_retrace_bool( -+ int code) -+ { return(*(NCURSES_BOOL *)0); } -+ -+#undef _nc_retrace_char -+char _nc_retrace_char( -+ int code) -+ { return(*(char *)0); } -+ -+#undef _nc_retrace_int -+int _nc_retrace_int( -+ int code) -+ { return(*(int *)0); } -+ -+#undef _nc_retrace_unsigned -+unsigned _nc_retrace_unsigned( -+ unsigned code) -+ { return(*(unsigned *)0); } -+ -+#undef _nc_retrace_ptr -+char *_nc_retrace_ptr( -+ char *code) -+ { return(*(char **)0); } -+ -+#undef _nc_retrace_cptr -+const char *_nc_retrace_cptr( -+ const char *code) -+ { return(*(const char **)0); } -+ -+#undef _nc_retrace_cvoid_ptr -+void *_nc_retrace_cvoid_ptr( -+ void *code) -+ { return(*(void **)0); } -+ -+#undef _nc_retrace_void_ptr -+void *_nc_retrace_void_ptr( -+ void *code) -+ { return(*(void **)0); } -+ -+#undef _nc_retrace_sp -+SCREEN *_nc_retrace_sp( -+ SCREEN *code) -+ { return(*(SCREEN **)0); } -+ -+#undef _nc_retrace_win -+WINDOW *_nc_retrace_win( -+ WINDOW *code) -+ { return(*(WINDOW **)0); } -+ -+#undef _nc_use_tracef -+int _nc_use_tracef( -+ unsigned mask) -+ { return(*(int *)0); } -+ -+#undef _nc_locked_tracef -+void _nc_locked_tracef( -+ const char *fmt, -+ ...) -+ { /* void */ } -+ -+/* ./trace/lib_traceatr.c */ -+ -+#undef _traceattr2 -+char *_traceattr2( -+ int bufnum, -+ chtype newmode) -+ { return(*(char **)0); } -+ -+#undef _traceattr -+char *_traceattr( -+ attr_t newmode) -+ { return(*(char **)0); } -+ -+#undef _nc_retrace_int_attr_t -+int _nc_retrace_int_attr_t( -+ attr_t code) -+ { return(*(int *)0); } -+ -+#undef _nc_retrace_attr_t -+attr_t _nc_retrace_attr_t( -+ attr_t code) -+ { return(*(attr_t *)0); } -+ -+#undef _nc_altcharset_name -+const char *_nc_altcharset_name( -+ attr_t attr, -+ chtype ch) -+ { return(*(const char **)0); } -+ -+#undef _tracechtype2 -+char *_tracechtype2( -+ int bufnum, -+ chtype ch) -+ { return(*(char **)0); } -+ -+#undef _tracechtype -+char *_tracechtype( -+ chtype ch) -+ { return(*(char **)0); } -+ -+#undef _nc_retrace_chtype -+chtype _nc_retrace_chtype( -+ chtype code) -+ { return(*(chtype *)0); } -+ -+#undef _tracecchar_t2 -+char *_tracecchar_t2( -+ int bufnum, -+ const cchar_t *ch) -+ { return(*(char **)0); } -+ -+#undef _tracecchar_t -+char *_tracecchar_t( -+ const cchar_t *ch) -+ { return(*(char **)0); } -+ -+/* ./trace/lib_tracebits.c */ -+ -+typedef struct { -+ unsigned int val; -+ const char *name; -+} BITNAMES; -+ -+#undef _nc_trace_ttymode -+char *_nc_trace_ttymode( -+ struct termios *tty) -+ { return(*(char **)0); } -+ -+#undef _nc_tracebits -+char *_nc_tracebits(void) -+ { return(*(char **)0); } -+ -+/* ./trace/lib_tracechr.c */ -+ -+#undef _nc_tracechar -+char *_nc_tracechar( -+ SCREEN *sp, -+ int ch) -+ { return(*(char **)0); } -+ -+#undef _tracechar -+char *_tracechar( -+ int ch) -+ { return(*(char **)0); } -+ -+/* ./tinfo/lib_ttyflags.c */ -+ -+#undef _nc_get_tty_mode_sp -+int _nc_get_tty_mode_sp( -+ SCREEN *sp, -+ struct termios *buf) -+ { return(*(int *)0); } -+ -+#undef _nc_get_tty_mode -+int _nc_get_tty_mode( -+ struct termios *buf) -+ { return(*(int *)0); } -+ -+#undef _nc_set_tty_mode_sp -+int _nc_set_tty_mode_sp( -+ SCREEN *sp, -+ struct termios *buf) -+ { return(*(int *)0); } -+ -+#undef _nc_set_tty_mode -+int _nc_set_tty_mode( -+ struct termios *buf) -+ { return(*(int *)0); } -+ -+#undef def_shell_mode_sp -+int def_shell_mode_sp( -+ SCREEN *sp) -+ { return(*(int *)0); } -+ -+#undef def_shell_mode -+int def_shell_mode(void) -+ { return(*(int *)0); } -+ -+#undef def_prog_mode_sp -+int def_prog_mode_sp( -+ SCREEN *sp) -+ { return(*(int *)0); } -+ -+#undef def_prog_mode -+int def_prog_mode(void) -+ { return(*(int *)0); } -+ -+#undef reset_prog_mode_sp -+int reset_prog_mode_sp( -+ SCREEN *sp) -+ { return(*(int *)0); } -+ -+#undef reset_prog_mode -+int reset_prog_mode(void) -+ { return(*(int *)0); } -+ -+#undef reset_shell_mode_sp -+int reset_shell_mode_sp( -+ SCREEN *sp) -+ { return(*(int *)0); } -+ -+#undef reset_shell_mode -+int reset_shell_mode(void) -+ { return(*(int *)0); } -+ -+#undef savetty_sp -+int savetty_sp( -+ SCREEN *sp) -+ { return(*(int *)0); } -+ -+#undef savetty -+int savetty(void) -+ { return(*(int *)0); } -+ -+#undef resetty_sp -+int resetty_sp( -+ SCREEN *sp) -+ { return(*(int *)0); } -+ -+#undef resetty -+int resetty(void) -+ { return(*(int *)0); } -+ -+/* ./tty/lib_twait.c */ -+ -+#include <sys/time.h> -+ -+#undef _nc_timed_wait -+int _nc_timed_wait( -+ SCREEN *sp, -+ int mode, -+ int milliseconds, -+ int *timeleft) -+ { return(*(int *)0); } -+ -+/* ./tinfo/name_match.c */ -+ -+#undef _nc_first_name -+char *_nc_first_name( -+ const char *const sp) -+ { return(*(char **)0); } -+ -+#undef _nc_name_match -+int _nc_name_match( -+ const char *const namelst, -+ const char *const name, -+ const char *const delim) -+ { return(*(int *)0); } -+ -+/* ./names.c */ -+ -+#undef _nc_boolnames -+char *const *_nc_boolnames(void) -+ { return(*(char **)0); } -+ -+#undef _nc_boolfnames -+char *const *_nc_boolfnames(void) -+ { return(*(char **)0); } -+ -+#undef _nc_numnames -+char *const *_nc_numnames(void) -+ { return(*(char **)0); } -+ -+#undef _nc_numfnames -+char *const *_nc_numfnames(void) -+ { return(*(char **)0); } -+ -+#undef _nc_strnames -+char *const *_nc_strnames(void) -+ { return(*(char **)0); } -+ -+#undef _nc_strfnames -+char *const *_nc_strfnames(void) -+ { return(*(char **)0); } -+ -+/* ./tinfo/obsolete.c */ -+ -+#undef _nc_set_buffer_sp -+void _nc_set_buffer_sp( -+ SCREEN *sp, -+ FILE *ofp, -+ int buffered) -+ { /* void */ } -+ -+#undef _nc_set_buffer -+void _nc_set_buffer( -+ FILE *ofp, -+ int buffered) -+ { /* void */ } -+ -+/* ./tinfo/read_entry.c */ -+ -+#include <hashed_db.h> -+ -+#undef _nc_init_termtype -+void _nc_init_termtype( -+ TERMTYPE *const tp) -+ { /* void */ } -+ -+#undef _nc_read_termtype -+int _nc_read_termtype( -+ TERMTYPE *ptr, -+ char *buffer, -+ int limit) -+ { return(*(int *)0); } -+ -+#undef _nc_read_file_entry -+int _nc_read_file_entry( -+ const char *const filename, -+ TERMTYPE *ptr) -+ { return(*(int *)0); } -+ -+#undef _nc_read_entry -+int _nc_read_entry( -+ const char *const name, -+ char *const filename, -+ TERMTYPE *const tp) -+ { return(*(int *)0); } -+ -+/* ./tinfo/read_termcap.c */ -+ -+#include <sys/types.h> -+ -+#undef _nc_read_termcap -+void _nc_read_termcap(void) -+ { /* void */ } -+ -+/* ./tinfo/strings.c */ -+ -+#undef _nc_str_init -+string_desc *_nc_str_init( -+ string_desc *dst, -+ char *src, -+ size_t len) -+ { return(*(string_desc **)0); } -+ -+#undef _nc_str_null -+string_desc *_nc_str_null( -+ string_desc *dst, -+ size_t len) -+ { return(*(string_desc **)0); } -+ -+#undef _nc_str_copy -+string_desc *_nc_str_copy( -+ string_desc *dst, -+ string_desc *src) -+ { return(*(string_desc **)0); } -+ -+#undef _nc_safe_strcat -+NCURSES_BOOL _nc_safe_strcat( -+ string_desc *dst, -+ const char *src) -+ { return(*(NCURSES_BOOL *)0); } -+ -+#undef _nc_safe_strcpy -+NCURSES_BOOL _nc_safe_strcpy( -+ string_desc *dst, -+ const char *src) -+ { return(*(NCURSES_BOOL *)0); } -+ -+/* ./trace/trace_buf.c */ -+ -+#undef _nc_trace_buf -+char *_nc_trace_buf( -+ int bufnum, -+ size_t want) -+ { return(*(char **)0); } -+ -+#undef _nc_trace_bufcat -+char *_nc_trace_bufcat( -+ int bufnum, -+ const char *value) -+ { return(*(char **)0); } -+ -+/* ./trace/trace_tries.c */ -+ -+#undef _nc_trace_tries -+void _nc_trace_tries( -+ TRIES *tree) -+ { /* void */ } -+ -+/* ./base/tries.c */ -+ -+#undef _nc_expand_try -+char *_nc_expand_try( -+ TRIES *tree, -+ unsigned code, -+ int *count, -+ size_t len) -+ { return(*(char **)0); } -+ -+#undef _nc_remove_key -+int _nc_remove_key( -+ TRIES **tree, -+ unsigned code) -+ { return(*(int *)0); } -+ -+#undef _nc_remove_string -+int _nc_remove_string( -+ TRIES **tree, -+ const char *string) -+ { return(*(int *)0); } -+ -+/* ./tinfo/trim_sgr0.c */ -+ -+#undef _nc_trim_sgr0 -+char *_nc_trim_sgr0( -+ TERMTYPE *tp) -+ { return(*(char **)0); } -+ -+/* ./unctrl.c */ -+ -+#undef unctrl_sp -+char *unctrl_sp( -+ SCREEN *sp, -+ chtype ch) -+ { return(*(char **)0); } -+ -+#undef unctrl -+char *unctrl( -+ chtype ch) -+ { return(*(char **)0); } -+ -+/* ./trace/visbuf.c */ -+ -+#undef _nc_visbuf2 -+const char *_nc_visbuf2( -+ int bufnum, -+ const char *buf) -+ { return(*(const char **)0); } -+ -+#undef _nc_visbuf -+const char *_nc_visbuf( -+ const char *buf) -+ { return(*(const char **)0); } -+ -+#undef _nc_visbufn -+const char *_nc_visbufn( -+ const char *buf, -+ int len) -+ { return(*(const char **)0); } -+ -+#undef _nc_viswbuf2 -+const char *_nc_viswbuf2( -+ int bufnum, -+ const wchar_t *buf) -+ { return(*(const char **)0); } -+ -+#undef _nc_viswbuf -+const char *_nc_viswbuf( -+ const wchar_t *buf) -+ { return(*(const char **)0); } -+ -+#undef _nc_viswbufn -+const char *_nc_viswbufn( -+ const wchar_t *buf, -+ int len) -+ { return(*(const char **)0); } -+ -+#undef _nc_viswibuf -+const char *_nc_viswibuf( -+ const wint_t *buf) -+ { return(*(const char **)0); } -+ -+#undef _nc_viscbuf2 -+const char *_nc_viscbuf2( -+ int bufnum, -+ const cchar_t *buf, -+ int len) -+ { return(*(const char **)0); } -+ -+#undef _nc_viscbuf -+const char *_nc_viscbuf( -+ const cchar_t *buf, -+ int len) -+ { return(*(const char **)0); } -+ -+/* ./base/define_key.c */ -+ -+#undef define_key_sp -+int define_key_sp( -+ SCREEN *sp, -+ const char *str, -+ int keycode) -+ { return(*(int *)0); } -+ -+#undef define_key -+int define_key( -+ const char *str, -+ int keycode) -+ { return(*(int *)0); } -+ -+/* ./tinfo/hashed_db.c */ -+ -+#undef _nc_hashed_db -+void _nc_hashed_db(void) -+ { /* void */ } -+ -+/* ./base/key_defined.c */ -+ -+#undef key_defined_sp -+int key_defined_sp( -+ SCREEN *sp, -+ const char *str) -+ { return(*(int *)0); } -+ -+#undef key_defined -+int key_defined( -+ const char *str) -+ { return(*(int *)0); } -+ -+/* ./base/keybound.c */ -+ -+#undef keybound_sp -+char *keybound_sp( -+ SCREEN *sp, -+ int code, -+ int count) -+ { return(*(char **)0); } -+ -+#undef keybound -+char *keybound( -+ int code, -+ int count) -+ { return(*(char **)0); } -+ -+/* ./base/keyok.c */ -+ -+#undef keyok_sp -+int keyok_sp( -+ SCREEN *sp, -+ int c, -+ NCURSES_BOOL flag) -+ { return(*(int *)0); } -+ -+#undef keyok -+int keyok( -+ int c, -+ NCURSES_BOOL flag) -+ { return(*(int *)0); } -+ -+/* ./base/version.c */ -+ -+#undef curses_version -+const char *curses_version(void) -+ { return(*(const char **)0); } -diff -Naur ncurses-5.9/ncurses/llib-ltinfow ncurses-5.9.patch/ncurses/llib-ltinfow ---- ncurses-5.9/ncurses/llib-ltinfow 1970-01-01 01:00:00.000000000 +0100 -+++ ncurses-5.9.patch/ncurses/llib-ltinfow 2014-09-01 16:33:22.419792227 +0200 -@@ -0,0 +1,1559 @@ -+/**************************************************************************** -+ * Copyright (c) 2012,2013 Free Software Foundation, Inc. * -+ * * -+ * Permission is hereby granted, free of charge, to any person obtaining a * -+ * copy of this software and associated documentation files (the * -+ * "Software"), to deal in the Software without restriction, including * -+ * without limitation the rights to use, copy, modify, merge, publish, * -+ * distribute, distribute with modifications, sublicense, and/or sell * -+ * copies of the Software, and to permit persons to whom the Software is * -+ * furnished to do so, subject to the following conditions: * -+ * * -+ * The above copyright notice and this permission notice shall be included * -+ * in all copies or substantial portions of the Software. * -+ * * -+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * -+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * -+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * -+ * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * -+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * -+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * -+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * -+ * * -+ * Except as contained in this notice, the name(s) of the above copyright * -+ * holders shall not be used in advertising or otherwise to promote the * -+ * sale, use or other dealings in this Software without prior written * -+ * authorization. * -+ ****************************************************************************/ -+ -+/**************************************************************************** -+ * Author: Thomas E. Dickey 2012 * -+ ****************************************************************************/ -+/* LINTLIBRARY */ -+ -+/* ./tinfo/access.c */ -+ -+#include <curses.priv.h> -+#include <ctype.h> -+#include <tic.h> -+ -+#undef _nc_rootname -+char *_nc_rootname( -+ char *path) -+ { return(*(char **)0); } -+ -+#undef _nc_is_abs_path -+NCURSES_BOOL _nc_is_abs_path( -+ const char *path) -+ { return(*(NCURSES_BOOL *)0); } -+ -+#undef _nc_pathlast -+unsigned _nc_pathlast( -+ const char *path) -+ { return(*(unsigned *)0); } -+ -+#undef _nc_basename -+char *_nc_basename( -+ char *path) -+ { return(*(char **)0); } -+ -+#undef _nc_access -+int _nc_access( -+ const char *path, -+ int mode) -+ { return(*(int *)0); } -+ -+#undef _nc_is_dir_path -+NCURSES_BOOL _nc_is_dir_path( -+ const char *path) -+ { return(*(NCURSES_BOOL *)0); } -+ -+#undef _nc_is_file_path -+NCURSES_BOOL _nc_is_file_path( -+ const char *path) -+ { return(*(NCURSES_BOOL *)0); } -+ -+#undef _nc_env_access -+int _nc_env_access(void) -+ { return(*(int *)0); } -+ -+/* ./tinfo/add_tries.c */ -+ -+#undef _nc_add_to_try -+int _nc_add_to_try( -+ TRIES **tree, -+ const char *str, -+ unsigned code) -+ { return(*(int *)0); } -+ -+/* ./tinfo/alloc_ttype.c */ -+ -+#undef _nc_align_termtype -+void _nc_align_termtype( -+ TERMTYPE *to, -+ TERMTYPE *from) -+ { /* void */ } -+ -+#undef _nc_copy_termtype -+void _nc_copy_termtype( -+ TERMTYPE *dst, -+ const TERMTYPE *src) -+ { /* void */ } -+ -+/* ./codes.c */ -+ -+#undef boolcodes -+char *const boolcodes[] = {0}; -+#undef numcodes -+char *const numcodes[] = {0}; -+#undef strcodes -+char *const strcodes[] = {0}; -+ -+/* ./comp_captab.c */ -+ -+#include <hashsize.h> -+ -+#undef _nc_get_table -+const struct name_table_entry *_nc_get_table( -+ NCURSES_BOOL termcap) -+ { return(*(const struct name_table_entry **)0); } -+ -+#undef _nc_get_hash_table -+const HashValue *_nc_get_hash_table( -+ NCURSES_BOOL termcap) -+ { return(*(const HashValue **)0); } -+ -+#undef _nc_get_alias_table -+const struct alias *_nc_get_alias_table( -+ NCURSES_BOOL termcap) -+ { return(*(const struct alias **)0); } -+ -+#undef _nc_get_hash_info -+const HashData *_nc_get_hash_info( -+ NCURSES_BOOL termcap) -+ { return(*(const HashData **)0); } -+ -+/* ./tinfo/comp_error.c */ -+ -+#undef _nc_suppress_warnings -+NCURSES_BOOL _nc_suppress_warnings; -+#undef _nc_curr_line -+int _nc_curr_line; -+#undef _nc_curr_col -+int _nc_curr_col; -+ -+#undef _nc_get_source -+const char *_nc_get_source(void) -+ { return(*(const char **)0); } -+ -+#undef _nc_set_source -+void _nc_set_source( -+ const char *const name) -+ { /* void */ } -+ -+#undef _nc_set_type -+void _nc_set_type( -+ const char *const name) -+ { /* void */ } -+ -+#undef _nc_get_type -+void _nc_get_type( -+ char *name) -+ { /* void */ } -+ -+#undef _nc_warning -+void _nc_warning( -+ const char *const fmt, -+ ...) -+ { /* void */ } -+ -+#undef _nc_err_abort -+void _nc_err_abort( -+ const char *const fmt, -+ ...) -+ { /* void */ } -+ -+#undef _nc_syserr_abort -+void _nc_syserr_abort( -+ const char *const fmt, -+ ...) -+ { /* void */ } -+ -+/* ./tinfo/comp_hash.c */ -+ -+#undef _nc_find_entry -+struct name_table_entry const *_nc_find_entry( -+ const char *string, -+ const HashValue *hash_table) -+ { return(*(struct name_table_entry const **)0); } -+ -+#undef _nc_find_type_entry -+struct name_table_entry const *_nc_find_type_entry( -+ const char *string, -+ int type, -+ NCURSES_BOOL termcap) -+ { return(*(struct name_table_entry const **)0); } -+ -+/* ./tinfo/db_iterator.c */ -+ -+#include <time.h> -+ -+#undef _nc_tic_dir -+const char *_nc_tic_dir( -+ const char *path) -+ { return(*(const char **)0); } -+ -+#undef _nc_keep_tic_dir -+void _nc_keep_tic_dir( -+ const char *path) -+ { /* void */ } -+ -+#undef _nc_last_db -+void _nc_last_db(void) -+ { /* void */ } -+ -+#undef _nc_next_db -+const char *_nc_next_db( -+ DBDIRS *state, -+ int *offset) -+ { return(*(const char **)0); } -+ -+#undef _nc_first_db -+void _nc_first_db( -+ DBDIRS *state, -+ int *offset) -+ { /* void */ } -+ -+/* ./tinfo/doalloc.c */ -+ -+#undef _nc_doalloc -+void *_nc_doalloc( -+ void *oldp, -+ size_t amount) -+ { return(*(void **)0); } -+ -+/* ./tinfo/entries.c */ -+ -+#undef _nc_head -+ENTRY *_nc_head; -+#undef _nc_tail -+ENTRY *_nc_tail; -+ -+#undef _nc_free_entry -+void _nc_free_entry( -+ ENTRY *headp, -+ TERMTYPE *tterm) -+ { /* void */ } -+ -+#undef _nc_free_entries -+void _nc_free_entries( -+ ENTRY *headp) -+ { /* void */ } -+ -+#undef _nc_delink_entry -+ENTRY *_nc_delink_entry( -+ ENTRY *headp, -+ TERMTYPE *tterm) -+ { return(*(ENTRY **)0); } -+ -+#undef _nc_leaks_tinfo -+void _nc_leaks_tinfo(void) -+ { /* void */ } -+ -+/* ./fallback.c */ -+ -+#undef _nc_fallback -+const TERMTYPE *_nc_fallback( -+ const char *name) -+ { return(*(const TERMTYPE **)0); } -+ -+/* ./tinfo/free_ttype.c */ -+ -+#undef _nc_free_termtype -+void _nc_free_termtype( -+ TERMTYPE *ptr) -+ { /* void */ } -+ -+#undef _nc_user_definable -+NCURSES_BOOL _nc_user_definable; -+ -+#undef use_extended_names -+int use_extended_names( -+ NCURSES_BOOL flag) -+ { return(*(int *)0); } -+ -+/* ./tinfo/getenv_num.c */ -+ -+#undef _nc_getenv_num -+int _nc_getenv_num( -+ const char *name) -+ { return(*(int *)0); } -+ -+#undef _nc_setenv_num -+void _nc_setenv_num( -+ const char *name, -+ int value) -+ { /* void */ } -+ -+/* ./tinfo/home_terminfo.c */ -+ -+#undef _nc_home_terminfo -+char *_nc_home_terminfo(void) -+ { return(*(char **)0); } -+ -+/* ./tinfo/init_keytry.c */ -+ -+#if 0 -+ -+#include <init_keytry.h> -+ -+#undef _nc_tinfo_fkeys -+const struct tinfo_fkeys _nc_tinfo_fkeys[] = {0}; -+ -+#endif -+ -+#undef _nc_init_keytry -+void _nc_init_keytry( -+ SCREEN *sp) -+ { /* void */ } -+ -+/* ./tinfo/lib_acs.c */ -+ -+#undef acs_map -+chtype acs_map[128]; -+ -+#undef _nc_init_acs_sp -+void _nc_init_acs_sp( -+ SCREEN *sp) -+ { /* void */ } -+ -+#undef _nc_init_acs -+void _nc_init_acs(void) -+ { /* void */ } -+ -+/* ./tinfo/lib_baudrate.c */ -+ -+#include <termcap.h> -+ -+struct speed { -+ int s; -+ int sp; -+}; -+ -+#undef _nc_baudrate -+int _nc_baudrate( -+ int OSpeed) -+ { return(*(int *)0); } -+ -+#undef _nc_ospeed -+int _nc_ospeed( -+ int BaudRate) -+ { return(*(int *)0); } -+ -+#undef baudrate_sp -+int baudrate_sp( -+ SCREEN *sp) -+ { return(*(int *)0); } -+ -+#undef baudrate -+int baudrate(void) -+ { return(*(int *)0); } -+ -+/* ./tinfo/lib_cur_term.c */ -+ -+#undef cur_term -+TERMINAL *cur_term; -+ -+#undef set_curterm_sp -+TERMINAL *set_curterm_sp( -+ SCREEN *sp, -+ TERMINAL *termp) -+ { return(*(TERMINAL **)0); } -+ -+#undef set_curterm -+TERMINAL *set_curterm( -+ TERMINAL *termp) -+ { return(*(TERMINAL **)0); } -+ -+#undef del_curterm_sp -+int del_curterm_sp( -+ SCREEN *sp, -+ TERMINAL *termp) -+ { return(*(int *)0); } -+ -+#undef del_curterm -+int del_curterm( -+ TERMINAL *termp) -+ { return(*(int *)0); } -+ -+/* ./tinfo/lib_data.c */ -+ -+#undef stdscr -+WINDOW *stdscr; -+#undef curscr -+WINDOW *curscr; -+#undef newscr -+WINDOW *newscr; -+#undef _nc_screen_chain -+SCREEN *_nc_screen_chain; -+#undef SP -+SCREEN *SP; -+#undef _nc_globals -+NCURSES_GLOBALS _nc_globals; -+#undef _nc_prescreen -+NCURSES_PRESCREEN _nc_prescreen; -+ -+#undef _nc_screen_of -+SCREEN *_nc_screen_of( -+ WINDOW *win) -+ { return(*(SCREEN **)0); } -+ -+/* ./tinfo/lib_has_cap.c */ -+ -+#undef has_ic_sp -+NCURSES_BOOL has_ic_sp( -+ SCREEN *sp) -+ { return(*(NCURSES_BOOL *)0); } -+ -+#undef has_ic -+NCURSES_BOOL has_ic(void) -+ { return(*(NCURSES_BOOL *)0); } -+ -+#undef has_il_sp -+NCURSES_BOOL has_il_sp( -+ SCREEN *sp) -+ { return(*(NCURSES_BOOL *)0); } -+ -+#undef has_il -+NCURSES_BOOL has_il(void) -+ { return(*(NCURSES_BOOL *)0); } -+ -+/* ./tinfo/lib_kernel.c */ -+ -+#undef erasechar_sp -+char erasechar_sp( -+ SCREEN *sp) -+ { return(*(char *)0); } -+ -+#undef erasechar -+char erasechar(void) -+ { return(*(char *)0); } -+ -+#undef killchar_sp -+char killchar_sp( -+ SCREEN *sp) -+ { return(*(char *)0); } -+ -+#undef killchar -+char killchar(void) -+ { return(*(char *)0); } -+ -+#undef flushinp_sp -+int flushinp_sp( -+ SCREEN *sp) -+ { return(*(int *)0); } -+ -+#undef flushinp -+int flushinp(void) -+ { return(*(int *)0); } -+ -+/* ./lib_keyname.c */ -+ -+struct kn { short offset; int code; }; -+ -+#undef keyname_sp -+char *keyname_sp( -+ SCREEN *sp, -+ int c) -+ { return(*(char **)0); } -+ -+#undef keyname -+char *keyname( -+ int c) -+ { return(*(char **)0); } -+ -+/* ./tinfo/lib_longname.c */ -+ -+#undef longname -+char *longname(void) -+ { return(*(char **)0); } -+ -+/* ./tinfo/lib_napms.c */ -+ -+#include <sys/time.h> -+ -+#undef napms_sp -+int napms_sp( -+ SCREEN *sp, -+ int ms) -+ { return(*(int *)0); } -+ -+#undef napms -+int napms( -+ int ms) -+ { return(*(int *)0); } -+ -+/* ./tinfo/lib_options.c */ -+ -+#undef idlok -+int idlok( -+ WINDOW *win, -+ NCURSES_BOOL flag) -+ { return(*(int *)0); } -+ -+#undef idcok -+void idcok( -+ WINDOW *win, -+ NCURSES_BOOL flag) -+ { /* void */ } -+ -+#undef halfdelay_sp -+int halfdelay_sp( -+ SCREEN *sp, -+ int t) -+ { return(*(int *)0); } -+ -+#undef halfdelay -+int halfdelay( -+ int t) -+ { return(*(int *)0); } -+ -+#undef nodelay -+int nodelay( -+ WINDOW *win, -+ NCURSES_BOOL flag) -+ { return(*(int *)0); } -+ -+#undef notimeout -+int notimeout( -+ WINDOW *win, -+ NCURSES_BOOL f) -+ { return(*(int *)0); } -+ -+#undef wtimeout -+void wtimeout( -+ WINDOW *win, -+ int delay) -+ { /* void */ } -+ -+#undef keypad -+int keypad( -+ WINDOW *win, -+ NCURSES_BOOL flag) -+ { return(*(int *)0); } -+ -+#undef meta -+int meta( -+ WINDOW *win, -+ NCURSES_BOOL flag) -+ { return(*(int *)0); } -+ -+#undef curs_set_sp -+int curs_set_sp( -+ SCREEN *sp, -+ int vis) -+ { return(*(int *)0); } -+ -+#undef curs_set -+int curs_set( -+ int vis) -+ { return(*(int *)0); } -+ -+#undef typeahead_sp -+int typeahead_sp( -+ SCREEN *sp, -+ int fd) -+ { return(*(int *)0); } -+ -+#undef typeahead -+int typeahead( -+ int fd) -+ { return(*(int *)0); } -+ -+#undef has_key_sp -+int has_key_sp( -+ SCREEN *sp, -+ int keycode) -+ { return(*(int *)0); } -+ -+#undef has_key -+int has_key( -+ int keycode) -+ { return(*(int *)0); } -+ -+#undef _nc_putp_flush_sp -+int _nc_putp_flush_sp( -+ SCREEN *sp, -+ const char *name, -+ const char *value) -+ { return(*(int *)0); } -+ -+#undef _nc_keypad -+int _nc_keypad( -+ SCREEN *sp, -+ int flag) -+ { return(*(int *)0); } -+ -+/* ./tinfo/lib_raw.c */ -+ -+#undef raw_sp -+int raw_sp( -+ SCREEN *sp) -+ { return(*(int *)0); } -+ -+#undef raw -+int raw(void) -+ { return(*(int *)0); } -+ -+#undef cbreak_sp -+int cbreak_sp( -+ SCREEN *sp) -+ { return(*(int *)0); } -+ -+#undef cbreak -+int cbreak(void) -+ { return(*(int *)0); } -+ -+#undef qiflush_sp -+void qiflush_sp( -+ SCREEN *sp) -+ { /* void */ } -+ -+#undef qiflush -+void qiflush(void) -+ { /* void */ } -+ -+#undef noraw_sp -+int noraw_sp( -+ SCREEN *sp) -+ { return(*(int *)0); } -+ -+#undef noraw -+int noraw(void) -+ { return(*(int *)0); } -+ -+#undef nocbreak_sp -+int nocbreak_sp( -+ SCREEN *sp) -+ { return(*(int *)0); } -+ -+#undef nocbreak -+int nocbreak(void) -+ { return(*(int *)0); } -+ -+#undef noqiflush_sp -+void noqiflush_sp( -+ SCREEN *sp) -+ { /* void */ } -+ -+#undef noqiflush -+void noqiflush(void) -+ { /* void */ } -+ -+#undef intrflush_sp -+int intrflush_sp( -+ SCREEN *sp, -+ WINDOW *win, -+ NCURSES_BOOL flag) -+ { return(*(int *)0); } -+ -+#undef intrflush -+int intrflush( -+ WINDOW *win, -+ NCURSES_BOOL flag) -+ { return(*(int *)0); } -+ -+/* ./tinfo/lib_setup.c */ -+ -+#include <locale.h> -+#include <sys/ioctl.h> -+#include <langinfo.h> -+ -+#undef ttytype -+char ttytype[256]; -+#undef LINES -+int LINES; -+#undef COLS -+int COLS; -+#undef TABSIZE -+int TABSIZE; -+ -+#undef set_tabsize_sp -+int set_tabsize_sp( -+ SCREEN *sp, -+ int value) -+ { return(*(int *)0); } -+ -+#undef set_tabsize -+int set_tabsize( -+ int value) -+ { return(*(int *)0); } -+ -+#undef _nc_handle_sigwinch -+int _nc_handle_sigwinch( -+ SCREEN *sp) -+ { return(*(int *)0); } -+ -+#undef use_env_sp -+void use_env_sp( -+ SCREEN *sp, -+ NCURSES_BOOL f) -+ { /* void */ } -+ -+#undef use_tioctl_sp -+void use_tioctl_sp( -+ SCREEN *sp, -+ NCURSES_BOOL f) -+ { /* void */ } -+ -+#undef use_env -+void use_env( -+ NCURSES_BOOL f) -+ { /* void */ } -+ -+#undef use_tioctl -+void use_tioctl( -+ NCURSES_BOOL f) -+ { /* void */ } -+ -+#undef _nc_get_screensize -+void _nc_get_screensize( -+ SCREEN *sp, -+ int *linep, -+ int *colp) -+ { /* void */ } -+ -+#undef _nc_update_screensize -+void _nc_update_screensize( -+ SCREEN *sp) -+ { /* void */ } -+ -+#undef _nc_setup_tinfo -+int _nc_setup_tinfo( -+ const char *const tn, -+ TERMTYPE *const tp) -+ { return(*(int *)0); } -+ -+#undef _nc_tinfo_cmdch -+void _nc_tinfo_cmdch( -+ TERMINAL *termp, -+ int proto) -+ { /* void */ } -+ -+#undef _nc_get_locale -+char *_nc_get_locale(void) -+ { return(*(char **)0); } -+ -+#undef _nc_unicode_locale -+int _nc_unicode_locale(void) -+ { return(*(int *)0); } -+ -+#undef _nc_locale_breaks_acs -+int _nc_locale_breaks_acs( -+ TERMINAL *termp) -+ { return(*(int *)0); } -+ -+#undef _nc_setupterm -+int _nc_setupterm( -+ char *tname, -+ int Filedes, -+ int *errret, -+ int reuse) -+ { return(*(int *)0); } -+ -+#undef new_prescr -+SCREEN *new_prescr(void) -+ { return(*(SCREEN **)0); } -+ -+#undef setupterm -+int setupterm( -+ char *tname, -+ int Filedes, -+ int *errret) -+ { return(*(int *)0); } -+ -+/* ./tinfo/lib_termcap.c */ -+ -+#undef UP -+char *UP; -+#undef BC -+char *BC; -+ -+#undef tgetent_sp -+int tgetent_sp( -+ SCREEN *sp, -+ char *bufp, -+ const char *name) -+ { return(*(int *)0); } -+ -+#if 0 -+ -+#include <capdefaults.c> -+ -+#endif -+ -+#undef tgetent -+int tgetent( -+ char *bufp, -+ const char *name) -+ { return(*(int *)0); } -+ -+#undef tgetflag_sp -+int tgetflag_sp( -+ SCREEN *sp, -+ char *id) -+ { return(*(int *)0); } -+ -+#undef tgetflag -+int tgetflag( -+ char *id) -+ { return(*(int *)0); } -+ -+#undef tgetnum_sp -+int tgetnum_sp( -+ SCREEN *sp, -+ char *id) -+ { return(*(int *)0); } -+ -+#undef tgetnum -+int tgetnum( -+ char *id) -+ { return(*(int *)0); } -+ -+#undef tgetstr_sp -+char *tgetstr_sp( -+ SCREEN *sp, -+ char *id, -+ char **area) -+ { return(*(char **)0); } -+ -+#undef tgetstr -+char *tgetstr( -+ char *id, -+ char **area) -+ { return(*(char **)0); } -+ -+/* ./tinfo/lib_termname.c */ -+ -+#undef termname_sp -+char *termname_sp( -+ SCREEN *sp) -+ { return(*(char **)0); } -+ -+#undef termname -+char *termname(void) -+ { return(*(char **)0); } -+ -+/* ./tinfo/lib_tgoto.c */ -+ -+#undef tgoto -+char *tgoto( -+ const char *string, -+ int x, -+ int y) -+ { return(*(char **)0); } -+ -+/* ./tinfo/lib_ti.c */ -+ -+#undef tigetflag_sp -+int tigetflag_sp( -+ SCREEN *sp, -+ char *str) -+ { return(*(int *)0); } -+ -+#undef tigetflag -+int tigetflag( -+ char *str) -+ { return(*(int *)0); } -+ -+#undef tigetnum_sp -+int tigetnum_sp( -+ SCREEN *sp, -+ char *str) -+ { return(*(int *)0); } -+ -+#undef tigetnum -+int tigetnum( -+ char *str) -+ { return(*(int *)0); } -+ -+#undef tigetstr_sp -+char *tigetstr_sp( -+ SCREEN *sp, -+ char *str) -+ { return(*(char **)0); } -+ -+#undef tigetstr -+char *tigetstr( -+ char *str) -+ { return(*(char **)0); } -+ -+/* ./tinfo/lib_tparm.c */ -+ -+#undef _nc_tparm_err -+int _nc_tparm_err; -+ -+#undef _nc_tparm_analyze -+int _nc_tparm_analyze( -+ const char *string, -+ char *p_is_s[9], -+ int *_nc_popcount) -+ { return(*(int *)0); } -+ -+#undef tparm -+char *tparm( -+ char *string, -+ ...) -+ { return(*(char **)0); } -+ -+#undef tiparm -+char *tiparm( -+ const char *string, -+ ...) -+ { return(*(char **)0); } -+ -+/* ./tinfo/lib_tputs.c */ -+ -+#undef PC -+char PC; -+#undef ospeed -+short ospeed; -+#undef _nc_nulls_sent -+int _nc_nulls_sent; -+ -+#undef _nc_set_no_padding -+void _nc_set_no_padding( -+ SCREEN *sp) -+ { /* void */ } -+ -+#undef delay_output_sp -+int delay_output_sp( -+ SCREEN *sp, -+ int ms) -+ { return(*(int *)0); } -+ -+#undef delay_output -+int delay_output( -+ int ms) -+ { return(*(int *)0); } -+ -+#undef _nc_flush_sp -+void _nc_flush_sp( -+ SCREEN *sp) -+ { /* void */ } -+ -+#undef _nc_flush -+void _nc_flush(void) -+ { /* void */ } -+ -+#undef _nc_outch_sp -+int _nc_outch_sp( -+ SCREEN *sp, -+ int ch) -+ { return(*(int *)0); } -+ -+#undef _nc_outch -+int _nc_outch( -+ int ch) -+ { return(*(int *)0); } -+ -+#undef _nc_putchar_sp -+int _nc_putchar_sp( -+ SCREEN *sp, -+ int ch) -+ { return(*(int *)0); } -+ -+#undef _nc_putchar -+int _nc_putchar( -+ int ch) -+ { return(*(int *)0); } -+ -+#undef putp_sp -+int putp_sp( -+ SCREEN *sp, -+ const char *string) -+ { return(*(int *)0); } -+ -+#undef putp -+int putp( -+ const char *string) -+ { return(*(int *)0); } -+ -+#undef _nc_putp_sp -+int _nc_putp_sp( -+ SCREEN *sp, -+ const char *name, -+ const char *string) -+ { return(*(int *)0); } -+ -+#undef _nc_putp -+int _nc_putp( -+ const char *name, -+ const char *string) -+ { return(*(int *)0); } -+ -+#undef tputs_sp -+int tputs_sp( -+ SCREEN *sp, -+ const char *string, -+ int affcnt, -+ NCURSES_OUTC_sp outc) -+ { return(*(int *)0); } -+ -+#undef _nc_outc_wrapper -+int _nc_outc_wrapper( -+ SCREEN *sp, -+ int c) -+ { return(*(int *)0); } -+ -+#undef tputs -+int tputs( -+ const char *string, -+ int affcnt, -+ int (*outc)( -+ int p1)) -+ { return(*(int *)0); } -+ -+/* ./trace/lib_trace.c */ -+ -+#undef _nc_tracing -+unsigned _nc_tracing; -+#undef _nc_tputs_trace -+const char *_nc_tputs_trace = {0}; -+#undef _nc_outchars -+long _nc_outchars; -+ -+#undef trace -+void trace( -+ const unsigned int tracelevel) -+ { /* void */ } -+ -+#undef _tracef -+void _tracef( -+ const char *fmt, -+ ...) -+ { /* void */ } -+ -+#undef _nc_retrace_bool -+NCURSES_BOOL _nc_retrace_bool( -+ int code) -+ { return(*(NCURSES_BOOL *)0); } -+ -+#undef _nc_retrace_char -+char _nc_retrace_char( -+ int code) -+ { return(*(char *)0); } -+ -+#undef _nc_retrace_int -+int _nc_retrace_int( -+ int code) -+ { return(*(int *)0); } -+ -+#undef _nc_retrace_unsigned -+unsigned _nc_retrace_unsigned( -+ unsigned code) -+ { return(*(unsigned *)0); } -+ -+#undef _nc_retrace_ptr -+char *_nc_retrace_ptr( -+ char *code) -+ { return(*(char **)0); } -+ -+#undef _nc_retrace_cptr -+const char *_nc_retrace_cptr( -+ const char *code) -+ { return(*(const char **)0); } -+ -+#undef _nc_retrace_cvoid_ptr -+void *_nc_retrace_cvoid_ptr( -+ void *code) -+ { return(*(void **)0); } -+ -+#undef _nc_retrace_void_ptr -+void *_nc_retrace_void_ptr( -+ void *code) -+ { return(*(void **)0); } -+ -+#undef _nc_retrace_sp -+SCREEN *_nc_retrace_sp( -+ SCREEN *code) -+ { return(*(SCREEN **)0); } -+ -+#undef _nc_retrace_win -+WINDOW *_nc_retrace_win( -+ WINDOW *code) -+ { return(*(WINDOW **)0); } -+ -+/* ./trace/lib_traceatr.c */ -+ -+#undef _traceattr2 -+char *_traceattr2( -+ int bufnum, -+ chtype newmode) -+ { return(*(char **)0); } -+ -+#undef _traceattr -+char *_traceattr( -+ attr_t newmode) -+ { return(*(char **)0); } -+ -+#undef _nc_retrace_int_attr_t -+int _nc_retrace_int_attr_t( -+ attr_t code) -+ { return(*(int *)0); } -+ -+#undef _nc_retrace_attr_t -+attr_t _nc_retrace_attr_t( -+ attr_t code) -+ { return(*(attr_t *)0); } -+ -+#undef _nc_altcharset_name -+const char *_nc_altcharset_name( -+ attr_t attr, -+ chtype ch) -+ { return(*(const char **)0); } -+ -+#undef _tracechtype2 -+char *_tracechtype2( -+ int bufnum, -+ chtype ch) -+ { return(*(char **)0); } -+ -+#undef _tracechtype -+char *_tracechtype( -+ chtype ch) -+ { return(*(char **)0); } -+ -+#undef _nc_retrace_chtype -+chtype _nc_retrace_chtype( -+ chtype code) -+ { return(*(chtype *)0); } -+ -+#undef _tracecchar_t2 -+char *_tracecchar_t2( -+ int bufnum, -+ const cchar_t *ch) -+ { return(*(char **)0); } -+ -+#undef _tracecchar_t -+char *_tracecchar_t( -+ const cchar_t *ch) -+ { return(*(char **)0); } -+ -+/* ./trace/lib_tracebits.c */ -+ -+typedef struct { -+ unsigned int val; -+ const char *name; -+} BITNAMES; -+ -+#undef _nc_trace_ttymode -+char *_nc_trace_ttymode( -+ struct termios *tty) -+ { return(*(char **)0); } -+ -+#undef _nc_tracebits -+char *_nc_tracebits(void) -+ { return(*(char **)0); } -+ -+/* ./trace/lib_tracechr.c */ -+ -+#undef _nc_tracechar -+char *_nc_tracechar( -+ SCREEN *sp, -+ int ch) -+ { return(*(char **)0); } -+ -+#undef _tracechar -+char *_tracechar( -+ int ch) -+ { return(*(char **)0); } -+ -+/* ./tinfo/lib_ttyflags.c */ -+ -+#undef _nc_get_tty_mode_sp -+int _nc_get_tty_mode_sp( -+ SCREEN *sp, -+ struct termios *buf) -+ { return(*(int *)0); } -+ -+#undef _nc_get_tty_mode -+int _nc_get_tty_mode( -+ struct termios *buf) -+ { return(*(int *)0); } -+ -+#undef _nc_set_tty_mode_sp -+int _nc_set_tty_mode_sp( -+ SCREEN *sp, -+ struct termios *buf) -+ { return(*(int *)0); } -+ -+#undef _nc_set_tty_mode -+int _nc_set_tty_mode( -+ struct termios *buf) -+ { return(*(int *)0); } -+ -+#undef def_shell_mode_sp -+int def_shell_mode_sp( -+ SCREEN *sp) -+ { return(*(int *)0); } -+ -+#undef def_shell_mode -+int def_shell_mode(void) -+ { return(*(int *)0); } -+ -+#undef def_prog_mode_sp -+int def_prog_mode_sp( -+ SCREEN *sp) -+ { return(*(int *)0); } -+ -+#undef def_prog_mode -+int def_prog_mode(void) -+ { return(*(int *)0); } -+ -+#undef reset_prog_mode_sp -+int reset_prog_mode_sp( -+ SCREEN *sp) -+ { return(*(int *)0); } -+ -+#undef reset_prog_mode -+int reset_prog_mode(void) -+ { return(*(int *)0); } -+ -+#undef reset_shell_mode_sp -+int reset_shell_mode_sp( -+ SCREEN *sp) -+ { return(*(int *)0); } -+ -+#undef reset_shell_mode -+int reset_shell_mode(void) -+ { return(*(int *)0); } -+ -+#undef savetty_sp -+int savetty_sp( -+ SCREEN *sp) -+ { return(*(int *)0); } -+ -+#undef savetty -+int savetty(void) -+ { return(*(int *)0); } -+ -+#undef resetty_sp -+int resetty_sp( -+ SCREEN *sp) -+ { return(*(int *)0); } -+ -+#undef resetty -+int resetty(void) -+ { return(*(int *)0); } -+ -+/* ./tty/lib_twait.c */ -+ -+#undef _nc_timed_wait -+int _nc_timed_wait( -+ SCREEN *sp, -+ int mode, -+ int milliseconds, -+ int *timeleft) -+ { return(*(int *)0); } -+ -+/* ./tinfo/name_match.c */ -+ -+#undef _nc_first_name -+char *_nc_first_name( -+ const char *const sp) -+ { return(*(char **)0); } -+ -+#undef _nc_name_match -+int _nc_name_match( -+ const char *const namelst, -+ const char *const name, -+ const char *const delim) -+ { return(*(int *)0); } -+ -+/* ./names.c */ -+ -+#undef boolnames -+char *const boolnames[] = {0}; -+#undef boolfnames -+char *const boolfnames[] = {0}; -+#undef numnames -+char *const numnames[] = {0}; -+#undef numfnames -+char *const numfnames[] = {0}; -+#undef strnames -+char *const strnames[] = {0}; -+#undef strfnames -+char *const strfnames[] = {0}; -+ -+/* ./tinfo/obsolete.c */ -+ -+#undef _nc_set_buffer_sp -+void _nc_set_buffer_sp( -+ SCREEN *sp, -+ FILE *ofp, -+ int buffered) -+ { /* void */ } -+ -+#undef _nc_set_buffer -+void _nc_set_buffer( -+ FILE *ofp, -+ int buffered) -+ { /* void */ } -+ -+/* ./tinfo/read_entry.c */ -+ -+#include <hashed_db.h> -+ -+#undef _nc_init_termtype -+void _nc_init_termtype( -+ TERMTYPE *const tp) -+ { /* void */ } -+ -+#undef _nc_read_termtype -+int _nc_read_termtype( -+ TERMTYPE *ptr, -+ char *buffer, -+ int limit) -+ { return(*(int *)0); } -+ -+#undef _nc_read_file_entry -+int _nc_read_file_entry( -+ const char *const filename, -+ TERMTYPE *ptr) -+ { return(*(int *)0); } -+ -+#undef _nc_read_entry -+int _nc_read_entry( -+ const char *const name, -+ char *const filename, -+ TERMTYPE *const tp) -+ { return(*(int *)0); } -+ -+/* ./tinfo/read_termcap.c */ -+ -+#include <sys/types.h> -+ -+#undef _nc_read_termcap -+void _nc_read_termcap(void) -+ { /* void */ } -+ -+/* ./tinfo/strings.c */ -+ -+#undef _nc_str_init -+string_desc *_nc_str_init( -+ string_desc *dst, -+ char *src, -+ size_t len) -+ { return(*(string_desc **)0); } -+ -+#undef _nc_str_null -+string_desc *_nc_str_null( -+ string_desc *dst, -+ size_t len) -+ { return(*(string_desc **)0); } -+ -+#undef _nc_str_copy -+string_desc *_nc_str_copy( -+ string_desc *dst, -+ string_desc *src) -+ { return(*(string_desc **)0); } -+ -+#undef _nc_safe_strcat -+NCURSES_BOOL _nc_safe_strcat( -+ string_desc *dst, -+ const char *src) -+ { return(*(NCURSES_BOOL *)0); } -+ -+#undef _nc_safe_strcpy -+NCURSES_BOOL _nc_safe_strcpy( -+ string_desc *dst, -+ const char *src) -+ { return(*(NCURSES_BOOL *)0); } -+ -+/* ./trace/trace_buf.c */ -+ -+#undef _nc_trace_buf -+char *_nc_trace_buf( -+ int bufnum, -+ size_t want) -+ { return(*(char **)0); } -+ -+#undef _nc_trace_bufcat -+char *_nc_trace_bufcat( -+ int bufnum, -+ const char *value) -+ { return(*(char **)0); } -+ -+/* ./trace/trace_tries.c */ -+ -+#undef _nc_trace_tries -+void _nc_trace_tries( -+ TRIES *tree) -+ { /* void */ } -+ -+/* ./base/tries.c */ -+ -+#undef _nc_expand_try -+char *_nc_expand_try( -+ TRIES *tree, -+ unsigned code, -+ int *count, -+ size_t len) -+ { return(*(char **)0); } -+ -+#undef _nc_remove_key -+int _nc_remove_key( -+ TRIES **tree, -+ unsigned code) -+ { return(*(int *)0); } -+ -+#undef _nc_remove_string -+int _nc_remove_string( -+ TRIES **tree, -+ const char *string) -+ { return(*(int *)0); } -+ -+/* ./tinfo/trim_sgr0.c */ -+ -+#undef _nc_trim_sgr0 -+char *_nc_trim_sgr0( -+ TERMTYPE *tp) -+ { return(*(char **)0); } -+ -+/* ./unctrl.c */ -+ -+#undef unctrl_sp -+char *unctrl_sp( -+ SCREEN *sp, -+ chtype ch) -+ { return(*(char **)0); } -+ -+#undef unctrl -+char *unctrl( -+ chtype ch) -+ { return(*(char **)0); } -+ -+/* ./trace/visbuf.c */ -+ -+#undef _nc_visbuf2 -+const char *_nc_visbuf2( -+ int bufnum, -+ const char *buf) -+ { return(*(const char **)0); } -+ -+#undef _nc_visbuf -+const char *_nc_visbuf( -+ const char *buf) -+ { return(*(const char **)0); } -+ -+#undef _nc_visbufn -+const char *_nc_visbufn( -+ const char *buf, -+ int len) -+ { return(*(const char **)0); } -+ -+#undef _nc_viswbuf2 -+const char *_nc_viswbuf2( -+ int bufnum, -+ const wchar_t *buf) -+ { return(*(const char **)0); } -+ -+#undef _nc_viswbuf -+const char *_nc_viswbuf( -+ const wchar_t *buf) -+ { return(*(const char **)0); } -+ -+#undef _nc_viswbufn -+const char *_nc_viswbufn( -+ const wchar_t *buf, -+ int len) -+ { return(*(const char **)0); } -+ -+#undef _nc_viswibuf -+const char *_nc_viswibuf( -+ const wint_t *buf) -+ { return(*(const char **)0); } -+ -+#undef _nc_viscbuf2 -+const char *_nc_viscbuf2( -+ int bufnum, -+ const cchar_t *buf, -+ int len) -+ { return(*(const char **)0); } -+ -+#undef _nc_viscbuf -+const char *_nc_viscbuf( -+ const cchar_t *buf, -+ int len) -+ { return(*(const char **)0); } -+ -+/* ./base/define_key.c */ -+ -+#undef define_key_sp -+int define_key_sp( -+ SCREEN *sp, -+ const char *str, -+ int keycode) -+ { return(*(int *)0); } -+ -+#undef define_key -+int define_key( -+ const char *str, -+ int keycode) -+ { return(*(int *)0); } -+ -+/* ./tinfo/hashed_db.c */ -+ -+#undef _nc_hashed_db -+void _nc_hashed_db(void) -+ { /* void */ } -+ -+/* ./base/key_defined.c */ -+ -+#undef key_defined_sp -+int key_defined_sp( -+ SCREEN *sp, -+ const char *str) -+ { return(*(int *)0); } -+ -+#undef key_defined -+int key_defined( -+ const char *str) -+ { return(*(int *)0); } -+ -+/* ./base/keybound.c */ -+ -+#undef keybound_sp -+char *keybound_sp( -+ SCREEN *sp, -+ int code, -+ int count) -+ { return(*(char **)0); } -+ -+#undef keybound -+char *keybound( -+ int code, -+ int count) -+ { return(*(char **)0); } -+ -+/* ./base/keyok.c */ -+ -+#undef keyok_sp -+int keyok_sp( -+ SCREEN *sp, -+ int c, -+ NCURSES_BOOL flag) -+ { return(*(int *)0); } -+ -+#undef keyok -+int keyok( -+ int c, -+ NCURSES_BOOL flag) -+ { return(*(int *)0); } -+ -+/* ./base/version.c */ -+ -+#undef curses_version -+const char *curses_version(void) -+ { return(*(const char **)0); } -diff -Naur ncurses-5.9/ncurses/Makefile.in ncurses-5.9.patch/ncurses/Makefile.in ---- ncurses-5.9/ncurses/Makefile.in 2010-11-27 22:45:27.000000000 +0100 -+++ ncurses-5.9.patch/ncurses/Makefile.in 2014-09-01 16:33:22.369792144 +0200 -@@ -1,6 +1,6 @@ --# $Id: Makefile.in,v 1.130 2010/11/27 21:45:27 tom Exp $ -+# $Id: Makefile.in,v 1.139 2013/08/04 20:20:45 tom Exp $ - ############################################################################## --# Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. # -+# Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. # - # # - # Permission is hereby granted, free of charge, to any person obtaining a # - # copy of this software and associated documentation files (the "Software"), # -@@ -64,7 +64,11 @@ - bindir = @bindir@ - libdir = @libdir@ - includedir = @includedir@ -+datarootdir = @datarootdir@ - datadir = @datadir@ -+includesubdir = @includesubdir@ -+ -+INCLUDEDIR = $(DESTDIR)$(includedir)$(includesubdir) - - LIBTOOL = @LIBTOOL@ - LIBTOOL_CLEAN = @LIB_CLEAN@ -@@ -84,6 +88,7 @@ - AWK = @AWK@ - LD = @LD@ - LN_S = @LN_S@ -+NM = @NM@ - - CTAGS = @CTAGS@ - ETAGS = @ETAGS@ -@@ -107,7 +112,7 @@ - # is compiled into the build, or are test-programs that are not installed. - - BUILD_EXEEXT = @BUILD_EXEEXT@ --x = @PROG_EXT@ -+x = @EXEEXT@ - - CFLAGS_LIBTOOL = $(CCFLAGS) - CFLAGS_NORMAL = $(CCFLAGS) -@@ -125,6 +130,7 @@ - TINFO_LIST = $(SHLIB_DIRS) @TINFO_LIST@ - TICS_LIST = $(SHLIB_DIRS) @TICS_LIST@ - -+RPATH_LIST = @RPATH_LIST@ - MK_SHARED_LIB = @MK_SHARED_LIB@ - - NCURSES_MAJOR = @NCURSES_MAJOR@ -@@ -134,7 +140,7 @@ - - RANLIB = @LIB_PREP@ - --LIBRARIES = @LIBS_TO_MAKE@ -+LIBRARIES = @Libs_To_Make@ - - LINT = @LINT@ - LINT_OPTS = @LINT_OPTS@ -@@ -254,6 +260,9 @@ - @MAKE_UPPER_TAGS@TAGS: - @MAKE_UPPER_TAGS@ $(ETAGS) *.[ch] */*.[ch] - -+ncurses.map : $(LIBRARIES) -+ $(NM) -p $(LIBRARIES) >$@ -+ - mostlyclean :: - -rm -f core tags TAGS *~ *.bak *.i *.ln *.atac trace - -rm -f $(TEST_PROGS) -@@ -262,7 +271,7 @@ - -rm -f $(AUTO_SRC) - -rm -f make_keys$(BUILD_EXEEXT) - -rm -f make_hash$(BUILD_EXEEXT) -- -rm -rf .libs -+ -rm -rf .libs *.dSYM *.map - - distclean :: clean - -rm -f Makefile -@@ -282,21 +291,21 @@ - sh -e $(base)/MKlib_gen.sh "$(CPP) $(CPPFLAGS)" "$(AWK)" implemented <../include/curses.h >$@ - - captoinfo$x : $(tinfo)/captoinfo.c $(TEST_DEPS) -- @ECHO_LINK@ $(LIBTOOL_LINK) -o $@ $(CFLAGS_DEFAULT) -DMAIN $(tinfo)/captoinfo.c $(TEST_LDFLAGS) -+ @ECHO_LD@ $(LIBTOOL_LINK) -o $@ $(CFLAGS_DEFAULT) -DMAIN $(tinfo)/captoinfo.c $(TEST_LDFLAGS) - - hardscroll$x : $(serial)/hardscroll.c $(TEST_DEPS) -- @ECHO_LINK@ $(LIBTOOL_LINK) -o $@ $(CFLAGS_DEFAULT) -DSCROLLDEBUG $(serial)/hardscroll.c $(TEST_LDFLAGS) -+ @ECHO_LD@ $(LIBTOOL_LINK) -o $@ $(CFLAGS_DEFAULT) -DSCROLLDEBUG $(serial)/hardscroll.c $(TEST_LDFLAGS) - - hashmap$x : $(serial)/hashmap.c $(serial)/hardscroll.c $(TEST_DEPS) -- @ECHO_LINK@ $(LIBTOOL_LINK) -o $@ $(CFLAGS_DEFAULT) -DHASHDEBUG $(serial)/hashmap.c $(serial)/hardscroll.c $(TEST_LDFLAGS) -+ @ECHO_LD@ $(LIBTOOL_LINK) -o $@ $(CFLAGS_DEFAULT) -DHASHDEBUG $(serial)/hashmap.c $(serial)/hardscroll.c $(TEST_LDFLAGS) - - lib_mvcur$x : $(serial)/lib_mvcur.c $(TEST_DEPS) \ - ../@DFT_OBJ_SUBDIR@/dump_entry$o -- @ECHO_LINK@ $(LIBTOOL_LINK) -o $@ $(CFLAGS_DEFAULT) -DNCURSES_TEST -I$(serial)/../../progs $(serial)/lib_mvcur.c ../@DFT_OBJ_SUBDIR@/dump_entry$o $(TEST_LDFLAGS) -+ @ECHO_LD@ $(LIBTOOL_LINK) -o $@ $(CFLAGS_DEFAULT) -DNCURSES_TEST -I$(serial)/../../progs $(serial)/lib_mvcur.c ../@DFT_OBJ_SUBDIR@/dump_entry$o $(TEST_LDFLAGS) - - link_test$x : ./link_test.c $(TEST_DEPS) \ - ../@DFT_OBJ_SUBDIR@/link_test$o -- @ECHO_LINK@ $(CC) -o $@ $(CFLAGS_DEFAULT) ../@DFT_OBJ_SUBDIR@/link_test$o $(TEST_LDFLAGS) -+ @ECHO_LD@ $(CC) -o $@ $(CFLAGS_DEFAULT) ../@DFT_OBJ_SUBDIR@/link_test$o $(TEST_LDFLAGS) - - ../@DFT_OBJ_SUBDIR@/dump_entry$o: - cd ../progs && $(MAKE) ../@DFT_OBJ_SUBDIR@/dump_entry$o -diff -Naur ncurses-5.9/ncurses/modules ncurses-5.9.patch/ncurses/modules ---- ncurses-5.9/ncurses/modules 2010-08-07 20:41:02.000000000 +0200 -+++ ncurses-5.9.patch/ncurses/modules 2014-09-01 16:33:22.419792227 +0200 -@@ -1,6 +1,6 @@ --# $Id: modules,v 1.117 2010/08/07 18:41:02 tom Exp $ -+# $Id: modules,v 1.120 2013/01/26 22:17:55 tom Exp $ - ############################################################################## --# Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. # -+# Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. # - # # - # Permission is hereby granted, free of charge, to any person obtaining a # - # copy of this software and associated documentation files (the "Software"), # -@@ -115,7 +115,6 @@ - varargs lib $(trace) $(HEADER_DEPS) - - # Modules for porting --memmove lib $(base) $(HEADER_DEPS) - vsscanf lib $(base) $(HEADER_DEPS) - - # actually an extension, but with its own configure option (--disable-leaks) -@@ -199,9 +198,9 @@ - lib_twait lib $(serial) $(HEADER_DEPS) - name_match lib $(tinfo) $(HEADER_DEPS) $(INCDIR)/tic.h - names lib . $(HEADER_DEPS) -+obsolete lib $(tinfo) $(HEADER_DEPS) - read_entry lib $(tinfo) $(HEADER_DEPS) $(INCDIR)/tic.h $(INCDIR)/hashed_db.h - read_termcap lib $(tinfo) $(HEADER_DEPS) $(INCDIR)/tic.h --setbuf lib $(tinfo) $(HEADER_DEPS) - strings lib $(tinfo) $(HEADER_DEPS) - trace_buf lib $(trace) $(HEADER_DEPS) - trace_tries lib $(trace) $(HEADER_DEPS) -@@ -236,6 +235,7 @@ - @ port_win32con - gettimeofday lib $(win32con) $(HEADER_DEPS) - wcwidth lib $(win32con) $(HEADER_DEPS) -+widechars lib $(wide) $(HEADER_DEPS) - win_driver lib $(win32con) $(HEADER_DEPS) - - @ port_tinfo -diff -Naur ncurses-5.9/ncurses/tinfo/access.c ncurses-5.9.patch/ncurses/tinfo/access.c ---- ncurses-5.9/ncurses/tinfo/access.c 2010-01-23 18:57:43.000000000 +0100 -+++ ncurses-5.9.patch/ncurses/tinfo/access.c 2014-09-01 16:33:22.419792227 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -33,11 +33,18 @@ - #include <curses.priv.h> - - #include <ctype.h> --#include <sys/stat.h> - - #include <tic.h> - --MODULE_ID("$Id: access.c,v 1.16 2010/01/23 17:57:43 tom Exp $") -+MODULE_ID("$Id: access.c,v 1.23 2012/09/01 19:21:29 tom Exp $") -+ -+#ifdef __TANDEM -+#define ROOT_UID 65535 -+#endif -+ -+#ifndef ROOT_UID -+#define ROOT_UID 0 -+#endif - - #define LOWERCASE(c) ((isalpha(UChar(c)) && isupper(UChar(c))) ? tolower(UChar(c)) : (c)) - -@@ -53,7 +60,7 @@ - result = temp; - #if !MIXEDCASE_FILENAMES - for (s = result; *s != '\0'; ++s) { -- *s = LOWERCASE(*s); -+ *s = (char) LOWERCASE(*s); - } - #endif - #if defined(PROG_EXT) -@@ -108,24 +115,33 @@ - NCURSES_EXPORT(int) - _nc_access(const char *path, int mode) - { -- if (access(path, mode) < 0) { -+ int result; -+ -+ if (path == 0) { -+ result = -1; -+ } else if (access(path, mode) < 0) { - if ((mode & W_OK) != 0 - && errno == ENOENT - && strlen(path) < PATH_MAX) { - char head[PATH_MAX]; -- char *leaf = _nc_basename(strcpy(head, path)); -+ char *leaf; - -+ _nc_STRCPY(head, path, sizeof(head)); -+ leaf = _nc_basename(head); - if (leaf == 0) - leaf = head; - *leaf = '\0'; - if (head == leaf) -- (void) strcpy(head, "."); -+ _nc_STRCPY(head, ".", sizeof(head)); - -- return access(head, R_OK | W_OK | X_OK); -+ result = access(head, R_OK | W_OK | X_OK); -+ } else { -+ result = -1; - } -- return -1; -+ } else { -+ result = 0; - } -- return 0; -+ return result; - } - - NCURSES_EXPORT(bool) -@@ -135,7 +151,7 @@ - struct stat sb; - - if (stat(path, &sb) == 0 -- && (sb.st_mode & S_IFMT) == S_IFDIR) { -+ && S_ISDIR(sb.st_mode)) { - result = TRUE; - } - return result; -@@ -148,7 +164,7 @@ - struct stat sb; - - if (stat(path, &sb) == 0 -- && (sb.st_mode & S_IFMT) == S_IFREG) { -+ && S_ISREG(sb.st_mode)) { - result = TRUE; - } - return result; -@@ -170,6 +186,7 @@ - || getgid() != getegid()) - return FALSE; - #endif -- return getuid() != 0 && geteuid() != 0; /* ...finally, disallow root */ -+ /* ...finally, disallow root */ -+ return (getuid() != ROOT_UID) && (geteuid() != ROOT_UID); - } - #endif -diff -Naur ncurses-5.9/ncurses/tinfo/alloc_entry.c ncurses-5.9.patch/ncurses/tinfo/alloc_entry.c ---- ncurses-5.9/ncurses/tinfo/alloc_entry.c 2010-12-26 00:06:01.000000000 +0100 -+++ ncurses-5.9.patch/ncurses/tinfo/alloc_entry.c 2014-09-01 16:33:22.419792227 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2008,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -47,7 +47,7 @@ - - #include <tic.h> - --MODULE_ID("$Id: alloc_entry.c,v 1.51 2010/12/25 23:06:01 tom Exp $") -+MODULE_ID("$Id: alloc_entry.c,v 1.58 2013/08/17 19:20:38 tom Exp $") - - #define ABSENT_OFFSET -1 - #define CANCELLED_OFFSET -2 -@@ -61,8 +61,6 @@ - _nc_init_entry(TERMTYPE *const tp) - /* initialize a terminal type data block */ - { -- unsigned i; -- - #if NO_LEAKS - if (tp == 0) { - if (stringbuf != 0) { -@@ -73,33 +71,11 @@ - #endif - - if (stringbuf == 0) -- stringbuf = (char *) malloc(MAX_STRTAB); -- --#if NCURSES_XNAMES -- tp->num_Booleans = BOOLCOUNT; -- tp->num_Numbers = NUMCOUNT; -- tp->num_Strings = STRCOUNT; -- tp->ext_Booleans = 0; -- tp->ext_Numbers = 0; -- tp->ext_Strings = 0; --#endif -- if (tp->Booleans == 0) -- tp->Booleans = typeMalloc(NCURSES_SBOOL, BOOLCOUNT); -- if (tp->Numbers == 0) -- tp->Numbers = typeMalloc(short, NUMCOUNT); -- if (tp->Strings == 0) -- tp->Strings = typeMalloc(char *, STRCOUNT); -- -- for_each_boolean(i, tp) -- tp->Booleans[i] = FALSE; -- -- for_each_number(i, tp) -- tp->Numbers[i] = ABSENT_NUMERIC; -- -- for_each_string(i, tp) -- tp->Strings[i] = ABSENT_STRING; -+ TYPE_MALLOC(char, (size_t) MAX_STRTAB, stringbuf); - - next_free = 0; -+ -+ _nc_init_termtype(tp); - } - - NCURSES_EXPORT(ENTRY *) -@@ -131,13 +107,13 @@ - result = (stringbuf + next_free - 1); - } - } else if (next_free + len < MAX_STRTAB) { -- strcpy(&stringbuf[next_free], string); -+ _nc_STRCPY(&stringbuf[next_free], string, MAX_STRTAB); - DEBUG(7, ("Saved string %s", _nc_visbuf(string))); - DEBUG(7, ("at location %d", (int) next_free)); - next_free += len; - result = (stringbuf + old_next_free); - } else { -- _nc_warning("Too much data, some is lost"); -+ _nc_warning("Too much data, some is lost: %s", string); - } - return result; - } -@@ -194,8 +170,7 @@ - useoffsets[i] = (int) (ep->uses[i].name - stringbuf); - } - -- if ((tp->str_table = typeMalloc(char, next_free)) == (char *) 0) -- _nc_err_abort(MSG_NO_MEMORY); -+ TYPE_MALLOC(char, next_free, tp->str_table); - (void) memcpy(tp->str_table, stringbuf, next_free); - - tp->term_names = tp->str_table + n; -@@ -216,16 +191,18 @@ - if ((n = (unsigned) NUM_EXT_NAMES(tp)) != 0) { - if (n < SIZEOF(offsets)) { - size_t length = 0; -+ size_t offset; - for (i = 0; i < n; i++) { - length += strlen(tp->ext_Names[i]) + 1; - offsets[i] = (int) (tp->ext_Names[i] - stringbuf); - } -- if ((tp->ext_str_table = typeMalloc(char, length)) == 0) -- _nc_err_abort(MSG_NO_MEMORY); -- for (i = 0, length = 0; i < n; i++) { -- tp->ext_Names[i] = tp->ext_str_table + length; -- strcpy(tp->ext_Names[i], stringbuf + offsets[i]); -- length += strlen(tp->ext_Names[i]) + 1; -+ TYPE_MALLOC(char, length, tp->ext_str_table); -+ for (i = 0, offset = 0; i < n; i++) { -+ tp->ext_Names[i] = tp->ext_str_table + offset; -+ _nc_STRCPY(tp->ext_Names[i], -+ stringbuf + offsets[i], -+ length - offset); -+ offset += strlen(tp->ext_Names[i]) + 1; - } - } - } -diff -Naur ncurses-5.9/ncurses/tinfo/alloc_ttype.c ncurses-5.9.patch/ncurses/tinfo/alloc_ttype.c ---- ncurses-5.9/ncurses/tinfo/alloc_ttype.c 2010-12-19 01:24:09.000000000 +0100 -+++ ncurses-5.9.patch/ncurses/tinfo/alloc_ttype.c 2014-09-01 16:33:22.419792227 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1999-2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1999-2012,2013 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -42,7 +42,7 @@ - - #include <tic.h> - --MODULE_ID("$Id: alloc_ttype.c,v 1.22 2010/12/19 00:24:09 tom Exp $") -+MODULE_ID("$Id: alloc_ttype.c,v 1.27 2013/06/08 16:54:50 tom Exp $") - - #if NCURSES_XNAMES - /* -@@ -104,7 +104,7 @@ - - if (to->ext_Booleans != ext_Booleans) { - EXTEND_NUM(num_Booleans, ext_Booleans); -- to->Booleans = typeRealloc(NCURSES_SBOOL, to->num_Booleans, to->Booleans); -+ TYPE_REALLOC(NCURSES_SBOOL, to->num_Booleans, to->Booleans); - for (n = to->ext_Booleans - 1, - m = ext_Booleans - 1, - base = to->num_Booleans - (m + 1); m >= 0; m--) { -@@ -116,9 +116,10 @@ - } - to->ext_Booleans = UShort(ext_Booleans); - } -+ - if (to->ext_Numbers != ext_Numbers) { - EXTEND_NUM(num_Numbers, ext_Numbers); -- to->Numbers = typeRealloc(short, to->num_Numbers, to->Numbers); -+ TYPE_REALLOC(short, to->num_Numbers, to->Numbers); - for (n = to->ext_Numbers - 1, - m = ext_Numbers - 1, - base = to->num_Numbers - (m + 1); m >= 0; m--) { -@@ -132,7 +133,7 @@ - } - if (to->ext_Strings != ext_Strings) { - EXTEND_NUM(num_Strings, ext_Strings); -- to->Strings = typeRealloc(char *, to->num_Strings, to->Strings); -+ TYPE_REALLOC(char *, to->num_Strings, to->Strings); - for (n = to->ext_Strings - 1, - m = ext_Strings - 1, - base = to->num_Strings - (m + 1); m >= 0; m--) { -@@ -301,7 +302,7 @@ - } - } - -- tp->ext_Names = typeRealloc(char *, total, tp->ext_Names); -+ TYPE_REALLOC(char *, total, tp->ext_Names); - for (k = total - 1; k > j; k--) - tp->ext_Names[k] = tp->ext_Names[k - 1]; - tp->ext_Names[j] = name; -@@ -311,21 +312,21 @@ - case BOOLEAN: - tp->ext_Booleans++; - tp->num_Booleans++; -- tp->Booleans = typeRealloc(NCURSES_SBOOL, tp->num_Booleans, tp->Booleans); -+ TYPE_REALLOC(NCURSES_SBOOL, tp->num_Booleans, tp->Booleans); - for (k = (unsigned) (tp->num_Booleans - 1); k > j; k--) - tp->Booleans[k] = tp->Booleans[k - 1]; - break; - case NUMBER: - tp->ext_Numbers++; - tp->num_Numbers++; -- tp->Numbers = typeRealloc(short, tp->num_Numbers, tp->Numbers); -+ TYPE_REALLOC(short, tp->num_Numbers, tp->Numbers); - for (k = (unsigned) (tp->num_Numbers - 1); k > j; k--) - tp->Numbers[k] = tp->Numbers[k - 1]; - break; - case STRING: - tp->ext_Strings++; - tp->num_Strings++; -- tp->Strings = typeRealloc(char *, tp->num_Strings, tp->Strings); -+ TYPE_REALLOC(char *, tp->num_Strings, tp->Strings); - for (k = (unsigned) (tp->num_Strings - 1); k > j; k--) - tp->Strings[k] = tp->Strings[k - 1]; - break; -@@ -417,7 +418,7 @@ - * into it, updating to's counts for booleans, etc. Fortunately we do - * this only for the terminfo compiler (tic) and comparer (infocmp). - */ -- ext_Names = typeMalloc(char *, (size_t)(na + nb)); -+ TYPE_MALLOC(char *, (size_t)(na + nb), ext_Names); - - if (to->ext_Strings && (from->ext_Booleans + from->ext_Numbers)) - adjust_cancels(to, from); -@@ -461,7 +462,7 @@ - if (nb != (ext_Booleans + ext_Numbers + ext_Strings)) { - nb = (ext_Booleans + ext_Numbers + ext_Strings); - realign_data(from, ext_Names, ext_Booleans, ext_Numbers, ext_Strings); -- from->ext_Names = typeRealloc(char *, (size_t) nb, from->ext_Names); -+ TYPE_REALLOC(char *, (size_t) nb, from->ext_Names); - memcpy(from->ext_Names, ext_Names, sizeof(char *) * (size_t) nb); - DEBUG(2, ("realigned %d extended names for '%s' (from)", - NUM_EXT_NAMES(from), from->term_names)); -@@ -473,22 +474,27 @@ - #endif - - NCURSES_EXPORT(void) --_nc_copy_termtype(TERMTYPE *dst, TERMTYPE *src) -+_nc_copy_termtype(TERMTYPE *dst, const TERMTYPE *src) - { -+#if NCURSES_XNAMES - unsigned i; -+#endif - - *dst = *src; /* ...to copy the sizes and string-tables */ -- dst->Booleans = typeMalloc(NCURSES_SBOOL, NUM_BOOLEANS(dst)); -- dst->Numbers = typeMalloc(short, NUM_NUMBERS(dst)); -- dst->Strings = typeMalloc(char *, NUM_STRINGS(dst)); -- -- /* FIXME: use memcpy for these and similar loops */ -- for_each_boolean(i, dst) -- dst->Booleans[i] = src->Booleans[i]; -- for_each_number(i, dst) -- dst->Numbers[i] = src->Numbers[i]; -- for_each_string(i, dst) -- dst->Strings[i] = src->Strings[i]; -+ -+ TYPE_MALLOC(NCURSES_SBOOL, NUM_BOOLEANS(dst), dst->Booleans); -+ TYPE_MALLOC(short, NUM_NUMBERS(dst), dst->Numbers); -+ TYPE_MALLOC(char *, NUM_STRINGS(dst), dst->Strings); -+ -+ memcpy(dst->Booleans, -+ src->Booleans, -+ NUM_BOOLEANS(dst) * sizeof(dst->Booleans[0])); -+ memcpy(dst->Numbers, -+ src->Numbers, -+ NUM_NUMBERS(dst) * sizeof(dst->Numbers[0])); -+ memcpy(dst->Strings, -+ src->Strings, -+ NUM_STRINGS(dst) * sizeof(dst->Strings[0])); - - /* FIXME: we probably should also copy str_table and ext_str_table, - * but tic and infocmp are not written to exploit that (yet). -@@ -496,11 +502,10 @@ - - #if NCURSES_XNAMES - if ((i = NUM_EXT_NAMES(src)) != 0) { -- dst->ext_Names = typeMalloc(char *, i); -+ TYPE_MALLOC(char *, i, dst->ext_Names); - memcpy(dst->ext_Names, src->ext_Names, i * sizeof(char *)); - } else { - dst->ext_Names = 0; - } - #endif -- - } -diff -Naur ncurses-5.9/ncurses/tinfo/captoinfo.c ncurses-5.9.patch/ncurses/tinfo/captoinfo.c ---- ncurses-5.9/ncurses/tinfo/captoinfo.c 2010-12-04 21:08:19.000000000 +0100 -+++ ncurses-5.9.patch/ncurses/tinfo/captoinfo.c 2014-09-01 16:33:22.420792229 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -93,7 +93,7 @@ - #include <ctype.h> - #include <tic.h> - --MODULE_ID("$Id: captoinfo.c,v 1.58 2010/12/04 20:08:19 tom Exp $") -+MODULE_ID("$Id: captoinfo.c,v 1.77 2012/12/30 00:50:40 tom Exp $") - - #define MAX_PUSHED 16 /* max # args we can push onto the stack */ - -@@ -114,9 +114,7 @@ - /* initialize 'my_string', 'my_length' */ - { - if (my_string == 0) -- my_string = typeMalloc(char, my_length = 256); -- if (my_string == 0) -- _nc_err_abort(MSG_NO_MEMORY); -+ TYPE_MALLOC(char, my_length = 256, my_string); - - *my_string = '\0'; - return my_string; -@@ -133,7 +131,7 @@ - _nc_err_abort(MSG_NO_MEMORY); - d = my_string + have; - } -- (void) strcpy(d, s); -+ _nc_STRCPY(d, s, my_length - have); - return d + strlen(d); - } - -@@ -240,6 +238,12 @@ - else if (parm == 2) - parm = 1; - } -+ -+ while (n--) { -+ dp = save_string(dp, "%p"); -+ dp = save_char(dp, '0' + parm); -+ } -+ - if (onstack == parm) { - if (n > 1) { - _nc_warning("string may not be optimal"); -@@ -255,11 +259,6 @@ - - onstack = parm; - -- while (n--) { -- dp = save_string(dp, "%p"); -- dp = save_char(dp, '0' + parm); -- } -- - if (seenn && parm < 3) { - dp = save_string(dp, "%{96}%^"); - } -@@ -469,73 +468,9 @@ - break; - } - break; --#ifdef REVISIBILIZE -- case '\\': -- dp = save_char(dp, *s++); -- dp = save_char(dp, *s++); -- break; -- case '\n': -- dp = save_string(dp, "\\n"); -- s++; -- break; -- case '\t': -- dp = save_string(dp, "\\t"); -- s++; -- break; -- case '\r': -- dp = save_string(dp, "\\r"); -- s++; -- break; -- case '\200': -- dp = save_string(dp, "\\0"); -- s++; -- break; -- case '\f': -- dp = save_string(dp, "\\f"); -- s++; -- break; -- case '\b': -- dp = save_string(dp, "\\b"); -- s++; -- break; -- case ' ': -- dp = save_string(dp, "\\s"); -- s++; -- break; -- case '^': -- dp = save_string(dp, "\\^"); -- s++; -- break; -- case ':': -- dp = save_string(dp, "\\:"); -- s++; -- break; -- case ',': -- dp = save_string(dp, "\\,"); -- s++; -- break; -- default: -- if (*s == '\033') { -- dp = save_string(dp, "\\E"); -- s++; -- } else if (*s > 0 && *s < 32) { -- dp = save_char(dp, '^'); -- dp = save_char(dp, *s + '@'); -- s++; -- } else if (*s <= 0 || *s >= 127) { -- dp = save_char(dp, '\\'); -- dp = save_char(dp, ((*s & 0300) >> 6) + '0'); -- dp = save_char(dp, ((*s & 0070) >> 3) + '0'); -- dp = save_char(dp, (*s & 0007) + '0'); -- s++; -- } else -- dp = save_char(dp, *s++); -- break; --#else - default: - dp = save_char(dp, *s++); - break; --#endif - } - } - -@@ -578,7 +513,7 @@ - { - char buffer[80]; - int tst; -- sprintf(buffer, fmt, ch1, ch2); -+ _nc_SPRINTF(buffer, _nc_SLIMIT(sizeof(buffer)) fmt, ch1, ch2); - tst = strlen(buffer) - 1; - assert(len == tst); - } -@@ -597,10 +532,13 @@ - bufptr = save_char(bufptr, '\\'); - bufptr = save_char(bufptr, c1); - } else { -- if (c1 == (c1 & 0x1f)) /* iscntrl() returns T on 255 */ -- (void) strcpy(temp, unctrl((chtype) c1)); -- else -- (void) sprintf(temp, "\\%03o", c1); -+ if (c1 == (c1 & 0x1f)) { /* iscntrl() returns T on 255 */ -+ _nc_SPRINTF(temp, _nc_SLIMIT(sizeof(temp)) -+ "%.20s", unctrl((chtype) c1)); -+ } else { -+ _nc_SPRINTF(temp, _nc_SLIMIT(sizeof(temp)) -+ "\\%03o", c1); -+ } - bufptr = save_string(bufptr, temp); - } - return bufptr; -@@ -646,13 +584,15 @@ - int in0, in1, in2; - char ch1 = 0, ch2 = 0; - char *bufptr = init_string(); -+ char octal[4]; - int len; - bool syntax_error = FALSE; - - /* we may have to move some trailing mandatory padding up front */ - padding = str + strlen(str) - 1; -- if (padding > str && *padding == '>' && *--padding == '/') { -- --padding; -+ if (padding > str && *padding == '>') { -+ if (*--padding == '/') -+ --padding; - while (isdigit(UChar(*padding)) || *padding == '.' || *padding == '*') - padding--; - if (padding > str && *padding == '<' && *--padding == '$') -@@ -663,7 +603,7 @@ - bufptr = save_char(bufptr, *padding++); - } - -- for (; *str && str != trimmed; str++) { -+ for (; *str && ((trimmed == 0) || (str < trimmed)); str++) { - int c1, c2; - char *cp = 0; - -@@ -685,8 +625,72 @@ - } else if (str[1] == ',') { - bufptr = save_char(bufptr, *++str); - } else { -+ int xx1, xx2; -+ - bufptr = save_char(bufptr, *str++); -- bufptr = save_char(bufptr, *str); -+ xx1 = *str; -+ if (_nc_strict_bsd) { -+ if (isdigit(UChar(xx1))) { -+ int pad = 0; -+ -+ if (!isdigit(UChar(str[1]))) -+ pad = 2; -+ else if (str[1] && !isdigit(UChar(str[2]))) -+ pad = 1; -+ -+ /* -+ * Test for "\0", "\00" or "\000" and transform those -+ * into "\200". -+ */ -+ if (xx1 == '0' -+ && ((pad == 2) || (str[1] == '0')) -+ && ((pad >= 1) || (str[2] == '0'))) { -+ xx2 = '2'; -+ } else { -+ xx2 = '0'; -+ pad = 0; /* FIXME - optionally pad to 3 digits */ -+ } -+ while (pad-- > 0) { -+ bufptr = save_char(bufptr, xx2); -+ xx2 = '0'; -+ } -+ } else if (strchr("E\\nrtbf", xx1) == 0) { -+ switch (xx1) { -+ case 'e': -+ xx1 = 'E'; -+ break; -+ case 'l': -+ xx1 = 'n'; -+ break; -+ case 's': -+ bufptr = save_char(bufptr, '0'); -+ bufptr = save_char(bufptr, '4'); -+ xx1 = '0'; -+ break; -+ case ':': -+ /* -+ * Note: termcap documentation claims that ":" -+ * must be escaped as "\072", however the -+ * documentation is incorrect - read the code. -+ * The replacement does not work reliably, -+ * so the advice is not helpful. -+ */ -+ bufptr = save_char(bufptr, '0'); -+ bufptr = save_char(bufptr, '7'); -+ xx1 = '2'; -+ break; -+ default: -+ /* should not happen, but handle this anyway */ -+ _nc_SPRINTF(octal, _nc_SLIMIT(sizeof(octal)) -+ "%03o", UChar(xx1)); -+ bufptr = save_char(bufptr, octal[0]); -+ bufptr = save_char(bufptr, octal[1]); -+ xx1 = octal[2]; -+ break; -+ } -+ } -+ } -+ bufptr = save_char(bufptr, xx1); - } - } else if (str[0] == '$' && str[1] == '<') { /* discard padding */ - str += 2; -@@ -703,7 +707,8 @@ - && ((in0 == 4 && in1 == 10 && in2 == 48) - || (in0 == 3 && in1 == 9 && in2 == 38))) { - /* dumb-down an optimized case from xterm-256color for termcap */ -- str = strstr(str, ";m"); -+ if ((str = strstr(str, ";m")) == 0) -+ break; /* cannot happen */ - ++str; - if (in2 == 48) { - bufptr = save_string(bufptr, "[48;5;%dm"); -@@ -720,13 +725,13 @@ - bufptr = save_tc_inequality(bufptr, c1, c2); - } else if (sscanf(str, "%%?%%{%d}%%>%%t%%'%c'%%+%%;", &c1, &ch2) == 2) { - str = strchr(str, ';'); -- bufptr = save_tc_inequality(bufptr, c1, c2); -+ bufptr = save_tc_inequality(bufptr, c1, ch2); - } else if (sscanf(str, "%%?%%'%c'%%>%%t%%{%d}%%+%%;", &ch1, &c2) == 2) { - str = strchr(str, ';'); -- bufptr = save_tc_inequality(bufptr, c1, c2); -+ bufptr = save_tc_inequality(bufptr, ch1, c2); - } else if (sscanf(str, "%%?%%'%c'%%>%%t%%'%c'%%+%%;", &ch1, &ch2) == 2) { - str = strchr(str, ';'); -- bufptr = save_tc_inequality(bufptr, c1, c2); -+ bufptr = save_tc_inequality(bufptr, ch1, ch2); - } else if ((len = bcd_expression(str)) != 0) { - str += len; - bufptr = save_string(bufptr, "%B"); -@@ -741,15 +746,15 @@ - bufptr = save_tc_char(bufptr, c1); - } - /* FIXME: this "works" for 'delta' */ -- else if (strncmp(str, "%{2}%*%-", 8) == 0) { -+ else if (strncmp(str, "%{2}%*%-", (size_t) 8) == 0) { - str += 7; - bufptr = save_string(bufptr, "%D"); -- } else if (strncmp(str, "%{96}%^", 7) == 0) { -+ } else if (strncmp(str, "%{96}%^", (size_t) 7) == 0) { - str += 6; - if (saw_m++ == 0) { - bufptr = save_string(bufptr, "%n"); - } -- } else if (strncmp(str, "%{127}%^", 8) == 0) { -+ } else if (strncmp(str, "%{127}%^", (size_t) 8) == 0) { - str += 7; - if (saw_n++ == 0) { - bufptr = save_string(bufptr, "%m"); -@@ -772,8 +777,25 @@ - case '8': - case '9': - bufptr = save_char(bufptr, '%'); -- while (isdigit(UChar(*str))) -- bufptr = save_char(bufptr, *str++); -+ ch1 = 0; -+ ch2 = 0; -+ while (isdigit(UChar(*str))) { -+ ch2 = ch1; -+ ch1 = *str++; -+ if (_nc_strict_bsd) { -+ if (ch1 > '3') -+ return 0; -+ } else { -+ bufptr = save_char(bufptr, ch1); -+ } -+ } -+ if (_nc_strict_bsd) { -+ if (ch2 != 0 && ch2 != '0') -+ return 0; -+ if (ch1 < '2') -+ ch1 = 'd'; -+ bufptr = save_char(bufptr, ch1); -+ } - if (strchr("doxX.", *str)) { - if (*str != 'd') /* termcap doesn't have octal, hex */ - return 0; -@@ -794,6 +816,8 @@ - * termcap notation. - */ - case 's': -+ if (_nc_strict_bsd) -+ return 0; - bufptr = save_string(bufptr, "%s"); - break; - -@@ -826,7 +850,7 @@ - * but that may not be the end of the string. - */ - assert(str != 0); -- if (*str == '\0') -+ if (str == 0 || *str == '\0') - break; - - } /* endwhile (*str) */ -diff -Naur ncurses-5.9/ncurses/tinfo/comp_error.c ncurses-5.9.patch/ncurses/tinfo/comp_error.c ---- ncurses-5.9/ncurses/tinfo/comp_error.c 2007-04-22 01:38:32.000000000 +0200 -+++ ncurses-5.9.patch/ncurses/tinfo/comp_error.c 2014-09-01 16:33:22.420792229 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2005,2007 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -41,7 +41,7 @@ - - #include <tic.h> - --MODULE_ID("$Id: comp_error.c,v 1.31 2007/04/21 23:38:32 tom Exp $") -+MODULE_ID("$Id: comp_error.c,v 1.36 2012/02/22 22:34:31 tom Exp $") - - NCURSES_EXPORT_VAR(bool) _nc_suppress_warnings = FALSE; - NCURSES_EXPORT_VAR(int) _nc_curr_line = 0; /* current line # in input */ -@@ -59,7 +59,8 @@ - NCURSES_EXPORT(void) - _nc_set_source(const char *const name) - { -- SourceName = name; -+ FreeIfNeeded(SourceName); -+ SourceName = strdup(name); - } - - NCURSES_EXPORT(void) -@@ -70,7 +71,7 @@ - if (TermType != 0) { - TermType[0] = '\0'; - if (name) -- strncat(TermType, name, MAX_NAME_SIZE); -+ strncat(TermType, name, (size_t) MAX_NAME_SIZE); - } - } - -@@ -84,7 +85,7 @@ - } - #endif - if (name != 0) -- strcpy(name, TermType != 0 ? TermType : ""); -+ _nc_STRCPY(name, TermType != 0 ? TermType : "", MAX_NAME_SIZE); - } - - static NCURSES_INLINE void -@@ -151,3 +152,12 @@ - exit(EXIT_FAILURE); - #endif - } -+ -+#if NO_LEAKS -+NCURSES_EXPORT(void) -+_nc_comp_error_leaks(void) -+{ -+ FreeAndNull(SourceName); -+ FreeAndNull(TermType); -+} -+#endif -diff -Naur ncurses-5.9/ncurses/tinfo/comp_expand.c ncurses-5.9.patch/ncurses/tinfo/comp_expand.c ---- ncurses-5.9/ncurses/tinfo/comp_expand.c 2010-01-16 18:11:23.000000000 +0100 -+++ ncurses-5.9.patch/ncurses/tinfo/comp_expand.c 2014-09-01 16:33:22.420792229 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2008,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -35,7 +35,7 @@ - #include <ctype.h> - #include <tic.h> - --MODULE_ID("$Id: comp_expand.c,v 1.21 2010/01/16 17:11:23 tom Exp $") -+MODULE_ID("$Id: comp_expand.c,v 1.25 2012/03/24 18:37:17 tom Exp $") - - static int - trailing_spaces(const char *src) -@@ -49,6 +49,8 @@ - #define REALCTL(s) (UChar(*(s)) < 127 && iscntrl(UChar(*(s)))) - #define REALPRINT(s) (UChar(*(s)) < 127 && isprint(UChar(*(s)))) - -+#define P_LIMIT(p) (length - (size_t)(p)) -+ - NCURSES_EXPORT(char *) - _nc_tic_expand(const char *srcp, bool tic_format, int numbers) - { -@@ -61,15 +63,15 @@ - size_t need = (2 + strlen(str)) * 4; - int ch; - --#if NO_LEAKS - if (srcp == 0) { -+#if NO_LEAKS - if (buffer != 0) { - FreeAndNull(buffer); - length = 0; - } -+#endif - return 0; - } --#endif - if (buffer == 0 || need > length) { - if ((buffer = typeRealloc(char, length = need, buffer)) == 0) - return 0; -@@ -90,7 +92,8 @@ - && str[1] != '\\' - && REALPRINT(str + 1) - && str[2] == S_QUOTE) { -- sprintf(buffer + bufp, "{%d}", str[1]); -+ _nc_SPRINTF(buffer + bufp, _nc_SLIMIT(P_LIMIT(bufp)) -+ "{%d}", str[1]); - bufp += (int) strlen(buffer + bufp); - str += 2; - } else { -@@ -177,10 +180,12 @@ - #define UnCtl(c) ((c) + '@') - else if (REALCTL(str) && ch != '\\' - && (!islong || isdigit(UChar(str[1])))) { -- (void) sprintf(&buffer[bufp], "^%c", UnCtl(ch)); -+ _nc_SPRINTF(&buffer[bufp], _nc_SLIMIT(P_LIMIT(bufp)) -+ "^%c", UnCtl(ch)); - bufp += 2; - } else { -- (void) sprintf(&buffer[bufp], "\\%03o", ch); -+ _nc_SPRINTF(&buffer[bufp], _nc_SLIMIT(P_LIMIT(bufp)) -+ "\\%03o", ch); - bufp += 4; - } - -diff -Naur ncurses-5.9/ncurses/tinfo/comp_parse.c ncurses-5.9.patch/ncurses/tinfo/comp_parse.c ---- ncurses-5.9/ncurses/tinfo/comp_parse.c 2010-12-26 00:06:37.000000000 +0100 -+++ ncurses-5.9.patch/ncurses/tinfo/comp_parse.c 2014-09-01 16:33:22.420792229 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -35,15 +35,10 @@ - /* - * comp_parse.c -- parser driver loop and use handling. - * -- * _nc_read_entry_source(FILE *, literal, bool, bool (*hook)()) -- * _nc_resolve_uses2(void) -- * _nc_free_entries(void) -- * - * Use this code by calling _nc_read_entry_source() on as many source - * files as you like (either terminfo or termcap syntax). If you - * want use-resolution, call _nc_resolve_uses2(). To free the list - * storage, do _nc_free_entries(). -- * - */ - - #include <curses.priv.h> -@@ -52,7 +47,7 @@ - - #include <tic.h> - --MODULE_ID("$Id: comp_parse.c,v 1.73 2010/12/25 23:06:37 tom Exp $") -+MODULE_ID("$Id: comp_parse.c,v 1.90 2013/08/31 15:22:31 tom Exp $") - - static void sanity_check2(TERMTYPE *, bool); - NCURSES_IMPEXP void NCURSES_API(*_nc_check_termtype2) (TERMTYPE *, bool) = sanity_check2; -@@ -61,6 +56,8 @@ - static void sanity_check(TERMTYPE *); - NCURSES_IMPEXP void NCURSES_API(*_nc_check_termtype) (TERMTYPE *) = sanity_check; - -+static void fixup_acsc(TERMTYPE *, int); -+ - static void - enqueue(ENTRY * ep) - /* add an entry to the in-core list */ -@@ -86,16 +83,28 @@ - if (len > MAX_NAME_SIZE) - len = MAX_NAME_SIZE; - (void) strncpy(dst, src, len); -- (void) strcpy(dst + len, "|"); -+ _nc_STRCPY(dst + len, "|", MAX_NAME_SIZE); - src = dst; - } - return src; - } - #define ForceBar(dst, src) ((strchr(src, '|') == 0) ? force_bar(dst, src) : src) - --NCURSES_EXPORT(bool) --_nc_entry_match(char *n1, char *n2) --/* do any of the aliases in a pair of terminal names match? */ -+#if NCURSES_USE_TERMCAP && NCURSES_XNAMES -+static char * -+skip_index(char *name) -+{ -+ char *bar = strchr(name, '|'); -+ -+ if (bar != 0 && (bar - name) == 2) -+ name = bar + 1; -+ -+ return name; -+} -+#endif -+ -+static bool -+check_collisions(char *n1, char *n2, int counter) - { - char *pstart, *qstart, *pend, *qend; - char nc1[MAX_NAME_SIZE + 2]; -@@ -104,15 +113,95 @@ - n1 = ForceBar(nc1, n1); - n2 = ForceBar(nc2, n2); - -- for (pstart = n1; (pend = strchr(pstart, '|')); pstart = pend + 1) -- for (qstart = n2; (qend = strchr(qstart, '|')); qstart = qend + 1) -+#if NCURSES_USE_TERMCAP && NCURSES_XNAMES -+ if ((_nc_syntax == SYN_TERMCAP) && _nc_user_definable) { -+ n1 = skip_index(n1); -+ n2 = skip_index(n2); -+ } -+#endif -+ -+ for (pstart = n1; (pend = strchr(pstart, '|')); pstart = pend + 1) { -+ for (qstart = n2; (qend = strchr(qstart, '|')); qstart = qend + 1) { - if ((pend - pstart == qend - qstart) -- && memcmp(pstart, qstart, (size_t) (pend - pstart)) == 0) -+ && memcmp(pstart, qstart, (size_t) (pend - pstart)) == 0) { -+ if (counter > 0) -+ (void) fprintf(stderr, "Name collision '%.*s' between\n", -+ (int) (pend - pstart), pstart); - return (TRUE); -+ } -+ } -+ } - - return (FALSE); - } - -+static char * -+next_name(char *name) -+{ -+ if (*name != '\0') -+ ++name; -+ return name; -+} -+ -+static char * -+name_ending(char *name) -+{ -+ if (*name == '\0') { -+ name = 0; -+ } else { -+ while (*name != '\0' && *name != '|') -+ ++name; -+ } -+ return name; -+} -+ -+/* -+ * Essentially, find the conflict reported in check_collisions() and remove -+ * it from the second name, unless that happens to be the last alias. -+ */ -+static bool -+remove_collision(char *n1, char *n2) -+{ -+ char *p2 = n2; -+ char *pstart, *qstart, *pend, *qend; -+ bool removed = FALSE; -+ -+#if NCURSES_USE_TERMCAP && NCURSES_XNAMES -+ if ((_nc_syntax == SYN_TERMCAP) && _nc_user_definable) { -+ n1 = skip_index(n1); -+ p2 = n2 = skip_index(n2); -+ } -+#endif -+ -+ for (pstart = n1; (pend = name_ending(pstart)); pstart = next_name(pend)) { -+ for (qstart = n2; (qend = name_ending(qstart)); qstart = next_name(qend)) { -+ if ((pend - pstart == qend - qstart) -+ && memcmp(pstart, qstart, (size_t) (pend - pstart)) == 0) { -+ if (qstart != p2 || *qend == '|') { -+ if (*qend == '|') -+ ++qend; -+ while ((*qstart++ = *qend++) != '\0') ; -+ fprintf(stderr, "...now\t%s\n", p2); -+ } else { -+ fprintf(stderr, "Cannot remove alias '%.*s'\n", -+ (int) (qend - qstart), qstart); -+ } -+ removed = TRUE; -+ break; -+ } -+ } -+ } -+ -+ return removed; -+} -+ -+/* do any of the aliases in a pair of terminal names match? */ -+NCURSES_EXPORT(bool) -+_nc_entry_match(char *n1, char *n2) -+{ -+ return check_collisions(n1, n2, 0); -+} -+ - /**************************************************************************** - * - * Entry compiler and resolution logic -@@ -198,19 +287,19 @@ - - for_entry_list(rp) { - if (qp > rp -- && _nc_entry_match(qp->tterm.term_names, rp->tterm.term_names)) { -- matchcount++; -- if (matchcount == 1) { -- (void) fprintf(stderr, "Name collision between %s", -- _nc_first_name(qp->tterm.term_names)); -- multiples++; -+ && check_collisions(qp->tterm.term_names, -+ rp->tterm.term_names, -+ matchcount + 1)) { -+ if (!matchcount++) { -+ (void) fprintf(stderr, "\t%s\n", rp->tterm.term_names); -+ } -+ (void) fprintf(stderr, "and\t%s\n", qp->tterm.term_names); -+ if (!remove_collision(rp->tterm.term_names, -+ qp->tterm.term_names)) { -+ ++multiples; - } -- if (matchcount >= 1) -- (void) fprintf(stderr, " %s", _nc_first_name(rp->tterm.term_names)); - } - } -- if (matchcount >= 1) -- (void) putc('\n', stderr); - } - if (multiples > 0) - return (FALSE); -@@ -256,9 +345,7 @@ - DEBUG(2, ("%s: resolving use=%s (compiled)", - child, lookfor)); - -- rp = typeMalloc(ENTRY, 1); -- if (rp == 0) -- _nc_err_abort(MSG_NO_MEMORY); -+ TYPE_MALLOC(ENTRY, 1, rp); - rp->tterm = thisterm; - rp->nuses = 0; - rp->next = lastread; -@@ -378,7 +465,34 @@ - for_entry_list(qp) { - _nc_curr_line = (int) qp->startline; - _nc_set_type(_nc_first_name(qp->tterm.term_names)); -- _nc_check_termtype2(&qp->tterm, literal); -+ /* -+ * tic overrides this function pointer to provide more verbose -+ * checking. -+ */ -+ if (_nc_check_termtype2 != sanity_check2) { -+ SCREEN *save_SP = SP; -+ SCREEN fake_sp; -+ TERMINAL fake_tm; -+ TERMINAL *save_tm = cur_term; -+ -+ /* -+ * Setup so that tic can use ordinary terminfo interface -+ * to obtain capability information. -+ */ -+ memset(&fake_sp, 0, sizeof(fake_sp)); -+ memset(&fake_tm, 0, sizeof(fake_tm)); -+ fake_sp._term = &fake_tm; -+ fake_tm.type = qp->tterm; -+ _nc_set_screen(&fake_sp); -+ set_curterm(&fake_tm); -+ -+ _nc_check_termtype2(&qp->tterm, literal); -+ -+ _nc_set_screen(save_SP); -+ set_curterm(save_tm); -+ } else { -+ fixup_acsc(&qp->tterm, literal); -+ } - } - DEBUG(2, ("SANITY CHECK FINISHED")); - } -@@ -403,6 +517,17 @@ - #define CUR tp-> - - static void -+fixup_acsc(TERMTYPE *tp, int literal) -+{ -+ if (!literal) { -+ if (acs_chars == 0 -+ && enter_alt_charset_mode != 0 -+ && exit_alt_charset_mode != 0) -+ acs_chars = strdup(VT_ACSC); -+ } -+} -+ -+static void - sanity_check2(TERMTYPE *tp, bool literal) - { - if (!PRESENT(exit_attribute_mode)) { -@@ -422,16 +547,14 @@ - #endif /* __UNUSED__ */ - PAIRED(enter_standout_mode, exit_standout_mode); - PAIRED(enter_underline_mode, exit_underline_mode); -+ PAIRED(enter_italics_mode, exit_italics_mode); - } - - /* we do this check/fix in postprocess_termcap(), but some packagers - * prefer to bypass it... - */ - if (!literal) { -- if (acs_chars == 0 -- && enter_alt_charset_mode != 0 -- && exit_alt_charset_mode != 0) -- acs_chars = strdup(VT_ACSC); -+ fixup_acsc(tp, literal); - ANDMISSING(enter_alt_charset_mode, acs_chars); - ANDMISSING(exit_alt_charset_mode, acs_chars); - } -diff -Naur ncurses-5.9/ncurses/tinfo/comp_scan.c ncurses-5.9.patch/ncurses/tinfo/comp_scan.c ---- ncurses-5.9/ncurses/tinfo/comp_scan.c 2010-12-26 00:06:37.000000000 +0100 -+++ ncurses-5.9.patch/ncurses/tinfo/comp_scan.c 2014-09-01 16:33:22.421792231 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2008,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -50,7 +50,7 @@ - #include <ctype.h> - #include <tic.h> - --MODULE_ID("$Id: comp_scan.c,v 1.89 2010/12/25 23:06:37 tom Exp $") -+MODULE_ID("$Id: comp_scan.c,v 1.102 2013/11/16 19:57:50 tom Exp $") - - /* - * Maximum length of string capability we'll accept before raising an error. -@@ -61,6 +61,7 @@ - #define iswhite(ch) (ch == ' ' || ch == '\t') - - NCURSES_EXPORT_VAR (int) _nc_syntax = 0; /* termcap or terminfo? */ -+NCURSES_EXPORT_VAR (int) _nc_strict_bsd = 1; /* ncurses extended termcap? */ - NCURSES_EXPORT_VAR (long) _nc_curr_file_pos = 0; /* file offset of current line */ - NCURSES_EXPORT_VAR (long) _nc_comment_start = 0; /* start of comment range before name */ - NCURSES_EXPORT_VAR (long) _nc_comment_end = 0; /* end of comment range before name */ -@@ -127,14 +128,19 @@ - * Returns the final nonblank character on the current input buffer - */ - static int --last_char(void) -+last_char(int from_end) - { - size_t len = strlen(bufptr); -+ int result = 0; -+ - while (len--) { -- if (!isspace(UChar(bufptr[len]))) -- return bufptr[len]; -+ if (!isspace(UChar(bufptr[len]))) { -+ if (from_end < (int) len) -+ result = bufptr[(int) len - from_end]; -+ break; -+ } - } -- return 0; -+ return result; - } - - /* -@@ -195,7 +201,8 @@ - result = typeRealloc(char, allocated, result); - if (result == 0) - return (EOF); -- bufstart = result; -+ if (bufstart) -+ bufstart = result; - } - if (used == 0) - _nc_curr_file_pos = ftell(yyin); -@@ -212,7 +219,7 @@ - } - } else { - if (used != 0) -- strcat(result, "\n"); -+ _nc_STRCAT(result, "\n", allocated); - } - if ((bufptr = bufstart) != 0) { - used = strlen(bufptr); -@@ -256,12 +263,12 @@ - } - - static void --push_back(char c) -+push_back(int c) - /* push a character back onto the input stream */ - { - if (bufptr == bufstart) - _nc_syserr_abort("Can't backspace off beginning of line"); -- *--bufptr = c; -+ *--bufptr = (char) c; - _nc_curr_col--; - } - -@@ -299,6 +306,8 @@ - *tok_ptr++ = (char) ch; \ - *tok_ptr = '\0' - -+static char *tok_buf; -+ - /* - * int - * get_token() -@@ -336,15 +345,14 @@ - _nc_get_token(bool silent) - { - static const char terminfo_punct[] = "@%&*!#"; -- static char *tok_buf; - -- char *after_list; -- char *after_name; -+ char *after_name; /* after primary name */ -+ char *after_list; /* after primary and alias list */ - char *numchk; - char *tok_ptr; - char *s; - char numbuf[80]; -- int ch; -+ int ch, c0, c1; - int dot_flag = FALSE; - int type; - long number; -@@ -372,11 +380,10 @@ - - if (end_of_stream()) { - yyin = 0; -- next_char(); /* frees its allocated memory */ -+ (void) next_char(); /* frees its allocated memory */ - if (tok_buf != 0) { - if (_nc_curr_token.tk_name == tok_buf) - _nc_curr_token.tk_name = 0; -- FreeAndNull(tok_buf); - } - return (EOF); - } -@@ -390,6 +397,7 @@ - } - - ch = eat_escaped_newline(ch); -+ _nc_curr_token.tk_valstring = 0; - - #ifdef TRACE - old_line = _nc_curr_line; -@@ -424,7 +432,7 @@ - #if NCURSES_EXT_FUNCS - && !(ch == '.' && _nc_disable_period) - #endif -- && !strchr(terminfo_punct, (char) ch)) { -+ && ((strchr) (terminfo_punct, (char) ch) == 0)) { - if (!silent) - _nc_warning("Illegal character (expected alphanumeric or %s) - '%s'", - terminfo_punct, unctrl(UChar(ch))); -@@ -457,7 +465,7 @@ - after_list = tok_ptr; - if (after_name == 0) - after_name = tok_ptr; -- } else if (ch == ':' && last_char() != ',') { -+ } else if (ch == ':' && last_char(0) != ',') { - _nc_syntax = SYN_TERMCAP; - separator = ':'; - break; -@@ -471,12 +479,64 @@ - if (after_name == 0) - break; - /* -- * If we see a comma, we assume this is terminfo unless we -- * subsequently run into a colon. But we don't stop -- * looking for a colon until hitting a newline. This -- * allows commas to be embedded in description fields of -- * either syntax. -+ * We saw a comma, but are not entirely sure this is -+ * terminfo format, since we can still be parsing the -+ * description field (for either syntax). -+ * -+ * A properly formatted termcap line ends with either a -+ * colon, or a backslash after a colon. It is possible -+ * to have a backslash in the middle of a capability, but -+ * then there would be no leading whitespace on the next -+ * line - something we want to discourage. - */ -+ c0 = last_char(0); -+ c1 = last_char(1); -+ if (c1 != ':' && c0 != '\\' && c0 != ':') { -+ bool capability = FALSE; -+ -+ /* -+ * Since it is not termcap, assume the line is terminfo -+ * format. However, the comma can be embedded in a -+ * description field. It also can be a separator -+ * between a description field and a capability. -+ * -+ * Improve the guess by checking if the next word after -+ * the comma does not look like a capability. In that -+ * case, extend the description past the comma. -+ */ -+ for (s = bufptr; isspace(UChar(*s)); ++s) { -+ ; -+ } -+ if (islower(UChar(*s))) { -+ char *name = s; -+ while (isalnum(UChar(*s))) { -+ ++s; -+ } -+ if (*s == '#' || *s == '=' || *s == '@') { -+ /* -+ * Checking solely with syntax allows us to -+ * support extended capabilities with string -+ * values. -+ */ -+ capability = TRUE; -+ } else if (*s == ',') { -+ c0 = *s; -+ *s = '\0'; -+ /* -+ * Otherwise, we can handle predefined boolean -+ * capabilities, still aided by syntax. -+ */ -+ if (_nc_find_entry(name, -+ _nc_get_hash_table(FALSE))) { -+ capability = TRUE; -+ } -+ *s = (char) c0; -+ } -+ } -+ if (capability) { -+ break; -+ } -+ } - } else - ch = eat_escaped_newline(ch); - -@@ -748,7 +808,7 @@ - if (!(is7bits(c) && isprint(c))) { - _nc_warning("Illegal ^ character - '%s'", unctrl(UChar(c))); - } -- if (c == '?') { -+ if (c == '?' && (_nc_syntax != SYN_TERMCAP)) { - *(ptr++) = '\177'; - if (_nc_tracing) - _nc_warning("Allow ^? as synonym for \\177"); -@@ -758,23 +818,29 @@ - *(ptr++) = (char) (c); - } - } else if (c == '\\') { -+ bool strict_bsd = ((_nc_syntax == SYN_TERMCAP) && _nc_strict_bsd); -+ - c = next_char(); - if (c == EOF) - _nc_err_abort(MSG_NO_INPUTS); - -- if (c >= '0' && c <= '7') { -+#define isoctal(c) ((c) >= '0' && (c) <= '7') -+ -+ if (isoctal(c) || (strict_bsd && isdigit(c))) { - number = c - '0'; - for (i = 0; i < 2; i++) { - c = next_char(); - if (c == EOF) - _nc_err_abort(MSG_NO_INPUTS); - -- if (c < '0' || c > '7') { -+ if (!isoctal(c)) { - if (isdigit(c)) { -- _nc_warning("Non-octal digit `%c' in \\ sequence", c); -- /* allow the digit; it'll do less harm */ -+ if (!strict_bsd) { -+ _nc_warning("Non-octal digit `%c' in \\ sequence", c); -+ /* allow the digit; it'll do less harm */ -+ } - } else { -- push_back((char) c); -+ push_back(c); - break; - } - } -@@ -782,21 +848,16 @@ - number = number * 8 + c - '0'; - } - -- if (number == 0) -+ number = UChar(number); -+ if (number == 0 && !strict_bsd) - number = 0200; - *(ptr++) = (char) number; - } else { - switch (c) { - case 'E': -- case 'e': - *(ptr++) = '\033'; - break; - -- case 'a': -- *(ptr++) = '\007'; -- break; -- -- case 'l': - case 'n': - *(ptr++) = '\n'; - break; -@@ -809,10 +870,6 @@ - *(ptr++) = '\010'; - break; - -- case 's': -- *(ptr++) = ' '; -- break; -- - case 'f': - *(ptr++) = '\014'; - break; -@@ -833,16 +890,33 @@ - *(ptr++) = ','; - break; - -- case ':': -- *(ptr++) = ':'; -- break; -- - case '\n': - continue; - - default: -- _nc_warning("Illegal character '%s' in \\ sequence", -- unctrl(UChar(c))); -+ if ((_nc_syntax == SYN_TERMINFO) || !_nc_strict_bsd) { -+ switch (c) { -+ case 'a': -+ c = '\007'; -+ break; -+ case 'e': -+ c = '\033'; -+ break; -+ case 'l': -+ c = '\n'; -+ break; -+ case 's': -+ c = ' '; -+ break; -+ case ':': -+ c = ':'; -+ break; -+ default: -+ _nc_warning("Illegal character '%s' in \\ sequence", -+ unctrl(UChar(c))); -+ break; -+ } -+ } - /* FALLTHRU */ - case '|': - *(ptr++) = (char) c; -@@ -862,7 +936,7 @@ - - if (!ignored) { - if (_nc_curr_col <= 1) { -- push_back((char) c); -+ push_back(c); - c = '\n'; - break; - } -@@ -934,5 +1008,8 @@ - if (pushname != 0) { - FreeAndNull(pushname); - } -+ if (tok_buf != 0) { -+ FreeAndNull(tok_buf); -+ } - } - #endif -diff -Naur ncurses-5.9/ncurses/tinfo/db_iterator.c ncurses-5.9.patch/ncurses/tinfo/db_iterator.c ---- ncurses-5.9/ncurses/tinfo/db_iterator.c 2010-12-26 00:00:25.000000000 +0100 -+++ ncurses-5.9.patch/ncurses/tinfo/db_iterator.c 2014-09-01 16:33:22.421792231 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 2006-2007,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 2006-2012,2013 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -36,13 +36,142 @@ - - #include <curses.priv.h> - -+#include <time.h> - #include <tic.h> - --MODULE_ID("$Id: db_iterator.c,v 1.9 2010/12/25 23:00:25 tom Exp $") -+#if USE_HASHED_DB -+#include <hashed_db.h> -+#endif -+ -+MODULE_ID("$Id: db_iterator.c,v 1.38 2013/12/14 21:23:20 tom Exp $") - - #define HaveTicDirectory _nc_globals.have_tic_directory - #define KeepTicDirectory _nc_globals.keep_tic_directory - #define TicDirectory _nc_globals.tic_directory -+#define my_blob _nc_globals.dbd_blob -+#define my_list _nc_globals.dbd_list -+#define my_size _nc_globals.dbd_size -+#define my_time _nc_globals.dbd_time -+#define my_vars _nc_globals.dbd_vars -+ -+static void -+add_to_blob(const char *text, size_t limit) -+{ -+ (void) limit; -+ -+ if (*text != '\0') { -+ char *last = my_blob + strlen(my_blob); -+ if (last != my_blob) -+ *last++ = NCURSES_PATHSEP; -+ _nc_STRCPY(last, text, limit); -+ } -+} -+ -+static bool -+check_existence(const char *name, struct stat *sb) -+{ -+ bool result = FALSE; -+ -+ if (stat(name, sb) == 0 -+ && (S_ISDIR(sb->st_mode) || S_ISREG(sb->st_mode))) { -+ result = TRUE; -+ } -+#if USE_HASHED_DB -+ else if (strlen(name) < PATH_MAX - sizeof(DBM_SUFFIX)) { -+ char temp[PATH_MAX]; -+ _nc_SPRINTF(temp, _nc_SLIMIT(sizeof(temp)) "%s%s", name, DBM_SUFFIX); -+ if (stat(temp, sb) == 0 && S_ISREG(sb->st_mode)) { -+ result = TRUE; -+ } -+ } -+#endif -+ return result; -+} -+ -+/* -+ * Store the latest value of an environment variable in my_vars[] so we can -+ * detect if one changes, invalidating the cached search-list. -+ */ -+static bool -+update_getenv(const char *name, DBDIRS which) -+{ -+ bool result = FALSE; -+ -+ if (which < dbdLAST) { -+ char *value; -+ -+ if ((value = getenv(name)) == 0 || (value = strdup(value)) == 0) { -+ ; -+ } else if (my_vars[which].name == 0 || strcmp(my_vars[which].name, name)) { -+ FreeIfNeeded(my_vars[which].value); -+ my_vars[which].name = name; -+ my_vars[which].value = value; -+ result = TRUE; -+ } else if ((my_vars[which].value != 0) ^ (value != 0)) { -+ FreeIfNeeded(my_vars[which].value); -+ my_vars[which].value = value; -+ result = TRUE; -+ } else if (value != 0 && strcmp(value, my_vars[which].value)) { -+ FreeIfNeeded(my_vars[which].value); -+ my_vars[which].value = value; -+ result = TRUE; -+ } else { -+ free(value); -+ } -+ } -+ return result; -+} -+ -+static char * -+cache_getenv(const char *name, DBDIRS which) -+{ -+ char *result = 0; -+ -+ (void) update_getenv(name, which); -+ if (which < dbdLAST) { -+ result = my_vars[which].value; -+ } -+ return result; -+} -+ -+/* -+ * The cache expires if at least a second has passed since the initial lookup, -+ * or if one of the environment variables changed. -+ * -+ * Only a few applications use multiple lookups of terminal entries, seems that -+ * aside from bulk I/O such as tic and toe, that leaves interactive programs -+ * which should not be modifying the terminal databases in a way that would -+ * invalidate the search-list. -+ * -+ * The "1-second" is to allow for user-directed changes outside the program. -+ */ -+static bool -+cache_expired(void) -+{ -+ bool result = FALSE; -+ time_t now = time((time_t *) 0); -+ -+ if (now > my_time) { -+ result = TRUE; -+ } else { -+ DBDIRS n; -+ for (n = (DBDIRS) 0; n < dbdLAST; ++n) { -+ if (my_vars[n].name != 0 -+ && update_getenv(my_vars[n].name, n)) { -+ result = TRUE; -+ break; -+ } -+ } -+ } -+ return result; -+} -+ -+static void -+free_cache(void) -+{ -+ FreeAndNull(my_blob); -+ FreeAndNull(my_list); -+} - - /* - * Record the "official" location of the terminfo directory, according to -@@ -51,17 +180,20 @@ - NCURSES_EXPORT(const char *) - _nc_tic_dir(const char *path) - { -+ T(("_nc_tic_dir %s", NonNull(path))); - if (!KeepTicDirectory) { - if (path != 0) { - TicDirectory = path; - HaveTicDirectory = TRUE; -- } else if (!HaveTicDirectory && use_terminfo_vars()) { -- char *envp; -- if ((envp = getenv("TERMINFO")) != 0) -- return _nc_tic_dir(envp); -+ } else if (HaveTicDirectory == 0) { -+ if (use_terminfo_vars()) { -+ char *envp; -+ if ((envp = getenv("TERMINFO")) != 0) -+ return _nc_tic_dir(envp); -+ } - } - } -- return TicDirectory; -+ return TicDirectory ? TicDirectory : TERMINFO; - } - - /* -@@ -77,61 +209,16 @@ - } - - /* -- * Process the list of :-separated directories, looking for the terminal type. -- * We don't use strtok because it does not show us empty tokens. -- */ --#define ThisDbList _nc_globals.dbi_list --#define ThisDbSize _nc_globals.dbi_size -- --/* - * Cleanup. - */ - NCURSES_EXPORT(void) - _nc_last_db(void) - { -- if (ThisDbList != 0) { -- FreeAndNull(ThisDbList); -+ if (my_blob != 0 && cache_expired()) { -+ free_cache(); - } -- ThisDbSize = 0; - } - --/* The TERMINFO_DIRS value, if defined by the configure script, begins with a -- * ":", which will be interpreted as TERMINFO. -- */ --static const char * --next_list_item(const char *source, int *offset) --{ -- if (source != 0) { -- FreeIfNeeded(ThisDbList); -- ThisDbList = strdup(source); -- ThisDbSize = (int) strlen(source); -- } -- -- if (ThisDbList != 0 && ThisDbSize && *offset < ThisDbSize) { -- static char system_db[] = TERMINFO; -- char *result = ThisDbList + *offset; -- char *marker = strchr(result, NCURSES_PATHSEP); -- -- /* -- * Put a null on the marker if a separator was found. Set the offset -- * to the next position after the marker so we can call this function -- * again, using the data at the offset. -- */ -- if (marker == 0) { -- *offset += (int) strlen(result); -- } else { -- *marker++ = 0; -- *offset = (int) (marker - ThisDbList); -- } -- if (*result == 0 && result != (ThisDbList + ThisDbSize)) -- result = system_db; -- return result; -- } -- return 0; --} -- --#define NEXT_DBD(var, offset) next_list_item((*offset == 0) ? var : 0, offset) -- - /* - * This is a simple iterator which allows the caller to step through the - * possible locations for a terminfo directory. ncurses uses this to find -@@ -141,84 +228,186 @@ - _nc_next_db(DBDIRS * state, int *offset) - { - const char *result; -- char *envp; -- -- while (*state < dbdLAST) { -- DBDIRS next = (DBDIRS) ((int) (*state) + 1); - -+ (void) offset; -+ if ((int) *state < my_size -+ && my_list != 0 -+ && my_list[*state] != 0) { -+ result = my_list[*state]; -+ (*state)++; -+ } else { - result = 0; -+ } -+ if (result != 0) { -+ T(("_nc_next_db %d %s", *state, result)); -+ } -+ return result; -+} - -- switch (*state) { -- case dbdTIC: -- if (HaveTicDirectory) -- result = _nc_tic_dir(0); -- break; --#if USE_DATABASE -- case dbdEnvOnce: -- if (use_terminfo_vars()) { -- if ((envp = getenv("TERMINFO")) != 0) -- result = _nc_tic_dir(envp); -+NCURSES_EXPORT(void) -+_nc_first_db(DBDIRS * state, int *offset) -+{ -+ bool cache_has_expired = FALSE; -+ *state = dbdTIC; -+ *offset = 0; -+ -+ T(("_nc_first_db")); -+ -+ /* build a blob containing all of the strings we will use for a lookup -+ * table. -+ */ -+ if (my_blob == 0 || (cache_has_expired = cache_expired())) { -+ size_t blobsize = 0; -+ const char *values[dbdLAST]; -+ struct stat *my_stat; -+ int j, k; -+ -+ if (cache_has_expired) -+ free_cache(); -+ -+ for (j = 0; j < dbdLAST; ++j) -+ values[j] = 0; -+ -+ /* -+ * This is the first item in the list, and is used only when tic is -+ * writing to the database, as a performance improvement. -+ */ -+ values[dbdTIC] = TicDirectory; -+ -+#if NCURSES_USE_DATABASE -+#ifdef TERMINFO_DIRS -+ values[dbdCfgList] = TERMINFO_DIRS; -+#endif -+#ifdef TERMINFO -+ values[dbdCfgOnce] = TERMINFO; -+#endif -+#endif -+ -+#if NCURSES_USE_TERMCAP -+ values[dbdCfgList2] = TERMPATH; -+#endif -+ -+ if (use_terminfo_vars()) { -+#if NCURSES_USE_DATABASE -+ values[dbdEnvOnce] = cache_getenv("TERMINFO", dbdEnvOnce); -+ values[dbdHome] = _nc_home_terminfo(); -+ (void) cache_getenv("HOME", dbdHome); -+ values[dbdEnvList] = cache_getenv("TERMINFO_DIRS", dbdEnvList); -+ -+#endif -+#if NCURSES_USE_TERMCAP -+ values[dbdEnvOnce2] = cache_getenv("TERMCAP", dbdEnvOnce2); -+ /* only use $TERMCAP if it is an absolute path */ -+ if (values[dbdEnvOnce2] != 0 -+ && *values[dbdEnvOnce2] != '/') { -+ values[dbdEnvOnce2] = 0; - } -- break; -- case dbdHome: -- if (use_terminfo_vars()) { -- result = _nc_home_terminfo(); -+ values[dbdEnvList2] = cache_getenv("TERMPATH", dbdEnvList2); -+#endif /* NCURSES_USE_TERMCAP */ -+ } -+ -+ for (j = 0; j < dbdLAST; ++j) { -+ if (values[j] == 0) -+ values[j] = ""; -+ blobsize += 2 + strlen(values[j]); -+ } -+ -+ my_blob = malloc(blobsize); -+ if (my_blob != 0) { -+ *my_blob = '\0'; -+ for (j = 0; j < dbdLAST; ++j) { -+ add_to_blob(values[j], blobsize); - } -- break; -- case dbdEnvList: -- if (use_terminfo_vars()) { -- if ((result = NEXT_DBD(getenv("TERMINFO_DIRS"), offset)) != 0) -- next = *state; -+ -+ /* Now, build an array which will be pointers to the distinct -+ * strings in the blob. -+ */ -+ blobsize = 2; -+ for (j = 0; my_blob[j] != '\0'; ++j) { -+ if (my_blob[j] == NCURSES_PATHSEP) -+ ++blobsize; - } -- break; -- case dbdCfgList: --#ifdef TERMINFO_DIRS -- if ((result = NEXT_DBD(TERMINFO_DIRS, offset)) != 0) -- next = *state; -+ my_list = typeCalloc(char *, blobsize); -+ my_stat = typeCalloc(struct stat, blobsize); -+ if (my_list != 0 && my_stat != 0) { -+ k = 0; -+ my_list[k++] = my_blob; -+ for (j = 0; my_blob[j] != '\0'; ++j) { -+ if (my_blob[j] == NCURSES_PATHSEP) { -+ my_blob[j] = '\0'; -+ my_list[k++] = &my_blob[j + 1]; -+ } -+ } -+ -+ /* -+ * Eliminate duplicates from the list. -+ */ -+ for (j = 0; my_list[j] != 0; ++j) { -+#ifdef TERMINFO -+ if (*my_list[j] == '\0') -+ my_list[j] = strdup(TERMINFO); - #endif -- break; -- case dbdCfgOnce: --#ifndef TERMINFO_DIRS -- result = TERMINFO; --#endif -- break; --#endif /* USE_DATABASE */ --#if USE_TERMCAP -- case dbdEnvOnce2: -- if (use_terminfo_vars()) { -- if ((envp = getenv("TERMCAP")) != 0) -- result = _nc_tic_dir(envp); -- } -- break; -- case dbdEnvList2: -- if (use_terminfo_vars()) { -- if ((result = NEXT_DBD(getenv("TERMPATH"), offset)) != 0) -- next = *state; -+ for (k = 0; k < j; ++k) { -+ if (!strcmp(my_list[j], my_list[k])) { -+ k = j - 1; -+ while ((my_list[j] = my_list[j + 1]) != 0) { -+ ++j; -+ } -+ j = k; -+ break; -+ } -+ } -+ } -+ -+ /* -+ * Eliminate non-existent databases, and those that happen to -+ * be symlinked to another location. -+ */ -+ for (j = 0; my_list[j] != 0; ++j) { -+ bool found = check_existence(my_list[j], &my_stat[j]); -+#if HAVE_LINK -+ if (found) { -+ for (k = 0; k < j; ++k) { -+ if (my_stat[j].st_dev == my_stat[k].st_dev -+ && my_stat[j].st_ino == my_stat[k].st_ino) { -+ found = FALSE; -+ break; -+ } -+ } -+ } -+#endif -+ if (!found) { -+ k = j; -+ while ((my_list[k] = my_list[k + 1]) != 0) { -+ ++k; -+ } -+ --j; -+ } -+ } -+ my_size = j; -+ my_time = time((time_t *) 0); -+ } else { -+ FreeAndNull(my_blob); - } -- break; -- case dbdCfgList2: -- if ((result = NEXT_DBD(TERMPATH, offset)) != 0) -- next = *state; -- break; --#endif /* USE_TERMCAP */ -- case dbdLAST: -- break; -- } -- if (*state != next) { -- *state = next; -- *offset = 0; -- _nc_last_db(); -- } -- if (result != 0) { -- return result; -+ free(my_stat); - } - } -- return 0; - } - --NCURSES_EXPORT(void) --_nc_first_db(DBDIRS * state, int *offset) -+#if NO_LEAKS -+void -+_nc_db_iterator_leaks(void) - { -- *state = dbdTIC; -- *offset = 0; -+ DBDIRS which; -+ -+ if (my_blob != 0) -+ FreeAndNull(my_blob); -+ if (my_list != 0) -+ FreeAndNull(my_list); -+ for (which = 0; (int) which < dbdLAST; ++which) { -+ my_vars[which].name = 0; -+ FreeIfNeeded(my_vars[which].value); -+ my_vars[which].value = 0; -+ } - } -+#endif -diff -Naur ncurses-5.9/ncurses/tinfo/doalloc.c ncurses-5.9.patch/ncurses/tinfo/doalloc.c ---- ncurses-5.9/ncurses/tinfo/doalloc.c 2002-08-31 23:48:11.000000000 +0200 -+++ ncurses-5.9.patch/ncurses/tinfo/doalloc.c 2014-09-01 16:33:22.421792231 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998,2000 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2000,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -39,7 +39,7 @@ - - #include <curses.priv.h> - --MODULE_ID("$Id: doalloc.c,v 1.8 2002/08/31 21:48:11 Philippe.Blain Exp $") -+MODULE_ID("$Id: doalloc.c,v 1.11 2012/11/03 19:27:41 tom Exp $") - - NCURSES_EXPORT(void *) - _nc_doalloc(void *oldp, size_t amount) -@@ -56,20 +56,3 @@ - } - return newp; - } -- --#if !HAVE_STRDUP --NCURSES_EXPORT(char *) --_nc_strdup(const char *src) --{ -- char *dst; -- if (src != 0) { -- dst = typeMalloc(char, strlen(src) + 1); -- if (dst != 0) { -- (void) strcpy(dst, src); -- } -- } else { -- dst = 0; -- } -- return dst; --} --#endif -diff -Naur ncurses-5.9/ncurses/tinfo/entries.c ncurses-5.9.patch/ncurses/tinfo/entries.c ---- ncurses-5.9/ncurses/tinfo/entries.c 2010-01-23 18:57:43.000000000 +0100 -+++ ncurses-5.9.patch/ncurses/tinfo/entries.c 2014-09-01 16:33:22.421792231 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 2006-2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 2006-2011,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -37,7 +37,7 @@ - - #include <tic.h> - --MODULE_ID("$Id: entries.c,v 1.17 2010/01/23 17:57:43 tom Exp $") -+MODULE_ID("$Id: entries.c,v 1.21 2012/05/05 20:33:44 tom Exp $") - - /**************************************************************************** - * -@@ -96,6 +96,9 @@ - if (last != 0) { - last->next = ep->next; - } -+ if (ep->next != 0) { -+ ep->next->last = last; -+ } - if (ep == _nc_head) { - _nc_head = ep->next; - } -@@ -128,19 +131,21 @@ - _nc_free_entries(_nc_head); - _nc_get_type(0); - _nc_first_name(0); -+ _nc_db_iterator_leaks(); - _nc_keyname_leaks(); - #if BROKEN_LINKER || USE_REENTRANT - _nc_names_leaks(); - _nc_codes_leaks(); - FreeIfNeeded(_nc_prescreen.real_acs_map); - #endif -+ _nc_comp_error_leaks(); - - if ((s = _nc_home_terminfo()) != 0) - free(s); - - #ifdef TRACE - trace(0); -- _nc_trace_buf(-1, 0); -+ _nc_trace_buf(-1, (size_t) 0); - #endif - - #endif /* NO_LEAKS */ -diff -Naur ncurses-5.9/ncurses/tinfo/getenv_num.c ncurses-5.9.patch/ncurses/tinfo/getenv_num.c ---- ncurses-5.9/ncurses/tinfo/getenv_num.c 2000-12-10 03:55:07.000000000 +0100 -+++ ncurses-5.9.patch/ncurses/tinfo/getenv_num.c 2014-09-01 16:33:22.421792231 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998,2000 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -36,7 +36,7 @@ - - #include <curses.priv.h> - --MODULE_ID("$Id: getenv_num.c,v 1.3 2000/12/10 02:55:07 tom Exp $") -+MODULE_ID("$Id: getenv_num.c,v 1.6 2013/09/28 20:25:08 tom Exp $") - - NCURSES_EXPORT(int) - _nc_getenv_num(const char *name) -@@ -54,3 +54,20 @@ - - return (int) value; - } -+ -+NCURSES_EXPORT(void) -+_nc_setenv_num(const char *name, int value) -+{ -+ if (name != 0 && value >= 0) { -+ char buffer[128]; -+#if HAVE_SETENV -+ _nc_SPRINTF(buffer, _nc_SLIMIT(sizeof(buffer)) "%d", value); -+ setenv(name, buffer, 1); -+#elif HAVE_PUTENV -+ char *s; -+ _nc_SPRINTF(buffer, _nc_SLIMIT(sizeof(buffer)) "%s=%d", name, value); -+ if ((s = strdup(buffer)) != 0) -+ putenv(s); -+#endif -+ } -+} -diff -Naur ncurses-5.9/ncurses/tinfo/hashed_db.c ncurses-5.9.patch/ncurses/tinfo/hashed_db.c ---- ncurses-5.9/ncurses/tinfo/hashed_db.c 2008-12-13 21:59:02.000000000 +0100 -+++ ncurses-5.9.patch/ncurses/tinfo/hashed_db.c 2014-09-01 16:33:22.421792231 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 2006,2008 Free Software Foundation, Inc. * -+ * Copyright (c) 2006-2011,2013 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -36,12 +36,81 @@ - - #if USE_HASHED_DB - --MODULE_ID("$Id: hashed_db.c,v 1.14 2008/12/13 20:59:02 tom Exp $") -+MODULE_ID("$Id: hashed_db.c,v 1.17 2013/12/15 00:33:01 tom Exp $") - - #if HASHED_DB_API >= 2 - static DBC *cursor; - #endif - -+typedef struct _myconn { -+ struct _myconn *next; -+ DB *db; -+ char *path; -+ bool modify; -+} MYCONN; -+ -+static MYCONN *connections; -+ -+static void -+cleanup(void) -+{ -+ while (connections != 0) { -+ _nc_db_close(connections->db); -+ } -+} -+ -+static DB * -+find_connection(const char *path, bool modify) -+{ -+ DB *result = 0; -+ MYCONN *p; -+ -+ for (p = connections; p != 0; p = p->next) { -+ if (!strcmp(p->path, path) && p->modify == modify) { -+ result = p->db; -+ break; -+ } -+ } -+ -+ return result; -+} -+ -+static void -+drop_connection(DB * db) -+{ -+ MYCONN *p, *q; -+ -+ for (p = connections, q = 0; p != 0; q = p, p = p->next) { -+ if (p->db == db) { -+ if (q != 0) -+ q->next = p->next; -+ else -+ connections = p->next; -+ free(p->path); -+ free(p); -+ break; -+ } -+ } -+} -+ -+static void -+make_connection(DB * db, const char *path, bool modify) -+{ -+ MYCONN *p = typeCalloc(MYCONN, 1); -+ -+ if (p != 0) { -+ p->db = db; -+ p->path = strdup(path); -+ p->modify = modify; -+ if (p->path != 0) { -+ p->next = connections; -+ connections = p; -+ } else { -+ free(p); -+ } -+ } -+} -+ - /* - * Open the database. - */ -@@ -51,50 +120,57 @@ - DB *result = 0; - int code; - -+ if (connections == 0) -+ atexit(cleanup); -+ -+ if ((result = find_connection(path, modify)) == 0) { -+ - #if HASHED_DB_API >= 4 -- db_create(&result, NULL, 0); -- if ((code = result->open(result, -- NULL, -- path, -- NULL, -- DB_HASH, -- modify ? DB_CREATE : DB_RDONLY, -- 0644)) != 0) { -- result = 0; -- } -+ db_create(&result, NULL, 0); -+ if ((code = result->open(result, -+ NULL, -+ path, -+ NULL, -+ DB_HASH, -+ modify ? DB_CREATE : DB_RDONLY, -+ 0644)) != 0) { -+ result = 0; -+ } - #elif HASHED_DB_API >= 3 -- db_create(&result, NULL, 0); -- if ((code = result->open(result, -- path, -- NULL, -- DB_HASH, -- modify ? DB_CREATE : DB_RDONLY, -- 0644)) != 0) { -- result = 0; -- } -+ db_create(&result, NULL, 0); -+ if ((code = result->open(result, -+ path, -+ NULL, -+ DB_HASH, -+ modify ? DB_CREATE : DB_RDONLY, -+ 0644)) != 0) { -+ result = 0; -+ } - #elif HASHED_DB_API >= 2 -- if ((code = db_open(path, -- DB_HASH, -- modify ? DB_CREATE : DB_RDONLY, -- 0644, -- (DB_ENV *) 0, -- (DB_INFO *) 0, -- &result)) != 0) { -- result = 0; -- } --#else -- if ((result = dbopen(path, -- modify ? (O_CREAT | O_RDWR) : O_RDONLY, -- 0644, -- DB_HASH, -- NULL)) == 0) { -- code = errno; -- } -+ if ((code = db_open(path, -+ DB_HASH, -+ modify ? DB_CREATE : DB_RDONLY, -+ 0644, -+ (DB_ENV *) 0, -+ (DB_INFO *) 0, -+ &result)) != 0) { -+ result = 0; -+ } -+#else -+ if ((result = dbopen(path, -+ modify ? (O_CREAT | O_RDWR) : O_RDONLY, -+ 0644, -+ DB_HASH, -+ NULL)) == 0) { -+ code = errno; -+ } - #endif -- if (result != 0) { -- T(("opened %s", path)); -- } else { -- T(("cannot open %s: %s", path, strerror(code))); -+ if (result != 0) { -+ make_connection(result, path, modify); -+ T(("opened %s", path)); -+ } else { -+ T(("cannot open %s: %s", path, strerror(code))); -+ } - } - return result; - } -@@ -107,6 +183,7 @@ - { - int result; - -+ drop_connection(db); - #if HASHED_DB_API >= 2 - result = db->close(db, 0); - #else -@@ -209,7 +286,7 @@ - _nc_db_have_index(DBT * key, DBT * data, char **buffer, int *size) - { - bool result = FALSE; -- int used = data->size - 1; -+ int used = (int) data->size - 1; - char *have = (char *) data->data; - - (void) key; -@@ -232,7 +309,7 @@ - _nc_db_have_data(DBT * key, DBT * data, char **buffer, int *size) - { - bool result = FALSE; -- int used = data->size - 1; -+ int used = (int) data->size - 1; - char *have = (char *) data->data; - - if (*have++ == 0) { -diff -Naur ncurses-5.9/ncurses/tinfo/home_terminfo.c ncurses-5.9.patch/ncurses/tinfo/home_terminfo.c ---- ncurses-5.9/ncurses/tinfo/home_terminfo.c 2010-12-26 00:43:58.000000000 +0100 -+++ ncurses-5.9.patch/ncurses/tinfo/home_terminfo.c 2014-09-01 16:33:22.421792231 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2008,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -37,7 +37,7 @@ - #include <curses.priv.h> - #include <tic.h> - --MODULE_ID("$Id: home_terminfo.c,v 1.12 2010/12/25 23:43:58 tom Exp $") -+MODULE_ID("$Id: home_terminfo.c,v 1.15 2012/10/27 21:49:14 tom Exp $") - - /* ncurses extension...fall back on user's private directory */ - -@@ -54,10 +54,8 @@ - if (MyBuffer == 0) { - if ((home = getenv("HOME")) != 0) { - size_t want = (strlen(home) + sizeof(PRIVATE_INFO)); -- MyBuffer = typeMalloc(char, want); -- if (MyBuffer == 0) -- _nc_err_abort(MSG_NO_MEMORY); -- (void) sprintf(MyBuffer, PRIVATE_INFO, home); -+ TYPE_MALLOC(char, want, MyBuffer); -+ _nc_SPRINTF(MyBuffer, _nc_SLIMIT(want) PRIVATE_INFO, home); - } - } - result = MyBuffer; -diff -Naur ncurses-5.9/ncurses/tinfo/lib_acs.c ncurses-5.9.patch/ncurses/tinfo/lib_acs.c ---- ncurses-5.9/ncurses/tinfo/lib_acs.c 2010-12-26 00:00:45.000000000 +0100 -+++ ncurses-5.9.patch/ncurses/tinfo/lib_acs.c 2014-09-01 16:33:22.422792233 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2013,2014 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -39,7 +39,7 @@ - #define CUR SP_TERMTYPE - #endif - --MODULE_ID("$Id: lib_acs.c,v 1.43 2010/12/25 23:00:45 tom Exp $") -+MODULE_ID("$Id: lib_acs.c,v 1.45 2014/03/08 20:32:59 tom Exp $") - - #if BROKEN_LINKER || USE_REENTRANT - #define MyBuffer _nc_prescreen.real_acs_map -@@ -166,11 +166,10 @@ - real_map['E'] = '+'; /* large plus or crossover */ - - #ifdef USE_TERM_DRIVER -- CallDriver_2(SP_PARM, initacs, real_map, fake_map); -+ CallDriver_2(SP_PARM, td_initacs, real_map, fake_map); - #else - if (ena_acs != NULL) { -- TPUTS_TRACE("ena_acs"); -- putp(ena_acs); -+ NCURSES_PUTP2("ena_acs", ena_acs); - } - #if NCURSES_EXT_FUNCS - /* -diff -Naur ncurses-5.9/ncurses/tinfo/lib_baudrate.c ncurses-5.9.patch/ncurses/tinfo/lib_baudrate.c ---- ncurses-5.9/ncurses/tinfo/lib_baudrate.c 2010-12-19 02:50:50.000000000 +0100 -+++ ncurses-5.9.patch/ncurses/tinfo/lib_baudrate.c 2014-09-01 16:33:22.422792233 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2010,2013 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -49,7 +49,7 @@ - * of the indices up to B115200 fit nicely in a 'short', allowing us to retain - * ospeed's type for compatibility. - */ --#if (defined(__FreeBSD__) && (__FreeBSD_version < 700000)) || defined(__NetBSD__) || defined(__OpenBSD__) -+#if NCURSES_OSPEED_COMPAT && ((defined(__FreeBSD__) && (__FreeBSD_version < 700000)) || defined(__NetBSD__) || defined(__OpenBSD__)) - #undef B0 - #undef B50 - #undef B75 -@@ -79,7 +79,7 @@ - #undef USE_OLD_TTY - #endif /* USE_OLD_TTY */ - --MODULE_ID("$Id: lib_baudrate.c,v 1.31 2010/12/19 01:50:50 tom Exp $") -+MODULE_ID("$Id: lib_baudrate.c,v 1.34 2013/12/15 01:29:02 tom Exp $") - - /* - * int -@@ -90,54 +90,55 @@ - */ - - struct speed { -- int s; /* value for 'ospeed' is an index */ -+ NCURSES_OSPEED s; /* values for 'ospeed' */ - int sp; /* the actual speed */ - }; - -+#define DATA(number) { B##number, number } -+ - static struct speed const speeds[] = - { -- {B0, 0}, -- {B50, 50}, -- {B75, 75}, -- {B110, 110}, -- {B134, 134}, -- {B150, 150}, -- {B200, 200}, -- {B300, 300}, -- {B600, 600}, -- {B1200, 1200}, -- {B1800, 1800}, -- {B2400, 2400}, -- {B4800, 4800}, -- {B9600, 9600}, -+ DATA(0), -+ DATA(50), -+ DATA(75), -+ DATA(110), -+ DATA(134), -+ DATA(150), -+ DATA(200), -+ DATA(300), -+ DATA(600), -+ DATA(1200), -+ DATA(1800), -+ DATA(2400), -+ DATA(4800), -+ DATA(9600), - #ifdef B19200 -- {B19200, 19200}, --#else --#ifdef EXTA -+ DATA(19200), -+#elif defined(EXTA) - {EXTA, 19200}, - #endif --#endif - #ifdef B38400 -- {B38400, 38400}, --#else --#ifdef EXTB -+ DATA(38400), -+#elif defined(EXTB) - {EXTB, 38400}, - #endif --#endif - #ifdef B57600 -- {B57600, 57600}, -+ DATA(57600), - #endif -+ /* ifdef to prevent overflow when OLD_TTY is not available */ -+#if !(NCURSES_OSPEED_COMPAT && defined(__FreeBSD__) && (__FreeBSD_version > 700000)) - #ifdef B115200 -- {B115200, 115200}, -+ DATA(115200), - #endif - #ifdef B230400 -- {B230400, 230400}, -+ DATA(230400), - #endif - #ifdef B460800 -- {B460800, 460800}, -+ DATA(460800), - #endif - #ifdef B921600 -- {B921600, 921600}, -+ DATA(921600), -+#endif - #endif - }; - -@@ -167,7 +168,7 @@ - } - } - #if !USE_REENTRANT -- if (OSpeed == last_OSpeed) { -+ if (OSpeed != last_OSpeed) { - last_OSpeed = OSpeed; - last_baudrate = result; - } -@@ -219,8 +220,8 @@ - - if (IsValidTIScreen(SP_PARM)) { - #ifdef USE_OLD_TTY -- result = cfgetospeed(&(TerminalOf(SP_PARM)->Nttyb)); -- ospeed = _nc_ospeed(result); -+ result = (int) cfgetospeed(&(TerminalOf(SP_PARM)->Nttyb)); -+ ospeed = (NCURSES_OSPEED) _nc_ospeed(result); - #else /* !USE_OLD_TTY */ - #ifdef TERMIOS - ospeed = (NCURSES_OSPEED) cfgetospeed(&(TerminalOf(SP_PARM)->Nttyb)); -diff -Naur ncurses-5.9/ncurses/tinfo/lib_cur_term.c ncurses-5.9.patch/ncurses/tinfo/lib_cur_term.c ---- ncurses-5.9/ncurses/tinfo/lib_cur_term.c 2010-12-19 02:38:45.000000000 +0100 -+++ ncurses-5.9.patch/ncurses/tinfo/lib_cur_term.c 2014-09-01 16:33:22.422792233 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2013,2014 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -39,14 +39,12 @@ - #include <curses.priv.h> - #include <termcap.h> /* ospeed */ - --MODULE_ID("$Id: lib_cur_term.c,v 1.30 2010/12/19 01:38:45 tom Exp $") -+MODULE_ID("$Id: lib_cur_term.c,v 1.33 2014/03/08 20:32:59 tom Exp $") - - #undef CUR - #define CUR termp->type. - --#if BROKEN_LINKER && !USE_REENTRANT --NCURSES_EXPORT_VAR(TERMINAL *) cur_term = 0; --#elif BROKEN_LINKER || USE_REENTRANT -+#if USE_REENTRANT - - NCURSES_EXPORT(TERMINAL *) - NCURSES_SP_NAME(_nc_get_cur_term) (NCURSES_SP_DCL0) -@@ -55,6 +53,7 @@ - } - - #if NCURSES_SP_FUNCS -+ - NCURSES_EXPORT(TERMINAL *) - _nc_get_cur_term(void) - { -@@ -87,10 +86,10 @@ - oldterm = cur_term; - if (SP_PARM) - SP_PARM->_term = termp; --#if BROKEN_LINKER && !USE_REENTRANT -- cur_term = termp; --#else -+#if USE_REENTRANT - CurTerm = termp; -+#else -+ cur_term = termp; - #endif - if (termp != 0) { - #ifdef USE_TERM_DRIVER -@@ -133,9 +132,7 @@ - TERMINAL_CONTROL_BLOCK *TCB = (TERMINAL_CONTROL_BLOCK *) termp; - #endif - TERMINAL *cur = ( --#if BROKEN_LINKER && !USE_REENTRANT -- cur_term --#elif BROKEN_LINKER || USE_REENTRANT -+#if USE_REENTRANT - NCURSES_SP_NAME(_nc_get_cur_term) (NCURSES_SP_ARG) - #else - cur_term -@@ -148,12 +145,13 @@ - - FreeIfNeeded(termp->_termname); - #if USE_HOME_TERMINFO -- if (_nc_globals.home_terminfo != 0) -+ if (_nc_globals.home_terminfo != 0) { - FreeAndNull(_nc_globals.home_terminfo); -+ } - #endif - #ifdef USE_TERM_DRIVER - if (TCB->drv) -- TCB->drv->release(TCB); -+ TCB->drv->td_release(TCB); - #endif - free(termp); - -diff -Naur ncurses-5.9/ncurses/tinfo/lib_data.c ncurses-5.9.patch/ncurses/tinfo/lib_data.c ---- ncurses-5.9/ncurses/tinfo/lib_data.c 2010-05-16 00:06:56.000000000 +0200 -+++ ncurses-5.9.patch/ncurses/tinfo/lib_data.c 2014-09-01 16:33:22.422792233 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -42,7 +42,7 @@ - - #include <curses.priv.h> - --MODULE_ID("$Id: lib_data.c,v 1.61 2010/05/15 22:06:56 tom Exp $") -+MODULE_ID("$Id: lib_data.c,v 1.66 2013/08/24 17:28:24 tom Exp $") - - /* - * OS/2's native linker complains if we don't initialize public data when -@@ -114,6 +114,7 @@ - #define TGETENT_0s { TGETENT_0, TGETENT_0, TGETENT_0, TGETENT_0 } - - NCURSES_EXPORT_VAR(NCURSES_GLOBALS) _nc_globals = { -+ 0, /* have_sigtstp */ - 0, /* have_sigwinch */ - 0, /* cleanup_nested */ - -@@ -125,13 +126,14 @@ - - FALSE, /* have_tic_directory */ - FALSE, /* keep_tic_directory */ -- TERMINFO, /* tic_directory */ -+ 0, /* tic_directory */ - - NULL, /* dbi_list */ - 0, /* dbi_size */ - - NULL, /* first_name */ - NULL, /* keyname_table */ -+ 0, /* init_keyname */ - - 0, /* slk_format */ - -@@ -142,6 +144,12 @@ - 0, /* tgetent_index */ - 0, /* tgetent_sequence */ - -+ 0, /* dbd_blob */ -+ 0, /* dbd_list */ -+ 0, /* dbd_size */ -+ 0, /* dbd_time */ -+ { { 0, 0 } }, /* dbd_vars */ -+ - #ifndef USE_SP_WINDOWLIST - 0, /* _nc_windowlist */ - #endif -@@ -249,6 +257,7 @@ - NULL, /* _tputs_trace */ - #endif - #endif -+ FALSE, /* use_tioctl */ - }; - /* *INDENT-ON* */ - -diff -Naur ncurses-5.9/ncurses/tinfo/lib_has_cap.c ncurses-5.9.patch/ncurses/tinfo/lib_has_cap.c ---- ncurses-5.9/ncurses/tinfo/lib_has_cap.c 2009-10-25 00:15:47.000000000 +0200 -+++ ncurses-5.9.patch/ncurses/tinfo/lib_has_cap.c 2014-09-01 16:33:22.422792233 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2003,2009 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2009,2013 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -46,7 +46,7 @@ - #define CUR SP_TERMTYPE - #endif - --MODULE_ID("$Id: lib_has_cap.c,v 1.9 2009/10/24 22:15:47 tom Exp $") -+MODULE_ID("$Id: lib_has_cap.c,v 1.10 2013/11/16 19:57:22 tom Exp $") - - NCURSES_EXPORT(bool) - NCURSES_SP_NAME(has_ic) (NCURSES_SP_DCL0) -@@ -55,7 +55,7 @@ - - T((T_CALLED("has_ic(%p)"), (void *) SP_PARM)); - -- if (IsValidTIScreen(SP_PARM) && IsTermInfo(SP_PARM)) { -+ if (HasTInfoTerminal(SP_PARM)) { - code = ((insert_character || parm_ich - || (enter_insert_mode && exit_insert_mode)) - && (delete_character || parm_dch)) ? TRUE : FALSE; -@@ -77,7 +77,7 @@ - { - bool code = FALSE; - T((T_CALLED("has_il(%p)"), (void *) SP_PARM)); -- if (IsValidTIScreen(SP_PARM) && IsTermInfo(SP_PARM)) { -+ if (HasTInfoTerminal(SP_PARM)) { - code = ((insert_line || parm_insert_line) - && (delete_line || parm_delete_line)) ? TRUE : FALSE; - } -diff -Naur ncurses-5.9/ncurses/tinfo/lib_napms.c ncurses-5.9.patch/ncurses/tinfo/lib_napms.c ---- ncurses-5.9/ncurses/tinfo/lib_napms.c 2009-11-07 21:37:30.000000000 +0100 -+++ ncurses-5.9.patch/ncurses/tinfo/lib_napms.c 2014-09-01 16:33:22.422792233 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2008,2009 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2012,2014 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -51,17 +51,21 @@ - #endif - #endif - --MODULE_ID("$Id: lib_napms.c,v 1.20 2009/11/07 20:37:30 tom Exp $") -+MODULE_ID("$Id: lib_napms.c,v 1.24 2014/03/08 20:32:59 tom Exp $") - - NCURSES_EXPORT(int) - NCURSES_SP_NAME(napms) (NCURSES_SP_DCLx int ms) - { -- (void) SP_PARM; - T((T_CALLED("napms(%d)"), ms)); - - #ifdef USE_TERM_DRIVER -- CallDriver_1(SP_PARM, nap, ms); -+ if (HasTerminal(SP_PARM)) { -+ CallDriver_1(SP_PARM, td_nap, ms); -+ } - #else /* !USE_TERM_DRIVER */ -+#if NCURSES_SP_FUNCS -+ (void) sp; -+#endif - #if HAVE_NANOSLEEP - { - struct timespec request, remaining; -diff -Naur ncurses-5.9/ncurses/tinfo/lib_options.c ncurses-5.9.patch/ncurses/tinfo/lib_options.c ---- ncurses-5.9/ncurses/tinfo/lib_options.c 2009-10-24 23:56:15.000000000 +0200 -+++ ncurses-5.9.patch/ncurses/tinfo/lib_options.c 2014-09-01 16:33:22.422792233 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2008,2009 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2013,2014 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -46,7 +46,7 @@ - #define CUR SP_TERMTYPE - #endif - --MODULE_ID("$Id: lib_options.c,v 1.71 2009/10/24 21:56:15 tom Exp $") -+MODULE_ID("$Id: lib_options.c,v 1.77 2014/03/08 20:32:59 tom Exp $") - - NCURSES_EXPORT(int) - idlok(WINDOW *win, bool flag) -@@ -56,7 +56,11 @@ - - if (win) { - SCREEN *sp = _nc_screen_of(win); -- if (sp && IsTermInfo(sp)) { -+ if (sp != 0 -+#ifdef USE_TERM_DRIVER -+ && IsTermInfo(sp) -+#endif -+ ) { - sp->_nc_sp_idlok = - win->_idlok = (flag && (NCURSES_SP_NAME(has_il) (NCURSES_SP_ARG) - || change_scroll_region)); -@@ -165,16 +169,16 @@ - #ifdef USE_TERM_DRIVER - if (IsTermInfo(sp)) { - if (flag) { -- NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx "meta_on", meta_on); -+ NCURSES_PUTP2("meta_on", meta_on); - } else { -- NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx "meta_off", meta_off); -+ NCURSES_PUTP2("meta_off", meta_off); - } - } - #else - if (flag) { -- NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx "meta_on", meta_on); -+ NCURSES_PUTP2("meta_on", meta_on); - } else { -- NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx "meta_off", meta_off); -+ NCURSES_PUTP2("meta_off", meta_off); - } - #endif - result = OK; -@@ -199,19 +203,16 @@ - if (!bBuiltIn) { - switch (vis) { - case 2: -- code = NCURSES_SP_NAME(_nc_putp_flush) (NCURSES_SP_ARGx -- "cursor_visible", -- cursor_visible); -+ code = NCURSES_PUTP2_FLUSH("cursor_visible", -+ cursor_visible); - break; - case 1: -- code = NCURSES_SP_NAME(_nc_putp_flush) (NCURSES_SP_ARGx -- "cursor_normal", -- cursor_normal); -+ code = NCURSES_PUTP2_FLUSH("cursor_normal", -+ cursor_normal); - break; - case 0: -- code = NCURSES_SP_NAME(_nc_putp_flush) (NCURSES_SP_ARGx -- "cursor_invisible", -- cursor_invisible); -+ code = NCURSES_PUTP2_FLUSH("cursor_invisible", -+ cursor_invisible); - break; - } - } else -@@ -301,7 +302,7 @@ - NCURSES_SP_NAME(_nc_putp_flush) (NCURSES_SP_DCLx - const char *name, const char *value) - { -- int rc = NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx name, value); -+ int rc = NCURSES_PUTP2(name, value); - if (rc != ERR) { - _nc_flush(); - } -@@ -324,7 +325,7 @@ - * the terminal state _before_ switching modes. - */ - NCURSES_EXPORT(int) --_nc_keypad(SCREEN *sp, bool flag) -+_nc_keypad(SCREEN *sp, int flag) - { - int rc = ERR; - -@@ -349,18 +350,14 @@ - #endif - { - #ifdef USE_TERM_DRIVER -- rc = CallDriver_1(sp, kpad, flag); -+ rc = CallDriver_1(sp, td_kpad, flag); - if (rc == OK) - sp->_keypad_on = flag; - #else - if (flag) { -- (void) NCURSES_SP_NAME(_nc_putp_flush) (NCURSES_SP_ARGx -- "keypad_xmit", -- keypad_xmit); -+ (void) NCURSES_PUTP2_FLUSH("keypad_xmit", keypad_xmit); - } else if (!flag && keypad_local) { -- (void) NCURSES_SP_NAME(_nc_putp_flush) (NCURSES_SP_ARGx -- "keypad_local", -- keypad_local); -+ (void) NCURSES_PUTP2_FLUSH("keypad_local", keypad_local); - } - - if (flag && !sp->_tried) { -diff -Naur ncurses-5.9/ncurses/tinfo/lib_print.c ncurses-5.9.patch/ncurses/tinfo/lib_print.c ---- ncurses-5.9/ncurses/tinfo/lib_print.c 2010-06-06 00:18:35.000000000 +0200 -+++ ncurses-5.9.patch/ncurses/tinfo/lib_print.c 2014-09-01 16:33:22.423792234 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -39,7 +39,7 @@ - #define CUR SP_TERMTYPE - #endif - --MODULE_ID("$Id: lib_print.c,v 1.20 2010/06/05 22:18:35 tom Exp $") -+MODULE_ID("$Id: lib_print.c,v 1.23 2012/02/22 22:34:31 tom Exp $") - - NCURSES_EXPORT(int) - NCURSES_SP_NAME(mcprint) (NCURSES_SP_DCLx char *data, int len) -@@ -76,10 +76,10 @@ - return (ERR); - } - -- (void) strcpy(mybuf, switchon); -- memcpy(mybuf + onsize, data, (unsigned) len); -+ _nc_STRCPY(mybuf, switchon, need); -+ memcpy(mybuf + onsize, data, (size_t) len); - if (offsize) -- (void) strcpy(mybuf + onsize + len, prtr_off); -+ _nc_STRCPY(mybuf + onsize + len, prtr_off, need); - - /* - * We're relying on the atomicity of UNIX writes here. The -diff -Naur ncurses-5.9/ncurses/tinfo/lib_raw.c ncurses-5.9.patch/ncurses/tinfo/lib_raw.c ---- ncurses-5.9/ncurses/tinfo/lib_raw.c 2010-04-25 01:49:12.000000000 +0200 -+++ ncurses-5.9.patch/ncurses/tinfo/lib_raw.c 2014-09-01 16:33:22.423792234 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -49,11 +49,7 @@ - - #include <curses.priv.h> - --MODULE_ID("$Id: lib_raw.c,v 1.19 2010/04/24 23:49:12 tom Exp $") -- --#if SVR4_TERMIO && !defined(_POSIX_SOURCE) --#define _POSIX_SOURCE --#endif -+MODULE_ID("$Id: lib_raw.c,v 1.21 2012/01/21 19:21:29 KO.Myung-Hun Exp $") - - #if HAVE_SYS_TERMIO_H - #include <sys/termio.h> /* needed for ISC */ -@@ -66,6 +62,11 @@ - #define _nc_setmode(mode) /* nothing */ - #endif - -+#if USE_KLIBC_KBD -+#define INCL_KBD -+#include <os2.h> -+#endif -+ - #define COOKED_INPUT (IXON|BRKINT|PARMRK) - - #ifdef TRACE -@@ -100,6 +101,17 @@ - #endif - result = NCURSES_SP_NAME(_nc_set_tty_mode) (NCURSES_SP_ARGx &buf); - if (result == OK) { -+#if USE_KLIBC_KBD -+ KBDINFO kbdinfo; -+ -+ kbdinfo.cb = sizeof(kbdinfo); -+ KbdGetStatus(&kbdinfo, 0); -+ -+ kbdinfo.cb = sizeof(kbdinfo); -+ kbdinfo.fsMask &= ~KEYBOARD_ASCII_MODE; -+ kbdinfo.fsMask |= KEYBOARD_BINARY_MODE; -+ KbdSetStatus(&kbdinfo, 0); -+#endif - SP_PARM->_raw = TRUE; - SP_PARM->_cbreak = 1; - termp->Nttyb = buf; -@@ -218,6 +230,17 @@ - #endif - result = NCURSES_SP_NAME(_nc_set_tty_mode) (NCURSES_SP_ARGx &buf); - if (result == OK) { -+#if USE_KLIBC_KBD -+ KBDINFO kbdinfo; -+ -+ kbdinfo.cb = sizeof(kbdinfo); -+ KbdGetStatus(&kbdinfo, 0); -+ -+ kbdinfo.cb = sizeof(kbdinfo); -+ kbdinfo.fsMask &= ~KEYBOARD_BINARY_MODE; -+ kbdinfo.fsMask |= KEYBOARD_ASCII_MODE; -+ KbdSetStatus(&kbdinfo, 0); -+#endif - SP_PARM->_raw = FALSE; - SP_PARM->_cbreak = 0; - termp->Nttyb = buf; -diff -Naur ncurses-5.9/ncurses/tinfo/lib_setup.c ncurses-5.9.patch/ncurses/tinfo/lib_setup.c ---- ncurses-5.9/ncurses/tinfo/lib_setup.c 2011-02-06 02:04:21.000000000 +0100 -+++ ncurses-5.9.patch/ncurses/tinfo/lib_setup.c 2014-09-01 16:33:22.423792234 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2010,2011 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2013,2014 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -37,21 +37,18 @@ - * Terminal setup routines common to termcap and terminfo: - * - * use_env(bool) -+ * use_tioctl(bool) - * setupterm(char *, int, int *) - */ - - #include <curses.priv.h> - #include <tic.h> /* for MAX_NAME_SIZE */ - --#if SVR4_TERMIO && !defined(_POSIX_SOURCE) --#define _POSIX_SOURCE --#endif -- - #if HAVE_LOCALE_H - #include <locale.h> - #endif - --MODULE_ID("$Id: lib_setup.c,v 1.135 2011/02/06 01:04:21 tom Exp $") -+MODULE_ID("$Id: lib_setup.c,v 1.159 2014/03/08 20:32:59 tom Exp $") - - /**************************************************************************** - * -@@ -225,6 +222,7 @@ - { - T((T_CALLED("use_env(%p,%d)"), (void *) SP_PARM, (int) f)); - #if NCURSES_SP_FUNCS -+ START_TRACE(); - if (IsPreScreen(SP_PARM)) { - SP_PARM->_use_env = f; - } -@@ -234,14 +232,39 @@ - returnVoid; - } - -+NCURSES_EXPORT(void) -+NCURSES_SP_NAME(use_tioctl) (NCURSES_SP_DCLx bool f) -+{ -+ T((T_CALLED("use_tioctl(%p,%d)"), (void *) SP_PARM, (int) f)); -+#if NCURSES_SP_FUNCS -+ START_TRACE(); -+ if (IsPreScreen(SP_PARM)) { -+ SP_PARM->_use_tioctl = f; -+ } -+#else -+ _nc_prescreen.use_tioctl = f; -+#endif -+ returnVoid; -+} -+ - #if NCURSES_SP_FUNCS - NCURSES_EXPORT(void) - use_env(bool f) - { - T((T_CALLED("use_env(%d)"), (int) f)); -+ START_TRACE(); - _nc_prescreen.use_env = f; - returnVoid; - } -+ -+NCURSES_EXPORT(void) -+use_tioctl(bool f) -+{ -+ T((T_CALLED("use_tioctl(%d)"), (int) f)); -+ START_TRACE(); -+ _nc_prescreen.use_tioctl = f; -+ returnVoid; -+} - #endif - - NCURSES_EXPORT(void) -@@ -260,7 +283,7 @@ - TCB = (TERMINAL_CONTROL_BLOCK *) termp; - - my_tabsize = TCB->info.tabsize; -- TCB->drv->size(TCB, linep, colp); -+ TCB->drv->td_size(TCB, linep, colp); - - #if USE_REENTRANT - if (sp != 0) { -@@ -281,7 +304,7 @@ - *linep = (int) lines; - *colp = (int) columns; - -- if (_nc_prescreen.use_env) { -+ if (_nc_prescreen.use_env || _nc_prescreen.use_tioctl) { - int value; - - #ifdef __EMX__ -@@ -289,7 +312,9 @@ - int screendata[2]; - _scrsize(screendata); - *colp = screendata[0]; -- *linep = screendata[1]; -+ *linep = ((sp != 0 && sp->_filtered) -+ ? 1 -+ : screendata[1]); - T(("EMX screen size: environment LINES = %d COLUMNS = %d", - *linep, *colp)); - } -@@ -315,19 +340,33 @@ - } - #endif /* HAVE_SIZECHANGE */ - -- /* -- * Finally, look for environment variables. -- * -- * Solaris lets users override either dimension with an environment -- * variable. -- */ -- if ((value = _nc_getenv_num("LINES")) > 0) { -- *linep = value; -- T(("screen size: environment LINES = %d", *linep)); -- } -- if ((value = _nc_getenv_num("COLUMNS")) > 0) { -- *colp = value; -- T(("screen size: environment COLUMNS = %d", *colp)); -+ if (_nc_prescreen.use_env) { -+ if (_nc_prescreen.use_tioctl) { -+ /* -+ * If environment variables are used, update them. -+ */ -+ if ((sp == 0 || !sp->_filtered) && _nc_getenv_num("LINES") > 0) { -+ _nc_setenv_num("LINES", *linep); -+ } -+ if (_nc_getenv_num("COLUMNS") > 0) { -+ _nc_setenv_num("COLUMNS", *colp); -+ } -+ } -+ -+ /* -+ * Finally, look for environment variables. -+ * -+ * Solaris lets users override either dimension with an environment -+ * variable. -+ */ -+ if ((value = _nc_getenv_num("LINES")) > 0) { -+ *linep = value; -+ T(("screen size: environment LINES = %d", *linep)); -+ } -+ if ((value = _nc_getenv_num("COLUMNS")) > 0) { -+ *colp = value; -+ T(("screen size: environment COLUMNS = %d", *colp)); -+ } - } - - /* if we can't get dynamic info about the size, use static */ -@@ -384,7 +423,7 @@ - - assert(sp != 0); - -- CallDriver_2(sp, getsize, &old_lines, &old_cols); -+ CallDriver_2(sp, td_getsize, &old_lines, &old_cols); - - #else - TERMINAL *termp = cur_term; -@@ -399,10 +438,12 @@ - * We're doing it this way because those functions belong to the upper - * ncurses library, while this resides in the lower terminfo library. - */ -- if (sp != 0 -- && sp->_resize != 0) { -- if ((new_lines != old_lines) || (new_cols != old_cols)) -+ if (sp != 0 && sp->_resize != 0) { -+ if ((new_lines != old_lines) || (new_cols != old_cols)) { - sp->_resize(NCURSES_SP_ARGx new_lines, new_cols); -+ } else if (sp->_sig_winch && (sp->_ungetch != 0)) { -+ sp->_ungetch(SP_PARM, KEY_RESIZE); /* so application can know this */ -+ } - sp->_sig_winch = FALSE; - } - } -@@ -414,23 +455,7 @@ - * - ****************************************************************************/ - --#define ret_error(code, fmt, arg) if (errret) {\ -- *errret = code;\ -- returnCode(ERR);\ -- } else {\ -- fprintf(stderr, fmt, arg);\ -- exit(EXIT_FAILURE);\ -- } -- --#define ret_error0(code, msg) if (errret) {\ -- *errret = code;\ -- returnCode(ERR);\ -- } else {\ -- fprintf(stderr, msg);\ -- exit(EXIT_FAILURE);\ -- } -- --#if USE_DATABASE || USE_TERMCAP -+#if NCURSES_USE_DATABASE || NCURSES_USE_TERMCAP - /* - * Return 1 if entry found, 0 if not found, -1 if database not accessible, - * just like tgetent(). -@@ -467,7 +492,7 @@ - ** and substitute it in for the prototype given in 'command_character'. - */ - void --_nc_tinfo_cmdch(TERMINAL * termp, char proto) -+_nc_tinfo_cmdch(TERMINAL * termp, int proto) - { - unsigned i; - char CC; -@@ -481,8 +506,8 @@ - if ((tmp = getenv("CC")) != 0 && strlen(tmp) == 1) { - CC = *tmp; - for_each_string(i, &(termp->type)) { -- for (tmp = termp->type.Strings[i]; *tmp; tmp++) { -- if (*tmp == proto) -+ for (tmp = termp->type.Strings[i]; tmp && *tmp; tmp++) { -+ if (UChar(*tmp) == proto) - *tmp = CC; - } - } -@@ -520,7 +545,9 @@ - _nc_unicode_locale(void) - { - int result = 0; --#if HAVE_LANGINFO_CODESET -+#if defined(__MINGW32__) && USE_WIDEC_SUPPORT -+ result = 1; -+#elif HAVE_LANGINFO_CODESET - char *env = nl_langinfo(CODESET); - result = !strcmp(env, "UTF-8"); - T(("_nc_unicode_locale(%s) ->%d", env, result)); -@@ -551,7 +578,7 @@ - int value; - int result = 0; - -- if ((env = getenv(env_name)) != 0) { -+ if (getenv(env_name) != 0) { - result = _nc_getenv_num(env_name); - } else if ((value = tigetnum("U8")) >= 0) { - result = value; /* use extension feature */ -@@ -578,7 +605,7 @@ - NCURSES_CONST char *tname, - int Filedes, - int *errret, -- bool reuse) -+ int reuse) - { - #ifdef USE_TERM_DRIVER - TERMINAL_CONTROL_BLOCK *TCB = 0; -@@ -608,7 +635,11 @@ - if (tname == 0) { - tname = getenv("TERM"); - if (tname == 0 || *tname == '\0') { -+#ifdef USE_TERM_DRIVER -+ tname = "unknown"; -+#else - ret_error0(TGETENT_ERR, "TERM environment variable not set.\n"); -+#endif - } - } - -@@ -651,9 +682,14 @@ - && _nc_name_match(termp->type.term_names, tname, "|")) { - T(("reusing existing terminal information and mode-settings")); - code = OK; -+#ifdef USE_TERM_DRIVER -+ TCB = (TERMINAL_CONTROL_BLOCK *) termp; -+#endif - } else { - #ifdef USE_TERM_DRIVER -- termp = (TERMINAL *) typeCalloc(TERMINAL_CONTROL_BLOCK, 1); -+ TERMINAL_CONTROL_BLOCK *my_tcb; -+ my_tcb = typeCalloc(TERMINAL_CONTROL_BLOCK, 1); -+ termp = &(my_tcb->term); - #else - termp = typeCalloc(TERMINAL, 1); - #endif -@@ -673,7 +709,7 @@ - "Could not find any driver to handle this terminal.\n"); - } - #else --#if USE_DATABASE || USE_TERMCAP -+#if NCURSES_USE_DATABASE || NCURSES_USE_TERMCAP - status = _nc_setup_tinfo(tname, &termp->type); - #else - status = TGETENT_NO; -@@ -684,7 +720,7 @@ - const TERMTYPE *fallback = _nc_fallback(tname); - - if (fallback) { -- termp->type = *fallback; -+ _nc_copy_termtype(&(termp->type), fallback); - status = TGETENT_YES; - } - } -@@ -694,11 +730,11 @@ - if (status == TGETENT_ERR) { - ret_error0(status, "terminals database is inaccessible\n"); - } else if (status == TGETENT_NO) { -- ret_error(status, "'%s': unknown terminal type.\n", tname); -+ ret_error1(status, "unknown terminal type.\n", tname); - } - } - #if !USE_REENTRANT -- strncpy(ttytype, termp->type.term_names, NAMESIZE - 1); -+ strncpy(ttytype, termp->type.term_names, (size_t) (NAMESIZE - 1)); - ttytype[NAMESIZE - 1] = '\0'; - #endif - -@@ -708,7 +744,7 @@ - set_curterm(termp); - - if (command_character) -- _nc_tinfo_cmdch(termp, *command_character); -+ _nc_tinfo_cmdch(termp, UChar(*command_character)); - - /* - * If an application calls setupterm() rather than initscr() or -@@ -727,7 +763,7 @@ - #ifdef USE_TERM_DRIVER - *tp = termp; - NCURSES_SP_NAME(set_curterm) (sp, termp); -- TCB->drv->init(TCB); -+ TCB->drv->td_init(TCB); - #else - sp = SP; - #endif -@@ -742,10 +778,20 @@ - - #ifndef USE_TERM_DRIVER - if (generic_type) { -- ret_error(TGETENT_NO, "'%s': I need something more specific.\n", tname); -- } -- if (hard_copy) { -- ret_error(TGETENT_YES, "'%s': I can't handle hardcopy terminals.\n", tname); -+ /* -+ * BSD 4.3's termcap contains mis-typed "gn" for wy99. Do a sanity -+ * check before giving up. -+ */ -+ if ((VALID_STRING(cursor_address) -+ || (VALID_STRING(cursor_down) && VALID_STRING(cursor_home))) -+ && VALID_STRING(clear_screen)) { -+ ret_error1(TGETENT_YES, "terminal is not really generic.\n", tname); -+ } else { -+ del_curterm(termp); -+ ret_error1(TGETENT_NO, "I need something more specific.\n", tname); -+ } -+ } else if (hard_copy) { -+ ret_error1(TGETENT_YES, "I can't handle hardcopy terminals.\n", tname); - } - #endif - returnCode(code); -@@ -798,10 +844,10 @@ - _nc_setupterm(NCURSES_CONST char *tname, - int Filedes, - int *errret, -- bool reuse) -+ int reuse) - { - int res; -- TERMINAL *termp; -+ TERMINAL *termp = 0; - res = TINFO_SETUP_TERM(&termp, tname, Filedes, errret, reuse); - if (ERR != res) - NCURSES_SP_NAME(set_curterm) (CURRENT_SCREEN_PRE, termp); -diff -Naur ncurses-5.9/ncurses/tinfo/lib_termcap.c ncurses-5.9.patch/ncurses/tinfo/lib_termcap.c ---- ncurses-5.9/ncurses/tinfo/lib_termcap.c 2010-12-25 20:27:12.000000000 +0100 -+++ ncurses-5.9.patch/ncurses/tinfo/lib_termcap.c 2014-09-01 16:33:22.423792234 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -48,7 +48,7 @@ - #define CUR SP_TERMTYPE - #endif - --MODULE_ID("$Id: lib_termcap.c,v 1.73 2010/12/25 19:27:12 tom Exp $") -+MODULE_ID("$Id: lib_termcap.c,v 1.80 2013/06/08 16:48:47 tom Exp $") - - NCURSES_EXPORT_VAR(char *) UP = 0; - NCURSES_EXPORT_VAR(char *) BC = 0; -@@ -63,6 +63,15 @@ - #define LAST_USE MyCache[CacheInx].last_used - #define LAST_SEQ MyCache[CacheInx].sequence - -+/* -+ * Termcap names are matched only using the first two bytes. -+ * Ignore any extended names longer than two bytes, to avoid problems -+ * with legacy code which passes in parameters whose use is long forgotten. -+ */ -+#define ValidCap(cap) (((cap)[0] != '\0') && ((cap)[1] != '\0')) -+#define SameCap(a,b) (((a)[0] == (b)[0]) && ((a)[1] == (b)[1])) -+#define ValidExt(ext) (ValidCap(ext) && (ext)[2] == '\0') -+ - /*************************************************************************** - * - * tgetent(bufp, term) -@@ -97,7 +106,7 @@ - #ifdef USE_TERM_DRIVER - if (termp == 0 || - !((TERMINAL_CONTROL_BLOCK *) termp)->drv->isTerminfo) -- return (rc); -+ returnCode(rc); - #endif - - /* -@@ -202,11 +211,13 @@ - static bool - same_tcname(const char *a, const char *b) - { -- fprintf(stderr, "compare(%s,%s)\n", a, b); -- return !strncmp(a, b, 2); -+ bool code = SameCap(a, b); -+ fprintf(stderr, "compare(%s,%s) %s\n", a, b, code ? "same" : "diff"); -+ return code; - } -+ - #else --#define same_tcname(a,b) !strncmp(a,b,2) -+#define same_tcname(a,b) SameCap(a,b) - #endif - - /*************************************************************************** -@@ -222,10 +233,10 @@ - NCURSES_SP_NAME(tgetflag) (NCURSES_SP_DCLx NCURSES_CONST char *id) - { - int result = 0; /* Solaris returns zero for missing flag */ -- int i, j; -+ int j = -1; - - T((T_CALLED("tgetflag(%p, %s)"), (void *) SP_PARM, id)); -- if (HasTInfoTerminal(SP_PARM)) { -+ if (HasTInfoTerminal(SP_PARM) && ValidCap(id)) { - TERMTYPE *tp = &(TerminalOf(SP_PARM)->type); - struct name_table_entry const *entry_ptr; - -@@ -235,10 +246,10 @@ - } - #if NCURSES_XNAMES - else { -- j = -1; -+ int i; - for_each_ext_boolean(i, tp) { - const char *capname = ExtBoolname(tp, i, boolcodes); -- if (same_tcname(id, capname)) { -+ if (same_tcname(id, capname) && ValidExt(capname)) { - j = i; - break; - } -@@ -274,10 +285,10 @@ - NCURSES_SP_NAME(tgetnum) (NCURSES_SP_DCLx NCURSES_CONST char *id) - { - int result = ABSENT_NUMERIC; -- int i, j; -+ int j = -1; - - T((T_CALLED("tgetnum(%p, %s)"), (void *) SP_PARM, id)); -- if (HasTInfoTerminal(SP_PARM)) { -+ if (HasTInfoTerminal(SP_PARM) && ValidCap(id)) { - TERMTYPE *tp = &(TerminalOf(SP_PARM)->type); - struct name_table_entry const *entry_ptr; - -@@ -287,10 +298,10 @@ - } - #if NCURSES_XNAMES - else { -- j = -1; -+ int i; - for_each_ext_number(i, tp) { - const char *capname = ExtNumname(tp, i, numcodes); -- if (same_tcname(id, capname)) { -+ if (same_tcname(id, capname) && ValidExt(capname)) { - j = i; - break; - } -@@ -326,10 +337,10 @@ - NCURSES_SP_NAME(tgetstr) (NCURSES_SP_DCLx NCURSES_CONST char *id, char **area) - { - char *result = NULL; -- int i, j; -+ int j = -1; - - T((T_CALLED("tgetstr(%s,%p)"), id, (void *) area)); -- if (HasTInfoTerminal(SP_PARM)) { -+ if (HasTInfoTerminal(SP_PARM) && ValidCap(id)) { - TERMTYPE *tp = &(TerminalOf(SP_PARM)->type); - struct name_table_entry const *entry_ptr; - -@@ -339,10 +350,10 @@ - } - #if NCURSES_XNAMES - else { -- j = -1; -+ int i; - for_each_ext_string(i, tp) { - const char *capname = ExtStrname(tp, i, strcodes); -- if (same_tcname(id, capname)) { -+ if (same_tcname(id, capname) && ValidExt(capname)) { - j = i; - break; - } -@@ -351,7 +362,7 @@ - #endif - if (j >= 0) { - result = tp->Strings[j]; -- TR(TRACE_DATABASE, ("found match : %s", _nc_visbuf(result))); -+ TR(TRACE_DATABASE, ("found match %d: %s", j, _nc_visbuf(result))); - /* setupterm forces canceled strings to null */ - if (VALID_STRING(result)) { - if (result == exit_attribute_mode -@@ -361,7 +372,7 @@ - } - if (area != 0 - && *area != 0) { -- (void) strcpy(*area, result); -+ _nc_STRCPY(*area, result, 1024); - result = *area; - *area += strlen(*area) + 1; - } -diff -Naur ncurses-5.9/ncurses/tinfo/lib_tgoto.c ncurses-5.9.patch/ncurses/tinfo/lib_tgoto.c ---- ncurses-5.9/ncurses/tinfo/lib_tgoto.c 2008-08-16 21:29:32.000000000 +0200 -+++ ncurses-5.9.patch/ncurses/tinfo/lib_tgoto.c 2014-09-01 16:33:22.423792234 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 2000-2006,2008 Free Software Foundation, Inc. * -+ * Copyright (c) 2000-2008,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -35,7 +35,7 @@ - #include <ctype.h> - #include <termcap.h> - --MODULE_ID("$Id: lib_tgoto.c,v 1.13 2008/08/16 19:29:32 tom Exp $") -+MODULE_ID("$Id: lib_tgoto.c,v 1.16 2012/02/24 02:08:08 tom Exp $") - - #if !PURE_TERMINFO - static bool -@@ -159,7 +159,8 @@ - break; - } - if (fmt != 0) { -- sprintf(result + used, fmt, *value++); -+ _nc_SPRINTF(result + used, _nc_SLIMIT(length - used) -+ fmt, *value++); - used += strlen(result + used); - fmt = 0; - } -@@ -174,7 +175,7 @@ - } - if (result != 0) { - if (need_BC) { -- strcpy(result + used, BC); -+ _nc_STRCPY(result + used, BC, length - used); - used += strlen(BC); - } - result[used] = '\0'; -diff -Naur ncurses-5.9/ncurses/tinfo/lib_ti.c ncurses-5.9.patch/ncurses/tinfo/lib_ti.c ---- ncurses-5.9/ncurses/tinfo/lib_ti.c 2010-01-23 18:57:43.000000000 +0100 -+++ ncurses-5.9.patch/ncurses/tinfo/lib_ti.c 2014-09-01 16:33:22.423792234 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2010,2013 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -36,7 +36,7 @@ - - #include <tic.h> - --MODULE_ID("$Id: lib_ti.c,v 1.29 2010/01/23 17:57:43 tom Exp $") -+MODULE_ID("$Id: lib_ti.c,v 1.30 2013/06/08 16:55:05 tom Exp $") - - #if 0 - static bool -@@ -53,7 +53,7 @@ - NCURSES_SP_NAME(tigetflag) (NCURSES_SP_DCLx NCURSES_CONST char *str) - { - int result = ABSENT_BOOLEAN; -- int i, j; -+ int j = -1; - - T((T_CALLED("tigetflag(%p, %s)"), (void *) SP_PARM, str)); - -@@ -67,7 +67,7 @@ - } - #if NCURSES_XNAMES - else { -- j = -1; -+ int i; - for_each_ext_boolean(i, tp) { - const char *capname = ExtBoolname(tp, i, boolnames); - if (same_name(str, capname)) { -@@ -97,7 +97,7 @@ - NCURSES_EXPORT(int) - NCURSES_SP_NAME(tigetnum) (NCURSES_SP_DCLx NCURSES_CONST char *str) - { -- int i, j; -+ int j = -1; - int result = CANCELLED_NUMERIC; /* Solaris returns a -1 on error */ - - T((T_CALLED("tigetnum(%p, %s)"), (void *) SP_PARM, str)); -@@ -112,7 +112,7 @@ - } - #if NCURSES_XNAMES - else { -- j = -1; -+ int i; - for_each_ext_number(i, tp) { - const char *capname = ExtNumname(tp, i, numnames); - if (same_name(str, capname)) { -@@ -145,7 +145,7 @@ - NCURSES_SP_NAME(tigetstr) (NCURSES_SP_DCLx NCURSES_CONST char *str) - { - char *result = CANCELLED_STRING; -- int i, j; -+ int j = -1; - - T((T_CALLED("tigetstr(%p, %s)"), (void *) SP_PARM, str)); - -@@ -159,7 +159,7 @@ - } - #if NCURSES_XNAMES - else { -- j = -1; -+ int i; - for_each_ext_string(i, tp) { - const char *capname = ExtStrname(tp, i, strnames); - if (same_name(str, capname)) { -diff -Naur ncurses-5.9/ncurses/tinfo/lib_tparm.c ncurses-5.9.patch/ncurses/tinfo/lib_tparm.c ---- ncurses-5.9/ncurses/tinfo/lib_tparm.c 2011-01-15 23:19:12.000000000 +0100 -+++ ncurses-5.9.patch/ncurses/tinfo/lib_tparm.c 2014-09-01 16:33:22.424792236 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2010,2011 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -42,7 +42,7 @@ - #include <ctype.h> - #include <tic.h> - --MODULE_ID("$Id: lib_tparm.c,v 1.82 2011/01/15 22:19:12 tom Exp $") -+MODULE_ID("$Id: lib_tparm.c,v 1.90 2013/11/09 14:53:05 tom Exp $") - - /* - * char * -@@ -53,7 +53,7 @@ - * - * Cursor addressing and other strings requiring parame- - * ters in the terminal are described by a parameterized string -- * capability, with like escapes %x in it. For example, to -+ * capability, with escapes like %x in it. For example, to - * address the cursor, the cup capability is given, using two - * parameters: the row and column to address to. (Rows and - * columns are numbered from zero and refer to the physical -@@ -107,6 +107,7 @@ - NCURSES_EXPORT_VAR(int) _nc_tparm_err = 0; - - #define TPS(var) _nc_prescreen.tparm_state.var -+#define popcount _nc_popcount /* workaround for NetBSD 6.0 defect */ - - #if NO_LEAKS - NCURSES_EXPORT(void) -@@ -128,9 +129,7 @@ - need += TPS(out_used); - if (need > TPS(out_size)) { - TPS(out_size) = need * 2; -- TPS(out_buff) = typeRealloc(char, TPS(out_size), TPS(out_buff)); -- if (TPS(out_buff) == 0) -- _nc_err_abort(MSG_NO_MEMORY); -+ TYPE_REALLOC(char, TPS(out_size), TPS(out_buff)); - } - } - -@@ -143,7 +142,9 @@ - - get_space(s_len + 1); - -- (void) sprintf(TPS(out_buff) + TPS(out_used), fmt, s); -+ _nc_SPRINTF(TPS(out_buff) + TPS(out_used), -+ _nc_SLIMIT(TPS(out_size) - TPS(out_used)) -+ fmt, s); - TPS(out_used) += strlen(TPS(out_buff) + TPS(out_used)); - } - -@@ -153,9 +154,11 @@ - if (len < 30) - len = 30; /* actually log10(MAX_INT)+1 */ - -- get_space((unsigned) len + 1); -+ get_space((size_t) len + 1); - -- (void) sprintf(TPS(out_buff) + TPS(out_used), fmt, number); -+ _nc_SPRINTF(TPS(out_buff) + TPS(out_used), -+ _nc_SLIMIT(TPS(out_size) - TPS(out_used)) -+ fmt, number); - TPS(out_used) += strlen(TPS(out_buff) + TPS(out_used)); - } - -@@ -164,7 +167,7 @@ - { - if (c == 0) - c = 0200; -- get_space(1); -+ get_space((size_t) 1); - TPS(out_buff)[TPS(out_used)++] = (char) c; - } - -@@ -450,7 +453,7 @@ - } - - static NCURSES_INLINE char * --tparam_internal(bool use_TPARM_ARG, const char *string, va_list ap) -+tparam_internal(int use_TPARM_ARG, const char *string, va_list ap) - { - char *p_is_s[NUM_PARM]; - TPARM_ARG param[NUM_PARM]; -@@ -522,7 +525,7 @@ - } - #ifdef TRACE - if (USE_TRACEF(TRACE_CALLS)) { -- for (i = 0; i < popcount; i++) { -+ for (i = 0; i < num_args; i++) { - if (p_is_s[i] != 0) - save_text(", %s", _nc_visbuf(p_is_s[i]), 0); - else -@@ -559,7 +562,7 @@ - break; - - case 'l': -- save_number("%d", (int) strlen(spop()), 0); -+ npush((int) strlen(spop())); - break; - - case 's': -@@ -757,7 +760,7 @@ - cp++; - } /* endwhile (*cp) */ - -- get_space(1); -+ get_space((size_t) 1); - TPS(out_buff)[TPS(out_used)] = '\0'; - - T((T_RETURN("%s"), _nc_visbuf(TPS(out_buff)))); -diff -Naur ncurses-5.9/ncurses/tinfo/lib_tputs.c ncurses-5.9.patch/ncurses/tinfo/lib_tputs.c ---- ncurses-5.9/ncurses/tinfo/lib_tputs.c 2010-12-20 01:42:50.000000000 +0100 -+++ ncurses-5.9.patch/ncurses/tinfo/lib_tputs.c 2014-09-01 16:33:22.424792236 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -51,7 +51,7 @@ - #include <termcap.h> /* ospeed */ - #include <tic.h> - --MODULE_ID("$Id: lib_tputs.c,v 1.81 2010/12/20 00:42:50 tom Exp $") -+MODULE_ID("$Id: lib_tputs.c,v 1.93 2013/01/12 20:57:32 tom Exp $") - - NCURSES_EXPORT_VAR(char) PC = 0; /* used by termcap library */ - NCURSES_EXPORT_VAR(NCURSES_OSPEED) ospeed = 0; /* used by termcap library */ -@@ -119,7 +119,17 @@ - NCURSES_EXPORT(void) - NCURSES_SP_NAME(_nc_flush) (NCURSES_SP_DCL0) - { -- (void) fflush(NC_OUTPUT(SP_PARM)); -+ if (SP_PARM != 0 && SP_PARM->_ofd >= 0) { -+ if (SP_PARM->out_inuse) { -+ size_t amount = SP->out_inuse; -+ /* -+ * Help a little, if the write is interrupted, by first resetting -+ * our amount. -+ */ -+ SP->out_inuse = 0; -+ IGNORE_RC(write(SP_PARM->_ofd, SP_PARM->out_buffer, amount)); -+ } -+ } - } - - #if NCURSES_SP_FUNCS -@@ -138,17 +148,23 @@ - COUNT_OUTCHARS(1); - - if (HasTInfoTerminal(SP_PARM) -- && SP_PARM != 0 -- && SP_PARM->_cleanup) { -- char tmp = (char) ch; -- /* -- * POSIX says write() is safe in a signal handler, but the -- * buffered I/O is not. -- */ -- if (write(fileno(NC_OUTPUT(SP_PARM)), &tmp, 1) == -1) -- rc = ERR; -+ && SP_PARM != 0) { -+ if (SP_PARM->out_buffer != 0) { -+ if (SP_PARM->out_inuse + 1 >= SP_PARM->out_limit) -+ NCURSES_SP_NAME(_nc_flush) (NCURSES_SP_ARG); -+ SP_PARM->out_buffer[SP_PARM->out_inuse++] = (char) ch; -+ } else { -+ char tmp = (char) ch; -+ /* -+ * POSIX says write() is safe in a signal handler, but the -+ * buffered I/O is not. -+ */ -+ if (write(fileno(NC_OUTPUT(SP_PARM)), &tmp, (size_t) 1) == -1) -+ rc = ERR; -+ } - } else { -- if (putc(ch, NC_OUTPUT(SP_PARM)) == EOF) -+ char tmp = (char) ch; -+ if (write(fileno(stdout), &tmp, (size_t) 1) == -1) - rc = ERR; - } - return rc; -@@ -162,13 +178,48 @@ - } - #endif - -+/* -+ * This is used for the putp special case. -+ */ -+NCURSES_EXPORT(int) -+NCURSES_SP_NAME(_nc_putchar) (NCURSES_SP_DCLx int ch) -+{ -+ (void) SP_PARM; -+ return putchar(ch); -+} -+ -+#if NCURSES_SP_FUNCS -+NCURSES_EXPORT(int) -+_nc_putchar(int ch) -+{ -+ return putchar(ch); -+} -+#endif -+ -+/* -+ * putp is special - per documentation it calls tputs with putchar as the -+ * parameter for outputting characters. This means that it uses stdio, which -+ * is not signal-safe. Applications call this entrypoint; we do not call it -+ * from within the library. -+ */ - NCURSES_EXPORT(int) - NCURSES_SP_NAME(putp) (NCURSES_SP_DCLx const char *string) - { - return NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx -- string, 1, NCURSES_SP_NAME(_nc_outch)); -+ string, 1, NCURSES_SP_NAME(_nc_putchar)); - } - -+#if NCURSES_SP_FUNCS -+NCURSES_EXPORT(int) -+putp(const char *string) -+{ -+ return NCURSES_SP_NAME(putp) (CURRENT_SCREEN, string); -+} -+#endif -+ -+/* -+ * Use these entrypoints rather than "putp" within the library. -+ */ - NCURSES_EXPORT(int) - NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_DCLx - const char *name GCC_UNUSED, -@@ -178,19 +229,14 @@ - - if (string != 0) { - TPUTS_TRACE(name); -- rc = NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx string); -+ rc = NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx -+ string, 1, NCURSES_SP_NAME(_nc_outch)); - } - return rc; - } - - #if NCURSES_SP_FUNCS - NCURSES_EXPORT(int) --putp(const char *string) --{ -- return NCURSES_SP_NAME(putp) (CURRENT_SCREEN, string); --} -- --NCURSES_EXPORT(int) - _nc_putp(const char *name, const char *string) - { - return NCURSES_SP_NAME(_nc_putp) (CURRENT_SCREEN, name, string); -@@ -216,9 +262,9 @@ - - if (USE_TRACEF(TRACE_TPUTS)) { - if (outc == NCURSES_SP_NAME(_nc_outch)) -- (void) strcpy(addrbuf, "_nc_outch"); -+ _nc_STRCPY(addrbuf, "_nc_outch", sizeof(addrbuf)); - else -- (void) sprintf(addrbuf, "%p", outc); -+ _nc_SPRINTF(addrbuf, _nc_SLIMIT(sizeof(addrbuf)) "%p", outc); - if (_nc_tputs_trace) { - _tracef("tputs(%s = %s, %d, %s) called", _nc_tputs_trace, - _nc_visbuf(string), affcnt, addrbuf); -diff -Naur ncurses-5.9/ncurses/tinfo/lib_ttyflags.c ncurses-5.9.patch/ncurses/tinfo/lib_ttyflags.c ---- ncurses-5.9/ncurses/tinfo/lib_ttyflags.c 2010-12-26 00:43:58.000000000 +0100 -+++ ncurses-5.9.patch/ncurses/tinfo/lib_ttyflags.c 2014-09-01 16:33:22.452792282 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2012,2014 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -41,7 +41,7 @@ - #define CUR SP_TERMTYPE - #endif - --MODULE_ID("$Id: lib_ttyflags.c,v 1.27 2010/12/25 23:43:58 tom Exp $") -+MODULE_ID("$Id: lib_ttyflags.c,v 1.29 2014/03/08 20:32:59 tom Exp $") - - NCURSES_EXPORT(int) - NCURSES_SP_NAME(_nc_get_tty_mode) (NCURSES_SP_DCLx TTY * buf) -@@ -57,7 +57,7 @@ - result = ERR; - } else { - #ifdef USE_TERM_DRIVER -- result = CallDriver_2(SP_PARM, sgmode, FALSE, buf); -+ result = CallDriver_2(SP_PARM, td_sgmode, FALSE, buf); - #else - for (;;) { - if (GET_TTY(termp->Filedes, buf) != 0) { -@@ -102,10 +102,14 @@ - result = ERR; - } else { - #ifdef USE_TERM_DRIVER -- result = CallDriver_2(SP_PARM, sgmode, TRUE, buf); -+ result = CallDriver_2(SP_PARM, td_sgmode, TRUE, buf); - #else - for (;;) { -- if (SET_TTY(termp->Filedes, buf) != 0) { -+ if ((SET_TTY(termp->Filedes, buf) != 0) -+#if USE_KLIBC_KBD -+ && !isatty(termp->Filedes) -+#endif -+ ) { - if (errno == EINTR) - continue; - if ((errno == ENOTTY) && (SP_PARM != 0)) -@@ -141,7 +145,7 @@ - - if (termp != 0) { - #ifdef USE_TERM_DRIVER -- rc = CallDriver_2(SP_PARM, mode, FALSE, TRUE); -+ rc = CallDriver_2(SP_PARM, td_mode, FALSE, TRUE); - #else - /* - * If XTABS was on, remove the tab and backtab capabilities. -@@ -179,7 +183,7 @@ - - if (termp != 0) { - #ifdef USE_TERM_DRIVER -- rc = CallDriver_2(SP_PARM, mode, TRUE, TRUE); -+ rc = CallDriver_2(SP_PARM, td_mode, TRUE, TRUE); - #else - /* - * Turn off the XTABS bit in the tty structure if it was on. -@@ -215,13 +219,12 @@ - - if (termp != 0) { - #ifdef USE_TERM_DRIVER -- rc = CallDriver_2(SP_PARM, mode, TRUE, FALSE); -+ rc = CallDriver_2(SP_PARM, td_mode, TRUE, FALSE); - #else - if (_nc_set_tty_mode(&termp->Nttyb) == OK) { - if (SP_PARM) { - if (SP_PARM->_keypad_on) - _nc_keypad(SP_PARM, TRUE); -- NC_BUFFERED(SP_PARM, TRUE); - } - rc = OK; - } -@@ -248,12 +251,11 @@ - - if (termp != 0) { - #ifdef USE_TERM_DRIVER -- rc = CallDriver_2(SP_PARM, mode, FALSE, FALSE); -+ rc = CallDriver_2(SP_PARM, td_mode, FALSE, FALSE); - #else - if (SP_PARM) { - _nc_keypad(SP_PARM, FALSE); - _nc_flush(); -- NC_BUFFERED(SP_PARM, FALSE); - } - rc = _nc_set_tty_mode(&termp->Ottyb); - #endif -diff -Naur ncurses-5.9/ncurses/tinfo/make_hash.c ncurses-5.9.patch/ncurses/tinfo/make_hash.c ---- ncurses-5.9/ncurses/tinfo/make_hash.c 2010-05-22 20:02:50.000000000 +0200 -+++ ncurses-5.9.patch/ncurses/tinfo/make_hash.c 2014-09-01 16:33:22.452792282 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -44,7 +44,7 @@ - - #include <ctype.h> - --MODULE_ID("$Id: make_hash.c,v 1.3 2010/05/22 18:02:50 tom Exp $") -+MODULE_ID("$Id: make_hash.c,v 1.13 2013/09/28 20:55:47 tom Exp $") - - /* - * _nc_make_hash_table() -@@ -59,6 +59,24 @@ - #define MODULE_ID(id) /*nothing */ - #include <tinfo/doalloc.c> - -+static void -+failed(const char *s) -+{ -+ perror(s); -+ exit(EXIT_FAILURE); -+} -+ -+static char * -+strmalloc(char *s) -+{ -+ size_t need = strlen(s) + 1; -+ char *result = malloc(need); -+ if (result == 0) -+ failed("strmalloc"); -+ _nc_STRCPY(result, s, need); -+ return result; -+} -+ - /* - * int hash_function(string) - * -@@ -119,6 +137,18 @@ - - #define MAX_COLUMNS BUFSIZ /* this _has_ to be worst-case */ - -+static int -+count_columns(char **list) -+{ -+ int result = 0; -+ if (list != 0) { -+ while (*list++) { -+ ++result; -+ } -+ } -+ return result; -+} -+ - static char ** - parse_columns(char *buffer) - { -@@ -126,7 +156,7 @@ - - int col = 0; - -- if (list == 0 && (list = typeCalloc(char *, MAX_COLUMNS)) == 0) -+ if (list == 0 && (list = typeCalloc(char *, (MAX_COLUMNS + 1))) == 0) - return (0); - - if (*buffer != '#') { -@@ -201,8 +231,15 @@ - list = parse_columns(buffer); - if (list == 0) /* blank or comment */ - continue; -+ if (column > count_columns(list)) { -+ fprintf(stderr, "expected %d columns, have %d:\n%s\n", -+ column, -+ count_columns(list), -+ buffer); -+ exit(EXIT_FAILURE); -+ } - name_table[n].nte_link = -1; /* end-of-hash */ -- name_table[n].nte_name = strdup(list[column]); -+ name_table[n].nte_name = strmalloc(list[column]); - if (!strcmp(list[2], "bool")) { - name_table[n].nte_type = BOOLEAN; - name_table[n].nte_index = BoolCount++; -@@ -256,13 +293,12 @@ - printf("static struct name_table_entry *_nc_%s_table = 0;\n\n", root_name); - } else { - -- printf("static struct name_table_entry %s _nc_%s_table[] =\n", -- bigstring ? "" : "const", -+ printf("static struct name_table_entry const _nc_%s_table[] =\n", - root_name); - printf("{\n"); - for (n = 0; n < CAPTABSIZE; n++) { -- sprintf(buffer, "\"%s\"", -- name_table[n].nte_name); -+ _nc_SPRINTF(buffer, _nc_SLIMIT(sizeof(buffer)) "\"%s\"", -+ name_table[n].nte_name); - printf("\t{ %15s,\t%10s,\t%3d, %3d }%c\n", - buffer, - typenames[name_table[n].nte_type], -diff -Naur ncurses-5.9/ncurses/tinfo/make_keys.c ncurses-5.9.patch/ncurses/tinfo/make_keys.c ---- ncurses-5.9/ncurses/tinfo/make_keys.c 2010-06-06 00:08:00.000000000 +0200 -+++ ncurses-5.9.patch/ncurses/tinfo/make_keys.c 2014-09-01 16:33:22.452792282 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2008,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2010,2011 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -39,7 +39,7 @@ - #define USE_TERMLIB 1 - #include <build.priv.h> - --MODULE_ID("$Id: make_keys.c,v 1.19 2010/06/05 22:08:00 tom Exp $") -+MODULE_ID("$Id: make_keys.c,v 1.20 2011/10/22 16:34:50 tom Exp $") - - #include <names.c> - -@@ -76,7 +76,7 @@ - unsigned maxlen = 16; - int scanned; - -- while (fgets(buffer, sizeof(buffer), ifp) != 0) { -+ while (fgets(buffer, (int) sizeof(buffer), ifp) != 0) { - if (*buffer == '#') - continue; - -diff -Naur ncurses-5.9/ncurses/tinfo/MKcaptab.sh ncurses-5.9.patch/ncurses/tinfo/MKcaptab.sh ---- ncurses-5.9/ncurses/tinfo/MKcaptab.sh 2010-12-26 00:43:58.000000000 +0100 -+++ ncurses-5.9.patch/ncurses/tinfo/MKcaptab.sh 2014-09-01 16:33:22.419792227 +0200 -@@ -1,6 +1,6 @@ - #!/bin/sh - ############################################################################## --# Copyright (c) 2007-2009,2010 Free Software Foundation, Inc. # -+# Copyright (c) 2007-2010,2011 Free Software Foundation, Inc. # - # # - # Permission is hereby granted, free of charge, to any person obtaining a # - # copy of this software and associated documentation files (the "Software"), # -@@ -26,7 +26,7 @@ - # use or other dealings in this Software without prior written # - # authorization. # - ############################################################################## --# $Id: MKcaptab.sh,v 1.13 2010/12/25 23:43:58 tom Exp $ -+# $Id: MKcaptab.sh,v 1.14 2011/10/22 16:34:50 tom Exp $ - AWK=${1-awk} - OPT1=${2-0} - OPT2=${3-tinfo/MKcaptab.awk} -@@ -99,12 +99,12 @@ - _nc_build_alias(struct alias **actual, - const alias_table_data *source, - const char *strings, -- unsigned tablesize) -+ size_t tablesize) - { - if (*actual == 0) { - *actual = typeCalloc(struct alias, tablesize + 1); - if (*actual != 0) { -- unsigned n; -+ size_t n; - for (n = 0; n < tablesize; ++n) { - add_alias(from); - add_alias(to); -@@ -178,7 +178,7 @@ - static int - compare_tcap_names(const char *a, const char *b) - { -- return !strncmp(a, b, TCAP_LEN); -+ return !strncmp(a, b, (size_t) TCAP_LEN); - } - - static int -diff -Naur ncurses-5.9/ncurses/tinfo/name_match.c ncurses-5.9.patch/ncurses/tinfo/name_match.c ---- ncurses-5.9/ncurses/tinfo/name_match.c 2008-11-16 01:19:59.000000000 +0100 -+++ ncurses-5.9.patch/ncurses/tinfo/name_match.c 2014-09-01 16:33:22.452792282 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1999-2007,2008 Free Software Foundation, Inc. * -+ * Copyright (c) 1999-2012,2013 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -33,25 +33,38 @@ - #include <curses.priv.h> - #include <tic.h> - --MODULE_ID("$Id: name_match.c,v 1.18 2008/11/16 00:19:59 juergen Exp $") -+MODULE_ID("$Id: name_match.c,v 1.23 2013/05/25 20:20:08 tom Exp $") - --/* -- * _nc_first_name(char *names) -- * -- * Extract the primary name from a compiled entry. -- */ - #define FirstName _nc_globals.first_name - -+#if NCURSES_USE_TERMCAP && NCURSES_XNAMES -+static const char * -+skip_index(const char *name) -+{ -+ if ((_nc_syntax == SYN_TERMCAP) && _nc_user_definable) { -+ const char *bar = strchr(name, '|'); -+ if (bar != 0 && (bar - name) == 2) -+ name = bar + 1; -+ } -+ return name; -+} -+#endif -+ -+/* -+ * Get the primary name from the given name list. For terminfo, this is the -+ * first name. For termcap, this may be the second name, if the first one -+ * happens to be two characters. -+ */ - NCURSES_EXPORT(char *) - _nc_first_name(const char *const sp) --/* get the first name from the given name list */ - { - unsigned n; - - #if NO_LEAKS - if (sp == 0) { -- if (FirstName != 0) -+ if (FirstName != 0) { - FreeAndNull(FirstName); -+ } - } else - #endif - { -@@ -59,8 +72,12 @@ - FirstName = typeMalloc(char, MAX_NAME_SIZE + 1); - - if (FirstName != 0) { -+ const char *src = sp; -+#if NCURSES_USE_TERMCAP && NCURSES_XNAMES -+ src = skip_index(sp); -+#endif - for (n = 0; n < MAX_NAME_SIZE; n++) { -- if ((FirstName[n] = sp[n]) == '\0' -+ if ((FirstName[n] = src[n]) == '\0' - || (FirstName[n] == '|')) - break; - } -@@ -71,11 +88,8 @@ - } - - /* -- * int _nc_name_match(namelist, name, delim) -- * -- * Is the given name matched in namelist? -+ * Is the given name matched in namelist? - */ -- - NCURSES_EXPORT(int) - _nc_name_match(const char *const namelst, const char *const name, const char *const delim) - { -diff -Naur ncurses-5.9/ncurses/tinfo/obsolete.c ncurses-5.9.patch/ncurses/tinfo/obsolete.c ---- ncurses-5.9/ncurses/tinfo/obsolete.c 1970-01-01 01:00:00.000000000 +0100 -+++ ncurses-5.9.patch/ncurses/tinfo/obsolete.c 2014-09-01 16:33:22.452792282 +0200 -@@ -0,0 +1,102 @@ -+/**************************************************************************** -+ * Copyright (c) 2013 Free Software Foundation, Inc. * -+ * * -+ * Permission is hereby granted, free of charge, to any person obtaining a * -+ * copy of this software and associated documentation files (the * -+ * "Software"), to deal in the Software without restriction, including * -+ * without limitation the rights to use, copy, modify, merge, publish, * -+ * distribute, distribute with modifications, sublicense, and/or sell * -+ * copies of the Software, and to permit persons to whom the Software is * -+ * furnished to do so, subject to the following conditions: * -+ * * -+ * The above copyright notice and this permission notice shall be included * -+ * in all copies or substantial portions of the Software. * -+ * * -+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * -+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * -+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * -+ * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * -+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * -+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * -+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * -+ * * -+ * Except as contained in this notice, the name(s) of the above copyright * -+ * holders shall not be used in advertising or otherwise to promote the * -+ * sale, use or other dealings in this Software without prior written * -+ * authorization. * -+ ****************************************************************************/ -+ -+/**************************************************************************** -+ * Author: Thomas E. Dickey 2013 * -+ ****************************************************************************/ -+ -+/* -+** Support for obsolete features. -+*/ -+ -+#include <curses.priv.h> -+ -+MODULE_ID("$Id: obsolete.c,v 1.1 2013/01/26 22:07:51 tom Exp $") -+ -+/* -+ * Obsolete entrypoint retained for binary compatbility. -+ */ -+NCURSES_EXPORT(void) -+NCURSES_SP_NAME(_nc_set_buffer) (NCURSES_SP_DCLx FILE *ofp, int buffered) -+{ -+#if NCURSES_SP_FUNCS -+ (void) SP_PARM; -+#endif -+ (void) ofp; -+ (void) buffered; -+} -+ -+#if NCURSES_SP_FUNCS -+NCURSES_EXPORT(void) -+_nc_set_buffer(FILE *ofp, int buffered) -+{ -+ NCURSES_SP_NAME(_nc_set_buffer) (CURRENT_SCREEN, ofp, buffered); -+} -+#endif -+ -+#if !HAVE_STRDUP -+NCURSES_EXPORT(char *) -+_nc_strdup(const char *s) -+{ -+ char *result = 0; -+ if (s != 0) { -+ size_t need = strlen(s); -+ result = malloc(need + 1); -+ if (result != 0) { -+ strcpy(result, s); -+ } -+ } -+ return result; -+} -+#endif -+ -+#if USE_MY_MEMMOVE -+#define DST ((char *)s1) -+#define SRC ((const char *)s2) -+NCURSES_EXPORT(void *) -+_nc_memmove(void *s1, const void *s2, size_t n) -+{ -+ if (n != 0) { -+ if ((DST + n > SRC) && (SRC + n > DST)) { -+ static char *bfr; -+ static size_t length; -+ register size_t j; -+ if (length < n) { -+ length = (n * 3) / 2; -+ bfr = typeRealloc(char, length, bfr); -+ } -+ for (j = 0; j < n; j++) -+ bfr[j] = SRC[j]; -+ s2 = bfr; -+ } -+ while (n-- != 0) -+ DST[n] = SRC[n]; -+ } -+ return s1; -+} -+#endif /* USE_MY_MEMMOVE */ -diff -Naur ncurses-5.9/ncurses/tinfo/parse_entry.c ncurses-5.9.patch/ncurses/tinfo/parse_entry.c ---- ncurses-5.9/ncurses/tinfo/parse_entry.c 2010-05-01 21:35:09.000000000 +0200 -+++ ncurses-5.9.patch/ncurses/tinfo/parse_entry.c 2014-09-01 16:33:22.452792282 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -47,7 +47,7 @@ - #include <ctype.h> - #include <tic.h> - --MODULE_ID("$Id: parse_entry.c,v 1.75 2010/05/01 19:35:09 tom Exp $") -+MODULE_ID("$Id: parse_entry.c,v 1.79 2012/10/27 21:43:45 tom Exp $") - - #ifdef LINT - static short const parametrized[] = -@@ -145,27 +145,27 @@ - case BOOLEAN: - tp->ext_Booleans++; - tp->num_Booleans++; -- tp->Booleans = typeRealloc(NCURSES_SBOOL, tp->num_Booleans, tp->Booleans); -+ TYPE_REALLOC(NCURSES_SBOOL, tp->num_Booleans, tp->Booleans); - for_each_value(tp->num_Booleans) - tp->Booleans[last] = tp->Booleans[last - 1]; - break; - case NUMBER: - tp->ext_Numbers++; - tp->num_Numbers++; -- tp->Numbers = typeRealloc(short, tp->num_Numbers, tp->Numbers); -+ TYPE_REALLOC(short, tp->num_Numbers, tp->Numbers); - for_each_value(tp->num_Numbers) - tp->Numbers[last] = tp->Numbers[last - 1]; - break; - case STRING: - tp->ext_Strings++; - tp->num_Strings++; -- tp->Strings = typeRealloc(char *, tp->num_Strings, tp->Strings); -+ TYPE_REALLOC(char *, tp->num_Strings, tp->Strings); - for_each_value(tp->num_Strings) - tp->Strings[last] = tp->Strings[last - 1]; - break; - } - actual = NUM_EXT_NAMES(tp); -- tp->ext_Names = typeRealloc(char *, actual, tp->ext_Names); -+ TYPE_REALLOC(char *, actual, tp->ext_Names); - while (--actual > offset) - tp->ext_Names[actual] = tp->ext_Names[actual - 1]; - tp->ext_Names[offset] = _nc_save_str(name); -@@ -203,6 +203,8 @@ - { bad_tc_usage = TRUE; \ - _nc_warning("Legacy termcap allows only a trailing tc= clause"); } - -+#define MAX_NUMBER 0x7fff /* positive shorts only */ -+ - NCURSES_EXPORT(int) - _nc_parse_entry(struct entry *entryp, int literal, bool silent) - { -@@ -444,8 +446,12 @@ - break; - - case NUMBER: -- entryp->tterm.Numbers[entry_ptr->nte_index] = -- (short) _nc_curr_token.tk_valnumber; -+ if (_nc_curr_token.tk_valnumber > MAX_NUMBER) { -+ entryp->tterm.Numbers[entry_ptr->nte_index] = MAX_NUMBER; -+ } else { -+ entryp->tterm.Numbers[entry_ptr->nte_index] = -+ (short) _nc_curr_token.tk_valnumber; -+ } - break; - - case STRING: -@@ -654,14 +660,16 @@ - - if (WANTED(carriage_return)) { - if (carriage_return_delay > 0) { -- sprintf(buf, "%s$<%d>", C_CR, carriage_return_delay); -+ _nc_SPRINTF(buf, _nc_SLIMIT(sizeof(buf)) -+ "%s$<%d>", C_CR, carriage_return_delay); - carriage_return = _nc_save_str(buf); - } else - carriage_return = _nc_save_str(C_CR); - } - if (WANTED(cursor_left)) { - if (backspace_delay > 0) { -- sprintf(buf, "%s$<%d>", C_BS, backspace_delay); -+ _nc_SPRINTF(buf, _nc_SLIMIT(sizeof(buf)) -+ "%s$<%d>", C_BS, backspace_delay); - cursor_left = _nc_save_str(buf); - } else if (backspaces_with_bs == 1) - cursor_left = _nc_save_str(C_BS); -@@ -674,7 +682,8 @@ - cursor_down = linefeed_if_not_lf; - else if (linefeed_is_newline != 1) { - if (new_line_delay > 0) { -- sprintf(buf, "%s$<%d>", C_LF, new_line_delay); -+ _nc_SPRINTF(buf, _nc_SLIMIT(sizeof(buf)) -+ "%s$<%d>", C_LF, new_line_delay); - cursor_down = _nc_save_str(buf); - } else - cursor_down = _nc_save_str(C_LF); -@@ -685,7 +694,8 @@ - cursor_down = linefeed_if_not_lf; - else if (linefeed_is_newline != 1) { - if (new_line_delay > 0) { -- sprintf(buf, "%s$<%d>", C_LF, new_line_delay); -+ _nc_SPRINTF(buf, _nc_SLIMIT(sizeof(buf)) -+ "%s$<%d>", C_LF, new_line_delay); - scroll_forward = _nc_save_str(buf); - } else - scroll_forward = _nc_save_str(C_LF); -@@ -694,7 +704,8 @@ - if (WANTED(newline)) { - if (linefeed_is_newline == 1) { - if (new_line_delay > 0) { -- sprintf(buf, "%s$<%d>", C_LF, new_line_delay); -+ _nc_SPRINTF(buf, _nc_SLIMIT(sizeof(buf)) -+ "%s$<%d>", C_LF, new_line_delay); - newline = _nc_save_str(buf); - } else - newline = _nc_save_str(C_LF); -@@ -736,7 +747,8 @@ - */ - if (WANTED(tab)) { - if (horizontal_tab_delay > 0) { -- sprintf(buf, "%s$<%d>", C_HT, horizontal_tab_delay); -+ _nc_SPRINTF(buf, _nc_SLIMIT(sizeof(buf)) -+ "%s$<%d>", C_HT, horizontal_tab_delay); - tab = _nc_save_str(buf); - } else - tab = _nc_save_str(C_HT); -diff -Naur ncurses-5.9/ncurses/tinfo/read_entry.c ncurses-5.9.patch/ncurses/tinfo/read_entry.c ---- ncurses-5.9/ncurses/tinfo/read_entry.c 2011-02-26 16:36:06.000000000 +0100 -+++ ncurses-5.9.patch/ncurses/tinfo/read_entry.c 2014-09-01 16:33:22.453792284 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2010,2011 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2013,2014 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -41,11 +41,11 @@ - - #include <tic.h> - --MODULE_ID("$Id: read_entry.c,v 1.108 2011/02/26 15:36:06 tom Exp $") -+MODULE_ID("$Id: read_entry.c,v 1.127 2014/03/08 22:07:31 Xin.Li Exp $") - - #define TYPE_CALLOC(type,elts) typeCalloc(type, (unsigned)(elts)) - --#if USE_DATABASE -+#if NCURSES_USE_DATABASE - static void - convert_shorts(char *buf, short *Numbers, int count) - { -@@ -99,7 +99,7 @@ - if (have > 0) { - if ((int) want > have) - want = (unsigned) have; -- memcpy(dst, src + *offset, want); -+ memcpy(dst, src + *offset, (size_t) want); - *offset += (int) want; - } else { - want = 0; -@@ -107,22 +107,56 @@ - return (int) want; - } - --#define Read(buf, count) fake_read(buffer, &offset, limit, buf, count) -+#define Read(buf, count) fake_read(buffer, &offset, limit, (char *) buf, (unsigned) count) - - #define read_shorts(buf, count) \ -- (Read(buf, (unsigned) (count)*2) == (int) (count)*2) -+ (Read(buf, (count)*2) == (int) (count)*2) - - #define even_boundary(value) \ - if ((value) % 2 != 0) Read(buf, 1) -+#endif -+ -+NCURSES_EXPORT(void) -+_nc_init_termtype(TERMTYPE *const tp) -+{ -+ unsigned i; -+ -+#if NCURSES_XNAMES -+ tp->num_Booleans = BOOLCOUNT; -+ tp->num_Numbers = NUMCOUNT; -+ tp->num_Strings = STRCOUNT; -+ tp->ext_Booleans = 0; -+ tp->ext_Numbers = 0; -+ tp->ext_Strings = 0; -+#endif -+ if (tp->Booleans == 0) -+ TYPE_MALLOC(NCURSES_SBOOL, BOOLCOUNT, tp->Booleans); -+ if (tp->Numbers == 0) -+ TYPE_MALLOC(short, NUMCOUNT, tp->Numbers); -+ if (tp->Strings == 0) -+ TYPE_MALLOC(char *, STRCOUNT, tp->Strings); -+ -+ for_each_boolean(i, tp) -+ tp->Booleans[i] = FALSE; -+ -+ for_each_number(i, tp) -+ tp->Numbers[i] = ABSENT_NUMERIC; - -+ for_each_string(i, tp) -+ tp->Strings[i] = ABSENT_STRING; -+} -+ -+#if NCURSES_USE_DATABASE -+/* -+ * Return TGETENT_YES if read, TGETENT_NO if not found or garbled. -+ */ - NCURSES_EXPORT(int) - _nc_read_termtype(TERMTYPE *ptr, char *buffer, int limit) --/* return 1 if read, 0 if not found or garbled */ - { - int offset = 0; - int name_size, bool_count, num_count, str_count, str_size; - int i; -- char buf[MAX_ENTRY_SIZE + 1]; -+ char buf[MAX_ENTRY_SIZE + 2]; - char *string_table; - unsigned want, have; - -@@ -157,7 +191,7 @@ - want = (unsigned) (str_size + name_size + 1); - if (str_size) { - /* try to allocate space for the string table */ -- if (str_count * 2 >= (int) sizeof(buf) -+ if (str_count * 2 >= MAX_ENTRY_SIZE - || (string_table = typeMalloc(char, want)) == 0) { - return (TGETENT_NO); - } -@@ -173,7 +207,7 @@ - ptr->str_table = string_table; - ptr->term_names = string_table; - if ((have = (unsigned) Read(ptr->term_names, want)) != want) { -- memset(ptr->term_names + have, 0, want - have); -+ memset(ptr->term_names + have, 0, (size_t) (want - have)); - } - ptr->term_names[want] = '\0'; - string_table += (want + 1); -@@ -236,9 +270,9 @@ - unsigned need = (unsigned) (ext_bool_count + ext_num_count + ext_str_count); - int base = 0; - -- if (need >= sizeof(buf) -- || ext_str_size >= (int) sizeof(buf) -- || ext_str_limit >= (int) sizeof(buf) -+ if (need >= (MAX_ENTRY_SIZE / 2) -+ || ext_str_size >= MAX_ENTRY_SIZE -+ || ext_str_limit >= MAX_ENTRY_SIZE - || ext_bool_count < 0 - || ext_num_count < 0 - || ext_str_count < 0 -@@ -250,9 +284,9 @@ - ptr->num_Numbers = UShort(NUMCOUNT + ext_num_count); - ptr->num_Strings = UShort(STRCOUNT + ext_str_count); - -- ptr->Booleans = typeRealloc(NCURSES_SBOOL, ptr->num_Booleans, ptr->Booleans); -- ptr->Numbers = typeRealloc(short, ptr->num_Numbers, ptr->Numbers); -- ptr->Strings = typeRealloc(char *, ptr->num_Strings, ptr->Strings); -+ TYPE_REALLOC(NCURSES_SBOOL, ptr->num_Booleans, ptr->Booleans); -+ TYPE_REALLOC(short, ptr->num_Numbers, ptr->Numbers); -+ TYPE_REALLOC(char *, ptr->num_Strings, ptr->Strings); - - TR(TRACE_DATABASE, ("extended header is %d/%d/%d(%d:%d)", - ext_bool_count, ext_num_count, ext_str_count, -@@ -277,6 +311,8 @@ - } - - TR(TRACE_DATABASE, ("READ extended-offsets @%d", offset)); -+ if ((unsigned) (ext_str_count + (int) need) >= (MAX_ENTRY_SIZE / 2)) -+ return (TGETENT_NO); - if ((ext_str_count || need) - && !read_shorts(buf, ext_str_count + (int) need)) - return (TGETENT_NO); -@@ -313,7 +349,7 @@ - } - - if (need) { -- if (ext_str_count >= (MAX_ENTRY_SIZE * 2)) -+ if (ext_str_count >= (MAX_ENTRY_SIZE / 2)) - return (TGETENT_NO); - if ((ptr->ext_Names = TYPE_CALLOC(char *, need)) == 0) - return (TGETENT_NO); -@@ -326,17 +362,18 @@ - ext_str_limit, ptr->ext_str_table + base); - } - -- T(("...done reading terminfo bool %d(%d) num %d(%d) str %d(%d)", -- ptr->num_Booleans, ptr->ext_Booleans, -- ptr->num_Numbers, ptr->ext_Numbers, -- ptr->num_Strings, ptr->ext_Strings)); -+ TR(TRACE_DATABASE, -+ ("...done reading terminfo bool %d(%d) num %d(%d) str %d(%d)", -+ ptr->num_Booleans, ptr->ext_Booleans, -+ ptr->num_Numbers, ptr->ext_Numbers, -+ ptr->num_Strings, ptr->ext_Strings)); - - TR(TRACE_DATABASE, ("extend: num_Booleans:%d", ptr->num_Booleans)); - } else - #endif /* NCURSES_XNAMES */ - { -- T(("...done reading terminfo bool %d num %d str %d", -- bool_count, num_count, str_count)); -+ TR(TRACE_DATABASE, ("...done reading terminfo bool %d num %d str %d", -+ bool_count, num_count, str_count)); - #if NCURSES_XNAMES - TR(TRACE_DATABASE, ("normal: num_Booleans:%d", ptr->num_Booleans)); - #endif -@@ -371,13 +408,13 @@ - - if (_nc_access(filename, R_OK) < 0 - || (fp = fopen(filename, "rb")) == 0) { -- T(("cannot open terminfo %s (errno=%d)", filename, errno)); -+ TR(TRACE_DATABASE, ("cannot open terminfo %s (errno=%d)", filename, errno)); - code = TGETENT_NO; - } else { - if ((limit = (int) fread(buffer, sizeof(char), sizeof(buffer), fp)) - > 0) { - -- T(("read terminfo %s", filename)); -+ TR(TRACE_DATABASE, ("read terminfo %s", filename)); - if ((code = _nc_read_termtype(ptr, buffer, limit)) == TGETENT_NO) { - _nc_free_termtype(ptr); - } -@@ -390,6 +427,58 @@ - return (code); - } - -+#if USE_HASHED_DB -+/* -+ * Return if if we can build the filename of a ".db" file. -+ */ -+static bool -+make_db_filename(char *filename, unsigned limit, const char *const path) -+{ -+ static const char suffix[] = DBM_SUFFIX; -+ -+ size_t lens = sizeof(suffix) - 1; -+ size_t size = strlen(path); -+ size_t test = lens + size; -+ bool result = FALSE; -+ -+ if (test < limit) { -+ if (size >= lens -+ && !strcmp(path + size - lens, suffix)) -+ _nc_STRCPY(filename, path, limit); -+ else -+ _nc_SPRINTF(filename, _nc_SLIMIT(limit) "%s%s", path, suffix); -+ result = TRUE; -+ } -+ return result; -+} -+#endif -+ -+/* -+ * Return true if we can build the name of a filesystem entry. -+ */ -+static bool -+make_dir_filename(char *filename, -+ unsigned limit, -+ const char *const path, -+ const char *name) -+{ -+ bool result = FALSE; -+ -+#if NCURSES_USE_TERMCAP -+ if (_nc_is_dir_path(path)) -+#endif -+ { -+ unsigned need = (unsigned) (LEAF_LEN + 3 + strlen(path) + strlen(name)); -+ -+ if (need <= limit) { -+ _nc_SPRINTF(filename, _nc_SLIMIT(limit) -+ "%s/" LEAF_FMT "/%s", path, *name, name); -+ result = TRUE; -+ } -+ } -+ return result; -+} -+ - /* - * Build a terminfo pathname and try to read the data. Returns TGETENT_YES on - * success, TGETENT_NO on failure. -@@ -401,103 +490,82 @@ - const char *name, - TERMTYPE *const tp) - { -- int result = TGETENT_NO; -- -- /* -- * If we are looking in a directory, assume the entry is a file under that, -- * according to the normal rules. -- */ -- unsigned need = (unsigned) (LEAF_LEN + 3 + strlen(path) + strlen(name)); -- if (need <= limit) -- (void) sprintf(filename, "%s/" LEAF_FMT "/%s", path, *name, name); -+ int code = TGETENT_NO; - -- if (_nc_is_dir_path(path)) -- result = _nc_read_file_entry(filename, tp); - #if USE_HASHED_DB -- else { -- static const char suffix[] = DBM_SUFFIX; -- DB *capdbp; -- unsigned lens = sizeof(suffix) - 1; -- unsigned size = strlen(path); -- unsigned test = lens + size; -- -- if (test < limit) { -- if (size >= lens -- && !strcmp(path + size - lens, suffix)) -- (void) strcpy(filename, path); -- else -- (void) sprintf(filename, "%s%s", path, suffix); -+ DB *capdbp; - -- /* -- * It would be nice to optimize the dbopen/close activity, as -- * done in the cgetent implementation for tc= clauses. However, -- * since we support multiple database locations, we cannot do -- * that. -- */ -- if ((capdbp = _nc_db_open(filename, FALSE)) != 0) { -- DBT key, data; -- int reccnt = 0; -- char *save = strdup(name); -- -- memset(&key, 0, sizeof(key)); -- key.data = save; -- key.size = strlen(save); -- -- /* -- * This lookup could return termcap data, which we do not want. -- * We are looking for compiled (binary) terminfo data. -- * -- * cgetent uses a two-level lookup. On the first it uses the -- * given name to return a record containing only the aliases -- * for an entry. On the second (using that list of aliases as -- * a key), it returns the content of the terminal description. -- * We expect second lookup to return data beginning with the -- * same set of aliases. -- * -- * For compiled terminfo, the list of aliases in the second -- * case will be null-terminated. A termcap entry will not be, -- * and will run on into the description. So we can easily -- * distinguish between the two (source/binary) by checking the -- * lengths. -- */ -- while (_nc_db_get(capdbp, &key, &data) == 0) { -- int used = data.size - 1; -- char *have = (char *) data.data; -- -- if (*have++ == 0) { -- if (data.size > key.size -- && IS_TIC_MAGIC(have)) { -- result = _nc_read_termtype(tp, have, used); -- if (result == TGETENT_NO) { -- _nc_free_termtype(tp); -- } -- } -- break; -- } -+ if (make_db_filename(filename, limit, path) -+ && (capdbp = _nc_db_open(filename, FALSE)) != 0) { - -- /* -- * Just in case we have a corrupt database, do not waste -- * time with it. -- */ -- if (++reccnt >= 3) -- break; -- -- /* -- * Prepare for the second level. -- */ -- key.data = have; -- key.size = used; -+ DBT key, data; -+ int reccnt = 0; -+ char *save = strdup(name); -+ -+ memset(&key, 0, sizeof(key)); -+ key.data = save; -+ key.size = strlen(save); -+ -+ /* -+ * This lookup could return termcap data, which we do not want. We are -+ * looking for compiled (binary) terminfo data. -+ * -+ * cgetent uses a two-level lookup. On the first it uses the given -+ * name to return a record containing only the aliases for an entry. -+ * On the second (using that list of aliases as a key), it returns the -+ * content of the terminal description. We expect second lookup to -+ * return data beginning with the same set of aliases. -+ * -+ * For compiled terminfo, the list of aliases in the second case will -+ * be null-terminated. A termcap entry will not be, and will run on -+ * into the description. So we can easily distinguish between the two -+ * (source/binary) by checking the lengths. -+ */ -+ while (_nc_db_get(capdbp, &key, &data) == 0) { -+ int used = (int) data.size - 1; -+ char *have = (char *) data.data; -+ -+ if (*have++ == 0) { -+ if (data.size > key.size -+ && IS_TIC_MAGIC(have)) { -+ code = _nc_read_termtype(tp, have, used); -+ if (code == TGETENT_NO) { -+ _nc_free_termtype(tp); -+ } - } -- -- _nc_db_close(capdbp); -- free(save); -+ break; - } -+ -+ /* -+ * Just in case we have a corrupt database, do not waste time with -+ * it. -+ */ -+ if (++reccnt >= 3) -+ break; -+ -+ /* -+ * Prepare for the second level. -+ */ -+ key.data = have; -+ key.size = used; - } -+ -+ free(save); -+ } else /* may be either filesystem or flat file */ -+#endif -+ if (make_dir_filename(filename, limit, path, name)) { -+ code = _nc_read_file_entry(filename, tp); -+ } -+#if NCURSES_USE_TERMCAP -+ else if (code != TGETENT_YES) { -+ code = _nc_read_termcap_entry(name, tp); -+ _nc_SPRINTF(filename, _nc_SLIMIT(PATH_MAX) -+ "%.*s", PATH_MAX - 1, _nc_get_source()); - } - #endif -- return result; -+ return code; - } --#endif /* USE_DATABASE */ -+#endif /* NCURSES_USE_DATABASE */ - - /* - * _nc_read_entry(char *name, char *filename, TERMTYPE *tp) -@@ -513,31 +581,35 @@ - { - int code = TGETENT_NO; - -- sprintf(filename, "%.*s", PATH_MAX - 1, name); -+ _nc_SPRINTF(filename, _nc_SLIMIT(PATH_MAX) -+ "%.*s", PATH_MAX - 1, name); -+ - if (strlen(name) == 0 - || strcmp(name, ".") == 0 - || strcmp(name, "..") == 0 - || _nc_pathlast(name) != 0 - || strchr(name, NCURSES_PATHSEP) != 0) { -- T(("illegal or missing entry name '%s'", name)); -+ TR(TRACE_DATABASE, ("illegal or missing entry name '%s'", name)); - } else { --#if USE_DATABASE -- DBDIRS state = dbdTIC; -- int offset = 0; -+#if NCURSES_USE_DATABASE -+ DBDIRS state; -+ int offset; - const char *path; - -+ _nc_first_db(&state, &offset); - while ((path = _nc_next_db(&state, &offset)) != 0) { -+ TR(TRACE_DATABASE, ("_nc_read_tic_entry path=%s, name=%s", path, name)); - code = _nc_read_tic_entry(filename, PATH_MAX, path, name, tp); - if (code == TGETENT_YES) { - _nc_last_db(); - break; - } - } --#endif --#if USE_TERMCAP -+#elif NCURSES_USE_TERMCAP - if (code != TGETENT_YES) { - code = _nc_read_termcap_entry(name, tp); -- sprintf(filename, "%.*s", PATH_MAX - 1, _nc_get_source()); -+ _nc_SPRINTF(filename, _nc_SLIMIT(PATH_MAX) -+ "%.*s", PATH_MAX - 1, _nc_get_source()); - } - #endif - } -diff -Naur ncurses-5.9/ncurses/tinfo/read_termcap.c ncurses-5.9.patch/ncurses/tinfo/read_termcap.c ---- ncurses-5.9/ncurses/tinfo/read_termcap.c 2010-01-23 18:57:43.000000000 +0100 -+++ ncurses-5.9.patch/ncurses/tinfo/read_termcap.c 2014-09-01 16:33:22.453792284 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -54,10 +54,9 @@ - - #include <ctype.h> - #include <sys/types.h> --#include <sys/stat.h> - #include <tic.h> - --MODULE_ID("$Id: read_termcap.c,v 1.74 2010/01/23 17:57:43 tom Exp $") -+MODULE_ID("$Id: read_termcap.c,v 1.89 2013/12/15 00:32:43 tom Exp $") - - #if !PURE_TERMINFO - -@@ -74,7 +73,7 @@ - - if (!use_terminfo_vars() || (result = getenv("TERMPATH")) == 0) - result = TERMPATH; -- T(("TERMPATH is %s", result)); -+ TR(TRACE_DATABASE, ("TERMPATH is %s", result)); - return result; - } - -@@ -162,7 +161,7 @@ - return (-1); - } - gottoprec = 0; -- (void) strcpy(toprec, ent); -+ _nc_STRCPY(toprec, ent, topreclen); - return (0); - } - -@@ -295,7 +294,7 @@ - errno = ENOMEM; - return (TC_SYS_ERR); - } -- (void) strcpy(record, toprec); -+ _nc_STRCPY(record, toprec, topreclen + BFRAG); - rp = record + topreclen + 1; - r_end = rp + BFRAG; - current = in_array; -@@ -384,7 +383,14 @@ - c = *bp++; - if (c == '\n') { - lineno++; -- if (rp == record || *(rp - 1) != '\\') -+ /* -+ * Unlike BSD 4.3, this ignores a backslash at the -+ * end of a comment-line. That makes it consistent -+ * with the rest of ncurses -TD -+ */ -+ if (rp == record -+ || *record == '#' -+ || *(rp - 1) != '\\') - break; - } - *rp++ = c; -@@ -442,8 +448,10 @@ - break; - } - -- if (!foundit) -+ if (!foundit) { -+ free(record); - return (TC_NOT_FOUND); -+ } - } - - /* -@@ -455,7 +463,7 @@ - register int newilen; - unsigned ilen; - int diff, iret, tclen, oline; -- char *icap, *scan, *tc, *tcstart, *tcend; -+ char *icap = 0, *scan, *tc, *tcstart, *tcend; - - /* - * Loop invariants: -@@ -468,8 +476,9 @@ - scan = record; - tc_not_resolved = FALSE; - for (;;) { -- if ((tc = _nc_cgetcap(scan, "tc", '=')) == 0) -+ if ((tc = _nc_cgetcap(scan, "tc", '=')) == 0) { - break; -+ } - - /* - * Find end of tc=name and stomp on the trailing `:' -@@ -486,6 +495,7 @@ - tclen = s - tcstart; - tcend = s; - -+ icap = 0; - iret = _nc_getent(&icap, &ilen, &oline, current, db_array, fd, - tc, depth + 1, 0); - newicap = icap; /* Put into a register. */ -@@ -496,12 +506,13 @@ - if (myfd) - (void) close(fd); - free(record); -+ FreeIfNeeded(icap); - return (iret); - } -- if (iret == TC_UNRESOLVED) -+ if (iret == TC_UNRESOLVED) { - tc_not_resolved = TRUE; -- /* couldn't resolve tc */ -- if (iret == TC_NOT_FOUND) { -+ /* couldn't resolve tc */ -+ } else if (iret == TC_NOT_FOUND) { - *(s - 1) = ':'; - scan = s - 1; - tc_not_resolved = TRUE; -@@ -581,8 +592,9 @@ - } - - *cap = record; -- if (tc_not_resolved) -+ if (tc_not_resolved) { - return (TC_UNRESOLVED); -+ } - return (current); - } - -@@ -697,8 +709,6 @@ - #define PVECSIZ 32 /* max number of names in path */ - #define TBUFSIZ (2048*2) - --static char *tbuf; -- - /* - * On entry, srcp points to a non ':' character which is the beginning of the - * token, if any. We'll try to return a string that doesn't end with a ':'. -@@ -760,7 +770,7 @@ - dst = 0; - break; - } -- *dst++ = ch; -+ *dst++ = (char) ch; - } - return dst; - } -@@ -776,18 +786,16 @@ - register char *p; - register char *cp; - char *dummy = NULL; -- char **fname; -+ CGETENT_CONST char **fname; - char *home; - int i; - char pathbuf[PBUFSIZ]; /* holds raw path of filenames */ -- char *pathvec[PVECSIZ]; /* to point to names in pathbuf */ -- char **pvec; /* holds usable tail of path vector */ -+ CGETENT_CONST char *pathvec[PVECSIZ]; /* point to names in pathbuf */ - NCURSES_CONST char *termpath; - string_desc desc; - -+ *lineno = 1; - fname = pathvec; -- pvec = pathvec; -- tbuf = bp; - p = pathbuf; - cp = use_terminfo_vars()? getenv("TERMCAP") : NULL; - -@@ -812,10 +820,11 @@ - if ((home = getenv("HOME")) != 0 && *home != '\0' - && strchr(home, ' ') == 0 - && strlen(home) < sizeof(temp) - 10) { /* setup path */ -- sprintf(temp, "%s/", home); /* $HOME first */ -+ _nc_SPRINTF(temp, _nc_SLIMIT(sizeof(temp)) -+ "%s/", home); /* $HOME first */ - } - /* if no $HOME look in current directory */ -- strcat(temp, ".termcap"); -+ _nc_STRCAT(temp, ".termcap", sizeof(temp)); - _nc_safe_strcat(&desc, temp); - _nc_safe_strcat(&desc, " "); - _nc_safe_strcat(&desc, get_termpath()); -@@ -841,6 +850,9 @@ - } - } - *fname = 0; /* mark end of vector */ -+#if !HAVE_BSD_CGETENT -+ (void) _nc_cgetset(0); -+#endif - if (_nc_is_abs_path(cp)) { - if (_nc_cgetset(cp) < 0) { - return (TC_SYS_ERR); -@@ -853,6 +865,7 @@ - * empty fields, and mistakenly use the last valid cap entry instead of - * the first (breaks tc= includes) - */ -+ *bp = '\0'; - if (i >= 0) { - char *pd, *ps, *tok; - int endflag = FALSE; -@@ -874,7 +887,7 @@ - } - if (ignore != TRUE) { - list[count++] = tok; -- pd = copy_tc_token(pd, tok, TBUFSIZ - (2 + pd - bp)); -+ pd = copy_tc_token(pd, tok, (size_t) (TBUFSIZ - (2 + pd - bp))); - if (pd == 0) { - i = -1; - break; -@@ -932,7 +945,7 @@ - if (count < MAXPATHS - && _nc_access(path, R_OK) == 0) { - termpaths[count++] = path; -- T(("Adding termpath %s", path)); -+ TR(TRACE_DATABASE, ("Adding termpath %s", path)); - } - termpaths[count] = 0; - if (save != 0) -@@ -956,13 +969,13 @@ - static char *source; - static int lineno; - -- T(("read termcap entry for %s", tn)); -+ TR(TRACE_DATABASE, ("read termcap entry for %s", tn)); - - if (strlen(tn) == 0 - || strcmp(tn, ".") == 0 - || strcmp(tn, "..") == 0 - || _nc_pathlast(tn) != 0) { -- T(("illegal or missing entry name '%s'", tn)); -+ TR(TRACE_DATABASE, ("illegal or missing entry name '%s'", tn)); - return TGETENT_NO; - } - -@@ -980,7 +993,7 @@ - _nc_curr_line = lineno; - _nc_set_source(source); - } -- _nc_read_entry_source((FILE *) 0, tc, FALSE, FALSE, NULLHOOK); -+ _nc_read_entry_source((FILE *) 0, tc, FALSE, TRUE, NULLHOOK); - #else - /* - * Here is what the 4.4BSD termcap(3) page prescribes: -@@ -1027,7 +1040,9 @@ - normal = FALSE; - } else if (_nc_name_match(tc, tn, "|:")) { /* treat as a capability file */ - use_buffer = TRUE; -- (void) sprintf(tc_buf, "%.*s\n", (int) sizeof(tc_buf) - 2, tc); -+ _nc_SPRINTF(tc_buf, -+ _nc_SLIMIT(sizeof(tc_buf)) -+ "%.*s\n", (int) sizeof(tc_buf) - 2, tc); - normal = FALSE; - } - } -@@ -1049,8 +1064,9 @@ - if (use_terminfo_vars() && (h = getenv("HOME")) != NULL && *h != '\0' - && (strlen(h) + sizeof(PRIVATE_CAP)) < PATH_MAX) { - /* user's .termcap, if any, should override it */ -- (void) strcpy(envhome, h); -- (void) sprintf(pathbuf, PRIVATE_CAP, envhome); -+ _nc_STRCPY(envhome, h, sizeof(envhome)); -+ _nc_SPRINTF(pathbuf, _nc_SLIMIT(sizeof(pathbuf)) -+ PRIVATE_CAP, envhome); - ADD_TC(pathbuf, filecount); - } - } -@@ -1063,7 +1079,7 @@ - for (j = 0; j < filecount; j++) { - bool omit = FALSE; - if (stat(termpaths[j], &test_stat[j]) != 0 -- || (test_stat[j].st_mode & S_IFMT) != S_IFREG) { -+ || !S_ISREG(test_stat[j].st_mode)) { - omit = TRUE; - } else { - for (k = 0; k < j; k++) { -@@ -1075,7 +1091,7 @@ - } - } - if (omit) { -- T(("Path %s is a duplicate", termpaths[j])); -+ TR(TRACE_DATABASE, ("Path %s is a duplicate", termpaths[j])); - for (k = j + 1; k < filecount; k++) { - termpaths[k - 1] = termpaths[k]; - test_stat[k - 1] = test_stat[k]; -@@ -1100,7 +1116,7 @@ - - for (i = 0; i < filecount; i++) { - -- T(("Looking for %s in %s", tn, termpaths[i])); -+ TR(TRACE_DATABASE, ("Looking for %s in %s", tn, termpaths[i])); - if (_nc_access(termpaths[i], R_OK) == 0 - && (fp = fopen(termpaths[i], "r")) != (FILE *) 0) { - _nc_set_source(termpaths[i]); -@@ -1138,8 +1154,7 @@ - * from the list. - */ - *tp = ep->tterm; -- _nc_delink_entry(_nc_head, &(ep->tterm)); -- free(ep); -+ _nc_free_entry(_nc_head, &(ep->tterm)); - - /* - * OK, now try to write the type to user's terminfo directory. -diff -Naur ncurses-5.9/ncurses/tinfo/setbuf.c ncurses-5.9.patch/ncurses/tinfo/setbuf.c ---- ncurses-5.9/ncurses/tinfo/setbuf.c 2010-08-28 23:08:31.000000000 +0200 -+++ ncurses-5.9.patch/ncurses/tinfo/setbuf.c 1970-01-01 01:00:00.000000000 +0100 -@@ -1,169 +0,0 @@ --/**************************************************************************** -- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * -- * * -- * Permission is hereby granted, free of charge, to any person obtaining a * -- * copy of this software and associated documentation files (the * -- * "Software"), to deal in the Software without restriction, including * -- * without limitation the rights to use, copy, modify, merge, publish, * -- * distribute, distribute with modifications, sublicense, and/or sell * -- * copies of the Software, and to permit persons to whom the Software is * -- * furnished to do so, subject to the following conditions: * -- * * -- * The above copyright notice and this permission notice shall be included * -- * in all copies or substantial portions of the Software. * -- * * -- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * -- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * -- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * -- * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * -- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * -- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * -- * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * -- * * -- * Except as contained in this notice, the name(s) of the above copyright * -- * holders shall not be used in advertising or otherwise to promote the * -- * sale, use or other dealings in this Software without prior written * -- * authorization. * -- ****************************************************************************/ -- --/**************************************************************************** -- * Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 * -- * and: Eric S. Raymond <esr@snark.thyrsus.com> * -- * and: Thomas E. Dickey 1996-on * -- * and: Juergen Pfeifer 2008 * -- ****************************************************************************/ -- --/* --** setbuf.c --** --** Support for set_term(), reset_shell_mode(), reset_prog_mode(). --** --*/ -- --#include <curses.priv.h> -- --MODULE_ID("$Id: setbuf.c,v 1.16 2010/08/28 21:08:31 tom Exp $") -- --/* -- * If the output file descriptor is connected to a tty (the typical case) it -- * will probably be line-buffered. Keith Bostic pointed out that we don't want -- * this; it hoses people running over networks by forcing out a bunch of small -- * packets instead of one big one, so screen updates on ptys look jerky. -- * Restore block buffering to prevent this minor lossage. -- * -- * The buffer size is a compromise. Ideally we'd like a buffer that can hold -- * the maximum possible update size (the whole screen plus cup commands to -- * change lines as it's painted). On a 66-line xterm this can become -- * excessive. So we min it with the amount of data we think we can get through -- * two Ethernet packets (maximum packet size - 100 for TCP/IP overhead). -- * -- * Why two ethernet packets? It used to be one, on the theory that said -- * packets define the maximum size of atomic update. But that's less than the -- * 2000 chars on a 25 x 80 screen, and we don't want local updates to flicker -- * either. Two packet lengths will handle up to a 35 x 80 screen. -- * -- * The magic '6' is the estimated length of the end-of-line cup sequence to go -- * to the next line. It's generous. We used to mess with the buffering in -- * init_mvcur() after cost computation, but that lost the sequences emitted by -- * init_acs() in setupscreen(). -- * -- * "The setvbuf function may be used only after the stream pointed to by stream -- * has been associated with an open file and before any other operation is -- * performed on the stream." (ISO 7.9.5.6.) -- * -- * Grrrr... -- * -- * On a lighter note, many implementations do in fact allow an application to -- * reset the buffering after it has been written to. We try to do this because -- * otherwise we leave stdout in buffered mode after endwin() is called. (This -- * also happens with SVr4 curses). -- * -- * There are pros/cons: -- * -- * con: -- * There is no guarantee that we can reestablish buffering once we've -- * dropped it. -- * -- * We _may_ lose data if the implementation does not coordinate this with -- * fflush. -- * -- * pro: -- * An implementation is more likely to refuse to change the buffering than -- * to do it in one of the ways mentioned above. -- * -- * The alternative is to have the application try to change buffering -- * itself, which is certainly no improvement. -- * -- * Just in case it does not work well on a particular system, the calls to -- * change buffering are all via the macro NC_BUFFERED. Some implementations -- * do indeed get confused by changing setbuf on/off, and will overrun the -- * buffer. So we disable this by default (there may yet be a workaround). -- */ --NCURSES_EXPORT(void) --NCURSES_SP_NAME(_nc_set_buffer) (NCURSES_SP_DCLx FILE *ofp, bool buffered) --{ -- int Cols; -- int Lines; -- -- if (0 == SP_PARM) -- return; -- -- Cols = *(ptrCols(SP_PARM)); -- Lines = *(ptrLines(SP_PARM)); -- -- /* optional optimization hack -- do before any output to ofp */ --#if HAVE_SETVBUF || HAVE_SETBUFFER -- if (SP_PARM->_buffered != buffered) { -- unsigned buf_len; -- char *buf_ptr; -- -- if (getenv("NCURSES_NO_SETBUF") != 0) -- return; -- -- fflush(ofp); --#ifdef __DJGPP__ -- setmode(ofp, O_BINARY); --#endif -- if (buffered != 0) { -- buf_len = (unsigned) min(Lines * (Cols + 6), 2800); -- if ((buf_ptr = SP_PARM->_setbuf) == 0) { -- if ((buf_ptr = typeMalloc(char, buf_len)) == NULL) -- return; -- SP_PARM->_setbuf = buf_ptr; -- /* Don't try to free this! */ -- } --#if !USE_SETBUF_0 -- else -- return; --#endif -- } else { --#if !USE_SETBUF_0 -- return; --#else -- buf_len = 0; -- buf_ptr = 0; --#endif -- } -- --#if HAVE_SETVBUF --#ifdef SETVBUF_REVERSED /* pre-svr3? */ -- (void) setvbuf(ofp, buf_ptr, buf_len, buf_len ? _IOFBF : _IOLBF); --#else -- (void) setvbuf(ofp, buf_ptr, buf_len ? _IOFBF : _IOLBF, buf_len); --#endif --#elif HAVE_SETBUFFER -- (void) setbuffer(ofp, buf_ptr, (int) buf_len); --#endif -- -- SP_PARM->_buffered = buffered; -- } --#endif /* HAVE_SETVBUF || HAVE_SETBUFFER */ --} -- --#if NCURSES_SP_FUNCS --NCURSES_EXPORT(void) --_nc_set_buffer(FILE *ofp, bool buffered) --{ -- NCURSES_SP_NAME(_nc_set_buffer) (CURRENT_SCREEN, ofp, buffered); --} --#endif -diff -Naur ncurses-5.9/ncurses/tinfo/strings.c ncurses-5.9.patch/ncurses/tinfo/strings.c ---- ncurses-5.9/ncurses/tinfo/strings.c 2007-08-11 19:12:17.000000000 +0200 -+++ ncurses-5.9.patch/ncurses/tinfo/strings.c 2014-09-01 16:33:22.453792284 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 2000-2003,2007 Free Software Foundation, Inc. * -+ * Copyright (c) 2000-2007,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -36,7 +36,7 @@ - - #include <curses.priv.h> - --MODULE_ID("$Id: strings.c,v 1.6 2007/08/11 17:12:17 tom Exp $") -+MODULE_ID("$Id: strings.c,v 1.8 2012/02/22 22:34:31 tom Exp $") - - /**************************************************************************** - * Useful string functions (especially for mvcur) -@@ -110,7 +110,7 @@ - - if (len < dst->s_size) { - if (dst->s_tail != 0) { -- strcpy(dst->s_tail, src); -+ _nc_STRCPY(dst->s_tail, src, dst->s_size); - dst->s_tail += len; - } - dst->s_size -= len; -@@ -131,7 +131,7 @@ - - if (len < dst->s_size) { - if (dst->s_head != 0) { -- strcpy(dst->s_head, src); -+ _nc_STRCPY(dst->s_head, src, dst->s_size); - dst->s_tail = dst->s_head + len; - } - dst->s_size = dst->s_init - len; -diff -Naur ncurses-5.9/ncurses/tinfo/tinfo_driver.c ncurses-5.9.patch/ncurses/tinfo/tinfo_driver.c ---- ncurses-5.9/ncurses/tinfo/tinfo_driver.c 2010-12-20 02:47:09.000000000 +0100 -+++ ncurses-5.9.patch/ncurses/tinfo/tinfo_driver.c 2014-09-01 16:33:22.454792285 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 2008-2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 2008-2013,2014 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -50,7 +50,7 @@ - # endif - #endif - --MODULE_ID("$Id: tinfo_driver.c,v 1.13 2010/12/20 01:47:09 tom Exp $") -+MODULE_ID("$Id: tinfo_driver.c,v 1.33 2014/03/08 20:33:38 tom Exp $") - - /* - * SCO defines TIOCGSIZE and the corresponding struct. Other systems (SunOS, -@@ -93,7 +93,7 @@ - - #define TCBMAGIC NCDRV_MAGIC(NCDRV_TINFO) - #define AssertTCB() assert(TCB!=0 && TCB->magic==TCBMAGIC) --#define SetSP() assert(TCB->csp!=0); sp = TCB->csp -+#define SetSP() assert(TCB->csp!=0); sp = TCB->csp; (void) sp - - /* - * This routine needs to do all the work to make curscr look -@@ -106,22 +106,6 @@ - return TINFO_DOUPDATE(TCB->csp); - } - --#define ret_error(code, fmt, arg) if (errret) {\ -- *errret = code;\ -- return(FALSE); \ -- } else {\ -- fprintf(stderr, fmt, arg);\ -- exit(EXIT_FAILURE);\ -- } -- --#define ret_error0(code, msg) if (errret) {\ -- *errret = code;\ -- return(FALSE);\ -- } else {\ -- fprintf(stderr, msg);\ -- exit(EXIT_FAILURE);\ -- } -- - static bool - drv_CanHandle(TERMINAL_CONTROL_BLOCK * TCB, const char *tname, int *errret) - { -@@ -135,7 +119,7 @@ - sp = TCB->csp; - TCB->magic = TCBMAGIC; - --#if (USE_DATABASE || USE_TERMCAP) -+#if (NCURSES_USE_DATABASE || NCURSES_USE_TERMCAP) - status = _nc_setup_tinfo(tname, &termp->type); - #else - status = TGETENT_NO; -@@ -156,12 +140,12 @@ - if (status == TGETENT_ERR) { - ret_error0(status, "terminals database is inaccessible\n"); - } else if (status == TGETENT_NO) { -- ret_error(status, "'%s': unknown terminal type.\n", tname); -+ ret_error1(status, "unknown terminal type.\n", tname); - } - } - result = TRUE; - #if !USE_REENTRANT -- strncpy(ttytype, termp->type.term_names, NAMESIZE - 1); -+ strncpy(ttytype, termp->type.term_names, (size_t) NAMESIZE - 1); - ttytype[NAMESIZE - 1] = '\0'; - #endif - -@@ -169,17 +153,27 @@ - _nc_tinfo_cmdch(termp, *command_character); - - if (generic_type) { -- ret_error(TGETENT_NO, "'%s': I need something more specific.\n", tname); -+ /* -+ * BSD 4.3's termcap contains mis-typed "gn" for wy99. Do a sanity -+ * check before giving up. -+ */ -+ if ((VALID_STRING(cursor_address) -+ || (VALID_STRING(cursor_down) && VALID_STRING(cursor_home))) -+ && VALID_STRING(clear_screen)) { -+ ret_error1(TGETENT_YES, "terminal is not really generic.\n", tname); -+ } else { -+ ret_error1(TGETENT_NO, "I need something more specific.\n", tname); -+ } - } - if (hard_copy) { -- ret_error(TGETENT_YES, "'%s': I can't handle hardcopy terminals.\n", tname); -+ ret_error1(TGETENT_YES, "I can't handle hardcopy terminals.\n", tname); - } - - return result; - } - - static int --drv_dobeepflash(TERMINAL_CONTROL_BLOCK * TCB, bool beepFlag) -+drv_dobeepflash(TERMINAL_CONTROL_BLOCK * TCB, int beepFlag) - { - SCREEN *sp; - int res = ERR; -@@ -190,22 +184,18 @@ - /* FIXME: should make sure that we are not in altchar mode */ - if (beepFlag) { - if (bell) { -- res = NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx "bell", bell); -+ res = NCURSES_PUTP2("bell", bell); - NCURSES_SP_NAME(_nc_flush) (sp); - } else if (flash_screen) { -- res = NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx -- "flash_screen", -- flash_screen); -+ res = NCURSES_PUTP2("flash_screen", flash_screen); - NCURSES_SP_NAME(_nc_flush) (sp); - } - } else { - if (flash_screen) { -- res = NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx -- "flash_screen", -- flash_screen); -+ res = NCURSES_PUTP2("flash_screen", flash_screen); - NCURSES_SP_NAME(_nc_flush) (sp); - } else if (bell) { -- res = NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx "bell", bell); -+ res = NCURSES_PUTP2("bell", bell); - NCURSES_SP_NAME(_nc_flush) (sp); - } - } -@@ -277,7 +267,7 @@ - - static void - drv_setcolor(TERMINAL_CONTROL_BLOCK * TCB, -- bool fore, -+ int fore, - int color, - NCURSES_SP_OUTC outc) - { -@@ -321,7 +311,7 @@ - SetSP(); - - if (orig_pair != 0) { -- NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx "orig_pair", orig_pair); -+ NCURSES_PUTP2("orig_pair", orig_pair); - result = TRUE; - } - return result; -@@ -337,7 +327,7 @@ - SetSP(); - - if (orig_colors != 0) { -- NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx "orig_colors", orig_colors); -+ NCURSES_PUTP2("orig_colors", orig_colors); - result = TRUE; - } - return result; -@@ -348,14 +338,18 @@ - { - SCREEN *sp; - bool useEnv = TRUE; -+ bool useTioctl = TRUE; - - AssertTCB(); - sp = TCB->csp; /* can be null here */ - - if (sp) { - useEnv = sp->_use_env; -- } else -+ useTioctl = sp->_use_tioctl; -+ } else { - useEnv = _nc_prescreen.use_env; -+ useTioctl = _nc_prescreen.use_tioctl; -+ } - - /* figure out the size of the screen */ - T(("screen size: terminfo lines = %d columns = %d", lines, columns)); -@@ -363,7 +357,7 @@ - *linep = (int) lines; - *colp = (int) columns; - -- if (useEnv) { -+ if (useEnv || useTioctl) { - int value; - - #ifdef __EMX__ -@@ -371,7 +365,9 @@ - int screendata[2]; - _scrsize(screendata); - *colp = screendata[0]; -- *linep = screendata[1]; -+ *linep = ((sp != 0 && sp->_filtered) -+ ? 1 -+ : screendata[1]); - T(("EMX screen size: environment LINES = %d COLUMNS = %d", - *linep, *colp)); - } -@@ -400,19 +396,33 @@ - } - #endif /* HAVE_SIZECHANGE */ - -- /* -- * Finally, look for environment variables. -- * -- * Solaris lets users override either dimension with an environment -- * variable. -- */ -- if ((value = _nc_getenv_num("LINES")) > 0) { -- *linep = value; -- T(("screen size: environment LINES = %d", *linep)); -- } -- if ((value = _nc_getenv_num("COLUMNS")) > 0) { -- *colp = value; -- T(("screen size: environment COLUMNS = %d", *colp)); -+ if (useEnv) { -+ if (useTioctl) { -+ /* -+ * If environment variables are used, update them. -+ */ -+ if ((sp == 0 || !sp->_filtered) && _nc_getenv_num("LINES") > 0) { -+ _nc_setenv_num("LINES", *linep); -+ } -+ if (_nc_getenv_num("COLUMNS") > 0) { -+ _nc_setenv_num("COLUMNS", *colp); -+ } -+ } -+ -+ /* -+ * Finally, look for environment variables. -+ * -+ * Solaris lets users override either dimension with an environment -+ * variable. -+ */ -+ if ((value = _nc_getenv_num("LINES")) > 0) { -+ *linep = value; -+ T(("screen size: environment LINES = %d", *linep)); -+ } -+ if ((value = _nc_getenv_num("COLUMNS")) > 0) { -+ *colp = value; -+ T(("screen size: environment COLUMNS = %d", *colp)); -+ } - } - - /* if we can't get dynamic info about the size, use static */ -@@ -463,7 +473,7 @@ - } - - static int --drv_sgmode(TERMINAL_CONTROL_BLOCK * TCB, bool setFlag, TTY * buf) -+drv_sgmode(TERMINAL_CONTROL_BLOCK * TCB, int setFlag, TTY * buf) - { - SCREEN *sp = TCB->csp; - TERMINAL *_term = (TERMINAL *) TCB; -@@ -497,7 +507,7 @@ - } - - static int --drv_mode(TERMINAL_CONTROL_BLOCK * TCB, bool progFlag, bool defFlag) -+drv_mode(TERMINAL_CONTROL_BLOCK * TCB, int progFlag, int defFlag) - { - SCREEN *sp; - TERMINAL *_term = (TERMINAL *) TCB; -@@ -527,7 +537,6 @@ - if (sp) { - if (sp->_keypad_on) - _nc_keypad(sp, TRUE); -- NC_BUFFERED(sp, TRUE); - } - code = OK; - } -@@ -553,7 +562,6 @@ - if (sp) { - _nc_keypad(sp, FALSE); - NCURSES_SP_NAME(_nc_flush) (sp); -- NC_BUFFERED(sp, FALSE); - } - code = drv_sgmode(TCB, TRUE, &(_term->Ottyb)); - } -@@ -620,15 +628,13 @@ - static void - drv_init(TERMINAL_CONTROL_BLOCK * TCB) - { -- SCREEN *sp; - TERMINAL *trm; - - AssertTCB(); - - trm = (TERMINAL *) TCB; -- sp = TCB->csp; - -- TCB->info.initcolor = initialize_color; -+ TCB->info.initcolor = VALID_STRING(initialize_color); - TCB->info.canchange = can_change; - TCB->info.hascolor = ((VALID_NUMERIC(max_colors) && VALID_NUMERIC(max_pairs) - && (((set_foreground != NULL) -@@ -657,7 +663,7 @@ - * baudrate. - */ - if (isatty(trm->Filedes)) { -- TCB->drv->mode(TCB, TRUE, TRUE); -+ TCB->drv->td_mode(TCB, TRUE, TRUE); - } - } - -@@ -665,7 +671,7 @@ - #define InPalette(n) ((n) >= 0 && (n) < MAX_PALETTE) - - static void --drv_initpair(TERMINAL_CONTROL_BLOCK * TCB, short pair, short f, short b) -+drv_initpair(TERMINAL_CONTROL_BLOCK * TCB, int pair, int f, int b) - { - SCREEN *sp; - -@@ -681,12 +687,11 @@ - tp[f].red, tp[f].green, tp[f].blue, - tp[b].red, tp[b].green, tp[b].blue)); - -- NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx -- "initialize_pair", -- TPARM_7(initialize_pair, -- pair, -- tp[f].red, tp[f].green, tp[f].blue, -- tp[b].red, tp[b].green, tp[b].blue)); -+ NCURSES_PUTP2("initialize_pair", -+ TPARM_7(initialize_pair, -+ pair, -+ tp[f].red, tp[f].green, tp[f].blue, -+ tp[b].red, tp[b].green, tp[b].blue)); - } - } - -@@ -712,23 +717,22 @@ - - static void - drv_initcolor(TERMINAL_CONTROL_BLOCK * TCB, -- short color, short r, short g, short b) -+ int color, int r, int g, int b) - { - SCREEN *sp = TCB->csp; - - AssertTCB(); - if (initialize_color != NULL) { -- NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx -- "initialize_color", -- TPARM_4(initialize_color, color, r, g, b)); -+ NCURSES_PUTP2("initialize_color", -+ TPARM_4(initialize_color, color, r, g, b)); - } - } - - static void - drv_do_color(TERMINAL_CONTROL_BLOCK * TCB, -- short old_pair, -- short pair, -- bool reverse, -+ int old_pair, -+ int pair, -+ int reverse, - NCURSES_SP_OUTC outc) - { - SCREEN *sp = TCB->csp; -@@ -759,7 +763,7 @@ - if (old_pair >= 0 - && sp != 0 - && NCURSES_SP_NAME(pair_content) (NCURSES_SP_ARGx -- old_pair, -+ (short) old_pair, - &old_fg, - &old_bg) !=ERR) { - if ((isDefaultColor(fg) && !isDefaultColor(old_fg)) -@@ -845,7 +849,9 @@ - } - - static int --drv_testmouse(TERMINAL_CONTROL_BLOCK * TCB, int delay) -+drv_testmouse(TERMINAL_CONTROL_BLOCK * TCB, -+ int delay -+ EVENTLIST_2nd(_nc_eventlist * evl)) - { - int rc = 0; - SCREEN *sp; -@@ -860,11 +866,11 @@ - } else - #endif - { -- rc = TCBOf(sp)->drv->twait(TCBOf(sp), -- TWAIT_MASK, -- delay, -- (int *) 0 -- EVENTLIST_2nd(evl)); -+ rc = TCBOf(sp)->drv->td_twait(TCBOf(sp), -+ TWAIT_MASK, -+ delay, -+ (int *) 0 -+ EVENTLIST_2nd(evl)); - #if USE_SYSMOUSE - if ((sp->_mouse_type == M_SYSMOUSE) - && (sp->_sysmouse_head < sp->_sysmouse_tail) -@@ -882,7 +888,7 @@ - { - SCREEN *sp = TCB->csp; - AssertTCB(); -- return TINFO_MVCUR(sp, yold, xold, ynew, xnew); -+ return NCURSES_SP_NAME(_nc_mvcur) (sp, yold, xold, ynew, xnew); - } - - static void -@@ -892,22 +898,21 @@ - - AssertTCB(); - if (labnum > 0 && labnum <= num_labels) { -- NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx -- "plab_norm", -- TPARM_2(plab_norm, labnum, text)); -+ NCURSES_PUTP2("plab_norm", -+ TPARM_2(plab_norm, labnum, text)); - } - } - - static void --drv_hwlabelOnOff(TERMINAL_CONTROL_BLOCK * TCB, bool OnFlag) -+drv_hwlabelOnOff(TERMINAL_CONTROL_BLOCK * TCB, int OnFlag) - { - SCREEN *sp = TCB->csp; - - AssertTCB(); - if (OnFlag) { -- NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx "label_on", label_on); -+ NCURSES_PUTP2("label_on", label_on); - } else { -- NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx "label_off", label_off); -+ NCURSES_PUTP2("label_off", label_off); - } - } - -@@ -948,6 +953,11 @@ - if (sp && sp->_coloron) - attrs |= A_COLOR; - -+#if USE_ITALIC -+ if (enter_italics_mode) -+ attrs |= A_ITALIC; -+#endif -+ - return (attrs); - } - -@@ -972,7 +982,7 @@ - AssertTCB(); - assert(sp != 0); - if (ena_acs != NULL) { -- NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx "ena_acs", ena_acs); -+ NCURSES_PUTP2("ena_acs", ena_acs); - } - #if NCURSES_EXT_FUNCS - /* -@@ -1074,16 +1084,7 @@ - - if (magic_cookie_glitch > 0) { /* tvi, wyse */ - -- sp->_xmc_triggers = sp->_ok_attributes & ( -- A_STANDOUT | -- A_UNDERLINE | -- A_REVERSE | -- A_BLINK | -- A_DIM | -- A_BOLD | -- A_INVIS | -- A_PROTECT -- ); -+ sp->_xmc_triggers = sp->_ok_attributes & XMC_CONFLICT; - #if 0 - /* - * We "should" treat colors as an attribute. The wyse350 (and its -@@ -1176,7 +1177,7 @@ - if ((pthread_self) && (pthread_kill) && (pthread_equal)) - _nc_globals.read_thread = pthread_self(); - # endif -- n = read(sp->_ifd, &c2, 1); -+ n = read(sp->_ifd, &c2, (size_t) 1); - #if USE_PTHREADS_EINTR - _nc_globals.read_thread = 0; - #endif -@@ -1209,7 +1210,7 @@ - int rc = ERR; - - if (value) { -- rc = NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx name, value); -+ rc = NCURSES_PUTP2(name, value); - } - return rc; - } -@@ -1225,7 +1226,7 @@ - } - - static int --drv_kpad(TERMINAL_CONTROL_BLOCK * TCB, bool flag) -+drv_kpad(TERMINAL_CONTROL_BLOCK * TCB, int flag) - { - int ret = ERR; - SCREEN *sp; -@@ -1251,7 +1252,7 @@ - } - - static int --drv_keyok(TERMINAL_CONTROL_BLOCK * TCB, int c, bool flag) -+drv_keyok(TERMINAL_CONTROL_BLOCK * TCB, int c, int flag) - { - SCREEN *sp; - int code = ERR; -@@ -1264,7 +1265,8 @@ - if (c >= 0) { - unsigned ch = (unsigned) c; - if (flag) { -- while ((s = _nc_expand_try(sp->_key_ok, ch, &count, 0)) != 0 -+ while ((s = _nc_expand_try(sp->_key_ok, -+ ch, &count, (size_t) 0)) != 0 - && _nc_remove_key(&(sp->_key_ok), ch)) { - code = _nc_add_to_try(&(sp->_keytry), s, ch); - free(s); -@@ -1273,7 +1275,8 @@ - break; - } - } else { -- while ((s = _nc_expand_try(sp->_keytry, ch, &count, 0)) != 0 -+ while ((s = _nc_expand_try(sp->_keytry, -+ ch, &count, (size_t) 0)) != 0 - && _nc_remove_key(&(sp->_keytry), ch)) { - code = _nc_add_to_try(&(sp->_key_ok), s, ch); - free(s); -diff -Naur ncurses-5.9/ncurses/tinfo/trim_sgr0.c ncurses-5.9.patch/ncurses/tinfo/trim_sgr0.c ---- ncurses-5.9/ncurses/tinfo/trim_sgr0.c 2010-12-26 00:03:57.000000000 +0100 -+++ ncurses-5.9.patch/ncurses/tinfo/trim_sgr0.c 2014-09-01 16:33:22.454792285 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 2005-2007,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 2005-2010,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -36,7 +36,7 @@ - - #include <tic.h> - --MODULE_ID("$Id: trim_sgr0.c,v 1.12 2010/12/25 23:03:57 tom Exp $") -+MODULE_ID("$Id: trim_sgr0.c,v 1.15 2012/12/15 20:57:17 tom Exp $") - - #undef CUR - #define CUR tp-> -@@ -48,21 +48,28 @@ - static char * - set_attribute_9(TERMTYPE *tp, int flag) - { -- const char *result; -+ const char *value; -+ char *result; - -- if ((result = tparm(set_attributes, 0, 0, 0, 0, 0, 0, 0, 0, flag)) == 0) -- result = ""; -- return strdup(result); -+ value = tparm(set_attributes, 0, 0, 0, 0, 0, 0, 0, 0, flag); -+ if (PRESENT(value)) -+ result = strdup(value); -+ else -+ result = 0; -+ return result; - } - - static int - is_csi(const char *s) - { -- if (UChar(s[0]) == CSI) -- return 1; -- else if (s[0] == ESC && s[1] == L_BRACK) -- return 2; -- return 0; -+ int result = 0; -+ if (s != 0) { -+ if (UChar(s[0]) == CSI) -+ result = 1; -+ else if (s[0] == ESC && s[1] == L_BRACK) -+ result = 2; -+ } -+ return result; - } - - static char * -@@ -97,7 +104,7 @@ - static bool - rewrite_sgr(char *s, char *attr) - { -- if (PRESENT(s)) { -+ if (s != 0) { - if (PRESENT(attr)) { - size_t len_s = strlen(s); - size_t len_a = strlen(attr); -@@ -108,7 +115,7 @@ - for (n = 0; n < len_s - len_a; ++n) { - s[n] = s[n + len_a]; - } -- strcpy(s + n, attr); -+ _nc_STRCPY(s + n, attr, strlen(s) + 1); - TR(TRACE_DATABASE, ("to:\n\t%s", s)); - } - } -@@ -121,33 +128,35 @@ - similar_sgr(char *a, char *b) - { - bool result = FALSE; -- int csi_a = is_csi(a); -- int csi_b = is_csi(b); -- size_t len_a; -- size_t len_b; -- -- TR(TRACE_DATABASE, ("similar_sgr:\n\t%s\n\t%s", -- _nc_visbuf2(1, a), -- _nc_visbuf2(2, b))); -- if (csi_a != 0 && csi_b != 0 && csi_a == csi_b) { -- a += csi_a; -- b += csi_b; -- if (*a != *b) { -- a = skip_zero(a); -- b = skip_zero(b); -+ if (a != 0 && b != 0) { -+ int csi_a = is_csi(a); -+ int csi_b = is_csi(b); -+ size_t len_a; -+ size_t len_b; -+ -+ TR(TRACE_DATABASE, ("similar_sgr:\n\t%s\n\t%s", -+ _nc_visbuf2(1, a), -+ _nc_visbuf2(2, b))); -+ if (csi_a != 0 && csi_b != 0 && csi_a == csi_b) { -+ a += csi_a; -+ b += csi_b; -+ if (*a != *b) { -+ a = skip_zero(a); -+ b = skip_zero(b); -+ } - } -+ len_a = strlen(a); -+ len_b = strlen(b); -+ if (len_a && len_b) { -+ if (len_a > len_b) -+ result = (strncmp(a, b, len_b) == 0); -+ else -+ result = (strncmp(a, b, len_a) == 0); -+ } -+ TR(TRACE_DATABASE, ("...similar_sgr: %d\n\t%s\n\t%s", result, -+ _nc_visbuf2(1, a), -+ _nc_visbuf2(2, b))); - } -- len_a = strlen(a); -- len_b = strlen(b); -- if (len_a && len_b) { -- if (len_a > len_b) -- result = (strncmp(a, b, len_b) == 0); -- else -- result = (strncmp(a, b, len_a) == 0); -- } -- TR(TRACE_DATABASE, ("...similar_sgr: %d\n\t%s\n\t%s", result, -- _nc_visbuf2(1, a), -- _nc_visbuf2(2, b))); - return result; - } - -diff -Naur ncurses-5.9/ncurses/tinfo/write_entry.c ncurses-5.9.patch/ncurses/tinfo/write_entry.c ---- ncurses-5.9/ncurses/tinfo/write_entry.c 2010-12-26 00:23:08.000000000 +0100 -+++ ncurses-5.9.patch/ncurses/tinfo/write_entry.c 2014-09-01 16:33:22.454792285 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -39,21 +39,15 @@ - #include <curses.priv.h> - #include <hashed_db.h> - --#include <sys/stat.h> -- - #include <tic.h> - --#ifndef S_ISDIR --#define S_ISDIR(mode) ((mode & S_IFMT) == S_IFDIR) --#endif -- - #if 1 - #define TRACE_OUT(p) DEBUG(2, p) - #else - #define TRACE_OUT(p) /*nothing */ - #endif - --MODULE_ID("$Id: write_entry.c,v 1.78 2010/12/25 23:23:08 tom Exp $") -+MODULE_ID("$Id: write_entry.c,v 1.91 2013/12/14 21:29:42 tom Exp $") - - static int total_written; - -@@ -76,7 +70,7 @@ - DEBUG(1, ("Created %s", filename)); - - if (write_object(tp, buffer, &offset, limit) == ERR -- || fwrite(buffer, sizeof(char), offset, fp) != offset) { -+ || fwrite(buffer, sizeof(char), (size_t) offset, fp) != offset) { - _nc_syserr_abort("error writing %s/%s", _nc_tic_dir(0), filename); - } - -@@ -99,13 +93,13 @@ - char dir[sizeof(LEAF_FMT)]; - char *s = 0; - -- if (code == 0 || (s = strchr(dirnames, code)) == 0) -+ if (code == 0 || (s = (strchr) (dirnames, code)) == 0) - _nc_err_abort("Illegal terminfo subdirectory \"" LEAF_FMT "\"", code); - - if (verified[s - dirnames]) - return; - -- sprintf(dir, LEAF_FMT, code); -+ _nc_SPRINTF(dir, _nc_SLIMIT(sizeof(dir)) LEAF_FMT, code); - if (make_db_root(dir) < 0) { - _nc_err_abort("%s/%s: permission denied", _nc_tic_dir(0), dir); - } -@@ -115,36 +109,35 @@ - #endif /* !USE_HASHED_DB */ - - static int --make_db_path(char *dst, const char *src, unsigned limit) -+make_db_path(char *dst, const char *src, size_t limit) - { - int rc = -1; - const char *top = _nc_tic_dir(0); - - if (src == top || _nc_is_abs_path(src)) { - if (strlen(src) + 1 <= limit) { -- (void) strcpy(dst, src); -+ _nc_STRCPY(dst, src, limit); - rc = 0; - } - } else { - if (strlen(top) + strlen(src) + 2 <= limit) { -- (void) sprintf(dst, "%s/%s", top, src); -+ _nc_SPRINTF(dst, _nc_SLIMIT(limit) "%s/%s", top, src); - rc = 0; - } - } - #if USE_HASHED_DB - if (rc == 0) { -- if (_nc_is_dir_path(dst)) { -- rc = -1; -- } else { -- static const char suffix[] = DBM_SUFFIX; -- unsigned have = strlen(dst); -- unsigned need = strlen(suffix); -- if (have > need && strcmp(dst + have - need, suffix)) { -- if (have + need <= limit) -- strcat(dst, suffix); -- else -- rc = -1; -+ static const char suffix[] = DBM_SUFFIX; -+ size_t have = strlen(dst); -+ size_t need = strlen(suffix); -+ if (have > need && strcmp(dst + (int) (have - need), suffix)) { -+ if (have + need <= limit) { -+ _nc_STRCAT(dst, suffix, limit); -+ } else { -+ rc = -1; - } -+ } else if (_nc_is_dir_path(dst)) { -+ rc = -1; - } - } - #endif -@@ -164,10 +157,11 @@ - #if USE_HASHED_DB - DB *capdbp; - -- if ((capdbp = _nc_db_open(fullpath, TRUE)) == NULL) -+ if ((capdbp = _nc_db_open(fullpath, TRUE)) == NULL) { - rc = -1; -- else if (_nc_db_close(capdbp) < 0) -+ } else if (_nc_db_close(capdbp) < 0) { - rc = -1; -+ } - #else - struct stat statbuf; - -@@ -197,7 +191,10 @@ - char actual[PATH_MAX]; - - if (dir == 0 -- && use_terminfo_vars()) -+#ifndef USE_ROOT_ENVIRON -+ && use_terminfo_vars() -+#endif -+ ) - dir = getenv("TERMINFO"); - - if (dir != 0) -@@ -279,16 +276,21 @@ - char name_list[MAX_TERMINFO_LENGTH]; - char *first_name, *other_names; - char *ptr; -+ char *term_names = tp->term_names; -+ size_t name_size = strlen(term_names); - -- assert(strlen(tp->term_names) != 0); -- assert(strlen(tp->term_names) < sizeof(name_list)); -+ if (name_size == 0) { -+ _nc_syserr_abort("no terminal name found."); -+ } else if (name_size >= sizeof(name_list) - 1) { -+ _nc_syserr_abort("terminal name too long: %s", term_names); -+ } - -- (void) strcpy(name_list, tp->term_names); -+ _nc_STRCPY(name_list, term_names, sizeof(name_list)); - DEBUG(7, ("Name list = '%s'", name_list)); - - first_name = name_list; - -- ptr = &name_list[strlen(name_list) - 1]; -+ ptr = &name_list[name_size - 1]; - other_names = ptr + 1; - - while (ptr > name_list && *ptr != '|') -@@ -322,8 +324,8 @@ - buffer[0] = 0; - - memset(&key, 0, sizeof(key)); -- key.data = tp->term_names; -- key.size = strlen(tp->term_names); -+ key.data = term_names; -+ key.size = name_size; - - memset(&data, 0, sizeof(data)); - data.data = buffer; -@@ -336,8 +338,10 @@ - key.data = name_list; - key.size = strlen(name_list); - -- strcpy(buffer + 1, tp->term_names); -- data.size = strlen(tp->term_names) + 1; -+ _nc_STRCPY(buffer + 1, -+ term_names, -+ sizeof(buffer) - 1); -+ data.size = name_size + 1; - - _nc_db_put(capdb, &key, &data); - -@@ -355,7 +359,6 @@ - - _nc_db_put(capdb, &key, &data); - } -- _nc_db_close(capdb); - } - } - #else /* !USE_HASHED_DB */ -@@ -366,7 +369,8 @@ - if (strlen(first_name) >= sizeof(filename) - (2 + LEAF_LEN)) - _nc_warning("terminal name too long."); - -- sprintf(filename, LEAF_FMT "/%s", first_name[0], first_name); -+ _nc_SPRINTF(filename, _nc_SLIMIT(sizeof(filename)) -+ LEAF_FMT "/%s", first_name[0], first_name); - - /* - * Has this primary name been written since the first call to -@@ -376,7 +380,22 @@ - if (start_time > 0 && - stat(filename, &statbuf) >= 0 - && statbuf.st_mtime >= start_time) { -+#if HAVE_LINK && !USE_SYMLINKS -+ /* -+ * If the file has more than one link, the reason for the previous -+ * write could be that the current primary name used to be an alias for -+ * the previous entry. In that case, unlink the file so that we will -+ * not modify the previous entry as we write this one. -+ */ -+ if (statbuf.st_nlink > 1) { -+ _nc_warning("name redefined."); -+ unlink(filename); -+ } else { -+ _nc_warning("name multiply defined."); -+ } -+#else - _nc_warning("name multiply defined."); -+#endif - } - - check_writeable(first_name[0]); -@@ -407,7 +426,8 @@ - } - - check_writeable(ptr[0]); -- sprintf(linkname, LEAF_FMT "/%s", ptr[0], ptr); -+ _nc_SPRINTF(linkname, _nc_SLIMIT(sizeof(linkname)) -+ LEAF_FMT "/%s", ptr[0], ptr); - - if (strcmp(filename, linkname) == 0) { - _nc_warning("self-synonym ignored"); -@@ -422,7 +442,7 @@ - if (first_name[0] == linkname[0]) - strncpy(symlinkname, first_name, sizeof(symlinkname) - 1); - else { -- strcpy(symlinkname, "../"); -+ _nc_STRCPY(symlinkname, "../", sizeof(suymlinkname)); - strncat(symlinkname, filename, sizeof(symlinkname) - 4); - } - symlinkname[sizeof(symlinkname) - 1] = '\0'; -@@ -491,7 +511,7 @@ - return (want / size); - } - --#define Write(buf, size, count) fake_write(buffer, offset, limit, (char *) buf, count, size) -+#define Write(buf, size, count) fake_write(buffer, offset, (size_t) limit, (char *) buf, (size_t) count, (size_t) size) - - #undef LITTLE_ENDIAN /* BSD/OS defines this as a feature macro */ - #define HI(x) ((x) / 256) -@@ -706,7 +726,7 @@ - return (ERR); - - nextfree = compute_offsets(tp->Strings + STRCOUNT, -- tp->ext_Strings, -+ (size_t) tp->ext_Strings, - offsets); - TRACE_OUT(("after extended string capabilities, nextfree=%d", nextfree)); - -@@ -714,7 +734,7 @@ - return (ERR); - - nextfree += compute_offsets(tp->ext_Names, -- extcnt, -+ (size_t) extcnt, - offsets + tp->ext_Strings); - TRACE_OUT(("after extended capnames, nextfree=%d", nextfree)); - strmax = tp->ext_Strings + extcnt; -@@ -742,7 +762,7 @@ - - TRACE_OUT(("WRITE %d numbers @%d", tp->ext_Numbers, *offset)); - if (tp->ext_Numbers) { -- convert_shorts(buf, tp->Numbers + NUMCOUNT, tp->ext_Numbers); -+ convert_shorts(buf, tp->Numbers + NUMCOUNT, (size_t) tp->ext_Numbers); - if (Write(buf, 2, tp->ext_Numbers) != tp->ext_Numbers) - return (ERR); - } -diff -Naur ncurses-5.9/ncurses/trace/lib_traceatr.c ncurses-5.9.patch/ncurses/trace/lib_traceatr.c ---- ncurses-5.9/ncurses/trace/lib_traceatr.c 2011-01-22 20:48:01.000000000 +0100 -+++ ncurses-5.9.patch/ncurses/trace/lib_traceatr.c 2014-09-01 16:33:22.454792285 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2010,2011 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2013,2014 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -43,10 +43,13 @@ - #define CUR SP_TERMTYPE - #endif - --MODULE_ID("$Id: lib_traceatr.c,v 1.74 2011/01/22 19:48:01 tom Exp $") -+MODULE_ID("$Id: lib_traceatr.c,v 1.81 2014/02/01 22:09:27 tom Exp $") - - #define COLOR_OF(c) ((c < 0) ? "default" : (c > 7 ? color_of(c) : colors[c].name)) - -+#define TRACE_BUF_SIZE(num) (_nc_globals.tracebuf_ptr[num].size) -+#define COLOR_BUF_SIZE(num) (sizeof(my_buffer[num])) -+ - #ifdef TRACE - - static const char l_brace[] = StringOf(L_BRACE); -@@ -65,9 +68,12 @@ - my_cached = c; - my_select = !my_select; - if (c == COLOR_DEFAULT) -- strcpy(my_buffer[my_select], "default"); -+ _nc_STRCPY(my_buffer[my_select], "default", -+ COLOR_BUF_SIZE(my_select)); - else -- sprintf(my_buffer[my_select], "color%d", c); -+ _nc_SPRINTF(my_buffer[my_select], -+ _nc_SLIMIT(COLOR_BUF_SIZE(my_select)) -+ "color%d", c); - } - return my_buffer[my_select]; - } -@@ -97,6 +103,9 @@ - { A_CHARTEXT, "A_CHARTEXT" }, - { A_NORMAL, "A_NORMAL" }, - { A_COLOR, "A_COLOR" }, -+#if USE_ITALIC -+ { A_ITALIC, "A_ITALIC" }, -+#endif - /* *INDENT-ON* */ - - } -@@ -120,14 +129,14 @@ - ; - size_t n; - char temp[80]; -- char *result = _nc_trace_buf(bufnum, BUFSIZ); -+ char *result = _nc_trace_buf(bufnum, (size_t) BUFSIZ); - - if (result != 0) { - unsigned save_nc_tracing = _nc_tracing; - - _nc_tracing = 0; - -- strcpy(result, l_brace); -+ _nc_STRCPY(result, l_brace, TRACE_BUF_SIZE(bufnum)); - - for (n = 0; n < SIZEOF(names); n++) { - if ((newmode & names[n].val) != 0) { -@@ -139,18 +148,20 @@ - short pairnum = (short) PairNumber(newmode); - #ifdef USE_TERMLIB - /* pair_content lives in libncurses */ -- (void) sprintf(temp, "{%d}", pairnum); -+ _nc_SPRINTF(temp, _nc_SLIMIT(sizeof(temp)) -+ "{%d}", pairnum); - #else -- short fg, bg; -+ NCURSES_COLOR_T fg, bg; - - if (pair_content(pairnum, &fg, &bg) == OK) { -- (void) sprintf(temp, -- "{%d = {%s, %s}}", -- pairnum, -- COLOR_OF(fg), -- COLOR_OF(bg)); -+ _nc_SPRINTF(temp, _nc_SLIMIT(sizeof(temp)) -+ "{%d = {%s, %s}}", -+ pairnum, -+ COLOR_OF(fg), -+ COLOR_OF(bg)); - } else { -- (void) sprintf(temp, "{%d}", pairnum); -+ _nc_SPRINTF(temp, _nc_SLIMIT(sizeof(temp)) -+ "{%d}", pairnum); - } - #endif - result = _nc_trace_bufcat(bufnum, temp); -@@ -243,7 +254,7 @@ - #if NCURSES_SP_FUNCS - (void) sp; - #endif -- if ((attr & A_ALTCHARSET) && (acs_chars != 0)) { -+ if (SP_PARM != 0 && (attr & A_ALTCHARSET) && (acs_chars != 0)) { - char *cp; - char *found = 0; - const ALT_NAMES *strp; -@@ -271,10 +282,10 @@ - _tracechtype2(int bufnum, chtype ch) - { - const char *found; -- char *result = _nc_trace_buf(bufnum, BUFSIZ); -+ char *result = _nc_trace_buf(bufnum, (size_t) BUFSIZ); - - if (result != 0) { -- strcpy(result, l_brace); -+ _nc_STRCPY(result, l_brace, TRACE_BUF_SIZE(bufnum)); - if ((found = _nc_altcharset_name(ChAttrOf(ch), ch)) != 0) { - (void) _nc_trace_bufcat(bufnum, found); - } else -@@ -311,12 +322,12 @@ - NCURSES_EXPORT(char *) - _tracecchar_t2(int bufnum, const cchar_t *ch) - { -- char *result = _nc_trace_buf(bufnum, BUFSIZ); -+ char *result = _nc_trace_buf(bufnum, (size_t) BUFSIZ); - attr_t attr; - const char *found; - - if (result != 0) { -- strcpy(result, l_brace); -+ _nc_STRCPY(result, l_brace, TRACE_BUF_SIZE(bufnum)); - if (ch != 0) { - attr = AttrOfD(ch); - if ((found = _nc_altcharset_name(attr, (chtype) CharOfD(ch))) != 0) { -diff -Naur ncurses-5.9/ncurses/trace/lib_tracebits.c ncurses-5.9.patch/ncurses/trace/lib_tracebits.c ---- ncurses-5.9/ncurses/trace/lib_tracebits.c 2011-01-09 01:23:03.000000000 +0100 -+++ ncurses-5.9.patch/ncurses/trace/lib_tracebits.c 2014-09-01 16:33:22.454792285 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2008,2011 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -34,11 +34,7 @@ - - #include <curses.priv.h> - --MODULE_ID("$Id: lib_tracebits.c,v 1.19 2011/01/09 00:23:03 tom Exp $") -- --#if SVR4_TERMIO && !defined(_POSIX_SOURCE) --#define _POSIX_SOURCE --#endif -+MODULE_ID("$Id: lib_tracebits.c,v 1.23 2012/06/09 19:55:46 tom Exp $") - - #if HAVE_SYS_TERMIO_H - #include <sys/termio.h> /* needed for ISC */ -@@ -80,22 +76,24 @@ - const char *name; - } BITNAMES; - -+#define TRACE_BUF_SIZE(num) (_nc_globals.tracebuf_ptr[num].size) -+ - static void - lookup_bits(char *buf, const BITNAMES * table, const char *label, unsigned int val) - { - const BITNAMES *sp; - -- (void) strcat(buf, label); -- (void) strcat(buf, ": {"); -+ _nc_STRCAT(buf, label, TRACE_BUF_SIZE(0)); -+ _nc_STRCAT(buf, ": {", TRACE_BUF_SIZE(0)); - for (sp = table; sp->name; sp++) - if (sp->val != 0 - && (val & sp->val) == sp->val) { -- (void) strcat(buf, sp->name); -- (void) strcat(buf, ", "); -+ _nc_STRCAT(buf, sp->name, TRACE_BUF_SIZE(0)); -+ _nc_STRCAT(buf, ", ", TRACE_BUF_SIZE(0)); - } - if (buf[strlen(buf) - 2] == ',') - buf[strlen(buf) - 2] = '\0'; -- (void) strcat(buf, "} "); -+ _nc_STRCAT(buf, "} ", TRACE_BUF_SIZE(0)); - } - - NCURSES_EXPORT(char *) -@@ -192,7 +190,7 @@ - CS_DATA(CS8), - }; - const char *result = "CSIZE? "; -- int value = (tty->c_cflag & CSIZE); -+ int value = (int) (tty->c_cflag & CSIZE); - unsigned n; - - if (value != 0) { -@@ -203,7 +201,7 @@ - } - } - } -- strcat(buf, result); -+ _nc_STRCAT(buf, result, TRACE_BUF_SIZE(0)); - } - #endif - -diff -Naur ncurses-5.9/ncurses/trace/lib_trace.c ncurses-5.9.patch/ncurses/trace/lib_trace.c ---- ncurses-5.9/ncurses/trace/lib_trace.c 2010-12-19 02:21:19.000000000 +0100 -+++ ncurses-5.9.patch/ncurses/trace/lib_trace.c 2014-09-01 16:33:22.454792285 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -47,7 +47,7 @@ - - #include <ctype.h> - --MODULE_ID("$Id: lib_trace.c,v 1.76 2010/12/19 01:21:19 tom Exp $") -+MODULE_ID("$Id: lib_trace.c,v 1.82 2013/07/06 19:42:09 tom Exp $") - - NCURSES_EXPORT_VAR(unsigned) _nc_tracing = 0; /* always define this */ - -@@ -103,9 +103,9 @@ - } - TracePath[size] = '\0'; - assert(strlen(TracePath) <= size); -- strcat(TracePath, "/trace"); -+ _nc_STRCAT(TracePath, "/trace", sizeof(TracePath)); - if (_nc_is_dir_path(TracePath)) { -- strcat(TracePath, ".log"); -+ _nc_STRCAT(TracePath, ".log", sizeof(TracePath)); - } - } - -@@ -121,7 +121,7 @@ - * end of each line. This is useful in case the program dies. - */ - #if HAVE_SETVBUF /* ANSI */ -- (void) setvbuf(TraceFP, (char *) 0, _IOLBF, 0); -+ (void) setvbuf(TraceFP, (char *) 0, _IOLBF, (size_t) 0); - #elif HAVE_SETBUF /* POSIX */ - (void) setbuffer(TraceFP, (char *) 0); - #endif -@@ -185,9 +185,9 @@ - if ((pthread_self)) - # endif - #ifdef __MINGW32__ -- fprintf(TraceFP, "%#lx:", (long) (void *) pthread_self().p); -+ fprintf(TraceFP, "%#lx:", (long) (intptr_t) pthread_self().p); - #else -- fprintf(TraceFP, "%#lx:", (long) (void *) pthread_self()); -+ fprintf(TraceFP, "%#lx:", (long) (intptr_t) pthread_self()); - #endif - #endif - if (before || after) { -@@ -218,7 +218,7 @@ - - /* Trace 'bool' return-values */ - NCURSES_EXPORT(NCURSES_BOOL) --_nc_retrace_bool(NCURSES_BOOL code) -+_nc_retrace_bool(int code) - { - T((T_RETURN("%s"), code ? "TRUE" : "FALSE")); - return code; -@@ -226,10 +226,10 @@ - - /* Trace 'char' return-values */ - NCURSES_EXPORT(char) --_nc_retrace_char(char code) -+_nc_retrace_char(int code) - { - T((T_RETURN("%c"), code)); -- return code; -+ return (char) code; - } - - /* Trace 'int' return-values */ -@@ -339,8 +339,9 @@ - _nc_va_tracef(fmt, ap); - va_end(ap); - -- if (--(_nc_globals.nested_tracef) == 0) -+ if (--(_nc_globals.nested_tracef) == 0) { - _nc_unlock_global(tracef); -+ } - } - #endif /* USE_REENTRANT */ - -diff -Naur ncurses-5.9/ncurses/trace/lib_tracechr.c ncurses-5.9.patch/ncurses/trace/lib_tracechr.c ---- ncurses-5.9/ncurses/trace/lib_tracechr.c 2009-04-19 00:48:29.000000000 +0200 -+++ ncurses-5.9.patch/ncurses/trace/lib_tracechr.c 2014-09-01 16:33:22.455792287 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2008,2009 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2009,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -39,10 +39,12 @@ - - #include <ctype.h> - --MODULE_ID("$Id: lib_tracechr.c,v 1.20 2009/04/18 22:48:29 tom Exp $") -+MODULE_ID("$Id: lib_tracechr.c,v 1.22 2012/02/22 22:40:24 tom Exp $") - - #ifdef TRACE - -+#define MyBufSize sizeof(_nc_globals.tracechr_buf) -+ - NCURSES_EXPORT(char *) - _nc_tracechar(SCREEN *sp, int ch) - { -@@ -55,19 +57,22 @@ - name = safe_keyname(SP_PARM, ch); - if (name == 0 || *name == '\0') - name = "NULL"; -- (void) sprintf(MyBuffer, "'%.30s' = %#03o", name, ch); -+ _nc_SPRINTF(MyBuffer, _nc_SLIMIT(MyBufSize) -+ "'%.30s' = %#03o", name, ch); - } else if (!is8bits(ch) || !isprint(UChar(ch))) { - /* - * workaround for glibc bug: - * sprintf changes the result from unctrl() to an empty string if it - * does not correspond to a valid multibyte sequence. - */ -- (void) sprintf(MyBuffer, "%#03o", ch); -+ _nc_SPRINTF(MyBuffer, _nc_SLIMIT(MyBufSize) -+ "%#03o", ch); - } else { - name = safe_unctrl(SP_PARM, (chtype) ch); - if (name == 0 || *name == 0) - name = "null"; /* shouldn't happen */ -- (void) sprintf(MyBuffer, "'%.30s' = %#03o", name, ch); -+ _nc_SPRINTF(MyBuffer, _nc_SLIMIT(MyBufSize) -+ "'%.30s' = %#03o", name, ch); - } - return (MyBuffer); - } -diff -Naur ncurses-5.9/ncurses/trace/lib_tracedmp.c ncurses-5.9.patch/ncurses/trace/lib_tracedmp.c ---- ncurses-5.9/ncurses/trace/lib_tracedmp.c 2009-04-18 23:01:38.000000000 +0200 -+++ ncurses-5.9.patch/ncurses/trace/lib_tracedmp.c 2014-09-01 16:33:22.455792287 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2008,2009 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2009,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -39,7 +39,7 @@ - #include <curses.priv.h> - #include <ctype.h> - --MODULE_ID("$Id: lib_tracedmp.c,v 1.32 2009/04/18 21:01:38 tom Exp $") -+MODULE_ID("$Id: lib_tracedmp.c,v 1.34 2012/10/27 20:54:42 tom Exp $") - - #ifdef TRACE - -@@ -70,6 +70,8 @@ - if (++width + 1 > (int) my_length) { - my_length = (unsigned) (2 * (width + 1)); - my_buffer = typeRealloc(char, my_length, my_buffer); -+ if (my_buffer == 0) -+ return; - } - - for (n = 0; n <= win->_maxy; ++n) { -@@ -111,7 +113,7 @@ - if (multicolumn) { - ep = my_buffer; - for (j = 0; j < width; ++j) { -- chtype test = WidecExt(win->_line[n].text[j]); -+ int test = WidecExt(win->_line[n].text[j]); - if (test) { - ep[j] = (char) (test + '0'); - } else { -diff -Naur ncurses-5.9/ncurses/trace/lib_tracemse.c ncurses-5.9.patch/ncurses/trace/lib_tracemse.c ---- ncurses-5.9/ncurses/trace/lib_tracemse.c 2011-01-22 20:48:08.000000000 +0100 -+++ ncurses-5.9.patch/ncurses/trace/lib_tracemse.c 2014-09-01 16:33:22.455792287 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2010,2011 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -38,7 +38,7 @@ - - #include <curses.priv.h> - --MODULE_ID("$Id: lib_tracemse.c,v 1.18 2011/01/22 19:48:08 tom Exp $") -+MODULE_ID("$Id: lib_tracemse.c,v 1.21 2012/12/15 23:51:19 tom Exp $") - - #ifdef TRACE - -@@ -47,7 +47,11 @@ - static char * - _trace_mmask_t(SCREEN *sp, mmask_t code) - { --#define SHOW(m, s) if ((code & m) == m) strcat(strcat(my_buffer, s), ", ") -+#define SHOW(m, s) \ -+ if ((code & m) == m) { \ -+ _nc_STRCAT(my_buffer, s, sizeof(my_buffer)); \ -+ _nc_STRCAT(my_buffer, ", ", sizeof(my_buffer)); \ -+ } - - SHOW(BUTTON1_RELEASED, "release-1"); - SHOW(BUTTON1_PRESSED, "press-1"); -@@ -110,23 +114,33 @@ - NCURSES_EXPORT(char *) - _nc_tracemouse(SCREEN *sp, MEVENT const *ep) - { -- (void) sprintf(my_buffer, TRACEMSE_FMT, -- ep->id, -- ep->x, -- ep->y, -- ep->z, -- (unsigned long) ep->bstate); -+ char *result = 0; - -- (void) _trace_mmask_t(sp, ep->bstate); -- (void) strcat(my_buffer, "}"); -- return (my_buffer); -+ if (sp != 0) { -+ _nc_SPRINTF(my_buffer, _nc_SLIMIT(sizeof(my_buffer)) -+ TRACEMSE_FMT, -+ ep->id, -+ ep->x, -+ ep->y, -+ ep->z, -+ (unsigned long) ep->bstate); -+ -+ (void) _trace_mmask_t(sp, ep->bstate); -+ _nc_STRCAT(my_buffer, "}", sizeof(my_buffer)); -+ result = (my_buffer); -+ } -+ return result; - } - - NCURSES_EXPORT(mmask_t) - _nc_retrace_mmask_t(SCREEN *sp, mmask_t code) - { -- *my_buffer = '\0'; -- T((T_RETURN("{%s}"), _trace_mmask_t(sp, code))); -+ if (sp != 0) { -+ *my_buffer = '\0'; -+ T((T_RETURN("{%s}"), _trace_mmask_t(sp, code))); -+ } else { -+ T((T_RETURN("{?}"))); -+ } - return code; - } - -diff -Naur ncurses-5.9/ncurses/trace/trace_buf.c ncurses-5.9.patch/ncurses/trace/trace_buf.c ---- ncurses-5.9/ncurses/trace/trace_buf.c 2011-01-22 20:48:16.000000000 +0100 -+++ ncurses-5.9.patch/ncurses/trace/trace_buf.c 2014-09-01 16:33:22.455792287 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2010,2011 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -35,7 +35,7 @@ - - #include <curses.priv.h> - --MODULE_ID("$Id: trace_buf.c,v 1.17 2011/01/22 19:48:16 tom Exp $") -+MODULE_ID("$Id: trace_buf.c,v 1.20 2012/02/22 22:34:31 tom Exp $") - - #ifdef TRACE - -@@ -103,13 +103,14 @@ - NCURSES_EXPORT(char *) - _nc_trace_bufcat(int bufnum, const char *value) - { -- char *buffer = _nc_trace_alloc(bufnum, 0); -+ char *buffer = _nc_trace_alloc(bufnum, (size_t) 0); - if (buffer != 0) { - size_t have = strlen(buffer); -+ size_t need = strlen(value) + have; - -- buffer = _nc_trace_alloc(bufnum, 1 + have + strlen(value)); -+ buffer = _nc_trace_alloc(bufnum, 1 + need); - if (buffer != 0) -- (void) strcpy(buffer + have, value); -+ _nc_STRCPY(buffer + have, value, need); - - } - return buffer; -diff -Naur ncurses-5.9/ncurses/trace/trace_tries.c ncurses-5.9.patch/ncurses/trace/trace_tries.c ---- ncurses-5.9/ncurses/trace/trace_tries.c 2011-01-09 01:23:27.000000000 +0100 -+++ ncurses-5.9.patch/ncurses/trace/trace_tries.c 2014-09-01 16:33:22.455792287 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1999-2009,2011 Free Software Foundation, Inc. * -+ * Copyright (c) 1999-2011,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -35,7 +35,7 @@ - - #include <curses.priv.h> - --MODULE_ID("$Id: trace_tries.c,v 1.16 2011/01/09 00:23:27 tom Exp $") -+MODULE_ID("$Id: trace_tries.c,v 1.17 2012/10/27 20:50:50 tom Exp $") - - #ifdef TRACE - #define my_buffer _nc_globals.tracetry_buf -@@ -49,28 +49,31 @@ - my_buffer = (unsigned char *) _nc_doalloc(my_buffer, my_length); - } - -- while (tree != 0) { -- if ((my_buffer[level] = tree->ch) == 0) -- my_buffer[level] = 128; -- my_buffer[level + 1] = 0; -- if (tree->value != 0) { -- _tracef("%5d: %s (%s)", tree->value, -- _nc_visbuf((char *) my_buffer), keyname(tree->value)); -+ if (my_buffer != 0) { -+ while (tree != 0) { -+ if ((my_buffer[level] = tree->ch) == 0) -+ my_buffer[level] = 128; -+ my_buffer[level + 1] = 0; -+ if (tree->value != 0) { -+ _tracef("%5d: %s (%s)", tree->value, -+ _nc_visbuf((char *) my_buffer), keyname(tree->value)); -+ } -+ if (tree->child) -+ recur_tries(tree->child, level + 1); -+ tree = tree->sibling; - } -- if (tree->child) -- recur_tries(tree->child, level + 1); -- tree = tree->sibling; - } - } - - NCURSES_EXPORT(void) - _nc_trace_tries(TRIES * tree) - { -- my_buffer = typeMalloc(unsigned char, my_length = 80); -- _tracef("BEGIN tries %p", (void *) tree); -- recur_tries(tree, 0); -- _tracef(". . . tries %p", (void *) tree); -- free(my_buffer); -+ if ((my_buffer = typeMalloc(unsigned char, my_length = 80)) != 0) { -+ _tracef("BEGIN tries %p", (void *) tree); -+ recur_tries(tree, 0); -+ _tracef(". . . tries %p", (void *) tree); -+ free(my_buffer); -+ } - } - - #else -diff -Naur ncurses-5.9/ncurses/trace/varargs.c ncurses-5.9.patch/ncurses/trace/varargs.c ---- ncurses-5.9/ncurses/trace/varargs.c 2008-11-16 01:19:59.000000000 +0100 -+++ ncurses-5.9.patch/ncurses/trace/varargs.c 2014-09-01 16:33:22.455792287 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 2001-2007,2008 Free Software Foundation, Inc. * -+ * Copyright (c) 2001-2008,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -34,7 +34,7 @@ - - #include <ctype.h> - --MODULE_ID("$Id: varargs.c,v 1.8 2008/11/16 00:19:59 juergen Exp $") -+MODULE_ID("$Id: varargs.c,v 1.11 2012/10/27 21:03:28 tom Exp $") - - #ifdef TRACE - -@@ -149,25 +149,32 @@ - param = buffer; - switch (used) { - case atInteger: -- sprintf(buffer, "%d", ival); -+ _nc_SPRINTF(buffer, _nc_SLIMIT(sizeof(buffer)) -+ "%d", ival); - break; - case atFloat: -- sprintf(buffer, "%f", fval); -+ _nc_SPRINTF(buffer, _nc_SLIMIT(sizeof(buffer)) -+ "%f", fval); - break; - case atPoint: -- sprintf(buffer, "%p", pval); -+ _nc_SPRINTF(buffer, _nc_SLIMIT(sizeof(buffer)) -+ "%p", pval); - break; - case atString: - param = _nc_visbuf2(1, sval); - break; - case atUnknown: - default: -- strcpy(buffer, "?"); -+ _nc_STRCPY(buffer, "?", sizeof(buffer)); - break; - } - MyLength += strlen(param) + 2; - MyBuffer = typeRealloc(char, MyLength, MyBuffer); -- sprintf(MyBuffer + strlen(MyBuffer), ", %s", param); -+ if (MyBuffer != 0) { -+ _nc_SPRINTF(MyBuffer + strlen(MyBuffer), -+ _nc_SLIMIT(MyLength - strlen(MyBuffer)) -+ ", %s", param); -+ } - } - } - used = atUnknown; -@@ -177,7 +184,7 @@ - } - } - -- return (MyBuffer); -+ return (MyBuffer ? MyBuffer : dummy); - } - #else - EMPTY_MODULE(_nc_varargs) -diff -Naur ncurses-5.9/ncurses/trace/visbuf.c ncurses-5.9.patch/ncurses/trace/visbuf.c ---- ncurses-5.9/ncurses/trace/visbuf.c 2010-05-29 20:51:41.000000000 +0200 -+++ ncurses-5.9.patch/ncurses/trace/visbuf.c 2014-09-01 16:33:22.455792287 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 2001-2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 2001-2012,2014 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -42,7 +42,7 @@ - #include <tic.h> - #include <ctype.h> - --MODULE_ID("$Id: visbuf.c,v 1.37 2010/05/29 18:51:41 tom Exp $") -+MODULE_ID("$Id: visbuf.c,v 1.43 2014/02/23 01:21:08 tom Exp $") - - #define NUM_VISBUFS 4 - -@@ -55,13 +55,21 @@ - static const char r_brace[] = StringOf(R_BRACE); - #endif - -+#if USE_STRING_HACKS && HAVE_SNPRINTF -+#define VisChar(tp, chr, limit) _nc_vischar(tp, chr, limit) -+#define LIMIT_ARG ,size_t limit -+#else -+#define VisChar(tp, chr, limit) _nc_vischar(tp, chr) -+#define LIMIT_ARG /* nothing */ -+#endif -+ - static char * --_nc_vischar(char *tp, unsigned c) -+_nc_vischar(char *tp, unsigned c LIMIT_ARG) - { - if (c == '"' || c == '\\') { - *tp++ = '\\'; - *tp++ = (char) c; -- } else if (is7bits(c) && (isgraph(c) || c == ' ')) { -+ } else if (is7bits((int)c) && (isgraph((int)c) || c == ' ')) { - *tp++ = (char) c; - } else if (c == '\n') { - *tp++ = '\\'; -@@ -84,7 +92,8 @@ - *tp++ = '^'; - *tp++ = (char) ('@' + c); - } else { -- sprintf(tp, "\\%03lo", (unsigned long) ChCharOf(c)); -+ _nc_SPRINTF(tp, _nc_SLIMIT(limit) -+ "\\%03lo", (unsigned long) ChCharOf(c)); - tp += strlen(tp); - } - *tp = 0; -@@ -97,6 +106,7 @@ - const char *vbuf = 0; - char *tp; - int c; -+ int count; - - if (buf == 0) - return ("(null)"); -@@ -106,6 +116,7 @@ - if (len < 0) - len = (int) strlen(buf); - -+ count = len; - #ifdef TRACE - vbuf = tp = _nc_trace_buf(bufnum, NormalLen(len)); - #else -@@ -124,8 +135,8 @@ - #endif - if (tp != 0) { - *tp++ = D_QUOTE; -- while ((--len >= 0) && (c = *buf++) != '\0') { -- tp = _nc_vischar(tp, UChar(c)); -+ while ((--count >= 0) && (c = *buf++) != '\0') { -+ tp = VisChar(tp, UChar(c), NormalLen(len)); - } - *tp++ = D_QUOTE; - *tp = '\0'; -@@ -175,6 +186,7 @@ - const char *vbuf; - char *tp; - wchar_t c; -+ int count; - - if (buf == 0) - return ("(null)"); -@@ -182,6 +194,7 @@ - if (len < 0) - len = (int) wcslen(buf); - -+ count = len; - #ifdef TRACE - vbuf = tp = _nc_trace_buf(bufnum, WideLen(len)); - #else -@@ -193,15 +206,16 @@ - #endif - if (tp != 0) { - *tp++ = D_QUOTE; -- while ((--len >= 0) && (c = *buf++) != '\0') { -+ while ((--count >= 0) && (c = *buf++) != '\0') { - char temp[CCHARW_MAX + 80]; - int j = wctomb(temp, c), k; - if (j <= 0) { -- sprintf(temp, "\\u%08X", (unsigned) c); -+ _nc_SPRINTF(temp, _nc_SLIMIT(sizeof(temp)) -+ "\\u%08X", (unsigned) c); - j = (int) strlen(temp); - } - for (k = 0; k < j; ++k) { -- tp = _nc_vischar(tp, UChar(temp[k])); -+ tp = VisChar(tp, UChar(temp[k]), WideLen(len)); - } - } - *tp++ = D_QUOTE; -@@ -248,10 +262,12 @@ - else - mybuf = typeMalloc(wchar_t, mylen); - } -- for (n = 0; buf[n] != 0; ++n) { -- mybuf[n] = (wchar_t) buf[n]; -+ if (mybuf != 0) { -+ for (n = 0; buf[n] != 0; ++n) { -+ mybuf[n] = (wchar_t) buf[n]; -+ } -+ mybuf[n] = L'\0'; - } -- mybuf[n] = L'\0'; - - return _nc_viswbuf2(0, mybuf); - } -@@ -261,7 +277,7 @@ - NCURSES_EXPORT(const char *) - _nc_viscbuf2(int bufnum, const NCURSES_CH_T * buf, int len) - { -- char *result = _nc_trace_buf(bufnum, BUFSIZ); -+ char *result = _nc_trace_buf(bufnum, (size_t) BUFSIZ); - int first; - const char *found; - -@@ -315,7 +331,7 @@ - break; - for (k = 0; k < PUTC_n; k++) { - char temp[80]; -- _nc_vischar(temp, UChar(PUTC_buf[k])); -+ VisChar(temp, UChar(PUTC_buf[k]), sizeof(temp)); - (void) _nc_trace_bufcat(bufnum, temp); - } - } -@@ -323,8 +339,8 @@ - #else - { - char temp[80]; -- _nc_vischar(temp, UChar(buf[j])); -- result = _nc_trace_bufcat(bufnum, temp); -+ VisChar(temp, UChar(buf[j]), sizeof(temp)); -+ (void) _nc_trace_bufcat(bufnum, temp); - } - #endif /* USE_WIDEC_SUPPORT */ - } -diff -Naur ncurses-5.9/ncurses/tty/hardscroll.c ncurses-5.9.patch/ncurses/tty/hardscroll.c ---- ncurses-5.9/ncurses/tty/hardscroll.c 2010-04-25 01:46:47.000000000 +0200 -+++ ncurses-5.9.patch/ncurses/tty/hardscroll.c 2014-09-01 16:33:22.456792288 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -147,7 +147,7 @@ - - #include <curses.priv.h> - --MODULE_ID("$Id: hardscroll.c,v 1.47 2010/04/24 23:46:47 tom Exp $") -+MODULE_ID("$Id: hardscroll.c,v 1.51 2012/10/17 09:01:10 tom Exp $") - - #if defined(SCROLLDEBUG) || defined(HASHDEBUG) - -@@ -173,9 +173,9 @@ - # if USE_HASHMAP - # define oldnums(sp) (sp)->_oldnum_list - # define OLDNUM(sp,n) oldnums(sp)[n] --# else /* !USE_HASHMAP */ -+# else /* !USE_HASHMAP */ - # define OLDNUM(sp,n) NewScreen(sp)->_line[n].oldindex --# endif /* !USE_HASHMAP */ -+# endif /* !USE_HASHMAP */ - - #define OLDNUM_SIZE(sp) (sp)->_oldnum_size - -@@ -193,14 +193,20 @@ - #if !defined(SCROLLDEBUG) && !defined(HASHDEBUG) - #if USE_HASHMAP - /* get enough storage */ -- if (OLDNUM_SIZE(SP_PARM) < screen_lines(SP_PARM)) { -+ assert(OLDNUM_SIZE(SP_PARM) >= 0); -+ assert(screen_lines(SP_PARM) > 0); -+ if ((oldnums(SP_PARM) == 0) -+ || (OLDNUM_SIZE(SP_PARM) < screen_lines(SP_PARM))) { -+ int need_lines = ((OLDNUM_SIZE(SP_PARM) < screen_lines(SP_PARM)) -+ ? screen_lines(SP_PARM) -+ : OLDNUM_SIZE(SP_PARM)); - int *new_oldnums = typeRealloc(int, -- (size_t) screen_lines(SP_PARM), -+ (size_t) need_lines, - oldnums(SP_PARM)); - if (!new_oldnums) - return; - oldnums(SP_PARM) = new_oldnums; -- OLDNUM_SIZE(SP_PARM) = screen_lines(SP_PARM); -+ OLDNUM_SIZE(SP_PARM) = need_lines; - } - /* calculate the indices */ - NCURSES_SP_NAME(_nc_hash_map) (NCURSES_SP_ARG); -@@ -302,7 +308,9 @@ - - *buf = '\0'; - for (n = 0; n < screen_lines(SP_PARM); n++) -- (void) sprintf(buf + strlen(buf), " %02d", OLDNUM(SP_PARM, n)); -+ _nc_SPRINTF(buf + strlen(buf), -+ _nc_SLIMIT(want - strlen(buf)) -+ " %02d", OLDNUM(SP_PARM, n)); - TR(TRACE_UPDATE | TRACE_MOVE, ("virt %s", buf)); - free(buf); - } -diff -Naur ncurses-5.9/ncurses/tty/hashmap.c ncurses-5.9.patch/ncurses/tty/hashmap.c ---- ncurses-5.9/ncurses/tty/hashmap.c 2010-04-25 01:46:07.000000000 +0200 -+++ ncurses-5.9.patch/ncurses/tty/hashmap.c 2014-09-01 16:33:22.456792288 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2010,2011 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -73,7 +73,7 @@ - #define CUR SP_TERMTYPE - #endif - --MODULE_ID("$Id: hashmap.c,v 1.62 2010/04/24 23:46:07 tom Exp $") -+MODULE_ID("$Id: hashmap.c,v 1.63 2011/10/22 16:34:50 tom Exp $") - - #ifdef HASHDEBUG - -@@ -163,7 +163,7 @@ - * effective. 'blank' indicates whether the line 'to' would become blank. - */ - static NCURSES_INLINE bool --cost_effective(SCREEN *sp, const int from, const int to, const bool blank) -+cost_effective(SCREEN *sp, const int from, const int to, const int blank) - { - int new_from; - -diff -Naur ncurses-5.9/ncurses/tty/lib_mvcur.c ncurses-5.9.patch/ncurses/tty/lib_mvcur.c ---- ncurses-5.9/ncurses/tty/lib_mvcur.c 2011-01-22 20:48:21.000000000 +0100 -+++ ncurses-5.9.patch/ncurses/tty/lib_mvcur.c 2014-09-01 16:33:22.456792288 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2010,2011 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2013,2014 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -159,7 +159,7 @@ - #define CUR SP_TERMTYPE - #endif - --MODULE_ID("$Id: lib_mvcur.c,v 1.126 2011/01/22 19:48:21 tom Exp $") -+MODULE_ID("$Id: lib_mvcur.c,v 1.134 2014/03/08 20:32:59 tom Exp $") - - #define WANT_CHAR(sp, y, x) NewScreen(sp)->_line[y].text[x] /* desired state */ - -@@ -176,6 +176,9 @@ - static float diff; - #endif /* MAIN */ - -+#undef NCURSES_OUTC_FUNC -+#define NCURSES_OUTC_FUNC myOutCh -+ - #define OPT_SIZE 512 - - static int normalized_cost(NCURSES_SP_DCLx const char *const cap, int affcnt); -@@ -274,10 +277,9 @@ - /* Set the scroll-region to a known state (the default) */ - { - if (change_scroll_region) { -- NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx -- "change_scroll_region", -- TPARM_2(change_scroll_region, -- 0, screen_lines(SP_PARM) - 1)); -+ NCURSES_PUTP2("change_scroll_region", -+ TPARM_2(change_scroll_region, -+ 0, screen_lines(SP_PARM) - 1)); - } - } - -@@ -285,14 +287,12 @@ - NCURSES_SP_NAME(_nc_mvcur_resume) (NCURSES_SP_DCL0) - /* what to do at initialization time and after each shellout */ - { -- if (SP_PARM && !IsTermInfo(SP_PARM)) -+ if (!SP_PARM || !IsTermInfo(SP_PARM)) - return; - - /* initialize screen for cursor access */ - if (enter_ca_mode) { -- NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx -- "enter_ca_mode", -- enter_ca_mode); -+ NCURSES_PUTP2("enter_ca_mode", enter_ca_mode); - } - - /* -@@ -327,13 +327,14 @@ - NCURSES_SP_NAME(_nc_mvcur_init) (NCURSES_SP_DCL0) - /* initialize the cost structure */ - { -- if (SP_PARM->_ofp && isatty(fileno(SP_PARM->_ofp))) -+ if (SP_PARM->_ofp && isatty(fileno(SP_PARM->_ofp))) { - SP_PARM->_char_padding = ((BAUDBYTE * 1000 * 10) - / (BAUDRATE(SP_PARM) > 0 - ? BAUDRATE(SP_PARM) - : 9600)); -- else -+ } else { - SP_PARM->_char_padding = 1; /* must be nonzero */ -+ } - if (SP_PARM->_char_padding <= 0) - SP_PARM->_char_padding = 1; /* must be nonzero */ - TR(TRACE_CHARPUT | TRACE_MOVE, ("char_padding %d msecs", SP_PARM->_char_padding)); -@@ -481,9 +482,7 @@ - } - - if (exit_ca_mode) { -- NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx -- "exit_ca_mode", -- exit_ca_mode); -+ NCURSES_PUTP2("exit_ca_mode", exit_ca_mode); - } - /* - * Reset terminal's tab counter. There's a long-time bug that -@@ -549,7 +548,7 @@ - int from_x, - int to_y, - int to_x, -- bool ovw) -+ int ovw) - /* move via local motions (cuu/cuu1/cud/cud1/cub1/cub/cuf1/cuf/vpa/hpa) */ - { - string_desc save; -@@ -770,7 +769,10 @@ - */ - - static NCURSES_INLINE int --onscreen_mvcur(NCURSES_SP_DCLx int yold, int xold, int ynew, int xnew, bool ovw) -+onscreen_mvcur(NCURSES_SP_DCLx -+ int yold, int xold, -+ int ynew, int xnew, int ovw, -+ NCURSES_SP_OUTC myOutCh) - /* onscreen move from (yold, xold) to (ynew, xnew) */ - { - string_desc result; -@@ -935,7 +937,7 @@ - if (usecost != INFINITY) { - TPUTS_TRACE("mvcur"); - NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx -- buffer, 1, NCURSES_SP_NAME(_nc_outch)); -+ buffer, 1, myOutCh); - SP_PARM->_cursrow = ynew; - SP_PARM->_curscol = xnew; - return (OK); -@@ -943,9 +945,15 @@ - return (ERR); - } - --NCURSES_EXPORT(int) --TINFO_MVCUR(NCURSES_SP_DCLx int yold, int xold, int ynew, int xnew) --/* optimized cursor move from (yold, xold) to (ynew, xnew) */ -+/* -+ * optimized cursor move from (yold, xold) to (ynew, xnew) -+ */ -+static int -+_nc_real_mvcur(NCURSES_SP_DCLx -+ int yold, int xold, -+ int ynew, int xnew, -+ NCURSES_SP_OUTC myOutCh, -+ int ovw) - { - NCURSES_CH_T oldattr; - int code; -@@ -994,20 +1002,18 @@ - - if (l > 0) { - if (carriage_return) { -- NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx -- "carriage_return", -- carriage_return); -- } else -- NCURSES_SP_NAME(_nc_outch) (NCURSES_SP_ARGx '\r'); -+ NCURSES_PUTP2("carriage_return", carriage_return); -+ } else { -+ myOutCh(NCURSES_SP_ARGx '\r'); -+ } - xold = 0; - - while (l > 0) { - if (newline) { -- NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx -- "newline", -- newline); -- } else -- NCURSES_SP_NAME(_nc_outch) (NCURSES_SP_ARGx '\n'); -+ NCURSES_PUTP2("newline", newline); -+ } else { -+ myOutCh(NCURSES_SP_ARGx '\n'); -+ } - l--; - } - } -@@ -1027,7 +1033,7 @@ - ynew = screen_lines(SP_PARM) - 1; - - /* destination location is on screen now */ -- code = onscreen_mvcur(NCURSES_SP_ARGx yold, xold, ynew, xnew, TRUE); -+ code = onscreen_mvcur(NCURSES_SP_ARGx yold, xold, ynew, xnew, ovw, myOutCh); - - /* - * Restore attributes if we disabled them before moving. -@@ -1042,13 +1048,66 @@ - returnCode(code); - } - --#if NCURSES_SP_FUNCS && !defined(USE_TERM_DRIVER) -+/* -+ * These entrypoints are used within the library. -+ */ -+NCURSES_EXPORT(int) -+NCURSES_SP_NAME(_nc_mvcur) (NCURSES_SP_DCLx -+ int yold, int xold, -+ int ynew, int xnew) -+{ -+ return _nc_real_mvcur(NCURSES_SP_ARGx yold, xold, ynew, xnew, -+ NCURSES_SP_NAME(_nc_outch), -+ TRUE); -+} -+ -+#if NCURSES_SP_FUNCS -+NCURSES_EXPORT(int) -+_nc_mvcur(int yold, int xold, -+ int ynew, int xnew) -+{ -+ return NCURSES_SP_NAME(_nc_mvcur) (CURRENT_SCREEN, yold, xold, ynew, xnew); -+} -+#endif -+ -+#if defined(USE_TERM_DRIVER) -+/* -+ * The terminal driver does not support the external "mvcur()". -+ */ -+NCURSES_EXPORT(int) -+TINFO_MVCUR(NCURSES_SP_DCLx int yold, int xold, int ynew, int xnew) -+{ -+ return _nc_real_mvcur(NCURSES_SP_ARGx -+ yold, xold, -+ ynew, xnew, -+ NCURSES_SP_NAME(_nc_outch), -+ TRUE); -+} -+ -+#else /* !USE_TERM_DRIVER */ -+ -+/* -+ * These entrypoints support users of the library. -+ */ -+NCURSES_EXPORT(int) -+NCURSES_SP_NAME(mvcur) (NCURSES_SP_DCLx int yold, int xold, int ynew, -+ int xnew) -+{ -+ return _nc_real_mvcur(NCURSES_SP_ARGx -+ yold, xold, -+ ynew, xnew, -+ NCURSES_SP_NAME(_nc_putchar), -+ FALSE); -+} -+ -+#if NCURSES_SP_FUNCS - NCURSES_EXPORT(int) - mvcur(int yold, int xold, int ynew, int xnew) - { - return NCURSES_SP_NAME(mvcur) (CURRENT_SCREEN, yold, xold, ynew, xnew); - } - #endif -+#endif /* USE_TERM_DRIVER */ - - #if defined(TRACE) || defined(NCURSES_TEST) - NCURSES_EXPORT_VAR(int) _nc_optimize_enable = OPTIMIZE_ALL; -@@ -1128,7 +1187,6 @@ - baudrate(); - - _nc_mvcur_init(); -- NC_BUFFERED(FALSE); - - (void) puts("The mvcur tester. Type ? for help"); - -diff -Naur ncurses-5.9/ncurses/tty/lib_tstp.c ncurses-5.9.patch/ncurses/tty/lib_tstp.c ---- ncurses-5.9/ncurses/tty/lib_tstp.c 2010-05-15 23:31:12.000000000 +0200 -+++ ncurses-5.9.patch/ncurses/tty/lib_tstp.c 2014-09-01 16:33:22.456792288 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -42,11 +42,7 @@ - - #include <SigAction.h> - --#if SVR4_ACTION && !defined(_POSIX_SOURCE) --#define _POSIX_SOURCE --#endif -- --MODULE_ID("$Id: lib_tstp.c,v 1.41 2010/05/15 21:31:12 tom Exp $") -+MODULE_ID("$Id: lib_tstp.c,v 1.47 2013/04/27 19:50:17 tom Exp $") - - #if defined(SIGTSTP) && (HAVE_SIGACTION || HAVE_SIGVEC) - #define USE_SIGTSTP 1 -@@ -138,7 +134,7 @@ - - #if USE_SIGTSTP - static void --tstp(int dummy GCC_UNUSED) -+handle_SIGTSTP(int dummy GCC_UNUSED) - { - SCREEN *sp = CURRENT_SCREEN; - sigset_t mask, omask; -@@ -148,7 +144,8 @@ - int sigttou_blocked; - #endif - -- T(("tstp() called")); -+ _nc_globals.have_sigtstp = 1; -+ T(("handle_SIGTSTP() called")); - - /* - * The user may have changed the prog_mode tty bits, so save them. -@@ -239,21 +236,24 @@ - #endif /* USE_SIGTSTP */ - - static void --cleanup(int sig) -+handle_SIGINT(int sig) - { - SCREEN *sp = CURRENT_SCREEN; - - /* -- * Actually, doing any sort of I/O from within an signal handler is -- * "unsafe". But we'll _try_ to clean up the screen and terminal -- * settings on the way out. -+ * Much of this is unsafe from a signal handler. But we'll _try_ to clean -+ * up the screen and terminal settings on the way out. -+ * -+ * There are at least the following problems: -+ * 1) Walking the SCREEN list is unsafe, since all list management -+ * is done without any signal blocking. -+ * 2) On systems which have REENTRANT turned on, set_term() uses -+ * _nc_lock_global() which could deadlock or misbehave in other ways. -+ * 3) endwin() calls all sorts of stuff, many of which use stdio or -+ * other library functions which are clearly unsafe. - */ - if (!_nc_globals.cleanup_nested++ -- && (sig == SIGINT --#ifdef SIGQUIT -- || sig == SIGQUIT --#endif -- )) { -+ && (sig == SIGINT || sig == SIGTERM)) { - #if HAVE_SIGACTION || HAVE_SIGVEC - sigaction_t act; - sigemptyset(&act.sa_mask); -@@ -268,22 +268,21 @@ - for (each_screen(scan)) { - if (scan->_ofp != 0 - && isatty(fileno(scan->_ofp))) { -- scan->_cleanup = TRUE; - scan->_outch = NCURSES_SP_NAME(_nc_outch); - } - set_term(scan); - NCURSES_SP_NAME(endwin) (NCURSES_SP_ARG); - if (sp) -- sp->_endwin = FALSE; /* in case we have an atexit! */ -+ sp->_endwin = FALSE; /* in case of reuse */ - } - } - } -- exit(EXIT_FAILURE); -+ _exit(EXIT_FAILURE); - } - - #if USE_SIGWINCH - static void --sigwinch(int sig GCC_UNUSED) -+handle_SIGWINCH(int sig GCC_UNUSED) - { - _nc_globals.have_sigwinch = 1; - # if USE_PTHREADS_EINTR -@@ -301,7 +300,7 @@ - * handler. - */ - static int --CatchIfDefault(int sig, RETSIGTYPE (*handler) (int)) -+CatchIfDefault(int sig, void (*handler) (int)) - { - int result; - #if HAVE_SIGACTION || HAVE_SIGVEC -@@ -331,7 +330,7 @@ - result = FALSE; - } - #else /* !HAVE_SIGACTION */ -- RETSIGTYPE (*ohandler) (int); -+ void (*ohandler) (int); - - ohandler = signal(sig, SIG_IGN); - if (ohandler == SIG_DFL -@@ -364,7 +363,7 @@ - * the caller later changes its mind, but that doesn't seem correct. - */ - NCURSES_EXPORT(void) --_nc_signal_handler(bool enable) -+_nc_signal_handler(int enable) - { - T((T_CALLED("_nc_signal_handler(%d)"), enable)); - #if USE_SIGTSTP /* Xenix 2.x doesn't have SIGTSTP, for example */ -@@ -385,7 +384,7 @@ - #ifdef SA_RESTART - new_sigaction.sa_flags |= SA_RESTART; - #endif /* SA_RESTART */ -- new_sigaction.sa_handler = tstp; -+ new_sigaction.sa_handler = handle_SIGTSTP; - (void) sigaction(SIGTSTP, &new_sigaction, NULL); - } else { - ignore_tstp = TRUE; -@@ -396,10 +395,10 @@ - - if (!_nc_globals.init_signals) { - if (enable) { -- CatchIfDefault(SIGINT, cleanup); -- CatchIfDefault(SIGTERM, cleanup); -+ CatchIfDefault(SIGINT, handle_SIGINT); -+ CatchIfDefault(SIGTERM, handle_SIGINT); - #if USE_SIGWINCH -- CatchIfDefault(SIGWINCH, sigwinch); -+ CatchIfDefault(SIGWINCH, handle_SIGWINCH); - #endif - _nc_globals.init_signals = TRUE; - } -diff -Naur ncurses-5.9/ncurses/tty/lib_twait.c ncurses-5.9.patch/ncurses/tty/lib_twait.c ---- ncurses-5.9/ncurses/tty/lib_twait.c 2010-12-26 00:43:58.000000000 +0100 -+++ ncurses-5.9.patch/ncurses/tty/lib_twait.c 2014-09-01 16:33:22.456792288 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2013,2014 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -53,6 +53,11 @@ - #include <OS.h> - #endif - -+#if USE_KLIBC_KBD -+#define INCL_KBD -+#include <os2.h> -+#endif -+ - #if USE_FUNC_POLL - # if HAVE_SYS_TIME_H - # include <sys/time.h> -@@ -70,10 +75,10 @@ - #endif - #undef CUR - --MODULE_ID("$Id: lib_twait.c,v 1.61 2010/12/25 23:43:58 tom Exp $") -+MODULE_ID("$Id: lib_twait.c,v 1.68 2014/03/08 20:32:59 tom Exp $") - - static long --_nc_gettime(TimeType * t0, bool first) -+_nc_gettime(TimeType * t0, int first) - { - long res; - -@@ -97,7 +102,7 @@ - if (first) { - *t0 = t1; - } -- res = (t1 - *t0) * 1000; -+ res = (long) ((t1 - *t0) * 1000); - #endif - TR(TRACE_IEVENT, ("%s time: %ld msec", first ? "get" : "elapsed", res)); - return res; -@@ -184,6 +189,12 @@ - fd_set set; - #endif - -+#if USE_KLIBC_KBD -+ fd_set saved_set; -+ KBDKEYINFO ki; -+ struct timeval tv; -+#endif -+ - long starttime, returntime; - - TR(TRACE_IEVENT, ("start twait: %d milliseconds, mode: %d", -@@ -207,6 +218,7 @@ - starttime = _nc_gettime(&t0, TRUE); - - count = 0; -+ (void) count; - - #ifdef NCURSES_WGETCH_EVENTS - if ((mode & TW_EVENT) && evl) -@@ -217,8 +229,11 @@ - memset(fd_list, 0, sizeof(fd_list)); - - #ifdef NCURSES_WGETCH_EVENTS -- if ((mode & TW_EVENT) && evl) -+ if ((mode & TW_EVENT) && evl) { - fds = typeMalloc(struct pollfd, MIN_FDS + evl->count); -+ if (fds == 0) -+ return TW_NONE; -+ } - #endif - - if (mode & TW_INPUT) { -@@ -247,7 +262,7 @@ - } - #endif - -- result = poll(fds, (unsigned) count, milliseconds); -+ result = poll(fds, (size_t) count, milliseconds); - - #ifdef NCURSES_WGETCH_EVENTS - if ((mode & TW_EVENT) && evl) { -@@ -274,10 +289,6 @@ - } - } - } -- -- if (fds != fd_list) -- free((char *) fds); -- - #endif - - #elif defined(__BEOS__) -@@ -329,10 +340,12 @@ - */ - FD_ZERO(&set); - -+#if !USE_KLIBC_KBD - if (mode & TW_INPUT) { - FD_SET(sp->_ifd, &set); - count = sp->_ifd + 1; - } -+#endif - if ((mode & TW_MOUSE) - && (fd = sp->_mouse_fd) >= 0) { - FD_SET(fd, &set); -@@ -352,6 +365,31 @@ - } - #endif - -+#if USE_KLIBC_KBD -+ for (saved_set = set;; set = saved_set) { -+ if ((mode & TW_INPUT) -+ && (sp->_extended_key -+ || (KbdPeek(&ki, 0) == 0 -+ && (ki.fbStatus & KBDTRF_FINAL_CHAR_IN)))) { -+ FD_ZERO(&set); -+ FD_SET(sp->_ifd, &set); -+ result = 1; -+ break; -+ } -+ -+ tv.tv_sec = 0; -+ tv.tv_usec = (milliseconds == 0) ? 0 : (10 * 1000); -+ -+ if ((result = select(count, &set, NULL, NULL, &tv)) != 0) -+ break; -+ -+ /* Time out ? */ -+ if (milliseconds >= 0 && _nc_gettime(&t0, FALSE) >= milliseconds) { -+ result = 0; -+ break; -+ } -+ } -+#else - if (milliseconds >= 0) { - struct timeval ntimeout; - ntimeout.tv_sec = milliseconds / 1000; -@@ -360,6 +398,7 @@ - } else { - result = select(count, &set, NULL, NULL, NULL); - } -+#endif - - #ifdef NCURSES_WGETCH_EVENTS - if ((mode & TW_EVENT) && evl) { -@@ -462,5 +501,12 @@ - result |= TW_EVENT; - #endif - -+#if USE_FUNC_POLL -+#ifdef NCURSES_WGETCH_EVENTS -+ if (fds != fd_list) -+ free((char *) fds); -+#endif -+#endif -+ - return (result); - } -diff -Naur ncurses-5.9/ncurses/tty/lib_vidattr.c ncurses-5.9.patch/ncurses/tty/lib_vidattr.c ---- ncurses-5.9/ncurses/tty/lib_vidattr.c 2010-06-06 00:22:04.000000000 +0200 -+++ ncurses-5.9.patch/ncurses/tty/lib_vidattr.c 2014-09-01 16:33:22.457792290 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2013,2014 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -69,27 +69,27 @@ - #define CUR SP_TERMTYPE - #endif - --MODULE_ID("$Id: lib_vidattr.c,v 1.61 2010/06/05 22:22:04 tom Exp $") -+MODULE_ID("$Id: lib_vidattr.c,v 1.68 2014/03/08 20:32:59 tom Exp $") - - #define doPut(mode) \ - TPUTS_TRACE(#mode); \ - NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx mode, 1, outc) - --#define TurnOn(mask,mode) \ -+#define TurnOn(mask, mode) \ - if ((turn_on & mask) && mode) { doPut(mode); } - --#define TurnOff(mask,mode) \ -+#define TurnOff(mask, mode) \ - if ((turn_off & mask) && mode) { doPut(mode); turn_off &= ~mask; } - - /* if there is no current screen, assume we *can* do color */ --#define SetColorsIf(why,old_attr) \ -+#define SetColorsIf(why, old_attr) \ - if (can_color && (why)) { \ - int old_pair = PairNumber(old_attr); \ - TR(TRACE_ATTRS, ("old pair = %d -- new pair = %d", old_pair, pair)); \ - if ((pair != old_pair) \ - || (fix_pair0 && (pair == 0)) \ - || (reverse ^ ((old_attr & A_REVERSE) != 0))) { \ -- NCURSES_SP_NAME(_nc_do_color)(NCURSES_SP_ARGx \ -+ NCURSES_SP_NAME(_nc_do_color) (NCURSES_SP_ARGx \ - (short) old_pair, \ - (short) pair, \ - reverse, outc); \ -@@ -139,6 +139,9 @@ - A_BOLD, - A_INVIS, - A_PROTECT, -+#if USE_ITALIC -+ A_ITALIC, -+#endif - }; - unsigned n; - int used = 0; -@@ -229,6 +232,11 @@ - if (!SP_PARM || SP_PARM->_use_rmso) { - TurnOff(A_STANDOUT, exit_standout_mode); - } -+#if USE_ITALIC -+ if (!SP_PARM || SP_PARM->_use_ritm) { -+ TurnOff(A_ITALIC, exit_italics_mode); -+ } -+#endif - } - PreviousAttr &= ALL_BUT_COLOR; - } -@@ -251,6 +259,15 @@ - 1, outc); - PreviousAttr &= ALL_BUT_COLOR; - } -+#if USE_ITALIC -+ if (!SP_PARM || SP_PARM->_use_ritm) { -+ if (turn_on & A_ITALIC) { -+ TurnOn(A_ITALIC, enter_italics_mode); -+ } else if (turn_off & A_ITALIC) { -+ TurnOff(A_ITALIC, exit_italics_mode); -+ } -+ } -+#endif - SetColorsIf((pair != 0) || fix_pair0, PreviousAttr); - } else { - -@@ -265,7 +282,11 @@ - if (!SP_PARM || SP_PARM->_use_rmso) { - TurnOff(A_STANDOUT, exit_standout_mode); - } -- -+#if USE_ITALIC -+ if (!SP_PARM || SP_PARM->_use_ritm) { -+ TurnOff(A_ITALIC, exit_italics_mode); -+ } -+#endif - if (turn_off && exit_attribute_mode) { - doPut(exit_attribute_mode); - turn_on |= (newmode & ALL_BUT_COLOR); -@@ -284,6 +305,9 @@ - TurnOn(A_PROTECT, enter_protected_mode); - TurnOn(A_INVIS, enter_secure_mode); - TurnOn(A_UNDERLINE, enter_underline_mode); -+#if USE_ITALIC -+ TurnOn(A_ITALIC, enter_italics_mode); -+#endif - #if USE_WIDEC_SUPPORT - TurnOn(A_HORIZONTAL, enter_horizontal_hl_mode); - TurnOn(A_LEFT, enter_left_hl_mode); -@@ -324,7 +348,7 @@ - T((T_CALLED("vidattr(%p,%s)"), (void *) SP_PARM, _traceattr(newmode))); - returnCode(NCURSES_SP_NAME(vidputs) (NCURSES_SP_ARGx - newmode, -- NCURSES_SP_NAME(_nc_outch))); -+ NCURSES_SP_NAME(_nc_putchar))); - } - - #if NCURSES_SP_FUNCS -@@ -341,42 +365,49 @@ - chtype attrs = A_NORMAL; - - T((T_CALLED("termattrs(%p)"), (void *) SP_PARM)); -+ -+ if (HasTerminal(SP_PARM)) { - #ifdef USE_TERM_DRIVER -- if (HasTerminal(SP_PARM)) -- attrs = CallDriver(SP_PARM, conattr); --#else -+ attrs = CallDriver(SP_PARM, td_conattr); -+#else /* ! USE_TERM_DRIVER */ - -- if (enter_alt_charset_mode) -- attrs |= A_ALTCHARSET; -+ if (enter_alt_charset_mode) -+ attrs |= A_ALTCHARSET; - -- if (enter_blink_mode) -- attrs |= A_BLINK; -+ if (enter_blink_mode) -+ attrs |= A_BLINK; - -- if (enter_bold_mode) -- attrs |= A_BOLD; -+ if (enter_bold_mode) -+ attrs |= A_BOLD; - -- if (enter_dim_mode) -- attrs |= A_DIM; -+ if (enter_dim_mode) -+ attrs |= A_DIM; - -- if (enter_reverse_mode) -- attrs |= A_REVERSE; -+ if (enter_reverse_mode) -+ attrs |= A_REVERSE; - -- if (enter_standout_mode) -- attrs |= A_STANDOUT; -+ if (enter_standout_mode) -+ attrs |= A_STANDOUT; - -- if (enter_protected_mode) -- attrs |= A_PROTECT; -+ if (enter_protected_mode) -+ attrs |= A_PROTECT; - -- if (enter_secure_mode) -- attrs |= A_INVIS; -+ if (enter_secure_mode) -+ attrs |= A_INVIS; - -- if (enter_underline_mode) -- attrs |= A_UNDERLINE; -+ if (enter_underline_mode) -+ attrs |= A_UNDERLINE; - -- if (SP_PARM->_coloron) -- attrs |= A_COLOR; -+ if (SP_PARM->_coloron) -+ attrs |= A_COLOR; - -+#if USE_ITALIC -+ if (enter_italics_mode) -+ attrs |= A_ITALIC; - #endif -+ -+#endif /* USE_TERM_DRIVER */ -+ } - returnChtype(attrs); - } - -diff -Naur ncurses-5.9/ncurses/tty/tty_display.h ncurses-5.9.patch/ncurses/tty/tty_display.h ---- ncurses-5.9/ncurses/tty/tty_display.h 2005-01-02 00:41:12.000000000 +0100 -+++ ncurses-5.9.patch/ncurses/tty/tty_display.h 1970-01-01 01:00:00.000000000 +0100 -@@ -1,140 +0,0 @@ --/**************************************************************************** -- * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. * -- * * -- * Permission is hereby granted, free of charge, to any person obtaining a * -- * copy of this software and associated documentation files (the * -- * "Software"), to deal in the Software without restriction, including * -- * without limitation the rights to use, copy, modify, merge, publish, * -- * distribute, distribute with modifications, sublicense, and/or sell * -- * copies of the Software, and to permit persons to whom the Software is * -- * furnished to do so, subject to the following conditions: * -- * * -- * The above copyright notice and this permission notice shall be included * -- * in all copies or substantial portions of the Software. * -- * * -- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * -- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * -- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * -- * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * -- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * -- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * -- * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * -- * * -- * Except as contained in this notice, the name(s) of the above copyright * -- * holders shall not be used in advertising or otherwise to promote the * -- * sale, use or other dealings in this Software without prior written * -- * authorization. * -- ************************************************************************** */ -- --#ifndef TTY_DISPLAY_H --#define TTY_DISPLAY_H 1 -- --/* -- * $Id: tty_display.h,v 1.6 2005/01/01 23:41:12 tom Exp $ -- */ --extern NCURSES_EXPORT(bool) _nc_tty_beep (void); --extern NCURSES_EXPORT(bool) _nc_tty_check_resize (void); --extern NCURSES_EXPORT(bool) _nc_tty_cursor (int); --extern NCURSES_EXPORT(bool) _nc_tty_flash (void); --extern NCURSES_EXPORT(bool) _nc_tty_init_color (int,int,int,int); --extern NCURSES_EXPORT(bool) _nc_tty_init_pair (int,int,int); --extern NCURSES_EXPORT(bool) _nc_tty_slk_hide (bool); --extern NCURSES_EXPORT(bool) _nc_tty_slk_update (int,const char *); --extern NCURSES_EXPORT(bool) _nc_tty_start_color (void); --extern NCURSES_EXPORT(void) _nc_tty_display_resume (void); --extern NCURSES_EXPORT(void) _nc_tty_display_suspend (void); --extern NCURSES_EXPORT(void) _nc_tty_dispose (void); /* frees SP->_term */ --extern NCURSES_EXPORT(void) _nc_tty_switch_to (void); --extern NCURSES_EXPORT(void) _nc_tty_update (void); -- --struct tty_display_data { -- int _fifohold; /* set if breakout marked */ -- unsigned long _current_attr; /* terminal attribute current set */ -- int _cursrow; /* physical cursor row (-1=unknown) */ -- int _curscol; /* physical cursor column */ -- -- /* cursor movement costs; units are 10ths of milliseconds */ -- int _char_padding; /* cost of character put */ -- int _cr_cost; /* cost of (carriage_return) */ -- int _cup_cost; /* cost of (cursor_address) */ -- int _home_cost; /* cost of (cursor_home) */ -- int _ll_cost; /* cost of (cursor_to_ll) */ --#if USE_HARD_TABS -- int _ht_cost; /* cost of (tab) */ -- int _cbt_cost; /* cost of (backtab) */ --#endif /* USE_HARD_TABS */ -- int _cub1_cost; /* cost of (cursor_left) */ -- int _cuf1_cost; /* cost of (cursor_right) */ -- int _cud1_cost; /* cost of (cursor_down) */ -- int _cuu1_cost; /* cost of (cursor_up) */ -- int _cub_cost; /* cost of (parm_cursor_left) */ -- int _cuf_cost; /* cost of (parm_cursor_right) */ -- int _cud_cost; /* cost of (parm_cursor_down) */ -- int _cuu_cost; /* cost of (parm_cursor_up) */ -- int _hpa_cost; /* cost of (column_address) */ -- int _vpa_cost; /* cost of (row_address) */ -- /* used in lib_doupdate.c, must be chars */ -- int _ed_cost; /* cost of (clr_eos) */ -- int _el_cost; /* cost of (clr_eol) */ -- int _el1_cost; /* cost of (clr_bol) */ -- int _dch1_cost; /* cost of (delete_character) */ -- int _ich1_cost; /* cost of (insert_character) */ -- int _dch_cost; /* cost of (parm_dch) */ -- int _ich_cost; /* cost of (parm_ich) */ -- int _ech_cost; /* cost of (erase_chars) */ -- int _rep_cost; /* cost of (repeat_char) */ -- int _hpa_ch_cost; /* cost of (column_address) */ -- int _cup_ch_cost; /* cost of (cursor_address) */ -- int _smir_cost; /* cost of (enter_insert_mode) */ -- int _rmir_cost; /* cost of (exit_insert_mode) */ -- int _ip_cost; /* cost of (insert_padding) */ -- /* used in lib_mvcur.c */ -- char * _address_cursor; -- int _carriage_return_length; -- int _cursor_home_length; -- int _cursor_to_ll_length; -- -- chtype _xmc_suppress; /* attributes to suppress if xmc */ -- chtype _xmc_triggers; /* attributes to process if xmc */ -- -- bool _sig_winch; --}; -- -- --#define DelCharCost(count) \ -- ((parm_dch != 0) \ -- ? D->_dch_cost \ -- : ((delete_character != 0) \ -- ? (D->_dch1_cost * count) \ -- : INFINITY)) -- --#define InsCharCost(count) \ -- ((parm_ich != 0) \ -- ? D->_ich_cost \ -- : ((enter_insert_mode && exit_insert_mode) \ -- ? D->_smir_cost + D->_rmir_cost + (D->_ip_cost * count) \ -- : ((insert_character != 0) \ -- ? ((D->_ich1_cost + D->_ip_cost) * count) \ -- : INFINITY))) -- --#if USE_XMC_SUPPORT --#define UpdateAttrs(c) if (!SameAttrOf(D->_current_attr, AttrOf(c))) { \ -- attr_t chg = D->_current_attr; \ -- vidattr(AttrOf(c)); \ -- if (magic_cookie_glitch > 0 \ -- && XMC_CHANGES((chg ^ D->_current_attr))) { \ -- T(("%s @%d before glitch %d,%d", \ -- __FILE__, __LINE__, \ -- D->_cursrow, \ -- D->_curscol)); \ -- _nc_do_xmc_glitch(chg); \ -- } \ -- } --#else --#define UpdateAttrs(c) if (!SameAttrOf(D->_current_attr, AttrOf(c))) \ -- vidattr(AttrOf(c)); --#endif -- --#define XMC_CHANGES(c) ((c) & D->_xmc_suppress) -- --#endif /* TTY_DISPLAY_H */ -diff -Naur ncurses-5.9/ncurses/tty/tty_input.h ncurses-5.9.patch/ncurses/tty/tty_input.h ---- ncurses-5.9/ncurses/tty/tty_input.h 2000-12-10 03:26:51.000000000 +0100 -+++ ncurses-5.9.patch/ncurses/tty/tty_input.h 1970-01-01 01:00:00.000000000 +0100 -@@ -1,61 +0,0 @@ --/**************************************************************************** -- * Copyright (c) 1998,2000 Free Software Foundation, Inc. * -- * * -- * Permission is hereby granted, free of charge, to any person obtaining a * -- * copy of this software and associated documentation files (the * -- * "Software"), to deal in the Software without restriction, including * -- * without limitation the rights to use, copy, modify, merge, publish, * -- * distribute, distribute with modifications, sublicense, and/or sell * -- * copies of the Software, and to permit persons to whom the Software is * -- * furnished to do so, subject to the following conditions: * -- * * -- * The above copyright notice and this permission notice shall be included * -- * in all copies or substantial portions of the Software. * -- * * -- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * -- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * -- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * -- * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * -- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * -- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * -- * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * -- * * -- * Except as contained in this notice, the name(s) of the above copyright * -- * holders shall not be used in advertising or otherwise to promote the * -- * sale, use or other dealings in this Software without prior written * -- * authorization. * -- ****************************************************************************/ -- --/* -- * $Id: tty_input.h,v 1.2 2000/12/10 02:26:51 tom Exp $ -- */ -- --#ifndef TTY_INPUT_H --#define TTY_INPUT_H 1 -- --extern NCURSES_EXPORT(bool) _nc_tty_mouse_mask (mmask_t); --extern NCURSES_EXPORT(bool) _nc_tty_pending (void); --extern NCURSES_EXPORT(int) _nc_tty_next_event (int); --extern NCURSES_EXPORT(void) _nc_tty_flags_changed (void); --extern NCURSES_EXPORT(void) _nc_tty_flush (void); --extern NCURSES_EXPORT(void) _nc_tty_input_resume (void); --extern NCURSES_EXPORT(void) _nc_tty_input_suspend (void); -- --struct tty_input_data { -- int _ifd; /* input file ptr for screen */ -- int _keypad_xmit; /* current terminal state */ -- int _meta_on; /* current terminal state */ -- -- /* -- * These are the data that support the mouse interface. -- */ -- bool (*_mouse_event) (SCREEN *); -- bool (*_mouse_inline)(SCREEN *); -- bool (*_mouse_parse) (int); -- void (*_mouse_resume)(SCREEN *); -- void (*_mouse_wrap) (SCREEN *); -- int _mouse_fd; /* file-descriptor, if any */ -- int mousetype; --}; -- --#endif /* TTY_INPUT_H */ -diff -Naur ncurses-5.9/ncurses/tty/tty_update.c ncurses-5.9.patch/ncurses/tty/tty_update.c ---- ncurses-5.9/ncurses/tty/tty_update.c 2010-12-19 02:21:02.000000000 +0100 -+++ ncurses-5.9.patch/ncurses/tty/tty_update.c 2014-09-01 16:33:22.457792290 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2013,2014 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -82,7 +82,7 @@ - - #include <ctype.h> - --MODULE_ID("$Id: tty_update.c,v 1.264 2010/12/19 01:21:02 tom Exp $") -+MODULE_ID("$Id: tty_update.c,v 1.277 2014/02/01 22:09:27 tom Exp $") - - /* - * This define controls the line-breakout optimization. Every once in a -@@ -145,8 +145,7 @@ - - NCURSES_SP_NAME(_nc_flush) (NCURSES_SP_ARG); - memset(buf, '\0', sizeof(buf)); -- NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx "\033[6n"); /* only works on ANSI-compatibles */ -- NCURSES_SP_NAME(_nc_flush) (NCURSES_SP_ARG); -+ NCURSES_PUTP2_FLUSH("cpr", "\033[6n"); /* only works on ANSI-compatibles */ - *(s = buf) = 0; - do { - int ask = sizeof(buf) - 1 - (s - buf); -@@ -209,7 +208,9 @@ - { - int chlen = 1; - NCURSES_CH_T my_ch; -+#if USE_WIDEC_SUPPORT - PUTC_DATA; -+#endif - NCURSES_CH_T tilde; - NCURSES_CH_T attr = CHDEREF(ch); - -@@ -276,6 +277,11 @@ - && SP_PARM->_screen_acs_map[CharOf(my_ch)]) { - RemAttr(attr, A_ALTCHARSET); - my_ch = _nc_wacs[CharOf(my_ch)]; -+ } else if (SP_PARM->_screen_unicode -+ && !SP_PARM->_screen_acs_map[CharOf(my_ch)] -+ && _nc_wacs[CharOf(my_ch)].chars[0]) { -+ RemAttr(attr, A_ALTCHARSET); -+ my_ch = _nc_wacs[CharOf(my_ch)]; - } - #endif - /* -@@ -288,13 +294,12 @@ - int j = CharOfD(ch); - chtype temp = UChar(SP_PARM->_acs_map[j]); - -- if (!(SP_PARM->_screen_acs_map[j])) { -+ if (temp != 0) { -+ SetChar(my_ch, temp, AttrOf(attr)); -+ } else { -+ my_ch = CHDEREF(ch); - RemAttr(attr, A_ALTCHARSET); -- if (temp == 0) -- temp = ' '; - } -- if (temp != 0) -- SetChar(my_ch, temp, AttrOf(attr)); - } - ch = CHREF(my_ch); - } -@@ -304,22 +309,13 @@ - } - - UpdateAttrs(SP_PARM, attr); -+ PUTC(CHDEREF(ch)); - #if !USE_WIDEC_SUPPORT -- /* FIXME - we do this special case for signal handling, should see how to -- * make it work for wide characters. -- */ -- if (SP_PARM->_outch != 0) { -- SP_PARM->_outch(NCURSES_SP_ARGx UChar(ch)); -- } else -+ COUNT_OUTCHARS(1); - #endif -- { -- PUTC(CHDEREF(ch), SP_PARM->_ofp); /* macro's fastest... */ -- COUNT_OUTCHARS(1); -- } - SP_PARM->_curscol += chlen; - if (char_padding) { -- TPUTS_TRACE("char_padding"); -- NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx char_padding); -+ NCURSES_PUTP2("char_padding", char_padding); - } - } - -@@ -342,7 +338,7 @@ - struct pollfd fds[1]; - fds[0].fd = SP_PARM->_checkfd; - fds[0].events = POLLIN; -- if (poll(fds, 1, 0) > 0) { -+ if (poll(fds, (size_t) 1, 0) > 0) { - have_pending = TRUE; - } - #elif defined(__BEOS__) -@@ -390,8 +386,7 @@ - PutAttrChar(NCURSES_SP_ARGx ch); - } else if (enter_am_mode && exit_am_mode) { - /* we can suppress automargin */ -- TPUTS_TRACE("exit_am_mode"); -- NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx exit_am_mode); -+ NCURSES_PUTP2("exit_am_mode", exit_am_mode); - - PutAttrChar(NCURSES_SP_ARGx ch); - SP_PARM->_curscol--; -@@ -400,8 +395,7 @@ - SP_PARM->_curscol, - "exit_am_mode"); - -- TPUTS_TRACE("enter_am_mode"); -- NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx enter_am_mode); -+ NCURSES_PUTP2("enter_am_mode", enter_am_mode); - } else if ((enter_insert_mode && exit_insert_mode) - || insert_character || parm_ich) { - GoTo(NCURSES_SP_ARGx -@@ -496,12 +490,13 @@ - if (SP_PARM->_default_fg != C_MASK || SP_PARM->_default_bg != C_MASK) - return FALSE; - if ((pair = GetPair(CHDEREF(ch))) != 0) { -- short fg, bg; -- NCURSES_SP_NAME(pair_content) (NCURSES_SP_ARGx -- (short) pair, -- &fg, &bg); -- if (fg != C_MASK || bg != C_MASK) -+ NCURSES_COLOR_T fg, bg; -+ if (NCURSES_SP_NAME(pair_content) (NCURSES_SP_ARGx -+ (short) pair, -+ &fg, &bg) == ERR -+ || (fg != C_MASK || bg != C_MASK)) { - return FALSE; -+ } - } - #else - if (AttrOfD(ch) & A_COLOR) -@@ -563,8 +558,7 @@ - && runcount > SP_PARM->_ech_cost + SP_PARM->_cup_ch_cost - && can_clear_with(NCURSES_SP_ARGx CHREF(ntext0))) { - UpdateAttrs(SP_PARM, ntext0); -- NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx -- TPARM_1(erase_chars, runcount)); -+ NCURSES_PUTP2("erase_chars", TPARM_1(erase_chars, runcount)); - - /* - * If this is the last part of the given interval, -@@ -677,6 +671,9 @@ - - T((T_CALLED("_nc_tinfo:doupdate(%p)"), (void *) SP_PARM)); - -+ if (SP_PARM == 0) -+ returnCode(ERR); -+ - #if !USE_REENTRANT - /* - * It is "legal" but unlikely that an application could assign a new -@@ -1076,32 +1073,29 @@ - */ - - static void --ClrToEOL(NCURSES_SP_DCLx NCURSES_CH_T blank, bool needclear) -+ClrToEOL(NCURSES_SP_DCLx NCURSES_CH_T blank, int needclear) - { - int j; - -- if (SP_PARM != 0) { -- if (CurScreen(SP_PARM) != 0 -- && SP_PARM->_cursrow >= 0) { -- for (j = SP_PARM->_curscol; j < screen_columns(SP_PARM); j++) { -- if (j >= 0) { -- NCURSES_CH_T *cp = -- &(CurScreen(SP_PARM)->_line[SP_PARM->_cursrow].text[j]); -- -- if (!CharEq(*cp, blank)) { -- *cp = blank; -- needclear = TRUE; -- } -+ if (CurScreen(SP_PARM) != 0 -+ && SP_PARM->_cursrow >= 0) { -+ for (j = SP_PARM->_curscol; j < screen_columns(SP_PARM); j++) { -+ if (j >= 0) { -+ NCURSES_CH_T *cp = -+ &(CurScreen(SP_PARM)->_line[SP_PARM->_cursrow].text[j]); -+ -+ if (!CharEq(*cp, blank)) { -+ *cp = blank; -+ needclear = TRUE; - } - } - } - } - -- if (needclear && (SP_PARM != 0)) { -+ if (needclear) { - UpdateAttrs(SP_PARM, blank); -- TPUTS_TRACE("clr_eol"); - if (clr_eol && SP_PARM->_el_cost <= (screen_columns(SP_PARM) - SP_PARM->_curscol)) { -- NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx clr_eol); -+ NCURSES_PUTP2("clr_eol", clr_eol); - } else { - int count = (screen_columns(SP_PARM) - SP_PARM->_curscol); - while (count-- > 0) -@@ -1121,12 +1115,14 @@ - { - int row, col; - -- if (0 == SP_PARM) -- return; -- - row = SP_PARM->_cursrow; - col = SP_PARM->_curscol; - -+ if (row < 0) -+ row = 0; -+ if (col < 0) -+ col = 0; -+ - UpdateAttrs(SP_PARM, blank); - TPUTS_TRACE("clr_eos"); - NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx -@@ -1370,13 +1366,11 @@ - && SP_PARM->_el_cost <= SP_PARM->_el1_cost) { - GoTo(NCURSES_SP_ARGx lineno, 0); - UpdateAttrs(SP_PARM, blank); -- TPUTS_TRACE("clr_eol"); -- NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx clr_eol); -+ NCURSES_PUTP2("clr_eol", clr_eol); - } else { - GoTo(NCURSES_SP_ARGx lineno, nFirstChar - 1); - UpdateAttrs(SP_PARM, blank); -- TPUTS_TRACE("clr_bol"); -- NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx clr_bol); -+ NCURSES_PUTP2("clr_bol", clr_bol); - } - - while (firstChar < nFirstChar) -@@ -1574,8 +1568,7 @@ - if (fast_clear) { - if (clear_screen) { - UpdateAttrs(SP_PARM, blank); -- TPUTS_TRACE("clear_screen"); -- NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx clear_screen); -+ NCURSES_PUTP2("clear_screen", clear_screen); - SP_PARM->_cursrow = SP_PARM->_curscol = 0; - position_check(SP_PARM, - SP_PARM->_cursrow, -@@ -1595,8 +1588,7 @@ - UpdateAttrs(SP_PARM, blank); - for (i = 0; i < screen_lines(SP_PARM); i++) { - GoTo(NCURSES_SP_ARGx i, 0); -- TPUTS_TRACE("clr_eol"); -- NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx clr_eol); -+ NCURSES_PUTP2("clr_eol", clr_eol); - } - GoTo(NCURSES_SP_ARGx 0, 0); - } -@@ -1647,27 +1639,22 @@ - count--; - } - } else if (enter_insert_mode && exit_insert_mode) { -- TPUTS_TRACE("enter_insert_mode"); -- NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx enter_insert_mode); -+ NCURSES_PUTP2("enter_insert_mode", enter_insert_mode); - while (count) { - PutAttrChar(NCURSES_SP_ARGx CHREF(*line)); - if (insert_padding) { -- TPUTS_TRACE("insert_padding"); -- NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx insert_padding); -+ NCURSES_PUTP2("insert_padding", insert_padding); - } - line++; - count--; - } -- TPUTS_TRACE("exit_insert_mode"); -- NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx exit_insert_mode); -+ NCURSES_PUTP2("exit_insert_mode", exit_insert_mode); - } else { - while (count) { -- TPUTS_TRACE("insert_character"); -- NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx insert_character); -+ NCURSES_PUTP2("insert_character", insert_character); - PutAttrChar(NCURSES_SP_ARGx CHREF(*line)); - if (insert_padding) { -- TPUTS_TRACE("insert_padding"); -- NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx insert_padding); -+ NCURSES_PUTP2("insert_padding", insert_padding); - } - line++; - count--; -@@ -1701,8 +1688,7 @@ - NCURSES_SP_NAME(_nc_outch)); - } else { - for (n = 0; n < count; n++) { -- TPUTS_TRACE("delete_character"); -- NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx delete_character); -+ NCURSES_PUTP2("delete_character", delete_character); - } - } - } -@@ -1754,13 +1740,11 @@ - if (n == 1 && scroll_forward && top == miny && bot == maxy) { - GoTo(NCURSES_SP_ARGx bot, 0); - UpdateAttrs(SP_PARM, blank); -- TPUTS_TRACE("scroll_forward"); -- NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx scroll_forward); -+ NCURSES_PUTP2("scroll_forward", scroll_forward); - } else if (n == 1 && delete_line && bot == maxy) { - GoTo(NCURSES_SP_ARGx top, 0); - UpdateAttrs(SP_PARM, blank); -- TPUTS_TRACE("delete_line"); -- NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx delete_line); -+ NCURSES_PUTP2("delete_line", delete_line); - } else if (parm_index && top == miny && bot == maxy) { - GoTo(NCURSES_SP_ARGx bot, 0); - UpdateAttrs(SP_PARM, blank); -@@ -1781,15 +1765,13 @@ - GoTo(NCURSES_SP_ARGx bot, 0); - UpdateAttrs(SP_PARM, blank); - for (i = 0; i < n; i++) { -- TPUTS_TRACE("scroll_forward"); -- NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx scroll_forward); -+ NCURSES_PUTP2("scroll_forward", scroll_forward); - } - } else if (delete_line && bot == maxy) { - GoTo(NCURSES_SP_ARGx top, 0); - UpdateAttrs(SP_PARM, blank); - for (i = 0; i < n; i++) { -- TPUTS_TRACE("delete_line"); -- NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx delete_line); -+ NCURSES_PUTP2("delete_line", delete_line); - } - } else - return ERR; -@@ -1823,13 +1805,11 @@ - if (n == 1 && scroll_reverse && top == miny && bot == maxy) { - GoTo(NCURSES_SP_ARGx top, 0); - UpdateAttrs(SP_PARM, blank); -- TPUTS_TRACE("scroll_reverse"); -- NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx scroll_reverse); -+ NCURSES_PUTP2("scroll_reverse", scroll_reverse); - } else if (n == 1 && insert_line && bot == maxy) { - GoTo(NCURSES_SP_ARGx top, 0); - UpdateAttrs(SP_PARM, blank); -- TPUTS_TRACE("insert_line"); -- NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx insert_line); -+ NCURSES_PUTP2("insert_line", insert_line); - } else if (parm_rindex && top == miny && bot == maxy) { - GoTo(NCURSES_SP_ARGx top, 0); - UpdateAttrs(SP_PARM, blank); -@@ -1850,15 +1830,13 @@ - GoTo(NCURSES_SP_ARGx top, 0); - UpdateAttrs(SP_PARM, blank); - for (i = 0; i < n; i++) { -- TPUTS_TRACE("scroll_reverse"); -- NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx scroll_reverse); -+ NCURSES_PUTP2("scroll_reverse", scroll_reverse); - } - } else if (insert_line && bot == maxy) { - GoTo(NCURSES_SP_ARGx top, 0); - UpdateAttrs(SP_PARM, blank); - for (i = 0; i < n; i++) { -- TPUTS_TRACE("insert_line"); -- NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx insert_line); -+ NCURSES_PUTP2("insert_line", insert_line); - } - } else - return ERR; -@@ -1889,8 +1867,7 @@ - GoTo(NCURSES_SP_ARGx del, 0); - UpdateAttrs(SP_PARM, blank); - if (n == 1 && delete_line) { -- TPUTS_TRACE("delete_line"); -- NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx delete_line); -+ NCURSES_PUTP2("delete_line", delete_line); - } else if (parm_delete_line) { - TPUTS_TRACE("parm_delete_line"); - NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx -@@ -1899,16 +1876,14 @@ - NCURSES_SP_NAME(_nc_outch)); - } else { /* if (delete_line) */ - for (i = 0; i < n; i++) { -- TPUTS_TRACE("delete_line"); -- NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx delete_line); -+ NCURSES_PUTP2("delete_line", delete_line); - } - } - - GoTo(NCURSES_SP_ARGx ins, 0); - UpdateAttrs(SP_PARM, blank); - if (n == 1 && insert_line) { -- TPUTS_TRACE("insert_line"); -- NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx insert_line); -+ NCURSES_PUTP2("insert_line", insert_line); - } else if (parm_insert_line) { - TPUTS_TRACE("parm_insert_line"); - NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx -@@ -1917,8 +1892,7 @@ - NCURSES_SP_NAME(_nc_outch)); - } else { /* if (insert_line) */ - for (i = 0; i < n; i++) { -- TPUTS_TRACE("insert_line"); -- NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx insert_line); -+ NCURSES_PUTP2("insert_line", insert_line); - } - } - -@@ -1975,24 +1949,20 @@ - && (SP_PARM->_cursrow == bot || SP_PARM->_cursrow == bot - 1)) - && save_cursor && restore_cursor) { - cursor_saved = TRUE; -- TPUTS_TRACE("save_cursor"); -- NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx save_cursor); -+ NCURSES_PUTP2("save_cursor", save_cursor); - } -- TPUTS_TRACE("change_scroll_region"); -- NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx -- TPARM_2(change_scroll_region, top, bot)); -+ NCURSES_PUTP2("change_scroll_region", -+ TPARM_2(change_scroll_region, top, bot)); - if (cursor_saved) { -- TPUTS_TRACE("restore_cursor"); -- NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx restore_cursor); -+ NCURSES_PUTP2("restore_cursor", restore_cursor); - } else { - SP_PARM->_cursrow = SP_PARM->_curscol = -1; - } - - res = scroll_csr_forward(NCURSES_SP_ARGx n, top, bot, top, bot, blank); - -- TPUTS_TRACE("change_scroll_region"); -- NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx -- TPARM_2(change_scroll_region, 0, maxy)); -+ NCURSES_PUTP2("change_scroll_region", -+ TPARM_2(change_scroll_region, 0, maxy)); - SP_PARM->_cursrow = SP_PARM->_curscol = -1; - } - -@@ -2025,15 +1995,12 @@ - SP_PARM->_cursrow == top - 1) - && save_cursor && restore_cursor) { - cursor_saved = TRUE; -- TPUTS_TRACE("save_cursor"); -- NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx save_cursor); -+ NCURSES_PUTP2("save_cursor", save_cursor); - } -- TPUTS_TRACE("change_scroll_region"); -- NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx -- TPARM_2(change_scroll_region, top, bot)); -+ NCURSES_PUTP2("change_scroll_region", -+ TPARM_2(change_scroll_region, top, bot)); - if (cursor_saved) { -- TPUTS_TRACE("restore_cursor"); -- NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx restore_cursor); -+ NCURSES_PUTP2("restore_cursor", restore_cursor); - } else { - SP_PARM->_cursrow = SP_PARM->_curscol = -1; - } -@@ -2041,9 +2008,8 @@ - res = scroll_csr_backward(NCURSES_SP_ARGx - -n, top, bot, top, bot, blank); - -- TPUTS_TRACE("change_scroll_region"); -- NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx -- TPARM_2(change_scroll_region, 0, maxy)); -+ NCURSES_PUTP2("change_scroll_region", -+ TPARM_2(change_scroll_region, 0, maxy)); - SP_PARM->_cursrow = SP_PARM->_curscol = -1; - } - -@@ -2114,23 +2080,25 @@ - } - - if (exit_attribute_mode) -- NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx exit_attribute_mode); -+ NCURSES_PUTP2("exit_attribute_mode", exit_attribute_mode); - else { - /* turn off attributes */ - if (exit_alt_charset_mode) -- NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx exit_alt_charset_mode); -+ NCURSES_PUTP2("exit_alt_charset_mode", exit_alt_charset_mode); - if (exit_standout_mode) -- NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx exit_standout_mode); -+ NCURSES_PUTP2("exit_standout_mode", exit_standout_mode); - if (exit_underline_mode) -- NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx exit_underline_mode); -+ NCURSES_PUTP2("exit_underline_mode", exit_underline_mode); - } - if (exit_insert_mode) -- NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx exit_insert_mode); -- if (enter_am_mode && exit_am_mode) -- NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx -- (auto_right_margin -- ? enter_am_mode -- : exit_am_mode)); -+ NCURSES_PUTP2("exit_insert_mode", exit_insert_mode); -+ if (enter_am_mode && exit_am_mode) { -+ if (auto_right_margin) { -+ NCURSES_PUTP2("enter_am_mode", enter_am_mode); -+ } else { -+ NCURSES_PUTP2("exit_am_mode", exit_am_mode); -+ } -+ } - } - - #if NCURSES_SP_FUNCS -@@ -2159,33 +2127,33 @@ - NCURSES_EXPORT(void) - NCURSES_SP_NAME(_nc_screen_wrap) (NCURSES_SP_DCL0) - { -- if (SP_PARM == 0) -- return; -+ if (SP_PARM != 0) { - -- UpdateAttrs(SP_PARM, normal); -+ UpdateAttrs(SP_PARM, normal); - #if NCURSES_EXT_FUNCS -- if (SP_PARM->_coloron -- && !SP_PARM->_default_color) { -- static const NCURSES_CH_T blank = NewChar(BLANK_TEXT); -- SP_PARM->_default_color = TRUE; -- NCURSES_SP_NAME(_nc_do_color) (NCURSES_SP_ARGx -- -1, -- 0, -- FALSE, -- NCURSES_SP_NAME(_nc_outch)); -- SP_PARM->_default_color = FALSE; -- -- TINFO_MVCUR(NCURSES_SP_ARGx -- SP_PARM->_cursrow, -- SP_PARM->_curscol, -- screen_lines(SP_PARM) - 1, -- 0); -+ if (SP_PARM->_coloron -+ && !SP_PARM->_default_color) { -+ static const NCURSES_CH_T blank = NewChar(BLANK_TEXT); -+ SP_PARM->_default_color = TRUE; -+ NCURSES_SP_NAME(_nc_do_color) (NCURSES_SP_ARGx -+ -1, -+ 0, -+ FALSE, -+ NCURSES_SP_NAME(_nc_outch)); -+ SP_PARM->_default_color = FALSE; -+ -+ TINFO_MVCUR(NCURSES_SP_ARGx -+ SP_PARM->_cursrow, -+ SP_PARM->_curscol, -+ screen_lines(SP_PARM) - 1, -+ 0); - -- ClrToEOL(NCURSES_SP_ARGx blank, TRUE); -- } -+ ClrToEOL(NCURSES_SP_ARGx blank, TRUE); -+ } - #endif -- if (SP_PARM->_color_defs) { -- NCURSES_SP_NAME(_nc_reset_colors) (NCURSES_SP_ARG); -+ if (SP_PARM->_color_defs) { -+ NCURSES_SP_NAME(_nc_reset_colors) (NCURSES_SP_ARG); -+ } - } - } - -diff -Naur ncurses-5.9/ncurses/wcwidth.h ncurses-5.9.patch/ncurses/wcwidth.h ---- ncurses-5.9/ncurses/wcwidth.h 2010-08-07 20:28:09.000000000 +0200 -+++ ncurses-5.9.patch/ncurses/wcwidth.h 2014-09-01 16:33:22.457792290 +0200 -@@ -192,15 +192,18 @@ - (ucs <= 0x115f || /* Hangul Jamo init. consonants */ - ucs == 0x2329 || ucs == 0x232a || - (ucs >= 0x2e80 && ucs <= 0xa4cf && -- ucs != 0x303f) || /* CJK ... Yi */ -- (ucs >= 0xac00 && ucs <= 0xd7a3) || /* Hangul Syllables */ -- (ucs >= 0xf900 && ucs <= 0xfaff) || /* CJK Compatibility Ideographs */ -- (ucs >= 0xfe10 && ucs <= 0xfe19) || /* Vertical forms */ -- (ucs >= 0xfe30 && ucs <= 0xfe6f) || /* CJK Compatibility Forms */ -- (ucs >= 0xff00 && ucs <= 0xff60) || /* Fullwidth Forms */ -- (ucs >= 0xffe0 && ucs <= 0xffe6) || -- (ucs >= 0x20000 && ucs <= 0x2fffd) || -- (ucs >= 0x30000 && ucs <= 0x3fffd))); -+ ucs != 0x303f) /* CJK ... Yi */ -+ || (ucs >= 0xac00 && ucs <= 0xd7a3) /* Hangul Syllables */ -+ || (ucs >= 0xf900 && ucs <= 0xfaff) /* CJK Compatibility Ideographs */ -+ || (ucs >= 0xfe10 && ucs <= 0xfe19) /* Vertical forms */ -+ || (ucs >= 0xfe30 && ucs <= 0xfe6f) /* CJK Compatibility Forms */ -+ || (ucs >= 0xff00 && ucs <= 0xff60) /* Fullwidth Forms */ -+ || (ucs >= 0xffe0 && ucs <= 0xffe6) -+#if !defined(SIZEOF_WCHAR_T) || (SIZEOF_WCHAR_T >= 4) -+ || (ucs >= 0x20000 && ucs <= 0x2fffd) -+ || (ucs >= 0x30000 && ucs <= 0x3fffd) -+#endif -+ )); - } - - -diff -Naur ncurses-5.9/ncurses/widechar/lib_box_set.c ncurses-5.9.patch/ncurses/widechar/lib_box_set.c ---- ncurses-5.9/ncurses/widechar/lib_box_set.c 2009-10-25 00:36:56.000000000 +0200 -+++ ncurses-5.9.patch/ncurses/widechar/lib_box_set.c 2014-09-01 16:33:22.457792290 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 2002-2003,2009 Free Software Foundation, Inc. * -+ * Copyright (c) 2002-2009,2011 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -39,7 +39,7 @@ - - #include <curses.priv.h> - --MODULE_ID("$Id: lib_box_set.c,v 1.5 2009/10/24 22:36:56 tom Exp $") -+MODULE_ID("$Id: lib_box_set.c,v 1.6 2011/06/25 19:02:07 Vassili.Courzakis Exp $") - - NCURSES_EXPORT(int) - wborder_set(WINDOW *win, -@@ -52,7 +52,7 @@ - NCURSES_SIZE_T endx, endy; - NCURSES_CH_T wls, wrs, wts, wbs, wtl, wtr, wbl, wbr; - -- T((T_CALLED("wborder(%p,%s,%s,%s,%s,%s,%s,%s,%s)"), -+ T((T_CALLED("wborder_set(%p,%s,%s,%s,%s,%s,%s,%s,%s)"), - (void *) win, - _tracech_t2(1, ls), - _tracech_t2(2, rs), -diff -Naur ncurses-5.9/ncurses/widechar/lib_cchar.c ncurses-5.9.patch/ncurses/widechar/lib_cchar.c ---- ncurses-5.9/ncurses/widechar/lib_cchar.c 2010-12-26 00:46:26.000000000 +0100 -+++ ncurses-5.9.patch/ncurses/widechar/lib_cchar.c 2014-09-01 16:33:22.458792292 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 2001-2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 2001-2012,2014 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -35,7 +35,7 @@ - - #include <curses.priv.h> - --MODULE_ID("$Id: lib_cchar.c,v 1.20 2010/12/25 23:46:26 tom Exp $") -+MODULE_ID("$Id: lib_cchar.c,v 1.27 2014/02/01 22:10:42 tom Exp $") - - /* - * The SuSv2 description leaves some room for interpretation. We'll assume wch -@@ -47,7 +47,7 @@ - setcchar(cchar_t *wcval, - const wchar_t *wch, - const attr_t attrs, -- short color_pair, -+ NCURSES_PAIRS_T color_pair, - const void *opts) - { - unsigned i; -@@ -56,11 +56,11 @@ - - TR(TRACE_CCALLS, (T_CALLED("setcchar(%p,%s,%lu,%d,%p)"), - (void *) wcval, _nc_viswbuf(wch), -- (unsigned long) attrs, color_pair, opts)); -+ (unsigned long) attrs, (int) color_pair, opts)); - -- len = (unsigned) wcslen(wch); - if (opts != NULL -- || (len > 1 && wcwidth(wch[0]) < 0)) { -+ || wch == NULL -+ || ((len = (unsigned) wcslen(wch)) > 1 && wcwidth(wch[0]) < 0)) { - code = ERR; - } else { - if (len > CCHARW_MAX) -@@ -80,7 +80,7 @@ - memset(wcval, 0, sizeof(*wcval)); - - if (len != 0) { -- SetAttr(*wcval, attrs | (attr_t) ColorPair(color_pair)); -+ SetAttr(*wcval, attrs); - SetPair(CHDEREF(wcval), color_pair); - memcpy(&wcval->chars, wch, len * sizeof(wchar_t)); - TR(TRACE_CCALLS, ("copy %d wchars, first is %s", len, -@@ -96,7 +96,7 @@ - getcchar(const cchar_t *wcval, - wchar_t *wch, - attr_t *attrs, -- short *color_pair, -+ NCURSES_PAIRS_T *color_pair, - void *opts) - { - wchar_t *wp; -@@ -110,8 +110,8 @@ - (void *) color_pair, - opts)); - -- if (opts == NULL) { -- len = ((wp = wmemchr(wcval->chars, L'\0', CCHARW_MAX)) -+ if (opts == NULL && wcval != NULL) { -+ len = ((wp = wmemchr(wcval->chars, L'\0', (size_t) CCHARW_MAX)) - ? (int) (wp - wcval->chars) - : CCHARW_MAX); - -@@ -125,8 +125,8 @@ - code = ERR; - } else if (len >= 0) { - *attrs = AttrOf(*wcval) & A_ATTRIBUTES; -- *color_pair = (short) GetPair(*wcval); -- wmemcpy(wch, wcval->chars, (unsigned) len); -+ *color_pair = (NCURSES_PAIRS_T) GetPair(*wcval); -+ wmemcpy(wch, wcval->chars, (size_t) len); - wch[len] = L'\0'; - code = OK; - } -diff -Naur ncurses-5.9/ncurses/widechar/lib_erasewchar.c ncurses-5.9.patch/ncurses/widechar/lib_erasewchar.c ---- ncurses-5.9/ncurses/widechar/lib_erasewchar.c 2010-07-24 13:35:12.000000000 +0200 -+++ ncurses-5.9.patch/ncurses/widechar/lib_erasewchar.c 2014-09-01 16:33:22.458792292 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 2002,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 2002-2010,2014 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -32,7 +32,7 @@ - - #include <curses.priv.h> - --MODULE_ID("$Id: lib_erasewchar.c,v 1.2 2010/07/24 11:35:12 tom Exp $") -+MODULE_ID("$Id: lib_erasewchar.c,v 1.3 2014/02/23 01:21:08 tom Exp $") - - /* - * erasewchar() -@@ -49,7 +49,7 @@ - - T((T_CALLED("erasewchar()"))); - if ((value = erasechar()) != ERR) { -- *wch = value; -+ *wch = (wchar_t) value; - result = OK; - } - returnCode(result); -@@ -70,7 +70,7 @@ - - T((T_CALLED("killwchar()"))); - if ((value = killchar()) != ERR) { -- *wch = value; -+ *wch = (wchar_t) value; - result = OK; - } - returnCode(result); -diff -Naur ncurses-5.9/ncurses/widechar/lib_get_wch.c ncurses-5.9.patch/ncurses/widechar/lib_get_wch.c ---- ncurses-5.9/ncurses/widechar/lib_get_wch.c 2010-08-28 23:00:35.000000000 +0200 -+++ ncurses-5.9.patch/ncurses/widechar/lib_get_wch.c 2014-09-01 16:33:22.458792292 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 2002-2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 2002-2010,2011 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -40,7 +40,7 @@ - #include <curses.priv.h> - #include <ctype.h> - --MODULE_ID("$Id: lib_get_wch.c,v 1.22 2010/08/28 21:00:35 tom Exp $") -+MODULE_ID("$Id: lib_get_wch.c,v 1.23 2011/05/28 23:00:29 tom Exp $") - - NCURSES_EXPORT(int) - wget_wch(WINDOW *win, wint_t *result) -@@ -106,7 +106,10 @@ - } else { - code = ERR; - } -- *result = (wint_t) value; -+ -+ if (result != 0) -+ *result = (wint_t) value; -+ - _nc_unlock_global(curses); - T(("result %#o", value)); - returnCode(code); -diff -Naur ncurses-5.9/ncurses/widechar/lib_get_wstr.c ncurses-5.9.patch/ncurses/widechar/lib_get_wstr.c ---- ncurses-5.9/ncurses/widechar/lib_get_wstr.c 2009-10-25 00:38:11.000000000 +0200 -+++ ncurses-5.9.patch/ncurses/widechar/lib_get_wstr.c 2014-09-01 16:33:22.458792292 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 2002-2008,2009 Free Software Foundation, Inc. * -+ * Copyright (c) 2002-2009,2011 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -39,7 +39,7 @@ - - #include <curses.priv.h> - --MODULE_ID("$Id: lib_get_wstr.c,v 1.12 2009/10/24 22:38:11 tom Exp $") -+MODULE_ID("$Id: lib_get_wstr.c,v 1.13 2011/10/22 16:31:35 tom Exp $") - - static int - wadd_wint(WINDOW *win, wint_t *src) -@@ -49,7 +49,7 @@ - - wch[0] = (wchar_t) (*src); - wch[1] = 0; -- setcchar(&tmp, wch, A_NORMAL, 0, NULL); -+ setcchar(&tmp, wch, A_NORMAL, (short) 0, NULL); - return wadd_wch(win, &tmp); - } - -@@ -58,7 +58,7 @@ - * or other character, and handles reverse wraparound. - */ - static wint_t * --WipeOut(WINDOW *win, int y, int x, wint_t *first, wint_t *last, bool echoed) -+WipeOut(WINDOW *win, int y, int x, wint_t *first, wint_t *last, int echoed) - { - if (last > first) { - *--last = '\0'; -diff -Naur ncurses-5.9/ncurses/widechar/lib_ins_wch.c ncurses-5.9.patch/ncurses/widechar/lib_ins_wch.c ---- ncurses-5.9/ncurses/widechar/lib_ins_wch.c 2010-12-19 02:34:04.000000000 +0100 -+++ ncurses-5.9.patch/ncurses/widechar/lib_ins_wch.c 2014-09-01 16:33:22.458792292 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 2002-2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 2002-2010,2011 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -39,7 +39,7 @@ - - #include <curses.priv.h> - --MODULE_ID("$Id: lib_ins_wch.c,v 1.16 2010/12/19 01:34:04 tom Exp $") -+MODULE_ID("$Id: lib_ins_wch.c,v 1.17 2011/10/22 16:34:50 tom Exp $") - - /* - * Insert the given character, updating the current location to simplify -@@ -132,7 +132,7 @@ - (void) setcchar(&tmp_cchar, - &tmp_wchar, - WA_NORMAL, -- 0, -+ (short) 0, - (void *) 0); - code = _nc_insert_wch(win, &tmp_cchar); - } else { -diff -Naur ncurses-5.9/ncurses/widechar/lib_inwstr.c ncurses-5.9.patch/ncurses/widechar/lib_inwstr.c ---- ncurses-5.9/ncurses/widechar/lib_inwstr.c 2009-10-25 00:37:29.000000000 +0200 -+++ ncurses-5.9.patch/ncurses/widechar/lib_inwstr.c 2014-09-01 16:33:22.458792292 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 2002-2004,2009 Free Software Foundation, Inc. * -+ * Copyright (c) 2002-2009,2011 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -39,7 +39,7 @@ - - #include <curses.priv.h> - --MODULE_ID("$Id: lib_inwstr.c,v 1.5 2009/10/24 22:37:29 tom Exp $") -+MODULE_ID("$Id: lib_inwstr.c,v 1.6 2011/05/28 22:49:49 tom Exp $") - - NCURSES_EXPORT(int) - winnwstr(WINDOW *win, wchar_t *wstr, int n) -@@ -93,8 +93,13 @@ - winwstr(WINDOW *win, wchar_t *wstr) - { - int result = OK; -+ - T((T_CALLED("winwstr(%p,%p)"), (void *) win, (void *) wstr)); -- if (winnwstr(win, wstr, CCHARW_MAX * (win->_maxx - win->_curx + 1)) == ERR) -+ if (win == 0) { -+ result = ERR; -+ } else if (winnwstr(win, wstr, -+ CCHARW_MAX * (win->_maxx - win->_curx + 1)) == ERR) { - result = ERR; -+ } - returnCode(result); - } -diff -Naur ncurses-5.9/ncurses/widechar/lib_slk_wset.c ncurses-5.9.patch/ncurses/widechar/lib_slk_wset.c ---- ncurses-5.9/ncurses/widechar/lib_slk_wset.c 2005-01-16 02:03:53.000000000 +0100 -+++ ncurses-5.9.patch/ncurses/widechar/lib_slk_wset.c 2014-09-01 16:33:22.458792292 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 2003-2004,2005 Free Software Foundation, Inc. * -+ * Copyright (c) 2003-2002,2011 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -40,7 +40,7 @@ - #include <wctype.h> - #endif - --MODULE_ID("$Id: lib_slk_wset.c,v 1.11 2005/01/16 01:03:53 tom Exp $") -+MODULE_ID("$Id: lib_slk_wset.c,v 1.13 2011/10/22 15:52:20 tom Exp $") - - NCURSES_EXPORT(int) - slk_wset(int i, const wchar_t *astr, int format) -@@ -53,19 +53,21 @@ - - T((T_CALLED("slk_wset(%d, %s, %d)"), i, _nc_viswbuf(astr), format)); - -- init_mb(state); -- str = astr; -- if ((arglen = wcsrtombs(NULL, &str, 0, &state)) != (size_t) -1) { -- if ((mystr = (char *) _nc_doalloc(0, arglen + 1)) != 0) { -- str = astr; -- if (wcsrtombs(mystr, &str, arglen, &state) != (size_t) -1) { -- /* glibc documentation claims that the terminating L'\0' -- * is written, but it is not... -- */ -- mystr[arglen] = 0; -- result = slk_set(i, mystr, format); -+ if (astr != 0) { -+ init_mb(state); -+ str = astr; -+ if ((arglen = wcsrtombs(NULL, &str, (size_t) 0, &state)) != (size_t) -1) { -+ if ((mystr = (char *) _nc_doalloc(0, arglen + 1)) != 0) { -+ str = astr; -+ if (wcsrtombs(mystr, &str, arglen, &state) != (size_t) -1) { -+ /* glibc documentation claims that the terminating L'\0' -+ * is written, but it is not... -+ */ -+ mystr[arglen] = 0; -+ result = slk_set(i, mystr, format); -+ } -+ free(mystr); - } -- free(mystr); - } - } - returnCode(result); -diff -Naur ncurses-5.9/ncurses/widechar/lib_unget_wch.c ncurses-5.9.patch/ncurses/widechar/lib_unget_wch.c ---- ncurses-5.9/ncurses/widechar/lib_unget_wch.c 2010-07-24 13:35:21.000000000 +0200 -+++ ncurses-5.9.patch/ncurses/widechar/lib_unget_wch.c 2014-09-01 16:33:22.458792292 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 2002-2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 2002-2010,2011 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -39,7 +39,7 @@ - - #include <curses.priv.h> - --MODULE_ID("$Id: lib_unget_wch.c,v 1.14 2010/07/24 11:35:21 tom Exp $") -+MODULE_ID("$Id: lib_unget_wch.c,v 1.15 2011/10/22 16:34:50 tom Exp $") - - /* - * Wrapper for wcrtomb() which obtains the length needed for the given -@@ -55,7 +55,7 @@ - const wchar_t *tempp = temp; - temp[0] = source; - temp[1] = 0; -- result = (int) wcsrtombs(NULL, &tempp, 0, state); -+ result = (int) wcsrtombs(NULL, &tempp, (size_t) 0, state); - } else { - result = (int) wcrtomb(target, source, state); - } -diff -Naur ncurses-5.9/ncurses/widechar/lib_vid_attr.c ncurses-5.9.patch/ncurses/widechar/lib_vid_attr.c ---- ncurses-5.9/ncurses/widechar/lib_vid_attr.c 2010-12-19 02:44:24.000000000 +0100 -+++ ncurses-5.9.patch/ncurses/widechar/lib_vid_attr.c 2014-09-01 16:33:22.459792294 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 2002-2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 2002-2013,2014 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -36,14 +36,16 @@ - #define CUR SP_TERMTYPE - #endif - --MODULE_ID("$Id: lib_vid_attr.c,v 1.14 2010/12/19 01:44:24 tom Exp $") -+MODULE_ID("$Id: lib_vid_attr.c,v 1.22 2014/02/01 22:09:27 tom Exp $") - --#define doPut(mode) TPUTS_TRACE(#mode); NCURSES_SP_NAME(tputs)(NCURSES_SP_ARGx mode, 1, outc) -+#define doPut(mode) \ -+ TPUTS_TRACE(#mode); \ -+ NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx mode, 1, outc) - --#define TurnOn(mask,mode) \ -+#define TurnOn(mask, mode) \ - if ((turn_on & mask) && mode) { doPut(mode); } - --#define TurnOff(mask,mode) \ -+#define TurnOff(mask, mode) \ - if ((turn_off & mask) && mode) { doPut(mode); turn_off &= ~mask; } - - /* if there is no current screen, assume we *can* do color */ -@@ -66,7 +68,7 @@ - NCURSES_EXPORT(int) - NCURSES_SP_NAME(vid_puts) (NCURSES_SP_DCLx - attr_t newmode, -- short pair, -+ NCURSES_PAIRS_T pair, - void *opts GCC_UNUSED, - NCURSES_SP_OUTC outc) - { -@@ -120,7 +122,7 @@ - * A_ALTCHARSET (256) down 2 to line up. We use the NCURSES_BITS - * macro so this will work properly for the wide-character layout. - */ -- unsigned value = no_color_video; -+ unsigned value = (unsigned) no_color_video; - attr_t mask = NCURSES_BITS((value & 63) - | ((value & 192) << 1) - | ((value & 256) >> 2), 8); -@@ -161,6 +163,11 @@ - if (!SP_PARM || SP_PARM->_use_rmso) { - TurnOff(A_STANDOUT, exit_standout_mode); - } -+#if USE_ITALIC -+ if (!SP_PARM || SP_PARM->_use_ritm) { -+ TurnOff(A_ITALIC, exit_italics_mode); -+ } -+#endif - } - previous_attr &= ALL_BUT_COLOR; - previous_pair = 0; -@@ -185,6 +192,15 @@ - previous_attr &= ALL_BUT_COLOR; - previous_pair = 0; - } -+#if USE_ITALIC -+ if (!SP_PARM || SP_PARM->_use_ritm) { -+ if (turn_on & A_ITALIC) { -+ TurnOn(A_ITALIC, enter_italics_mode); -+ } else if (turn_off & A_ITALIC) { -+ TurnOff(A_ITALIC, exit_italics_mode); -+ } -+ } -+#endif - SetColorsIf((pair != 0) || fix_pair0, previous_attr, previous_pair); - } else { - -@@ -199,7 +215,11 @@ - if (!SP_PARM || SP_PARM->_use_rmso) { - TurnOff(A_STANDOUT, exit_standout_mode); - } -- -+#if USE_ITALIC -+ if (!SP_PARM || SP_PARM->_use_ritm) { -+ TurnOff(A_ITALIC, exit_italics_mode); -+ } -+#endif - if (turn_off && exit_attribute_mode) { - doPut(exit_attribute_mode); - turn_on |= (newmode & ALL_BUT_COLOR); -@@ -219,6 +239,9 @@ - TurnOn(A_PROTECT, enter_protected_mode); - TurnOn(A_INVIS, enter_secure_mode); - TurnOn(A_UNDERLINE, enter_underline_mode); -+#if USE_ITALIC -+ TurnOn(A_ITALIC, enter_italics_mode); -+#endif - #if USE_WIDEC_SUPPORT - TurnOn(A_HORIZONTAL, enter_horizontal_hl_mode); - TurnOn(A_LEFT, enter_left_hl_mode); -@@ -244,7 +267,7 @@ - - returnCode(OK); - #else -- T((T_CALLED("vid_puts(%s,%d)"), _traceattr(newmode), pair)); -+ T((T_CALLED("vid_puts(%s,%d)"), _traceattr(newmode), (int) pair)); - set_color(newmode, pair); - returnCode(NCURSES_SP_NAME(vidputs) (NCURSES_SP_ARGx newmode, outc)); - #endif -@@ -253,7 +276,7 @@ - #if NCURSES_SP_FUNCS - NCURSES_EXPORT(int) - vid_puts(attr_t newmode, -- short pair, -+ NCURSES_PAIRS_T pair, - void *opts GCC_UNUSED, - NCURSES_OUTC outc) - { -@@ -270,20 +293,20 @@ - NCURSES_EXPORT(int) - NCURSES_SP_NAME(vid_attr) (NCURSES_SP_DCLx - attr_t newmode, -- short pair, -+ NCURSES_PAIRS_T pair, - void *opts) - { -- T((T_CALLED("vid_attr(%s,%d)"), _traceattr(newmode), pair)); -+ T((T_CALLED("vid_attr(%s,%d)"), _traceattr(newmode), (int) pair)); - returnCode(NCURSES_SP_NAME(vid_puts) (NCURSES_SP_ARGx - newmode, - pair, - opts, -- NCURSES_SP_NAME(_nc_outch))); -+ NCURSES_SP_NAME(_nc_putchar))); - } - - #if NCURSES_SP_FUNCS - NCURSES_EXPORT(int) --vid_attr(attr_t newmode, short pair, void *opts) -+vid_attr(attr_t newmode, NCURSES_PAIRS_T pair, void *opts) - { - return NCURSES_SP_NAME(vid_attr) (CURRENT_SCREEN, newmode, pair, opts); - } -@@ -296,24 +319,26 @@ - NCURSES_EXPORT(attr_t) - NCURSES_SP_NAME(term_attrs) (NCURSES_SP_DCL0) - { -- attr_t attrs; -+ attr_t attrs = 0; - - T((T_CALLED("term_attrs()"))); -- attrs = SP_PARM ? NCURSES_SP_NAME(termattrs) (NCURSES_SP_ARG) : 0; -+ if (SP_PARM) { -+ attrs = NCURSES_SP_NAME(termattrs) (NCURSES_SP_ARG); - -- /* these are only supported for wide-character mode */ -- if (enter_horizontal_hl_mode) -- attrs |= WA_HORIZONTAL; -- if (enter_left_hl_mode) -- attrs |= WA_LEFT; -- if (enter_low_hl_mode) -- attrs |= WA_LOW; -- if (enter_right_hl_mode) -- attrs |= WA_RIGHT; -- if (enter_top_hl_mode) -- attrs |= WA_TOP; -- if (enter_vertical_hl_mode) -- attrs |= WA_VERTICAL; -+ /* these are only supported for wide-character mode */ -+ if (enter_horizontal_hl_mode) -+ attrs |= WA_HORIZONTAL; -+ if (enter_left_hl_mode) -+ attrs |= WA_LEFT; -+ if (enter_low_hl_mode) -+ attrs |= WA_LOW; -+ if (enter_right_hl_mode) -+ attrs |= WA_RIGHT; -+ if (enter_top_hl_mode) -+ attrs |= WA_TOP; -+ if (enter_vertical_hl_mode) -+ attrs |= WA_VERTICAL; -+ } - - returnAttr(attrs); - } -diff -Naur ncurses-5.9/ncurses/widechar/lib_wacs.c ncurses-5.9.patch/ncurses/widechar/lib_wacs.c ---- ncurses-5.9/ncurses/widechar/lib_wacs.c 2010-12-19 02:43:19.000000000 +0100 -+++ ncurses-5.9.patch/ncurses/widechar/lib_wacs.c 2014-09-01 16:33:22.459792294 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 2002-2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 2002-2013,2014 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -32,7 +32,7 @@ - - #include <curses.priv.h> - --MODULE_ID("$Id: lib_wacs.c,v 1.10 2010/12/19 01:43:19 tom Exp $") -+MODULE_ID("$Id: lib_wacs.c,v 1.14 2014/02/23 01:21:08 tom Exp $") - - NCURSES_EXPORT_VAR(cchar_t) * _nc_wacs = 0; - -@@ -119,22 +119,24 @@ - T(("initializing WIDE-ACS map (Unicode is%s active)", - active ? "" : " not")); - -- _nc_wacs = typeCalloc(cchar_t, ACS_LEN); -- for (n = 0; n < SIZEOF(table); ++n) { -- int wide = wcwidth(table[n].value[active]); -- -- m = table[n].map; -- if (active && (wide == 1)) { -- SetChar(_nc_wacs[m], table[n].value[active], A_NORMAL); -- } else if (acs_map[m] & A_ALTCHARSET) { -- SetChar(_nc_wacs[m], m, A_ALTCHARSET); -- } else { -- SetChar(_nc_wacs[m], table[n].value[0], A_NORMAL); -- } -+ if ((_nc_wacs = typeCalloc(cchar_t, ACS_LEN)) != 0) { -+ -+ for (n = 0; n < SIZEOF(table); ++n) { -+ int wide = wcwidth((wchar_t) table[n].value[active]); - -- T(("#%d, SetChar(%c, %#04x) = %s", -- n, m, -- table[n].value[active], -- _tracecchar_t(&_nc_wacs[m]))); -+ m = table[n].map; -+ if (active && (wide == 1)) { -+ SetChar(_nc_wacs[m], table[n].value[1], A_NORMAL); -+ } else if (acs_map[m] & A_ALTCHARSET) { -+ SetChar(_nc_wacs[m], m, A_ALTCHARSET); -+ } else { -+ SetChar(_nc_wacs[m], table[n].value[0], A_NORMAL); -+ } -+ -+ T(("#%d, SetChar(%c, %#04x) = %s", -+ n, m, -+ table[n].value[active], -+ _tracecchar_t(&_nc_wacs[m]))); -+ } - } - } -diff -Naur ncurses-5.9/ncurses/widechar/lib_wunctrl.c ncurses-5.9.patch/ncurses/widechar/lib_wunctrl.c ---- ncurses-5.9/ncurses/widechar/lib_wunctrl.c 2010-12-19 02:42:15.000000000 +0100 -+++ ncurses-5.9.patch/ncurses/widechar/lib_wunctrl.c 2014-09-01 16:33:22.459792294 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 2001-2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 2001-2011,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -35,14 +35,17 @@ - - #include <curses.priv.h> - --MODULE_ID("$Id: lib_wunctrl.c,v 1.14 2010/12/19 01:42:15 tom Exp $") -+MODULE_ID("$Id: lib_wunctrl.c,v 1.16 2012/12/15 20:53:42 tom Exp $") - - NCURSES_EXPORT(wchar_t *) - NCURSES_SP_NAME(wunctrl) (NCURSES_SP_DCLx cchar_t *wc) - { - static wchar_t str[CCHARW_MAX + 1], *wsp; -+ wchar_t *result; - -- if (Charable(*wc)) { -+ if (wc == 0) { -+ result = 0; -+ } else if (SP_PARM != 0 && Charable(*wc)) { - const char *p = - NCURSES_SP_NAME(unctrl) (NCURSES_SP_ARGx - (unsigned) _nc_to_char((wint_t)CharOf(*wc))); -@@ -51,9 +54,11 @@ - *wsp++ = (wchar_t) _nc_to_widechar(*p); - } - *wsp = 0; -- return str; -- } else -- return wc->chars; -+ result = str; -+ } else { -+ result = wc->chars; -+ } -+ return result; - } - - #if NCURSES_SP_FUNCS -diff -Naur ncurses-5.9/ncurses/widechar/widechars.c ncurses-5.9.patch/ncurses/widechar/widechars.c ---- ncurses-5.9/ncurses/widechar/widechars.c 1970-01-01 01:00:00.000000000 +0100 -+++ ncurses-5.9.patch/ncurses/widechar/widechars.c 2014-09-01 16:33:22.518792397 +0200 -@@ -0,0 +1,152 @@ -+/**************************************************************************** -+ * Copyright (c) 2012,2013 Free Software Foundation, Inc. * -+ * * -+ * Permission is hereby granted, free of charge, to any person obtaining a * -+ * copy of this software and associated documentation files (the * -+ * "Software"), to deal in the Software without restriction, including * -+ * without limitation the rights to use, copy, modify, merge, publish, * -+ * distribute, distribute with modifications, sublicense, and/or sell * -+ * copies of the Software, and to permit persons to whom the Software is * -+ * furnished to do so, subject to the following conditions: * -+ * * -+ * The above copyright notice and this permission notice shall be included * -+ * in all copies or substantial portions of the Software. * -+ * * -+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * -+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * -+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * -+ * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * -+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * -+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * -+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * -+ * * -+ * Except as contained in this notice, the name(s) of the above copyright * -+ * holders shall not be used in advertising or otherwise to promote the * -+ * sale, use or other dealings in this Software without prior written * -+ * authorization. * -+ ****************************************************************************/ -+ -+#include <curses.priv.h> -+ -+#if USE_WIDEC_SUPPORT -+ -+MODULE_ID("$Id: widechars.c,v 1.5 2013/03/02 18:55:51 tom Exp $") -+ -+#if defined(__MINGW32__) -+/* -+ * MinGW has wide-character functions, but they do not work correctly. -+ */ -+ -+int -+_nc_mbtowc(wchar_t *pwc, const char *s, size_t n) -+{ -+ int result; -+ int count; -+ int try; -+ -+ if (s != 0 && n != 0) { -+ /* -+ * MultiByteToWideChar() can decide to return more than one -+ * wide-character. We want only one. Ignore any trailing null, both -+ * in the initial count and in the conversion. -+ */ -+ count = 0; -+ for (try = 1; try <= (int) n; ++try) { -+ count = MultiByteToWideChar(CP_UTF8, -+ MB_ERR_INVALID_CHARS, -+ s, -+ try, -+ pwc, -+ 0); -+ TR(TRACE_BITS, ("...try %d:%d", try, count)); -+ if (count > 0) { -+ break; -+ } -+ } -+ if (count < 1 || count > 2) { -+ result = -1; -+ } else { -+ wchar_t actual[2]; -+ memset(&actual, 0, sizeof(actual)); -+ count = MultiByteToWideChar(CP_UTF8, -+ MB_ERR_INVALID_CHARS, -+ s, -+ try, -+ actual, -+ 2); -+ TR(TRACE_BITS, ("\twin32 ->%#x, %#x", actual[0], actual[1])); -+ *pwc = actual[0]; -+ if (actual[1] != 0) -+ result = -1; -+ else -+ result = try; -+ } -+ } else { -+ result = 0; -+ } -+ -+ return result; -+} -+ -+int -+_nc_mblen(const char *s, size_t n) -+{ -+ int result = -1; -+ int count; -+ wchar_t temp; -+ -+ if (s != 0 && n != 0) { -+ count = _nc_mbtowc(&temp, s, n); -+ if (count == 1) { -+ int check = WideCharToMultiByte(CP_UTF8, -+ 0, -+ &temp, -+ 1, -+ NULL, -+ 0, /* compute length only */ -+ NULL, -+ NULL); -+ TR(TRACE_BITS, ("\tcheck ->%d\n", check)); -+ if (check > 0 && (size_t) check <= n) { -+ result = check; -+ } -+ } -+ } else { -+ result = 0; -+ } -+ -+ return result; -+} -+ -+int __MINGW_NOTHROW -+_nc_wctomb(char *s, wchar_t wc) -+{ -+ int result; -+ int check; -+ -+ check = WideCharToMultiByte(CP_UTF8, -+ 0, -+ &wc, -+ 1, -+ NULL, -+ 0, /* compute length only */ -+ NULL, -+ NULL); -+ if (check > 0) { -+ result = WideCharToMultiByte(CP_UTF8, -+ 0, -+ &wc, -+ 1, -+ s, -+ check + 1, -+ NULL, -+ NULL); -+ } else { -+ result = -1; -+ } -+ return result; -+} -+ -+#endif /* __MINGW32__ */ -+ -+#endif /* USE_WIDEC_SUPPORT */ -diff -Naur ncurses-5.9/ncurses/win32con/win_driver.c ncurses-5.9.patch/ncurses/win32con/win_driver.c ---- ncurses-5.9/ncurses/win32con/win_driver.c 2010-12-25 20:28:21.000000000 +0100 -+++ ncurses-5.9.patch/ncurses/win32con/win_driver.c 2014-09-01 16:33:22.518792397 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2013,2014 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -28,7 +28,7 @@ - - /**************************************************************************** - * Author: Juergen Pfeifer * -- * * -+ * and: Thomas E. Dickey * - ****************************************************************************/ - - /* -@@ -39,15 +39,21 @@ - #include <curses.priv.h> - #define CUR my_term.type. - --MODULE_ID("$Id: win_driver.c,v 1.10 2010/12/25 19:28:21 tom Exp $") -+MODULE_ID("$Id: win_driver.c,v 1.28 2014/03/08 21:44:53 tom Exp $") - - #define WINMAGIC NCDRV_MAGIC(NCDRV_WINCONSOLE) - --#define AssertTCB() assert(TCB!=0 && TCB->magic==WINMAGIC) --#define SetSP() assert(TCB->csp!=0); sp = TCB->csp -+#define EXP_OPTIMIZE 0 -+ -+#define okConsoleHandle(TCB) (TCB != 0 && !InvalidConsoleHandle(TCB->hdl)) -+ -+#define AssertTCB() assert(TCB != 0 && (TCB->magic == WINMAGIC)) -+#define SetSP() assert(TCB->csp != 0); sp = TCB->csp; (void) sp - - #define GenMap(vKey,key) MAKELONG(key, vKey) - -+#define AdjustY(p) ((p)->buffered ? 0 : (int) (p)->SBI.srWindow.Top) -+ - static const LONG keylist[] = - { - GenMap(VK_PRIOR, KEY_PPAGE), -@@ -69,9 +75,14 @@ - typedef struct props { - CONSOLE_SCREEN_BUFFER_INFO SBI; - bool progMode; -+ TERM_HANDLE lastOut; - DWORD map[MAPSIZE]; - DWORD rmap[MAPSIZE]; - WORD pairs[NUMPAIRS]; -+ bool buffered; /* normally allocate console-buffer */ -+ bool window_only; /* ..if not, we save buffer or window-only */ -+ COORD origin; -+ CHAR_INFO *save_screen; - } Properties; - - #define PropOf(TCB) ((Properties*)TCB->prop) -@@ -103,7 +114,7 @@ - } - - static WORD --MapAttr(TERMINAL_CONTROL_BLOCK * TCB, WORD res, chtype ch) -+MapAttr(TERMINAL_CONTROL_BLOCK * TCB, WORD res, attr_t ch) - { - if (ch & A_COLOR) { - int p; -@@ -115,16 +126,22 @@ - if (p > 0 && p < NUMPAIRS && TCB != 0 && sp != 0) { - WORD a; - a = PropOf(TCB)->pairs[p]; -- res = (res & 0xff00) | a; -+ res = (WORD) ((res & 0xff00) | a); - } - } - -- if (ch & A_REVERSE) -- res = ((res & 0xff00) | (((res & 0x07) << 4) | ((res & 0x70) >> 4))); -+ if (ch & A_REVERSE) { -+ res = (WORD) ((res & 0xff00) | -+ (((res & 0x07) << 4) | -+ ((res & 0x70) >> 4))); -+ } - -- if (ch & A_STANDOUT) -- res = ((res & 0xff00) | (((res & 0x07) << 4) | ((res & 0x70) >> 4)) -- | BACKGROUND_INTENSITY); -+ if (ch & A_STANDOUT) { -+ res = (WORD) ((res & 0xff00) | -+ (((res & 0x07) << 4) | -+ ((res & 0x70) >> 4)) | -+ BACKGROUND_INTENSITY); -+ } - - if (ch & A_BOLD) - res |= FOREGROUND_INTENSITY; -@@ -135,8 +152,69 @@ - return res; - } - -+#if USE_WIDEC_SUPPORT -+/* -+ * TODO: support surrogate pairs -+ * TODO: support combining characters -+ * TODO: support acsc -+ * TODO: check wcwidth of base character, fill if needed for double-width -+ * TODO: _nc_wacs should be part of sp. -+ */ - static BOOL --con_write(TERMINAL_CONTROL_BLOCK * TCB, int y, int x, chtype *str, int n) -+con_write16(TERMINAL_CONTROL_BLOCK * TCB, int y, int x, cchar_t *str, int limit) -+{ -+ int actual = 0; -+ CHAR_INFO ci[limit]; -+ COORD loc, siz; -+ SMALL_RECT rec; -+ int i; -+ cchar_t ch; -+ SCREEN *sp; -+ Properties *p = PropOf(TCB); -+ -+ AssertTCB(); -+ -+ SetSP(); -+ -+ for (i = actual = 0; i < limit; i++) { -+ ch = str[i]; -+ if (isWidecExt(ch)) -+ continue; -+ ci[actual].Char.UnicodeChar = CharOf(ch); -+ ci[actual].Attributes = MapAttr(TCB, -+ PropOf(TCB)->SBI.wAttributes, -+ AttrOf(ch)); -+ if (AttrOf(ch) & A_ALTCHARSET) { -+ if (_nc_wacs) { -+ int which = CharOf(ch); -+ if (which > 0 -+ && which < ACS_LEN -+ && CharOf(_nc_wacs[which]) != 0) { -+ ci[actual].Char.UnicodeChar = CharOf(_nc_wacs[which]); -+ } else { -+ ci[actual].Char.UnicodeChar = ' '; -+ } -+ } -+ } -+ ++actual; -+ } -+ -+ loc.X = (short) 0; -+ loc.Y = (short) 0; -+ siz.X = (short) actual; -+ siz.Y = 1; -+ -+ rec.Left = (short) x; -+ rec.Top = (SHORT) (y + AdjustY(p)); -+ rec.Right = (short) (x + limit - 1); -+ rec.Bottom = rec.Top; -+ -+ return WriteConsoleOutputW(TCB->hdl, ci, siz, loc, &rec); -+} -+#define con_write(tcb, y, x, str, n) con_write16(tcb, y, x, str, n) -+#else -+static BOOL -+con_write8(TERMINAL_CONTROL_BLOCK * TCB, int y, int x, chtype *str, int n) - { - CHAR_INFO ci[n]; - COORD loc, siz; -@@ -147,9 +225,6 @@ - - AssertTCB(); - -- if (TCB == 0 || InvalidConsoleHandle(TCB->hdl)) -- return FALSE; -- - SetSP(); - - for (i = 0; i < n; i++) { -@@ -161,7 +236,7 @@ - if (ChAttrOf(ch) & A_ALTCHARSET) { - if (sp->_acs_map) - ci[i].Char.AsciiChar = -- ChCharOf(NCURSES_SP_NAME(_nc_acs_char) (sp, ChCharOf(ch))); -+ ChCharOf(NCURSES_SP_NAME(_nc_acs_char) (sp, ChCharOf(ch))); - } - } - -@@ -177,55 +252,199 @@ - - return WriteConsoleOutput(TCB->hdl, ci, siz, loc, &rec); - } -+#define con_write(tcb, y, x, str, n) con_write8(tcb, y, x, str, n) -+#endif -+ -+#if EXP_OPTIMIZE -+/* -+ * Comparing new/current screens, determine the last column-index for a change -+ * beginning on the given row,col position. Unlike a serial terminal, there is -+ * no cost for "moving" the "cursor" on the line as we update it. -+ */ -+static int -+find_end_of_change(SCREEN *sp, int row, int col) -+{ -+ int result = col; -+ struct ldat *curdat = CurScreen(sp)->_line + row; -+ struct ldat *newdat = NewScreen(sp)->_line + row; -+ -+ while (col <= newdat->lastchar) { -+#if USE_WIDEC_SUPPORT -+ if (isWidecExt(curdat->text[col]) || isWidecExt(newdat->text[col])) { -+ result = col; -+ } else if (memcmp(&curdat->text[col], -+ &newdat->text[col], -+ sizeof(curdat->text[0]))) { -+ result = col; -+ } else { -+ break; -+ } -+#else -+ if (curdat->text[col] != newdat->text[col]) { -+ result = col; -+ } else { -+ break; -+ } -+#endif -+ ++col; -+ } -+ return result; -+} -+ -+/* -+ * Given a row,col position at the end of a change-chunk, look for the -+ * beginning of the next change-chunk. -+ */ -+static int -+find_next_change(SCREEN *sp, int row, int col) -+{ -+ struct ldat *curdat = CurScreen(sp)->_line + row; -+ struct ldat *newdat = NewScreen(sp)->_line + row; -+ int result = newdat->lastchar + 1; -+ -+ while (++col <= newdat->lastchar) { -+#if USE_WIDEC_SUPPORT -+ if (isWidecExt(curdat->text[col]) != isWidecExt(newdat->text[col])) { -+ result = col; -+ break; -+ } else if (memcmp(&curdat->text[col], -+ &newdat->text[col], -+ sizeof(curdat->text[0]))) { -+ result = col; -+ break; -+ } -+#else -+ if (curdat->text[col] != newdat->text[col]) { -+ result = col; -+ break; -+ } -+#endif -+ } -+ return result; -+} -+ -+#define EndChange(first) \ -+ find_end_of_change(sp, y, first) -+#define NextChange(last) \ -+ find_next_change(sp, y, last) -+ -+#endif /* EXP_OPTIMIZE */ - - #define MARK_NOCHANGE(win,row) \ - win->_line[row].firstchar = _NOCHANGE; \ - win->_line[row].lastchar = _NOCHANGE - -+static void -+selectActiveHandle(TERMINAL_CONTROL_BLOCK * TCB) -+{ -+ if (PropOf(TCB)->lastOut != TCB->hdl) { -+ PropOf(TCB)->lastOut = TCB->hdl; -+ SetConsoleActiveScreenBuffer(PropOf(TCB)->lastOut); -+ } -+} -+ -+static bool -+restore_original_screen(TERMINAL_CONTROL_BLOCK * TCB) -+{ -+ COORD bufferCoord; -+ SMALL_RECT writeRegion; -+ Properties *p = PropOf(TCB); -+ bool result = FALSE; -+ -+ if (p->window_only) { -+ writeRegion.Top = p->SBI.srWindow.Top; -+ writeRegion.Left = p->SBI.srWindow.Left; -+ writeRegion.Bottom = p->SBI.srWindow.Bottom; -+ writeRegion.Right = p->SBI.srWindow.Right; -+ T(("... restoring window")); -+ } else { -+ writeRegion.Top = 0; -+ writeRegion.Left = 0; -+ writeRegion.Bottom = (SHORT) (p->SBI.dwSize.Y - 1); -+ writeRegion.Right = (SHORT) (p->SBI.dwSize.X - 1); -+ T(("... restoring entire buffer")); -+ } -+ -+ bufferCoord.X = bufferCoord.Y = 0; -+ -+ if (WriteConsoleOutput(TCB->hdl, -+ p->save_screen, -+ p->SBI.dwSize, -+ bufferCoord, -+ &writeRegion)) { -+ result = TRUE; -+ mvcur(-1, -1, LINES - 2, 0); -+ } -+ T(("... restore original screen contents %s", result ? "ok" : "err")); -+ return result; -+} -+ - static int - drv_doupdate(TERMINAL_CONTROL_BLOCK * TCB) - { -+ int result = ERR; - int y, nonempty, n, x0, x1, Width, Height; - SCREEN *sp; - - AssertTCB(); - SetSP(); - -- Width = screen_columns(sp); -- Height = screen_lines(sp); -- nonempty = min(Height, NewScreen(sp)->_maxy + 1); -- -- if ((CurScreen(sp)->_clear || NewScreen(sp)->_clear)) { -- int x; -- chtype empty[Width]; -+ T((T_CALLED("win32con::drv_doupdate(%p)"), TCB)); -+ if (okConsoleHandle(TCB)) { - -- for (x = 0; x < Width; x++) -- empty[x] = ' '; -+ Width = screen_columns(sp); -+ Height = screen_lines(sp); -+ nonempty = min(Height, NewScreen(sp)->_maxy + 1); -+ -+ if ((CurScreen(sp)->_clear || NewScreen(sp)->_clear)) { -+ int x; -+#if USE_WIDEC_SUPPORT -+ cchar_t empty[Width]; -+ wchar_t blank[2] = -+ { -+ L' ', L'\0' -+ }; -+ -+ for (x = 0; x < Width; x++) -+ setcchar(&empty[x], blank, 0, 0, 0); -+#else -+ chtype empty[Width]; -+ -+ for (x = 0; x < Width; x++) -+ empty[x] = ' '; -+#endif -+ -+ for (y = 0; y < nonempty; y++) { -+ con_write(TCB, y, 0, empty, Width); -+ memcpy(empty, -+ CurScreen(sp)->_line[y].text, -+ (size_t) Width * sizeof(empty[0])); -+ } -+ CurScreen(sp)->_clear = FALSE; -+ NewScreen(sp)->_clear = FALSE; -+ touchwin(NewScreen(sp)); -+ } - - for (y = 0; y < nonempty; y++) { -- con_write(TCB, y, 0, empty, Width); -- memcpy(empty, -- CurScreen(sp)->_line[y].text, -- Width * sizeof(chtype)); -- } -- CurScreen(sp)->_clear = FALSE; -- NewScreen(sp)->_clear = FALSE; -- touchwin(NewScreen(sp)); -- } -- -- for (y = 0; y < nonempty; y++) { -- x0 = NewScreen(sp)->_line[y].firstchar; -- if (x0 != _NOCHANGE) { -- x1 = NewScreen(sp)->_line[y].lastchar; -- n = x1 - x0 + 1; -- if (n > 0) { -- memcpy(CurScreen(sp)->_line[y].text + x0, -- NewScreen(sp)->_line[y].text + x0, -- n * sizeof(chtype)); -- con_write(TCB, -- y, -- x0, -- ((chtype *) CurScreen(sp)->_line[y].text) + x0, n); -+ x0 = NewScreen(sp)->_line[y].firstchar; -+ if (x0 != _NOCHANGE) { -+#if EXP_OPTIMIZE -+ int x2; -+ int limit = NewScreen(sp)->_line[y].lastchar; -+ while ((x1 = EndChange(x0)) <= limit) { -+ while ((x2 = NextChange(x1)) <= limit && x2 <= (x1 + 2)) { -+ x1 = x2; -+ } -+ n = x1 - x0 + 1; -+ memcpy(&CurScreen(sp)->_line[y].text[x0], -+ &NewScreen(sp)->_line[y].text[x0], -+ n * sizeof(CurScreen(sp)->_line[y].text[x0])); -+ con_write(TCB, -+ y, -+ x0, -+ &CurScreen(sp)->_line[y].text[x0], n); -+ x0 = NextChange(x1); -+ } - - /* mark line changed successfully */ - if (y <= NewScreen(sp)->_maxy) { -@@ -234,26 +453,50 @@ - if (y <= CurScreen(sp)->_maxy) { - MARK_NOCHANGE(CurScreen(sp), y); - } -+#else -+ x1 = NewScreen(sp)->_line[y].lastchar; -+ n = x1 - x0 + 1; -+ if (n > 0) { -+ memcpy(&CurScreen(sp)->_line[y].text[x0], -+ &NewScreen(sp)->_line[y].text[x0], -+ (size_t) n * sizeof(CurScreen(sp)->_line[y].text[x0])); -+ con_write(TCB, -+ y, -+ x0, -+ &CurScreen(sp)->_line[y].text[x0], n); -+ -+ /* mark line changed successfully */ -+ if (y <= NewScreen(sp)->_maxy) { -+ MARK_NOCHANGE(NewScreen(sp), y); -+ } -+ if (y <= CurScreen(sp)->_maxy) { -+ MARK_NOCHANGE(CurScreen(sp), y); -+ } -+ } -+#endif - } - } -- } -- -- /* put everything back in sync */ -- for (y = nonempty; y <= NewScreen(sp)->_maxy; y++) { -- MARK_NOCHANGE(NewScreen(sp), y); -- } -- for (y = nonempty; y <= CurScreen(sp)->_maxy; y++) { -- MARK_NOCHANGE(CurScreen(sp), y); -- } - -- if (!NewScreen(sp)->_leaveok) { -- CurScreen(sp)->_curx = NewScreen(sp)->_curx; -- CurScreen(sp)->_cury = NewScreen(sp)->_cury; -+ /* put everything back in sync */ -+ for (y = nonempty; y <= NewScreen(sp)->_maxy; y++) { -+ MARK_NOCHANGE(NewScreen(sp), y); -+ } -+ for (y = nonempty; y <= CurScreen(sp)->_maxy; y++) { -+ MARK_NOCHANGE(CurScreen(sp), y); -+ } - -- TCB->drv->hwcur(TCB, 0, 0, CurScreen(sp)->_cury, CurScreen(sp)->_curx); -+ if (!NewScreen(sp)->_leaveok) { -+ CurScreen(sp)->_curx = NewScreen(sp)->_curx; -+ CurScreen(sp)->_cury = NewScreen(sp)->_cury; -+ -+ TCB->drv->td_hwcur(TCB, -+ 0, 0, -+ CurScreen(sp)->_cury, CurScreen(sp)->_curx); -+ } -+ selectActiveHandle(TCB); -+ result = OK; - } -- SetConsoleActiveScreenBuffer(TCB->hdl); -- return OK; -+ returnCode(result); - } - - static bool -@@ -269,14 +512,14 @@ - assert(tname != 0); - - TCB->magic = WINMAGIC; -- if (*tname == 0 || *tname == 0) { -+ if (*tname == 0 || *tname == 0 || *tname == '#') { - code = TRUE; - } else { - TERMINAL my_term; - int status; - - code = FALSE; --#if (USE_DATABASE || USE_TERMCAP) -+#if (NCURSES_USE_DATABASE || NCURSES_USE_TERMCAP) - status = _nc_setup_tinfo(tname, &my_term.type); - #else - status = TGETENT_NO; -@@ -299,7 +542,7 @@ - - if (code) { - if ((TCB->term.type.Booleans) == 0) { -- _nc_init_entry(&(TCB->term.type)); -+ _nc_init_termtype(&(TCB->term.type)); - } - } - -@@ -308,7 +551,7 @@ - - static int - drv_dobeepflash(TERMINAL_CONTROL_BLOCK * TCB, -- bool beepFlag GCC_UNUSED) -+ int beepFlag GCC_UNUSED) - { - SCREEN *sp; - int res = ERR; -@@ -346,19 +589,55 @@ - return (code); - } - -+static bool -+get_SBI(TERMINAL_CONTROL_BLOCK * TCB) -+{ -+ bool rc = FALSE; -+ Properties *p = PropOf(TCB); -+ if (GetConsoleScreenBufferInfo(TCB->hdl, &(p->SBI))) { -+ T(("GetConsoleScreenBufferInfo")); -+ T(("... buffer(X:%d Y:%d)", -+ p->SBI.dwSize.X, -+ p->SBI.dwSize.Y)); -+ T(("... window(X:%d Y:%d)", -+ p->SBI.dwMaximumWindowSize.X, -+ p->SBI.dwMaximumWindowSize.Y)); -+ T(("... cursor(X:%d Y:%d)", -+ p->SBI.dwCursorPosition.X, -+ p->SBI.dwCursorPosition.Y)); -+ T(("... display(Top:%d Bottom:%d Left:%d Right:%d)", -+ p->SBI.srWindow.Top, -+ p->SBI.srWindow.Bottom, -+ p->SBI.srWindow.Left, -+ p->SBI.srWindow.Right)); -+ if (p->buffered) { -+ p->origin.X = 0; -+ p->origin.Y = 0; -+ } else { -+ p->origin.X = p->SBI.srWindow.Left; -+ p->origin.Y = p->SBI.srWindow.Top; -+ } -+ rc = TRUE; -+ } else { -+ T(("GetConsoleScreenBufferInfo ERR")); -+ } -+ return rc; -+} -+ - static void - drv_setcolor(TERMINAL_CONTROL_BLOCK * TCB, -- bool fore, -+ int fore, - int color, - int (*outc) (SCREEN *, int) GCC_UNUSED) - { - AssertTCB(); - -- if (TCB && !InvalidConsoleHandle(TCB->hdl)) { -+ if (okConsoleHandle(TCB) && -+ PropOf(TCB) != 0) { - WORD a = MapColor(fore, color); -- a = ((PropOf(TCB)->SBI.wAttributes) & (fore ? 0xfff8 : 0xff8f)) | a; -+ a |= (WORD) ((PropOf(TCB)->SBI.wAttributes) & (fore ? 0xfff8 : 0xff8f)); - SetConsoleTextAttribute(TCB->hdl, a); -- GetConsoleScreenBufferInfo(TCB->hdl, &(PropOf(TCB)->SBI)); -+ get_SBI(TCB); - } - } - -@@ -368,10 +647,10 @@ - bool res = FALSE; - - AssertTCB(); -- if (TCB && !InvalidConsoleHandle(TCB->hdl)) { -+ if (okConsoleHandle(TCB)) { - WORD a = FOREGROUND_BLUE | FOREGROUND_RED | FOREGROUND_GREEN; - SetConsoleTextAttribute(TCB->hdl, a); -- GetConsoleScreenBufferInfo(TCB->hdl, &(PropOf(TCB)->SBI)); -+ get_SBI(TCB); - res = TRUE; - } - return res; -@@ -392,14 +671,28 @@ - static int - drv_size(TERMINAL_CONTROL_BLOCK * TCB, int *Lines, int *Cols) - { -+ int result = ERR; -+ - AssertTCB(); - -- if (TCB == NULL || Lines == NULL || Cols == NULL || InvalidConsoleHandle(TCB->hdl)) -- return ERR; -+ T((T_CALLED("win32con::drv_size(%p)"), TCB)); - -- *Lines = (int) (PropOf(TCB)->SBI.dwSize.Y); -- *Cols = (int) (PropOf(TCB)->SBI.dwSize.X); -- return OK; -+ if (okConsoleHandle(TCB) && -+ PropOf(TCB) != 0 && -+ Lines != NULL && -+ Cols != NULL) { -+ if (PropOf(TCB)->buffered) { -+ *Lines = (int) (PropOf(TCB)->SBI.dwSize.Y); -+ *Cols = (int) (PropOf(TCB)->SBI.dwSize.X); -+ } else { -+ *Lines = (int) (PropOf(TCB)->SBI.srWindow.Bottom + 1 - -+ PropOf(TCB)->SBI.srWindow.Top); -+ *Cols = (int) (PropOf(TCB)->SBI.srWindow.Right + 1 - -+ PropOf(TCB)->SBI.srWindow.Left); -+ } -+ result = OK; -+ } -+ returnCode(result); - } - - static int -@@ -412,7 +705,7 @@ - } - - static int --drv_sgmode(TERMINAL_CONTROL_BLOCK * TCB, bool setFlag, TTY * buf) -+drv_sgmode(TERMINAL_CONTROL_BLOCK * TCB, int setFlag, TTY * buf) - { - DWORD dwFlag = 0; - tcflag_t iflag; -@@ -432,17 +725,17 @@ - if (lflag & ICANON) - dwFlag |= ENABLE_LINE_INPUT; - else -- dwFlag &= ~ENABLE_LINE_INPUT; -+ dwFlag &= (DWORD) (~ENABLE_LINE_INPUT); - - if (lflag & ECHO) - dwFlag |= ENABLE_ECHO_INPUT; - else -- dwFlag &= ~ENABLE_ECHO_INPUT; -+ dwFlag &= (DWORD) (~ENABLE_ECHO_INPUT); - - if (iflag & BRKINT) - dwFlag |= ENABLE_PROCESSED_INPUT; - else -- dwFlag &= ~ENABLE_PROCESSED_INPUT; -+ dwFlag &= (DWORD) (~ENABLE_PROCESSED_INPUT); - - dwFlag |= ENABLE_MOUSE_INPUT; - -@@ -458,17 +751,17 @@ - if (dwFlag & ENABLE_LINE_INPUT) - lflag |= ICANON; - else -- lflag &= ~ICANON; -+ lflag &= (tcflag_t) (~ICANON); - - if (dwFlag & ENABLE_ECHO_INPUT) - lflag |= ECHO; - else -- lflag &= ~ECHO; -+ lflag &= (tcflag_t) (~ECHO); - - if (dwFlag & ENABLE_PROCESSED_INPUT) - iflag |= BRKINT; - else -- iflag &= ~BRKINT; -+ iflag &= (tcflag_t) (~BRKINT); - - TCB->term.Nttyb.c_iflag = iflag; - TCB->term.Nttyb.c_lflag = lflag; -@@ -479,7 +772,7 @@ - } - - static int --drv_mode(TERMINAL_CONTROL_BLOCK * TCB, bool progFlag, bool defFlag) -+drv_mode(TERMINAL_CONTROL_BLOCK * TCB, int progFlag, int defFlag) - { - SCREEN *sp; - TERMINAL *_term = (TERMINAL *) TCB; -@@ -488,13 +781,15 @@ - AssertTCB(); - sp = TCB->csp; - -+ T((T_CALLED("win32con::drv_mode(%p, prog=%d, def=%d)"), TCB, progFlag, defFlag)); - PropOf(TCB)->progMode = progFlag; -- SetConsoleActiveScreenBuffer(progFlag ? TCB->hdl : TCB->out); -+ PropOf(TCB)->lastOut = progFlag ? TCB->hdl : TCB->out; -+ SetConsoleActiveScreenBuffer(PropOf(TCB)->lastOut); - - if (progFlag) /* prog mode */ { - if (defFlag) { - if ((drv_sgmode(TCB, FALSE, &(_term->Nttyb)) == OK)) { -- _term->Nttyb.c_oflag &= ~OFLAGS_TABS; -+ _term->Nttyb.c_oflag &= (tcflag_t) (~OFLAGS_TABS); - code = OK; - } - } else { -@@ -503,7 +798,6 @@ - if (sp) { - if (sp->_keypad_on) - _nc_keypad(sp, TRUE); -- NC_BUFFERED(sp, TRUE); - } - code = OK; - } -@@ -519,9 +813,12 @@ - if (sp) { - _nc_keypad(sp, FALSE); - NCURSES_SP_NAME(_nc_flush) (sp); -- NC_BUFFERED(sp, FALSE); - } - code = drv_sgmode(TCB, TRUE, &(_term->Ottyb)); -+ if (!PropOf(TCB)->buffered) { -+ if (!restore_original_screen(TCB)) -+ code = ERR; -+ } - } - } - -@@ -593,6 +890,93 @@ - returnVoid; - } - -+/* -+ * Attempt to save the screen contents. PDCurses does this if -+ * PDC_RESTORE_SCREEN is set, giving the same visual appearance on restoration -+ * as if the library had allocated a console buffer. -+ */ -+static bool -+save_original_screen(TERMINAL_CONTROL_BLOCK * TCB) -+{ -+ bool result = FALSE; -+ Properties *p = PropOf(TCB); -+ COORD bufferSize; -+ COORD bufferCoord; -+ SMALL_RECT readRegion; -+ size_t want; -+ -+ bufferSize.X = p->SBI.dwSize.X; -+ bufferSize.Y = p->SBI.dwSize.Y; -+ want = (size_t) (bufferSize.X * bufferSize.Y); -+ -+ if ((p->save_screen = malloc(want * sizeof(CHAR_INFO))) != 0) { -+ bufferCoord.X = bufferCoord.Y = 0; -+ -+ readRegion.Top = 0; -+ readRegion.Left = 0; -+ readRegion.Bottom = (SHORT) (bufferSize.Y - 1); -+ readRegion.Right = (SHORT) (bufferSize.X - 1); -+ -+ T(("... reading console buffer %dx%d into %d,%d - %d,%d at %d,%d", -+ bufferSize.Y, bufferSize.X, -+ readRegion.Top, -+ readRegion.Left, -+ readRegion.Bottom, -+ readRegion.Right, -+ bufferCoord.Y, -+ bufferCoord.X)); -+ -+ if (ReadConsoleOutput(TCB->hdl, -+ p->save_screen, -+ bufferSize, -+ bufferCoord, -+ &readRegion)) { -+ result = TRUE; -+ } else { -+ T((" error %#lx", (unsigned long) GetLastError())); -+ FreeAndNull(p->save_screen); -+ -+ bufferSize.X = (SHORT) (p->SBI.srWindow.Right -+ - p->SBI.srWindow.Left + 1); -+ bufferSize.Y = (SHORT) (p->SBI.srWindow.Bottom -+ - p->SBI.srWindow.Top + 1); -+ want = (size_t) (bufferSize.X * bufferSize.Y); -+ -+ if ((p->save_screen = malloc(want * sizeof(CHAR_INFO))) != 0) { -+ bufferCoord.X = bufferCoord.Y = 0; -+ -+ readRegion.Top = p->SBI.srWindow.Top; -+ readRegion.Left = p->SBI.srWindow.Left; -+ readRegion.Bottom = p->SBI.srWindow.Bottom; -+ readRegion.Right = p->SBI.srWindow.Right; -+ -+ T(("... reading console window %dx%d into %d,%d - %d,%d at %d,%d", -+ bufferSize.Y, bufferSize.X, -+ readRegion.Top, -+ readRegion.Left, -+ readRegion.Bottom, -+ readRegion.Right, -+ bufferCoord.Y, -+ bufferCoord.X)); -+ -+ if (ReadConsoleOutput(TCB->hdl, -+ p->save_screen, -+ bufferSize, -+ bufferCoord, -+ &readRegion)) { -+ result = TRUE; -+ p->window_only = TRUE; -+ } else { -+ T((" error %#lx", (unsigned long) GetLastError())); -+ } -+ } -+ } -+ } -+ -+ T(("... save original screen contents %s", result ? "ok" : "err")); -+ return result; -+} -+ - static void - drv_init(TERMINAL_CONTROL_BLOCK * TCB) - { -@@ -606,6 +990,7 @@ - BOOL b = AllocConsole(); - WORD a; - int i; -+ bool buffered = TRUE; - - if (!b) - b = AttachConsole(ATTACH_PARENT_PROCESS); -@@ -613,18 +998,32 @@ - TCB->inp = GetStdHandle(STD_INPUT_HANDLE); - TCB->out = GetStdHandle(STD_OUTPUT_HANDLE); - -- if (getenv("NCGDB")) -+ if (getenv("NCGDB") || getenv("NCURSES_CONSOLE2")) { - TCB->hdl = TCB->out; -- else -+ buffered = FALSE; -+ } else { - TCB->hdl = CreateConsoleScreenBuffer(GENERIC_READ | GENERIC_WRITE, - 0, - NULL, - CONSOLE_TEXTMODE_BUFFER, - NULL); -+ } - -- if (!InvalidConsoleHandle(TCB->hdl)) { -- TCB->prop = typeCalloc(Properties, 1); -- GetConsoleScreenBufferInfo(TCB->hdl, &(PropOf(TCB)->SBI)); -+ if (InvalidConsoleHandle(TCB->hdl)) { -+ returnVoid; -+ } else if ((TCB->prop = typeCalloc(Properties, 1)) != 0) { -+ PropOf(TCB)->buffered = buffered; -+ PropOf(TCB)->window_only = FALSE; -+ if (!get_SBI(TCB)) { -+ FreeAndNull(TCB->prop); /* force error in drv_size */ -+ returnVoid; -+ } -+ if (!buffered) { -+ if (!save_original_screen(TCB)) { -+ FreeAndNull(TCB->prop); /* force error in drv_size */ -+ returnVoid; -+ } -+ } - } - - TCB->info.initcolor = TRUE; -@@ -642,7 +1041,7 @@ - - if (GetNumberOfConsoleMouseButtons(&num_buttons)) { - T(("mouse has %ld buttons", num_buttons)); -- TCB->info.numbuttons = num_buttons; -+ TCB->info.numbuttons = (int) num_buttons; - } else { - TCB->info.numbuttons = 1; - } -@@ -651,10 +1050,10 @@ - - for (i = 0; i < (N_INI + FKEYS); i++) { - if (i < N_INI) -- PropOf(TCB)->rmap[i] = PropOf(TCB)->map[i] = keylist[i]; -+ PropOf(TCB)->rmap[i] = PropOf(TCB)->map[i] = (DWORD) keylist[i]; - else - PropOf(TCB)->rmap[i] = PropOf(TCB)->map[i] = -- GenMap((VK_F1 + (i - N_INI)), (KEY_F(1) + (i - N_INI))); -+ (DWORD) GenMap((VK_F1 + (i - N_INI)), (KEY_F(1) + (i - N_INI))); - } - qsort(PropOf(TCB)->map, - (size_t) (MAPSIZE), -@@ -674,9 +1073,9 @@ - - static void - drv_initpair(TERMINAL_CONTROL_BLOCK * TCB, -- short pair, -- short f, -- short b) -+ int pair, -+ int f, -+ int b) - { - SCREEN *sp; - -@@ -691,10 +1090,10 @@ - - static void - drv_initcolor(TERMINAL_CONTROL_BLOCK * TCB, -- short color GCC_UNUSED, -- short r GCC_UNUSED, -- short g GCC_UNUSED, -- short b GCC_UNUSED) -+ int color GCC_UNUSED, -+ int r GCC_UNUSED, -+ int g GCC_UNUSED, -+ int b GCC_UNUSED) - { - SCREEN *sp; - -@@ -704,9 +1103,9 @@ - - static void - drv_do_color(TERMINAL_CONTROL_BLOCK * TCB, -- short old_pair GCC_UNUSED, -- short pair GCC_UNUSED, -- bool reverse GCC_UNUSED, -+ int old_pair GCC_UNUSED, -+ int pair GCC_UNUSED, -+ int reverse GCC_UNUSED, - int (*outc) (SCREEN *, int) GCC_UNUSED - ) - { -@@ -739,11 +1138,11 @@ - if (sp->_drv_mouse_head < sp->_drv_mouse_tail) { - rc = TW_MOUSE; - } else { -- rc = TCBOf(sp)->drv->twait(TCBOf(sp), -- TWAIT_MASK, -- delay, -- (int *) 0 -- EVENTLIST_2nd(evl)); -+ rc = TCBOf(sp)->drv->td_twait(TCBOf(sp), -+ TWAIT_MASK, -+ delay, -+ (int *) 0 -+ EVENTLIST_2nd(evl)); - } - - return rc; -@@ -755,10 +1154,11 @@ - int y, int x) - { - int ret = ERR; -- if (TCB && !InvalidConsoleHandle(TCB->hdl)) { -+ if (okConsoleHandle(TCB)) { -+ Properties *p = PropOf(TCB); - COORD loc; - loc.X = (short) x; -- loc.Y = (short) y; -+ loc.Y = (short) (y + AdjustY(p)); - SetConsoleCursorPosition(TCB->hdl, loc); - ret = OK; - } -@@ -778,7 +1178,7 @@ - - static void - drv_hwlabelOnOff(TERMINAL_CONTROL_BLOCK * TCB, -- bool OnFlag GCC_UNUSED) -+ int OnFlag GCC_UNUSED) - { - SCREEN *sp; - -@@ -844,7 +1244,7 @@ - SetSP(); - - for (n = 0; n < SIZEOF(table); ++n) { -- real_map[table[n].acs_code] = table[n].use_code | A_ALTCHARSET; -+ real_map[table[n].acs_code] = (chtype) table[n].use_code | A_ALTCHARSET; - if (sp != 0) - sp->_screen_acs_map[table[n].acs_code] = TRUE; - } -@@ -931,7 +1331,7 @@ - SCREEN *sp; - INPUT_RECORD inp_rec; - BOOL b; -- DWORD nRead = 0, rc = -1; -+ DWORD nRead = 0, rc = (DWORD) (-1); - int code = 0; - FILETIME fstart; - FILETIME fend; -@@ -953,7 +1353,7 @@ - - while (true) { - GetSystemTimeAsFileTime(&fstart); -- rc = WaitForSingleObject(TCB->inp, milliseconds); -+ rc = WaitForSingleObject(TCB->inp, (DWORD) milliseconds); - GetSystemTimeAsFileTime(&fend); - diff = (int) tdiff(fstart, fend); - milliseconds = Adjust(milliseconds, diff); -@@ -999,8 +1399,7 @@ - } - continue; - default: -- SetConsoleActiveScreenBuffer(!PropOf(TCB)->progMode ? -- TCB->hdl : TCB->out); -+ selectActiveHandle(TCB); - continue; - } - } -@@ -1046,23 +1445,26 @@ - * FIXME: implement continuous event-tracking. - */ - if (sp->_drv_mouse_new_buttons != sp->_drv_mouse_old_buttons) { -+ Properties *p = PropOf(TCB); - - memset(&work, 0, sizeof(work)); - - if (sp->_drv_mouse_new_buttons) { - -- work.bstate |= decode_mouse(TCB, sp->_drv_mouse_new_buttons); -+ work.bstate |= (mmask_t) decode_mouse(TCB, sp->_drv_mouse_new_buttons); - - } else { - - /* cf: BUTTON_PRESSED, BUTTON_RELEASED */ -- work.bstate |= (decode_mouse(TCB, sp->_drv_mouse_old_buttons) >> 1); -+ work.bstate |= (mmask_t) (decode_mouse(TCB, -+ sp->_drv_mouse_old_buttons) -+ >> 1); - - result = TRUE; - } - - work.x = mer.dwMousePosition.X; -- work.y = mer.dwMousePosition.Y; -+ work.y = mer.dwMousePosition.Y - AdjustY(p); - - sp->_drv_mouse_fifo[sp->_drv_mouse_tail] = work; - sp->_drv_mouse_tail += 1; -@@ -1080,7 +1482,6 @@ - BOOL b; - DWORD nRead; - WORD vk; -- WORD sc; - - AssertTCB(); - assert(buf); -@@ -1096,7 +1497,6 @@ - continue; - *buf = (int) inp_rec.Event.KeyEvent.uChar.AsciiChar; - vk = inp_rec.Event.KeyEvent.wVirtualKeyCode; -- sc = inp_rec.Event.KeyEvent.wVirtualScanCode; - if (*buf == 0) { - if (sp->_keypad_on) { - *buf = MapKey(TCB, vk); -@@ -1124,8 +1524,9 @@ - static int - drv_nap(TERMINAL_CONTROL_BLOCK * TCB GCC_UNUSED, int ms) - { -- Sleep(ms); -- return OK; -+ T((T_CALLED("win32con::drv_nap(%p, %d)"), TCB, ms)); -+ Sleep((DWORD) ms); -+ returnCode(OK); - } - - static bool -@@ -1142,6 +1543,7 @@ - - AssertTCB(); - -+ T((T_CALLED("win32con::drv_kyExist(%p, %d)"), TCB, keycode)); - res = bsearch(&key, - PropOf(TCB)->rmap, - (size_t) (N_INI + FKEYS), -@@ -1153,11 +1555,11 @@ - if (!(nKey & 0x8000)) - found = TRUE; - } -- return found; -+ returnCode(found); - } - - static int --drv_kpad(TERMINAL_CONTROL_BLOCK * TCB, bool flag GCC_UNUSED) -+drv_kpad(TERMINAL_CONTROL_BLOCK * TCB, int flag GCC_UNUSED) - { - SCREEN *sp; - int code = ERR; -@@ -1165,14 +1567,15 @@ - AssertTCB(); - sp = TCB->csp; - -+ T((T_CALLED("win32con::drv_kpad(%p, %d)"), TCB, flag)); - if (sp) { - code = OK; - } -- return code; -+ returnCode(code); - } - - static int --drv_keyok(TERMINAL_CONTROL_BLOCK * TCB, int keycode, bool flag) -+drv_keyok(TERMINAL_CONTROL_BLOCK * TCB, int keycode, int flag) - { - int code = ERR; - SCREEN *sp; -@@ -1184,6 +1587,7 @@ - AssertTCB(); - SetSP(); - -+ T((T_CALLED("win32con::drv_keyok(%p, %d, %d)"), TCB, keycode, flag)); - if (sp) { - res = bsearch(&key, - PropOf(TCB)->rmap, -@@ -1199,7 +1603,7 @@ - *(LONG *) res = GenMap(vKey, nKey); - } - } -- return code; -+ returnCode(code); - } - - NCURSES_EXPORT_VAR (TERM_DRIVER) _nc_WIN_DRIVER = { -diff -Naur ncurses-5.9/NEWS ncurses-5.9.patch/NEWS ---- ncurses-5.9/NEWS 2011-04-04 02:02:42.000000000 +0200 -+++ ncurses-5.9.patch/NEWS 2014-09-01 16:34:19.474887043 +0200 -@@ -1,5 +1,5 @@ - ------------------------------------------------------------------------------- ---- Copyright (c) 1998-2010,2011 Free Software Foundation, Inc. -- -+-- Copyright (c) 1998-2013,2014 Free Software Foundation, Inc. -- - -- -- - -- Permission is hereby granted, free of charge, to any person obtaining a -- - -- copy of this software and associated documentation files (the -- -@@ -25,7 +25,7 @@ - -- sale, use or other dealings in this Software without prior written -- - -- authorization. -- - ------------------------------------------------------------------------------- ---- $Id: NEWS,v 1.1682 2011/04/04 00:02:42 tom Exp $ -+-- $Id: NEWS,v 1.2185 2014/03/23 21:01:15 tom Exp $ - ------------------------------------------------------------------------------- - - This is a log of changes that ncurses has gone through since Zeyd started -@@ -45,6 +45,1389 @@ - Changes through 1.9.9e did not credit all contributions; - it is not possible to add this information. - -+20140323 -+ + fix typo in "mlterm" entry (report by Gabriele Balducci) -TD -+ -+20140322 -+ + use types from <stdint.h> in sample build-scripts for chtype, etc. -+ + modify configure script and curses.h.in to allow the types specified -+ using --with-chtype and related options to be defined in <stdint.h> -+ + add terminology entry -TD -+ + add mlterm3 entry, use that as "mlterm" -TD -+ + inherit mlterm-256color from mlterm -TD -+ -+20140315 -+ + modify _nc_New_TopRow_and_CurrentItem() to ensure that the menu's -+ top-row is adjusted as needed to ensure that the current item is -+ on the screen (patch by Johann Klammer). -+ + add wgetdelay() to retrieve _delay member of WINDOW if it happens to -+ be opaque, e.g., in the pthread configuration (prompted by patch by -+ Soren Brinkmann). -+ -+20140308 -+ + modify ifdef in read_entry.c to handle the case where -+ NCURSES_USE_DATABASE is not defined (patch by Xin Li). -+ + add cast in form_driver_w() to fix ARM build (patch by Xin Li). -+ + add logic to win_driver.c to save/restore screen contents when not -+ allocating a console-buffer (cf: 20140215). -+ -+20140301 -+ + clarify error-returns from newwin (report by Ruslan Nabioullin). -+ -+20140222 -+ + fix some compiler warnings in win_driver.c -+ + updated notes for wsvt25 based on tack and vttest -TD -+ + add teken entry to show actual properties of FreeBSD's "xterm" -+ console -TD -+ -+20140215 -+ + in-progress changes to win_driver.c to implement output without -+ allocating a console-buffer. This uses a pre-existing environment -+ variable NCGDB used by Juergen Pfeifer for debugging (prompted by -+ discussion with Erwin Waterlander regarding Console2, which hangs -+ when reading in an allocated console-buffer). -+ + add -t option to gdc.c, and modify to accept "S" to step through the -+ scrolling-stages. -+ + regenerate NCURSES-Programming-HOWTO.html to fix some of the broken -+ html emitted by docbook. -+ -+20140209 -+ + modify CF_XOPEN_SOURCE macro to omit followup check to determine if -+ _XOPEN_SOURCE can/should be defined. g++ 4.7.2 built on Solaris 10 -+ has some header breakage due to its own predefinition of this symbol -+ (report by Jean-Pierre Flori, Sage #15796). -+ -+20140201 -+ + add/use symbol NCURSES_PAIRS_T like NCURSES_COLOR_T, to illustrate -+ which "short" types are for color pairs and which are color values. -+ + fix build for s390x, by correcting field bit offsets in generated -+ representation clauses when int=32 long=64 and endian=big, or at -+ least on s390x (patch by Nicolas Boulenguez). -+ + minor cleanup change to test/form_driver_w.c (patch by Gaute Hope). -+ -+20140125 -+ + remove unnecessary ifdef's in Ada95/gen/gen.c, which reportedly do -+ not work as is with gcc 4.8 due to fixes using chtype cast made for -+ new compiler warnings by gcc 4.8 in 20130824 (Debian #735753, patch -+ by Nicolas Boulenguez). -+ -+20140118 -+ + apply includesubdir variable which was introduced in 20130805 to -+ gen-pkgconfig.in (Debian #735782). -+ -+20131221 -+ + further improved man2html, used this to fix broken links in html -+ manpages. See -+ ftp://invisible-island.net/ncurses/patches/man2html -+ -+20131214 -+ + modify configure-script/ifdef's to allow OLD_TTY feature to be -+ suppressed if the type of ospeed is configured using the option -+ --with-ospeed to not be a short. By default, it is a short for -+ termcap-compatibility (adapted from suggestion by Christian -+ Weisgerber). -+ + correct a typo in _nc_baudrate() (patch by Christian Weisgerber, -+ cf: 20061230). -+ + fix a few -Wlogical-op warnings. -+ + updated llib-l* files. -+ -+20131207 -+ + add form_driver_w() entrypoint to wide-character forms library, as -+ well as test program form_driver_w (adapted from patch by Gaute -+ Hope). -+ -+20131123 -+ + minor fix for CF_GCC_WARNINGS to special-case options which are not -+ recognized by clang. -+ -+20131116 -+ + add special case to configure script to move _XOPEN_SOURCE_EXTENDED -+ definition from CPPFLAGS to CFLAGS if it happens to be needed for -+ Solaris, because g++ errors with that definition (report by -+ Jean-Pierre Flori, Sage #15268). -+ + correct logic in infocmp's -i option which was intended to ignore -+ strings which correspond to function-keys as candidates for piecing -+ together initialization- or reset-strings. The problem dates to -+ 1.9.7a, but was overlooked until changes in -Wlogical-op warnings for -+ gcc 4.8 (report by David Binderman). -+ + updated CF_GCC_WARNINGS to documented options for gcc 4.9.0, adding -+ checks for -Wextra, -Wignored-qualifiers and -Wlogical-op -+ + updated CF_GCC_WARNINGS to documented options for gcc 4.9.0, moving -+ checks for -Wextra and -Wdeclaration-after-statement into the macro, -+ and adding checks for -Wignored-qualifiers, -Wlogical-op and -+ -Wvarargs -+ + updated CF_CURSES_UNCTRL_H and CF_SHARED_OPTS macros from ongoing -+ work on cdk. -+ + update config.sub from -+ http://git.savannah.gnu.org/cgit/config.git -+ -+20131110 -+ + minor cleanup of terminfo.tail -+ -+20131102 -+ + use TS extension to describe xterm's title-escapes -TD -+ + modify terminator and nsterm-s to use xterm+sl-twm building block -TD -+ + update hurd.ti, add xenl to reflect 2011-03-06 change in -+ http://git.savannah.gnu.org/cgit/hurd/hurd.git/log/console/display.c -+ (Debian #727119). -+ + simplify pfkey expression in ansi.sys -TD -+ -+20131027 -+ + correct/simplify ifdef's for cur_term versus broken-linker and -+ reentrant options (report by Jean-Pierre Flori, cf: 20090530). -+ + modify release/version combinations in test build-scripts to make -+ them more consistent with other packages. -+ -+20131019 -+ + add nc_mingw.h to installed headers for MinGW port; needed for -+ compiling ncurses-examples. -+ + add rpm-script for testing cross-compile of ncurses-examples. -+ -+20131014 -+ + fix new typo in CF_ADA_INCLUDE_DIRS macro (report by Roumen Petrov). -+ -+20131012 -+ + fix a few compiler warnings in progs and test. -+ + minor fix to package/debian-mingw/rules, do not strip dll's. -+ + minor fixes to configure script for empty $prefix, e.g., when doing -+ cross-compiles to MinGW. -+ + add script for building test-packages of binaries cross-compiled to -+ MinGW using NSIS. -+ -+20131005 -+ + minor fixes for ncurses-example package and makefile. -+ + add scripts for test-builds of cross-compiler packages for ncurses6 -+ to MinGW. -+ -+20130928 -+ + some build-fixes for ncurses-examples with NetBSD-6.0 curses, though -+ it lacks some common functions such as use_env() which is not yet -+ addressed. -+ + build-fix and some compiler warning fixes for ncurses-examples with -+ OpenBSD 5.3 -+ + fix a possible null-pointer reference in a trace message from newterm. -+ + quiet a few warnings from NetBSD 6.0 namespace pollution by -+ nonstandard popcount() function in standard strings.h header. -+ + ignore g++ 4.2.1 warnings for "-Weffc++" in c++/cursesmain.cc -+ + fix a few overlooked places for --enable-string-hacks option. -+ -+20130921 -+ + fix typo in curs_attr.3x (patch by Sven Joachim, cf: 20130831). -+ + build-fix for --with-shared option for DragonFly and FreeBSD (report -+ by Rong-En Fan, cf: 20130727). -+ -+20130907 -+ + build-fixes for MSYS for two test-programs (patches by Ray Donnelly, -+ Alexey Pavlov). -+ + revert change to two of the dpkg format files, to work with dpkg -+ before/after Debian #700177. -+ + fix gcc -Wconversion warning in wattr_get() macro. -+ + add msys and msysdll to known host/configuration types (patch by -+ Alexey Pavlov). -+ + modify CF_RPATH_HACK configure macro to not rely upon "-u" option -+ of sort, improving portability. -+ + minor improvements for test-programs from reviewing Solaris port. -+ + update config.guess, config.sub from -+ http://git.savannah.gnu.org/cgit/config.git -+ -+20130831 -+ + modify test/ncurses.c b/B tests to display lines only for the -+ attributes which a given terminal supports, to make room for an -+ italics test. -+ + completed ncv table in terminfo.tail; it did not list the wide -+ character codes listed in X/Open Curses issue 7. -+ + add A_ITALIC extension (prompted by discussion with Egmont Koblinger). -+ -+20130824 -+ + fix some gcc 4.8 -Wconversion warnings. -+ + change format of dpkg test-scripts to quilted to work around bug -+ introduced by Debian #700177. -+ + discard cached keyname() values if meta() is changed after a value -+ was cached using (report by Kurban Mallachiev). -+ -+20130816 -+ + add checks in tic to warn about terminals which lack cursor -+ addressing, capabilities or having those, are marked as hard_copy or -+ generic_type. -+ + use --without-progs in mingw-ncurses rpm. -+ + split out _nc_init_termtype() from alloc_entry.c to use in MinGW -+ port when tic and other programs are not needed. -+ -+20130805 -+ + minor fixes to the --disable-overwrite logic, to ensure that the -+ configured $(includedir) is not cancelled by the mingwxx-filesystem -+ rpm macros. -+ + add --disable-db-install configure option, to simplify building -+ cross-compile support packages. -+ + add mingw-ncurses.spec file, for testing cross-compiles. -+ -+20130727 -+ + improve configure macros from ongoing work on cdk, dialog, xterm: -+ + CF_ADD_LIB_AFTER - fix a problem with -Wl options -+ + CF_RPATH_HACK - add missing result-message -+ + CF_SHARED_OPTS - modify to use $rel_builddir in cygwin and mingw -+ dll symbols (which can be overridden) rather than explicit "../". -+ + CF_SHARED_OPTS - modify NetBSD and DragonFly symbols to use ${CC} -+ rather than ${LD} to improve rpath support. -+ + CF_SHARED_OPTS - add a symbol to denote the temporary files that -+ are created by the macro, to simplify clean-rules. -+ + CF_X_ATHENA - trim extra libraries to work with -Wl,--as-needed -+ + fix a regression in hashed-database support for NetBSD, which uses -+ the key-size differently from other implementations (cf: 20121229). -+ -+20130720 -+ + further improvements for setupterm manpage, clarifying the -+ initialization of cur_term. -+ -+20130713 -+ + improve manpages for initscr and setupterm. -+ + minor compiler-warning fixes -+ -+20130706 -+ + add fallback defs for <inttypes.h> and <stdint.h> (cf: 20120225). -+ + add check for size of wchar_t, use that to suppress a chunk of -+ wcwidth.h in MinGW port. -+ + quiet linker warnings for MinGW cross-compile with dll's using the -+ --enable-auto-import flag. -+ + add ncurses.map rule to ncurses/Makefile to help diagnose symbol -+ table issues. -+ -+20130622 -+ + modify the clear program to take into account the E3 extended -+ capability to clear the terminal's scrollback buffer (patch by -+ Miroslav Lichvar, Redhat #815790). -+ + clarify in resizeterm manpage that LINES and COLS are updated. -+ + updated ansi example in terminfo.tail, correct misordered example -+ of sgr. -+ + fix other doclifter warnings for manpages -+ + remove unnecessary ".ta" in terminfo.tail, add missing ".fi" -+ (patch by Eric Raymond). -+ -+20130615 -+ + minor changes to some configure macros to make them more reusable. -+ + fixes for tabs program (prompted by report by Nick Andrik): -+ + corrected logic in command-line parsing of -a and -c predefined -+ tab-lists options. -+ + allow "-0" and "-8" options to be combined with others, e.g.,"-0d". -+ + make warning messages more consistent with the other utilities by -+ not printing the full pathname of the program. -+ + add -V option for consistency with other utilities. -+ + fix off-by-one in columns for tabs program when processing an option -+ such as "-5" (patch by Nick Andrik). -+ -+20130608 -+ + add to test/demo_forms.c examples of using the menu-hooks as well -+ as showing how the menu item user-data can be used to pass a callback -+ function pointer. -+ + add test/dots_termcap.c -+ + remove setupterm call from test/demo_termcap.c -+ + build-fix if --disable-ext-funcs configure option is used. -+ + modified test/edit_field.c and test/demo_forms.c to move the lengths -+ into a user-data structure, keeping the original string for later -+ expansion to free-format input/out demo. -+ + modified test/demo_forms.c to load data from file. -+ + added note to clarify Terminal.app's non-emulation of the various -+ terminal types listed in the preferences dialog -TD -+ + fix regression in error-reporting in lib_setup.c (Debian #711134, -+ cf: 20121117). -+ + build-fix for a case where --enable-broken_linker and -+ --enable-reentrant options are combined (report by George R Goffe). -+ -+20130525 -+ + modify mvcur() to distinguish between internal use by the ncurses -+ library, and external callers, preventing it from reading the content -+ of the screen which is only nonblank when curses calls have updated -+ it. This makes test/dots_mvcur.c avoid painting colored cells in -+ the left margin of the display. -+ + minor fix to test/dots_mvcur.c -+ + move configured symbols USE_DATABASE and USE_TERMCAP to term.h as -+ NCURSES_USE_DATABASE and NCURSES_USE_TERMCAP to allow consistent -+ use of these symbols in term_entry.h -+ -+20130518 -+ + corrected ifdefs in test/testcurs.c to allow comparison of mouse -+ interface versus pdcurses (cf: 20130316). -+ + add pow() to configure-check for math library, needed since -+ 20121208 for test/hanoi (Debian #708056). -+ + regenerated html manpages. -+ + update doctype used for html documentation. -+ -+20130511 -+ + move nsterm-related entries out of "obsolete" section to more -+ plausible "ansi consoles" -TD -+ + additional cleanup of table-of-contents by reordering -TD -+ + revise fix for check for 8-bit value in _nc_insert_ch(); prior fix -+ prevented inserts when video attributes were attached to the data -+ (cf: 20121215) (Redhat #959534). -+ -+20130504 -+ + fixes for issues found by Coverity: -+ + correct FNKEY() macro in progs/dump_entry.c, allowing kf11-kf63 to -+ display when infocmp's -R option is used for HP or AIX subsets. -+ + fix dead-code issue with test/movewindow.c -+ + improve limited-checking in _nc_read_termtype(). -+ -+20130427 -+ + fix clang 3.2 warning in progs/dump_entry.c -+ + drop AC_TYPE_SIGNAL check; ncurses relies on c89 and later. -+ -+20130413 -+ + add MinGW to cases where ncurses installs by default into /usr -+ (prompted by discussion with Daniel Silva Ferreira). -+ + add -D option to infocmp's usage-message (patch by Miroslav Lichvar). -+ + add a missing 'int' type for main function in configure check for -+ type of bool variable, to work with clang 3.2 (report by Dmitri -+ Gribenko). -+ + improve configure check for static_cast, to work with clang 3.2 -+ (report by Dmitri Gribenko). -+ + re-order rule for demo.o and macros defining header dependencies in -+ c++/Makefile.in to accommodate gmake (report by Dmitri Gribenko). -+ -+20130406 -+ + improve parameter checking in copywin(). -+ + modify configure script to work around OS X's "libtool" program, to -+ choose glibtool instead. At the same time, chance the autoconf macro -+ to look for a "tool" rather than a "prog", to help with potential use -+ in cross-compiling. -+ + separate the rpath usage for c++ library from demo program -+ (Redhat #911540) -+ + update/correct header-dependencies in c++ makefile (report by Werner -+ Fink). -+ + add --with-cxx-shared to dpkg-script, as done for rpm-script. -+ -+20130324 -+ + build-fix for libtool configuration (reports by Daniel Silva Ferreira -+ and Roumen Petrov). -+ -+20130323 -+ + build-fix for OS X, to handle changes for --with-cxx-shared feature -+ (report by Christian Ebert). -+ + change initialization for vt220, similar entries for consistency -+ with cursor-key strings (NetBSD #47674) -TD -+ + further improvements to linux-16color (Benjamin Sittler) -+ -+20130316 -+ + additional fix for tic.c, to allocate missing buffer space. -+ + eliminate configure-script warnings for gen-pkgconfig.in -+ + correct typo in sgr string for sun-color, -+ add bold for consistency with sgr, -+ change smso for consistency with sgr -TD -+ + correct typo in sgr string for terminator -TD -+ + add blink to the attributes masked by ncv in linux-16color (report -+ by Benjamin Sittler) -+ + improve warning message from post-load checking for missing "%?" -+ operator by tic/infocmp by showing the entry name and capability. -+ + minor formatting improvement to tic/infocmp -f option to ensure -+ line split after "%;". -+ + amend scripting for --with-cxx-shared option to handle the debug -+ library "libncurses++_g.a" (report by Sven Joachim). -+ -+20130309 -+ + amend change to toe.c for reading from /dev/zero, to ensure that -+ there is a buffer for the temporary filename (cf: 20120324). -+ + regenerated html manpages. -+ + fix typo in terminfo.head (report by Sven Joachim, cf: 20130302). -+ + updated some autoconf macros: -+ + CF_ACVERSION_CHECK, from byacc 1.9 20130304 -+ + CF_INTEL_COMPILER, CF_XOPEN_SOURCE from luit 2.0-20130217 -+ + add configure option --with-cxx-shared to permit building -+ libncurses++ as a shared library when using g++, e.g., the same -+ limitations as libtool but better integrated with the usual build -+ configuration (Redhat #911540). -+ + modify MKkey_defs.sh to filter out build-path which was unnecessarily -+ shown in curses.h (Debian #689131). -+ -+20130302 -+ + add section to terminfo manpage discussing user-defined capabilities. -+ + update manpage description of NCURSES_NO_SETBUF, explaining why it -+ is obsolete. -+ + add a check in waddch_nosync() to ensure that tab characters are -+ treated as control characters; some broken locales claim they are -+ printable. -+ + add some traces to the Windows console driver. -+ + initialize a temporary array in _nc_mbtowc, needed for some cases -+ of raw input in MinGW port. -+ -+20130218 -+ + correct ifdef on change to lib_twait.c (report by Werner Fink). -+ + update config.guess, config.sub -+ -+20130216 -+ + modify test/testcurs.c to work with mouse for ncurses as it does for -+ pdcurses. -+ + modify test/knight.c to work with mouse for pdcurses as it does for -+ ncurses. -+ + modify internal recursion in wgetch() which handles cooked mode to -+ check if the call to wgetnstr() returned an error. This can happen -+ when both nocbreak() and nodelay() are set, for instance (report by -+ Nils Christopher Brause) (cf: 960418). -+ + fixes for issues found by Coverity: -+ + add a check for valid position in ClearToEOS() -+ + fix in lib_twait.c when --enable-wgetch-events is used, pointer -+ use after free. -+ + improve a limit-check in make_hash.c -+ + fix a memory leak in hashed_db.c -+ -+20130209 -+ + modify test/configure script to make it simpler to override names -+ of curses-related libraries, to help with linking with pdcurses in -+ MinGW environment. -+ + if the --with-terminfo-dirs configure option is not used, there is -+ no corresponding compiled-in value for that. Fill in "no default -+ value" for that part of the manpage substitution. -+ -+20130202 -+ + correct initialization in knight.c which let it occasionally make -+ an incorrect move (cf: 20001028). -+ + improve documentation of the terminfo/termcap search path. -+ -+20130126 -+ + further fixes to mvcur to pass callback function (cf: 20130112), -+ needed to make test/dots_mvcur work. -+ + reduce calls to SetConsoleActiveScreenBuffer in win_driver.c, to -+ help reduce flicker. -+ + modify configure script to omit "+b" from linker options for very -+ old HP-UX systems (report by Dennis Grevenstein) -+ + add HP-UX workaround for missing EILSEQ on old HP-UX systems (patch -+ by Dennis Grevenstein). -+ + restore memmove/strdup support for antique systems (request by -+ Dennis Grevenstein). -+ + change %l behavior in tparm to push the string length onto the stack -+ rather than saving the formatted length into the output buffer -+ (report by Roy Marples, cf: 980620). -+ -+20130119 -+ + fixes for issues found by Coverity: -+ + fix memory leak in safe_sprintf.c -+ + add check for return-value in tty_update.c -+ + correct initialization for -s option in test/view.c -+ + add check for numeric overflow in lib_instr.c -+ + improve error-checking in copywin -+ + add advice in infocmp manpage for termcap users (Debian #698469). -+ + add "-y" option to test/demo_termcap and test/demo_terminfo to -+ demonstrate behavior with/without extended capabilities. -+ + updated termcap manpage to document legacy termcap behavior for -+ matching capability names. -+ + modify name-comparison for tgetstr, etc., to accommodate legacy -+ applications as well as to improve compatbility with BSD 4.2 -+ termcap implementations (Debian #698299) (cf: 980725). -+ -+20130112 -+ + correct prototype in manpage for vid_puts. -+ + drop ncurses/tty/tty_display.h, ncurses/tty/tty_input.h, since they -+ are unused in the current driver model. -+ + modify mvcur to use stdout except when called within the ncurses -+ library. -+ + modify vidattr and vid_attr to use stdout as documented in manpage. -+ + amend changes made to buffering in 20120825 so that the low-level -+ putp() call uses stdout rather than ncurses' internal buffering. -+ The putp_sp() call does the same, for consistency (Redhat #892674). -+ -+20130105 -+ + add "-s" option to test/view.c to allow it to start in single-step -+ mode, reducing size of trace files when it is used for debugging -+ MinGW changes. -+ + revert part of 20121222 change to tinfo_driver.c -+ + add experimental logic in win_driver.c to improve optimization of -+ screen updates. This does not yet work with double-width characters, -+ so it is ifdef'd out for the moment (prompted by report by Erwin -+ Waterlander regarding screen flicker). -+ -+20121229 -+ + fix coverity warnings regarding copying into fixed-size buffers. -+ + add throw-declarations in the c++ binding per Coverity warning. -+ + minor changes to new-items for consistent reference to bug-report -+ numbers. -+ -+20121222 -+ + add *.dSYM directories to clean-rule in ncurses directory makefile, -+ for Mac OS builds. -+ + add a configure check for gcc option -no-cpp-precomp, which is not -+ available in all Mac OS X configurations (report by Andras Salamon, -+ cf: 20011208). -+ + improve 20021221 workaround for broken acs, handling a case where -+ that ACS_xxx character is not in the acsc string but there is a known -+ wide-character which can be used. -+ -+20121215 -+ + fix several warnings from clang 3.1 --analyze, includes correcting -+ a null-pointer check in _nc_mvcur_resume. -+ + correct display of double-width characters with MinGW port (report -+ by Erwin Waterlander). -+ + replace MinGW's wcrtomb(), fixing a problem with _nc_viscbuf -+ > fixes based on Coverity report: -+ + correct coloring in test/bs.c -+ + correct check for 8-bit value in _nc_insert_ch(). -+ + remove dead code in progs/tset.c, test/linedata.h -+ + add null-pointer checks in lib_tracemse.c, panel.priv.h, and some -+ test-programs. -+ -+20121208 -+ + modify test/knight.c to show the number of choices possible for -+ each position in automove option, e.g., to allow user to follow -+ Warnsdorff's rule to solve the puzzle. -+ + modify test/hanoi.c to show the minimum number of moves possible for -+ the given number of tiles (prompted by patch by Lucas Gioia). -+ > fixes based on Coverity report: -+ + remove a few redundant checks. -+ + correct logic in test/bs.c, when randomly placing a specific type of -+ ship. -+ + check return value from remove/unlink in tic. -+ + check return value from sscanf in test/ncurses.c -+ + fix a null dereference in c++/cursesw.cc -+ + fix two instances of uninitialized variables when configuring for the -+ terminal driver. -+ + correct scope of variable used in SetSafeOutcWrapper macro. -+ + set umask when calling mkstemp in tic. -+ + initialize wbkgrndset() temporary variable when extended-colors are -+ used. -+ -+20121201 -+ + also replace MinGW's wctomb(), fixing a problem with setcchar(). -+ + modify test/view.c to load UTF-8 when built with MinGW by using -+ regular win32 API because the MinGW functions mblen() and mbtowc() -+ do not work. -+ -+20121124 -+ + correct order of color initialization versus display in some of the -+ test-programs, e.g., test_addstr.c -+ > fixes based on Coverity report: -+ + delete windows on exit from some of the test-programs. -+ -+20121117 -+ > fixes based on Coverity report: -+ + add missing braces around FreeAndNull in two places. -+ + various fixes in test/ncurses.c -+ + improve limit-checks in tinfo/make_hash.c, tinfo/read_entry.c -+ + correct malloc size in progs/infocmp.c -+ + guard against negative array indices in test/knight.c -+ + fix off-by-one limit check in test/color_name.h -+ + add null-pointer check in progs/tabs.c, test/bs.c, test/demo_forms.c, -+ test/inchs.c -+ + fix memory-leak in tinfo/lib_setup.c, progs/toe.c, -+ test/clip_printw.c, test/demo_menus.c -+ + delete unused windows in test/chgat.c, test/clip_printw.c, -+ test/insdelln.c, test/newdemo.c on error-return. -+ -+20121110 -+ + modify configure macro CF_INCLUDE_DIRS to put $CPPFLAGS after the -+ local -I include options in case someone has set conflicting -I -+ options in $CPPFLAGS (prompted by patch for ncurses/Makefile.in by -+ Vassili Courzakis). -+ + modify the ncurses*-config scripts to eliminate relative paths from -+ the RPATH_LIST variable, e.g., "../lib" as used in installing shared -+ libraries or executables. -+ -+20121102 -+ + realign these related pages: -+ curs_add_wchstr.3x -+ curs_addchstr.3x -+ curs_addstr.3x -+ curs_addwstr.3x -+ and fix a long-ago error in curs_addstr.3x which said that a -1 -+ length parameter would only write as much as fit onto one line -+ (report by Reuben Thomas). -+ + remove obsolete fallback _nc_memmove() for memmove()/bcopy(). -+ + remove obsolete fallback _nc_strdup() for strdup(). -+ + cancel any debug-rpm in package/ncurses.spec -+ + reviewed vte-2012, reverted most of the change since it was incorrect -+ based on testing with tack -TD -+ + un-cancel the initc in vte-256color, since this was implemented -+ starting with version 0.20 in 2009 -TD -+ -+20121026 -+ + improve malloc/realloc checking (prompted by discussion in Redhat -+ #866989). -+ + add ncurses test-program as "ncurses6" to the rpm- and dpkg-scripts. -+ + updated configure macros CF_GCC_VERSION and CF_WITH_PATHLIST. The -+ first corrects pattern used for Mac OS X's customization of gcc. -+ -+20121017 -+ + fix change to _nc_scroll_optimize(), which incorrectly freed memory -+ (Redhat #866989). -+ -+20121013 -+ + add vte-2012, gnome-2012, making these the defaults for vte/gnome -+ (patch by Christian Persch). -+ -+20121006 -+ + improve CF_GCC_VERSION to work around Debian's customization of gcc -+ --version message. -+ + improve configure macros as done in byacc: -+ + drop 2.13 compatibility; use 2.52.xxxx version only since EMX port -+ has used that for a while. -+ + add 3rd parameter to AC_DEFINE's to allow autoheader to run, i.e., -+ for experimental use. -+ + remove unused configure macros. -+ + modify configure script and makefiles to quiet new autoconf warning -+ for LIBS_TO_MAKE variable. -+ + modify configure script to show $PATH_SEPARATOR variable. -+ + update config.guess, config.sub -+ -+20120922 -+ + modify setupterm to set its copy of TERM to "unknown" if configured -+ for the terminal driver and TERM was null or empty. -+ + modify treatment of TERM variable for MinGW port to allow explicit -+ use of the windows console driver by checking if $TERM is set to -+ "#win32con" or an abbreviation of that. -+ + undo recent change to fallback definition of vsscanf() to build with -+ older Solaris compilers (cf: 20120728). -+ -+20120908 -+ + add test-screens to test/ncurses to show 256-characters at a time, -+ to help with MinGW port. -+ -+20120903 -+ + simplify varargs logic in lib_printw.c; va_copy is no longer needed -+ there. -+ + modifications for MinGW port to make wide-character display usable. -+ -+20120902 -+ + regenerate configure script (report by Sven Joachim, cf: 20120901). -+ -+20120901 -+ + add a null-pointer check in _nc_flush (cf: 20120825). -+ + fix a case in _nc_scroll_optimize() where the _oldnums_list array -+ might not be allocated. -+ + improve comparisons in configure.in for unset shell variables. -+ -+20120826 -+ + increase size of ncurses' output-buffer, in case of very small -+ initial screen-sizes. -+ + fix evaluation of TERMINFO and TERMINFO_DIRS default values as needed -+ after changes to use --datarootdir (reports by Gabriele Balducci, -+ Roumen Petrov). -+ -+20120825 -+ + change output buffering scheme, using buffer maintained by ncurses -+ rather than stdio, to avoid problems with SIGTSTP handling (report -+ by Brian Bloniarz). -+ -+20120811 -+ + update autoconf patch to 2.52.20120811, adding --datarootdir -+ (prompted by discussion with Erwin Waterlander). -+ + improve description of --enable-reentrant option in README and the -+ INSTALL file. -+ + add nsterm-256color, make this the default nsterm -TD -+ + remove bw from nsterm-bce, per testing with tack -TD -+ -+20120804 -+ + update test/configure, adding check for tinfo library. -+ + improve limit-checks for the getch fifo (report by Werner Fink). -+ + fix a remaining mismatch between $with_echo and the symbols updated -+ for CF_DISABLE_ECHO affecting parameters for mk-2nd.awk (report by -+ Sven Joachim, cf: 20120317). -+ + modify followup check for pkg-config's library directory in the -+ --enable-pc-files option to validate syntax (report by Sven Joachim, -+ cf: 20110716). -+ -+20120728 -+ + correct path for ncurses_mingw.h in include/headers, in case build -+ is done outside source-tree (patch by Roumen Petrov). -+ + modify some older xterm entries to align with xterm source -TD -+ + separate "xterm-old" alias from "xterm-r6" -TD -+ + add E3 extended capability to xterm-basic and putty -TD -+ + parenthesize parameters of other macros in curses.h -TD -+ + parenthesize parameter of COLOR_PAIR and PAIR_NUMBER in curses.h -+ in case it happens to be a comma-expression, etc. (patch by Nick -+ Black). -+ -+20120721 -+ + improved form_request_by_name() and menu_request_by_name(). -+ + eliminate two fixed-size buffers in toe.c -+ + extend use_tioctl() to have expected behavior when use_env(FALSE) and -+ use_tioctl(TRUE) are called. -+ + modify ncurses test-program, adding -E and -T options to demonstrate -+ use_env() versus use_tioctl(). -+ -+20120714 -+ + add use_tioctl() function (adapted from patch by Werner Fink, -+ Novell #769788): -+ -+20120707 -+ + add ncurses_mingw.h to installed headers (prompted by patch by -+ Juergen Pfeifer). -+ + clarify return-codes from wgetch() in response to SIGWINCH (prompted -+ by Novell #769788). -+ + modify resizeterm() to always push a KEY_RESIZE onto the fifo, even -+ if screensize is unchanged. Modify _nc_update_screensize() to push a -+ KEY_RESIZE if there was a SIGWINCH, even if it does not call -+ resizeterm(). These changes eliminate the case where a SIGWINCH is -+ received, but ERR returned from wgetch or wgetnstr because the screen -+ dimensions did not change (Novell #769788). -+ -+20120630 -+ + add --enable-interop to sample package scripts (suggested by Juergen -+ Pfeifer). -+ + update CF_PATH_SYNTAX macro, from mawk changes. -+ + modify mk-0th.awk to allow for generating llib-ltic, etc., though -+ some work is needed on cproto to work with lib_gen.c to update -+ llib-lncurses. -+ + remove redundant getenv() cal in database-iterator leftover from -+ cleanup in 20120622 changes (report by Sven Joachim). -+ -+20120622 -+ + add -d, -e and -q options to test/demo_terminfo and test/demo_termcap -+ + fix caching of environment variables in database-iterator (patch by -+ Philippe Troin, Redhat #831366). -+ -+20120616 -+ + add configure check to distinguish clang from gcc to eliminate -+ warnings about unused command-line parameters when compiler warnings -+ are enabled. -+ + improve behavior when updating terminfo entries which are hardlinked -+ by allowing for the possibility that an alias has been repurposed to -+ a new primary name. -+ + fix some strict compiler warnings based on package scripts. -+ + further fixes for configure check for working poll (Debian #676461). -+ -+20120608 -+ + fix an uninitialized variable in -c/-n logic for infocmp changes -+ (cf: 20120526). -+ + corrected fix for building c++ binding with clang 3.0 (report/patch -+ by Richard Yao, Gentoo #417613, cf: 20110409) -+ + correct configure check for working poll, fixing the case where stdin -+ is redirected, e.g., in rpm/dpkg builds (Debian #676461). -+ + add rpm- and dpkg-scripts, to test those build-environments. -+ The resulting packages are used only for testing. -+ -+20120602 -+ + add kdch1 aka "Remove" to vt220 and vt220-8 entries -TD -+ + add kdch1, etc., to qvt108 -TD -+ + add dl1/il1 to some entries based on dl/il values -TD -+ + add dl to simpleterm -TD -+ + add consistency-checks in tic for insert-line vs delete-line -+ controls, and insert/delete-char keys -+ + correct no-leaks logic in infocmp when doing comparisons, fixing -+ duplicate free of entries given via the command-line, and freeing -+ entries loaded from the last-but-one of files specified on the -+ command-line. -+ + add kdch1 to wsvt25 entry from NetBSD CVS (reported by David Lord, -+ analysis by Martin Husemann). -+ + add cnorm/civis to wsvt25 entry from NetBSD CVS (report/analysis by -+ Onno van der Linden). -+ -+20120526 -+ + extend -c and -n options of infocmp to allow comparing more than two -+ entries. -+ + correct check in infocmp for number of terminal names when more than -+ two are given. -+ + correct typo in curs_threads.3x (report by Yanhui Shen on -+ freebsd-hackers mailing list). -+ -+20120512 -+ + corrected 'op' for bterm (report by Samuel Thibault) -TD -+ + modify test/background.c to demonstrate a background character -+ holding a colored ACS_HLINE. The behavior differs from SVr4 due to -+ the thick- and double-line extension (cf: 20091003). -+ + modify handling of acs characters in PutAttrChar to avoid mapping an -+ unmapped character to a space with A_ALTCHARSET set. -+ + rewrite vt520 entry based on vt420 -TD -+ -+20120505 -+ + remove p6 (bold) from opus3n1+ for consistency -TD -+ + remove acs stuff from env230 per clues in Ingres termcap -TD -+ + modify env230 sgr/sgr0 to match other capabilities -TD -+ + modify smacs/rmacs in bq300-8 to match sgr/sgr0 -TD -+ + make sgr for dku7202 agree with other caps -TD -+ + make sgr for ibmpc agree with other caps -TD -+ + make sgr for tek4107 agree with other caps -TD -+ + make sgr for ndr9500 agree with other caps -TD -+ + make sgr for sco-ansi agree with other caps -TD -+ + make sgr for d410 agree with other caps -TD -+ + make sgr for d210 agree with other caps -TD -+ + make sgr for d470c, d470c-7b agree with other caps -TD -+ + remove redundant AC_DEFINE for NDEBUG versus Makefile definition. -+ + fix a back-link in _nc_delink_entry(), which is needed if ncurses is -+ configured with --enable-termcap and --disable-getcap. -+ -+20120428 -+ + fix some inconsistencies between vt320/vt420, e.g., cnorm/civis -TD -+ + add eslok flag to dec+sl -TD -+ + dec+sl applies to vt320 and up -TD -+ + drop wsl width from xterm+sl -TD -+ + reuse xterm+sl in putty and nsca-m -TD -+ + add ansi+tabs to vt520 -TD -+ + add ansi+enq to vt220-vt520 -TD -+ + fix a compiler warning in example in ncurses-intro.doc (Paul Waring). -+ + added paragraph in keyname manpage telling how extended capabilities -+ are interpreted as key definitions. -+ + modify tic's check of conflicting key definitions to include extended -+ capability strings in addition to the existing check on predefined -+ keys. -+ -+20120421 -+ + improve cleanup of temporary files in tic using atexit(). -+ + add msgr to vt420, similar DEC vtXXX entries -TD -+ + add several missing vt420 capabilities from vt220 -TD -+ + factor out ansi+pp from several entries -TD -+ + change xterm+sl and xterm+sl-twm to include only the status-line -+ capabilities and not "use=xterm", making them more generally useful -+ as building-blocks -TD -+ + add dec+sl building block, as example -TD -+ -+20120414 -+ + add XT to some terminfo entries to improve usefulness for other -+ applications than screen, which would like to pretend that xterm's -+ title is a status-line. -TD -+ + change use-clauses in ansi-mtabs, hp2626, and hp2622 based on review -+ of ordering and overrides -TD -+ + add consistency check in tic for screen's "XT" capability. -+ + add section in terminfo.src summarizing the user-defined capabilities -+ used in that file -TD -+ -+20120407 -+ + fix an inconsistency between tic/infocmp "-x" option; tic omits all -+ non-standard capabilities, while infocmp was ignoring only the user -+ definable capabilities. -+ + improve special case in tic parsing of description to allow it to be -+ followed by terminfo capabilities. Previously the description had to -+ be the last field on an input line to allow tic to distinguish -+ between termcap and terminfo format while still allowing commas to be -+ embedded in the description. -+ + correct variable name in gen_edit.sh which broke configurability of -+ the --with-xterm-kbs option. -+ + revert 2011-07-16 change to "linux" alias, return to "linux2.2" -TD -+ + further amend 20110910 change, providing for configure-script -+ override of the "linux" terminfo entry to install and changing the -+ default for that to "linux2.2" (Debian #665959). -+ -+20120331 -+ + update Ada95/configure to use CF_DISABLE_ECHO (cf: 20120317). -+ + correct order of use-clauses in st-256color -TD -+ + modify configure script to look for gnatgcc if the Ada95 binding -+ is built, in preference to the default gcc/cc (suggested by -+ Nicolas Boulenguez). -+ + modify configure script to ensure that the same -On option used for -+ the C compiler in CFLAGS is used for ADAFLAGS rather than simply -+ using "-O3" (suggested by Nicolas Boulenguez) -+ -+20120324 -+ + amend an old fix so that next_char() exits properly for empty files, -+ e.g., from reading /dev/null (cf: 20080804). -+ + modify tic so that it can read from the standard input, or from -+ a character device. Because tic uses seek's, this requires writing -+ the data to a temporary file first (prompted by remark by Sven -+ Joachim) (cf: 20000923). -+ -+20120317 -+ + correct a check made in lib_napms.c, so that terminfo applications -+ can again use napms() (cf: 20110604). -+ + add a note in tic.h regarding required casts for ABSENT_BOOLEAN -+ (cf: 20040327). -+ + correct scripting for --disable-echo option in test/configure. -+ + amend check for missing c++ compiler to work when no error is -+ reported, and no variables set (cf: 20021206). -+ + add/use configure macro CF_DISABLE_ECHO. -+ -+20120310 -+ + fix some strict compiler warnings for abi6 and 64-bits. -+ + use begin_va_copy/end_va_copy macros in lib_printw.c (cf: 20120303). -+ + improve a limit-check in infocmp.c (Werner Fink): -+ -+20120303 -+ + minor tidying of terminfo.tail, clarify reason for limitation -+ regarding mapping of \0 to \200 -+ + minor improvement to _nc_copy_termtype(), using memcpy to replace -+ loops. -+ + fix no-leaks checking in test/demo_termcap.c to account for multiple -+ calls to setupterm(). -+ + modified the libgpm change to show previous load as a problem in the -+ debug-trace. -+ > merge some patches from OpenSUSE rpm (Werner Fink): -+ + ncurses-5.7-printw.dif, fixes for varargs handling in lib_printw.c -+ + ncurses-5.7-gpm.dif, do not dlopen libgpm if already loaded by -+ runtime linker -+ + ncurses-5.6-fallback.dif, do not free arrays and strings from static -+ fallback entries -+ -+20120228 -+ + fix breakage in tic/infocmp from 20120225 (report by Werner Fink). -+ -+20120225 -+ + modify configure script to allow creating dll's for MinGW when -+ cross-compiling. -+ + add --enable-string-hacks option to control whether strlcat and -+ strlcpy may be used. The same issue applies to OpenBSD's warnings -+ about snprintf, noting that this function is weakly standardized. -+ + add configure checks for strlcat, strlcpy and snprintf, to help -+ reduce bogus warnings with OpenBSD builds. -+ + build-fix for OpenBSD 4.9 to supply consistent intptr_t declaration -+ (cf:20111231) -+ + update config.guess, config.sub -+ -+20120218 -+ + correct CF_ETIP_DEFINES configure macro, making it exit properly on -+ the first success (patch by Pierre Labastie). -+ + improve configure macro CF_MKSTEMP by moving existence-check for -+ mkstemp out of the AC_TRY_RUN, to help with cross-compiles. -+ + improve configure macro CF_FUNC_POLL from luit changes to detect -+ broken implementations, e.g., with Mac OS X. -+ + add configure option --with-tparm-arg -+ + build-fix for MinGW cross-compiling, so that make_hash does not -+ depend on TTY definition (cf: 20111008). -+ -+20120211 -+ + make sgr for xterm-pcolor agree with other caps -TD -+ + make sgr for att5425 agree with other caps -TD -+ + make sgr for att630 agree with other caps -TD -+ + make sgr for linux entries agree with other caps -TD -+ + make sgr for tvi9065 agree with other caps -TD -+ + make sgr for ncr260vt200an agree with other caps -TD -+ + make sgr for ncr160vt100pp agree with other caps -TD -+ + make sgr for ncr260vt300an agree with other caps -TD -+ + make sgr for aaa-60-dec-rv, aaa+dec agree with other caps -TD -+ + make sgr for cygwin, cygwinDBG agree with other caps -TD -+ + add configure option --with-xterm-kbs to simplify configuration for -+ Linux versus most other systems. -+ -+20120204 -+ + improved tic -D option, avoid making target directory and provide -+ better diagnostics. -+ -+20120128 -+ + add mach-gnu (Debian #614316, patch by Samuel Thibault) -+ + add mach-gnu-color, tweaks to mach-gnu terminfo -TD -+ + make sgr for sun-color agree with smso -TD -+ + make sgr for prism9 agree with other caps -TD -+ + make sgr for icl6404 agree with other caps -TD -+ + make sgr for ofcons agree with other caps -TD -+ + make sgr for att5410v1, att4415, att620 agree with other caps -TD -+ + make sgr for aaa-unk, aaa-rv agree with other caps -TD -+ + make sgr for avt-ns agree with other caps -TD -+ + amend fix intended to separate fixups for acsc to allow "tic -cv" to -+ give verbose warnings (cf: 20110730). -+ + modify misc/gen-edit.sh to make the location of the tabset directory -+ consistent with misc/Makefile.in, i.e., using ${datadir}/tabset -+ (Debian #653435, patch by Sven Joachim). -+ -+20120121 -+ + add --with-lib-prefix option to allow configuring for old/new flavors -+ of OS/2 EMX. -+ + modify check for gnat version to allow for year, as used in FreeBSD -+ port. -+ + modify check_existence() in db_iterator.c to simply check if the -+ path is a directory or file, according to the need. Checking for -+ directory size also gives no usable result with OS/2 (cf: 20120107). -+ + support OS/2 kLIBC (patch by KO Myung-Han). -+ -+20120114 -+ + several improvements to test/movewindow.c (prompted by discussion on -+ Linux Mint forum): -+ + modify movement commands to make them continuous -+ + rewrote the test for mvderwin -+ + rewrote the test for recursive mvwin -+ + split-out reusable CF_WITH_NCURSES_ETC macro in test/configure.in -+ + updated configure macro CF_XOPEN_SOURCE, build-fixes for Mac OS X -+ and OpenBSD. -+ + regenerated html manpages. -+ -+20120107 -+ + various improvments for MinGW (Juergen Pfeifer): -+ + modify stat() calls to ignore the st_size member -+ + drop mk-dlls.sh script. -+ + change recommended regular expression library. -+ + modify rain.c to allow for threaded configuraton. -+ + modify tset.c to allow for case when size-change logic is not used. -+ -+20111231 -+ + modify toe's report when -a and -s options are combined, to add -+ a column showing which entries belong to a given database. -+ + add -s option to toe, to sort its output. -+ + modify progs/toe.c, simplifying use of db-iterator results to use -+ caching improvements from 20111001 and 20111126. -+ + correct generation of pc-files when ticlib or termlib options are -+ given to rename the corresponding tic- or tinfo-libraries (report -+ by Sven Joachim). -+ -+20111224 -+ + document a portability issue with tput, i.e., that scripts which work -+ with ncurses may fail in other implementations that do no parameter -+ analysis. -+ + add putty-sco entry -TD -+ -+20111217 -+ + review/fix places in manpages where --program-prefix configure option -+ was not being used. -+ + add -D option to infocmp, to show the database locations that it -+ could use. -+ + fix build for the special case where term-driver, ticlib and termlib -+ are all enabled. The terminal driver depends on a few features in -+ the base ncurses library, so tic's dependencies include both ncurses -+ and termlib. -+ + fix build work for term-driver when --enable-wgetch-events option is -+ enabled. -+ + use <stdint.h> types to fix some questionable casts to void*. -+ -+20111210 -+ + modify configure script to check if thread library provides -+ pthread_mutexattr_settype(), e.g., not provided by Solaris 2.6 -+ + modify configure script to suppress check to define _XOPEN_SOURCE -+ for IRIX64, since its header files have a conflict versus -+ _SGI_SOURCE. -+ + modify configure script to add ".pc" files for tic- and -+ tinfo-libraries, which were omitted in recent change (cf: 20111126). -+ + fix inconsistent checks on $PKG_CONFIG variable in configure script. -+ -+20111203 -+ + modify configure-check for etip.h dependencies, supplying a temporary -+ copy of ncurses_dll.h since it is a generated file (prompted by -+ Debian #646977). -+ + modify CF_CPP_PARAM_INIT "main" function to work with current C++. -+ -+20111126 -+ + correct database iterator's check for duplicate entries -+ (cf: 20111001). -+ + modify database iterator to ignore $TERMCAP when it is not an -+ absolute pathname. -+ + add -D option to tic, to show the database locations that it could -+ use. -+ + improve description of database locations in tic manpage. -+ + modify the configure script to generate a list of the ".pc" files to -+ generate, rather than deriving the list from the libraries which have -+ been built (patch by Mike Frysinger). -+ + use AC_CHECK_TOOLS in preference to AC_PATH_PROGS when searching for -+ ncurses*-config, e.g., in Ada95/configure and test/configure (adapted -+ from patch by Mike Frysinger). -+ -+20111119 -+ + remove obsolete/conflicting fallback definition for _POSIX_SOURCE -+ from curses.priv.h, fixing a regression with IRIX64 and Tru64 -+ (cf: 20110416) -+ + modify _nc_tic_dir() to ensure that its return-value is nonnull, -+ i.e., the database iterator was not initialized. This case is needed -+ to when tic is translating to termcap, rather than loading the -+ database (cf: 20111001). -+ -+20111112 -+ + add pccon entries for OpenBSD console (Alexei Malinin). -+ + build-fix for OpenBSD 4.9 with gcc 4.2.1, setting _XOPEN_SOURCE to -+ 600 to work around inconsistent ifdef'ing of wcstof between C and -+ C++ header files. -+ + modify capconvert script to accept more than exact match on "xterm", -+ e.g., the "xterm-*" variants, to exclude from the conversion (patch -+ by Robert Millan). -+ + add -lc_r as alternative for -lpthread, allows build of threaded code -+ in older FreeBSD machines. -+ + build-fix for MirBSD, which fails when either _XOPEN_SOURCE or -+ _POSIX_SOURCE are defined. -+ + fix a typo misc/Makefile.in, used in uninstalling pc-files. -+ -+20111030 -+ + modify make_db_path() to allow creating "terminfo.db" in the same -+ directory as an existing "terminfo" directory. This fixes a case -+ where switching between hashed/filesystem databases would cause the -+ new hashed database to be installed in the next best location - -+ root's home directory. -+ + add variable cf_cv_prog_gnat_correct to those passed to -+ config.status, fixing a problem with Ada95 builds (cf: 20111022). -+ + change feature test from _XPG5 to _XOPEN_SOURCE in two places, to -+ accommodate broken implementations for _XPG6. -+ + eliminate usage of NULL symbol from etip.h, to reduce header -+ interdependencies. -+ + add configure check to decide when to add _XOPEN_SOURCE define to -+ compiler options, i.e., for Solaris 10 and later (cf: 20100403). -+ This is a workaround for gcc 4.6, which fails to build the c++ -+ binding if that symbol is defined by the application, due to -+ incorrectly combining the corresponding feature test macros -+ (report by Peter Kruse). -+ -+20111022 -+ + correct logic for discarding mouse events, retaining the partial -+ events used to build up click, double-click, etc, until needed -+ (cf: 20110917). -+ + fix configure script to avoid creating unused Ada95 makefile when -+ gnat does not work. -+ + cleanup width-related gcc 3.4.3 warnings for 64-bit platform, for the -+ internal functions of libncurses. The external interface of courses -+ uses bool, which still produces these warnings. -+ -+20111015 -+ + improve description of --disable-tic-depends option to make it -+ clear that it may be useful whether or not the --with-termlib -+ option is also given (report by Sven Joachim). -+ + amend termcap equivalent for set_pglen_inch to use the X/Open -+ "YI" rather than the obsolete Solaris 2.5 "sL" (cf: 990109). -+ + improve manpage for tgetent differences from termcap library. -+ -+20111008 -+ + moved static data from db_iterator.c to lib_data.c -+ + modify db_iterator.c for memory-leak checking, fix one leak. -+ + modify misc/gen-pkgconfig.in to use Requires.private for the parts -+ of ncurses rather than Requires, as well as Libs.private for the -+ other library dependencies (prompted by Debian #644728). -+ -+20111001 -+ + modify tic "-K" option to only set the strict-flag rather than force -+ source-output. That allows the same flag to control the parser for -+ input and output of termcap source. -+ + modify _nc_getent() to ignore backslash at the end of a comment line, -+ making it consistent with ncurses' parser. -+ + restore a special-case check for directory needed to make termcap -+ text files load as if they were databases (cf: 20110924). -+ + modify tic's resolution/collision checking to attempt to remove the -+ conflicting alias from the second entry in the pair, which is -+ normally following in the source file. Also improved the warning -+ message to make it simpler to see which alias is the problem. -+ + improve performance of the database iterator by caching search-list. -+ -+20110925 -+ + add a missing "else" in changes to _nc_read_tic_entry(). -+ -+20110924 -+ + modify _nc_read_tic_entry() so that hashed-database is checked before -+ filesystem. -+ + updated CF_CURSES_LIBS check in test/configure script. -+ + modify configure script and makefiles to split TIC_ARGS and -+ TINFO_ARGS into pieces corresponding to LDFLAGS and LIBS variables, -+ to help separate searches for tic- and tinfo-libraries (patch by Nick -+ Alcock aka "Nix"). -+ + build-fix for lib_mouse.c changes (cf: 20110917). -+ -+20110917 -+ + fix compiler warning for clang 2.9 -+ + improve merging of mouse events (integrated patch by Damien -+ Guibouret). -+ + correct mask-check used in lib_mouse for wheel mouse buttons 4/5 -+ (patch by Damien Guibouret). -+ -+20110910 -+ + modify misc/gen_edit.sh to select a "linux" entry which works with -+ the current kernel rather than assuming it is always "linux3.0" -+ (cf: 20110716). -+ + revert a change to getmouse() which had the undesirable side-effect -+ of suppressing button-release events (report by Damien Guibouret, -+ cf: 20100102). -+ + add xterm+kbs fragment from xterm #272 -TD -+ + add configure option --with-pkg-config-libdir to provide control over -+ the actual directory into which pc-files are installed, do not use -+ the pkg-config environment variables (discussion with Frederic L W -+ Meunier). -+ + add link to mailing-list archive in announce.html.in, as done in -+ FAQ (prompted by question by Andrius Bentkus). -+ + improve manpage install by adjusting the "#include" examples to -+ show the ncurses-subdirectory used when --disable-overwrite option -+ is used. -+ + install an alias for "curses" to the ncurses manpage, tied to the -+ --with-curses-h configure option (suggested by Reuben Thomas). -+ -+20110903 -+ + propagate error-returns from wresize, i.e., the internal -+ increase_size and decrease_size functions through resize_term (report -+ by Tim van der Molen, cf: 20020713). -+ + fix typo in tset manpage (patch by Sven Joachim). -+ -+20110820 -+ + add a check to ensure that termcap files which might have "^?" do -+ not use the terminfo interpretation as "\177". -+ + minor cleanup of X-terminal emulator section of terminfo.src -TD -+ + add terminator entry -TD -+ + add simpleterm entry -TD -+ + improve wattr_get macros by ensuring that if the window pointer is -+ null, then the attribute and color values returned will be zero -+ (cf: 20110528). -+ -+20110813 -+ + add substitution for $RPATH_LIST to misc/ncurses-config.in -+ + improve performance of tic with hashed-database by caching the -+ database connection, using atexit() to cleanup. -+ + modify treatment of 2-character aliases at the beginning of termcap -+ entries so they are not counted in use-resolution, since these are -+ guaranteed to be unique. Also ignore these aliases when reporting -+ the primary name of the entry (cf: 20040501) -+ + double-check gn (generic) flag in terminal descriptions to -+ accommodate old/buggy termcap databases which misused that feature. -+ + minor fixes to _nc_tgetent(), ensure buffer is initialized even on -+ error-return. -+ -+20110807 -+ + improve rpath fix from 20110730 by ensuring that the new $RPATH_LIST -+ variable is defined in the makefiles which use it. -+ + build-fix for DragonFlyBSD's pkgsrc in test/configure script. -+ + build-fixes for NetBSD 5.1 with termcap support enabled. -+ + corrected k9 in dg460-ansi, add other features based on manuals -TD -+ + improve trimming of whitespace at the end of terminfo/termcap output -+ from tic/infocmp. -+ + when writing termcap source, ensure that colons in the description -+ field are translated to a non-delimiter, i.e., "=". -+ + add "-0" option to tic/infocmp, to make the termcap/terminfo source -+ use a single line. -+ + add a null-pointer check when handling the $CC variable. -+ -+20110730 -+ + modify configure script and makefiles in c++ and progs to allow the -+ directory used for rpath option to be overridden, e.g., to work -+ around updates to the variables used by tic during an install. -+ + add -K option to tic/infocmp, to provide stricter BSD-compatibility -+ for termcap output. -+ + add _nc_strict_bsd variable in tic library which controls the -+ "strict" BSD termcap compatibility from 20110723, plus these -+ features: -+ + allow escapes such as "\8" and "\9" when reading termcap -+ + disallow "\a", "\e", "\l", "\s" and "\:" escapes when reading -+ termcap files, passing through "a", "e", etc. -+ + expand "\:" as "\072" on output. -+ + modify _nc_get_token() to reset the token's string value in case -+ there is a string-typed token lacking the "=" marker. -+ + fix a few memory leaks in _nc_tgetent. -+ + fix a few places where reading from a termcap file could refer to -+ freed memory. -+ + add an overflow check when converting terminfo/termcap numeric -+ values, since terminfo stores those in a short, and they must be -+ positive. -+ + correct internal variables used for translating to termcap "%>" -+ feature, and translating from termcap %B to terminfo, needed by -+ tctest (cf: 19991211). -+ + amend a minor fix to acsc when loading a termcap file to separate it -+ from warnings needed for tic (cf: 20040710) -+ + modify logic in _nc_read_entry() and _nc_read_tic_entry() to allow -+ a termcap file to be handled via TERMINFO_DIRS. -+ + modify _nc_infotocap() to include non-mandatory padding when -+ translating to termcap. -+ + modify _nc_read_termcap_entry(), passing a flag in the case where -+ getcap is used, to reduce interactive warning messages. -+ -+20110723 -+ + add a check in start_color() to limit color-pairs to 256 when -+ extended colors are not supported (patch by David Benjamin). -+ + modify setcchar to omit no-longer-needed OR'ing of color pair in -+ the SetAttr() macro (patch by David Benjamin). -+ + add kich1 to sun terminfo entry (Yuri Pankov) -+ + use bold rather than reverse for smso in sun-color terminfo entry -+ (Yuri Pankov). -+ + improve generation of termcap using tic/infocmp -C option, e.g., -+ to correspond with 4.2BSD (prompted by discussion with Yuri Pankov -+ regarding Schilling's test program): -+ + translate %02 and %03 to %2 and %3 respectively. -+ + suppress string capabilities which use %s, not supported by tgoto -+ + use \040 rather than \s -+ + expand null characters as \200 rather than \0 -+ + modify configure script to support shared libraries for DragonFlyBSD. -+ -+20110716 -+ + replace an assert() in _nc_Free_Argument() with a regular null -+ pointer check (report/analysis by Franjo Ivancic). -+ + modify configure --enable-pc-files option to take into account the -+ PKG_CONFIG_PATH variable (report by Frederic L W Meunier). -+ + add/use xterm+tmux chunk from xterm #271 -TD -+ + resync xterm-new entry from xterm #271 -TD -+ + add E3 extended capability to linux-basic (Miroslav Lichvar) -+ + add linux2.2, linux2.6, linux3.0 entries to give context for E3 -TD -+ + add SI/SO change to linux2.6 entry (Debian #515609) -TD -+ + fix inconsistent tabset path in pcmw (Todd C. Miller). -+ + remove a backslash which continued comment, obscuring altos3 -+ definition with OpenBSD toolset (Nicholas Marriott). -+ -+20110702 -+ + add workaround from xterm #271 changes to ensure that compiler flags -+ are not used in the $CC variable. -+ + improve support for shared libraries, tested with AIX 5.3, 6.1 and -+ 7.1 with both gcc 4.2.4 and cc. -+ + modify configure checks for AIX to include release 7.x -+ + add loader flags/libraries to libtool options so that dynamic loading -+ works properly, adapted from ncurses-5.7-ldflags-with-libtool.patch -+ at gentoo prefix repository (patch by Michael Haubenwallner). -+ -+20110626 -+ + move include of nc_termios.h out of term_entry.h, since the latter -+ is installed, e.g., for tack while the former is not (report by -+ Sven Joachim). -+ -+20110625 -+ + improve cleanup() function in lib_tstp.c, using _exit() rather than -+ exit() and checking for SIGTERM rather than SIGQUIT (prompted by -+ comments forwarded by Nicholas Marriott). -+ + reduce name pollution from term.h, moving fallback #define's for -+ tcgetattr(), etc., to new private header nc_termios.h (report by -+ Sergio NNX). -+ + two minor fixes for tracing (patch by Vassili Courzakis). -+ + improve trace initialization by starting it in use_env() and -+ ripoffline(). -+ + review old email, add details for some changelog entries. -+ -+20110611 -+ + update minix entry to minix 3.2 (Thomas Cort). -+ + fix a strict compiler warning in change to wattr_get (cf: 20110528). -+ -+20110604 -+ + fixes for MirBSD port: -+ + set default prefix to /usr. -+ + add support for shared libraries in configure script. -+ + use S_ISREG and S_ISDIR consistently, with fallback definitions. -+ + add a few more checks based on ncurses/link_test. -+ + modify MKlib_gen.sh to handle sp-funcs renaming of NCURSES_OUTC type. -+ -+20110528 -+ + add case to CF_SHARED_OPTS for Interix (patch by Markus Duft). -+ + used ncurses/link_test to check for behavior when the terminal has -+ not been initialized and when an application passes null pointers -+ to the library. Added checks to cover this (prompted by Redhat -+ #707344). -+ + modify MKlib_gen.sh to make its main() function call each function -+ with zero parameters, to help find inconsistent checking for null -+ pointers, etc. -+ -+20110521 -+ + fix warnings from clang 2.7 "--analyze" -+ -+20110514 -+ + compiler-warning fixes in panel and progs. -+ + modify CF_PKG_CONFIG macro, from changes to tin -TD -+ + modify CF_CURSES_FUNCS configure macro, used in test directory -+ configure script: -+ + work around (non-optimizer) bug in gcc 4.2.1 which caused -+ test-expression to be omitted from executable. -+ + force the linker to see a link-time expression of a symbol, to -+ help work around weak-symbol issues. -+ -+20110507 -+ + update discussion of MKfallback.sh script in INSTALL; normally the -+ script is used automatically via the configured makefiles. However -+ there are still occasions when it might be used directly by packagers -+ (report by Gunter Schaffler). -+ + modify misc/ncurses-config.in to omit the "-L" option from the -+ "--libs" output if the library directory is /usr/lib. -+ + change order of tests for curses.h versus ncurses.h headers in the -+ configure scripts for Ada95 and test-directories, to look for -+ ncurses.h, from fixes to tin -TD -+ + modify ncurses/tinfo/access.c to account for Tandem's root uid -+ (report by Joachim Schmitz). -+ -+20110430 -+ + modify rules in Ada95/src/Makefile.in to ensure that the PIC option -+ is not used when building a static library (report by Nicolas -+ Boulenguez): -+ + Ada95 build-fix for big-endian architectures such as sparc. This -+ undoes one of the fixes from 20110319, which added an "Unused" member -+ to representation clauses, replacing that with pragmas to suppress -+ warnings about unused bits (patch by Nicolas Boulenguez): -+ -+20110423 -+ + add check in test/configure for use_window, use_screen. -+ + add configure-checks for getopt's variables, which may be declared -+ as different types on some Unix systems. -+ + add check in test/configure for some legacy curses types of the -+ function pointer passed to tputs(). -+ + modify init_pair() to accept -1's for color value after -+ assume_default_colors() has been called (Debian #337095). -+ + modify test/background.c, adding commmand-line options to demonstrate -+ assume_default_colors() and use_default_colors(). -+ -+20110416 -+ + modify configure script/source-code to only define _POSIX_SOURCE if -+ the checks for sigaction and/or termios fail, and if _POSIX_C_SOURCE -+ and _XOPEN_SOURCE are undefined (report by Valentin Ochs). -+ + update config.guess, config.sub -+ -+20110409 -+ + fixes to build c++ binding with clang 3.0 (patch by Alexander -+ Kolesen). -+ + add check for unctrl.h in test/configure, to work around breakage in -+ some ncurses packages. -+ + add "--disable-widec" option to test/configure script. -+ + add "--with-curses-colr" and "--with-curses-5lib" options to the -+ test/configure script to address testing with very old machines. -+ - 20110404 5.9 release for upload to ftp.gnu.org - - 20110402 -@@ -100,7 +1483,7 @@ - + modify configure script to provide value for HTML_DIR in - Ada95/gen/Makefile.in, which depends on whether the Ada95 binding is - distributed separately (report by Nicolas Boulenguez). -- + modify configure script to add -g and/or -O3 to ADAFLAGS if the -+ + modify configure script to add "-g" and/or "-O3" to ADAFLAGS if the - CFLAGS for the build has these options. - + amend change from 20070324, to not add 1 to the result of getmaxx - and getmaxy in the Ada binding (report by Nicolas Boulenguez for -@@ -155,7 +1538,7 @@ - 20110212 - + regenerated html manpages. - + use _tracef() in show_where() function of tic, to work correctly with -- special case of trace configuration. -+ special case of trace configuration. - - 20110205 - + add xterm-utf8 entry as a demo of the U8 feature -TD -@@ -219,7 +1602,7 @@ - version which works with termcap. - + remove obsolete emacs "Local Variables" section from documentation - (request by Sven Joachim). -- + update doc/html/index.html to include NCURSES-Programming-HOWTO.html -+ + update doc/html/index.html to include NCURSES-Programming-HOWTO.html - (report by Sven Joachim). - - 20101128 -@@ -294,8 +1677,8 @@ - Sven Joachim). - + add parameterized cursor-controls to linux-basic (report by Dae) -TD - > patch by Juergen Pfeifer: -- + document how to build 32-bit libraries in README.MinGW -- + fixes to filename computation in mk-dlls.sh.in -+ + document how to build 32-bit libraries in README.MinGW -+ + fixes to filename computation in mk-dlls.sh.in - + use POSIX locale in mk-dlls.sh.in rather than en_US (report by Sven - Joachim). - + add a check in mk-dlls.sh.in to obtain the size of a pointer to -@@ -478,7 +1861,7 @@ - 20100417 - + modify _nc_capcmp() to work with cancelled strings. - + correct translation of "^" in _nc_infotocap(), used to transform -- terminfo to termcap strings -+ terminfo to termcap strings - + add configure --disable-rpath-hack, to allow disabling the feature - which adds rpath options for libraries in unusual places. - + improve CF_RPATH_HACK_2 by checking if the rpath option for a given -@@ -1533,8 +2916,8 @@ - that library. - + add/modify null-pointer checks in several functions for SP and/or - the WINDOW* parameter (report by Thorben Krueger). -- + fixes for field_buffer() in formw library (see Redhat Bugzilla -- #310071, patches by Miroslav Lichvar). -+ + fixes for field_buffer() in formw library (see Redhat #310071, -+ patches by Miroslav Lichvar). - + improve performance of NCURSES_CHAR_EQ code (patch by Miroslav - Lichvar). - + update/improve mlterm and rxvt terminfo entries, e.g., for -@@ -1645,7 +3028,7 @@ - + modify configure script to quiet c++ build with libtool when the - --disable-echo option is used. - + modify configure script to disable ada95 if libtool is selected, -- writing a warning message (addresses FreeBSD ports/114493). -+ writing a warning message (addresses FreeBSD #114493). - + update config.guess, config.sub - - 20070707 -@@ -2130,8 +3513,7 @@ - + workaround for 20050806 ifdef's change to allow visbuf.c to compile - when using --with-termlib --with-trace options. - + improve tgetstr() by making the return value point into the user's -- buffer, if provided (patch by Miroslav Lichvar (see Redhat Bugzilla -- #202480)). -+ buffer, if provided (patch by Miroslav Lichvar (see Redhat #202480)). - + correct libraries needed for foldkeys (report by Stanislav Ievlev) - - 20060826 -@@ -2144,10 +3526,10 @@ - source output (Debian #378783). - + modify configure script to ensure that if the C compiler is used - rather than the loader in making shared libraries, the $(CFLAGS) -- variable is also used (Redhat Bugzilla #199369). -+ variable is also used (Redhat #199369). - + port hashed-db code to db2 and db3. - + fix a bug in tgetent() from 20060625 and 20060715 changes -- (patch/analysis by Miroslav Lichvar (see Redhat Bugzilla #202480)). -+ (patch/analysis by Miroslav Lichvar (see Redhat #202480)). - - 20060805 - + updated xterm function-keys terminfo to match xterm #216 -TD -@@ -2939,7 +4321,7 @@ - of cur_term if the same output was selected. This now reuses it only - when setupterm() is called from tgetent(), which has no notion of - separate SCREENs. Note that tgetent() must be called after initscr() -- or newterm() to use this feature (Redhat Bugzilla #140326). -+ or newterm() to use this feature (Redhat #140326). - + add a check in CF_BUILD_CC macro to ensure that developer has given - the --with-build-cc option when cross-compiling (report by Alexandre - Campo). -@@ -3032,7 +4414,7 @@ - entries, e.g., so it can analyze the xterm-8bit entry. - + add morphos terminfo entry, improve amiga-8bit entry (Pavel Fedin). - + correct translation of "%%" in terminfo format to termcap, e.g., -- using "tic -C" (Redhat Bugzilla #130921). -+ using "tic -C" (Redhat #130921). - + modified configure script CF_XOPEN_SOURCE macro to ensure that if - it defines _POSIX_C_SOURCE, that it defines it to a specific value - (comp.os.stratus newsgroup comment). -@@ -3043,9 +4425,9 @@ - However that did find a coding error in Assume_Default_Colors(). - + modify several terminfo entries to ensure xterm mouse and cursor - visibility are reset in rs2 string: hurd, putty, gnome, -- konsole-base, mlterm, Eterm, screen (Debian #265784, #55637). The -- xterm entries are left alone - old ones for compatibility, and the -- new ones do not require this change. -TD -+ konsole-base, mlterm, Eterm, screen (Debian #265784, Debian #55637). -+ The xterm entries are left alone - old ones for compatibility, and -+ the new ones do not require this change. -TD - - 20040814 - + fake a SIGWINCH in newterm() to accommodate buggy terminal emulators -@@ -3076,8 +4458,8 @@ - + modify "tic -cv" to ignore delays when comparing strings. Also - modify it to ignore a canceled sgr string, e.g., for terminals which - cannot properly combine attributes in one control sequence. -- + corrections for gnome and konsole entries (Redhat Bugzilla #122815, -- patch by Hans de Goede) -+ + corrections for gnome and konsole entries (Redhat #122815, patch by -+ Hans de Goede) - > terminfo updates -TD - + make ncsa-m rmacs/smacs consistent with sgr - + add sgr, rc/sc and ech to syscons entries -@@ -3090,7 +4472,7 @@ - > terminfo updates -TD - + add xterm-pc-fkeys - + review/update gnome and gnome-rh90 entries (prompted by Redhat -- Bugzilla #122815). -+ #122815). - + review/update konsole entries - + add sgr, correct sgr0 for kterm and mlterm - + correct tsl string in kterm -@@ -3503,7 +4885,7 @@ - generated when cross-compiling for DJGPP. - + modify infocmp to omit check for $TERM for operations that do not - require it, e.g., "infocmp -e" used to build fallback list (report by -- Koblinger Egmont). -+ Egmont Koblinger). - - 20031004 - + add terminfo entries for DJGPP. -@@ -4204,7 +5586,7 @@ - + add a check in kgetch() for cooked characters in the fifo to avoid - calling fifo_push() when a KEY_RESIZE is available (report/analysis - by Sam Varshavchik <mrsam@courier-mta.com>). -- + fix an overlooked case for bugzilla #68199 (Philippe Blain). -+ + fix an overlooked case for Redhat #68199 (Philippe Blain). - + ensure clearerr() is called before using ferror() e.g., in - lib_screen.c (report by Philippe Blain). - -@@ -4212,7 +5594,7 @@ - + modify lib_screen.c and lib_newwin.c to maintain the SCREEN-specific - pointers for curscr/stdscr/newscr when scr_save() and scr_restore() - modify the global curscr/stdscr/newscr variables. Fixes Redhat -- bugzilla #68199 dated 2002-07-07. -+ #68199. - + add checks for null pointer in calls to tparm() and tgoto() based on - FreeBSD bug report. If ncurses were built with termcap support, and - the first call to tgoto() were a zero-length string, the result would -@@ -4245,7 +5627,7 @@ - Olaf Buddenhagen <olafBuddenhagen@web.de>). - + modified wresize() to ensure that a failed realloc will not corrupt - the window structure, and to make subwindows fit within the resized -- window (completes Debian #87678, #101699) -+ window (completes Debian #87678, Debian #101699) - - 20020803 - + fix an off-by-one in lib_pad.c check for limits of pad (patch by -@@ -4940,9 +6322,9 @@ - which may be in libutf8. - + remove some unnecessary text from curs_extend.3x and - default_colors.3x which caused man-db to make incorrect symbolic -- links (Debian bug report #99550). -+ links (Debian #99550). - + add configure check if cast for _IO_va_list is needed to compile -- C++ vscan code (Debian bug report #97945). -+ C++ vscan code (Debian #97945). - > several patches from Sven Verdoolaege: - + correct code that used non-standard auto-initialization of a struct, - which gcc allows (report by Larry Virden). -@@ -5077,7 +6459,7 @@ - + add some examples of customizing screen's terminfo: - screen.xterm-xfree86, screen.xterm-r6, screen.teraterm -TD - + modify screen's terminfo entry to match the khome/kend in screen -- 3.09.08 (Debian bug report #92215). -+ 3.09.08 (Debian #92215). - + correct a memory leak in forms library (report by Stefan Vogtner - <stefan@vogtner.de>) (patch by Juergen Pfeifer). - -@@ -5091,12 +6473,12 @@ - + add .cc.ii rule to c++ makefile, to get preprocessor output for - debugging. - + correct configure script handling of @keyword@ substitutions when the -- --with-manpage-renames option is given (cf: 20000715, fixes Debian -- bug #89939). -+ --with-manpage-renames option is given (cf: 20000715, fixes Debian -+ #89939). - + report stack underflow/overflow in tparm() when tic -cv option is - given. - + remove spurious "%|" operator from xterm-xfree86 terminfo entry, -- (reported by Adam Costello <amc@cs.berkeley.edu>, Debian bug #89222). -+ (reported by Adam Costello <amc@cs.berkeley.edu>, Debian #89222). - - 20010310 - + cleanup of newdemo.c, fixing some ambiguous expressions noted by gcc -@@ -5800,7 +7182,7 @@ - + correct spelling error in terminfo entry name: bq300-rv was given as - bg300-rv in esr's version. - + modify redrawwin() macro so its parameter is fully parenthesized -- (fixes Debian bug report #61088). -+ (fixes Debian #61088). - + correct formatting error in dump_entry() which set incorrect column - value when no newline trimming was needed at the end of an entry, - before appending "use=" clauses (cf: 960406). -@@ -6530,7 +7912,7 @@ - handling in lynx (reported by Kim DeVaughn). - - 990306 pre-release -- + add -G option to tic and infocmp, to reverse the -g option. -+ + add -G option to tic and infocmp, to reverse the "-g" option. - + recode functions in name_match.c to avoid use of strncpy, which - caused a 4-fold slowdown in tic (cf: 980530). - + correct a few warnings about sign-extension in recent changes. -@@ -6901,7 +8283,7 @@ - since that is a little more efficient. - + minor correction to infocmp to avoid displaying "difference" between - two capabilities that are rendered in equivalent forms. -- + add -g option to tic/infocmp to force character constants to be -+ + add "-g" option to tic/infocmp to force character constants to be - displayed in quoted form. Otherwise their decimal values are shown. - + modify setupterm so that cancelled strings are treated the same as - absent strings, cancelled and absent booleans false (does not affect -@@ -8979,15 +10361,18 @@ - + correction to #317. - > patch 317 (ESR): - + re-add _nc_hash_map -- + modify EmitRange to maintain position as per original design. -- + add hashtest.c, program to time the hashmap optimization. -+ + modify EmitRange to maintain position as per original design -+ (patch by A. Lukyanov). -+ + modify test/ncurses.c and tputs, etc., to allow trace counting -+ output characters. -+ + add hashtest.c program to time the hashmap optimization. - > patch 316 (ESR): - + add logic to deal with magic-cookie (how was this tested?) - (lib_doupdate.c). - + add ncurses.c driver for magic-cookie, some fixes to ncurses.c - > patch 315 (ESR): -- + merged Alexander V Lukyanov's patch to use ech and rep - untested -- (lib_doupdate.c). -+ + merge changes to lib_doupdate.c to use ech and rep - untested -+ (patch by Alexander V Lukyanov). - + modified handling of interrupted system calls - untested - (lib_getch.c, lib_twait.c). - + new function _nc_mvcur_resume() -@@ -9059,12 +10444,12 @@ - + corrected typo in dtterm description. - > patch 313 (ESR): - + add dtterm description -- + clarify ncurses 'i' test (drop vscanf subtest) -+ + clarify ncurses 'i' test (drop mvwscanw subtest) - - 960810 - snapshot - + correct nl()/nonl() to work as per SVr4 & XSI. - + minor fixes to ncurses.c (use 'noraw()', mvscanw return-code) -- + refine configure-test for -g option (Tim Mooney). -+ + refine configure-test for "-g" option (Tim Mooney). - + correct interaction between O_BLANK and NEW_LINE request in form - library (Juergen Pfeifer) - -@@ -9073,7 +10458,8 @@ - > patch 312 (ESR): - correct terminfo.src corrupted by #310 - > patch 311 (ESR): -- + fix idlok() and idcok() and the default of the idlok switch. -+ + fix idlok() and idcok() and the default of the idlok switch (report -+ by Ville Sulko). - - 960803 - snapshot - + corrected tparm to handle capability strings without explicit pop -@@ -9083,7 +10469,7 @@ - > patch 310 (ESR): - + documentation and prototyping errors for has_color, immedok and idcok - (reported by William P Setzer <wsetzer@pams.ncsu.edu>) -- + updated qnx terminfo entry (by Michael Hunter) -+ + updated qnx terminfo entry (patch by Michael Hunter) - - 960730 - + eliminate quoted includes in ncurses subdirectory, ensure config.h -@@ -9095,7 +10481,7 @@ - + call cbreak() in initscr(), as per XSI & SVr4. - + turn off hardware echo in initscr() as per XSI & SVr4 - > patch 309 (ESR): -- + terminfo changes (9.3.10), from BRL -+ + terminfo changes (9.3.9), from BRL - + add more checks to terminfo parser. - + add more symbols to infocmp. - -@@ -9114,6 +10500,7 @@ - > patch 308 (ESR): - + terminfo changes (9.3.8) - + modified logic of error-reporting in terminfo parser -+ + fix option-processing bug in toe. - - 960713 - snapshot - + always check for <sys/bsdtypes.h> since ISC needs it to declare -@@ -9122,9 +10509,19 @@ - by Juergen Pfeifer, Mike Long) - + add LOCAL_LDFLAGS2 symbol (Juergen Pfeifer) - + corrected prototype for delay_output() -- bump ABI to 3.2 -- + terminfo patches #306/307 (ESR). -+ + patch 307 (ESR): -+ + enable more translations of nonstandard caps, and document them. -+ + misc/terminfo.src update to 9.13.8 -+ + patch 306 (ESR): - + moved logic that filters out rmul and rmso from setupterm to newterm - where it is less likely to interfere with termcap applications. -+ + cosmetic fixes to test/ncurses.c -+ + modify open() call in ncurses/read_entry.c to use O_RDONLY symbol -+ rather than constant (report by mib). -+ + misc/terminfo.src sgr0 and acsc changes (report by Philippe De -+ Muyter). -+ + modify ncurses/comp_parse.c so that entries containing a "+" can -+ have missing rmcup vs smcup. - - 960707 - + rollback ESR's #305 change to terminfo.src (it breaks existing -@@ -9139,7 +10536,6 @@ - + make lib_vidattr.c more readable using macros. - + filter out rmul, rmso that conflict with sgr0 when reading terminal - descriptions. -- + added sanity-checking of various paired string attributes (ESR). - + work around autoconf bug, force $INSTALL to absolute path - (reported by Zeyd). - + modify man-page install for BSDI to install preformatted .0 files -@@ -9152,6 +10548,12 @@ - + disable scrollok during the ncurses 'p' test; if it is enabled the - stdscr will scroll when putting the box-corners in the lower-right - of the screen. -+ > patch 305 (ESR): -+ + added sanity-checking of various paired string attributes. -+ + misc/terminfo.src update to 9.13.7 (report by A. Lukyanov). -+ + modify man/Makefile.in to make terminfo.5 during normal build. -+ > patch 304 (ESR): -+ + corrected allocation-length for $HOME/.terminfo path. - - 960629 - snapshot - + check return code of _nc_mvcur_scrolln() in _nc_scroll_optimize() for -@@ -9234,6 +10636,7 @@ - + better fix for nvi refresh-bug (Rick Marshall) - + fix for bug in handling of interrupted keystroke waits, - (Werner Fleck). -+ + misc/ncurses-intro.html syntax fix (Kajiyama Tamito). - - 960601 - snapshot - + auto-configure man-page compression-format and renames for Debian. -@@ -9248,7 +10651,7 @@ - + enhancement to the control over the new PC-style soft key format. - allow caller now to select whether or not one wants to have - the index-line; see curs_slk.3x for documentation (Juergen Pfeifer). -- + typos, don't use inline with -g (Philippe De Muyter) -+ + typos, don't use inline with "-g" (Philippe De Muyter) - + fixes for menus & wattr-, slk-functions (Juergen Pfeifer) - - 960526 - snapshot -@@ -9263,6 +10666,9 @@ - + include sys/types.h in case stdlib.h does not declare size_t. - + fixes for makefile (Tim Mooney) - + fixes for menus & forms (Juergen Pfeifer) -+ > patch 302 (ESR): -+ + improve hash function (suggested by Alexander V Lukyanov). -+ + 9.13.4 update for terminfo.src - - 960518 - snapshot - + revised ncurses.c panner test, let pad abut all 4 sides of screen. -@@ -9275,6 +10681,8 @@ - confusion, and made this check for the /usr/lib/terminfo pre-existing - directory. - > patches 299-301 (ESR): -+ + html fixes (Phillippe de Muyter). -+ + fix typo in ncurses-intro.html (report by Fabrizio Polacco). - + added hashmap.c - + mods to tracing, especially for ACS chars. - + corrected off-by-one in IDCtransform. -@@ -9294,13 +10702,21 @@ - > patches 297, 298 (ESR): - + implement TERMINFO_DIRS, and -o option of tic - + added TRACE_IEVENT -- + removed boolean version of 'getm' -- + added lib_print.c (for Rick Marshall) -- + added has_key() -+ + fix REQ_TOGGLE_ITEM in menu/menu_driver.c; it could select but not -+ deselect. -+ + added lib_print.c (request by Rick Marshall). -+ + added has_key() (request by Juergen Pfeifer). -+ + do not issue clrtoeol or clrtobot if the relevant portion of the line -+ is already blank (analysis by Keith Bostic). -+ + add parentheses for parameters of COLOR_PAIR and PAIR_NUMBER macros -+ (analysis by Jurgen Eidt). -+ + update screen's notion of cursor position in endwin() (analysis by -+ Alexander Lukyanov). - + added 't' to ncurses.c test. - + moved delay_output() to lib_tputs.c - + removed tparam() (was added in 1.9.9, but conflicts with emacs and - is not part of X/Open Curses). -+ + removed boolean version of 'getm'. - + misc cursor & optimization fixes. - - 960504 - snapshot -@@ -9326,11 +10742,20 @@ - + make TIOCGWINSZ configure test less stringent, in case user - configures via terminal that cannot get screen size. - > patches 295, 296 (ESR): -- + new "-e" option of tic. -- + fix for "infocmp -e". -- + restore working-directory in read_termcap.c - + split lib_kernel.c, lib_setup.c and names.c in order to reduce - overhead for programs that use only termcap features. -+ + new "-e" and "-h" options of tic (request by Tony Nugent). -+ + fix bug in mandatory-delay logic in lib_tputs.c (report by Sven -+ Verdoolaege). -+ + fix for "infocmp -e" to emit correct initializers (reported by Manual -+ J Novoa III). -+ + restore working-directory in read_termcap.c (report by Kayvan -+ Sylvan). -+ + use "-h" option on Solaris when generating shared libraries on -+ Solaris 2.5 to record the library name in the file, for assisting -+ the loader (patch by Scott Kramer). -+ + undo patch #294 changes to form and menu libraries (request by -+ Juergen Pfeifer). - - 960418 - snapshot - + use autoconf 2.9 -@@ -9338,10 +10763,22 @@ - definitions via <termios.h>, modified macros in lib_raw.c to avoid - K&R-style substitution) - > patches 293, 294 (ESR): -- + mods to wgetch() in cooked mode -- + corrected askuser() logic in tset -- + correct interaction of endwin() with mouse processing -+ + rewrite wsyncup(), wsyncdown(), as well as small fixes to form and -+ menu libraries to fix echo-breakage introduced by 1.8.9, 1.9.9e -+ changes (patches by Juergen Pfeifer). -+ + fix compile under QNX 4.2 by defining ONLCR in lib_raw.c when -+ __QNX__ is defined (patch by Michael Hunter). -+ + modify setupterm() to match documentation for its return value, fix -+ newterm to work with this change (report by Emmet Lazich). -+ + add checks in getch() for error, return ERR as appropriate (report by -+ Emmet Lazich). -+ + mods to wgetch() in cooked mode (report by Pete Seebach). -+ + corrected askuser() logic in tset (patch by Remco Treffkorn). -+ + correct interaction of endwin() with mouse processing (report by -+ Michael Elkins). - + added trace support for TTY flags -+ + update terminfo.src to 9.13.1 -+ + FreeBSD console entries (patch by Andrew Chernov). - - 960406 - + fixes for NeXT, ISC and HPUX auto-configure -diff -Naur ncurses-5.9/package/debian/changelog ncurses-5.9.patch/package/debian/changelog ---- ncurses-5.9/package/debian/changelog 1970-01-01 01:00:00.000000000 +0100 -+++ ncurses-5.9.patch/package/debian/changelog 2014-09-01 16:34:19.497887066 +0200 -@@ -0,0 +1,11 @@ -+ncurses6 (5.9-20140323) unstable; urgency=low -+ -+ * latest weekly patch -+ -+ -- Thomas E. Dickey <dickey@invisible-island.net> Sun, 23 Mar 2014 16:59:54 -0400 -+ -+ncurses6 (5.9-20120608) unstable; urgency=low -+ -+ * initial release -+ -+ -- Thomas E. Dickey <dickey@invisible-island.net> Fri, 08 Jun 2012 07:54:29 -0400 -diff -Naur ncurses-5.9/package/debian/compat ncurses-5.9.patch/package/debian/compat ---- ncurses-5.9/package/debian/compat 1970-01-01 01:00:00.000000000 +0100 -+++ ncurses-5.9.patch/package/debian/compat 2014-09-01 16:33:22.519792399 +0200 -@@ -0,0 +1 @@ -+5 -diff -Naur ncurses-5.9/package/debian/control ncurses-5.9.patch/package/debian/control ---- ncurses-5.9/package/debian/control 1970-01-01 01:00:00.000000000 +0100 -+++ ncurses-5.9.patch/package/debian/control 2014-09-01 16:33:22.519792399 +0200 -@@ -0,0 +1,16 @@ -+Source: ncurses6 -+Section: libdevel -+Priority: optional -+Maintainer: Thomas E. Dickey <dickey@invisible-island.net> -+Homepage: http://invisible-island.net/ncurses/ -+Build-Depends: debhelper (>= 7) -+Standards-Version: 3.8.2 -+ -+Package: ncurses6 -+Architecture: any -+Depends: ${misc:Depends} -+Description: shared libraries for terminal handling -+ The ncurses library routines are a terminal-independent method of -+ updating character screens with reasonable optimization. -+ . -+ This package is used for testing ABI 6. -diff -Naur ncurses-5.9/package/debian/copyright ncurses-5.9.patch/package/debian/copyright ---- ncurses-5.9/package/debian/copyright 1970-01-01 01:00:00.000000000 +0100 -+++ ncurses-5.9.patch/package/debian/copyright 2014-09-01 16:33:22.520792399 +0200 -@@ -0,0 +1,112 @@ -+This package is used for testing builds of ncurses. -+ -+Copyright (c) 1998-2013,2014 Free Software Foundation, Inc. -+Copyright © 2001 by Pradeep Padala -+ -+Permission is hereby granted, free of charge, to any person obtaining a -+copy of this software and associated documentation files (the -+"Software"), to deal in the Software without restriction, including -+without limitation the rights to use, copy, modify, merge, publish, -+distribute, distribute with modifications, sublicense, and/or sell -+copies of the Software, and to permit persons to whom the Software is -+furnished to do so, subject to the following conditions: -+ -+The above copyright notice and this permission notice shall be included -+in all copies or substantial portions of the Software. -+ -+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -+IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -+DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -+OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR -+THE USE OR OTHER DEALINGS IN THE SOFTWARE. -+ -+Except as contained in this notice, the name(s) of the above copyright -+holders shall not be used in advertising or otherwise to promote the -+sale, use or other dealings in this Software without prior written -+authorization. -+ -+ -+Copyright (C) 1994 X Consortium -+ -+Permission is hereby granted, free of charge, to any person obtaining a copy -+of this software and associated documentation files (the "Software"), to -+deal in the Software without restriction, including without limitation the -+rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -+sell copies of the Software, and to permit persons to whom the Software is -+furnished to do so, subject to the following conditions: -+ -+The above copyright notice and this permission notice shall be included in -+all copies or substantial portions of the Software. -+ -+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -+X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- -+TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -+ -+Except as contained in this notice, the name of the X Consortium shall not -+be used in advertising or otherwise to promote the sale, use or other deal- -+ings in this Software without prior written authorization from the X Consor- -+tium. -+ -+ -+Copyright (c) 1980, 1991, 1992, 1993 -+ The Regents of the University of California. 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. -+3. Neither the name of the University nor the names of its contributors -+ may be used to endorse or promote products derived from this software -+ without specific prior written permission. -+ -+THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. -+ -+ -+Copyright 1996-2013,2014 by Thomas E. Dickey -+ -+ All Rights Reserved -+ -+Permission is hereby granted, free of charge, to any person obtaining a -+copy of this software and associated documentation files (the -+"Software"), to deal in the Software without restriction, including -+without limitation the rights to use, copy, modify, merge, publish, -+distribute, sublicense, and/or sell copies of the Software, and to -+permit persons to whom the Software is furnished to do so, subject to -+the following conditions: -+ -+The above copyright notice and this permission notice shall be included -+in all copies or substantial portions of the Software. -+ -+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -+IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY -+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -+ -+Except as contained in this notice, the name(s) of the above copyright -+holders shall not be used in advertising or otherwise to promote the -+sale, use or other dealings in this Software without prior written -+authorization. -+ -+-- vile: txtmode file-encoding=utf-8 -diff -Naur ncurses-5.9/package/debian/rules ncurses-5.9.patch/package/debian/rules ---- ncurses-5.9/package/debian/rules 1970-01-01 01:00:00.000000000 +0100 -+++ ncurses-5.9.patch/package/debian/rules 2014-09-01 16:34:19.473887046 +0200 -@@ -0,0 +1,125 @@ -+#!/usr/bin/make -f -+# MAde with the aid of dh_make, by Craig Small -+# Sample debian/rules that uses debhelper. GNU copyright 1997 by Joey Hess. -+# Some lines taken from debmake, by Cristoph Lameter. -+ -+# Uncomment this to turn on verbose mode. -+#export DH_VERBOSE=1 -+ -+# These are used for cross-compiling and for saving the configure script -+# from having to guess our platform (since we know it already) -+DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) -+DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) -+ -+CC_NORMAL = -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wconversion -+CC_STRICT = $(CC_NORMAL) -W -Wbad-function-cast -Wcast-align -Wcast-qual -Wmissing-declarations -Wnested-externs -Wpointer-arith -Wwrite-strings -ansi -pedantic -+ -+MY_DIR=/usr/local/ncurses6 -+MYDATA=/usr/local/ncurses/share/terminfo -+BUILD_DIR=$(CURDIR)/debian/ncurses6 -+ -+CFLAGS = $(CC_NORMAL) -+ -+ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) -+ CFLAGS += -O0 -+else -+ CFLAGS += -O2 -+endif -+ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) -+ INSTALL_PROGRAM += -s -+endif -+ -+ -+configure: configure-stamp -+configure-stamp: -+ dh_testdir -+ -+ RPATH_LIST=../lib:$(MY_DIR)/lib \ -+ CFLAGS="$(CFLAGS)" ./configure \ -+ --host=$(DEB_HOST_GNU_TYPE) \ -+ --build=$(DEB_BUILD_GNU_TYPE) \ -+ --prefix=$(MY_DIR) \ -+ --with-default-terminfo-dir=$(MYDATA) \ -+ --with-terminfo-dirs=$(MYDATA):/usr/share/terminfo \ -+ --disable-echo \ -+ --disable-getcap \ -+ --disable-leaks \ -+ --disable-macros \ -+ --disable-termcap \ -+ --enable-const \ -+ --enable-ext-colors \ -+ --enable-ext-mouse \ -+ --enable-hard-tabs \ -+ --enable-interop \ -+ --enable-rpath \ -+ --enable-sp-funcs \ -+ --enable-warnings \ -+ --enable-widec \ -+ --verbose \ -+ --with-chtype=uint32_t \ -+ --with-mmask_t=uint32_t \ -+ --with-develop \ -+ --with-shared \ -+ --with-termlib \ -+ --with-ticlib \ -+ --with-trace \ -+ --with-cxx-shared \ -+ --with-xterm-kbs=DEL \ -+ --without-ada \ -+ --without-debug \ -+ --without-normal -+ -+ touch configure-stamp -+ -+build: build-stamp -+build-stamp: configure-stamp -+ dh_testdir -+ -+ $(MAKE) -+ -+ touch build-stamp -+ -+clean: -+ dh_testdir -+ dh_testroot -+ -+ [ ! -f makefile ] || $(MAKE) distclean -+ -+ rm -f configure-stamp build-stamp install-stamp -+ -+ dh_clean -+ -+install: install-stamp -+install-stamp: build-stamp -+ dh_testdir -+ dh_testroot -+ dh_clean -k -+ dh_installdirs -+ -+ $(MAKE) install.libs install.progs DESTDIR=$(BUILD_DIR) -+ -+ ( cd test && make ncurses LOCAL_LIBDIR=$(MY_DIR)/lib ) -+ mv test/ncurses $(BUILD_DIR)$(MY_DIR)/bin/ncurses6 -+ -+ touch install-stamp -+ -+# Build architecture-independent files here. -+binary-indep: build install -+# No binary-indep target. -+ -+# Build architecture-dependent files here. -+binary-arch: build install -+ dh_testdir -+ dh_testroot -+ dh_installchangelogs NEWS -+ dh_strip -+ dh_compress -+ dh_fixperms -+ dh_installdeb -+ dh_shlibdeps -+ dh_gencontrol -+ dh_md5sums -+ dh_builddeb -+ -+binary: binary-indep binary-arch -+.PHONY: build clean binary-indep binary-arch binary install install-stamp -diff -Naur ncurses-5.9/package/debian/source/format ncurses-5.9.patch/package/debian/source/format ---- ncurses-5.9/package/debian/source/format 1970-01-01 01:00:00.000000000 +0100 -+++ ncurses-5.9.patch/package/debian/source/format 2014-09-01 16:33:22.520792399 +0200 -@@ -0,0 +1 @@ -+3.0 (quilt) -diff -Naur ncurses-5.9/package/debian/watch ncurses-5.9.patch/package/debian/watch ---- ncurses-5.9/package/debian/watch 1970-01-01 01:00:00.000000000 +0100 -+++ ncurses-5.9.patch/package/debian/watch 2014-09-01 16:33:22.520792399 +0200 -@@ -0,0 +1,4 @@ -+version=3 -+ -+opts=passive ftp://invisible-island.net/ncurses/current/ncurses\.tar.gz \ -+ debian uupdate -diff -Naur ncurses-5.9/package/debian-mingw/changelog ncurses-5.9.patch/package/debian-mingw/changelog ---- ncurses-5.9/package/debian-mingw/changelog 1970-01-01 01:00:00.000000000 +0100 -+++ ncurses-5.9.patch/package/debian-mingw/changelog 2014-09-01 16:34:19.497887066 +0200 -@@ -0,0 +1,11 @@ -+ncurses6 (5.9-20140323) unstable; urgency=low -+ -+ * latest weekly patch -+ -+ -- Thomas E. Dickey <dickey@invisible-island.net> Sun, 23 Mar 2014 16:59:54 -0400 -+ -+ncurses6 (5.9-20131005) unstable; urgency=low -+ -+ * initial release -+ -+ -- Thomas E. Dickey <dickey@invisible-island.net> Sat, 05 Oct 2013 13:35:29 -0400 -diff -Naur ncurses-5.9/package/debian-mingw/compat ncurses-5.9.patch/package/debian-mingw/compat ---- ncurses-5.9/package/debian-mingw/compat 1970-01-01 01:00:00.000000000 +0100 -+++ ncurses-5.9.patch/package/debian-mingw/compat 2014-09-01 16:33:22.518792397 +0200 -@@ -0,0 +1 @@ -+5 -diff -Naur ncurses-5.9/package/debian-mingw/control ncurses-5.9.patch/package/debian-mingw/control ---- ncurses-5.9/package/debian-mingw/control 1970-01-01 01:00:00.000000000 +0100 -+++ ncurses-5.9.patch/package/debian-mingw/control 2014-09-01 16:33:22.518792397 +0200 -@@ -0,0 +1,16 @@ -+Source: ncurses6 -+Section: libdevel -+Priority: optional -+Maintainer: Thomas E. Dickey <dickey@invisible-island.net> -+Homepage: http://invisible-island.net/ncurses/ -+Build-Depends: debhelper (>= 7) -+Standards-Version: 3.8.2 -+ -+Package: mingw32-ncurses6 -+Architecture: any -+Depends: ${misc:Depends} -+Description: shared libraries for terminal handling -+ The ncurses library routines are a terminal-independent method of -+ updating character screens with reasonable optimization. -+ . -+ This package is used for testing ABI 6 with the MinGW 32-bit port. -diff -Naur ncurses-5.9/package/debian-mingw/copyright ncurses-5.9.patch/package/debian-mingw/copyright ---- ncurses-5.9/package/debian-mingw/copyright 1970-01-01 01:00:00.000000000 +0100 -+++ ncurses-5.9.patch/package/debian-mingw/copyright 2014-09-01 16:33:22.518792397 +0200 -@@ -0,0 +1,112 @@ -+This package is used for testing builds of ncurses. -+ -+Copyright (c) 1998-2013,2014 Free Software Foundation, Inc. -+Copyright © 2001 by Pradeep Padala -+ -+Permission is hereby granted, free of charge, to any person obtaining a -+copy of this software and associated documentation files (the -+"Software"), to deal in the Software without restriction, including -+without limitation the rights to use, copy, modify, merge, publish, -+distribute, distribute with modifications, sublicense, and/or sell -+copies of the Software, and to permit persons to whom the Software is -+furnished to do so, subject to the following conditions: -+ -+The above copyright notice and this permission notice shall be included -+in all copies or substantial portions of the Software. -+ -+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -+IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -+DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -+OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR -+THE USE OR OTHER DEALINGS IN THE SOFTWARE. -+ -+Except as contained in this notice, the name(s) of the above copyright -+holders shall not be used in advertising or otherwise to promote the -+sale, use or other dealings in this Software without prior written -+authorization. -+ -+ -+Copyright (C) 1994 X Consortium -+ -+Permission is hereby granted, free of charge, to any person obtaining a copy -+of this software and associated documentation files (the "Software"), to -+deal in the Software without restriction, including without limitation the -+rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -+sell copies of the Software, and to permit persons to whom the Software is -+furnished to do so, subject to the following conditions: -+ -+The above copyright notice and this permission notice shall be included in -+all copies or substantial portions of the Software. -+ -+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -+X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- -+TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -+ -+Except as contained in this notice, the name of the X Consortium shall not -+be used in advertising or otherwise to promote the sale, use or other deal- -+ings in this Software without prior written authorization from the X Consor- -+tium. -+ -+ -+Copyright (c) 1980, 1991, 1992, 1993 -+ The Regents of the University of California. 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. -+3. Neither the name of the University nor the names of its contributors -+ may be used to endorse or promote products derived from this software -+ without specific prior written permission. -+ -+THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. -+ -+ -+Copyright 1996-2013,2014 by Thomas E. Dickey -+ -+ All Rights Reserved -+ -+Permission is hereby granted, free of charge, to any person obtaining a -+copy of this software and associated documentation files (the -+"Software"), to deal in the Software without restriction, including -+without limitation the rights to use, copy, modify, merge, publish, -+distribute, sublicense, and/or sell copies of the Software, and to -+permit persons to whom the Software is furnished to do so, subject to -+the following conditions: -+ -+The above copyright notice and this permission notice shall be included -+in all copies or substantial portions of the Software. -+ -+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -+IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY -+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -+ -+Except as contained in this notice, the name(s) of the above copyright -+holders shall not be used in advertising or otherwise to promote the -+sale, use or other dealings in this Software without prior written -+authorization. -+ -+-- vile: txtmode file-encoding=utf-8 -diff -Naur ncurses-5.9/package/debian-mingw/rules ncurses-5.9.patch/package/debian-mingw/rules ---- ncurses-5.9/package/debian-mingw/rules 1970-01-01 01:00:00.000000000 +0100 -+++ ncurses-5.9.patch/package/debian-mingw/rules 2014-09-01 16:34:19.472887057 +0200 -@@ -0,0 +1,132 @@ -+#!/usr/bin/make -f -+# Made with the aid of dh_make, by Craig Small -+# Sample debian/rules that uses debhelper. GNU copyright 1997 by Joey Hess. -+# Some lines taken from debmake, by Cristoph Lameter. -+ -+# Uncomment this to turn on verbose mode. -+#export DH_VERBOSE=1 -+ -+# These are used for cross-compiling and for saving the configure script -+# from having to guess our platform (since we know it already) -+DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) -+DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) -+ -+BUILD_CC = gcc -+ -+CC_NORMAL = -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wconversion -+CC_STRICT = $(CC_NORMAL) -W -Wbad-function-cast -Wcast-align -Wcast-qual -Wmissing-declarations -Wnested-externs -Wpointer-arith -Wwrite-strings -ansi -pedantic -+ -+TARGET = i686-w64-mingw32 -+MINGW_TOP = /usr/$(TARGET) -+MINGW_TMP = $(CURDIR)/debian/mingw32-ncurses6 -+ -+CFLAGS = $(CC_NORMAL) -+ -+CONFIG_OPTIONS = \ -+ --disable-echo \ -+ --disable-db-install \ -+ --disable-getcap \ -+ --disable-hard-tabs \ -+ --disable-leaks \ -+ --disable-macros \ -+ --disable-overwrite \ -+ --disable-termcap \ -+ --enable-const \ -+ --enable-ext-colors \ -+ --enable-ext-mouse \ -+ --enable-interop \ -+ --enable-sp-funcs \ -+ --enable-term-driver \ -+ --enable-warnings \ -+ --enable-widec \ -+ --verbose \ -+ --with-chtype=uint32_t \ -+ --with-mmask_t=uint32_t \ -+ --with-cxx-shared \ -+ --with-develop \ -+ --with-fallbacks=unknown,rxvt \ -+ --with-shared \ -+ --with-tparm-arg=intptr_t \ -+ --with-trace \ -+ --with-xterm-kbs=DEL \ -+ --without-ada \ -+ --without-debug \ -+ --without-manpages \ -+ --without-progs \ -+ --without-tests -+ -+export CFLAGS BUILD_CC -+ -+ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) -+ CFLAGS += -O0 -+else -+ CFLAGS += -O2 -+endif -+ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) -+ INSTALL_PROGRAM += -s -+endif -+ -+configure: configure-stamp -+configure-stamp: -+ dh_testdir -+ -+ CC=$(TARGET)-gcc \ -+ CFLAGS="$(CFLAGS)" \ -+ ./configure \ -+ --host=$(TARGET) \ -+ --target=$(TARGET) \ -+ --prefix=$(MINGW_TOP) \ -+ --with-build-cc=$(BUILD_CC) \ -+ $(CONFIG_OPTIONS) -+ -+ touch configure-stamp -+ -+build: build-stamp -+build-stamp: configure-stamp -+ dh_testdir -+ -+ $(MAKE) -+ -+ touch build-stamp -+ -+clean: -+ dh_testdir -+ dh_testroot -+ -+ [ ! -f makefile ] || $(MAKE) distclean -+ -+ rm -f configure-stamp build-stamp install-stamp -+ -+ dh_clean -+ -+install: install-stamp -+install-stamp: build-stamp -+ dh_testdir -+ dh_testroot -+ dh_clean -k -+ dh_installdirs -+ -+ $(MAKE) install.libs DESTDIR=$(MINGW_TMP) -+ -+ touch install-stamp -+ -+# Build architecture-independent files here. -+binary-indep: build install -+# No binary-indep target. -+ -+# Build architecture-dependent files here. -+binary-arch: build install -+ dh_testdir -+ dh_testroot -+ dh_installchangelogs NEWS -+ # dh_strip -+ dh_compress -+ dh_fixperms -+ dh_installdeb -+ dh_shlibdeps -+ dh_gencontrol -+ dh_md5sums -+ dh_builddeb -+ -+binary: binary-indep binary-arch -+.PHONY: build clean binary-indep binary-arch binary install install-stamp -diff -Naur ncurses-5.9/package/debian-mingw/source/format ncurses-5.9.patch/package/debian-mingw/source/format ---- ncurses-5.9/package/debian-mingw/source/format 1970-01-01 01:00:00.000000000 +0100 -+++ ncurses-5.9.patch/package/debian-mingw/source/format 2014-09-01 16:33:22.519792399 +0200 -@@ -0,0 +1 @@ -+3.0 (quilt) -diff -Naur ncurses-5.9/package/debian-mingw/watch ncurses-5.9.patch/package/debian-mingw/watch ---- ncurses-5.9/package/debian-mingw/watch 1970-01-01 01:00:00.000000000 +0100 -+++ ncurses-5.9.patch/package/debian-mingw/watch 2014-09-01 16:33:22.519792399 +0200 -@@ -0,0 +1,4 @@ -+version=3 -+ -+opts=passive ftp://invisible-island.net/ncurses/current/ncurses\.tar.gz \ -+ debian uupdate -diff -Naur ncurses-5.9/package/debian-mingw64/changelog ncurses-5.9.patch/package/debian-mingw64/changelog ---- ncurses-5.9/package/debian-mingw64/changelog 1970-01-01 01:00:00.000000000 +0100 -+++ ncurses-5.9.patch/package/debian-mingw64/changelog 2014-09-01 16:34:19.497887066 +0200 -@@ -0,0 +1,11 @@ -+ncurses6 (5.9-20140323) unstable; urgency=low -+ -+ * latest weekly patch -+ -+ -- Thomas E. Dickey <dickey@invisible-island.net> Sun, 23 Mar 2014 16:59:54 -0400 -+ -+ncurses6 (5.9-20131005) unstable; urgency=low -+ -+ * initial release -+ -+ -- Thomas E. Dickey <dickey@invisible-island.net> Sat, 05 Oct 2013 13:35:29 -0400 -diff -Naur ncurses-5.9/package/debian-mingw64/compat ncurses-5.9.patch/package/debian-mingw64/compat ---- ncurses-5.9/package/debian-mingw64/compat 1970-01-01 01:00:00.000000000 +0100 -+++ ncurses-5.9.patch/package/debian-mingw64/compat 2014-09-01 16:33:22.519792399 +0200 -@@ -0,0 +1 @@ -+5 -diff -Naur ncurses-5.9/package/debian-mingw64/control ncurses-5.9.patch/package/debian-mingw64/control ---- ncurses-5.9/package/debian-mingw64/control 1970-01-01 01:00:00.000000000 +0100 -+++ ncurses-5.9.patch/package/debian-mingw64/control 2014-09-01 16:33:22.519792399 +0200 -@@ -0,0 +1,16 @@ -+Source: ncurses6 -+Section: libdevel -+Priority: optional -+Maintainer: Thomas E. Dickey <dickey@invisible-island.net> -+Homepage: http://invisible-island.net/ncurses/ -+Build-Depends: debhelper (>= 7) -+Standards-Version: 3.8.2 -+ -+Package: mingw64-ncurses6 -+Architecture: any -+Depends: ${misc:Depends} -+Description: shared libraries for terminal handling -+ The ncurses library routines are a terminal-independent method of -+ updating character screens with reasonable optimization. -+ . -+ This package is used for testing ABI 6 with the MinGW 64-bit port. -diff -Naur ncurses-5.9/package/debian-mingw64/copyright ncurses-5.9.patch/package/debian-mingw64/copyright ---- ncurses-5.9/package/debian-mingw64/copyright 1970-01-01 01:00:00.000000000 +0100 -+++ ncurses-5.9.patch/package/debian-mingw64/copyright 2014-09-01 16:33:22.519792399 +0200 -@@ -0,0 +1,112 @@ -+This package is used for testing builds of ncurses. -+ -+Copyright (c) 1998-2013,2014 Free Software Foundation, Inc. -+Copyright © 2001 by Pradeep Padala -+ -+Permission is hereby granted, free of charge, to any person obtaining a -+copy of this software and associated documentation files (the -+"Software"), to deal in the Software without restriction, including -+without limitation the rights to use, copy, modify, merge, publish, -+distribute, distribute with modifications, sublicense, and/or sell -+copies of the Software, and to permit persons to whom the Software is -+furnished to do so, subject to the following conditions: -+ -+The above copyright notice and this permission notice shall be included -+in all copies or substantial portions of the Software. -+ -+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -+IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -+DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -+OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR -+THE USE OR OTHER DEALINGS IN THE SOFTWARE. -+ -+Except as contained in this notice, the name(s) of the above copyright -+holders shall not be used in advertising or otherwise to promote the -+sale, use or other dealings in this Software without prior written -+authorization. -+ -+ -+Copyright (C) 1994 X Consortium -+ -+Permission is hereby granted, free of charge, to any person obtaining a copy -+of this software and associated documentation files (the "Software"), to -+deal in the Software without restriction, including without limitation the -+rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -+sell copies of the Software, and to permit persons to whom the Software is -+furnished to do so, subject to the following conditions: -+ -+The above copyright notice and this permission notice shall be included in -+all copies or substantial portions of the Software. -+ -+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -+X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- -+TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -+ -+Except as contained in this notice, the name of the X Consortium shall not -+be used in advertising or otherwise to promote the sale, use or other deal- -+ings in this Software without prior written authorization from the X Consor- -+tium. -+ -+ -+Copyright (c) 1980, 1991, 1992, 1993 -+ The Regents of the University of California. 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. -+3. Neither the name of the University nor the names of its contributors -+ may be used to endorse or promote products derived from this software -+ without specific prior written permission. -+ -+THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. -+ -+ -+Copyright 1996-2013,2014 by Thomas E. Dickey -+ -+ All Rights Reserved -+ -+Permission is hereby granted, free of charge, to any person obtaining a -+copy of this software and associated documentation files (the -+"Software"), to deal in the Software without restriction, including -+without limitation the rights to use, copy, modify, merge, publish, -+distribute, sublicense, and/or sell copies of the Software, and to -+permit persons to whom the Software is furnished to do so, subject to -+the following conditions: -+ -+The above copyright notice and this permission notice shall be included -+in all copies or substantial portions of the Software. -+ -+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -+IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY -+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -+ -+Except as contained in this notice, the name(s) of the above copyright -+holders shall not be used in advertising or otherwise to promote the -+sale, use or other dealings in this Software without prior written -+authorization. -+ -+-- vile: txtmode file-encoding=utf-8 -diff -Naur ncurses-5.9/package/debian-mingw64/rules ncurses-5.9.patch/package/debian-mingw64/rules ---- ncurses-5.9/package/debian-mingw64/rules 1970-01-01 01:00:00.000000000 +0100 -+++ ncurses-5.9.patch/package/debian-mingw64/rules 2014-09-01 16:34:19.472887057 +0200 -@@ -0,0 +1,132 @@ -+#!/usr/bin/make -f -+# Made with the aid of dh_make, by Craig Small -+# Sample debian/rules that uses debhelper. GNU copyright 1997 by Joey Hess. -+# Some lines taken from debmake, by Cristoph Lameter. -+ -+# Uncomment this to turn on verbose mode. -+#export DH_VERBOSE=1 -+ -+# These are used for cross-compiling and for saving the configure script -+# from having to guess our platform (since we know it already) -+DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) -+DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) -+ -+BUILD_CC = gcc -+ -+CC_NORMAL = -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wconversion -+CC_STRICT = $(CC_NORMAL) -W -Wbad-function-cast -Wcast-align -Wcast-qual -Wmissing-declarations -Wnested-externs -Wpointer-arith -Wwrite-strings -ansi -pedantic -+ -+TARGET = x86_64-w64-mingw32 -+MINGW_TOP = /usr/$(TARGET) -+MINGW_TMP = $(CURDIR)/debian/mingw64-ncurses6 -+ -+CFLAGS = $(CC_NORMAL) -+ -+CONFIG_OPTIONS = \ -+ --disable-echo \ -+ --disable-db-install \ -+ --disable-getcap \ -+ --disable-hard-tabs \ -+ --disable-leaks \ -+ --disable-macros \ -+ --disable-overwrite \ -+ --disable-termcap \ -+ --enable-const \ -+ --enable-ext-colors \ -+ --enable-ext-mouse \ -+ --enable-interop \ -+ --enable-sp-funcs \ -+ --enable-term-driver \ -+ --enable-warnings \ -+ --enable-widec \ -+ --verbose \ -+ --with-chtype=uint32_t \ -+ --with-mmask_t=uint32_t \ -+ --with-cxx-shared \ -+ --with-develop \ -+ --with-fallbacks=unknown,rxvt \ -+ --with-shared \ -+ --with-tparm-arg=intptr_t \ -+ --with-trace \ -+ --with-xterm-kbs=DEL \ -+ --without-ada \ -+ --without-debug \ -+ --without-manpages \ -+ --without-progs \ -+ --without-tests -+ -+export CFLAGS BUILD_CC -+ -+ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) -+ CFLAGS += -O0 -+else -+ CFLAGS += -O2 -+endif -+ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) -+ INSTALL_PROGRAM += -s -+endif -+ -+configure: configure-stamp -+configure-stamp: -+ dh_testdir -+ -+ CC=$(TARGET)-gcc \ -+ CFLAGS="$(CFLAGS)" \ -+ ./configure \ -+ --host=$(TARGET) \ -+ --target=$(TARGET) \ -+ --prefix=$(MINGW_TOP) \ -+ --with-build-cc=$(BUILD_CC) \ -+ $(CONFIG_OPTIONS) -+ -+ touch configure-stamp -+ -+build: build-stamp -+build-stamp: configure-stamp -+ dh_testdir -+ -+ $(MAKE) -+ -+ touch build-stamp -+ -+clean: -+ dh_testdir -+ dh_testroot -+ -+ [ ! -f makefile ] || $(MAKE) distclean -+ -+ rm -f configure-stamp build-stamp install-stamp -+ -+ dh_clean -+ -+install: install-stamp -+install-stamp: build-stamp -+ dh_testdir -+ dh_testroot -+ dh_clean -k -+ dh_installdirs -+ -+ $(MAKE) install.libs DESTDIR=$(MINGW_TMP) -+ -+ touch install-stamp -+ -+# Build architecture-independent files here. -+binary-indep: build install -+# No binary-indep target. -+ -+# Build architecture-dependent files here. -+binary-arch: build install -+ dh_testdir -+ dh_testroot -+ dh_installchangelogs NEWS -+ # dh_strip -+ dh_compress -+ dh_fixperms -+ dh_installdeb -+ dh_shlibdeps -+ dh_gencontrol -+ dh_md5sums -+ dh_builddeb -+ -+binary: binary-indep binary-arch -+.PHONY: build clean binary-indep binary-arch binary install install-stamp -diff -Naur ncurses-5.9/package/debian-mingw64/source/format ncurses-5.9.patch/package/debian-mingw64/source/format ---- ncurses-5.9/package/debian-mingw64/source/format 1970-01-01 01:00:00.000000000 +0100 -+++ ncurses-5.9.patch/package/debian-mingw64/source/format 2014-09-01 16:33:22.519792399 +0200 -@@ -0,0 +1 @@ -+3.0 (quilt) -diff -Naur ncurses-5.9/package/debian-mingw64/watch ncurses-5.9.patch/package/debian-mingw64/watch ---- ncurses-5.9/package/debian-mingw64/watch 1970-01-01 01:00:00.000000000 +0100 -+++ ncurses-5.9.patch/package/debian-mingw64/watch 2014-09-01 16:33:22.519792399 +0200 -@@ -0,0 +1,4 @@ -+version=3 -+ -+opts=passive ftp://invisible-island.net/ncurses/current/ncurses\.tar.gz \ -+ debian uupdate -diff -Naur ncurses-5.9/package/mingw-ncurses.nsi ncurses-5.9.patch/package/mingw-ncurses.nsi ---- ncurses-5.9/package/mingw-ncurses.nsi 1970-01-01 01:00:00.000000000 +0100 -+++ ncurses-5.9.patch/package/mingw-ncurses.nsi 2014-09-01 16:34:19.497887066 +0200 -@@ -0,0 +1,190 @@ -+; $Id: mingw-ncurses.nsi,v 1.33 2014/03/23 20:59:54 tom Exp $ -+ -+; TODO add examples -+; TODO bump ABI to 6 -+ -+; Define the application name -+!define APPNAME "ncurses" -+!define EXENAME "ncurses.exe" -+ -+!define VERSION_MAJOR "5" -+!define VERSION_MINOR "9" -+!define VERSION_YYYY "2014" -+!define VERSION_MMDD "0323" -+!define VERSION_PATCH ${VERSION_YYYY}${VERSION_MMDD} -+ -+!define MY_ABI "5" -+!define MY_MODEL "w" -+ -+!define SUBKEY "ncurses" -+ -+!define INSTALL "${APPNAME} (Console)" -+!define VERSION ${VERSION_MAJOR}.${VERSION_MINOR} -+!define VERSION_FULL ${VERSION}-${VERSION_PATCH} -+ -+; Main Install settings -+Name "${INSTALL}" -+InstallDir "c:\mingw" -+InstallDirRegKey HKLM "Software\${SUBKEY}" "$INSTDIR\bin" -+OutFile "NSIS-Output\${APPNAME}-${VERSION_FULL}-setup.exe" -+ -+CRCCheck on -+SetCompressor /SOLID lzma -+ -+VIAddVersionKey ProductName "${SUBKEY}" -+VIAddVersionKey CompanyName "http://invisible-island.net" -+VIAddVersionKey FileDescription "NCurses Installer (MinGW)" -+VIAddVersionKey FileVersion ${VERSION_FULL} -+VIAddVersionKey ProductVersion ${VERSION_FULL} -+VIAddVersionKey Comments "This installer was built with NSIS and cross-compiling to MinGW." -+VIAddVersionKey InternalName "${APPNAME}-${VERSION_FULL}-setup.exe" -+; This is a dotted set of numbers limited to 16-bits each -+VIProductVersion "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_YYYY}.${VERSION_MMDD}" -+ -+; Modern interface settings -+!include "MUI.nsh" -+ -+!define MUI_ABORTWARNING -+;!define MUI_FINISHPAGE_RUN -+;"$INSTDIR\bin\${EXENAME}" -+ -+!insertmacro MUI_PAGE_WELCOME -+!insertmacro MUI_PAGE_LICENSE "..\COPYING" -+!insertmacro MUI_PAGE_COMPONENTS -+!insertmacro MUI_PAGE_DIRECTORY -+!insertmacro MUI_PAGE_INSTFILES -+!insertmacro MUI_PAGE_FINISH -+ -+!insertmacro MUI_UNPAGE_CONFIRM -+!insertmacro MUI_UNPAGE_INSTFILES -+ -+; Set languages (first is default language) -+!insertmacro MUI_LANGUAGE "English" -+!insertmacro MUI_RESERVEFILE_LANGDLL -+ -+InstType "Full" ; SectionIn 1 -+InstType "Typical" ; SectionIn 2 -+InstType "Minimal" ; SectionIn 3 -+ -+Section "${APPNAME}" Section1 -+ -+ SectionIn 1 2 3 -+ -+ ; Set Section properties -+ SetOverwrite on -+ -+ ; Set Section Files and Shortcuts -+ SetOutPath "$INSTDIR\bin" -+ -+ File ".\bin\*.dll" -+ -+ SetOutPath "$INSTDIR\share\${APPNAME}" -+ File /oname=README.txt "..\README" -+ File /oname=README-mingw.txt "..\README.mingw" -+ -+ CreateDirectory "$SMPROGRAMS\${INSTALL}" -+ CreateShortCut "$SMPROGRAMS\${INSTALL}\${APPNAME}.lnk" "$INSTDIR\bin\${EXENAME}" -+ CreateShortCut "$SMPROGRAMS\${INSTALL}\Uninstall.lnk" "$INSTDIR\uninstall.exe" -+ -+SectionEnd -+ -+Section "development" Section2 -+ -+ SectionIn 1 2 -+ -+ ; Set Section properties -+ SetOverwrite on -+ -+ ; Set Section Files and Shortcuts -+ SetOutPath "$INSTDIR\share\${APPNAME}" -+ -+ SetOutPath "$INSTDIR\include\${APPNAME}${MY_MODEL}" -+ -+ File ".\include\${APPNAME}${MY_MODEL}\*.h" -+ -+ SetOutPath "$INSTDIR\lib" -+ -+ File ".\lib\*.a" -+ -+SectionEnd -+ -+Section "examples" Section3 -+ -+ SectionIn 1 -+ -+ ; Set Section properties -+ SetOverwrite on -+ -+ ; Set Section Files and Shortcuts -+ SetOutPath "$INSTDIR\lib\${APPNAME}" -+ -+SectionEnd -+ -+Section -FinishSection -+ -+ WriteRegStr HKLM "Software\${SUBKEY}" "" "$INSTDIR" -+ WriteRegStr HKLM "Software\${SUBKEY}" "Environment" "" -+ WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${INSTALL}" "DisplayName" "${APPNAME} ${VERSION_FULL} (Console)" -+ WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${INSTALL}" "UninstallString" "$INSTDIR\uninstall.exe" -+ WriteUninstaller "$INSTDIR\uninstall.exe" -+ -+SectionEnd -+ -+; Modern install component descriptions -+!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN -+ !insertmacro MUI_DESCRIPTION_TEXT ${Section1} "${SUBKEY} runtime" -+ !insertmacro MUI_DESCRIPTION_TEXT ${Section2} "Development headers and libraries" -+ !insertmacro MUI_DESCRIPTION_TEXT ${Section3} "Examples" -+!insertmacro MUI_FUNCTION_DESCRIPTION_END -+ -+;Uninstall section -+Section Uninstall -+ -+ ;Remove from registry... -+ DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${INSTALL}" -+ DeleteRegKey HKLM "SOFTWARE\${SUBKEY}" -+ -+ ; Delete self -+ Delete "$INSTDIR\uninstall.exe" -+ -+ ; Delete Shortcuts -+ Delete "$SMPROGRAMS\${INSTALL}\${APPNAME}.lnk" -+ Delete "$SMPROGRAMS\${INSTALL}\Uninstall.lnk" -+ -+ ; Clean up application -+ Delete "$INSTDIR\bin\libform${MY_MODEL}${MY_ABI}.dll" -+ Delete "$INSTDIR\bin\libmenu${MY_MODEL}${MY_ABI}.dll" -+ Delete "$INSTDIR\bin\libncurses++${MY_MODEL}${MY_ABI}.dll" -+ Delete "$INSTDIR\bin\libncurses${MY_MODEL}${MY_ABI}.dll" -+ Delete "$INSTDIR\bin\libpanel${MY_MODEL}${MY_ABI}.dll" -+ -+ Delete "$INSTDIR\include\${APPNAME}${MY_MODEL}\*.h" -+ -+ Delete "$INSTDIR\lib\libform${MY_MODEL}.a" -+ Delete "$INSTDIR\lib\libmenu${MY_MODEL}.a" -+ Delete "$INSTDIR\lib\libncurses++${MY_MODEL}.a" -+ Delete "$INSTDIR\lib\libncurses${MY_MODEL}.a" -+ Delete "$INSTDIR\lib\libpanel${MY_MODEL}.a" -+ -+ Delete "$INSTDIR\lib\libform${MY_MODEL}.dll.a" -+ Delete "$INSTDIR\lib\libmenu${MY_MODEL}.dll.a" -+ Delete "$INSTDIR\lib\libncurses++${MY_MODEL}.dll.a" -+ Delete "$INSTDIR\lib\libncurses${MY_MODEL}.dll.a" -+ Delete "$INSTDIR\lib\libpanel${MY_MODEL}.dll.a" -+ -+ Delete "$INSTDIR\lib\${APPNAME}\*.exe" -+ -+ Delete "$INSTDIR\share\${APPNAME}\*.*" -+ -+ ; Remove remaining directories -+ RMDir "$SMPROGRAMS\${INSTALL}" -+ RMDir "$INSTDIR\share\${APPNAME}" -+ RMDir "$INSTDIR\share" -+ RMDir "$INSTDIR\lib\${APPNAME}" -+ RMDir "$INSTDIR\lib" -+ RMDir "$INSTDIR\include\${APPNAME}${MY_MODEL}" -+ RMDir "$INSTDIR\include" -+ RMDir "$INSTDIR\bin" -+ RMDir "$INSTDIR\" -+ -+SectionEnd -\ Kein Zeilenumbruch am Dateiende. -diff -Naur ncurses-5.9/package/mingw-ncurses.spec ncurses-5.9.patch/package/mingw-ncurses.spec ---- ncurses-5.9/package/mingw-ncurses.spec 1970-01-01 01:00:00.000000000 +0100 -+++ ncurses-5.9.patch/package/mingw-ncurses.spec 2014-09-01 16:34:19.497887066 +0200 -@@ -0,0 +1,126 @@ -+%?mingw_package_header -+ -+Summary: shared libraries for terminal handling -+Name: mingw32-ncurses6 -+Version: 5.9 -+Release: 20140323 -+License: X11 -+Group: Development/Libraries -+Source: ncurses-%{version}-%{release}.tgz -+# URL: http://invisible-island.net/ncurses/ -+ -+BuildRequires: mingw32-filesystem >= 95 -+BuildRequires: mingw32-gcc -+BuildRequires: mingw32-binutils -+ -+BuildRequires: mingw64-filesystem >= 95 -+BuildRequires: mingw64-gcc -+BuildRequires: mingw64-binutils -+ -+%define CC_NORMAL -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wconversion -+%define CC_STRICT %{CC_NORMAL} -W -Wbad-function-cast -Wcast-align -Wcast-qual -Wmissing-declarations -Wnested-externs -Wpointer-arith -Wwrite-strings -ansi -pedantic -+ -+%description -n mingw32-ncurses6 -+Cross-compiling support for ncurses to mingw32. -+ -+The ncurses library routines are a terminal-independent method of -+updating character screens with reasonable optimization. -+ -+This package is used for testing ABI 6 with cross-compiles to MinGW. -+ -+%package -n mingw64-ncurses6 -+Summary: Curses library for MinGW64 -+ -+%description -n mingw64-ncurses6 -+Cross-compiling support for ncurses to mingw64. -+ -+The ncurses library routines are a terminal-independent method of -+updating character screens with reasonable optimization. -+ -+This package is used for testing ABI 6 with cross-compiles to MinGW. -+ -+%prep -+ -+%define CFG_OPTS \\\ -+ --disable-echo \\\ -+ --disable-db-install \\\ -+ --disable-getcap \\\ -+ --disable-hard-tabs \\\ -+ --disable-leaks \\\ -+ --disable-macros \\\ -+ --disable-overwrite \\\ -+ --disable-termcap \\\ -+ --enable-const \\\ -+ --enable-ext-colors \\\ -+ --enable-ext-mouse \\\ -+ --enable-interop \\\ -+ --enable-sp-funcs \\\ -+ --enable-term-driver \\\ -+ --enable-warnings \\\ -+ --enable-widec \\\ -+ --verbose \\\ -+ --with-cxx-shared \\\ -+ --with-develop \\\ -+ --with-fallbacks=unknown,rxvt \\\ -+ --with-shared \\\ -+ --with-tparm-arg=intptr_t \\\ -+ --with-trace \\\ -+ --with-xterm-kbs=DEL \\\ -+ --without-ada \\\ -+ --without-debug \\\ -+ --with-install-prefix=$RPM_BUILD_ROOT \\\ -+ --without-manpages \\\ -+ --without-progs \\\ -+ --without-tests -+ -+%define debug_package %{nil} -+%setup -q -n ncurses-%{version}-%{release} -+ -+%build -+mkdir BUILD-W32 -+pushd BUILD-W32 -+CFLAGS="%{CC_NORMAL}" \ -+CC=%{mingw32_cc} \ -+%mingw32_configure %{CFG_OPTS} -+make -+popd -+ -+mkdir BUILD-W64 -+pushd BUILD-W64 -+CFLAGS="%{CC_NORMAL}" \ -+CC=%{mingw64_cc} \ -+%mingw64_configure %{CFG_OPTS} -+make -+popd -+ -+%install -+rm -rf $RPM_BUILD_ROOT -+ -+pushd BUILD-W32 -+%{mingw32_make} install -+popd -+ -+pushd BUILD-W64 -+%{mingw64_make} install -+popd -+ -+%clean -+rm -rf $RPM_BUILD_ROOT -+ -+%files -+%defattr(-,root,root,-) -+ -+%files -n mingw32-ncurses6 -+%{mingw32_bindir}/* -+%{mingw32_includedir}/* -+%{mingw32_libdir}/* -+ -+%files -n mingw64-ncurses6 -+%{mingw64_bindir}/* -+%{mingw64_includedir}/* -+%{mingw64_libdir}/* -+ -+%changelog -+ -+* Sat Aug 03 2013 Thomas E. Dickey -+- initial version, using mingw-pdcurses package as a guide. -diff -Naur ncurses-5.9/package/ncurses.spec ncurses-5.9.patch/package/ncurses.spec ---- ncurses-5.9/package/ncurses.spec 1970-01-01 01:00:00.000000000 +0100 -+++ ncurses-5.9.patch/package/ncurses.spec 2014-09-01 16:34:19.498887062 +0200 -@@ -0,0 +1,94 @@ -+Summary: shared libraries for terminal handling -+Name: ncurses6 -+Version: 5.9 -+Release: 20140323 -+License: X11 -+Group: Development/Libraries -+Source: ncurses-%{version}-%{release}.tgz -+# URL: http://invisible-island.net/ncurses/ -+ -+%define CC_NORMAL -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wconversion -+%define CC_STRICT %{CC_NORMAL} -W -Wbad-function-cast -Wcast-align -Wcast-qual -Wmissing-declarations -Wnested-externs -Wpointer-arith -Wwrite-strings -ansi -pedantic -+ -+%define _prefix /usr/local/ncurses6 -+%define MYDATA /usr/local/ncurses/share/terminfo -+ -+%description -+The ncurses library routines are a terminal-independent method of -+updating character screens with reasonable optimization. -+ -+This package is used for testing ABI 6. -+ -+%prep -+ -+%define debug_package %{nil} -+%setup -q -n ncurses-%{version}-%{release} -+ -+%build -+CFLAGS="%{CC_NORMAL}" \ -+RPATH_LIST=../lib:%{_prefix}/lib \ -+%configure \ -+ --target %{_target_platform} \ -+ --prefix=%{_prefix} \ -+ --includedir='${prefix}/include' \ -+ --with-default-terminfo-dir=%{MYDATA} \ -+ --with-install-prefix=$RPM_BUILD_ROOT \ -+ --with-terminfo-dirs=%{MYDATA}:/usr/share/terminfo \ -+ --disable-echo \ -+ --disable-getcap \ -+ --disable-leaks \ -+ --disable-macros \ -+ --disable-overwrite \ -+ --disable-termcap \ -+ --enable-const \ -+ --enable-ext-colors \ -+ --enable-ext-mouse \ -+ --enable-hard-tabs \ -+ --enable-interop \ -+ --enable-rpath \ -+ --enable-sp-funcs \ -+ --enable-warnings \ -+ --enable-widec \ -+ --verbose \ -+ --with-chtype=uint32_t \ -+ --with-mmask_t=uint32_t \ -+ --with-develop \ -+ --with-shared \ -+ --with-termlib \ -+ --with-ticlib \ -+ --with-trace \ -+ --with-cxx-shared \ -+ --with-xterm-kbs=DEL \ -+ --without-ada \ -+ --without-debug \ -+ --without-normal -+ -+make -+ -+%install -+rm -rf $RPM_BUILD_ROOT -+ -+make install.libs install.progs -+rm -f test/ncurses -+( cd test && make ncurses LOCAL_LIBDIR=%{_libdir} && mv ncurses $RPM_BUILD_ROOT/%{_bindir}/ncurses6 ) -+ -+%clean -+rm -rf $RPM_BUILD_ROOT -+ -+%files -+%defattr(-,root,root,-) -+%{_bindir}/* -+%{_includedir}/* -+%{_libdir}/* -+#%{_datadir}/* -+ -+%changelog -+ -+* Sat Mar 09 2013 Thomas E. Dickey -+- add --with-cxx-shared option to demonstrate c++ binding as shared library -+ -+* Sat Oct 27 2012 Thomas E. Dickey -+- add ncurses program as "ncurses6" to provide demonstration. -+ -+* Fri Jun 08 2012 Thomas E. Dickey -+- initial version. -diff -Naur ncurses-5.9/panel/Makefile.in ncurses-5.9.patch/panel/Makefile.in ---- ncurses-5.9/panel/Makefile.in 2010-11-27 22:45:27.000000000 +0100 -+++ ncurses-5.9.patch/panel/Makefile.in 2014-09-01 16:33:22.520792399 +0200 -@@ -1,6 +1,6 @@ --# $Id: Makefile.in,v 1.58 2010/11/27 21:45:27 tom Exp $ -+# $Id: Makefile.in,v 1.62 2013/08/04 20:23:32 tom Exp $ - ############################################################################## --# Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. # -+# Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. # - # # - # Permission is hereby granted, free of charge, to any person obtaining a # - # copy of this software and associated documentation files (the "Software"), # -@@ -57,7 +57,11 @@ - bindir = @bindir@ - libdir = @libdir@ - includedir = @includedir@ -+datarootdir = @datarootdir@ - datadir = @datadir@ -+includesubdir = @includesubdir@ -+ -+INCLUDEDIR = $(DESTDIR)$(includedir)$(includesubdir) - - LIBTOOL = @LIBTOOL@ - LIBTOOL_CLEAN = @LIB_CLEAN@ -@@ -103,6 +107,7 @@ - SHLIB_DIRS = -L../lib - SHLIB_LIST = $(SHLIB_DIRS) -lncurses@LIB_SUFFIX@ @SHLIB_LIST@ - -+RPATH_LIST = @RPATH_LIST@ - MK_SHARED_LIB = @MK_SHARED_LIB@ - - NCURSES_MAJOR = @NCURSES_MAJOR@ -@@ -112,7 +117,7 @@ - - RANLIB = @LIB_PREP@ - --LIBRARIES = @LIBS_TO_MAKE@ -+LIBRARIES = @Libs_To_Make@ - - LINT = @LINT@ - LINT_OPTS = @LINT_OPTS@ -diff -Naur ncurses-5.9/panel/p_above.c ncurses-5.9.patch/panel/p_above.c ---- ncurses-5.9/panel/p_above.c 2010-01-23 22:22:15.000000000 +0100 -+++ ncurses-5.9.patch/panel/p_above.c 2014-09-01 16:33:22.520792399 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -36,13 +36,13 @@ - */ - #include "panel.priv.h" - --MODULE_ID("$Id: p_above.c,v 1.8 2010/01/23 21:22:15 tom Exp $") -+MODULE_ID("$Id: p_above.c,v 1.9 2012/03/10 23:43:41 tom Exp $") - - #if NCURSES_SP_FUNCS - NCURSES_EXPORT(PANEL *) - ground_panel(SCREEN * sp) - { -- T((T_CALLED("ground_panel(%p)"), sp)); -+ T((T_CALLED("ground_panel(%p)"), (void *)sp)); - if (sp) - { - struct panelhook *ph = NCURSES_SP_NAME(_nc_panelhook) (sp); -diff -Naur ncurses-5.9/panel/panel.c ncurses-5.9.patch/panel/panel.c ---- ncurses-5.9/panel/panel.c 2010-01-23 22:22:16.000000000 +0100 -+++ ncurses-5.9.patch/panel/panel.c 2014-09-01 16:33:22.520792399 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -36,7 +36,7 @@ - /* panel.c -- implementation of panels library, some core routines */ - #include "panel.priv.h" - --MODULE_ID("$Id: panel.c,v 1.25 2010/01/23 21:22:16 tom Exp $") -+MODULE_ID("$Id: panel.c,v 1.26 2012/02/23 10:02:15 tom Exp $") - - /*+------------------------------------------------------------------------- - _nc_retrace_panel (pan) -@@ -61,9 +61,9 @@ - char temp[32]; - - if (ptr != 0) -- sprintf(temp, "ptr:%p", ptr); -+ _nc_SPRINTF(temp, _nc_SLIMIT(sizeof(temp)) "ptr:%p", ptr); - else -- strcpy(temp, "<null>"); -+ _nc_STRCPY(temp, "<null>", sizeof(temp)); - return _nc_visbuf(temp); - } - #endif -@@ -95,7 +95,7 @@ - - GetPanelHook(pan); - -- sprintf(s80, fmt, num, pan); -+ _nc_SPRINTF(s80, _nc_SLIMIT(sizeof(s80)) fmt, num, pan); - _tracef("%s b=%s t=%s", s80, - (_nc_bottom_panel) ? USER_PTR(_nc_bottom_panel->user) : "--", - (_nc_top_panel) ? USER_PTR(_nc_top_panel->user) : "--"); -@@ -143,7 +143,7 @@ - { - char s80[80]; - -- sprintf(s80, "Touchline s=%d c=%d", start, count); -+ _nc_SPRINTF(s80, _nc_SLIMIT(sizeof(s80)) "Touchline s=%d c=%d", start, count); - dPanel(s80, pan); - touchline(pan->win, start, count); - } -diff -Naur ncurses-5.9/panel/panel.priv.h ncurses-5.9.patch/panel/panel.priv.h ---- ncurses-5.9/panel/panel.priv.h 2009-04-11 22:33:55.000000000 +0200 -+++ ncurses-5.9.patch/panel/panel.priv.h 2014-09-01 16:33:22.521792398 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2008,2009 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -26,7 +26,7 @@ - * authorization. * - ****************************************************************************/ - --/* $Id: panel.priv.h,v 1.23 2009/04/11 20:33:55 tom Exp $ */ -+/* $Id: panel.priv.h,v 1.25 2012/12/15 23:57:43 tom Exp $ */ - - #ifndef NCURSES_PANEL_PRIV_H - #define NCURSES_PANEL_PRIV_H 1 -@@ -89,7 +89,7 @@ - #define GetScreenHook(sp) \ - struct panelhook* ph = NCURSES_SP_NAME(_nc_panelhook)(sp) - #define GetPanelHook(pan) \ -- GetScreenHook(_nc_screen_of((pan)->win)) -+ GetScreenHook(pan ? _nc_screen_of((pan)->win) : 0) - #define GetWindowHook(win) \ - SCREEN* sp = _nc_screen_of(win); \ - GetScreenHook(sp) -@@ -160,7 +160,7 @@ - ---------------------------------------------------------------------------*/ - #define PANEL_UPDATE(pan,panstart)\ - { PANEL* pan2 = ((panstart) ? (panstart) : _nc_bottom_panel);\ -- while(pan2) {\ -+ while(pan2 && pan2->win) {\ - if ((pan2 != pan) && PANELS_OVERLAPPED(pan,pan2)) {\ - int y, ix1, ix2, iy1, iy2;\ - COMPUTE_INTERSECTION(pan, pan2, ix1, ix2, iy1, iy2);\ -diff -Naur ncurses-5.9/panel/p_below.c ncurses-5.9.patch/panel/p_below.c ---- ncurses-5.9/panel/p_below.c 2010-01-23 22:22:15.000000000 +0100 -+++ ncurses-5.9.patch/panel/p_below.c 2014-09-01 16:33:22.520792399 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -36,13 +36,13 @@ - */ - #include "panel.priv.h" - --MODULE_ID("$Id: p_below.c,v 1.8 2010/01/23 21:22:15 tom Exp $") -+MODULE_ID("$Id: p_below.c,v 1.9 2012/03/10 23:43:41 tom Exp $") - - #if NCURSES_SP_FUNCS - NCURSES_EXPORT(PANEL *) - ceiling_panel(SCREEN * sp) - { -- T((T_CALLED("ceiling_panel(%p)"), sp)); -+ T((T_CALLED("ceiling_panel(%p)"), (void *)sp)); - if (sp) - { - struct panelhook *ph = NCURSES_SP_NAME(_nc_panelhook) (sp); -diff -Naur ncurses-5.9/progs/capconvert ncurses-5.9.patch/progs/capconvert ---- ncurses-5.9/progs/capconvert 2006-04-22 23:46:17.000000000 +0200 -+++ ncurses-5.9.patch/progs/capconvert 2014-09-01 16:33:22.521792398 +0200 -@@ -1,6 +1,6 @@ - #!/bin/sh - ############################################################################## --# Copyright (c) 1998,2006 Free Software Foundation, Inc. # -+# Copyright (c) 1998-2006,2011 Free Software Foundation, Inc. # - # # - # Permission is hereby granted, free of charge, to any person obtaining a # - # copy of this software and associated documentation files (the "Software"), # -@@ -26,7 +26,7 @@ - # use or other dealings in this Software without prior written # - # authorization. # - ############################################################################## --# $Id: capconvert,v 1.4 2006/04/22 21:46:17 tom Exp $ -+# $Id: capconvert,v 1.5 2011/11/12 23:28:07 Robert.Millan Exp $ - # - # capconvert -- automated conversion from termcap to terminfo - # -@@ -77,16 +77,18 @@ - # Assumes the terminfo master covers all canned terminal types - exit; - fi -- if test "$TERM" = "xterm" -- then -+ case $TERM in -+ xterm | xterm-*) - echo "You are running xterm, which usually sets TERMCAP itself." - echo "We can ignore this, because terminfo knows about xterm." - echo "So you will just use the system-wide terminfo tree." -- exit; -- else -+ exit -+ ;; -+ *) - echo "We will have to make a local one for you anyway, to capture the effect" - echo "of your TERMCAP variable." -- fi -+ ;; -+ esac - else - echo "No system-wide terminfo tree. We will make you a local one." - fi -@@ -109,7 +111,7 @@ - for x in $PATH . - do - if test $OPT $x/tic -- then -+ then - TIC=$x/tic - break - fi -@@ -141,7 +143,7 @@ - then - echo "It appears you already have a private terminfo directory" - echo "at $HOME/.terminfo; this seems odd, because TERMINFO" -- echo "is not defined. I am not going to second-guess this -- if you" -+ echo "is not defined. I am not going to second-guess this -- if you" - echo "really want me to try auto-configuring for you, remove or" - echo "rename $HOME/terminfo and run me again." - exit; -@@ -214,7 +216,7 @@ - # - echo "You now have a private tree under $HOME/.terminfo;" - echo "the ncurses library will automatically read from it," --echo "and ncurses tic will automatically compile entries to it." -+echo "and ncurses tic will automatically compile entries to it." - - # We're done unless user has a .termcap file or equivalent named by TERMCAP - if test -z "$TERMCAP" -@@ -235,7 +237,7 @@ - echo "Done." - echo "Note that editing $HOME/.termcap will no longer change the data curses sees." - elif test -f "$TERMCAP" --then -+then - echo "Your TERMCAP names the file $TERMCAP. I will compile that." - eval $TIC $TERMCAP - echo "Done." -diff -Naur ncurses-5.9/progs/clear.c ncurses-5.9.patch/progs/clear.c ---- ncurses-5.9/progs/clear.c 2007-10-14 00:16:02.000000000 +0200 -+++ ncurses-5.9.patch/progs/clear.c 2014-09-01 16:33:22.521792398 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2006,2007 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2007,2013 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -39,7 +39,7 @@ - #define USE_LIBTINFO - #include <progs.priv.h> - --MODULE_ID("$Id: clear.c,v 1.11 2007/10/13 22:16:02 tom Exp $") -+MODULE_ID("$Id: clear.c,v 1.13 2013/06/22 22:20:54 tom Exp $") - - static int - putch(int c) -@@ -52,7 +52,15 @@ - int argc GCC_UNUSED, - char *argv[]GCC_UNUSED) - { -+ char *E3; -+ - setupterm((char *) 0, STDOUT_FILENO, (int *) 0); -+ -+ /* Clear the scrollback buffer if possible. */ -+ E3 = tigetstr("E3"); -+ if (E3) -+ (void) tputs(E3, lines > 0 ? lines : 1, putch); -+ - ExitProgram((tputs(clear_screen, lines > 0 ? lines : 1, putch) == ERR) - ? EXIT_FAILURE - : EXIT_SUCCESS); -diff -Naur ncurses-5.9/progs/dump_entry.c ncurses-5.9.patch/progs/dump_entry.c ---- ncurses-5.9/progs/dump_entry.c 2010-05-02 00:04:08.000000000 +0200 -+++ ncurses-5.9.patch/progs/dump_entry.c 2014-09-01 16:33:22.521792398 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2008,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -39,7 +39,7 @@ - #include "termsort.c" /* this C file is generated */ - #include <parametrized.h> /* so is this */ - --MODULE_ID("$Id: dump_entry.c,v 1.89 2010/05/01 22:04:08 tom Exp $") -+MODULE_ID("$Id: dump_entry.c,v 1.111 2013/12/15 01:05:20 tom Exp $") - - #define INDENT 8 - #define DISCARD(string) string = ABSENT_STRING -@@ -57,6 +57,7 @@ - static int outform; /* output format to use */ - static int sortmode; /* sort mode to use */ - static int width = 60; /* max line width for listings */ -+static int height = 65535; /* max number of lines for listings */ - static int column; /* current column, limited by 'width' */ - static int oldcol; /* last value of column before wrap */ - static bool pretty; /* true if we format if-then-else strings */ -@@ -72,7 +73,7 @@ - static NCURSES_CONST char *const *num_names; - static NCURSES_CONST char *const *str_names; - --static const char *separator, *trailer; -+static const char *separator = "", *trailer = ""; - - /* cover various ports and variants of terminfo */ - #define V_ALLCAPS 0 /* all capabilities (SVr4, XSI, ncurses) */ -@@ -99,6 +100,15 @@ - #define StrIndirect(j) ((sortmode == S_NOSORT) ? (j) : str_indirect[j]) - #endif - -+static void failed(const char *) GCC_NORETURN; -+ -+static void -+failed(const char *s) -+{ -+ perror(s); -+ ExitProgram(EXIT_FAILURE); -+} -+ - static void - strncpy_DYN(DYNBUF * dst, const char *src, size_t need) - { -@@ -106,6 +116,8 @@ - if (want > dst->size) { - dst->size += (want + 1024); /* be generous */ - dst->text = typeRealloc(char, dst->size, dst->text); -+ if (dst->text == 0) -+ failed("strncpy_DYN"); - } - (void) strncpy(dst->text + dst->used, src, need); - dst->used += need; -@@ -172,11 +184,17 @@ - } - - void --dump_init(const char *version, int mode, int sort, int twidth, int traceval, -+dump_init(const char *version, -+ int mode, -+ int sort, -+ int twidth, -+ int theight, -+ unsigned traceval, - bool formatted) - /* set up for entry display */ - { - width = twidth; -+ height = theight; - pretty = formatted; - - /* versions */ -@@ -201,7 +219,7 @@ - bool_names = boolnames; - num_names = numnames; - str_names = strnames; -- separator = twidth ? ", " : ","; -+ separator = (twidth > 0 && theight > 1) ? ", " : ","; - trailer = "\n\t"; - break; - -@@ -209,7 +227,7 @@ - bool_names = boolfnames; - num_names = numfnames; - str_names = strfnames; -- separator = twidth ? ", " : ","; -+ separator = (twidth > 0 && theight > 1) ? ", " : ","; - trailer = "\n\t"; - break; - -@@ -291,7 +309,11 @@ - static void set_obsolete_termcaps(TERMTYPE *tp); - - /* is this the index of a function key string? */ --#define FNKEY(i) (((i)<= 65 && (i)>= 75) || ((i)<= 216 && (i)>= 268)) -+#define FNKEY(i) \ -+ (((i) >= STR_IDX(key_f0) && \ -+ (i) <= STR_IDX(key_f9)) || \ -+ ((i) >= STR_IDX(key_f11) && \ -+ (i) <= STR_IDX(key_f63))) - - /* - * If we configure with a different Caps file, the offsets into the arrays -@@ -393,8 +415,8 @@ - static void - wrap_concat(const char *src) - { -- unsigned need = strlen(src); -- unsigned want = strlen(separator) + need; -+ size_t need = strlen(src); -+ size_t want = strlen(separator) + need; - - if (column > INDENT - && column + (int) want > width) { -@@ -445,7 +467,7 @@ - int n; - - for (n = 0; n < level; n++) -- strncpy_DYN(buffer, "\t", 1); -+ strncpy_DYN(buffer, "\t", (size_t) 1); - } - - static bool -@@ -458,9 +480,9 @@ - bool params = FALSE; - - for (n = 0; n < len - 1; ++n) { -- if (!strncmp(src + n, "%p", 2)) { -+ if (!strncmp(src + n, "%p", (size_t) 2)) { - params = TRUE; -- } else if (!strncmp(src + n, "%;", 2)) { -+ } else if (!strncmp(src + n, "%;", (size_t) 2)) { - ifthen = TRUE; - result = params; - break; -@@ -473,7 +495,7 @@ - } - - static char * --fmt_complex(char *src, int level) -+fmt_complex(TERMTYPE *tterm, const char *capability, char *src, int level) - { - bool percent = FALSE; - bool params = has_params(src); -@@ -482,7 +504,7 @@ - switch (*src) { - case '\\': - percent = FALSE; -- strncpy_DYN(&tmpbuf, src++, 1); -+ strncpy_DYN(&tmpbuf, src++, (size_t) 1); - break; - case '%': - percent = TRUE; -@@ -496,26 +518,28 @@ - /* treat a "%e" as else-if, on the same level */ - if (*src == 'e') { - indent_DYN(&tmpbuf, level); -- strncpy_DYN(&tmpbuf, "%", 1); -- strncpy_DYN(&tmpbuf, src, 1); -+ strncpy_DYN(&tmpbuf, "%", (size_t) 1); -+ strncpy_DYN(&tmpbuf, src, (size_t) 1); - src++; - params = has_params(src); - if (!params && *src != '\0' && *src != '%') { -- strncpy_DYN(&tmpbuf, "\n", 1); -+ strncpy_DYN(&tmpbuf, "\n", (size_t) 1); - indent_DYN(&tmpbuf, level + 1); - } - } else { - indent_DYN(&tmpbuf, level + 1); -- strncpy_DYN(&tmpbuf, "%", 1); -- strncpy_DYN(&tmpbuf, src, 1); -+ strncpy_DYN(&tmpbuf, "%", (size_t) 1); -+ strncpy_DYN(&tmpbuf, src, (size_t) 1); - if (*src++ == '?') { -- src = fmt_complex(src, level + 1); -+ src = fmt_complex(tterm, capability, src, level + 1); - if (*src != '\0' && *src != '%') { -- strncpy_DYN(&tmpbuf, "\n", 1); -+ strncpy_DYN(&tmpbuf, "\n", (size_t) 1); - indent_DYN(&tmpbuf, level + 1); - } - } else if (level == 1) { -- _nc_warning("%%%c without %%?", *src); -+ _nc_warning("%s: %%%c without %%? in %s", -+ _nc_first_name(tterm->term_names), -+ *src, capability); - } - } - continue; -@@ -527,31 +551,39 @@ - if (level > 1) { - tmpbuf.text[tmpbuf.used - 1] = '\n'; - indent_DYN(&tmpbuf, level); -- strncpy_DYN(&tmpbuf, "%", 1); -- strncpy_DYN(&tmpbuf, src++, 1); -+ strncpy_DYN(&tmpbuf, "%", (size_t) 1); -+ strncpy_DYN(&tmpbuf, src++, (size_t) 1); -+ if (src[0] == '%' -+ && src[1] != '\0' -+ && (strchr("?e;", src[1])) == 0) { -+ tmpbuf.text[tmpbuf.used++] = '\n'; -+ indent_DYN(&tmpbuf, level); -+ } - return src; - } -- _nc_warning("%%; without %%?"); -+ _nc_warning("%s: %%; without %%? in %s", -+ _nc_first_name(tterm->term_names), -+ capability); - } - break; - case 'p': - if (percent && params) { - tmpbuf.text[tmpbuf.used - 1] = '\n'; - indent_DYN(&tmpbuf, level + 1); -- strncpy_DYN(&tmpbuf, "%", 1); -+ strncpy_DYN(&tmpbuf, "%", (size_t) 1); - } - params = FALSE; - percent = FALSE; - break; - case ' ': -- strncpy_DYN(&tmpbuf, "\\s", 2); -+ strncpy_DYN(&tmpbuf, "\\s", (size_t) 2); - ++src; - continue; - default: - percent = FALSE; - break; - } -- strncpy_DYN(&tmpbuf, src++, 1); -+ strncpy_DYN(&tmpbuf, src++, (size_t) 1); - } - return src; - } -@@ -562,9 +594,9 @@ - int - fmt_entry(TERMTYPE *tterm, - PredFunc pred, -- bool content_only, -- bool suppress_untranslatable, -- bool infodump, -+ int content_only, -+ int suppress_untranslatable, -+ int infodump, - int numbers) - { - PredIdx i, j; -@@ -593,14 +625,28 @@ - column = INDENT; /* FIXME: workaround to prevent empty lines */ - } else { - strcpy_DYN(&outbuf, tterm->term_names); -+ -+ /* -+ * Colon is legal in terminfo descriptions, but not in termcap. -+ */ -+ if (!infodump) { -+ char *p = outbuf.text; -+ while (*p) { -+ if (*p == ':') { -+ *p = '='; -+ } -+ ++p; -+ } -+ } - strcpy_DYN(&outbuf, separator); - column = (int) outbuf.used; -- force_wrap(); -+ if (height > 1) -+ force_wrap(); - } - - for_each_boolean(j, tterm) { - i = BoolIndirect(j); -- name = ExtBoolname(tterm, i, bool_names); -+ name = ExtBoolname(tterm, (int) i, bool_names); - assert(strlen(name) < sizeof(buffer) - EXTRA_CAP); - - if (!version_filter(BOOLEAN, i)) -@@ -610,21 +656,21 @@ - - predval = pred(BOOLEAN, i); - if (predval != FAIL) { -- (void) strcpy(buffer, name); -+ _nc_STRCPY(buffer, name, sizeof(buffer)); - if (predval <= 0) -- (void) strcat(buffer, "@"); -+ _nc_STRCAT(buffer, "@", sizeof(buffer)); - else if (i + 1 > num_bools) - num_bools = i + 1; - WRAP_CONCAT; - } - } - -- if (column != INDENT) -+ if (column != INDENT && height > 1) - force_wrap(); - - for_each_number(j, tterm) { - i = NumIndirect(j); -- name = ExtNumname(tterm, i, num_names); -+ name = ExtNumname(tterm, (int) i, num_names); - assert(strlen(name) < sizeof(buffer) - EXTRA_CAP); - - if (!version_filter(NUMBER, i)) -@@ -635,9 +681,11 @@ - predval = pred(NUMBER, i); - if (predval != FAIL) { - if (tterm->Numbers[i] < 0) { -- sprintf(buffer, "%s@", name); -+ _nc_SPRINTF(buffer, _nc_SLIMIT(sizeof(buffer)) -+ "%s@", name); - } else { -- sprintf(buffer, "%s#%d", name, tterm->Numbers[i]); -+ _nc_SPRINTF(buffer, _nc_SLIMIT(sizeof(buffer)) -+ "%s#%d", name, tterm->Numbers[i]); - if (i + 1 > num_values) - num_values = i + 1; - } -@@ -645,7 +693,7 @@ - } - } - -- if (column != INDENT) -+ if (column != INDENT && height > 1) - force_wrap(); - - len += (int) (num_bools -@@ -670,7 +718,7 @@ - - for_each_string(j, tterm) { - i = StrIndirect(j); -- name = ExtStrname(tterm, i, str_names); -+ name = ExtStrname(tterm, (int) i, str_names); - assert(strlen(name) < sizeof(buffer) - EXTRA_CAP); - - capability = tterm->Strings[i]; -@@ -698,14 +746,14 @@ - if (PRESENT(insert_character) || PRESENT(parm_ich)) { - if (SAME_CAP(i, enter_insert_mode) - && enter_insert_mode == ABSENT_STRING) { -- (void) strcpy(buffer, "im="); -+ _nc_STRCPY(buffer, "im=", sizeof(buffer)); - WRAP_CONCAT; - continue; - } - - if (SAME_CAP(i, exit_insert_mode) - && exit_insert_mode == ABSENT_STRING) { -- (void) strcpy(buffer, "ei="); -+ _nc_STRCPY(buffer, "ei=", sizeof(buffer)); - WRAP_CONCAT; - continue; - } -@@ -739,7 +787,8 @@ - num_strings = i + 1; - - if (!VALID_STRING(capability)) { -- sprintf(buffer, "%s@", name); -+ _nc_SPRINTF(buffer, _nc_SLIMIT(sizeof(buffer)) -+ "%s@", name); - WRAP_CONCAT; - } else if (outform == F_TERMCAP || outform == F_TCONVERR) { - int params = ((i < (int) SIZEOF(parametrized)) -@@ -750,13 +799,14 @@ - - if (cv == 0) { - if (outform == F_TCONVERR) { -- sprintf(buffer, "%s=!!! %s WILL NOT CONVERT !!!", -- name, srccap); -+ _nc_SPRINTF(buffer, _nc_SLIMIT(sizeof(buffer)) -+ "%s=!!! %s WILL NOT CONVERT !!!", -+ name, srccap); - } else if (suppress_untranslatable) { - continue; - } else { - char *s = srccap, *d = buffer; -- sprintf(d, "..%s=", name); -+ _nc_SPRINTF(d, _nc_SLIMIT(sizeof(buffer)) "..%s=", name); - d += strlen(d); - while ((*d = *s++) != 0) { - if (*d == ':') { -@@ -769,7 +819,8 @@ - } - } - } else { -- sprintf(buffer, "%s=%s", name, cv); -+ _nc_SPRINTF(buffer, _nc_SLIMIT(sizeof(buffer)) -+ "%s=%s", name, cv); - } - len += (int) strlen(capability) + 1; - WRAP_CONCAT; -@@ -783,7 +834,7 @@ - if (pretty - && (outform == F_TERMINFO - || outform == F_VARIABLE)) { -- fmt_complex(src, 1); -+ fmt_complex(tterm, name, src, 1); - } else { - strcpy_DYN(&tmpbuf, src); - } -@@ -793,7 +844,9 @@ - } - } - /* e.g., trimmed_sgr0 */ -- if (capability != tterm->Strings[i]) -+ if (capability != ABSENT_STRING && -+ capability != CANCELLED_STRING && -+ capability != tterm->Strings[i]) - free(capability); - } - len += (int) (num_strings * 2); -@@ -805,11 +858,13 @@ - */ - if (tversion == V_HPUX) { - if (VALID_STRING(memory_lock)) { -- (void) sprintf(buffer, "meml=%s", memory_lock); -+ _nc_SPRINTF(buffer, _nc_SLIMIT(sizeof(buffer)) -+ "meml=%s", memory_lock); - WRAP_CONCAT; - } - if (VALID_STRING(memory_unlock)) { -- (void) sprintf(buffer, "memu=%s", memory_unlock); -+ _nc_SPRINTF(buffer, _nc_SLIMIT(sizeof(buffer)) -+ "memu=%s", memory_unlock); - WRAP_CONCAT; - } - } else if (tversion == V_AIX) { -@@ -821,7 +876,7 @@ - - tp = boxchars; - for (cp = acstrans; *cp; cp++) { -- sp = strchr(acs_chars, *cp); -+ sp = (strchr) (acs_chars, *cp); - if (sp) - *tp++ = sp[1]; - else { -@@ -832,9 +887,41 @@ - tp[0] = '\0'; - - if (box_ok) { -- (void) strcpy(buffer, "box1="); -- (void) strcat(buffer, _nc_tic_expand(boxchars, -- outform == F_TERMINFO, numbers)); -+ char *tmp = _nc_tic_expand(boxchars, -+ (outform == F_TERMINFO), -+ numbers); -+ _nc_STRCPY(buffer, "box1=", sizeof(buffer)); -+ while (*tmp != '\0') { -+ size_t have = strlen(buffer); -+ size_t next = strlen(tmp); -+ size_t want = have + next + 1; -+ size_t last = next; -+ char save = '\0'; -+ -+ /* -+ * If the expanded string is too long for the buffer, -+ * chop it off and save the location where we chopped it. -+ */ -+ if (want >= sizeof(buffer)) { -+ save = tmp[last]; -+ tmp[last] = '\0'; -+ } -+ _nc_STRCAT(buffer, tmp, sizeof(buffer)); -+ -+ /* -+ * If we chopped the buffer, replace the missing piece and -+ * shift everything to append the remainder. -+ */ -+ if (save != '\0') { -+ next = 0; -+ tmp[last] = save; -+ while ((tmp[next] = tmp[last + next]) != '\0') { -+ ++next; -+ } -+ } else { -+ break; -+ } -+ } - WRAP_CONCAT; - } - } -@@ -846,7 +933,7 @@ - */ - if (outcount) { - bool trimmed = FALSE; -- j = outbuf.used; -+ j = (PredIdx) outbuf.used; - if (j >= 2 - && outbuf.text[j - 1] == '\t' - && outbuf.text[j - 2] == '\n') { -@@ -926,7 +1013,7 @@ - char name[10]; - - for (n = 0; n <= 10; ++n) { -- sprintf(name, "lf%d", n); -+ _nc_SPRINTF(name, _nc_SLIMIT(sizeof(name)) "lf%d", n); - if ((cap = find_string(tterm, name)) != ABSENT_STRING - && kill_string(tterm, cap)) { - target -= (int) (strlen(cap) + 5); -@@ -951,7 +1038,7 @@ - char name[10]; - - for (n = 60; n >= 0; --n) { -- sprintf(name, "kf%d", n); -+ _nc_SPRINTF(name, _nc_SLIMIT(sizeof(name)) "kf%d", n); - if ((cap = find_string(tterm, name)) != ABSENT_STRING - && kill_string(tterm, cap)) { - target -= (int) (strlen(cap) + 5); -@@ -1017,8 +1104,8 @@ - */ - void - dump_entry(TERMTYPE *tterm, -- bool suppress_untranslatable, -- bool limited, -+ int suppress_untranslatable, -+ int limited, - int numbers, - PredFunc pred) - { -@@ -1064,7 +1151,7 @@ - */ - unsigned n; - for (n = STRCOUNT; n < NUM_STRINGS(tterm); n++) { -- const char *name = ExtStrname(tterm, n, strnames); -+ const char *name = ExtStrname(tterm, (int) n, strnames); - - if (VALID_STRING(tterm->Strings[n])) { - set_attributes = ABSENT_STRING; -@@ -1144,21 +1231,45 @@ - - if (outform == F_TERMCAP || outform == F_TCONVERR) - trim_trailing(); -- (void) sprintf(buffer, "%s%s", infodump ? "use=" : "tc=", name); -+ _nc_SPRINTF(buffer, _nc_SLIMIT(sizeof(buffer)) -+ "%s%s", infodump ? "use=" : "tc=", name); - wrap_concat(buffer); - } - - int - show_entry(void) - { -- trim_trailing(); -+ /* -+ * Trim any remaining whitespace. -+ */ -+ if (outbuf.used != 0) { -+ bool infodump = (outform != F_TERMCAP && outform != F_TCONVERR); -+ char delim = (char) (infodump ? ',' : ':'); -+ int j; -+ -+ for (j = (int) outbuf.used - 1; j > 0; --j) { -+ char ch = outbuf.text[j]; -+ if (ch == '\n') { -+ ; -+ } else if (isspace(UChar(ch))) { -+ outbuf.used = (size_t) j; -+ } else if (!infodump && ch == '\\') { -+ outbuf.used = (size_t) j; -+ } else if (ch == delim && (j == 0 || outbuf.text[j - 1] != '\\')) { -+ outbuf.used = (size_t) (j + 1); -+ } else { -+ break; -+ } -+ } -+ outbuf.text[outbuf.used] = '\0'; -+ } - (void) fputs(outbuf.text, stdout); - putchar('\n'); - return (int) outbuf.used; - } - - void --compare_entry(void (*hook) (PredType t, PredIdx i, const char *name), -+compare_entry(PredHook hook, - TERMTYPE *tp GCC_UNUSED, - bool quiet) - /* compare two entries */ -@@ -1170,7 +1281,7 @@ - fputs(" comparing booleans.\n", stdout); - for_each_boolean(j, tp) { - i = BoolIndirect(j); -- name = ExtBoolname(tp, i, bool_names); -+ name = ExtBoolname(tp, (int) i, bool_names); - - if (isObsolete(outform, name)) - continue; -@@ -1182,7 +1293,7 @@ - fputs(" comparing numbers.\n", stdout); - for_each_number(j, tp) { - i = NumIndirect(j); -- name = ExtNumname(tp, i, num_names); -+ name = ExtNumname(tp, (int) i, num_names); - - if (isObsolete(outform, name)) - continue; -@@ -1194,7 +1305,7 @@ - fputs(" comparing strings.\n", stdout); - for_each_string(j, tp) { - i = StrIndirect(j); -- name = ExtStrname(tp, i, str_names); -+ name = ExtStrname(tp, (int) i, str_names); - - if (isObsolete(outform, name)) - continue; -diff -Naur ncurses-5.9/progs/dump_entry.h ncurses-5.9.patch/progs/dump_entry.h ---- ncurses-5.9/progs/dump_entry.h 2008-07-12 22:23:03.000000000 +0200 -+++ ncurses-5.9.patch/progs/dump_entry.h 2014-09-01 16:33:22.522792397 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2006,2008 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2011,2013 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -32,9 +32,8 @@ - * and: Thomas E. Dickey 1996-on * - ****************************************************************************/ - -- - /* -- * $Id: dump_entry.h,v 1.30 2008/07/12 20:23:03 tom Exp $ -+ * $Id: dump_entry.h,v 1.33 2013/12/15 01:08:03 tom Exp $ - * - * Dump control definitions and variables - */ -@@ -64,16 +63,17 @@ - - typedef unsigned PredType; - typedef unsigned PredIdx; --typedef int (*PredFunc)(PredType, PredIdx); -+typedef int (*PredFunc) (PredType, PredIdx); -+typedef void (*PredHook) (PredType, PredIdx, const char *); - - extern NCURSES_CONST char *nametrans(const char *); --extern int fmt_entry(TERMTYPE *, PredFunc, bool, bool, bool, int); -+extern int fmt_entry(TERMTYPE *, PredFunc, int, int, int, int); - extern int show_entry(void); --extern void compare_entry(void (*)(PredType, PredIdx, const char *), TERMTYPE *, bool); --extern void dump_entry(TERMTYPE *, bool, bool, int, PredFunc); --extern void dump_init(const char *, int, int, int, int, bool); -+extern void compare_entry(PredHook, TERMTYPE *, bool); -+extern void dump_entry(TERMTYPE *, int, int, int, PredFunc); -+extern void dump_init(const char *, int, int, int, int, unsigned, bool); - extern void dump_uses(const char *, bool); --extern void repair_acsc(TERMTYPE * tp); -+extern void repair_acsc(TERMTYPE *tp); - - #define FAIL -1 - -diff -Naur ncurses-5.9/progs/infocmp.c ncurses-5.9.patch/progs/infocmp.c ---- ncurses-5.9/progs/infocmp.c 2010-05-02 00:04:08.000000000 +0200 -+++ ncurses-5.9.patch/progs/infocmp.c 2014-09-01 16:33:22.522792397 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2013,2014 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -42,7 +42,7 @@ - - #include <dump_entry.h> - --MODULE_ID("$Id: infocmp.c,v 1.105 2010/05/01 22:04:08 tom Exp $") -+MODULE_ID("$Id: infocmp.c,v 1.129 2014/02/01 22:11:03 tom Exp $") - - #define L_CURL "{" - #define R_CURL "}" -@@ -70,8 +70,9 @@ - static const char *s_absent = "NULL"; - static const char *s_cancel = "NULL"; - static const char *tversion; /* terminfo version selected */ --static int itrace; /* trace flag for debugging */ -+static unsigned itrace; /* trace flag for debugging */ - static int mwidth = 60; -+static int mheight = 65535; - static int numbers = 0; /* format "%'char'" to/from "%{number}" */ - static int outform = F_TERMINFO; /* output format */ - static int sortmode; /* sort_mode */ -@@ -86,27 +87,52 @@ - static bool ignorepads; /* ignore pad prefixes when diffing */ - - #if NO_LEAKS -+ -+typedef struct { -+ ENTRY *head; -+ ENTRY *tail; -+} ENTERED; -+ -+static ENTERED *entered; -+ - #undef ExitProgram - static void ExitProgram(int code) GCC_NORETURN; - /* prototype is to get gcc to accept the noreturn attribute */ - static void - ExitProgram(int code) - { -- while (termcount-- > 0) -- _nc_free_termtype(&entries[termcount].tterm); -+ int n; -+ -+ for (n = 0; n < termcount; ++n) { -+ ENTRY *new_head = _nc_head; -+ ENTRY *new_tail = _nc_tail; -+ _nc_head = entered[n].head; -+ _nc_tail = entered[n].tail; -+ _nc_free_entries(entered[n].head); -+ _nc_head = new_head; -+ _nc_tail = new_tail; -+ } - _nc_leaks_dump_entry(); - free(entries); -+ free(entered); - _nc_free_tic(code); - } - #endif - -+static void -+failed(const char *s) -+{ -+ perror(s); -+ ExitProgram(EXIT_FAILURE); -+} -+ - static char * - canonical_name(char *ptr, char *buf) - /* extract the terminal type's primary name */ - { - char *bp; - -- (void) strcpy(buf, ptr); -+ _nc_STRCPY(buf, ptr, NAMESIZE); - if ((bp = strchr(buf, '|')) != 0) - *bp = '\0'; - -@@ -307,13 +333,13 @@ - { - switch (val) { - case ABSENT_NUMERIC: -- strcpy(buf, s_absent); -+ _nc_STRCPY(buf, s_absent, MAX_STRING); - break; - case CANCELLED_NUMERIC: -- strcpy(buf, s_cancel); -+ _nc_STRCPY(buf, s_cancel, MAX_STRING); - break; - default: -- sprintf(buf, "%d", val); -+ _nc_SPRINTF(buf, _nc_SLIMIT(MAX_STRING) "%d", val); - break; - } - } -@@ -323,31 +349,94 @@ - /* display the value of a string capability */ - { - if (val == ABSENT_STRING) -- strcpy(buf, s_absent); -+ _nc_STRCPY(buf, s_absent, MAX_STRING); - else if (val == CANCELLED_STRING) -- strcpy(buf, s_cancel); -+ _nc_STRCPY(buf, s_cancel, MAX_STRING); - else { -- sprintf(buf, "'%.*s'", MAX_STRING - 3, TIC_EXPAND(val)); -+ _nc_SPRINTF(buf, _nc_SLIMIT(MAX_STRING) -+ "'%.*s'", MAX_STRING - 3, TIC_EXPAND(val)); - } - } - -+/* -+ * Show "comparing..." message for the given terminal names. -+ */ -+static void -+show_comparing(char **names) -+{ -+ if (itrace) { -+ switch (compare) { -+ case C_DIFFERENCE: -+ (void) fprintf(stderr, "%s: dumping differences\n", _nc_progname); -+ break; -+ -+ case C_COMMON: -+ (void) fprintf(stderr, "%s: dumping common capabilities\n", _nc_progname); -+ break; -+ -+ case C_NAND: -+ (void) fprintf(stderr, "%s: dumping differences\n", _nc_progname); -+ break; -+ } -+ } -+ if (*names) { -+ printf("comparing %s", *names++); -+ if (*names) { -+ printf(" to %s", *names++); -+ while (*names) { -+ printf(", %s", *names++); -+ } -+ } -+ printf(".\n"); -+ } -+} -+ -+/* -+ * ncurses stores two types of non-standard capabilities: -+ * a) capabilities listed past the "STOP-HERE" comment in the Caps file. -+ * These are used in the terminfo source file to provide data for termcaps, -+ * e.g., when there is no equivalent capability in terminfo, as well as for -+ * widely-used non-standard capabilities. -+ * b) user-definable capabilities, via "tic -x". -+ * -+ * However, if "-x" is omitted from the tic command, both types of -+ * non-standard capability are not loaded into the terminfo database. This -+ * macro is used for limit-checks against the symbols that tic uses to omit -+ * the two types of non-standard entry. -+ */ -+#if NCURSES_XNAMES -+#define check_user_definable(n,limit) if (!_nc_user_definable && (n) > (limit)) break -+#else -+#define check_user_definable(n,limit) if ((n) > (limit)) break -+#endif -+ -+/* -+ * Use these macros to simplify loops on C_COMMON and C_NAND: -+ */ -+#define for_each_entry() while (entries[extra].tterm.term_names) -+#define next_entry (&(entries[extra++].tterm)) -+ - static void - compare_predicate(PredType type, PredIdx idx, const char *name) - /* predicate function to use for entry difference reports */ - { -- register ENTRY *e1 = &entries[0]; -- register ENTRY *e2 = &entries[1]; -- char buf1[MAX_STRING], buf2[MAX_STRING]; -+ ENTRY *e1 = &entries[0]; -+ ENTRY *e2 = &entries[1]; -+ char buf1[MAX_STRING]; -+ char buf2[MAX_STRING]; - int b1, b2; - int n1, n2; - char *s1, *s2; -+ bool found; -+ int extra = 1; - - switch (type) { - case CMP_BOOLEAN: -+ check_user_definable(idx, BOOLWRITE); - b1 = e1->tterm.Booleans[idx]; -- b2 = e2->tterm.Booleans[idx]; - switch (compare) { - case C_DIFFERENCE: -+ b2 = next_entry->Booleans[idx]; - if (!(b1 == ABSENT_BOOLEAN && b2 == ABSENT_BOOLEAN) && b1 != b2) - (void) printf("\t%s: %s%s%s.\n", - name, -@@ -357,45 +446,93 @@ - break; - - case C_COMMON: -- if (b1 == b2 && b1 != ABSENT_BOOLEAN) -- (void) printf("\t%s= %s.\n", name, dump_boolean(b1)); -+ if (b1 != ABSENT_BOOLEAN) { -+ found = TRUE; -+ for_each_entry() { -+ b2 = next_entry->Booleans[idx]; -+ if (b1 != b2) { -+ found = FALSE; -+ break; -+ } -+ } -+ if (found) { -+ (void) printf("\t%s= %s.\n", name, dump_boolean(b1)); -+ } -+ } - break; - - case C_NAND: -- if (b1 == ABSENT_BOOLEAN && b2 == ABSENT_BOOLEAN) -- (void) printf("\t!%s.\n", name); -+ if (b1 == ABSENT_BOOLEAN) { -+ found = TRUE; -+ for_each_entry() { -+ b2 = next_entry->Booleans[idx]; -+ if (b1 != b2) { -+ found = FALSE; -+ break; -+ } -+ } -+ if (found) { -+ (void) printf("\t!%s.\n", name); -+ } -+ } - break; - } - break; - - case CMP_NUMBER: -+ check_user_definable(idx, NUMWRITE); - n1 = e1->tterm.Numbers[idx]; -- n2 = e2->tterm.Numbers[idx]; -- dump_numeric(n1, buf1); -- dump_numeric(n2, buf2); - switch (compare) { - case C_DIFFERENCE: -- if (!((n1 == ABSENT_NUMERIC && n2 == ABSENT_NUMERIC)) && n1 != n2) -+ n2 = next_entry->Numbers[idx]; -+ if (!((n1 == ABSENT_NUMERIC && n2 == ABSENT_NUMERIC)) && n1 != n2) { -+ dump_numeric(n1, buf1); -+ dump_numeric(n2, buf2); - (void) printf("\t%s: %s, %s.\n", name, buf1, buf2); -+ } - break; - - case C_COMMON: -- if (n1 != ABSENT_NUMERIC && n2 != ABSENT_NUMERIC && n1 == n2) -- (void) printf("\t%s= %s.\n", name, buf1); -+ if (n1 != ABSENT_NUMERIC) { -+ found = TRUE; -+ for_each_entry() { -+ n2 = next_entry->Numbers[idx]; -+ if (n1 != n2) { -+ found = FALSE; -+ break; -+ } -+ } -+ if (found) { -+ dump_numeric(n1, buf1); -+ (void) printf("\t%s= %s.\n", name, buf1); -+ } -+ } - break; - - case C_NAND: -- if (n1 == ABSENT_NUMERIC && n2 == ABSENT_NUMERIC) -- (void) printf("\t!%s.\n", name); -+ if (n1 == ABSENT_NUMERIC) { -+ found = TRUE; -+ for_each_entry() { -+ n2 = next_entry->Numbers[idx]; -+ if (n1 != n2) { -+ found = FALSE; -+ break; -+ } -+ } -+ if (found) { -+ (void) printf("\t!%s.\n", name); -+ } -+ } - break; - } - break; - - case CMP_STRING: -+ check_user_definable(idx, STRWRITE); - s1 = e1->tterm.Strings[idx]; -- s2 = e2->tterm.Strings[idx]; - switch (compare) { - case C_DIFFERENCE: -+ s2 = next_entry->Strings[idx]; - if (capcmp(idx, s1, s2)) { - dump_string(s1, buf1); - dump_string(s2, buf2); -@@ -405,13 +542,35 @@ - break; - - case C_COMMON: -- if (s1 && s2 && !capcmp(idx, s1, s2)) -- (void) printf("\t%s= '%s'.\n", name, TIC_EXPAND(s1)); -+ if (s1 != ABSENT_STRING) { -+ found = TRUE; -+ for_each_entry() { -+ s2 = next_entry->Strings[idx]; -+ if (capcmp(idx, s1, s2) != 0) { -+ found = FALSE; -+ break; -+ } -+ } -+ if (found) { -+ (void) printf("\t%s= '%s'.\n", name, TIC_EXPAND(s1)); -+ } -+ } - break; - - case C_NAND: -- if (!s1 && !s2) -- (void) printf("\t!%s.\n", name); -+ if (s1 == ABSENT_STRING) { -+ found = TRUE; -+ for_each_entry() { -+ s2 = next_entry->Strings[idx]; -+ if (s2 != s1) { -+ found = FALSE; -+ break; -+ } -+ } -+ if (found) { -+ (void) printf("\t!%s.\n", name); -+ } -+ } - break; - } - break; -@@ -430,16 +589,37 @@ - break; - - case C_COMMON: -- if (e1->nuses && e2->nuses && useeq(e1, e2)) { -- (void) fputs("\tuse: ", stdout); -- print_uses(e1, stdout); -- fputs(".\n", stdout); -+ if (e1->nuses) { -+ found = TRUE; -+ for_each_entry() { -+ e2 = &entries[extra++]; -+ if (e2->nuses != e1->nuses || !useeq(e1, e2)) { -+ found = FALSE; -+ break; -+ } -+ } -+ if (found) { -+ (void) fputs("\tuse: ", stdout); -+ print_uses(e1, stdout); -+ fputs(".\n", stdout); -+ } - } - break; - - case C_NAND: -- if (!e1->nuses && !e2->nuses) -- (void) printf("\t!use.\n"); -+ if (!e1->nuses) { -+ found = TRUE; -+ for_each_entry() { -+ e2 = &entries[extra++]; -+ if (e2->nuses != e1->nuses) { -+ found = FALSE; -+ break; -+ } -+ } -+ if (found) { -+ (void) printf("\t!use.\n"); -+ } -+ } - break; - } - } -@@ -556,7 +736,7 @@ - } - - static bool --same_param(const char *table, const char *param, unsigned length) -+same_param(const char *table, const char *param, size_t length) - { - bool result = FALSE; - if (strncmp(table, param, length) == 0) { -@@ -581,15 +761,15 @@ - size_t tlen = strlen(ap->from); - - if (same_param(ap->from, ep, tlen)) { -- (void) strcat(dst, ap->to); -+ _nc_STRCAT(dst, ap->to, MAX_TERMINFO_LENGTH); - found = TRUE; - break; - } - } - - if (!found) -- (void) strcat(dst, ep); -- (void) strcat(dst, ";"); -+ _nc_STRCAT(dst, ep, MAX_TERMINFO_LENGTH); -+ _nc_STRCAT(dst, ";", MAX_TERMINFO_LENGTH); - } while - ((ep = strtok((char *) 0, ";"))); - -@@ -608,7 +788,7 @@ - const assoc *ap; - int tp_lines = tp->Numbers[2]; - -- if (cap == ABSENT_STRING || cap == CANCELLED_STRING) -+ if (!VALID_STRING(cap)) - return; - (void) printf("%s: ", name); - -@@ -624,12 +804,13 @@ - for (i = 0; i < STRCOUNT; i++) { - char *cp = tp->Strings[i]; - -- /* don't use soft-key capabilities */ -- if (strnames[i][0] == 'k' && strnames[i][0] == 'f') -+ /* don't use function-key capabilities */ -+ if (strnames[i][0] == 'k' && strnames[i][1] == 'f') - continue; - -- if (cp != ABSENT_STRING && cp != CANCELLED_STRING && cp[0] && cp -- != cap) { -+ if (VALID_STRING(cp) && -+ cp[0] != '\0' && -+ cp != cap) { - len = strlen(cp); - (void) strncpy(buf2, sp, len); - buf2[len] = '\0'; -@@ -637,7 +818,7 @@ - if (_nc_capcmp(cp, buf2)) - continue; - --#define ISRS(s) (!strncmp((s), "is", 2) || !strncmp((s), "rs", 2)) -+#define ISRS(s) (!strncmp((s), "is", (size_t) 2) || !strncmp((s), "rs", (size_t) 2)) - /* - * Theoretically we just passed the test for translation - * (equality once the padding is stripped). However, there -@@ -677,12 +858,16 @@ - /* now check for standard-mode sequences */ - if (!expansion - && (csi = skip_csi(sp)) != 0 -- && (len = strspn(sp + csi, "0123456789;")) -+ && (len = (strspn) (sp + csi, "0123456789;")) - && (len < sizeof(buf3)) - && (next = (size_t) csi + len) - && ((sp[next] == 'h') || (sp[next] == 'l'))) { - -- (void) strcpy(buf2, (sp[next] == 'h') ? "ECMA+" : "ECMA-"); -+ _nc_STRCPY(buf2, -+ ((sp[next] == 'h') -+ ? "ECMA+" -+ : "ECMA-"), -+ sizeof(buf2)); - (void) strncpy(buf3, sp + csi, len); - buf3[len] = '\0'; - len += (size_t) csi + 1; -@@ -694,12 +879,16 @@ - if (!expansion - && (csi = skip_csi(sp)) != 0 - && sp[csi] == '?' -- && (len = strspn(sp + csi + 1, "0123456789;")) -+ && (len = (strspn) (sp + csi + 1, "0123456789;")) - && (len < sizeof(buf3)) - && (next = (size_t) csi + 1 + len) - && ((sp[next] == 'h') || (sp[next] == 'l'))) { - -- (void) strcpy(buf2, (sp[next] == 'h') ? "DEC+" : "DEC-"); -+ _nc_STRCPY(buf2, -+ ((sp[next] == 'h') -+ ? "DEC+" -+ : "DEC-"), -+ sizeof(buf2)); - (void) strncpy(buf3, sp + csi + 1, len); - buf3[len] = '\0'; - len += (size_t) csi + 2; -@@ -710,12 +899,12 @@ - /* now check for ECMA highlight sequences */ - if (!expansion - && (csi = skip_csi(sp)) != 0 -- && (len = strspn(sp + csi, "0123456789;")) != 0 -+ && (len = (strspn) (sp + csi, "0123456789;")) != 0 - && (len < sizeof(buf3)) - && (next = (size_t) csi + len) - && sp[next] == 'm') { - -- (void) strcpy(buf2, "SGR:"); -+ _nc_STRCPY(buf2, "SGR:", sizeof(buf2)); - (void) strncpy(buf3, sp + csi, len); - buf3[len] = '\0'; - len += (size_t) csi + 1; -@@ -727,8 +916,8 @@ - && (csi = skip_csi(sp)) != 0 - && sp[csi] == 'm') { - len = (size_t) csi + 1; -- (void) strcpy(buf2, "SGR:"); -- strcat(buf2, ecma_highlights[0].to); -+ _nc_STRCPY(buf2, "SGR:", sizeof(buf2)); -+ _nc_STRCAT(buf2, ecma_highlights[0].to, sizeof(buf2)); - expansion = buf2; - } - -@@ -739,7 +928,7 @@ - expansion = "RSR"; - len = 1; - } else { -- (void) sprintf(buf2, "1;%dr", tp_lines); -+ _nc_SPRINTF(buf2, _nc_SLIMIT(sizeof(buf2)) "1;%dr", tp_lines); - len = strlen(buf2); - if (strncmp(buf2, sp + csi, len) == 0) - expansion = "RSR"; -@@ -750,12 +939,12 @@ - /* now check for home-down */ - if (!expansion - && (csi = skip_csi(sp)) != 0) { -- (void) sprintf(buf2, "%d;1H", tp_lines); -+ _nc_SPRINTF(buf2, _nc_SLIMIT(sizeof(buf2)) "%d;1H", tp_lines); - len = strlen(buf2); - if (strncmp(buf2, sp + csi, len) == 0) { - expansion = "LL"; - } else { -- (void) sprintf(buf2, "%dH", tp_lines); -+ _nc_SPRINTF(buf2, _nc_SLIMIT(sizeof(buf2)) "%dH", tp_lines); - len = strlen(buf2); - if (strncmp(buf2, sp + csi, len) == 0) { - expansion = "LL"; -@@ -795,12 +984,16 @@ - int i, n; - - memset(heads, 0, sizeof(heads)); -- dump_init((char *) 0, F_LITERAL, S_TERMINFO, 0, itrace, FALSE); -+ dump_init((char *) 0, F_LITERAL, S_TERMINFO, 0, 65535, itrace, FALSE); - - for (n = 0; n < argc && n < MAXCOMPARE; n++) { - if (freopen(argv[n], "r", stdin) == 0) - _nc_err_abort("Can't open %s", argv[n]); - -+#if NO_LEAKS -+ entered[n].head = _nc_head; -+ entered[n].tail = _nc_tail; -+#endif - _nc_head = _nc_tail = 0; - - /* parse entries out of the source file */ -@@ -925,6 +1118,11 @@ - #endif - if (!(entryeq(&qp->tterm, &rp->tterm) && useeq(qp, rp))) { - char name1[NAMESIZE], name2[NAMESIZE]; -+ char *names[3]; -+ -+ names[0] = name1; -+ names[1] = name2; -+ names[2] = 0; - - entries[0] = *qp; - entries[1] = *rp; -@@ -934,29 +1132,17 @@ - - switch (compare) { - case C_DIFFERENCE: -- if (itrace) -- (void) fprintf(stderr, -- "%s: dumping differences\n", -- _nc_progname); -- (void) printf("comparing %s to %s.\n", name1, name2); -+ show_comparing(names); - compare_entry(compare_predicate, &entries->tterm, quiet); - break; - - case C_COMMON: -- if (itrace) -- (void) fprintf(stderr, -- "%s: dumping common capabilities\n", -- _nc_progname); -- (void) printf("comparing %s to %s.\n", name1, name2); -+ show_comparing(names); - compare_entry(compare_predicate, &entries->tterm, quiet); - break; - - case C_NAND: -- if (itrace) -- (void) fprintf(stderr, -- "%s: dumping differences\n", -- _nc_progname); -- (void) printf("comparing %s to %s.\n", name1, name2); -+ show_comparing(names); - compare_entry(compare_predicate, &entries->tterm, quiet); - break; - -@@ -974,7 +1160,9 @@ - "Usage: infocmp [options] [-A directory] [-B directory] [termname...]" - ,"" - ,"Options:" -+ ," -0 print single-row" - ," -1 print single-column" -+ ," -K use termcap-names and BSD syntax" - ," -C use termcap-names" - ," -F compare terminfo-files" - ," -I use terminfo-names" -@@ -982,6 +1170,7 @@ - ," -R subset (see manpage)" - ," -T eliminate size limits (test)" - ," -U eliminate post-processing of entries" -+ ," -D print database locations" - ," -V print version" - #if NCURSES_XNAMES - ," -a with -F, list commented-out caps" -@@ -1030,19 +1219,25 @@ - any_initializer(const char *fmt, const char *type) - { - static char *initializer; -+ static size_t need; - char *s; - -- if (initializer == 0) -- initializer = (char *) malloc(strlen(entries->tterm.term_names) + -- strlen(type) + strlen(fmt)); -+ if (initializer == 0) { -+ need = (strlen(entries->tterm.term_names) -+ + strlen(type) -+ + strlen(fmt)); -+ initializer = (char *) malloc(need + 1); -+ if (initializer == 0) -+ failed("any_initializer"); -+ } - -- (void) strcpy(initializer, entries->tterm.term_names); -+ _nc_STRCPY(initializer, entries->tterm.term_names, need); - for (s = initializer; *s != 0 && *s != '|'; s++) { - if (!isalnum(UChar(*s))) - *s = '_'; - } - *s = 0; -- (void) sprintf(s, fmt, type); -+ _nc_SPRINTF(s, _nc_SLIMIT(need) fmt, type); - return initializer; - } - -@@ -1073,9 +1268,10 @@ - - if (VALID_STRING(term->Strings[n])) { - tp = buf; -+#define TP_LIMIT ((MAX_STRING - 5) - (size_t)(tp - buf)) - *tp++ = '"'; - for (sp = term->Strings[n]; -- *sp != 0 && (tp - buf) < MAX_STRING - 6; -+ *sp != 0 && TP_LIMIT > 2; - sp++) { - if (isascii(UChar(*sp)) - && isprint(UChar(*sp)) -@@ -1083,14 +1279,15 @@ - && *sp != '"') - *tp++ = *sp; - else { -- (void) sprintf(tp, "\\%03o", UChar(*sp)); -+ _nc_SPRINTF(tp, _nc_SLIMIT(TP_LIMIT) "\\%03o", UChar(*sp)); - tp += 4; - } - } - *tp++ = '"'; - *tp = '\0'; - (void) printf("static char %-20s[] = %s;\n", -- string_variable(ExtStrname(term, n, strnames)), buf); -+ string_variable(ExtStrname(term, (int) n, strnames)), -+ buf); - } - } - printf("\n"); -@@ -1116,7 +1313,7 @@ - break; - } - (void) printf("\t/* %3u: %-8s */\t%s,\n", -- n, ExtBoolname(term, n, boolnames), str); -+ n, ExtBoolname(term, (int) n, boolnames), str); - } - (void) printf("%s;\n", R_CURL); - -@@ -1132,12 +1329,12 @@ - str = "CANCELLED_NUMERIC"; - break; - default: -- sprintf(buf, "%d", term->Numbers[n]); -+ _nc_SPRINTF(buf, _nc_SLIMIT(sizeof(buf)) "%d", term->Numbers[n]); - str = buf; - break; - } - (void) printf("\t/* %3u: %-8s */\t%s,\n", n, -- ExtNumname(term, n, numnames), str); -+ ExtNumname(term, (int) n, numnames), str); - } - (void) printf("%s;\n", R_CURL); - -@@ -1150,10 +1347,10 @@ - else if (term->Strings[n] == CANCELLED_STRING) - str = "CANCELLED_STRING"; - else { -- str = string_variable(ExtStrname(term, n, strnames)); -+ str = string_variable(ExtStrname(term, (int) n, strnames)); - } - (void) printf("\t/* %3u: %-8s */\t%s,\n", n, -- ExtStrname(term, n, strnames), str); -+ ExtStrname(term, (int) n, strnames), str); - } - (void) printf("%s;\n", R_CURL); - -@@ -1165,15 +1362,15 @@ - name_initializer("string_ext"), L_CURL); - for (n = BOOLCOUNT; n < NUM_BOOLEANS(term); ++n) { - (void) printf("\t/* %3u: bool */\t\"%s\",\n", -- n, ExtBoolname(term, n, boolnames)); -+ n, ExtBoolname(term, (int) n, boolnames)); - } - for (n = NUMCOUNT; n < NUM_NUMBERS(term); ++n) { - (void) printf("\t/* %3u: num */\t\"%s\",\n", -- n, ExtNumname(term, n, numnames)); -+ n, ExtNumname(term, (int) n, numnames)); - } - for (n = STRCOUNT; n < NUM_STRINGS(term); ++n) { - (void) printf("\t/* %3u: str */\t\"%s\",\n", -- n, ExtStrname(term, n, strnames)); -+ n, ExtStrname(term, (int) n, strnames)); - } - (void) printf("%s;\n", R_CURL); - } -@@ -1247,6 +1444,23 @@ - return terminal; - } - -+/* -+ * Show the databases that infocmp knows about. The location to which it writes is -+ */ -+static void -+show_databases(void) -+{ -+ DBDIRS state; -+ int offset; -+ const char *path2; -+ -+ _nc_first_db(&state, &offset); -+ while ((path2 = _nc_next_db(&state, &offset)) != 0) { -+ printf("%s\n", path2); -+ } -+ _nc_last_db(); -+} -+ - /*************************************************************************** - * - * Main sequence -@@ -1269,7 +1483,7 @@ - /* Also avoid overflowing smaller stacks on systems like AmigaOS */ - path *tfile = 0; - char **tname = 0; -- int maxterms; -+ size_t maxterms; - - char **myargv; - -@@ -1287,18 +1501,27 @@ - #if NCURSES_XNAMES - use_extended_names(FALSE); - #endif -+ _nc_strict_bsd = 0; - - _nc_progname = _nc_rootname(argv[0]); - - /* make sure we have enough space to add two terminal entries */ - myargv = typeCalloc(char *, (size_t) (argc + 3)); -+ if (myargv == 0) -+ failed("myargv"); -+ - memcpy(myargv, argv, (sizeof(char *) * (size_t) argc)); - argv = myargv; - - while ((c = getopt(argc, - argv, -- "1A:aB:CcdEeFfGgIiLlnpqR:rs:TtUuVv:w:x")) != -1) { -+ "01A:aB:CcDdEeFfGgIiKLlnpqR:rs:TtUuVv:w:x")) != -1) { - switch (c) { -+ case '0': -+ mwidth = 65535; -+ mheight = 1; -+ break; -+ - case '1': - mwidth = 0; - break; -@@ -1317,6 +1540,9 @@ - restdir = optarg; - break; - -+ case 'K': -+ _nc_strict_bsd = 1; -+ /* FALLTHRU */ - case 'C': - outform = F_TERMCAP; - tversion = "BSD"; -@@ -1324,6 +1550,11 @@ - sortmode = S_TERMCAP; - break; - -+ case 'D': -+ show_databases(); -+ ExitProgram(EXIT_SUCCESS); -+ break; -+ - case 'c': - compare = C_COMMON; - break; -@@ -1441,7 +1672,7 @@ - ExitProgram(EXIT_SUCCESS); - - case 'v': -- itrace = optarg_to_number(); -+ itrace = (unsigned) optarg_to_number(); - set_trace_level(itrace); - break; - -@@ -1460,10 +1691,17 @@ - } - } - -- maxterms = (argc + 2 - optind); -- tfile = typeMalloc(path, maxterms); -- tname = typeCalloc(char *, maxterms); -- entries = typeCalloc(ENTRY, maxterms); -+ maxterms = (size_t) (argc + 2 - optind); -+ if ((tfile = typeMalloc(path, maxterms)) == 0) -+ failed("tfile"); -+ if ((tname = typeCalloc(char *, maxterms)) == 0) -+ failed("tname"); -+ if ((entries = typeCalloc(ENTRY, maxterms)) == 0) -+ failed("entries"); -+#if NO_LEAKS -+ if ((entered = typeCalloc(ENTERED, maxterms)) == 0) -+ failed("entered"); -+#endif - - if (tfile == 0 - || tname == 0 -@@ -1476,9 +1714,6 @@ - if (sortmode == S_DEFAULT) - sortmode = S_TERMINFO; - -- /* set up for display */ -- dump_init(tversion, outform, sortmode, mwidth, itrace, formatted); -- - /* make sure we have at least one terminal name to work with */ - if (optind >= argc) - argv[argc++] = terminal_env(); -@@ -1487,9 +1722,23 @@ - if (compare != C_DEFAULT && optind >= argc - 1) - argv[argc++] = terminal_env(); - -+ /* exactly one terminal name with no options means display it */ - /* exactly two terminal names with no options means do -d */ -- if (argc - optind == 2 && compare == C_DEFAULT) -- compare = C_DIFFERENCE; -+ if (compare == C_DEFAULT) { -+ switch (argc - optind) { -+ default: -+ fprintf(stderr, "%s: too many names to compare\n", _nc_progname); -+ ExitProgram(EXIT_FAILURE); -+ case 1: -+ break; -+ case 2: -+ compare = C_DIFFERENCE; -+ break; -+ } -+ } -+ -+ /* set up for display */ -+ dump_init(tversion, outform, sortmode, mwidth, mheight, itrace, formatted); - - if (!filecompare) { - /* grab the entries */ -@@ -1501,15 +1750,17 @@ - tname[termcount] = argv[optind]; - - if (directory) { --#if USE_DATABASE -+#if NCURSES_USE_DATABASE - #if MIXEDCASE_FILENAMES - #define LEAF_FMT "%c" - #else - #define LEAF_FMT "%02x" - #endif -- (void) sprintf(tfile[termcount], "%s/" LEAF_FMT "/%s", -- directory, -- UChar(*argv[optind]), argv[optind]); -+ _nc_SPRINTF(tfile[termcount], -+ _nc_SLIMIT(sizeof(path)) -+ "%s/" LEAF_FMT "/%s", -+ directory, -+ UChar(*argv[optind]), argv[optind]); - if (itrace) - (void) fprintf(stderr, - "%s: reading entry %s from file %s\n", -@@ -1599,27 +1850,17 @@ - break; - - case C_DIFFERENCE: -- if (itrace) -- (void) fprintf(stderr, "%s: dumping differences\n", _nc_progname); -- (void) printf("comparing %s to %s.\n", tname[0], tname[1]); -+ show_comparing(tname); - compare_entry(compare_predicate, &entries->tterm, quiet); - break; - - case C_COMMON: -- if (itrace) -- (void) fprintf(stderr, -- "%s: dumping common capabilities\n", -- _nc_progname); -- (void) printf("comparing %s to %s.\n", tname[0], tname[1]); -+ show_comparing(tname); - compare_entry(compare_predicate, &entries->tterm, quiet); - break; - - case C_NAND: -- if (itrace) -- (void) fprintf(stderr, -- "%s: dumping differences\n", -- _nc_progname); -- (void) printf("comparing %s to %s.\n", tname[0], tname[1]); -+ show_comparing(tname); - compare_entry(compare_predicate, &entries->tterm, quiet); - break; - -@@ -1640,15 +1881,16 @@ - break; - } - } -- } else if (compare == C_USEALL) -+ } else if (compare == C_USEALL) { - (void) fprintf(stderr, "Sorry, -u doesn't work with -F\n"); -- else if (compare == C_DEFAULT) -+ } else if (compare == C_DEFAULT) { - (void) fprintf(stderr, "Use `tic -[CI] <file>' for this.\n"); -- else if (argc - optind != 2) -+ } else if (argc - optind != 2) { - (void) fprintf(stderr, - "File comparison needs exactly two file arguments.\n"); -- else -+ } else { - file_comparison(argc - optind, argv + optind); -+ } - - MAIN_LEAKS(); - ExitProgram(EXIT_SUCCESS); -diff -Naur ncurses-5.9/progs/Makefile.in ncurses-5.9.patch/progs/Makefile.in ---- ncurses-5.9/progs/Makefile.in 2010-11-27 22:45:27.000000000 +0100 -+++ ncurses-5.9.patch/progs/Makefile.in 2014-09-01 16:33:22.521792398 +0200 -@@ -1,6 +1,6 @@ --# $Id: Makefile.in,v 1.85 2010/11/27 21:45:27 tom Exp $ -+# $Id: Makefile.in,v 1.90 2013/08/04 20:23:20 tom Exp $ - ############################################################################## --# Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. # -+# Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. # - # # - # Permission is hereby granted, free of charge, to any person obtaining a # - # copy of this software and associated documentation files (the "Software"), # -@@ -61,7 +61,11 @@ - bindir = @bindir@ - libdir = @libdir@ - includedir = @includedir@ -+datarootdir = @datarootdir@ - datadir = @datadir@ -+includesubdir = @includesubdir@ -+ -+INCLUDEDIR = $(DESTDIR)$(includedir)$(includesubdir) - - LIBTOOL = @LIBTOOL@ - LIBTOOL_CLEAN = @LIB_CLEAN@ -@@ -104,20 +108,21 @@ - LD = @LD@ - LINK = @LINK_PROGS@ $(LIBTOOL_LINK) - LDFLAGS = @EXTRA_LDFLAGS@ @LDFLAGS@ -+RPATH_LIST = @RPATH_LIST@ - - LDFLAGS_LIBTOOL = $(LDFLAGS) $(CFLAGS_LIBTOOL) - LDFLAGS_NORMAL = $(LDFLAGS) $(CFLAGS_NORMAL) - LDFLAGS_DEBUG = $(LDFLAGS) $(CFLAGS_DEBUG) --LDFLAGS_PROFILE = $(LDFLAGS) $(CFLAGS_PROFILE) -+LDFLAGS_PROFILE = $(LDFLAGS) $(CFLAGS_PROFILE) - LDFLAGS_SHARED = $(LDFLAGS) $(CFLAGS_SHARED) @LD_SHARED_OPTS@ - - LDFLAGS_DEFAULT = $(LDFLAGS_@DFT_UPR_MODEL@) - --LIBS_TIC = @LDFLAGS_STATIC@ @TICS_ARGS@ @TINFO_ARGS@ @LDFLAGS_SHARED@ @LD_MODEL@ @LIBS@ --LDFLAGS_TIC = $(LDFLAGS_@DFT_UPR_MODEL@) $(LIBS_TIC) -+LIBS_TIC = @TINFO_LDFLAGS@ @LDFLAGS_STATIC@ @TICS_LIBS@ @TINFO_LIBS@ @LDFLAGS_SHARED@ @LD_MODEL@ @LIBS@ -+LDFLAGS_TIC = @TICS_LDFLAGS@ $(LDFLAGS_@DFT_UPR_MODEL@) $(LIBS_TIC) - --LIBS_TINFO = @LDFLAGS_STATIC@ @TINFO_ARGS@ @LDFLAGS_SHARED@ @LD_MODEL@ @LIBS@ --LDFLAGS_TINFO = $(LDFLAGS_@DFT_UPR_MODEL@) $(LIBS_TINFO) -+LIBS_TINFO = @LDFLAGS_STATIC@ @TINFO_LIBS@ @LDFLAGS_SHARED@ @LD_MODEL@ @LIBS@ -+LDFLAGS_TINFO = @TINFO_LDFLAGS@ $(LDFLAGS_@DFT_UPR_MODEL@) $(LIBS_TINFO) - - LINT = @LINT@ - LINT_OPTS = @LINT_OPTS@ -@@ -230,46 +235,46 @@ - $(MODEL)/transform$o - - tic$x: $(DEPS_TIC) $(DEPS_CURSES) transform.h -- @ECHO_LINK@ $(LINK) $(DEPS_TIC) $(LDFLAGS_TIC) -o $@ -+ @ECHO_LD@ $(LINK) $(DEPS_TIC) $(LDFLAGS_TIC) -o $@ - - DEPS_TOE = \ - $(MODEL)/toe$o - - toe$x: $(DEPS_TOE) $(DEPS_CURSES) -- @ECHO_LINK@ $(LINK) $(DEPS_TOE) $(LDFLAGS_TIC) -o $@ -+ @ECHO_LD@ $(LINK) $(DEPS_TOE) $(LDFLAGS_TIC) -o $@ - - DEPS_CLEAR = \ - $(MODEL)/clear$o - - clear$x: $(DEPS_CLEAR) $(DEPS_CURSES) -- @ECHO_LINK@ $(LINK) $(DEPS_CLEAR) $(LDFLAGS_TINFO) -o $@ -+ @ECHO_LD@ $(LINK) $(DEPS_CLEAR) $(LDFLAGS_TINFO) -o $@ - - DEPS_TABS = \ - $(MODEL)/tabs$o - - tabs$x: $(DEPS_TABS) $(DEPS_TABS) -- @ECHO_LINK@ $(LINK) $(DEPS_TABS) $(LDFLAGS_TINFO) -o $@ -+ @ECHO_LD@ $(LINK) $(DEPS_TABS) $(LDFLAGS_TINFO) -o $@ - - DEPS_TPUT = \ - $(MODEL)/tput$o \ - $(MODEL)/transform$o - - tput$x: $(DEPS_TPUT) $(DEPS_CURSES) transform.h -- @ECHO_LINK@ $(LINK) $(DEPS_TPUT) $(LDFLAGS_TINFO) -o $@ -+ @ECHO_LD@ $(LINK) $(DEPS_TPUT) $(LDFLAGS_TINFO) -o $@ - - DEPS_INFOCMP = \ - $(MODEL)/infocmp$o \ - $(MODEL)/dump_entry$o - - infocmp$x: $(DEPS_INFOCMP) $(DEPS_CURSES) -- @ECHO_LINK@ $(LINK) $(DEPS_INFOCMP) $(LDFLAGS_TIC) -o $@ -+ @ECHO_LD@ $(LINK) $(DEPS_INFOCMP) $(LDFLAGS_TIC) -o $@ - - DEPS_TSET = \ - $(MODEL)/tset$o \ - $(MODEL)/transform$o - - tset$x: $(DEPS_TSET) $(DEPS_CURSES) transform.h -- @ECHO_LINK@ $(LINK) $(DEPS_TSET) $(LDFLAGS_TINFO) -o $@ -+ @ECHO_LD@ $(LINK) $(DEPS_TSET) $(LDFLAGS_TINFO) -o $@ - - termsort.c: $(srcdir)/MKtermsort.sh - sh $(srcdir)/MKtermsort.sh $(AWK) $(srcdir)/../include/@TERMINFO_CAPS@ >$@ -diff -Naur ncurses-5.9/progs/progs.priv.h ncurses-5.9.patch/progs/progs.priv.h ---- ncurses-5.9/progs/progs.priv.h 2008-08-03 19:43:05.000000000 +0200 -+++ ncurses-5.9.patch/progs/progs.priv.h 2014-09-01 16:33:22.522792397 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -30,7 +30,7 @@ - * Author: Thomas E. Dickey 1997-on * - ****************************************************************************/ - /* -- * $Id: progs.priv.h,v 1.34 2008/08/03 17:43:05 tom Exp $ -+ * $Id: progs.priv.h,v 1.39 2012/02/22 22:11:27 tom Exp $ - * - * progs.priv.h - * -@@ -42,7 +42,7 @@ - #if USE_RCS_IDS - #define MODULE_ID(id) static const char Ident[] = id; - #else --#define MODULE_ID(id) /*nothing*/ -+#define MODULE_ID(id) /*nothing */ - #endif - - #include <stdlib.h> -@@ -90,6 +90,14 @@ - # endif - #endif - -+#if HAVE_INTTYPES_H -+# include <inttypes.h> -+#else -+# if HAVE_STDINT_H -+# include <stdint.h> -+# endif -+#endif -+ - #include <assert.h> - #include <errno.h> - -@@ -99,7 +107,7 @@ - - #if HAVE_GETOPT_H - #include <getopt.h> --#else -+#elif !defined(HAVE_GETOPT_HEADER) - /* 'getopt()' may be prototyped in <stdlib.h>, but declaring its - * variables doesn't hurt. - */ -@@ -109,9 +117,11 @@ - - #include <curses.h> - #include <term_entry.h> -+#include <nc_termios.h> - #include <tic.h> - #include <nc_tparm.h> - -+#include <nc_string.h> - #include <nc_alloc.h> - #if HAVE_NC_FREEALL - #undef ExitProgram -@@ -171,7 +181,7 @@ - # elif defined(MAXPATHLEN) - # define PATH_MAX MAXPATHLEN - # else --# define PATH_MAX 255 /* the Posix minimum pathsize */ -+# define PATH_MAX 255 /* the Posix minimum pathsize */ - # endif - #endif - -@@ -183,7 +193,7 @@ - # if ('z'-'a' == 25) && ('z' < 127) && ('Z'-'A' == 25) && ('Z' < 127) && ('9' < 127) - # define isascii(c) (UChar(c) <= 127) - # else --# define isascii(c) 1 /* not really ascii anyway */ -+# define isascii(c) 1 /* not really ascii anyway */ - # endif - #endif - -diff -Naur ncurses-5.9/progs/tabs.c ncurses-5.9.patch/progs/tabs.c ---- ncurses-5.9/progs/tabs.c 2010-10-24 00:26:01.000000000 +0200 -+++ ncurses-5.9.patch/progs/tabs.c 2014-09-01 16:33:22.523792397 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 2008-2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 2008-2012,2013 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -37,12 +37,20 @@ - #define USE_LIBTINFO - #include <progs.priv.h> - --MODULE_ID("$Id: tabs.c,v 1.19 2010/10/23 22:26:01 tom Exp $") -+MODULE_ID("$Id: tabs.c,v 1.34 2013/06/11 08:18:27 tom Exp $") - - static void usage(void) GCC_NORETURN; - -+static char *prg_name; - static int max_cols; - -+static void -+failed(const char *s) -+{ -+ perror(s); -+ ExitProgram(EXIT_FAILURE); -+} -+ - static int - putch(int c) - { -@@ -83,28 +91,29 @@ - int prior = 0; - int ch; - -- if (result != 0) { -- while ((ch = *tab_list++) != '\0') { -- if (isdigit(UChar(ch))) { -- value *= 10; -- value += (ch - '0'); -- } else if (ch == ',') { -- result[n] = value + prior; -- if (n > 0 && result[n] <= result[n - 1]) { -- fprintf(stderr, -- "tab-stops are not in increasing order: %d %d\n", -- value, result[n - 1]); -- free(result); -- result = 0; -- break; -- } -- ++n; -- value = 0; -- prior = 0; -- } else if (ch == '+') { -- if (n) -- prior = result[n - 1]; -+ if (result == 0) -+ failed("decode_tabs"); -+ -+ while ((ch = *tab_list++) != '\0') { -+ if (isdigit(UChar(ch))) { -+ value *= 10; -+ value += (ch - '0'); -+ } else if (ch == ',') { -+ result[n] = value + prior; -+ if (n > 0 && result[n] <= result[n - 1]) { -+ fprintf(stderr, -+ "%s: tab-stops are not in increasing order: %d %d\n", -+ prg_name, value, result[n - 1]); -+ free(result); -+ result = 0; -+ break; - } -+ ++n; -+ value = 0; -+ prior = 0; -+ } else if (ch == '+') { -+ if (n) -+ prior = result[n - 1]; - } - } - -@@ -114,6 +123,7 @@ - */ - if ((n == 0) && (value > 0)) { - int step = value; -+ value = 1; - while (n < max_cols - 1) { - result[n++] = value; - value += step; -@@ -126,6 +136,7 @@ - result[n++] = value + prior; - result[n] = 0; - } -+ - return result; - } - -@@ -140,10 +151,11 @@ - for (n = 0; n < max_cols; n += 10) { - int ch = 1 + (n / 10); - char buffer[20]; -- sprintf(buffer, "----+----%c", -- ((ch < 10) -- ? (ch + '0') -- : (ch + 'A' - 10))); -+ _nc_SPRINTF(buffer, _nc_SLIMIT(sizeof(buffer)) -+ "----+----%c", -+ ((ch < 10) -+ ? (ch + '0') -+ : (ch + 'A' - 10))); - printf("%.*s", ((max_cols - n) > 10) ? 10 : (max_cols - n), buffer); - } - putchar('\n'); -@@ -227,7 +239,7 @@ - bool result = FALSE; - - if (source != 0) { -- unsigned len = strlen(source); -+ size_t len = strlen(source); - if (len != 0) - result = (source[len - 1] != ','); - } else { -@@ -251,7 +263,7 @@ - - if (copied != 0 && *copied != '\0') { - const char *comma = ","; -- unsigned need = 1 + strlen(copied); -+ size_t need = 1 + strlen(copied); - - if (*copied == ',') - comma = ""; -@@ -263,15 +275,16 @@ - need += strlen(*append); - - result = malloc(need); -- if (result != 0) { -- *result = '\0'; -- if (*append != 0) { -- strcpy(result, *append); -- free(*append); -- } -- strcat(result, comma); -- strcat(result, copied); -+ if (result == 0) -+ failed("add_to_tab_list"); -+ -+ *result = '\0'; -+ if (*append != 0) { -+ _nc_STRCPY(result, *append, need); -+ free(*append); - } -+ _nc_STRCAT(result, comma, need); -+ _nc_STRCAT(result, copied, need); - - *append = result; - } -@@ -282,7 +295,7 @@ - * Check for illegal characters in the tab-list. - */ - static bool --legal_tab_list(const char *program, const char *tab_list) -+legal_tab_list(const char *tab_list) - { - bool result = TRUE; - -@@ -294,22 +307,34 @@ - if (!(isdigit(ch) || ch == ',' || ch == '+')) { - fprintf(stderr, - "%s: unexpected character found '%c'\n", -- program, ch); -+ prg_name, ch); - result = FALSE; - break; - } - } - } else { -- fprintf(stderr, "%s: trailing comma found '%s'\n", program, tab_list); -+ fprintf(stderr, "%s: trailing comma found '%s'\n", prg_name, tab_list); - result = FALSE; - } - } else { -- fprintf(stderr, "%s: no tab-list given\n", program); -+ fprintf(stderr, "%s: no tab-list given\n", prg_name); - result = FALSE; - } - return result; - } - -+static char * -+skip_list(char *value) -+{ -+ while (*value != '\0' && -+ (isdigit(UChar(*value)) || -+ isspace(UChar(*value)) || -+ strchr("+,", UChar(*value)) != 0)) { -+ ++value; -+ } -+ return value; -+} -+ - static void - usage(void) - { -@@ -332,6 +357,7 @@ - ," -s SNOBOL" - ," -u UNIVAC 1100 Assembler" - ," -T name use terminal type 'name'" -+ ," -V print version" - ,"" - ,"A tabstop-list is an ordered list of column numbers, e.g., 1,11,21" - ,"or 1,+10,+10 which is the same." -@@ -353,10 +379,11 @@ - bool no_op = FALSE; - int n, ch; - NCURSES_CONST char *term_name = 0; -- const char *mar_list = 0; /* ignored */ - char *append = 0; - const char *tab_list = 0; - -+ prg_name = _nc_rootname(argv[0]); -+ - if ((term_name = getenv("TERM")) == 0) - term_name = "ansi+tabs"; - -@@ -368,23 +395,25 @@ - while ((ch = *++option) != '\0') { - switch (ch) { - case 'a': -- switch (*option) { -+ switch (*++option) { -+ default: - case '\0': - tab_list = "1,10,16,36,72"; -+ option--; - /* Assembler, IBM S/370, first format */ - break; - case '2': - tab_list = "1,10,16,40,72"; - /* Assembler, IBM S/370, second format */ - break; -- default: -- usage(); - } - break; - case 'c': -- switch (*option) { -+ switch (*++option) { -+ default: - case '\0': - tab_list = "1,8,12,16,20,55"; -+ option--; - /* COBOL, normal format */ - break; - case '2': -@@ -395,8 +424,6 @@ - tab_list = "1,6,10,14,18,22,26,30,34,38,42,46,50,54,58,62,67"; - /* COBOL compact format extended */ - break; -- default: -- usage(); - } - break; - case 'd': /* ncurses extension */ -@@ -427,17 +454,22 @@ - term_name = option; - } else { - term_name = argv[n++]; -+ option--; - } - option += ((int) strlen(option)) - 1; - continue; -+ case 'V': -+ puts(curses_version()); -+ ExitProgram(EXIT_SUCCESS); - default: - if (isdigit(UChar(*option))) { -- tab_list = option; -- ++n; -+ char *copy = strdup(option); -+ *skip_list(copy) = '\0'; -+ tab_list = copy; -+ option = skip_list(option) - 1; - } else { - usage(); - } -- option += ((int) strlen(option)) - 1; - break; - } - } -@@ -446,7 +478,11 @@ - while ((ch = *++option) != '\0') { - switch (ch) { - case 'm': -- mar_list = option; -+ /* -+ * The "+mXXX" option is unimplemented because only the long-obsolete -+ * att510d implements smgl, which is needed to support -+ * this option. -+ */ - break; - default: - /* special case of relative stops separated by spaces? */ -@@ -477,12 +513,12 @@ - if (!VALID_STRING(clear_all_tabs)) { - fprintf(stderr, - "%s: terminal type '%s' cannot reset tabs\n", -- argv[0], term_name); -+ prg_name, term_name); - } else if (!VALID_STRING(set_tab)) { - fprintf(stderr, - "%s: terminal type '%s' cannot set tabs\n", -- argv[0], term_name); -- } else if (legal_tab_list(argv[0], tab_list)) { -+ prg_name, term_name); -+ } else if (legal_tab_list(tab_list)) { - int *list = decode_tabs(tab_list); - - if (!no_op) -diff -Naur ncurses-5.9/progs/tic.c ncurses-5.9.patch/progs/tic.c ---- ncurses-5.9/progs/tic.c 2011-02-12 19:39:08.000000000 +0100 -+++ ncurses-5.9.patch/progs/tic.c 2014-09-01 16:33:22.523792397 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2010,2011 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -35,6 +35,7 @@ - /* - * tic.c --- Main program for terminfo compiler - * by Eric S. Raymond -+ * and Thomas E Dickey - * - */ - -@@ -42,9 +43,12 @@ - #include <sys/stat.h> - - #include <dump_entry.h> -+#include <hashed_db.h> - #include <transform.h> - --MODULE_ID("$Id: tic.c,v 1.147 2011/02/12 18:39:08 tom Exp $") -+MODULE_ID("$Id: tic.c,v 1.189 2013/11/16 19:58:09 tom Exp $") -+ -+#define STDIN_NAME "<stdin>" - - const char *_nc_progname = "tic"; - -@@ -53,6 +57,7 @@ - static bool capdump = FALSE; /* running as infotocap? */ - static bool infodump = FALSE; /* running as captoinfo? */ - static bool showsummary = FALSE; -+static char **namelst = 0; - static const char *to_remove; - - static void (*save_check_termtype) (TERMTYPE *, bool); -@@ -69,11 +74,13 @@ - 1\ - a\ - C\ -+D\ - c\ - f\ - G\ - g\ - I\ -+K\ - L\ - N\ - r\ -@@ -99,8 +106,10 @@ - #endif - - static void --cleanup(char **namelst GCC_UNUSED) -+cleanup(void) - { -+ int rc; -+ - #if NO_LEAKS - free_namelist(namelst); - #endif -@@ -108,10 +117,12 @@ - fclose(tmp_fp); - if (to_remove != 0) { - #if HAVE_REMOVE -- remove(to_remove); -+ rc = remove(to_remove); - #else -- unlink(to_remove); -+ rc = unlink(to_remove); - #endif -+ if (rc != 0) -+ perror(to_remove); - } - } - -@@ -119,7 +130,6 @@ - failed(const char *msg) - { - perror(msg); -- cleanup((char **) 0); - ExitProgram(EXIT_FAILURE); - } - -@@ -133,7 +143,9 @@ - #if NCURSES_XNAMES - " -a retain commented-out capabilities (sets -x also)", - #endif -+ " -K translate entries to termcap source form with BSD syntax", - " -C translate entries to termcap source form", -+ " -D print list of tic's database locations (first must be writable)", - " -c check only, validate input without compiling or translating", - " -e<names> translate/compile only entries named by comma-separated list", - " -f format complex strings for readability", -@@ -173,7 +185,7 @@ - - #define L_BRACE '{' - #define R_BRACE '}' --#define S_QUOTE '\''; -+#define S_QUOTE '\'' - - static void - write_it(ENTRY * ep) -@@ -216,12 +228,12 @@ - } - *d = 0; - if (strlen(result) < strlen(s)) -- strcpy(s, result); -+ _nc_STRCPY(s, result, strlen(s) + 1); - } - } - - _nc_set_type(_nc_first_name(ep->tterm.term_names)); -- _nc_curr_line = ep->startline; -+ _nc_curr_line = (int) ep->startline; - _nc_write_entry(&ep->tterm); - } - -@@ -286,8 +298,10 @@ - if (in_name) { - if (used + 1 >= have) { - have += 132; -- namebuf = typeRealloc(char, have, namebuf); -- suffix = typeRealloc(char, have, suffix); -+ if ((namebuf = typeRealloc(char, have, namebuf)) == 0) -+ failed("put_translate namebuf"); -+ if ((suffix = typeRealloc(char, have, suffix)) == 0) -+ failed("put_translate suffix"); - } - if (c == '\n' || c == '@') { - namebuf[used++] = '\0'; -@@ -308,7 +322,7 @@ - if ((up = strchr(namebuf, '#')) != 0 - || (up = strchr(namebuf, '=')) != 0 - || ((up = strchr(namebuf, '@')) != 0 && up[1] == '>')) { -- (void) strcpy(suffix, up); -+ _nc_STRCPY(suffix, up, have); - *up = '\0'; - } - -@@ -339,39 +353,122 @@ - static char * - stripped(char *src) - { -+ char *dst = 0; -+ - while (isspace(UChar(*src))) - src++; -+ - if (*src != '\0') { -- char *dst; - size_t len; - -- if ((dst = strdup(src)) == NULL) -+ if ((dst = strdup(src)) == NULL) { - failed("strdup"); -+ } else { -+ len = strlen(dst); -+ while (--len != 0 && isspace(UChar(dst[len]))) -+ dst[len] = '\0'; -+ } -+ } -+ return dst; -+} -+ -+static FILE * -+open_tempfile(char *filename) -+{ -+ FILE *result = 0; -+ -+ _nc_STRCPY(filename, "/tmp/XXXXXX", PATH_MAX); -+#if HAVE_MKSTEMP -+ { -+ int oldmask = (int) umask(077); -+ int fd = mkstemp(filename); -+ if (fd >= 0) -+ result = fdopen(fd, "w"); -+ umask((mode_t) oldmask); -+ } -+#else -+ if (tmpnam(filename) != 0) -+ result = fopen(filename, "w"); -+#endif -+ return result; -+} -+ -+static FILE * -+copy_input(FILE *source, const char *filename, char *alt_file) -+{ -+ char my_altfile[PATH_MAX]; -+ FILE *result = 0; -+ FILE *target = 0; -+ int ch; - -- assert(dst != 0); -+ if (alt_file == 0) -+ alt_file = my_altfile; - -- len = strlen(dst); -- while (--len != 0 && isspace(UChar(dst[len]))) -- dst[len] = '\0'; -- return dst; -+ if (source == 0) { -+ failed("copy_input (source)"); -+ } else if ((target = open_tempfile(alt_file)) == 0) { -+ failed("copy_input (target)"); -+ } else { -+ clearerr(source); -+ for (;;) { -+ ch = fgetc(source); -+ if (feof(source)) { -+ break; -+ } else if (ferror(source)) { -+ failed(filename); -+ } else if (ch == 0) { -+ /* don't loop in case someone wants to convert /dev/zero */ -+ fprintf(stderr, "%s: %s is not a text-file\n", _nc_progname, filename); -+ ExitProgram(EXIT_FAILURE); -+ } -+ fputc(ch, target); -+ } -+ fclose(source); -+ /* -+ * rewind() does not force the target file's data to disk (not does -+ * fflush()...). So open a second stream on the data and then close -+ * the one that we were writing on before starting to read from the -+ * second stream. -+ */ -+ result = fopen(alt_file, "r+"); -+ fclose(target); -+ to_remove = strdup(alt_file); - } -- return 0; -+ return result; - } - - static FILE * --open_input(const char *filename) -+open_input(const char *filename, char *alt_file) - { -- FILE *fp = fopen(filename, "r"); -+ FILE *fp; - struct stat sb; -+ int mode; - -- if (fp == 0) { -- fprintf(stderr, "%s: Can't open %s\n", _nc_progname, filename); -+ if (!strcmp(filename, "-")) { -+ fp = copy_input(stdin, STDIN_NAME, alt_file); -+ } else if (stat(filename, &sb) < 0) { -+ fprintf(stderr, "%s: %s %s\n", _nc_progname, filename, strerror(errno)); - ExitProgram(EXIT_FAILURE); -- } -- if (fstat(fileno(fp), &sb) < 0 -- || (sb.st_mode & S_IFMT) != S_IFREG) { -+ } else if ((mode = (sb.st_mode & S_IFMT)) == S_IFDIR -+ || (mode != S_IFREG && mode != S_IFCHR)) { - fprintf(stderr, "%s: %s is not a file\n", _nc_progname, filename); - ExitProgram(EXIT_FAILURE); -+ } else { -+ fp = fopen(filename, "r"); -+ -+ if (fp == 0) { -+ fprintf(stderr, "%s: Can't open %s\n", _nc_progname, filename); -+ ExitProgram(EXIT_FAILURE); -+ } -+ if (mode != S_IFREG) { -+ if (alt_file != 0) { -+ FILE *fp2 = copy_input(fp, filename, alt_file); -+ fp = fp2; -+ } else { -+ fprintf(stderr, "%s: %s is not a file\n", _nc_progname, filename); -+ ExitProgram(EXIT_FAILURE); -+ } -+ } - } - return fp; - } -@@ -389,7 +486,7 @@ - if (src == 0) { - /* EMPTY */ ; - } else if (strchr(src, '/') != 0) { /* a filename */ -- FILE *fp = open_input(src); -+ FILE *fp = open_input(src, (char *) 0); - - for (pass = 1; pass <= 2; pass++) { - nn = 0; -@@ -403,7 +500,8 @@ - } - } - if (pass == 1) { -- dst = typeCalloc(char *, nn + 1); -+ if ((dst = typeCalloc(char *, nn + 1)) == 0) -+ failed("make_namelist"); - rewind(fp); - } - } -@@ -425,8 +523,10 @@ - if (mark == '\0') - break; - } -- if (pass == 1) -- dst = typeCalloc(char *, nn + 1); -+ if (pass == 1) { -+ if ((dst = typeCalloc(char *, nn + 1)) == 0) -+ failed("make_namelist"); -+ } - } - } - if (showsummary && (dst != 0)) { -@@ -456,26 +556,118 @@ - return (code); - } - --static FILE * --open_tempfile(char *name) -+static char * -+valid_db_path(const char *nominal) - { -- FILE *result = 0; --#if HAVE_MKSTEMP -- int fd = mkstemp(name); -- if (fd >= 0) -- result = fdopen(fd, "w"); -+ struct stat sb; -+#if USE_HASHED_DB -+ char suffix[] = DBM_SUFFIX; -+ size_t need = strlen(nominal) + sizeof(suffix); -+ char *result = malloc(need); -+ -+ if (result == 0) -+ failed("valid_db_path"); -+ _nc_STRCPY(result, nominal, need); -+ if (strcmp(result + need - sizeof(suffix), suffix)) { -+ _nc_STRCAT(result, suffix, need); -+ } -+#else -+ char *result = strdup(nominal); -+#endif -+ -+ DEBUG(1, ("** stat(%s)", result)); -+ if (stat(result, &sb) >= 0) { -+#if USE_HASHED_DB -+ if (!S_ISREG(sb.st_mode) -+ || access(result, R_OK | W_OK) != 0) { -+ DEBUG(1, ("...not a writable file")); -+ free(result); -+ result = 0; -+ } - #else -- if (tmpnam(name) != 0) -- result = fopen(name, "w"); -+ if (!S_ISDIR(sb.st_mode) -+ || access(result, R_OK | W_OK | X_OK) != 0) { -+ DEBUG(1, ("...not a writable directory")); -+ free(result); -+ result = 0; -+ } - #endif -+ } else { -+ /* check if parent is directory and is writable */ -+ unsigned leaf = _nc_pathlast(result); -+ -+ DEBUG(1, ("...not found")); -+ if (leaf) { -+ char save = result[leaf]; -+ result[leaf] = 0; -+ if (stat(result, &sb) >= 0 -+ && S_ISDIR(sb.st_mode) -+ && access(result, R_OK | W_OK | X_OK) == 0) { -+ result[leaf] = save; -+ } else { -+ DEBUG(1, ("...parent directory %s is not writable", result)); -+ free(result); -+ result = 0; -+ } -+ } else { -+ DEBUG(1, ("... no parent directory")); -+ free(result); -+ result = 0; -+ } -+ } - return result; - } - -+/* -+ * Show the databases to which tic could write. The location to which it -+ * writes is always the first one. If none are writable, print an error -+ * message. -+ */ -+static void -+show_databases(const char *outdir) -+{ -+ bool specific = (outdir != 0) || getenv("TERMINFO") != 0; -+ char *result; -+ const char *tried = 0; -+ -+ if (outdir == 0) { -+ outdir = _nc_tic_dir(0); -+ } -+ if ((result = valid_db_path(outdir)) != 0) { -+ printf("%s\n", result); -+ free(result); -+ } else { -+ tried = outdir; -+ } -+ -+ if ((outdir = _nc_home_terminfo())) { -+ if ((result = valid_db_path(outdir)) != 0) { -+ printf("%s\n", result); -+ free(result); -+ } else if (!specific) { -+ tried = outdir; -+ } -+ } -+ -+ /* -+ * If we can write in neither location, give an error message. -+ */ -+ if (tried) { -+ fflush(stdout); -+ fprintf(stderr, "%s: %s (no permission)\n", _nc_progname, tried); -+ ExitProgram(EXIT_FAILURE); -+ } -+} -+ -+#define VtoTrace(opt) (unsigned) ((opt > 0) ? opt : (opt == 0)) -+ - int - main(int argc, char *argv[]) - { - char my_tmpname[PATH_MAX]; -- int v_opt = -1, debug_level; -+ char my_altfile[PATH_MAX]; -+ int v_opt = -1; -+ unsigned debug_level; - int smart_defaults = TRUE; - char *termcap; - ENTRY *qp; -@@ -486,6 +678,7 @@ - int sortmode = S_TERMINFO; /* sort_mode */ - - int width = 60; -+ int height = 65535; - bool formatted = FALSE; /* reformat complex strings? */ - bool literal = FALSE; /* suppress post-processing? */ - int numbers = 0; /* format "%'char'" to/from "%{number}" */ -@@ -493,7 +686,6 @@ - bool limited = TRUE; - char *tversion = (char *) NULL; - const char *source_file = "terminfo"; -- char **namelst = 0; - char *outdir = (char *) NULL; - bool check_only = FALSE; - bool suppress_untranslatable = FALSE; -@@ -501,6 +693,7 @@ - log_fp = stderr; - - _nc_progname = _nc_rootname(argv[0]); -+ atexit(cleanup); - - if ((infodump = same_program(_nc_progname, PROG_CAPTOINFO)) != FALSE) { - outform = F_TERMINFO; -@@ -513,6 +706,7 @@ - #if NCURSES_XNAMES - use_extended_names(FALSE); - #endif -+ _nc_strict_bsd = 0; - - /* - * Processing arguments is a little complicated, since someone made a -@@ -520,7 +714,7 @@ - * be optional. - */ - while ((this_opt = getopt(argc, argv, -- "0123456789CILNR:TUVace:fGgo:rstvwx")) != -1) { -+ "0123456789CDIKLNR:TUVace:fGgo:rstvwx")) != -1) { - if (isdigit(this_opt)) { - switch (last_opt) { - case 'v': -@@ -530,19 +724,40 @@ - width = (width * 10) + (this_opt - '0'); - break; - default: -- if (this_opt != '1') -+ switch (this_opt) { -+ case '0': -+ last_opt = this_opt; -+ width = 65535; -+ height = 1; -+ break; -+ case '1': -+ last_opt = this_opt; -+ width = 0; -+ break; -+ default: - usage(); -- last_opt = this_opt; -- width = 0; -+ } - } - continue; - } - switch (this_opt) { -+ case 'K': -+ _nc_strict_bsd = 1; -+ /* the initial version of -K in 20110730 fell-thru here, but the -+ * same flag is useful when reading sources -TD -+ */ -+ break; - case 'C': - capdump = TRUE; - outform = F_TERMCAP; - sortmode = S_TERMCAP; - break; -+ case 'D': -+ debug_level = VtoTrace(v_opt); -+ set_trace_level(debug_level); -+ show_databases(outdir); -+ ExitProgram(EXIT_SUCCESS); -+ break; - case 'I': - infodump = TRUE; - outform = F_TERMINFO; -@@ -568,7 +783,6 @@ - break; - case 'V': - puts(curses_version()); -- cleanup(namelst); - ExitProgram(EXIT_SUCCESS); - case 'c': - check_only = TRUE; -@@ -618,7 +832,7 @@ - last_opt = this_opt; - } - -- debug_level = (v_opt > 0) ? v_opt : (v_opt == 0); -+ debug_level = VtoTrace(v_opt); - set_trace_level(debug_level); - - if (_nc_tracing) { -@@ -638,8 +852,8 @@ - */ - if (namelst && (!infodump && !capdump)) { - (void) fprintf(stderr, -- "Sorry, -e can't be used without -I or -C\n"); -- cleanup(namelst); -+ "%s: Sorry, -e can't be used without -I or -C\n", -+ _nc_progname); - ExitProgram(EXIT_FAILURE); - } - #endif /* HAVE_BIG_CORE */ -@@ -663,16 +877,16 @@ - if (access(termcap, F_OK) == 0) { - /* file exists */ - source_file = termcap; -- } else if ((tmp_fp = open_tempfile(strcpy(my_tmpname, -- "/tmp/XXXXXX"))) -- != 0) { -- source_file = my_tmpname; -- fprintf(tmp_fp, "%s\n", termcap); -- fclose(tmp_fp); -- tmp_fp = open_input(source_file); -- to_remove = source_file; - } else { -- failed("tmpnam"); -+ if ((tmp_fp = open_tempfile(my_tmpname)) != 0) { -+ source_file = my_tmpname; -+ fprintf(tmp_fp, "%s\n", termcap); -+ fclose(tmp_fp); -+ tmp_fp = open_input(source_file, (char *) 0); -+ to_remove = source_file; -+ } else { -+ failed("tmpnam"); -+ } - } - } - } else { -@@ -682,24 +896,28 @@ - _nc_progname, - _nc_progname, - usage_string); -- cleanup(namelst); - ExitProgram(EXIT_FAILURE); - } - } - -- if (tmp_fp == 0) -- tmp_fp = open_input(source_file); -+ if (tmp_fp == 0) { -+ tmp_fp = open_input(source_file, my_altfile); -+ if (!strcmp(source_file, "-")) { -+ source_file = STDIN_NAME; -+ } -+ } - -- if (infodump) -+ if (infodump) { - dump_init(tversion, - smart_defaults - ? outform - : F_LITERAL, -- sortmode, width, debug_level, formatted); -- else if (capdump) -+ sortmode, width, height, debug_level, formatted); -+ } else if (capdump) { - dump_init(tversion, - outform, -- sortmode, width, debug_level, FALSE); -+ sortmode, width, height, debug_level, FALSE); -+ } - - /* parse entries out of the source file */ - _nc_set_source(source_file); -@@ -716,7 +934,6 @@ - /* do use resolution */ - if (check_only || (!infodump && !capdump) || forceresolve) { - if (!_nc_resolve_uses2(TRUE, literal) && !check_only) { -- cleanup(namelst); - ExitProgram(EXIT_FAILURE); - } - } -@@ -750,7 +967,7 @@ - - for_entry_list(qp) { - if (matches(namelst, qp->tterm.term_names)) { -- int j = qp->cend - qp->cstart; -+ long j = qp->cend - qp->cstart; - int len = 0; - - /* this is in case infotocap() generates warnings */ -@@ -767,7 +984,7 @@ - repair_acsc(&qp->tterm); - dump_entry(&qp->tterm, suppress_untranslatable, - limited, numbers, NULL); -- for (j = 0; j < (int) qp->nuses; j++) -+ for (j = 0; j < (long) qp->nuses; j++) - dump_uses(qp->uses[j].name, !capdump); - len = show_entry(); - if (debug_level != 0 && !limited) -@@ -811,7 +1028,6 @@ - else - fprintf(log_fp, "No entries written\n"); - } -- cleanup(namelst); - ExitProgram(EXIT_SUCCESS); - } - -@@ -915,18 +1131,18 @@ - return result; - } - --static int -+static long - keypad_index(const char *string) - { - char *test; - const char *list = "PQRSwxymtuvlqrsPpn"; /* app-keypad except "Enter" */ - int ch; -- int result = -1; -+ long result = -1; - - if ((ch = keypad_final(string)) != '\0') { -- test = strchr(list, ch); -+ test = (strchr) (list, ch); - if (test != 0) -- result = (test - list); -+ result = (long) (test - list); - } - return result; - } -@@ -1008,6 +1224,19 @@ - } - - #define EXPECTED(name) if (!PRESENT(name)) _nc_warning("expected " #name) -+#define UNEXPECTED(name) if (PRESENT(name)) _nc_warning("unexpected " #name ", for %s", why) -+ -+static void -+check_noaddress(TERMTYPE *tp, const char *why) -+{ -+ UNEXPECTED(column_address); -+ UNEXPECTED(cursor_address); -+ UNEXPECTED(cursor_home); -+ UNEXPECTED(cursor_mem_address); -+ UNEXPECTED(cursor_to_ll); -+ UNEXPECTED(row_address); -+ UNEXPECTED(row_address); -+} - - static void - check_cursor(TERMTYPE *tp) -@@ -1015,13 +1244,55 @@ - int count; - char *list[4]; - -+ if (hard_copy) { -+ check_noaddress(tp, "hard_copy"); -+ } else if (generic_type) { -+ check_noaddress(tp, "generic_type"); -+ } else if (strchr(tp->term_names, '+') == 0) { -+ int y = 0; -+ int x = 0; -+ if (PRESENT(column_address)) -+ ++y; -+ if (PRESENT(cursor_address)) -+ y = x = 10; -+ if (PRESENT(cursor_home)) -+ ++y, ++x; -+ if (PRESENT(cursor_mem_address)) -+ y = x = 10; -+ if (PRESENT(cursor_to_ll)) -+ ++y, ++x; -+ if (PRESENT(row_address)) -+ ++x; -+ if (PRESENT(cursor_down)) -+ ++y; -+ if (PRESENT(cursor_up)) -+ ++y; -+ if (PRESENT(cursor_left)) -+ ++x; -+ if (PRESENT(cursor_right)) -+ ++x; -+ if (x < 2 && y < 2) { -+ _nc_warning("terminal lacks cursor addressing"); -+ } else { -+ if (x < 2) -+ _nc_warning("terminal lacks cursor column-addressing"); -+ if (y < 2) -+ _nc_warning("terminal lacks cursor row-addressing"); -+ } -+ } -+ -+ /* it is rare to have an insert-line feature without a matching delete */ -+ ANDMISSING(parm_insert_line, insert_line); -+ ANDMISSING(parm_delete_line, delete_line); -+ ANDMISSING(parm_insert_line, parm_delete_line); -+ - /* if we have a parameterized form, then the non-parameterized is easy */ - ANDMISSING(parm_down_cursor, cursor_down); - ANDMISSING(parm_up_cursor, cursor_up); - ANDMISSING(parm_left_cursor, cursor_left); - ANDMISSING(parm_right_cursor, cursor_right); - -- /* Given any of a set of cursor movement, the whole set should be present. -+ /* Given any of a set of cursor movement, the whole set should be present. - * Technically this is not true (we could use cursor_address to fill in - * unsupported controls), but it is likely. - */ -@@ -1097,11 +1368,11 @@ - VALID_STRING(key_c1) && - VALID_STRING(key_c3)) { - char final[MAX_KP + 1]; -- int list[MAX_KP]; -+ long list[MAX_KP]; - int increase = 0; - int j, k, kk; -- int last; -- int test; -+ long last; -+ long test; - - final[0] = keypad_final(key_a1); - final[1] = keypad_final(key_a3); -@@ -1149,19 +1420,19 @@ - assert(strlen(show) < (MAX_KP * 4)); - switch (kk) { - case 0: -- strcat(show, " ka1"); -+ _nc_STRCAT(show, " ka1", sizeof(show)); - break; - case 1: -- strcat(show, " ka3"); -+ _nc_STRCAT(show, " ka3", sizeof(show)); - break; - case 2: -- strcat(show, " kb2"); -+ _nc_STRCAT(show, " kb2", sizeof(show)); - break; - case 3: -- strcat(show, " kc1"); -+ _nc_STRCAT(show, " kc1", sizeof(show)); - break; - case 4: -- strcat(show, " kc3"); -+ _nc_STRCAT(show, " kc3", sizeof(show)); - break; - } - } -@@ -1176,18 +1447,24 @@ - VALID_STRING(key_c3)) { - show[0] = '\0'; - if (keypad_index(key_a1) >= 0) -- strcat(show, " ka1"); -+ _nc_STRCAT(show, " ka1", sizeof(show)); - if (keypad_index(key_a3) >= 0) -- strcat(show, " ka3"); -+ _nc_STRCAT(show, " ka3", sizeof(show)); - if (keypad_index(key_b2) >= 0) -- strcat(show, " kb2"); -+ _nc_STRCAT(show, " kb2", sizeof(show)); - if (keypad_index(key_c1) >= 0) -- strcat(show, " kc1"); -+ _nc_STRCAT(show, " kc1", sizeof(show)); - if (keypad_index(key_c3) >= 0) -- strcat(show, " kc3"); -+ _nc_STRCAT(show, " kc3", sizeof(show)); - if (*show != '\0') - _nc_warning("vt100 keypad map incomplete:%s", show); - } -+ -+ /* -+ * These warnings are useful for consistency checks - it is possible that -+ * there are real terminals with mismatches in these -+ */ -+ ANDMISSING(key_ic, key_dc); - } - - static void -@@ -1216,6 +1493,74 @@ - ANDMISSING(parm_up_micro, micro_up); - } - -+static bool -+uses_SGR_39_49(const char *value) -+{ -+ return (strstr(value, "39;49") != 0 -+ || strstr(value, "49;39") != 0); -+} -+ -+/* -+ * Check consistency of termcap extensions related to "screen". -+ */ -+static void -+check_screen(TERMTYPE *tp) -+{ -+#if NCURSES_XNAMES -+ if (_nc_user_definable) { -+ int have_XT = tigetflag("XT"); -+ int have_XM = tigetflag("XM"); -+ int have_bce = back_color_erase; -+ bool have_kmouse = FALSE; -+ bool use_sgr_39_49 = FALSE; -+ char *name = _nc_first_name(tp->term_names); -+ -+ if (!VALID_BOOLEAN(have_bce)) { -+ have_bce = FALSE; -+ } -+ if (!VALID_BOOLEAN(have_XM)) { -+ have_XM = FALSE; -+ } -+ if (!VALID_BOOLEAN(have_XT)) { -+ have_XT = FALSE; -+ } -+ if (VALID_STRING(key_mouse)) { -+ have_kmouse = !strcmp("\033[M", key_mouse); -+ } -+ if (VALID_STRING(orig_colors)) { -+ use_sgr_39_49 = uses_SGR_39_49(orig_colors); -+ } else if (VALID_STRING(orig_pair)) { -+ use_sgr_39_49 = uses_SGR_39_49(orig_pair); -+ } -+ -+ if (have_XM && have_XT) { -+ _nc_warning("Screen's XT capability conflicts with XM"); -+ } else if (have_XT -+ && strstr(name, "screen") != 0 -+ && strchr(name, '.') != 0) { -+ _nc_warning("Screen's \"screen\" entries should not have XT set"); -+ } else if (have_XT) { -+ if (!have_kmouse && have_bce) { -+ if (VALID_STRING(key_mouse)) { -+ _nc_warning("Value of kmous inconsistent with screen's usage"); -+ } else { -+ _nc_warning("Expected kmous capability with XT"); -+ } -+ } -+ if (!have_bce && max_colors > 0) -+ _nc_warning("Expected bce capability with XT"); -+ if (!use_sgr_39_49 && have_bce && max_colors > 0) -+ _nc_warning("Expected orig_colors capability with XT to have 39/49 parameters"); -+ if (VALID_STRING(to_status_line)) -+ _nc_warning("\"tsl\" capability is redundant, given XT"); -+ } else { -+ if (have_kmouse && !have_XM) -+ _nc_warning("Expected XT to be set, given kmous"); -+ } -+ } -+#endif -+} -+ - /* - * Returns the expected number of parameters for the given capability. - */ -@@ -1527,7 +1872,7 @@ - show_where(unsigned level) - { - if (_nc_tracing >= DEBUG_LEVEL(level)) { -- char my_name[256]; -+ char my_name[MAX_NAME_SIZE]; - _nc_get_type(my_name); - _tracef("\"%s\", line %d, '%s'", - _nc_get_source(), -@@ -1539,6 +1884,58 @@ - #define show_where(level) /* nothing */ - #endif - -+typedef struct { -+ int keycode; -+ const char *name; -+ const char *value; -+} NAME_VALUE; -+ -+static NAME_VALUE * -+get_fkey_list(TERMTYPE *tp) -+{ -+ NAME_VALUE *result = typeMalloc(NAME_VALUE, NUM_STRINGS(tp) + 1); -+ const struct tinfo_fkeys *all_fkeys = _nc_tinfo_fkeys; -+ int used = 0; -+ int j; -+ -+ if (result == 0) -+ failed("get_fkey_list"); -+ -+ for (j = 0; all_fkeys[j].code; j++) { -+ char *a = tp->Strings[all_fkeys[j].offset]; -+ if (VALID_STRING(a)) { -+ result[used].keycode = (int) all_fkeys[j].code; -+ result[used].name = strnames[all_fkeys[j].offset]; -+ result[used].value = a; -+ ++used; -+ } -+ } -+#if NCURSES_XNAMES -+ for (j = STRCOUNT; j < NUM_STRINGS(tp); ++j) { -+ const char *name = ExtStrname(tp, j, strnames); -+ if (*name == 'k') { -+ result[used].keycode = -1; -+ result[used].name = name; -+ result[used].value = tp->Strings[j]; -+ ++used; -+ } -+ } -+#endif -+ result[used].keycode = 0; -+ return result; -+} -+ -+static void -+show_fkey_name(NAME_VALUE * data) -+{ -+ if (data->keycode > 0) { -+ fprintf(stderr, " %s", keyname(data->keycode)); -+ fprintf(stderr, " (capability \"%s\")", data->name); -+ } else { -+ fprintf(stderr, " capability \"%s\"", data->name); -+ } -+} -+ - /* other sanity-checks (things that we don't want in the normal - * logic that reads a terminfo entry) - */ -@@ -1547,7 +1944,6 @@ - { - bool conflict = FALSE; - unsigned j, k; -- char fkeys[STRCOUNT]; - - /* - * A terminal entry may contain more than one keycode assigned to -@@ -1555,44 +1951,50 @@ - * return one (the last one assigned). - */ - if (!(_nc_syntax == SYN_TERMCAP && capdump)) { -- memset(fkeys, 0, sizeof(fkeys)); -- for (j = 0; _nc_tinfo_fkeys[j].code; j++) { -- char *a = tp->Strings[_nc_tinfo_fkeys[j].offset]; -+ char *check = calloc((size_t) (NUM_STRINGS(tp) + 1), sizeof(char)); -+ NAME_VALUE *given = get_fkey_list(tp); -+ -+ if (check == 0) -+ failed("check_termtype"); -+ -+ for (j = 0; given[j].keycode; ++j) { -+ const char *a = given[j].value; - bool first = TRUE; -- if (!VALID_STRING(a)) -- continue; -- for (k = j + 1; _nc_tinfo_fkeys[k].code; k++) { -- char *b = tp->Strings[_nc_tinfo_fkeys[k].offset]; -- if (!VALID_STRING(b) -- || fkeys[k]) -+ -+ for (k = j + 1; given[k].keycode; k++) { -+ const char *b = given[k].value; -+ if (check[k]) - continue; - if (!_nc_capcmp(a, b)) { -- fkeys[j] = 1; -- fkeys[k] = 1; -+ check[j] = 1; -+ check[k] = 1; - if (first) { - if (!conflict) { - _nc_warning("Conflicting key definitions (using the last)"); - conflict = TRUE; - } -- fprintf(stderr, "... %s is the same as %s", -- keyname((int) _nc_tinfo_fkeys[j].code), -- keyname((int) _nc_tinfo_fkeys[k].code)); -+ fprintf(stderr, "..."); -+ show_fkey_name(given + j); -+ fprintf(stderr, " is the same as"); -+ show_fkey_name(given + k); - first = FALSE; - } else { -- fprintf(stderr, ", %s", -- keyname((int) _nc_tinfo_fkeys[k].code)); -+ fprintf(stderr, ", "); -+ show_fkey_name(given + k); - } - } - } - if (!first) - fprintf(stderr, "\n"); - } -+ free(given); -+ free(check); - } - -- for (j = 0; j < NUM_STRINGS(tp); j++) { -+ for_each_string(j, tp) { - char *a = tp->Strings[j]; - if (VALID_STRING(a)) -- check_params(tp, ExtStrname(tp, j, strnames), a); -+ check_params(tp, ExtStrname(tp, (int) j, strnames), a); - } - - check_acs(tp); -@@ -1600,6 +2002,7 @@ - check_cursor(tp); - check_keypad(tp); - check_printer(tp); -+ check_screen(tp); - - /* - * These may be mismatched because the terminal description relies on -diff -Naur ncurses-5.9/progs/toe.c ncurses-5.9.patch/progs/toe.c ---- ncurses-5.9/progs/toe.c 2010-05-02 00:04:08.000000000 +0200 -+++ ncurses-5.9.patch/progs/toe.c 2014-09-01 16:33:22.523792397 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2008,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -44,12 +44,23 @@ - #include <hashed_db.h> - #endif - --MODULE_ID("$Id: toe.c,v 1.52 2010/05/01 22:04:08 tom Exp $") -+MODULE_ID("$Id: toe.c,v 1.74 2013/12/15 01:08:28 tom Exp $") - - #define isDotname(name) (!strcmp(name, ".") || !strcmp(name, "..")) - -+typedef struct { -+ int db_index; -+ unsigned long checksum; -+ char *term_name; -+ char *description; -+} TERMDATA; -+ - const char *_nc_progname; - -+static TERMDATA *ptr_termdata; /* array of terminal data */ -+static size_t use_termdata; /* actual usage in ptr_termdata[] */ -+static size_t len_termdata; /* allocated size of ptr_termdata[] */ -+ - #if NO_LEAKS - #undef ExitProgram - static void ExitProgram(int code) GCC_NORETURN; -@@ -61,6 +72,8 @@ - } - #endif - -+static void failed(const char *) GCC_NORETURN; -+ - static void - failed(const char *msg) - { -@@ -68,6 +81,150 @@ - ExitProgram(EXIT_FAILURE); - } - -+static char * -+strmalloc(const char *value) -+{ -+ char *result = strdup(value); -+ if (result == 0) { -+ failed("strmalloc"); -+ } -+ return result; -+} -+ -+static TERMDATA * -+new_termdata(void) -+{ -+ size_t want = use_termdata + 1; -+ -+ if (want >= len_termdata) { -+ len_termdata = (2 * want) + 10; -+ ptr_termdata = typeRealloc(TERMDATA, len_termdata, ptr_termdata); -+ if (ptr_termdata == 0) -+ failed("ptr_termdata"); -+ } -+ -+ return ptr_termdata + use_termdata++; -+} -+ -+static int -+compare_termdata(const void *a, const void *b) -+{ -+ const TERMDATA *p = (const TERMDATA *) a; -+ const TERMDATA *q = (const TERMDATA *) b; -+ int result = strcmp(p->term_name, q->term_name); -+ -+ if (result == 0) { -+ result = (p->db_index - q->db_index); -+ } -+ return result; -+} -+ -+/* -+ * Sort the array of TERMDATA and print it. If more than one database is being -+ * reported, add a column to show which database has a given entry. -+ */ -+static void -+show_termdata(int eargc, char **eargv) -+{ -+ int j, k; -+ size_t n; -+ -+ if (use_termdata) { -+ if (eargc > 1) { -+ for (j = 0; j < eargc; ++j) { -+ for (k = 0; k <= j; ++k) { -+ printf("--"); -+ } -+ printf("> "); -+ printf("%s\n", eargv[j]); -+ } -+ } -+ if (use_termdata > 1) -+ qsort(ptr_termdata, use_termdata, sizeof(TERMDATA), compare_termdata); -+ for (n = 0; n < use_termdata; ++n) { -+ -+ /* -+ * If there is more than one database, show how they differ. -+ */ -+ if (eargc > 1) { -+ unsigned long check = 0; -+ k = 0; -+ for (;;) { -+ for (; k < ptr_termdata[n].db_index; ++k) { -+ printf("--"); -+ } -+ -+ /* -+ * If this is the first entry, or its checksum differs -+ * from the first entry's checksum, print "*". Otherwise -+ * it looks enough like a duplicate to print "+". -+ */ -+ printf("%c-", ((check == 0 -+ || (check != ptr_termdata[n].checksum)) -+ ? '*' -+ : '+')); -+ check = ptr_termdata[n].checksum; -+ -+ ++k; -+ if ((n + 1) >= use_termdata -+ || strcmp(ptr_termdata[n].term_name, -+ ptr_termdata[n + 1].term_name)) { -+ break; -+ } -+ ++n; -+ } -+ for (; k < eargc; ++k) { -+ printf("--"); -+ } -+ printf(":\t"); -+ } -+ -+ (void) printf("%-10s\t%s\n", -+ ptr_termdata[n].term_name, -+ ptr_termdata[n].description); -+ } -+ } -+} -+ -+static void -+free_termdata(void) -+{ -+ if (ptr_termdata != 0) { -+ while (use_termdata != 0) { -+ --use_termdata; -+ free(ptr_termdata[use_termdata].term_name); -+ free(ptr_termdata[use_termdata].description); -+ } -+ free(ptr_termdata); -+ ptr_termdata = 0; -+ } -+ use_termdata = 0; -+ len_termdata = 0; -+} -+ -+static char ** -+allocArgv(size_t count) -+{ -+ char **result = typeCalloc(char *, count + 1); -+ if (result == 0) -+ failed("realloc eargv"); -+ -+ assert(result != 0); -+ return result; -+} -+ -+static void -+freeArgv(char **argv) -+{ -+ if (argv) { -+ int count = 0; -+ while (argv[count]) { -+ free(argv[count++]); -+ } -+ free(argv); -+ } -+} -+ - #if USE_HASHED_DB - static bool - make_db_name(char *dst, const char *src, unsigned limit) -@@ -75,67 +232,100 @@ - static const char suffix[] = DBM_SUFFIX; - - bool result = FALSE; -- unsigned lens = sizeof(suffix) - 1; -- unsigned size = strlen(src); -- unsigned need = lens + size; -+ size_t lens = sizeof(suffix) - 1; -+ size_t size = strlen(src); -+ size_t need = lens + size; - - if (need <= limit) { - if (size >= lens -- && !strcmp(src + size - lens, suffix)) -- (void) strcpy(dst, src); -- else -- (void) sprintf(dst, "%s%s", src, suffix); -+ && !strcmp(src + size - lens, suffix)) { -+ _nc_STRCPY(dst, src, PATH_MAX); -+ } else { -+ _nc_SPRINTF(dst, _nc_SLIMIT(PATH_MAX) "%s%s", src, suffix); -+ } - result = TRUE; - } - return result; - } - #endif - --static bool --is_database(const char *path) -+typedef void (DescHook) (int /* db_index */ , -+ int /* db_limit */ , -+ const char * /* term_name */ , -+ TERMTYPE * /* term */ ); -+ -+static const char * -+term_description(TERMTYPE *tp) - { -- bool result = FALSE; --#if USE_DATABASE -- if (_nc_is_dir_path(path) && access(path, R_OK | X_OK) == 0) { -- result = TRUE; -- } --#endif --#if USE_TERMCAP -- if (_nc_is_file_path(path) && access(path, R_OK) == 0) { -- result = TRUE; -+ const char *desc; -+ -+ if (tp->term_names == 0 -+ || (desc = strrchr(tp->term_names, '|')) == 0 -+ || (*++desc == '\0')) { -+ desc = "(No description)"; - } --#endif --#if USE_HASHED_DB -- if (!result) { -- char filename[PATH_MAX]; -- if (_nc_is_file_path(path) && access(path, R_OK) == 0) { -- result = TRUE; -- } else if (make_db_name(filename, path, sizeof(filename))) { -- if (_nc_is_file_path(filename) && access(filename, R_OK) == 0) { -- result = TRUE; -- } -+ -+ return desc; -+} -+ -+/* display a description for the type */ -+static void -+deschook(int db_index, int db_limit, const char *term_name, TERMTYPE *tp) -+{ -+ (void) db_index; -+ (void) db_limit; -+ (void) printf("%-10s\t%s\n", term_name, term_description(tp)); -+} -+ -+static unsigned long -+string_sum(const char *value) -+{ -+ unsigned long result = 0; -+ -+ if ((intptr_t) value == (intptr_t) (-1)) { -+ result = ~result; -+ } else if (value) { -+ while (*value) { -+ result += UChar(*value); -+ ++value; - } - } --#endif - return result; - } - --static void --deschook(const char *cn, TERMTYPE *tp) --/* display a description for the type */ -+static unsigned long -+checksum_of(TERMTYPE *tp) - { -- const char *desc; -+ unsigned long result = string_sum(tp->term_names); -+ unsigned i; - -- if ((desc = strrchr(tp->term_names, '|')) == 0 || *++desc == '\0') -- desc = "(No description)"; -+ for (i = 0; i < NUM_BOOLEANS(tp); i++) { -+ result += (unsigned long) (tp->Booleans[i]); -+ } -+ for (i = 0; i < NUM_NUMBERS(tp); i++) { -+ result += (unsigned long) (tp->Numbers[i]); -+ } -+ for (i = 0; i < NUM_STRINGS(tp); i++) { -+ result += string_sum(tp->Strings[i]); -+ } -+ return result; -+} -+ -+/* collect data, to sort before display */ -+static void -+sorthook(int db_index, int db_limit, const char *term_name, TERMTYPE *tp) -+{ -+ TERMDATA *data = new_termdata(); - -- (void) printf("%-10s\t%s\n", cn, desc); -+ data->db_index = db_index; -+ data->checksum = ((db_limit > 1) ? checksum_of(tp) : 0); -+ data->term_name = strmalloc(term_name); -+ data->description = strmalloc(term_description(tp)); - } - --#if USE_TERMCAP -+#if NCURSES_USE_TERMCAP - static void --show_termcap(char *buffer, -- void (*hook) (const char *, TERMTYPE *tp)) -+show_termcap(int db_index, int db_limit, char *buffer, DescHook hook) - { - TERMTYPE data; - char *next = strchr(buffer, ':'); -@@ -149,26 +339,42 @@ - if (last) - ++last; - -- data.term_names = strdup(buffer); -+ memset(&data, 0, sizeof(data)); -+ data.term_names = strmalloc(buffer); - while ((next = strtok(list, "|")) != 0) { - if (next != last) -- hook(next, &data); -+ hook(db_index, db_limit, next, &data); - list = 0; - } - free(data.term_names); - } - #endif - -+#if NCURSES_USE_DATABASE -+static char * -+copy_entryname(DIRENT * src) -+{ -+ size_t len = NAMLEN(src); -+ char *result = malloc(len + 1); -+ if (result == 0) -+ failed("copy entryname"); -+ memcpy(result, src->d_name, len); -+ result[len] = '\0'; -+ -+ return result; -+} -+#endif -+ - static int - typelist(int eargc, char *eargv[], -- bool verbosity, -- void (*hook) (const char *, TERMTYPE *tp)) -+ int verbosity, -+ DescHook hook) - /* apply a function to each entry in given terminfo directories */ - { - int i; - - for (i = 0; i < eargc; i++) { --#if USE_DATABASE -+#if NCURSES_USE_DATABASE - if (_nc_is_dir_path(eargv[i])) { - char *cwd_buf = 0; - DIR *termdir; -@@ -179,28 +385,35 @@ - (void) fprintf(stderr, - "%s: can't open terminfo directory %s\n", - _nc_progname, eargv[i]); -- return (EXIT_FAILURE); -- } else if (verbosity) -+ continue; -+ } -+ -+ if (verbosity) - (void) printf("#\n#%s:\n#\n", eargv[i]); - - while ((subdir = readdir(termdir)) != 0) { -- size_t len = NAMLEN(subdir); -- size_t cwd_len = len + strlen(eargv[i]) + 3; -- char name_1[PATH_MAX]; -+ size_t cwd_len; -+ char *name_1; - DIR *entrydir; - DIRENT *entry; - -+ name_1 = copy_entryname(subdir); -+ if (isDotname(name_1)) { -+ free(name_1); -+ continue; -+ } -+ -+ cwd_len = NAMLEN(subdir) + strlen(eargv[i]) + 3; - cwd_buf = typeRealloc(char, cwd_len, cwd_buf); - if (cwd_buf == 0) - failed("realloc cwd_buf"); - - assert(cwd_buf != 0); - -- strncpy(name_1, subdir->d_name, len)[len] = '\0'; -- if (isDotname(name_1)) -- continue; -+ _nc_SPRINTF(cwd_buf, _nc_SLIMIT(cwd_len) -+ "%s/%s/", eargv[i], name_1); -+ free(name_1); - -- (void) sprintf(cwd_buf, "%s/%.*s/", eargv[i], (int) len, name_1); - if (chdir(cwd_buf) != 0) - continue; - -@@ -210,15 +423,16 @@ - continue; - } - while ((entry = readdir(entrydir)) != 0) { -- char name_2[PATH_MAX]; -+ char *name_2; - TERMTYPE lterm; - char *cn; - int status; - -- len = NAMLEN(entry); -- strncpy(name_2, entry->d_name, len)[len] = '\0'; -- if (isDotname(name_2) || !_nc_is_file_path(name_2)) -+ name_2 = copy_entryname(entry); -+ if (isDotname(name_2) || !_nc_is_file_path(name_2)) { -+ free(name_2); - continue; -+ } - - status = _nc_read_file_entry(name_2, &lterm); - if (status <= 0) { -@@ -226,6 +440,10 @@ - (void) fprintf(stderr, - "%s: couldn't open terminfo file %s.\n", - _nc_progname, name_2); -+ free(cwd_buf); -+ free(name_2); -+ closedir(entrydir); -+ closedir(termdir); - return (EXIT_FAILURE); - } - -@@ -233,21 +451,26 @@ - cn = _nc_first_name(lterm.term_names); - if (!strcmp(cn, name_2)) { - /* apply the selected hook function */ -- (*hook) (cn, &lterm); -+ hook(i, eargc, cn, &lterm); - } - _nc_free_termtype(&lterm); -+ free(name_2); - } - closedir(entrydir); - } - closedir(termdir); - if (cwd_buf != 0) - free(cwd_buf); -+ continue; - } - #if USE_HASHED_DB - else { - DB *capdbp; - char filename[PATH_MAX]; - -+ if (verbosity) -+ (void) printf("#\n#%s:\n#\n", eargv[i]); -+ - if (make_db_name(filename, eargv[i], sizeof(filename))) { - if ((capdbp = _nc_db_open(filename, FALSE)) != 0) { - DBT key, data; -@@ -265,7 +488,7 @@ - /* only visit things once, by primary name */ - cn = _nc_first_name(lterm.term_names); - /* apply the selected hook function */ -- (*hook) (cn, &lterm); -+ hook(i, eargc, cn, &lterm); - _nc_free_termtype(&lterm); - } - } -@@ -273,44 +496,51 @@ - } - - _nc_db_close(capdbp); -+ continue; - } - } - } - #endif - #endif --#if USE_TERMCAP -+#if NCURSES_USE_TERMCAP - #if HAVE_BSD_CGETENT -- char *db_array[2]; -- char *buffer = 0; -+ { -+ CGETENT_CONST char *db_array[2]; -+ char *buffer = 0; - -- if (verbosity) -- (void) printf("#\n#%s:\n#\n", eargv[i]); -+ if (verbosity) -+ (void) printf("#\n#%s:\n#\n", eargv[i]); - -- db_array[0] = eargv[i]; -- db_array[1] = 0; -+ db_array[0] = eargv[i]; -+ db_array[1] = 0; - -- if (cgetfirst(&buffer, db_array)) { -- show_termcap(buffer, hook); -- free(buffer); -- while (cgetnext(&buffer, db_array)) { -- show_termcap(buffer, hook); -+ if (cgetfirst(&buffer, db_array) > 0) { -+ show_termcap(i, eargc, buffer, hook); - free(buffer); -+ while (cgetnext(&buffer, db_array) > 0) { -+ show_termcap(i, eargc, buffer, hook); -+ free(buffer); -+ } -+ cgetclose(); -+ continue; - } - } -- cgetclose(); - #else - /* scan termcap text-file only */ - if (_nc_is_file_path(eargv[i])) { - char buffer[2048]; - FILE *fp; - -+ if (verbosity) -+ (void) printf("#\n#%s:\n#\n", eargv[i]); -+ - if ((fp = fopen(eargv[i], "r")) != 0) { - while (fgets(buffer, sizeof(buffer), fp) != 0) { - if (*buffer == '#') - continue; - if (isspace(*buffer)) - continue; -- show_termcap(buffer, hook); -+ show_termcap(i, eargc, buffer, hook); - } - fclose(fp); - } -@@ -319,13 +549,18 @@ - #endif - } - -+ if (hook == sorthook) { -+ show_termdata(eargc, eargv); -+ free_termdata(); -+ } -+ - return (EXIT_SUCCESS); - } - - static void - usage(void) - { -- (void) fprintf(stderr, "usage: %s [-ahuUV] [-v n] [file...]\n", _nc_progname); -+ (void) fprintf(stderr, "usage: %s [-ahsuUV] [-v n] [file...]\n", _nc_progname); - ExitProgram(EXIT_FAILURE); - } - -@@ -340,23 +575,24 @@ - unsigned i; - int code; - int this_opt, last_opt = '?'; -- int v_opt = 0; -+ unsigned v_opt = 0; -+ DescHook *hook = deschook; - - _nc_progname = _nc_rootname(argv[0]); - -- while ((this_opt = getopt(argc, argv, "0123456789ahu:vU:V")) != -1) { -+ while ((this_opt = getopt(argc, argv, "0123456789ahsu:vU:V")) != -1) { - /* handle optional parameter */ - if (isdigit(this_opt)) { - switch (last_opt) { - case 'v': -- v_opt = (this_opt - '0'); -+ v_opt = (unsigned) (this_opt - '0'); - break; - default: - if (isdigit(last_opt)) - v_opt *= 10; - else - v_opt = 0; -- v_opt += (this_opt - '0'); -+ v_opt += (unsigned) (this_opt - '0'); - last_opt = this_opt; - } - continue; -@@ -368,6 +604,9 @@ - case 'h': - header = TRUE; - break; -+ case 's': -+ hook = sorthook; -+ break; - case 'u': - direct_dependencies = TRUE; - report_file = optarg; -@@ -450,7 +689,7 @@ - * If we get this far, user wants a simple terminal type listing. - */ - if (optind < argc) { -- code = typelist(argc - optind, argv + optind, header, deschook); -+ code = typelist(argc - optind, argv + optind, header, hook); - } else if (all_dirs) { - DBDIRS state; - int offset; -@@ -460,64 +699,41 @@ - - code = EXIT_FAILURE; - for (pass = 0; pass < 2; ++pass) { -- unsigned count = 0; -+ size_t count = 0; - - _nc_first_db(&state, &offset); - while ((path = _nc_next_db(&state, &offset)) != 0) { -- if (!is_database(path)) { -- ; -- } else if (eargv != 0) { -- unsigned n; -- int found = FALSE; -- -- /* eliminate duplicates */ -- for (n = 0; n < count; ++n) { -- if (!strcmp(path, eargv[n])) { -- found = TRUE; -- break; -- } -- } -- if (!found) { -- eargv[count] = strdup(path); -- ++count; -- } -- } else { -- ++count; -+ if (pass) { -+ eargv[count] = strmalloc(path); - } -+ ++count; - } - if (!pass) { -- eargv = typeCalloc(char *, count + 1); -+ eargv = allocArgv(count); - if (eargv == 0) -- failed("realloc eargv"); -- -- assert(eargv != 0); -+ failed("eargv"); - } else { -- code = typelist((int) count, eargv, header, deschook); -- while (count-- > 0) -- free(eargv[count]); -- free(eargv); -+ code = typelist((int) count, eargv, header, hook); -+ freeArgv(eargv); - } - } - } else { - DBDIRS state; - int offset; - const char *path; -- char *eargv[3]; -- int count = 0; -+ char **eargv = allocArgv((size_t) 2); -+ size_t count = 0; - -+ if (eargv == 0) -+ failed("eargv"); - _nc_first_db(&state, &offset); -- while ((path = _nc_next_db(&state, &offset)) != 0) { -- if (is_database(path)) { -- eargv[count++] = strdup(path); -- break; -- } -+ if ((path = _nc_next_db(&state, &offset)) != 0) { -+ eargv[count++] = strmalloc(path); - } -- eargv[count] = 0; - -- code = typelist(count, eargv, header, deschook); -+ code = typelist((int) count, eargv, header, hook); - -- while (count-- > 0) -- free(eargv[count]); -+ freeArgv(eargv); - } - _nc_last_db(); - -diff -Naur ncurses-5.9/progs/tput.c ncurses-5.9.patch/progs/tput.c ---- ncurses-5.9/progs/tput.c 2010-01-09 17:53:24.000000000 +0100 -+++ ncurses-5.9.patch/progs/tput.c 2014-09-01 16:33:22.524792400 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -47,7 +47,7 @@ - #endif - #include <transform.h> - --MODULE_ID("$Id: tput.c,v 1.46 2010/01/09 16:53:24 tom Exp $") -+MODULE_ID("$Id: tput.c,v 1.49 2013/09/28 20:57:25 tom Exp $") - - #define PUTS(s) fputs(s, stdout) - #define PUTCHAR(c) putchar(c) -@@ -94,9 +94,6 @@ - * Lookup the type of call we should make to tparm(). This ignores the actual - * terminfo capability (bad, because it is not extensible), but makes this - * code portable to platforms where sizeof(int) != sizeof(char *). -- * -- * FIXME: If we want extensibility, analyze the capability string as we do -- * in tparm() to decide how to parse the varargs list. - */ - static TParams - tparm_type(const char *name) -@@ -306,7 +303,7 @@ - } else if (s != ABSENT_STRING) { - if (argc > 1) { - int k; -- int popcount; -+ int ignored; - long numbers[1 + NUM_PARM]; - char *strings[1 + NUM_PARM]; - char *p_is_s[NUM_PARM]; -@@ -337,8 +334,8 @@ - break; - case Numbers: - default: -- (void) _nc_tparm_analyze(s, p_is_s, &popcount); --#define myParam(n) (p_is_s[n - 1] != 0 ? ((long) strings[n]) : numbers[n]) -+ (void) _nc_tparm_analyze(s, p_is_s, &ignored); -+#define myParam(n) (p_is_s[n - 1] != 0 ? ((TPARM_ARG) strings[n]) : numbers[n]) - s = TPARM_9(s, - myParam(1), - myParam(2), -diff -Naur ncurses-5.9/progs/transform.c ncurses-5.9.patch/progs/transform.c ---- ncurses-5.9/progs/transform.c 2010-09-04 23:16:17.000000000 +0200 -+++ ncurses-5.9.patch/progs/transform.c 2014-09-01 16:33:22.524792400 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 2009-2010,2011 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -34,21 +34,21 @@ - - #include <transform.h> - --MODULE_ID("$Id: transform.c,v 1.2 2010/09/04 21:16:17 tom Exp $") -+MODULE_ID("$Id: transform.c,v 1.3 2011/05/14 22:41:17 tom Exp $") - - #ifdef SUFFIX_IGNORED - static void --trim_suffix(const char *a, unsigned *len) -+trim_suffix(const char *a, size_t *len) - { - const char ignore[] = SUFFIX_IGNORED; - - if (sizeof(ignore) != 0) { - bool trim = FALSE; -- unsigned need = (sizeof(ignore) - 1); -+ size_t need = (sizeof(ignore) - 1); - - if (*len > need) { -- unsigned first = *len - need; -- unsigned n; -+ size_t first = *len - need; -+ size_t n; - trim = TRUE; - for (n = first; n < *len; ++n) { - if (tolower(UChar(a[n])) != tolower(UChar(ignore[n - first]))) { -@@ -69,8 +69,8 @@ - bool - same_program(const char *a, const char *b) - { -- unsigned len_a = strlen(a); -- unsigned len_b = strlen(b); -+ size_t len_a = strlen(a); -+ size_t len_b = strlen(b); - - trim_suffix(a, &len_a); - trim_suffix(b, &len_b); -diff -Naur ncurses-5.9/progs/tset.c ncurses-5.9.patch/progs/tset.c ---- ncurses-5.9/progs/tset.c 2010-05-01 23:42:46.000000000 +0200 -+++ ncurses-5.9.patch/progs/tset.c 2014-09-01 16:33:22.524792400 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -119,7 +119,7 @@ - #include <dump_entry.h> - #include <transform.h> - --MODULE_ID("$Id: tset.c,v 1.82 2010/05/01 21:42:46 tom Exp $") -+MODULE_ID("$Id: tset.c,v 1.93 2013/12/15 01:05:56 tom Exp $") - - /* - * SCO defines TIOCGSIZE and the corresponding struct. Other systems (SunOS, -@@ -148,6 +148,10 @@ - #undef CTRL - #define CTRL(x) ((x) & 0x1f) - -+static void failed(const char *) GCC_NORETURN; -+static void exit_error(void) GCC_NORETURN; -+static void err(const char *,...) GCC_NORETURN; -+ - const char *_nc_progname = "tset"; - - static TTY mode, oldmode, original; -@@ -160,7 +164,10 @@ - static int terasechar = -1; /* new erase character */ - static int intrchar = -1; /* new interrupt character */ - static int tkillchar = -1; /* new kill character */ -+ -+#if HAVE_SIZECHANGE - static int tlines, tcolumns; /* window size */ -+#endif - - #define LOWERCASE(c) ((isalpha(UChar(c)) && isupper(UChar(c))) ? tolower(UChar(c)) : (c)) - -@@ -203,13 +210,13 @@ - failed(const char *msg) - { - char temp[BUFSIZ]; -- unsigned len = strlen(_nc_progname) + 2; -+ size_t len = strlen(_nc_progname) + 2; - - if ((int) len < (int) sizeof(temp) - 12) { -- strcpy(temp, _nc_progname); -- strcat(temp, ": "); -+ _nc_STRCPY(temp, _nc_progname, sizeof(temp)); -+ _nc_STRCAT(temp, ": ", sizeof(temp)); - } else { -- strcpy(temp, "tset: "); -+ _nc_STRCPY(temp, "tset: ", sizeof(temp)); - } - perror(strncat(temp, msg, sizeof(temp) - strlen(temp) - 2)); - exit_error(); -@@ -467,9 +474,6 @@ - mapp->speed = tbaudrate(p); - } - -- if (arg == (char *) 0) /* Non-optional type. */ -- goto badmopt; -- - mapp->type = arg; - - /* Terminate porttype, if specified. */ -@@ -527,19 +531,19 @@ - match = TRUE; - break; - case EQ: -- match = (ospeed == mapp->speed); -+ match = ((int) ospeed == mapp->speed); - break; - case GE: -- match = (ospeed >= mapp->speed); -+ match = ((int) ospeed >= mapp->speed); - break; - case GT: -- match = (ospeed > mapp->speed); -+ match = ((int) ospeed > mapp->speed); - break; - case LE: -- match = (ospeed <= mapp->speed); -+ match = ((int) ospeed <= mapp->speed); - break; - case LT: -- match = (ospeed < mapp->speed); -+ match = ((int) ospeed < mapp->speed); - break; - default: - match = FALSE; -@@ -631,13 +635,14 @@ - * real entry from /etc/termcap. This prevents us from being fooled - * by out of date stuff in the environment. - */ -- found:if ((p = getenv("TERMCAP")) != 0 && !_nc_is_abs_path(p)) { -+ found: -+ if ((p = getenv("TERMCAP")) != 0 && !_nc_is_abs_path(p)) { - /* 'unsetenv("TERMCAP")' is not portable. - * The 'environ' array is better. - */ - int n; - for (n = 0; environ[n] != 0; n++) { -- if (!strncmp("TERMCAP=", environ[n], 8)) { -+ if (!strncmp("TERMCAP=", environ[n], (size_t) 8)) { - while ((environ[n] = environ[n + 1]) != 0) { - n++; - } -@@ -788,14 +793,14 @@ - mode.c_cc[VWERASE] = CHK(mode.c_cc[VWERASE], CWERASE); - #endif - -- mode.c_iflag &= ~(IGNBRK | PARMRK | INPCK | ISTRIP | INLCR | IGNCR -+ mode.c_iflag &= ~((unsigned) (IGNBRK | PARMRK | INPCK | ISTRIP | INLCR | IGNCR - #ifdef IUCLC -- | IUCLC -+ | IUCLC - #endif - #ifdef IXANY -- | IXANY -+ | IXANY - #endif -- | IXOFF); -+ | IXOFF)); - - mode.c_iflag |= (BRKINT | IGNPAR | ICRNL | IXON - #ifdef IMAXBEL -@@ -803,44 +808,44 @@ - #endif - ); - -- mode.c_oflag &= ~(0 -+ mode.c_oflag &= ~((unsigned) (0 - #ifdef OLCUC -- | OLCUC -+ | OLCUC - #endif - #ifdef OCRNL -- | OCRNL -+ | OCRNL - #endif - #ifdef ONOCR -- | ONOCR -+ | ONOCR - #endif - #ifdef ONLRET -- | ONLRET -+ | ONLRET - #endif - #ifdef OFILL -- | OFILL -+ | OFILL - #endif - #ifdef OFDEL -- | OFDEL -+ | OFDEL - #endif - #ifdef NLDLY -- | NLDLY -+ | NLDLY - #endif - #ifdef CRDLY -- | CRDLY -+ | CRDLY - #endif - #ifdef TABDLY -- | TABDLY -+ | TABDLY - #endif - #ifdef BSDLY -- | BSDLY -+ | BSDLY - #endif - #ifdef VTDLY -- | VTDLY -+ | VTDLY - #endif - #ifdef FFDLY -- | FFDLY -+ | FFDLY - #endif -- ); -+ )); - - mode.c_oflag |= (OPOST - #ifdef ONLCR -@@ -848,19 +853,19 @@ - #endif - ); - -- mode.c_cflag &= ~(CSIZE | CSTOPB | PARENB | PARODD | CLOCAL); -+ mode.c_cflag &= ~((unsigned) (CSIZE | CSTOPB | PARENB | PARODD | CLOCAL)); - mode.c_cflag |= (CS8 | CREAD); -- mode.c_lflag &= ~(ECHONL | NOFLSH -+ mode.c_lflag &= ~((unsigned) (ECHONL | NOFLSH - #ifdef TOSTOP -- | TOSTOP -+ | TOSTOP - #endif - #ifdef ECHOPTR -- | ECHOPRT -+ | ECHOPRT - #endif - #ifdef XCASE -- | XCASE -+ | XCASE - #endif -- ); -+ )); - - mode.c_lflag |= (ISIG | ICANON | ECHO | ECHOE | ECHOK - #ifdef ECHOCTL -@@ -907,14 +912,23 @@ - set_control_chars(void) - { - #ifdef TERMIOS -- if (DISABLED(mode.c_cc[VERASE]) || terasechar >= 0) -- mode.c_cc[VERASE] = (terasechar >= 0) ? terasechar : default_erase(); -- -- if (DISABLED(mode.c_cc[VINTR]) || intrchar >= 0) -- mode.c_cc[VINTR] = (intrchar >= 0) ? intrchar : CINTR; -- -- if (DISABLED(mode.c_cc[VKILL]) || tkillchar >= 0) -- mode.c_cc[VKILL] = (tkillchar >= 0) ? tkillchar : CKILL; -+ if (DISABLED(mode.c_cc[VERASE]) || terasechar >= 0) { -+ mode.c_cc[VERASE] = UChar((terasechar >= 0) -+ ? terasechar -+ : default_erase()); -+ } -+ -+ if (DISABLED(mode.c_cc[VINTR]) || intrchar >= 0) { -+ mode.c_cc[VINTR] = UChar((intrchar >= 0) -+ ? intrchar -+ : CINTR); -+ } -+ -+ if (DISABLED(mode.c_cc[VKILL]) || tkillchar >= 0) { -+ mode.c_cc[VKILL] = UChar((tkillchar >= 0) -+ ? tkillchar -+ : CKILL); -+ } - #endif - } - -@@ -970,9 +984,9 @@ - if (newline != (char *) 0 && newline[0] == '\n' && !newline[1]) { - /* Newline, not linefeed. */ - #ifdef ONLCR -- mode.c_oflag &= ~ONLCR; -+ mode.c_oflag &= ~((unsigned) ONLCR); - #endif -- mode.c_iflag &= ~ICRNL; -+ mode.c_iflag &= ~((unsigned) ICRNL); - } - #ifdef __OBSOLETE__ - if (tgetflag("HD")) /* Half duplex. */ -@@ -1043,11 +1057,18 @@ - { - if (set_tab && clear_all_tabs) { - int c; -+ int lim = -+#if HAVE_SIZECHANGE -+ tcolumns -+#else -+ columns -+#endif -+ ; - - (void) putc('\r', stderr); /* Force to left margin. */ - tputs(clear_all_tabs, 0, outc); - -- for (c = 8; c < tcolumns; c += 8) { -+ for (c = 8; c < lim; c += 8) { - /* Get to the right column. In BSD tset, this - * used to try a bunch of half-clever things - * with cup and hpa, for an average saving of -@@ -1273,10 +1294,10 @@ - (void) get_termcap_entry(*argv); - - if (!noset) { -+#if HAVE_SIZECHANGE - tcolumns = columns; - tlines = lines; - --#if HAVE_SIZECHANGE - if (opt_w) { - STRUCT_WINSIZE win; - /* Set window size if not set already */ -diff -Naur ncurses-5.9/README ncurses-5.9.patch/README ---- ncurses-5.9/README 2006-04-23 00:19:37.000000000 +0200 -+++ ncurses-5.9.patch/README 2014-09-01 16:33:22.232791916 +0200 -@@ -1,5 +1,5 @@ - ------------------------------------------------------------------------------- ---- Copyright (c) 1998-2004,2006 Free Software Foundation, Inc. -- -+-- Copyright (c) 1998-2011,2012 Free Software Foundation, Inc. -- - -- -- - -- Permission is hereby granted, free of charge, to any person obtaining a -- - -- copy of this software and associated documentation files (the -- -@@ -25,7 +25,7 @@ - -- sale, use or other dealings in this Software without prior written -- - -- authorization. -- - ------------------------------------------------------------------------------- ---- $Id: README,v 1.23 2006/04/22 22:19:37 tom Exp $ -+-- $Id: README,v 1.25 2012/08/11 20:11:26 tom Exp $ - ------------------------------------------------------------------------------- - README file for the ncurses package - -@@ -78,6 +78,10 @@ - library interfaces are not binary-compatible with the non-wide-character - version. - -+If you configure using the --enable-reentrant option, a "t" is appended to the -+library names (e.g., libncursest.a) and the resulting libraries have a -+different binary interface which makes the ncurses interface more "opaque". -+ - The ncurses libraries implement the curses API. The panel, menu and forms - libraries implement clones of the SVr4 panel, menu and forms APIs. The source - code for these lives in the `ncurses', `panel', `menu', and `form' directories -@@ -122,8 +126,9 @@ - tic -- terminfo source to binary compiler - infocmp -- terminfo binary to source decompiler/comparator - clear -- emits clear-screen for current terminal -+ tabs -- set tabs on a terminal - tput -- shell-script access to terminal capabilities. -- toe -- table of entries utility -+ toe -- table of entries utility - tset -- terminal-initialization utility - - The first two (tic and infocmp) are used for manipulating terminfo -@@ -153,8 +158,10 @@ - configuration scripts, porting, mods to adhere to XSI Curses in the - areas of background color, terminal modes. Also memory leak testing, - the wresize, default colors and key definition extensions and numerous -- bug fixes (more than half of those enumerated in NEWS beginning with -- the internal release 1.8.9). -+ bug fixes -- more than half of those enumerated in NEWS beginning with -+ the internal release 1.8.9, see -+ -+ http://invisible-island.net/personal/changelogs.html - - Florian La Roche (official maintainer for FSF's ncurses 4.2) - Beginning with release 4.2, ncurses is distributed under an MIT-style -diff -Naur ncurses-5.9/README.MinGW ncurses-5.9.patch/README.MinGW ---- ncurses-5.9/README.MinGW 2011-02-26 17:57:17.000000000 +0100 -+++ ncurses-5.9.patch/README.MinGW 2014-09-01 16:33:22.233791918 +0200 -@@ -1,5 +1,5 @@ - ------------------------------------------------------------------------------- ---- Copyright (c) 2008-2010,2011 Free Software Foundation, Inc. -- -+-- Copyright (c) 2008-2011,2012 Free Software Foundation, Inc. -- - -- -- - -- Permission is hereby granted, free of charge, to any person obtaining a -- - -- copy of this software and associated documentation files (the -- -@@ -25,7 +25,7 @@ - -- sale, use or other dealings in this Software without prior written -- - -- authorization. -- - ------------------------------------------------------------------------------- ---- $Id: README.MinGW,v 1.5 2011/02/26 16:57:17 tom Exp $ -+-- $Id: README.MinGW,v 1.9 2012/09/22 17:46:04 tom Exp $ - -- Author: Juergen Pfeifer - ------------------------------------------------------------------------------- - -@@ -39,7 +39,7 @@ - To build ncurses for native Windows, you need the MinGW toolchain. The - original MinGW toolchain from the above site is only for 32-Bit Windows. As - Windows Server - and also regular workstations - are moving to 64-Bit, it --seems to be reasonable to have a toolchain that supports both architectures. -+seems to be reasonable to have a toolchain that supports both architectures. - I recommend to use the TDM gcc toolchain which you can find at - http://tdm-gcc.tdragon.net/download. Go to the download section and select - the bundle installer for tdm64 (MinGW-w64). This installs a multilib version -@@ -47,7 +47,7 @@ - versions. It also comes with a working pthread implementation. - - The latest config and build scripts we use for MinGW have only been tested --for the gcc-4.4 compiler toolchain (or better). -+for the gcc-4.6.1 compiler toolchain (or better). - - Using MinGW is a pragmatic decision, it's the easiest way to port this - heavily UNIX based sourcebase to native Windows. The goal is of course -@@ -55,22 +55,13 @@ - common traditional development environments on Windows, mainly with - Microsoft Visual Studio. - --If you start a bash from the MSYS environment, please make sure that the --Microsoft Development tools are in your PATH right after the MinGW --tools. The LIB.EXE tool is the only one needed. You need this only if --you want to build DLLs that work with native Windows programs. If you --don't have any Microsoft Development tools on your machine, consider --at least to get the free "Visual C++ 2010 Express Edition". --It contains the LIB.EXE tool. You may also use this compiler to test --writing native Windows programs using the ncurses DLLs without using --MinGW then for writing apps. -- --It is necessary to unset the TERM environment variable, to activate the --Windows console-driver. -+The TERM environment variable must be set specially to active the Windows -+console-driver. The driver checks if TERM is set to "#win32con" (explicit -+use) or if TERM is unset or empty (implicit). - - Please also make sure that MSYS links to the correct directory containing - your MinGW toolchain. For TDM this is usually C:\MinGW64. In your Windows --CMD.EXE command shell go to the MSYS root directory (most probably -+CMD.EXE command shell go to the MSYS root directory (most probably - C:\MSYS or C:\MSYS\1.0) and verify, that there is a junction point mingw - that points to the MinGW toolchain directory. If not, delete the mingw - directory and use the mklink command (or the linkd.exe utility on older -@@ -79,62 +70,60 @@ - This code requires WindowsNT 5.1 or better, which means on the client - Windows XP or better, on the server Windows Server 2003 or better. - --In order to build ncurses for the planned interop layer with .NET, we --recommend to use these options with configure -+I recommend using libtool to build ncurses on MinGW, because libtool -+knows exactly how to build dll's on Windows for use with MinGW. -+ -+To build a modern but still small footprint ncurses that provides -+hooks for interop, I recommend using these options: - -+ --with-libtool - --disable-home-terminfo -- --enable-reentrant -+ --enable-database -+ --disable-termcap - --enable-sp-funcs - --enable-term-driver - --enable-interop -- --with-pthread (if using TDM toolchain as recommended) - --This is the configuration commandline as I'm using it at the moment: -+This is the configuration commandline as I'm using it at the moment (assuming -+environment variable MINGW_ROOT to hold the root directory name of your MinGW -+build): - - ./configure \ -- --prefix=/mingw \ -- --without-cxx-binding \ -+ --prefix=$MINGW_ROOT \ -+ --with-cxx \ - --without-ada \ - --enable-warnings \ - --enable-assertions \ -- --enable-reentrant \ -- --with-debug \ -- --with-normal \ - --disable-home-terminfo \ -+ --enable-database \ - --enable-sp-funcs \ - --enable-term-driver \ - --enable-interop \ -- --with-pthread -+ --disable-termcap \ -+ --with-progs \ -+ --with-libtool \ -+ --enable-pc-files \ -+ --mandir=$MINGW_ROOT/share/man - --If you are on a 64-Bit Windows system and want to build a 32-Bit version --of ncurses, you may use this commandline for configuration (when using --the TDM toolchain): -- --CC="gcc -m32" LD="ld -m32" ./configure \ -- --prefix=/mingw \ -- --without-cxx-binding \ -- --without-ada \ -- --enable-warnings \ -- --enable-assertions \ -- --enable-reentrant \ -- --with-debug \ -- --with-normal \ -- --disable-home-terminfo \ -- --enable-sp-funcs \ -- --enable-term-driver \ -- --enable-interop \ -- --with-pthread -+Please note that it is also necessary to set this environment variable: - --All the options above are - like the whole Windows support - --experimental. -+export PATH_SEPARATOR=";" -+ -+in order to parse the terminfo paths correctly. Terminfo paths should -+always be separated by a seeeemicolon,even when running under MSYS. - --In order to build the DLLs, after your regular make you must call -+To support regular expressions properly, ncurses under MinGW should be -+linked against the gnurx regex library, which must be built separately -+under MinGW. See - -- make dlls -+ ftp.gnome.org/pub/GNOME/binaries/win32/dependencies/libgnurx-src-2.5.zip -+ -+All the options above are - like the whole Windows support - -+experimental. - - A lot is still TODO, e.g.: - -- - Wide Character support -+ - Wide Character support (display is workable, but input untested) - The Win32Con driver should actually only use Unicode in the - future. - - Thread support (locking). If using TDM toolchain this is done by -@@ -145,5 +134,5 @@ - - Workarounds for MinGW's filesystem access are necessary to make infocmp - work (though tic works). - --To support terminfo, we need to have an ioctl() simulation for the --serial and networked Terminals. -+To support terminfo, we would need to have an ioctl() simulation for the -+serial and networked terminals. -diff -Naur ncurses-5.9/test/aclocal.m4 ncurses-5.9.patch/test/aclocal.m4 ---- ncurses-5.9/test/aclocal.m4 2011-03-24 09:28:07.000000000 +0100 -+++ ncurses-5.9.patch/test/aclocal.m4 2014-09-01 16:33:22.525792404 +0200 -@@ -1,5 +1,5 @@ - dnl*************************************************************************** --dnl Copyright (c) 2003-2010,2011 Free Software Foundation, Inc. * -+dnl Copyright (c) 2003-2013,2014 Free Software Foundation, Inc. * - dnl * - dnl Permission is hereby granted, free of charge, to any person obtaining a * - dnl copy of this software and associated documentation files (the * -@@ -26,7 +26,7 @@ - dnl authorization. * - dnl*************************************************************************** - dnl --dnl $Id: aclocal.m4,v 1.50 2011/03/24 08:28:07 tom Exp $ -+dnl $Id: aclocal.m4,v 1.94 2014/02/10 00:43:27 tom Exp $ - dnl - dnl Author: Thomas E. Dickey - dnl -@@ -40,6 +40,32 @@ - dnl - dnl --------------------------------------------------------------------------- - dnl --------------------------------------------------------------------------- -+dnl CF_ACVERSION_CHECK version: 4 updated: 2013/03/04 19:52:56 -+dnl ------------------ -+dnl Conditionally generate script according to whether we're using a given autoconf. -+dnl -+dnl $1 = version to compare against -+dnl $2 = code to use if AC_ACVERSION is at least as high as $1. -+dnl $3 = code to use if AC_ACVERSION is older than $1. -+define([CF_ACVERSION_CHECK], -+[ -+ifdef([AC_ACVERSION], ,[m4_copy([m4_PACKAGE_VERSION],[AC_ACVERSION])])dnl -+ifdef([m4_version_compare], -+[m4_if(m4_version_compare(m4_defn([AC_ACVERSION]), [$1]), -1, [$3], [$2])], -+[CF_ACVERSION_COMPARE( -+AC_PREREQ_CANON(AC_PREREQ_SPLIT([$1])), -+AC_PREREQ_CANON(AC_PREREQ_SPLIT(AC_ACVERSION)), AC_ACVERSION, [$2], [$3])])])dnl -+dnl --------------------------------------------------------------------------- -+dnl CF_ACVERSION_COMPARE version: 3 updated: 2012/10/03 18:39:53 -+dnl -------------------- -+dnl CF_ACVERSION_COMPARE(MAJOR1, MINOR1, TERNARY1, -+dnl MAJOR2, MINOR2, TERNARY2, -+dnl PRINTABLE2, not FOUND, FOUND) -+define([CF_ACVERSION_COMPARE], -+[ifelse(builtin([eval], [$2 < $5]), 1, -+[ifelse([$8], , ,[$8])], -+[ifelse([$9], , ,[$9])])])dnl -+dnl --------------------------------------------------------------------------- - dnl CF_ADD_CFLAGS version: 10 updated: 2010/05/26 05:38:42 - dnl ------------- - dnl Copy non-preprocessor flags to $CFLAGS, preprocessor flags to $CPPFLAGS -@@ -237,7 +263,7 @@ - dnl $2 = variable to update (default $LIBS) - AC_DEFUN([CF_ADD_LIBS],[ifelse($2,,LIBS,[$2])="$1 [$]ifelse($2,,LIBS,[$2])"])dnl - dnl --------------------------------------------------------------------------- --dnl CF_ADD_LIB_AFTER version: 2 updated: 2010/11/08 20:33:46 -+dnl CF_ADD_LIB_AFTER version: 3 updated: 2013/07/09 21:27:22 - dnl ---------------- - dnl Add a given library after another, e.g., following the one it satisfies a - dnl dependency for. -@@ -246,11 +272,11 @@ - dnl $2 = its dependency - AC_DEFUN([CF_ADD_LIB_AFTER],[ - CF_VERBOSE(...before $LIBS) --LIBS=`echo "$LIBS" | sed -e "s/[[ ]][[ ]]*/ /g" -e "s,$1 ,$1 $2 ," -e 's/ / /g'` -+LIBS=`echo "$LIBS" | sed -e "s/[[ ]][[ ]]*/ /g" -e "s%$1 %$1 $2 %" -e 's% % %g'` - CF_VERBOSE(...after $LIBS) - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_ADD_SUBDIR_PATH version: 3 updated: 2010/07/03 20:58:12 -+dnl CF_ADD_SUBDIR_PATH version: 4 updated: 2013/10/08 17:47:05 - dnl ------------------ - dnl Append to a search-list for a nonstandard header/lib-file - dnl $1 = the variable to return as result -@@ -260,9 +286,9 @@ - dnl $5 = a directory that we do not want $4 to match - AC_DEFUN([CF_ADD_SUBDIR_PATH], - [ --test "$4" != "$5" && \ -+test "x$4" != "x$5" && \ - test -d "$4" && \ --ifelse([$5],NONE,,[(test $5 = NONE || test "$4" != "$5") &&]) { -+ifelse([$5],NONE,,[(test -z "$5" || test x$5 = xNONE || test "x$4" != "x$5") &&]) { - test -n "$verbose" && echo " ... testing for $3-directories under $4" - test -d $4/$3 && $1="[$]$1 $4/$3" - test -d $4/$3/$2 && $1="[$]$1 $4/$3/$2" -@@ -272,76 +298,6 @@ - } - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_ANSI_CC_CHECK version: 10 updated: 2010/10/23 15:52:32 --dnl ---------------- --dnl This is adapted from the macros 'fp_PROG_CC_STDC' and 'fp_C_PROTOTYPES' --dnl in the sharutils 4.2 distribution. --AC_DEFUN([CF_ANSI_CC_CHECK], --[ --AC_CACHE_CHECK(for ${CC:-cc} option to accept ANSI C, cf_cv_ansi_cc,[ --cf_cv_ansi_cc=no --cf_save_CFLAGS="$CFLAGS" --cf_save_CPPFLAGS="$CPPFLAGS" --# Don't try gcc -ansi; that turns off useful extensions and --# breaks some systems' header files. --# AIX -qlanglvl=ansi --# Ultrix and OSF/1 -std1 --# HP-UX -Aa -D_HPUX_SOURCE --# SVR4 -Xc --# UnixWare 1.2 (cannot use -Xc, since ANSI/POSIX clashes) --for cf_arg in "-DCC_HAS_PROTOS" \ -- "" \ -- -qlanglvl=ansi \ -- -std1 \ -- -Ae \ -- "-Aa -D_HPUX_SOURCE" \ -- -Xc --do -- CF_ADD_CFLAGS($cf_arg) -- AC_TRY_COMPILE( --[ --#ifndef CC_HAS_PROTOS --#if !defined(__STDC__) || (__STDC__ != 1) --choke me --#endif --#endif --],[ -- int test (int i, double x); -- struct s1 {int (*f) (int a);}; -- struct s2 {int (*f) (double a);};], -- [cf_cv_ansi_cc="$cf_arg"; break]) --done --CFLAGS="$cf_save_CFLAGS" --CPPFLAGS="$cf_save_CPPFLAGS" --]) -- --if test "$cf_cv_ansi_cc" != "no"; then --if test ".$cf_cv_ansi_cc" != ".-DCC_HAS_PROTOS"; then -- CF_ADD_CFLAGS($cf_cv_ansi_cc) --else -- AC_DEFINE(CC_HAS_PROTOS) --fi --fi --])dnl --dnl --------------------------------------------------------------------------- --dnl CF_ANSI_CC_REQD version: 4 updated: 2008/03/23 14:48:54 --dnl --------------- --dnl For programs that must use an ANSI compiler, obtain compiler options that --dnl will make it recognize prototypes. We'll do preprocessor checks in other --dnl macros, since tools such as unproto can fake prototypes, but only part of --dnl the preprocessor. --AC_DEFUN([CF_ANSI_CC_REQD], --[AC_REQUIRE([CF_ANSI_CC_CHECK]) --if test "$cf_cv_ansi_cc" = "no"; then -- AC_MSG_ERROR( --[Your compiler does not appear to recognize prototypes. --You have the following choices: -- a. adjust your compiler options -- b. get an up-to-date compiler -- c. use a wrapper such as unproto]) --fi --])dnl --dnl --------------------------------------------------------------------------- - dnl CF_ARG_DISABLE version: 3 updated: 1999/03/30 17:24:31 - dnl -------------- - dnl Allow user to disable a normally-on option. -@@ -377,7 +333,33 @@ - ])dnl - ])])dnl - dnl --------------------------------------------------------------------------- --dnl CF_CHECK_CACHE version: 11 updated: 2008/03/23 14:45:59 -+dnl CF_CC_ENV_FLAGS version: 1 updated: 2012/10/03 05:25:49 -+dnl --------------- -+dnl Check for user's environment-breakage by stuffing CFLAGS/CPPFLAGS content -+dnl into CC. This will not help with broken scripts that wrap the compiler with -+dnl options, but eliminates a more common category of user confusion. -+AC_DEFUN([CF_CC_ENV_FLAGS], -+[ -+# This should have been defined by AC_PROG_CC -+: ${CC:=cc} -+ -+AC_MSG_CHECKING(\$CC variable) -+case "$CC" in #(vi -+*[[\ \ ]]-[[IUD]]*) -+ AC_MSG_RESULT(broken) -+ AC_MSG_WARN(your environment misuses the CC variable to hold CFLAGS/CPPFLAGS options) -+ # humor him... -+ cf_flags=`echo "$CC" | sed -e 's/^[[^ ]]*[[ ]]//'` -+ CC=`echo "$CC" | sed -e 's/[[ ]].*//'` -+ CF_ADD_CFLAGS($cf_flags) -+ ;; -+*) -+ AC_MSG_RESULT(ok) -+ ;; -+esac -+])dnl -+dnl --------------------------------------------------------------------------- -+dnl CF_CHECK_CACHE version: 12 updated: 2012/10/02 20:55:03 - dnl -------------- - dnl Check if we're accidentally using a cache from a different machine. - dnl Derive the system name, as a check for reusing the autoconf cache. -@@ -400,7 +382,7 @@ - system_name="`(hostname) 2>/dev/null`" - fi - fi --test -n "$system_name" && AC_DEFINE_UNQUOTED(SYSTEM_NAME,"$system_name") -+test -n "$system_name" && AC_DEFINE_UNQUOTED(SYSTEM_NAME,"$system_name",[Define to the system name.]) - AC_CACHE_VAL(cf_cv_system_name,[cf_cv_system_name="$system_name"]) - - test -z "$system_name" && system_name="$cf_cv_system_name" -@@ -434,7 +416,40 @@ - fi - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_CURSES_ACS_MAP version: 6 updated: 2010/10/23 15:54:49 -+dnl CF_CLANG_COMPILER version: 2 updated: 2013/11/19 19:23:35 -+dnl ----------------- -+dnl Check if the given compiler is really clang. clang's C driver defines -+dnl __GNUC__ (fooling the configure script into setting $GCC to yes) but does -+dnl not ignore some gcc options. -+dnl -+dnl This macro should be run "soon" after AC_PROG_CC or AC_PROG_CPLUSPLUS, to -+dnl ensure that it is not mistaken for gcc/g++. It is normally invoked from -+dnl the wrappers for gcc and g++ warnings. -+dnl -+dnl $1 = GCC (default) or GXX -+dnl $2 = CLANG_COMPILER (default) -+dnl $3 = CFLAGS (default) or CXXFLAGS -+AC_DEFUN([CF_CLANG_COMPILER],[ -+ifelse([$2],,CLANG_COMPILER,[$2])=no -+ -+if test "$ifelse([$1],,[$1],GCC)" = yes ; then -+ AC_MSG_CHECKING(if this is really Clang ifelse([$1],GXX,C++,C) compiler) -+ cf_save_CFLAGS="$ifelse([$3],,CFLAGS,[$3])" -+ ifelse([$3],,CFLAGS,[$3])="$ifelse([$3],,CFLAGS,[$3]) -Qunused-arguments" -+ AC_TRY_COMPILE([],[ -+#ifdef __clang__ -+#else -+make an error -+#endif -+],[ifelse([$2],,CLANG_COMPILER,[$2])=yes -+cf_save_CFLAGS="$cf_save_CFLAGS -Qunused-arguments" -+],[]) -+ ifelse([$3],,CFLAGS,[$3])="$cf_save_CFLAGS" -+ AC_MSG_RESULT($ifelse([$2],,CLANG_COMPILER,[$2])) -+fi -+]) -+dnl --------------------------------------------------------------------------- -+dnl CF_CURSES_ACS_MAP version: 7 updated: 2012/10/06 16:39:58 - dnl ----------------- - dnl Check for likely values of acs_map[]: - AC_DEFUN([CF_CURSES_ACS_MAP], -@@ -452,7 +467,7 @@ - done - ]) - --test "$cf_cv_curses_acs_map" != unknown && AC_DEFINE_UNQUOTED(CURSES_ACS_ARRAY,$cf_cv_curses_acs_map) -+test "$cf_cv_curses_acs_map" != unknown && AC_DEFINE_UNQUOTED(CURSES_ACS_ARRAY,$cf_cv_curses_acs_map,[Define as needed to override ncurses prefix _nc_]) - ]) - dnl --------------------------------------------------------------------------- - dnl CF_CURSES_CHECK_DATA version: 4 updated: 2011/01/15 16:39:24 -@@ -499,7 +514,7 @@ - fi - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_CURSES_CHECK_TYPE version: 3 updated: 2010/10/23 15:54:49 -+dnl CF_CURSES_CHECK_TYPE version: 4 updated: 2012/10/06 16:39:58 - dnl -------------------- - dnl Check if curses.h defines the given type - AC_DEFUN([CF_CURSES_CHECK_TYPE], -@@ -515,9 +530,9 @@ - AC_MSG_RESULT($cf_result) - if test $cf_result = yes ; then - CF_UPPER(cf_result,have_type_$1) -- AC_DEFINE_UNQUOTED($cf_result) -+ AC_DEFINE_UNQUOTED($cf_result,1,[Define to 1 if we have type $1]) - else -- AC_DEFINE_UNQUOTED($1,$2) -+ AC_DEFINE_UNQUOTED($1,$2,[Define to appropriate type if $1 is not declared]) - fi - ])dnl - dnl --------------------------------------------------------------------------- -@@ -533,7 +548,7 @@ - CF_CURSES_LIBS - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_CURSES_CPPFLAGS version: 10 updated: 2009/01/06 19:34:11 -+dnl CF_CURSES_CPPFLAGS version: 11 updated: 2011/04/09 14:51:08 - dnl ------------------ - dnl Look for the curses headers. - AC_DEFUN([CF_CURSES_CPPFLAGS],[ -@@ -542,13 +557,19 @@ - cf_cv_curses_incdir=no - case $host_os in #(vi - hpux10.*) #(vi -- test -d /usr/include/curses_colr && \ -- cf_cv_curses_incdir="-I/usr/include/curses_colr" -+ if test "x$cf_cv_screen" = "xcurses_colr" -+ then -+ test -d /usr/include/curses_colr && \ -+ cf_cv_curses_incdir="-I/usr/include/curses_colr" -+ fi - ;; - sunos3*|sunos4*) -- test -d /usr/5lib && \ -- test -d /usr/5include && \ -- cf_cv_curses_incdir="-I/usr/5include" -+ if test "x$cf_cv_screen" = "xcurses_5lib" -+ then -+ test -d /usr/5lib && \ -+ test -d /usr/5include && \ -+ cf_cv_curses_incdir="-I/usr/5include" -+ fi - ;; - esac - ]) -@@ -558,7 +579,7 @@ - CF_TERM_HEADER - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_CURSES_FUNCS version: 15 updated: 2010/10/23 15:52:32 -+dnl CF_CURSES_FUNCS version: 17 updated: 2011/05/14 16:07:29 - dnl --------------- - dnl Curses-functions are a little complicated, since a lot of them are macros. - AC_DEFUN([CF_CURSES_FUNCS], -@@ -566,6 +587,7 @@ - AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl - AC_REQUIRE([CF_XOPEN_CURSES]) - AC_REQUIRE([CF_CURSES_TERM_H]) -+AC_REQUIRE([CF_CURSES_UNCTRL_H]) - for cf_func in $1 - do - CF_UPPER(cf_tr_func,$cf_func) -@@ -578,7 +600,8 @@ - [ - #ifndef ${cf_func} - long foo = (long)(&${cf_func}); --${cf_cv_main_return:-return}(foo == 0); -+if (foo + 1234 > 5678) -+ ${cf_cv_main_return:-return}(foo); - #endif - ], - [cf_result=yes], -@@ -595,7 +618,7 @@ - done - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_CURSES_HEADER version: 2 updated: 2010/04/28 06:02:16 -+dnl CF_CURSES_HEADER version: 3 updated: 2011/05/01 19:47:45 - dnl ---------------- - dnl Find a "curses" header file, e.g,. "curses.h", or one of the more common - dnl variations of ncurses' installs. -@@ -605,10 +628,10 @@ - AC_CACHE_CHECK(if we have identified curses headers,cf_cv_ncurses_header,[ - cf_cv_ncurses_header=none - for cf_header in ifelse($1,,,[ \ -- $1/curses.h \ -- $1/ncurses.h]) \ -- curses.h \ -- ncurses.h ifelse($1,,[ncurses/curses.h ncurses/ncurses.h]) -+ $1/ncurses.h \ -+ $1/curses.h]) \ -+ ncurses.h \ -+ curses.h ifelse($1,,[ncurses/ncurses.h ncurses/curses.h]) - do - AC_TRY_COMPILE([#include <${cf_header}>], - [initscr(); tgoto("?", 0,0)], -@@ -624,7 +647,7 @@ - AC_CHECK_HEADERS($cf_cv_ncurses_header) - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_CURSES_LIBS version: 33 updated: 2011/03/06 12:37:18 -+dnl CF_CURSES_LIBS version: 37 updated: 2013/02/09 17:33:50 - dnl -------------- - dnl Look for the curses libraries. Older curses implementations may require - dnl termcap/termlib to be linked as well. Call CF_CURSES_CPPFLAGS first. -@@ -644,17 +667,24 @@ - AC_CHECK_LIB(mytinfo,tgoto,[CF_ADD_LIBS(-lmytinfo)]) - ;; - hpux10.*) #(vi -- AC_CHECK_LIB(cur_colr,initscr,[ -- CF_ADD_LIBS(-lcur_colr) -- ac_cv_func_initscr=yes -- ],[ -- AC_CHECK_LIB(Hcurses,initscr,[ -- # HP's header uses __HP_CURSES, but user claims _HP_CURSES. -- CF_ADD_LIBS(-lHcurses) -- CPPFLAGS="$CPPFLAGS -D__HP_CURSES -D_HP_CURSES" -- ac_cv_func_initscr=yes -- ])]) -- ;; -+ # Looking at HPUX 10.20, the Hcurses library is the oldest (1997), cur_colr -+ # next (1998), and xcurses "newer" (2000). There is no header file for -+ # Hcurses; the subdirectory curses_colr has the headers (curses.h and -+ # term.h) for cur_colr -+ if test "x$cf_cv_screen" = "xcurses_colr" -+ then -+ AC_CHECK_LIB(cur_colr,initscr,[ -+ CF_ADD_LIBS(-lcur_colr) -+ ac_cv_func_initscr=yes -+ ],[ -+ AC_CHECK_LIB(Hcurses,initscr,[ -+ # HP's header uses __HP_CURSES, but user claims _HP_CURSES. -+ CF_ADD_LIBS(-lHcurses) -+ CPPFLAGS="$CPPFLAGS -D__HP_CURSES -D_HP_CURSES" -+ ac_cv_func_initscr=yes -+ ])]) -+ fi -+ ;; - linux*) - case `arch 2>/dev/null` in - x86_64) -@@ -669,76 +699,83 @@ - CF_ADD_LIBDIR(/lib) - ;; - esac -- ;; -+ ;; - sunos3*|sunos4*) -- if test -d /usr/5lib ; then -- CF_ADD_LIBDIR(/usr/5lib) -- CF_ADD_LIBS(-lcurses -ltermcap) -+ if test "x$cf_cv_screen" = "xcurses_5lib" -+ then -+ if test -d /usr/5lib ; then -+ CF_ADD_LIBDIR(/usr/5lib) -+ CF_ADD_LIBS(-lcurses -ltermcap) -+ fi - fi - ac_cv_func_initscr=yes - ;; - esac - - if test ".$ac_cv_func_initscr" != .yes ; then -- cf_save_LIBS="$LIBS" -- cf_term_lib="" -- cf_curs_lib="" -+ cf_save_LIBS="$LIBS" - -- if test ".${cf_cv_ncurses_version:-no}" != .no -- then -- cf_check_list="ncurses curses cursesX" -- else -- cf_check_list="cursesX curses ncurses" -- fi -+ if test ".${cf_cv_ncurses_version:-no}" != .no -+ then -+ cf_check_list="ncurses curses cursesX" -+ else -+ cf_check_list="cursesX curses ncurses" -+ fi - -- # Check for library containing tgoto. Do this before curses library -- # because it may be needed to link the test-case for initscr. -- AC_CHECK_FUNC(tgoto,[cf_term_lib=predefined],[ -- for cf_term_lib in $cf_check_list termcap termlib unknown -- do -- AC_CHECK_LIB($cf_term_lib,tgoto,[break]) -- done -- ]) -+ # Check for library containing tgoto. Do this before curses library -+ # because it may be needed to link the test-case for initscr. -+ if test "x$cf_term_lib" = x -+ then -+ AC_CHECK_FUNC(tgoto,[cf_term_lib=predefined],[ -+ for cf_term_lib in $cf_check_list otermcap termcap tinfo termlib unknown -+ do -+ AC_CHECK_LIB($cf_term_lib,tgoto,[break]) -+ done -+ ]) -+ fi - -- # Check for library containing initscr -- test "$cf_term_lib" != predefined && test "$cf_term_lib" != unknown && LIBS="-l$cf_term_lib $cf_save_LIBS" -- for cf_curs_lib in $cf_check_list xcurses jcurses pdcurses unknown -- do -- AC_CHECK_LIB($cf_curs_lib,initscr,[break]) -- done -- test $cf_curs_lib = unknown && AC_MSG_ERROR(no curses library found) -+ # Check for library containing initscr -+ test "$cf_term_lib" != predefined && test "$cf_term_lib" != unknown && LIBS="-l$cf_term_lib $cf_save_LIBS" -+ if test "x$cf_curs_lib" = x -+ then -+ for cf_curs_lib in $cf_check_list xcurses jcurses pdcurses unknown -+ do -+ AC_CHECK_LIB($cf_curs_lib,initscr,[break]) -+ done -+ fi -+ test $cf_curs_lib = unknown && AC_MSG_ERROR(no curses library found) - -- LIBS="-l$cf_curs_lib $cf_save_LIBS" -- if test "$cf_term_lib" = unknown ; then -- AC_MSG_CHECKING(if we can link with $cf_curs_lib library) -- AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>], -- [initscr()], -- [cf_result=yes], -- [cf_result=no]) -- AC_MSG_RESULT($cf_result) -- test $cf_result = no && AC_MSG_ERROR(Cannot link curses library) -- elif test "$cf_curs_lib" = "$cf_term_lib" ; then -- : -- elif test "$cf_term_lib" != predefined ; then -- AC_MSG_CHECKING(if we need both $cf_curs_lib and $cf_term_lib libraries) -- AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>], -- [initscr(); tgoto((char *)0, 0, 0);], -- [cf_result=no], -- [ -- LIBS="-l$cf_curs_lib -l$cf_term_lib $cf_save_LIBS" -- AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>], -- [initscr()], -- [cf_result=yes], -- [cf_result=error]) -- ]) -- AC_MSG_RESULT($cf_result) -- fi -+ LIBS="-l$cf_curs_lib $cf_save_LIBS" -+ if test "$cf_term_lib" = unknown ; then -+ AC_MSG_CHECKING(if we can link with $cf_curs_lib library) -+ AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>], -+ [initscr()], -+ [cf_result=yes], -+ [cf_result=no]) -+ AC_MSG_RESULT($cf_result) -+ test $cf_result = no && AC_MSG_ERROR(Cannot link curses library) -+ elif test "$cf_curs_lib" = "$cf_term_lib" ; then -+ : -+ elif test "$cf_term_lib" != predefined ; then -+ AC_MSG_CHECKING(if we need both $cf_curs_lib and $cf_term_lib libraries) -+ AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>], -+ [initscr(); tgoto((char *)0, 0, 0);], -+ [cf_result=no], -+ [ -+ LIBS="-l$cf_curs_lib -l$cf_term_lib $cf_save_LIBS" -+ AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>], -+ [initscr()], -+ [cf_result=yes], -+ [cf_result=error]) -+ ]) -+ AC_MSG_RESULT($cf_result) -+ fi - fi - fi - - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_CURSES_TERM_H version: 8 updated: 2010/10/23 15:54:49 -+dnl CF_CURSES_TERM_H version: 10 updated: 2012/10/06 08:57:51 - dnl ---------------- - dnl SVr4 curses should have term.h as well (where it puts the definitions of - dnl the low-level interface). This may not be true in old/broken implementations, -@@ -752,9 +789,17 @@ - - # If we found <ncurses/curses.h>, look for <ncurses/term.h>, but always look - # for <term.h> if we do not find the variant. --for cf_header in \ -- `echo ${cf_cv_ncurses_header:-curses.h} | sed -e 's%/.*%/%'`term.h \ -- term.h -+ -+cf_header_list="term.h ncurses/term.h ncursesw/term.h" -+ -+case ${cf_cv_ncurses_header:-curses.h} in #(vi -+*/*) -+ cf_header_item=`echo ${cf_cv_ncurses_header:-curses.h} | sed -e 's%\..*%%' -e 's%/.*%/%'`term.h -+ cf_header_list="$cf_header_item $cf_header_list" -+ ;; -+esac -+ -+for cf_header in $cf_header_list - do - AC_TRY_COMPILE([ - #include <${cf_cv_ncurses_header:-curses.h}> -@@ -789,18 +834,73 @@ - - case $cf_cv_term_header in #(vi - term.h) #(vi -- AC_DEFINE(HAVE_TERM_H) -+ AC_DEFINE(HAVE_TERM_H,1,[Define to 1 if we have term.h]) - ;; - ncurses/term.h) #(vi -- AC_DEFINE(HAVE_NCURSES_TERM_H) -+ AC_DEFINE(HAVE_NCURSES_TERM_H,1,[Define to 1 if we have ncurses/term.h]) - ;; - ncursesw/term.h) -- AC_DEFINE(HAVE_NCURSESW_TERM_H) -+ AC_DEFINE(HAVE_NCURSESW_TERM_H,1,[Define to 1 if we have ncursesw/term.h]) -+ ;; -+esac -+])dnl -+dnl --------------------------------------------------------------------------- -+dnl CF_CURSES_UNCTRL_H version: 3 updated: 2013/11/03 06:26:10 -+dnl ------------------ -+dnl Any X/Open curses implementation must have unctrl.h, but ncurses packages -+dnl may put it in a subdirectory (along with ncurses' other headers, of -+dnl course). Packages which put the headers in inconsistent locations are -+dnl broken). -+AC_DEFUN([CF_CURSES_UNCTRL_H], -+[ -+AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl -+ -+AC_CACHE_CHECK(for unctrl.h, cf_cv_unctrl_header,[ -+ -+# If we found <ncurses/curses.h>, look for <ncurses/unctrl.h>, but always look -+# for <unctrl.h> if we do not find the variant. -+ -+cf_header_list="unctrl.h ncurses/unctrl.h ncursesw/unctrl.h" -+ -+case ${cf_cv_ncurses_header:-curses.h} in #(vi -+*/*) -+ cf_header_item=`echo ${cf_cv_ncurses_header:-curses.h} | sed -e 's%\..*%%' -e 's%/.*%/%'`unctrl.h -+ cf_header_list="$cf_header_item $cf_header_list" -+ ;; -+esac -+ -+for cf_header in $cf_header_list -+do -+ AC_TRY_COMPILE([ -+#include <${cf_cv_ncurses_header:-curses.h}> -+#include <${cf_header}>], -+ [WINDOW *x], -+ [cf_cv_unctrl_header=$cf_header -+ break], -+ [cf_cv_unctrl_header=no]) -+done -+]) -+ -+case $cf_cv_unctrl_header in #(vi -+no) -+ AC_MSG_WARN(unctrl.h header not found) -+ ;; -+esac -+ -+case $cf_cv_unctrl_header in #(vi -+unctrl.h) #(vi -+ AC_DEFINE(HAVE_UNCTRL_H,1,[Define to 1 if we have unctrl.h]) -+ ;; -+ncurses/unctrl.h) #(vi -+ AC_DEFINE(HAVE_NCURSES_UNCTRL_H,1,[Define to 1 if we have ncurses/unctrl.h]) -+ ;; -+ncursesw/unctrl.h) -+ AC_DEFINE(HAVE_NCURSESW_UNCTRL_H,1,[Define to 1 if we have ncursesw/unctrl.h]) - ;; - esac - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_CURSES_WACS_MAP version: 5 updated: 2011/01/15 11:28:59 -+dnl CF_CURSES_WACS_MAP version: 6 updated: 2012/10/06 08:57:51 - dnl ------------------ - dnl Check for likely values of wacs_map[]. - AC_DEFUN([CF_CURSES_WACS_MAP], -@@ -819,10 +919,10 @@ - break]) - done]) - --test "$cf_cv_curses_wacs_map" != unknown && AC_DEFINE_UNQUOTED(CURSES_WACS_ARRAY,$cf_cv_curses_wacs_map) -+test "$cf_cv_curses_wacs_map" != unknown && AC_DEFINE_UNQUOTED(CURSES_WACS_ARRAY,$cf_cv_curses_wacs_map,[Define to name of (n)curses wide-character array]) - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_CURSES_WACS_SYMBOLS version: 1 updated: 2011/01/15 11:28:59 -+dnl CF_CURSES_WACS_SYMBOLS version: 2 updated: 2012/10/06 08:57:51 - dnl ---------------------- - dnl Do a check to see if the WACS_xxx constants are defined compatibly with - dnl X/Open Curses. In particular, NetBSD's implementation of the WACS_xxx -@@ -854,7 +954,7 @@ - fi - ]) - --test "$cf_cv_curses_wacs_symbols" != no && AC_DEFINE(CURSES_WACS_SYMBOLS) -+test "$cf_cv_curses_wacs_symbols" != no && AC_DEFINE(CURSES_WACS_SYMBOLS,1,[Define to 1 if (n)curses supports wide-character WACS_ symbols]) - ])dnl - dnl --------------------------------------------------------------------------- - dnl CF_DIRNAME version: 4 updated: 2002/12/21 19:25:52 -@@ -862,7 +962,7 @@ - dnl "dirname" is not portable, so we fake it with a shell script. - AC_DEFUN([CF_DIRNAME],[$1=`echo $2 | sed -e 's%/[[^/]]*$%%'`])dnl - dnl --------------------------------------------------------------------------- --dnl CF_DISABLE_ECHO version: 11 updated: 2009/12/13 13:16:57 -+dnl CF_DISABLE_ECHO version: 12 updated: 2012/10/06 16:30:28 - dnl --------------- - dnl You can always use "make -n" to see the actual options, but it's hard to - dnl pick out/analyze warning messages when the compile-line is long. -@@ -877,7 +977,7 @@ - AC_DEFUN([CF_DISABLE_ECHO],[ - AC_MSG_CHECKING(if you want to see long compiling messages) - CF_ARG_DISABLE(echo, -- [ --disable-echo display "compiling" commands], -+ [ --disable-echo do not display "compiling" commands], - [ - ECHO_LT='--silent' - ECHO_LD='@echo linking [$]@;' -@@ -899,7 +999,7 @@ - AC_SUBST(ECHO_CC) - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_DISABLE_LEAKS version: 6 updated: 2010/07/23 04:14:32 -+dnl CF_DISABLE_LEAKS version: 7 updated: 2012/10/02 20:55:03 - dnl ---------------- - dnl Combine no-leak checks with the libraries or tools that are used for the - dnl checks. -@@ -917,11 +1017,30 @@ - AC_MSG_RESULT($with_no_leaks) - - if test "$with_no_leaks" = yes ; then -- AC_DEFINE(NO_LEAKS) -- AC_DEFINE(YY_NO_LEAKS) -+ AC_DEFINE(NO_LEAKS,1,[Define to 1 if you want to perform memory-leak testing.]) -+ AC_DEFINE(YY_NO_LEAKS,1,[Define to 1 if you want to perform memory-leak testing.]) - fi - ])dnl - dnl --------------------------------------------------------------------------- -+dnl CF_DISABLE_RPATH_HACK version: 2 updated: 2011/02/13 13:31:33 -+dnl --------------------- -+dnl The rpath-hack makes it simpler to build programs, particularly with the -+dnl *BSD ports which may have essential libraries in unusual places. But it -+dnl can interfere with building an executable for the base system. Use this -+dnl option in that case. -+AC_DEFUN([CF_DISABLE_RPATH_HACK], -+[ -+AC_MSG_CHECKING(if rpath-hack should be disabled) -+CF_ARG_DISABLE(rpath-hack, -+ [ --disable-rpath-hack don't add rpath options for additional libraries], -+ [cf_disable_rpath_hack=yes], -+ [cf_disable_rpath_hack=no]) -+AC_MSG_RESULT($cf_disable_rpath_hack) -+if test "$cf_disable_rpath_hack" = no ; then -+ CF_RPATH_HACK -+fi -+]) -+dnl --------------------------------------------------------------------------- - dnl CF_ENABLE_WARNINGS version: 4 updated: 2009/07/26 17:53:03 - dnl ------------------ - dnl Configure-option to enable gcc warnings -@@ -1122,7 +1241,7 @@ - fi - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_FUNC_CURSES_VERSION version: 5 updated: 2010/10/23 15:54:49 -+dnl CF_FUNC_CURSES_VERSION version: 6 updated: 2012/10/06 16:39:58 - dnl ---------------------- - dnl Solaris has a data item 'curses_version', which confuses AC_CHECK_FUNCS. - dnl It's a character string "SVR4", not documented. -@@ -1141,10 +1260,10 @@ - ,[cf_cv_func_curses_version=no] - ,[cf_cv_func_curses_version=unknown]) - rm -f core]) --test "$cf_cv_func_curses_version" = yes && AC_DEFINE(HAVE_CURSES_VERSION) -+test "$cf_cv_func_curses_version" = yes && AC_DEFINE(HAVE_CURSES_VERSION,1,[Define to 1 if we have curses_version function]) - ]) - dnl --------------------------------------------------------------------------- --dnl CF_GCC_ATTRIBUTES version: 14 updated: 2010/10/23 15:52:32 -+dnl CF_GCC_ATTRIBUTES version: 16 updated: 2012/10/02 20:55:03 - dnl ----------------- - dnl Test for availability of useful gcc __attribute__ directives to quiet - dnl compiler warnings. Though useful, not all are supported -- and contrary -@@ -1222,27 +1341,27 @@ - test -n "$verbose" && AC_MSG_RESULT(... $cf_attribute) - cat conftest.h >>confdefs.h - case $cf_attribute in #(vi -+ noreturn) #(vi -+ AC_DEFINE_UNQUOTED(GCC_NORETURN,$cf_directive,[Define to noreturn-attribute for gcc]) -+ ;; - printf) #(vi -- if test "$cf_printf_attribute" = no ; then -- cat >>confdefs.h <<EOF --#define GCC_PRINTFLIKE(fmt,var) /* nothing */ --EOF -- else -- cat >>confdefs.h <<EOF --#define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var))) --EOF -+ cf_value='/* nothing */' -+ if test "$cf_printf_attribute" != no ; then -+ cf_value='__attribute__((format(printf,fmt,var)))' -+ AC_DEFINE(GCC_PRINTF,1,[Define to 1 if the compiler supports gcc-like printf attribute.]) - fi -+ AC_DEFINE_UNQUOTED(GCC_PRINTFLIKE(fmt,var),$cf_value,[Define to printf-attribute for gcc]) - ;; - scanf) #(vi -- if test "$cf_scanf_attribute" = no ; then -- cat >>confdefs.h <<EOF --#define GCC_SCANFLIKE(fmt,var) /* nothing */ --EOF -- else -- cat >>confdefs.h <<EOF --#define GCC_SCANFLIKE(fmt,var) __attribute__((format(scanf,fmt,var))) --EOF -+ cf_value='/* nothing */' -+ if test "$cf_scanf_attribute" != no ; then -+ cf_value='__attribute__((format(scanf,fmt,var)))' -+ AC_DEFINE(GCC_SCANF,1,[Define to 1 if the compiler supports gcc-like scanf attribute.]) - fi -+ AC_DEFINE_UNQUOTED(GCC_SCANFLIKE(fmt,var),$cf_value,[Define to sscanf-attribute for gcc]) -+ ;; -+ unused) #(vi -+ AC_DEFINE_UNQUOTED(GCC_UNUSED,$cf_directive,[Define to unused-attribute for gcc]) - ;; - esac - fi -@@ -1254,7 +1373,7 @@ - fi - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_GCC_VERSION version: 5 updated: 2010/04/24 11:02:31 -+dnl CF_GCC_VERSION version: 7 updated: 2012/10/18 06:46:33 - dnl -------------- - dnl Find version of gcc - AC_DEFUN([CF_GCC_VERSION],[ -@@ -1262,13 +1381,13 @@ - GCC_VERSION=none - if test "$GCC" = yes ; then - AC_MSG_CHECKING(version of $CC) -- GCC_VERSION="`${CC} --version 2>/dev/null | sed -e '2,$d' -e 's/^.*(GCC) //' -e 's/^[[^0-9.]]*//' -e 's/[[^0-9.]].*//'`" -+ GCC_VERSION="`${CC} --version 2>/dev/null | sed -e '2,$d' -e 's/^.*(GCC[[^)]]*) //' -e 's/^.*(Debian[[^)]]*) //' -e 's/^[[^0-9.]]*//' -e 's/[[^0-9.]].*//'`" - test -z "$GCC_VERSION" && GCC_VERSION=unknown - AC_MSG_RESULT($GCC_VERSION) - fi - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_GCC_WARNINGS version: 27 updated: 2010/10/23 15:52:32 -+dnl CF_GCC_WARNINGS version: 31 updated: 2013/11/19 19:23:35 - dnl --------------- - dnl Check if the compiler supports useful warning options. There's a few that - dnl we don't use, simply because they're too noisy: -@@ -1291,6 +1410,7 @@ - [ - AC_REQUIRE([CF_GCC_VERSION]) - CF_INTEL_COMPILER(GCC,INTEL_COMPILER,CFLAGS) -+CF_CLANG_COMPILER(GCC,CLANG_COMPILER,CFLAGS) - - cat > conftest.$ac_ext <<EOF - #line __oline__ "${as_me:-configure}" -@@ -1339,10 +1459,14 @@ - EXTRA_CFLAGS= - cf_warn_CONST="" - test "$with_ext_const" = yes && cf_warn_CONST="Wwrite-strings" -+ cf_gcc_warnings="Wignored-qualifiers Wlogical-op Wvarargs" -+ test "x$CLANG_COMPILER" = xyes && cf_gcc_warnings= - for cf_opt in W Wall \ - Wbad-function-cast \ - Wcast-align \ - Wcast-qual \ -+ Wdeclaration-after-statement \ -+ Wextra \ - Winline \ - Wmissing-declarations \ - Wmissing-prototypes \ -@@ -1350,7 +1474,7 @@ - Wpointer-arith \ - Wshadow \ - Wstrict-prototypes \ -- Wundef $cf_warn_CONST $1 -+ Wundef $cf_gcc_warnings $cf_warn_CONST $1 - do - CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt" - if AC_TRY_EVAL(ac_compile); then -@@ -1366,6 +1490,13 @@ - continue;; - esac - ;; -+ Wpointer-arith) #(vi -+ case $GCC_VERSION in -+ [[12]].*) -+ CF_VERBOSE(feature is broken in gcc $GCC_VERSION) -+ continue;; -+ esac -+ ;; - esac - EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt" - fi -@@ -1377,6 +1508,29 @@ - AC_SUBST(EXTRA_CFLAGS) - ])dnl - dnl --------------------------------------------------------------------------- -+dnl CF_GETOPT_HEADER version: 5 updated: 2012/10/06 16:39:58 -+dnl ---------------- -+dnl Check for getopt's variables which are commonly defined in stdlib.h, -+dnl unistd.h or (nonstandard) in getopt.h -+AC_DEFUN([CF_GETOPT_HEADER], -+[ -+AC_HAVE_HEADERS(unistd.h getopt.h) -+AC_CACHE_CHECK(for header declaring getopt variables,cf_cv_getopt_header,[ -+cf_cv_getopt_header=none -+for cf_header in stdio.h stdlib.h unistd.h getopt.h -+do -+AC_TRY_COMPILE([ -+#include <$cf_header>], -+[int x = optind; char *y = optarg], -+[cf_cv_getopt_header=$cf_header -+ break]) -+done -+]) -+if test $cf_cv_getopt_header != none ; then -+ AC_DEFINE(HAVE_GETOPT_HEADER,1,[Define to 1 if we need to include getopt.h]) -+fi -+])dnl -+dnl --------------------------------------------------------------------------- - dnl CF_GNU_SOURCE version: 6 updated: 2005/07/09 13:23:07 - dnl ------------- - dnl Check if we must define _GNU_SOURCE to get a reasonable value for -@@ -1453,6 +1607,13 @@ - $1="[$]$1 $cf_header_path_list" - ])dnl - dnl --------------------------------------------------------------------------- -+dnl CF_HELP_MESSAGE version: 3 updated: 1998/01/14 10:56:23 -+dnl --------------- -+dnl Insert text into the help-message, for readability, from AC_ARG_WITH. -+AC_DEFUN([CF_HELP_MESSAGE], -+[AC_DIVERT_HELP([$1])dnl -+])dnl -+dnl --------------------------------------------------------------------------- - dnl CF_INHERIT_SCRIPT version: 2 updated: 2003/03/01 23:50:42 - dnl ----------------- - dnl If we do not have a given script, look for it in the parent directory. -@@ -1461,7 +1622,7 @@ - test -f $1 || ( test -f ../$1 && cp ../$1 ./ ) - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_INTEL_COMPILER version: 4 updated: 2010/05/26 05:38:42 -+dnl CF_INTEL_COMPILER version: 5 updated: 2013/02/10 10:41:05 - dnl ----------------- - dnl Check if the given compiler is really the Intel compiler for Linux. It - dnl tries to imitate gcc, but does not return an error when it finds a mismatch -@@ -1475,6 +1636,7 @@ - dnl $2 = INTEL_COMPILER (default) or INTEL_CPLUSPLUS - dnl $3 = CFLAGS (default) or CXXFLAGS - AC_DEFUN([CF_INTEL_COMPILER],[ -+AC_REQUIRE([AC_CANONICAL_HOST]) - ifelse([$2],,INTEL_COMPILER,[$2])=no - - if test "$ifelse([$1],,[$1],GCC)" = yes ; then -@@ -1498,6 +1660,60 @@ - fi - ])dnl - dnl --------------------------------------------------------------------------- -+dnl CF_LD_RPATH_OPT version: 5 updated: 2011/07/17 14:48:41 -+dnl --------------- -+dnl For the given system and compiler, find the compiler flags to pass to the -+dnl loader to use the "rpath" feature. -+AC_DEFUN([CF_LD_RPATH_OPT], -+[ -+AC_REQUIRE([CF_CHECK_CACHE]) -+ -+LD_RPATH_OPT= -+AC_MSG_CHECKING(for an rpath option) -+case $cf_cv_system_name in #(vi -+irix*) #(vi -+ if test "$GCC" = yes; then -+ LD_RPATH_OPT="-Wl,-rpath," -+ else -+ LD_RPATH_OPT="-rpath " -+ fi -+ ;; -+linux*|gnu*|k*bsd*-gnu) #(vi -+ LD_RPATH_OPT="-Wl,-rpath," -+ ;; -+openbsd[[2-9]].*|mirbsd*) #(vi -+ LD_RPATH_OPT="-Wl,-rpath," -+ ;; -+dragonfly*|freebsd*) #(vi -+ LD_RPATH_OPT="-rpath " -+ ;; -+netbsd*) #(vi -+ LD_RPATH_OPT="-Wl,-rpath," -+ ;; -+osf*|mls+*) #(vi -+ LD_RPATH_OPT="-rpath " -+ ;; -+solaris2*) #(vi -+ LD_RPATH_OPT="-R" -+ ;; -+*) -+ ;; -+esac -+AC_MSG_RESULT($LD_RPATH_OPT) -+ -+case "x$LD_RPATH_OPT" in #(vi -+x-R*) -+ AC_MSG_CHECKING(if we need a space after rpath option) -+ cf_save_LIBS="$LIBS" -+ CF_ADD_LIBS(${LD_RPATH_OPT}$libdir) -+ AC_TRY_LINK(, , cf_rpath_space=no, cf_rpath_space=yes) -+ LIBS="$cf_save_LIBS" -+ AC_MSG_RESULT($cf_rpath_space) -+ test "$cf_rpath_space" = yes && LD_RPATH_OPT="$LD_RPATH_OPT " -+ ;; -+esac -+])dnl -+dnl --------------------------------------------------------------------------- - dnl CF_LIBRARY_PATH version: 9 updated: 2010/03/28 12:52:50 - dnl --------------- - dnl Construct a search-list of directories for a nonstandard library-file -@@ -1588,38 +1804,7 @@ - fi - ]) - dnl --------------------------------------------------------------------------- --dnl CF_MIN_GETCCHAR version: 3 updated: 2010/10/23 15:54:49 --dnl --------------- --dnl CF_MIN_GETCCHAR --dnl Check whether getcchar's return value counts the trailing null in a wchar_t --dnl string, or not. X/Open says it does, but Tru64 and Solaris do not do this. --AC_DEFUN([CF_MIN_GETCCHAR],[ --AC_CACHE_CHECK(if getcchar counts trailing null,cf_cv_min_getcchar,[ --AC_TRY_RUN([ --#include <stdlib.h> --#include <stdarg.h> --#include <${cf_cv_ncurses_header:-curses.h}> -- --int main() --{ -- wchar_t data[2]; -- cchar_t temp[2]; -- int count; -- data[0] = L'\0'; -- setcchar(temp, data, 0, 0, (void *)0); -- count = getcchar(temp, (wchar_t *)0, (attr_t *)0, (short *)0, (void *)0); -- ${cf_cv_main_return:-return}(count != 0); --}], -- [cf_cv_min_getcchar=no], -- [cf_cv_min_getcchar=yes], -- [cf_cv_min_getcchar=yes]) --]) --if test "$cf_cv_min_getcchar" = yes ; then -- AC_DEFINE(MIN_GETCCHAR,1) --fi --])dnl --dnl --------------------------------------------------------------------------- --dnl CF_MIXEDCASE_FILENAMES version: 3 updated: 2003/09/20 17:07:55 -+dnl CF_MIXEDCASE_FILENAMES version: 6 updated: 2013/10/08 17:47:05 - dnl ---------------------- - dnl Check if the file-system supports mixed-case filenames. If we're able to - dnl create a lowercase name and see it as uppercase, it doesn't support that. -@@ -1628,7 +1813,7 @@ - AC_CACHE_CHECK(if filesystem supports mixed-case filenames,cf_cv_mixedcase,[ - if test "$cross_compiling" = yes ; then - case $target_alias in #(vi -- *-os2-emx*|*-msdosdjgpp*|*-cygwin*|*-mingw32*|*-uwin*) #(vi -+ *-os2-emx*|*-msdosdjgpp*|*-cygwin*|*-msys*|*-mingw*|*-uwin*) #(vi - cf_cv_mixedcase=no - ;; - *) -@@ -1646,7 +1831,7 @@ - rm -f conftest CONFTEST - fi - ]) --test "$cf_cv_mixedcase" = yes && AC_DEFINE(MIXEDCASE_FILENAMES) -+test "$cf_cv_mixedcase" = yes && AC_DEFINE(MIXEDCASE_FILENAMES,1,[Define to 1 if filesystem supports mixed-case filenames.]) - ])dnl - dnl --------------------------------------------------------------------------- - dnl CF_MSG_LOG version: 5 updated: 2010/10/23 15:52:32 -@@ -1690,7 +1875,7 @@ - ,[$1=no]) - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_NCURSES_CONFIG version: 8 updated: 2010/07/08 05:17:30 -+dnl CF_NCURSES_CONFIG version: 10 updated: 2012/10/06 08:57:51 - dnl ----------------- - dnl Tie together the configure-script macros for ncurses. - dnl Prefer the "-config" script from ncurses 6.x, to simplify analysis. -@@ -1702,7 +1887,10 @@ - cf_ncuconfig_root=ifelse($1,,ncurses,$1) - - echo "Looking for ${cf_ncuconfig_root}-config" --AC_PATH_PROGS(NCURSES_CONFIG,${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config,none) -+ -+CF_ACVERSION_CHECK(2.52, -+ [AC_CHECK_TOOLS(NCURSES_CONFIG, ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config, none)], -+ [AC_PATH_PROGS(NCURSES_CONFIG, ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config, none)]) - - if test "$NCURSES_CONFIG" != none ; then - -@@ -1713,7 +1901,7 @@ - CF_CURSES_HEADER(ifelse($1,,ncurses,$1)) - - dnl like CF_NCURSES_CPPFLAGS --AC_DEFINE(NCURSES) -+AC_DEFINE(NCURSES,1,[Define to 1 if we are using ncurses headers/libraries]) - - dnl like CF_NCURSES_LIBS - CF_UPPER(cf_nculib_ROOT,HAVE_LIB$cf_ncuconfig_root) -@@ -1730,7 +1918,7 @@ - fi - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_NCURSES_CPPFLAGS version: 20 updated: 2010/11/20 17:02:38 -+dnl CF_NCURSES_CPPFLAGS version: 21 updated: 2012/10/06 08:57:51 - dnl ------------------- - dnl Look for the SVr4 curses clone 'ncurses' in the standard places, adjusting - dnl the CPPFLAGS variable so we can include its header. -@@ -1776,12 +1964,12 @@ - CF_TERM_HEADER - - # some applications need this, but should check for NCURSES_VERSION --AC_DEFINE(NCURSES) -+AC_DEFINE(NCURSES,1,[Define to 1 if we are using ncurses headers/libraries]) - - CF_NCURSES_VERSION - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_NCURSES_EXT_FUNCS version: 3 updated: 2010/11/13 19:43:23 -+dnl CF_NCURSES_EXT_FUNCS version: 4 updated: 2012/10/06 16:39:58 - dnl -------------------- - dnl Since 2007/11/17, ncurses has defined NCURSES_EXT_FUNCS; earlier versions - dnl may provide these functions. Define the symbol if it is not defined, and -@@ -1813,10 +2001,10 @@ - [cf_cv_ncurses_ext_funcs=no]) - ]) - ]) --test "$cf_cv_ncurses_ext_funcs" = yes && AC_DEFINE(NCURSES_EXT_FUNCS) -+test "$cf_cv_ncurses_ext_funcs" = yes && AC_DEFINE(NCURSES_EXT_FUNCS,1,[Define to 1 if we have ncurses extensions]) - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_NCURSES_HEADER version: 2 updated: 2008/03/23 14:48:54 -+dnl CF_NCURSES_HEADER version: 3 updated: 2012/10/06 08:57:51 - dnl ----------------- - dnl Find a "curses" header file, e.g,. "curses.h", or one of the more common - dnl variations of ncurses' installs. -@@ -1867,16 +2055,16 @@ - - case $cf_cv_ncurses_header in # (vi - *ncurses.h) -- AC_DEFINE(HAVE_NCURSES_H) -+ AC_DEFINE(HAVE_NCURSES_H,1,[Define to 1 if we have ncurses.h]) - ;; - esac - - case $cf_cv_ncurses_header in # (vi - ncurses/curses.h|ncurses/ncurses.h) -- AC_DEFINE(HAVE_NCURSES_NCURSES_H) -+ AC_DEFINE(HAVE_NCURSES_NCURSES_H,1,[Define to 1 if we have ncurses/ncurses.h]) - ;; - ncursesw/curses.h|ncursesw/ncurses.h) -- AC_DEFINE(HAVE_NCURSESW_NCURSES_H) -+ AC_DEFINE(HAVE_NCURSESW_NCURSES_H,1,[Define to 1 if we have ncursesw/ncurses.h]) - ;; - esac - -@@ -1950,7 +2138,7 @@ - AC_DEFINE_UNQUOTED($cf_nculib_ROOT) - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_NCURSES_VERSION version: 13 updated: 2010/10/23 15:54:49 -+dnl CF_NCURSES_VERSION version: 14 updated: 2012/10/06 08:57:51 - dnl ------------------ - dnl Check for the version of ncurses, to aid in reporting bugs, etc. - dnl Call CF_CURSES_CPPFLAGS first, or CF_NCURSES_CPPFLAGS. We don't use -@@ -2009,7 +2197,7 @@ - ]) - rm -f $cf_tempfile - ]) --test "$cf_cv_ncurses_version" = no || AC_DEFINE(NCURSES) -+test "$cf_cv_ncurses_version" = no || AC_DEFINE(NCURSES,1,[Define to 1 if we are using ncurses headers/libraries]) - ])dnl - dnl --------------------------------------------------------------------------- - dnl CF_NCURSES_WRAP_PREFIX version: 1 updated: 2009/03/28 16:08:10 -@@ -2028,7 +2216,7 @@ - AC_SUBST(NCURSES_WRAP_PREFIX) - ]) - dnl --------------------------------------------------------------------------- --dnl CF_NETBSD_FORM_H version: 1 updated: 2011/01/15 14:59:18 -+dnl CF_NETBSD_FORM_H version: 2 updated: 2012/10/06 16:39:58 - dnl ---------------- - dnl Check for NetBSD's form.h, which is incompatible with SVr4 and ncurses. - dnl Some workarounds are needed in client programs to allow them to compile. -@@ -2045,10 +2233,10 @@ - ],[cf_cv_netbsd_form_h=no]) - ]) - --test "$cf_cv_netbsd_form_h" = yes && AC_DEFINE(HAVE_NETBSD_FORM_H) -+test "$cf_cv_netbsd_form_h" = yes && AC_DEFINE(HAVE_NETBSD_FORM_H,1,[Define to 1 if we appear to be using NetBSD form.h]) - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_NETBSD_MENU_H version: 1 updated: 2011/01/15 14:59:18 -+dnl CF_NETBSD_MENU_H version: 2 updated: 2012/10/06 16:39:58 - dnl ---------------- - dnl Check for NetBSD's menu.h, which is incompatible with SVr4 and ncurses. - dnl Some workarounds are needed in client programs to allow them to compile. -@@ -2064,17 +2252,17 @@ - ],[cf_cv_netbsd_menu_h=no]) - ]) - --test "$cf_cv_netbsd_menu_h" = yes && AC_DEFINE(HAVE_NETBSD_MENU_H) -+test "$cf_cv_netbsd_menu_h" = yes && AC_DEFINE(HAVE_NETBSD_MENU_H,1,[Define to 1 if we appear to be using NetBSD menu.h]) - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_NO_LEAKS_OPTION version: 4 updated: 2006/12/16 14:24:05 -+dnl CF_NO_LEAKS_OPTION version: 5 updated: 2012/10/02 20:55:03 - dnl ------------------ - dnl see CF_WITH_NO_LEAKS - AC_DEFUN([CF_NO_LEAKS_OPTION],[ - AC_MSG_CHECKING(if you want to use $1 for testing) - AC_ARG_WITH($1, - [$2], -- [AC_DEFINE($3)ifelse([$4],,[ -+ [AC_DEFINE_UNQUOTED($3,1,"Define to 1 if you want to use $1 for testing.")ifelse([$4],,[ - $4 - ]) - : ${with_cflags:=-g} -@@ -2096,7 +2284,7 @@ - esac - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_PATH_SYNTAX version: 13 updated: 2010/05/26 05:38:42 -+dnl CF_PATH_SYNTAX version: 14 updated: 2012/06/19 20:58:54 - dnl -------------- - dnl Check the argument to see that it looks like a pathname. Rewrite it if it - dnl begins with one of the prefix/exec_prefix variables, and then again if the -@@ -2116,7 +2304,7 @@ - ;; - .[[a-zA-Z]]:[[\\/]]*) #(vi OS/2 EMX - ;; --.\[$]{*prefix}*) #(vi -+.\[$]{*prefix}*|.\[$]{*dir}*) #(vi - eval $1="[$]$1" - case ".[$]$1" in #(vi - .NONE/*) -@@ -2133,13 +2321,15 @@ - esac - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_PDCURSES_X11 version: 11 updated: 2011/01/15 18:45:38 -+dnl CF_PDCURSES_X11 version: 13 updated: 2012/10/06 16:39:58 - dnl --------------- - dnl Configure for PDCurses' X11 library - AC_DEFUN([CF_PDCURSES_X11],[ - AC_REQUIRE([CF_X_ATHENA]) - --AC_PATH_PROGS(XCURSES_CONFIG,xcurses-config,none) -+CF_ACVERSION_CHECK(2.52, -+ [AC_CHECK_TOOLS(XCURSES_CONFIG, xcurses-config, none)], -+ [AC_PATH_PROGS(XCURSES_CONFIG, xcurses-config, none)]) - - if test "$XCURSES_CONFIG" != none ; then - -@@ -2168,15 +2358,15 @@ - fi - - if test $cf_cv_lib_XCurses = yes ; then -- AC_DEFINE(UNIX) -- AC_DEFINE(XCURSES) -- AC_CHECK_HEADER(xcurses.h, AC_DEFINE(HAVE_XCURSES)) -+ AC_DEFINE(UNIX,1,[Define to 1 if using PDCurses on Unix]) -+ AC_DEFINE(XCURSES,1,[Define to 1 if using PDCurses on Unix]) -+ AC_CHECK_HEADER(xcurses.h, AC_DEFINE(HAVE_XCURSES,1,[Define to 1 if using PDCurses on Unix])) - else - AC_MSG_ERROR(Cannot link with XCurses) - fi - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_PKG_CONFIG version: 4 updated: 2011/02/18 20:26:24 -+dnl CF_PKG_CONFIG version: 7 updated: 2011/04/29 04:53:22 - dnl ------------- - dnl Check for the package-config program, unless disabled by command-line. - AC_DEFUN([CF_PKG_CONFIG], -@@ -2193,7 +2383,9 @@ - PKG_CONFIG=none - ;; - yes) #(vi -- AC_PATH_TOOL(PKG_CONFIG, pkg-config, none) -+ CF_ACVERSION_CHECK(2.52, -+ [AC_PATH_TOOL(PKG_CONFIG, pkg-config, none)], -+ [AC_PATH_PROG(PKG_CONFIG, pkg-config, none)]) - ;; - *) - PKG_CONFIG=$withval -@@ -2305,29 +2497,17 @@ - - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_PROG_CC_U_D version: 1 updated: 2005/07/14 16:59:30 --dnl -------------- --dnl Check if C (preprocessor) -U and -D options are processed in the order --dnl given rather than by type of option. Some compilers insist on apply all --dnl of the -U options after all of the -D options. Others allow mixing them, --dnl and may predefine symbols that conflict with those we define. --AC_DEFUN([CF_PROG_CC_U_D], --[ --AC_CACHE_CHECK(if $CC -U and -D options work together,cf_cv_cc_u_d_options,[ -- cf_save_CPPFLAGS="$CPPFLAGS" -- CPPFLAGS="-UU_D_OPTIONS -DU_D_OPTIONS -DD_U_OPTIONS -UD_U_OPTIONS" -- AC_TRY_COMPILE([],[ --#ifndef U_D_OPTIONS --make an undefined-error --#endif --#ifdef D_U_OPTIONS --make a defined-error --#endif -- ],[ -- cf_cv_cc_u_d_options=yes],[ -- cf_cv_cc_u_d_options=no]) -- CPPFLAGS="$cf_save_CPPFLAGS" --]) -+dnl CF_PROG_CC version: 3 updated: 2012/10/06 15:31:55 -+dnl ---------- -+dnl standard check for CC, plus followup sanity checks -+dnl $1 = optional parameter to pass to AC_PROG_CC to specify compiler name -+AC_DEFUN([CF_PROG_CC],[ -+ifelse($1,,[AC_PROG_CC],[AC_PROG_CC($1)]) -+CF_GCC_VERSION -+CF_ACVERSION_CHECK(2.52, -+ [AC_PROG_CC_STDC], -+ [CF_ANSI_CC_REQD]) -+CF_CC_ENV_FLAGS - ])dnl - dnl --------------------------------------------------------------------------- - dnl CF_PROG_INSTALL version: 5 updated: 2002/12/21 22:46:07 -@@ -2373,7 +2553,124 @@ - -e 's/-[[UD]]'"$3"'\(=[[^ ]]*\)\?[$]//g'` - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_SIG_ATOMIC_T version: 2 updated: 2005/09/18 17:27:12 -+dnl CF_RPATH_HACK version: 11 updated: 2013/09/01 13:02:00 -+dnl ------------- -+AC_DEFUN([CF_RPATH_HACK], -+[ -+AC_REQUIRE([CF_LD_RPATH_OPT]) -+AC_MSG_CHECKING(for updated LDFLAGS) -+if test -n "$LD_RPATH_OPT" ; then -+ AC_MSG_RESULT(maybe) -+ -+ AC_CHECK_PROGS(cf_ldd_prog,ldd,no) -+ cf_rpath_list="/usr/lib /lib" -+ if test "$cf_ldd_prog" != no -+ then -+ cf_rpath_oops= -+ -+AC_TRY_LINK([#include <stdio.h>], -+ [printf("Hello");], -+ [cf_rpath_oops=`$cf_ldd_prog conftest$ac_exeext | fgrep ' not found' | sed -e 's% =>.*$%%' |sort | uniq` -+ cf_rpath_list=`$cf_ldd_prog conftest$ac_exeext | fgrep / | sed -e 's%^.*[[ ]]/%/%' -e 's%/[[^/]][[^/]]*$%%' |sort | uniq`]) -+ -+ # If we passed the link-test, but get a "not found" on a given library, -+ # this could be due to inept reconfiguration of gcc to make it only -+ # partly honor /usr/local/lib (or whatever). Sometimes this behavior -+ # is intentional, e.g., installing gcc in /usr/bin and suppressing the -+ # /usr/local libraries. -+ if test -n "$cf_rpath_oops" -+ then -+ for cf_rpath_src in $cf_rpath_oops -+ do -+ for cf_rpath_dir in \ -+ /usr/local \ -+ /usr/pkg \ -+ /opt/sfw -+ do -+ if test -f $cf_rpath_dir/lib/$cf_rpath_src -+ then -+ CF_VERBOSE(...adding -L$cf_rpath_dir/lib to LDFLAGS for $cf_rpath_src) -+ LDFLAGS="$LDFLAGS -L$cf_rpath_dir/lib" -+ break -+ fi -+ done -+ done -+ fi -+ fi -+ -+ CF_VERBOSE(...checking EXTRA_LDFLAGS $EXTRA_LDFLAGS) -+ -+ CF_RPATH_HACK_2(LDFLAGS) -+ CF_RPATH_HACK_2(LIBS) -+ -+ CF_VERBOSE(...checked EXTRA_LDFLAGS $EXTRA_LDFLAGS) -+else -+ AC_MSG_RESULT(no) -+fi -+AC_SUBST(EXTRA_LDFLAGS) -+])dnl -+dnl --------------------------------------------------------------------------- -+dnl CF_RPATH_HACK_2 version: 6 updated: 2010/04/17 16:31:24 -+dnl --------------- -+dnl Do one set of substitutions for CF_RPATH_HACK, adding an rpath option to -+dnl EXTRA_LDFLAGS for each -L option found. -+dnl -+dnl $cf_rpath_list contains a list of directories to ignore. -+dnl -+dnl $1 = variable name to update. The LDFLAGS variable should be the only one, -+dnl but LIBS often has misplaced -L options. -+AC_DEFUN([CF_RPATH_HACK_2], -+[ -+CF_VERBOSE(...checking $1 [$]$1) -+ -+cf_rpath_dst= -+for cf_rpath_src in [$]$1 -+do -+ case $cf_rpath_src in #(vi -+ -L*) #(vi -+ -+ # check if this refers to a directory which we will ignore -+ cf_rpath_skip=no -+ if test -n "$cf_rpath_list" -+ then -+ for cf_rpath_item in $cf_rpath_list -+ do -+ if test "x$cf_rpath_src" = "x-L$cf_rpath_item" -+ then -+ cf_rpath_skip=yes -+ break -+ fi -+ done -+ fi -+ -+ if test "$cf_rpath_skip" = no -+ then -+ # transform the option -+ if test "$LD_RPATH_OPT" = "-R " ; then -+ cf_rpath_tmp=`echo "$cf_rpath_src" |sed -e "s%-L%-R %"` -+ else -+ cf_rpath_tmp=`echo "$cf_rpath_src" |sed -e "s%-L%$LD_RPATH_OPT%"` -+ fi -+ -+ # if we have not already added this, add it now -+ cf_rpath_tst=`echo "$EXTRA_LDFLAGS" | sed -e "s%$cf_rpath_tmp %%"` -+ if test "x$cf_rpath_tst" = "x$EXTRA_LDFLAGS" -+ then -+ CF_VERBOSE(...Filter $cf_rpath_src ->$cf_rpath_tmp) -+ EXTRA_LDFLAGS="$cf_rpath_tmp $EXTRA_LDFLAGS" -+ fi -+ fi -+ ;; -+ esac -+ cf_rpath_dst="$cf_rpath_dst $cf_rpath_src" -+done -+$1=$cf_rpath_dst -+ -+CF_VERBOSE(...checked $1 [$]$1) -+AC_SUBST(EXTRA_LDFLAGS) -+])dnl -+dnl --------------------------------------------------------------------------- -+dnl CF_SIG_ATOMIC_T version: 3 updated: 2012/10/04 20:12:20 - dnl --------------- - dnl signal handler, but there are some gcc depedencies in that recommendation. - dnl Try anyway. -@@ -2405,7 +2702,7 @@ - done - ]) - AC_MSG_RESULT($cf_cv_sig_atomic_t) --test "$cf_cv_sig_atomic_t" != no && AC_DEFINE_UNQUOTED(SIG_ATOMIC_T, $cf_cv_sig_atomic_t) -+test "$cf_cv_sig_atomic_t" != no && AC_DEFINE_UNQUOTED(SIG_ATOMIC_T, $cf_cv_sig_atomic_t,[Define to signal global datatype]) - ])dnl - dnl --------------------------------------------------------------------------- - dnl CF_SUBDIR_PATH version: 6 updated: 2010/04/21 06:20:50 -@@ -2425,7 +2722,7 @@ - CF_ADD_SUBDIR_PATH($1,$2,$3,[$]HOME,$prefix) - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_SYS_TIME_SELECT version: 4 updated: 2000/10/04 09:18:40 -+dnl CF_SYS_TIME_SELECT version: 5 updated: 2012/10/04 05:24:07 - dnl ------------------ - dnl Check if we can include <sys/time.h> with <sys/select.h>; this breaks on - dnl older SCO configurations. -@@ -2445,10 +2742,10 @@ - [cf_cv_sys_time_select=no]) - ]) - AC_MSG_RESULT($cf_cv_sys_time_select) --test "$cf_cv_sys_time_select" = yes && AC_DEFINE(HAVE_SYS_TIME_SELECT) -+test "$cf_cv_sys_time_select" = yes && AC_DEFINE(HAVE_SYS_TIME_SELECT,1,[Define to 1 if we can include <sys/time.h> with <sys/select.h>]) - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_TERM_HEADER version: 2 updated: 2010/10/23 15:54:49 -+dnl CF_TERM_HEADER version: 3 updated: 2012/10/06 08:57:51 - dnl -------------- - dnl Look for term.h, which is part of X/Open curses. It defines the interface - dnl to terminfo database. Usually it is in the same include-path as curses.h, -@@ -2481,21 +2778,90 @@ - - case $cf_cv_term_header in # (vi - *term.h) -- AC_DEFINE(HAVE_TERM_H) -+ AC_DEFINE(HAVE_TERM_H,1,[Define to 1 if we have term.h]) - ;; - esac - - case $cf_cv_term_header in # (vi - ncurses/term.h) #(vi -- AC_DEFINE(HAVE_NCURSES_TERM_H) -+ AC_DEFINE(HAVE_NCURSES_TERM_H,1,[Define to 1 if we have ncurses/term.h]) - ;; - ncursesw/term.h) -- AC_DEFINE(HAVE_NCURSESW_TERM_H) -+ AC_DEFINE(HAVE_NCURSESW_TERM_H,1,[Define to 1 if we have ncursesw/term.h]) - ;; - esac - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_TRY_PKG_CONFIG version: 4 updated: 2010/06/14 17:42:30 -+dnl CF_TOP_BUILDDIR version: 2 updated: 2013/07/27 17:38:32 -+dnl --------------- -+dnl Define a top_builddir symbol, for applications that need an absolute path. -+AC_DEFUN([CF_TOP_BUILDDIR], -+[ -+top_builddir=ifelse($1,,`pwd`,$1) -+AC_SUBST(top_builddir) -+])dnl -+dnl --------------------------------------------------------------------------- -+dnl CF_TPUTS_PROTO version: 2 updated: 2011/04/23 19:25:50 -+dnl -------------- -+dnl Check for type of function-pointer passed to tputs. Some old -+dnl implementations used functions that had different prototypes, making it -+dnl hard to compile portable programs using tputs. -+AC_DEFUN([CF_TPUTS_PROTO],[ -+CF_CURSES_FUNCS(tputs) -+if test x$cf_cv_func_tputs = xyes -+then -+ cf_done=no -+ for cf_arg in int char -+ do -+ for cf_ret in int void -+ do -+ if test $cf_ret = void -+ then -+ cf_return="/* nothing */" -+ else -+ cf_return="return value" -+ fi -+ AC_TRY_COMPILE([ -+#include <${cf_cv_ncurses_header:-curses.h}> -+#include <$cf_cv_term_header> -+ -+static $cf_ret outc($cf_arg value) { $cf_return; } -+],[ -+ tputs("hello", 0, outc); -+ ${cf_cv_main_return:-return}(0); -+],[ -+ CF_VERBOSE([prototype $cf_ret func($cf_arg value)]) -+ cat >>confdefs.h <<EOF -+#define TPUTS_ARG $cf_arg -+#define TPUTS_PROTO(func,value) $cf_ret func(TPUTS_ARG value) -+#define TPUTS_RETURN(value) $cf_return -+EOF -+ cf_done=yes -+ break -+]) -+ done -+ test $cf_done = yes && break -+ done -+fi -+])dnl -+dnl --------------------------------------------------------------------------- -+dnl CF_TRIM_X_LIBS version: 2 updated: 2013/07/09 21:27:22 -+dnl -------------- -+dnl Trim extra base X libraries added as a workaround for inconsistent library -+dnl dependencies returned by "new" pkg-config files. -+AC_DEFUN([CF_TRIM_X_LIBS],[ -+ for cf_trim_lib in Xmu Xt X11 -+ do -+ case "$LIBS" in -+ *-l$cf_trim_lib\ *-l$cf_trim_lib*) -+ LIBS=`echo "$LIBS " | sed -e 's/ / /g' -e 's%-l'"$cf_trim_lib"' %%' -e 's/ $//'` -+ CF_VERBOSE(..trimmed $LIBS) -+ ;; -+ esac -+ done -+]) -+dnl --------------------------------------------------------------------------- -+dnl CF_TRY_PKG_CONFIG version: 5 updated: 2013/07/06 21:27:06 - dnl ----------------- - dnl This is a simple wrapper to use for pkg-config, for libraries which may be - dnl available in that form. -@@ -2516,10 +2882,51 @@ - CF_ADD_LIBS($cf_pkgconfig_libs) - ifelse([$2],,:,[$2]) - else -+ cf_pkgconfig_incs= -+ cf_pkgconfig_libs= - ifelse([$3],,:,[$3]) - fi - ]) - dnl --------------------------------------------------------------------------- -+dnl CF_TRY_XOPEN_SOURCE version: 1 updated: 2011/10/30 17:09:50 -+dnl ------------------- -+dnl If _XOPEN_SOURCE is not defined in the compile environment, check if we -+dnl can define it successfully. -+AC_DEFUN([CF_TRY_XOPEN_SOURCE],[ -+AC_CACHE_CHECK(if we should define _XOPEN_SOURCE,cf_cv_xopen_source,[ -+ AC_TRY_COMPILE([ -+#include <stdlib.h> -+#include <string.h> -+#include <sys/types.h> -+],[ -+#ifndef _XOPEN_SOURCE -+make an error -+#endif], -+ [cf_cv_xopen_source=no], -+ [cf_save="$CPPFLAGS" -+ CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" -+ AC_TRY_COMPILE([ -+#include <stdlib.h> -+#include <string.h> -+#include <sys/types.h> -+],[ -+#ifdef _XOPEN_SOURCE -+make an error -+#endif], -+ [cf_cv_xopen_source=no], -+ [cf_cv_xopen_source=$cf_XOPEN_SOURCE]) -+ CPPFLAGS="$cf_save" -+ ]) -+]) -+ -+if test "$cf_cv_xopen_source" != no ; then -+ CF_REMOVE_DEFINE(CFLAGS,$CFLAGS,_XOPEN_SOURCE) -+ CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,_XOPEN_SOURCE) -+ cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source" -+ CF_ADD_CFLAGS($cf_temp_xopen_source) -+fi -+]) -+dnl --------------------------------------------------------------------------- - dnl CF_UPPER version: 5 updated: 2001/01/29 23:40:59 - dnl -------- - dnl Make an uppercase version of a variable -@@ -2529,7 +2936,7 @@ - $1=`echo "$2" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_UTF8_LIB version: 7 updated: 2010/06/20 09:24:28 -+dnl CF_UTF8_LIB version: 8 updated: 2012/10/06 08:57:51 - dnl ----------- - dnl Check for multibyte support, and if not found, utf8 compatibility library - AC_DEFUN([CF_UTF8_LIB], -@@ -2548,7 +2955,7 @@ - # HAVE_LIBUTF8_H is used by ncurses if curses.h is shared between - # ncurses/ncursesw: - if test "$cf_cv_utf8_lib" = "add-on" ; then -- AC_DEFINE(HAVE_LIBUTF8_H) -+ AC_DEFINE(HAVE_LIBUTF8_H,1,[Define to 1 if we should include libutf8.h]) - CF_ADD_INCDIR($cf_cv_header_path_utf8) - CF_ADD_LIBDIR($cf_cv_library_path_utf8) - CF_ADD_LIBS($cf_cv_library_file_utf8) -@@ -2563,7 +2970,7 @@ - CF_MSG_LOG([$1]) - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_WCHAR_TYPE version: 3 updated: 2010/05/26 16:44:57 -+dnl CF_WCHAR_TYPE version: 4 updated: 2012/10/06 16:39:58 - dnl ------------- - dnl Check if type wide-character type $1 is declared, and if so, which header - dnl file is needed. The second parameter is used to set a shell variable when -@@ -2595,7 +3002,7 @@ - [cf_cv_$1=unknown])])]) - - if test "$cf_cv_$1" = yes ; then -- AC_DEFINE(NEED_WCHAR_H) -+ AC_DEFINE(NEED_WCHAR_H,1,[Define to 1 if we must include wchar.h]) - NEED_WCHAR_H=1 - fi - -@@ -2667,6 +3074,60 @@ - fi - ])dnl - dnl --------------------------------------------------------------------------- -+dnl CF_WITH_NCURSES_ETC version: 2 updated: 2012/01/13 10:49:00 -+dnl ------------------- -+dnl Use this macro for programs which use any variant of "curses", e.g., -+dnl "ncurses", and "PDCurses". Programs that can use curses and some unrelated -+dnl library (such as slang) should use a "--with-screen=XXX" option. -+dnl -+dnl This does not use AC_DEFUN, because that would tell autoconf to run each -+dnl of the macros inside this one - before this macro. -+define([CF_WITH_NCURSES_ETC],[ -+CF_WITH_CURSES_DIR -+ -+cf_cv_screen=curses -+ -+AC_MSG_CHECKING(for specified curses library type) -+AC_ARG_WITH(ncursesw, -+ [ --with-ncursesw use wide ncurses-libraries], -+ [cf_cv_screen=ncursesw],[ -+ -+AC_ARG_WITH(ncurses, -+ [ --with-ncurses use ncurses-libraries], -+ [cf_cv_screen=ncurses],[ -+ -+AC_ARG_WITH(pdcurses, -+ [ --with-pdcurses compile/link with pdcurses X11 library], -+ [cf_cv_screen=pdcurses],[ -+ -+AC_ARG_WITH(curses-colr, -+ [ --with-curses-colr compile/link with HPUX 10.x color-curses], -+ [cf_cv_screen=curses_colr],[ -+ -+AC_ARG_WITH(curses-5lib, -+ [ --with-curses-5lib compile/link with SunOS 5lib curses], -+ [cf_cv_screen=curses_5lib])])])])]) -+ -+AC_MSG_RESULT($cf_cv_screen) -+ -+case $cf_cv_screen in #(vi -+curses|curses_*) #(vi -+ CF_CURSES_CONFIG -+ ;; -+ncurses) #(vi -+ CF_NCURSES_CONFIG -+ ;; -+ncursesw) #(vi -+ CF_UTF8_LIB -+ CF_NCURSES_CONFIG(ncursesw) -+ ;; -+pdcurses) -+ CF_PDCURSES_X11 -+ ;; -+esac -+ -+])dnl -+dnl --------------------------------------------------------------------------- - dnl CF_WITH_VALGRIND version: 1 updated: 2006/12/14 18:00:21 - dnl ---------------- - AC_DEFUN([CF_WITH_VALGRIND],[ -@@ -2714,7 +3175,7 @@ - test $cf_cv_need_xopen_extension = yes && CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED" - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_XOPEN_SOURCE version: 35 updated: 2011/02/20 20:37:37 -+dnl CF_XOPEN_SOURCE version: 46 updated: 2014/02/09 19:30:15 - dnl --------------- - dnl Try to get _XOPEN_SOURCE defined properly that we can use POSIX functions, - dnl or adapt to the vendor's definitions to get equivalent functionality, -@@ -2724,16 +3185,17 @@ - dnl $1 is the nominal value for _XOPEN_SOURCE - dnl $2 is the nominal value for _POSIX_C_SOURCE - AC_DEFUN([CF_XOPEN_SOURCE],[ -+AC_REQUIRE([AC_CANONICAL_HOST]) - - cf_XOPEN_SOURCE=ifelse([$1],,500,[$1]) - cf_POSIX_C_SOURCE=ifelse([$2],,199506L,[$2]) - cf_xopen_source= - - case $host_os in #(vi --aix[[456]]*) #(vi -+aix[[4-7]]*) #(vi - cf_xopen_source="-D_ALL_SOURCE" - ;; --cygwin) #(vi -+cygwin|msys) #(vi - cf_XOPEN_SOURCE=600 - ;; - darwin[[0-8]].*) #(vi -@@ -2741,6 +3203,7 @@ - ;; - darwin*) #(vi - cf_xopen_source="-D_DARWIN_C_SOURCE" -+ cf_XOPEN_SOURCE= - ;; - freebsd*|dragonfly*) #(vi - # 5.x headers associate -@@ -2758,15 +3221,23 @@ - ;; - irix[[56]].*) #(vi - cf_xopen_source="-D_SGI_SOURCE" -+ cf_XOPEN_SOURCE= - ;; - linux*|gnu*|mint*|k*bsd*-gnu) #(vi - CF_GNU_SOURCE - ;; - mirbsd*) #(vi -- # setting _XOPEN_SOURCE or _POSIX_SOURCE breaks <arpa/inet.h> -+ # setting _XOPEN_SOURCE or _POSIX_SOURCE breaks <sys/select.h> and other headers which use u_int / u_short types -+ cf_XOPEN_SOURCE= -+ CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE) - ;; - netbsd*) #(vi -- # setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw -+ cf_xopen_source="-D_NETBSD_SOURCE" # setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw -+ ;; -+openbsd[[4-9]]*) #(vi -+ # setting _XOPEN_SOURCE lower than 500 breaks g++ compile with wchar.h, needed for ncursesw -+ cf_xopen_source="-D_BSD_SOURCE" -+ cf_XOPEN_SOURCE=600 - ;; - openbsd*) #(vi - # setting _XOPEN_SOURCE breaks xterm on OpenBSD 2.8, is not needed for ncursesw -@@ -2780,36 +3251,12 @@ - sco*) #(vi - # setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer - ;; --solaris2.1[[0-9]]) #(vi -- cf_xopen_source="-D__EXTENSIONS__ -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" -- ;; --solaris2.[[1-9]]) #(vi -+solaris2.*) #(vi - cf_xopen_source="-D__EXTENSIONS__" -+ cf_cv_xopen_source=broken - ;; - *) -- AC_CACHE_CHECK(if we should define _XOPEN_SOURCE,cf_cv_xopen_source,[ -- AC_TRY_COMPILE([#include <sys/types.h>],[ --#ifndef _XOPEN_SOURCE --make an error --#endif], -- [cf_cv_xopen_source=no], -- [cf_save="$CPPFLAGS" -- CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" -- AC_TRY_COMPILE([#include <sys/types.h>],[ --#ifdef _XOPEN_SOURCE --make an error --#endif], -- [cf_cv_xopen_source=no], -- [cf_cv_xopen_source=$cf_XOPEN_SOURCE]) -- CPPFLAGS="$cf_save" -- ]) --]) -- if test "$cf_cv_xopen_source" != no ; then -- CF_REMOVE_DEFINE(CFLAGS,$CFLAGS,_XOPEN_SOURCE) -- CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,_XOPEN_SOURCE) -- cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source" -- CF_ADD_CFLAGS($cf_temp_xopen_source) -- fi -+ CF_TRY_XOPEN_SOURCE - CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE) - ;; - esac -@@ -2817,9 +3264,38 @@ - if test -n "$cf_xopen_source" ; then - CF_ADD_CFLAGS($cf_xopen_source) - fi -+ -+dnl In anything but the default case, we may have system-specific setting -+dnl which is still not guaranteed to provide all of the entrypoints that -+dnl _XOPEN_SOURCE would yield. -+if test -n "$cf_XOPEN_SOURCE" && test -z "$cf_cv_xopen_source" ; then -+ AC_MSG_CHECKING(if _XOPEN_SOURCE really is set) -+ AC_TRY_COMPILE([#include <stdlib.h>],[ -+#ifndef _XOPEN_SOURCE -+make an error -+#endif], -+ [cf_XOPEN_SOURCE_set=yes], -+ [cf_XOPEN_SOURCE_set=no]) -+ AC_MSG_RESULT($cf_XOPEN_SOURCE_set) -+ if test $cf_XOPEN_SOURCE_set = yes -+ then -+ AC_TRY_COMPILE([#include <stdlib.h>],[ -+#if (_XOPEN_SOURCE - 0) < $cf_XOPEN_SOURCE -+make an error -+#endif], -+ [cf_XOPEN_SOURCE_set_ok=yes], -+ [cf_XOPEN_SOURCE_set_ok=no]) -+ if test $cf_XOPEN_SOURCE_set_ok = no -+ then -+ AC_MSG_WARN(_XOPEN_SOURCE is lower than requested) -+ fi -+ else -+ CF_TRY_XOPEN_SOURCE -+ fi -+fi - ]) - dnl --------------------------------------------------------------------------- --dnl CF_X_ATHENA version: 20 updated: 2010/11/09 05:18:02 -+dnl CF_X_ATHENA version: 21 updated: 2013/07/06 21:27:06 - dnl ----------- - dnl Check for Xaw (Athena) libraries - dnl -@@ -2878,6 +3354,8 @@ - CF_UPPER(cf_x_athena_LIBS,HAVE_LIB_$cf_x_athena) - AC_DEFINE_UNQUOTED($cf_x_athena_LIBS) - -+ CF_TRIM_X_LIBS -+ - AC_CACHE_CHECK(for usable $cf_x_athena/Xmu package,cf_cv_xaw_compat,[ - AC_TRY_LINK([ - #include <X11/Xmu/CharSet.h> -@@ -2893,7 +3371,15 @@ - ;; - *) - CF_VERBOSE(work around broken package) -- CF_TRY_PKG_CONFIG(xmu,,[CF_ADD_LIB_AFTER(-lXt,-lXmu)]) -+ cf_save_xmu="$LIBS" -+ cf_first_lib=`echo "$cf_save_xmu" | sed -e 's/^[ ][ ]*//' -e 's/ .*//'` -+ CF_TRY_PKG_CONFIG(xmu,[ -+ LIBS="$cf_save_xmu" -+ CF_ADD_LIB_AFTER($cf_first_lib,$cf_pkgconfig_libs) -+ ],[ -+ CF_ADD_LIB_AFTER($cf_first_lib,-lXmu) -+ ]) -+ CF_TRIM_X_LIBS - ;; - esac - fi -@@ -2957,7 +3443,7 @@ - fi - ]) - dnl --------------------------------------------------------------------------- --dnl CF_X_ATHENA_LIBS version: 10 updated: 2011/02/13 13:31:33 -+dnl CF_X_ATHENA_LIBS version: 12 updated: 2011/07/17 19:55:02 - dnl ---------------- - dnl Normally invoked by CF_X_ATHENA, with $1 set to the appropriate flavor of - dnl the Athena widgets, e.g., Xaw, Xaw3d, neXtaw. -@@ -2973,19 +3459,24 @@ - /usr/local - do - for cf_lib in \ -- "-l$cf_x_athena_root -lXmu" \ -- "-l$cf_x_athena_root -lXpm -lXmu" \ -- "-l${cf_x_athena_root}_s -lXmu_s" -+ ${cf_x_athena_root} \ -+ ${cf_x_athena_root}7 \ -+ ${cf_x_athena_root}6 -+ do -+ for cf_libs in \ -+ "-l$cf_lib -lXmu" \ -+ "-l$cf_lib -lXpm -lXmu" \ -+ "-l${cf_lib}_s -lXmu_s" - do - if test -z "$cf_x_athena_lib" ; then - cf_save="$LIBS" - cf_test=XawSimpleMenuAddGlobalActions - if test $cf_path != default ; then -- CF_ADD_LIBS(-L$cf_path/lib $cf_lib) -- AC_MSG_CHECKING(for $cf_lib in $cf_path) -+ CF_ADD_LIBS(-L$cf_path/lib $cf_libs) -+ AC_MSG_CHECKING(for $cf_libs in $cf_path) - else -- CF_ADD_LIBS($cf_lib) -- AC_MSG_CHECKING(for $cf_test in $cf_lib) -+ CF_ADD_LIBS($cf_libs) -+ AC_MSG_CHECKING(for $cf_test in $cf_libs) - fi - AC_TRY_LINK([ - #include <X11/Intrinsic.h> -@@ -2996,12 +3487,14 @@ - [cf_result=no]) - AC_MSG_RESULT($cf_result) - if test "$cf_result" = yes ; then -- cf_x_athena_lib="$cf_lib" -+ cf_x_athena_lib="$cf_libs" - break - fi - LIBS="$cf_save" - fi -- done -+ done # cf_libs -+ test -n "$cf_x_athena_lib" && break -+ done # cf_lib - done - - if test -z "$cf_x_athena_lib" ; then -@@ -3021,7 +3514,7 @@ - [CF_ADD_LIB(Xext)])]) - ])dnl - dnl --------------------------------------------------------------------------- --dnl CF_X_TOOLKIT version: 20 updated: 2010/11/19 05:43:04 -+dnl CF_X_TOOLKIT version: 21 updated: 2012/10/04 06:57:36 - dnl ------------ - dnl Check for X Toolkit libraries - dnl -@@ -3095,7 +3588,7 @@ - - AC_CHECK_FUNC(XtAppInitialize,,[ - AC_CHECK_LIB(Xt, XtAppInitialize, -- [AC_DEFINE(HAVE_LIBXT) -+ [AC_DEFINE(HAVE_LIBXT,1,[Define to 1 if we can compile with the Xt library]) - cf_have_X_LIBS=Xt - LIBS="-lXt $X_PRE_LIBS $LIBS $X_EXTRA_LIBS"],, - [$X_PRE_LIBS $LIBS $X_EXTRA_LIBS])]) -diff -Naur ncurses-5.9/test/background.c ncurses-5.9.patch/test/background.c ---- ncurses-5.9/test/background.c 2006-06-03 18:43:08.000000000 +0200 -+++ ncurses-5.9.patch/test/background.c 2014-09-01 16:33:22.526792407 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 2003,2006 Free Software Foundation, Inc. * -+ * Copyright (c) 2003-2012,2014 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -26,15 +26,172 @@ - * authorization. * - ****************************************************************************/ - /* -- * $Id: background.c,v 1.3 2006/06/03 16:43:08 tom Exp $ -+ * $Id: background.c,v 1.14 2014/02/01 22:10:42 tom Exp $ - */ - --#include <test.priv.h> -+#define NEED_COLOR_CODE 1 -+#define NEED_COLOR_NAME 1 -+#include <color_name.h> -+ -+static int default_bg = COLOR_BLACK; -+static int default_fg = COLOR_WHITE; -+ -+static void -+test_background(void) -+{ -+ NCURSES_COLOR_T f, b; -+ int row; -+ int chr; -+ -+ if (pair_content(0, &f, &b) == ERR) { -+ printw("pair 0 contains no data\n"); -+ } else { -+ printw("pair 0 contains (%d,%d)\n", (int) f, (int) b); -+ } -+ getch(); -+ -+ printw("Initializing pair 1 to red/%s\n", color_name(default_bg)); -+ init_pair(1, COLOR_RED, (NCURSES_COLOR_T) default_bg); -+ bkgdset((chtype) (' ' | COLOR_PAIR(1))); -+ printw("RED/BLACK\n"); -+ getch(); -+ -+ printw("Initializing pair 2 to %s/blue\n", color_name(default_fg)); -+ init_pair(2, (NCURSES_COLOR_T) default_fg, COLOR_BLUE); -+ bkgdset((chtype) (' ' | COLOR_PAIR(2))); -+ printw("This line should be %s/blue\n", color_name(default_fg)); -+ getch(); -+ -+ printw("Initializing pair 3 to %s/cyan (ACS_HLINE)\n", color_name(default_fg)); -+ init_pair(3, (NCURSES_COLOR_T) default_fg, COLOR_CYAN); -+ printw("...and drawing a box which should be followed by lines\n"); -+ bkgdset(ACS_HLINE | COLOR_PAIR(3)); -+ /* -+ * Characters from vt100 line-drawing should be mapped to line-drawing, -+ * since A_ALTCHARSET is set in the background, and the character part -+ * of the background is replaced by the nonblank characters written. -+ * -+ * Characters not in the line-drawing range are usually sent as-is. -+ * -+ * With SVr4 curses it is possible to rely on this to mix uppercase text -+ * with the (lowercase) line-drawing characters. ncurses uses some of -+ * the uppercase characters for encoding thick- and double-lines. -+ */ -+ row = 7; -+ mvprintw(row++, 10, "l"); -+ for (chr = 0; chr < 32; ++chr) -+ addch(' '); -+ printw("x\n"); -+ chr = 32; -+ while (chr < 128) { -+ if ((chr % 32) == 0) -+ mvprintw(row++, 10, "x"); -+ addch((chtype) ((chr == 127) ? ' ' : chr)); -+ if ((++chr % 32) == 0) -+ printw("x\n"); -+ } -+ mvprintw(row++, 10, "m"); -+ for (chr = 0; chr < 32; ++chr) -+ addch(' '); -+ printw("j\n"); -+ getch(); -+ -+ bkgdset((chtype) (' ' | COLOR_PAIR(0))); -+ printw("Default Colors\n"); -+ getch(); -+ -+ printw("Resetting colors to pair 1\n"); -+ bkgdset((chtype) (' ' | COLOR_PAIR(1))); -+ printw("This line should be red/%s\n", color_name(default_bg)); -+ getch(); -+ -+ printw("Setting screen to pair 0\n"); -+ bkgd((chtype) (' ' | COLOR_PAIR(0))); -+ getch(); -+ -+ printw("Setting screen to pair 1\n"); -+ bkgd((chtype) (' ' | COLOR_PAIR(1))); -+ getch(); -+ -+ printw("Setting screen to pair 2\n"); -+ bkgd((chtype) (' ' | COLOR_PAIR(2))); -+ getch(); -+ -+ printw("Setting screen to pair 3\n"); -+ bkgd((chtype) (' ' | COLOR_PAIR(3))); -+ getch(); -+ -+ printw("Setting screen to pair 0\n"); -+ bkgd((chtype) (' ' | COLOR_PAIR(0))); -+ getch(); -+} -+ -+static void -+usage(void) -+{ -+ static const char *msg[] = -+ { -+ "Usage: background [options]" -+ ,"" -+ ,"Options:" -+#if HAVE_ASSUME_DEFAULT_COLORS -+ ," -a invoke assume_default_colors, repeat to use in init_pair" -+#endif -+ ," -b XXX specify background color" -+#if HAVE_USE_DEFAULT_COLORS -+ ," -d invoke use_default_colors, repeat to use in init_pair" -+#endif -+ ," -f XXX specify foreground color" -+ }; -+ size_t n; -+ -+ for (n = 0; n < SIZEOF(msg); n++) -+ fprintf(stderr, "%s\n", msg[n]); -+ -+ ExitProgram(EXIT_FAILURE); -+} - - int - main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) - { -- short f, b; -+#if HAVE_ASSUME_DEFAULT_COLORS -+ int a_option = 0; -+#endif -+#if HAVE_USE_DEFAULT_COLORS -+ int d_option = 0; -+#endif -+ int n; -+ -+ setlocale(LC_ALL, ""); -+ -+ while ((n = getopt(argc, argv, "ab:df:")) != -1) { -+ switch (n) { -+#if HAVE_ASSUME_DEFAULT_COLORS -+ case 'a': -+ ++a_option; -+ break; -+#endif -+ case 'b': -+ default_bg = color_code(optarg); -+ break; -+#if HAVE_USE_DEFAULT_COLORS -+ case 'd': -+ ++d_option; -+ break; -+#endif -+ case 'f': -+ default_fg = color_code(optarg); -+ break; -+ default: -+ usage(); -+ } -+ } -+#if HAVE_USE_DEFAULT_COLORS && HAVE_ASSUME_DEFAULT_COLORS -+ if (a_option && d_option) { -+ fprintf(stderr, "Use either -a or -d option, but not both\n"); -+ ExitProgram(EXIT_FAILURE); -+ } -+#endif - - initscr(); - cbreak(); -@@ -43,47 +200,30 @@ - if (has_colors()) { - start_color(); - -- pair_content(0, &f, &b); -- printw("pair 0 contains (%d,%d)\n", f, b); -- getch(); -- -- printw("Initializing pair 1 to red/black\n"); -- init_pair(1, COLOR_RED, COLOR_BLACK); -- bkgdset(' ' | COLOR_PAIR(1)); -- printw("RED/BLACK\n"); -- getch(); -- -- printw("Initializing pair 2 to white/blue\n"); -- init_pair(2, COLOR_WHITE, COLOR_BLUE); -- bkgdset(' ' | COLOR_PAIR(2)); -- printw("WHITE/BLUE\n"); -- getch(); -- -- printw("Resetting colors to pair 0\n"); -- bkgdset(' ' | COLOR_PAIR(0)); -- printw("Default Colors\n"); -- getch(); -- -- printw("Resetting colors to pair 1\n"); -- bkgdset(' ' | COLOR_PAIR(1)); -- printw("RED/BLACK\n"); -- getch(); -- -- printw("Setting screen to pair 0\n"); -- bkgd(' ' | COLOR_PAIR(0)); -- getch(); -- -- printw("Setting screen to pair 1\n"); -- bkgd(' ' | COLOR_PAIR(1)); -- getch(); -- -- printw("Setting screen to pair 2\n"); -- bkgd(' ' | COLOR_PAIR(2)); -- getch(); -- -- printw("Setting screen to pair 0\n"); -- bkgd(' ' | COLOR_PAIR(0)); -- getch(); -+#if HAVE_USE_DEFAULT_COLORS -+ if (d_option) { -+ printw("Using default colors...\n"); -+ use_default_colors(); -+ if (d_option > 1) { -+ default_fg = -1; -+ default_bg = -1; -+ } -+ } -+#endif -+#if HAVE_ASSUME_DEFAULT_COLORS -+ if (a_option) { -+ printw("Using assumed colors %s/%s...\n", -+ color_name(default_fg), -+ color_name(default_bg)); -+ assume_default_colors(default_fg, default_bg); -+ if (a_option > 1) { -+ default_fg = -1; -+ default_bg = -1; -+ } -+ } -+#endif -+ -+ test_background(); - - } else { - printw("This demo requires a color terminal"); -diff -Naur ncurses-5.9/test/blue.c ncurses-5.9.patch/test/blue.c ---- ncurses-5.9/test/blue.c 2009-10-24 23:03:35.000000000 +0200 -+++ ncurses-5.9.patch/test/blue.c 2014-09-01 16:33:22.526792407 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2008,2009 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2009,2013 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -40,7 +40,7 @@ - * results, use the ncurses(3) library. On non-Intel machines, SVr4 curses is - * just as good. - * -- * $Id: blue.c,v 1.33 2009/10/24 21:03:35 tom Exp $ -+ * $Id: blue.c,v 1.35 2013/04/27 19:46:53 tom Exp $ - */ - - #include <test.priv.h> -@@ -70,7 +70,7 @@ - #define BLACK_ON_WHITE 2 - #define BLUE_ON_WHITE 3 - --static RETSIGTYPE die(int onsig) GCC_NORETURN; -+static void die(int onsig) GCC_NORETURN; - - static int deck_size = PACK_SIZE; /* initial deck */ - static int deck[PACK_SIZE]; -@@ -132,7 +132,7 @@ - - static chtype *suits = letters; /* this may change to glyphs below */ - --static RETSIGTYPE -+static void - die(int onsig) - { - (void) signal(onsig, SIG_IGN); -@@ -202,8 +202,8 @@ - if (value == NOCARD) - (void) addstr(" "); - else { -- addch(ranks[value % SUIT_LENGTH][0] | COLOR_PAIR(BLUE_ON_WHITE)); -- addch(ranks[value % SUIT_LENGTH][1] | COLOR_PAIR(BLUE_ON_WHITE)); -+ addch(ranks[value % SUIT_LENGTH][0] | (chtype) COLOR_PAIR(BLUE_ON_WHITE)); -+ addch(ranks[value % SUIT_LENGTH][1] | (chtype) COLOR_PAIR(BLUE_ON_WHITE)); - addch(suits[value / SUIT_LENGTH]); - } - (void) addch(' '); -diff -Naur ncurses-5.9/test/bs.c ncurses-5.9.patch/test/bs.c ---- ncurses-5.9/test/bs.c 2010-11-13 21:07:52.000000000 +0100 -+++ ncurses-5.9.patch/test/bs.c 2014-09-01 16:33:22.526792407 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -34,7 +34,7 @@ - * v2.0 featuring strict ANSI/POSIX conformance, November 1993. - * v2.1 with ncurses mouse support, September 1995 - * -- * $Id: bs.c,v 1.52 2010/11/13 20:07:52 tom Exp $ -+ * $Id: bs.c,v 1.62 2013/11/16 19:57:56 tom Exp $ - */ - - #include <test.priv.h> -@@ -110,7 +110,7 @@ - static char destroy[] = "Destroyer"; - static char ptboat[] = "PT Boat"; - --static char name[40]; -+static char *your_name; - static char dftname[] = "stranger"; - - /* direction constants */ -@@ -174,9 +174,9 @@ - - #define PR (void)addstr - --static RETSIGTYPE uninitgame(int sig) GCC_NORETURN; -+static void uninitgame(int sig) GCC_NORETURN; - --static RETSIGTYPE -+static void - uninitgame(int sig GCC_UNUSED) - /* end the game, either normally or due to signal */ - { -@@ -220,11 +220,12 @@ - - CATCHALL(uninitgame); - -- if ((tmpname = getlogin()) != 0) { -- (void) strcpy(name, tmpname); -- name[0] = (char) toupper(UChar(name[0])); -- } else -- (void) strcpy(name, dftname); -+ if ((tmpname = getlogin()) != 0 && -+ (your_name = strdup(tmpname)) != 0) { -+ your_name[0] = (char) toupper(UChar(your_name[0])); -+ } else { -+ your_name = dftname; -+ } - - (void) initscr(); - keypad(stdscr, TRUE); -@@ -368,7 +369,7 @@ - MvAddCh(PYBASE + i, PXBASE - 3, (chtype) (i + 'A')); - #ifdef A_COLOR - if (has_colors()) -- attron(COLOR_PAIR(COLOR_BLUE)); -+ attron((attr_t) COLOR_PAIR(COLOR_BLUE)); - #endif /* A_COLOR */ - (void) addch(' '); - for (j = 0; j < BWIDTH; j++) -@@ -386,7 +387,7 @@ - MvAddCh(CYBASE + i, CXBASE - 3, (chtype) (i + 'A')); - #ifdef A_COLOR - if (has_colors()) -- attron(COLOR_PAIR(COLOR_BLUE)); -+ attron((attr_t) COLOR_PAIR(COLOR_BLUE)); - #endif /* A_COLOR */ - (void) addch(' '); - for (j = 0; j < BWIDTH; j++) -@@ -426,10 +427,11 @@ - placeship(COMPUTER, ss, FALSE); - } - -- ss = (ship_t *) NULL; - do { - char c, docked[SHIPTYPES + 2], *cp = docked; - -+ ss = (ship_t *) NULL; -+ - /* figure which ships still wait to be placed */ - *cp++ = 'R'; - for (i = 0; i < SHIPTYPES; i++) -@@ -442,7 +444,7 @@ - do { - c = (char) getcoord(PLAYER); - } while -- (!strchr(docked, c)); -+ (!(strchr) (docked, c)); - - if (c == 'R') - (void) ungetch('R'); -@@ -459,13 +461,14 @@ - do { - c = (char) getch(); - } while -- (!(strchr("hjklrR", c) || c == FF)); -+ (!(strchr("hjkl8462rR", c) || c == FF)); - - if (c == FF) { - (void) clearok(stdscr, TRUE); - (void) refresh(); -+ } else if (ss == 0) { -+ beep(); /* simple to verify, unlikely to happen */ - } else if (c == 'r') { -- assert(ss != 0); - prompt(1, "Random-placing your %s", ss->name); - randomplace(PLAYER, ss); - placeship(PLAYER, ss, TRUE); -@@ -481,7 +484,6 @@ - } - error((char *) NULL); - } else if (strchr("hjkl8462", c)) { -- assert(ss != 0); - ss->x = curx; - ss->y = cury; - -@@ -769,7 +771,7 @@ - cgoto(y1, x1); - #ifdef A_COLOR - if (has_colors()) -- attron(COLOR_PAIR(COLOR_GREEN)); -+ attron((attr_t) COLOR_PAIR(COLOR_GREEN)); - #endif /* A_COLOR */ - (void) addch(MARK_MISS); - #ifdef A_COLOR -@@ -795,7 +797,7 @@ - pgoto(y1, x1); - #ifdef A_COLOR - if (has_colors()) -- attron(COLOR_PAIR(COLOR_RED)); -+ attron((attr_t) COLOR_PAIR(COLOR_RED)); - #endif /* A_COLOR */ - (void) addch(SHOWHIT); - #ifdef A_COLOR -@@ -834,9 +836,9 @@ - #ifdef A_COLOR - if (has_colors()) { - if (hit) -- attron(COLOR_PAIR(COLOR_RED)); -+ attron((attr_t) COLOR_PAIR(COLOR_RED)); - else -- attron(COLOR_PAIR(COLOR_GREEN)); -+ attron((attr_t) COLOR_PAIR(COLOR_GREEN)); - } - #endif /* A_COLOR */ - (void) addch((chtype) hits[PLAYER][curx][cury]); -@@ -863,7 +865,9 @@ - m = " You'll pick up survivors from my %s, I hope...!"; - break; - } -- (void) printw(m, ss->name); -+ if (m != 0) { -+ (void) printw(m, ss->name); -+ } - (void) beep(); - } - return (hit); -@@ -952,8 +956,8 @@ - bool hit, sunk; - ship_t *ss = NULL; - -- hit = board[PLAYER][x][y] ? MARK_HIT : MARK_MISS; -- hits[COMPUTER][x][y] = (char) hit; -+ hit = (bool) board[PLAYER][x][y]; -+ hits[COMPUTER][x][y] = (hit ? MARK_HIT : MARK_MISS); - MvPrintw(PROMPTLINE, 0, - "I shoot at %c%d. I %s!", y + 'A', x, hit ? "hit" : - "miss"); -@@ -965,9 +969,9 @@ - #ifdef A_COLOR - if (has_colors()) { - if (hit) -- attron(COLOR_PAIR(COLOR_RED)); -+ attron((attr_t) COLOR_PAIR(COLOR_RED)); - else -- attron(COLOR_PAIR(COLOR_GREEN)); -+ attron((attr_t) COLOR_PAIR(COLOR_GREEN)); - } - #endif /* A_COLOR */ - (void) addch((chtype) (hit ? SHOWHIT : SHOWSPLASH)); -@@ -1130,16 +1134,16 @@ - ++cpuwon; - else - ++plywon; -- j = 18 + (int) strlen(name); -+ j = 18 + (int) strlen(your_name); - if (plywon >= 10) - ++j; - if (cpuwon >= 10) - ++j; - MvPrintw(1, (COLWIDTH - j) / 2, -- "%s: %d Computer: %d", name, plywon, cpuwon); -+ "%s: %d Computer: %d", your_name, plywon, cpuwon); - - prompt(2, (awinna())? "Want to be humiliated again, %s [yn]? " -- : "Going to give me a chance for revenge, %s [yn]? ", name); -+ : "Going to give me a chance for revenge, %s [yn]? ", your_name); - return (sgetc("YN") == 'Y'); - } - -diff -Naur ncurses-5.9/test/cardfile.c ncurses-5.9.patch/test/cardfile.c ---- ncurses-5.9/test/cardfile.c 2010-11-14 01:58:45.000000000 +0100 -+++ ncurses-5.9.patch/test/cardfile.c 2014-09-01 16:33:22.526792407 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1999-2008,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1999-2012,2013 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -29,7 +29,7 @@ - /* - * Author: Thomas E. Dickey - * -- * $Id: cardfile.c,v 1.38 2010/11/14 00:58:45 tom Exp $ -+ * $Id: cardfile.c,v 1.42 2013/09/28 22:02:17 tom Exp $ - * - * File format: text beginning in column 1 is a title; other text is content. - */ -@@ -68,17 +68,13 @@ - static bool try_color = FALSE; - static char default_name[] = "cardfile.dat"; - --#if !HAVE_STRDUP --#define strdup my_strdup --static char * --strdup(const char *s) --{ -- char *p = typeMalloc(char, strlen(s) + 1); -- if (p) -- strcpy(p, s); -- return (p); -+static void -+failed(const char *s) -+{ -+ perror(s); -+ endwin(); -+ ExitProgram(EXIT_FAILURE); - } --#endif /* not HAVE_STRDUP */ - - static const char * - skip(const char *buffer) -@@ -111,7 +107,7 @@ - break; - } - -- card = typeCalloc(CARD, 1); -+ card = typeCalloc(CARD, (size_t) 1); - card->title = strdup(title); - card->content = strdup(""); - -@@ -146,6 +142,8 @@ - } - if (card->content) - strcpy(card->content + offset, content); -+ else -+ failed("add_content"); - } - } - -@@ -337,7 +335,7 @@ - static FIELD ** - make_fields(CARD * p, int form_high, int form_wide) - { -- FIELD **f = typeCalloc(FIELD *, 3); -+ FIELD **f = typeCalloc(FIELD *, (size_t) 3); - - f[0] = new_field(1, form_wide, 0, 0, 0, 0); - set_field_back(f[0], A_REVERSE); -@@ -414,7 +412,7 @@ - if ((win = newwin(panel_high, panel_wide, y, x)) == 0) - break; - -- wbkgd(win, COLOR_PAIR(pair_2)); -+ wbkgd(win, (chtype) COLOR_PAIR(pair_2)); - keypad(win, TRUE); - p->panel = new_panel(win); - box(win, 0, 0); -@@ -588,7 +586,7 @@ - start_color(); - init_pair(pair_1, COLOR_WHITE, COLOR_BLUE); - init_pair(pair_2, COLOR_WHITE, COLOR_CYAN); -- bkgd(COLOR_PAIR(pair_1)); -+ bkgd((chtype) COLOR_PAIR(pair_1)); - } else { - try_color = FALSE; - } -diff -Naur ncurses-5.9/test/chgat.c ncurses-5.9.patch/test/chgat.c ---- ncurses-5.9/test/chgat.c 2010-05-01 21:12:26.000000000 +0200 -+++ ncurses-5.9.patch/test/chgat.c 2014-09-01 16:33:22.526792407 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 2006-2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 2006-2010,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -26,7 +26,7 @@ - * authorization. * - ****************************************************************************/ - /* -- * $Id: chgat.c,v 1.11 2010/05/01 19:12:26 tom Exp $ -+ * $Id: chgat.c,v 1.12 2012/11/18 01:55:35 tom Exp $ - * - * test-driver for chgat/wchgat/mvchgat/mvwchgat - */ -@@ -176,6 +176,8 @@ - delwin(win1); - touchwin(win); - } else { -+ if (win1 != 0) -+ delwin(win1); - beep(); - } - } -diff -Naur ncurses-5.9/test/clip_printw.c ncurses-5.9.patch/test/clip_printw.c ---- ncurses-5.9/test/clip_printw.c 2010-11-13 21:48:48.000000000 +0100 -+++ ncurses-5.9.patch/test/clip_printw.c 2014-09-01 16:33:22.527792409 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 2008-2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 2008-2010,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -26,7 +26,7 @@ - * authorization. * - ****************************************************************************/ - /* -- * $Id: clip_printw.c,v 1.7 2010/11/13 20:48:48 tom Exp $ -+ * $Id: clip_printw.c,v 1.9 2012/11/18 00:39:48 tom Exp $ - * - * demonstrate how to use printw without wrapping. - */ -@@ -207,6 +207,8 @@ - delwin(win1); - touchwin(win); - } else { -+ if (win1) -+ delwin(win1); - beep(); - } - } -@@ -329,7 +331,7 @@ - do { - switch (st.ch) { - case '.': /* change from current position */ -- (void) wattrset(win, st.attr | (chtype) COLOR_PAIR(st.pair)); -+ (void) wattrset(win, (int) (st.attr | (chtype) COLOR_PAIR(st.pair))); - if (st.count > 0) { - need = (unsigned) st.count + 1; - sprintf(fmt, "%%c%%%ds%%c", st.count); -@@ -337,12 +339,13 @@ - need = (unsigned) getmaxx(win) - 1; - strcpy(fmt, "%c%s%c"); - } -- if ((buffer = typeMalloc(char, need)) != 0) { -+ if ((buffer = typeMalloc(char, need + 1)) != 0) { - for (j = 0; j < need; ++j) { - buffer[j] = (char) ('A' + (j % 26)); - } - buffer[need - 1] = '\0'; - st.status = clip_wprintw(win, fmt, '[', buffer, ']'); -+ free(buffer); - } - break; - case 'w': -diff -Naur ncurses-5.9/test/color_name.h ncurses-5.9.patch/test/color_name.h ---- ncurses-5.9/test/color_name.h 1970-01-01 01:00:00.000000000 +0100 -+++ ncurses-5.9.patch/test/color_name.h 2014-09-01 16:33:22.527792409 +0200 -@@ -0,0 +1,103 @@ -+/**************************************************************************** -+ * Copyright (c) 2011,2012 Free Software Foundation, Inc. * -+ * * -+ * Permission is hereby granted, free of charge, to any person obtaining a * -+ * copy of this software and associated documentation files (the * -+ * "Software"), to deal in the Software without restriction, including * -+ * without limitation the rights to use, copy, modify, merge, publish, * -+ * distribute, distribute with modifications, sublicense, and/or sell * -+ * copies of the Software, and to permit persons to whom the Software is * -+ * furnished to do so, subject to the following conditions: * -+ * * -+ * The above copyright notice and this permission notice shall be included * -+ * in all copies or substantial portions of the Software. * -+ * * -+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * -+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * -+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * -+ * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * -+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * -+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * -+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * -+ * * -+ * Except as contained in this notice, the name(s) of the above copyright * -+ * holders shall not be used in advertising or otherwise to promote the * -+ * sale, use or other dealings in this Software without prior written * -+ * authorization. * -+ ****************************************************************************/ -+/* -+ * $Id: color_name.h,v 1.4 2012/11/18 01:59:32 tom Exp $ -+ */ -+ -+#ifndef __COLORNAME_H -+#define __COLORNAME_H 1 -+ -+#ifndef __TEST_PRIV_H -+#include <test.priv.h> -+#endif -+ -+static NCURSES_CONST char *the_color_names[] = -+{ -+ "black", -+ "red", -+ "green", -+ "yellow", -+ "blue", -+ "magenta", -+ "cyan", -+ "white", -+ "BLACK", -+ "RED", -+ "GREEN", -+ "YELLOW", -+ "BLUE", -+ "MAGENTA", -+ "CYAN", -+ "WHITE" -+}; -+ -+#ifdef NEED_COLOR_CODE -+static int -+color_code(const char *color) -+{ -+ int result = 0; -+ char *endp = 0; -+ size_t n; -+ -+ if ((result = (int) strtol(color, &endp, 0)) >= 0 -+ && (endp == 0 || *endp == 0)) { -+ ; -+ } else if (!strcmp(color, "default")) { -+ result = -1; -+ } else { -+ for (n = 0; n < SIZEOF(the_color_names); ++n) { -+ if (!strcmp(the_color_names[n], color)) { -+ result = (int) n; -+ break; -+ } -+ } -+ } -+ return result; -+} -+#endif /* NEED_COLOR_NAME */ -+ -+#ifdef NEED_COLOR_NAME -+static const char * -+color_name(int color) -+{ -+ static char temp[20]; -+ const char *result = 0; -+ -+ if (color >= (int) SIZEOF(the_color_names)) { -+ sprintf(temp, "%d", color); -+ result = temp; -+ } else if (color < 0) { -+ result = "default"; -+ } else { -+ result = the_color_names[color]; -+ } -+ return result; -+} -+#endif /* NEED_COLOR_NAME */ -+ -+#endif /* __COLORNAME_H */ -diff -Naur ncurses-5.9/test/color_set.c ncurses-5.9.patch/test/color_set.c ---- ncurses-5.9/test/color_set.c 2008-02-10 01:18:01.000000000 +0100 -+++ ncurses-5.9.patch/test/color_set.c 2014-09-01 16:33:22.527792409 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 2003-2006,2008 Free Software Foundation, Inc. * -+ * Copyright (c) 2003-2012,2014 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -26,7 +26,7 @@ - * authorization. * - ****************************************************************************/ - /* -- * $Id: color_set.c,v 1.6 2008/02/10 00:18:01 tom Exp $ -+ * $Id: color_set.c,v 1.8 2014/02/01 22:10:42 tom Exp $ - */ - - #include <test.priv.h> -@@ -38,7 +38,7 @@ - int - main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) - { -- short f, b; -+ NCURSES_COLOR_T f, b; - int i; - - initscr(); -@@ -48,8 +48,8 @@ - if (has_colors()) { - start_color(); - -- pair_content(0, &f, &b); -- printw("pair 0 contains (%d,%d)\n", f, b); -+ (void) pair_content(0, &f, &b); -+ printw("pair 0 contains (%d,%d)\n", (int) f, (int) b); - getch(); - - printw("Initializing pair 1 to red/black\n"); -diff -Naur ncurses-5.9/test/configure ncurses-5.9.patch/test/configure ---- ncurses-5.9/test/configure 2011-03-24 09:29:40.000000000 +0100 -+++ ncurses-5.9.patch/test/configure 2014-09-01 16:33:22.534792419 +0200 -@@ -1,6 +1,6 @@ - #! /bin/sh - # Guess values for system-dependent variables and create Makefiles. --# Generated by Autoconf 2.52.20101002. -+# Generated by Autoconf 2.52.20121002. - # - # Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 - # Free Software Foundation, Inc. -@@ -105,42 +105,6 @@ - : ${ac_max_here_lines=38} - - ac_unique_file="ncurses.c" --# Factoring default headers for most tests. --ac_includes_default="\ --#include <stdio.h> --#if HAVE_SYS_TYPES_H --# include <sys/types.h> --#endif --#if HAVE_SYS_STAT_H --# include <sys/stat.h> --#endif --#if STDC_HEADERS --# include <stdlib.h> --# include <stddef.h> --#else --# if HAVE_STDLIB_H --# include <stdlib.h> --# endif --#endif --#if HAVE_STRING_H --# if !STDC_HEADERS && HAVE_MEMORY_H --# include <memory.h> --# endif --# include <string.h> --#endif --#if HAVE_STRINGS_H --# include <strings.h> --#endif --#if HAVE_INTTYPES_H --# include <inttypes.h> --#else --# if HAVE_STDINT_H --# include <stdint.h> --# endif --#endif --#if HAVE_UNISTD_H --# include <unistd.h> --#endif" - - # Initialize some variables set by options. - ac_init_help= -@@ -170,15 +134,16 @@ - bindir='${exec_prefix}/bin' - sbindir='${exec_prefix}/sbin' - libexecdir='${exec_prefix}/libexec' --datadir='${prefix}/share' -+datarootdir='${prefix}/share' -+datadir='${datarootdir}' - sysconfdir='${prefix}/etc' - sharedstatedir='${prefix}/com' - localstatedir='${prefix}/var' - libdir='${exec_prefix}/lib' - includedir='${prefix}/include' - oldincludedir='/usr/include' --infodir='${prefix}/info' --mandir='${prefix}/man' -+infodir='${datarootdir}/info' -+mandir='${datarootdir}/man' - - # Identity of this package. - PACKAGE_NAME= -@@ -229,6 +194,13 @@ - | --da=*) - datadir=$ac_optarg ;; - -+ -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ -+ | --dataroo | --dataro | --datar) -+ ac_prev=datarootdir ;; -+ -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ -+ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) -+ datarootdir=$ac_optarg ;; -+ - -disable-* | --disable-*) - ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` - # Reject names that are not valid shell variable names. -@@ -504,7 +476,7 @@ - done - - # Be sure to have absolute paths. --for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ -+for ac_var in bindir sbindir libexecdir datarootdir datadir sysconfdir sharedstatedir \ - localstatedir libdir includedir oldincludedir infodir mandir - do - eval ac_val=$`echo $ac_var` -@@ -641,15 +613,16 @@ - --bindir=DIR user executables [EPREFIX/bin] - --sbindir=DIR system admin executables [EPREFIX/sbin] - --libexecdir=DIR program executables [EPREFIX/libexec] -- --datadir=DIR read-only architecture-independent data [PREFIX/share] -+ --datarootdir=DIR read-only architecture-independent data [PREFIX/share] -+ --datadir=DIR read-only architecture-independent data [DATAROOTDIR] - --sysconfdir=DIR read-only single-machine data [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] - --localstatedir=DIR modifiable single-machine data [PREFIX/var] - --libdir=DIR object code libraries [EPREFIX/lib] - --includedir=DIR C header files [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc [/usr/include] -- --infodir=DIR info documentation [PREFIX/info] -- --mandir=DIR man documentation [PREFIX/man] -+ --infodir=DIR info documentation [DATAROOTDIR/info] -+ --mandir=DIR man documentation [DATAROOTDIR/man] - EOF - - cat <<\EOF -@@ -673,31 +646,37 @@ - - cat <<\EOF - --Optional Features: -- --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) -- --enable-FEATURE[=ARG] include FEATURE [ARG=yes] -- - Optional Packages: - --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] - --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - -- --disable-echo display "compiling" commands -- --enable-warnings test: turn on gcc compiler warnings -- --with-dmalloc test: use Gray Watson's dmalloc library -- --with-dbmalloc test: use Conor Cahill's dbmalloc library -- --with-valgrind test: use valgrind -- --disable-leaks test: free permanent memory, analyze leaks -+Optional Features: -+ --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) -+ --enable-FEATURE[=ARG] include FEATURE [ARG=yes] -+ -+General Options: -+ --with-pkg-config{=path} enable/disable use of pkg-config -+ --disable-echo do not display "compiling" commands -+Curses Version-dependent Options: -+ --with-ncurses-wrap-prefix naming-prefix for ncurses wrapped-variables -+ --disable-widec disable checks for wide-character functions - --with-curses-dir=DIR directory in which (n)curses is installed -- --with-5lib use SunOS sysv-libraries -- --with-ncursesw use wide ncurses-libraries (installed) -- --with-ncurses use ncurses-libraries (installed) -+ --with-ncursesw use wide ncurses-libraries -+ --with-ncurses use ncurses-libraries - --with-pdcurses compile/link with pdcurses X11 library -+ --with-curses-colr compile/link with HPUX 10.x color-curses -+ --with-curses-5lib compile/link with SunOS 5lib curses - --with-Xaw3d link with Xaw 3d library - --with-neXtaw link with neXT Athena library - --with-XawPlus link with Athena-Plus library -- --with-pkg-config{=path} enable/disable use of pkg-config - --with-x use the X Window System -- --with-ncurses-wrap-prefix naming-prefix for ncurses wrapped-variables -+Testing/development Options: -+ --enable-warnings test: turn on gcc compiler warnings -+ --with-dmalloc test: use Gray Watson's dmalloc library -+ --with-dbmalloc test: use Conor Cahill's dbmalloc library -+ --with-valgrind test: use valgrind -+ --disable-leaks test: free permanent memory, analyze leaks -+ --disable-rpath-hack don't add rpath options for additional libraries - - Some influential environment variables: - CC C compiler command -@@ -767,7 +746,7 @@ - running configure, to aid debugging if configure makes a mistake. - - It was created by $as_me, which was --generated by GNU Autoconf 2.52.20101002. Invocation command line was -+generated by GNU Autoconf 2.52.20121002. Invocation command line was - - $ $0 $@ - -@@ -891,7 +870,7 @@ - fi - for ac_site_file in $CONFIG_SITE; do - if test -r "$ac_site_file"; then -- { echo "$as_me:894: loading site script $ac_site_file" >&5 -+ { echo "$as_me:873: loading site script $ac_site_file" >&5 - echo "$as_me: loading site script $ac_site_file" >&6;} - cat "$ac_site_file" >&5 - . "$ac_site_file" -@@ -902,7 +881,7 @@ - # Some versions of bash will fail to source /dev/null (special - # files actually), so we avoid doing that. - if test -f "$cache_file"; then -- { echo "$as_me:905: loading cache $cache_file" >&5 -+ { echo "$as_me:884: loading cache $cache_file" >&5 - echo "$as_me: loading cache $cache_file" >&6;} - case $cache_file in - [\\/]* | ?:[\\/]* ) . $cache_file;; -@@ -910,7 +889,7 @@ - esac - fi - else -- { echo "$as_me:913: creating cache $cache_file" >&5 -+ { echo "$as_me:892: creating cache $cache_file" >&5 - echo "$as_me: creating cache $cache_file" >&6;} - >$cache_file - fi -@@ -926,21 +905,21 @@ - eval ac_new_val="\$ac_env_${ac_var}_value" - case $ac_old_set,$ac_new_set in - set,) -- { echo "$as_me:929: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 -+ { echo "$as_me:908: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 - echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,set) -- { echo "$as_me:933: error: \`$ac_var' was not set in the previous run" >&5 -+ { echo "$as_me:912: error: \`$ac_var' was not set in the previous run" >&5 - echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,);; - *) - if test "x$ac_old_val" != "x$ac_new_val"; then -- { echo "$as_me:939: error: \`$ac_var' has changed since the previous run:" >&5 -+ { echo "$as_me:918: error: \`$ac_var' has changed since the previous run:" >&5 - echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} -- { echo "$as_me:941: former value: $ac_old_val" >&5 -+ { echo "$as_me:920: former value: $ac_old_val" >&5 - echo "$as_me: former value: $ac_old_val" >&2;} -- { echo "$as_me:943: current value: $ac_new_val" >&5 -+ { echo "$as_me:922: current value: $ac_new_val" >&5 - echo "$as_me: current value: $ac_new_val" >&2;} - ac_cache_corrupted=: - fi;; -@@ -959,9 +938,9 @@ - fi - done - if $ac_cache_corrupted; then -- { echo "$as_me:962: error: changes in the environment can compromise the build" >&5 -+ { echo "$as_me:941: error: changes in the environment can compromise the build" >&5 - echo "$as_me: error: changes in the environment can compromise the build" >&2;} -- { { echo "$as_me:964: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 -+ { { echo "$as_me:943: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 - echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} - { (exit 1); exit 1; }; } - fi -@@ -982,10 +961,10 @@ - echo "#! $SHELL" >conftest.sh - echo "exit 0" >>conftest.sh - chmod +x conftest.sh --if { (echo "$as_me:985: PATH=\".;.\"; conftest.sh") >&5 -+if { (echo "$as_me:964: PATH=\".;.\"; conftest.sh") >&5 - (PATH=".;."; conftest.sh) 2>&5 - ac_status=$? -- echo "$as_me:988: \$? = $ac_status" >&5 -+ echo "$as_me:967: \$? = $ac_status" >&5 - (exit $ac_status); }; then - ac_path_separator=';' - else -@@ -1017,7 +996,7 @@ - fi - done - if test -z "$ac_aux_dir"; then -- { { echo "$as_me:1020: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 -+ { { echo "$as_me:999: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 - echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;} - { (exit 1); exit 1; }; } - fi -@@ -1027,11 +1006,11 @@ - - # Make sure we can run config.sub. - $ac_config_sub sun4 >/dev/null 2>&1 || -- { { echo "$as_me:1030: error: cannot run $ac_config_sub" >&5 -+ { { echo "$as_me:1009: error: cannot run $ac_config_sub" >&5 - echo "$as_me: error: cannot run $ac_config_sub" >&2;} - { (exit 1); exit 1; }; } - --echo "$as_me:1034: checking build system type" >&5 -+echo "$as_me:1013: checking build system type" >&5 - echo $ECHO_N "checking build system type... $ECHO_C" >&6 - if test "${ac_cv_build+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -1040,16 +1019,16 @@ - test -z "$ac_cv_build_alias" && - ac_cv_build_alias=`$ac_config_guess` - test -z "$ac_cv_build_alias" && -- { { echo "$as_me:1043: error: cannot guess build type; you must specify one" >&5 -+ { { echo "$as_me:1022: error: cannot guess build type; you must specify one" >&5 - echo "$as_me: error: cannot guess build type; you must specify one" >&2;} - { (exit 1); exit 1; }; } - ac_cv_build=`$ac_config_sub $ac_cv_build_alias` || -- { { echo "$as_me:1047: error: $ac_config_sub $ac_cv_build_alias failed." >&5 -+ { { echo "$as_me:1026: error: $ac_config_sub $ac_cv_build_alias failed." >&5 - echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed." >&2;} - { (exit 1); exit 1; }; } - - fi --echo "$as_me:1052: result: $ac_cv_build" >&5 -+echo "$as_me:1031: result: $ac_cv_build" >&5 - echo "${ECHO_T}$ac_cv_build" >&6 - build=$ac_cv_build - build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -@@ -1057,7 +1036,7 @@ - build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` - - if test -f $srcdir/config.guess || test -f $ac_aux_dir/config.guess ; then -- echo "$as_me:1060: checking host system type" >&5 -+ echo "$as_me:1039: checking host system type" >&5 - echo $ECHO_N "checking host system type... $ECHO_C" >&6 - if test "${ac_cv_host+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -1066,12 +1045,12 @@ - test -z "$ac_cv_host_alias" && - ac_cv_host_alias=$ac_cv_build_alias - ac_cv_host=`$ac_config_sub $ac_cv_host_alias` || -- { { echo "$as_me:1069: error: $ac_config_sub $ac_cv_host_alias failed" >&5 -+ { { echo "$as_me:1048: error: $ac_config_sub $ac_cv_host_alias failed" >&5 - echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;} - { (exit 1); exit 1; }; } - - fi --echo "$as_me:1074: result: $ac_cv_host" >&5 -+echo "$as_me:1053: result: $ac_cv_host" >&5 - echo "${ECHO_T}$ac_cv_host" >&6 - host=$ac_cv_host - host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -@@ -1085,7 +1064,8 @@ - system_name="`(hostname) 2>/dev/null`" - fi - fi --test -n "$system_name" && cat >>confdefs.h <<EOF -+test -n "$system_name" && -+cat >>confdefs.h <<EOF - #define SYSTEM_NAME "$system_name" - EOF - -@@ -1096,13 +1076,13 @@ - fi - - test -z "$system_name" && system_name="$cf_cv_system_name" --test -n "$cf_cv_system_name" && echo "$as_me:1099: result: Configuring for $cf_cv_system_name" >&5 -+test -n "$cf_cv_system_name" && echo "$as_me:1079: result: Configuring for $cf_cv_system_name" >&5 - echo "${ECHO_T}Configuring for $cf_cv_system_name" >&6 - - if test ".$system_name" != ".$cf_cv_system_name" ; then -- echo "$as_me:1103: result: Cached system name ($system_name) does not agree with actual ($cf_cv_system_name)" >&5 -+ echo "$as_me:1083: result: Cached system name ($system_name) does not agree with actual ($cf_cv_system_name)" >&5 - echo "${ECHO_T}Cached system name ($system_name) does not agree with actual ($cf_cv_system_name)" >&6 -- { { echo "$as_me:1105: error: \"Please remove config.cache and try again.\"" >&5 -+ { { echo "$as_me:1085: error: \"Please remove config.cache and try again.\"" >&5 - echo "$as_me: error: \"Please remove config.cache and try again.\"" >&2;} - { (exit 1); exit 1; }; } - fi -@@ -1120,7 +1100,7 @@ - program_transform_name=`echo $program_transform_name | sed -f conftest.sed` - rm conftest.sed - --echo "$as_me:1123: checking whether ${MAKE-make} sets \${MAKE}" >&5 -+echo "$as_me:1103: checking whether ${MAKE-make} sets \${MAKE}" >&5 - echo $ECHO_N "checking whether ${MAKE-make} sets \${MAKE}... $ECHO_C" >&6 - set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,./+-,__p_,'` - if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then -@@ -1140,11 +1120,11 @@ - rm -f conftest.make - fi - if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then -- echo "$as_me:1143: result: yes" >&5 -+ echo "$as_me:1123: result: yes" >&5 - echo "${ECHO_T}yes" >&6 - SET_MAKE= - else -- echo "$as_me:1147: result: no" >&5 -+ echo "$as_me:1127: result: no" >&5 - echo "${ECHO_T}no" >&6 - SET_MAKE="MAKE=${MAKE-make}" - fi -@@ -1158,7 +1138,7 @@ - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. - set dummy ${ac_tool_prefix}gcc; ac_word=$2 --echo "$as_me:1161: checking for $ac_word" >&5 -+echo "$as_me:1141: checking for $ac_word" >&5 - echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 - if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -1173,7 +1153,7 @@ - test -z "$ac_dir" && ac_dir=. - $as_executable_p "$ac_dir/$ac_word" || continue - ac_cv_prog_CC="${ac_tool_prefix}gcc" --echo "$as_me:1176: found $ac_dir/$ac_word" >&5 -+echo "$as_me:1156: found $ac_dir/$ac_word" >&5 - break - done - -@@ -1181,10 +1161,10 @@ - fi - CC=$ac_cv_prog_CC - if test -n "$CC"; then -- echo "$as_me:1184: result: $CC" >&5 -+ echo "$as_me:1164: result: $CC" >&5 - echo "${ECHO_T}$CC" >&6 - else -- echo "$as_me:1187: result: no" >&5 -+ echo "$as_me:1167: result: no" >&5 - echo "${ECHO_T}no" >&6 - fi - -@@ -1193,7 +1173,7 @@ - ac_ct_CC=$CC - # Extract the first word of "gcc", so it can be a program name with args. - set dummy gcc; ac_word=$2 --echo "$as_me:1196: checking for $ac_word" >&5 -+echo "$as_me:1176: checking for $ac_word" >&5 - echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 - if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -1208,7 +1188,7 @@ - test -z "$ac_dir" && ac_dir=. - $as_executable_p "$ac_dir/$ac_word" || continue - ac_cv_prog_ac_ct_CC="gcc" --echo "$as_me:1211: found $ac_dir/$ac_word" >&5 -+echo "$as_me:1191: found $ac_dir/$ac_word" >&5 - break - done - -@@ -1216,10 +1196,10 @@ - fi - ac_ct_CC=$ac_cv_prog_ac_ct_CC - if test -n "$ac_ct_CC"; then -- echo "$as_me:1219: result: $ac_ct_CC" >&5 -+ echo "$as_me:1199: result: $ac_ct_CC" >&5 - echo "${ECHO_T}$ac_ct_CC" >&6 - else -- echo "$as_me:1222: result: no" >&5 -+ echo "$as_me:1202: result: no" >&5 - echo "${ECHO_T}no" >&6 - fi - -@@ -1232,7 +1212,7 @@ - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. - set dummy ${ac_tool_prefix}cc; ac_word=$2 --echo "$as_me:1235: checking for $ac_word" >&5 -+echo "$as_me:1215: checking for $ac_word" >&5 - echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 - if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -1247,7 +1227,7 @@ - test -z "$ac_dir" && ac_dir=. - $as_executable_p "$ac_dir/$ac_word" || continue - ac_cv_prog_CC="${ac_tool_prefix}cc" --echo "$as_me:1250: found $ac_dir/$ac_word" >&5 -+echo "$as_me:1230: found $ac_dir/$ac_word" >&5 - break - done - -@@ -1255,10 +1235,10 @@ - fi - CC=$ac_cv_prog_CC - if test -n "$CC"; then -- echo "$as_me:1258: result: $CC" >&5 -+ echo "$as_me:1238: result: $CC" >&5 - echo "${ECHO_T}$CC" >&6 - else -- echo "$as_me:1261: result: no" >&5 -+ echo "$as_me:1241: result: no" >&5 - echo "${ECHO_T}no" >&6 - fi - -@@ -1267,7 +1247,7 @@ - ac_ct_CC=$CC - # Extract the first word of "cc", so it can be a program name with args. - set dummy cc; ac_word=$2 --echo "$as_me:1270: checking for $ac_word" >&5 -+echo "$as_me:1250: checking for $ac_word" >&5 - echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 - if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -1282,7 +1262,7 @@ - test -z "$ac_dir" && ac_dir=. - $as_executable_p "$ac_dir/$ac_word" || continue - ac_cv_prog_ac_ct_CC="cc" --echo "$as_me:1285: found $ac_dir/$ac_word" >&5 -+echo "$as_me:1265: found $ac_dir/$ac_word" >&5 - break - done - -@@ -1290,10 +1270,10 @@ - fi - ac_ct_CC=$ac_cv_prog_ac_ct_CC - if test -n "$ac_ct_CC"; then -- echo "$as_me:1293: result: $ac_ct_CC" >&5 -+ echo "$as_me:1273: result: $ac_ct_CC" >&5 - echo "${ECHO_T}$ac_ct_CC" >&6 - else -- echo "$as_me:1296: result: no" >&5 -+ echo "$as_me:1276: result: no" >&5 - echo "${ECHO_T}no" >&6 - fi - -@@ -1306,7 +1286,7 @@ - if test -z "$CC"; then - # Extract the first word of "cc", so it can be a program name with args. - set dummy cc; ac_word=$2 --echo "$as_me:1309: checking for $ac_word" >&5 -+echo "$as_me:1289: checking for $ac_word" >&5 - echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 - if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -1326,7 +1306,7 @@ - continue - fi - ac_cv_prog_CC="cc" --echo "$as_me:1329: found $ac_dir/$ac_word" >&5 -+echo "$as_me:1309: found $ac_dir/$ac_word" >&5 - break - done - -@@ -1348,10 +1328,10 @@ - fi - CC=$ac_cv_prog_CC - if test -n "$CC"; then -- echo "$as_me:1351: result: $CC" >&5 -+ echo "$as_me:1331: result: $CC" >&5 - echo "${ECHO_T}$CC" >&6 - else -- echo "$as_me:1354: result: no" >&5 -+ echo "$as_me:1334: result: no" >&5 - echo "${ECHO_T}no" >&6 - fi - -@@ -1362,7 +1342,7 @@ - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. - set dummy $ac_tool_prefix$ac_prog; ac_word=$2 --echo "$as_me:1365: checking for $ac_word" >&5 -+echo "$as_me:1345: checking for $ac_word" >&5 - echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 - if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -1377,7 +1357,7 @@ - test -z "$ac_dir" && ac_dir=. - $as_executable_p "$ac_dir/$ac_word" || continue - ac_cv_prog_CC="$ac_tool_prefix$ac_prog" --echo "$as_me:1380: found $ac_dir/$ac_word" >&5 -+echo "$as_me:1360: found $ac_dir/$ac_word" >&5 - break - done - -@@ -1385,10 +1365,10 @@ - fi - CC=$ac_cv_prog_CC - if test -n "$CC"; then -- echo "$as_me:1388: result: $CC" >&5 -+ echo "$as_me:1368: result: $CC" >&5 - echo "${ECHO_T}$CC" >&6 - else -- echo "$as_me:1391: result: no" >&5 -+ echo "$as_me:1371: result: no" >&5 - echo "${ECHO_T}no" >&6 - fi - -@@ -1401,7 +1381,7 @@ - do - # Extract the first word of "$ac_prog", so it can be a program name with args. - set dummy $ac_prog; ac_word=$2 --echo "$as_me:1404: checking for $ac_word" >&5 -+echo "$as_me:1384: checking for $ac_word" >&5 - echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 - if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -1416,7 +1396,7 @@ - test -z "$ac_dir" && ac_dir=. - $as_executable_p "$ac_dir/$ac_word" || continue - ac_cv_prog_ac_ct_CC="$ac_prog" --echo "$as_me:1419: found $ac_dir/$ac_word" >&5 -+echo "$as_me:1399: found $ac_dir/$ac_word" >&5 - break - done - -@@ -1424,10 +1404,10 @@ - fi - ac_ct_CC=$ac_cv_prog_ac_ct_CC - if test -n "$ac_ct_CC"; then -- echo "$as_me:1427: result: $ac_ct_CC" >&5 -+ echo "$as_me:1407: result: $ac_ct_CC" >&5 - echo "${ECHO_T}$ac_ct_CC" >&6 - else -- echo "$as_me:1430: result: no" >&5 -+ echo "$as_me:1410: result: no" >&5 - echo "${ECHO_T}no" >&6 - fi - -@@ -1439,32 +1419,32 @@ - - fi - --test -z "$CC" && { { echo "$as_me:1442: error: no acceptable cc found in \$PATH" >&5 -+test -z "$CC" && { { echo "$as_me:1422: error: no acceptable cc found in \$PATH" >&5 - echo "$as_me: error: no acceptable cc found in \$PATH" >&2;} - { (exit 1); exit 1; }; } - - # Provide some information about the compiler. --echo "$as_me:1447:" \ -+echo "$as_me:1427:" \ - "checking for C compiler version" >&5 - ac_compiler=`set X $ac_compile; echo $2` --{ (eval echo "$as_me:1450: \"$ac_compiler --version </dev/null >&5\"") >&5 -+{ (eval echo "$as_me:1430: \"$ac_compiler --version </dev/null >&5\"") >&5 - (eval $ac_compiler --version </dev/null >&5) 2>&5 - ac_status=$? -- echo "$as_me:1453: \$? = $ac_status" >&5 -+ echo "$as_me:1433: \$? = $ac_status" >&5 - (exit $ac_status); } --{ (eval echo "$as_me:1455: \"$ac_compiler -v </dev/null >&5\"") >&5 -+{ (eval echo "$as_me:1435: \"$ac_compiler -v </dev/null >&5\"") >&5 - (eval $ac_compiler -v </dev/null >&5) 2>&5 - ac_status=$? -- echo "$as_me:1458: \$? = $ac_status" >&5 -+ echo "$as_me:1438: \$? = $ac_status" >&5 - (exit $ac_status); } --{ (eval echo "$as_me:1460: \"$ac_compiler -V </dev/null >&5\"") >&5 -+{ (eval echo "$as_me:1440: \"$ac_compiler -V </dev/null >&5\"") >&5 - (eval $ac_compiler -V </dev/null >&5) 2>&5 - ac_status=$? -- echo "$as_me:1463: \$? = $ac_status" >&5 -+ echo "$as_me:1443: \$? = $ac_status" >&5 - (exit $ac_status); } - - cat >conftest.$ac_ext <<_ACEOF --#line 1467 "configure" -+#line 1447 "configure" - #include "confdefs.h" - - int -@@ -1480,13 +1460,13 @@ - # Try to create an executable without -o first, disregard a.out. - # It will help us diagnose broken compilers, and finding out an intuition - # of exeext. --echo "$as_me:1483: checking for C compiler default output" >&5 -+echo "$as_me:1463: checking for C compiler default output" >&5 - echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6 - ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` --if { (eval echo "$as_me:1486: \"$ac_link_default\"") >&5 -+if { (eval echo "$as_me:1466: \"$ac_link_default\"") >&5 - (eval $ac_link_default) 2>&5 - ac_status=$? -- echo "$as_me:1489: \$? = $ac_status" >&5 -+ echo "$as_me:1469: \$? = $ac_status" >&5 - (exit $ac_status); }; then - # Find the output, starting from the most likely. This scheme is - # not robust to junk in `.', hence go to wildcards (a.*) only as a last -@@ -1509,34 +1489,34 @@ - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --{ { echo "$as_me:1512: error: C compiler cannot create executables" >&5 -+{ { echo "$as_me:1492: error: C compiler cannot create executables" >&5 - echo "$as_me: error: C compiler cannot create executables" >&2;} - { (exit 77); exit 77; }; } - fi - - ac_exeext=$ac_cv_exeext --echo "$as_me:1518: result: $ac_file" >&5 -+echo "$as_me:1498: result: $ac_file" >&5 - echo "${ECHO_T}$ac_file" >&6 - - # Check the compiler produces executables we can run. If not, either - # the compiler is broken, or we cross compile. --echo "$as_me:1523: checking whether the C compiler works" >&5 -+echo "$as_me:1503: checking whether the C compiler works" >&5 - echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 - # FIXME: These cross compiler hacks should be removed for Autoconf 3.0 - # If not cross compiling, check that we can run a simple program. - if test "$cross_compiling" != yes; then - if { ac_try='./$ac_file' -- { (eval echo "$as_me:1529: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:1509: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:1532: \$? = $ac_status" >&5 -+ echo "$as_me:1512: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cross_compiling=no - else - if test "$cross_compiling" = maybe; then - cross_compiling=yes - else -- { { echo "$as_me:1539: error: cannot run C compiled programs. -+ { { echo "$as_me:1519: error: cannot run C compiled programs. - If you meant to cross compile, use \`--host'." >&5 - echo "$as_me: error: cannot run C compiled programs. - If you meant to cross compile, use \`--host'." >&2;} -@@ -1544,24 +1524,24 @@ - fi - fi - fi --echo "$as_me:1547: result: yes" >&5 -+echo "$as_me:1527: result: yes" >&5 - echo "${ECHO_T}yes" >&6 - - rm -f a.out a.exe conftest$ac_cv_exeext - ac_clean_files=$ac_clean_files_save - # Check the compiler produces executables we can run. If not, either - # the compiler is broken, or we cross compile. --echo "$as_me:1554: checking whether we are cross compiling" >&5 -+echo "$as_me:1534: checking whether we are cross compiling" >&5 - echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 --echo "$as_me:1556: result: $cross_compiling" >&5 -+echo "$as_me:1536: result: $cross_compiling" >&5 - echo "${ECHO_T}$cross_compiling" >&6 - --echo "$as_me:1559: checking for executable suffix" >&5 -+echo "$as_me:1539: checking for executable suffix" >&5 - echo $ECHO_N "checking for executable suffix... $ECHO_C" >&6 --if { (eval echo "$as_me:1561: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:1541: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:1564: \$? = $ac_status" >&5 -+ echo "$as_me:1544: \$? = $ac_status" >&5 - (exit $ac_status); }; then - # If both `conftest.exe' and `conftest' are `present' (well, observable) - # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will -@@ -1577,25 +1557,25 @@ - esac - done - else -- { { echo "$as_me:1580: error: cannot compute EXEEXT: cannot compile and link" >&5 -+ { { echo "$as_me:1560: error: cannot compute EXEEXT: cannot compile and link" >&5 - echo "$as_me: error: cannot compute EXEEXT: cannot compile and link" >&2;} - { (exit 1); exit 1; }; } - fi - - rm -f conftest$ac_cv_exeext --echo "$as_me:1586: result: $ac_cv_exeext" >&5 -+echo "$as_me:1566: result: $ac_cv_exeext" >&5 - echo "${ECHO_T}$ac_cv_exeext" >&6 - - rm -f conftest.$ac_ext - EXEEXT=$ac_cv_exeext - ac_exeext=$EXEEXT --echo "$as_me:1592: checking for object suffix" >&5 -+echo "$as_me:1572: checking for object suffix" >&5 - echo $ECHO_N "checking for object suffix... $ECHO_C" >&6 - if test "${ac_cv_objext+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - cat >conftest.$ac_ext <<_ACEOF --#line 1598 "configure" -+#line 1578 "configure" - #include "confdefs.h" - - int -@@ -1607,10 +1587,10 @@ - } - _ACEOF - rm -f conftest.o conftest.obj --if { (eval echo "$as_me:1610: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:1590: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:1613: \$? = $ac_status" >&5 -+ echo "$as_me:1593: \$? = $ac_status" >&5 - (exit $ac_status); }; then - for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do - case $ac_file in -@@ -1622,24 +1602,24 @@ - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --{ { echo "$as_me:1625: error: cannot compute OBJEXT: cannot compile" >&5 -+{ { echo "$as_me:1605: error: cannot compute OBJEXT: cannot compile" >&5 - echo "$as_me: error: cannot compute OBJEXT: cannot compile" >&2;} - { (exit 1); exit 1; }; } - fi - - rm -f conftest.$ac_cv_objext conftest.$ac_ext - fi --echo "$as_me:1632: result: $ac_cv_objext" >&5 -+echo "$as_me:1612: result: $ac_cv_objext" >&5 - echo "${ECHO_T}$ac_cv_objext" >&6 - OBJEXT=$ac_cv_objext - ac_objext=$OBJEXT --echo "$as_me:1636: checking whether we are using the GNU C compiler" >&5 -+echo "$as_me:1616: checking whether we are using the GNU C compiler" >&5 - echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 - if test "${ac_cv_c_compiler_gnu+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - cat >conftest.$ac_ext <<_ACEOF --#line 1642 "configure" -+#line 1622 "configure" - #include "confdefs.h" - - int -@@ -1654,16 +1634,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:1657: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:1637: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:1660: \$? = $ac_status" >&5 -+ echo "$as_me:1640: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:1663: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:1643: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:1666: \$? = $ac_status" >&5 -+ echo "$as_me:1646: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_compiler_gnu=yes - else -@@ -1675,19 +1655,19 @@ - ac_cv_c_compiler_gnu=$ac_compiler_gnu - - fi --echo "$as_me:1678: result: $ac_cv_c_compiler_gnu" >&5 -+echo "$as_me:1658: result: $ac_cv_c_compiler_gnu" >&5 - echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 - GCC=`test $ac_compiler_gnu = yes && echo yes` - ac_test_CFLAGS=${CFLAGS+set} - ac_save_CFLAGS=$CFLAGS - CFLAGS="-g" --echo "$as_me:1684: checking whether $CC accepts -g" >&5 -+echo "$as_me:1664: checking whether $CC accepts -g" >&5 - echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 - if test "${ac_cv_prog_cc_g+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - cat >conftest.$ac_ext <<_ACEOF --#line 1690 "configure" -+#line 1670 "configure" - #include "confdefs.h" - - int -@@ -1699,16 +1679,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:1702: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:1682: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:1705: \$? = $ac_status" >&5 -+ echo "$as_me:1685: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:1708: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:1688: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:1711: \$? = $ac_status" >&5 -+ echo "$as_me:1691: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_prog_cc_g=yes - else -@@ -1718,7 +1698,7 @@ - fi - rm -f conftest.$ac_objext conftest.$ac_ext - fi --echo "$as_me:1721: result: $ac_cv_prog_cc_g" >&5 -+echo "$as_me:1701: result: $ac_cv_prog_cc_g" >&5 - echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 - if test "$ac_test_CFLAGS" = set; then - CFLAGS=$ac_save_CFLAGS -@@ -1745,16 +1725,16 @@ - #endif - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:1748: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:1728: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:1751: \$? = $ac_status" >&5 -+ echo "$as_me:1731: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:1754: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:1734: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:1757: \$? = $ac_status" >&5 -+ echo "$as_me:1737: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - for ac_declaration in \ - ''\ -@@ -1766,7 +1746,7 @@ - 'void exit (int);' - do - cat >conftest.$ac_ext <<_ACEOF --#line 1769 "configure" -+#line 1749 "configure" - #include "confdefs.h" - #include <stdlib.h> - $ac_declaration -@@ -1779,16 +1759,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:1782: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:1762: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:1785: \$? = $ac_status" >&5 -+ echo "$as_me:1765: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:1788: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:1768: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:1791: \$? = $ac_status" >&5 -+ echo "$as_me:1771: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : - else -@@ -1798,7 +1778,7 @@ - fi - rm -f conftest.$ac_objext conftest.$ac_ext - cat >conftest.$ac_ext <<_ACEOF --#line 1801 "configure" -+#line 1781 "configure" - #include "confdefs.h" - $ac_declaration - int -@@ -1810,16 +1790,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:1813: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:1793: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:1816: \$? = $ac_status" >&5 -+ echo "$as_me:1796: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:1819: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:1799: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:1822: \$? = $ac_status" >&5 -+ echo "$as_me:1802: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - break - else -@@ -1847,13 +1827,214 @@ - ac_compiler_gnu=$ac_cv_c_compiler_gnu - ac_main_return=return - -+GCC_VERSION=none -+if test "$GCC" = yes ; then -+ echo "$as_me:1832: checking version of $CC" >&5 -+echo $ECHO_N "checking version of $CC... $ECHO_C" >&6 -+ GCC_VERSION="`${CC} --version 2>/dev/null | sed -e '2,$d' -e 's/^.*(GCC[^)]*) //' -e 's/^.*(Debian[^)]*) //' -e 's/^[^0-9.]*//' -e 's/[^0-9.].*//'`" -+ test -z "$GCC_VERSION" && GCC_VERSION=unknown -+ echo "$as_me:1836: result: $GCC_VERSION" >&5 -+echo "${ECHO_T}$GCC_VERSION" >&6 -+fi -+ -+echo "$as_me:1840: checking for $CC option to accept ANSI C" >&5 -+echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 -+if test "${ac_cv_prog_cc_stdc+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ ac_cv_prog_cc_stdc=no -+ac_save_CC=$CC -+cat >conftest.$ac_ext <<_ACEOF -+#line 1848 "configure" -+#include "confdefs.h" -+#include <stdarg.h> -+#include <stdio.h> -+#include <sys/types.h> -+#include <sys/stat.h> -+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ -+struct buf { int x; }; -+FILE * (*rcsopen) (struct buf *, struct stat *, int); -+static char *e (p, i) -+ char **p; -+ int i; -+{ -+ return p[i]; -+} -+static char *f (char * (*g) (char **, int), char **p, ...) -+{ -+ char *s; -+ va_list v; -+ va_start (v,p); -+ s = g (p, va_arg (v,int)); -+ va_end (v); -+ return s; -+} -+int test (int i, double x); -+struct s1 {int (*f) (int a);}; -+struct s2 {int (*f) (double a);}; -+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); -+int argc; -+char **argv; -+int -+main () -+{ -+return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; -+ ; -+ return 0; -+} -+_ACEOF -+# Don't try gcc -ansi; that turns off useful extensions and -+# breaks some systems' header files. -+# AIX -qlanglvl=ansi -+# Ultrix and OSF/1 -std1 -+# HP-UX 10.20 and later -Ae -+# HP-UX older versions -Aa -D_HPUX_SOURCE -+# SVR4 -Xc -D__EXTENSIONS__ -+for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" -+do -+ CC="$ac_save_CC $ac_arg" -+ rm -f conftest.$ac_objext -+if { (eval echo "$as_me:1897: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>&5 -+ ac_status=$? -+ echo "$as_me:1900: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:1903: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:1906: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ ac_cv_prog_cc_stdc=$ac_arg -+break -+else -+ echo "$as_me: failed program was:" >&5 -+cat conftest.$ac_ext >&5 -+fi -+rm -f conftest.$ac_objext -+done -+rm -f conftest.$ac_ext conftest.$ac_objext -+CC=$ac_save_CC -+ -+fi -+ -+case "x$ac_cv_prog_cc_stdc" in -+ x|xno) -+ echo "$as_me:1923: result: none needed" >&5 -+echo "${ECHO_T}none needed" >&6 ;; -+ *) -+ echo "$as_me:1926: result: $ac_cv_prog_cc_stdc" >&5 -+echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 -+ CC="$CC $ac_cv_prog_cc_stdc" ;; -+esac -+ -+# This should have been defined by AC_PROG_CC -+: ${CC:=cc} -+ -+echo "$as_me:1934: checking \$CC variable" >&5 -+echo $ECHO_N "checking \$CC variable... $ECHO_C" >&6 -+case "$CC" in #(vi -+*[\ \ ]-[IUD]*) -+ echo "$as_me:1938: result: broken" >&5 -+echo "${ECHO_T}broken" >&6 -+ { echo "$as_me:1940: WARNING: your environment misuses the CC variable to hold CFLAGS/CPPFLAGS options" >&5 -+echo "$as_me: WARNING: your environment misuses the CC variable to hold CFLAGS/CPPFLAGS options" >&2;} -+ # humor him... -+ cf_flags=`echo "$CC" | sed -e 's/^[^ ]*[ ]//'` -+ CC=`echo "$CC" | sed -e 's/[ ].*//'` -+ -+cf_fix_cppflags=no -+cf_new_cflags= -+cf_new_cppflags= -+cf_new_extra_cppflags= -+ -+for cf_add_cflags in $cf_flags -+do -+case $cf_fix_cppflags in -+no) -+ case $cf_add_cflags in #(vi -+ -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi -+ case $cf_add_cflags in -+ -D*) -+ cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` -+ -+ test "${cf_add_cflags}" != "${cf_tst_cflags}" \ -+ && test -z "${cf_tst_cflags}" \ -+ && cf_fix_cppflags=yes -+ -+ if test $cf_fix_cppflags = yes ; then -+ cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -+ continue -+ elif test "${cf_tst_cflags}" = "\"'" ; then -+ cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -+ continue -+ fi -+ ;; -+ esac -+ case "$CPPFLAGS" in -+ *$cf_add_cflags) #(vi -+ ;; -+ *) #(vi -+ case $cf_add_cflags in #(vi -+ -D*) -+ cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` -+ -+CPPFLAGS=`echo "$CPPFLAGS" | \ -+ sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ -+ -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` -+ -+ ;; -+ esac -+ cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" -+ ;; -+ esac -+ ;; -+ *) -+ cf_new_cflags="$cf_new_cflags $cf_add_cflags" -+ ;; -+ esac -+ ;; -+yes) -+ cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -+ -+ cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` -+ -+ test "${cf_add_cflags}" != "${cf_tst_cflags}" \ -+ && test -z "${cf_tst_cflags}" \ -+ && cf_fix_cppflags=no -+ ;; -+esac -+done -+ -+if test -n "$cf_new_cflags" ; then -+ -+ CFLAGS="$CFLAGS $cf_new_cflags" -+fi -+ -+if test -n "$cf_new_cppflags" ; then -+ -+ CPPFLAGS="$CPPFLAGS $cf_new_cppflags" -+fi -+ -+if test -n "$cf_new_extra_cppflags" ; then -+ -+ EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" -+fi -+ -+ ;; -+*) -+ echo "$as_me:2026: result: ok" >&5 -+echo "${ECHO_T}ok" >&6 -+ ;; -+esac -+ - ac_ext=c - ac_cpp='$CPP $CPPFLAGS' - ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' - ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' - ac_compiler_gnu=$ac_cv_c_compiler_gnu - ac_main_return=return --echo "$as_me:1856: checking how to run the C preprocessor" >&5 -+echo "$as_me:2037: checking how to run the C preprocessor" >&5 - echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 - # On Suns, sometimes $CPP names a directory. - if test -n "$CPP" && test -d "$CPP"; then -@@ -1874,18 +2055,18 @@ - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat >conftest.$ac_ext <<_ACEOF --#line 1877 "configure" -+#line 2058 "configure" - #include "confdefs.h" - #include <assert.h> - Syntax error - _ACEOF --if { (eval echo "$as_me:1882: \"$ac_cpp conftest.$ac_ext\"") >&5 -+if { (eval echo "$as_me:2063: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 -- echo "$as_me:1888: \$? = $ac_status" >&5 -+ echo "$as_me:2069: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag -@@ -1908,17 +2089,17 @@ - # OK, works on sane cases. Now check whether non-existent headers - # can be detected and how. - cat >conftest.$ac_ext <<_ACEOF --#line 1911 "configure" -+#line 2092 "configure" - #include "confdefs.h" - #include <ac_nonexistent.h> - _ACEOF --if { (eval echo "$as_me:1915: \"$ac_cpp conftest.$ac_ext\"") >&5 -+if { (eval echo "$as_me:2096: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 -- echo "$as_me:1921: \$? = $ac_status" >&5 -+ echo "$as_me:2102: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag -@@ -1955,7 +2136,7 @@ - else - ac_cv_prog_CPP=$CPP - fi --echo "$as_me:1958: result: $CPP" >&5 -+echo "$as_me:2139: result: $CPP" >&5 - echo "${ECHO_T}$CPP" >&6 - ac_preproc_ok=false - for ac_c_preproc_warn_flag in '' yes -@@ -1965,18 +2146,18 @@ - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat >conftest.$ac_ext <<_ACEOF --#line 1968 "configure" -+#line 2149 "configure" - #include "confdefs.h" - #include <assert.h> - Syntax error - _ACEOF --if { (eval echo "$as_me:1973: \"$ac_cpp conftest.$ac_ext\"") >&5 -+if { (eval echo "$as_me:2154: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 -- echo "$as_me:1979: \$? = $ac_status" >&5 -+ echo "$as_me:2160: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag -@@ -1999,17 +2180,17 @@ - # OK, works on sane cases. Now check whether non-existent headers - # can be detected and how. - cat >conftest.$ac_ext <<_ACEOF --#line 2002 "configure" -+#line 2183 "configure" - #include "confdefs.h" - #include <ac_nonexistent.h> - _ACEOF --if { (eval echo "$as_me:2006: \"$ac_cpp conftest.$ac_ext\"") >&5 -+if { (eval echo "$as_me:2187: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 -- echo "$as_me:2012: \$? = $ac_status" >&5 -+ echo "$as_me:2193: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag -@@ -2037,7 +2218,7 @@ - if $ac_preproc_ok; then - : - else -- { { echo "$as_me:2040: error: C preprocessor \"$CPP\" fails sanity check" >&5 -+ { { echo "$as_me:2221: error: C preprocessor \"$CPP\" fails sanity check" >&5 - echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check" >&2;} - { (exit 1); exit 1; }; } - fi -@@ -2053,7 +2234,7 @@ - do - # Extract the first word of "$ac_prog", so it can be a program name with args. - set dummy $ac_prog; ac_word=$2 --echo "$as_me:2056: checking for $ac_word" >&5 -+echo "$as_me:2237: checking for $ac_word" >&5 - echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 - if test "${ac_cv_prog_AWK+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -2068,7 +2249,7 @@ - test -z "$ac_dir" && ac_dir=. - $as_executable_p "$ac_dir/$ac_word" || continue - ac_cv_prog_AWK="$ac_prog" --echo "$as_me:2071: found $ac_dir/$ac_word" >&5 -+echo "$as_me:2252: found $ac_dir/$ac_word" >&5 - break - done - -@@ -2076,10 +2257,10 @@ - fi - AWK=$ac_cv_prog_AWK - if test -n "$AWK"; then -- echo "$as_me:2079: result: $AWK" >&5 -+ echo "$as_me:2260: result: $AWK" >&5 - echo "${ECHO_T}$AWK" >&6 - else -- echo "$as_me:2082: result: no" >&5 -+ echo "$as_me:2263: result: no" >&5 - echo "${ECHO_T}no" >&6 - fi - -@@ -2098,7 +2279,7 @@ - # AFS /usr/afsws/bin/install, which mishandles nonexistent args - # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" - # ./install, which can be erroneously created by make from ./install.sh. --echo "$as_me:2101: checking for a BSD compatible install" >&5 -+echo "$as_me:2282: checking for a BSD compatible install" >&5 - echo $ECHO_N "checking for a BSD compatible install... $ECHO_C" >&6 - if test -z "$INSTALL"; then - if test "${ac_cv_path_install+set}" = set; then -@@ -2147,7 +2328,7 @@ - INSTALL=$ac_install_sh - fi - fi --echo "$as_me:2150: result: $INSTALL" >&5 -+echo "$as_me:2331: result: $INSTALL" >&5 - echo "${ECHO_T}$INSTALL" >&6 - - # Use test -z because SunOS4 sh mishandles braces in ${var-val}. -@@ -2172,7 +2353,7 @@ - do - # Extract the first word of "$ac_prog", so it can be a program name with args. - set dummy $ac_prog; ac_word=$2 --echo "$as_me:2175: checking for $ac_word" >&5 -+echo "$as_me:2356: checking for $ac_word" >&5 - echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 - if test "${ac_cv_prog_LINT+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -2187,7 +2368,7 @@ - test -z "$ac_dir" && ac_dir=. - $as_executable_p "$ac_dir/$ac_word" || continue - ac_cv_prog_LINT="$ac_prog" --echo "$as_me:2190: found $ac_dir/$ac_word" >&5 -+echo "$as_me:2371: found $ac_dir/$ac_word" >&5 - break - done - -@@ -2195,17 +2376,17 @@ - fi - LINT=$ac_cv_prog_LINT - if test -n "$LINT"; then -- echo "$as_me:2198: result: $LINT" >&5 -+ echo "$as_me:2379: result: $LINT" >&5 - echo "${ECHO_T}$LINT" >&6 - else -- echo "$as_me:2201: result: no" >&5 -+ echo "$as_me:2382: result: no" >&5 - echo "${ECHO_T}no" >&6 - fi - - test -n "$LINT" && break - done - --echo "$as_me:2208: checking if filesystem supports mixed-case filenames" >&5 -+echo "$as_me:2389: checking if filesystem supports mixed-case filenames" >&5 - echo $ECHO_N "checking if filesystem supports mixed-case filenames... $ECHO_C" >&6 - if test "${cf_cv_mixedcase+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -2213,7 +2394,7 @@ - - if test "$cross_compiling" = yes ; then - case $target_alias in #(vi -- *-os2-emx*|*-msdosdjgpp*|*-cygwin*|*-mingw32*|*-uwin*) #(vi -+ *-os2-emx*|*-msdosdjgpp*|*-cygwin*|*-msys*|*-mingw*|*-uwin*) #(vi - cf_cv_mixedcase=no - ;; - *) -@@ -2232,9 +2413,10 @@ - fi - - fi --echo "$as_me:2235: result: $cf_cv_mixedcase" >&5 -+echo "$as_me:2416: result: $cf_cv_mixedcase" >&5 - echo "${ECHO_T}$cf_cv_mixedcase" >&6 --test "$cf_cv_mixedcase" = yes && cat >>confdefs.h <<\EOF -+test "$cf_cv_mixedcase" = yes && -+cat >>confdefs.h <<\EOF - #define MIXEDCASE_FILENAMES 1 - EOF - -@@ -2242,7 +2424,7 @@ - do - # Extract the first word of "$ac_prog", so it can be a program name with args. - set dummy $ac_prog; ac_word=$2 --echo "$as_me:2245: checking for $ac_word" >&5 -+echo "$as_me:2427: checking for $ac_word" >&5 - echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 - if test "${ac_cv_prog_CTAGS+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -2257,7 +2439,7 @@ - test -z "$ac_dir" && ac_dir=. - $as_executable_p "$ac_dir/$ac_word" || continue - ac_cv_prog_CTAGS="$ac_prog" --echo "$as_me:2260: found $ac_dir/$ac_word" >&5 -+echo "$as_me:2442: found $ac_dir/$ac_word" >&5 - break - done - -@@ -2265,10 +2447,10 @@ - fi - CTAGS=$ac_cv_prog_CTAGS - if test -n "$CTAGS"; then -- echo "$as_me:2268: result: $CTAGS" >&5 -+ echo "$as_me:2450: result: $CTAGS" >&5 - echo "${ECHO_T}$CTAGS" >&6 - else -- echo "$as_me:2271: result: no" >&5 -+ echo "$as_me:2453: result: no" >&5 - echo "${ECHO_T}no" >&6 - fi - -@@ -2279,7 +2461,7 @@ - do - # Extract the first word of "$ac_prog", so it can be a program name with args. - set dummy $ac_prog; ac_word=$2 --echo "$as_me:2282: checking for $ac_word" >&5 -+echo "$as_me:2464: checking for $ac_word" >&5 - echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 - if test "${ac_cv_prog_ETAGS+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -2294,7 +2476,7 @@ - test -z "$ac_dir" && ac_dir=. - $as_executable_p "$ac_dir/$ac_word" || continue - ac_cv_prog_ETAGS="$ac_prog" --echo "$as_me:2297: found $ac_dir/$ac_word" >&5 -+echo "$as_me:2479: found $ac_dir/$ac_word" >&5 - break - done - -@@ -2302,10 +2484,10 @@ - fi - ETAGS=$ac_cv_prog_ETAGS - if test -n "$ETAGS"; then -- echo "$as_me:2305: result: $ETAGS" >&5 -+ echo "$as_me:2487: result: $ETAGS" >&5 - echo "${ECHO_T}$ETAGS" >&6 - else -- echo "$as_me:2308: result: no" >&5 -+ echo "$as_me:2490: result: no" >&5 - echo "${ECHO_T}no" >&6 - fi - -@@ -2314,7 +2496,7 @@ - - # Extract the first word of "${CTAGS:-ctags}", so it can be a program name with args. - set dummy ${CTAGS:-ctags}; ac_word=$2 --echo "$as_me:2317: checking for $ac_word" >&5 -+echo "$as_me:2499: checking for $ac_word" >&5 - echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 - if test "${ac_cv_prog_MAKE_LOWER_TAGS+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -2329,7 +2511,7 @@ - test -z "$ac_dir" && ac_dir=. - $as_executable_p "$ac_dir/$ac_word" || continue - ac_cv_prog_MAKE_LOWER_TAGS="yes" --echo "$as_me:2332: found $ac_dir/$ac_word" >&5 -+echo "$as_me:2514: found $ac_dir/$ac_word" >&5 - break - done - -@@ -2338,17 +2520,17 @@ - fi - MAKE_LOWER_TAGS=$ac_cv_prog_MAKE_LOWER_TAGS - if test -n "$MAKE_LOWER_TAGS"; then -- echo "$as_me:2341: result: $MAKE_LOWER_TAGS" >&5 -+ echo "$as_me:2523: result: $MAKE_LOWER_TAGS" >&5 - echo "${ECHO_T}$MAKE_LOWER_TAGS" >&6 - else -- echo "$as_me:2344: result: no" >&5 -+ echo "$as_me:2526: result: no" >&5 - echo "${ECHO_T}no" >&6 - fi - - if test "$cf_cv_mixedcase" = yes ; then - # Extract the first word of "${ETAGS:-etags}", so it can be a program name with args. - set dummy ${ETAGS:-etags}; ac_word=$2 --echo "$as_me:2351: checking for $ac_word" >&5 -+echo "$as_me:2533: checking for $ac_word" >&5 - echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 - if test "${ac_cv_prog_MAKE_UPPER_TAGS+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -2363,7 +2545,7 @@ - test -z "$ac_dir" && ac_dir=. - $as_executable_p "$ac_dir/$ac_word" || continue - ac_cv_prog_MAKE_UPPER_TAGS="yes" --echo "$as_me:2366: found $ac_dir/$ac_word" >&5 -+echo "$as_me:2548: found $ac_dir/$ac_word" >&5 - break - done - -@@ -2372,10 +2554,10 @@ - fi - MAKE_UPPER_TAGS=$ac_cv_prog_MAKE_UPPER_TAGS - if test -n "$MAKE_UPPER_TAGS"; then -- echo "$as_me:2375: result: $MAKE_UPPER_TAGS" >&5 -+ echo "$as_me:2557: result: $MAKE_UPPER_TAGS" >&5 - echo "${ECHO_T}$MAKE_UPPER_TAGS" >&6 - else -- echo "$as_me:2378: result: no" >&5 -+ echo "$as_me:2560: result: no" >&5 - echo "${ECHO_T}no" >&6 - fi - -@@ -2395,14 +2577,14 @@ - MAKE_LOWER_TAGS="#" - fi - --echo "$as_me:2398: checking if -lm needed for math functions" >&5 -+echo "$as_me:2580: checking if -lm needed for math functions" >&5 - echo $ECHO_N "checking if -lm needed for math functions... $ECHO_C" >&6 - if test "${cf_cv_need_libm+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - - cat >conftest.$ac_ext <<_ACEOF --#line 2405 "configure" -+#line 2587 "configure" - #include "confdefs.h" - - #include <stdio.h> -@@ -2411,22 +2593,22 @@ - int - main () - { --double x = rand(); printf("result = %g\n", sin(x)) -+double x = rand(); printf("result = %g\n", pow(sin(x),x)) - ; - return 0; - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:2420: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:2602: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:2423: \$? = $ac_status" >&5 -+ echo "$as_me:2605: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:2426: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:2608: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:2429: \$? = $ac_status" >&5 -+ echo "$as_me:2611: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_cv_need_libm=no - else -@@ -2436,13 +2618,15 @@ - fi - rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - fi --echo "$as_me:2439: result: $cf_cv_need_libm" >&5 -+echo "$as_me:2621: result: $cf_cv_need_libm" >&5 - echo "${ECHO_T}$cf_cv_need_libm" >&6 - if test "$cf_cv_need_libm" = yes - then - MATH_LIB=-lm - fi - -+top_builddir=`pwd` -+ - CC_G_OPT="-g" - CC_SHARED_OPTS=unknown - CPPFLAGS="$CPPFLAGS" -@@ -2464,427 +2648,305 @@ - TEST_ARGS="" - TEST_DEPS="" - TEST_LIBS="" --TINFO_ARGS='$(LIBS_CURSES)' -+TINFO_LDFLAGS='' -+TINFO_LIBS='$(LIBS_CURSES)' - cf_cv_abi_version="" - cf_cv_rel_version="" -+includesubdir="" - - cf_cv_screen=curses - cf_cv_libtype= - --echo "$as_me:2474: checking for ${CC:-cc} option to accept ANSI C" >&5 --echo $ECHO_N "checking for ${CC:-cc} option to accept ANSI C... $ECHO_C" >&6 --if test "${cf_cv_ansi_cc+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 --else -+if test "$GCC" = yes -+then -+cat > conftest.i <<EOF -+#ifndef GCC_PRINTF -+#define GCC_PRINTF 0 -+#endif -+#ifndef GCC_SCANF -+#define GCC_SCANF 0 -+#endif -+#ifndef GCC_NORETURN -+#define GCC_NORETURN /* nothing */ -+#endif -+#ifndef GCC_UNUSED -+#define GCC_UNUSED /* nothing */ -+#endif -+EOF -+if test "$GCC" = yes -+then -+ { echo "$as_me:2678: checking for $CC __attribute__ directives..." >&5 -+echo "$as_me: checking for $CC __attribute__ directives..." >&6;} -+cat > conftest.$ac_ext <<EOF -+#line 2681 "${as_me:-configure}" -+#include "confdefs.h" -+#include "conftest.h" -+#include "conftest.i" -+#if GCC_PRINTF -+#define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var))) -+#else -+#define GCC_PRINTFLIKE(fmt,var) /*nothing*/ -+#endif -+#if GCC_SCANF -+#define GCC_SCANFLIKE(fmt,var) __attribute__((format(scanf,fmt,var))) -+#else -+#define GCC_SCANFLIKE(fmt,var) /*nothing*/ -+#endif -+extern void wow(char *,...) GCC_SCANFLIKE(1,2); -+extern void oops(char *,...) GCC_PRINTFLIKE(1,2) GCC_NORETURN; -+extern void foo(void) GCC_NORETURN; -+int main(int argc GCC_UNUSED, char *argv[] GCC_UNUSED) { return 0; } -+EOF -+ cf_printf_attribute=no -+ cf_scanf_attribute=no -+ for cf_attribute in scanf printf unused noreturn -+ do - --cf_cv_ansi_cc=no --cf_save_CFLAGS="$CFLAGS" --cf_save_CPPFLAGS="$CPPFLAGS" --# Don't try gcc -ansi; that turns off useful extensions and --# breaks some systems' header files. --# AIX -qlanglvl=ansi --# Ultrix and OSF/1 -std1 --# HP-UX -Aa -D_HPUX_SOURCE --# SVR4 -Xc --# UnixWare 1.2 (cannot use -Xc, since ANSI/POSIX clashes) --for cf_arg in "-DCC_HAS_PROTOS" \ -- "" \ -- -qlanglvl=ansi \ -- -std1 \ -- -Ae \ -- "-Aa -D_HPUX_SOURCE" \ -- -Xc --do -- --cf_fix_cppflags=no --cf_new_cflags= --cf_new_cppflags= --cf_new_extra_cppflags= -- --for cf_add_cflags in $cf_arg --do --case $cf_fix_cppflags in --no) -- case $cf_add_cflags in #(vi -- -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi -- case $cf_add_cflags in -- -D*) -- cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` -+cf_ATTRIBUTE=`echo "$cf_attribute" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` - -- test "${cf_add_cflags}" != "${cf_tst_cflags}" \ -- && test -z "${cf_tst_cflags}" \ -- && cf_fix_cppflags=yes -+ cf_directive="__attribute__(($cf_attribute))" -+ echo "checking for $CC $cf_directive" 1>&5 - -- if test $cf_fix_cppflags = yes ; then -- cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -- continue -- elif test "${cf_tst_cflags}" = "\"'" ; then -- cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -- continue -- fi -+ case $cf_attribute in #(vi -+ printf) #(vi -+ cf_printf_attribute=yes -+ cat >conftest.h <<EOF -+#define GCC_$cf_ATTRIBUTE 1 -+EOF - ;; -- esac -- case "$CPPFLAGS" in -- *$cf_add_cflags) #(vi -+ scanf) #(vi -+ cf_scanf_attribute=yes -+ cat >conftest.h <<EOF -+#define GCC_$cf_ATTRIBUTE 1 -+EOF - ;; - *) #(vi -- case $cf_add_cflags in #(vi -- -D*) -- cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` -+ cat >conftest.h <<EOF -+#define GCC_$cf_ATTRIBUTE $cf_directive -+EOF -+ ;; -+ esac - --CPPFLAGS=`echo "$CPPFLAGS" | \ -- sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ -- -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` -+ if { (eval echo "$as_me:2730: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>&5 -+ ac_status=$? -+ echo "$as_me:2733: \$? = $ac_status" >&5 -+ (exit $ac_status); }; then -+ test -n "$verbose" && echo "$as_me:2735: result: ... $cf_attribute" >&5 -+echo "${ECHO_T}... $cf_attribute" >&6 -+ cat conftest.h >>confdefs.h -+ case $cf_attribute in #(vi -+ noreturn) #(vi -+ -+cat >>confdefs.h <<EOF -+#define GCC_NORETURN $cf_directive -+EOF - - ;; -- esac -- cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" -- ;; -- esac -- ;; -- *) -- cf_new_cflags="$cf_new_cflags $cf_add_cflags" -- ;; -- esac -- ;; --yes) -- cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -+ printf) #(vi -+ cf_value='/* nothing */' -+ if test "$cf_printf_attribute" != no ; then -+ cf_value='__attribute__((format(printf,fmt,var)))' - -- cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` -+cat >>confdefs.h <<\EOF -+#define GCC_PRINTF 1 -+EOF - -- test "${cf_add_cflags}" != "${cf_tst_cflags}" \ -- && test -z "${cf_tst_cflags}" \ -- && cf_fix_cppflags=no -- ;; --esac --done -+ fi - --if test -n "$cf_new_cflags" ; then -+cat >>confdefs.h <<EOF -+#define GCC_PRINTFLIKE(fmt,var) $cf_value -+EOF - -- CFLAGS="$CFLAGS $cf_new_cflags" --fi -+ ;; -+ scanf) #(vi -+ cf_value='/* nothing */' -+ if test "$cf_scanf_attribute" != no ; then -+ cf_value='__attribute__((format(scanf,fmt,var)))' - --if test -n "$cf_new_cppflags" ; then -+cat >>confdefs.h <<\EOF -+#define GCC_SCANF 1 -+EOF - -- CPPFLAGS="$CPPFLAGS $cf_new_cppflags" --fi -+ fi - --if test -n "$cf_new_extra_cppflags" ; then -+cat >>confdefs.h <<EOF -+#define GCC_SCANFLIKE(fmt,var) $cf_value -+EOF - -- EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" -+ ;; -+ unused) #(vi -+ -+cat >>confdefs.h <<EOF -+#define GCC_UNUSED $cf_directive -+EOF -+ -+ ;; -+ esac -+ fi -+ done -+else -+ fgrep define conftest.i >>confdefs.h -+fi -+rm -rf conftest* - fi - -- cat >conftest.$ac_ext <<_ACEOF --#line 2578 "configure" -+cf_XOPEN_SOURCE=500 -+cf_POSIX_C_SOURCE=199506L -+cf_xopen_source= -+ -+case $host_os in #(vi -+aix[4-7]*) #(vi -+ cf_xopen_source="-D_ALL_SOURCE" -+ ;; -+cygwin|msys) #(vi -+ cf_XOPEN_SOURCE=600 -+ ;; -+darwin[0-8].*) #(vi -+ cf_xopen_source="-D_APPLE_C_SOURCE" -+ ;; -+darwin*) #(vi -+ cf_xopen_source="-D_DARWIN_C_SOURCE" -+ cf_XOPEN_SOURCE= -+ ;; -+freebsd*|dragonfly*) #(vi -+ # 5.x headers associate -+ # _XOPEN_SOURCE=600 with _POSIX_C_SOURCE=200112L -+ # _XOPEN_SOURCE=500 with _POSIX_C_SOURCE=199506L -+ cf_POSIX_C_SOURCE=200112L -+ cf_XOPEN_SOURCE=600 -+ cf_xopen_source="-D_BSD_TYPES -D__BSD_VISIBLE -D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" -+ ;; -+hpux11*) #(vi -+ cf_xopen_source="-D_HPUX_SOURCE -D_XOPEN_SOURCE=500" -+ ;; -+hpux*) #(vi -+ cf_xopen_source="-D_HPUX_SOURCE" -+ ;; -+irix[56].*) #(vi -+ cf_xopen_source="-D_SGI_SOURCE" -+ cf_XOPEN_SOURCE= -+ ;; -+linux*|gnu*|mint*|k*bsd*-gnu) #(vi -+ -+echo "$as_me:2832: checking if we must define _GNU_SOURCE" >&5 -+echo $ECHO_N "checking if we must define _GNU_SOURCE... $ECHO_C" >&6 -+if test "${cf_cv_gnu_source+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ -+cat >conftest.$ac_ext <<_ACEOF -+#line 2839 "configure" - #include "confdefs.h" -+#include <sys/types.h> -+int -+main () -+{ - --#ifndef CC_HAS_PROTOS --#if !defined(__STDC__) || (__STDC__ != 1) --choke me --#endif -+#ifndef _XOPEN_SOURCE -+make an error - #endif -- -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:2854: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>&5 -+ ac_status=$? -+ echo "$as_me:2857: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:2860: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:2863: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ cf_cv_gnu_source=no -+else -+ echo "$as_me: failed program was:" >&5 -+cat conftest.$ac_ext >&5 -+cf_save="$CPPFLAGS" -+ CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" -+ cat >conftest.$ac_ext <<_ACEOF -+#line 2872 "configure" -+#include "confdefs.h" -+#include <sys/types.h> - int - main () - { - -- int test (int i, double x); -- struct s1 {int (*f) (int a);}; -- struct s2 {int (*f) (double a);}; -+#ifdef _XOPEN_SOURCE -+make an error -+#endif - ; - return 0; - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:2599: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:2887: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:2602: \$? = $ac_status" >&5 -+ echo "$as_me:2890: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:2605: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:2893: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:2608: \$? = $ac_status" >&5 -+ echo "$as_me:2896: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- cf_cv_ansi_cc="$cf_arg"; break -+ cf_cv_gnu_source=no - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 -+cf_cv_gnu_source=yes - fi - rm -f conftest.$ac_objext conftest.$ac_ext --done --CFLAGS="$cf_save_CFLAGS" --CPPFLAGS="$cf_save_CPPFLAGS" -+ CPPFLAGS="$cf_save" - - fi --echo "$as_me:2621: result: $cf_cv_ansi_cc" >&5 --echo "${ECHO_T}$cf_cv_ansi_cc" >&6 -+rm -f conftest.$ac_objext conftest.$ac_ext - --if test "$cf_cv_ansi_cc" != "no"; then --if test ".$cf_cv_ansi_cc" != ".-DCC_HAS_PROTOS"; then -+fi -+echo "$as_me:2911: result: $cf_cv_gnu_source" >&5 -+echo "${ECHO_T}$cf_cv_gnu_source" >&6 -+test "$cf_cv_gnu_source" = yes && CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" - --cf_fix_cppflags=no --cf_new_cflags= --cf_new_cppflags= --cf_new_extra_cppflags= -+ ;; -+mirbsd*) #(vi -+ # setting _XOPEN_SOURCE or _POSIX_SOURCE breaks <sys/select.h> and other headers which use u_int / u_short types -+ cf_XOPEN_SOURCE= - --for cf_add_cflags in $cf_cv_ansi_cc --do --case $cf_fix_cppflags in --no) -- case $cf_add_cflags in #(vi -- -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi -- case $cf_add_cflags in -- -D*) -- cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` -+cf_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE - -- test "${cf_add_cflags}" != "${cf_tst_cflags}" \ -- && test -z "${cf_tst_cflags}" \ -- && cf_fix_cppflags=yes -+cf_save_CFLAGS="$CFLAGS" -+cf_save_CPPFLAGS="$CPPFLAGS" - -- if test $cf_fix_cppflags = yes ; then -- cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -- continue -- elif test "${cf_tst_cflags}" = "\"'" ; then -- cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -- continue -- fi -- ;; -- esac -- case "$CPPFLAGS" in -- *$cf_add_cflags) #(vi -- ;; -- *) #(vi -- case $cf_add_cflags in #(vi -- -D*) -- cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` -+cf_trim_CFLAGS=`echo "$cf_save_CFLAGS" | \ -+ sed -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \ -+ -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?$//g'` - --CPPFLAGS=`echo "$CPPFLAGS" | \ -- sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ -- -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` -+cf_trim_CPPFLAGS=`echo "$cf_save_CPPFLAGS" | \ -+ sed -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \ -+ -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?$//g'` - -- ;; -- esac -- cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" -- ;; -- esac -- ;; -- *) -- cf_new_cflags="$cf_new_cflags $cf_add_cflags" -- ;; -- esac -- ;; --yes) -- cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -- -- cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` -- -- test "${cf_add_cflags}" != "${cf_tst_cflags}" \ -- && test -z "${cf_tst_cflags}" \ -- && cf_fix_cppflags=no -- ;; --esac --done -- --if test -n "$cf_new_cflags" ; then -- -- CFLAGS="$CFLAGS $cf_new_cflags" --fi -- --if test -n "$cf_new_cppflags" ; then -- -- CPPFLAGS="$CPPFLAGS $cf_new_cppflags" --fi -- --if test -n "$cf_new_extra_cppflags" ; then -- -- EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" --fi -- --else -- cat >>confdefs.h <<\EOF --#define CC_HAS_PROTOS 1 --EOF -- --fi --fi -- --if test "$cf_cv_ansi_cc" = "no"; then -- { { echo "$as_me:2714: error: Your compiler does not appear to recognize prototypes. --You have the following choices: -- a. adjust your compiler options -- b. get an up-to-date compiler -- c. use a wrapper such as unproto" >&5 --echo "$as_me: error: Your compiler does not appear to recognize prototypes. --You have the following choices: -- a. adjust your compiler options -- b. get an up-to-date compiler -- c. use a wrapper such as unproto" >&2;} -- { (exit 1); exit 1; }; } --fi -- --if test "$GCC" = yes --then --cat > conftest.i <<EOF --#ifndef GCC_PRINTF --#define GCC_PRINTF 0 --#endif --#ifndef GCC_SCANF --#define GCC_SCANF 0 --#endif --#ifndef GCC_NORETURN --#define GCC_NORETURN /* nothing */ --#endif --#ifndef GCC_UNUSED --#define GCC_UNUSED /* nothing */ --#endif --EOF --if test "$GCC" = yes --then -- { echo "$as_me:2745: checking for $CC __attribute__ directives..." >&5 --echo "$as_me: checking for $CC __attribute__ directives..." >&6;} --cat > conftest.$ac_ext <<EOF --#line 2748 "${as_me:-configure}" --#include "confdefs.h" --#include "conftest.h" --#include "conftest.i" --#if GCC_PRINTF --#define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var))) --#else --#define GCC_PRINTFLIKE(fmt,var) /*nothing*/ --#endif --#if GCC_SCANF --#define GCC_SCANFLIKE(fmt,var) __attribute__((format(scanf,fmt,var))) --#else --#define GCC_SCANFLIKE(fmt,var) /*nothing*/ --#endif --extern void wow(char *,...) GCC_SCANFLIKE(1,2); --extern void oops(char *,...) GCC_PRINTFLIKE(1,2) GCC_NORETURN; --extern void foo(void) GCC_NORETURN; --int main(int argc GCC_UNUSED, char *argv[] GCC_UNUSED) { return 0; } --EOF -- cf_printf_attribute=no -- cf_scanf_attribute=no -- for cf_attribute in scanf printf unused noreturn -- do -- --cf_ATTRIBUTE=`echo "$cf_attribute" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` -- -- cf_directive="__attribute__(($cf_attribute))" -- echo "checking for $CC $cf_directive" 1>&5 -- -- case $cf_attribute in #(vi -- printf) #(vi -- cf_printf_attribute=yes -- cat >conftest.h <<EOF --#define GCC_$cf_ATTRIBUTE 1 --EOF -- ;; -- scanf) #(vi -- cf_scanf_attribute=yes -- cat >conftest.h <<EOF --#define GCC_$cf_ATTRIBUTE 1 --EOF -- ;; -- *) #(vi -- cat >conftest.h <<EOF --#define GCC_$cf_ATTRIBUTE $cf_directive --EOF -- ;; -- esac -- -- if { (eval echo "$as_me:2797: \"$ac_compile\"") >&5 -- (eval $ac_compile) 2>&5 -- ac_status=$? -- echo "$as_me:2800: \$? = $ac_status" >&5 -- (exit $ac_status); }; then -- test -n "$verbose" && echo "$as_me:2802: result: ... $cf_attribute" >&5 --echo "${ECHO_T}... $cf_attribute" >&6 -- cat conftest.h >>confdefs.h -- case $cf_attribute in #(vi -- printf) #(vi -- if test "$cf_printf_attribute" = no ; then -- cat >>confdefs.h <<EOF --#define GCC_PRINTFLIKE(fmt,var) /* nothing */ --EOF -- else -- cat >>confdefs.h <<EOF --#define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var))) --EOF -- fi -- ;; -- scanf) #(vi -- if test "$cf_scanf_attribute" = no ; then -- cat >>confdefs.h <<EOF --#define GCC_SCANFLIKE(fmt,var) /* nothing */ --EOF -- else -- cat >>confdefs.h <<EOF --#define GCC_SCANFLIKE(fmt,var) __attribute__((format(scanf,fmt,var))) --EOF -- fi -- ;; -- esac -- fi -- done --else -- fgrep define conftest.i >>confdefs.h --fi --rm -rf conftest* --fi -- --cf_XOPEN_SOURCE=500 --cf_POSIX_C_SOURCE=199506L --cf_xopen_source= -- --case $host_os in #(vi --aix[456]*) #(vi -- cf_xopen_source="-D_ALL_SOURCE" -- ;; --cygwin) #(vi -- cf_XOPEN_SOURCE=600 -- ;; --darwin[0-8].*) #(vi -- cf_xopen_source="-D_APPLE_C_SOURCE" -- ;; --darwin*) #(vi -- cf_xopen_source="-D_DARWIN_C_SOURCE" -- ;; --freebsd*|dragonfly*) #(vi -- # 5.x headers associate -- # _XOPEN_SOURCE=600 with _POSIX_C_SOURCE=200112L -- # _XOPEN_SOURCE=500 with _POSIX_C_SOURCE=199506L -- cf_POSIX_C_SOURCE=200112L -- cf_XOPEN_SOURCE=600 -- cf_xopen_source="-D_BSD_TYPES -D__BSD_VISIBLE -D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" -- ;; --hpux11*) #(vi -- cf_xopen_source="-D_HPUX_SOURCE -D_XOPEN_SOURCE=500" -- ;; --hpux*) #(vi -- cf_xopen_source="-D_HPUX_SOURCE" -- ;; --irix[56].*) #(vi -- cf_xopen_source="-D_SGI_SOURCE" -- ;; --linux*|gnu*|mint*|k*bsd*-gnu) #(vi -- --echo "$as_me:2873: checking if we must define _GNU_SOURCE" >&5 --echo $ECHO_N "checking if we must define _GNU_SOURCE... $ECHO_C" >&6 --if test "${cf_cv_gnu_source+set}" = set; then -+echo "$as_me:2933: checking if we should define _POSIX_C_SOURCE" >&5 -+echo $ECHO_N "checking if we should define _POSIX_C_SOURCE... $ECHO_C" >&6 -+if test "${cf_cv_posix_c_source+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - --cat >conftest.$ac_ext <<_ACEOF --#line 2880 "configure" -+echo "${as_me:-configure}:2939: testing if the symbol is already defined go no further ..." 1>&5 -+ -+ cat >conftest.$ac_ext <<_ACEOF -+#line 2942 "configure" - #include "confdefs.h" - #include <sys/types.h> - int - main () - { - --#ifndef _XOPEN_SOURCE -+#ifndef _POSIX_C_SOURCE - make an error - #endif - ; -@@ -2892,32 +2954,44 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:2895: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:2957: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:2898: \$? = $ac_status" >&5 -+ echo "$as_me:2960: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:2901: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:2963: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:2904: \$? = $ac_status" >&5 -+ echo "$as_me:2966: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- cf_cv_gnu_source=no -+ cf_cv_posix_c_source=no - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --cf_save="$CPPFLAGS" -- CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" -- cat >conftest.$ac_ext <<_ACEOF --#line 2913 "configure" -+cf_want_posix_source=no -+ case .$cf_POSIX_C_SOURCE in #(vi -+ .[12]??*) #(vi -+ cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" -+ ;; -+ .2) #(vi -+ cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" -+ cf_want_posix_source=yes -+ ;; -+ .*) -+ cf_want_posix_source=yes -+ ;; -+ esac -+ if test "$cf_want_posix_source" = yes ; then -+ cat >conftest.$ac_ext <<_ACEOF -+#line 2987 "configure" - #include "confdefs.h" - #include <sys/types.h> - int - main () - { - --#ifdef _XOPEN_SOURCE -+#ifdef _POSIX_SOURCE - make an error - #endif - ; -@@ -2925,75 +2999,42 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:2928: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:3002: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:2931: \$? = $ac_status" >&5 -+ echo "$as_me:3005: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:2934: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:3008: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:2937: \$? = $ac_status" >&5 -+ echo "$as_me:3011: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- cf_cv_gnu_source=no -+ : - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --cf_cv_gnu_source=yes -+cf_cv_posix_c_source="$cf_cv_posix_c_source -D_POSIX_SOURCE" - fi - rm -f conftest.$ac_objext conftest.$ac_ext -- CPPFLAGS="$cf_save" -+ fi - --fi --rm -f conftest.$ac_objext conftest.$ac_ext -+echo "${as_me:-configure}:3022: testing ifdef from value $cf_POSIX_C_SOURCE ..." 1>&5 - --fi --echo "$as_me:2952: result: $cf_cv_gnu_source" >&5 --echo "${ECHO_T}$cf_cv_gnu_source" >&6 --test "$cf_cv_gnu_source" = yes && CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" -+ CFLAGS="$cf_trim_CFLAGS" -+ CPPFLAGS="$cf_trim_CPPFLAGS $cf_cv_posix_c_source" - -- ;; --mirbsd*) #(vi -- # setting _XOPEN_SOURCE or _POSIX_SOURCE breaks <arpa/inet.h> -- ;; --netbsd*) #(vi -- # setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw -- ;; --openbsd*) #(vi -- # setting _XOPEN_SOURCE breaks xterm on OpenBSD 2.8, is not needed for ncursesw -- ;; --osf[45]*) #(vi -- cf_xopen_source="-D_OSF_SOURCE" -- ;; --nto-qnx*) #(vi -- cf_xopen_source="-D_QNX_SOURCE" -- ;; --sco*) #(vi -- # setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer -- ;; --solaris2.1[0-9]) #(vi -- cf_xopen_source="-D__EXTENSIONS__ -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" -- ;; --solaris2.[1-9]) #(vi -- cf_xopen_source="-D__EXTENSIONS__" -- ;; --*) -- echo "$as_me:2982: checking if we should define _XOPEN_SOURCE" >&5 --echo $ECHO_N "checking if we should define _XOPEN_SOURCE... $ECHO_C" >&6 --if test "${cf_cv_xopen_source+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 --else -+echo "${as_me:-configure}:3027: testing if the second compile does not leave our definition intact error ..." 1>&5 - -- cat >conftest.$ac_ext <<_ACEOF --#line 2989 "configure" -+ cat >conftest.$ac_ext <<_ACEOF -+#line 3030 "configure" - #include "confdefs.h" - #include <sys/types.h> - int - main () - { - --#ifndef _XOPEN_SOURCE -+#ifndef _POSIX_C_SOURCE - make an error - #endif - ; -@@ -3001,49 +3042,218 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:3004: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:3045: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:3007: \$? = $ac_status" >&5 -+ echo "$as_me:3048: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:3010: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:3051: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:3013: \$? = $ac_status" >&5 -+ echo "$as_me:3054: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- cf_cv_xopen_source=no -+ : - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --cf_save="$CPPFLAGS" -- CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" -- cat >conftest.$ac_ext <<_ACEOF --#line 3022 "configure" --#include "confdefs.h" --#include <sys/types.h> --int --main () --{ -- --#ifdef _XOPEN_SOURCE --make an error --#endif -+cf_cv_posix_c_source=no -+fi -+rm -f conftest.$ac_objext conftest.$ac_ext -+ CFLAGS="$cf_save_CFLAGS" -+ CPPFLAGS="$cf_save_CPPFLAGS" -+ -+fi -+rm -f conftest.$ac_objext conftest.$ac_ext -+ -+fi -+echo "$as_me:3070: result: $cf_cv_posix_c_source" >&5 -+echo "${ECHO_T}$cf_cv_posix_c_source" >&6 -+ -+if test "$cf_cv_posix_c_source" != no ; then -+ CFLAGS="$cf_trim_CFLAGS" -+ CPPFLAGS="$cf_trim_CPPFLAGS" -+ -+cf_fix_cppflags=no -+cf_new_cflags= -+cf_new_cppflags= -+cf_new_extra_cppflags= -+ -+for cf_add_cflags in $cf_cv_posix_c_source -+do -+case $cf_fix_cppflags in -+no) -+ case $cf_add_cflags in #(vi -+ -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi -+ case $cf_add_cflags in -+ -D*) -+ cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` -+ -+ test "${cf_add_cflags}" != "${cf_tst_cflags}" \ -+ && test -z "${cf_tst_cflags}" \ -+ && cf_fix_cppflags=yes -+ -+ if test $cf_fix_cppflags = yes ; then -+ cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -+ continue -+ elif test "${cf_tst_cflags}" = "\"'" ; then -+ cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -+ continue -+ fi -+ ;; -+ esac -+ case "$CPPFLAGS" in -+ *$cf_add_cflags) #(vi -+ ;; -+ *) #(vi -+ case $cf_add_cflags in #(vi -+ -D*) -+ cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` -+ -+CPPFLAGS=`echo "$CPPFLAGS" | \ -+ sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ -+ -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` -+ -+ ;; -+ esac -+ cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" -+ ;; -+ esac -+ ;; -+ *) -+ cf_new_cflags="$cf_new_cflags $cf_add_cflags" -+ ;; -+ esac -+ ;; -+yes) -+ cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -+ -+ cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` -+ -+ test "${cf_add_cflags}" != "${cf_tst_cflags}" \ -+ && test -z "${cf_tst_cflags}" \ -+ && cf_fix_cppflags=no -+ ;; -+esac -+done -+ -+if test -n "$cf_new_cflags" ; then -+ -+ CFLAGS="$CFLAGS $cf_new_cflags" -+fi -+ -+if test -n "$cf_new_cppflags" ; then -+ -+ CPPFLAGS="$CPPFLAGS $cf_new_cppflags" -+fi -+ -+if test -n "$cf_new_extra_cppflags" ; then -+ -+ EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" -+fi -+ -+fi -+ -+ ;; -+netbsd*) #(vi -+ cf_xopen_source="-D_NETBSD_SOURCE" # setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw -+ ;; -+openbsd[4-9]*) #(vi -+ # setting _XOPEN_SOURCE lower than 500 breaks g++ compile with wchar.h, needed for ncursesw -+ cf_xopen_source="-D_BSD_SOURCE" -+ cf_XOPEN_SOURCE=600 -+ ;; -+openbsd*) #(vi -+ # setting _XOPEN_SOURCE breaks xterm on OpenBSD 2.8, is not needed for ncursesw -+ ;; -+osf[45]*) #(vi -+ cf_xopen_source="-D_OSF_SOURCE" -+ ;; -+nto-qnx*) #(vi -+ cf_xopen_source="-D_QNX_SOURCE" -+ ;; -+sco*) #(vi -+ # setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer -+ ;; -+solaris2.*) #(vi -+ cf_xopen_source="-D__EXTENSIONS__" -+ cf_cv_xopen_source=broken -+ ;; -+*) -+ -+echo "$as_me:3184: checking if we should define _XOPEN_SOURCE" >&5 -+echo $ECHO_N "checking if we should define _XOPEN_SOURCE... $ECHO_C" >&6 -+if test "${cf_cv_xopen_source+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ -+ cat >conftest.$ac_ext <<_ACEOF -+#line 3191 "configure" -+#include "confdefs.h" -+ -+#include <stdlib.h> -+#include <string.h> -+#include <sys/types.h> -+ -+int -+main () -+{ -+ -+#ifndef _XOPEN_SOURCE -+make an error -+#endif -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:3210: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>&5 -+ ac_status=$? -+ echo "$as_me:3213: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:3216: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:3219: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ cf_cv_xopen_source=no -+else -+ echo "$as_me: failed program was:" >&5 -+cat conftest.$ac_ext >&5 -+cf_save="$CPPFLAGS" -+ CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" -+ cat >conftest.$ac_ext <<_ACEOF -+#line 3228 "configure" -+#include "confdefs.h" -+ -+#include <stdlib.h> -+#include <string.h> -+#include <sys/types.h> -+ -+int -+main () -+{ -+ -+#ifdef _XOPEN_SOURCE -+make an error -+#endif - ; - return 0; - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:3037: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:3247: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:3040: \$? = $ac_status" >&5 -+ echo "$as_me:3250: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:3043: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:3253: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:3046: \$? = $ac_status" >&5 -+ echo "$as_me:3256: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_cv_xopen_source=no - else -@@ -3058,9 +3268,10 @@ - rm -f conftest.$ac_objext conftest.$ac_ext - - fi --echo "$as_me:3061: result: $cf_cv_xopen_source" >&5 -+echo "$as_me:3271: result: $cf_cv_xopen_source" >&5 - echo "${ECHO_T}$cf_cv_xopen_source" >&6 -- if test "$cf_cv_xopen_source" != no ; then -+ -+if test "$cf_cv_xopen_source" != no ; then - - CFLAGS=`echo "$CFLAGS" | \ - sed -e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \ -@@ -3070,7 +3281,7 @@ - sed -e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \ - -e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ ]*\)\?$//g'` - -- cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source" -+ cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source" - - cf_fix_cppflags=no - cf_new_cflags= -@@ -3150,7 +3361,7 @@ - EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" - fi - -- fi -+fi - - cf_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE - -@@ -3165,16 +3376,16 @@ - sed -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \ - -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?$//g'` - --echo "$as_me:3168: checking if we should define _POSIX_C_SOURCE" >&5 -+echo "$as_me:3379: checking if we should define _POSIX_C_SOURCE" >&5 - echo $ECHO_N "checking if we should define _POSIX_C_SOURCE... $ECHO_C" >&6 - if test "${cf_cv_posix_c_source+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - --echo "${as_me:-configure}:3174: testing if the symbol is already defined go no further ..." 1>&5 -+echo "${as_me:-configure}:3385: testing if the symbol is already defined go no further ..." 1>&5 - - cat >conftest.$ac_ext <<_ACEOF --#line 3177 "configure" -+#line 3388 "configure" - #include "confdefs.h" - #include <sys/types.h> - int -@@ -3189,16 +3400,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:3192: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:3403: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:3195: \$? = $ac_status" >&5 -+ echo "$as_me:3406: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:3198: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:3409: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:3201: \$? = $ac_status" >&5 -+ echo "$as_me:3412: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_cv_posix_c_source=no - else -@@ -3219,7 +3430,7 @@ - esac - if test "$cf_want_posix_source" = yes ; then - cat >conftest.$ac_ext <<_ACEOF --#line 3222 "configure" -+#line 3433 "configure" - #include "confdefs.h" - #include <sys/types.h> - int -@@ -3234,16 +3445,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:3237: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:3448: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:3240: \$? = $ac_status" >&5 -+ echo "$as_me:3451: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:3243: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:3454: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:3246: \$? = $ac_status" >&5 -+ echo "$as_me:3457: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : - else -@@ -3254,15 +3465,15 @@ - rm -f conftest.$ac_objext conftest.$ac_ext - fi - --echo "${as_me:-configure}:3257: testing ifdef from value $cf_POSIX_C_SOURCE ..." 1>&5 -+echo "${as_me:-configure}:3468: testing ifdef from value $cf_POSIX_C_SOURCE ..." 1>&5 - - CFLAGS="$cf_trim_CFLAGS" - CPPFLAGS="$cf_trim_CPPFLAGS $cf_cv_posix_c_source" - --echo "${as_me:-configure}:3262: testing if the second compile does not leave our definition intact error ..." 1>&5 -+echo "${as_me:-configure}:3473: testing if the second compile does not leave our definition intact error ..." 1>&5 - - cat >conftest.$ac_ext <<_ACEOF --#line 3265 "configure" -+#line 3476 "configure" - #include "confdefs.h" - #include <sys/types.h> - int -@@ -3277,16 +3488,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:3280: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:3491: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:3283: \$? = $ac_status" >&5 -+ echo "$as_me:3494: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:3286: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:3497: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:3289: \$? = $ac_status" >&5 -+ echo "$as_me:3500: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : - else -@@ -3302,7 +3513,7 @@ - rm -f conftest.$ac_objext conftest.$ac_ext - - fi --echo "$as_me:3305: result: $cf_cv_posix_c_source" >&5 -+echo "$as_me:3516: result: $cf_cv_posix_c_source" >&5 - echo "${ECHO_T}$cf_cv_posix_c_source" >&6 - - if test "$cf_cv_posix_c_source" != no ; then -@@ -3474,191 +3685,274 @@ - - fi - --echo "$as_me:3477: checking for $CC option to accept ANSI C" >&5 --echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 --if test "${ac_cv_prog_cc_stdc+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 --else -- ac_cv_prog_cc_stdc=no --ac_save_CC=$CC --cat >conftest.$ac_ext <<_ACEOF --#line 3485 "configure" -+if test -n "$cf_XOPEN_SOURCE" && test -z "$cf_cv_xopen_source" ; then -+ echo "$as_me:3689: checking if _XOPEN_SOURCE really is set" >&5 -+echo $ECHO_N "checking if _XOPEN_SOURCE really is set... $ECHO_C" >&6 -+ cat >conftest.$ac_ext <<_ACEOF -+#line 3692 "configure" - #include "confdefs.h" --#include <stdarg.h> --#include <stdio.h> --#include <sys/types.h> --#include <sys/stat.h> --/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ --struct buf { int x; }; --FILE * (*rcsopen) (struct buf *, struct stat *, int); --static char *e (p, i) -- char **p; -- int i; --{ -- return p[i]; --} --static char *f (char * (*g) (char **, int), char **p, ...) --{ -- char *s; -- va_list v; -- va_start (v,p); -- s = g (p, va_arg (v,int)); -- va_end (v); -- return s; --} --int test (int i, double x); --struct s1 {int (*f) (int a);}; --struct s2 {int (*f) (double a);}; --int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); --int argc; --char **argv; -+#include <stdlib.h> - int - main () - { --return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; -+ -+#ifndef _XOPEN_SOURCE -+make an error -+#endif - ; - return 0; - } - _ACEOF --# Don't try gcc -ansi; that turns off useful extensions and --# breaks some systems' header files. --# AIX -qlanglvl=ansi --# Ultrix and OSF/1 -std1 --# HP-UX 10.20 and later -Ae --# HP-UX older versions -Aa -D_HPUX_SOURCE --# SVR4 -Xc -D__EXTENSIONS__ --for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" --do -- CC="$ac_save_CC $ac_arg" -- rm -f conftest.$ac_objext --if { (eval echo "$as_me:3534: \"$ac_compile\"") >&5 -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:3707: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:3537: \$? = $ac_status" >&5 -+ echo "$as_me:3710: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:3540: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:3713: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:3543: \$? = $ac_status" >&5 -+ echo "$as_me:3716: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- ac_cv_prog_cc_stdc=$ac_arg --break -+ cf_XOPEN_SOURCE_set=yes - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 -+cf_XOPEN_SOURCE_set=no - fi --rm -f conftest.$ac_objext --done --rm -f conftest.$ac_ext conftest.$ac_objext --CC=$ac_save_CC -- --fi -- --case "x$ac_cv_prog_cc_stdc" in -- x|xno) -- echo "$as_me:3560: result: none needed" >&5 --echo "${ECHO_T}none needed" >&6 ;; -- *) -- echo "$as_me:3563: result: $ac_cv_prog_cc_stdc" >&5 --echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 -- CC="$CC $ac_cv_prog_cc_stdc" ;; --esac -- --echo "$as_me:3568: checking for an ANSI C-conforming const" >&5 --echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6 --if test "${ac_cv_c_const+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 --else -- cat >conftest.$ac_ext <<_ACEOF --#line 3574 "configure" -+rm -f conftest.$ac_objext conftest.$ac_ext -+ echo "$as_me:3725: result: $cf_XOPEN_SOURCE_set" >&5 -+echo "${ECHO_T}$cf_XOPEN_SOURCE_set" >&6 -+ if test $cf_XOPEN_SOURCE_set = yes -+ then -+ cat >conftest.$ac_ext <<_ACEOF -+#line 3730 "configure" - #include "confdefs.h" -- -+#include <stdlib.h> - int - main () - { --/* FIXME: Include the comments suggested by Paul. */ --#ifndef __cplusplus -- /* Ultrix mips cc rejects this. */ -- typedef int charset[2]; -- const charset x; -- /* SunOS 4.1.1 cc rejects this. */ -- char const *const *ccp; -- char **p; -- /* NEC SVR4.0.2 mips cc rejects this. */ -- struct point {int x, y;}; -- static struct point const zero = {0,0}; -- /* AIX XL C 1.02.0.0 rejects this. -- It does not let you subtract one const X* pointer from another in -- an arm of an if-expression whose if-part is not a constant -- expression */ -- const char *g = "string"; -- ccp = &g + (g ? g-g : 0); -- /* HPUX 7.0 cc rejects these. */ -- ++ccp; -- p = (char**) ccp; -- ccp = (char const *const *) p; -- { /* SCO 3.2v4 cc rejects this. */ -- char *t; -- char const *s = 0 ? (char *) 0 : (char const *) 0; - -- *t++ = 0; -- } -- { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ -- int x[] = {25, 17}; -- const int *foo = &x[0]; -- ++foo; -- } -- { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ -- typedef const int *iptr; -- iptr p = 0; -- ++p; -- } -- { /* AIX XL C 1.02.0.0 rejects this saying -- "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ -- struct s { int j; const int *ap[3]; }; -- struct s *b; b->j = 5; -- } -- { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ -- const int foo = 10; -- } -+#if (_XOPEN_SOURCE - 0) < $cf_XOPEN_SOURCE -+make an error - #endif -- - ; - return 0; - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:3632: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:3745: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:3635: \$? = $ac_status" >&5 -+ echo "$as_me:3748: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:3638: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:3751: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:3641: \$? = $ac_status" >&5 -+ echo "$as_me:3754: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- ac_cv_c_const=yes -+ cf_XOPEN_SOURCE_set_ok=yes - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --ac_cv_c_const=no -+cf_XOPEN_SOURCE_set_ok=no - fi - rm -f conftest.$ac_objext conftest.$ac_ext --fi --echo "$as_me:3651: result: $ac_cv_c_const" >&5 --echo "${ECHO_T}$ac_cv_c_const" >&6 --if test $ac_cv_c_const = no; then -- --cat >>confdefs.h <<\EOF --#define const --EOF -+ if test $cf_XOPEN_SOURCE_set_ok = no -+ then -+ { echo "$as_me:3765: WARNING: _XOPEN_SOURCE is lower than requested" >&5 -+echo "$as_me: WARNING: _XOPEN_SOURCE is lower than requested" >&2;} -+ fi -+ else -+ -+echo "$as_me:3770: checking if we should define _XOPEN_SOURCE" >&5 -+echo $ECHO_N "checking if we should define _XOPEN_SOURCE... $ECHO_C" >&6 -+if test "${cf_cv_xopen_source+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ -+ cat >conftest.$ac_ext <<_ACEOF -+#line 3777 "configure" -+#include "confdefs.h" -+ -+#include <stdlib.h> -+#include <string.h> -+#include <sys/types.h> -+ -+int -+main () -+{ -+ -+#ifndef _XOPEN_SOURCE -+make an error -+#endif -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:3796: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>&5 -+ ac_status=$? -+ echo "$as_me:3799: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:3802: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:3805: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ cf_cv_xopen_source=no -+else -+ echo "$as_me: failed program was:" >&5 -+cat conftest.$ac_ext >&5 -+cf_save="$CPPFLAGS" -+ CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" -+ cat >conftest.$ac_ext <<_ACEOF -+#line 3814 "configure" -+#include "confdefs.h" -+ -+#include <stdlib.h> -+#include <string.h> -+#include <sys/types.h> -+ -+int -+main () -+{ -+ -+#ifdef _XOPEN_SOURCE -+make an error -+#endif -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:3833: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>&5 -+ ac_status=$? -+ echo "$as_me:3836: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:3839: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:3842: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ cf_cv_xopen_source=no -+else -+ echo "$as_me: failed program was:" >&5 -+cat conftest.$ac_ext >&5 -+cf_cv_xopen_source=$cf_XOPEN_SOURCE -+fi -+rm -f conftest.$ac_objext conftest.$ac_ext -+ CPPFLAGS="$cf_save" -+ -+fi -+rm -f conftest.$ac_objext conftest.$ac_ext -+ -+fi -+echo "$as_me:3857: result: $cf_cv_xopen_source" >&5 -+echo "${ECHO_T}$cf_cv_xopen_source" >&6 -+ -+if test "$cf_cv_xopen_source" != no ; then -+ -+CFLAGS=`echo "$CFLAGS" | \ -+ sed -e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \ -+ -e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ ]*\)\?$//g'` -+ -+CPPFLAGS=`echo "$CPPFLAGS" | \ -+ sed -e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \ -+ -e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ ]*\)\?$//g'` -+ -+ cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source" -+ -+cf_fix_cppflags=no -+cf_new_cflags= -+cf_new_cppflags= -+cf_new_extra_cppflags= -+ -+for cf_add_cflags in $cf_temp_xopen_source -+do -+case $cf_fix_cppflags in -+no) -+ case $cf_add_cflags in #(vi -+ -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi -+ case $cf_add_cflags in -+ -D*) -+ cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` -+ -+ test "${cf_add_cflags}" != "${cf_tst_cflags}" \ -+ && test -z "${cf_tst_cflags}" \ -+ && cf_fix_cppflags=yes -+ -+ if test $cf_fix_cppflags = yes ; then -+ cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -+ continue -+ elif test "${cf_tst_cflags}" = "\"'" ; then -+ cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -+ continue -+ fi -+ ;; -+ esac -+ case "$CPPFLAGS" in -+ *$cf_add_cflags) #(vi -+ ;; -+ *) #(vi -+ case $cf_add_cflags in #(vi -+ -D*) -+ cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` - -+CPPFLAGS=`echo "$CPPFLAGS" | \ -+ sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ -+ -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` -+ -+ ;; -+ esac -+ cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" -+ ;; -+ esac -+ ;; -+ *) -+ cf_new_cflags="$cf_new_cflags $cf_add_cflags" -+ ;; -+ esac -+ ;; -+yes) -+ cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -+ -+ cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` -+ -+ test "${cf_add_cflags}" != "${cf_tst_cflags}" \ -+ && test -z "${cf_tst_cflags}" \ -+ && cf_fix_cppflags=no -+ ;; -+esac -+done -+ -+if test -n "$cf_new_cflags" ; then -+ -+ CFLAGS="$CFLAGS $cf_new_cflags" -+fi -+ -+if test -n "$cf_new_cppflags" ; then -+ -+ CPPFLAGS="$CPPFLAGS $cf_new_cppflags" -+fi -+ -+if test -n "$cf_new_extra_cppflags" ; then -+ -+ EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" - fi - --echo "$as_me:3661: checking for signal global datatype" >&5 -+fi -+ -+ fi -+fi -+ -+echo "$as_me:3955: checking for signal global datatype" >&5 - echo $ECHO_N "checking for signal global datatype... $ECHO_C" >&6 - if test "${cf_cv_sig_atomic_t+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -@@ -3670,7 +3964,7 @@ - "int" - do - cat >conftest.$ac_ext <<_ACEOF --#line 3673 "configure" -+#line 3967 "configure" - #include "confdefs.h" - - #include <sys/types.h> -@@ -3693,16 +3987,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:3696: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:3990: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:3699: \$? = $ac_status" >&5 -+ echo "$as_me:3993: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:3702: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:3996: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:3705: \$? = $ac_status" >&5 -+ echo "$as_me:3999: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_cv_sig_atomic_t=$cf_type - else -@@ -3716,473 +4010,535 @@ - - fi - --echo "$as_me:3719: result: $cf_cv_sig_atomic_t" >&5 -+echo "$as_me:4013: result: $cf_cv_sig_atomic_t" >&5 - echo "${ECHO_T}$cf_cv_sig_atomic_t" >&6 --test "$cf_cv_sig_atomic_t" != no && cat >>confdefs.h <<EOF -+test "$cf_cv_sig_atomic_t" != no && -+cat >>confdefs.h <<EOF - #define SIG_ATOMIC_T $cf_cv_sig_atomic_t - EOF - --echo "$as_me:3725: checking if you want to see long compiling messages" >&5 --echo $ECHO_N "checking if you want to see long compiling messages... $ECHO_C" >&6 -- --# Check whether --enable-echo or --disable-echo was given. --if test "${enable_echo+set}" = set; then -- enableval="$enable_echo" -- test "$enableval" != no && enableval=yes -- if test "$enableval" != "yes" ; then -- -- ECHO_LT='--silent' -- ECHO_LD='@echo linking $@;' -- RULE_CC='@echo compiling $<' -- SHOW_CC='@echo compiling $@' -- ECHO_CC='@' -- -- else -- -- ECHO_LT='' -- ECHO_LD='' -- RULE_CC='' -- SHOW_CC='' -- ECHO_CC='' -+echo "$as_me:4020: checking if you want to use pkg-config" >&5 -+echo $ECHO_N "checking if you want to use pkg-config... $ECHO_C" >&6 - -- fi -+# Check whether --with-pkg-config or --without-pkg-config was given. -+if test "${with_pkg_config+set}" = set; then -+ withval="$with_pkg_config" -+ cf_pkg_config=$withval - else -- enableval=yes -+ cf_pkg_config=yes -+fi; -+echo "$as_me:4030: result: $cf_pkg_config" >&5 -+echo "${ECHO_T}$cf_pkg_config" >&6 - -- ECHO_LT='' -- ECHO_LD='' -- RULE_CC='' -- SHOW_CC='' -- ECHO_CC='' -+case $cf_pkg_config in #(vi -+no) #(vi -+ PKG_CONFIG=none -+ ;; -+yes) #(vi - --fi; --echo "$as_me:3759: result: $enableval" >&5 --echo "${ECHO_T}$enableval" >&6 -+if test -n "$ac_tool_prefix"; then -+ # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. -+set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 -+echo "$as_me:4042: checking for $ac_word" >&5 -+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -+if test "${ac_cv_path_PKG_CONFIG+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ case $PKG_CONFIG in -+ [\\/]* | ?:[\\/]*) -+ ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. -+ ;; -+ *) -+ ac_save_IFS=$IFS; IFS=$ac_path_separator -+ac_dummy="$PATH" -+for ac_dir in $ac_dummy; do -+ IFS=$ac_save_IFS -+ test -z "$ac_dir" && ac_dir=. -+ if $as_executable_p "$ac_dir/$ac_word"; then -+ ac_cv_path_PKG_CONFIG="$ac_dir/$ac_word" -+ echo "$as_me:4059: found $ac_dir/$ac_word" >&5 -+ break -+fi -+done - --GCC_VERSION=none --if test "$GCC" = yes ; then -- echo "$as_me:3764: checking version of $CC" >&5 --echo $ECHO_N "checking version of $CC... $ECHO_C" >&6 -- GCC_VERSION="`${CC} --version 2>/dev/null | sed -e '2,$d' -e 's/^.*(GCC) //' -e 's/^[^0-9.]*//' -e 's/[^0-9.].*//'`" -- test -z "$GCC_VERSION" && GCC_VERSION=unknown -- echo "$as_me:3768: result: $GCC_VERSION" >&5 --echo "${ECHO_T}$GCC_VERSION" >&6 -+ ;; -+esac - fi -+PKG_CONFIG=$ac_cv_path_PKG_CONFIG - --if ( test "$GCC" = yes || test "$GXX" = yes ) --then --echo "$as_me:3774: checking if you want to turn on gcc warnings" >&5 --echo $ECHO_N "checking if you want to turn on gcc warnings... $ECHO_C" >&6 -+if test -n "$PKG_CONFIG"; then -+ echo "$as_me:4070: result: $PKG_CONFIG" >&5 -+echo "${ECHO_T}$PKG_CONFIG" >&6 -+else -+ echo "$as_me:4073: result: no" >&5 -+echo "${ECHO_T}no" >&6 -+fi - --# Check whether --enable-warnings or --disable-warnings was given. --if test "${enable_warnings+set}" = set; then -- enableval="$enable_warnings" -- test "$enableval" != yes && enableval=no -- if test "$enableval" != "no" ; then -- with_warnings=yes -- else -- with_warnings=no -- fi -+fi -+if test -z "$ac_cv_path_PKG_CONFIG"; then -+ ac_pt_PKG_CONFIG=$PKG_CONFIG -+ # Extract the first word of "pkg-config", so it can be a program name with args. -+set dummy pkg-config; ac_word=$2 -+echo "$as_me:4082: checking for $ac_word" >&5 -+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -+if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 - else -- enableval=no -- with_warnings=no -+ case $ac_pt_PKG_CONFIG in -+ [\\/]* | ?:[\\/]*) -+ ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. -+ ;; -+ *) -+ ac_save_IFS=$IFS; IFS=$ac_path_separator -+ac_dummy="$PATH" -+for ac_dir in $ac_dummy; do -+ IFS=$ac_save_IFS -+ test -z "$ac_dir" && ac_dir=. -+ if $as_executable_p "$ac_dir/$ac_word"; then -+ ac_cv_path_ac_pt_PKG_CONFIG="$ac_dir/$ac_word" -+ echo "$as_me:4099: found $ac_dir/$ac_word" >&5 -+ break -+fi -+done - --fi; --echo "$as_me:3791: result: $with_warnings" >&5 --echo "${ECHO_T}$with_warnings" >&6 --if test "$with_warnings" = "yes" --then -+ test -z "$ac_cv_path_ac_pt_PKG_CONFIG" && ac_cv_path_ac_pt_PKG_CONFIG="none" -+ ;; -+esac -+fi -+ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG - --if test "$GCC" = yes --then --cat > conftest.i <<EOF --#ifndef GCC_PRINTF --#define GCC_PRINTF 0 --#endif --#ifndef GCC_SCANF --#define GCC_SCANF 0 --#endif --#ifndef GCC_NORETURN --#define GCC_NORETURN /* nothing */ --#endif --#ifndef GCC_UNUSED --#define GCC_UNUSED /* nothing */ --#endif --EOF --if test "$GCC" = yes --then -- { echo "$as_me:3814: checking for $CC __attribute__ directives..." >&5 --echo "$as_me: checking for $CC __attribute__ directives..." >&6;} --cat > conftest.$ac_ext <<EOF --#line 3817 "${as_me:-configure}" --#include "confdefs.h" --#include "conftest.h" --#include "conftest.i" --#if GCC_PRINTF --#define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var))) --#else --#define GCC_PRINTFLIKE(fmt,var) /*nothing*/ --#endif --#if GCC_SCANF --#define GCC_SCANFLIKE(fmt,var) __attribute__((format(scanf,fmt,var))) --#else --#define GCC_SCANFLIKE(fmt,var) /*nothing*/ --#endif --extern void wow(char *,...) GCC_SCANFLIKE(1,2); --extern void oops(char *,...) GCC_PRINTFLIKE(1,2) GCC_NORETURN; --extern void foo(void) GCC_NORETURN; --int main(int argc GCC_UNUSED, char *argv[] GCC_UNUSED) { return 0; } --EOF -- cf_printf_attribute=no -- cf_scanf_attribute=no -- for cf_attribute in scanf printf unused noreturn -- do -+if test -n "$ac_pt_PKG_CONFIG"; then -+ echo "$as_me:4111: result: $ac_pt_PKG_CONFIG" >&5 -+echo "${ECHO_T}$ac_pt_PKG_CONFIG" >&6 -+else -+ echo "$as_me:4114: result: no" >&5 -+echo "${ECHO_T}no" >&6 -+fi - --cf_ATTRIBUTE=`echo "$cf_attribute" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` -+ PKG_CONFIG=$ac_pt_PKG_CONFIG -+else -+ PKG_CONFIG="$ac_cv_path_PKG_CONFIG" -+fi - -- cf_directive="__attribute__(($cf_attribute))" -- echo "checking for $CC $cf_directive" 1>&5 -+ ;; -+*) -+ PKG_CONFIG=$withval -+ ;; -+esac - -- case $cf_attribute in #(vi -- printf) #(vi -- cf_printf_attribute=yes -- cat >conftest.h <<EOF --#define GCC_$cf_ATTRIBUTE 1 --EOF -- ;; -- scanf) #(vi -- cf_scanf_attribute=yes -- cat >conftest.h <<EOF --#define GCC_$cf_ATTRIBUTE 1 --EOF -- ;; -- *) #(vi -- cat >conftest.h <<EOF --#define GCC_$cf_ATTRIBUTE $cf_directive --EOF -- ;; -- esac -+test -z "$PKG_CONFIG" && PKG_CONFIG=none -+if test "$PKG_CONFIG" != none ; then - -- if { (eval echo "$as_me:3866: \"$ac_compile\"") >&5 -- (eval $ac_compile) 2>&5 -- ac_status=$? -- echo "$as_me:3869: \$? = $ac_status" >&5 -- (exit $ac_status); }; then -- test -n "$verbose" && echo "$as_me:3871: result: ... $cf_attribute" >&5 --echo "${ECHO_T}... $cf_attribute" >&6 -- cat conftest.h >>confdefs.h -- case $cf_attribute in #(vi -- printf) #(vi -- if test "$cf_printf_attribute" = no ; then -- cat >>confdefs.h <<EOF --#define GCC_PRINTFLIKE(fmt,var) /* nothing */ --EOF -- else -- cat >>confdefs.h <<EOF --#define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var))) --EOF -- fi -- ;; -- scanf) #(vi -- if test "$cf_scanf_attribute" = no ; then -- cat >>confdefs.h <<EOF --#define GCC_SCANFLIKE(fmt,var) /* nothing */ --EOF -- else -- cat >>confdefs.h <<EOF --#define GCC_SCANFLIKE(fmt,var) __attribute__((format(scanf,fmt,var))) --EOF -- fi -- ;; -- esac -- fi -- done -+if test "x$prefix" != xNONE; then -+ cf_path_syntax="$prefix" - else -- fgrep define conftest.i >>confdefs.h -+ cf_path_syntax="$ac_default_prefix" - fi --rm -rf conftest* -+ -+case ".$PKG_CONFIG" in #(vi -+.\$\(*\)*|.\'*\'*) #(vi -+ ;; -+..|./*|.\\*) #(vi -+ ;; -+.[a-zA-Z]:[\\/]*) #(vi OS/2 EMX -+ ;; -+.\${*prefix}*|.\${*dir}*) #(vi -+ eval PKG_CONFIG="$PKG_CONFIG" -+ case ".$PKG_CONFIG" in #(vi -+ .NONE/*) -+ PKG_CONFIG=`echo $PKG_CONFIG | sed -e s%NONE%$cf_path_syntax%` -+ ;; -+ esac -+ ;; #(vi -+.no|.NONE/*) -+ PKG_CONFIG=`echo $PKG_CONFIG | sed -e s%NONE%$cf_path_syntax%` -+ ;; -+*) -+ { { echo "$as_me:4157: error: expected a pathname, not \"$PKG_CONFIG\"" >&5 -+echo "$as_me: error: expected a pathname, not \"$PKG_CONFIG\"" >&2;} -+ { (exit 1); exit 1; }; } -+ ;; -+esac -+ - fi - --INTEL_COMPILER=no -+echo "$as_me:4165: checking if you want to see long compiling messages" >&5 -+echo $ECHO_N "checking if you want to see long compiling messages... $ECHO_C" >&6 - --if test "$GCC" = yes ; then -- case $host_os in -- linux*|gnu*) -- echo "$as_me:3911: checking if this is really Intel C compiler" >&5 --echo $ECHO_N "checking if this is really Intel C compiler... $ECHO_C" >&6 -- cf_save_CFLAGS="$CFLAGS" -- CFLAGS="$CFLAGS -no-gcc" -- cat >conftest.$ac_ext <<_ACEOF --#line 3916 "configure" --#include "confdefs.h" -+# Check whether --enable-echo or --disable-echo was given. -+if test "${enable_echo+set}" = set; then -+ enableval="$enable_echo" -+ test "$enableval" != no && enableval=yes -+ if test "$enableval" != "yes" ; then - --int --main () --{ -+ ECHO_LT='--silent' -+ ECHO_LD='@echo linking $@;' -+ RULE_CC='@echo compiling $<' -+ SHOW_CC='@echo compiling $@' -+ ECHO_CC='@' - --#ifdef __INTEL_COMPILER --#else --make an error --#endif -+ else - -- ; -- return 0; --} --_ACEOF --rm -f conftest.$ac_objext --if { (eval echo "$as_me:3933: \"$ac_compile\"") >&5 -- (eval $ac_compile) 2>&5 -- ac_status=$? -- echo "$as_me:3936: \$? = $ac_status" >&5 -- (exit $ac_status); } && -- { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:3939: \"$ac_try\"") >&5 -- (eval $ac_try) 2>&5 -- ac_status=$? -- echo "$as_me:3942: \$? = $ac_status" >&5 -- (exit $ac_status); }; }; then -- INTEL_COMPILER=yes --cf_save_CFLAGS="$cf_save_CFLAGS -we147 -no-gcc" -+ ECHO_LT='' -+ ECHO_LD='' -+ RULE_CC='' -+ SHOW_CC='' -+ ECHO_CC='' - -+ fi - else -- echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 --fi --rm -f conftest.$ac_objext conftest.$ac_ext -- CFLAGS="$cf_save_CFLAGS" -- echo "$as_me:3953: result: $INTEL_COMPILER" >&5 --echo "${ECHO_T}$INTEL_COMPILER" >&6 -- ;; -- esac --fi -+ enableval=yes - --cat > conftest.$ac_ext <<EOF --#line 3960 "${as_me:-configure}" --int main(int argc, char *argv[]) { return (argv[argc-1] == 0) ; } --EOF -+ ECHO_LT='' -+ ECHO_LD='' -+ RULE_CC='' -+ SHOW_CC='' -+ ECHO_CC='' - --if test "$INTEL_COMPILER" = yes --then --# The "-wdXXX" options suppress warnings: --# remark #1419: external declaration in primary source file --# remark #1683: explicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem) --# remark #1684: conversion from pointer to same-sized integral type (potential portability problem) --# remark #193: zero used for undefined preprocessing identifier --# remark #593: variable "curs_sb_left_arrow" was set but never used --# remark #810: conversion from "int" to "Dimension={unsigned short}" may lose significant bits --# remark #869: parameter "tw" was never referenced --# remark #981: operands are evaluated in unspecified order --# warning #279: controlling expression is constant -+fi; -+echo "$as_me:4199: result: $enableval" >&5 -+echo "${ECHO_T}$enableval" >&6 - -- { echo "$as_me:3977: checking for $CC warning options..." >&5 --echo "$as_me: checking for $CC warning options..." >&6;} -- cf_save_CFLAGS="$CFLAGS" -- EXTRA_CFLAGS="-Wall" -- for cf_opt in \ -- wd1419 \ -- wd1683 \ -- wd1684 \ -- wd193 \ -- wd593 \ -- wd279 \ -- wd810 \ -- wd869 \ -- wd981 -- do -- CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt" -- if { (eval echo "$as_me:3993: \"$ac_compile\"") >&5 -- (eval $ac_compile) 2>&5 -- ac_status=$? -- echo "$as_me:3996: \$? = $ac_status" >&5 -- (exit $ac_status); }; then -- test -n "$verbose" && echo "$as_me:3998: result: ... -$cf_opt" >&5 --echo "${ECHO_T}... -$cf_opt" >&6 -- EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt" -- fi -- done -- CFLAGS="$cf_save_CFLAGS" -- --elif test "$GCC" = yes --then -- { echo "$as_me:4007: checking for $CC warning options..." >&5 --echo "$as_me: checking for $CC warning options..." >&6;} -- cf_save_CFLAGS="$CFLAGS" -- EXTRA_CFLAGS= -- cf_warn_CONST="" -- test "$with_ext_const" = yes && cf_warn_CONST="Wwrite-strings" -- for cf_opt in W Wall \ -- Wbad-function-cast \ -- Wcast-align \ -- Wcast-qual \ -- Winline \ -- Wmissing-declarations \ -- Wmissing-prototypes \ -- Wnested-externs \ -- Wpointer-arith \ -- Wshadow \ -- Wstrict-prototypes \ -- Wundef $cf_warn_CONST -- do -- CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt" -- if { (eval echo "$as_me:4027: \"$ac_compile\"") >&5 -- (eval $ac_compile) 2>&5 -- ac_status=$? -- echo "$as_me:4030: \$? = $ac_status" >&5 -- (exit $ac_status); }; then -- test -n "$verbose" && echo "$as_me:4032: result: ... -$cf_opt" >&5 --echo "${ECHO_T}... -$cf_opt" >&6 -- case $cf_opt in #(vi -- Wcast-qual) #(vi -- CPPFLAGS="$CPPFLAGS -DXTSTRINGDEFINES" -- ;; -- Winline) #(vi -- case $GCC_VERSION in -- [34].*) -- test -n "$verbose" && echo " feature is broken in gcc $GCC_VERSION" 1>&6 -+echo "$as_me:4202: checking for ncurses wrap-prefix" >&5 -+echo $ECHO_N "checking for ncurses wrap-prefix... $ECHO_C" >&6 - --echo "${as_me:-configure}:4043: testing feature is broken in gcc $GCC_VERSION ..." 1>&5 -+# Check whether --with-ncurses-wrap-prefix or --without-ncurses-wrap-prefix was given. -+if test "${with_ncurses_wrap_prefix+set}" = set; then -+ withval="$with_ncurses_wrap_prefix" -+ NCURSES_WRAP_PREFIX=$withval -+else -+ NCURSES_WRAP_PREFIX=_nc_ -+fi; -+echo "$as_me:4212: result: $NCURSES_WRAP_PREFIX" >&5 -+echo "${ECHO_T}$NCURSES_WRAP_PREFIX" >&6 - -- continue;; -- esac -- ;; -- esac -- EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt" -- fi -- done -- CFLAGS="$cf_save_CFLAGS" --fi --rm -rf conftest* -+echo "$as_me:4215: checking if you want to check for wide-character functions" >&5 -+echo $ECHO_N "checking if you want to check for wide-character functions... $ECHO_C" >&6 - --fi --fi -+# Check whether --enable-widec or --disable-widec was given. -+if test "${enable_widec+set}" = set; then -+ enableval="$enable_widec" -+ test "$enableval" != no && enableval=yes -+ if test "$enableval" != "yes" ; then -+ cf_enable_widec=no -+ else -+ cf_enable_widec=yes -+ fi -+else -+ enableval=yes -+ cf_enable_widec=yes - --echo "$as_me:4059: checking if you want to use dmalloc for testing" >&5 --echo $ECHO_N "checking if you want to use dmalloc for testing... $ECHO_C" >&6 -+fi; -+echo "$as_me:4232: result: $cf_enable_widec" >&5 -+echo "${ECHO_T}$cf_enable_widec" >&6 - --# Check whether --with-dmalloc or --without-dmalloc was given. --if test "${with_dmalloc+set}" = set; then -- withval="$with_dmalloc" -- cat >>confdefs.h <<\EOF --#define USE_DMALLOC 1 --EOF -+echo "$as_me:4235: checking for specific curses-directory" >&5 -+echo $ECHO_N "checking for specific curses-directory... $ECHO_C" >&6 - -- : ${with_cflags:=-g} -- : ${with_no_leaks:=yes} -- with_dmalloc=yes -+# Check whether --with-curses-dir or --without-curses-dir was given. -+if test "${with_curses_dir+set}" = set; then -+ withval="$with_curses_dir" -+ cf_cv_curses_dir=$withval - else -- with_dmalloc= -+ cf_cv_curses_dir=no - fi; --echo "$as_me:4075: result: ${with_dmalloc:-no}" >&5 --echo "${ECHO_T}${with_dmalloc:-no}" >&6 -+echo "$as_me:4245: result: $cf_cv_curses_dir" >&5 -+echo "${ECHO_T}$cf_cv_curses_dir" >&6 - --case .$with_cflags in #(vi --.*-g*) -- case .$CFLAGS in #(vi -- .*-g*) #(vi -- ;; -- *) -+if ( test -n "$cf_cv_curses_dir" && test "$cf_cv_curses_dir" != "no" ) -+then - --cf_fix_cppflags=no --cf_new_cflags= --cf_new_cppflags= --cf_new_extra_cppflags= -+if test "x$prefix" != xNONE; then -+ cf_path_syntax="$prefix" -+else -+ cf_path_syntax="$ac_default_prefix" -+fi - --for cf_add_cflags in -g --do --case $cf_fix_cppflags in --no) -- case $cf_add_cflags in #(vi -- -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi -- case $cf_add_cflags in -- -D*) -- cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` -+case ".$withval" in #(vi -+.\$\(*\)*|.\'*\'*) #(vi -+ ;; -+..|./*|.\\*) #(vi -+ ;; -+.[a-zA-Z]:[\\/]*) #(vi OS/2 EMX -+ ;; -+.\${*prefix}*|.\${*dir}*) #(vi -+ eval withval="$withval" -+ case ".$withval" in #(vi -+ .NONE/*) -+ withval=`echo $withval | sed -e s%NONE%$cf_path_syntax%` -+ ;; -+ esac -+ ;; #(vi -+.no|.NONE/*) -+ withval=`echo $withval | sed -e s%NONE%$cf_path_syntax%` -+ ;; -+*) -+ { { echo "$as_me:4276: error: expected a pathname, not \"$withval\"" >&5 -+echo "$as_me: error: expected a pathname, not \"$withval\"" >&2;} -+ { (exit 1); exit 1; }; } -+ ;; -+esac - -- test "${cf_add_cflags}" != "${cf_tst_cflags}" \ -- && test -z "${cf_tst_cflags}" \ -- && cf_fix_cppflags=yes -+ if test -d "$cf_cv_curses_dir" -+ then - -- if test $cf_fix_cppflags = yes ; then -- cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -- continue -- elif test "${cf_tst_cflags}" = "\"'" ; then -- cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -- continue -+if test -n "$cf_cv_curses_dir/include" ; then -+ for cf_add_incdir in $cf_cv_curses_dir/include -+ do -+ while test $cf_add_incdir != /usr/include -+ do -+ if test -d $cf_add_incdir -+ then -+ cf_have_incdir=no -+ if test -n "$CFLAGS$CPPFLAGS" ; then -+ # a loop is needed to ensure we can add subdirs of existing dirs -+ for cf_test_incdir in $CFLAGS $CPPFLAGS ; do -+ if test ".$cf_test_incdir" = ".-I$cf_add_incdir" ; then -+ cf_have_incdir=yes; break - fi -- ;; -- esac -- case "$CPPFLAGS" in -- *$cf_add_cflags) #(vi -- ;; -- *) #(vi -- case $cf_add_cflags in #(vi -- -D*) -- cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` -- --CPPFLAGS=`echo "$CPPFLAGS" | \ -- sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ -- -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` -+ done -+ fi - -- ;; -- esac -- cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" -- ;; -- esac -- ;; -- *) -- cf_new_cflags="$cf_new_cflags $cf_add_cflags" -- ;; -- esac -- ;; --yes) -- cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -+ if test "$cf_have_incdir" = no ; then -+ if test "$cf_add_incdir" = /usr/local/include ; then -+ if test "$GCC" = yes -+ then -+ cf_save_CPPFLAGS=$CPPFLAGS -+ CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" -+ cat >conftest.$ac_ext <<_ACEOF -+#line 4309 "configure" -+#include "confdefs.h" -+#include <stdio.h> -+int -+main () -+{ -+printf("Hello") -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:4321: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>&5 -+ ac_status=$? -+ echo "$as_me:4324: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:4327: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:4330: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ : -+else -+ echo "$as_me: failed program was:" >&5 -+cat conftest.$ac_ext >&5 -+cf_have_incdir=yes -+fi -+rm -f conftest.$ac_objext conftest.$ac_ext -+ CPPFLAGS=$cf_save_CPPFLAGS -+ fi -+ fi -+ fi - -- cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` -+ if test "$cf_have_incdir" = no ; then -+ test -n "$verbose" && echo " adding $cf_add_incdir to include-path" 1>&6 - -- test "${cf_add_cflags}" != "${cf_tst_cflags}" \ -- && test -z "${cf_tst_cflags}" \ -- && cf_fix_cppflags=no -- ;; --esac --done -+echo "${as_me:-configure}:4347: testing adding $cf_add_incdir to include-path ..." 1>&5 - --if test -n "$cf_new_cflags" ; then -+ CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" - -- CFLAGS="$CFLAGS $cf_new_cflags" -+ cf_top_incdir=`echo $cf_add_incdir | sed -e 's%/include/.*$%/include%'` -+ test "$cf_top_incdir" = "$cf_add_incdir" && break -+ cf_add_incdir="$cf_top_incdir" -+ else -+ break -+ fi -+ fi -+ done -+ done - fi - --if test -n "$cf_new_cppflags" ; then -+if test -n "$cf_cv_curses_dir/lib" ; then -+ for cf_add_libdir in $cf_cv_curses_dir/lib -+ do -+ if test $cf_add_libdir = /usr/lib ; then -+ : -+ elif test -d $cf_add_libdir -+ then -+ cf_have_libdir=no -+ if test -n "$LDFLAGS$LIBS" ; then -+ # a loop is needed to ensure we can add subdirs of existing dirs -+ for cf_test_libdir in $LDFLAGS $LIBS ; do -+ if test ".$cf_test_libdir" = ".-L$cf_add_libdir" ; then -+ cf_have_libdir=yes; break -+ fi -+ done -+ fi -+ if test "$cf_have_libdir" = no ; then -+ test -n "$verbose" && echo " adding $cf_add_libdir to library-path" 1>&6 - -- CPPFLAGS="$CPPFLAGS $cf_new_cppflags" --fi -+echo "${as_me:-configure}:4381: testing adding $cf_add_libdir to library-path ..." 1>&5 - --if test -n "$cf_new_extra_cppflags" ; then -+ LDFLAGS="-L$cf_add_libdir $LDFLAGS" -+ fi -+ fi -+ done -+fi - -- EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" -+ fi - fi - -- ;; -- esac -+cf_cv_screen=curses -+ -+echo "$as_me:4394: checking for specified curses library type" >&5 -+echo $ECHO_N "checking for specified curses library type... $ECHO_C" >&6 -+ -+# Check whether --with-ncursesw or --without-ncursesw was given. -+if test "${with_ncursesw+set}" = set; then -+ withval="$with_ncursesw" -+ cf_cv_screen=ncursesw -+else -+ -+# Check whether --with-ncurses or --without-ncurses was given. -+if test "${with_ncurses+set}" = set; then -+ withval="$with_ncurses" -+ cf_cv_screen=ncurses -+else -+ -+# Check whether --with-pdcurses or --without-pdcurses was given. -+if test "${with_pdcurses+set}" = set; then -+ withval="$with_pdcurses" -+ cf_cv_screen=pdcurses -+else -+ -+# Check whether --with-curses-colr or --without-curses-colr was given. -+if test "${with_curses_colr+set}" = set; then -+ withval="$with_curses_colr" -+ cf_cv_screen=curses_colr -+else -+ -+# Check whether --with-curses-5lib or --without-curses-5lib was given. -+if test "${with_curses_5lib+set}" = set; then -+ withval="$with_curses_5lib" -+ cf_cv_screen=curses_5lib -+fi; -+fi; -+fi; -+fi; -+fi; -+ -+echo "$as_me:4431: result: $cf_cv_screen" >&5 -+echo "${ECHO_T}$cf_cv_screen" >&6 -+ -+case $cf_cv_screen in #(vi -+curses|curses_*) #(vi -+ -+echo "$as_me:4437: checking for extra include directories" >&5 -+echo $ECHO_N "checking for extra include directories... $ECHO_C" >&6 -+if test "${cf_cv_curses_incdir+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ -+cf_cv_curses_incdir=no -+case $host_os in #(vi -+hpux10.*) #(vi -+ if test "x$cf_cv_screen" = "xcurses_colr" -+ then -+ test -d /usr/include/curses_colr && \ -+ cf_cv_curses_incdir="-I/usr/include/curses_colr" -+ fi -+ ;; -+sunos3*|sunos4*) -+ if test "x$cf_cv_screen" = "xcurses_5lib" -+ then -+ test -d /usr/5lib && \ -+ test -d /usr/5include && \ -+ cf_cv_curses_incdir="-I/usr/5include" -+ fi - ;; - esac - --if test "$with_dmalloc" = yes ; then -- echo "$as_me:4169: checking for dmalloc.h" >&5 --echo $ECHO_N "checking for dmalloc.h... $ECHO_C" >&6 --if test "${ac_cv_header_dmalloc_h+set}" = set; then -+fi -+echo "$as_me:4463: result: $cf_cv_curses_incdir" >&5 -+echo "${ECHO_T}$cf_cv_curses_incdir" >&6 -+test "$cf_cv_curses_incdir" != no && CPPFLAGS="$CPPFLAGS $cf_cv_curses_incdir" -+ -+echo "$as_me:4467: checking if we have identified curses headers" >&5 -+echo $ECHO_N "checking if we have identified curses headers... $ECHO_C" >&6 -+if test "${cf_cv_ncurses_header+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ -+cf_cv_ncurses_header=none -+for cf_header in \ -+ ncurses.h \ -+ curses.h ncurses/ncurses.h ncurses/curses.h -+do -+cat >conftest.$ac_ext <<_ACEOF -+#line 4479 "configure" -+#include "confdefs.h" -+#include <${cf_header}> -+int -+main () -+{ -+initscr(); tgoto("?", 0,0) -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:4491: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>&5 -+ ac_status=$? -+ echo "$as_me:4494: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:4497: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:4500: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ cf_cv_ncurses_header=$cf_header; break -+else -+ echo "$as_me: failed program was:" >&5 -+cat conftest.$ac_ext >&5 -+fi -+rm -f conftest.$ac_objext conftest.$ac_ext -+done -+ -+fi -+echo "$as_me:4511: result: $cf_cv_ncurses_header" >&5 -+echo "${ECHO_T}$cf_cv_ncurses_header" >&6 -+ -+if test "$cf_cv_ncurses_header" = none ; then -+ { { echo "$as_me:4515: error: No curses header-files found" >&5 -+echo "$as_me: error: No curses header-files found" >&2;} -+ { (exit 1); exit 1; }; } -+fi -+ -+# cheat, to get the right #define's for HAVE_NCURSES_H, etc. -+ -+for ac_header in $cf_cv_ncurses_header -+do -+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -+echo "$as_me:4525: checking for $ac_header" >&5 -+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -+if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - cat >conftest.$ac_ext <<_ACEOF --#line 4175 "configure" -+#line 4531 "configure" - #include "confdefs.h" --#include <dmalloc.h> -+#include <$ac_header> - _ACEOF --if { (eval echo "$as_me:4179: \"$ac_cpp conftest.$ac_ext\"") >&5 -+if { (eval echo "$as_me:4535: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 -- echo "$as_me:4185: \$? = $ac_status" >&5 -+ echo "$as_me:4541: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag -@@ -4193,238 +4549,316 @@ - ac_cpp_err=yes - fi - if test -z "$ac_cpp_err"; then -- ac_cv_header_dmalloc_h=yes -+ eval "$as_ac_Header=yes" - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 -- ac_cv_header_dmalloc_h=no -+ eval "$as_ac_Header=no" - fi - rm -f conftest.err conftest.$ac_ext - fi --echo "$as_me:4204: result: $ac_cv_header_dmalloc_h" >&5 --echo "${ECHO_T}$ac_cv_header_dmalloc_h" >&6 --if test $ac_cv_header_dmalloc_h = yes; then -+echo "$as_me:4560: result: `eval echo '${'$as_ac_Header'}'`" >&5 -+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -+if test `eval echo '${'$as_ac_Header'}'` = yes; then -+ cat >>confdefs.h <<EOF -+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -+EOF - --echo "$as_me:4208: checking for dmalloc_debug in -ldmalloc" >&5 --echo $ECHO_N "checking for dmalloc_debug in -ldmalloc... $ECHO_C" >&6 --if test "${ac_cv_lib_dmalloc_dmalloc_debug+set}" = set; then -+fi -+done -+ -+echo "$as_me:4570: checking for terminfo header" >&5 -+echo $ECHO_N "checking for terminfo header... $ECHO_C" >&6 -+if test "${cf_cv_term_header+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else -- ac_check_lib_save_LIBS=$LIBS --LIBS="-ldmalloc $LIBS" -+ -+case ${cf_cv_ncurses_header} in #(vi -+*/ncurses.h|*/ncursesw.h) #(vi -+ cf_term_header=`echo "$cf_cv_ncurses_header" | sed -e 's%ncurses[^.]*\.h$%term.h%'` -+ ;; -+*) -+ cf_term_header=term.h -+ ;; -+esac -+ -+for cf_test in $cf_term_header "ncurses/term.h" "ncursesw/term.h" -+do - cat >conftest.$ac_ext <<_ACEOF --#line 4216 "configure" -+#line 4588 "configure" - #include "confdefs.h" -+#include <stdio.h> -+#include <${cf_cv_ncurses_header:-curses.h}> -+#include <$cf_test> - --/* Override any gcc2 internal prototype to avoid an error. */ --#ifdef __cplusplus --extern "C" --#endif --/* We use char because int might match the return type of a gcc2 -- builtin and then its argument prototype would still apply. */ --char dmalloc_debug (); - int - main () - { --dmalloc_debug (); -+int x = auto_left_margin - ; - return 0; - } - _ACEOF --rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:4235: \"$ac_link\"") >&5 -- (eval $ac_link) 2>&5 -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:4603: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:4238: \$? = $ac_status" >&5 -+ echo "$as_me:4606: \$? = $ac_status" >&5 - (exit $ac_status); } && -- { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:4241: \"$ac_try\"") >&5 -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:4609: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:4244: \$? = $ac_status" >&5 -+ echo "$as_me:4612: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- ac_cv_lib_dmalloc_dmalloc_debug=yes -+ -+ cf_cv_term_header="$cf_test" - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --ac_cv_lib_dmalloc_dmalloc_debug=no --fi --rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext --LIBS=$ac_check_lib_save_LIBS --fi --echo "$as_me:4255: result: $ac_cv_lib_dmalloc_dmalloc_debug" >&5 --echo "${ECHO_T}$ac_cv_lib_dmalloc_dmalloc_debug" >&6 --if test $ac_cv_lib_dmalloc_dmalloc_debug = yes; then -- cat >>confdefs.h <<EOF --#define HAVE_LIBDMALLOC 1 --EOF - -- LIBS="-ldmalloc $LIBS" -+ cf_cv_term_header=unknown - - fi -+rm -f conftest.$ac_objext conftest.$ac_ext -+ test "$cf_cv_term_header" != unknown && break -+done - - fi -+echo "$as_me:4628: result: $cf_cv_term_header" >&5 -+echo "${ECHO_T}$cf_cv_term_header" >&6 - --fi -+# Set definitions to allow ifdef'ing to accommodate subdirectories - --echo "$as_me:4270: checking if you want to use dbmalloc for testing" >&5 --echo $ECHO_N "checking if you want to use dbmalloc for testing... $ECHO_C" >&6 -+case $cf_cv_term_header in # (vi -+*term.h) - --# Check whether --with-dbmalloc or --without-dbmalloc was given. --if test "${with_dbmalloc+set}" = set; then -- withval="$with_dbmalloc" -- cat >>confdefs.h <<\EOF --#define USE_DBMALLOC 1 -+cat >>confdefs.h <<\EOF -+#define HAVE_TERM_H 1 - EOF - -- : ${with_cflags:=-g} -- : ${with_no_leaks:=yes} -- with_dbmalloc=yes --else -- with_dbmalloc= --fi; --echo "$as_me:4286: result: ${with_dbmalloc:-no}" >&5 --echo "${ECHO_T}${with_dbmalloc:-no}" >&6 -+ ;; -+esac - --case .$with_cflags in #(vi --.*-g*) -- case .$CFLAGS in #(vi -- .*-g*) #(vi -- ;; -- *) -+case $cf_cv_term_header in # (vi -+ncurses/term.h) #(vi - --cf_fix_cppflags=no --cf_new_cflags= --cf_new_cppflags= --cf_new_extra_cppflags= -+cat >>confdefs.h <<\EOF -+#define HAVE_NCURSES_TERM_H 1 -+EOF - --for cf_add_cflags in -g --do --case $cf_fix_cppflags in --no) -- case $cf_add_cflags in #(vi -- -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi -- case $cf_add_cflags in -- -D*) -- cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` -+ ;; -+ncursesw/term.h) - -- test "${cf_add_cflags}" != "${cf_tst_cflags}" \ -- && test -z "${cf_tst_cflags}" \ -- && cf_fix_cppflags=yes -+cat >>confdefs.h <<\EOF -+#define HAVE_NCURSESW_TERM_H 1 -+EOF - -- if test $cf_fix_cppflags = yes ; then -- cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -- continue -- elif test "${cf_tst_cflags}" = "\"'" ; then -- cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -- continue -- fi -- ;; -- esac -- case "$CPPFLAGS" in -- *$cf_add_cflags) #(vi -- ;; -- *) #(vi -- case $cf_add_cflags in #(vi -- -D*) -- cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` -- --CPPFLAGS=`echo "$CPPFLAGS" | \ -- sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ -- -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` -- -- ;; -- esac -- cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" -- ;; -- esac -- ;; -- *) -- cf_new_cflags="$cf_new_cflags $cf_add_cflags" -- ;; -- esac - ;; --yes) -- cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -+esac - -- cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` -+echo "$as_me:4660: checking for ncurses version" >&5 -+echo $ECHO_N "checking for ncurses version... $ECHO_C" >&6 -+if test "${cf_cv_ncurses_version+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else - -- test "${cf_add_cflags}" != "${cf_tst_cflags}" \ -- && test -z "${cf_tst_cflags}" \ -- && cf_fix_cppflags=no -- ;; --esac --done -+ cf_cv_ncurses_version=no -+ cf_tempfile=out$$ -+ rm -f $cf_tempfile -+ if test "$cross_compiling" = yes; then - --if test -n "$cf_new_cflags" ; then -+ # This will not work if the preprocessor splits the line after the -+ # Autoconf token. The 'unproto' program does that. -+ cat > conftest.$ac_ext <<EOF -+#include <${cf_cv_ncurses_header:-curses.h}> -+#undef Autoconf -+#ifdef NCURSES_VERSION -+Autoconf NCURSES_VERSION -+#else -+#ifdef __NCURSES_H -+Autoconf "old" -+#endif -+; -+#endif -+EOF -+ cf_try="$ac_cpp conftest.$ac_ext 2>&5 | grep '^Autoconf ' >conftest.out" -+ { (eval echo "$as_me:4686: \"$cf_try\"") >&5 -+ (eval $cf_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:4689: \$? = $ac_status" >&5 -+ (exit $ac_status); } -+ if test -f conftest.out ; then -+ cf_out=`cat conftest.out | sed -e 's%^Autoconf %%' -e 's%^[^"]*"%%' -e 's%".*%%'` -+ test -n "$cf_out" && cf_cv_ncurses_version="$cf_out" -+ rm -f conftest.out -+ fi - -- CFLAGS="$CFLAGS $cf_new_cflags" --fi -+else -+ cat >conftest.$ac_ext <<_ACEOF -+#line 4699 "configure" -+#include "confdefs.h" - --if test -n "$cf_new_cppflags" ; then -+#include <${cf_cv_ncurses_header:-curses.h}> -+#include <stdio.h> -+int main() -+{ -+ FILE *fp = fopen("$cf_tempfile", "w"); -+#ifdef NCURSES_VERSION -+# ifdef NCURSES_VERSION_PATCH -+ fprintf(fp, "%s.%d\n", NCURSES_VERSION, NCURSES_VERSION_PATCH); -+# else -+ fprintf(fp, "%s\n", NCURSES_VERSION); -+# endif -+#else -+# ifdef __NCURSES_H -+ fprintf(fp, "old\n"); -+# else -+ make an error -+# endif -+#endif -+ ${cf_cv_main_return:-return}(0); -+} -+_ACEOF -+rm -f conftest$ac_exeext -+if { (eval echo "$as_me:4724: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>&5 -+ ac_status=$? -+ echo "$as_me:4727: \$? = $ac_status" >&5 -+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext' -+ { (eval echo "$as_me:4729: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:4732: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then - -- CPPFLAGS="$CPPFLAGS $cf_new_cppflags" -+ cf_cv_ncurses_version=`cat $cf_tempfile` -+else -+ echo "$as_me: program exited with status $ac_status" >&5 -+echo "$as_me: failed program was:" >&5 -+cat conftest.$ac_ext >&5 - fi -+rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -+fi -+ rm -f $cf_tempfile - --if test -n "$cf_new_extra_cppflags" ; then -- -- EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" - fi -+echo "$as_me:4746: result: $cf_cv_ncurses_version" >&5 -+echo "${ECHO_T}$cf_cv_ncurses_version" >&6 -+test "$cf_cv_ncurses_version" = no || -+cat >>confdefs.h <<\EOF -+#define NCURSES 1 -+EOF - -- ;; -- esac -- ;; --esac -+echo "$as_me:4753: checking if we have identified curses libraries" >&5 -+echo $ECHO_N "checking if we have identified curses libraries... $ECHO_C" >&6 -+cat >conftest.$ac_ext <<_ACEOF -+#line 4756 "configure" -+#include "confdefs.h" -+#include <${cf_cv_ncurses_header:-curses.h}> -+int -+main () -+{ -+initscr(); tgoto("?", 0,0) -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext conftest$ac_exeext -+if { (eval echo "$as_me:4768: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>&5 -+ ac_status=$? -+ echo "$as_me:4771: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -s conftest$ac_exeext' -+ { (eval echo "$as_me:4774: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:4777: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ cf_result=yes -+else -+ echo "$as_me: failed program was:" >&5 -+cat conftest.$ac_ext >&5 -+cf_result=no -+fi -+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -+echo "$as_me:4786: result: $cf_result" >&5 -+echo "${ECHO_T}$cf_result" >&6 - --if test "$with_dbmalloc" = yes ; then -- echo "$as_me:4380: checking for dbmalloc.h" >&5 --echo $ECHO_N "checking for dbmalloc.h... $ECHO_C" >&6 --if test "${ac_cv_header_dbmalloc_h+set}" = set; then -+if test "$cf_result" = no ; then -+case $host_os in #(vi -+freebsd*) #(vi -+ echo "$as_me:4792: checking for tgoto in -lmytinfo" >&5 -+echo $ECHO_N "checking for tgoto in -lmytinfo... $ECHO_C" >&6 -+if test "${ac_cv_lib_mytinfo_tgoto+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else -- cat >conftest.$ac_ext <<_ACEOF --#line 4386 "configure" -+ ac_check_lib_save_LIBS=$LIBS -+LIBS="-lmytinfo $LIBS" -+cat >conftest.$ac_ext <<_ACEOF -+#line 4800 "configure" - #include "confdefs.h" --#include <dbmalloc.h> -+ -+/* Override any gcc2 internal prototype to avoid an error. */ -+#ifdef __cplusplus -+extern "C" -+#endif -+/* We use char because int might match the return type of a gcc2 -+ builtin and then its argument prototype would still apply. */ -+char tgoto (); -+int -+main () -+{ -+tgoto (); -+ ; -+ return 0; -+} - _ACEOF --if { (eval echo "$as_me:4390: \"$ac_cpp conftest.$ac_ext\"") >&5 -- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 -+rm -f conftest.$ac_objext conftest$ac_exeext -+if { (eval echo "$as_me:4819: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>&5 - ac_status=$? -- egrep -v '^ *\+' conftest.er1 >conftest.err -- rm -f conftest.er1 -- cat conftest.err >&5 -- echo "$as_me:4396: \$? = $ac_status" >&5 -- (exit $ac_status); } >/dev/null; then -- if test -s conftest.err; then -- ac_cpp_err=$ac_c_preproc_warn_flag -- else -- ac_cpp_err= -- fi --else -- ac_cpp_err=yes --fi --if test -z "$ac_cpp_err"; then -- ac_cv_header_dbmalloc_h=yes -+ echo "$as_me:4822: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -s conftest$ac_exeext' -+ { (eval echo "$as_me:4825: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:4828: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ ac_cv_lib_mytinfo_tgoto=yes - else - echo "$as_me: failed program was:" >&5 -- cat conftest.$ac_ext >&5 -- ac_cv_header_dbmalloc_h=no -+cat conftest.$ac_ext >&5 -+ac_cv_lib_mytinfo_tgoto=no - fi --rm -f conftest.err conftest.$ac_ext -+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -+LIBS=$ac_check_lib_save_LIBS -+fi -+echo "$as_me:4839: result: $ac_cv_lib_mytinfo_tgoto" >&5 -+echo "${ECHO_T}$ac_cv_lib_mytinfo_tgoto" >&6 -+if test $ac_cv_lib_mytinfo_tgoto = yes; then -+ LIBS="-lmytinfo $LIBS" - fi --echo "$as_me:4415: result: $ac_cv_header_dbmalloc_h" >&5 --echo "${ECHO_T}$ac_cv_header_dbmalloc_h" >&6 --if test $ac_cv_header_dbmalloc_h = yes; then - --echo "$as_me:4419: checking for debug_malloc in -ldbmalloc" >&5 --echo $ECHO_N "checking for debug_malloc in -ldbmalloc... $ECHO_C" >&6 --if test "${ac_cv_lib_dbmalloc_debug_malloc+set}" = set; then -+ ;; -+hpux10.*) #(vi -+ # Looking at HPUX 10.20, the Hcurses library is the oldest (1997), cur_colr -+ # next (1998), and xcurses "newer" (2000). There is no header file for -+ # Hcurses; the subdirectory curses_colr has the headers (curses.h and -+ # term.h) for cur_colr -+ if test "x$cf_cv_screen" = "xcurses_colr" -+ then -+ echo "$as_me:4853: checking for initscr in -lcur_colr" >&5 -+echo $ECHO_N "checking for initscr in -lcur_colr... $ECHO_C" >&6 -+if test "${ac_cv_lib_cur_colr_initscr+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - ac_check_lib_save_LIBS=$LIBS --LIBS="-ldbmalloc $LIBS" -+LIBS="-lcur_colr $LIBS" - cat >conftest.$ac_ext <<_ACEOF --#line 4427 "configure" -+#line 4861 "configure" - #include "confdefs.h" - - /* Override any gcc2 internal prototype to avoid an error. */ -@@ -4433,313 +4867,115 @@ - #endif - /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ --char debug_malloc (); -+char initscr (); - int - main () - { --debug_malloc (); -+initscr (); - ; - return 0; - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:4446: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:4880: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:4449: \$? = $ac_status" >&5 -+ echo "$as_me:4883: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:4452: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:4886: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:4455: \$? = $ac_status" >&5 -+ echo "$as_me:4889: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- ac_cv_lib_dbmalloc_debug_malloc=yes -+ ac_cv_lib_cur_colr_initscr=yes - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --ac_cv_lib_dbmalloc_debug_malloc=no -+ac_cv_lib_cur_colr_initscr=no - fi - rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - LIBS=$ac_check_lib_save_LIBS - fi --echo "$as_me:4466: result: $ac_cv_lib_dbmalloc_debug_malloc" >&5 --echo "${ECHO_T}$ac_cv_lib_dbmalloc_debug_malloc" >&6 --if test $ac_cv_lib_dbmalloc_debug_malloc = yes; then -- cat >>confdefs.h <<EOF --#define HAVE_LIBDBMALLOC 1 --EOF -+echo "$as_me:4900: result: $ac_cv_lib_cur_colr_initscr" >&5 -+echo "${ECHO_T}$ac_cv_lib_cur_colr_initscr" >&6 -+if test $ac_cv_lib_cur_colr_initscr = yes; then - -- LIBS="-ldbmalloc $LIBS" -+ LIBS="-lcur_colr $LIBS" -+ ac_cv_func_initscr=yes - --fi -+else - --fi -+ echo "$as_me:4909: checking for initscr in -lHcurses" >&5 -+echo $ECHO_N "checking for initscr in -lHcurses... $ECHO_C" >&6 -+if test "${ac_cv_lib_Hcurses_initscr+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ ac_check_lib_save_LIBS=$LIBS -+LIBS="-lHcurses $LIBS" -+cat >conftest.$ac_ext <<_ACEOF -+#line 4917 "configure" -+#include "confdefs.h" - --fi -- --echo "$as_me:4481: checking if you want to use valgrind for testing" >&5 --echo $ECHO_N "checking if you want to use valgrind for testing... $ECHO_C" >&6 -- --# Check whether --with-valgrind or --without-valgrind was given. --if test "${with_valgrind+set}" = set; then -- withval="$with_valgrind" -- cat >>confdefs.h <<\EOF --#define USE_VALGRIND 1 --EOF -- -- : ${with_cflags:=-g} -- : ${with_no_leaks:=yes} -- with_valgrind=yes --else -- with_valgrind= --fi; --echo "$as_me:4497: result: ${with_valgrind:-no}" >&5 --echo "${ECHO_T}${with_valgrind:-no}" >&6 -- --case .$with_cflags in #(vi --.*-g*) -- case .$CFLAGS in #(vi -- .*-g*) #(vi -- ;; -- *) -- --cf_fix_cppflags=no --cf_new_cflags= --cf_new_cppflags= --cf_new_extra_cppflags= -- --for cf_add_cflags in -g --do --case $cf_fix_cppflags in --no) -- case $cf_add_cflags in #(vi -- -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi -- case $cf_add_cflags in -- -D*) -- cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` -- -- test "${cf_add_cflags}" != "${cf_tst_cflags}" \ -- && test -z "${cf_tst_cflags}" \ -- && cf_fix_cppflags=yes -- -- if test $cf_fix_cppflags = yes ; then -- cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -- continue -- elif test "${cf_tst_cflags}" = "\"'" ; then -- cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -- continue -- fi -- ;; -- esac -- case "$CPPFLAGS" in -- *$cf_add_cflags) #(vi -- ;; -- *) #(vi -- case $cf_add_cflags in #(vi -- -D*) -- cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` -- --CPPFLAGS=`echo "$CPPFLAGS" | \ -- sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ -- -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` -- -- ;; -- esac -- cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" -- ;; -- esac -- ;; -- *) -- cf_new_cflags="$cf_new_cflags $cf_add_cflags" -- ;; -- esac -- ;; --yes) -- cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -- -- cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` -- -- test "${cf_add_cflags}" != "${cf_tst_cflags}" \ -- && test -z "${cf_tst_cflags}" \ -- && cf_fix_cppflags=no -- ;; --esac --done -- --if test -n "$cf_new_cflags" ; then -- -- CFLAGS="$CFLAGS $cf_new_cflags" --fi -- --if test -n "$cf_new_cppflags" ; then -- -- CPPFLAGS="$CPPFLAGS $cf_new_cppflags" --fi -- --if test -n "$cf_new_extra_cppflags" ; then -- -- EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" --fi -- -- ;; -- esac -- ;; --esac -- --echo "$as_me:4590: checking if you want to perform memory-leak testing" >&5 --echo $ECHO_N "checking if you want to perform memory-leak testing... $ECHO_C" >&6 -- --# Check whether --enable-leaks or --disable-leaks was given. --if test "${enable_leaks+set}" = set; then -- enableval="$enable_leaks" -- if test "x$enableval" = xno; then with_no_leaks=yes; else with_no_leaks=no; fi --else -- : ${with_no_leaks:=no} --fi; --echo "$as_me:4600: result: $with_no_leaks" >&5 --echo "${ECHO_T}$with_no_leaks" >&6 -- --if test "$with_no_leaks" = yes ; then -- cat >>confdefs.h <<\EOF --#define NO_LEAKS 1 --EOF -- -- cat >>confdefs.h <<\EOF --#define YY_NO_LEAKS 1 --EOF -- --fi -- --echo "$as_me:4614: checking for specific curses-directory" >&5 --echo $ECHO_N "checking for specific curses-directory... $ECHO_C" >&6 -- --# Check whether --with-curses-dir or --without-curses-dir was given. --if test "${with_curses_dir+set}" = set; then -- withval="$with_curses_dir" -- cf_cv_curses_dir=$withval --else -- cf_cv_curses_dir=no --fi; --echo "$as_me:4624: result: $cf_cv_curses_dir" >&5 --echo "${ECHO_T}$cf_cv_curses_dir" >&6 -- --if ( test -n "$cf_cv_curses_dir" && test "$cf_cv_curses_dir" != "no" ) --then -- --if test "x$prefix" != xNONE; then -- cf_path_syntax="$prefix" --else -- cf_path_syntax="$ac_default_prefix" --fi -- --case ".$withval" in #(vi --.\$\(*\)*|.\'*\'*) #(vi -- ;; --..|./*|.\\*) #(vi -- ;; --.[a-zA-Z]:[\\/]*) #(vi OS/2 EMX -- ;; --.\${*prefix}*) #(vi -- eval withval="$withval" -- case ".$withval" in #(vi -- .NONE/*) -- withval=`echo $withval | sed -e s%NONE%$cf_path_syntax%` -- ;; -- esac -- ;; #(vi --.no|.NONE/*) -- withval=`echo $withval | sed -e s%NONE%$cf_path_syntax%` -- ;; --*) -- { { echo "$as_me:4655: error: expected a pathname, not \"$withval\"" >&5 --echo "$as_me: error: expected a pathname, not \"$withval\"" >&2;} -- { (exit 1); exit 1; }; } -- ;; --esac -- -- if test -d "$cf_cv_curses_dir" -- then -- --if test -n "$cf_cv_curses_dir/include" ; then -- for cf_add_incdir in $cf_cv_curses_dir/include -- do -- while test $cf_add_incdir != /usr/include -- do -- if test -d $cf_add_incdir -- then -- cf_have_incdir=no -- if test -n "$CFLAGS$CPPFLAGS" ; then -- # a loop is needed to ensure we can add subdirs of existing dirs -- for cf_test_incdir in $CFLAGS $CPPFLAGS ; do -- if test ".$cf_test_incdir" = ".-I$cf_add_incdir" ; then -- cf_have_incdir=yes; break -- fi -- done -- fi -- -- if test "$cf_have_incdir" = no ; then -- if test "$cf_add_incdir" = /usr/local/include ; then -- if test "$GCC" = yes -- then -- cf_save_CPPFLAGS=$CPPFLAGS -- CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" -- cat >conftest.$ac_ext <<_ACEOF --#line 4688 "configure" --#include "confdefs.h" --#include <stdio.h> -+/* Override any gcc2 internal prototype to avoid an error. */ -+#ifdef __cplusplus -+extern "C" -+#endif -+/* We use char because int might match the return type of a gcc2 -+ builtin and then its argument prototype would still apply. */ -+char initscr (); - int - main () - { --printf("Hello") -+initscr (); - ; - return 0; - } - _ACEOF --rm -f conftest.$ac_objext --if { (eval echo "$as_me:4700: \"$ac_compile\"") >&5 -- (eval $ac_compile) 2>&5 -+rm -f conftest.$ac_objext conftest$ac_exeext -+if { (eval echo "$as_me:4936: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:4703: \$? = $ac_status" >&5 -+ echo "$as_me:4939: \$? = $ac_status" >&5 - (exit $ac_status); } && -- { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:4706: \"$ac_try\"") >&5 -+ { ac_try='test -s conftest$ac_exeext' -+ { (eval echo "$as_me:4942: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:4709: \$? = $ac_status" >&5 -+ echo "$as_me:4945: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- : -+ ac_cv_lib_Hcurses_initscr=yes - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --cf_have_incdir=yes -+ac_cv_lib_Hcurses_initscr=no - fi --rm -f conftest.$ac_objext conftest.$ac_ext -- CPPFLAGS=$cf_save_CPPFLAGS -- fi -- fi -- fi -- -- if test "$cf_have_incdir" = no ; then -- test -n "$verbose" && echo " adding $cf_add_incdir to include-path" 1>&6 -+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -+LIBS=$ac_check_lib_save_LIBS -+fi -+echo "$as_me:4956: result: $ac_cv_lib_Hcurses_initscr" >&5 -+echo "${ECHO_T}$ac_cv_lib_Hcurses_initscr" >&6 -+if test $ac_cv_lib_Hcurses_initscr = yes; then - --echo "${as_me:-configure}:4726: testing adding $cf_add_incdir to include-path ..." 1>&5 -+ # HP's header uses __HP_CURSES, but user claims _HP_CURSES. -+ LIBS="-lHcurses $LIBS" -+ CPPFLAGS="$CPPFLAGS -D__HP_CURSES -D_HP_CURSES" -+ ac_cv_func_initscr=yes - -- CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" -+fi - -- cf_top_incdir=`echo $cf_add_incdir | sed -e 's%/include/.*$%/include%'` -- test "$cf_top_incdir" = "$cf_add_incdir" && break -- cf_add_incdir="$cf_top_incdir" -- else -- break -- fi -- fi -- done -- done - fi - --if test -n "$cf_cv_curses_dir/lib" ; then -- for cf_add_libdir in $cf_cv_curses_dir/lib -+ fi -+ ;; -+linux*) -+ case `arch 2>/dev/null` in -+ x86_64) -+ if test -d /lib64 -+ then -+ -+if test -n "/lib64" ; then -+ for cf_add_libdir in /lib64 - do - if test $cf_add_libdir = /usr/lib ; then - : -@@ -4757,7 +4993,7 @@ - if test "$cf_have_libdir" = no ; then - test -n "$verbose" && echo " adding $cf_add_libdir to library-path" 1>&6 - --echo "${as_me:-configure}:4760: testing adding $cf_add_libdir to library-path ..." 1>&5 -+echo "${as_me:-configure}:4996: testing adding $cf_add_libdir to library-path ..." 1>&5 - - LDFLAGS="-L$cf_add_libdir $LDFLAGS" - fi -@@ -4765,370 +5001,339 @@ - done - fi - -- fi --fi -+ else - --# Check whether --with-5lib or --without-5lib was given. --if test "${with_5lib+set}" = set; then -- withval="$with_5lib" -- LIBS="-L/usr/5lib $LIBS" -- CPPFLAGS="$CPPFLAGS -I/usr/5include" --fi; -+if test -n "/lib" ; then -+ for cf_add_libdir in /lib -+ do -+ if test $cf_add_libdir = /usr/lib ; then -+ : -+ elif test -d $cf_add_libdir -+ then -+ cf_have_libdir=no -+ if test -n "$LDFLAGS$LIBS" ; then -+ # a loop is needed to ensure we can add subdirs of existing dirs -+ for cf_test_libdir in $LDFLAGS $LIBS ; do -+ if test ".$cf_test_libdir" = ".-L$cf_add_libdir" ; then -+ cf_have_libdir=yes; break -+ fi -+ done -+ fi -+ if test "$cf_have_libdir" = no ; then -+ test -n "$verbose" && echo " adding $cf_add_libdir to library-path" 1>&6 - --# Check whether --with-ncursesw or --without-ncursesw was given. --if test "${with_ncursesw+set}" = set; then -- withval="$with_ncursesw" -- cf_cv_screen=ncursesw --else -+echo "${as_me:-configure}:5025: testing adding $cf_add_libdir to library-path ..." 1>&5 - --# Check whether --with-ncurses or --without-ncurses was given. --if test "${with_ncurses+set}" = set; then -- withval="$with_ncurses" -- cf_cv_screen=ncurses --else -+ LDFLAGS="-L$cf_add_libdir $LDFLAGS" -+ fi -+ fi -+ done -+fi - --# Check whether --with-pdcurses or --without-pdcurses was given. --if test "${with_pdcurses+set}" = set; then -- withval="$with_pdcurses" -- cf_cv_screen=pdcurses --fi; --fi; --fi; -+ fi -+ ;; -+ *) - --case $cf_cv_screen in --curses) -+if test -n "/lib" ; then -+ for cf_add_libdir in /lib -+ do -+ if test $cf_add_libdir = /usr/lib ; then -+ : -+ elif test -d $cf_add_libdir -+ then -+ cf_have_libdir=no -+ if test -n "$LDFLAGS$LIBS" ; then -+ # a loop is needed to ensure we can add subdirs of existing dirs -+ for cf_test_libdir in $LDFLAGS $LIBS ; do -+ if test ".$cf_test_libdir" = ".-L$cf_add_libdir" ; then -+ cf_have_libdir=yes; break -+ fi -+ done -+ fi -+ if test "$cf_have_libdir" = no ; then -+ test -n "$verbose" && echo " adding $cf_add_libdir to library-path" 1>&6 - --echo "$as_me:4801: checking for extra include directories" >&5 --echo $ECHO_N "checking for extra include directories... $ECHO_C" >&6 --if test "${cf_cv_curses_incdir+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 --else -+echo "${as_me:-configure}:5056: testing adding $cf_add_libdir to library-path ..." 1>&5 - --cf_cv_curses_incdir=no --case $host_os in #(vi --hpux10.*) #(vi -- test -d /usr/include/curses_colr && \ -- cf_cv_curses_incdir="-I/usr/include/curses_colr" -+ LDFLAGS="-L$cf_add_libdir $LDFLAGS" -+ fi -+ fi -+ done -+fi -+ -+ ;; -+ esac - ;; - sunos3*|sunos4*) -- test -d /usr/5lib && \ -- test -d /usr/5include && \ -- cf_cv_curses_incdir="-I/usr/5include" -- ;; --esac -+ if test "x$cf_cv_screen" = "xcurses_5lib" -+ then -+ if test -d /usr/5lib ; then -+ -+if test -n "/usr/5lib" ; then -+ for cf_add_libdir in /usr/5lib -+ do -+ if test $cf_add_libdir = /usr/lib ; then -+ : -+ elif test -d $cf_add_libdir -+ then -+ cf_have_libdir=no -+ if test -n "$LDFLAGS$LIBS" ; then -+ # a loop is needed to ensure we can add subdirs of existing dirs -+ for cf_test_libdir in $LDFLAGS $LIBS ; do -+ if test ".$cf_test_libdir" = ".-L$cf_add_libdir" ; then -+ cf_have_libdir=yes; break -+ fi -+ done -+ fi -+ if test "$cf_have_libdir" = no ; then -+ test -n "$verbose" && echo " adding $cf_add_libdir to library-path" 1>&6 -+ -+echo "${as_me:-configure}:5091: testing adding $cf_add_libdir to library-path ..." 1>&5 - -+ LDFLAGS="-L$cf_add_libdir $LDFLAGS" -+ fi -+ fi -+ done - fi --echo "$as_me:4821: result: $cf_cv_curses_incdir" >&5 --echo "${ECHO_T}$cf_cv_curses_incdir" >&6 --test "$cf_cv_curses_incdir" != no && CPPFLAGS="$CPPFLAGS $cf_cv_curses_incdir" - --echo "$as_me:4825: checking if we have identified curses headers" >&5 --echo $ECHO_N "checking if we have identified curses headers... $ECHO_C" >&6 --if test "${cf_cv_ncurses_header+set}" = set; then -+ LIBS="-lcurses -ltermcap $LIBS" -+ fi -+ fi -+ ac_cv_func_initscr=yes -+ ;; -+esac -+ -+if test ".$ac_cv_func_initscr" != .yes ; then -+ cf_save_LIBS="$LIBS" -+ -+ if test ".${cf_cv_ncurses_version:-no}" != .no -+ then -+ cf_check_list="ncurses curses cursesX" -+ else -+ cf_check_list="cursesX curses ncurses" -+ fi -+ -+ # Check for library containing tgoto. Do this before curses library -+ # because it may be needed to link the test-case for initscr. -+ if test "x$cf_term_lib" = x -+ then -+ echo "$as_me:5120: checking for tgoto" >&5 -+echo $ECHO_N "checking for tgoto... $ECHO_C" >&6 -+if test "${ac_cv_func_tgoto+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else -- --cf_cv_ncurses_header=none --for cf_header in \ -- curses.h \ -- ncurses.h ncurses/curses.h ncurses/ncurses.h --do --cat >conftest.$ac_ext <<_ACEOF --#line 4837 "configure" -+ cat >conftest.$ac_ext <<_ACEOF -+#line 5126 "configure" - #include "confdefs.h" --#include <${cf_header}> -+/* System header to define __stub macros and hopefully few prototypes, -+ which can conflict with char tgoto (); below. */ -+#include <assert.h> -+/* Override any gcc2 internal prototype to avoid an error. */ -+#ifdef __cplusplus -+extern "C" -+#endif -+/* We use char because int might match the return type of a gcc2 -+ builtin and then its argument prototype would still apply. */ -+char tgoto (); -+char (*f) (); -+ - int - main () - { --initscr(); tgoto("?", 0,0) -+/* The GNU C library defines this for functions which it implements -+ to always fail with ENOSYS. Some functions are actually named -+ something starting with __ and the normal name is an alias. */ -+#if defined (__stub_tgoto) || defined (__stub___tgoto) -+choke me -+#else -+f = tgoto; /* workaround for ICC 12.0.3 */ if (f == 0) return 1; -+#endif -+ - ; - return 0; - } - _ACEOF --rm -f conftest.$ac_objext --if { (eval echo "$as_me:4849: \"$ac_compile\"") >&5 -- (eval $ac_compile) 2>&5 -+rm -f conftest.$ac_objext conftest$ac_exeext -+if { (eval echo "$as_me:5157: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:4852: \$? = $ac_status" >&5 -+ echo "$as_me:5160: \$? = $ac_status" >&5 - (exit $ac_status); } && -- { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:4855: \"$ac_try\"") >&5 -+ { ac_try='test -s conftest$ac_exeext' -+ { (eval echo "$as_me:5163: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:4858: \$? = $ac_status" >&5 -+ echo "$as_me:5166: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- cf_cv_ncurses_header=$cf_header; break -+ ac_cv_func_tgoto=yes - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 -+ac_cv_func_tgoto=no - fi --rm -f conftest.$ac_objext conftest.$ac_ext --done -- --fi --echo "$as_me:4869: result: $cf_cv_ncurses_header" >&5 --echo "${ECHO_T}$cf_cv_ncurses_header" >&6 -- --if test "$cf_cv_ncurses_header" = none ; then -- { { echo "$as_me:4873: error: No curses header-files found" >&5 --echo "$as_me: error: No curses header-files found" >&2;} -- { (exit 1); exit 1; }; } --fi -- --# cheat, to get the right #define's for HAVE_NCURSES_H, etc. -- --for ac_header in $cf_cv_ncurses_header --do --as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` --echo "$as_me:4883: checking for $ac_header" >&5 --echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 --if eval "test \"\${$as_ac_Header+set}\" = set"; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 --else -- cat >conftest.$ac_ext <<_ACEOF --#line 4889 "configure" --#include "confdefs.h" --#include <$ac_header> --_ACEOF --if { (eval echo "$as_me:4893: \"$ac_cpp conftest.$ac_ext\"") >&5 -- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 -- ac_status=$? -- egrep -v '^ *\+' conftest.er1 >conftest.err -- rm -f conftest.er1 -- cat conftest.err >&5 -- echo "$as_me:4899: \$? = $ac_status" >&5 -- (exit $ac_status); } >/dev/null; then -- if test -s conftest.err; then -- ac_cpp_err=$ac_c_preproc_warn_flag -- else -- ac_cpp_err= -- fi --else -- ac_cpp_err=yes -+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - fi --if test -z "$ac_cpp_err"; then -- eval "$as_ac_Header=yes" -+echo "$as_me:5176: result: $ac_cv_func_tgoto" >&5 -+echo "${ECHO_T}$ac_cv_func_tgoto" >&6 -+if test $ac_cv_func_tgoto = yes; then -+ cf_term_lib=predefined - else -- echo "$as_me: failed program was:" >&5 -- cat conftest.$ac_ext >&5 -- eval "$as_ac_Header=no" --fi --rm -f conftest.err conftest.$ac_ext --fi --echo "$as_me:4918: result: `eval echo '${'$as_ac_Header'}'`" >&5 --echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 --if test `eval echo '${'$as_ac_Header'}'` = yes; then -- cat >>confdefs.h <<EOF --#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 --EOF -- --fi --done - --echo "$as_me:4928: checking for terminfo header" >&5 --echo $ECHO_N "checking for terminfo header... $ECHO_C" >&6 --if test "${cf_cv_term_header+set}" = set; then -+ for cf_term_lib in $cf_check_list otermcap termcap tinfo termlib unknown -+ do -+ as_ac_Lib=`echo "ac_cv_lib_$cf_term_lib''_tgoto" | $as_tr_sh` -+echo "$as_me:5185: checking for tgoto in -l$cf_term_lib" >&5 -+echo $ECHO_N "checking for tgoto in -l$cf_term_lib... $ECHO_C" >&6 -+if eval "test \"\${$as_ac_Lib+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else -- --case ${cf_cv_ncurses_header} in #(vi --*/ncurses.h|*/ncursesw.h) #(vi -- cf_term_header=`echo "$cf_cv_ncurses_header" | sed -e 's%ncurses[^.]*\.h$%term.h%'` -- ;; --*) -- cf_term_header=term.h -- ;; --esac -- --for cf_test in $cf_term_header "ncurses/term.h" "ncursesw/term.h" --do -+ ac_check_lib_save_LIBS=$LIBS -+LIBS="-l$cf_term_lib $LIBS" - cat >conftest.$ac_ext <<_ACEOF --#line 4946 "configure" -+#line 5193 "configure" - #include "confdefs.h" --#include <stdio.h> --#include <${cf_cv_ncurses_header:-curses.h}> --#include <$cf_test> - -+/* Override any gcc2 internal prototype to avoid an error. */ -+#ifdef __cplusplus -+extern "C" -+#endif -+/* We use char because int might match the return type of a gcc2 -+ builtin and then its argument prototype would still apply. */ -+char tgoto (); - int - main () - { --int x = auto_left_margin -+tgoto (); - ; - return 0; - } - _ACEOF --rm -f conftest.$ac_objext --if { (eval echo "$as_me:4961: \"$ac_compile\"") >&5 -- (eval $ac_compile) 2>&5 -- ac_status=$? -- echo "$as_me:4964: \$? = $ac_status" >&5 -+rm -f conftest.$ac_objext conftest$ac_exeext -+if { (eval echo "$as_me:5212: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>&5 -+ ac_status=$? -+ echo "$as_me:5215: \$? = $ac_status" >&5 - (exit $ac_status); } && -- { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:4967: \"$ac_try\"") >&5 -+ { ac_try='test -s conftest$ac_exeext' -+ { (eval echo "$as_me:5218: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:4970: \$? = $ac_status" >&5 -+ echo "$as_me:5221: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- -- cf_cv_term_header="$cf_test" -+ eval "$as_ac_Lib=yes" - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 -- -- cf_cv_term_header=unknown -- -+eval "$as_ac_Lib=no" - fi --rm -f conftest.$ac_objext conftest.$ac_ext -- test "$cf_cv_term_header" != unknown && break --done -- -+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -+LIBS=$ac_check_lib_save_LIBS -+fi -+echo "$as_me:5232: result: `eval echo '${'$as_ac_Lib'}'`" >&5 -+echo "${ECHO_T}`eval echo '${'$as_ac_Lib'}'`" >&6 -+if test `eval echo '${'$as_ac_Lib'}'` = yes; then -+ break - fi --echo "$as_me:4986: result: $cf_cv_term_header" >&5 --echo "${ECHO_T}$cf_cv_term_header" >&6 -- --# Set definitions to allow ifdef'ing to accommodate subdirectories -- --case $cf_cv_term_header in # (vi --*term.h) -- cat >>confdefs.h <<\EOF --#define HAVE_TERM_H 1 --EOF -- -- ;; --esac -- --case $cf_cv_term_header in # (vi --ncurses/term.h) #(vi -- cat >>confdefs.h <<\EOF --#define HAVE_NCURSES_TERM_H 1 --EOF -- -- ;; --ncursesw/term.h) -- cat >>confdefs.h <<\EOF --#define HAVE_NCURSESW_TERM_H 1 --EOF -- -- ;; --esac - --echo "$as_me:5015: checking for ncurses version" >&5 --echo $ECHO_N "checking for ncurses version... $ECHO_C" >&6 --if test "${cf_cv_ncurses_version+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 --else -+ done - -- cf_cv_ncurses_version=no -- cf_tempfile=out$$ -- rm -f $cf_tempfile -- if test "$cross_compiling" = yes; then -+fi - -- # This will not work if the preprocessor splits the line after the -- # Autoconf token. The 'unproto' program does that. -- cat > conftest.$ac_ext <<EOF --#include <${cf_cv_ncurses_header:-curses.h}> --#undef Autoconf --#ifdef NCURSES_VERSION --Autoconf NCURSES_VERSION --#else --#ifdef __NCURSES_H --Autoconf "old" --#endif --; --#endif --EOF -- cf_try="$ac_cpp conftest.$ac_ext 2>&5 | grep '^Autoconf ' >conftest.out" -- { (eval echo "$as_me:5041: \"$cf_try\"") >&5 -- (eval $cf_try) 2>&5 -- ac_status=$? -- echo "$as_me:5044: \$? = $ac_status" >&5 -- (exit $ac_status); } -- if test -f conftest.out ; then -- cf_out=`cat conftest.out | sed -e 's%^Autoconf %%' -e 's%^[^"]*"%%' -e 's%".*%%'` -- test -n "$cf_out" && cf_cv_ncurses_version="$cf_out" -- rm -f conftest.out - fi - -+ # Check for library containing initscr -+ test "$cf_term_lib" != predefined && test "$cf_term_lib" != unknown && LIBS="-l$cf_term_lib $cf_save_LIBS" -+ if test "x$cf_curs_lib" = x -+ then -+ for cf_curs_lib in $cf_check_list xcurses jcurses pdcurses unknown -+ do -+ as_ac_Lib=`echo "ac_cv_lib_$cf_curs_lib''_initscr" | $as_tr_sh` -+echo "$as_me:5251: checking for initscr in -l$cf_curs_lib" >&5 -+echo $ECHO_N "checking for initscr in -l$cf_curs_lib... $ECHO_C" >&6 -+if eval "test \"\${$as_ac_Lib+set}\" = set"; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 - else -- cat >conftest.$ac_ext <<_ACEOF --#line 5054 "configure" -+ ac_check_lib_save_LIBS=$LIBS -+LIBS="-l$cf_curs_lib $LIBS" -+cat >conftest.$ac_ext <<_ACEOF -+#line 5259 "configure" - #include "confdefs.h" - --#include <${cf_cv_ncurses_header:-curses.h}> --#include <stdio.h> --int main() --{ -- FILE *fp = fopen("$cf_tempfile", "w"); --#ifdef NCURSES_VERSION --# ifdef NCURSES_VERSION_PATCH -- fprintf(fp, "%s.%d\n", NCURSES_VERSION, NCURSES_VERSION_PATCH); --# else -- fprintf(fp, "%s\n", NCURSES_VERSION); --# endif --#else --# ifdef __NCURSES_H -- fprintf(fp, "old\n"); --# else -- make an error --# endif -+/* Override any gcc2 internal prototype to avoid an error. */ -+#ifdef __cplusplus -+extern "C" - #endif -- ${cf_cv_main_return:-return}(0); -+/* We use char because int might match the return type of a gcc2 -+ builtin and then its argument prototype would still apply. */ -+char initscr (); -+int -+main () -+{ -+initscr (); -+ ; -+ return 0; - } - _ACEOF --rm -f conftest$ac_exeext --if { (eval echo "$as_me:5079: \"$ac_link\"") >&5 -+rm -f conftest.$ac_objext conftest$ac_exeext -+if { (eval echo "$as_me:5278: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:5082: \$? = $ac_status" >&5 -- (exit $ac_status); } && { ac_try='./conftest$ac_exeext' -- { (eval echo "$as_me:5084: \"$ac_try\"") >&5 -+ echo "$as_me:5281: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -s conftest$ac_exeext' -+ { (eval echo "$as_me:5284: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:5087: \$? = $ac_status" >&5 -+ echo "$as_me:5287: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- -- cf_cv_ncurses_version=`cat $cf_tempfile` -+ eval "$as_ac_Lib=yes" - else -- echo "$as_me: program exited with status $ac_status" >&5 --echo "$as_me: failed program was:" >&5 -+ echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 -+eval "$as_ac_Lib=no" - fi --rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -+LIBS=$ac_check_lib_save_LIBS - fi -- rm -f $cf_tempfile -- -+echo "$as_me:5298: result: `eval echo '${'$as_ac_Lib'}'`" >&5 -+echo "${ECHO_T}`eval echo '${'$as_ac_Lib'}'`" >&6 -+if test `eval echo '${'$as_ac_Lib'}'` = yes; then -+ break - fi --echo "$as_me:5101: result: $cf_cv_ncurses_version" >&5 --echo "${ECHO_T}$cf_cv_ncurses_version" >&6 --test "$cf_cv_ncurses_version" = no || cat >>confdefs.h <<\EOF --#define NCURSES 1 --EOF - --echo "$as_me:5107: checking if we have identified curses libraries" >&5 --echo $ECHO_N "checking if we have identified curses libraries... $ECHO_C" >&6 --cat >conftest.$ac_ext <<_ACEOF --#line 5110 "configure" -+ done -+ fi -+ test $cf_curs_lib = unknown && { { echo "$as_me:5306: error: no curses library found" >&5 -+echo "$as_me: error: no curses library found" >&2;} -+ { (exit 1); exit 1; }; } -+ -+ LIBS="-l$cf_curs_lib $cf_save_LIBS" -+ if test "$cf_term_lib" = unknown ; then -+ echo "$as_me:5312: checking if we can link with $cf_curs_lib library" >&5 -+echo $ECHO_N "checking if we can link with $cf_curs_lib library... $ECHO_C" >&6 -+ cat >conftest.$ac_ext <<_ACEOF -+#line 5315 "configure" - #include "confdefs.h" - #include <${cf_cv_ncurses_header:-curses.h}> - int - main () - { --initscr(); tgoto("?", 0,0) -+initscr() - ; - return 0; - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:5122: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:5327: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:5125: \$? = $ac_status" >&5 -+ echo "$as_me:5330: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:5128: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:5333: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:5131: \$? = $ac_status" >&5 -+ echo "$as_me:5336: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_result=yes - else -@@ -5137,919 +5342,720 @@ - cf_result=no - fi - rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext --echo "$as_me:5140: result: $cf_result" >&5 -+ echo "$as_me:5345: result: $cf_result" >&5 - echo "${ECHO_T}$cf_result" >&6 -- --if test "$cf_result" = no ; then --case $host_os in #(vi --freebsd*) #(vi -- echo "$as_me:5146: checking for tgoto in -lmytinfo" >&5 --echo $ECHO_N "checking for tgoto in -lmytinfo... $ECHO_C" >&6 --if test "${ac_cv_lib_mytinfo_tgoto+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 --else -- ac_check_lib_save_LIBS=$LIBS --LIBS="-lmytinfo $LIBS" --cat >conftest.$ac_ext <<_ACEOF --#line 5154 "configure" -+ test $cf_result = no && { { echo "$as_me:5347: error: Cannot link curses library" >&5 -+echo "$as_me: error: Cannot link curses library" >&2;} -+ { (exit 1); exit 1; }; } -+ elif test "$cf_curs_lib" = "$cf_term_lib" ; then -+ : -+ elif test "$cf_term_lib" != predefined ; then -+ echo "$as_me:5353: checking if we need both $cf_curs_lib and $cf_term_lib libraries" >&5 -+echo $ECHO_N "checking if we need both $cf_curs_lib and $cf_term_lib libraries... $ECHO_C" >&6 -+ cat >conftest.$ac_ext <<_ACEOF -+#line 5356 "configure" - #include "confdefs.h" -- --/* Override any gcc2 internal prototype to avoid an error. */ --#ifdef __cplusplus --extern "C" --#endif --/* We use char because int might match the return type of a gcc2 -- builtin and then its argument prototype would still apply. */ --char tgoto (); -+#include <${cf_cv_ncurses_header:-curses.h}> - int - main () - { --tgoto (); -+initscr(); tgoto((char *)0, 0, 0); - ; - return 0; - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:5173: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:5368: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:5176: \$? = $ac_status" >&5 -+ echo "$as_me:5371: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:5179: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:5374: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:5182: \$? = $ac_status" >&5 -+ echo "$as_me:5377: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- ac_cv_lib_mytinfo_tgoto=yes -+ cf_result=no - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --ac_cv_lib_mytinfo_tgoto=no --fi --rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext --LIBS=$ac_check_lib_save_LIBS --fi --echo "$as_me:5193: result: $ac_cv_lib_mytinfo_tgoto" >&5 --echo "${ECHO_T}$ac_cv_lib_mytinfo_tgoto" >&6 --if test $ac_cv_lib_mytinfo_tgoto = yes; then -- LIBS="-lmytinfo $LIBS" --fi - -- ;; --hpux10.*) #(vi -- echo "$as_me:5201: checking for initscr in -lcur_colr" >&5 --echo $ECHO_N "checking for initscr in -lcur_colr... $ECHO_C" >&6 --if test "${ac_cv_lib_cur_colr_initscr+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 --else -- ac_check_lib_save_LIBS=$LIBS --LIBS="-lcur_colr $LIBS" --cat >conftest.$ac_ext <<_ACEOF --#line 5209 "configure" -+ LIBS="-l$cf_curs_lib -l$cf_term_lib $cf_save_LIBS" -+ cat >conftest.$ac_ext <<_ACEOF -+#line 5386 "configure" - #include "confdefs.h" -- --/* Override any gcc2 internal prototype to avoid an error. */ --#ifdef __cplusplus --extern "C" --#endif --/* We use char because int might match the return type of a gcc2 -- builtin and then its argument prototype would still apply. */ --char initscr (); -+#include <${cf_cv_ncurses_header:-curses.h}> - int - main () - { --initscr (); -+initscr() - ; - return 0; - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:5228: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:5398: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:5231: \$? = $ac_status" >&5 -+ echo "$as_me:5401: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:5234: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:5404: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:5237: \$? = $ac_status" >&5 -+ echo "$as_me:5407: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- ac_cv_lib_cur_colr_initscr=yes -+ cf_result=yes - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --ac_cv_lib_cur_colr_initscr=no -+cf_result=error - fi - rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext --LIBS=$ac_check_lib_save_LIBS -+ -+fi -+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -+ echo "$as_me:5419: result: $cf_result" >&5 -+echo "${ECHO_T}$cf_result" >&6 -+ fi -+fi - fi --echo "$as_me:5248: result: $ac_cv_lib_cur_colr_initscr" >&5 --echo "${ECHO_T}$ac_cv_lib_cur_colr_initscr" >&6 --if test $ac_cv_lib_cur_colr_initscr = yes; then - -- LIBS="-lcur_colr $LIBS" -- ac_cv_func_initscr=yes -+ ;; -+ncurses) #(vi - --else -+cf_ncuconfig_root=ncurses - -- echo "$as_me:5257: checking for initscr in -lHcurses" >&5 --echo $ECHO_N "checking for initscr in -lHcurses... $ECHO_C" >&6 --if test "${ac_cv_lib_Hcurses_initscr+set}" = set; then -+echo "Looking for ${cf_ncuconfig_root}-config" -+ -+if test -n "$ac_tool_prefix"; then -+ for ac_prog in ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config -+ do -+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -+set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -+echo "$as_me:5437: checking for $ac_word" >&5 -+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -+if test "${ac_cv_prog_NCURSES_CONFIG+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else -- ac_check_lib_save_LIBS=$LIBS --LIBS="-lHcurses $LIBS" --cat >conftest.$ac_ext <<_ACEOF --#line 5265 "configure" --#include "confdefs.h" -+ if test -n "$NCURSES_CONFIG"; then -+ ac_cv_prog_NCURSES_CONFIG="$NCURSES_CONFIG" # Let the user override the test. -+else -+ ac_save_IFS=$IFS; IFS=$ac_path_separator -+ac_dummy="$PATH" -+for ac_dir in $ac_dummy; do -+ IFS=$ac_save_IFS -+ test -z "$ac_dir" && ac_dir=. -+ $as_executable_p "$ac_dir/$ac_word" || continue -+ac_cv_prog_NCURSES_CONFIG="$ac_tool_prefix$ac_prog" -+echo "$as_me:5452: found $ac_dir/$ac_word" >&5 -+break -+done - --/* Override any gcc2 internal prototype to avoid an error. */ --#ifdef __cplusplus --extern "C" --#endif --/* We use char because int might match the return type of a gcc2 -- builtin and then its argument prototype would still apply. */ --char initscr (); --int --main () --{ --initscr (); -- ; -- return 0; --} --_ACEOF --rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:5284: \"$ac_link\"") >&5 -- (eval $ac_link) 2>&5 -- ac_status=$? -- echo "$as_me:5287: \$? = $ac_status" >&5 -- (exit $ac_status); } && -- { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:5290: \"$ac_try\"") >&5 -- (eval $ac_try) 2>&5 -- ac_status=$? -- echo "$as_me:5293: \$? = $ac_status" >&5 -- (exit $ac_status); }; }; then -- ac_cv_lib_Hcurses_initscr=yes --else -- echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 --ac_cv_lib_Hcurses_initscr=no - fi --rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext --LIBS=$ac_check_lib_save_LIBS --fi --echo "$as_me:5304: result: $ac_cv_lib_Hcurses_initscr" >&5 --echo "${ECHO_T}$ac_cv_lib_Hcurses_initscr" >&6 --if test $ac_cv_lib_Hcurses_initscr = yes; then -- -- # HP's header uses __HP_CURSES, but user claims _HP_CURSES. -- LIBS="-lHcurses $LIBS" -- CPPFLAGS="$CPPFLAGS -D__HP_CURSES -D_HP_CURSES" -- ac_cv_func_initscr=yes -- - fi -- -+NCURSES_CONFIG=$ac_cv_prog_NCURSES_CONFIG -+if test -n "$NCURSES_CONFIG"; then -+ echo "$as_me:5460: result: $NCURSES_CONFIG" >&5 -+echo "${ECHO_T}$NCURSES_CONFIG" >&6 -+else -+ echo "$as_me:5463: result: no" >&5 -+echo "${ECHO_T}no" >&6 - fi - -- ;; --linux*) -- case `arch 2>/dev/null` in -- x86_64) -- if test -d /lib64 -- then -- --if test -n "/lib64" ; then -- for cf_add_libdir in /lib64 -- do -- if test $cf_add_libdir = /usr/lib ; then -- : -- elif test -d $cf_add_libdir -- then -- cf_have_libdir=no -- if test -n "$LDFLAGS$LIBS" ; then -- # a loop is needed to ensure we can add subdirs of existing dirs -- for cf_test_libdir in $LDFLAGS $LIBS ; do -- if test ".$cf_test_libdir" = ".-L$cf_add_libdir" ; then -- cf_have_libdir=yes; break -- fi -- done -- fi -- if test "$cf_have_libdir" = no ; then -- test -n "$verbose" && echo " adding $cf_add_libdir to library-path" 1>&6 -- --echo "${as_me:-configure}:5343: testing adding $cf_add_libdir to library-path ..." 1>&5 -- -- LDFLAGS="-L$cf_add_libdir $LDFLAGS" -- fi -- fi -+ test -n "$NCURSES_CONFIG" && break - done - fi -+if test -z "$NCURSES_CONFIG"; then -+ ac_ct_NCURSES_CONFIG=$NCURSES_CONFIG -+ for ac_prog in ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config -+do -+ # Extract the first word of "$ac_prog", so it can be a program name with args. -+set dummy $ac_prog; ac_word=$2 -+echo "$as_me:5476: checking for $ac_word" >&5 -+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -+if test "${ac_cv_prog_ac_ct_NCURSES_CONFIG+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ if test -n "$ac_ct_NCURSES_CONFIG"; then -+ ac_cv_prog_ac_ct_NCURSES_CONFIG="$ac_ct_NCURSES_CONFIG" # Let the user override the test. -+else -+ ac_save_IFS=$IFS; IFS=$ac_path_separator -+ac_dummy="$PATH" -+for ac_dir in $ac_dummy; do -+ IFS=$ac_save_IFS -+ test -z "$ac_dir" && ac_dir=. -+ $as_executable_p "$ac_dir/$ac_word" || continue -+ac_cv_prog_ac_ct_NCURSES_CONFIG="$ac_prog" -+echo "$as_me:5491: found $ac_dir/$ac_word" >&5 -+break -+done - -- else -- --if test -n "/lib" ; then -- for cf_add_libdir in /lib -- do -- if test $cf_add_libdir = /usr/lib ; then -- : -- elif test -d $cf_add_libdir -- then -- cf_have_libdir=no -- if test -n "$LDFLAGS$LIBS" ; then -- # a loop is needed to ensure we can add subdirs of existing dirs -- for cf_test_libdir in $LDFLAGS $LIBS ; do -- if test ".$cf_test_libdir" = ".-L$cf_add_libdir" ; then -- cf_have_libdir=yes; break -- fi -- done -- fi -- if test "$cf_have_libdir" = no ; then -- test -n "$verbose" && echo " adding $cf_add_libdir to library-path" 1>&6 -- --echo "${as_me:-configure}:5372: testing adding $cf_add_libdir to library-path ..." 1>&5 -- -- LDFLAGS="-L$cf_add_libdir $LDFLAGS" -- fi -- fi -- done - fi -- -- fi -- ;; -- *) -- --if test -n "/lib" ; then -- for cf_add_libdir in /lib -- do -- if test $cf_add_libdir = /usr/lib ; then -- : -- elif test -d $cf_add_libdir -- then -- cf_have_libdir=no -- if test -n "$LDFLAGS$LIBS" ; then -- # a loop is needed to ensure we can add subdirs of existing dirs -- for cf_test_libdir in $LDFLAGS $LIBS ; do -- if test ".$cf_test_libdir" = ".-L$cf_add_libdir" ; then -- cf_have_libdir=yes; break -- fi -- done -- fi -- if test "$cf_have_libdir" = no ; then -- test -n "$verbose" && echo " adding $cf_add_libdir to library-path" 1>&6 -- --echo "${as_me:-configure}:5403: testing adding $cf_add_libdir to library-path ..." 1>&5 -- -- LDFLAGS="-L$cf_add_libdir $LDFLAGS" -- fi -- fi -- done -+fi -+ac_ct_NCURSES_CONFIG=$ac_cv_prog_ac_ct_NCURSES_CONFIG -+if test -n "$ac_ct_NCURSES_CONFIG"; then -+ echo "$as_me:5499: result: $ac_ct_NCURSES_CONFIG" >&5 -+echo "${ECHO_T}$ac_ct_NCURSES_CONFIG" >&6 -+else -+ echo "$as_me:5502: result: no" >&5 -+echo "${ECHO_T}no" >&6 - fi - -- ;; -- esac -- ;; --sunos3*|sunos4*) -- if test -d /usr/5lib ; then -- --if test -n "/usr/5lib" ; then -- for cf_add_libdir in /usr/5lib -- do -- if test $cf_add_libdir = /usr/lib ; then -- : -- elif test -d $cf_add_libdir -- then -- cf_have_libdir=no -- if test -n "$LDFLAGS$LIBS" ; then -- # a loop is needed to ensure we can add subdirs of existing dirs -- for cf_test_libdir in $LDFLAGS $LIBS ; do -- if test ".$cf_test_libdir" = ".-L$cf_add_libdir" ; then -- cf_have_libdir=yes; break -- fi -- done -- fi -- if test "$cf_have_libdir" = no ; then -- test -n "$verbose" && echo " adding $cf_add_libdir to library-path" 1>&6 -- --echo "${as_me:-configure}:5436: testing adding $cf_add_libdir to library-path ..." 1>&5 -+ test -n "$ac_ct_NCURSES_CONFIG" && break -+done -+test -n "$ac_ct_NCURSES_CONFIG" || ac_ct_NCURSES_CONFIG="none" - -- LDFLAGS="-L$cf_add_libdir $LDFLAGS" -- fi -- fi -- done -+ NCURSES_CONFIG=$ac_ct_NCURSES_CONFIG - fi - -- LIBS="-lcurses -ltermcap $LIBS" -- fi -- ac_cv_func_initscr=yes -- ;; --esac -+if test "$NCURSES_CONFIG" != none ; then - --if test ".$ac_cv_func_initscr" != .yes ; then -- cf_save_LIBS="$LIBS" -- cf_term_lib="" -- cf_curs_lib="" -+CPPFLAGS="$CPPFLAGS `$NCURSES_CONFIG --cflags`" -+LIBS="`$NCURSES_CONFIG --libs` $LIBS" - -- if test ".${cf_cv_ncurses_version:-no}" != .no -- then -- cf_check_list="ncurses curses cursesX" -- else -- cf_check_list="cursesX curses ncurses" -- fi -+# even with config script, some packages use no-override for curses.h - -- # Check for library containing tgoto. Do this before curses library -- # because it may be needed to link the test-case for initscr. -- echo "$as_me:5464: checking for tgoto" >&5 --echo $ECHO_N "checking for tgoto... $ECHO_C" >&6 --if test "${ac_cv_func_tgoto+set}" = set; then -+echo "$as_me:5520: checking if we have identified curses headers" >&5 -+echo $ECHO_N "checking if we have identified curses headers... $ECHO_C" >&6 -+if test "${cf_cv_ncurses_header+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else -- cat >conftest.$ac_ext <<_ACEOF --#line 5470 "configure" --#include "confdefs.h" --/* System header to define __stub macros and hopefully few prototypes, -- which can conflict with char tgoto (); below. */ --#include <assert.h> --/* Override any gcc2 internal prototype to avoid an error. */ --#ifdef __cplusplus --extern "C" --#endif --/* We use char because int might match the return type of a gcc2 -- builtin and then its argument prototype would still apply. */ --char tgoto (); --char (*f) (); - -+cf_cv_ncurses_header=none -+for cf_header in \ -+ ncurses/ncurses.h \ -+ ncurses/curses.h \ -+ ncurses.h \ -+ curses.h -+do -+cat >conftest.$ac_ext <<_ACEOF -+#line 5534 "configure" -+#include "confdefs.h" -+#include <${cf_header}> - int - main () - { --/* The GNU C library defines this for functions which it implements -- to always fail with ENOSYS. Some functions are actually named -- something starting with __ and the normal name is an alias. */ --#if defined (__stub_tgoto) || defined (__stub___tgoto) --choke me --#else --f = tgoto; --#endif -- -+initscr(); tgoto("?", 0,0) - ; - return 0; - } - _ACEOF --rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:5501: \"$ac_link\"") >&5 -- (eval $ac_link) 2>&5 -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:5546: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:5504: \$? = $ac_status" >&5 -+ echo "$as_me:5549: \$? = $ac_status" >&5 - (exit $ac_status); } && -- { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:5507: \"$ac_try\"") >&5 -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:5552: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:5510: \$? = $ac_status" >&5 -+ echo "$as_me:5555: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- ac_cv_func_tgoto=yes -+ cf_cv_ncurses_header=$cf_header; break - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --ac_cv_func_tgoto=no - fi --rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -+rm -f conftest.$ac_objext conftest.$ac_ext -+done -+ - fi --echo "$as_me:5520: result: $ac_cv_func_tgoto" >&5 --echo "${ECHO_T}$ac_cv_func_tgoto" >&6 --if test $ac_cv_func_tgoto = yes; then -- cf_term_lib=predefined --else -+echo "$as_me:5566: result: $cf_cv_ncurses_header" >&5 -+echo "${ECHO_T}$cf_cv_ncurses_header" >&6 - -- for cf_term_lib in $cf_check_list termcap termlib unknown -- do -- as_ac_Lib=`echo "ac_cv_lib_$cf_term_lib''_tgoto" | $as_tr_sh` --echo "$as_me:5529: checking for tgoto in -l$cf_term_lib" >&5 --echo $ECHO_N "checking for tgoto in -l$cf_term_lib... $ECHO_C" >&6 --if eval "test \"\${$as_ac_Lib+set}\" = set"; then -+if test "$cf_cv_ncurses_header" = none ; then -+ { { echo "$as_me:5570: error: No curses header-files found" >&5 -+echo "$as_me: error: No curses header-files found" >&2;} -+ { (exit 1); exit 1; }; } -+fi -+ -+# cheat, to get the right #define's for HAVE_NCURSES_H, etc. -+ -+for ac_header in $cf_cv_ncurses_header -+do -+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -+echo "$as_me:5580: checking for $ac_header" >&5 -+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -+if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else -- ac_check_lib_save_LIBS=$LIBS --LIBS="-l$cf_term_lib $LIBS" --cat >conftest.$ac_ext <<_ACEOF --#line 5537 "configure" -+ cat >conftest.$ac_ext <<_ACEOF -+#line 5586 "configure" - #include "confdefs.h" -- --/* Override any gcc2 internal prototype to avoid an error. */ --#ifdef __cplusplus --extern "C" --#endif --/* We use char because int might match the return type of a gcc2 -- builtin and then its argument prototype would still apply. */ --char tgoto (); --int --main () --{ --tgoto (); -- ; -- return 0; --} -+#include <$ac_header> - _ACEOF --rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:5556: \"$ac_link\"") >&5 -- (eval $ac_link) 2>&5 -- ac_status=$? -- echo "$as_me:5559: \$? = $ac_status" >&5 -- (exit $ac_status); } && -- { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:5562: \"$ac_try\"") >&5 -- (eval $ac_try) 2>&5 -+if { (eval echo "$as_me:5590: \"$ac_cpp conftest.$ac_ext\"") >&5 -+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? -- echo "$as_me:5565: \$? = $ac_status" >&5 -- (exit $ac_status); }; }; then -- eval "$as_ac_Lib=yes" -+ egrep -v '^ *\+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 -+ echo "$as_me:5596: \$? = $ac_status" >&5 -+ (exit $ac_status); } >/dev/null; then -+ if test -s conftest.err; then -+ ac_cpp_err=$ac_c_preproc_warn_flag -+ else -+ ac_cpp_err= -+ fi -+else -+ ac_cpp_err=yes -+fi -+if test -z "$ac_cpp_err"; then -+ eval "$as_ac_Header=yes" - else - echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 --eval "$as_ac_Lib=no" -+ cat conftest.$ac_ext >&5 -+ eval "$as_ac_Header=no" - fi --rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext --LIBS=$ac_check_lib_save_LIBS -+rm -f conftest.err conftest.$ac_ext - fi --echo "$as_me:5576: result: `eval echo '${'$as_ac_Lib'}'`" >&5 --echo "${ECHO_T}`eval echo '${'$as_ac_Lib'}'`" >&6 --if test `eval echo '${'$as_ac_Lib'}'` = yes; then -- break -+echo "$as_me:5615: result: `eval echo '${'$as_ac_Header'}'`" >&5 -+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -+if test `eval echo '${'$as_ac_Header'}'` = yes; then -+ cat >>confdefs.h <<EOF -+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -+EOF -+ - fi -+done - -- done -+cat >>confdefs.h <<\EOF -+#define NCURSES 1 -+EOF - --fi -+cf_nculib_ROOT=`echo "HAVE_LIB$cf_ncuconfig_root" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` - -- # Check for library containing initscr -- test "$cf_term_lib" != predefined && test "$cf_term_lib" != unknown && LIBS="-l$cf_term_lib $cf_save_LIBS" -- for cf_curs_lib in $cf_check_list xcurses jcurses pdcurses unknown -- do -- as_ac_Lib=`echo "ac_cv_lib_$cf_curs_lib''_initscr" | $as_tr_sh` --echo "$as_me:5591: checking for initscr in -l$cf_curs_lib" >&5 --echo $ECHO_N "checking for initscr in -l$cf_curs_lib... $ECHO_C" >&6 --if eval "test \"\${$as_ac_Lib+set}\" = set"; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 --else -- ac_check_lib_save_LIBS=$LIBS --LIBS="-l$cf_curs_lib $LIBS" --cat >conftest.$ac_ext <<_ACEOF --#line 5599 "configure" --#include "confdefs.h" -+cat >>confdefs.h <<EOF -+#define $cf_nculib_ROOT 1 -+EOF -+ -+cf_cv_ncurses_version=`$NCURSES_CONFIG --version` - --/* Override any gcc2 internal prototype to avoid an error. */ --#ifdef __cplusplus --extern "C" --#endif --/* We use char because int might match the return type of a gcc2 -- builtin and then its argument prototype would still apply. */ --char initscr (); --int --main () --{ --initscr (); -- ; -- return 0; --} --_ACEOF --rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:5618: \"$ac_link\"") >&5 -- (eval $ac_link) 2>&5 -- ac_status=$? -- echo "$as_me:5621: \$? = $ac_status" >&5 -- (exit $ac_status); } && -- { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:5624: \"$ac_try\"") >&5 -- (eval $ac_try) 2>&5 -- ac_status=$? -- echo "$as_me:5627: \$? = $ac_status" >&5 -- (exit $ac_status); }; }; then -- eval "$as_ac_Lib=yes" - else -- echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 --eval "$as_ac_Lib=no" --fi --rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext --LIBS=$ac_check_lib_save_LIBS --fi --echo "$as_me:5638: result: `eval echo '${'$as_ac_Lib'}'`" >&5 --echo "${ECHO_T}`eval echo '${'$as_ac_Lib'}'`" >&6 --if test `eval echo '${'$as_ac_Lib'}'` = yes; then -- break --fi - -- done -- test $cf_curs_lib = unknown && { { echo "$as_me:5645: error: no curses library found" >&5 --echo "$as_me: error: no curses library found" >&2;} -- { (exit 1); exit 1; }; } -+cf_ncuhdr_root=ncurses - -- LIBS="-l$cf_curs_lib $cf_save_LIBS" -- if test "$cf_term_lib" = unknown ; then -- echo "$as_me:5651: checking if we can link with $cf_curs_lib library" >&5 --echo $ECHO_N "checking if we can link with $cf_curs_lib library... $ECHO_C" >&6 -- cat >conftest.$ac_ext <<_ACEOF --#line 5654 "configure" -+test -n "$cf_cv_curses_dir" && \ -+test "$cf_cv_curses_dir" != "no" && { \ -+ -+if test -n "$cf_cv_curses_dir/include/$cf_ncuhdr_root" ; then -+ for cf_add_incdir in $cf_cv_curses_dir/include/$cf_ncuhdr_root -+ do -+ while test $cf_add_incdir != /usr/include -+ do -+ if test -d $cf_add_incdir -+ then -+ cf_have_incdir=no -+ if test -n "$CFLAGS$CPPFLAGS" ; then -+ # a loop is needed to ensure we can add subdirs of existing dirs -+ for cf_test_incdir in $CFLAGS $CPPFLAGS ; do -+ if test ".$cf_test_incdir" = ".-I$cf_add_incdir" ; then -+ cf_have_incdir=yes; break -+ fi -+ done -+ fi -+ -+ if test "$cf_have_incdir" = no ; then -+ if test "$cf_add_incdir" = /usr/local/include ; then -+ if test "$GCC" = yes -+ then -+ cf_save_CPPFLAGS=$CPPFLAGS -+ CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" -+ cat >conftest.$ac_ext <<_ACEOF -+#line 5668 "configure" - #include "confdefs.h" --#include <${cf_cv_ncurses_header:-curses.h}> -+#include <stdio.h> - int - main () - { --initscr() -+printf("Hello") - ; - return 0; - } - _ACEOF --rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:5666: \"$ac_link\"") >&5 -- (eval $ac_link) 2>&5 -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:5680: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:5669: \$? = $ac_status" >&5 -+ echo "$as_me:5683: \$? = $ac_status" >&5 - (exit $ac_status); } && -- { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:5672: \"$ac_try\"") >&5 -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:5686: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:5675: \$? = $ac_status" >&5 -+ echo "$as_me:5689: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- cf_result=yes -+ : - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --cf_result=no -+cf_have_incdir=yes - fi --rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -- echo "$as_me:5684: result: $cf_result" >&5 --echo "${ECHO_T}$cf_result" >&6 -- test $cf_result = no && { { echo "$as_me:5686: error: Cannot link curses library" >&5 --echo "$as_me: error: Cannot link curses library" >&2;} -- { (exit 1); exit 1; }; } -- elif test "$cf_curs_lib" = "$cf_term_lib" ; then -- : -- elif test "$cf_term_lib" != predefined ; then -- echo "$as_me:5692: checking if we need both $cf_curs_lib and $cf_term_lib libraries" >&5 --echo $ECHO_N "checking if we need both $cf_curs_lib and $cf_term_lib libraries... $ECHO_C" >&6 -- cat >conftest.$ac_ext <<_ACEOF --#line 5695 "configure" --#include "confdefs.h" --#include <${cf_cv_ncurses_header:-curses.h}> --int --main () --{ --initscr(); tgoto((char *)0, 0, 0); -- ; -- return 0; -+rm -f conftest.$ac_objext conftest.$ac_ext -+ CPPFLAGS=$cf_save_CPPFLAGS -+ fi -+ fi -+ fi -+ -+ if test "$cf_have_incdir" = no ; then -+ test -n "$verbose" && echo " adding $cf_add_incdir to include-path" 1>&6 -+ -+echo "${as_me:-configure}:5706: testing adding $cf_add_incdir to include-path ..." 1>&5 -+ -+ CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" -+ -+ cf_top_incdir=`echo $cf_add_incdir | sed -e 's%/include/.*$%/include%'` -+ test "$cf_top_incdir" = "$cf_add_incdir" && break -+ cf_add_incdir="$cf_top_incdir" -+ else -+ break -+ fi -+ fi -+ done -+ done -+fi -+ - } --_ACEOF --rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:5707: \"$ac_link\"") >&5 -- (eval $ac_link) 2>&5 -- ac_status=$? -- echo "$as_me:5710: \$? = $ac_status" >&5 -- (exit $ac_status); } && -- { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:5713: \"$ac_try\"") >&5 -- (eval $ac_try) 2>&5 -- ac_status=$? -- echo "$as_me:5716: \$? = $ac_status" >&5 -- (exit $ac_status); }; }; then -- cf_result=no -+ -+echo "$as_me:5723: checking for $cf_ncuhdr_root header in include-path" >&5 -+echo $ECHO_N "checking for $cf_ncuhdr_root header in include-path... $ECHO_C" >&6 -+if test "${cf_cv_ncurses_h+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 - else -- echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 - -- LIBS="-l$cf_curs_lib -l$cf_term_lib $cf_save_LIBS" -- cat >conftest.$ac_ext <<_ACEOF --#line 5725 "configure" -+ cf_header_list="$cf_ncuhdr_root/curses.h $cf_ncuhdr_root/ncurses.h" -+ ( test "$cf_ncuhdr_root" = ncurses || test "$cf_ncuhdr_root" = ncursesw ) && cf_header_list="$cf_header_list curses.h ncurses.h" -+ for cf_header in $cf_header_list -+ do -+ -+ cat >conftest.$ac_ext <<_ACEOF -+#line 5735 "configure" - #include "confdefs.h" --#include <${cf_cv_ncurses_header:-curses.h}> -+ -+#include <$cf_header> - int - main () - { --initscr() -+ -+#ifdef NCURSES_VERSION -+ -+printf("%s\n", NCURSES_VERSION); -+#else -+#ifdef __NCURSES_H -+printf("old\n"); -+#else -+ make an error -+#endif -+#endif -+ - ; - return 0; - } - _ACEOF --rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:5737: \"$ac_link\"") >&5 -- (eval $ac_link) 2>&5 -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:5759: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:5740: \$? = $ac_status" >&5 -+ echo "$as_me:5762: \$? = $ac_status" >&5 - (exit $ac_status); } && -- { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:5743: \"$ac_try\"") >&5 -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:5765: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:5746: \$? = $ac_status" >&5 -+ echo "$as_me:5768: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- cf_result=yes -+ cf_cv_ncurses_h=$cf_header -+ - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --cf_result=error -+cf_cv_ncurses_h=no - fi --rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -+rm -f conftest.$ac_objext conftest.$ac_ext -+ -+ test "$cf_cv_ncurses_h" != no && break -+ done - - fi --rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -- echo "$as_me:5758: result: $cf_result" >&5 --echo "${ECHO_T}$cf_result" >&6 -- fi --fi --fi -+echo "$as_me:5783: result: $cf_cv_ncurses_h" >&5 -+echo "${ECHO_T}$cf_cv_ncurses_h" >&6 - --echo "$as_me:5764: checking for NetBSD form.h" >&5 --echo $ECHO_N "checking for NetBSD form.h... $ECHO_C" >&6 --if test "${cf_cv_netbsd_form_h+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 -+if test "$cf_cv_ncurses_h" != no ; then -+ cf_cv_ncurses_header=$cf_cv_ncurses_h - else - --cat >conftest.$ac_ext <<_ACEOF --#line 5771 "configure" --#include "confdefs.h" -+echo "$as_me:5790: checking for $cf_ncuhdr_root include-path" >&5 -+echo $ECHO_N "checking for $cf_ncuhdr_root include-path... $ECHO_C" >&6 -+if test "${cf_cv_ncurses_h2+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else - --#include <${cf_cv_ncurses_header:-curses.h}> --#include <form.h> -+ test -n "$verbose" && echo - --int --main () --{ -+cf_search= - -- FORM *form; -- int y = current_field(form)->cursor_ypos; -- int x = current_field(form)->cursor_xpos; -+# collect the current set of include-directories from compiler flags -+cf_header_path_list="" -+if test -n "${CFLAGS}${CPPFLAGS}" ; then -+ for cf_header_path in $CPPFLAGS $CFLAGS -+ do -+ case $cf_header_path in #(vi -+ -I*) -+ cf_header_path=`echo ".$cf_header_path" |sed -e 's/^...//' -e 's,/include$,,'` - -- ; -- return 0; -+test "x$cf_header_path" != "xNONE" && \ -+test -d "$cf_header_path" && \ -+ { -+ test -n "$verbose" && echo " ... testing for include-directories under $cf_header_path" -+ test -d $cf_header_path/include && cf_search="$cf_search $cf_header_path/include" -+ test -d $cf_header_path/include/$cf_ncuhdr_root && cf_search="$cf_search $cf_header_path/include/$cf_ncuhdr_root" -+ test -d $cf_header_path/include/$cf_ncuhdr_root/include && cf_search="$cf_search $cf_header_path/include/$cf_ncuhdr_root/include" -+ test -d $cf_header_path/$cf_ncuhdr_root/include && cf_search="$cf_search $cf_header_path/$cf_ncuhdr_root/include" -+ test -d $cf_header_path/$cf_ncuhdr_root/include/$cf_ncuhdr_root && cf_search="$cf_search $cf_header_path/$cf_ncuhdr_root/include/$cf_ncuhdr_root" - } --_ACEOF --rm -f conftest.$ac_objext --if { (eval echo "$as_me:5790: \"$ac_compile\"") >&5 -- (eval $ac_compile) 2>&5 -- ac_status=$? -- echo "$as_me:5793: \$? = $ac_status" >&5 -- (exit $ac_status); } && -- { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:5796: \"$ac_try\"") >&5 -- (eval $ac_try) 2>&5 -- ac_status=$? -- echo "$as_me:5799: \$? = $ac_status" >&5 -- (exit $ac_status); }; }; then -- cf_cv_netbsd_form_h=yes - --else -- echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 --cf_cv_netbsd_form_h=no -+ cf_header_path_list="$cf_header_path_list $cf_search" -+ ;; -+ esac -+ done - fi --rm -f conftest.$ac_objext conftest.$ac_ext - --fi --echo "$as_me:5811: result: $cf_cv_netbsd_form_h" >&5 --echo "${ECHO_T}$cf_cv_netbsd_form_h" >&6 -+# add the variations for the package we are looking for - --test "$cf_cv_netbsd_form_h" = yes && cat >>confdefs.h <<\EOF --#define HAVE_NETBSD_FORM_H 1 --EOF -+cf_search= - --echo "$as_me:5818: checking for NetBSD menu.h" >&5 --echo $ECHO_N "checking for NetBSD menu.h... $ECHO_C" >&6 --if test "${cf_cv_netbsd_menu_h+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 --else -+test "x/usr" != "x$prefix" && \ -+test -d "/usr" && \ -+(test -z "$prefix" || test x$prefix = xNONE || test "x/usr" != "x$prefix") && { -+ test -n "$verbose" && echo " ... testing for include-directories under /usr" -+ test -d /usr/include && cf_search="$cf_search /usr/include" -+ test -d /usr/include/$cf_ncuhdr_root && cf_search="$cf_search /usr/include/$cf_ncuhdr_root" -+ test -d /usr/include/$cf_ncuhdr_root/include && cf_search="$cf_search /usr/include/$cf_ncuhdr_root/include" -+ test -d /usr/$cf_ncuhdr_root/include && cf_search="$cf_search /usr/$cf_ncuhdr_root/include" -+ test -d /usr/$cf_ncuhdr_root/include/$cf_ncuhdr_root && cf_search="$cf_search /usr/$cf_ncuhdr_root/include/$cf_ncuhdr_root" -+} - --cat >conftest.$ac_ext <<_ACEOF --#line 5825 "configure" --#include "confdefs.h" -+test "x$prefix" != "xNONE" && \ -+test -d "$prefix" && \ -+ { -+ test -n "$verbose" && echo " ... testing for include-directories under $prefix" -+ test -d $prefix/include && cf_search="$cf_search $prefix/include" -+ test -d $prefix/include/$cf_ncuhdr_root && cf_search="$cf_search $prefix/include/$cf_ncuhdr_root" -+ test -d $prefix/include/$cf_ncuhdr_root/include && cf_search="$cf_search $prefix/include/$cf_ncuhdr_root/include" -+ test -d $prefix/$cf_ncuhdr_root/include && cf_search="$cf_search $prefix/$cf_ncuhdr_root/include" -+ test -d $prefix/$cf_ncuhdr_root/include/$cf_ncuhdr_root && cf_search="$cf_search $prefix/$cf_ncuhdr_root/include/$cf_ncuhdr_root" -+} - --#include <${cf_cv_ncurses_header:-curses.h}> --#include <menu.h> -+test "x/usr/local" != "x$prefix" && \ -+test -d "/usr/local" && \ -+(test -z "$prefix" || test x$prefix = xNONE || test "x/usr/local" != "x$prefix") && { -+ test -n "$verbose" && echo " ... testing for include-directories under /usr/local" -+ test -d /usr/local/include && cf_search="$cf_search /usr/local/include" -+ test -d /usr/local/include/$cf_ncuhdr_root && cf_search="$cf_search /usr/local/include/$cf_ncuhdr_root" -+ test -d /usr/local/include/$cf_ncuhdr_root/include && cf_search="$cf_search /usr/local/include/$cf_ncuhdr_root/include" -+ test -d /usr/local/$cf_ncuhdr_root/include && cf_search="$cf_search /usr/local/$cf_ncuhdr_root/include" -+ test -d /usr/local/$cf_ncuhdr_root/include/$cf_ncuhdr_root && cf_search="$cf_search /usr/local/$cf_ncuhdr_root/include/$cf_ncuhdr_root" -+} -+ -+test "x/opt" != "x$prefix" && \ -+test -d "/opt" && \ -+(test -z "$prefix" || test x$prefix = xNONE || test "x/opt" != "x$prefix") && { -+ test -n "$verbose" && echo " ... testing for include-directories under /opt" -+ test -d /opt/include && cf_search="$cf_search /opt/include" -+ test -d /opt/include/$cf_ncuhdr_root && cf_search="$cf_search /opt/include/$cf_ncuhdr_root" -+ test -d /opt/include/$cf_ncuhdr_root/include && cf_search="$cf_search /opt/include/$cf_ncuhdr_root/include" -+ test -d /opt/$cf_ncuhdr_root/include && cf_search="$cf_search /opt/$cf_ncuhdr_root/include" -+ test -d /opt/$cf_ncuhdr_root/include/$cf_ncuhdr_root && cf_search="$cf_search /opt/$cf_ncuhdr_root/include/$cf_ncuhdr_root" -+} -+ -+test "x$HOME" != "x$prefix" && \ -+test -d "$HOME" && \ -+(test -z "$prefix" || test x$prefix = xNONE || test "x$HOME" != "x$prefix") && { -+ test -n "$verbose" && echo " ... testing for include-directories under $HOME" -+ test -d $HOME/include && cf_search="$cf_search $HOME/include" -+ test -d $HOME/include/$cf_ncuhdr_root && cf_search="$cf_search $HOME/include/$cf_ncuhdr_root" -+ test -d $HOME/include/$cf_ncuhdr_root/include && cf_search="$cf_search $HOME/include/$cf_ncuhdr_root/include" -+ test -d $HOME/$cf_ncuhdr_root/include && cf_search="$cf_search $HOME/$cf_ncuhdr_root/include" -+ test -d $HOME/$cf_ncuhdr_root/include/$cf_ncuhdr_root && cf_search="$cf_search $HOME/$cf_ncuhdr_root/include/$cf_ncuhdr_root" -+} -+ -+test "$includedir" != NONE && \ -+test "$includedir" != "/usr/include" && \ -+test -d "$includedir" && { -+ test -d $includedir && cf_search="$cf_search $includedir" -+ test -d $includedir/$cf_ncuhdr_root && cf_search="$cf_search $includedir/$cf_ncuhdr_root" -+} -+ -+test "$oldincludedir" != NONE && \ -+test "$oldincludedir" != "/usr/include" && \ -+test -d "$oldincludedir" && { -+ test -d $oldincludedir && cf_search="$cf_search $oldincludedir" -+ test -d $oldincludedir/$cf_ncuhdr_root && cf_search="$cf_search $oldincludedir/$cf_ncuhdr_root" -+} -+ -+cf_search="$cf_search $cf_header_path_list" -+ -+ test -n "$verbose" && echo search path $cf_search -+ cf_save2_CPPFLAGS="$CPPFLAGS" -+ for cf_incdir in $cf_search -+ do -+ -+if test -n "$cf_incdir" ; then -+ for cf_add_incdir in $cf_incdir -+ do -+ while test $cf_add_incdir != /usr/include -+ do -+ if test -d $cf_add_incdir -+ then -+ cf_have_incdir=no -+ if test -n "$CFLAGS$CPPFLAGS" ; then -+ # a loop is needed to ensure we can add subdirs of existing dirs -+ for cf_test_incdir in $CFLAGS $CPPFLAGS ; do -+ if test ".$cf_test_incdir" = ".-I$cf_add_incdir" ; then -+ cf_have_incdir=yes; break -+ fi -+ done -+ fi - -+ if test "$cf_have_incdir" = no ; then -+ if test "$cf_add_incdir" = /usr/local/include ; then -+ if test "$GCC" = yes -+ then -+ cf_save_CPPFLAGS=$CPPFLAGS -+ CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" -+ cat >conftest.$ac_ext <<_ACEOF -+#line 5930 "configure" -+#include "confdefs.h" -+#include <stdio.h> - int - main () - { -- -- MENU *menu; -- int y = menu->max_item_width; -- -+printf("Hello") - ; - return 0; - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:5843: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:5942: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:5846: \$? = $ac_status" >&5 -+ echo "$as_me:5945: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:5849: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:5948: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:5852: \$? = $ac_status" >&5 -+ echo "$as_me:5951: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- cf_cv_netbsd_menu_h=yes -- -+ : - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --cf_cv_netbsd_menu_h=no -+cf_have_incdir=yes - fi - rm -f conftest.$ac_objext conftest.$ac_ext -+ CPPFLAGS=$cf_save_CPPFLAGS -+ fi -+ fi -+ fi - --fi --echo "$as_me:5864: result: $cf_cv_netbsd_menu_h" >&5 --echo "${ECHO_T}$cf_cv_netbsd_menu_h" >&6 -- --test "$cf_cv_netbsd_menu_h" = yes && cat >>confdefs.h <<\EOF --#define HAVE_NETBSD_MENU_H 1 --EOF -- -- ;; --ncurses) -- --cf_ncuconfig_root=ncurses -+ if test "$cf_have_incdir" = no ; then -+ test -n "$verbose" && echo " adding $cf_add_incdir to include-path" 1>&6 - --echo "Looking for ${cf_ncuconfig_root}-config" --for ac_prog in ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config --do -- # Extract the first word of "$ac_prog", so it can be a program name with args. --set dummy $ac_prog; ac_word=$2 --echo "$as_me:5881: checking for $ac_word" >&5 --echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 --if test "${ac_cv_path_NCURSES_CONFIG+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 --else -- case $NCURSES_CONFIG in -- [\\/]* | ?:[\\/]*) -- ac_cv_path_NCURSES_CONFIG="$NCURSES_CONFIG" # Let the user override the test with a path. -- ;; -- *) -- ac_save_IFS=$IFS; IFS=$ac_path_separator --ac_dummy="$PATH" --for ac_dir in $ac_dummy; do -- IFS=$ac_save_IFS -- test -z "$ac_dir" && ac_dir=. -- if $as_executable_p "$ac_dir/$ac_word"; then -- ac_cv_path_NCURSES_CONFIG="$ac_dir/$ac_word" -- echo "$as_me:5898: found $ac_dir/$ac_word" >&5 -- break --fi --done -+echo "${as_me:-configure}:5968: testing adding $cf_add_incdir to include-path ..." 1>&5 - -- ;; --esac --fi --NCURSES_CONFIG=$ac_cv_path_NCURSES_CONFIG -+ CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" - --if test -n "$NCURSES_CONFIG"; then -- echo "$as_me:5909: result: $NCURSES_CONFIG" >&5 --echo "${ECHO_T}$NCURSES_CONFIG" >&6 --else -- echo "$as_me:5912: result: no" >&5 --echo "${ECHO_T}no" >&6 -+ cf_top_incdir=`echo $cf_add_incdir | sed -e 's%/include/.*$%/include%'` -+ test "$cf_top_incdir" = "$cf_add_incdir" && break -+ cf_add_incdir="$cf_top_incdir" -+ else -+ break -+ fi -+ fi -+ done -+ done - fi - -- test -n "$NCURSES_CONFIG" && break --done --test -n "$NCURSES_CONFIG" || NCURSES_CONFIG="none" -- --if test "$NCURSES_CONFIG" != none ; then -- --CPPFLAGS="$CPPFLAGS `$NCURSES_CONFIG --cflags`" --LIBS="`$NCURSES_CONFIG --libs` $LIBS" -- --# even with config script, some packages use no-override for curses.h -- --echo "$as_me:5927: checking if we have identified curses headers" >&5 --echo $ECHO_N "checking if we have identified curses headers... $ECHO_C" >&6 --if test "${cf_cv_ncurses_header+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 --else -+ for cf_header in \ -+ ncurses.h \ -+ curses.h -+ do - --cf_cv_ncurses_header=none --for cf_header in \ -- ncurses/curses.h \ -- ncurses/ncurses.h \ -- curses.h \ -- ncurses.h --do --cat >conftest.$ac_ext <<_ACEOF --#line 5941 "configure" -+ cat >conftest.$ac_ext <<_ACEOF -+#line 5989 "configure" - #include "confdefs.h" --#include <${cf_header}> -+ -+#include <$cf_header> - int - main () - { --initscr(); tgoto("?", 0,0) -+ -+#ifdef NCURSES_VERSION -+ -+printf("%s\n", NCURSES_VERSION); -+#else -+#ifdef __NCURSES_H -+printf("old\n"); -+#else -+ make an error -+#endif -+#endif -+ - ; - return 0; - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:5953: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:6013: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:5956: \$? = $ac_status" >&5 -+ echo "$as_me:6016: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:5959: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:6019: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:5962: \$? = $ac_status" >&5 -+ echo "$as_me:6022: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- cf_cv_ncurses_header=$cf_header; break --else -+ cf_cv_ncurses_h2=$cf_header -+ -+else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 -+cf_cv_ncurses_h2=no - fi - rm -f conftest.$ac_objext conftest.$ac_ext --done -- --fi --echo "$as_me:5973: result: $cf_cv_ncurses_header" >&5 --echo "${ECHO_T}$cf_cv_ncurses_header" >&6 - --if test "$cf_cv_ncurses_header" = none ; then -- { { echo "$as_me:5977: error: No curses header-files found" >&5 --echo "$as_me: error: No curses header-files found" >&2;} -+ if test "$cf_cv_ncurses_h2" != no ; then -+ cf_cv_ncurses_h2=$cf_incdir/$cf_header -+ test -n "$verbose" && echo $ac_n " ... found $ac_c" 1>&6 -+ break -+ fi -+ test -n "$verbose" && echo " ... tested $cf_incdir/$cf_header" 1>&6 -+ done -+ CPPFLAGS="$cf_save2_CPPFLAGS" -+ test "$cf_cv_ncurses_h2" != no && break -+ done -+ test "$cf_cv_ncurses_h2" = no && { { echo "$as_me:6043: error: not found" >&5 -+echo "$as_me: error: not found" >&2;} - { (exit 1); exit 1; }; } --fi -- --# cheat, to get the right #define's for HAVE_NCURSES_H, etc. -- --for ac_header in $cf_cv_ncurses_header --do --as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` --echo "$as_me:5987: checking for $ac_header" >&5 --echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 --if eval "test \"\${$as_ac_Header+set}\" = set"; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 --else -- cat >conftest.$ac_ext <<_ACEOF --#line 5993 "configure" --#include "confdefs.h" --#include <$ac_header> --_ACEOF --if { (eval echo "$as_me:5997: \"$ac_cpp conftest.$ac_ext\"") >&5 -- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 -- ac_status=$? -- egrep -v '^ *\+' conftest.er1 >conftest.err -- rm -f conftest.er1 -- cat conftest.err >&5 -- echo "$as_me:6003: \$? = $ac_status" >&5 -- (exit $ac_status); } >/dev/null; then -- if test -s conftest.err; then -- ac_cpp_err=$ac_c_preproc_warn_flag -- else -- ac_cpp_err= -- fi --else -- ac_cpp_err=yes --fi --if test -z "$ac_cpp_err"; then -- eval "$as_ac_Header=yes" --else -- echo "$as_me: failed program was:" >&5 -- cat conftest.$ac_ext >&5 -- eval "$as_ac_Header=no" --fi --rm -f conftest.err conftest.$ac_ext --fi --echo "$as_me:6022: result: `eval echo '${'$as_ac_Header'}'`" >&5 --echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 --if test `eval echo '${'$as_ac_Header'}'` = yes; then -- cat >>confdefs.h <<EOF --#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 --EOF - - fi --done -- --cat >>confdefs.h <<\EOF --#define NCURSES 1 --EOF -- --cf_nculib_ROOT=`echo "HAVE_LIB$cf_ncuconfig_root" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` -- --cat >>confdefs.h <<EOF --#define $cf_nculib_ROOT 1 --EOF -- --cf_cv_ncurses_version=`$NCURSES_CONFIG --version` -- --else -- --cf_ncuhdr_root=ncurses -+echo "$as_me:6048: result: $cf_cv_ncurses_h2" >&5 -+echo "${ECHO_T}$cf_cv_ncurses_h2" >&6 - --test -n "$cf_cv_curses_dir" && \ --test "$cf_cv_curses_dir" != "no" && { \ -+ cf_1st_incdir=`echo $cf_cv_ncurses_h2 | sed -e 's%/[^/]*$%%'` -+ cf_cv_ncurses_header=`basename $cf_cv_ncurses_h2` -+ if test `basename $cf_1st_incdir` = $cf_ncuhdr_root ; then -+ cf_cv_ncurses_header=$cf_ncuhdr_root/$cf_cv_ncurses_header -+ fi - --if test -n "$cf_cv_curses_dir/include/$cf_ncuhdr_root" ; then -- for cf_add_incdir in $cf_cv_curses_dir/include/$cf_ncuhdr_root -+if test -n "$cf_1st_incdir" ; then -+ for cf_add_incdir in $cf_1st_incdir - do - while test $cf_add_incdir != /usr/include - do -@@ -6072,7 +6078,7 @@ - cf_save_CPPFLAGS=$CPPFLAGS - CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" - cat >conftest.$ac_ext <<_ACEOF --#line 6075 "configure" -+#line 6081 "configure" - #include "confdefs.h" - #include <stdio.h> - int -@@ -6084,16 +6090,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:6087: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:6093: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:6090: \$? = $ac_status" >&5 -+ echo "$as_me:6096: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:6093: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:6099: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:6096: \$? = $ac_status" >&5 -+ echo "$as_me:6102: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : - else -@@ -6110,7 +6116,7 @@ - if test "$cf_have_incdir" = no ; then - test -n "$verbose" && echo " adding $cf_add_incdir to include-path" 1>&6 - --echo "${as_me:-configure}:6113: testing adding $cf_add_incdir to include-path ..." 1>&5 -+echo "${as_me:-configure}:6119: testing adding $cf_add_incdir to include-path ..." 1>&5 - - CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" - -@@ -6125,771 +6131,765 @@ - done - fi - --} -+fi - --echo "$as_me:6130: checking for $cf_ncuhdr_root header in include-path" >&5 --echo $ECHO_N "checking for $cf_ncuhdr_root header in include-path... $ECHO_C" >&6 --if test "${cf_cv_ncurses_h+set}" = set; then -+# Set definitions to allow ifdef'ing for ncurses.h -+ -+case $cf_cv_ncurses_header in # (vi -+*ncurses.h) -+ -+cat >>confdefs.h <<\EOF -+#define HAVE_NCURSES_H 1 -+EOF -+ -+ ;; -+esac -+ -+case $cf_cv_ncurses_header in # (vi -+ncurses/curses.h|ncurses/ncurses.h) -+ -+cat >>confdefs.h <<\EOF -+#define HAVE_NCURSES_NCURSES_H 1 -+EOF -+ -+ ;; -+ncursesw/curses.h|ncursesw/ncurses.h) -+ -+cat >>confdefs.h <<\EOF -+#define HAVE_NCURSESW_NCURSES_H 1 -+EOF -+ -+ ;; -+esac -+ -+echo "$as_me:6165: checking for terminfo header" >&5 -+echo $ECHO_N "checking for terminfo header... $ECHO_C" >&6 -+if test "${cf_cv_term_header+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - -- cf_header_list="$cf_ncuhdr_root/curses.h $cf_ncuhdr_root/ncurses.h" -- ( test "$cf_ncuhdr_root" = ncurses || test "$cf_ncuhdr_root" = ncursesw ) && cf_header_list="$cf_header_list curses.h ncurses.h" -- for cf_header in $cf_header_list -- do -+case ${cf_cv_ncurses_header} in #(vi -+*/ncurses.h|*/ncursesw.h) #(vi -+ cf_term_header=`echo "$cf_cv_ncurses_header" | sed -e 's%ncurses[^.]*\.h$%term.h%'` -+ ;; -+*) -+ cf_term_header=term.h -+ ;; -+esac - -- cat >conftest.$ac_ext <<_ACEOF --#line 6142 "configure" -+for cf_test in $cf_term_header "ncurses/term.h" "ncursesw/term.h" -+do -+cat >conftest.$ac_ext <<_ACEOF -+#line 6183 "configure" - #include "confdefs.h" -+#include <stdio.h> -+#include <${cf_cv_ncurses_header:-curses.h}> -+#include <$cf_test> - --#include <$cf_header> - int - main () - { -- --#ifdef NCURSES_VERSION -- --printf("%s\n", NCURSES_VERSION); --#else --#ifdef __NCURSES_H --printf("old\n"); --#else -- make an error --#endif --#endif -- -+int x = auto_left_margin - ; - return 0; - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:6166: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:6198: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:6169: \$? = $ac_status" >&5 -+ echo "$as_me:6201: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:6172: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:6204: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:6175: \$? = $ac_status" >&5 -+ echo "$as_me:6207: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- cf_cv_ncurses_h=$cf_header - -+ cf_cv_term_header="$cf_test" - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --cf_cv_ncurses_h=no -+ -+ cf_cv_term_header=unknown -+ - fi - rm -f conftest.$ac_objext conftest.$ac_ext -- -- test "$cf_cv_ncurses_h" != no && break -- done -+ test "$cf_cv_term_header" != unknown && break -+done - - fi --echo "$as_me:6190: result: $cf_cv_ncurses_h" >&5 --echo "${ECHO_T}$cf_cv_ncurses_h" >&6 -+echo "$as_me:6223: result: $cf_cv_term_header" >&5 -+echo "${ECHO_T}$cf_cv_term_header" >&6 - --if test "$cf_cv_ncurses_h" != no ; then -- cf_cv_ncurses_header=$cf_cv_ncurses_h --else -+# Set definitions to allow ifdef'ing to accommodate subdirectories - --echo "$as_me:6197: checking for $cf_ncuhdr_root include-path" >&5 --echo $ECHO_N "checking for $cf_ncuhdr_root include-path... $ECHO_C" >&6 --if test "${cf_cv_ncurses_h2+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 --else -+case $cf_cv_term_header in # (vi -+*term.h) - -- test -n "$verbose" && echo -+cat >>confdefs.h <<\EOF -+#define HAVE_TERM_H 1 -+EOF - --cf_search= -+ ;; -+esac - --# collect the current set of include-directories from compiler flags --cf_header_path_list="" --if test -n "${CFLAGS}${CPPFLAGS}" ; then -- for cf_header_path in $CPPFLAGS $CFLAGS -- do -- case $cf_header_path in #(vi -- -I*) -- cf_header_path=`echo ".$cf_header_path" |sed -e 's/^...//' -e 's,/include$,,'` -+case $cf_cv_term_header in # (vi -+ncurses/term.h) #(vi - --test "$cf_header_path" != "NONE" && \ --test -d "$cf_header_path" && \ -- { -- test -n "$verbose" && echo " ... testing for include-directories under $cf_header_path" -- test -d $cf_header_path/include && cf_search="$cf_search $cf_header_path/include" -- test -d $cf_header_path/include/$cf_ncuhdr_root && cf_search="$cf_search $cf_header_path/include/$cf_ncuhdr_root" -- test -d $cf_header_path/include/$cf_ncuhdr_root/include && cf_search="$cf_search $cf_header_path/include/$cf_ncuhdr_root/include" -- test -d $cf_header_path/$cf_ncuhdr_root/include && cf_search="$cf_search $cf_header_path/$cf_ncuhdr_root/include" -- test -d $cf_header_path/$cf_ncuhdr_root/include/$cf_ncuhdr_root && cf_search="$cf_search $cf_header_path/$cf_ncuhdr_root/include/$cf_ncuhdr_root" --} -+cat >>confdefs.h <<\EOF -+#define HAVE_NCURSES_TERM_H 1 -+EOF - -- cf_header_path_list="$cf_header_path_list $cf_search" -- ;; -- esac -- done --fi -+ ;; -+ncursesw/term.h) - --# add the variations for the package we are looking for -+cat >>confdefs.h <<\EOF -+#define HAVE_NCURSESW_TERM_H 1 -+EOF - --cf_search= -+ ;; -+esac - --test "/usr" != "$prefix" && \ --test -d "/usr" && \ --(test $prefix = NONE || test "/usr" != "$prefix") && { -- test -n "$verbose" && echo " ... testing for include-directories under /usr" -- test -d /usr/include && cf_search="$cf_search /usr/include" -- test -d /usr/include/$cf_ncuhdr_root && cf_search="$cf_search /usr/include/$cf_ncuhdr_root" -- test -d /usr/include/$cf_ncuhdr_root/include && cf_search="$cf_search /usr/include/$cf_ncuhdr_root/include" -- test -d /usr/$cf_ncuhdr_root/include && cf_search="$cf_search /usr/$cf_ncuhdr_root/include" -- test -d /usr/$cf_ncuhdr_root/include/$cf_ncuhdr_root && cf_search="$cf_search /usr/$cf_ncuhdr_root/include/$cf_ncuhdr_root" --} -+# some applications need this, but should check for NCURSES_VERSION - --test "$prefix" != "NONE" && \ --test -d "$prefix" && \ -- { -- test -n "$verbose" && echo " ... testing for include-directories under $prefix" -- test -d $prefix/include && cf_search="$cf_search $prefix/include" -- test -d $prefix/include/$cf_ncuhdr_root && cf_search="$cf_search $prefix/include/$cf_ncuhdr_root" -- test -d $prefix/include/$cf_ncuhdr_root/include && cf_search="$cf_search $prefix/include/$cf_ncuhdr_root/include" -- test -d $prefix/$cf_ncuhdr_root/include && cf_search="$cf_search $prefix/$cf_ncuhdr_root/include" -- test -d $prefix/$cf_ncuhdr_root/include/$cf_ncuhdr_root && cf_search="$cf_search $prefix/$cf_ncuhdr_root/include/$cf_ncuhdr_root" --} -+cat >>confdefs.h <<\EOF -+#define NCURSES 1 -+EOF - --test "/usr/local" != "$prefix" && \ --test -d "/usr/local" && \ --(test $prefix = NONE || test "/usr/local" != "$prefix") && { -- test -n "$verbose" && echo " ... testing for include-directories under /usr/local" -- test -d /usr/local/include && cf_search="$cf_search /usr/local/include" -- test -d /usr/local/include/$cf_ncuhdr_root && cf_search="$cf_search /usr/local/include/$cf_ncuhdr_root" -- test -d /usr/local/include/$cf_ncuhdr_root/include && cf_search="$cf_search /usr/local/include/$cf_ncuhdr_root/include" -- test -d /usr/local/$cf_ncuhdr_root/include && cf_search="$cf_search /usr/local/$cf_ncuhdr_root/include" -- test -d /usr/local/$cf_ncuhdr_root/include/$cf_ncuhdr_root && cf_search="$cf_search /usr/local/$cf_ncuhdr_root/include/$cf_ncuhdr_root" --} -+echo "$as_me:6261: checking for ncurses version" >&5 -+echo $ECHO_N "checking for ncurses version... $ECHO_C" >&6 -+if test "${cf_cv_ncurses_version+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else - --test "/opt" != "$prefix" && \ --test -d "/opt" && \ --(test $prefix = NONE || test "/opt" != "$prefix") && { -- test -n "$verbose" && echo " ... testing for include-directories under /opt" -- test -d /opt/include && cf_search="$cf_search /opt/include" -- test -d /opt/include/$cf_ncuhdr_root && cf_search="$cf_search /opt/include/$cf_ncuhdr_root" -- test -d /opt/include/$cf_ncuhdr_root/include && cf_search="$cf_search /opt/include/$cf_ncuhdr_root/include" -- test -d /opt/$cf_ncuhdr_root/include && cf_search="$cf_search /opt/$cf_ncuhdr_root/include" -- test -d /opt/$cf_ncuhdr_root/include/$cf_ncuhdr_root && cf_search="$cf_search /opt/$cf_ncuhdr_root/include/$cf_ncuhdr_root" --} -+ cf_cv_ncurses_version=no -+ cf_tempfile=out$$ -+ rm -f $cf_tempfile -+ if test "$cross_compiling" = yes; then - --test "$HOME" != "$prefix" && \ --test -d "$HOME" && \ --(test $prefix = NONE || test "$HOME" != "$prefix") && { -- test -n "$verbose" && echo " ... testing for include-directories under $HOME" -- test -d $HOME/include && cf_search="$cf_search $HOME/include" -- test -d $HOME/include/$cf_ncuhdr_root && cf_search="$cf_search $HOME/include/$cf_ncuhdr_root" -- test -d $HOME/include/$cf_ncuhdr_root/include && cf_search="$cf_search $HOME/include/$cf_ncuhdr_root/include" -- test -d $HOME/$cf_ncuhdr_root/include && cf_search="$cf_search $HOME/$cf_ncuhdr_root/include" -- test -d $HOME/$cf_ncuhdr_root/include/$cf_ncuhdr_root && cf_search="$cf_search $HOME/$cf_ncuhdr_root/include/$cf_ncuhdr_root" --} -+ # This will not work if the preprocessor splits the line after the -+ # Autoconf token. The 'unproto' program does that. -+ cat > conftest.$ac_ext <<EOF -+#include <${cf_cv_ncurses_header:-curses.h}> -+#undef Autoconf -+#ifdef NCURSES_VERSION -+Autoconf NCURSES_VERSION -+#else -+#ifdef __NCURSES_H -+Autoconf "old" -+#endif -+; -+#endif -+EOF -+ cf_try="$ac_cpp conftest.$ac_ext 2>&5 | grep '^Autoconf ' >conftest.out" -+ { (eval echo "$as_me:6287: \"$cf_try\"") >&5 -+ (eval $cf_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:6290: \$? = $ac_status" >&5 -+ (exit $ac_status); } -+ if test -f conftest.out ; then -+ cf_out=`cat conftest.out | sed -e 's%^Autoconf %%' -e 's%^[^"]*"%%' -e 's%".*%%'` -+ test -n "$cf_out" && cf_cv_ncurses_version="$cf_out" -+ rm -f conftest.out -+ fi - --test "$includedir" != NONE && \ --test "$includedir" != "/usr/include" && \ --test -d "$includedir" && { -- test -d $includedir && cf_search="$cf_search $includedir" -- test -d $includedir/$cf_ncuhdr_root && cf_search="$cf_search $includedir/$cf_ncuhdr_root" --} -+else -+ cat >conftest.$ac_ext <<_ACEOF -+#line 6300 "configure" -+#include "confdefs.h" - --test "$oldincludedir" != NONE && \ --test "$oldincludedir" != "/usr/include" && \ --test -d "$oldincludedir" && { -- test -d $oldincludedir && cf_search="$cf_search $oldincludedir" -- test -d $oldincludedir/$cf_ncuhdr_root && cf_search="$cf_search $oldincludedir/$cf_ncuhdr_root" -+#include <${cf_cv_ncurses_header:-curses.h}> -+#include <stdio.h> -+int main() -+{ -+ FILE *fp = fopen("$cf_tempfile", "w"); -+#ifdef NCURSES_VERSION -+# ifdef NCURSES_VERSION_PATCH -+ fprintf(fp, "%s.%d\n", NCURSES_VERSION, NCURSES_VERSION_PATCH); -+# else -+ fprintf(fp, "%s\n", NCURSES_VERSION); -+# endif -+#else -+# ifdef __NCURSES_H -+ fprintf(fp, "old\n"); -+# else -+ make an error -+# endif -+#endif -+ ${cf_cv_main_return:-return}(0); - } -+_ACEOF -+rm -f conftest$ac_exeext -+if { (eval echo "$as_me:6325: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>&5 -+ ac_status=$? -+ echo "$as_me:6328: \$? = $ac_status" >&5 -+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext' -+ { (eval echo "$as_me:6330: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:6333: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then - --cf_search="$cf_search $cf_header_path_list" -- -- test -n "$verbose" && echo search path $cf_search -- cf_save2_CPPFLAGS="$CPPFLAGS" -- for cf_incdir in $cf_search -- do -+ cf_cv_ncurses_version=`cat $cf_tempfile` -+else -+ echo "$as_me: program exited with status $ac_status" >&5 -+echo "$as_me: failed program was:" >&5 -+cat conftest.$ac_ext >&5 -+fi -+rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -+fi -+ rm -f $cf_tempfile - --if test -n "$cf_incdir" ; then -- for cf_add_incdir in $cf_incdir -- do -- while test $cf_add_incdir != /usr/include -- do -- if test -d $cf_add_incdir -- then -- cf_have_incdir=no -- if test -n "$CFLAGS$CPPFLAGS" ; then -- # a loop is needed to ensure we can add subdirs of existing dirs -- for cf_test_incdir in $CFLAGS $CPPFLAGS ; do -- if test ".$cf_test_incdir" = ".-I$cf_add_incdir" ; then -- cf_have_incdir=yes; break -- fi -- done -- fi -+fi -+echo "$as_me:6347: result: $cf_cv_ncurses_version" >&5 -+echo "${ECHO_T}$cf_cv_ncurses_version" >&6 -+test "$cf_cv_ncurses_version" = no || -+cat >>confdefs.h <<\EOF -+#define NCURSES 1 -+EOF - -- if test "$cf_have_incdir" = no ; then -- if test "$cf_add_incdir" = /usr/local/include ; then -- if test "$GCC" = yes -- then -- cf_save_CPPFLAGS=$CPPFLAGS -- CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" -- cat >conftest.$ac_ext <<_ACEOF --#line 6337 "configure" -+cf_nculib_root=ncurses -+ # This works, except for the special case where we find gpm, but -+ # ncurses is in a nonstandard location via $LIBS, and we really want -+ # to link gpm. -+cf_ncurses_LIBS="" -+cf_ncurses_SAVE="$LIBS" -+echo "$as_me:6360: checking for Gpm_Open in -lgpm" >&5 -+echo $ECHO_N "checking for Gpm_Open in -lgpm... $ECHO_C" >&6 -+if test "${ac_cv_lib_gpm_Gpm_Open+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ ac_check_lib_save_LIBS=$LIBS -+LIBS="-lgpm $LIBS" -+cat >conftest.$ac_ext <<_ACEOF -+#line 6368 "configure" - #include "confdefs.h" --#include <stdio.h> -+ -+/* Override any gcc2 internal prototype to avoid an error. */ -+#ifdef __cplusplus -+extern "C" -+#endif -+/* We use char because int might match the return type of a gcc2 -+ builtin and then its argument prototype would still apply. */ -+char Gpm_Open (); - int - main () - { --printf("Hello") -+Gpm_Open (); - ; - return 0; - } - _ACEOF --rm -f conftest.$ac_objext --if { (eval echo "$as_me:6349: \"$ac_compile\"") >&5 -- (eval $ac_compile) 2>&5 -+rm -f conftest.$ac_objext conftest$ac_exeext -+if { (eval echo "$as_me:6387: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:6352: \$? = $ac_status" >&5 -+ echo "$as_me:6390: \$? = $ac_status" >&5 - (exit $ac_status); } && -- { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:6355: \"$ac_try\"") >&5 -+ { ac_try='test -s conftest$ac_exeext' -+ { (eval echo "$as_me:6393: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:6358: \$? = $ac_status" >&5 -+ echo "$as_me:6396: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- : -+ ac_cv_lib_gpm_Gpm_Open=yes - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --cf_have_incdir=yes -+ac_cv_lib_gpm_Gpm_Open=no - fi --rm -f conftest.$ac_objext conftest.$ac_ext -- CPPFLAGS=$cf_save_CPPFLAGS -- fi -- fi -- fi -- -- if test "$cf_have_incdir" = no ; then -- test -n "$verbose" && echo " adding $cf_add_incdir to include-path" 1>&6 -- --echo "${as_me:-configure}:6375: testing adding $cf_add_incdir to include-path ..." 1>&5 -- -- CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" -- -- cf_top_incdir=`echo $cf_add_incdir | sed -e 's%/include/.*$%/include%'` -- test "$cf_top_incdir" = "$cf_add_incdir" && break -- cf_add_incdir="$cf_top_incdir" -- else -- break -- fi -- fi -- done -- done -+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -+LIBS=$ac_check_lib_save_LIBS - fi -- -- for cf_header in \ -- ncurses.h \ -- curses.h -- do -- -- cat >conftest.$ac_ext <<_ACEOF --#line 6396 "configure" -+echo "$as_me:6407: result: $ac_cv_lib_gpm_Gpm_Open" >&5 -+echo "${ECHO_T}$ac_cv_lib_gpm_Gpm_Open" >&6 -+if test $ac_cv_lib_gpm_Gpm_Open = yes; then -+ echo "$as_me:6410: checking for initscr in -lgpm" >&5 -+echo $ECHO_N "checking for initscr in -lgpm... $ECHO_C" >&6 -+if test "${ac_cv_lib_gpm_initscr+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ ac_check_lib_save_LIBS=$LIBS -+LIBS="-lgpm $LIBS" -+cat >conftest.$ac_ext <<_ACEOF -+#line 6418 "configure" - #include "confdefs.h" - --#include <$cf_header> -+/* Override any gcc2 internal prototype to avoid an error. */ -+#ifdef __cplusplus -+extern "C" -+#endif -+/* We use char because int might match the return type of a gcc2 -+ builtin and then its argument prototype would still apply. */ -+char initscr (); - int - main () - { -- --#ifdef NCURSES_VERSION -- --printf("%s\n", NCURSES_VERSION); --#else --#ifdef __NCURSES_H --printf("old\n"); --#else -- make an error --#endif --#endif -- -+initscr (); - ; - return 0; - } - _ACEOF --rm -f conftest.$ac_objext --if { (eval echo "$as_me:6420: \"$ac_compile\"") >&5 -- (eval $ac_compile) 2>&5 -+rm -f conftest.$ac_objext conftest$ac_exeext -+if { (eval echo "$as_me:6437: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:6423: \$? = $ac_status" >&5 -+ echo "$as_me:6440: \$? = $ac_status" >&5 - (exit $ac_status); } && -- { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:6426: \"$ac_try\"") >&5 -+ { ac_try='test -s conftest$ac_exeext' -+ { (eval echo "$as_me:6443: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:6429: \$? = $ac_status" >&5 -+ echo "$as_me:6446: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- cf_cv_ncurses_h2=$cf_header -- -+ ac_cv_lib_gpm_initscr=yes - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --cf_cv_ncurses_h2=no -+ac_cv_lib_gpm_initscr=no - fi --rm -f conftest.$ac_objext conftest.$ac_ext -- -- if test "$cf_cv_ncurses_h2" != no ; then -- cf_cv_ncurses_h2=$cf_incdir/$cf_header -- test -n "$verbose" && echo $ac_n " ... found $ac_c" 1>&6 -- break -- fi -- test -n "$verbose" && echo " ... tested $cf_incdir/$cf_header" 1>&6 -- done -- CPPFLAGS="$cf_save2_CPPFLAGS" -- test "$cf_cv_ncurses_h2" != no && break -- done -- test "$cf_cv_ncurses_h2" = no && { { echo "$as_me:6450: error: not found" >&5 --echo "$as_me: error: not found" >&2;} -- { (exit 1); exit 1; }; } -- -+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -+LIBS=$ac_check_lib_save_LIBS -+fi -+echo "$as_me:6457: result: $ac_cv_lib_gpm_initscr" >&5 -+echo "${ECHO_T}$ac_cv_lib_gpm_initscr" >&6 -+if test $ac_cv_lib_gpm_initscr = yes; then -+ LIBS="$cf_ncurses_SAVE" -+else -+ cf_ncurses_LIBS="-lgpm" - fi --echo "$as_me:6455: result: $cf_cv_ncurses_h2" >&5 --echo "${ECHO_T}$cf_cv_ncurses_h2" >&6 -- -- cf_1st_incdir=`echo $cf_cv_ncurses_h2 | sed -e 's%/[^/]*$%%'` -- cf_cv_ncurses_header=`basename $cf_cv_ncurses_h2` -- if test `basename $cf_1st_incdir` = $cf_ncuhdr_root ; then -- cf_cv_ncurses_header=$cf_ncuhdr_root/$cf_cv_ncurses_header -- fi - --if test -n "$cf_1st_incdir" ; then -- for cf_add_incdir in $cf_1st_incdir -- do -- while test $cf_add_incdir != /usr/include -- do -- if test -d $cf_add_incdir -- then -- cf_have_incdir=no -- if test -n "$CFLAGS$CPPFLAGS" ; then -- # a loop is needed to ensure we can add subdirs of existing dirs -- for cf_test_incdir in $CFLAGS $CPPFLAGS ; do -- if test ".$cf_test_incdir" = ".-I$cf_add_incdir" ; then -- cf_have_incdir=yes; break -- fi -- done -- fi -+fi - -- if test "$cf_have_incdir" = no ; then -- if test "$cf_add_incdir" = /usr/local/include ; then -- if test "$GCC" = yes -- then -- cf_save_CPPFLAGS=$CPPFLAGS -- CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" -- cat >conftest.$ac_ext <<_ACEOF --#line 6488 "configure" -+case $host_os in #(vi -+freebsd*) -+ # This is only necessary if you are linking against an obsolete -+ # version of ncurses (but it should do no harm, since it's static). -+ if test "$cf_nculib_root" = ncurses ; then -+ echo "$as_me:6472: checking for tgoto in -lmytinfo" >&5 -+echo $ECHO_N "checking for tgoto in -lmytinfo... $ECHO_C" >&6 -+if test "${ac_cv_lib_mytinfo_tgoto+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ ac_check_lib_save_LIBS=$LIBS -+LIBS="-lmytinfo $LIBS" -+cat >conftest.$ac_ext <<_ACEOF -+#line 6480 "configure" - #include "confdefs.h" --#include <stdio.h> -+ -+/* Override any gcc2 internal prototype to avoid an error. */ -+#ifdef __cplusplus -+extern "C" -+#endif -+/* We use char because int might match the return type of a gcc2 -+ builtin and then its argument prototype would still apply. */ -+char tgoto (); - int - main () - { --printf("Hello") -+tgoto (); - ; - return 0; - } - _ACEOF --rm -f conftest.$ac_objext --if { (eval echo "$as_me:6500: \"$ac_compile\"") >&5 -- (eval $ac_compile) 2>&5 -+rm -f conftest.$ac_objext conftest$ac_exeext -+if { (eval echo "$as_me:6499: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:6503: \$? = $ac_status" >&5 -+ echo "$as_me:6502: \$? = $ac_status" >&5 - (exit $ac_status); } && -- { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:6506: \"$ac_try\"") >&5 -+ { ac_try='test -s conftest$ac_exeext' -+ { (eval echo "$as_me:6505: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:6509: \$? = $ac_status" >&5 -+ echo "$as_me:6508: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- : -+ ac_cv_lib_mytinfo_tgoto=yes - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --cf_have_incdir=yes -+ac_cv_lib_mytinfo_tgoto=no - fi --rm -f conftest.$ac_objext conftest.$ac_ext -- CPPFLAGS=$cf_save_CPPFLAGS -- fi -- fi -- fi -- -- if test "$cf_have_incdir" = no ; then -- test -n "$verbose" && echo " adding $cf_add_incdir to include-path" 1>&6 -- --echo "${as_me:-configure}:6526: testing adding $cf_add_incdir to include-path ..." 1>&5 -- -- CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" -- -- cf_top_incdir=`echo $cf_add_incdir | sed -e 's%/include/.*$%/include%'` -- test "$cf_top_incdir" = "$cf_add_incdir" && break -- cf_add_incdir="$cf_top_incdir" -- else -- break -- fi -- fi -- done -- done -+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -+LIBS=$ac_check_lib_save_LIBS - fi -- -+echo "$as_me:6519: result: $ac_cv_lib_mytinfo_tgoto" >&5 -+echo "${ECHO_T}$ac_cv_lib_mytinfo_tgoto" >&6 -+if test $ac_cv_lib_mytinfo_tgoto = yes; then -+ cf_ncurses_LIBS="-lmytinfo $cf_ncurses_LIBS" - fi - --# Set definitions to allow ifdef'ing for ncurses.h -- --case $cf_cv_ncurses_header in # (vi --*ncurses.h) -- cat >>confdefs.h <<\EOF --#define HAVE_NCURSES_H 1 --EOF -- -+ fi - ;; - esac - --case $cf_cv_ncurses_header in # (vi --ncurses/curses.h|ncurses/ncurses.h) -- cat >>confdefs.h <<\EOF --#define HAVE_NCURSES_NCURSES_H 1 --EOF -- -- ;; --ncursesw/curses.h|ncursesw/ncurses.h) -- cat >>confdefs.h <<\EOF --#define HAVE_NCURSESW_NCURSES_H 1 --EOF -+LIBS="$cf_ncurses_LIBS $LIBS" - -- ;; --esac -+if ( test -n "$cf_cv_curses_dir" && test "$cf_cv_curses_dir" != "no" ) -+then -+ LIBS="-l$cf_nculib_root $LIBS" -+else - --echo "$as_me:6569: checking for terminfo header" >&5 --echo $ECHO_N "checking for terminfo header... $ECHO_C" >&6 --if test "${cf_cv_term_header+set}" = set; then -+ eval 'cf_cv_have_lib_'$cf_nculib_root'=no' -+ cf_libdir="" -+ echo "$as_me:6538: checking for initscr" >&5 -+echo $ECHO_N "checking for initscr... $ECHO_C" >&6 -+if test "${ac_cv_func_initscr+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else -+ cat >conftest.$ac_ext <<_ACEOF -+#line 6544 "configure" -+#include "confdefs.h" -+/* System header to define __stub macros and hopefully few prototypes, -+ which can conflict with char initscr (); below. */ -+#include <assert.h> -+/* Override any gcc2 internal prototype to avoid an error. */ -+#ifdef __cplusplus -+extern "C" -+#endif -+/* We use char because int might match the return type of a gcc2 -+ builtin and then its argument prototype would still apply. */ -+char initscr (); -+char (*f) (); - --case ${cf_cv_ncurses_header} in #(vi --*/ncurses.h|*/ncursesw.h) #(vi -- cf_term_header=`echo "$cf_cv_ncurses_header" | sed -e 's%ncurses[^.]*\.h$%term.h%'` -- ;; --*) -- cf_term_header=term.h -- ;; --esac -+int -+main () -+{ -+/* The GNU C library defines this for functions which it implements -+ to always fail with ENOSYS. Some functions are actually named -+ something starting with __ and the normal name is an alias. */ -+#if defined (__stub_initscr) || defined (__stub___initscr) -+choke me -+#else -+f = initscr; /* workaround for ICC 12.0.3 */ if (f == 0) return 1; -+#endif - --for cf_test in $cf_term_header "ncurses/term.h" "ncursesw/term.h" --do --cat >conftest.$ac_ext <<_ACEOF --#line 6587 "configure" -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext conftest$ac_exeext -+if { (eval echo "$as_me:6575: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>&5 -+ ac_status=$? -+ echo "$as_me:6578: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -s conftest$ac_exeext' -+ { (eval echo "$as_me:6581: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:6584: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ ac_cv_func_initscr=yes -+else -+ echo "$as_me: failed program was:" >&5 -+cat conftest.$ac_ext >&5 -+ac_cv_func_initscr=no -+fi -+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -+fi -+echo "$as_me:6594: result: $ac_cv_func_initscr" >&5 -+echo "${ECHO_T}$ac_cv_func_initscr" >&6 -+if test $ac_cv_func_initscr = yes; then -+ eval 'cf_cv_have_lib_'$cf_nculib_root'=yes' -+else -+ -+ cf_save_LIBS="$LIBS" -+ echo "$as_me:6601: checking for initscr in -l$cf_nculib_root" >&5 -+echo $ECHO_N "checking for initscr in -l$cf_nculib_root... $ECHO_C" >&6 -+ LIBS="-l$cf_nculib_root $LIBS" -+ cat >conftest.$ac_ext <<_ACEOF -+#line 6605 "configure" - #include "confdefs.h" --#include <stdio.h> - #include <${cf_cv_ncurses_header:-curses.h}> --#include <$cf_test> -- - int - main () - { --int x = auto_left_margin -+initscr() - ; - return 0; - } - _ACEOF --rm -f conftest.$ac_objext --if { (eval echo "$as_me:6602: \"$ac_compile\"") >&5 -- (eval $ac_compile) 2>&5 -+rm -f conftest.$ac_objext conftest$ac_exeext -+if { (eval echo "$as_me:6617: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:6605: \$? = $ac_status" >&5 -+ echo "$as_me:6620: \$? = $ac_status" >&5 - (exit $ac_status); } && -- { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:6608: \"$ac_try\"") >&5 -+ { ac_try='test -s conftest$ac_exeext' -+ { (eval echo "$as_me:6623: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:6611: \$? = $ac_status" >&5 -+ echo "$as_me:6626: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -+ echo "$as_me:6628: result: yes" >&5 -+echo "${ECHO_T}yes" >&6 -+ eval 'cf_cv_have_lib_'$cf_nculib_root'=yes' - -- cf_cv_term_header="$cf_test" - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 -+echo "$as_me:6635: result: no" >&5 -+echo "${ECHO_T}no" >&6 - -- cf_cv_term_header=unknown -+cf_search= -+cf_library_path_list="" -+if test -n "${LDFLAGS}${LIBS}" ; then -+ for cf_library_path in $LDFLAGS $LIBS -+ do -+ case $cf_library_path in #(vi -+ -L*) -+ cf_library_path=`echo ".$cf_library_path" |sed -e 's/^...//' -e 's,/lib$,,'` - --fi --rm -f conftest.$ac_objext conftest.$ac_ext -- test "$cf_cv_term_header" != unknown && break --done -+test "x$cf_library_path" != "xNONE" && \ -+test -d "$cf_library_path" && \ -+ { -+ test -n "$verbose" && echo " ... testing for lib-directories under $cf_library_path" -+ test -d $cf_library_path/lib && cf_search="$cf_search $cf_library_path/lib" -+ test -d $cf_library_path/lib/$cf_nculib_root && cf_search="$cf_search $cf_library_path/lib/$cf_nculib_root" -+ test -d $cf_library_path/lib/$cf_nculib_root/lib && cf_search="$cf_search $cf_library_path/lib/$cf_nculib_root/lib" -+ test -d $cf_library_path/$cf_nculib_root/lib && cf_search="$cf_search $cf_library_path/$cf_nculib_root/lib" -+ test -d $cf_library_path/$cf_nculib_root/lib/$cf_nculib_root && cf_search="$cf_search $cf_library_path/$cf_nculib_root/lib/$cf_nculib_root" -+} - -+ cf_library_path_list="$cf_library_path_list $cf_search" -+ ;; -+ esac -+ done - fi --echo "$as_me:6627: result: $cf_cv_term_header" >&5 --echo "${ECHO_T}$cf_cv_term_header" >&6 -- --# Set definitions to allow ifdef'ing to accommodate subdirectories - --case $cf_cv_term_header in # (vi --*term.h) -- cat >>confdefs.h <<\EOF --#define HAVE_TERM_H 1 --EOF -+cf_search= - -- ;; --esac -+test "x/usr" != "x$prefix" && \ -+test -d "/usr" && \ -+(test -z "$prefix" || test x$prefix = xNONE || test "x/usr" != "x$prefix") && { -+ test -n "$verbose" && echo " ... testing for lib-directories under /usr" -+ test -d /usr/lib && cf_search="$cf_search /usr/lib" -+ test -d /usr/lib/$cf_nculib_root && cf_search="$cf_search /usr/lib/$cf_nculib_root" -+ test -d /usr/lib/$cf_nculib_root/lib && cf_search="$cf_search /usr/lib/$cf_nculib_root/lib" -+ test -d /usr/$cf_nculib_root/lib && cf_search="$cf_search /usr/$cf_nculib_root/lib" -+ test -d /usr/$cf_nculib_root/lib/$cf_nculib_root && cf_search="$cf_search /usr/$cf_nculib_root/lib/$cf_nculib_root" -+} - --case $cf_cv_term_header in # (vi --ncurses/term.h) #(vi -- cat >>confdefs.h <<\EOF --#define HAVE_NCURSES_TERM_H 1 --EOF -- -- ;; --ncursesw/term.h) -- cat >>confdefs.h <<\EOF --#define HAVE_NCURSESW_TERM_H 1 --EOF -- -- ;; --esac -+test "x$prefix" != "xNONE" && \ -+test -d "$prefix" && \ -+ { -+ test -n "$verbose" && echo " ... testing for lib-directories under $prefix" -+ test -d $prefix/lib && cf_search="$cf_search $prefix/lib" -+ test -d $prefix/lib/$cf_nculib_root && cf_search="$cf_search $prefix/lib/$cf_nculib_root" -+ test -d $prefix/lib/$cf_nculib_root/lib && cf_search="$cf_search $prefix/lib/$cf_nculib_root/lib" -+ test -d $prefix/$cf_nculib_root/lib && cf_search="$cf_search $prefix/$cf_nculib_root/lib" -+ test -d $prefix/$cf_nculib_root/lib/$cf_nculib_root && cf_search="$cf_search $prefix/$cf_nculib_root/lib/$cf_nculib_root" -+} - --# some applications need this, but should check for NCURSES_VERSION --cat >>confdefs.h <<\EOF --#define NCURSES 1 --EOF -+test "x/usr/local" != "x$prefix" && \ -+test -d "/usr/local" && \ -+(test -z "$prefix" || test x$prefix = xNONE || test "x/usr/local" != "x$prefix") && { -+ test -n "$verbose" && echo " ... testing for lib-directories under /usr/local" -+ test -d /usr/local/lib && cf_search="$cf_search /usr/local/lib" -+ test -d /usr/local/lib/$cf_nculib_root && cf_search="$cf_search /usr/local/lib/$cf_nculib_root" -+ test -d /usr/local/lib/$cf_nculib_root/lib && cf_search="$cf_search /usr/local/lib/$cf_nculib_root/lib" -+ test -d /usr/local/$cf_nculib_root/lib && cf_search="$cf_search /usr/local/$cf_nculib_root/lib" -+ test -d /usr/local/$cf_nculib_root/lib/$cf_nculib_root && cf_search="$cf_search /usr/local/$cf_nculib_root/lib/$cf_nculib_root" -+} - --echo "$as_me:6661: checking for ncurses version" >&5 --echo $ECHO_N "checking for ncurses version... $ECHO_C" >&6 --if test "${cf_cv_ncurses_version+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 --else -+test "x/opt" != "x$prefix" && \ -+test -d "/opt" && \ -+(test -z "$prefix" || test x$prefix = xNONE || test "x/opt" != "x$prefix") && { -+ test -n "$verbose" && echo " ... testing for lib-directories under /opt" -+ test -d /opt/lib && cf_search="$cf_search /opt/lib" -+ test -d /opt/lib/$cf_nculib_root && cf_search="$cf_search /opt/lib/$cf_nculib_root" -+ test -d /opt/lib/$cf_nculib_root/lib && cf_search="$cf_search /opt/lib/$cf_nculib_root/lib" -+ test -d /opt/$cf_nculib_root/lib && cf_search="$cf_search /opt/$cf_nculib_root/lib" -+ test -d /opt/$cf_nculib_root/lib/$cf_nculib_root && cf_search="$cf_search /opt/$cf_nculib_root/lib/$cf_nculib_root" -+} - -- cf_cv_ncurses_version=no -- cf_tempfile=out$$ -- rm -f $cf_tempfile -- if test "$cross_compiling" = yes; then -+test "x$HOME" != "x$prefix" && \ -+test -d "$HOME" && \ -+(test -z "$prefix" || test x$prefix = xNONE || test "x$HOME" != "x$prefix") && { -+ test -n "$verbose" && echo " ... testing for lib-directories under $HOME" -+ test -d $HOME/lib && cf_search="$cf_search $HOME/lib" -+ test -d $HOME/lib/$cf_nculib_root && cf_search="$cf_search $HOME/lib/$cf_nculib_root" -+ test -d $HOME/lib/$cf_nculib_root/lib && cf_search="$cf_search $HOME/lib/$cf_nculib_root/lib" -+ test -d $HOME/$cf_nculib_root/lib && cf_search="$cf_search $HOME/$cf_nculib_root/lib" -+ test -d $HOME/$cf_nculib_root/lib/$cf_nculib_root && cf_search="$cf_search $HOME/$cf_nculib_root/lib/$cf_nculib_root" -+} - -- # This will not work if the preprocessor splits the line after the -- # Autoconf token. The 'unproto' program does that. -- cat > conftest.$ac_ext <<EOF --#include <${cf_cv_ncurses_header:-curses.h}> --#undef Autoconf --#ifdef NCURSES_VERSION --Autoconf NCURSES_VERSION --#else --#ifdef __NCURSES_H --Autoconf "old" --#endif --; --#endif --EOF -- cf_try="$ac_cpp conftest.$ac_ext 2>&5 | grep '^Autoconf ' >conftest.out" -- { (eval echo "$as_me:6687: \"$cf_try\"") >&5 -- (eval $cf_try) 2>&5 -- ac_status=$? -- echo "$as_me:6690: \$? = $ac_status" >&5 -- (exit $ac_status); } -- if test -f conftest.out ; then -- cf_out=`cat conftest.out | sed -e 's%^Autoconf %%' -e 's%^[^"]*"%%' -e 's%".*%%'` -- test -n "$cf_out" && cf_cv_ncurses_version="$cf_out" -- rm -f conftest.out -- fi -+cf_search="$cf_library_path_list $cf_search" - --else -- cat >conftest.$ac_ext <<_ACEOF --#line 6700 "configure" -+ for cf_libdir in $cf_search -+ do -+ echo "$as_me:6725: checking for -l$cf_nculib_root in $cf_libdir" >&5 -+echo $ECHO_N "checking for -l$cf_nculib_root in $cf_libdir... $ECHO_C" >&6 -+ LIBS="-L$cf_libdir -l$cf_nculib_root $cf_save_LIBS" -+ cat >conftest.$ac_ext <<_ACEOF -+#line 6729 "configure" - #include "confdefs.h" -- - #include <${cf_cv_ncurses_header:-curses.h}> --#include <stdio.h> --int main() -+int -+main () - { -- FILE *fp = fopen("$cf_tempfile", "w"); --#ifdef NCURSES_VERSION --# ifdef NCURSES_VERSION_PATCH -- fprintf(fp, "%s.%d\n", NCURSES_VERSION, NCURSES_VERSION_PATCH); --# else -- fprintf(fp, "%s\n", NCURSES_VERSION); --# endif --#else --# ifdef __NCURSES_H -- fprintf(fp, "old\n"); --# else -- make an error --# endif --#endif -- ${cf_cv_main_return:-return}(0); -+initscr() -+ ; -+ return 0; - } - _ACEOF --rm -f conftest$ac_exeext --if { (eval echo "$as_me:6725: \"$ac_link\"") >&5 -+rm -f conftest.$ac_objext conftest$ac_exeext -+if { (eval echo "$as_me:6741: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:6728: \$? = $ac_status" >&5 -- (exit $ac_status); } && { ac_try='./conftest$ac_exeext' -- { (eval echo "$as_me:6730: \"$ac_try\"") >&5 -+ echo "$as_me:6744: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -s conftest$ac_exeext' -+ { (eval echo "$as_me:6747: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:6733: \$? = $ac_status" >&5 -+ echo "$as_me:6750: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- -- cf_cv_ncurses_version=`cat $cf_tempfile` -+ echo "$as_me:6752: result: yes" >&5 -+echo "${ECHO_T}yes" >&6 -+ eval 'cf_cv_have_lib_'$cf_nculib_root'=yes' -+ break - else -- echo "$as_me: program exited with status $ac_status" >&5 --echo "$as_me: failed program was:" >&5 -+ echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 -+echo "$as_me:6759: result: no" >&5 -+echo "${ECHO_T}no" >&6 -+ LIBS="$cf_save_LIBS" - fi --rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -+ done -+ - fi -- rm -f $cf_tempfile -+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - - fi --echo "$as_me:6747: result: $cf_cv_ncurses_version" >&5 --echo "${ECHO_T}$cf_cv_ncurses_version" >&6 --test "$cf_cv_ncurses_version" = no || cat >>confdefs.h <<\EOF --#define NCURSES 1 --EOF - --cf_nculib_root=ncurses -- # This works, except for the special case where we find gpm, but -- # ncurses is in a nonstandard location via $LIBS, and we really want -- # to link gpm. --cf_ncurses_LIBS="" --cf_ncurses_SAVE="$LIBS" --echo "$as_me:6759: checking for Gpm_Open in -lgpm" >&5 --echo $ECHO_N "checking for Gpm_Open in -lgpm... $ECHO_C" >&6 --if test "${ac_cv_lib_gpm_Gpm_Open+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 --else -- ac_check_lib_save_LIBS=$LIBS --LIBS="-lgpm $LIBS" --cat >conftest.$ac_ext <<_ACEOF --#line 6767 "configure" --#include "confdefs.h" -+eval 'cf_found_library=$cf_cv_have_lib_'$cf_nculib_root - --/* Override any gcc2 internal prototype to avoid an error. */ --#ifdef __cplusplus --extern "C" --#endif --/* We use char because int might match the return type of a gcc2 -- builtin and then its argument prototype would still apply. */ --char Gpm_Open (); -+if test $cf_found_library = no ; then -+ { { echo "$as_me:6774: error: Cannot link $cf_nculib_root library" >&5 -+echo "$as_me: error: Cannot link $cf_nculib_root library" >&2;} -+ { (exit 1); exit 1; }; } -+fi -+ -+fi -+ -+if test -n "$cf_ncurses_LIBS" ; then -+ echo "$as_me:6782: checking if we can link $cf_nculib_root without $cf_ncurses_LIBS" >&5 -+echo $ECHO_N "checking if we can link $cf_nculib_root without $cf_ncurses_LIBS... $ECHO_C" >&6 -+ cf_ncurses_SAVE="$LIBS" -+ for p in $cf_ncurses_LIBS ; do -+ q=`echo $LIBS | sed -e "s%$p %%" -e "s%$p$%%"` -+ if test "$q" != "$LIBS" ; then -+ LIBS="$q" -+ fi -+ done -+ cat >conftest.$ac_ext <<_ACEOF -+#line 6792 "configure" -+#include "confdefs.h" -+#include <${cf_cv_ncurses_header:-curses.h}> - int - main () - { --Gpm_Open (); -+initscr(); mousemask(0,0); tgoto((char *)0, 0, 0); - ; - return 0; - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:6786: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:6804: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:6789: \$? = $ac_status" >&5 -+ echo "$as_me:6807: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:6792: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:6810: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:6795: \$? = $ac_status" >&5 -+ echo "$as_me:6813: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- ac_cv_lib_gpm_Gpm_Open=yes -+ echo "$as_me:6815: result: yes" >&5 -+echo "${ECHO_T}yes" >&6 - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --ac_cv_lib_gpm_Gpm_Open=no -+echo "$as_me:6820: result: no" >&5 -+echo "${ECHO_T}no" >&6 -+ LIBS="$cf_ncurses_SAVE" - fi - rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext --LIBS=$ac_check_lib_save_LIBS - fi --echo "$as_me:6806: result: $ac_cv_lib_gpm_Gpm_Open" >&5 --echo "${ECHO_T}$ac_cv_lib_gpm_Gpm_Open" >&6 --if test $ac_cv_lib_gpm_Gpm_Open = yes; then -- echo "$as_me:6809: checking for initscr in -lgpm" >&5 --echo $ECHO_N "checking for initscr in -lgpm... $ECHO_C" >&6 --if test "${ac_cv_lib_gpm_initscr+set}" = set; then -+ -+cf_nculib_ROOT=`echo "HAVE_LIB$cf_nculib_root" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` -+ -+cat >>confdefs.h <<EOF -+#define $cf_nculib_ROOT 1 -+EOF -+ -+fi -+ -+ ;; -+ncursesw) #(vi -+ -+echo "$as_me:6838: checking for multibyte character support" >&5 -+echo $ECHO_N "checking for multibyte character support... $ECHO_C" >&6 -+if test "${cf_cv_utf8_lib+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else -- ac_check_lib_save_LIBS=$LIBS --LIBS="-lgpm $LIBS" --cat >conftest.$ac_ext <<_ACEOF --#line 6817 "configure" -+ -+ cf_save_LIBS="$LIBS" -+ cat >conftest.$ac_ext <<_ACEOF -+#line 6846 "configure" - #include "confdefs.h" - --/* Override any gcc2 internal prototype to avoid an error. */ --#ifdef __cplusplus --extern "C" --#endif --/* We use char because int might match the return type of a gcc2 -- builtin and then its argument prototype would still apply. */ --char initscr (); -+#include <stdlib.h> - int - main () - { --initscr (); -+putwc(0,0); - ; - return 0; - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:6836: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:6859: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:6839: \$? = $ac_status" >&5 -+ echo "$as_me:6862: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:6842: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:6865: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:6845: \$? = $ac_status" >&5 -+ echo "$as_me:6868: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- ac_cv_lib_gpm_initscr=yes -+ cf_cv_utf8_lib=yes - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --ac_cv_lib_gpm_initscr=no --fi --rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext --LIBS=$ac_check_lib_save_LIBS --fi --echo "$as_me:6856: result: $ac_cv_lib_gpm_initscr" >&5 --echo "${ECHO_T}$ac_cv_lib_gpm_initscr" >&6 --if test $ac_cv_lib_gpm_initscr = yes; then -- LIBS="$cf_ncurses_SAVE" --else -- cf_ncurses_LIBS="-lgpm" --fi - --fi -+# If the linkage is not already in the $CPPFLAGS/$LDFLAGS configuration, these -+# will be set on completion of the AC_TRY_LINK below. -+cf_cv_header_path_utf8= -+cf_cv_library_path_utf8= -+ -+echo "${as_me:-configure}:6880: testing Starting FIND_LINKAGE(utf8,) ..." 1>&5 -+ -+cf_save_LIBS="$LIBS" - --case $host_os in #(vi --freebsd*) -- # This is only necessary if you are linking against an obsolete -- # version of ncurses (but it should do no harm, since it's static). -- if test "$cf_nculib_root" = ncurses ; then -- echo "$as_me:6871: checking for tgoto in -lmytinfo" >&5 --echo $ECHO_N "checking for tgoto in -lmytinfo... $ECHO_C" >&6 --if test "${ac_cv_lib_mytinfo_tgoto+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 --else -- ac_check_lib_save_LIBS=$LIBS --LIBS="-lmytinfo $LIBS" - cat >conftest.$ac_ext <<_ACEOF --#line 6879 "configure" -+#line 6885 "configure" - #include "confdefs.h" - --/* Override any gcc2 internal prototype to avoid an error. */ --#ifdef __cplusplus --extern "C" --#endif --/* We use char because int might match the return type of a gcc2 -- builtin and then its argument prototype would still apply. */ --char tgoto (); -+#include <libutf8.h> - int - main () - { --tgoto (); -+putwc(0,0); - ; - return 0; - } -@@ -6906,133 +6906,227 @@ - ac_status=$? - echo "$as_me:6907: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- ac_cv_lib_mytinfo_tgoto=yes -+ -+ cf_cv_find_linkage_utf8=yes -+ cf_cv_header_path_utf8=/usr/include -+ cf_cv_library_path_utf8=/usr/lib -+ - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --ac_cv_lib_mytinfo_tgoto=no --fi --rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext --LIBS=$ac_check_lib_save_LIBS --fi --echo "$as_me:6918: result: $ac_cv_lib_mytinfo_tgoto" >&5 --echo "${ECHO_T}$ac_cv_lib_mytinfo_tgoto" >&6 --if test $ac_cv_lib_mytinfo_tgoto = yes; then -- cf_ncurses_LIBS="-lmytinfo $cf_ncurses_LIBS" --fi - -- fi -- ;; --esac -- --LIBS="$cf_ncurses_LIBS $LIBS" -- --if ( test -n "$cf_cv_curses_dir" && test "$cf_cv_curses_dir" != "no" ) --then -- LIBS="-l$cf_nculib_root $LIBS" --else -+LIBS="-lutf8 $cf_save_LIBS" - -- eval 'cf_cv_have_lib_'$cf_nculib_root'=no' -- cf_libdir="" -- echo "$as_me:6937: checking for initscr" >&5 --echo $ECHO_N "checking for initscr... $ECHO_C" >&6 --if test "${ac_cv_func_initscr+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 --else -- cat >conftest.$ac_ext <<_ACEOF --#line 6943 "configure" -+cat >conftest.$ac_ext <<_ACEOF -+#line 6921 "configure" - #include "confdefs.h" --/* System header to define __stub macros and hopefully few prototypes, -- which can conflict with char initscr (); below. */ --#include <assert.h> --/* Override any gcc2 internal prototype to avoid an error. */ --#ifdef __cplusplus --extern "C" --#endif --/* We use char because int might match the return type of a gcc2 -- builtin and then its argument prototype would still apply. */ --char initscr (); --char (*f) (); - -+#include <libutf8.h> - int - main () - { --/* The GNU C library defines this for functions which it implements -- to always fail with ENOSYS. Some functions are actually named -- something starting with __ and the normal name is an alias. */ --#if defined (__stub_initscr) || defined (__stub___initscr) --choke me --#else --f = initscr; --#endif -- -+putwc(0,0); - ; - return 0; - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:6974: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:6934: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:6977: \$? = $ac_status" >&5 -+ echo "$as_me:6937: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:6980: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:6940: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:6983: \$? = $ac_status" >&5 -+ echo "$as_me:6943: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- ac_cv_func_initscr=yes -+ -+ cf_cv_find_linkage_utf8=yes -+ cf_cv_header_path_utf8=/usr/include -+ cf_cv_library_path_utf8=/usr/lib -+ cf_cv_library_file_utf8="-lutf8" -+ - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --ac_cv_func_initscr=no --fi --rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -+ -+ cf_cv_find_linkage_utf8=no -+ LIBS="$cf_save_LIBS" -+ -+ test -n "$verbose" && echo " find linkage for utf8 library" 1>&6 -+ -+echo "${as_me:-configure}:6960: testing find linkage for utf8 library ..." 1>&5 -+ -+echo "${as_me:-configure}:6962: testing Searching for headers in FIND_LINKAGE(utf8,) ..." 1>&5 -+ -+ cf_save_CPPFLAGS="$CPPFLAGS" -+ cf_test_CPPFLAGS="$CPPFLAGS" -+ -+cf_search= -+ -+# collect the current set of include-directories from compiler flags -+cf_header_path_list="" -+if test -n "${CFLAGS}${CPPFLAGS}" ; then -+ for cf_header_path in $CPPFLAGS $CFLAGS -+ do -+ case $cf_header_path in #(vi -+ -I*) -+ cf_header_path=`echo ".$cf_header_path" |sed -e 's/^...//' -e 's,/include$,,'` -+ -+test "x$cf_header_path" != "xNONE" && \ -+test -d "$cf_header_path" && \ -+ { -+ test -n "$verbose" && echo " ... testing for include-directories under $cf_header_path" -+ test -d $cf_header_path/include && cf_search="$cf_search $cf_header_path/include" -+ test -d $cf_header_path/include/utf8 && cf_search="$cf_search $cf_header_path/include/utf8" -+ test -d $cf_header_path/include/utf8/include && cf_search="$cf_search $cf_header_path/include/utf8/include" -+ test -d $cf_header_path/utf8/include && cf_search="$cf_search $cf_header_path/utf8/include" -+ test -d $cf_header_path/utf8/include/utf8 && cf_search="$cf_search $cf_header_path/utf8/include/utf8" -+} -+ -+ cf_header_path_list="$cf_header_path_list $cf_search" -+ ;; -+ esac -+ done - fi --echo "$as_me:6993: result: $ac_cv_func_initscr" >&5 --echo "${ECHO_T}$ac_cv_func_initscr" >&6 --if test $ac_cv_func_initscr = yes; then -- eval 'cf_cv_have_lib_'$cf_nculib_root'=yes' --else - -- cf_save_LIBS="$LIBS" -- echo "$as_me:7000: checking for initscr in -l$cf_nculib_root" >&5 --echo $ECHO_N "checking for initscr in -l$cf_nculib_root... $ECHO_C" >&6 -- LIBS="-l$cf_nculib_root $LIBS" -- cat >conftest.$ac_ext <<_ACEOF --#line 7004 "configure" -+# add the variations for the package we are looking for -+ -+cf_search= -+ -+test "x/usr" != "x$prefix" && \ -+test -d "/usr" && \ -+(test -z "$prefix" || test x$prefix = xNONE || test "x/usr" != "x$prefix") && { -+ test -n "$verbose" && echo " ... testing for include-directories under /usr" -+ test -d /usr/include && cf_search="$cf_search /usr/include" -+ test -d /usr/include/utf8 && cf_search="$cf_search /usr/include/utf8" -+ test -d /usr/include/utf8/include && cf_search="$cf_search /usr/include/utf8/include" -+ test -d /usr/utf8/include && cf_search="$cf_search /usr/utf8/include" -+ test -d /usr/utf8/include/utf8 && cf_search="$cf_search /usr/utf8/include/utf8" -+} -+ -+test "x$prefix" != "xNONE" && \ -+test -d "$prefix" && \ -+ { -+ test -n "$verbose" && echo " ... testing for include-directories under $prefix" -+ test -d $prefix/include && cf_search="$cf_search $prefix/include" -+ test -d $prefix/include/utf8 && cf_search="$cf_search $prefix/include/utf8" -+ test -d $prefix/include/utf8/include && cf_search="$cf_search $prefix/include/utf8/include" -+ test -d $prefix/utf8/include && cf_search="$cf_search $prefix/utf8/include" -+ test -d $prefix/utf8/include/utf8 && cf_search="$cf_search $prefix/utf8/include/utf8" -+} -+ -+test "x/usr/local" != "x$prefix" && \ -+test -d "/usr/local" && \ -+(test -z "$prefix" || test x$prefix = xNONE || test "x/usr/local" != "x$prefix") && { -+ test -n "$verbose" && echo " ... testing for include-directories under /usr/local" -+ test -d /usr/local/include && cf_search="$cf_search /usr/local/include" -+ test -d /usr/local/include/utf8 && cf_search="$cf_search /usr/local/include/utf8" -+ test -d /usr/local/include/utf8/include && cf_search="$cf_search /usr/local/include/utf8/include" -+ test -d /usr/local/utf8/include && cf_search="$cf_search /usr/local/utf8/include" -+ test -d /usr/local/utf8/include/utf8 && cf_search="$cf_search /usr/local/utf8/include/utf8" -+} -+ -+test "x/opt" != "x$prefix" && \ -+test -d "/opt" && \ -+(test -z "$prefix" || test x$prefix = xNONE || test "x/opt" != "x$prefix") && { -+ test -n "$verbose" && echo " ... testing for include-directories under /opt" -+ test -d /opt/include && cf_search="$cf_search /opt/include" -+ test -d /opt/include/utf8 && cf_search="$cf_search /opt/include/utf8" -+ test -d /opt/include/utf8/include && cf_search="$cf_search /opt/include/utf8/include" -+ test -d /opt/utf8/include && cf_search="$cf_search /opt/utf8/include" -+ test -d /opt/utf8/include/utf8 && cf_search="$cf_search /opt/utf8/include/utf8" -+} -+ -+test "x$HOME" != "x$prefix" && \ -+test -d "$HOME" && \ -+(test -z "$prefix" || test x$prefix = xNONE || test "x$HOME" != "x$prefix") && { -+ test -n "$verbose" && echo " ... testing for include-directories under $HOME" -+ test -d $HOME/include && cf_search="$cf_search $HOME/include" -+ test -d $HOME/include/utf8 && cf_search="$cf_search $HOME/include/utf8" -+ test -d $HOME/include/utf8/include && cf_search="$cf_search $HOME/include/utf8/include" -+ test -d $HOME/utf8/include && cf_search="$cf_search $HOME/utf8/include" -+ test -d $HOME/utf8/include/utf8 && cf_search="$cf_search $HOME/utf8/include/utf8" -+} -+ -+test "$includedir" != NONE && \ -+test "$includedir" != "/usr/include" && \ -+test -d "$includedir" && { -+ test -d $includedir && cf_search="$cf_search $includedir" -+ test -d $includedir/utf8 && cf_search="$cf_search $includedir/utf8" -+} -+ -+test "$oldincludedir" != NONE && \ -+test "$oldincludedir" != "/usr/include" && \ -+test -d "$oldincludedir" && { -+ test -d $oldincludedir && cf_search="$cf_search $oldincludedir" -+ test -d $oldincludedir/utf8 && cf_search="$cf_search $oldincludedir/utf8" -+} -+ -+cf_search="$cf_search $cf_header_path_list" -+ -+ for cf_cv_header_path_utf8 in $cf_search -+ do -+ if test -d $cf_cv_header_path_utf8 ; then -+ test -n "$verbose" && echo " ... testing $cf_cv_header_path_utf8" 1>&6 -+ -+echo "${as_me:-configure}:7075: testing ... testing $cf_cv_header_path_utf8 ..." 1>&5 -+ -+ CPPFLAGS="$cf_save_CPPFLAGS -I$cf_cv_header_path_utf8" -+ cat >conftest.$ac_ext <<_ACEOF -+#line 7079 "configure" - #include "confdefs.h" --#include <${cf_cv_ncurses_header:-curses.h}> -+ -+#include <libutf8.h> - int - main () - { --initscr() -+putwc(0,0); - ; - return 0; - } - _ACEOF --rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:7016: \"$ac_link\"") >&5 -- (eval $ac_link) 2>&5 -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:7092: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:7019: \$? = $ac_status" >&5 -+ echo "$as_me:7095: \$? = $ac_status" >&5 - (exit $ac_status); } && -- { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:7022: \"$ac_try\"") >&5 -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:7098: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:7025: \$? = $ac_status" >&5 -+ echo "$as_me:7101: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- echo "$as_me:7027: result: yes" >&5 --echo "${ECHO_T}yes" >&6 -- eval 'cf_cv_have_lib_'$cf_nculib_root'=yes' - -+ test -n "$verbose" && echo " ... found utf8 headers in $cf_cv_header_path_utf8" 1>&6 -+ -+echo "${as_me:-configure}:7106: testing ... found utf8 headers in $cf_cv_header_path_utf8 ..." 1>&5 -+ -+ cf_cv_find_linkage_utf8=maybe -+ cf_test_CPPFLAGS="$CPPFLAGS" -+ break - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --echo "$as_me:7034: result: no" >&5 --echo "${ECHO_T}no" >&6 -+ -+ CPPFLAGS="$cf_save_CPPFLAGS" -+ -+fi -+rm -f conftest.$ac_objext conftest.$ac_ext -+ fi -+ done -+ -+ if test "$cf_cv_find_linkage_utf8" = maybe ; then -+ -+echo "${as_me:-configure}:7124: testing Searching for utf8 library in FIND_LINKAGE(utf8,) ..." 1>&5 -+ -+ cf_save_LIBS="$LIBS" -+ cf_save_LDFLAGS="$LDFLAGS" -+ -+ if test "$cf_cv_find_linkage_utf8" != yes ; then - - cf_search= - cf_library_path_list="" -@@ -7043,15 +7137,15 @@ - -L*) - cf_library_path=`echo ".$cf_library_path" |sed -e 's/^...//' -e 's,/lib$,,'` - --test "$cf_library_path" != "NONE" && \ -+test "x$cf_library_path" != "xNONE" && \ - test -d "$cf_library_path" && \ - { - test -n "$verbose" && echo " ... testing for lib-directories under $cf_library_path" - test -d $cf_library_path/lib && cf_search="$cf_search $cf_library_path/lib" -- test -d $cf_library_path/lib/$cf_nculib_root && cf_search="$cf_search $cf_library_path/lib/$cf_nculib_root" -- test -d $cf_library_path/lib/$cf_nculib_root/lib && cf_search="$cf_search $cf_library_path/lib/$cf_nculib_root/lib" -- test -d $cf_library_path/$cf_nculib_root/lib && cf_search="$cf_search $cf_library_path/$cf_nculib_root/lib" -- test -d $cf_library_path/$cf_nculib_root/lib/$cf_nculib_root && cf_search="$cf_search $cf_library_path/$cf_nculib_root/lib/$cf_nculib_root" -+ test -d $cf_library_path/lib/utf8 && cf_search="$cf_search $cf_library_path/lib/utf8" -+ test -d $cf_library_path/lib/utf8/lib && cf_search="$cf_search $cf_library_path/lib/utf8/lib" -+ test -d $cf_library_path/utf8/lib && cf_search="$cf_search $cf_library_path/utf8/lib" -+ test -d $cf_library_path/utf8/lib/utf8 && cf_search="$cf_search $cf_library_path/utf8/lib/utf8" - } - - cf_library_path_list="$cf_library_path_list $cf_search" -@@ -7062,307 +7156,638 @@ - - cf_search= - --test "/usr" != "$prefix" && \ -+test "x/usr" != "x$prefix" && \ - test -d "/usr" && \ --(test $prefix = NONE || test "/usr" != "$prefix") && { -+(test -z "$prefix" || test x$prefix = xNONE || test "x/usr" != "x$prefix") && { - test -n "$verbose" && echo " ... testing for lib-directories under /usr" - test -d /usr/lib && cf_search="$cf_search /usr/lib" -- test -d /usr/lib/$cf_nculib_root && cf_search="$cf_search /usr/lib/$cf_nculib_root" -- test -d /usr/lib/$cf_nculib_root/lib && cf_search="$cf_search /usr/lib/$cf_nculib_root/lib" -- test -d /usr/$cf_nculib_root/lib && cf_search="$cf_search /usr/$cf_nculib_root/lib" -- test -d /usr/$cf_nculib_root/lib/$cf_nculib_root && cf_search="$cf_search /usr/$cf_nculib_root/lib/$cf_nculib_root" -+ test -d /usr/lib/utf8 && cf_search="$cf_search /usr/lib/utf8" -+ test -d /usr/lib/utf8/lib && cf_search="$cf_search /usr/lib/utf8/lib" -+ test -d /usr/utf8/lib && cf_search="$cf_search /usr/utf8/lib" -+ test -d /usr/utf8/lib/utf8 && cf_search="$cf_search /usr/utf8/lib/utf8" - } - --test "$prefix" != "NONE" && \ -+test "x$prefix" != "xNONE" && \ - test -d "$prefix" && \ - { - test -n "$verbose" && echo " ... testing for lib-directories under $prefix" - test -d $prefix/lib && cf_search="$cf_search $prefix/lib" -- test -d $prefix/lib/$cf_nculib_root && cf_search="$cf_search $prefix/lib/$cf_nculib_root" -- test -d $prefix/lib/$cf_nculib_root/lib && cf_search="$cf_search $prefix/lib/$cf_nculib_root/lib" -- test -d $prefix/$cf_nculib_root/lib && cf_search="$cf_search $prefix/$cf_nculib_root/lib" -- test -d $prefix/$cf_nculib_root/lib/$cf_nculib_root && cf_search="$cf_search $prefix/$cf_nculib_root/lib/$cf_nculib_root" -+ test -d $prefix/lib/utf8 && cf_search="$cf_search $prefix/lib/utf8" -+ test -d $prefix/lib/utf8/lib && cf_search="$cf_search $prefix/lib/utf8/lib" -+ test -d $prefix/utf8/lib && cf_search="$cf_search $prefix/utf8/lib" -+ test -d $prefix/utf8/lib/utf8 && cf_search="$cf_search $prefix/utf8/lib/utf8" - } - --test "/usr/local" != "$prefix" && \ -+test "x/usr/local" != "x$prefix" && \ - test -d "/usr/local" && \ --(test $prefix = NONE || test "/usr/local" != "$prefix") && { -+(test -z "$prefix" || test x$prefix = xNONE || test "x/usr/local" != "x$prefix") && { - test -n "$verbose" && echo " ... testing for lib-directories under /usr/local" - test -d /usr/local/lib && cf_search="$cf_search /usr/local/lib" -- test -d /usr/local/lib/$cf_nculib_root && cf_search="$cf_search /usr/local/lib/$cf_nculib_root" -- test -d /usr/local/lib/$cf_nculib_root/lib && cf_search="$cf_search /usr/local/lib/$cf_nculib_root/lib" -- test -d /usr/local/$cf_nculib_root/lib && cf_search="$cf_search /usr/local/$cf_nculib_root/lib" -- test -d /usr/local/$cf_nculib_root/lib/$cf_nculib_root && cf_search="$cf_search /usr/local/$cf_nculib_root/lib/$cf_nculib_root" -+ test -d /usr/local/lib/utf8 && cf_search="$cf_search /usr/local/lib/utf8" -+ test -d /usr/local/lib/utf8/lib && cf_search="$cf_search /usr/local/lib/utf8/lib" -+ test -d /usr/local/utf8/lib && cf_search="$cf_search /usr/local/utf8/lib" -+ test -d /usr/local/utf8/lib/utf8 && cf_search="$cf_search /usr/local/utf8/lib/utf8" - } - --test "/opt" != "$prefix" && \ -+test "x/opt" != "x$prefix" && \ - test -d "/opt" && \ --(test $prefix = NONE || test "/opt" != "$prefix") && { -+(test -z "$prefix" || test x$prefix = xNONE || test "x/opt" != "x$prefix") && { - test -n "$verbose" && echo " ... testing for lib-directories under /opt" - test -d /opt/lib && cf_search="$cf_search /opt/lib" -- test -d /opt/lib/$cf_nculib_root && cf_search="$cf_search /opt/lib/$cf_nculib_root" -- test -d /opt/lib/$cf_nculib_root/lib && cf_search="$cf_search /opt/lib/$cf_nculib_root/lib" -- test -d /opt/$cf_nculib_root/lib && cf_search="$cf_search /opt/$cf_nculib_root/lib" -- test -d /opt/$cf_nculib_root/lib/$cf_nculib_root && cf_search="$cf_search /opt/$cf_nculib_root/lib/$cf_nculib_root" --} -+ test -d /opt/lib/utf8 && cf_search="$cf_search /opt/lib/utf8" -+ test -d /opt/lib/utf8/lib && cf_search="$cf_search /opt/lib/utf8/lib" -+ test -d /opt/utf8/lib && cf_search="$cf_search /opt/utf8/lib" -+ test -d /opt/utf8/lib/utf8 && cf_search="$cf_search /opt/utf8/lib/utf8" -+} - --test "$HOME" != "$prefix" && \ -+test "x$HOME" != "x$prefix" && \ - test -d "$HOME" && \ --(test $prefix = NONE || test "$HOME" != "$prefix") && { -+(test -z "$prefix" || test x$prefix = xNONE || test "x$HOME" != "x$prefix") && { - test -n "$verbose" && echo " ... testing for lib-directories under $HOME" - test -d $HOME/lib && cf_search="$cf_search $HOME/lib" -- test -d $HOME/lib/$cf_nculib_root && cf_search="$cf_search $HOME/lib/$cf_nculib_root" -- test -d $HOME/lib/$cf_nculib_root/lib && cf_search="$cf_search $HOME/lib/$cf_nculib_root/lib" -- test -d $HOME/$cf_nculib_root/lib && cf_search="$cf_search $HOME/$cf_nculib_root/lib" -- test -d $HOME/$cf_nculib_root/lib/$cf_nculib_root && cf_search="$cf_search $HOME/$cf_nculib_root/lib/$cf_nculib_root" -+ test -d $HOME/lib/utf8 && cf_search="$cf_search $HOME/lib/utf8" -+ test -d $HOME/lib/utf8/lib && cf_search="$cf_search $HOME/lib/utf8/lib" -+ test -d $HOME/utf8/lib && cf_search="$cf_search $HOME/utf8/lib" -+ test -d $HOME/utf8/lib/utf8 && cf_search="$cf_search $HOME/utf8/lib/utf8" - } - - cf_search="$cf_library_path_list $cf_search" - -- for cf_libdir in $cf_search -- do -- echo "$as_me:7124: checking for -l$cf_nculib_root in $cf_libdir" >&5 --echo $ECHO_N "checking for -l$cf_nculib_root in $cf_libdir... $ECHO_C" >&6 -- LIBS="-L$cf_libdir -l$cf_nculib_root $cf_save_LIBS" -- cat >conftest.$ac_ext <<_ACEOF --#line 7128 "configure" -+ for cf_cv_library_path_utf8 in $cf_search -+ do -+ if test -d $cf_cv_library_path_utf8 ; then -+ test -n "$verbose" && echo " ... testing $cf_cv_library_path_utf8" 1>&6 -+ -+echo "${as_me:-configure}:7221: testing ... testing $cf_cv_library_path_utf8 ..." 1>&5 -+ -+ CPPFLAGS="$cf_test_CPPFLAGS" -+ LIBS="-lutf8 $cf_save_LIBS" -+ LDFLAGS="$cf_save_LDFLAGS -L$cf_cv_library_path_utf8" -+ cat >conftest.$ac_ext <<_ACEOF -+#line 7227 "configure" - #include "confdefs.h" --#include <${cf_cv_ncurses_header:-curses.h}> -+ -+#include <libutf8.h> - int - main () - { --initscr() -+putwc(0,0); - ; - return 0; - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:7140: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:7240: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:7143: \$? = $ac_status" >&5 -+ echo "$as_me:7243: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:7146: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:7246: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:7149: \$? = $ac_status" >&5 -+ echo "$as_me:7249: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- echo "$as_me:7151: result: yes" >&5 --echo "${ECHO_T}yes" >&6 -- eval 'cf_cv_have_lib_'$cf_nculib_root'=yes' -- break -+ -+ test -n "$verbose" && echo " ... found utf8 library in $cf_cv_library_path_utf8" 1>&6 -+ -+echo "${as_me:-configure}:7254: testing ... found utf8 library in $cf_cv_library_path_utf8 ..." 1>&5 -+ -+ cf_cv_find_linkage_utf8=yes -+ cf_cv_library_file_utf8="-lutf8" -+ break - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --echo "$as_me:7158: result: no" >&5 --echo "${ECHO_T}no" >&6 -- LIBS="$cf_save_LIBS" -+ -+ CPPFLAGS="$cf_save_CPPFLAGS" -+ LIBS="$cf_save_LIBS" -+ LDFLAGS="$cf_save_LDFLAGS" -+ - fi - rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -- done -+ fi -+ done -+ CPPFLAGS="$cf_save_CPPFLAGS" -+ LDFLAGS="$cf_save_LDFLAGS" -+ fi -+ -+ else -+ cf_cv_find_linkage_utf8=no -+ fi - - fi - rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - - fi -+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - --eval 'cf_found_library=$cf_cv_have_lib_'$cf_nculib_root -+LIBS="$cf_save_LIBS" - --if test $cf_found_library = no ; then -- { { echo "$as_me:7173: error: Cannot link $cf_nculib_root library" >&5 --echo "$as_me: error: Cannot link $cf_nculib_root library" >&2;} -- { (exit 1); exit 1; }; } -+if test "$cf_cv_find_linkage_utf8" = yes ; then -+cf_cv_utf8_lib=add-on -+else -+cf_cv_utf8_lib=no - fi - - fi -+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -+fi -+echo "$as_me:7296: result: $cf_cv_utf8_lib" >&5 -+echo "${ECHO_T}$cf_cv_utf8_lib" >&6 - --if test -n "$cf_ncurses_LIBS" ; then -- echo "$as_me:7181: checking if we can link $cf_nculib_root without $cf_ncurses_LIBS" >&5 --echo $ECHO_N "checking if we can link $cf_nculib_root without $cf_ncurses_LIBS... $ECHO_C" >&6 -- cf_ncurses_SAVE="$LIBS" -- for p in $cf_ncurses_LIBS ; do -- q=`echo $LIBS | sed -e "s%$p %%" -e "s%$p$%%"` -- if test "$q" != "$LIBS" ; then -- LIBS="$q" -+# HAVE_LIBUTF8_H is used by ncurses if curses.h is shared between -+# ncurses/ncursesw: -+if test "$cf_cv_utf8_lib" = "add-on" ; then -+ -+cat >>confdefs.h <<\EOF -+#define HAVE_LIBUTF8_H 1 -+EOF -+ -+if test -n "$cf_cv_header_path_utf8" ; then -+ for cf_add_incdir in $cf_cv_header_path_utf8 -+ do -+ while test $cf_add_incdir != /usr/include -+ do -+ if test -d $cf_add_incdir -+ then -+ cf_have_incdir=no -+ if test -n "$CFLAGS$CPPFLAGS" ; then -+ # a loop is needed to ensure we can add subdirs of existing dirs -+ for cf_test_incdir in $CFLAGS $CPPFLAGS ; do -+ if test ".$cf_test_incdir" = ".-I$cf_add_incdir" ; then -+ cf_have_incdir=yes; break -+ fi -+ done - fi -- done -- cat >conftest.$ac_ext <<_ACEOF --#line 7191 "configure" -+ -+ if test "$cf_have_incdir" = no ; then -+ if test "$cf_add_incdir" = /usr/local/include ; then -+ if test "$GCC" = yes -+ then -+ cf_save_CPPFLAGS=$CPPFLAGS -+ CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" -+ cat >conftest.$ac_ext <<_ACEOF -+#line 7331 "configure" - #include "confdefs.h" --#include <${cf_cv_ncurses_header:-curses.h}> -+#include <stdio.h> - int - main () - { --initscr(); mousemask(0,0); tgoto((char *)0, 0, 0); -+printf("Hello") - ; - return 0; - } - _ACEOF --rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:7203: \"$ac_link\"") >&5 -- (eval $ac_link) 2>&5 -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:7343: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:7206: \$? = $ac_status" >&5 -+ echo "$as_me:7346: \$? = $ac_status" >&5 - (exit $ac_status); } && -- { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:7209: \"$ac_try\"") >&5 -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:7349: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:7212: \$? = $ac_status" >&5 -+ echo "$as_me:7352: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- echo "$as_me:7214: result: yes" >&5 --echo "${ECHO_T}yes" >&6 -+ : - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --echo "$as_me:7219: result: no" >&5 -+cf_have_incdir=yes -+fi -+rm -f conftest.$ac_objext conftest.$ac_ext -+ CPPFLAGS=$cf_save_CPPFLAGS -+ fi -+ fi -+ fi -+ -+ if test "$cf_have_incdir" = no ; then -+ test -n "$verbose" && echo " adding $cf_add_incdir to include-path" 1>&6 -+ -+echo "${as_me:-configure}:7369: testing adding $cf_add_incdir to include-path ..." 1>&5 -+ -+ CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" -+ -+ cf_top_incdir=`echo $cf_add_incdir | sed -e 's%/include/.*$%/include%'` -+ test "$cf_top_incdir" = "$cf_add_incdir" && break -+ cf_add_incdir="$cf_top_incdir" -+ else -+ break -+ fi -+ fi -+ done -+ done -+fi -+ -+if test -n "$cf_cv_library_path_utf8" ; then -+ for cf_add_libdir in $cf_cv_library_path_utf8 -+ do -+ if test $cf_add_libdir = /usr/lib ; then -+ : -+ elif test -d $cf_add_libdir -+ then -+ cf_have_libdir=no -+ if test -n "$LDFLAGS$LIBS" ; then -+ # a loop is needed to ensure we can add subdirs of existing dirs -+ for cf_test_libdir in $LDFLAGS $LIBS ; do -+ if test ".$cf_test_libdir" = ".-L$cf_add_libdir" ; then -+ cf_have_libdir=yes; break -+ fi -+ done -+ fi -+ if test "$cf_have_libdir" = no ; then -+ test -n "$verbose" && echo " adding $cf_add_libdir to library-path" 1>&6 -+ -+echo "${as_me:-configure}:7403: testing adding $cf_add_libdir to library-path ..." 1>&5 -+ -+ LDFLAGS="-L$cf_add_libdir $LDFLAGS" -+ fi -+ fi -+ done -+fi -+ -+ LIBS="$cf_cv_library_file_utf8 $LIBS" -+fi -+ -+cf_ncuconfig_root=ncursesw -+ -+echo "Looking for ${cf_ncuconfig_root}-config" -+ -+if test -n "$ac_tool_prefix"; then -+ for ac_prog in ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config -+ do -+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -+set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -+echo "$as_me:7423: checking for $ac_word" >&5 -+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -+if test "${ac_cv_prog_NCURSES_CONFIG+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ if test -n "$NCURSES_CONFIG"; then -+ ac_cv_prog_NCURSES_CONFIG="$NCURSES_CONFIG" # Let the user override the test. -+else -+ ac_save_IFS=$IFS; IFS=$ac_path_separator -+ac_dummy="$PATH" -+for ac_dir in $ac_dummy; do -+ IFS=$ac_save_IFS -+ test -z "$ac_dir" && ac_dir=. -+ $as_executable_p "$ac_dir/$ac_word" || continue -+ac_cv_prog_NCURSES_CONFIG="$ac_tool_prefix$ac_prog" -+echo "$as_me:7438: found $ac_dir/$ac_word" >&5 -+break -+done -+ -+fi -+fi -+NCURSES_CONFIG=$ac_cv_prog_NCURSES_CONFIG -+if test -n "$NCURSES_CONFIG"; then -+ echo "$as_me:7446: result: $NCURSES_CONFIG" >&5 -+echo "${ECHO_T}$NCURSES_CONFIG" >&6 -+else -+ echo "$as_me:7449: result: no" >&5 - echo "${ECHO_T}no" >&6 -- LIBS="$cf_ncurses_SAVE" - fi --rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -+ -+ test -n "$NCURSES_CONFIG" && break -+ done - fi -+if test -z "$NCURSES_CONFIG"; then -+ ac_ct_NCURSES_CONFIG=$NCURSES_CONFIG -+ for ac_prog in ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config -+do -+ # Extract the first word of "$ac_prog", so it can be a program name with args. -+set dummy $ac_prog; ac_word=$2 -+echo "$as_me:7462: checking for $ac_word" >&5 -+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -+if test "${ac_cv_prog_ac_ct_NCURSES_CONFIG+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ if test -n "$ac_ct_NCURSES_CONFIG"; then -+ ac_cv_prog_ac_ct_NCURSES_CONFIG="$ac_ct_NCURSES_CONFIG" # Let the user override the test. -+else -+ ac_save_IFS=$IFS; IFS=$ac_path_separator -+ac_dummy="$PATH" -+for ac_dir in $ac_dummy; do -+ IFS=$ac_save_IFS -+ test -z "$ac_dir" && ac_dir=. -+ $as_executable_p "$ac_dir/$ac_word" || continue -+ac_cv_prog_ac_ct_NCURSES_CONFIG="$ac_prog" -+echo "$as_me:7477: found $ac_dir/$ac_word" >&5 -+break -+done - --cf_nculib_ROOT=`echo "HAVE_LIB$cf_nculib_root" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` -+fi -+fi -+ac_ct_NCURSES_CONFIG=$ac_cv_prog_ac_ct_NCURSES_CONFIG -+if test -n "$ac_ct_NCURSES_CONFIG"; then -+ echo "$as_me:7485: result: $ac_ct_NCURSES_CONFIG" >&5 -+echo "${ECHO_T}$ac_ct_NCURSES_CONFIG" >&6 -+else -+ echo "$as_me:7488: result: no" >&5 -+echo "${ECHO_T}no" >&6 -+fi - --cat >>confdefs.h <<EOF --#define $cf_nculib_ROOT 1 --EOF -+ test -n "$ac_ct_NCURSES_CONFIG" && break -+done -+test -n "$ac_ct_NCURSES_CONFIG" || ac_ct_NCURSES_CONFIG="none" - -+ NCURSES_CONFIG=$ac_ct_NCURSES_CONFIG - fi - -- ;; --ncursesw) -- cf_cv_libtype=w -+if test "$NCURSES_CONFIG" != none ; then - --echo "$as_me:7238: checking for multibyte character support" >&5 --echo $ECHO_N "checking for multibyte character support... $ECHO_C" >&6 --if test "${cf_cv_utf8_lib+set}" = set; then -+CPPFLAGS="$CPPFLAGS `$NCURSES_CONFIG --cflags`" -+LIBS="`$NCURSES_CONFIG --libs` $LIBS" -+ -+# even with config script, some packages use no-override for curses.h -+ -+echo "$as_me:7506: checking if we have identified curses headers" >&5 -+echo $ECHO_N "checking if we have identified curses headers... $ECHO_C" >&6 -+if test "${cf_cv_ncurses_header+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - -- cf_save_LIBS="$LIBS" -- cat >conftest.$ac_ext <<_ACEOF --#line 7246 "configure" -+cf_cv_ncurses_header=none -+for cf_header in \ -+ ncursesw/ncurses.h \ -+ ncursesw/curses.h \ -+ ncurses.h \ -+ curses.h -+do -+cat >conftest.$ac_ext <<_ACEOF -+#line 7520 "configure" - #include "confdefs.h" -- --#include <stdlib.h> -+#include <${cf_header}> - int - main () - { --putwc(0,0); -+initscr(); tgoto("?", 0,0) - ; - return 0; - } - _ACEOF --rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:7259: \"$ac_link\"") >&5 -- (eval $ac_link) 2>&5 -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:7532: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:7262: \$? = $ac_status" >&5 -+ echo "$as_me:7535: \$? = $ac_status" >&5 - (exit $ac_status); } && -- { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:7265: \"$ac_try\"") >&5 -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:7538: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:7268: \$? = $ac_status" >&5 -+ echo "$as_me:7541: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- cf_cv_utf8_lib=yes -+ cf_cv_ncurses_header=$cf_header; break - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 -+fi -+rm -f conftest.$ac_objext conftest.$ac_ext -+done - --# If the linkage is not already in the $CPPFLAGS/$LDFLAGS configuration, these --# will be set on completion of the AC_TRY_LINK below. --cf_cv_header_path_utf8= --cf_cv_library_path_utf8= -+fi -+echo "$as_me:7552: result: $cf_cv_ncurses_header" >&5 -+echo "${ECHO_T}$cf_cv_ncurses_header" >&6 - --echo "${as_me:-configure}:7280: testing Starting FIND_LINKAGE(utf8,) ..." 1>&5 -+if test "$cf_cv_ncurses_header" = none ; then -+ { { echo "$as_me:7556: error: No curses header-files found" >&5 -+echo "$as_me: error: No curses header-files found" >&2;} -+ { (exit 1); exit 1; }; } -+fi - --cf_save_LIBS="$LIBS" -+# cheat, to get the right #define's for HAVE_NCURSES_H, etc. - --cat >conftest.$ac_ext <<_ACEOF --#line 7285 "configure" -+for ac_header in $cf_cv_ncurses_header -+do -+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -+echo "$as_me:7566: checking for $ac_header" >&5 -+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -+if eval "test \"\${$as_ac_Header+set}\" = set"; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ cat >conftest.$ac_ext <<_ACEOF -+#line 7572 "configure" - #include "confdefs.h" -+#include <$ac_header> -+_ACEOF -+if { (eval echo "$as_me:7576: \"$ac_cpp conftest.$ac_ext\"") >&5 -+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 -+ ac_status=$? -+ egrep -v '^ *\+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 -+ echo "$as_me:7582: \$? = $ac_status" >&5 -+ (exit $ac_status); } >/dev/null; then -+ if test -s conftest.err; then -+ ac_cpp_err=$ac_c_preproc_warn_flag -+ else -+ ac_cpp_err= -+ fi -+else -+ ac_cpp_err=yes -+fi -+if test -z "$ac_cpp_err"; then -+ eval "$as_ac_Header=yes" -+else -+ echo "$as_me: failed program was:" >&5 -+ cat conftest.$ac_ext >&5 -+ eval "$as_ac_Header=no" -+fi -+rm -f conftest.err conftest.$ac_ext -+fi -+echo "$as_me:7601: result: `eval echo '${'$as_ac_Header'}'`" >&5 -+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -+if test `eval echo '${'$as_ac_Header'}'` = yes; then -+ cat >>confdefs.h <<EOF -+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -+EOF - --#include <libutf8.h> -+fi -+done -+ -+cat >>confdefs.h <<\EOF -+#define NCURSES 1 -+EOF -+ -+cf_nculib_ROOT=`echo "HAVE_LIB$cf_ncuconfig_root" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` -+ -+cat >>confdefs.h <<EOF -+#define $cf_nculib_ROOT 1 -+EOF -+ -+cf_cv_ncurses_version=`$NCURSES_CONFIG --version` -+ -+else -+ -+cf_ncuhdr_root=ncursesw -+ -+test -n "$cf_cv_curses_dir" && \ -+test "$cf_cv_curses_dir" != "no" && { \ -+ -+if test -n "$cf_cv_curses_dir/include/$cf_ncuhdr_root" ; then -+ for cf_add_incdir in $cf_cv_curses_dir/include/$cf_ncuhdr_root -+ do -+ while test $cf_add_incdir != /usr/include -+ do -+ if test -d $cf_add_incdir -+ then -+ cf_have_incdir=no -+ if test -n "$CFLAGS$CPPFLAGS" ; then -+ # a loop is needed to ensure we can add subdirs of existing dirs -+ for cf_test_incdir in $CFLAGS $CPPFLAGS ; do -+ if test ".$cf_test_incdir" = ".-I$cf_add_incdir" ; then -+ cf_have_incdir=yes; break -+ fi -+ done -+ fi -+ -+ if test "$cf_have_incdir" = no ; then -+ if test "$cf_add_incdir" = /usr/local/include ; then -+ if test "$GCC" = yes -+ then -+ cf_save_CPPFLAGS=$CPPFLAGS -+ CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" -+ cat >conftest.$ac_ext <<_ACEOF -+#line 7654 "configure" -+#include "confdefs.h" -+#include <stdio.h> - int - main () - { --putwc(0,0); -+printf("Hello") - ; - return 0; - } - _ACEOF --rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:7298: \"$ac_link\"") >&5 -- (eval $ac_link) 2>&5 -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:7666: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:7301: \$? = $ac_status" >&5 -+ echo "$as_me:7669: \$? = $ac_status" >&5 - (exit $ac_status); } && -- { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:7304: \"$ac_try\"") >&5 -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:7672: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:7307: \$? = $ac_status" >&5 -+ echo "$as_me:7675: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- -- cf_cv_find_linkage_utf8=yes -- cf_cv_header_path_utf8=/usr/include -- cf_cv_library_path_utf8=/usr/lib -- -+ : - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 -+cf_have_incdir=yes -+fi -+rm -f conftest.$ac_objext conftest.$ac_ext -+ CPPFLAGS=$cf_save_CPPFLAGS -+ fi -+ fi -+ fi - --LIBS="-lutf8 $cf_save_LIBS" -+ if test "$cf_have_incdir" = no ; then -+ test -n "$verbose" && echo " adding $cf_add_incdir to include-path" 1>&6 - --cat >conftest.$ac_ext <<_ACEOF --#line 7321 "configure" -+echo "${as_me:-configure}:7692: testing adding $cf_add_incdir to include-path ..." 1>&5 -+ -+ CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" -+ -+ cf_top_incdir=`echo $cf_add_incdir | sed -e 's%/include/.*$%/include%'` -+ test "$cf_top_incdir" = "$cf_add_incdir" && break -+ cf_add_incdir="$cf_top_incdir" -+ else -+ break -+ fi -+ fi -+ done -+ done -+fi -+ -+} -+ -+echo "$as_me:7709: checking for $cf_ncuhdr_root header in include-path" >&5 -+echo $ECHO_N "checking for $cf_ncuhdr_root header in include-path... $ECHO_C" >&6 -+if test "${cf_cv_ncurses_h+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ -+ cf_header_list="$cf_ncuhdr_root/curses.h $cf_ncuhdr_root/ncurses.h" -+ ( test "$cf_ncuhdr_root" = ncurses || test "$cf_ncuhdr_root" = ncursesw ) && cf_header_list="$cf_header_list curses.h ncurses.h" -+ for cf_header in $cf_header_list -+ do -+ -+ cat >conftest.$ac_ext <<_ACEOF -+#line 7721 "configure" - #include "confdefs.h" - --#include <libutf8.h> -+#define _XOPEN_SOURCE_EXTENDED -+#undef HAVE_LIBUTF8_H /* in case we used CF_UTF8_LIB */ -+#define HAVE_LIBUTF8_H /* to force ncurses' header file to use cchar_t */ -+ -+#include <$cf_header> - int - main () - { --putwc(0,0); -+ -+#ifdef NCURSES_VERSION -+ -+#ifndef WACS_BSSB -+ make an error -+#endif -+ -+printf("%s\n", NCURSES_VERSION); -+#else -+#ifdef __NCURSES_H -+printf("old\n"); -+#else -+ make an error -+#endif -+#endif -+ - ; - return 0; - } - _ACEOF --rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:7334: \"$ac_link\"") >&5 -- (eval $ac_link) 2>&5 -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:7753: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:7337: \$? = $ac_status" >&5 -+ echo "$as_me:7756: \$? = $ac_status" >&5 - (exit $ac_status); } && -- { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:7340: \"$ac_try\"") >&5 -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:7759: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:7343: \$? = $ac_status" >&5 -+ echo "$as_me:7762: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- -- cf_cv_find_linkage_utf8=yes -- cf_cv_header_path_utf8=/usr/include -- cf_cv_library_path_utf8=/usr/lib -- cf_cv_library_file_utf8="-lutf8" -+ cf_cv_ncurses_h=$cf_header - - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 -+cf_cv_ncurses_h=no -+fi -+rm -f conftest.$ac_objext conftest.$ac_ext - -- cf_cv_find_linkage_utf8=no -- LIBS="$cf_save_LIBS" -+ test "$cf_cv_ncurses_h" != no && break -+ done - -- test -n "$verbose" && echo " find linkage for utf8 library" 1>&6 -+fi -+echo "$as_me:7777: result: $cf_cv_ncurses_h" >&5 -+echo "${ECHO_T}$cf_cv_ncurses_h" >&6 - --echo "${as_me:-configure}:7360: testing find linkage for utf8 library ..." 1>&5 -+if test "$cf_cv_ncurses_h" != no ; then -+ cf_cv_ncurses_header=$cf_cv_ncurses_h -+else - --echo "${as_me:-configure}:7362: testing Searching for headers in FIND_LINKAGE(utf8,) ..." 1>&5 -+echo "$as_me:7784: checking for $cf_ncuhdr_root include-path" >&5 -+echo $ECHO_N "checking for $cf_ncuhdr_root include-path... $ECHO_C" >&6 -+if test "${cf_cv_ncurses_h2+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else - -- cf_save_CPPFLAGS="$CPPFLAGS" -- cf_test_CPPFLAGS="$CPPFLAGS" -+ test -n "$verbose" && echo - - cf_search= - -@@ -7375,15 +7800,15 @@ - -I*) - cf_header_path=`echo ".$cf_header_path" |sed -e 's/^...//' -e 's,/include$,,'` - --test "$cf_header_path" != "NONE" && \ -+test "x$cf_header_path" != "xNONE" && \ - test -d "$cf_header_path" && \ - { - test -n "$verbose" && echo " ... testing for include-directories under $cf_header_path" - test -d $cf_header_path/include && cf_search="$cf_search $cf_header_path/include" -- test -d $cf_header_path/include/utf8 && cf_search="$cf_search $cf_header_path/include/utf8" -- test -d $cf_header_path/include/utf8/include && cf_search="$cf_search $cf_header_path/include/utf8/include" -- test -d $cf_header_path/utf8/include && cf_search="$cf_search $cf_header_path/utf8/include" -- test -d $cf_header_path/utf8/include/utf8 && cf_search="$cf_search $cf_header_path/utf8/include/utf8" -+ test -d $cf_header_path/include/$cf_ncuhdr_root && cf_search="$cf_search $cf_header_path/include/$cf_ncuhdr_root" -+ test -d $cf_header_path/include/$cf_ncuhdr_root/include && cf_search="$cf_search $cf_header_path/include/$cf_ncuhdr_root/include" -+ test -d $cf_header_path/$cf_ncuhdr_root/include && cf_search="$cf_search $cf_header_path/$cf_ncuhdr_root/include" -+ test -d $cf_header_path/$cf_ncuhdr_root/include/$cf_ncuhdr_root && cf_search="$cf_search $cf_header_path/$cf_ncuhdr_root/include/$cf_ncuhdr_root" - } - - cf_header_path_list="$cf_header_path_list $cf_search" -@@ -7396,315 +7821,84 @@ - - cf_search= - --test "/usr" != "$prefix" && \ -+test "x/usr" != "x$prefix" && \ - test -d "/usr" && \ --(test $prefix = NONE || test "/usr" != "$prefix") && { -+(test -z "$prefix" || test x$prefix = xNONE || test "x/usr" != "x$prefix") && { - test -n "$verbose" && echo " ... testing for include-directories under /usr" - test -d /usr/include && cf_search="$cf_search /usr/include" -- test -d /usr/include/utf8 && cf_search="$cf_search /usr/include/utf8" -- test -d /usr/include/utf8/include && cf_search="$cf_search /usr/include/utf8/include" -- test -d /usr/utf8/include && cf_search="$cf_search /usr/utf8/include" -- test -d /usr/utf8/include/utf8 && cf_search="$cf_search /usr/utf8/include/utf8" -+ test -d /usr/include/$cf_ncuhdr_root && cf_search="$cf_search /usr/include/$cf_ncuhdr_root" -+ test -d /usr/include/$cf_ncuhdr_root/include && cf_search="$cf_search /usr/include/$cf_ncuhdr_root/include" -+ test -d /usr/$cf_ncuhdr_root/include && cf_search="$cf_search /usr/$cf_ncuhdr_root/include" -+ test -d /usr/$cf_ncuhdr_root/include/$cf_ncuhdr_root && cf_search="$cf_search /usr/$cf_ncuhdr_root/include/$cf_ncuhdr_root" - } - --test "$prefix" != "NONE" && \ -+test "x$prefix" != "xNONE" && \ - test -d "$prefix" && \ - { - test -n "$verbose" && echo " ... testing for include-directories under $prefix" - test -d $prefix/include && cf_search="$cf_search $prefix/include" -- test -d $prefix/include/utf8 && cf_search="$cf_search $prefix/include/utf8" -- test -d $prefix/include/utf8/include && cf_search="$cf_search $prefix/include/utf8/include" -- test -d $prefix/utf8/include && cf_search="$cf_search $prefix/utf8/include" -- test -d $prefix/utf8/include/utf8 && cf_search="$cf_search $prefix/utf8/include/utf8" -+ test -d $prefix/include/$cf_ncuhdr_root && cf_search="$cf_search $prefix/include/$cf_ncuhdr_root" -+ test -d $prefix/include/$cf_ncuhdr_root/include && cf_search="$cf_search $prefix/include/$cf_ncuhdr_root/include" -+ test -d $prefix/$cf_ncuhdr_root/include && cf_search="$cf_search $prefix/$cf_ncuhdr_root/include" -+ test -d $prefix/$cf_ncuhdr_root/include/$cf_ncuhdr_root && cf_search="$cf_search $prefix/$cf_ncuhdr_root/include/$cf_ncuhdr_root" - } - --test "/usr/local" != "$prefix" && \ -+test "x/usr/local" != "x$prefix" && \ - test -d "/usr/local" && \ --(test $prefix = NONE || test "/usr/local" != "$prefix") && { -+(test -z "$prefix" || test x$prefix = xNONE || test "x/usr/local" != "x$prefix") && { - test -n "$verbose" && echo " ... testing for include-directories under /usr/local" - test -d /usr/local/include && cf_search="$cf_search /usr/local/include" -- test -d /usr/local/include/utf8 && cf_search="$cf_search /usr/local/include/utf8" -- test -d /usr/local/include/utf8/include && cf_search="$cf_search /usr/local/include/utf8/include" -- test -d /usr/local/utf8/include && cf_search="$cf_search /usr/local/utf8/include" -- test -d /usr/local/utf8/include/utf8 && cf_search="$cf_search /usr/local/utf8/include/utf8" -+ test -d /usr/local/include/$cf_ncuhdr_root && cf_search="$cf_search /usr/local/include/$cf_ncuhdr_root" -+ test -d /usr/local/include/$cf_ncuhdr_root/include && cf_search="$cf_search /usr/local/include/$cf_ncuhdr_root/include" -+ test -d /usr/local/$cf_ncuhdr_root/include && cf_search="$cf_search /usr/local/$cf_ncuhdr_root/include" -+ test -d /usr/local/$cf_ncuhdr_root/include/$cf_ncuhdr_root && cf_search="$cf_search /usr/local/$cf_ncuhdr_root/include/$cf_ncuhdr_root" - } - --test "/opt" != "$prefix" && \ -+test "x/opt" != "x$prefix" && \ - test -d "/opt" && \ --(test $prefix = NONE || test "/opt" != "$prefix") && { -+(test -z "$prefix" || test x$prefix = xNONE || test "x/opt" != "x$prefix") && { - test -n "$verbose" && echo " ... testing for include-directories under /opt" - test -d /opt/include && cf_search="$cf_search /opt/include" -- test -d /opt/include/utf8 && cf_search="$cf_search /opt/include/utf8" -- test -d /opt/include/utf8/include && cf_search="$cf_search /opt/include/utf8/include" -- test -d /opt/utf8/include && cf_search="$cf_search /opt/utf8/include" -- test -d /opt/utf8/include/utf8 && cf_search="$cf_search /opt/utf8/include/utf8" -+ test -d /opt/include/$cf_ncuhdr_root && cf_search="$cf_search /opt/include/$cf_ncuhdr_root" -+ test -d /opt/include/$cf_ncuhdr_root/include && cf_search="$cf_search /opt/include/$cf_ncuhdr_root/include" -+ test -d /opt/$cf_ncuhdr_root/include && cf_search="$cf_search /opt/$cf_ncuhdr_root/include" -+ test -d /opt/$cf_ncuhdr_root/include/$cf_ncuhdr_root && cf_search="$cf_search /opt/$cf_ncuhdr_root/include/$cf_ncuhdr_root" - } - --test "$HOME" != "$prefix" && \ -+test "x$HOME" != "x$prefix" && \ - test -d "$HOME" && \ --(test $prefix = NONE || test "$HOME" != "$prefix") && { -+(test -z "$prefix" || test x$prefix = xNONE || test "x$HOME" != "x$prefix") && { - test -n "$verbose" && echo " ... testing for include-directories under $HOME" - test -d $HOME/include && cf_search="$cf_search $HOME/include" -- test -d $HOME/include/utf8 && cf_search="$cf_search $HOME/include/utf8" -- test -d $HOME/include/utf8/include && cf_search="$cf_search $HOME/include/utf8/include" -- test -d $HOME/utf8/include && cf_search="$cf_search $HOME/utf8/include" -- test -d $HOME/utf8/include/utf8 && cf_search="$cf_search $HOME/utf8/include/utf8" -+ test -d $HOME/include/$cf_ncuhdr_root && cf_search="$cf_search $HOME/include/$cf_ncuhdr_root" -+ test -d $HOME/include/$cf_ncuhdr_root/include && cf_search="$cf_search $HOME/include/$cf_ncuhdr_root/include" -+ test -d $HOME/$cf_ncuhdr_root/include && cf_search="$cf_search $HOME/$cf_ncuhdr_root/include" -+ test -d $HOME/$cf_ncuhdr_root/include/$cf_ncuhdr_root && cf_search="$cf_search $HOME/$cf_ncuhdr_root/include/$cf_ncuhdr_root" - } - - test "$includedir" != NONE && \ - test "$includedir" != "/usr/include" && \ - test -d "$includedir" && { - test -d $includedir && cf_search="$cf_search $includedir" -- test -d $includedir/utf8 && cf_search="$cf_search $includedir/utf8" -+ test -d $includedir/$cf_ncuhdr_root && cf_search="$cf_search $includedir/$cf_ncuhdr_root" - } - - test "$oldincludedir" != NONE && \ - test "$oldincludedir" != "/usr/include" && \ - test -d "$oldincludedir" && { - test -d $oldincludedir && cf_search="$cf_search $oldincludedir" -- test -d $oldincludedir/utf8 && cf_search="$cf_search $oldincludedir/utf8" -+ test -d $oldincludedir/$cf_ncuhdr_root && cf_search="$cf_search $oldincludedir/$cf_ncuhdr_root" - } - - cf_search="$cf_search $cf_header_path_list" - -- for cf_cv_header_path_utf8 in $cf_search -- do -- if test -d $cf_cv_header_path_utf8 ; then -- test -n "$verbose" && echo " ... testing $cf_cv_header_path_utf8" 1>&6 -- --echo "${as_me:-configure}:7475: testing ... testing $cf_cv_header_path_utf8 ..." 1>&5 -- -- CPPFLAGS="$cf_save_CPPFLAGS -I$cf_cv_header_path_utf8" -- cat >conftest.$ac_ext <<_ACEOF --#line 7479 "configure" --#include "confdefs.h" -- --#include <libutf8.h> --int --main () --{ --putwc(0,0); -- ; -- return 0; --} --_ACEOF --rm -f conftest.$ac_objext --if { (eval echo "$as_me:7492: \"$ac_compile\"") >&5 -- (eval $ac_compile) 2>&5 -- ac_status=$? -- echo "$as_me:7495: \$? = $ac_status" >&5 -- (exit $ac_status); } && -- { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:7498: \"$ac_try\"") >&5 -- (eval $ac_try) 2>&5 -- ac_status=$? -- echo "$as_me:7501: \$? = $ac_status" >&5 -- (exit $ac_status); }; }; then -- -- test -n "$verbose" && echo " ... found utf8 headers in $cf_cv_header_path_utf8" 1>&6 -- --echo "${as_me:-configure}:7506: testing ... found utf8 headers in $cf_cv_header_path_utf8 ..." 1>&5 -- -- cf_cv_find_linkage_utf8=maybe -- cf_test_CPPFLAGS="$CPPFLAGS" -- break --else -- echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 -- -- CPPFLAGS="$cf_save_CPPFLAGS" -- --fi --rm -f conftest.$ac_objext conftest.$ac_ext -- fi -- done -- -- if test "$cf_cv_find_linkage_utf8" = maybe ; then -- --echo "${as_me:-configure}:7524: testing Searching for utf8 library in FIND_LINKAGE(utf8,) ..." 1>&5 -- -- cf_save_LIBS="$LIBS" -- cf_save_LDFLAGS="$LDFLAGS" -- -- if test "$cf_cv_find_linkage_utf8" != yes ; then -- --cf_search= --cf_library_path_list="" --if test -n "${LDFLAGS}${LIBS}" ; then -- for cf_library_path in $LDFLAGS $LIBS -+ test -n "$verbose" && echo search path $cf_search -+ cf_save2_CPPFLAGS="$CPPFLAGS" -+ for cf_incdir in $cf_search - do -- case $cf_library_path in #(vi -- -L*) -- cf_library_path=`echo ".$cf_library_path" |sed -e 's/^...//' -e 's,/lib$,,'` -- --test "$cf_library_path" != "NONE" && \ --test -d "$cf_library_path" && \ -- { -- test -n "$verbose" && echo " ... testing for lib-directories under $cf_library_path" -- test -d $cf_library_path/lib && cf_search="$cf_search $cf_library_path/lib" -- test -d $cf_library_path/lib/utf8 && cf_search="$cf_search $cf_library_path/lib/utf8" -- test -d $cf_library_path/lib/utf8/lib && cf_search="$cf_search $cf_library_path/lib/utf8/lib" -- test -d $cf_library_path/utf8/lib && cf_search="$cf_search $cf_library_path/utf8/lib" -- test -d $cf_library_path/utf8/lib/utf8 && cf_search="$cf_search $cf_library_path/utf8/lib/utf8" --} -- -- cf_library_path_list="$cf_library_path_list $cf_search" -- ;; -- esac -- done --fi -- --cf_search= -- --test "/usr" != "$prefix" && \ --test -d "/usr" && \ --(test $prefix = NONE || test "/usr" != "$prefix") && { -- test -n "$verbose" && echo " ... testing for lib-directories under /usr" -- test -d /usr/lib && cf_search="$cf_search /usr/lib" -- test -d /usr/lib/utf8 && cf_search="$cf_search /usr/lib/utf8" -- test -d /usr/lib/utf8/lib && cf_search="$cf_search /usr/lib/utf8/lib" -- test -d /usr/utf8/lib && cf_search="$cf_search /usr/utf8/lib" -- test -d /usr/utf8/lib/utf8 && cf_search="$cf_search /usr/utf8/lib/utf8" --} -- --test "$prefix" != "NONE" && \ --test -d "$prefix" && \ -- { -- test -n "$verbose" && echo " ... testing for lib-directories under $prefix" -- test -d $prefix/lib && cf_search="$cf_search $prefix/lib" -- test -d $prefix/lib/utf8 && cf_search="$cf_search $prefix/lib/utf8" -- test -d $prefix/lib/utf8/lib && cf_search="$cf_search $prefix/lib/utf8/lib" -- test -d $prefix/utf8/lib && cf_search="$cf_search $prefix/utf8/lib" -- test -d $prefix/utf8/lib/utf8 && cf_search="$cf_search $prefix/utf8/lib/utf8" --} -- --test "/usr/local" != "$prefix" && \ --test -d "/usr/local" && \ --(test $prefix = NONE || test "/usr/local" != "$prefix") && { -- test -n "$verbose" && echo " ... testing for lib-directories under /usr/local" -- test -d /usr/local/lib && cf_search="$cf_search /usr/local/lib" -- test -d /usr/local/lib/utf8 && cf_search="$cf_search /usr/local/lib/utf8" -- test -d /usr/local/lib/utf8/lib && cf_search="$cf_search /usr/local/lib/utf8/lib" -- test -d /usr/local/utf8/lib && cf_search="$cf_search /usr/local/utf8/lib" -- test -d /usr/local/utf8/lib/utf8 && cf_search="$cf_search /usr/local/utf8/lib/utf8" --} -- --test "/opt" != "$prefix" && \ --test -d "/opt" && \ --(test $prefix = NONE || test "/opt" != "$prefix") && { -- test -n "$verbose" && echo " ... testing for lib-directories under /opt" -- test -d /opt/lib && cf_search="$cf_search /opt/lib" -- test -d /opt/lib/utf8 && cf_search="$cf_search /opt/lib/utf8" -- test -d /opt/lib/utf8/lib && cf_search="$cf_search /opt/lib/utf8/lib" -- test -d /opt/utf8/lib && cf_search="$cf_search /opt/utf8/lib" -- test -d /opt/utf8/lib/utf8 && cf_search="$cf_search /opt/utf8/lib/utf8" --} -- --test "$HOME" != "$prefix" && \ --test -d "$HOME" && \ --(test $prefix = NONE || test "$HOME" != "$prefix") && { -- test -n "$verbose" && echo " ... testing for lib-directories under $HOME" -- test -d $HOME/lib && cf_search="$cf_search $HOME/lib" -- test -d $HOME/lib/utf8 && cf_search="$cf_search $HOME/lib/utf8" -- test -d $HOME/lib/utf8/lib && cf_search="$cf_search $HOME/lib/utf8/lib" -- test -d $HOME/utf8/lib && cf_search="$cf_search $HOME/utf8/lib" -- test -d $HOME/utf8/lib/utf8 && cf_search="$cf_search $HOME/utf8/lib/utf8" --} -- --cf_search="$cf_library_path_list $cf_search" -- -- for cf_cv_library_path_utf8 in $cf_search -- do -- if test -d $cf_cv_library_path_utf8 ; then -- test -n "$verbose" && echo " ... testing $cf_cv_library_path_utf8" 1>&6 -- --echo "${as_me:-configure}:7621: testing ... testing $cf_cv_library_path_utf8 ..." 1>&5 -- -- CPPFLAGS="$cf_test_CPPFLAGS" -- LIBS="-lutf8 $cf_save_LIBS" -- LDFLAGS="$cf_save_LDFLAGS -L$cf_cv_library_path_utf8" -- cat >conftest.$ac_ext <<_ACEOF --#line 7627 "configure" --#include "confdefs.h" -- --#include <libutf8.h> --int --main () --{ --putwc(0,0); -- ; -- return 0; --} --_ACEOF --rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:7640: \"$ac_link\"") >&5 -- (eval $ac_link) 2>&5 -- ac_status=$? -- echo "$as_me:7643: \$? = $ac_status" >&5 -- (exit $ac_status); } && -- { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:7646: \"$ac_try\"") >&5 -- (eval $ac_try) 2>&5 -- ac_status=$? -- echo "$as_me:7649: \$? = $ac_status" >&5 -- (exit $ac_status); }; }; then -- -- test -n "$verbose" && echo " ... found utf8 library in $cf_cv_library_path_utf8" 1>&6 -- --echo "${as_me:-configure}:7654: testing ... found utf8 library in $cf_cv_library_path_utf8 ..." 1>&5 -- -- cf_cv_find_linkage_utf8=yes -- cf_cv_library_file_utf8="-lutf8" -- break --else -- echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 -- -- CPPFLAGS="$cf_save_CPPFLAGS" -- LIBS="$cf_save_LIBS" -- LDFLAGS="$cf_save_LDFLAGS" -- --fi --rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -- fi -- done -- CPPFLAGS="$cf_save_CPPFLAGS" -- LDFLAGS="$cf_save_LDFLAGS" -- fi -- -- else -- cf_cv_find_linkage_utf8=no -- fi -- --fi --rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -- --fi --rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -- --LIBS="$cf_save_LIBS" -- --if test "$cf_cv_find_linkage_utf8" = yes ; then --cf_cv_utf8_lib=add-on --else --cf_cv_utf8_lib=no --fi -- --fi --rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext --fi --echo "$as_me:7696: result: $cf_cv_utf8_lib" >&5 --echo "${ECHO_T}$cf_cv_utf8_lib" >&6 -- --# HAVE_LIBUTF8_H is used by ncurses if curses.h is shared between --# ncurses/ncursesw: --if test "$cf_cv_utf8_lib" = "add-on" ; then -- cat >>confdefs.h <<\EOF --#define HAVE_LIBUTF8_H 1 --EOF - --if test -n "$cf_cv_header_path_utf8" ; then -- for cf_add_incdir in $cf_cv_header_path_utf8 -+if test -n "$cf_incdir" ; then -+ for cf_add_incdir in $cf_incdir - do - while test $cf_add_incdir != /usr/include - do -@@ -7727,7 +7921,7 @@ - cf_save_CPPFLAGS=$CPPFLAGS - CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" - cat >conftest.$ac_ext <<_ACEOF --#line 7730 "configure" -+#line 7924 "configure" - #include "confdefs.h" - #include <stdio.h> - int -@@ -7739,16 +7933,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:7742: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:7936: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:7745: \$? = $ac_status" >&5 -+ echo "$as_me:7939: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:7748: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:7942: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:7751: \$? = $ac_status" >&5 -+ echo "$as_me:7945: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : - else -@@ -7765,7 +7959,7 @@ - if test "$cf_have_incdir" = no ; then - test -n "$verbose" && echo " adding $cf_add_incdir to include-path" 1>&6 - --echo "${as_me:-configure}:7768: testing adding $cf_add_incdir to include-path ..." 1>&5 -+echo "${as_me:-configure}:7962: testing adding $cf_add_incdir to include-path ..." 1>&5 - - CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" - -@@ -7780,215 +7974,82 @@ - done - fi - --if test -n "$cf_cv_library_path_utf8" ; then -- for cf_add_libdir in $cf_cv_library_path_utf8 -- do -- if test $cf_add_libdir = /usr/lib ; then -- : -- elif test -d $cf_add_libdir -- then -- cf_have_libdir=no -- if test -n "$LDFLAGS$LIBS" ; then -- # a loop is needed to ensure we can add subdirs of existing dirs -- for cf_test_libdir in $LDFLAGS $LIBS ; do -- if test ".$cf_test_libdir" = ".-L$cf_add_libdir" ; then -- cf_have_libdir=yes; break -- fi -- done -- fi -- if test "$cf_have_libdir" = no ; then -- test -n "$verbose" && echo " adding $cf_add_libdir to library-path" 1>&6 -+ for cf_header in \ -+ ncurses.h \ -+ curses.h -+ do - --echo "${as_me:-configure}:7802: testing adding $cf_add_libdir to library-path ..." 1>&5 -+ cat >conftest.$ac_ext <<_ACEOF -+#line 7983 "configure" -+#include "confdefs.h" - -- LDFLAGS="-L$cf_add_libdir $LDFLAGS" -- fi -- fi -- done --fi -- -- LIBS="$cf_cv_library_file_utf8 $LIBS" --fi -- --cf_ncuconfig_root=ncursesw -- --echo "Looking for ${cf_ncuconfig_root}-config" --for ac_prog in ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config --do -- # Extract the first word of "$ac_prog", so it can be a program name with args. --set dummy $ac_prog; ac_word=$2 --echo "$as_me:7820: checking for $ac_word" >&5 --echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 --if test "${ac_cv_path_NCURSES_CONFIG+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 --else -- case $NCURSES_CONFIG in -- [\\/]* | ?:[\\/]*) -- ac_cv_path_NCURSES_CONFIG="$NCURSES_CONFIG" # Let the user override the test with a path. -- ;; -- *) -- ac_save_IFS=$IFS; IFS=$ac_path_separator --ac_dummy="$PATH" --for ac_dir in $ac_dummy; do -- IFS=$ac_save_IFS -- test -z "$ac_dir" && ac_dir=. -- if $as_executable_p "$ac_dir/$ac_word"; then -- ac_cv_path_NCURSES_CONFIG="$ac_dir/$ac_word" -- echo "$as_me:7837: found $ac_dir/$ac_word" >&5 -- break --fi --done -- -- ;; --esac --fi --NCURSES_CONFIG=$ac_cv_path_NCURSES_CONFIG -- --if test -n "$NCURSES_CONFIG"; then -- echo "$as_me:7848: result: $NCURSES_CONFIG" >&5 --echo "${ECHO_T}$NCURSES_CONFIG" >&6 --else -- echo "$as_me:7851: result: no" >&5 --echo "${ECHO_T}no" >&6 --fi -- -- test -n "$NCURSES_CONFIG" && break --done --test -n "$NCURSES_CONFIG" || NCURSES_CONFIG="none" -- --if test "$NCURSES_CONFIG" != none ; then -- --CPPFLAGS="$CPPFLAGS `$NCURSES_CONFIG --cflags`" --LIBS="`$NCURSES_CONFIG --libs` $LIBS" -- --# even with config script, some packages use no-override for curses.h -- --echo "$as_me:7866: checking if we have identified curses headers" >&5 --echo $ECHO_N "checking if we have identified curses headers... $ECHO_C" >&6 --if test "${cf_cv_ncurses_header+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 --else -- --cf_cv_ncurses_header=none --for cf_header in \ -- ncursesw/curses.h \ -- ncursesw/ncurses.h \ -- curses.h \ -- ncurses.h --do --cat >conftest.$ac_ext <<_ACEOF --#line 7880 "configure" --#include "confdefs.h" --#include <${cf_header}> -+#include <$cf_header> - int - main () - { --initscr(); tgoto("?", 0,0) -+ -+#ifdef NCURSES_VERSION -+ -+printf("%s\n", NCURSES_VERSION); -+#else -+#ifdef __NCURSES_H -+printf("old\n"); -+#else -+ make an error -+#endif -+#endif -+ - ; - return 0; - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:7892: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:8007: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:7895: \$? = $ac_status" >&5 -+ echo "$as_me:8010: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:7898: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:8013: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:7901: \$? = $ac_status" >&5 -+ echo "$as_me:8016: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- cf_cv_ncurses_header=$cf_header; break -+ cf_cv_ncurses_h2=$cf_header -+ - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 -+cf_cv_ncurses_h2=no - fi - rm -f conftest.$ac_objext conftest.$ac_ext --done -- --fi --echo "$as_me:7912: result: $cf_cv_ncurses_header" >&5 --echo "${ECHO_T}$cf_cv_ncurses_header" >&6 - --if test "$cf_cv_ncurses_header" = none ; then -- { { echo "$as_me:7916: error: No curses header-files found" >&5 --echo "$as_me: error: No curses header-files found" >&2;} -+ if test "$cf_cv_ncurses_h2" != no ; then -+ cf_cv_ncurses_h2=$cf_incdir/$cf_header -+ test -n "$verbose" && echo $ac_n " ... found $ac_c" 1>&6 -+ break -+ fi -+ test -n "$verbose" && echo " ... tested $cf_incdir/$cf_header" 1>&6 -+ done -+ CPPFLAGS="$cf_save2_CPPFLAGS" -+ test "$cf_cv_ncurses_h2" != no && break -+ done -+ test "$cf_cv_ncurses_h2" = no && { { echo "$as_me:8037: error: not found" >&5 -+echo "$as_me: error: not found" >&2;} - { (exit 1); exit 1; }; } --fi -- --# cheat, to get the right #define's for HAVE_NCURSES_H, etc. -- --for ac_header in $cf_cv_ncurses_header --do --as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` --echo "$as_me:7926: checking for $ac_header" >&5 --echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 --if eval "test \"\${$as_ac_Header+set}\" = set"; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 --else -- cat >conftest.$ac_ext <<_ACEOF --#line 7932 "configure" --#include "confdefs.h" --#include <$ac_header> --_ACEOF --if { (eval echo "$as_me:7936: \"$ac_cpp conftest.$ac_ext\"") >&5 -- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 -- ac_status=$? -- egrep -v '^ *\+' conftest.er1 >conftest.err -- rm -f conftest.er1 -- cat conftest.err >&5 -- echo "$as_me:7942: \$? = $ac_status" >&5 -- (exit $ac_status); } >/dev/null; then -- if test -s conftest.err; then -- ac_cpp_err=$ac_c_preproc_warn_flag -- else -- ac_cpp_err= -- fi --else -- ac_cpp_err=yes --fi --if test -z "$ac_cpp_err"; then -- eval "$as_ac_Header=yes" --else -- echo "$as_me: failed program was:" >&5 -- cat conftest.$ac_ext >&5 -- eval "$as_ac_Header=no" --fi --rm -f conftest.err conftest.$ac_ext --fi --echo "$as_me:7961: result: `eval echo '${'$as_ac_Header'}'`" >&5 --echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 --if test `eval echo '${'$as_ac_Header'}'` = yes; then -- cat >>confdefs.h <<EOF --#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 --EOF - - fi --done -- --cat >>confdefs.h <<\EOF --#define NCURSES 1 --EOF -- --cf_nculib_ROOT=`echo "HAVE_LIB$cf_ncuconfig_root" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` -- --cat >>confdefs.h <<EOF --#define $cf_nculib_ROOT 1 --EOF -- --cf_cv_ncurses_version=`$NCURSES_CONFIG --version` -- --else -- --cf_ncuhdr_root=ncursesw -+echo "$as_me:8042: result: $cf_cv_ncurses_h2" >&5 -+echo "${ECHO_T}$cf_cv_ncurses_h2" >&6 - --test -n "$cf_cv_curses_dir" && \ --test "$cf_cv_curses_dir" != "no" && { \ -+ cf_1st_incdir=`echo $cf_cv_ncurses_h2 | sed -e 's%/[^/]*$%%'` -+ cf_cv_ncurses_header=`basename $cf_cv_ncurses_h2` -+ if test `basename $cf_1st_incdir` = $cf_ncuhdr_root ; then -+ cf_cv_ncurses_header=$cf_ncuhdr_root/$cf_cv_ncurses_header -+ fi - --if test -n "$cf_cv_curses_dir/include/$cf_ncuhdr_root" ; then -- for cf_add_incdir in $cf_cv_curses_dir/include/$cf_ncuhdr_root -+if test -n "$cf_1st_incdir" ; then -+ for cf_add_incdir in $cf_1st_incdir - do - while test $cf_add_incdir != /usr/include - do -@@ -8011,7 +8072,7 @@ - cf_save_CPPFLAGS=$CPPFLAGS - CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" - cat >conftest.$ac_ext <<_ACEOF --#line 8014 "configure" -+#line 8075 "configure" - #include "confdefs.h" - #include <stdio.h> - int -@@ -8023,16 +8084,16 @@ - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:8026: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:8087: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:8029: \$? = $ac_status" >&5 -+ echo "$as_me:8090: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:8032: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:8093: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:8035: \$? = $ac_status" >&5 -+ echo "$as_me:8096: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : - else -@@ -8049,7 +8110,7 @@ - if test "$cf_have_incdir" = no ; then - test -n "$verbose" && echo " adding $cf_add_incdir to include-path" 1>&6 - --echo "${as_me:-configure}:8052: testing adding $cf_add_incdir to include-path ..." 1>&5 -+echo "${as_me:-configure}:8113: testing adding $cf_add_incdir to include-path ..." 1>&5 - - CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" - -@@ -8064,1639 +8125,1554 @@ - done - fi - --} -+fi - --echo "$as_me:8069: checking for $cf_ncuhdr_root header in include-path" >&5 --echo $ECHO_N "checking for $cf_ncuhdr_root header in include-path... $ECHO_C" >&6 --if test "${cf_cv_ncurses_h+set}" = set; then -+# Set definitions to allow ifdef'ing for ncurses.h -+ -+case $cf_cv_ncurses_header in # (vi -+*ncurses.h) -+ -+cat >>confdefs.h <<\EOF -+#define HAVE_NCURSES_H 1 -+EOF -+ -+ ;; -+esac -+ -+case $cf_cv_ncurses_header in # (vi -+ncurses/curses.h|ncurses/ncurses.h) -+ -+cat >>confdefs.h <<\EOF -+#define HAVE_NCURSES_NCURSES_H 1 -+EOF -+ -+ ;; -+ncursesw/curses.h|ncursesw/ncurses.h) -+ -+cat >>confdefs.h <<\EOF -+#define HAVE_NCURSESW_NCURSES_H 1 -+EOF -+ -+ ;; -+esac -+ -+echo "$as_me:8159: checking for terminfo header" >&5 -+echo $ECHO_N "checking for terminfo header... $ECHO_C" >&6 -+if test "${cf_cv_term_header+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - -- cf_header_list="$cf_ncuhdr_root/curses.h $cf_ncuhdr_root/ncurses.h" -- ( test "$cf_ncuhdr_root" = ncurses || test "$cf_ncuhdr_root" = ncursesw ) && cf_header_list="$cf_header_list curses.h ncurses.h" -- for cf_header in $cf_header_list -- do -+case ${cf_cv_ncurses_header} in #(vi -+*/ncurses.h|*/ncursesw.h) #(vi -+ cf_term_header=`echo "$cf_cv_ncurses_header" | sed -e 's%ncurses[^.]*\.h$%term.h%'` -+ ;; -+*) -+ cf_term_header=term.h -+ ;; -+esac - -- cat >conftest.$ac_ext <<_ACEOF --#line 8081 "configure" -+for cf_test in $cf_term_header "ncurses/term.h" "ncursesw/term.h" -+do -+cat >conftest.$ac_ext <<_ACEOF -+#line 8177 "configure" - #include "confdefs.h" -+#include <stdio.h> -+#include <${cf_cv_ncurses_header:-curses.h}> -+#include <$cf_test> - --#define _XOPEN_SOURCE_EXTENDED --#undef HAVE_LIBUTF8_H /* in case we used CF_UTF8_LIB */ --#define HAVE_LIBUTF8_H /* to force ncurses' header file to use cchar_t */ -- --#include <$cf_header> - int - main () - { -- --#ifdef NCURSES_VERSION -- --#ifndef WACS_BSSB -- make an error --#endif -- --printf("%s\n", NCURSES_VERSION); --#else --#ifdef __NCURSES_H --printf("old\n"); --#else -- make an error --#endif --#endif -- -+int x = auto_left_margin - ; - return 0; - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:8113: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:8192: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:8116: \$? = $ac_status" >&5 -+ echo "$as_me:8195: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:8119: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:8198: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:8122: \$? = $ac_status" >&5 -+ echo "$as_me:8201: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- cf_cv_ncurses_h=$cf_header - -+ cf_cv_term_header="$cf_test" - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --cf_cv_ncurses_h=no -+ -+ cf_cv_term_header=unknown -+ - fi - rm -f conftest.$ac_objext conftest.$ac_ext -- -- test "$cf_cv_ncurses_h" != no && break -- done -+ test "$cf_cv_term_header" != unknown && break -+done - - fi --echo "$as_me:8137: result: $cf_cv_ncurses_h" >&5 --echo "${ECHO_T}$cf_cv_ncurses_h" >&6 -+echo "$as_me:8217: result: $cf_cv_term_header" >&5 -+echo "${ECHO_T}$cf_cv_term_header" >&6 - --if test "$cf_cv_ncurses_h" != no ; then -- cf_cv_ncurses_header=$cf_cv_ncurses_h --else -+# Set definitions to allow ifdef'ing to accommodate subdirectories - --echo "$as_me:8144: checking for $cf_ncuhdr_root include-path" >&5 --echo $ECHO_N "checking for $cf_ncuhdr_root include-path... $ECHO_C" >&6 --if test "${cf_cv_ncurses_h2+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 --else -+case $cf_cv_term_header in # (vi -+*term.h) - -- test -n "$verbose" && echo -+cat >>confdefs.h <<\EOF -+#define HAVE_TERM_H 1 -+EOF - --cf_search= -+ ;; -+esac - --# collect the current set of include-directories from compiler flags --cf_header_path_list="" --if test -n "${CFLAGS}${CPPFLAGS}" ; then -- for cf_header_path in $CPPFLAGS $CFLAGS -- do -- case $cf_header_path in #(vi -- -I*) -- cf_header_path=`echo ".$cf_header_path" |sed -e 's/^...//' -e 's,/include$,,'` -+case $cf_cv_term_header in # (vi -+ncurses/term.h) #(vi - --test "$cf_header_path" != "NONE" && \ --test -d "$cf_header_path" && \ -- { -- test -n "$verbose" && echo " ... testing for include-directories under $cf_header_path" -- test -d $cf_header_path/include && cf_search="$cf_search $cf_header_path/include" -- test -d $cf_header_path/include/$cf_ncuhdr_root && cf_search="$cf_search $cf_header_path/include/$cf_ncuhdr_root" -- test -d $cf_header_path/include/$cf_ncuhdr_root/include && cf_search="$cf_search $cf_header_path/include/$cf_ncuhdr_root/include" -- test -d $cf_header_path/$cf_ncuhdr_root/include && cf_search="$cf_search $cf_header_path/$cf_ncuhdr_root/include" -- test -d $cf_header_path/$cf_ncuhdr_root/include/$cf_ncuhdr_root && cf_search="$cf_search $cf_header_path/$cf_ncuhdr_root/include/$cf_ncuhdr_root" --} -+cat >>confdefs.h <<\EOF -+#define HAVE_NCURSES_TERM_H 1 -+EOF - -- cf_header_path_list="$cf_header_path_list $cf_search" -- ;; -- esac -- done --fi -+ ;; -+ncursesw/term.h) - --# add the variations for the package we are looking for -+cat >>confdefs.h <<\EOF -+#define HAVE_NCURSESW_TERM_H 1 -+EOF - --cf_search= -+ ;; -+esac - --test "/usr" != "$prefix" && \ --test -d "/usr" && \ --(test $prefix = NONE || test "/usr" != "$prefix") && { -- test -n "$verbose" && echo " ... testing for include-directories under /usr" -- test -d /usr/include && cf_search="$cf_search /usr/include" -- test -d /usr/include/$cf_ncuhdr_root && cf_search="$cf_search /usr/include/$cf_ncuhdr_root" -- test -d /usr/include/$cf_ncuhdr_root/include && cf_search="$cf_search /usr/include/$cf_ncuhdr_root/include" -- test -d /usr/$cf_ncuhdr_root/include && cf_search="$cf_search /usr/$cf_ncuhdr_root/include" -- test -d /usr/$cf_ncuhdr_root/include/$cf_ncuhdr_root && cf_search="$cf_search /usr/$cf_ncuhdr_root/include/$cf_ncuhdr_root" --} -+# some applications need this, but should check for NCURSES_VERSION - --test "$prefix" != "NONE" && \ --test -d "$prefix" && \ -- { -- test -n "$verbose" && echo " ... testing for include-directories under $prefix" -- test -d $prefix/include && cf_search="$cf_search $prefix/include" -- test -d $prefix/include/$cf_ncuhdr_root && cf_search="$cf_search $prefix/include/$cf_ncuhdr_root" -- test -d $prefix/include/$cf_ncuhdr_root/include && cf_search="$cf_search $prefix/include/$cf_ncuhdr_root/include" -- test -d $prefix/$cf_ncuhdr_root/include && cf_search="$cf_search $prefix/$cf_ncuhdr_root/include" -- test -d $prefix/$cf_ncuhdr_root/include/$cf_ncuhdr_root && cf_search="$cf_search $prefix/$cf_ncuhdr_root/include/$cf_ncuhdr_root" --} -+cat >>confdefs.h <<\EOF -+#define NCURSES 1 -+EOF - --test "/usr/local" != "$prefix" && \ --test -d "/usr/local" && \ --(test $prefix = NONE || test "/usr/local" != "$prefix") && { -- test -n "$verbose" && echo " ... testing for include-directories under /usr/local" -- test -d /usr/local/include && cf_search="$cf_search /usr/local/include" -- test -d /usr/local/include/$cf_ncuhdr_root && cf_search="$cf_search /usr/local/include/$cf_ncuhdr_root" -- test -d /usr/local/include/$cf_ncuhdr_root/include && cf_search="$cf_search /usr/local/include/$cf_ncuhdr_root/include" -- test -d /usr/local/$cf_ncuhdr_root/include && cf_search="$cf_search /usr/local/$cf_ncuhdr_root/include" -- test -d /usr/local/$cf_ncuhdr_root/include/$cf_ncuhdr_root && cf_search="$cf_search /usr/local/$cf_ncuhdr_root/include/$cf_ncuhdr_root" --} -+echo "$as_me:8255: checking for ncurses version" >&5 -+echo $ECHO_N "checking for ncurses version... $ECHO_C" >&6 -+if test "${cf_cv_ncurses_version+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else - --test "/opt" != "$prefix" && \ --test -d "/opt" && \ --(test $prefix = NONE || test "/opt" != "$prefix") && { -- test -n "$verbose" && echo " ... testing for include-directories under /opt" -- test -d /opt/include && cf_search="$cf_search /opt/include" -- test -d /opt/include/$cf_ncuhdr_root && cf_search="$cf_search /opt/include/$cf_ncuhdr_root" -- test -d /opt/include/$cf_ncuhdr_root/include && cf_search="$cf_search /opt/include/$cf_ncuhdr_root/include" -- test -d /opt/$cf_ncuhdr_root/include && cf_search="$cf_search /opt/$cf_ncuhdr_root/include" -- test -d /opt/$cf_ncuhdr_root/include/$cf_ncuhdr_root && cf_search="$cf_search /opt/$cf_ncuhdr_root/include/$cf_ncuhdr_root" --} -+ cf_cv_ncurses_version=no -+ cf_tempfile=out$$ -+ rm -f $cf_tempfile -+ if test "$cross_compiling" = yes; then - --test "$HOME" != "$prefix" && \ --test -d "$HOME" && \ --(test $prefix = NONE || test "$HOME" != "$prefix") && { -- test -n "$verbose" && echo " ... testing for include-directories under $HOME" -- test -d $HOME/include && cf_search="$cf_search $HOME/include" -- test -d $HOME/include/$cf_ncuhdr_root && cf_search="$cf_search $HOME/include/$cf_ncuhdr_root" -- test -d $HOME/include/$cf_ncuhdr_root/include && cf_search="$cf_search $HOME/include/$cf_ncuhdr_root/include" -- test -d $HOME/$cf_ncuhdr_root/include && cf_search="$cf_search $HOME/$cf_ncuhdr_root/include" -- test -d $HOME/$cf_ncuhdr_root/include/$cf_ncuhdr_root && cf_search="$cf_search $HOME/$cf_ncuhdr_root/include/$cf_ncuhdr_root" --} -+ # This will not work if the preprocessor splits the line after the -+ # Autoconf token. The 'unproto' program does that. -+ cat > conftest.$ac_ext <<EOF -+#include <${cf_cv_ncurses_header:-curses.h}> -+#undef Autoconf -+#ifdef NCURSES_VERSION -+Autoconf NCURSES_VERSION -+#else -+#ifdef __NCURSES_H -+Autoconf "old" -+#endif -+; -+#endif -+EOF -+ cf_try="$ac_cpp conftest.$ac_ext 2>&5 | grep '^Autoconf ' >conftest.out" -+ { (eval echo "$as_me:8281: \"$cf_try\"") >&5 -+ (eval $cf_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:8284: \$? = $ac_status" >&5 -+ (exit $ac_status); } -+ if test -f conftest.out ; then -+ cf_out=`cat conftest.out | sed -e 's%^Autoconf %%' -e 's%^[^"]*"%%' -e 's%".*%%'` -+ test -n "$cf_out" && cf_cv_ncurses_version="$cf_out" -+ rm -f conftest.out -+ fi - --test "$includedir" != NONE && \ --test "$includedir" != "/usr/include" && \ --test -d "$includedir" && { -- test -d $includedir && cf_search="$cf_search $includedir" -- test -d $includedir/$cf_ncuhdr_root && cf_search="$cf_search $includedir/$cf_ncuhdr_root" --} -+else -+ cat >conftest.$ac_ext <<_ACEOF -+#line 8294 "configure" -+#include "confdefs.h" - --test "$oldincludedir" != NONE && \ --test "$oldincludedir" != "/usr/include" && \ --test -d "$oldincludedir" && { -- test -d $oldincludedir && cf_search="$cf_search $oldincludedir" -- test -d $oldincludedir/$cf_ncuhdr_root && cf_search="$cf_search $oldincludedir/$cf_ncuhdr_root" -+#include <${cf_cv_ncurses_header:-curses.h}> -+#include <stdio.h> -+int main() -+{ -+ FILE *fp = fopen("$cf_tempfile", "w"); -+#ifdef NCURSES_VERSION -+# ifdef NCURSES_VERSION_PATCH -+ fprintf(fp, "%s.%d\n", NCURSES_VERSION, NCURSES_VERSION_PATCH); -+# else -+ fprintf(fp, "%s\n", NCURSES_VERSION); -+# endif -+#else -+# ifdef __NCURSES_H -+ fprintf(fp, "old\n"); -+# else -+ make an error -+# endif -+#endif -+ ${cf_cv_main_return:-return}(0); - } -+_ACEOF -+rm -f conftest$ac_exeext -+if { (eval echo "$as_me:8319: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>&5 -+ ac_status=$? -+ echo "$as_me:8322: \$? = $ac_status" >&5 -+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext' -+ { (eval echo "$as_me:8324: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:8327: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then - --cf_search="$cf_search $cf_header_path_list" -- -- test -n "$verbose" && echo search path $cf_search -- cf_save2_CPPFLAGS="$CPPFLAGS" -- for cf_incdir in $cf_search -- do -+ cf_cv_ncurses_version=`cat $cf_tempfile` -+else -+ echo "$as_me: program exited with status $ac_status" >&5 -+echo "$as_me: failed program was:" >&5 -+cat conftest.$ac_ext >&5 -+fi -+rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -+fi -+ rm -f $cf_tempfile - --if test -n "$cf_incdir" ; then -- for cf_add_incdir in $cf_incdir -- do -- while test $cf_add_incdir != /usr/include -- do -- if test -d $cf_add_incdir -- then -- cf_have_incdir=no -- if test -n "$CFLAGS$CPPFLAGS" ; then -- # a loop is needed to ensure we can add subdirs of existing dirs -- for cf_test_incdir in $CFLAGS $CPPFLAGS ; do -- if test ".$cf_test_incdir" = ".-I$cf_add_incdir" ; then -- cf_have_incdir=yes; break -- fi -- done -- fi -+fi -+echo "$as_me:8341: result: $cf_cv_ncurses_version" >&5 -+echo "${ECHO_T}$cf_cv_ncurses_version" >&6 -+test "$cf_cv_ncurses_version" = no || -+cat >>confdefs.h <<\EOF -+#define NCURSES 1 -+EOF - -- if test "$cf_have_incdir" = no ; then -- if test "$cf_add_incdir" = /usr/local/include ; then -- if test "$GCC" = yes -- then -- cf_save_CPPFLAGS=$CPPFLAGS -- CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" -- cat >conftest.$ac_ext <<_ACEOF --#line 8284 "configure" -+cf_nculib_root=ncursesw -+ # This works, except for the special case where we find gpm, but -+ # ncurses is in a nonstandard location via $LIBS, and we really want -+ # to link gpm. -+cf_ncurses_LIBS="" -+cf_ncurses_SAVE="$LIBS" -+echo "$as_me:8354: checking for Gpm_Open in -lgpm" >&5 -+echo $ECHO_N "checking for Gpm_Open in -lgpm... $ECHO_C" >&6 -+if test "${ac_cv_lib_gpm_Gpm_Open+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ ac_check_lib_save_LIBS=$LIBS -+LIBS="-lgpm $LIBS" -+cat >conftest.$ac_ext <<_ACEOF -+#line 8362 "configure" - #include "confdefs.h" --#include <stdio.h> -+ -+/* Override any gcc2 internal prototype to avoid an error. */ -+#ifdef __cplusplus -+extern "C" -+#endif -+/* We use char because int might match the return type of a gcc2 -+ builtin and then its argument prototype would still apply. */ -+char Gpm_Open (); - int - main () - { --printf("Hello") -+Gpm_Open (); - ; - return 0; - } - _ACEOF --rm -f conftest.$ac_objext --if { (eval echo "$as_me:8296: \"$ac_compile\"") >&5 -- (eval $ac_compile) 2>&5 -+rm -f conftest.$ac_objext conftest$ac_exeext -+if { (eval echo "$as_me:8381: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:8299: \$? = $ac_status" >&5 -+ echo "$as_me:8384: \$? = $ac_status" >&5 - (exit $ac_status); } && -- { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:8302: \"$ac_try\"") >&5 -+ { ac_try='test -s conftest$ac_exeext' -+ { (eval echo "$as_me:8387: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:8305: \$? = $ac_status" >&5 -+ echo "$as_me:8390: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- : -+ ac_cv_lib_gpm_Gpm_Open=yes - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --cf_have_incdir=yes -+ac_cv_lib_gpm_Gpm_Open=no - fi --rm -f conftest.$ac_objext conftest.$ac_ext -- CPPFLAGS=$cf_save_CPPFLAGS -- fi -- fi -- fi -- -- if test "$cf_have_incdir" = no ; then -- test -n "$verbose" && echo " adding $cf_add_incdir to include-path" 1>&6 -- --echo "${as_me:-configure}:8322: testing adding $cf_add_incdir to include-path ..." 1>&5 -- -- CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" -- -- cf_top_incdir=`echo $cf_add_incdir | sed -e 's%/include/.*$%/include%'` -- test "$cf_top_incdir" = "$cf_add_incdir" && break -- cf_add_incdir="$cf_top_incdir" -- else -- break -- fi -- fi -- done -- done -+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -+LIBS=$ac_check_lib_save_LIBS - fi -- -- for cf_header in \ -- ncurses.h \ -- curses.h -- do -- -- cat >conftest.$ac_ext <<_ACEOF --#line 8343 "configure" -+echo "$as_me:8401: result: $ac_cv_lib_gpm_Gpm_Open" >&5 -+echo "${ECHO_T}$ac_cv_lib_gpm_Gpm_Open" >&6 -+if test $ac_cv_lib_gpm_Gpm_Open = yes; then -+ echo "$as_me:8404: checking for initscr in -lgpm" >&5 -+echo $ECHO_N "checking for initscr in -lgpm... $ECHO_C" >&6 -+if test "${ac_cv_lib_gpm_initscr+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ ac_check_lib_save_LIBS=$LIBS -+LIBS="-lgpm $LIBS" -+cat >conftest.$ac_ext <<_ACEOF -+#line 8412 "configure" - #include "confdefs.h" - --#include <$cf_header> -+/* Override any gcc2 internal prototype to avoid an error. */ -+#ifdef __cplusplus -+extern "C" -+#endif -+/* We use char because int might match the return type of a gcc2 -+ builtin and then its argument prototype would still apply. */ -+char initscr (); - int - main () - { -- --#ifdef NCURSES_VERSION -- --printf("%s\n", NCURSES_VERSION); --#else --#ifdef __NCURSES_H --printf("old\n"); --#else -- make an error --#endif --#endif -- -+initscr (); - ; - return 0; - } - _ACEOF --rm -f conftest.$ac_objext --if { (eval echo "$as_me:8367: \"$ac_compile\"") >&5 -- (eval $ac_compile) 2>&5 -+rm -f conftest.$ac_objext conftest$ac_exeext -+if { (eval echo "$as_me:8431: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:8370: \$? = $ac_status" >&5 -+ echo "$as_me:8434: \$? = $ac_status" >&5 - (exit $ac_status); } && -- { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:8373: \"$ac_try\"") >&5 -+ { ac_try='test -s conftest$ac_exeext' -+ { (eval echo "$as_me:8437: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:8376: \$? = $ac_status" >&5 -+ echo "$as_me:8440: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- cf_cv_ncurses_h2=$cf_header -- -+ ac_cv_lib_gpm_initscr=yes - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --cf_cv_ncurses_h2=no -+ac_cv_lib_gpm_initscr=no - fi --rm -f conftest.$ac_objext conftest.$ac_ext -- -- if test "$cf_cv_ncurses_h2" != no ; then -- cf_cv_ncurses_h2=$cf_incdir/$cf_header -- test -n "$verbose" && echo $ac_n " ... found $ac_c" 1>&6 -- break -- fi -- test -n "$verbose" && echo " ... tested $cf_incdir/$cf_header" 1>&6 -- done -- CPPFLAGS="$cf_save2_CPPFLAGS" -- test "$cf_cv_ncurses_h2" != no && break -- done -- test "$cf_cv_ncurses_h2" = no && { { echo "$as_me:8397: error: not found" >&5 --echo "$as_me: error: not found" >&2;} -- { (exit 1); exit 1; }; } -- -+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -+LIBS=$ac_check_lib_save_LIBS -+fi -+echo "$as_me:8451: result: $ac_cv_lib_gpm_initscr" >&5 -+echo "${ECHO_T}$ac_cv_lib_gpm_initscr" >&6 -+if test $ac_cv_lib_gpm_initscr = yes; then -+ LIBS="$cf_ncurses_SAVE" -+else -+ cf_ncurses_LIBS="-lgpm" - fi --echo "$as_me:8402: result: $cf_cv_ncurses_h2" >&5 --echo "${ECHO_T}$cf_cv_ncurses_h2" >&6 -- -- cf_1st_incdir=`echo $cf_cv_ncurses_h2 | sed -e 's%/[^/]*$%%'` -- cf_cv_ncurses_header=`basename $cf_cv_ncurses_h2` -- if test `basename $cf_1st_incdir` = $cf_ncuhdr_root ; then -- cf_cv_ncurses_header=$cf_ncuhdr_root/$cf_cv_ncurses_header -- fi - --if test -n "$cf_1st_incdir" ; then -- for cf_add_incdir in $cf_1st_incdir -- do -- while test $cf_add_incdir != /usr/include -- do -- if test -d $cf_add_incdir -- then -- cf_have_incdir=no -- if test -n "$CFLAGS$CPPFLAGS" ; then -- # a loop is needed to ensure we can add subdirs of existing dirs -- for cf_test_incdir in $CFLAGS $CPPFLAGS ; do -- if test ".$cf_test_incdir" = ".-I$cf_add_incdir" ; then -- cf_have_incdir=yes; break -- fi -- done -- fi -+fi - -- if test "$cf_have_incdir" = no ; then -- if test "$cf_add_incdir" = /usr/local/include ; then -- if test "$GCC" = yes -- then -- cf_save_CPPFLAGS=$CPPFLAGS -- CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" -- cat >conftest.$ac_ext <<_ACEOF --#line 8435 "configure" -+case $host_os in #(vi -+freebsd*) -+ # This is only necessary if you are linking against an obsolete -+ # version of ncurses (but it should do no harm, since it's static). -+ if test "$cf_nculib_root" = ncurses ; then -+ echo "$as_me:8466: checking for tgoto in -lmytinfo" >&5 -+echo $ECHO_N "checking for tgoto in -lmytinfo... $ECHO_C" >&6 -+if test "${ac_cv_lib_mytinfo_tgoto+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ ac_check_lib_save_LIBS=$LIBS -+LIBS="-lmytinfo $LIBS" -+cat >conftest.$ac_ext <<_ACEOF -+#line 8474 "configure" - #include "confdefs.h" --#include <stdio.h> -+ -+/* Override any gcc2 internal prototype to avoid an error. */ -+#ifdef __cplusplus -+extern "C" -+#endif -+/* We use char because int might match the return type of a gcc2 -+ builtin and then its argument prototype would still apply. */ -+char tgoto (); - int - main () - { --printf("Hello") -+tgoto (); - ; - return 0; - } - _ACEOF --rm -f conftest.$ac_objext --if { (eval echo "$as_me:8447: \"$ac_compile\"") >&5 -- (eval $ac_compile) 2>&5 -+rm -f conftest.$ac_objext conftest$ac_exeext -+if { (eval echo "$as_me:8493: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:8450: \$? = $ac_status" >&5 -+ echo "$as_me:8496: \$? = $ac_status" >&5 - (exit $ac_status); } && -- { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:8453: \"$ac_try\"") >&5 -+ { ac_try='test -s conftest$ac_exeext' -+ { (eval echo "$as_me:8499: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:8456: \$? = $ac_status" >&5 -+ echo "$as_me:8502: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- : -+ ac_cv_lib_mytinfo_tgoto=yes - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --cf_have_incdir=yes -+ac_cv_lib_mytinfo_tgoto=no - fi --rm -f conftest.$ac_objext conftest.$ac_ext -- CPPFLAGS=$cf_save_CPPFLAGS -- fi -- fi -- fi -- -- if test "$cf_have_incdir" = no ; then -- test -n "$verbose" && echo " adding $cf_add_incdir to include-path" 1>&6 -- --echo "${as_me:-configure}:8473: testing adding $cf_add_incdir to include-path ..." 1>&5 -- -- CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" -- -- cf_top_incdir=`echo $cf_add_incdir | sed -e 's%/include/.*$%/include%'` -- test "$cf_top_incdir" = "$cf_add_incdir" && break -- cf_add_incdir="$cf_top_incdir" -- else -- break -- fi -- fi -- done -- done -+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -+LIBS=$ac_check_lib_save_LIBS - fi -- -+echo "$as_me:8513: result: $ac_cv_lib_mytinfo_tgoto" >&5 -+echo "${ECHO_T}$ac_cv_lib_mytinfo_tgoto" >&6 -+if test $ac_cv_lib_mytinfo_tgoto = yes; then -+ cf_ncurses_LIBS="-lmytinfo $cf_ncurses_LIBS" - fi - --# Set definitions to allow ifdef'ing for ncurses.h -- --case $cf_cv_ncurses_header in # (vi --*ncurses.h) -- cat >>confdefs.h <<\EOF --#define HAVE_NCURSES_H 1 --EOF -- -+ fi - ;; - esac - --case $cf_cv_ncurses_header in # (vi --ncurses/curses.h|ncurses/ncurses.h) -- cat >>confdefs.h <<\EOF --#define HAVE_NCURSES_NCURSES_H 1 --EOF -- -- ;; --ncursesw/curses.h|ncursesw/ncurses.h) -- cat >>confdefs.h <<\EOF --#define HAVE_NCURSESW_NCURSES_H 1 --EOF -+LIBS="$cf_ncurses_LIBS $LIBS" - -- ;; --esac -+if ( test -n "$cf_cv_curses_dir" && test "$cf_cv_curses_dir" != "no" ) -+then -+ LIBS="-l$cf_nculib_root $LIBS" -+else - --echo "$as_me:8516: checking for terminfo header" >&5 --echo $ECHO_N "checking for terminfo header... $ECHO_C" >&6 --if test "${cf_cv_term_header+set}" = set; then -+ eval 'cf_cv_have_lib_'$cf_nculib_root'=no' -+ cf_libdir="" -+ echo "$as_me:8532: checking for initscr" >&5 -+echo $ECHO_N "checking for initscr... $ECHO_C" >&6 -+if test "${ac_cv_func_initscr+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else -- --case ${cf_cv_ncurses_header} in #(vi --*/ncurses.h|*/ncursesw.h) #(vi -- cf_term_header=`echo "$cf_cv_ncurses_header" | sed -e 's%ncurses[^.]*\.h$%term.h%'` -- ;; --*) -- cf_term_header=term.h -- ;; --esac -- --for cf_test in $cf_term_header "ncurses/term.h" "ncursesw/term.h" --do --cat >conftest.$ac_ext <<_ACEOF --#line 8534 "configure" -+ cat >conftest.$ac_ext <<_ACEOF -+#line 8538 "configure" - #include "confdefs.h" --#include <stdio.h> --#include <${cf_cv_ncurses_header:-curses.h}> --#include <$cf_test> -+/* System header to define __stub macros and hopefully few prototypes, -+ which can conflict with char initscr (); below. */ -+#include <assert.h> -+/* Override any gcc2 internal prototype to avoid an error. */ -+#ifdef __cplusplus -+extern "C" -+#endif -+/* We use char because int might match the return type of a gcc2 -+ builtin and then its argument prototype would still apply. */ -+char initscr (); -+char (*f) (); - - int - main () - { --int x = auto_left_margin -+/* The GNU C library defines this for functions which it implements -+ to always fail with ENOSYS. Some functions are actually named -+ something starting with __ and the normal name is an alias. */ -+#if defined (__stub_initscr) || defined (__stub___initscr) -+choke me -+#else -+f = initscr; /* workaround for ICC 12.0.3 */ if (f == 0) return 1; -+#endif -+ - ; - return 0; - } - _ACEOF --rm -f conftest.$ac_objext --if { (eval echo "$as_me:8549: \"$ac_compile\"") >&5 -- (eval $ac_compile) 2>&5 -+rm -f conftest.$ac_objext conftest$ac_exeext -+if { (eval echo "$as_me:8569: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:8552: \$? = $ac_status" >&5 -+ echo "$as_me:8572: \$? = $ac_status" >&5 - (exit $ac_status); } && -- { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:8555: \"$ac_try\"") >&5 -+ { ac_try='test -s conftest$ac_exeext' -+ { (eval echo "$as_me:8575: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:8558: \$? = $ac_status" >&5 -+ echo "$as_me:8578: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- -- cf_cv_term_header="$cf_test" -+ ac_cv_func_initscr=yes - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 -- -- cf_cv_term_header=unknown -- -+ac_cv_func_initscr=no - fi --rm -f conftest.$ac_objext conftest.$ac_ext -- test "$cf_cv_term_header" != unknown && break --done -- -+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - fi --echo "$as_me:8574: result: $cf_cv_term_header" >&5 --echo "${ECHO_T}$cf_cv_term_header" >&6 -- --# Set definitions to allow ifdef'ing to accommodate subdirectories -- --case $cf_cv_term_header in # (vi --*term.h) -- cat >>confdefs.h <<\EOF --#define HAVE_TERM_H 1 --EOF -- -- ;; --esac -- --case $cf_cv_term_header in # (vi --ncurses/term.h) #(vi -- cat >>confdefs.h <<\EOF --#define HAVE_NCURSES_TERM_H 1 --EOF -- -- ;; --ncursesw/term.h) -- cat >>confdefs.h <<\EOF --#define HAVE_NCURSESW_TERM_H 1 --EOF -- -- ;; --esac -- --# some applications need this, but should check for NCURSES_VERSION --cat >>confdefs.h <<\EOF --#define NCURSES 1 --EOF -- --echo "$as_me:8608: checking for ncurses version" >&5 --echo $ECHO_N "checking for ncurses version... $ECHO_C" >&6 --if test "${cf_cv_ncurses_version+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 -+echo "$as_me:8588: result: $ac_cv_func_initscr" >&5 -+echo "${ECHO_T}$ac_cv_func_initscr" >&6 -+if test $ac_cv_func_initscr = yes; then -+ eval 'cf_cv_have_lib_'$cf_nculib_root'=yes' - else - -- cf_cv_ncurses_version=no -- cf_tempfile=out$$ -- rm -f $cf_tempfile -- if test "$cross_compiling" = yes; then -- -- # This will not work if the preprocessor splits the line after the -- # Autoconf token. The 'unproto' program does that. -- cat > conftest.$ac_ext <<EOF --#include <${cf_cv_ncurses_header:-curses.h}> --#undef Autoconf --#ifdef NCURSES_VERSION --Autoconf NCURSES_VERSION --#else --#ifdef __NCURSES_H --Autoconf "old" --#endif --; --#endif --EOF -- cf_try="$ac_cpp conftest.$ac_ext 2>&5 | grep '^Autoconf ' >conftest.out" -- { (eval echo "$as_me:8634: \"$cf_try\"") >&5 -- (eval $cf_try) 2>&5 -- ac_status=$? -- echo "$as_me:8637: \$? = $ac_status" >&5 -- (exit $ac_status); } -- if test -f conftest.out ; then -- cf_out=`cat conftest.out | sed -e 's%^Autoconf %%' -e 's%^[^"]*"%%' -e 's%".*%%'` -- test -n "$cf_out" && cf_cv_ncurses_version="$cf_out" -- rm -f conftest.out -- fi -- --else -- cat >conftest.$ac_ext <<_ACEOF --#line 8647 "configure" -+ cf_save_LIBS="$LIBS" -+ echo "$as_me:8595: checking for initscr in -l$cf_nculib_root" >&5 -+echo $ECHO_N "checking for initscr in -l$cf_nculib_root... $ECHO_C" >&6 -+ LIBS="-l$cf_nculib_root $LIBS" -+ cat >conftest.$ac_ext <<_ACEOF -+#line 8599 "configure" - #include "confdefs.h" -- - #include <${cf_cv_ncurses_header:-curses.h}> --#include <stdio.h> --int main() -+int -+main () - { -- FILE *fp = fopen("$cf_tempfile", "w"); --#ifdef NCURSES_VERSION --# ifdef NCURSES_VERSION_PATCH -- fprintf(fp, "%s.%d\n", NCURSES_VERSION, NCURSES_VERSION_PATCH); --# else -- fprintf(fp, "%s\n", NCURSES_VERSION); --# endif --#else --# ifdef __NCURSES_H -- fprintf(fp, "old\n"); --# else -- make an error --# endif --#endif -- ${cf_cv_main_return:-return}(0); -+initscr() -+ ; -+ return 0; - } - _ACEOF --rm -f conftest$ac_exeext --if { (eval echo "$as_me:8672: \"$ac_link\"") >&5 -+rm -f conftest.$ac_objext conftest$ac_exeext -+if { (eval echo "$as_me:8611: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:8675: \$? = $ac_status" >&5 -- (exit $ac_status); } && { ac_try='./conftest$ac_exeext' -- { (eval echo "$as_me:8677: \"$ac_try\"") >&5 -+ echo "$as_me:8614: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -s conftest$ac_exeext' -+ { (eval echo "$as_me:8617: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:8680: \$? = $ac_status" >&5 -+ echo "$as_me:8620: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -+ echo "$as_me:8622: result: yes" >&5 -+echo "${ECHO_T}yes" >&6 -+ eval 'cf_cv_have_lib_'$cf_nculib_root'=yes' - -- cf_cv_ncurses_version=`cat $cf_tempfile` - else -- echo "$as_me: program exited with status $ac_status" >&5 --echo "$as_me: failed program was:" >&5 -+ echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --fi --rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext --fi -- rm -f $cf_tempfile -+echo "$as_me:8629: result: no" >&5 -+echo "${ECHO_T}no" >&6 -+ -+cf_search= -+cf_library_path_list="" -+if test -n "${LDFLAGS}${LIBS}" ; then -+ for cf_library_path in $LDFLAGS $LIBS -+ do -+ case $cf_library_path in #(vi -+ -L*) -+ cf_library_path=`echo ".$cf_library_path" |sed -e 's/^...//' -e 's,/lib$,,'` -+ -+test "x$cf_library_path" != "xNONE" && \ -+test -d "$cf_library_path" && \ -+ { -+ test -n "$verbose" && echo " ... testing for lib-directories under $cf_library_path" -+ test -d $cf_library_path/lib && cf_search="$cf_search $cf_library_path/lib" -+ test -d $cf_library_path/lib/$cf_nculib_root && cf_search="$cf_search $cf_library_path/lib/$cf_nculib_root" -+ test -d $cf_library_path/lib/$cf_nculib_root/lib && cf_search="$cf_search $cf_library_path/lib/$cf_nculib_root/lib" -+ test -d $cf_library_path/$cf_nculib_root/lib && cf_search="$cf_search $cf_library_path/$cf_nculib_root/lib" -+ test -d $cf_library_path/$cf_nculib_root/lib/$cf_nculib_root && cf_search="$cf_search $cf_library_path/$cf_nculib_root/lib/$cf_nculib_root" -+} - -+ cf_library_path_list="$cf_library_path_list $cf_search" -+ ;; -+ esac -+ done - fi --echo "$as_me:8694: result: $cf_cv_ncurses_version" >&5 --echo "${ECHO_T}$cf_cv_ncurses_version" >&6 --test "$cf_cv_ncurses_version" = no || cat >>confdefs.h <<\EOF --#define NCURSES 1 --EOF - --cf_nculib_root=ncursesw -- # This works, except for the special case where we find gpm, but -- # ncurses is in a nonstandard location via $LIBS, and we really want -- # to link gpm. --cf_ncurses_LIBS="" --cf_ncurses_SAVE="$LIBS" --echo "$as_me:8706: checking for Gpm_Open in -lgpm" >&5 --echo $ECHO_N "checking for Gpm_Open in -lgpm... $ECHO_C" >&6 --if test "${ac_cv_lib_gpm_Gpm_Open+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 --else -- ac_check_lib_save_LIBS=$LIBS --LIBS="-lgpm $LIBS" --cat >conftest.$ac_ext <<_ACEOF --#line 8714 "configure" --#include "confdefs.h" -+cf_search= - --/* Override any gcc2 internal prototype to avoid an error. */ --#ifdef __cplusplus --extern "C" --#endif --/* We use char because int might match the return type of a gcc2 -- builtin and then its argument prototype would still apply. */ --char Gpm_Open (); -+test "x/usr" != "x$prefix" && \ -+test -d "/usr" && \ -+(test -z "$prefix" || test x$prefix = xNONE || test "x/usr" != "x$prefix") && { -+ test -n "$verbose" && echo " ... testing for lib-directories under /usr" -+ test -d /usr/lib && cf_search="$cf_search /usr/lib" -+ test -d /usr/lib/$cf_nculib_root && cf_search="$cf_search /usr/lib/$cf_nculib_root" -+ test -d /usr/lib/$cf_nculib_root/lib && cf_search="$cf_search /usr/lib/$cf_nculib_root/lib" -+ test -d /usr/$cf_nculib_root/lib && cf_search="$cf_search /usr/$cf_nculib_root/lib" -+ test -d /usr/$cf_nculib_root/lib/$cf_nculib_root && cf_search="$cf_search /usr/$cf_nculib_root/lib/$cf_nculib_root" -+} -+ -+test "x$prefix" != "xNONE" && \ -+test -d "$prefix" && \ -+ { -+ test -n "$verbose" && echo " ... testing for lib-directories under $prefix" -+ test -d $prefix/lib && cf_search="$cf_search $prefix/lib" -+ test -d $prefix/lib/$cf_nculib_root && cf_search="$cf_search $prefix/lib/$cf_nculib_root" -+ test -d $prefix/lib/$cf_nculib_root/lib && cf_search="$cf_search $prefix/lib/$cf_nculib_root/lib" -+ test -d $prefix/$cf_nculib_root/lib && cf_search="$cf_search $prefix/$cf_nculib_root/lib" -+ test -d $prefix/$cf_nculib_root/lib/$cf_nculib_root && cf_search="$cf_search $prefix/$cf_nculib_root/lib/$cf_nculib_root" -+} -+ -+test "x/usr/local" != "x$prefix" && \ -+test -d "/usr/local" && \ -+(test -z "$prefix" || test x$prefix = xNONE || test "x/usr/local" != "x$prefix") && { -+ test -n "$verbose" && echo " ... testing for lib-directories under /usr/local" -+ test -d /usr/local/lib && cf_search="$cf_search /usr/local/lib" -+ test -d /usr/local/lib/$cf_nculib_root && cf_search="$cf_search /usr/local/lib/$cf_nculib_root" -+ test -d /usr/local/lib/$cf_nculib_root/lib && cf_search="$cf_search /usr/local/lib/$cf_nculib_root/lib" -+ test -d /usr/local/$cf_nculib_root/lib && cf_search="$cf_search /usr/local/$cf_nculib_root/lib" -+ test -d /usr/local/$cf_nculib_root/lib/$cf_nculib_root && cf_search="$cf_search /usr/local/$cf_nculib_root/lib/$cf_nculib_root" -+} -+ -+test "x/opt" != "x$prefix" && \ -+test -d "/opt" && \ -+(test -z "$prefix" || test x$prefix = xNONE || test "x/opt" != "x$prefix") && { -+ test -n "$verbose" && echo " ... testing for lib-directories under /opt" -+ test -d /opt/lib && cf_search="$cf_search /opt/lib" -+ test -d /opt/lib/$cf_nculib_root && cf_search="$cf_search /opt/lib/$cf_nculib_root" -+ test -d /opt/lib/$cf_nculib_root/lib && cf_search="$cf_search /opt/lib/$cf_nculib_root/lib" -+ test -d /opt/$cf_nculib_root/lib && cf_search="$cf_search /opt/$cf_nculib_root/lib" -+ test -d /opt/$cf_nculib_root/lib/$cf_nculib_root && cf_search="$cf_search /opt/$cf_nculib_root/lib/$cf_nculib_root" -+} -+ -+test "x$HOME" != "x$prefix" && \ -+test -d "$HOME" && \ -+(test -z "$prefix" || test x$prefix = xNONE || test "x$HOME" != "x$prefix") && { -+ test -n "$verbose" && echo " ... testing for lib-directories under $HOME" -+ test -d $HOME/lib && cf_search="$cf_search $HOME/lib" -+ test -d $HOME/lib/$cf_nculib_root && cf_search="$cf_search $HOME/lib/$cf_nculib_root" -+ test -d $HOME/lib/$cf_nculib_root/lib && cf_search="$cf_search $HOME/lib/$cf_nculib_root/lib" -+ test -d $HOME/$cf_nculib_root/lib && cf_search="$cf_search $HOME/$cf_nculib_root/lib" -+ test -d $HOME/$cf_nculib_root/lib/$cf_nculib_root && cf_search="$cf_search $HOME/$cf_nculib_root/lib/$cf_nculib_root" -+} -+ -+cf_search="$cf_library_path_list $cf_search" -+ -+ for cf_libdir in $cf_search -+ do -+ echo "$as_me:8719: checking for -l$cf_nculib_root in $cf_libdir" >&5 -+echo $ECHO_N "checking for -l$cf_nculib_root in $cf_libdir... $ECHO_C" >&6 -+ LIBS="-L$cf_libdir -l$cf_nculib_root $cf_save_LIBS" -+ cat >conftest.$ac_ext <<_ACEOF -+#line 8723 "configure" -+#include "confdefs.h" -+#include <${cf_cv_ncurses_header:-curses.h}> - int - main () - { --Gpm_Open (); -+initscr() - ; - return 0; - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:8733: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:8735: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:8736: \$? = $ac_status" >&5 -+ echo "$as_me:8738: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:8739: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:8741: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:8742: \$? = $ac_status" >&5 -+ echo "$as_me:8744: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- ac_cv_lib_gpm_Gpm_Open=yes -+ echo "$as_me:8746: result: yes" >&5 -+echo "${ECHO_T}yes" >&6 -+ eval 'cf_cv_have_lib_'$cf_nculib_root'=yes' -+ break - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --ac_cv_lib_gpm_Gpm_Open=no -+echo "$as_me:8753: result: no" >&5 -+echo "${ECHO_T}no" >&6 -+ LIBS="$cf_save_LIBS" - fi - rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext --LIBS=$ac_check_lib_save_LIBS -+ done -+ - fi --echo "$as_me:8753: result: $ac_cv_lib_gpm_Gpm_Open" >&5 --echo "${ECHO_T}$ac_cv_lib_gpm_Gpm_Open" >&6 --if test $ac_cv_lib_gpm_Gpm_Open = yes; then -- echo "$as_me:8756: checking for initscr in -lgpm" >&5 --echo $ECHO_N "checking for initscr in -lgpm... $ECHO_C" >&6 --if test "${ac_cv_lib_gpm_initscr+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 --else -- ac_check_lib_save_LIBS=$LIBS --LIBS="-lgpm $LIBS" --cat >conftest.$ac_ext <<_ACEOF --#line 8764 "configure" --#include "confdefs.h" -+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - --/* Override any gcc2 internal prototype to avoid an error. */ --#ifdef __cplusplus --extern "C" --#endif --/* We use char because int might match the return type of a gcc2 -- builtin and then its argument prototype would still apply. */ --char initscr (); --int --main () --{ --initscr (); -- ; -- return 0; --} --_ACEOF --rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:8783: \"$ac_link\"") >&5 -- (eval $ac_link) 2>&5 -- ac_status=$? -- echo "$as_me:8786: \$? = $ac_status" >&5 -- (exit $ac_status); } && -- { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:8789: \"$ac_try\"") >&5 -- (eval $ac_try) 2>&5 -- ac_status=$? -- echo "$as_me:8792: \$? = $ac_status" >&5 -- (exit $ac_status); }; }; then -- ac_cv_lib_gpm_initscr=yes --else -- echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 --ac_cv_lib_gpm_initscr=no --fi --rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext --LIBS=$ac_check_lib_save_LIBS - fi --echo "$as_me:8803: result: $ac_cv_lib_gpm_initscr" >&5 --echo "${ECHO_T}$ac_cv_lib_gpm_initscr" >&6 --if test $ac_cv_lib_gpm_initscr = yes; then -- LIBS="$cf_ncurses_SAVE" --else -- cf_ncurses_LIBS="-lgpm" -+ -+eval 'cf_found_library=$cf_cv_have_lib_'$cf_nculib_root -+ -+if test $cf_found_library = no ; then -+ { { echo "$as_me:8768: error: Cannot link $cf_nculib_root library" >&5 -+echo "$as_me: error: Cannot link $cf_nculib_root library" >&2;} -+ { (exit 1); exit 1; }; } - fi - - fi - --case $host_os in #(vi --freebsd*) -- # This is only necessary if you are linking against an obsolete -- # version of ncurses (but it should do no harm, since it's static). -- if test "$cf_nculib_root" = ncurses ; then -- echo "$as_me:8818: checking for tgoto in -lmytinfo" >&5 --echo $ECHO_N "checking for tgoto in -lmytinfo... $ECHO_C" >&6 --if test "${ac_cv_lib_mytinfo_tgoto+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 --else -- ac_check_lib_save_LIBS=$LIBS --LIBS="-lmytinfo $LIBS" --cat >conftest.$ac_ext <<_ACEOF --#line 8826 "configure" -+if test -n "$cf_ncurses_LIBS" ; then -+ echo "$as_me:8776: checking if we can link $cf_nculib_root without $cf_ncurses_LIBS" >&5 -+echo $ECHO_N "checking if we can link $cf_nculib_root without $cf_ncurses_LIBS... $ECHO_C" >&6 -+ cf_ncurses_SAVE="$LIBS" -+ for p in $cf_ncurses_LIBS ; do -+ q=`echo $LIBS | sed -e "s%$p %%" -e "s%$p$%%"` -+ if test "$q" != "$LIBS" ; then -+ LIBS="$q" -+ fi -+ done -+ cat >conftest.$ac_ext <<_ACEOF -+#line 8786 "configure" - #include "confdefs.h" -- --/* Override any gcc2 internal prototype to avoid an error. */ --#ifdef __cplusplus --extern "C" --#endif --/* We use char because int might match the return type of a gcc2 -- builtin and then its argument prototype would still apply. */ --char tgoto (); -+#include <${cf_cv_ncurses_header:-curses.h}> - int - main () - { --tgoto (); -+initscr(); mousemask(0,0); tgoto((char *)0, 0, 0); - ; - return 0; - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:8845: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:8798: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:8848: \$? = $ac_status" >&5 -+ echo "$as_me:8801: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:8851: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:8804: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:8854: \$? = $ac_status" >&5 -+ echo "$as_me:8807: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- ac_cv_lib_mytinfo_tgoto=yes -+ echo "$as_me:8809: result: yes" >&5 -+echo "${ECHO_T}yes" >&6 - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --ac_cv_lib_mytinfo_tgoto=no -+echo "$as_me:8814: result: no" >&5 -+echo "${ECHO_T}no" >&6 -+ LIBS="$cf_ncurses_SAVE" - fi - rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext --LIBS=$ac_check_lib_save_LIBS - fi --echo "$as_me:8865: result: $ac_cv_lib_mytinfo_tgoto" >&5 --echo "${ECHO_T}$ac_cv_lib_mytinfo_tgoto" >&6 --if test $ac_cv_lib_mytinfo_tgoto = yes; then -- cf_ncurses_LIBS="-lmytinfo $cf_ncurses_LIBS" -+ -+cf_nculib_ROOT=`echo "HAVE_LIB$cf_nculib_root" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` -+ -+cat >>confdefs.h <<EOF -+#define $cf_nculib_ROOT 1 -+EOF -+ - fi - -- fi - ;; --esac -+pdcurses) -+ echo "$as_me:8831: checking for X" >&5 -+echo $ECHO_N "checking for X... $ECHO_C" >&6 - --LIBS="$cf_ncurses_LIBS $LIBS" -+# Check whether --with-x or --without-x was given. -+if test "${with_x+set}" = set; then -+ withval="$with_x" - --if ( test -n "$cf_cv_curses_dir" && test "$cf_cv_curses_dir" != "no" ) --then -- LIBS="-l$cf_nculib_root $LIBS" -+fi; -+# $have_x is `yes', `no', `disabled', or empty when we do not yet know. -+if test "x$with_x" = xno; then -+ # The user explicitly disabled X. -+ have_x=disabled - else -- -- eval 'cf_cv_have_lib_'$cf_nculib_root'=no' -- cf_libdir="" -- echo "$as_me:8884: checking for initscr" >&5 --echo $ECHO_N "checking for initscr... $ECHO_C" >&6 --if test "${ac_cv_func_initscr+set}" = set; then -+ if test "x$x_includes" != xNONE && test "x$x_libraries" != xNONE; then -+ # Both variables are already set. -+ have_x=yes -+ else -+ if test "${ac_cv_have_x+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else -+ # One or both of the vars are not set, and there is no cached value. -+ac_x_includes=no ac_x_libraries=no -+rm -fr conftest.dir -+if mkdir conftest.dir; then -+ cd conftest.dir -+ # Make sure to not put "make" in the Imakefile rules, since we grep it out. -+ cat >Imakefile <<'EOF' -+acfindx: -+ @echo 'ac_im_incroot="${INCROOT}"; ac_im_usrlibdir="${USRLIBDIR}"; ac_im_libdir="${LIBDIR}"' -+EOF -+ if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then -+ # GNU make sometimes prints "make[1]: Entering...", which would confuse us. -+ eval `${MAKE-make} acfindx 2>/dev/null | grep -v make` -+ # Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR. -+ for ac_extension in a so sl dylib dll; do -+ if test ! -f $ac_im_usrlibdir/libX11.$ac_extension && -+ test -f $ac_im_libdir/libX11.$ac_extension; then -+ ac_im_usrlibdir=$ac_im_libdir; break -+ fi -+ done -+ # Screen out bogus values from the imake configuration. They are -+ # bogus both because they are the default anyway, and because -+ # using them would break gcc on systems where it needs fixed includes. -+ case $ac_im_incroot in -+ /usr/include) ;; -+ *) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes=$ac_im_incroot;; -+ esac -+ case $ac_im_usrlibdir in -+ /usr/lib | /lib) ;; -+ *) test -d "$ac_im_usrlibdir" && ac_x_libraries=$ac_im_usrlibdir ;; -+ esac -+ fi -+ cd .. -+ rm -fr conftest.dir -+fi -+ -+# Standard set of common directories for X headers. -+# Check X11 before X11Rn because it is often a symlink to the current release. -+ac_x_header_dirs=' -+/usr/X11/include -+/usr/X11R6/include -+/usr/X11R5/include -+/usr/X11R4/include -+ -+/usr/include/X11 -+/usr/include/X11R6 -+/usr/include/X11R5 -+/usr/include/X11R4 -+ -+/usr/local/X11/include -+/usr/local/X11R6/include -+/usr/local/X11R5/include -+/usr/local/X11R4/include -+ -+/usr/local/include/X11 -+/usr/local/include/X11R6 -+/usr/local/include/X11R5 -+/usr/local/include/X11R4 -+ -+/usr/X386/include -+/usr/x386/include -+/usr/XFree86/include/X11 -+ -+/usr/include -+/usr/local/include -+/usr/unsupported/include -+/usr/athena/include -+/usr/local/x11r5/include -+/usr/lpp/Xamples/include -+ -+/usr/openwin/include -+/usr/openwin/share/include' -+ -+if test "$ac_x_includes" = no; then -+ # Guess where to find include files, by looking for Intrinsic.h. -+ # First, try using that file with no special directory specified. - cat >conftest.$ac_ext <<_ACEOF --#line 8890 "configure" -+#line 8928 "configure" - #include "confdefs.h" --/* System header to define __stub macros and hopefully few prototypes, -- which can conflict with char initscr (); below. */ --#include <assert.h> --/* Override any gcc2 internal prototype to avoid an error. */ --#ifdef __cplusplus --extern "C" --#endif --/* We use char because int might match the return type of a gcc2 -- builtin and then its argument prototype would still apply. */ --char initscr (); --char (*f) (); -+#include <X11/Intrinsic.h> -+_ACEOF -+if { (eval echo "$as_me:8932: \"$ac_cpp conftest.$ac_ext\"") >&5 -+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 -+ ac_status=$? -+ egrep -v '^ *\+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 -+ echo "$as_me:8938: \$? = $ac_status" >&5 -+ (exit $ac_status); } >/dev/null; then -+ if test -s conftest.err; then -+ ac_cpp_err=$ac_c_preproc_warn_flag -+ else -+ ac_cpp_err= -+ fi -+else -+ ac_cpp_err=yes -+fi -+if test -z "$ac_cpp_err"; then -+ # We can compile using X headers with no special include directory. -+ac_x_includes= -+else -+ echo "$as_me: failed program was:" >&5 -+ cat conftest.$ac_ext >&5 -+ for ac_dir in $ac_x_header_dirs; do -+ if test -r "$ac_dir/X11/Intrinsic.h"; then -+ ac_x_includes=$ac_dir -+ break -+ fi -+done -+fi -+rm -f conftest.err conftest.$ac_ext -+fi # $ac_x_includes = no - -+if test "$ac_x_libraries" = no; then -+ # Check for the libraries. -+ # See if we find them without any special options. -+ # Don't add to $LIBS permanently. -+ ac_save_LIBS=$LIBS -+ LIBS="-lXt $LIBS" -+ cat >conftest.$ac_ext <<_ACEOF -+#line 8971 "configure" -+#include "confdefs.h" -+#include <X11/Intrinsic.h> - int - main () - { --/* The GNU C library defines this for functions which it implements -- to always fail with ENOSYS. Some functions are actually named -- something starting with __ and the normal name is an alias. */ --#if defined (__stub_initscr) || defined (__stub___initscr) --choke me --#else --f = initscr; --#endif -- -+XtMalloc (0) - ; - return 0; - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:8921: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:8983: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:8924: \$? = $ac_status" >&5 -+ echo "$as_me:8986: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:8927: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:8989: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:8930: \$? = $ac_status" >&5 -+ echo "$as_me:8992: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- ac_cv_func_initscr=yes -+ LIBS=$ac_save_LIBS -+# We can link X programs with no special library path. -+ac_x_libraries= - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --ac_cv_func_initscr=no --fi --rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext --fi --echo "$as_me:8940: result: $ac_cv_func_initscr" >&5 --echo "${ECHO_T}$ac_cv_func_initscr" >&6 --if test $ac_cv_func_initscr = yes; then -- eval 'cf_cv_have_lib_'$cf_nculib_root'=yes' --else -- -- cf_save_LIBS="$LIBS" -- echo "$as_me:8947: checking for initscr in -l$cf_nculib_root" >&5 --echo $ECHO_N "checking for initscr in -l$cf_nculib_root... $ECHO_C" >&6 -- LIBS="-l$cf_nculib_root $LIBS" -- cat >conftest.$ac_ext <<_ACEOF --#line 8951 "configure" -+LIBS=$ac_save_LIBS -+for ac_dir in `echo "$ac_x_includes $ac_x_header_dirs" | sed s/include/lib/g` -+do -+ # Don't even attempt the hair of trying to link an X program! -+ for ac_extension in a so sl dylib dll; do -+ if test -r $ac_dir/libXt.$ac_extension; then -+ ac_x_libraries=$ac_dir -+ break 2 -+ fi -+ done -+done -+fi -+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -+fi # $ac_x_libraries = no -+ -+if test "$ac_x_includes" = no || test "$ac_x_libraries" = no; then -+ # Didn't find X anywhere. Cache the known absence of X. -+ ac_cv_have_x="have_x=no" -+else -+ # Record where we found X for the cache. -+ ac_cv_have_x="have_x=yes \ -+ ac_x_includes=$ac_x_includes ac_x_libraries=$ac_x_libraries" -+fi -+fi -+ -+ fi -+ eval "$ac_cv_have_x" -+fi # $with_x != no -+ -+if test "$have_x" != yes; then -+ echo "$as_me:9030: result: $have_x" >&5 -+echo "${ECHO_T}$have_x" >&6 -+ no_x=yes -+else -+ # If each of the values was on the command line, it overrides each guess. -+ test "x$x_includes" = xNONE && x_includes=$ac_x_includes -+ test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries -+ # Update the cache value to reflect the command line values. -+ ac_cv_have_x="have_x=yes \ -+ ac_x_includes=$x_includes ac_x_libraries=$x_libraries" -+ echo "$as_me:9040: result: libraries $x_libraries, headers $x_includes" >&5 -+echo "${ECHO_T}libraries $x_libraries, headers $x_includes" >&6 -+fi -+ -+if test "$no_x" = yes; then -+ # Not all programs may use this symbol, but it does not hurt to define it. -+ -+cat >>confdefs.h <<\EOF -+#define X_DISPLAY_MISSING 1 -+EOF -+ -+ X_CFLAGS= X_PRE_LIBS= X_LIBS= X_EXTRA_LIBS= -+else -+ if test -n "$x_includes"; then -+ X_CFLAGS="$X_CFLAGS -I$x_includes" -+ fi -+ -+ # It would also be nice to do this for all -L options, not just this one. -+ if test -n "$x_libraries"; then -+ X_LIBS="$X_LIBS -L$x_libraries" -+ # For Solaris; some versions of Sun CC require a space after -R and -+ # others require no space. Words are not sufficient . . . . -+ case `(uname -sr) 2>/dev/null` in -+ "SunOS 5"*) -+ echo "$as_me:9064: checking whether -R must be followed by a space" >&5 -+echo $ECHO_N "checking whether -R must be followed by a space... $ECHO_C" >&6 -+ ac_xsave_LIBS=$LIBS; LIBS="$LIBS -R$x_libraries" -+ cat >conftest.$ac_ext <<_ACEOF -+#line 9068 "configure" - #include "confdefs.h" --#include <${cf_cv_ncurses_header:-curses.h}> -+ - int - main () - { --initscr() -+ - ; - return 0; - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:8963: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:9080: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:8966: \$? = $ac_status" >&5 -+ echo "$as_me:9083: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:8969: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:9086: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:8972: \$? = $ac_status" >&5 -+ echo "$as_me:9089: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- echo "$as_me:8974: result: yes" >&5 --echo "${ECHO_T}yes" >&6 -- eval 'cf_cv_have_lib_'$cf_nculib_root'=yes' -- -+ ac_R_nospace=yes - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --echo "$as_me:8981: result: no" >&5 --echo "${ECHO_T}no" >&6 -- --cf_search= --cf_library_path_list="" --if test -n "${LDFLAGS}${LIBS}" ; then -- for cf_library_path in $LDFLAGS $LIBS -- do -- case $cf_library_path in #(vi -- -L*) -- cf_library_path=`echo ".$cf_library_path" |sed -e 's/^...//' -e 's,/lib$,,'` -- --test "$cf_library_path" != "NONE" && \ --test -d "$cf_library_path" && \ -- { -- test -n "$verbose" && echo " ... testing for lib-directories under $cf_library_path" -- test -d $cf_library_path/lib && cf_search="$cf_search $cf_library_path/lib" -- test -d $cf_library_path/lib/$cf_nculib_root && cf_search="$cf_search $cf_library_path/lib/$cf_nculib_root" -- test -d $cf_library_path/lib/$cf_nculib_root/lib && cf_search="$cf_search $cf_library_path/lib/$cf_nculib_root/lib" -- test -d $cf_library_path/$cf_nculib_root/lib && cf_search="$cf_search $cf_library_path/$cf_nculib_root/lib" -- test -d $cf_library_path/$cf_nculib_root/lib/$cf_nculib_root && cf_search="$cf_search $cf_library_path/$cf_nculib_root/lib/$cf_nculib_root" --} -- -- cf_library_path_list="$cf_library_path_list $cf_search" -- ;; -- esac -- done -+ac_R_nospace=no - fi -- --cf_search= -- --test "/usr" != "$prefix" && \ --test -d "/usr" && \ --(test $prefix = NONE || test "/usr" != "$prefix") && { -- test -n "$verbose" && echo " ... testing for lib-directories under /usr" -- test -d /usr/lib && cf_search="$cf_search /usr/lib" -- test -d /usr/lib/$cf_nculib_root && cf_search="$cf_search /usr/lib/$cf_nculib_root" -- test -d /usr/lib/$cf_nculib_root/lib && cf_search="$cf_search /usr/lib/$cf_nculib_root/lib" -- test -d /usr/$cf_nculib_root/lib && cf_search="$cf_search /usr/$cf_nculib_root/lib" -- test -d /usr/$cf_nculib_root/lib/$cf_nculib_root && cf_search="$cf_search /usr/$cf_nculib_root/lib/$cf_nculib_root" --} -- --test "$prefix" != "NONE" && \ --test -d "$prefix" && \ -- { -- test -n "$verbose" && echo " ... testing for lib-directories under $prefix" -- test -d $prefix/lib && cf_search="$cf_search $prefix/lib" -- test -d $prefix/lib/$cf_nculib_root && cf_search="$cf_search $prefix/lib/$cf_nculib_root" -- test -d $prefix/lib/$cf_nculib_root/lib && cf_search="$cf_search $prefix/lib/$cf_nculib_root/lib" -- test -d $prefix/$cf_nculib_root/lib && cf_search="$cf_search $prefix/$cf_nculib_root/lib" -- test -d $prefix/$cf_nculib_root/lib/$cf_nculib_root && cf_search="$cf_search $prefix/$cf_nculib_root/lib/$cf_nculib_root" --} -- --test "/usr/local" != "$prefix" && \ --test -d "/usr/local" && \ --(test $prefix = NONE || test "/usr/local" != "$prefix") && { -- test -n "$verbose" && echo " ... testing for lib-directories under /usr/local" -- test -d /usr/local/lib && cf_search="$cf_search /usr/local/lib" -- test -d /usr/local/lib/$cf_nculib_root && cf_search="$cf_search /usr/local/lib/$cf_nculib_root" -- test -d /usr/local/lib/$cf_nculib_root/lib && cf_search="$cf_search /usr/local/lib/$cf_nculib_root/lib" -- test -d /usr/local/$cf_nculib_root/lib && cf_search="$cf_search /usr/local/$cf_nculib_root/lib" -- test -d /usr/local/$cf_nculib_root/lib/$cf_nculib_root && cf_search="$cf_search /usr/local/$cf_nculib_root/lib/$cf_nculib_root" --} -- --test "/opt" != "$prefix" && \ --test -d "/opt" && \ --(test $prefix = NONE || test "/opt" != "$prefix") && { -- test -n "$verbose" && echo " ... testing for lib-directories under /opt" -- test -d /opt/lib && cf_search="$cf_search /opt/lib" -- test -d /opt/lib/$cf_nculib_root && cf_search="$cf_search /opt/lib/$cf_nculib_root" -- test -d /opt/lib/$cf_nculib_root/lib && cf_search="$cf_search /opt/lib/$cf_nculib_root/lib" -- test -d /opt/$cf_nculib_root/lib && cf_search="$cf_search /opt/$cf_nculib_root/lib" -- test -d /opt/$cf_nculib_root/lib/$cf_nculib_root && cf_search="$cf_search /opt/$cf_nculib_root/lib/$cf_nculib_root" --} -- --test "$HOME" != "$prefix" && \ --test -d "$HOME" && \ --(test $prefix = NONE || test "$HOME" != "$prefix") && { -- test -n "$verbose" && echo " ... testing for lib-directories under $HOME" -- test -d $HOME/lib && cf_search="$cf_search $HOME/lib" -- test -d $HOME/lib/$cf_nculib_root && cf_search="$cf_search $HOME/lib/$cf_nculib_root" -- test -d $HOME/lib/$cf_nculib_root/lib && cf_search="$cf_search $HOME/lib/$cf_nculib_root/lib" -- test -d $HOME/$cf_nculib_root/lib && cf_search="$cf_search $HOME/$cf_nculib_root/lib" -- test -d $HOME/$cf_nculib_root/lib/$cf_nculib_root && cf_search="$cf_search $HOME/$cf_nculib_root/lib/$cf_nculib_root" --} -- --cf_search="$cf_library_path_list $cf_search" -- -- for cf_libdir in $cf_search -- do -- echo "$as_me:9071: checking for -l$cf_nculib_root in $cf_libdir" >&5 --echo $ECHO_N "checking for -l$cf_nculib_root in $cf_libdir... $ECHO_C" >&6 -- LIBS="-L$cf_libdir -l$cf_nculib_root $cf_save_LIBS" -- cat >conftest.$ac_ext <<_ACEOF --#line 9075 "configure" -+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -+ if test $ac_R_nospace = yes; then -+ echo "$as_me:9099: result: no" >&5 -+echo "${ECHO_T}no" >&6 -+ X_LIBS="$X_LIBS -R$x_libraries" -+ else -+ LIBS="$ac_xsave_LIBS -R $x_libraries" -+ cat >conftest.$ac_ext <<_ACEOF -+#line 9105 "configure" - #include "confdefs.h" --#include <${cf_cv_ncurses_header:-curses.h}> -+ - int - main () - { --initscr() -+ - ; - return 0; - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:9087: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:9117: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:9090: \$? = $ac_status" >&5 -+ echo "$as_me:9120: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:9093: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:9123: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:9096: \$? = $ac_status" >&5 -+ echo "$as_me:9126: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- echo "$as_me:9098: result: yes" >&5 --echo "${ECHO_T}yes" >&6 -- eval 'cf_cv_have_lib_'$cf_nculib_root'=yes' -- break -+ ac_R_space=yes - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --echo "$as_me:9105: result: no" >&5 --echo "${ECHO_T}no" >&6 -- LIBS="$cf_save_LIBS" --fi --rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -- done -- -+ac_R_space=no - fi - rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -+ if test $ac_R_space = yes; then -+ echo "$as_me:9136: result: yes" >&5 -+echo "${ECHO_T}yes" >&6 -+ X_LIBS="$X_LIBS -R $x_libraries" -+ else -+ echo "$as_me:9140: result: neither works" >&5 -+echo "${ECHO_T}neither works" >&6 -+ fi -+ fi -+ LIBS=$ac_xsave_LIBS -+ esac -+ fi - --fi -- --eval 'cf_found_library=$cf_cv_have_lib_'$cf_nculib_root -- --if test $cf_found_library = no ; then -- { { echo "$as_me:9120: error: Cannot link $cf_nculib_root library" >&5 --echo "$as_me: error: Cannot link $cf_nculib_root library" >&2;} -- { (exit 1); exit 1; }; } --fi -- --fi -+ # Check for system-dependent libraries X programs must link with. -+ # Do this before checking for the system-independent R6 libraries -+ # (-lICE), since we may need -lsocket or whatever for X linking. - --if test -n "$cf_ncurses_LIBS" ; then -- echo "$as_me:9128: checking if we can link $cf_nculib_root without $cf_ncurses_LIBS" >&5 --echo $ECHO_N "checking if we can link $cf_nculib_root without $cf_ncurses_LIBS... $ECHO_C" >&6 -- cf_ncurses_SAVE="$LIBS" -- for p in $cf_ncurses_LIBS ; do -- q=`echo $LIBS | sed -e "s%$p %%" -e "s%$p$%%"` -- if test "$q" != "$LIBS" ; then -- LIBS="$q" -- fi -- done -- cat >conftest.$ac_ext <<_ACEOF --#line 9138 "configure" -+ if test "$ISC" = yes; then -+ X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl_s -linet" -+ else -+ # Martyn Johnson says this is needed for Ultrix, if the X -+ # libraries were built with DECnet support. And Karl Berry says -+ # the Alpha needs dnet_stub (dnet does not exist). -+ ac_xsave_LIBS="$LIBS"; LIBS="$LIBS $X_LIBS -lX11" -+ cat >conftest.$ac_ext <<_ACEOF -+#line 9160 "configure" - #include "confdefs.h" --#include <${cf_cv_ncurses_header:-curses.h}> -+ -+/* Override any gcc2 internal prototype to avoid an error. */ -+#ifdef __cplusplus -+extern "C" -+#endif -+/* We use char because int might match the return type of a gcc2 -+ builtin and then its argument prototype would still apply. */ -+char XOpenDisplay (); - int - main () - { --initscr(); mousemask(0,0); tgoto((char *)0, 0, 0); -+XOpenDisplay (); - ; - return 0; - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:9150: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:9179: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:9153: \$? = $ac_status" >&5 -+ echo "$as_me:9182: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:9156: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:9185: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:9159: \$? = $ac_status" >&5 -+ echo "$as_me:9188: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- echo "$as_me:9161: result: yes" >&5 --echo "${ECHO_T}yes" >&6 -+ : - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --echo "$as_me:9166: result: no" >&5 --echo "${ECHO_T}no" >&6 -- LIBS="$cf_ncurses_SAVE" --fi --rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext --fi -- --cf_nculib_ROOT=`echo "HAVE_LIB$cf_nculib_root" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` -- --cat >>confdefs.h <<EOF --#define $cf_nculib_ROOT 1 --EOF -- --fi -+echo "$as_me:9194: checking for dnet_ntoa in -ldnet" >&5 -+echo $ECHO_N "checking for dnet_ntoa in -ldnet... $ECHO_C" >&6 -+if test "${ac_cv_lib_dnet_dnet_ntoa+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ ac_check_lib_save_LIBS=$LIBS -+LIBS="-ldnet $LIBS" -+cat >conftest.$ac_ext <<_ACEOF -+#line 9202 "configure" -+#include "confdefs.h" - -- ;; --pdcurses) #(vi -- --echo "$as_me:9184: checking if you want to use pkg-config" >&5 --echo $ECHO_N "checking if you want to use pkg-config... $ECHO_C" >&6 -- --# Check whether --with-pkg-config or --without-pkg-config was given. --if test "${with_pkg_config+set}" = set; then -- withval="$with_pkg_config" -- cf_pkg_config=$withval --else -- cf_pkg_config=yes --fi; --echo "$as_me:9194: result: $cf_pkg_config" >&5 --echo "${ECHO_T}$cf_pkg_config" >&6 -- --case $cf_pkg_config in #(vi --no) #(vi -- PKG_CONFIG=none -- ;; --yes) #(vi -- if test -n "$ac_tool_prefix"; then -- # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. --set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 --echo "$as_me:9205: checking for $ac_word" >&5 --echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 --if test "${ac_cv_path_PKG_CONFIG+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 -+/* Override any gcc2 internal prototype to avoid an error. */ -+#ifdef __cplusplus -+extern "C" -+#endif -+/* We use char because int might match the return type of a gcc2 -+ builtin and then its argument prototype would still apply. */ -+char dnet_ntoa (); -+int -+main () -+{ -+dnet_ntoa (); -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext conftest$ac_exeext -+if { (eval echo "$as_me:9221: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>&5 -+ ac_status=$? -+ echo "$as_me:9224: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -s conftest$ac_exeext' -+ { (eval echo "$as_me:9227: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:9230: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ ac_cv_lib_dnet_dnet_ntoa=yes - else -- case $PKG_CONFIG in -- [\\/]* | ?:[\\/]*) -- ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. -- ;; -- *) -- ac_save_IFS=$IFS; IFS=$ac_path_separator --ac_dummy="$PATH" --for ac_dir in $ac_dummy; do -- IFS=$ac_save_IFS -- test -z "$ac_dir" && ac_dir=. -- if $as_executable_p "$ac_dir/$ac_word"; then -- ac_cv_path_PKG_CONFIG="$ac_dir/$ac_word" -- echo "$as_me:9222: found $ac_dir/$ac_word" >&5 -- break -+ echo "$as_me: failed program was:" >&5 -+cat conftest.$ac_ext >&5 -+ac_cv_lib_dnet_dnet_ntoa=no - fi --done -- -- ;; --esac -+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -+LIBS=$ac_check_lib_save_LIBS - fi --PKG_CONFIG=$ac_cv_path_PKG_CONFIG -- --if test -n "$PKG_CONFIG"; then -- echo "$as_me:9233: result: $PKG_CONFIG" >&5 --echo "${ECHO_T}$PKG_CONFIG" >&6 --else -- echo "$as_me:9236: result: no" >&5 --echo "${ECHO_T}no" >&6 -+echo "$as_me:9241: result: $ac_cv_lib_dnet_dnet_ntoa" >&5 -+echo "${ECHO_T}$ac_cv_lib_dnet_dnet_ntoa" >&6 -+if test $ac_cv_lib_dnet_dnet_ntoa = yes; then -+ X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet" - fi - --fi --if test -z "$ac_cv_path_PKG_CONFIG"; then -- ac_pt_PKG_CONFIG=$PKG_CONFIG -- # Extract the first word of "pkg-config", so it can be a program name with args. --set dummy pkg-config; ac_word=$2 --echo "$as_me:9245: checking for $ac_word" >&5 --echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 --if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then -+ if test $ac_cv_lib_dnet_dnet_ntoa = no; then -+ echo "$as_me:9248: checking for dnet_ntoa in -ldnet_stub" >&5 -+echo $ECHO_N "checking for dnet_ntoa in -ldnet_stub... $ECHO_C" >&6 -+if test "${ac_cv_lib_dnet_stub_dnet_ntoa+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else -- case $ac_pt_PKG_CONFIG in -- [\\/]* | ?:[\\/]*) -- ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. -- ;; -- *) -- ac_save_IFS=$IFS; IFS=$ac_path_separator --ac_dummy="$PATH" --for ac_dir in $ac_dummy; do -- IFS=$ac_save_IFS -- test -z "$ac_dir" && ac_dir=. -- if $as_executable_p "$ac_dir/$ac_word"; then -- ac_cv_path_ac_pt_PKG_CONFIG="$ac_dir/$ac_word" -- echo "$as_me:9262: found $ac_dir/$ac_word" >&5 -- break --fi --done -- -- test -z "$ac_cv_path_ac_pt_PKG_CONFIG" && ac_cv_path_ac_pt_PKG_CONFIG="none" -- ;; --esac --fi --ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG -+ ac_check_lib_save_LIBS=$LIBS -+LIBS="-ldnet_stub $LIBS" -+cat >conftest.$ac_ext <<_ACEOF -+#line 9256 "configure" -+#include "confdefs.h" - --if test -n "$ac_pt_PKG_CONFIG"; then -- echo "$as_me:9274: result: $ac_pt_PKG_CONFIG" >&5 --echo "${ECHO_T}$ac_pt_PKG_CONFIG" >&6 -+/* Override any gcc2 internal prototype to avoid an error. */ -+#ifdef __cplusplus -+extern "C" -+#endif -+/* We use char because int might match the return type of a gcc2 -+ builtin and then its argument prototype would still apply. */ -+char dnet_ntoa (); -+int -+main () -+{ -+dnet_ntoa (); -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext conftest$ac_exeext -+if { (eval echo "$as_me:9275: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>&5 -+ ac_status=$? -+ echo "$as_me:9278: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -s conftest$ac_exeext' -+ { (eval echo "$as_me:9281: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:9284: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ ac_cv_lib_dnet_stub_dnet_ntoa=yes - else -- echo "$as_me:9277: result: no" >&5 --echo "${ECHO_T}no" >&6 -+ echo "$as_me: failed program was:" >&5 -+cat conftest.$ac_ext >&5 -+ac_cv_lib_dnet_stub_dnet_ntoa=no -+fi -+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -+LIBS=$ac_check_lib_save_LIBS -+fi -+echo "$as_me:9295: result: $ac_cv_lib_dnet_stub_dnet_ntoa" >&5 -+echo "${ECHO_T}$ac_cv_lib_dnet_stub_dnet_ntoa" >&6 -+if test $ac_cv_lib_dnet_stub_dnet_ntoa = yes; then -+ X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub" - fi - -- PKG_CONFIG=$ac_pt_PKG_CONFIG --else -- PKG_CONFIG="$ac_cv_path_PKG_CONFIG" -+ fi - fi -+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -+ LIBS="$ac_xsave_LIBS" - -- ;; --*) -- PKG_CONFIG=$withval -- ;; --esac -+ # msh@cis.ufl.edu says -lnsl (and -lsocket) are needed for his 386/AT, -+ # to get the SysV transport functions. -+ # Chad R. Larson says the Pyramis MIS-ES running DC/OSx (SVR4) -+ # needs -lnsl. -+ # The nsl library prevents programs from opening the X display -+ # on Irix 5.2, according to T.E. Dickey. -+ # The functions gethostbyname, getservbyname, and inet_addr are -+ # in -lbsd on LynxOS 3.0.1/i386, according to Lars Hecking. -+ echo "$as_me:9314: checking for gethostbyname" >&5 -+echo $ECHO_N "checking for gethostbyname... $ECHO_C" >&6 -+if test "${ac_cv_func_gethostbyname+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ cat >conftest.$ac_ext <<_ACEOF -+#line 9320 "configure" -+#include "confdefs.h" -+/* System header to define __stub macros and hopefully few prototypes, -+ which can conflict with char gethostbyname (); below. */ -+#include <assert.h> -+/* Override any gcc2 internal prototype to avoid an error. */ -+#ifdef __cplusplus -+extern "C" -+#endif -+/* We use char because int might match the return type of a gcc2 -+ builtin and then its argument prototype would still apply. */ -+char gethostbyname (); -+char (*f) (); - --test -z "$PKG_CONFIG" && PKG_CONFIG=none --if test "$PKG_CONFIG" != none ; then -+int -+main () -+{ -+/* The GNU C library defines this for functions which it implements -+ to always fail with ENOSYS. Some functions are actually named -+ something starting with __ and the normal name is an alias. */ -+#if defined (__stub_gethostbyname) || defined (__stub___gethostbyname) -+choke me -+#else -+f = gethostbyname; /* workaround for ICC 12.0.3 */ if (f == 0) return 1; -+#endif - --if test "x$prefix" != xNONE; then -- cf_path_syntax="$prefix" -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext conftest$ac_exeext -+if { (eval echo "$as_me:9351: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>&5 -+ ac_status=$? -+ echo "$as_me:9354: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -s conftest$ac_exeext' -+ { (eval echo "$as_me:9357: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:9360: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ ac_cv_func_gethostbyname=yes - else -- cf_path_syntax="$ac_default_prefix" -+ echo "$as_me: failed program was:" >&5 -+cat conftest.$ac_ext >&5 -+ac_cv_func_gethostbyname=no - fi -- --case ".$PKG_CONFIG" in #(vi --.\$\(*\)*|.\'*\'*) #(vi -- ;; --..|./*|.\\*) #(vi -- ;; --.[a-zA-Z]:[\\/]*) #(vi OS/2 EMX -- ;; --.\${*prefix}*) #(vi -- eval PKG_CONFIG="$PKG_CONFIG" -- case ".$PKG_CONFIG" in #(vi -- .NONE/*) -- PKG_CONFIG=`echo $PKG_CONFIG | sed -e s%NONE%$cf_path_syntax%` -- ;; -- esac -- ;; #(vi --.no|.NONE/*) -- PKG_CONFIG=`echo $PKG_CONFIG | sed -e s%NONE%$cf_path_syntax%` -- ;; --*) -- { { echo "$as_me:9320: error: expected a pathname, not \"$PKG_CONFIG\"" >&5 --echo "$as_me: error: expected a pathname, not \"$PKG_CONFIG\"" >&2;} -- { (exit 1); exit 1; }; } -- ;; --esac -- -+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - fi -+echo "$as_me:9370: result: $ac_cv_func_gethostbyname" >&5 -+echo "${ECHO_T}$ac_cv_func_gethostbyname" >&6 - --echo "$as_me:9328: checking for X" >&5 --echo $ECHO_N "checking for X... $ECHO_C" >&6 -- --# Check whether --with-x or --without-x was given. --if test "${with_x+set}" = set; then -- withval="$with_x" -- --fi; --# $have_x is `yes', `no', `disabled', or empty when we do not yet know. --if test "x$with_x" = xno; then -- # The user explicitly disabled X. -- have_x=disabled --else -- if test "x$x_includes" != xNONE && test "x$x_libraries" != xNONE; then -- # Both variables are already set. -- have_x=yes -- else -- if test "${ac_cv_have_x+set}" = set; then -+ if test $ac_cv_func_gethostbyname = no; then -+ echo "$as_me:9374: checking for gethostbyname in -lnsl" >&5 -+echo $ECHO_N "checking for gethostbyname in -lnsl... $ECHO_C" >&6 -+if test "${ac_cv_lib_nsl_gethostbyname+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else -- # One or both of the vars are not set, and there is no cached value. --ac_x_includes=no ac_x_libraries=no --rm -fr conftest.dir --if mkdir conftest.dir; then -- cd conftest.dir -- # Make sure to not put "make" in the Imakefile rules, since we grep it out. -- cat >Imakefile <<'EOF' --acfindx: -- @echo 'ac_im_incroot="${INCROOT}"; ac_im_usrlibdir="${USRLIBDIR}"; ac_im_libdir="${LIBDIR}"' --EOF -- if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then -- # GNU make sometimes prints "make[1]: Entering...", which would confuse us. -- eval `${MAKE-make} acfindx 2>/dev/null | grep -v make` -- # Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR. -- for ac_extension in a so sl dylib dll; do -- if test ! -f $ac_im_usrlibdir/libX11.$ac_extension && -- test -f $ac_im_libdir/libX11.$ac_extension; then -- ac_im_usrlibdir=$ac_im_libdir; break -- fi -- done -- # Screen out bogus values from the imake configuration. They are -- # bogus both because they are the default anyway, and because -- # using them would break gcc on systems where it needs fixed includes. -- case $ac_im_incroot in -- /usr/include) ;; -- *) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes=$ac_im_incroot;; -- esac -- case $ac_im_usrlibdir in -- /usr/lib | /lib) ;; -- *) test -d "$ac_im_usrlibdir" && ac_x_libraries=$ac_im_usrlibdir ;; -- esac -- fi -- cd .. -- rm -fr conftest.dir --fi -- --# Standard set of common directories for X headers. --# Check X11 before X11Rn because it is often a symlink to the current release. --ac_x_header_dirs=' --/usr/X11/include --/usr/X11R6/include --/usr/X11R5/include --/usr/X11R4/include -- --/usr/include/X11 --/usr/include/X11R6 --/usr/include/X11R5 --/usr/include/X11R4 -- --/usr/local/X11/include --/usr/local/X11R6/include --/usr/local/X11R5/include --/usr/local/X11R4/include -- --/usr/local/include/X11 --/usr/local/include/X11R6 --/usr/local/include/X11R5 --/usr/local/include/X11R4 -- --/usr/X386/include --/usr/x386/include --/usr/XFree86/include/X11 -- --/usr/include --/usr/local/include --/usr/unsupported/include --/usr/athena/include --/usr/local/x11r5/include --/usr/lpp/Xamples/include -- --/usr/openwin/include --/usr/openwin/share/include' -- --if test "$ac_x_includes" = no; then -- # Guess where to find include files, by looking for Intrinsic.h. -- # First, try using that file with no special directory specified. -- cat >conftest.$ac_ext <<_ACEOF --#line 9425 "configure" -+ ac_check_lib_save_LIBS=$LIBS -+LIBS="-lnsl $LIBS" -+cat >conftest.$ac_ext <<_ACEOF -+#line 9382 "configure" - #include "confdefs.h" --#include <X11/Intrinsic.h> -+ -+/* Override any gcc2 internal prototype to avoid an error. */ -+#ifdef __cplusplus -+extern "C" -+#endif -+/* We use char because int might match the return type of a gcc2 -+ builtin and then its argument prototype would still apply. */ -+char gethostbyname (); -+int -+main () -+{ -+gethostbyname (); -+ ; -+ return 0; -+} - _ACEOF --if { (eval echo "$as_me:9429: \"$ac_cpp conftest.$ac_ext\"") >&5 -- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 -+rm -f conftest.$ac_objext conftest$ac_exeext -+if { (eval echo "$as_me:9401: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>&5 - ac_status=$? -- egrep -v '^ *\+' conftest.er1 >conftest.err -- rm -f conftest.er1 -- cat conftest.err >&5 -- echo "$as_me:9435: \$? = $ac_status" >&5 -- (exit $ac_status); } >/dev/null; then -- if test -s conftest.err; then -- ac_cpp_err=$ac_c_preproc_warn_flag -- else -- ac_cpp_err= -- fi --else -- ac_cpp_err=yes --fi --if test -z "$ac_cpp_err"; then -- # We can compile using X headers with no special include directory. --ac_x_includes= -+ echo "$as_me:9404: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -s conftest$ac_exeext' -+ { (eval echo "$as_me:9407: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:9410: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ ac_cv_lib_nsl_gethostbyname=yes - else - echo "$as_me: failed program was:" >&5 -- cat conftest.$ac_ext >&5 -- for ac_dir in $ac_x_header_dirs; do -- if test -r "$ac_dir/X11/Intrinsic.h"; then -- ac_x_includes=$ac_dir -- break -- fi --done -+cat conftest.$ac_ext >&5 -+ac_cv_lib_nsl_gethostbyname=no -+fi -+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -+LIBS=$ac_check_lib_save_LIBS -+fi -+echo "$as_me:9421: result: $ac_cv_lib_nsl_gethostbyname" >&5 -+echo "${ECHO_T}$ac_cv_lib_nsl_gethostbyname" >&6 -+if test $ac_cv_lib_nsl_gethostbyname = yes; then -+ X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl" - fi --rm -f conftest.err conftest.$ac_ext --fi # $ac_x_includes = no - --if test "$ac_x_libraries" = no; then -- # Check for the libraries. -- # See if we find them without any special options. -- # Don't add to $LIBS permanently. -- ac_save_LIBS=$LIBS -- LIBS="-lXt $LIBS" -- cat >conftest.$ac_ext <<_ACEOF --#line 9468 "configure" -+ if test $ac_cv_lib_nsl_gethostbyname = no; then -+ echo "$as_me:9428: checking for gethostbyname in -lbsd" >&5 -+echo $ECHO_N "checking for gethostbyname in -lbsd... $ECHO_C" >&6 -+if test "${ac_cv_lib_bsd_gethostbyname+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ ac_check_lib_save_LIBS=$LIBS -+LIBS="-lbsd $LIBS" -+cat >conftest.$ac_ext <<_ACEOF -+#line 9436 "configure" - #include "confdefs.h" --#include <X11/Intrinsic.h> -+ -+/* Override any gcc2 internal prototype to avoid an error. */ -+#ifdef __cplusplus -+extern "C" -+#endif -+/* We use char because int might match the return type of a gcc2 -+ builtin and then its argument prototype would still apply. */ -+char gethostbyname (); - int - main () - { --XtMalloc (0) -+gethostbyname (); - ; - return 0; - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:9480: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:9455: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:9483: \$? = $ac_status" >&5 -+ echo "$as_me:9458: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:9486: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:9461: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:9489: \$? = $ac_status" >&5 -+ echo "$as_me:9464: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- LIBS=$ac_save_LIBS --# We can link X programs with no special library path. --ac_x_libraries= -+ ac_cv_lib_bsd_gethostbyname=yes - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --LIBS=$ac_save_LIBS --for ac_dir in `echo "$ac_x_includes $ac_x_header_dirs" | sed s/include/lib/g` --do -- # Don't even attempt the hair of trying to link an X program! -- for ac_extension in a so sl dylib dll; do -- if test -r $ac_dir/libXt.$ac_extension; then -- ac_x_libraries=$ac_dir -- break 2 -- fi -- done --done -+ac_cv_lib_bsd_gethostbyname=no - fi - rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext --fi # $ac_x_libraries = no -- --if test "$ac_x_includes" = no || test "$ac_x_libraries" = no; then -- # Didn't find X anywhere. Cache the known absence of X. -- ac_cv_have_x="have_x=no" --else -- # Record where we found X for the cache. -- ac_cv_have_x="have_x=yes \ -- ac_x_includes=$ac_x_includes ac_x_libraries=$ac_x_libraries" --fi -+LIBS=$ac_check_lib_save_LIBS - fi -- -- fi -- eval "$ac_cv_have_x" --fi # $with_x != no -- --if test "$have_x" != yes; then -- echo "$as_me:9527: result: $have_x" >&5 --echo "${ECHO_T}$have_x" >&6 -- no_x=yes --else -- # If each of the values was on the command line, it overrides each guess. -- test "x$x_includes" = xNONE && x_includes=$ac_x_includes -- test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries -- # Update the cache value to reflect the command line values. -- ac_cv_have_x="have_x=yes \ -- ac_x_includes=$x_includes ac_x_libraries=$x_libraries" -- echo "$as_me:9537: result: libraries $x_libraries, headers $x_includes" >&5 --echo "${ECHO_T}libraries $x_libraries, headers $x_includes" >&6 -+echo "$as_me:9475: result: $ac_cv_lib_bsd_gethostbyname" >&5 -+echo "${ECHO_T}$ac_cv_lib_bsd_gethostbyname" >&6 -+if test $ac_cv_lib_bsd_gethostbyname = yes; then -+ X_EXTRA_LIBS="$X_EXTRA_LIBS -lbsd" - fi - --if test "$no_x" = yes; then -- # Not all programs may use this symbol, but it does not hurt to define it. -- --cat >>confdefs.h <<\EOF --#define X_DISPLAY_MISSING 1 --EOF -+ fi -+ fi - -- X_CFLAGS= X_PRE_LIBS= X_LIBS= X_EXTRA_LIBS= -+ # lieder@skyler.mavd.honeywell.com says without -lsocket, -+ # socket/setsockopt and other routines are undefined under SCO ODT -+ # 2.0. But -lsocket is broken on IRIX 5.2 (and is not necessary -+ # on later versions), says Simon Leinen: it contains gethostby* -+ # variants that don't use the nameserver (or something). -lsocket -+ # must be given before -lnsl if both are needed. We assume that -+ # if connect needs -lnsl, so does gethostbyname. -+ echo "$as_me:9491: checking for connect" >&5 -+echo $ECHO_N "checking for connect... $ECHO_C" >&6 -+if test "${ac_cv_func_connect+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 - else -- if test -n "$x_includes"; then -- X_CFLAGS="$X_CFLAGS -I$x_includes" -- fi -- -- # It would also be nice to do this for all -L options, not just this one. -- if test -n "$x_libraries"; then -- X_LIBS="$X_LIBS -L$x_libraries" -- # For Solaris; some versions of Sun CC require a space after -R and -- # others require no space. Words are not sufficient . . . . -- case `(uname -sr) 2>/dev/null` in -- "SunOS 5"*) -- echo "$as_me:9561: checking whether -R must be followed by a space" >&5 --echo $ECHO_N "checking whether -R must be followed by a space... $ECHO_C" >&6 -- ac_xsave_LIBS=$LIBS; LIBS="$LIBS -R$x_libraries" -- cat >conftest.$ac_ext <<_ACEOF --#line 9565 "configure" -+ cat >conftest.$ac_ext <<_ACEOF -+#line 9497 "configure" - #include "confdefs.h" -+/* System header to define __stub macros and hopefully few prototypes, -+ which can conflict with char connect (); below. */ -+#include <assert.h> -+/* Override any gcc2 internal prototype to avoid an error. */ -+#ifdef __cplusplus -+extern "C" -+#endif -+/* We use char because int might match the return type of a gcc2 -+ builtin and then its argument prototype would still apply. */ -+char connect (); -+char (*f) (); - - int - main () - { -+/* The GNU C library defines this for functions which it implements -+ to always fail with ENOSYS. Some functions are actually named -+ something starting with __ and the normal name is an alias. */ -+#if defined (__stub_connect) || defined (__stub___connect) -+choke me -+#else -+f = connect; /* workaround for ICC 12.0.3 */ if (f == 0) return 1; -+#endif - - ; - return 0; - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:9577: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:9528: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:9580: \$? = $ac_status" >&5 -+ echo "$as_me:9531: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:9583: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:9534: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:9586: \$? = $ac_status" >&5 -+ echo "$as_me:9537: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- ac_R_nospace=yes -+ ac_cv_func_connect=yes - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --ac_R_nospace=no -+ac_cv_func_connect=no - fi - rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -- if test $ac_R_nospace = yes; then -- echo "$as_me:9596: result: no" >&5 --echo "${ECHO_T}no" >&6 -- X_LIBS="$X_LIBS -R$x_libraries" -- else -- LIBS="$ac_xsave_LIBS -R $x_libraries" -- cat >conftest.$ac_ext <<_ACEOF --#line 9602 "configure" -+fi -+echo "$as_me:9547: result: $ac_cv_func_connect" >&5 -+echo "${ECHO_T}$ac_cv_func_connect" >&6 -+ -+ if test $ac_cv_func_connect = no; then -+ echo "$as_me:9551: checking for connect in -lsocket" >&5 -+echo $ECHO_N "checking for connect in -lsocket... $ECHO_C" >&6 -+if test "${ac_cv_lib_socket_connect+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ ac_check_lib_save_LIBS=$LIBS -+LIBS="-lsocket $X_EXTRA_LIBS $LIBS" -+cat >conftest.$ac_ext <<_ACEOF -+#line 9559 "configure" - #include "confdefs.h" - -+/* Override any gcc2 internal prototype to avoid an error. */ -+#ifdef __cplusplus -+extern "C" -+#endif -+/* We use char because int might match the return type of a gcc2 -+ builtin and then its argument prototype would still apply. */ -+char connect (); - int - main () - { -- -+connect (); - ; - return 0; - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:9614: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:9578: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:9617: \$? = $ac_status" >&5 -+ echo "$as_me:9581: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:9620: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:9584: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:9623: \$? = $ac_status" >&5 -+ echo "$as_me:9587: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- ac_R_space=yes -+ ac_cv_lib_socket_connect=yes - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --ac_R_space=no -+ac_cv_lib_socket_connect=no - fi - rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -- if test $ac_R_space = yes; then -- echo "$as_me:9633: result: yes" >&5 --echo "${ECHO_T}yes" >&6 -- X_LIBS="$X_LIBS -R $x_libraries" -- else -- echo "$as_me:9637: result: neither works" >&5 --echo "${ECHO_T}neither works" >&6 -- fi -- fi -- LIBS=$ac_xsave_LIBS -- esac -- fi -+LIBS=$ac_check_lib_save_LIBS -+fi -+echo "$as_me:9598: result: $ac_cv_lib_socket_connect" >&5 -+echo "${ECHO_T}$ac_cv_lib_socket_connect" >&6 -+if test $ac_cv_lib_socket_connect = yes; then -+ X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS" -+fi - -- # Check for system-dependent libraries X programs must link with. -- # Do this before checking for the system-independent R6 libraries -- # (-lICE), since we may need -lsocket or whatever for X linking. -+ fi - -- if test "$ISC" = yes; then -- X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl_s -linet" -- else -- # Martyn Johnson says this is needed for Ultrix, if the X -- # libraries were built with DECnet support. And Karl Berry says -- # the Alpha needs dnet_stub (dnet does not exist). -- ac_xsave_LIBS="$LIBS"; LIBS="$LIBS $X_LIBS -lX11" -- cat >conftest.$ac_ext <<_ACEOF --#line 9657 "configure" -+ # Guillermo Gomez says -lposix is necessary on A/UX. -+ echo "$as_me:9607: checking for remove" >&5 -+echo $ECHO_N "checking for remove... $ECHO_C" >&6 -+if test "${ac_cv_func_remove+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ cat >conftest.$ac_ext <<_ACEOF -+#line 9613 "configure" - #include "confdefs.h" -- -+/* System header to define __stub macros and hopefully few prototypes, -+ which can conflict with char remove (); below. */ -+#include <assert.h> - /* Override any gcc2 internal prototype to avoid an error. */ - #ifdef __cplusplus - extern "C" - #endif - /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ --char XOpenDisplay (); -+char remove (); -+char (*f) (); -+ - int - main () - { --XOpenDisplay (); -+/* The GNU C library defines this for functions which it implements -+ to always fail with ENOSYS. Some functions are actually named -+ something starting with __ and the normal name is an alias. */ -+#if defined (__stub_remove) || defined (__stub___remove) -+choke me -+#else -+f = remove; /* workaround for ICC 12.0.3 */ if (f == 0) return 1; -+#endif -+ - ; - return 0; - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:9676: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:9644: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:9679: \$? = $ac_status" >&5 -+ echo "$as_me:9647: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:9682: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:9650: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:9685: \$? = $ac_status" >&5 -+ echo "$as_me:9653: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- : -+ ac_cv_func_remove=yes - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --echo "$as_me:9691: checking for dnet_ntoa in -ldnet" >&5 --echo $ECHO_N "checking for dnet_ntoa in -ldnet... $ECHO_C" >&6 --if test "${ac_cv_lib_dnet_dnet_ntoa+set}" = set; then -+ac_cv_func_remove=no -+fi -+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -+fi -+echo "$as_me:9663: result: $ac_cv_func_remove" >&5 -+echo "${ECHO_T}$ac_cv_func_remove" >&6 -+ -+ if test $ac_cv_func_remove = no; then -+ echo "$as_me:9667: checking for remove in -lposix" >&5 -+echo $ECHO_N "checking for remove in -lposix... $ECHO_C" >&6 -+if test "${ac_cv_lib_posix_remove+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - ac_check_lib_save_LIBS=$LIBS --LIBS="-ldnet $LIBS" -+LIBS="-lposix $LIBS" - cat >conftest.$ac_ext <<_ACEOF --#line 9699 "configure" -+#line 9675 "configure" - #include "confdefs.h" - - /* Override any gcc2 internal prototype to avoid an error. */ -@@ -9705,178 +9681,179 @@ - #endif - /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ --char dnet_ntoa (); -+char remove (); - int - main () - { --dnet_ntoa (); -+remove (); - ; - return 0; - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:9718: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:9694: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:9721: \$? = $ac_status" >&5 -+ echo "$as_me:9697: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:9724: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:9700: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:9727: \$? = $ac_status" >&5 -+ echo "$as_me:9703: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- ac_cv_lib_dnet_dnet_ntoa=yes -+ ac_cv_lib_posix_remove=yes - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --ac_cv_lib_dnet_dnet_ntoa=no -+ac_cv_lib_posix_remove=no - fi - rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - LIBS=$ac_check_lib_save_LIBS - fi --echo "$as_me:9738: result: $ac_cv_lib_dnet_dnet_ntoa" >&5 --echo "${ECHO_T}$ac_cv_lib_dnet_dnet_ntoa" >&6 --if test $ac_cv_lib_dnet_dnet_ntoa = yes; then -- X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet" -+echo "$as_me:9714: result: $ac_cv_lib_posix_remove" >&5 -+echo "${ECHO_T}$ac_cv_lib_posix_remove" >&6 -+if test $ac_cv_lib_posix_remove = yes; then -+ X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix" - fi - -- if test $ac_cv_lib_dnet_dnet_ntoa = no; then -- echo "$as_me:9745: checking for dnet_ntoa in -ldnet_stub" >&5 --echo $ECHO_N "checking for dnet_ntoa in -ldnet_stub... $ECHO_C" >&6 --if test "${ac_cv_lib_dnet_stub_dnet_ntoa+set}" = set; then -+ fi -+ -+ # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay. -+ echo "$as_me:9723: checking for shmat" >&5 -+echo $ECHO_N "checking for shmat... $ECHO_C" >&6 -+if test "${ac_cv_func_shmat+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else -- ac_check_lib_save_LIBS=$LIBS --LIBS="-ldnet_stub $LIBS" --cat >conftest.$ac_ext <<_ACEOF --#line 9753 "configure" -+ cat >conftest.$ac_ext <<_ACEOF -+#line 9729 "configure" - #include "confdefs.h" -- -+/* System header to define __stub macros and hopefully few prototypes, -+ which can conflict with char shmat (); below. */ -+#include <assert.h> - /* Override any gcc2 internal prototype to avoid an error. */ - #ifdef __cplusplus - extern "C" - #endif - /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ --char dnet_ntoa (); -+char shmat (); -+char (*f) (); -+ - int - main () - { --dnet_ntoa (); -+/* The GNU C library defines this for functions which it implements -+ to always fail with ENOSYS. Some functions are actually named -+ something starting with __ and the normal name is an alias. */ -+#if defined (__stub_shmat) || defined (__stub___shmat) -+choke me -+#else -+f = shmat; /* workaround for ICC 12.0.3 */ if (f == 0) return 1; -+#endif -+ - ; - return 0; - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:9772: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:9760: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:9775: \$? = $ac_status" >&5 -+ echo "$as_me:9763: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:9778: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:9766: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:9781: \$? = $ac_status" >&5 -+ echo "$as_me:9769: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- ac_cv_lib_dnet_stub_dnet_ntoa=yes -+ ac_cv_func_shmat=yes - else - echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 --ac_cv_lib_dnet_stub_dnet_ntoa=no --fi --rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext --LIBS=$ac_check_lib_save_LIBS --fi --echo "$as_me:9792: result: $ac_cv_lib_dnet_stub_dnet_ntoa" >&5 --echo "${ECHO_T}$ac_cv_lib_dnet_stub_dnet_ntoa" >&6 --if test $ac_cv_lib_dnet_stub_dnet_ntoa = yes; then -- X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub" --fi -- -- fi -+cat conftest.$ac_ext >&5 -+ac_cv_func_shmat=no - fi - rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -- LIBS="$ac_xsave_LIBS" -+fi -+echo "$as_me:9779: result: $ac_cv_func_shmat" >&5 -+echo "${ECHO_T}$ac_cv_func_shmat" >&6 - -- # msh@cis.ufl.edu says -lnsl (and -lsocket) are needed for his 386/AT, -- # to get the SysV transport functions. -- # Chad R. Larson says the Pyramis MIS-ES running DC/OSx (SVR4) -- # needs -lnsl. -- # The nsl library prevents programs from opening the X display -- # on Irix 5.2, according to T.E. Dickey. -- # The functions gethostbyname, getservbyname, and inet_addr are -- # in -lbsd on LynxOS 3.0.1/i386, according to Lars Hecking. -- echo "$as_me:9811: checking for gethostbyname" >&5 --echo $ECHO_N "checking for gethostbyname... $ECHO_C" >&6 --if test "${ac_cv_func_gethostbyname+set}" = set; then -+ if test $ac_cv_func_shmat = no; then -+ echo "$as_me:9783: checking for shmat in -lipc" >&5 -+echo $ECHO_N "checking for shmat in -lipc... $ECHO_C" >&6 -+if test "${ac_cv_lib_ipc_shmat+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else -- cat >conftest.$ac_ext <<_ACEOF --#line 9817 "configure" -+ ac_check_lib_save_LIBS=$LIBS -+LIBS="-lipc $LIBS" -+cat >conftest.$ac_ext <<_ACEOF -+#line 9791 "configure" - #include "confdefs.h" --/* System header to define __stub macros and hopefully few prototypes, -- which can conflict with char gethostbyname (); below. */ --#include <assert.h> -+ - /* Override any gcc2 internal prototype to avoid an error. */ - #ifdef __cplusplus - extern "C" - #endif - /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ --char gethostbyname (); --char (*f) (); -- -+char shmat (); - int - main () - { --/* The GNU C library defines this for functions which it implements -- to always fail with ENOSYS. Some functions are actually named -- something starting with __ and the normal name is an alias. */ --#if defined (__stub_gethostbyname) || defined (__stub___gethostbyname) --choke me --#else --f = gethostbyname; --#endif -- -+shmat (); - ; - return 0; - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:9848: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:9810: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:9851: \$? = $ac_status" >&5 -+ echo "$as_me:9813: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:9854: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:9816: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:9857: \$? = $ac_status" >&5 -+ echo "$as_me:9819: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- ac_cv_func_gethostbyname=yes -+ ac_cv_lib_ipc_shmat=yes - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --ac_cv_func_gethostbyname=no -+ac_cv_lib_ipc_shmat=no - fi - rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -+LIBS=$ac_check_lib_save_LIBS -+fi -+echo "$as_me:9830: result: $ac_cv_lib_ipc_shmat" >&5 -+echo "${ECHO_T}$ac_cv_lib_ipc_shmat" >&6 -+if test $ac_cv_lib_ipc_shmat = yes; then -+ X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc" - fi --echo "$as_me:9867: result: $ac_cv_func_gethostbyname" >&5 --echo "${ECHO_T}$ac_cv_func_gethostbyname" >&6 - -- if test $ac_cv_func_gethostbyname = no; then -- echo "$as_me:9871: checking for gethostbyname in -lnsl" >&5 --echo $ECHO_N "checking for gethostbyname in -lnsl... $ECHO_C" >&6 --if test "${ac_cv_lib_nsl_gethostbyname+set}" = set; then -+ fi -+ fi -+ -+ # Check for libraries that X11R6 Xt/Xaw programs need. -+ ac_save_LDFLAGS=$LDFLAGS -+ test -n "$x_libraries" && LDFLAGS="$LDFLAGS -L$x_libraries" -+ # SM needs ICE to (dynamically) link under SunOS 4.x (so we have to -+ # check for ICE first), but we must link in the order -lSM -lICE or -+ # we get undefined symbols. So assume we have SM if we have ICE. -+ # These have to be linked with before -lX11, unlike the other -+ # libraries we check for below, so use a different variable. -+ # John Interrante, Karl Berry -+ echo "$as_me:9848: checking for IceConnectionNumber in -lICE" >&5 -+echo $ECHO_N "checking for IceConnectionNumber in -lICE... $ECHO_C" >&6 -+if test "${ac_cv_lib_ICE_IceConnectionNumber+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - ac_check_lib_save_LIBS=$LIBS --LIBS="-lnsl $LIBS" -+LIBS="-lICE $X_EXTRA_LIBS $LIBS" - cat >conftest.$ac_ext <<_ACEOF --#line 9879 "configure" -+#line 9856 "configure" - #include "confdefs.h" - - /* Override any gcc2 internal prototype to avoid an error. */ -@@ -9885,291 +9862,548 @@ - #endif - /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ --char gethostbyname (); -+char IceConnectionNumber (); - int - main () - { --gethostbyname (); -+IceConnectionNumber (); - ; - return 0; - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:9898: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:9875: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:9901: \$? = $ac_status" >&5 -+ echo "$as_me:9878: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:9904: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:9881: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:9907: \$? = $ac_status" >&5 -+ echo "$as_me:9884: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- ac_cv_lib_nsl_gethostbyname=yes -+ ac_cv_lib_ICE_IceConnectionNumber=yes - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --ac_cv_lib_nsl_gethostbyname=no -+ac_cv_lib_ICE_IceConnectionNumber=no - fi - rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - LIBS=$ac_check_lib_save_LIBS - fi --echo "$as_me:9918: result: $ac_cv_lib_nsl_gethostbyname" >&5 --echo "${ECHO_T}$ac_cv_lib_nsl_gethostbyname" >&6 --if test $ac_cv_lib_nsl_gethostbyname = yes; then -- X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl" -+echo "$as_me:9895: result: $ac_cv_lib_ICE_IceConnectionNumber" >&5 -+echo "${ECHO_T}$ac_cv_lib_ICE_IceConnectionNumber" >&6 -+if test $ac_cv_lib_ICE_IceConnectionNumber = yes; then -+ X_PRE_LIBS="$X_PRE_LIBS -lSM -lICE" - fi - -- if test $ac_cv_lib_nsl_gethostbyname = no; then -- echo "$as_me:9925: checking for gethostbyname in -lbsd" >&5 --echo $ECHO_N "checking for gethostbyname in -lbsd... $ECHO_C" >&6 --if test "${ac_cv_lib_bsd_gethostbyname+set}" = set; then -+ LDFLAGS=$ac_save_LDFLAGS -+ -+fi -+ -+cf_x_athena=${cf_x_athena:-Xaw} -+ -+echo "$as_me:9907: checking if you want to link with Xaw 3d library" >&5 -+echo $ECHO_N "checking if you want to link with Xaw 3d library... $ECHO_C" >&6 -+withval= -+ -+# Check whether --with-Xaw3d or --without-Xaw3d was given. -+if test "${with_Xaw3d+set}" = set; then -+ withval="$with_Xaw3d" -+ -+fi; -+if test "$withval" = yes ; then -+ cf_x_athena=Xaw3d -+ echo "$as_me:9918: result: yes" >&5 -+echo "${ECHO_T}yes" >&6 -+else -+ echo "$as_me:9921: result: no" >&5 -+echo "${ECHO_T}no" >&6 -+fi -+ -+echo "$as_me:9925: checking if you want to link with neXT Athena library" >&5 -+echo $ECHO_N "checking if you want to link with neXT Athena library... $ECHO_C" >&6 -+withval= -+ -+# Check whether --with-neXtaw or --without-neXtaw was given. -+if test "${with_neXtaw+set}" = set; then -+ withval="$with_neXtaw" -+ -+fi; -+if test "$withval" = yes ; then -+ cf_x_athena=neXtaw -+ echo "$as_me:9936: result: yes" >&5 -+echo "${ECHO_T}yes" >&6 -+else -+ echo "$as_me:9939: result: no" >&5 -+echo "${ECHO_T}no" >&6 -+fi -+ -+echo "$as_me:9943: checking if you want to link with Athena-Plus library" >&5 -+echo $ECHO_N "checking if you want to link with Athena-Plus library... $ECHO_C" >&6 -+withval= -+ -+# Check whether --with-XawPlus or --without-XawPlus was given. -+if test "${with_XawPlus+set}" = set; then -+ withval="$with_XawPlus" -+ -+fi; -+if test "$withval" = yes ; then -+ cf_x_athena=XawPlus -+ echo "$as_me:9954: result: yes" >&5 -+echo "${ECHO_T}yes" >&6 -+else -+ echo "$as_me:9957: result: no" >&5 -+echo "${ECHO_T}no" >&6 -+fi -+ -+cf_x_athena_lib="" -+ -+if test "$PKG_CONFIG" != none ; then -+ cf_athena_list= -+ test "$cf_x_athena" = Xaw && cf_athena_list="xaw8 xaw7 xaw6" -+ for cf_athena_pkg in \ -+ $cf_athena_list \ -+ ${cf_x_athena} \ -+ ${cf_x_athena}-devel \ -+ lib${cf_x_athena} \ -+ lib${cf_x_athena}-devel -+ do -+ -+if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists $cf_athena_pkg; then -+ test -n "$verbose" && echo " found package $cf_athena_pkg" 1>&6 -+ -+echo "${as_me:-configure}:9977: testing found package $cf_athena_pkg ..." 1>&5 -+ -+ cf_pkgconfig_incs="`$PKG_CONFIG --cflags $cf_athena_pkg 2>/dev/null`" -+ cf_pkgconfig_libs="`$PKG_CONFIG --libs $cf_athena_pkg 2>/dev/null`" -+ test -n "$verbose" && echo " package $cf_athena_pkg CFLAGS: $cf_pkgconfig_incs" 1>&6 -+ -+echo "${as_me:-configure}:9983: testing package $cf_athena_pkg CFLAGS: $cf_pkgconfig_incs ..." 1>&5 -+ -+ test -n "$verbose" && echo " package $cf_athena_pkg LIBS: $cf_pkgconfig_libs" 1>&6 -+ -+echo "${as_me:-configure}:9987: testing package $cf_athena_pkg LIBS: $cf_pkgconfig_libs ..." 1>&5 -+ -+cf_fix_cppflags=no -+cf_new_cflags= -+cf_new_cppflags= -+cf_new_extra_cppflags= -+ -+for cf_add_cflags in $cf_pkgconfig_incs -+do -+case $cf_fix_cppflags in -+no) -+ case $cf_add_cflags in #(vi -+ -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi -+ case $cf_add_cflags in -+ -D*) -+ cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` -+ -+ test "${cf_add_cflags}" != "${cf_tst_cflags}" \ -+ && test -z "${cf_tst_cflags}" \ -+ && cf_fix_cppflags=yes -+ -+ if test $cf_fix_cppflags = yes ; then -+ cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -+ continue -+ elif test "${cf_tst_cflags}" = "\"'" ; then -+ cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -+ continue -+ fi -+ ;; -+ esac -+ case "$CPPFLAGS" in -+ *$cf_add_cflags) #(vi -+ ;; -+ *) #(vi -+ case $cf_add_cflags in #(vi -+ -D*) -+ cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` -+ -+CPPFLAGS=`echo "$CPPFLAGS" | \ -+ sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ -+ -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` -+ -+ ;; -+ esac -+ cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" -+ ;; -+ esac -+ ;; -+ *) -+ cf_new_cflags="$cf_new_cflags $cf_add_cflags" -+ ;; -+ esac -+ ;; -+yes) -+ cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -+ -+ cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` -+ -+ test "${cf_add_cflags}" != "${cf_tst_cflags}" \ -+ && test -z "${cf_tst_cflags}" \ -+ && cf_fix_cppflags=no -+ ;; -+esac -+done -+ -+if test -n "$cf_new_cflags" ; then -+ -+ CFLAGS="$CFLAGS $cf_new_cflags" -+fi -+ -+if test -n "$cf_new_cppflags" ; then -+ -+ CPPFLAGS="$CPPFLAGS $cf_new_cppflags" -+fi -+ -+if test -n "$cf_new_extra_cppflags" ; then -+ -+ EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" -+fi -+ -+ LIBS="$cf_pkgconfig_libs $LIBS" -+ -+ cf_x_athena_lib="$cf_pkgconfig_libs" -+ -+cf_x_athena_LIBS=`echo "HAVE_LIB_$cf_x_athena" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` -+ -+ cat >>confdefs.h <<EOF -+#define $cf_x_athena_LIBS 1 -+EOF -+ -+ for cf_trim_lib in Xmu Xt X11 -+ do -+ case "$LIBS" in -+ *-l$cf_trim_lib\ *-l$cf_trim_lib*) -+ LIBS=`echo "$LIBS " | sed -e 's/ / /g' -e 's%-l'"$cf_trim_lib"' %%' -e 's/ $//'` -+ test -n "$verbose" && echo " ..trimmed $LIBS" 1>&6 -+ -+echo "${as_me:-configure}:10084: testing ..trimmed $LIBS ..." 1>&5 -+ -+ ;; -+ esac -+ done -+ -+echo "$as_me:10090: checking for usable $cf_x_athena/Xmu package" >&5 -+echo $ECHO_N "checking for usable $cf_x_athena/Xmu package... $ECHO_C" >&6 -+if test "${cf_cv_xaw_compat+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else -- ac_check_lib_save_LIBS=$LIBS --LIBS="-lbsd $LIBS" -+ - cat >conftest.$ac_ext <<_ACEOF --#line 9933 "configure" -+#line 10097 "configure" - #include "confdefs.h" - --/* Override any gcc2 internal prototype to avoid an error. */ --#ifdef __cplusplus --extern "C" --#endif --/* We use char because int might match the return type of a gcc2 -- builtin and then its argument prototype would still apply. */ --char gethostbyname (); -+#include <X11/Xmu/CharSet.h> -+ - int - main () - { --gethostbyname (); -+ -+int check = XmuCompareISOLatin1("big", "small") -+ - ; - return 0; - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:9952: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:10113: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:9955: \$? = $ac_status" >&5 -+ echo "$as_me:10116: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:9958: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:10119: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:9961: \$? = $ac_status" >&5 -+ echo "$as_me:10122: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- ac_cv_lib_bsd_gethostbyname=yes -+ cf_cv_xaw_compat=yes - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --ac_cv_lib_bsd_gethostbyname=no -+cf_cv_xaw_compat=no - fi - rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext --LIBS=$ac_check_lib_save_LIBS - fi --echo "$as_me:9972: result: $ac_cv_lib_bsd_gethostbyname" >&5 --echo "${ECHO_T}$ac_cv_lib_bsd_gethostbyname" >&6 --if test $ac_cv_lib_bsd_gethostbyname = yes; then -- X_EXTRA_LIBS="$X_EXTRA_LIBS -lbsd" -+echo "$as_me:10132: result: $cf_cv_xaw_compat" >&5 -+echo "${ECHO_T}$cf_cv_xaw_compat" >&6 -+ -+ if test "$cf_cv_xaw_compat" = no -+ then -+ # workaround for broken ".pc" files... -+ case "$cf_x_athena_lib" in #(vi -+ *-lXmu*) #(vi -+ ;; -+ *) -+ test -n "$verbose" && echo " work around broken package" 1>&6 -+ -+echo "${as_me:-configure}:10144: testing work around broken package ..." 1>&5 -+ -+ cf_save_xmu="$LIBS" -+ cf_first_lib=`echo "$cf_save_xmu" | sed -e 's/^ *//' -e 's/ .*//'` -+ -+if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists xmu; then -+ test -n "$verbose" && echo " found package xmu" 1>&6 -+ -+echo "${as_me:-configure}:10152: testing found package xmu ..." 1>&5 -+ -+ cf_pkgconfig_incs="`$PKG_CONFIG --cflags xmu 2>/dev/null`" -+ cf_pkgconfig_libs="`$PKG_CONFIG --libs xmu 2>/dev/null`" -+ test -n "$verbose" && echo " package xmu CFLAGS: $cf_pkgconfig_incs" 1>&6 -+ -+echo "${as_me:-configure}:10158: testing package xmu CFLAGS: $cf_pkgconfig_incs ..." 1>&5 -+ -+ test -n "$verbose" && echo " package xmu LIBS: $cf_pkgconfig_libs" 1>&6 -+ -+echo "${as_me:-configure}:10162: testing package xmu LIBS: $cf_pkgconfig_libs ..." 1>&5 -+ -+cf_fix_cppflags=no -+cf_new_cflags= -+cf_new_cppflags= -+cf_new_extra_cppflags= -+ -+for cf_add_cflags in $cf_pkgconfig_incs -+do -+case $cf_fix_cppflags in -+no) -+ case $cf_add_cflags in #(vi -+ -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi -+ case $cf_add_cflags in -+ -D*) -+ cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` -+ -+ test "${cf_add_cflags}" != "${cf_tst_cflags}" \ -+ && test -z "${cf_tst_cflags}" \ -+ && cf_fix_cppflags=yes -+ -+ if test $cf_fix_cppflags = yes ; then -+ cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -+ continue -+ elif test "${cf_tst_cflags}" = "\"'" ; then -+ cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -+ continue -+ fi -+ ;; -+ esac -+ case "$CPPFLAGS" in -+ *$cf_add_cflags) #(vi -+ ;; -+ *) #(vi -+ case $cf_add_cflags in #(vi -+ -D*) -+ cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` -+ -+CPPFLAGS=`echo "$CPPFLAGS" | \ -+ sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ -+ -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` -+ -+ ;; -+ esac -+ cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" -+ ;; -+ esac -+ ;; -+ *) -+ cf_new_cflags="$cf_new_cflags $cf_add_cflags" -+ ;; -+ esac -+ ;; -+yes) -+ cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -+ -+ cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` -+ -+ test "${cf_add_cflags}" != "${cf_tst_cflags}" \ -+ && test -z "${cf_tst_cflags}" \ -+ && cf_fix_cppflags=no -+ ;; -+esac -+done -+ -+if test -n "$cf_new_cflags" ; then -+ -+ CFLAGS="$CFLAGS $cf_new_cflags" - fi - -- fi -- fi -+if test -n "$cf_new_cppflags" ; then -+ -+ CPPFLAGS="$CPPFLAGS $cf_new_cppflags" -+fi -+ -+if test -n "$cf_new_extra_cppflags" ; then -+ -+ EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" -+fi -+ -+ LIBS="$cf_pkgconfig_libs $LIBS" -+ -+ LIBS="$cf_save_xmu" -+ -+test -n "$verbose" && echo " ...before $LIBS" 1>&6 -+ -+echo "${as_me:-configure}:10248: testing ...before $LIBS ..." 1>&5 -+ -+LIBS=`echo "$LIBS" | sed -e "s/[ ][ ]*/ /g" -e "s%$cf_first_lib %$cf_first_lib $cf_pkgconfig_libs %" -e 's% % %g'` -+test -n "$verbose" && echo " ...after $LIBS" 1>&6 -+ -+echo "${as_me:-configure}:10253: testing ...after $LIBS ..." 1>&5 - -- # lieder@skyler.mavd.honeywell.com says without -lsocket, -- # socket/setsockopt and other routines are undefined under SCO ODT -- # 2.0. But -lsocket is broken on IRIX 5.2 (and is not necessary -- # on later versions), says Simon Leinen: it contains gethostby* -- # variants that don't use the nameserver (or something). -lsocket -- # must be given before -lnsl if both are needed. We assume that -- # if connect needs -lnsl, so does gethostbyname. -- echo "$as_me:9988: checking for connect" >&5 --echo $ECHO_N "checking for connect... $ECHO_C" >&6 --if test "${ac_cv_func_connect+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 - else -- cat >conftest.$ac_ext <<_ACEOF --#line 9994 "configure" --#include "confdefs.h" --/* System header to define __stub macros and hopefully few prototypes, -- which can conflict with char connect (); below. */ --#include <assert.h> --/* Override any gcc2 internal prototype to avoid an error. */ --#ifdef __cplusplus --extern "C" --#endif --/* We use char because int might match the return type of a gcc2 -- builtin and then its argument prototype would still apply. */ --char connect (); --char (*f) (); -+ cf_pkgconfig_incs= -+ cf_pkgconfig_libs= -+ -+test -n "$verbose" && echo " ...before $LIBS" 1>&6 -+ -+echo "${as_me:-configure}:10261: testing ...before $LIBS ..." 1>&5 -+ -+LIBS=`echo "$LIBS" | sed -e "s/[ ][ ]*/ /g" -e "s%$cf_first_lib %$cf_first_lib -lXmu %" -e 's% % %g'` -+test -n "$verbose" && echo " ...after $LIBS" 1>&6 -+ -+echo "${as_me:-configure}:10266: testing ...after $LIBS ..." 1>&5 -+ -+fi -+ -+ for cf_trim_lib in Xmu Xt X11 -+ do -+ case "$LIBS" in -+ *-l$cf_trim_lib\ *-l$cf_trim_lib*) -+ LIBS=`echo "$LIBS " | sed -e 's/ / /g' -e 's%-l'"$cf_trim_lib"' %%' -e 's/ $//'` -+ test -n "$verbose" && echo " ..trimmed $LIBS" 1>&6 -+ -+echo "${as_me:-configure}:10277: testing ..trimmed $LIBS ..." 1>&5 -+ -+ ;; -+ esac -+ done -+ -+ ;; -+ esac -+ fi -+ -+ break -+else -+ cf_pkgconfig_incs= -+ cf_pkgconfig_libs= -+ : -+fi -+ -+ done -+fi -+ -+if test -z "$cf_x_athena_lib" ; then -+ -+if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists Xext; then -+ test -n "$verbose" && echo " found package Xext" 1>&6 -+ -+echo "${as_me:-configure}:10302: testing found package Xext ..." 1>&5 -+ -+ cf_pkgconfig_incs="`$PKG_CONFIG --cflags Xext 2>/dev/null`" -+ cf_pkgconfig_libs="`$PKG_CONFIG --libs Xext 2>/dev/null`" -+ test -n "$verbose" && echo " package Xext CFLAGS: $cf_pkgconfig_incs" 1>&6 -+ -+echo "${as_me:-configure}:10308: testing package Xext CFLAGS: $cf_pkgconfig_incs ..." 1>&5 -+ -+ test -n "$verbose" && echo " package Xext LIBS: $cf_pkgconfig_libs" 1>&6 -+ -+echo "${as_me:-configure}:10312: testing package Xext LIBS: $cf_pkgconfig_libs ..." 1>&5 -+ -+cf_fix_cppflags=no -+cf_new_cflags= -+cf_new_cppflags= -+cf_new_extra_cppflags= -+ -+for cf_add_cflags in $cf_pkgconfig_incs -+do -+case $cf_fix_cppflags in -+no) -+ case $cf_add_cflags in #(vi -+ -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi -+ case $cf_add_cflags in -+ -D*) -+ cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` -+ -+ test "${cf_add_cflags}" != "${cf_tst_cflags}" \ -+ && test -z "${cf_tst_cflags}" \ -+ && cf_fix_cppflags=yes -+ -+ if test $cf_fix_cppflags = yes ; then -+ cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -+ continue -+ elif test "${cf_tst_cflags}" = "\"'" ; then -+ cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -+ continue -+ fi -+ ;; -+ esac -+ case "$CPPFLAGS" in -+ *$cf_add_cflags) #(vi -+ ;; -+ *) #(vi -+ case $cf_add_cflags in #(vi -+ -D*) -+ cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` -+ -+CPPFLAGS=`echo "$CPPFLAGS" | \ -+ sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ -+ -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` -+ -+ ;; -+ esac -+ cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" -+ ;; -+ esac -+ ;; -+ *) -+ cf_new_cflags="$cf_new_cflags $cf_add_cflags" -+ ;; -+ esac -+ ;; -+yes) -+ cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -+ -+ cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` - --int --main () --{ --/* The GNU C library defines this for functions which it implements -- to always fail with ENOSYS. Some functions are actually named -- something starting with __ and the normal name is an alias. */ --#if defined (__stub_connect) || defined (__stub___connect) --choke me --#else --f = connect; --#endif -+ test "${cf_add_cflags}" != "${cf_tst_cflags}" \ -+ && test -z "${cf_tst_cflags}" \ -+ && cf_fix_cppflags=no -+ ;; -+esac -+done - -- ; -- return 0; --} --_ACEOF --rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:10025: \"$ac_link\"") >&5 -- (eval $ac_link) 2>&5 -- ac_status=$? -- echo "$as_me:10028: \$? = $ac_status" >&5 -- (exit $ac_status); } && -- { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:10031: \"$ac_try\"") >&5 -- (eval $ac_try) 2>&5 -- ac_status=$? -- echo "$as_me:10034: \$? = $ac_status" >&5 -- (exit $ac_status); }; }; then -- ac_cv_func_connect=yes --else -- echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 --ac_cv_func_connect=no --fi --rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -+if test -n "$cf_new_cflags" ; then -+ -+ CFLAGS="$CFLAGS $cf_new_cflags" - fi --echo "$as_me:10044: result: $ac_cv_func_connect" >&5 --echo "${ECHO_T}$ac_cv_func_connect" >&6 - -- if test $ac_cv_func_connect = no; then -- echo "$as_me:10048: checking for connect in -lsocket" >&5 --echo $ECHO_N "checking for connect in -lsocket... $ECHO_C" >&6 --if test "${ac_cv_lib_socket_connect+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 --else -- ac_check_lib_save_LIBS=$LIBS --LIBS="-lsocket $X_EXTRA_LIBS $LIBS" --cat >conftest.$ac_ext <<_ACEOF --#line 10056 "configure" --#include "confdefs.h" -+if test -n "$cf_new_cppflags" ; then - --/* Override any gcc2 internal prototype to avoid an error. */ --#ifdef __cplusplus --extern "C" --#endif --/* We use char because int might match the return type of a gcc2 -- builtin and then its argument prototype would still apply. */ --char connect (); --int --main () --{ --connect (); -- ; -- return 0; --} --_ACEOF --rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:10075: \"$ac_link\"") >&5 -- (eval $ac_link) 2>&5 -- ac_status=$? -- echo "$as_me:10078: \$? = $ac_status" >&5 -- (exit $ac_status); } && -- { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:10081: \"$ac_try\"") >&5 -- (eval $ac_try) 2>&5 -- ac_status=$? -- echo "$as_me:10084: \$? = $ac_status" >&5 -- (exit $ac_status); }; }; then -- ac_cv_lib_socket_connect=yes --else -- echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 --ac_cv_lib_socket_connect=no --fi --rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext --LIBS=$ac_check_lib_save_LIBS --fi --echo "$as_me:10095: result: $ac_cv_lib_socket_connect" >&5 --echo "${ECHO_T}$ac_cv_lib_socket_connect" >&6 --if test $ac_cv_lib_socket_connect = yes; then -- X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS" -+ CPPFLAGS="$CPPFLAGS $cf_new_cppflags" - fi - -- fi -- -- # Guillermo Gomez says -lposix is necessary on A/UX. -- echo "$as_me:10104: checking for remove" >&5 --echo $ECHO_N "checking for remove... $ECHO_C" >&6 --if test "${ac_cv_func_remove+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 --else -- cat >conftest.$ac_ext <<_ACEOF --#line 10110 "configure" --#include "confdefs.h" --/* System header to define __stub macros and hopefully few prototypes, -- which can conflict with char remove (); below. */ --#include <assert.h> --/* Override any gcc2 internal prototype to avoid an error. */ --#ifdef __cplusplus --extern "C" --#endif --/* We use char because int might match the return type of a gcc2 -- builtin and then its argument prototype would still apply. */ --char remove (); --char (*f) (); -+if test -n "$cf_new_extra_cppflags" ; then - --int --main () --{ --/* The GNU C library defines this for functions which it implements -- to always fail with ENOSYS. Some functions are actually named -- something starting with __ and the normal name is an alias. */ --#if defined (__stub_remove) || defined (__stub___remove) --choke me --#else --f = remove; --#endif -+ EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" -+fi - -- ; -- return 0; --} --_ACEOF --rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:10141: \"$ac_link\"") >&5 -- (eval $ac_link) 2>&5 -- ac_status=$? -- echo "$as_me:10144: \$? = $ac_status" >&5 -- (exit $ac_status); } && -- { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:10147: \"$ac_try\"") >&5 -- (eval $ac_try) 2>&5 -- ac_status=$? -- echo "$as_me:10150: \$? = $ac_status" >&5 -- (exit $ac_status); }; }; then -- ac_cv_func_remove=yes -+ LIBS="$cf_pkgconfig_libs $LIBS" -+ : - else -- echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 --ac_cv_func_remove=no --fi --rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext --fi --echo "$as_me:10160: result: $ac_cv_func_remove" >&5 --echo "${ECHO_T}$ac_cv_func_remove" >&6 -+ cf_pkgconfig_incs= -+ cf_pkgconfig_libs= - -- if test $ac_cv_func_remove = no; then -- echo "$as_me:10164: checking for remove in -lposix" >&5 --echo $ECHO_N "checking for remove in -lposix... $ECHO_C" >&6 --if test "${ac_cv_lib_posix_remove+set}" = set; then -+ echo "$as_me:10398: checking for XextCreateExtension in -lXext" >&5 -+echo $ECHO_N "checking for XextCreateExtension in -lXext... $ECHO_C" >&6 -+if test "${ac_cv_lib_Xext_XextCreateExtension+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - ac_check_lib_save_LIBS=$LIBS --LIBS="-lposix $LIBS" -+LIBS="-lXext $LIBS" - cat >conftest.$ac_ext <<_ACEOF --#line 10172 "configure" -+#line 10406 "configure" - #include "confdefs.h" - - /* Override any gcc2 internal prototype to avoid an error. */ -@@ -10178,310 +10412,386 @@ - #endif - /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ --char remove (); -+char XextCreateExtension (); - int - main () - { --remove (); -+XextCreateExtension (); - ; - return 0; - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:10191: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:10425: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:10194: \$? = $ac_status" >&5 -+ echo "$as_me:10428: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:10197: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:10431: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:10200: \$? = $ac_status" >&5 -+ echo "$as_me:10434: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- ac_cv_lib_posix_remove=yes -+ ac_cv_lib_Xext_XextCreateExtension=yes - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --ac_cv_lib_posix_remove=no -+ac_cv_lib_Xext_XextCreateExtension=no - fi - rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - LIBS=$ac_check_lib_save_LIBS - fi --echo "$as_me:10211: result: $ac_cv_lib_posix_remove" >&5 --echo "${ECHO_T}$ac_cv_lib_posix_remove" >&6 --if test $ac_cv_lib_posix_remove = yes; then -- X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix" -+echo "$as_me:10445: result: $ac_cv_lib_Xext_XextCreateExtension" >&5 -+echo "${ECHO_T}$ac_cv_lib_Xext_XextCreateExtension" >&6 -+if test $ac_cv_lib_Xext_XextCreateExtension = yes; then -+ LIBS="-lXext $LIBS" - fi - -- fi -+fi - -- # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay. -- echo "$as_me:10220: checking for shmat" >&5 --echo $ECHO_N "checking for shmat... $ECHO_C" >&6 --if test "${ac_cv_func_shmat+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 --else -- cat >conftest.$ac_ext <<_ACEOF --#line 10226 "configure" --#include "confdefs.h" --/* System header to define __stub macros and hopefully few prototypes, -- which can conflict with char shmat (); below. */ --#include <assert.h> --/* Override any gcc2 internal prototype to avoid an error. */ --#ifdef __cplusplus --extern "C" --#endif --/* We use char because int might match the return type of a gcc2 -- builtin and then its argument prototype would still apply. */ --char shmat (); --char (*f) (); -+cf_have_X_LIBS=no -+ -+if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists xt; then -+ test -n "$verbose" && echo " found package xt" 1>&6 -+ -+echo "${as_me:-configure}:10458: testing found package xt ..." 1>&5 -+ -+ cf_pkgconfig_incs="`$PKG_CONFIG --cflags xt 2>/dev/null`" -+ cf_pkgconfig_libs="`$PKG_CONFIG --libs xt 2>/dev/null`" -+ test -n "$verbose" && echo " package xt CFLAGS: $cf_pkgconfig_incs" 1>&6 -+ -+echo "${as_me:-configure}:10464: testing package xt CFLAGS: $cf_pkgconfig_incs ..." 1>&5 -+ -+ test -n "$verbose" && echo " package xt LIBS: $cf_pkgconfig_libs" 1>&6 -+ -+echo "${as_me:-configure}:10468: testing package xt LIBS: $cf_pkgconfig_libs ..." 1>&5 -+ -+cf_fix_cppflags=no -+cf_new_cflags= -+cf_new_cppflags= -+cf_new_extra_cppflags= -+ -+for cf_add_cflags in $cf_pkgconfig_incs -+do -+case $cf_fix_cppflags in -+no) -+ case $cf_add_cflags in #(vi -+ -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi -+ case $cf_add_cflags in -+ -D*) -+ cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` -+ -+ test "${cf_add_cflags}" != "${cf_tst_cflags}" \ -+ && test -z "${cf_tst_cflags}" \ -+ && cf_fix_cppflags=yes -+ -+ if test $cf_fix_cppflags = yes ; then -+ cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -+ continue -+ elif test "${cf_tst_cflags}" = "\"'" ; then -+ cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -+ continue -+ fi -+ ;; -+ esac -+ case "$CPPFLAGS" in -+ *$cf_add_cflags) #(vi -+ ;; -+ *) #(vi -+ case $cf_add_cflags in #(vi -+ -D*) -+ cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` -+ -+CPPFLAGS=`echo "$CPPFLAGS" | \ -+ sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ -+ -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` -+ -+ ;; -+ esac -+ cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" -+ ;; -+ esac -+ ;; -+ *) -+ cf_new_cflags="$cf_new_cflags $cf_add_cflags" -+ ;; -+ esac -+ ;; -+yes) -+ cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -+ -+ cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` -+ -+ test "${cf_add_cflags}" != "${cf_tst_cflags}" \ -+ && test -z "${cf_tst_cflags}" \ -+ && cf_fix_cppflags=no -+ ;; -+esac -+done - --int --main () --{ --/* The GNU C library defines this for functions which it implements -- to always fail with ENOSYS. Some functions are actually named -- something starting with __ and the normal name is an alias. */ --#if defined (__stub_shmat) || defined (__stub___shmat) --choke me --#else --f = shmat; --#endif -+if test -n "$cf_new_cflags" ; then - -- ; -- return 0; --} --_ACEOF --rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:10257: \"$ac_link\"") >&5 -- (eval $ac_link) 2>&5 -- ac_status=$? -- echo "$as_me:10260: \$? = $ac_status" >&5 -- (exit $ac_status); } && -- { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:10263: \"$ac_try\"") >&5 -- (eval $ac_try) 2>&5 -- ac_status=$? -- echo "$as_me:10266: \$? = $ac_status" >&5 -- (exit $ac_status); }; }; then -- ac_cv_func_shmat=yes --else -- echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 --ac_cv_func_shmat=no --fi --rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -+ CFLAGS="$CFLAGS $cf_new_cflags" - fi --echo "$as_me:10276: result: $ac_cv_func_shmat" >&5 --echo "${ECHO_T}$ac_cv_func_shmat" >&6 - -- if test $ac_cv_func_shmat = no; then -- echo "$as_me:10280: checking for shmat in -lipc" >&5 --echo $ECHO_N "checking for shmat in -lipc... $ECHO_C" >&6 --if test "${ac_cv_lib_ipc_shmat+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 --else -- ac_check_lib_save_LIBS=$LIBS --LIBS="-lipc $LIBS" --cat >conftest.$ac_ext <<_ACEOF --#line 10288 "configure" --#include "confdefs.h" -+if test -n "$cf_new_cppflags" ; then - --/* Override any gcc2 internal prototype to avoid an error. */ --#ifdef __cplusplus --extern "C" --#endif --/* We use char because int might match the return type of a gcc2 -- builtin and then its argument prototype would still apply. */ --char shmat (); --int --main () --{ --shmat (); -- ; -- return 0; --} --_ACEOF --rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:10307: \"$ac_link\"") >&5 -- (eval $ac_link) 2>&5 -- ac_status=$? -- echo "$as_me:10310: \$? = $ac_status" >&5 -- (exit $ac_status); } && -- { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:10313: \"$ac_try\"") >&5 -- (eval $ac_try) 2>&5 -- ac_status=$? -- echo "$as_me:10316: \$? = $ac_status" >&5 -- (exit $ac_status); }; }; then -- ac_cv_lib_ipc_shmat=yes --else -- echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 --ac_cv_lib_ipc_shmat=no --fi --rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext --LIBS=$ac_check_lib_save_LIBS -+ CPPFLAGS="$CPPFLAGS $cf_new_cppflags" - fi --echo "$as_me:10327: result: $ac_cv_lib_ipc_shmat" >&5 --echo "${ECHO_T}$ac_cv_lib_ipc_shmat" >&6 --if test $ac_cv_lib_ipc_shmat = yes; then -- X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc" -+ -+if test -n "$cf_new_extra_cppflags" ; then -+ -+ EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" - fi - -- fi -- fi -+ LIBS="$cf_pkgconfig_libs $LIBS" - -- # Check for libraries that X11R6 Xt/Xaw programs need. -- ac_save_LDFLAGS=$LDFLAGS -- test -n "$x_libraries" && LDFLAGS="$LDFLAGS -L$x_libraries" -- # SM needs ICE to (dynamically) link under SunOS 4.x (so we have to -- # check for ICE first), but we must link in the order -lSM -lICE or -- # we get undefined symbols. So assume we have SM if we have ICE. -- # These have to be linked with before -lX11, unlike the other -- # libraries we check for below, so use a different variable. -- # John Interrante, Karl Berry -- echo "$as_me:10345: checking for IceConnectionNumber in -lICE" >&5 --echo $ECHO_N "checking for IceConnectionNumber in -lICE... $ECHO_C" >&6 --if test "${ac_cv_lib_ICE_IceConnectionNumber+set}" = set; then -+ case "x$LIBS" in #(vi -+ *-lX11*) #(vi -+ ;; -+ *) -+# we have an "xt" package, but it may omit Xt's dependency on X11 -+echo "$as_me:10555: checking for usable X dependency" >&5 -+echo $ECHO_N "checking for usable X dependency... $ECHO_C" >&6 -+if test "${cf_cv_xt_x11_compat+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else -- ac_check_lib_save_LIBS=$LIBS --LIBS="-lICE $X_EXTRA_LIBS $LIBS" -+ - cat >conftest.$ac_ext <<_ACEOF --#line 10353 "configure" -+#line 10562 "configure" - #include "confdefs.h" - --/* Override any gcc2 internal prototype to avoid an error. */ --#ifdef __cplusplus --extern "C" --#endif --/* We use char because int might match the return type of a gcc2 -- builtin and then its argument prototype would still apply. */ --char IceConnectionNumber (); -+#include <X11/Xlib.h> -+ - int - main () - { --IceConnectionNumber (); -+ -+ int rc1 = XDrawLine((Display*) 0, (Drawable) 0, (GC) 0, 0, 0, 0, 0); -+ int rc2 = XClearWindow((Display*) 0, (Window) 0); -+ int rc3 = XMoveWindow((Display*) 0, (Window) 0, 0, 0); -+ int rc4 = XMoveResizeWindow((Display*)0, (Window)0, 0, 0, 0, 0); -+ - ; - return 0; - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:10372: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:10581: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:10375: \$? = $ac_status" >&5 -+ echo "$as_me:10584: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:10378: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:10587: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:10381: \$? = $ac_status" >&5 -+ echo "$as_me:10590: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- ac_cv_lib_ICE_IceConnectionNumber=yes -+ cf_cv_xt_x11_compat=yes - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --ac_cv_lib_ICE_IceConnectionNumber=no -+cf_cv_xt_x11_compat=no - fi - rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext --LIBS=$ac_check_lib_save_LIBS --fi --echo "$as_me:10392: result: $ac_cv_lib_ICE_IceConnectionNumber" >&5 --echo "${ECHO_T}$ac_cv_lib_ICE_IceConnectionNumber" >&6 --if test $ac_cv_lib_ICE_IceConnectionNumber = yes; then -- X_PRE_LIBS="$X_PRE_LIBS -lSM -lICE" - fi -+echo "$as_me:10600: result: $cf_cv_xt_x11_compat" >&5 -+echo "${ECHO_T}$cf_cv_xt_x11_compat" >&6 -+ if test "$cf_cv_xt_x11_compat" = no -+ then -+ test -n "$verbose" && echo " work around broken X11 dependency" 1>&6 - -- LDFLAGS=$ac_save_LDFLAGS -+echo "${as_me:-configure}:10606: testing work around broken X11 dependency ..." 1>&5 -+ -+ # 2010/11/19 - good enough until a working Xt on Xcb is delivered. -+ -+if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists x11; then -+ test -n "$verbose" && echo " found package x11" 1>&6 -+ -+echo "${as_me:-configure}:10613: testing found package x11 ..." 1>&5 -+ -+ cf_pkgconfig_incs="`$PKG_CONFIG --cflags x11 2>/dev/null`" -+ cf_pkgconfig_libs="`$PKG_CONFIG --libs x11 2>/dev/null`" -+ test -n "$verbose" && echo " package x11 CFLAGS: $cf_pkgconfig_incs" 1>&6 -+ -+echo "${as_me:-configure}:10619: testing package x11 CFLAGS: $cf_pkgconfig_incs ..." 1>&5 -+ -+ test -n "$verbose" && echo " package x11 LIBS: $cf_pkgconfig_libs" 1>&6 -+ -+echo "${as_me:-configure}:10623: testing package x11 LIBS: $cf_pkgconfig_libs ..." 1>&5 -+ -+cf_fix_cppflags=no -+cf_new_cflags= -+cf_new_cppflags= -+cf_new_extra_cppflags= -+ -+for cf_add_cflags in $cf_pkgconfig_incs -+do -+case $cf_fix_cppflags in -+no) -+ case $cf_add_cflags in #(vi -+ -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi -+ case $cf_add_cflags in -+ -D*) -+ cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` -+ -+ test "${cf_add_cflags}" != "${cf_tst_cflags}" \ -+ && test -z "${cf_tst_cflags}" \ -+ && cf_fix_cppflags=yes -+ -+ if test $cf_fix_cppflags = yes ; then -+ cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -+ continue -+ elif test "${cf_tst_cflags}" = "\"'" ; then -+ cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -+ continue -+ fi -+ ;; -+ esac -+ case "$CPPFLAGS" in -+ *$cf_add_cflags) #(vi -+ ;; -+ *) #(vi -+ case $cf_add_cflags in #(vi -+ -D*) -+ cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` -+ -+CPPFLAGS=`echo "$CPPFLAGS" | \ -+ sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ -+ -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` -+ -+ ;; -+ esac -+ cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" -+ ;; -+ esac -+ ;; -+ *) -+ cf_new_cflags="$cf_new_cflags $cf_add_cflags" -+ ;; -+ esac -+ ;; -+yes) -+ cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -+ -+ cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` -+ -+ test "${cf_add_cflags}" != "${cf_tst_cflags}" \ -+ && test -z "${cf_tst_cflags}" \ -+ && cf_fix_cppflags=no -+ ;; -+esac -+done -+ -+if test -n "$cf_new_cflags" ; then - -+ CFLAGS="$CFLAGS $cf_new_cflags" - fi - --cf_x_athena=${cf_x_athena:-Xaw} -+if test -n "$cf_new_cppflags" ; then - --echo "$as_me:10404: checking if you want to link with Xaw 3d library" >&5 --echo $ECHO_N "checking if you want to link with Xaw 3d library... $ECHO_C" >&6 --withval= -+ CPPFLAGS="$CPPFLAGS $cf_new_cppflags" -+fi - --# Check whether --with-Xaw3d or --without-Xaw3d was given. --if test "${with_Xaw3d+set}" = set; then -- withval="$with_Xaw3d" -+if test -n "$cf_new_extra_cppflags" ; then - --fi; --if test "$withval" = yes ; then -- cf_x_athena=Xaw3d -- echo "$as_me:10415: result: yes" >&5 --echo "${ECHO_T}yes" >&6 --else -- echo "$as_me:10418: result: no" >&5 --echo "${ECHO_T}no" >&6 -+ EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" - fi - --echo "$as_me:10422: checking if you want to link with neXT Athena library" >&5 --echo $ECHO_N "checking if you want to link with neXT Athena library... $ECHO_C" >&6 --withval= -+ LIBS="$cf_pkgconfig_libs $LIBS" -+ : -+else -+ cf_pkgconfig_incs= -+ cf_pkgconfig_libs= - --# Check whether --with-neXtaw or --without-neXtaw was given. --if test "${with_neXtaw+set}" = set; then -- withval="$with_neXtaw" -+test -n "$verbose" && echo " ...before $LIBS" 1>&6 - --fi; --if test "$withval" = yes ; then -- cf_x_athena=neXtaw -- echo "$as_me:10433: result: yes" >&5 --echo "${ECHO_T}yes" >&6 -+echo "${as_me:-configure}:10711: testing ...before $LIBS ..." 1>&5 -+ -+LIBS=`echo "$LIBS" | sed -e "s/[ ][ ]*/ /g" -e "s%-lXt %-lXt -lX11 %" -e 's% % %g'` -+test -n "$verbose" && echo " ...after $LIBS" 1>&6 -+ -+echo "${as_me:-configure}:10716: testing ...after $LIBS ..." 1>&5 -+ -+fi -+ -+ fi -+ ;; -+ esac -+ -+echo "$as_me:10724: checking for usable X Toolkit package" >&5 -+echo $ECHO_N "checking for usable X Toolkit package... $ECHO_C" >&6 -+if test "${cf_cv_xt_ice_compat+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 - else -- echo "$as_me:10436: result: no" >&5 --echo "${ECHO_T}no" >&6 --fi - --echo "$as_me:10440: checking if you want to link with Athena-Plus library" >&5 --echo $ECHO_N "checking if you want to link with Athena-Plus library... $ECHO_C" >&6 --withval= -+cat >conftest.$ac_ext <<_ACEOF -+#line 10731 "configure" -+#include "confdefs.h" - --# Check whether --with-XawPlus or --without-XawPlus was given. --if test "${with_XawPlus+set}" = set; then -- withval="$with_XawPlus" -+#include <X11/Shell.h> - --fi; --if test "$withval" = yes ; then -- cf_x_athena=XawPlus -- echo "$as_me:10451: result: yes" >&5 --echo "${ECHO_T}yes" >&6 -+int -+main () -+{ -+int num = IceConnectionNumber(0) -+ -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext conftest$ac_exeext -+if { (eval echo "$as_me:10746: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>&5 -+ ac_status=$? -+ echo "$as_me:10749: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -s conftest$ac_exeext' -+ { (eval echo "$as_me:10752: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:10755: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ cf_cv_xt_ice_compat=yes - else -- echo "$as_me:10454: result: no" >&5 --echo "${ECHO_T}no" >&6 -+ echo "$as_me: failed program was:" >&5 -+cat conftest.$ac_ext >&5 -+cf_cv_xt_ice_compat=no - fi -+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -+fi -+echo "$as_me:10765: result: $cf_cv_xt_ice_compat" >&5 -+echo "${ECHO_T}$cf_cv_xt_ice_compat" >&6 - --cf_x_athena_lib="" -+ if test "$cf_cv_xt_ice_compat" = no -+ then -+ # workaround for broken ".pc" files used for X Toolkit. -+ case "x$X_PRE_LIBS" in #(vi -+ *-lICE*) -+ case "x$LIBS" in #(vi -+ *-lICE*) #(vi -+ ;; -+ *) -+ test -n "$verbose" && echo " work around broken ICE dependency" 1>&6 - --if test "$PKG_CONFIG" != none ; then -- cf_athena_list= -- test "$cf_x_athena" = Xaw && cf_athena_list="xaw8 xaw7 xaw6" -- for cf_athena_pkg in \ -- $cf_athena_list \ -- ${cf_x_athena} \ -- ${cf_x_athena}-devel \ -- lib${cf_x_athena} \ -- lib${cf_x_athena}-devel -- do -+echo "${as_me:-configure}:10779: testing work around broken ICE dependency ..." 1>&5 - --if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists $cf_athena_pkg; then -- test -n "$verbose" && echo " found package $cf_athena_pkg" 1>&6 -+if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists ice; then -+ test -n "$verbose" && echo " found package ice" 1>&6 - --echo "${as_me:-configure}:10474: testing found package $cf_athena_pkg ..." 1>&5 -+echo "${as_me:-configure}:10784: testing found package ice ..." 1>&5 - -- cf_pkgconfig_incs="`$PKG_CONFIG --cflags $cf_athena_pkg 2>/dev/null`" -- cf_pkgconfig_libs="`$PKG_CONFIG --libs $cf_athena_pkg 2>/dev/null`" -- test -n "$verbose" && echo " package $cf_athena_pkg CFLAGS: $cf_pkgconfig_incs" 1>&6 -+ cf_pkgconfig_incs="`$PKG_CONFIG --cflags ice 2>/dev/null`" -+ cf_pkgconfig_libs="`$PKG_CONFIG --libs ice 2>/dev/null`" -+ test -n "$verbose" && echo " package ice CFLAGS: $cf_pkgconfig_incs" 1>&6 - --echo "${as_me:-configure}:10480: testing package $cf_athena_pkg CFLAGS: $cf_pkgconfig_incs ..." 1>&5 -+echo "${as_me:-configure}:10790: testing package ice CFLAGS: $cf_pkgconfig_incs ..." 1>&5 - -- test -n "$verbose" && echo " package $cf_athena_pkg LIBS: $cf_pkgconfig_libs" 1>&6 -+ test -n "$verbose" && echo " package ice LIBS: $cf_pkgconfig_libs" 1>&6 - --echo "${as_me:-configure}:10484: testing package $cf_athena_pkg LIBS: $cf_pkgconfig_libs ..." 1>&5 -+echo "${as_me:-configure}:10794: testing package ice LIBS: $cf_pkgconfig_libs ..." 1>&5 - - cf_fix_cppflags=no - cf_new_cflags= -@@ -10563,84 +10873,20 @@ - - LIBS="$cf_pkgconfig_libs $LIBS" - -- cf_x_athena_lib="$cf_pkgconfig_libs" -- --cf_x_athena_LIBS=`echo "HAVE_LIB_$cf_x_athena" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` -- -- cat >>confdefs.h <<EOF --#define $cf_x_athena_LIBS 1 --EOF -- --echo "$as_me:10574: checking for usable $cf_x_athena/Xmu package" >&5 --echo $ECHO_N "checking for usable $cf_x_athena/Xmu package... $ECHO_C" >&6 --if test "${cf_cv_xaw_compat+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 --else -- --cat >conftest.$ac_ext <<_ACEOF --#line 10581 "configure" --#include "confdefs.h" -- --#include <X11/Xmu/CharSet.h> -- --int --main () --{ -- --int check = XmuCompareISOLatin1("big", "small") -- -- ; -- return 0; --} --_ACEOF --rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:10597: \"$ac_link\"") >&5 -- (eval $ac_link) 2>&5 -- ac_status=$? -- echo "$as_me:10600: \$? = $ac_status" >&5 -- (exit $ac_status); } && -- { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:10603: \"$ac_try\"") >&5 -- (eval $ac_try) 2>&5 -- ac_status=$? -- echo "$as_me:10606: \$? = $ac_status" >&5 -- (exit $ac_status); }; }; then -- cf_cv_xaw_compat=yes --else -- echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 --cf_cv_xaw_compat=no --fi --rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext --fi --echo "$as_me:10616: result: $cf_cv_xaw_compat" >&5 --echo "${ECHO_T}$cf_cv_xaw_compat" >&6 -- -- if test "$cf_cv_xaw_compat" = no -- then -- # workaround for broken ".pc" files... -- case "$cf_x_athena_lib" in #(vi -- *-lXmu*) #(vi -- ;; -- *) -- test -n "$verbose" && echo " work around broken package" 1>&6 -- --echo "${as_me:-configure}:10628: testing work around broken package ..." 1>&5 -- --if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists xmu; then -- test -n "$verbose" && echo " found package xmu" 1>&6 -+if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists sm; then -+ test -n "$verbose" && echo " found package sm" 1>&6 - --echo "${as_me:-configure}:10633: testing found package xmu ..." 1>&5 -+echo "${as_me:-configure}:10879: testing found package sm ..." 1>&5 - -- cf_pkgconfig_incs="`$PKG_CONFIG --cflags xmu 2>/dev/null`" -- cf_pkgconfig_libs="`$PKG_CONFIG --libs xmu 2>/dev/null`" -- test -n "$verbose" && echo " package xmu CFLAGS: $cf_pkgconfig_incs" 1>&6 -+ cf_pkgconfig_incs="`$PKG_CONFIG --cflags sm 2>/dev/null`" -+ cf_pkgconfig_libs="`$PKG_CONFIG --libs sm 2>/dev/null`" -+ test -n "$verbose" && echo " package sm CFLAGS: $cf_pkgconfig_incs" 1>&6 - --echo "${as_me:-configure}:10639: testing package xmu CFLAGS: $cf_pkgconfig_incs ..." 1>&5 -+echo "${as_me:-configure}:10885: testing package sm CFLAGS: $cf_pkgconfig_incs ..." 1>&5 - -- test -n "$verbose" && echo " package xmu LIBS: $cf_pkgconfig_libs" 1>&6 -+ test -n "$verbose" && echo " package sm LIBS: $cf_pkgconfig_libs" 1>&6 - --echo "${as_me:-configure}:10643: testing package xmu LIBS: $cf_pkgconfig_libs ..." 1>&5 -+echo "${as_me:-configure}:10889: testing package sm LIBS: $cf_pkgconfig_libs ..." 1>&5 - - cf_fix_cppflags=no - cf_new_cflags= -@@ -10723,53 +10969,53 @@ - LIBS="$cf_pkgconfig_libs $LIBS" - : - else -+ cf_pkgconfig_incs= -+ cf_pkgconfig_libs= -+ : -+fi -+ -+else -+ cf_pkgconfig_incs= -+ cf_pkgconfig_libs= - - test -n "$verbose" && echo " ...before $LIBS" 1>&6 - --echo "${as_me:-configure}:10729: testing ...before $LIBS ..." 1>&5 -+echo "${as_me:-configure}:10983: testing ...before $LIBS ..." 1>&5 - --LIBS=`echo "$LIBS" | sed -e "s/[ ][ ]*/ /g" -e "s,-lXt ,-lXt -lXmu ," -e 's/ / /g'` -+LIBS=`echo "$LIBS" | sed -e "s/[ ][ ]*/ /g" -e "s%-lXt %-lXt $X_PRE_LIBS %" -e 's% % %g'` - test -n "$verbose" && echo " ...after $LIBS" 1>&6 - --echo "${as_me:-configure}:10734: testing ...after $LIBS ..." 1>&5 -- --fi -- -- ;; -- esac -- fi -- -- break --else -- : --fi -+echo "${as_me:-configure}:10988: testing ...after $LIBS ..." 1>&5 - -- done - fi - --if test -z "$cf_x_athena_lib" ; then -+ ;; -+ esac -+ ;; -+ esac -+ fi - --if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists Xext; then -- test -n "$verbose" && echo " found package Xext" 1>&6 -+ cf_have_X_LIBS=yes - --echo "${as_me:-configure}:10755: testing found package Xext ..." 1>&5 -+else -+ cf_pkgconfig_incs= -+ cf_pkgconfig_libs= - -- cf_pkgconfig_incs="`$PKG_CONFIG --cflags Xext 2>/dev/null`" -- cf_pkgconfig_libs="`$PKG_CONFIG --libs Xext 2>/dev/null`" -- test -n "$verbose" && echo " package Xext CFLAGS: $cf_pkgconfig_incs" 1>&6 -+ LDFLAGS="$X_LIBS $LDFLAGS" - --echo "${as_me:-configure}:10761: testing package Xext CFLAGS: $cf_pkgconfig_incs ..." 1>&5 -+test -n "$verbose" && echo " checking additions to CFLAGS" 1>&6 - -- test -n "$verbose" && echo " package Xext LIBS: $cf_pkgconfig_libs" 1>&6 -+echo "${as_me:-configure}:11008: testing checking additions to CFLAGS ..." 1>&5 - --echo "${as_me:-configure}:10765: testing package Xext LIBS: $cf_pkgconfig_libs ..." 1>&5 -+cf_check_cflags="$CFLAGS" -+cf_check_cppflags="$CPPFLAGS" - - cf_fix_cppflags=no - cf_new_cflags= - cf_new_cppflags= - cf_new_extra_cppflags= - --for cf_add_cflags in $cf_pkgconfig_incs -+for cf_add_cflags in $X_CFLAGS - do - case $cf_fix_cppflags in - no) -@@ -10828,33 +11074,144 @@ - done - - if test -n "$cf_new_cflags" ; then -+ test -n "$verbose" && echo " add to \$CFLAGS $cf_new_cflags" 1>&6 -+ -+echo "${as_me:-configure}:11079: testing add to \$CFLAGS $cf_new_cflags ..." 1>&5 - - CFLAGS="$CFLAGS $cf_new_cflags" - fi - - if test -n "$cf_new_cppflags" ; then -+ test -n "$verbose" && echo " add to \$CPPFLAGS $cf_new_cppflags" 1>&6 -+ -+echo "${as_me:-configure}:11087: testing add to \$CPPFLAGS $cf_new_cppflags ..." 1>&5 -+ -+ CPPFLAGS="$CPPFLAGS $cf_new_cppflags" -+fi -+ -+if test -n "$cf_new_extra_cppflags" ; then -+ test -n "$verbose" && echo " add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags" 1>&6 -+ -+echo "${as_me:-configure}:11095: testing add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags ..." 1>&5 -+ -+ EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" -+fi -+ -+if test "$cf_check_cflags" != "$CFLAGS" ; then -+cat >conftest.$ac_ext <<_ACEOF -+#line 11102 "configure" -+#include "confdefs.h" -+#include <stdio.h> -+int -+main () -+{ -+printf("Hello world"); -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext conftest$ac_exeext -+if { (eval echo "$as_me:11114: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>&5 -+ ac_status=$? -+ echo "$as_me:11117: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -s conftest$ac_exeext' -+ { (eval echo "$as_me:11120: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:11123: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ : -+else -+ echo "$as_me: failed program was:" >&5 -+cat conftest.$ac_ext >&5 -+test -n "$verbose" && echo " test-compile failed. Undoing change to \$CFLAGS" 1>&6 -+ -+echo "${as_me:-configure}:11131: testing test-compile failed. Undoing change to \$CFLAGS ..." 1>&5 -+ -+ if test "$cf_check_cppflags" != "$CPPFLAGS" ; then -+ test -n "$verbose" && echo " but keeping change to \$CPPFLAGS" 1>&6 -+ -+echo "${as_me:-configure}:11136: testing but keeping change to \$CPPFLAGS ..." 1>&5 -+ -+ fi -+ CFLAGS="$cf_check_flags" -+fi -+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -+fi -+ -+ echo "$as_me:11144: checking for XOpenDisplay" >&5 -+echo $ECHO_N "checking for XOpenDisplay... $ECHO_C" >&6 -+if test "${ac_cv_func_XOpenDisplay+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ cat >conftest.$ac_ext <<_ACEOF -+#line 11150 "configure" -+#include "confdefs.h" -+/* System header to define __stub macros and hopefully few prototypes, -+ which can conflict with char XOpenDisplay (); below. */ -+#include <assert.h> -+/* Override any gcc2 internal prototype to avoid an error. */ -+#ifdef __cplusplus -+extern "C" -+#endif -+/* We use char because int might match the return type of a gcc2 -+ builtin and then its argument prototype would still apply. */ -+char XOpenDisplay (); -+char (*f) (); -+ -+int -+main () -+{ -+/* The GNU C library defines this for functions which it implements -+ to always fail with ENOSYS. Some functions are actually named -+ something starting with __ and the normal name is an alias. */ -+#if defined (__stub_XOpenDisplay) || defined (__stub___XOpenDisplay) -+choke me -+#else -+f = XOpenDisplay; /* workaround for ICC 12.0.3 */ if (f == 0) return 1; -+#endif - -- CPPFLAGS="$CPPFLAGS $cf_new_cppflags" -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext conftest$ac_exeext -+if { (eval echo "$as_me:11181: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>&5 -+ ac_status=$? -+ echo "$as_me:11184: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -s conftest$ac_exeext' -+ { (eval echo "$as_me:11187: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:11190: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ ac_cv_func_XOpenDisplay=yes -+else -+ echo "$as_me: failed program was:" >&5 -+cat conftest.$ac_ext >&5 -+ac_cv_func_XOpenDisplay=no - fi -- --if test -n "$cf_new_extra_cppflags" ; then -- -- EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" -+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - fi -- -- LIBS="$cf_pkgconfig_libs $LIBS" -- : -+echo "$as_me:11200: result: $ac_cv_func_XOpenDisplay" >&5 -+echo "${ECHO_T}$ac_cv_func_XOpenDisplay" >&6 -+if test $ac_cv_func_XOpenDisplay = yes; then -+ : - else - -- echo "$as_me:10849: checking for XextCreateExtension in -lXext" >&5 --echo $ECHO_N "checking for XextCreateExtension in -lXext... $ECHO_C" >&6 --if test "${ac_cv_lib_Xext_XextCreateExtension+set}" = set; then -+ echo "$as_me:11206: checking for XOpenDisplay in -lX11" >&5 -+echo $ECHO_N "checking for XOpenDisplay in -lX11... $ECHO_C" >&6 -+if test "${ac_cv_lib_X11_XOpenDisplay+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - ac_check_lib_save_LIBS=$LIBS --LIBS="-lXext $LIBS" -+LIBS="-lX11 $X_PRE_LIBS $LIBS $X_EXTRA_LIBS $LIBS" - cat >conftest.$ac_ext <<_ACEOF --#line 10857 "configure" -+#line 11214 "configure" - #include "confdefs.h" - - /* Override any gcc2 internal prototype to avoid an error. */ -@@ -10863,486 +11220,447 @@ - #endif - /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ --char XextCreateExtension (); -+char XOpenDisplay (); - int - main () - { --XextCreateExtension (); -+XOpenDisplay (); - ; - return 0; - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:10876: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:11233: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:10879: \$? = $ac_status" >&5 -+ echo "$as_me:11236: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:10882: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:11239: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:10885: \$? = $ac_status" >&5 -+ echo "$as_me:11242: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- ac_cv_lib_Xext_XextCreateExtension=yes -+ ac_cv_lib_X11_XOpenDisplay=yes - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --ac_cv_lib_Xext_XextCreateExtension=no -+ac_cv_lib_X11_XOpenDisplay=no - fi - rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - LIBS=$ac_check_lib_save_LIBS - fi --echo "$as_me:10896: result: $ac_cv_lib_Xext_XextCreateExtension" >&5 --echo "${ECHO_T}$ac_cv_lib_Xext_XextCreateExtension" >&6 --if test $ac_cv_lib_Xext_XextCreateExtension = yes; then -- LIBS="-lXext $LIBS" -+echo "$as_me:11253: result: $ac_cv_lib_X11_XOpenDisplay" >&5 -+echo "${ECHO_T}$ac_cv_lib_X11_XOpenDisplay" >&6 -+if test $ac_cv_lib_X11_XOpenDisplay = yes; then -+ LIBS="-lX11 $LIBS" - fi - - fi - --cf_have_X_LIBS=no -- --if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists xt; then -- test -n "$verbose" && echo " found package xt" 1>&6 -- --echo "${as_me:-configure}:10909: testing found package xt ..." 1>&5 -- -- cf_pkgconfig_incs="`$PKG_CONFIG --cflags xt 2>/dev/null`" -- cf_pkgconfig_libs="`$PKG_CONFIG --libs xt 2>/dev/null`" -- test -n "$verbose" && echo " package xt CFLAGS: $cf_pkgconfig_incs" 1>&6 -- --echo "${as_me:-configure}:10915: testing package xt CFLAGS: $cf_pkgconfig_incs ..." 1>&5 -- -- test -n "$verbose" && echo " package xt LIBS: $cf_pkgconfig_libs" 1>&6 -- --echo "${as_me:-configure}:10919: testing package xt LIBS: $cf_pkgconfig_libs ..." 1>&5 -- --cf_fix_cppflags=no --cf_new_cflags= --cf_new_cppflags= --cf_new_extra_cppflags= -- --for cf_add_cflags in $cf_pkgconfig_incs --do --case $cf_fix_cppflags in --no) -- case $cf_add_cflags in #(vi -- -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi -- case $cf_add_cflags in -- -D*) -- cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` -- -- test "${cf_add_cflags}" != "${cf_tst_cflags}" \ -- && test -z "${cf_tst_cflags}" \ -- && cf_fix_cppflags=yes -- -- if test $cf_fix_cppflags = yes ; then -- cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -- continue -- elif test "${cf_tst_cflags}" = "\"'" ; then -- cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -- continue -- fi -- ;; -- esac -- case "$CPPFLAGS" in -- *$cf_add_cflags) #(vi -- ;; -- *) #(vi -- case $cf_add_cflags in #(vi -- -D*) -- cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` -- --CPPFLAGS=`echo "$CPPFLAGS" | \ -- sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ -- -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` -- -- ;; -- esac -- cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" -- ;; -- esac -- ;; -- *) -- cf_new_cflags="$cf_new_cflags $cf_add_cflags" -- ;; -- esac -- ;; --yes) -- cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -+ echo "$as_me:11261: checking for XtAppInitialize" >&5 -+echo $ECHO_N "checking for XtAppInitialize... $ECHO_C" >&6 -+if test "${ac_cv_func_XtAppInitialize+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ cat >conftest.$ac_ext <<_ACEOF -+#line 11267 "configure" -+#include "confdefs.h" -+/* System header to define __stub macros and hopefully few prototypes, -+ which can conflict with char XtAppInitialize (); below. */ -+#include <assert.h> -+/* Override any gcc2 internal prototype to avoid an error. */ -+#ifdef __cplusplus -+extern "C" -+#endif -+/* We use char because int might match the return type of a gcc2 -+ builtin and then its argument prototype would still apply. */ -+char XtAppInitialize (); -+char (*f) (); - -- cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` -+int -+main () -+{ -+/* The GNU C library defines this for functions which it implements -+ to always fail with ENOSYS. Some functions are actually named -+ something starting with __ and the normal name is an alias. */ -+#if defined (__stub_XtAppInitialize) || defined (__stub___XtAppInitialize) -+choke me -+#else -+f = XtAppInitialize; /* workaround for ICC 12.0.3 */ if (f == 0) return 1; -+#endif - -- test "${cf_add_cflags}" != "${cf_tst_cflags}" \ -- && test -z "${cf_tst_cflags}" \ -- && cf_fix_cppflags=no -- ;; --esac --done -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext conftest$ac_exeext -+if { (eval echo "$as_me:11298: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>&5 -+ ac_status=$? -+ echo "$as_me:11301: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -s conftest$ac_exeext' -+ { (eval echo "$as_me:11304: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:11307: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ ac_cv_func_XtAppInitialize=yes -+else -+ echo "$as_me: failed program was:" >&5 -+cat conftest.$ac_ext >&5 -+ac_cv_func_XtAppInitialize=no -+fi -+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -+fi -+echo "$as_me:11317: result: $ac_cv_func_XtAppInitialize" >&5 -+echo "${ECHO_T}$ac_cv_func_XtAppInitialize" >&6 -+if test $ac_cv_func_XtAppInitialize = yes; then -+ : -+else - --if test -n "$cf_new_cflags" ; then -+ echo "$as_me:11323: checking for XtAppInitialize in -lXt" >&5 -+echo $ECHO_N "checking for XtAppInitialize in -lXt... $ECHO_C" >&6 -+if test "${ac_cv_lib_Xt_XtAppInitialize+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ ac_check_lib_save_LIBS=$LIBS -+LIBS="-lXt $X_PRE_LIBS $LIBS $X_EXTRA_LIBS $LIBS" -+cat >conftest.$ac_ext <<_ACEOF -+#line 11331 "configure" -+#include "confdefs.h" - -- CFLAGS="$CFLAGS $cf_new_cflags" -+/* Override any gcc2 internal prototype to avoid an error. */ -+#ifdef __cplusplus -+extern "C" -+#endif -+/* We use char because int might match the return type of a gcc2 -+ builtin and then its argument prototype would still apply. */ -+char XtAppInitialize (); -+int -+main () -+{ -+XtAppInitialize (); -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext conftest$ac_exeext -+if { (eval echo "$as_me:11350: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>&5 -+ ac_status=$? -+ echo "$as_me:11353: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -s conftest$ac_exeext' -+ { (eval echo "$as_me:11356: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:11359: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ ac_cv_lib_Xt_XtAppInitialize=yes -+else -+ echo "$as_me: failed program was:" >&5 -+cat conftest.$ac_ext >&5 -+ac_cv_lib_Xt_XtAppInitialize=no - fi -+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -+LIBS=$ac_check_lib_save_LIBS -+fi -+echo "$as_me:11370: result: $ac_cv_lib_Xt_XtAppInitialize" >&5 -+echo "${ECHO_T}$ac_cv_lib_Xt_XtAppInitialize" >&6 -+if test $ac_cv_lib_Xt_XtAppInitialize = yes; then - --if test -n "$cf_new_cppflags" ; then -+cat >>confdefs.h <<\EOF -+#define HAVE_LIBXT 1 -+EOF - -- CPPFLAGS="$CPPFLAGS $cf_new_cppflags" -+ cf_have_X_LIBS=Xt -+ LIBS="-lXt $X_PRE_LIBS $LIBS $X_EXTRA_LIBS" - fi - --if test -n "$cf_new_extra_cppflags" ; then -+fi - -- EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" - fi - -- LIBS="$cf_pkgconfig_libs $LIBS" -+if test $cf_have_X_LIBS = no ; then -+ { echo "$as_me:11387: WARNING: Unable to successfully link X Toolkit library (-lXt) with -+test program. You will have to check and add the proper libraries by hand -+to makefile." >&5 -+echo "$as_me: WARNING: Unable to successfully link X Toolkit library (-lXt) with -+test program. You will have to check and add the proper libraries by hand -+to makefile." >&2;} -+fi - -- case "x$LIBS" in #(vi -- *-lX11*) #(vi -- ;; -- *) --# we have an "xt" package, but it may omit Xt's dependency on X11 --echo "$as_me:11006: checking for usable X dependency" >&5 --echo $ECHO_N "checking for usable X dependency... $ECHO_C" >&6 --if test "${cf_cv_xt_x11_compat+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 --else -+cf_x_athena_root=$cf_x_athena -+cf_x_athena_inc="" - --cat >conftest.$ac_ext <<_ACEOF --#line 11013 "configure" -+for cf_path in default \ -+ /usr/contrib/X11R6 \ -+ /usr/contrib/X11R5 \ -+ /usr/lib/X11R5 \ -+ /usr/local -+do -+ if test -z "$cf_x_athena_inc" ; then -+ cf_save="$CPPFLAGS" -+ cf_test=X11/$cf_x_athena_root/SimpleMenu.h -+ if test $cf_path != default ; then -+ CPPFLAGS="$cf_save -I$cf_path/include" -+ echo "$as_me:11409: checking for $cf_test in $cf_path" >&5 -+echo $ECHO_N "checking for $cf_test in $cf_path... $ECHO_C" >&6 -+ else -+ echo "$as_me:11412: checking for $cf_test" >&5 -+echo $ECHO_N "checking for $cf_test... $ECHO_C" >&6 -+ fi -+ cat >conftest.$ac_ext <<_ACEOF -+#line 11416 "configure" - #include "confdefs.h" - --#include <X11/Xlib.h> -- -+#include <X11/Intrinsic.h> -+#include <$cf_test> - int - main () - { - -- int rc1 = XDrawLine((Display*) 0, (Drawable) 0, (GC) 0, 0, 0, 0, 0); -- int rc2 = XClearWindow((Display*) 0, (Window) 0); -- int rc3 = XMoveWindow((Display*) 0, (Window) 0, 0, 0); -- int rc4 = XMoveResizeWindow((Display*)0, (Window)0, 0, 0, 0, 0); -- - ; - return 0; - } - _ACEOF --rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:11032: \"$ac_link\"") >&5 -- (eval $ac_link) 2>&5 -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:11430: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:11035: \$? = $ac_status" >&5 -+ echo "$as_me:11433: \$? = $ac_status" >&5 - (exit $ac_status); } && -- { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:11038: \"$ac_try\"") >&5 -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:11436: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:11041: \$? = $ac_status" >&5 -+ echo "$as_me:11439: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- cf_cv_xt_x11_compat=yes -+ cf_result=yes - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --cf_cv_xt_x11_compat=no --fi --rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -+cf_result=no - fi --echo "$as_me:11051: result: $cf_cv_xt_x11_compat" >&5 --echo "${ECHO_T}$cf_cv_xt_x11_compat" >&6 -- if test "$cf_cv_xt_x11_compat" = no -- then -- test -n "$verbose" && echo " work around broken X11 dependency" 1>&6 -- --echo "${as_me:-configure}:11057: testing work around broken X11 dependency ..." 1>&5 -- -- # 2010/11/19 - good enough until a working Xt on Xcb is delivered. -- --if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists x11; then -- test -n "$verbose" && echo " found package x11" 1>&6 -- --echo "${as_me:-configure}:11064: testing found package x11 ..." 1>&5 -- -- cf_pkgconfig_incs="`$PKG_CONFIG --cflags x11 2>/dev/null`" -- cf_pkgconfig_libs="`$PKG_CONFIG --libs x11 2>/dev/null`" -- test -n "$verbose" && echo " package x11 CFLAGS: $cf_pkgconfig_incs" 1>&6 -- --echo "${as_me:-configure}:11070: testing package x11 CFLAGS: $cf_pkgconfig_incs ..." 1>&5 -- -- test -n "$verbose" && echo " package x11 LIBS: $cf_pkgconfig_libs" 1>&6 -- --echo "${as_me:-configure}:11074: testing package x11 LIBS: $cf_pkgconfig_libs ..." 1>&5 -- --cf_fix_cppflags=no --cf_new_cflags= --cf_new_cppflags= --cf_new_extra_cppflags= -- --for cf_add_cflags in $cf_pkgconfig_incs --do --case $cf_fix_cppflags in --no) -- case $cf_add_cflags in #(vi -- -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi -- case $cf_add_cflags in -- -D*) -- cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` -- -- test "${cf_add_cflags}" != "${cf_tst_cflags}" \ -- && test -z "${cf_tst_cflags}" \ -- && cf_fix_cppflags=yes -- -- if test $cf_fix_cppflags = yes ; then -- cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -- continue -- elif test "${cf_tst_cflags}" = "\"'" ; then -- cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -- continue -- fi -- ;; -- esac -- case "$CPPFLAGS" in -- *$cf_add_cflags) #(vi -- ;; -- *) #(vi -- case $cf_add_cflags in #(vi -- -D*) -- cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` -- --CPPFLAGS=`echo "$CPPFLAGS" | \ -- sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ -- -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` -- -- ;; -- esac -- cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" -- ;; -- esac -- ;; -- *) -- cf_new_cflags="$cf_new_cflags $cf_add_cflags" -- ;; -- esac -- ;; --yes) -- cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -- -- cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` -- -- test "${cf_add_cflags}" != "${cf_tst_cflags}" \ -- && test -z "${cf_tst_cflags}" \ -- && cf_fix_cppflags=no -- ;; --esac -+rm -f conftest.$ac_objext conftest.$ac_ext -+ echo "$as_me:11448: result: $cf_result" >&5 -+echo "${ECHO_T}$cf_result" >&6 -+ if test "$cf_result" = yes ; then -+ cf_x_athena_inc=$cf_path -+ break -+ else -+ CPPFLAGS="$cf_save" -+ fi -+ fi - done - --if test -n "$cf_new_cflags" ; then -- -- CFLAGS="$CFLAGS $cf_new_cflags" --fi -- --if test -n "$cf_new_cppflags" ; then -- -- CPPFLAGS="$CPPFLAGS $cf_new_cppflags" --fi -- --if test -n "$cf_new_extra_cppflags" ; then -- -- EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" --fi -- -- LIBS="$cf_pkgconfig_libs $LIBS" -- : --else -- --test -n "$verbose" && echo " ...before $LIBS" 1>&6 -- --echo "${as_me:-configure}:11160: testing ...before $LIBS ..." 1>&5 -- --LIBS=`echo "$LIBS" | sed -e "s/[ ][ ]*/ /g" -e "s,-lXt ,-lXt -lX11 ," -e 's/ / /g'` --test -n "$verbose" && echo " ...after $LIBS" 1>&6 -- --echo "${as_me:-configure}:11165: testing ...after $LIBS ..." 1>&5 -- -+if test -z "$cf_x_athena_inc" ; then -+ { echo "$as_me:11460: WARNING: Unable to successfully find Athena header files with test program" >&5 -+echo "$as_me: WARNING: Unable to successfully find Athena header files with test program" >&2;} -+elif test "$cf_x_athena_inc" != default ; then -+ CPPFLAGS="$CPPFLAGS -I$cf_x_athena_inc" - fi - -- fi -- ;; -- esac -- --echo "$as_me:11173: checking for usable X Toolkit package" >&5 --echo $ECHO_N "checking for usable X Toolkit package... $ECHO_C" >&6 --if test "${cf_cv_xt_ice_compat+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 --else -+cf_x_athena_root=$cf_x_athena -+cf_x_athena_lib="" - --cat >conftest.$ac_ext <<_ACEOF --#line 11180 "configure" -+for cf_path in default \ -+ /usr/contrib/X11R6 \ -+ /usr/contrib/X11R5 \ -+ /usr/lib/X11R5 \ -+ /usr/local -+do -+ for cf_lib in \ -+ ${cf_x_athena_root} \ -+ ${cf_x_athena_root}7 \ -+ ${cf_x_athena_root}6 -+ do -+ for cf_libs in \ -+ "-l$cf_lib -lXmu" \ -+ "-l$cf_lib -lXpm -lXmu" \ -+ "-l${cf_lib}_s -lXmu_s" -+ do -+ if test -z "$cf_x_athena_lib" ; then -+ cf_save="$LIBS" -+ cf_test=XawSimpleMenuAddGlobalActions -+ if test $cf_path != default ; then -+ LIBS="-L$cf_path/lib $cf_libs $LIBS" -+ echo "$as_me:11490: checking for $cf_libs in $cf_path" >&5 -+echo $ECHO_N "checking for $cf_libs in $cf_path... $ECHO_C" >&6 -+ else -+ LIBS="$cf_libs $LIBS" -+ echo "$as_me:11494: checking for $cf_test in $cf_libs" >&5 -+echo $ECHO_N "checking for $cf_test in $cf_libs... $ECHO_C" >&6 -+ fi -+ cat >conftest.$ac_ext <<_ACEOF -+#line 11498 "configure" - #include "confdefs.h" - --#include <X11/Shell.h> -+#include <X11/Intrinsic.h> -+#include <X11/$cf_x_athena_root/SimpleMenu.h> - - int - main () - { --int num = IceConnectionNumber(0) - -+$cf_test((XtAppContext) 0) - ; - return 0; - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:11195: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:11514: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:11198: \$? = $ac_status" >&5 -+ echo "$as_me:11517: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:11201: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:11520: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:11204: \$? = $ac_status" >&5 -+ echo "$as_me:11523: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- cf_cv_xt_ice_compat=yes -+ cf_result=yes - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --cf_cv_xt_ice_compat=no -+cf_result=no - fi - rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext --fi --echo "$as_me:11214: result: $cf_cv_xt_ice_compat" >&5 --echo "${ECHO_T}$cf_cv_xt_ice_compat" >&6 -- -- if test "$cf_cv_xt_ice_compat" = no -- then -- # workaround for broken ".pc" files used for X Toolkit. -- case "x$X_PRE_LIBS" in #(vi -- *-lICE*) -- case "x$LIBS" in #(vi -- *-lICE*) #(vi -- ;; -- *) -- test -n "$verbose" && echo " work around broken ICE dependency" 1>&6 -- --echo "${as_me:-configure}:11228: testing work around broken ICE dependency ..." 1>&5 -- --if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists ice; then -- test -n "$verbose" && echo " found package ice" 1>&6 -- --echo "${as_me:-configure}:11233: testing found package ice ..." 1>&5 -- -- cf_pkgconfig_incs="`$PKG_CONFIG --cflags ice 2>/dev/null`" -- cf_pkgconfig_libs="`$PKG_CONFIG --libs ice 2>/dev/null`" -- test -n "$verbose" && echo " package ice CFLAGS: $cf_pkgconfig_incs" 1>&6 -- --echo "${as_me:-configure}:11239: testing package ice CFLAGS: $cf_pkgconfig_incs ..." 1>&5 -- -- test -n "$verbose" && echo " package ice LIBS: $cf_pkgconfig_libs" 1>&6 -- --echo "${as_me:-configure}:11243: testing package ice LIBS: $cf_pkgconfig_libs ..." 1>&5 -- --cf_fix_cppflags=no --cf_new_cflags= --cf_new_cppflags= --cf_new_extra_cppflags= -- --for cf_add_cflags in $cf_pkgconfig_incs --do --case $cf_fix_cppflags in --no) -- case $cf_add_cflags in #(vi -- -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi -- case $cf_add_cflags in -- -D*) -- cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` -- -- test "${cf_add_cflags}" != "${cf_tst_cflags}" \ -- && test -z "${cf_tst_cflags}" \ -- && cf_fix_cppflags=yes -- -- if test $cf_fix_cppflags = yes ; then -- cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -- continue -- elif test "${cf_tst_cflags}" = "\"'" ; then -- cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -- continue -+ echo "$as_me:11532: result: $cf_result" >&5 -+echo "${ECHO_T}$cf_result" >&6 -+ if test "$cf_result" = yes ; then -+ cf_x_athena_lib="$cf_libs" -+ break - fi -- ;; -- esac -- case "$CPPFLAGS" in -- *$cf_add_cflags) #(vi -- ;; -- *) #(vi -- case $cf_add_cflags in #(vi -- -D*) -- cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` -+ LIBS="$cf_save" -+ fi -+ done # cf_libs -+ test -n "$cf_x_athena_lib" && break -+ done # cf_lib -+done -+ -+if test -z "$cf_x_athena_lib" ; then -+ { { echo "$as_me:11546: error: Unable to successfully link Athena library (-l$cf_x_athena_root) with test program" >&5 -+echo "$as_me: error: Unable to successfully link Athena library (-l$cf_x_athena_root) with test program" >&2;} -+ { (exit 1); exit 1; }; } -+fi - --CPPFLAGS=`echo "$CPPFLAGS" | \ -- sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ -- -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` -+cf_x_athena_LIBS=`echo "HAVE_LIB_$cf_x_athena" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` - -- ;; -- esac -- cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" -- ;; -- esac -- ;; -- *) -- cf_new_cflags="$cf_new_cflags $cf_add_cflags" -- ;; -- esac -- ;; --yes) -- cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -+cat >>confdefs.h <<EOF -+#define $cf_x_athena_LIBS 1 -+EOF - -- cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` -+fi - -- test "${cf_add_cflags}" != "${cf_tst_cflags}" \ -- && test -z "${cf_tst_cflags}" \ -- && cf_fix_cppflags=no -- ;; --esac -+if test -n "$ac_tool_prefix"; then -+ for ac_prog in xcurses-config -+ do -+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -+set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -+echo "$as_me:11564: checking for $ac_word" >&5 -+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -+if test "${ac_cv_prog_XCURSES_CONFIG+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ if test -n "$XCURSES_CONFIG"; then -+ ac_cv_prog_XCURSES_CONFIG="$XCURSES_CONFIG" # Let the user override the test. -+else -+ ac_save_IFS=$IFS; IFS=$ac_path_separator -+ac_dummy="$PATH" -+for ac_dir in $ac_dummy; do -+ IFS=$ac_save_IFS -+ test -z "$ac_dir" && ac_dir=. -+ $as_executable_p "$ac_dir/$ac_word" || continue -+ac_cv_prog_XCURSES_CONFIG="$ac_tool_prefix$ac_prog" -+echo "$as_me:11579: found $ac_dir/$ac_word" >&5 -+break - done - --if test -n "$cf_new_cflags" ; then -- -- CFLAGS="$CFLAGS $cf_new_cflags" -+fi -+fi -+XCURSES_CONFIG=$ac_cv_prog_XCURSES_CONFIG -+if test -n "$XCURSES_CONFIG"; then -+ echo "$as_me:11587: result: $XCURSES_CONFIG" >&5 -+echo "${ECHO_T}$XCURSES_CONFIG" >&6 -+else -+ echo "$as_me:11590: result: no" >&5 -+echo "${ECHO_T}no" >&6 - fi - --if test -n "$cf_new_cppflags" ; then -+ test -n "$XCURSES_CONFIG" && break -+ done -+fi -+if test -z "$XCURSES_CONFIG"; then -+ ac_ct_XCURSES_CONFIG=$XCURSES_CONFIG -+ for ac_prog in xcurses-config -+do -+ # Extract the first word of "$ac_prog", so it can be a program name with args. -+set dummy $ac_prog; ac_word=$2 -+echo "$as_me:11603: checking for $ac_word" >&5 -+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -+if test "${ac_cv_prog_ac_ct_XCURSES_CONFIG+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ if test -n "$ac_ct_XCURSES_CONFIG"; then -+ ac_cv_prog_ac_ct_XCURSES_CONFIG="$ac_ct_XCURSES_CONFIG" # Let the user override the test. -+else -+ ac_save_IFS=$IFS; IFS=$ac_path_separator -+ac_dummy="$PATH" -+for ac_dir in $ac_dummy; do -+ IFS=$ac_save_IFS -+ test -z "$ac_dir" && ac_dir=. -+ $as_executable_p "$ac_dir/$ac_word" || continue -+ac_cv_prog_ac_ct_XCURSES_CONFIG="$ac_prog" -+echo "$as_me:11618: found $ac_dir/$ac_word" >&5 -+break -+done - -- CPPFLAGS="$CPPFLAGS $cf_new_cppflags" -+fi -+fi -+ac_ct_XCURSES_CONFIG=$ac_cv_prog_ac_ct_XCURSES_CONFIG -+if test -n "$ac_ct_XCURSES_CONFIG"; then -+ echo "$as_me:11626: result: $ac_ct_XCURSES_CONFIG" >&5 -+echo "${ECHO_T}$ac_ct_XCURSES_CONFIG" >&6 -+else -+ echo "$as_me:11629: result: no" >&5 -+echo "${ECHO_T}no" >&6 - fi - --if test -n "$cf_new_extra_cppflags" ; then -+ test -n "$ac_ct_XCURSES_CONFIG" && break -+done -+test -n "$ac_ct_XCURSES_CONFIG" || ac_ct_XCURSES_CONFIG="none" - -- EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" -+ XCURSES_CONFIG=$ac_ct_XCURSES_CONFIG - fi - -- LIBS="$cf_pkgconfig_libs $LIBS" -+if test "$XCURSES_CONFIG" != none ; then - --if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists sm; then -- test -n "$verbose" && echo " found package sm" 1>&6 -+CPPFLAGS="$CPPFLAGS `$XCURSES_CONFIG --cflags`" -+LIBS="`$XCURSES_CONFIG --libs` $LIBS" - --echo "${as_me:-configure}:11328: testing found package sm ..." 1>&5 -+cf_cv_lib_XCurses=yes - -- cf_pkgconfig_incs="`$PKG_CONFIG --cflags sm 2>/dev/null`" -- cf_pkgconfig_libs="`$PKG_CONFIG --libs sm 2>/dev/null`" -- test -n "$verbose" && echo " package sm CFLAGS: $cf_pkgconfig_incs" 1>&6 -+else -+ -+LDFLAGS="$LDFLAGS $X_LIBS" - --echo "${as_me:-configure}:11334: testing package sm CFLAGS: $cf_pkgconfig_incs ..." 1>&5 -+test -n "$verbose" && echo " checking additions to CFLAGS" 1>&6 - -- test -n "$verbose" && echo " package sm LIBS: $cf_pkgconfig_libs" 1>&6 -+echo "${as_me:-configure}:11653: testing checking additions to CFLAGS ..." 1>&5 - --echo "${as_me:-configure}:11338: testing package sm LIBS: $cf_pkgconfig_libs ..." 1>&5 -+cf_check_cflags="$CFLAGS" -+cf_check_cppflags="$CPPFLAGS" - - cf_fix_cppflags=no - cf_new_cflags= - cf_new_cppflags= - cf_new_extra_cppflags= - --for cf_add_cflags in $cf_pkgconfig_incs -+for cf_add_cflags in $X_CFLAGS - do - case $cf_fix_cppflags in - no) -@@ -11401,260 +11719,375 @@ - done - - if test -n "$cf_new_cflags" ; then -+ test -n "$verbose" && echo " add to \$CFLAGS $cf_new_cflags" 1>&6 -+ -+echo "${as_me:-configure}:11724: testing add to \$CFLAGS $cf_new_cflags ..." 1>&5 - - CFLAGS="$CFLAGS $cf_new_cflags" - fi - - if test -n "$cf_new_cppflags" ; then -+ test -n "$verbose" && echo " add to \$CPPFLAGS $cf_new_cppflags" 1>&6 -+ -+echo "${as_me:-configure}:11732: testing add to \$CPPFLAGS $cf_new_cppflags ..." 1>&5 - - CPPFLAGS="$CPPFLAGS $cf_new_cppflags" - fi - - if test -n "$cf_new_extra_cppflags" ; then -+ test -n "$verbose" && echo " add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags" 1>&6 - -- EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" --fi -+echo "${as_me:-configure}:11740: testing add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags ..." 1>&5 - -- LIBS="$cf_pkgconfig_libs $LIBS" -- : --else -- : -+ EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" - fi - -+if test "$cf_check_cflags" != "$CFLAGS" ; then -+cat >conftest.$ac_ext <<_ACEOF -+#line 11747 "configure" -+#include "confdefs.h" -+#include <stdio.h> -+int -+main () -+{ -+printf("Hello world"); -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext conftest$ac_exeext -+if { (eval echo "$as_me:11759: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>&5 -+ ac_status=$? -+ echo "$as_me:11762: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -s conftest$ac_exeext' -+ { (eval echo "$as_me:11765: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:11768: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ : - else -+ echo "$as_me: failed program was:" >&5 -+cat conftest.$ac_ext >&5 -+test -n "$verbose" && echo " test-compile failed. Undoing change to \$CFLAGS" 1>&6 - --test -n "$verbose" && echo " ...before $LIBS" 1>&6 -- --echo "${as_me:-configure}:11428: testing ...before $LIBS ..." 1>&5 -+echo "${as_me:-configure}:11776: testing test-compile failed. Undoing change to \$CFLAGS ..." 1>&5 - --LIBS=`echo "$LIBS" | sed -e "s/[ ][ ]*/ /g" -e "s,-lXt ,-lXt $X_PRE_LIBS ," -e 's/ / /g'` --test -n "$verbose" && echo " ...after $LIBS" 1>&6 -+ if test "$cf_check_cppflags" != "$CPPFLAGS" ; then -+ test -n "$verbose" && echo " but keeping change to \$CPPFLAGS" 1>&6 - --echo "${as_me:-configure}:11433: testing ...after $LIBS ..." 1>&5 -+echo "${as_me:-configure}:11781: testing but keeping change to \$CPPFLAGS ..." 1>&5 - -+ fi -+ CFLAGS="$cf_check_flags" -+fi -+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - fi - -- ;; -- esac -- ;; -- esac -- fi -- -- cf_have_X_LIBS=yes -- -+echo "$as_me:11789: checking for XOpenDisplay in -lX11" >&5 -+echo $ECHO_N "checking for XOpenDisplay in -lX11... $ECHO_C" >&6 -+if test "${ac_cv_lib_X11_XOpenDisplay+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 - else -+ ac_check_lib_save_LIBS=$LIBS -+LIBS="-lX11 $X_PRE_LIBS $LIBS $X_EXTRA_LIBS $LIBS" -+cat >conftest.$ac_ext <<_ACEOF -+#line 11797 "configure" -+#include "confdefs.h" - -- LDFLAGS="$X_LIBS $LDFLAGS" -- --test -n "$verbose" && echo " checking additions to CFLAGS" 1>&6 -- --echo "${as_me:-configure}:11451: testing checking additions to CFLAGS ..." 1>&5 -- --cf_check_cflags="$CFLAGS" --cf_check_cppflags="$CPPFLAGS" -- --cf_fix_cppflags=no --cf_new_cflags= --cf_new_cppflags= --cf_new_extra_cppflags= -+/* Override any gcc2 internal prototype to avoid an error. */ -+#ifdef __cplusplus -+extern "C" -+#endif -+/* We use char because int might match the return type of a gcc2 -+ builtin and then its argument prototype would still apply. */ -+char XOpenDisplay (); -+int -+main () -+{ -+XOpenDisplay (); -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext conftest$ac_exeext -+if { (eval echo "$as_me:11816: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>&5 -+ ac_status=$? -+ echo "$as_me:11819: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -s conftest$ac_exeext' -+ { (eval echo "$as_me:11822: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:11825: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ ac_cv_lib_X11_XOpenDisplay=yes -+else -+ echo "$as_me: failed program was:" >&5 -+cat conftest.$ac_ext >&5 -+ac_cv_lib_X11_XOpenDisplay=no -+fi -+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -+LIBS=$ac_check_lib_save_LIBS -+fi -+echo "$as_me:11836: result: $ac_cv_lib_X11_XOpenDisplay" >&5 -+echo "${ECHO_T}$ac_cv_lib_X11_XOpenDisplay" >&6 -+if test $ac_cv_lib_X11_XOpenDisplay = yes; then -+ LIBS="-lX11 $LIBS" -+fi - --for cf_add_cflags in $X_CFLAGS --do --case $cf_fix_cppflags in --no) -- case $cf_add_cflags in #(vi -- -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi -- case $cf_add_cflags in -- -D*) -- cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` -+echo "$as_me:11842: checking for XCurses library" >&5 -+echo $ECHO_N "checking for XCurses library... $ECHO_C" >&6 -+if test "${cf_cv_lib_XCurses+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else - -- test "${cf_add_cflags}" != "${cf_tst_cflags}" \ -- && test -z "${cf_tst_cflags}" \ -- && cf_fix_cppflags=yes -+LIBS="-lXCurses $LIBS" -+cat >conftest.$ac_ext <<_ACEOF -+#line 11850 "configure" -+#include "confdefs.h" - -- if test $cf_fix_cppflags = yes ; then -- cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -- continue -- elif test "${cf_tst_cflags}" = "\"'" ; then -- cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -- continue -- fi -- ;; -- esac -- case "$CPPFLAGS" in -- *$cf_add_cflags) #(vi -- ;; -- *) #(vi -- case $cf_add_cflags in #(vi -- -D*) -- cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` -+#include <xcurses.h> -+char *XCursesProgramName = "test"; - --CPPFLAGS=`echo "$CPPFLAGS" | \ -- sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ -- -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` -+int -+main () -+{ -+XCursesExit(); -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext conftest$ac_exeext -+if { (eval echo "$as_me:11865: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>&5 -+ ac_status=$? -+ echo "$as_me:11868: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -s conftest$ac_exeext' -+ { (eval echo "$as_me:11871: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:11874: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ cf_cv_lib_XCurses=yes -+else -+ echo "$as_me: failed program was:" >&5 -+cat conftest.$ac_ext >&5 -+cf_cv_lib_XCurses=no -+fi -+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - -- ;; -- esac -- cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" -- ;; -- esac -- ;; -- *) -- cf_new_cflags="$cf_new_cflags $cf_add_cflags" -- ;; -- esac -- ;; --yes) -- cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -+fi -+echo "$as_me:11885: result: $cf_cv_lib_XCurses" >&5 -+echo "${ECHO_T}$cf_cv_lib_XCurses" >&6 - -- cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` -+fi - -- test "${cf_add_cflags}" != "${cf_tst_cflags}" \ -- && test -z "${cf_tst_cflags}" \ -- && cf_fix_cppflags=no -- ;; --esac --done -+if test $cf_cv_lib_XCurses = yes ; then - --if test -n "$cf_new_cflags" ; then -- test -n "$verbose" && echo " add to \$CFLAGS $cf_new_cflags" 1>&6 -+cat >>confdefs.h <<\EOF -+#define UNIX 1 -+EOF - --echo "${as_me:-configure}:11522: testing add to \$CFLAGS $cf_new_cflags ..." 1>&5 -+cat >>confdefs.h <<\EOF -+#define XCURSES 1 -+EOF - -- CFLAGS="$CFLAGS $cf_new_cflags" -+ echo "$as_me:11900: checking for xcurses.h" >&5 -+echo $ECHO_N "checking for xcurses.h... $ECHO_C" >&6 -+if test "${ac_cv_header_xcurses_h+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ cat >conftest.$ac_ext <<_ACEOF -+#line 11906 "configure" -+#include "confdefs.h" -+#include <xcurses.h> -+_ACEOF -+if { (eval echo "$as_me:11910: \"$ac_cpp conftest.$ac_ext\"") >&5 -+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 -+ ac_status=$? -+ egrep -v '^ *\+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 -+ echo "$as_me:11916: \$? = $ac_status" >&5 -+ (exit $ac_status); } >/dev/null; then -+ if test -s conftest.err; then -+ ac_cpp_err=$ac_c_preproc_warn_flag -+ else -+ ac_cpp_err= -+ fi -+else -+ ac_cpp_err=yes -+fi -+if test -z "$ac_cpp_err"; then -+ ac_cv_header_xcurses_h=yes -+else -+ echo "$as_me: failed program was:" >&5 -+ cat conftest.$ac_ext >&5 -+ ac_cv_header_xcurses_h=no -+fi -+rm -f conftest.err conftest.$ac_ext - fi -+echo "$as_me:11935: result: $ac_cv_header_xcurses_h" >&5 -+echo "${ECHO_T}$ac_cv_header_xcurses_h" >&6 -+if test $ac_cv_header_xcurses_h = yes; then - --if test -n "$cf_new_cppflags" ; then -- test -n "$verbose" && echo " add to \$CPPFLAGS $cf_new_cppflags" 1>&6 -+cat >>confdefs.h <<\EOF -+#define HAVE_XCURSES 1 -+EOF - --echo "${as_me:-configure}:11530: testing add to \$CPPFLAGS $cf_new_cppflags ..." 1>&5 -+fi - -- CPPFLAGS="$CPPFLAGS $cf_new_cppflags" -+else -+ { { echo "$as_me:11946: error: Cannot link with XCurses" >&5 -+echo "$as_me: error: Cannot link with XCurses" >&2;} -+ { (exit 1); exit 1; }; } - fi - --if test -n "$cf_new_extra_cppflags" ; then -- test -n "$verbose" && echo " add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags" 1>&6 -+ ;; -+esac - --echo "${as_me:-configure}:11538: testing add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags ..." 1>&5 -+case $cf_cv_screen in -+curses|curses_*) - -- EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" --fi -+echo "$as_me:11957: checking for NetBSD form.h" >&5 -+echo $ECHO_N "checking for NetBSD form.h... $ECHO_C" >&6 -+if test "${cf_cv_netbsd_form_h+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else - --if test "$cf_check_cflags" != "$CFLAGS" ; then - cat >conftest.$ac_ext <<_ACEOF --#line 11545 "configure" -+#line 11964 "configure" - #include "confdefs.h" --#include <stdio.h> -+ -+#include <${cf_cv_ncurses_header:-curses.h}> -+#include <form.h> -+ - int - main () - { --printf("Hello world"); -+ -+ FORM *form; -+ int y = current_field(form)->cursor_ypos; -+ int x = current_field(form)->cursor_xpos; -+ - ; - return 0; - } - _ACEOF --rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:11557: \"$ac_link\"") >&5 -- (eval $ac_link) 2>&5 -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:11983: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:11560: \$? = $ac_status" >&5 -+ echo "$as_me:11986: \$? = $ac_status" >&5 - (exit $ac_status); } && -- { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:11563: \"$ac_try\"") >&5 -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:11989: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:11566: \$? = $ac_status" >&5 -+ echo "$as_me:11992: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- : -+ cf_cv_netbsd_form_h=yes -+ - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --test -n "$verbose" && echo " test-compile failed. Undoing change to \$CFLAGS" 1>&6 -- --echo "${as_me:-configure}:11574: testing test-compile failed. Undoing change to \$CFLAGS ..." 1>&5 -- -- if test "$cf_check_cppflags" != "$CPPFLAGS" ; then -- test -n "$verbose" && echo " but keeping change to \$CPPFLAGS" 1>&6 -- --echo "${as_me:-configure}:11579: testing but keeping change to \$CPPFLAGS ..." 1>&5 -- -- fi -- CFLAGS="$cf_check_flags" -+cf_cv_netbsd_form_h=no - fi --rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -+rm -f conftest.$ac_objext conftest.$ac_ext -+ - fi -+echo "$as_me:12004: result: $cf_cv_netbsd_form_h" >&5 -+echo "${ECHO_T}$cf_cv_netbsd_form_h" >&6 - -- echo "$as_me:11587: checking for XOpenDisplay" >&5 --echo $ECHO_N "checking for XOpenDisplay... $ECHO_C" >&6 --if test "${ac_cv_func_XOpenDisplay+set}" = set; then -+test "$cf_cv_netbsd_form_h" = yes && -+cat >>confdefs.h <<\EOF -+#define HAVE_NETBSD_FORM_H 1 -+EOF -+ -+echo "$as_me:12012: checking for NetBSD menu.h" >&5 -+echo $ECHO_N "checking for NetBSD menu.h... $ECHO_C" >&6 -+if test "${cf_cv_netbsd_menu_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else -- cat >conftest.$ac_ext <<_ACEOF --#line 11593 "configure" -+ -+cat >conftest.$ac_ext <<_ACEOF -+#line 12019 "configure" - #include "confdefs.h" --/* System header to define __stub macros and hopefully few prototypes, -- which can conflict with char XOpenDisplay (); below. */ --#include <assert.h> --/* Override any gcc2 internal prototype to avoid an error. */ --#ifdef __cplusplus --extern "C" --#endif --/* We use char because int might match the return type of a gcc2 -- builtin and then its argument prototype would still apply. */ --char XOpenDisplay (); --char (*f) (); -+ -+#include <${cf_cv_ncurses_header:-curses.h}> -+#include <menu.h> - - int - main () - { --/* The GNU C library defines this for functions which it implements -- to always fail with ENOSYS. Some functions are actually named -- something starting with __ and the normal name is an alias. */ --#if defined (__stub_XOpenDisplay) || defined (__stub___XOpenDisplay) --choke me --#else --f = XOpenDisplay; --#endif -+ -+ MENU *menu; -+ int y = menu->max_item_width; - - ; - return 0; - } - _ACEOF --rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:11624: \"$ac_link\"") >&5 -- (eval $ac_link) 2>&5 -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:12037: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:11627: \$? = $ac_status" >&5 -+ echo "$as_me:12040: \$? = $ac_status" >&5 - (exit $ac_status); } && -- { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:11630: \"$ac_try\"") >&5 -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:12043: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:11633: \$? = $ac_status" >&5 -+ echo "$as_me:12046: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- ac_cv_func_XOpenDisplay=yes -+ cf_cv_netbsd_menu_h=yes -+ - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --ac_cv_func_XOpenDisplay=no -+cf_cv_netbsd_menu_h=no - fi --rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -+rm -f conftest.$ac_objext conftest.$ac_ext -+ - fi --echo "$as_me:11643: result: $ac_cv_func_XOpenDisplay" >&5 --echo "${ECHO_T}$ac_cv_func_XOpenDisplay" >&6 --if test $ac_cv_func_XOpenDisplay = yes; then -- : --else -+echo "$as_me:12058: result: $cf_cv_netbsd_menu_h" >&5 -+echo "${ECHO_T}$cf_cv_netbsd_menu_h" >&6 - -- echo "$as_me:11649: checking for XOpenDisplay in -lX11" >&5 --echo $ECHO_N "checking for XOpenDisplay in -lX11... $ECHO_C" >&6 --if test "${ac_cv_lib_X11_XOpenDisplay+set}" = set; then -+test "$cf_cv_netbsd_menu_h" = yes && -+cat >>confdefs.h <<\EOF -+#define HAVE_NETBSD_MENU_H 1 -+EOF -+ -+ ;; -+ncursesw) -+ cf_cv_libtype=w -+ ;; -+esac -+ -+case $cf_cv_screen in #(vi -+pdcurses) #(vi -+ ;; -+*) -+ # look for curses-related libraries -+ : ${cf_panel_lib:=panel} -+ : ${cf_menu_lib:=menu} -+ : ${cf_form_lib:=form} -+ -+as_ac_Lib=`echo "ac_cv_lib_$cf_panel_lib$cf_cv_libtype''_new_panel" | $as_tr_sh` -+echo "$as_me:12082: checking for new_panel in -l$cf_panel_lib$cf_cv_libtype" >&5 -+echo $ECHO_N "checking for new_panel in -l$cf_panel_lib$cf_cv_libtype... $ECHO_C" >&6 -+if eval "test \"\${$as_ac_Lib+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - ac_check_lib_save_LIBS=$LIBS --LIBS="-lX11 $X_PRE_LIBS $LIBS $X_EXTRA_LIBS $LIBS" -+LIBS="-l$cf_panel_lib$cf_cv_libtype $LIBS" - cat >conftest.$ac_ext <<_ACEOF --#line 11657 "configure" -+#line 12090 "configure" - #include "confdefs.h" - - /* Override any gcc2 internal prototype to avoid an error. */ -@@ -11663,115 +12096,116 @@ - #endif - /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ --char XOpenDisplay (); -+char new_panel (); - int - main () - { --XOpenDisplay (); -+new_panel (); - ; - return 0; - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:11676: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:12109: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:11679: \$? = $ac_status" >&5 -+ echo "$as_me:12112: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:11682: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:12115: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:11685: \$? = $ac_status" >&5 -+ echo "$as_me:12118: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- ac_cv_lib_X11_XOpenDisplay=yes -+ eval "$as_ac_Lib=yes" - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --ac_cv_lib_X11_XOpenDisplay=no -+eval "$as_ac_Lib=no" - fi - rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - LIBS=$ac_check_lib_save_LIBS - fi --echo "$as_me:11696: result: $ac_cv_lib_X11_XOpenDisplay" >&5 --echo "${ECHO_T}$ac_cv_lib_X11_XOpenDisplay" >&6 --if test $ac_cv_lib_X11_XOpenDisplay = yes; then -- LIBS="-lX11 $LIBS" --fi -+echo "$as_me:12129: result: `eval echo '${'$as_ac_Lib'}'`" >&5 -+echo "${ECHO_T}`eval echo '${'$as_ac_Lib'}'`" >&6 -+if test `eval echo '${'$as_ac_Lib'}'` = yes; then -+ cat >>confdefs.h <<EOF -+#define `echo "HAVE_LIB$cf_panel_lib$cf_cv_libtype" | $as_tr_cpp` 1 -+EOF -+ -+ LIBS="-l$cf_panel_lib$cf_cv_libtype $LIBS" - - fi - -- echo "$as_me:11704: checking for XtAppInitialize" >&5 --echo $ECHO_N "checking for XtAppInitialize... $ECHO_C" >&6 --if test "${ac_cv_func_XtAppInitialize+set}" = set; then -+as_ac_Lib=`echo "ac_cv_lib_$cf_menu_lib$cf_cv_libtype''_menu_driver" | $as_tr_sh` -+echo "$as_me:12141: checking for menu_driver in -l$cf_menu_lib$cf_cv_libtype" >&5 -+echo $ECHO_N "checking for menu_driver in -l$cf_menu_lib$cf_cv_libtype... $ECHO_C" >&6 -+if eval "test \"\${$as_ac_Lib+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else -- cat >conftest.$ac_ext <<_ACEOF --#line 11710 "configure" -+ ac_check_lib_save_LIBS=$LIBS -+LIBS="-l$cf_menu_lib$cf_cv_libtype $LIBS" -+cat >conftest.$ac_ext <<_ACEOF -+#line 12149 "configure" - #include "confdefs.h" --/* System header to define __stub macros and hopefully few prototypes, -- which can conflict with char XtAppInitialize (); below. */ --#include <assert.h> -+ - /* Override any gcc2 internal prototype to avoid an error. */ - #ifdef __cplusplus - extern "C" - #endif - /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ --char XtAppInitialize (); --char (*f) (); -- -+char menu_driver (); - int - main () - { --/* The GNU C library defines this for functions which it implements -- to always fail with ENOSYS. Some functions are actually named -- something starting with __ and the normal name is an alias. */ --#if defined (__stub_XtAppInitialize) || defined (__stub___XtAppInitialize) --choke me --#else --f = XtAppInitialize; --#endif -- -+menu_driver (); - ; - return 0; - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:11741: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:12168: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:11744: \$? = $ac_status" >&5 -+ echo "$as_me:12171: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:11747: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:12174: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:11750: \$? = $ac_status" >&5 -+ echo "$as_me:12177: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- ac_cv_func_XtAppInitialize=yes -+ eval "$as_ac_Lib=yes" - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --ac_cv_func_XtAppInitialize=no -+eval "$as_ac_Lib=no" - fi - rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -+LIBS=$ac_check_lib_save_LIBS -+fi -+echo "$as_me:12188: result: `eval echo '${'$as_ac_Lib'}'`" >&5 -+echo "${ECHO_T}`eval echo '${'$as_ac_Lib'}'`" >&6 -+if test `eval echo '${'$as_ac_Lib'}'` = yes; then -+ cat >>confdefs.h <<EOF -+#define `echo "HAVE_LIB$cf_menu_lib$cf_cv_libtype" | $as_tr_cpp` 1 -+EOF -+ -+ LIBS="-l$cf_menu_lib$cf_cv_libtype $LIBS" -+ - fi --echo "$as_me:11760: result: $ac_cv_func_XtAppInitialize" >&5 --echo "${ECHO_T}$ac_cv_func_XtAppInitialize" >&6 --if test $ac_cv_func_XtAppInitialize = yes; then -- : --else - -- echo "$as_me:11766: checking for XtAppInitialize in -lXt" >&5 --echo $ECHO_N "checking for XtAppInitialize in -lXt... $ECHO_C" >&6 --if test "${ac_cv_lib_Xt_XtAppInitialize+set}" = set; then -+as_ac_Lib=`echo "ac_cv_lib_$cf_form_lib$cf_cv_libtype''_form_driver" | $as_tr_sh` -+echo "$as_me:12200: checking for form_driver in -l$cf_form_lib$cf_cv_libtype" >&5 -+echo $ECHO_N "checking for form_driver in -l$cf_form_lib$cf_cv_libtype... $ECHO_C" >&6 -+if eval "test \"\${$as_ac_Lib+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - ac_check_lib_save_LIBS=$LIBS --LIBS="-lXt $X_PRE_LIBS $LIBS $X_EXTRA_LIBS $LIBS" -+LIBS="-l$cf_form_lib$cf_cv_libtype $LIBS" - cat >conftest.$ac_ext <<_ACEOF --#line 11774 "configure" -+#line 12208 "configure" - #include "confdefs.h" - - /* Override any gcc2 internal prototype to avoid an error. */ -@@ -11780,2296 +12214,2187 @@ - #endif - /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ --char XtAppInitialize (); -+char form_driver (); - int - main () - { --XtAppInitialize (); -+form_driver (); - ; - return 0; - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:11793: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:12227: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:11796: \$? = $ac_status" >&5 -+ echo "$as_me:12230: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:11799: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:12233: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:11802: \$? = $ac_status" >&5 -+ echo "$as_me:12236: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- ac_cv_lib_Xt_XtAppInitialize=yes -+ eval "$as_ac_Lib=yes" - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --ac_cv_lib_Xt_XtAppInitialize=no -+eval "$as_ac_Lib=no" - fi - rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - LIBS=$ac_check_lib_save_LIBS - fi --echo "$as_me:11813: result: $ac_cv_lib_Xt_XtAppInitialize" >&5 --echo "${ECHO_T}$ac_cv_lib_Xt_XtAppInitialize" >&6 --if test $ac_cv_lib_Xt_XtAppInitialize = yes; then -- cat >>confdefs.h <<\EOF --#define HAVE_LIBXT 1 -+echo "$as_me:12247: result: `eval echo '${'$as_ac_Lib'}'`" >&5 -+echo "${ECHO_T}`eval echo '${'$as_ac_Lib'}'`" >&6 -+if test `eval echo '${'$as_ac_Lib'}'` = yes; then -+ cat >>confdefs.h <<EOF -+#define `echo "HAVE_LIB$cf_form_lib$cf_cv_libtype" | $as_tr_cpp` 1 - EOF - -- cf_have_X_LIBS=Xt -- LIBS="-lXt $X_PRE_LIBS $LIBS $X_EXTRA_LIBS" -+ LIBS="-l$cf_form_lib$cf_cv_libtype $LIBS" -+ - fi - -+ # look for curses-related headers -+ -+for ac_header in \ -+ nc_alloc.h \ -+ nomacros.h \ -+ form.h \ -+ menu.h \ -+ panel.h \ -+ term_entry.h \ -+ -+do -+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -+echo "$as_me:12270: checking for $ac_header" >&5 -+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -+if eval "test \"\${$as_ac_Header+set}\" = set"; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ cat >conftest.$ac_ext <<_ACEOF -+#line 12276 "configure" -+#include "confdefs.h" -+#include <$ac_header> -+_ACEOF -+if { (eval echo "$as_me:12280: \"$ac_cpp conftest.$ac_ext\"") >&5 -+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 -+ ac_status=$? -+ egrep -v '^ *\+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 -+ echo "$as_me:12286: \$? = $ac_status" >&5 -+ (exit $ac_status); } >/dev/null; then -+ if test -s conftest.err; then -+ ac_cpp_err=$ac_c_preproc_warn_flag -+ else -+ ac_cpp_err= -+ fi -+else -+ ac_cpp_err=yes -+fi -+if test -z "$ac_cpp_err"; then -+ eval "$as_ac_Header=yes" -+else -+ echo "$as_me: failed program was:" >&5 -+ cat conftest.$ac_ext >&5 -+ eval "$as_ac_Header=no" -+fi -+rm -f conftest.err conftest.$ac_ext - fi -+echo "$as_me:12305: result: `eval echo '${'$as_ac_Header'}'`" >&5 -+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -+if test `eval echo '${'$as_ac_Header'}'` = yes; then -+ cat >>confdefs.h <<EOF -+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -+EOF - - fi -+done - --if test $cf_have_X_LIBS = no ; then -- { echo "$as_me:11829: WARNING: Unable to successfully link X Toolkit library (-lXt) with --test program. You will have to check and add the proper libraries by hand --to makefile." >&5 --echo "$as_me: WARNING: Unable to successfully link X Toolkit library (-lXt) with --test program. You will have to check and add the proper libraries by hand --to makefile." >&2;} -+ ;; -+esac -+ -+echo "$as_me:12318: checking for ANSI C header files" >&5 -+echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 -+if test "${ac_cv_header_stdc+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ cat >conftest.$ac_ext <<_ACEOF -+#line 12324 "configure" -+#include "confdefs.h" -+#include <stdlib.h> -+#include <stdarg.h> -+#include <string.h> -+#include <float.h> -+ -+_ACEOF -+if { (eval echo "$as_me:12332: \"$ac_cpp conftest.$ac_ext\"") >&5 -+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 -+ ac_status=$? -+ egrep -v '^ *\+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 -+ echo "$as_me:12338: \$? = $ac_status" >&5 -+ (exit $ac_status); } >/dev/null; then -+ if test -s conftest.err; then -+ ac_cpp_err=$ac_c_preproc_warn_flag -+ else -+ ac_cpp_err= -+ fi -+else -+ ac_cpp_err=yes -+fi -+if test -z "$ac_cpp_err"; then -+ ac_cv_header_stdc=yes -+else -+ echo "$as_me: failed program was:" >&5 -+ cat conftest.$ac_ext >&5 -+ ac_cv_header_stdc=no - fi -+rm -f conftest.err conftest.$ac_ext - --cf_x_athena_root=$cf_x_athena --cf_x_athena_inc="" -+if test $ac_cv_header_stdc = yes; then -+ # SunOS 4.x string.h does not declare mem*, contrary to ANSI. -+ cat >conftest.$ac_ext <<_ACEOF -+#line 12360 "configure" -+#include "confdefs.h" -+#include <string.h> - --for cf_path in default \ -- /usr/contrib/X11R6 \ -- /usr/contrib/X11R5 \ -- /usr/lib/X11R5 \ -- /usr/local --do -- if test -z "$cf_x_athena_inc" ; then -- cf_save="$CPPFLAGS" -- cf_test=X11/$cf_x_athena_root/SimpleMenu.h -- if test $cf_path != default ; then -- CPPFLAGS="$cf_save -I$cf_path/include" -- echo "$as_me:11851: checking for $cf_test in $cf_path" >&5 --echo $ECHO_N "checking for $cf_test in $cf_path... $ECHO_C" >&6 -- else -- echo "$as_me:11854: checking for $cf_test" >&5 --echo $ECHO_N "checking for $cf_test... $ECHO_C" >&6 -- fi -- cat >conftest.$ac_ext <<_ACEOF --#line 11858 "configure" -+_ACEOF -+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | -+ egrep "memchr" >/dev/null 2>&1; then -+ : -+else -+ ac_cv_header_stdc=no -+fi -+rm -rf conftest* -+ -+fi -+ -+if test $ac_cv_header_stdc = yes; then -+ # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. -+ cat >conftest.$ac_ext <<_ACEOF -+#line 12378 "configure" - #include "confdefs.h" -+#include <stdlib.h> - --#include <X11/Intrinsic.h> --#include <$cf_test> -+_ACEOF -+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | -+ egrep "free" >/dev/null 2>&1; then -+ : -+else -+ ac_cv_header_stdc=no -+fi -+rm -rf conftest* -+ -+fi -+ -+if test $ac_cv_header_stdc = yes; then -+ # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. -+ if test "$cross_compiling" = yes; then -+ : -+else -+ cat >conftest.$ac_ext <<_ACEOF -+#line 12399 "configure" -+#include "confdefs.h" -+#include <ctype.h> -+#if ((' ' & 0x0FF) == 0x020) -+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -+#else -+# define ISLOWER(c) (('a' <= (c) && (c) <= 'i') \ -+ || ('j' <= (c) && (c) <= 'r') \ -+ || ('s' <= (c) && (c) <= 'z')) -+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) -+#endif -+ -+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) - int - main () - { -- -- ; -- return 0; -+ int i; -+ for (i = 0; i < 256; i++) -+ if (XOR (islower (i), ISLOWER (i)) -+ || toupper (i) != TOUPPER (i)) -+ $ac_main_return(2); -+ $ac_main_return (0); - } - _ACEOF --rm -f conftest.$ac_objext --if { (eval echo "$as_me:11872: \"$ac_compile\"") >&5 -- (eval $ac_compile) 2>&5 -+rm -f conftest$ac_exeext -+if { (eval echo "$as_me:12425: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:11875: \$? = $ac_status" >&5 -- (exit $ac_status); } && -- { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:11878: \"$ac_try\"") >&5 -+ echo "$as_me:12428: \$? = $ac_status" >&5 -+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext' -+ { (eval echo "$as_me:12430: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:11881: \$? = $ac_status" >&5 -+ echo "$as_me:12433: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- cf_result=yes -+ : - else -- echo "$as_me: failed program was:" >&5 -+ echo "$as_me: program exited with status $ac_status" >&5 -+echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --cf_result=no -+ac_cv_header_stdc=no - fi --rm -f conftest.$ac_objext conftest.$ac_ext -- echo "$as_me:11890: result: $cf_result" >&5 --echo "${ECHO_T}$cf_result" >&6 -- if test "$cf_result" = yes ; then -- cf_x_athena_inc=$cf_path -- break -- else -- CPPFLAGS="$cf_save" -- fi -- fi --done -- --if test -z "$cf_x_athena_inc" ; then -- { echo "$as_me:11902: WARNING: Unable to successfully find Athena header files with test program" >&5 --echo "$as_me: WARNING: Unable to successfully find Athena header files with test program" >&2;} --elif test "$cf_x_athena_inc" != default ; then -- CPPFLAGS="$CPPFLAGS -I$cf_x_athena_inc" -+rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext - fi -+fi -+fi -+echo "$as_me:12446: result: $ac_cv_header_stdc" >&5 -+echo "${ECHO_T}$ac_cv_header_stdc" >&6 -+if test $ac_cv_header_stdc = yes; then - --cf_x_athena_root=$cf_x_athena --cf_x_athena_lib="" -+cat >>confdefs.h <<\EOF -+#define STDC_HEADERS 1 -+EOF - --for cf_path in default \ -- /usr/contrib/X11R6 \ -- /usr/contrib/X11R5 \ -- /usr/lib/X11R5 \ -- /usr/local --do -- for cf_lib in \ -- "-l$cf_x_athena_root -lXmu" \ -- "-l$cf_x_athena_root -lXpm -lXmu" \ -- "-l${cf_x_athena_root}_s -lXmu_s" -- do -- if test -z "$cf_x_athena_lib" ; then -- cf_save="$LIBS" -- cf_test=XawSimpleMenuAddGlobalActions -- if test $cf_path != default ; then -- LIBS="-L$cf_path/lib $cf_lib $LIBS" -- echo "$as_me:11927: checking for $cf_lib in $cf_path" >&5 --echo $ECHO_N "checking for $cf_lib in $cf_path... $ECHO_C" >&6 -- else -- LIBS="$cf_lib $LIBS" -- echo "$as_me:11931: checking for $cf_test in $cf_lib" >&5 --echo $ECHO_N "checking for $cf_test in $cf_lib... $ECHO_C" >&6 -- fi -- cat >conftest.$ac_ext <<_ACEOF --#line 11935 "configure" -+fi -+ -+echo "$as_me:12456: checking whether time.h and sys/time.h may both be included" >&5 -+echo $ECHO_N "checking whether time.h and sys/time.h may both be included... $ECHO_C" >&6 -+if test "${ac_cv_header_time+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ cat >conftest.$ac_ext <<_ACEOF -+#line 12462 "configure" - #include "confdefs.h" -- --#include <X11/Intrinsic.h> --#include <X11/$cf_x_athena_root/SimpleMenu.h> -+#include <sys/types.h> -+#include <sys/time.h> -+#include <time.h> - - int - main () - { -- --$cf_test((XtAppContext) 0) -+if ((struct tm *) 0) -+return 0; - ; - return 0; - } - _ACEOF --rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:11951: \"$ac_link\"") >&5 -- (eval $ac_link) 2>&5 -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:12478: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:11954: \$? = $ac_status" >&5 -+ echo "$as_me:12481: \$? = $ac_status" >&5 - (exit $ac_status); } && -- { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:11957: \"$ac_try\"") >&5 -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:12484: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:11960: \$? = $ac_status" >&5 -+ echo "$as_me:12487: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- cf_result=yes -+ ac_cv_header_time=yes - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --cf_result=no -+ac_cv_header_time=no - fi --rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -- echo "$as_me:11969: result: $cf_result" >&5 --echo "${ECHO_T}$cf_result" >&6 -- if test "$cf_result" = yes ; then -- cf_x_athena_lib="$cf_lib" -- break -- fi -- LIBS="$cf_save" -- fi -- done --done -- --if test -z "$cf_x_athena_lib" ; then -- { { echo "$as_me:11981: error: Unable to successfully link Athena library (-l$cf_x_athena_root) with test program" >&5 --echo "$as_me: error: Unable to successfully link Athena library (-l$cf_x_athena_root) with test program" >&2;} -- { (exit 1); exit 1; }; } -+rm -f conftest.$ac_objext conftest.$ac_ext - fi -+echo "$as_me:12497: result: $ac_cv_header_time" >&5 -+echo "${ECHO_T}$ac_cv_header_time" >&6 -+if test $ac_cv_header_time = yes; then - --cf_x_athena_LIBS=`echo "HAVE_LIB_$cf_x_athena" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` -- --cat >>confdefs.h <<EOF --#define $cf_x_athena_LIBS 1 -+cat >>confdefs.h <<\EOF -+#define TIME_WITH_SYS_TIME 1 - EOF - - fi - --for ac_prog in xcurses-config -+for ac_header in \ -+getopt.h \ -+locale.h \ -+math.h \ -+stdarg.h \ -+sys/ioctl.h \ -+sys/select.h \ -+sys/time.h \ -+termios.h \ -+unistd.h \ -+ - do -- # Extract the first word of "$ac_prog", so it can be a program name with args. --set dummy $ac_prog; ac_word=$2 --echo "$as_me:11998: checking for $ac_word" >&5 --echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 --if test "${ac_cv_path_XCURSES_CONFIG+set}" = set; then -+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -+echo "$as_me:12520: checking for $ac_header" >&5 -+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -+if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else -- case $XCURSES_CONFIG in -- [\\/]* | ?:[\\/]*) -- ac_cv_path_XCURSES_CONFIG="$XCURSES_CONFIG" # Let the user override the test with a path. -- ;; -- *) -- ac_save_IFS=$IFS; IFS=$ac_path_separator --ac_dummy="$PATH" --for ac_dir in $ac_dummy; do -- IFS=$ac_save_IFS -- test -z "$ac_dir" && ac_dir=. -- if $as_executable_p "$ac_dir/$ac_word"; then -- ac_cv_path_XCURSES_CONFIG="$ac_dir/$ac_word" -- echo "$as_me:12015: found $ac_dir/$ac_word" >&5 -- break -+ cat >conftest.$ac_ext <<_ACEOF -+#line 12526 "configure" -+#include "confdefs.h" -+#include <$ac_header> -+_ACEOF -+if { (eval echo "$as_me:12530: \"$ac_cpp conftest.$ac_ext\"") >&5 -+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 -+ ac_status=$? -+ egrep -v '^ *\+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 -+ echo "$as_me:12536: \$? = $ac_status" >&5 -+ (exit $ac_status); } >/dev/null; then -+ if test -s conftest.err; then -+ ac_cpp_err=$ac_c_preproc_warn_flag -+ else -+ ac_cpp_err= -+ fi -+else -+ ac_cpp_err=yes - fi --done -+if test -z "$ac_cpp_err"; then -+ eval "$as_ac_Header=yes" -+else -+ echo "$as_me: failed program was:" >&5 -+ cat conftest.$ac_ext >&5 -+ eval "$as_ac_Header=no" -+fi -+rm -f conftest.err conftest.$ac_ext -+fi -+echo "$as_me:12555: result: `eval echo '${'$as_ac_Header'}'`" >&5 -+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -+if test `eval echo '${'$as_ac_Header'}'` = yes; then -+ cat >>confdefs.h <<EOF -+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -+EOF - -- ;; --esac - fi --XCURSES_CONFIG=$ac_cv_path_XCURSES_CONFIG -+done - --if test -n "$XCURSES_CONFIG"; then -- echo "$as_me:12026: result: $XCURSES_CONFIG" >&5 --echo "${ECHO_T}$XCURSES_CONFIG" >&6 -+for ac_header in unistd.h getopt.h -+do -+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -+echo "$as_me:12568: checking for $ac_header" >&5 -+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -+if eval "test \"\${$as_ac_Header+set}\" = set"; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 - else -- echo "$as_me:12029: result: no" >&5 --echo "${ECHO_T}no" >&6 -+ cat >conftest.$ac_ext <<_ACEOF -+#line 12574 "configure" -+#include "confdefs.h" -+#include <$ac_header> -+_ACEOF -+if { (eval echo "$as_me:12578: \"$ac_cpp conftest.$ac_ext\"") >&5 -+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 -+ ac_status=$? -+ egrep -v '^ *\+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 -+ echo "$as_me:12584: \$? = $ac_status" >&5 -+ (exit $ac_status); } >/dev/null; then -+ if test -s conftest.err; then -+ ac_cpp_err=$ac_c_preproc_warn_flag -+ else -+ ac_cpp_err= -+ fi -+else -+ ac_cpp_err=yes -+fi -+if test -z "$ac_cpp_err"; then -+ eval "$as_ac_Header=yes" -+else -+ echo "$as_me: failed program was:" >&5 -+ cat conftest.$ac_ext >&5 -+ eval "$as_ac_Header=no" -+fi -+rm -f conftest.err conftest.$ac_ext - fi -+echo "$as_me:12603: result: `eval echo '${'$as_ac_Header'}'`" >&5 -+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -+if test `eval echo '${'$as_ac_Header'}'` = yes; then -+ cat >>confdefs.h <<EOF -+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -+EOF - -- test -n "$XCURSES_CONFIG" && break -+fi - done --test -n "$XCURSES_CONFIG" || XCURSES_CONFIG="none" -- --if test "$XCURSES_CONFIG" != none ; then -- --CPPFLAGS="$CPPFLAGS `$XCURSES_CONFIG --cflags`" --LIBS="`$XCURSES_CONFIG --libs` $LIBS" -- --cf_cv_lib_XCurses=yes - -+echo "$as_me:12613: checking for header declaring getopt variables" >&5 -+echo $ECHO_N "checking for header declaring getopt variables... $ECHO_C" >&6 -+if test "${cf_cv_getopt_header+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 - else - --LDFLAGS="$LDFLAGS $X_LIBS" -- --test -n "$verbose" && echo " checking additions to CFLAGS" 1>&6 -- --echo "${as_me:-configure}:12050: testing checking additions to CFLAGS ..." 1>&5 -- --cf_check_cflags="$CFLAGS" --cf_check_cppflags="$CPPFLAGS" -- --cf_fix_cppflags=no --cf_new_cflags= --cf_new_cppflags= --cf_new_extra_cppflags= -- --for cf_add_cflags in $X_CFLAGS -+cf_cv_getopt_header=none -+for cf_header in stdio.h stdlib.h unistd.h getopt.h - do --case $cf_fix_cppflags in --no) -- case $cf_add_cflags in #(vi -- -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi -- case $cf_add_cflags in -- -D*) -- cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` -- -- test "${cf_add_cflags}" != "${cf_tst_cflags}" \ -- && test -z "${cf_tst_cflags}" \ -- && cf_fix_cppflags=yes -- -- if test $cf_fix_cppflags = yes ; then -- cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -- continue -- elif test "${cf_tst_cflags}" = "\"'" ; then -- cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -- continue -- fi -- ;; -- esac -- case "$CPPFLAGS" in -- *$cf_add_cflags) #(vi -- ;; -- *) #(vi -- case $cf_add_cflags in #(vi -- -D*) -- cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` -- --CPPFLAGS=`echo "$CPPFLAGS" | \ -- sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ -- -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` -- -- ;; -- esac -- cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" -- ;; -- esac -- ;; -- *) -- cf_new_cflags="$cf_new_cflags $cf_add_cflags" -- ;; -- esac -- ;; --yes) -- cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -- -- cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` -- -- test "${cf_add_cflags}" != "${cf_tst_cflags}" \ -- && test -z "${cf_tst_cflags}" \ -- && cf_fix_cppflags=no -- ;; --esac --done -- --if test -n "$cf_new_cflags" ; then -- test -n "$verbose" && echo " add to \$CFLAGS $cf_new_cflags" 1>&6 -- --echo "${as_me:-configure}:12121: testing add to \$CFLAGS $cf_new_cflags ..." 1>&5 -+cat >conftest.$ac_ext <<_ACEOF -+#line 12623 "configure" -+#include "confdefs.h" - -- CFLAGS="$CFLAGS $cf_new_cflags" -+#include <$cf_header> -+int -+main () -+{ -+int x = optind; char *y = optarg -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:12636: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>&5 -+ ac_status=$? -+ echo "$as_me:12639: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:12642: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:12645: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ cf_cv_getopt_header=$cf_header -+ break -+else -+ echo "$as_me: failed program was:" >&5 -+cat conftest.$ac_ext >&5 - fi -+rm -f conftest.$ac_objext conftest.$ac_ext -+done - --if test -n "$cf_new_cppflags" ; then -- test -n "$verbose" && echo " add to \$CPPFLAGS $cf_new_cppflags" 1>&6 -- --echo "${as_me:-configure}:12129: testing add to \$CPPFLAGS $cf_new_cppflags ..." 1>&5 -- -- CPPFLAGS="$CPPFLAGS $cf_new_cppflags" - fi -+echo "$as_me:12657: result: $cf_cv_getopt_header" >&5 -+echo "${ECHO_T}$cf_cv_getopt_header" >&6 -+if test $cf_cv_getopt_header != none ; then - --if test -n "$cf_new_extra_cppflags" ; then -- test -n "$verbose" && echo " add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags" 1>&6 -- --echo "${as_me:-configure}:12137: testing add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags ..." 1>&5 -+cat >>confdefs.h <<\EOF -+#define HAVE_GETOPT_HEADER 1 -+EOF - -- EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" - fi - --if test "$cf_check_cflags" != "$CFLAGS" ; then --cat >conftest.$ac_ext <<_ACEOF --#line 12144 "configure" -+for ac_func in \ -+gettimeofday \ -+ -+do -+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -+echo "$as_me:12672: checking for $ac_func" >&5 -+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 -+if eval "test \"\${$as_ac_var+set}\" = set"; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ cat >conftest.$ac_ext <<_ACEOF -+#line 12678 "configure" - #include "confdefs.h" --#include <stdio.h> -+/* System header to define __stub macros and hopefully few prototypes, -+ which can conflict with char $ac_func (); below. */ -+#include <assert.h> -+/* Override any gcc2 internal prototype to avoid an error. */ -+#ifdef __cplusplus -+extern "C" -+#endif -+/* We use char because int might match the return type of a gcc2 -+ builtin and then its argument prototype would still apply. */ -+char $ac_func (); -+char (*f) (); -+ - int - main () - { --printf("Hello world"); -+/* The GNU C library defines this for functions which it implements -+ to always fail with ENOSYS. Some functions are actually named -+ something starting with __ and the normal name is an alias. */ -+#if defined (__stub_$ac_func) || defined (__stub___$ac_func) -+choke me -+#else -+f = $ac_func; /* workaround for ICC 12.0.3 */ if (f == 0) return 1; -+#endif -+ - ; - return 0; - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:12156: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:12709: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:12159: \$? = $ac_status" >&5 -+ echo "$as_me:12712: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:12162: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:12715: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:12165: \$? = $ac_status" >&5 -+ echo "$as_me:12718: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- : -+ eval "$as_ac_var=yes" - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --test -n "$verbose" && echo " test-compile failed. Undoing change to \$CFLAGS" 1>&6 -- --echo "${as_me:-configure}:12173: testing test-compile failed. Undoing change to \$CFLAGS ..." 1>&5 -- -- if test "$cf_check_cppflags" != "$CPPFLAGS" ; then -- test -n "$verbose" && echo " but keeping change to \$CPPFLAGS" 1>&6 -- --echo "${as_me:-configure}:12178: testing but keeping change to \$CPPFLAGS ..." 1>&5 -- -- fi -- CFLAGS="$cf_check_flags" -+eval "$as_ac_var=no" - fi - rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - fi -+echo "$as_me:12728: result: `eval echo '${'$as_ac_var'}'`" >&5 -+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 -+if test `eval echo '${'$as_ac_var'}'` = yes; then -+ cat >>confdefs.h <<EOF -+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 -+EOF -+ -+fi -+done - --echo "$as_me:12186: checking for XOpenDisplay in -lX11" >&5 --echo $ECHO_N "checking for XOpenDisplay in -lX11... $ECHO_C" >&6 --if test "${ac_cv_lib_X11_XOpenDisplay+set}" = set; then -+if test "$cf_enable_widec" = yes; then -+ -+for ac_func in \ -+mblen \ -+mbrlen \ -+mbrtowc \ -+mbsrtowcs \ -+mbstowcs \ -+mbtowc \ -+wcsrtombs \ -+wcstombs \ -+ -+do -+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -+echo "$as_me:12752: checking for $ac_func" >&5 -+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 -+if eval "test \"\${$as_ac_var+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else -- ac_check_lib_save_LIBS=$LIBS --LIBS="-lX11 $X_PRE_LIBS $LIBS $X_EXTRA_LIBS $LIBS" --cat >conftest.$ac_ext <<_ACEOF --#line 12194 "configure" -+ cat >conftest.$ac_ext <<_ACEOF -+#line 12758 "configure" - #include "confdefs.h" -- -+/* System header to define __stub macros and hopefully few prototypes, -+ which can conflict with char $ac_func (); below. */ -+#include <assert.h> - /* Override any gcc2 internal prototype to avoid an error. */ - #ifdef __cplusplus - extern "C" - #endif - /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ --char XOpenDisplay (); -+char $ac_func (); -+char (*f) (); -+ - int - main () - { --XOpenDisplay (); -+/* The GNU C library defines this for functions which it implements -+ to always fail with ENOSYS. Some functions are actually named -+ something starting with __ and the normal name is an alias. */ -+#if defined (__stub_$ac_func) || defined (__stub___$ac_func) -+choke me -+#else -+f = $ac_func; /* workaround for ICC 12.0.3 */ if (f == 0) return 1; -+#endif -+ - ; - return 0; - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:12213: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:12789: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:12216: \$? = $ac_status" >&5 -+ echo "$as_me:12792: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:12219: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:12795: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:12222: \$? = $ac_status" >&5 -+ echo "$as_me:12798: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- ac_cv_lib_X11_XOpenDisplay=yes -+ eval "$as_ac_var=yes" - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --ac_cv_lib_X11_XOpenDisplay=no -+eval "$as_ac_var=no" - fi - rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext --LIBS=$ac_check_lib_save_LIBS - fi --echo "$as_me:12233: result: $ac_cv_lib_X11_XOpenDisplay" >&5 --echo "${ECHO_T}$ac_cv_lib_X11_XOpenDisplay" >&6 --if test $ac_cv_lib_X11_XOpenDisplay = yes; then -- LIBS="-lX11 $LIBS" -+echo "$as_me:12808: result: `eval echo '${'$as_ac_var'}'`" >&5 -+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 -+if test `eval echo '${'$as_ac_var'}'` = yes; then -+ cat >>confdefs.h <<EOF -+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 -+EOF -+ - fi -+done - --echo "$as_me:12239: checking for XCurses library" >&5 --echo $ECHO_N "checking for XCurses library... $ECHO_C" >&6 --if test "${cf_cv_lib_XCurses+set}" = set; then -+fi -+ -+echo "$as_me:12820: checking if we must define _XOPEN_SOURCE_EXTENDED" >&5 -+echo $ECHO_N "checking if we must define _XOPEN_SOURCE_EXTENDED... $ECHO_C" >&6 -+if test "${cf_cv_need_xopen_extension+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - --LIBS="-lXCurses $LIBS" - cat >conftest.$ac_ext <<_ACEOF --#line 12247 "configure" -+#line 12827 "configure" - #include "confdefs.h" - --#include <xcurses.h> --char *XCursesProgramName = "test"; -+#include <stdlib.h> -+#include <${cf_cv_ncurses_header:-curses.h}> -+int -+main () -+{ - -+#if defined(NCURSES_VERSION_PATCH) -+#if (NCURSES_VERSION_PATCH < 20100501) && (NCURSES_VERSION_PATCH >= 20100403) -+ make an error -+#endif -+#endif -+ long x = winnstr(stdscr, "", 0); -+ int x1, y1; -+ getbegyx(stdscr, y1, x1) -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext conftest$ac_exeext -+if { (eval echo "$as_me:12849: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>&5 -+ ac_status=$? -+ echo "$as_me:12852: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -s conftest$ac_exeext' -+ { (eval echo "$as_me:12855: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:12858: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ cf_cv_need_xopen_extension=no -+else -+ echo "$as_me: failed program was:" >&5 -+cat conftest.$ac_ext >&5 -+cat >conftest.$ac_ext <<_ACEOF -+#line 12865 "configure" -+#include "confdefs.h" -+ -+#define _XOPEN_SOURCE_EXTENDED -+#include <stdlib.h> -+#include <${cf_cv_ncurses_header:-curses.h}> - int - main () - { --XCursesExit(); -+ -+#ifdef NCURSES_VERSION -+ cchar_t check; -+ int check2 = curs_set((int)sizeof(check)); -+#endif -+ long x = winnstr(stdscr, "", 0); -+ int x1, y1; -+ getbegyx(stdscr, y1, x1) - ; - return 0; - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:12262: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:12887: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:12265: \$? = $ac_status" >&5 -+ echo "$as_me:12890: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:12268: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:12893: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:12271: \$? = $ac_status" >&5 -+ echo "$as_me:12896: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- cf_cv_lib_XCurses=yes -+ cf_cv_need_xopen_extension=yes -+else -+ echo "$as_me: failed program was:" >&5 -+cat conftest.$ac_ext >&5 -+cf_cv_need_xopen_extension=unknown -+fi -+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -+fi -+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -+fi -+echo "$as_me:12908: result: $cf_cv_need_xopen_extension" >&5 -+echo "${ECHO_T}$cf_cv_need_xopen_extension" >&6 -+test $cf_cv_need_xopen_extension = yes && CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED" -+ -+echo "$as_me:12912: checking for term.h" >&5 -+echo $ECHO_N "checking for term.h... $ECHO_C" >&6 -+if test "${cf_cv_term_header+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ -+# If we found <ncurses/curses.h>, look for <ncurses/term.h>, but always look -+# for <term.h> if we do not find the variant. -+ -+cf_header_list="term.h ncurses/term.h ncursesw/term.h" -+ -+case ${cf_cv_ncurses_header:-curses.h} in #(vi -+*/*) -+ cf_header_item=`echo ${cf_cv_ncurses_header:-curses.h} | sed -e 's%\..*%%' -e 's%/.*%/%'`term.h -+ cf_header_list="$cf_header_item $cf_header_list" -+ ;; -+esac -+ -+for cf_header in $cf_header_list -+do -+ cat >conftest.$ac_ext <<_ACEOF -+#line 12933 "configure" -+#include "confdefs.h" -+ -+#include <${cf_cv_ncurses_header:-curses.h}> -+#include <${cf_header}> -+int -+main () -+{ -+WINDOW *x -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:12947: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>&5 -+ ac_status=$? -+ echo "$as_me:12950: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:12953: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:12956: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ cf_cv_term_header=$cf_header -+ break -+else -+ echo "$as_me: failed program was:" >&5 -+cat conftest.$ac_ext >&5 -+cf_cv_term_header=no -+fi -+rm -f conftest.$ac_objext conftest.$ac_ext -+done -+ -+case $cf_cv_term_header in #(vi -+no) -+ # If curses is ncurses, some packagers still mess it up by trying to make -+ # us use GNU termcap. This handles the most common case. -+ for cf_header in ncurses/term.h ncursesw/term.h -+ do -+ cat >conftest.$ac_ext <<_ACEOF -+#line 12975 "configure" -+#include "confdefs.h" -+ -+#include <${cf_cv_ncurses_header:-curses.h}> -+#ifdef NCURSES_VERSION -+#include <${cf_header}> -+#else -+make an error -+#endif -+int -+main () -+{ -+WINDOW *x -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:12993: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>&5 -+ ac_status=$? -+ echo "$as_me:12996: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:12999: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:13002: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ cf_cv_term_header=$cf_header -+ break - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --cf_cv_lib_XCurses=no -+cf_cv_term_header=no - fi --rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -+rm -f conftest.$ac_objext conftest.$ac_ext -+ done -+ ;; -+esac - - fi --echo "$as_me:12282: result: $cf_cv_lib_XCurses" >&5 --echo "${ECHO_T}$cf_cv_lib_XCurses" >&6 -+echo "$as_me:13017: result: $cf_cv_term_header" >&5 -+echo "${ECHO_T}$cf_cv_term_header" >&6 - --fi -+case $cf_cv_term_header in #(vi -+term.h) #(vi - --if test $cf_cv_lib_XCurses = yes ; then -- cat >>confdefs.h <<\EOF --#define UNIX 1 -+cat >>confdefs.h <<\EOF -+#define HAVE_TERM_H 1 - EOF - -- cat >>confdefs.h <<\EOF --#define XCURSES 1 --EOF -+ ;; -+ncurses/term.h) #(vi - -- echo "$as_me:12296: checking for xcurses.h" >&5 --echo $ECHO_N "checking for xcurses.h... $ECHO_C" >&6 --if test "${ac_cv_header_xcurses_h+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 --else -- cat >conftest.$ac_ext <<_ACEOF --#line 12302 "configure" --#include "confdefs.h" --#include <xcurses.h> --_ACEOF --if { (eval echo "$as_me:12306: \"$ac_cpp conftest.$ac_ext\"") >&5 -- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 -- ac_status=$? -- egrep -v '^ *\+' conftest.er1 >conftest.err -- rm -f conftest.er1 -- cat conftest.err >&5 -- echo "$as_me:12312: \$? = $ac_status" >&5 -- (exit $ac_status); } >/dev/null; then -- if test -s conftest.err; then -- ac_cpp_err=$ac_c_preproc_warn_flag -- else -- ac_cpp_err= -- fi --else -- ac_cpp_err=yes --fi --if test -z "$ac_cpp_err"; then -- ac_cv_header_xcurses_h=yes --else -- echo "$as_me: failed program was:" >&5 -- cat conftest.$ac_ext >&5 -- ac_cv_header_xcurses_h=no --fi --rm -f conftest.err conftest.$ac_ext --fi --echo "$as_me:12331: result: $ac_cv_header_xcurses_h" >&5 --echo "${ECHO_T}$ac_cv_header_xcurses_h" >&6 --if test $ac_cv_header_xcurses_h = yes; then -- cat >>confdefs.h <<\EOF --#define HAVE_XCURSES 1 -+cat >>confdefs.h <<\EOF -+#define HAVE_NCURSES_TERM_H 1 - EOF - --fi -+ ;; -+ncursesw/term.h) - --else -- { { echo "$as_me:12341: error: Cannot link with XCurses" >&5 --echo "$as_me: error: Cannot link with XCurses" >&2;} -- { (exit 1); exit 1; }; } --fi -+cat >>confdefs.h <<\EOF -+#define HAVE_NCURSESW_TERM_H 1 -+EOF - - ;; - esac - --case $cf_cv_screen in #(vi --pdcurses) #(vi -- ;; --*) -- # look for curses-related libraries -- --as_ac_Lib=`echo "ac_cv_lib_panel$cf_cv_libtype''_new_panel" | $as_tr_sh` --echo "$as_me:12356: checking for new_panel in -lpanel$cf_cv_libtype" >&5 --echo $ECHO_N "checking for new_panel in -lpanel$cf_cv_libtype... $ECHO_C" >&6 --if eval "test \"\${$as_ac_Lib+set}\" = set"; then -+echo "$as_me:13044: checking for unctrl.h" >&5 -+echo $ECHO_N "checking for unctrl.h... $ECHO_C" >&6 -+if test "${cf_cv_unctrl_header+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else -- ac_check_lib_save_LIBS=$LIBS --LIBS="-lpanel$cf_cv_libtype $LIBS" --cat >conftest.$ac_ext <<_ACEOF --#line 12364 "configure" -+ -+# If we found <ncurses/curses.h>, look for <ncurses/unctrl.h>, but always look -+# for <unctrl.h> if we do not find the variant. -+ -+cf_header_list="unctrl.h ncurses/unctrl.h ncursesw/unctrl.h" -+ -+case ${cf_cv_ncurses_header:-curses.h} in #(vi -+*/*) -+ cf_header_item=`echo ${cf_cv_ncurses_header:-curses.h} | sed -e 's%\..*%%' -e 's%/.*%/%'`unctrl.h -+ cf_header_list="$cf_header_item $cf_header_list" -+ ;; -+esac -+ -+for cf_header in $cf_header_list -+do -+ cat >conftest.$ac_ext <<_ACEOF -+#line 13065 "configure" - #include "confdefs.h" - --/* Override any gcc2 internal prototype to avoid an error. */ --#ifdef __cplusplus --extern "C" --#endif --/* We use char because int might match the return type of a gcc2 -- builtin and then its argument prototype would still apply. */ --char new_panel (); -+#include <${cf_cv_ncurses_header:-curses.h}> -+#include <${cf_header}> - int - main () - { --new_panel (); -+WINDOW *x - ; - return 0; - } - _ACEOF --rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:12383: \"$ac_link\"") >&5 -- (eval $ac_link) 2>&5 -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:13079: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:12386: \$? = $ac_status" >&5 -+ echo "$as_me:13082: \$? = $ac_status" >&5 - (exit $ac_status); } && -- { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:12389: \"$ac_try\"") >&5 -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:13085: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:12392: \$? = $ac_status" >&5 -+ echo "$as_me:13088: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- eval "$as_ac_Lib=yes" -+ cf_cv_unctrl_header=$cf_header -+ break - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --eval "$as_ac_Lib=no" -+cf_cv_unctrl_header=no - fi --rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext --LIBS=$ac_check_lib_save_LIBS -+rm -f conftest.$ac_objext conftest.$ac_ext -+done -+ - fi --echo "$as_me:12403: result: `eval echo '${'$as_ac_Lib'}'`" >&5 --echo "${ECHO_T}`eval echo '${'$as_ac_Lib'}'`" >&6 --if test `eval echo '${'$as_ac_Lib'}'` = yes; then -- cat >>confdefs.h <<EOF --#define `echo "HAVE_LIBpanel$cf_cv_libtype" | $as_tr_cpp` 1 -+echo "$as_me:13101: result: $cf_cv_unctrl_header" >&5 -+echo "${ECHO_T}$cf_cv_unctrl_header" >&6 -+ -+case $cf_cv_unctrl_header in #(vi -+no) -+ { echo "$as_me:13106: WARNING: unctrl.h header not found" >&5 -+echo "$as_me: WARNING: unctrl.h header not found" >&2;} -+ ;; -+esac -+ -+case $cf_cv_unctrl_header in #(vi -+unctrl.h) #(vi -+ -+cat >>confdefs.h <<\EOF -+#define HAVE_UNCTRL_H 1 - EOF - -- LIBS="-lpanel$cf_cv_libtype $LIBS" -+ ;; -+ncurses/unctrl.h) #(vi - --fi -+cat >>confdefs.h <<\EOF -+#define HAVE_NCURSES_UNCTRL_H 1 -+EOF - --as_ac_Lib=`echo "ac_cv_lib_menu$cf_cv_libtype''_menu_driver" | $as_tr_sh` --echo "$as_me:12415: checking for menu_driver in -lmenu$cf_cv_libtype" >&5 --echo $ECHO_N "checking for menu_driver in -lmenu$cf_cv_libtype... $ECHO_C" >&6 --if eval "test \"\${$as_ac_Lib+set}\" = set"; then -+ ;; -+ncursesw/unctrl.h) -+ -+cat >>confdefs.h <<\EOF -+#define HAVE_NCURSESW_UNCTRL_H 1 -+EOF -+ -+ ;; -+esac -+ -+for cf_func in \ -+assume_default_colors \ -+chgat \ -+color_set \ -+filter \ -+getbegx \ -+getcurx \ -+getmaxx \ -+getnstr \ -+getparx \ -+getwin \ -+mvvline \ -+mvwvline \ -+napms \ -+putwin \ -+resize_term \ -+resizeterm \ -+ripoffline \ -+scr_dump \ -+setupterm \ -+slk_color \ -+slk_init \ -+termattrs \ -+tgetent \ -+tigetnum \ -+tigetstr \ -+typeahead \ -+use_default_colors \ -+use_screen \ -+use_window \ -+vsscanf \ -+vw_printw \ -+wchgat \ -+winsstr \ -+wresize \ -+wsyncdown \ -+ -+do -+ -+cf_tr_func=`echo "$cf_func" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` -+ -+ echo "$as_me:13176: checking for ${cf_func}" >&5 -+echo $ECHO_N "checking for ${cf_func}... $ECHO_C" >&6 -+ -+echo "${as_me:-configure}:13179: testing ${cf_func} ..." 1>&5 -+ -+ if eval "test \"\${cf_cv_func_$cf_func+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else -- ac_check_lib_save_LIBS=$LIBS --LIBS="-lmenu$cf_cv_libtype $LIBS" --cat >conftest.$ac_ext <<_ACEOF --#line 12423 "configure" -+ -+ eval cf_result='$ac_cv_func_'$cf_func -+ if test ".$cf_result" != ".no"; then -+ cat >conftest.$ac_ext <<_ACEOF -+#line 13188 "configure" - #include "confdefs.h" - --/* Override any gcc2 internal prototype to avoid an error. */ --#ifdef __cplusplus --extern "C" -+#ifdef HAVE_XCURSES -+#include <xcurses.h> -+char * XCursesProgramName = "test"; -+#else -+#include <${cf_cv_ncurses_header:-curses.h}> -+#if defined(NCURSES_VERSION) && defined(HAVE_NCURSESW_TERM_H) -+#include <ncursesw/term.h> -+#elif defined(NCURSES_VERSION) && defined(HAVE_NCURSES_TERM_H) -+#include <ncurses/term.h> -+#elif defined(HAVE_TERM_H) -+#include <term.h> - #endif --/* We use char because int might match the return type of a gcc2 -- builtin and then its argument prototype would still apply. */ --char menu_driver (); -+#endif -+ - int - main () - { --menu_driver (); -+ -+#ifndef ${cf_func} -+long foo = (long)(&${cf_func}); -+if (foo + 1234 > 5678) -+ ${cf_cv_main_return:-return}(foo); -+#endif -+ - ; - return 0; - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:12442: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:13220: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:12445: \$? = $ac_status" >&5 -+ echo "$as_me:13223: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:12448: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:13226: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:12451: \$? = $ac_status" >&5 -+ echo "$as_me:13229: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- eval "$as_ac_Lib=yes" -+ cf_result=yes - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --eval "$as_ac_Lib=no" -+cf_result=no - fi - rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext --LIBS=$ac_check_lib_save_LIBS -+ fi -+ eval 'cf_cv_func_'$cf_func'=$cf_result' -+ - fi --echo "$as_me:12462: result: `eval echo '${'$as_ac_Lib'}'`" >&5 --echo "${ECHO_T}`eval echo '${'$as_ac_Lib'}'`" >&6 --if test `eval echo '${'$as_ac_Lib'}'` = yes; then -- cat >>confdefs.h <<EOF --#define `echo "HAVE_LIBmenu$cf_cv_libtype" | $as_tr_cpp` 1 -+ -+ # use the computed/retrieved cache-value: -+ eval 'cf_result=$cf_cv_func_'$cf_func -+ echo "$as_me:13245: result: $cf_result" >&5 -+echo "${ECHO_T}$cf_result" >&6 -+ if test $cf_result != no; then -+ cat >>confdefs.h <<EOF -+#define HAVE_${cf_tr_func} 1 - EOF - -- LIBS="-lmenu$cf_cv_libtype $LIBS" -+ fi -+done - --fi -+for cf_func in tputs -+do - --as_ac_Lib=`echo "ac_cv_lib_form$cf_cv_libtype''_form_driver" | $as_tr_sh` --echo "$as_me:12474: checking for form_driver in -lform$cf_cv_libtype" >&5 --echo $ECHO_N "checking for form_driver in -lform$cf_cv_libtype... $ECHO_C" >&6 --if eval "test \"\${$as_ac_Lib+set}\" = set"; then -+cf_tr_func=`echo "$cf_func" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` -+ -+ echo "$as_me:13260: checking for ${cf_func}" >&5 -+echo $ECHO_N "checking for ${cf_func}... $ECHO_C" >&6 -+ -+echo "${as_me:-configure}:13263: testing ${cf_func} ..." 1>&5 -+ -+ if eval "test \"\${cf_cv_func_$cf_func+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else -- ac_check_lib_save_LIBS=$LIBS --LIBS="-lform$cf_cv_libtype $LIBS" --cat >conftest.$ac_ext <<_ACEOF --#line 12482 "configure" -+ -+ eval cf_result='$ac_cv_func_'$cf_func -+ if test ".$cf_result" != ".no"; then -+ cat >conftest.$ac_ext <<_ACEOF -+#line 13272 "configure" - #include "confdefs.h" - --/* Override any gcc2 internal prototype to avoid an error. */ --#ifdef __cplusplus --extern "C" -+#ifdef HAVE_XCURSES -+#include <xcurses.h> -+char * XCursesProgramName = "test"; -+#else -+#include <${cf_cv_ncurses_header:-curses.h}> -+#if defined(NCURSES_VERSION) && defined(HAVE_NCURSESW_TERM_H) -+#include <ncursesw/term.h> -+#elif defined(NCURSES_VERSION) && defined(HAVE_NCURSES_TERM_H) -+#include <ncurses/term.h> -+#elif defined(HAVE_TERM_H) -+#include <term.h> - #endif --/* We use char because int might match the return type of a gcc2 -- builtin and then its argument prototype would still apply. */ --char form_driver (); -+#endif -+ - int - main () - { --form_driver (); -+ -+#ifndef ${cf_func} -+long foo = (long)(&${cf_func}); -+if (foo + 1234 > 5678) -+ ${cf_cv_main_return:-return}(foo); -+#endif -+ - ; - return 0; - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:12501: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:13304: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:12504: \$? = $ac_status" >&5 -+ echo "$as_me:13307: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:12507: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:13310: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:12510: \$? = $ac_status" >&5 -+ echo "$as_me:13313: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- eval "$as_ac_Lib=yes" -+ cf_result=yes - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --eval "$as_ac_Lib=no" -+cf_result=no - fi - rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext --LIBS=$ac_check_lib_save_LIBS --fi --echo "$as_me:12521: result: `eval echo '${'$as_ac_Lib'}'`" >&5 --echo "${ECHO_T}`eval echo '${'$as_ac_Lib'}'`" >&6 --if test `eval echo '${'$as_ac_Lib'}'` = yes; then -- cat >>confdefs.h <<EOF --#define `echo "HAVE_LIBform$cf_cv_libtype" | $as_tr_cpp` 1 --EOF -- -- LIBS="-lform$cf_cv_libtype $LIBS" -+ fi -+ eval 'cf_cv_func_'$cf_func'=$cf_result' - - fi - -- # look for curses-related headers -- --for ac_header in \ -- nc_alloc.h \ -- nomacros.h \ -- form.h \ -- menu.h \ -- panel.h \ -- term_entry.h \ -- --do --as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` --echo "$as_me:12544: checking for $ac_header" >&5 --echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 --if eval "test \"\${$as_ac_Header+set}\" = set"; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 --else -- cat >conftest.$ac_ext <<_ACEOF --#line 12550 "configure" --#include "confdefs.h" --#include <$ac_header> --_ACEOF --if { (eval echo "$as_me:12554: \"$ac_cpp conftest.$ac_ext\"") >&5 -- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 -- ac_status=$? -- egrep -v '^ *\+' conftest.er1 >conftest.err -- rm -f conftest.er1 -- cat conftest.err >&5 -- echo "$as_me:12560: \$? = $ac_status" >&5 -- (exit $ac_status); } >/dev/null; then -- if test -s conftest.err; then -- ac_cpp_err=$ac_c_preproc_warn_flag -- else -- ac_cpp_err= -- fi --else -- ac_cpp_err=yes --fi --if test -z "$ac_cpp_err"; then -- eval "$as_ac_Header=yes" --else -- echo "$as_me: failed program was:" >&5 -- cat conftest.$ac_ext >&5 -- eval "$as_ac_Header=no" --fi --rm -f conftest.err conftest.$ac_ext --fi --echo "$as_me:12579: result: `eval echo '${'$as_ac_Header'}'`" >&5 --echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 --if test `eval echo '${'$as_ac_Header'}'` = yes; then -- cat >>confdefs.h <<EOF --#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -+ # use the computed/retrieved cache-value: -+ eval 'cf_result=$cf_cv_func_'$cf_func -+ echo "$as_me:13329: result: $cf_result" >&5 -+echo "${ECHO_T}$cf_result" >&6 -+ if test $cf_result != no; then -+ cat >>confdefs.h <<EOF -+#define HAVE_${cf_tr_func} 1 - EOF - --fi -+ fi - done - -- ;; --esac -- --echo "$as_me:12592: checking return type of signal handlers" >&5 --echo $ECHO_N "checking return type of signal handlers... $ECHO_C" >&6 --if test "${ac_cv_type_signal+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 --else -- cat >conftest.$ac_ext <<_ACEOF --#line 12598 "configure" -+if test x$cf_cv_func_tputs = xyes -+then -+ cf_done=no -+ for cf_arg in int char -+ do -+ for cf_ret in int void -+ do -+ if test $cf_ret = void -+ then -+ cf_return="/* nothing */" -+ else -+ cf_return="return value" -+ fi -+ cat >conftest.$ac_ext <<_ACEOF -+#line 13353 "configure" - #include "confdefs.h" --#include <sys/types.h> --#include <signal.h> --#ifdef signal --# undef signal --#endif --#ifdef __cplusplus --extern "C" void (*signal (int, void (*)(int)))(int); --#else --void (*signal ()) (); --#endif -+ -+#include <${cf_cv_ncurses_header:-curses.h}> -+#include <$cf_cv_term_header> -+ -+static $cf_ret outc($cf_arg value) { $cf_return; } - - int - main () - { --int i; -+ -+ tputs("hello", 0, outc); -+ ${cf_cv_main_return:-return}(0); -+ - ; - return 0; - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:12620: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:13373: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:12623: \$? = $ac_status" >&5 -+ echo "$as_me:13376: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:12626: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:13379: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:12629: \$? = $ac_status" >&5 -+ echo "$as_me:13382: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- ac_cv_type_signal=void -+ -+ test -n "$verbose" && echo " prototype $cf_ret func($cf_arg value)" 1>&6 -+ -+echo "${as_me:-configure}:13387: testing prototype $cf_ret func($cf_arg value) ..." 1>&5 -+ -+ cat >>confdefs.h <<EOF -+#define TPUTS_ARG $cf_arg -+#define TPUTS_PROTO(func,value) $cf_ret func(TPUTS_ARG value) -+#define TPUTS_RETURN(value) $cf_return -+EOF -+ cf_done=yes -+ break -+ - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --ac_cv_type_signal=int - fi - rm -f conftest.$ac_objext conftest.$ac_ext -+ done -+ test $cf_done = yes && break -+ done - fi --echo "$as_me:12639: result: $ac_cv_type_signal" >&5 --echo "${ECHO_T}$ac_cv_type_signal" >&6 -- --cat >>confdefs.h <<EOF --#define RETSIGTYPE $ac_cv_type_signal --EOF - --echo "$as_me:12646: checking for ANSI C header files" >&5 --echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 --if test "${ac_cv_header_stdc+set}" = set; then -+echo "$as_me:13407: checking for ncurses extended functions" >&5 -+echo $ECHO_N "checking for ncurses extended functions... $ECHO_C" >&6 -+if test "${cf_cv_ncurses_ext_funcs+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else -- cat >conftest.$ac_ext <<_ACEOF --#line 12652 "configure" --#include "confdefs.h" --#include <stdlib.h> --#include <stdarg.h> --#include <string.h> --#include <float.h> -- --_ACEOF --if { (eval echo "$as_me:12660: \"$ac_cpp conftest.$ac_ext\"") >&5 -- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 -- ac_status=$? -- egrep -v '^ *\+' conftest.er1 >conftest.err -- rm -f conftest.er1 -- cat conftest.err >&5 -- echo "$as_me:12666: \$? = $ac_status" >&5 -- (exit $ac_status); } >/dev/null; then -- if test -s conftest.err; then -- ac_cpp_err=$ac_c_preproc_warn_flag -- else -- ac_cpp_err= -- fi --else -- ac_cpp_err=yes --fi --if test -z "$ac_cpp_err"; then -- ac_cv_header_stdc=yes --else -- echo "$as_me: failed program was:" >&5 -- cat conftest.$ac_ext >&5 -- ac_cv_header_stdc=no --fi --rm -f conftest.err conftest.$ac_ext - --if test $ac_cv_header_stdc = yes; then -- # SunOS 4.x string.h does not declare mem*, contrary to ANSI. -- cat >conftest.$ac_ext <<_ACEOF --#line 12688 "configure" -+cat >conftest.$ac_ext <<_ACEOF -+#line 13414 "configure" - #include "confdefs.h" --#include <string.h> -- --_ACEOF --if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | -- egrep "memchr" >/dev/null 2>&1; then -- : --else -- ac_cv_header_stdc=no --fi --rm -rf conftest* - --fi -+#include <${cf_cv_ncurses_header:-curses.h}> -+int -+main () -+{ - --if test $ac_cv_header_stdc = yes; then -- # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. -- cat >conftest.$ac_ext <<_ACEOF --#line 12706 "configure" --#include "confdefs.h" --#include <stdlib.h> -+int x = NCURSES_EXT_FUNCS - -+ ; -+ return 0; -+} - _ACEOF --if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | -- egrep "free" >/dev/null 2>&1; then -- : -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:13429: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>&5 -+ ac_status=$? -+ echo "$as_me:13432: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:13435: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:13438: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ cf_cv_ncurses_ext_funcs=defined - else -- ac_cv_header_stdc=no --fi --rm -rf conftest* -- --fi -+ echo "$as_me: failed program was:" >&5 -+cat conftest.$ac_ext >&5 - --if test $ac_cv_header_stdc = yes; then -- # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. -- if test "$cross_compiling" = yes; then -- : --else -- cat >conftest.$ac_ext <<_ACEOF --#line 12727 "configure" -+cat >conftest.$ac_ext <<_ACEOF -+#line 13446 "configure" - #include "confdefs.h" --#include <ctype.h> --#if ((' ' & 0x0FF) == 0x020) --# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') --# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) --#else --# define ISLOWER(c) (('a' <= (c) && (c) <= 'i') \ -- || ('j' <= (c) && (c) <= 'r') \ -- || ('s' <= (c) && (c) <= 'z')) --# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) --#endif - --#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) -+#include <${cf_cv_ncurses_header:-curses.h}> - int - main () - { -- int i; -- for (i = 0; i < 256; i++) -- if (XOR (islower (i), ISLOWER (i)) -- || toupper (i) != TOUPPER (i)) -- $ac_main_return(2); -- $ac_main_return (0); -+ -+ (void) assume_default_colors (0, 0); -+ (void) curses_version (); -+ (void) define_key (0, 0); -+ (void) is_term_resized (0, 0); -+ (void) key_defined (0); -+ (void) keybound (0, 0); -+ (void) keyok (0, 0); -+ (void) resize_term (0, 0); -+ (void) resizeterm (0, 0); -+ (void) use_default_colors (); -+ (void) use_extended_names (0); -+ (void) wresize (0, 0, 0); -+ ; -+ return 0; - } - _ACEOF --rm -f conftest$ac_exeext --if { (eval echo "$as_me:12753: \"$ac_link\"") >&5 -+rm -f conftest.$ac_objext conftest$ac_exeext -+if { (eval echo "$as_me:13471: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:12756: \$? = $ac_status" >&5 -- (exit $ac_status); } && { ac_try='./conftest$ac_exeext' -- { (eval echo "$as_me:12758: \"$ac_try\"") >&5 -+ echo "$as_me:13474: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -s conftest$ac_exeext' -+ { (eval echo "$as_me:13477: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:12761: \$? = $ac_status" >&5 -+ echo "$as_me:13480: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- : -+ cf_cv_ncurses_ext_funcs=yes - else -- echo "$as_me: program exited with status $ac_status" >&5 --echo "$as_me: failed program was:" >&5 -+ echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --ac_cv_header_stdc=no --fi --rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext --fi -+cf_cv_ncurses_ext_funcs=no - fi -+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -+ - fi --echo "$as_me:12774: result: $ac_cv_header_stdc" >&5 --echo "${ECHO_T}$ac_cv_header_stdc" >&6 --if test $ac_cv_header_stdc = yes; then -+rm -f conftest.$ac_objext conftest.$ac_ext - -+fi -+echo "$as_me:13494: result: $cf_cv_ncurses_ext_funcs" >&5 -+echo "${ECHO_T}$cf_cv_ncurses_ext_funcs" >&6 -+test "$cf_cv_ncurses_ext_funcs" = yes && - cat >>confdefs.h <<\EOF --#define STDC_HEADERS 1 -+#define NCURSES_EXT_FUNCS 1 - EOF - --fi -+if test "$cf_enable_widec" = yes -+then -+ # workaround for systems with ncurses before 20111029, due to change of -+ # feature test macro from _XPG5 to _XOPEN_SOURCE -+ if test -n "$cf_cv_ncurses_version" && test "x$cf_cv_ncurses_version" != xno -+ then -+ cf_define_xpg5=no -+ echo "$as_me:13508: checking if _XPG5 should be defined to enable wide-characters" >&5 -+echo $ECHO_N "checking if _XPG5 should be defined to enable wide-characters... $ECHO_C" >&6 - --echo "$as_me:12784: checking whether time.h and sys/time.h may both be included" >&5 --echo $ECHO_N "checking whether time.h and sys/time.h may both be included... $ECHO_C" >&6 --if test "${ac_cv_header_time+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 --else -- cat >conftest.$ac_ext <<_ACEOF --#line 12790 "configure" -+ cat >conftest.$ac_ext <<_ACEOF -+#line 13512 "configure" - #include "confdefs.h" --#include <sys/types.h> --#include <sys/time.h> --#include <time.h> - -+#include <${cf_cv_ncurses_header:-curses.h}> - int - main () - { --if ((struct tm *) 0) --return 0; -+int x = _XPG5 - ; - return 0; - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:12806: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:13525: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:12809: \$? = $ac_status" >&5 -+ echo "$as_me:13528: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:12812: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:13531: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:12815: \$? = $ac_status" >&5 -+ echo "$as_me:13534: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- ac_cv_header_time=yes -+ : - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --ac_cv_header_time=no --fi --rm -f conftest.$ac_objext conftest.$ac_ext --fi --echo "$as_me:12825: result: $ac_cv_header_time" >&5 --echo "${ECHO_T}$ac_cv_header_time" >&6 --if test $ac_cv_header_time = yes; then -- --cat >>confdefs.h <<\EOF --#define TIME_WITH_SYS_TIME 1 --EOF -- --fi -- --for ac_header in \ --getopt.h \ --locale.h \ --math.h \ --stdarg.h \ --sys/ioctl.h \ --sys/select.h \ --sys/time.h \ --termios.h \ --unistd.h \ -- --do --as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` --echo "$as_me:12848: checking for $ac_header" >&5 --echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 --if eval "test \"\${$as_ac_Header+set}\" = set"; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 --else -- cat >conftest.$ac_ext <<_ACEOF --#line 12854 "configure" --#include "confdefs.h" --#include <$ac_header> --_ACEOF --if { (eval echo "$as_me:12858: \"$ac_cpp conftest.$ac_ext\"") >&5 -- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 -- ac_status=$? -- egrep -v '^ *\+' conftest.er1 >conftest.err -- rm -f conftest.er1 -- cat conftest.err >&5 -- echo "$as_me:12864: \$? = $ac_status" >&5 -- (exit $ac_status); } >/dev/null; then -- if test -s conftest.err; then -- ac_cpp_err=$ac_c_preproc_warn_flag -- else -- ac_cpp_err= -- fi --else -- ac_cpp_err=yes --fi --if test -z "$ac_cpp_err"; then -- eval "$as_ac_Header=yes" --else -- echo "$as_me: failed program was:" >&5 -- cat conftest.$ac_ext >&5 -- eval "$as_ac_Header=no" --fi --rm -f conftest.err conftest.$ac_ext --fi --echo "$as_me:12883: result: `eval echo '${'$as_ac_Header'}'`" >&5 --echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 --if test `eval echo '${'$as_ac_Header'}'` = yes; then -- cat >>confdefs.h <<EOF --#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 --EOF -- --fi --done -- --for ac_func in \ --gettimeofday \ --mblen \ --mbrlen \ --mbrtowc \ --mbsrtowcs \ --mbstowcs \ --mbtowc \ --strdup \ --wcsrtombs \ --wcstombs \ -- --do --as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` --echo "$as_me:12907: checking for $ac_func" >&5 --echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 --if eval "test \"\${$as_ac_var+set}\" = set"; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 --else -- cat >conftest.$ac_ext <<_ACEOF --#line 12913 "configure" -+cf_save_cppflags="$CPPFLAGS" -+ CPPFLAGS="$CPPFLAGS -D_XPG5" -+ cat >conftest.$ac_ext <<_ACEOF -+#line 13543 "configure" - #include "confdefs.h" --/* System header to define __stub macros and hopefully few prototypes, -- which can conflict with char $ac_func (); below. */ --#include <assert.h> --/* Override any gcc2 internal prototype to avoid an error. */ --#ifdef __cplusplus --extern "C" --#endif --/* We use char because int might match the return type of a gcc2 -- builtin and then its argument prototype would still apply. */ --char $ac_func (); --char (*f) (); - -+#include <${cf_cv_ncurses_header:-curses.h}> - int - main () - { --/* The GNU C library defines this for functions which it implements -- to always fail with ENOSYS. Some functions are actually named -- something starting with __ and the normal name is an alias. */ --#if defined (__stub_$ac_func) || defined (__stub___$ac_func) --choke me --#else --f = $ac_func; --#endif -- -+int x = _XPG5 - ; - return 0; - } - _ACEOF --rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:12944: \"$ac_link\"") >&5 -- (eval $ac_link) 2>&5 -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:13556: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:12947: \$? = $ac_status" >&5 -+ echo "$as_me:13559: \$? = $ac_status" >&5 - (exit $ac_status); } && -- { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:12950: \"$ac_try\"") >&5 -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:13562: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:12953: \$? = $ac_status" >&5 -+ echo "$as_me:13565: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- eval "$as_ac_var=yes" -+ cf_define_xpg5=yes - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --eval "$as_ac_var=no" - fi --rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -+rm -f conftest.$ac_objext conftest.$ac_ext -+ CPPFLAGS="$cf_save_cppflags" - fi --echo "$as_me:12963: result: `eval echo '${'$as_ac_var'}'`" >&5 --echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 --if test `eval echo '${'$as_ac_var'}'` = yes; then -- cat >>confdefs.h <<EOF --#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 --EOF -+rm -f conftest.$ac_objext conftest.$ac_ext -+ echo "$as_me:13576: result: $cf_define_xpg5" >&5 -+echo "${ECHO_T}$cf_define_xpg5" >&6 - --fi --done -+ if test "$cf_define_xpg5" = yes -+ then -+ CPPFLAGS="$CPPFLAGS -D_XPG5" -+ fi -+ fi - --echo "$as_me:12973: checking if we must define _XOPEN_SOURCE_EXTENDED" >&5 --echo $ECHO_N "checking if we must define _XOPEN_SOURCE_EXTENDED... $ECHO_C" >&6 --if test "${cf_cv_need_xopen_extension+set}" = set; then -+ echo "$as_me:13585: checking for wide-character functions" >&5 -+echo $ECHO_N "checking for wide-character functions... $ECHO_C" >&6 -+if test "${cf_cv_widechar_funcs+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - --cat >conftest.$ac_ext <<_ACEOF --#line 12980 "configure" -+ cat >conftest.$ac_ext <<_ACEOF -+#line 13592 "configure" - #include "confdefs.h" - --#include <stdlib.h> - #include <${cf_cv_ncurses_header:-curses.h}> - int - main () - { - --#if defined(NCURSES_VERSION_PATCH) --#if (NCURSES_VERSION_PATCH < 20100501) && (NCURSES_VERSION_PATCH >= 20100403) -- make an error --#endif --#endif -- long x = winnstr(stdscr, "", 0); -- int x1, y1; -- getbegyx(stdscr, y1, x1) -+ static wchar_t src_wchar[2]; -+ static cchar_t dst_cchar; -+ setcchar(&dst_cchar, src_wchar, A_NORMAL, 0, (void *) 0); -+ - ; - return 0; - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:13002: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:13609: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:13005: \$? = $ac_status" >&5 -+ echo "$as_me:13612: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:13008: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:13615: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:13011: \$? = $ac_status" >&5 -+ echo "$as_me:13618: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- cf_cv_need_xopen_extension=no -+ cf_cv_widechar_funcs=yes - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 -+cf_cv_widechar_funcs=no -+fi -+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -+ -+fi -+echo "$as_me:13629: result: $cf_cv_widechar_funcs" >&5 -+echo "${ECHO_T}$cf_cv_widechar_funcs" >&6 -+ if test "$cf_cv_widechar_funcs" != no ; then -+ -+cat >>confdefs.h <<\EOF -+#define USE_WIDEC_SUPPORT 1 -+EOF -+ -+ else -+ cat >>confdefs.h <<\EOF -+#define USE_WIDEC_SUPPORT 0 -+EOF -+ -+ fi -+else -+ cat >>confdefs.h <<\EOF -+#define USE_WIDEC_SUPPORT 0 -+EOF -+ -+fi -+ -+echo "$as_me:13650: checking if sys/time.h works with sys/select.h" >&5 -+echo $ECHO_N "checking if sys/time.h works with sys/select.h... $ECHO_C" >&6 -+if test "${cf_cv_sys_time_select+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ - cat >conftest.$ac_ext <<_ACEOF --#line 13018 "configure" -+#line 13657 "configure" - #include "confdefs.h" - --#define _XOPEN_SOURCE_EXTENDED --#include <stdlib.h> --#include <${cf_cv_ncurses_header:-curses.h}> -+#include <sys/types.h> -+#ifdef HAVE_SYS_TIME_H -+#include <sys/time.h> -+#endif -+#ifdef HAVE_SYS_SELECT_H -+#include <sys/select.h> -+#endif -+ - int - main () - { - --#ifdef NCURSES_VERSION -- cchar_t check; -- int check2 = curs_set((int)sizeof(check)); --#endif -- long x = winnstr(stdscr, "", 0); -- int x1, y1; -- getbegyx(stdscr, y1, x1) - ; - return 0; - } - _ACEOF --rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:13040: \"$ac_link\"") >&5 -- (eval $ac_link) 2>&5 -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:13677: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:13043: \$? = $ac_status" >&5 -+ echo "$as_me:13680: \$? = $ac_status" >&5 - (exit $ac_status); } && -- { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:13046: \"$ac_try\"") >&5 -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:13683: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:13049: \$? = $ac_status" >&5 -+ echo "$as_me:13686: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- cf_cv_need_xopen_extension=yes -+ cf_cv_sys_time_select=yes - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --cf_cv_need_xopen_extension=unknown --fi --rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -+cf_cv_sys_time_select=no - fi --rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -+rm -f conftest.$ac_objext conftest.$ac_ext -+ - fi --echo "$as_me:13061: result: $cf_cv_need_xopen_extension" >&5 --echo "${ECHO_T}$cf_cv_need_xopen_extension" >&6 --test $cf_cv_need_xopen_extension = yes && CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED" - --echo "$as_me:13065: checking for term.h" >&5 --echo $ECHO_N "checking for term.h... $ECHO_C" >&6 --if test "${cf_cv_term_header+set}" = set; then -+echo "$as_me:13698: result: $cf_cv_sys_time_select" >&5 -+echo "${ECHO_T}$cf_cv_sys_time_select" >&6 -+test "$cf_cv_sys_time_select" = yes && -+cat >>confdefs.h <<\EOF -+#define HAVE_SYS_TIME_SELECT 1 -+EOF -+ -+echo "$as_me:13705: checking for function curses_version" >&5 -+echo $ECHO_N "checking for function curses_version... $ECHO_C" >&6 -+if test "${cf_cv_func_curses_version+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - --# If we found <ncurses/curses.h>, look for <ncurses/term.h>, but always look --# for <term.h> if we do not find the variant. --for cf_header in \ -- `echo ${cf_cv_ncurses_header:-curses.h} | sed -e 's%/.*%/%'`term.h \ -- term.h --do -- cat >conftest.$ac_ext <<_ACEOF --#line 13078 "configure" -+if test "$cross_compiling" = yes; then -+ cf_cv_func_curses_version=unknown -+else -+ cat >conftest.$ac_ext <<_ACEOF -+#line 13715 "configure" - #include "confdefs.h" - - #include <${cf_cv_ncurses_header:-curses.h}> --#include <${cf_header}> --int --main () -+int main() - { --WINDOW *x -- ; -- return 0; -+ char temp[1024]; -+ sprintf(temp, "%s\n", curses_version()); -+ ${cf_cv_main_return:-return}(0); - } -+ - _ACEOF --rm -f conftest.$ac_objext --if { (eval echo "$as_me:13092: \"$ac_compile\"") >&5 -- (eval $ac_compile) 2>&5 -+rm -f conftest$ac_exeext -+if { (eval echo "$as_me:13728: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:13095: \$? = $ac_status" >&5 -- (exit $ac_status); } && -- { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:13098: \"$ac_try\"") >&5 -+ echo "$as_me:13731: \$? = $ac_status" >&5 -+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext' -+ { (eval echo "$as_me:13733: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:13101: \$? = $ac_status" >&5 -+ echo "$as_me:13736: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- cf_cv_term_header=$cf_header -- break -+ cf_cv_func_curses_version=yes -+ - else -- echo "$as_me: failed program was:" >&5 -+ echo "$as_me: program exited with status $ac_status" >&5 -+echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --cf_cv_term_header=no -+cf_cv_func_curses_version=no -+ - fi --rm -f conftest.$ac_objext conftest.$ac_ext --done -+rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -+fi -+rm -f core -+fi -+echo "$as_me:13751: result: $cf_cv_func_curses_version" >&5 -+echo "${ECHO_T}$cf_cv_func_curses_version" >&6 -+test "$cf_cv_func_curses_version" = yes && -+cat >>confdefs.h <<\EOF -+#define HAVE_CURSES_VERSION 1 -+EOF - --case $cf_cv_term_header in #(vi --no) -- # If curses is ncurses, some packagers still mess it up by trying to make -- # us use GNU termcap. This handles the most common case. -- for cf_header in ncurses/term.h ncursesw/term.h -- do -- cat >conftest.$ac_ext <<_ACEOF --#line 13120 "configure" -+echo "$as_me:13758: checking for alternate character set array" >&5 -+echo $ECHO_N "checking for alternate character set array... $ECHO_C" >&6 -+if test "${cf_cv_curses_acs_map+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ -+cf_cv_curses_acs_map=unknown -+for name in acs_map _acs_map __acs_map ${NCURSES_WRAP_PREFIX}acs_map -+do -+cat >conftest.$ac_ext <<_ACEOF -+#line 13768 "configure" - #include "confdefs.h" - - #include <${cf_cv_ncurses_header:-curses.h}> --#ifdef NCURSES_VERSION --#include <${cf_header}> --#else --make an error --#endif -+ - int - main () - { --WINDOW *x -+ -+$name['k'] = ACS_PLUS -+ - ; - return 0; - } - _ACEOF --rm -f conftest.$ac_objext --if { (eval echo "$as_me:13138: \"$ac_compile\"") >&5 -- (eval $ac_compile) 2>&5 -+rm -f conftest.$ac_objext conftest$ac_exeext -+if { (eval echo "$as_me:13784: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:13141: \$? = $ac_status" >&5 -+ echo "$as_me:13787: \$? = $ac_status" >&5 - (exit $ac_status); } && -- { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:13144: \"$ac_try\"") >&5 -+ { ac_try='test -s conftest$ac_exeext' -+ { (eval echo "$as_me:13790: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:13147: \$? = $ac_status" >&5 -+ echo "$as_me:13793: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- cf_cv_term_header=$cf_header -- break -+ cf_cv_curses_acs_map=$name; break - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --cf_cv_term_header=no - fi --rm -f conftest.$ac_objext conftest.$ac_ext -- done -- ;; --esac -+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -+done - - fi --echo "$as_me:13162: result: $cf_cv_term_header" >&5 --echo "${ECHO_T}$cf_cv_term_header" >&6 -- --case $cf_cv_term_header in #(vi --term.h) #(vi -- cat >>confdefs.h <<\EOF --#define HAVE_TERM_H 1 --EOF -- -- ;; --ncurses/term.h) #(vi -- cat >>confdefs.h <<\EOF --#define HAVE_NCURSES_TERM_H 1 --EOF -+echo "$as_me:13804: result: $cf_cv_curses_acs_map" >&5 -+echo "${ECHO_T}$cf_cv_curses_acs_map" >&6 - -- ;; --ncursesw/term.h) -- cat >>confdefs.h <<\EOF --#define HAVE_NCURSESW_TERM_H 1 -+test "$cf_cv_curses_acs_map" != unknown && -+cat >>confdefs.h <<EOF -+#define CURSES_ACS_ARRAY $cf_cv_curses_acs_map - EOF - -- ;; --esac -- --for cf_func in \ --chgat \ --color_set \ --filter \ --getbegx \ --getcurx \ --getmaxx \ --getnstr \ --getparx \ --getwin \ --mvvline \ --mvwvline \ --napms \ --putwin \ --resize_term \ --resizeterm \ --ripoffline \ --scr_dump \ --setupterm \ --slk_color \ --slk_init \ --termattrs \ --tgetent \ --tigetnum \ --tigetstr \ --typeahead \ --use_default_colors \ --vw_printw \ --vsscanf \ --wchgat \ --winsstr \ --wresize \ --wsyncdown \ -- --do -- --cf_tr_func=`echo "$cf_func" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` -- -- echo "$as_me:13224: checking for ${cf_func}" >&5 --echo $ECHO_N "checking for ${cf_func}... $ECHO_C" >&6 -- --echo "${as_me:-configure}:13227: testing ${cf_func} ..." 1>&5 -+if test "$cf_enable_widec" = yes; then - -- if eval "test \"\${cf_cv_func_$cf_func+set}\" = set"; then -+echo "$as_me:13814: checking for wide alternate character set array" >&5 -+echo $ECHO_N "checking for wide alternate character set array... $ECHO_C" >&6 -+if test "${cf_cv_curses_wacs_map+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - -- eval cf_result='$ac_cv_func_'$cf_func -- if test ".$cf_result" != ".no"; then -- cat >conftest.$ac_ext <<_ACEOF --#line 13236 "configure" -+ cf_cv_curses_wacs_map=unknown -+ for name in wacs_map _wacs_map __wacs_map _nc_wacs _wacs_char -+ do -+ cat >conftest.$ac_ext <<_ACEOF -+#line 13824 "configure" - #include "confdefs.h" - --#ifdef HAVE_XCURSES --#include <xcurses.h> --char * XCursesProgramName = "test"; --#else --#include <${cf_cv_ncurses_header:-curses.h}> --#if defined(NCURSES_VERSION) && defined(HAVE_NCURSESW_TERM_H) --#include <ncursesw/term.h> --#elif defined(NCURSES_VERSION) && defined(HAVE_NCURSES_TERM_H) --#include <ncurses/term.h> --#elif defined(HAVE_TERM_H) --#include <term.h> --#endif -+#ifndef _XOPEN_SOURCE_EXTENDED -+#define _XOPEN_SOURCE_EXTENDED - #endif -- -+#include <${cf_cv_ncurses_header:-curses.h}> - int - main () - { -- --#ifndef ${cf_func} --long foo = (long)(&${cf_func}); --${cf_cv_main_return:-return}(foo == 0); --#endif -- -+void *foo = &($name['k']) - ; - return 0; - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:13267: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:13840: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:13270: \$? = $ac_status" >&5 -+ echo "$as_me:13843: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:13273: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:13846: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:13276: \$? = $ac_status" >&5 -+ echo "$as_me:13849: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- cf_result=yes -+ cf_cv_curses_wacs_map=$name -+ break - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --cf_result=no - fi - rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -- fi -- eval 'cf_cv_func_'$cf_func'=$cf_result' -- -+ done - fi -+echo "$as_me:13860: result: $cf_cv_curses_wacs_map" >&5 -+echo "${ECHO_T}$cf_cv_curses_wacs_map" >&6 - -- # use the computed/retrieved cache-value: -- eval 'cf_result=$cf_cv_func_'$cf_func -- echo "$as_me:13292: result: $cf_result" >&5 --echo "${ECHO_T}$cf_result" >&6 -- if test $cf_result != no; then -- cat >>confdefs.h <<EOF --#define HAVE_${cf_tr_func} 1 -+test "$cf_cv_curses_wacs_map" != unknown && -+cat >>confdefs.h <<EOF -+#define CURSES_WACS_ARRAY $cf_cv_curses_wacs_map - EOF - -- fi --done -- --echo "$as_me:13302: checking for ncurses extended functions" >&5 --echo $ECHO_N "checking for ncurses extended functions... $ECHO_C" >&6 --if test "${cf_cv_ncurses_ext_funcs+set}" = set; then -+echo "$as_me:13868: checking for wide alternate character constants" >&5 -+echo $ECHO_N "checking for wide alternate character constants... $ECHO_C" >&6 -+if test "${cf_cv_curses_wacs_symbols+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - --cat >conftest.$ac_ext <<_ACEOF --#line 13309 "configure" -+cf_cv_curses_wacs_symbols=no -+if test "$cf_cv_curses_wacs_map" != unknown -+then -+ cat >conftest.$ac_ext <<_ACEOF -+#line 13878 "configure" - #include "confdefs.h" - -+#ifndef _XOPEN_SOURCE_EXTENDED -+#define _XOPEN_SOURCE_EXTENDED -+#endif - #include <${cf_cv_ncurses_header:-curses.h}> - int - main () - { -- --int x = NCURSES_EXT_FUNCS -- -+cchar_t *foo = WACS_PLUS; -+ $cf_cv_curses_wacs_map['k'] = *WACS_PLUS - ; - return 0; - } - _ACEOF --rm -f conftest.$ac_objext --if { (eval echo "$as_me:13324: \"$ac_compile\"") >&5 -- (eval $ac_compile) 2>&5 -+rm -f conftest.$ac_objext conftest$ac_exeext -+if { (eval echo "$as_me:13895: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:13327: \$? = $ac_status" >&5 -+ echo "$as_me:13898: \$? = $ac_status" >&5 - (exit $ac_status); } && -- { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:13330: \"$ac_try\"") >&5 -+ { ac_try='test -s conftest$ac_exeext' -+ { (eval echo "$as_me:13901: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:13333: \$? = $ac_status" >&5 -+ echo "$as_me:13904: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- cf_cv_ncurses_ext_funcs=defined -+ cf_cv_curses_wacs_symbols=yes - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 -- --cat >conftest.$ac_ext <<_ACEOF --#line 13341 "configure" -+fi -+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -+else -+ cat >conftest.$ac_ext <<_ACEOF -+#line 13914 "configure" - #include "confdefs.h" - -+#ifndef _XOPEN_SOURCE_EXTENDED -+#define _XOPEN_SOURCE_EXTENDED -+#endif - #include <${cf_cv_ncurses_header:-curses.h}> - int - main () - { -- -- (void) assume_default_colors (0, 0); -- (void) curses_version (); -- (void) define_key (0, 0); -- (void) is_term_resized (0, 0); -- (void) key_defined (0); -- (void) keybound (0, 0); -- (void) keyok (0, 0); -- (void) resize_term (0, 0); -- (void) resizeterm (0, 0); -- (void) use_default_colors (); -- (void) use_extended_names (0); -- (void) wresize (0, 0, 0); -+cchar_t *foo = WACS_PLUS - ; - return 0; - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:13366: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:13930: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:13369: \$? = $ac_status" >&5 -+ echo "$as_me:13933: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:13372: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:13936: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:13375: \$? = $ac_status" >&5 -+ echo "$as_me:13939: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- cf_cv_ncurses_ext_funcs=yes -+ cf_cv_curses_wacs_symbols=yes - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --cf_cv_ncurses_ext_funcs=no - fi - rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -- - fi --rm -f conftest.$ac_objext conftest.$ac_ext - - fi --echo "$as_me:13389: result: $cf_cv_ncurses_ext_funcs" >&5 --echo "${ECHO_T}$cf_cv_ncurses_ext_funcs" >&6 --test "$cf_cv_ncurses_ext_funcs" = yes && cat >>confdefs.h <<\EOF --#define NCURSES_EXT_FUNCS 1 -+echo "$as_me:13950: result: $cf_cv_curses_wacs_symbols" >&5 -+echo "${ECHO_T}$cf_cv_curses_wacs_symbols" >&6 -+ -+test "$cf_cv_curses_wacs_symbols" != no && -+cat >>confdefs.h <<\EOF -+#define CURSES_WACS_SYMBOLS 1 - EOF - --echo "$as_me:13395: checking for wide-character functions" >&5 --echo $ECHO_N "checking for wide-character functions... $ECHO_C" >&6 --if test "${cf_cv_widechar_funcs+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 --else -+fi - -+echo "$as_me:13960: checking for type attr_t in ${cf_cv_ncurses_header:-curses.h}" >&5 -+echo $ECHO_N "checking for type attr_t in ${cf_cv_ncurses_header:-curses.h}... $ECHO_C" >&6 - cat >conftest.$ac_ext <<_ACEOF --#line 13402 "configure" -+#line 13963 "configure" - #include "confdefs.h" - -+#ifndef _XOPEN_SOURCE_EXTENDED -+#define _XOPEN_SOURCE_EXTENDED -+#endif - #include <${cf_cv_ncurses_header:-curses.h}> - int - main () - { - -- static wchar_t src_wchar[2]; -- static cchar_t dst_cchar; -- setcchar(&dst_cchar, src_wchar, A_NORMAL, 0, (void *) 0); -+attr_t foo - - ; - return 0; - } - _ACEOF --rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:13419: \"$ac_link\"") >&5 -- (eval $ac_link) 2>&5 -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:13981: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:13422: \$? = $ac_status" >&5 -+ echo "$as_me:13984: \$? = $ac_status" >&5 - (exit $ac_status); } && -- { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:13425: \"$ac_try\"") >&5 -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:13987: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:13428: \$? = $ac_status" >&5 -+ echo "$as_me:13990: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- cf_cv_widechar_funcs=yes -+ cf_result=yes - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --cf_cv_widechar_funcs=no -+cf_result=no - fi --rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -+rm -f conftest.$ac_objext conftest.$ac_ext -+echo "$as_me:13999: result: $cf_result" >&5 -+echo "${ECHO_T}$cf_result" >&6 -+if test $cf_result = yes ; then - --fi --echo "$as_me:13439: result: $cf_cv_widechar_funcs" >&5 --echo "${ECHO_T}$cf_cv_widechar_funcs" >&6 --if test "$cf_cv_widechar_funcs" != no ; then -- cat >>confdefs.h <<\EOF --#define USE_WIDEC_SUPPORT 1 -+cf_result=`echo "have_type_attr_t" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` -+ -+cat >>confdefs.h <<EOF -+#define $cf_result 1 - EOF - - else -- cat >>confdefs.h <<\EOF --#define USE_WIDEC_SUPPORT 0 -+ -+cat >>confdefs.h <<EOF -+#define attr_t long - EOF - - fi - --# On IRIX 5.3, sys/types and inttypes.h are conflicting. -+if test "$cf_enable_widec" = yes; then - --for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ -- inttypes.h stdint.h unistd.h --do --as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` --echo "$as_me:13459: checking for $ac_header" >&5 --echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 --if eval "test \"\${$as_ac_Header+set}\" = set"; then -+# This is needed on Tru64 5.0 to declare mbstate_t -+echo "$as_me:14020: checking if we must include wchar.h to declare mbstate_t" >&5 -+echo $ECHO_N "checking if we must include wchar.h to declare mbstate_t... $ECHO_C" >&6 -+if test "${cf_cv_mbstate_t+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else -- cat >conftest.$ac_ext <<_ACEOF --#line 13465 "configure" -+ -+cat >conftest.$ac_ext <<_ACEOF -+#line 14027 "configure" - #include "confdefs.h" --$ac_includes_default --#include <$ac_header> -+ -+#include <stdlib.h> -+#include <stdarg.h> -+#include <stdio.h> -+#ifdef HAVE_LIBUTF8_H -+#include <libutf8.h> -+#endif -+int -+main () -+{ -+mbstate_t state -+ ; -+ return 0; -+} - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:13471: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:14045: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:13474: \$? = $ac_status" >&5 -+ echo "$as_me:14048: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:13477: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:14051: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:13480: \$? = $ac_status" >&5 -+ echo "$as_me:14054: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- eval "$as_ac_Header=yes" -+ cf_cv_mbstate_t=no - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --eval "$as_ac_Header=no" --fi --rm -f conftest.$ac_objext conftest.$ac_ext --fi --echo "$as_me:13490: result: `eval echo '${'$as_ac_Header'}'`" >&5 --echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 --if test `eval echo '${'$as_ac_Header'}'` = yes; then -- cat >>confdefs.h <<EOF --#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 --EOF -- --fi --done -- --echo "$as_me:13500: checking for pid_t" >&5 --echo $ECHO_N "checking for pid_t... $ECHO_C" >&6 --if test "${ac_cv_type_pid_t+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 --else -- cat >conftest.$ac_ext <<_ACEOF --#line 13506 "configure" -+cat >conftest.$ac_ext <<_ACEOF -+#line 14061 "configure" - #include "confdefs.h" --$ac_includes_default -+ -+#include <stdlib.h> -+#include <stdarg.h> -+#include <stdio.h> -+#include <wchar.h> -+#ifdef HAVE_LIBUTF8_H -+#include <libutf8.h> -+#endif - int - main () - { --if ((pid_t *) 0) -- return 0; --if (sizeof (pid_t)) -- return 0; -+mbstate_t value - ; - return 0; - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:13521: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:14080: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:13524: \$? = $ac_status" >&5 -+ echo "$as_me:14083: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:13527: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:14086: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:13530: \$? = $ac_status" >&5 -+ echo "$as_me:14089: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- ac_cv_type_pid_t=yes -+ cf_cv_mbstate_t=yes - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --ac_cv_type_pid_t=no -+cf_cv_mbstate_t=unknown - fi - rm -f conftest.$ac_objext conftest.$ac_ext - fi --echo "$as_me:13540: result: $ac_cv_type_pid_t" >&5 --echo "${ECHO_T}$ac_cv_type_pid_t" >&6 --if test $ac_cv_type_pid_t = yes; then -- : --else -+rm -f conftest.$ac_objext conftest.$ac_ext -+fi -+echo "$as_me:14101: result: $cf_cv_mbstate_t" >&5 -+echo "${ECHO_T}$cf_cv_mbstate_t" >&6 - --cat >>confdefs.h <<EOF --#define pid_t int -+if test "$cf_cv_mbstate_t" = yes ; then -+ -+cat >>confdefs.h <<\EOF -+#define NEED_WCHAR_H 1 - EOF - -+ NEED_WCHAR_H=1 - fi - --for ac_header in unistd.h vfork.h --do --as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` --echo "$as_me:13555: checking for $ac_header" >&5 --echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 --if eval "test \"\${$as_ac_Header+set}\" = set"; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 --else -- cat >conftest.$ac_ext <<_ACEOF --#line 13561 "configure" --#include "confdefs.h" --#include <$ac_header> --_ACEOF --if { (eval echo "$as_me:13565: \"$ac_cpp conftest.$ac_ext\"") >&5 -- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 -- ac_status=$? -- egrep -v '^ *\+' conftest.er1 >conftest.err -- rm -f conftest.er1 -- cat conftest.err >&5 -- echo "$as_me:13571: \$? = $ac_status" >&5 -- (exit $ac_status); } >/dev/null; then -- if test -s conftest.err; then -- ac_cpp_err=$ac_c_preproc_warn_flag -- else -- ac_cpp_err= -- fi --else -- ac_cpp_err=yes --fi --if test -z "$ac_cpp_err"; then -- eval "$as_ac_Header=yes" --else -- echo "$as_me: failed program was:" >&5 -- cat conftest.$ac_ext >&5 -- eval "$as_ac_Header=no" --fi --rm -f conftest.err conftest.$ac_ext -+# if we do not find mbstate_t in either place, use substitution to provide a fallback. -+if test "$cf_cv_mbstate_t" = unknown ; then -+ NCURSES_MBSTATE_T=1 - fi --echo "$as_me:13590: result: `eval echo '${'$as_ac_Header'}'`" >&5 --echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 --if test `eval echo '${'$as_ac_Header'}'` = yes; then -- cat >>confdefs.h <<EOF --#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 --EOF - -+# if we find mbstate_t in either place, use substitution to provide a fallback. -+if test "$cf_cv_mbstate_t" != unknown ; then -+ NCURSES_OK_MBSTATE_T=1 - fi --done - --for ac_func in fork vfork --do --as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` --echo "$as_me:13603: checking for $ac_func" >&5 --echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 --if eval "test \"\${$as_ac_var+set}\" = set"; then -+# This is needed on Tru64 5.0 to declare wchar_t -+echo "$as_me:14124: checking if we must include wchar.h to declare wchar_t" >&5 -+echo $ECHO_N "checking if we must include wchar.h to declare wchar_t... $ECHO_C" >&6 -+if test "${cf_cv_wchar_t+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else -- cat >conftest.$ac_ext <<_ACEOF --#line 13609 "configure" -+ -+cat >conftest.$ac_ext <<_ACEOF -+#line 14131 "configure" - #include "confdefs.h" --/* System header to define __stub macros and hopefully few prototypes, -- which can conflict with char $ac_func (); below. */ --#include <assert.h> --/* Override any gcc2 internal prototype to avoid an error. */ --#ifdef __cplusplus --extern "C" --#endif --/* We use char because int might match the return type of a gcc2 -- builtin and then its argument prototype would still apply. */ --char $ac_func (); --char (*f) (); - -+#include <stdlib.h> -+#include <stdarg.h> -+#include <stdio.h> -+#ifdef HAVE_LIBUTF8_H -+#include <libutf8.h> -+#endif - int - main () - { --/* The GNU C library defines this for functions which it implements -- to always fail with ENOSYS. Some functions are actually named -- something starting with __ and the normal name is an alias. */ --#if defined (__stub_$ac_func) || defined (__stub___$ac_func) --choke me --#else --f = $ac_func; --#endif -- -+wchar_t state - ; - return 0; - } - _ACEOF --rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:13640: \"$ac_link\"") >&5 -- (eval $ac_link) 2>&5 -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:14149: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:13643: \$? = $ac_status" >&5 -+ echo "$as_me:14152: \$? = $ac_status" >&5 - (exit $ac_status); } && -- { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:13646: \"$ac_try\"") >&5 -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:14155: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:13649: \$? = $ac_status" >&5 -+ echo "$as_me:14158: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- eval "$as_ac_var=yes" -+ cf_cv_wchar_t=no - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --eval "$as_ac_var=no" --fi --rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext --fi --echo "$as_me:13659: result: `eval echo '${'$as_ac_var'}'`" >&5 --echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 --if test `eval echo '${'$as_ac_var'}'` = yes; then -- cat >>confdefs.h <<EOF --#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 --EOF -- --fi --done -- --ac_cv_func_fork_works=$ac_cv_func_fork --if test "x$ac_cv_func_fork" = xyes; then -- echo "$as_me:13671: checking for working fork" >&5 --echo $ECHO_N "checking for working fork... $ECHO_C" >&6 --if test "${ac_cv_func_fork_works+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 --else -- if test "$cross_compiling" = yes; then -- ac_cv_func_fork_works=cross --else -- cat >conftest.$ac_ext <<_ACEOF --/* By Rüdiger Kuhlmann. */ -- #include <sys/types.h> -- #if HAVE_UNISTD_H -- # include <unistd.h> -- #endif -- /* Some systems only have a dummy stub for fork() */ -- int main () -- { -- if (fork() < 0) -- $ac_main_return (1); -- $ac_main_return (0); -- } --_ACEOF --rm -f conftest$ac_exeext --if { (eval echo "$as_me:13694: \"$ac_link\"") >&5 -- (eval $ac_link) 2>&5 -- ac_status=$? -- echo "$as_me:13697: \$? = $ac_status" >&5 -- (exit $ac_status); } && { ac_try='./conftest$ac_exeext' -- { (eval echo "$as_me:13699: \"$ac_try\"") >&5 -- (eval $ac_try) 2>&5 -- ac_status=$? -- echo "$as_me:13702: \$? = $ac_status" >&5 -- (exit $ac_status); }; }; then -- ac_cv_func_fork_works=yes --else -- echo "$as_me: program exited with status $ac_status" >&5 --echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 --ac_cv_func_fork_works=no --fi --rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext --fi --fi --echo "$as_me:13714: result: $ac_cv_func_fork_works" >&5 --echo "${ECHO_T}$ac_cv_func_fork_works" >&6 -- --fi --if test "x$ac_cv_func_fork_works" = xcross; then -- case $host in -- *-*-amigaos* | *-*-msdosdjgpp*) -- # Override, as these systems have only a dummy fork() stub -- ac_cv_func_fork_works=no -- ;; -- *) -- ac_cv_func_fork_works=yes -- ;; -- esac -- { echo "$as_me:13728: WARNING: CROSS: Result $ac_cv_func_fork_works guessed due to cross-compiling." >&5 --echo "$as_me: WARNING: CROSS: Result $ac_cv_func_fork_works guessed due to cross-compiling." >&2;} --fi --ac_cv_func_vfork_works=$ac_cv_func_vfork --if test "x$ac_cv_func_vfork" = xyes; then -- echo "$as_me:13733: checking for working vfork" >&5 --echo $ECHO_N "checking for working vfork... $ECHO_C" >&6 --if test "${ac_cv_func_vfork_works+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 --else -- if test "$cross_compiling" = yes; then -- ac_cv_func_vfork_works=cross --else -- cat >conftest.$ac_ext <<_ACEOF --#line 13742 "configure" -+cat >conftest.$ac_ext <<_ACEOF -+#line 14165 "configure" - #include "confdefs.h" --/* Thanks to Paul Eggert for this test. */ -+ -+#include <stdlib.h> -+#include <stdarg.h> - #include <stdio.h> --#include <sys/types.h> --#include <sys/stat.h> --#if HAVE_UNISTD_H --# include <unistd.h> --#endif --#if HAVE_VFORK_H --# include <vfork.h> --#endif --/* On some sparc systems, changes by the child to local and incoming -- argument registers are propagated back to the parent. The compiler -- is told about this with #include <vfork.h>, but some compilers -- (e.g. gcc -O) don't grok <vfork.h>. Test for this by using a -- static variable whose address is put into a register that is -- clobbered by the vfork. */ --static --#ifdef __cplusplus --sparc_address_test (int arg) --# else --sparc_address_test (arg) int arg; -+#include <wchar.h> -+#ifdef HAVE_LIBUTF8_H -+#include <libutf8.h> - #endif --{ -- static pid_t child; -- if (!child) { -- child = vfork (); -- if (child < 0) { -- perror ("vfork"); -- _exit(2); -- } -- if (!child) { -- arg = getpid(); -- write(-1, "", 0); -- _exit (arg); -- } -- } --} -- - int - main () - { -- pid_t parent = getpid (); -- pid_t child; -- -- sparc_address_test (); -- -- child = vfork (); -- -- if (child == 0) { -- /* Here is another test for sparc vfork register problems. This -- test uses lots of local variables, at least as many local -- variables as main has allocated so far including compiler -- temporaries. 4 locals are enough for gcc 1.40.3 on a Solaris -- 4.1.3 sparc, but we use 8 to be safe. A buggy compiler should -- reuse the register of parent for one of the local variables, -- since it will think that parent can't possibly be used any more -- in this routine. Assigning to the local variable will thus -- munge parent in the parent process. */ -- pid_t -- p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(), -- p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid(); -- /* Convince the compiler that p..p7 are live; otherwise, it might -- use the same hardware register for all 8 local variables. */ -- if (p != p1 || p != p2 || p != p3 || p != p4 -- || p != p5 || p != p6 || p != p7) -- _exit(1); -- -- /* On some systems (e.g. IRIX 3.3), vfork doesn't separate parent -- from child file descriptors. If the child closes a descriptor -- before it execs or exits, this munges the parent's descriptor -- as well. Test for this by closing stdout in the child. */ -- _exit(close(fileno(stdout)) != 0); -- } else { -- int status; -- struct stat st; -- -- while (wait(&status) != child) -- ; -- $ac_main_return( -- /* Was there some problem with vforking? */ -- child < 0 -- -- /* Did the child fail? (This shouldn't happen.) */ -- || status -- -- /* Did the vfork/compiler bug occur? */ -- || parent != getpid() -- -- /* Did the file descriptor bug occur? */ -- || fstat(fileno(stdout), &st) != 0 -- ); -- } -+wchar_t value -+ ; -+ return 0; - } - _ACEOF --rm -f conftest$ac_exeext --if { (eval echo "$as_me:13839: \"$ac_link\"") >&5 -- (eval $ac_link) 2>&5 -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:14184: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:13842: \$? = $ac_status" >&5 -- (exit $ac_status); } && { ac_try='./conftest$ac_exeext' -- { (eval echo "$as_me:13844: \"$ac_try\"") >&5 -+ echo "$as_me:14187: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:14190: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:13847: \$? = $ac_status" >&5 -+ echo "$as_me:14193: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- ac_cv_func_vfork_works=yes -+ cf_cv_wchar_t=yes - else -- echo "$as_me: program exited with status $ac_status" >&5 --echo "$as_me: failed program was:" >&5 -+ echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --ac_cv_func_vfork_works=no --fi --rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -+cf_cv_wchar_t=unknown - fi -+rm -f conftest.$ac_objext conftest.$ac_ext - fi --echo "$as_me:13859: result: $ac_cv_func_vfork_works" >&5 --echo "${ECHO_T}$ac_cv_func_vfork_works" >&6 -- --fi; --if test "x$ac_cv_func_fork_works" = xcross; then -- ac_cv_func_vfork_works=ac_cv_func_vfork -- { echo "$as_me:13865: WARNING: CROSS: Result $ac_cv_func_vfork_works guessed due to cross-compiling." >&5 --echo "$as_me: WARNING: CROSS: Result $ac_cv_func_vfork_works guessed due to cross-compiling." >&2;} -+rm -f conftest.$ac_objext conftest.$ac_ext - fi -+echo "$as_me:14205: result: $cf_cv_wchar_t" >&5 -+echo "${ECHO_T}$cf_cv_wchar_t" >&6 - --if test "x$ac_cv_func_vfork_works" = xyes; then -- --cat >>confdefs.h <<\EOF --#define HAVE_WORKING_VFORK 1 --EOF -- --else -+if test "$cf_cv_wchar_t" = yes ; then - - cat >>confdefs.h <<\EOF --#define vfork fork -+#define NEED_WCHAR_H 1 - EOF - -+ NEED_WCHAR_H=1 - fi --if test "x$ac_cv_func_fork_works" = xyes; then - --cat >>confdefs.h <<\EOF --#define HAVE_WORKING_FORK 1 --EOF -+# if we do not find wchar_t in either place, use substitution to provide a fallback. -+if test "$cf_cv_wchar_t" = unknown ; then -+ NCURSES_WCHAR_T=1 -+fi - -+# if we find wchar_t in either place, use substitution to provide a fallback. -+if test "$cf_cv_wchar_t" != unknown ; then -+ NCURSES_OK_WCHAR_T=1 - fi - --echo "$as_me:13890: checking if sys/time.h works with sys/select.h" >&5 --echo $ECHO_N "checking if sys/time.h works with sys/select.h... $ECHO_C" >&6 --if test "${cf_cv_sys_time_select+set}" = set; then -+# This is needed on Tru64 5.0 to declare wint_t -+echo "$as_me:14228: checking if we must include wchar.h to declare wint_t" >&5 -+echo $ECHO_N "checking if we must include wchar.h to declare wint_t... $ECHO_C" >&6 -+if test "${cf_cv_wint_t+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - - cat >conftest.$ac_ext <<_ACEOF --#line 13897 "configure" -+#line 14235 "configure" - #include "confdefs.h" - --#include <sys/types.h> --#ifdef HAVE_SYS_TIME_H --#include <sys/time.h> --#endif --#ifdef HAVE_SYS_SELECT_H --#include <sys/select.h> -+#include <stdlib.h> -+#include <stdarg.h> -+#include <stdio.h> -+#ifdef HAVE_LIBUTF8_H -+#include <libutf8.h> - #endif -- - int - main () - { -- -+wint_t state - ; - return 0; - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:13917: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:14253: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:13920: \$? = $ac_status" >&5 -+ echo "$as_me:14256: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:13923: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:14259: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:13926: \$? = $ac_status" >&5 -+ echo "$as_me:14262: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- cf_cv_sys_time_select=yes -+ cf_cv_wint_t=no - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --cf_cv_sys_time_select=no --fi --rm -f conftest.$ac_objext conftest.$ac_ext -- --fi -- --echo "$as_me:13938: result: $cf_cv_sys_time_select" >&5 --echo "${ECHO_T}$cf_cv_sys_time_select" >&6 --test "$cf_cv_sys_time_select" = yes && cat >>confdefs.h <<\EOF --#define HAVE_SYS_TIME_SELECT 1 --EOF -- --echo "$as_me:13944: checking for function curses_version" >&5 --echo $ECHO_N "checking for function curses_version... $ECHO_C" >&6 --if test "${cf_cv_func_curses_version+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 --else -- --if test "$cross_compiling" = yes; then -- cf_cv_func_curses_version=unknown --else -- cat >conftest.$ac_ext <<_ACEOF --#line 13954 "configure" -+cat >conftest.$ac_ext <<_ACEOF -+#line 14269 "configure" - #include "confdefs.h" - --#include <${cf_cv_ncurses_header:-curses.h}> --int main() -+#include <stdlib.h> -+#include <stdarg.h> -+#include <stdio.h> -+#include <wchar.h> -+#ifdef HAVE_LIBUTF8_H -+#include <libutf8.h> -+#endif -+int -+main () - { -- char temp[1024]; -- sprintf(temp, "%s\n", curses_version()); -- ${cf_cv_main_return:-return}(0); -+wint_t value -+ ; -+ return 0; - } -- - _ACEOF --rm -f conftest$ac_exeext --if { (eval echo "$as_me:13967: \"$ac_link\"") >&5 -- (eval $ac_link) 2>&5 -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:14288: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:13970: \$? = $ac_status" >&5 -- (exit $ac_status); } && { ac_try='./conftest$ac_exeext' -- { (eval echo "$as_me:13972: \"$ac_try\"") >&5 -+ echo "$as_me:14291: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:14294: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:13975: \$? = $ac_status" >&5 -+ echo "$as_me:14297: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- cf_cv_func_curses_version=yes -- -+ cf_cv_wint_t=yes - else -- echo "$as_me: program exited with status $ac_status" >&5 --echo "$as_me: failed program was:" >&5 -+ echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --cf_cv_func_curses_version=no -- -+cf_cv_wint_t=unknown - fi --rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -+rm -f conftest.$ac_objext conftest.$ac_ext - fi --rm -f core -+rm -f conftest.$ac_objext conftest.$ac_ext - fi --echo "$as_me:13990: result: $cf_cv_func_curses_version" >&5 --echo "${ECHO_T}$cf_cv_func_curses_version" >&6 --test "$cf_cv_func_curses_version" = yes && cat >>confdefs.h <<\EOF --#define HAVE_CURSES_VERSION 1 -+echo "$as_me:14309: result: $cf_cv_wint_t" >&5 -+echo "${ECHO_T}$cf_cv_wint_t" >&6 -+ -+if test "$cf_cv_wint_t" = yes ; then -+ -+cat >>confdefs.h <<\EOF -+#define NEED_WCHAR_H 1 - EOF - --echo "$as_me:13996: checking for ncurses wrap-prefix" >&5 --echo $ECHO_N "checking for ncurses wrap-prefix... $ECHO_C" >&6 -+ NEED_WCHAR_H=1 -+fi - --# Check whether --with-ncurses-wrap-prefix or --without-ncurses-wrap-prefix was given. --if test "${with_ncurses_wrap_prefix+set}" = set; then -- withval="$with_ncurses_wrap_prefix" -- NCURSES_WRAP_PREFIX=$withval --else -- NCURSES_WRAP_PREFIX=_nc_ --fi; --echo "$as_me:14006: result: $NCURSES_WRAP_PREFIX" >&5 --echo "${ECHO_T}$NCURSES_WRAP_PREFIX" >&6 -+# if we do not find wint_t in either place, use substitution to provide a fallback. -+if test "$cf_cv_wint_t" = unknown ; then -+ NCURSES_WINT_T=1 -+fi - --echo "$as_me:14009: checking for alternate character set array" >&5 --echo $ECHO_N "checking for alternate character set array... $ECHO_C" >&6 --if test "${cf_cv_curses_acs_map+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 --else -+# if we find wint_t in either place, use substitution to provide a fallback. -+if test "$cf_cv_wint_t" != unknown ; then -+ NCURSES_OK_WINT_T=1 -+fi - --cf_cv_curses_acs_map=unknown --for name in acs_map _acs_map __acs_map ${NCURSES_WRAP_PREFIX}acs_map --do -+ if test "$NCURSES_OK_MBSTATE_T" = 0 ; then -+ -+echo "$as_me:14333: checking for type mbstate_t in ${cf_cv_ncurses_header:-curses.h}" >&5 -+echo $ECHO_N "checking for type mbstate_t in ${cf_cv_ncurses_header:-curses.h}... $ECHO_C" >&6 - cat >conftest.$ac_ext <<_ACEOF --#line 14019 "configure" -+#line 14336 "configure" - #include "confdefs.h" - -+#ifndef _XOPEN_SOURCE_EXTENDED -+#define _XOPEN_SOURCE_EXTENDED -+#endif - #include <${cf_cv_ncurses_header:-curses.h}> -- - int - main () - { - --$name['k'] = ACS_PLUS -+mbstate_t foo - - ; - return 0; - } - _ACEOF --rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:14035: \"$ac_link\"") >&5 -- (eval $ac_link) 2>&5 -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:14354: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:14038: \$? = $ac_status" >&5 -+ echo "$as_me:14357: \$? = $ac_status" >&5 - (exit $ac_status); } && -- { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:14041: \"$ac_try\"") >&5 -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:14360: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:14044: \$? = $ac_status" >&5 -+ echo "$as_me:14363: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- cf_cv_curses_acs_map=$name; break -+ cf_result=yes - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 -+cf_result=no - fi --rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext --done -+rm -f conftest.$ac_objext conftest.$ac_ext -+echo "$as_me:14372: result: $cf_result" >&5 -+echo "${ECHO_T}$cf_result" >&6 -+if test $cf_result = yes ; then - --fi --echo "$as_me:14055: result: $cf_cv_curses_acs_map" >&5 --echo "${ECHO_T}$cf_cv_curses_acs_map" >&6 -+cf_result=`echo "have_type_mbstate_t" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` - --test "$cf_cv_curses_acs_map" != unknown && cat >>confdefs.h <<EOF --#define CURSES_ACS_ARRAY $cf_cv_curses_acs_map -+cat >>confdefs.h <<EOF -+#define $cf_result 1 - EOF - --echo "$as_me:14062: checking for wide alternate character set array" >&5 --echo $ECHO_N "checking for wide alternate character set array... $ECHO_C" >&6 --if test "${cf_cv_curses_wacs_map+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 - else - -- cf_cv_curses_wacs_map=unknown -- for name in wacs_map _wacs_map __wacs_map _nc_wacs _wacs_char -- do -- cat >conftest.$ac_ext <<_ACEOF --#line 14072 "configure" -+cat >>confdefs.h <<EOF -+#define mbstate_t long -+EOF -+ -+fi -+ -+ fi -+ -+ if test "$NCURSES_OK_WCHAR_T" = 0 ; then -+ -+echo "$as_me:14394: checking for type wchar_t in ${cf_cv_ncurses_header:-curses.h}" >&5 -+echo $ECHO_N "checking for type wchar_t in ${cf_cv_ncurses_header:-curses.h}... $ECHO_C" >&6 -+cat >conftest.$ac_ext <<_ACEOF -+#line 14397 "configure" - #include "confdefs.h" - - #ifndef _XOPEN_SOURCE_EXTENDED -@@ -14079,86 +14404,58 @@ - int - main () - { --void *foo = &($name['k']) -+ -+wchar_t foo -+ - ; - return 0; - } - _ACEOF --rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:14088: \"$ac_link\"") >&5 -- (eval $ac_link) 2>&5 -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:14415: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:14091: \$? = $ac_status" >&5 -+ echo "$as_me:14418: \$? = $ac_status" >&5 - (exit $ac_status); } && -- { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:14094: \"$ac_try\"") >&5 -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:14421: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:14097: \$? = $ac_status" >&5 -+ echo "$as_me:14424: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- cf_cv_curses_wacs_map=$name -- break -+ cf_result=yes - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 -+cf_result=no - fi --rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -- done --fi --echo "$as_me:14108: result: $cf_cv_curses_wacs_map" >&5 --echo "${ECHO_T}$cf_cv_curses_wacs_map" >&6 -+rm -f conftest.$ac_objext conftest.$ac_ext -+echo "$as_me:14433: result: $cf_result" >&5 -+echo "${ECHO_T}$cf_result" >&6 -+if test $cf_result = yes ; then - --test "$cf_cv_curses_wacs_map" != unknown && cat >>confdefs.h <<EOF --#define CURSES_WACS_ARRAY $cf_cv_curses_wacs_map -+cf_result=`echo "have_type_wchar_t" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` -+ -+cat >>confdefs.h <<EOF -+#define $cf_result 1 - EOF - --echo "$as_me:14115: checking for wide alternate character constants" >&5 --echo $ECHO_N "checking for wide alternate character constants... $ECHO_C" >&6 --if test "${cf_cv_curses_wacs_symbols+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 - else - --cf_cv_curses_wacs_symbols=no --if test "$cf_cv_curses_wacs_map" != unknown --then -- cat >conftest.$ac_ext <<_ACEOF --#line 14125 "configure" --#include "confdefs.h" -+cat >>confdefs.h <<EOF -+#define wchar_t long -+EOF - --#ifndef _XOPEN_SOURCE_EXTENDED --#define _XOPEN_SOURCE_EXTENDED --#endif --#include <${cf_cv_ncurses_header:-curses.h}> --int --main () --{ --cchar_t *foo = WACS_PLUS; -- $cf_cv_curses_wacs_map['k'] = *WACS_PLUS -- ; -- return 0; --} --_ACEOF --rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:14142: \"$ac_link\"") >&5 -- (eval $ac_link) 2>&5 -- ac_status=$? -- echo "$as_me:14145: \$? = $ac_status" >&5 -- (exit $ac_status); } && -- { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:14148: \"$ac_try\"") >&5 -- (eval $ac_try) 2>&5 -- ac_status=$? -- echo "$as_me:14151: \$? = $ac_status" >&5 -- (exit $ac_status); }; }; then -- cf_cv_curses_wacs_symbols=yes --else -- echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 - fi --rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext --else -- cat >conftest.$ac_ext <<_ACEOF --#line 14161 "configure" -+ -+ fi -+ -+ if test "$NCURSES_OK_WINT_T" = 0 ; then -+ -+echo "$as_me:14455: checking for type wint_t in ${cf_cv_ncurses_header:-curses.h}" >&5 -+echo $ECHO_N "checking for type wint_t in ${cf_cv_ncurses_header:-curses.h}... $ECHO_C" >&6 -+cat >conftest.$ac_ext <<_ACEOF -+#line 14458 "configure" - #include "confdefs.h" - - #ifndef _XOPEN_SOURCE_EXTENDED -@@ -14168,70 +14465,95 @@ - int - main () - { --cchar_t *foo = WACS_PLUS -+ -+wint_t foo -+ - ; - return 0; - } - _ACEOF --rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:14177: \"$ac_link\"") >&5 -- (eval $ac_link) 2>&5 -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:14476: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:14180: \$? = $ac_status" >&5 -+ echo "$as_me:14479: \$? = $ac_status" >&5 - (exit $ac_status); } && -- { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:14183: \"$ac_try\"") >&5 -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:14482: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:14186: \$? = $ac_status" >&5 -+ echo "$as_me:14485: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- cf_cv_curses_wacs_symbols=yes -+ cf_result=yes - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 -+cf_result=no - fi --rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -+rm -f conftest.$ac_objext conftest.$ac_ext -+echo "$as_me:14494: result: $cf_result" >&5 -+echo "${ECHO_T}$cf_result" >&6 -+if test $cf_result = yes ; then -+ -+cf_result=`echo "have_type_wint_t" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` -+ -+cat >>confdefs.h <<EOF -+#define $cf_result 1 -+EOF -+ -+else -+ -+cat >>confdefs.h <<EOF -+#define wint_t long -+EOF -+ - fi - -+ fi - fi --echo "$as_me:14197: result: $cf_cv_curses_wacs_symbols" >&5 --echo "${ECHO_T}$cf_cv_curses_wacs_symbols" >&6 - --test "$cf_cv_curses_wacs_symbols" != no && cat >>confdefs.h <<\EOF --#define CURSES_WACS_SYMBOLS 1 --EOF -+echo "$as_me:14515: checking for data boolnames declaration in ${cf_cv_ncurses_header:-curses.h}" >&5 -+echo $ECHO_N "checking for data boolnames declaration in ${cf_cv_ncurses_header:-curses.h}... $ECHO_C" >&6 - --echo "$as_me:14204: checking for type attr_t in ${cf_cv_ncurses_header:-curses.h}" >&5 --echo $ECHO_N "checking for type attr_t in ${cf_cv_ncurses_header:-curses.h}... $ECHO_C" >&6 - cat >conftest.$ac_ext <<_ACEOF --#line 14207 "configure" -+#line 14519 "configure" - #include "confdefs.h" - --#ifndef _XOPEN_SOURCE_EXTENDED --#define _XOPEN_SOURCE_EXTENDED --#endif -+#ifdef HAVE_XCURSES -+#include <xcurses.h> -+char * XCursesProgramName = "test"; -+#else - #include <${cf_cv_ncurses_header:-curses.h}> -+#if defined(NCURSES_VERSION) && defined(HAVE_NCURSESW_TERM_H) -+#include <ncursesw/term.h> -+#elif defined(NCURSES_VERSION) && defined(HAVE_NCURSES_TERM_H) -+#include <ncurses/term.h> -+#elif defined(HAVE_TERM_H) -+#include <term.h> -+#endif -+#endif -+ - int - main () - { - --attr_t foo -+void *foo = &(boolnames) - - ; - return 0; - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:14225: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:14547: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:14228: \$? = $ac_status" >&5 -+ echo "$as_me:14550: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:14231: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:14553: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:14234: \$? = $ac_status" >&5 -+ echo "$as_me:14556: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_result=yes - else -@@ -14240,868 +14562,1577 @@ - cf_result=no - fi - rm -f conftest.$ac_objext conftest.$ac_ext --echo "$as_me:14243: result: $cf_result" >&5 -+echo "$as_me:14565: result: $cf_result" >&5 - echo "${ECHO_T}$cf_result" >&6 -+ - if test $cf_result = yes ; then - --cf_result=`echo "have_type_attr_t" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` -+cf_result=`echo "have_curses_data_boolnames" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` - - cat >>confdefs.h <<EOF - #define $cf_result 1 - EOF - - else -- cat >>confdefs.h <<EOF --#define attr_t long --EOF -- --fi -- --# This is needed on Tru64 5.0 to declare mbstate_t --echo "$as_me:14261: checking if we must include wchar.h to declare mbstate_t" >&5 --echo $ECHO_N "checking if we must include wchar.h to declare mbstate_t... $ECHO_C" >&6 --if test "${cf_cv_mbstate_t+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 --else -+ echo "$as_me:14577: checking for data boolnames in library" >&5 -+echo $ECHO_N "checking for data boolnames in library... $ECHO_C" >&6 -+ # BSD linkers insist on making weak linkage, but resolve at runtime. -+ if test "$cross_compiling" = yes; then - --cat >conftest.$ac_ext <<_ACEOF --#line 14268 "configure" -+ # cross-compiling -+ cat >conftest.$ac_ext <<_ACEOF -+#line 14584 "configure" - #include "confdefs.h" - --#include <stdlib.h> --#include <stdarg.h> --#include <stdio.h> --#ifdef HAVE_LIBUTF8_H --#include <libutf8.h> -+#ifdef HAVE_XCURSES -+#include <xcurses.h> -+char * XCursesProgramName = "test"; -+#else -+#include <${cf_cv_ncurses_header:-curses.h}> -+#if defined(NCURSES_VERSION) && defined(HAVE_NCURSESW_TERM_H) -+#include <ncursesw/term.h> -+#elif defined(NCURSES_VERSION) && defined(HAVE_NCURSES_TERM_H) -+#include <ncurses/term.h> -+#elif defined(HAVE_TERM_H) -+#include <term.h> - #endif -+#endif -+ -+extern char boolnames; - int - main () - { --mbstate_t state -+ -+ do { -+ void *foo = &(boolnames); -+ ${cf_cv_main_return:-return}(foo == 0); -+ } while (0) -+ - ; - return 0; - } - _ACEOF --rm -f conftest.$ac_objext --if { (eval echo "$as_me:14286: \"$ac_compile\"") >&5 -- (eval $ac_compile) 2>&5 -+rm -f conftest.$ac_objext conftest$ac_exeext -+if { (eval echo "$as_me:14616: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:14289: \$? = $ac_status" >&5 -+ echo "$as_me:14619: \$? = $ac_status" >&5 - (exit $ac_status); } && -- { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:14292: \"$ac_try\"") >&5 -+ { ac_try='test -s conftest$ac_exeext' -+ { (eval echo "$as_me:14622: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:14295: \$? = $ac_status" >&5 -+ echo "$as_me:14625: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- cf_cv_mbstate_t=no -+ cf_result=yes - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 -+cf_result=no -+fi -+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -+ -+else -+ cat >conftest.$ac_ext <<_ACEOF -+#line 14637 "configure" -+#include "confdefs.h" -+ -+#ifdef HAVE_XCURSES -+#include <xcurses.h> -+char * XCursesProgramName = "test"; -+#else -+#include <${cf_cv_ncurses_header:-curses.h}> -+#if defined(NCURSES_VERSION) && defined(HAVE_NCURSESW_TERM_H) -+#include <ncursesw/term.h> -+#elif defined(NCURSES_VERSION) && defined(HAVE_NCURSES_TERM_H) -+#include <ncurses/term.h> -+#elif defined(HAVE_TERM_H) -+#include <term.h> -+#endif -+#endif -+ -+extern char boolnames; -+int main(void) -+{ -+ void *foo = &(boolnames); -+ ${cf_cv_main_return:-return}(foo == 0); -+} -+_ACEOF -+rm -f conftest$ac_exeext -+if { (eval echo "$as_me:14662: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>&5 -+ ac_status=$? -+ echo "$as_me:14665: \$? = $ac_status" >&5 -+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext' -+ { (eval echo "$as_me:14667: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:14670: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ cf_result=yes -+else -+ echo "$as_me: program exited with status $ac_status" >&5 -+echo "$as_me: failed program was:" >&5 -+cat conftest.$ac_ext >&5 -+cf_result=no -+fi -+rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -+fi -+ echo "$as_me:14681: result: $cf_result" >&5 -+echo "${ECHO_T}$cf_result" >&6 -+ if test $cf_result = yes ; then -+ -+cf_result=`echo "decl_curses_data_boolnames" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` -+ -+ cat >>confdefs.h <<EOF -+#define $cf_result 1 -+EOF -+ -+ fi -+fi -+ -+echo "$as_me:14694: checking for data boolfnames declaration in ${cf_cv_ncurses_header:-curses.h}" >&5 -+echo $ECHO_N "checking for data boolfnames declaration in ${cf_cv_ncurses_header:-curses.h}... $ECHO_C" >&6 -+ - cat >conftest.$ac_ext <<_ACEOF --#line 14302 "configure" -+#line 14698 "configure" - #include "confdefs.h" - --#include <stdlib.h> --#include <stdarg.h> --#include <stdio.h> --#include <wchar.h> --#ifdef HAVE_LIBUTF8_H --#include <libutf8.h> -+#ifdef HAVE_XCURSES -+#include <xcurses.h> -+char * XCursesProgramName = "test"; -+#else -+#include <${cf_cv_ncurses_header:-curses.h}> -+#if defined(NCURSES_VERSION) && defined(HAVE_NCURSESW_TERM_H) -+#include <ncursesw/term.h> -+#elif defined(NCURSES_VERSION) && defined(HAVE_NCURSES_TERM_H) -+#include <ncurses/term.h> -+#elif defined(HAVE_TERM_H) -+#include <term.h> - #endif -+#endif -+ - int - main () - { --mbstate_t value -+ -+void *foo = &(boolfnames) -+ - ; - return 0; - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:14321: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:14726: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:14324: \$? = $ac_status" >&5 -+ echo "$as_me:14729: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:14327: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:14732: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:14330: \$? = $ac_status" >&5 -+ echo "$as_me:14735: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- cf_cv_mbstate_t=yes -+ cf_result=yes - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --cf_cv_mbstate_t=unknown --fi --rm -f conftest.$ac_objext conftest.$ac_ext -+cf_result=no - fi - rm -f conftest.$ac_objext conftest.$ac_ext --fi --echo "$as_me:14342: result: $cf_cv_mbstate_t" >&5 --echo "${ECHO_T}$cf_cv_mbstate_t" >&6 -- --if test "$cf_cv_mbstate_t" = yes ; then -- cat >>confdefs.h <<\EOF --#define NEED_WCHAR_H 1 --EOF -+echo "$as_me:14744: result: $cf_result" >&5 -+echo "${ECHO_T}$cf_result" >&6 - -- NEED_WCHAR_H=1 --fi -+if test $cf_result = yes ; then - --# if we do not find mbstate_t in either place, use substitution to provide a fallback. --if test "$cf_cv_mbstate_t" = unknown ; then -- NCURSES_MBSTATE_T=1 --fi -+cf_result=`echo "have_curses_data_boolfnames" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` - --# if we find mbstate_t in either place, use substitution to provide a fallback. --if test "$cf_cv_mbstate_t" != unknown ; then -- NCURSES_OK_MBSTATE_T=1 --fi -+ cat >>confdefs.h <<EOF -+#define $cf_result 1 -+EOF - --# This is needed on Tru64 5.0 to declare wchar_t --echo "$as_me:14364: checking if we must include wchar.h to declare wchar_t" >&5 --echo $ECHO_N "checking if we must include wchar.h to declare wchar_t... $ECHO_C" >&6 --if test "${cf_cv_wchar_t+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 - else -+ echo "$as_me:14756: checking for data boolfnames in library" >&5 -+echo $ECHO_N "checking for data boolfnames in library... $ECHO_C" >&6 -+ # BSD linkers insist on making weak linkage, but resolve at runtime. -+ if test "$cross_compiling" = yes; then - --cat >conftest.$ac_ext <<_ACEOF --#line 14371 "configure" -+ # cross-compiling -+ cat >conftest.$ac_ext <<_ACEOF -+#line 14763 "configure" - #include "confdefs.h" - --#include <stdlib.h> --#include <stdarg.h> --#include <stdio.h> --#ifdef HAVE_LIBUTF8_H --#include <libutf8.h> -+#ifdef HAVE_XCURSES -+#include <xcurses.h> -+char * XCursesProgramName = "test"; -+#else -+#include <${cf_cv_ncurses_header:-curses.h}> -+#if defined(NCURSES_VERSION) && defined(HAVE_NCURSESW_TERM_H) -+#include <ncursesw/term.h> -+#elif defined(NCURSES_VERSION) && defined(HAVE_NCURSES_TERM_H) -+#include <ncurses/term.h> -+#elif defined(HAVE_TERM_H) -+#include <term.h> -+#endif - #endif -+ -+extern char boolfnames; - int - main () - { --wchar_t state -+ -+ do { -+ void *foo = &(boolfnames); -+ ${cf_cv_main_return:-return}(foo == 0); -+ } while (0) -+ - ; - return 0; - } - _ACEOF --rm -f conftest.$ac_objext --if { (eval echo "$as_me:14389: \"$ac_compile\"") >&5 -- (eval $ac_compile) 2>&5 -+rm -f conftest.$ac_objext conftest$ac_exeext -+if { (eval echo "$as_me:14795: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:14392: \$? = $ac_status" >&5 -+ echo "$as_me:14798: \$? = $ac_status" >&5 - (exit $ac_status); } && -- { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:14395: \"$ac_try\"") >&5 -+ { ac_try='test -s conftest$ac_exeext' -+ { (eval echo "$as_me:14801: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:14398: \$? = $ac_status" >&5 -+ echo "$as_me:14804: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- cf_cv_wchar_t=no -+ cf_result=yes - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --cat >conftest.$ac_ext <<_ACEOF --#line 14405 "configure" -+cf_result=no -+fi -+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -+ -+else -+ cat >conftest.$ac_ext <<_ACEOF -+#line 14816 "configure" - #include "confdefs.h" - --#include <stdlib.h> --#include <stdarg.h> --#include <stdio.h> --#include <wchar.h> --#ifdef HAVE_LIBUTF8_H --#include <libutf8.h> -+#ifdef HAVE_XCURSES -+#include <xcurses.h> -+char * XCursesProgramName = "test"; -+#else -+#include <${cf_cv_ncurses_header:-curses.h}> -+#if defined(NCURSES_VERSION) && defined(HAVE_NCURSESW_TERM_H) -+#include <ncursesw/term.h> -+#elif defined(NCURSES_VERSION) && defined(HAVE_NCURSES_TERM_H) -+#include <ncurses/term.h> -+#elif defined(HAVE_TERM_H) -+#include <term.h> - #endif --int --main () -+#endif -+ -+extern char boolfnames; -+int main(void) - { --wchar_t value -- ; -- return 0; -+ void *foo = &(boolfnames); -+ ${cf_cv_main_return:-return}(foo == 0); - } - _ACEOF --rm -f conftest.$ac_objext --if { (eval echo "$as_me:14424: \"$ac_compile\"") >&5 -- (eval $ac_compile) 2>&5 -+rm -f conftest$ac_exeext -+if { (eval echo "$as_me:14841: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:14427: \$? = $ac_status" >&5 -- (exit $ac_status); } && -- { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:14430: \"$ac_try\"") >&5 -+ echo "$as_me:14844: \$? = $ac_status" >&5 -+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext' -+ { (eval echo "$as_me:14846: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:14433: \$? = $ac_status" >&5 -+ echo "$as_me:14849: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- cf_cv_wchar_t=yes -+ cf_result=yes - else -- echo "$as_me: failed program was:" >&5 -+ echo "$as_me: program exited with status $ac_status" >&5 -+echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --cf_cv_wchar_t=unknown --fi --rm -f conftest.$ac_objext conftest.$ac_ext -+cf_result=no - fi --rm -f conftest.$ac_objext conftest.$ac_ext -+rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext - fi --echo "$as_me:14445: result: $cf_cv_wchar_t" >&5 --echo "${ECHO_T}$cf_cv_wchar_t" >&6 -+ echo "$as_me:14860: result: $cf_result" >&5 -+echo "${ECHO_T}$cf_result" >&6 -+ if test $cf_result = yes ; then - --if test "$cf_cv_wchar_t" = yes ; then -- cat >>confdefs.h <<\EOF --#define NEED_WCHAR_H 1 -+cf_result=`echo "decl_curses_data_boolfnames" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` -+ -+ cat >>confdefs.h <<EOF -+#define $cf_result 1 - EOF - -- NEED_WCHAR_H=1 -+ fi - fi - --# if we do not find wchar_t in either place, use substitution to provide a fallback. --if test "$cf_cv_wchar_t" = unknown ; then -- NCURSES_WCHAR_T=1 --fi -+if ( test "$GCC" = yes || test "$GXX" = yes ) -+then -+echo "$as_me:14875: checking if you want to turn on gcc warnings" >&5 -+echo $ECHO_N "checking if you want to turn on gcc warnings... $ECHO_C" >&6 - --# if we find wchar_t in either place, use substitution to provide a fallback. --if test "$cf_cv_wchar_t" != unknown ; then -- NCURSES_OK_WCHAR_T=1 --fi -+# Check whether --enable-warnings or --disable-warnings was given. -+if test "${enable_warnings+set}" = set; then -+ enableval="$enable_warnings" -+ test "$enableval" != yes && enableval=no -+ if test "$enableval" != "no" ; then -+ with_warnings=yes -+ else -+ with_warnings=no -+ fi -+else -+ enableval=no -+ with_warnings=no - --# This is needed on Tru64 5.0 to declare wint_t --echo "$as_me:14467: checking if we must include wchar.h to declare wint_t" >&5 --echo $ECHO_N "checking if we must include wchar.h to declare wint_t... $ECHO_C" >&6 --if test "${cf_cv_wint_t+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 -+fi; -+echo "$as_me:14892: result: $with_warnings" >&5 -+echo "${ECHO_T}$with_warnings" >&6 -+if test "$with_warnings" = "yes" -+then -+ -+if test "$GCC" = yes -+then -+cat > conftest.i <<EOF -+#ifndef GCC_PRINTF -+#define GCC_PRINTF 0 -+#endif -+#ifndef GCC_SCANF -+#define GCC_SCANF 0 -+#endif -+#ifndef GCC_NORETURN -+#define GCC_NORETURN /* nothing */ -+#endif -+#ifndef GCC_UNUSED -+#define GCC_UNUSED /* nothing */ -+#endif -+EOF -+if test "$GCC" = yes -+then -+ { echo "$as_me:14915: checking for $CC __attribute__ directives..." >&5 -+echo "$as_me: checking for $CC __attribute__ directives..." >&6;} -+cat > conftest.$ac_ext <<EOF -+#line 14918 "${as_me:-configure}" -+#include "confdefs.h" -+#include "conftest.h" -+#include "conftest.i" -+#if GCC_PRINTF -+#define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var))) -+#else -+#define GCC_PRINTFLIKE(fmt,var) /*nothing*/ -+#endif -+#if GCC_SCANF -+#define GCC_SCANFLIKE(fmt,var) __attribute__((format(scanf,fmt,var))) -+#else -+#define GCC_SCANFLIKE(fmt,var) /*nothing*/ -+#endif -+extern void wow(char *,...) GCC_SCANFLIKE(1,2); -+extern void oops(char *,...) GCC_PRINTFLIKE(1,2) GCC_NORETURN; -+extern void foo(void) GCC_NORETURN; -+int main(int argc GCC_UNUSED, char *argv[] GCC_UNUSED) { return 0; } -+EOF -+ cf_printf_attribute=no -+ cf_scanf_attribute=no -+ for cf_attribute in scanf printf unused noreturn -+ do -+ -+cf_ATTRIBUTE=`echo "$cf_attribute" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` -+ -+ cf_directive="__attribute__(($cf_attribute))" -+ echo "checking for $CC $cf_directive" 1>&5 -+ -+ case $cf_attribute in #(vi -+ printf) #(vi -+ cf_printf_attribute=yes -+ cat >conftest.h <<EOF -+#define GCC_$cf_ATTRIBUTE 1 -+EOF -+ ;; -+ scanf) #(vi -+ cf_scanf_attribute=yes -+ cat >conftest.h <<EOF -+#define GCC_$cf_ATTRIBUTE 1 -+EOF -+ ;; -+ *) #(vi -+ cat >conftest.h <<EOF -+#define GCC_$cf_ATTRIBUTE $cf_directive -+EOF -+ ;; -+ esac -+ -+ if { (eval echo "$as_me:14967: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>&5 -+ ac_status=$? -+ echo "$as_me:14970: \$? = $ac_status" >&5 -+ (exit $ac_status); }; then -+ test -n "$verbose" && echo "$as_me:14972: result: ... $cf_attribute" >&5 -+echo "${ECHO_T}... $cf_attribute" >&6 -+ cat conftest.h >>confdefs.h -+ case $cf_attribute in #(vi -+ noreturn) #(vi -+ -+cat >>confdefs.h <<EOF -+#define GCC_NORETURN $cf_directive -+EOF -+ -+ ;; -+ printf) #(vi -+ cf_value='/* nothing */' -+ if test "$cf_printf_attribute" != no ; then -+ cf_value='__attribute__((format(printf,fmt,var)))' -+ -+cat >>confdefs.h <<\EOF -+#define GCC_PRINTF 1 -+EOF -+ -+ fi -+ -+cat >>confdefs.h <<EOF -+#define GCC_PRINTFLIKE(fmt,var) $cf_value -+EOF -+ -+ ;; -+ scanf) #(vi -+ cf_value='/* nothing */' -+ if test "$cf_scanf_attribute" != no ; then -+ cf_value='__attribute__((format(scanf,fmt,var)))' -+ -+cat >>confdefs.h <<\EOF -+#define GCC_SCANF 1 -+EOF -+ -+ fi -+ -+cat >>confdefs.h <<EOF -+#define GCC_SCANFLIKE(fmt,var) $cf_value -+EOF -+ -+ ;; -+ unused) #(vi -+ -+cat >>confdefs.h <<EOF -+#define GCC_UNUSED $cf_directive -+EOF -+ -+ ;; -+ esac -+ fi -+ done - else -+ fgrep define conftest.i >>confdefs.h -+fi -+rm -rf conftest* -+fi - --cat >conftest.$ac_ext <<_ACEOF --#line 14474 "configure" -+INTEL_COMPILER=no -+ -+if test "$GCC" = yes ; then -+ case $host_os in -+ linux*|gnu*) -+ echo "$as_me:15036: checking if this is really Intel C compiler" >&5 -+echo $ECHO_N "checking if this is really Intel C compiler... $ECHO_C" >&6 -+ cf_save_CFLAGS="$CFLAGS" -+ CFLAGS="$CFLAGS -no-gcc" -+ cat >conftest.$ac_ext <<_ACEOF -+#line 15041 "configure" - #include "confdefs.h" - --#include <stdlib.h> --#include <stdarg.h> --#include <stdio.h> --#ifdef HAVE_LIBUTF8_H --#include <libutf8.h> --#endif - int - main () - { --wint_t state -+ -+#ifdef __INTEL_COMPILER -+#else -+make an error -+#endif -+ - ; - return 0; - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:14492: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:15058: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:14495: \$? = $ac_status" >&5 -+ echo "$as_me:15061: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:14498: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:15064: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:14501: \$? = $ac_status" >&5 -+ echo "$as_me:15067: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- cf_cv_wint_t=no -+ INTEL_COMPILER=yes -+cf_save_CFLAGS="$cf_save_CFLAGS -we147 -no-gcc" -+ - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --cat >conftest.$ac_ext <<_ACEOF --#line 14508 "configure" -+fi -+rm -f conftest.$ac_objext conftest.$ac_ext -+ CFLAGS="$cf_save_CFLAGS" -+ echo "$as_me:15078: result: $INTEL_COMPILER" >&5 -+echo "${ECHO_T}$INTEL_COMPILER" >&6 -+ ;; -+ esac -+fi -+ -+CLANG_COMPILER=no -+ -+if test "$GCC" = yes ; then -+ echo "$as_me:15087: checking if this is really Clang C compiler" >&5 -+echo $ECHO_N "checking if this is really Clang C compiler... $ECHO_C" >&6 -+ cf_save_CFLAGS="$CFLAGS" -+ CFLAGS="$CFLAGS -Qunused-arguments" -+ cat >conftest.$ac_ext <<_ACEOF -+#line 15092 "configure" - #include "confdefs.h" - --#include <stdlib.h> --#include <stdarg.h> --#include <stdio.h> --#include <wchar.h> --#ifdef HAVE_LIBUTF8_H --#include <libutf8.h> --#endif - int - main () - { --wint_t value -+ -+#ifdef __clang__ -+#else -+make an error -+#endif -+ - ; - return 0; - } - _ACEOF - rm -f conftest.$ac_objext --if { (eval echo "$as_me:14527: \"$ac_compile\"") >&5 -+if { (eval echo "$as_me:15109: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:14530: \$? = $ac_status" >&5 -+ echo "$as_me:15112: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:14533: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:15115: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:14536: \$? = $ac_status" >&5 -+ echo "$as_me:15118: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- cf_cv_wint_t=yes -+ CLANG_COMPILER=yes -+cf_save_CFLAGS="$cf_save_CFLAGS -Qunused-arguments" -+ - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --cf_cv_wint_t=unknown - fi - rm -f conftest.$ac_objext conftest.$ac_ext -+ CFLAGS="$cf_save_CFLAGS" -+ echo "$as_me:15129: result: $CLANG_COMPILER" >&5 -+echo "${ECHO_T}$CLANG_COMPILER" >&6 - fi --rm -f conftest.$ac_objext conftest.$ac_ext -+ -+cat > conftest.$ac_ext <<EOF -+#line 15134 "${as_me:-configure}" -+int main(int argc, char *argv[]) { return (argv[argc-1] == 0) ; } -+EOF -+ -+if test "$INTEL_COMPILER" = yes -+then -+# The "-wdXXX" options suppress warnings: -+# remark #1419: external declaration in primary source file -+# remark #1683: explicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem) -+# remark #1684: conversion from pointer to same-sized integral type (potential portability problem) -+# remark #193: zero used for undefined preprocessing identifier -+# remark #593: variable "curs_sb_left_arrow" was set but never used -+# remark #810: conversion from "int" to "Dimension={unsigned short}" may lose significant bits -+# remark #869: parameter "tw" was never referenced -+# remark #981: operands are evaluated in unspecified order -+# warning #279: controlling expression is constant -+ -+ { echo "$as_me:15151: checking for $CC warning options..." >&5 -+echo "$as_me: checking for $CC warning options..." >&6;} -+ cf_save_CFLAGS="$CFLAGS" -+ EXTRA_CFLAGS="-Wall" -+ for cf_opt in \ -+ wd1419 \ -+ wd1683 \ -+ wd1684 \ -+ wd193 \ -+ wd593 \ -+ wd279 \ -+ wd810 \ -+ wd869 \ -+ wd981 -+ do -+ CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt" -+ if { (eval echo "$as_me:15167: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>&5 -+ ac_status=$? -+ echo "$as_me:15170: \$? = $ac_status" >&5 -+ (exit $ac_status); }; then -+ test -n "$verbose" && echo "$as_me:15172: result: ... -$cf_opt" >&5 -+echo "${ECHO_T}... -$cf_opt" >&6 -+ EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt" -+ fi -+ done -+ CFLAGS="$cf_save_CFLAGS" -+ -+elif test "$GCC" = yes -+then -+ { echo "$as_me:15181: checking for $CC warning options..." >&5 -+echo "$as_me: checking for $CC warning options..." >&6;} -+ cf_save_CFLAGS="$CFLAGS" -+ EXTRA_CFLAGS= -+ cf_warn_CONST="" -+ test "$with_ext_const" = yes && cf_warn_CONST="Wwrite-strings" -+ cf_gcc_warnings="Wignored-qualifiers Wlogical-op Wvarargs" -+ test "x$CLANG_COMPILER" = xyes && cf_gcc_warnings= -+ for cf_opt in W Wall \ -+ Wbad-function-cast \ -+ Wcast-align \ -+ Wcast-qual \ -+ Wdeclaration-after-statement \ -+ Wextra \ -+ Winline \ -+ Wmissing-declarations \ -+ Wmissing-prototypes \ -+ Wnested-externs \ -+ Wpointer-arith \ -+ Wshadow \ -+ Wstrict-prototypes \ -+ Wundef $cf_gcc_warnings $cf_warn_CONST -+ do -+ CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt" -+ if { (eval echo "$as_me:15205: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>&5 -+ ac_status=$? -+ echo "$as_me:15208: \$? = $ac_status" >&5 -+ (exit $ac_status); }; then -+ test -n "$verbose" && echo "$as_me:15210: result: ... -$cf_opt" >&5 -+echo "${ECHO_T}... -$cf_opt" >&6 -+ case $cf_opt in #(vi -+ Wcast-qual) #(vi -+ CPPFLAGS="$CPPFLAGS -DXTSTRINGDEFINES" -+ ;; -+ Winline) #(vi -+ case $GCC_VERSION in -+ [34].*) -+ test -n "$verbose" && echo " feature is broken in gcc $GCC_VERSION" 1>&6 -+ -+echo "${as_me:-configure}:15221: testing feature is broken in gcc $GCC_VERSION ..." 1>&5 -+ -+ continue;; -+ esac -+ ;; -+ Wpointer-arith) #(vi -+ case $GCC_VERSION in -+ [12].*) -+ test -n "$verbose" && echo " feature is broken in gcc $GCC_VERSION" 1>&6 -+ -+echo "${as_me:-configure}:15231: testing feature is broken in gcc $GCC_VERSION ..." 1>&5 -+ -+ continue;; -+ esac -+ ;; -+ esac -+ EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt" -+ fi -+ done -+ CFLAGS="$cf_save_CFLAGS" - fi --echo "$as_me:14548: result: $cf_cv_wint_t" >&5 --echo "${ECHO_T}$cf_cv_wint_t" >&6 -+rm -rf conftest* - --if test "$cf_cv_wint_t" = yes ; then -- cat >>confdefs.h <<\EOF --#define NEED_WCHAR_H 1 -+fi -+fi -+ -+echo "$as_me:15247: checking if you want to use dmalloc for testing" >&5 -+echo $ECHO_N "checking if you want to use dmalloc for testing... $ECHO_C" >&6 -+ -+# Check whether --with-dmalloc or --without-dmalloc was given. -+if test "${with_dmalloc+set}" = set; then -+ withval="$with_dmalloc" -+ -+cat >>confdefs.h <<EOF -+#define USE_DMALLOC 1 - EOF - -- NEED_WCHAR_H=1 -+ : ${with_cflags:=-g} -+ : ${with_no_leaks:=yes} -+ with_dmalloc=yes -+else -+ with_dmalloc= -+fi; -+echo "$as_me:15264: result: ${with_dmalloc:-no}" >&5 -+echo "${ECHO_T}${with_dmalloc:-no}" >&6 -+ -+case .$with_cflags in #(vi -+.*-g*) -+ case .$CFLAGS in #(vi -+ .*-g*) #(vi -+ ;; -+ *) -+ -+cf_fix_cppflags=no -+cf_new_cflags= -+cf_new_cppflags= -+cf_new_extra_cppflags= -+ -+for cf_add_cflags in -g -+do -+case $cf_fix_cppflags in -+no) -+ case $cf_add_cflags in #(vi -+ -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi -+ case $cf_add_cflags in -+ -D*) -+ cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` -+ -+ test "${cf_add_cflags}" != "${cf_tst_cflags}" \ -+ && test -z "${cf_tst_cflags}" \ -+ && cf_fix_cppflags=yes -+ -+ if test $cf_fix_cppflags = yes ; then -+ cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -+ continue -+ elif test "${cf_tst_cflags}" = "\"'" ; then -+ cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -+ continue -+ fi -+ ;; -+ esac -+ case "$CPPFLAGS" in -+ *$cf_add_cflags) #(vi -+ ;; -+ *) #(vi -+ case $cf_add_cflags in #(vi -+ -D*) -+ cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` -+ -+CPPFLAGS=`echo "$CPPFLAGS" | \ -+ sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ -+ -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` -+ -+ ;; -+ esac -+ cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" -+ ;; -+ esac -+ ;; -+ *) -+ cf_new_cflags="$cf_new_cflags $cf_add_cflags" -+ ;; -+ esac -+ ;; -+yes) -+ cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -+ -+ cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` -+ -+ test "${cf_add_cflags}" != "${cf_tst_cflags}" \ -+ && test -z "${cf_tst_cflags}" \ -+ && cf_fix_cppflags=no -+ ;; -+esac -+done -+ -+if test -n "$cf_new_cflags" ; then -+ -+ CFLAGS="$CFLAGS $cf_new_cflags" - fi - --# if we do not find wint_t in either place, use substitution to provide a fallback. --if test "$cf_cv_wint_t" = unknown ; then -- NCURSES_WINT_T=1 -+if test -n "$cf_new_cppflags" ; then -+ -+ CPPFLAGS="$CPPFLAGS $cf_new_cppflags" -+fi -+ -+if test -n "$cf_new_extra_cppflags" ; then -+ -+ EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" -+fi -+ -+ ;; -+ esac -+ ;; -+esac -+ -+if test "$with_dmalloc" = yes ; then -+ echo "$as_me:15358: checking for dmalloc.h" >&5 -+echo $ECHO_N "checking for dmalloc.h... $ECHO_C" >&6 -+if test "${ac_cv_header_dmalloc_h+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ cat >conftest.$ac_ext <<_ACEOF -+#line 15364 "configure" -+#include "confdefs.h" -+#include <dmalloc.h> -+_ACEOF -+if { (eval echo "$as_me:15368: \"$ac_cpp conftest.$ac_ext\"") >&5 -+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 -+ ac_status=$? -+ egrep -v '^ *\+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 -+ echo "$as_me:15374: \$? = $ac_status" >&5 -+ (exit $ac_status); } >/dev/null; then -+ if test -s conftest.err; then -+ ac_cpp_err=$ac_c_preproc_warn_flag -+ else -+ ac_cpp_err= -+ fi -+else -+ ac_cpp_err=yes -+fi -+if test -z "$ac_cpp_err"; then -+ ac_cv_header_dmalloc_h=yes -+else -+ echo "$as_me: failed program was:" >&5 -+ cat conftest.$ac_ext >&5 -+ ac_cv_header_dmalloc_h=no - fi -- --# if we find wint_t in either place, use substitution to provide a fallback. --if test "$cf_cv_wint_t" != unknown ; then -- NCURSES_OK_WINT_T=1 -+rm -f conftest.err conftest.$ac_ext - fi -+echo "$as_me:15393: result: $ac_cv_header_dmalloc_h" >&5 -+echo "${ECHO_T}$ac_cv_header_dmalloc_h" >&6 -+if test $ac_cv_header_dmalloc_h = yes; then - --if test "$NCURSES_OK_MBSTATE_T" = 0 ; then -- --echo "$as_me:14571: checking for type mbstate_t in ${cf_cv_ncurses_header:-curses.h}" >&5 --echo $ECHO_N "checking for type mbstate_t in ${cf_cv_ncurses_header:-curses.h}... $ECHO_C" >&6 -+echo "$as_me:15397: checking for dmalloc_debug in -ldmalloc" >&5 -+echo $ECHO_N "checking for dmalloc_debug in -ldmalloc... $ECHO_C" >&6 -+if test "${ac_cv_lib_dmalloc_dmalloc_debug+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ ac_check_lib_save_LIBS=$LIBS -+LIBS="-ldmalloc $LIBS" - cat >conftest.$ac_ext <<_ACEOF --#line 14574 "configure" -+#line 15405 "configure" - #include "confdefs.h" - --#ifndef _XOPEN_SOURCE_EXTENDED --#define _XOPEN_SOURCE_EXTENDED -+/* Override any gcc2 internal prototype to avoid an error. */ -+#ifdef __cplusplus -+extern "C" - #endif --#include <${cf_cv_ncurses_header:-curses.h}> -+/* We use char because int might match the return type of a gcc2 -+ builtin and then its argument prototype would still apply. */ -+char dmalloc_debug (); - int - main () - { -- --mbstate_t foo -- -+dmalloc_debug (); - ; - return 0; - } - _ACEOF --rm -f conftest.$ac_objext --if { (eval echo "$as_me:14592: \"$ac_compile\"") >&5 -- (eval $ac_compile) 2>&5 -+rm -f conftest.$ac_objext conftest$ac_exeext -+if { (eval echo "$as_me:15424: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:14595: \$? = $ac_status" >&5 -+ echo "$as_me:15427: \$? = $ac_status" >&5 - (exit $ac_status); } && -- { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:14598: \"$ac_try\"") >&5 -+ { ac_try='test -s conftest$ac_exeext' -+ { (eval echo "$as_me:15430: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:14601: \$? = $ac_status" >&5 -+ echo "$as_me:15433: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- cf_result=yes -+ ac_cv_lib_dmalloc_dmalloc_debug=yes - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --cf_result=no -+ac_cv_lib_dmalloc_dmalloc_debug=no - fi --rm -f conftest.$ac_objext conftest.$ac_ext --echo "$as_me:14610: result: $cf_result" >&5 --echo "${ECHO_T}$cf_result" >&6 --if test $cf_result = yes ; then -- --cf_result=`echo "have_type_mbstate_t" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` -- -- cat >>confdefs.h <<EOF --#define $cf_result 1 -+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -+LIBS=$ac_check_lib_save_LIBS -+fi -+echo "$as_me:15444: result: $ac_cv_lib_dmalloc_dmalloc_debug" >&5 -+echo "${ECHO_T}$ac_cv_lib_dmalloc_dmalloc_debug" >&6 -+if test $ac_cv_lib_dmalloc_dmalloc_debug = yes; then -+ cat >>confdefs.h <<EOF -+#define HAVE_LIBDMALLOC 1 - EOF - --else -- cat >>confdefs.h <<EOF --#define mbstate_t long --EOF -+ LIBS="-ldmalloc $LIBS" - - fi - - fi - --if test "$NCURSES_OK_WCHAR_T" = 0 ; then -+fi - --echo "$as_me:14631: checking for type wchar_t in ${cf_cv_ncurses_header:-curses.h}" >&5 --echo $ECHO_N "checking for type wchar_t in ${cf_cv_ncurses_header:-curses.h}... $ECHO_C" >&6 --cat >conftest.$ac_ext <<_ACEOF --#line 14634 "configure" --#include "confdefs.h" -+echo "$as_me:15459: checking if you want to use dbmalloc for testing" >&5 -+echo $ECHO_N "checking if you want to use dbmalloc for testing... $ECHO_C" >&6 - --#ifndef _XOPEN_SOURCE_EXTENDED --#define _XOPEN_SOURCE_EXTENDED --#endif --#include <${cf_cv_ncurses_header:-curses.h}> --int --main () --{ -+# Check whether --with-dbmalloc or --without-dbmalloc was given. -+if test "${with_dbmalloc+set}" = set; then -+ withval="$with_dbmalloc" - --wchar_t foo -+cat >>confdefs.h <<EOF -+#define USE_DBMALLOC 1 -+EOF - -- ; -- return 0; --} --_ACEOF --rm -f conftest.$ac_objext --if { (eval echo "$as_me:14652: \"$ac_compile\"") >&5 -- (eval $ac_compile) 2>&5 -- ac_status=$? -- echo "$as_me:14655: \$? = $ac_status" >&5 -- (exit $ac_status); } && -- { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:14658: \"$ac_try\"") >&5 -- (eval $ac_try) 2>&5 -- ac_status=$? -- echo "$as_me:14661: \$? = $ac_status" >&5 -- (exit $ac_status); }; }; then -- cf_result=yes -+ : ${with_cflags:=-g} -+ : ${with_no_leaks:=yes} -+ with_dbmalloc=yes - else -- echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 --cf_result=no --fi --rm -f conftest.$ac_objext conftest.$ac_ext --echo "$as_me:14670: result: $cf_result" >&5 --echo "${ECHO_T}$cf_result" >&6 --if test $cf_result = yes ; then -+ with_dbmalloc= -+fi; -+echo "$as_me:15476: result: ${with_dbmalloc:-no}" >&5 -+echo "${ECHO_T}${with_dbmalloc:-no}" >&6 - --cf_result=`echo "have_type_wchar_t" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` -+case .$with_cflags in #(vi -+.*-g*) -+ case .$CFLAGS in #(vi -+ .*-g*) #(vi -+ ;; -+ *) - -- cat >>confdefs.h <<EOF --#define $cf_result 1 --EOF -+cf_fix_cppflags=no -+cf_new_cflags= -+cf_new_cppflags= -+cf_new_extra_cppflags= - --else -- cat >>confdefs.h <<EOF --#define wchar_t long --EOF -+for cf_add_cflags in -g -+do -+case $cf_fix_cppflags in -+no) -+ case $cf_add_cflags in #(vi -+ -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi -+ case $cf_add_cflags in -+ -D*) -+ cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` - --fi -+ test "${cf_add_cflags}" != "${cf_tst_cflags}" \ -+ && test -z "${cf_tst_cflags}" \ -+ && cf_fix_cppflags=yes - --fi -+ if test $cf_fix_cppflags = yes ; then -+ cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -+ continue -+ elif test "${cf_tst_cflags}" = "\"'" ; then -+ cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -+ continue -+ fi -+ ;; -+ esac -+ case "$CPPFLAGS" in -+ *$cf_add_cflags) #(vi -+ ;; -+ *) #(vi -+ case $cf_add_cflags in #(vi -+ -D*) -+ cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` - --if test "$NCURSES_OK_WINT_T" = 0 ; then -+CPPFLAGS=`echo "$CPPFLAGS" | \ -+ sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ -+ -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` - --echo "$as_me:14691: checking for type wint_t in ${cf_cv_ncurses_header:-curses.h}" >&5 --echo $ECHO_N "checking for type wint_t in ${cf_cv_ncurses_header:-curses.h}... $ECHO_C" >&6 --cat >conftest.$ac_ext <<_ACEOF --#line 14694 "configure" --#include "confdefs.h" -+ ;; -+ esac -+ cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" -+ ;; -+ esac -+ ;; -+ *) -+ cf_new_cflags="$cf_new_cflags $cf_add_cflags" -+ ;; -+ esac -+ ;; -+yes) -+ cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" - --#ifndef _XOPEN_SOURCE_EXTENDED --#define _XOPEN_SOURCE_EXTENDED --#endif --#include <${cf_cv_ncurses_header:-curses.h}> --int --main () --{ -+ cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` - --wint_t foo -+ test "${cf_add_cflags}" != "${cf_tst_cflags}" \ -+ && test -z "${cf_tst_cflags}" \ -+ && cf_fix_cppflags=no -+ ;; -+esac -+done - -- ; -- return 0; --} --_ACEOF --rm -f conftest.$ac_objext --if { (eval echo "$as_me:14712: \"$ac_compile\"") >&5 -- (eval $ac_compile) 2>&5 -- ac_status=$? -- echo "$as_me:14715: \$? = $ac_status" >&5 -- (exit $ac_status); } && -- { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:14718: \"$ac_try\"") >&5 -- (eval $ac_try) 2>&5 -- ac_status=$? -- echo "$as_me:14721: \$? = $ac_status" >&5 -- (exit $ac_status); }; }; then -- cf_result=yes --else -- echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 --cf_result=no -+if test -n "$cf_new_cflags" ; then -+ -+ CFLAGS="$CFLAGS $cf_new_cflags" - fi --rm -f conftest.$ac_objext conftest.$ac_ext --echo "$as_me:14730: result: $cf_result" >&5 --echo "${ECHO_T}$cf_result" >&6 --if test $cf_result = yes ; then - --cf_result=`echo "have_type_wint_t" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` -+if test -n "$cf_new_cppflags" ; then - -- cat >>confdefs.h <<EOF --#define $cf_result 1 --EOF -+ CPPFLAGS="$CPPFLAGS $cf_new_cppflags" -+fi - --else -- cat >>confdefs.h <<EOF --#define wint_t long --EOF -+if test -n "$cf_new_extra_cppflags" ; then -+ -+ EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" -+fi -+ -+ ;; -+ esac -+ ;; -+esac - -+if test "$with_dbmalloc" = yes ; then -+ echo "$as_me:15570: checking for dbmalloc.h" >&5 -+echo $ECHO_N "checking for dbmalloc.h... $ECHO_C" >&6 -+if test "${ac_cv_header_dbmalloc_h+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ cat >conftest.$ac_ext <<_ACEOF -+#line 15576 "configure" -+#include "confdefs.h" -+#include <dbmalloc.h> -+_ACEOF -+if { (eval echo "$as_me:15580: \"$ac_cpp conftest.$ac_ext\"") >&5 -+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 -+ ac_status=$? -+ egrep -v '^ *\+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 -+ echo "$as_me:15586: \$? = $ac_status" >&5 -+ (exit $ac_status); } >/dev/null; then -+ if test -s conftest.err; then -+ ac_cpp_err=$ac_c_preproc_warn_flag -+ else -+ ac_cpp_err= -+ fi -+else -+ ac_cpp_err=yes -+fi -+if test -z "$ac_cpp_err"; then -+ ac_cv_header_dbmalloc_h=yes -+else -+ echo "$as_me: failed program was:" >&5 -+ cat conftest.$ac_ext >&5 -+ ac_cv_header_dbmalloc_h=no - fi -- -+rm -f conftest.err conftest.$ac_ext - fi -+echo "$as_me:15605: result: $ac_cv_header_dbmalloc_h" >&5 -+echo "${ECHO_T}$ac_cv_header_dbmalloc_h" >&6 -+if test $ac_cv_header_dbmalloc_h = yes; then - --echo "$as_me:14749: checking for data boolnames declaration in ${cf_cv_ncurses_header:-curses.h}" >&5 --echo $ECHO_N "checking for data boolnames declaration in ${cf_cv_ncurses_header:-curses.h}... $ECHO_C" >&6 -- -+echo "$as_me:15609: checking for debug_malloc in -ldbmalloc" >&5 -+echo $ECHO_N "checking for debug_malloc in -ldbmalloc... $ECHO_C" >&6 -+if test "${ac_cv_lib_dbmalloc_debug_malloc+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ ac_check_lib_save_LIBS=$LIBS -+LIBS="-ldbmalloc $LIBS" - cat >conftest.$ac_ext <<_ACEOF --#line 14753 "configure" -+#line 15617 "configure" - #include "confdefs.h" - --#ifdef HAVE_XCURSES --#include <xcurses.h> --char * XCursesProgramName = "test"; --#else --#include <${cf_cv_ncurses_header:-curses.h}> --#if defined(NCURSES_VERSION) && defined(HAVE_NCURSESW_TERM_H) --#include <ncursesw/term.h> --#elif defined(NCURSES_VERSION) && defined(HAVE_NCURSES_TERM_H) --#include <ncurses/term.h> --#elif defined(HAVE_TERM_H) --#include <term.h> --#endif -+/* Override any gcc2 internal prototype to avoid an error. */ -+#ifdef __cplusplus -+extern "C" - #endif -- -+/* We use char because int might match the return type of a gcc2 -+ builtin and then its argument prototype would still apply. */ -+char debug_malloc (); - int - main () - { -- --void *foo = &(boolnames) -- -+debug_malloc (); - ; - return 0; - } - _ACEOF --rm -f conftest.$ac_objext --if { (eval echo "$as_me:14781: \"$ac_compile\"") >&5 -- (eval $ac_compile) 2>&5 -+rm -f conftest.$ac_objext conftest$ac_exeext -+if { (eval echo "$as_me:15636: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:14784: \$? = $ac_status" >&5 -+ echo "$as_me:15639: \$? = $ac_status" >&5 - (exit $ac_status); } && -- { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:14787: \"$ac_try\"") >&5 -+ { ac_try='test -s conftest$ac_exeext' -+ { (eval echo "$as_me:15642: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:14790: \$? = $ac_status" >&5 -+ echo "$as_me:15645: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- cf_result=yes -+ ac_cv_lib_dbmalloc_debug_malloc=yes - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --cf_result=no -+ac_cv_lib_dbmalloc_debug_malloc=no - fi --rm -f conftest.$ac_objext conftest.$ac_ext --echo "$as_me:14799: result: $cf_result" >&5 --echo "${ECHO_T}$cf_result" >&6 -+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -+LIBS=$ac_check_lib_save_LIBS -+fi -+echo "$as_me:15656: result: $ac_cv_lib_dbmalloc_debug_malloc" >&5 -+echo "${ECHO_T}$ac_cv_lib_dbmalloc_debug_malloc" >&6 -+if test $ac_cv_lib_dbmalloc_debug_malloc = yes; then -+ cat >>confdefs.h <<EOF -+#define HAVE_LIBDBMALLOC 1 -+EOF - --if test $cf_result = yes ; then -+ LIBS="-ldbmalloc $LIBS" - --cf_result=`echo "have_curses_data_boolnames" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` -+fi - -- cat >>confdefs.h <<EOF --#define $cf_result 1 -+fi -+ -+fi -+ -+echo "$as_me:15671: checking if you want to use valgrind for testing" >&5 -+echo $ECHO_N "checking if you want to use valgrind for testing... $ECHO_C" >&6 -+ -+# Check whether --with-valgrind or --without-valgrind was given. -+if test "${with_valgrind+set}" = set; then -+ withval="$with_valgrind" -+ -+cat >>confdefs.h <<EOF -+#define USE_VALGRIND 1 - EOF - -+ : ${with_cflags:=-g} -+ : ${with_no_leaks:=yes} -+ with_valgrind=yes - else -- echo "$as_me:14811: checking for data boolnames in library" >&5 --echo $ECHO_N "checking for data boolnames in library... $ECHO_C" >&6 -- # BSD linkers insist on making weak linkage, but resolve at runtime. -- if test "$cross_compiling" = yes; then -+ with_valgrind= -+fi; -+echo "$as_me:15688: result: ${with_valgrind:-no}" >&5 -+echo "${ECHO_T}${with_valgrind:-no}" >&6 - -- # cross-compiling -- cat >conftest.$ac_ext <<_ACEOF --#line 14818 "configure" --#include "confdefs.h" -+case .$with_cflags in #(vi -+.*-g*) -+ case .$CFLAGS in #(vi -+ .*-g*) #(vi -+ ;; -+ *) - --#ifdef HAVE_XCURSES --#include <xcurses.h> --char * XCursesProgramName = "test"; --#else --#include <${cf_cv_ncurses_header:-curses.h}> --#if defined(NCURSES_VERSION) && defined(HAVE_NCURSESW_TERM_H) --#include <ncursesw/term.h> --#elif defined(NCURSES_VERSION) && defined(HAVE_NCURSES_TERM_H) --#include <ncurses/term.h> --#elif defined(HAVE_TERM_H) --#include <term.h> --#endif --#endif -+cf_fix_cppflags=no -+cf_new_cflags= -+cf_new_cppflags= -+cf_new_extra_cppflags= - --extern char boolnames; --int --main () --{ -+for cf_add_cflags in -g -+do -+case $cf_fix_cppflags in -+no) -+ case $cf_add_cflags in #(vi -+ -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi -+ case $cf_add_cflags in -+ -D*) -+ cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` - -- do { -- void *foo = &(boolnames); -- ${cf_cv_main_return:-return}(foo == 0); -- } while (0) -+ test "${cf_add_cflags}" != "${cf_tst_cflags}" \ -+ && test -z "${cf_tst_cflags}" \ -+ && cf_fix_cppflags=yes - -- ; -- return 0; --} --_ACEOF --rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:14850: \"$ac_link\"") >&5 -- (eval $ac_link) 2>&5 -- ac_status=$? -- echo "$as_me:14853: \$? = $ac_status" >&5 -- (exit $ac_status); } && -- { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:14856: \"$ac_try\"") >&5 -- (eval $ac_try) 2>&5 -- ac_status=$? -- echo "$as_me:14859: \$? = $ac_status" >&5 -- (exit $ac_status); }; }; then -- cf_result=yes --else -- echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 --cf_result=no --fi --rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -+ if test $cf_fix_cppflags = yes ; then -+ cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -+ continue -+ elif test "${cf_tst_cflags}" = "\"'" ; then -+ cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" -+ continue -+ fi -+ ;; -+ esac -+ case "$CPPFLAGS" in -+ *$cf_add_cflags) #(vi -+ ;; -+ *) #(vi -+ case $cf_add_cflags in #(vi -+ -D*) -+ cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` - --else -- cat >conftest.$ac_ext <<_ACEOF --#line 14871 "configure" --#include "confdefs.h" -+CPPFLAGS=`echo "$CPPFLAGS" | \ -+ sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ -+ -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` - --#ifdef HAVE_XCURSES --#include <xcurses.h> --char * XCursesProgramName = "test"; --#else --#include <${cf_cv_ncurses_header:-curses.h}> --#if defined(NCURSES_VERSION) && defined(HAVE_NCURSESW_TERM_H) --#include <ncursesw/term.h> --#elif defined(NCURSES_VERSION) && defined(HAVE_NCURSES_TERM_H) --#include <ncurses/term.h> --#elif defined(HAVE_TERM_H) --#include <term.h> --#endif --#endif -+ ;; -+ esac -+ cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" -+ ;; -+ esac -+ ;; -+ *) -+ cf_new_cflags="$cf_new_cflags $cf_add_cflags" -+ ;; -+ esac -+ ;; -+yes) -+ cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" - --extern char boolnames; --int main(void) --{ -- void *foo = &(boolnames); -- ${cf_cv_main_return:-return}(foo == 0); --} --_ACEOF --rm -f conftest$ac_exeext --if { (eval echo "$as_me:14896: \"$ac_link\"") >&5 -- (eval $ac_link) 2>&5 -- ac_status=$? -- echo "$as_me:14899: \$? = $ac_status" >&5 -- (exit $ac_status); } && { ac_try='./conftest$ac_exeext' -- { (eval echo "$as_me:14901: \"$ac_try\"") >&5 -- (eval $ac_try) 2>&5 -- ac_status=$? -- echo "$as_me:14904: \$? = $ac_status" >&5 -- (exit $ac_status); }; }; then -- cf_result=yes --else -- echo "$as_me: program exited with status $ac_status" >&5 --echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 --cf_result=no -+ cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` -+ -+ test "${cf_add_cflags}" != "${cf_tst_cflags}" \ -+ && test -z "${cf_tst_cflags}" \ -+ && cf_fix_cppflags=no -+ ;; -+esac -+done -+ -+if test -n "$cf_new_cflags" ; then -+ -+ CFLAGS="$CFLAGS $cf_new_cflags" - fi --rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -+ -+if test -n "$cf_new_cppflags" ; then -+ -+ CPPFLAGS="$CPPFLAGS $cf_new_cppflags" - fi -- echo "$as_me:14915: result: $cf_result" >&5 --echo "${ECHO_T}$cf_result" >&6 -- if test $cf_result = yes ; then - --cf_result=`echo "decl_curses_data_boolnames" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` -+if test -n "$cf_new_extra_cppflags" ; then -+ -+ EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" -+fi -+ -+ ;; -+ esac -+ ;; -+esac -+ -+echo "$as_me:15781: checking if you want to perform memory-leak testing" >&5 -+echo $ECHO_N "checking if you want to perform memory-leak testing... $ECHO_C" >&6 -+ -+# Check whether --enable-leaks or --disable-leaks was given. -+if test "${enable_leaks+set}" = set; then -+ enableval="$enable_leaks" -+ if test "x$enableval" = xno; then with_no_leaks=yes; else with_no_leaks=no; fi -+else -+ : ${with_no_leaks:=no} -+fi; -+echo "$as_me:15791: result: $with_no_leaks" >&5 -+echo "${ECHO_T}$with_no_leaks" >&6 -+ -+if test "$with_no_leaks" = yes ; then - -- cat >>confdefs.h <<EOF --#define $cf_result 1 -+cat >>confdefs.h <<\EOF -+#define NO_LEAKS 1 -+EOF -+ -+cat >>confdefs.h <<\EOF -+#define YY_NO_LEAKS 1 - EOF - -- fi - fi - --echo "$as_me:14928: checking for data boolfnames declaration in ${cf_cv_ncurses_header:-curses.h}" >&5 --echo $ECHO_N "checking for data boolfnames declaration in ${cf_cv_ncurses_header:-curses.h}... $ECHO_C" >&6 -+LD_RPATH_OPT= -+echo "$as_me:15807: checking for an rpath option" >&5 -+echo $ECHO_N "checking for an rpath option... $ECHO_C" >&6 -+case $cf_cv_system_name in #(vi -+irix*) #(vi -+ if test "$GCC" = yes; then -+ LD_RPATH_OPT="-Wl,-rpath," -+ else -+ LD_RPATH_OPT="-rpath " -+ fi -+ ;; -+linux*|gnu*|k*bsd*-gnu) #(vi -+ LD_RPATH_OPT="-Wl,-rpath," -+ ;; -+openbsd[2-9].*|mirbsd*) #(vi -+ LD_RPATH_OPT="-Wl,-rpath," -+ ;; -+dragonfly*|freebsd*) #(vi -+ LD_RPATH_OPT="-rpath " -+ ;; -+netbsd*) #(vi -+ LD_RPATH_OPT="-Wl,-rpath," -+ ;; -+osf*|mls+*) #(vi -+ LD_RPATH_OPT="-rpath " -+ ;; -+solaris2*) #(vi -+ LD_RPATH_OPT="-R" -+ ;; -+*) -+ ;; -+esac -+echo "$as_me:15838: result: $LD_RPATH_OPT" >&5 -+echo "${ECHO_T}$LD_RPATH_OPT" >&6 - --cat >conftest.$ac_ext <<_ACEOF --#line 14932 "configure" -+case "x$LD_RPATH_OPT" in #(vi -+x-R*) -+ echo "$as_me:15843: checking if we need a space after rpath option" >&5 -+echo $ECHO_N "checking if we need a space after rpath option... $ECHO_C" >&6 -+ cf_save_LIBS="$LIBS" -+ LIBS="${LD_RPATH_OPT}$libdir $LIBS" -+ cat >conftest.$ac_ext <<_ACEOF -+#line 15848 "configure" - #include "confdefs.h" - --#ifdef HAVE_XCURSES --#include <xcurses.h> --char * XCursesProgramName = "test"; --#else --#include <${cf_cv_ncurses_header:-curses.h}> --#if defined(NCURSES_VERSION) && defined(HAVE_NCURSESW_TERM_H) --#include <ncursesw/term.h> --#elif defined(NCURSES_VERSION) && defined(HAVE_NCURSES_TERM_H) --#include <ncurses/term.h> --#elif defined(HAVE_TERM_H) --#include <term.h> --#endif --#endif -- - int - main () - { - --void *foo = &(boolfnames) -- - ; - return 0; - } - _ACEOF --rm -f conftest.$ac_objext --if { (eval echo "$as_me:14960: \"$ac_compile\"") >&5 -- (eval $ac_compile) 2>&5 -+rm -f conftest.$ac_objext conftest$ac_exeext -+if { (eval echo "$as_me:15860: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:14963: \$? = $ac_status" >&5 -+ echo "$as_me:15863: \$? = $ac_status" >&5 - (exit $ac_status); } && -- { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:14966: \"$ac_try\"") >&5 -+ { ac_try='test -s conftest$ac_exeext' -+ { (eval echo "$as_me:15866: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:14969: \$? = $ac_status" >&5 -+ echo "$as_me:15869: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- cf_result=yes -+ cf_rpath_space=no - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --cf_result=no -+cf_rpath_space=yes - fi --rm -f conftest.$ac_objext conftest.$ac_ext --echo "$as_me:14978: result: $cf_result" >&5 --echo "${ECHO_T}$cf_result" >&6 -+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -+ LIBS="$cf_save_LIBS" -+ echo "$as_me:15879: result: $cf_rpath_space" >&5 -+echo "${ECHO_T}$cf_rpath_space" >&6 -+ test "$cf_rpath_space" = yes && LD_RPATH_OPT="$LD_RPATH_OPT " -+ ;; -+esac - --if test $cf_result = yes ; then -+echo "$as_me:15885: checking if rpath-hack should be disabled" >&5 -+echo $ECHO_N "checking if rpath-hack should be disabled... $ECHO_C" >&6 - --cf_result=`echo "have_curses_data_boolfnames" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` -+# Check whether --enable-rpath-hack or --disable-rpath-hack was given. -+if test "${enable_rpath_hack+set}" = set; then -+ enableval="$enable_rpath_hack" -+ test "$enableval" != no && enableval=yes -+ if test "$enableval" != "yes" ; then -+ cf_disable_rpath_hack=yes -+ else -+ cf_disable_rpath_hack=no -+ fi -+else -+ enableval=yes -+ cf_disable_rpath_hack=no - -- cat >>confdefs.h <<EOF --#define $cf_result 1 --EOF -+fi; -+echo "$as_me:15902: result: $cf_disable_rpath_hack" >&5 -+echo "${ECHO_T}$cf_disable_rpath_hack" >&6 -+if test "$cf_disable_rpath_hack" = no ; then -+ -+echo "$as_me:15906: checking for updated LDFLAGS" >&5 -+echo $ECHO_N "checking for updated LDFLAGS... $ECHO_C" >&6 -+if test -n "$LD_RPATH_OPT" ; then -+ echo "$as_me:15909: result: maybe" >&5 -+echo "${ECHO_T}maybe" >&6 - -+ for ac_prog in ldd -+do -+ # Extract the first word of "$ac_prog", so it can be a program name with args. -+set dummy $ac_prog; ac_word=$2 -+echo "$as_me:15916: checking for $ac_word" >&5 -+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -+if test "${ac_cv_prog_cf_ldd_prog+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 - else -- echo "$as_me:14990: checking for data boolfnames in library" >&5 --echo $ECHO_N "checking for data boolfnames in library... $ECHO_C" >&6 -- # BSD linkers insist on making weak linkage, but resolve at runtime. -- if test "$cross_compiling" = yes; then -+ if test -n "$cf_ldd_prog"; then -+ ac_cv_prog_cf_ldd_prog="$cf_ldd_prog" # Let the user override the test. -+else -+ ac_save_IFS=$IFS; IFS=$ac_path_separator -+ac_dummy="$PATH" -+for ac_dir in $ac_dummy; do -+ IFS=$ac_save_IFS -+ test -z "$ac_dir" && ac_dir=. -+ $as_executable_p "$ac_dir/$ac_word" || continue -+ac_cv_prog_cf_ldd_prog="$ac_prog" -+echo "$as_me:15931: found $ac_dir/$ac_word" >&5 -+break -+done - -- # cross-compiling -- cat >conftest.$ac_ext <<_ACEOF --#line 14997 "configure" --#include "confdefs.h" -+fi -+fi -+cf_ldd_prog=$ac_cv_prog_cf_ldd_prog -+if test -n "$cf_ldd_prog"; then -+ echo "$as_me:15939: result: $cf_ldd_prog" >&5 -+echo "${ECHO_T}$cf_ldd_prog" >&6 -+else -+ echo "$as_me:15942: result: no" >&5 -+echo "${ECHO_T}no" >&6 -+fi - --#ifdef HAVE_XCURSES --#include <xcurses.h> --char * XCursesProgramName = "test"; --#else --#include <${cf_cv_ncurses_header:-curses.h}> --#if defined(NCURSES_VERSION) && defined(HAVE_NCURSESW_TERM_H) --#include <ncursesw/term.h> --#elif defined(NCURSES_VERSION) && defined(HAVE_NCURSES_TERM_H) --#include <ncurses/term.h> --#elif defined(HAVE_TERM_H) --#include <term.h> --#endif --#endif -+ test -n "$cf_ldd_prog" && break -+done -+test -n "$cf_ldd_prog" || cf_ldd_prog="no" - --extern char boolfnames; -+ cf_rpath_list="/usr/lib /lib" -+ if test "$cf_ldd_prog" != no -+ then -+ cf_rpath_oops= -+ -+cat >conftest.$ac_ext <<_ACEOF -+#line 15956 "configure" -+#include "confdefs.h" -+#include <stdio.h> - int - main () - { -- -- do { -- void *foo = &(boolfnames); -- ${cf_cv_main_return:-return}(foo == 0); -- } while (0) -- -+printf("Hello"); - ; - return 0; - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:15029: \"$ac_link\"") >&5 -+if { (eval echo "$as_me:15968: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? -- echo "$as_me:15032: \$? = $ac_status" >&5 -+ echo "$as_me:15971: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:15035: \"$ac_try\"") >&5 -+ { (eval echo "$as_me:15974: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -- echo "$as_me:15038: \$? = $ac_status" >&5 -+ echo "$as_me:15977: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- cf_result=yes -+ cf_rpath_oops=`$cf_ldd_prog conftest$ac_exeext | fgrep ' not found' | sed -e 's% =>.*$%%' |sort | uniq` -+ cf_rpath_list=`$cf_ldd_prog conftest$ac_exeext | fgrep / | sed -e 's%^.*[ ]/%/%' -e 's%/[^/][^/]*$%%' |sort | uniq` - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 --cf_result=no - fi - rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - --else -- cat >conftest.$ac_ext <<_ACEOF --#line 15050 "configure" --#include "confdefs.h" -+ # If we passed the link-test, but get a "not found" on a given library, -+ # this could be due to inept reconfiguration of gcc to make it only -+ # partly honor /usr/local/lib (or whatever). Sometimes this behavior -+ # is intentional, e.g., installing gcc in /usr/bin and suppressing the -+ # /usr/local libraries. -+ if test -n "$cf_rpath_oops" -+ then -+ for cf_rpath_src in $cf_rpath_oops -+ do -+ for cf_rpath_dir in \ -+ /usr/local \ -+ /usr/pkg \ -+ /opt/sfw -+ do -+ if test -f $cf_rpath_dir/lib/$cf_rpath_src -+ then -+ test -n "$verbose" && echo " ...adding -L$cf_rpath_dir/lib to LDFLAGS for $cf_rpath_src" 1>&6 -+ -+echo "${as_me:-configure}:16005: testing ...adding -L$cf_rpath_dir/lib to LDFLAGS for $cf_rpath_src ..." 1>&5 -+ -+ LDFLAGS="$LDFLAGS -L$cf_rpath_dir/lib" -+ break -+ fi -+ done -+ done -+ fi -+ fi - --#ifdef HAVE_XCURSES --#include <xcurses.h> --char * XCursesProgramName = "test"; --#else --#include <${cf_cv_ncurses_header:-curses.h}> --#if defined(NCURSES_VERSION) && defined(HAVE_NCURSESW_TERM_H) --#include <ncursesw/term.h> --#elif defined(NCURSES_VERSION) && defined(HAVE_NCURSES_TERM_H) --#include <ncurses/term.h> --#elif defined(HAVE_TERM_H) --#include <term.h> --#endif --#endif -+ test -n "$verbose" && echo " ...checking EXTRA_LDFLAGS $EXTRA_LDFLAGS" 1>&6 - --extern char boolfnames; --int main(void) --{ -- void *foo = &(boolfnames); -- ${cf_cv_main_return:-return}(foo == 0); --} --_ACEOF --rm -f conftest$ac_exeext --if { (eval echo "$as_me:15075: \"$ac_link\"") >&5 -- (eval $ac_link) 2>&5 -- ac_status=$? -- echo "$as_me:15078: \$? = $ac_status" >&5 -- (exit $ac_status); } && { ac_try='./conftest$ac_exeext' -- { (eval echo "$as_me:15080: \"$ac_try\"") >&5 -- (eval $ac_try) 2>&5 -- ac_status=$? -- echo "$as_me:15083: \$? = $ac_status" >&5 -- (exit $ac_status); }; }; then -- cf_result=yes --else -- echo "$as_me: program exited with status $ac_status" >&5 --echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 --cf_result=no --fi --rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext --fi -- echo "$as_me:15094: result: $cf_result" >&5 --echo "${ECHO_T}$cf_result" >&6 -- if test $cf_result = yes ; then -+echo "${as_me:-configure}:16017: testing ...checking EXTRA_LDFLAGS $EXTRA_LDFLAGS ..." 1>&5 - --cf_result=`echo "decl_curses_data_boolfnames" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` -+test -n "$verbose" && echo " ...checking LDFLAGS $LDFLAGS" 1>&6 - -- cat >>confdefs.h <<EOF --#define $cf_result 1 --EOF -+echo "${as_me:-configure}:16021: testing ...checking LDFLAGS $LDFLAGS ..." 1>&5 -+ -+cf_rpath_dst= -+for cf_rpath_src in $LDFLAGS -+do -+ case $cf_rpath_src in #(vi -+ -L*) #(vi -+ -+ # check if this refers to a directory which we will ignore -+ cf_rpath_skip=no -+ if test -n "$cf_rpath_list" -+ then -+ for cf_rpath_item in $cf_rpath_list -+ do -+ if test "x$cf_rpath_src" = "x-L$cf_rpath_item" -+ then -+ cf_rpath_skip=yes -+ break -+ fi -+ done -+ fi -+ -+ if test "$cf_rpath_skip" = no -+ then -+ # transform the option -+ if test "$LD_RPATH_OPT" = "-R " ; then -+ cf_rpath_tmp=`echo "$cf_rpath_src" |sed -e "s%-L%-R %"` -+ else -+ cf_rpath_tmp=`echo "$cf_rpath_src" |sed -e "s%-L%$LD_RPATH_OPT%"` -+ fi -+ -+ # if we have not already added this, add it now -+ cf_rpath_tst=`echo "$EXTRA_LDFLAGS" | sed -e "s%$cf_rpath_tmp %%"` -+ if test "x$cf_rpath_tst" = "x$EXTRA_LDFLAGS" -+ then -+ test -n "$verbose" && echo " ...Filter $cf_rpath_src ->$cf_rpath_tmp" 1>&6 -+ -+echo "${as_me:-configure}:16058: testing ...Filter $cf_rpath_src ->$cf_rpath_tmp ..." 1>&5 -+ -+ EXTRA_LDFLAGS="$cf_rpath_tmp $EXTRA_LDFLAGS" -+ fi -+ fi -+ ;; -+ esac -+ cf_rpath_dst="$cf_rpath_dst $cf_rpath_src" -+done -+LDFLAGS=$cf_rpath_dst -+ -+test -n "$verbose" && echo " ...checked LDFLAGS $LDFLAGS" 1>&6 -+ -+echo "${as_me:-configure}:16071: testing ...checked LDFLAGS $LDFLAGS ..." 1>&5 -+ -+test -n "$verbose" && echo " ...checking LIBS $LIBS" 1>&6 -+ -+echo "${as_me:-configure}:16075: testing ...checking LIBS $LIBS ..." 1>&5 -+ -+cf_rpath_dst= -+for cf_rpath_src in $LIBS -+do -+ case $cf_rpath_src in #(vi -+ -L*) #(vi -+ -+ # check if this refers to a directory which we will ignore -+ cf_rpath_skip=no -+ if test -n "$cf_rpath_list" -+ then -+ for cf_rpath_item in $cf_rpath_list -+ do -+ if test "x$cf_rpath_src" = "x-L$cf_rpath_item" -+ then -+ cf_rpath_skip=yes -+ break -+ fi -+ done -+ fi -+ -+ if test "$cf_rpath_skip" = no -+ then -+ # transform the option -+ if test "$LD_RPATH_OPT" = "-R " ; then -+ cf_rpath_tmp=`echo "$cf_rpath_src" |sed -e "s%-L%-R %"` -+ else -+ cf_rpath_tmp=`echo "$cf_rpath_src" |sed -e "s%-L%$LD_RPATH_OPT%"` -+ fi -+ -+ # if we have not already added this, add it now -+ cf_rpath_tst=`echo "$EXTRA_LDFLAGS" | sed -e "s%$cf_rpath_tmp %%"` -+ if test "x$cf_rpath_tst" = "x$EXTRA_LDFLAGS" -+ then -+ test -n "$verbose" && echo " ...Filter $cf_rpath_src ->$cf_rpath_tmp" 1>&6 -+ -+echo "${as_me:-configure}:16112: testing ...Filter $cf_rpath_src ->$cf_rpath_tmp ..." 1>&5 -+ -+ EXTRA_LDFLAGS="$cf_rpath_tmp $EXTRA_LDFLAGS" -+ fi -+ fi -+ ;; -+ esac -+ cf_rpath_dst="$cf_rpath_dst $cf_rpath_src" -+done -+LIBS=$cf_rpath_dst -+ -+test -n "$verbose" && echo " ...checked LIBS $LIBS" 1>&6 -+ -+echo "${as_me:-configure}:16125: testing ...checked LIBS $LIBS ..." 1>&5 -+ -+ test -n "$verbose" && echo " ...checked EXTRA_LDFLAGS $EXTRA_LDFLAGS" 1>&6 -+ -+echo "${as_me:-configure}:16129: testing ...checked EXTRA_LDFLAGS $EXTRA_LDFLAGS ..." 1>&5 -+ -+else -+ echo "$as_me:16132: result: no" >&5 -+echo "${ECHO_T}no" >&6 -+fi - -- fi - fi - - TEST_ARGS="$LIBS" -@@ -15188,7 +16219,7 @@ - : ${CONFIG_STATUS=./config.status} - ac_clean_files_save=$ac_clean_files - ac_clean_files="$ac_clean_files $CONFIG_STATUS" --{ echo "$as_me:15191: creating $CONFIG_STATUS" >&5 -+{ echo "$as_me:16222: creating $CONFIG_STATUS" >&5 - echo "$as_me: creating $CONFIG_STATUS" >&6;} - cat >$CONFIG_STATUS <<_ACEOF - #! $SHELL -@@ -15320,7 +16351,7 @@ - cat >>$CONFIG_STATUS <<EOF - ac_cs_version="\\ - config.status --configured by $0, generated by GNU Autoconf 2.52.20101002, -+configured by $0, generated by GNU Autoconf 2.52.20121002, - with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" - - Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 -@@ -15364,7 +16395,7 @@ - echo "$ac_cs_version"; exit 0 ;; - --he | --h) - # Conflict between --help and --header -- { { echo "$as_me:15367: error: ambiguous option: $1 -+ { { echo "$as_me:16398: error: ambiguous option: $1 - Try \`$0 --help' for more information." >&5 - echo "$as_me: error: ambiguous option: $1 - Try \`$0 --help' for more information." >&2;} -@@ -15383,7 +16414,7 @@ - ac_need_defaults=false;; - - # This is an error. -- -*) { { echo "$as_me:15386: error: unrecognized option: $1 -+ -*) { { echo "$as_me:16417: error: unrecognized option: $1 - Try \`$0 --help' for more information." >&5 - echo "$as_me: error: unrecognized option: $1 - Try \`$0 --help' for more information." >&2;} -@@ -15402,7 +16433,7 @@ - ## Running config.status. ## - ## ----------------------- ## - --This file was extended by $as_me 2.52.20101002, executed with -+This file was extended by $as_me 2.52.20121002, executed with - CONFIG_FILES = $CONFIG_FILES - CONFIG_HEADERS = $CONFIG_HEADERS - CONFIG_LINKS = $CONFIG_LINKS -@@ -15419,7 +16450,9 @@ - # - - AWK="$AWK" -+ECHO_CC="$ECHO_CC" - ECHO_LD="$ECHO_LD" -+SHOW_CC="$SHOW_LD" - - EOF - -@@ -15431,7 +16464,7 @@ - "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; - "default" ) CONFIG_COMMANDS="$CONFIG_COMMANDS default" ;; - "ncurses_cfg.h" ) CONFIG_HEADERS="$CONFIG_HEADERS ncurses_cfg.h:ncurses_tst.hin" ;; -- *) { { echo "$as_me:15434: error: invalid argument: $ac_config_target" >&5 -+ *) { { echo "$as_me:16467: error: invalid argument: $ac_config_target" >&5 - echo "$as_me: error: invalid argument: $ac_config_target" >&2;} - { (exit 1); exit 1; }; };; - esac -@@ -15490,6 +16523,7 @@ - s,@bindir@,$bindir,;t t - s,@sbindir@,$sbindir,;t t - s,@libexecdir@,$libexecdir,;t t -+s,@datarootdir@,$datarootdir,;t t - s,@datadir@,$datadir,;t t - s,@sysconfdir@,$sysconfdir,;t t - s,@sharedstatedir@,$sharedstatedir,;t t -@@ -15529,6 +16563,7 @@ - s,@ac_ct_CC@,$ac_ct_CC,;t t - s,@EXEEXT@,$EXEEXT,;t t - s,@OBJEXT@,$OBJEXT,;t t -+s,@EXTRA_CPPFLAGS@,$EXTRA_CPPFLAGS,;t t - s,@CPP@,$CPP,;t t - s,@AWK@,$AWK,;t t - s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t -@@ -15541,6 +16576,7 @@ - s,@MAKE_LOWER_TAGS@,$MAKE_LOWER_TAGS,;t t - s,@MAKE_UPPER_TAGS@,$MAKE_UPPER_TAGS,;t t - s,@MATH_LIB@,$MATH_LIB,;t t -+s,@top_builddir@,$top_builddir,;t t - s,@CC_G_OPT@,$CC_G_OPT,;t t - s,@CC_SHARED_OPTS@,$CC_SHARED_OPTS,;t t - s,@DFT_DEP_SUFFIX@,$DFT_DEP_SUFFIX,;t t -@@ -15561,25 +16597,30 @@ - s,@TEST_ARGS@,$TEST_ARGS,;t t - s,@TEST_DEPS@,$TEST_DEPS,;t t - s,@TEST_LIBS@,$TEST_LIBS,;t t --s,@TINFO_ARGS@,$TINFO_ARGS,;t t -+s,@TINFO_LDFLAGS@,$TINFO_LDFLAGS,;t t -+s,@TINFO_LIBS@,$TINFO_LIBS,;t t - s,@cf_cv_abi_version@,$cf_cv_abi_version,;t t - s,@cf_cv_rel_version@,$cf_cv_rel_version,;t t --s,@EXTRA_CPPFLAGS@,$EXTRA_CPPFLAGS,;t t -+s,@includesubdir@,$includesubdir,;t t -+s,@PKG_CONFIG@,$PKG_CONFIG,;t t -+s,@ac_pt_PKG_CONFIG@,$ac_pt_PKG_CONFIG,;t t - s,@ECHO_LT@,$ECHO_LT,;t t - s,@ECHO_LD@,$ECHO_LD,;t t - s,@RULE_CC@,$RULE_CC,;t t - s,@SHOW_CC@,$SHOW_CC,;t t - s,@ECHO_CC@,$ECHO_CC,;t t --s,@EXTRA_CFLAGS@,$EXTRA_CFLAGS,;t t -+s,@NCURSES_WRAP_PREFIX@,$NCURSES_WRAP_PREFIX,;t t - s,@NCURSES_CONFIG@,$NCURSES_CONFIG,;t t --s,@PKG_CONFIG@,$PKG_CONFIG,;t t --s,@ac_pt_PKG_CONFIG@,$ac_pt_PKG_CONFIG,;t t -+s,@ac_ct_NCURSES_CONFIG@,$ac_ct_NCURSES_CONFIG,;t t - s,@X_CFLAGS@,$X_CFLAGS,;t t - s,@X_PRE_LIBS@,$X_PRE_LIBS,;t t - s,@X_LIBS@,$X_LIBS,;t t - s,@X_EXTRA_LIBS@,$X_EXTRA_LIBS,;t t - s,@XCURSES_CONFIG@,$XCURSES_CONFIG,;t t --s,@NCURSES_WRAP_PREFIX@,$NCURSES_WRAP_PREFIX,;t t -+s,@ac_ct_XCURSES_CONFIG@,$ac_ct_XCURSES_CONFIG,;t t -+s,@EXTRA_CFLAGS@,$EXTRA_CFLAGS,;t t -+s,@cf_ldd_prog@,$cf_ldd_prog,;t t -+s,@EXTRA_LDFLAGS@,$EXTRA_LDFLAGS,;t t - CEOF - - EOF -@@ -15694,7 +16735,7 @@ - esac - - if test x"$ac_file" != x-; then -- { echo "$as_me:15697: creating $ac_file" >&5 -+ { echo "$as_me:16738: creating $ac_file" >&5 - echo "$as_me: creating $ac_file" >&6;} - rm -f "$ac_file" - fi -@@ -15712,7 +16753,7 @@ - -) echo $tmp/stdin ;; - [\\/$]*) - # Absolute (can't be DOS-style, as IFS=:) -- test -f "$f" || { { echo "$as_me:15715: error: cannot find input file: $f" >&5 -+ test -f "$f" || { { echo "$as_me:16756: error: cannot find input file: $f" >&5 - echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - echo $f;; -@@ -15725,13 +16766,45 @@ - echo $srcdir/$f - else - # /dev/null tree -- { { echo "$as_me:15728: error: cannot find input file: $f" >&5 -+ { { echo "$as_me:16769: error: cannot find input file: $f" >&5 - echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - fi;; - esac - done` || { (exit 1); exit 1; } - EOF -+cat >>$CONFIG_STATUS <<\EOF -+ ac_warn_datarootdir=no -+ if test x"$ac_file" != x-; then -+ for ac_item in $ac_file_inputs -+ do -+ ac_seen=`grep '@\(datadir\|mandir\|infodir\)@' $ac_item` -+ if test -n "$ac_seen"; then -+ ac_used=`grep '@datarootdir@' $ac_item` -+ if test -z "$ac_used"; then -+ { echo "$as_me:16785: WARNING: datarootdir was used implicitly but not set: -+$ac_seen" >&5 -+echo "$as_me: WARNING: datarootdir was used implicitly but not set: -+$ac_seen" >&2;} -+ ac_warn_datarootdir=yes -+ fi -+ fi -+ ac_seen=`grep '${datarootdir}' $ac_item` -+ if test -n "$ac_seen"; then -+ { echo "$as_me:16794: WARNING: datarootdir was used explicitly but not set: -+$ac_seen" >&5 -+echo "$as_me: WARNING: datarootdir was used explicitly but not set: -+$ac_seen" >&2;} -+ ac_warn_datarootdir=yes -+ fi -+ done -+ fi -+ -+if test "x$ac_warn_datarootdir" = xyes; then -+ ac_sed_cmds="$ac_sed_cmds | sed -e 's,@datarootdir@,\${prefix}/share,g' -e 's,\${datarootdir},\${prefix}/share,g'" -+fi -+ -+EOF - cat >>$CONFIG_STATUS <<EOF - sed "$ac_vpsub - $extrasub -@@ -15746,11 +16819,35 @@ - " $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out - rm -f $tmp/stdin - if test x"$ac_file" != x-; then -- mv $tmp/out $ac_file -+ cp $tmp/out $ac_file -+ -+ for ac_name in prefix exec_prefix datarootdir -+ do -+ ac_seen=`fgrep -n '${'$ac_name'[:=].*}' $ac_file` -+ if test -n "$ac_seen"; then -+ ac_init=`egrep '[ ]*'$ac_name'[ ]*=' $ac_file` -+ if test -z "$ac_init"; then -+ ac_seen=`echo "$ac_seen" |sed -e 's,^,'$ac_file':,'` -+ { echo "$as_me:16831: WARNING: Variable $ac_name is used but was not set: -+$ac_seen" >&5 -+echo "$as_me: WARNING: Variable $ac_name is used but was not set: -+$ac_seen" >&2;} -+ fi -+ fi -+ done -+ egrep -n '@[a-z_][a-z_0-9]+@' $ac_file >$tmp/out -+ egrep -n '@[A-Z_][A-Z_0-9]+@' $ac_file >>$tmp/out -+ if test -s $tmp/out; then -+ ac_seen=`sed -e 's,^,'$ac_file':,' < $tmp/out` -+ { echo "$as_me:16842: WARNING: Some variables may not be substituted: -+$ac_seen" >&5 -+echo "$as_me: WARNING: Some variables may not be substituted: -+$ac_seen" >&2;} -+ fi - else - cat $tmp/out -- rm -f $tmp/out - fi -+ rm -f $tmp/out - - done - EOF -@@ -15791,7 +16888,7 @@ - * ) ac_file_in=$ac_file.in ;; - esac - -- test x"$ac_file" != x- && { echo "$as_me:15794: creating $ac_file" >&5 -+ test x"$ac_file" != x- && { echo "$as_me:16891: creating $ac_file" >&5 - echo "$as_me: creating $ac_file" >&6;} - - # First look for the input files in the build tree, otherwise in the -@@ -15802,7 +16899,7 @@ - -) echo $tmp/stdin ;; - [\\/$]*) - # Absolute (can't be DOS-style, as IFS=:) -- test -f "$f" || { { echo "$as_me:15805: error: cannot find input file: $f" >&5 -+ test -f "$f" || { { echo "$as_me:16902: error: cannot find input file: $f" >&5 - echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - echo $f;; -@@ -15815,7 +16912,7 @@ - echo $srcdir/$f - else - # /dev/null tree -- { { echo "$as_me:15818: error: cannot find input file: $f" >&5 -+ { { echo "$as_me:16915: error: cannot find input file: $f" >&5 - echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - fi;; -@@ -15873,7 +16970,7 @@ - rm -f $tmp/in - if test x"$ac_file" != x-; then - if cmp -s $ac_file $tmp/config.h 2>/dev/null; then -- { echo "$as_me:15876: $ac_file is unchanged" >&5 -+ { echo "$as_me:16973: $ac_file is unchanged" >&5 - echo "$as_me: $ac_file is unchanged" >&6;} - else - ac_dir=`$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ -@@ -15949,7 +17046,8 @@ - \$(MODEL)/$N.o : \$(srcdir)/$N.c \\ - \$(srcdir)/test.priv.h \\ - ncurses_cfg.h -- @echo compiling $N; \$(CC) -c \$(CFLAGS_DEFAULT) \$(srcdir)/$N.c -+ $SHOW_CC -+ $ECHO_CC\$(CC) -c \$(CFLAGS_DEFAULT) \$(srcdir)/$N.c - TEST_EOF - done - -diff -Naur ncurses-5.9/test/configure.in ncurses-5.9.patch/test/configure.in ---- ncurses-5.9/test/configure.in 2011-03-22 10:15:08.000000000 +0100 -+++ ncurses-5.9.patch/test/configure.in 2014-09-01 16:33:22.534792419 +0200 -@@ -1,5 +1,5 @@ - dnl*************************************************************************** --dnl Copyright (c) 1998-2010,2011 Free Software Foundation, Inc. * -+dnl Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. * - dnl * - dnl Permission is hereby granted, free of charge, to any person obtaining a * - dnl copy of this software and associated documentation files (the * -@@ -28,7 +28,7 @@ - dnl - dnl Author: Thomas E. Dickey 1996, etc. - dnl --dnl $Id: configure.in,v 1.90 2011/03/22 09:15:08 tom Exp $ -+dnl $Id: configure.in,v 1.113 2013/10/19 21:03:17 tom Exp $ - dnl This is a simple configuration-script for the ncurses test programs that - dnl allows the test-directory to be separately configured against a reference - dnl system (i.e., sysvr4 curses) -@@ -38,7 +38,7 @@ - dnl - dnl See http://invisible-island.net/autoconf/ for additional information. - dnl --------------------------------------------------------------------------- --AC_PREREQ(2.13.20020210) -+AC_PREREQ(2.52.20030208) - AC_INIT(ncurses.c) - AC_CONFIG_HEADER(ncurses_cfg.h:ncurses_tst.hin) - -@@ -49,17 +49,18 @@ - AC_ARG_PROGRAM - - AC_PROG_MAKE_SET --AC_PROG_CC -+CF_PROG_CC - AC_PROG_CPP - AC_PROG_AWK - CF_PROG_INSTALL - CF_PROG_LINT - CF_MAKE_TAGS - --CF_MATH_LIB(MATH_LIB,sin(x)) -+CF_MATH_LIB(MATH_LIB,pow(sin(x),x)) - AC_SUBST(MATH_LIB) - - dnl Things that we don't need (or must override) if we're not building ncurses -+CF_TOP_BUILDDIR - CC_G_OPT="-g" AC_SUBST(CC_G_OPT) - CC_SHARED_OPTS=unknown AC_SUBST(CC_SHARED_OPTS) - CPPFLAGS="$CPPFLAGS" AC_SUBST(CPPFLAGS) -@@ -81,9 +82,11 @@ - TEST_ARGS="" AC_SUBST(TEST_ARGS) - TEST_DEPS="" AC_SUBST(TEST_DEPS) - TEST_LIBS="" AC_SUBST(TEST_LIBS) --TINFO_ARGS='$(LIBS_CURSES)' AC_SUBST(TINFO_ARGS) -+TINFO_LDFLAGS='' AC_SUBST(TINFO_LDFLAGS) -+TINFO_LIBS='$(LIBS_CURSES)' AC_SUBST(TINFO_LIBS) - cf_cv_abi_version="" AC_SUBST(cf_cv_abi_version) - cf_cv_rel_version="" AC_SUBST(cf_cv_rel_version) -+includesubdir="" AC_SUBST(includesubdir) - - cf_cv_screen=curses - cf_cv_libtype= -@@ -91,55 +94,38 @@ - AC_EXEEXT - AC_OBJEXT - --CF_ANSI_CC_REQD - CF_GCC_ATTRIBUTES - CF_XOPEN_SOURCE --AC_C_CONST - CF_SIG_ATOMIC_T - -+dnl --------------------------------------------------------------------------- -+CF_HELP_MESSAGE(General Options:) -+CF_PKG_CONFIG - CF_DISABLE_ECHO --CF_ENABLE_WARNINGS - --CF_DISABLE_LEAKS --CF_WITH_CURSES_DIR -+dnl --------------------------------------------------------------------------- -+CF_HELP_MESSAGE(Curses Version-dependent Options:) -+CF_NCURSES_WRAP_PREFIX - --dnl SunOS 4.x --AC_ARG_WITH(5lib, -- [ --with-5lib use SunOS sysv-libraries], -- [LIBS="-L/usr/5lib $LIBS" -- CPPFLAGS="$CPPFLAGS -I/usr/5include"]) -+AC_MSG_CHECKING(if you want to check for wide-character functions) -+CF_ARG_DISABLE(widec, -+ [ --disable-widec disable checks for wide-character functions], -+ cf_enable_widec=no, -+ cf_enable_widec=yes, -+ yes) -+AC_MSG_RESULT($cf_enable_widec) - - dnl --------------------------------------------------------------------------- --dnl NcursesW, installed in conventional location --AC_ARG_WITH(ncursesw, -- [ --with-ncursesw use wide ncurses-libraries (installed)], -- [cf_cv_screen=ncursesw],[ -- --dnl Ncurses, installed in conventional location --AC_ARG_WITH(ncurses, -- [ --with-ncurses use ncurses-libraries (installed)], -- [cf_cv_screen=ncurses],[ -- --AC_ARG_WITH(pdcurses, -- [ --with-pdcurses compile/link with pdcurses X11 library], -- [cf_cv_screen=pdcurses])])]) -+CF_HELP_MESSAGE(Curses Version-dependent Options:) -+CF_WITH_NCURSES_ETC - - case $cf_cv_screen in --curses) -- CF_CURSES_CONFIG -+curses|curses_*) - CF_NETBSD_FORM_H - CF_NETBSD_MENU_H - ;; --ncurses) -- CF_NCURSES_CONFIG -- ;; - ncursesw) - cf_cv_libtype=w -- CF_UTF8_LIB -- CF_NCURSES_CONFIG(ncursesw) -- ;; --pdcurses) #(vi -- CF_PDCURSES_X11 - ;; - esac - -@@ -153,9 +139,12 @@ - ;; - *) - # look for curses-related libraries -- AC_CHECK_LIB(panel$cf_cv_libtype,new_panel) -- AC_CHECK_LIB(menu$cf_cv_libtype,menu_driver) -- AC_CHECK_LIB(form$cf_cv_libtype,form_driver) -+ : ${cf_panel_lib:=panel} -+ : ${cf_menu_lib:=menu} -+ : ${cf_form_lib:=form} -+ AC_CHECK_LIB($cf_panel_lib$cf_cv_libtype,new_panel) -+ AC_CHECK_LIB($cf_menu_lib$cf_cv_libtype,menu_driver) -+ AC_CHECK_LIB($cf_form_lib$cf_cv_libtype,form_driver) - - # look for curses-related headers - AC_CHECK_HEADERS( \ -@@ -169,8 +158,6 @@ - ;; - esac - --AC_TYPE_SIGNAL -- - AC_STDC_HEADERS - AC_HEADER_TIME - AC_CHECK_HEADERS( \ -@@ -185,20 +172,27 @@ - unistd.h \ - ) - -+CF_GETOPT_HEADER -+ - AC_CHECK_FUNCS( \ - gettimeofday \ -+) -+ -+if test "$cf_enable_widec" = yes; then -+AC_CHECK_FUNCS( \ - mblen \ - mbrlen \ - mbrtowc \ - mbsrtowcs \ - mbstowcs \ - mbtowc \ --strdup \ - wcsrtombs \ - wcstombs \ - ) -+fi - - CF_CURSES_FUNCS( \ -+assume_default_colors \ - chgat \ - color_set \ - filter \ -@@ -225,61 +219,104 @@ - tigetstr \ - typeahead \ - use_default_colors \ --vw_printw \ -+use_screen \ -+use_window \ - vsscanf \ -+vw_printw \ - wchgat \ - winsstr \ - wresize \ - wsyncdown \ - ) - -+CF_TPUTS_PROTO - CF_NCURSES_EXT_FUNCS - --AC_CACHE_CHECK(for wide-character functions,cf_cv_widechar_funcs,[ --AC_TRY_LINK([ -+if test "$cf_enable_widec" = yes -+then -+ # workaround for systems with ncurses before 20111029, due to change of -+ # feature test macro from _XPG5 to _XOPEN_SOURCE -+ if test -n "$cf_cv_ncurses_version" && test "x$cf_cv_ncurses_version" != xno -+ then -+ cf_define_xpg5=no -+ AC_MSG_CHECKING(if _XPG5 should be defined to enable wide-characters) -+ -+ AC_TRY_COMPILE([ -+#include <${cf_cv_ncurses_header:-curses.h}>], -+ [int x = _XPG5],, -+ [cf_save_cppflags="$CPPFLAGS" -+ CPPFLAGS="$CPPFLAGS -D_XPG5" -+ AC_TRY_COMPILE([ -+#include <${cf_cv_ncurses_header:-curses.h}>], -+ [int x = _XPG5], -+ [cf_define_xpg5=yes]) -+ CPPFLAGS="$cf_save_cppflags"]) -+ AC_MSG_RESULT($cf_define_xpg5) -+ -+ if test "$cf_define_xpg5" = yes -+ then -+ CPPFLAGS="$CPPFLAGS -D_XPG5" -+ fi -+ fi -+ -+ AC_CACHE_CHECK(for wide-character functions,cf_cv_widechar_funcs,[ -+ AC_TRY_LINK([ - #include <${cf_cv_ncurses_header:-curses.h}>], --[ -- static wchar_t src_wchar[2]; -- static cchar_t dst_cchar; -- setcchar(&dst_cchar, src_wchar, A_NORMAL, 0, (void *) 0); -- ], -- [cf_cv_widechar_funcs=yes], -- [cf_cv_widechar_funcs=no]) --]) --if test "$cf_cv_widechar_funcs" != no ; then -- AC_DEFINE(USE_WIDEC_SUPPORT,1) -+ [ -+ static wchar_t src_wchar[2]; -+ static cchar_t dst_cchar; -+ setcchar(&dst_cchar, src_wchar, A_NORMAL, 0, (void *) 0); -+ ], -+ [cf_cv_widechar_funcs=yes], -+ [cf_cv_widechar_funcs=no]) -+ ]) -+ if test "$cf_cv_widechar_funcs" != no ; then -+ AC_DEFINE(USE_WIDEC_SUPPORT,1,[Define to 1 to enable wide-character support in (n)curses]) -+ else -+ AC_DEFINE(USE_WIDEC_SUPPORT,0) -+ fi - else - AC_DEFINE(USE_WIDEC_SUPPORT,0) - fi - --AC_FUNC_VFORK - CF_SYS_TIME_SELECT - CF_FUNC_CURSES_VERSION --CF_CURSES_ACS_MAP --CF_CURSES_WACS_MAP --CF_CURSES_WACS_SYMBOLS -- --CF_CURSES_CHECK_TYPE(attr_t,long) -- --CF_WCHAR_TYPE(mbstate_t, NCURSES_MBSTATE_T, NCURSES_OK_MBSTATE_T) --CF_WCHAR_TYPE(wchar_t, NCURSES_WCHAR_T, NCURSES_OK_WCHAR_T) --CF_WCHAR_TYPE(wint_t, NCURSES_WINT_T, NCURSES_OK_WINT_T) - --if test "$NCURSES_OK_MBSTATE_T" = 0 ; then -- CF_CURSES_CHECK_TYPE(mbstate_t,long) -+CF_CURSES_ACS_MAP -+if test "$cf_enable_widec" = yes; then -+ CF_CURSES_WACS_MAP -+ CF_CURSES_WACS_SYMBOLS - fi - --if test "$NCURSES_OK_WCHAR_T" = 0 ; then -- CF_CURSES_CHECK_TYPE(wchar_t,long) --fi -+CF_CURSES_CHECK_TYPE(attr_t,long) - --if test "$NCURSES_OK_WINT_T" = 0 ; then -- CF_CURSES_CHECK_TYPE(wint_t,long) -+if test "$cf_enable_widec" = yes; then -+ CF_WCHAR_TYPE(mbstate_t, NCURSES_MBSTATE_T, NCURSES_OK_MBSTATE_T) -+ CF_WCHAR_TYPE(wchar_t, NCURSES_WCHAR_T, NCURSES_OK_WCHAR_T) -+ CF_WCHAR_TYPE(wint_t, NCURSES_WINT_T, NCURSES_OK_WINT_T) -+ -+ if test "$NCURSES_OK_MBSTATE_T" = 0 ; then -+ CF_CURSES_CHECK_TYPE(mbstate_t,long) -+ fi -+ -+ if test "$NCURSES_OK_WCHAR_T" = 0 ; then -+ CF_CURSES_CHECK_TYPE(wchar_t,long) -+ fi -+ -+ if test "$NCURSES_OK_WINT_T" = 0 ; then -+ CF_CURSES_CHECK_TYPE(wint_t,long) -+ fi - fi - - CF_CURSES_CHECK_DATA(boolnames) - CF_CURSES_CHECK_DATA(boolfnames) - -+dnl --------------------------------------------------------------------------- -+CF_HELP_MESSAGE(Testing/development Options:) -+CF_ENABLE_WARNINGS -+CF_DISABLE_LEAKS -+CF_DISABLE_RPATH_HACK -+ - TEST_ARGS="$LIBS" - LIBS= - -@@ -302,7 +339,8 @@ - \$(MODEL)/$N.o : \$(srcdir)/$N.c \\ - \$(srcdir)/test.priv.h \\ - ncurses_cfg.h -- @echo compiling $N; \$(CC) -c \$(CFLAGS_DEFAULT) \$(srcdir)/$N.c -+ $SHOW_CC -+ $ECHO_CC\$(CC) -c \$(CFLAGS_DEFAULT) \$(srcdir)/$N.c - TEST_EOF - done - -@@ -317,5 +355,7 @@ - fi - ],[ - AWK="$AWK" -+ECHO_CC="$ECHO_CC" - ECHO_LD="$ECHO_LD" -+SHOW_CC="$SHOW_LD" - ],cat) -diff -Naur ncurses-5.9/test/demo_defkey.c ncurses-5.9.patch/test/demo_defkey.c ---- ncurses-5.9/test/demo_defkey.c 2010-11-14 01:59:35.000000000 +0100 -+++ ncurses-5.9.patch/test/demo_defkey.c 2014-09-01 16:33:22.534792419 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 2002-2007,2008 Free Software Foundation, Inc. * -+ * Copyright (c) 2002-2012,2013 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -26,7 +26,7 @@ - * authorization. * - ****************************************************************************/ - /* -- * $Id: demo_defkey.c,v 1.20 2010/11/14 00:59:35 tom Exp $ -+ * $Id: demo_defkey.c,v 1.22 2013/09/28 22:02:17 tom Exp $ - * - * Demonstrate the define_key() function. - * Thomas Dickey - 2002/11/23 -@@ -106,7 +106,7 @@ - for (pass = 0; pass < 2; ++pass) { - for (n = 0; string[n] != '\0'; ++n) { - char temp[80]; -- strcpy(temp, visichar(string[n])); -+ strncpy(temp, visichar(string[n]), sizeof(temp) - 2); - if (pass) - strcat(result, temp); - else -@@ -116,7 +116,7 @@ - result = typeCalloc(char, need); - } - } else { -- result = typeCalloc(char, 1); -+ result = typeCalloc(char, (size_t) 1); - } - return result; - } -@@ -186,9 +186,9 @@ - const char *prefix = 0; - char temp[BUFSIZ]; - -- if (!strncmp(value, "\033[", 2)) { -+ if (!strncmp(value, "\033[", (size_t) 2)) { - prefix = "\033O"; -- } else if (!strncmp(value, "\033O", 2)) { -+ } else if (!strncmp(value, "\033O", (size_t) 2)) { - prefix = "\033["; - } - if (prefix != 0) { -diff -Naur ncurses-5.9/test/demo_forms.c ncurses-5.9.patch/test/demo_forms.c ---- ncurses-5.9/test/demo_forms.c 2011-01-15 19:15:11.000000000 +0100 -+++ ncurses-5.9.patch/test/demo_forms.c 2014-09-01 16:33:22.534792419 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 2003-2010,2011 Free Software Foundation, Inc. * -+ * Copyright (c) 2003-2012,2013 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -26,7 +26,7 @@ - * authorization. * - ****************************************************************************/ - /* -- * $Id: demo_forms.c,v 1.38 2011/01/15 18:15:11 tom Exp $ -+ * $Id: demo_forms.c,v 1.46 2013/09/28 21:55:54 tom Exp $ - * - * Demonstrate a variety of functions from the form library. - * Thomas Dickey - 2003/4/26 -@@ -70,14 +70,115 @@ - - #include <edit_field.h> - -+typedef struct { -+ char *name; -+ char *value; -+} MY_DATA; -+ -+static MY_DATA *my_data; -+ - static int d_option = 0; - static int j_value = 0; - static int m_value = 0; - static int o_value = 0; - static char *t_value = 0; - -+static void -+failed(const char *s) -+{ -+ perror(s); -+ ExitProgram(EXIT_FAILURE); -+} -+ -+static void -+chomp(char *value) -+{ -+ size_t have = strlen(value); -+ while (have != 0 && (value[have - 1] == '\n' || value[have - 1] == '\r')) { -+ value[--have] = '\0'; -+ } -+} -+ -+static int -+trimmed(const char *value) -+{ -+ int result = (int) strlen(value); -+ while (result > 0 && isspace(UChar(value[result - 1]))) { -+ --result; -+ } -+ return result; -+} -+ -+static char * -+get_data(const char *name) -+{ -+ char *result = t_value; -+ if (my_data != 0) { -+ int n; -+ for (n = 0; my_data[n].name != 0; ++n) { -+ if (!strcmp(name, my_data[n].name)) { -+ result = my_data[n].value; -+ break; -+ } -+ } -+ } -+ return result; -+} -+ -+/* -+ * Read (possibly) multi-line data with name+value pairs. -+ */ -+static void -+read_data(const char *filename) -+{ -+ FILE *fp = fopen(filename, "r"); -+ -+ if (fp != 0) { -+ char buffer[BUFSIZ]; -+ char *colon; -+ int more = 0; -+ int item = 0; -+ -+ my_data = typeCalloc(MY_DATA, (size_t) 100); /* FIXME */ -+ while (fgets(buffer, sizeof(buffer), fp) != 0) { -+ chomp(buffer); -+ if (more) { -+ if (strcmp(buffer, ".")) { -+ char *prior = my_data[more - 1].value; -+ size_t need = strlen(buffer) + 2 + strlen(prior); -+ char *value = typeRealloc(char, need, prior); -+ if (value == 0) -+ failed("realloc"); -+ strcat(value, "\n"); -+ strcat(value, buffer); -+ my_data[more - 1].value = value; -+ } else { -+ more = 0; -+ } -+ } else if (*buffer == '#') { -+ continue; -+ } else if ((colon = strchr(buffer, ':')) != 0) { -+ char *name; -+ char *value; -+ *colon++ = '\0'; -+ name = strdup(buffer); -+ value = strdup(colon); -+ if (name == 0 || value == 0) -+ failed("strdup"); -+ my_data[item].name = name; -+ my_data[item].value = value; -+ more = ++item; -+ } else { -+ failed("expected a colon"); -+ } -+ } -+ } else { -+ failed(filename); -+ } -+} -+ - static FIELD * --make_label(int frow, int fcol, NCURSES_CONST char *label) -+make_label(const char *label, int frow, int fcol) - { - FIELD *f = new_field(1, (int) strlen(label), frow, fcol, 0, 0); - -@@ -92,13 +193,11 @@ - * Define each field with an extra one, for reflecting "actual" text. - */ - static FIELD * --make_field(int frow, int fcol, int rows, int cols) -+make_field(const char *label, int frow, int fcol, int rows, int cols) - { - FIELD *f = new_field(rows, cols, frow, fcol, o_value, 1); - - if (f) { -- FieldAttrs *ptr; -- - set_field_back(f, A_UNDERLINE); - /* - * If -j and -d options are combined, -j loses. It is documented in -@@ -108,7 +207,7 @@ - set_field_just(f, j_value); - if (d_option) { - if (has_colors()) { -- set_field_fore(f, COLOR_PAIR(2)); -+ set_field_fore(f, (chtype) COLOR_PAIR(2)); - set_field_back(f, A_UNDERLINE | COLOR_PAIR(3)); - } else { - set_field_fore(f, A_BOLD); -@@ -121,17 +220,7 @@ - set_max_field(f, m_value); - } - -- /* -- * The userptr is used in edit_field.c's inactive_field(). -- */ -- ptr = (FieldAttrs *) field_userptr(f); -- if (ptr == 0) { -- ptr = typeCalloc(FieldAttrs, 1); -- ptr->background = field_back(f); -- } -- set_field_userptr(f, (void *) ptr); -- if (t_value) -- set_field_buffer(f, 0, t_value); -+ init_edit_field(f, get_data(label)); - } - return (f); - } -@@ -153,10 +242,10 @@ - set_form_sub(f, derwin(w, rows, cols, 1, 2)); - box(w, 0, 0); - keypad(w, TRUE); -- } - -- if (post_form(f) != E_OK) -- wrefresh(w); -+ if (post_form(f) != E_OK) -+ wrefresh(w); -+ } - } - - static void -@@ -257,7 +346,7 @@ - int currow, curcol; - - if (has_colors()) { -- wbkgd(win, COLOR_PAIR(1)); -+ wbkgd(win, (chtype) COLOR_PAIR(1)); - } - werase(win); - form_getyx(form, currow, curcol); -@@ -309,25 +398,28 @@ - } - - waddch(win, ' '); -- (void) wattrset(win, field_fore(field)); -+ (void) wattrset(win, (int) field_fore(field)); - waddstr(win, "fore"); -- wattroff(win, field_fore(field)); -+ wattroff(win, (int) field_fore(field)); - - waddch(win, '/'); - -- (void) wattrset(win, field_back(field)); -+ (void) wattrset(win, (int) field_back(field)); - waddstr(win, "back"); -- wattroff(win, field_back(field)); -+ wattroff(win, (int) field_back(field)); - -- wprintw(win, ", pad '%c'", -- field_pad(field)); -+ wprintw(win, ", pad '%c'", field_pad(field)); - - waddstr(win, "\n"); - for (nbuf = 0; nbuf <= 2; ++nbuf) { - if ((buffer = field_buffer(field, nbuf)) != 0) { - wprintw(win, "buffer %d:", nbuf); - (void) wattrset(win, A_REVERSE); -- waddstr(win, buffer); -+ if (nbuf) { -+ waddnstr(win, buffer, trimmed(buffer)); -+ } else { -+ waddstr(win, buffer); -+ } - wattroff(win, A_REVERSE); - waddstr(win, "\n"); - } -@@ -341,11 +433,12 @@ - { - WINDOW *w; - FORM *form; -- FIELD *f[100]; /* FIXME memset to zero */ -+ FIELD *f[100]; /* will memset to zero */ - int finished = 0, c; - unsigned n = 0; - int pg; - WINDOW *also; -+ const char *fname; - - #ifdef NCURSES_MOUSE_VERSION - mousemask(ALL_MOUSE_EVENTS, (mmask_t *) 0); -@@ -363,66 +456,76 @@ - for (pg = 0; pg < 4; ++pg) { - char label[80]; - sprintf(label, "Sample Form Page %d", pg + 1); -- f[n++] = make_label(0, 15, label); -+ f[n++] = make_label(label, 0, 15); - set_new_page(f[n - 1], TRUE); - - switch (pg) { - default: -- f[n++] = make_label(2, 0, "Last Name"); -- f[n++] = make_field(3, 0, 1, 18); -+ fname = "Last Name"; -+ f[n++] = make_label(fname, 2, 0); -+ f[n++] = make_field(fname, 3, 0, 1, 18); - set_field_type(f[n - 1], TYPE_ALPHA, 1); - -- f[n++] = make_label(2, 20, "First Name"); -- f[n++] = make_field(3, 20, 1, 12); -+ fname = "First Name"; -+ f[n++] = make_label(fname, 2, 20); -+ f[n++] = make_field(fname, 3, 20, 1, 12); - set_field_type(f[n - 1], TYPE_ALPHA, 1); - -- f[n++] = make_label(2, 34, "Middle Name"); -- f[n++] = make_field(3, 34, 1, 12); -+ fname = "Middle Name"; -+ f[n++] = make_label(fname, 2, 34); -+ f[n++] = make_field(fname, 3, 34, 1, 12); - set_field_type(f[n - 1], TYPE_ALPHA, 1); - break; - case 1: -- f[n++] = make_label(2, 0, "Last Name"); -- f[n++] = make_field(3, 0, 1, 18); -+ fname = "Last Name"; -+ f[n++] = make_label(fname, 2, 0); -+ f[n++] = make_field(fname, 3, 0, 1, 18); - set_field_type(f[n - 1], TYPE_ALPHA, 1); - -- f[n++] = make_label(2, 20, "First Name"); -- f[n++] = make_field(3, 20, 1, 12); -+ fname = "First Name"; -+ f[n++] = make_label(fname, 2, 20); -+ f[n++] = make_field(fname, 3, 20, 1, 12); - set_field_type(f[n - 1], TYPE_ALPHA, 1); - -- f[n++] = make_label(2, 34, "MI"); -- f[n++] = make_field(3, 34, 1, 1); -+ fname = "MI"; -+ f[n++] = make_label(fname, 2, 34); -+ f[n++] = make_field(fname, 3, 34, 1, 1); - set_field_pad(f[n - 1], '?'); - set_field_type(f[n - 1], TYPE_ALPHA, 1); - break; - case 2: -- f[n++] = make_label(2, 0, "Host Name"); -- f[n++] = make_field(3, 0, 1, 18); -+ fname = "Host Name"; -+ f[n++] = make_label(fname, 2, 0); -+ f[n++] = make_field(fname, 3, 0, 1, 24); - set_field_type(f[n - 1], TYPE_ALNUM, 1); - - #ifdef NCURSES_VERSION -- f[n++] = make_label(2, 20, "IP Address"); -- f[n++] = make_field(3, 20, 1, 12); -+ fname = "IP Address"; -+ f[n++] = make_label(fname, 2, 26); -+ f[n++] = make_field(fname, 3, 26, 1, 16); - set_field_type(f[n - 1], TYPE_IPV4, 1); - #endif - - break; - - case 3: -- f[n++] = make_label(2, 0, "Four digits"); -- f[n++] = make_field(3, 0, 1, 18); -+ fname = "Four digits"; -+ f[n++] = make_label(fname, 2, 0); -+ f[n++] = make_field(fname, 3, 0, 1, 18); - set_field_type(f[n - 1], TYPE_INTEGER, 4, 0, 0); - -- f[n++] = make_label(2, 20, "Numeric"); -- f[n++] = make_field(3, 20, 1, 12); -+ fname = "Numeric"; -+ f[n++] = make_label(fname, 2, 20); -+ f[n++] = make_field(fname, 3, 20, 1, 12); - set_field_type(f[n - 1], TYPE_NUMERIC, 3, -10000.0, 100000000.0); - - break; - } - -- f[n++] = make_label(5, 0, "Comments"); -- f[n++] = make_field(6, 0, 4, 46); -- set_field_buffer(f[n - 1], 0, "HELLO\nWORLD!"); -- set_field_buffer(f[n - 1], 1, "Hello\nWorld!"); -+ fname = "Comments"; -+ f[n++] = make_label(fname, 5, 0); -+ f[n++] = make_field(fname, 6, 0, 4, 46); -+ init_edit_field(f[n - 1], get_data(fname)); - } - - f[n] = (FIELD *) 0; -@@ -471,7 +574,7 @@ - { - static const char *tbl[] = - { -- "Usage: demo_forms [options]" -+ "Usage: demo_forms [options] [data file]" - ,"" - ," -d make fields dynamic" - ," -j value justify (1=left, 2=center, 3=right)" -@@ -517,6 +620,9 @@ - - } - } -+ while (optind < argc) { -+ read_data(argv[optind++]); -+ } - - initscr(); - cbreak(); -@@ -531,7 +637,7 @@ - init_pair(1, COLOR_WHITE, COLOR_BLUE); - init_pair(2, COLOR_GREEN, COLOR_BLACK); - init_pair(3, COLOR_CYAN, COLOR_BLACK); -- bkgd(COLOR_PAIR(1)); -+ bkgd((chtype) COLOR_PAIR(1)); - refresh(); - } - -@@ -540,6 +646,7 @@ - endwin(); - ExitProgram(EXIT_SUCCESS); - } -+ - #else - int - main(void) -diff -Naur ncurses-5.9/test/demo_forms.txt ncurses-5.9.patch/test/demo_forms.txt ---- ncurses-5.9/test/demo_forms.txt 1970-01-01 01:00:00.000000000 +0100 -+++ ncurses-5.9.patch/test/demo_forms.txt 2014-09-01 16:33:22.534792419 +0200 -@@ -0,0 +1,20 @@ -+# $Id: demo_forms.txt,v 1.3 2013/06/08 14:10:15 tom Exp $ -+First Name:John -+. -+Middle Name:Don -+. -+MI:D -+. -+Last Name:Smith -+. -+Comments:Hello -+World! -+. -+Host Name:localhost@localdomain -+. -+IP Address:192.168.1.100 -+. -+Four digits:1234 -+. -+Numeric:32768 -+. -diff -Naur ncurses-5.9/test/demo_menus.c ncurses-5.9.patch/test/demo_menus.c ---- ncurses-5.9/test/demo_menus.c 2011-01-15 21:02:47.000000000 +0100 -+++ ncurses-5.9.patch/test/demo_menus.c 2014-09-01 16:33:22.535792421 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 2005-2010,2011 Free Software Foundation, Inc. * -+ * Copyright (c) 2005-2012,2013 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -26,7 +26,7 @@ - * authorization. * - ****************************************************************************/ - /* -- * $Id: demo_menus.c,v 1.32 2011/01/15 20:02:47 tom Exp $ -+ * $Id: demo_menus.c,v 1.52 2013/09/28 21:55:02 tom Exp $ - * - * Demonstrate a variety of functions from the menu library. - * Thomas Dickey - 2005/4/9 -@@ -38,7 +38,6 @@ - item_opts_off - - item_opts_on - - item_term - --item_userptr - - item_visible - - menu_back - - menu_fore - -@@ -49,22 +48,16 @@ - menu_pad - - menu_request_by_name - - menu_request_name - --menu_sub - - menu_term - - menu_userptr - - set_current_item - --set_item_init - - set_item_opts - --set_item_term - --set_item_userptr - - set_menu_grey - --set_menu_init - - set_menu_items - - set_menu_opts - - set_menu_pad - - set_menu_pattern - - set_menu_spacing - --set_menu_term - - set_menu_userptr - - set_top_row - - top_row - -@@ -103,23 +96,21 @@ - - #define MENU_Y 1 - -+typedef struct { -+ const char *name; -+ void (*func) (int); -+ unsigned mask; -+} MENU_DATA; -+ -+static void call_files(int); -+ - static MENU *mpBanner; - static MENU *mpFile; - static MENU *mpSelect; - --static bool loaded_file = FALSE; -+static WINDOW *status; - --#if !HAVE_STRDUP --#define strdup my_strdup --static char * --strdup(char *s) --{ -- char *p = typeMalloc(char, strlen(s) + 1); -- if (p) -- strcpy(p, s); -- return (p); --} --#endif /* not HAVE_STRDUP */ -+static bool loaded_file = FALSE; - - /* Common function to allow ^T to toggle trace-mode in the middle of a test - * so that trace-files can be made smaller. -@@ -207,6 +198,48 @@ - return result; - } - -+static void -+my_menu_init(MENU * menu) -+{ -+ Trace(("called MenuHook my_menu_init")); -+ mvwprintw(status, 2, 0, "menu_init %p", (void *) menu); -+ wclrtoeol(status); -+ wrefresh(status); -+} -+ -+static void -+my_menu_term(MENU * menu) -+{ -+ Trace(("called MenuHook my_menu_term")); -+ mvwprintw(status, 2, 0, "menu_term %p", (void *) menu); -+ wclrtoeol(status); -+ wrefresh(status); -+} -+ -+static void -+my_item_init(MENU * menu) -+{ -+ ITEM *item = current_item(menu); -+ const char *name = item_name(item); -+ -+ Trace(("called MenuHook my_item_init (%s)", name)); -+ mvwprintw(status, 2, 0, "item_init %s", name); -+ wclrtoeol(status); -+ wrefresh(status); -+} -+ -+static void -+my_item_term(MENU * menu) -+{ -+ ITEM *item = current_item(menu); -+ const char *name = item_name(item); -+ -+ Trace(("called MenuHook my_item_term (%s)", name)); -+ mvwprintw(status, 2, 0, "item_term %s", name); -+ wclrtoeol(status); -+ wrefresh(status); -+} -+ - static MENU * - menu_create(ITEM ** items, int count, int ncols, MenuNo number) - { -@@ -225,8 +258,8 @@ - result = new_menu(items); - - if (has_colors()) { -- set_menu_fore(result, COLOR_PAIR(1)); -- set_menu_back(result, COLOR_PAIR(2)); -+ set_menu_fore(result, (chtype) COLOR_PAIR(1)); -+ set_menu_back(result, (chtype) COLOR_PAIR(2)); - } - - set_menu_format(result, maxrow, maxcol); -@@ -252,6 +285,10 @@ - - post_menu(result); - -+ set_menu_init(result, my_menu_init); -+ set_menu_term(result, my_menu_term); -+ set_item_init(result, my_item_init); -+ set_item_term(result, my_item_term); - return result; - } - -@@ -281,12 +318,15 @@ - free((char *) blob); - } - free(items); -+ items = 0; - } - #ifdef TRACE - if ((count > 0) && (m == mpTrace)) { - ITEM **ip = items; -- while (*ip) -- free(*ip++); -+ if (ip != 0) { -+ while (*ip) -+ free(*ip++); -+ } - } - #endif - } -@@ -305,21 +345,24 @@ - static void - build_file_menu(MenuNo number) - { -- static CONST_MENUS char *labels[] = -+ static MENU_DATA table[] = - { -- "Exit", -- (char *) 0 -+ {"Exit", call_files, 0}, -+ {(char *) 0, 0, 0} - }; -- static ITEM *items[SIZEOF(labels)]; -+ static ITEM *items[SIZEOF(table)]; - - ITEM **ip = items; -- CONST_MENUS char **ap; -+ int n; - -- for (ap = labels; *ap; ap++) -- *ip++ = new_item(*ap, ""); -+ for (n = 0; table[n].name != 0; ++n) { -+ *ip = new_item(table[n].name, ""); -+ set_item_userptr(*ip, &table[n]); -+ ++ip; -+ } - *ip = (ITEM *) 0; - -- mpFile = menu_create(items, SIZEOF(labels) - 1, 1, number); -+ mpFile = menu_create(items, SIZEOF(table) - 1, 1, number); - } - - static int -@@ -331,31 +374,40 @@ - /*****************************************************************************/ - - static void -+call_select(int code) -+{ -+ (void) code; -+ Trace(("Selected item %d", code)); -+} -+ -+static void - build_select_menu(MenuNo number, char *filename) - { -- static CONST_MENUS char *labels[] = -+#define MY_DATA(name) { name, call_select, 0 } -+ static MENU_DATA table[] = - { -- "Lions", -- "Tigers", -- "Bears", -- "(Oh my!)", -- "Newts", -- "Platypi", -- "Lemurs", -- "(Oh really?!)", -- "Leopards", -- "Panthers", -- "Pumas", -- "Lions, Tigers, Bears, (Oh my!), Newts, Platypi, Lemurs", -- "Lions, Tigers, Bears, (Oh my!), Newts, Platypi, Lemurs, Lions, Tigers, Bears, (Oh my!), Newts, Platypi, Lemurs", -- (char *) 0 -+ MY_DATA("Lions"), -+ MY_DATA("Tigers"), -+ MY_DATA("Bears"), -+ MY_DATA("(Oh my!)"), -+ MY_DATA("Newts"), -+ MY_DATA("Platypi"), -+ MY_DATA("Lemurs"), -+ MY_DATA("(Oh really?!)"), -+ MY_DATA("Leopards"), -+ MY_DATA("Panthers"), -+ MY_DATA("Pumas"), -+ MY_DATA("Lions, Tigers, Bears, (Oh my!), Newts, Platypi, Lemurs"), -+ MY_DATA("Lions, Tigers, Bears, (Oh my!), Newts, Platypi, Lemurs, Lions, Tigers, Bears, (Oh my!), Newts, Platypi, Lemurs"), -+ {(char *) 0, 0, 0} - }; - static ITEM **items; - - ITEM **ip; -- CONST_MENUS char **ap = 0; -- CONST_MENUS char **myList = 0; -- unsigned count = 0; -+ MENU_DATA *ap = 0; -+ MENU_DATA *myList = 0; -+ int i; -+ size_t count = 0; - - if (filename != 0) { - struct stat sb; -@@ -365,7 +417,7 @@ - size_t size = (size_t) sb.st_size; - unsigned j, k; - char *blob = typeMalloc(char, size + 1); -- CONST_MENUS char **list = typeCalloc(CONST_MENUS char *, size + 1); -+ MENU_DATA *list = typeCalloc(MENU_DATA, size + 1); - - items = typeCalloc(ITEM *, size + 1); - Trace(("build_select_menu blob=%p, items=%p", -@@ -378,19 +430,19 @@ - bool mark = TRUE; - for (j = k = 0; j < size; ++j) { - if (mark) { -- list[k++] = blob + j; -+ list[k++].name = blob + j; - mark = FALSE; - } - if (blob[j] == '\n') { - blob[j] = '\0'; -- if (k > 0 && *list[k - 1] == '\0') -+ if (k > 0 && *list[k - 1].name == '\0') - --k; - mark = TRUE; - } else if (blob[j] == '\t') { - blob[j] = ' '; /* menu items are printable */ - } - } -- list[k] = 0; -+ list[k].name = 0; - count = k; - ap = myList = list; - } -@@ -398,17 +450,24 @@ - } - loaded_file = TRUE; - } -+ if (ap == 0) -+ free(items); - } - } - if (ap == 0) { -- count = SIZEOF(labels) - 1; -+ count = SIZEOF(table) - 1; - items = typeCalloc(ITEM *, count + 1); -- ap = labels; -+ ap = table; - } - - ip = items; -- while (*ap != 0) -- *ip++ = new_item(*ap++, ""); -+ for (i = 0; ap[i].name != 0; ++i) { -+ ap[i].func = call_select; -+ ap[i].mask = (unsigned) i; -+ *ip = new_item(ap[i].name, ""); -+ set_item_userptr(*ip, &table[i]); -+ ++ip; -+ } - *ip = 0; - - mpSelect = menu_create(items, (int) count, 1, number); -@@ -425,30 +484,36 @@ - /*****************************************************************************/ - - #ifdef TRACE --#define T_TBL(name) { #name, name } --static struct { -- const char *name; -- unsigned mask; --} t_tbl[] = { -+ -+static void -+call_trace(int code) -+{ -+ (void) code; -+ Trace(("Updating trace mask %d", code)); -+} -+ -+#define T_TBL(name) { #name, call_trace, name } -+static MENU_DATA t_tbl[] = -+{ - - T_TBL(TRACE_DISABLE), -- T_TBL(TRACE_TIMES), -- T_TBL(TRACE_TPUTS), -- T_TBL(TRACE_UPDATE), -- T_TBL(TRACE_MOVE), -- T_TBL(TRACE_CHARPUT), -- T_TBL(TRACE_ORDINARY), -- T_TBL(TRACE_CALLS), -- T_TBL(TRACE_VIRTPUT), -- T_TBL(TRACE_IEVENT), -- T_TBL(TRACE_BITS), -- T_TBL(TRACE_ICALLS), -- T_TBL(TRACE_CCALLS), -- T_TBL(TRACE_DATABASE), -- T_TBL(TRACE_ATTRS), -- T_TBL(TRACE_MAXIMUM), -+ T_TBL(TRACE_TIMES), -+ T_TBL(TRACE_TPUTS), -+ T_TBL(TRACE_UPDATE), -+ T_TBL(TRACE_MOVE), -+ T_TBL(TRACE_CHARPUT), -+ T_TBL(TRACE_ORDINARY), -+ T_TBL(TRACE_CALLS), -+ T_TBL(TRACE_VIRTPUT), -+ T_TBL(TRACE_IEVENT), -+ T_TBL(TRACE_BITS), -+ T_TBL(TRACE_ICALLS), -+ T_TBL(TRACE_CCALLS), -+ T_TBL(TRACE_DATABASE), -+ T_TBL(TRACE_ATTRS), -+ T_TBL(TRACE_MAXIMUM), - { -- (char *) 0, 0 -+ (char *) 0, 0, 0 - } - }; - -@@ -460,8 +525,11 @@ - ITEM **ip = items; - int n; - -- for (n = 0; t_tbl[n].name != 0; n++) -- *ip++ = new_item(t_tbl[n].name, ""); -+ for (n = 0; t_tbl[n].name != 0; n++) { -+ *ip = new_item(t_tbl[n].name, ""); -+ set_item_userptr(*ip, &t_tbl[n]); -+ ++ip; -+ } - *ip = (ITEM *) 0; - - mpTrace = menu_create(items, SIZEOF(t_tbl) - 1, 2, number); -@@ -527,7 +595,8 @@ - int result; - - for (ip = menu_items(mpTrace); *ip; ip++) { -- unsigned mask = t_tbl[item_index(*ip)].mask; -+ MENU_DATA *td = (MENU_DATA *) item_userptr(*ip); -+ unsigned mask = td->mask; - if (mask == 0) - set_item_value(*ip, _nc_tracing == 0); - else if ((mask & _nc_tracing) == mask) -@@ -540,15 +609,17 @@ - if (update_trace_menu(mpTrace) || cmd == REQ_TOGGLE_ITEM) { - newtrace = 0; - for (ip = menu_items(mpTrace); *ip; ip++) { -- if (item_value(*ip)) -- newtrace |= t_tbl[item_index(*ip)].mask; -+ if (item_value(*ip)) { -+ MENU_DATA *td = (MENU_DATA *) item_userptr(*ip); -+ newtrace |= td->mask; -+ } - } - trace(newtrace); - Trace(("trace level interactively set to %s", tracetrace(_nc_tracing))); - -- MvPrintw(LINES - 2, 0, -- "Trace level is %s\n", tracetrace(_nc_tracing)); -- refresh(); -+ MvWPrintw(status, 1, 0, -+ "Trace level is %s\n", tracetrace(_nc_tracing)); -+ wrefresh(status); - } - } - return result; -@@ -588,27 +659,37 @@ - } - - static void -+call_menus(int code) -+{ -+ (void) code; -+ Trace(("Activated menu %d\n", code)); -+} -+ -+static void - build_menus(char *filename) - { -- static CONST_MENUS char *labels[] = -+ static MENU_DATA table[] = - { -- "File", -- "Select", -+ {"File", call_menus, 0}, -+ {"Select", call_menus, 1}, - #ifdef TRACE -- "Trace", -+ {"Trace", call_menus, 2}, - #endif -- (char *) 0 -+ {(char *) 0, 0, 0} - }; -- static ITEM *items[SIZEOF(labels)]; -+ static ITEM *items[SIZEOF(table)]; - - ITEM **ip = items; -- CONST_MENUS char **ap; -+ int n; - -- for (ap = labels; *ap; ap++) -- *ip++ = new_item(*ap, ""); -+ for (n = 0; table[n].name != 0; ++n) { -+ *ip = new_item(table[n].name, ""); -+ set_item_userptr(*ip, &table[n]); -+ ++ip; -+ } - *ip = (ITEM *) 0; - -- mpBanner = menu_create(items, SIZEOF(labels) - 1, SIZEOF(labels) - 1, eBanner); -+ mpBanner = menu_create(items, SIZEOF(table) - 1, SIZEOF(table) - 1, eBanner); - set_menu_mark(mpBanner, ">"); - - build_file_menu(eFile); -@@ -671,14 +752,14 @@ - static void - show_status(int ch, MENU * menu) - { -- move(LINES - 1, 0); -- printw("key %s, menu %d, mark %s, match %s", -- keyname(ch), -- menu_number(), -- menu_mark(menu), -- menu_pattern(menu)); -- clrtoeol(); -- refresh(); -+ wmove(status, 0, 0); -+ wprintw(status, "key %s, menu %d, mark %s, match %s", -+ keyname(ch), -+ menu_number(), -+ menu_mark(menu), -+ menu_pattern(menu)); -+ wclrtoeol(status); -+ wrefresh(status); - } - - static void -@@ -777,9 +858,9 @@ - wrefresh(menu_win(last_menu)); - if (code == E_UNKNOWN_COMMAND - || code == E_NOT_POSTED) { -- if (menu_number() == eFile) -- break; -- beep(); -+ ITEM *item = current_item(last_menu); -+ MENU_DATA *td = (MENU_DATA *) item_userptr(item); -+ td->func((int) td->mask); - } - if (code == E_REQUEST_DENIED) - beep(); -@@ -827,11 +908,23 @@ - #endif /* HAVE_RIPOFFLINE */ - - static void -+call_files(int code) -+{ -+ switch (code) { -+ case 0: -+ destroy_menus(); -+ endwin(); -+ printf("DONE!\n"); -+ ExitProgram(EXIT_SUCCESS); -+ } -+} -+ -+static void - usage(void) - { - static const char *const tbl[] = - { -- "Usage: demo_menus [options]" -+ "Usage: demo_menus [options] [menu-file]" - ,"" - ,"Options:" - #if HAVE_RIPOFFLINE -@@ -867,7 +960,7 @@ - #endif /* HAVE_RIPOFFLINE */ - #ifdef TRACE - case 't': -- trace(strtoul(optarg, 0, 0)); -+ trace((unsigned) strtoul(optarg, 0, 0)); - break; - #endif - default: -@@ -885,6 +978,7 @@ - init_pair(1, COLOR_RED, COLOR_BLACK); - init_pair(2, COLOR_BLUE, COLOR_WHITE); - } -+ status = newwin(3, COLS, LINES - 3, 0); - build_menus(argc > 1 ? argv[1] : 0); - perform_menus(); - destroy_menus(); -diff -Naur ncurses-5.9/test/demo_termcap.c ncurses-5.9.patch/test/demo_termcap.c ---- ncurses-5.9/test/demo_termcap.c 2011-01-15 22:41:27.000000000 +0100 -+++ ncurses-5.9.patch/test/demo_termcap.c 2014-09-01 16:33:22.535792421 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 2005-2010,2011 Free Software Foundation, Inc. * -+ * Copyright (c) 2005-2012,2013 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -29,7 +29,7 @@ - /* - * Author: Thomas E. Dickey - * -- * $Id: demo_termcap.c,v 1.14 2011/01/15 21:41:27 tom Exp $ -+ * $Id: demo_termcap.c,v 1.24 2013/06/08 16:58:49 tom Exp $ - * - * A simple demo of the termcap interface. - */ -@@ -50,11 +50,90 @@ - #if USE_CODE_LISTS - static bool b_opt = FALSE; - static bool n_opt = FALSE; -+static bool q_opt = FALSE; - static bool s_opt = FALSE; - #endif - -+static char *d_opt; -+static char *e_opt; -+static char **db_list; -+static int db_item; -+ -+static long total_values; -+ - #define isCapName(c) (isgraph(c) && strchr("^#=:\\", c) == 0) - -+static char * -+make_dbitem(char *p, char *q) -+{ -+ char *result = malloc(strlen(e_opt) + 2 + (size_t) (p - q)); -+ sprintf(result, "%s=%.*s", e_opt, (int) (p - q), q); -+ return result; -+} -+ -+static void -+make_dblist(void) -+{ -+ if (d_opt && e_opt) { -+ int pass; -+ -+ for (pass = 0; pass < 2; ++pass) { -+ char *p, *q; -+ size_t count = 0; -+ -+ for (p = q = d_opt; *p != '\0'; ++p) { -+ if (*p == ':') { -+ if (p != q + 1) { -+ if (pass) { -+ db_list[count] = make_dbitem(p, q); -+ } -+ count++; -+ } -+ q = p + 1; -+ } -+ } -+ if (p != q + 1) { -+ if (pass) { -+ db_list[count] = make_dbitem(p, q); -+ } -+ count++; -+ } -+ if (!pass) { -+ db_list = typeCalloc(char *, count + 1); -+ } -+ } -+ } -+} -+ -+static char * -+next_dbitem(void) -+{ -+ char *result = 0; -+ -+ if (db_list) { -+ if ((result = db_list[db_item]) == 0) { -+ db_item = 0; -+ result = db_list[0]; -+ } else { -+ db_item++; -+ } -+ } -+ printf("** %s\n", result); -+ return result; -+} -+ -+static void -+free_dblist(void) -+{ -+ if (db_list) { -+ int n; -+ for (n = 0; db_list[n]; ++n) -+ free(db_list[n]); -+ free(db_list); -+ db_list = 0; -+ } -+} -+ - static void - dumpit(NCURSES_CONST char *cap) - { -@@ -70,66 +149,77 @@ - int num; - - if ((str = tgetstr(cap, &ap)) != 0) { -- /* -- * Note that the strings returned are mostly terminfo format, since -- * ncurses does not convert except for a handful of special cases. -- */ -- printf(FNAME(str), cap); -- while (*str != 0) { -- int ch = UChar(*str++); -- switch (ch) { -- case '\177': -- fputs("^?", stdout); -- break; -- case '\033': -- fputs("\\E", stdout); -- break; -- case '\b': -- fputs("\\b", stdout); -- break; -- case '\f': -- fputs("\\f", stdout); -- break; -- case '\n': -- fputs("\\n", stdout); -- break; -- case '\r': -- fputs("\\r", stdout); -- break; -- case ' ': -- fputs("\\s", stdout); -- break; -- case '\t': -- fputs("\\t", stdout); -- break; -- case '^': -- fputs("\\^", stdout); -- break; -- case ':': -- fputs("\\072", stdout); -- break; -- case '\\': -- fputs("\\\\", stdout); -- break; -- default: -- if (isgraph(ch)) -- fputc(ch, stdout); -- else if (ch < 32) -- printf("^%c", ch + '@'); -- else -- printf("\\%03o", ch); -- break; -+ total_values++; -+ if (!q_opt) { -+ /* -+ * Note that the strings returned are mostly terminfo format, since -+ * ncurses does not convert except for a handful of special cases. -+ */ -+ printf(FNAME(str), cap); -+ while (*str != 0) { -+ int ch = UChar(*str++); -+ switch (ch) { -+ case '\177': -+ fputs("^?", stdout); -+ break; -+ case '\033': -+ fputs("\\E", stdout); -+ break; -+ case '\b': -+ fputs("\\b", stdout); -+ break; -+ case '\f': -+ fputs("\\f", stdout); -+ break; -+ case '\n': -+ fputs("\\n", stdout); -+ break; -+ case '\r': -+ fputs("\\r", stdout); -+ break; -+ case ' ': -+ fputs("\\s", stdout); -+ break; -+ case '\t': -+ fputs("\\t", stdout); -+ break; -+ case '^': -+ fputs("\\^", stdout); -+ break; -+ case ':': -+ fputs("\\072", stdout); -+ break; -+ case '\\': -+ fputs("\\\\", stdout); -+ break; -+ default: -+ if (isgraph(ch)) -+ fputc(ch, stdout); -+ else if (ch < 32) -+ printf("^%c", ch + '@'); -+ else -+ printf("\\%03o", ch); -+ break; -+ } - } -+ printf("\n"); - } -- printf("\n"); - } else if ((num = tgetnum(cap)) >= 0) { -- printf(FNAME(num), cap); -- printf(" %d\n", num); -+ total_values++; -+ if (!q_opt) { -+ printf(FNAME(num), cap); -+ printf(" %d\n", num); -+ } - } else if (tgetflag(cap) > 0) { -- printf(FNAME(flg), cap); -- printf("%s\n", "true"); -+ ++total_values; -+ if (!q_opt) { -+ printf(FNAME(flg), cap); -+ printf("%s\n", "true"); -+ } - } -- fflush(stdout); -+ -+ if (!q_opt) -+ fflush(stdout); - } - - static void -@@ -137,6 +227,9 @@ - { - char buffer[1024]; - -+ if (db_list) { -+ putenv(next_dbitem()); -+ } - printf("Terminal type %s\n", name); - if (tgetent(buffer, name) >= 0) { - char cap[3]; -@@ -159,42 +252,43 @@ - - #if USE_CODE_LISTS - static void --demo_terminfo(NCURSES_CONST char *name) -+demo_termcap(NCURSES_CONST char *name) - { - unsigned n; - NCURSES_CONST char *cap; -+ char buffer[1024]; - -+ if (db_list) { -+ putenv(next_dbitem()); -+ } - printf("Terminal type \"%s\"\n", name); --#if HAVE_SETUPTERM -- setupterm(name, 1, (int *) 0); --#else -- setterm(name); --#endif -+ if (tgetent(buffer, name) >= 0) { - -- if (b_opt) { -- for (n = 0;; ++n) { -- cap = boolcodes[n]; -- if (cap == 0) -- break; -- dumpit(cap); -+ if (b_opt) { -+ for (n = 0;; ++n) { -+ cap = boolcodes[n]; -+ if (cap == 0) -+ break; -+ dumpit(cap); -+ } - } -- } - -- if (n_opt) { -- for (n = 0;; ++n) { -- cap = numcodes[n]; -- if (cap == 0) -- break; -- dumpit(cap); -+ if (n_opt) { -+ for (n = 0;; ++n) { -+ cap = numcodes[n]; -+ if (cap == 0) -+ break; -+ dumpit(cap); -+ } - } -- } - -- if (s_opt) { -- for (n = 0;; ++n) { -- cap = strcodes[n]; -- if (cap == 0) -- break; -- dumpit(cap); -+ if (s_opt) { -+ for (n = 0;; ++n) { -+ cap = strcodes[n]; -+ if (cap == 0) -+ break; -+ dumpit(cap); -+ } - } - } - } -@@ -204,7 +298,7 @@ - { - static const char *msg[] = - { -- "Usage: demo_terminfo [options] [terminal]", -+ "Usage: demo_termcap [options] [terminal]", - "", - "If no options are given, print all (boolean, numeric, string)", - "capabilities for the given terminal, using short names.", -@@ -212,9 +306,15 @@ - "Options:", - " -a try all names, print capabilities found", - " -b print boolean-capabilities", -+ " -d LIST colon-separated list of databases to use", -+ " -e NAME environment variable to set with -d option", - " -n print numeric-capabilities", -+ " -q quiet (prints only counts)", - " -r COUNT repeat for given count", - " -s print string-capabilities", -+#ifdef NCURSES_VERSION -+ " -y disable extended capabilities", -+#endif - }; - unsigned n; - for (n = 0; n < SIZEOF(msg); ++n) { -@@ -235,7 +335,7 @@ - int repeat; - int r_opt = 1; - -- while ((n = getopt(argc, argv, "abnr:s")) != -1) { -+ while ((n = getopt(argc, argv, "abd:e:nqr:sy")) != -1) { - switch (n) { - case 'a': - a_opt = TRUE; -@@ -243,9 +343,18 @@ - case 'b': - b_opt = TRUE; - break; -+ case 'd': -+ d_opt = optarg; -+ break; -+ case 'e': -+ e_opt = optarg; -+ break; - case 'n': - n_opt = TRUE; - break; -+ case 'q': -+ q_opt = TRUE; -+ break; - case 'r': - if ((r_opt = atoi(optarg)) <= 0) - usage(); -@@ -253,6 +362,11 @@ - case 's': - s_opt = TRUE; - break; -+#if NCURSES_XNAMES -+ case 'y': -+ use_extended_names(FALSE); -+ break; -+#endif - default: - usage(); - break; -@@ -268,6 +382,8 @@ - a_opt = TRUE; - #endif - -+ make_dblist(); -+ - if (a_opt) { - if (optind < argc) { - for (n = optind; n < argc; ++n) { -@@ -285,17 +401,21 @@ - for (repeat = 0; repeat < r_opt; ++repeat) { - if (optind < argc) { - for (n = optind; n < argc; ++n) { -- demo_terminfo(argv[n]); -+ demo_termcap(argv[n]); - } - } else if ((name = getenv("TERM")) != 0) { -- demo_terminfo(name); -+ demo_termcap(name); - } else { - static char dumb[] = "dumb"; -- demo_terminfo(dumb); -+ demo_termcap(dumb); - } - } - } --#endif -+#endif /* USE_CODE_LISTS */ -+ -+ printf("%ld values\n", total_values); -+ -+ free_dblist(); - - ExitProgram(EXIT_SUCCESS); - } -@@ -306,6 +426,6 @@ - char *argv[]GCC_UNUSED) - { - printf("This program requires termcap\n"); -- exit(EXIT_FAILURE); -+ ExitProgram(EXIT_FAILURE); - } - #endif -diff -Naur ncurses-5.9/test/demo_terminfo.c ncurses-5.9.patch/test/demo_terminfo.c ---- ncurses-5.9/test/demo_terminfo.c 2010-11-28 01:15:27.000000000 +0100 -+++ ncurses-5.9.patch/test/demo_terminfo.c 2014-09-01 16:33:22.535792421 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 2009-2012,2013 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -29,20 +29,19 @@ - /* - * Author: Thomas E. Dickey - * -- * $Id: demo_terminfo.c,v 1.9 2010/11/28 00:15:27 tom Exp $ -+ * $Id: demo_terminfo.c,v 1.19 2013/09/28 21:50:01 tom Exp $ - * - * A simple demo of the terminfo interface. - */ - #define USE_TINFO - #include <test.priv.h> - --#ifdef NCURSES_VERSION --#if !(defined(HAVE_TERM_ENTRY_H) && HAVE_TERM_ENTRY_H) --#undef NCURSES_XNAMES --#define NCURSES_XNAMES 0 --#endif - #if NCURSES_XNAMES -+#if HAVE_TERM_ENTRY_H - #include <term_entry.h> -+#else -+#undef NCURSES_XNAMES -+#define NCURSES_XNAMES 0 - #endif - #endif - -@@ -52,12 +51,90 @@ - static bool b_opt = FALSE; - static bool f_opt = FALSE; - static bool n_opt = FALSE; -+static bool q_opt = FALSE; - static bool s_opt = FALSE; - static bool x_opt = FALSE; - -+static char *d_opt; -+static char *e_opt; -+static char **db_list; -+static int db_item; -+ -+static long total_values; -+ - #define FCOLS 8 - #define FNAME(type) "%s %-*s = ", #type, FCOLS - -+static char * -+make_dbitem(char *p, char *q) -+{ -+ char *result = malloc(strlen(e_opt) + 2 + (size_t) (p - q)); -+ sprintf(result, "%s=%.*s", e_opt, (int) (p - q), q); -+ return result; -+} -+ -+static void -+make_dblist(void) -+{ -+ if (d_opt && e_opt) { -+ int pass; -+ -+ for (pass = 0; pass < 2; ++pass) { -+ char *p, *q; -+ size_t count = 0; -+ -+ for (p = q = d_opt; *p != '\0'; ++p) { -+ if (*p == ':') { -+ if (p != q + 1) { -+ if (pass) { -+ db_list[count] = make_dbitem(p, q); -+ } -+ count++; -+ } -+ q = p + 1; -+ } -+ } -+ if (p != q + 1) { -+ if (pass) { -+ db_list[count] = make_dbitem(p, q); -+ } -+ count++; -+ } -+ if (!pass) { -+ db_list = typeCalloc(char *, count + 1); -+ } -+ } -+ } -+} -+ -+static char * -+next_dbitem(void) -+{ -+ char *result = 0; -+ -+ if (db_list) { -+ if ((result = db_list[db_item]) == 0) { -+ db_item = 0; -+ result = db_list[0]; -+ } else { -+ db_item++; -+ } -+ } -+ printf("** %s\n", result); -+ return result; -+} -+ -+static void -+free_dblist(void) -+{ -+ if (db_list) { -+ int n; -+ for (n = 0; db_list[n]; ++n) -+ free(db_list[n]); -+ free(db_list); -+ db_list = 0; -+ } -+} - static void - dumpit(NCURSES_CONST char *cap) - { -@@ -72,66 +149,77 @@ - int num; - - if ((str = tigetstr(cap)) != 0 && (str != (char *) -1)) { -- /* -- * Note that the strings returned are mostly terminfo format, since -- * ncurses does not convert except for a handful of special cases. -- */ -- printf(FNAME(str), cap); -- while (*str != 0) { -- int ch = UChar(*str++); -- switch (ch) { -- case '\177': -- fputs("^?", stdout); -- break; -- case '\033': -- fputs("\\E", stdout); -- break; -- case '\b': -- fputs("\\b", stdout); -- break; -- case '\f': -- fputs("\\f", stdout); -- break; -- case '\n': -- fputs("\\n", stdout); -- break; -- case '\r': -- fputs("\\r", stdout); -- break; -- case ' ': -- fputs("\\s", stdout); -- break; -- case '\t': -- fputs("\\t", stdout); -- break; -- case '^': -- fputs("\\^", stdout); -- break; -- case ':': -- fputs("\\072", stdout); -- break; -- case '\\': -- fputs("\\\\", stdout); -- break; -- default: -- if (isgraph(ch)) -- fputc(ch, stdout); -- else if (ch < 32) -- printf("^%c", ch + '@'); -- else -- printf("\\%03o", ch); -- break; -+ total_values++; -+ if (!q_opt) { -+ /* -+ * Note that the strings returned are mostly terminfo format, since -+ * ncurses does not convert except for a handful of special cases. -+ */ -+ printf(FNAME(str), cap); -+ while (*str != 0) { -+ int ch = UChar(*str++); -+ switch (ch) { -+ case '\177': -+ fputs("^?", stdout); -+ break; -+ case '\033': -+ fputs("\\E", stdout); -+ break; -+ case '\b': -+ fputs("\\b", stdout); -+ break; -+ case '\f': -+ fputs("\\f", stdout); -+ break; -+ case '\n': -+ fputs("\\n", stdout); -+ break; -+ case '\r': -+ fputs("\\r", stdout); -+ break; -+ case ' ': -+ fputs("\\s", stdout); -+ break; -+ case '\t': -+ fputs("\\t", stdout); -+ break; -+ case '^': -+ fputs("\\^", stdout); -+ break; -+ case ':': -+ fputs("\\072", stdout); -+ break; -+ case '\\': -+ fputs("\\\\", stdout); -+ break; -+ default: -+ if (isgraph(ch)) -+ fputc(ch, stdout); -+ else if (ch < 32) -+ printf("^%c", ch + '@'); -+ else -+ printf("\\%03o", ch); -+ break; -+ } - } -+ printf("\n"); - } -- printf("\n"); - } else if ((num = tigetnum(cap)) >= 0) { -- printf(FNAME(num), cap); -- printf(" %d\n", num); -+ total_values++; -+ if (!q_opt) { -+ printf(FNAME(num), cap); -+ printf(" %d\n", num); -+ } - } else if ((num = tigetflag(cap)) >= 0) { -- printf(FNAME(flg), cap); -- printf("%s\n", num ? "true" : "false"); -+ total_values++; -+ if (!q_opt) { -+ printf(FNAME(flg), cap); -+ printf("%s\n", num ? "true" : "false"); -+ } - } -- fflush(stdout); -+ -+ if (!q_opt) -+ fflush(stdout); - } - - static void -@@ -140,6 +228,9 @@ - unsigned n; - NCURSES_CONST char *cap; - -+ if (db_list) { -+ putenv(next_dbitem()); -+ } - printf("Terminal type \"%s\"\n", name); - setupterm(name, 1, (int *) 0); - -@@ -191,7 +282,7 @@ - } - #endif - } else { -- char temp[10]; -+ char temp[80]; - static const char *xterm_keys[] = - { - "kDC", "kDN", "kEND", "kHOM", "kIC", -@@ -200,9 +291,9 @@ - for (n = 0; n < SIZEOF(xterm_keys); ++n) { - for (mod = 0; mod < 8; ++mod) { - if (mod == 0) -- strcpy(temp, xterm_keys[n]); -+ sprintf(temp, "%.*s", 8, xterm_keys[n]); - else -- sprintf(temp, "%s%d", xterm_keys[n], mod); -+ sprintf(temp, "%.*s%d", 8, xterm_keys[n], mod); - dumpit(temp); - } - } -@@ -224,12 +315,16 @@ - "", - "Options:", - " -b print boolean-capabilities", -+ " -d LIST colon-separated list of databases to use", -+ " -e NAME environment variable to set with -d option", - " -f print full names", - " -n print numeric-capabilities", -+ " -q quiet (prints only counts)", - " -r COUNT repeat for given count", - " -s print string-capabilities", - #ifdef NCURSES_VERSION - " -x print extended capabilities", -+ " -y disable extended capabilities", - #endif - }; - unsigned n; -@@ -246,18 +341,30 @@ - int repeat; - char *name; - int r_opt = 1; -+#ifdef NCURSES_VERSION -+ bool xy_opt = TRUE; /* by default, use_extended_names is true */ -+#endif - -- while ((n = getopt(argc, argv, "bfnr:sx")) != -1) { -+ while ((n = getopt(argc, argv, "bd:e:fnqr:sxy")) != -1) { - switch (n) { - case 'b': - b_opt = TRUE; - break; -+ case 'd': -+ d_opt = optarg; -+ break; -+ case 'e': -+ e_opt = optarg; -+ break; - case 'f': - f_opt = TRUE; - break; - case 'n': - n_opt = TRUE; - break; -+ case 'q': -+ q_opt = TRUE; -+ break; - case 'r': - if ((r_opt = atoi(optarg)) <= 0) - usage(); -@@ -268,7 +375,10 @@ - #ifdef NCURSES_VERSION - case 'x': - x_opt = TRUE; -- use_extended_names(TRUE); -+ xy_opt = TRUE; -+ break; -+ case 'y': -+ xy_opt = FALSE; - break; - #endif - default: -@@ -277,12 +387,18 @@ - } - } - -+#if NCURSES_XNAMES -+ use_extended_names(xy_opt); -+#endif -+ - if (!(b_opt || n_opt || s_opt || x_opt)) { - b_opt = TRUE; - n_opt = TRUE; - s_opt = TRUE; - } - -+ make_dblist(); -+ - for (repeat = 0; repeat < r_opt; ++repeat) { - if (optind < argc) { - for (n = optind; n < argc; ++n) { -@@ -296,6 +412,10 @@ - } - } - -+ printf("%ld values\n", total_values); -+ -+ free_dblist(); -+ - ExitProgram(EXIT_SUCCESS); - } - -diff -Naur ncurses-5.9/test/ditto.c ncurses-5.9.patch/test/ditto.c ---- ncurses-5.9/test/ditto.c 2010-11-14 02:06:47.000000000 +0100 -+++ ncurses-5.9.patch/test/ditto.c 2014-09-01 16:33:22.535792421 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -29,7 +29,7 @@ - /* - * Author: Thomas E. Dickey (1998-on) - * -- * $Id: ditto.c,v 1.40 2010/11/14 01:06:47 tom Exp $ -+ * $Id: ditto.c,v 1.42 2012/11/24 20:16:18 tom Exp $ - * - * The program illustrates how to set up multiple screens from a single - * program. -@@ -80,6 +80,7 @@ - int which1; /* this screen's index in DITTO[] array */ - int length; /* length of windows[] and peeks[] */ - char **titles; /* per-window titles */ -+ WINDOW **parents; /* display boxes around each screen's data */ - WINDOW **windows; /* display data from each screen */ - PEEK *peeks; /* indices for each screen's fifo */ - FIFO fifo; /* fifo for this screen */ -@@ -98,6 +99,9 @@ - DITTO *ditto; /* data for all screens */ - } DDATA; - -+static void failed(const char *) GCC_NORETURN; -+static void usage(void) GCC_NORETURN; -+ - static void - failed(const char *s) - { -@@ -201,6 +205,7 @@ - scrollok(stdscr, TRUE); - box(stdscr, 0, 0); - -+ target->parents = typeCalloc(WINDOW *, (size_t) target->length); - target->windows = typeCalloc(WINDOW *, (size_t) target->length); - target->peeks = typeCalloc(PEEK, (size_t) target->length); - -@@ -220,6 +225,7 @@ - nodelay(inner, TRUE); - #endif - -+ target->parents[k] = outer; - target->windows[k] = inner; - } - doupdate(); -diff -Naur ncurses-5.9/test/dots.c ncurses-5.9.patch/test/dots.c ---- ncurses-5.9/test/dots.c 2010-11-14 02:00:02.000000000 +0100 -+++ ncurses-5.9.patch/test/dots.c 2014-09-01 16:33:22.536792422 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1999-2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1999-2011,2013 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -29,7 +29,7 @@ - /* - * Author: Thomas E. Dickey <dickey@clark.net> 1999 - * -- * $Id: dots.c,v 1.22 2010/11/14 01:00:02 tom Exp $ -+ * $Id: dots.c,v 1.25 2013/09/28 22:12:09 tom Exp $ - * - * A simple demo of the terminfo interface. - */ -@@ -46,23 +46,23 @@ - static long total_chars = 0; - static time_t started; - --static int --outc(TPUTS_ARG c) -+static -+TPUTS_PROTO(outc, c) - { - int rc = c; - - if (interrupted) { - char tmp = (char) c; -- if (write(STDOUT_FILENO, &tmp, 1) == -1) -+ if (write(STDOUT_FILENO, &tmp, (size_t) 1) == -1) - rc = EOF; - } else { - rc = putc(c, stdout); - } -- return rc; -+ TPUTS_RETURN(rc); - } - - static bool --outs(char *s) -+outs(const char *s) - { - if (valid(s)) { - tputs(s, 1, outc); -@@ -105,6 +105,7 @@ - int x, y, z, p; - double r; - double c; -+ int my_colors; - - CATCHALL(onsig); - -@@ -112,11 +113,12 @@ - setupterm((char *) 0, 1, (int *) 0); - outs(clear_screen); - outs(cursor_invisible); -- if (max_colors > 1) { -+ my_colors = max_colors; -+ if (my_colors > 1) { - if (!valid(set_a_foreground) - || !valid(set_a_background) - || (!valid(orig_colors) && !valid(orig_pair))) -- max_colors = -1; -+ my_colors = -1; - } - - r = (double) (lines - 4); -@@ -129,8 +131,8 @@ - p = (ranf() > 0.9) ? '*' : ' '; - - tputs(tparm3(cursor_address, y, x), 1, outc); -- if (max_colors > 0) { -- z = (int) (ranf() * max_colors); -+ if (my_colors > 0) { -+ z = (int) (ranf() * my_colors); - if (ranf() > 0.01) { - tputs(tparm2(set_a_foreground, z), 1, outc); - } else { -diff -Naur ncurses-5.9/test/dots_mvcur.c ncurses-5.9.patch/test/dots_mvcur.c ---- ncurses-5.9/test/dots_mvcur.c 2010-11-14 02:00:44.000000000 +0100 -+++ ncurses-5.9.patch/test/dots_mvcur.c 2014-09-01 16:33:22.536792422 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 2007-2008,2009 Free Software Foundation, Inc. * -+ * Copyright (c) 2007-2009,2013 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -29,7 +29,7 @@ - /* - * Author: Thomas E. Dickey - 2007 - * -- * $Id: dots_mvcur.c,v 1.6 2010/11/14 01:00:44 tom Exp $ -+ * $Id: dots_mvcur.c,v 1.10 2013/09/28 22:44:18 tom Exp $ - * - * A simple demo of the terminfo interface, and mvcur. - */ -@@ -46,24 +46,24 @@ - static long total_chars = 0; - static time_t started; - --static int --outc(TPUTS_ARG c) -+static -+TPUTS_PROTO(outc, c) - { - int rc = c; - - if (interrupted) { - char tmp = (char) c; -- if (write(STDOUT_FILENO, &tmp, 1) == -1) -+ if (write(STDOUT_FILENO, &tmp, (size_t) 1) == -1) - rc = EOF; - } else { - if (putc(c, stdout) == EOF) - rc = EOF; - } -- return rc; -+ TPUTS_RETURN(rc); - } - - static bool --outs(char *s) -+outs(const char *s) - { - if (valid(s)) { - tputs(s, 1, outc); -@@ -108,6 +108,7 @@ - double r; - double c; - SCREEN *sp; -+ int my_colors; - - CATCHALL(onsig); - -@@ -116,11 +117,12 @@ - outs(clear_screen); - outs(cursor_home); - outs(cursor_invisible); -- if (max_colors > 1) { -+ my_colors = max_colors; -+ if (my_colors > 1) { - if (!valid(set_a_foreground) - || !valid(set_a_background) - || (!valid(orig_colors) && !valid(orig_pair))) -- max_colors = -1; -+ my_colors = -1; - } - - r = (double) (lines - 4); -@@ -137,8 +139,8 @@ - y0 = y; - } - -- if (max_colors > 0) { -- z = (int) (ranf() * max_colors); -+ if (my_colors > 0) { -+ z = (int) (ranf() * my_colors); - if (ranf() > 0.01) { - tputs(tparm2(set_a_foreground, z), 1, outc); - } else { -@@ -155,6 +157,7 @@ - } - } - outc(p); -+ ++x0; - fflush(stdout); - ++total_chars; - } -diff -Naur ncurses-5.9/test/dots_termcap.c ncurses-5.9.patch/test/dots_termcap.c ---- ncurses-5.9/test/dots_termcap.c 1970-01-01 01:00:00.000000000 +0100 -+++ ncurses-5.9.patch/test/dots_termcap.c 2014-09-01 16:33:22.536792422 +0200 -@@ -0,0 +1,254 @@ -+/**************************************************************************** -+ * Copyright (c) 2013 Free Software Foundation, Inc. * -+ * * -+ * Permission is hereby granted, free of charge, to any person obtaining a * -+ * copy of this software and associated documentation files (the * -+ * "Software"), to deal in the Software without restriction, including * -+ * without limitation the rights to use, copy, modify, merge, publish, * -+ * distribute, distribute with modifications, sublicense, and/or sell * -+ * copies of the Software, and to permit persons to whom the Software is * -+ * furnished to do so, subject to the following conditions: * -+ * * -+ * The above copyright notice and this permission notice shall be included * -+ * in all copies or substantial portions of the Software. * -+ * * -+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * -+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * -+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * -+ * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * -+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * -+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * -+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * -+ * * -+ * Except as contained in this notice, the name(s) of the above copyright * -+ * holders shall not be used in advertising or otherwise to promote the * -+ * sale, use or other dealings in this Software without prior written * -+ * authorization. * -+ ****************************************************************************/ -+ -+/* -+ * Author: Thomas E. Dickey -+ * -+ * $Id: dots_termcap.c,v 1.7 2013/09/28 21:50:35 tom Exp $ -+ * -+ * A simple demo of the termcap interface. -+ */ -+#define USE_TINFO -+#include <test.priv.h> -+ -+#if !defined(__MINGW32__) -+#include <sys/time.h> -+#endif -+ -+#if HAVE_TGETENT -+ -+#include <time.h> -+ -+#define valid(s) ((s != 0) && s != (char *)-1) -+ -+static bool interrupted = FALSE; -+static long total_chars = 0; -+static time_t started; -+ -+static char *t_AB; -+static char *t_AF; -+static char *t_cl; -+static char *t_cm; -+static char *t_me; -+static char *t_mr; -+static char *t_oc; -+static char *t_op; -+static char *t_ve; -+static char *t_vi; -+ -+static struct { -+ const char *name; -+ char **value; -+} my_caps[] = { -+ -+ { -+ "AB", &t_AB -+ }, -+ { -+ "AF", &t_AF -+ }, -+ { -+ "cl", &t_cl -+ }, -+ { -+ "cm", &t_cm -+ }, -+ { -+ "me", &t_me -+ }, -+ { -+ "mr", &t_mr -+ }, -+ { -+ "oc", &t_oc -+ }, -+ { -+ "op", &t_op -+ }, -+ { -+ "ve", &t_ve -+ }, -+ { -+ "vi", &t_vi -+ }, -+}; -+ -+static -+TPUTS_PROTO(outc, c) -+{ -+ int rc = c; -+ -+ if (interrupted) { -+ char tmp = (char) c; -+ if (write(STDOUT_FILENO, &tmp, (size_t) 1) == -1) -+ rc = EOF; -+ } else { -+ rc = putc(c, stdout); -+ } -+ TPUTS_RETURN(rc); -+} -+ -+static bool -+outs(char *s) -+{ -+ if (valid(s)) { -+ tputs(s, 1, outc); -+ return TRUE; -+ } -+ return FALSE; -+} -+ -+static void -+cleanup(void) -+{ -+ outs(t_me); -+ if (!outs(t_oc)) -+ outs(t_op); -+ outs(t_cl); -+ outs(t_ve); -+ -+ printf("\n\n%ld total chars, rate %.2f/sec\n", -+ total_chars, -+ ((double) (total_chars) / (double) (time((time_t *) 0) - started))); -+} -+ -+static void -+onsig(int n GCC_UNUSED) -+{ -+ interrupted = TRUE; -+} -+ -+static double -+ranf(void) -+{ -+ long r = (rand() & 077777); -+ return ((double) r / 32768.); -+} -+ -+static void -+my_napms(int ms) -+{ -+#if defined(__MINGW32__) || !HAVE_GETTIMEOFDAY -+ Sleep(ms); -+#else -+ struct timeval data; -+ data.tv_sec = 0; -+ data.tv_usec = ms * 1000; -+ select(0, NULL, NULL, NULL, &data); -+#endif -+} -+ -+int -+main(int argc GCC_UNUSED, -+ char *argv[]GCC_UNUSED) -+{ -+ int x, y, z, p; -+ int num_colors; -+ int num_lines; -+ int num_columns; -+ double r; -+ double c; -+ char buffer[1024]; -+ char area[1024]; -+ char *name; -+ -+ CATCHALL(onsig); -+ -+ srand((unsigned) time(0)); -+ -+ if ((name = getenv("TERM")) == 0) { -+ fprintf(stderr, "TERM is not set\n"); -+ ExitProgram(EXIT_FAILURE); -+ } else if (tgetent(buffer, name) < 0) { -+ fprintf(stderr, "terminal description not found\n"); -+ ExitProgram(EXIT_FAILURE); -+ } else { -+ size_t t; -+ char *ap = area; -+ for (t = 0; t < SIZEOF(my_caps); ++t) { -+ *(my_caps[t].value) = tgetstr((NCURSES_CONST char *) -+ my_caps[t].name, &ap); -+ } -+ } -+ -+ num_colors = tgetnum("Co"); -+ num_lines = tgetnum("li"); -+ num_columns = tgetnum("co"); -+ -+ outs(t_cl); -+ outs(t_vi); -+ if (num_colors > 1) { -+ if (!valid(t_AF) -+ || !valid(t_AB) -+ || (!valid(t_oc) && !valid(t_op))) -+ num_colors = -1; -+ } -+ -+ r = (double) (num_lines - 4); -+ c = (double) (num_columns - 4); -+ started = time((time_t *) 0); -+ -+ while (!interrupted) { -+ x = (int) (c * ranf()) + 2; -+ y = (int) (r * ranf()) + 2; -+ p = (ranf() > 0.9) ? '*' : ' '; -+ -+ tputs(tgoto(t_cm, x, y), 1, outc); -+ if (num_colors > 0) { -+ z = (int) (ranf() * num_colors); -+ if (ranf() > 0.01) { -+ tputs(tgoto(t_AF, 0, z), 1, outc); -+ } else { -+ tputs(tgoto(t_AB, 0, z), 1, outc); -+ my_napms(1); -+ } -+ } else if (valid(t_me) -+ && valid(t_mr)) { -+ if (ranf() <= 0.01) { -+ outs((ranf() > 0.6) -+ ? t_mr -+ : t_me); -+ my_napms(1); -+ } -+ } -+ outc(p); -+ fflush(stdout); -+ ++total_chars; -+ } -+ cleanup(); -+ ExitProgram(EXIT_SUCCESS); -+} -+#else -+int -+main(int argc GCC_UNUSED, -+ char *argv[]GCC_UNUSED) -+{ -+ fprintf(stderr, "This program requires termcap\n"); -+ exit(EXIT_FAILURE); -+} -+#endif -diff -Naur ncurses-5.9/test/echochar.c ncurses-5.9.patch/test/echochar.c ---- ncurses-5.9/test/echochar.c 2010-11-14 02:00:44.000000000 +0100 -+++ ncurses-5.9.patch/test/echochar.c 2014-09-01 16:33:22.536792422 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 2006-2008,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 2006-2010,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -26,7 +26,7 @@ - * authorization. * - ****************************************************************************/ - /* -- * $Id: echochar.c,v 1.8 2010/11/14 01:00:44 tom Exp $ -+ * $Id: echochar.c,v 1.9 2012/06/09 20:30:32 tom Exp $ - * - * Demonstrate the echochar function (compare to dots.c). - * Thomas Dickey - 2006/11/4 -@@ -74,7 +74,7 @@ - (short) fg, - (short) bg); - } -- attron(COLOR_PAIR(pair)); -+ attron((attr_t) COLOR_PAIR(pair)); - } - - int -diff -Naur ncurses-5.9/test/edit_field.c ncurses-5.9.patch/test/edit_field.c ---- ncurses-5.9/test/edit_field.c 2011-01-15 19:15:11.000000000 +0100 -+++ ncurses-5.9.patch/test/edit_field.c 2014-09-01 16:33:22.536792422 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 2003-2008,2011 Free Software Foundation, Inc. * -+ * Copyright (c) 2003-2011,2013 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -26,11 +26,11 @@ - * authorization. * - ****************************************************************************/ - /* -- * $Id: edit_field.c,v 1.17 2011/01/15 18:15:11 tom Exp $ -+ * $Id: edit_field.c,v 1.22 2013/09/28 22:02:17 tom Exp $ - * - * A wrapper for form_driver() which keeps track of the user's editing changes -- * for each field, and makes the result available as a null-terminated string -- * in field_buffer(field,1). -+ * for each field, and makes the resulting length available as a -+ * null-terminated string in field_buffer(field,1). - * - * Thomas Dickey - 2003/4/26. - */ -@@ -297,8 +297,49 @@ - static void - inactive_field(FIELD * f) - { -- FieldAttrs *ptr = (FieldAttrs *) field_userptr(f); -- set_field_back(f, ptr->background); -+ set_field_back(f, field_attrs(f)->background); -+} -+ -+FieldAttrs * -+field_attrs(FIELD * f) -+{ -+ return (FieldAttrs *) field_userptr(f); -+} -+ -+static int -+buffer_length(FIELD * f) -+{ -+ return field_attrs(f)->row_lengths[0]; -+} -+ -+static void -+set_buffer_length(FIELD * f, int length) -+{ -+ field_attrs(f)->row_lengths[0] = length; -+} -+ -+/* -+ * The userptr is used in edit_field.c's inactive_field(), as well as for -+ * keeping track of the actual lengths of lines in a multiline field. -+ */ -+void -+init_edit_field(FIELD * f, char *value) -+{ -+ FieldAttrs *ptr = field_attrs(f); -+ if (ptr == 0) { -+ int rows, cols, frow, fcol, nrow, nbuf; -+ -+ ptr = typeCalloc(FieldAttrs, (size_t) 1); -+ ptr->background = field_back(f); -+ if (field_info(f, &rows, &cols, &frow, &fcol, &nrow, &nbuf) == E_OK) { -+ ptr->row_count = nrow; -+ ptr->row_lengths = typeCalloc(int, (size_t) nrow + 1); -+ } -+ } -+ set_field_userptr(f, (void *) ptr); -+ set_field_buffer(f, 0, value); /* will be formatted */ -+ set_field_buffer(f, 1, value); /* will be unformatted */ -+ set_buffer_length(f, (int) strlen(value)); - } - - int -@@ -308,9 +349,7 @@ - int status; - FIELD *before; - unsigned n; -- char lengths[80]; - int length; -- char *buffer; - int before_row; - int before_col; - int before_off = offset_in_field(form); -@@ -337,9 +376,7 @@ - if (status == E_OK) { - bool modified = TRUE; - -- length = 0; -- if ((buffer = field_buffer(before, 1)) != 0) -- length = atoi(buffer); -+ length = buffer_length(before); - if (length < before_off) - length = before_off; - switch (*result) { -@@ -445,8 +482,7 @@ - < MIN_FORM_COMMAND) - ++length; - -- sprintf(lengths, "%d", length); -- set_field_buffer(before, 1, lengths); -+ set_buffer_length(before, length); - } - - if (current_field(form) != before) -diff -Naur ncurses-5.9/test/edit_field.h ncurses-5.9.patch/test/edit_field.h ---- ncurses-5.9/test/edit_field.h 2008-12-20 20:23:18.000000000 +0100 -+++ ncurses-5.9.patch/test/edit_field.h 2014-09-01 16:33:22.536792422 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 2003-2006,2008 Free Software Foundation, Inc. * -+ * Copyright (c) 2003-2008,2013 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -26,7 +26,7 @@ - * authorization. * - ****************************************************************************/ - /* -- * $Id: edit_field.h,v 1.6 2008/12/20 19:23:18 tom Exp $ -+ * $Id: edit_field.h,v 1.9 2013/06/08 15:46:01 tom Exp $ - * - * Interface of edit_field.c - */ -@@ -45,8 +45,12 @@ - - typedef struct { - chtype background; -+ int row_count; -+ int *row_lengths; - } FieldAttrs; - -+extern FieldAttrs *field_attrs(FIELD * field); -+extern void init_edit_field(FIELD * field, char *value); - extern void help_edit_field(void); - extern int edit_field(FORM * form, int *result); - -diff -Naur ncurses-5.9/test/filter.c ncurses-5.9.patch/test/filter.c ---- ncurses-5.9/test/filter.c 2010-11-13 21:55:54.000000000 +0100 -+++ ncurses-5.9.patch/test/filter.c 2014-09-01 16:33:22.536792422 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2008,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -29,7 +29,7 @@ - /* - * Author: Thomas E. Dickey <dickey@clark.net> 1998 - * -- * $Id: filter.c,v 1.13 2010/11/13 20:55:54 tom Exp $ -+ * $Id: filter.c,v 1.15 2012/06/09 20:30:32 tom Exp $ - */ - #include <test.priv.h> - -@@ -133,7 +133,7 @@ - background = -1; - #endif - init_pair(1, COLOR_CYAN, (short) background); -- underline = COLOR_PAIR(1); -+ underline = (attr_t) COLOR_PAIR(1); - } else { - underline = A_UNDERLINE; - } -@@ -143,7 +143,7 @@ - reset_shell_mode(); - printf("\n"); - fflush(stdout); -- system(buffer); -+ IGNORE_RC(system(buffer)); - reset_prog_mode(); - touchwin(stdscr); - erase(); -diff -Naur ncurses-5.9/test/firework.c ncurses-5.9.patch/test/firework.c ---- ncurses-5.9/test/firework.c 2010-11-13 21:58:25.000000000 +0100 -+++ ncurses-5.9.patch/test/firework.c 2014-09-01 16:33:22.536792422 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2010,2013 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -26,7 +26,7 @@ - * authorization. * - ****************************************************************************/ - /* -- * $Id: firework.c,v 1.27 2010/11/13 20:58:25 tom Exp $ -+ * $Id: firework.c,v 1.29 2013/04/27 19:46:53 tom Exp $ - */ - #include <test.priv.h> - -@@ -41,7 +41,7 @@ - endwin(); - } - --static RETSIGTYPE -+static void - onsig(int n GCC_UNUSED) - { - cleanup(); -@@ -94,14 +94,14 @@ - showit(); - - init_pair(1, get_colour(&bold), my_bg); -- (void) attrset(COLOR_PAIR(1) | bold); -+ (void) attrset((chtype) COLOR_PAIR(1) | bold); - MvPrintw(row - 1, col - 1, " - "); - MvPrintw(row + 0, col - 1, "-+-"); - MvPrintw(row + 1, col - 1, " - "); - showit(); - - init_pair(1, get_colour(&bold), my_bg); -- (void) attrset(COLOR_PAIR(1) | bold); -+ (void) attrset((chtype) COLOR_PAIR(1) | bold); - MvPrintw(row - 2, col - 2, " --- "); - MvPrintw(row - 1, col - 2, "-+++-"); - MvPrintw(row + 0, col - 2, "-+#+-"); -@@ -110,7 +110,7 @@ - showit(); - - init_pair(1, get_colour(&bold), my_bg); -- (void) attrset(COLOR_PAIR(1) | bold); -+ (void) attrset((chtype) COLOR_PAIR(1) | bold); - MvPrintw(row - 2, col - 2, " +++ "); - MvPrintw(row - 1, col - 2, "++#++"); - MvPrintw(row + 0, col - 2, "+# #+"); -@@ -119,7 +119,7 @@ - showit(); - - init_pair(1, get_colour(&bold), my_bg); -- (void) attrset(COLOR_PAIR(1) | bold); -+ (void) attrset((chtype) COLOR_PAIR(1) | bold); - MvPrintw(row - 2, col - 2, " # "); - MvPrintw(row - 1, col - 2, "## ##"); - MvPrintw(row + 0, col - 2, "# #"); -@@ -128,7 +128,7 @@ - showit(); - - init_pair(1, get_colour(&bold), my_bg); -- (void) attrset(COLOR_PAIR(1) | bold); -+ (void) attrset((chtype) COLOR_PAIR(1) | bold); - MvPrintw(row - 2, col - 2, " # # "); - MvPrintw(row - 1, col - 2, "# #"); - MvPrintw(row + 0, col - 2, " "); -diff -Naur ncurses-5.9/test/form_driver_w.c ncurses-5.9.patch/test/form_driver_w.c ---- ncurses-5.9/test/form_driver_w.c 1970-01-01 01:00:00.000000000 +0100 -+++ ncurses-5.9.patch/test/form_driver_w.c 2014-09-01 16:33:22.537792423 +0200 -@@ -0,0 +1,150 @@ -+/**************************************************************************** -+ * Copyright (c) 2013,2014 Free Software Foundation, Inc. * -+ * * -+ * Permission is hereby granted, free of charge, to any person obtaining a * -+ * copy of this software and associated documentation files (the * -+ * "Software"), to deal in the Software without restriction, including * -+ * without limitation the rights to use, copy, modify, merge, publish, * -+ * distribute, distribute with modifications, sublicense, and/or sell * -+ * copies of the Software, and to permit persons to whom the Software is * -+ * furnished to do so, subject to the following conditions: * -+ * * -+ * The above copyright notice and this permission notice shall be included * -+ * in all copies or substantial portions of the Software. * -+ * * -+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * -+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * -+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * -+ * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * -+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * -+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * -+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * -+ * * -+ * Except as contained in this notice, the name(s) of the above copyright * -+ * holders shall not be used in advertising or otherwise to promote the * -+ * sale, use or other dealings in this Software without prior written * -+ * authorization. * -+ ****************************************************************************/ -+ -+/**************************************************************************** -+ * Author: Gaute Hope, 2013 * -+ ****************************************************************************/ -+ -+/* -+ * $Id: form_driver_w.c,v 1.11 2014/02/09 22:20:27 tom Exp $ -+ * -+ * Test form_driver_w (int, int, wchar_t), a wide char aware -+ * replacement of form_driver. -+ */ -+ -+#include <locale.h> -+ -+#include <test.priv.h> -+ -+#if USE_WIDEC_SUPPORT && USE_LIBFORM -+ -+#include <form.h> -+ -+int -+main(void) -+{ -+ FIELD *field[3]; -+ FORM *my_form; -+ bool done = FALSE; -+ -+ setlocale(LC_ALL, ""); -+ -+ /* Initialize curses */ -+ initscr(); -+ cbreak(); -+ noecho(); -+ keypad(stdscr, TRUE); -+ -+ /* Initialize the fields */ -+ field[0] = new_field(1, 10, 4, 18, 0, 0); -+ field[1] = new_field(1, 10, 6, 18, 0, 0); -+ field[2] = NULL; -+ -+ /* Set field options */ -+ set_field_back(field[0], A_UNDERLINE); /* Print a line for the option */ -+ field_opts_off(field[0], O_AUTOSKIP); /* Don't go to next field when this */ -+ /* Field is filled up */ -+ set_field_back(field[1], A_UNDERLINE); -+ field_opts_off(field[1], O_AUTOSKIP); -+ -+ /* Create the form and post it */ -+ my_form = new_form(field); -+ post_form(my_form); -+ refresh(); -+ -+ mvprintw(4, 10, "Value 1:"); -+ mvprintw(6, 10, "Value 2:"); -+ refresh(); -+ -+ /* Loop through to get user requests */ -+ while (!done) { -+ wint_t ch; -+ int ret = get_wch(&ch); -+ -+ mvprintw(8, 10, "Got %d (%#x), type: %s", (int) ch, (int) ch, -+ (ret == KEY_CODE_YES) -+ ? "KEY_CODE_YES" -+ : ((ret == OK) -+ ? "OK" -+ : ((ret == ERR) -+ ? "ERR" -+ : "?"))); -+ clrtoeol(); -+ -+ switch (ret) { -+ case KEY_CODE_YES: -+ switch (ch) { -+ case KEY_DOWN: -+ /* Go to next field */ -+ form_driver_w(my_form, KEY_CODE_YES, REQ_NEXT_FIELD); -+ /* Go to the end of the present buffer */ -+ /* Leaves nicely at the last character */ -+ form_driver_w(my_form, KEY_CODE_YES, REQ_END_LINE); -+ break; -+ case KEY_UP: -+ /* Go to previous field */ -+ form_driver_w(my_form, KEY_CODE_YES, REQ_PREV_FIELD); -+ form_driver_w(my_form, KEY_CODE_YES, REQ_END_LINE); -+ break; -+ default: -+ break; -+ } -+ break; -+ case OK: -+ switch (ch) { -+ case CTRL('D'): -+ case QUIT: -+ case ESCAPE: -+ done = TRUE; -+ break; -+ default: -+ form_driver_w(my_form, OK, ch); -+ break; -+ } -+ break; -+ } -+ } -+ -+ /* Un post form and free the memory */ -+ unpost_form(my_form); -+ free_form(my_form); -+ free_field(field[0]); -+ free_field(field[1]); -+ -+ endwin(); -+ ExitProgram(EXIT_SUCCESS); -+} -+ -+#else -+int -+main(void) -+{ -+ printf("This program requires the wide-ncurses and forms library\n"); -+ ExitProgram(EXIT_FAILURE); -+} -+#endif /* USE_WIDEC_SUPPORT */ -diff -Naur ncurses-5.9/test/gdc.c ncurses-5.9.patch/test/gdc.c ---- ncurses-5.9/test/gdc.c 2010-11-13 22:01:23.000000000 +0100 -+++ ncurses-5.9.patch/test/gdc.c 2014-09-01 16:33:22.537792423 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2013,2014 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -27,13 +27,13 @@ - ****************************************************************************/ - /* - * Grand digital clock for curses compatible terminals -- * Usage: gdc [-s] [n] -- run for n seconds (default infinity) -+ * Usage: gdc [-s] [-t hh:mm:ss] [n] -- run for n seconds (default infinity) - * Flags: -s: scroll - * - * modified 10-18-89 for curses (jrl) - * 10-18-89 added signal handling - * -- * $Id: gdc.c,v 1.34 2010/11/13 21:01:23 tom Exp $ -+ * $Id: gdc.c,v 1.40 2014/02/15 17:34:36 tom Exp $ - */ - - #include <test.priv.h> -@@ -60,7 +60,7 @@ - static bool redirected = FALSE; - static bool hascolor = FALSE; - --static RETSIGTYPE -+static void - sighndl(int signo) - { - signal(signo, sighndl); -@@ -72,13 +72,24 @@ - } - - static void -+check_term(void) -+{ -+ if (sigtermed) { -+ (void) standend(); -+ endwin(); -+ fprintf(stderr, "gdc terminated by signal %d\n", sigtermed); -+ ExitProgram(EXIT_FAILURE); -+ } -+} -+ -+static void - drawbox(bool scrolling) - { - chtype bottom[XLENGTH + 1]; - int n; - - if (hascolor) -- (void) attrset(COLOR_PAIR(PAIR_FRAMES)); -+ (void) attrset((attr_t) COLOR_PAIR(PAIR_FRAMES)); - - MvAddCh(YBASE - 1, XBASE - 1, ACS_ULCORNER); - hline(ACS_HLINE, XLENGTH); -@@ -102,7 +113,7 @@ - vline(ACS_VLINE, YDEPTH); - - if (hascolor) -- (void) attrset(COLOR_PAIR(PAIR_OTHERS)); -+ (void) attrset((attr_t) COLOR_PAIR(PAIR_OTHERS)); - } - - static void -@@ -110,13 +121,13 @@ - { - if (on) { - if (hascolor) { -- attron(COLOR_PAIR(PAIR_DIGITS)); -+ attron((attr_t) COLOR_PAIR(PAIR_DIGITS)); - } else { - attron(A_STANDOUT); - } - } else { - if (hascolor) { -- attron(COLOR_PAIR(PAIR_OTHERS)); -+ attron((attr_t) COLOR_PAIR(PAIR_OTHERS)); - } else { - attroff(A_STANDOUT); - } -@@ -147,6 +158,7 @@ - ,"Options:" - ," -n redirect input to /dev/null" - ," -s scroll each number into place, rather than flipping" -+ ," -t hh:mm:ss specify starting time (default is ``now'')" - ,"" - ,"If you specify a count, gdc runs for that number of seconds" - }; -@@ -156,6 +168,43 @@ - ExitProgram(EXIT_FAILURE); - } - -+static time_t -+parse_time(const char *value) -+{ -+ int hh, mm, ss; -+ int check; -+ time_t result; -+ char c; -+ struct tm *tm; -+ -+ if (sscanf(value, "%d:%d:%d%c", &hh, &mm, &ss, &c) != 3) { -+ if (sscanf(value, "%02d%02d%02d%c", &hh, &mm, &ss, &c) != 3) { -+ usage(); -+ } -+ } -+ -+ if ((hh < 0) || (hh >= 24) || -+ (mm < 0) || (mm >= 60) || -+ (ss < 0) || (ss >= 60)) { -+ usage(); -+ } -+ -+ /* adjust so that the localtime in the main loop will give usable time */ -+ result = (hh * 3600) + ((mm * 60) + ss); -+ for (check = 0; check < 24; ++check) { -+ tm = localtime(&result); -+ if (tm->tm_hour == hh) -+ break; -+ result += 3600; -+ } -+ -+ if (tm->tm_hour != hh) { -+ fprintf(stderr, "Cannot find local time for %s!\n", value); -+ usage(); -+ } -+ return result; -+} -+ - int - main(int argc, char *argv[]) - { -@@ -166,21 +215,26 @@ - int count = 0; - FILE *ofp = stdout; - FILE *ifp = stdin; -- bool scrol = FALSE; -+ bool smooth = FALSE; -+ bool stages = FALSE; -+ time_t starts = 0; - - setlocale(LC_ALL, ""); - - CATCHALL(sighndl); - -- while ((k = getopt(argc, argv, "sn")) != -1) { -+ while ((k = getopt(argc, argv, "nst:")) != -1) { - switch (k) { -- case 's': -- scrol = TRUE; -- break; - case 'n': - ifp = fopen("/dev/null", "r"); - redirected = TRUE; - break; -+ case 's': -+ smooth = TRUE; -+ break; -+ case 't': -+ starts = parse_time(optarg); -+ break; - default: - usage(); - } -@@ -220,7 +274,7 @@ - init_pair(PAIR_DIGITS, COLOR_BLACK, COLOR_RED); - init_pair(PAIR_OTHERS, COLOR_RED, bg); - init_pair(PAIR_FRAMES, COLOR_WHITE, bg); -- (void) attrset(COLOR_PAIR(PAIR_OTHERS)); -+ (void) attrset((attr_t) COLOR_PAIR(PAIR_OTHERS)); - } - - restart: -@@ -231,9 +285,13 @@ - drawbox(FALSE); - - do { -- char buf[30]; -+ char buf[40]; - -- time(&now); -+ if (starts != 0) { -+ now = ++starts; -+ } else { -+ time(&now); -+ } - tm = localtime(&now); - - mask = 0; -@@ -247,12 +305,13 @@ - set(10, 17); - - for (k = 0; k < 6; k++) { -- if (scrol) { -+ if (smooth) { - for (i = 0; i < 5; i++) - newer[i] = (newer[i] & ~mask) | (newer[i + 1] & mask); - newer[5] = (newer[5] & ~mask) | (next[k] & mask); -- } else -+ } else { - newer[k] = (newer[k] & ~mask) | (next[k] & mask); -+ } - next[k] = 0; - for (s = 1; s >= 0; s--) { - standt(s); -@@ -273,7 +332,7 @@ - } - } - if (!s) { -- if (scrol) -+ if (smooth) - drawbox(TRUE); - refresh(); - /* -@@ -286,14 +345,41 @@ - * a lot of time when asking what time it is, at the top of - * this loop -T.Dickey - */ -- if (scrol) -+ if (smooth) - napms(85); -+ if (stages) { -+ stages = FALSE; -+ switch (wgetch(stdscr)) { -+ case 'q': -+ count = 1; -+ break; -+ case 'S': -+ stages = TRUE; -+ /* FALLTHRU */ -+ case 's': -+ nodelay(stdscr, FALSE); -+ break; -+ case ' ': -+ nodelay(stdscr, TRUE); -+ break; -+#ifdef KEY_RESIZE -+ case KEY_RESIZE: -+#endif -+ case '?': -+ goto restart; -+ case ERR: -+ check_term(); -+ /* FALLTHRU */ -+ default: -+ continue; -+ } -+ } - } - } - } - - /* this depends on the detailed format of ctime(3) */ -- (void) strcpy(buf, ctime(&now)); -+ (void) strncpy(buf, ctime(&now), (size_t) 30); - (void) strcpy(buf + 10, buf + 19); - MvAddStr(16, 30, buf); - -@@ -302,11 +388,11 @@ - refresh(); - - /* -- * If we're not scrolling, wait 1000 msec (1 sec). Use napms() rather -- * than sleep() because the latter does odd things on some systems, -- * e.g., suspending output as well. -+ * If we're not smooth-scrolling, wait 1000 msec (1 sec). Use napms() -+ * rather than sleep() because the latter does odd things on some -+ * systems, e.g., suspending output as well. - */ -- if (scrol) -+ if (smooth) - napms(500); - else - napms(1000); -@@ -318,10 +404,14 @@ - * will return an error if interrupted. This works only if we can - * read from the input, of course. - */ -+ stages = FALSE; - switch (wgetch(stdscr)) { - case 'q': - count = 1; - break; -+ case 'S': -+ stages = TRUE; -+ /* FALLTHRU */ - case 's': - nodelay(stdscr, FALSE); - break; -@@ -334,12 +424,7 @@ - case '?': - goto restart; - case ERR: -- if (sigtermed) { -- (void) standend(); -- endwin(); -- fprintf(stderr, "gdc terminated by signal %d\n", sigtermed); -- ExitProgram(EXIT_FAILURE); -- } -+ check_term(); - /* FALLTHRU */ - default: - continue; -diff -Naur ncurses-5.9/test/hanoi.c ncurses-5.9.patch/test/hanoi.c ---- ncurses-5.9/test/hanoi.c 2010-11-14 02:01:07.000000000 +0100 -+++ ncurses-5.9.patch/test/hanoi.c 2014-09-01 16:33:22.569792509 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -41,10 +41,11 @@ - * - * Date: 05.Nov.90 - * -- * $Id: hanoi.c,v 1.31 2010/11/14 01:01:07 tom Exp $ -+ * $Id: hanoi.c,v 1.35 2013/09/28 22:02:17 tom Exp $ - */ - - #include <test.priv.h> -+#include <math.h> - - #define NPEGS 3 /* This is not configurable !! */ - #define MINTILES 3 -@@ -57,7 +58,7 @@ - #define MIDPEG 39 - #define RIGHTPEG 59 - --#define LENTOIND(x) (((x)-1)/2) -+#define LENTOIND(x) (((int)(x)-1)/2) - #define OTHER(a,b) (3-((a)+(b))) - - struct Peg { -@@ -84,10 +85,11 @@ - COLOR_MAGENTA, /* Length 17 */ - COLOR_RED, /* Length 19 */ - }; -+static int NTiles = 0; - static int NMoves = 0; - static bool AutoFlag = FALSE; - --static void InitTiles(int NTiles); -+static void InitTiles(void); - static void DisplayTiles(void); - static void MakeMove(int From, int To); - static void AutoMove(int From, int To, int Num); -@@ -99,7 +101,7 @@ - int - main(int argc, char **argv) - { -- int NTiles, FromCol, ToCol; -+ int FromCol, ToCol; - - setlocale(LC_ALL, ""); - -@@ -130,9 +132,6 @@ - Usage(); - ExitProgram(EXIT_FAILURE); - } --#ifdef TRACE -- trace(TRACE_MAXIMUM); --#endif - initscr(); - if (has_colors()) { - int i; -@@ -155,7 +154,7 @@ - curs_set(0); - leaveok(stdscr, TRUE); /* Attempt to remove cursor */ - } -- InitTiles(NTiles); -+ InitTiles(); - DisplayTiles(); - if (AutoFlag) { - do { -@@ -211,7 +210,7 @@ - } - - static void --InitTiles(int NTiles) -+InitTiles(void) - { - int Size, SlotNo; - -@@ -232,7 +231,7 @@ - erase(); - MvAddStr(1, 24, "T O W E R S O F H A N O I"); - MvAddStr(3, 34, "SJR 1990"); -- MvPrintw(19, 5, "Moves : %d", NMoves); -+ MvPrintw(19, 5, "Moves : %d of %.0f", NMoves, pow(2.0, (float) NTiles) - 1); - (void) attrset(A_REVERSE); - MvAddStr(BASELINE, 8, - " "); -@@ -255,7 +254,7 @@ - memset(TileBuf, ' ', len); - TileBuf[len] = '\0'; - if (has_colors()) -- (void) attrset(COLOR_PAIR(LENTOIND(len))); -+ (void) attrset((attr_t) COLOR_PAIR(LENTOIND(len))); - else - (void) attrset(A_REVERSE); - MvAddStr(BASELINE - (SlotNo + 1), -@@ -310,12 +309,12 @@ - if (Num == 1) { - MakeMove(From, To); - napms(500); -- return; -+ } else { -+ AutoMove(From, OTHER(From, To), Num - 1); -+ MakeMove(From, To); -+ napms(500); -+ AutoMove(OTHER(From, To), To, Num - 1); - } -- AutoMove(From, OTHER(From, To), Num - 1); -- MakeMove(From, To); -- napms(500); -- AutoMove(OTHER(From, To), To, Num - 1); - } - - static int -diff -Naur ncurses-5.9/test/hashtest.c ncurses-5.9.patch/test/hashtest.c ---- ncurses-5.9/test/hashtest.c 2010-11-14 00:43:15.000000000 +0100 -+++ ncurses-5.9.patch/test/hashtest.c 2014-09-01 16:33:22.569792509 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2010,2013 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -30,7 +30,7 @@ - * - * Generate timing statistics for vertical-motion optimization. - * -- * $Id: hashtest.c,v 1.31 2010/11/13 23:43:15 tom Exp $ -+ * $Id: hashtest.c,v 1.32 2013/04/27 19:50:17 tom Exp $ - */ - - #include <test.priv.h> -@@ -54,7 +54,7 @@ - endwin(); - } - --static RETSIGTYPE -+static void - finish(int sig GCC_UNUSED) - { - cleanup(); -diff -Naur ncurses-5.9/test/inchs.c ncurses-5.9.patch/test/inchs.c ---- ncurses-5.9/test/inchs.c 2010-11-14 00:41:23.000000000 +0100 -+++ ncurses-5.9.patch/test/inchs.c 2014-09-01 16:33:22.569792509 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 2007,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 2007-2010,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -26,7 +26,7 @@ - * authorization. * - ****************************************************************************/ - /* -- * $Id: inchs.c,v 1.11 2010/11/13 23:41:23 tom Exp $ -+ * $Id: inchs.c,v 1.12 2012/11/18 01:58:15 tom Exp $ - * - * Author: Thomas E Dickey - */ -@@ -50,6 +50,16 @@ - #define BASE_Y 7 - #define MAX_COLS 1024 - -+static void -+failed(const char *s) -+{ -+ int save = errno; -+ endwin(); -+ errno = save; -+ perror(s); -+ ExitProgram(EXIT_FAILURE); -+} -+ - static bool - Quit(int ch) - { -@@ -87,6 +97,8 @@ - txtwin = stdscr; - base_y = BASE_Y; - } -+ if (txtwin == 0) -+ failed("cannot create txtwin"); - - keypad(txtwin, TRUE); /* enable keyboard mapping */ - (void) cbreak(); /* take input chars one at a time, no wait for \n */ -diff -Naur ncurses-5.9/test/insdelln.c ncurses-5.9.patch/test/insdelln.c ---- ncurses-5.9/test/insdelln.c 2010-11-14 00:39:38.000000000 +0100 -+++ ncurses-5.9.patch/test/insdelln.c 2014-09-01 16:33:22.570792508 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 2008-2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 2008-2010,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -26,7 +26,7 @@ - * authorization. * - ****************************************************************************/ - /* -- * $Id: insdelln.c,v 1.5 2010/11/13 23:39:38 tom Exp $ -+ * $Id: insdelln.c,v 1.7 2012/11/18 00:37:58 tom Exp $ - * - * test-driver for deleteln, wdeleteln, insdelln, winsdelln, insertln, winsertln - */ -@@ -175,6 +175,8 @@ - delwin(win1); - touchwin(win); - } else { -+ if (win1) -+ delwin(win1); - beep(); - } - } -@@ -300,7 +302,7 @@ - init_status(win, &st); - - do { -- (void) wattrset(win, st.attr | (attr_t) COLOR_PAIR(st.pair)); -+ (void) wattrset(win, (int) (st.attr | (attr_t) COLOR_PAIR(st.pair))); - switch (st.ch) { - case 'i': - for (n = 0; n < st.count; ++n) -diff -Naur ncurses-5.9/test/inserts.c ncurses-5.9.patch/test/inserts.c ---- ncurses-5.9/test/inserts.c 2010-12-12 01:19:55.000000000 +0100 -+++ ncurses-5.9.patch/test/inserts.c 2014-09-01 16:33:22.570792508 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 2002-2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 2002-2010,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -26,7 +26,7 @@ - * authorization. * - ****************************************************************************/ - /* -- * $Id: inserts.c,v 1.23 2010/12/12 00:19:55 tom Exp $ -+ * $Id: inserts.c,v 1.27 2012/12/16 00:35:27 tom Exp $ - * - * Demonstrate the winsstr() and winsch functions. - * Thomas Dickey - 2002/10/19 -@@ -167,6 +167,15 @@ - (void) cbreak(); /* take input chars one at a time, no wait for \n */ - (void) noecho(); /* don't echo input */ - keypad(stdscr, TRUE); -+ -+ /* -+ * Show the characters inserted in color, to distinguish from those -+ * that are shifted. -+ */ -+ if (has_colors()) { -+ start_color(); -+ init_pair(1, COLOR_WHITE, COLOR_BLUE); -+ } - } - - limit = LINES - 5; -@@ -200,14 +209,8 @@ - - doupdate(); - -- /* -- * Show the characters inserted in color, to distinguish from those that -- * are shifted. -- */ - if (has_colors()) { -- start_color(); -- init_pair(1, COLOR_WHITE, COLOR_BLUE); -- wbkgdset(work, COLOR_PAIR(1) | ' '); -+ wbkgdset(work, (chtype) (COLOR_PAIR(1) | ' ')); - } - - while ((ch = read_linedata(work)) != ERR && !isQUIT(ch)) { -@@ -216,11 +219,13 @@ - case key_RECUR: - test_inserts(level + 1); - -- touchwin(look); -+ if (look) -+ touchwin(look); - touchwin(work); - touchwin(show); - -- wnoutrefresh(look); -+ if (look) -+ wnoutrefresh(look); - wnoutrefresh(work); - wnoutrefresh(show); - -@@ -368,10 +373,10 @@ - } - } - if (level > 0) { -- delwin(show); - delwin(work); - delwin(look); - } -+ delwin(show); - } - - static void -diff -Naur ncurses-5.9/test/ins_wide.c ncurses-5.9.patch/test/ins_wide.c ---- ncurses-5.9/test/ins_wide.c 2010-12-12 01:20:14.000000000 +0100 -+++ ncurses-5.9.patch/test/ins_wide.c 2014-09-01 16:33:22.570792508 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 2002-2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 2002-2010,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -26,7 +26,7 @@ - * authorization. * - ****************************************************************************/ - /* -- * $Id: ins_wide.c,v 1.15 2010/12/12 00:20:14 tom Exp $ -+ * $Id: ins_wide.c,v 1.20 2012/12/16 00:51:02 tom Exp $ - * - * Demonstrate the wins_wstr() and wins_wch functions. - * Thomas Dickey - 2002/11/23 -@@ -228,8 +228,9 @@ - WINDOW *work = 0; - WINDOW *show = 0; - int margin = (2 * MY_TABSIZE) - 1; -- Options option = ((m_opt ? oMove : oDefault) -- | ((w_opt || (level > 0)) ? oWindow : oDefault)); -+ Options option = (Options) ((int) (m_opt ? oMove : oDefault) -+ | (int) ((w_opt || (level > 0)) -+ ? oWindow : oDefault)); - - if (first) { - static char cmd[80]; -@@ -241,6 +242,15 @@ - (void) cbreak(); /* take input chars one at a time, no wait for \n */ - (void) noecho(); /* don't echo input */ - keypad(stdscr, TRUE); -+ -+ /* -+ * Show the characters inserted in color, to distinguish from those -+ * that are shifted. -+ */ -+ if (has_colors()) { -+ start_color(); -+ init_pair(1, COLOR_WHITE, COLOR_BLUE); -+ } - } - - limit = LINES - 5; -@@ -274,14 +284,8 @@ - - doupdate(); - -- /* -- * Show the characters inserted in color, to distinguish from those that -- * are shifted. -- */ - if (has_colors()) { -- start_color(); -- init_pair(1, COLOR_WHITE, COLOR_BLUE); -- wbkgdset(work, COLOR_PAIR(1) | ' '); -+ wbkgdset(work, (chtype) (COLOR_PAIR(1) | ' ')); - } - - while ((ch = read_linedata(work)) != ERR && !isQUIT(ch)) { -@@ -290,11 +294,13 @@ - case key_RECUR: - test_inserts(level + 1); - -- touchwin(look); -+ if (look) -+ touchwin(look); - touchwin(work); - touchwin(show); - -- wnoutrefresh(look); -+ if (look) -+ wnoutrefresh(look); - wnoutrefresh(work); - wnoutrefresh(show); - -@@ -438,10 +444,10 @@ - } - } - if (level > 0) { -- delwin(show); - delwin(work); - delwin(look); - } -+ delwin(show); - } - - static void -diff -Naur ncurses-5.9/test/knight.c ncurses-5.9.patch/test/knight.c ---- ncurses-5.9/test/knight.c 2010-11-13 21:44:21.000000000 +0100 -+++ ncurses-5.9.patch/test/knight.c 2014-09-01 16:33:22.570792508 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2008,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -33,7 +33,7 @@ - * Eric S. Raymond <esr@snark.thyrsus.com> July 22 1995. Mouse support - * added September 20th 1995. - * -- * $Id: knight.c,v 1.31 2010/11/13 20:44:21 tom Exp $ -+ * $Id: knight.c,v 1.36 2013/02/16 19:53:08 tom Exp $ - */ - - #include <test.priv.h> -@@ -123,13 +123,16 @@ - (void) init_pair(PLUS_COLOR, (short) COLOR_RED, (short) bg); - (void) init_pair(MINUS_COLOR, (short) COLOR_GREEN, (short) bg); - -- trail |= COLOR_PAIR(TRAIL_COLOR); -- plus |= COLOR_PAIR(PLUS_COLOR); -- minus |= COLOR_PAIR(MINUS_COLOR); -+ trail |= (chtype) COLOR_PAIR(TRAIL_COLOR); -+ plus |= (chtype) COLOR_PAIR(PLUS_COLOR); -+ minus |= (chtype) COLOR_PAIR(MINUS_COLOR); - } - #ifdef NCURSES_MOUSE_VERSION - (void) mousemask(BUTTON1_CLICKED, (mmask_t *) NULL); - #endif /* NCURSES_MOUSE_VERSION */ -+#if defined(PDCURSES) -+ mouse_set(BUTTON1_RELEASED); -+#endif - - oldch = minus; - } -@@ -300,15 +303,16 @@ - } - } - --static void -+static bool - find_next_move(int *y, int *x) - { - unsigned j, k; - int found = -1; - int first = -1; -- int next = 0; -+ int next = -1; - int oldy, oldx; - int newy, newx; -+ bool result = FALSE; - - if (movecount > 1) { - oldy = history[movecount - 1].y; -@@ -335,9 +339,27 @@ - *y = oldy + offsets[next].y; - *x = oldx + offsets[next].x; - } -- } else { -- beep(); -+ result = TRUE; - } -+ return result; -+} -+ -+static void -+count_next_moves(int y, int x) -+{ -+ int count = 0; -+ unsigned j; -+ -+ wprintw(msgwin, "\nMove %d", movecount); -+ for (j = 0; j < SIZEOF(offsets); j++) { -+ int newy = y + offsets[j].y; -+ int newx = x + offsets[j].x; -+ if (chksqr(newy, newx)) { -+ ++count; -+ } -+ } -+ wprintw(msgwin, ", gives %d choices", count); -+ wclrtoeol(msgwin); - } - - static void -@@ -558,8 +580,9 @@ - nx = col + 1; - break; - --#ifdef NCURSES_MOUSE_VERSION -+#ifdef KEY_MOUSE - case KEY_MOUSE: -+#ifdef NCURSES_MOUSE_VERSION - { - MEVENT myevent; - -@@ -576,6 +599,24 @@ - } - } - #endif /* NCURSES_MOUSE_VERSION */ -+#ifdef PDCURSES -+ { -+ int test_y, test_x; -+ request_mouse_pos(); -+ test_y = MOUSE_Y_POS + 0; -+ test_x = MOUSE_X_POS + 1; -+ if (test_y >= CY(0) && test_y <= CY(BDEPTH) -+ && test_x >= CX(0) && test_x <= CX(BWIDTH)) { -+ ny = CYINV(test_y); -+ nx = CXINV(test_x); -+ wmove(helpwin, 0, 0); -+ wrefresh(helpwin); -+ ungetch('\n'); -+ } -+ break; -+ } -+#endif /* PDCURSES */ -+#endif /* KEY_MOUSE */ - - case KEY_B2: - case '\n': -@@ -614,8 +655,8 @@ - ny = history[movecount].y; - nx = history[movecount].x; - if (nx < 0 || ny < 0) { -- ny = lastrow; -- nx = lastcol; -+ ny = (lastrow >= 0) ? lastrow : 0; -+ nx = (lastcol >= 0) ? lastcol : 0; - } - movecount = 0; - board[ny][nx] = FALSE; -@@ -652,7 +693,10 @@ - case 'a': - nx = col; - ny = rw; -- find_next_move(&ny, &nx); -+ if (find_next_move(&ny, &nx)) -+ count_next_moves(ny, nx); -+ else -+ beep(); - break; - - case 'F': -diff -Naur ncurses-5.9/test/linedata.h ncurses-5.9.patch/test/linedata.h ---- ncurses-5.9/test/linedata.h 2010-11-13 22:12:31.000000000 +0100 -+++ ncurses-5.9.patch/test/linedata.h 2014-09-01 16:33:22.570792508 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 2009-2010,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -85,10 +85,8 @@ - beep(); - continue; - } -- } else if (code != ERR) { -- result = (int) ch; -- break; - } else { -+ result = (int) ch; - break; - } - } -diff -Naur ncurses-5.9/test/Makefile.in ncurses-5.9.patch/test/Makefile.in ---- ncurses-5.9/test/Makefile.in 2010-11-28 17:39:40.000000000 +0100 -+++ ncurses-5.9.patch/test/Makefile.in 2014-09-01 16:33:22.524792400 +0200 -@@ -1,6 +1,6 @@ --# $Id: Makefile.in,v 1.108 2010/11/28 16:39:40 tom Exp $ -+# $Id: Makefile.in,v 1.111 2013/10/05 23:46:10 tom Exp $ - ############################################################################## --# Copyright (c) 1998-2008,2010 Free Software Foundation, Inc. # -+# Copyright (c) 1998-2011,2013 Free Software Foundation, Inc. # - # # - # Permission is hereby granted, free of charge, to any person obtaining a # - # copy of this software and associated documentation files (the "Software"), # -@@ -47,13 +47,16 @@ - srcdir = @srcdir@ - prefix = @prefix@ - exec_prefix = @exec_prefix@ -+datarootdir = @datarootdir@ -+ - bindir = @bindir@ - libdir = @libdir@ - includedir = @includedir@ -+includesubdir = @includesubdir@ - - BINDIR = $(DESTDIR)$(bindir) - LIBDIR = $(DESTDIR)$(libdir) --INCLUDEDIR = $(DESTDIR)$(includedir) -+INCLUDEDIR = $(DESTDIR)$(includedir)$(includesubdir) - - LIBTOOL = @LIBTOOL@ - LIBTOOL_CLEAN = @LIB_CLEAN@ -@@ -102,7 +105,7 @@ - LDFLAGS_PROFILE = $(LDFLAGS) $(CFLAGS_PROFILE) - LDFLAGS_SHARED = $(LDFLAGS) $(CFLAGS_SHARED) @LD_SHARED_OPTS@ - --TEST_ARGS = @LDFLAGS_STATIC@ @TEST_ARGS@ @LDFLAGS_SHARED@ -+TEST_ARGS = @LDFLAGS_STATIC@ @TEST_ARGS@ @LDFLAGS_SHARED@ - - # use these for linking with all of the libraries - LIBS_DEFAULT = $(TEST_ARGS) @LIBS@ $(TEST_LIBS) $(MATH_LIB) -@@ -117,8 +120,8 @@ - LDFLAGS_CURSES = $(LDFLAGS_@DFT_UPR_MODEL@) $(LIBS_CURSES) - - # use these for linking with the tinfo library if we have it, or curses library if not --LIBS_TINFO = @LDFLAGS_STATIC@ @TINFO_ARGS@ @LDFLAGS_SHARED@ @LIBS@ $(TEST_LIBS) $(MATH_LIB) --LDFLAGS_TINFO = $(LDFLAGS_@DFT_UPR_MODEL@) $(LIBS_TINFO) -+LIBS_TINFO = @LDFLAGS_STATIC@ @TINFO_LIBS@ @LDFLAGS_SHARED@ @LIBS@ $(TEST_LIBS) $(MATH_LIB) -+LDFLAGS_TINFO = @TINFO_LDFLAGS@ $(LDFLAGS_@DFT_UPR_MODEL@) $(LIBS_TINFO) - - LINT = @LINT@ - LINT_OPTS = @LINT_OPTS@ -diff -Naur ncurses-5.9/test/make-tar.sh ncurses-5.9.patch/test/make-tar.sh ---- ncurses-5.9/test/make-tar.sh 2011-03-26 21:46:51.000000000 +0100 -+++ ncurses-5.9.patch/test/make-tar.sh 2014-09-01 16:33:22.570792508 +0200 -@@ -1,7 +1,7 @@ - #!/bin/sh --# $Id: make-tar.sh,v 1.10 2011/03/26 20:46:51 tom Exp $ -+# $Id: make-tar.sh,v 1.12 2013/10/26 23:11:43 tom Exp $ - ############################################################################## --# Copyright (c) 2010,2011 Free Software Foundation, Inc. # -+# Copyright (c) 2010-2011,2013 Free Software Foundation, Inc. # - # # - # Permission is hereby granted, free of charge, to any person obtaining a # - # copy of this software and associated documentation files (the "Software"), # -@@ -66,11 +66,11 @@ - make_changelog() { - test -f $1 && chmod u+w $1 - cat >$1 <<EOF --`echo $PKG_NAME|tr '[A-Z]' '[a-z]'` ($NCURSES_PATCH) unstable; urgency=low -+`echo $PKG_NAME|tr '[A-Z]' '[a-z]'` ($NCURSES_MAJOR.$NCURSES_MINOR-$NCURSES_PATCH) unstable; urgency=low - - * snapshot of ncurses subpackage for $PKG_NAME. - -- -- `head -1 $HOME/.signature` `date -R` -+ -- `head -n 1 $HOME/.signature` `date -R` - EOF - } - -@@ -108,7 +108,10 @@ - do - edit_specfile $spec - done --make_changelog $BUILD/$ROOTNAME/package/debian/changelog -+for spec in $BUILD/$ROOTNAME/package/debian* -+do -+ make_changelog $spec/changelog -+done - - cp -p $SOURCE/NEWS $BUILD/$ROOTNAME - -diff -Naur ncurses-5.9/test/modules ncurses-5.9.patch/test/modules ---- ncurses-5.9/test/modules 2010-01-23 18:51:38.000000000 +0100 -+++ ncurses-5.9.patch/test/modules 2014-09-01 16:33:22.571792503 +0200 -@@ -1,6 +1,6 @@ --# $Id: modules,v 1.43 2010/01/23 17:51:38 tom Exp $ -+# $Id: modules,v 1.50 2013/12/07 18:06:01 tom Exp $ - ############################################################################## --# Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. # -+# Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. # - # # - # Permission is hereby granted, free of charge, to any person obtaining a # - # copy of this software and associated documentation files (the "Software"), # -@@ -50,12 +50,14 @@ - ditto progs $(srcdir) $(HEADER_DEPS) - dots progs $(srcdir) $(HEADER_DEPS) - dots_mvcur progs $(srcdir) $(HEADER_DEPS) -+dots_termcap progs $(srcdir) $(HEADER_DEPS) - echochar progs $(srcdir) $(HEADER_DEPS) - edit_field progs $(srcdir) $(HEADER_DEPS) $(srcdir)/edit_field.h - filter progs $(srcdir) $(HEADER_DEPS) - firework progs $(srcdir) $(HEADER_DEPS) - firstlast progs $(srcdir) $(HEADER_DEPS) - foldkeys progs $(srcdir) $(HEADER_DEPS) -+form_driver_w progs $(srcdir) $(HEADER_DEPS) - gdc progs $(srcdir) $(HEADER_DEPS) - hanoi progs $(srcdir) $(HEADER_DEPS) - hashtest progs $(srcdir) $(HEADER_DEPS) -@@ -86,10 +88,12 @@ - test_instr progs $(srcdir) $(HEADER_DEPS) - test_inwstr progs $(srcdir) $(HEADER_DEPS) - test_opaque progs $(srcdir) $(HEADER_DEPS) -+test_vid_puts progs $(srcdir) $(HEADER_DEPS) -+test_vidputs progs $(srcdir) $(HEADER_DEPS) - testaddch progs $(srcdir) $(HEADER_DEPS) - testcurs progs $(srcdir) $(HEADER_DEPS) - testscanw progs $(srcdir) $(HEADER_DEPS) --view progs $(srcdir) $(HEADER_DEPS) -+view progs $(srcdir) $(HEADER_DEPS) $(srcdir)/widechars.h - worm progs $(srcdir) $(HEADER_DEPS) - xmas progs $(srcdir) $(HEADER_DEPS) - -diff -Naur ncurses-5.9/test/movewindow.c ncurses-5.9.patch/test/movewindow.c ---- ncurses-5.9/test/movewindow.c 2010-11-14 00:34:55.000000000 +0100 -+++ ncurses-5.9.patch/test/movewindow.c 2014-09-01 16:33:22.571792503 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 2006-2008,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 2006-2012,2013 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -26,18 +26,22 @@ - * authorization. * - ****************************************************************************/ - /* -- * $Id: movewindow.c,v 1.24 2010/11/13 23:34:55 tom Exp $ -+ * $Id: movewindow.c,v 1.39 2013/05/04 19:41:02 tom Exp $ - * - * Demonstrate move functions for windows and derived windows from the curses - * library. - * -- * Thomas Dickey - 2006/2/11 -+ * Author: Thomas E. Dickey - */ - /* - derwin - mvderwin - subwin - mvwin -+ -+TODO: -+ add command to reset subwindow's origin to coincide with parent. -+ add command to delete subwindow (check if it has subwindows though) - */ - - #include <test.priv.h> -@@ -76,6 +80,14 @@ - static FRAME *all_windows; - - static void -+failed(const char *s) -+{ -+ perror(s); -+ endwin(); -+ ExitProgram(EXIT_FAILURE); -+} -+ -+static void - message(int lineno, CONST_FMT char *fmt, va_list argp) - { - int y, x; -@@ -122,7 +134,12 @@ - * Arrow keys move cursor, return location at current on non-arrow key. - */ - static PAIR * --selectcell(WINDOW *parent, int uli, int ulj, int lri, int lrj) -+selectcell(WINDOW *parent, -+ WINDOW *child, -+ int uli, int ulj, -+ int lri, int lrj, -+ bool relative, -+ bool * more) - { - static PAIR res; /* result cell */ - int si = lri - uli + 1; /* depth of the select area */ -@@ -131,25 +148,46 @@ - - res.y = uli; - res.x = ulj; -+ -+ if (child != 0) { -+ if (relative) { -+ getparyx(child, i, j); -+ } else { -+ getbegyx(child, i, j); -+ i -= uli + getbegy(parent); -+ j -= ulj + getbegx(parent); -+ } -+ } -+ -+ if (more) -+ *more = FALSE; -+ - for (;;) { -- tail_line("Upper left [%2d,%2d] Lower right [%2d,%2d] -> %d,%d", -+ bool moved = FALSE; -+ -+ tail_line("Upper left [%2d,%2d] Lower right [%2d,%2d] -> %d,%d -> %d,%d", - uli, ulj, - lri, lrj, -+ i, j, - uli + i, ulj + j); - wmove(parent, uli + i, ulj + j); - - switch (wgetch(parent)) { - case KEY_UP: - i += si - 1; -+ moved = TRUE; - break; - case KEY_DOWN: - i++; -+ moved = TRUE; - break; - case KEY_LEFT: - j += sj - 1; -+ moved = TRUE; - break; - case KEY_RIGHT: - j++; -+ moved = TRUE; - break; - case QUIT: - case ESCAPE: -@@ -161,8 +199,13 @@ - - getmouse(&event); - if (event.y > uli && event.x > ulj) { -- i = event.y - uli; -- j = event.x - ulj; -+ if (parent != stdscr) { -+ i = event.y - getbegy(parent) - uli; -+ j = event.x - getbegx(parent) - ulj; -+ } else { -+ i = event.y - uli; -+ j = event.x - ulj; -+ } - } else { - beep(); - break; -@@ -175,8 +218,26 @@ - res.x = ulj + j; - return (&res); - } -- i %= si; -- j %= sj; -+ -+ if (si <= 0) -+ i = 0; -+ else -+ i %= si; -+ -+ if (sj <= 0) -+ j = 0; -+ else -+ j %= sj; -+ -+ /* -+ * If the caller can handle continuous movement, return the result. -+ */ -+ if (moved && more) { -+ *more = TRUE; -+ res.y = uli + i; -+ res.x = ulj + j; -+ return (&res); -+ } - } - } - -@@ -194,12 +255,20 @@ - bool result = FALSE; - - head_line("Use arrows to move cursor, anything else to mark corner 1"); -- if ((tmp = selectcell(parent, min_line, min_col, max_line, max_col)) != 0) { -+ if ((tmp = selectcell(parent, 0, -+ min_line, min_col, -+ max_line, max_col, -+ FALSE, -+ (bool *) 0)) != 0) { - *ul = *tmp; - MvWAddCh(parent, ul->y, ul->x, '*'); - - head_line("Use arrows to move cursor, anything else to mark corner 2"); -- if ((tmp = selectcell(parent, ul->y, ul->x, max_line, max_col)) != 0) { -+ if ((tmp = selectcell(parent, 0, -+ ul->y, ul->x, -+ max_line, max_col, -+ FALSE, -+ (bool *) 0)) != 0) { - *lr = *tmp; - MvWAddCh(parent, lr->y, lr->x, '*'); - wmove(parent, lr->y, lr->x); -@@ -252,6 +321,8 @@ - keypad(child, TRUE); - if (need > have) { - all_windows = typeRealloc(FRAME, need, all_windows); -+ if (!all_windows) -+ failed("add_window"); - } - all_windows[num_windows].parent = parent; - all_windows[num_windows].child = child; -@@ -341,10 +412,7 @@ - - for (n = 0; n < num_windows; ++n) { - if (all_windows[n].parent == parent) { -- int y0, x0; -- -- getbegyx(all_windows[n].child, y0, x0); -- mvwin(all_windows[n].child, y0 + dy, x0 + dx); -+ mvwin(all_windows[n].child, dy, dx); - recur_move_window(all_windows[n].child, dy, dx); - } - } -@@ -366,20 +434,24 @@ - int min_line = top ? LINE_MIN : 0; - int max_line = top ? LINE_MAX : getmaxy(parent); - PAIR *tmp; -+ bool more; - - head_line("Select new position for %swindow", top ? "" : "sub"); - -- if ((tmp = selectcell(parent, -- min_line, min_col, -- max_line, max_col)) != 0) { -+ while ((tmp = selectcell(parent, -+ win, -+ min_line, min_col, -+ max_line, max_col, -+ FALSE, -+ &more)) != 0) { - int y0, x0; - getbegyx(parent, y0, x0); - /* -- * Note: Moving a subwindow has the effect of moving a viewport -- * around the screen. The parent window retains the contents of -- * the subwindow in the original location, but the viewport will -- * show the contents (again) at the new location. So it will look -- * odd when testing. -+ * Moving a subwindow has the effect of moving a viewport around -+ * the screen. The parent window retains the contents of the -+ * subwindow in the original location, but the viewport will show -+ * the contents (again) at the new location. So it will look odd -+ * when testing. - */ - if (mvwin(win, y0 + tmp->y, x0 + tmp->x) != ERR) { - if (recur) { -@@ -388,45 +460,69 @@ - refresh_all(win); - doupdate(); - result = TRUE; -+ } else { -+ result = FALSE; - } -+ if (!more) -+ break; - } - } -+ head_line("done"); - return result; - } - -+static void -+show_derwin(WINDOW *win) -+{ -+ int pary, parx, maxy, maxx; -+ -+ getmaxyx(win, maxy, maxx); -+ getparyx(win, pary, parx); -+ -+ head_line("Select new position for derived window at %d,%d (%d,%d)", -+ pary, parx, maxy, maxx); -+} -+ - /* - * test mvderwin(). - */ - static bool --move_subwin(WINDOW *win) -+move_derwin(WINDOW *win) - { - WINDOW *parent = parent_of(win); - bool result = FALSE; - - if (parent != 0) { - bool top = (parent == stdscr); -- if (!top) { -- int min_col = top ? COL_MIN : 0; -- int max_col = top ? COL_MAX : getmaxx(parent); -- int min_line = top ? LINE_MIN : 0; -- int max_line = top ? LINE_MAX : getmaxy(parent); -- PAIR *tmp; -- -- head_line("Select new position for subwindow"); -- -- if ((tmp = selectcell(parent, -- min_line, min_col, -- max_line, max_col)) != 0) { -- int y0, x0; -- getbegyx(parent, y0, x0); -- if (mvderwin(win, y0 + tmp->y, x0 + tmp->x) != ERR) { -- refresh_all(win); -- doupdate(); -- result = TRUE; -- } -+ int min_col = top ? COL_MIN : 0; -+ int max_col = top ? COL_MAX : getmaxx(parent); -+ int min_line = top ? LINE_MIN : 0; -+ int max_line = top ? LINE_MAX : getmaxy(parent); -+ PAIR *tmp; -+ bool more; -+ -+ show_derwin(win); -+ while ((tmp = selectcell(parent, -+ win, -+ min_line, min_col, -+ max_line, max_col, -+ TRUE, -+ &more)) != 0) { -+ if (mvderwin(win, tmp->y, tmp->x) != ERR) { -+ refresh_all(win); -+ doupdate(); -+ repaint_one(win); -+ doupdate(); -+ result = TRUE; -+ show_derwin(win); -+ } else { -+ flash(); - } -+ if (!more) -+ break; - } - } -+ head_line("done"); - return result; - } - -@@ -449,6 +545,28 @@ - wrefresh(win); - } - -+static void -+fill_with_pattern(WINDOW *win) -+{ -+ int y, x; -+ int y0, x0; -+ int y1, x1; -+ int ch = 'a'; -+ -+ getyx(win, y0, x0); -+ getmaxyx(win, y1, x1); -+ for (y = 0; y < y1; ++y) { -+ for (x = 0; x < x1; ++x) { -+ MvWAddCh(win, y, x, (chtype) ch); -+ if (++ch > 'z') -+ ch = 'a'; -+ } -+ } -+ wsyncdown(win); -+ wmove(win, y0, x0); -+ wrefresh(win); -+} -+ - #define lines_of(ul,lr) (lr.y - ul.y + 1) - #define cols_of(ul,lr) (lr.x - ul.x + 1) - #define pair_of(ul) ul.y, ul.x -@@ -523,12 +641,13 @@ - { 'b', "Draw a box inside the current window" }, - { 'c', "Create a new window" }, - { 'd', "Create a new derived window" }, -+ { 'D', "Move derived window (moves viewport)" }, - { 'f', "Fill the current window with the next character" }, -+ { 'F', "Fill the current window with a pattern" }, - { 'm', "Move the current window" }, - { 'M', "Move the current window (and its children)" }, - { 'q', "Quit" }, - { 's', "Create a new subwindow" }, -- { 't', "Move the current subwindow (moves content)" }, - { CTRL('L'), "Repaint all windows, doing current one last" }, - { CTRL('N'), "Cursor to next window" }, - { CTRL('P'), "Cursor to previous window" }, -@@ -571,6 +690,10 @@ - #endif /* NCURSES_MOUSE_VERSION */ - - while (!done && (ch = wgetch(current_win)) != ERR) { -+ int y, x; -+ -+ getyx(current_win, y, x); -+ - switch (ch) { - case '?': - show_help(current_win); -@@ -584,9 +707,18 @@ - case 'd': - current_win = create_my_derwin(current_win); - break; -+ case 'D': -+ if (!move_derwin(current_win)) { -+ tail_line("error"); -+ continue; -+ } -+ break; - case 'f': - fill_window(current_win, (chtype) wgetch(current_win)); - break; -+ case 'F': -+ fill_with_pattern(current_win); -+ break; - case 'm': - case 'M': - if (!move_window(current_win, (ch == 'M'))) { -@@ -600,12 +732,6 @@ - case 's': - current_win = create_my_subwin(current_win); - break; -- case 't': -- if (!move_subwin(current_win)) { -- tail_line("error"); -- continue; -- } -- break; - case CTRL('L'): - refresh_all(current_win); - break; -@@ -621,6 +747,7 @@ - /* want to allow deleting a window also */ - #endif - default: -+ wmove(current_win, y, x); - tail_line("unrecognized key (use '?' for help)"); - beep(); - continue; -diff -Naur ncurses-5.9/test/ncurses.c ncurses-5.9.patch/test/ncurses.c ---- ncurses-5.9/test/ncurses.c 2011-01-22 20:48:33.000000000 +0100 -+++ ncurses-5.9.patch/test/ncurses.c 2014-09-01 16:33:22.572792500 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2010,2011 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2013,2014 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -40,7 +40,7 @@ - Author: Eric S. Raymond <esr@snark.thyrsus.com> 1993 - Thomas E. Dickey (beginning revision 1.27 in 1996). - --$Id: ncurses.c,v 1.365 2011/01/22 19:48:33 tom Exp $ -+$Id: ncurses.c,v 1.397 2014/02/01 22:29:37 tom Exp $ - - ***************************************************************************/ - -@@ -157,15 +157,23 @@ - static int max_pairs; /* ...and the number of color pairs */ - - typedef struct { -- short red; -- short green; -- short blue; -+ NCURSES_COLOR_T red; -+ NCURSES_COLOR_T green; -+ NCURSES_COLOR_T blue; - } RGB_DATA; - - static RGB_DATA *all_colors; - - static void main_menu(bool); - -+static void -+failed(const char *s) -+{ -+ perror(s); -+ endwin(); -+ ExitProgram(EXIT_FAILURE); -+} -+ - /* The behavior of mvhline, mvvline for negative/zero length is unspecified, - * though we can rely on negative x/y values to stop the macro. - */ -@@ -490,7 +498,7 @@ - #ifdef __MINGW32__ - system("cmd.exe"); - #else -- system("sh"); -+ IGNORE_RC(system("sh")); - #endif - if (message) - addstr("returned from shellout.\n"); -@@ -723,6 +731,8 @@ - len_winstack = need; - winstack = typeRealloc(WINSTACK, len_winstack, winstack); - } -+ if (!winstack) -+ failed("remember_boxes"); - winstack[level].text = txt_win; - winstack[level].frame = box_win; - } -@@ -777,12 +787,21 @@ - } - doupdate(); - } --#endif /* resize_boxes */ -+#endif /* resize_boxes */ - #else - #define forget_boxes() /* nothing */ - #define remember_boxes(level,text,frame) /* nothing */ - #endif - -+/* -+ * Return-code is OK/ERR or a keyname. -+ */ -+static const char * -+ok_keyname(int code) -+{ -+ return ((code == OK) ? "OK" : ((code == ERR) ? "ERR" : keyname(code))); -+} -+ - static void - wgetch_test(unsigned level, WINDOW *win, int delay) - { -@@ -824,9 +843,11 @@ - } else if (c == 'g') { - waddstr(win, "getstr test: "); - echo(); -- wgetnstr(win, buf, sizeof(buf) - 1); -+ c = wgetnstr(win, buf, sizeof(buf) - 1); - noecho(); -- wprintw(win, "I saw %d characters:\n\t`%s'.", (int) strlen(buf), buf); -+ wprintw(win, "I saw %d characters:\n\t`%s' (%s).", -+ (int) strlen(buf), buf, -+ ok_keyname(c)); - wclrtoeol(win); - wgetch_wrap(win, first_y); - } else if (c == 'k') { -@@ -1023,6 +1044,8 @@ - free(result); - result = 0; - } -+ } else { -+ failed("wcstos"); - } - } - return result; -@@ -1072,7 +1095,7 @@ - } else if (c == 'g') { - waddstr(win, "getstr test: "); - echo(); -- code = wgetn_wstr(win, wint_buf, sizeof(wint_buf) - 1); -+ code = wgetn_wstr(win, wint_buf, BUFSIZ - 1); - noecho(); - if (code == ERR) { - wprintw(win, "wgetn_wstr returns an error."); -@@ -1278,29 +1301,29 @@ - } - - static bool --cycle_color_attr(int ch, short *fg, short *bg, short *tx) -+cycle_color_attr(int ch, NCURSES_COLOR_T *fg, NCURSES_COLOR_T *bg, NCURSES_COLOR_T *tx) - { - bool error = FALSE; - - if (use_colors) { - switch (ch) { - case 'f': -- *fg = (short) (*fg + 1); -+ *fg = (NCURSES_COLOR_T) (*fg + 1); - break; - case 'F': -- *fg = (short) (*fg - 1); -+ *fg = (NCURSES_COLOR_T) (*fg - 1); - break; - case 'b': -- *bg = (short) (*bg + 1); -+ *bg = (NCURSES_COLOR_T) (*bg + 1); - break; - case 'B': -- *bg = (short) (*bg - 1); -+ *bg = (NCURSES_COLOR_T) (*bg - 1); - break; - case 't': -- *tx = (short) (*tx + 1); -+ *tx = (NCURSES_COLOR_T) (*tx + 1); - break; - case 'T': -- *tx = (short) (*tx - 1); -+ *tx = (NCURSES_COLOR_T) (*tx - 1); - break; - default: - beep(); -@@ -1308,17 +1331,17 @@ - break; - } - if (*fg >= COLORS) -- *fg = (short) min_colors; -+ *fg = (NCURSES_COLOR_T) min_colors; - if (*fg < min_colors) -- *fg = (short) (COLORS - 1); -+ *fg = (NCURSES_COLOR_T) (COLORS - 1); - if (*bg >= COLORS) -- *bg = (short) min_colors; -+ *bg = (NCURSES_COLOR_T) min_colors; - if (*bg < min_colors) -- *bg = (short) (COLORS - 1); -+ *bg = (NCURSES_COLOR_T) (COLORS - 1); - if (*tx >= COLORS) - *tx = -1; - if (*tx < -1) -- *tx = (short) (COLORS - 1); -+ *tx = (NCURSES_COLOR_T) (COLORS - 1); - } else { - beep(); - error = TRUE; -@@ -1394,7 +1417,7 @@ - if (!(termattrs() & test)) { - printw(" (N/A)"); - } else { -- if (ncv > 0 && (getbkgd(stdscr) & A_COLOR)) { -+ if (ncv > 0 && stdscr && (getbkgd(stdscr) & A_COLOR)) { - static const chtype table[] = - { - A_STANDOUT, -@@ -1406,6 +1429,9 @@ - #ifdef A_INVIS - A_INVIS, - #endif -+#ifdef A_ITALIC -+ A_ITALIC, -+#endif - A_PROTECT, - A_ALTCHARSET - }; -@@ -1427,11 +1453,13 @@ - } - return row + 2; - } -+ -+typedef struct { -+ attr_t attr; -+ NCURSES_CONST char *name; -+} ATTR_TBL; - /* *INDENT-OFF* */ --static const struct { -- chtype attr; -- NCURSES_CONST char * name; --} attrs_to_test[] = { -+static const ATTR_TBL attrs_to_test[] = { - { A_STANDOUT, "STANDOUT" }, - { A_REVERSE, "REVERSE" }, - { A_BOLD, "BOLD" }, -@@ -1442,12 +1470,36 @@ - #ifdef A_INVIS - { A_INVIS, "INVISIBLE" }, - #endif -+#ifdef A_ITALIC -+ { A_ITALIC, "ITALIC" }, -+#endif - { A_NORMAL, "NORMAL" }, - }; - /* *INDENT-ON* */ - -+static unsigned -+init_attr_list(ATTR_TBL * target, attr_t attrs) -+{ -+ unsigned result = 0; -+ size_t n; -+ -+ for (n = 0; n < SIZEOF(attrs_to_test); ++n) { -+ attr_t test = attrs_to_test[n].attr; -+ if (test == A_NORMAL || (test & attrs) != 0) { -+ target[result++] = attrs_to_test[n]; -+ } -+ } -+ return result; -+} -+ - static bool --attr_getc(int *skip, short *fg, short *bg, short *tx, int *ac, unsigned *kc) -+attr_getc(int *skip, -+ NCURSES_COLOR_T *fg, -+ NCURSES_COLOR_T *bg, -+ NCURSES_COLOR_T *tx, -+ int *ac, -+ unsigned *kc, -+ unsigned limit) - { - bool result = TRUE; - bool error = FALSE; -@@ -1480,13 +1532,13 @@ - break; - case 'v': - if (*kc == 0) -- *kc = SIZEOF(attrs_to_test) - 1; -+ *kc = limit - 1; - else - *kc -= 1; - break; - case 'V': - *kc += 1; -- if (*kc >= SIZEOF(attrs_to_test)) -+ if (*kc >= limit) - *kc = 0; - break; - case '<': -@@ -1513,72 +1565,78 @@ - { - int n; - int skip = get_xmc(); -- short fg = COLOR_BLACK; /* color pair 0 is special */ -- short bg = COLOR_BLACK; -- short tx = -1; -+ NCURSES_COLOR_T fg = COLOR_BLACK; /* color pair 0 is special */ -+ NCURSES_COLOR_T bg = COLOR_BLACK; -+ NCURSES_COLOR_T tx = -1; - int ac = 0; - unsigned j, k; -+ ATTR_TBL my_list[SIZEOF(attrs_to_test)]; -+ unsigned my_size = init_attr_list(my_list, termattrs()); - -- if (skip < 0) -- skip = 0; -- -- n = skip; /* make it easy */ -- k = SIZEOF(attrs_to_test) - 1; -- init_attr_string(); -+ if (my_size > 1) { -+ if (skip < 0) -+ skip = 0; -+ -+ n = skip; /* make it easy */ -+ k = my_size - 1; -+ init_attr_string(); - -- do { -- int row = 2; -- chtype normal = A_NORMAL | BLANK; -- chtype extras = (chtype) ac; -+ do { -+ int row = 2; -+ chtype normal = A_NORMAL | BLANK; -+ chtype extras = (chtype) ac; - -- if (use_colors) { -- short pair = (short) (fg != COLOR_BLACK || bg != COLOR_BLACK); -- if (pair != 0) { -- pair = 1; -- if (init_pair(pair, fg, bg) == ERR) { -- beep(); -- } else { -- normal |= (chtype) COLOR_PAIR(pair); -+ if (use_colors) { -+ NCURSES_PAIRS_T pair = 0; -+ if ((fg != COLOR_BLACK) || (bg != COLOR_BLACK)) { -+ pair = 1; -+ if (init_pair(pair, fg, bg) == ERR) { -+ beep(); -+ } else { -+ normal |= (chtype) COLOR_PAIR(pair); -+ } - } -- } -- if (tx >= 0) { -- pair = 2; -- if (init_pair(pair, tx, bg) == ERR) { -- beep(); -- } else { -- extras |= (chtype) COLOR_PAIR(pair); -+ if (tx >= 0) { -+ pair = 2; -+ if (init_pair(pair, tx, bg) == ERR) { -+ beep(); -+ } else { -+ extras |= (chtype) COLOR_PAIR(pair); -+ } - } - } -- } -- bkgd(normal); -- bkgdset(normal); -- erase(); -+ bkgd(normal); -+ bkgdset(normal); -+ erase(); - -- box(stdscr, 0, 0); -- MvAddStr(0, 20, "Character attribute test display"); -+ box(stdscr, 0, 0); -+ MvAddStr(0, 20, "Character attribute test display"); - -- for (j = 0; j < SIZEOF(attrs_to_test); ++j) { -- bool arrow = (j == k); -- row = show_attr(row, n, arrow, -- extras | -- attrs_to_test[j].attr | -- attrs_to_test[k].attr, -- attrs_to_test[j].name); -- } -- -- MvPrintw(row, 8, -- "This terminal does %shave the magic-cookie glitch", -- get_xmc() > -1 ? "" : "not "); -- MvPrintw(row + 1, 8, "Enter '?' for help."); -- show_color_attr(fg, bg, tx); -- printw(" ACS (%d)", ac != 0); -+ for (j = 0; j < my_size; ++j) { -+ bool arrow = (j == k); -+ row = show_attr(row, n, arrow, -+ extras | -+ my_list[j].attr | -+ my_list[k].attr, -+ my_list[j].name); -+ } -+ -+ MvPrintw(row, 8, -+ "This terminal does %shave the magic-cookie glitch", -+ get_xmc() > -1 ? "" : "not "); -+ MvPrintw(row + 1, 8, "Enter '?' for help."); -+ show_color_attr(fg, bg, tx); -+ printw(" ACS (%d)", ac != 0); - -- refresh(); -- } while (attr_getc(&n, &fg, &bg, &tx, &ac, &k)); -+ refresh(); -+ } while (attr_getc(&n, &fg, &bg, &tx, &ac, &k, my_size)); - -- bkgdset(A_NORMAL | BLANK); -- erase(); -- endwin(); -+ bkgdset(A_NORMAL | BLANK); -+ erase(); -+ endwin(); -+ } else { -+ Cannot("does not support video attributes."); -+ } - } - - #if USE_WIDEC_SUPPORT -@@ -1616,7 +1674,7 @@ - } - - static void --set_wide_background(short pair) -+set_wide_background(NCURSES_PAIRS_T pair) - { - cchar_t normal; - wchar_t blank[2]; -@@ -1634,9 +1692,10 @@ - attr_t result = A_NORMAL; - attr_t attr; - cchar_t ch; -- short pair; -+ NCURSES_PAIRS_T pair; - wchar_t wch[10]; - -+ memset(&ch, 0, sizeof(ch)); - if (getbkgrnd(&ch) != ERR) { - if (getcchar(&ch, wch, &attr, &pair, 0) != ERR) { - result = attr; -@@ -1646,7 +1705,12 @@ - } - - static int --wide_show_attr(int row, int skip, bool arrow, chtype attr, short pair, const char *name) -+wide_show_attr(int row, -+ int skip, -+ bool arrow, -+ chtype attr, -+ NCURSES_PAIRS_T pair, -+ const char *name) - { - int ncv = get_ncv(); - chtype test = attr & ~WA_ALTCHARSET; -@@ -1675,10 +1739,10 @@ - add_wch(&ch); - } - } else { -- attr_t old_attr; -- short old_pair; -+ attr_t old_attr = 0; -+ NCURSES_PAIRS_T old_pair = 0; - -- (void) attr_get(&old_attr, &old_pair, 0); -+ (void) (attr_get) (&old_attr, &old_pair, 0); - (void) attr_set(attr, pair, 0); - addwstr(wide_attr_test_string); - (void) attr_set(old_attr, old_pair, 0); -@@ -1723,7 +1787,10 @@ - } - - static bool --wide_attr_getc(int *skip, short *fg, short *bg, short *tx, int *ac, unsigned *kc) -+wide_attr_getc(int *skip, -+ NCURSES_COLOR_T *fg, NCURSES_COLOR_T *bg, -+ NCURSES_COLOR_T *tx, int *ac, -+ unsigned *kc, unsigned limit) - { - bool result = TRUE; - bool error = FALSE; -@@ -1756,13 +1823,13 @@ - break; - case 'v': - if (*kc == 0) -- *kc = SIZEOF(attrs_to_test) - 1; -+ *kc = limit - 1; - else - *kc -= 1; - break; - case 'V': - *kc += 1; -- if (*kc >= SIZEOF(attrs_to_test)) -+ if (*kc >= limit) - *kc = 0; - break; - case '<': -@@ -1789,68 +1856,74 @@ - { - int n; - int skip = get_xmc(); -- short fg = COLOR_BLACK; /* color pair 0 is special */ -- short bg = COLOR_BLACK; -- short tx = -1; -+ NCURSES_COLOR_T fg = COLOR_BLACK; /* color pair 0 is special */ -+ NCURSES_COLOR_T bg = COLOR_BLACK; -+ NCURSES_COLOR_T tx = -1; - int ac = 0; - unsigned j, k; -+ ATTR_TBL my_list[SIZEOF(attrs_to_test)]; -+ unsigned my_size = init_attr_list(my_list, term_attrs()); - -- if (skip < 0) -- skip = 0; -+ if (my_size > 1) { -+ if (skip < 0) -+ skip = 0; -+ -+ n = skip; /* make it easy */ -+ k = my_size - 1; -+ wide_init_attr_string(); - -- n = skip; /* make it easy */ -- k = SIZEOF(attrs_to_test) - 1; -- wide_init_attr_string(); -- -- do { -- int row = 2; -- short pair = 0; -- short extras = 0; -+ do { -+ int row = 2; -+ NCURSES_PAIRS_T pair = 0; -+ NCURSES_PAIRS_T extras = 0; - -- if (use_colors) { -- pair = (short) (fg != COLOR_BLACK || bg != COLOR_BLACK); -- if (pair != 0) { -- pair = 1; -- if (init_pair(pair, fg, bg) == ERR) { -- beep(); -+ if (use_colors) { -+ pair = (NCURSES_PAIRS_T) (fg != COLOR_BLACK || bg != COLOR_BLACK); -+ if (pair != 0) { -+ pair = 1; -+ if (init_pair(pair, fg, bg) == ERR) { -+ beep(); -+ } - } -- } -- extras = pair; -- if (tx >= 0) { -- extras = 2; -- if (init_pair(extras, tx, bg) == ERR) { -- beep(); -+ extras = pair; -+ if (tx >= 0) { -+ extras = 2; -+ if (init_pair(extras, tx, bg) == ERR) { -+ beep(); -+ } - } - } -- } -- set_wide_background(pair); -- erase(); -+ set_wide_background(pair); -+ erase(); - -- box_set(stdscr, 0, 0); -- MvAddStr(0, 20, "Character attribute test display"); -+ box_set(stdscr, 0, 0); -+ MvAddStr(0, 20, "Character attribute test display"); - -- for (j = 0; j < SIZEOF(attrs_to_test); ++j) { -- row = wide_show_attr(row, n, j == k, -- ((attr_t) ac | -- attrs_to_test[j].attr | -- attrs_to_test[k].attr), -- extras, -- attrs_to_test[j].name); -- } -- -- MvPrintw(row, 8, -- "This terminal does %shave the magic-cookie glitch", -- get_xmc() > -1 ? "" : "not "); -- MvPrintw(row + 1, 8, "Enter '?' for help."); -- show_color_attr(fg, bg, tx); -- printw(" ACS (%d)", ac != 0); -+ for (j = 0; j < my_size; ++j) { -+ row = wide_show_attr(row, n, j == k, -+ ((attr_t) ac | -+ my_list[j].attr | -+ my_list[k].attr), -+ extras, -+ my_list[j].name); -+ } -+ -+ MvPrintw(row, 8, -+ "This terminal does %shave the magic-cookie glitch", -+ get_xmc() > -1 ? "" : "not "); -+ MvPrintw(row + 1, 8, "Enter '?' for help."); -+ show_color_attr(fg, bg, tx); -+ printw(" ACS (%d)", ac != 0); - -- refresh(); -- } while (wide_attr_getc(&n, &fg, &bg, &tx, &ac, &k)); -+ refresh(); -+ } while (wide_attr_getc(&n, &fg, &bg, &tx, &ac, &k, my_size)); - -- set_wide_background(0); -- erase(); -- endwin(); -+ set_wide_background(0); -+ erase(); -+ endwin(); -+ } else { -+ Cannot("does not support extended video attributes."); -+ } - } - #endif - -@@ -1895,7 +1968,7 @@ - } else if (color < 0) { - strcpy(temp, "default"); - } else { -- strcpy(temp, the_color_names[color]); -+ sprintf(temp, "%.*s", 16, the_color_names[color]); - } - printw("%-*.*s", width, width, temp); - } -@@ -1949,7 +2022,7 @@ - static void - color_test(void) - { -- short i; -+ NCURSES_PAIRS_T i; - int top = 0, width; - int base_row = 0; - int grid_top = top + 3; -@@ -2010,16 +2083,16 @@ - show_color_name(top + 2, (i + 1) * width, i + min_colors, opt_wide); - - /* show a grid of colors, with color names/ numbers on the left */ -- for (i = (short) (base_row * per_row); i < pairs_max; i++) { -+ for (i = (NCURSES_PAIRS_T) (base_row * per_row); i < pairs_max; i++) { - int row = grid_top + (i / per_row) - base_row; - int col = (i % per_row + 1) * width; -- short pair = i; -+ NCURSES_PAIRS_T pair = i; - --#define InxToFG(i) (short) ((i % (COLORS - min_colors)) + min_colors) --#define InxToBG(i) (short) ((i / (COLORS - min_colors)) + min_colors) -+#define InxToFG(i) (NCURSES_COLOR_T) ((i % (COLORS - min_colors)) + min_colors) -+#define InxToBG(i) (NCURSES_COLOR_T) ((i / (COLORS - min_colors)) + min_colors) - if (row >= 0 && move(row, col) != ERR) { -- short fg = InxToFG(i); -- short bg = InxToBG(i); -+ NCURSES_COLOR_T fg = InxToFG(i); -+ NCURSES_COLOR_T bg = InxToBG(i); - - init_pair(pair, fg, bg); - attron((attr_t) COLOR_PAIR(pair)); -@@ -2031,7 +2104,7 @@ - attron((attr_t) A_REVERSE); - - if (opt_nums) { -- sprintf(numbered, "{%02X}", i); -+ sprintf(numbered, "{%02X}", (int) i); - hello = numbered; - } - printw("%-*.*s", width, width, hello); -@@ -2159,7 +2232,7 @@ - bool opt_wide = FALSE; - bool opt_nums = FALSE; - bool opt_xchr = FALSE; -- wchar_t buffer[10]; -+ wchar_t buffer[80]; - WINDOW *helpwin; - - if (COLORS * COLORS == COLOR_PAIRS) { -@@ -2216,11 +2289,11 @@ - for (i = (base_row * per_row); i < pairs_max; i++) { - int row = grid_top + (i / per_row) - base_row; - int col = (i % per_row + 1) * width; -- short pair = (short) i; -+ NCURSES_PAIRS_T pair = (NCURSES_PAIRS_T) i; - - if (row >= 0 && move(row, col) != ERR) { - init_pair(pair, InxToFG(i), InxToBG(i)); -- color_set(pair, NULL); -+ (void) color_set(pair, NULL); - if (opt_acsc) - attr_on((attr_t) A_ALTCHARSET, NULL); - if (opt_bold) -@@ -2347,21 +2420,21 @@ - #endif /* USE_WIDEC_SUPPORT */ - - static void --change_color(short current, int field, int value, int usebase) -+change_color(NCURSES_PAIRS_T current, int field, int value, int usebase) - { -- short red, green, blue; -+ NCURSES_COLOR_T red, green, blue; - - color_content(current, &red, &green, &blue); - - switch (field) { - case 0: -- red = (short) (usebase ? (red + value) : value); -+ red = (NCURSES_COLOR_T) (usebase ? (red + value) : value); - break; - case 1: -- green = (short) (usebase ? (green + value) : value); -+ green = (NCURSES_COLOR_T) (usebase ? (green + value) : value); - break; - case 2: -- blue = (short) (usebase ? (blue + value) : value); -+ blue = (NCURSES_COLOR_T) (usebase ? (blue + value) : value); - break; - } - -@@ -2372,7 +2445,7 @@ - static void - init_all_colors(void) - { -- short c; -+ NCURSES_PAIRS_T c; - - for (c = 0; c < COLORS; ++c) - init_color(c, -@@ -2398,18 +2471,20 @@ - refresh(); - - for (i = 0; i < max_colors; i++) -- init_pair((short) i, (short) COLOR_WHITE, (short) i); -+ init_pair((NCURSES_PAIRS_T) i, -+ (NCURSES_COLOR_T) COLOR_WHITE, -+ (NCURSES_COLOR_T) i); - - MvPrintw(LINES - 2, 0, "Number: %d", value); - - do { -- short red, green, blue; -+ NCURSES_COLOR_T red, green, blue; - - attron(A_BOLD); - MvAddStr(0, 20, "Color RGB Value Editing"); - attroff(A_BOLD); - -- for (i = (short) top_color; -+ for (i = (NCURSES_COLOR_T) top_color; - (i - top_color < page_size) - && (i < max_colors); i++) { - char numeric[80]; -@@ -2423,30 +2498,30 @@ - addstr(" "); - (void) attrset(A_NORMAL); - -- color_content((short) i, &red, &green, &blue); -+ color_content((NCURSES_PAIRS_T) i, &red, &green, &blue); - addstr(" R = "); - if (current == i && field == 0) - attron(A_STANDOUT); -- printw("%04d", red); -+ printw("%04d", (int) red); - if (current == i && field == 0) - (void) attrset(A_NORMAL); - addstr(", G = "); - if (current == i && field == 1) - attron(A_STANDOUT); -- printw("%04d", green); -+ printw("%04d", (int) green); - if (current == i && field == 1) - (void) attrset(A_NORMAL); - addstr(", B = "); - if (current == i && field == 2) - attron(A_STANDOUT); -- printw("%04d", blue); -+ printw("%04d", (int) blue); - if (current == i && field == 2) - (void) attrset(A_NORMAL); - (void) attrset(A_NORMAL); - printw(" ( %3d %3d %3d )", -- scaled_rgb(red), -- scaled_rgb(green), -- scaled_rgb(blue)); -+ (int) scaled_rgb(red), -+ (int) scaled_rgb(green), -+ (int) scaled_rgb(blue)); - } - - MvAddStr(LINES - 3, 0, -@@ -2510,15 +2585,15 @@ - break; - - case '+': -- change_color((short) current, field, value, 1); -+ change_color((NCURSES_PAIRS_T) current, field, value, 1); - break; - - case '-': -- change_color((short) current, field, -value, 1); -+ change_color((NCURSES_PAIRS_T) current, field, -value, 1); - break; - - case '=': -- change_color((short) current, field, value, 0); -+ change_color((NCURSES_PAIRS_T) current, field, value, 0); - break; - - case '?': -@@ -2545,7 +2620,9 @@ - endwin(); - main_menu(FALSE); - for (i = 0; i < max_colors; i++) -- init_pair((short) i, (short) COLOR_WHITE, (short) i); -+ init_pair((NCURSES_PAIRS_T) i, -+ (NCURSES_COLOR_T) COLOR_WHITE, -+ (NCURSES_COLOR_T) i); - refresh(); - break; - -@@ -2586,32 +2663,19 @@ - * Alternate character-set stuff - * - ****************************************************************************/ --/* *INDENT-OFF* */ --static struct { -- chtype attr; -- const char *name; --} attrs_to_cycle[] = { -- { A_NORMAL, "normal" }, -- { A_BOLD, "bold" }, -- { A_BLINK, "blink" }, -- { A_REVERSE, "reverse" }, -- { A_UNDERLINE, "underline" }, --}; --/* *INDENT-ON* */ -- - static bool --cycle_attr(int ch, unsigned *at_code, chtype *attr) -+cycle_attr(int ch, unsigned *at_code, chtype *attr, ATTR_TBL * list, unsigned limit) - { - bool result = TRUE; - - switch (ch) { - case 'v': -- if ((*at_code += 1) >= SIZEOF(attrs_to_cycle)) -+ if ((*at_code += 1) >= limit) - *at_code = 0; - break; - case 'V': - if (*at_code == 0) -- *at_code = SIZEOF(attrs_to_cycle) - 1; -+ *at_code = limit - 1; - else - *at_code -= 1; - break; -@@ -2620,12 +2684,12 @@ - break; - } - if (result) -- *attr = attrs_to_cycle[*at_code].attr; -+ *attr = list[*at_code].attr; - return result; - } - - static bool --cycle_colors(int ch, int *fg, int *bg, short *pair) -+cycle_colors(int ch, int *fg, int *bg, NCURSES_PAIRS_T *pair) - { - bool result = FALSE; - -@@ -2653,10 +2717,12 @@ - break; - } - if (result) { -- *pair = (short) (*fg != COLOR_BLACK || *bg != COLOR_BLACK); -+ *pair = (NCURSES_PAIRS_T) (*fg != COLOR_BLACK || *bg != COLOR_BLACK); - if (*pair != 0) { - *pair = 1; -- if (init_pair(*pair, (short) *fg, (short) *bg) == ERR) { -+ if (init_pair(*pair, -+ (NCURSES_COLOR_T) *fg, -+ (NCURSES_COLOR_T) *bg) == ERR) { - result = FALSE; - } - } -@@ -2715,7 +2781,7 @@ - static void - call_slk_color(int fg, int bg) - { -- init_pair(1, (short) bg, (short) fg); -+ init_pair(1, (NCURSES_COLOR_T) bg, (NCURSES_COLOR_T) fg); - slk_color(1); - MvPrintw(SLK_WORK, 0, "Colors %d/%d\n", fg, bg); - clrtoeol(); -@@ -2737,8 +2803,10 @@ - #if HAVE_SLK_COLOR - int fg = COLOR_BLACK; - int bg = COLOR_WHITE; -- short pair = 0; -+ NCURSES_PAIRS_T pair = 0; - #endif -+ ATTR_TBL my_list[SIZEOF(attrs_to_test)]; -+ unsigned my_size = init_attr_list(my_list, termattrs()); - - c = CTRL('l'); - #if HAVE_SLK_COLOR -@@ -2800,7 +2868,7 @@ - MvAddStr(SLK_WORK, 0, "Please enter the label value: "); - strcpy(buf, ""); - if ((s = slk_label(c - '0')) != 0) { -- strncpy(buf, s, 8); -+ strncpy(buf, s, (size_t) 8); - } - wGetstring(stdscr, buf, 8); - slk_set((c - '0'), buf, fmt); -@@ -2819,7 +2887,7 @@ - #endif - - default: -- if (cycle_attr(c, &at_code, &attr)) { -+ if (cycle_attr(c, &at_code, &attr, my_list, my_size)) { - slk_attrset(attr); - slk_touch(); - slk_noutrefresh(); -@@ -2859,7 +2927,9 @@ - unsigned at_code = 0; - int fg = COLOR_BLACK; - int bg = COLOR_WHITE; -- short pair = 0; -+ NCURSES_PAIRS_T pair = 0; -+ ATTR_TBL my_list[SIZEOF(attrs_to_test)]; -+ unsigned my_size = init_attr_list(my_list, term_attrs()); - - c = CTRL('l'); - if (use_colors) { -@@ -2955,13 +3025,13 @@ - - case 'F': - if (use_colors) { -- fg = (short) ((fg + 1) % COLORS); -+ fg = (NCURSES_COLOR_T) ((fg + 1) % COLORS); - call_slk_color(fg, bg); - } - break; - case 'B': - if (use_colors) { -- bg = (short) ((bg + 1) % COLORS); -+ bg = (NCURSES_COLOR_T) ((bg + 1) % COLORS); - call_slk_color(fg, bg); - } - break; -@@ -2971,8 +3041,8 @@ - break; - #endif - default: -- if (cycle_attr(c, &at_code, &attr)) { -- slk_attr_set(attr, (fg || bg), NULL); -+ if (cycle_attr(c, &at_code, &attr, my_list, my_size)) { -+ slk_attr_set(attr, (NCURSES_COLOR_T) (fg || bg), NULL); - slk_touch(); - slk_noutrefresh(); - break; -@@ -3000,15 +3070,46 @@ - #endif - #endif /* SLK_INIT */ - --/* ISO 6429: codes 0x80 to 0x9f may be control characters that cause the -+static void -+show_256_chars(int repeat, attr_t attr, NCURSES_PAIRS_T pair) -+{ -+ unsigned first = 0; -+ unsigned last = 255; -+ unsigned code; -+ int count; -+ -+ erase(); -+ attron(A_BOLD); -+ MvPrintw(0, 20, "Display of Character Codes %#0x to %#0x", -+ first, last); -+ attroff(A_BOLD); -+ refresh(); -+ -+ for (code = first; code <= last; ++code) { -+ int row = (int) (2 + (code / 16)); -+ int col = (int) (5 * (code % 16)); -+ IGNORE_RC(mvaddch(row, col, colored_chtype(code, attr, pair))); -+ for (count = 1; count < repeat; ++count) { -+ addch(colored_chtype(code, attr, pair)); -+ } -+ } -+ -+} -+ -+/* -+ * Show a slice of 32 characters, allowing those to be repeated up to the -+ * screen's width. -+ * -+ * ISO 6429: codes 0x80 to 0x9f may be control characters that cause the - * terminal to perform functions. The remaining codes can be graphic. - */ - static void --show_upper_chars(unsigned first, int repeat, attr_t attr, short pair) -+show_upper_chars(int base, int pagesize, int repeat, attr_t attr, NCURSES_PAIRS_T pair) - { -- bool C1 = (first == 128); - unsigned code; -- unsigned last = first + 31; -+ unsigned first = (unsigned) base; -+ unsigned last = first + (unsigned) pagesize - 2; -+ bool C1 = (first == 128); - int reply; - - erase(); -@@ -3020,8 +3121,8 @@ - - for (code = first; code <= last; code++) { - int count = repeat; -- int row = 2 + ((int) (code - first) % 16); -- int col = ((int) (code - first) / 16) * COLS / 2; -+ int row = 2 + ((int) (code - first) % (pagesize / 2)); -+ int col = ((int) (code - first) / (pagesize / 2)) * COLS / 2; - char tmp[80]; - sprintf(tmp, "%3u (0x%x)", code, code); - MvPrintw(row, col, "%*s: ", COLS / 4, tmp); -@@ -3045,7 +3146,7 @@ - #define PC_COLS 4 - - static void --show_pc_chars(int repeat, attr_t attr, short pair) -+show_pc_chars(int repeat, attr_t attr, NCURSES_PAIRS_T pair) - { - unsigned code; - -@@ -3086,7 +3187,7 @@ - } - - static void --show_box_chars(int repeat, attr_t attr, short pair) -+show_box_chars(int repeat, attr_t attr, NCURSES_PAIRS_T pair) - { - (void) repeat; - -@@ -3133,7 +3234,7 @@ - } - - static void --show_acs_chars(int repeat, attr_t attr, short pair) -+show_acs_chars(int repeat, attr_t attr, NCURSES_PAIRS_T pair) - /* display the ACS character set */ - { - int n; -@@ -3195,6 +3296,7 @@ - acs_display(void) - { - int c = 'a'; -+ int pagesize = 32; - char *term = getenv("TERM"); - const char *pch_kludge = ((term != 0 && strstr(term, "linux")) - ? "p=PC, " -@@ -3205,8 +3307,10 @@ - int fg = COLOR_BLACK; - int bg = COLOR_BLACK; - unsigned at_code = 0; -- short pair = 0; -- void (*last_show_acs) (int, attr_t, short) = 0; -+ NCURSES_PAIRS_T pair = 0; -+ void (*last_show_acs) (int, attr_t, NCURSES_PAIRS_T) = 0; -+ ATTR_TBL my_list[SIZEOF(attrs_to_test)]; -+ unsigned my_size = init_attr_list(my_list, termattrs()); - - do { - switch (c) { -@@ -3222,6 +3326,13 @@ - else - beep(); - break; -+ case 'w': -+ if (pagesize == 32) { -+ pagesize = 256; -+ } else { -+ pagesize = 32; -+ } -+ break; - case 'x': - ToggleAcs(last_show_acs, show_box_chars); - break; -@@ -3257,7 +3368,7 @@ - --repeat; - break; - default: -- if (cycle_attr(c, &at_code, &attr) -+ if (cycle_attr(c, &at_code, &attr, my_list, my_size) - || cycle_colors(c, &fg, &bg, &pair)) { - break; - } else { -@@ -3265,25 +3376,28 @@ - } - break; - } -- if (last_show_acs != 0) -+ if (pagesize != 32) { -+ show_256_chars(repeat, attr, pair); -+ } else if (last_show_acs != 0) { - last_show_acs(repeat, attr, pair); -- else -- show_upper_chars((unsigned) (digit * 32 + 128), repeat, attr, pair); -+ } else { -+ show_upper_chars(digit * pagesize + 128, pagesize, repeat, attr, pair); -+ } - - MvPrintw(LINES - 3, 0, - "Note: ANSI terminals may not display C1 characters."); - MvPrintw(LINES - 2, 0, -- "Select: a=ACS, x=box, %s0=C1, 1-3,+/- non-ASCII, </> repeat, ESC=quit", -+ "Select: a=ACS, w=all x=box, %s0=C1, 1-3,+/- non-ASCII, </> repeat, ESC=quit", - pch_kludge); - if (use_colors) { - MvPrintw(LINES - 1, 0, - "v/V, f/F, b/B cycle through video attributes (%s) and color %d/%d.", -- attrs_to_cycle[at_code].name, -+ my_list[at_code].name, - fg, bg); - } else { - MvPrintw(LINES - 1, 0, - "v/V cycles through video attributes (%s).", -- attrs_to_cycle[at_code].name); -+ my_list[at_code].name); - } - refresh(); - } while (!isQuit(c = Getchar())); -@@ -3295,7 +3409,7 @@ - - #if USE_WIDEC_SUPPORT - static cchar_t * --merge_wide_attr(cchar_t *dst, const cchar_t *src, attr_t attr, short pair) -+merge_wide_attr(cchar_t *dst, const cchar_t *src, attr_t attr, NCURSES_PAIRS_T pair) - { - int count; - -@@ -3312,8 +3426,55 @@ - return dst; - } - -+/* -+ * Header/legend take up no more than 8 lines, leaving 16 lines on a 24-line -+ * display. If there are no repeats, we could normally display 16 lines of 64 -+ * characters (1024 total). However, taking repeats and double-width cells -+ * into account, use 256 characters for the page. -+ */ -+static void -+show_paged_widechars(int base, -+ int pagesize, -+ int repeat, -+ int space, -+ attr_t attr, -+ NCURSES_PAIRS_T pair) -+{ -+ int first = base * pagesize; -+ int last = first + pagesize - 1; -+ int per_line = 16; -+ cchar_t temp; -+ wchar_t code; -+ wchar_t codes[10]; -+ -+ erase(); -+ attron(A_BOLD); -+ MvPrintw(0, 20, "Display of Character Codes %#x to %#x", first, last); -+ attroff(A_BOLD); -+ -+ for (code = first; (int) code <= last; code++) { -+ int row = (2 + ((int) code - first) / per_line); -+ int col = 5 * ((int) code % per_line); -+ int count; -+ -+ memset(&codes, 0, sizeof(codes)); -+ codes[0] = code; -+ setcchar(&temp, codes, attr, pair, 0); -+ move(row, col); -+ if (wcwidth(code) == 0 && code != 0) { -+ addch((chtype) space | -+ (A_REVERSE ^ attr) | -+ (attr_t) COLOR_PAIR(pair)); -+ } -+ add_wch(&temp); -+ for (count = 1; count < repeat; ++count) { -+ add_wch(&temp); -+ } -+ } -+} -+ - static void --show_upper_widechars(int first, int repeat, int space, attr_t attr, short pair) -+show_upper_widechars(int first, int repeat, int space, attr_t attr, NCURSES_PAIRS_T pair) - { - cchar_t temp; - wchar_t code; -@@ -3332,11 +3493,13 @@ - int count = repeat; - int y, x; - -- memset(&codes, 0, sizeof(codes)); -- codes[0] = code; - sprintf(tmp, "%3ld (0x%lx)", (long) code, (long) code); - MvPrintw(row, col, "%*s: ", COLS / 4, tmp); -+ -+ memset(&codes, 0, sizeof(codes)); -+ codes[0] = code; - setcchar(&temp, codes, attr, pair, 0); -+ - do { - /* - * Give non-spacing characters something to combine with. If we -@@ -3350,16 +3513,17 @@ - (attr_t) COLOR_PAIR(pair)); - } - /* -- * This could use add_wch(), but is done for comparison with the -- * normal 'f' test (and to make a test-case for echo_wchar()). -- * The screen will flicker because the erase() at the top of the -- * function is met by the builtin refresh() in echo_wchar(). -+ * This uses echo_wchar(), for comparison with the normal 'f' -+ * test (and to make a test-case for echo_wchar()). The screen -+ * may flicker because the erase() at the top of the function -+ * is met by the builtin refresh() in echo_wchar(). - */ - echo_wchar(&temp); - /* - * The repeat-count may make text wrap - avoid that. - */ - getyx(stdscr, y, x); -+ (void) y; - if (x >= col + (COLS / 2) - 2) - break; - } while (--count > 0); -@@ -3383,7 +3547,7 @@ - #define MERGE_ATTR(wch) merge_wide_attr(&temp, wch, attr, pair) - - static void --show_wacs_chars(int repeat, attr_t attr, short pair) -+show_wacs_chars(int repeat, attr_t attr, NCURSES_PAIRS_T pair) - /* display the wide-ACS character set */ - { - cchar_t temp; -@@ -3443,7 +3607,7 @@ - - #ifdef WACS_D_PLUS - static void --show_wacs_chars_double(int repeat, attr_t attr, short pair) -+show_wacs_chars_double(int repeat, attr_t attr, NCURSES_PAIRS_T pair) - /* display the wide-ACS character set */ - { - cchar_t temp; -@@ -3504,7 +3668,7 @@ - - #ifdef WACS_T_PLUS - static void --show_wacs_chars_thick(int repeat, attr_t attr, short pair) -+show_wacs_chars_thick(int repeat, attr_t attr, NCURSES_PAIRS_T pair) - /* display the wide-ACS character set */ - { - cchar_t temp; -@@ -3568,7 +3732,7 @@ - #define MERGE_ATTR(n,wch) merge_wide_attr(&temp[n], wch, attr, pair) - - static void --show_wbox_chars(int repeat, attr_t attr, short pair) -+show_wbox_chars(int repeat, attr_t attr, NCURSES_PAIRS_T pair) - { - cchar_t temp[8]; - -@@ -3603,7 +3767,7 @@ - #undef MERGE_ATTR - - static int --show_2_wacs(int n, const char *name, const char *code, attr_t attr, short pair) -+show_2_wacs(int n, const char *name, const char *code, attr_t attr, NCURSES_PAIRS_T pair) - { - const int height = 16; - int row = 2 + (n % height); -@@ -3612,7 +3776,7 @@ - - MvPrintw(row, col, "%*s : ", COLS / 4, name); - (void) attr_set(attr, pair, 0); -- addstr(strcpy(temp, code)); -+ addstr(strncpy(temp, code, 20)); - (void) attr_set(A_NORMAL, 0, 0); - return n + 1; - } -@@ -3620,7 +3784,7 @@ - #define SHOW_UTF8(n, name, code) show_2_wacs(n, name, code, attr, pair) - - static void --show_utf8_chars(int repeat, attr_t attr, short pair) -+show_utf8_chars(int repeat, attr_t attr, NCURSES_PAIRS_T pair) - { - int n; - -@@ -3680,12 +3844,15 @@ - int digit = 0; - int repeat = 1; - int space = ' '; -+ int pagesize = 32; - chtype attr = A_NORMAL; - int fg = COLOR_BLACK; - int bg = COLOR_BLACK; - unsigned at_code = 0; -- short pair = 0; -- void (*last_show_wacs) (int, attr_t, short) = 0; -+ NCURSES_PAIRS_T pair = 0; -+ void (*last_show_wacs) (int, attr_t, NCURSES_PAIRS_T) = 0; -+ ATTR_TBL my_list[SIZEOF(attrs_to_test)]; -+ unsigned my_size = init_attr_list(my_list, term_attrs()); - - do { - switch (c) { -@@ -3705,6 +3872,13 @@ - ToggleAcs(last_show_wacs, show_wacs_chars_thick); - break; - #endif -+ case 'w': -+ if (pagesize == 32) { -+ pagesize = 256; -+ } else { -+ pagesize = 32; -+ } -+ break; - case 'x': - ToggleAcs(last_show_wacs, show_wbox_chars); - break; -@@ -3728,7 +3902,7 @@ - } else if (c == '_') { - space = (space == ' ') ? '_' : ' '; - last_show_wacs = 0; -- } else if (cycle_attr(c, &at_code, &attr) -+ } else if (cycle_attr(c, &at_code, &attr, my_list, my_size) - || cycle_colors(c, &fg, &bg, &pair)) { - if (last_show_wacs != 0) - break; -@@ -3738,22 +3912,27 @@ - } - break; - } -- if (last_show_wacs != 0) -+ if (pagesize != 32) { -+ show_paged_widechars(digit, pagesize, repeat, space, attr, pair); -+ } else if (last_show_wacs != 0) { - last_show_wacs(repeat, attr, pair); -- else -+ } else { - show_upper_widechars(digit * 32 + 128, repeat, space, attr, pair); -+ } - -- MvPrintw(LINES - 3, 0, -- "Select: a/d/t WACS, x box, u UTF-8, 0-9,+/- non-ASCII, </> repeat, ESC=quit"); -+ MvPrintw(LINES - 4, 0, -+ "Select: a/d/t WACS, w=all x=box, u UTF-8, ^L repaint"); -+ MvPrintw(LINES - 3, 2, -+ "0-9,+/- non-ASCII, </> repeat, _ space, ESC=quit"); - if (use_colors) { -- MvPrintw(LINES - 2, 0, -+ MvPrintw(LINES - 2, 2, - "v/V, f/F, b/B cycle through video attributes (%s) and color %d/%d.", -- attrs_to_cycle[at_code].name, -+ my_list[at_code].name, - fg, bg); - } else { -- MvPrintw(LINES - 2, 0, -+ MvPrintw(LINES - 2, 2, - "v/V cycles through video attributes (%s).", -- attrs_to_cycle[at_code].name); -+ my_list[at_code].name); - } - refresh(); - } while (!isQuit(c = Getchar())); -@@ -3779,7 +3958,7 @@ - /* Use non-default colors if possible to exercise bce a little */ - if (use_colors) { - init_pair(1, COLOR_WHITE, COLOR_BLUE); -- normal |= COLOR_PAIR(1); -+ normal |= (chtype) COLOR_PAIR(1); - } - bkgdset(normal); - erase(); -@@ -4115,7 +4294,8 @@ - outerbox(ul, lr, TRUE); - refresh(); - -- wrefresh(rwindow); -+ if (rwindow != 0) -+ wrefresh(rwindow); - - move(0, 0); - clrtoeol(); -@@ -4185,10 +4365,12 @@ - transient((FRAME *) 0, (char *) 0); - switch (c) { - case CTRL('C'): -- if ((neww = typeCalloc(FRAME, 1)) == 0) { -+ if ((neww = typeCalloc(FRAME, (size_t) 1)) == 0) { -+ failed("acs_and_scroll"); - goto breakout; - } - if ((neww->wind = getwindow()) == (WINDOW *) 0) { -+ failed("acs_and_scroll"); - free(neww); - goto breakout; - } -@@ -4265,16 +4447,20 @@ - if ((fp = fopen(DUMPFILE, "r")) == (FILE *) 0) { - transient(current, "Can't open screen dump file"); - } else { -- if ((neww = typeCalloc(FRAME, 1)) != 0) { -+ if ((neww = typeCalloc(FRAME, (size_t) 1)) != 0) { - - neww->next = current ? current->next : 0; - neww->last = current; -- neww->last->next = neww; -- neww->next->last = neww; -+ if (neww->last != 0) -+ neww->last->next = neww; -+ if (neww->next != 0) -+ neww->next->last = neww; - - neww->wind = getwin(fp); - - wrefresh(neww->wind); -+ } else { -+ failed("acs_and_scroll"); - } - (void) fclose(fp); - } -@@ -4463,7 +4649,7 @@ - mkpanel(rows,cols,tly,tlx) - alloc a win and panel and associate them - --------------------------------------------------------------------------*/ - static PANEL * --mkpanel(short color, int rows, int cols, int tly, int tlx) -+mkpanel(NCURSES_COLOR_T color, int rows, int cols, int tly, int tlx) - { - WINDOW *win; - PANEL *pan = 0; -@@ -4472,8 +4658,10 @@ - if ((pan = new_panel(win)) == 0) { - delwin(win); - } else if (use_colors) { -- short fg = (short) ((color == COLOR_BLUE) ? COLOR_WHITE : COLOR_BLACK); -- short bg = color; -+ NCURSES_COLOR_T fg = (NCURSES_COLOR_T) ((color == COLOR_BLUE) -+ ? COLOR_WHITE -+ : COLOR_BLACK); -+ NCURSES_COLOR_T bg = color; - - init_pair(color, fg, bg); - wbkgdset(win, (attr_t) (COLOR_PAIR(color) | ' ')); -@@ -5226,7 +5414,7 @@ - #ifdef A_COLOR - if (use_colors) { - init_pair(2, COLOR_CYAN, COLOR_BLUE); -- wbkgd(subWin, COLOR_PAIR(2) | ' '); -+ wbkgd(subWin, (chtype) (COLOR_PAIR(2) | ' ')); - } - #endif - (void) wattrset(subWin, A_BOLD); -@@ -5449,6 +5637,8 @@ - for (n = 0; t_tbl[n].name != 0; n++) - need += strlen(t_tbl[n].name) + 2; - buf = typeMalloc(char, need); -+ if (!buf) -+ failed("tracetrace"); - } - sprintf(buf, "0x%02x = {", tlevel); - if (tlevel == 0) { -@@ -5622,10 +5812,9 @@ - set_form_sub(f, derwin(w, rows, cols, 1, 2)); - box(w, 0, 0); - keypad(w, TRUE); -+ if (post_form(f) != E_OK) -+ wrefresh(w); - } -- -- if (post_form(f) != E_OK) -- wrefresh(w); - } - - static void -@@ -5649,55 +5838,60 @@ - if (field_info(me, &rows, &cols, &frow, &fcol, &nrow, &nbuf) == E_OK - && nbuf > 0) { - char *source = field_buffer(me, 1); -- char temp[80]; -- long len; -- -- strcpy(temp, source ? source : ""); -- len = (long) (char *) field_userptr(me); -- if (c <= KEY_MAX) { -- if (isgraph(c) && (len + 1) < (int) sizeof(temp)) { -- temp[len++] = (char) c; -- temp[len] = 0; -- set_field_buffer(me, 1, temp); -- c = '*'; -- } else { -- c = 0; -- } -- } else { -- switch (c) { -- case REQ_BEG_FIELD: -- case REQ_CLR_EOF: -- case REQ_CLR_EOL: -- case REQ_DEL_LINE: -- case REQ_DEL_WORD: -- case REQ_DOWN_CHAR: -- case REQ_END_FIELD: -- case REQ_INS_CHAR: -- case REQ_INS_LINE: -- case REQ_LEFT_CHAR: -- case REQ_NEW_LINE: -- case REQ_NEXT_WORD: -- case REQ_PREV_WORD: -- case REQ_RIGHT_CHAR: -- case REQ_UP_CHAR: -- c = 0; /* we don't want to do inline editing */ -- break; -- case REQ_CLR_FIELD: -- if (len) { -- temp[0] = 0; -+ size_t have = (source ? strlen(source) : 0) + 1; -+ size_t need = 80 + have; -+ char *temp = malloc(need); -+ size_t len; -+ -+ if (temp != 0) { -+ strncpy(temp, source ? source : "", have + 1); -+ len = (size_t) (char *) field_userptr(me); -+ if (c <= KEY_MAX) { -+ if (isgraph(c) && (len + 1) < sizeof(temp)) { -+ temp[len++] = (char) c; -+ temp[len] = 0; - set_field_buffer(me, 1, temp); -+ c = '*'; -+ } else { -+ c = 0; - } -- break; -- case REQ_DEL_CHAR: -- case REQ_DEL_PREV: -- if (len) { -- temp[--len] = 0; -- set_field_buffer(me, 1, temp); -+ } else { -+ switch (c) { -+ case REQ_BEG_FIELD: -+ case REQ_CLR_EOF: -+ case REQ_CLR_EOL: -+ case REQ_DEL_LINE: -+ case REQ_DEL_WORD: -+ case REQ_DOWN_CHAR: -+ case REQ_END_FIELD: -+ case REQ_INS_CHAR: -+ case REQ_INS_LINE: -+ case REQ_LEFT_CHAR: -+ case REQ_NEW_LINE: -+ case REQ_NEXT_WORD: -+ case REQ_PREV_WORD: -+ case REQ_RIGHT_CHAR: -+ case REQ_UP_CHAR: -+ c = 0; /* we don't want to do inline editing */ -+ break; -+ case REQ_CLR_FIELD: -+ if (len) { -+ temp[0] = 0; -+ set_field_buffer(me, 1, temp); -+ } -+ break; -+ case REQ_DEL_CHAR: -+ case REQ_DEL_PREV: -+ if (len) { -+ temp[--len] = 0; -+ set_field_buffer(me, 1, temp); -+ } -+ break; - } -- break; - } -+ set_field_userptr(me, (void *) len); -+ free(temp); - } -- set_field_userptr(me, (void *) len); - } - return c; - } -@@ -6045,7 +6239,7 @@ - static void - overlap_test_1_attr(WINDOW *win, int flavor, int col) - { -- short cpair = (short) (1 + (flavor * 2) + col); -+ NCURSES_PAIRS_T cpair = (NCURSES_PAIRS_T) (1 + (flavor * 2) + col); - - switch (flavor) { - case 0: -@@ -6056,11 +6250,11 @@ - break; - case 2: - init_pair(cpair, COLOR_BLUE, COLOR_WHITE); -- (void) wattrset(win, (attr_t) COLOR_PAIR(cpair) | A_NORMAL); -+ (void) wattrset(win, (int) (COLOR_PAIR(cpair) | A_NORMAL)); - break; - case 3: - init_pair(cpair, COLOR_WHITE, COLOR_BLUE); -- (void) wattrset(win, (attr_t) COLOR_PAIR(cpair) | A_BOLD); -+ (void) wattrset(win, (int) (COLOR_PAIR(cpair) | A_BOLD)); - break; - } - } -@@ -6068,7 +6262,7 @@ - static void - overlap_test_2_attr(WINDOW *win, int flavor, int col) - { -- short cpair = (short) (9 + (flavor * 2) + col); -+ NCURSES_PAIRS_T cpair = (NCURSES_PAIRS_T) (9 + (flavor * 2) + col); - - switch (flavor) { - case 0: -@@ -6483,6 +6677,7 @@ - ," -a f,b set default-colors (assumed white-on-black)" - ," -d use default-colors if terminal supports them" - #endif -+ ," -E call use_env(FALSE) to ignore $LINES and $COLUMNS" - #if USE_SOFTKEYS - ," -e fmt specify format for soft-keys test (e)" - #endif -@@ -6495,6 +6690,9 @@ - #if USE_LIBPANEL - ," -s msec specify nominal time for panel-demo (default: 1, to hold)" - #endif -+#if defined(NCURSES_VERSION_PATCH) && (NCURSES_VERSION_PATCH >= 20120714) -+ ," -T call use_tioctl(TRUE) to allow SIGWINCH to override environment" -+#endif - #ifdef TRACE - ," -t mask specify default trace-level (may toggle with ^T)" - #endif -@@ -6517,7 +6715,7 @@ - } - - #ifdef SIGUSR1 --static RETSIGTYPE -+static void - announce_sig(int sig) - { - (void) fprintf(stderr, "Handled signal %d\r\n", sig); -@@ -6613,7 +6811,7 @@ - command = 0; - for (;;) { - char ch = '\0'; -- if (read(fileno(stdin), &ch, 1) <= 0) { -+ if (read(fileno(stdin), &ch, (size_t) 1) <= 0) { - if (command == 0) - command = 'q'; - break; -@@ -6681,17 +6879,27 @@ - - setlocale(LC_ALL, ""); - -- while ((c = getopt(argc, argv, "a:de:fhmp:s:t:")) != -1) { -+ while ((c = getopt(argc, argv, "a:dEe:fhmp:s:Tt:")) != -1) { - switch (c) { - #ifdef NCURSES_VERSION - case 'a': - assumed_colors = TRUE; -- sscanf(optarg, "%d,%d", &default_fg, &default_bg); -+ switch (sscanf(optarg, "%d,%d", &default_fg, &default_bg)) { -+ case 0: -+ default_fg = COLOR_WHITE; -+ /* FALLTHRU */ -+ case 1: -+ default_bg = COLOR_BLACK; -+ break; -+ } - break; - case 'd': - default_colors = TRUE; - break; - #endif -+ case 'E': -+ use_env(FALSE); -+ break; - case 'e': - my_e_param = atoi(optarg); - #ifdef NCURSES_VERSION -@@ -6721,6 +6929,11 @@ - nap_msec = (int) atol(optarg); - break; - #endif -+#if defined(NCURSES_VERSION_PATCH) && (NCURSES_VERSION_PATCH >= 20120714) -+ case 'T': -+ use_tioctl(TRUE); -+ break; -+#endif - #ifdef TRACE - case 't': - save_trace = (unsigned) strtol(optarg, 0, 0); -@@ -6761,7 +6974,7 @@ - bkgdset(BLANK); - - /* tests, in general, will want these modes */ -- use_colors = monochrome ? FALSE : has_colors(); -+ use_colors = (bool) (monochrome ? FALSE : has_colors()); - - if (use_colors) { - start_color(); -@@ -6772,7 +6985,7 @@ - use_default_colors(); - min_colors = -1; - } --#if NCURSES_VERSION_PATCH >= 20000708 -+#if HAVE_ASSUME_DEFAULT_COLORS - if (assumed_colors) - assume_default_colors(default_fg, default_bg); - #endif -@@ -6783,8 +6996,10 @@ - max_pairs = COLOR_PAIRS; /* was > 256 ? 256 : COLOR_PAIRS */ - - if (can_change_color()) { -- short cp; -+ NCURSES_PAIRS_T cp; - all_colors = typeMalloc(RGB_DATA, (unsigned) max_colors); -+ if (!all_colors) -+ failed("all_colors"); - for (cp = 0; cp < max_colors; ++cp) { - color_content(cp, - &all_colors[cp].red, -@@ -6809,9 +7024,10 @@ - && okRGB(red) - && okRGB(green) - && okRGB(blue)) { -- all_colors[c].red = (short) ((red * 1000) / scale); -- all_colors[c].green = (short) ((green * 1000) / scale); -- all_colors[c].blue = (short) ((blue * 1000) / scale); -+#define Scaled(n) (NCURSES_COLOR_T) (((n) * 1000) / scale) -+ all_colors[c].red = Scaled(red); -+ all_colors[c].green = Scaled(green); -+ all_colors[c].blue = Scaled(blue); - } - } - fclose(fp); -diff -Naur ncurses-5.9/test/newdemo.c ncurses-5.9.patch/test/newdemo.c ---- ncurses-5.9/test/newdemo.c 2010-12-12 01:19:15.000000000 +0100 -+++ ncurses-5.9.patch/test/newdemo.c 2014-09-01 16:33:22.572792500 +0200 -@@ -2,7 +2,7 @@ - * newdemo.c - A demo program using PDCurses. The program illustrate - * the use of colours for text output. - * -- * $Id: newdemo.c,v 1.35 2010/12/12 00:19:15 tom Exp $ -+ * $Id: newdemo.c,v 1.40 2013/04/27 19:46:53 tom Exp $ - */ - - #include <test.priv.h> -@@ -47,7 +47,7 @@ - /* - * Trap interrupt - */ --static RETSIGTYPE -+static void - trap(int sig GCC_UNUSED) - { - endwin(); -@@ -84,7 +84,7 @@ - if (pair > COLOR_PAIRS) - pair = COLOR_PAIRS; - init_pair((short) pair, (short) foreground, (short) background); -- (void) wattrset(win, (attr_t) COLOR_PAIR(pair)); -+ (void) wattrset(win, (int) COLOR_PAIR(pair)); - } - } - -@@ -96,7 +96,7 @@ - pair = COLOR_PAIRS; - attrs |= (chtype) COLOR_PAIR(pair); - } -- (void) wattrset(win, attrs); -+ (void) wattrset(win, (int) attrs); - return attrs; - } - -@@ -113,12 +113,19 @@ - getbegyx(win, by, bx); - sw = w / 3; - sh = h / 3; -- if ((swin1 = subwin(win, sh, sw, by + 3, bx + 5)) == NULL) -+ -+ if ((swin1 = subwin(win, sh, sw, by + 3, bx + 5)) == NULL) { - return 1; -- if ((swin2 = subwin(win, sh, sw, by + 4, bx + 8)) == NULL) -+ } -+ if ((swin2 = subwin(win, sh, sw, by + 4, bx + 8)) == NULL) { -+ delwin(swin1); - return 1; -- if ((swin3 = subwin(win, sh, sw, by + 5, bx + 11)) == NULL) -+ } -+ if ((swin3 = subwin(win, sh, sw, by + 5, bx + 11)) == NULL) { -+ delwin(swin1); -+ delwin(swin2); - return 1; -+ } - - set_colors(swin1, 8, COLOR_RED, COLOR_BLUE); - werase(swin1); -@@ -215,7 +222,7 @@ - { - WINDOW *win; - int w, x, y, i, j, k; -- char buffer[200]; -+ char buffer[SIZEOF(messages) * 80]; - const char *message; - int width, height; - chtype save[80]; -diff -Naur ncurses-5.9/test/package/mingw-ncurses-examples.spec ncurses-5.9.patch/test/package/mingw-ncurses-examples.spec ---- ncurses-5.9/test/package/mingw-ncurses-examples.spec 1970-01-01 01:00:00.000000000 +0100 -+++ ncurses-5.9.patch/test/package/mingw-ncurses-examples.spec 2014-09-01 16:33:22.572792500 +0200 -@@ -0,0 +1,109 @@ -+Summary: ncurses-examples - example/test programs from ncurses -+%?mingw_package_header -+ -+%define AppProgram ncurses-examples -+%define AppVersion MAJOR.MINOR -+%define AppRelease YYYYMMDD -+# $Id: mingw-ncurses-examples.spec,v 1.3 2013/10/26 23:30:21 tom Exp $ -+Name: mingw32-ncurses6-examples -+Version: %{AppVersion} -+Release: %{AppRelease} -+License: X11 -+Group: Development/Libraries -+Source: ncurses-examples-%{release}.tgz -+# URL: http://invisible-island.net/ncurses/ -+ -+BuildRequires: mingw32-ncurses6 -+ -+BuildRequires: mingw32-filesystem >= 95 -+BuildRequires: mingw32-gcc -+BuildRequires: mingw32-binutils -+ -+BuildRequires: mingw64-ncurses6 -+ -+BuildRequires: mingw64-filesystem >= 95 -+BuildRequires: mingw64-gcc -+BuildRequires: mingw64-binutils -+ -+%define CC_NORMAL -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wconversion -+%define CC_STRICT %{CC_NORMAL} -W -Wbad-function-cast -Wcast-align -Wcast-qual -Wmissing-declarations -Wnested-externs -Wpointer-arith -Wwrite-strings -ansi -pedantic -+ -+%description -n mingw32-ncurses6-examples -+Cross-compiling support for ncurses to mingw32. -+ -+The ncurses library routines are a terminal-independent method of -+updating character screens with reasonable optimization. -+ -+This package is used for testing ABI 6 with cross-compiles to MinGW. -+ -+%package -n mingw64-ncurses6-examples -+Summary: Curses library for MinGW64 -+ -+%description -n mingw64-ncurses6-examples -+Cross-compiling support for ncurses to mingw64. -+ -+The ncurses library routines are a terminal-independent method of -+updating character screens with reasonable optimization. -+ -+This package is used for testing ABI 6 with cross-compiles to MinGW. -+ -+%prep -+ -+# override location of bindir, e.g., to avoid conflict with pdcurses -+%global mingw32_bindir %{mingw32_exec_prefix}/bin/%{AppProgram} -+%global mingw64_bindir %{mingw64_exec_prefix}/bin/%{AppProgram} -+ -+%define CFG_OPTS \\\ -+ --disable-echo \\\ -+ --enable-warnings \\\ -+ --verbose -+ -+%define debug_package %{nil} -+%setup -q -n ncurses-examples-%{release} -+ -+%build -+mkdir BUILD-W32 -+pushd BUILD-W32 -+CFLAGS="%{CC_NORMAL}" \ -+CC=%{mingw32_cc} \ -+%mingw32_configure %{CFG_OPTS} -+cp config.status /tmp/ming32-config.status -+make -+popd -+ -+mkdir BUILD-W64 -+pushd BUILD-W64 -+CFLAGS="%{CC_NORMAL}" \ -+CC=%{mingw64_cc} \ -+%mingw64_configure %{CFG_OPTS} -+cp config.status /tmp/ming64-config.status -+make -+popd -+ -+%install -+rm -rf $RPM_BUILD_ROOT -+ -+pushd BUILD-W32 -+%{mingw32_make} install DESTDIR=$RPM_BUILD_ROOT -+popd -+ -+pushd BUILD-W64 -+%{mingw64_make} install DESTDIR=$RPM_BUILD_ROOT -+popd -+ -+%clean -+rm -rf $RPM_BUILD_ROOT -+ -+%files -+%defattr(-,root,root,-) -+ -+%files -n mingw32-ncurses6-examples -+%{mingw32_bindir}/* -+ -+%files -n mingw64-ncurses6-examples -+%{mingw64_bindir}/* -+ -+%changelog -+ -+* Sat Oct 19 2013 Thomas E. Dickey -+- initial version -diff -Naur ncurses-5.9/test/package/ncurses-examples.spec ncurses-5.9.patch/test/package/ncurses-examples.spec ---- ncurses-5.9/test/package/ncurses-examples.spec 2011-03-25 18:46:44.000000000 +0100 -+++ ncurses-5.9.patch/test/package/ncurses-examples.spec 2014-09-01 16:33:22.572792500 +0200 -@@ -2,7 +2,7 @@ - %define AppProgram ncurses-examples - %define AppVersion MAJOR.MINOR - %define AppRelease YYYYMMDD --# $Id: ncurses-examples.spec,v 1.2 2011/03/25 17:46:44 tom Exp $ -+# $Id: ncurses-examples.spec,v 1.3 2013/10/05 23:44:19 tom Exp $ - Name: %{AppProgram} - Version: %{AppVersion} - Release: %{AppRelease} -@@ -51,5 +51,5 @@ - %changelog - # each patch should add its ChangeLog entries here - --* Fri Mar 25 2010 Thomas Dickey -+* Thu Mar 25 2010 Thomas Dickey - - initial version -diff -Naur ncurses-5.9/test/programs ncurses-5.9.patch/test/programs ---- ncurses-5.9/test/programs 2009-09-12 21:44:01.000000000 +0200 -+++ ncurses-5.9.patch/test/programs 2014-09-01 16:33:22.572792500 +0200 -@@ -1,6 +1,6 @@ --# $Id: programs,v 1.19 2009/09/12 19:44:01 tom Exp $ -+# $Id: programs,v 1.24 2013/12/07 18:06:24 tom Exp $ - ############################################################################## --# Copyright (c) 2006-2008,2009 Free Software Foundation, Inc. # -+# Copyright (c) 2006-2009,2013 Free Software Foundation, Inc. # - # # - # Permission is hereby granted, free of charge, to any person obtaining a # - # copy of this software and associated documentation files (the "Software"), # -@@ -48,11 +48,13 @@ - ditto $(LDFLAGS_THREADS) $(LOCAL_LIBS) ditto - dots $(LDFLAGS_TINFO) $(LOCAL_LIBS) dots - dots_mvcur $(LDFLAGS_CURSES) $(LOCAL_LIBS) dots_mvcur -+dots_termcap $(LDFLAGS_TINFO) $(LOCAL_LIBS) dots_termcap - echochar $(LDFLAGS_CURSES) $(LOCAL_LIBS) echochar - filter $(LDFLAGS_CURSES) $(LOCAL_LIBS) filter - firework $(LDFLAGS_CURSES) $(LOCAL_LIBS) firework - firstlast $(LDFLAGS_DEFAULT) $(LOCAL_LIBS) firstlast - foldkeys $(LDFLAGS_CURSES) $(LOCAL_LIBS) foldkeys -+form_driver_w $(LDFLAGS_DEFAULT) $(LOCAL_LIBS) form_driver_w - gdc $(LDFLAGS_CURSES) $(LOCAL_LIBS) gdc - hanoi $(LDFLAGS_CURSES) $(LOCAL_LIBS) hanoi - hashtest $(LDFLAGS_CURSES) $(LOCAL_LIBS) hashtest -@@ -83,6 +85,8 @@ - test_instr $(LDFLAGS_CURSES) $(LOCAL_LIBS) test_instr - test_inwstr $(LDFLAGS_CURSES) $(LOCAL_LIBS) test_inwstr - test_opaque $(LDFLAGS_CURSES) $(LOCAL_LIBS) test_opaque -+test_vid_puts $(LDFLAGS_CURSES) $(LOCAL_LIBS) test_vid_puts -+test_vidputs $(LDFLAGS_CURSES) $(LOCAL_LIBS) test_vidputs - testaddch $(LDFLAGS_CURSES) $(LOCAL_LIBS) testaddch - testcurs $(LDFLAGS_CURSES) $(LOCAL_LIBS) testcurs - testscanw $(LDFLAGS_CURSES) $(LOCAL_LIBS) testscanw -diff -Naur ncurses-5.9/test/railroad.c ncurses-5.9.patch/test/railroad.c ---- ncurses-5.9/test/railroad.c 2009-10-24 23:37:56.000000000 +0200 -+++ ncurses-5.9.patch/test/railroad.c 2014-09-01 16:33:22.572792500 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 2000-2008,2009 Free Software Foundation, Inc. * -+ * Copyright (c) 2000-2011,2013 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -29,7 +29,7 @@ - /* - * Author: Thomas E. Dickey - 2000 - * -- * $Id: railroad.c,v 1.19 2009/10/24 21:37:56 tom Exp $ -+ * $Id: railroad.c,v 1.21 2013/09/28 22:02:17 tom Exp $ - * - * A simple demo of the termcap interface. - */ -@@ -55,20 +55,20 @@ - - static bool interrupted = FALSE; - --static int --outc(TPUTS_ARG c) -+static -+TPUTS_PROTO(outc, c) - { - int rc = OK; - - if (interrupted) { - char tmp = (char) c; -- if (write(STDOUT_FILENO, &tmp, 1) == -1) -+ if (write(STDOUT_FILENO, &tmp, (size_t) 1) == -1) - rc = ERR; - } else { - if (putc(c, stdout) == EOF) - rc = ERR; - } -- return rc; -+ TPUTS_RETURN(rc); - } - - static void -diff -Naur ncurses-5.9/test/rain.c ncurses-5.9.patch/test/rain.c ---- ncurses-5.9/test/rain.c 2010-11-13 21:11:46.000000000 +0100 -+++ ncurses-5.9.patch/test/rain.c 2014-09-01 16:33:22.573792493 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -26,7 +26,7 @@ - * authorization. * - ****************************************************************************/ - /* -- * $Id: rain.c,v 1.38 2010/11/13 20:11:46 tom Exp $ -+ * $Id: rain.c,v 1.40 2012/01/21 23:54:47 tom Exp $ - */ - #include <test.priv.h> - -@@ -222,7 +222,7 @@ - * Find myself in the list of threads so we can count the number of loops. - */ - for (mystats = 0; mystats < MAX_THREADS; ++mystats) { --#ifdef __MINGW32__ -+#if defined(__MINGW32__) && !defined(__WINPTHREADS_VERSION) - if (drop_threads[mystats].myself.p == pthread_self().p) - #else - if (drop_threads[mystats].myself == pthread_self()) -@@ -256,7 +256,7 @@ - /* - * The description of pthread_create() is misleading, since it implies that - * threads will exit cleanly after their function returns. -- * -+ * - * Since they do not (and the number of threads is limited by system - * resources), make a limited number of threads, and signal any that are - * waiting when we want a thread past that limit. -diff -Naur ncurses-5.9/test/README ncurses-5.9.patch/test/README ---- ncurses-5.9/test/README 2011-02-26 01:09:25.000000000 +0100 -+++ ncurses-5.9.patch/test/README 2014-09-01 16:33:22.524792400 +0200 -@@ -1,5 +1,5 @@ - ------------------------------------------------------------------------------- ---- Copyright (c) 1998-2010,2011 Free Software Foundation, Inc. -- -+-- Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. -- - -- -- - -- Permission is hereby granted, free of charge, to any person obtaining a -- - -- copy of this software and associated documentation files (the -- -@@ -25,7 +25,7 @@ - -- sale, use or other dealings in this Software without prior written -- - -- authorization. -- - ------------------------------------------------------------------------------- ---- $Id: README,v 1.44 2011/02/26 00:09:25 tom Exp $ -+-- $Id: README,v 1.48 2013/01/19 21:30:38 tom Exp $ - ------------------------------------------------------------------------------- - - The programs in this directory are designed to test your newest toy :-) -@@ -223,18 +223,18 @@ - SP lib: form - TABSIZE test: test_opaque - UP - --acs_map test: gdc ins_wide inserts knight movewindow ncurses newdemo test_add_wchstr test_addchstr test_addstr test_addwstr testcurs -+acs_map test: background gdc ins_wide inserts knight movewindow ncurses newdemo test_add_wchstr test_addchstr test_addstr test_addwstr testcurs - add_wch test: demo_panels ncurses test_add_wchstr test_addwstr - add_wchnstr test: test_add_wchstr - add_wchstr test: test_add_wchstr view --addch test: blue bs echochar hashtest ncurses savescreen test_add_wchstr test_addchstr test_addstr test_addwstr test_opaque testaddch view worm -+addch test: background blue bs echochar hashtest ncurses savescreen test_add_wchstr test_addchstr test_addstr test_addwstr test_opaque testaddch view worm - addchnstr test: test_addchstr - addchstr test: test_addchstr - addnstr test: test_addstr - addnwstr test: ncurses test_addwstr - addstr test: blue bs cardfile gdc hanoi lrtest ncurses savescreen test_addstr - addwstr test: ncurses test_addwstr --assume_default_colors test: ncurses -+assume_default_colors test: background ncurses - assume_default_colors_sp - - attr_get test: ncurses - attr_off test: ncurses -@@ -271,7 +271,7 @@ - color_content_sp - - color_set test: color_set ncurses - copywin test: ncurses testcurs --cur_term test: demo_terminfo dots dots_mvcur lrtest progs: clear tabs tput tset -+cur_term test: demo_terminfo dots dots_mvcur lrtest test_vid_puts test_vidputs progs: clear tabs tput tset - curs_set test: echochar firework gdc hanoi lrtest ncurses newdemo rain savescreen tclock testcurs worm xmas - curs_set_sp lib: ncurses - curscr test: demo_panels edit_field knight lrtest ncurses savescreen tclock view -@@ -306,7 +306,7 @@ - erasewchar - - filter test: filter - filter_sp - --flash test: cardfile lrtest ncurses tclock testcurs -+flash test: cardfile lrtest movewindow ncurses tclock testcurs - flash_sp - - flushinp test: ncurses newdemo testcurs - flushinp_sp lib: ncurses -@@ -399,7 +399,7 @@ - key_name test: key_names ncurses - keybound test: demo_altkeys demo_defkey - keybound_sp lib: ncurses --keyname test: demo_altkeys demo_defkey demo_keyok demo_menus edit_field foldkeys keynames movewindow ncurses redraw testcurs view progs: tic -+keyname test: demo_altkeys demo_defkey demo_keyok demo_menus edit_field foldkeys keynames movewindow ncurses redraw test_getstr testcurs view progs: tic - keyname_sp lib: ncurses - keyok test: demo_keyok foldkeys - keyok_sp lib: ncurses -@@ -430,7 +430,7 @@ - mvaddwstr test: test_addwstr - mvchgat test: chgat - mvcur test: dots_mvcur redraw --mvcur_sp lib: ncurses -+mvcur_sp - - mvdelch - - mvderwin test: movewindow - mvget_wch - -@@ -457,7 +457,7 @@ - mvinsstr test: inserts - mvinstr test: test_instr - mvinwstr test: test_inwstr --mvprintw test: bs demo_menus firework hanoi ncurses tclock view -+mvprintw test: background bs demo_menus firework hanoi ncurses tclock view - mvscanw - - mvvline test: ncurses - mvvline_set test: ncurses -@@ -542,13 +542,13 @@ - prefresh test: testcurs - printw test: background blue bs color_set demo_altkeys demo_defkey demo_keyok demo_menus filter foldkeys ncurses savescreen testcurs testscanw view - putp progs: tput --putp_sp lib: ncurses -+putp_sp - - putwin test: ncurses - qiflush - - qiflush_sp - - raw test: demo_forms ncurses redraw testcurs - raw_sp lib: ncurses --redrawwin test: redraw -+redrawwin test: redraw view - refresh test: blue bs demo_defkey demo_forms demo_keyok demo_menus demo_panels echochar filter firstlast gdc hanoi hashtest lrtest movewindow ncurses savescreen tclock testcurs view xmas - reset_prog_mode test: filter ncurses - reset_prog_mode_sp lib: ncurses -@@ -586,7 +586,7 @@ - set_term lib: ncurses - setcchar test: demo_panels ins_wide ncurses test_add_wchstr test_addwstr view - setscrreg test: view --setupterm test: demo_termcap demo_terminfo dots progs: clear tabs tput tset -+setupterm test: demo_termcap demo_terminfo dots test_vid_puts test_vidputs progs: clear tabs tput tset - slk_attr - - slk_attr_off - - slk_attr_on - -@@ -644,20 +644,20 @@ - tgetstr test: demo_termcap railroad - tgetstr_sp - - tgoto test: railroad --tigetflag test: demo_terminfo progs: tput -+tigetflag test: demo_terminfo progs: tic tput - tigetflag_sp - - tigetnum test: demo_terminfo ncurses progs: tput - tigetnum_sp - --tigetstr test: blue demo_defkey demo_terminfo foldkeys testcurs progs: tput -+tigetstr test: demo_defkey demo_terminfo foldkeys testcurs progs: tput - tigetstr_sp - - timeout test: rain savescreen - tiparm - - touchline test: chgat clip_printw insdelln - touchwin test: chgat clip_printw demo_menus edit_field filter firstlast inch_wide inchs ins_wide insdelln inserts movewindow ncurses redraw test_add_wchstr test_addchstr test_addstr test_addwstr test_get_wstr test_getstr test_instr test_inwstr test_opaque xmas - tparm test: dots dots_mvcur progs: tabs tic tput --tputs test: dots dots_mvcur railroad progs: clear tabs tset -+tputs test: dots dots_mvcur railroad test_vid_puts test_vidputs progs: clear tabs tset - tputs_sp lib: ncurses --trace test: demo_menus hanoi hashtest lrtest ncurses testcurs view worm -+trace test: demo_menus hashtest lrtest ncurses testcurs view worm - ttytype lib: ncurses - typeahead test: testcurs - typeahead_sp lib: ncurses -@@ -670,22 +670,24 @@ - ungetmouse - - ungetmouse_sp - - untouchwin lib: form --use_default_colors test: filter firework gdc hanoi knight ncurses rain tclock worm xmas -+use_default_colors test: background filter firework gdc hanoi knight ncurses rain tclock worm xmas - use_default_colors_sp - --use_env progs: tput -+use_env test: ncurses progs: tput - use_env_sp - --use_extended_names test: demo_terminfo progs: infocmp tic -+use_extended_names test: demo_termcap demo_terminfo progs: infocmp tic - use_legacy_coding - - use_legacy_coding_sp - - use_screen test: ditto -+use_tioctl test: ncurses -+use_tioctl_sp - - use_window test: rain worm --vid_attr - -+vid_attr test: test_vid_puts - vid_attr_sp - --vid_puts - -+vid_puts test: test_vid_puts - vid_puts_sp - --vidattr - --vidattr_sp lib: ncurses --vidputs - -+vidattr test: test_vidputs -+vidattr_sp - -+vidputs test: test_vidputs - vidputs_sp lib: ncurses - vline test: gdc ncurses - vline_set - -diff -Naur ncurses-5.9/test/redraw.c ncurses-5.9.patch/test/redraw.c ---- ncurses-5.9/test/redraw.c 2010-05-02 00:04:08.000000000 +0200 -+++ ncurses-5.9.patch/test/redraw.c 2014-09-01 16:33:22.573792493 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 2006-2007,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 2006-2011,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -26,7 +26,7 @@ - * authorization. * - ****************************************************************************/ - /* -- * $Id: redraw.c,v 1.5 2010/05/01 22:04:08 tom Exp $ -+ * $Id: redraw.c,v 1.8 2012/12/08 20:46:02 tom Exp $ - * - * Demonstrate the redrawwin() and wredrawln() functions. - * Thomas Dickey - 2006/11/4 -@@ -113,7 +113,7 @@ - * using mvcur(). It is ifdef'd for NCURSES, since X/Open does - * not define the case where the old location is unknown. - */ -- system("date"); -+ IGNORE_RC(system("date")); - mvcur(-1, -1, y, x); - break; - #endif -diff -Naur ncurses-5.9/test/tclock.c ncurses-5.9.patch/test/tclock.c ---- ncurses-5.9/test/tclock.c 2011-03-22 10:16:00.000000000 +0100 -+++ ncurses-5.9.patch/test/tclock.c 2014-09-01 16:33:22.573792493 +0200 -@@ -1,4 +1,4 @@ --/* $Id: tclock.c,v 1.30 2011/03/22 09:16:00 tom Exp $ */ -+/* $Id: tclock.c,v 1.33 2013/09/28 21:52:34 tom Exp $ */ - - #include <test.priv.h> - -@@ -53,14 +53,14 @@ - - /* Plot a point */ - static void --plot(int x, int y, char col) -+plot(int x, int y, int col) - { - MvAddCh(y, x, (chtype) col); - } - - /* Draw a diagonal(arbitrary) line using Bresenham's alogrithm. */ - static void --dline(int pair, int from_x, int from_y, int x2, int y2, char ch) -+dline(int pair, int from_x, int from_y, int x2, int y2, int ch) - { - int dx, dy; - int ax, ay; -@@ -135,8 +135,8 @@ - short my_bg = COLOR_BLACK; - #if HAVE_GETTIMEOFDAY - struct timeval current; -- double fraction = 0.0; - #endif -+ double fraction = 0.0; - - setlocale(LC_ALL, ""); - -@@ -216,12 +216,12 @@ - attroff(A_REVERSE); - - if (has_colors()) -- (void) attrset(COLOR_PAIR(1)); -+ (void) attrset((attr_t) COLOR_PAIR(1)); - - dline(1, cx, cy, cx + sdx, cy - sdy, 'O'); - - if (has_colors()) -- (void) attrset(COLOR_PAIR(0)); -+ (void) attrset((attr_t) COLOR_PAIR(0)); - - text = ctime(&tim); - MvPrintw(2, 0, "%.*s", (int) (strlen(text) - 1), text); -diff -Naur ncurses-5.9/test/testaddch.c ncurses-5.9.patch/test/testaddch.c ---- ncurses-5.9/test/testaddch.c 2009-08-29 21:02:25.000000000 +0200 -+++ ncurses-5.9.patch/test/testaddch.c 2014-09-01 16:33:22.574792487 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2006,2009 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2011,2013 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -29,7 +29,7 @@ - * This is an example written by Alexander V. Lukyanov <lav@yars.free.net>, - * to demonstrate an inconsistency between ncurses and SVr4 curses. - * -- * $Id: testaddch.c,v 1.7 2009/08/29 19:02:25 tom Exp $ -+ * $Id: testaddch.c,v 1.9 2013/01/13 01:02:41 tom Exp $ - */ - #include <test.priv.h> - -@@ -63,7 +63,7 @@ - for (i = 0; i < 8; i++) { - back = (i & 1) ? A_BOLD | 'B' : ' '; - set = (i & 2) ? A_REVERSE : 0; -- attr = (i & 4) ? COLOR_PAIR(4) : 0; -+ attr = (chtype) ((i & 4) ? COLOR_PAIR(4) : 0); - - bkgdset(back); - (void) attrset(set); -@@ -72,9 +72,9 @@ - } - addch('\n'); - for (i = 0; i < 8; i++) { -- back = (i & 1) ? A_BOLD | 'B' | COLOR_PAIR(1) : ' '; -- set = (i & 2) ? A_REVERSE | COLOR_PAIR(2) : 0; -- attr = (i & 4) ? COLOR_PAIR(4) : 0; -+ back = (i & 1) ? (A_BOLD | 'B' | COLOR_PAIR(1)) : ' '; -+ set = (i & 2) ? (A_REVERSE | COLOR_PAIR(2)) : 0; -+ attr = (chtype) ((i & 4) ? COLOR_PAIR(4) : 0); - - bkgdset(back); - (void) attrset(set); -diff -Naur ncurses-5.9/test/test_addchstr.c ncurses-5.9.patch/test/test_addchstr.c ---- ncurses-5.9/test/test_addchstr.c 2010-12-12 02:28:24.000000000 +0100 -+++ ncurses-5.9.patch/test/test_addchstr.c 2014-09-01 16:33:22.573792493 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 2009-2010,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -26,7 +26,7 @@ - * authorization. * - ****************************************************************************/ - /* -- * $Id: test_addchstr.c,v 1.13 2010/12/12 01:28:24 tom Exp $ -+ * $Id: test_addchstr.c,v 1.18 2012/12/16 00:36:27 tom Exp $ - * - * Demonstrate the waddchstr() and waddch functions. - * Thomas Dickey - 2009/9/12 -@@ -101,6 +101,8 @@ - if (need > temp_length) { - temp_length = need * 2; - temp_buffer = typeRealloc(chtype, temp_length, temp_buffer); -+ if (!temp_buffer) -+ failed("TempBuffer"); - } - do { - const char *s; -@@ -237,6 +239,15 @@ - (void) cbreak(); /* take input chars one at a time, no wait for \n */ - (void) noecho(); /* don't echo input */ - keypad(stdscr, TRUE); -+ -+ /* -+ * Show the characters added in color, to distinguish from those that -+ * are shifted. -+ */ -+ if (has_colors()) { -+ start_color(); -+ init_pair(1, COLOR_WHITE, COLOR_BLUE); -+ } - } - - limit = LINES - 5; -@@ -270,14 +281,8 @@ - - doupdate(); - -- /* -- * Show the characters added in color, to distinguish from those that -- * are shifted. -- */ - if (has_colors()) { -- start_color(); -- init_pair(1, COLOR_WHITE, COLOR_BLUE); -- show_attr = COLOR_PAIR(1); -+ show_attr = (attr_t) COLOR_PAIR(1); - wbkgdset(work, show_attr | ' '); - } else { - show_attr = A_STANDOUT; -@@ -289,11 +294,13 @@ - case key_RECUR: - test_adds(level + 1); - -- touchwin(look); -+ if (look) -+ touchwin(look); - touchwin(work); - touchwin(show); - -- wnoutrefresh(look); -+ if (look) -+ wnoutrefresh(look); - wnoutrefresh(work); - wnoutrefresh(show); - -@@ -445,10 +452,10 @@ - } - } - if (level > 0) { -- delwin(show); - delwin(work); - delwin(look); - } -+ delwin(show); - } - - static void -diff -Naur ncurses-5.9/test/test_addstr.c ncurses-5.9.patch/test/test_addstr.c ---- ncurses-5.9/test/test_addstr.c 2010-12-12 01:17:37.000000000 +0100 -+++ ncurses-5.9.patch/test/test_addstr.c 2014-09-01 16:33:22.574792487 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 2009-2010,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -26,7 +26,7 @@ - * authorization. * - ****************************************************************************/ - /* -- * $Id: test_addstr.c,v 1.6 2010/12/12 00:17:37 tom Exp $ -+ * $Id: test_addstr.c,v 1.10 2012/12/16 00:14:10 tom Exp $ - * - * Demonstrate the waddstr() and waddch functions. - * Thomas Dickey - 2009/9/12 -@@ -161,6 +161,15 @@ - (void) cbreak(); /* take input chars one at a time, no wait for \n */ - (void) noecho(); /* don't echo input */ - keypad(stdscr, TRUE); -+ -+ /* -+ * Show the characters added in color, to distinguish from those that -+ * are shifted. -+ */ -+ if (has_colors()) { -+ start_color(); -+ init_pair(1, COLOR_WHITE, COLOR_BLUE); -+ } - } - - limit = LINES - 5; -@@ -194,14 +203,8 @@ - - doupdate(); - -- /* -- * Show the characters added in color, to distinguish from those that -- * are shifted. -- */ - if (has_colors()) { -- start_color(); -- init_pair(1, COLOR_WHITE, COLOR_BLUE); -- wbkgdset(work, COLOR_PAIR(1) | ' '); -+ wbkgdset(work, (chtype) (COLOR_PAIR(1) | ' ')); - } - - while ((ch = read_linedata(work)) != ERR && !isQUIT(ch)) { -@@ -210,11 +213,13 @@ - case key_RECUR: - test_adds(level + 1); - -- touchwin(look); -+ if (look) -+ touchwin(look); - touchwin(work); - touchwin(show); - -- wnoutrefresh(look); -+ if (look) -+ wnoutrefresh(look); - wnoutrefresh(work); - wnoutrefresh(show); - -@@ -361,8 +366,8 @@ - break; - } - } -+ delwin(show); - if (level > 0) { -- delwin(show); - delwin(work); - delwin(look); - } -diff -Naur ncurses-5.9/test/test_add_wchstr.c ncurses-5.9.patch/test/test_add_wchstr.c ---- ncurses-5.9/test/test_add_wchstr.c 2011-01-15 19:15:11.000000000 +0100 -+++ ncurses-5.9.patch/test/test_add_wchstr.c 2014-09-01 16:33:22.573792493 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 2009,2010,2011 Free Software Foundation, Inc. * -+ * Copyright (c) 2010-2011,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -26,7 +26,7 @@ - * authorization. * - ****************************************************************************/ - /* -- * $Id: test_add_wchstr.c,v 1.15 2011/01/15 18:15:11 tom Exp $ -+ * $Id: test_add_wchstr.c,v 1.20 2012/12/16 00:12:04 tom Exp $ - * - * Demonstrate the waddwchstr() and wadd_wch functions. - * Thomas Dickey - 2009/9/12 -@@ -90,6 +90,8 @@ - if (need > temp_length) { \ - temp_length = need * 2; \ - temp_buffer = typeRealloc(cchar_t, temp_length, temp_buffer); \ -+ if (!temp_buffer) \ -+ failed("TempBuffer"); \ - } \ - have[0] = 0; \ - have[1] = 0; \ -@@ -317,6 +319,15 @@ - (void) cbreak(); /* take input chars one at a time, no wait for \n */ - (void) noecho(); /* don't echo input */ - keypad(stdscr, TRUE); -+ -+ /* -+ * Show the characters added in color, to distinguish from those that -+ * are shifted. -+ */ -+ if (has_colors()) { -+ start_color(); -+ init_pair(1, COLOR_WHITE, COLOR_BLUE); -+ } - } - - limit = LINES - 5; -@@ -350,14 +361,8 @@ - - doupdate(); - -- /* -- * Show the characters added in color, to distinguish from those that -- * are shifted. -- */ - if (has_colors()) { -- start_color(); -- init_pair(1, COLOR_WHITE, COLOR_BLUE); -- wbkgdset(work, COLOR_PAIR(1) | ' '); -+ wbkgdset(work, (chtype) (COLOR_PAIR(1) | ' ')); - } - - while ((ch = read_linedata(work)) != ERR && !isQUIT(ch)) { -@@ -366,11 +371,13 @@ - case key_RECUR: - test_add_wchstr(level + 1); - -- touchwin(look); -+ if (look) -+ touchwin(look); - touchwin(work); - touchwin(show); - -- wnoutrefresh(look); -+ if (look) -+ wnoutrefresh(look); - wnoutrefresh(work); - wnoutrefresh(show); - -@@ -514,8 +521,8 @@ - break; - } - } -+ delwin(show); - if (level > 0) { -- delwin(show); - delwin(work); - delwin(look); - } -diff -Naur ncurses-5.9/test/test_addwstr.c ncurses-5.9.patch/test/test_addwstr.c ---- ncurses-5.9/test/test_addwstr.c 2010-12-12 01:18:00.000000000 +0100 -+++ ncurses-5.9.patch/test/test_addwstr.c 2014-09-01 16:33:22.574792487 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 2009-2010,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -26,7 +26,7 @@ - * authorization. * - ****************************************************************************/ - /* -- * $Id: test_addwstr.c,v 1.6 2010/12/12 00:18:00 tom Exp $ -+ * $Id: test_addwstr.c,v 1.11 2012/12/16 00:11:18 tom Exp $ - * - * Demonstrate the waddwstr() and wadd_wch functions. - * Thomas Dickey - 2009/9/12 -@@ -233,8 +233,9 @@ - WINDOW *work = 0; - WINDOW *show = 0; - int margin = (2 * MY_TABSIZE) - 1; -- Options option = ((m_opt ? oMove : oDefault) -- | ((w_opt || (level > 0)) ? oWindow : oDefault)); -+ Options option = (Options) ((int) (m_opt ? oMove : oDefault) -+ | (int) ((w_opt || (level > 0)) -+ ? oWindow : oDefault)); - - if (first) { - static char cmd[80]; -@@ -246,6 +247,15 @@ - (void) cbreak(); /* take input chars one at a time, no wait for \n */ - (void) noecho(); /* don't echo input */ - keypad(stdscr, TRUE); -+ -+ /* -+ * Show the characters inserted in color, to distinguish from those that -+ * are shifted. -+ */ -+ if (has_colors()) { -+ start_color(); -+ init_pair(1, COLOR_WHITE, COLOR_BLUE); -+ } - } - - limit = LINES - 5; -@@ -279,14 +289,8 @@ - - doupdate(); - -- /* -- * Show the characters inserted in color, to distinguish from those that -- * are shifted. -- */ - if (has_colors()) { -- start_color(); -- init_pair(1, COLOR_WHITE, COLOR_BLUE); -- wbkgdset(work, COLOR_PAIR(1) | ' '); -+ wbkgdset(work, (chtype) (COLOR_PAIR(1) | ' ')); - } - - while ((ch = read_linedata(work)) != ERR && !isQUIT(ch)) { -@@ -295,11 +299,13 @@ - case key_RECUR: - test_inserts(level + 1); - -- touchwin(look); -+ if (look) -+ touchwin(look); - touchwin(work); - touchwin(show); - -- wnoutrefresh(look); -+ if (look) -+ wnoutrefresh(look); - wnoutrefresh(work); - wnoutrefresh(show); - -@@ -445,8 +451,8 @@ - break; - } - } -+ delwin(show); - if (level > 0) { -- delwin(show); - delwin(work); - delwin(look); - } -diff -Naur ncurses-5.9/test/testcurs.c ncurses-5.9.patch/test/testcurs.c ---- ncurses-5.9/test/testcurs.c 2010-11-13 22:02:28.000000000 +0100 -+++ ncurses-5.9.patch/test/testcurs.c 2014-09-01 16:33:22.574792487 +0200 -@@ -6,7 +6,7 @@ - * wrs(5/28/93) -- modified to be consistent (perform identically) with either - * PDCurses or under Unix System V, R4 - * -- * $Id: testcurs.c,v 1.43 2010/11/13 21:02:28 tom Exp $ -+ * $Id: testcurs.c,v 1.48 2013/05/18 22:05:06 tom Exp $ - */ - - #include <test.priv.h> -@@ -45,18 +45,6 @@ - }; - #define MAX_OPTIONS (int) SIZEOF(command) - --#if !HAVE_STRDUP --#define strdup my_strdup --static char * --strdup(char *s) --{ -- char *p = typeMalloc(char, strlen(s) + 1); -- if (p) -- strcpy(p, s); -- return (p); --} --#endif /* not HAVE_STRDUP */ -- - static int width, height; - - int -@@ -85,7 +73,7 @@ - #ifdef A_COLOR - if (has_colors()) { - init_pair(1, COLOR_WHITE, COLOR_BLUE); -- wbkgd(win, COLOR_PAIR(1)); -+ wbkgd(win, (chtype) COLOR_PAIR(1)); - } else - wbkgd(win, A_REVERSE); - #else -@@ -353,6 +341,9 @@ - typeahead(-1); - #endif - -+#ifdef NCURSES_MOUSE_VERSION -+ mousemask(ALL_MOUSE_EVENTS, (mmask_t *) 0); -+#endif - #if defined(PDCURSES) - mouse_set(ALL_MOUSE_EVENTS); - #endif -@@ -367,8 +358,38 @@ - wprintw(win, "Key Pressed: %c", c); - else - wprintw(win, "Key Pressed: %s", unctrl(UChar(c))); --#if defined(PDCURSES) -+#ifdef KEY_MOUSE - if (c == KEY_MOUSE) { -+#if defined(NCURSES_MOUSE_VERSION) -+#define ButtonChanged(n) ((event.bstate) & NCURSES_MOUSE_MASK(1, 037)) -+#define ButtonPressed(n) ((event.bstate) & NCURSES_MOUSE_MASK(1, NCURSES_BUTTON_PRESSED)) -+#define ButtonDouble(n) ((event.bstate) & NCURSES_MOUSE_MASK(1, NCURSES_DOUBLE_CLICKED)) -+#define ButtonTriple(n) ((event.bstate) & NCURSES_MOUSE_MASK(1, NCURSES_TRIPLE_CLICKED)) -+#define ButtonRelease(n) ((event.bstate) & NCURSES_MOUSE_MASK(1, NCURSES_BUTTON_RELEASED)) -+ MEVENT event; -+ int button = 0; -+ -+ getmouse(&event); -+ if (ButtonChanged(1)) -+ button = 1; -+ else if (ButtonChanged(2)) -+ button = 2; -+ else if (ButtonChanged(3)) -+ button = 3; -+ else -+ button = 0; -+ wmove(win, 4, 18); -+ wprintw(win, "Button %d: ", button); -+ if (ButtonPressed(button)) -+ wprintw(win, "pressed: "); -+ else if (ButtonDouble(button)) -+ wprintw(win, "double: "); -+ else if (ButtonTriple(button)) -+ wprintw(win, "triple: "); -+ else -+ wprintw(win, "released: "); -+ wprintw(win, " Position: Y: %d X: %d", event.y, event.x); -+#elif defined(PDCURSES) - int button = 0; - request_mouse_pos(); - if (BUTTON_CHANGED(1)) -@@ -390,8 +411,9 @@ - else - wprintw(win, "released: "); - wprintw(win, " Position: Y: %d X: %d", MOUSE_Y_POS, MOUSE_X_POS); -+#endif /* NCURSES_VERSION vs PDCURSES */ - } --#endif -+#endif /* KEY_MOUSE */ - wrefresh(win); - if (c == ' ') - break; -@@ -491,7 +513,7 @@ - #ifdef A_COLOR - if (has_colors()) { - init_pair(3, COLOR_BLUE, COLOR_WHITE); -- wbkgd(win1, COLOR_PAIR(3)); -+ wbkgd(win1, (chtype) COLOR_PAIR(3)); - } else - wbkgd(win1, A_NORMAL); - #else -@@ -693,9 +715,11 @@ - raw(); - wgetch(pad); - -- spad = subpad(pad, 12, 25, 6, 52); -- MvWAddStr(spad, 2, 2, "This is a new subpad"); -- box(spad, 0, 0); -+ if ((spad = subpad(pad, 12, 25, 6, 52)) != 0) { -+ MvWAddStr(spad, 2, 2, "This is a new subpad"); -+ box(spad, 0, 0); -+ delwin(spad); -+ } - prefresh(pad, 0, 0, 0, 0, 15, 75); - keypad(pad, TRUE); - raw(); -diff -Naur ncurses-5.9/test/test_getstr.c ncurses-5.9.patch/test/test_getstr.c ---- ncurses-5.9/test/test_getstr.c 2009-08-29 21:02:25.000000000 +0200 -+++ ncurses-5.9.patch/test/test_getstr.c 2014-09-01 16:33:22.574792487 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 2007-2008,2009 Free Software Foundation, Inc. * -+ * Copyright (c) 2007-2009,2012 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -26,7 +26,7 @@ - * authorization. * - ****************************************************************************/ - /* -- * $Id: test_getstr.c,v 1.9 2009/08/29 19:02:25 tom Exp $ -+ * $Id: test_getstr.c,v 1.10 2012/07/07 18:22:49 tom Exp $ - * - * Author: Thomas E Dickey - * -@@ -58,6 +58,15 @@ - eMaxFlavor - } Flavors; - -+/* -+ * Return-code is OK/ERR or a keyname. -+ */ -+static const char * -+ok_keyname(int code) -+{ -+ return ((code == OK) ? "OK" : ((code == ERR) ? "ERR" : keyname(code))); -+} -+ - static bool - Quit(int ch) - { -@@ -310,7 +319,7 @@ - } - noecho(); - (void) wattrset(txtwin, A_NORMAL); -- wprintw(strwin, "%d:%s", rc, buffer); -+ wprintw(strwin, "%s:%s", ok_keyname(rc), buffer); - wnoutrefresh(strwin); - break; - default: -diff -Naur ncurses-5.9/test/test.priv.h ncurses-5.9.patch/test/test.priv.h ---- ncurses-5.9/test/test.priv.h 2011-03-22 10:15:45.000000000 +0100 -+++ ncurses-5.9.patch/test/test.priv.h 2014-09-01 16:33:22.573792493 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2010,2011 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2013,2014 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -29,7 +29,7 @@ - /**************************************************************************** - * Author: Thomas E. Dickey 1996-on * - ****************************************************************************/ --/* $Id: test.priv.h,v 1.103 2011/03/22 09:15:45 tom Exp $ */ -+/* $Id: test.priv.h,v 1.123 2014/02/01 22:09:27 tom Exp $ */ - - #ifndef __TEST_PRIV_H - #define __TEST_PRIV_H 1 -@@ -58,6 +58,10 @@ - /* - * Fallback definitions to accommodate broken compilers. - */ -+#ifndef HAVE_ASSUME_DEFAULT_COLORS -+#define HAVE_ASSUME_DEFAULT_COLORS 0 -+#endif -+ - #ifndef HAVE_CURSES_VERSION - #define HAVE_CURSES_VERSION 0 - #endif -@@ -158,6 +162,10 @@ - #define HAVE_RIPOFFLINE 0 - #endif - -+#ifndef HAVE_SCR_DUMP -+#define HAVE_SCR_DUMP 0 -+#endif -+ - #ifndef HAVE_SETUPTERM - #define HAVE_SETUPTERM 0 - #endif -@@ -170,14 +178,30 @@ - #define HAVE_SLK_INIT 0 - #endif - -+#ifndef HAVE_SYS_IOCTL_H -+#define HAVE_SYS_IOCTL_H 0 -+#endif -+ -+#ifndef HAVE_SYS_SELECT_H -+#define HAVE_SYS_SELECT_H 0 -+#endif -+ - #ifndef HAVE_TERMATTRS - #define HAVE_TERMATTRS 0 - #endif - -+#ifndef HAVE_TERMIOS_H -+#define HAVE_TERMIOS_H 0 -+#endif -+ - #ifndef HAVE_TERMNAME - #define HAVE_TERMNAME 0 - #endif - -+#ifndef HAVE_TERM_ENTRY_H -+#define HAVE_TERM_ENTRY_H 0 -+#endif -+ - #ifndef HAVE_TGETENT - #define HAVE_TGETENT 0 - #endif -@@ -202,6 +226,14 @@ - #define HAVE_USE_DEFAULT_COLORS 0 - #endif - -+#ifndef HAVE_USE_SCREEN -+#define HAVE_USE_SCREEN 0 -+#endif -+ -+#ifndef HAVE_USE_WINDOW -+#define HAVE_USE_WINDOW 0 -+#endif -+ - #ifndef HAVE_WRESIZE - #define HAVE_WRESIZE 0 - #endif -@@ -222,6 +254,13 @@ - #define NO_LEAKS 0 - #endif - -+/* -+ * Workaround for HPUX -+ */ -+#if defined(__hpux) && !defined(NCURSES_VERSION) -+#define _ACS_COMPAT_CODE /* needed for acs_map vs __acs_map */ -+#endif -+ - #include <stdlib.h> - #include <stdarg.h> - #include <string.h> -@@ -269,21 +308,18 @@ - - /* - * Not all curses.h implementations include unctrl.h, -- * Solaris 10 xpg4 for example. - */ --#if defined(NCURSES_VERSION) || defined(_XOPEN_CURSES) --#if defined(HAVE_NCURSESW_NCURSES_H) -+#if defined(HAVE_NCURSESW_UNCTRL_H) - #include <ncursesw/unctrl.h> --#elif defined(HAVE_NCURSES_NCURSES_H) -+#elif defined(HAVE_NCURSES_UNCTRL_H) - #include <ncurses/unctrl.h> --#else -+#elif defined(HAVE_UNCTRL_H) - #include <unctrl.h> - #endif --#endif - - #if HAVE_GETOPT_H - #include <getopt.h> --#else -+#elif !defined(HAVE_GETOPT_HEADER) - /* 'getopt()' may be prototyped in <stdlib.h>, but declaring its variables - * doesn't hurt. - */ -@@ -323,17 +359,20 @@ - #endif - - #if !USE_SOFTKEYS --#define slk_init() /* nothing */ --#define slk_restore() /* nothing */ --#define slk_clear() /* nothing */ -+#define slk_init() /* nothing */ -+#define slk_restore() /* nothing */ -+#define slk_clear() /* nothing */ - #endif - - #ifndef HAVE_WSYNCDOWN --#define wsyncdown(win) /* nothing */ -+#define wsyncdown(win) /* nothing */ - #endif - - #ifndef USE_WIDEC_SUPPORT --#if (defined(_XOPEN_SOURCE_EXTENDED) || defined(_XPG5)) && defined(WACS_ULCORNER) -+#if (defined(_XOPEN_SOURCE_EXTENDED) \ -+ || (defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE - 0 >= 500)) \ -+ || (defined(NCURSES_WIDECHAR) && (NCURSES_WIDECHAR - 0 < 1))) \ -+ && defined(WACS_ULCORNER) - #define USE_WIDEC_SUPPORT 1 - #else - #define USE_WIDEC_SUPPORT 0 -@@ -385,6 +424,14 @@ - #define NCURSES_CH_T cchar_t - #endif - -+#ifndef NCURSES_COLOR_T -+#define NCURSES_COLOR_T short -+#endif -+ -+#ifndef NCURSES_PAIRS_T -+#define NCURSES_PAIRS_T short -+#endif -+ - #ifndef NCURSES_OPAQUE - #define NCURSES_OPAQUE 0 - #endif -@@ -507,7 +554,7 @@ - if ((count = getcchar(s, NULL, NULL, NULL, NULL)) > 0) { \ - wchar_t test_wch[CCHARW_MAX + 2]; \ - attr_t test_attrs; \ -- short test_pair; \ -+ NCURSES_PAIRS_T test_pair; \ - \ - if (getcchar( s, test_wch, &test_attrs, &test_pair, NULL) == OK \ - && test_wch[0] != L'\0') { \ -@@ -576,6 +623,17 @@ - #define TIGETSTR(ti,tc) tgetstr(tc,&area_pointer) - #endif - -+/* -+ * So far (2013 - more than ten years), only ncurses implements -+ * use_extended_names(). -+ */ -+#if defined(NCURSES_XNAMES) -+#elif defined(NCURSES_VERSION) && defined(HAVE_TERM_ENTRY_H) && HAVE_TERM_ENTRY_H -+#define NCURSES_XNAMES 1 -+#else -+#define NCURSES_XNAMES 0 -+#endif -+ - /* ncurses implements tparm() with varargs, X/Open with a fixed-parameter list - * (which is incompatible with legacy usage, doesn't solve any problems). - */ -@@ -609,8 +667,32 @@ - #define EXIT_FAILURE 1 - #endif - --#ifdef __MINGW32__ -+#if defined(__MINGW32__) -+ -+#if defined(PDCURSES) -+#ifdef WINVER -+# if WINVER < 0x0501 -+# error WINVER must at least be 0x0501 -+# endif -+#else -+# define WINVER 0x0501 -+#endif -+#include <windows.h> -+#include <sys/time.h> /* for struct timeval */ -+#undef sleep -+#define sleep(n) Sleep((n) * 1000) -+#define SIGHUP 1 -+#define SIGKILL 9 -+#define getlogin() "username" -+ -+#elif defined(HAVE_NCURSESW_NCURSES_H) -+#include <ncursesw/nc_mingw.h> -+#elif defined(HAVE_NCURSES_NCURSES_H) -+#include <ncurses/nc_mingw.h> -+#else - #include <nc_mingw.h> -+#endif -+ - /* conflicts in test/firstlast.c */ - #undef large - #undef small -@@ -653,25 +735,32 @@ - * The same would be needed for HPUX 10.20 - */ - #ifndef TPUTS_ARG -+#define TPUTS_ARG int -+#endif -+ - #if defined(sun) && !defined(_XOPEN_CURSES) && !defined(NCURSES_VERSION_PATCH) -+#undef TPUTS_ARG - #define TPUTS_ARG char - extern char *tgoto(char *, int, int); /* available, but not prototyped */ --#else --#define TPUTS_ARG int - #endif -+ -+#ifndef TPUTS_PROTO -+#define TPUTS_PROTO(func,value) int func(TPUTS_ARG value) -+#endif -+ -+#ifndef TPUTS_RETURN -+#define TPUTS_RETURN(value) return value - #endif - - /* - * Workarounds for Solaris's X/Open curses - */ --#if defined(sun) && defined(_XOPEN_CURSES) && !defined(NCURSES_VERSION_PATCH) - #if !defined(KEY_MIN) && defined(__KEY_MIN) - #define KEY_MIN __KEY_MIN - #endif - #if !defined(KEY_MAX) && defined(__KEY_MIN) - #define KEY_MAX __KEY_MAX - #endif --#endif - - /* - * Workaround to build with Sun's default SVr4 curses. -@@ -702,23 +791,10 @@ - #define CONST_MENUS /* nothing */ - #endif - --#ifndef HAVE_USE_WINDOW --#if !defined(NCURSES_VERSION_PATCH) || (NCURSES_VERSION_PATCH < 20070915) || !NCURSES_EXT_FUNCS --#define HAVE_USE_WINDOW 0 --#else --#define HAVE_USE_WINDOW 1 --#endif --#endif -- - /* - * Simplify setting up demo of threading with these macros. - */ - --#if !HAVE_USE_WINDOW --typedef int (*NCURSES_WINDOW_CB) (WINDOW *, void *); --typedef int (*NCURSES_SCREEN_CB) (SCREEN *, void *); --#endif -- - #if HAVE_USE_WINDOW - #define USING_WINDOW(w,func) use_window(w, (NCURSES_WINDOW_CB) func, w) - #define USING_WINDOW2(w,func,data) use_window(w, (NCURSES_WINDOW_CB) func, data) -@@ -745,6 +821,8 @@ - #define USE_TRACE 0 - #endif - -+#define Trace2(p) /* nothing */ -+ - #define MvAddCh (void) mvaddch - #define MvWAddCh (void) mvwaddch - #define MvAddStr (void) mvaddstr -diff -Naur ncurses-5.9/test/test_vid_puts.c ncurses-5.9.patch/test/test_vid_puts.c ---- ncurses-5.9/test/test_vid_puts.c 1970-01-01 01:00:00.000000000 +0100 -+++ ncurses-5.9.patch/test/test_vid_puts.c 2014-09-01 16:33:22.574792487 +0200 -@@ -0,0 +1,148 @@ -+/**************************************************************************** -+ * Copyright (c) 2013 Free Software Foundation, Inc. * -+ * * -+ * Permission is hereby granted, free of charge, to any person obtaining a * -+ * copy of this software and associated documentation files (the * -+ * "Software"), to deal in the Software without restriction, including * -+ * without limitation the rights to use, copy, modify, merge, publish, * -+ * distribute, distribute with modifications, sublicense, and/or sell * -+ * copies of the Software, and to permit persons to whom the Software is * -+ * furnished to do so, subject to the following conditions: * -+ * * -+ * The above copyright notice and this permission notice shall be included * -+ * in all copies or substantial portions of the Software. * -+ * * -+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * -+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * -+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * -+ * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * -+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * -+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * -+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * -+ * * -+ * Except as contained in this notice, the name(s) of the above copyright * -+ * holders shall not be used in advertising or otherwise to promote the * -+ * sale, use or other dealings in this Software without prior written * -+ * authorization. * -+ ****************************************************************************/ -+/* -+ * $Id: test_vid_puts.c,v 1.5 2013/09/28 22:42:29 tom Exp $ -+ * -+ * Demonstrate the vid_puts and vid_attr functions. -+ * Thomas Dickey - 2013/01/12 -+ */ -+ -+#define USE_TINFO -+#include <test.priv.h> -+ -+#if USE_WIDEC_SUPPORT && HAVE_SETUPTERM -+ -+#define valid(s) ((s != 0) && s != (char *)-1) -+ -+static FILE *my_fp; -+static bool p_opt = FALSE; -+ -+static -+TPUTS_PROTO(outc, c) -+{ -+ int rc = c; -+ -+ rc = putc(c, my_fp); -+ TPUTS_RETURN(rc); -+} -+ -+static bool -+outs(const char *s) -+{ -+ if (valid(s)) { -+ tputs(s, 1, outc); -+ return TRUE; -+ } -+ return FALSE; -+} -+ -+static void -+cleanup(void) -+{ -+ outs(exit_attribute_mode); -+ if (!outs(orig_colors)) -+ outs(orig_pair); -+ outs(cursor_normal); -+} -+ -+static void -+change_attr(chtype attr) -+{ -+ if (p_opt) { -+ vid_puts(attr, (short) 0, (void *) 0, outc); -+ } else { -+ vid_attr(attr, (short) 0, (void *) 0); -+ } -+} -+ -+static void -+test_vid_puts(void) -+{ -+ fprintf(my_fp, "Name: "); -+ change_attr(A_BOLD); -+ fputs("Bold", my_fp); -+ change_attr(A_REVERSE); -+ fputs(" Reverse", my_fp); -+ change_attr(A_NORMAL); -+ fputs("\n", my_fp); -+} -+ -+static void -+usage(void) -+{ -+ static const char *tbl[] = -+ { -+ "Usage: test_vid_puts [options]" -+ ,"" -+ ,"Options:" -+ ," -e use stderr (default stdout)" -+ ," -p use vid_puts (default vid_attr)" -+ }; -+ unsigned n; -+ for (n = 0; n < SIZEOF(tbl); ++n) -+ fprintf(stderr, "%s\n", tbl[n]); -+ ExitProgram(EXIT_FAILURE); -+} -+ -+int -+main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) -+{ -+ int ch; -+ -+ my_fp = stdout; -+ -+ while ((ch = getopt(argc, argv, "ep")) != -1) { -+ switch (ch) { -+ case 'e': -+ my_fp = stderr; -+ break; -+ case 'p': -+ p_opt = TRUE; -+ break; -+ default: -+ usage(); -+ break; -+ } -+ } -+ if (optind < argc) -+ usage(); -+ -+ setupterm((char *) 0, 1, (int *) 0); -+ test_vid_puts(); -+ cleanup(); -+ ExitProgram(EXIT_SUCCESS); -+} -+ -+#else -+int -+main(void) -+{ -+ printf("This program requires the wide-ncurses terminfo library\n"); -+ ExitProgram(EXIT_FAILURE); -+} -+#endif -diff -Naur ncurses-5.9/test/test_vidputs.c ncurses-5.9.patch/test/test_vidputs.c ---- ncurses-5.9/test/test_vidputs.c 1970-01-01 01:00:00.000000000 +0100 -+++ ncurses-5.9.patch/test/test_vidputs.c 2014-09-01 16:33:22.574792487 +0200 -@@ -0,0 +1,148 @@ -+/**************************************************************************** -+ * Copyright (c) 2013 Free Software Foundation, Inc. * -+ * * -+ * Permission is hereby granted, free of charge, to any person obtaining a * -+ * copy of this software and associated documentation files (the * -+ * "Software"), to deal in the Software without restriction, including * -+ * without limitation the rights to use, copy, modify, merge, publish, * -+ * distribute, distribute with modifications, sublicense, and/or sell * -+ * copies of the Software, and to permit persons to whom the Software is * -+ * furnished to do so, subject to the following conditions: * -+ * * -+ * The above copyright notice and this permission notice shall be included * -+ * in all copies or substantial portions of the Software. * -+ * * -+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * -+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * -+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * -+ * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * -+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * -+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * -+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * -+ * * -+ * Except as contained in this notice, the name(s) of the above copyright * -+ * holders shall not be used in advertising or otherwise to promote the * -+ * sale, use or other dealings in this Software without prior written * -+ * authorization. * -+ ****************************************************************************/ -+/* -+ * $Id: test_vidputs.c,v 1.4 2013/09/28 22:45:21 tom Exp $ -+ * -+ * Demonstrate the vidputs and vidattr functions. -+ * Thomas Dickey - 2013/01/12 -+ */ -+ -+#define USE_TINFO -+#include <test.priv.h> -+ -+#if HAVE_SETUPTERM -+ -+#define valid(s) ((s != 0) && s != (char *)-1) -+ -+static FILE *my_fp; -+static bool p_opt = FALSE; -+ -+static -+TPUTS_PROTO(outc, c) -+{ -+ int rc = c; -+ -+ rc = putc(c, my_fp); -+ TPUTS_RETURN(rc); -+} -+ -+static bool -+outs(const char *s) -+{ -+ if (valid(s)) { -+ tputs(s, 1, outc); -+ return TRUE; -+ } -+ return FALSE; -+} -+ -+static void -+cleanup(void) -+{ -+ outs(exit_attribute_mode); -+ if (!outs(orig_colors)) -+ outs(orig_pair); -+ outs(cursor_normal); -+} -+ -+static void -+change_attr(chtype attr) -+{ -+ if (p_opt) { -+ vidputs(attr, outc); -+ } else { -+ vidattr(attr); -+ } -+} -+ -+static void -+test_vidputs(void) -+{ -+ fprintf(my_fp, "Name: "); -+ change_attr(A_BOLD); -+ fputs("Bold", my_fp); -+ change_attr(A_REVERSE); -+ fputs(" Reverse", my_fp); -+ change_attr(A_NORMAL); -+ fputs("\n", my_fp); -+} -+ -+static void -+usage(void) -+{ -+ static const char *tbl[] = -+ { -+ "Usage: test_vidputs [options]" -+ ,"" -+ ,"Options:" -+ ," -e use stderr (default stdout)" -+ ," -p use vidputs (default vidattr)" -+ }; -+ unsigned n; -+ for (n = 0; n < SIZEOF(tbl); ++n) -+ fprintf(stderr, "%s\n", tbl[n]); -+ ExitProgram(EXIT_FAILURE); -+} -+ -+int -+main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) -+{ -+ int ch; -+ -+ my_fp = stdout; -+ -+ while ((ch = getopt(argc, argv, "ep")) != -1) { -+ switch (ch) { -+ case 'e': -+ my_fp = stderr; -+ break; -+ case 'p': -+ p_opt = TRUE; -+ break; -+ default: -+ usage(); -+ break; -+ } -+ } -+ if (optind < argc) -+ usage(); -+ -+ setupterm((char *) 0, 1, (int *) 0); -+ test_vidputs(); -+ cleanup(); -+ ExitProgram(EXIT_SUCCESS); -+} -+#else -+int -+main(int argc GCC_UNUSED, -+ char *argv[]GCC_UNUSED) -+{ -+ fprintf(stderr, "This program requires terminfo\n"); -+ exit(EXIT_FAILURE); -+} -+#endif -diff -Naur ncurses-5.9/test/view.c ncurses-5.9.patch/test/view.c ---- ncurses-5.9/test/view.c 2010-11-14 02:06:02.000000000 +0100 -+++ ncurses-5.9.patch/test/view.c 2014-09-01 16:33:22.575792482 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -50,10 +50,11 @@ - * scroll operation worked, and the refresh() code only had to do a - * partial repaint. - * -- * $Id: view.c,v 1.81 2010/11/14 01:06:02 tom Exp $ -+ * $Id: view.c,v 1.94 2013/09/28 21:58:42 tom Exp $ - */ - - #include <test.priv.h> -+#include <widechars.h> - - #include <time.h> - -@@ -81,24 +82,10 @@ - #include <sys/ptem.h> - #endif - --#if USE_WIDEC_SUPPORT --#if HAVE_MBTOWC && HAVE_MBLEN --#define reset_mbytes(state) IGNORE_RC(mblen(NULL, 0)), IGNORE_RC(mbtowc(NULL, NULL, 0)) --#define count_mbytes(buffer,length,state) mblen(buffer,length) --#define check_mbytes(wch,buffer,length,state) \ -- (int) mbtowc(&wch, buffer, length) --#define state_unused --#elif HAVE_MBRTOWC && HAVE_MBRLEN --#define reset_mbytes(state) init_mb(state) --#define count_mbytes(buffer,length,state) mbrlen(buffer,length,&state) --#define check_mbytes(wch,buffer,length,state) \ -- (int) mbrtowc(&wch, buffer, length, &state) --#else --make an error --#endif --#endif /* USE_WIDEC_SUPPORT */ -+#undef CTRL -+#define CTRL(x) ((x) & 0x1f) - --static RETSIGTYPE finish(int sig) GCC_NORETURN; -+static void finish(int sig) GCC_NORETURN; - static void show_all(const char *tag); - - #if defined(SIGWINCH) && defined(TIOCGWINSZ) && HAVE_RESIZE_TERM -@@ -108,11 +95,11 @@ - #endif - - #if CAN_RESIZE --static RETSIGTYPE adjust(int sig); -+static void adjust(int sig); - static int interrupted; -+static bool waiting = FALSE; - #endif - --static bool waiting = FALSE; - static int shift = 0; - static bool try_color = FALSE; - -@@ -121,6 +108,8 @@ - static NCURSES_CH_T **lptr; - static int num_lines; - -+static void usage(void) GCC_NORETURN; -+ - static void - usage(void) - { -@@ -135,6 +124,7 @@ - #if defined(KEY_RESIZE) - ," -r use old-style sigwinch handler rather than KEY_RESIZE" - #endif -+ ," -s start in single-step mode, waiting for input" - #ifdef TRACE - ," -t trace screen updates" - ," -T NUM specify trace mask" -@@ -180,7 +170,7 @@ - { - unsigned len = (unsigned) strlen(src); - NCURSES_CH_T *dst = typeMalloc(NCURSES_CH_T, len + 1); -- unsigned j, k; -+ size_t j, k; - #if USE_WIDEC_SUPPORT - wchar_t wstr[CCHARW_MAX + 1]; - wchar_t wch; -@@ -243,6 +233,7 @@ - int value = 0; - bool done = FALSE; - bool got_number = FALSE; -+ bool single_step = FALSE; - #if CAN_RESIZE - bool nonposix_resize = FALSE; - #endif -@@ -258,7 +249,7 @@ - (void) signal(SIGINT, finish); /* arrange interrupts to terminate */ - #endif - -- while ((i = getopt(argc, argv, "cin:rtT:")) != -1) { -+ while ((i = getopt(argc, argv, "cin:rstT:")) != -1) { - switch (i) { - case 'c': - try_color = TRUE; -@@ -276,9 +267,18 @@ - nonposix_resize = TRUE; - break; - #endif -+ case 's': -+ single_step = TRUE; -+ break; - #ifdef TRACE - case 'T': -- trace((unsigned) atoi(optarg)); -+ { -+ char *next = 0; -+ int tvalue = (int) strtol(optarg, &next, 0); -+ if (tvalue < 0 || (next != 0 && *next != 0)) -+ usage(); -+ trace((unsigned) tvalue); -+ } - break; - case 't': - trace(TRACE_CALLS); -@@ -306,7 +306,7 @@ - (void) signal(SIGWINCH, adjust); /* arrange interrupts to resize */ - #endif - -- /* slurp the file */ -+ Trace(("slurp the file")); - for (lptr = &vec_lines[0]; (lptr - vec_lines) < MAXLINES; lptr++) { - char temp[BUFSIZ], *s, *d; - int col; -@@ -314,8 +314,26 @@ - if (fgets(buf, sizeof(buf), fp) == 0) - break; - -- /* convert tabs so that shift will work properly */ -+#if USE_WIDEC_SUPPORT -+ if (lptr == vec_lines) { -+ if (!memcmp("", buf, 3)) { -+ Trace(("trim BOM")); -+ s = buf + 3; -+ d = buf; -+ do { -+ } while ((*d++ = *s++) != '\0'); -+ } -+ } -+#endif -+ -+ /* convert tabs and nonprinting chars so that shift will work properly */ - for (s = buf, d = temp, col = 0; (*d = *s) != '\0'; s++) { -+ if (*d == '\r') { -+ if (s[1] == '\n') -+ continue; -+ else -+ break; -+ } - if (*d == '\n') { - *d = '\0'; - break; -@@ -347,14 +365,15 @@ - (void) nonl(); /* tell curses not to do NL->CR/NL on output */ - (void) cbreak(); /* take input chars one at a time, no wait for \n */ - (void) noecho(); /* don't echo input */ -- nodelay(stdscr, TRUE); -+ if (!single_step) -+ nodelay(stdscr, TRUE); - idlok(stdscr, TRUE); /* allow use of insert/delete line */ - - if (try_color) { - if (has_colors()) { - start_color(); - init_pair(my_pair, COLOR_WHITE, COLOR_BLUE); -- bkgd(COLOR_PAIR(my_pair)); -+ bkgd((chtype) COLOR_PAIR(my_pair)); - } else { - try_color = FALSE; - } -@@ -373,10 +392,12 @@ - adjust(0); - my_label = "interrupt"; - } --#endif - waiting = TRUE; - c = getch(); - waiting = FALSE; -+#else -+ c = getch(); -+#endif - if ((c < 127) && isdigit(c)) { - if (!got_number) { - MvPrintw(0, 0, "Count: "); -@@ -466,6 +487,9 @@ - nodelay(stdscr, TRUE); - my_delay = 0; - break; -+ case CTRL('L'): -+ redrawwin(stdscr); -+ break; - case ERR: - if (!my_delay) - napms(50); -@@ -483,7 +507,7 @@ - finish(0); /* we're done */ - } - --static RETSIGTYPE -+static void - finish(int sig) - { - endwin(); -@@ -510,7 +534,7 @@ - * The 'wrefresh(curscr)' is needed to force the refresh to start from the top - * of the screen -- some xterms mangle the bitmap while resizing. - */ --static RETSIGTYPE -+static void - adjust(int sig) - { - if (waiting || sig == 0) { -@@ -553,7 +577,7 @@ - printw("%.*s", COLS, temp); - clrtoeol(); - this_time = time((time_t *) 0); -- strcpy(temp, ctime(&this_time)); -+ strncpy(temp, ctime(&this_time), (size_t) 30); - if ((i = (int) strlen(temp)) != 0) { - temp[--i] = 0; - if (move(0, COLS - i - 2) != ERR) -diff -Naur ncurses-5.9/test/widechars.h ncurses-5.9.patch/test/widechars.h ---- ncurses-5.9/test/widechars.h 1970-01-01 01:00:00.000000000 +0100 -+++ ncurses-5.9.patch/test/widechars.h 2014-09-01 16:33:22.575792482 +0200 -@@ -0,0 +1,71 @@ -+/**************************************************************************** -+ * Copyright (c) 2012 Free Software Foundation, Inc. * -+ * * -+ * Permission is hereby granted, free of charge, to any person obtaining a * -+ * copy of this software and associated documentation files (the * -+ * "Software"), to deal in the Software without restriction, including * -+ * without limitation the rights to use, copy, modify, merge, publish, * -+ * distribute, distribute with modifications, sublicense, and/or sell * -+ * copies of the Software, and to permit persons to whom the Software is * -+ * furnished to do so, subject to the following conditions: * -+ * * -+ * The above copyright notice and this permission notice shall be included * -+ * in all copies or substantial portions of the Software. * -+ * * -+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * -+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * -+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * -+ * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * -+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * -+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * -+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * -+ * * -+ * Except as contained in this notice, the name(s) of the above copyright * -+ * holders shall not be used in advertising or otherwise to promote the * -+ * sale, use or other dealings in this Software without prior written * -+ * authorization. * -+ ****************************************************************************/ -+ -+#ifndef __WIDECHARS_H -+#define __WIDECHARS_H 1 -+ -+#include <test.priv.h> -+ -+#if USE_WIDEC_SUPPORT -+ -+#if defined(__MINGW32__) -+/* -+ * MinGW has wide-character functions, but they do not work correctly. -+ */ -+ -+extern int _nc_mbtowc(wchar_t *pwc, const char *s, size_t n); -+extern int __MINGW_NOTHROW _nc_mbtowc(wchar_t *pwc, const char *s, size_t n); -+#define mbtowc(pwc,s,n) _nc_mbtowc(pwc,s,n) -+ -+extern int __MINGW_NOTHROW _nc_mblen(const char *, size_t); -+#define mblen(s,n) _nc_mblen(s, n) -+ -+#endif /* __MINGW32__ */ -+ -+#if HAVE_MBTOWC && HAVE_MBLEN -+#define reset_mbytes(state) IGNORE_RC(mblen(NULL, 0)), IGNORE_RC(mbtowc(NULL, NULL, 0)) -+#define count_mbytes(buffer,length,state) mblen(buffer,length) -+#define check_mbytes(wch,buffer,length,state) \ -+ (int) mbtowc(&wch, buffer, length) -+#define state_unused -+#elif HAVE_MBRTOWC && HAVE_MBRLEN -+#define reset_mbytes(state) init_mb(state) -+#define count_mbytes(buffer,length,state) mbrlen(buffer,length,&state) -+#define check_mbytes(wch,buffer,length,state) \ -+ (int) mbrtowc(&wch, buffer, length, &state) -+#else -+make an error -+#endif -+ -+#else -+ -+#endif /* USE_WIDEC_SUPPORT */ -+ -+extern void widechars_stub(void); -+ -+#endif /* __WIDECHARS_H */ -diff -Naur ncurses-5.9/test/worm.c ncurses-5.9.patch/test/worm.c ---- ncurses-5.9/test/worm.c 2010-11-13 21:21:21.000000000 +0100 -+++ ncurses-5.9.patch/test/worm.c 2014-09-01 16:33:22.575792482 +0200 -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. * -+ * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -61,7 +61,7 @@ - traces will be dumped. The program stops and waits for one character of - input at the beginning and end of the interval. - -- $Id: worm.c,v 1.60 2010/11/13 20:21:21 tom Exp $ -+ $Id: worm.c,v 1.65 2013/06/22 20:01:41 tom Exp $ - */ - - #include <test.priv.h> -@@ -202,6 +202,14 @@ - /* *INDENT-ON* */ - - static void -+failed(const char *s) -+{ -+ perror(s); -+ endwin(); -+ ExitProgram(EXIT_FAILURE); -+} -+ -+static void - cleanup(void) - { - USING_WINDOW(stdscr, wrefresh); -@@ -209,7 +217,7 @@ - endwin(); - } - --static RETSIGTYPE -+static void - onsig(int sig GCC_UNUSED) - { - cleanup(); -@@ -354,8 +362,7 @@ - if (first) { - first = FALSE; - for (n = 0, w = &worm[0]; n < number; n++, w++) { -- int rc; -- rc = pthread_create(&(w->thread), NULL, start_worm, w); -+ (void) pthread_create(&(w->thread), NULL, start_worm, w); - } - } - #else -@@ -391,6 +398,8 @@ - if (last_x != COLS - 1) { - for (y = 0; y <= last_y; y++) { - refs[y] = typeRealloc(int, (size_t) COLS, refs[y]); -+ if (!refs[y]) -+ failed("update_refs"); - for (x = last_x + 1; x < COLS; x++) - refs[y][x] = 0; - } -@@ -402,6 +411,8 @@ - refs = typeRealloc(int *, (size_t) LINES, refs); - for (y = last_y + 1; y < LINES; y++) { - refs[y] = typeMalloc(int, (size_t) COLS); -+ if (!refs[y]) -+ failed("update_refs"); - for (x = 0; x < COLS; x++) - refs[y][x] = 0; - } -@@ -419,6 +430,7 @@ - struct worm *w; - int *ip; - bool done = FALSE; -+ int max_refs; - - setlocale(LC_ALL, ""); - -@@ -489,7 +501,7 @@ - - #define SET_COLOR(num, fg) \ - init_pair(num+1, (short) fg, (short) bg); \ -- flavor[num] |= COLOR_PAIR(num+1) | A_BOLD -+ flavor[num] |= (chtype) COLOR_PAIR(num+1) | A_BOLD - - SET_COLOR(0, COLOR_GREEN); - SET_COLOR(1, COLOR_RED); -@@ -501,8 +513,9 @@ - } - #endif /* A_COLOR */ - -- refs = typeMalloc(int *, (size_t) LINES); -- for (y = 0; y < LINES; y++) { -+ max_refs = LINES; -+ refs = typeMalloc(int *, (size_t) max_refs); -+ for (y = 0; y < max_refs; y++) { - refs[y] = typeMalloc(int, (size_t) COLS); - for (x = 0; x < COLS; x++) { - refs[y][x] = 0; -@@ -596,7 +609,7 @@ - Trace(("Cleanup")); - cleanup(); - #ifdef NO_LEAKS -- for (y = 0; y < LINES; y++) { -+ for (y = 0; y < max_refs; y++) { - free(refs[y]); - } - free(refs); -diff -Naur ncurses-5.9/test/xmas.c ncurses-5.9.patch/test/xmas.c ---- ncurses-5.9/test/xmas.c 2010-11-13 21:24:10.000000000 +0100 -+++ ncurses-5.9.patch/test/xmas.c 2014-09-01 16:33:22.575792482 +0200 -@@ -92,7 +92,7 @@ - /******************************************************************************/ - - /* -- * $Id: xmas.c,v 1.27 2010/11/13 20:24:10 tom Exp $ -+ * $Id: xmas.c,v 1.28 2013/04/27 19:46:53 tom Exp $ - */ - #include <test.priv.h> - -@@ -148,7 +148,7 @@ - static int reindeer(void); - static int blinkit(void); - --static RETSIGTYPE done(int sig) GCC_NORETURN; -+static void done(int sig) GCC_NORETURN; - - static void - set_color(WINDOW *win, chtype color) -@@ -1143,7 +1143,7 @@ - return (0); - } - --static RETSIGTYPE -+static void - done(int sig GCC_UNUSED) - { - CATCHALL(done); diff --git a/packages/devel/ncurses/patches/ncurses-gcc-5.patch b/packages/devel/ncurses/patches/ncurses-gcc-5.patch deleted file mode 100644 index 2448229b88e..00000000000 --- a/packages/devel/ncurses/patches/ncurses-gcc-5.patch +++ /dev/null @@ -1,46 +0,0 @@ -https://bugs.gentoo.org/545114 - -extracted from the upstream change (which had many unrelated commits in one) - -From 97bb4678dc03e753290b39bbff30ba2825df9517 Mon Sep 17 00:00:00 2001 -From: "Thomas E. Dickey" <dickey@invisible-island.net> -Date: Sun, 7 Dec 2014 03:10:09 +0000 -Subject: [PATCH] ncurses 5.9 - patch 20141206 - -+ modify MKlib_gen.sh to work around change in development version of - gcc introduced here: - https://gcc.gnu.org/ml/gcc-patches/2014-06/msg02185.html - https://gcc.gnu.org/ml/gcc-patches/2014-07/msg00236.html - (reports by Marcus Shawcroft, Maohui Lei). - -diff --git a/ncurses/base/MKlib_gen.sh b/ncurses/base/MKlib_gen.sh -index d8cc3c9..b91398c 100755 ---- a/ncurses/base/MKlib_gen.sh -+++ b/ncurses/base/MKlib_gen.sh -@@ -474,11 +474,22 @@ sed -n -f $ED1 \ - -e 's/gen_$//' \ - -e 's/ / /g' >>$TMP - -+cat >$ED1 <<EOF -+s/ / /g -+s/^ // -+s/ $// -+s/P_NCURSES_BOOL/NCURSES_BOOL/g -+EOF -+ -+# A patch discussed here: -+# https://gcc.gnu.org/ml/gcc-patches/2014-06/msg02185.html -+# introduces spurious #line markers. Work around that by ignoring the system's -+# attempt to define "bool" and using our own symbol here. -+sed -e 's/bool/P_NCURSES_BOOL/g' $TMP > $ED2 -+cat $ED2 >$TMP -+ - $preprocessor $TMP 2>/dev/null \ --| sed \ -- -e 's/ / /g' \ -- -e 's/^ //' \ -- -e 's/_Bool/NCURSES_BOOL/g' \ -+| sed -f $ED1 \ - | $AWK -f $AW2 \ - | sed -f $ED3 \ - | sed \ diff --git a/packages/devel/netbsd-curses/package.mk b/packages/devel/netbsd-curses/package.mk new file mode 100644 index 00000000000..1654909bb61 --- /dev/null +++ b/packages/devel/netbsd-curses/package.mk @@ -0,0 +1,36 @@ +################################################################################ +# This file is part of LibreELEC - https://libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see <http://www.gnu.org/licenses/>. +################################################################################ + +PKG_NAME="netbsd-curses" +PKG_VERSION="47b256a" +PKG_ARCH="any" +PKG_SITE="https://github.com/sabotage-linux/netbsd-curses" +PKG_URL="https://github.com/sabotage-linux/netbsd-curses/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain" +PKG_PRIORITY="optional" +PKG_SECTION="devel" +PKG_SHORTDESC="netbsd-libcurses portable edition" +PKG_LONGDESC="netbsd-libcurses portable edition" + +make_target() { + make HOSTCC="$HOST_CC" PREFIX=/usr all-static +} + +makeinstall_target() { + make HOSTCC="$HOST_CC" PREFIX=$SYSROOT_PREFIX/usr install-static +} diff --git a/packages/devel/pkg-config/package.mk b/packages/devel/pkg-config/package.mk index 87cb8787c75..38249732002 100644 --- a/packages/devel/pkg-config/package.mk +++ b/packages/devel/pkg-config/package.mk @@ -17,7 +17,7 @@ ################################################################################ PKG_NAME="pkg-config" -PKG_VERSION="0.29" +PKG_VERSION="0.29.1" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" diff --git a/packages/devel/readline/package.mk b/packages/devel/readline/package.mk index 52eccc9a24c..366123aafdb 100644 --- a/packages/devel/readline/package.mk +++ b/packages/devel/readline/package.mk @@ -23,7 +23,7 @@ PKG_ARCH="any" PKG_LICENSE="MIT" PKG_SITE="http://www.gnu.org/readline" PKG_URL="http://ftp.gnu.org/gnu/readline/$PKG_NAME-$PKG_VERSION.tar.gz" -PKG_DEPENDS_TARGET="toolchain ncurses" +PKG_DEPENDS_TARGET="toolchain netbsd-curses" PKG_PRIORITY="optional" PKG_SECTION="devel" PKG_SHORTDESC="readline: The GNU Readline library provides a set of functions for use by applications that allow users to edit command lines as they are typed in." diff --git a/packages/graphics/bcm2835-driver/package.mk b/packages/graphics/bcm2835-driver/package.mk index c84ae431068..9ca449f775d 100644 --- a/packages/graphics/bcm2835-driver/package.mk +++ b/packages/graphics/bcm2835-driver/package.mk @@ -17,13 +17,13 @@ ################################################################################ PKG_NAME="bcm2835-driver" -PKG_VERSION="b48c36f" +PKG_VERSION="70143fe" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="nonfree" PKG_SITE="http://www.broadcom.com" PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" -PKG_DEPENDS_TARGET="toolchain" +PKG_DEPENDS_TARGET="toolchain dtc" PKG_PRIORITY="optional" PKG_SECTION="graphics" PKG_SHORTDESC="OpenMAX-bcm2835: OpenGL-ES and OpenMAX driver for BCM2835" @@ -56,6 +56,7 @@ make_target() { cp -PRv $FLOAT/opt/vc/lib/libmmal_util.so $SYSROOT_PREFIX/usr/lib cp -PRv $FLOAT/opt/vc/lib/libmmal_vc_client.so $SYSROOT_PREFIX/usr/lib cp -PRv $FLOAT/opt/vc/lib/libvcsm.so $SYSROOT_PREFIX/usr/lib + cp -PRv $FLOAT/opt/vc/lib/libdtovl.so $SYSROOT_PREFIX/usr/lib } makeinstall_target() { @@ -76,11 +77,14 @@ makeinstall_target() { cp -PRv $FLOAT/opt/vc/lib/libmmal_util.so $INSTALL/usr/lib cp -PRv $FLOAT/opt/vc/lib/libmmal_vc_client.so $INSTALL/usr/lib cp -PRv $FLOAT/opt/vc/lib/libvcsm.so $INSTALL/usr/lib + cp -PRv $FLOAT/opt/vc/lib/libdtovl.so $INSTALL/usr/lib # some usefull debug tools mkdir -p $INSTALL/usr/bin + cp -PRv $FLOAT/opt/vc/bin/dtoverlay $INSTALL/usr/bin + ln -s dtoverlay $INSTALL/usr/bin/dtparam cp -PRv $FLOAT/opt/vc/bin/vcdbg $INSTALL/usr/bin - cp -PRv $FLOAT/opt/vc/lib/libdebug_sym.so $INSTALL/usr/lib + cp -PRv $FLOAT/opt/vc/lib/libdebug_sym.so $INSTALL/usr/lib cp -PRv $FLOAT/opt/vc/bin/vcgencmd $INSTALL/usr/bin cp -PRv $FLOAT/opt/vc/bin/tvservice $INSTALL/usr/bin cp -PRv $FLOAT/opt/vc/bin/edidparser $INSTALL/usr/bin diff --git a/packages/graphics/cairo/package.mk b/packages/graphics/cairo/package.mk new file mode 100644 index 00000000000..3a689ae0ffe --- /dev/null +++ b/packages/graphics/cairo/package.mk @@ -0,0 +1,104 @@ +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# +# OpenELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# OpenELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with OpenELEC. If not, see <http://www.gnu.org/licenses/>. +################################################################################ + +PKG_NAME="cairo" +PKG_VERSION="1.14.6" +PKG_REV="1" +PKG_ARCH="any" +PKG_LICENSE="LGPL" +PKG_SITE="http://cairographics.org/" +PKG_URL="http://cairographics.org/releases/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_DEPENDS_TARGET="toolchain zlib freetype fontconfig libpng pixman" +PKG_PRIORITY="optional" +PKG_SECTION="graphics" +PKG_SHORTDESC="cairo: Multi-platform 2D graphics library" +PKG_LONGDESC="Cairo is a vector graphics library with cross-device output support. Currently supported output targets include the X Window System and in-memory image buffers. PostScript and PDF file output is planned. Cairo is designed to produce identical output on all output media while taking advantage of display hardware acceleration when available." +PKG_IS_ADDON="no" + +PKG_AUTORECONF="no" # ToDo + +if [ "$DISPLAYSERVER" = "x11" ]; then + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET libXrender libX11 mesa glu" + PKG_CAIRO_CONFIG="--x-includes="$SYSROOT_PREFIX/usr/include" \ + --x-libraries="$SYSROOT_PREFIX/usr/lib" \ + --enable-xlib \ + --enable-xlib-xrender \ + --enable-gl \ + --enable-glx \ + --disable-glesv2 \ + --disable-egl \ + --with-x" + + +elif [ "$DISPLAYSERVER" = "weston" ]; then + PKG_CAIRO_CONFIG="--disable-xlib \ + --disable-xlib-xrender \ + --disable-gl \ + --disable-glx \ + --enable-glesv2 \ + --enable-egl \ + --without-x" +fi + +PKG_CONFIGURE_OPTS_TARGET="$PKG_CAIRO_CONFIG \ + --disable-silent-rules \ + --enable-shared \ + --disable-static \ + --disable-gtk-doc \ + --enable-largefile \ + --enable-atomic \ + --disable-gcov \ + --disable-valgrind \ + --disable-xcb \ + --disable-xlib-xcb \ + --disable-xcb-shm \ + --disable-qt \ + --disable-quartz \ + --disable-quartz-font \ + --disable-quartz-image \ + --disable-win32 \ + --disable-win32-font \ + --disable-skia \ + --disable-os2 \ + --disable-beos \ + --disable-cogl \ + --disable-drm \ + --disable-drm-xr \ + --disable-gallium \ + --disable-xcb-drm \ + --enable-png \ + --disable-directfb \ + --disable-vg \ + --disable-wgl \ + --disable-script \ + --enable-ft \ + --enable-fc \ + --enable-ps \ + --enable-pdf \ + --enable-svg \ + --disable-test-surfaces \ + --disable-tee \ + --disable-xml \ + --enable-pthread \ + --disable-gobject \ + --disable-full-testing \ + --disable-trace \ + --enable-interpreter \ + --disable-symbol-lookup \ + --enable-some-floating-point \ + --with-gnu-ld" diff --git a/packages/graphics/glew/package.mk b/packages/graphics/glew/package.mk index 14139cef004..658ca86bf92 100644 --- a/packages/graphics/glew/package.mk +++ b/packages/graphics/glew/package.mk @@ -23,7 +23,7 @@ PKG_ARCH="any" PKG_LICENSE="BSD" PKG_SITE="http://glew.sourceforge.net/" PKG_URL="$SOURCEFORGE_SRC/glew/glew/$PKG_VERSION/$PKG_NAME-$PKG_VERSION.tgz" -PKG_DEPENDS_TARGET="toolchain libX11 libXext libXi libXmu" +PKG_DEPENDS_TARGET="toolchain" PKG_PRIORITY="optional" PKG_SECTION="graphics" PKG_SHORTDESC="glew: The OpenGL Extension Wrangler Library" @@ -32,10 +32,6 @@ PKG_LONGDESC="The OpenGL Extension Wrangler Library (GLEW) is a cross-platform C PKG_IS_ADDON="no" PKG_AUTORECONF="no" -if [ ! "$OPENGL" = "no" ]; then - PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET $OPENGL glu" -fi - make_target() { make CC="$CC" LD="$CC" AR="$AR" \ POPT="$CFLAGS" LDFLAGS.EXTRA="$LDFLAGS" \ diff --git a/packages/graphics/gpu-viv-bin-mx6q/package.mk b/packages/graphics/gpu-viv-bin-mx6q/package.mk index 339e5de3909..dde2f2ba9ef 100644 --- a/packages/graphics/gpu-viv-bin-mx6q/package.mk +++ b/packages/graphics/gpu-viv-bin-mx6q/package.mk @@ -17,67 +17,48 @@ ################################################################################ PKG_NAME="gpu-viv-bin-mx6q" -PKG_VERSION="3.10.17-1.0.0-1" +PKG_VERSION="3.10.17-1.0.2-hfp" PKG_REV="1" PKG_ARCH="arm" PKG_LICENSE="nonfree" PKG_SITE="http://www.freescale.com" PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" -PKG_DEPENDS_TARGET="toolchain" +PKG_DEPENDS_TARGET="toolchain gpu-viv-g2d" PKG_PRIORITY="optional" PKG_SECTION="graphics" PKG_SHORTDESC="gpu-viv-bin-mx6q: OpenGL-ES and VIVANTE driver for imx6q" PKG_LONGDESC="gpu-viv-bin-mx6q: OpenGL-ES and VIVANTE driver for imx6q" - PKG_IS_ADDON="no" PKG_AUTORECONF="no" -if [ "$TARGET_FLOAT" = "softfp" -o "$TARGET_FLOAT" = "soft" ]; then - FLOAT="softfp" -elif [ "$TARGET_FLOAT" = "hard" ]; then - FLOAT="hardfp" -fi - make_target() { : # nothing to make } makeinstall_target() { mkdir -p $SYSROOT_PREFIX/usr/include - cp -PRv $FLOAT/usr/include/* $SYSROOT_PREFIX/usr/include + cp -PRv usr/include/* $SYSROOT_PREFIX/usr/include + + LIBS_COPY="usr/lib/libEGL-fb.so \ + usr/lib/libEGL.so* \ + usr/lib/libGLES_CL.so \ + usr/lib/libGLES_CM.so \ + usr/lib/libGLESv1_CL.so* \ + usr/lib/libGLESv1_CM.so* \ + usr/lib/libGLESv2-fb.so \ + usr/lib/libGLESv2.so* \ + usr/lib/libGLSLC.so* \ + usr/lib/libGAL-fb.so \ + usr/lib/libGAL.so* \ + usr/lib/libVIVANTE-fb.so \ + usr/lib/libVIVANTE.so* \ + usr/lib/libOpenCL.so" mkdir -p $SYSROOT_PREFIX/usr/lib - cp -PRv $FLOAT/usr/lib/libEGL-fb.so \ - $FLOAT/usr/lib/libEGL.so* \ - $FLOAT/usr/lib/libGLES_CL.so \ - $FLOAT/usr/lib/libGLES_CM.so \ - $FLOAT/usr/lib/libGLESv1_CL.so* \ - $FLOAT/usr/lib/libGLESv1_CM.so* \ - $FLOAT/usr/lib/libGLESv2-fb.so \ - $FLOAT/usr/lib/libGLESv2.so* \ - $FLOAT/usr/lib/libGAL-fb.so \ - $FLOAT/usr/lib/libGAL.so* \ - $FLOAT/usr/lib/libVIVANTE-fb.so \ - $FLOAT/usr/lib/libVIVANTE.so* \ - $FLOAT/usr/lib/libOpenCL.so \ - $SYSROOT_PREFIX/usr/lib + cp -PRv $LIBS_COPY $SYSROOT_PREFIX/usr/lib mkdir -p $INSTALL/usr/lib - cp -PRv $FLOAT/usr/lib/libEGL-fb.so \ - $FLOAT/usr/lib/libEGL.so* \ - $FLOAT/usr/lib/libGLES_CL.so \ - $FLOAT/usr/lib/libGLES_CM.so \ - $FLOAT/usr/lib/libGLESv1_CL.so* \ - $FLOAT/usr/lib/libGLESv1_CM.so* \ - $FLOAT/usr/lib/libGLESv2-fb.so \ - $FLOAT/usr/lib/libGLESv2.so* \ - $FLOAT/usr/lib/libGLSLC.so* \ - $FLOAT/usr/lib/libGAL-fb.so \ - $FLOAT/usr/lib/libGAL.so* \ - $FLOAT/usr/lib/libVIVANTE-fb.so \ - $FLOAT/usr/lib/libVIVANTE.so* \ - $FLOAT/usr/lib/libOpenCL.so \ - $INSTALL/usr/lib + cp -PRv $LIBS_COPY $INSTALL/usr/lib } post_install() { diff --git a/packages/graphics/opengl-meson8/package.mk b/packages/graphics/imx-gpu-viv/package.mk similarity index 51% rename from packages/graphics/opengl-meson8/package.mk rename to packages/graphics/imx-gpu-viv/package.mk index 74e75250072..c2401165dc3 100644 --- a/packages/graphics/opengl-meson8/package.mk +++ b/packages/graphics/imx-gpu-viv/package.mk @@ -16,35 +16,54 @@ # along with OpenELEC. If not, see <http://www.gnu.org/licenses/>. ################################################################################ -PKG_NAME="opengl-meson8" -PKG_VERSION="r5p1-01rel0-armhf" +PKG_NAME="imx-gpu-viv" +PKG_VERSION="5.0.11.p4.5-hfp" PKG_REV="1" PKG_ARCH="arm" PKG_LICENSE="nonfree" -PKG_SITE="http://openlinux.amlogic.com:8000/download/ARM/filesystem/" +PKG_SITE="http://www.freescale.com" PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" PKG_DEPENDS_TARGET="toolchain" PKG_PRIORITY="optional" PKG_SECTION="graphics" -PKG_SHORTDESC="opengl-meson8: OpenGL ES pre-compiled libraries for Mali 450 GPUs found in Amlogic Meson8 SoCs" -PKG_LONGDESC="opengl-meson8: OpenGL ES pre-compiled libraries for Mali 450 GPUs found in Amlogic Meson8 SoCs. The libraries could be found in a Linux buildroot released by Amlogic at http://openlinux.amlogic.com:8000/download/ARM/filesystem/. See the opengl package." - +PKG_SHORTDESC="imx-gpu-viv: OpenGL-ES and VIVANTE driver for imx6q" +PKG_LONGDESC="imx-gpu-viv: OpenGL-ES and VIVANTE driver for imx6q" PKG_IS_ADDON="no" PKG_AUTORECONF="no" make_target() { - : # nothing todo + : # nothing to make } makeinstall_target() { mkdir -p $SYSROOT_PREFIX/usr/include - cp -PR usr/include/* $SYSROOT_PREFIX/usr/include + cp -PRv gpu-core/usr/include/* $SYSROOT_PREFIX/usr/include + cp -PRv g2d/usr/include/* $SYSROOT_PREFIX/usr/include + + LIBS_COPY="gpu-core/usr/lib/libEGL-fb.so \ + gpu-core/usr/lib/libEGL.so* \ + gpu-core/usr/lib/libGLES_CL.so* \ + gpu-core/usr/lib/libGLES_CM.so* \ + gpu-core/usr/lib/libGLESv1_CL.so* \ + gpu-core/usr/lib/libGLESv1_CM.so* \ + gpu-core/usr/lib/libGLESv2-fb.so \ + gpu-core/usr/lib/libGLESv2.so* \ + gpu-core/usr/lib/libGLSLC.so* \ + gpu-core/usr/lib/libGAL-fb.so \ + gpu-core/usr/lib/libGAL.so* \ + gpu-core/usr/lib/libGAL_egl.fb.so \ + gpu-core/usr/lib/libGAL_egl.so* \ + gpu-core/usr/lib/libVIVANTE-fb.so \ + gpu-core/usr/lib/libVIVANTE.so* \ + gpu-core/usr/lib/libOpenCL.so \ + gpu-core/usr/lib/libVSC.so \ + g2d/usr/lib/libg2d*.so*" mkdir -p $SYSROOT_PREFIX/usr/lib - cp -PR usr/lib/*.so* $SYSROOT_PREFIX/usr/lib + cp -PRv $LIBS_COPY $SYSROOT_PREFIX/usr/lib mkdir -p $INSTALL/usr/lib - cp -PR usr/lib/*.so* $INSTALL/usr/lib + cp -PRv $LIBS_COPY $INSTALL/usr/lib } post_install() { diff --git a/packages/graphics/opengl-meson8/system.d/unbind-console.service b/packages/graphics/imx-gpu-viv/system.d/unbind-console.service similarity index 82% rename from packages/graphics/opengl-meson8/system.d/unbind-console.service rename to packages/graphics/imx-gpu-viv/system.d/unbind-console.service index a79c37ad113..af5e5d44c44 100644 --- a/packages/graphics/opengl-meson8/system.d/unbind-console.service +++ b/packages/graphics/imx-gpu-viv/system.d/unbind-console.service @@ -1,5 +1,5 @@ [Unit] -Description=Unbind framebuffer console +Description=unbind Framebuffer console ConditionPathExists=/sys/class/vtconsole/vtcon1/bind diff --git a/packages/graphics/libdrm/package.mk b/packages/graphics/libdrm/package.mk index f49fd142c7e..939bc0897c1 100644 --- a/packages/graphics/libdrm/package.mk +++ b/packages/graphics/libdrm/package.mk @@ -17,7 +17,7 @@ ################################################################################ PKG_NAME="libdrm" -PKG_VERSION="2.4.67" +PKG_VERSION="2.4.68" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" @@ -46,6 +46,10 @@ for drv in $GRAPHIC_DRIVERS; do DRM_CONFIG=`echo $DRM_CONFIG | sed -e 's/disable-libkms/enable-libkms/'` && \ DRM_CONFIG=`echo $DRM_CONFIG | sed -e 's/disable-radeon/enable-radeon/'` && \ DRM_CONFIG=`echo $DRM_CONFIG | sed -e 's/disable-amdgpu/enable-amdgpu/'` + + [ "$drv" = "vmware" ] && \ + DRM_CONFIG=`echo $DRM_CONFIG | sed -e 's/disable-libkms/enable-libkms/'` && \ + DRM_CONFIG=`echo $DRM_CONFIG | sed -e 's/disable-vmwgfx/enable-vmwgfx/'` done PKG_CONFIGURE_OPTS_TARGET="--disable-udev \ diff --git a/packages/graphics/libprojectM/package.mk b/packages/graphics/libprojectM/package.mk index 5b0c2eeb066..146f71a1b01 100644 --- a/packages/graphics/libprojectM/package.mk +++ b/packages/graphics/libprojectM/package.mk @@ -23,7 +23,7 @@ PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://projectm.sourceforge.net/" PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.gz" -PKG_DEPENDS_TARGET="toolchain ftgl" +PKG_DEPENDS_TARGET="toolchain ftgl freetype $OPENGL" PKG_PRIORITY="optional" PKG_SECTION="multimedia" PKG_SHORTDESC="libprojectM:" diff --git a/packages/graphics/mesa/package.mk b/packages/graphics/mesa/package.mk index a68c799a185..2e7da8bff80 100644 --- a/packages/graphics/mesa/package.mk +++ b/packages/graphics/mesa/package.mk @@ -17,13 +17,13 @@ ################################################################################ PKG_NAME="mesa" -PKG_VERSION="11.2.0-rc2" +PKG_VERSION="11.2.2" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="OSS" PKG_SITE="http://www.mesa3d.org/" -PKG_URL="ftp://freedesktop.org/pub/mesa/11.2.0/$PKG_NAME-$PKG_VERSION.tar.xz" -PKG_DEPENDS_TARGET="toolchain Python:host expat glproto dri2proto presentproto libdrm libXext libXdamage libXfixes libXxf86vm libxcb libX11 systemd dri3proto libxshmfence" +PKG_URL="ftp://freedesktop.org/pub/mesa/$PKG_VERSION/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_DEPENDS_TARGET="toolchain Python:host expat glproto dri2proto presentproto libdrm libXext libXdamage libXfixes libXxf86vm libxcb libX11 systemd dri3proto libxshmfence libressl" PKG_PRIORITY="optional" PKG_SECTION="graphics" PKG_SHORTDESC="mesa: 3-D graphics library with OpenGL API" @@ -43,13 +43,24 @@ else MESA_GALLIUM_LLVM="--disable-gallium-llvm" fi -if [ "$VDPAU_SUPPORT" = "yes" ]; then +if [ "$VDPAU_SUPPORT" = "yes" -a "$DISPLAYSERVER" = "x11" ]; then PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET libvdpau" MESA_VDPAU="--enable-vdpau" else MESA_VDPAU="--disable-vdpau" fi +XA_CONFIG="--disable-xa" +for drv in $GRAPHIC_DRIVERS; do + [ "$drv" = "vmware" ] && XA_CONFIG="--enable-xa" +done + +if [ "$OPENGLES_SUPPORT" = "yes" ]; then + MESA_GLES="--enable-gles2" +else + MESA_GLES="--disable-gles2" +fi + PKG_CONFIGURE_OPTS_TARGET="CC_FOR_BUILD=$HOST_CC \ CXX_FOR_BUILD=$HOST_CXX \ CFLAGS_FOR_BUILD= \ @@ -65,14 +76,14 @@ PKG_CONFIGURE_OPTS_TARGET="CC_FOR_BUILD=$HOST_CC \ --disable-selinux \ --enable-opengl \ --disable-gles1 \ - --disable-gles2 \ + $MESA_GLES \ --enable-dri \ - --disable-dri3 \ + --enable-dri3 \ --enable-glx \ --disable-osmesa \ --disable-gallium-osmesa \ --enable-egl --with-egl-platforms=x11,drm \ - --disable-xa \ + $XA_CONFIG \ --enable-gbm \ --disable-nine \ --disable-xvmc \ @@ -97,6 +108,10 @@ PKG_CONFIGURE_OPTS_TARGET="CC_FOR_BUILD=$HOST_CC \ --with-dri-drivers=$DRI_DRIVERS \ --with-sysroot=$SYSROOT_PREFIX" +pre_configure_target() { + export LIBS="-lxcb-dri3 -lxcb-present -lxcb-sync -lxshmfence" +} + post_makeinstall_target() { # rename and relink for cooperate with nvidia drivers rm -rf $INSTALL/usr/lib/libGL.so diff --git a/packages/graphics/opengl-meson/package.mk b/packages/graphics/opengl-meson/package.mk new file mode 100644 index 00000000000..58e84b736d5 --- /dev/null +++ b/packages/graphics/opengl-meson/package.mk @@ -0,0 +1,86 @@ +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# +# OpenELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# OpenELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with OpenELEC. If not, see <http://www.gnu.org/licenses/>. +################################################################################ + +PKG_NAME="opengl-meson" +PKG_REV="1" +PKG_ARCH="arm aarch64" +PKG_LICENSE="nonfree" +PKG_SITE="http://openlinux.amlogic.com:8000/download/ARM/filesystem/" +case $MESON_FAMILY in + 8) + PKG_VERSION="8-r5p1-01rel0-armhf" + ;; + 6) + PKG_VERSION="6-r5p1-01rel0-armhf" + ;; + gxbb) + PKG_VERSION="gxbb-r5p1-01rel0" + ;; +esac +PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_DEPENDS_TARGET="toolchain" +PKG_PRIORITY="optional" +PKG_SECTION="graphics" +PKG_SHORTDESC="opengl-meson: OpenGL ES pre-compiled libraries for Mali GPUs found in Amlogic Meson SoCs" +PKG_LONGDESC="opengl-meson: OpenGL ES pre-compiled libraries for Mali GPUs found in Amlogic Meson SoCs. The libraries could be found in a Linux buildroot released by Amlogic at http://openlinux.amlogic.com:8000/download/ARM/filesystem/. See the opengl package." + +PKG_IS_ADDON="no" +PKG_AUTORECONF="no" + +make_target() { + : # nothing todo +} + +makeinstall_target() { + mkdir -p $SYSROOT_PREFIX/usr/include + cp -PR usr/include/* $SYSROOT_PREFIX/usr/include + + mkdir -p $SYSROOT_PREFIX/usr/lib + cp -PR usr/lib/libMali.so $SYSROOT_PREFIX/usr/lib + + ln -sf libMali.so $SYSROOT_PREFIX/usr/lib/libEGL.so.1.4 + ln -sf libEGL.so.1.4 $SYSROOT_PREFIX/usr/lib/libEGL.so.1 + ln -sf libEGL.so.1 $SYSROOT_PREFIX/usr/lib/libEGL.so + + ln -sf libMali.so $SYSROOT_PREFIX/usr/lib/libGLESv1_CM.so.1.1 + ln -sf libGLESv1_CM.so.1.1 $SYSROOT_PREFIX/usr/lib/libGLESv1_CM.so.1 + ln -sf libGLESv1_CM.so.1 $SYSROOT_PREFIX/usr/lib/libGLESv1_CM.so + + ln -sf libMali.so $SYSROOT_PREFIX/usr/lib/libGLESv2.so.2.0 + ln -sf libGLESv2.so.2.0 $SYSROOT_PREFIX/usr/lib/libGLESv2.so.2 + ln -sf libGLESv2.so.2 $SYSROOT_PREFIX/usr/lib/libGLESv2.so + + mkdir -p $INSTALL/usr/lib + cp -PR usr/lib/libMali.so $INSTALL/usr/lib + + ln -sf libMali.so $INSTALL/usr/lib/libEGL.so.1.4 + ln -sf libEGL.so.1.4 $INSTALL/usr/lib/libEGL.so.1 + ln -sf libEGL.so.1 $INSTALL/usr/lib/libEGL.so + + ln -sf libMali.so $INSTALL/usr/lib/libGLESv1_CM.so.1.1 + ln -sf libGLESv1_CM.so.1.1 $INSTALL/usr/lib/libGLESv1_CM.so.1 + ln -sf libGLESv1_CM.so.1 $INSTALL/usr/lib/libGLESv1_CM.so + + ln -sf libMali.so $INSTALL/usr/lib/libGLESv2.so.2.0 + ln -sf libGLESv2.so.2.0 $INSTALL/usr/lib/libGLESv2.so.2 + ln -sf libGLESv2.so.2 $INSTALL/usr/lib/libGLESv2.so +} + +post_install() { + enable_service unbind-console.service +} diff --git a/packages/graphics/opengl-meson6/system.d/unbind-console.service b/packages/graphics/opengl-meson/system.d/unbind-console.service similarity index 100% rename from packages/graphics/opengl-meson6/system.d/unbind-console.service rename to packages/graphics/opengl-meson/system.d/unbind-console.service diff --git a/packages/graphics/opengl-meson6/package.mk b/packages/graphics/opengl-meson6/package.mk deleted file mode 100644 index 44ab9038a53..00000000000 --- a/packages/graphics/opengl-meson6/package.mk +++ /dev/null @@ -1,52 +0,0 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2014 Alex Deryskyba (alex@codesnake.com) -# -# OpenELEC is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 2 of the License, or -# (at your option) any later version. -# -# OpenELEC is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see <http://www.gnu.org/licenses/>. -################################################################################ - -PKG_NAME="opengl-meson6" -PKG_VERSION="r5p1-01rel0-armhf" -PKG_REV="1" -PKG_ARCH="arm" -PKG_LICENSE="nonfree" -PKG_SITE="http://openlinux.amlogic.com:8000/download/ARM/filesystem/" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" -PKG_DEPENDS_TARGET="toolchain" -PKG_PRIORITY="optional" -PKG_SECTION="graphics" -PKG_SHORTDESC="opengl-meson6: OpenGL ES pre-compiled libraries for Mali 400 GPUs found in Amlogic Meson6 SoCs" -PKG_LONGDESC="opengl-meson6: OpenGL ES pre-compiled libraries for Mali 400 GPUs found in Amlogic Meson6 SoCs. The libraries could be found in a Linux buildroot released by Amlogic at http://openlinux.amlogic.com:8000/download/ARM/filesystem/. See the opengl package." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -make_target() { - : # nothing todo -} - -makeinstall_target() { - mkdir -p $SYSROOT_PREFIX/usr/include - cp -PR usr/include/* $SYSROOT_PREFIX/usr/include - - mkdir -p $SYSROOT_PREFIX/usr/lib - cp -PR usr/lib/*.so* $SYSROOT_PREFIX/usr/lib - - mkdir -p $INSTALL/usr/lib - cp -PR usr/lib/*.so* $INSTALL/usr/lib -} - -post_install() { - enable_service unbind-console.service -} diff --git a/packages/graphics/soil/package.mk b/packages/graphics/soil/package.mk index b959306cf61..c103e643b59 100644 --- a/packages/graphics/soil/package.mk +++ b/packages/graphics/soil/package.mk @@ -17,30 +17,26 @@ ################################################################################ PKG_NAME="soil" -PKG_VERSION="1.07" +PKG_VERSION="1.16" PKG_REV="1" PKG_ARCH="any" -PKG_LICENSE="PD" +PKG_LICENSE="CCPL" PKG_SITE="http://www.lonesock.net/soil.html" PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" -PKG_DEPENDS_TARGET="mesa" +PKG_DEPENDS_TARGET="toolchain mesa" PKG_PRIORITY="optional" PKG_SECTION="graphics" -PKG_SHORTDESC="libsoil: Simple OpenGL Image Library" -PKG_LONGDESC="libsoil: Simple OpenGL Image Library" +PKG_SHORTDESC="A tiny C lib primarily for loading textures into OpenGL" +PKG_LONGDESC="A tiny C lib primarily for loading textures into OpenGL" PKG_IS_ADDON="no" PKG_AUTORECONF="no" -make_target() { - mkdir projects/makefile/obj - make CXX="$CXX" CC="$CC" LD="$CC" AR="$AR" CFLAGS="-fPIC -O2" CXXFLAGS="-fPIC -O2" -C projects/makefile +pre_make_target() { + sed "s/1.07-20071110/$PKG_VERSION/" -i Makefile + export CFLAGS="$CFLAGS -fPIC" } -makeinstall_target() { - mkdir -p $SYSROOT_PREFIX/usr/lib - cp -PR lib/libSOIL.a $SYSROOT_PREFIX/usr/lib - - mkdir -p $SYSROOT_PREFIX/usr/include/SOIL - cp -P src/SOIL.h $SYSROOT_PREFIX/usr/include/SOIL +pre_makeinstall_target() { + export DESTDIR=$SYSROOT_PREFIX } diff --git a/packages/graphics/soil/patches/soil-0001_fix-makefile.patch b/packages/graphics/soil/patches/soil-0001_fix-makefile.patch new file mode 100644 index 00000000000..505530ce5cb --- /dev/null +++ b/packages/graphics/soil/patches/soil-0001_fix-makefile.patch @@ -0,0 +1,47 @@ +--- /dev/null 2015-06-05 20:37:04.396503995 +0200 ++++ b/Makefile 2016-01-27 22:47:09.795982961 +0100 +@@ -0,0 +1,44 @@ ++CC ?= gcc ++INSTALL_FILE = install -p -m 644 ++INSTALL_DIR = install -p -d ++LN = ln -s ++RM = rm -fv ++CFLAGS += -c -O2 -Wall ++LDFLAGS += ++ ++SRC = src ++CFILES = $(SRC)/image_DXT.c $(SRC)/image_helper.c $(SRC)/SOIL.c $(SRC)/stb_image_aug.c ++OFILES = $(CFILES:.c=.o) ++LIBNAME = libSOIL ++VERSION = 1.07-20071110 ++MAJOR = 1 ++ ++HFILES = $(SRC)/SOIL.h $(SRC)/image_DXT.h $(SRC)/image_helper.h \ ++ $(SRC)/stbi_DDS_aug.h $(SRC)/stbi_DDS_aug_c.h $(SRC)/stb_image_aug.h ++AFILE = libSOIL.a ++INCLUDEDIR = /usr/include/SOIL ++LIBDIR = /usr/lib ++ ++all: $(OFILES) lib ++ ++%.o: %.c ++ $(CC) $(CFLAGS) $< -o $@ ++ ++lib: $(OFILES) ++ # create static library ++ $(AR) -cvq $(LIBNAME).a $(OFILES) ++ ++install: ++ $(INSTALL_DIR) $(DESTDIR)/$(INCLUDEDIR) ++ $(INSTALL_FILE) $(HFILES) $(DESTDIR)/$(INCLUDEDIR) ++ $(INSTALL_DIR) $(DESTDIR)/$(LIBDIR) ++ $(INSTALL_FILE) $(AFILE) $(DESTDIR)/$(LIBDIR) ++ ++clean: ++ $(RM) *.o ++ $(RM) *~ ++ ++distclean: ++ $(RM) $(AFILE) $(SOFILE) ++ ++.PHONY: all lib clean distclean diff --git a/packages/graphics/tiff/package.mk b/packages/graphics/tiff/package.mk index 782f35e3229..23d5c0ee2e9 100644 --- a/packages/graphics/tiff/package.mk +++ b/packages/graphics/tiff/package.mk @@ -37,6 +37,7 @@ PKG_CONFIGURE_OPTS_TARGET="--enable-static \ --disable-shared \ --disable-mdi \ --enable-cxx \ + --with-gl=no \ --with-jpeg-lib-dir=$SYSROOT_PREFIX/usr/lib \ --with-jpeg-include-dir=$SYSROOT_PREFIX/usr/include \ --without-x" diff --git a/packages/graphics/vsxu/package.mk b/packages/graphics/vsxu/package.mk index 1a0c2b0d716..6c5842c558b 100644 --- a/packages/graphics/vsxu/package.mk +++ b/packages/graphics/vsxu/package.mk @@ -19,12 +19,12 @@ PKG_NAME="vsxu" PKG_VERSION="0.5.1" PKG_REV="1" -PKG_ARCH="any" +PKG_ARCH="i386 x86_64" PKG_LICENSE="GPL" PKG_SITE="http://www.vsxu.com" # repackaged from https://github.com/vovoid/vsxu/archive/$PKG_VERSION.tar.gz PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.gz" -PKG_DEPENDS_TARGET="toolchain glew glfw" +PKG_DEPENDS_TARGET="toolchain $OPENGL libX11 glew glfw zlib libpng libjpeg-turbo freetype" PKG_PRIORITY="optional" PKG_SECTION="multimedia" PKG_SHORTDESC="vsxu:" @@ -33,6 +33,8 @@ PKG_LONGDESC="vsxu:" PKG_IS_ADDON="no" PKG_AUTORECONF="no" +export LDFLAGS="$LDFLAGS -lX11" + configure_target() { cmake -DCMAKE_TOOLCHAIN_FILE=$CMAKE_CONF \ -DCMAKE_INSTALL_PREFIX=/usr \ diff --git a/packages/lang/Python/package.mk b/packages/lang/Python/package.mk index 55f1d1cb500..bc5e35cf8d1 100644 --- a/packages/lang/Python/package.mk +++ b/packages/lang/Python/package.mk @@ -23,7 +23,7 @@ PKG_ARCH="any" PKG_LICENSE="OSS" PKG_SITE="http://www.python.org/" PKG_URL="http://www.python.org/ftp/python/$PKG_VERSION/$PKG_NAME-$PKG_VERSION.tar.xz" -PKG_DEPENDS_HOST="zlib:host" +PKG_DEPENDS_HOST="zlib:host bzip2:host" PKG_DEPENDS_TARGET="toolchain sqlite expat zlib bzip2 libressl libffi Python:host" PKG_PRIORITY="optional" PKG_SECTION="lang" @@ -33,7 +33,7 @@ PKG_LONGDESC="Python is an interpreted object-oriented programming language, and PKG_IS_ADDON="no" PKG_AUTORECONF="yes" -PY_DISABLED_MODULES="readline _curses _curses_panel _tkinter nis gdbm bsddb ossaudiodev" +PY_DISABLED_MODULES="_tkinter nis gdbm bsddb ossaudiodev" PKG_CONFIGURE_OPTS_HOST="--cache-file=config.cache \ --without-cxx-main \ @@ -75,7 +75,7 @@ post_patch() { make_host() { make PYTHON_MODULES_INCLUDE="$HOST_INCDIR" \ PYTHON_MODULES_LIB="$HOST_LIBDIR" \ - PYTHON_DISABLE_MODULES="$PY_DISABLED_MODULES" + PYTHON_DISABLE_MODULES="readline _curses _curses_panel $PY_DISABLED_MODULES" # python distutils per default adds -L$LIBDIR when linking binary extensions sed -e "s|^ 'LIBDIR':.*| 'LIBDIR': '/usr/lib',|g" -i $(cat pybuilddir.txt)/_sysconfigdata.py @@ -84,7 +84,7 @@ make_host() { makeinstall_host() { make PYTHON_MODULES_INCLUDE="$HOST_INCDIR" \ PYTHON_MODULES_LIB="$HOST_LIBDIR" \ - PYTHON_DISABLE_MODULES="$PY_DISABLED_MODULES" \ + PYTHON_DISABLE_MODULES="readline _curses _curses_panel $PY_DISABLED_MODULES" \ install } @@ -116,18 +116,23 @@ makeinstall_target() { } post_makeinstall_target() { - EXCLUDE_DIRS="bsddb curses idlelib lib-tk lib2to3 msilib pydoc_data test unittest" + EXCLUDE_DIRS="bsddb idlelib lib-tk lib2to3 msilib pydoc_data test unittest" for dir in $EXCLUDE_DIRS; do rm -rf $INSTALL/usr/lib/python*/$dir done - python -Wi -t -B ../Lib/compileall.py $INSTALL/usr/lib/python*/ -f - rm -rf `find $INSTALL/usr/lib/python*/ -name "*.py"` - rm -rf $INSTALL/usr/lib/python*/config rm -rf $INSTALL/usr/bin/2to3 rm -rf $INSTALL/usr/bin/idle rm -rf $INSTALL/usr/bin/pydoc rm -rf $INSTALL/usr/bin/smtpd.py rm -rf $INSTALL/usr/bin/python*-config + + cd $INSTALL/usr/lib/python2.7 + python -Wi -t -B $ROOT/$PKG_BUILD/Lib/compileall.py -d /usr/lib/python2.7 -f . + find $INSTALL/usr/lib/python2.7 -name "*.py" -exec rm -f {} \; &>/dev/null + + # strip + chmod u+w $INSTALL/usr/lib/libpython*.so.* + debug_strip $INSTALL/usr } diff --git a/packages/lang/Python/patches/Python-2.7.11-017-link-curses-module-against-termcap.patch b/packages/lang/Python/patches/Python-2.7.11-017-link-curses-module-against-termcap.patch new file mode 100644 index 00000000000..4d67f9c96c1 --- /dev/null +++ b/packages/lang/Python/patches/Python-2.7.11-017-link-curses-module-against-termcap.patch @@ -0,0 +1,241 @@ +diff -Naur a/Modules/_cursesmodule.c b/Modules/_cursesmodule.c +--- a/Modules/_cursesmodule.c 2015-12-05 11:47:13.000000000 -0800 ++++ b/Modules/_cursesmodule.c 2016-04-29 01:22:41.271608696 -0700 +@@ -312,7 +312,6 @@ + Window_NoArgNoReturnVoidFunction(wclear) + + Window_OneArgNoReturnVoidFunction(idcok, int, "i;True(1) or False(0)") +-Window_OneArgNoReturnVoidFunction(immedok, int, "i;True(1) or False(0)") + Window_OneArgNoReturnVoidFunction(wtimeout, int, "i;delay") + + Window_NoArg2TupleReturnFunction(getyx, int, "ii") +@@ -336,7 +335,6 @@ + Window_OneArgNoReturnFunction(notimeout, int, "i;True(1) or False(0)") + Window_OneArgNoReturnFunction(scrollok, int, "i;True(1) or False(0)") + Window_OneArgNoReturnFunction(winsdelln, int, "i;nlines") +-Window_OneArgNoReturnFunction(syncok, int, "i;True(1) or False(0)") + + Window_TwoArgNoReturnFunction(mvwin, int, "ii;y,x") + Window_TwoArgNoReturnFunction(mvderwin, int, "ii;y,x") +@@ -1580,7 +1578,6 @@ + {"hline", (PyCFunction)PyCursesWindow_Hline, METH_VARARGS}, + {"idcok", (PyCFunction)PyCursesWindow_idcok, METH_VARARGS}, + {"idlok", (PyCFunction)PyCursesWindow_idlok, METH_VARARGS}, +- {"immedok", (PyCFunction)PyCursesWindow_immedok, METH_VARARGS}, + {"inch", (PyCFunction)PyCursesWindow_InCh, METH_VARARGS}, + {"insch", (PyCFunction)PyCursesWindow_InsCh, METH_VARARGS}, + {"insdelln", (PyCFunction)PyCursesWindow_winsdelln, METH_VARARGS}, +@@ -1618,7 +1615,6 @@ + {"subpad", (PyCFunction)PyCursesWindow_SubWin, METH_VARARGS}, + {"subwin", (PyCFunction)PyCursesWindow_SubWin, METH_VARARGS}, + {"syncdown", (PyCFunction)PyCursesWindow_wsyncdown, METH_NOARGS}, +- {"syncok", (PyCFunction)PyCursesWindow_syncok, METH_VARARGS}, + {"syncup", (PyCFunction)PyCursesWindow_wsyncup, METH_NOARGS}, + {"timeout", (PyCFunction)PyCursesWindow_wtimeout, METH_VARARGS}, + {"touchline", (PyCFunction)PyCursesWindow_TouchLine, METH_VARARGS}, +@@ -1693,16 +1689,6 @@ + NoArgNoReturnVoidFunction(noqiflush) + + static PyObject * +-PyCurses_filter(PyObject *self) +-{ +- /* not checking for PyCursesInitialised here since filter() must +- be called before initscr() */ +- filter(); +- Py_INCREF(Py_None); +- return Py_None; +-} +- +-static PyObject * + PyCurses_Color_Content(PyObject *self, PyObject *args) + { + short color,r,g,b; +@@ -1772,19 +1758,6 @@ + return PyString_FromStringAndSize(&ch, 1); + } + +-static PyObject * +-PyCurses_getsyx(PyObject *self) +-{ +- int x = 0; +- int y = 0; +- +- PyCursesInitialised; +- +- getsyx(y, x); +- +- return Py_BuildValue("(ii)", y, x); +-} +- + #ifdef NCURSES_MOUSE_VERSION + static PyObject * + PyCurses_GetMouse(PyObject *self) +@@ -1855,25 +1828,6 @@ + return PyCursesCheckERR(halfdelay(tenths), "halfdelay"); + } + +-#ifndef STRICT_SYSV_CURSES +-/* No has_key! */ +-static PyObject * PyCurses_has_key(PyObject *self, PyObject *args) +-{ +- int ch; +- +- PyCursesInitialised; +- +- if (!PyArg_ParseTuple(args,"i",&ch)) return NULL; +- +- if (has_key(ch) == FALSE) { +- Py_INCREF(Py_False); +- return Py_False; +- } +- Py_INCREF(Py_True); +- return Py_True; +-} +-#endif /* STRICT_SYSV_CURSES */ +- + static PyObject * + PyCurses_Init_Color(PyObject *self, PyObject *args) + { +@@ -2426,26 +2380,6 @@ + #endif /* HAVE_CURSES_RESIZE_TERM */ + + static PyObject * +-PyCurses_setsyx(PyObject *self, PyObject *args) +-{ +- int y,x; +- +- PyCursesInitialised; +- +- if (PyTuple_Size(args)!=2) { +- PyErr_SetString(PyExc_TypeError, "setsyx requires 2 arguments"); +- return NULL; +- } +- +- if (!PyArg_ParseTuple(args, "ii;y, x", &y, &x)) return NULL; +- +- setsyx(y,x); +- +- Py_INCREF(Py_None); +- return Py_None; +-} +- +-static PyObject * + PyCurses_Start_Color(PyObject *self) + { + int code; +@@ -2539,18 +2473,6 @@ + } + + static PyObject * +-PyCurses_TypeAhead(PyObject *self, PyObject *args) +-{ +- int fd; +- +- PyCursesInitialised; +- +- if (!PyArg_ParseTuple(args,"i;fd",&fd)) return NULL; +- +- return PyCursesCheckERR(typeahead( fd ), "typeahead"); +-} +- +-static PyObject * + PyCurses_UnCtrl(PyObject *self, PyObject *args) + { + PyObject *temp; +@@ -2594,25 +2516,6 @@ + return PyCursesCheckERR(ungetch(ch), "ungetch"); + } + +-static PyObject * +-PyCurses_Use_Env(PyObject *self, PyObject *args) +-{ +- int flag; +- +- switch(PyTuple_Size(args)) { +- case 1: +- if (!PyArg_ParseTuple(args,"i;True(1), False(0)",&flag)) +- return NULL; +- break; +- default: +- PyErr_SetString(PyExc_TypeError, "use_env requires 1 argument"); +- return NULL; +- } +- use_env(flag); +- Py_INCREF(Py_None); +- return Py_None; +-} +- + #ifndef STRICT_SYSV_CURSES + static PyObject * + PyCurses_Use_Default_Colors(PyObject *self) +@@ -2650,21 +2553,16 @@ + {"echo", (PyCFunction)PyCurses_echo, METH_VARARGS}, + {"endwin", (PyCFunction)PyCurses_endwin, METH_NOARGS}, + {"erasechar", (PyCFunction)PyCurses_EraseChar, METH_NOARGS}, +- {"filter", (PyCFunction)PyCurses_filter, METH_NOARGS}, + {"flash", (PyCFunction)PyCurses_flash, METH_NOARGS}, + {"flushinp", (PyCFunction)PyCurses_flushinp, METH_NOARGS}, + #ifdef NCURSES_MOUSE_VERSION + {"getmouse", (PyCFunction)PyCurses_GetMouse, METH_NOARGS}, + {"ungetmouse", (PyCFunction)PyCurses_UngetMouse, METH_VARARGS}, + #endif +- {"getsyx", (PyCFunction)PyCurses_getsyx, METH_NOARGS}, + {"getwin", (PyCFunction)PyCurses_GetWin, METH_O}, + {"has_colors", (PyCFunction)PyCurses_has_colors, METH_NOARGS}, + {"has_ic", (PyCFunction)PyCurses_has_ic, METH_NOARGS}, + {"has_il", (PyCFunction)PyCurses_has_il, METH_NOARGS}, +-#ifndef STRICT_SYSV_CURSES +- {"has_key", (PyCFunction)PyCurses_has_key, METH_VARARGS}, +-#endif + {"halfdelay", (PyCFunction)PyCurses_HalfDelay, METH_VARARGS}, + {"init_color", (PyCFunction)PyCurses_Init_Color, METH_VARARGS}, + {"init_pair", (PyCFunction)PyCurses_Init_Pair, METH_VARARGS}, +@@ -2708,7 +2606,6 @@ + {"resize_term", (PyCFunction)PyCurses_Resize_Term, METH_VARARGS}, + #endif + {"savetty", (PyCFunction)PyCurses_savetty, METH_NOARGS}, +- {"setsyx", (PyCFunction)PyCurses_setsyx, METH_VARARGS}, + {"setupterm", (PyCFunction)PyCurses_setupterm, + METH_VARARGS|METH_KEYWORDS}, + {"start_color", (PyCFunction)PyCurses_Start_Color, METH_NOARGS}, +@@ -2718,10 +2615,8 @@ + {"tigetnum", (PyCFunction)PyCurses_tigetnum, METH_VARARGS}, + {"tigetstr", (PyCFunction)PyCurses_tigetstr, METH_VARARGS}, + {"tparm", (PyCFunction)PyCurses_tparm, METH_VARARGS}, +- {"typeahead", (PyCFunction)PyCurses_TypeAhead, METH_VARARGS}, + {"unctrl", (PyCFunction)PyCurses_UnCtrl, METH_VARARGS}, + {"ungetch", (PyCFunction)PyCurses_UngetCh, METH_VARARGS}, +- {"use_env", (PyCFunction)PyCurses_Use_Env, METH_VARARGS}, + #ifndef STRICT_SYSV_CURSES + {"use_default_colors", (PyCFunction)PyCurses_Use_Default_Colors, METH_NOARGS}, + #endif +diff -Naur a/setup.py b/setup.py +--- a/setup.py 2016-04-28 13:18:03.397008583 -0700 ++++ b/setup.py 2016-04-28 13:28:04.595779984 -0700 +@@ -766,7 +766,7 @@ + else: + readline_extra_link_args = () + +- readline_libs = ['readline'] ++ readline_libs = ['readline', 'termcap'] + if readline_termcap_library: + pass # Issue 7384: Already linked against curses or tinfo. + elif curses_library: +@@ -1359,7 +1359,7 @@ + # Bug 1464056: If _curses.so links with ncursesw, + # _curses_panel.so must link with panelw. + panel_library = 'panelw' +- curses_libs = [curses_library] ++ curses_libs = [curses_library, 'termcap'] + curses_incs = find_file('curses.h', inc_dirs, + [os.path.join(d, 'ncursesw') for d in inc_dirs]) + exts.append( Extension('_curses', ['_cursesmodule.c'], +@@ -1373,7 +1373,7 @@ + elif (self.compiler.find_library_file(lib_dirs, 'termcap')): + curses_libs = ['curses', 'termcap'] + else: +- curses_libs = ['curses'] ++ curses_libs = ['curses', 'termcap'] + + exts.append( Extension('_curses', ['_cursesmodule.c'], + libraries = curses_libs) ) diff --git a/packages/lang/gcc-linaro-aarch64-none-elf/package.mk b/packages/lang/gcc-linaro-aarch64-none-elf/package.mk new file mode 100644 index 00000000000..800e11c0ce6 --- /dev/null +++ b/packages/lang/gcc-linaro-aarch64-none-elf/package.mk @@ -0,0 +1,43 @@ +################################################################################ +# This file is part of LibreELEC - https://libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see <http://www.gnu.org/licenses/>. +################################################################################ + +PKG_NAME="gcc-linaro-aarch64-none-elf" +PKG_VERSION="4.9-2014.11-x86_64" +PKG_REV="1" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="" +PKG_URL="https://releases.linaro.org/14.11/components/toolchain/binaries/aarch64-none-elf/gcc-linaro-${PKG_VERSION}_aarch64-elf.tar.xz" +PKG_SOURCE_DIR="gcc-linaro-${PKG_VERSION}_aarch64-elf" +PKG_DEPENDS_HOST="toolchain" +PKG_PRIORITY="optional" +PKG_SECTION="lang" +PKG_SHORTDESC="" +PKG_LONGDESC="" + +PKG_IS_ADDON="no" +PKG_AUTORECONF="no" + +make_host() { + : +} + +makeinstall_host() { + mkdir -p $ROOT/$TOOLCHAIN/lib/gcc-linaro-aarch64-none-elf/ + cp -a * $ROOT/$TOOLCHAIN/lib/gcc-linaro-aarch64-none-elf +} diff --git a/packages/lang/gcc/package.mk b/packages/lang/gcc/package.mk index 72b23d7048f..4b58261ba0d 100644 --- a/packages/lang/gcc/package.mk +++ b/packages/lang/gcc/package.mk @@ -110,6 +110,10 @@ PKG_CONFIGURE_OPTS_HOST="--target=$TARGET_NAME \ --enable-checking=release \ --with-default-libstdcxx-abi=gcc4-compatible" +pre_configure_host() { + export CXXFLAGS="$CXXFLAGS -std=gnu++98" +} + pre_configure_bootstrap() { setup_toolchain host } diff --git a/packages/lang/llvm/package.mk b/packages/lang/llvm/package.mk index 199641b4eee..eba122a34a1 100644 --- a/packages/lang/llvm/package.mk +++ b/packages/lang/llvm/package.mk @@ -17,13 +17,13 @@ ################################################################################ PKG_NAME="llvm" -PKG_VERSION="f65e46b" +PKG_VERSION="3.8.0" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://llvm.org/" -PKG_URL="$DISTRO_SRC/${PKG_NAME}-${PKG_VERSION}.tar.xz" -#PKG_SOURCE_DIR="${PKG_NAME}-${PKG_VERSION}.src" +PKG_URL="http://llvm.org/releases/$PKG_VERSION/${PKG_NAME}-${PKG_VERSION}.src.tar.xz" +PKG_SOURCE_DIR="${PKG_NAME}-${PKG_VERSION}.src" PKG_DEPENDS_HOST="" PKG_DEPENDS_TARGET="toolchain llvm:host" PKG_PRIORITY="optional" diff --git a/packages/linux-drivers/RTL8188EU/package.mk b/packages/linux-drivers/RTL8188EU/package.mk index b8f8472d553..d35a9c40eda 100644 --- a/packages/linux-drivers/RTL8188EU/package.mk +++ b/packages/linux-drivers/RTL8188EU/package.mk @@ -17,13 +17,14 @@ ################################################################################ PKG_NAME="RTL8188EU" -PKG_VERSION="3091828" +PKG_VERSION="ced2b64" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" # realtek: PKG_SITE="http://www.realtek.com.tw/downloads/downloadsView.aspx?Langid=1&PFid=48&Level=5&Conn=4&ProdID=274&DownTypeID=3&GetDown=false&Downloads=true" PKG_SITE="https://github.com/lwfinger/rtl8188eu" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_URL="https://github.com/lwfinger/rtl8188eu/archive/$PKG_VERSION.tar.gz" +PKG_SOURCE_DIR="rtl8188eu-$PKG_VERSION*" PKG_DEPENDS_TARGET="toolchain linux" PKG_NEED_UNPACK="$LINUX_DEPENDS" PKG_PRIORITY="optional" diff --git a/packages/linux-drivers/RTL8192CU/patches/RTL8192CU-kernel-4.6.patch b/packages/linux-drivers/RTL8192CU/patches/RTL8192CU-kernel-4.6.patch new file mode 100644 index 00000000000..b6947605f89 --- /dev/null +++ b/packages/linux-drivers/RTL8192CU/patches/RTL8192CU-kernel-4.6.patch @@ -0,0 +1,17 @@ +diff -Naur a/os_dep/linux/os_intfs.c b/os_dep/linux/os_intfs.c +--- a/os_dep/linux/os_intfs.c 2016-04-19 11:17:44.465411644 -0700 ++++ b/os_dep/linux/os_intfs.c 2016-04-19 11:23:24.742014169 -0700 +@@ -958,7 +958,13 @@ + return dscp >> 5; + } + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,6,0) ++static u16 rtw_select_queue(struct net_device *dev, struct sk_buff *skb, ++ void *accel_priv, ++ select_queue_fallback_t fallback) ++#else + static u16 rtw_select_queue(struct net_device *dev, struct sk_buff *skb) ++#endif + { + _adapter *padapter = rtw_netdev_priv(dev); + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; diff --git a/packages/linux-drivers/RTL8192DU/package.mk b/packages/linux-drivers/RTL8192DU/package.mk index 06a21276d30..de41b927767 100644 --- a/packages/linux-drivers/RTL8192DU/package.mk +++ b/packages/linux-drivers/RTL8192DU/package.mk @@ -17,12 +17,13 @@ ################################################################################ PKG_NAME="RTL8192DU" -PKG_VERSION="7498302" +PKG_VERSION="9e7eb15" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="https://github.com/lwfinger/rtl8192du" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_URL="https://github.com/lwfinger/rtl8192du/archive/$PKG_VERSION.tar.gz" +PKG_SOURCE_DIR="rtl8192du-$PKG_VERSION*" PKG_DEPENDS_TARGET="toolchain linux" PKG_NEED_UNPACK="$LINUX_DEPENDS" PKG_PRIORITY="optional" diff --git a/packages/linux-drivers/RTL8192DU/patches/RTL8192DU-fix-build-kernel-4.2.patch b/packages/linux-drivers/RTL8192DU/patches/RTL8192DU-fix-build-kernel-4.2.patch deleted file mode 100644 index ab9010dfd27..00000000000 --- a/packages/linux-drivers/RTL8192DU/patches/RTL8192DU-fix-build-kernel-4.2.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 9e7eb15c74779150e7cc7229a06335a579366f2a Mon Sep 17 00:00:00 2001 -From: Larry Finger <Larry.Finger@lwfinger.net> -Date: Mon, 28 Sep 2015 19:55:49 -0500 -Subject: [PATCH] rtl8192du: Fix build on kernel 4.2 - -Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net> ---- - os_dep/ioctl_cfg80211.c | 9 +++++++-- - 1 file changed, 7 insertions(+), 2 deletions(-) - -diff --git a/os_dep/ioctl_cfg80211.c b/os_dep/ioctl_cfg80211.c -index a2bc7ed..7054e3a 100644 ---- a/os_dep/ioctl_cfg80211.c -+++ b/os_dep/ioctl_cfg80211.c -@@ -491,8 +491,13 @@ void rtw_cfg80211_indicate_disconnect(struct rtw_adapter *padapter) - WLAN_STATUS_UNSPECIFIED_FAILURE, - GFP_ATOMIC/*GFP_KERNEL*/); - } else { -- cfg80211_disconnected(padapter->pnetdev, 0, NULL, -- 0, GFP_ATOMIC); -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0) -+ cfg80211_disconnected(padapter->pnetdev, 0, -+ NULL, 0, true, GFP_ATOMIC); -+#else -+ cfg80211_disconnected(padapter->pnetdev, 0, NULL, 0, -+ GFP_ATOMIC); -+#endif - } - } - } diff --git a/packages/linux-drivers/RTL8192EU/package.mk b/packages/linux-drivers/RTL8192EU/package.mk index bb9bb614438..bc3c59fdb2a 100644 --- a/packages/linux-drivers/RTL8192EU/package.mk +++ b/packages/linux-drivers/RTL8192EU/package.mk @@ -17,12 +17,13 @@ ################################################################################ PKG_NAME="RTL8192EU" -PKG_VERSION="6793bae" +PKG_VERSION="a322c84" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="https://github.com/Mange/rtl8192eu-linux-driver" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_URL="https://github.com/Mange/rtl8192eu-linux-driver/archive/$PKG_VERSION.tar.gz" +PKG_SOURCE_DIR="rtl8192eu-linux-driver-$PKG_VERSION*" PKG_DEPENDS_TARGET="toolchain linux" PKG_NEED_UNPACK="$LINUX_DEPENDS" PKG_PRIORITY="optional" diff --git a/packages/linux-drivers/RTL8812AU/package.mk b/packages/linux-drivers/RTL8812AU/package.mk index a5a6582bcdb..cfd50b1f816 100644 --- a/packages/linux-drivers/RTL8812AU/package.mk +++ b/packages/linux-drivers/RTL8812AU/package.mk @@ -17,19 +17,19 @@ ################################################################################ PKG_NAME="RTL8812AU" -PKG_VERSION="3f015f0" +PKG_VERSION="928e27f" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" -PKG_SITE="git@github.com:abperiasamy/rtl8812AU_8821AU_linux.git" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_SITE="https://github.com/Grawp/rtl8812au_rtl8821au" +PKG_URL="https://github.com/Grawp/rtl8812au_rtl8821au/archive/$PKG_VERSION.tar.gz" +PKG_SOURCE_DIR="rtl8812au_rtl8821au-$PKG_VERSION*" PKG_DEPENDS_TARGET="toolchain linux" PKG_NEED_UNPACK="$LINUX_DEPENDS" PKG_PRIORITY="optional" PKG_SECTION="driver" PKG_SHORTDESC="Realtek RTL8812AU Linux 3.x driver" PKG_LONGDESC="Realtek RTL8812AU Linux 3.x driver" - PKG_IS_ADDON="no" PKG_AUTORECONF="no" diff --git a/packages/linux-drivers/RTL8812AU/patches/RTL8812AU-01-add_new_cards.patch b/packages/linux-drivers/RTL8812AU/patches/RTL8812AU-01-add_new_cards.patch index 5b0b492b72c..9ee48db1823 100644 --- a/packages/linux-drivers/RTL8812AU/patches/RTL8812AU-01-add_new_cards.patch +++ b/packages/linux-drivers/RTL8812AU/patches/RTL8812AU-01-add_new_cards.patch @@ -1,36 +1,30 @@ -diff -Naur RTL8812AU-3f015f0/os_dep/linux/usb_intf.c RTL8812AU-3f015f0.patch/os_dep/linux/usb_intf.c ---- RTL8812AU-3f015f0/os_dep/linux/usb_intf.c 2015-07-14 21:45:26.000000000 +0200 -+++ RTL8812AU-3f015f0.patch/os_dep/linux/usb_intf.c 2016-01-17 12:01:14.594776191 +0100 -@@ -278,7 +278,7 @@ - {USB_DEVICE(0x13B1, 0x003F),.driver_info = RTL8812}, /* Linksys - SerComm */ - {USB_DEVICE(0x2357, 0x0101),.driver_info = RTL8812}, /* TP-Link - T4U */ - {USB_DEVICE(0x148F, 0x9097),.driver_info = RTL8812}, /* Amped Wireless ACA1 */ -- {USB_DEVICE(0x2357, 0x0103),.driver_info = RTL8812}, /* TP-Link - T4UH */ -+ {USB_DEVICE(0x2357, 0x0103),.driver_info = RTL8812}, /* TP-Link - T4UH */ +diff -Naur RTL8812AU-928e27f/os_dep/linux/usb_intf.c RTL8812AU-928e27f.patch/os_dep/linux/usb_intf.c +--- RTL8812AU-928e27f/os_dep/linux/usb_intf.c 2016-02-07 14:05:49.000000000 +0100 ++++ RTL8812AU-928e27f.patch/os_dep/linux/usb_intf.c 2016-03-16 11:34:32.884119151 +0100 +@@ -167,6 +167,10 @@ + {USB_DEVICE(0x13b1, 0x003f),.driver_info = RTL8812}, /* Linksys - WUSB6300 */ + {USB_DEVICE(0x2357, 0x0101),.driver_info = RTL8812}, /* TP-Link - T4U */ + {USB_DEVICE(0x2357, 0x0103),.driver_info = RTL8812}, /* TP-Link - T4UH */ ++ /*=== Patched ID ===*/ ++ {USB_DEVICE(0x050D, 0x1109),.driver_info = RTL8812}, /* Belkin F9L1109 - SerComm */ ++ {USB_DEVICE(0x20F4, 0x805B),.driver_info = RTL8812}, /* TRENDnet - Cameo */ ++ {USB_DEVICE(0x148F, 0x9097),.driver_info = RTL8812}, /* Amped Wireless ACA1 */ #endif #ifdef CONFIG_RTL8821A -@@ -288,15 +288,19 @@ - {USB_DEVICE(USB_VENDER_ID_REALTEK, 0x8822),.driver_info = RTL8821},/* Default ID */ - {USB_DEVICE_AND_INTERFACE_INFO(USB_VENDER_ID_REALTEK, 0x0820,0xff,0xff,0xff),.driver_info = RTL8821}, /* 8821AU */ - /*=== Customer ID ===*/ -+ {USB_DEVICE(0x056e, 0x4007),.driver_info = RTL8821}, /* Elecom - WDC-433DU2HBK */ - {USB_DEVICE(0x7392, 0xA811),.driver_info = RTL8821}, /* Edimax - Edimax */ -- {USB_DEVICE(0x0BDA, 0xA811),.driver_info = RTL8821}, /* OUTLINK - Edimax */ -+ {USB_DEVICE(0x0BDA, 0xA811),.driver_info = RTL8821}, /* OUTLINK - Edimax */ - {USB_DEVICE(0x7392, 0xA812),.driver_info = RTL8821}, /* Edimax - Edimax */ -+ {USB_DEVICE(0x7392, 0xA813),.driver_info = RTL8821}, /* Edimax - EW-7811UAC */ - {USB_DEVICE(0x2001, 0x3314),.driver_info = RTL8821}, /* D-Link - Cameo */ - {USB_DEVICE(0x0846, 0x9052),.driver_info = RTL8821}, /* Netgear - A6100 */ -- {USB_DEVICE(0x04BB, 0x0953),.driver_info = RTL8821}, /* I-O DATA - Edimax */ -- {USB_DEVICE(0x2001, 0x3318),.driver_info = RTL8821}, /* D-Link - Cameo */ -- {USB_DEVICE(0x0E66, 0x0023),.driver_info = RTL8821}, /* HAWKING - Edimax */ -+ {USB_DEVICE(0x2019, 0xAB32),.driver_info = RTL8821}, /* Planex - GW-450S */ -+ {USB_DEVICE(0x04BB, 0x0953),.driver_info = RTL8821}, /* I-O DATA - Edimax */ -+ {USB_DEVICE(0x2001, 0x3318),.driver_info = RTL8821}, /* D-Link - Cameo */ -+ {USB_DEVICE(0x0E66, 0x0023),.driver_info = RTL8821}, /* HAWKING - Edimax */ - {USB_DEVICE(0x0411, 0x0242),.driver_info = RTL8821}, /* BUFFALO - Edimax */ -+ {USB_DEVICE(0x0411, 0x025D),.driver_info = RTL8821}, /* BUFFALO WI-U3-866D */ - {USB_DEVICE(0x2001, 0x3318),.driver_info = RTL8821}, /* D-Link DWA-172 */ +@@ -186,6 +190,15 @@ + {USB_DEVICE(0x056E, 0x400E) , .driver_info = RTL8821}, /* ELECOM - ELECOM */ + {USB_DEVICE(0x056E, 0x400F) , .driver_info = RTL8821}, /* ELECOM - ELECOM */ + {USB_DEVICE(0x0846, 0x9052),.driver_info = RTL8821}, /* Netgear - A6100 */ ++ /*=== Patched ID ===*/ ++ {USB_DEVICE(0x0BDA, 0xA811),.driver_info = RTL8821}, /* OUTLINK - Edimax */ ++ {USB_DEVICE(0x7392, 0xA812),.driver_info = RTL8821}, /* Edimax - Edimax */ ++ {USB_DEVICE(0x0411, 0x0242),.driver_info = RTL8821}, /* BUFFALO - Edimax */ ++ {USB_DEVICE(0x2001, 0x3318),.driver_info = RTL8821}, /* D-Link DWA-172 */ ++ {USB_DEVICE(0x056e, 0x4007),.driver_info = RTL8821}, /* Elecom - WDC-433DU2HBK */ ++ {USB_DEVICE(0x7392, 0xA813),.driver_info = RTL8821}, /* Edimax - EW-7811UAC */ ++ {USB_DEVICE(0x2019, 0xAB32),.driver_info = RTL8821}, /* Planex - GW-450S */ ++ {USB_DEVICE(0x0411, 0x025D),.driver_info = RTL8821}, /* BUFFALO WI-U3-866D */ #endif + #ifdef CONFIG_RTL8192E diff --git a/packages/linux-drivers/RTL8812AU/patches/RTL8812AU-gcc-5.patch b/packages/linux-drivers/RTL8812AU/patches/RTL8812AU-03-gcc-5.patch similarity index 100% rename from packages/linux-drivers/RTL8812AU/patches/RTL8812AU-gcc-5.patch rename to packages/linux-drivers/RTL8812AU/patches/RTL8812AU-03-gcc-5.patch diff --git a/packages/linux-drivers/RTL8812AU/patches/RTL8812AU-04-kernel-4.6.patch b/packages/linux-drivers/RTL8812AU/patches/RTL8812AU-04-kernel-4.6.patch new file mode 100644 index 00000000000..846a72b5782 --- /dev/null +++ b/packages/linux-drivers/RTL8812AU/patches/RTL8812AU-04-kernel-4.6.patch @@ -0,0 +1,30 @@ +diff -Naur a/os_dep/linux/ioctl_linux.c b/os_dep/linux/ioctl_linux.c +--- a/os_dep/linux/ioctl_linux.c 2016-02-07 05:05:49.000000000 -0800 ++++ b/os_dep/linux/ioctl_linux.c 2016-04-19 12:35:27.647180055 -0700 +@@ -13908,7 +13908,11 @@ + static int rtw_ioctl_wext_private(struct net_device *dev, struct ifreq *rq) + { + #ifdef CONFIG_COMPAT ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,6,0) ++ if(in_compat_syscall()) ++#else + if(is_compat_task()) ++#endif + return rtw_ioctl_compat_wext_private( dev, rq ); + else + #endif // CONFIG_COMPAT +diff -Naur a/os_dep/linux/rtw_android.c b/os_dep/linux/rtw_android.c +--- a/os_dep/linux/rtw_android.c 2016-02-07 05:05:49.000000000 -0800 ++++ b/os_dep/linux/rtw_android.c 2016-04-19 12:39:24.551833041 -0700 +@@ -577,7 +577,11 @@ + goto exit; + } + #ifdef CONFIG_COMPAT ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,6,0) ++ if (in_compat_syscall()) { ++#else + if (is_compat_task()) { ++#endif + /* User space is 32-bit, use compat ioctl */ + compat_android_wifi_priv_cmd compat_priv_cmd; + diff --git a/packages/linux-drivers/RTL8812AU/patches/RTL8812AU-05-fix-AP-timeout.patch b/packages/linux-drivers/RTL8812AU/patches/RTL8812AU-05-fix-AP-timeout.patch new file mode 100644 index 00000000000..089d4f25b8c --- /dev/null +++ b/packages/linux-drivers/RTL8812AU/patches/RTL8812AU-05-fix-AP-timeout.patch @@ -0,0 +1,23 @@ +From 4037784fc342dc81c71f7b950f4f5d94c0c21e5c Mon Sep 17 00:00:00 2001 +From: Sam Nazarko <email@samnazarko.co.uk> +Date: Tue, 8 Sep 2015 18:36:02 +0100 +Subject: [PATCH] Fix potential issue for timeout when connecting to an AP. + +Signed-off-by: Sam Nazarko <email@samnazarko.co.uk> +--- + include/rtw_mlme_ext.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/include/rtw_mlme_ext.h b/include/rtw_mlme_ext.h +index d1d5894..7dd78ad 100644 +--- a/include/rtw_mlme_ext.h ++++ b/include/rtw_mlme_ext.h +@@ -27,7 +27,7 @@ + // So, this driver tried to extend the dwell time for each scanning channel. + // This will increase the chance to receive the probe response from SoftAP. + +-#define SURVEY_TO (100) ++#define SURVEY_TO (0) + #define REAUTH_TO (300) //(50) + #define REASSOC_TO (300) //(50) + //#define DISCONNECT_TO (3000) diff --git a/packages/linux-drivers/RTL8812AU/patches/RTL8812AU-06-disable-power-saving.patch b/packages/linux-drivers/RTL8812AU/patches/RTL8812AU-06-disable-power-saving.patch new file mode 100644 index 00000000000..390637d4f25 --- /dev/null +++ b/packages/linux-drivers/RTL8812AU/patches/RTL8812AU-06-disable-power-saving.patch @@ -0,0 +1,23 @@ +From b68705a507c47dc2ff2cc6121830af315fbcdc83 Mon Sep 17 00:00:00 2001 +From: Sam Nazarko <email@samnazarko.co.uk> +Date: Sat, 11 Jul 2015 02:31:07 +0100 +Subject: [PATCH] Disable power saving by default + +Signed-off-by: Sam Nazarko <email@samnazarko.co.uk> +--- + Makefile | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/Makefile b/Makefile +index e97fbbf..7981e59 100644 +--- a/Makefile ++++ b/Makefile +@@ -36,7 +36,7 @@ CONFIG_SDIO_HCI = n + CONFIG_GSPI_HCI = n + + CONFIG_MP_INCLUDED = y +-CONFIG_POWER_SAVING = y ++CONFIG_POWER_SAVING = n + CONFIG_USB_AUTOSUSPEND = n + CONFIG_HW_PWRP_DETECTION = n + CONFIG_WIFI_TEST = n diff --git a/packages/linux-drivers/RTL8812AU/patches/RTL8812AU-fix-build-kernel-4.2.patch b/packages/linux-drivers/RTL8812AU/patches/RTL8812AU-fix-build-kernel-4.2.patch deleted file mode 100644 index 117f87c13a3..00000000000 --- a/packages/linux-drivers/RTL8812AU/patches/RTL8812AU-fix-build-kernel-4.2.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 0aa1823aa7e658422f49f558b8b82b03a32f0c30 Mon Sep 17 00:00:00 2001 -From: Jos Dehaes <jos.dehaes@gmail.com> -Date: Fri, 25 Sep 2015 23:11:57 +0200 -Subject: [PATCH] adapt to api in linux 4.2 - ---- - os_dep/linux/ioctl_cfg80211.c | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/os_dep/linux/ioctl_cfg80211.c b/os_dep/linux/ioctl_cfg80211.c -index 4946de3..6a751fd 100644 ---- a/os_dep/linux/ioctl_cfg80211.c -+++ b/os_dep/linux/ioctl_cfg80211.c -@@ -601,8 +601,12 @@ void rtw_cfg80211_indicate_disconnect(_adapter *padapter) - else if(pwdev->sme_state==CFG80211_SME_CONNECTED) - cfg80211_disconnected(padapter->pnetdev, 0, NULL, 0, GFP_ATOMIC); - #else -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,2,0) -+ cfg80211_disconnected(padapter->pnetdev, 0, NULL, 0, 0, GFP_ATOMIC); -+#else - cfg80211_disconnected(padapter->pnetdev, 0, NULL, 0, GFP_ATOMIC); - #endif -+#endif - - //DBG_8192C("pwdev->sme_state(a)=%d\n", pwdev->sme_state); - } diff --git a/packages/linux-drivers/vboxguest/package.mk b/packages/linux-drivers/vboxguest/package.mk new file mode 100644 index 00000000000..213056b082f --- /dev/null +++ b/packages/linux-drivers/vboxguest/package.mk @@ -0,0 +1,47 @@ +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) +# +# OpenELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# OpenELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with OpenELEC. If not, see <http://www.gnu.org/licenses/>. +################################################################################ + +PKG_NAME="vboxguest" +PKG_VERSION="5.0.20" +PKG_REV="1" +PKG_ARCH="x86_64" +PKG_LICENSE="GPL" +PKG_SITE="http://www.virtualbox.org" +PKG_DEPENDS_TARGET="toolchain linux xf86-video-virtualbox" +PKG_NEED_UNPACK="$LINUX_DEPENDS" +PKG_PRIORITY="optional" +PKG_SECTION="driver" +PKG_SHORTDESC="vboxguest" +PKG_LONGDESC="vboxguest" + +PKG_IS_ADDON="no" +PKG_AUTORECONF="no" + +pre_make_target() { + unset LDFLAGS +} + +make_target() { + cd $(get_build_dir xf86-video-virtualbox)/src/${PKG_NAME}-${PKG_VERSION}/ + make KERN_DIR=$(kernel_path) +} + +makeinstall_target() { + mkdir -p $INSTALL/lib/modules/$(get_module_dir)/$PKG_NAME + cp *.ko $INSTALL/lib/modules/$(get_module_dir)/$PKG_NAME +} diff --git a/packages/linux-firmware/brcmfmac_sdio-firmware-aml/system.d/brcmfmac_sdio-firmware@.service b/packages/linux-firmware/brcmfmac_sdio-firmware-aml/system.d/brcmfmac_sdio-firmware@.service index 2c84c734e96..93f33228ea1 100644 --- a/packages/linux-firmware/brcmfmac_sdio-firmware-aml/system.d/brcmfmac_sdio-firmware@.service +++ b/packages/linux-firmware/brcmfmac_sdio-firmware-aml/system.d/brcmfmac_sdio-firmware@.service @@ -5,4 +5,4 @@ ConditionPathExists=/dev/ttyS1 [Service] Type=simple RemainAfterExit=yes -ExecStart=/usr/bin/brcm_patchram_plus --patchram /lib/firmware/brcm/%I.hcd --baudrate 3000000 --use_baudrate_for_download /dev/ttyS1 --enable_hci --no2bytes --tosleep=50000 +ExecStart=/usr/bin/brcm_patchram_plus --patchram /lib/firmware/brcm/%I.hcd --baudrate 2000000 --use_baudrate_for_download /dev/ttyS1 --enable_hci --no2bytes --tosleep=50000 diff --git a/packages/linux-firmware/brcmfmac_sdio-firmware-aml/udev.d/80-brcmfmac_sdio.rules b/packages/linux-firmware/brcmfmac_sdio-firmware-aml/udev.d/80-brcmfmac_sdio.rules index 7059847cfc3..2f8fcdaa0a3 100644 --- a/packages/linux-firmware/brcmfmac_sdio-firmware-aml/udev.d/80-brcmfmac_sdio.rules +++ b/packages/linux-firmware/brcmfmac_sdio-firmware-aml/udev.d/80-brcmfmac_sdio.rules @@ -4,12 +4,17 @@ ACTION!="add", GOTO="end" SUBSYSTEMS=="sdio", ATTRS{vendor}=="0x02d0", ATTRS{device}=="0xa962", GOTO="begin" +SUBSYSTEMS=="sdio", ATTRS{vendor}=="0x02d0", ATTRS{device}=="0x4330", GOTO="begin" GOTO="end" LABEL="begin" ### Broadcom bcm43362/bcm20710a1 bluetooth device ATTRS{vendor}=="0x02d0", ATTRS{device}=="0xa962", \ ENV{brcm_device}="bcm20710a1" -ENV{brcm_device}=="bcm20*", ACTION=="add", \ +### Broadcom bcm4330/bcm40183b2 bluetooth device +ATTRS{vendor}=="0x02d0", ATTRS{device}=="0x4330", \ + ENV{brcm_device}="bcm40183b2" + +ENV{brcm_device}=="bcm*", ACTION=="add", \ TAG+="systemd", ENV{SYSTEMD_WANTS}+="brcmfmac_sdio-firmware@$env{brcm_device}.service" LABEL="end" diff --git a/packages/addons/repository/repository.unofficial.addon.pro/package.mk b/packages/linux-firmware/cpu-firmware/package.mk similarity index 60% rename from packages/addons/repository/repository.unofficial.addon.pro/package.mk rename to packages/linux-firmware/cpu-firmware/package.mk index 87a6e4ba0c9..5fde7988bbf 100644 --- a/packages/addons/repository/repository.unofficial.addon.pro/package.mk +++ b/packages/linux-firmware/cpu-firmware/package.mk @@ -16,40 +16,40 @@ # along with OpenELEC. If not, see <http://www.gnu.org/licenses/>. ################################################################################ -PKG_NAME="repository.unofficial.addon.pro" -PKG_VERSION="7.0" +PKG_NAME="cpu-firmware" +PKG_VERSION="5e23731" PKG_REV="1" -PKG_ARCH="any" -PKG_LICENSE="GPL" -PKG_SITE="http://unofficial.addon.pro" -PKG_URL="" -PKG_DEPENDS_TARGET="" +PKG_ARCH="i386 x86_64" +PKG_LICENSE="other" +PKG_SITE="https://git.fedorahosted.org/cgit/microcode_ctl.git" +PKG_URL="https://git.fedorahosted.org/cgit/microcode_ctl.git/snapshot/$PKG_VERSION.tar.xz" +PKG_SOURCE_DIR="$PKG_VERSION" +PKG_DEPENDS_INIT="toolchain" +PKG_DEPENDS_TARGET="toolchain" PKG_PRIORITY="optional" -PKG_SECTION="" -PKG_SHORTDESC="Unfficial OpenELEC.tv Add-on Repository" -PKG_LONGDESC="Unfficial OpenELEC.tv Add-on Repository" - -PKG_IS_ADDON="yes" -PKG_ADDON_TYPE="xbmc.addon.repository" -PKG_ADDON_PROVIDES="" +PKG_SECTION="linux-firmware" +PKG_SHORTDESC="cpu-microcode: Intel and AMD CPU microcodes" +PKG_LONGDESC="cpu-microcode: Intel and AMD CPU microcodes" +PKG_IS_ADDON="no" PKG_AUTORECONF="no" -PKG_MAINTAINER="unofficial.addon.pro" +make_init() { + PREFIX=/ + MICDIR=/lib/firmware + make +} -make_target() { - $SED -e "s|@PROJECT@|$PROJECT|g" \ - -e "s|@ARCH@|$TARGET_ARCH|g" \ - -e "s|@PKG_VERSION@|$PKG_VERSION|g" \ - -e "s|@PKG_REV@|$PKG_REV|g"\ - -i addon.xml +makeinstall_init() { + DESTDIR=$INSTALL make install } -makeinstall_target() { - : # nop +make_target() { + PREFIX=/ + MICDIR=/lib/firmware + make } -addon() { - mkdir -p $ADDON_BUILD/$PKG_ADDON_ID - cp -R $PKG_BUILD/* $ADDON_BUILD/$PKG_ADDON_ID +makeinstall_target() { + DESTDIR=$INSTALL make install } diff --git a/packages/linux-firmware/cpu-firmware/patches/cpu-firmware-0001-fix-makefile.patch b/packages/linux-firmware/cpu-firmware/patches/cpu-firmware-0001-fix-makefile.patch new file mode 100644 index 00000000000..0e797e0c643 --- /dev/null +++ b/packages/linux-firmware/cpu-firmware/patches/cpu-firmware-0001-fix-makefile.patch @@ -0,0 +1,66 @@ +diff -Naur a/Makefile b/Makefile +--- a/Makefile 2016-01-12 07:14:57.000000000 -0800 ++++ b/Makefile 2016-03-19 13:59:39.937499052 -0700 +@@ -14,34 +14,25 @@ + MICROCODE_AMD = amd-ucode-2012-09-10.tar + + INS = install +-CC = gcc +-KERNELHEADER = /usr/src/linux/include ++CC ?= gcc ++KERNELHEADER ?= /usr/src/linux/include + CFLAGS = -g -Wall -O2 -I $(KERNELHEADER) + +-DESTDIR = +-PREFIX = /usr/local ++DESTDIR ?= ++PREFIX ?= /usr/local + + INSDIR = $(PREFIX)/sbin + MANDIR = $(PREFIX)/share/man/man8 + DOCDIR = $(PREFIX)/share/doc/microcode_ctl +-MICDIR = /lib/firmware ++MICDIR ?= /lib/firmware + MICDIRAMD = $(MICDIR)/amd-ucode + +-RCFILE = microcode_ctl.start +-RCFILEFINAL = microcode_ctl +-# this is a bit nasty... +-RCDIR = $(shell if [ -d /etc/init.d ]; then echo "/etc"; else echo "/etc/rc.d"; fi) +-RCHOMEDIR = init.d +-RCFILETO = $(RCDIR)/$(RCHOMEDIR) +- + all: microcode_ctl + +-microcode_ctl: microcode_ctl.c +- $(CC) $(CFLAGS) -o $(PROGRAM) microcode_ctl.c +- mkdir intel-ucode amd-ucode ++microcode_ctl: ++ mkdir -p intel-ucode amd-ucode + tar xfz $(MICROCODE_INTEL) -C intel-ucode + tar --strip-components 1 -xf $(MICROCODE_AMD) -C amd-ucode +- echo "$(RCDIR)/$(RCHOMEDIR)/microcode_ctl" > microcode-filelist + + clean: + rm -rf $(PROGRAM) intel-ucode amd-ucode +@@ -50,20 +41,9 @@ + $(INS) -d $(DESTDIR)$(INSDIR) $(DESTDIR)$(MICDIRAMD) \ + $(DESTDIR)$(MANDIR) $(DESTDIR)$(RCFILETO) \ + $(DESTDIR)$(RCLINKTO) $(DESTDIR)$(DOCDIR) +- $(INS) -m 755 $(PROGRAM) $(DESTDIR)$(INSDIR) +- $(INS) -m 644 $(MANPAGE) $(DESTDIR)$(MANDIR) +- gzip -9f $(DESTDIR)$(MANDIR)/$(MANPAGE) +- $(INS) -m 755 $(RCFILE) $(DESTDIR)$(RCFILETO)/$(RCFILEFINAL) + $(INS) -m 644 intel-ucode/microcode.dat $(DESTDIR)$(MICDIR) + $(INS) -m 644 amd-ucode/microcode_amd.bin $(DESTDIR)$(MICDIR)/amd-ucode/ + $(INS) -m 644 amd-ucode/microcode_amd_fam15h.bin $(DESTDIR)$(MICDIR)/amd-ucode/ +- $(INS) -m 644 amd-ucode/microcode_amd.bin.README \ +- $(DESTDIR)$(DOCDIR)/README.microcode_amd.bin +- $(INS) -m 644 amd-ucode/microcode_amd_fam15h.bin.README \ +- $(DESTDIR)$(DOCDIR)/README.microcode_amd_fam15h.bin +- $(INS) -m 644 amd-ucode/LICENSE $(DESTDIR)$(DOCDIR)/LICENSE.microcode_amd +- $(INS) -m 644 amd-ucode/README $(DESTDIR)$(DOCDIR)/README.microcode_amd +- $(INS) -m 644 amd-ucode/INSTALL $(DESTDIR)$(DOCDIR)/INSTALL.microcode_amd + + ifndef DESTDIR + chkconfig --add $(RCFILEFINAL) diff --git a/packages/linux-firmware/dvb-firmware/package.mk b/packages/linux-firmware/dvb-firmware/package.mk index bd9867cd77f..45fe1e1299c 100644 --- a/packages/linux-firmware/dvb-firmware/package.mk +++ b/packages/linux-firmware/dvb-firmware/package.mk @@ -17,12 +17,12 @@ ################################################################################ PKG_NAME="dvb-firmware" -PKG_VERSION="0.0.51" +PKG_VERSION="1.0.0" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="Free-to-use" -PKG_SITE="https://github.com/OpenELEC/dvb-firmware" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_SITE="https://github.com/LibreELEC/dvb-firmware" +PKG_URL="https://github.com/LibreELEC/dvb-firmware/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain" PKG_PRIORITY="optional" PKG_SECTION="firmware" diff --git a/packages/linux/firmware/amdgpu/carrizo_ce.bin b/packages/linux/firmware/amdgpu/carrizo_ce.bin index eb6e5650a1d..aed66c0c6ac 100644 Binary files a/packages/linux/firmware/amdgpu/carrizo_ce.bin and b/packages/linux/firmware/amdgpu/carrizo_ce.bin differ diff --git a/packages/linux/firmware/amdgpu/carrizo_me.bin b/packages/linux/firmware/amdgpu/carrizo_me.bin index 2a6b266374f..103cd471ab5 100644 Binary files a/packages/linux/firmware/amdgpu/carrizo_me.bin and b/packages/linux/firmware/amdgpu/carrizo_me.bin differ diff --git a/packages/linux/firmware/amdgpu/carrizo_mec.bin b/packages/linux/firmware/amdgpu/carrizo_mec.bin index 5697ce95658..2f8476f9d6c 100644 Binary files a/packages/linux/firmware/amdgpu/carrizo_mec.bin and b/packages/linux/firmware/amdgpu/carrizo_mec.bin differ diff --git a/packages/linux/firmware/amdgpu/carrizo_mec2.bin b/packages/linux/firmware/amdgpu/carrizo_mec2.bin index c467fc91a8c..2f8476f9d6c 100644 Binary files a/packages/linux/firmware/amdgpu/carrizo_mec2.bin and b/packages/linux/firmware/amdgpu/carrizo_mec2.bin differ diff --git a/packages/linux/firmware/amdgpu/carrizo_pfp.bin b/packages/linux/firmware/amdgpu/carrizo_pfp.bin index 4b1e02a8948..3f35714d88d 100644 Binary files a/packages/linux/firmware/amdgpu/carrizo_pfp.bin and b/packages/linux/firmware/amdgpu/carrizo_pfp.bin differ diff --git a/packages/linux/firmware/amdgpu/carrizo_rlc.bin b/packages/linux/firmware/amdgpu/carrizo_rlc.bin index ff25d37a6ff..ed85b15cb53 100644 Binary files a/packages/linux/firmware/amdgpu/carrizo_rlc.bin and b/packages/linux/firmware/amdgpu/carrizo_rlc.bin differ diff --git a/packages/linux/firmware/amdgpu/carrizo_sdma.bin b/packages/linux/firmware/amdgpu/carrizo_sdma.bin index 5c4be064f5f..12dc407b129 100644 Binary files a/packages/linux/firmware/amdgpu/carrizo_sdma.bin and b/packages/linux/firmware/amdgpu/carrizo_sdma.bin differ diff --git a/packages/linux/firmware/amdgpu/carrizo_sdma1.bin b/packages/linux/firmware/amdgpu/carrizo_sdma1.bin index 5c4be064f5f..12dc407b129 100644 Binary files a/packages/linux/firmware/amdgpu/carrizo_sdma1.bin and b/packages/linux/firmware/amdgpu/carrizo_sdma1.bin differ diff --git a/packages/linux/firmware/amdgpu/carrizo_uvd.bin b/packages/linux/firmware/amdgpu/carrizo_uvd.bin index 042f68138c7..387dbf8c37c 100644 Binary files a/packages/linux/firmware/amdgpu/carrizo_uvd.bin and b/packages/linux/firmware/amdgpu/carrizo_uvd.bin differ diff --git a/packages/linux/firmware/amdgpu/fiji_ce.bin b/packages/linux/firmware/amdgpu/fiji_ce.bin index 488cefcb9bd..3e551365bc8 100644 Binary files a/packages/linux/firmware/amdgpu/fiji_ce.bin and b/packages/linux/firmware/amdgpu/fiji_ce.bin differ diff --git a/packages/linux/firmware/amdgpu/fiji_me.bin b/packages/linux/firmware/amdgpu/fiji_me.bin index 9ed9c6c3360..8be8fe443fb 100644 Binary files a/packages/linux/firmware/amdgpu/fiji_me.bin and b/packages/linux/firmware/amdgpu/fiji_me.bin differ diff --git a/packages/linux/firmware/amdgpu/fiji_mec.bin b/packages/linux/firmware/amdgpu/fiji_mec.bin index f44754588d9..4686fa7ab56 100644 Binary files a/packages/linux/firmware/amdgpu/fiji_mec.bin and b/packages/linux/firmware/amdgpu/fiji_mec.bin differ diff --git a/packages/linux/firmware/amdgpu/fiji_mec2.bin b/packages/linux/firmware/amdgpu/fiji_mec2.bin index f44754588d9..4686fa7ab56 100644 Binary files a/packages/linux/firmware/amdgpu/fiji_mec2.bin and b/packages/linux/firmware/amdgpu/fiji_mec2.bin differ diff --git a/packages/linux/firmware/amdgpu/fiji_pfp.bin b/packages/linux/firmware/amdgpu/fiji_pfp.bin index 5b956cc0b9e..e35b96559a8 100644 Binary files a/packages/linux/firmware/amdgpu/fiji_pfp.bin and b/packages/linux/firmware/amdgpu/fiji_pfp.bin differ diff --git a/packages/linux/firmware/amdgpu/fiji_rlc.bin b/packages/linux/firmware/amdgpu/fiji_rlc.bin index 4cfc3406258..c8e55c1addd 100644 Binary files a/packages/linux/firmware/amdgpu/fiji_rlc.bin and b/packages/linux/firmware/amdgpu/fiji_rlc.bin differ diff --git a/packages/linux/firmware/amdgpu/fiji_sdma.bin b/packages/linux/firmware/amdgpu/fiji_sdma.bin index 2f15cee7a45..9a33b6e3873 100644 Binary files a/packages/linux/firmware/amdgpu/fiji_sdma.bin and b/packages/linux/firmware/amdgpu/fiji_sdma.bin differ diff --git a/packages/linux/firmware/amdgpu/fiji_sdma1.bin b/packages/linux/firmware/amdgpu/fiji_sdma1.bin index 999f1a9537d..411de845bf4 100644 Binary files a/packages/linux/firmware/amdgpu/fiji_sdma1.bin and b/packages/linux/firmware/amdgpu/fiji_sdma1.bin differ diff --git a/packages/linux/firmware/amdgpu/fiji_smc.bin b/packages/linux/firmware/amdgpu/fiji_smc.bin index fced50ded5c..86d656b110f 100644 Binary files a/packages/linux/firmware/amdgpu/fiji_smc.bin and b/packages/linux/firmware/amdgpu/fiji_smc.bin differ diff --git a/packages/linux/firmware/amdgpu/fiji_uvd.bin b/packages/linux/firmware/amdgpu/fiji_uvd.bin index e43dcd6d8f1..0ff4c5654ed 100644 Binary files a/packages/linux/firmware/amdgpu/fiji_uvd.bin and b/packages/linux/firmware/amdgpu/fiji_uvd.bin differ diff --git a/packages/linux/firmware/amdgpu/fiji_vce.bin b/packages/linux/firmware/amdgpu/fiji_vce.bin index d110da1dfb9..a45f4ee03e4 100644 Binary files a/packages/linux/firmware/amdgpu/fiji_vce.bin and b/packages/linux/firmware/amdgpu/fiji_vce.bin differ diff --git a/packages/linux/firmware/amdgpu/polaris10_ce.bin b/packages/linux/firmware/amdgpu/polaris10_ce.bin new file mode 100644 index 00000000000..08720105812 Binary files /dev/null and b/packages/linux/firmware/amdgpu/polaris10_ce.bin differ diff --git a/packages/linux/firmware/amdgpu/polaris10_mc.bin b/packages/linux/firmware/amdgpu/polaris10_mc.bin new file mode 100644 index 00000000000..d1c0cf5f25c Binary files /dev/null and b/packages/linux/firmware/amdgpu/polaris10_mc.bin differ diff --git a/packages/linux/firmware/amdgpu/polaris10_me.bin b/packages/linux/firmware/amdgpu/polaris10_me.bin new file mode 100644 index 00000000000..826aca1371e Binary files /dev/null and b/packages/linux/firmware/amdgpu/polaris10_me.bin differ diff --git a/packages/linux/firmware/amdgpu/polaris10_mec.bin b/packages/linux/firmware/amdgpu/polaris10_mec.bin new file mode 100644 index 00000000000..c1d2ca9bb5e Binary files /dev/null and b/packages/linux/firmware/amdgpu/polaris10_mec.bin differ diff --git a/packages/linux/firmware/amdgpu/polaris10_mec2.bin b/packages/linux/firmware/amdgpu/polaris10_mec2.bin new file mode 100644 index 00000000000..c1d2ca9bb5e Binary files /dev/null and b/packages/linux/firmware/amdgpu/polaris10_mec2.bin differ diff --git a/packages/linux/firmware/amdgpu/polaris10_pfp.bin b/packages/linux/firmware/amdgpu/polaris10_pfp.bin new file mode 100644 index 00000000000..85b9c91ddcf Binary files /dev/null and b/packages/linux/firmware/amdgpu/polaris10_pfp.bin differ diff --git a/packages/linux/firmware/amdgpu/polaris10_rlc.bin b/packages/linux/firmware/amdgpu/polaris10_rlc.bin new file mode 100644 index 00000000000..1addeb23883 Binary files /dev/null and b/packages/linux/firmware/amdgpu/polaris10_rlc.bin differ diff --git a/packages/linux/firmware/amdgpu/polaris10_sdma.bin b/packages/linux/firmware/amdgpu/polaris10_sdma.bin new file mode 100644 index 00000000000..ba0d5e64da9 Binary files /dev/null and b/packages/linux/firmware/amdgpu/polaris10_sdma.bin differ diff --git a/packages/linux/firmware/amdgpu/polaris10_sdma1.bin b/packages/linux/firmware/amdgpu/polaris10_sdma1.bin new file mode 100644 index 00000000000..45c656de766 Binary files /dev/null and b/packages/linux/firmware/amdgpu/polaris10_sdma1.bin differ diff --git a/packages/linux/firmware/amdgpu/polaris10_smc.bin b/packages/linux/firmware/amdgpu/polaris10_smc.bin new file mode 100644 index 00000000000..c4b545cf383 Binary files /dev/null and b/packages/linux/firmware/amdgpu/polaris10_smc.bin differ diff --git a/packages/linux/firmware/amdgpu/polaris10_smc_sk.bin b/packages/linux/firmware/amdgpu/polaris10_smc_sk.bin new file mode 100644 index 00000000000..7d7e1df565a Binary files /dev/null and b/packages/linux/firmware/amdgpu/polaris10_smc_sk.bin differ diff --git a/packages/linux/firmware/amdgpu/polaris10_uvd.bin b/packages/linux/firmware/amdgpu/polaris10_uvd.bin new file mode 100644 index 00000000000..2a84fa5db3d Binary files /dev/null and b/packages/linux/firmware/amdgpu/polaris10_uvd.bin differ diff --git a/packages/linux/firmware/amdgpu/polaris10_vce.bin b/packages/linux/firmware/amdgpu/polaris10_vce.bin new file mode 100644 index 00000000000..5f5d436c3c1 Binary files /dev/null and b/packages/linux/firmware/amdgpu/polaris10_vce.bin differ diff --git a/packages/linux/firmware/amdgpu/polaris11_ce.bin b/packages/linux/firmware/amdgpu/polaris11_ce.bin new file mode 100644 index 00000000000..08720105812 Binary files /dev/null and b/packages/linux/firmware/amdgpu/polaris11_ce.bin differ diff --git a/packages/linux/firmware/amdgpu/polaris11_mc.bin b/packages/linux/firmware/amdgpu/polaris11_mc.bin new file mode 100644 index 00000000000..8c9f74a6c0a Binary files /dev/null and b/packages/linux/firmware/amdgpu/polaris11_mc.bin differ diff --git a/packages/linux/firmware/amdgpu/polaris11_me.bin b/packages/linux/firmware/amdgpu/polaris11_me.bin new file mode 100644 index 00000000000..89e1e7d4d1f Binary files /dev/null and b/packages/linux/firmware/amdgpu/polaris11_me.bin differ diff --git a/packages/linux/firmware/amdgpu/polaris11_mec.bin b/packages/linux/firmware/amdgpu/polaris11_mec.bin new file mode 100644 index 00000000000..da63ea2d446 Binary files /dev/null and b/packages/linux/firmware/amdgpu/polaris11_mec.bin differ diff --git a/packages/linux/firmware/amdgpu/polaris11_mec2.bin b/packages/linux/firmware/amdgpu/polaris11_mec2.bin new file mode 100644 index 00000000000..da63ea2d446 Binary files /dev/null and b/packages/linux/firmware/amdgpu/polaris11_mec2.bin differ diff --git a/packages/linux/firmware/amdgpu/polaris11_pfp.bin b/packages/linux/firmware/amdgpu/polaris11_pfp.bin new file mode 100644 index 00000000000..e528693b0b8 Binary files /dev/null and b/packages/linux/firmware/amdgpu/polaris11_pfp.bin differ diff --git a/packages/linux/firmware/amdgpu/polaris11_rlc.bin b/packages/linux/firmware/amdgpu/polaris11_rlc.bin new file mode 100644 index 00000000000..c4cdd92379c Binary files /dev/null and b/packages/linux/firmware/amdgpu/polaris11_rlc.bin differ diff --git a/packages/linux/firmware/amdgpu/polaris11_sdma.bin b/packages/linux/firmware/amdgpu/polaris11_sdma.bin new file mode 100644 index 00000000000..ba0d5e64da9 Binary files /dev/null and b/packages/linux/firmware/amdgpu/polaris11_sdma.bin differ diff --git a/packages/linux/firmware/amdgpu/polaris11_sdma1.bin b/packages/linux/firmware/amdgpu/polaris11_sdma1.bin new file mode 100644 index 00000000000..45c656de766 Binary files /dev/null and b/packages/linux/firmware/amdgpu/polaris11_sdma1.bin differ diff --git a/packages/linux/firmware/amdgpu/polaris11_smc.bin b/packages/linux/firmware/amdgpu/polaris11_smc.bin new file mode 100644 index 00000000000..e1b9ea66465 Binary files /dev/null and b/packages/linux/firmware/amdgpu/polaris11_smc.bin differ diff --git a/packages/linux/firmware/amdgpu/polaris11_smc_sk.bin b/packages/linux/firmware/amdgpu/polaris11_smc_sk.bin new file mode 100644 index 00000000000..469dcc28b88 Binary files /dev/null and b/packages/linux/firmware/amdgpu/polaris11_smc_sk.bin differ diff --git a/packages/linux/firmware/amdgpu/polaris11_uvd.bin b/packages/linux/firmware/amdgpu/polaris11_uvd.bin new file mode 100644 index 00000000000..62ef71547bb Binary files /dev/null and b/packages/linux/firmware/amdgpu/polaris11_uvd.bin differ diff --git a/packages/linux/firmware/amdgpu/polaris11_vce.bin b/packages/linux/firmware/amdgpu/polaris11_vce.bin new file mode 100644 index 00000000000..5f5d436c3c1 Binary files /dev/null and b/packages/linux/firmware/amdgpu/polaris11_vce.bin differ diff --git a/packages/linux/firmware/amdgpu/stoney_ce.bin b/packages/linux/firmware/amdgpu/stoney_ce.bin new file mode 100644 index 00000000000..5e35ccd9936 Binary files /dev/null and b/packages/linux/firmware/amdgpu/stoney_ce.bin differ diff --git a/packages/linux/firmware/amdgpu/stoney_me.bin b/packages/linux/firmware/amdgpu/stoney_me.bin new file mode 100644 index 00000000000..775b752c511 Binary files /dev/null and b/packages/linux/firmware/amdgpu/stoney_me.bin differ diff --git a/packages/linux/firmware/amdgpu/stoney_mec.bin b/packages/linux/firmware/amdgpu/stoney_mec.bin new file mode 100644 index 00000000000..bdec08f0623 Binary files /dev/null and b/packages/linux/firmware/amdgpu/stoney_mec.bin differ diff --git a/packages/linux/firmware/amdgpu/stoney_pfp.bin b/packages/linux/firmware/amdgpu/stoney_pfp.bin new file mode 100644 index 00000000000..84b5b0fbf54 Binary files /dev/null and b/packages/linux/firmware/amdgpu/stoney_pfp.bin differ diff --git a/packages/linux/firmware/amdgpu/stoney_rlc.bin b/packages/linux/firmware/amdgpu/stoney_rlc.bin new file mode 100644 index 00000000000..7002e730721 Binary files /dev/null and b/packages/linux/firmware/amdgpu/stoney_rlc.bin differ diff --git a/packages/linux/firmware/amdgpu/stoney_sdma.bin b/packages/linux/firmware/amdgpu/stoney_sdma.bin new file mode 100644 index 00000000000..95663d6971b Binary files /dev/null and b/packages/linux/firmware/amdgpu/stoney_sdma.bin differ diff --git a/packages/linux/firmware/amdgpu/stoney_uvd.bin b/packages/linux/firmware/amdgpu/stoney_uvd.bin new file mode 100644 index 00000000000..3fe546dec59 Binary files /dev/null and b/packages/linux/firmware/amdgpu/stoney_uvd.bin differ diff --git a/packages/linux/firmware/amdgpu/stoney_vce.bin b/packages/linux/firmware/amdgpu/stoney_vce.bin new file mode 100644 index 00000000000..ff54327c8c6 Binary files /dev/null and b/packages/linux/firmware/amdgpu/stoney_vce.bin differ diff --git a/packages/linux/firmware/amdgpu/tonga_ce.bin b/packages/linux/firmware/amdgpu/tonga_ce.bin index f253473fa3a..3e551365bc8 100644 Binary files a/packages/linux/firmware/amdgpu/tonga_ce.bin and b/packages/linux/firmware/amdgpu/tonga_ce.bin differ diff --git a/packages/linux/firmware/amdgpu/tonga_me.bin b/packages/linux/firmware/amdgpu/tonga_me.bin index 0f21f8839e0..a22a4c0ba02 100644 Binary files a/packages/linux/firmware/amdgpu/tonga_me.bin and b/packages/linux/firmware/amdgpu/tonga_me.bin differ diff --git a/packages/linux/firmware/amdgpu/tonga_mec.bin b/packages/linux/firmware/amdgpu/tonga_mec.bin index 6d29d12dacc..4d589cf57e9 100644 Binary files a/packages/linux/firmware/amdgpu/tonga_mec.bin and b/packages/linux/firmware/amdgpu/tonga_mec.bin differ diff --git a/packages/linux/firmware/amdgpu/tonga_mec2.bin b/packages/linux/firmware/amdgpu/tonga_mec2.bin index 7294cf7c3e6..4d589cf57e9 100644 Binary files a/packages/linux/firmware/amdgpu/tonga_mec2.bin and b/packages/linux/firmware/amdgpu/tonga_mec2.bin differ diff --git a/packages/linux/firmware/amdgpu/tonga_pfp.bin b/packages/linux/firmware/amdgpu/tonga_pfp.bin index 6d89bd456ff..de07043e7f9 100644 Binary files a/packages/linux/firmware/amdgpu/tonga_pfp.bin and b/packages/linux/firmware/amdgpu/tonga_pfp.bin differ diff --git a/packages/linux/firmware/amdgpu/tonga_sdma.bin b/packages/linux/firmware/amdgpu/tonga_sdma.bin index bc72f7fb34c..8ede27dba4c 100644 Binary files a/packages/linux/firmware/amdgpu/tonga_sdma.bin and b/packages/linux/firmware/amdgpu/tonga_sdma.bin differ diff --git a/packages/linux/firmware/amdgpu/tonga_sdma1.bin b/packages/linux/firmware/amdgpu/tonga_sdma1.bin index ff4797664c4..7f7078e624b 100644 Binary files a/packages/linux/firmware/amdgpu/tonga_sdma1.bin and b/packages/linux/firmware/amdgpu/tonga_sdma1.bin differ diff --git a/packages/linux/firmware/amdgpu/tonga_smc.bin b/packages/linux/firmware/amdgpu/tonga_smc.bin index b7e38137672..0fd5b94ecd0 100644 Binary files a/packages/linux/firmware/amdgpu/tonga_smc.bin and b/packages/linux/firmware/amdgpu/tonga_smc.bin differ diff --git a/packages/linux/firmware/amdgpu/topaz_ce.bin b/packages/linux/firmware/amdgpu/topaz_ce.bin index aa970619b6f..59548e1bc13 100644 Binary files a/packages/linux/firmware/amdgpu/topaz_ce.bin and b/packages/linux/firmware/amdgpu/topaz_ce.bin differ diff --git a/packages/linux/firmware/amdgpu/topaz_me.bin b/packages/linux/firmware/amdgpu/topaz_me.bin index cfd016cdb0f..4cc3a8dfad7 100644 Binary files a/packages/linux/firmware/amdgpu/topaz_me.bin and b/packages/linux/firmware/amdgpu/topaz_me.bin differ diff --git a/packages/linux/firmware/amdgpu/topaz_mec.bin b/packages/linux/firmware/amdgpu/topaz_mec.bin index 612a029b06c..929b3779821 100644 Binary files a/packages/linux/firmware/amdgpu/topaz_mec.bin and b/packages/linux/firmware/amdgpu/topaz_mec.bin differ diff --git a/packages/linux/firmware/amdgpu/topaz_pfp.bin b/packages/linux/firmware/amdgpu/topaz_pfp.bin index d5f5ba34534..1372cae1a62 100644 Binary files a/packages/linux/firmware/amdgpu/topaz_pfp.bin and b/packages/linux/firmware/amdgpu/topaz_pfp.bin differ diff --git a/packages/linux/firmware/amdgpu/topaz_sdma.bin b/packages/linux/firmware/amdgpu/topaz_sdma.bin index 0d567acc7fb..4e0e5624472 100644 Binary files a/packages/linux/firmware/amdgpu/topaz_sdma.bin and b/packages/linux/firmware/amdgpu/topaz_sdma.bin differ diff --git a/packages/linux/firmware/amdgpu/topaz_sdma1.bin b/packages/linux/firmware/amdgpu/topaz_sdma1.bin index 4bd62a3e9dc..6600b86b8ea 100644 Binary files a/packages/linux/firmware/amdgpu/topaz_sdma1.bin and b/packages/linux/firmware/amdgpu/topaz_sdma1.bin differ diff --git a/packages/linux/firmware/amdgpu/topaz_smc.bin b/packages/linux/firmware/amdgpu/topaz_smc.bin index 864308ff5c2..842c6f192f3 100644 Binary files a/packages/linux/firmware/amdgpu/topaz_smc.bin and b/packages/linux/firmware/amdgpu/topaz_smc.bin differ diff --git a/packages/linux/firmware/i915/skl_dmc_ver1.bin b/packages/linux/firmware/i915/skl_dmc_ver1.bin index b9bc65c8b6e..02e7b32d17a 120000 --- a/packages/linux/firmware/i915/skl_dmc_ver1.bin +++ b/packages/linux/firmware/i915/skl_dmc_ver1.bin @@ -1 +1 @@ -skl_dmc_ver1_22.bin \ No newline at end of file +skl_dmc_ver1_26.bin \ No newline at end of file diff --git a/packages/linux/firmware/i915/skl_dmc_ver1_26.bin b/packages/linux/firmware/i915/skl_dmc_ver1_26.bin new file mode 100644 index 00000000000..3dd8a7d9512 Binary files /dev/null and b/packages/linux/firmware/i915/skl_dmc_ver1_26.bin differ diff --git a/packages/linux/firmware/i915/skl_guc_ver6.bin b/packages/linux/firmware/i915/skl_guc_ver6.bin new file mode 120000 index 00000000000..9bd545c72ca --- /dev/null +++ b/packages/linux/firmware/i915/skl_guc_ver6.bin @@ -0,0 +1 @@ +skl_guc_ver6_1.bin \ No newline at end of file diff --git a/packages/linux/firmware/i915/skl_guc_ver6_1.bin b/packages/linux/firmware/i915/skl_guc_ver6_1.bin new file mode 100644 index 00000000000..5c626ea8bb5 Binary files /dev/null and b/packages/linux/firmware/i915/skl_guc_ver6_1.bin differ diff --git a/packages/linux/firmware/radeon/BONAIRE_uvd.bin b/packages/linux/firmware/radeon/BONAIRE_uvd.bin index 0876de9e9b1..2ef100849da 100644 Binary files a/packages/linux/firmware/radeon/BONAIRE_uvd.bin and b/packages/linux/firmware/radeon/BONAIRE_uvd.bin differ diff --git a/packages/linux/firmware/radeon/TAHITI_vce.bin b/packages/linux/firmware/radeon/TAHITI_vce.bin new file mode 100644 index 00000000000..1a9a8a45473 Binary files /dev/null and b/packages/linux/firmware/radeon/TAHITI_vce.bin differ diff --git a/packages/linux/firmware/radeon/bonaire_ce.bin b/packages/linux/firmware/radeon/bonaire_ce.bin index d86d86e1cd7..21d2ebad1e6 100644 Binary files a/packages/linux/firmware/radeon/bonaire_ce.bin and b/packages/linux/firmware/radeon/bonaire_ce.bin differ diff --git a/packages/linux/firmware/radeon/bonaire_me.bin b/packages/linux/firmware/radeon/bonaire_me.bin index 5f0cd81823d..bd43457df03 100644 Binary files a/packages/linux/firmware/radeon/bonaire_me.bin and b/packages/linux/firmware/radeon/bonaire_me.bin differ diff --git a/packages/linux/firmware/radeon/bonaire_mec.bin b/packages/linux/firmware/radeon/bonaire_mec.bin index ab36ad52c19..af7870aecba 100644 Binary files a/packages/linux/firmware/radeon/bonaire_mec.bin and b/packages/linux/firmware/radeon/bonaire_mec.bin differ diff --git a/packages/linux/firmware/radeon/bonaire_pfp.bin b/packages/linux/firmware/radeon/bonaire_pfp.bin index 7e6b5358b0f..ca3af0e2036 100644 Binary files a/packages/linux/firmware/radeon/bonaire_pfp.bin and b/packages/linux/firmware/radeon/bonaire_pfp.bin differ diff --git a/packages/linux/firmware/radeon/bonaire_rlc.bin b/packages/linux/firmware/radeon/bonaire_rlc.bin index 5fe16b30ed3..69410a89f21 100644 Binary files a/packages/linux/firmware/radeon/bonaire_rlc.bin and b/packages/linux/firmware/radeon/bonaire_rlc.bin differ diff --git a/packages/linux/firmware/radeon/bonaire_sdma.bin b/packages/linux/firmware/radeon/bonaire_sdma.bin index 9c099103e35..77b6d9dab15 100644 Binary files a/packages/linux/firmware/radeon/bonaire_sdma.bin and b/packages/linux/firmware/radeon/bonaire_sdma.bin differ diff --git a/packages/linux/firmware/radeon/bonaire_sdma1.bin b/packages/linux/firmware/radeon/bonaire_sdma1.bin new file mode 100644 index 00000000000..f9efa138dcc Binary files /dev/null and b/packages/linux/firmware/radeon/bonaire_sdma1.bin differ diff --git a/packages/linux/firmware/radeon/bonaire_smc.bin b/packages/linux/firmware/radeon/bonaire_smc.bin index 1f1ca8b5671..7d7ffffeffd 100644 Binary files a/packages/linux/firmware/radeon/bonaire_smc.bin and b/packages/linux/firmware/radeon/bonaire_smc.bin differ diff --git a/packages/linux/firmware/radeon/bonaire_uvd.bin b/packages/linux/firmware/radeon/bonaire_uvd.bin new file mode 100644 index 00000000000..ff4613916d4 Binary files /dev/null and b/packages/linux/firmware/radeon/bonaire_uvd.bin differ diff --git a/packages/linux/firmware/radeon/bonaire_vce.bin b/packages/linux/firmware/radeon/bonaire_vce.bin new file mode 100644 index 00000000000..bea60f1e441 Binary files /dev/null and b/packages/linux/firmware/radeon/bonaire_vce.bin differ diff --git a/packages/linux/firmware/radeon/hawaii_ce.bin b/packages/linux/firmware/radeon/hawaii_ce.bin index 047f842d2c3..9eed128ce7b 100644 Binary files a/packages/linux/firmware/radeon/hawaii_ce.bin and b/packages/linux/firmware/radeon/hawaii_ce.bin differ diff --git a/packages/linux/firmware/radeon/hawaii_mc.bin b/packages/linux/firmware/radeon/hawaii_mc.bin index 0b0389e1571..c8bdd104dde 100644 Binary files a/packages/linux/firmware/radeon/hawaii_mc.bin and b/packages/linux/firmware/radeon/hawaii_mc.bin differ diff --git a/packages/linux/firmware/radeon/hawaii_me.bin b/packages/linux/firmware/radeon/hawaii_me.bin index a020e7ec470..6ebfa49d4e4 100644 Binary files a/packages/linux/firmware/radeon/hawaii_me.bin and b/packages/linux/firmware/radeon/hawaii_me.bin differ diff --git a/packages/linux/firmware/radeon/hawaii_mec.bin b/packages/linux/firmware/radeon/hawaii_mec.bin index b01de6a7c3a..978558533ea 100644 Binary files a/packages/linux/firmware/radeon/hawaii_mec.bin and b/packages/linux/firmware/radeon/hawaii_mec.bin differ diff --git a/packages/linux/firmware/radeon/hawaii_pfp.bin b/packages/linux/firmware/radeon/hawaii_pfp.bin index 297f985352e..ee376c1aabf 100644 Binary files a/packages/linux/firmware/radeon/hawaii_pfp.bin and b/packages/linux/firmware/radeon/hawaii_pfp.bin differ diff --git a/packages/linux/firmware/radeon/hawaii_rlc.bin b/packages/linux/firmware/radeon/hawaii_rlc.bin index 16515747eaf..56abc51d785 100644 Binary files a/packages/linux/firmware/radeon/hawaii_rlc.bin and b/packages/linux/firmware/radeon/hawaii_rlc.bin differ diff --git a/packages/linux/firmware/radeon/hawaii_sdma.bin b/packages/linux/firmware/radeon/hawaii_sdma.bin index 9c099103e35..77b6d9dab15 100644 Binary files a/packages/linux/firmware/radeon/hawaii_sdma.bin and b/packages/linux/firmware/radeon/hawaii_sdma.bin differ diff --git a/packages/linux/firmware/radeon/hawaii_sdma1.bin b/packages/linux/firmware/radeon/hawaii_sdma1.bin new file mode 100644 index 00000000000..f9efa138dcc Binary files /dev/null and b/packages/linux/firmware/radeon/hawaii_sdma1.bin differ diff --git a/packages/linux/firmware/radeon/hawaii_smc.bin b/packages/linux/firmware/radeon/hawaii_smc.bin index 9225e35d138..0080fc0307d 100644 Binary files a/packages/linux/firmware/radeon/hawaii_smc.bin and b/packages/linux/firmware/radeon/hawaii_smc.bin differ diff --git a/packages/linux/firmware/radeon/hawaii_uvd.bin b/packages/linux/firmware/radeon/hawaii_uvd.bin new file mode 100644 index 00000000000..ff4613916d4 Binary files /dev/null and b/packages/linux/firmware/radeon/hawaii_uvd.bin differ diff --git a/packages/linux/firmware/radeon/hawaii_vce.bin b/packages/linux/firmware/radeon/hawaii_vce.bin new file mode 100644 index 00000000000..bea60f1e441 Binary files /dev/null and b/packages/linux/firmware/radeon/hawaii_vce.bin differ diff --git a/packages/linux/firmware/radeon/kabini_ce.bin b/packages/linux/firmware/radeon/kabini_ce.bin index d86d86e1cd7..c2c0f4a0dff 100644 Binary files a/packages/linux/firmware/radeon/kabini_ce.bin and b/packages/linux/firmware/radeon/kabini_ce.bin differ diff --git a/packages/linux/firmware/radeon/kabini_me.bin b/packages/linux/firmware/radeon/kabini_me.bin index f65c1c86c41..1e2406a7d75 100644 Binary files a/packages/linux/firmware/radeon/kabini_me.bin and b/packages/linux/firmware/radeon/kabini_me.bin differ diff --git a/packages/linux/firmware/radeon/kabini_mec.bin b/packages/linux/firmware/radeon/kabini_mec.bin index 68d3f489c4d..e16efdb24f9 100644 Binary files a/packages/linux/firmware/radeon/kabini_mec.bin and b/packages/linux/firmware/radeon/kabini_mec.bin differ diff --git a/packages/linux/firmware/radeon/kabini_pfp.bin b/packages/linux/firmware/radeon/kabini_pfp.bin index edc2cc9e5cf..b3b4c60a53c 100644 Binary files a/packages/linux/firmware/radeon/kabini_pfp.bin and b/packages/linux/firmware/radeon/kabini_pfp.bin differ diff --git a/packages/linux/firmware/radeon/kabini_sdma.bin b/packages/linux/firmware/radeon/kabini_sdma.bin index 9c099103e35..77b6d9dab15 100644 Binary files a/packages/linux/firmware/radeon/kabini_sdma.bin and b/packages/linux/firmware/radeon/kabini_sdma.bin differ diff --git a/packages/linux/firmware/radeon/kabini_sdma1.bin b/packages/linux/firmware/radeon/kabini_sdma1.bin new file mode 100644 index 00000000000..f9efa138dcc Binary files /dev/null and b/packages/linux/firmware/radeon/kabini_sdma1.bin differ diff --git a/packages/linux/firmware/radeon/kabini_uvd.bin b/packages/linux/firmware/radeon/kabini_uvd.bin new file mode 100644 index 00000000000..ff4613916d4 Binary files /dev/null and b/packages/linux/firmware/radeon/kabini_uvd.bin differ diff --git a/packages/linux/firmware/radeon/kabini_vce.bin b/packages/linux/firmware/radeon/kabini_vce.bin new file mode 100644 index 00000000000..bea60f1e441 Binary files /dev/null and b/packages/linux/firmware/radeon/kabini_vce.bin differ diff --git a/packages/linux/firmware/radeon/kaveri_ce.bin b/packages/linux/firmware/radeon/kaveri_ce.bin index 95163d49ae6..c2c0f4a0dff 100644 Binary files a/packages/linux/firmware/radeon/kaveri_ce.bin and b/packages/linux/firmware/radeon/kaveri_ce.bin differ diff --git a/packages/linux/firmware/radeon/kaveri_me.bin b/packages/linux/firmware/radeon/kaveri_me.bin index 4920e2ed561..1e2406a7d75 100644 Binary files a/packages/linux/firmware/radeon/kaveri_me.bin and b/packages/linux/firmware/radeon/kaveri_me.bin differ diff --git a/packages/linux/firmware/radeon/kaveri_pfp.bin b/packages/linux/firmware/radeon/kaveri_pfp.bin index f3054c1369f..b43f47d00c2 100644 Binary files a/packages/linux/firmware/radeon/kaveri_pfp.bin and b/packages/linux/firmware/radeon/kaveri_pfp.bin differ diff --git a/packages/linux/firmware/radeon/kaveri_sdma.bin b/packages/linux/firmware/radeon/kaveri_sdma.bin index 13c9bc513c2..77b6d9dab15 100644 Binary files a/packages/linux/firmware/radeon/kaveri_sdma.bin and b/packages/linux/firmware/radeon/kaveri_sdma.bin differ diff --git a/packages/linux/firmware/radeon/kaveri_sdma1.bin b/packages/linux/firmware/radeon/kaveri_sdma1.bin new file mode 100644 index 00000000000..f9efa138dcc Binary files /dev/null and b/packages/linux/firmware/radeon/kaveri_sdma1.bin differ diff --git a/packages/linux/firmware/radeon/kaveri_uvd.bin b/packages/linux/firmware/radeon/kaveri_uvd.bin new file mode 100644 index 00000000000..ff4613916d4 Binary files /dev/null and b/packages/linux/firmware/radeon/kaveri_uvd.bin differ diff --git a/packages/linux/firmware/radeon/kaveri_vce.bin b/packages/linux/firmware/radeon/kaveri_vce.bin new file mode 100644 index 00000000000..bea60f1e441 Binary files /dev/null and b/packages/linux/firmware/radeon/kaveri_vce.bin differ diff --git a/packages/linux/firmware/radeon/mullins_ce.bin b/packages/linux/firmware/radeon/mullins_ce.bin index d86d86e1cd7..c2c0f4a0dff 100644 Binary files a/packages/linux/firmware/radeon/mullins_ce.bin and b/packages/linux/firmware/radeon/mullins_ce.bin differ diff --git a/packages/linux/firmware/radeon/mullins_me.bin b/packages/linux/firmware/radeon/mullins_me.bin index f65c1c86c41..1e2406a7d75 100644 Binary files a/packages/linux/firmware/radeon/mullins_me.bin and b/packages/linux/firmware/radeon/mullins_me.bin differ diff --git a/packages/linux/firmware/radeon/mullins_mec.bin b/packages/linux/firmware/radeon/mullins_mec.bin index 68d3f489c4d..e16efdb24f9 100644 Binary files a/packages/linux/firmware/radeon/mullins_mec.bin and b/packages/linux/firmware/radeon/mullins_mec.bin differ diff --git a/packages/linux/firmware/radeon/mullins_pfp.bin b/packages/linux/firmware/radeon/mullins_pfp.bin index edc2cc9e5cf..b3b4c60a53c 100644 Binary files a/packages/linux/firmware/radeon/mullins_pfp.bin and b/packages/linux/firmware/radeon/mullins_pfp.bin differ diff --git a/packages/linux/firmware/radeon/mullins_sdma.bin b/packages/linux/firmware/radeon/mullins_sdma.bin index 9c099103e35..77b6d9dab15 100644 Binary files a/packages/linux/firmware/radeon/mullins_sdma.bin and b/packages/linux/firmware/radeon/mullins_sdma.bin differ diff --git a/packages/linux/firmware/radeon/mullins_sdma1.bin b/packages/linux/firmware/radeon/mullins_sdma1.bin new file mode 100644 index 00000000000..f9efa138dcc Binary files /dev/null and b/packages/linux/firmware/radeon/mullins_sdma1.bin differ diff --git a/packages/linux/firmware/radeon/mullins_uvd.bin b/packages/linux/firmware/radeon/mullins_uvd.bin new file mode 100644 index 00000000000..ff4613916d4 Binary files /dev/null and b/packages/linux/firmware/radeon/mullins_uvd.bin differ diff --git a/packages/linux/firmware/radeon/mullins_vce.bin b/packages/linux/firmware/radeon/mullins_vce.bin new file mode 100644 index 00000000000..bea60f1e441 Binary files /dev/null and b/packages/linux/firmware/radeon/mullins_vce.bin differ diff --git a/packages/linux/package.mk b/packages/linux/package.mk index fcf9bf39c5f..ac9f118edd3 100644 --- a/packages/linux/package.mk +++ b/packages/linux/package.mk @@ -23,24 +23,39 @@ PKG_LICENSE="GPL" PKG_SITE="http://www.kernel.org" PKG_DEPENDS_HOST="ccache:host" PKG_DEPENDS_TARGET="toolchain cpio:host kmod:host pciutils xz:host wireless-regdb keyutils" -PKG_DEPENDS_INIT="toolchain" +PKG_DEPENDS_INIT="toolchain cpu-firmware:init" PKG_NEED_UNPACK="$LINUX_DEPENDS" PKG_PRIORITY="optional" PKG_SECTION="linux" PKG_SHORTDESC="linux26: The Linux kernel 2.6 precompiled kernel binary image and modules" PKG_LONGDESC="This package contains a precompiled kernel image and the modules." case "$LINUX" in + hardkernel) + PKG_VERSION="55d5417" + PKG_URL="https://github.com/hardkernel/linux/archive/$PKG_VERSION.tar.gz" + ;; amlogic) PKG_VERSION="amlogic-3.10-c8d5b2f" PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" ;; imx6) - PKG_VERSION="cuboxi-3.14-ea83bda" - PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" + PKG_VERSION="3.14-mx6-sr" + PKG_COMMIT="4386797" + PKG_SOURCE_DIR="$PKG_NAME-$PKG_VERSION-$PKG_COMMIT" + PKG_SOURCE_NAME="$PKG_SOURCE_DIR.tar.xz" + PKG_URL="$DISTRO_SRC/$PKG_SOURCE_NAME" PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET imx6-status-led imx6-soc-fan" ;; + imx6-4.4-xbian) + PKG_VERSION="4.4-xbian" + PKG_COMMIT="20160403-d08b62d" + PKG_SOURCE_DIR="$PKG_NAME-$PKG_VERSION-$PKG_COMMIT" + PKG_SOURCE_NAME="$PKG_SOURCE_DIR.tar.xz" + PKG_URL="$DISTRO_SRC/$PKG_SOURCE_NAME" + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET imx6-status-led imx6-soc-fan irqbalanced" + ;; *) - PKG_VERSION="4.4.5" + PKG_VERSION="4.6.1" PKG_URL="http://www.kernel.org/pub/linux/kernel/v4.x/$PKG_NAME-$PKG_VERSION.tar.xz" ;; esac @@ -55,8 +70,12 @@ if [ "$BUILD_ANDROID_BOOTIMG" = "yes" ]; then fi post_patch() { - if [ -f $PROJECT_DIR/$PROJECT/$PKG_NAME/$PKG_NAME.$TARGET_ARCH.conf ]; then + if [ -f $PROJECT_DIR/$PROJECT/$PKG_NAME/$PKG_VERSION/$PKG_NAME.$TARGET_ARCH.conf ]; then + KERNEL_CFG_FILE=$PROJECT_DIR/$PROJECT/$PKG_NAME/$PKG_VERSION/$PKG_NAME.$TARGET_ARCH.conf + elif [ -f $PROJECT_DIR/$PROJECT/$PKG_NAME/$PKG_NAME.$TARGET_ARCH.conf ]; then KERNEL_CFG_FILE=$PROJECT_DIR/$PROJECT/$PKG_NAME/$PKG_NAME.$TARGET_ARCH.conf + elif [ -f $PKG_DIR/config/$PKG_VERSION/$PKG_NAME.$TARGET_ARCH.conf ]; then + KERNEL_CFG_FILE=$PKG_DIR/config/$PKG_VERSION/$PKG_NAME.$TARGET_ARCH.conf else KERNEL_CFG_FILE=$PKG_DIR/config/$PKG_NAME.$TARGET_ARCH.conf fi @@ -157,7 +176,7 @@ makeinstall_target() { elif [ "$BOOTLOADER" = "bcm2835-bootloader" ]; then mkdir -p $INSTALL/usr/share/bootloader/overlays cp -p arch/$TARGET_KERNEL_ARCH/boot/dts/*.dtb $INSTALL/usr/share/bootloader - for dtb in arch/$TARGET_KERNEL_ARCH/boot/dts/overlays/*.dtb; do + for dtb in arch/$TARGET_KERNEL_ARCH/boot/dts/overlays/*.dtbo; do cp $dtb $INSTALL/usr/share/bootloader/overlays 2>/dev/null || : done cp -p arch/$TARGET_KERNEL_ARCH/boot/dts/overlays/README $INSTALL/usr/share/bootloader/overlays diff --git a/packages/linux/patches/4.4.5/linux-001-Intel-EDID-fix.patch b/packages/linux/patches/4.4.5/linux-001-Intel-EDID-fix.patch deleted file mode 100644 index d340cf9168b..00000000000 --- a/packages/linux/patches/4.4.5/linux-001-Intel-EDID-fix.patch +++ /dev/null @@ -1,92 +0,0 @@ -From 8d2246fd092ba7e9593ec9fe329ad647be73d46a Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= <ville.syrjala@linux.intel.com> -Date: Tue, 1 Mar 2016 21:50:13 +0200 -Subject: [PATCH] drm/edid: Extract SADs properly from multiple audio data blocks -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -SADs may span multiple CEA audio data blocks in the EDID. - -CEA-861-E says: -"The order of the Data Blocks is not constrained. It is also possible -to have more than one of a specific type of data block if necessary to -include all of the descriptors needed to describe the sink’s capabilities." - -Each audio data block can carry up to 10 SADs, whereas the ELD SAD limit -is 15 according to HDA 1.0a spec. So we should support at least two data -blocks. And apparently some devices take a more liberal interpretation -and stuff only one SAD per data block even when they would fit into one. - -So let's try to extract all the SADs we can fit into the ELD even when -they span multiple data blocks. - -While at it, toss in a comment to explain the 13 byte monitor name -string limit which confused me at first. - -Cc: Arturo Pérez <artur999555@gmail.com> -Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94197 -Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> -Signed-off-by: Matt DeVillier <matt.devillier@gmail.com> ---- - drivers/gpu/drm/drm_edid.c | 17 +++++++++++------ - 1 file changed, 11 insertions(+), 6 deletions(-) - -diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c -index fdb1eb014586..414d7f61aa05 100644 ---- a/drivers/gpu/drm/drm_edid.c -+++ b/drivers/gpu/drm/drm_edid.c -@@ -3308,7 +3308,7 @@ void drm_edid_to_eld(struct drm_connector *connector, struct edid *edid) - u8 *cea; - u8 *name; - u8 *db; -- int sad_count = 0; -+ int total_sad_count = 0; - int mnl; - int dbl; - -@@ -3322,6 +3322,7 @@ void drm_edid_to_eld(struct drm_connector *connector, struct edid *edid) - - name = NULL; - drm_for_each_detailed_block((u8 *)edid, monitor_name, &name); -+ /* max: 13 bytes EDID, 16 bytes ELD */ - for (mnl = 0; name && mnl < 13; mnl++) { - if (name[mnl] == 0x0a) - break; -@@ -3350,11 +3351,15 @@ void drm_edid_to_eld(struct drm_connector *connector, struct edid *edid) - dbl = cea_db_payload_len(db); - - switch (cea_db_tag(db)) { -+ int sad_count; -+ - case AUDIO_BLOCK: - /* Audio Data Block, contains SADs */ -- sad_count = dbl / 3; -- if (dbl >= 1) -- memcpy(eld + 20 + mnl, &db[1], dbl); -+ sad_count = min(dbl / 3, 15 - total_sad_count); -+ if (sad_count >= 1) -+ memcpy(eld + 20 + mnl + total_sad_count * 3, -+ &db[1], sad_count * 3); -+ total_sad_count += sad_count; - break; - case SPEAKER_BLOCK: - /* Speaker Allocation Data Block */ -@@ -3371,13 +3376,13 @@ void drm_edid_to_eld(struct drm_connector *connector, struct edid *edid) - } - } - } -- eld[5] |= sad_count << 4; -+ eld[5] |= total_sad_count << 4; - - eld[DRM_ELD_BASELINE_ELD_LEN] = - DIV_ROUND_UP(drm_eld_calc_baseline_block_size(eld), 4); - - DRM_DEBUG_KMS("ELD size %d, SAD count %d\n", -- drm_eld_size(eld), sad_count); -+ drm_eld_size(eld), total_sad_count); - } - EXPORT_SYMBOL(drm_edid_to_eld); - --- -2.4.10 diff --git a/packages/linux/patches/4.4.5/linux-063-xpad-fix_xbox360_wireless.patch b/packages/linux/patches/4.4.5/linux-063-xpad-fix_xbox360_wireless.patch deleted file mode 100644 index 67b86895822..00000000000 --- a/packages/linux/patches/4.4.5/linux-063-xpad-fix_xbox360_wireless.patch +++ /dev/null @@ -1,963 +0,0 @@ -From 627e828fcf1bb9fc71dbbeca29acd33162efb448 Mon Sep 17 00:00:00 2001 -From: Matt DeVillier <matt.devillier@gmail.com> -Date: Wed, 2 Mar 2016 23:11:33 -0600 -Subject: [PATCH 1/1] linux/drivers/input/joystick/xpad: fixes for xbox360/one controllers - -merged from https://github.com/paroj/xpad - -- fixed blinking LED on Xbox 360 Wireless Controllers -- only expose actually connected Xbox 360 Wireless Controllers -- fixed kernel warnings due to submitting active URB requests -- updated Xbox One controller force feedback -- controller still works after suspend/ resume -- Xbox 360 Wireless button mappings are now compatible with Xbox 360 (non-wireless) mappings - -Signed-off-by: Matt DeVillier <matt.devillier@gmail.com> ---- - drivers/input/joystick/xpad.c | 608 ++++++++++++++++++++++++++++++------------ - 1 file changed, 432 insertions(+), 176 deletions(-) - -diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c -index fd4100d..1ee6626 100644 ---- a/drivers/input/joystick/xpad.c -+++ b/drivers/input/joystick/xpad.c -@@ -74,12 +74,15 @@ - * - * Later changes can be tracked in SCM. - */ -- -+#define DEBUG - #include <linux/kernel.h> -+#include <linux/input.h> -+#include <linux/rcupdate.h> - #include <linux/slab.h> - #include <linux/stat.h> - #include <linux/module.h> - #include <linux/usb/input.h> -+#include <linux/usb/quirks.h> - - #define DRIVER_AUTHOR "Marko Friedemann <mfr@bmx-chemnitz.de>" - #define DRIVER_DESC "X-Box pad driver" -@@ -125,7 +128,8 @@ static const struct xpad_device { - { 0x045e, 0x0289, "Microsoft X-Box pad v2 (US)", 0, XTYPE_XBOX }, - { 0x045e, 0x028e, "Microsoft X-Box 360 pad", 0, XTYPE_XBOX360 }, - { 0x045e, 0x02d1, "Microsoft X-Box One pad", 0, XTYPE_XBOXONE }, -- { 0x045e, 0x02dd, "Microsoft X-Box One pad (Covert Forces)", 0, XTYPE_XBOXONE }, -+ { 0x045e, 0x02dd, "Microsoft X-Box One pad (Firmware 2015)", 0, XTYPE_XBOXONE }, -+ { 0x0e6f, 0x0139, "Afterglow Prismatic Wired Controller", 0, XTYPE_XBOXONE }, - { 0x045e, 0x0291, "Xbox 360 Wireless Receiver (XBOX)", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360W }, - { 0x045e, 0x0719, "Xbox 360 Wireless Receiver", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360W }, - { 0x044f, 0x0f07, "Thrustmaster, Inc. Controller", 0, XTYPE_XBOX }, -@@ -298,6 +302,7 @@ static struct usb_device_id xpad_table[] = { - XPAD_XBOX360_VENDOR(0x044f), /* Thrustmaster X-Box 360 controllers */ - XPAD_XBOX360_VENDOR(0x045e), /* Microsoft X-Box 360 controllers */ - XPAD_XBOXONE_VENDOR(0x045e), /* Microsoft X-Box One controllers */ -+ XPAD_XBOXONE_VENDOR(0x0e6f), /* 0x0e6f X-Box One controllers */ - XPAD_XBOX360_VENDOR(0x046d), /* Logitech X-Box 360 style controllers */ - XPAD_XBOX360_VENDOR(0x0738), /* Mad Catz X-Box 360 controllers */ - { USB_DEVICE(0x0738, 0x4540) }, /* Mad Catz Beat Pad */ -@@ -317,21 +322,42 @@ static struct usb_device_id xpad_table[] = { - - MODULE_DEVICE_TABLE(usb, xpad_table); - -+struct xpad_output_packet { -+ u8 data[XPAD_PKT_LEN]; -+ u8 len; -+ bool pending; -+}; -+ -+#define XPAD_OUT_CMD_IDX 0 -+#define XPAD_OUT_FF_IDX 1 -+#define XPAD_OUT_LED_IDX (1 + IS_ENABLED(CONFIG_JOYSTICK_XPAD_FF)) -+#define XPAD_NUM_OUT_PACKETS (1 + \ -+ IS_ENABLED(CONFIG_JOYSTICK_XPAD_FF) + \ -+ IS_ENABLED(CONFIG_JOYSTICK_XPAD_LEDS)) -+ - struct usb_xpad { - struct input_dev *dev; /* input device interface */ -+ struct input_dev __rcu *x360w_dev; - struct usb_device *udev; /* usb device */ - struct usb_interface *intf; /* usb interface */ - -- int pad_present; -+ bool pad_present; -+ bool input_created; - - struct urb *irq_in; /* urb for interrupt in report */ - unsigned char *idata; /* input data */ - dma_addr_t idata_dma; - - struct urb *irq_out; /* urb for interrupt out report */ -+ struct usb_anchor irq_out_anchor; -+ bool irq_out_active; /* we must not use an active URB */ -+ u8 odata_serial; /* serial number for xbox one protocol */ - unsigned char *odata; /* output data */ - dma_addr_t odata_dma; -- struct mutex odata_mutex; -+ spinlock_t odata_lock; -+ -+ struct xpad_output_packet out_packets[XPAD_NUM_OUT_PACKETS]; -+ int last_out_packet; - - #if defined(CONFIG_JOYSTICK_XPAD_LEDS) - struct xpad_led *led; -@@ -343,8 +369,12 @@ struct usb_xpad { - int xtype; /* type of xbox device */ - int pad_nr; /* the order x360 pads were attached */ - const char *name; /* name of the device */ -+ struct work_struct work; /* init/remove device from callback */ - }; - -+static int xpad_init_input(struct usb_xpad *xpad); -+static void xpad_deinit_input(struct usb_xpad *xpad); -+ - /* - * xpad_process_packet - * -@@ -424,11 +454,9 @@ static void xpad_process_packet(struct usb_xpad *xpad, u16 cmd, unsigned char *d - * http://www.free60.org/wiki/Gamepad - */ - --static void xpad360_process_packet(struct usb_xpad *xpad, -+static void xpad360_process_packet(struct usb_xpad *xpad, struct input_dev *dev, - u16 cmd, unsigned char *data) - { -- struct input_dev *dev = xpad->dev; -- - /* digital pad */ - if (xpad->mapping & MAP_DPAD_TO_BUTTONS) { - /* dpad as buttons (left, right, up, down) */ -@@ -495,7 +523,30 @@ static void xpad360_process_packet(struct usb_xpad *xpad, - input_sync(dev); - } - --static void xpad_identify_controller(struct usb_xpad *xpad); -+static void xpad_presence_work(struct work_struct *work) -+{ -+ struct usb_xpad *xpad = container_of(work, struct usb_xpad, work); -+ int error; -+ -+ if (xpad->pad_present) { -+ error = xpad_init_input(xpad); -+ if (error) { -+ /* complain only, not much else we can do here */ -+ dev_err(&xpad->dev->dev, -+ "unable to init device: %d\n", error); -+ } else { -+ rcu_assign_pointer(xpad->x360w_dev, xpad->dev); -+ } -+ } else { -+ RCU_INIT_POINTER(xpad->x360w_dev, NULL); -+ synchronize_rcu(); -+ /* -+ * Now that we are sure xpad360w_process_packet is not -+ * using input device we can get rid of it. -+ */ -+ xpad_deinit_input(xpad); -+ } -+} - - /* - * xpad360w_process_packet -@@ -513,24 +564,28 @@ static void xpad_identify_controller(struct usb_xpad *xpad); - */ - static void xpad360w_process_packet(struct usb_xpad *xpad, u16 cmd, unsigned char *data) - { -+ struct input_dev *dev; -+ bool present; -+ - /* Presence change */ - if (data[0] & 0x08) { -- if (data[1] & 0x80) { -- xpad->pad_present = 1; -- /* -- * Light up the segment corresponding to -- * controller number. -- */ -- xpad_identify_controller(xpad); -- } else -- xpad->pad_present = 0; -+ present = (data[1] & 0x80) != 0; -+ -+ if (xpad->pad_present != present) { -+ xpad->pad_present = present; -+ schedule_work(&xpad->work); -+ } - } - - /* Valid pad data */ -- if (!(data[1] & 0x1)) -+ if (data[1] != 0x1) - return; - -- xpad360_process_packet(xpad, cmd, &data[4]); -+ rcu_read_lock(); -+ dev = rcu_dereference(xpad->x360w_dev); -+ if (dev) -+ xpad360_process_packet(xpad, dev, cmd, &data[4]); -+ rcu_read_unlock(); - } - - /* -@@ -659,7 +714,7 @@ static void xpad_irq_in(struct urb *urb) - - switch (xpad->xtype) { - case XTYPE_XBOX360: -- xpad360_process_packet(xpad, 0, xpad->idata); -+ xpad360_process_packet(xpad, xpad->dev, 0, xpad->idata); - break; - case XTYPE_XBOX360W: - xpad360w_process_packet(xpad, 0, xpad->idata); -@@ -678,18 +733,73 @@ exit: - __func__, retval); - } - -+/* Callers must hold xpad->odata_lock spinlock */ -+static bool xpad_prepare_next_out_packet(struct usb_xpad *xpad) -+{ -+ struct xpad_output_packet *pkt, *packet = NULL; -+ int i; -+ -+ for (i = 0; i < XPAD_NUM_OUT_PACKETS; i++) { -+ if (++xpad->last_out_packet >= XPAD_NUM_OUT_PACKETS) -+ xpad->last_out_packet = 0; -+ -+ pkt = &xpad->out_packets[xpad->last_out_packet]; -+ if (pkt->pending) { -+ dev_dbg(&xpad->intf->dev, -+ "%s - found pending output packet %d\n", -+ __func__, xpad->last_out_packet); -+ packet = pkt; -+ break; -+ } -+ } -+ -+ if (packet) { -+ memcpy(xpad->odata, packet->data, packet->len); -+ xpad->irq_out->transfer_buffer_length = packet->len; -+ return true; -+ } -+ -+ return false; -+} -+ -+/* Callers must hold xpad->odata_lock spinlock */ -+static int xpad_try_sending_next_out_packet(struct usb_xpad *xpad) -+{ -+ int error; -+ -+ if (!xpad->irq_out_active && xpad_prepare_next_out_packet(xpad)) { -+ usb_anchor_urb(xpad->irq_out, &xpad->irq_out_anchor); -+ error = usb_submit_urb(xpad->irq_out, GFP_ATOMIC); -+ if (error) { -+ dev_err(&xpad->intf->dev, -+ "%s - usb_submit_urb failed with result %d\n", -+ __func__, error); -+ usb_unanchor_urb(xpad->irq_out); -+ return -EIO; -+ } -+ -+ xpad->irq_out_active = true; -+ } -+ -+ return 0; -+} -+ - static void xpad_irq_out(struct urb *urb) - { - struct usb_xpad *xpad = urb->context; - struct device *dev = &xpad->intf->dev; -- int retval, status; -+ int status = urb->status; -+ int error; -+ unsigned long flags; - -- status = urb->status; -+ spin_lock_irqsave(&xpad->odata_lock, flags); - - switch (status) { - case 0: - /* success */ -- return; -+ xpad->out_packets[xpad->last_out_packet].pending = false; -+ xpad->irq_out_active = xpad_prepare_next_out_packet(xpad); -+ break; - - case -ECONNRESET: - case -ENOENT: -@@ -697,43 +807,52 @@ static void xpad_irq_out(struct urb *urb) - /* this urb is terminated, clean up */ - dev_dbg(dev, "%s - urb shutting down with status: %d\n", - __func__, status); -- return; -+ xpad->irq_out_active = false; -+ break; - - default: - dev_dbg(dev, "%s - nonzero urb status received: %d\n", - __func__, status); -- goto exit; -+ break; - } - --exit: -- retval = usb_submit_urb(urb, GFP_ATOMIC); -- if (retval) -- dev_err(dev, "%s - usb_submit_urb failed with result %d\n", -- __func__, retval); -+ if (xpad->irq_out_active) { -+ usb_anchor_urb(urb, &xpad->irq_out_anchor); -+ error = usb_submit_urb(urb, GFP_ATOMIC); -+ if (error) { -+ dev_err(dev, -+ "%s - usb_submit_urb failed with result %d\n", -+ __func__, error); -+ usb_unanchor_urb(urb); -+ xpad->irq_out_active = false; -+ } -+ } -+ -+ spin_unlock_irqrestore(&xpad->odata_lock, flags); - } - - static int xpad_init_output(struct usb_interface *intf, struct usb_xpad *xpad) - { - struct usb_endpoint_descriptor *ep_irq_out; - int ep_irq_out_idx; -- int error; - - if (xpad->xtype == XTYPE_UNKNOWN) - return 0; - -+ init_usb_anchor(&xpad->irq_out_anchor); -+ - xpad->odata = usb_alloc_coherent(xpad->udev, XPAD_PKT_LEN, - GFP_KERNEL, &xpad->odata_dma); - if (!xpad->odata) { -- error = -ENOMEM; -- goto fail1; -+ return -ENOMEM; - } - -- mutex_init(&xpad->odata_mutex); -+ spin_lock_init(&xpad->odata_lock); - - xpad->irq_out = usb_alloc_urb(0, GFP_KERNEL); - if (!xpad->irq_out) { -- error = -ENOMEM; -- goto fail2; -+ usb_free_coherent(xpad->udev, XPAD_PKT_LEN, xpad->odata, xpad->odata_dma); -+ return -ENOMEM; - } - - /* Xbox One controller has in/out endpoints swapped. */ -@@ -748,15 +867,18 @@ static int xpad_init_output(struct usb_interface *intf, struct usb_xpad *xpad) - xpad->irq_out->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; - - return 0; -- -- fail2: usb_free_coherent(xpad->udev, XPAD_PKT_LEN, xpad->odata, xpad->odata_dma); -- fail1: return error; - } - - static void xpad_stop_output(struct usb_xpad *xpad) - { -- if (xpad->xtype != XTYPE_UNKNOWN) -- usb_kill_urb(xpad->irq_out); -+ if (xpad->xtype != XTYPE_UNKNOWN) { -+ if (!usb_wait_anchor_empty_timeout(&xpad->irq_out_anchor, -+ 5000)) { -+ dev_warn(&xpad->intf->dev, -+ "timed out waiting for output URB to complete, killing\n"); -+ usb_kill_anchored_urbs(&xpad->irq_out_anchor); -+ } -+ } - } - - static void xpad_deinit_output(struct usb_xpad *xpad) -@@ -770,27 +892,60 @@ static void xpad_deinit_output(struct usb_xpad *xpad) - - static int xpad_inquiry_pad_presence(struct usb_xpad *xpad) - { -+ struct xpad_output_packet *packet = -+ &xpad->out_packets[XPAD_OUT_CMD_IDX]; -+ unsigned long flags; -+ int retval; -+ -+ spin_lock_irqsave(&xpad->odata_lock, flags); -+ -+ packet->data[0] = 0x08; -+ packet->data[1] = 0x00; -+ packet->data[2] = 0x0F; -+ packet->data[3] = 0xC0; -+ packet->data[4] = 0x00; -+ packet->data[5] = 0x00; -+ packet->data[6] = 0x00; -+ packet->data[7] = 0x00; -+ packet->data[8] = 0x00; -+ packet->data[9] = 0x00; -+ packet->data[10] = 0x00; -+ packet->data[11] = 0x00; -+ packet->len = 12; -+ packet->pending = true; -+ -+ /* Reset the sequence so we send out presence first */ -+ xpad->last_out_packet = -1; -+ retval = xpad_try_sending_next_out_packet(xpad); -+ -+ spin_unlock_irqrestore(&xpad->odata_lock, flags); -+ -+ return retval; -+} -+ -+static int xpad_start_xbox_one(struct usb_xpad *xpad) -+{ -+ struct xpad_output_packet *packet = -+ &xpad->out_packets[XPAD_OUT_CMD_IDX]; -+ unsigned long flags; - int retval; - -- mutex_lock(&xpad->odata_mutex); -+ spin_lock_irqsave(&xpad->odata_lock, flags); - -- xpad->odata[0] = 0x08; -- xpad->odata[1] = 0x00; -- xpad->odata[2] = 0x0F; -- xpad->odata[3] = 0xC0; -- xpad->odata[4] = 0x00; -- xpad->odata[5] = 0x00; -- xpad->odata[6] = 0x00; -- xpad->odata[7] = 0x00; -- xpad->odata[8] = 0x00; -- xpad->odata[9] = 0x00; -- xpad->odata[10] = 0x00; -- xpad->odata[11] = 0x00; -- xpad->irq_out->transfer_buffer_length = 12; -+ /* Xbox one controller needs to be initialized. */ -+ packet->data[0] = 0x05; -+ packet->data[1] = 0x20; -+ packet->data[2] = xpad->odata_serial++; /* packet serial */ -+ packet->data[3] = 0x01; /* rumble bit enable? */ -+ packet->data[4] = 0x00; -+ packet->len = 5; -+ packet->pending = true; - -- retval = usb_submit_urb(xpad->irq_out, GFP_KERNEL); -+ /* Reset the sequence so we send out start packet first */ -+ xpad->last_out_packet = -1; -+ retval = xpad_try_sending_next_out_packet(xpad); - -- mutex_unlock(&xpad->odata_mutex); -+ spin_unlock_irqrestore(&xpad->odata_lock, flags); - - return retval; - } -@@ -799,8 +954,11 @@ static int xpad_inquiry_pad_presence(struct usb_xpad *xpad) - static int xpad_play_effect(struct input_dev *dev, void *data, struct ff_effect *effect) - { - struct usb_xpad *xpad = input_get_drvdata(dev); -+ struct xpad_output_packet *packet = &xpad->out_packets[XPAD_OUT_FF_IDX]; - __u16 strong; - __u16 weak; -+ int retval; -+ unsigned long flags; - - if (effect->type != FF_RUMBLE) - return 0; -@@ -808,69 +966,81 @@ static int xpad_play_effect(struct input_dev *dev, void *data, struct ff_effect - strong = effect->u.rumble.strong_magnitude; - weak = effect->u.rumble.weak_magnitude; - -+ spin_lock_irqsave(&xpad->odata_lock, flags); -+ - switch (xpad->xtype) { - case XTYPE_XBOX: -- xpad->odata[0] = 0x00; -- xpad->odata[1] = 0x06; -- xpad->odata[2] = 0x00; -- xpad->odata[3] = strong / 256; /* left actuator */ -- xpad->odata[4] = 0x00; -- xpad->odata[5] = weak / 256; /* right actuator */ -- xpad->irq_out->transfer_buffer_length = 6; -+ packet->data[0] = 0x00; -+ packet->data[1] = 0x06; -+ packet->data[2] = 0x00; -+ packet->data[3] = strong / 256; /* left actuator */ -+ packet->data[4] = 0x00; -+ packet->data[5] = weak / 256; /* right actuator */ -+ packet->len = 6; -+ packet->pending = true; - break; - - case XTYPE_XBOX360: -- xpad->odata[0] = 0x00; -- xpad->odata[1] = 0x08; -- xpad->odata[2] = 0x00; -- xpad->odata[3] = strong / 256; /* left actuator? */ -- xpad->odata[4] = weak / 256; /* right actuator? */ -- xpad->odata[5] = 0x00; -- xpad->odata[6] = 0x00; -- xpad->odata[7] = 0x00; -- xpad->irq_out->transfer_buffer_length = 8; -+ packet->data[0] = 0x00; -+ packet->data[1] = 0x08; -+ packet->data[2] = 0x00; -+ packet->data[3] = strong / 256; /* left actuator? */ -+ packet->data[4] = weak / 256; /* right actuator? */ -+ packet->data[5] = 0x00; -+ packet->data[6] = 0x00; -+ packet->data[7] = 0x00; -+ packet->len = 8; -+ packet->pending = true; - break; - - case XTYPE_XBOX360W: -- xpad->odata[0] = 0x00; -- xpad->odata[1] = 0x01; -- xpad->odata[2] = 0x0F; -- xpad->odata[3] = 0xC0; -- xpad->odata[4] = 0x00; -- xpad->odata[5] = strong / 256; -- xpad->odata[6] = weak / 256; -- xpad->odata[7] = 0x00; -- xpad->odata[8] = 0x00; -- xpad->odata[9] = 0x00; -- xpad->odata[10] = 0x00; -- xpad->odata[11] = 0x00; -- xpad->irq_out->transfer_buffer_length = 12; -+ packet->data[0] = 0x00; -+ packet->data[1] = 0x01; -+ packet->data[2] = 0x0F; -+ packet->data[3] = 0xC0; -+ packet->data[4] = 0x00; -+ packet->data[5] = strong / 256; -+ packet->data[6] = weak / 256; -+ packet->data[7] = 0x00; -+ packet->data[8] = 0x00; -+ packet->data[9] = 0x00; -+ packet->data[10] = 0x00; -+ packet->data[11] = 0x00; -+ packet->len = 12; -+ packet->pending = true; - break; - - case XTYPE_XBOXONE: -- xpad->odata[0] = 0x09; /* activate rumble */ -- xpad->odata[1] = 0x08; -- xpad->odata[2] = 0x00; -- xpad->odata[3] = 0x08; /* continuous effect */ -- xpad->odata[4] = 0x00; /* simple rumble mode */ -- xpad->odata[5] = 0x03; /* L and R actuator only */ -- xpad->odata[6] = 0x00; /* TODO: LT actuator */ -- xpad->odata[7] = 0x00; /* TODO: RT actuator */ -- xpad->odata[8] = strong / 256; /* left actuator */ -- xpad->odata[9] = weak / 256; /* right actuator */ -- xpad->odata[10] = 0x80; /* length of pulse */ -- xpad->odata[11] = 0x00; /* stop period of pulse */ -- xpad->irq_out->transfer_buffer_length = 12; -+ packet->data[0] = 0x09; /* activate rumble */ -+ packet->data[1] = 0x08; -+ packet->data[2] = xpad->odata_serial++; -+ packet->data[3] = 0x08; /* continuous effect */ -+ packet->data[4] = 0x00; /* simple rumble mode */ -+ packet->data[5] = 0x03; /* L and R actuator only */ -+ packet->data[6] = 0x00; /* TODO: LT actuator */ -+ packet->data[7] = 0x00; /* TODO: RT actuator */ -+ packet->data[8] = strong / 512; /* left actuator */ -+ packet->data[9] = weak / 512; /* right actuator */ -+ packet->data[10] = 0x80; /* length of pulse */ -+ packet->data[11] = 0x00; /* stop period of pulse */ -+ packet->data[12] = 0x00; -+ packet->len = 13; -+ packet->pending = true; - break; - - default: - dev_dbg(&xpad->dev->dev, - "%s - rumble command sent to unsupported xpad type: %d\n", - __func__, xpad->xtype); -- return -EINVAL; -+ retval = -EINVAL; -+ goto out; - } - -- return usb_submit_urb(xpad->irq_out, GFP_ATOMIC); -+ retval = xpad_try_sending_next_out_packet(xpad); -+ -+out: -+ spin_unlock_irqrestore(&xpad->odata_lock, flags); -+ return retval; - } - - static int xpad_init_ff(struct usb_xpad *xpad) -@@ -921,36 +1091,44 @@ struct xpad_led { - */ - static void xpad_send_led_command(struct usb_xpad *xpad, int command) - { -+ struct xpad_output_packet *packet = -+ &xpad->out_packets[XPAD_OUT_LED_IDX]; -+ unsigned long flags; -+ - command %= 16; - -- mutex_lock(&xpad->odata_mutex); -+ spin_lock_irqsave(&xpad->odata_lock, flags); - - switch (xpad->xtype) { - case XTYPE_XBOX360: -- xpad->odata[0] = 0x01; -- xpad->odata[1] = 0x03; -- xpad->odata[2] = command; -- xpad->irq_out->transfer_buffer_length = 3; -+ packet->data[0] = 0x01; -+ packet->data[1] = 0x03; -+ packet->data[2] = command; -+ packet->len = 3; -+ packet->pending = true; - break; -+ - case XTYPE_XBOX360W: -- xpad->odata[0] = 0x00; -- xpad->odata[1] = 0x00; -- xpad->odata[2] = 0x08; -- xpad->odata[3] = 0x40 + command; -- xpad->odata[4] = 0x00; -- xpad->odata[5] = 0x00; -- xpad->odata[6] = 0x00; -- xpad->odata[7] = 0x00; -- xpad->odata[8] = 0x00; -- xpad->odata[9] = 0x00; -- xpad->odata[10] = 0x00; -- xpad->odata[11] = 0x00; -- xpad->irq_out->transfer_buffer_length = 12; -+ packet->data[0] = 0x00; -+ packet->data[1] = 0x00; -+ packet->data[2] = 0x08; -+ packet->data[3] = 0x40 + command; -+ packet->data[4] = 0x00; -+ packet->data[5] = 0x00; -+ packet->data[6] = 0x00; -+ packet->data[7] = 0x00; -+ packet->data[8] = 0x00; -+ packet->data[9] = 0x00; -+ packet->data[10] = 0x00; -+ packet->data[11] = 0x00; -+ packet->len = 12; -+ packet->pending = true; - break; - } - -- usb_submit_urb(xpad->irq_out, GFP_KERNEL); -- mutex_unlock(&xpad->odata_mutex); -+ xpad_try_sending_next_out_packet(xpad); -+ -+ spin_unlock_irqrestore(&xpad->odata_lock, flags); - } - - /* -@@ -959,7 +1137,7 @@ static void xpad_send_led_command(struct usb_xpad *xpad, int command) - */ - static void xpad_identify_controller(struct usb_xpad *xpad) - { -- xpad_send_led_command(xpad, (xpad->pad_nr % 4) + 2); -+ led_set_brightness(&xpad->led->led_cdev, (xpad->pad_nr % 4) + 2); - } - - static void xpad_led_set(struct led_classdev *led_cdev, -@@ -1001,14 +1179,7 @@ static int xpad_led_probe(struct usb_xpad *xpad) - if (error) - goto err_free_id; - -- if (xpad->xtype == XTYPE_XBOX360) { -- /* -- * Light up the segment corresponding to controller -- * number on wired devices. On wireless we'll do that -- * when they respond to "presence" packet. -- */ -- xpad_identify_controller(xpad); -- } -+ xpad_identify_controller(xpad); - - return 0; - -@@ -1036,37 +1207,73 @@ static void xpad_led_disconnect(struct usb_xpad *xpad) { } - static void xpad_identify_controller(struct usb_xpad *xpad) { } - #endif - --static int xpad_open(struct input_dev *dev) -+static int xpad_start_input(struct usb_xpad *xpad) - { -- struct usb_xpad *xpad = input_get_drvdata(dev); -- -- /* URB was submitted in probe */ -- if (xpad->xtype == XTYPE_XBOX360W) -- return 0; -+ int error; - -- xpad->irq_in->dev = xpad->udev; - if (usb_submit_urb(xpad->irq_in, GFP_KERNEL)) - return -EIO; - - if (xpad->xtype == XTYPE_XBOXONE) { -- /* Xbox one controller needs to be initialized. */ -- xpad->odata[0] = 0x05; -- xpad->odata[1] = 0x20; -- xpad->irq_out->transfer_buffer_length = 2; -- return usb_submit_urb(xpad->irq_out, GFP_KERNEL); -+ error = xpad_start_xbox_one(xpad); -+ if (error) { -+ usb_kill_urb(xpad->irq_in); -+ return error; -+ } - } - - return 0; - } - --static void xpad_close(struct input_dev *dev) -+static void xpad_stop_input(struct usb_xpad *xpad) - { -- struct usb_xpad *xpad = input_get_drvdata(dev); -+ usb_kill_urb(xpad->irq_in); -+} -+ -+static int xpad360w_start_input(struct usb_xpad *xpad) -+{ -+ int error; -+ -+ error = usb_submit_urb(xpad->irq_in, GFP_KERNEL); -+ if (error) -+ return -EIO; - -- if (xpad->xtype != XTYPE_XBOX360W) -+ /* -+ * Send presence packet. -+ * This will force the controller to resend connection packets. -+ * This is useful in the case we activate the module after the -+ * adapter has been plugged in, as it won't automatically -+ * send us info about the controllers. -+ */ -+ error = xpad_inquiry_pad_presence(xpad); -+ if (error) { - usb_kill_urb(xpad->irq_in); -+ return error; -+ } - -- xpad_stop_output(xpad); -+ return 0; -+} -+ -+static void xpad360w_stop_input(struct usb_xpad *xpad) -+{ -+ usb_kill_urb(xpad->irq_in); -+ -+ /* Make sure we are done with presence work if it was scheduled */ -+ flush_work(&xpad->work); -+} -+ -+static int xpad_open(struct input_dev *dev) -+{ -+ struct usb_xpad *xpad = input_get_drvdata(dev); -+ -+ return xpad_start_input(xpad); -+} -+ -+static void xpad_close(struct input_dev *dev) -+{ -+ struct usb_xpad *xpad = input_get_drvdata(dev); -+ -+ xpad_stop_input(xpad); - } - - static void xpad_set_up_abs(struct input_dev *input_dev, signed short abs) -@@ -1097,8 +1304,11 @@ static void xpad_set_up_abs(struct input_dev *input_dev, signed short abs) - - static void xpad_deinit_input(struct usb_xpad *xpad) - { -- xpad_led_disconnect(xpad); -- input_unregister_device(xpad->dev); -+ if (xpad->input_created) { -+ xpad->input_created = false; -+ xpad_led_disconnect(xpad); -+ input_unregister_device(xpad->dev); -+ } - } - - static int xpad_init_input(struct usb_xpad *xpad) -@@ -1118,8 +1328,10 @@ static int xpad_init_input(struct usb_xpad *xpad) - - input_set_drvdata(input_dev, xpad); - -- input_dev->open = xpad_open; -- input_dev->close = xpad_close; -+ if (xpad->xtype != XTYPE_XBOX360W) { -+ input_dev->open = xpad_open; -+ input_dev->close = xpad_close; -+ } - - __set_bit(EV_KEY, input_dev->evbit); - -@@ -1181,6 +1393,7 @@ static int xpad_init_input(struct usb_xpad *xpad) - if (error) - goto err_disconnect_led; - -+ xpad->input_created = true; - return 0; - - err_disconnect_led: -@@ -1241,6 +1454,7 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id - xpad->mapping = xpad_device[i].mapping; - xpad->xtype = xpad_device[i].xtype; - xpad->name = xpad_device[i].name; -+ INIT_WORK(&xpad->work, xpad_presence_work); - - if (xpad->xtype == XTYPE_UNKNOWN) { - if (intf->cur_altsetting->desc.bInterfaceClass == USB_CLASS_VENDOR_SPEC) { -@@ -1277,10 +1491,6 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id - - usb_set_intfdata(intf, xpad); - -- error = xpad_init_input(xpad); -- if (error) -- goto err_deinit_output; -- - if (xpad->xtype == XTYPE_XBOX360W) { - /* - * Submit the int URB immediately rather than waiting for open -@@ -1289,28 +1499,24 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id - * exactly the message that a controller has arrived that - * we're waiting for. - */ -- xpad->irq_in->dev = xpad->udev; -- error = usb_submit_urb(xpad->irq_in, GFP_KERNEL); -+ error = xpad360w_start_input(xpad); - if (error) -- goto err_deinit_input; -- -+ goto err_deinit_output; - /* -- * Send presence packet. -- * This will force the controller to resend connection packets. -- * This is useful in the case we activate the module after the -- * adapter has been plugged in, as it won't automatically -- * send us info about the controllers. -+ * Wireless controllers require RESET_RESUME to work properly -+ * after suspend. Ideally this quirk should be in usb core -+ * quirk list, but we have too many vendors producing these -+ * controllers and we'd need to maintain 2 identical lists -+ * here in this driver and in usb core. - */ -- error = xpad_inquiry_pad_presence(xpad); -+ udev->quirks |= USB_QUIRK_RESET_RESUME; -+ } else { -+ error = xpad_init_input(xpad); - if (error) -- goto err_kill_in_urb; -+ goto err_deinit_output; - } - return 0; - --err_kill_in_urb: -- usb_kill_urb(xpad->irq_in); --err_deinit_input: -- xpad_deinit_input(xpad); - err_deinit_output: - xpad_deinit_output(xpad); - err_free_in_urb: -@@ -1320,19 +1526,24 @@ err_free_idata: - err_free_mem: - kfree(xpad); - return error; -- - } - - static void xpad_disconnect(struct usb_interface *intf) - { -- struct usb_xpad *xpad = usb_get_intfdata (intf); -+ struct usb_xpad *xpad = usb_get_intfdata(intf); -+ -+ if (xpad->xtype == XTYPE_XBOX360W) -+ xpad360w_stop_input(xpad); - - xpad_deinit_input(xpad); -- xpad_deinit_output(xpad); - -- if (xpad->xtype == XTYPE_XBOX360W) { -- usb_kill_urb(xpad->irq_in); -- } -+ /* -+ * Now that both input device and LED device are gone we can -+ * stop output URB. -+ */ -+ xpad_stop_output(xpad); -+ -+ xpad_deinit_output(xpad); - - usb_free_urb(xpad->irq_in); - usb_free_coherent(xpad->udev, XPAD_PKT_LEN, -@@ -1343,10 +1554,55 @@ static void xpad_disconnect(struct usb_interface *intf) - usb_set_intfdata(intf, NULL); - } - -+static int xpad_suspend(struct usb_interface *intf, pm_message_t message) -+{ -+ struct usb_xpad *xpad = usb_get_intfdata(intf); -+ struct input_dev *input = xpad->dev; -+ -+ if (xpad->xtype == XTYPE_XBOX360W) { -+ /* -+ * Wireless controllers always listen to input so -+ * they are notified when controller shows up -+ * or goes away. -+ */ -+ xpad360w_stop_input(xpad); -+ } else { -+ mutex_lock(&input->mutex); -+ if (input->users) -+ xpad_stop_input(xpad); -+ mutex_unlock(&input->mutex); -+ } -+ -+ xpad_stop_output(xpad); -+ -+ return 0; -+} -+ -+static int xpad_resume(struct usb_interface *intf) -+{ -+ struct usb_xpad *xpad = usb_get_intfdata(intf); -+ struct input_dev *input = xpad->dev; -+ int retval = 0; -+ -+ if (xpad->xtype == XTYPE_XBOX360W) { -+ retval = xpad360w_start_input(xpad); -+ } else { -+ mutex_lock(&input->mutex); -+ if (input->users) -+ retval = xpad_start_input(xpad); -+ mutex_unlock(&input->mutex); -+ } -+ -+ return retval; -+} -+ - static struct usb_driver xpad_driver = { - .name = "xpad", - .probe = xpad_probe, - .disconnect = xpad_disconnect, -+ .suspend = xpad_suspend, -+ .resume = xpad_resume, -+ .reset_resume = xpad_resume, - .id_table = xpad_table, - }; - -@@ -1354,4 +1610,4 @@ module_usb_driver(xpad_driver); - - MODULE_AUTHOR(DRIVER_AUTHOR); - MODULE_DESCRIPTION(DRIVER_DESC); --MODULE_LICENSE("GPL"); -+MODULE_LICENSE("GPL"); -\ No newline at end of file --- -2.5.0 - diff --git a/packages/linux/patches/4.4.5/linux-224_Hauppauge_WinTV-soloHD.patch b/packages/linux/patches/4.4.5/linux-224_Hauppauge_WinTV-soloHD.patch deleted file mode 100644 index e629f83b695..00000000000 --- a/packages/linux/patches/4.4.5/linux-224_Hauppauge_WinTV-soloHD.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 1efc21701d94ed0c5b91467b042bed8b8becd5cc Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Arno=20Bauern=C3=B6ppel?= <arno@aziraphale.net> -Date: Sun, 15 Nov 2015 19:24:10 -0200 -Subject: [media] Add support for dvb usb stick Hauppauge WinTV-soloHD - -This patch adds support for the DVB-T/C/T2 usb stick WinTV-soloHD from -Hauppauge. It adds the usb ID 2040:0264 Hauppauge to the cards of the -driver em28xx. - -I successfully tested DVB-T/C and the IR remote control with the -firmware dvb-demod-si2168-b40-01.fw. - -Signed-off-by: Arno Bauernoeppel <arno@aziraphale.net> -Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com> - -diff --git a/drivers/media/dvb-core/dvb-usb-ids.h b/drivers/media/dvb-core/dvb-usb-ids.h -index 0a46580..1c1c298 100644 ---- a/drivers/media/dvb-core/dvb-usb-ids.h -+++ b/drivers/media/dvb-core/dvb-usb-ids.h -@@ -389,4 +389,5 @@ - #define USB_PID_PCTV_2002E_SE 0x025d - #define USB_PID_SVEON_STV27 0xd3af - #define USB_PID_TURBOX_DTT_2000 0xd3a4 -+#define USB_PID_WINTV_SOLOHD 0x0264 - #endif -diff --git a/drivers/media/usb/em28xx/em28xx-cards.c b/drivers/media/usb/em28xx/em28xx-cards.c -index 5373dce..a1b6ef5 100644 ---- a/drivers/media/usb/em28xx/em28xx-cards.c -+++ b/drivers/media/usb/em28xx/em28xx-cards.c -@@ -2475,6 +2475,8 @@ struct usb_device_id em28xx_id_table[] = { - .driver_info = EM28178_BOARD_PCTV_461E }, - { USB_DEVICE(0x2013, 0x025f), - .driver_info = EM28178_BOARD_PCTV_292E }, -+ { USB_DEVICE(0x2040, 0x0264), /* Hauppauge WinTV-soloHD */ -+ .driver_info = EM28178_BOARD_PCTV_292E }, - { USB_DEVICE(0x0413, 0x6f07), - .driver_info = EM2861_BOARD_LEADTEK_VC100 }, - { USB_DEVICE(0xeb1a, 0x8179), --- -cgit v0.10.2 - diff --git a/packages/linux/patches/4.4.5/linux-228-support-tt-ct2-4650-v2.patch b/packages/linux/patches/4.4.5/linux-228-support-tt-ct2-4650-v2.patch deleted file mode 100644 index bfc9e6bfcae..00000000000 --- a/packages/linux/patches/4.4.5/linux-228-support-tt-ct2-4650-v2.patch +++ /dev/null @@ -1,25 +0,0 @@ -diff -urN a/drivers/media/dvb-core/dvb-usb-ids.h b/drivers/media/dvb-core/dvb-usb-ids.h ---- a/drivers/media/dvb-core/dvb-usb-ids.h 2016-01-11 01:01:32.000000000 +0200 -+++ b/drivers/media/dvb-core/dvb-usb-ids.h 2016-01-13 12:42:17.648388583 +0200 -@@ -247,6 +247,7 @@ - #define USB_PID_TECHNOTREND_CONNECT_CT3650 0x300d - #define USB_PID_TECHNOTREND_CONNECT_S2_4600 0x3011 - #define USB_PID_TECHNOTREND_CONNECT_CT2_4650_CI 0x3012 -+#define USB_PID_TECHNOTREND_CONNECT_CT2_4650_CI_2 0x3015 - #define USB_PID_TECHNOTREND_TVSTICK_CT2_4400 0x3014 - #define USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY 0x005a - #define USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY_2 0x0081 -diff -urN a/drivers/media/usb/dvb-usb-v2/dvbsky.c b/drivers/media/usb/dvb-usb-v2/dvbsky.c ---- a/drivers/media/usb/dvb-usb-v2/dvbsky.c 2016-01-11 01:01:32.000000000 +0200 -+++ b/drivers/media/usb/dvb-usb-v2/dvbsky.c 2016-01-13 12:41:17.480386735 +0200 -@@ -847,6 +847,10 @@ - USB_PID_TECHNOTREND_CONNECT_CT2_4650_CI, - &dvbsky_t680c_props, "TechnoTrend TT-connect CT2-4650 CI", - RC_MAP_TT_1500) }, -+ { DVB_USB_DEVICE(USB_VID_TECHNOTREND, -+ USB_PID_TECHNOTREND_CONNECT_CT2_4650_CI_2, -+ &dvbsky_t680c_props, "TechnoTrend TT-connect CT2-4650 CI v1.1", -+ RC_MAP_TT_1500) }, - { DVB_USB_DEVICE(USB_VID_TERRATEC, - USB_PID_TERRATEC_H7_3, - &dvbsky_t680c_props, "Terratec H7 Rev.4", diff --git a/packages/linux/patches/4.4.5/linux-229-avermedia-volar-hd2.patch b/packages/linux/patches/4.4.5/linux-229-avermedia-volar-hd2.patch deleted file mode 100644 index 1be01a52520..00000000000 --- a/packages/linux/patches/4.4.5/linux-229-avermedia-volar-hd2.patch +++ /dev/null @@ -1,25 +0,0 @@ -taken from https://bugzilla.kernel.org/show_bug.cgi?id=108691 -diff --git a/drivers/media/usb/dvb-usb-v2/af9035.c b/drivers/media/usb/dvb-usb-v2/af9035.c ---- a/drivers/media/usb/dvb-usb-v2/af9035.c -+++ b/drivers/media/usb/dvb-usb-v2/af9035.c -@@ -2053,6 +2053,8 @@ static const struct usb_device_id af9035_id_table[] = { - &af9035_props, "Avermedia A835B(3835)", RC_MAP_IT913X_V2) }, - { DVB_USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_A835B_4835, - &af9035_props, "Avermedia A835B(4835)", RC_MAP_IT913X_V2) }, -+ { DVB_USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_TD110, -+ &af9035_props, "Avermedia AverTV Volar HD 2 (TD110)", RC_MAP_AVERMEDIA_RM_KS) }, - { DVB_USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_H335, - &af9035_props, "Avermedia H335", RC_MAP_IT913X_V2) }, - { DVB_USB_DEVICE(USB_VID_KWORLD_2, USB_PID_KWORLD_UB499_2T_T09, - -diff --git a/drivers/media/dvb-core/dvb-usb-ids.h b/drivers/media/dvb-core/dvb-usb-ids.h ---- a/drivers/media/dvb-core/dvb-usb-ids.h -+++ b/drivers/media/dvb-core/dvb-usb-ids.h -@@ -242,6 +242,7 @@ - #define USB_PID_AVERMEDIA_1867 0x1867 - #define USB_PID_AVERMEDIA_A867 0xa867 - #define USB_PID_AVERMEDIA_H335 0x0335 -+#define USB_PID_AVERMEDIA_TD110 0xa110 - #define USB_PID_AVERMEDIA_TWINSTAR 0x0825 - #define USB_PID_TECHNOTREND_CONNECT_S2400 0x3006 - #define USB_PID_TECHNOTREND_CONNECT_S2400_8KEEPROM 0x3009 diff --git a/packages/linux/patches/4.4.5/linux-003-no_dev_console.patch b/packages/linux/patches/4.6.1/linux-003-no_dev_console.patch similarity index 100% rename from packages/linux/patches/4.4.5/linux-003-no_dev_console.patch rename to packages/linux/patches/4.6.1/linux-003-no_dev_console.patch diff --git a/packages/linux/patches/4.4.5/linux-004-fix-build-with-gcc-5.patch b/packages/linux/patches/4.6.1/linux-004-fix-build-with-gcc-5.patch similarity index 100% rename from packages/linux/patches/4.4.5/linux-004-fix-build-with-gcc-5.patch rename to packages/linux/patches/4.6.1/linux-004-fix-build-with-gcc-5.patch diff --git a/packages/linux/patches/4.4.5/linux-051-ouya_controller_support.patch b/packages/linux/patches/4.6.1/linux-051-ouya_controller_support.patch similarity index 100% rename from packages/linux/patches/4.4.5/linux-051-ouya_controller_support.patch rename to packages/linux/patches/4.6.1/linux-051-ouya_controller_support.patch diff --git a/projects/imx6/patches/linux/linux-052-XBOX_remote_support.patch b/packages/linux/patches/4.6.1/linux-052-XBOX_remote_support.patch similarity index 99% rename from projects/imx6/patches/linux/linux-052-XBOX_remote_support.patch rename to packages/linux/patches/4.6.1/linux-052-XBOX_remote_support.patch index 6b43f9b3154..399739dde0d 100644 --- a/projects/imx6/patches/linux/linux-052-XBOX_remote_support.patch +++ b/packages/linux/patches/4.6.1/linux-052-XBOX_remote_support.patch @@ -4,7 +4,7 @@ diff -Naur linux-3.9.4/drivers/staging/media/lirc/Kconfig linux-3.9.4.patch/driv @@ -63,10 +63,17 @@ help Driver for the SIR IrDA port - + +config LIRC_XBOX + tristate "XBOX USB IR Remote" + depends on LIRC && USB @@ -435,7 +435,7 @@ diff -Naur linux-3.9.4/drivers/staging/media/lirc/lirc_xbox.c linux-3.9.4.patch/ + + case 0: + result = code_check_xbox(iep, len); -+ ++ + if (result < 0) + break; + @@ -823,7 +823,7 @@ diff -Naur linux-3.9.4/drivers/staging/media/lirc/lirc_xbox.c linux-3.9.4.patch/ +} + +/* -+ * If the USB interface has an out endpoint for control. ++ * If the USB interface has an out endpoint for control. + */ +static void send_outbound_init(struct xbox_dev *ir) +{ @@ -1007,16 +1007,16 @@ diff -Naur linux-3.9.4/drivers/staging/media/lirc/lirc_xbox.c linux-3.9.4.patch/ +MODULE_LICENSE("GPL"); +MODULE_DEVICE_TABLE(usb, usb_remote_table); + -+module_param(debug, bool, S_IRUGO | S_IWUSR); ++module_param(debug, uint, S_IRUGO | S_IWUSR); +MODULE_PARM_DESC(debug, "Debug enabled or not (default: 0)"); + -+module_param(mask, int, S_IRUGO | S_IWUSR); ++module_param(mask, uint, S_IRUGO | S_IWUSR); +MODULE_PARM_DESC(mask, "Set channel acceptance bit mask (default: 0xFFFF)"); + -+module_param(unique, bool, S_IRUGO | S_IWUSR); ++module_param(unique, uint, S_IRUGO | S_IWUSR); +MODULE_PARM_DESC(unique, "Enable channel-specific codes (default: 0)"); + -+module_param(repeat, int, S_IRUGO | S_IWUSR); ++module_param(repeat, uint, S_IRUGO | S_IWUSR); +MODULE_PARM_DESC(repeat, "Repeat timeout (1/100 sec) (default: 10)"); diff -Naur linux-3.9.4/drivers/staging/media/lirc/Makefile linux-3.9.4.patch/drivers/staging/media/lirc/Makefile --- linux-3.9.4/drivers/staging/media/lirc/Makefile 2013-05-24 20:45:59.000000000 +0200 diff --git a/packages/linux/patches/4.4.5/linux-053-spinelplus-remote-0.2.patch b/packages/linux/patches/4.6.1/linux-053-spinelplus-remote-0.2.patch similarity index 100% rename from packages/linux/patches/4.4.5/linux-053-spinelplus-remote-0.2.patch rename to packages/linux/patches/4.6.1/linux-053-spinelplus-remote-0.2.patch diff --git a/packages/linux/patches/4.4.5/linux-054-nuvoton_revert_d7b290a1056c5564eec8a1b169c6e84ff3.6.114c13.patch b/packages/linux/patches/4.6.1/linux-054-nuvoton_revert_d7b290a1056c5564eec8a1b169c6e84ff3.6.114c13.patch similarity index 100% rename from packages/linux/patches/4.4.5/linux-054-nuvoton_revert_d7b290a1056c5564eec8a1b169c6e84ff3.6.114c13.patch rename to packages/linux/patches/4.6.1/linux-054-nuvoton_revert_d7b290a1056c5564eec8a1b169c6e84ff3.6.114c13.patch diff --git a/packages/linux/patches/4.4.5/linux-056-add_Adaptec_eHome_Infrared_Receiver.patch b/packages/linux/patches/4.6.1/linux-056-add_Adaptec_eHome_Infrared_Receiver.patch similarity index 100% rename from packages/linux/patches/4.4.5/linux-056-add_Adaptec_eHome_Infrared_Receiver.patch rename to packages/linux/patches/4.6.1/linux-056-add_Adaptec_eHome_Infrared_Receiver.patch diff --git a/packages/linux/patches/4.4.5/linux-057-Removed-MCE-customer-code-restriction-in-rc6-decode.patch b/packages/linux/patches/4.6.1/linux-057-Removed-MCE-customer-code-restriction-in-rc6-decode.patch similarity index 100% rename from packages/linux/patches/4.4.5/linux-057-Removed-MCE-customer-code-restriction-in-rc6-decode.patch rename to packages/linux/patches/4.6.1/linux-057-Removed-MCE-customer-code-restriction-in-rc6-decode.patch diff --git a/packages/linux/patches/4.4.5/linux-057-add_SMK_Manufacturing_Inc_Infrared_Receiver.patch b/packages/linux/patches/4.6.1/linux-057-add_SMK_Manufacturing_Inc_Infrared_Receiver.patch similarity index 100% rename from packages/linux/patches/4.4.5/linux-057-add_SMK_Manufacturing_Inc_Infrared_Receiver.patch rename to packages/linux/patches/4.6.1/linux-057-add_SMK_Manufacturing_Inc_Infrared_Receiver.patch diff --git a/packages/linux/patches/4.4.5/linux-058.05-hid_sony-add_autorepeat_for_PS3_remotes.patch b/packages/linux/patches/4.6.1/linux-058.05-hid_sony-add_autorepeat_for_PS3_remotes.patch similarity index 83% rename from packages/linux/patches/4.4.5/linux-058.05-hid_sony-add_autorepeat_for_PS3_remotes.patch rename to packages/linux/patches/4.6.1/linux-058.05-hid_sony-add_autorepeat_for_PS3_remotes.patch index c3d77a70289..56e2ca86551 100644 --- a/packages/linux/patches/4.4.5/linux-058.05-hid_sony-add_autorepeat_for_PS3_remotes.patch +++ b/packages/linux/patches/4.6.1/linux-058.05-hid_sony-add_autorepeat_for_PS3_remotes.patch @@ -3,7 +3,7 @@ From: Stefan Saraev <stefan@saraev.ca> Date: Tue, 22 Apr 2014 16:05:14 +0300 Subject: [PATCH] [RFC] hid/sony: add autorepeat for PS3 remotes -adapted to 3.17 +adapted to 4.6 Betreff: [RFC] hid/sony: add autorepeat for PS3 remotes Von: David Dillow <dave@thedillows.org> @@ -23,15 +23,17 @@ some demand. This compiled against the hid-sony driver with the PS3 remote changes merged, but I have done no testing of it. If the approach seems reasonable, I'll try to test it when the MythTV is idle. + +Signed-off-by: Matt DeVillier <matt.devillier@gmail.com> --- drivers/hid/hid-sony.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c -index 661f94f..2256e35 100644 +index 310436a..84f7f41 100644 --- a/drivers/hid/hid-sony.c +++ b/drivers/hid/hid-sony.c -@@ -1111,6 +1111,25 @@ static int ps3remote_mapping(struct hid_device *hdev, struct hid_input *hi, +@@ -1120,6 +1120,25 @@ static int ps3remote_mapping(struct hid_device *hdev, struct hid_input *hi, return 1; } @@ -54,17 +56,17 @@ index 661f94f..2256e35 100644 + return 0; +} + - static __u8 *sony_report_fixup(struct hid_device *hdev, __u8 *rdesc, + static u8 *sony_report_fixup(struct hid_device *hdev, u8 *rdesc, unsigned int *rsize) { -@@ -2339,6 +2358,8 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id) - sony_init_work(sc, dualshock4_state_worker); +@@ -2372,6 +2391,8 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id) + sony_init_output_report(sc, dualshock4_send_output_report); } else if (sc->quirks & MOTION_CONTROLLER) { - sony_init_work(sc, motion_state_worker); + sony_init_output_report(sc, motion_send_output_report); + } else if (sc->quirks & PS3REMOTE) { + ret = ps3remote_setup_repeat(hdev); } else { ret = 0; } -- -1.9.1 +2.5.0 diff --git a/packages/linux/patches/4.4.5/linux-062-imon_pad_ignore_diagonal.patch b/packages/linux/patches/4.6.1/linux-062-imon_pad_ignore_diagonal.patch similarity index 100% rename from packages/linux/patches/4.4.5/linux-062-imon_pad_ignore_diagonal.patch rename to packages/linux/patches/4.6.1/linux-062-imon_pad_ignore_diagonal.patch diff --git a/packages/linux/patches/4.6.1/linux-063-xpad-add-3rdparty-controllers.patch b/packages/linux/patches/4.6.1/linux-063-xpad-add-3rdparty-controllers.patch new file mode 100644 index 00000000000..e05f92fa9a7 --- /dev/null +++ b/packages/linux/patches/4.6.1/linux-063-xpad-add-3rdparty-controllers.patch @@ -0,0 +1,34 @@ +From 627e828fcf1bb9fc71dbbeca29acd33162efb448 Mon Sep 17 00:00:00 2001 +From: Matt DeVillier <matt.devillier@gmail.com> +Date: Wed, 2 Mar 2016 23:11:33 -0600 +Subject: [PATCH 1/1] linux/drivers/input/joystick/xpad: add support for 3rd party XBONE controllers + +linux/drivers/input/joystick/xpad: add support for 3rd party XBONE controllers + +Signed-off-by: Matt DeVillier <matt.devillier@gmail.com> +--- + drivers/input/joystick/xpad.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c +index e8a84d1..d1ab48a 100644 +--- a/drivers/input/joystick/xpad.c ++++ b/drivers/input/joystick/xpad.c +@@ -129,6 +129,7 @@ static const struct xpad_device { + { 0x045e, 0x028e, "Microsoft X-Box 360 pad", 0, XTYPE_XBOX360 }, + { 0x045e, 0x02d1, "Microsoft X-Box One pad", 0, XTYPE_XBOXONE }, + { 0x045e, 0x02dd, "Microsoft X-Box One pad (Firmware 2015)", 0, XTYPE_XBOXONE }, ++ { 0x0e6f, 0x0139, "Afterglow Prismatic Wired Controller", 0, XTYPE_XBOXONE }, + { 0x045e, 0x0291, "Xbox 360 Wireless Receiver (XBOX)", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360W }, + { 0x045e, 0x0719, "Xbox 360 Wireless Receiver", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360W }, + { 0x044f, 0x0f07, "Thrustmaster, Inc. Controller", 0, XTYPE_XBOX }, +@@ -301,6 +302,7 @@ static struct usb_device_id xpad_table[] = { + XPAD_XBOX360_VENDOR(0x044f), /* Thrustmaster X-Box 360 controllers */ + XPAD_XBOX360_VENDOR(0x045e), /* Microsoft X-Box 360 controllers */ + XPAD_XBOXONE_VENDOR(0x045e), /* Microsoft X-Box One controllers */ ++ XPAD_XBOXONE_VENDOR(0x0e6f), /* 0x0e6f X-Box One controllers */ + XPAD_XBOX360_VENDOR(0x046d), /* Logitech X-Box 360 style controllers */ + XPAD_XBOX360_VENDOR(0x0738), /* Mad Catz X-Box 360 controllers */ + { USB_DEVICE(0x0738, 0x4540) }, /* Mad Catz Beat Pad */ +-- +2.5.0 diff --git a/packages/linux/patches/4.4.5/linux-203-stb0899_enable_low_symbol_rate.patch b/packages/linux/patches/4.6.1/linux-203-stb0899_enable_low_symbol_rate.patch similarity index 100% rename from packages/linux/patches/4.4.5/linux-203-stb0899_enable_low_symbol_rate.patch rename to packages/linux/patches/4.6.1/linux-203-stb0899_enable_low_symbol_rate.patch diff --git a/packages/linux/patches/4.4.5/linux-212-mantis_stb0899_faster_lock.patch b/packages/linux/patches/4.6.1/linux-212-mantis_stb0899_faster_lock.patch similarity index 100% rename from packages/linux/patches/4.4.5/linux-212-mantis_stb0899_faster_lock.patch rename to packages/linux/patches/4.6.1/linux-212-mantis_stb0899_faster_lock.patch diff --git a/packages/linux/patches/4.4.5/linux-221-ngene-octopus.todo b/packages/linux/patches/4.6.1/linux-221-ngene-octopus.todo similarity index 100% rename from packages/linux/patches/4.4.5/linux-221-ngene-octopus.todo rename to packages/linux/patches/4.6.1/linux-221-ngene-octopus.todo diff --git a/packages/linux/patches/4.4.5/linux-222-stb0899_signal_quality.patch b/packages/linux/patches/4.6.1/linux-222-stb0899_signal_quality.patch similarity index 100% rename from packages/linux/patches/4.4.5/linux-222-stb0899_signal_quality.patch rename to packages/linux/patches/4.6.1/linux-222-stb0899_signal_quality.patch diff --git a/packages/linux/patches/4.4.5/linux-223-Fix-video-artifacts-with-tt-3600-s2-usb.patch b/packages/linux/patches/4.6.1/linux-223-Fix-video-artifacts-with-tt-3600-s2-usb.patch similarity index 100% rename from packages/linux/patches/4.4.5/linux-223-Fix-video-artifacts-with-tt-3600-s2-usb.patch rename to packages/linux/patches/4.6.1/linux-223-Fix-video-artifacts-with-tt-3600-s2-usb.patch diff --git a/packages/linux/patches/4.4.5/linux-227-ds3000-invalid-symbol-rate.patch b/packages/linux/patches/4.6.1/linux-227-ds3000-invalid-symbol-rate.patch similarity index 100% rename from packages/linux/patches/4.4.5/linux-227-ds3000-invalid-symbol-rate.patch rename to packages/linux/patches/4.6.1/linux-227-ds3000-invalid-symbol-rate.patch diff --git a/packages/linux/patches/4.4.5/linux-230-elgato-eyetv-sat-v3.patch b/packages/linux/patches/4.6.1/linux-230-elgato-eyetv-sat-v3.patch similarity index 100% rename from packages/linux/patches/4.4.5/linux-230-elgato-eyetv-sat-v3.patch rename to packages/linux/patches/4.6.1/linux-230-elgato-eyetv-sat-v3.patch diff --git a/packages/linux/patches/4.6.1/linux-231-Terratec-Cinergy-S2-Rev.3.patch b/packages/linux/patches/4.6.1/linux-231-Terratec-Cinergy-S2-Rev.3.patch new file mode 100644 index 00000000000..c662155e746 --- /dev/null +++ b/packages/linux/patches/4.6.1/linux-231-Terratec-Cinergy-S2-Rev.3.patch @@ -0,0 +1,51 @@ +From: cvh <namerp@googlemail.com> +Date: Sun, 29 May 2016 23:00:40 +0200 +Subject: [PATCH] [media] Add support for Terratec Cinergy S2 Rev.3 + +--- + drivers/media/usb/dvb-usb/dw2102.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/drivers/media/usb/dvb-usb/dw2102.c b/drivers/media/usb/dvb-usb/dw2102.c +index 49b55d7..961f64e 100644 +--- a/drivers/media/usb/dvb-usb/dw2102.c ++++ b/drivers/media/usb/dvb-usb/dw2102.c +@@ -1641,6 +1641,7 @@ enum dw2102_table_entry { + TEVII_S421, + TEVII_S632, + TERRATEC_CINERGY_S2_R2, ++ TERRATEC_CINERGY_S2_R3, + GOTVIEW_SAT_HD, + GENIATECH_T220, + TECHNOTREND_S2_4600, +@@ -1669,6 +1670,7 @@ static struct usb_device_id dw2102_table[] = { + [TEVII_S421] = {USB_DEVICE(0x9022, USB_PID_TEVII_S421)}, + [TEVII_S632] = {USB_DEVICE(0x9022, USB_PID_TEVII_S632)}, + [TERRATEC_CINERGY_S2_R2] = {USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_S2_R2)}, ++ [TERRATEC_CINERGY_S2_R3] = {USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_S2_R3)}, + [GOTVIEW_SAT_HD] = {USB_DEVICE(0x1FE1, USB_PID_GOTVIEW_SAT_HD)}, + [GENIATECH_T220] = {USB_DEVICE(0x1f4d, 0xD220)}, + [TECHNOTREND_S2_4600] = {USB_DEVICE(USB_VID_TECHNOTREND, +@@ -2083,7 +2085,7 @@ static struct dvb_usb_device_properties su3000_properties = { + }}, + } + }, +- .num_device_descs = 5, ++ .num_device_descs = 6, + .devices = { + { "SU3000HD DVB-S USB2.0", + { &dw2102_table[GENIATECH_SU3000], NULL }, +@@ -2101,6 +2103,10 @@ static struct dvb_usb_device_properties su3000_properties = { + { &dw2102_table[TERRATEC_CINERGY_S2_R2], NULL }, + { NULL }, + }, ++ { "Terratec Cinergy S2 USB HD Rev.3", ++ { &dw2102_table[TERRATEC_CINERGY_S2_R3], NULL }, ++ { NULL }, ++ }, + { "GOTVIEW Satellite HD", + { &dw2102_table[GOTVIEW_SAT_HD], NULL }, + { NULL }, +-- +2.7.4 + diff --git a/packages/linux/patches/4.4.5/linux-950-saa716x_PCIe_interface_chipset.patch b/packages/linux/patches/4.6.1/linux-950-saa716x_PCIe_interface_chipset.patch.todo similarity index 100% rename from packages/linux/patches/4.4.5/linux-950-saa716x_PCIe_interface_chipset.patch rename to packages/linux/patches/4.6.1/linux-950-saa716x_PCIe_interface_chipset.patch.todo diff --git a/packages/linux/patches/4.4.5/linux-990.06-hda-Avoid-outputting-HDMI-audio-before-prepare-.patch b/packages/linux/patches/4.6.1/linux-990.06-hda-Avoid-outputting-HDMI-audio-before-prepare-.patch similarity index 84% rename from packages/linux/patches/4.4.5/linux-990.06-hda-Avoid-outputting-HDMI-audio-before-prepare-.patch rename to packages/linux/patches/4.6.1/linux-990.06-hda-Avoid-outputting-HDMI-audio-before-prepare-.patch index 4fe58e69b3c..a3de53495cc 100644 --- a/packages/linux/patches/4.4.5/linux-990.06-hda-Avoid-outputting-HDMI-audio-before-prepare-.patch +++ b/packages/linux/patches/4.6.1/linux-990.06-hda-Avoid-outputting-HDMI-audio-before-prepare-.patch @@ -1,9 +1,10 @@ -From 56ca3555ed8e0f5fd741477fd23497f5455c3f53 Mon Sep 17 00:00:00 2001 +From 203eaba8afbb984349b0b11e4e3d4e5d3eb4df4b Mon Sep 17 00:00:00 2001 From: Stefan Saraev <stefan@saraev.ca> -Date: Tue, 22 Apr 2014 15:58:50 +0300 -Subject: [PATCH] ALSA: hda - Avoid outputting HDMI audio before prepare() and after close() +Date: Mon, 18 Apr 2016 23:51:56 +0300 +Subject: [PATCH] ALSA: hda - Avoid outputting HDMI audio before prepare() and + after close() -adapted to 3.15 +adapted to 4.6 From a6024295fd3290a8c9c5519a03316081ee82378a Mon Sep 17 00:00:00 2001 From: Anssi Hannula <anssi.hannula@iki.fi> @@ -43,14 +44,14 @@ Intel PantherPoint was done by myself. Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi> Cc: stable@vger.kernel.org --- - sound/pci/hda/patch_hdmi.c | 14 ++++++++++++++ - 1 files changed, 14 insertions(+), 0 deletions(-) + sound/pci/hda/patch_hdmi.c | 14 ++++++++++++++ + 1 file changed, 14 insertions(+) diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c -index 0cb5b89..e92f24f 100644 +index 5af372d..18bad9a 100644 --- a/sound/pci/hda/patch_hdmi.c +++ b/sound/pci/hda/patch_hdmi.c -@@ -1698,6 +1698,14 @@ static int hdmi_add_cvt(struct hda_codec *codec, hda_nid_t cvt_nid) +@@ -1630,6 +1630,14 @@ static int hdmi_add_cvt(struct hda_codec *codec, hda_nid_t cvt_nid) if (err < 0) return err; @@ -65,7 +66,7 @@ index 0cb5b89..e92f24f 100644 if (spec->num_cvts < ARRAY_SIZE(spec->cvt_nids)) spec->cvt_nids[spec->num_cvts] = cvt_nid; spec->num_cvts++; -@@ -1823,6 +1831,12 @@ static int hdmi_pcm_close(struct hda_pcm_stream *hinfo, +@@ -1783,6 +1791,12 @@ static int hdmi_pcm_close(struct hda_pcm_stream *hinfo, int pinctl; if (hinfo->nid) { @@ -75,9 +76,11 @@ index 0cb5b89..e92f24f 100644 + */ + __snd_hda_codec_cleanup_stream(codec, hinfo->nid, 1); + - cvt_idx = cvt_nid_to_cvt_index(codec, hinfo->nid); - if (snd_BUG_ON(cvt_idx < 0)) + pcm_idx = hinfo_to_pcm_index(codec, hinfo); + if (snd_BUG_ON(pcm_idx < 0)) return -EINVAL; -- -1.7.2.5 +2.7.4 + + diff --git a/packages/linux/patches/4.4.5/linux-999-i915-implement-passthrough-colors.patch b/packages/linux/patches/4.6.1/linux-999-i915-implement-passthrough-colors.patch similarity index 100% rename from packages/linux/patches/4.4.5/linux-999-i915-implement-passthrough-colors.patch rename to packages/linux/patches/4.6.1/linux-999-i915-implement-passthrough-colors.patch diff --git a/packages/linux/patches/4.4.5/linux-999-i915-use-legacy-turbo.patch b/packages/linux/patches/4.6.1/linux-999-i915-use-legacy-turbo.patch similarity index 67% rename from packages/linux/patches/4.4.5/linux-999-i915-use-legacy-turbo.patch rename to packages/linux/patches/4.6.1/linux-999-i915-use-legacy-turbo.patch index ad413e55f6e..a8df9d68d2f 100644 --- a/packages/linux/patches/4.4.5/linux-999-i915-use-legacy-turbo.patch +++ b/packages/linux/patches/4.6.1/linux-999-i915-use-legacy-turbo.patch @@ -1,22 +1,22 @@ -From 5a59cc60d323c3b50f3afa4b9949f97f2bd05ed0 Mon Sep 17 00:00:00 2001 -From: fritsch <Peter.Fruehberger@gmail.com> -Date: Thu, 11 Jun 2015 11:02:01 +0300 -Subject: [PATCH] i915_irq: enable legacy turbo +From aefcd1a6b1ec22e4e0d26eb932b618c5d12f7e9c Mon Sep 17 00:00:00 2001 +From: fritsch <peter.fruehberger@gmail.com> +Date: Sun, 21 Feb 2016 12:39:16 +0100 +Subject: [PATCH] i915_irq: enable legacy turbo (4.6) --- drivers/gpu/drm/i915/i915_irq.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c -index 6d49443..2367009 100644 +index 1c21220..6507643 100644 --- a/drivers/gpu/drm/i915/i915_irq.c +++ b/drivers/gpu/drm/i915/i915_irq.c -@@ -4235,12 +4235,7 @@ void intel_irq_init(struct drm_i915_private *dev_priv) +@@ -4557,12 +4557,7 @@ void intel_irq_init(struct drm_i915_private *dev_priv) INIT_WORK(&dev_priv->rps.work, gen6_pm_rps_work); INIT_WORK(&dev_priv->l3_parity.error_work, ivybridge_parity_work); - /* Let's track the enabled rps events */ -- if (IS_VALLEYVIEW(dev_priv) && !IS_CHERRYVIEW(dev_priv)) +- if (IS_VALLEYVIEW(dev_priv)) - /* WaGsvRC0ResidencyMethod:vlv */ - dev_priv->pm_rps_events = GEN6_PM_RP_DOWN_EI_EXPIRED | GEN6_PM_RP_UP_EI_EXPIRED; - else @@ -25,6 +25,3 @@ index 6d49443..2367009 100644 INIT_DELAYED_WORK(&dev_priv->gpu_error.hangcheck_work, i915_hangcheck_elapsed); --- -2.1.4 - diff --git a/packages/linux/patches/4.4.5/linux-999.02-0001-pm-disable-async-suspend-resume-by-default.patch b/packages/linux/patches/4.6.1/linux-999.02-0001-pm-disable-async-suspend-resume-by-default.patch similarity index 100% rename from packages/linux/patches/4.4.5/linux-999.02-0001-pm-disable-async-suspend-resume-by-default.patch rename to packages/linux/patches/4.6.1/linux-999.02-0001-pm-disable-async-suspend-resume-by-default.patch diff --git a/packages/linux/patches/4.4.5/linux-999.05-eMMC-Don-t-initialize-partitions-on-RPMB-flagged-are.patch b/packages/linux/patches/4.6.1/linux-999.05-eMMC-Don-t-initialize-partitions-on-RPMB-flagged-are.patch similarity index 100% rename from packages/linux/patches/4.4.5/linux-999.05-eMMC-Don-t-initialize-partitions-on-RPMB-flagged-are.patch rename to packages/linux/patches/4.6.1/linux-999.05-eMMC-Don-t-initialize-partitions-on-RPMB-flagged-are.patch diff --git a/packages/linux/patches/linux-006_enable_utf8.patch b/packages/linux/patches/linux-006_enable_utf8.patch deleted file mode 100644 index bee1cf3da8e..00000000000 --- a/packages/linux/patches/linux-006_enable_utf8.patch +++ /dev/null @@ -1,25 +0,0 @@ -diff -Naur linux-2.6.31-rc4.orig/fs/fat/inode.c linux-2.6.31-rc4/fs/fat/inode.c ---- linux-2.6.31-rc4.orig/fs/fat/inode.c 2009-07-25 12:47:41.000000000 +0200 -+++ linux-2.6.31-rc4/fs/fat/inode.c 2009-07-25 13:38:18.000000000 +0200 -@@ -979,7 +979,8 @@ - } - opts->name_check = 'n'; - opts->quiet = opts->showexec = opts->sys_immutable = opts->dotsOK = 0; -- opts->utf8 = opts->unicode_xlate = 0; -+ opts->utf8 = 1; -+ opts->unicode_xlate = 0; - opts->numtail = 1; - opts->usefree = opts->nocase = 0; - opts->tz_utc = 0; -diff -Naur linux-2.6.31-rc4.orig/fs/isofs/inode.c linux-2.6.31-rc4/fs/isofs/inode.c ---- linux-2.6.31-rc4.orig/fs/isofs/inode.c 2009-07-25 12:47:41.000000000 +0200 -+++ linux-2.6.31-rc4/fs/isofs/inode.c 2009-07-25 13:38:49.000000000 +0200 -@@ -377,7 +377,7 @@ - popt->gid = 0; - popt->uid = 0; - popt->iocharset = NULL; -- popt->utf8 = 0; -+ popt->utf8 = 1; - popt->overriderockperm = 0; - popt->session=-1; - popt->sbsector=-1; diff --git a/packages/mediacenter/OpenELEC-settings/package.mk b/packages/mediacenter/LibreELEC-settings/package.mk similarity index 63% rename from packages/mediacenter/OpenELEC-settings/package.mk rename to packages/mediacenter/LibreELEC-settings/package.mk index 4b7937bb605..25f804827df 100644 --- a/packages/mediacenter/OpenELEC-settings/package.mk +++ b/packages/mediacenter/LibreELEC-settings/package.mk @@ -16,18 +16,19 @@ # along with OpenELEC. If not, see <http://www.gnu.org/licenses/>. ################################################################################ -PKG_NAME="OpenELEC-settings" -PKG_VERSION="0.6.12" +PKG_NAME="LibreELEC-settings" +PKG_VERSION="c0aa38f" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="prop." -PKG_SITE="http://www.openelec.tv" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_SITE="https://libreelec.tv" +PKG_URL="https://github.com/LibreELEC/service.libreelec.settings/archive/$PKG_VERSION.tar.gz" +PKG_SOURCE_DIR="service.libreelec.settings-$PKG_VERSION*" PKG_DEPENDS_TARGET="toolchain Python connman pygobject dbus-python" PKG_PRIORITY="optional" PKG_SECTION="" -PKG_SHORTDESC="OpenELEC-settings: Settings dialog for OpenELEC" -PKG_LONGDESC="OpenELEC-settings: is a settings dialog for OpenELEC" +PKG_SHORTDESC="LibreELEC-settings: Settings dialog for LibreELEC" +PKG_LONGDESC="LibreELEC-settings: is a settings dialog for LibreELEC" PKG_IS_ADDON="no" PKG_AUTORECONF="no" @@ -40,20 +41,27 @@ else PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET bkeymaps" fi +post_unpack() { + if [ -e $DISTRO_DIR/$DISTRO/OpenELEC-settings/ ]; then + mkdir -p $ROOT/$PKG_BUILD/textures/$DISTRO + cp -r $DISTRO_DIR/$DISTRO/OpenELEC-settings/textures/* $ROOT/$PKG_BUILD/textures/$DISTRO + fi +} + post_makeinstall_target() { - mkdir -p $INSTALL/usr/lib/openelec - cp $PKG_DIR/scripts/* $INSTALL/usr/lib/openelec + mkdir -p $INSTALL/usr/lib/libreelec + cp $PKG_DIR/scripts/* $INSTALL/usr/lib/libreelec # # bluetooth is optional # if [ ! "$BLUETOOTH_SUPPORT" = yes ]; then # rm -f resources/lib/modules/bluetooth.py # fi - python -Wi -t -B $ROOT/$TOOLCHAIN/lib/python2.7/compileall.py $INSTALL/usr/share/kodi/addons/service.openelec.settings/resources/lib/ -f - rm -rf `find $INSTALL/usr/share/kodi/addons/service.openelec.settings/resources/lib/ -name "*.py"` + python -Wi -t -B $ROOT/$TOOLCHAIN/lib/python2.7/compileall.py $INSTALL/usr/share/kodi/addons/service.libreelec.settings/resources/lib/ -f + rm -rf `find $INSTALL/usr/share/kodi/addons/service.libreelec.settings/resources/lib/ -name "*.py"` - python -Wi -t -B $ROOT/$TOOLCHAIN/lib/python2.7/compileall.py $INSTALL/usr/share/kodi/addons/service.openelec.settings/oe.py -f - rm -rf $INSTALL/usr/share/kodi/addons/service.openelec.settings/oe.py + python -Wi -t -B $ROOT/$TOOLCHAIN/lib/python2.7/compileall.py $INSTALL/usr/share/kodi/addons/service.libreelec.settings/oe.py -f + rm -rf $INSTALL/usr/share/kodi/addons/service.libreelec.settings/oe.py } post_install() { diff --git a/packages/mediacenter/OpenELEC-settings/scripts/backup-restore b/packages/mediacenter/LibreELEC-settings/scripts/backup-restore similarity index 100% rename from packages/mediacenter/OpenELEC-settings/scripts/backup-restore rename to packages/mediacenter/LibreELEC-settings/scripts/backup-restore diff --git a/packages/mediacenter/OpenELEC-settings/scripts/factory-reset b/packages/mediacenter/LibreELEC-settings/scripts/factory-reset similarity index 100% rename from packages/mediacenter/OpenELEC-settings/scripts/factory-reset rename to packages/mediacenter/LibreELEC-settings/scripts/factory-reset diff --git a/packages/mediacenter/OpenELEC-settings/system.d/backup-restore.service b/packages/mediacenter/LibreELEC-settings/system.d/backup-restore.service similarity index 77% rename from packages/mediacenter/OpenELEC-settings/system.d/backup-restore.service rename to packages/mediacenter/LibreELEC-settings/system.d/backup-restore.service index abc385d2453..25f06e85891 100644 --- a/packages/mediacenter/OpenELEC-settings/system.d/backup-restore.service +++ b/packages/mediacenter/LibreELEC-settings/system.d/backup-restore.service @@ -4,7 +4,7 @@ DefaultDependencies=no [Service] Type=idle -ExecStart=/usr/lib/openelec/backup-restore +ExecStart=/usr/lib/libreelec/backup-restore StandardInput=tty-force StandardOutput=inherit StandardError=inherit diff --git a/packages/mediacenter/OpenELEC-settings/system.d/backup-restore.target b/packages/mediacenter/LibreELEC-settings/system.d/backup-restore.target similarity index 100% rename from packages/mediacenter/OpenELEC-settings/system.d/backup-restore.target rename to packages/mediacenter/LibreELEC-settings/system.d/backup-restore.target diff --git a/packages/mediacenter/OpenELEC-settings/system.d/factory-reset.service b/packages/mediacenter/LibreELEC-settings/system.d/factory-reset.service similarity index 77% rename from packages/mediacenter/OpenELEC-settings/system.d/factory-reset.service rename to packages/mediacenter/LibreELEC-settings/system.d/factory-reset.service index 70aa5e2bd81..5b25d73d0a8 100644 --- a/packages/mediacenter/OpenELEC-settings/system.d/factory-reset.service +++ b/packages/mediacenter/LibreELEC-settings/system.d/factory-reset.service @@ -4,7 +4,7 @@ DefaultDependencies=no [Service] Type=idle -ExecStart=/usr/lib/openelec/factory-reset +ExecStart=/usr/lib/libreelec/factory-reset StandardInput=tty-force StandardOutput=inherit StandardError=inherit diff --git a/packages/mediacenter/OpenELEC-settings/system.d/factory-reset.target b/packages/mediacenter/LibreELEC-settings/system.d/factory-reset.target similarity index 100% rename from packages/mediacenter/OpenELEC-settings/system.d/factory-reset.target rename to packages/mediacenter/LibreELEC-settings/system.d/factory-reset.target diff --git a/packages/mediacenter/kodi-binary-addons/adsp.basic/package.mk b/packages/mediacenter/kodi-binary-addons/adsp.basic/package.mk index 8eb6b79283e..051f05e4160 100644 --- a/packages/mediacenter/kodi-binary-addons/adsp.basic/package.mk +++ b/packages/mediacenter/kodi-binary-addons/adsp.basic/package.mk @@ -17,12 +17,12 @@ ################################################################################ PKG_NAME="adsp.basic" -PKG_VERSION="cb56e0e" +PKG_VERSION="5cf12e8" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.kodi.tv" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_URL="https://github.com/kodi-adsp/adsp.basic/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain kodi-platform libsamplerate" PKG_PRIORITY="optional" PKG_SECTION="" @@ -45,6 +45,8 @@ configure_target() { addon() { mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PR $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PL $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/*.so $ADDON_BUILD/$PKG_ADDON_ID/ + cp -R $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ + + ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) + cp -L $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ } diff --git a/packages/mediacenter/kodi-binary-addons/adsp.biquad.filters/package.mk b/packages/mediacenter/kodi-binary-addons/adsp.biquad.filters/package.mk index 89195549b1d..515e4ad0f64 100644 --- a/packages/mediacenter/kodi-binary-addons/adsp.biquad.filters/package.mk +++ b/packages/mediacenter/kodi-binary-addons/adsp.biquad.filters/package.mk @@ -17,12 +17,12 @@ ################################################################################ PKG_NAME="adsp.biquad.filters" -PKG_VERSION="d63d8ac" +PKG_VERSION="af575f3" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.kodi.tv" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_URL="https://github.com/kodi-adsp/adsp.biquad.filters/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain kodi-platform asplib tinyxml" PKG_PRIORITY="optional" PKG_SECTION="" @@ -45,6 +45,8 @@ configure_target() { addon() { mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PR $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PL $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/*.so $ADDON_BUILD/$PKG_ADDON_ID/ + cp -R $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ + + ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) + cp -L $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ } diff --git a/packages/mediacenter/kodi-binary-addons/adsp.freesurround/package.mk b/packages/mediacenter/kodi-binary-addons/adsp.freesurround/package.mk index 929762c428e..55d2f4bdab1 100644 --- a/packages/mediacenter/kodi-binary-addons/adsp.freesurround/package.mk +++ b/packages/mediacenter/kodi-binary-addons/adsp.freesurround/package.mk @@ -17,12 +17,12 @@ ################################################################################ PKG_NAME="adsp.freesurround" -PKG_VERSION="08b691d" +PKG_VERSION="6dc533b" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.kodi.tv" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_URL="https://github.com/kodi-adsp/adsp.freesurround/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain kodi-platform" PKG_PRIORITY="optional" PKG_SECTION="" @@ -45,6 +45,8 @@ configure_target() { addon() { mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PR $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PL $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/*.so $ADDON_BUILD/$PKG_ADDON_ID/ + cp -R $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ + + ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) + cp -L $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ } diff --git a/packages/mediacenter/kodi-binary-addons/audiodecoder.2sf/package.mk b/packages/mediacenter/kodi-binary-addons/audiodecoder.2sf/package.mk index d231493a9dc..c51661b622d 100644 --- a/packages/mediacenter/kodi-binary-addons/audiodecoder.2sf/package.mk +++ b/packages/mediacenter/kodi-binary-addons/audiodecoder.2sf/package.mk @@ -22,7 +22,7 @@ PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="https://github.com/notspiff/audiodecoder.2sf" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_URL="https://github.com/notspiff/audiodecoder.2sf/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain kodi-platform" PKG_PRIORITY="optional" PKG_SECTION="" @@ -43,6 +43,8 @@ configure_target() { addon() { mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PR $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PL $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/*.so $ADDON_BUILD/$PKG_ADDON_ID/ + cp -R $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ + + ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) + cp -L $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ } diff --git a/packages/mediacenter/kodi-binary-addons/audiodecoder.asap/package.mk b/packages/mediacenter/kodi-binary-addons/audiodecoder.asap/package.mk index 42999fd6e25..f37ef23e5fb 100644 --- a/packages/mediacenter/kodi-binary-addons/audiodecoder.asap/package.mk +++ b/packages/mediacenter/kodi-binary-addons/audiodecoder.asap/package.mk @@ -22,7 +22,7 @@ PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="https://github.com/notspiff/audiodecoder.asap" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_URL="https://github.com/notspiff/audiodecoder.asap/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain kodi-platform" PKG_PRIORITY="optional" PKG_SECTION="" @@ -43,6 +43,8 @@ configure_target() { addon() { mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PR $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PL $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/*.so $ADDON_BUILD/$PKG_ADDON_ID/ + cp -R $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ + + ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) + cp -L $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ } diff --git a/packages/mediacenter/kodi-binary-addons/audiodecoder.dumb/package.mk b/packages/mediacenter/kodi-binary-addons/audiodecoder.dumb/package.mk index acdb0308ebb..beb401b2eab 100644 --- a/packages/mediacenter/kodi-binary-addons/audiodecoder.dumb/package.mk +++ b/packages/mediacenter/kodi-binary-addons/audiodecoder.dumb/package.mk @@ -22,7 +22,7 @@ PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="https://github.com/notspiff/audiodecoder.dumb" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_URL="https://github.com/notspiff/audiodecoder.dumb/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain kodi-platform" PKG_PRIORITY="optional" PKG_SECTION="" @@ -43,6 +43,8 @@ configure_target() { addon() { mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PR $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PL $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/*.so $ADDON_BUILD/$PKG_ADDON_ID/ + cp -R $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ + + ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) + cp -L $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ } diff --git a/packages/mediacenter/kodi-binary-addons/audiodecoder.fluidsynth/package.mk b/packages/mediacenter/kodi-binary-addons/audiodecoder.fluidsynth/package.mk index 2e90c834a26..0176cfc5dd6 100644 --- a/packages/mediacenter/kodi-binary-addons/audiodecoder.fluidsynth/package.mk +++ b/packages/mediacenter/kodi-binary-addons/audiodecoder.fluidsynth/package.mk @@ -22,7 +22,7 @@ PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="https://github.com/notspiff/audiodecoder.fluidsynth" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_URL="https://github.com/notspiff/audiodecoder.fluidsynth/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain kodi-platform fluidsynth" PKG_PRIORITY="optional" PKG_SECTION="" @@ -43,6 +43,8 @@ configure_target() { addon() { mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PR $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PL $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/*.so $ADDON_BUILD/$PKG_ADDON_ID/ + cp -R $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ + + ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) + cp -L $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ } diff --git a/packages/mediacenter/kodi-binary-addons/audiodecoder.gme/package.mk b/packages/mediacenter/kodi-binary-addons/audiodecoder.gme/package.mk index 9e4510fc574..fb000378d68 100644 --- a/packages/mediacenter/kodi-binary-addons/audiodecoder.gme/package.mk +++ b/packages/mediacenter/kodi-binary-addons/audiodecoder.gme/package.mk @@ -22,7 +22,7 @@ PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="https://github.com/notspiff/audiodecoder.gme" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_URL="https://github.com/notspiff/audiodecoder.gme/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain kodi-platform" PKG_PRIORITY="optional" PKG_SECTION="" @@ -43,6 +43,8 @@ configure_target() { addon() { mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PR $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PL $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/*.so $ADDON_BUILD/$PKG_ADDON_ID/ + cp -R $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ + + ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) + cp -L $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ } diff --git a/packages/mediacenter/kodi-binary-addons/audiodecoder.gsf/package.mk b/packages/mediacenter/kodi-binary-addons/audiodecoder.gsf/package.mk index 9a811100561..7beee9c67dc 100644 --- a/packages/mediacenter/kodi-binary-addons/audiodecoder.gsf/package.mk +++ b/packages/mediacenter/kodi-binary-addons/audiodecoder.gsf/package.mk @@ -22,7 +22,7 @@ PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="https://github.com/notspiff/audiodecoder.gsf" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_URL="https://github.com/notspiff/audiodecoder.gsf/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain kodi-platform" PKG_PRIORITY="optional" PKG_SECTION="" @@ -43,6 +43,8 @@ configure_target() { addon() { mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PR $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PL $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/*.so $ADDON_BUILD/$PKG_ADDON_ID/ + cp -R $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ + + ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) + cp -L $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ } diff --git a/packages/mediacenter/kodi-binary-addons/audiodecoder.modplug/package.mk b/packages/mediacenter/kodi-binary-addons/audiodecoder.modplug/package.mk index ada7cf8179f..308a9e7052a 100644 --- a/packages/mediacenter/kodi-binary-addons/audiodecoder.modplug/package.mk +++ b/packages/mediacenter/kodi-binary-addons/audiodecoder.modplug/package.mk @@ -17,12 +17,12 @@ ################################################################################ PKG_NAME="audiodecoder.modplug" -PKG_VERSION="03b772d" +PKG_VERSION="3faec25" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.kodi.tv" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_URL="https://github.com/notspiff/audiodecoder.modplug/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain kodi-platform libmodplug" PKG_PRIORITY="optional" PKG_SECTION="" @@ -43,6 +43,8 @@ configure_target() { addon() { mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PR $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PL $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/*.so $ADDON_BUILD/$PKG_ADDON_ID/ + cp -R $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ + + ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) + cp -L $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ } diff --git a/packages/mediacenter/kodi-binary-addons/audiodecoder.ncsf/package.mk b/packages/mediacenter/kodi-binary-addons/audiodecoder.ncsf/package.mk index 0dcc9c2571f..f21933ba49b 100644 --- a/packages/mediacenter/kodi-binary-addons/audiodecoder.ncsf/package.mk +++ b/packages/mediacenter/kodi-binary-addons/audiodecoder.ncsf/package.mk @@ -17,12 +17,12 @@ ################################################################################ PKG_NAME="audiodecoder.ncsf" -PKG_VERSION="b452778" +PKG_VERSION="db9517f" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="https://github.com/notspiff/audiodecoder.ncsf" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_URL="https://github.com/notspiff/audiodecoder.ncsf/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain kodi-platform" PKG_PRIORITY="optional" PKG_SECTION="" @@ -43,6 +43,8 @@ configure_target() { addon() { mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PR $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PL $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/*.so $ADDON_BUILD/$PKG_ADDON_ID/ + cp -R $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ + + ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) + cp -L $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ } diff --git a/packages/mediacenter/kodi-binary-addons/audiodecoder.nosefart/package.mk b/packages/mediacenter/kodi-binary-addons/audiodecoder.nosefart/package.mk index 34719ae61d2..7117e5614cb 100644 --- a/packages/mediacenter/kodi-binary-addons/audiodecoder.nosefart/package.mk +++ b/packages/mediacenter/kodi-binary-addons/audiodecoder.nosefart/package.mk @@ -17,12 +17,12 @@ ################################################################################ PKG_NAME="audiodecoder.nosefart" -PKG_VERSION="bfab543" +PKG_VERSION="646a7cb" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.kodi.tv" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_URL="https://github.com/notspiff/audiodecoder.nosefart/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain kodi-platform" PKG_PRIORITY="optional" PKG_SECTION="" @@ -43,6 +43,8 @@ configure_target() { addon() { mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PR $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PL $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/*.so $ADDON_BUILD/$PKG_ADDON_ID/ + cp -R $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ + + ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) + cp -L $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ } diff --git a/packages/mediacenter/kodi-binary-addons/audiodecoder.openmpt/package.mk b/packages/mediacenter/kodi-binary-addons/audiodecoder.openmpt/package.mk index 8e669cbf365..de345a7d4f1 100644 --- a/packages/mediacenter/kodi-binary-addons/audiodecoder.openmpt/package.mk +++ b/packages/mediacenter/kodi-binary-addons/audiodecoder.openmpt/package.mk @@ -22,7 +22,7 @@ PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.kodi.tv" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_URL="https://github.com/notspiff/audiodecoder.openmpt/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain kodi-platform libopenmpt" PKG_PRIORITY="optional" PKG_SECTION="" @@ -43,6 +43,8 @@ configure_target() { addon() { mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PR $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PL $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/*.so $ADDON_BUILD/$PKG_ADDON_ID/ + cp -R $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ + + ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) + cp -L $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ } diff --git a/packages/mediacenter/kodi-binary-addons/audiodecoder.organya/package.mk b/packages/mediacenter/kodi-binary-addons/audiodecoder.organya/package.mk index ce8e293294c..f8958770deb 100644 --- a/packages/mediacenter/kodi-binary-addons/audiodecoder.organya/package.mk +++ b/packages/mediacenter/kodi-binary-addons/audiodecoder.organya/package.mk @@ -17,12 +17,12 @@ ################################################################################ PKG_NAME="audiodecoder.organya" -PKG_VERSION="ed0d3a5" +PKG_VERSION="88d8a0f" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="https://github.com/notspiff/audiodecoder.organya" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_URL="https://github.com/notspiff/audiodecoder.organya/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain kodi-platform" PKG_PRIORITY="optional" PKG_SECTION="" @@ -43,6 +43,8 @@ configure_target() { addon() { mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PR $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PL $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/*.so $ADDON_BUILD/$PKG_ADDON_ID/ + cp -R $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ + + ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) + cp -L $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ } diff --git a/packages/mediacenter/kodi-binary-addons/audiodecoder.qsf/package.mk b/packages/mediacenter/kodi-binary-addons/audiodecoder.qsf/package.mk index 1c4bd7129c4..24b729c64cd 100644 --- a/packages/mediacenter/kodi-binary-addons/audiodecoder.qsf/package.mk +++ b/packages/mediacenter/kodi-binary-addons/audiodecoder.qsf/package.mk @@ -17,12 +17,12 @@ ################################################################################ PKG_NAME="audiodecoder.qsf" -PKG_VERSION="83b18d7" +PKG_VERSION="4330729" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="https://github.com/notspiff/audiodecoder.qsf" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_URL="https://github.com/notspiff/audiodecoder.qsf/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain kodi-platform" PKG_PRIORITY="optional" PKG_SECTION="" @@ -43,6 +43,8 @@ configure_target() { addon() { mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PR $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PL $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/*.so $ADDON_BUILD/$PKG_ADDON_ID/ + cp -R $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ + + ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) + cp -L $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ } diff --git a/packages/mediacenter/kodi-binary-addons/audiodecoder.sidplay/package.mk b/packages/mediacenter/kodi-binary-addons/audiodecoder.sidplay/package.mk index 7aba1e543b4..38e49e1bb5a 100644 --- a/packages/mediacenter/kodi-binary-addons/audiodecoder.sidplay/package.mk +++ b/packages/mediacenter/kodi-binary-addons/audiodecoder.sidplay/package.mk @@ -17,12 +17,12 @@ ################################################################################ PKG_NAME="audiodecoder.sidplay" -PKG_VERSION="d832f05" +PKG_VERSION="4631114" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.kodi.tv" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_URL="https://github.com/notspiff/audiodecoder.sidplay/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain kodi-platform sidplay-libs" PKG_PRIORITY="optional" PKG_SECTION="" @@ -44,6 +44,8 @@ configure_target() { addon() { mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PR $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PL $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/*.so $ADDON_BUILD/$PKG_ADDON_ID/ + cp -R $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ + + ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) + cp -L $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ } diff --git a/packages/mediacenter/kodi-binary-addons/audiodecoder.snesapu/package.mk b/packages/mediacenter/kodi-binary-addons/audiodecoder.snesapu/package.mk index 15f76906896..9286ebb602e 100644 --- a/packages/mediacenter/kodi-binary-addons/audiodecoder.snesapu/package.mk +++ b/packages/mediacenter/kodi-binary-addons/audiodecoder.snesapu/package.mk @@ -17,12 +17,12 @@ ################################################################################ PKG_NAME="audiodecoder.snesapu" -PKG_VERSION="db62e88" +PKG_VERSION="c5a182b" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.kodi.tv" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_URL="https://github.com/notspiff/audiodecoder.snesapu/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain kodi-platform" PKG_PRIORITY="optional" PKG_SECTION="" @@ -43,6 +43,8 @@ configure_target() { addon() { mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PR $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PL $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/*.so $ADDON_BUILD/$PKG_ADDON_ID/ + cp -R $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ + + ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) + cp -L $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ } diff --git a/packages/mediacenter/kodi-binary-addons/audiodecoder.ssf/package.mk b/packages/mediacenter/kodi-binary-addons/audiodecoder.ssf/package.mk index 955c3e258f7..90405cea14e 100644 --- a/packages/mediacenter/kodi-binary-addons/audiodecoder.ssf/package.mk +++ b/packages/mediacenter/kodi-binary-addons/audiodecoder.ssf/package.mk @@ -22,7 +22,7 @@ PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="https://github.com/notspiff/audiodecoder.ssf" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_URL="https://github.com/notspiff/audiodecoder.ssf/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain kodi-platform" PKG_PRIORITY="optional" PKG_SECTION="" @@ -43,6 +43,8 @@ configure_target() { addon() { mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PR $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PL $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/*.so $ADDON_BUILD/$PKG_ADDON_ID/ + cp -R $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ + + ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) + cp -L $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ } diff --git a/packages/mediacenter/kodi-binary-addons/audiodecoder.stsound/package.mk b/packages/mediacenter/kodi-binary-addons/audiodecoder.stsound/package.mk index 13978e55a78..ff76218f6c2 100644 --- a/packages/mediacenter/kodi-binary-addons/audiodecoder.stsound/package.mk +++ b/packages/mediacenter/kodi-binary-addons/audiodecoder.stsound/package.mk @@ -17,12 +17,12 @@ ################################################################################ PKG_NAME="audiodecoder.stsound" -PKG_VERSION="759ae7e" +PKG_VERSION="65f0e06" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.kodi.tv" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_URL="https://github.com/notspiff/audiodecoder.stsound/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain kodi-platform" PKG_PRIORITY="optional" PKG_SECTION="" @@ -43,6 +43,8 @@ configure_target() { addon() { mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PR $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PL $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/*.so $ADDON_BUILD/$PKG_ADDON_ID/ + cp -R $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ + + ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) + cp -L $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ } diff --git a/packages/mediacenter/kodi-binary-addons/audiodecoder.timidity/package.mk b/packages/mediacenter/kodi-binary-addons/audiodecoder.timidity/package.mk index 64a630e2d85..fb7fe8e438e 100644 --- a/packages/mediacenter/kodi-binary-addons/audiodecoder.timidity/package.mk +++ b/packages/mediacenter/kodi-binary-addons/audiodecoder.timidity/package.mk @@ -17,12 +17,12 @@ ################################################################################ PKG_NAME="audiodecoder.timidity" -PKG_VERSION="1aa2378" +PKG_VERSION="f649d32" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.kodi.tv" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_URL="https://github.com/notspiff/audiodecoder.timidity/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain kodi-platform" PKG_PRIORITY="optional" PKG_SECTION="" @@ -43,6 +43,8 @@ configure_target() { addon() { mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PR $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PL $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/*.so $ADDON_BUILD/$PKG_ADDON_ID/ + cp -R $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ + + ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) + cp -L $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ } diff --git a/packages/mediacenter/kodi-binary-addons/audiodecoder.upse/package.mk b/packages/mediacenter/kodi-binary-addons/audiodecoder.upse/package.mk index d31656edfbb..074013303af 100644 --- a/packages/mediacenter/kodi-binary-addons/audiodecoder.upse/package.mk +++ b/packages/mediacenter/kodi-binary-addons/audiodecoder.upse/package.mk @@ -22,7 +22,7 @@ PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="https://github.com/notspiff/audiodecoder.upse" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_URL="https://github.com/notspiff/audiodecoder.upse/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain kodi-platform" PKG_PRIORITY="optional" PKG_SECTION="" @@ -43,6 +43,8 @@ configure_target() { addon() { mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PR $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PL $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/*.so $ADDON_BUILD/$PKG_ADDON_ID/ + cp -R $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ + + ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) + cp -L $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ } diff --git a/packages/mediacenter/kodi-binary-addons/audiodecoder.usf/package.mk b/packages/mediacenter/kodi-binary-addons/audiodecoder.usf/package.mk index 3da86d95d7d..150746be774 100644 --- a/packages/mediacenter/kodi-binary-addons/audiodecoder.usf/package.mk +++ b/packages/mediacenter/kodi-binary-addons/audiodecoder.usf/package.mk @@ -22,7 +22,7 @@ PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="https://github.com/notspiff/audiodecoder.usf" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_URL="https://github.com/notspiff/audiodecoder.usf/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain kodi-platform" PKG_PRIORITY="optional" PKG_SECTION="" @@ -44,6 +44,8 @@ configure_target() { addon() { mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PR $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PL $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/*.so $ADDON_BUILD/$PKG_ADDON_ID/ + cp -R $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ + + ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) + cp -L $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ } diff --git a/packages/mediacenter/kodi-binary-addons/audiodecoder.vgmstream/package.mk b/packages/mediacenter/kodi-binary-addons/audiodecoder.vgmstream/package.mk index 72c8a4c9f97..36c04b320ba 100644 --- a/packages/mediacenter/kodi-binary-addons/audiodecoder.vgmstream/package.mk +++ b/packages/mediacenter/kodi-binary-addons/audiodecoder.vgmstream/package.mk @@ -17,12 +17,12 @@ ################################################################################ PKG_NAME="audiodecoder.vgmstream" -PKG_VERSION="cb2892a" +PKG_VERSION="6695178" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.kodi.tv" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_URL="https://github.com/notspiff/audiodecoder.vgmstream/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain kodi-platform" PKG_PRIORITY="optional" PKG_SECTION="" @@ -43,6 +43,8 @@ configure_target() { addon() { mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PR $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PL $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/*.so $ADDON_BUILD/$PKG_ADDON_ID/ + cp -R $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ + + ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) + cp -L $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ } diff --git a/packages/mediacenter/kodi-binary-addons/audiodecoder.wsr/package.mk b/packages/mediacenter/kodi-binary-addons/audiodecoder.wsr/package.mk index 77b4729cf18..6e7e6fff1b8 100644 --- a/packages/mediacenter/kodi-binary-addons/audiodecoder.wsr/package.mk +++ b/packages/mediacenter/kodi-binary-addons/audiodecoder.wsr/package.mk @@ -22,7 +22,7 @@ PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="https://github.com/notspiff/audiodecoder.wsr" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_URL="https://github.com/notspiff/audiodecoder.wsr/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain kodi-platform" PKG_PRIORITY="optional" PKG_SECTION="" @@ -43,6 +43,8 @@ configure_target() { addon() { mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PR $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PL $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/*.so $ADDON_BUILD/$PKG_ADDON_ID/ + cp -R $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ + + ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) + cp -L $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ } diff --git a/packages/mediacenter/kodi-binary-addons/audioencoder.flac/package.mk b/packages/mediacenter/kodi-binary-addons/audioencoder.flac/package.mk index 1e14fcfcf0a..04a5707b594 100644 --- a/packages/mediacenter/kodi-binary-addons/audioencoder.flac/package.mk +++ b/packages/mediacenter/kodi-binary-addons/audioencoder.flac/package.mk @@ -17,12 +17,12 @@ ################################################################################ PKG_NAME="audioencoder.flac" -PKG_VERSION="f8a9cd0" +PKG_VERSION="176288b" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.kodi.tv" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_URL="https://github.com/xbmc/audioencoder.flac/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain kodi-platform flac" PKG_PRIORITY="optional" PKG_SECTION="" @@ -45,6 +45,8 @@ configure_target() { addon() { mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PR $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PL $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/*.so $ADDON_BUILD/$PKG_ADDON_ID/ + cp -R $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ + + ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) + cp -L $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ } diff --git a/packages/mediacenter/kodi-binary-addons/audioencoder.lame/package.mk b/packages/mediacenter/kodi-binary-addons/audioencoder.lame/package.mk index a62a6af6e82..ded5226a713 100644 --- a/packages/mediacenter/kodi-binary-addons/audioencoder.lame/package.mk +++ b/packages/mediacenter/kodi-binary-addons/audioencoder.lame/package.mk @@ -17,12 +17,12 @@ ################################################################################ PKG_NAME="audioencoder.lame" -PKG_VERSION="52f84dd" +PKG_VERSION="ffaf9cb" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.kodi.tv" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_URL="https://github.com/xbmc/audioencoder.lame/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain kodi-platform lame" PKG_PRIORITY="optional" PKG_SECTION="" @@ -44,6 +44,8 @@ configure_target() { addon() { mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PR $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PL $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/*.so $ADDON_BUILD/$PKG_ADDON_ID/ + cp -R $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ + + ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) + cp -L $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ } diff --git a/packages/mediacenter/kodi-binary-addons/audioencoder.vorbis/package.mk b/packages/mediacenter/kodi-binary-addons/audioencoder.vorbis/package.mk index 0e2665c08b2..3982821d189 100644 --- a/packages/mediacenter/kodi-binary-addons/audioencoder.vorbis/package.mk +++ b/packages/mediacenter/kodi-binary-addons/audioencoder.vorbis/package.mk @@ -17,12 +17,12 @@ ################################################################################ PKG_NAME="audioencoder.vorbis" -PKG_VERSION="42620de" +PKG_VERSION="47a0676" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.kodi.tv" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_URL="https://github.com/xbmc/audioencoder.vorbis/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain kodi-platform libogg libvorbis" PKG_PRIORITY="optional" PKG_SECTION="" @@ -46,6 +46,8 @@ configure_target() { addon() { mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PR $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PL $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/*.so $ADDON_BUILD/$PKG_ADDON_ID/ + cp -R $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ + + ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) + cp -L $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ } diff --git a/packages/mediacenter/kodi-binary-addons/audioencoder.wav/package.mk b/packages/mediacenter/kodi-binary-addons/audioencoder.wav/package.mk index 2a82cb3b371..695c83d7bc6 100644 --- a/packages/mediacenter/kodi-binary-addons/audioencoder.wav/package.mk +++ b/packages/mediacenter/kodi-binary-addons/audioencoder.wav/package.mk @@ -17,12 +17,12 @@ ################################################################################ PKG_NAME="audioencoder.wav" -PKG_VERSION="0c6ec77" +PKG_VERSION="a12bcd1" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.kodi.tv" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_URL="https://github.com/xbmc/audioencoder.wav/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain kodi-platform" PKG_PRIORITY="optional" PKG_SECTION="" @@ -43,6 +43,8 @@ configure_target() { addon() { mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PR $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PL $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/*.so $ADDON_BUILD/$PKG_ADDON_ID/ + cp -R $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ + + ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) + cp -L $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ } diff --git a/packages/mediacenter/kodi-binary-addons/inputstream.mpd/package.mk b/packages/mediacenter/kodi-binary-addons/inputstream.mpd/package.mk new file mode 100644 index 00000000000..ef94050aa4e --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/inputstream.mpd/package.mk @@ -0,0 +1,60 @@ +################################################################################ +# This file is part of LibreELEC - https://libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see <http://www.gnu.org/licenses/>. +################################################################################ + +PKG_NAME="inputstream.mpd" +PKG_VERSION="2cb2eab" +PKG_LICENSE="GPL" +PKG_SITE="http://www.kodi.tv" +PKG_URL="https://github.com/liberty-developer/inputstream.mpd/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform" +PKG_SECTION="" +PKG_SHORTDESC="inputstream.mpd" +PKG_LONGDESC="inputstream.mpd" + +PKG_IS_ADDON="yes" + +configure_target() { + cmake -DCMAKE_TOOLCHAIN_FILE=$CMAKE_CONF \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DCMAKE_MODULE_PATH=$SYSROOT_PREFIX/usr/lib/kodi \ + -DCMAKE_PREFIX_PATH=$SYSROOT_PREFIX/usr \ + .. +} + +post_makeinstall_target() { + mkdir -p wv && cd wv + cmake -DCMAKE_TOOLCHAIN_FILE=$CMAKE_CONF \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DCMAKE_MODULE_PATH=$SYSROOT_PREFIX/usr/lib/kodi \ + -DCMAKE_PREFIX_PATH=$SYSROOT_PREFIX/usr \ + $ROOT/$PKG_BUILD/wvdecrypter + make + + cp -P $ROOT/$PKG_BUILD/.$TARGET_NAME/wv/libssd_wv.so $INSTALL/usr/lib +} + +addon() { + mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ + cp -R $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ + + ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) + cp -L $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ + + mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/lib/ + cp -P $PKG_BUILD/.$TARGET_NAME/wv/libssd_wv.so $ADDON_BUILD/$PKG_ADDON_ID/lib +} diff --git a/packages/mediacenter/kodi-binary-addons/inputstream.smoothstream/package.mk b/packages/mediacenter/kodi-binary-addons/inputstream.smoothstream/package.mk new file mode 100644 index 00000000000..8839c338299 --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/inputstream.smoothstream/package.mk @@ -0,0 +1,45 @@ +################################################################################ +# This file is part of LibreELEC - https://libreelec.tv +# Copyright (C) 2009-2016 Lukas Rusak (lrusak@libreelec.tv) +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see <http://www.gnu.org/licenses/>. +################################################################################ + +PKG_NAME="inputstream.smoothstream" +PKG_VERSION="352b14e" +PKG_LICENSE="GPL" +PKG_SITE="http://www.kodi.tv" +PKG_URL="https://github.com/mapfau/inputstream.smoothstream/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform" +PKG_SECTION="" +PKG_SHORTDESC="inputstream.smoothstream" +PKG_LONGDESC="inputstream.smoothstream" + +PKG_IS_ADDON="yes" + +configure_target() { + cmake -DCMAKE_TOOLCHAIN_FILE=$CMAKE_CONF \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DCMAKE_MODULE_PATH=$SYSROOT_PREFIX/usr/lib/kodi \ + -DCMAKE_PREFIX_PATH=$SYSROOT_PREFIX/usr \ + .. +} + +addon() { + mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ + cp -R $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ + + ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) + cp -L $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ +} diff --git a/packages/mediacenter/kodi-binary-addons/peripheral.joystick/package.mk b/packages/mediacenter/kodi-binary-addons/peripheral.joystick/package.mk new file mode 100644 index 00000000000..88fa3f629ec --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/peripheral.joystick/package.mk @@ -0,0 +1,50 @@ +################################################################################ +# This file is part of LibreELEC - https://libreelec.tv +# Copyright (C) 2009-2016 Lukas Rusak (lrusak@libreelec.tv) +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see <http://www.gnu.org/licenses/>. +################################################################################ + +PKG_NAME="peripheral.joystick" +PKG_VERSION="76b7c40" +PKG_REV="0" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/kodi-game/peripheral.joystick" +PKG_URL="https://github.com/kodi-game/peripheral.joystick/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform p8-platform" +PKG_PRIORITY="optional" +PKG_SECTION="" +PKG_SHORTDESC="peripheral.joystick: Joystick support in Kodi" +PKG_LONGDESC="peripheral.joystick provides joystick support and button mapping" +PKG_AUTORECONF="no" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="kodi.peripheral" + +configure_target() { + cmake -DCMAKE_TOOLCHAIN_FILE=$CMAKE_CONF \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DCMAKE_MODULE_PATH=$SYSROOT_PREFIX/usr/lib/kodi \ + -DCMAKE_PREFIX_PATH=$SYSROOT_PREFIX/usr \ + .. +} + +addon() { + mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ + cp -R $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ + + ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) + cp -L $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ +} diff --git a/packages/mediacenter/kodi-binary-addons/pvr.argustv/package.mk b/packages/mediacenter/kodi-binary-addons/pvr.argustv/package.mk index 3d5baaaa3bf..c957941a1c5 100644 --- a/packages/mediacenter/kodi-binary-addons/pvr.argustv/package.mk +++ b/packages/mediacenter/kodi-binary-addons/pvr.argustv/package.mk @@ -17,12 +17,12 @@ ################################################################################ PKG_NAME="pvr.argustv" -PKG_VERSION="2aca01c" +PKG_VERSION="3a4eccd" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.kodi.tv" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_URL="https://github.com/kodi-pvr/pvr.argustv/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain kodi-platform jsoncpp" PKG_PRIORITY="optional" PKG_SECTION="" @@ -47,6 +47,8 @@ configure_target() { addon() { mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PR $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PL $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/*.so $ADDON_BUILD/$PKG_ADDON_ID/ + cp -R $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ + + ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) + cp -L $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ } diff --git a/packages/mediacenter/kodi-binary-addons/pvr.demo/package.mk b/packages/mediacenter/kodi-binary-addons/pvr.demo/package.mk index 3109297d2a2..ecccb4c3373 100644 --- a/packages/mediacenter/kodi-binary-addons/pvr.demo/package.mk +++ b/packages/mediacenter/kodi-binary-addons/pvr.demo/package.mk @@ -17,12 +17,12 @@ ################################################################################ PKG_NAME="pvr.demo" -PKG_VERSION="8673b1a" +PKG_VERSION="f4950d3" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.kodi.tv" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_URL="https://github.com/kodi-pvr/pvr.demo/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain kodi-platform" PKG_PRIORITY="optional" PKG_SECTION="" @@ -43,6 +43,8 @@ configure_target() { addon() { mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PR $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PL $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/*.so $ADDON_BUILD/$PKG_ADDON_ID/ + cp -R $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ + + ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) + cp -L $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ } diff --git a/packages/mediacenter/kodi-binary-addons/pvr.dvblink/package.mk b/packages/mediacenter/kodi-binary-addons/pvr.dvblink/package.mk index e7b5a1683e6..96aa0a7aedd 100644 --- a/packages/mediacenter/kodi-binary-addons/pvr.dvblink/package.mk +++ b/packages/mediacenter/kodi-binary-addons/pvr.dvblink/package.mk @@ -17,12 +17,12 @@ ################################################################################ PKG_NAME="pvr.dvblink" -PKG_VERSION="9741e69" +PKG_VERSION="41a62b1" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.kodi.tv" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_URL="https://github.com/kodi-pvr/pvr.dvblink/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain kodi-platform tinyxml2" PKG_PRIORITY="optional" PKG_SECTION="" @@ -43,6 +43,8 @@ configure_target() { addon() { mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PR $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PL $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/*.so $ADDON_BUILD/$PKG_ADDON_ID/ + cp -R $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ + + ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) + cp -L $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ } diff --git a/packages/mediacenter/kodi-binary-addons/pvr.dvbviewer/package.mk b/packages/mediacenter/kodi-binary-addons/pvr.dvbviewer/package.mk index 6e7502be764..0e5477ec401 100644 --- a/packages/mediacenter/kodi-binary-addons/pvr.dvbviewer/package.mk +++ b/packages/mediacenter/kodi-binary-addons/pvr.dvbviewer/package.mk @@ -17,12 +17,12 @@ ################################################################################ PKG_NAME="pvr.dvbviewer" -PKG_VERSION="2628660" +PKG_VERSION="77771dd" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.kodi.tv" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_URL="https://github.com/kodi-pvr/pvr.dvbviewer/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain kodi-platform" PKG_PRIORITY="optional" PKG_SECTION="" @@ -43,6 +43,8 @@ configure_target() { addon() { mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PR $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PL $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/*.so $ADDON_BUILD/$PKG_ADDON_ID/ + cp -R $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ + + ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) + cp -L $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ } diff --git a/packages/mediacenter/kodi-binary-addons/pvr.filmon/package.mk b/packages/mediacenter/kodi-binary-addons/pvr.filmon/package.mk index 862f4e89a43..220cd8ed292 100644 --- a/packages/mediacenter/kodi-binary-addons/pvr.filmon/package.mk +++ b/packages/mediacenter/kodi-binary-addons/pvr.filmon/package.mk @@ -17,12 +17,12 @@ ################################################################################ PKG_NAME="pvr.filmon" -PKG_VERSION="e1e2101" +PKG_VERSION="0b90677" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.kodi.tv" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_URL="https://github.com/kodi-pvr/pvr.filmon/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain kodi-platform jsoncpp" PKG_PRIORITY="optional" PKG_SECTION="" @@ -43,6 +43,8 @@ configure_target() { addon() { mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PR $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PL $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/*.so $ADDON_BUILD/$PKG_ADDON_ID/ + cp -R $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ + + ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) + cp -L $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ } diff --git a/packages/mediacenter/kodi-binary-addons/pvr.hdhomerun/package.mk b/packages/mediacenter/kodi-binary-addons/pvr.hdhomerun/package.mk index 29c137af402..8dcb46f33b5 100644 --- a/packages/mediacenter/kodi-binary-addons/pvr.hdhomerun/package.mk +++ b/packages/mediacenter/kodi-binary-addons/pvr.hdhomerun/package.mk @@ -17,12 +17,12 @@ ################################################################################ PKG_NAME="pvr.hdhomerun" -PKG_VERSION="456913e" +PKG_VERSION="9b51185" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.kodi.tv" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_URL="https://github.com/kodi-pvr/pvr.hdhomerun/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain kodi-platform jsoncpp libhdhomerun" PKG_PRIORITY="optional" PKG_SECTION="" @@ -45,6 +45,8 @@ configure_target() { addon() { mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PR $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PL $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/*.so $ADDON_BUILD/$PKG_ADDON_ID/ + cp -R $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ + + ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) + cp -L $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ } diff --git a/packages/mediacenter/kodi-binary-addons/pvr.hts/package.mk b/packages/mediacenter/kodi-binary-addons/pvr.hts/package.mk index 2c66d4a69fd..b46d5dc0bea 100644 --- a/packages/mediacenter/kodi-binary-addons/pvr.hts/package.mk +++ b/packages/mediacenter/kodi-binary-addons/pvr.hts/package.mk @@ -17,12 +17,12 @@ ################################################################################ PKG_NAME="pvr.hts" -PKG_VERSION="3c673b5" +PKG_VERSION="8929c22" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.kodi.tv" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_URL="https://github.com/kodi-pvr/pvr.hts/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain kodi-platform" PKG_PRIORITY="optional" PKG_SECTION="" @@ -43,6 +43,8 @@ configure_target() { addon() { mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PR $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PL $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/*.so $ADDON_BUILD/$PKG_ADDON_ID/ + cp -R $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ + + ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) + cp -L $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ } diff --git a/packages/mediacenter/kodi-binary-addons/pvr.iptvsimple/package.mk b/packages/mediacenter/kodi-binary-addons/pvr.iptvsimple/package.mk index 9546b5f1b7c..0d5b41c1128 100644 --- a/packages/mediacenter/kodi-binary-addons/pvr.iptvsimple/package.mk +++ b/packages/mediacenter/kodi-binary-addons/pvr.iptvsimple/package.mk @@ -17,12 +17,12 @@ ################################################################################ PKG_NAME="pvr.iptvsimple" -PKG_VERSION="ae9bc1d" +PKG_VERSION="373b525" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.kodi.tv" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_URL="https://github.com/kodi-pvr/pvr.iptvsimple/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain kodi-platform zlib" PKG_PRIORITY="optional" PKG_SECTION="" @@ -43,6 +43,8 @@ configure_target() { addon() { mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PR $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PL $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/*.so $ADDON_BUILD/$PKG_ADDON_ID/ + cp -R $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ + + ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) + cp -L $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ } diff --git a/packages/mediacenter/kodi-binary-addons/pvr.mediaportal.tvserver/package.mk b/packages/mediacenter/kodi-binary-addons/pvr.mediaportal.tvserver/package.mk index 7593b20d62b..52e838f8065 100644 --- a/packages/mediacenter/kodi-binary-addons/pvr.mediaportal.tvserver/package.mk +++ b/packages/mediacenter/kodi-binary-addons/pvr.mediaportal.tvserver/package.mk @@ -17,12 +17,12 @@ ################################################################################ PKG_NAME="pvr.mediaportal.tvserver" -PKG_VERSION="9dd54a6" +PKG_VERSION="4723f6d" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.kodi.tv" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_URL="https://github.com/kodi-pvr/pvr.mediaportal.tvserver/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain kodi-platform" PKG_PRIORITY="optional" PKG_SECTION="" @@ -47,6 +47,8 @@ configure_target() { addon() { mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PR $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PL $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/*.so $ADDON_BUILD/$PKG_ADDON_ID/ + cp -R $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ + + ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) + cp -L $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ } diff --git a/packages/mediacenter/kodi-binary-addons/pvr.mythtv/package.mk b/packages/mediacenter/kodi-binary-addons/pvr.mythtv/package.mk index 1a426c9c344..3b8c5252185 100644 --- a/packages/mediacenter/kodi-binary-addons/pvr.mythtv/package.mk +++ b/packages/mediacenter/kodi-binary-addons/pvr.mythtv/package.mk @@ -17,12 +17,12 @@ ################################################################################ PKG_NAME="pvr.mythtv" -PKG_VERSION="2e5a649" +PKG_VERSION="11b70a5" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.kodi.tv" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_URL="https://github.com/kodi-pvr/pvr.mythtv/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain kodi-platform" PKG_PRIORITY="optional" PKG_SECTION="" @@ -43,6 +43,8 @@ configure_target() { addon() { mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PR $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PL $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/*.so $ADDON_BUILD/$PKG_ADDON_ID/ + cp -R $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ + + ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) + cp -L $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ } diff --git a/packages/mediacenter/kodi-binary-addons/pvr.nextpvr/package.mk b/packages/mediacenter/kodi-binary-addons/pvr.nextpvr/package.mk index f01c60fbc44..415cd907254 100644 --- a/packages/mediacenter/kodi-binary-addons/pvr.nextpvr/package.mk +++ b/packages/mediacenter/kodi-binary-addons/pvr.nextpvr/package.mk @@ -17,12 +17,12 @@ ################################################################################ PKG_NAME="pvr.nextpvr" -PKG_VERSION="d82c0c5" +PKG_VERSION="fa13c7d" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.kodi.tv" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_URL="https://github.com/kodi-pvr/pvr.nextpvr/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain kodi-platform" PKG_PRIORITY="optional" PKG_SECTION="" @@ -47,6 +47,8 @@ configure_target() { addon() { mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PR $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PL $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/*.so $ADDON_BUILD/$PKG_ADDON_ID/ + cp -R $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ + + ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) + cp -L $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ } diff --git a/packages/mediacenter/kodi-binary-addons/pvr.njoy/package.mk b/packages/mediacenter/kodi-binary-addons/pvr.njoy/package.mk index 825ddd72df6..85ed9420432 100644 --- a/packages/mediacenter/kodi-binary-addons/pvr.njoy/package.mk +++ b/packages/mediacenter/kodi-binary-addons/pvr.njoy/package.mk @@ -17,12 +17,12 @@ ################################################################################ PKG_NAME="pvr.njoy" -PKG_VERSION="480c159" +PKG_VERSION="aea0b8a" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.kodi.tv" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_URL="https://github.com/kodi-pvr/pvr.njoy/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain kodi-platform" PKG_PRIORITY="optional" PKG_SECTION="" @@ -43,6 +43,8 @@ configure_target() { addon() { mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PR $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PL $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/*.so $ADDON_BUILD/$PKG_ADDON_ID/ + cp -R $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ + + ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) + cp -L $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ } diff --git a/packages/mediacenter/kodi-binary-addons/pvr.pctv/package.mk b/packages/mediacenter/kodi-binary-addons/pvr.pctv/package.mk index 5e09be5cbeb..09b6fe3bdf6 100644 --- a/packages/mediacenter/kodi-binary-addons/pvr.pctv/package.mk +++ b/packages/mediacenter/kodi-binary-addons/pvr.pctv/package.mk @@ -17,12 +17,12 @@ ################################################################################ PKG_NAME="pvr.pctv" -PKG_VERSION="0096770" +PKG_VERSION="fc80e0f" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.kodi.tv" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_URL="https://github.com/kodi-pvr/pvr.pctv/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain kodi-platform jsoncpp" PKG_PRIORITY="optional" PKG_SECTION="" @@ -43,6 +43,8 @@ configure_target() { addon() { mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PR $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PL $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/*.so $ADDON_BUILD/$PKG_ADDON_ID/ + cp -R $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ + + ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) + cp -L $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ } diff --git a/packages/mediacenter/kodi-binary-addons/pvr.stalker/package.mk b/packages/mediacenter/kodi-binary-addons/pvr.stalker/package.mk index 8dd5b2ed286..a004916b084 100644 --- a/packages/mediacenter/kodi-binary-addons/pvr.stalker/package.mk +++ b/packages/mediacenter/kodi-binary-addons/pvr.stalker/package.mk @@ -17,12 +17,12 @@ ################################################################################ PKG_NAME="pvr.stalker" -PKG_VERSION="ffe2b49" +PKG_VERSION="c1d8ee7" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.kodi.tv" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_URL="https://github.com/kodi-pvr/pvr.stalker/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain kodi-platform jsoncpp tinyxml" PKG_PRIORITY="optional" PKG_SECTION="" @@ -43,6 +43,8 @@ configure_target() { addon() { mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PR $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PL $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/*.so $ADDON_BUILD/$PKG_ADDON_ID/ + cp -R $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ + + ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) + cp -L $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ } diff --git a/packages/mediacenter/kodi-binary-addons/pvr.vbox/package.mk b/packages/mediacenter/kodi-binary-addons/pvr.vbox/package.mk index 8cd7426994b..c3694209f4f 100644 --- a/packages/mediacenter/kodi-binary-addons/pvr.vbox/package.mk +++ b/packages/mediacenter/kodi-binary-addons/pvr.vbox/package.mk @@ -17,12 +17,12 @@ ################################################################################ PKG_NAME="pvr.vbox" -PKG_VERSION="15e864d" +PKG_VERSION="3174857" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.kodi.tv" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_URL="https://github.com/kodi-pvr/pvr.vbox/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain kodi-platform tinyxml2" PKG_PRIORITY="optional" PKG_SECTION="" @@ -43,6 +43,8 @@ configure_target() { addon() { mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PR $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PL $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/*.so $ADDON_BUILD/$PKG_ADDON_ID/ + cp -R $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ + + ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) + cp -L $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ } diff --git a/packages/mediacenter/kodi-binary-addons/pvr.vdr.vnsi/package.mk b/packages/mediacenter/kodi-binary-addons/pvr.vdr.vnsi/package.mk index 7fe4e7a9cb5..0e0933ef451 100644 --- a/packages/mediacenter/kodi-binary-addons/pvr.vdr.vnsi/package.mk +++ b/packages/mediacenter/kodi-binary-addons/pvr.vdr.vnsi/package.mk @@ -17,12 +17,12 @@ ################################################################################ PKG_NAME="pvr.vdr.vnsi" -PKG_VERSION="7e11b85" +PKG_VERSION="090ef7e" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.kodi.tv" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_URL="https://github.com/kodi-pvr/pvr.vdr.vnsi/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain kodi-platform" PKG_PRIORITY="optional" PKG_SECTION="" @@ -43,6 +43,8 @@ configure_target() { addon() { mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PR $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PL $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/*.so $ADDON_BUILD/$PKG_ADDON_ID/ + cp -R $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ + + ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) + cp -L $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ } diff --git a/packages/mediacenter/kodi-binary-addons/pvr.vdr.vnsi/patches/pvr.vdr.vnsi-preset-picon-path.patch b/packages/mediacenter/kodi-binary-addons/pvr.vdr.vnsi/patches/pvr.vdr.vnsi-preset-picon-path.patch new file mode 100644 index 00000000000..539f81e574e --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/pvr.vdr.vnsi/patches/pvr.vdr.vnsi-preset-picon-path.patch @@ -0,0 +1,12 @@ +diff --git a/pvr.vdr.vnsi/resources/settings.xml b/pvr.vdr.vnsi/resources/settings.xml +index 95a4813..fed455e 100644 +--- a/pvr.vdr.vnsi/resources/settings.xml ++++ b/pvr.vdr.vnsi/resources/settings.xml +@@ -8,6 +8,6 @@ + <setting id="timeout" type="enum" label="30004" values="0|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15" default="3"/> + <setting id="handlemessages" type="bool" label="30005" default="true" /> + <setting id="autochannelgroups" type="bool" label="30046" default="false" /> +- <setting id="iconpath" type="folder" source="files" label="30048" default="" /> ++ <setting id="iconpath" type="folder" source="files" label="30048" default="/storage/picons/vdr/" /> + <setting id="wol_mac" type="text" label="30049" default="" /> + </settings> diff --git a/packages/mediacenter/kodi-binary-addons/pvr.vuplus/package.mk b/packages/mediacenter/kodi-binary-addons/pvr.vuplus/package.mk index 319ccd307a9..adfee982276 100644 --- a/packages/mediacenter/kodi-binary-addons/pvr.vuplus/package.mk +++ b/packages/mediacenter/kodi-binary-addons/pvr.vuplus/package.mk @@ -17,12 +17,12 @@ ################################################################################ PKG_NAME="pvr.vuplus" -PKG_VERSION="815ea2f" +PKG_VERSION="ec652b9" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.kodi.tv" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_URL="https://github.com/kodi-pvr/pvr.vuplus/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain kodi-platform" PKG_PRIORITY="optional" PKG_SECTION="" @@ -43,6 +43,8 @@ configure_target() { addon() { mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PR $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PL $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/*.so $ADDON_BUILD/$PKG_ADDON_ID/ + cp -R $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ + + ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) + cp -L $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ } diff --git a/packages/mediacenter/kodi-binary-addons/pvr.wmc/package.mk b/packages/mediacenter/kodi-binary-addons/pvr.wmc/package.mk index a4a93abe10a..c64279d3621 100644 --- a/packages/mediacenter/kodi-binary-addons/pvr.wmc/package.mk +++ b/packages/mediacenter/kodi-binary-addons/pvr.wmc/package.mk @@ -17,12 +17,12 @@ ################################################################################ PKG_NAME="pvr.wmc" -PKG_VERSION="368de27" +PKG_VERSION="b1d7a40" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.kodi.tv" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_URL="https://github.com/kodi-pvr/pvr.wmc/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain kodi-platform" PKG_PRIORITY="optional" PKG_SECTION="" @@ -43,6 +43,8 @@ configure_target() { addon() { mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PR $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PL $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/*.so $ADDON_BUILD/$PKG_ADDON_ID/ + cp -R $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ + + ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) + cp -L $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ } diff --git a/packages/mediacenter/kodi-binary-addons/screensaver.asteroids/package.mk b/packages/mediacenter/kodi-binary-addons/screensaver.asteroids/package.mk index 27e4fbbf86b..50dbcac2989 100644 --- a/packages/mediacenter/kodi-binary-addons/screensaver.asteroids/package.mk +++ b/packages/mediacenter/kodi-binary-addons/screensaver.asteroids/package.mk @@ -22,7 +22,7 @@ PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="https://github.com/notspiff/screensaver.asteroids" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_URL="https://github.com/notspiff/screensaver.asteroids/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain kodi-platform" PKG_PRIORITY="optional" PKG_SECTION="" @@ -47,6 +47,8 @@ configure_target() { addon() { mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PR $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PL $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/*.so $ADDON_BUILD/$PKG_ADDON_ID/ + cp -R $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ + + ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) + cp -L $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ } diff --git a/packages/mediacenter/kodi-binary-addons/screensaver.asterwave/package.mk b/packages/mediacenter/kodi-binary-addons/screensaver.asterwave/package.mk new file mode 100644 index 00000000000..02af2ad035e --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/screensaver.asterwave/package.mk @@ -0,0 +1,54 @@ +################################################################################ +# This file is part of LibreELEC - https://libreelec.tv +# Copyright (C) 2009-2016 Lukas Rusak (lrusak@libreelec.tv) +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see <http://www.gnu.org/licenses/>. +################################################################################ + +PKG_NAME="screensaver.asterwave" +PKG_VERSION="0dc2c48" +PKG_REV="1" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/notspiff/screensaver.asterwave" +PKG_URL="https://github.com/notspiff/screensaver.asterwave/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform soil" +PKG_PRIORITY="optional" +PKG_SECTION="" +PKG_SHORTDESC="screensaver.asterwave" +PKG_LONGDESC="screensaver.asterwave" +PKG_AUTORECONF="no" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="xbmc.ui.screensaver" + +if [ "$OPENGL" = "no" ] ; then + exit 0 +fi + +configure_target() { + cmake -DCMAKE_TOOLCHAIN_FILE=$CMAKE_CONF \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DCMAKE_MODULE_PATH=$SYSROOT_PREFIX/usr/lib/kodi \ + -DCMAKE_PREFIX_PATH=$SYSROOT_PREFIX/usr \ + .. +} + +addon() { + mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ + cp -R $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ + + ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) + cp -L $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ +} diff --git a/packages/mediacenter/kodi-binary-addons/screensaver.biogenesis/package.mk b/packages/mediacenter/kodi-binary-addons/screensaver.biogenesis/package.mk index fdcedf7c054..a0821caab36 100644 --- a/packages/mediacenter/kodi-binary-addons/screensaver.biogenesis/package.mk +++ b/packages/mediacenter/kodi-binary-addons/screensaver.biogenesis/package.mk @@ -22,7 +22,7 @@ PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="https://github.com/notspiff/screensaver.biogenesis" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_URL="https://github.com/notspiff/screensaver.biogenesis/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain kodi-platform" PKG_PRIORITY="optional" PKG_SECTION="" @@ -47,6 +47,8 @@ configure_target() { addon() { mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PR $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PL $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/*.so $ADDON_BUILD/$PKG_ADDON_ID/ + cp -R $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ + + ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) + cp -L $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ } diff --git a/packages/mediacenter/kodi-binary-addons/screensaver.cpblobs/package.mk b/packages/mediacenter/kodi-binary-addons/screensaver.cpblobs/package.mk new file mode 100644 index 00000000000..5166d3371f2 --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/screensaver.cpblobs/package.mk @@ -0,0 +1,54 @@ +################################################################################ +# This file is part of LibreELEC - https://libreelec.tv +# Copyright (C) 2009-2016 Lukas Rusak (lrusak@libreelec.tv) +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see <http://www.gnu.org/licenses/>. +################################################################################ + +PKG_NAME="screensaver.cpblobs" +PKG_VERSION="87a3abf" +PKG_REV="1" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/notspiff/screensaver.cpblobs" +PKG_URL="https://github.com/notspiff/screensaver.cpblobs/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform soil" +PKG_PRIORITY="optional" +PKG_SECTION="" +PKG_SHORTDESC="screensaver.cpblobs" +PKG_LONGDESC="screensaver.cpblobs" +PKG_AUTORECONF="no" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="xbmc.ui.screensaver" + +if [ "$OPENGL" = "no" ] ; then + exit 0 +fi + +configure_target() { + cmake -DCMAKE_TOOLCHAIN_FILE=$CMAKE_CONF \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DCMAKE_MODULE_PATH=$SYSROOT_PREFIX/usr/lib/kodi \ + -DCMAKE_PREFIX_PATH=$SYSROOT_PREFIX/usr \ + .. +} + +addon() { + mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ + cp -R $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ + + ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) + cp -L $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ +} diff --git a/packages/mediacenter/kodi-binary-addons/screensaver.greynetic/package.mk b/packages/mediacenter/kodi-binary-addons/screensaver.greynetic/package.mk index 4cbc79aaa5c..86802710fca 100644 --- a/packages/mediacenter/kodi-binary-addons/screensaver.greynetic/package.mk +++ b/packages/mediacenter/kodi-binary-addons/screensaver.greynetic/package.mk @@ -22,7 +22,7 @@ PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="https://github.com/notspiff/screensaver.greynetic" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_URL="https://github.com/notspiff/screensaver.greynetic/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain kodi-platform" PKG_PRIORITY="optional" PKG_SECTION="" @@ -47,6 +47,8 @@ configure_target() { addon() { mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PR $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PL $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/*.so $ADDON_BUILD/$PKG_ADDON_ID/ + cp -R $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ + + ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) + cp -L $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ } diff --git a/packages/mediacenter/kodi-binary-addons/screensaver.matrixtrails/package.mk b/packages/mediacenter/kodi-binary-addons/screensaver.matrixtrails/package.mk index 1f1dbe5cd0d..2d1c6c79246 100644 --- a/packages/mediacenter/kodi-binary-addons/screensaver.matrixtrails/package.mk +++ b/packages/mediacenter/kodi-binary-addons/screensaver.matrixtrails/package.mk @@ -22,7 +22,7 @@ PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="https://github.com/notspiff/screensaver.matrixtrails" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_URL="https://github.com/notspiff/screensaver.matrixtrails/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain kodi-platform soil" PKG_PRIORITY="optional" PKG_SECTION="" @@ -47,6 +47,8 @@ configure_target() { addon() { mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PR $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PL $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/*.so $ADDON_BUILD/$PKG_ADDON_ID/ + cp -R $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ + + ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) + cp -L $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ } diff --git a/packages/mediacenter/kodi-binary-addons/screensaver.pingpong/package.mk b/packages/mediacenter/kodi-binary-addons/screensaver.pingpong/package.mk index d59a0404966..864c70f4e55 100644 --- a/packages/mediacenter/kodi-binary-addons/screensaver.pingpong/package.mk +++ b/packages/mediacenter/kodi-binary-addons/screensaver.pingpong/package.mk @@ -22,7 +22,7 @@ PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="https://github.com/notspiff/screensaver.pingpong" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_URL="https://github.com/notspiff/screensaver.pingpong/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain kodi-platform" PKG_PRIORITY="optional" PKG_SECTION="" @@ -47,6 +47,8 @@ configure_target() { addon() { mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PR $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PL $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/*.so $ADDON_BUILD/$PKG_ADDON_ID/ + cp -R $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ + + ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) + cp -L $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ } diff --git a/packages/mediacenter/kodi-binary-addons/screensaver.pyro/package.mk b/packages/mediacenter/kodi-binary-addons/screensaver.pyro/package.mk index 5af4fa83874..e32dcd610de 100644 --- a/packages/mediacenter/kodi-binary-addons/screensaver.pyro/package.mk +++ b/packages/mediacenter/kodi-binary-addons/screensaver.pyro/package.mk @@ -22,7 +22,7 @@ PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="https://github.com/notspiff/screensaver.pyro" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_URL="https://github.com/notspiff/screensaver.pyro/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain kodi-platform" PKG_PRIORITY="optional" PKG_SECTION="" @@ -47,6 +47,8 @@ configure_target() { addon() { mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PR $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PL $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/*.so $ADDON_BUILD/$PKG_ADDON_ID/ + cp -R $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ + + ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) + cp -L $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ } diff --git a/packages/mediacenter/kodi-binary-addons/screensaver.shadertoy/package.mk b/packages/mediacenter/kodi-binary-addons/screensaver.shadertoy/package.mk new file mode 100644 index 00000000000..4da1b524d04 --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/screensaver.shadertoy/package.mk @@ -0,0 +1,70 @@ +################################################################################ +# This file is part of LibreELEC - https://libreelec.tv +# Copyright (C) 2009-2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see <http://www.gnu.org/licenses/>. +################################################################################ + +PKG_NAME="screensaver.shadertoy" +PKG_VERSION="394de3d" +PKG_REV="1" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/popcornmix/screensaver.shadertoy" +PKG_URL="https://github.com/popcornmix/screensaver.shadertoy/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform" +PKG_PRIORITY="optional" +PKG_SECTION="" +PKG_SHORTDESC="screensaver.shadertoy" +PKG_LONGDESC="screensaver.shadertoy" +PKG_AUTORECONF="no" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="xbmc.ui.screensaver" + +if [ ! "$OPENGL" = "no" ]; then +# for OpenGL (GLX) support + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET $OPENGL glew" +fi + +if [ "$OPENGLES_SUPPORT" = yes ]; then +# for OpenGL-ES support + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET $OPENGLES" +fi + +configure_target() { + if [ "$KODIPLAYER_DRIVER" = bcm2835-driver ]; then + BCM2835_INCLUDES="-I$SYSROOT_PREFIX/usr/include/interface/vcos/pthreads/ \ + -I$SYSROOT_PREFIX/usr/include/interface/vmcs_host/linux" + export CFLAGS="$CFLAGS $BCM2835_INCLUDES" + export CXXFLAGS="$CXXFLAGS $BCM2835_INCLUDES" + elif [ "$KODIPLAYER_DRIVER" = libfslvpuwrap ]; then + export CFLAGS="$CFLAGS -DLINUX -DEGL_API_FB" + export CXXFLAGS="$CXXFLAGS -DLINUX -DEGL_API_FB" + fi + + cmake -DCMAKE_TOOLCHAIN_FILE=$CMAKE_CONF \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DCMAKE_MODULE_PATH=$SYSROOT_PREFIX/usr/lib/kodi \ + -DCMAKE_PREFIX_PATH=$SYSROOT_PREFIX/usr \ + .. +} + +addon() { + mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ + cp -R $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ + + ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) + cp -L $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ +} diff --git a/packages/mediacenter/kodi-binary-addons/screensaver.stars/package.mk b/packages/mediacenter/kodi-binary-addons/screensaver.stars/package.mk index 9cf99af783d..0ba8417c94c 100644 --- a/packages/mediacenter/kodi-binary-addons/screensaver.stars/package.mk +++ b/packages/mediacenter/kodi-binary-addons/screensaver.stars/package.mk @@ -22,7 +22,7 @@ PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="https://github.com/notspiff/screensaver.stars" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_URL="https://github.com/notspiff/screensaver.stars/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain kodi-platform" PKG_PRIORITY="optional" PKG_SECTION="" @@ -47,6 +47,8 @@ configure_target() { addon() { mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PR $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PL $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/*.so $ADDON_BUILD/$PKG_ADDON_ID/ + cp -R $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ + + ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) + cp -L $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ } diff --git a/packages/mediacenter/kodi-binary-addons/screensavers.rsxs/package.mk b/packages/mediacenter/kodi-binary-addons/screensavers.rsxs/package.mk index b526cfcf2d5..ccd0365f568 100644 --- a/packages/mediacenter/kodi-binary-addons/screensavers.rsxs/package.mk +++ b/packages/mediacenter/kodi-binary-addons/screensavers.rsxs/package.mk @@ -22,8 +22,8 @@ PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.kodi.tv" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" -PKG_DEPENDS_TARGET="toolchain kodi-platform" +PKG_URL="https://github.com/notspiff/screensavers.rsxs/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform libXt libXmu" PKG_PRIORITY="optional" PKG_SECTION="" PKG_SHORTDESC="screensavers.rsxs" diff --git a/packages/mediacenter/kodi-binary-addons/visualization.fishbmc/package.mk b/packages/mediacenter/kodi-binary-addons/visualization.fishbmc/package.mk index 1007d87d92f..1846596ecbf 100644 --- a/packages/mediacenter/kodi-binary-addons/visualization.fishbmc/package.mk +++ b/packages/mediacenter/kodi-binary-addons/visualization.fishbmc/package.mk @@ -22,7 +22,7 @@ PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.kodi.tv" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_URL="https://github.com/notspiff/visualization.fishbmc/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain kodi-platform" PKG_PRIORITY="optional" PKG_SECTION="" @@ -47,6 +47,8 @@ configure_target() { addon() { mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PR $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PL $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/*.so $ADDON_BUILD/$PKG_ADDON_ID/ + cp -R $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ + + ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) + cp -L $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ } diff --git a/packages/mediacenter/kodi-binary-addons/visualization.goom/package.mk b/packages/mediacenter/kodi-binary-addons/visualization.goom/package.mk index c05cc966cf5..1e397bc9bdb 100644 --- a/packages/mediacenter/kodi-binary-addons/visualization.goom/package.mk +++ b/packages/mediacenter/kodi-binary-addons/visualization.goom/package.mk @@ -22,7 +22,7 @@ PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="https://github.com/notspiff/visualization.goom" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_URL="https://github.com/notspiff/visualization.goom/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain kodi-platform" PKG_PRIORITY="optional" PKG_SECTION="" @@ -47,6 +47,8 @@ configure_target() { addon() { mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PR $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PL $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/*.so $ADDON_BUILD/$PKG_ADDON_ID/ + cp -R $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ + + ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) + cp -L $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ } diff --git a/packages/mediacenter/kodi-binary-addons/visualization.pictureit/package.mk b/packages/mediacenter/kodi-binary-addons/visualization.pictureit/package.mk new file mode 100644 index 00000000000..22534e5fbfc --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/visualization.pictureit/package.mk @@ -0,0 +1,50 @@ +################################################################################ +# This file is part of LibreELEC - https://libreelec.tv +# Copyright (C) 2009-2016 Lukas Rusak (lrusak@libreelec.tv) +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see <http://www.gnu.org/licenses/>. +################################################################################ + +PKG_NAME="visualization.pictureit" +PKG_VERSION="e11d577" +PKG_REV="1" +PKG_ARCH="x86_64" +PKG_LICENSE="GPL" +PKG_SITE="http://www.kodi.tv" +PKG_URL="https://github.com/linuxwhatelse/visualization.pictureit/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform" +PKG_PRIORITY="optional" +PKG_SECTION="" +PKG_SHORTDESC="visualization.pictureit" +PKG_LONGDESC="visualization.pictureit" +PKG_AUTORECONF="no" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="xbmc.player.musicviz" + +configure_target() { + cmake -DCMAKE_TOOLCHAIN_FILE=$CMAKE_CONF \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DCMAKE_MODULE_PATH=$SYSROOT_PREFIX/usr/lib/kodi \ + -DCMAKE_PREFIX_PATH=$SYSROOT_PREFIX/usr \ + .. +} + +addon() { + mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ + cp -R $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ + + ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) + cp -L $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ +} diff --git a/packages/mediacenter/kodi-binary-addons/visualization.projectm/package.mk b/packages/mediacenter/kodi-binary-addons/visualization.projectm/package.mk index c80a349e6f4..3c1f72081cc 100644 --- a/packages/mediacenter/kodi-binary-addons/visualization.projectm/package.mk +++ b/packages/mediacenter/kodi-binary-addons/visualization.projectm/package.mk @@ -22,7 +22,7 @@ PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="https://github.com/notspiff/visualization.projectm" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_URL="https://github.com/notspiff/visualization.projectm/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain kodi-platform libprojectM" PKG_PRIORITY="optional" PKG_SECTION="" @@ -51,6 +51,8 @@ configure_target() { addon() { mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PR $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PL $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/*.so $ADDON_BUILD/$PKG_ADDON_ID/ + cp -R $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ + + ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) + cp -L $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ } diff --git a/packages/mediacenter/kodi-binary-addons/visualization.shadertoy/package.mk b/packages/mediacenter/kodi-binary-addons/visualization.shadertoy/package.mk new file mode 100644 index 00000000000..af3a4d866a3 --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/visualization.shadertoy/package.mk @@ -0,0 +1,70 @@ +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# +# OpenELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# OpenELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with OpenELEC. If not, see <http://www.gnu.org/licenses/>. +################################################################################ + +PKG_NAME="visualization.shadertoy" +PKG_VERSION="5b64785" +PKG_REV="1" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/notspiff/visualization.shadertoy" +PKG_URL="https://github.com/notspiff/visualization.shadertoy/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform" +PKG_PRIORITY="optional" +PKG_SECTION="" +PKG_SHORTDESC="visualization.shadertoy" +PKG_LONGDESC="visualization.shadertoy" +PKG_AUTORECONF="no" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="xbmc.player.musicviz" + +if [ ! "$OPENGL" = "no" ]; then +# for OpenGL (GLX) support + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET $OPENGL glew" +fi + +if [ "$OPENGLES_SUPPORT" = yes ]; then +# for OpenGL-ES support + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET $OPENGLES" +fi + +configure_target() { + if [ "$KODIPLAYER_DRIVER" = bcm2835-driver ]; then + BCM2835_INCLUDES="-I$SYSROOT_PREFIX/usr/include/interface/vcos/pthreads/ \ + -I$SYSROOT_PREFIX/usr/include/interface/vmcs_host/linux" + export CFLAGS="$CFLAGS $BCM2835_INCLUDES" + export CXXFLAGS="$CXXFLAGS $BCM2835_INCLUDES" + elif [ "$KODIPLAYER_DRIVER" = libfslvpuwrap ]; then + export CFLAGS="$CFLAGS -DLINUX -DEGL_API_FB" + export CXXFLAGS="$CXXFLAGS -DLINUX -DEGL_API_FB" + fi + + cmake -DCMAKE_TOOLCHAIN_FILE=$CMAKE_CONF \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DCMAKE_MODULE_PATH=$SYSROOT_PREFIX/usr/lib/kodi \ + -DCMAKE_PREFIX_PATH=$SYSROOT_PREFIX/usr \ + .. +} + +addon() { + mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ + cp -R $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ + + ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) + cp -L $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ +} diff --git a/packages/mediacenter/kodi-binary-addons/visualization.spectrum/package.mk b/packages/mediacenter/kodi-binary-addons/visualization.spectrum/package.mk index a1286a13158..07392f406dc 100644 --- a/packages/mediacenter/kodi-binary-addons/visualization.spectrum/package.mk +++ b/packages/mediacenter/kodi-binary-addons/visualization.spectrum/package.mk @@ -17,12 +17,12 @@ ################################################################################ PKG_NAME="visualization.spectrum" -PKG_VERSION="9dbe53a" +PKG_VERSION="d662ffe" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.kodi.tv" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_URL="https://github.com/notspiff/visualization.spectrum/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain kodi-platform" PKG_PRIORITY="optional" PKG_SECTION="" @@ -43,6 +43,8 @@ configure_target() { addon() { mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PR $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PL $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/*.so $ADDON_BUILD/$PKG_ADDON_ID/ + cp -R $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ + + ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) + cp -L $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ } diff --git a/packages/mediacenter/kodi-binary-addons/visualization.vsxu/package.mk b/packages/mediacenter/kodi-binary-addons/visualization.vsxu/package.mk index 2450c2664dc..3dc330b1dda 100644 --- a/packages/mediacenter/kodi-binary-addons/visualization.vsxu/package.mk +++ b/packages/mediacenter/kodi-binary-addons/visualization.vsxu/package.mk @@ -19,10 +19,10 @@ PKG_NAME="visualization.vsxu" PKG_VERSION="990332f" PKG_REV="1" -PKG_ARCH="any" +PKG_ARCH="i386 x86_64" PKG_LICENSE="GPL" PKG_SITE="https://github.com/notspiff/visualization.vsxu" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_URL="https://github.com/notspiff/visualization.vsxu/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain kodi-platform vsxu" PKG_PRIORITY="optional" PKG_SECTION="" @@ -33,17 +33,6 @@ PKG_AUTORECONF="no" PKG_IS_ADDON="yes" PKG_ADDON_TYPE="xbmc.player.musicviz" -if [ "$OPENGL" = "no" ] ; then - exit 0 -fi - -# dont build and upload for repos for now -# TODO fix -# undefined symbol: mt_32_to_double -# vis.vsxu also not linked against libGL ? - -exit 0 - configure_target() { cmake -DCMAKE_TOOLCHAIN_FILE=$CMAKE_CONF \ -DCMAKE_INSTALL_PREFIX=/usr \ @@ -54,6 +43,8 @@ configure_target() { addon() { mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PR $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PL $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/*.so $ADDON_BUILD/$PKG_ADDON_ID/ + cp -R $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ + + ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) + cp -L $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ } diff --git a/packages/mediacenter/kodi-binary-addons/visualization.waveform/package.mk b/packages/mediacenter/kodi-binary-addons/visualization.waveform/package.mk index f80e51ffd08..cda6e2e59bd 100644 --- a/packages/mediacenter/kodi-binary-addons/visualization.waveform/package.mk +++ b/packages/mediacenter/kodi-binary-addons/visualization.waveform/package.mk @@ -22,7 +22,7 @@ PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.kodi.tv" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_URL="https://github.com/notspiff/visualization.waveform/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain kodi-platform" PKG_PRIORITY="optional" PKG_SECTION="" @@ -43,6 +43,8 @@ configure_target() { addon() { mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PR $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - cp -PL $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/*.so $ADDON_BUILD/$PKG_ADDON_ID/ + cp -R $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ + + ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) + cp -L $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ } diff --git a/packages/mediacenter/kodi-binary-addons/visualization.wavforhue/package.mk b/packages/mediacenter/kodi-binary-addons/visualization.wavforhue/package.mk new file mode 100644 index 00000000000..d34efaa43f9 --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/visualization.wavforhue/package.mk @@ -0,0 +1,50 @@ +################################################################################ +# This file is part of LibreELEC - https://libreelec.tv +# Copyright (C) 2009-2016 Lukas Rusak (lrusak@libreelec.tv) +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see <http://www.gnu.org/licenses/>. +################################################################################ + +PKG_NAME="visualization.wavforhue" +PKG_VERSION="e57e436" +PKG_REV="1" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="http://www.kodi.tv" +PKG_URL="https://github.com/hardyt/visualization.wavforhue/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform" +PKG_PRIORITY="optional" +PKG_SECTION="" +PKG_SHORTDESC="visualization.wavforhue" +PKG_LONGDESC="visualization.wavforhue" +PKG_AUTORECONF="no" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="xbmc.player.musicviz" + +configure_target() { + cmake -DCMAKE_TOOLCHAIN_FILE=$CMAKE_CONF \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DCMAKE_MODULE_PATH=$SYSROOT_PREFIX/usr/lib/kodi \ + -DCMAKE_PREFIX_PATH=$SYSROOT_PREFIX/usr \ + .. +} + +addon() { + mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ + cp -R $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ + + ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) + cp -L $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ +} diff --git a/packages/mediacenter/kodi-platform/package.mk b/packages/mediacenter/kodi-platform/package.mk index 80d5ca7ad98..65ecd625627 100644 --- a/packages/mediacenter/kodi-platform/package.mk +++ b/packages/mediacenter/kodi-platform/package.mk @@ -17,13 +17,13 @@ ################################################################################ PKG_NAME="kodi-platform" -PKG_VERSION="15edaf7" +PKG_VERSION="fed924e" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.kodi.tv" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" -PKG_DEPENDS_TARGET="toolchain tinyxml kodi platform" +PKG_URL="https://github.com/xbmc/kodi-platform/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain tinyxml kodi p8-platform" PKG_PRIORITY="optional" PKG_SECTION="multimedia" PKG_SHORTDESC="kodi-platform:" diff --git a/packages/mediacenter/kodi-platform/patches/kodi-platform-02_no-multi-lib.patch b/packages/mediacenter/kodi-platform/patches/kodi-platform-02_no-multi-lib.patch index 9646eaea05e..3b57df93874 100644 --- a/packages/mediacenter/kodi-platform/patches/kodi-platform-02_no-multi-lib.patch +++ b/packages/mediacenter/kodi-platform/patches/kodi-platform-02_no-multi-lib.patch @@ -1,10 +1,10 @@ -diff -Naur kodi-platform-15edaf7.orig/CMakeLists.txt kodi-platform-15edaf7/CMakeLists.txt ---- kodi-platform-15edaf7.orig/CMakeLists.txt 2015-10-22 17:44:43.034540766 -0700 -+++ kodi-platform-15edaf7/CMakeLists.txt 2015-10-22 17:46:38.851326343 -0700 +diff -Naur a/CMakeLists.txt b/CMakeLists.txt +--- a/CMakeLists.txt 2016-01-06 00:56:44.616186365 +0100 ++++ b/CMakeLists.txt 2016-01-06 00:59:03.502490684 +0100 @@ -9,7 +9,6 @@ find_package(TinyXML REQUIRED) find_package(Threads REQUIRED) - find_package(platform REQUIRED) + find_package(p8-platform REQUIRED) -include(UseMultiArch.cmake) include(CheckAtomic.cmake) diff --git a/packages/mediacenter/kodi-theme-Confluence/patches/kodi-theme-Confluence-001-add_oe_settings_to_homescreen.patch b/packages/mediacenter/kodi-theme-Confluence/patches/kodi-theme-Confluence-001-add_oe_settings_to_homescreen.patch deleted file mode 100644 index f12d512b075..00000000000 --- a/packages/mediacenter/kodi-theme-Confluence/patches/kodi-theme-Confluence-001-add_oe_settings_to_homescreen.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- a/720p/IncludesHomeMenuItems.xml 2012-07-22 21:56:07.000000000 +0400 -+++ b/720p/IncludesHomeMenuItems.xml 2012-09-13 23:34:16.975470148 +0400 -@@ -189,6 +189,11 @@ - <label>5</label> - <onclick>ActivateWindow(Settings)</onclick> - </control> -+ <control type="button" id="90120"> -+ <include>ButtonHomeSubCommonValues</include> -+ <label>@DISTRONAME@</label> -+ <onclick>RunAddon(service.openelec.settings)</onclick> -+ </control> - <control type="button" id="90123"> - <include>ButtonHomeSubCommonValues</include> - <label>7</label> diff --git a/packages/mediacenter/kodi-theme-Confluence/package.mk b/packages/mediacenter/kodi-theme-Estuary/package.mk similarity index 67% rename from packages/mediacenter/kodi-theme-Confluence/package.mk rename to packages/mediacenter/kodi-theme-Estuary/package.mk index 2c3a7e0bc45..d58e5a82c2c 100644 --- a/packages/mediacenter/kodi-theme-Confluence/package.mk +++ b/packages/mediacenter/kodi-theme-Estuary/package.mk @@ -16,8 +16,8 @@ # along with OpenELEC. If not, see <http://www.gnu.org/licenses/>. ################################################################################ -PKG_NAME="kodi-theme-Confluence" -PKG_VERSION="16.0-a5f3a99" +PKG_NAME="kodi-theme-Estuary" +PKG_VERSION="17.0-alpha2-4e90409" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" @@ -26,7 +26,7 @@ PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" PKG_DEPENDS_TARGET="toolchain kodi:host" PKG_PRIORITY="optional" PKG_SECTION="mediacenter" -PKG_SHORTDESC="kodi-theme-Confluence: Kodi Mediacenter default theme" +PKG_SHORTDESC="kodi-theme-Estuary: Kodi Mediacenter default theme" PKG_LONGDESC="Kodi Media Center (which was formerly named Xbox Media Center and XBMC) is a free and open source cross-platform media player and home entertainment system software with a 10-foot user interface designed for the living-room TV. Its graphical user interface allows the user to easily manage video, photos, podcasts, and music from a computer, optical disk, local network, and the internet using a remote control." PKG_IS_ADDON="no" @@ -37,19 +37,28 @@ make_target() { -output Textures.xbt \ -dupecheck \ -use_none + + for theme in themes/*; do + TexturePacker -input $theme \ + -output $(basename $theme).xbt \ + -dupecheck + done } makeinstall_target() { - mkdir -p $INSTALL/usr/share/kodi/addons/skin.confluence - cp -R */ $INSTALL/usr/share/kodi/addons/skin.confluence - cp *.txt $INSTALL/usr/share/kodi/addons/skin.confluence - cp *.xml $INSTALL/usr/share/kodi/addons/skin.confluence - cp *.png $INSTALL/usr/share/kodi/addons/skin.confluence - rm -rf $INSTALL/usr/share/kodi/addons/skin.confluence/media + mkdir -p $INSTALL/usr/share/kodi/addons/skin.estuary + cp -R */ $INSTALL/usr/share/kodi/addons/skin.estuary + cp *.txt $INSTALL/usr/share/kodi/addons/skin.estuary + cp *.xml $INSTALL/usr/share/kodi/addons/skin.estuary + cp *.png $INSTALL/usr/share/kodi/addons/skin.estuary + rm -rf $INSTALL/usr/share/kodi/addons/skin.estuary/media - mkdir -p $INSTALL/usr/share/kodi/addons/skin.confluence/media - cp Textures.xbt $INSTALL/usr/share/kodi/addons/skin.confluence/media + mkdir -p $INSTALL/usr/share/kodi/addons/skin.estuary/media + cp Textures.xbt $INSTALL/usr/share/kodi/addons/skin.estuary/media + for theme in themes/*; do + cp $(basename $theme).xbt $INSTALL/usr/share/kodi/addons/skin.estuary/media + done # Rebrand - sed -e "s,@DISTRONAME@,$DISTRONAME,g" -i $INSTALL/usr/share/kodi/addons/skin.confluence/720p/IncludesHomeMenuItems.xml + sed -e "s,@DISTRONAME@,$DISTRONAME,g" -i $INSTALL/usr/share/kodi/addons/skin.estuary/1080i/Home.xml } diff --git a/packages/mediacenter/kodi-theme-Estuary/patches/kodi-theme-Estuary-0001-add_oe_settings_to_homescreen.patch b/packages/mediacenter/kodi-theme-Estuary/patches/kodi-theme-Estuary-0001-add_oe_settings_to_homescreen.patch new file mode 100644 index 00000000000..c2806c96d5e --- /dev/null +++ b/packages/mediacenter/kodi-theme-Estuary/patches/kodi-theme-Estuary-0001-add_oe_settings_to_homescreen.patch @@ -0,0 +1,16 @@ +diff -Naur a/1080i/Home.xml b/1080i/Home.xml +--- a/1080i/Home.xml 2016-03-29 23:29:42.616607010 +0100 ++++ b/1080i/Home.xml 2016-03-29 23:30:49.205150336 +0100 +@@ -1090,6 +1090,12 @@ + <property name="id">weather</property> + <visible>!Skin.HasSetting(HomeMenuNoWeatherButton)</visible> + </item> ++ <item> ++ <label>@DISTRONAME@</label> ++ <onclick>RunAddon(service.libreelec.settings)</onclick> ++ <thumb>icons/home/libreelec.png</thumb> ++ <property name="id">libreelec</property> ++ </item> + </content> + </control> + </control> diff --git a/packages/mediacenter/kodi-theme-Estuary/sources/media/icons/home/libreelec.png b/packages/mediacenter/kodi-theme-Estuary/sources/media/icons/home/libreelec.png new file mode 100644 index 00000000000..458b87fefd8 Binary files /dev/null and b/packages/mediacenter/kodi-theme-Estuary/sources/media/icons/home/libreelec.png differ diff --git a/packages/mediacenter/kodi-theme-slice/package.mk b/packages/mediacenter/kodi-theme-slice/package.mk new file mode 100644 index 00000000000..885bdd1aadc --- /dev/null +++ b/packages/mediacenter/kodi-theme-slice/package.mk @@ -0,0 +1,61 @@ +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) +# +# OpenELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# OpenELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with OpenELEC. If not, see <http://www.gnu.org/licenses/>. +################################################################################ + +PKG_NAME="kodi-theme-slice" +PKG_VERSION="0.9.18u" +PKG_REV="1" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="http://www.fiveninjas.com" +PKG_URL="http://updates.fiveninjas.com/src/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi led_tools" +PKG_PRIORITY="optional" +PKG_SECTION="mediacenter" +PKG_SHORTDESC="kodi-theme-Slice: Slice media center default skin" +PKG_LONGDESC="Slice skin: Optimised skin for the Slice media player" + +PKG_IS_ADDON="no" +PKG_AUTORECONF="no" + +make_target() { + TexturePacker -input media/ \ + -output Textures.xbt \ + -dupecheck \ + -use_none + for i in `ls themes`; do + echo Packing theme $i + TexturePacker -input themes/$i/ \ + -output $i.xbt \ + -dupecheck \ + -use_none + done +} + +makeinstall_target() { + mkdir -p $INSTALL/usr/share/kodi/addons/skin.slice + cp -R */ $INSTALL/usr/share/kodi/addons/skin.slice + rm -rf $INSTALL/usr/share/kodi/addons/skin.slice/media + cp *.xml $INSTALL/usr/share/kodi/addons/skin.slice + + mkdir -p $INSTALL/usr/share/kodi/addons/skin.slice/media + cp Textures.xbt $INSTALL/usr/share/kodi/addons/skin.slice/media + for i in `ls themes`; do + cp $i.xbt $INSTALL/usr/share/kodi/addons/skin.slice/media + done +} + diff --git a/packages/mediacenter/kodi/config/advancedsettings.xml b/packages/mediacenter/kodi/config/advancedsettings.xml index c54111aaa32..e139c4836e2 100644 --- a/packages/mediacenter/kodi/config/advancedsettings.xml +++ b/packages/mediacenter/kodi/config/advancedsettings.xml @@ -17,7 +17,4 @@ <samba> <clienttimeout>30</clienttimeout> </samba> - <network> - <readbufferfactor>4.0</readbufferfactor> - </network> </advancedsettings> diff --git a/packages/mediacenter/kodi/config/appliance.xml b/packages/mediacenter/kodi/config/appliance.xml index b5e7362065d..a9f67d5b83a 100644 --- a/packages/mediacenter/kodi/config/appliance.xml +++ b/packages/mediacenter/kodi/config/appliance.xml @@ -1,12 +1,35 @@ <?xml version="1.0" encoding="utf-8" ?> <settings> + + <section id="interface"> + <category id="other"> + <group id="2"> + <setting id="lookandfeel.enablerssfeeds"> + <default>false</default> + </setting> + </group> + </category> + </section> + <section id="system"> - <category id="videoscreen"> + <category id="display"> <group id="1"> <setting id="videoscreen.screen"> <visible>false</visible> </setting> </group> + <group id="3"> + <setting id="videoscreen.noofbuffers"> + <default>2</default> + </setting> + </group> + </category> + <category id="audio"> + <group id="1"> + <setting id="audiooutput.volumesteps"> + <default>20</default> + </setting> + </group> </category> </section> @@ -19,8 +42,8 @@ </group> </category> - <category id="zeroconf"> - <group id="1"> + <category id="general"> + <group id="2"> <setting id="services.zeroconf"> <default>true</default> </setting> @@ -44,6 +67,7 @@ </setting> </group> </category> + <category id="epg"> <group id="2"> <setting id="epg.preventupdateswhileplayingtv"> @@ -54,6 +78,7 @@ </setting> </group> </category> + <category id="pvrplayback"> <group id="1"> <setting id="pvrplayback.signalquality"> @@ -61,8 +86,9 @@ </setting> </group> </category> + <category id="pvrpowermanagement"> - <group id="2"> + <group id="1"> <setting id="pvrpowermanagement.setwakeupcmd"> <default>/usr/bin/setwakeup.sh</default> </setting> diff --git a/packages/mediacenter/kodi/config/os.libreelec.tv/addon.xml b/packages/mediacenter/kodi/config/os.libreelec.tv/addon.xml new file mode 100644 index 00000000000..6d30d320c46 --- /dev/null +++ b/packages/mediacenter/kodi/config/os.libreelec.tv/addon.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<addon id="os.libreelec.tv" version="@OS_VERSION@" provider-name="LibreELEC.tv"> + <requires> + <import addon="xbmc.addon" version="12.0"/> + </requires> +</addon> diff --git a/packages/mediacenter/kodi/config/repository.kodi.game/addon.xml b/packages/mediacenter/kodi/config/repository.kodi.game/addon.xml new file mode 100644 index 00000000000..c2ce2650c71 --- /dev/null +++ b/packages/mediacenter/kodi/config/repository.kodi.game/addon.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8" standalone="yes"?> +<addon id="repository.kodi.game" + name="Kodi game add-on repository (alpha)" + version="1.0.0" + provider-name="Team Kodi"> + <requires> + <import addon="xbmc.addon" version="15.0.0"/> + <import addon="kodi.game" version="1.0.0"/> + </requires> + <extension point="xbmc.addon.repository" name="Kodi game add-on repository (alpha)"> + <info compressed="false">https://raw.githubusercontent.com/kodi-game/repository.kodi.game/master/release/addons.xml</info> + <checksum>https://raw.githubusercontent.com/kodi-game/repository.kodi.game/master/release/addons.xml.md5</checksum> + <datadir zip="true">https://github.com/kodi-game/repository.kodi.game/raw/master/release/</datadir> + </extension> + <extension point="xbmc.addon.metadata"> + <summary lang="en_GB">Install game add-ons from Kodi.tv</summary> + <description lang="en_GB">This repository is for development builds of Kodi's RetroPlayer project.</description> + <license>GPLv2</license> + <forum>http://forum.kodi.tv/forumdisplay.php?fid=194</forum> + <website>http://kodi.tv</website> + <source>https://github.com/kodi-game/repository.kodi.game</source> + <nofanart>true</nofanart> + <platform>all</platform> + </extension> +</addon> diff --git a/packages/mediacenter/kodi/config/repository.kodi.game/icon.png b/packages/mediacenter/kodi/config/repository.kodi.game/icon.png new file mode 100644 index 00000000000..b2fb26c3f6e Binary files /dev/null and b/packages/mediacenter/kodi/config/repository.kodi.game/icon.png differ diff --git a/packages/mediacenter/kodi/config/repository.libreelec.tv/addon.xml b/packages/mediacenter/kodi/config/repository.libreelec.tv/addon.xml new file mode 100644 index 00000000000..f09d02c40cd --- /dev/null +++ b/packages/mediacenter/kodi/config/repository.libreelec.tv/addon.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8" standalone="yes"?> +<addon id="repository.libreelec.tv" + name="LibreELEC Add-ons" + version="8.0.0" + provider-name="Team LibreELEC"> + <extension point="xbmc.addon.repository" + name="LibreELEC Add-ons"> + <info>@ADDON_URL@/addons.xml.gz</info> + <checksum>@ADDON_URL@/addons.xml.gz.md5</checksum> + <datadir zip="true">@ADDON_URL@</datadir> + </extension> + <extension point="xbmc.addon.metadata"> + <summary>LibreELEC Add-ons</summary> + <description>The LibreELEC add-on repository contains Kodi PVR Clients and Servers, Screensavers, Visualisations, and more. Add-ons in this repository are maintained and supported by LibreELEC staff and YOU the community. If you find a broken or non-working add-on please report it via the forums, or help by submitting fixes via GitHub.</description> + <platform>all</platform> + </extension> +</addon> diff --git a/packages/mediacenter/kodi/config/repository.libreelec.tv/icon.png b/packages/mediacenter/kodi/config/repository.libreelec.tv/icon.png new file mode 100644 index 00000000000..9d3162cf275 Binary files /dev/null and b/packages/mediacenter/kodi/config/repository.libreelec.tv/icon.png differ diff --git a/packages/mediacenter/kodi/config/repository.openelec.tv/addon.xml b/packages/mediacenter/kodi/config/repository.openelec.tv/addon.xml deleted file mode 100644 index d5437d03931..00000000000 --- a/packages/mediacenter/kodi/config/repository.openelec.tv/addon.xml +++ /dev/null @@ -1,17 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="yes"?> -<addon id="repository.openelec.tv" - name="[COLOR FF757677]Open[/COLOR][COLOR FF8ABEE2]ELEC[/COLOR] Add-ons (official)" - version="7.0.0" - provider-name="Team [COLOR FF757677]Open[/COLOR][COLOR FF8ABEE2]ELEC[/COLOR]"> - <extension point="xbmc.addon.repository" - name="OpenELEC Add-ons (official)"> - <info>@ADDON_URL@/addons.xml</info> - <checksum>@ADDON_URL@/addons.xml.md5</checksum> - <datadir zip="true">@ADDON_URL@</datadir> - </extension> - <extension point="xbmc.addon.metadata"> - <summary>OpenELEC Add-ons (official)</summary> - <description>The OpenELEC official repository contains Kodi PVR Clients, Screensavers, Visualisations, the unofficial repo installer, and more. Add-ons in this repository are maintained and supported by OpenELEC staff and sponsors. If you find a broken or non-working add-on please report it via the forums.</description> - <platform>all</platform> - </extension> -</addon> diff --git a/packages/mediacenter/kodi/config/repository.openelec.tv/icon.png b/packages/mediacenter/kodi/config/repository.openelec.tv/icon.png deleted file mode 100644 index 1147ae1d37a..00000000000 Binary files a/packages/mediacenter/kodi/config/repository.openelec.tv/icon.png and /dev/null differ diff --git a/packages/mediacenter/kodi/libdvd/libdvd-makefile.in b/packages/mediacenter/kodi/libdvd/libdvd-makefile.in new file mode 100644 index 00000000000..e99b7461778 --- /dev/null +++ b/packages/mediacenter/kodi/libdvd/libdvd-makefile.in @@ -0,0 +1,34 @@ +ARCH=@ARCH@ +CC=@CC@ +CXX=@CXX@ + +DVDNAV_A = $(DVD_PREFIX)/usr/lib/libdvdnav.a +DVDREAD_A = $(DVD_PREFIX)/usr/lib/libdvdread.a +DVDCSS_A = $(DVD_PREFIX)/usr/lib/libdvdcss.a + +WRAPPER = @abs_top_srcdir@/xbmc/cores/DllLoader/exports/wrapper.o +WRAPPER_DEF = @abs_top_srcdir@/xbmc/cores/DllLoader/exports/wrapper.def + +SO_LDFLAGS = $(LDFLAGS) -shared -fPIC -rdynamic + +SYSDIR = @abs_top_srcdir@/system/players/VideoPlayer +SOS = libdvdcss-$(ARCH).so libdvdnav-$(ARCH).so +SLIB = $(addprefix $(SYSDIR)/, $(SOS)) + +all: $(SLIB) + +$(SYSDIR)/libdvdcss-$(ARCH).so: $(WRAPPER) $(WRAPPER_DEF) $(DVDCSS_A) + mkdir -p libdvdcss; cd libdvdcss; $(AR) x $(DVDCSS_A) + $(CC) -o $@ $(SO_LDFLAGS) -Wl,--soname,$@ libdvdcss/*.o -Wl,--unresolved-symbols=ignore-all -lm \ + `cat $(WRAPPER_DEF)` $(WRAPPER) + +$(SYSDIR)/libdvdnav-$(ARCH).so: $(WRAPPER) $(WRAPPER_DEF) $(DVDNAV_A) $(DVDREAD_A) $(DVDCSS_A) + mkdir -p libdvdread; cd libdvdread; $(AR) x $(DVDREAD_A) + mkdir -p libdvdnav; cd libdvdnav; $(AR) x $(DVDNAV_A) + mkdir -p libdvdcss; cd libdvdcss; $(AR) x $(DVDCSS_A) + $(CC) -o $@ $(SO_LDFLAGS) -Wl,--soname,$@ libdvdread/*.o libdvdnav/*.o libdvdcss/*.o -lm -Wl,--unresolved-symbols=ignore-all \ + `cat $(WRAPPER_DEF)` $(WRAPPER) + +$(WRAPPER_DEF): + $(MAKE) -C @abs_top_srcdir@/xbmc/cores/DllLoader/exports wrapper.def + diff --git a/packages/mediacenter/kodi/package.mk b/packages/mediacenter/kodi/package.mk index c7b54079dae..def78dc6b85 100644 --- a/packages/mediacenter/kodi/package.mk +++ b/packages/mediacenter/kodi/package.mk @@ -17,13 +17,13 @@ ################################################################################ PKG_NAME="kodi" -PKG_VERSION="16.0-a5f3a99" +PKG_VERSION="17.0-alpha2-4e90409" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.kodi.tv" PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" -PKG_DEPENDS_TARGET="toolchain kodi:host libsquish boost Python zlib bzip2 systemd pciutils lzo pcre swig:host libass curl rtmpdump fontconfig fribidi tinyxml libjpeg-turbo libpng tiff freetype jasper libogg libcdio libmpeg2 taglib libxml2 libxslt yajl sqlite libvorbis ffmpeg crossguid giflib" +PKG_DEPENDS_TARGET="toolchain kodi:host xmlstarlet:host Python zlib systemd pciutils lzo pcre swig:host libass curl rtmpdump fontconfig fribidi tinyxml libjpeg-turbo freetype libcdio taglib libxml2 libxslt yajl sqlite ffmpeg crossguid giflib libdvdnav" PKG_DEPENDS_HOST="lzo:host libpng:host libjpeg-turbo:host giflib:host" PKG_PRIORITY="optional" PKG_SECTION="mediacenter" @@ -49,7 +49,7 @@ fi if [ ! "$OPENGL" = "no" ]; then # for OpenGL (GLX) support - PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET $OPENGL glu glew" + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET $OPENGL glu" KODI_OPENGL="--enable-gl" else KODI_OPENGL="--disable-gl" @@ -201,7 +201,6 @@ if [ ! "$KODIPLAYER_DRIVER" = default ]; then KODI_CXXFLAGS="$KODI_CXXFLAGS $BCM2835_INCLUDES" elif [ "$KODIPLAYER_DRIVER" = libfslvpuwrap ]; then KODI_CODEC="--enable-codec=imxvpu" - PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET gpu-viv-g2d" elif [ "$KODIPLAYER_DRIVER" = libamcodec ]; then KODI_CODEC="--enable-codec=amcodec" else @@ -209,7 +208,7 @@ if [ ! "$KODIPLAYER_DRIVER" = default ]; then fi fi -if [ "$VDPAU_SUPPORT" = yes ]; then +if [ "$VDPAU_SUPPORT" = "yes" -a "$DISPLAYSERVER" = "x11" ]; then PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET libvdpau" KODI_VDPAU="--enable-vdpau" else @@ -229,14 +228,14 @@ export CXXFLAGS_FOR_BUILD="$HOST_CXXFLAGS" export CFLAGS_FOR_BUILD="$HOST_CFLAGS" export LDFLAGS_FOR_BUILD="$HOST_LDFLAGS" -export PYTHON_VERSION="2.7" +export PYTHON_VERSION=2.7 export PYTHON_CPPFLAGS="-I$SYSROOT_PREFIX/usr/include/python$PYTHON_VERSION" export PYTHON_LDFLAGS="-L$SYSROOT_PREFIX/usr/lib/python$PYTHON_VERSION -lpython$PYTHON_VERSION" export PYTHON_SITE_PKG="$SYSROOT_PREFIX/usr/lib/python$PYTHON_VERSION/site-packages" -export ac_python_version="$PYTHON_VERSION" PKG_CONFIGURE_OPTS_TARGET="gl_cv_func_gettimeofday_clobber=no \ - ac_cv_lib_bluetooth_hci_devid=no \ + ac_python_version=$PYTHON_VERSION \ + --disable-libbluetooth \ --disable-debug \ --disable-optimizations \ $KODI_OPENGL \ @@ -280,34 +279,41 @@ PKG_CONFIGURE_OPTS_TARGET="gl_cv_func_gettimeofday_clobber=no \ pre_configure_host() { # kodi fails to build in subdirs - cd $ROOT/$PKG_BUILD - rm -rf .$HOST_NAME + rm -rf $ROOT/$PKG_BUILD/.$HOST_NAME +} + +configure_host() { + : # not needed } make_host() { - make -C tools/depends/native/JsonSchemaBuilder - make -C tools/depends/native/TexturePacker + mkdir -p $ROOT/$PKG_BUILD/tools/depends/native/JsonSchemaBuilder/bin && cd $_ + cmake -DCMAKE_TOOLCHAIN_FILE=$CMAKE_CONF \ + -DCMAKE_INSTALL_PREFIX=/usr \ + .. + make + mkdir -p $ROOT/$PKG_BUILD/tools/depends/native/TexturePacker/bin && cd $_ + cmake -DCMAKE_TOOLCHAIN_FILE=$CMAKE_CONF \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DCORE_SOURCE_DIR=$ROOT/$PKG_BUILD \ + -DCMAKE_CXX_FLAGS="-std=c++11 -DTARGET_POSIX -DTARGET_LINUX -D_LINUX -I$ROOT/$PKG_BUILD/xbmc/linux" \ + .. + make } makeinstall_host() { - cp -PR tools/depends/native/JsonSchemaBuilder/native/JsonSchemaBuilder $ROOT/$TOOLCHAIN/bin - rm -f $ROOT/$TOOLCHAIN/bin/TexturePacker - cp -PR tools/depends/native/TexturePacker/native/TexturePacker $ROOT/$TOOLCHAIN/bin + cp -P $ROOT/$PKG_BUILD/tools/depends/native/TexturePacker/bin/TexturePacker $ROOT/$TOOLCHAIN/bin } pre_build_target() { # adding fake Makefile for stripped skin - mkdir -p $PKG_BUILD/addons/skin.confluence/media - touch $PKG_BUILD/addons/skin.confluence/media/Makefile.in - -# autoreconf - BOOTSTRAP_STANDALONE=1 make -C $PKG_BUILD -f bootstrap.mk + mkdir -p $ROOT/$PKG_BUILD/addons/skin.estuary/media + touch $ROOT/$PKG_BUILD/addons/skin.estuary/media/Makefile.in } pre_configure_target() { # kodi fails to build in subdirs - cd $ROOT/$PKG_BUILD - rm -rf .$TARGET_NAME + rm -rf $ROOT/$PKG_BUILD/.$TARGET_NAME # kodi should never be built with lto strip_lto @@ -317,6 +323,13 @@ pre_configure_target() { export LIBS="$LIBS -lz" export JSON_BUILDER=$ROOT/$TOOLCHAIN/bin/JsonSchemaBuilder + +# libdvd + cp -P $PKG_DIR/libdvd/libdvd-makefile.in $ROOT/$PKG_BUILD/lib/libdvd/Makefile.in + export DVD_PREFIX="$SYSROOT_PREFIX" + +# autoreconf + BOOTSTRAP_STANDALONE=1 make -f $ROOT/$PKG_BUILD/bootstrap.mk } make_target() { @@ -324,8 +337,8 @@ make_target() { SKIN_DIR="skin.`tolower $SKIN_DEFAULT`" # setup default skin inside the sources - sed -i -e "s|skin.confluence|$SKIN_DIR|g" $ROOT/$PKG_BUILD/xbmc/settings/Settings.h - sed -i -e "s|skin.confluence|$SKIN_DIR|g" $ROOT/$PKG_BUILD/system/settings/settings.xml + sed -i -e "s|skin.estuary|$SKIN_DIR|g" $ROOT/$PKG_BUILD/xbmc/system.h + sed -i -e "s|skin.estuary|$SKIN_DIR|g" $ROOT/$PKG_BUILD/system/settings/settings.xml make externals make kodi.bin @@ -341,16 +354,19 @@ post_makeinstall_target() { rm -rf $INSTALL/usr/bin/xbmc rm -rf $INSTALL/usr/bin/xbmc-standalone rm -rf $INSTALL/usr/lib/kodi/*.cmake - - # more binaddons cross compile badness meh - sed -i -e "s:INCLUDE_DIR /usr/include/kodi:INCLUDE_DIR $SYSROOT_PREFIX/usr/include/kodi:g" $SYSROOT_PREFIX/usr/lib/kodi/kodi-config.cmake + rm -rf $INSTALL/usr/share/applications + rm -rf $INSTALL/usr/share/icons + rm -rf $INSTALL/usr/share/kodi/addons/skin.estouchy + rm -rf $INSTALL/usr/share/kodi/addons/service.xbmc.versioncheck + rm -rf $INSTALL/usr/share/kodi/addons/visualization.vortex + rm -rf $INSTALL/usr/share/xsessions mkdir -p $INSTALL/usr/lib/kodi cp $PKG_DIR/scripts/kodi-config $INSTALL/usr/lib/kodi cp $PKG_DIR/scripts/kodi.sh $INSTALL/usr/lib/kodi - mkdir -p $INSTALL/usr/lib/openelec - cp $PKG_DIR/scripts/systemd-addon-wrapper $INSTALL/usr/lib/openelec + mkdir -p $INSTALL/usr/lib/libreelec + cp $PKG_DIR/scripts/systemd-addon-wrapper $INSTALL/usr/lib/libreelec mkdir -p $INSTALL/usr/bin cp $PKG_DIR/scripts/cputemp $INSTALL/usr/bin @@ -362,20 +378,17 @@ post_makeinstall_target() { rm -rf $INSTALL/usr/lib/kodi/kodi-xrandr fi - rm -rf $INSTALL/usr/share/applications - rm -rf $INSTALL/usr/share/icons - rm -rf $INSTALL/usr/share/kodi/addons/service.xbmc.versioncheck - rm -rf $INSTALL/usr/share/kodi/addons/visualization.vortex - rm -rf $INSTALL/usr/share/xsessions - mkdir -p $INSTALL/usr/share/kodi/addons cp -R $PKG_DIR/config/os.openelec.tv $INSTALL/usr/share/kodi/addons $SED "s|@OS_VERSION@|$OS_VERSION|g" -i $INSTALL/usr/share/kodi/addons/os.openelec.tv/addon.xml - cp -R $PKG_DIR/config/repository.openelec.tv $INSTALL/usr/share/kodi/addons - $SED "s|@ADDON_URL@|$ADDON_URL|g" -i $INSTALL/usr/share/kodi/addons/repository.openelec.tv/addon.xml + cp -R $PKG_DIR/config/os.libreelec.tv $INSTALL/usr/share/kodi/addons + $SED "s|@OS_VERSION@|$OS_VERSION|g" -i $INSTALL/usr/share/kodi/addons/os.libreelec.tv/addon.xml + cp -R $PKG_DIR/config/repository.libreelec.tv $INSTALL/usr/share/kodi/addons + $SED "s|@ADDON_URL@|$ADDON_URL|g" -i $INSTALL/usr/share/kodi/addons/repository.libreelec.tv/addon.xml + cp -R $PKG_DIR/config/repository.kodi.game $INSTALL/usr/share/kodi/addons - mkdir -p $INSTALL/usr/lib/python"$PYTHON_VERSION"/site-packages/kodi - cp -R tools/EventClients/lib/python/* $INSTALL/usr/lib/python"$PYTHON_VERSION"/site-packages/kodi + mkdir -p $INSTALL/usr/lib/python$PYTHON_VERSION/site-packages/kodi + cp -R tools/EventClients/lib/python/* $INSTALL/usr/lib/python$PYTHON_VERSION/site-packages/kodi mkdir -p $INSTALL/usr/share/kodi/config cp $PKG_DIR/config/guisettings.xml $INSTALL/usr/share/kodi/config @@ -404,10 +417,30 @@ post_makeinstall_target() { cp $PKG_DIR/config/appliance.xml $INSTALL/usr/share/kodi/system/settings fi + # update addon manifest + ADDON_MANIFEST=$INSTALL/usr/share/kodi/system/addon-manifest.xml + xmlstarlet ed -L -d "/addons/addon[text()='service.xbmc.versioncheck']" $ADDON_MANIFEST + xmlstarlet ed -L -d "/addons/addon[text()='skin.estouchy']" $ADDON_MANIFEST + xmlstarlet ed -L --subnode "/addons" -t elem -n "addon" -v "repository.kodi.game" $ADDON_MANIFEST + xmlstarlet ed -L --subnode "/addons" -t elem -n "addon" -v "os.libreelec.tv" $ADDON_MANIFEST + xmlstarlet ed -L --subnode "/addons" -t elem -n "addon" -v "os.openelec.tv" $ADDON_MANIFEST + xmlstarlet ed -L --subnode "/addons" -t elem -n "addon" -v "repository.libreelec.tv" $ADDON_MANIFEST + xmlstarlet ed -L --subnode "/addons" -t elem -n "addon" -v "service.libreelec.settings" $ADDON_MANIFEST + + # more binaddons cross compile badness meh + sed -i -e "s:INCLUDE_DIR /usr/include/kodi:INCLUDE_DIR $SYSROOT_PREFIX/usr/include/kodi:g" $SYSROOT_PREFIX/usr/lib/kodi/kodi-config.cmake + + mkdir -p $INSTALL/usr/share/kodi/media + if [ -d $PROJECT_DIR/$PROJECT/kodi/ledpatterns ]; then + cp -R $PROJECT_DIR/$PROJECT/kodi/ledpatterns $INSTALL/usr/share/kodi/media + fi + if [ "$KODI_EXTRA_FONTS" = yes ]; then mkdir -p $INSTALL/usr/share/kodi/media/Fonts cp $PKG_DIR/fonts/*.ttf $INSTALL/usr/share/kodi/media/Fonts fi + + debug_strip $INSTALL/usr/lib/kodi/kodi.bin } post_install() { diff --git a/packages/mediacenter/kodi/patches/README.patches b/packages/mediacenter/kodi/patches/README.patches index 08eb3a447f1..e6d39e25ade 100644 --- a/packages/mediacenter/kodi/patches/README.patches +++ b/packages/mediacenter/kodi/patches/README.patches @@ -1,3 +1,3 @@ -100.* - OpenELEC specific patches that wont go upstream -995.* - OpenELEC specific patches that should be send upstream +100.* - LibreELEC specific patches that wont go upstream +995.* - LibreELEC specific patches that should be send upstream 999.* - patches backported from upstream diff --git a/packages/mediacenter/kodi/patches/kodi-100.02-add-openelec.tv-RSS-news.patch b/packages/mediacenter/kodi/patches/kodi-100.02-add-libreelec.tv-RSS-news.patch similarity index 65% rename from packages/mediacenter/kodi/patches/kodi-100.02-add-openelec.tv-RSS-news.patch rename to packages/mediacenter/kodi/patches/kodi-100.02-add-libreelec.tv-RSS-news.patch index a976ab3dde9..03ccc517855 100644 --- a/packages/mediacenter/kodi/patches/kodi-100.02-add-openelec.tv-RSS-news.patch +++ b/packages/mediacenter/kodi/patches/kodi-100.02-add-libreelec.tv-RSS-news.patch @@ -1,12 +1,11 @@ -diff --git a/userdata/RssFeeds.xml b/userdata/RssFeeds.xml -index 48b99e8..856bf1e 100644 ---- a/userdata/RssFeeds.xml -+++ b/userdata/RssFeeds.xml +diff -Naur a/userdata/RssFeeds.xml b/userdata/RssFeeds.xml +--- a/userdata/RssFeeds.xml 2016-05-01 03:36:53.000000000 -0700 ++++ b/userdata/RssFeeds.xml 2016-05-05 00:42:53.999990267 -0700 @@ -3,6 +3,7 @@ <!-- RSS feeds. To have multiple feeds, just add a feed to the set. You can also have multiple sets. !--> <!-- To use different sets in your skin, each must be called from skin with a unique id. !--> <set id="1"> -+ <feed updateinterval="30">http://feeds.openelec.tv/news</feed> ++ <feed updateinterval="30">https://libreelec.tv/feed</feed> <feed updateinterval="30">http://feeds.kodi.tv/xbmc</feed> <feed updateinterval="30">http://feeds.kodi.tv/latest_xbmc_addons</feed> <feed updateinterval="30">http://feeds.kodi.tv/updated_xbmc_addons</feed> diff --git a/packages/mediacenter/kodi/patches/kodi-100.09-use-a-wrapper-to-setup-systemd-services.patch b/packages/mediacenter/kodi/patches/kodi-100.09-use-a-wrapper-to-setup-systemd-services.patch index 48918646b54..375e4aaec81 100644 --- a/packages/mediacenter/kodi/patches/kodi-100.09-use-a-wrapper-to-setup-systemd-services.patch +++ b/packages/mediacenter/kodi/patches/kodi-100.09-use-a-wrapper-to-setup-systemd-services.patch @@ -19,7 +19,7 @@ index 377a49c..2fda194 100644 +void CallOEWrapper(const std::string& ID, bool disable) +{ + char cmd[255]; -+ snprintf(cmd, sizeof(cmd), "/usr/lib/openelec/systemd-addon-wrapper %s %d %d", ID.c_str(), disable); ++ snprintf(cmd, sizeof(cmd), "/usr/lib/libreelec/systemd-addon-wrapper %s %d %d", ID.c_str(), disable); + system(cmd); +} + diff --git a/packages/mediacenter/kodi/patches/kodi-100.10-handle-SIGTERM.patch b/packages/mediacenter/kodi/patches/kodi-100.10-handle-SIGTERM.patch index 8de57f0ce07..a297f34eedd 100644 --- a/packages/mediacenter/kodi/patches/kodi-100.10-handle-SIGTERM.patch +++ b/packages/mediacenter/kodi/patches/kodi-100.10-handle-SIGTERM.patch @@ -121,14 +121,14 @@ index c46cba1..ed3f35f 100644 bool m_AppFocused; bool m_renderGUI; -diff --git a/xbmc/main/main.cpp b/xbmc/main/main.cpp +diff --git a/xbmc/platform/posix/main.cpp b/xbmc/platform/posix/main.cpp index 01027f8..4cfb04e 100644 ---- a/xbmc/main/main.cpp -+++ b/xbmc/main/main.cpp +--- a/xbmc/platform/posix/main.cpp ++++ b/xbmc/platform/posix/main.cpp @@ -41,12 +41,27 @@ #include "input/linux/LIRC.h" #endif - #include "XbmcContext.h" + #include "platform/XbmcContext.h" +#include "Application.h" + +void xbmc_term_handler(int signum) diff --git a/packages/mediacenter/kodi/patches/kodi-100.12-prevent-kodi-switching-to-windowed-mode.patch b/packages/mediacenter/kodi/patches/kodi-100.12-prevent-kodi-switching-to-windowed-mode.patch index 0bbb65f8bc5..d11e02ded8b 100644 --- a/packages/mediacenter/kodi/patches/kodi-100.12-prevent-kodi-switching-to-windowed-mode.patch +++ b/packages/mediacenter/kodi/patches/kodi-100.12-prevent-kodi-switching-to-windowed-mode.patch @@ -12,13 +12,13 @@ index 5ac2482..cb84940 100644 --- a/xbmc/windowing/X11/WinSystemX11.h +++ b/xbmc/windowing/X11/WinSystemX11.h @@ -54,6 +54,7 @@ public: - virtual bool ResizeWindow(int newWidth, int newHeight, int newLeft, int newTop); - virtual bool SetFullScreen(bool fullScreen, RESOLUTION_INFO& res, bool blankOtherDisplays); - virtual void UpdateResolutions(); -+ virtual bool CanDoWindowed() { return false; } - virtual int GetNumScreens() { return 1; } - virtual int GetCurrentScreen() { return m_nScreen; } - virtual void ShowOSMouse(bool show); + bool ResizeWindow(int newWidth, int newHeight, int newLeft, int newTop) override; + bool SetFullScreen(bool fullScreen, RESOLUTION_INFO& res, bool blankOtherDisplays) override; + void UpdateResolutions() override; ++ bool CanDoWindowed() override { return false; } + int GetNumScreens() override { return 1; } + int GetCurrentScreen() override { return m_nScreen; } + void ShowOSMouse(bool show) override; -- 2.5.0 diff --git a/packages/mediacenter/kodi/patches/kodi-100.13-udevprovider-filter-out-OE-specific-mounts.patch b/packages/mediacenter/kodi/patches/kodi-100.13-udevprovider-filter-out-OE-specific-mounts.patch index 3b6e6c74386..986e281bbf9 100644 --- a/packages/mediacenter/kodi/patches/kodi-100.13-udevprovider-filter-out-OE-specific-mounts.patch +++ b/packages/mediacenter/kodi/patches/kodi-100.13-udevprovider-filter-out-OE-specific-mounts.patch @@ -15,7 +15,7 @@ index dffee34..b7cd25b 100644 continue; } -+ // OE: filter out openelec specific mounts ++ // LE: filter out Libreelec specific mounts + if (strstr(mountpoint, "/flash")) + { + udev_device_unref(device); diff --git a/packages/mediacenter/kodi/patches/kodi-100.15-rename-default-pulse-device.patch b/packages/mediacenter/kodi/patches/kodi-100.15-rename-default-pulse-device.patch index 6b4d5e3c54e..7e96faaf3f8 100644 --- a/packages/mediacenter/kodi/patches/kodi-100.15-rename-default-pulse-device.patch +++ b/packages/mediacenter/kodi/patches/kodi-100.15-rename-default-pulse-device.patch @@ -1,17 +1,18 @@ -From b70f963a0963735e627b12cf361e4e30d6c2a799 Mon Sep 17 00:00:00 2001 -From: Lukas Rusak <lorusak@gmail.com> -Date: Tue, 26 Jan 2016 08:31:52 +0100 -Subject: [PATCH] change pulseaudio default device name to Bluetooth Audio +From cd60daafb0c6b1e1de94dbc944bb247a8f810b50 Mon Sep 17 00:00:00 2001 +From: fritsch <peter.fruehberger@gmail.com> +Date: Fri, 29 Jan 2016 16:32:06 +0100 +Subject: [PATCH] [PATCH] change pulseaudio default device name to Bluetooth + Audio --- xbmc/cores/AudioEngine/Sinks/AESinkPULSE.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkPULSE.cpp b/xbmc/cores/AudioEngine/Sinks/AESinkPULSE.cpp -index 67b7b90..8537163 100644 +index 7c669b7..043d0d5 100644 --- a/xbmc/cores/AudioEngine/Sinks/AESinkPULSE.cpp +++ b/xbmc/cores/AudioEngine/Sinks/AESinkPULSE.cpp -@@ -362,12 +362,14 @@ static void SinkInfoRequestCallback(pa_context *c, const pa_sink_info *i, int eo +@@ -394,13 +394,15 @@ static void SinkInfoRequestCallback(pa_context *c, const pa_sink_info *i, int eo CAEDeviceInfo defaultDevice; defaultDevice.m_deviceName = std::string("Default"); defaultDevice.m_displayName = std::string("Default"); @@ -21,6 +22,7 @@ index 67b7b90..8537163 100644 defaultDevice.m_channels = CAEChannelInfo(AE_CH_LAYOUT_2_0); defaultDevice.m_sampleRates.assign(defaultSampleRates, defaultSampleRates + ARRAY_SIZE(defaultSampleRates)); defaultDevice.m_deviceType = AE_DEVTYPE_PCM; + defaultDevice.m_wantsIECPassthrough = true; sinkStruct->list->push_back(defaultDevice); + // OE only wants the default device - so we are done here + return; @@ -28,5 +30,5 @@ index 67b7b90..8537163 100644 if (i && i->name) { -- -1.9.3 +2.5.0 diff --git a/packages/mediacenter/kodi/patches/kodi-100.20-meh.patch b/packages/mediacenter/kodi/patches/kodi-100.20-meh.patch deleted file mode 100644 index 657ffddcabc..00000000000 --- a/packages/mediacenter/kodi/patches/kodi-100.20-meh.patch +++ /dev/null @@ -1,27 +0,0 @@ -From ab9f0b5ed2017e07d80156b521dd55ecd322f92c Mon Sep 17 00:00:00 2001 -From: Stefan Saraev <stefan@saraev.ca> -Date: Tue, 25 Aug 2015 10:55:11 +0300 -Subject: [PATCH] meh - ---- - project/cmake/scripts/common/addon-helpers.cmake | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/project/cmake/scripts/common/addon-helpers.cmake b/project/cmake/scripts/common/addon-helpers.cmake -index a02836a..0ceb5eb 100644 ---- a/project/cmake/scripts/common/addon-helpers.cmake -+++ b/project/cmake/scripts/common/addon-helpers.cmake -@@ -55,6 +55,9 @@ macro (build_addon target prefix libs) - SET(LIBRARY_FILENAME $<TARGET_FILE_NAME:${target}>) - endif() - -+ # meh -+ set(LIBRARY_FILENAME $<TARGET_LINKER_FILE_NAME:${target}>) -+ - # if there's an addon.xml.in we need to generate the addon.xml - IF(EXISTS ${PROJECT_SOURCE_DIR}/${target}/addon.xml.in) - SET(PLATFORM ${CORE_SYSTEM_NAME}) --- -2.5.0 - - diff --git a/packages/mediacenter/kodi/patches/kodi-999.01-fix-segfault.patch b/packages/mediacenter/kodi/patches/kodi-999.01-fix-segfault.patch deleted file mode 100644 index 76235c7e493..00000000000 --- a/packages/mediacenter/kodi/patches/kodi-999.01-fix-segfault.patch +++ /dev/null @@ -1,69 +0,0 @@ -From 7216c71bfd250f8c3f9fa82685ec635cf7be4b60 Mon Sep 17 00:00:00 2001 -From: Rainer Hochecker <fernetmenta@online.de> -Date: Sun, 21 Feb 2016 17:54:20 +0100 -Subject: [PATCH] vaapi: fix segfault - ---- - xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.cpp | 10 ++++++---- - 1 file changed, 6 insertions(+), 4 deletions(-) - -diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.cpp -index 19f05ca..540f914 100644 ---- a/xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.cpp -+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.cpp -@@ -738,12 +738,14 @@ int CDecoder::FFGetBuffer(AVCodecContext *avctx, AVFrame *pic, int flags) - - void CDecoder::FFReleaseBuffer(uint8_t *data) - { -- VASurfaceID surf; -+ { -+ VASurfaceID surf; - -- CSingleLock lock(m_DecoderSection); -+ CSingleLock lock(m_DecoderSection); - -- surf = (VASurfaceID)(uintptr_t)data; -- m_videoSurfaces.ClearReference(surf); -+ surf = (VASurfaceID)(uintptr_t)data; -+ m_videoSurfaces.ClearReference(surf); -+ } - - IHardwareDecoder::Release(); - } - -From eb7ccc54a4db746368191927c5b2fe77b4f678fe Mon Sep 17 00:00:00 2001 -From: Rainer Hochecker <fernetmenta@online.de> -Date: Sun, 21 Feb 2016 18:00:24 +0100 -Subject: [PATCH] dxva2: fix segfault - ---- - xbmc/cores/dvdplayer/DVDCodecs/Video/DXVA.cpp | 14 ++++++++------ - 1 file changed, 8 insertions(+), 6 deletions(-) - -diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/DXVA.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/DXVA.cpp -index 1fc5061..a340183 100644 ---- a/xbmc/cores/dvdplayer/DVDCodecs/Video/DXVA.cpp -+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/DXVA.cpp -@@ -1144,14 +1144,16 @@ bool CDecoder::Supports(enum PixelFormat fmt) - - void CDecoder::RelBuffer(uint8_t *data) - { -- CSingleLock lock(m_section); -- ID3D11VideoDecoderOutputView* view = (ID3D11VideoDecoderOutputView*)(uintptr_t)data; -- -- if (!m_surface_context->IsValid(view)) - { -- CLog::Log(LOGWARNING, "%s - return of invalid surface", __FUNCTION__); -+ CSingleLock lock(m_section); -+ ID3D11VideoDecoderOutputView* view = (ID3D11VideoDecoderOutputView*)(uintptr_t)data; -+ -+ if (!m_surface_context->IsValid(view)) -+ { -+ CLog::Log(LOGWARNING, "%s - return of invalid surface", __FUNCTION__); -+ } -+ m_surface_context->ClearReference(view); - } -- m_surface_context->ClearReference(view); - - IHardwareDecoder::Release(); - } diff --git a/packages/mediacenter/kodi/patches/kodi-999.10-aarch64-support.patch b/packages/mediacenter/kodi/patches/kodi-999.10-aarch64-support.patch index f6353de3bbf..9e6a061167c 100644 --- a/packages/mediacenter/kodi/patches/kodi-999.10-aarch64-support.patch +++ b/packages/mediacenter/kodi/patches/kodi-999.10-aarch64-support.patch @@ -1,40 +1,8 @@ -From ae4e63aa165583ef5eaab4759e7af24eeffbb197 Mon Sep 17 00:00:00 2001 -From: croniccorey <cronmod.dev@gmail.com> -Date: Sun, 13 Dec 2015 16:37:05 -0500 -Subject: [PATCH] KODI: Add support for aarch64 platform - ---- - addons/library.xbmc.addon/libXBMC_addon.h | 2 ++ - configure.ac | 12 ++++++++++++ - m4/xbmc_arch.m4 | 2 +- - xbmc/cores/DllLoader/DllLoader.h | 2 +- - xbmc/cores/DllLoader/ldt_keeper.c | 2 +- - xbmc/cores/VideoRenderers/LinuxRendererGL.h | 2 +- - xbmc/linux/PlatformDefs.h | 2 +- - xbmc/threads/Atomics.cpp | 2 +- - xbmc/utils/CPUInfo.cpp | 2 +- - xbmc/utils/MathUtils.h | 3 ++- - 10 files changed, 23 insertions(+), 8 deletions(-) - -diff --git a/addons/library.xbmc.addon/libXBMC_addon.h b/addons/library.xbmc.addon/libXBMC_addon.h -index c3ed54f..76190b6 100644 ---- a/addons/library.xbmc.addon/libXBMC_addon.h -+++ b/addons/library.xbmc.addon/libXBMC_addon.h -@@ -55,6 +55,8 @@ typedef intptr_t ssize_t; - #define ADDON_HELPER_ARCH "powerpc64-linux" - #elif defined(__ARMEL__) - #define ADDON_HELPER_ARCH "arm" -+#elif defined(__aarch64__) -+#define ADDON_HELPER_ARCH "aarch64" - #elif defined(__mips__) - #define ADDON_HELPER_ARCH "mips" - #else -diff --git a/configure.ac b/configure.ac -index c767357..80f3807 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -691,6 +691,18 @@ case $host in - use_wayland=no +diff -Naur a/configure.ac b/configure.ac +--- a/configure.ac 2016-02-14 00:19:36.000000000 +0100 ++++ b/configure.ac 2016-03-02 09:15:52.504860258 +0100 +@@ -641,6 +641,18 @@ + use_gl=no USE_STATIC_FFMPEG=1 ;; + aarch64*-*-linux-gnu*) @@ -52,11 +20,10 @@ index c767357..80f3807 100644 arm*-*linux-android*) target_platform=target_android use_arch="arm" -diff --git a/m4/xbmc_arch.m4 b/m4/xbmc_arch.m4 -index 0b66a82..fa08537 100644 ---- a/m4/xbmc_arch.m4 -+++ b/m4/xbmc_arch.m4 -@@ -60,7 +60,7 @@ case $host in +diff -Naur a/m4/xbmc_arch.m4 b/m4/xbmc_arch.m4 +--- a/m4/xbmc_arch.m4 2016-02-14 00:19:42.000000000 +0100 ++++ b/m4/xbmc_arch.m4 2016-03-02 09:16:33.341943374 +0100 +@@ -60,7 +60,7 @@ powerpc64-*-linux-gnu*|powerpc64-*-linux-uclibc*) AC_SUBST(ARCH_DEFINES, "-DTARGET_POSIX -DTARGET_LINUX -D_LINUX -D_POWERPC64") ;; @@ -65,95 +32,3 @@ index 0b66a82..fa08537 100644 AC_SUBST(ARCH_DEFINES, "-DTARGET_POSIX -DTARGET_LINUX -D_LINUX") ;; mips*-*-linux-gnu*|mips*-*-linux-uclibc*) -diff --git a/xbmc/cores/DllLoader/DllLoader.h b/xbmc/cores/DllLoader/DllLoader.h -index 070aee6..e669203 100644 ---- a/xbmc/cores/DllLoader/DllLoader.h -+++ b/xbmc/cores/DllLoader/DllLoader.h -@@ -23,7 +23,7 @@ - #include "coffldr.h" - #include "LibraryLoader.h" - --#if defined(__linux__) && !defined(__powerpc__) && !defined(__arm__) && !defined(__mips__) -+#if defined(__linux__) && !defined(__powerpc__) && !defined(__arm__) && !defined(__mips__) && !defined(__aarch64__) - #define USE_LDT_KEEPER - #include "ldt_keeper.h" - #endif -diff --git a/xbmc/cores/DllLoader/ldt_keeper.c b/xbmc/cores/DllLoader/ldt_keeper.c -index 8af9a86..1c0cdb2 100644 ---- a/xbmc/cores/DllLoader/ldt_keeper.c -+++ b/xbmc/cores/DllLoader/ldt_keeper.c -@@ -19,7 +19,7 @@ - */ - - //#ifndef __powerpc__ --#if !defined(__powerpc__) && !defined(__ppc__) && !defined(__arm__) && !defined(__mips__) -+#if !defined(__powerpc__) && !defined(__ppc__) && !defined(__arm__) && !defined(__mips__) && !defined(__aarch64__) - - #include "ldt_keeper.h" - -diff --git a/xbmc/cores/VideoRenderers/LinuxRendererGL.h b/xbmc/cores/VideoRenderers/LinuxRendererGL.h -index fcdea8d..5a3e3df 100644 ---- a/xbmc/cores/VideoRenderers/LinuxRendererGL.h -+++ b/xbmc/cores/VideoRenderers/LinuxRendererGL.h -@@ -323,7 +323,7 @@ class CLinuxRendererGL : public CBaseRenderer - - - inline int NP2( unsigned x ) { --#if defined(TARGET_POSIX) && !defined(__POWERPC__) && !defined(__PPC__) && !defined(__arm__) && !defined(__mips__) -+#if defined(TARGET_POSIX) && !defined(__POWERPC__) && !defined(__PPC__) && !defined(__arm__) && !defined(__mips__) && !defined(__aarch64__) - // If there are any issues compiling this, just append a ' && 0' - // to the above to make it '#if defined(TARGET_POSIX) && 0' - -diff --git a/xbmc/linux/PlatformDefs.h b/xbmc/linux/PlatformDefs.h -index 4350075..2c6fff4 100644 ---- a/xbmc/linux/PlatformDefs.h -+++ b/xbmc/linux/PlatformDefs.h -@@ -161,7 +161,7 @@ - #define __int64 long long - #define __uint64 unsigned long long - --#if defined(__x86_64__) || defined(__powerpc__) || defined(__ppc__) || defined (__arm__) || defined(__mips__) // should this be powerpc64 only? -+#if defined(__x86_64__) || defined(__powerpc__) || defined(__ppc__) || defined (__arm__) || defined(__mips__) || defined(__aarch64__) - #define __stdcall - #else /* !__x86_64__ */ - #define __stdcall __attribute__((__stdcall__)) -diff --git a/xbmc/threads/Atomics.cpp b/xbmc/threads/Atomics.cpp -index 417b2b6..c172867 100644 ---- a/xbmc/threads/Atomics.cpp -+++ b/xbmc/threads/Atomics.cpp -@@ -106,7 +106,7 @@ long cas(volatile long *pAddr, long expectedVal, long swapVal) - /////////////////////////////////////////////////////////////////////////// - long long cas2(volatile long long* pAddr, long long expectedVal, long long swapVal) - { --#if defined(__ppc__) || defined(__powerpc__) || defined(__arm__)// PowerPC and ARM -+#if defined(__ppc__) || defined(__powerpc__) || defined(__arm__) || defined(__aarch64__) // PowerPC and ARM - // Not available/required - // Hack to allow compilation - throw "cas2 is not implemented"; -diff --git a/xbmc/utils/CPUInfo.cpp b/xbmc/utils/CPUInfo.cpp -index 9e709e7..d7fef37 100644 ---- a/xbmc/utils/CPUInfo.cpp -+++ b/xbmc/utils/CPUInfo.cpp -@@ -914,7 +914,7 @@ void CCPUInfo::ReadCPUFeatures() - #endif - #elif defined(LINUX) - // empty on purpose, the implementation is in the constructor --#elif !defined(__powerpc__) && !defined(__ppc__) && !defined(__arm__) -+#elif !defined(__powerpc__) && !defined(__ppc__) && !defined(__arm__) && !defined(__aarch64__) - m_cpuFeatures |= CPU_FEATURE_MMX; - #elif defined(__powerpc__) || defined(__ppc__) - m_cpuFeatures |= CPU_FEATURE_ALTIVEC; -diff --git a/xbmc/utils/MathUtils.h b/xbmc/utils/MathUtils.h -index 08140b7..249b4dd 100644 ---- a/xbmc/utils/MathUtils.h -+++ b/xbmc/utils/MathUtils.h -@@ -35,7 +35,8 @@ - #if defined(__ppc__) || \ - defined(__powerpc__) || \ - defined(__mips__) || \ -- defined(__arm__) -+ defined(__arm__) || \ -+ defined(__aarch64__) - #define DISABLE_MATHUTILS_ASM_ROUND_INT - #endif - diff --git a/packages/mediacenter/kodi/patches/kodi-999.11-fix-aarch64-compile.patch b/packages/mediacenter/kodi/patches/kodi-999.11-fix-aarch64-compile.patch index 6ad637c5f71..56de975a265 100644 --- a/packages/mediacenter/kodi/patches/kodi-999.11-fix-aarch64-compile.patch +++ b/packages/mediacenter/kodi/patches/kodi-999.11-fix-aarch64-compile.patch @@ -1,7 +1,7 @@ -diff -Naur a/xbmc/cores/dvdplayer/DVDCodecs/Video/AMLCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/AMLCodec.cpp ---- a/xbmc/cores/dvdplayer/DVDCodecs/Video/AMLCodec.cpp 2016-02-02 23:09:39.000000000 +0100 -+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/AMLCodec.cpp 2016-02-10 07:01:28.941399058 +0100 -@@ -1598,7 +1598,7 @@ +diff -Naur a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp +--- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp 2016-02-14 00:19:32.000000000 +0100 ++++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp 2016-03-02 09:36:04.503330833 +0100 +@@ -1601,7 +1601,7 @@ am_private->gcodec.param = (void*)(EXTERNAL_PTS | SYNC_OUTSIDE); break; } @@ -10,15 +10,3 @@ diff -Naur a/xbmc/cores/dvdplayer/DVDCodecs/Video/AMLCodec.cpp b/xbmc/cores/dvdp // translate from generic to firemware version dependent m_dll->codec_init_para(&am_private->gcodec, &am_private->vcodec); -diff -Naur a/xbmc/guilib/GUIFontTTFGL.cpp b/xbmc/guilib/GUIFontTTFGL.cpp ---- a/xbmc/guilib/GUIFontTTFGL.cpp 2016-02-02 23:09:39.000000000 +0100 -+++ b/xbmc/guilib/GUIFontTTFGL.cpp 2016-02-10 06:59:49.261293006 +0100 -@@ -232,7 +232,7 @@ - glUniformMatrix4fv(modelLoc, 1, GL_FALSE, glMatrixModview.Get()); - - // Bind the buffer to the OpenGL context's GL_ARRAY_BUFFER binding point -- glBindBuffer(GL_ARRAY_BUFFER, (GLuint) m_vertexTrans[i].vertexBuffer->bufferHandle); -+ glBindBuffer(GL_ARRAY_BUFFER, (unsigned long) m_vertexTrans[i].vertexBuffer->bufferHandle); - - // Do the actual drawing operation, split into groups of characters no - // larger than the pre-determined size of the element array diff --git a/packages/mediacenter/kodi/patches/kodi-999.15-disable-using-tv-menu-language-by-default.patch b/packages/mediacenter/kodi/patches/kodi-999.15-disable-using-tv-menu-language-by-default.patch new file mode 100644 index 00000000000..6c2893341e2 --- /dev/null +++ b/packages/mediacenter/kodi/patches/kodi-999.15-disable-using-tv-menu-language-by-default.patch @@ -0,0 +1,12 @@ +diff -Naur a/system/peripherals.xml b/system/peripherals.xml +--- a/system/peripherals.xml 2016-03-19 01:20:46.000000000 -0700 ++++ b/system/peripherals.xml 2016-04-13 11:07:51.605221474 -0700 +@@ -18,7 +18,7 @@ + <setting key="cec_wake_screensaver" type="bool" value="1" label="36010" order="7" /> + <setting key="standby_pc_on_tv_standby" type="enum" value="13011" label="36029" order="8" lvalues="36028|13005|13011" /> + <setting key="standby_tv_on_pc_standby" type="bool" value="1" label="36026" order="9" /> +- <setting key="use_tv_menu_language" type="bool" value="1" label="36018" order="10" /> ++ <setting key="use_tv_menu_language" type="bool" value="0" label="36018" order="10" /> + <setting key="pause_playback_on_deactivate" type="bool" value="1" label="36033" configurable="0" /> + <setting key="pause_or_stop_playback_on_deactivate" type="enum" value="231" label="36033" order="11" lvalues="231|36044|36045" /> + <setting key="connected_device" type="enum" label="36019" value="36037" lvalues="36037|36038" order="12" /> diff --git a/packages/mediacenter/kodi/patches/kodi-999.22-PR8254.patch b/packages/mediacenter/kodi/patches/kodi-999.22-PR8254.patch deleted file mode 100644 index ef26dc153d3..00000000000 --- a/packages/mediacenter/kodi/patches/kodi-999.22-PR8254.patch +++ /dev/null @@ -1,35 +0,0 @@ -From ee014b442eac3e85178c89d04691f4fc73cf89e4 Mon Sep 17 00:00:00 2001 -From: "Chris \"Koying\" Browet" <cbro@semperpax.com> -Date: Sun, 18 Oct 2015 11:24:00 +0200 -Subject: [PATCH] FIX: Only handle 3D bitmap subs in TAB - -3D bitmap subs cannot be detected in SBS, and there is always the option -to play with Kodi 3D disabled ---- - xbmc/cores/dvdplayer/DVDCodecs/Overlay/DVDOverlayCodecFFmpeg.cpp | 7 +------ - 1 file changed, 1 insertion(+), 6 deletions(-) - -diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Overlay/DVDOverlayCodecFFmpeg.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Overlay/DVDOverlayCodecFFmpeg.cpp -index dca4bdf..c9a0008 100644 ---- a/xbmc/cores/dvdplayer/DVDCodecs/Overlay/DVDOverlayCodecFFmpeg.cpp -+++ b/xbmc/cores/dvdplayer/DVDCodecs/Overlay/DVDOverlayCodecFFmpeg.cpp -@@ -257,18 +257,13 @@ CDVDOverlay* CDVDOverlayCodecFFmpeg::GetOverlay() - } - - RENDER_STEREO_MODE render_stereo_mode = g_graphicsContext.GetStereoMode(); -- if (render_stereo_mode != RENDER_STEREO_MODE_OFF) -+ if (render_stereo_mode == RENDER_STEREO_MODE_SPLIT_HORIZONTAL) - { - if (rect.h > m_height / 2) - { - m_height /= 2; - rect.h /= 2; - } -- else if (rect.w > m_width / 2) -- { -- m_width /= 2; -- rect.w /= 2; -- } - } - - CDVDOverlayImage* overlay = new CDVDOverlayImage(); diff --git a/packages/mediacenter/kodi/patches/kodi-999.42-KEY_EPG.patch b/packages/mediacenter/kodi/patches/kodi-999.42-KEY_EPG.patch deleted file mode 100644 index 5fc8ad80f32..00000000000 --- a/packages/mediacenter/kodi/patches/kodi-999.42-KEY_EPG.patch +++ /dev/null @@ -1,63 +0,0 @@ -diff -Naur kodi-16.0-beta5-19fc4fa/system/keymaps/keyboard.xml kodi-16.0-beta5-19fc4fa.patch/system/keymaps/keyboard.xml ---- kodi-16.0-beta5-19fc4fa/system/keymaps/keyboard.xml 2015-12-15 00:07:12.000000000 +0100 -+++ kodi-16.0-beta5-19fc4fa.patch/system/keymaps/keyboard.xml 2016-01-05 06:41:50.857902588 +0100 -@@ -113,6 +113,7 @@ - <sleep>ActivateWindow(shutdownmenu)</sleep> - <!-- PVR windows --> - <e>ActivateWindow(TVGuide)</e> -+ <epg>ActivateWindow(TVGuide)</epg> - <h>ActivateWindow(TVChannels)</h> - <j>ActivateWindow(RadioChannels)</j> - <k>ActivateWindow(TVRecordings)</k> -@@ -268,6 +269,7 @@ - <TVGuide> - <keyboard> - <e>PreviousMenu</e> -+ <epg>PreviousMenu</epg> - </keyboard> - </TVGuide> - <MyFiles> -diff -Naur kodi-16.0-beta5-19fc4fa/xbmc/input/linux/LinuxInputDevices.cpp kodi-16.0-beta5-19fc4fa.patch/xbmc/input/linux/LinuxInputDevices.cpp ---- kodi-16.0-beta5-19fc4fa/xbmc/input/linux/LinuxInputDevices.cpp 2015-12-15 00:07:12.000000000 +0100 -+++ kodi-16.0-beta5-19fc4fa.patch/xbmc/input/linux/LinuxInputDevices.cpp 2016-01-05 06:41:13.847846527 +0100 -@@ -268,6 +268,7 @@ - { KEY_FILE , XBMCK_LAUNCH_FILE_BROWSER}, - { KEY_SELECT , XBMCK_RETURN }, - { KEY_CONFIG , XBMCK_CONFIG }, -+ { KEY_EPG , XBMCK_EPG }, - // The Little Black Box Remote Additions - { 384 , XBMCK_LEFT }, // Red - { 378 , XBMCK_RIGHT }, // Green -diff -Naur kodi-16.0-beta5-19fc4fa/xbmc/input/XBMC_keysym.h kodi-16.0-beta5-19fc4fa.patch/xbmc/input/XBMC_keysym.h ---- kodi-16.0-beta5-19fc4fa/xbmc/input/XBMC_keysym.h 2015-12-15 00:07:12.000000000 +0100 -+++ kodi-16.0-beta5-19fc4fa.patch/xbmc/input/XBMC_keysym.h 2016-01-05 06:41:13.847846527 +0100 -@@ -229,6 +229,7 @@ - XBMCK_FAVORITES = 0x14d, - XBMCK_HOMEPAGE = 0x14e, - XBMCK_CONFIG = 0x14f, -+ XBMCK_EPG = 0x150, - - // Add any other keys here - -diff -Naur kodi-16.0-beta5-19fc4fa/xbmc/input/XBMC_keytable.cpp kodi-16.0-beta5-19fc4fa.patch/xbmc/input/XBMC_keytable.cpp ---- kodi-16.0-beta5-19fc4fa/xbmc/input/XBMC_keytable.cpp 2015-12-15 00:07:12.000000000 +0100 -+++ kodi-16.0-beta5-19fc4fa.patch/xbmc/input/XBMC_keytable.cpp 2016-01-05 06:41:13.848846528 +0100 -@@ -243,6 +243,7 @@ - , { XBMCK_FAVORITES, 0, 0, XBMCVK_FAVORITES, "favorites" } - , { XBMCK_HOMEPAGE , 0, 0, XBMCVK_HOMEPAGE, "homepage" } - , { XBMCK_CONFIG, 0, 0, XBMCVK_CONFIG, "config" } -+, { XBMCK_EPG , 0, 0, XBMCVK_EPG, "epg" } - }; - - static int XBMCKeyTableSize = sizeof(XBMCKeyTable)/sizeof(XBMCKEYTABLE); -diff -Naur kodi-16.0-beta5-19fc4fa/xbmc/input/XBMC_vkeys.h kodi-16.0-beta5-19fc4fa.patch/xbmc/input/XBMC_vkeys.h ---- kodi-16.0-beta5-19fc4fa/xbmc/input/XBMC_vkeys.h 2015-12-15 00:07:12.000000000 +0100 -+++ kodi-16.0-beta5-19fc4fa.patch/xbmc/input/XBMC_vkeys.h 2016-01-05 06:41:13.848846528 +0100 -@@ -221,6 +221,7 @@ - XBMCVK_FAVORITES = 0xE9, - XBMCVK_HOMEPAGE = 0xEA, - XBMCVK_CONFIG = 0xEB, -+ XBMCVK_EPG = 0xEC, - - XBMCVK_LAST = 0xFF - } XBMCVKey; diff --git a/packages/mediacenter/kodi/patches/kodi-999.99-IMX-increase-render-buffers.patch b/packages/mediacenter/kodi/patches/kodi-999.99-IMX-increase-render-buffers.patch deleted file mode 100644 index cf58e7d6f85..00000000000 --- a/packages/mediacenter/kodi/patches/kodi-999.99-IMX-increase-render-buffers.patch +++ /dev/null @@ -1,25 +0,0 @@ -From ccd6ad2f16b41286d22ba00fe2ca9df959d82dc9 Mon Sep 17 00:00:00 2001 -From: fritsch <Peter.Fruehberger@gmail.com> -Date: Wed, 8 Apr 2015 20:53:58 +0200 -Subject: [PATCH] IMX: Increase renderqueue size to 5 - ---- - xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp -index 09086b5..38017c1 100644 ---- a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp -+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp -@@ -37,7 +37,7 @@ - #define IMX_VDI_MAX_WIDTH 968 - #define FRAME_ALIGN 16 - #define MEDIAINFO 1 --#define RENDER_QUEUE_SIZE 3 -+#define RENDER_QUEUE_SIZE 5 - #define _4CC(c1,c2,c3,c4) (((uint32_t)(c4)<<24)|((uint32_t)(c3)<<16)|((uint32_t)(c2)<<8)|(uint32_t)(c1)) - #define Align(ptr,align) (((unsigned int)ptr + (align) - 1)/(align)*(align)) - #define Align2(ptr,align) (((unsigned int)ptr)/(align)*(align)) --- -1.9.1 - diff --git a/packages/mediacenter/kodi/scripts/kodi-config b/packages/mediacenter/kodi/scripts/kodi-config index 261e9cfb3bb..f0ce394bc1c 100755 --- a/packages/mediacenter/kodi/scripts/kodi-config +++ b/packages/mediacenter/kodi/scripts/kodi-config @@ -24,7 +24,7 @@ chmod +x /storage/.kodi/addons/*/bin/* # hack: update RSSnews.xml in userdata if [ -f /storage/.kodi/userdata/RssFeeds.xml ]; then - sed -e "s,http://openelec.tv/news?format=feed&type=rss,http://feeds.openelec.tv/news,g" \ + sed -e "s,http://libreelec.tv/news?format=feed&type=rss,http://feeds.libreelec.tv/news,g" \ -i /storage/.kodi/userdata/RssFeeds.xml fi @@ -42,10 +42,17 @@ if [ ! -f $HOME/.kodi/userdata/guisettings.xml ] ; then fi fi +# cleanup *.fi cache files from .kodi/temp as old version +# of these files can cause random problems/crashes, particularly +# after an upgrade +if [ -d $HOME/.kodi/temp ]; then + rm -f $HOME/.kodi/temp/*.fi +fi + if [ -e /run/lirc/lircd.irtrans ]; then KODI_ARGS="--lircdev /run/lirc/lircd.irtrans" else KODI_ARGS="--lircdev /run/lirc/lircd" fi -echo "KODI_ARGS=\"$KODI_ARGS\"" > /run/openelec/kodi.conf +echo "KODI_ARGS=\"$KODI_ARGS\"" > /run/libreelec/kodi.conf diff --git a/packages/mediacenter/kodi/system.d/kodi-cleanlogs.service b/packages/mediacenter/kodi/system.d/kodi-cleanlogs.service index 6f1ae9c683c..0b32a887426 100644 --- a/packages/mediacenter/kodi/system.d/kodi-cleanlogs.service +++ b/packages/mediacenter/kodi/system.d/kodi-cleanlogs.service @@ -1,7 +1,7 @@ [Unit] Description=Kodi clean debug logs ConditionKernelCommandLine=!debugging -ConditionPathExists=!/storage/.cache/debug.openelec +ConditionPathExists=!/storage/.cache/debug.libreelec Before=kodi.service [Service] diff --git a/packages/mediacenter/kodi/system.d/kodi-waitonnetwork.service b/packages/mediacenter/kodi/system.d/kodi-waitonnetwork.service index 9785da7fdc5..555b8108a05 100644 --- a/packages/mediacenter/kodi/system.d/kodi-waitonnetwork.service +++ b/packages/mediacenter/kodi/system.d/kodi-waitonnetwork.service @@ -5,11 +5,11 @@ After=connman.service Before=network-online.target DefaultDependencies=no Conflicts=shutdown.target -ConditionPathExists=/storage/.cache/openelec/network_wait +ConditionPathExists=/storage/.cache/libreelec/network_wait [Service] Type=oneshot -EnvironmentFile=/storage/.cache/openelec/network_wait +EnvironmentFile=/storage/.cache/libreelec/network_wait ExecStartPre=/bin/sh -c 'echo "waiting on Network to come online ... (max. $WAIT_NETWORK_TIME sec.)"' ExecStart=/usr/sbin/connmand-wait-online --timeout=${WAIT_NETWORK_TIME} StandardOutput=tty diff --git a/packages/mediacenter/kodi/system.d/kodi.service b/packages/mediacenter/kodi/system.d/kodi.service index 0c170b15d3d..8b972d89ece 100644 --- a/packages/mediacenter/kodi/system.d/kodi.service +++ b/packages/mediacenter/kodi/system.d/kodi.service @@ -5,11 +5,12 @@ Requires=graphical.target Wants=network-online.target [Service] +Environment=__GL_YIELD=USLEEP Environment=DISPLAY=:0.0 Environment=SDL_MOUSE_RELATIVE=0 Environment=HOME=/storage -EnvironmentFile=-/run/openelec/kodi.conf -EnvironmentFile=-/run/openelec/debug/kodi.conf +EnvironmentFile=-/run/libreelec/kodi.conf +EnvironmentFile=-/run/libreelec/debug/kodi.conf ExecStartPre=-/usr/lib/kodi/kodi-config ExecStart=/usr/lib/kodi/kodi.sh --standalone -fs $KODI_ARGS $KODI_DEBUG ExecStop=/bin/kill -TERM $MAINPID diff --git a/packages/mediacenter/platform/package.mk b/packages/mediacenter/p8-platform/package.mk similarity index 82% rename from packages/mediacenter/platform/package.mk rename to packages/mediacenter/p8-platform/package.mk index 014b46f03e4..2b8a8a53ec8 100644 --- a/packages/mediacenter/platform/package.mk +++ b/packages/mediacenter/p8-platform/package.mk @@ -16,18 +16,19 @@ # along with OpenELEC. If not, see <http://www.gnu.org/licenses/>. ################################################################################ -PKG_NAME="platform" -PKG_VERSION="081032f" +PKG_NAME="p8-platform" +PKG_VERSION="38343e0" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.kodi.tv" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_URL="https://github.com/Pulse-Eight/platform/archive/$PKG_VERSION.tar.gz" +PKG_SOURCE_DIR="platform-$PKG_VERSION*" PKG_DEPENDS_TARGET="toolchain" PKG_PRIORITY="optional" PKG_SECTION="multimedia" -PKG_SHORTDESC="platform:" -PKG_LONGDESC="platform:" +PKG_SHORTDESC="Platform support library used by libCEC and binary add-ons for Kodi" +PKG_LONGDESC="Platform support library used by libCEC and binary add-ons for Kodi" PKG_IS_ADDON="no" PKG_AUTORECONF="no" diff --git a/packages/mediacenter/p8-platform/patches/p8-platform-01-revert-cc-badness.patch b/packages/mediacenter/p8-platform/patches/p8-platform-01-revert-cc-badness.patch new file mode 100644 index 00000000000..c060921a361 --- /dev/null +++ b/packages/mediacenter/p8-platform/patches/p8-platform-01-revert-cc-badness.patch @@ -0,0 +1,28 @@ +From f91594676d1f75530addd87363ccbc6510efb84e Mon Sep 17 00:00:00 2001 +From: Stefan Saraev <stefan@saraev.ca> +Date: Fri, 8 May 2015 11:19:42 +0300 +Subject: [PATCH] revert cc badness + +this reverts upstream commit 68f8418 +--- + CMakeLists.txt | 6 ------ + 1 file changed, 6 deletions(-) + +diff -Naur a/CMakeLists.txt b/CMakeLists.txt +--- a/CMakeLists.txt 2016-01-05 23:58:40.000000000 +0100 ++++ b/CMakeLists.txt 2016-01-06 01:26:52.004076744 +0100 +@@ -22,12 +22,6 @@ + src/windows/os-threads.cpp) + endif() + +-set(p8-platform_INCLUDE_DIRS "${CMAKE_INSTALL_PREFIX}/include/p8-platform") +-IF(WIN32) +- LIST(APPEND p8-platform_INCLUDE_DIRS "${CMAKE_INSTALL_PREFIX}/include/p8-platform/windows") +-ENDIF(WIN32) +-set(p8-platform_LIBRARIES ${CMAKE_THREAD_LIBS_INIT}) +- + if(NOT ${CORE_SYSTEM_NAME} STREQUAL "") + if(${CORE_SYSTEM_NAME} STREQUAL "osx" OR ${CORE_SYSTEM_NAME} STREQUAL "ios") + list(APPEND p8-platform_LIBRARIES "-framework CoreVideo -framework IOKit") +-- +1.7.10.4 diff --git a/packages/mediacenter/platform/patches/platform-01-revert-cc-badness.patch b/packages/mediacenter/platform/patches/platform-01-revert-cc-badness.patch deleted file mode 100644 index 3e7e5ebcc71..00000000000 --- a/packages/mediacenter/platform/patches/platform-01-revert-cc-badness.patch +++ /dev/null @@ -1,30 +0,0 @@ -From f91594676d1f75530addd87363ccbc6510efb84e Mon Sep 17 00:00:00 2001 -From: Stefan Saraev <stefan@saraev.ca> -Date: Fri, 8 May 2015 11:19:42 +0300 -Subject: [PATCH] revert cc badness - -this reverts upstream commit 68f8418 ---- - CMakeLists.txt | 6 ------ - 1 file changed, 6 deletions(-) - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 73fae2e..dc3e1b5 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -22,12 +22,6 @@ if(WIN32) - src/windows/os-threads.cpp) - endif() - --set(platform_INCLUDE_DIRS "${CMAKE_INSTALL_PREFIX}/include/platform") --IF(WIN32) -- LIST(APPEND platform_INCLUDE_DIRS "${CMAKE_INSTALL_PREFIX}/include/platform/windows") --ENDIF(WIN32) --set(platform_LIBRARIES ${CMAKE_THREAD_LIBS_INIT}) -- - if(NOT ${CORE_SYSTEM_NAME} STREQUAL "") - if(${CORE_SYSTEM_NAME} STREQUAL "darwin" OR ${CORE_SYSTEM_NAME} STREQUAL "ios") - list(APPEND platform_LIBRARIES "-framework CoreVideo -framework IOKit") --- -1.7.10.4 - diff --git a/packages/multimedia/SDL2/package.mk b/packages/multimedia/SDL2/package.mk index ec496325c8e..f2f8b05d301 100644 --- a/packages/multimedia/SDL2/package.mk +++ b/packages/multimedia/SDL2/package.mk @@ -17,7 +17,7 @@ ################################################################################ PKG_NAME="SDL2" -PKG_VERSION="2.0.3" +PKG_VERSION="2.0.4" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" diff --git a/packages/multimedia/SDL2/patches/SDL2-0001-fix-missing-axes.patch b/packages/multimedia/SDL2/patches/SDL2-0001-fix-missing-axes.patch deleted file mode 100644 index 47e2abfb565..00000000000 --- a/packages/multimedia/SDL2/patches/SDL2-0001-fix-missing-axes.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- a/src/joystick/linux/SDL_sysjoystick.c 2014-03-16 03:31:41.000000000 +0100 -+++ b/src/joystick/linux/SDL_sysjoystick.c 2014-09-08 01:42:32.987502340 +0200 -@@ -500,7 +500,7 @@ - ++joystick->nbuttons; - } - } -- for (i = 0; i < ABS_MISC; ++i) { -+ for (i = 0; i < ABS_MAX; ++i) { - /* Skip hats */ - if (i == ABS_HAT0X) { - i = ABS_HAT3Y; -@@ -761,10 +761,6 @@ - } - break; - case EV_ABS: -- if (code >= ABS_MISC) { -- break; -- } -- - switch (code) { - case ABS_HAT0X: - case ABS_HAT0Y: diff --git a/packages/multimedia/ffmpeg/package.mk b/packages/multimedia/ffmpeg/package.mk index 6ea57687578..830d288334f 100644 --- a/packages/multimedia/ffmpeg/package.mk +++ b/packages/multimedia/ffmpeg/package.mk @@ -17,13 +17,14 @@ ################################################################################ PKG_NAME="ffmpeg" -PKG_VERSION="2.8.6" +PKG_VERSION="3.0-xbmc" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="LGPLv2.1+" PKG_SITE="https://ffmpeg.org" -PKG_URL="https://ffmpeg.org/releases/${PKG_NAME}-${PKG_VERSION}.tar.gz" -PKG_DEPENDS_TARGET="toolchain yasm:host zlib bzip2 libvorbis libressl dcadec speex" +PKG_URL="https://github.com/xbmc/FFmpeg/archive/release/${PKG_VERSION}.tar.gz" +PKG_SOURCE_DIR="FFmpeg-release-${PKG_VERSION}" +PKG_DEPENDS_TARGET="toolchain yasm:host zlib bzip2 libressl speex" PKG_PRIORITY="optional" PKG_SECTION="multimedia" PKG_SHORTDESC="FFmpeg is a complete, cross-platform solution to record, convert and stream audio and video." @@ -42,7 +43,7 @@ else FFMPEG_VAAPI="--disable-vaapi" fi -if [ "$VDPAU_SUPPORT" = yes ]; then +if [ "$VDPAU_SUPPORT" = "yes" -a "$DISPLAYSERVER" = "x11" ]; then PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET libvdpau" FFMPEG_VDPAU="--enable-vdpau" else @@ -194,7 +195,6 @@ configure_target() { --disable-libopencore-amrwb \ --disable-libopencv \ --disable-libdc1394 \ - --enable-libdcadec \ --disable-libfaac \ --disable-libfreetype \ --disable-libgsm \ @@ -205,9 +205,8 @@ configure_target() { --disable-libschroedinger \ --enable-libspeex \ --disable-libtheora \ - --disable-libvo-aacenc \ --disable-libvo-amrwbenc \ - --enable-libvorbis --enable-muxer=ogg --enable-encoder=libvorbis \ + --disable-libvorbis \ --disable-libvpx \ --disable-libx264 \ --disable-libxavs \ diff --git a/packages/multimedia/ffmpeg/patches/ffmpeg-libressl-is-free.patch b/packages/multimedia/ffmpeg/patches/ffmpeg-050-libressl-is-free.patch similarity index 100% rename from packages/multimedia/ffmpeg/patches/ffmpeg-libressl-is-free.patch rename to packages/multimedia/ffmpeg/patches/ffmpeg-050-libressl-is-free.patch diff --git a/packages/multimedia/ffmpeg/patches/ffmpeg-2.8-kodi.patch b/packages/multimedia/ffmpeg/patches/ffmpeg-2.8-kodi.patch deleted file mode 100644 index 27b2c1b973a..00000000000 --- a/packages/multimedia/ffmpeg/patches/ffmpeg-2.8-kodi.patch +++ /dev/null @@ -1,585 +0,0 @@ -From 007ee4796d1621ef6070fdef9aa10ff227ee20b4 Mon Sep 17 00:00:00 2001 -From: Joakim Plate <elupus@ecce.se> -Date: Sun, 11 Sep 2011 19:04:51 +0200 -Subject: [PATCH 01/13] Support raw dvdsub palette as stored on normal dvd's - -This is how the palette is stored on dvd's. Currently -only xbmc passes the palette information to libavcodec -this way. ---- - libavcodec/dvdsubdec.c | 24 ++++++++++++++++++++++++ - 1 file changed, 24 insertions(+) - -diff --git a/libavcodec/dvdsubdec.c b/libavcodec/dvdsubdec.c -index f009824..bbee694 100644 ---- a/libavcodec/dvdsubdec.c -+++ b/libavcodec/dvdsubdec.c -@@ -64,6 +64,24 @@ static void yuv_a_to_rgba(const uint8_t *ycbcr, const uint8_t *alpha, uint32_t * - } - } - -+static void ayvu_to_argb(const uint8_t *ayvu, uint32_t *argb, int num_values) -+{ -+ uint8_t *cm = ff_crop_tab + MAX_NEG_CROP; -+ uint8_t r, g, b; -+ int i, y, cb, cr, a; -+ int r_add, g_add, b_add; -+ -+ for (i = num_values; i > 0; i--) { -+ a = *ayvu++; -+ y = *ayvu++; -+ cr = *ayvu++; -+ cb = *ayvu++; -+ YUV_TO_RGB1_CCIR(cb, cr); -+ YUV_TO_RGB2_CCIR(r, g, b, y); -+ *argb++ = (a << 24) | (r << 16) | (g << 8) | b; -+ } -+} -+ - static int decode_run_2bit(GetBitContext *gb, int *color) - { - unsigned int v, t; -@@ -708,6 +726,12 @@ static av_cold int dvdsub_init(AVCodecContext *avctx) - parse_ifo_palette(ctx, ctx->ifo_str); - if (ctx->palette_str) - parse_palette(ctx, ctx->palette_str); -+ -+ if (!ctx->has_palette && avctx->extradata_size == 64) { -+ ayvu_to_argb((uint8_t*)avctx->extradata, ctx->palette, 16); -+ ctx->has_palette = 1; -+ } -+ - if (ctx->has_palette) { - int i; - av_log(avctx, AV_LOG_DEBUG, "palette:"); - -From 3b001c5375fdcb0fca89c813bf808da35f904323 Mon Sep 17 00:00:00 2001 -From: Cory Fields <theuni-nospam-@xbmc.org> -Date: Mon, 28 Jun 2010 01:55:31 -0400 -Subject: [PATCH 02/13] if av_read_packet returns AVERROR_IO, we are done. - ffmpeg's codecs might or might not handle returning any completed demuxed - packets correctly - ---- - libavformat/utils.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/libavformat/utils.c b/libavformat/utils.c -index 30567fa..8a947d6 100644 ---- a/libavformat/utils.c -+++ b/libavformat/utils.c -@@ -1329,6 +1329,8 @@ static int read_frame_internal(AVFormatContext *s, AVPacket *pkt) - if (ret < 0) { - if (ret == AVERROR(EAGAIN)) - return ret; -+ if (ret == AVERROR(EIO)) -+ return ret; - /* flush the parsers */ - for (i = 0; i < s->nb_streams; i++) { - st = s->streams[i]; - -From 75902cb6825c581853636147020f1be99aba198c Mon Sep 17 00:00:00 2001 -From: Cory Fields <theuni-nospam-@xbmc.org> -Date: Mon, 28 Jun 2010 02:10:50 -0400 -Subject: [PATCH 03/13] added: Ticket #7187, TV Teletext support for DVB EBU - Teletext streams - ---- - libavcodec/avcodec.h | 4 ++++ - libavformat/mpegts.c | 2 ++ - 2 files changed, 6 insertions(+) - -diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h -index 9d38b59..bc1b1b9 100644 ---- a/libavcodec/avcodec.h -+++ b/libavcodec/avcodec.h -@@ -532,6 +532,10 @@ enum AVCodecID { - AV_CODEC_ID_ASS = MKBETAG('A','S','S',' '), ///< ASS as defined in Matroska - AV_CODEC_ID_HDMV_TEXT_SUBTITLE = MKBETAG('B','D','T','X'), - -+ /* data codecs */ -+ AV_CODEC_ID_VBI_DATA= 0x17500, -+ AV_CODEC_ID_VBI_TELETEXT, -+ - /* other specific kind of codecs (generally used for attachments) */ - AV_CODEC_ID_FIRST_UNKNOWN = 0x18000, ///< A dummy ID pointing at the start of various fake codecs. - AV_CODEC_ID_TTF = 0x18000, -diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c -index 65824dd..338861e 100644 ---- a/libavformat/mpegts.c -+++ b/libavformat/mpegts.c -@@ -756,6 +756,8 @@ static const StreamType DESC_types[] = { - { 0x7b, AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_DTS }, - { 0x56, AVMEDIA_TYPE_SUBTITLE, AV_CODEC_ID_DVB_TELETEXT }, - { 0x59, AVMEDIA_TYPE_SUBTITLE, AV_CODEC_ID_DVB_SUBTITLE }, /* subtitling descriptor */ -+ { 0x45, AVMEDIA_TYPE_DATA, AV_CODEC_ID_VBI_DATA }, /* VBI Data descriptor */ -+ { 0x46, AVMEDIA_TYPE_DATA, AV_CODEC_ID_VBI_TELETEXT }, /* VBI Teletext descriptor */ - { 0 }, - }; - - -From fabf7216626da8caecf9cb34b188739e530cc8d4 Mon Sep 17 00:00:00 2001 -From: Joakim Plate <elupus@ecce.se> -Date: Sun, 18 Sep 2011 19:16:34 +0200 -Subject: [PATCH 04/13] Don't accept mpegts PMT that isn't current - ---- - libavformat/mpegts.c | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c -index 338861e..d4168c8 100644 ---- a/libavformat/mpegts.c -+++ b/libavformat/mpegts.c -@@ -585,6 +585,7 @@ typedef struct SectionHeader { - uint8_t tid; - uint16_t id; - uint8_t version; -+ uint8_t current; - uint8_t sec_num; - uint8_t last_sec_num; - } SectionHeader; -@@ -667,6 +668,7 @@ static int parse_section_header(SectionHeader *h, - val = get8(pp, p_end); - if (val < 0) - return val; -+ h->current = val & 0x1; - h->version = (val >> 1) & 0x1f; - val = get8(pp, p_end); - if (val < 0) -@@ -2020,6 +2022,8 @@ static void pat_cb(MpegTSFilter *filter, const uint8_t *section, int section_len - return; - if (ts->skip_changes) - return; -+ if (!h->current) -+ return; - - if (skip_identical(h, tssf)) - return; - -From 4f1d8668a50ebf7cddc03d191c72c36fca2146dc Mon Sep 17 00:00:00 2001 -From: Joakim Plate <elupus@ecce.se> -Date: Sun, 18 Sep 2011 19:17:23 +0200 -Subject: [PATCH 05/13] Don't reparse PMT unless it's version has changed - ---- - libavformat/mpegts.c | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c -index d4168c8..9c6f6dc 100644 ---- a/libavformat/mpegts.c -+++ b/libavformat/mpegts.c -@@ -91,6 +91,7 @@ struct MpegTSFilter { - int es_id; - int last_cc; /* last cc code (-1 if first packet) */ - int64_t last_pcr; -+ int last_version; /* last version of data on this pid */ - enum MpegTSFilterType type; - union { - MpegTSPESFilter pes_filter; -@@ -459,6 +460,7 @@ static MpegTSFilter *mpegts_open_filter(MpegTSContext *ts, unsigned int pid, - filter->es_id = -1; - filter->last_cc = -1; - filter->last_pcr= -1; -+ filter->last_version = -1; - - return filter; - } -@@ -2024,6 +2026,10 @@ static void pat_cb(MpegTSFilter *filter, const uint8_t *section, int section_len - return; - if (!h->current) - return; -+ if (h->version == filter->last_version) -+ return; -+ filter->last_version = h->version; -+ av_dlog(ts->stream, "version=%d\n", filter->last_version); - - if (skip_identical(h, tssf)) - return; - -From 72cf6cb34af9de7e81bffc6a53f7d1f450e5b624 Mon Sep 17 00:00:00 2001 -From: Cory Fields <theuni-nospam-@xbmc.org> -Date: Fri, 9 Jul 2010 16:43:31 -0400 -Subject: [PATCH 06/13] Read PID timestamps as well as PCR timestamps to find - location in mpegts stream - ---- - libavformat/mpegts.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++-- - 1 file changed, 46 insertions(+), 2 deletions(-) - -diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c -index 9c6f6dc..a4db558 100644 ---- a/libavformat/mpegts.c -+++ b/libavformat/mpegts.c -@@ -2519,6 +2519,44 @@ static void seek_back(AVFormatContext *s, AVIOContext *pb, int64_t pos) { - av_log(s, pb->seekable ? AV_LOG_ERROR : AV_LOG_INFO, "Unable to seek back to the start\n"); - } - -+static int parse_timestamp(int64_t *ts, const uint8_t *buf) -+{ -+ int afc, flags; -+ const uint8_t *p; -+ -+ if(!(buf[1] & 0x40)) /* must be a start packet */ -+ return -1; -+ -+ afc = (buf[3] >> 4) & 3; -+ p = buf + 4; -+ if (afc == 0 || afc == 2) /* invalid or only adaption field */ -+ return -1; -+ if (afc == 3) -+ p += p[0] + 1; -+ if (p >= buf + TS_PACKET_SIZE) -+ return -1; -+ -+ if (p[0] != 0x00 || p[1] != 0x00 || p[2] != 0x01) /* packet_start_code_prefix */ -+ return -1; -+ -+ flags = p[3] | 0x100; /* stream type */ -+ if (!((flags >= 0x1c0 && flags <= 0x1df) || -+ (flags >= 0x1e0 && flags <= 0x1ef) || -+ (flags == 0x1bd) || (flags == 0x1fd))) -+ return -1; -+ -+ flags = p[7]; -+ if ((flags & 0xc0) == 0x80) { -+ *ts = ff_parse_pes_pts(p+9); -+ return 0; -+ } else if ((flags & 0xc0) == 0xc0) { -+ *ts = ff_parse_pes_pts(p+9+5); -+ return 0; -+ } -+ return -1; -+} -+ -+ - static int mpegts_read_header(AVFormatContext *s) - { - MpegTSContext *ts = s->priv_data; -@@ -2724,6 +2762,7 @@ static av_unused int64_t mpegts_get_pcr(AVFormatContext *s, int stream_index, - uint8_t buf[TS_PACKET_SIZE]; - int pcr_l, pcr_pid = - ((PESContext *)s->streams[stream_index]->priv_data)->pcr_pid; -+ int pid = ((PESContext*)s->streams[stream_index]->priv_data)->pid; - int pos47 = ts->pos47_full % ts->raw_packet_size; - pos = - ((*ppos + ts->raw_packet_size - 1 - pos47) / ts->raw_packet_size) * -@@ -2745,6 +2784,11 @@ static av_unused int64_t mpegts_get_pcr(AVFormatContext *s, int stream_index, - *ppos = pos; - return timestamp; - } -+ if ((pid < 0 || (AV_RB16(buf + 1) & 0x1fff) == pid) && -+ parse_timestamp(&timestamp, buf) == 0) { -+ *ppos = pos; -+ return timestamp; -+ } - pos += ts->raw_packet_size; - } - -@@ -2844,7 +2888,7 @@ AVInputFormat ff_mpegts_demuxer = { - .read_header = mpegts_read_header, - .read_packet = mpegts_read_packet, - .read_close = mpegts_read_close, -- .read_timestamp = mpegts_get_dts, -+ .read_timestamp = mpegts_get_pcr, - .flags = AVFMT_SHOW_IDS | AVFMT_TS_DISCONT, - .priv_class = &mpegts_class, - }; -@@ -2856,7 +2900,7 @@ AVInputFormat ff_mpegtsraw_demuxer = { - .read_header = mpegts_read_header, - .read_packet = mpegts_raw_read_packet, - .read_close = mpegts_read_close, -- .read_timestamp = mpegts_get_dts, -+ .read_timestamp = mpegts_get_pcr, - .flags = AVFMT_SHOW_IDS | AVFMT_TS_DISCONT, - .priv_class = &mpegtsraw_class, - }; - -From ee8a688e4e6f59785180c1e92981ff867f6f5c23 Mon Sep 17 00:00:00 2001 -From: Joakim Plate <elupus@ecce.se> -Date: Sat, 22 Oct 2011 19:01:38 +0200 -Subject: [PATCH 07/13] Get stream durations using read_timestamp - ---- - libavformat/utils.c | 39 +++++++++++++++++++++++++++++++++++++++ - 1 file changed, 39 insertions(+) - -diff --git a/libavformat/utils.c b/libavformat/utils.c -index 8a947d6..88786f1 100644 ---- a/libavformat/utils.c -+++ b/libavformat/utils.c -@@ -2455,6 +2455,41 @@ static void estimate_timings_from_bit_rate(AVFormatContext *ic) - #define DURATION_MAX_READ_SIZE 250000LL - #define DURATION_MAX_RETRY 6 - -+static void av_estimate_timings_from_pts2(AVFormatContext *ic, int64_t old_offset) -+{ -+ AVStream *st; -+ int i, step= 1024; -+ int64_t ts, pos; -+ -+ for(i=0;i<ic->nb_streams;i++) { -+ st = ic->streams[i]; -+ -+ pos = 0; -+ ts = ic->iformat->read_timestamp(ic, i, &pos, DURATION_MAX_READ_SIZE); -+ if (ts == AV_NOPTS_VALUE) -+ continue; -+ if (st->start_time > ts || st->start_time == AV_NOPTS_VALUE) -+ st->start_time = ts; -+ -+ pos = avio_size(ic->pb) - 1; -+ do { -+ pos -= step; -+ ts = ic->iformat->read_timestamp(ic, i, &pos, pos + step); -+ step += step; -+ } while (ts == AV_NOPTS_VALUE && pos >= step && step < DURATION_MAX_READ_SIZE); -+ -+ if (ts == AV_NOPTS_VALUE) -+ continue; -+ -+ if (st->duration < ts - st->start_time || st->duration == AV_NOPTS_VALUE) -+ st->duration = ts - st->start_time; -+ } -+ -+ fill_all_stream_timings(ic); -+ -+ avio_seek(ic->pb, old_offset, SEEK_SET); -+} -+ - /* only usable for MPEG-PS streams */ - static void estimate_timings_from_pts(AVFormatContext *ic, int64_t old_offset) - { -@@ -2605,6 +2640,10 @@ static void estimate_timings(AVFormatContext *ic, int64_t old_offset) - * the components */ - fill_all_stream_timings(ic); - ic->duration_estimation_method = AVFMT_DURATION_FROM_STREAM; -+ } else if (ic->iformat->read_timestamp && -+ file_size && ic->pb->seekable) { -+ /* get accurate estimate from the PTSes */ -+ av_estimate_timings_from_pts2(ic, old_offset); - } else { - /* less precise: use bitrate info */ - estimate_timings_from_bit_rate(ic); - -From a45171f7370c263344805d19181e08a12a65dcdd Mon Sep 17 00:00:00 2001 -From: Joakim Plate <elupus@ecce.se> -Date: Wed, 8 Dec 2010 14:03:43 +0000 -Subject: [PATCH 08/13] changed: allow 4 second skew between streams in mov - before attempting to seek - ---- - libavformat/mov.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/libavformat/mov.c b/libavformat/mov.c -index 4ce4e2d..2c364ac 100644 ---- a/libavformat/mov.c -+++ b/libavformat/mov.c -@@ -4624,8 +4624,8 @@ static AVIndexEntry *mov_find_next_sample(AVFormatContext *s, AVStream **st) - if (!sample || (!s->pb->seekable && current_sample->pos < sample->pos) || - (s->pb->seekable && - ((msc->pb != s->pb && dts < best_dts) || (msc->pb == s->pb && -- ((FFABS(best_dts - dts) <= AV_TIME_BASE && current_sample->pos < sample->pos) || -- (FFABS(best_dts - dts) > AV_TIME_BASE && dts < best_dts)))))) { -+ ((FFABS(best_dts - dts) <= 4*AV_TIME_BASE && current_sample->pos < sample->pos) || -+ (FFABS(best_dts - dts) > 4*AV_TIME_BASE && dts < best_dts)))))) { - sample = current_sample; - best_dts = dts; - *st = avst; - -From c3e8fbd02c2eaba2a5d14d2b6c07fe08746f5947 Mon Sep 17 00:00:00 2001 -From: Joakim Plate <elupus@ecce.se> -Date: Fri, 26 Nov 2010 20:56:48 +0000 -Subject: [PATCH 09/13] fixed: memleak in mpegts demuxer on some malformed (??) - mpegts files with too large pes packets - -at-visions sample file brokenStream.mpg ---- - libavformat/mpegts.c | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c -index a4db558..492d9c7 100644 ---- a/libavformat/mpegts.c -+++ b/libavformat/mpegts.c -@@ -868,6 +868,10 @@ static void reset_pes_packet_state(PESContext *pes) - - static void new_pes_packet(PESContext *pes, AVPacket *pkt) - { -+ if(pkt->data) { -+ av_log(pes->stream, AV_LOG_ERROR, "ignoring previously allocated packet on stream %d\n", pkt->stream_index); -+ av_free_packet(pkt); -+ } - av_init_packet(pkt); - - pkt->buf = pes->buffer; -@@ -2715,6 +2719,8 @@ static int mpegts_read_packet(AVFormatContext *s, AVPacket *pkt) - - pkt->size = -1; - ts->pkt = pkt; -+ ts->pkt->data = NULL; -+ - ret = handle_packets(ts, 0); - if (ret < 0) { - av_free_packet(ts->pkt); - -From eba5c839b7e24f8e6800d3f923d5334c2c9e6b2d Mon Sep 17 00:00:00 2001 -From: Joakim Plate <elupus@ecce.se> -Date: Mon, 28 Jun 2010 21:26:54 +0000 -Subject: [PATCH 10/13] Speed up mpegts av_find_stream_info - ---- - libavformat/mpegts.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c -index 492d9c7..29d58eb 100644 ---- a/libavformat/mpegts.c -+++ b/libavformat/mpegts.c -@@ -1030,7 +1030,7 @@ static int mpegts_push_data(MpegTSFilter *filter, - goto skip; - - /* stream not present in PMT */ -- if (!pes->st) { -+ if (ts->auto_guess && !pes->st) { - if (ts->skip_changes) - goto skip; - - -From 2372b27243eb7d0932d9885558708ba115596d0b Mon Sep 17 00:00:00 2001 -From: marc <mhocking@ubuntu-desktop.(none)> -Date: Mon, 18 Feb 2013 17:18:18 +0000 -Subject: [PATCH 11/13] dxva-h264 Fix dxva playback of streams that don't start - with an I-Frame (adjusted to 2.7) - ---- - libavcodec/dxva2_h264.c | 8 ++++++++ - libavcodec/h264.c | 1 + - libavcodec/h264.h | 2 ++ - libavcodec/h264_slice.c | 1 + - 4 files changed, 12 insertions(+) - -diff --git a/libavcodec/dxva2_h264.c b/libavcodec/dxva2_h264.c -index 99b80ba..eb5ecd1 100644 ---- a/libavcodec/dxva2_h264.c -+++ b/libavcodec/dxva2_h264.c -@@ -497,6 +497,14 @@ static int dxva2_h264_end_frame(AVCodecContext *avctx) - - if (ctx_pic->slice_count <= 0 || ctx_pic->bitstream_size <= 0) - return -1; -+ -+ // Wait for an I-frame before start decoding. Workaround for ATI UVD and UVD+ GPUs -+ if (!h->got_first_iframe) { -+ if (!(ctx_pic->pp.wBitFields & (1 << 15))) -+ return -1; -+ h->got_first_iframe = 1; -+ } -+ - ret = ff_dxva2_common_end_frame(avctx, h->cur_pic_ptr->f, - &ctx_pic->pp, sizeof(ctx_pic->pp), - &ctx_pic->qm, sizeof(ctx_pic->qm), -diff --git a/libavcodec/h264.c b/libavcodec/h264.c -index 907943e..718b746 100644 ---- a/libavcodec/h264.c -+++ b/libavcodec/h264.c -@@ -1087,6 +1087,7 @@ void ff_h264_flush_change(H264Context *h) - - h->next_outputed_poc = INT_MIN; - h->prev_interlaced_frame = 1; -+ h->got_first_iframe = 0; - idr(h); - - h->prev_frame_num = -1; -diff --git a/libavcodec/h264.h b/libavcodec/h264.h -index 7356288..907ee5e 100644 ---- a/libavcodec/h264.h -+++ b/libavcodec/h264.h -@@ -813,6 +813,8 @@ typedef struct H264Context { - * slices) anymore */ - int setup_finished; - -+ int got_first_iframe; -+ - // Timestamp stuff - int sei_buffering_period_present; ///< Buffering period SEI flag - int initial_cpb_removal_delay[32]; ///< Initial timestamps for CPBs -diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c -index 8be803b7..939d02b 100644 ---- a/libavcodec/h264_slice.c -+++ b/libavcodec/h264_slice.c -@@ -1043,6 +1043,7 @@ static int h264_slice_header_init(H264Context *h) - - h->first_field = 0; - h->prev_interlaced_frame = 1; -+ h->got_first_iframe = 0; - - init_scan_tables(h); - ret = ff_h264_alloc_tables(h); - -From 959b88473b6f76fb2245f329ef604d2066b2cb89 Mon Sep 17 00:00:00 2001 -From: wsnipex <wsnipex@a1.net> -Date: Mon, 16 Feb 2015 09:58:28 +0100 -Subject: [PATCH 12/13] only check for a git rev if the src tree is in a git - repo - -fixes the version string when building from the kodi depends src tree ---- - version.sh | 36 +++++++++++++++++++----------------- - 1 file changed, 19 insertions(+), 17 deletions(-) - -diff --git a/version.sh b/version.sh -index f9754eb..cc23f80 100755 ---- a/version.sh -+++ b/version.sh -@@ -2,30 +2,32 @@ - - # Usage: version.sh <ffmpeg-root-dir> <output-version.h> <extra-version> - -+if [ -d $1/.git ]; then # only check for a git rev, if the src tree is in a git repo - # check for git short hash --if ! test "$revision"; then -+ if ! test "$revision"; then - if (cd "$1" && grep git RELEASE 2> /dev/null >/dev/null) ; then - revision=$(cd "$1" && git describe --tags --match N 2> /dev/null) - else - revision=$(cd "$1" && git describe --tags --always 2> /dev/null) - fi --fi -+ fi -+ -+ # Shallow Git clones (--depth) do not have the N tag: -+ # use 'git-YYYY-MM-DD-hhhhhhh'. -+ test "$revision" || revision=$(cd "$1" && -+ git log -1 --pretty=format:"git-%cd-%h" --date=short 2> /dev/null) - --# Shallow Git clones (--depth) do not have the N tag: --# use 'git-YYYY-MM-DD-hhhhhhh'. --test "$revision" || revision=$(cd "$1" && -- git log -1 --pretty=format:"git-%cd-%h" --date=short 2> /dev/null) -- --# Snapshots from gitweb are in a directory called ffmpeg-hhhhhhh or --# ffmpeg-HEAD-hhhhhhh. --if [ -z "$revision" ]; then -- srcdir=$(cd "$1" && pwd) -- case "$srcdir" in -- */ffmpeg-[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]) -- git_hash="${srcdir##*-}";; -- */ffmpeg-HEAD-[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]) -- git_hash="${srcdir##*-}";; -- esac -+ # Snapshots from gitweb are in a directory called ffmpeg-hhhhhhh or -+ # ffmpeg-HEAD-hhhhhhh. -+ if [ -z "$revision" ]; then -+ srcdir=$(cd "$1" && pwd) -+ case "$srcdir" in -+ */ffmpeg-[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]) -+ git_hash="${srcdir##*-}";; -+ */ffmpeg-HEAD-[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]) -+ git_hash="${srcdir##*-}";; -+ esac -+ fi - fi - - # no revision number found diff --git a/packages/multimedia/ffmpeg/patches/ffmpeg-99.0011-mpeg4video-Signal-unsupported-GMC-with-more-than-one.patch b/packages/multimedia/ffmpeg/patches/ffmpeg-99.1000-mpeg4video-Signal-unsupported-GMC-with-more-than-one.patch similarity index 99% rename from packages/multimedia/ffmpeg/patches/ffmpeg-99.0011-mpeg4video-Signal-unsupported-GMC-with-more-than-one.patch rename to packages/multimedia/ffmpeg/patches/ffmpeg-99.1000-mpeg4video-Signal-unsupported-GMC-with-more-than-one.patch index 4cb8dd8fc46..0e814fa3c0f 100644 --- a/packages/multimedia/ffmpeg/patches/ffmpeg-99.0011-mpeg4video-Signal-unsupported-GMC-with-more-than-one.patch +++ b/packages/multimedia/ffmpeg/patches/ffmpeg-99.1000-mpeg4video-Signal-unsupported-GMC-with-more-than-one.patch @@ -46,3 +46,4 @@ index 9bf33dd..0b5d3b9 100644 -- 1.9.1 + diff --git a/packages/multimedia/ffmpeg/patches/ffmpeg-99.1001-hevcdsp_ARM_NEON_optimized_epel_functions.patch b/packages/multimedia/ffmpeg/patches/ffmpeg-99.1001-hevcdsp_ARM_NEON_optimized_epel_functions.patch new file mode 100644 index 00000000000..d19984b4dec --- /dev/null +++ b/packages/multimedia/ffmpeg/patches/ffmpeg-99.1001-hevcdsp_ARM_NEON_optimized_epel_functions.patch @@ -0,0 +1,410 @@ +From 29c3327a0d72a7e872ff170363cfe5ed13bca5d0 Mon Sep 17 00:00:00 2001 +From: Seppo Tomperi <seppo.tomperi@vtt.fi> +Date: Tue, 22 Dec 2015 18:10:24 +0000 +Subject: [PATCH] hevcdsp: ARM NEON optimized epel functions + +--- + libavcodec/arm/Makefile | 1 + + libavcodec/arm/hevcdsp_epel_neon.S | 334 +++++++++++++++++++++++++++++++++++++ + libavcodec/arm/hevcdsp_init_neon.c | 23 +++ + 3 files changed, 358 insertions(+) + create mode 100644 libavcodec/arm/hevcdsp_epel_neon.S + +diff --git a/libavcodec/arm/Makefile b/libavcodec/arm/Makefile +index cdd35b0..6051ec8 100644 +--- a/libavcodec/arm/Makefile ++++ b/libavcodec/arm/Makefile +@@ -131,6 +131,7 @@ NEON-OBJS-$(CONFIG_DCA_DECODER) += arm/dcadsp_neon.o \ + arm/synth_filter_neon.o + NEON-OBJS-$(CONFIG_HEVC_DECODER) += arm/hevcdsp_init_neon.o \ + arm/hevcdsp_deblock_neon.o \ ++ arm/hevcdsp_epel_neon.o \ + arm/hevcdsp_idct_neon.o \ + arm/hevcdsp_qpel_neon.o + NEON-OBJS-$(CONFIG_RV30_DECODER) += arm/rv34dsp_neon.o +diff --git a/libavcodec/arm/hevcdsp_epel_neon.S b/libavcodec/arm/hevcdsp_epel_neon.S +new file mode 100644 +index 0000000..516ae5b +--- /dev/null ++++ b/libavcodec/arm/hevcdsp_epel_neon.S +@@ -0,0 +1,334 @@ ++/* ++ * Copyright (c) 2014 - 2015 Seppo Tomperi <seppo.tomperi@vtt.fi> ++ * ++ * This file is part of FFmpeg. ++ * ++ * FFmpeg is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * FFmpeg is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FFmpeg; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ */ ++ ++#include "libavutil/arm/asm.S" ++#include "neon.S" ++ ++#define MAX_PB_SIZE #64 ++ ++.macro vextin_d4 ++ vld1.8 {q10}, [r1], r2 ++ vmov d16, d20 ++ vext.8 d17, d20, d21, #1 ++ vext.8 d18, d20, d21, #2 ++ vext.8 d19, d20, d21, #3 ++.endm ++ ++.macro vextin_d4_8 ++ vld1.8 d16, [r1], r2 ++ vext.8 d17, d16, d16, #1 ++ vext.8 d18, d16, d16, #2 ++ vext.8 d19, d16, d16, #3 ++.endm ++ ++.macro load_coeffs_16b coeffs ++ ldr \coeffs, [\coeffs] ++ vdup.i8 d0, \coeffs ++ lsr \coeffs, #8 ++ vdup.i8 d1, \coeffs ++ lsr \coeffs, #8 ++ vdup.i8 d2, \coeffs ++ lsr \coeffs, #8 ++ vdup.i8 d3, \coeffs ++.endm ++ ++.macro epel_filter_16b out=q12 ++ vmull.u8 q3, d16, d0 ++ vmull.u8 q11, d19, d3 ++ vmull.u8 \out, d17, d1 ++ vmull.u8 q10, d18, d2 ++ vadd.s16 q3, q11 ++ vadd.s16 \out, q10 ++ vsub.s16 \out, q3 ++.endm ++ ++.macro load_coeffs_32b coeffs ++ ldr \coeffs, [\coeffs] ++ vmov.i64 d4, #0 ++ vmov.8 d4[0], \coeffs ++ lsr \coeffs, #8 ++ vmov.8 d4[2], \coeffs ++ lsr \coeffs, #8 ++ vmov.8 d4[4], \coeffs ++ lsr \coeffs, #8 ++ vmov.8 d4[6], \coeffs ++.endm ++ ++.macro epel_filter_32b ++ vmull.s16 q3, d24, d4[0] //q12 ++ vmull.s16 q4, d25, d4[0] ++ vmull.s16 q5, d30, d4[3] //q15 ++ vmull.s16 q6, d31, d4[3] ++ ++ vmull.s16 q7, d26, d4[1] // q13 ++ vmull.s16 q8, d27, d4[1] ++ vmull.s16 q9, d28, d4[2] // q14 ++ vmull.s16 q10, d29, d4[2] ++ vadd.s32 q3, q5 ++ vadd.s32 q4, q6 ++ vadd.s32 q7, q9 ++ vadd.s32 q8, q10 ++ vsub.s32 q7, q3 ++ vsub.s32 q8, q4 ++ vqshrn.s32 d6, q7, #6 ++ vqshrn.s32 d7, q8, #6 ++.endm ++ ++.macro epel_filter_32b_4 ++ vmull.s16 q3, d24, d4[0] //q12 ++ vmull.s16 q5, d30, d4[3] //q15 ++ vmull.s16 q7, d26, d4[1] // q13 ++ vmull.s16 q9, d28, d4[2] // q14 ++ vadd.s32 q3, q5 ++ vadd.s32 q7, q9 ++ vsub.s32 q7, q3 ++ vqshrn.s32 d6, q7, #6 ++.endm ++ ++function ff_hevc_put_epel_h_neon_8, export=1 ++ push {r4-r7} ++ mov r4, MAX_PB_SIZE ++ ldr r7, [sp, #16] // mx ++ ldr r5, [sp, #24] // width ++ sub r7, #1 ++ lsl r7, #2 ++ vpush {d8-d15} ++ adrl r12, epel_coeffs ++ add r7, r12 ++ sub r1, #1 ++ lsl r4, #1 ++ load_coeffs_16b r7 ++ mov r12, r3 ++ mov r6, r0 ++ mov r7, r1 ++ cmp r5, #6 ++ bgt 8f ++ cmp r5, #4 ++ blt 2f ++ b 4f ++8: subs r3, #1 ++ pld [r1] ++ vextin_d4 ++ epel_filter_16b ++ vst1.16 {q12}, [r0], r4 ++ bne 8b ++ subs r5, #8 ++ beq 99f ++ mov r3, r12 ++ add r6, #16 ++ mov r0, r6 ++ add r7, #8 ++ mov r1, r7 ++ cmp r5, #4 ++ bgt 8b ++4: subs r3, #1 ++ pld [r1] ++ vextin_d4_8 ++ epel_filter_16b ++ vst1.16 d24, [r0], r4 ++ bne 4b ++ subs r5, #4 ++ beq 99f ++ mov r3, r12 ++ add r6, #8 ++ mov r0, r6 ++ add r7, #4 ++ mov r1, r7 ++2: subs r3, #1 ++ pld [r1] ++ vextin_d4_8 ++ epel_filter_16b ++ vst1.32 d24[0], [r0], r4 ++ bne 2b ++99: vpop {d8-d15} ++ pop {r4-r7} ++ bx lr ++endfunc ++ ++function ff_hevc_put_epel_v_neon_8, export=1 ++ push {r4-r7} ++ mov r4, MAX_PB_SIZE ++ ldr r7, [sp, #20] // my ++ ldr r5, [sp, #24] // width ++ sub r7, #1 ++ lsl r7, #2 ++ vpush {d8-d15} ++ adrl r12, epel_coeffs ++ add r7, r12 ++ load_coeffs_16b r7 ++ sub r1, r2 ++ lsl r4, #1 ++ mov r12, r3 ++ mov r6, r0 ++ mov r7, r1 ++0: pld [r1] ++ vld1.8 {d16}, [r1], r2 ++ pld [r1] ++ vld1.8 {d17}, [r1], r2 ++ pld [r1] ++ vld1.8 {d18}, [r1], r2 ++ cmp r5, #6 ++ bgt 8f ++ cmp r5, #4 ++ blt 2f ++ b 4f ++8: pld [r1] ++ vld1.8 {d19}, [r1], r2 ++ subs r3, #1 ++ epel_filter_16b ++ vst1.16 {q12}, [r0], r4 ++ vmov d16, d17 ++ vmov d17, d18 ++ vmov d18, d19 ++ bne 8b ++ subs r5, #8 ++ beq 99f ++ mov r3, r12 ++ add r6, #16 ++ mov r0, r6 ++ add r7, #8 ++ mov r1, r7 ++ b 0b ++4: pld [r1] ++ vld1.8 {d19}, [r1], r2 ++ subs r3, #1 ++ epel_filter_16b ++ vst1.16 d24, [r0], r4 ++ vmov d16, d17 ++ vmov d17, d18 ++ vmov d18, d19 ++ bne 4b ++ subs r5, #4 ++ beq 99f ++ mov r3, r12 ++ add r6, #8 ++ mov r0, r6 ++ add r7, #4 ++ mov r1, r7 ++ b 0b ++2: pld [r1] ++ vld1.8 {d19}, [r1], r2 ++ subs r3, #1 ++ epel_filter_16b ++ vst1.32 d24[0], [r0], r4 ++ vmov d16, d17 ++ vmov d17, d18 ++ vmov d18, d19 ++ bne 2b ++99: vpop {d8-d15} ++ pop {r4-r7} ++ bx lr ++endfunc ++ ++function ff_hevc_put_epel_hv_neon_8, export=1 ++ push {r4-r7} ++ mov r4, MAX_PB_SIZE ++ ldr r6, [sp, #16] // mx ++ ldr r7, [sp, #20] // my ++ ldr r5, [sp, #24] // width ++ sub r7, #1 ++ lsl r7, #2 ++ vpush {d8-d15} ++ adrl r12, epel_coeffs ++ sub r6, #1 ++ lsl r6, #2 ++ add r6, r12 // mx epel coeff offset ++ add r7, r12 ++ sub r1, #1 ++ sub r1, r2 ++ lsl r4, #1 ++ load_coeffs_16b r6 ++ load_coeffs_32b r7 ++ mov r12, r3 ++ mov r6, r0 ++ mov r7, r1 ++0: pld [r1] ++ vextin_d4 ++ epel_filter_16b q12 ++ pld [r1] ++ vextin_d4 ++ epel_filter_16b q13 ++ pld [r1] ++ vextin_d4 ++ epel_filter_16b q14 ++ cmp r5, #6 ++ bgt 8f ++ cmp r5, #4 ++ blt 2f ++ b 4f ++8: pld [r1] ++ vextin_d4 ++ epel_filter_16b q15 ++ subs r3, #1 ++ epel_filter_32b ++ vst1.16 {q3}, [r0], r4 ++ vmov q12, q13 ++ vmov q13, q14 ++ vmov q14, q15 ++ bne 8b ++ subs r5, #8 ++ beq 99f ++ mov r3, r12 ++ add r6, #16 ++ mov r0, r6 ++ add r7, #8 ++ mov r1, r7 ++ b 0b ++4: pld [r1] ++ vextin_d4_8 ++ epel_filter_16b q15 ++ subs r3, #1 ++ epel_filter_32b_4 ++ vst1.16 d6, [r0], r4 ++ vmov q12, q13 ++ vmov q13, q14 ++ vmov q14, q15 ++ bne 4b ++ subs r5, #4 ++ beq 99f ++ mov r3, r12 ++ add r6, #8 ++ mov r0, r6 ++ add r7, #4 ++ mov r1, r7 ++ b 0b ++2: pld [r1] ++ vextin_d4_8 ++ epel_filter_16b q15 ++ subs r3, #1 ++ epel_filter_32b_4 ++ vst1.32 d6[0], [r0], r4 ++ vmov q12, q13 ++ vmov q13, q14 ++ vmov q14, q15 ++ bne 2b ++99: vpop {d8-d15} ++ pop {r4-r7} ++ bx lr ++endfunc ++ ++epel_coeffs: ++ .byte 2, 58, 10, 2 ++ .byte 4, 54, 16, 2 ++ .byte 6, 46, 28, 4 ++ .byte 4, 36, 36, 4 ++ .byte 4, 28, 46, 6 ++ .byte 2, 16, 54, 4 ++ .byte 2, 10, 58, 2 +diff --git a/libavcodec/arm/hevcdsp_init_neon.c b/libavcodec/arm/hevcdsp_init_neon.c +index 5591807..733ff08 100644 +--- a/libavcodec/arm/hevcdsp_init_neon.c ++++ b/libavcodec/arm/hevcdsp_init_neon.c +@@ -58,6 +58,15 @@ PUT_PIXELS(ff_hevc_put_pixels_w32_neon_8); + PUT_PIXELS(ff_hevc_put_pixels_w48_neon_8); + PUT_PIXELS(ff_hevc_put_pixels_w64_neon_8); + #undef PUT_PIXELS ++void ff_hevc_put_epel_h_neon_8(int16_t *dst, uint8_t *src, ++ ptrdiff_t srcstride, int height, ++ intptr_t mx, intptr_t my, int width); ++void ff_hevc_put_epel_v_neon_8(int16_t *dst, uint8_t *src, ++ ptrdiff_t srcstride, int height, ++ intptr_t mx, intptr_t my, int width); ++void ff_hevc_put_epel_hv_neon_8(int16_t *dst, uint8_t *src, ++ ptrdiff_t srcstride, int height, ++ intptr_t mx, intptr_t my, int width); + + static void (*put_hevc_qpel_neon[4][4])(int16_t *dst, ptrdiff_t dststride, uint8_t *src, ptrdiff_t srcstride, + int height, int width); +@@ -201,7 +210,21 @@ av_cold void ff_hevcdsp_init_neon(HEVCDSPContext *c, const int bit_depth) + c->put_hevc_qpel_bi[x][1][0] = ff_hevc_put_qpel_bi_neon_wrapper; + c->put_hevc_qpel_bi[x][0][1] = ff_hevc_put_qpel_bi_neon_wrapper; + c->put_hevc_qpel_bi[x][1][1] = ff_hevc_put_qpel_bi_neon_wrapper; ++ c->put_hevc_epel[x][1][0] = ff_hevc_put_epel_v_neon_8; ++ c->put_hevc_epel[x][0][1] = ff_hevc_put_epel_h_neon_8; ++ c->put_hevc_epel[x][1][1] = ff_hevc_put_epel_hv_neon_8; + } ++ c->put_hevc_epel[0][0][0] = ff_hevc_put_pixels_w2_neon_8; ++ c->put_hevc_epel[1][0][0] = ff_hevc_put_pixels_w4_neon_8; ++ c->put_hevc_epel[2][0][0] = ff_hevc_put_pixels_w6_neon_8; ++ c->put_hevc_epel[3][0][0] = ff_hevc_put_pixels_w8_neon_8; ++ c->put_hevc_epel[4][0][0] = ff_hevc_put_pixels_w12_neon_8; ++ c->put_hevc_epel[5][0][0] = ff_hevc_put_pixels_w16_neon_8; ++ c->put_hevc_epel[6][0][0] = ff_hevc_put_pixels_w24_neon_8; ++ c->put_hevc_epel[7][0][0] = ff_hevc_put_pixels_w32_neon_8; ++ c->put_hevc_epel[8][0][0] = ff_hevc_put_pixels_w48_neon_8; ++ c->put_hevc_epel[9][0][0] = ff_hevc_put_pixels_w64_neon_8; ++ + c->put_hevc_qpel[0][0][0] = ff_hevc_put_pixels_w2_neon_8; + c->put_hevc_qpel[1][0][0] = ff_hevc_put_pixels_w4_neon_8; + c->put_hevc_qpel[2][0][0] = ff_hevc_put_pixels_w6_neon_8; +-- +2.5.0 + + diff --git a/packages/multimedia/ffmpeg/patches/ffmpeg-99.1002-added_ARM_NEON_optimized_SAO_patches.patch b/packages/multimedia/ffmpeg/patches/ffmpeg-99.1002-added_ARM_NEON_optimized_SAO_patches.patch new file mode 100644 index 00000000000..f090c38c7eb --- /dev/null +++ b/packages/multimedia/ffmpeg/patches/ffmpeg-99.1002-added_ARM_NEON_optimized_SAO_patches.patch @@ -0,0 +1,3329 @@ +From b0cb307c253d2c9f4b94a54dfc74ddb83af984cc Mon Sep 17 00:00:00 2001 +From: Seppo Tomperi <seppo.tomperi@vtt.fi> +Date: Mon, 8 Dec 2014 13:24:40 +0200 +Subject: [PATCH 1/9] added ARM NEON optimized SAO band offset + +--- + libavcodec/arm/Makefile | 3 +- + libavcodec/arm/hevcdsp_init_neon.c | 47 +++++++++ + libavcodec/arm/hevcdsp_sao_neon.S | 204 +++++++++++++++++++++++++++++++++++++ + 3 files changed, 253 insertions(+), 1 deletion(-) + create mode 100644 libavcodec/arm/hevcdsp_sao_neon.S + +diff --git a/libavcodec/arm/Makefile b/libavcodec/arm/Makefile +index 6051ec8..093a2e8 100644 +--- a/libavcodec/arm/Makefile ++++ b/libavcodec/arm/Makefile +@@ -133,7 +133,8 @@ NEON-OBJS-$(CONFIG_HEVC_DECODER) += arm/hevcdsp_init_neon.o \ + arm/hevcdsp_deblock_neon.o \ + arm/hevcdsp_epel_neon.o \ + arm/hevcdsp_idct_neon.o \ +- arm/hevcdsp_qpel_neon.o ++ arm/hevcdsp_qpel_neon.o \ ++ arm/hevcdsp_sao_neon.o + NEON-OBJS-$(CONFIG_RV30_DECODER) += arm/rv34dsp_neon.o + NEON-OBJS-$(CONFIG_RV40_DECODER) += arm/rv34dsp_neon.o \ + arm/rv40dsp_neon.o +diff --git a/libavcodec/arm/hevcdsp_init_neon.c b/libavcodec/arm/hevcdsp_init_neon.c +index 733ff08..69e2b2c 100644 +--- a/libavcodec/arm/hevcdsp_init_neon.c ++++ b/libavcodec/arm/hevcdsp_init_neon.c +@@ -22,6 +22,7 @@ + #include "libavutil/arm/cpu.h" + #include "libavcodec/hevcdsp.h" + #include "hevcdsp_arm.h" ++#include "../bit_depth_template.c" + + void ff_hevc_v_loop_filter_luma_neon(uint8_t *_pix, ptrdiff_t _stride, int _beta, int *_tc, uint8_t *_no_p, uint8_t *_no_q); + void ff_hevc_h_loop_filter_luma_neon(uint8_t *_pix, ptrdiff_t _stride, int _beta, int *_tc, uint8_t *_no_p, uint8_t *_no_q); +@@ -43,6 +44,11 @@ void ff_hevc_transform_add_16x16_neon_8(uint8_t *_dst, int16_t *coeffs, + void ff_hevc_transform_add_32x32_neon_8(uint8_t *_dst, int16_t *coeffs, + ptrdiff_t stride); + ++void ff_hevc_sao_band_w8_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t * offset_table); ++void ff_hevc_sao_band_w16_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t * offset_table); ++void ff_hevc_sao_band_w32_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t * offset_table); ++void ff_hevc_sao_band_w64_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t * offset_table); ++ + #define PUT_PIXELS(name) \ + void name(int16_t *dst, uint8_t *src, \ + ptrdiff_t srcstride, int height, \ +@@ -151,6 +157,44 @@ void ff_hevc_put_qpel_bi_neon_wrapper(uint8_t *dst, ptrdiff_t dststride, uint8_t + put_hevc_qpel_uw_neon[my][mx](dst, dststride, src, srcstride, width, height, src2, MAX_PB_SIZE); + } + ++static void ff_hevc_sao_band_neon_wrapper(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, ++ int16_t *sao_offset_val, int sao_left_class, int width, int height) ++{ ++ pixel *dst = (pixel *)_dst; ++ pixel *src = (pixel *)_src; ++ int8_t offset_table[32] = { 0 }; ++ int k, y, x; ++ int shift = 3; // BIT_DEPTH - 5 ++ ++ stride_src /= sizeof(pixel); ++ stride_dst /= sizeof(pixel); ++ ++ for (k = 0; k < 4; k++) ++ offset_table[(k + sao_left_class) & 31] = sao_offset_val[k + 1]; ++ ++ switch(width){ ++ case 8: ++ ff_hevc_sao_band_w8_neon_8(_dst, _src, stride_dst, stride_src, height, offset_table); ++ break; ++ case 16: ++ ff_hevc_sao_band_w16_neon_8(_dst, _src, stride_dst, stride_src, height, offset_table); ++ break; ++ case 32: ++ ff_hevc_sao_band_w32_neon_8(_dst, _src, stride_dst, stride_src, height, offset_table); ++ break; ++ case 64: ++ ff_hevc_sao_band_w64_neon_8(_dst, _src, stride_dst, stride_src, height, offset_table); ++ break; ++ default: ++ for (y = 0; y < height; y++) { ++ for (x = 0; x < width; x++) ++ dst[x] = av_clip_pixel(src[x] + offset_table[src[x] >> shift]); ++ dst += stride_dst; ++ src += stride_src; ++ } ++ } ++} ++ + av_cold void ff_hevcdsp_init_neon(HEVCDSPContext *c, const int bit_depth) + { + if (bit_depth == 8) { +@@ -170,6 +214,9 @@ av_cold void ff_hevcdsp_init_neon(HEVCDSPContext *c, const int bit_depth) + c->transform_add[2] = ff_hevc_transform_add_16x16_neon_8; + c->transform_add[3] = ff_hevc_transform_add_32x32_neon_8; + c->idct_4x4_luma = ff_hevc_transform_luma_4x4_neon_8; ++ for (x = 0; x < sizeof c->sao_band_filter / sizeof *c->sao_band_filter; x++) { ++ c->sao_band_filter[x] = ff_hevc_sao_band_neon_wrapper; ++ } + put_hevc_qpel_neon[1][0] = ff_hevc_put_qpel_v1_neon_8; + put_hevc_qpel_neon[2][0] = ff_hevc_put_qpel_v2_neon_8; + put_hevc_qpel_neon[3][0] = ff_hevc_put_qpel_v3_neon_8; +diff --git a/libavcodec/arm/hevcdsp_sao_neon.S b/libavcodec/arm/hevcdsp_sao_neon.S +new file mode 100644 +index 0000000..1f0ad64 +--- /dev/null ++++ b/libavcodec/arm/hevcdsp_sao_neon.S +@@ -0,0 +1,204 @@ ++/* ++ * Copyright (c) 2014 Seppo Tomperi <seppo.tomperi@vtt.fi> ++ * ++ * This file is part of FFmpeg. ++ * ++ * FFmpeg is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * FFmpeg is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FFmpeg; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ */ ++ ++#include "libavutil/arm/asm.S" ++#include "neon.S" ++ ++function ff_hevc_sao_band_w8_neon_8, export=1 ++ push {r4-r8} ++ ldr r4, [sp, #20] // height ++ ldr r5, [sp, #24] // offset_table ++ vpush {d8-d15} ++ vld1.8 {q0, q1}, [r5] // offset table ++ ++1: subs r4, #1 ++ vld1.8 {d24}, [r1], r3 ++ vshr.u8 d16, d24, #3 ++ vtbl.8 d16, {q0, q1}, d16 ++ vmovl.s8 q2, d16 ++ vmovl.u8 q6, d24 ++ vadd.s16 q2, q6 ++ vqmovun.s16 d4, q2 ++ vst1.8 {d4}, [r0], r2 ++ bne 1b ++ ++ vpop {d8-d15} ++ pop {r4-r8} ++ bx lr ++endfunc ++ ++function ff_hevc_sao_band_w16_neon_8, export=1 ++ push {r4-r8} ++ ldr r4, [sp, #20] // height ++ ldr r5, [sp, #24] // offset_table ++ vpush {d8-d15} ++ vld1.8 {q0, q1}, [r5] // offset table ++ ++1: subs r4, #1 ++ vld1.8 {q12}, [r1], r3 ++ ++ vshr.u8 q8, q12, #3 ++ ++ vtbl.8 d16, {q0, q1}, d16 ++ vtbl.8 d17, {q0, q1}, d17 ++ ++ vmovl.s8 q2, d16 ++ vmovl.s8 q3, d17 ++ ++ vmovl.u8 q6, d24 ++ vmovl.u8 q7, d25 ++ ++ vadd.s16 q2, q6 ++ vadd.s16 q3, q7 ++ ++ vqmovun.s16 d4, q2 ++ vqmovun.s16 d5, q3 ++ ++ vstm.8 r0, {q2} ++ add r0, r2 ++ bne 1b ++ ++ vpop {d8-d15} ++ pop {r4-r8} ++ bx lr ++endfunc ++ ++function ff_hevc_sao_band_w32_neon_8, export=1 ++ push {r4-r8} ++ ldr r4, [sp, #20] // height ++ ldr r5, [sp, #24] // offset_table ++ vpush {d8-d15} ++ vld1.8 {q0, q1}, [r5] // offset table ++ ++1: subs r4, #1 ++ vld1.8 {q12-q13}, [r1], r3 ++ ++ vshr.u8 q8, q12, #3 ++ vshr.u8 q9, q13, #3 ++ ++ vtbl.8 d16, {q0, q1}, d16 ++ vtbl.8 d17, {q0, q1}, d17 ++ vtbl.8 d18, {q0, q1}, d18 ++ vtbl.8 d19, {q0, q1}, d19 ++ ++ vmovl.s8 q2, d16 ++ vmovl.s8 q3, d17 // q8 free ++ vmovl.s8 q4, d18 ++ vmovl.s8 q5, d19 // q9 free ++ ++ vmovl.u8 q6, d24 ++ vmovl.u8 q7, d25 // q12 free ++ vmovl.u8 q8, d26 ++ vmovl.u8 q9, d27 // q13 free ++ ++ vadd.s16 q2, q6 ++ vadd.s16 q3, q7 ++ vadd.s16 q4, q8 ++ vadd.s16 q5, q9 ++ ++ vqmovun.s16 d4, q2 ++ vqmovun.s16 d5, q3 ++ vqmovun.s16 d6, q4 // q4 free ++ vqmovun.s16 d7, q5 // q5 free ++ ++ vst1.8 {q2-q3}, [r0], r2 ++ bne 1b ++ ++ vpop {d8-d15} ++ pop {r4-r8} ++ bx lr ++endfunc ++ ++function ff_hevc_sao_band_w64_neon_8, export=1 ++ push {r4-r8} ++ ldr r4, [sp, #20] // height ++ ldr r5, [sp, #24] // offset_table ++ vpush {d8-d15} ++ vld1.8 {q0, q1}, [r5] // offset table ++ ++1: subs r4, #1 ++ vld1.8 {q12-q13}, [r1]! ++ vld1.8 {q14-q15}, [r1], r3 ++ sub r1, #32 ++ ++ vshr.u8 q8, q12, #3 ++ vshr.u8 q9, q13, #3 ++ vshr.u8 q10, q14, #3 ++ vshr.u8 q11, q15, #3 ++ ++ vtbl.8 d16, {q0, q1}, d16 ++ vtbl.8 d17, {q0, q1}, d17 ++ vtbl.8 d18, {q0, q1}, d18 ++ vtbl.8 d19, {q0, q1}, d19 ++ vtbl.8 d20, {q0, q1}, d20 ++ vtbl.8 d21, {q0, q1}, d21 ++ vtbl.8 d22, {q0, q1}, d22 ++ vtbl.8 d23, {q0, q1}, d23 ++ ++ vmovl.s8 q2, d16 ++ vmovl.s8 q3, d17 // q8 free ++ vmovl.s8 q4, d18 ++ vmovl.s8 q5, d19 // q9 free ++ ++ vmovl.u8 q6, d24 ++ vmovl.u8 q7, d25 // q12 free ++ vmovl.u8 q8, d26 ++ vmovl.u8 q9, d27 // q13 free ++ ++ vadd.s16 q2, q6 ++ vadd.s16 q3, q7 ++ vadd.s16 q4, q8 ++ vadd.s16 q5, q9 ++ ++ vqmovun.s16 d4, q2 ++ vqmovun.s16 d5, q3 ++ vqmovun.s16 d6, q4 // q4 free ++ vqmovun.s16 d7, q5 // q5 free ++ ++ // free q4 -q9, q12 - q13 ++ vmovl.s8 q4, d20 ++ vmovl.s8 q5, d21 // q10 free ++ vmovl.s8 q6, d22 ++ vmovl.s8 q7, d23 // q11 free ++ ++ vmovl.u8 q8, d28 ++ vmovl.u8 q9, d29 // q14 free ++ vmovl.u8 q10, d30 ++ vmovl.u8 q11, d31 // q15 free ++ ++ vadd.s16 q4, q8 ++ vadd.s16 q5, q9 ++ vadd.s16 q6, q10 ++ vadd.s16 q7, q11 ++ ++ vqmovun.s16 d8, q4 ++ vqmovun.s16 d9, q5 ++ vqmovun.s16 d10, q6 ++ vqmovun.s16 d11, q7 ++ ++ vstm.8 r0, {q2-q5} ++ add r0, r2 ++ bne 1b ++ ++ vpop {d8-d15} ++ pop {r4-r8} ++ bx lr ++endfunc ++ +-- +2.5.0 + + +From 8429b1de64bb871d57651ecfe3b084e2dfe0af51 Mon Sep 17 00:00:00 2001 +From: Seppo Tomperi <seppo.tomperi@vtt.fi> +Date: Wed, 27 May 2015 18:10:20 +0100 +Subject: [PATCH 2/9] added NEON optimized sao edge for eo1 width 64 + +--- + libavcodec/arm/hevcdsp_init_neon.c | 47 ++++++++++++ + libavcodec/arm/hevcdsp_sao_neon.S | 147 +++++++++++++++++++++++++++++++++++++ + 2 files changed, 194 insertions(+) + +diff --git a/libavcodec/arm/hevcdsp_init_neon.c b/libavcodec/arm/hevcdsp_init_neon.c +index 69e2b2c..c7b5404 100644 +--- a/libavcodec/arm/hevcdsp_init_neon.c ++++ b/libavcodec/arm/hevcdsp_init_neon.c +@@ -22,6 +22,7 @@ + #include "libavutil/arm/cpu.h" + #include "libavcodec/hevcdsp.h" + #include "hevcdsp_arm.h" ++#include "libavcodec/avcodec.h" + #include "../bit_depth_template.c" + + void ff_hevc_v_loop_filter_luma_neon(uint8_t *_pix, ptrdiff_t _stride, int _beta, int *_tc, uint8_t *_no_p, uint8_t *_no_q); +@@ -48,6 +49,7 @@ void ff_hevc_sao_band_w8_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_d + void ff_hevc_sao_band_w16_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t * offset_table); + void ff_hevc_sao_band_w32_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t * offset_table); + void ff_hevc_sao_band_w64_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t * offset_table); ++void ff_hevc_sao_edge_eo1_w64_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t *sao_offset_table); + + #define PUT_PIXELS(name) \ + void name(int16_t *dst, uint8_t *src, \ +@@ -195,6 +197,50 @@ static void ff_hevc_sao_band_neon_wrapper(uint8_t *_dst, uint8_t *_src, ptrdiff_ + } + } + ++#define CMP(a, b) ((a) > (b) ? 1 : ((a) == (b) ? 0 : -1)) ++static void ff_hevc_sao_edge_neon_wrapper(uint8_t *_dst /* align 16 */, uint8_t *_src /* align 32 */, ptrdiff_t stride_dst, ++ int16_t *_sao_offset_val, int eo, int width, int height) ++{ ++ static const uint8_t edge_idx[] = { 1, 2, 0, 3, 4 }; ++ static const int8_t pos[4][2][2] = { ++ { { -1, 0 }, { 1, 0 } }, // horizontal ++ { { 0, -1 }, { 0, 1 } }, // vertical ++ { { -1, -1 }, { 1, 1 } }, // 45 degree ++ { { 1, -1 }, { -1, 1 } }, // 135 degree ++ }; ++ int8_t sao_offset_val[8]; // padding of 3 for vld ++ ptrdiff_t stride_src = (2*MAX_PB_SIZE + FF_INPUT_BUFFER_PADDING_SIZE); ++ pixel *dst = (pixel *)_dst; ++ pixel *src = (pixel *)_src; ++ int a_stride, b_stride; ++ int x, y; ++ ++ for (x = 0; x < 5; x++) { ++ sao_offset_val[x] = _sao_offset_val[x]; ++ } ++ ++ stride_src /= sizeof(pixel); ++ stride_dst /= sizeof(pixel); ++ ++ if (eo == 1 && width == 64) { ++ ff_hevc_sao_edge_eo1_w64_neon_8(dst, src, stride_dst, stride_src, height, sao_offset_val); ++ } else { ++ a_stride = pos[eo][0][0] + pos[eo][0][1] * stride_src; ++ b_stride = pos[eo][1][0] + pos[eo][1][1] * stride_src; ++ for (y = 0; y < height; y++) { ++ for (x = 0; x < width; x++) { ++ int diff0 = CMP(src[x], src[x + a_stride]); ++ int diff1 = CMP(src[x], src[x + b_stride]); ++ int offset_val = edge_idx[2 + diff0 + diff1]; ++ dst[x] = av_clip_pixel(src[x] + sao_offset_val[offset_val]); ++ } ++ src += stride_src; ++ dst += stride_dst; ++ } ++ } ++} ++#undef CMP ++ + av_cold void ff_hevcdsp_init_neon(HEVCDSPContext *c, const int bit_depth) + { + if (bit_depth == 8) { +@@ -216,6 +262,7 @@ av_cold void ff_hevcdsp_init_neon(HEVCDSPContext *c, const int bit_depth) + c->idct_4x4_luma = ff_hevc_transform_luma_4x4_neon_8; + for (x = 0; x < sizeof c->sao_band_filter / sizeof *c->sao_band_filter; x++) { + c->sao_band_filter[x] = ff_hevc_sao_band_neon_wrapper; ++ c->sao_edge_filter[x] = ff_hevc_sao_edge_neon_wrapper; + } + put_hevc_qpel_neon[1][0] = ff_hevc_put_qpel_v1_neon_8; + put_hevc_qpel_neon[2][0] = ff_hevc_put_qpel_v2_neon_8; +diff --git a/libavcodec/arm/hevcdsp_sao_neon.S b/libavcodec/arm/hevcdsp_sao_neon.S +index 1f0ad64..5ec2de9 100644 +--- a/libavcodec/arm/hevcdsp_sao_neon.S ++++ b/libavcodec/arm/hevcdsp_sao_neon.S +@@ -202,3 +202,150 @@ function ff_hevc_sao_band_w64_neon_8, export=1 + bx lr + endfunc + ++function ff_hevc_sao_edge_eo1_w64_neon_8, export=1 ++ push {r4-r8} ++ ldr r4, [sp, #20] // height ++ ldr r5, [sp, #24] // sao_offset_val_table ++ ldr r6, =0x02 ++ vpush {d8-d15} ++1: subs r4, #1 ++ // load a ++ sub r1, r3 ++ vld1.8 {q0-q1}, [r1]! ++ vld1.8 {q2-q3}, [r1], r3 ++ sub r1, #32 ++ // load c ++ vld1.8 {q4-q5}, [r1]! ++ vld1.8 {q6-q7}, [r1], r3 ++ sub r1, #32 ++ // load b ++ vld1.8 {q8-q9}, [r1]! ++ vld1.8 {q10-q11}, [r1], r3 ++ sub r1, #32 ++ ++ vcgt.u8 q12, q4, q0 // c > a -> -1 , otherwise 0 ++ vcgt.u8 q0, q0, q4 // a > c -> -1 , otherwise 0 ++ vcgt.u8 q13, q5, q1 ++ vcgt.u8 q1, q1, q5 ++ vcgt.u8 q14, q6, q2 ++ vcgt.u8 q2, q2, q6 ++ vcgt.u8 q15, q7, q3 ++ vcgt.u8 q3, q3, q7 ++ ++ vsub.s8 q12, q0, q12 // diff0 ++ vsub.s8 q13, q1, q13 ++ vsub.s8 q14, q2, q14 ++ vsub.s8 q15, q3, q15 ++ ++ vcgt.u8 q0, q4, q8 // c > b ++ vcgt.u8 q8, q8, q4 // b > c ++ vcgt.u8 q1, q5, q9 ++ vcgt.u8 q9, q9, q5 ++ vcgt.u8 q2, q6, q10 ++ vcgt.u8 q10, q10, q6 ++ vcgt.u8 q3, q7, q11 ++ vcgt.u8 q11, q11, q7 ++ ++ vsub.s8 q0, q8, q0 // diff1 ++ vsub.s8 q1, q9, q1 ++ vsub.s8 q2, q10, q2 ++ vsub.s8 q3, q11, q3 ++ ++ veor.u8 q8, q8 // zero register ++ vdup.s8 q9, r6 // 2 to all elements ++ add r6, #1 ++ vdup.s8 q10, r6 // 3 to all elements ++ sub r6, #1 ++ ++ vadd.s8 q0, q12 //diff0 + diff1 ++ vadd.s8 q1, q13 ++ vadd.s8 q2, q14 ++ vadd.s8 q3, q15 ++ ++ vcgt.s8 q4, q0, q8 // diff0 + diff1 > 0 ++ vcgt.s8 q5, q1, q8 ++ vcgt.s8 q6, q2, q8 ++ vcgt.s8 q7, q3, q8 ++ ++ vclt.s8 q11, q0, q8 // diff0 + diff1 < 0 ++ vclt.s8 q12, q1, q8 ++ vclt.s8 q13, q2, q8 ++ vclt.s8 q14, q3, q8 ++ ++ vadd.s8 q8, q0, q9 // diff0 + diff1 + 2 ++ vand.8 q15, q8, q4 ++ vadd.s8 q8, q0, q10 // diff0 + diff1 + 3 ++ vand.8 q8, q8, q11 ++ vadd.s8 q0, q15, q8 // offset_idx ++ ++ vadd.s8 q8, q1, q9 // diff0 + diff1 + 2 ++ vand.8 q15, q8, q5 ++ vadd.s8 q8, q1, q10 // diff0 + diff1 + 3 ++ vand.8 q8, q8, q12 ++ vadd.s8 q1, q15, q8 // offset_idx ++ ++ vadd.s8 q8, q2, q9 // diff0 + diff1 + 2 + 2 ++ vand.8 q15, q8, q6 ++ vadd.s8 q8, q2, q10 // diff0 + diff1 + 2 + 3 ++ vand.8 q8, q8, q13 ++ vadd.s8 q2, q15, q8 // offset_idx ++ ++ vadd.s8 q8, q3, q9 // diff0 + diff1 + 2 + 2 ++ vand.8 q15, q8, q7 ++ vadd.s8 q8, q3, q10 // diff0 + diff1 + 2 + 3 ++ vand.8 q8, q8, q14 ++ vadd.s8 q3, q15, q8 // offset_idx ++ // TODO: load only once ++ vld1.8 d16, [r5] ++ ++ vtbl.8 d0, {d16}, d0 ++ vtbl.8 d1, {d16}, d1 ++ vtbl.8 d2, {d16}, d2 ++ vtbl.8 d3, {d16}, d3 ++ vtbl.8 d4, {d16}, d4 ++ vtbl.8 d5, {d16}, d5 ++ vtbl.8 d6, {d16}, d6 ++ vtbl.8 d7, {d16}, d7 ++ ++ // TODO: load only once ++ // load c again ++ sub r1, r3 ++ sub r1, r3 ++ vld1.8 {q4-q5}, [r1]! ++ vld1.8 {q6-q7}, [r1], r3 ++ sub r1, #32 ++ ++ vmovl.u8 q8, d8 ++ vmovl.u8 q9, d9 ++ vmovl.u8 q10, d10 ++ vmovl.u8 q11, d11 ++ vmovl.u8 q12, d12 ++ vmovl.u8 q13, d13 ++ vmovl.u8 q14, d14 ++ vmovl.u8 q15, d15 ++ ++ vaddw.s8 q8, d0 ++ vaddw.s8 q9, d1 ++ vaddw.s8 q10, d2 ++ vaddw.s8 q11, d3 ++ vaddw.s8 q12, d4 ++ vaddw.s8 q13, d5 ++ vaddw.s8 q14, d6 ++ vaddw.s8 q15, d7 ++ ++ vqmovun.s16 d0, q8 ++ vqmovun.s16 d1, q9 ++ vqmovun.s16 d2, q10 ++ vqmovun.s16 d3, q11 ++ vqmovun.s16 d4, q12 ++ vqmovun.s16 d5, q13 ++ vqmovun.s16 d6, q14 ++ vqmovun.s16 d7, q15 ++ ++ vstm r0, {q0-q3} ++ add r0, r2 ++ bne 1b ++ vpop {d8-d15} ++ pop {r4-r8} ++ bx lr ++endfunc +-- +2.5.0 + + +From 402e2bd1c5ad659c757bf9734abe6331904fb9e2 Mon Sep 17 00:00:00 2001 +From: Seppo Tomperi <seppo.tomperi@vtt.fi> +Date: Tue, 16 Dec 2014 16:28:25 +0200 +Subject: [PATCH 3/9] Added SAO edge offset for ARM NEON w32 and w64 + +--- + libavcodec/arm/hevcdsp_init_neon.c | 46 +++- + libavcodec/arm/hevcdsp_sao_neon.S | 510 +++++++++++++++++++++++++++++++------ + 2 files changed, 474 insertions(+), 82 deletions(-) + +diff --git a/libavcodec/arm/hevcdsp_init_neon.c b/libavcodec/arm/hevcdsp_init_neon.c +index c7b5404..c32940e 100644 +--- a/libavcodec/arm/hevcdsp_init_neon.c ++++ b/libavcodec/arm/hevcdsp_init_neon.c +@@ -49,7 +49,16 @@ void ff_hevc_sao_band_w8_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_d + void ff_hevc_sao_band_w16_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t * offset_table); + void ff_hevc_sao_band_w32_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t * offset_table); + void ff_hevc_sao_band_w64_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t * offset_table); ++ ++void ff_hevc_sao_edge_eo0_w32_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t *sao_offset_table); ++void ff_hevc_sao_edge_eo1_w32_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t *sao_offset_table); ++void ff_hevc_sao_edge_eo2_w32_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t *sao_offset_table); ++void ff_hevc_sao_edge_eo3_w32_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t *sao_offset_table); ++ ++void ff_hevc_sao_edge_eo0_w64_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t *sao_offset_table); + void ff_hevc_sao_edge_eo1_w64_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t *sao_offset_table); ++void ff_hevc_sao_edge_eo2_w64_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t *sao_offset_table); ++void ff_hevc_sao_edge_eo3_w64_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t *sao_offset_table); + + #define PUT_PIXELS(name) \ + void name(int16_t *dst, uint8_t *src, \ +@@ -222,9 +231,40 @@ static void ff_hevc_sao_edge_neon_wrapper(uint8_t *_dst /* align 16 */, uint8_t + stride_src /= sizeof(pixel); + stride_dst /= sizeof(pixel); + +- if (eo == 1 && width == 64) { +- ff_hevc_sao_edge_eo1_w64_neon_8(dst, src, stride_dst, stride_src, height, sao_offset_val); +- } else { ++ switch (width) { ++ case 32: ++ switch(eo) { ++ case 0: ++ ff_hevc_sao_edge_eo0_w32_neon_8(dst, src, stride_dst, stride_src, height, sao_offset_val); ++ break; ++ case 1: ++ ff_hevc_sao_edge_eo1_w32_neon_8(dst, src, stride_dst, stride_src, height, sao_offset_val); ++ break; ++ case 2: ++ ff_hevc_sao_edge_eo2_w32_neon_8(dst, src, stride_dst, stride_src, height, sao_offset_val); ++ break; ++ case 3: ++ ff_hevc_sao_edge_eo3_w32_neon_8(dst, src, stride_dst, stride_src, height, sao_offset_val); ++ break; ++ } ++ break; ++ case 64: ++ switch(eo) { ++ case 0: ++ ff_hevc_sao_edge_eo0_w64_neon_8(dst, src, stride_dst, stride_src, height, sao_offset_val); ++ break; ++ case 1: ++ ff_hevc_sao_edge_eo1_w64_neon_8(dst, src, stride_dst, stride_src, height, sao_offset_val); ++ break; ++ case 2: ++ ff_hevc_sao_edge_eo2_w64_neon_8(dst, src, stride_dst, stride_src, height, sao_offset_val); ++ break; ++ case 3: ++ ff_hevc_sao_edge_eo3_w64_neon_8(dst, src, stride_dst, stride_src, height, sao_offset_val); ++ break; ++ } ++ break; ++ default: + a_stride = pos[eo][0][0] + pos[eo][0][1] * stride_src; + b_stride = pos[eo][1][0] + pos[eo][1][1] * stride_src; + for (y = 0; y < height; y++) { +diff --git a/libavcodec/arm/hevcdsp_sao_neon.S b/libavcodec/arm/hevcdsp_sao_neon.S +index 5ec2de9..4687012 100644 +--- a/libavcodec/arm/hevcdsp_sao_neon.S ++++ b/libavcodec/arm/hevcdsp_sao_neon.S +@@ -202,27 +202,7 @@ function ff_hevc_sao_band_w64_neon_8, export=1 + bx lr + endfunc + +-function ff_hevc_sao_edge_eo1_w64_neon_8, export=1 +- push {r4-r8} +- ldr r4, [sp, #20] // height +- ldr r5, [sp, #24] // sao_offset_val_table +- ldr r6, =0x02 +- vpush {d8-d15} +-1: subs r4, #1 +- // load a +- sub r1, r3 +- vld1.8 {q0-q1}, [r1]! +- vld1.8 {q2-q3}, [r1], r3 +- sub r1, #32 +- // load c +- vld1.8 {q4-q5}, [r1]! +- vld1.8 {q6-q7}, [r1], r3 +- sub r1, #32 +- // load b +- vld1.8 {q8-q9}, [r1]! +- vld1.8 {q10-q11}, [r1], r3 +- sub r1, #32 +- ++.macro edge_w64_body + vcgt.u8 q12, q4, q0 // c > a -> -1 , otherwise 0 + vcgt.u8 q0, q0, q4 // a > c -> -1 , otherwise 0 + vcgt.u8 q13, q5, q1 +@@ -251,69 +231,61 @@ function ff_hevc_sao_edge_eo1_w64_neon_8, export=1 + vsub.s8 q2, q10, q2 + vsub.s8 q3, q11, q3 + +- veor.u8 q8, q8 // zero register +- vdup.s8 q9, r6 // 2 to all elements +- add r6, #1 +- vdup.s8 q10, r6 // 3 to all elements +- sub r6, #1 +- + vadd.s8 q0, q12 //diff0 + diff1 + vadd.s8 q1, q13 + vadd.s8 q2, q14 + vadd.s8 q3, q15 + +- vcgt.s8 q4, q0, q8 // diff0 + diff1 > 0 +- vcgt.s8 q5, q1, q8 +- vcgt.s8 q6, q2, q8 +- vcgt.s8 q7, q3, q8 +- +- vclt.s8 q11, q0, q8 // diff0 + diff1 < 0 +- vclt.s8 q12, q1, q8 +- vclt.s8 q13, q2, q8 +- vclt.s8 q14, q3, q8 +- +- vadd.s8 q8, q0, q9 // diff0 + diff1 + 2 +- vand.8 q15, q8, q4 +- vadd.s8 q8, q0, q10 // diff0 + diff1 + 3 +- vand.8 q8, q8, q11 +- vadd.s8 q0, q15, q8 // offset_idx +- +- vadd.s8 q8, q1, q9 // diff0 + diff1 + 2 +- vand.8 q15, q8, q5 +- vadd.s8 q8, q1, q10 // diff0 + diff1 + 3 +- vand.8 q8, q8, q12 +- vadd.s8 q1, q15, q8 // offset_idx +- +- vadd.s8 q8, q2, q9 // diff0 + diff1 + 2 + 2 +- vand.8 q15, q8, q6 +- vadd.s8 q8, q2, q10 // diff0 + diff1 + 2 + 3 +- vand.8 q8, q8, q13 +- vadd.s8 q2, q15, q8 // offset_idx +- +- vadd.s8 q8, q3, q9 // diff0 + diff1 + 2 + 2 +- vand.8 q15, q8, q7 +- vadd.s8 q8, q3, q10 // diff0 + diff1 + 2 + 3 +- vand.8 q8, q8, q14 +- vadd.s8 q3, q15, q8 // offset_idx +- // TODO: load only once +- vld1.8 d16, [r5] +- +- vtbl.8 d0, {d16}, d0 +- vtbl.8 d1, {d16}, d1 +- vtbl.8 d2, {d16}, d2 +- vtbl.8 d3, {d16}, d3 +- vtbl.8 d4, {d16}, d4 +- vtbl.8 d5, {d16}, d5 +- vtbl.8 d6, {d16}, d6 +- vtbl.8 d7, {d16}, d7 +- +- // TODO: load only once +- // load c again +- sub r1, r3 +- sub r1, r3 +- vld1.8 {q4-q5}, [r1]! +- vld1.8 {q6-q7}, [r1], r3 +- sub r1, #32 ++ vdup.s8 q9, r6 // 3 to all elements ++ sub r6, #1 ++ ++ vclt.s8 q12, q0, #0 // diff0 + diff1 < 0 ++ vclt.s8 q13, q1, #0 ++ vclt.s8 q14, q2, #0 ++ vclt.s8 q15, q3, #0 ++ ++ vadd.s8 q8, q0, q9 // diff0 + diff1 + 3 ++ vadd.s8 q10, q1, q9 ++ vand.8 q12, q8, q12 // if (diff0 + diff1 < 0) then (diff0 + diff1 + 3) else 0 ++ vand.8 q13, q10, q13 ++ vadd.s8 q8, q2, q9 ++ vadd.s8 q10, q3, q9 ++ vand.8 q14, q8, q14 ++ vand.8 q15, q10, q15 ++ ++ vdup.s8 q9, r6 // 2 to all elements ++ add r6, #1 ++ ++ vcgt.s8 q10, q0, #0 // diff0 + diff1 > 0 ++ vadd.s8 q8, q0, q9 // diff0 + diff1 + 2 ++ vand.8 q11, q8, q10 // if (diff0 + diff1 > 0) then (diff0 + diff1 + 2) else 0 ++ vcgt.s8 q10, q1, #0 ++ vadd.s8 q0, q11, q12 // offset_idx ++ ++ vadd.s8 q8, q1, q9 // diff0 + diff1 + 2 ++ vcgt.s8 q12, q2, #0 ++ vand.8 q11, q8, q10 // if (diff0 + diff1 > 0) then (diff0 + diff1 + 2) else 0 ++ vadd.s8 q8, q2, q9 // diff0 + diff1 + 2 ++ vadd.s8 q1, q11, q13 ++ ++ vand.8 q11, q8, q12 // if (diff0 + diff1 > 0) then (diff0 + diff1 + 2) else 0 ++ vcgt.s8 q10, q3, #0 ++ vadd.s8 q2, q11, q14 ++ ++ vadd.s8 q8, q3, q9 // diff0 + diff1 + 2 ++ vmov.32 d18[0], r7 // load offset table from general registers ++ vand.8 q11, q8, q10 // if (diff0 + diff1 > 0) then (diff0 + diff1 + 2) else 0 ++ vmov.32 d18[1], r5 // load rest of offset table ++ vadd.s8 q3, q11, q15 ++ ++ vtbl.8 d0, {d18}, d0 ++ vtbl.8 d1, {d18}, d1 ++ vtbl.8 d2, {d18}, d2 ++ vtbl.8 d3, {d18}, d3 ++ vtbl.8 d4, {d18}, d4 ++ vtbl.8 d5, {d18}, d5 ++ vtbl.8 d6, {d18}, d6 ++ vtbl.8 d7, {d18}, d7 + + vmovl.u8 q8, d8 + vmovl.u8 q9, d9 +@@ -344,8 +316,388 @@ function ff_hevc_sao_edge_eo1_w64_neon_8, export=1 + + vstm r0, {q0-q3} + add r0, r2 ++.endm ++ ++.macro edge_w32_body ++ vcgt.u8 q12, q4, q0 // c > a -> -1 , otherwise 0 ++ vcgt.u8 q0, q0, q4 // a > c -> -1 , otherwise 0 ++ vcgt.u8 q13, q5, q1 ++ vcgt.u8 q1, q1, q5 ++ ++ vsub.s8 q12, q0, q12 // diff0 ++ vcgt.u8 q0, q4, q8 // c > b ++ vsub.s8 q13, q1, q13 // diff0 part 2 ++ ++ vcgt.u8 q6, q8, q4 // b > c ++ vcgt.u8 q1, q5, q9 ++ vcgt.u8 q7, q9, q5 ++ ++ vsub.s8 q0, q6, q0 // diff1 ++ vsub.s8 q1, q7, q1 // diff1 part 2 ++ vadd.s8 q0, q12 //diff0 + diff1 ++ ++ vdup.s8 q7, r6 // 3 to all elements ++ sub r6, #1 ++ vadd.s8 q1, q13 ++ ++ vclt.s8 q12, q0, #0 // diff0 + diff1 < 0 ++ vclt.s8 q13, q1, #0 ++ ++ vadd.s8 q6, q0, q7 // diff0 + diff1 + 3 ++ vadd.s8 q10, q1, q7 ++ vdup.s8 q7, r6 // 2 to all elements ++ add r6, #1 ++ vand.8 q12, q6, q12 // if (diff0 + diff1 < 0) then (diff0 + diff1 + 3) else 0 ++ vand.8 q13, q10, q13 ++ ++ ++ vcgt.s8 q10, q0, #0 // diff0 + diff1 > 0 ++ vadd.s8 q6, q0, q7 // diff0 + diff1 + 2 ++ vand.8 q11, q6, q10 // if (diff0 + diff1 > 0) then (diff0 + diff1 + 2) else 0 ++ vcgt.s8 q10, q1, #0 ++ vadd.s8 q0, q11, q12 // offset_idx ++ ++ vadd.s8 q6, q1, q7 // diff0 + diff1 + 2 ++ vmov.32 d14[0], r7 // load offset table from general registers ++ vand.8 q11, q6, q10 // if (diff0 + diff1 > 0) then (diff0 + diff1 + 2) else 0 ++ vmov.32 d14[1], r5 // load rest of offset table ++ vadd.s8 q1, q11, q13 ++ ++ vtbl.8 d0, {d14}, d0 ++ vtbl.8 d1, {d14}, d1 ++ vtbl.8 d2, {d14}, d2 ++ vtbl.8 d3, {d14}, d3 ++ ++ vmovl.u8 q6, d8 ++ vmovl.u8 q7, d9 ++ vmovl.u8 q10, d10 ++ vmovl.u8 q11, d11 ++ ++ vaddw.s8 q6, d0 ++ vaddw.s8 q7, d1 ++ vaddw.s8 q10, d2 ++ vaddw.s8 q11, d3 ++ ++ vqmovun.s16 d0, q6 ++ vqmovun.s16 d1, q7 ++ vqmovun.s16 d2, q10 ++ vqmovun.s16 d3, q11 ++ ++ vstm r0, {q0-q1} ++ add r0, r2 ++.endm ++ ++function ff_hevc_sao_edge_eo0_w64_neon_8, export=1 ++ push {r4-r8} ++ ldr r4, [sp, #20] // height ++ ldr r5, [sp, #24] // sao_offset_val_table ++ ldr r6, =0x03 ++ ldr r7, [r5] ++ add r5, #4 ++ ldr r5, [r5] ++ vpush {d8-d15} ++ sub r1, #8 ++1: subs r4, #1 ++ vld1.64 {q10-q11}, [r1]! ++ vld1.64 {q12-q13}, [r1]! ++ vld1.64 {q14}, [r1], r3 ++ sub r1, #64 ++ // load a ++ vext.8 q0, q10, q11, #7 ++ vext.8 q1, q11, q12, #7 ++ vext.8 q2, q12, q13, #7 ++ vext.8 q3, q13, q14, #7 ++ // load c ++ vext.8 q4, q10, q11, #8 ++ vext.8 q5, q11, q12, #8 ++ vext.8 q6, q12, q13, #8 ++ vext.8 q7, q13, q14, #8 ++ // load b ++ vext.8 q8, q10, q11, #9 ++ vext.8 q9, q11, q12, #9 ++ vext.8 q10, q12, q13, #9 ++ vext.8 q11, q13, q14, #9 ++ edge_w64_body ++ bne 1b ++ vpop {d8-d15} ++ pop {r4-r8} ++ bx lr ++endfunc ++ ++function ff_hevc_sao_edge_eo1_w64_neon_8, export=1 ++ push {r4-r8} ++ ldr r4, [sp, #20] // height ++ ldr r5, [sp, #24] // sao_offset_val_table ++ ldr r6, =0x03 ++ ldr r7, [r5] ++ add r5, #4 ++ ldr r5, [r5] ++ vpush {d8-d15} ++ sub r1, r3 ++ // load a ++ vld1.8 {q0-q1}, [r1]! ++ vld1.8 {q2-q3}, [r1], r3 ++ sub r1, #32 ++1: subs r4, #1 ++ // load c ++ vld1.8 {q4-q5}, [r1]! ++ vld1.8 {q6-q7}, [r1], r3 ++ sub r1, #32 ++ // load b ++ vld1.8 {q8-q9}, [r1]! ++ vld1.8 {q10-q11}, [r1] ++ sub r1, #32 ++ edge_w64_body ++ // copy c to a ++ vmov.64 q0, q4 ++ vmov.64 q1, q5 ++ vmov.64 q2, q6 ++ vmov.64 q3, q7 + bne 1b + vpop {d8-d15} + pop {r4-r8} + bx lr + endfunc ++ ++function ff_hevc_sao_edge_eo2_w64_neon_8, export=1 ++ push {r4-r8} ++ ldr r4, [sp, #20] // height ++ ldr r5, [sp, #24] // sao_offset_val_table ++ ldr r6, =0x03 ++ ldr r7, [r5] ++ add r5, #4 ++ ldr r5, [r5] ++ vpush {d8-d15} ++1: sub r1, r3 ++ // load a ++ // TODO: fix unaligned load ++ // don't reload a like in eo1 ++ sub r1, #1 ++ vld1.8 {q0-q1}, [r1]! ++ vld1.8 {q2-q3}, [r1], r3 ++ sub r1, #31 ++ subs r4, #1 ++ // load c ++ vld1.8 {q4-q5}, [r1]! ++ vld1.8 {q6-q7}, [r1], r3 ++ sub r1, #32 ++ // load b ++ add r1, #1 ++ vld1.8 {q8-q9}, [r1]! ++ vld1.8 {q10-q11}, [r1] ++ sub r1, #33 ++ edge_w64_body ++ // copy c to a ++ vmov.64 q0, q4 ++ vmov.64 q1, q5 ++ vmov.64 q2, q6 ++ vmov.64 q3, q7 ++ bne 1b ++ vpop {d8-d15} ++ pop {r4-r8} ++ bx lr ++endfunc ++ ++function ff_hevc_sao_edge_eo3_w64_neon_8, export=1 ++ push {r4-r8} ++ ldr r4, [sp, #20] // height ++ ldr r5, [sp, #24] // sao_offset_val_table ++ ldr r6, =0x03 ++ ldr r7, [r5] ++ add r5, #4 ++ ldr r5, [r5] ++ vpush {d8-d15} ++1: sub r1, r3 ++ // load a ++ // TODO: fix unaligned load ++ // don't reload a like in eo1 ++ add r1, #1 ++ vld1.8 {q0-q1}, [r1]! ++ vld1.8 {q2-q3}, [r1], r3 ++ sub r1, #33 ++ subs r4, #1 ++ // load c ++ vld1.8 {q4-q5}, [r1]! ++ vld1.8 {q6-q7}, [r1], r3 ++ sub r1, #32 ++ // load b ++ sub r1, #1 ++ vld1.8 {q8-q9}, [r1]! ++ vld1.8 {q10-q11}, [r1] ++ sub r1, #31 ++ edge_w64_body ++ // copy c to a ++ vmov.64 q0, q4 ++ vmov.64 q1, q5 ++ vmov.64 q2, q6 ++ vmov.64 q3, q7 ++ bne 1b ++ vpop {d8-d15} ++ pop {r4-r8} ++ bx lr ++endfunc ++ ++function ff_hevc_sao_edge_eo0_w32_neon_8, export=1 ++ push {r4-r8} ++ ldr r4, [sp, #20] // height ++ ldr r5, [sp, #24] // sao_offset_val_table ++ ldr r6, =0x03 ++ ldr r7, [r5] ++ add r5, #4 ++ ldr r5, [r5] ++ vpush {d8-d15} ++ sub r1, #8 // load 8 extra bytes ++1: subs r4, #1 ++ vld1.8 {q10-q11}, [r1] ++ add r1, #32 ++ vld1.8 {q12}, [r1], r3 // only first 9 bytes are used ++ sub r1, #32 ++ // a ++ vext.8 q0, q10, q11, #7 ++ vext.8 q1, q11, q12, #7 ++ // c ++ vext.8 q4, q10, q11, #8 ++ vext.8 q5, q11, q12, #8 ++ // b ++ vext.8 q8, q10, q11, #9 ++ vext.8 q9, q11, q12, #9 ++ edge_w32_body ++ bne 1b ++ vpop {d8-d15} ++ pop {r4-r8} ++ bx lr ++endfunc ++ ++function ff_hevc_sao_edge_eo1_w32_neon_8, export=1 ++ push {r4-r8} ++ ldr r4, [sp, #20] // height ++ ldr r5, [sp, #24] // sao_offset_val_table ++ ldr r6, =0x03 ++ ldr r7, [r5] ++ add r5, #4 ++ ldr r5, [r5] ++ vpush {d8-d15} ++ // load a ++ sub r1, r3 ++ vld1.8 {q0-q1}, [r1], r3 ++ // load c ++ vld1.8 {q4-q5}, [r1], r3 ++1: subs r4, #1 ++ // load b ++ vld1.8 {q8-q9}, [r1], r3 ++ edge_w32_body ++ // inputs for next loop iteration ++ // a ++ vmov.64 q0, q4 ++ vmov.64 q1, q5 ++ // c ++ vmov.64 q4, q8 ++ vmov.64 q5, q9 ++ bne 1b ++ vpop {d8-d15} ++ pop {r4-r8} ++ bx lr ++endfunc ++ ++function ff_hevc_sao_edge_eo2_w32_neon_8, export=1 ++ push {r4-r8} ++ ldr r4, [sp, #20] // height ++ ldr r5, [sp, #24] // sao_offset_val_table ++ ldr r6, =0x03 ++ ldr r7, [r5] ++ add r5, #4 ++ ldr r5, [r5] ++ vpush {d8-d15} ++ // load a ++ sub r1, r3 ++ sub r1, #8 ++ vld1.8 {q10-q11}, [r1] ++ add r1, #32 ++ vld1.8 {q12}, [r1], r3 ++ sub r1, #32 ++ vext.8 q0, q10, q11, #7 ++ vext.8 q1, q11, q12, #7 ++ // load c ++ vld1.8 {q10-q11}, [r1] ++ add r1, #32 ++ vld1.8 {q12}, [r1], r3 ++ sub r1, #32 ++ vext.8 q4, q10, q11, #8 ++ vext.8 q5, q11, q12, #8 ++ vext.8 q2, q10, q11, #7 ++1: subs r4, #1 ++ // load b ++ vld1.8 {q10-q11}, [r1] ++ add r1, #32 ++ vld1.8 {q12}, [r1], r3 ++ sub r1, #32 ++ vext.8 q8, q10, q11, #9 ++ vext.8 q9, q11, q12, #9 ++ vext.8 q14, q10, q11, #8 ++ vext.8 q15, q11, q12, #8 ++ vext.8 q3, q10, q11, #7 ++ edge_w32_body ++ // inputs for next loop iteration ++ // a ++ vmov.8 q0, q2 ++ vext.8 q1, q4, q5, #15 ++ // c ++ vmov.8 q4, q14 ++ vmov.8 q5, q15 ++ vmov.8 q2, q3 ++ bne 1b ++ vpop {d8-d15} ++ pop {r4-r8} ++ bx lr ++endfunc ++ ++function ff_hevc_sao_edge_eo3_w32_neon_8, export=1 ++ push {r4-r8} ++ ldr r4, [sp, #20] // height ++ ldr r5, [sp, #24] // sao_offset_val_table ++ ldr r6, =0x03 ++ ldr r7, [r5] ++ add r5, #4 ++ sub r1, r3 ++ ldr r5, [r5] ++ sub r1, #8 ++ vpush {d8-d15} ++ // load a ++ vld1.8 {q10-q11}, [r1] ++ add r1, #32 ++ vld1.8 {q12}, [r1], r3 ++ sub r1, #32 ++ vext.8 q0, q10, q11, #9 ++ vext.8 q1, q11, q12, #9 ++ // load c ++ vld1.8 {q10-q11}, [r1] ++ add r1, #32 ++ vld1.8 {q12}, [r1], r3 ++ sub r1, #32 ++ vext.8 q4, q10, q11, #8 ++ vext.8 q5, q11, q12, #8 ++ vext.8 q2, q12, q11, #8 ++1: subs r4, #1 ++ // load b ++ vld1.8 {q10-q11}, [r1] ++ add r1, #32 ++ vld1.8 {q12}, [r1], r3 ++ sub r1, #32 ++ vext.8 q8, q10, q11, #7 ++ vext.8 q9, q11, q12, #7 ++ vext.8 q3, q12, q10, #7 ++ edge_w32_body ++ // inputs for next loop iteration ++ // a ++ vext.8 q0, q4, q5, #1 ++ vext.8 q1, q5, q2, #1 ++ // c ++ vext.8 q4, q8, q9, #1 ++ vext.8 q5, q9, q3, #1 ++ vext.8 q2, q3, q1, #1 ++ bne 1b ++ vpop {d8-d15} ++ pop {r4-r8} ++ bx lr ++endfunc ++ +-- +2.5.0 + + +From 1898d052a73370166d57e17cc7c52b7275887df3 Mon Sep 17 00:00:00 2001 +From: Seppo Tomperi <seppo.tomperi@vtt.fi> +Date: Fri, 19 Dec 2014 09:44:10 +0200 +Subject: [PATCH 4/9] Improved SAO band NEON opimizations made SAO buffer 16 + byte aligned added alignment hints to loads and stores optimized register + usage in SAO band neon assembly + +--- + libavcodec/arm/hevcdsp_sao_neon.S | 212 +++++++++++++++----------------------- + 1 file changed, 82 insertions(+), 130 deletions(-) + +diff --git a/libavcodec/arm/hevcdsp_sao_neon.S b/libavcodec/arm/hevcdsp_sao_neon.S +index 4687012..ac21013 100644 +--- a/libavcodec/arm/hevcdsp_sao_neon.S ++++ b/libavcodec/arm/hevcdsp_sao_neon.S +@@ -22,120 +22,84 @@ + #include "neon.S" + + function ff_hevc_sao_band_w8_neon_8, export=1 +- push {r4-r8} +- ldr r4, [sp, #20] // height +- ldr r5, [sp, #24] // offset_table +- vpush {d8-d15} +- vld1.8 {q0, q1}, [r5] // offset table ++ ldr r12, [sp, #4] // offset_table address ++ vld1.8 {q0, q1}, [r12] // offset table ++ ldr r12, [sp, #0] // height + +-1: subs r4, #1 +- vld1.8 {d24}, [r1], r3 ++1: subs r12, #1 ++ vld1.8 {d24}, [r1,:64], r3 + vshr.u8 d16, d24, #3 + vtbl.8 d16, {q0, q1}, d16 +- vmovl.s8 q2, d16 + vmovl.u8 q6, d24 +- vadd.s16 q2, q6 ++ vaddw.s8 q6, d16 + vqmovun.s16 d4, q2 +- vst1.8 {d4}, [r0], r2 ++ vst1.8 {d4}, [r0,:64], r2 + bne 1b + +- vpop {d8-d15} +- pop {r4-r8} + bx lr + endfunc + + function ff_hevc_sao_band_w16_neon_8, export=1 +- push {r4-r8} +- ldr r4, [sp, #20] // height +- ldr r5, [sp, #24] // offset_table +- vpush {d8-d15} +- vld1.8 {q0, q1}, [r5] // offset table +- +-1: subs r4, #1 +- vld1.8 {q12}, [r1], r3 ++ ldr r12, [sp, #4] // offset_table address ++ vld1.8 {q0, q1}, [r12] // offset table ++ ldr r12, [sp, #0] // height + ++1: subs r12, #1 ++ vld1.8 {q12}, [r1,:128], r3 + vshr.u8 q8, q12, #3 +- + vtbl.8 d16, {q0, q1}, d16 + vtbl.8 d17, {q0, q1}, d17 +- +- vmovl.s8 q2, d16 +- vmovl.s8 q3, d17 +- +- vmovl.u8 q6, d24 +- vmovl.u8 q7, d25 +- +- vadd.s16 q2, q6 +- vadd.s16 q3, q7 +- +- vqmovun.s16 d4, q2 +- vqmovun.s16 d5, q3 +- +- vstm.8 r0, {q2} +- add r0, r2 ++ vmovl.u8 q10, d24 ++ vmovl.u8 q11, d25 ++ vaddw.s8 q10, d16 ++ vaddw.s8 q11, d17 ++ vqmovun.s16 d4, q10 ++ vqmovun.s16 d5, q11 ++ vst1.8 {q2}, [r0,:128], r2 + bne 1b + +- vpop {d8-d15} +- pop {r4-r8} + bx lr + endfunc + + function ff_hevc_sao_band_w32_neon_8, export=1 +- push {r4-r8} +- ldr r4, [sp, #20] // height +- ldr r5, [sp, #24] // offset_table +- vpush {d8-d15} +- vld1.8 {q0, q1}, [r5] // offset table +- +-1: subs r4, #1 +- vld1.8 {q12-q13}, [r1], r3 +- +- vshr.u8 q8, q12, #3 +- vshr.u8 q9, q13, #3 +- +- vtbl.8 d16, {q0, q1}, d16 +- vtbl.8 d17, {q0, q1}, d17 +- vtbl.8 d18, {q0, q1}, d18 +- vtbl.8 d19, {q0, q1}, d19 +- +- vmovl.s8 q2, d16 +- vmovl.s8 q3, d17 // q8 free +- vmovl.s8 q4, d18 +- vmovl.s8 q5, d19 // q9 free +- +- vmovl.u8 q6, d24 +- vmovl.u8 q7, d25 // q12 free +- vmovl.u8 q8, d26 +- vmovl.u8 q9, d27 // q13 free +- +- vadd.s16 q2, q6 +- vadd.s16 q3, q7 +- vadd.s16 q4, q8 +- vadd.s16 q5, q9 +- +- vqmovun.s16 d4, q2 +- vqmovun.s16 d5, q3 +- vqmovun.s16 d6, q4 // q4 free +- vqmovun.s16 d7, q5 // q5 free +- +- vst1.8 {q2-q3}, [r0], r2 +- bne 1b +- +- vpop {d8-d15} +- pop {r4-r8} +- bx lr ++ ldr r12, [sp, #4] // offset_table address ++ vld1.8 {q0, q1}, [r12] // offset table ++ ldr r12, [sp, #0] // height ++ ++1: subs r12, #1 ++ vld1.8 {q2-q3}, [r1,:128], r3 ++ vshr.u8 q8, q2, #3 ++ vshr.u8 q9, q3, #3 ++ vtbl.8 d16, {q0, q1}, d16 ++ vtbl.8 d17, {q0, q1}, d17 ++ vtbl.8 d18, {q0, q1}, d18 ++ vtbl.8 d19, {q0, q1}, d19 ++ vmovl.u8 q12, d4 ++ vmovl.u8 q13, d5 ++ vmovl.u8 q14, d6 ++ vmovl.u8 q15, d7 ++ vaddw.s8 q12, d16 ++ vaddw.s8 q13, d17 ++ vaddw.s8 q14, d18 ++ vaddw.s8 q15, d19 ++ vqmovun.s16 d4, q12 ++ vqmovun.s16 d5, q13 ++ vqmovun.s16 d6, q14 ++ vqmovun.s16 d7, q15 ++ vst1.8 {q2-q3}, [r0,:128], r2 ++ bne 1b ++ ++ bx lr + endfunc + + function ff_hevc_sao_band_w64_neon_8, export=1 +- push {r4-r8} +- ldr r4, [sp, #20] // height +- ldr r5, [sp, #24] // offset_table +- vpush {d8-d15} +- vld1.8 {q0, q1}, [r5] // offset table ++ ldr r12, [sp, #4] // offset_table address ++ vld1.8 {q0, q1}, [r12] // offset table ++ ldr r12, [sp, #0] // height + +-1: subs r4, #1 +- vld1.8 {q12-q13}, [r1]! +- vld1.8 {q14-q15}, [r1], r3 ++1: subs r12, #1 ++ vld1.8 {q12-q13}, [r1,:128]! ++ vld1.8 {q14-q15}, [r1,:128], r3 + sub r1, #32 + + vshr.u8 q8, q12, #3 +@@ -152,53 +116,41 @@ function ff_hevc_sao_band_w64_neon_8, export=1 + vtbl.8 d22, {q0, q1}, d22 + vtbl.8 d23, {q0, q1}, d23 + +- vmovl.s8 q2, d16 +- vmovl.s8 q3, d17 // q8 free +- vmovl.s8 q4, d18 +- vmovl.s8 q5, d19 // q9 free ++ vmovl.u8 q2, d24 ++ vmovl.u8 q3, d25 ++ vmovl.u8 q12, d26 ++ vmovl.u8 q13, d27 + +- vmovl.u8 q6, d24 +- vmovl.u8 q7, d25 // q12 free +- vmovl.u8 q8, d26 +- vmovl.u8 q9, d27 // q13 free +- +- vadd.s16 q2, q6 +- vadd.s16 q3, q7 +- vadd.s16 q4, q8 +- vadd.s16 q5, q9 ++ vaddw.s8 q2, d16 ++ vaddw.s8 q3, d17 ++ vaddw.s8 q12, d18 ++ vaddw.s8 q13, d19 + + vqmovun.s16 d4, q2 + vqmovun.s16 d5, q3 +- vqmovun.s16 d6, q4 // q4 free +- vqmovun.s16 d7, q5 // q5 free +- +- // free q4 -q9, q12 - q13 +- vmovl.s8 q4, d20 +- vmovl.s8 q5, d21 // q10 free +- vmovl.s8 q6, d22 +- vmovl.s8 q7, d23 // q11 free +- +- vmovl.u8 q8, d28 +- vmovl.u8 q9, d29 // q14 free +- vmovl.u8 q10, d30 +- vmovl.u8 q11, d31 // q15 free +- +- vadd.s16 q4, q8 +- vadd.s16 q5, q9 +- vadd.s16 q6, q10 +- vadd.s16 q7, q11 +- +- vqmovun.s16 d8, q4 +- vqmovun.s16 d9, q5 +- vqmovun.s16 d10, q6 +- vqmovun.s16 d11, q7 +- +- vstm.8 r0, {q2-q5} +- add r0, r2 ++ vqmovun.s16 d6, q12 ++ vqmovun.s16 d7, q13 ++ ++ vmovl.u8 q12, d28 ++ vmovl.u8 q13, d29 ++ vmovl.u8 q14, d30 ++ vmovl.u8 q15, d31 ++ ++ vaddw.s8 q12, d20 ++ vaddw.s8 q13, d21 ++ vaddw.s8 q14, d22 ++ vaddw.s8 q15, d23 ++ ++ vqmovun.s16 d8, q12 ++ vqmovun.s16 d9, q13 ++ vqmovun.s16 d10, q14 ++ vqmovun.s16 d11, q15 ++ ++ vst1.8 {q2-q3}, [r0,:128]! ++ vst1.8 {q4-q5}, [r0,:128], r2 ++ sub r0, #32 + bne 1b + +- vpop {d8-d15} +- pop {r4-r8} + bx lr + endfunc + +-- +2.5.0 + + +From 26bd536800db2f50ff6a021e1fda0d0394d1ea01 Mon Sep 17 00:00:00 2001 +From: Seppo Tomperi <seppo.tomperi@vtt.fi> +Date: Mon, 29 Dec 2014 15:00:49 +0200 +Subject: [PATCH 5/9] better code reuse in NEON SAO band + +--- + libavcodec/arm/hevcdsp_init_neon.c | 16 ++-- + libavcodec/arm/hevcdsp_sao_neon.S | 155 +++++++++++++------------------------ + 2 files changed, 61 insertions(+), 110 deletions(-) + +diff --git a/libavcodec/arm/hevcdsp_init_neon.c b/libavcodec/arm/hevcdsp_init_neon.c +index c32940e..6379810 100644 +--- a/libavcodec/arm/hevcdsp_init_neon.c ++++ b/libavcodec/arm/hevcdsp_init_neon.c +@@ -45,10 +45,10 @@ void ff_hevc_transform_add_16x16_neon_8(uint8_t *_dst, int16_t *coeffs, + void ff_hevc_transform_add_32x32_neon_8(uint8_t *_dst, int16_t *coeffs, + ptrdiff_t stride); + +-void ff_hevc_sao_band_w8_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t * offset_table); +-void ff_hevc_sao_band_w16_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t * offset_table); +-void ff_hevc_sao_band_w32_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t * offset_table); +-void ff_hevc_sao_band_w64_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t * offset_table); ++void ff_hevc_sao_band_w8_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int8_t * offset_table, int height); ++void ff_hevc_sao_band_w16_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int8_t * offset_table, int height); ++void ff_hevc_sao_band_w32_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int8_t * offset_table, int height); ++void ff_hevc_sao_band_w64_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int8_t * offset_table, int height); + + void ff_hevc_sao_edge_eo0_w32_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t *sao_offset_table); + void ff_hevc_sao_edge_eo1_w32_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t *sao_offset_table); +@@ -185,16 +185,16 @@ static void ff_hevc_sao_band_neon_wrapper(uint8_t *_dst, uint8_t *_src, ptrdiff_ + + switch(width){ + case 8: +- ff_hevc_sao_band_w8_neon_8(_dst, _src, stride_dst, stride_src, height, offset_table); ++ ff_hevc_sao_band_w8_neon_8(_dst, _src, stride_dst, stride_src, offset_table, height); + break; + case 16: +- ff_hevc_sao_band_w16_neon_8(_dst, _src, stride_dst, stride_src, height, offset_table); ++ ff_hevc_sao_band_w16_neon_8(_dst, _src, stride_dst, stride_src, offset_table, height); + break; + case 32: +- ff_hevc_sao_band_w32_neon_8(_dst, _src, stride_dst, stride_src, height, offset_table); ++ ff_hevc_sao_band_w32_neon_8(_dst, _src, stride_dst, stride_src, offset_table, height); + break; + case 64: +- ff_hevc_sao_band_w64_neon_8(_dst, _src, stride_dst, stride_src, height, offset_table); ++ ff_hevc_sao_band_w64_neon_8(_dst, _src, stride_dst, stride_src, offset_table, height); + break; + default: + for (y = 0; y < height; y++) { +diff --git a/libavcodec/arm/hevcdsp_sao_neon.S b/libavcodec/arm/hevcdsp_sao_neon.S +index ac21013..8852550 100644 +--- a/libavcodec/arm/hevcdsp_sao_neon.S ++++ b/libavcodec/arm/hevcdsp_sao_neon.S +@@ -21,53 +21,13 @@ + #include "libavutil/arm/asm.S" + #include "neon.S" + +-function ff_hevc_sao_band_w8_neon_8, export=1 +- ldr r12, [sp, #4] // offset_table address ++.macro init_sao_band ++ ldr r12, [sp, #0] // offset_table address + vld1.8 {q0, q1}, [r12] // offset table +- ldr r12, [sp, #0] // height +- +-1: subs r12, #1 +- vld1.8 {d24}, [r1,:64], r3 +- vshr.u8 d16, d24, #3 +- vtbl.8 d16, {q0, q1}, d16 +- vmovl.u8 q6, d24 +- vaddw.s8 q6, d16 +- vqmovun.s16 d4, q2 +- vst1.8 {d4}, [r0,:64], r2 +- bne 1b +- +- bx lr +-endfunc +- +-function ff_hevc_sao_band_w16_neon_8, export=1 +- ldr r12, [sp, #4] // offset_table address +- vld1.8 {q0, q1}, [r12] // offset table +- ldr r12, [sp, #0] // height +- +-1: subs r12, #1 +- vld1.8 {q12}, [r1,:128], r3 +- vshr.u8 q8, q12, #3 +- vtbl.8 d16, {q0, q1}, d16 +- vtbl.8 d17, {q0, q1}, d17 +- vmovl.u8 q10, d24 +- vmovl.u8 q11, d25 +- vaddw.s8 q10, d16 +- vaddw.s8 q11, d17 +- vqmovun.s16 d4, q10 +- vqmovun.s16 d5, q11 +- vst1.8 {q2}, [r0,:128], r2 +- bne 1b +- +- bx lr +-endfunc +- +-function ff_hevc_sao_band_w32_neon_8, export=1 +- ldr r12, [sp, #4] // offset_table address +- vld1.8 {q0, q1}, [r12] // offset table +- ldr r12, [sp, #0] // height ++ ldr r12, [sp, #4] // height ++.endm + +-1: subs r12, #1 +- vld1.8 {q2-q3}, [r1,:128], r3 ++.macro sao_band_32 + vshr.u8 q8, q2, #3 + vshr.u8 q9, q3, #3 + vtbl.8 d16, {q0, q1}, d16 +@@ -86,6 +46,43 @@ function ff_hevc_sao_band_w32_neon_8, export=1 + vqmovun.s16 d5, q13 + vqmovun.s16 d6, q14 + vqmovun.s16 d7, q15 ++.endm ++ ++function ff_hevc_sao_band_w8_neon_8, export=1 ++ init_sao_band ++1: subs r12, #4 ++ vld1.8 {d4}, [r1,:64], r3 ++ vld1.8 {d5}, [r1,:64], r3 ++ vld1.8 {d6}, [r1,:64], r3 ++ vld1.8 {d7}, [r1,:64], r3 ++ sao_band_32 ++ vst1.8 {d4}, [r0,:64], r2 ++ vst1.8 {d5}, [r0,:64], r2 ++ vst1.8 {d6}, [r0,:64], r2 ++ vst1.8 {d7}, [r0,:64], r2 ++ bne 1b ++ ++ bx lr ++endfunc ++ ++function ff_hevc_sao_band_w16_neon_8, export=1 ++ init_sao_band ++1: subs r12, #2 ++ vld1.8 {q2}, [r1,:128], r3 ++ vld1.8 {q3}, [r1,:128], r3 ++ sao_band_32 ++ vst1.8 {q2}, [r0,:128], r2 ++ vst1.8 {q3}, [r0,:128], r2 ++ bne 1b ++ ++ bx lr ++endfunc ++ ++function ff_hevc_sao_band_w32_neon_8, export=1 ++ init_sao_band ++1: subs r12, #1 ++ vld1.8 {q2-q3}, [r1,:128], r3 ++ sao_band_32 + vst1.8 {q2-q3}, [r0,:128], r2 + bne 1b + +@@ -93,63 +90,17 @@ function ff_hevc_sao_band_w32_neon_8, export=1 + endfunc + + function ff_hevc_sao_band_w64_neon_8, export=1 +- ldr r12, [sp, #4] // offset_table address +- vld1.8 {q0, q1}, [r12] // offset table +- ldr r12, [sp, #0] // height +- +-1: subs r12, #1 +- vld1.8 {q12-q13}, [r1,:128]! +- vld1.8 {q14-q15}, [r1,:128], r3 +- sub r1, #32 +- +- vshr.u8 q8, q12, #3 +- vshr.u8 q9, q13, #3 +- vshr.u8 q10, q14, #3 +- vshr.u8 q11, q15, #3 +- +- vtbl.8 d16, {q0, q1}, d16 +- vtbl.8 d17, {q0, q1}, d17 +- vtbl.8 d18, {q0, q1}, d18 +- vtbl.8 d19, {q0, q1}, d19 +- vtbl.8 d20, {q0, q1}, d20 +- vtbl.8 d21, {q0, q1}, d21 +- vtbl.8 d22, {q0, q1}, d22 +- vtbl.8 d23, {q0, q1}, d23 +- +- vmovl.u8 q2, d24 +- vmovl.u8 q3, d25 +- vmovl.u8 q12, d26 +- vmovl.u8 q13, d27 +- +- vaddw.s8 q2, d16 +- vaddw.s8 q3, d17 +- vaddw.s8 q12, d18 +- vaddw.s8 q13, d19 +- +- vqmovun.s16 d4, q2 +- vqmovun.s16 d5, q3 +- vqmovun.s16 d6, q12 +- vqmovun.s16 d7, q13 +- +- vmovl.u8 q12, d28 +- vmovl.u8 q13, d29 +- vmovl.u8 q14, d30 +- vmovl.u8 q15, d31 +- +- vaddw.s8 q12, d20 +- vaddw.s8 q13, d21 +- vaddw.s8 q14, d22 +- vaddw.s8 q15, d23 +- +- vqmovun.s16 d8, q12 +- vqmovun.s16 d9, q13 +- vqmovun.s16 d10, q14 +- vqmovun.s16 d11, q15 +- +- vst1.8 {q2-q3}, [r0,:128]! +- vst1.8 {q4-q5}, [r0,:128], r2 +- sub r0, #32 +- bne 1b ++ init_sao_band ++1: subs r12, #1 ++ vld1.8 {q2-q3}, [r1,:128]! ++ sao_band_32 ++ vst1.8 {q2-q3}, [r0,:128]! ++ vld1.8 {q2-q3}, [r1,:128], r3 ++ sub r1, #32 ++ sao_band_32 ++ vst1.8 {q2-q3}, [r0,:128], r2 ++ sub r0, #32 ++ bne 1b + + bx lr + endfunc +-- +2.5.0 + + +From f93646a97bc885b81759e774d04be3781916a3e7 Mon Sep 17 00:00:00 2001 +From: Seppo Tomperi <seppo.tomperi@vtt.fi> +Date: Wed, 7 Jan 2015 15:27:38 +0200 +Subject: [PATCH 6/9] More SAO NEON optimizations Now uses only 8 bit integers + for SAO calculations + +--- + libavcodec/arm/hevcdsp_init_neon.c | 7 +- + libavcodec/arm/hevcdsp_sao_neon.S | 664 +++++++++++++++---------------------- + 2 files changed, 272 insertions(+), 399 deletions(-) + +diff --git a/libavcodec/arm/hevcdsp_init_neon.c b/libavcodec/arm/hevcdsp_init_neon.c +index 6379810..8d6e863 100644 +--- a/libavcodec/arm/hevcdsp_init_neon.c ++++ b/libavcodec/arm/hevcdsp_init_neon.c +@@ -225,7 +225,7 @@ static void ff_hevc_sao_edge_neon_wrapper(uint8_t *_dst /* align 16 */, uint8_t + int x, y; + + for (x = 0; x < 5; x++) { +- sao_offset_val[x] = _sao_offset_val[x]; ++ sao_offset_val[x] = _sao_offset_val[edge_idx[x]]; + } + + stride_src /= sizeof(pixel); +@@ -271,8 +271,9 @@ static void ff_hevc_sao_edge_neon_wrapper(uint8_t *_dst /* align 16 */, uint8_t + for (x = 0; x < width; x++) { + int diff0 = CMP(src[x], src[x + a_stride]); + int diff1 = CMP(src[x], src[x + b_stride]); +- int offset_val = edge_idx[2 + diff0 + diff1]; +- dst[x] = av_clip_pixel(src[x] + sao_offset_val[offset_val]); ++ int idx = diff0 + diff1; ++ if (idx) ++ dst[x] = av_clip_pixel(src[x] + sao_offset_val[idx+2]); + } + src += stride_src; + dst += stride_dst; +diff --git a/libavcodec/arm/hevcdsp_sao_neon.S b/libavcodec/arm/hevcdsp_sao_neon.S +index 8852550..5fc482b 100644 +--- a/libavcodec/arm/hevcdsp_sao_neon.S ++++ b/libavcodec/arm/hevcdsp_sao_neon.S +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 2014 Seppo Tomperi <seppo.tomperi@vtt.fi> ++ * Copyright (c) 2014 - 2015 Seppo Tomperi <seppo.tomperi@vtt.fi> + * + * This file is part of FFmpeg. + * +@@ -23,6 +23,7 @@ + + .macro init_sao_band + ldr r12, [sp, #0] // offset_table address ++ pld [r1] + vld1.8 {q0, q1}, [r12] // offset table + ldr r12, [sp, #4] // height + .endm +@@ -30,36 +31,31 @@ + .macro sao_band_32 + vshr.u8 q8, q2, #3 + vshr.u8 q9, q3, #3 ++ vmov.u8 q14, #128 + vtbl.8 d16, {q0, q1}, d16 + vtbl.8 d17, {q0, q1}, d17 + vtbl.8 d18, {q0, q1}, d18 + vtbl.8 d19, {q0, q1}, d19 +- vmovl.u8 q12, d4 +- vmovl.u8 q13, d5 +- vmovl.u8 q14, d6 +- vmovl.u8 q15, d7 +- vaddw.s8 q12, d16 +- vaddw.s8 q13, d17 +- vaddw.s8 q14, d18 +- vaddw.s8 q15, d19 +- vqmovun.s16 d4, q12 +- vqmovun.s16 d5, q13 +- vqmovun.s16 d6, q14 +- vqmovun.s16 d7, q15 ++ vadd.s8 q2, q14 ++ vadd.s8 q3, q14 ++ vqadd.s8 q2, q8 ++ vqadd.s8 q3, q9 ++ vsub.s8 q2, q14 ++ vsub.s8 q3, q14 + .endm + + function ff_hevc_sao_band_w8_neon_8, export=1 + init_sao_band + 1: subs r12, #4 +- vld1.8 {d4}, [r1,:64], r3 +- vld1.8 {d5}, [r1,:64], r3 +- vld1.8 {d6}, [r1,:64], r3 +- vld1.8 {d7}, [r1,:64], r3 ++ vld1.8 {d4}, [r1, :64], r3 ++ vld1.8 {d5}, [r1, :64], r3 ++ vld1.8 {d6}, [r1, :64], r3 ++ vld1.8 {d7}, [r1, :64], r3 + sao_band_32 +- vst1.8 {d4}, [r0,:64], r2 +- vst1.8 {d5}, [r0,:64], r2 +- vst1.8 {d6}, [r0,:64], r2 +- vst1.8 {d7}, [r0,:64], r2 ++ vst1.8 {d4}, [r0, :64], r2 ++ vst1.8 {d5}, [r0, :64], r2 ++ vst1.8 {d6}, [r0, :64], r2 ++ vst1.8 {d7}, [r0, :64], r2 + bne 1b + + bx lr +@@ -68,11 +64,11 @@ endfunc + function ff_hevc_sao_band_w16_neon_8, export=1 + init_sao_band + 1: subs r12, #2 +- vld1.8 {q2}, [r1,:128], r3 +- vld1.8 {q3}, [r1,:128], r3 ++ vld1.8 {q2}, [r1, :128], r3 ++ vld1.8 {q3}, [r1, :128], r3 + sao_band_32 +- vst1.8 {q2}, [r0,:128], r2 +- vst1.8 {q3}, [r0,:128], r2 ++ vst1.8 {q2}, [r0, :128], r2 ++ vst1.8 {q3}, [r0, :128], r2 + bne 1b + + bx lr +@@ -81,9 +77,9 @@ endfunc + function ff_hevc_sao_band_w32_neon_8, export=1 + init_sao_band + 1: subs r12, #1 +- vld1.8 {q2-q3}, [r1,:128], r3 ++ vld1.8 {q2-q3}, [r1, :128], r3 + sao_band_32 +- vst1.8 {q2-q3}, [r0,:128], r2 ++ vst1.8 {q2-q3}, [r0, :128], r2 + bne 1b + + bx lr +@@ -92,263 +88,153 @@ endfunc + function ff_hevc_sao_band_w64_neon_8, export=1 + init_sao_band + 1: subs r12, #1 +- vld1.8 {q2-q3}, [r1,:128]! ++ pld [r1, r3] ++ vld1.8 {q2-q3}, [r1, :128]! + sao_band_32 +- vst1.8 {q2-q3}, [r0,:128]! +- vld1.8 {q2-q3}, [r1,:128], r3 ++ vst1.8 {q2-q3}, [r0, :128]! ++ vld1.8 {q2-q3}, [r1, :128], r3 + sub r1, #32 + sao_band_32 +- vst1.8 {q2-q3}, [r0,:128], r2 ++ vst1.8 {q2-q3}, [r0, :128], r2 + sub r0, #32 + bne 1b + + bx lr + endfunc +- ++// input ++// a in q0 - q3 ++// c in q4 - q7 ++// b in q8 - q11 ++// offset table in r7 and r5 ++// output in q0 - q3 ++// clobbers q12 - q15 + .macro edge_w64_body +- vcgt.u8 q12, q4, q0 // c > a -> -1 , otherwise 0 +- vcgt.u8 q0, q0, q4 // a > c -> -1 , otherwise 0 +- vcgt.u8 q13, q5, q1 +- vcgt.u8 q1, q1, q5 +- vcgt.u8 q14, q6, q2 +- vcgt.u8 q2, q2, q6 +- vcgt.u8 q15, q7, q3 +- vcgt.u8 q3, q3, q7 +- +- vsub.s8 q12, q0, q12 // diff0 +- vsub.s8 q13, q1, q13 +- vsub.s8 q14, q2, q14 +- vsub.s8 q15, q3, q15 +- ++ vcgt.u8 q12, q4, q0 // c > a -> -1 , otherwise 0 ++ vcgt.u8 q0, q0, q4 // a > c -> -1 , otherwise 0 ++ vcgt.u8 q13, q5, q1 ++ vcgt.u8 q1, q1, q5 ++ vsub.s8 q12, q0, q12 // diff0 + vcgt.u8 q0, q4, q8 // c > b +- vcgt.u8 q8, q8, q4 // b > c ++ vsub.s8 q13, q1, q13 ++ ++ vcgt.u8 q14, q8, q4 // b > c + vcgt.u8 q1, q5, q9 +- vcgt.u8 q9, q9, q5 +- vcgt.u8 q2, q6, q10 +- vcgt.u8 q10, q10, q6 +- vcgt.u8 q3, q7, q11 +- vcgt.u8 q11, q11, q7 ++ vcgt.u8 q15, q9, q5 ++ vsub.s8 q0, q14, q0 // diff1 + +- vsub.s8 q0, q8, q0 // diff1 +- vsub.s8 q1, q9, q1 +- vsub.s8 q2, q10, q2 +- vsub.s8 q3, q11, q3 ++ vsub.s8 q1, q15, q1 + +- vadd.s8 q0, q12 //diff0 + diff1 +- vadd.s8 q1, q13 +- vadd.s8 q2, q14 +- vadd.s8 q3, q15 +- +- vdup.s8 q9, r6 // 3 to all elements +- sub r6, #1 +- +- vclt.s8 q12, q0, #0 // diff0 + diff1 < 0 +- vclt.s8 q13, q1, #0 +- vclt.s8 q14, q2, #0 +- vclt.s8 q15, q3, #0 +- +- vadd.s8 q8, q0, q9 // diff0 + diff1 + 3 +- vadd.s8 q10, q1, q9 +- vand.8 q12, q8, q12 // if (diff0 + diff1 < 0) then (diff0 + diff1 + 3) else 0 +- vand.8 q13, q10, q13 +- vadd.s8 q8, q2, q9 +- vadd.s8 q10, q3, q9 +- vand.8 q14, q8, q14 +- vand.8 q15, q10, q15 +- +- vdup.s8 q9, r6 // 2 to all elements +- add r6, #1 +- +- vcgt.s8 q10, q0, #0 // diff0 + diff1 > 0 +- vadd.s8 q8, q0, q9 // diff0 + diff1 + 2 +- vand.8 q11, q8, q10 // if (diff0 + diff1 > 0) then (diff0 + diff1 + 2) else 0 +- vcgt.s8 q10, q1, #0 +- vadd.s8 q0, q11, q12 // offset_idx +- +- vadd.s8 q8, q1, q9 // diff0 + diff1 + 2 +- vcgt.s8 q12, q2, #0 +- vand.8 q11, q8, q10 // if (diff0 + diff1 > 0) then (diff0 + diff1 + 2) else 0 +- vadd.s8 q8, q2, q9 // diff0 + diff1 + 2 +- vadd.s8 q1, q11, q13 +- +- vand.8 q11, q8, q12 // if (diff0 + diff1 > 0) then (diff0 + diff1 + 2) else 0 +- vcgt.s8 q10, q3, #0 +- vadd.s8 q2, q11, q14 +- +- vadd.s8 q8, q3, q9 // diff0 + diff1 + 2 +- vmov.32 d18[0], r7 // load offset table from general registers +- vand.8 q11, q8, q10 // if (diff0 + diff1 > 0) then (diff0 + diff1 + 2) else 0 +- vmov.32 d18[1], r5 // load rest of offset table +- vadd.s8 q3, q11, q15 +- +- vtbl.8 d0, {d18}, d0 +- vtbl.8 d1, {d18}, d1 +- vtbl.8 d2, {d18}, d2 +- vtbl.8 d3, {d18}, d3 +- vtbl.8 d4, {d18}, d4 +- vtbl.8 d5, {d18}, d5 +- vtbl.8 d6, {d18}, d6 +- vtbl.8 d7, {d18}, d7 +- +- vmovl.u8 q8, d8 +- vmovl.u8 q9, d9 +- vmovl.u8 q10, d10 +- vmovl.u8 q11, d11 +- vmovl.u8 q12, d12 +- vmovl.u8 q13, d13 +- vmovl.u8 q14, d14 +- vmovl.u8 q15, d15 +- +- vaddw.s8 q8, d0 +- vaddw.s8 q9, d1 +- vaddw.s8 q10, d2 +- vaddw.s8 q11, d3 +- vaddw.s8 q12, d4 +- vaddw.s8 q13, d5 +- vaddw.s8 q14, d6 +- vaddw.s8 q15, d7 +- +- vqmovun.s16 d0, q8 +- vqmovun.s16 d1, q9 +- vqmovun.s16 d2, q10 +- vqmovun.s16 d3, q11 +- vqmovun.s16 d4, q12 +- vqmovun.s16 d5, q13 +- vqmovun.s16 d6, q14 +- vqmovun.s16 d7, q15 +- +- vstm r0, {q0-q3} +- add r0, r2 +-.endm ++ vadd.s8 q0, q12 //diff0 + diff1 ++ vadd.s8 q1, q13 + +-.macro edge_w32_body +- vcgt.u8 q12, q4, q0 // c > a -> -1 , otherwise 0 +- vcgt.u8 q0, q0, q4 // a > c -> -1 , otherwise 0 +- vcgt.u8 q13, q5, q1 +- vcgt.u8 q1, q1, q5 ++ vcgt.u8 q14, q6, q2 ++ vcgt.u8 q2, q2, q6 ++ vcgt.u8 q15, q7, q3 ++ vcgt.u8 q3, q3, q7 + +- vsub.s8 q12, q0, q12 // diff0 +- vcgt.u8 q0, q4, q8 // c > b +- vsub.s8 q13, q1, q13 // diff0 part 2 ++ vsub.s8 q14, q2, q14 ++ vcgt.u8 q2, q6, q10 ++ vsub.s8 q15, q3, q15 + +- vcgt.u8 q6, q8, q4 // b > c +- vcgt.u8 q1, q5, q9 +- vcgt.u8 q7, q9, q5 ++ vcgt.u8 q12, q10, q6 ++ vcgt.u8 q3, q7, q11 ++ vcgt.u8 q13, q11, q7 ++ vsub.s8 q2, q12, q2 ++ vsub.s8 q3, q13, q3 + +- vsub.s8 q0, q6, q0 // diff1 +- vsub.s8 q1, q7, q1 // diff1 part 2 +- vadd.s8 q0, q12 //diff0 + diff1 ++ vmov.s8 q13, #2 // 2 to all elements + +- vdup.s8 q7, r6 // 3 to all elements +- sub r6, #1 +- vadd.s8 q1, q13 ++ vadd.s8 q2, q14 ++ vadd.s8 q3, q15 ++ ++ vmov.32 d24[0], r4 // load offset table from general registers ++ vmov.32 d24[1], r5 // load rest of offset table + +- vclt.s8 q12, q0, #0 // diff0 + diff1 < 0 +- vclt.s8 q13, q1, #0 +- +- vadd.s8 q6, q0, q7 // diff0 + diff1 + 3 +- vadd.s8 q10, q1, q7 +- vdup.s8 q7, r6 // 2 to all elements +- add r6, #1 +- vand.8 q12, q6, q12 // if (diff0 + diff1 < 0) then (diff0 + diff1 + 3) else 0 +- vand.8 q13, q10, q13 +- +- +- vcgt.s8 q10, q0, #0 // diff0 + diff1 > 0 +- vadd.s8 q6, q0, q7 // diff0 + diff1 + 2 +- vand.8 q11, q6, q10 // if (diff0 + diff1 > 0) then (diff0 + diff1 + 2) else 0 +- vcgt.s8 q10, q1, #0 +- vadd.s8 q0, q11, q12 // offset_idx +- +- vadd.s8 q6, q1, q7 // diff0 + diff1 + 2 +- vmov.32 d14[0], r7 // load offset table from general registers +- vand.8 q11, q6, q10 // if (diff0 + diff1 > 0) then (diff0 + diff1 + 2) else 0 +- vmov.32 d14[1], r5 // load rest of offset table +- vadd.s8 q1, q11, q13 +- +- vtbl.8 d0, {d14}, d0 +- vtbl.8 d1, {d14}, d1 +- vtbl.8 d2, {d14}, d2 +- vtbl.8 d3, {d14}, d3 +- +- vmovl.u8 q6, d8 +- vmovl.u8 q7, d9 +- vmovl.u8 q10, d10 +- vmovl.u8 q11, d11 +- +- vaddw.s8 q6, d0 +- vaddw.s8 q7, d1 +- vaddw.s8 q10, d2 +- vaddw.s8 q11, d3 +- +- vqmovun.s16 d0, q6 +- vqmovun.s16 d1, q7 +- vqmovun.s16 d2, q10 +- vqmovun.s16 d3, q11 +- +- vstm r0, {q0-q1} +- add r0, r2 ++ vadd.s8 q0, q13 ++ vadd.s8 q1, q13 ++ vadd.s8 q2, q13 ++ vadd.s8 q3, q13 ++ ++ vmov.u8 q15, #128 // s8 #-128 ++ vtbl.8 d0, {d24}, d0 ++ vtbl.8 d1, {d24}, d1 ++ vtbl.8 d2, {d24}, d2 ++ vtbl.8 d3, {d24}, d3 ++ vtbl.8 d4, {d24}, d4 ++ vtbl.8 d5, {d24}, d5 ++ vtbl.8 d6, {d24}, d6 ++ vtbl.8 d7, {d24}, d7 ++ ++ vadd.s8 q12, q4, q15 ++ vadd.s8 q13, q5, q15 ++ vadd.s8 q14, q6, q15 ++ vadd.s8 q15, q7, q15 ++ vqadd.s8 q12, q0 ++ vqadd.s8 q15, q3 ++ vmov.u8 q3, #128 // s8 #-128 ++ vqadd.s8 q13, q1 ++ vqadd.s8 q14, q2 ++ vsub.s8 q0, q12, q3 ++ vsub.s8 q1, q13, q3 ++ vsub.s8 q2, q14, q3 ++ vsub.s8 q3, q15, q3 ++ vst1.8 {q0-q1}, [r0, :128]! ++ vst1.8 {q2-q3}, [r0, :128], r2 ++ sub r0, #32 + .endm + +-function ff_hevc_sao_edge_eo0_w64_neon_8, export=1 +- push {r4-r8} +- ldr r4, [sp, #20] // height +- ldr r5, [sp, #24] // sao_offset_val_table +- ldr r6, =0x03 +- ldr r7, [r5] ++.macro init_edge_64 ++ push {r4-r5} ++ ldr r12, [sp, #8] // height ++ ldr r5, [sp, #12] // sao_offset_val_table ++ ldr r4, [r5] + add r5, #4 + ldr r5, [r5] ++.endm ++ ++function ff_hevc_sao_edge_eo0_w64_neon_8, export=1 ++ init_edge_64 + vpush {d8-d15} + sub r1, #8 +-1: subs r4, #1 +- vld1.64 {q10-q11}, [r1]! +- vld1.64 {q12-q13}, [r1]! +- vld1.64 {q14}, [r1], r3 +- sub r1, #64 ++1: subs r12, #1 ++ vld1.64 {d7}, [r1, :64]! ++ vld1.64 {q4-q5}, [r1, :128]! // load c ++ vld1.64 {q6-q7}, [r1, :128]! ++ vld1.64 {d24}, [r1, :64], r3 ++ sub r1, #72 + // load a +- vext.8 q0, q10, q11, #7 +- vext.8 q1, q11, q12, #7 +- vext.8 q2, q12, q13, #7 +- vext.8 q3, q13, q14, #7 +- // load c +- vext.8 q4, q10, q11, #8 +- vext.8 q5, q11, q12, #8 +- vext.8 q6, q12, q13, #8 +- vext.8 q7, q13, q14, #8 ++ vext.8 q0, q3, q4, #15 ++ vext.8 q1, q4, q5, #15 ++ vext.8 q2, q5, q6, #15 ++ vext.8 q3, q6, q7, #15 + // load b +- vext.8 q8, q10, q11, #9 +- vext.8 q9, q11, q12, #9 +- vext.8 q10, q12, q13, #9 +- vext.8 q11, q13, q14, #9 ++ vext.8 q8, q4, q5, #1 ++ vext.8 q9, q5, q6, #1 ++ vext.8 q10, q6, q7, #1 ++ vext.8 q11, q7, q12, #1 + edge_w64_body + bne 1b + vpop {d8-d15} +- pop {r4-r8} ++ pop {r4-r5} + bx lr + endfunc + + function ff_hevc_sao_edge_eo1_w64_neon_8, export=1 +- push {r4-r8} +- ldr r4, [sp, #20] // height +- ldr r5, [sp, #24] // sao_offset_val_table +- ldr r6, =0x03 +- ldr r7, [r5] +- add r5, #4 +- ldr r5, [r5] ++ init_edge_64 + vpush {d8-d15} + sub r1, r3 + // load a +- vld1.8 {q0-q1}, [r1]! +- vld1.8 {q2-q3}, [r1], r3 ++ vld1.8 {q0-q1}, [r1, :128]! ++ vld1.8 {q2-q3}, [r1, :128], r3 + sub r1, #32 +-1: subs r4, #1 + // load c +- vld1.8 {q4-q5}, [r1]! +- vld1.8 {q6-q7}, [r1], r3 ++ vld1.8 {q4-q5}, [r1, :128]! ++ vld1.8 {q6-q7}, [r1, :128], r3 + sub r1, #32 ++1: subs r12, #1 + // load b +- vld1.8 {q8-q9}, [r1]! +- vld1.8 {q10-q11}, [r1] ++ vld1.8 {q8-q9}, [r1, :128]! ++ vld1.8 {q10-q11}, [r1, :128], r3 + sub r1, #32 + edge_w64_body + // copy c to a +@@ -356,20 +242,19 @@ function ff_hevc_sao_edge_eo1_w64_neon_8, export=1 + vmov.64 q1, q5 + vmov.64 q2, q6 + vmov.64 q3, q7 ++ // copy b to c ++ vmov.64 q4, q8 ++ vmov.64 q5, q9 ++ vmov.64 q6, q10 ++ vmov.64 q7, q11 + bne 1b + vpop {d8-d15} +- pop {r4-r8} ++ pop {r4-r5} + bx lr + endfunc + + function ff_hevc_sao_edge_eo2_w64_neon_8, export=1 +- push {r4-r8} +- ldr r4, [sp, #20] // height +- ldr r5, [sp, #24] // sao_offset_val_table +- ldr r6, =0x03 +- ldr r7, [r5] +- add r5, #4 +- ldr r5, [r5] ++ init_edge_64 + vpush {d8-d15} + 1: sub r1, r3 + // load a +@@ -379,10 +264,10 @@ function ff_hevc_sao_edge_eo2_w64_neon_8, export=1 + vld1.8 {q0-q1}, [r1]! + vld1.8 {q2-q3}, [r1], r3 + sub r1, #31 +- subs r4, #1 ++ subs r12, #1 + // load c +- vld1.8 {q4-q5}, [r1]! +- vld1.8 {q6-q7}, [r1], r3 ++ vld1.8 {q4-q5}, [r1, :128]! ++ vld1.8 {q6-q7}, [r1, :128], r3 + sub r1, #32 + // load b + add r1, #1 +@@ -390,25 +275,14 @@ function ff_hevc_sao_edge_eo2_w64_neon_8, export=1 + vld1.8 {q10-q11}, [r1] + sub r1, #33 + edge_w64_body +- // copy c to a +- vmov.64 q0, q4 +- vmov.64 q1, q5 +- vmov.64 q2, q6 +- vmov.64 q3, q7 + bne 1b + vpop {d8-d15} +- pop {r4-r8} ++ pop {r4-r5} + bx lr + endfunc + + function ff_hevc_sao_edge_eo3_w64_neon_8, export=1 +- push {r4-r8} +- ldr r4, [sp, #20] // height +- ldr r5, [sp, #24] // sao_offset_val_table +- ldr r6, =0x03 +- ldr r7, [r5] +- add r5, #4 +- ldr r5, [r5] ++ init_edge_64 + vpush {d8-d15} + 1: sub r1, r3 + // load a +@@ -418,10 +292,10 @@ function ff_hevc_sao_edge_eo3_w64_neon_8, export=1 + vld1.8 {q0-q1}, [r1]! + vld1.8 {q2-q3}, [r1], r3 + sub r1, #33 +- subs r4, #1 ++ subs r12, #1 + // load c +- vld1.8 {q4-q5}, [r1]! +- vld1.8 {q6-q7}, [r1], r3 ++ vld1.8 {q4-q5}, [r1, :128]! ++ vld1.8 {q6-q7}, [r1, :128], r3 + sub r1, #32 + // load b + sub r1, #1 +@@ -429,178 +303,176 @@ function ff_hevc_sao_edge_eo3_w64_neon_8, export=1 + vld1.8 {q10-q11}, [r1] + sub r1, #31 + edge_w64_body +- // copy c to a +- vmov.64 q0, q4 +- vmov.64 q1, q5 +- vmov.64 q2, q6 +- vmov.64 q3, q7 + bne 1b + vpop {d8-d15} +- pop {r4-r8} ++ pop {r4-r5} + bx lr + endfunc + ++// inputs: ++// a in q0, q1 ++// c in q2, q3 ++// b in q8, q9 ++// offset table in d31 ++// clobbered registers q0, q1, q10, q11, q12, q13 ++// output q0, q1 ++.macro edge_w32_body ++ vcgt.u8 q12, q2, q0 // c > a -> -1 , otherwise 0 ++ vcgt.u8 q0, q0, q2 // a > c -> -1 , otherwise 0 ++ vcgt.u8 q13, q3, q1 ++ vcgt.u8 q1, q1, q3 ++ ++ vsub.s8 q12, q0, q12 // diff0 ++ vcgt.u8 q0, q2, q8 // c > b ++ vsub.s8 q13, q1, q13 // diff0 part 2 ++ ++ vcgt.u8 q10, q8, q2 // b > c ++ vcgt.u8 q1, q3, q9 ++ vcgt.u8 q11, q9, q3 ++ ++ vsub.s8 q0, q10, q0 // diff1 ++ ++ vmov.s8 q10, #2 // 2 to all elements ++ vsub.s8 q1, q11, q1 // diff1 part 2 ++ vadd.s8 q0, q12 //diff0 + diff1 ++ vadd.s8 q1, q13 ++ ++ vadd.s8 q0, q10 ++ vadd.s8 q1, q10 ++ ++ vmov.u8 q10, #128 ++ vtbl.8 d0, {d31}, d0 ++ vtbl.8 d1, {d31}, d1 ++ vtbl.8 d2, {d31}, d2 ++ vtbl.8 d3, {d31}, d3 ++ ++ vadd.s8 q11, q2, q10 ++ vadd.s8 q12, q3, q10 ++ vqadd.s8 q11, q0 ++ vqadd.s8 q12, q1 ++ vsub.s8 q0, q11, q10 ++ vsub.s8 q1, q12, q10 ++ vst1.8 {q0-q1}, [r0, :128], r2 ++.endm ++ ++.macro init_edge_32 ++ ldr r12, [sp, #4] // sao_offset_val_table ++ vld1.32 {d31}, [r12] ++ ldr r12, [sp] // height ++.endm ++ + function ff_hevc_sao_edge_eo0_w32_neon_8, export=1 +- push {r4-r8} +- ldr r4, [sp, #20] // height +- ldr r5, [sp, #24] // sao_offset_val_table +- ldr r6, =0x03 +- ldr r7, [r5] +- add r5, #4 +- ldr r5, [r5] +- vpush {d8-d15} +- sub r1, #8 // load 8 extra bytes +-1: subs r4, #1 +- vld1.8 {q10-q11}, [r1] +- add r1, #32 +- vld1.8 {q12}, [r1], r3 // only first 9 bytes are used +- sub r1, #32 ++ init_edge_32 ++ sub r1, #4 // load 4 extra bytes ++1: subs r12, #1 ++ vld1.32 d3[1], [r1]! ++ vld1.8 {q2-q3}, [r1, :128]! // c ++ vld1.32 d20[0], [r1], r3 ++ sub r1, #36 + // a +- vext.8 q0, q10, q11, #7 +- vext.8 q1, q11, q12, #7 +- // c +- vext.8 q4, q10, q11, #8 +- vext.8 q5, q11, q12, #8 ++ vext.8 q0, q1, q2, #15 ++ vext.8 q1, q2, q3, #15 + // b +- vext.8 q8, q10, q11, #9 +- vext.8 q9, q11, q12, #9 ++ vext.8 q8, q2, q3, #1 ++ vext.8 q9, q3, q10, #1 + edge_w32_body +- bne 1b +- vpop {d8-d15} +- pop {r4-r8} +- bx lr ++ bne 1b ++ bx lr + endfunc + + function ff_hevc_sao_edge_eo1_w32_neon_8, export=1 +- push {r4-r8} +- ldr r4, [sp, #20] // height +- ldr r5, [sp, #24] // sao_offset_val_table +- ldr r6, =0x03 +- ldr r7, [r5] +- add r5, #4 +- ldr r5, [r5] +- vpush {d8-d15} ++ init_edge_32 + // load a + sub r1, r3 +- vld1.8 {q0-q1}, [r1], r3 ++ vld1.8 {q0-q1}, [r1, :128], r3 + // load c +- vld1.8 {q4-q5}, [r1], r3 +-1: subs r4, #1 ++ vld1.8 {q2-q3}, [r1, :128], r3 ++1: subs r12, #1 + // load b +- vld1.8 {q8-q9}, [r1], r3 ++ vld1.8 {q8-q9}, [r1, :128], r3 + edge_w32_body + // inputs for next loop iteration + // a +- vmov.64 q0, q4 +- vmov.64 q1, q5 ++ vmov.64 q0, q2 ++ vmov.64 q1, q3 + // c +- vmov.64 q4, q8 +- vmov.64 q5, q9 +- bne 1b +- vpop {d8-d15} +- pop {r4-r8} +- bx lr ++ vmov.64 q2, q8 ++ vmov.64 q3, q9 ++ bne 1b ++ bx lr + endfunc + + function ff_hevc_sao_edge_eo2_w32_neon_8, export=1 +- push {r4-r8} +- ldr r4, [sp, #20] // height +- ldr r5, [sp, #24] // sao_offset_val_table +- ldr r6, =0x03 +- ldr r7, [r5] +- add r5, #4 +- ldr r5, [r5] +- vpush {d8-d15} ++ init_edge_32 ++ vpush {d8-d15} + // load a + sub r1, r3 +- sub r1, #8 +- vld1.8 {q10-q11}, [r1] +- add r1, #32 +- vld1.8 {q12}, [r1], r3 +- sub r1, #32 ++ sub r1, #8 ++ vld1.8 {q10-q11}, [r1, :64]! ++ vld1.8 {d24}, [r1, :64], r3 ++ sub r1, #32 + vext.8 q0, q10, q11, #7 + vext.8 q1, q11, q12, #7 + // load c +- vld1.8 {q10-q11}, [r1] +- add r1, #32 +- vld1.8 {q12}, [r1], r3 +- sub r1, #32 +- vext.8 q4, q10, q11, #8 +- vext.8 q5, q11, q12, #8 +- vext.8 q2, q10, q11, #7 +-1: subs r4, #1 ++ vld1.8 {d9}, [r1, :64]! ++ vld1.8 {q2-q3}, [r1, :64], r3 ++ sub r1, #8 ++ vext.8 q4, q4, q2, #15 ++1: subs r12, #1 + // load b +- vld1.8 {q10-q11}, [r1] +- add r1, #32 +- vld1.8 {q12}, [r1], r3 +- sub r1, #32 ++ vld1.8 {q10-q11}, [r1, :64]! ++ vld1.8 {q12}, [r1, :64], r3 ++ sub r1, #32 + vext.8 q8, q10, q11, #9 + vext.8 q9, q11, q12, #9 +- vext.8 q14, q10, q11, #8 +- vext.8 q15, q11, q12, #8 +- vext.8 q3, q10, q11, #7 ++ vext.8 q6, q10, q11, #8 ++ vext.8 q7, q11, q12, #8 ++ vext.8 q5, q10, q11, #7 + edge_w32_body + // inputs for next loop iteration + // a +- vmov.8 q0, q2 +- vext.8 q1, q4, q5, #15 ++ vmov.8 q0, q4 ++ vext.8 q1, q2, q3, #15 + // c +- vmov.8 q4, q14 +- vmov.8 q5, q15 +- vmov.8 q2, q3 +- bne 1b +- vpop {d8-d15} +- pop {r4-r8} +- bx lr ++ vmov.8 q2, q6 ++ vmov.8 q3, q7 ++ vmov.8 q4, q5 ++ bne 1b ++ vpop {d8-d15} ++ bx lr + endfunc + + function ff_hevc_sao_edge_eo3_w32_neon_8, export=1 +- push {r4-r8} +- ldr r4, [sp, #20] // height +- ldr r5, [sp, #24] // sao_offset_val_table +- ldr r6, =0x03 +- ldr r7, [r5] +- add r5, #4 +- sub r1, r3 +- ldr r5, [r5] +- sub r1, #8 +- vpush {d8-d15} ++ init_edge_32 ++ sub r1, r3 + // load a +- vld1.8 {q10-q11}, [r1] +- add r1, #32 +- vld1.8 {q12}, [r1], r3 +- sub r1, #32 +- vext.8 q0, q10, q11, #9 +- vext.8 q1, q11, q12, #9 ++ vld1.8 {q10-q11}, [r1, :64]! ++ vld1.8 {d24}, [r1, :64], r3 ++ sub r1, #32 ++ vext.8 q0, q10, q11, #1 ++ vext.8 q1, q11, q12, #1 + // load c +- vld1.8 {q10-q11}, [r1] +- add r1, #32 +- vld1.8 {q12}, [r1], r3 +- sub r1, #32 +- vext.8 q4, q10, q11, #8 +- vext.8 q5, q11, q12, #8 +- vext.8 q2, q12, q11, #8 +-1: subs r4, #1 ++ vld1.8 {q2-q3}, [r1, :64]! ++ vld1.8 {d30}, [r1, :64], r3 ++ sub r1, #40 ++1: subs r12, #1 + // load b +- vld1.8 {q10-q11}, [r1] +- add r1, #32 +- vld1.8 {q12}, [r1], r3 +- sub r1, #32 ++ vld1.8 {q10-q11}, [r1, :64]! ++ vld1.8 {q12}, [r1, :64], r3 ++ sub r1, #32 + vext.8 q8, q10, q11, #7 + vext.8 q9, q11, q12, #7 +- vext.8 q3, q12, q10, #7 ++ vext.8 q14, q12, q10, #7 + edge_w32_body + // inputs for next loop iteration + // a +- vext.8 q0, q4, q5, #1 +- vext.8 q1, q5, q2, #1 ++ vext.8 q0, q2, q3, #1 ++ vext.8 q1, q3, q15, #1 + // c +- vext.8 q4, q8, q9, #1 +- vext.8 q5, q9, q3, #1 +- vext.8 q2, q3, q1, #1 +- bne 1b +- vpop {d8-d15} +- pop {r4-r8} +- bx lr ++ vext.8 q2, q8, q9, #1 ++ vext.8 q3, q9, q14, #1 ++ vext.8 d30, d28, d2, #1 ++ bne 1b ++ bx lr + endfunc + +-- +2.5.0 + + +From 016c39d46b86830204a4519590332d2a38f7ee51 Mon Sep 17 00:00:00 2001 +From: Seppo Tomperi <seppo.tomperi@vtt.fi> +Date: Thu, 8 Jan 2015 09:58:55 +0200 +Subject: [PATCH 7/9] small optimization to SAO BAND. correct path for + bit_depth_template.c + +--- + libavcodec/arm/hevcdsp_init_neon.c | 2 +- + libavcodec/arm/hevcdsp_sao_neon.S | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/libavcodec/arm/hevcdsp_init_neon.c b/libavcodec/arm/hevcdsp_init_neon.c +index 8d6e863..385c35d 100644 +--- a/libavcodec/arm/hevcdsp_init_neon.c ++++ b/libavcodec/arm/hevcdsp_init_neon.c +@@ -23,7 +23,7 @@ + #include "libavcodec/hevcdsp.h" + #include "hevcdsp_arm.h" + #include "libavcodec/avcodec.h" +-#include "../bit_depth_template.c" ++#include "libavcodec/bit_depth_template.c" + + void ff_hevc_v_loop_filter_luma_neon(uint8_t *_pix, ptrdiff_t _stride, int _beta, int *_tc, uint8_t *_no_p, uint8_t *_no_q); + void ff_hevc_h_loop_filter_luma_neon(uint8_t *_pix, ptrdiff_t _stride, int _beta, int *_tc, uint8_t *_no_p, uint8_t *_no_q); +diff --git a/libavcodec/arm/hevcdsp_sao_neon.S b/libavcodec/arm/hevcdsp_sao_neon.S +index 5fc482b..710b32b 100644 +--- a/libavcodec/arm/hevcdsp_sao_neon.S ++++ b/libavcodec/arm/hevcdsp_sao_neon.S +@@ -26,12 +26,12 @@ + pld [r1] + vld1.8 {q0, q1}, [r12] // offset table + ldr r12, [sp, #4] // height ++ vmov.u8 q14, #128 + .endm + + .macro sao_band_32 + vshr.u8 q8, q2, #3 + vshr.u8 q9, q3, #3 +- vmov.u8 q14, #128 + vtbl.8 d16, {q0, q1}, d16 + vtbl.8 d17, {q0, q1}, d17 + vtbl.8 d18, {q0, q1}, d18 +-- +2.5.0 + + +From 579f1584d688e1ac24fb7d22697e2a7b64f62e8e Mon Sep 17 00:00:00 2001 +From: Seppo Tomperi <seppo.tomperi@vtt.fi> +Date: Fri, 9 Jan 2015 10:28:52 +0200 +Subject: [PATCH 8/9] Added height check for SAO NEON optimizations. Faster SAO + band NEON Some reordering to use NEON pipelines more efficiently + +--- + libavcodec/arm/hevcdsp_init_neon.c | 12 +++- + libavcodec/arm/hevcdsp_sao_neon.S | 142 ++++++++++++++++++++++--------------- + 2 files changed, 93 insertions(+), 61 deletions(-) + +diff --git a/libavcodec/arm/hevcdsp_init_neon.c b/libavcodec/arm/hevcdsp_init_neon.c +index 385c35d..6d0689c 100644 +--- a/libavcodec/arm/hevcdsp_init_neon.c ++++ b/libavcodec/arm/hevcdsp_init_neon.c +@@ -176,6 +176,7 @@ static void ff_hevc_sao_band_neon_wrapper(uint8_t *_dst, uint8_t *_src, ptrdiff_ + int8_t offset_table[32] = { 0 }; + int k, y, x; + int shift = 3; // BIT_DEPTH - 5 ++ int cwidth = 0; + + stride_src /= sizeof(pixel); + stride_dst /= sizeof(pixel); +@@ -183,7 +184,10 @@ static void ff_hevc_sao_band_neon_wrapper(uint8_t *_dst, uint8_t *_src, ptrdiff_ + for (k = 0; k < 4; k++) + offset_table[(k + sao_left_class) & 31] = sao_offset_val[k + 1]; + +- switch(width){ ++ if (height % 8 == 0) ++ cwidth = width; ++ ++ switch(cwidth){ + case 8: + ff_hevc_sao_band_w8_neon_8(_dst, _src, stride_dst, stride_src, offset_table, height); + break; +@@ -223,15 +227,19 @@ static void ff_hevc_sao_edge_neon_wrapper(uint8_t *_dst /* align 16 */, uint8_t + pixel *src = (pixel *)_src; + int a_stride, b_stride; + int x, y; ++ int cwidth = 0; + + for (x = 0; x < 5; x++) { + sao_offset_val[x] = _sao_offset_val[edge_idx[x]]; + } + ++ if (height % 8 == 0) ++ cwidth = width; ++ + stride_src /= sizeof(pixel); + stride_dst /= sizeof(pixel); + +- switch (width) { ++ switch (cwidth) { + case 32: + switch(eo) { + case 0: +diff --git a/libavcodec/arm/hevcdsp_sao_neon.S b/libavcodec/arm/hevcdsp_sao_neon.S +index 710b32b..08f50b8 100644 +--- a/libavcodec/arm/hevcdsp_sao_neon.S ++++ b/libavcodec/arm/hevcdsp_sao_neon.S +@@ -26,36 +26,59 @@ + pld [r1] + vld1.8 {q0, q1}, [r12] // offset table + ldr r12, [sp, #4] // height +- vmov.u8 q14, #128 ++ vmov.u8 q3, #128 + .endm + +-.macro sao_band_32 +- vshr.u8 q8, q2, #3 +- vshr.u8 q9, q3, #3 +- vtbl.8 d16, {q0, q1}, d16 +- vtbl.8 d17, {q0, q1}, d17 +- vtbl.8 d18, {q0, q1}, d18 +- vtbl.8 d19, {q0, q1}, d19 +- vadd.s8 q2, q14 +- vadd.s8 q3, q14 +- vqadd.s8 q2, q8 +- vqadd.s8 q3, q9 +- vsub.s8 q2, q14 +- vsub.s8 q3, q14 ++// 128 in q3 ++// input q8 - q11 ++// 32 cycles ++.macro sao_band_64 ++ vshr.u8 q12, q8, #3 ++ vshr.u8 q13, q9, #3 ++ vshr.u8 q14, q10, #3 ++ vshr.u8 q15, q11, #3 ++ vtbl.8 d24, {d0, d1, d2, d3}, d24 ++ vadd.s8 q8, q3 ++ vtbl.8 d25, {d0, d1, d2, d3}, d25 ++ vadd.s8 q9, q3 ++ vtbl.8 d26, {d0, d1, d2, d3}, d26 ++ vadd.s8 q10, q3 ++ vtbl.8 d27, {d0, d1, d2, d3}, d27 ++ vadd.s8 q11, q3 ++ vtbl.8 d28, {d0, d1, d2, d3}, d28 ++ vqadd.s8 q8, q12 ++ vtbl.8 d29, {d0, d1, d2, d3}, d29 ++ vqadd.s8 q9, q13 ++ vtbl.8 d30, {d0, d1, d2, d3}, d30 ++ vqadd.s8 q10, q14 ++ vtbl.8 d31, {d0, d1, d2, d3}, d31 ++ vqadd.s8 q11, q15 ++ vsub.s8 q8, q3 ++ vsub.s8 q9, q3 ++ vsub.s8 q10, q3 ++ vsub.s8 q11, q3 + .endm + + function ff_hevc_sao_band_w8_neon_8, export=1 + init_sao_band +-1: subs r12, #4 +- vld1.8 {d4}, [r1, :64], r3 +- vld1.8 {d5}, [r1, :64], r3 +- vld1.8 {d6}, [r1, :64], r3 +- vld1.8 {d7}, [r1, :64], r3 +- sao_band_32 +- vst1.8 {d4}, [r0, :64], r2 +- vst1.8 {d5}, [r0, :64], r2 +- vst1.8 {d6}, [r0, :64], r2 +- vst1.8 {d7}, [r0, :64], r2 ++1: subs r12, #8 ++ vld1.8 {d16}, [r1, :64], r3 ++ vld1.8 {d17}, [r1, :64], r3 ++ vld1.8 {d18}, [r1, :64], r3 ++ vld1.8 {d19}, [r1, :64], r3 ++ vld1.8 {d20}, [r1, :64], r3 ++ vld1.8 {d21}, [r1, :64], r3 ++ vld1.8 {d22}, [r1, :64], r3 ++ vld1.8 {d23}, [r1, :64], r3 ++ sao_band_64 ++ vst1.8 {d16}, [r0, :64], r2 ++ vst1.8 {d17}, [r0, :64], r2 ++ vst1.8 {d18}, [r0, :64], r2 ++ vst1.8 {d19}, [r0, :64], r2 ++ vst1.8 {d20}, [r0, :64], r2 ++ vst1.8 {d21}, [r0, :64], r2 ++ vst1.8 {d22}, [r0, :64], r2 ++ vst1.8 {d23}, [r0, :64], r2 + bne 1b + + bx lr +@@ -63,12 +86,16 @@ endfunc + + function ff_hevc_sao_band_w16_neon_8, export=1 + init_sao_band +-1: subs r12, #2 +- vld1.8 {q2}, [r1, :128], r3 +- vld1.8 {q3}, [r1, :128], r3 +- sao_band_32 +- vst1.8 {q2}, [r0, :128], r2 +- vst1.8 {q3}, [r0, :128], r2 ++1: subs r12, #4 ++ vld1.8 {q8}, [r1, :128], r3 ++ vld1.8 {q9}, [r1, :128], r3 ++ vld1.8 {q10}, [r1, :128], r3 ++ vld1.8 {q11}, [r1, :128], r3 ++ sao_band_64 ++ vst1.8 {q8}, [r0, :128], r2 ++ vst1.8 {q9}, [r0, :128], r2 ++ vst1.8 {q10}, [r0, :128], r2 ++ vst1.8 {q11}, [r0, :128], r2 + bne 1b + + bx lr +@@ -76,10 +103,12 @@ endfunc + + function ff_hevc_sao_band_w32_neon_8, export=1 + init_sao_band +-1: subs r12, #1 +- vld1.8 {q2-q3}, [r1, :128], r3 +- sao_band_32 +- vst1.8 {q2-q3}, [r0, :128], r2 ++1: subs r12, #2 ++ vld1.8 {q8-q9}, [r1, :128], r3 ++ vld1.8 {q10-q11}, [r1, :128], r3 ++ sao_band_64 ++ vst1.8 {q8-q9}, [r0, :128], r2 ++ vst1.8 {q10-q11}, [r0, :128], r2 + bne 1b + + bx lr +@@ -89,13 +118,12 @@ function ff_hevc_sao_band_w64_neon_8, export=1 + init_sao_band + 1: subs r12, #1 + pld [r1, r3] +- vld1.8 {q2-q3}, [r1, :128]! +- sao_band_32 +- vst1.8 {q2-q3}, [r0, :128]! +- vld1.8 {q2-q3}, [r1, :128], r3 ++ vld1.8 {q8-q9}, [r1, :128]! ++ vld1.8 {q10-q11}, [r1, :128], r3 + sub r1, #32 +- sao_band_32 +- vst1.8 {q2-q3}, [r0, :128], r2 ++ sao_band_64 ++ vst1.8 {q8-q9}, [r0, :128]! ++ vst1.8 {q10-q11}, [r0, :128], r2 + sub r0, #32 + bne 1b + +@@ -121,7 +149,6 @@ endfunc + vcgt.u8 q1, q5, q9 + vcgt.u8 q15, q9, q5 + vsub.s8 q0, q14, q0 // diff1 +- + vsub.s8 q1, q15, q1 + + vadd.s8 q0, q12 //diff0 + diff1 +@@ -157,27 +184,25 @@ endfunc + + vmov.u8 q15, #128 // s8 #-128 + vtbl.8 d0, {d24}, d0 ++ vadd.s8 q13, q4, q15 + vtbl.8 d1, {d24}, d1 ++ vadd.s8 q14, q5, q15 + vtbl.8 d2, {d24}, d2 ++ vqadd.s8 q0, q13 + vtbl.8 d3, {d24}, d3 ++ vqadd.s8 q1, q14 + vtbl.8 d4, {d24}, d4 ++ vadd.s8 q13, q6, q15 + vtbl.8 d5, {d24}, d5 ++ vadd.s8 q14, q7, q15 + vtbl.8 d6, {d24}, d6 ++ vqadd.s8 q2, q13 + vtbl.8 d7, {d24}, d7 +- +- vadd.s8 q12, q4, q15 +- vadd.s8 q13, q5, q15 +- vadd.s8 q14, q6, q15 +- vadd.s8 q15, q7, q15 +- vqadd.s8 q12, q0 +- vqadd.s8 q15, q3 +- vmov.u8 q3, #128 // s8 #-128 +- vqadd.s8 q13, q1 +- vqadd.s8 q14, q2 +- vsub.s8 q0, q12, q3 +- vsub.s8 q1, q13, q3 +- vsub.s8 q2, q14, q3 +- vsub.s8 q3, q15, q3 ++ vqadd.s8 q3, q14 ++ vsub.s8 q0, q15 ++ vsub.s8 q1, q15 ++ vsub.s8 q2, q15 ++ vsub.s8 q3, q15 + vst1.8 {q0-q1}, [r0, :128]! + vst1.8 {q2-q3}, [r0, :128], r2 + sub r0, #32 +@@ -342,13 +367,12 @@ endfunc + + vmov.u8 q10, #128 + vtbl.8 d0, {d31}, d0 ++ vadd.s8 q11, q2, q10 + vtbl.8 d1, {d31}, d1 ++ vadd.s8 q12, q3, q10 + vtbl.8 d2, {d31}, d2 ++ vqadd.s8 q11, q0 + vtbl.8 d3, {d31}, d3 +- +- vadd.s8 q11, q2, q10 +- vadd.s8 q12, q3, q10 +- vqadd.s8 q11, q0 + vqadd.s8 q12, q1 + vsub.s8 q0, q11, q10 + vsub.s8 q1, q12, q10 +-- +2.5.0 + + +From 026bac1824e4936e948e6b1efec82868c520ea66 Mon Sep 17 00:00:00 2001 +From: Seppo Tomperi <seppo.tomperi@vtt.fi> +Date: Mon, 2 Feb 2015 16:08:27 +0200 +Subject: [PATCH 9/9] Further SAO NEON optimisations + +--- + libavcodec/arm/hevcdsp_init_neon.c | 16 +-- + libavcodec/arm/hevcdsp_sao_neon.S | 224 +++++++++++++++++++------------------ + 2 files changed, 124 insertions(+), 116 deletions(-) + +diff --git a/libavcodec/arm/hevcdsp_init_neon.c b/libavcodec/arm/hevcdsp_init_neon.c +index 6d0689c..e5da7e9 100644 +--- a/libavcodec/arm/hevcdsp_init_neon.c ++++ b/libavcodec/arm/hevcdsp_init_neon.c +@@ -45,10 +45,10 @@ void ff_hevc_transform_add_16x16_neon_8(uint8_t *_dst, int16_t *coeffs, + void ff_hevc_transform_add_32x32_neon_8(uint8_t *_dst, int16_t *coeffs, + ptrdiff_t stride); + +-void ff_hevc_sao_band_w8_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int8_t * offset_table, int height); +-void ff_hevc_sao_band_w16_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int8_t * offset_table, int height); +-void ff_hevc_sao_band_w32_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int8_t * offset_table, int height); +-void ff_hevc_sao_band_w64_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int8_t * offset_table, int height); ++void ff_hevc_sao_band_w8_neon_8(uint8_t *_dst, uint8_t *_src, int8_t * offset_table, ptrdiff_t stride_src, ptrdiff_t stride_dst, int height); ++void ff_hevc_sao_band_w16_neon_8(uint8_t *_dst, uint8_t *_src, int8_t * offset_table, ptrdiff_t stride_src, ptrdiff_t stride_dst, int height); ++void ff_hevc_sao_band_w32_neon_8(uint8_t *_dst, uint8_t *_src, int8_t * offset_table, ptrdiff_t stride_src, ptrdiff_t stride_dst, int height); ++void ff_hevc_sao_band_w64_neon_8(uint8_t *_dst, uint8_t *_src, int8_t * offset_table, ptrdiff_t stride_src, ptrdiff_t stride_dst, int height); + + void ff_hevc_sao_edge_eo0_w32_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t *sao_offset_table); + void ff_hevc_sao_edge_eo1_w32_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t *sao_offset_table); +@@ -189,16 +189,16 @@ static void ff_hevc_sao_band_neon_wrapper(uint8_t *_dst, uint8_t *_src, ptrdiff_ + + switch(cwidth){ + case 8: +- ff_hevc_sao_band_w8_neon_8(_dst, _src, stride_dst, stride_src, offset_table, height); ++ ff_hevc_sao_band_w8_neon_8(_dst, _src, offset_table, stride_src, stride_dst, height); + break; + case 16: +- ff_hevc_sao_band_w16_neon_8(_dst, _src, stride_dst, stride_src, offset_table, height); ++ ff_hevc_sao_band_w16_neon_8(_dst, _src, offset_table, stride_src, stride_dst, height); + break; + case 32: +- ff_hevc_sao_band_w32_neon_8(_dst, _src, stride_dst, stride_src, offset_table, height); ++ ff_hevc_sao_band_w32_neon_8(_dst, _src, offset_table, stride_src, stride_dst, height); + break; + case 64: +- ff_hevc_sao_band_w64_neon_8(_dst, _src, stride_dst, stride_src, offset_table, height); ++ ff_hevc_sao_band_w64_neon_8(_dst, _src, offset_table, stride_src, stride_dst, height); + break; + default: + for (y = 0; y < height; y++) { +diff --git a/libavcodec/arm/hevcdsp_sao_neon.S b/libavcodec/arm/hevcdsp_sao_neon.S +index 08f50b8..9c7808d 100644 +--- a/libavcodec/arm/hevcdsp_sao_neon.S ++++ b/libavcodec/arm/hevcdsp_sao_neon.S +@@ -22,21 +22,16 @@ + #include "neon.S" + + .macro init_sao_band +- ldr r12, [sp, #0] // offset_table address + pld [r1] +- vld1.8 {q0, q1}, [r12] // offset table +- ldr r12, [sp, #4] // height ++ vld1.8 {q0, q1}, [r2] // offset table ++ ldr r2, [sp, #0] // stride_dst ++ ldr r12, [sp, #4] // height + vmov.u8 q3, #128 + .endm + + // 128 in q3 + // input q8 - q11 +-// 32 cycles + .macro sao_band_64 +- vshr.u8 q12, q8, #3 +- vshr.u8 q13, q9, #3 +- vshr.u8 q14, q10, #3 +- vshr.u8 q15, q11, #3 + vtbl.8 d24, {d0, d1, d2, d3}, d24 + vadd.s8 q8, q3 + vtbl.8 d25, {d0, d1, d2, d3}, d25 +@@ -52,8 +47,8 @@ + vtbl.8 d30, {d0, d1, d2, d3}, d30 + vqadd.s8 q10, q14 + vtbl.8 d31, {d0, d1, d2, d3}, d31 +- vqadd.s8 q11, q15 + vsub.s8 q8, q3 ++ vqadd.s8 q11, q15 + vsub.s8 q9, q3 + vsub.s8 q10, q3 + vsub.s8 q11, q3 +@@ -64,12 +59,16 @@ function ff_hevc_sao_band_w8_neon_8, export=1 + 1: subs r12, #8 + vld1.8 {d16}, [r1, :64], r3 + vld1.8 {d17}, [r1, :64], r3 ++ vshr.u8 q12, q8, #3 + vld1.8 {d18}, [r1, :64], r3 + vld1.8 {d19}, [r1, :64], r3 ++ vshr.u8 q13, q9, #3 + vld1.8 {d20}, [r1, :64], r3 + vld1.8 {d21}, [r1, :64], r3 ++ vshr.u8 q14, q10, #3 + vld1.8 {d22}, [r1, :64], r3 + vld1.8 {d23}, [r1, :64], r3 ++ vshr.u8 q15, q11, #3 + sao_band_64 + vst1.8 {d16}, [r0, :64], r2 + vst1.8 {d17}, [r0, :64], r2 +@@ -88,9 +87,13 @@ function ff_hevc_sao_band_w16_neon_8, export=1 + init_sao_band + 1: subs r12, #4 + vld1.8 {q8}, [r1, :128], r3 ++ vshr.u8 q12, q8, #3 + vld1.8 {q9}, [r1, :128], r3 ++ vshr.u8 q13, q9, #3 + vld1.8 {q10}, [r1, :128], r3 ++ vshr.u8 q14, q10, #3 + vld1.8 {q11}, [r1, :128], r3 ++ vshr.u8 q15, q11, #3 + sao_band_64 + vst1.8 {q8}, [r0, :128], r2 + vst1.8 {q9}, [r0, :128], r2 +@@ -105,7 +108,11 @@ function ff_hevc_sao_band_w32_neon_8, export=1 + init_sao_band + 1: subs r12, #2 + vld1.8 {q8-q9}, [r1, :128], r3 ++ vshr.u8 q12, q8, #3 ++ vshr.u8 q13, q9, #3 + vld1.8 {q10-q11}, [r1, :128], r3 ++ vshr.u8 q14, q10, #3 ++ vshr.u8 q15, q11, #3 + sao_band_64 + vst1.8 {q8-q9}, [r0, :128], r2 + vst1.8 {q10-q11}, [r0, :128], r2 +@@ -119,7 +126,11 @@ function ff_hevc_sao_band_w64_neon_8, export=1 + 1: subs r12, #1 + pld [r1, r3] + vld1.8 {q8-q9}, [r1, :128]! ++ vshr.u8 q12, q8, #3 ++ vshr.u8 q13, q9, #3 + vld1.8 {q10-q11}, [r1, :128], r3 ++ vshr.u8 q14, q10, #3 ++ vshr.u8 q15, q11, #3 + sub r1, #32 + sao_band_64 + vst1.8 {q8-q9}, [r0, :128]! +@@ -129,51 +140,18 @@ function ff_hevc_sao_band_w64_neon_8, export=1 + + bx lr + endfunc +-// input +-// a in q0 - q3 +-// c in q4 - q7 +-// b in q8 - q11 +-// offset table in r7 and r5 +-// output in q0 - q3 +-// clobbers q12 - q15 +-.macro edge_w64_body +- vcgt.u8 q12, q4, q0 // c > a -> -1 , otherwise 0 +- vcgt.u8 q0, q0, q4 // a > c -> -1 , otherwise 0 +- vcgt.u8 q13, q5, q1 +- vcgt.u8 q1, q1, q5 +- vsub.s8 q12, q0, q12 // diff0 +- vcgt.u8 q0, q4, q8 // c > b +- vsub.s8 q13, q1, q13 +- +- vcgt.u8 q14, q8, q4 // b > c +- vcgt.u8 q1, q5, q9 +- vcgt.u8 q15, q9, q5 +- vsub.s8 q0, q14, q0 // diff1 +- vsub.s8 q1, q15, q1 + +- vadd.s8 q0, q12 //diff0 + diff1 +- vadd.s8 q1, q13 +- +- vcgt.u8 q14, q6, q2 +- vcgt.u8 q2, q2, q6 +- vcgt.u8 q15, q7, q3 +- vcgt.u8 q3, q3, q7 +- +- vsub.s8 q14, q2, q14 +- vcgt.u8 q2, q6, q10 +- vsub.s8 q15, q3, q15 +- +- vcgt.u8 q12, q10, q6 +- vcgt.u8 q3, q7, q11 +- vcgt.u8 q13, q11, q7 +- vsub.s8 q2, q12, q2 +- vsub.s8 q3, q13, q3 ++.macro diff32 out0, out1, tmp0, tmp1, in0, in1, in2, in3 ++ vcgt.u8 \out0, \in2, \in0 // c > a -> -1 , otherwise 0 ++ vcgt.u8 \tmp0, \in0, \in2 // a > c -> -1 , otherwise 0 ++ vcgt.u8 \out1, \in3, \in1 // c > a -> -1 , otherwise 0 part 2 ++ vcgt.u8 \tmp1, \in1, \in3 // a > c -> -1 , otherwise 0 part 2 ++ vsub.s8 \out0, \tmp0, \out0 // diff0 ++ vsub.s8 \out1, \tmp1, \out1 // diff0 part 2 ++.endm + ++.macro table64 + vmov.s8 q13, #2 // 2 to all elements +- +- vadd.s8 q2, q14 +- vadd.s8 q3, q15 +- + vmov.32 d24[0], r4 // load offset table from general registers + vmov.32 d24[1], r5 // load rest of offset table + +@@ -208,6 +186,28 @@ endfunc + sub r0, #32 + .endm + ++// input ++// a in q0 - q3 ++// c in q4 - q7 ++// b in q8 - q11 ++// offset table in r7 and r5 ++// output in q0 - q3 ++// clobbers q12 - q15 ++.macro edge_w64_body ++ diff32 q12, q13, q0, q1, q0, q1, q4, q5 ++ diff32 q0, q1, q14, q15, q8, q9, q4, q5 ++ ++ vadd.s8 q0, q12 //diff0 + diff1 ++ vadd.s8 q1, q13 ++ ++ diff32 q14, q15, q2, q3, q2, q3, q6, q7 ++ diff32 q2, q3, q12, q13, q10, q11, q6, q7 ++ ++ vadd.s8 q2, q14 ++ vadd.s8 q3, q15 ++ table64 ++.endm ++ + .macro init_edge_64 + push {r4-r5} + ldr r12, [sp, #8] // height +@@ -334,38 +334,23 @@ function ff_hevc_sao_edge_eo3_w64_neon_8, export=1 + bx lr + endfunc + +-// inputs: +-// a in q0, q1 +-// c in q2, q3 +-// b in q8, q9 +-// offset table in d31 +-// clobbered registers q0, q1, q10, q11, q12, q13 +-// output q0, q1 +-.macro edge_w32_body +- vcgt.u8 q12, q2, q0 // c > a -> -1 , otherwise 0 +- vcgt.u8 q0, q0, q2 // a > c -> -1 , otherwise 0 +- vcgt.u8 q13, q3, q1 +- vcgt.u8 q1, q1, q3 +- +- vsub.s8 q12, q0, q12 // diff0 +- vcgt.u8 q0, q2, q8 // c > b +- vsub.s8 q13, q1, q13 // diff0 part 2 +- +- vcgt.u8 q10, q8, q2 // b > c +- vcgt.u8 q1, q3, q9 +- vcgt.u8 q11, q9, q3 +- +- vsub.s8 q0, q10, q0 // diff1 +- +- vmov.s8 q10, #2 // 2 to all elements +- vsub.s8 q1, q11, q1 // diff1 part 2 +- vadd.s8 q0, q12 //diff0 + diff1 +- vadd.s8 q1, q13 ++.macro init_edge_32 ++ ldr r12, [sp, #4] // sao_offset_val_table ++ vld1.32 {d31}, [r12] ++ ldr r12, [sp] // height ++.endm + +- vadd.s8 q0, q10 +- vadd.s8 q1, q10 ++.macro diff out0, tmp0, in0, in1 ++ vcgt.u8 \out0, \in1, \in0 // c > a -> -1 , otherwise 0 ++ vcgt.u8 \tmp0, \in0, \in1 // a > c -> -1 , otherwise 0 ++ vsub.s8 \out0, \tmp0, \out0 // diff0 ++.endm + +- vmov.u8 q10, #128 ++.macro table32 ++ vmov.s8 q10, #2 ++ vadd.s8 q0, q10 ++ vadd.s8 q1, q10 ++ vmov.s8 q10, #128 + vtbl.8 d0, {d31}, d0 + vadd.s8 q11, q2, q10 + vtbl.8 d1, {d31}, d1 +@@ -373,56 +358,68 @@ endfunc + vtbl.8 d2, {d31}, d2 + vqadd.s8 q11, q0 + vtbl.8 d3, {d31}, d3 +- vqadd.s8 q12, q1 +- vsub.s8 q0, q11, q10 +- vsub.s8 q1, q12, q10 ++ vqadd.s8 q12, q1 ++ vsub.s8 q0, q11, q10 ++ vsub.s8 q1, q12, q10 + vst1.8 {q0-q1}, [r0, :128], r2 + .endm + +-.macro init_edge_32 +- ldr r12, [sp, #4] // sao_offset_val_table +- vld1.32 {d31}, [r12] +- ldr r12, [sp] // height +-.endm +- + function ff_hevc_sao_edge_eo0_w32_neon_8, export=1 + init_edge_32 +- sub r1, #4 // load 4 extra bytes ++ vpush {q4-q7} ++ sub r1, #4 + 1: subs r12, #1 +- vld1.32 d3[1], [r1]! +- vld1.8 {q2-q3}, [r1, :128]! // c +- vld1.32 d20[0], [r1], r3 +- sub r1, #36 ++ vld1.8 {q13-q14}, [r1]! ++ vld1.32 d30, [r1], r3 ++ sub r1, #32 + // a +- vext.8 q0, q1, q2, #15 +- vext.8 q1, q2, q3, #15 +- // b +- vext.8 q8, q2, q3, #1 +- vext.8 q9, q3, q10, #1 +- edge_w32_body ++ vext.8 q0, q13, q14, #3 ++ vext.8 q1, q14, q15, #3 ++ vshr.u64 d24, d30, #24 ++ // c ++ vext.8 q2, q13, q14, #4 ++ vext.8 q3, q14, q15, #4 ++ vshr.u64 d16, d30, #32 ++ // diff0 ++ diff32 q13, q14, q4, q5, q0, q1, q2, q3 ++ diff d18, d25, d24, d16 ++ // -diff1 ++ vext.s8 q0, q13, q14, #1 ++ vext.s8 q1, q14, q9, #1 ++ ++ vsub.s8 q0, q13, q0 //diff0 + diff1 ++ vsub.s8 q1, q14, q1 ++ table32 + bne 1b ++ vpop {q4-q7} ++ + bx lr + endfunc + + function ff_hevc_sao_edge_eo1_w32_neon_8, export=1 + init_edge_32 ++ vpush {q4-q7} + // load a + sub r1, r3 + vld1.8 {q0-q1}, [r1, :128], r3 + // load c + vld1.8 {q2-q3}, [r1, :128], r3 ++ diff32 q12, q13, q0, q1, q0, q1, q2, q3 // CMP ( c, a ) + 1: subs r12, #1 + // load b + vld1.8 {q8-q9}, [r1, :128], r3 +- edge_w32_body +- // inputs for next loop iteration +- // a +- vmov.64 q0, q2 +- vmov.64 q1, q3 ++ diff32 q4, q5, q10, q11, q8, q9, q2, q3 // CMP ( c, b ) ++ vadd.s8 q0, q4, q12 //diff0 + diff1 ++ vadd.s8 q1, q5, q13 ++ table32 ++ // CMP ( c, a ) ++ vneg.s8 q12, q4 ++ vneg.s8 q13, q5 + // c + vmov.64 q2, q8 + vmov.64 q3, q9 + bne 1b ++ vpop {q4-q7} + bx lr + endfunc + +@@ -452,7 +449,11 @@ function ff_hevc_sao_edge_eo2_w32_neon_8, export=1 + vext.8 q6, q10, q11, #8 + vext.8 q7, q11, q12, #8 + vext.8 q5, q10, q11, #7 +- edge_w32_body ++ diff32 q12, q13, q0, q1, q0, q1, q2, q3 ++ diff32 q0, q1, q10, q11, q8, q9, q2, q3 ++ vadd.s8 q0, q12 //diff0 + diff1 ++ vadd.s8 q1, q13 ++ table32 + // inputs for next loop iteration + // a + vmov.8 q0, q4 +@@ -487,7 +488,14 @@ function ff_hevc_sao_edge_eo3_w32_neon_8, export=1 + vext.8 q8, q10, q11, #7 + vext.8 q9, q11, q12, #7 + vext.8 q14, q12, q10, #7 +- edge_w32_body ++ ++ diff32 q12, q13, q0, q1, q0, q1, q2, q3 ++ diff32 q0, q1, q10, q11, q8, q9, q2, q3 ++ ++ vadd.s8 q0, q12 //diff0 + diff1 ++ vadd.s8 q1, q13 ++ table32 ++ + // inputs for next loop iteration + // a + vext.8 q0, q2, q3, #1 +-- +2.5.0 + + diff --git a/packages/multimedia/ffmpeg/patches/ffmpeg-99.1003-pfcd_hevc_optimisations.patch b/packages/multimedia/ffmpeg/patches/ffmpeg-99.1003-pfcd_hevc_optimisations.patch new file mode 100644 index 00000000000..a48d81a1a39 --- /dev/null +++ b/packages/multimedia/ffmpeg/patches/ffmpeg-99.1003-pfcd_hevc_optimisations.patch @@ -0,0 +1,38137 @@ +From 4c05fa1631b5e8839a7763417c5220291308c707 Mon Sep 17 00:00:00 2001 +From: Peter de Rivaz <peter.derivaz@gmail.com> +Date: Tue, 28 Apr 2015 16:18:40 +0100 +Subject: [PATCH 01/68] Added display output + +--- + ffmpeg.c | 159 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 159 insertions(+) + +diff --git a/ffmpeg.c b/ffmpeg.c +index a5ec3c3..8828f48 100644 +--- a/ffmpeg.c ++++ b/ffmpeg.c +@@ -23,6 +23,11 @@ + * multimedia converter based on the FFmpeg libraries + */ + ++#ifdef RPI ++#define RPI_DISPLAY ++//#define RPI_ZERO_COPY ++#endif ++ + #include "config.h" + #include <ctype.h> + #include <string.h> +@@ -66,6 +71,20 @@ + # include "libavfilter/buffersrc.h" + # include "libavfilter/buffersink.h" + ++#ifdef RPI_DISPLAY ++#include <bcm_host.h> ++#include <interface/mmal/mmal.h> ++#include <interface/mmal/mmal_parameters_camera.h> ++#include <interface/mmal/mmal_buffer.h> ++#include <interface/mmal/util/mmal_util.h> ++#include <interface/mmal/util/mmal_default_components.h> ++#include <interface/mmal/util/mmal_connection.h> ++#include <interface/mmal/util/mmal_util_params.h> ++#ifdef RPI_ZERO_COPY ++#include "libavcodec/rpi_qpu.h" ++#endif ++#endif ++ + #if HAVE_SYS_RESOURCE_H + #include <sys/time.h> + #include <sys/types.h> +@@ -158,6 +177,134 @@ static int restore_tty; + static void free_input_threads(void); + #endif + ++#ifdef RPI_DISPLAY ++ ++#define NUM_BUFFERS 4 ++ ++static MMAL_COMPONENT_T* rpi_display = NULL; ++static MMAL_POOL_T *rpi_pool = NULL; ++ ++#ifdef RPI_ZERO_COPY ++static uint8_t *get_vc_handle(AVBufferRef *bref) { ++ GPU_MEM_PTR_T *p = av_buffer_pool_opaque(bref); ++ return (uint8_t *)p->vc_handle; ++} ++#endif ++ ++static MMAL_POOL_T* display_alloc_pool(MMAL_PORT_T* port, size_t w, size_t h) ++{ ++ MMAL_POOL_T* pool; ++ size_t i; ++ size_t size = (w*h*3)/2; ++#ifdef RPI_ZERO_COPY ++ mmal_port_parameter_set_boolean(port, MMAL_PARAMETER_ZERO_COPY, MMAL_TRUE); // Does this mark that the buffer contains a vc_handle? Would have expected a vc_image? ++ pool = mmal_port_pool_create(port, NUM_BUFFERS, 0); ++ assert(pool); ++#else ++ pool = mmal_port_pool_create(port, NUM_BUFFERS, size); ++ ++ for (i = 0; i < NUM_BUFFERS; ++i) ++ { ++ MMAL_BUFFER_HEADER_T* buffer = pool->header[i]; ++ void* bufPtr = buffer->data; ++ memset(bufPtr, i*30, w*h); ++ memset(bufPtr+w*h, 128, (w*h)/2); ++ } ++#endif ++ ++ return pool; ++} ++ ++static void display_cb_input(MMAL_PORT_T *port,MMAL_BUFFER_HEADER_T *buffer) { ++ mmal_buffer_header_release(buffer); ++} ++ ++static MMAL_COMPONENT_T* display_init(size_t x, size_t y, size_t w, size_t h) ++{ ++ MMAL_COMPONENT_T* display; ++ int w2 = (w+31)&~31; ++ int h2 = (h+15)&~15; ++ MMAL_DISPLAYREGION_T region = ++ { ++ {MMAL_PARAMETER_DISPLAYREGION, sizeof(region)}, ++ .set = MMAL_DISPLAY_SET_LAYER | MMAL_DISPLAY_SET_FULLSCREEN | MMAL_DISPLAY_SET_DEST_RECT, ++ .layer = 2, ++ .fullscreen = 0, ++ .dest_rect = {x, y, w, h} ++ }; ++ bcm_host_init(); // TODO is this needed? ++ mmal_component_create(MMAL_COMPONENT_DEFAULT_VIDEO_RENDERER, &display); ++ assert(display); ++ ++ mmal_port_parameter_set(display->input[0], &region.hdr); ++ ++ MMAL_ES_FORMAT_T* format = display->input[0]->format; ++ format->encoding = MMAL_ENCODING_I420; ++ format->es->video.width = w2; ++ format->es->video.height = h2; ++ format->es->video.crop.x = 0; ++ format->es->video.crop.y = 0; ++ format->es->video.crop.width = w; ++ format->es->video.crop.height = h; ++ mmal_port_format_commit(display->input[0]); ++ ++ mmal_component_enable(display); ++ ++ rpi_pool = display_alloc_pool(display->input[0], w2, h2); ++ ++ mmal_port_enable(display->input[0],display_cb_input); ++ mmal_port_enable(display->control,display_cb_input); ++ ++ printf("Allocated display %d %d\n",w,h); ++ ++ return display; ++} ++ ++static void display_frame(MMAL_COMPONENT_T* display,AVFrame* fr) ++{ ++ int w = fr->width; ++ int h = fr->height; ++ int w2 = (w+31)&~31; ++ int h2 = (h+15)&~15; ++ if (!display || !rpi_pool) ++ return; ++ MMAL_BUFFER_HEADER_T* buf = mmal_queue_get(rpi_pool->queue); ++ if (!buf) { ++ // Running too fast so drop the frame ++ return; ++ } ++ assert(buf); ++ buf->cmd = 0; ++ buf->length = (w2 * h2 * 3)/2; ++ buf->offset = 0; // Offset to valid data ++ buf->flags = 0; ++#ifdef RPI_ZERO_COPY ++ buf->data = get_vc_handle(fr->buf[0]); ++ buf->alloc_size = (w2*h2*3)/2; ++#else ++ //mmal_buffer_header_mem_lock(buf); ++ memcpy(buf->data, fr->data[0], w2 * h); ++ memcpy(buf->data+w2*h2, fr->data[1], w2 * h / 4); ++ memcpy(buf->data+w2*h2*5/4, fr->data[2], w2 * h / 4); ++ //mmal_buffer_header_mem_unlock(buf); ++#endif ++ ++ mmal_port_send_buffer(display->input[0], buf); // I assume this will automatically get released ++} ++ ++static void display_exit(MMAL_COMPONENT_T* display) ++{ ++ if (display) { ++ mmal_component_destroy(display); ++ } ++ if (rpi_pool) { ++ mmal_port_pool_destroy(display->input[0], rpi_pool); ++ } ++} ++ ++#endif ++ ++ + /* sub2video hack: + Convert subtitles to video with alpha to insert them in filter graphs. + This is a temporary solution until libavfilter gets real subtitles support. +@@ -581,6 +728,10 @@ static void ffmpeg_cleanup(int ret) + } + term_exit(); + ffmpeg_exited = 1; ++ ++#ifdef RPI_DISPLAY ++ display_exit(rpi_display); ++#endif + } + + void remove_avoptions(AVDictionary **a, AVDictionary *b) +@@ -928,6 +1079,14 @@ static void do_video_out(AVFormatContext *s, + int frame_size = 0; + InputStream *ist = NULL; + AVFilterContext *filter = ost->filter->filter; ++#ifdef RPI_DISPLAY ++ if (next_picture) ++ { ++ if (!rpi_display) ++ rpi_display = display_init(0,0,next_picture->width,next_picture->height); ++ display_frame(rpi_display,next_picture); ++ } ++#endif + + if (ost->source_index >= 0) + ist = input_streams[ost->source_index]; +-- +2.5.0 + + +From 90f7867ad638d03e8d1a9902990dfd7edd13fe0d Mon Sep 17 00:00:00 2001 +From: Peter de Rivaz <peter.derivaz@gmail.com> +Date: Wed, 29 Apr 2015 16:49:43 +0100 +Subject: [PATCH 02/68] Split transform and intra prediction into commands + +--- + libavcodec/hevc.c | 119 +++++++++++++++++++++++++++++++++++++++++++++++- + libavcodec/hevc.h | 58 +++++++++++++++++++++++ + libavcodec/hevc_cabac.c | 15 ++++++ + 3 files changed, 191 insertions(+), 1 deletion(-) + +diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c +index 203f90a..2eebd31 100644 +--- a/libavcodec/hevc.c ++++ b/libavcodec/hevc.c +@@ -920,6 +920,25 @@ static int hls_cross_component_pred(HEVCContext *s, int idx) { + return 0; + } + ++#ifdef RPI ++static void rpi_intra_pred(HEVCContext *s, int log2_trafo_size, int x0, int y0, int c_idx) ++{ ++ if (s->enable_rpi) { ++ HEVCLocalContext *lc = s->HEVClc; ++ HEVCPredCmd *cmd = s->univ_pred_cmds + s->num_pred_cmds++; ++ cmd->type = RPI_PRED_INTRA; ++ cmd->size = log2_trafo_size; ++ cmd->c_idx = c_idx; ++ cmd->x = x0; ++ cmd->y = y0; ++ cmd->na = (lc->na.cand_bottom_left<<4) + (lc->na.cand_left<<3) + (lc->na.cand_up_left<<2) + (lc->na.cand_up<<1) + lc->na.cand_up_right; ++ cmd->mode = c_idx ? lc->tu.intra_pred_mode_c : lc->tu.intra_pred_mode; ++ } else { ++ s->hpc.intra_pred[log2_trafo_size - 2](s, x0, y0, c_idx); ++ } ++} ++#endif ++ + static int hls_transform_unit(HEVCContext *s, int x0, int y0, + int xBase, int yBase, int cb_xBase, int cb_yBase, + int log2_cb_size, int log2_trafo_size, +@@ -932,8 +951,11 @@ static int hls_transform_unit(HEVCContext *s, int x0, int y0, + if (lc->cu.pred_mode == MODE_INTRA) { + int trafo_size = 1 << log2_trafo_size; + ff_hevc_set_neighbour_available(s, x0, y0, trafo_size, trafo_size); +- ++#ifdef RPI ++ rpi_intra_pred(s, log2_trafo_size, x0, y0, 0); ++#else + s->hpc.intra_pred[log2_trafo_size - 2](s, x0, y0, 0); ++#endif + } + + if (cbf_luma || cbf_cb[0] || cbf_cr[0] || +@@ -1019,7 +1041,11 @@ static int hls_transform_unit(HEVCContext *s, int x0, int y0, + for (i = 0; i < (s->ps.sps->chroma_format_idc == 2 ? 2 : 1); i++) { + if (lc->cu.pred_mode == MODE_INTRA) { + ff_hevc_set_neighbour_available(s, x0, y0 + (i << log2_trafo_size_c), trafo_size_h, trafo_size_v); ++#ifdef RPI ++ rpi_intra_pred(s, log2_trafo_size_c, x0, y0 + (i << log2_trafo_size_c), 1); ++#else + s->hpc.intra_pred[log2_trafo_size_c - 2](s, x0, y0 + (i << log2_trafo_size_c), 1); ++#endif + } + if (cbf_cb[i]) + ff_hevc_hls_residual_coding(s, x0, y0 + (i << log2_trafo_size_c), +@@ -1048,7 +1074,11 @@ static int hls_transform_unit(HEVCContext *s, int x0, int y0, + for (i = 0; i < (s->ps.sps->chroma_format_idc == 2 ? 2 : 1); i++) { + if (lc->cu.pred_mode == MODE_INTRA) { + ff_hevc_set_neighbour_available(s, x0, y0 + (i << log2_trafo_size_c), trafo_size_h, trafo_size_v); ++#ifdef RPI ++ rpi_intra_pred(s, log2_trafo_size_c, x0, y0 + (i << log2_trafo_size_c), 2); ++#else + s->hpc.intra_pred[log2_trafo_size_c - 2](s, x0, y0 + (i << log2_trafo_size_c), 2); ++#endif + } + if (cbf_cr[i]) + ff_hevc_hls_residual_coding(s, x0, y0 + (i << log2_trafo_size_c), +@@ -1077,7 +1107,11 @@ static int hls_transform_unit(HEVCContext *s, int x0, int y0, + if (lc->cu.pred_mode == MODE_INTRA) { + ff_hevc_set_neighbour_available(s, xBase, yBase + (i << log2_trafo_size), + trafo_size_h, trafo_size_v); ++#ifdef RPI ++ rpi_intra_pred(s, log2_trafo_size, xBase, yBase + (i << log2_trafo_size), 1); ++#else + s->hpc.intra_pred[log2_trafo_size - 2](s, xBase, yBase + (i << log2_trafo_size), 1); ++#endif + } + if (cbf_cb[i]) + ff_hevc_hls_residual_coding(s, xBase, yBase + (i << log2_trafo_size), +@@ -1087,7 +1121,11 @@ static int hls_transform_unit(HEVCContext *s, int x0, int y0, + if (lc->cu.pred_mode == MODE_INTRA) { + ff_hevc_set_neighbour_available(s, xBase, yBase + (i << log2_trafo_size), + trafo_size_h, trafo_size_v); ++#ifdef RPI ++ rpi_intra_pred(s, log2_trafo_size, xBase, yBase + (i << log2_trafo_size), 2); ++#else + s->hpc.intra_pred[log2_trafo_size - 2](s, xBase, yBase + (i << log2_trafo_size), 2); ++#endif + } + if (cbf_cr[i]) + ff_hevc_hls_residual_coding(s, xBase, yBase + (i << log2_trafo_size), +@@ -1099,26 +1137,46 @@ static int hls_transform_unit(HEVCContext *s, int x0, int y0, + int trafo_size_h = 1 << (log2_trafo_size_c + s->ps.sps->hshift[1]); + int trafo_size_v = 1 << (log2_trafo_size_c + s->ps.sps->vshift[1]); + ff_hevc_set_neighbour_available(s, x0, y0, trafo_size_h, trafo_size_v); ++#ifdef RPI ++ rpi_intra_pred(s, log2_trafo_size_c, x0, y0, 1); ++ rpi_intra_pred(s, log2_trafo_size_c, x0, y0, 2); ++#else + s->hpc.intra_pred[log2_trafo_size_c - 2](s, x0, y0, 1); + s->hpc.intra_pred[log2_trafo_size_c - 2](s, x0, y0, 2); ++#endif + if (s->ps.sps->chroma_format_idc == 2) { + ff_hevc_set_neighbour_available(s, x0, y0 + (1 << log2_trafo_size_c), + trafo_size_h, trafo_size_v); ++#ifdef RPI ++ rpi_intra_pred(s, log2_trafo_size_c, x0, y0 + (1 << log2_trafo_size_c), 1); ++ rpi_intra_pred(s, log2_trafo_size_c, x0, y0 + (1 << log2_trafo_size_c), 2); ++#else + s->hpc.intra_pred[log2_trafo_size_c - 2](s, x0, y0 + (1 << log2_trafo_size_c), 1); + s->hpc.intra_pred[log2_trafo_size_c - 2](s, x0, y0 + (1 << log2_trafo_size_c), 2); ++#endif + } + } else if (blk_idx == 3) { + int trafo_size_h = 1 << (log2_trafo_size + 1); + int trafo_size_v = 1 << (log2_trafo_size + s->ps.sps->vshift[1]); + ff_hevc_set_neighbour_available(s, xBase, yBase, + trafo_size_h, trafo_size_v); ++#ifdef RPI ++ rpi_intra_pred(s, log2_trafo_size, xBase, yBase, 1); ++ rpi_intra_pred(s, log2_trafo_size, xBase, yBase, 2); ++#else + s->hpc.intra_pred[log2_trafo_size - 2](s, xBase, yBase, 1); + s->hpc.intra_pred[log2_trafo_size - 2](s, xBase, yBase, 2); ++#endif + if (s->ps.sps->chroma_format_idc == 2) { + ff_hevc_set_neighbour_available(s, xBase, yBase + (1 << (log2_trafo_size)), + trafo_size_h, trafo_size_v); ++#ifdef RPI ++ rpi_intra_pred(s, log2_trafo_size, xBase, yBase + (1 << (log2_trafo_size)), 1); ++ rpi_intra_pred(s, log2_trafo_size, xBase, yBase + (1 << (log2_trafo_size)), 2); ++#else + s->hpc.intra_pred[log2_trafo_size - 2](s, xBase, yBase + (1 << (log2_trafo_size)), 1); + s->hpc.intra_pred[log2_trafo_size - 2](s, xBase, yBase + (1 << (log2_trafo_size)), 2); ++#endif + } + } + } +@@ -2293,6 +2351,31 @@ static void hls_decode_neighbour(HEVCContext *s, int x_ctb, int y_ctb, + lc->ctb_up_left_flag = ((x_ctb > 0) && (y_ctb > 0) && (ctb_addr_in_slice-1 >= s->ps.sps->ctb_width) && (s->ps.pps->tile_id[ctb_addr_ts] == s->ps.pps->tile_id[s->ps.pps->ctb_addr_rs_to_ts[ctb_addr_rs-1 - s->ps.sps->ctb_width]])); + } + ++#ifdef RPI ++static void rpi_execute_pred_cmds(HEVCContext *s) ++{ ++ int i; ++ HEVCPredCmd *cmd = s->univ_pred_cmds; ++ HEVCLocalContext *lc = s->HEVClc; ++ ++ for(i = s->num_pred_cmds; i > 0; i--, cmd++) { ++ if (cmd->type == RPI_PRED_INTRA) { ++ lc->tu.intra_pred_mode_c = lc->tu.intra_pred_mode = cmd->mode; ++ lc->na.cand_bottom_left = (cmd->na >> 4) & 1; ++ lc->na.cand_left = (cmd->na >> 3) & 1; ++ lc->na.cand_up_left = (cmd->na >> 2) & 1; ++ lc->na.cand_up = (cmd->na >> 1) & 1; ++ lc->na.cand_up_right = (cmd->na >> 0) & 1; ++ s->hpc.intra_pred[cmd->size - 2](s, cmd->x, cmd->y, cmd->c_idx); ++ } else { ++ s->hevcdsp.transform_add[cmd->size-2](cmd->dst, cmd->buf, cmd->stride); ++ } ++ } ++ s->num_pred_cmds = 0; ++ s->num_coeffs = 0; ++} ++#endif ++ + static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) + { + HEVCContext *s = avctxt->priv_data; +@@ -2302,6 +2385,10 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) + int y_ctb = 0; + int ctb_addr_ts = s->ps.pps->ctb_addr_rs_to_ts[s->sh.slice_ctb_addr_rs]; + ++#ifdef RPI ++ s->enable_rpi = 1; // TODO this should depend on cross component and frame width etc. ++#endif ++ + if (!ctb_addr_ts && s->sh.dependent_slice_segment_flag) { + av_log(s->avctx, AV_LOG_ERROR, "Impossible initial tile.\n"); + return AVERROR_INVALIDDATA; +@@ -2331,6 +2418,9 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) + s->filter_slice_edges[ctb_addr_rs] = s->sh.slice_loop_filter_across_slices_enabled_flag; + + more_data = hls_coding_quadtree(s, x_ctb, y_ctb, s->ps.sps->log2_ctb_size, 0); ++#ifdef RPI ++ rpi_execute_pred_cmds(s); ++#endif + if (more_data < 0) { + s->tab_slice_address[ctb_addr_rs] = -1; + return more_data; +@@ -2376,6 +2466,10 @@ static int hls_decode_entry_wpp(AVCodecContext *avctxt, void *input_ctb_row, int + s = s1->sList[self_id]; + lc = s->HEVClc; + ++#ifdef RPI ++ s->enable_rpi = 0; ++#endif ++ + if(ctb_row) { + ret = init_get_bits8(&lc->gb, s->data + s->sh.offset[ctb_row - 1], s->sh.size[ctb_row - 1]); + +@@ -3064,6 +3158,13 @@ static av_cold int hevc_decode_free(AVCodecContext *avctx) + + av_freep(&s->cabac_state); + ++#ifdef RPI ++ av_freep(&s->unif_mv_cmds); ++ av_freep(&s->unif_xfm_cmds); ++ av_freep(&s->univ_pred_cmds); ++ av_freep(&s->coeffs_buf); ++#endif ++ + for (i = 0; i < 3; i++) { + av_freep(&s->sao_pixel_buffer_h[i]); + av_freep(&s->sao_pixel_buffer_v[i]); +@@ -3123,6 +3224,22 @@ static av_cold int hevc_init_context(AVCodecContext *avctx) + s->HEVClcList[0] = s->HEVClc; + s->sList[0] = s; + ++#ifdef RPI ++ s->unif_mv_cmds = av_mallocz(sizeof(HEVCMvCmd)*RPI_MAX_MV_CMDS); ++ if (!s->unif_mv_cmds) ++ goto fail; ++ s->unif_xfm_cmds = av_mallocz(sizeof(HEVCXfmCmd)*RPI_MAX_XFM_CMDS); ++ if (!s->unif_xfm_cmds) ++ goto fail; ++ s->univ_pred_cmds = av_mallocz(sizeof(HEVCPredCmd)*RPI_MAX_PRED_CMDS); ++ if (!s->univ_pred_cmds) ++ goto fail; ++ s->coeffs_buf = av_mallocz(sizeof(int16_t)*RPI_MAX_XFM_CMDS*16); ++ if (!s->coeffs_buf) ++ goto fail; ++ s->enable_rpi = 0; ++#endif ++ + s->cabac_state = av_malloc(HEVC_CONTEXTS); + if (!s->cabac_state) + goto fail; +diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h +index c91f815..71174af 100644 +--- a/libavcodec/hevc.h ++++ b/libavcodec/hevc.h +@@ -23,6 +23,9 @@ + #ifndef AVCODEC_HEVC_H + #define AVCODEC_HEVC_H + ++// define RPI to split the CABAC/prediction/transform into separate stages ++#include "config.h" ++ + #include "libavutil/buffer.h" + #include "libavutil/md5.h" + +@@ -816,6 +819,49 @@ typedef struct HEVCLocalContext { + int boundary_flags; + } HEVCLocalContext; + ++#ifdef RPI ++ ++// RPI_MAX_WIDTH is maximum width in pixels supported by the accelerated code ++#define RPI_MAX_WIDTH 2048 ++ ++// Worst case is for 4:4:4 4x4 blocks with 64 high coding tree blocks, so 16 MV cmds per 4 pixels across for each colour plane ++#define RPI_MAX_MV_CMDS (16*3*(RPI_MAX_WIDTH/4)) ++#define RPI_MAX_XFM_CMDS (16*3*(RPI_MAX_WIDTH/4)) ++// Each block can have an intra prediction and a transform_add command ++#define RPI_MAX_PRED_CMDS (2*16*3*(RPI_MAX_WIDTH/4)) ++ ++// Command for inter prediction ++typedef struct HEVCMvCmd { ++} HEVCMvCmd; ++ ++// Command for transform to process a block of coefficients ++typedef struct HEVCXfmCmd { ++} HEVCXfmCmd; ++ ++// Command for intra prediction and transform_add of predictions to coefficients ++#define RPI_PRED_TRANSFORM_ADD 0 ++#define RPI_PRED_INTRA 1 ++typedef struct HEVCPredCmd { ++ uint8_t size; ++ uint8_t type; ++ uint8_t na; ++ uint8_t c_idx; ++ union { ++ uint8_t *dst; // RPI_PRED_TRANSFORM_ADD ++ uint32_t x; // RPI_PRED_INTRA ++ }; ++ union { ++ int16_t *buf; // RPI_PRED_TRANSFORM_ADD ++ uint32_t y; // RPI_PRED_INTRA ++ }; ++ union { ++ enum IntraPredMode mode; // RPI_PRED_TRANSFORM_ADD ++ uint32_t stride; // RPI_PRED_INTRA ++ }; ++} HEVCPredCmd; ++ ++#endif ++ + typedef struct HEVCContext { + const AVClass *c; // needed by private avoptions + AVCodecContext *avctx; +@@ -831,6 +877,18 @@ typedef struct HEVCContext { + int width; + int height; + ++#ifdef RPI ++ int enable_rpi; ++ HEVCMvCmd *unif_mv_cmds; ++ HEVCXfmCmd *unif_xfm_cmds; ++ HEVCPredCmd *univ_pred_cmds; ++ int16_t *coeffs_buf; ++ int num_mv_cmds; ++ int num_xfm_cmds; ++ int num_pred_cmds; ++ int num_coeffs; ++#endif ++ + uint8_t *cabac_state; + + /** 1 if the independent slice segment header was successfully parsed */ +diff --git a/libavcodec/hevc_cabac.c b/libavcodec/hevc_cabac.c +index d1bef83..c0fdfad 100644 +--- a/libavcodec/hevc_cabac.c ++++ b/libavcodec/hevc_cabac.c +@@ -1510,6 +1510,21 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, + coeffs[i] = coeffs[i] + ((lc->tu.res_scale_val * coeffs_y[i]) >> 3); + } + } ++#ifdef RPI ++ if (s->enable_rpi) { ++ int16_t *c = s->coeffs_buf + s->num_coeffs; ++ int n = trafo_size * trafo_size; ++ HEVCPredCmd *cmd = s->univ_pred_cmds + s->num_pred_cmds++; ++ memcpy(c, coeffs, n * sizeof(int16_t)); // TODO change pointer earlier and we can avoid this copy ++ s->num_coeffs += n; ++ cmd->type = RPI_PRED_TRANSFORM_ADD; ++ cmd->size = log2_trafo_size; ++ cmd->buf = c; ++ cmd->dst = dst; ++ cmd->stride = stride; ++ return; ++ } ++#endif + s->hevcdsp.transform_add[log2_trafo_size-2](dst, coeffs, stride); + } + +-- +2.5.0 + + +From 18fe64824d85a2ac9832bd5b600db8e52b5581fe Mon Sep 17 00:00:00 2001 +From: Peter de Rivaz <peter.derivaz@gmail.com> +Date: Thu, 30 Apr 2015 15:23:22 +0100 +Subject: [PATCH 03/68] Added simple VPU test code + +--- + libavcodec/Makefile | 7 + + libavcodec/hevc.c | 33 +- + libavcodec/rpi_hevc_transform.h | 212 ++++++ + libavcodec/rpi_hevc_transform.s | 147 ++++ + libavcodec/rpi_mailbox.c | 293 ++++++++ + libavcodec/rpi_mailbox.h | 20 + + libavcodec/rpi_qpu.c | 652 ++++++++++++++++++ + libavcodec/rpi_qpu.h | 45 ++ + libavcodec/rpi_shader.c | 818 ++++++++++++++++++++++ + libavcodec/rpi_shader.h | 20 + + libavcodec/rpi_shader.qasm | 1413 +++++++++++++++++++++++++++++++++++++++ + libavcodec/rpi_user_vcsm.h | 425 ++++++++++++ + 12 files changed, 4084 insertions(+), 1 deletion(-) + create mode 100644 libavcodec/rpi_hevc_transform.h + create mode 100644 libavcodec/rpi_hevc_transform.s + create mode 100644 libavcodec/rpi_mailbox.c + create mode 100644 libavcodec/rpi_mailbox.h + create mode 100644 libavcodec/rpi_qpu.c + create mode 100644 libavcodec/rpi_qpu.h + create mode 100644 libavcodec/rpi_shader.c + create mode 100644 libavcodec/rpi_shader.h + create mode 100644 libavcodec/rpi_shader.qasm + create mode 100644 libavcodec/rpi_user_vcsm.h + +diff --git a/libavcodec/Makefile b/libavcodec/Makefile +index f6a4fbb..0fd6767 100644 +--- a/libavcodec/Makefile ++++ b/libavcodec/Makefile +@@ -5,6 +5,10 @@ NAME = avcodec + HEADERS = avcodec.h \ + avdct.h \ + avfft.h \ ++ rpi_qpu.h \ ++ rpi_shader.h \ ++ rpi_mailbox.h \ ++ rpi_hevc_transform.h \ + dv_profile.h \ + d3d11va.h \ + dirac.h \ +@@ -39,6 +43,9 @@ OBJS = allcodecs.o \ + resample.o \ + resample2.o \ + utils.o \ ++ rpi_qpu.o \ ++ rpi_shader.o \ ++ rpi_mailbox.o \ + vorbis_parser.o \ + xiph.o \ + +diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c +index 2eebd31..681e9fd 100644 +--- a/libavcodec/hevc.c ++++ b/libavcodec/hevc.c +@@ -41,6 +41,10 @@ + #include "hevc.h" + #include "profiles.h" + ++#ifdef RPI ++#include "rpi_qpu.h" ++#endif ++ + const uint8_t ff_hevc_pel_weight[65] = { [2] = 0, [4] = 1, [6] = 2, [8] = 3, [12] = 4, [16] = 5, [24] = 6, [32] = 7, [48] = 8, [64] = 9 }; + + /** +@@ -2419,7 +2423,9 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) + + more_data = hls_coding_quadtree(s, x_ctb, y_ctb, s->ps.sps->log2_ctb_size, 0); + #ifdef RPI +- rpi_execute_pred_cmds(s); ++ if (x_ctb + ctb_size >= s->ps.sps->width) { ++ rpi_execute_pred_cmds(s); ++ } + #endif + if (more_data < 0) { + s->tab_slice_address[ctb_addr_rs] = -1; +@@ -3238,6 +3244,31 @@ static av_cold int hevc_init_context(AVCodecContext *avctx) + if (!s->coeffs_buf) + goto fail; + s->enable_rpi = 0; ++ ++ // A little test program ++ { ++ GPU_MEM_PTR_T p; ++ int err = gpu_malloc_cached(16, &p); ++ short *q = (short *)p.arm; ++ int i; ++ int r; ++ printf("Allocated memory %d ARM 0x%x, VC 0x%x, Code 0x%x\n",err,(int)p.arm,p.vc,(int)vpu_get_fn()); ++ printf("Allocated memory %d ARM 0x%x, VC 0x%x\n",err,(int)p.arm,p.vc); ++ printf("Preparing data %p\n",q); ++ for(i=0;i<16;i++) ++ q[i] = i; ++ printf("Flush cache\n"); ++ gpu_cache_flush(&p); ++ printf("Executing code\n"); ++ r = vpu_execute_code( vpu_get_fn(), p.vc, 0, 0, 0, 0, 0); ++ printf("Return value %d (",r); ++ for(i=0;i<16;i++) ++ printf("%d ",q[i]); ++ printf(")\n"); ++ gpu_free(&p); ++ goto fail; // Early out ++ } ++ + #endif + + s->cabac_state = av_malloc(HEVC_CONTEXTS); +diff --git a/libavcodec/rpi_hevc_transform.h b/libavcodec/rpi_hevc_transform.h +new file mode 100644 +index 0000000..85a9102 +--- /dev/null ++++ b/libavcodec/rpi_hevc_transform.h +@@ -0,0 +1,212 @@ ++unsigned char rpi_hevc_transform [] = { ++169, ++3, ++3, ++232, ++128, ++0, ++0, ++0, ++20, ++248, ++0, ++136, ++0, ++0, ++192, ++248, ++0, ++0, ++0, ++96, ++3, ++232, ++32, ++0, ++0, ++0, ++7, ++232, ++0, ++2, ++0, ++0, ++8, ++232, ++0, ++4, ++0, ++0, ++12, ++248, ++0, ++128, ++0, ++0, ++192, ++8, ++4, ++0, ++4, ++232, ++64, ++0, ++0, ++0, ++5, ++232, ++0, ++0, ++8, ++0, ++128, ++69, ++113, ++66, ++12, ++248, ++0, ++128, ++0, ++0, ++192, ++8, ++4, ++0, ++128, ++69, ++113, ++70, ++128, ++144, ++39, ++0, ++4, ++255, ++48, ++192, ++128, ++3, ++32, ++8, ++16, ++0, ++76, ++254, ++48, ++192, ++9, ++4, ++32, ++8, ++0, ++0, ++4, ++254, ++0, ++144, ++128, ++2, ++0, ++248, ++62, ++0, ++128, ++144, ++22, ++0, ++4, ++255, ++48, ++192, ++128, ++3, ++32, ++8, ++16, ++0, ++76, ++254, ++48, ++192, ++9, ++4, ++32, ++8, ++0, ++0, ++140, ++248, ++44, ++0, ++0, ++0, ++32, ++48, ++4, ++0, ++128, ++69, ++113, ++66, ++242, ++140, ++211, ++192, ++41, ++3, ++68, ++192, ++80, ++7, ++164, ++255, ++36, ++220, ++96, ++2, ++0, ++248, ++62, ++0, ++3, ++255, ++55, ++208, ++120, ++3, ++224, ++3, ++190, ++11, ++16, ++139, ++246, ++83, ++0, ++103, ++90, ++0, ++8, ++240, ++0, ++128, ++128, ++3, ++0, ++247, ++32, ++128, ++10, ++4, ++136, ++240, ++32, ++0, ++128, ++3, ++112, ++96, ++90, ++0, ++}; +diff --git a/libavcodec/rpi_hevc_transform.s b/libavcodec/rpi_hevc_transform.s +new file mode 100644 +index 0000000..5e2728d +--- /dev/null ++++ b/libavcodec/rpi_hevc_transform.s +@@ -0,0 +1,147 @@ ++# ****************************************************************************** ++# Argon Design Ltd. ++# (c) Copyright 2015 Argon Design Ltd. All rights reserved. ++# ++# Module : HEVC ++# Author : Peter de Rivaz ++# ****************************************************************************** ++ ++# HEVC VPU Transform ++# ++# Transform matrix can be thought of as ++# output row vector = input row vector * transMatrix2 ++# ++# The even rows of the matrix are symmetric ++# The odd rows of the matrix are antisymmetric ++# ++# So only need to compute the first half of the results, then can compute the remainder with a butterfly ++# ++# EXAMPLE ++# (a b c d) (1 2 2 1) ++# (3 4 -4 -3) ++# (5 6 6 5) ++# (7 8 -8 -7) ++# ++# x=(a c)(1 2) = 1a+5c 2a+6c ++# (5 6) ++# ++# y=(b d)(3 4) = 3b+7d 4b+8d ++# (7 8) ++# ++# u=x+y = 1a+5c+3b+7d 2a+4b+6c+8d ++# v=x-y = 1a+5c-3b-7d 2a+6c-4b-8d ++# ++# Final results are (u , v[::-1]) ++# ++# ++# For 32x1 input, load even rows into HX(0++,0), odd rows into HX(16++,0) ++# Apply the even matrix first and stop before rounding ++# Then apply the odd matrix in a full manner: ++# ++# First step is to compute partial products with the first input (16 cycles) ++# 1a 3b 5c 7d 16x1 input coefficients produce 16x16 output ++# 2a 4b 6c 8d ++# 2a -4b 6c -8d ++# 1a -3b 5c -7d ++# ++# Second step is to sum partial products into final position (8 cycles) ++# 1a+3b+5c+7d ++# 2a+4b+6c+8d ++# 2a-4b+6c-8d ++# 1a-3b+5c-7d ++# ++# Then can apply butterfly to combine even results and odd results + rounding to produce 16 rows of output at a time (need to save in transposed format) ++# ++# For 16x16 no butterfly is required and can store final results in original location (Could do 2 16x16s in parallel to make use of the trick - saves on the adds) ++# ++# For 8x8 we could compute two in parallel. ++# ++# ++ ++test_add: ++ vldh HX(0,0),(r0) ++ vadd HX(0,0),HX(0,0),10 ++ vsth HX(0,0),(r0) ++ mov r0,7 # return value ++ b lr ++ ++# Columns are transformed first ++# ++# Store top left half of transMatrix2 in ++# Store bottom left half of transMatrix2 in HX(32,32) ++# ++# For 16x16 ++# HX(0:15,0) contains input data before transform ++# HY(0:15,0) contains 32bit output data after transform ++# HX(32,0) contains even rows of left half of transMatrix2 ++# HX(32,32) contains odd rows of left half of transMatrix2 ++# HY(48,0) contains partial products ready for summing ++# ++ ++ ++# hevc_trans_16x16(short *transMatrix2, short *coeffs, int num) ++# transMatrix2: address of the constant matrix (must be at 32 byte aligned address in Videocore memory) ++# coeffs: address of the transform coefficients (must be at 32 byte aligned address in Videocore memory) ++# num: number of 16x16 transforms to be done ++# ++hevc_trans_16x16: ++ push r6-r15, lr # TODO cut down number of used registers ++ ++ mov r3, 2*32*2 # Twice Stride of transMatrix2 in bytes ++ vld HX(32++,0),(r0 += r3) REP 16 # This is the 16x16 matrix, a transform is equivalent to multiplying input row vector * matrix ++ # Now use r0 to describe which matrix we are working on. ++ # Allows us to prefetch the next block of coefficients for efficiency. ++ mov r0,0 # This describes the location where we read our coefficients from ++ mov r3,16*2 # Stride of coefficients in bytes ++ mov r7,16*16*2 # Total block size ++ mov r8,64*16 # Value used to swap from current to next VRF location ++ vldh HX(0++,0)+r0,(r1 += r3) REP 16 ++ mov r4,64 # Constant used for rounding first pass ++ mov r5,1<<19 # Constant used for rounding second pass ++ ++ # At start of block r0,r1 point to the current block (that has already been loaded) ++block_loop: ++ eor r0,r8 ++ add r1,r7 ++ # Prefetch the next block ++ vldh HX(0++,0)+r0,(r1 += r3) REP 16 ++ eor r0,r8 ++ sub r1,r7 ++ ++ # Transform the current block ++ bl col_trans_16 ++ vadd HY(0++,0)+r0,HY(0++,0)+r0,r4 REP 16 # Now add on rounding, shift down by 7, and saturate ++ #vsasls HY(0++,0)+r0,HY(0++,0)+r0,9 REP 16 # 9+7=16 so this ends up with the output saturated and in the top half of the word. ++ vasl HY(0++,0)+r0,HY(0++,0)+r0,9 REP 16 # This should be saturating, but the instruction above does not assemble? ++ vmov VX(0,0++), HX(0++,32) REP 16 # For simplicity transpose this back to the original position ++ ++ bl col_trans_16 ++ vadd HY(0++,0)+r0,HY(0++,0)+r0,r4 REP 16 # Now add on rounding, shift down by 7, and saturate ++ #vsasls HY(0++,0)+r0,HY(0++,0)+r0,9 REP 16 # 9+7=16 so this ends up with the output saturated and in the top half of the word. ++ vasl HY(0++,0)+r0,HY(0++,0)+r0,9 REP 16 # This should be saturating, but the instruction above does not assemble? ++ ++ # Save results - note there has been a transposition during the processing so we save columns ++ vsth VX(0,32++)+r0, (r1 += r3) REP 16 ++ ++ # Move onto next block ++ eor r0,r8 ++ add r1,r7 ++ ++ addcmpbgt r2,-1,0,block_loop ++ pop r6-r15, pc ++ ++# r1,r2,r3 r7,r8 should be preserved ++# HX(0++,0)+r0 is the block to be transformed ++# HX(32++,0) is the 16x16 matrix of transform coefficients ++# Use HY(48,0) for intermediate results ++# r0 can be used, but should be returned to its original value at the end ++col_trans_16: ++ add r4,r0,16 # Final value for this loop ++col_trans_16_loop: ++ # First compute partial products for a single column ++ vmul32s VY(48,0++), VX(0,0)+r0, VX(32,0++) REP 16 ++ # Then sum up the results and place back ++ vadd VY(0,0)+r0, VY(48,0++), VY(48,8++) REP 8 CLRA SACC ++ addcmpblt r0,1,r4,col_trans_16_loop ++ sub r0,16 # but r0 back to its original value ++ b lr +diff --git a/libavcodec/rpi_mailbox.c b/libavcodec/rpi_mailbox.c +new file mode 100644 +index 0000000..536896f +--- /dev/null ++++ b/libavcodec/rpi_mailbox.c +@@ -0,0 +1,293 @@ ++/* ++Copyright (c) 2012, Broadcom Europe Ltd. ++All rights reserved. ++ ++Redistribution and use in source and binary forms, with or without ++modification, are permitted provided that the following conditions are met: ++ * Redistributions of source code must retain the above copyright ++ notice, this list of conditions and the following disclaimer. ++ * 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. ++ * Neither the name of the copyright holder nor the ++ names of its contributors may be used to endorse or promote products ++ derived from this software without specific prior written permission. ++ ++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY ++DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ++(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; ++LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ++ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ++(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++*/ ++ ++#include <stdio.h> ++#include <string.h> ++#include <stdlib.h> ++#include <fcntl.h> ++#include <unistd.h> ++#include <assert.h> ++#include <stdint.h> ++#include <sys/mman.h> ++#include <sys/ioctl.h> ++ ++#include <linux/ioctl.h> ++ ++#define MAJOR_NUM 100 ++#define IOCTL_MBOX_PROPERTY _IOWR(MAJOR_NUM, 0, char *) ++#define DEVICE_FILE_NAME "/dev/char_dev" ++ ++#include "rpi_mailbox.h" ++ ++#define PAGE_SIZE (4*1024) ++ ++// Shared memory will not be cached in ARM cache ++void *mapmem_shared(unsigned base, unsigned size) ++{ ++ int mem_fd; ++ unsigned offset = base % PAGE_SIZE; ++ base = base - offset; ++ /* open /dev/mem */ ++ if ((mem_fd = open("/dev/mem", O_RDWR|O_SYNC) ) < 0) { ++ printf("can't open /dev/mem\nThis program should be run as root. Try prefixing command with: sudo\n"); ++ return NULL; ++ } ++ void *mem = mmap( ++ 0, ++ size, ++ PROT_READ|PROT_WRITE, ++ MAP_SHARED/*|MAP_FIXED*/, ++ mem_fd, ++ base); ++#ifdef DEBUG ++ printf("base=0x%x, mem=%p\n", base, mem); ++#endif ++ if (mem == MAP_FAILED) { ++ printf("mmap error %d\n", (int)mem); ++ return NULL; ++ } ++ close(mem_fd); ++ return (char *)mem + offset; ++} ++ ++// Unshared memory will be faster as lives in ARM cache, but requires cache flushing ++void *mapmem_private(unsigned base, unsigned size) ++{ ++ int mem_fd; ++ unsigned offset = base % PAGE_SIZE; ++ base = base - offset; ++ /* open /dev/mem */ ++ if ((mem_fd = open("/dev/mem", O_RDWR|O_SYNC) ) < 0) { ++ printf("can't open /dev/mem\nThis program should be run as root. Try prefixing command with: sudo\n"); ++ return NULL; ++ } ++ void *mem = mmap( ++ 0, ++ size, ++ PROT_READ|PROT_WRITE, ++ MAP_PRIVATE/*|MAP_FIXED*/, ++ mem_fd, ++ base); ++#ifdef DEBUG ++ printf("base=0x%x, mem=%p\n", base, mem); ++#endif ++ if (mem == MAP_FAILED) { ++ printf("mmap error %d\n", (int)mem); ++ return NULL; ++ } ++ close(mem_fd); ++ return (char *)mem + offset; ++} ++ ++void unmapmem(void *addr, unsigned size) ++{ ++ int s = munmap(addr, size); ++ if (s != 0) { ++ printf("munmap error %d\n", s); ++ exit (-1); ++ } ++} ++ ++/* ++ * use ioctl to send mbox property message ++ */ ++ ++static int mbox_property(int file_desc, void *buf) ++{ ++ int ret_val = ioctl(file_desc, IOCTL_MBOX_PROPERTY, buf); ++ ++ if (ret_val < 0) { ++ printf("ioctl_set_msg failed:%d\n", ret_val); ++ } ++ ++#ifdef DEBUG ++ unsigned *p = buf; int i; unsigned size = *(unsigned *)buf; ++ for (i=0; i<size/4; i++) ++ printf("%04x: 0x%08x\n", i*sizeof *p, p[i]); ++#endif ++ return ret_val; ++} ++ ++unsigned mem_alloc(int file_desc, unsigned size, unsigned align, unsigned flags) ++{ ++ int i=0; ++ unsigned p[32]; ++ p[i++] = 0; // size ++ p[i++] = 0x00000000; // process request ++ ++ p[i++] = 0x3000c; // (the tag id) ++ p[i++] = 12; // (size of the buffer) ++ p[i++] = 12; // (size of the data) ++ p[i++] = size; // (num bytes? or pages?) ++ p[i++] = align; // (alignment) ++ p[i++] = flags; // (MEM_FLAG_L1_NONALLOCATING) ++ ++ p[i++] = 0x00000000; // end tag ++ p[0] = i*sizeof *p; // actual size ++ ++ mbox_property(file_desc, p); ++ return p[5]; ++} ++ ++unsigned mem_free(int file_desc, unsigned handle) ++{ ++ int i=0; ++ unsigned p[32]; ++ p[i++] = 0; // size ++ p[i++] = 0x00000000; // process request ++ ++ p[i++] = 0x3000f; // (the tag id) ++ p[i++] = 4; // (size of the buffer) ++ p[i++] = 4; // (size of the data) ++ p[i++] = handle; ++ ++ p[i++] = 0x00000000; // end tag ++ p[0] = i*sizeof *p; // actual size ++ ++ mbox_property(file_desc, p); ++ return p[5]; ++} ++ ++unsigned mem_lock(int file_desc, unsigned handle) ++{ ++ int i=0; ++ unsigned p[32]; ++ p[i++] = 0; // size ++ p[i++] = 0x00000000; // process request ++ ++ p[i++] = 0x3000d; // (the tag id) ++ p[i++] = 4; // (size of the buffer) ++ p[i++] = 4; // (size of the data) ++ p[i++] = handle; ++ ++ p[i++] = 0x00000000; // end tag ++ p[0] = i*sizeof *p; // actual size ++ ++ mbox_property(file_desc, p); ++ return p[5]; ++} ++ ++unsigned mem_unlock(int file_desc, unsigned handle) ++{ ++ int i=0; ++ unsigned p[32]; ++ p[i++] = 0; // size ++ p[i++] = 0x00000000; // process request ++ ++ p[i++] = 0x3000e; // (the tag id) ++ p[i++] = 4; // (size of the buffer) ++ p[i++] = 4; // (size of the data) ++ p[i++] = handle; ++ ++ p[i++] = 0x00000000; // end tag ++ p[0] = i*sizeof *p; // actual size ++ ++ mbox_property(file_desc, p); ++ return p[5]; ++} ++ ++unsigned execute_code(int file_desc, unsigned code, unsigned r0, unsigned r1, unsigned r2, unsigned r3, unsigned r4, unsigned r5) ++{ ++ int i=0; ++ unsigned p[32]; ++ p[i++] = 0; // size ++ p[i++] = 0x00000000; // process request ++ ++ p[i++] = 0x30010; // (the tag id) ++ p[i++] = 28; // (size of the buffer) ++ p[i++] = 28; // (size of the data) ++ p[i++] = code; ++ p[i++] = r0; ++ p[i++] = r1; ++ p[i++] = r2; ++ p[i++] = r3; ++ p[i++] = r4; ++ p[i++] = r5; ++ ++ p[i++] = 0x00000000; // end tag ++ p[0] = i*sizeof *p; // actual size ++ ++ mbox_property(file_desc, p); ++ return p[5]; ++} ++ ++unsigned qpu_enable(int file_desc, unsigned enable) ++{ ++ int i=0; ++ unsigned p[32]; ++ ++ p[i++] = 0; // size ++ p[i++] = 0x00000000; // process request ++ ++ p[i++] = 0x30012; // (the tag id) ++ p[i++] = 4; // (size of the buffer) ++ p[i++] = 4; // (size of the data) ++ p[i++] = enable; ++ ++ p[i++] = 0x00000000; // end tag ++ p[0] = i*sizeof *p; // actual size ++ ++ mbox_property(file_desc, p); ++ return p[5]; ++} ++ ++unsigned execute_qpu(int file_desc, unsigned num_qpus, unsigned control, unsigned noflush, unsigned timeout) { ++ int i=0; ++ unsigned p[32]; ++ ++ p[i++] = 0; // size ++ p[i++] = 0x00000000; // process request ++ p[i++] = 0x30011; // (the tag id) ++ p[i++] = 16; // (size of the buffer) ++ p[i++] = 16; // (size of the data) ++ p[i++] = num_qpus; ++ p[i++] = control; ++ p[i++] = noflush; ++ p[i++] = timeout; // ms ++ ++ p[i++] = 0x00000000; // end tag ++ p[0] = i*sizeof *p; // actual size ++ ++ mbox_property(file_desc, p); ++ return p[5]; ++} ++ ++int mbox_open() { ++ int file_desc; ++ ++ // open a char device file used for communicating with kernel mbox driver ++ file_desc = open(DEVICE_FILE_NAME, 0); ++ if (file_desc < 0) { ++ printf("Can't open device file: %s\n", DEVICE_FILE_NAME); ++ printf("Try creating a device file with: sudo mknod %s c %d 0\n", DEVICE_FILE_NAME, MAJOR_NUM); ++ } ++ return file_desc; ++} ++ ++void mbox_close(int file_desc) { ++ close(file_desc); ++} +diff --git a/libavcodec/rpi_mailbox.h b/libavcodec/rpi_mailbox.h +new file mode 100644 +index 0000000..c264d2e +--- /dev/null ++++ b/libavcodec/rpi_mailbox.h +@@ -0,0 +1,20 @@ ++#ifndef RPI_MAILBOX_H ++#define RPI_MAILBOX_H ++ ++extern int mbox_open(void); ++extern void mbox_close(int file_desc); ++ ++extern unsigned get_version(int file_desc); ++extern unsigned mem_alloc(int file_desc, unsigned size, unsigned align, unsigned flags); ++extern unsigned mem_free(int file_desc, unsigned handle); ++extern unsigned mem_lock(int file_desc, unsigned handle); ++extern unsigned mem_unlock(int file_desc, unsigned handle); ++extern void *mapmem_shared(unsigned base, unsigned size); ++extern void *mapmem_private(unsigned base, unsigned size); ++extern void unmapmem(void *addr, unsigned size); ++ ++extern unsigned execute_code(int file_desc, unsigned code, unsigned r0, unsigned r1, unsigned r2, unsigned r3, unsigned r4, unsigned r5); ++extern unsigned execute_qpu(int file_desc, unsigned num_qpus, unsigned control, unsigned noflush, unsigned timeout); ++extern unsigned qpu_enable(int file_desc, unsigned enable); ++ ++#endif +diff --git a/libavcodec/rpi_qpu.c b/libavcodec/rpi_qpu.c +new file mode 100644 +index 0000000..b1f50ee +--- /dev/null ++++ b/libavcodec/rpi_qpu.c +@@ -0,0 +1,652 @@ ++#ifdef RPI ++// Use the vcsm device for shared memory ++// This works better than the mmap in that the memory can be cached, but requires a kernel modification to enable the device. ++#define RPI_USE_VCSM ++#define RPI_TIME_TOTAL_QPU ++ ++#include <stdio.h> ++#include <stdlib.h> ++#include <string.h> ++#include <stddef.h> ++#include <assert.h> ++ ++#include "config.h" ++ ++#include <pthread.h> ++#include <time.h> ++ ++#include "rpi_mailbox.h" ++#include "rpi_qpu.h" ++#include "rpi_shader.h" ++#include "rpi_hevc_transform.h" ++ ++#ifdef RPI_USE_VCSM ++#include "rpi_user_vcsm.h" ++#endif ++ ++// On Pi2 there is no way to access the VPU L2 cache ++// GPU_MEM_FLG should be 4 for uncached memory. ++// However, if using VCSM allocated buffers, need to use C at the moment because VCSM does not allocate uncached memory correctly ++// The QPU crashes if we mix L2 cached and L2 uncached accesses due to a HW bug. ++#define GPU_MEM_FLG 0xC ++#define GPU_MEM_MAP 0x0 ++ ++#define vcos_verify(x) ((x)>=0) ++ ++typedef unsigned char uint8_t; ++typedef signed char int8_t; ++typedef unsigned short uint16_t; ++typedef unsigned int uint32_t; ++typedef int int32_t; ++ ++/*static const unsigned code[] = ++{ ++ #include "rpi_shader.hex" ++};*/ ++ ++// Size in 32bit words ++#define QPU_CODE_SIZE 2048 ++#define VPU_CODE_SIZE 2048 ++ ++struct GPU ++{ ++ unsigned int qpu_code[QPU_CODE_SIZE]; ++ unsigned int vpu_code[VPU_CODE_SIZE]; ++ int open_count; // Number of allocated video buffers ++ unsigned int vc_handle; // Handle of this memory ++ int mb; // Mailbox handle ++ int vc; // Address in GPU memory ++ int mail[12]; // These are used to pass pairs of code/unifs to the QPUs ++}; ++ ++// Stop more than one thread trying to allocate memory or use the processing resources at once ++static pthread_mutex_t gpu_mutex = PTHREAD_MUTEX_INITIALIZER; ++static volatile struct GPU* gpu = NULL; ++ ++#ifdef RPI_TIME_TOTAL_QPU ++static unsigned int Microseconds(void) { ++ struct timespec ts; ++ unsigned int x; ++ static unsigned int base = 0; ++ clock_gettime(CLOCK_REALTIME, &ts); ++ x = ts.tv_sec*1000000 + ts.tv_nsec/1000; ++ if (base==0) base=x; ++ return x-base; ++} ++#endif ++ ++// Connect to QPU, returns 0 on success. ++static int gpu_init(volatile struct GPU **gpu) { ++ int mb = mbox_open(); ++ int vc; ++ int handle; ++ volatile struct GPU* ptr; ++ if (mb < 0) ++ return -1; ++ ++ if (qpu_enable(mb, 1)) return -2; ++ ++#ifdef RPI_USE_VCSM ++ vcsm_init(); ++#endif ++ ++ handle = mem_alloc(mb, sizeof(struct GPU), 4096, GPU_MEM_FLG); ++ if (!handle) ++ { ++ qpu_enable(mb, 0); ++ return -3; ++ } ++ vc = mem_lock(mb, handle); ++ ptr = mapmem_shared((vc+GPU_MEM_MAP)&~0xc0000000, sizeof(struct GPU)); ++ if (ptr == NULL) ++ { mem_free(mb, handle); ++ mem_unlock(mb, handle); ++ qpu_enable(mb, 0); ++ return -4; ++ } ++ ++ ptr->mb = mb; ++ ptr->vc_handle = handle; ++ ptr->vc = vc; ++ ++ *gpu = ptr; ++ ++ // Now copy over the QPU code into GPU memory ++ { ++ int num_bytes = qpu_get_fn(QPU_MC_END) - qpu_get_fn(QPU_MC_SETUP); ++ assert(num_bytes<=QPU_CODE_SIZE*sizeof(unsigned int)); ++ memcpy((void*)ptr->qpu_code, rpi_shader, num_bytes); ++ } ++ // And the VPU code ++ { ++ int num_bytes = sizeof(rpi_hevc_transform); ++ assert(num_bytes<=VPU_CODE_SIZE*sizeof(unsigned int)); ++ memcpy((void*)ptr->vpu_code, rpi_hevc_transform, num_bytes); ++ } ++ ++ return 0; ++} ++ ++// Make sure we have exclusive access to the mailbox, and enable qpu if necessary. ++static void gpu_lock(void) { ++ pthread_mutex_lock(&gpu_mutex); ++ if (gpu==NULL) { ++ gpu_init(&gpu); ++ } ++} ++ ++static void gpu_unlock(void) { ++ pthread_mutex_unlock(&gpu_mutex); ++} ++ ++// Allocate memory on GPU ++// Fills in structure <p> containing ARM pointer, videocore handle, videocore memory address, numbytes ++// Returns 0 on success. ++// This allocates memory that will not be cached in ARM's data cache. ++// Therefore safe to use without data cache flushing. ++int gpu_malloc_uncached(int numbytes, GPU_MEM_PTR_T *p) { ++ gpu_lock(); ++ p->vc_handle = mem_alloc(gpu->mb, numbytes, 4096, GPU_MEM_FLG); ++ p->vcsm_handle = 0; ++ if (!p->vc_handle) ++ { ++ qpu_enable(gpu->mb, 0); ++ return -3; ++ } ++ p->vc = mem_lock(gpu->mb, p->vc_handle); ++ p->arm = mapmem_shared((p->vc+GPU_MEM_MAP)&~0xc0000000,numbytes); ++ p->numbytes = numbytes; ++ if (p->arm == NULL) ++ { ++ mem_free(gpu->mb, p->vc_handle); ++ mem_unlock(gpu->mb, p->vc_handle); ++ gpu_unlock(); ++ qpu_enable(gpu->mb, 0); ++ return -4; ++ } ++ gpu->open_count++; ++ gpu_unlock(); ++ return 0; ++} ++ ++void gpu_cache_flush(GPU_MEM_PTR_T *p) ++{ ++ // This only works when using RPI_USE_VCSM ++ void *tmp = vcsm_lock(p->vcsm_handle); ++ vcsm_unlock_ptr(tmp); ++} ++ ++// This allocates data that will be ++// Cached in ARM L2 ++// Uncached in VPU L2 ++int gpu_malloc_cached(int numbytes, GPU_MEM_PTR_T *p) { ++ gpu_lock(); ++#ifdef RPI_USE_VCSM ++ { ++ p->vcsm_handle = vcsm_malloc_cache(numbytes, VCSM_CACHE_TYPE_HOST, (char *)"Video Frame" ); // f....... locks up for VP9 - retest this? ++ //p->vcsm_handle = vcsm_malloc_cache(numbytes, VCSM_CACHE_TYPE_VC, (char *)"Video Frame" ); // 3b...... works ++ //p->vcsm_handle = vcsm_malloc_cache(numbytes, VCSM_CACHE_TYPE_NONE, (char *)"Video Frame" ); //fb...... locks up ++ //p->vcsm_handle = vcsm_malloc_cache(numbytes, VCSM_CACHE_TYPE_HOST_AND_VC, (char *)"Video Frame" ); // 3b works (but corrupted due to caching) ++ p->vc_handle = vcsm_vc_hdl_from_hdl(p->vcsm_handle); ++ p->arm = vcsm_lock(p->vcsm_handle); ++ p->vc = mem_lock(gpu->mb, p->vc_handle); ++ } ++#else ++ p->vc_handle = mem_alloc(gpu->mb, numbytes, 4096, GPU_MEM_FLG); ++ p->vcsm_handle = 0; ++ if (!p->handle) ++ { ++ qpu_enable(gpu->mb, 0); ++ return -3; ++ } ++ p->vc = mem_lock(gpu->mb, p->vc_handle); ++ printf("This mapmem_private does not seem to work\n"); ++ exit(-1); ++ p->arm = mapmem_private((p->vc+GPU_MEM_MAP)&~0xc0000000,numbytes); ++ p->numbytes = numbytes; ++ if (p->arm == NULL) ++ { ++ mem_free(gpu->mb, p->handle); ++ mem_unlock(gpu->mb, p->handle); ++ gpu_unlock(); ++ qpu_enable(gpu->mb, 0); ++ return -4; ++ } ++#endif ++ gpu->open_count++; ++ gpu_unlock(); ++ return 0; ++} ++ ++static void gpu_term(void) ++{ ++ int mb = gpu->mb; ++ unsigned handle = gpu->vc_handle; ++ if (gpu==NULL) ++ return; ++ unmapmem((void*)gpu, sizeof(struct GPU)); ++ mem_unlock(mb, handle); ++ mem_free(mb, handle); ++ qpu_enable(mb, 0); ++#ifdef RPI_USE_VCSM ++ vcsm_exit(); ++#endif ++ mbox_close(mb); ++ gpu = NULL; ++} ++ ++void gpu_free(GPU_MEM_PTR_T *p) { ++ int mb = gpu->mb; ++ unsigned handle = p->vc_handle; ++ gpu_lock(); ++#ifdef RPI_USE_VCSM ++ if (p->vcsm_handle) { ++ mem_unlock(mb,p->vc_handle); ++ vcsm_unlock_ptr(p->arm); ++ vcsm_free(p->vcsm_handle); ++ } else { ++ unmapmem((void*)p->arm, sizeof(struct GPU)); ++ mem_unlock(mb, handle); ++ mem_free(mb, handle); ++ } ++#else ++ unmapmem((void*)p->arm, sizeof(struct GPU)); ++ mem_unlock(mb, handle); ++ mem_free(mb, handle); ++#endif ++ ++ gpu->open_count--; ++ if (gpu->open_count==0) { ++ printf("Closing GPU\n"); ++ gpu_term(); ++ gpu = NULL; ++ } ++ gpu_unlock(); ++} ++ ++unsigned int vpu_get_fn(void) { ++ // Make sure that the gpu is initialized ++ if (gpu==NULL) { ++ printf("Preparing gpu\n"); ++ gpu_lock(); ++ gpu_unlock(); ++ } ++ return gpu->vc + offsetof(struct GPU,vpu_code); ++} ++ ++unsigned vpu_execute_code( unsigned code, unsigned r0, unsigned r1, unsigned r2, unsigned r3, unsigned r4, unsigned r5) ++{ ++ unsigned r; ++ gpu_lock(); ++ r = execute_code(gpu->mb, code, r0, r1, r2, r3, r4, r5); ++ gpu_unlock(); ++ return r; ++} ++ ++// Run a program on a QPU with the given code and uniform stream (given in GPU addresses) ++// The first num QPUs will start at code, the next num2 QPUs will start at code2 ++void qpu_run_shader12(int code, int num, int code2, int num2, int unifs1, int unifs2, int unifs3, int unifs4, int unifs5, int unifs6, int unifs7, int unifs8, int unifs9, int unifs10, int unifs11, int unifs12) ++{ ++ int i; ++#ifdef RPI_TIME_TOTAL_QPU ++ static int last_time=0; ++ static long long on_time=0; ++ static long long off_time=0; ++ int start_time; ++ int end_time; ++ static int count=0; ++#endif ++ ++ gpu_lock(); ++#ifdef RPI_TIME_TOTAL_QPU ++ start_time = Microseconds(); ++ if (last_time==0) ++ last_time = start_time; ++ off_time += start_time-last_time; ++#endif ++ for(i=0;i<num;i++) { ++ gpu->mail[i*2 + 1] = code; ++ } ++ for(;i<num+num2;i++) { ++ gpu->mail[i*2 + 1] = code2; ++ } ++ gpu->mail[0 ] = unifs1; ++ gpu->mail[2 ] = unifs2; ++ gpu->mail[4 ] = unifs3; ++ gpu->mail[6 ] = unifs4; ++ gpu->mail[8 ] = unifs5; ++ gpu->mail[10] = unifs6; ++ gpu->mail[12] = unifs7; ++ gpu->mail[14] = unifs8; ++ gpu->mail[16] = unifs9; ++ gpu->mail[18] = unifs10; ++ gpu->mail[20] = unifs11; ++ gpu->mail[22] = unifs12; ++ execute_qpu( ++ gpu->mb, ++ 12 /* Number of QPUs */, ++ gpu->vc + offsetof(struct GPU, mail), ++ 1 /* no flush */, // Don't flush VPU L1 cache ++ 5000 /* timeout ms */); ++#ifdef RPI_TIME_TOTAL_QPU ++ end_time = Microseconds(); ++ last_time = end_time; ++ on_time += end_time - start_time; ++ count++; ++ if ((count&0x7f)==0) ++ printf("On=%dms, Off=%dms\n",(int)(on_time/1000),(int)(off_time/1000)); ++#endif ++ gpu_unlock(); ++} ++ ++unsigned int qpu_get_fn(int num) { ++ // Make sure that the gpu is initialized ++ unsigned int *fn; ++ if (gpu==NULL) { ++ printf("Preparing gpu\n"); ++ gpu_lock(); ++ gpu_unlock(); ++ } ++ switch(num) { ++ case QPU_MC_SETUP: ++ fn = mc_setup; ++ break; ++ case QPU_MC_FILTER: ++ fn = mc_filter; ++ break; ++ case QPU_MC_EXIT: ++ fn = mc_exit; ++ break; ++ case QPU_MC_INTERRUPT_EXIT: ++ fn = mc_interrupt_exit; ++ break; ++ case QPU_MC_FILTER_B: ++ fn = mc_filter_b; ++ break; ++ case QPU_MC_FILTER_HONLY: ++ fn = mc_filter_honly; ++ break; ++ case QPU_MC_SETUP_UV: ++ fn = mc_setup_uv; ++ break; ++ case QPU_MC_FILTER_UV: ++ fn = mc_filter_uv; ++ break; ++ case QPU_MC_FILTER_UV_B: ++ fn = mc_filter_uv_b; ++ break; ++ case QPU_MC_END: ++ fn = mc_end; ++ break; ++ default: ++ printf("Unknown function\n"); ++ exit(-1); ++ } ++ return gpu->vc + 4*(int)(fn-rpi_shader); ++ //return code[num] + gpu->vc; ++} ++ ++#if 0 ++ ++int32_t hcoeffs[] = {-4, 10, -21, 70, 90, -24, 11, -4}; ++//int32_t hcoeffs[] = {1, 1, 1, 1, 1, 1, 1, 1}; ++int32_t vcoeffs[] = {-2, 6, -13, 37, 115, -20, 9, -4}; ++//int32_t vcoeffs[] = {1, 1, 1, 1, 1, 1, 1, 1}; ++ ++#define ENCODE_COEFFS(c0, c1, c2, c3) (((c0-1) & 0xff) | ((c1-1) & 0xff) << 8 | ((c2-1) & 0xff) << 16 | ((c3-1) & 0xff) << 24); ++ ++static uint8_t av_clip_uint8(int32_t a) ++{ ++ if (a&(~255)) return (-a)>>31; ++ else return a; ++} ++ ++static int32_t filter8(const uint8_t *data, int pitch) ++{ ++ int32_t vsum = 0; ++ int x, y; ++ ++ for (y = 0; y < 8; y++) { ++ int32_t hsum = 0; ++ ++ for (x = 0; x < 8; x++) ++ hsum += hcoeffs[x]*data[x + y * pitch]; ++ ++ vsum += vcoeffs[y]*av_clip_uint8( (hsum + 64) >> 7); // Added brackets to stop compiler warning ++ } ++ ++ return av_clip_uint8( (vsum + 64) >> 7); ++} ++ ++// Note regression changes coefficients so is not thread safe ++//#define REGRESSION ++#ifdef REGRESSION ++#define CMAX 100 ++#else ++#define CMAX 2 ++#endif ++#define YMAX 16 ++ ++int rpi_test_shader(void) ++{ ++ int i, c; ++ ++ uint32_t *unifs; ++ ++ uint8_t *in_buffer; ++ uint8_t *out_buffer[2]; ++ ++ GPU_MEM_PTR_T unifs_ptr; ++ GPU_MEM_PTR_T in_buffer_ptr; ++ GPU_MEM_PTR_T out_buffer_ptr[2]; ++ ++ // Addresses in GPU memory of filter programs ++ uint32_t mc_setup = 0; ++ uint32_t mc_filter = 0; ++ uint32_t mc_exit = 0; ++ ++ int pitch = 0x500; ++ ++ if (gpu==NULL) { ++ gpu_lock(); ++ gpu_unlock(); ++ } ++ ++ printf("This needs to change to reflect new assembler\n"); ++ // Use table to compute locations of program start points ++ mc_setup = code[0] + gpu->vc; ++ mc_filter = code[1] + gpu->vc; ++ mc_exit = code[2] + gpu->vc; ++ ++ if (!vcos_verify(gpu_malloc_uncached(4*64,&unifs_ptr))) { ++ return -2; ++ } ++ unifs = (uint32_t*)unifs_ptr.arm; ++ ++ if (!vcos_verify(gpu_malloc_uncached(64*23,&in_buffer_ptr))) { ++ return -3; ++ } ++ in_buffer = (uint8_t*)in_buffer_ptr.arm; ++ ++ if (!vcos_verify(gpu_malloc_uncached(16*pitch,&out_buffer_ptr[0])) || !vcos_verify(gpu_malloc_uncached(16*pitch,&out_buffer_ptr[1]))) { ++ return -4; ++ } ++ out_buffer[0] = (uint8_t*)out_buffer_ptr[0].arm; ++ out_buffer[1] = (uint8_t*)out_buffer_ptr[1].arm; ++ ++ for (c = 0; c < CMAX; c++) { ++ int xo[] = {rand()&31, rand()&31}; ++ ++#ifdef REGRESSION ++ for (i = 0; i < 8; i++) { ++ hcoeffs[i] = (int8_t)rand(); ++ vcoeffs[i] = (int8_t)rand(); ++ if (hcoeffs[i]==-128) ++ hcoeffs[i]++; ++ if (vcoeffs[i]==-128) ++ vcoeffs[i]++; ++ } ++#endif ++ ++ for (i = 0; i < 64*23; i++) { ++ //printf("%d %d %p\n",i,gpu->mb,&in_buffer[i]); ++ in_buffer[i] = rand(); ++ } ++ ++ // Clear output array ++ { ++ int b; ++ for(b=0;b<2;b++) { ++ for(i=0;i<16*16;i++) { ++ out_buffer[b][i] = 3; ++ } ++ } ++ } ++ ++ unifs[0] = mc_filter; ++ unifs[1] = in_buffer_ptr.vc+xo[0]+16; ++ unifs[2] = 64; // src pitch ++ unifs[3] = pitch; // dst pitch ++ unifs[4] = 0; // Padding ++ unifs[5] = 0; ++ unifs[6] = 0; ++ unifs[7 ] = mc_filter; ++ unifs[8 ] = in_buffer_ptr.vc+xo[1]+16; ++ unifs[9 ] = ENCODE_COEFFS(hcoeffs[0], hcoeffs[1], hcoeffs[2], hcoeffs[3]); ++ unifs[10] = ENCODE_COEFFS(hcoeffs[4], hcoeffs[5], hcoeffs[6], hcoeffs[7]); ++ unifs[11] = ENCODE_COEFFS(vcoeffs[0], vcoeffs[1], vcoeffs[2], vcoeffs[3]); ++ unifs[12] = ENCODE_COEFFS(vcoeffs[4], vcoeffs[5], vcoeffs[6], vcoeffs[7]); ++ unifs[13] = out_buffer_ptr[0].vc; ++ unifs[14] = mc_exit; ++ unifs[15] = in_buffer_ptr.vc+xo[1]+16; // dummy ++ unifs[16] = ENCODE_COEFFS(hcoeffs[0], hcoeffs[1], hcoeffs[2], hcoeffs[3]); ++ unifs[17] = ENCODE_COEFFS(hcoeffs[4], hcoeffs[5], hcoeffs[6], hcoeffs[7]); ++ unifs[18] = ENCODE_COEFFS(vcoeffs[0], vcoeffs[1], vcoeffs[2], vcoeffs[3]); ++ unifs[19] = ENCODE_COEFFS(vcoeffs[4], vcoeffs[5], vcoeffs[6], vcoeffs[7]); ++ unifs[20] = out_buffer_ptr[1].vc; ++ ++ printf("Gpu->vc=%x Code=%x dst=%x\n",gpu->vc, mc_filter,out_buffer_ptr[1].vc); ++ ++ // flush_dcache(); TODO is this needed on ARM side? - tried to use the direct alias to avoid this problem ++ ++ //qpu_run_shader(mc_setup, unifs_ptr.vc); ++ //qpu_run_shader(gpu, gpu->vc, unifs_ptr.vc); ++ rpi_do_block(in_buffer_ptr.vc+xo[0]+16, 64, out_buffer_ptr[0].vc, pitch,out_buffer[0]); ++ rpi_do_block(in_buffer_ptr.vc+xo[1]+16, 64, out_buffer_ptr[1].vc, pitch,out_buffer[1]); ++ ++ if (1) ++ { ++ int x, y, b; ++ int bad = 0; ++ ++ for (b=0; b<2; ++b) ++ for (y=0; y<YMAX; ++y) ++ for (x=0; x<16; ++x) { ++ int32_t ref = filter8(in_buffer+x+y*64+xo[b], 64); ++ ++ if (out_buffer[b][x+y*pitch] != ref) { ++ bad = 1; ++// printf("%d, %d, %d, %d\n", c, b, x, y); ++ } ++#ifndef REGRESSION ++ //printf("%08x %08x\n", out_buffer[b][x+y*pitch], ref); ++#endif ++ } ++ if (bad) ++ printf("Failed dst=%x test=%d\n",out_buffer_ptr[1].vc,c); ++ else ++ printf("Passed dst=%x test=%d\n",out_buffer_ptr[1].vc,c); ++ } ++ //printf("%d\n", simpenrose_get_qpu_tick_count()); ++ } ++ ++ gpu_free(&out_buffer_ptr[0]); ++ gpu_free(&out_buffer_ptr[1]); ++ gpu_free(&in_buffer_ptr); ++ gpu_free(&unifs_ptr); ++ ++ return 0; ++} ++ ++void rpi_do_block_arm(const uint8_t *in_buffer, int src_pitch, uint8_t *dst, int dst_pitch) ++{ ++ int x,y; ++ for (y=0; y<16; ++y) { ++ for (x=0; x<16; ++x) { ++ dst[x+y*dst_pitch] = filter8(in_buffer+x+y*src_pitch, src_pitch); ++ } ++ } ++} ++ ++void rpi_do_block(const uint8_t *in_buffer_vc, int src_pitch, uint8_t *dst_vc, int dst_pitch, uint8_t *dst) ++{ ++ uint32_t *unifs; ++ ++ GPU_MEM_PTR_T unifs_ptr; ++ //uint8_t *out_buffer; ++ //GPU_MEM_PTR_T out_buffer_ptr; ++ ++ // Addresses in GPU memory of filter programs ++ uint32_t mc_setup = 0; ++ uint32_t mc_filter = 0; ++ uint32_t mc_exit = 0; ++ //int x,y; ++ ++ if (gpu==NULL) { ++ gpu_lock(); ++ gpu_unlock(); ++ } ++ ++ // Use table to compute locations of program start points ++ mc_setup = code[0] + gpu->vc; ++ mc_filter = code[1] + gpu->vc; ++ mc_exit = code[2] + gpu->vc; ++ ++ if (!vcos_verify(gpu_malloc_uncached(4*64,&unifs_ptr))) { ++ return; ++ } ++ //gpu_malloc_uncached(16*dst_pitch,&out_buffer_ptr); ++ //out_buffer = (uint8_t*)out_buffer_ptr.arm; ++ ++ /*for (y=0; y<16; ++y) { ++ for (x=0; x<16; ++x) { ++ out_buffer[x+y*dst_pitch] = 7; ++ } ++ }*/ ++ ++ unifs = (uint32_t*)unifs_ptr.arm; ++ ++ unifs[0] = mc_filter; ++ unifs[1] = (int)in_buffer_vc; ++ unifs[2] = src_pitch; // src pitch ++ unifs[3] = dst_pitch; // dst pitch ++ unifs[4] = 0; // Padding ++ unifs[5] = 0; ++ unifs[6] = 0; ++ unifs[7 ] = mc_exit; ++ unifs[8 ] = (int)in_buffer_vc; ++ unifs[9 ] = ENCODE_COEFFS(hcoeffs[0], hcoeffs[1], hcoeffs[2], hcoeffs[3]); ++ unifs[10] = ENCODE_COEFFS(hcoeffs[4], hcoeffs[5], hcoeffs[6], hcoeffs[7]); ++ unifs[11] = ENCODE_COEFFS(vcoeffs[0], vcoeffs[1], vcoeffs[2], vcoeffs[3]); ++ unifs[12] = ENCODE_COEFFS(vcoeffs[4], vcoeffs[5], vcoeffs[6], vcoeffs[7]); ++ unifs[13] = (int)dst_vc; ++ //unifs[13] = (int)out_buffer_ptr.vc; ++ ++ //printf("Gpu->vc=%x Code=%x dst=%x\n",gpu->vc, mc_filter,out_buffer_ptr[1].vc); ++ ++ qpu_run_shader(mc_setup, unifs_ptr.vc); ++ ++ /*for (y=0; y<16; ++y) { ++ for (x=0; x<16; ++x) { ++ dst[x+y*dst_pitch] = out_buffer[x+y*dst_pitch]; ++ } ++ }*/ ++ ++ gpu_free(&unifs_ptr); ++ //gpu_free(&out_buffer_ptr); ++} ++ ++ ++#endif ++ ++#endif // RPI +diff --git a/libavcodec/rpi_qpu.h b/libavcodec/rpi_qpu.h +new file mode 100644 +index 0000000..4e3c35c +--- /dev/null ++++ b/libavcodec/rpi_qpu.h +@@ -0,0 +1,45 @@ ++#ifndef RPI_QPU_H ++#define RPI_QPU_H ++ ++typedef struct gpu_mem_ptr_s { ++ unsigned char *arm; // Pointer to memory mapped on ARM side ++ int vc_handle; // Videocore handle of relocatable memory ++ int vcsm_handle; // Handle for use by VCSM ++ int vc; // Address for use in GPU code ++ int numbytes; // Size of memory block ++} GPU_MEM_PTR_T; ++ ++// General GPU functions ++extern int gpu_malloc_cached(int numbytes, GPU_MEM_PTR_T *p); ++extern int gpu_malloc_uncached(int numbytes, GPU_MEM_PTR_T *p); ++extern void gpu_free(GPU_MEM_PTR_T *p); ++extern void gpu_cache_flush(GPU_MEM_PTR_T *p); ++ ++// QPU specific functions ++extern void qpu_run_shader12(int code, int num, int code2, int num2, int unifs1, int unifs2, int unifs3, int unifs4, int unifs5, int unifs6, int unifs7, int unifs8, int unifs9, int unifs10, int unifs11, int unifs12); ++ ++enum { ++ QPU_MC_SETUP, ++ QPU_MC_FILTER, ++ QPU_MC_EXIT, ++ QPU_MC_INTERRUPT_EXIT, ++ QPU_MC_FILTER_B, ++ QPU_MC_FILTER_HONLY, ++ QPU_MC_SETUP_UV, ++ QPU_MC_FILTER_UV, ++ QPU_MC_FILTER_UV_B, ++ QPU_MC_END ++ }; ++extern unsigned int qpu_get_fn(int num); ++ ++// VPU specific functions ++extern unsigned int vpu_get_fn(void); ++extern unsigned vpu_execute_code( unsigned code, unsigned r0, unsigned r1, unsigned r2, unsigned r3, unsigned r4, unsigned r5); ++ ++// Simple test of shader code ++extern int rpi_test_shader(void); ++ ++extern void rpi_do_block(const unsigned char *in_buffer_vc, int src_pitch, unsigned char *dst_vc, int dst_pitch, unsigned char *dst); ++extern void rpi_do_block_arm(const unsigned char *in_buffer, int src_pitch, unsigned char *dst, int dst_pitch); ++ ++#endif +diff --git a/libavcodec/rpi_shader.c b/libavcodec/rpi_shader.c +new file mode 100644 +index 0000000..41cc2e1 +--- /dev/null ++++ b/libavcodec/rpi_shader.c +@@ -0,0 +1,818 @@ ++#include "rpi_shader.h" ++ ++#ifdef _MSC_VER ++ #include <stdint.h> ++ /* cast through uintptr_t to avoid warnings */ ++ #define POINTER_TO_UINT(X) ((unsigned int)(uintptr_t)(X)) ++#else ++ #define POINTER_TO_UINT(X) ((unsigned int)(X)) ++#endif ++ ++#ifdef __cplusplus ++extern "C" { /* the types are probably wrong... */ ++#endif ++#ifdef __cplusplus ++} ++#endif ++ ++#ifdef _MSC_VER ++__declspec(align(8)) ++#elif defined(__GNUC__) ++__attribute__((aligned(8))) ++#endif ++unsigned int rpi_shader[] = { ++// ::mc_setup ++/* [0x00000000] */ 0x15827d80, 0x100207e7, // mov ra31, unif ++/* [0x00000008] */ 0x0c9a0f80, 0x10020427, // add ra_x_base, unif, elem_num ++/* [0x00000010] */ 0x15827d80, 0x10020767, // mov ra_y, unif ++/* [0x00000018] */ 0x15827d80, 0x10020627, // mov ra_x2_base, unif ++/* [0x00000020] */ 0x0d801dc0, 0xd0021667, // sub rb25,unif,1 ++/* [0x00000028] */ 0x0d801dc0, 0xd00217a7, // sub rb30,unif,1 ++/* [0x00000030] */ 0x15827d80, 0x10021427, // mov rb16, unif ++/* [0x00000038] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000040] */ 0xc0000000, 0xe0020867, // mov r1, vdw_setup_1(0) ++/* [0x00000048] */ 0x0c9e7200, 0x10021627, // add rb24, r1, r0 ++/* [0x00000050] */ 0x00000001, 0xe0020527, // mov ra20, 1 ++/* [0x00000058] */ 0x00000040, 0xe0020567, // mov ra21, 64 ++/* [0x00000060] */ 0x00000100, 0xe00205a7, // mov ra22, 256 ++/* [0x00000068] */ 0x00000008, 0xe00205e7, // mov ra23, 8 ++/* [0x00000070] */ 0xffffff00, 0xe0021527, // mov rb20, 0xffffff00 ++/* [0x00000078] */ 0x00000040, 0xe0021567, // mov rb21, 64 ++/* [0x00000080] */ 0x000000ff, 0xe00215a7, // mov rb22, 255 ++/* [0x00000088] */ 0x00000018, 0xe00215e7, // mov rb23, 24 ++/* [0x00000090] */ 0x00000000, 0xe0020227, // mov ra8, 0 ++/* [0x00000098] */ 0x00000000, 0xe0020267, // mov ra9, 0 ++/* [0x000000a0] */ 0x00000000, 0xe00202a7, // mov ra10, 0 ++/* [0x000000a8] */ 0x00000000, 0xe00202e7, // mov ra11, 0 ++/* [0x000000b0] */ 0x00000000, 0xe0020327, // mov ra12, 0 ++/* [0x000000b8] */ 0x00000000, 0xe0020367, // mov ra13, 0 ++/* [0x000000c0] */ 0x00000000, 0xe00203a7, // mov ra14, 0 ++/* [0x000000c8] */ 0x00000000, 0xe00203e7, // mov ra15, 0 ++/* [0x000000d0] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num ++/* [0x000000d8] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 ++/* [0x000000e0] */ 0x159e7480, 0x10020867, // mov r1, r2 ++/* [0x000000e8] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 ++/* [0x000000f0] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 ++/* [0x000000f8] */ 0x159e7480, 0x10020827, // mov r0, r2 ++/* [0x00000100] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 ++/* [0x00000108] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 ++/* [0x00000110] */ 0x80004004, 0xe0020867, // mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) ++/* [0x00000118] */ 0x119c51c0, 0xd0020827, // shl r0, r0, 5 ++/* [0x00000120] */ 0x0c9e7040, 0x100216e7, // add rb27, r0, r1 ++/* [0x00000128] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num ++/* [0x00000130] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 ++/* [0x00000138] */ 0x159e7480, 0x10020867, // mov r1, r2 ++/* [0x00000140] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 ++/* [0x00000148] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 ++/* [0x00000150] */ 0x159e7480, 0x10020827, // mov r0, r2 ++/* [0x00000158] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 ++/* [0x00000160] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 ++/* [0x00000168] */ 0x00004800, 0xe0020867, // mov r1, vpm_setup(0, 4, h8p(0, 0)) ++/* [0x00000170] */ 0x0c9e7040, 0x10021727, // add rb28, r0, r1 ++/* [0x00000178] */ 0x15427d80, 0x10020827, // mov r0, ra_x_base ++/* [0x00000180] */ 0x0c9c81c0, 0xd00208a7, // add r2, r0, 8 ++/* [0x00000188] */ 0x937401f6, 0xd0024821, // max r0, r0, 0; mov r1, ra_y ++/* [0x00000190] */ 0x926191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, ra_x2_base ++/* [0x00000198] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 ++/* [0x000001a0] */ 0x139c05c0, 0xd00208a7, // max r2, r2, 0 ++/* [0x000001a8] */ 0x0c9c13c0, 0xd0020767, // add ra_y, r1, 1 ++/* [0x000001b0] */ 0x129d95c0, 0x100208a7, // min r2, r2, rb_frame_width_minus_1 ++/* [0x000001b8] */ 0x119c35c0, 0xd00206e7, // shl ra_x2shift_next, r2, 3 ++/* [0x000001c0] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 ++/* [0x000001c8] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 ++/* [0x000001d0] */ 0x4c9d00cf, 0x10024821, // add r0, r0, r3; mul24 r1, r1, rb_pitch ++/* [0x000001d8] */ 0x0c9e74c0, 0x100208a7, // add r2, r2, r3 ++/* [0x000001e0] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 ++/* [0x000001e8] */ 0x949dc5c0, 0xd0025890, // and r2, r2, ~3; mov ra_x_base, r0 ++/* [0x000001f0] */ 0x8c9e7052, 0x10025e18, // add t0s, r0, r1 ; mov ra_x2_base, r2 ++/* [0x000001f8] */ 0x0c9e7440, 0x10020e27, // add t0s, r2, r1 ++/* [0x00000200] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000208] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000210] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 ++/* [0x00000218] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 ++/* [0x00000220] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 ++/* [0x00000228] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 ++/* [0x00000230] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch ++/* [0x00000238] */ 0x0c427380, 0x10020e27, // add t0s, r1, ra_x_base ++/* [0x00000240] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_x2_base ++// ::mc_filter_uv ++/* [0x00000248] */ 0x15827d80, 0x100207e7, // mov ra31, unif ++/* [0x00000250] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next ++/* [0x00000258] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num ++/* [0x00000260] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif ++/* [0x00000268] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif ++/* [0x00000270] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 ++/* [0x00000278] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 ++/* [0x00000280] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 ++/* [0x00000288] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 ++/* [0x00000290] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 ++/* [0x00000298] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 ++/* [0x000002a0] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 ++/* [0x000002a8] */ 0x00000010, 0xe00208a7, // mov r2, 16 ++/* [0x000002b0] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x000002b8] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 ++/* [0x000002c0] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 ++/* [0x000002c8] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 ++/* [0x000002d0] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 ++/* [0x000002d8] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 ++/* [0x000002e0] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 ++/* [0x000002e8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 ++/* [0x000002f0] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 ++/* [0x000002f8] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 ++/* [0x00000300] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 ++/* [0x00000308] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000310] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000318] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000320] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000328] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif ++/* [0x00000330] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000338] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000340] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000348] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif ++/* [0x00000350] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000358] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000360] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000368] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif ++/* [0x00000370] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000378] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000380] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000388] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 ++/* [0x00000390] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 ++/* [0x00000398] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x000003a0] */ 0x00000000, 0xe00208e7, // mov r3, 0 ++// :uvloop ++/* [0x000003a8] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 ++/* [0x000003b0] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 ++/* [0x000003b8] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 ++/* [0x000003c0] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch ++/* [0x000003c8] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 ++/* [0x000003d0] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 ++/* [0x000003d8] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 ++/* [0x000003e0] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 ++/* [0x000003e8] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 ++/* [0x000003f0] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 ++/* [0x000003f8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x00000400] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 ++/* [0x00000408] */ 0x40038031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra0 << 8, r1 << 8 ++/* [0x00000410] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 ++/* [0x00000418] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 ++/* [0x00000420] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 ++/* [0x00000428] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 ++/* [0x00000430] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 ++/* [0x00000438] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 ++/* [0x00000440] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 ++/* [0x00000448] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 ++/* [0x00000450] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 ++/* [0x00000458] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 ++/* [0x00000460] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 ++/* [0x00000468] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 ++/* [0x00000470] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 ++/* [0x00000478] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 ++/* [0x00000480] */ 0x0d9e74c0, 0x10020827, // sub r0, r2, r3 ++/* [0x00000488] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 ++/* [0x00000490] */ 0x15267d80, 0x10020227, // mov ra8, ra9 ++/* [0x00000498] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 ++/* [0x000004a0] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 ++/* [0x000004a8] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 ++/* [0x000004b0] */ 0x15367d80, 0x10020327, // mov ra12, ra13 ++/* [0x000004b8] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 ++/* [0x000004c0] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 ++/* [0x000004c8] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop ++/* [0x000004d0] */ 0x533c0dc1, 0xd00243a0, // max ra14, ra15, 0 ; mul24 r0, r0, r1 ++/* [0x000004d8] */ 0x8f54f1f6, 0xd0024821, // asr r0, r0, 15 ; mov r1, ra21 ++/* [0x000004e0] */ 0x129d61c0, 0x100223e7, // min.setf ra15, r0, rb22 ++/* [0x000004e8] */ 0x4038e037, 0x100049e0, // nop ; mul24 r0, ra14, rb14 ++/* [0x000004f0] */ 0x4d34d237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra13, rb13 ++/* [0x000004f8] */ 0x4d30c237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra12, rb12 ++/* [0x00000500] */ 0x4d2cb237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra11, rb11 ++/* [0x00000508] */ 0x4d28a237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra10, rb10 ++/* [0x00000510] */ 0x4d249237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra9, rb9 ++/* [0x00000518] */ 0x4d208237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra8, rb8 ++/* [0x00000520] */ 0x4d3cf237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra15, rb15 ++/* [0x00000528] */ 0x8d9f223f, 0x100a0867, // sub.ifnn r1, r1, r0 ; mov -, vw_wait ++/* [0x00000530] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 ++/* [0x00000538] */ 0xfffffe50, 0xf06809e7, // brr.anyn -, r:uvloop ++/* [0x00000540] */ 0x0f9cf3c0, 0xd0020867, // asr r1, r1, 15 ++/* [0x00000548] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 ++/* [0x00000550] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 ++/* [0x00000558] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 ++/* [0x00000560] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 ++/* [0x00000568] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif ++/* [0x00000570] */ 0x00000010, 0xe0020827, // mov r0, 16 ++/* [0x00000578] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x00000580] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 ++/* [0x00000588] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 ++/* [0x00000590] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 ++/* [0x00000598] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif ++// ::mc_filter ++/* [0x000005a0] */ 0x15827d80, 0x100207e7, // mov ra31, unif ++/* [0x000005a8] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next ++/* [0x000005b0] */ 0x156e7d80, 0x10020667, // mov ra_x2shift, ra_x2shift_next ++/* [0x000005b8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num ++/* [0x000005c0] */ 0x0c9c81c0, 0xd00208a7, // add r2, r0, 8 ++/* [0x000005c8] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif ++/* [0x000005d0] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3,unif ++/* [0x000005d8] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 ++/* [0x000005e0] */ 0x139c05c0, 0xd00208a7, // max r2, r2, 0 ++/* [0x000005e8] */ 0x129d95c0, 0x100208a7, // min r2, r2, rb_frame_width_minus_1 ++/* [0x000005f0] */ 0x119c35c0, 0xd00206e7, // shl ra_x2shift_next, r2, 3 ++/* [0x000005f8] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 ++/* [0x00000600] */ 0x0c9e74c0, 0x100208a7, // add r2, r2, r3 ++/* [0x00000608] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 ++/* [0x00000610] */ 0x149dc5c0, 0xd00206a7, // and ra_x2_base_next, r2, ~3 ++/* [0x00000618] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 ++/* [0x00000620] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 ++/* [0x00000628] */ 0x00000010, 0xe00208a7, // mov r2, 16 ++/* [0x00000630] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000638] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 ++/* [0x00000640] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 ++/* [0x00000648] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 ++/* [0x00000650] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 ++/* [0x00000658] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 ++/* [0x00000660] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 ++/* [0x00000668] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 ++/* [0x00000670] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 ++/* [0x00000678] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 ++/* [0x00000680] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 ++/* [0x00000688] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000690] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000698] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000006a0] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000006a8] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif ++/* [0x000006b0] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000006b8] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000006c0] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000006c8] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif ++/* [0x000006d0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000006d8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000006e0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000006e8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif ++/* [0x000006f0] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000006f8] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000700] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000708] */ 0x000001d0, 0xf07809e7, // brr.anynn -, r:fast_path ++/* [0x00000710] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 ++/* [0x00000718] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 ++/* [0x00000720] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x00000728] */ 0x00000000, 0xe00208e7, // mov r3, 0 ++// :loop ++/* [0x00000730] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 ++/* [0x00000738] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 ++/* [0x00000740] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 ++/* [0x00000748] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch ++/* [0x00000750] */ 0xee654987, 0x10024860, // shr r1, r4, ra_x2shift ; v8subs r0, r0, rb20 ++/* [0x00000758] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 ++/* [0x00000760] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 ++/* [0x00000768] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 ++/* [0x00000770] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 ++/* [0x00000778] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 ++/* [0x00000780] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x00000788] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 ++/* [0x00000790] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 ++/* [0x00000798] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 ++/* [0x000007a0] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 ++/* [0x000007a8] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 ++/* [0x000007b0] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 ++/* [0x000007b8] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 ++/* [0x000007c0] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 ++/* [0x000007c8] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 ++/* [0x000007d0] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 ++/* [0x000007d8] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 ++/* [0x000007e0] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 ++/* [0x000007e8] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 ++/* [0x000007f0] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 ++/* [0x000007f8] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 ++/* [0x00000800] */ 0x0d9e74c0, 0x10020827, // sub r0, r2, r3 ++/* [0x00000808] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 ++/* [0x00000810] */ 0x15267d80, 0x10020227, // mov ra8, ra9 ++/* [0x00000818] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 ++/* [0x00000820] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 ++/* [0x00000828] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 ++/* [0x00000830] */ 0x15367d80, 0x10020327, // mov ra12, ra13 ++/* [0x00000838] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 ++/* [0x00000840] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 ++/* [0x00000848] */ 0xfffffec8, 0xf06809e7, // brr.anyn -, r:loop ++/* [0x00000850] */ 0x533c0dc1, 0xd00243a0, // max ra14, ra15, 0 ; mul24 r0, r0, r1 ++/* [0x00000858] */ 0x8f54f1f6, 0xd0024821, // asr r0, r0, 15 ; mov r1, ra21 ++/* [0x00000860] */ 0x129d61c0, 0x100223e7, // min.setf ra15, r0, rb22 ++/* [0x00000868] */ 0x4038e037, 0x100049e0, // nop ; mul24 r0, ra14, rb14 ++/* [0x00000870] */ 0x4d34d237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra13, rb13 ++/* [0x00000878] */ 0x4d30c237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra12, rb12 ++/* [0x00000880] */ 0x4d2cb237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra11, rb11 ++/* [0x00000888] */ 0x4d28a237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra10, rb10 ++/* [0x00000890] */ 0x4d249237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra9, rb9 ++/* [0x00000898] */ 0x4d208237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra8, rb8 ++/* [0x000008a0] */ 0x4d3cf237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra15, rb15 ++/* [0x000008a8] */ 0x8d9f223f, 0x100a0867, // sub.ifnn r1, r1, r0 ; mov -, vw_wait ++/* [0x000008b0] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 ++/* [0x000008b8] */ 0xfffffe58, 0xf06809e7, // brr.anyn -, r:loop ++/* [0x000008c0] */ 0x0f9cf3c0, 0xd0020867, // asr r1, r1, 15 ++/* [0x000008c8] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 ++/* [0x000008d0] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 ++/* [0x000008d8] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 ++/* [0x000008e0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 ++/* [0x000008e8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 ++/* [0x000008f0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif ++// :fast_path ++/* [0x000008f8] */ 0x00000000, 0xe00208e7, // mov r3, 0 ++// :fast_loop ++/* [0x00000900] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 ++/* [0x00000908] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 ++/* [0x00000910] */ 0x95727d9b, 0x1004475f, // mov.ifz ra_y, ra_y_next ; mov rb31, r3 ++/* [0x00000918] */ 0x95690dbf, 0x10044623, // mov.ifz ra_x2_base, ra_x2_base_next ; mov r3, rb_pitch ++/* [0x00000920] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 ++/* [0x00000928] */ 0x929de5e4, 0x100248a1, // min r2, r2, rb_frame_height_minus_1 ; mov r1, r4 ++/* [0x00000930] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 ++/* [0x00000938] */ 0xec414c87, 0x10024e20, // add t0s, ra_x_base, r2 ; v8subs r0, r0, rb20 ++/* [0x00000940] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 ++/* [0x00000948] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 ++/* [0x00000950] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 ++/* [0x00000958] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 ++/* [0x00000960] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 ++/* [0x00000968] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 ++/* [0x00000970] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 ++/* [0x00000978] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 ++/* [0x00000980] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 ++/* [0x00000988] */ 0x8d9df4ff, 0x10024823, // sub r0, r2, r3 ; mov r3, rb31 ++/* [0x00000990] */ 0x15267d80, 0x10020227, // mov ra8, ra9 ++/* [0x00000998] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 ++/* [0x000009a0] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 ++/* [0x000009a8] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 ++/* [0x000009b0] */ 0x15367d80, 0x10020327, // mov ra12, ra13 ++/* [0x000009b8] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 ++/* [0x000009c0] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 ++/* [0x000009c8] */ 0xffffff18, 0xf06809e7, // brr.anyn -, r:fast_loop ++/* [0x000009d0] */ 0x533c0dc1, 0xd00243a0, // max ra14, ra15, 0 ; mul24 r0, r0, r1 ++/* [0x000009d8] */ 0x8f54f1f6, 0xd0024821, // asr r0, r0, 15 ; mov r1, ra21 ++/* [0x000009e0] */ 0x129d61c0, 0x100223e7, // min.setf ra15, r0, rb22 ++/* [0x000009e8] */ 0x4038e037, 0x100049e0, // nop ; mul24 r0, ra14, rb14 ++/* [0x000009f0] */ 0x4d34d237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra13, rb13 ++/* [0x000009f8] */ 0x4d30c237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra12, rb12 ++/* [0x00000a00] */ 0x4d2cb237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra11, rb11 ++/* [0x00000a08] */ 0x4d28a237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra10, rb10 ++/* [0x00000a10] */ 0x4d249237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra9, rb9 ++/* [0x00000a18] */ 0x4d208237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra8, rb8 ++/* [0x00000a20] */ 0x4d3cf237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra15, rb15 ++/* [0x00000a28] */ 0x8d9f223f, 0x100a0867, // sub.ifnn r1, r1, r0 ; mov -, vw_wait ++/* [0x00000a30] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 ++/* [0x00000a38] */ 0xfffffea8, 0xf06809e7, // brr.anyn -, r:fast_loop ++/* [0x00000a40] */ 0x0f9cf3c0, 0xd0020867, // asr r1, r1, 15 ++/* [0x00000a48] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 ++/* [0x00000a50] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 ++/* [0x00000a58] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 ++/* [0x00000a60] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 ++/* [0x00000a68] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 ++/* [0x00000a70] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif ++// ::mc_filter_b ++/* [0x00000a78] */ 0x15827d80, 0x100207e7, // mov ra31, unif ++/* [0x00000a80] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next ++/* [0x00000a88] */ 0x156e7d80, 0x10020667, // mov ra_x2shift, ra_x2shift_next ++/* [0x00000a90] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num ++/* [0x00000a98] */ 0x0c9c81c0, 0xd00208a7, // add r2, r0, 8 ++/* [0x00000aa0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif ++/* [0x00000aa8] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3,unif ++/* [0x00000ab0] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 ++/* [0x00000ab8] */ 0x139c05c0, 0xd00208a7, // max r2, r2, 0 ++/* [0x00000ac0] */ 0x129d95c0, 0x100208a7, // min r2, r2, rb_frame_width_minus_1 ++/* [0x00000ac8] */ 0x119c35c0, 0xd00206e7, // shl ra_x2shift_next, r2, 3 ++/* [0x00000ad0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 ++/* [0x00000ad8] */ 0x0c9e74c0, 0x100208a7, // add r2, r2, r3 ++/* [0x00000ae0] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 ++/* [0x00000ae8] */ 0x149dc5c0, 0xd00206a7, // and ra_x2_base_next, r2, ~3 ++/* [0x00000af0] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 ++/* [0x00000af8] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 ++/* [0x00000b00] */ 0x00000010, 0xe00208a7, // mov r2, 16 ++/* [0x00000b08] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000b10] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 ++/* [0x00000b18] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 ++/* [0x00000b20] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 ++/* [0x00000b28] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 ++/* [0x00000b30] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 ++/* [0x00000b38] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 ++/* [0x00000b40] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 ++/* [0x00000b48] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 ++/* [0x00000b50] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 ++/* [0x00000b58] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 ++/* [0x00000b60] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 ++/* [0x00000b68] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 ++/* [0x00000b70] */ 0x0c9dc7c0, 0x10020c67, // add vr_setup, r3, rb28 ++/* [0x00000b78] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000b80] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000b88] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000b90] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000b98] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif ++/* [0x00000ba0] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000ba8] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000bb0] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000bb8] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif ++/* [0x00000bc0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000bc8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000bd0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000bd8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif ++/* [0x00000be0] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000be8] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000bf0] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000bf8] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 ++/* [0x00000c00] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 ++/* [0x00000c08] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x00000c10] */ 0x00000000, 0xe00208e7, // mov r3, 0 ++// :bloop ++/* [0x00000c18] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 ++/* [0x00000c20] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 ++/* [0x00000c28] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 ++/* [0x00000c30] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch ++/* [0x00000c38] */ 0xee654987, 0x10024860, // shr r1, r4, ra_x2shift ; v8subs r0, r0, rb20 ++/* [0x00000c40] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 ++/* [0x00000c48] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 ++/* [0x00000c50] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 ++/* [0x00000c58] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 ++/* [0x00000c60] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 ++/* [0x00000c68] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x00000c70] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 ++/* [0x00000c78] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 ++/* [0x00000c80] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 ++/* [0x00000c88] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 ++/* [0x00000c90] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 ++/* [0x00000c98] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 ++/* [0x00000ca0] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 ++/* [0x00000ca8] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 ++/* [0x00000cb0] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 ++/* [0x00000cb8] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 ++/* [0x00000cc0] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 ++/* [0x00000cc8] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 ++/* [0x00000cd0] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 ++/* [0x00000cd8] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 ++/* [0x00000ce0] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 ++/* [0x00000ce8] */ 0x0d9e74c0, 0x10020827, // sub r0, r2, r3 ++/* [0x00000cf0] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 ++/* [0x00000cf8] */ 0x15267d80, 0x10020227, // mov ra8, ra9 ++/* [0x00000d00] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 ++/* [0x00000d08] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 ++/* [0x00000d10] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 ++/* [0x00000d18] */ 0x15367d80, 0x10020327, // mov ra12, ra13 ++/* [0x00000d20] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 ++/* [0x00000d28] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 ++/* [0x00000d30] */ 0xfffffec8, 0xf06809e7, // brr.anyn -, r:bloop ++/* [0x00000d38] */ 0x533c0dc1, 0xd00243a0, // max ra14, ra15, 0 ; mul24 r0, r0, r1 ++/* [0x00000d40] */ 0x8f54f1f6, 0xd0024821, // asr r0, r0, 15 ; mov r1, ra21 ++/* [0x00000d48] */ 0x129d61c0, 0x100223e7, // min.setf ra15, r0, rb22 ++/* [0x00000d50] */ 0x4038e037, 0x100049e0, // nop ; mul24 r0, ra14, rb14 ++/* [0x00000d58] */ 0x4d34d237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra13, rb13 ++/* [0x00000d60] */ 0x4d30c237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra12, rb12 ++/* [0x00000d68] */ 0x4d2cb237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra11, rb11 ++/* [0x00000d70] */ 0x4d28a237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra10, rb10 ++/* [0x00000d78] */ 0x4d249237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra9, rb9 ++/* [0x00000d80] */ 0x4d208237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra8, rb8 ++/* [0x00000d88] */ 0x4d3cf237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra15, rb15 ++/* [0x00000d90] */ 0x8d9f223f, 0x100a0867, // sub.ifnn r1, r1, r0 ; mov -, vw_wait ++/* [0x00000d98] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 ++/* [0x00000da0] */ 0x8fc8f3f6, 0xd0020867, // asr r1, r1, 15 ; mov -, vr_wait ++/* [0x00000da8] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 ++/* [0x00000db0] */ 0x0cc01dc0, 0xd0020827, // add r0, vpm, 1 ++/* [0x00000db8] */ 0xfffffe40, 0xf06809e7, // brr.anyn -, r:bloop ++/* [0x00000dc0] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 ++/* [0x00000dc8] */ 0x0c9e7200, 0x10020867, // add r1, r1, r0 ++/* [0x00000dd0] */ 0x0e9c13c0, 0xd0020c27, // shr vpm, r1, 1 ++/* [0x00000dd8] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 ++/* [0x00000de0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 ++/* [0x00000de8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 ++/* [0x00000df0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif ++// ::mc_filter_honly ++/* [0x00000df8] */ 0x15827d80, 0x100207e7, // mov ra31, unif ++/* [0x00000e00] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next ++/* [0x00000e08] */ 0x156e7d80, 0x10020667, // mov ra_x2shift, ra_x2shift_next ++/* [0x00000e10] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num ++/* [0x00000e18] */ 0x0c9c81c0, 0xd00208a7, // add r2, r0, 8 ++/* [0x00000e20] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif ++/* [0x00000e28] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3,unif ++/* [0x00000e30] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 ++/* [0x00000e38] */ 0x139c05c0, 0xd00208a7, // max r2, r2, 0 ++/* [0x00000e40] */ 0x129d95c0, 0x100208a7, // min r2, r2, rb_frame_width_minus_1 ++/* [0x00000e48] */ 0x119c35c0, 0xd00206e7, // shl ra_x2shift_next, r2, 3 ++/* [0x00000e50] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 ++/* [0x00000e58] */ 0x0c9e74c0, 0x100208a7, // add r2, r2, r3 ++/* [0x00000e60] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 ++/* [0x00000e68] */ 0x149dc5c0, 0xd00206a7, // and ra_x2_base_next, r2, ~3 ++/* [0x00000e70] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 ++/* [0x00000e78] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 ++/* [0x00000e80] */ 0x00000010, 0xe00208a7, // mov r2, 16 ++/* [0x00000e88] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000e90] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 ++/* [0x00000e98] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 ++/* [0x00000ea0] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 ++/* [0x00000ea8] */ 0x0c9de1c0, 0xd0021467, // add rb17, r0, -2 ++/* [0x00000eb0] */ 0x919c71c0, 0xd0024812, // shl r0, r0, 7 ; mov rb18,r0 ++/* [0x00000eb8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 ++/* [0x00000ec0] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 ++/* [0x00000ec8] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 ++/* [0x00000ed0] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000ed8] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000ee0] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000ee8] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000ef0] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif ++/* [0x00000ef8] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000f00] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000f08] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000f10] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif ++/* [0x00000f18] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000f20] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 ++/* [0x00000f28] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x00000f30] */ 0x00000000, 0xe00208e7, // mov r3, 0 ++// :loop_honly ++/* [0x00000f38] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 ++/* [0x00000f40] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 ++/* [0x00000f48] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 ++/* [0x00000f50] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch ++/* [0x00000f58] */ 0xee654987, 0x10024860, // shr r1, r4, ra_x2shift ; v8subs r0, r0, rb20 ++/* [0x00000f60] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 ++/* [0x00000f68] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 ++/* [0x00000f70] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 ++/* [0x00000f78] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 ++/* [0x00000f80] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 ++/* [0x00000f88] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x00000f90] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 ++/* [0x00000f98] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 ++/* [0x00000fa0] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 ++/* [0x00000fa8] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 ++/* [0x00000fb0] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 ++/* [0x00000fb8] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 ++/* [0x00000fc0] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 ++/* [0x00000fc8] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 ++/* [0x00000fd0] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 ++/* [0x00000fd8] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 ++/* [0x00000fe0] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 ++/* [0x00000fe8] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 ++/* [0x00000ff0] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 ++/* [0x00000ff8] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 ++/* [0x00001000] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 ++/* [0x00001008] */ 0x8d9df4ff, 0x10024823, // sub r0, r2, r3 ; mov r3, rb31 ++/* [0x00001010] */ 0x8d5927f6, 0x100269e1, // sub.setf -, r3, rb18 ; mov r1, ra22 ++/* [0x00001018] */ 0x559f2fc1, 0x100049e0, // mov -, vw_wait ; mul24 r0, r0, r1 ++/* [0x00001020] */ 0xfffffef8, 0xf06809e7, // brr.anyn -, r:loop_honly ++/* [0x00001028] */ 0x0f9cf1c0, 0xd0020827, // asr r0, r0, 15 ++/* [0x00001030] */ 0x129d61c0, 0x10020827, // min r0, r0, rb22 ++/* [0x00001038] */ 0x139c01c0, 0xd0020c27, // max vpm, r0, 0 ++/* [0x00001040] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 ++/* [0x00001048] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 ++/* [0x00001050] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 ++/* [0x00001058] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif ++// ::mc_exit ++/* [0x00001060] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x00001068] */ 0x00000000, 0xe80009e7, // mov -,srel(0) ++/* [0x00001070] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00001078] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00001080] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00001088] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00001090] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend ++/* [0x00001098] */ 0x009e7000, 0x100009e7, // nop ; nop ++/* [0x000010a0] */ 0x009e7000, 0x100009e7, // nop ; nop ++// ::mc_exit1 ++/* [0x000010a8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x000010b0] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x000010b8] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x000010c0] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x000010c8] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x000010d0] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend ++/* [0x000010d8] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop ++/* [0x000010e0] */ 0x009e7000, 0x100009e7, // nop ; nop ++// ::mc_interrupt_exit ++/* [0x000010e8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x000010f0] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x000010f8] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00001100] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00001108] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00001110] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00001118] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00001120] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00001128] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00001130] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00001138] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00001140] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00001148] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00001150] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00001158] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00001160] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00001168] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend ++/* [0x00001170] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop ++/* [0x00001178] */ 0x009e7000, 0x100009e7, // nop ; nop ++// ::mc_interrupt_exit4 ++/* [0x00001180] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x00001188] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00001190] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00001198] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x000011a0] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x000011a8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x000011b0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x000011b8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x000011c0] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend ++/* [0x000011c8] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop ++/* [0x000011d0] */ 0x009e7000, 0x100009e7, // nop ; nop ++// ::mc_interrupt_exit8 ++/* [0x000011d8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x000011e0] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x000011e8] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x000011f0] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x000011f8] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00001200] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00001208] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00001210] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00001218] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00001220] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00001228] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00001230] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00001238] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend ++/* [0x00001240] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop ++/* [0x00001248] */ 0x009e7000, 0x100009e7, // nop ; nop ++// ::mc_setup_uv ++/* [0x00001250] */ 0x15827d80, 0x100207e7, // mov ra31, unif ++/* [0x00001258] */ 0x0c9a0f80, 0x10020427, // add ra_x_base, unif, elem_num ++/* [0x00001260] */ 0x15827d80, 0x10020767, // mov ra_y, unif ++/* [0x00001268] */ 0x15827d80, 0x10020627, // mov ra_x2_base, unif ++/* [0x00001270] */ 0x009e7000, 0x100009e7, // nop ++/* [0x00001278] */ 0x0d620f80, 0x10020667, // sub ra_u2v_ref_offset, unif, ra_x2_base ++/* [0x00001280] */ 0x0d801dc0, 0xd0021667, // sub rb25,unif,1 ++/* [0x00001288] */ 0x0d801dc0, 0xd00217a7, // sub rb30,unif,1 ++/* [0x00001290] */ 0x15827d80, 0x10021427, // mov rb16, unif ++/* [0x00001298] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x000012a0] */ 0xc0000000, 0xe0020867, // mov r1, vdw_setup_1(0) ++/* [0x000012a8] */ 0x0c9e7200, 0x10021627, // add rb24, r1, r0 ++/* [0x000012b0] */ 0x00000001, 0xe0020527, // mov ra20, 1 ++/* [0x000012b8] */ 0x00000040, 0xe0020567, // mov ra21, 64 ++/* [0x000012c0] */ 0x00000100, 0xe00205a7, // mov ra22, 256 ++/* [0x000012c8] */ 0x00000008, 0xe00205e7, // mov ra23, 8 ++/* [0x000012d0] */ 0xffffff00, 0xe0021527, // mov rb20, 0xffffff00 ++/* [0x000012d8] */ 0x00000040, 0xe0021567, // mov rb21, 64 ++/* [0x000012e0] */ 0x000000ff, 0xe00215a7, // mov rb22, 255 ++/* [0x000012e8] */ 0x00000018, 0xe00215e7, // mov rb23, 24 ++/* [0x000012f0] */ 0x00000000, 0xe0020227, // mov ra8, 0 ++/* [0x000012f8] */ 0x00000000, 0xe0020267, // mov ra9, 0 ++/* [0x00001300] */ 0x00000000, 0xe00202a7, // mov ra10, 0 ++/* [0x00001308] */ 0x00000000, 0xe00202e7, // mov ra11, 0 ++/* [0x00001310] */ 0x00000000, 0xe0020327, // mov ra12, 0 ++/* [0x00001318] */ 0x00000000, 0xe0020367, // mov ra13, 0 ++/* [0x00001320] */ 0x00000000, 0xe00203a7, // mov ra14, 0 ++/* [0x00001328] */ 0x00000000, 0xe00203e7, // mov ra15, 0 ++/* [0x00001330] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num ++/* [0x00001338] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 ++/* [0x00001340] */ 0x159e7480, 0x10020867, // mov r1, r2 ++/* [0x00001348] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 ++/* [0x00001350] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 ++/* [0x00001358] */ 0x159e7480, 0x10020827, // mov r0, r2 ++/* [0x00001360] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 ++/* [0x00001368] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 ++/* [0x00001370] */ 0x80004004, 0xe0020867, // mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) ++/* [0x00001378] */ 0x119c51c0, 0xd0020827, // shl r0, r0, 5 ++/* [0x00001380] */ 0x0c9e7040, 0x100216e7, // add rb27, r0, r1 ++/* [0x00001388] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num ++/* [0x00001390] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 ++/* [0x00001398] */ 0x159e7480, 0x10020867, // mov r1, r2 ++/* [0x000013a0] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 ++/* [0x000013a8] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 ++/* [0x000013b0] */ 0x159e7480, 0x10020827, // mov r0, r2 ++/* [0x000013b8] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 ++/* [0x000013c0] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 ++/* [0x000013c8] */ 0x00004800, 0xe0020867, // mov r1, vpm_setup(0, 4, h8p(0, 0)) ++/* [0x000013d0] */ 0x0c9e7040, 0x10021727, // add rb28, r0, r1 ++/* [0x000013d8] */ 0x15427d80, 0x10020827, // mov r0, ra_x_base ++/* [0x000013e0] */ 0x937401f6, 0xd0024821, // max r0, r0, 0; mov r1, ra_y ++/* [0x000013e8] */ 0x926191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, ra_x2_base ++/* [0x000013f0] */ 0x916431f6, 0xd00244e2, // shl ra_xshift_next, r0, 3 ; mov r2, ra_u2v_ref_offset ++/* [0x000013f8] */ 0x0c9c13c0, 0xd0020767, // add ra_y, r1, 1 ++/* [0x00001400] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 ++/* [0x00001408] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 ++/* [0x00001410] */ 0x939c03c0, 0xd0025850, // max r1, r1, 0 ; mov ra_x_base, r0 ++/* [0x00001418] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 ++/* [0x00001420] */ 0x4c9d040f, 0x100248a1, // add r2, r2, r0 ; mul24 r1, r1, rb_pitch ++/* [0x00001428] */ 0x8c9e7052, 0x10025e18, // add t0s, r0, r1 ; mov ra_x2_base, r2 ++/* [0x00001430] */ 0x0c9e7440, 0x10020e27, // add t0s, r2, r1 ++/* [0x00001438] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00001440] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00001448] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00001450] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 ++/* [0x00001458] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 ++/* [0x00001460] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 ++/* [0x00001468] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 ++/* [0x00001470] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch ++/* [0x00001478] */ 0x0c427380, 0x10020e27, // add t0s, r1, ra_x_base ++/* [0x00001480] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_x2_base ++// ::mc_filter_uv_b ++/* [0x00001488] */ 0x15827d80, 0x100207e7, // mov ra31, unif ++/* [0x00001490] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next ++/* [0x00001498] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num ++/* [0x000014a0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif ++/* [0x000014a8] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif ++/* [0x000014b0] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 ++/* [0x000014b8] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 ++/* [0x000014c0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 ++/* [0x000014c8] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 ++/* [0x000014d0] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 ++/* [0x000014d8] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 ++/* [0x000014e0] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 ++/* [0x000014e8] */ 0x00000010, 0xe00208a7, // mov r2, 16 ++/* [0x000014f0] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x000014f8] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 ++/* [0x00001500] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 ++/* [0x00001508] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 ++/* [0x00001510] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 ++/* [0x00001518] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 ++/* [0x00001520] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 ++/* [0x00001528] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 ++/* [0x00001530] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 ++/* [0x00001538] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 ++/* [0x00001540] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 ++/* [0x00001548] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 ++/* [0x00001550] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 ++/* [0x00001558] */ 0x0c9dc7c0, 0x10020c67, // add vr_setup, r3, rb28 ++/* [0x00001560] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 ++/* [0x00001568] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00001570] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00001578] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00001580] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00001588] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif ++/* [0x00001590] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00001598] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000015a0] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000015a8] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif ++/* [0x000015b0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000015b8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000015c0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000015c8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif ++/* [0x000015d0] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000015d8] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000015e0] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000015e8] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 ++/* [0x000015f0] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 ++/* [0x000015f8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x00001600] */ 0x00000000, 0xe00208e7, // mov r3, 0 ++// :uvloop_b ++/* [0x00001608] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 ++/* [0x00001610] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 ++/* [0x00001618] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 ++/* [0x00001620] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch ++/* [0x00001628] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 ++/* [0x00001630] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 ++/* [0x00001638] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 ++/* [0x00001640] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 ++/* [0x00001648] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 ++/* [0x00001650] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 ++/* [0x00001658] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x00001660] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 ++/* [0x00001668] */ 0x40038031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra0 << 8, r1 << 8 ++/* [0x00001670] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 ++/* [0x00001678] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 ++/* [0x00001680] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 ++/* [0x00001688] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 ++/* [0x00001690] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 ++/* [0x00001698] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 ++/* [0x000016a0] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 ++/* [0x000016a8] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 ++/* [0x000016b0] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 ++/* [0x000016b8] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 ++/* [0x000016c0] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 ++/* [0x000016c8] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 ++/* [0x000016d0] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 ++/* [0x000016d8] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 ++/* [0x000016e0] */ 0x0d9e74c0, 0x10020827, // sub r0, r2, r3 ++/* [0x000016e8] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 ++/* [0x000016f0] */ 0x15267d80, 0x10020227, // mov ra8, ra9 ++/* [0x000016f8] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 ++/* [0x00001700] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 ++/* [0x00001708] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 ++/* [0x00001710] */ 0x15367d80, 0x10020327, // mov ra12, ra13 ++/* [0x00001718] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 ++/* [0x00001720] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 ++/* [0x00001728] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop_b ++/* [0x00001730] */ 0x533c0dc1, 0xd00243a0, // max ra14, ra15, 0 ; mul24 r0, r0, r1 ++/* [0x00001738] */ 0x8f54f1f6, 0xd0024821, // asr r0, r0, 15 ; mov r1, ra21 ++/* [0x00001740] */ 0x129d61c0, 0x100223e7, // min.setf ra15, r0, rb22 ++/* [0x00001748] */ 0x4038e037, 0x100049e0, // nop ; mul24 r0, ra14, rb14 ++/* [0x00001750] */ 0x4d34d237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra13, rb13 ++/* [0x00001758] */ 0x4d30c237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra12, rb12 ++/* [0x00001760] */ 0x4d2cb237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra11, rb11 ++/* [0x00001768] */ 0x4d28a237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra10, rb10 ++/* [0x00001770] */ 0x4d249237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra9, rb9 ++/* [0x00001778] */ 0x4d208237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra8, rb8 ++/* [0x00001780] */ 0x4d3cf237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra15, rb15 ++/* [0x00001788] */ 0x8d9f223f, 0x100a0867, // sub.ifnn r1, r1, r0 ; mov -, vw_wait ++/* [0x00001790] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 ++/* [0x00001798] */ 0x0f9cf3c0, 0xd0020867, // asr r1, r1, 15 ++/* [0x000017a0] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 ++/* [0x000017a8] */ 0x0cc01dc0, 0xd0020827, // add r0, vpm, 1 ++/* [0x000017b0] */ 0xfffffe38, 0xf06809e7, // brr.anyn -, r:uvloop_b ++/* [0x000017b8] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 ++/* [0x000017c0] */ 0x0c9e7200, 0x10020867, // add r1, r1, r0 ++/* [0x000017c8] */ 0x0e9c13c0, 0xd0020c27, // shr vpm, r1, 1 ++/* [0x000017d0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 ++/* [0x000017d8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 ++/* [0x000017e0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif ++/* [0x000017e8] */ 0x00000010, 0xe0020827, // mov r0, 16 ++/* [0x000017f0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x000017f8] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 ++/* [0x00001800] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 ++/* [0x00001808] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 ++/* [0x00001810] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif ++// ::mc_end ++}; ++#ifdef __HIGHC__ ++#pragma Align_to(8, rpi_shader) ++#endif +diff --git a/libavcodec/rpi_shader.h b/libavcodec/rpi_shader.h +new file mode 100644 +index 0000000..db971f4 +--- /dev/null ++++ b/libavcodec/rpi_shader.h +@@ -0,0 +1,20 @@ ++#ifndef rpi_shader_H ++#define rpi_shader_H ++ ++extern unsigned int rpi_shader[]; ++ ++#define mc_setup (rpi_shader + 0) ++#define mc_filter_uv (rpi_shader + 146) ++#define mc_filter (rpi_shader + 360) ++#define mc_filter_b (rpi_shader + 670) ++#define mc_filter_honly (rpi_shader + 894) ++#define mc_exit (rpi_shader + 1048) ++#define mc_exit1 (rpi_shader + 1066) ++#define mc_interrupt_exit (rpi_shader + 1082) ++#define mc_interrupt_exit4 (rpi_shader + 1120) ++#define mc_interrupt_exit8 (rpi_shader + 1142) ++#define mc_setup_uv (rpi_shader + 1172) ++#define mc_filter_uv_b (rpi_shader + 1314) ++#define mc_end (rpi_shader + 1542) ++ ++#endif +diff --git a/libavcodec/rpi_shader.qasm b/libavcodec/rpi_shader.qasm +new file mode 100644 +index 0000000..6851e83 +--- /dev/null ++++ b/libavcodec/rpi_shader.qasm +@@ -0,0 +1,1413 @@ ++# register allocation ++# ++# ra0...ra7 eight horizontal filter coefficients ++# ++# rb1...rb7 seven shifted copies of the current unfiltered row ++# ++# ra8...ra15 eight filtered rows of context (rb15 == most recent) ++# ++# (ra15 isn't clamped to zero - this happens during the ++# copy to ra14, and during its use in the vertical filter) ++# ++# rb8...rb15 eight vertical filter coefficients ++# ++# ra16 clipped(row start address+elem_num)&~3 ++# ra17 per-channel shifts ++# ra19 next ra17 ++# ++# rb16 pitch ++# rb17 height + 5 ++# rb18 height + 7 ++# rb19 next ra16 ++# ++# ra20 1 ++# ra21 64 ++# ra22 256 ++# ra23 8 ++# ++# rb20 0xffffff00 ++# rb21 64 ++# rb22 255 ++# rb23 24 ++# ++# rb24 vdw_setup_1(dst_pitch) ++# rb25 frame width-1 ++# rb26 height<<23 + width<<16 + vdw_setup_0 ++# rb27 vdw_setup_0 (depends on QPU number) ++# rb28 vpm_setup (depends on QPU number) ++# rb29 vdw_setup_1(dst_pitch-width) ++# rb30 frame height-1 ++# rb31 used as temp to count loop iterations ++# ++# ra24...ra30 15, 14, 13, 12, 11, 10, 9 ++# ra24 clipped(row start address+8+elem_num)&~3 ++# ra25 per-channel shifts 2 ++# ra26 next ra24 ++# ra27 next ra25 ++# ra28 next y ++# ra29 y for next texture access ++# ++# ra31 next kernel address ++ ++.set rb_frame_width_minus_1, rb25 ++.set rb_frame_height_minus_1, rb30 ++.set rb_pitch, rb16 ++.set ra_x_base, ra16 ++.set rb_x_base_next, rb19 ++.set ra_x2_base, ra24 ++.set ra_x2_base_next, ra26 ++.set ra_xshift, ra17 ++ ++.set ra_x2shift, ra25 ++.set ra_u2v_ref_offset, ra25 ++ ++.set ra_xshift_next, ra19 ++ ++.set ra_x2shift_next, ra27 ++.set ra_u2v_dst_offset, ra27 ++ ++.set ra_y_next, ra28 ++.set ra_y, ra29 ++ ++.set rb_const_64, rb21 ++ ++# mc_setup(next_kernel, x, y, ref_base, frame_width, frame_height, pitch, dst_pitch, pad0, pad1) ++::mc_setup ++ ++# Read starting kernel ++mov ra31, unif ++ ++# Load first request location ++add ra_x_base, unif, elem_num # Store x ++mov ra_y, unif # Store y ++mov ra_x2_base, unif # Store frame base ++ ++# Read image dimensions ++sub rb25,unif,1 ++sub rb30,unif,1 ++ ++# get source pitch ++mov rb16, unif ++ ++# get destination pitch ++mov r0, unif ++mov r1, vdw_setup_1(0) ++add rb24, r1, r0 ++ ++# load constants ++ ++mov ra20, 1 ++mov ra21, 64 ++mov ra22, 256 ++mov ra23, 8 ++ ++mov rb20, 0xffffff00 ++mov rb21, 64 ++mov rb22, 255 ++mov rb23, 24 ++ ++# touch vertical context to keep simulator happy ++ ++mov ra8, 0 ++mov ra9, 0 ++mov ra10, 0 ++mov ra11, 0 ++mov ra12, 0 ++mov ra13, 0 ++mov ra14, 0 ++mov ra15, 0 ++ ++# Compute part of VPM to use for DMA output ++mov r2, qpu_num ++and r2, r2, 15 ++mov r1, r2 ++asr r1, r1, 2 ++shl r1, r1, 6 ++mov r0, r2 ++and r0, r0, 3 ++add r0, r0, r1 ++mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) # height,width added later ++shl r0, r0, 5 ++add rb27, r0, r1 ++ ++# Compute part of VPM to save data into ++mov r2, qpu_num ++and r2, r2, 15 ++mov r1, r2 ++asr r1, r1, 2 ++shl r1, r1, 6 ++mov r0, r2 ++and r0, r0, 3 ++add r0, r0, r1 ++mov r1, vpm_setup(0, 4, h8p(0, 0)) ++add rb28, r0, r1 ++ ++# Compute base address for first and second access ++#add r0, unif, elem_num # x ++mov r0, ra_x_base # Load x ++add r2, r0, 8 # x+8 ++max r0, r0, 0; mov r1, ra_y # Load y ++min r0, r0, rb_frame_width_minus_1 ; mov r3, ra_x2_base # Load the frame base ++shl ra_xshift_next, r0, 3 ++max r2, r2, 0 ++add ra_y, r1, 1 ++min r2, r2, rb_frame_width_minus_1 ++shl ra_x2shift_next, r2, 3 ++max r1, r1, 0 # y ++min r1, r1, rb_frame_height_minus_1 ++add r0, r0, r3; mul24 r1, r1, rb_pitch ++add r2, r2, r3 ++and r0, r0, ~3 ++and r2, r2, ~3; mov ra_x_base, r0 ++# submit texture requests for first line ++add t0s, r0, r1 ; mov ra_x2_base, r2 ++add t0s, r2, r1 ++ ++# Dump padding words ++mov r0, unif ++mov r0, unif ++ ++# submit texture requests for second line ++max r1, ra_y, 0 ++min r1, r1, rb_frame_height_minus_1 ++add ra_y, ra_y, 1 ++bra -, ra31 ++nop ; mul24 r1, r1, rb_pitch ++add t0s, r1, ra_x_base ++add t0s, r1, ra_x2_base ++ ++################################################################################ ++ ++# mc_filter_uv(next_kernel, x, y, frame_u_base, frame_v_base, height, hcoeffs[0], hcoeffs[1], vcoeffs[0], vcoeffs[1], this_u_dst, this_v_dst) ++ ++# At this point we have already issued two pairs of texture requests for the current block ++# ra_x_base, ra_x16_base point to the current coordinates for this block ++::mc_filter_uv ++mov ra31, unif ++ ++# per-channel shifts were calculated on the *previous* invocation ++ ++mov ra_xshift, ra_xshift_next ++ ++# get base addresses and per-channel shifts for *next* invocation ++add r0, unif, elem_num # x ++max r0, r0, 0; mov r1, unif # y ++min r0, r0, rb_frame_width_minus_1 ; mov r3, unif # frame_base ++shl ra_xshift_next, r0, 3 ++sub r2, unif, r3 # compute offset from frame base u to frame base v ++add r0, r0, r3 ++and rb_x_base_next, r0, ~3 ++mov ra_y_next, r1 ++add ra_x2_base_next, rb_x_base_next, r2 ++ ++# set up VPM write ++mov vw_setup, rb28 ++ ++# get width,height of block ++mov r2, 16 ++mov r0, unif ++shr r1, r0, r2 # Extract width ++sub rb29, rb24, r1 # Compute vdw_setup1(dst_pitch-width) ++and r0, r0, rb22 # Extract height ++add rb17, r0, 5 ++add rb18, r0, 7 ++shl r0, r0, 7 ++add r0, r0, r1 # Combine width and height of destination area ++shl r0, r0, r2 # Shift into bits 16 upwards of the vdw_setup0 register ++add rb26, r0, rb27 ++ ++sub.setf -,8,r1 # 8-r1, so if <0 (negative) we need to use the full code ++ ++# get filter coefficients ++ ++mov r0, unif ++asr ra3, r0, rb23; mul24 r0, r0, ra22 ++asr ra2, r0, rb23; mul24 r0, r0, ra22 ++asr ra1, r0, rb23; mul24 r0, r0, ra22 ++asr ra0, r0, rb23; mov r0, unif ++asr ra7, r0, rb23; mul24 r0, r0, ra22 ++asr ra6, r0, rb23; mul24 r0, r0, ra22 ++asr ra5, r0, rb23; mul24 r0, r0, ra22 ++asr ra4, r0, rb23; mov r0, unif ++asr rb11, r0, rb23; mul24 r0, r0, ra22 ++asr rb10, r0, rb23; mul24 r0, r0, ra22 ++asr rb9, r0, rb23; mul24 r0, r0, ra22 ++asr rb8, r0, rb23; mov r0, unif ++asr rb15, r0, rb23; mul24 r0, r0, ra22 ++asr rb14, r0, rb23; mul24 r0, r0, ra22 ++asr rb13, r0, rb23; mul24 r0, r0, ra22 ++asr rb12, r0, rb23 ++ ++# r2 is elem_num ++# r3 is loop counter ++ ++mov r5rep, -8 ++mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++ ++# retrieve texture results and pick out bytes ++# then submit two more texture requests ++ ++mov r3, 0 ++ ++:uvloop ++# retrieve texture results and pick out bytes ++# then submit two more texture requests ++ ++sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 # loop counter increment ++shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 ++mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 ++mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch ++shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 # v8subs masks out all but bottom byte ++ ++max r2, ra_y, 0 # y ++min r2, r2, rb_frame_height_minus_1 ++add ra_y, ra_y, 1 ; mul24 r2, r2, r3 ++add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 ++add t0s, ra_x2_base, r2 ++ ++# generate seven shifted versions ++# interleave with scroll of vertical context ++ ++mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++ ++mov r2, rb21 ; mul24 r3, r0, ra0 ++nop ; mul24.ifnz r3, ra0 << 8, r1 << 8 ++sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 ++nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 ++sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 ++nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 ++sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 ++nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 ++sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 ++nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 ++sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 ++nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 ++sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 ++nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 ++sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 ++nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 ++sub r0, r2, r3 ++ ++mov r3, rb31 ++ ++mov ra8, ra9 ++mov ra9, ra10 ++mov ra10, ra11 ++mov ra11, ra12 ++mov ra12, ra13 ++mov ra13, ra14 ++ ++sub.setf -, r3, 8 ; mov r1, ra22 ++ ++# apply horizontal filter ++brr.anyn -, r:uvloop ++max ra14, ra15, 0 ; mul24 r0, r0, r1 # last bit of context scroll, including clamp to zero ++asr r0, r0, 15 ; mov r1, ra21 ++min.setf ra15, r0, rb22 ++ ++# apply vertical filter and write to VPM ++ ++nop ; mul24 r0, ra14, rb14 ++sub r1, r1, r0 ; mul24 r0, ra13, rb13 ++sub r1, r1, r0 ; mul24 r0, ra12, rb12 ++sub r1, r1, r0 ; mul24 r0, ra11, rb11 ++sub r1, r1, r0 ; mul24 r0, ra10, rb10 ++sub r1, r1, r0 ; mul24 r0, ra9, rb9 ++sub r1, r1, r0 ; mul24 r0, ra8, rb8 ++sub r1, r1, r0 ; mul24 r0, ra15, rb15 ++sub.ifnn r1, r1, r0 ; mov -, vw_wait ++sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 ++brr.anyn -, r:uvloop ++asr r1, r1, 15 ++min r1, r1, rb22 ++max vpm, r1, 0 ++ ++# DMA out for U ++ ++mov vw_setup, rb26 # VDW setup 0 ++mov vw_setup, rb29 # Stride ++mov vw_addr, unif # start the VDW ++ ++# DMA out for V ++# We need to wait for the U to complete first, but have nothing useful to compute while we wait. ++# Could potentially push this write into the start of the next pipeline stage. ++mov r0, 16 ++mov -, vw_wait ++ ++bra -, ra31 ++add vw_setup, rb26, r0 # VDW setup 0 ++mov vw_setup, rb29 # Stride ++mov vw_addr, unif # start the VDW ++ ++################################################################################ ++ ++ ++# mc_filter(next_kernel, x, y, frame_base, height, hcoeffs[0], hcoeffs[1], vcoeffs[0], vcoeffs[1], this_dst) ++ ++# At this point we have already issued two pairs of texture requests for the current block ++# ra_x_base, ra_x16_base point to the current coordinates for this block ++::mc_filter ++mov ra31, unif ++ ++# per-channel shifts were calculated on the *previous* invocation ++ ++mov ra_xshift, ra_xshift_next ++mov ra_x2shift, ra_x2shift_next ++ ++# get base addresses and per-channel shifts for *next* invocation ++add r0, unif, elem_num # x ++add r2, r0, 8 # x+8 ++max r0, r0, 0; mov r1, unif # y ++min r0, r0, rb_frame_width_minus_1 ; mov r3,unif # frame_base ++shl ra_xshift_next, r0, 3 ++max r2, r2, 0 ++min r2, r2, rb_frame_width_minus_1 ++shl ra_x2shift_next, r2, 3 ++add r0, r0, r3 ++add r2, r2, r3 ++and rb_x_base_next, r0, ~3 ++and ra_x2_base_next, r2, ~3 ++mov ra_y_next, r1 ++ ++# set up VPM write ++mov vw_setup, rb28 ++ ++# get width,height of block ++mov r2, 16 ++mov r0, unif ++shr r1, r0, r2 # Extract width ++sub rb29, rb24, r1 # Compute vdw_setup1(dst_pitch-width) ++and r0, r0, rb22 # Extract height ++add rb17, r0, 5 ++add rb18, r0, 7 ++shl r0, r0, 7 ++add r0, r0, r1 # Combine width and height of destination area ++shl r0, r0, r2 # Shift into bits 16 upwards of the vdw_setup0 register ++add rb26, r0, rb27 ++ ++sub.setf -,8,r1 # 8-r1, so if <0 (negative) we need to use the full code ++ ++# get filter coefficients ++ ++mov r0, unif ++asr ra3, r0, rb23; mul24 r0, r0, ra22 ++asr ra2, r0, rb23; mul24 r0, r0, ra22 ++asr ra1, r0, rb23; mul24 r0, r0, ra22 ++asr ra0, r0, rb23; mov r0, unif ++asr ra7, r0, rb23; mul24 r0, r0, ra22 ++asr ra6, r0, rb23; mul24 r0, r0, ra22 ++asr ra5, r0, rb23; mul24 r0, r0, ra22 ++asr ra4, r0, rb23; mov r0, unif ++asr rb11, r0, rb23; mul24 r0, r0, ra22 ++asr rb10, r0, rb23; mul24 r0, r0, ra22 ++asr rb9, r0, rb23; mul24 r0, r0, ra22 ++asr rb8, r0, rb23; mov r0, unif ++asr rb15, r0, rb23; mul24 r0, r0, ra22 ++asr rb14, r0, rb23; mul24 r0, r0, ra22 ++asr rb13, r0, rb23; mul24 r0, r0, ra22 ++brr.anynn -, r:fast_path ++asr rb12, r0, rb23 # delay slot 1 ++ ++# r2 is elem_num ++# r3 is loop counter ++ ++mov r5rep, -8 # delay slot 2 ++ ++mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] # delay slot 3 ++ ++# retrieve texture results and pick out bytes ++# then submit two more texture requests ++ ++## nop ; ldtmu0 # loop counter increment ++## shr r0, r4, ra17 ; ldtmu0 ++## shr r1, r4, ra17 ; v8subs r0, r0, rb20 ++## add t0s, ra16, r5 ; v8subs r1, r1, rb20 ++## add ra16, ra16, rb16 ; mov t0s, ra16 ++## ++## # generate seven shifted versions ++## # interleave with scroll of vertical context ++## ++## mov r2, rb21 ; mul24 r3, r0, ra0 ++## sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 ++## nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 ++## sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 ++## nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 ++## sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 ++## nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 ++## sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 ++## nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 ++## sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 ++## nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 ++## sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 ++## nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 ++## sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 ++## nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 ++## sub r2, r2, r3 ; ldtmu0 ++## ++## mov r0, ra22 ++## shr r0, r4, ra17 ; mul24 r2, r2, r0 ; ldtmu0 ++## shr r1, r4, ra17 ; v8subs r0, r0, rb20 ++## add t0s, ra16, r5 ; v8subs r1, r1, rb20 ++## add ra16, ra16, rb16 ; mov t0s, ra16 ++## ++## # apply horizontal filter ++## ++## asr r2, r2, 15 ; mul24 r3, r0, ra0 ++## min r2, r2, rb22 ++## max ra13, r2, 0 ++## ++## # generate seven shifted versions ++## # interleave with scroll of vertical context ++## ++## mov r2, rb21 ++## sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 ++## nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 ++## sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 ++## nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 ++## sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 ++## nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 ++## sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 ++## nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 ++## sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 ++## nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 ++## sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 ++## nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 ++## sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 ++## nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 ++## sub r0, r2, r3 ++## ++## # apply horizontal filter ++## ++## nop ; mul24 r0, r0, ra22 # last bit of context scroll, including clamp to zero ++## asr r0, r0, 15 ++## min r0, r0, rb22 ++## max ra14, r0, 0 ++## ++## ++## ++## ++## nop ; ldtmu0 # loop counter increment ++## shr r0, r4, ra17 ; ldtmu0 ++## shr r1, r4, ra17 ; v8subs r0, r0, rb20 ++## add t0s, ra16, r5 ; v8subs r1, r1, rb20 ++## add ra16, ra16, rb16 ; mov t0s, ra16 ++## ++## # generate seven shifted versions ++## # interleave with scroll of vertical context ++## ++## mov r2, rb21 ; mul24 r3, r0, ra0 ++## sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 ++## nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 ++## sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 ++## nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 ++## sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 ++## nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 ++## sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 ++## nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 ++## sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 ++## nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 ++## sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 ++## nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 ++## sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 ++## nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 ++## sub r0, r2, r3 ++## ++## # apply horizontal filter ++## ++## nop ; mul24 r0, r0, ra22 # last bit of context scroll, including clamp to zero ++## asr r0, r0, 15 ++## min r0, r0, rb22 ++## max ra15, r0, 0 ++ ++ ++ ++ ++mov r3, 0 ++ ++:loop ++# retrieve texture results and pick out bytes ++# then submit two more texture requests ++ ++sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 # loop counter increment ++shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 ++mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 ++mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch ++shr r1, r4, ra_x2shift ; v8subs r0, r0, rb20 # v8subs masks out all but bottom byte ++ ++max r2, ra_y, 0 # y ++min r2, r2, rb_frame_height_minus_1 ++add ra_y, ra_y, 1 ; mul24 r2, r2, r3 ++add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 ++add t0s, ra_x2_base, r2 ++ ++# generate seven shifted versions ++# interleave with scroll of vertical context ++ ++mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++ ++mov r2, rb21 ; mul24 r3, r0, ra0 ++sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 ++nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 ++sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 ++nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 ++sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 ++nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 ++sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 ++nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 ++sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 ++nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 ++sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 ++nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 ++sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 ++nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 ++sub r0, r2, r3 ++ ++mov r3, rb31 ++ ++mov ra8, ra9 ++mov ra9, ra10 ++mov ra10, ra11 ++mov ra11, ra12 ++mov ra12, ra13 ++mov ra13, ra14 ++ ++sub.setf -, r3, 8 ; mov r1, ra22 ++ ++# apply horizontal filter ++brr.anyn -, r:loop ++max ra14, ra15, 0 ; mul24 r0, r0, r1 # last bit of context scroll, including clamp to zero ++asr r0, r0, 15 ; mov r1, ra21 ++min.setf ra15, r0, rb22 ++ ++# apply vertical filter and write to VPM ++ ++nop ; mul24 r0, ra14, rb14 ++sub r1, r1, r0 ; mul24 r0, ra13, rb13 ++sub r1, r1, r0 ; mul24 r0, ra12, rb12 ++sub r1, r1, r0 ; mul24 r0, ra11, rb11 ++sub r1, r1, r0 ; mul24 r0, ra10, rb10 ++sub r1, r1, r0 ; mul24 r0, ra9, rb9 ++sub r1, r1, r0 ; mul24 r0, ra8, rb8 ++sub r1, r1, r0 ; mul24 r0, ra15, rb15 ++sub.ifnn r1, r1, r0 ; mov -, vw_wait ++sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 ++brr.anyn -, r:loop ++asr r1, r1, 15 ++min r1, r1, rb22 ++max vpm, r1, 0 ++ ++# DMA out ++ ++bra -, ra31 ++mov vw_setup, rb26 # VDW: height rows, 16 8-bit units long ++mov vw_setup, rb29 ++mov vw_addr, unif # start the VDW ++ ++#################################################### ++ ++:fast_path ++## nop ; ldtmu0 # loop counter increment ++## shr r0, r4, ra17 ; ldtmu0 ++## shr r1, r4, ra17 ; v8subs r0, r0, rb20 ++## add t0s, ra16, r5 ; v8subs r1, r1, rb20 ++## add ra16, ra16, rb16 ; mov t0s, ra16 ++## ++## # generate seven shifted versions ++## # interleave with scroll of vertical context ++## ++## mov r2, rb21 ; mul24 r3, r0, ra0 ++## sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 ++## sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 ++## sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 ++## sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 ++## sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 ++## sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 ++## sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 ++## sub r2, r2, r3 ; ldtmu0 ++## ++## mov r0, ra22 ++## shr r0, r4, ra17 ; mul24 r2, r2, r0 ; ldtmu0 ++## shr r1, r4, ra17 ; v8subs r0, r0, rb20 ++## add t0s, ra16, r5 ; v8subs r1, r1, rb20 ++## add ra16, ra16, rb16 ; mov t0s, ra16 ++## ++## # apply horizontal filter ++## ++## asr r2, r2, 15 ; mul24 r3, r0, ra0 ++## min r2, r2, rb22 ++## max ra13, r2, 0 ++## ++## # generate seven shifted versions ++## # interleave with scroll of vertical context ++## ++## mov r2, rb21 ++## sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 ++## sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 ++## sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 ++## sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 ++## sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 ++## sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 ++## sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 ++## sub r0, r2, r3 ++## ++## # apply horizontal filter ++## ++## nop ; mul24 r0, r0, ra22 # last bit of context scroll, including clamp to zero ++## asr r0, r0, 15 ++## min r0, r0, rb22 ++## max ra14, r0, 0 ++## ++## ++## ++## ++## nop ; ldtmu0 # loop counter increment ++## shr r0, r4, ra17 ; ldtmu0 ++## shr r1, r4, ra17 ; v8subs r0, r0, rb20 ++## add t0s, ra16, r5 ; v8subs r1, r1, rb20 ++## add ra16, ra16, rb16 ; mov t0s, ra16 ++## ++## # generate seven shifted versions ++## # interleave with scroll of vertical context ++## ++## mov r2, rb21 ; mul24 r3, r0, ra0 ++## sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 ++## sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 ++## sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 ++## sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 ++## sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 ++## sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 ++## sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 ++## sub r0, r2, r3 ++## ++## # apply horizontal filter ++## ++## nop ; mul24 r0, r0, ra22 # last bit of context scroll, including clamp to zero ++## asr r0, r0, 15 ++## min r0, r0, rb22 ++## max ra15, r0, 0 ++ ++ ++mov r3, 0 # This signifies the amount of unrolling ++ ++:fast_loop ++# retrieve texture results and pick out bytes ++# then submit two more texture requests ++ ++# Due to pipelining we can only skip second pipeline instructions related to the fetched pixels ++sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 # loop counter increment ++shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 ++mov.ifz ra_y, ra_y_next ; mov rb31, r3 ++mov.ifz ra_x2_base, ra_x2_base_next ; mov r3, rb_pitch ++ ++max r2, ra_y, 0 ++min r2, r2, rb_frame_height_minus_1 ; mov r1, r4 # discard texture read ++add ra_y, ra_y, 1 ; mul24 r2, r2, r3 ++add t0s, ra_x_base, r2 ; v8subs r0, r0, rb20 ++add t0s, ra_x2_base, r2 ++ ++# generate seven shifted versions ++# interleave with scroll of vertical context ++ ++mov r2, rb21 ; mul24 r3, r0, ra0 ++sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 ++sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 ++sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 ++sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 ++sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 ++sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 ++sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 ++sub r0, r2, r3 ; mov r3, rb31 ++ ++mov ra8, ra9 ++mov ra9, ra10 ++mov ra10, ra11 ++mov ra11, ra12 ++mov ra12, ra13 ++mov ra13, ra14 ++ ++sub.setf -, r3, 8 ; mov r1, ra22 ++ ++# apply horizontal filter ++ ++brr.anyn -, r:fast_loop ++max ra14, ra15, 0 ; mul24 r0, r0, r1 # last bit of context scroll, including clamp to zero ++asr r0, r0, 15 ; mov r1, ra21 ++min.setf ra15, r0, rb22 ++ ++# apply vertical filter and write to VPM ++ ++nop ; mul24 r0, ra14, rb14 ++sub r1, r1, r0 ; mul24 r0, ra13, rb13 ++sub r1, r1, r0 ; mul24 r0, ra12, rb12 ++sub r1, r1, r0 ; mul24 r0, ra11, rb11 ++sub r1, r1, r0 ; mul24 r0, ra10, rb10 ++sub r1, r1, r0 ; mul24 r0, ra9, rb9 ++sub r1, r1, r0 ; mul24 r0, ra8, rb8 ++sub r1, r1, r0 ; mul24 r0, ra15, rb15 ++sub.ifnn r1, r1, r0 ; mov -, vw_wait ++sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 ++brr.anyn -, r:fast_loop ++asr r1, r1, 15 ++min r1, r1, rb22 ++max vpm, r1, 0 ++ ++# DMA out ++ ++bra -, ra31 ++mov vw_setup, rb26 # VDW: height rows, 16 8-bit units long ++mov vw_setup, rb29 ++mov vw_addr, unif # start the VDW ++ ++################################################################################ ++ ++# mc_filter_b(next_kernel, x, y, frame_base, height, hcoeffs[0], hcoeffs[1], vcoeffs[0], vcoeffs[1], this_dst) ++ ++# At this point we have already issued two pairs of texture requests for the current block ++# ra_x_base, ra_x16_base point to the current coordinates for this block ++::mc_filter_b ++mov ra31, unif ++ ++# per-channel shifts were calculated on the *previous* invocation ++ ++mov ra_xshift, ra_xshift_next ++mov ra_x2shift, ra_x2shift_next ++ ++# get base addresses and per-channel shifts for *next* invocation ++add r0, unif, elem_num # x ++add r2, r0, 8 # x+8 ++max r0, r0, 0; mov r1, unif # y ++min r0, r0, rb_frame_width_minus_1 ; mov r3,unif # frame_base ++shl ra_xshift_next, r0, 3 ++max r2, r2, 0 ++min r2, r2, rb_frame_width_minus_1 ++shl ra_x2shift_next, r2, 3 ++add r0, r0, r3 ++add r2, r2, r3 ++and rb_x_base_next, r0, ~3 ++and ra_x2_base_next, r2, ~3 ++mov ra_y_next, r1 ++ ++# set up VPM write ++mov vw_setup, rb28 ++ ++# get width,height of block ++mov r2, 16 ++mov r0, unif ++shr r1, r0, r2 # Extract width ++sub rb29, rb24, r1 # Compute vdw_setup1(dst_pitch-width) ++and r0, r0, rb22 # Extract height ++add rb17, r0, 5 ++add rb18, r0, 7 ++shl r0, r0, 7 ++# r0 is currently height<<7 ++# For vr_setup we want height<<20 (so 20-7=13 additional bits) ++shl r3, r0, 13 ++shl r3, r3, 8 # Mask off top 8 bits ++shr r3, r3, 8 ++add r0, r0, r1 # Combine width and height of destination area ++shl r0, r0, r2 # Shift into bits 16 upwards of the vdw_setup0 register ++add rb26, r0, rb27 ++# In a B frame, so also set up VPM read ++add vr_setup, r3, rb28 ++ ++# get filter coefficients ++ ++mov r0, unif ++asr ra3, r0, rb23; mul24 r0, r0, ra22 ++asr ra2, r0, rb23; mul24 r0, r0, ra22 ++asr ra1, r0, rb23; mul24 r0, r0, ra22 ++asr ra0, r0, rb23; mov r0, unif ++asr ra7, r0, rb23; mul24 r0, r0, ra22 ++asr ra6, r0, rb23; mul24 r0, r0, ra22 ++asr ra5, r0, rb23; mul24 r0, r0, ra22 ++asr ra4, r0, rb23; mov r0, unif ++asr rb11, r0, rb23; mul24 r0, r0, ra22 ++asr rb10, r0, rb23; mul24 r0, r0, ra22 ++asr rb9, r0, rb23; mul24 r0, r0, ra22 ++asr rb8, r0, rb23; mov r0, unif ++asr rb15, r0, rb23; mul24 r0, r0, ra22 ++asr rb14, r0, rb23; mul24 r0, r0, ra22 ++asr rb13, r0, rb23; mul24 r0, r0, ra22 ++asr rb12, r0, rb23 ++ ++# r2 is elem_num ++# r3 is loop counter ++ ++mov r5rep, -8 ++mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++mov r3, 0 ++ ++:bloop ++# retrieve texture results and pick out bytes ++# then submit two more texture requests ++ ++sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 # loop counter increment ++shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 ++mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 ++mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch ++shr r1, r4, ra_x2shift ; v8subs r0, r0, rb20 # v8subs masks out all but bottom byte ++ ++max r2, ra_y, 0 # y ++min r2, r2, rb_frame_height_minus_1 ++add ra_y, ra_y, 1 ; mul24 r2, r2, r3 ++add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 ++add t0s, ra_x2_base, r2 ++ ++# generate seven shifted versions ++# interleave with scroll of vertical context ++ ++mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++ ++mov r2, rb21 ; mul24 r3, r0, ra0 ++sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 ++nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 ++sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 ++nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 ++sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 ++nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 ++sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 ++nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 ++sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 ++nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 ++sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 ++nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 ++sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 ++nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 ++sub r0, r2, r3 ++ ++mov r3, rb31 ++ ++mov ra8, ra9 ++mov ra9, ra10 ++mov ra10, ra11 ++mov ra11, ra12 ++mov ra12, ra13 ++mov ra13, ra14 ++ ++sub.setf -, r3, 8 ; mov r1, ra22 ++ ++# apply horizontal filter ++brr.anyn -, r:bloop ++max ra14, ra15, 0 ; mul24 r0, r0, r1 # last bit of context scroll, including clamp to zero ++asr r0, r0, 15 ; mov r1, ra21 ++min.setf ra15, r0, rb22 ++ ++# apply vertical filter and write to VPM ++ ++nop ; mul24 r0, ra14, rb14 ++sub r1, r1, r0 ; mul24 r0, ra13, rb13 ++sub r1, r1, r0 ; mul24 r0, ra12, rb12 ++sub r1, r1, r0 ; mul24 r0, ra11, rb11 ++sub r1, r1, r0 ; mul24 r0, ra10, rb10 ++sub r1, r1, r0 ; mul24 r0, ra9, rb9 ++sub r1, r1, r0 ; mul24 r0, ra8, rb8 ++sub r1, r1, r0 ; mul24 r0, ra15, rb15 ++sub.ifnn r1, r1, r0 ; mov -, vw_wait ++sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 ++asr r1, r1, 15 ; mov -, vr_wait ++min r1, r1, rb22 ++add r0, vpm, 1 # Blend in previous VPM contents at this location ++brr.anyn -, r:bloop ++max r1, r1, 0 ++add r1, r1, r0 ++shr vpm, r1, 1 ++ ++# DMA out ++ ++bra -, ra31 ++mov vw_setup, rb26 # VDW: height rows, 16 8-bit units long ++mov vw_setup, rb29 ++mov vw_addr, unif # start the VDW ++ ++################################################################################ ++ ++# mc_filter_honly(next_kernel, x, y, frame_base, height, hcoeffs[0], hcoeffs[1], vcoeffs[0], vcoeffs[1], this_dst) ++# This filter only does horizontal filtering. ++# It is assumed that the region to fetch does not include extra rows above. ++ ++# At this point we have already issued two pairs of texture requests for the current block ++# ra_x_base, ra_x16_base point to the current coordinates for this block ++::mc_filter_honly ++mov ra31, unif ++ ++# per-channel shifts were calculated on the *previous* invocation ++ ++mov ra_xshift, ra_xshift_next ++mov ra_x2shift, ra_x2shift_next ++ ++# get base addresses and per-channel shifts for *next* invocation ++add r0, unif, elem_num # x ++add r2, r0, 8 # x+8 ++max r0, r0, 0; mov r1, unif # y ++min r0, r0, rb_frame_width_minus_1 ; mov r3,unif # frame_base ++shl ra_xshift_next, r0, 3 ++max r2, r2, 0 ++min r2, r2, rb_frame_width_minus_1 ++shl ra_x2shift_next, r2, 3 ++add r0, r0, r3 ++add r2, r2, r3 ++and rb_x_base_next, r0, ~3 ++and ra_x2_base_next, r2, ~3 ++mov ra_y_next, r1 ++ ++# set up VPM write ++mov vw_setup, rb28 ++ ++# get width,height of block ++mov r2, 16 ++mov r0, unif ++shr r1, r0, r2 # Extract width ++sub rb29, rb24, r1 # Compute vdw_setup1(dst_pitch-width) ++and r0, r0, rb22 # Extract height ++add rb17, r0, -2 # Pipelining means we move data across 2 iterations early ++shl r0, r0, 7 ; mov rb18,r0 ++add r0, r0, r1 # Combine width and height of destination area ++shl r0, r0, r2 # Shift into bits 16 upwards of the vdw_setup0 register ++add rb26, r0, rb27 ++ ++# get filter coefficients ++ ++mov r0, unif ++asr ra3, r0, rb23; mul24 r0, r0, ra22 ++asr ra2, r0, rb23; mul24 r0, r0, ra22 ++asr ra1, r0, rb23; mul24 r0, r0, ra22 ++asr ra0, r0, rb23; mov r0, unif ++asr ra7, r0, rb23; mul24 r0, r0, ra22 ++asr ra6, r0, rb23; mul24 r0, r0, ra22 ++asr ra5, r0, rb23; mul24 r0, r0, ra22 ++asr ra4, r0, rb23; mov r0, unif ++mov r0, unif ++ ++# r2 is elem_num ++# r3 is loop counter ++mov r5rep, -8 ++mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] # delay slot 3 ++mov r3, 0 ++ ++:loop_honly ++# retrieve texture results and pick out bytes ++# then submit two more texture requests ++ ++sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 # loop counter increment ++shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 ++mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 ++mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch ++shr r1, r4, ra_x2shift ; v8subs r0, r0, rb20 # v8subs masks out all but bottom byte ++ ++max r2, ra_y, 0 # y ++min r2, r2, rb_frame_height_minus_1 ++add ra_y, ra_y, 1 ; mul24 r2, r2, r3 ++add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 ++add t0s, ra_x2_base, r2 ++ ++# generate seven shifted versions ++# interleave with scroll of vertical context ++ ++mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++ ++mov r2, rb21 ; mul24 r3, r0, ra0 ++sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 ++nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 ++sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 ++nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 ++sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 ++nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 ++sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 ++nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 ++sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 ++nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 ++sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 ++nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 ++sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 ++nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 ++sub r0, r2, r3 ; mov r3, rb31 ++ ++sub.setf -, r3, rb18 ; mov r1, ra22 ++ ++mov -, vw_wait ; mul24 r0, r0, r1 ++brr.anyn -, r:loop_honly ++asr r0, r0, 15 # delay 1 ++min r0, r0, rb22 # delay 2 ++max vpm, r0, 0 # delay 3 ++ ++# DMA out ++bra -, ra31 ++mov vw_setup, rb26 # VDW: height rows, 16 8-bit units long ++mov vw_setup, rb29 ++mov vw_addr, unif # start the VDW ++ ++ ++################################################################################ ++ ++# mc_exit() ++ ++::mc_exit ++mov -, vw_wait # wait on the VDW ++ ++mov -,srel(0) ++ ++ldtmu0 ++ldtmu0 ++ldtmu0 ++ldtmu0 ++ ++nop ; nop ; thrend ++nop ; nop # delay slot 1 ++nop ; nop # delay slot 2 ++ ++::mc_exit1 ++mov -, vw_wait # wait on the VDW ++ ++#mov -,srel(1) ++ ++ldtmu0 ++ldtmu0 ++ldtmu0 ++ldtmu0 ++ ++nop ; nop ; thrend ++mov interrupt, 1; nop # delay slot 1 ++nop ; nop # delay slot 2 ++ ++# mc_interrupt_exit() ++::mc_interrupt_exit ++mov -, vw_wait # wait on the VDW ++ ++ldtmu0 ++ldtmu0 ++ldtmu0 ++ldtmu0 ++ ++mov -,sacq(0) # 1 ++mov -,sacq(0) # 2 ++mov -,sacq(0) # 3 ++mov -,sacq(0) # 4 ++mov -,sacq(0) # 5 ++mov -,sacq(0) # 6 ++mov -,sacq(0) # 7 ++mov -,sacq(0) # 8 ++mov -,sacq(0) # 9 ++mov -,sacq(0) # 10 ++mov -,sacq(0) # 11 ++ ++nop ; nop ; thrend ++mov interrupt, 1; nop # delay slot 1 ++nop ; nop # delay slot 2 ++ ++# mc_interrupt_exit4() ++::mc_interrupt_exit4 ++mov -, vw_wait # wait on the VDW ++ ++ldtmu0 ++ldtmu0 ++ldtmu0 ++ldtmu0 ++ ++mov -,sacq(0) # 1 ++mov -,sacq(0) # 2 ++mov -,sacq(0) # 3 ++ ++nop ; nop ; thrend ++mov interrupt, 1; nop # delay slot 1 ++nop ; nop # delay slot 2 ++ ++# mc_interrupt_exit8() ++::mc_interrupt_exit8 ++mov -, vw_wait # wait on the VDW ++ ++ldtmu0 ++ldtmu0 ++ldtmu0 ++ldtmu0 ++ ++mov -,sacq(0) # 1 ++mov -,sacq(0) # 2 ++mov -,sacq(0) # 3 ++mov -,sacq(0) # 4 ++mov -,sacq(0) # 5 ++mov -,sacq(0) # 6 ++mov -,sacq(0) # 7 ++ ++nop ; nop ; thrend ++mov interrupt, 1; nop # delay slot 1 ++nop ; nop # delay slot 2 ++ ++################################################################################ ++# mc_setup_uv(next_kernel, x, y, ref_u_base, ref_v_base, frame_width, frame_height, pitch, dst_pitch, pad0, pad1, pad2) ++::mc_setup_uv ++ ++# Read starting kernel ++mov ra31, unif ++ ++# Load first request location ++add ra_x_base, unif, elem_num # Store x ++mov ra_y, unif # Store y ++mov ra_x2_base, unif # Store frame u base ++nop ++sub ra_u2v_ref_offset, unif, ra_x2_base # Store offset to add to move from u to v in reference frame ++ ++# Read image dimensions ++sub rb25,unif,1 ++sub rb30,unif,1 ++ ++# get source pitch ++mov rb16, unif ++ ++# get destination pitch ++mov r0, unif ++mov r1, vdw_setup_1(0) ++add rb24, r1, r0 ++ ++# load constants ++ ++mov ra20, 1 ++mov ra21, 64 ++mov ra22, 256 ++mov ra23, 8 ++ ++mov rb20, 0xffffff00 ++mov rb21, 64 ++mov rb22, 255 ++mov rb23, 24 ++ ++# touch vertical context to keep simulator happy ++ ++mov ra8, 0 ++mov ra9, 0 ++mov ra10, 0 ++mov ra11, 0 ++mov ra12, 0 ++mov ra13, 0 ++mov ra14, 0 ++mov ra15, 0 ++ ++# Compute part of VPM to use for DMA output ++mov r2, qpu_num ++and r2, r2, 15 ++mov r1, r2 ++asr r1, r1, 2 ++shl r1, r1, 6 ++mov r0, r2 ++and r0, r0, 3 ++add r0, r0, r1 ++mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) # height,width added later ++shl r0, r0, 5 ++add rb27, r0, r1 ++ ++# Compute part of VPM to save data into ++mov r2, qpu_num ++and r2, r2, 15 ++mov r1, r2 ++asr r1, r1, 2 ++shl r1, r1, 6 ++mov r0, r2 ++and r0, r0, 3 ++add r0, r0, r1 ++mov r1, vpm_setup(0, 4, h8p(0, 0)) ++add rb28, r0, r1 ++ ++# Compute base address for first and second access ++mov r0, ra_x_base # Load x ++max r0, r0, 0; mov r1, ra_y # Load y ++min r0, r0, rb_frame_width_minus_1 ; mov r3, ra_x2_base # Load the frame base ++shl ra_xshift_next, r0, 3 ; mov r2, ra_u2v_ref_offset ++add ra_y, r1, 1 ++add r0, r0, r3 ++and r0, r0, ~3 ++max r1, r1, 0 ; mov ra_x_base, r0 # y ++min r1, r1, rb_frame_height_minus_1 ++# submit texture requests for first line ++add r2, r2, r0 ; mul24 r1, r1, rb_pitch ++add t0s, r0, r1 ; mov ra_x2_base, r2 ++add t0s, r2, r1 ++ ++# Dump padding words ++mov r0, unif ++mov r0, unif ++mov r0, unif ++ ++# submit texture requests for second line ++max r1, ra_y, 0 ++min r1, r1, rb_frame_height_minus_1 ++add ra_y, ra_y, 1 ++bra -, ra31 ++nop ; mul24 r1, r1, rb_pitch ++add t0s, r1, ra_x_base ++add t0s, r1, ra_x2_base ++ ++ ++ ++################################################################################ ++ ++::mc_filter_uv_b ++mov ra31, unif ++ ++# per-channel shifts were calculated on the *previous* invocation ++ ++mov ra_xshift, ra_xshift_next ++ ++# get base addresses and per-channel shifts for *next* invocation ++add r0, unif, elem_num # x ++max r0, r0, 0; mov r1, unif # y ++min r0, r0, rb_frame_width_minus_1 ; mov r3, unif # frame_base ++shl ra_xshift_next, r0, 3 ++sub r2, unif, r3 # compute offset from frame base u to frame base v ++add r0, r0, r3 ++and rb_x_base_next, r0, ~3 ++mov ra_y_next, r1 ++add ra_x2_base_next, rb_x_base_next, r2 ++ ++# set up VPM write ++mov vw_setup, rb28 ++ ++# get width,height of block ++mov r2, 16 ++mov r0, unif ++shr r1, r0, r2 # Extract width ++sub rb29, rb24, r1 # Compute vdw_setup1(dst_pitch-width) ++and r0, r0, rb22 # Extract height ++add rb17, r0, 5 ++add rb18, r0, 7 ++shl r0, r0, 7 ++ ++# r0 is currently height<<7 ++# For vr_setup we want height<<20 (so 20-7=13 additional bits) ++shl r3, r0, 13 ++shl r3, r3, 8 # Mask off top 8 bits ++shr r3, r3, 8 ++ ++add r0, r0, r1 # Combine width and height of destination area ++shl r0, r0, r2 # Shift into bits 16 upwards of the vdw_setup0 register ++add rb26, r0, rb27 ++ ++# In a B frame, so also set up VPM read ++add vr_setup, r3, rb28 ++ ++sub.setf -,8,r1 # 8-r1, so if <0 (negative) we need to use the full code ++ ++# get filter coefficients ++ ++mov r0, unif ++asr ra3, r0, rb23; mul24 r0, r0, ra22 ++asr ra2, r0, rb23; mul24 r0, r0, ra22 ++asr ra1, r0, rb23; mul24 r0, r0, ra22 ++asr ra0, r0, rb23; mov r0, unif ++asr ra7, r0, rb23; mul24 r0, r0, ra22 ++asr ra6, r0, rb23; mul24 r0, r0, ra22 ++asr ra5, r0, rb23; mul24 r0, r0, ra22 ++asr ra4, r0, rb23; mov r0, unif ++asr rb11, r0, rb23; mul24 r0, r0, ra22 ++asr rb10, r0, rb23; mul24 r0, r0, ra22 ++asr rb9, r0, rb23; mul24 r0, r0, ra22 ++asr rb8, r0, rb23; mov r0, unif ++asr rb15, r0, rb23; mul24 r0, r0, ra22 ++asr rb14, r0, rb23; mul24 r0, r0, ra22 ++asr rb13, r0, rb23; mul24 r0, r0, ra22 ++asr rb12, r0, rb23 ++ ++# r2 is elem_num ++# r3 is loop counter ++ ++mov r5rep, -8 ++mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++ ++# retrieve texture results and pick out bytes ++# then submit two more texture requests ++ ++mov r3, 0 ++ ++:uvloop_b ++# retrieve texture results and pick out bytes ++# then submit two more texture requests ++ ++sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 # loop counter increment ++shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 ++mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 ++mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch ++shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 # v8subs masks out all but bottom byte ++ ++max r2, ra_y, 0 # y ++min r2, r2, rb_frame_height_minus_1 ++add ra_y, ra_y, 1 ; mul24 r2, r2, r3 ++add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 ++add t0s, ra_x2_base, r2 ++ ++# generate seven shifted versions ++# interleave with scroll of vertical context ++ ++mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++ ++mov r2, rb21 ; mul24 r3, r0, ra0 ++nop ; mul24.ifnz r3, ra0 << 8, r1 << 8 ++sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 ++nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 ++sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 ++nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 ++sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 ++nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 ++sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 ++nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 ++sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 ++nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 ++sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 ++nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 ++sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 ++nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 ++sub r0, r2, r3 ++ ++mov r3, rb31 ++ ++mov ra8, ra9 ++mov ra9, ra10 ++mov ra10, ra11 ++mov ra11, ra12 ++mov ra12, ra13 ++mov ra13, ra14 ++ ++sub.setf -, r3, 8 ; mov r1, ra22 ++ ++# apply horizontal filter ++brr.anyn -, r:uvloop_b ++max ra14, ra15, 0 ; mul24 r0, r0, r1 # last bit of context scroll, including clamp to zero ++asr r0, r0, 15 ; mov r1, ra21 ++min.setf ra15, r0, rb22 ++ ++# apply vertical filter and write to VPM ++ ++nop ; mul24 r0, ra14, rb14 ++sub r1, r1, r0 ; mul24 r0, ra13, rb13 ++sub r1, r1, r0 ; mul24 r0, ra12, rb12 ++sub r1, r1, r0 ; mul24 r0, ra11, rb11 ++sub r1, r1, r0 ; mul24 r0, ra10, rb10 ++sub r1, r1, r0 ; mul24 r0, ra9, rb9 ++sub r1, r1, r0 ; mul24 r0, ra8, rb8 ++sub r1, r1, r0 ; mul24 r0, ra15, rb15 ++sub.ifnn r1, r1, r0 ; mov -, vw_wait ++sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 ++asr r1, r1, 15 ++min r1, r1, rb22 ++add r0, vpm, 1 # Blend in previous VPM contents at this location ++brr.anyn -, r:uvloop_b ++max r1, r1, 0 ++add r1, r1, r0 ++shr vpm, r1, 1 ++ ++ ++# DMA out for U ++ ++mov vw_setup, rb26 # VDW setup 0 ++mov vw_setup, rb29 # Stride ++mov vw_addr, unif # start the VDW ++ ++# DMA out for V ++# We need to wait for the U to complete first, but have nothing useful to compute while we wait. ++# Could potentially push this write into the start of the next pipeline stage. ++mov r0, 16 ++mov -, vw_wait ++ ++bra -, ra31 ++add vw_setup, rb26, r0 # VDW setup 0 ++mov vw_setup, rb29 # Stride ++mov vw_addr, unif # start the VDW ++ ++::mc_end +diff --git a/libavcodec/rpi_user_vcsm.h b/libavcodec/rpi_user_vcsm.h +new file mode 100644 +index 0000000..fbebbbe +--- /dev/null ++++ b/libavcodec/rpi_user_vcsm.h +@@ -0,0 +1,425 @@ ++/* ++Copyright (c) 2012, Broadcom Europe Ltd ++All rights reserved. ++ ++Redistribution and use in source and binary forms, with or without ++modification, are permitted provided that the following conditions are met: ++ * Redistributions of source code must retain the above copyright ++ notice, this list of conditions and the following disclaimer. ++ * 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. ++ * Neither the name of the copyright holder nor the ++ names of its contributors may be used to endorse or promote products ++ derived from this software without specific prior written permission. ++ ++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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. ++*/ ++ ++#ifndef __USER_VCSM__H__INCLUDED__ ++#define __USER_VCSM__H__INCLUDED__ ++ ++/* VideoCore Shared Memory - user interface library. ++** ++** This library provides all the necessary abstraction for any application to ++** make use of the shared memory service which is distributed accross a kernel ++** driver and a videocore service. ++** ++** It is an application design decision to choose or not to use this service. ++** ++** The logical flow of operations that a user application needs to follow when ++** using this service is: ++** ++** 1) Initialize the service. ++** 2) Allocate shared memory blocks. ++** 3) Start using the allocated blocks. ++** - In order to gain ownership on a block, lock the allocated block, ++** locking a block returns a valid address that the user application ++** can access. ++** - When finished with using the block for the current execution cycle ++** or function, and so when giving up the ownership, unlock the block. ++** 4) A block can be locked/unlocked as many times required - within or outside ++** of - a specific execution context. ++** 5) To completely release an allocated block, free it. ++** 6) If the service is no longer required, terminate it. ++** ++** ++** Some generic considerations: ++ ++** Allocating memory blocks. ++** ++** Memory blocks can be allocated in different manners depending on the cache ++** behavior desired. A given block can either be: ++ ++** - Allocated in a non cached fashion all the way through host and videocore. ++** - Allocated in a cached fashion on host OR videocore. ++** - Allocated in a cached fashion on host AND videocore. ++** ++** It is an application decision to determine how to allocate a block. Evidently ++** if the application will be doing substantial read/write accesses to a given block, ++** it is recommended to allocate the block at least in a 'host cached' fashion for ++** better results. ++** ++** ++** Locking memory blocks. ++** ++** When the memory block has been allocated in a host cached fashion, locking the ++** memory block (and so taking ownership of it) will trigger a cache invalidation. ++** ++** For the above reason and when using host cached allocation, it is important that ++** an application properly implements the lock/unlock mechanism to ensure cache will ++** stay coherent, otherwise there is no guarantee it will at all be. ++** ++** It is possible to dynamically change the host cache behavior (ie cached or non ++** cached) of a given allocation without needing to free and re-allocate the block. ++** This feature can be useful for such application which requires access to the block ++** only at certain times and not otherwise. By changing the cache behavior dynamically ++** the application can optimize performances for a given duration of use. ++** Such dynamic cache behavior remapping only applies to host cache and not videocore ++** cache. If one requires to change the videocore cache behavior, then a new block ++** must be created to replace the old one. ++** ++** On successful locking, a valid pointer is returned that the application can use ++** to access to data inside the block. There is no guarantee that the pointer will ++** stay valid following the unlock action corresponding to this lock. ++** ++** ++** Unocking memory blocks. ++** ++** When the memory block has been allocated in a host cached fashion, unlocking the ++** memory block (and so forgiving its ownership) will trigger a cache flush unless ++** explicitely asked not to flush the cache for performances reasons. ++** ++** For the above reason and when using host cached allocation, it is important that ++** an application properly implements the lock/unlock mechanism to ensure cache will ++** stay coherent, otherwise there is no guarantee it will at all be. ++** ++** ++** A complete API is defined below. ++*/ ++ ++#ifdef __cplusplus ++extern "C" ++{ ++#endif ++ ++/* Different status that can be dumped. ++*/ ++typedef enum ++{ ++ VCSM_STATUS_VC_WALK_ALLOC = 0, // Walks *all* the allocation on videocore. ++ // Result of the walk is seen in the videocore ++ // log. ++ VCSM_STATUS_HOST_WALK_MAP, // Walks the *full* mapping allocation on host ++ // driver (ie for all processes). Result of ++ // the walk is seen in the kernel log. ++ VCSM_STATUS_HOST_WALK_PID_MAP, // Walks the per process mapping allocation on host ++ // driver (for current process). Result of ++ // the walk is seen in the kernel log. ++ VCSM_STATUS_HOST_WALK_PID_ALLOC, // Walks the per process host allocation on host ++ // driver (for current process). Result of ++ // the walk is seen in the kernel log. ++ VCSM_STATUS_VC_MAP_ALL, // Equivalent to both VCSM_STATUS_VC_WALK_ALLOC and ++ // VCSM_STATUS_HOST_WALK_MAP. ++ // ++ VCSM_STATUS_NONE, // Must be last - invalid. ++ ++} VCSM_STATUS_T; ++ ++/* Different kind of cache behavior. ++*/ ++typedef enum ++{ ++ VCSM_CACHE_TYPE_NONE = 0, // No caching applies. ++ VCSM_CACHE_TYPE_HOST, // Allocation is cached on host (user space). ++ VCSM_CACHE_TYPE_VC, // Allocation is cached on videocore. ++ VCSM_CACHE_TYPE_HOST_AND_VC, // Allocation is cached on both host and videocore. ++ ++} VCSM_CACHE_TYPE_T; ++ ++/* Initialize the vcsm processing. ++** ++** Must be called once before attempting to do anything else. ++** ++** Returns 0 on success, -1 on error. ++*/ ++int vcsm_init( void ); ++ ++ ++/* Terminates the vcsm processing. ++** ++** Must be called vcsm services are no longer needed, it will ++** take care of removing any allocation under the current process ++** control if deemed necessary. ++*/ ++void vcsm_exit( void ); ++ ++ ++/* Queries the status of the the vcsm. ++** ++** Triggers dump of various kind of information, see the ++** different variants specified in VCSM_STATUS_T. ++** ++** Pid is optional. ++*/ ++void vcsm_status( VCSM_STATUS_T status, int pid ); ++ ++ ++/* Allocates a non-cached block of memory of size 'size' via the vcsm memory ++** allocator. ++** ++** Returns: 0 on error ++** a non-zero opaque handle on success. ++** ++** On success, the user must invoke vcsm_lock with the returned opaque ++** handle to gain access to the memory associated with the opaque handle. ++** When finished using the memory, the user calls vcsm_unlock_xx (see those ++** function definition for more details on the one that can be used). ++** ++** A well behaved application should make every attempt to lock/unlock ++** only for the duration it needs to access the memory data associated with ++** the opaque handle. ++*/ ++unsigned int vcsm_malloc( unsigned int size, char *name ); ++ ++ ++/* Allocates a cached block of memory of size 'size' via the vcsm memory ++** allocator, the type of caching requested is passed as argument of the ++** function call. ++** ++** Returns: 0 on error ++** a non-zero opaque handle on success. ++** ++** On success, the user must invoke vcsm_lock with the returned opaque ++** handle to gain access to the memory associated with the opaque handle. ++** When finished using the memory, the user calls vcsm_unlock_xx (see those ++** function definition for more details on the one that can be used). ++** ++** A well behaved application should make every attempt to lock/unlock ++** only for the duration it needs to access the memory data associated with ++** the opaque handle. ++*/ ++unsigned int vcsm_malloc_cache( unsigned int size, VCSM_CACHE_TYPE_T cache, char *name ); ++ ++ ++/* Shares an allocated block of memory via the vcsm memory allocator. ++** ++** Returns: 0 on error ++** a non-zero opaque handle on success. ++** ++** On success, the user must invoke vcsm_lock with the returned opaque ++** handle to gain access to the memory associated with the opaque handle. ++** When finished using the memory, the user calls vcsm_unlock_xx (see those ++** function definition for more details on the one that can be used). ++** ++** A well behaved application should make every attempt to lock/unlock ++** only for the duration it needs to access the memory data associated with ++** the opaque handle. ++*/ ++unsigned int vcsm_malloc_share( unsigned int handle ); ++ ++ ++/* Resizes a block of memory allocated previously by vcsm_alloc. ++** ++** Returns: 0 on success ++** -errno on error. ++** ++** The handle must be unlocked by user prior to attempting any ++** resize action. ++** ++** On error, the original size allocated against the handle ++** remains available the same way it would be following a ++** successful vcsm_malloc. ++*/ ++int vcsm_resize( unsigned int handle, unsigned int new_size ); ++ ++ ++/* Frees a block of memory that was successfully allocated by ++** a prior call the vcms_alloc. ++** ++** The handle should be considered invalid upon return from this ++** call. ++** ++** Whether any memory is actually freed up or not as the result of ++** this call will depends on many factors, if all goes well it will ++** be freed. If something goes wrong, the memory will likely end up ++** being freed up as part of the vcsm_exit process. In the end the ++** memory is guaranteed to be freed one way or another. ++*/ ++void vcsm_free( unsigned int handle ); ++ ++ ++/* Retrieves a videocore opaque handle from a mapped user address ++** pointer. The videocore handle will correspond to the actual ++** memory mapped in videocore. ++** ++** Returns: 0 on error ++** a non-zero opaque handle on success. ++** ++** Note: the videocore opaque handle is distinct from the user ++** opaque handle (allocated via vcsm_malloc) and it is only ++** significant for such application which knows what to do ++** with it, for the others it is just a number with little ++** use since nothing can be done with it (in particular ++** for safety reason it cannot be used to map anything). ++*/ ++unsigned int vcsm_vc_hdl_from_ptr( void *usr_ptr ); ++ ++ ++/* Retrieves a videocore opaque handle from a opaque handle ++** pointer. The videocore handle will correspond to the actual ++** memory mapped in videocore. ++** ++** Returns: 0 on error ++** a non-zero opaque handle on success. ++** ++** Note: the videocore opaque handle is distinct from the user ++** opaque handle (allocated via vcsm_malloc) and it is only ++** significant for such application which knows what to do ++** with it, for the others it is just a number with little ++** use since nothing can be done with it (in particular ++** for safety reason it cannot be used to map anything). ++*/ ++unsigned int vcsm_vc_hdl_from_hdl( unsigned int handle ); ++ ++ ++/* Retrieves a user opaque handle from a mapped user address ++** pointer. ++** ++** Returns: 0 on error ++** a non-zero opaque handle on success. ++*/ ++unsigned int vcsm_usr_handle( void *usr_ptr ); ++ ++ ++/* Retrieves a mapped user address from an opaque user ++** handle. ++** ++** Returns: 0 on error ++** a non-zero address on success. ++** ++** On success, the address corresponds to the pointer ++** which can access the data allocated via the vcsm_malloc ++** call. ++*/ ++void *vcsm_usr_address( unsigned int handle ); ++ ++ ++/* Locks the memory associated with this opaque handle. ++** ++** Returns: NULL on error ++** a valid pointer on success. ++** ++** A user MUST lock the handle received from vcsm_malloc ++** in order to be able to use the memory associated with it. ++** ++** On success, the pointer returned is only valid within ++** the lock content (ie until a corresponding vcsm_unlock_xx ++** is invoked). ++*/ ++void *vcsm_lock( unsigned int handle ); ++ ++ ++/* Locks the memory associated with this opaque handle. The lock ++** also gives a chance to update the *host* cache behavior of the ++** allocated buffer if so desired. The *videocore* cache behavior ++** of the allocated buffer cannot be changed by this call and such ++** attempt will be ignored. ++** ++** The system will attempt to honour the cache_update mode request, ++** the cache_result mode will provide the final answer on which cache ++** mode is really in use. Failing to change the cache mode will not ++** result in a failure to lock the buffer as it is an application ++** decision to choose what to do if (cache_result != cache_update) ++** ++** The value returned in cache_result can only be considered valid if ++** the returned pointer is non NULL. The cache_result pointer may be ++** NULL if the application does not care about the actual outcome of ++** its action with regards to the cache behavior change. ++** ++** Returns: NULL on error ++** a valid pointer on success. ++** ++** A user MUST lock the handle received from vcsm_malloc ++** in order to be able to use the memory associated with it. ++** ++** On success, the pointer returned is only valid within ++** the lock content (ie until a corresponding vcsm_unlock_xx ++** is invoked). ++*/ ++void *vcsm_lock_cache( unsigned int handle, ++ VCSM_CACHE_TYPE_T cache_update, ++ VCSM_CACHE_TYPE_T *cache_result ); ++ ++ ++/* Unlocks the memory associated with this user mapped address. ++** ++** Returns: 0 on success ++** -errno on error. ++** ++** After unlocking a mapped address, the user should no longer ++** attempt to reference it. ++*/ ++int vcsm_unlock_ptr( void *usr_ptr ); ++ ++ ++/* Unlocks the memory associated with this user mapped address. ++** Apply special processing that would override the otherwise ++** default behavior. ++** ++** If 'cache_no_flush' is specified: ++** Do not flush cache as the result of the unlock (if cache ++** flush was otherwise applicable in this case). ++** ++** Returns: 0 on success ++** -errno on error. ++** ++** After unlocking a mapped address, the user should no longer ++** attempt to reference it. ++*/ ++int vcsm_unlock_ptr_sp( void *usr_ptr, int cache_no_flush ); ++ ++ ++/* Unlocks the memory associated with this user opaque handle. ++** ++** Returns: 0 on success ++** -errno on error. ++** ++** After unlocking an opaque handle, the user should no longer ++** attempt to reference the mapped addressed once associated ++** with it. ++*/ ++int vcsm_unlock_hdl( unsigned int handle ); ++ ++ ++/* Unlocks the memory associated with this user opaque handle. ++** Apply special processing that would override the otherwise ++** default behavior. ++** ++** If 'cache_no_flush' is specified: ++** Do not flush cache as the result of the unlock (if cache ++** flush was otherwise applicable in this case). ++** ++** Returns: 0 on success ++** -errno on error. ++** ++** After unlocking an opaque handle, the user should no longer ++** attempt to reference the mapped addressed once associated ++** with it. ++*/ ++int vcsm_unlock_hdl_sp( unsigned int handle, int cache_no_flush ); ++ ++#ifdef __cplusplus ++} ++#endif ++ ++#endif /* __USER_VCSM__H__INCLUDED__ */ +-- +2.5.0 + + +From 9018000735949ecb6640187dd2571753881edcfa Mon Sep 17 00:00:00 2001 +From: Peter de Rivaz <peter.derivaz@argondesign.com> +Date: Sat, 2 May 2015 21:15:37 +0100 +Subject: [PATCH 04/68] First working version with uncached memory + +--- + libavcodec/hevc.c | 61 +++++- + libavcodec/hevc.h | 12 +- + libavcodec/hevc_cabac.c | 39 +++- + libavcodec/hevc_filter.c | 16 ++ + libavcodec/hevcpred_template.c | 6 + + libavcodec/rpi_hevc_transform.h | 422 +++++++++++++++++++++++++++++++++++++++- + libavcodec/rpi_hevc_transform.s | 153 +++++++++++++-- + libavcodec/rpi_qpu.c | 72 +++++++ + libavcodec/rpi_qpu.h | 1 + + 9 files changed, 736 insertions(+), 46 deletions(-) + +diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c +index 681e9fd..79678ea 100644 +--- a/libavcodec/hevc.c ++++ b/libavcodec/hevc.c +@@ -45,6 +45,8 @@ + #include "rpi_qpu.h" + #endif + ++// #define DISABLE_MC ++ + const uint8_t ff_hevc_pel_weight[65] = { [2] = 0, [4] = 1, [6] = 2, [8] = 3, [12] = 4, [16] = 5, [24] = 6, [32] = 7, [48] = 8, [64] = 9 }; + + /** +@@ -1068,11 +1070,15 @@ static int hls_transform_unit(HEVCContext *s, int x0, int y0, + for (i = 0; i < (size * size); i++) { + coeffs[i] = ((lc->tu.res_scale_val * coeffs_y[i]) >> 3); + } ++ printf("Cross component not supported\n"); // TODO ++ exit(-1); + s->hevcdsp.transform_add[log2_trafo_size_c-2](dst, coeffs, stride); + } + } + + if (lc->tu.cross_pf) { ++ printf("Cross component not supported\n"); // TODO ++ exit(-1); + hls_cross_component_pred(s, 1); + } + for (i = 0; i < (s->ps.sps->chroma_format_idc == 2 ? 2 : 1); i++) { +@@ -1101,6 +1107,8 @@ static int hls_transform_unit(HEVCContext *s, int x0, int y0, + for (i = 0; i < (size * size); i++) { + coeffs[i] = ((lc->tu.res_scale_val * coeffs_y[i]) >> 3); + } ++ printf("Cross component not supported\n"); // TODO ++ exit(-1); + s->hevcdsp.transform_add[log2_trafo_size_c-2](dst, coeffs, stride); + } + } +@@ -1398,6 +1406,10 @@ static void luma_mc_uni(HEVCContext *s, uint8_t *dst, ptrdiff_t dststride, + (s->sh.slice_type == B_SLICE && s->ps.pps->weighted_bipred_flag); + int idx = ff_hevc_pel_weight[block_w]; + ++#ifdef DISABLE_MC ++ return; ++#endif ++ + x_off += mv->x >> 2; + y_off += mv->y >> 2; + src += y_off * srcstride + (x_off * (1 << s->ps.sps->pixel_shift)); +@@ -1468,6 +1480,10 @@ static void luma_mc_uni(HEVCContext *s, uint8_t *dst, ptrdiff_t dststride, + uint8_t *src0 = ref0->data[0] + y_off0 * src0stride + (int)((unsigned)x_off0 << s->ps.sps->pixel_shift); + uint8_t *src1 = ref1->data[0] + y_off1 * src1stride + (int)((unsigned)x_off1 << s->ps.sps->pixel_shift); + ++#ifdef DISABLE_MC ++ return; ++#endif ++ + if (x_off0 < QPEL_EXTRA_BEFORE || y_off0 < QPEL_EXTRA_AFTER || + x_off0 >= pic_width - block_w - QPEL_EXTRA_AFTER || + y_off0 >= pic_height - block_h - QPEL_EXTRA_AFTER) { +@@ -1553,6 +1569,10 @@ static void chroma_mc_uni(HEVCContext *s, uint8_t *dst0, + intptr_t _mx = mx << (1 - hshift); + intptr_t _my = my << (1 - vshift); + ++#ifdef DISABLE_MC ++ return; ++#endif ++ + x_off += mv->x >> (2 + hshift); + y_off += mv->y >> (2 + vshift); + src0 += y_off * srcstride + (x_off * (1 << s->ps.sps->pixel_shift)); +@@ -1617,6 +1637,10 @@ static void chroma_mc_bi(HEVCContext *s, uint8_t *dst0, ptrdiff_t dststride, AVF + int hshift = s->ps.sps->hshift[1]; + int vshift = s->ps.sps->vshift[1]; + ++#ifdef DISABLE_MC ++ return; ++#endif ++ + intptr_t mx0 = av_mod_uintp2(mv0->x, 2 + hshift); + intptr_t my0 = av_mod_uintp2(mv0->y, 2 + vshift); + intptr_t mx1 = av_mod_uintp2(mv1->x, 2 + hshift); +@@ -2356,6 +2380,22 @@ static void hls_decode_neighbour(HEVCContext *s, int x_ctb, int y_ctb, + } + + #ifdef RPI ++static void rpi_execute_transform(HEVCContext *s) ++{ ++ int i=2; ++ //int j; ++ //int16_t *coeffs = s->coeffs_buf_arm[i]; ++ //for(j=s->num_coeffs[i]; j > 0; j-= 16*16, coeffs+=16*16) { ++ // s->hevcdsp.idct[4-2](coeffs, 16); ++ //} ++ ++ //gpu_cache_flush(&s->coeffs_buf[i]); ++ vpu_execute_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf[i].vc, s->num_coeffs[i] >> 8, 0, 0, 0); ++ ++ for(i=0;i<4;i++) ++ s->num_coeffs[i] = 0; ++} ++ + static void rpi_execute_pred_cmds(HEVCContext *s) + { + int i; +@@ -2376,7 +2416,6 @@ static void rpi_execute_pred_cmds(HEVCContext *s) + } + } + s->num_pred_cmds = 0; +- s->num_coeffs = 0; + } + #endif + +@@ -2423,7 +2462,8 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) + + more_data = hls_coding_quadtree(s, x_ctb, y_ctb, s->ps.sps->log2_ctb_size, 0); + #ifdef RPI +- if (x_ctb + ctb_size >= s->ps.sps->width) { ++ if (1 || x_ctb + ctb_size >= s->ps.sps->width) { // TODO watch out for deblocking! ++ rpi_execute_transform(s); + rpi_execute_pred_cmds(s); + } + #endif +@@ -3168,7 +3208,9 @@ static av_cold int hevc_decode_free(AVCodecContext *avctx) + av_freep(&s->unif_mv_cmds); + av_freep(&s->unif_xfm_cmds); + av_freep(&s->univ_pred_cmds); +- av_freep(&s->coeffs_buf); ++ for(i = 0; i < 4; i++) { ++ gpu_free(&s->coeffs_buf[i]); ++ } + #endif + + for (i = 0; i < 3; i++) { +@@ -3240,13 +3282,16 @@ static av_cold int hevc_init_context(AVCodecContext *avctx) + s->univ_pred_cmds = av_mallocz(sizeof(HEVCPredCmd)*RPI_MAX_PRED_CMDS); + if (!s->univ_pred_cmds) + goto fail; +- s->coeffs_buf = av_mallocz(sizeof(int16_t)*RPI_MAX_XFM_CMDS*16); +- if (!s->coeffs_buf) +- goto fail; ++ for(i = 0; i < 4; i++) { ++ gpu_malloc_uncached(sizeof(int16_t)*RPI_MAX_XFM_CMDS*16, &s->coeffs_buf[i]); // TODO slim this down and share across sizes ++ s->coeffs_buf_arm[i] = (int16_t*) s->coeffs_buf[i].arm; ++ if (!s->coeffs_buf_arm[i]) ++ goto fail; ++ } + s->enable_rpi = 0; + + // A little test program +- { ++ /*{ + GPU_MEM_PTR_T p; + int err = gpu_malloc_cached(16, &p); + short *q = (short *)p.arm; +@@ -3267,7 +3312,7 @@ static av_cold int hevc_init_context(AVCodecContext *avctx) + printf(")\n"); + gpu_free(&p); + goto fail; // Early out +- } ++ }*/ + + #endif + +diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h +index 71174af..1e4c34c 100644 +--- a/libavcodec/hevc.h ++++ b/libavcodec/hevc.h +@@ -39,6 +39,11 @@ + #include "thread.h" + #include "videodsp.h" + ++// define RPI to split the CABAC/prediction/transform into separate stages ++#ifdef RPI ++#include "rpi_qpu.h" ++#endif ++ + #define MAX_DPB_SIZE 16 // A.4.1 + #define MAX_REFS 16 + +@@ -882,11 +887,12 @@ typedef struct HEVCContext { + HEVCMvCmd *unif_mv_cmds; + HEVCXfmCmd *unif_xfm_cmds; + HEVCPredCmd *univ_pred_cmds; +- int16_t *coeffs_buf; +- int num_mv_cmds; ++ GPU_MEM_PTR_T coeffs_buf[4]; ++ int16_t *coeffs_buf_arm[4]; ++ int num_coeffs[4]; + int num_xfm_cmds; ++ int num_mv_cmds; + int num_pred_cmds; +- int num_coeffs; + #endif + + uint8_t *cabac_state; +diff --git a/libavcodec/hevc_cabac.c b/libavcodec/hevc_cabac.c +index c0fdfad..a7561bd 100644 +--- a/libavcodec/hevc_cabac.c ++++ b/libavcodec/hevc_cabac.c +@@ -1031,6 +1031,7 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, + int vshift = s->ps.sps->vshift[c_idx]; + uint8_t *dst = &s->frame->data[c_idx][(y0 >> vshift) * stride + + ((x0 >> hshift) << s->ps.sps->pixel_shift)]; ++ int use_vpu = s->enable_rpi && !lc->cu.cu_transquant_bypass_flag && !transform_skip_flag && !lc->tu.cross_pf && log2_trafo_size==4; + int16_t *coeffs = (int16_t*)(c_idx ? lc->edge_emu_buffer2 : lc->edge_emu_buffer); + uint8_t significant_coeff_group_flag[8][8] = {{0}}; + int explicit_rdpcm_flag = 0; +@@ -1044,6 +1045,18 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, + uint8_t dc_scale; + int pred_mode_intra = (c_idx == 0) ? lc->tu.intra_pred_mode : + lc->tu.intra_pred_mode_c; ++#ifdef RPI ++ if (s->enable_rpi) { ++ int n = trafo_size * trafo_size; ++ if (use_vpu) { ++ coeffs = s->coeffs_buf_arm[log2_trafo_size - 2] + s->num_coeffs[log2_trafo_size - 2]; ++ s->num_coeffs[log2_trafo_size - 2] += n; ++ } else { ++ coeffs = s->coeffs_buf_arm[0] + s->num_coeffs[0]; ++ s->num_coeffs[0] += n; ++ } ++ } ++#endif + + memset(coeffs, 0, trafo_size * trafo_size * sizeof(int16_t)); + +@@ -1488,6 +1501,24 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, + } else if (lc->cu.pred_mode == MODE_INTRA && c_idx == 0 && log2_trafo_size == 2) { + s->hevcdsp.idct_4x4_luma(coeffs); + } else { ++#ifdef RPI ++ if (!use_vpu) { ++ int max_xy = FFMAX(last_significant_coeff_x, last_significant_coeff_y); ++ if (max_xy == 0) ++ s->hevcdsp.idct_dc[log2_trafo_size-2](coeffs); ++ else { ++ int col_limit = last_significant_coeff_x + last_significant_coeff_y + 4; ++ if (max_xy < 4) ++ col_limit = FFMIN(4, col_limit); ++ else if (max_xy < 8) ++ col_limit = FFMIN(8, col_limit); ++ else if (max_xy < 12) ++ col_limit = FFMIN(24, col_limit); ++ ++ s->hevcdsp.idct[log2_trafo_size-2](coeffs, col_limit); ++ } ++ } ++#else + int max_xy = FFMAX(last_significant_coeff_x, last_significant_coeff_y); + if (max_xy == 0) + s->hevcdsp.idct_dc[log2_trafo_size-2](coeffs); +@@ -1501,6 +1532,7 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, + col_limit = FFMIN(24, col_limit); + s->hevcdsp.idct[log2_trafo_size-2](coeffs, col_limit); + } ++#endif + } + } + if (lc->tu.cross_pf) { +@@ -1512,14 +1544,11 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, + } + #ifdef RPI + if (s->enable_rpi) { +- int16_t *c = s->coeffs_buf + s->num_coeffs; +- int n = trafo_size * trafo_size; + HEVCPredCmd *cmd = s->univ_pred_cmds + s->num_pred_cmds++; +- memcpy(c, coeffs, n * sizeof(int16_t)); // TODO change pointer earlier and we can avoid this copy +- s->num_coeffs += n; ++ //memcpy(coeffs2, coeffs, sizeof(int16_t) * trafo_size * trafo_size); // TODO + cmd->type = RPI_PRED_TRANSFORM_ADD; + cmd->size = log2_trafo_size; +- cmd->buf = c; ++ cmd->buf = coeffs; + cmd->dst = dst; + cmd->stride = stride; + return; +diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c +index 1f33b0c..e4c3da7 100644 +--- a/libavcodec/hevc_filter.c ++++ b/libavcodec/hevc_filter.c +@@ -22,6 +22,10 @@ + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + ++//#define DISABLE_SAO ++//#define DISABLE_DEBLOCK ++//#define DISABLE_STRENGTHS ++ + #include "libavutil/common.h" + #include "libavutil/internal.h" + +@@ -273,6 +277,10 @@ static void sao_filter_CTB(HEVCContext *s, int x, int y) + edges[2] = x_ctb == s->ps.sps->ctb_width - 1; + edges[3] = y_ctb == s->ps.sps->ctb_height - 1; + ++#ifdef DISABLE_SAO ++ return; ++#endif ++ + if (restore) { + if (!edges[0]) { + left_tile_edge = no_tile_filter && s->ps.pps->tile_id[ctb_addr_ts] != s->ps.pps->tile_id[s->ps.pps->ctb_addr_rs_to_ts[ctb_addr_rs-1]]; +@@ -496,6 +504,10 @@ static void deblocking_filter_CTB(HEVCContext *s, int x0, int y0) + s->ps.sps->pcm.loop_filter_disable_flag) || + s->ps.pps->transquant_bypass_enable_flag; + ++#ifdef DISABLE_DEBLOCK ++ return; ++#endif ++ + if (x0) { + left_tc_offset = s->deblock[ctb - 1].tc_offset; + left_beta_offset = s->deblock[ctb - 1].beta_offset; +@@ -726,6 +738,10 @@ void ff_hevc_deblocking_boundary_strengths(HEVCContext *s, int x0, int y0, + int boundary_upper, boundary_left; + int i, j, bs; + ++#ifdef DISABLE_STRENGTHS ++ return; ++#endif ++ + boundary_upper = y0 > 0 && !(y0 & 7); + if (boundary_upper && + ((!s->sh.slice_loop_filter_across_slices_enabled_flag && +diff --git a/libavcodec/hevcpred_template.c b/libavcodec/hevcpred_template.c +index 6ae87cc..71c6d52 100644 +--- a/libavcodec/hevcpred_template.c ++++ b/libavcodec/hevcpred_template.c +@@ -20,6 +20,8 @@ + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + ++//#define DISABLE_INTRA ++ + #include "libavutil/pixdesc.h" + + #include "bit_depth_template.c" +@@ -114,6 +116,10 @@ do { \ + int top_right_size = (FFMIN(x0 + 2 * size_in_luma_h, s->ps.sps->width) - + (x0 + size_in_luma_h)) >> hshift; + ++#ifdef DISABLE_INTRA ++ return; ++#endif ++ + if (s->ps.pps->constrained_intra_pred_flag == 1) { + int size_in_luma_pu_v = PU(size_in_luma_v); + int size_in_luma_pu_h = PU(size_in_luma_h); +diff --git a/libavcodec/rpi_hevc_transform.h b/libavcodec/rpi_hevc_transform.h +index 85a9102..c0c279f 100644 +--- a/libavcodec/rpi_hevc_transform.h ++++ b/libavcodec/rpi_hevc_transform.h +@@ -3,11 +3,11 @@ unsigned char rpi_hevc_transform [] = { + 3, + 3, + 232, +-128, ++32, + 0, + 0, + 0, +-20, ++12, + 248, + 0, + 136, +@@ -56,9 +56,9 @@ unsigned char rpi_hevc_transform [] = { + 5, + 232, + 0, +-0, + 8, + 0, ++0, + 128, + 69, + 113, +@@ -108,8 +108,8 @@ unsigned char rpi_hevc_transform [] = { + 128, + 2, + 0, +-248, +-62, ++8, ++2, + 0, + 128, + 144, +@@ -123,13 +123,13 @@ unsigned char rpi_hevc_transform [] = { + 3, + 32, + 8, +-16, ++20, + 0, + 76, + 254, + 48, + 192, +-9, ++4, + 4, + 32, + 8, +@@ -155,14 +155,46 @@ unsigned char rpi_hevc_transform [] = { + 192, + 41, + 3, +-68, ++70, ++192, ++80, ++7, ++164, ++255, ++36, ++204, ++96, ++2, ++0, ++248, ++62, ++0, ++3, ++255, ++55, ++208, ++120, ++3, ++224, ++3, ++190, ++11, ++16, ++139, ++246, ++91, ++0, ++103, ++90, ++0, ++70, + 192, + 80, + 7, + 164, + 255, + 36, +-220, ++204, + 96, + 2, + 0, +@@ -182,7 +214,7 @@ unsigned char rpi_hevc_transform [] = { + 16, + 139, + 246, +-83, ++91, + 0, + 103, + 90, +@@ -209,4 +241,374 @@ unsigned char rpi_hevc_transform [] = { + 96, + 90, + 0, ++169, ++3, ++3, ++232, ++32, ++0, ++0, ++0, ++12, ++248, ++0, ++136, ++0, ++0, ++192, ++248, ++0, ++0, ++64, ++232, ++0, ++2, ++0, ++0, ++12, ++248, ++0, ++168, ++0, ++0, ++192, ++248, ++0, ++0, ++3, ++232, ++128, ++0, ++0, ++0, ++7, ++232, ++0, ++2, ++0, ++0, ++4, ++232, ++64, ++0, ++0, ++0, ++5, ++232, ++0, ++8, ++0, ++0, ++57, ++239, ++224, ++247, ++255, ++255, ++72, ++192, ++95, ++207, ++88, ++122, ++88, ++124, ++137, ++64, ++26, ++64, ++161, ++64, ++152, ++64, ++128, ++144, ++31, ++0, ++72, ++232, ++32, ++0, ++0, ++0, ++65, ++232, ++32, ++0, ++0, ++0, ++128, ++144, ++23, ++0, ++145, ++64, ++168, ++64, ++128, ++144, ++19, ++0, ++72, ++232, ++32, ++0, ++0, ++0, ++65, ++232, ++32, ++0, ++0, ++0, ++128, ++144, ++11, ++0, ++74, ++232, ++0, ++8, ++0, ++0, ++242, ++140, ++229, ++192, ++57, ++239, ++32, ++8, ++0, ++0, ++41, ++3, ++12, ++248, ++0, ++128, ++0, ++0, ++192, ++8, ++4, ++0, ++12, ++248, ++0, ++132, ++64, ++0, ++192, ++8, ++4, ++0, ++0, ++96, ++255, ++159, ++131, ++255, ++0, ++232, ++0, ++4, ++0, ++0, ++255, ++159, ++142, ++255, ++4, ++255, ++48, ++204, ++16, ++3, ++224, ++251, ++62, ++0, ++5, ++255, ++51, ++204, ++128, ++3, ++224, ++251, ++16, ++0, ++77, ++254, ++51, ++204, ++9, ++4, ++224, ++251, ++0, ++0, ++128, ++64, ++6, ++232, ++64, ++0, ++0, ++0, ++140, ++248, ++47, ++0, ++0, ++0, ++224, ++99, ++0, ++0, ++4, ++254, ++0, ++144, ++128, ++2, ++0, ++8, ++2, ++0, ++32, ++247, ++240, ++207, ++16, ++3, ++32, ++247, ++176, ++207, ++17, ++3, ++32, ++247, ++112, ++207, ++18, ++3, ++32, ++247, ++48, ++207, ++19, ++3, ++32, ++247, ++240, ++206, ++20, ++3, ++32, ++247, ++176, ++206, ++21, ++3, ++32, ++247, ++112, ++206, ++22, ++3, ++32, ++247, ++48, ++206, ++23, ++3, ++32, ++247, ++240, ++205, ++24, ++3, ++32, ++247, ++176, ++205, ++25, ++3, ++32, ++247, ++112, ++205, ++26, ++3, ++32, ++247, ++48, ++205, ++27, ++3, ++32, ++247, ++240, ++204, ++28, ++3, ++32, ++247, ++176, ++204, ++29, ++3, ++32, ++247, ++112, ++204, ++30, ++3, ++32, ++247, ++48, ++204, ++31, ++3, ++5, ++255, ++51, ++204, ++128, ++3, ++224, ++251, ++16, ++0, ++77, ++254, ++51, ++204, ++9, ++4, ++224, ++251, ++0, ++0, ++0, ++237, ++0, ++4, ++0, ++0, ++140, ++248, ++47, ++0, ++0, ++0, ++224, ++99, ++0, ++0, ++90, ++0, + }; +diff --git a/libavcodec/rpi_hevc_transform.s b/libavcodec/rpi_hevc_transform.s +index 5e2728d..1e389c7 100644 +--- a/libavcodec/rpi_hevc_transform.s ++++ b/libavcodec/rpi_hevc_transform.s +@@ -58,13 +58,6 @@ + # + # + +-test_add: +- vldh HX(0,0),(r0) +- vadd HX(0,0),HX(0,0),10 +- vsth HX(0,0),(r0) +- mov r0,7 # return value +- b lr +- + # Columns are transformed first + # + # Store top left half of transMatrix2 in +@@ -79,7 +72,7 @@ test_add: + # + + +-# hevc_trans_16x16(short *transMatrix2, short *coeffs, int num) ++# hevc_trans_16x16(short *transMatrix2, short *coeffs, int num) # TODO add size so we can branch to correct implementation (or perhaps have coeffs32 and num32 as secondary inputs!) + # transMatrix2: address of the constant matrix (must be at 32 byte aligned address in Videocore memory) + # coeffs: address of the transform coefficients (must be at 32 byte aligned address in Videocore memory) + # num: number of 16x16 transforms to be done +@@ -87,17 +80,17 @@ test_add: + hevc_trans_16x16: + push r6-r15, lr # TODO cut down number of used registers + +- mov r3, 2*32*2 # Twice Stride of transMatrix2 in bytes +- vld HX(32++,0),(r0 += r3) REP 16 # This is the 16x16 matrix, a transform is equivalent to multiplying input row vector * matrix ++ mov r3, 16*2 # Stride of transMatrix2 in bytes ++ vldh HX(32++,0),(r0 += r3) REP 16 # This is the 16x16 matrix, a transform is equivalent to multiplying input row vector * matrix + # Now use r0 to describe which matrix we are working on. + # Allows us to prefetch the next block of coefficients for efficiency. + mov r0,0 # This describes the location where we read our coefficients from +- mov r3,16*2 # Stride of coefficients in bytes ++ mov r3,16*2 # Stride of coefficients in bytes (TODO remove) + mov r7,16*16*2 # Total block size + mov r8,64*16 # Value used to swap from current to next VRF location + vldh HX(0++,0)+r0,(r1 += r3) REP 16 + mov r4,64 # Constant used for rounding first pass +- mov r5,1<<19 # Constant used for rounding second pass ++ mov r5,1<<11 # Constant used for rounding second pass + + # At start of block r0,r1 point to the current block (that has already been loaded) + block_loop: +@@ -113,12 +106,12 @@ block_loop: + vadd HY(0++,0)+r0,HY(0++,0)+r0,r4 REP 16 # Now add on rounding, shift down by 7, and saturate + #vsasls HY(0++,0)+r0,HY(0++,0)+r0,9 REP 16 # 9+7=16 so this ends up with the output saturated and in the top half of the word. + vasl HY(0++,0)+r0,HY(0++,0)+r0,9 REP 16 # This should be saturating, but the instruction above does not assemble? +- vmov VX(0,0++), HX(0++,32) REP 16 # For simplicity transpose this back to the original position ++ vmov VX(0,0++)+r0, HX(0++,32)+r0 REP 16 # For simplicity transpose this back to the original position + + bl col_trans_16 +- vadd HY(0++,0)+r0,HY(0++,0)+r0,r4 REP 16 # Now add on rounding, shift down by 7, and saturate +- #vsasls HY(0++,0)+r0,HY(0++,0)+r0,9 REP 16 # 9+7=16 so this ends up with the output saturated and in the top half of the word. +- vasl HY(0++,0)+r0,HY(0++,0)+r0,9 REP 16 # This should be saturating, but the instruction above does not assemble? ++ vadd HY(0++,0)+r0,HY(0++,0)+r0,r5 REP 16 # Now add on rounding, shift down by 7, and saturate ++ #vsasls HY(0++,0)+r0,HY(0++,0)+r0,4 REP 16 # 4+12=16 so this ends up with the output saturated and in the top half of the word. ++ vasl HY(0++,0)+r0,HY(0++,0)+r0,4 REP 16 # This should be saturating, but the instruction above does not assemble? (Probably because it ends with ls which is interpreted as a condition flag) + + # Save results - note there has been a transposition during the processing so we save columns + vsth VX(0,32++)+r0, (r1 += r3) REP 16 +@@ -132,16 +125,136 @@ block_loop: + + # r1,r2,r3 r7,r8 should be preserved + # HX(0++,0)+r0 is the block to be transformed +-# HX(32++,0) is the 16x16 matrix of transform coefficients ++# HX(32++,0)+r6 is the 16x16 matrix of transform coefficients + # Use HY(48,0) for intermediate results + # r0 can be used, but should be returned to its original value at the end + col_trans_16: +- add r4,r0,16 # Final value for this loop ++ add r6,r0,16 # Final value for this loop + col_trans_16_loop: + # First compute partial products for a single column +- vmul32s VY(48,0++), VX(0,0)+r0, VX(32,0++) REP 16 ++ vmul32s HY(48++,0), VX(0,0)+r0, VX(32,0++) REP 16 + # Then sum up the results and place back + vadd VY(0,0)+r0, VY(48,0++), VY(48,8++) REP 8 CLRA SACC +- addcmpblt r0,1,r4,col_trans_16_loop ++ addcmpblt r0,1,r6,col_trans_16_loop + sub r0,16 # but r0 back to its original value + b lr ++ ++col_trans_odd_16: ++ add r6,r0,16 # Final value for this loop ++col_trans_odd_16_loop: ++ # First compute partial products for a single column ++ vmul32s HY(48++,0), VX(0,0)+r0, VX(32,0++) REP 16 ++ # Then sum up the results and place back ++ vadd VY(0,0)+r0, VY(48,0++), VY(48,8++) REP 8 CLRA SACC ++ addcmpblt r0,1,r6,col_trans_odd_16_loop ++ sub r0,16 # but r0 back to its original value ++ b lr ++ ++ ++test_add: ++ vldh HX(0,0),(r0) ++ vadd HX(0,0),HX(0,0),10 ++ vsth HX(0,0),(r0) ++ mov r0,7 # return value ++ b lr ++ ++# hevc_trans_32x32(short *transMatrix2, short *coeffs, int num) ++# transMatrix2: address of the constant matrix (must be at 32 byte aligned address in Videocore memory) Even followed by odd ++# coeffs: address of the transform coefficients (must be at 32 byte aligned address in Videocore memory) ++# num: number of 16x16 transforms to be done ++# ++hevc_trans_32x32: ++ push r6-r15, lr # TODO cut down number of used registers ++ ++ # Fetch transform matrices ++ mov r3, 16*2 # Stride of transMatrix2 in bytes (and of coefficients) ++ vldh HX(32++,0),(r0 += r3) REP 16 # This is the even 16x16 matrix ++ add r0, 16*16*2 ++ vldh HX(32++,32),(r0 += r3) REP 16 # This is the odd 16x16 matrix ++ ++ mov r3, 32*2*2 # Stride used to fetch alternate rows of our input coefficient buffer ++ mov r7, 16*16*2 # Total block size ++ mov r4, 64 # Constant used for rounding first pass ++ mov r5, 1<<11 # Constant used for rounding second pass ++ sub sp,sp,32*32*2+32 # Allocate some space on the stack for us to store 32*32 shorts as temporary results (needs to be aligned) ++ # set r8 to 32byte aligned stack pointer ++ add r8,sp,31 ++ lsr r8,5 ++ lsl r8,5 ++ mov r9,r8 # Backup of the temporary storage ++ mov r10,r1 # Backup of the coefficient buffer ++block_loop32: ++ ++ # COLUMN TRANSFORM ++ # Transform the first 16 columns ++ mov r1,r10 # Input Coefficient buffer ++ mov r8,r9 # Output temporary storage ++ bl trans32 ++ # Transform the second 16 columns ++ add r8,32 ++ add r1,32 ++ bl trans32 ++ ++ # ROW TRANSFORM ++ mov r1,r9 # Input temporary storage ++ mov r8,r10 # Output Coefficient buffer ++ bl trans32 ++ # Transform the second 16 columns ++ add r8,32 ++ add r1,32 ++ bl trans32 ++ ++ add r10, 32*32*2 # move onto next block of coefficients ++ addcmpbgt r2,-1,0,block_loop32 ++ ++ add sp,sp,32*32*2+32 # Restore stack ++ ++ pop r6-r15, pc ++ ++trans32: ++ # We can no longer afford the VRF space to do prefetching when doing 32x32 ++ # Fetch the even rows ++ vldh HX(0++,0)+r0,(r1 += r3) REP 16 ++ # Fetch the odd rows ++ vldh HX(16++,0)+r0,64(r1 += r3) REP 16 # First odd row is 32 shorts ahead of r1 ++ ++ # Transform the even rows using even matrix ++ mov r0, 0 # Even rows ++ bl col_trans_16 ++ ++ # Now transform the odd rows using odd matrix ++ mov r0, 64*16 # Odd rows ++ bl col_trans_odd_16 ++ ++ # Now apply butterfly to compute the first 16 results ++ vadd HY(48++,0),HY(0++,0),HY(16++,0) REP 16 ++ vadd HY(48++,0),HY(48++,0),r4 REP 32 # add on rounding, ++ vasl HY(48++,0),HY(48++,0),9 REP 32 # shift down by 7, and saturate ++ # 16bit results now in HX(48,32) ++ mov r0,r8 ++ mov r6,32*2 ++ vsth VX(48,32++),(r0+=r6) REP 16 ++ vmov VX(0,0++)+r0, HX(0++,32)+r0 REP 16 # Store transposed ++ ++ # Now apply butterfly to compute the second 16 results (in reverse order) ++ vsub HY(63,0),HY(0,0),HY(16,0) ++ vsub HY(62,0),HY(0,0),HY(17,0) ++ vsub HY(61,0),HY(0,0),HY(18,0) ++ vsub HY(60,0),HY(0,0),HY(19,0) ++ vsub HY(59,0),HY(0,0),HY(20,0) ++ vsub HY(58,0),HY(0,0),HY(21,0) ++ vsub HY(57,0),HY(0,0),HY(22,0) ++ vsub HY(56,0),HY(0,0),HY(23,0) ++ vsub HY(55,0),HY(0,0),HY(24,0) ++ vsub HY(54,0),HY(0,0),HY(25,0) ++ vsub HY(53,0),HY(0,0),HY(26,0) ++ vsub HY(52,0),HY(0,0),HY(27,0) ++ vsub HY(51,0),HY(0,0),HY(28,0) ++ vsub HY(50,0),HY(0,0),HY(29,0) ++ vsub HY(49,0),HY(0,0),HY(30,0) ++ vsub HY(48,0),HY(0,0),HY(31,0) ++ vadd HY(48++,0),HY(48++,0),r4 REP 32 # add on rounding, ++ vasl HY(48++,0),HY(48++,0),9 REP 32 # shift down by 7, and saturate ++ add r0,r8,16*32*2 # Move to 16th row ++ vsth VX(48,32++),(r0+=r6) REP 16 ++ b lr +diff --git a/libavcodec/rpi_qpu.c b/libavcodec/rpi_qpu.c +index b1f50ee..d720546 100644 +--- a/libavcodec/rpi_qpu.c ++++ b/libavcodec/rpi_qpu.c +@@ -3,6 +3,7 @@ + // This works better than the mmap in that the memory can be cached, but requires a kernel modification to enable the device. + #define RPI_USE_VCSM + #define RPI_TIME_TOTAL_QPU ++#define RPI_TIME_TOTAL_VPU + + #include <stdio.h> + #include <stdlib.h> +@@ -48,10 +49,47 @@ typedef int int32_t; + #define QPU_CODE_SIZE 2048 + #define VPU_CODE_SIZE 2048 + ++const short rpi_transMatrix2even[32][16] = { // Even rows first ++{64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64}, ++{90, 87, 80, 70, 57, 43, 25, 9, -9, -25, -43, -57, -70, -80, -87, -90}, ++{89, 75, 50, 18, -18, -50, -75, -89, -89, -75, -50, -18, 18, 50, 75, 89}, ++{87, 57, 9, -43, -80, -90, -70, -25, 25, 70, 90, 80, 43, -9, -57, -87}, ++{83, 36, -36, -83, -83, -36, 36, 83, 83, 36, -36, -83, -83, -36, 36, 83}, ++{80, 9, -70, -87, -25, 57, 90, 43, -43, -90, -57, 25, 87, 70, -9, -80}, ++{75, -18, -89, -50, 50, 89, 18, -75, -75, 18, 89, 50, -50, -89, -18, 75}, ++{70, -43, -87, 9, 90, 25, -80, -57, 57, 80, -25, -90, -9, 87, 43, -70}, ++{64, -64, -64, 64, 64, -64, -64, 64, 64, -64, -64, 64, 64, -64, -64, 64}, ++{57, -80, -25, 90, -9, -87, 43, 70, -70, -43, 87, 9, -90, 25, 80, -57}, ++{50, -89, 18, 75, -75, -18, 89, -50, -50, 89, -18, -75, 75, 18, -89, 50}, ++{43, -90, 57, 25, -87, 70, 9, -80, 80, -9, -70, 87, -25, -57, 90, -43}, ++{36, -83, 83, -36, -36, 83, -83, 36, 36, -83, 83, -36, -36, 83, -83, 36}, ++{25, -70, 90, -80, 43, 9, -57, 87, -87, 57, -9, -43, 80, -90, 70, -25}, ++{18, -50, 75, -89, 89, -75, 50, -18, -18, 50, -75, 89, -89, 75, -50, 18}, ++{ 9, -25, 43, -57, 70, -80, 87, -90, 90, -87, 80, -70, 57, -43, 25, -9}, ++// Odd rows ++{90, 90, 88, 85, 82, 78, 73, 67, 61, 54, 46, 38, 31, 22, 13, 4}, ++{90, 82, 67, 46, 22, -4, -31, -54, -73, -85, -90, -88, -78, -61, -38, -13}, ++{88, 67, 31, -13, -54, -82, -90, -78, -46, -4, 38, 73, 90, 85, 61, 22}, ++{85, 46, -13, -67, -90, -73, -22, 38, 82, 88, 54, -4, -61, -90, -78, -31}, ++{82, 22, -54, -90, -61, 13, 78, 85, 31, -46, -90, -67, 4, 73, 88, 38}, ++{78, -4, -82, -73, 13, 85, 67, -22, -88, -61, 31, 90, 54, -38, -90, -46}, ++{73, -31, -90, -22, 78, 67, -38, -90, -13, 82, 61, -46, -88, -4, 85, 54}, ++{67, -54, -78, 38, 85, -22, -90, 4, 90, 13, -88, -31, 82, 46, -73, -61}, ++{61, -73, -46, 82, 31, -88, -13, 90, -4, -90, 22, 85, -38, -78, 54, 67}, ++{54, -85, -4, 88, -46, -61, 82, 13, -90, 38, 67, -78, -22, 90, -31, -73}, ++{46, -90, 38, 54, -90, 31, 61, -88, 22, 67, -85, 13, 73, -82, 4, 78}, ++{38, -88, 73, -4, -67, 90, -46, -31, 85, -78, 13, 61, -90, 54, 22, -82}, ++{31, -78, 90, -61, 4, 54, -88, 82, -38, -22, 73, -90, 67, -13, -46, 85}, ++{22, -61, 85, -90, 73, -38, -4, 46, -78, 90, -82, 54, -13, -31, 67, -88}, ++{13, -38, 61, -78, 88, -90, 85, -73, 54, -31, 4, 22, -46, 67, -82, 90}, ++{ 4, -13, 22, -31, 38, -46, 54, -61, 67, -73, 78, -82, 85, -88, 90, -90} ++}; ++ + struct GPU + { + unsigned int qpu_code[QPU_CODE_SIZE]; + unsigned int vpu_code[VPU_CODE_SIZE]; ++ short transMatrix2even[16*16]; + int open_count; // Number of allocated video buffers + unsigned int vc_handle; // Handle of this memory + int mb; // Mailbox handle +@@ -123,6 +161,8 @@ static int gpu_init(volatile struct GPU **gpu) { + assert(num_bytes<=VPU_CODE_SIZE*sizeof(unsigned int)); + memcpy((void*)ptr->vpu_code, rpi_hevc_transform, num_bytes); + } ++ // And the transform coefficients ++ memcpy((void*)ptr->transMatrix2even, rpi_transMatrix2even, 16*16*sizeof(short)); + + return 0; + } +@@ -274,11 +314,43 @@ unsigned int vpu_get_fn(void) { + return gpu->vc + offsetof(struct GPU,vpu_code); + } + ++unsigned int vpu_get_constants(void) { ++ if (gpu==NULL) { ++ gpu_lock(); ++ gpu_unlock(); ++ } ++ return gpu->vc + offsetof(struct GPU,transMatrix2even); ++} ++ + unsigned vpu_execute_code( unsigned code, unsigned r0, unsigned r1, unsigned r2, unsigned r3, unsigned r4, unsigned r5) + { + unsigned r; ++#ifdef RPI_TIME_TOTAL_VPU ++ static int last_time=0; ++ static long long on_time=0; ++ static long long off_time=0; ++ int start_time; ++ int end_time; ++ static int count=0; ++ static long long countr2=0; ++#endif + gpu_lock(); ++#ifdef RPI_TIME_TOTAL_VPU ++ start_time = Microseconds(); ++ if (last_time==0) ++ last_time = start_time; ++ off_time += start_time-last_time; ++#endif + r = execute_code(gpu->mb, code, r0, r1, r2, r3, r4, r5); ++#ifdef RPI_TIME_TOTAL_VPU ++ end_time = Microseconds(); ++ last_time = end_time; ++ on_time += end_time - start_time; ++ count++; ++ countr2 += r2; ++ if ((count&0x7f)==0) ++ printf("VPU %d %lld On=%dms, Off=%dms\n",count,countr2,(int)(on_time/1000),(int)(off_time/1000)); ++#endif + gpu_unlock(); + return r; + } +diff --git a/libavcodec/rpi_qpu.h b/libavcodec/rpi_qpu.h +index 4e3c35c..814fc3c 100644 +--- a/libavcodec/rpi_qpu.h ++++ b/libavcodec/rpi_qpu.h +@@ -34,6 +34,7 @@ extern unsigned int qpu_get_fn(int num); + + // VPU specific functions + extern unsigned int vpu_get_fn(void); ++extern unsigned int vpu_get_constants(void); + extern unsigned vpu_execute_code( unsigned code, unsigned r0, unsigned r1, unsigned r2, unsigned r3, unsigned r4, unsigned r5); + + // Simple test of shader code +-- +2.5.0 + + +From 4732d45788d56c44bda51c0cb12be912df89dab7 Mon Sep 17 00:00:00 2001 +From: Peter de Rivaz <peter.derivaz@gmail.com> +Date: Tue, 5 May 2015 09:41:23 +0100 +Subject: [PATCH 05/68] Fixed deblocking + +--- + libavcodec/hevc.c | 20 +++++++++++++++++--- + 1 file changed, 17 insertions(+), 3 deletions(-) + +diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c +index 79678ea..862f915 100644 +--- a/libavcodec/hevc.c ++++ b/libavcodec/hevc.c +@@ -2389,8 +2389,9 @@ static void rpi_execute_transform(HEVCContext *s) + // s->hevcdsp.idct[4-2](coeffs, 16); + //} + +- //gpu_cache_flush(&s->coeffs_buf[i]); ++ gpu_cache_flush(&s->coeffs_buf[i]); + vpu_execute_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf[i].vc, s->num_coeffs[i] >> 8, 0, 0, 0); ++ gpu_cache_flush(&s->coeffs_buf[i]); + + for(i=0;i<4;i++) + s->num_coeffs[i] = 0; +@@ -2429,6 +2430,7 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) + int ctb_addr_ts = s->ps.pps->ctb_addr_rs_to_ts[s->sh.slice_ctb_addr_rs]; + + #ifdef RPI ++ int start_ctb_x = (s->sh.slice_ctb_addr_rs % ((s->ps.sps->width + ctb_size - 1) >> s->ps.sps->log2_ctb_size)) << s->ps.sps->log2_ctb_size; + s->enable_rpi = 1; // TODO this should depend on cross component and frame width etc. + #endif + +@@ -2462,9 +2464,17 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) + + more_data = hls_coding_quadtree(s, x_ctb, y_ctb, s->ps.sps->log2_ctb_size, 0); + #ifdef RPI +- if (1 || x_ctb + ctb_size >= s->ps.sps->width) { // TODO watch out for deblocking! ++ if (s->enable_rpi && x_ctb + ctb_size >= s->ps.sps->width) { ++ int x; ++ // Transform all blocks + rpi_execute_transform(s); ++ // Perform intra prediction and residual reconstruction + rpi_execute_pred_cmds(s); ++ // Perform deblocking for CTBs in this row ++ for(x = start_ctb_x; x <= x_ctb; x += ctb_size) { // TODO this will fail for tiles ++ ff_hevc_hls_filters(s, x, y_ctb, ctb_size); ++ } ++ start_ctb_x = 0; + } + #endif + if (more_data < 0) { +@@ -2475,6 +2485,10 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) + + ctb_addr_ts++; + ff_hevc_save_states(s, ctb_addr_ts); ++#ifdef RPI ++ if (s->enable_rpi) ++ continue; ++#endif + ff_hevc_hls_filters(s, x_ctb, y_ctb, ctb_size); + } + +@@ -3283,7 +3297,7 @@ static av_cold int hevc_init_context(AVCodecContext *avctx) + if (!s->univ_pred_cmds) + goto fail; + for(i = 0; i < 4; i++) { +- gpu_malloc_uncached(sizeof(int16_t)*RPI_MAX_XFM_CMDS*16, &s->coeffs_buf[i]); // TODO slim this down and share across sizes ++ gpu_malloc_cached(sizeof(int16_t)*RPI_MAX_XFM_CMDS*16, &s->coeffs_buf[i]); // TODO slim this down and share across sizes + s->coeffs_buf_arm[i] = (int16_t*) s->coeffs_buf[i].arm; + if (!s->coeffs_buf_arm[i]) + goto fail; +-- +2.5.0 + + +From ddb4cf90d99f2e213de85244cd8e751570d794a8 Mon Sep 17 00:00:00 2001 +From: Peter de Rivaz <peter.derivaz@gmail.com> +Date: Tue, 5 May 2015 11:32:30 +0100 +Subject: [PATCH 06/68] Added 32x32 transform + +--- + libavcodec/hevc.c | 8 +- + libavcodec/hevc_cabac.c | 4 +- + libavcodec/rpi_hevc_transform.h | 200 +++++++++++++++++----------------------- + libavcodec/rpi_hevc_transform.s | 102 ++++++++++---------- + libavcodec/rpi_qpu.c | 4 +- + 5 files changed, 148 insertions(+), 170 deletions(-) + +diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c +index 862f915..fe71e03 100644 +--- a/libavcodec/hevc.c ++++ b/libavcodec/hevc.c +@@ -2389,9 +2389,11 @@ static void rpi_execute_transform(HEVCContext *s) + // s->hevcdsp.idct[4-2](coeffs, 16); + //} + +- gpu_cache_flush(&s->coeffs_buf[i]); +- vpu_execute_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf[i].vc, s->num_coeffs[i] >> 8, 0, 0, 0); +- gpu_cache_flush(&s->coeffs_buf[i]); ++ gpu_cache_flush(&s->coeffs_buf[2]); ++ gpu_cache_flush(&s->coeffs_buf[3]); ++ vpu_execute_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf[2].vc, s->num_coeffs[2] >> 8, s->coeffs_buf[3].vc, s->num_coeffs[3] >> 10, 0); ++ gpu_cache_flush(&s->coeffs_buf[2]); ++ gpu_cache_flush(&s->coeffs_buf[3]); + + for(i=0;i<4;i++) + s->num_coeffs[i] = 0; +diff --git a/libavcodec/hevc_cabac.c b/libavcodec/hevc_cabac.c +index a7561bd..3e6dabf 100644 +--- a/libavcodec/hevc_cabac.c ++++ b/libavcodec/hevc_cabac.c +@@ -1031,7 +1031,9 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, + int vshift = s->ps.sps->vshift[c_idx]; + uint8_t *dst = &s->frame->data[c_idx][(y0 >> vshift) * stride + + ((x0 >> hshift) << s->ps.sps->pixel_shift)]; +- int use_vpu = s->enable_rpi && !lc->cu.cu_transquant_bypass_flag && !transform_skip_flag && !lc->tu.cross_pf && log2_trafo_size==4; ++#ifdef RPI ++ int use_vpu = s->enable_rpi && !lc->cu.cu_transquant_bypass_flag && !transform_skip_flag && !lc->tu.cross_pf && log2_trafo_size>=4; ++#endif + int16_t *coeffs = (int16_t*)(c_idx ? lc->edge_emu_buffer2 : lc->edge_emu_buffer); + uint8_t significant_coeff_group_flag[8][8] = {{0}}; + int explicit_rdpcm_flag = 0; +diff --git a/libavcodec/rpi_hevc_transform.h b/libavcodec/rpi_hevc_transform.h +index c0c279f..6d772d7 100644 +--- a/libavcodec/rpi_hevc_transform.h ++++ b/libavcodec/rpi_hevc_transform.h +@@ -1,6 +1,10 @@ + unsigned char rpi_hevc_transform [] = { + 169, + 3, ++62, ++64, ++79, ++64, + 3, + 232, + 32, +@@ -17,6 +21,22 @@ unsigned char rpi_hevc_transform [] = { + 248, + 0, + 0, ++64, ++232, ++0, ++2, ++0, ++0, ++12, ++248, ++0, ++168, ++0, ++0, ++192, ++248, ++0, ++0, + 0, + 96, + 3, +@@ -79,7 +99,7 @@ unsigned char rpi_hevc_transform [] = { + 70, + 128, + 144, +-39, ++40, + 0, + 4, + 255, +@@ -113,7 +133,7 @@ unsigned char rpi_hevc_transform [] = { + 0, + 128, + 144, +-22, ++23, + 0, + 4, + 255, +@@ -153,6 +173,8 @@ unsigned char rpi_hevc_transform [] = { + 140, + 211, + 192, ++34, ++31, + 41, + 3, + 70, +@@ -195,7 +217,7 @@ unsigned char rpi_hevc_transform [] = { + 255, + 36, + 204, +-96, ++224, + 2, + 0, + 248, +@@ -219,62 +241,10 @@ unsigned char rpi_hevc_transform [] = { + 103, + 90, + 0, +-8, +-240, +-0, +-128, +-128, +-3, +-0, +-247, +-32, +-128, +-10, +-4, +-136, +-240, +-32, +-0, +-128, +-3, +-112, +-96, +-90, +-0, +-169, +-3, +-3, +-232, +-32, +-0, +-0, +-0, +-12, +-248, +-0, +-136, +-0, +-0, +-192, +-248, +-0, +-0, ++225, ++64, ++242, + 64, +-232, +-0, +-2, +-0, +-0, +-12, +-248, +-0, +-168, +-0, +-0, +-192, +-248, +-0, +-0, + 3, + 232, + 128, +@@ -287,18 +257,6 @@ unsigned char rpi_hevc_transform [] = { + 2, + 0, + 0, +-4, +-232, +-64, +-0, +-0, +-0, +-5, +-232, +-0, +-8, +-0, +-0, + 57, + 239, + 224, +@@ -317,18 +275,26 @@ unsigned char rpi_hevc_transform [] = { + 64, + 26, + 64, ++4, ++232, ++64, ++0, ++0, ++0, ++149, ++96, + 161, + 64, + 152, + 64, + 128, + 144, +-31, ++35, + 0, + 72, + 232, +-32, + 0, ++4, + 0, + 0, + 65, +@@ -339,8 +305,16 @@ unsigned char rpi_hevc_transform [] = { + 0, + 128, + 144, +-23, ++27, ++0, ++4, ++232, ++0, ++8, + 0, ++0, ++69, ++96, + 145, + 64, + 168, +@@ -351,8 +325,8 @@ unsigned char rpi_hevc_transform [] = { + 0, + 72, + 232, +-32, + 0, ++4, + 0, + 0, + 65, +@@ -373,7 +347,7 @@ unsigned char rpi_hevc_transform [] = { + 0, + 242, + 140, +-229, ++221, + 192, + 57, + 239, +@@ -383,6 +357,8 @@ unsigned char rpi_hevc_transform [] = { + 0, + 41, + 3, ++239, ++3, + 12, + 248, + 0, +@@ -390,7 +366,7 @@ unsigned char rpi_hevc_transform [] = { + 0, + 0, + 192, +-8, ++248, + 4, + 0, + 12, +@@ -400,14 +376,14 @@ unsigned char rpi_hevc_transform [] = { + 64, + 0, + 192, +-8, ++248, + 4, + 0, + 0, + 96, + 255, + 159, +-131, ++154, + 255, + 0, + 232, +@@ -417,7 +393,7 @@ unsigned char rpi_hevc_transform [] = { + 0, + 255, + 159, +-142, ++165, + 255, + 4, + 255, +@@ -429,7 +405,7 @@ unsigned char rpi_hevc_transform [] = { + 251, + 62, + 0, +-5, ++4, + 255, + 51, + 204, +@@ -439,15 +415,15 @@ unsigned char rpi_hevc_transform [] = { + 251, + 16, + 0, +-77, ++76, + 254, + 51, + 204, +-9, +-4, ++128, ++3, + 224, + 251, +-0, ++20, + 0, + 128, + 64, +@@ -467,16 +443,6 @@ unsigned char rpi_hevc_transform [] = { + 99, + 0, + 0, +-4, +-254, +-0, +-144, +-128, +-2, +-0, +-8, +-2, +-0, + 32, + 247, + 240, +@@ -488,92 +454,92 @@ unsigned char rpi_hevc_transform [] = { + 176, + 207, + 17, +-3, ++19, + 32, + 247, + 112, + 207, + 18, +-3, ++35, + 32, + 247, + 48, + 207, + 19, +-3, ++51, + 32, + 247, + 240, + 206, + 20, +-3, ++67, + 32, + 247, + 176, + 206, + 21, +-3, ++83, + 32, + 247, + 112, + 206, + 22, +-3, ++99, + 32, + 247, + 48, + 206, + 23, +-3, ++115, + 32, + 247, + 240, + 205, + 24, +-3, ++131, + 32, + 247, + 176, + 205, + 25, +-3, ++147, + 32, + 247, + 112, + 205, + 26, +-3, ++163, + 32, + 247, + 48, + 205, + 27, +-3, ++179, + 32, + 247, + 240, + 204, + 28, +-3, ++195, + 32, + 247, + 176, + 204, + 29, +-3, ++211, + 32, + 247, + 112, + 204, + 30, +-3, ++227, + 32, + 247, + 48, + 204, + 31, +-3, +-5, ++243, ++4, + 255, + 51, + 204, +@@ -583,20 +549,20 @@ unsigned char rpi_hevc_transform [] = { + 251, + 16, + 0, +-77, ++76, + 254, + 51, + 204, +-9, +-4, ++128, ++3, + 224, + 251, +-0, ++20, + 0, + 0, + 237, ++32, + 0, +-4, + 0, + 0, + 140, +@@ -609,6 +575,6 @@ unsigned char rpi_hevc_transform [] = { + 99, + 0, + 0, +-90, +-0, ++111, ++3, + }; +diff --git a/libavcodec/rpi_hevc_transform.s b/libavcodec/rpi_hevc_transform.s +index 1e389c7..afdb32a 100644 +--- a/libavcodec/rpi_hevc_transform.s ++++ b/libavcodec/rpi_hevc_transform.s +@@ -76,12 +76,19 @@ + # transMatrix2: address of the constant matrix (must be at 32 byte aligned address in Videocore memory) + # coeffs: address of the transform coefficients (must be at 32 byte aligned address in Videocore memory) + # num: number of 16x16 transforms to be done ++# coeffs32 ++# num32: number of 32x32 transforms + # + hevc_trans_16x16: + push r6-r15, lr # TODO cut down number of used registers +- ++ mov r14,r3 # coeffs32 ++ mov r15,r4 # num32 + mov r3, 16*2 # Stride of transMatrix2 in bytes + vldh HX(32++,0),(r0 += r3) REP 16 # This is the 16x16 matrix, a transform is equivalent to multiplying input row vector * matrix ++ ++ add r0, 16*16*2 # For 32x32 transforms we also need this matrix ++ vldh HX(32++,32),(r0 += r3) REP 16 # This is the odd 16x16 matrix ++ + # Now use r0 to describe which matrix we are working on. + # Allows us to prefetch the next block of coefficients for efficiency. + mov r0,0 # This describes the location where we read our coefficients from +@@ -121,6 +128,10 @@ block_loop: + add r1,r7 + + addcmpbgt r2,-1,0,block_loop ++ ++ # Now go and do any 32x32 transforms ++ b hevc_trans_32x32 ++ + pop r6-r15, pc + + # r1,r2,r3 r7,r8 should be preserved +@@ -136,26 +147,18 @@ col_trans_16_loop: + # Then sum up the results and place back + vadd VY(0,0)+r0, VY(48,0++), VY(48,8++) REP 8 CLRA SACC + addcmpblt r0,1,r6,col_trans_16_loop +- sub r0,16 # but r0 back to its original value ++ sub r0,16 # put r0 back to its original value + b lr + + col_trans_odd_16: + add r6,r0,16 # Final value for this loop + col_trans_odd_16_loop: + # First compute partial products for a single column +- vmul32s HY(48++,0), VX(0,0)+r0, VX(32,0++) REP 16 ++ vmul32s HY(48++,0), VX(0,0)+r0, VX(32,32++) REP 16 + # Then sum up the results and place back + vadd VY(0,0)+r0, VY(48,0++), VY(48,8++) REP 8 CLRA SACC + addcmpblt r0,1,r6,col_trans_odd_16_loop +- sub r0,16 # but r0 back to its original value +- b lr +- +- +-test_add: +- vldh HX(0,0),(r0) +- vadd HX(0,0),HX(0,0),10 +- vsth HX(0,0),(r0) +- mov r0,7 # return value ++ sub r0,16 # put r0 back to its original value + b lr + + # hevc_trans_32x32(short *transMatrix2, short *coeffs, int num) +@@ -164,18 +167,17 @@ test_add: + # num: number of 16x16 transforms to be done + # + hevc_trans_32x32: +- push r6-r15, lr # TODO cut down number of used registers ++ mov r1,r14 # coeffs ++ mov r2,r15 # num + +- # Fetch transform matrices +- mov r3, 16*2 # Stride of transMatrix2 in bytes (and of coefficients) +- vldh HX(32++,0),(r0 += r3) REP 16 # This is the even 16x16 matrix +- add r0, 16*16*2 +- vldh HX(32++,32),(r0 += r3) REP 16 # This is the odd 16x16 matrix ++ # Fetch odd transform matrix ++ #mov r3, 16*2 # Stride of transMatrix2 in bytes (and of coefficients) ++ #vldh HX(32++,0),(r0 += r3) REP 16 # This is the even 16x16 matrix ++ #add r0, 16*16*2 ++ #vldh HX(32++,32),(r0 += r3) REP 16 # This is the odd 16x16 matrix + + mov r3, 32*2*2 # Stride used to fetch alternate rows of our input coefficient buffer + mov r7, 16*16*2 # Total block size +- mov r4, 64 # Constant used for rounding first pass +- mov r5, 1<<11 # Constant used for rounding second pass + sub sp,sp,32*32*2+32 # Allocate some space on the stack for us to store 32*32 shorts as temporary results (needs to be aligned) + # set r8 to 32byte aligned stack pointer + add r8,sp,31 +@@ -186,21 +188,27 @@ hevc_trans_32x32: + block_loop32: + + # COLUMN TRANSFORM ++ mov r4, 64 # Constant used for rounding first pass ++ mov r5, 9 # left shift used for rounding first pass ++ + # Transform the first 16 columns + mov r1,r10 # Input Coefficient buffer + mov r8,r9 # Output temporary storage + bl trans32 + # Transform the second 16 columns +- add r8,32 ++ add r8,32*16*2 + add r1,32 + bl trans32 + + # ROW TRANSFORM ++ mov r4, 1<<11 # Constant used for rounding second pass ++ mov r5, 4 # left shift used for rounding second pass ++ + mov r1,r9 # Input temporary storage + mov r8,r10 # Output Coefficient buffer + bl trans32 + # Transform the second 16 columns +- add r8,32 ++ add r8,32*16*2 + add r1,32 + bl trans32 + +@@ -212,11 +220,12 @@ block_loop32: + pop r6-r15, pc + + trans32: ++ push lr + # We can no longer afford the VRF space to do prefetching when doing 32x32 + # Fetch the even rows +- vldh HX(0++,0)+r0,(r1 += r3) REP 16 ++ vldh HX(0++,0),(r1 += r3) REP 16 + # Fetch the odd rows +- vldh HX(16++,0)+r0,64(r1 += r3) REP 16 # First odd row is 32 shorts ahead of r1 ++ vldh HX(16++,0),64(r1 += r3) REP 16 # First odd row is 32 shorts ahead of r1 + + # Transform the even rows using even matrix + mov r0, 0 # Even rows +@@ -228,33 +237,32 @@ trans32: + + # Now apply butterfly to compute the first 16 results + vadd HY(48++,0),HY(0++,0),HY(16++,0) REP 16 +- vadd HY(48++,0),HY(48++,0),r4 REP 32 # add on rounding, +- vasl HY(48++,0),HY(48++,0),9 REP 32 # shift down by 7, and saturate ++ vadd HY(48++,0),HY(48++,0),r4 REP 16 # add on rounding, ++ vasl HY(48++,0),HY(48++,0),r5 REP 16 # shift down by 7, and saturate + # 16bit results now in HX(48,32) + mov r0,r8 + mov r6,32*2 + vsth VX(48,32++),(r0+=r6) REP 16 +- vmov VX(0,0++)+r0, HX(0++,32)+r0 REP 16 # Store transposed + + # Now apply butterfly to compute the second 16 results (in reverse order) +- vsub HY(63,0),HY(0,0),HY(16,0) +- vsub HY(62,0),HY(0,0),HY(17,0) +- vsub HY(61,0),HY(0,0),HY(18,0) +- vsub HY(60,0),HY(0,0),HY(19,0) +- vsub HY(59,0),HY(0,0),HY(20,0) +- vsub HY(58,0),HY(0,0),HY(21,0) +- vsub HY(57,0),HY(0,0),HY(22,0) +- vsub HY(56,0),HY(0,0),HY(23,0) +- vsub HY(55,0),HY(0,0),HY(24,0) +- vsub HY(54,0),HY(0,0),HY(25,0) +- vsub HY(53,0),HY(0,0),HY(26,0) +- vsub HY(52,0),HY(0,0),HY(27,0) +- vsub HY(51,0),HY(0,0),HY(28,0) +- vsub HY(50,0),HY(0,0),HY(29,0) +- vsub HY(49,0),HY(0,0),HY(30,0) +- vsub HY(48,0),HY(0,0),HY(31,0) +- vadd HY(48++,0),HY(48++,0),r4 REP 32 # add on rounding, +- vasl HY(48++,0),HY(48++,0),9 REP 32 # shift down by 7, and saturate +- add r0,r8,16*32*2 # Move to 16th row ++ vsub HY(63,0),HY(0 ,0),HY(16,0) ++ vsub HY(62,0),HY(1 ,0),HY(17,0) ++ vsub HY(61,0),HY(2 ,0),HY(18,0) ++ vsub HY(60,0),HY(3 ,0),HY(19,0) ++ vsub HY(59,0),HY(4 ,0),HY(20,0) ++ vsub HY(58,0),HY(5 ,0),HY(21,0) ++ vsub HY(57,0),HY(6 ,0),HY(22,0) ++ vsub HY(56,0),HY(7 ,0),HY(23,0) ++ vsub HY(55,0),HY(8 ,0),HY(24,0) ++ vsub HY(54,0),HY(9 ,0),HY(25,0) ++ vsub HY(53,0),HY(10,0),HY(26,0) ++ vsub HY(52,0),HY(11,0),HY(27,0) ++ vsub HY(51,0),HY(12,0),HY(28,0) ++ vsub HY(50,0),HY(13,0),HY(29,0) ++ vsub HY(49,0),HY(14,0),HY(30,0) ++ vsub HY(48,0),HY(15,0),HY(31,0) ++ vadd HY(48++,0),HY(48++,0),r4 REP 16 # add on rounding, ++ vasl HY(48++,0),HY(48++,0),r5 REP 16 # shift down by 7, and saturate ++ add r0,r8,32 + vsth VX(48,32++),(r0+=r6) REP 16 +- b lr ++ pop pc +diff --git a/libavcodec/rpi_qpu.c b/libavcodec/rpi_qpu.c +index d720546..12ad5fb 100644 +--- a/libavcodec/rpi_qpu.c ++++ b/libavcodec/rpi_qpu.c +@@ -89,7 +89,7 @@ struct GPU + { + unsigned int qpu_code[QPU_CODE_SIZE]; + unsigned int vpu_code[VPU_CODE_SIZE]; +- short transMatrix2even[16*16]; ++ short transMatrix2even[16*16*2]; + int open_count; // Number of allocated video buffers + unsigned int vc_handle; // Handle of this memory + int mb; // Mailbox handle +@@ -162,7 +162,7 @@ static int gpu_init(volatile struct GPU **gpu) { + memcpy((void*)ptr->vpu_code, rpi_hevc_transform, num_bytes); + } + // And the transform coefficients +- memcpy((void*)ptr->transMatrix2even, rpi_transMatrix2even, 16*16*sizeof(short)); ++ memcpy((void*)ptr->transMatrix2even, rpi_transMatrix2even, sizeof(rpi_transMatrix2even)); + + return 0; + } +-- +2.5.0 + + +From cb4444b27d7e1d38d42375f52cd3741c2ebbe4ec Mon Sep 17 00:00:00 2001 +From: Peter de Rivaz <peter.derivaz@gmail.com> +Date: Tue, 5 May 2015 16:57:03 +0100 +Subject: [PATCH 07/68] Clear coefficients in advance + +--- + libavcodec/hevc.c | 129 ++++++++++++++++++++++++++++------------ + libavcodec/hevc.h | 6 +- + libavcodec/hevc_cabac.c | 7 ++- + libavcodec/rpi_hevc_transform.h | 50 ++++++++++++++++ + libavcodec/rpi_hevc_transform.s | 16 +++++ + 5 files changed, 168 insertions(+), 40 deletions(-) + +diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c +index fe71e03..8b93ca2 100644 +--- a/libavcodec/hevc.c ++++ b/libavcodec/hevc.c +@@ -43,6 +43,8 @@ + + #ifdef RPI + #include "rpi_qpu.h" ++// For some unknown reason, the code seems to crash if I do a late malloc ++#define EARLY_MALLOC + #endif + + // #define DISABLE_MC +@@ -61,6 +63,20 @@ const uint8_t ff_hevc_pel_weight[65] = { [2] = 0, [4] = 1, [6] = 2, [8] = 3, [12 + /* free everything allocated by pic_arrays_init() */ + static void pic_arrays_free(HEVCContext *s) + { ++#ifdef RPI ++#ifdef EARLY_MALLOC ++#else ++ printf("pic_arrays_free\n"); ++ if (s->coeffs_buf_arm[0]) { ++ gpu_free(&s->coeffs_buf_default); ++ s->coeffs_buf_arm[0] = 0; ++ } ++ if (s->coeffs_buf_arm[2]) { ++ gpu_free(&s->coeffs_buf_accelerated); ++ s->coeffs_buf_arm[2] = 0; ++ } ++#endif ++#endif + av_freep(&s->sao); + av_freep(&s->deblock); + +@@ -97,6 +113,28 @@ static int pic_arrays_init(HEVCContext *s, const HEVCSPS *sps) + int ctb_count = sps->ctb_width * sps->ctb_height; + int min_pu_size = sps->min_pu_width * sps->min_pu_height; + ++#ifdef RPI ++#ifdef EARLY_MALLOC ++#else ++ int coeffs_in_ctb = (1 << s->ps.sps->log2_ctb_size) * (1 << s->ps.sps->log2_ctb_size); ++ int coefs_per_row = sps->ctb_width * coeffs_in_ctb * 3; // Allow space for chroma ++ printf("pic_arrays_init\n"); ++ printf("Allocated %d\n",coefs_per_row); ++ gpu_malloc_cached(sizeof(int16_t) * coefs_per_row, &s->coeffs_buf_default); ++ s->coeffs_buf_arm[0] = (int16_t*) s->coeffs_buf_default.arm; ++ if (!s->coeffs_buf_arm[0]) ++ goto fail; ++ gpu_malloc_cached(sizeof(int16_t) * coefs_per_row * 2, &s->coeffs_buf_accelerated); ++ s->coeffs_buf_arm[2] = (int16_t*) s->coeffs_buf_accelerated.arm; ++ s->coeffs_buf_vc[2] = s->coeffs_buf_accelerated.vc; ++ if (!s->coeffs_buf_arm[2]) ++ goto fail; ++ s->coeffs_buf_arm[3] = coefs_per_row + s->coeffs_buf_arm[2]; ++ s->coeffs_buf_vc[3] = sizeof(int16_t) * coefs_per_row + s->coeffs_buf_vc[2]; ++ printf("Done\n"); ++#endif ++#endif ++ + s->bs_width = (width >> 2) + 1; + s->bs_height = (height >> 2) + 1; + +@@ -2389,11 +2427,10 @@ static void rpi_execute_transform(HEVCContext *s) + // s->hevcdsp.idct[4-2](coeffs, 16); + //} + +- gpu_cache_flush(&s->coeffs_buf[2]); +- gpu_cache_flush(&s->coeffs_buf[3]); +- vpu_execute_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf[2].vc, s->num_coeffs[2] >> 8, s->coeffs_buf[3].vc, s->num_coeffs[3] >> 10, 0); +- gpu_cache_flush(&s->coeffs_buf[2]); +- gpu_cache_flush(&s->coeffs_buf[3]); ++ ++ gpu_cache_flush(&s->coeffs_buf_accelerated); ++ vpu_execute_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf_vc[2], s->num_coeffs[2] >> 8, s->coeffs_buf_vc[3], s->num_coeffs[3] >> 10, 0); ++ //gpu_cache_flush(&s->coeffs_buf_accelerated); + + for(i=0;i<4;i++) + s->num_coeffs[i] = 0; +@@ -2415,7 +2452,9 @@ static void rpi_execute_pred_cmds(HEVCContext *s) + lc->na.cand_up_right = (cmd->na >> 0) & 1; + s->hpc.intra_pred[cmd->size - 2](s, cmd->x, cmd->y, cmd->c_idx); + } else { ++ int trafo_size = 1 << cmd->size; + s->hevcdsp.transform_add[cmd->size-2](cmd->dst, cmd->buf, cmd->stride); ++ memset(cmd->buf, 0, trafo_size * trafo_size * sizeof(int16_t)); // Clear coefficients here while they are in the cache + } + } + s->num_pred_cmds = 0; +@@ -3224,10 +3263,18 @@ static av_cold int hevc_decode_free(AVCodecContext *avctx) + av_freep(&s->unif_mv_cmds); + av_freep(&s->unif_xfm_cmds); + av_freep(&s->univ_pred_cmds); +- for(i = 0; i < 4; i++) { +- gpu_free(&s->coeffs_buf[i]); ++ ++#ifdef EARLY_MALLOC ++ if (s->coeffs_buf_arm[0]) { ++ gpu_free(&s->coeffs_buf_default); ++ s->coeffs_buf_arm[0] = 0; ++ } ++ if (s->coeffs_buf_arm[2]) { ++ gpu_free(&s->coeffs_buf_accelerated); ++ s->coeffs_buf_arm[2] = 0; + } + #endif ++#endif + + for (i = 0; i < 3; i++) { + av_freep(&s->sao_pixel_buffer_h[i]); +@@ -3275,6 +3322,16 @@ static av_cold int hevc_decode_free(AVCodecContext *avctx) + return 0; + } + ++#ifdef RPI ++static av_cold void memclear16(int16_t *p, int n) ++{ ++ vpu_execute_code( vpu_get_fn(), p, n, 0, 0, 0, 1); ++ //int i; ++ //for(i=0;i<n;i++) ++ // p[i] = 0; ++} ++#endif ++ + static av_cold int hevc_init_context(AVCodecContext *avctx) + { + HEVCContext *s = avctx->priv_data; +@@ -3298,37 +3355,35 @@ static av_cold int hevc_init_context(AVCodecContext *avctx) + s->univ_pred_cmds = av_mallocz(sizeof(HEVCPredCmd)*RPI_MAX_PRED_CMDS); + if (!s->univ_pred_cmds) + goto fail; +- for(i = 0; i < 4; i++) { +- gpu_malloc_cached(sizeof(int16_t)*RPI_MAX_XFM_CMDS*16, &s->coeffs_buf[i]); // TODO slim this down and share across sizes +- s->coeffs_buf_arm[i] = (int16_t*) s->coeffs_buf[i].arm; +- if (!s->coeffs_buf_arm[i]) +- goto fail; +- } +- s->enable_rpi = 0; + +- // A little test program +- /*{ +- GPU_MEM_PTR_T p; +- int err = gpu_malloc_cached(16, &p); +- short *q = (short *)p.arm; +- int i; +- int r; +- printf("Allocated memory %d ARM 0x%x, VC 0x%x, Code 0x%x\n",err,(int)p.arm,p.vc,(int)vpu_get_fn()); +- printf("Allocated memory %d ARM 0x%x, VC 0x%x\n",err,(int)p.arm,p.vc); +- printf("Preparing data %p\n",q); +- for(i=0;i<16;i++) +- q[i] = i; +- printf("Flush cache\n"); +- gpu_cache_flush(&p); +- printf("Executing code\n"); +- r = vpu_execute_code( vpu_get_fn(), p.vc, 0, 0, 0, 0, 0); +- printf("Return value %d (",r); +- for(i=0;i<16;i++) +- printf("%d ",q[i]); +- printf(")\n"); +- gpu_free(&p); +- goto fail; // Early out +- }*/ ++ s->coeffs_buf_arm[0] = 0; ++ s->coeffs_buf_arm[2] = 0; ++ ++#ifdef EARLY_MALLOC ++ int coeffs_in_ctb = 64*64; ++ int coefs_per_row = (2048/64) * coeffs_in_ctb * 3; // Allow space for chroma ++ printf("Allocated %d\n",coefs_per_row); ++ gpu_malloc_cached(sizeof(int16_t) * coefs_per_row, &s->coeffs_buf_default); ++ s->coeffs_buf_arm[0] = (int16_t*) s->coeffs_buf_default.arm; ++ if (!s->coeffs_buf_arm[0]) ++ goto fail; ++ gpu_malloc_cached(sizeof(int16_t) * coefs_per_row * 2, &s->coeffs_buf_accelerated); ++ s->coeffs_buf_arm[2] = (int16_t*) s->coeffs_buf_accelerated.arm; ++ s->coeffs_buf_vc[2] = s->coeffs_buf_accelerated.vc; ++ if (!s->coeffs_buf_arm[2]) ++ goto fail; ++ s->coeffs_buf_arm[3] = coefs_per_row + s->coeffs_buf_arm[2]; ++ s->coeffs_buf_vc[3] = sizeof(int16_t) * coefs_per_row + s->coeffs_buf_vc[2]; ++ printf("Done\n"); ++ //memset(s->coeffs_buf_arm[0],0, sizeof(int16_t) * coefs_per_row); ++ memclear16(s->coeffs_buf_arm[0], coefs_per_row); ++ //memset(s->coeffs_buf_arm[2],0, sizeof(int16_t) * coefs_per_row); ++ memclear16(s->coeffs_buf_arm[2], coefs_per_row); ++ //memset(s->coeffs_buf_arm[3],0, sizeof(int16_t) * coefs_per_row); ++ memclear16(s->coeffs_buf_arm[3], coefs_per_row); ++#endif ++ ++ s->enable_rpi = 0; + + #endif + +diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h +index 1e4c34c..e240b5c 100644 +--- a/libavcodec/hevc.h ++++ b/libavcodec/hevc.h +@@ -887,8 +887,12 @@ typedef struct HEVCContext { + HEVCMvCmd *unif_mv_cmds; + HEVCXfmCmd *unif_xfm_cmds; + HEVCPredCmd *univ_pred_cmds; +- GPU_MEM_PTR_T coeffs_buf[4]; ++ int buf_width; ++ GPU_MEM_PTR_T coeffs_buf_default; ++ GPU_MEM_PTR_T coeffs_buf_accelerated; + int16_t *coeffs_buf_arm[4]; ++ unsigned int coeffs_buf_vc[4]; ++ + int num_coeffs[4]; + int num_xfm_cmds; + int num_mv_cmds; +diff --git a/libavcodec/hevc_cabac.c b/libavcodec/hevc_cabac.c +index 3e6dabf..a295d3e 100644 +--- a/libavcodec/hevc_cabac.c ++++ b/libavcodec/hevc_cabac.c +@@ -1058,9 +1058,13 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, + s->num_coeffs[0] += n; + } + } ++ // We now do the memset after transform_add while we know the data is cached. ++ //memset(coeffs, 0, trafo_size * trafo_size * sizeof(int16_t)); ++#else ++ memset(coeffs, 0, trafo_size * trafo_size * sizeof(int16_t)); + #endif + +- memset(coeffs, 0, trafo_size * trafo_size * sizeof(int16_t)); ++ + + // Derive QP for dequant + if (!lc->cu.cu_transquant_bypass_flag) { +@@ -1547,7 +1551,6 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, + #ifdef RPI + if (s->enable_rpi) { + HEVCPredCmd *cmd = s->univ_pred_cmds + s->num_pred_cmds++; +- //memcpy(coeffs2, coeffs, sizeof(int16_t) * trafo_size * trafo_size); // TODO + cmd->type = RPI_PRED_TRANSFORM_ADD; + cmd->size = log2_trafo_size; + cmd->buf = coeffs; +diff --git a/libavcodec/rpi_hevc_transform.h b/libavcodec/rpi_hevc_transform.h +index 6d772d7..4f13622 100644 +--- a/libavcodec/rpi_hevc_transform.h ++++ b/libavcodec/rpi_hevc_transform.h +@@ -1,4 +1,10 @@ + unsigned char rpi_hevc_transform [] = { ++21, ++106, ++0, ++144, ++35, ++1, + 169, + 3, + 62, +@@ -577,4 +583,48 @@ unsigned char rpi_hevc_transform [] = { + 0, + 111, + 3, ++4, ++254, ++0, ++128, ++0, ++4, ++0, ++248, ++0, ++0, ++2, ++232, ++32, ++0, ++0, ++0, ++140, ++248, ++32, ++0, ++0, ++0, ++224, ++35, ++0, ++0, ++64, ++232, ++0, ++2, ++0, ++0, ++193, ++232, ++0, ++1, ++0, ++0, ++1, ++106, ++116, ++30, ++90, ++0, + }; +diff --git a/libavcodec/rpi_hevc_transform.s b/libavcodec/rpi_hevc_transform.s +index afdb32a..fd159bc 100644 +--- a/libavcodec/rpi_hevc_transform.s ++++ b/libavcodec/rpi_hevc_transform.s +@@ -78,8 +78,11 @@ + # num: number of 16x16 transforms to be done + # coeffs32 + # num32: number of 32x32 transforms ++# command 0 for transform, 1 for memclear16(int16_t *dst,num16) + # + hevc_trans_16x16: ++ cmp r5,1 ++ beq memclear16 + push r6-r15, lr # TODO cut down number of used registers + mov r14,r3 # coeffs32 + mov r15,r4 # num32 +@@ -266,3 +269,16 @@ trans32: + add r0,r8,32 + vsth VX(48,32++),(r0+=r6) REP 16 + pop pc ++ ++memclear16: ++ # r0 is address ++ # r1 is number of 16bits values to set to 0 (may overrun past end and clear more than specified) ++ vmov HX(0++,0),0 REP 16 ++ mov r2,32 ++loop: ++ vsth HX(0++,0),(r0+=r2) REP 16 ++ add r0,16*16*2 ++ sub r1,16*16 ++ cmp r1,0 ++ bgt loop ++ b lr +-- +2.5.0 + + +From 3328a46c648542e5281088576dffac413de7a19d Mon Sep 17 00:00:00 2001 +From: Peter de Rivaz <peter.derivaz@gmail.com> +Date: Wed, 6 May 2015 09:56:43 +0100 +Subject: [PATCH 08/68] Prepared inter offload + +--- + libavcodec/hevc.c | 116 +++++++++++++++++++++++++++++++++++++++++++----- + libavcodec/hevc.h | 29 +++++++++++- + libavcodec/hevc_cabac.c | 5 ++- + 3 files changed, 137 insertions(+), 13 deletions(-) + +diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c +index 8b93ca2..59f5d15 100644 +--- a/libavcodec/hevc.c ++++ b/libavcodec/hevc.c +@@ -45,6 +45,8 @@ + #include "rpi_qpu.h" + // For some unknown reason, the code seems to crash if I do a late malloc + #define EARLY_MALLOC ++// Move Inter prediction into separate pass ++//#define RPI_INTER + #endif + + // #define DISABLE_MC +@@ -1429,6 +1431,95 @@ static int hls_pcm_sample(HEVCContext *s, int x0, int y0, int log2_cb_size) + * @param luma_offset additive offset applied to the luma prediction value + */ + ++#ifdef RPI_INTER ++#define RPI_REDIRECT(fn) rpi_ ## fn ++static void rpi_luma_mc_uni(HEVCContext *s, uint8_t *dst, ptrdiff_t dststride, ++ AVFrame *ref, const Mv *mv, int x_off, int y_off, ++ int block_w, int block_h, int luma_weight, int luma_offset) ++{ ++ HEVCMvCmd *cmd = unif_mv_cmds + s->num_mv_cmds++; ++ cmd->cmd = RPI_CMD_LUMA_UNI; ++ cmd->dst = dst; ++ cmd->dststride = dststride; ++ cmd->src = ref->data[0]; ++ cmd->srcstride = ref->linesize[0]; ++ cmd->mv = *mv; ++ cmd->x_off = x_off; ++ cmd->y_off = y_off; ++ cmd->block_w = block_w; ++ cmd->block_h = block_h; ++ cmd->weight = luma_weight; ++ cmd->offset = luma_offset; ++} ++ ++static void rpi_luma_mc_bi(HEVCContext *s, uint8_t *dst, ptrdiff_t dststride, ++ AVFrame *ref0, const Mv *mv0, int x_off, int y_off, ++ int block_w, int block_h, AVFrame *ref1, const Mv *mv1, struct MvField *current_mv) ++{ ++ HEVCMvCmd *cmd = unif_mv_cmds + s->num_mv_cmds++; ++ cmd->cmd = RPI_CMD_LUMA_BI; ++ cmd->dst = dst; ++ cmd->dststride = dststride; ++ cmd->src = ref->data[0]; ++ cmd->srcstride = ref->linesize[0]; ++ cmd->mv = *mv; ++ cmd->x_off = x_off; ++ cmd->y_off = y_off; ++ cmd->block_w = block_w; ++ cmd->block_h = block_h; ++ cmd->weight = luma_weight; ++ cmd->offset = luma_offset; ++ cmd->src1 = ref1->data[]; ++ cmd->srcstride1 = ref1->linesize[0]; ++ cmd->mv1 = *mv1; ++ cmd->ref_idx[0] = current_mv->ref_idx[0]; ++ cmd->ref_idx[1] = current_mv->ref_idx[1]; ++} ++ ++static void chroma_mc_uni(HEVCContext *s, uint8_t *dst0, ++ ptrdiff_t dststride, uint8_t *src0, ptrdiff_t srcstride, int reflist, ++ int x_off, int y_off, int block_w, int block_h, struct MvField *current_mv, int chroma_weight, int chroma_offset) ++{ ++ HEVCMvCmd *cmd = unif_mv_cmds + s->num_mv_cmds++; ++ cmd->cmd = RPI_CMD_CHROMA_UNI; ++ cmd->dst = dst0; ++ cmd->dststride = dststride; ++ cmd->src = src0; ++ cmd->srcstride = srcstride; ++ cmd->mv = current_mv->mv[reflist]; ++ cmd->x_off = x_off; ++ cmd->y_off = y_off; ++ cmd->block_w = block_w; ++ cmd->block_h = block_h; ++ cmd->weight = chroma_weight; ++ cmd->offset = chroma_offset; ++} ++ ++static void chroma_mc_bi(HEVCContext *s, uint8_t *dst0, ptrdiff_t dststride, AVFrame *ref0, AVFrame *ref1, ++ int x_off, int y_off, int block_w, int block_h, struct MvField *current_mv, int cidx) ++{ ++ HEVCMvCmd *cmd = unif_mv_cmds + s->num_mv_cmds++; ++ cmd->cmd = RPI_CMD_CHROMA_BI+cidx; ++ cmd->dst = dst0; ++ cmd->dststride = dststride; ++ cmd->src = ref0->data[cidx+1]; ++ cmd->srcstride = ref0->linesize[cidx+1]; ++ cmd->mv = current_mv->mv[reflist]; ++ cmd->x_off = x_off; ++ cmd->y_off = y_off; ++ cmd->block_w = block_w; ++ cmd->block_h = block_h; ++ cmd->weight = chroma_weight; ++ cmd->offset = chroma_offset; ++ cmd->src = ref1->data[cidx+1]; ++ cmd->srcstride1 = ref1->linesize[cidx+1]; ++ cmd->ref_idx[0] = current_mv->ref_idx[0]; ++ cmd->ref_idx[1] = current_mv->ref_idx[1]; ++} ++#else ++#define RPI_REDIRECT(fn) fn ++#endif ++ + static void luma_mc_uni(HEVCContext *s, uint8_t *dst, ptrdiff_t dststride, + AVFrame *ref, const Mv *mv, int x_off, int y_off, + int block_w, int block_h, int luma_weight, int luma_offset) +@@ -1494,7 +1585,7 @@ static void luma_mc_uni(HEVCContext *s, uint8_t *dst, ptrdiff_t dststride, + * @param mv1 motion vector1 (relative to block position) to get pixel data from + * @param current_mv current motion vector structure + */ +- static void luma_mc_bi(HEVCContext *s, uint8_t *dst, ptrdiff_t dststride, ++static void luma_mc_bi(HEVCContext *s, uint8_t *dst, ptrdiff_t dststride, + AVFrame *ref0, const Mv *mv0, int x_off, int y_off, + int block_w, int block_h, AVFrame *ref1, const Mv *mv1, struct MvField *current_mv) + { +@@ -1876,16 +1967,16 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, + int nPbW_c = nPbW >> s->ps.sps->hshift[1]; + int nPbH_c = nPbH >> s->ps.sps->vshift[1]; + +- luma_mc_uni(s, dst0, s->frame->linesize[0], ref0->frame, ++ RPI_REDIRECT(luma_mc_uni)(s, dst0, s->frame->linesize[0], ref0->frame, + &current_mv.mv[0], x0, y0, nPbW, nPbH, + s->sh.luma_weight_l0[current_mv.ref_idx[0]], + s->sh.luma_offset_l0[current_mv.ref_idx[0]]); + + if (s->ps.sps->chroma_format_idc) { +- chroma_mc_uni(s, dst1, s->frame->linesize[1], ref0->frame->data[1], ref0->frame->linesize[1], ++ RPI_REDIRECT(chroma_mc_uni)(s, dst1, s->frame->linesize[1], ref0->frame->data[1], ref0->frame->linesize[1], + 0, x0_c, y0_c, nPbW_c, nPbH_c, &current_mv, + s->sh.chroma_weight_l0[current_mv.ref_idx[0]][0], s->sh.chroma_offset_l0[current_mv.ref_idx[0]][0]); +- chroma_mc_uni(s, dst2, s->frame->linesize[2], ref0->frame->data[2], ref0->frame->linesize[2], ++ RPI_REDIRECT(chroma_mc_uni)(s, dst2, s->frame->linesize[2], ref0->frame->data[2], ref0->frame->linesize[2], + 0, x0_c, y0_c, nPbW_c, nPbH_c, &current_mv, + s->sh.chroma_weight_l0[current_mv.ref_idx[0]][1], s->sh.chroma_offset_l0[current_mv.ref_idx[0]][1]); + } +@@ -1895,17 +1986,17 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, + int nPbW_c = nPbW >> s->ps.sps->hshift[1]; + int nPbH_c = nPbH >> s->ps.sps->vshift[1]; + +- luma_mc_uni(s, dst0, s->frame->linesize[0], ref1->frame, ++ RPI_REDIRECT(luma_mc_uni)(s, dst0, s->frame->linesize[0], ref1->frame, + &current_mv.mv[1], x0, y0, nPbW, nPbH, + s->sh.luma_weight_l1[current_mv.ref_idx[1]], + s->sh.luma_offset_l1[current_mv.ref_idx[1]]); + + if (s->ps.sps->chroma_format_idc) { +- chroma_mc_uni(s, dst1, s->frame->linesize[1], ref1->frame->data[1], ref1->frame->linesize[1], ++ RPI_REDIRECT(chroma_mc_uni)(s, dst1, s->frame->linesize[1], ref1->frame->data[1], ref1->frame->linesize[1], + 1, x0_c, y0_c, nPbW_c, nPbH_c, &current_mv, + s->sh.chroma_weight_l1[current_mv.ref_idx[1]][0], s->sh.chroma_offset_l1[current_mv.ref_idx[1]][0]); + +- chroma_mc_uni(s, dst2, s->frame->linesize[2], ref1->frame->data[2], ref1->frame->linesize[2], ++ RPI_REDIRECT(chroma_mc_uni)(s, dst2, s->frame->linesize[2], ref1->frame->data[2], ref1->frame->linesize[2], + 1, x0_c, y0_c, nPbW_c, nPbH_c, &current_mv, + s->sh.chroma_weight_l1[current_mv.ref_idx[1]][1], s->sh.chroma_offset_l1[current_mv.ref_idx[1]][1]); + } +@@ -1915,15 +2006,15 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, + int nPbW_c = nPbW >> s->ps.sps->hshift[1]; + int nPbH_c = nPbH >> s->ps.sps->vshift[1]; + +- luma_mc_bi(s, dst0, s->frame->linesize[0], ref0->frame, ++ RPI_REDIRECT(luma_mc_bi)(s, dst0, s->frame->linesize[0], ref0->frame, + &current_mv.mv[0], x0, y0, nPbW, nPbH, + ref1->frame, &current_mv.mv[1], &current_mv); + + if (s->ps.sps->chroma_format_idc) { +- chroma_mc_bi(s, dst1, s->frame->linesize[1], ref0->frame, ref1->frame, ++ RPI_REDIRECT(chroma_mc_bi)(s, dst1, s->frame->linesize[1], ref0->frame, ref1->frame, + x0_c, y0_c, nPbW_c, nPbH_c, &current_mv, 0); + +- chroma_mc_bi(s, dst2, s->frame->linesize[2], ref0->frame, ref1->frame, ++ RPI_REDIRECT(chroma_mc_bi)(s, dst2, s->frame->linesize[2], ref0->frame, ref1->frame, + x0_c, y0_c, nPbW_c, nPbH_c, &current_mv, 1); + } + } +@@ -2454,7 +2545,9 @@ static void rpi_execute_pred_cmds(HEVCContext *s) + } else { + int trafo_size = 1 << cmd->size; + s->hevcdsp.transform_add[cmd->size-2](cmd->dst, cmd->buf, cmd->stride); ++#ifdef RPI_PRECLEAR + memset(cmd->buf, 0, trafo_size * trafo_size * sizeof(int16_t)); // Clear coefficients here while they are in the cache ++#endif + } + } + s->num_pred_cmds = 0; +@@ -3375,6 +3468,7 @@ static av_cold int hevc_init_context(AVCodecContext *avctx) + s->coeffs_buf_arm[3] = coefs_per_row + s->coeffs_buf_arm[2]; + s->coeffs_buf_vc[3] = sizeof(int16_t) * coefs_per_row + s->coeffs_buf_vc[2]; + printf("Done\n"); ++#ifdef RPI_PRECLEAR + //memset(s->coeffs_buf_arm[0],0, sizeof(int16_t) * coefs_per_row); + memclear16(s->coeffs_buf_arm[0], coefs_per_row); + //memset(s->coeffs_buf_arm[2],0, sizeof(int16_t) * coefs_per_row); +@@ -3383,6 +3477,8 @@ static av_cold int hevc_init_context(AVCodecContext *avctx) + memclear16(s->coeffs_buf_arm[3], coefs_per_row); + #endif + ++#endif ++ + s->enable_rpi = 0; + + #endif +diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h +index e240b5c..a35ee4a 100644 +--- a/libavcodec/hevc.h ++++ b/libavcodec/hevc.h +@@ -829,14 +829,39 @@ typedef struct HEVCLocalContext { + // RPI_MAX_WIDTH is maximum width in pixels supported by the accelerated code + #define RPI_MAX_WIDTH 2048 + +-// Worst case is for 4:4:4 4x4 blocks with 64 high coding tree blocks, so 16 MV cmds per 4 pixels across for each colour plane +-#define RPI_MAX_MV_CMDS (16*3*(RPI_MAX_WIDTH/4)) ++// Worst case is for 4:4:4 4x4 blocks with 64 high coding tree blocks, so 16 MV cmds per 4 pixels across for each colour plane, * 2 for bi ++#define RPI_MAX_MV_CMDS (2*16*3*(RPI_MAX_WIDTH/4)) + #define RPI_MAX_XFM_CMDS (16*3*(RPI_MAX_WIDTH/4)) + // Each block can have an intra prediction and a transform_add command + #define RPI_MAX_PRED_CMDS (2*16*3*(RPI_MAX_WIDTH/4)) + ++#define RPI_CMD_LUMA_UNI 0 ++#define RPI_CMD_CHROMA_UNI 1 ++#define RPI_CMD_LUMA_BI 2 ++#define RPI_CMD_U_BI 3 ++#define RPI_CMD_V_BI 4 ++ ++// RPI_PRECLEAR is not working yet - perhaps clearing on VPUs is flawed? ++// #define RPI_PRECLEAR ++ + // Command for inter prediction + typedef struct HEVCMvCmd { ++ int cmd; ++ uint8_t *dst; ++ ptrdiff_t dststride; ++ uint8_t *src; ++ ptrdiff_t srcstride; ++ Mv mv; ++ int x_off; ++ int y_off; ++ int block_w; ++ int block_h; ++ int weight; ++ int offset; ++ uint8_t *src1; ++ ptrdiff_t srcstride1; ++ Mv mv1; ++ int8_t ref_idx[2]; + } HEVCMvCmd; + + // Command for transform to process a block of coefficients +diff --git a/libavcodec/hevc_cabac.c b/libavcodec/hevc_cabac.c +index a295d3e..f28759b 100644 +--- a/libavcodec/hevc_cabac.c ++++ b/libavcodec/hevc_cabac.c +@@ -1059,7 +1059,10 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, + } + } + // We now do the memset after transform_add while we know the data is cached. +- //memset(coeffs, 0, trafo_size * trafo_size * sizeof(int16_t)); ++ #ifdef RPI_PRECLEAR ++ #else ++ memset(coeffs, 0, trafo_size * trafo_size * sizeof(int16_t)); ++ #endif + #else + memset(coeffs, 0, trafo_size * trafo_size * sizeof(int16_t)); + #endif +-- +2.5.0 + + +From 191028358f7153c8598981673e6bd165acaa699d Mon Sep 17 00:00:00 2001 +From: Peter de Rivaz <peter.derivaz@gmail.com> +Date: Wed, 6 May 2015 11:08:50 +0100 +Subject: [PATCH 09/68] Inter prediction in separate pass + +--- + libavcodec/hevc.c | 93 +++++++++++++++++++++++++++++++++++++++++++++---------- + libavcodec/hevc.h | 2 +- + 2 files changed, 77 insertions(+), 18 deletions(-) + +diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c +index 59f5d15..f60709e 100644 +--- a/libavcodec/hevc.c ++++ b/libavcodec/hevc.c +@@ -46,7 +46,7 @@ + // For some unknown reason, the code seems to crash if I do a late malloc + #define EARLY_MALLOC + // Move Inter prediction into separate pass +-//#define RPI_INTER ++#define RPI_INTER + #endif + + // #define DISABLE_MC +@@ -1437,7 +1437,7 @@ static void rpi_luma_mc_uni(HEVCContext *s, uint8_t *dst, ptrdiff_t dststride, + AVFrame *ref, const Mv *mv, int x_off, int y_off, + int block_w, int block_h, int luma_weight, int luma_offset) + { +- HEVCMvCmd *cmd = unif_mv_cmds + s->num_mv_cmds++; ++ HEVCMvCmd *cmd = s->unif_mv_cmds + s->num_mv_cmds++; + cmd->cmd = RPI_CMD_LUMA_UNI; + cmd->dst = dst; + cmd->dststride = dststride; +@@ -1456,31 +1456,29 @@ static void rpi_luma_mc_bi(HEVCContext *s, uint8_t *dst, ptrdiff_t dststride, + AVFrame *ref0, const Mv *mv0, int x_off, int y_off, + int block_w, int block_h, AVFrame *ref1, const Mv *mv1, struct MvField *current_mv) + { +- HEVCMvCmd *cmd = unif_mv_cmds + s->num_mv_cmds++; ++ HEVCMvCmd *cmd = s->unif_mv_cmds + s->num_mv_cmds++; + cmd->cmd = RPI_CMD_LUMA_BI; + cmd->dst = dst; + cmd->dststride = dststride; +- cmd->src = ref->data[0]; +- cmd->srcstride = ref->linesize[0]; +- cmd->mv = *mv; ++ cmd->src = ref0->data[0]; ++ cmd->srcstride = ref0->linesize[0]; ++ cmd->mv = *mv0; + cmd->x_off = x_off; + cmd->y_off = y_off; + cmd->block_w = block_w; + cmd->block_h = block_h; +- cmd->weight = luma_weight; +- cmd->offset = luma_offset; +- cmd->src1 = ref1->data[]; ++ cmd->src1 = ref1->data[0]; + cmd->srcstride1 = ref1->linesize[0]; + cmd->mv1 = *mv1; + cmd->ref_idx[0] = current_mv->ref_idx[0]; + cmd->ref_idx[1] = current_mv->ref_idx[1]; + } + +-static void chroma_mc_uni(HEVCContext *s, uint8_t *dst0, ++static void rpi_chroma_mc_uni(HEVCContext *s, uint8_t *dst0, + ptrdiff_t dststride, uint8_t *src0, ptrdiff_t srcstride, int reflist, + int x_off, int y_off, int block_w, int block_h, struct MvField *current_mv, int chroma_weight, int chroma_offset) + { +- HEVCMvCmd *cmd = unif_mv_cmds + s->num_mv_cmds++; ++ HEVCMvCmd *cmd = s->unif_mv_cmds + s->num_mv_cmds++; + cmd->cmd = RPI_CMD_CHROMA_UNI; + cmd->dst = dst0; + cmd->dststride = dststride; +@@ -1495,27 +1493,27 @@ static void chroma_mc_uni(HEVCContext *s, uint8_t *dst0, + cmd->offset = chroma_offset; + } + +-static void chroma_mc_bi(HEVCContext *s, uint8_t *dst0, ptrdiff_t dststride, AVFrame *ref0, AVFrame *ref1, ++static void rpi_chroma_mc_bi(HEVCContext *s, uint8_t *dst0, ptrdiff_t dststride, AVFrame *ref0, AVFrame *ref1, + int x_off, int y_off, int block_w, int block_h, struct MvField *current_mv, int cidx) + { +- HEVCMvCmd *cmd = unif_mv_cmds + s->num_mv_cmds++; ++ HEVCMvCmd *cmd = s->unif_mv_cmds + s->num_mv_cmds++; + cmd->cmd = RPI_CMD_CHROMA_BI+cidx; + cmd->dst = dst0; + cmd->dststride = dststride; + cmd->src = ref0->data[cidx+1]; + cmd->srcstride = ref0->linesize[cidx+1]; +- cmd->mv = current_mv->mv[reflist]; ++ cmd->mv = current_mv->mv[0]; ++ cmd->mv1 = current_mv->mv[1]; + cmd->x_off = x_off; + cmd->y_off = y_off; + cmd->block_w = block_w; + cmd->block_h = block_h; +- cmd->weight = chroma_weight; +- cmd->offset = chroma_offset; +- cmd->src = ref1->data[cidx+1]; ++ cmd->src1 = ref1->data[cidx+1]; + cmd->srcstride1 = ref1->linesize[cidx+1]; + cmd->ref_idx[0] = current_mv->ref_idx[0]; + cmd->ref_idx[1] = current_mv->ref_idx[1]; + } ++ + #else + #define RPI_REDIRECT(fn) fn + #endif +@@ -2543,7 +2541,9 @@ static void rpi_execute_pred_cmds(HEVCContext *s) + lc->na.cand_up_right = (cmd->na >> 0) & 1; + s->hpc.intra_pred[cmd->size - 2](s, cmd->x, cmd->y, cmd->c_idx); + } else { ++#ifdef RPI_PRECLEAR + int trafo_size = 1 << cmd->size; ++#endif + s->hevcdsp.transform_add[cmd->size-2](cmd->dst, cmd->buf, cmd->stride); + #ifdef RPI_PRECLEAR + memset(cmd->buf, 0, trafo_size * trafo_size * sizeof(int16_t)); // Clear coefficients here while they are in the cache +@@ -2552,6 +2552,61 @@ static void rpi_execute_pred_cmds(HEVCContext *s) + } + s->num_pred_cmds = 0; + } ++ ++static void rpi_execute_inter_cmds(HEVCContext *s) ++{ ++ HEVCMvCmd *cmd = s->unif_mv_cmds; ++ int n,cidx; ++ AVFrame myref; ++ AVFrame myref1; ++ struct MvField mymv; ++ if (s->num_mv_cmds > RPI_MAX_MV_CMDS) { ++ printf("Overflow inter_cmds\n"); ++ exit(-1); ++ } ++ for(n = s->num_mv_cmds; n>0 ; n--, cmd++) { ++ switch(cmd->cmd) { ++ case RPI_CMD_LUMA_UNI: ++ myref.data[0] = cmd->src; ++ myref.linesize[0] = cmd->srcstride; ++ luma_mc_uni(s, cmd->dst, cmd->dststride, &myref, &cmd->mv, cmd->x_off, cmd->y_off, cmd->block_w, cmd->block_h, cmd->weight, cmd->offset); ++ break; ++ case RPI_CMD_LUMA_BI: ++ myref.data[0] = cmd->src; ++ myref.linesize[0] = cmd->srcstride; ++ myref1.data[0] = cmd->src1; ++ myref1.linesize[0] = cmd->srcstride1; ++ mymv.ref_idx[0] = cmd->ref_idx[0]; ++ mymv.ref_idx[1] = cmd->ref_idx[1]; ++ luma_mc_bi(s, cmd->dst, cmd->dststride, ++ &myref, &cmd->mv, cmd->x_off, cmd->y_off, cmd->block_w, cmd->block_h, ++ &myref1, &cmd->mv1, &mymv); ++ break; ++ case RPI_CMD_CHROMA_UNI: ++ mymv.mv[0] = cmd->mv; ++ chroma_mc_uni(s, cmd->dst, ++ cmd->dststride, cmd->src, cmd->srcstride, 0, ++ cmd->x_off, cmd->y_off, cmd->block_w, cmd->block_h, &mymv, cmd->weight, cmd->offset); ++ break; ++ case RPI_CMD_CHROMA_BI: ++ case RPI_CMD_CHROMA_BI+1: ++ cidx = cmd->cmd - RPI_CMD_CHROMA_BI; ++ myref.data[cidx+1] = cmd->src; ++ myref.linesize[cidx+1] = cmd->srcstride; ++ myref1.data[cidx+1] = cmd->src1; ++ myref1.linesize[cidx+1] = cmd->srcstride1; ++ mymv.ref_idx[0] = cmd->ref_idx[0]; ++ mymv.ref_idx[1] = cmd->ref_idx[1]; ++ mymv.mv[0] = cmd->mv; ++ mymv.mv[1] = cmd->mv1; ++ chroma_mc_bi(s, cmd->dst, cmd->dststride, &myref, &myref1, ++ cmd->x_off, cmd->y_off, cmd->block_w, cmd->block_h, &mymv, cidx); ++ break; ++ } ++ } ++ s->num_mv_cmds = 0; ++} ++ + #endif + + static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) +@@ -2600,6 +2655,8 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) + #ifdef RPI + if (s->enable_rpi && x_ctb + ctb_size >= s->ps.sps->width) { + int x; ++ // Perform inter prediction ++ rpi_execute_inter_cmds(s); + // Transform all blocks + rpi_execute_transform(s); + // Perform intra prediction and residual reconstruction +@@ -3416,6 +3473,7 @@ static av_cold int hevc_decode_free(AVCodecContext *avctx) + } + + #ifdef RPI ++#ifdef RPI_PRECLEAR + static av_cold void memclear16(int16_t *p, int n) + { + vpu_execute_code( vpu_get_fn(), p, n, 0, 0, 0, 1); +@@ -3424,6 +3482,7 @@ static av_cold void memclear16(int16_t *p, int n) + // p[i] = 0; + } + #endif ++#endif + + static av_cold int hevc_init_context(AVCodecContext *avctx) + { +diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h +index a35ee4a..e3046a2 100644 +--- a/libavcodec/hevc.h ++++ b/libavcodec/hevc.h +@@ -838,7 +838,7 @@ typedef struct HEVCLocalContext { + #define RPI_CMD_LUMA_UNI 0 + #define RPI_CMD_CHROMA_UNI 1 + #define RPI_CMD_LUMA_BI 2 +-#define RPI_CMD_U_BI 3 ++#define RPI_CMD_CHROMA_BI 3 + #define RPI_CMD_V_BI 4 + + // RPI_PRECLEAR is not working yet - perhaps clearing on VPUs is flawed? +-- +2.5.0 + + +From cf8758aad96c2c71abd5f2feb8ff85b5ac191b60 Mon Sep 17 00:00:00 2001 +From: Peter de Rivaz <peter.derivaz@gmail.com> +Date: Wed, 6 May 2015 13:03:50 +0100 +Subject: [PATCH 10/68] Added VPU thread + +--- + libavcodec/hevc.c | 11 +++-- + libavcodec/hevc.h | 1 + + libavcodec/rpi_qpu.c | 125 +++++++++++++++++++++++++++++++++++++++++++++++++-- + libavcodec/rpi_qpu.h | 2 + + 4 files changed, 133 insertions(+), 6 deletions(-) + +diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c +index f60709e..7b0d951 100644 +--- a/libavcodec/hevc.c ++++ b/libavcodec/hevc.c +@@ -2518,8 +2518,10 @@ static void rpi_execute_transform(HEVCContext *s) + + + gpu_cache_flush(&s->coeffs_buf_accelerated); +- vpu_execute_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf_vc[2], s->num_coeffs[2] >> 8, s->coeffs_buf_vc[3], s->num_coeffs[3] >> 10, 0); ++ s->vpu_id = vpu_post_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf_vc[2], s->num_coeffs[2] >> 8, s->coeffs_buf_vc[3], s->num_coeffs[3] >> 10, 0, &s->coeffs_buf_accelerated); ++ //vpu_execute_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf_vc[2], s->num_coeffs[2] >> 8, s->coeffs_buf_vc[3], s->num_coeffs[3] >> 10, 0); + //gpu_cache_flush(&s->coeffs_buf_accelerated); ++ //vpu_wait(s->vpu_id); + + for(i=0;i<4;i++) + s->num_coeffs[i] = 0; +@@ -2655,10 +2657,12 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) + #ifdef RPI + if (s->enable_rpi && x_ctb + ctb_size >= s->ps.sps->width) { + int x; +- // Perform inter prediction +- rpi_execute_inter_cmds(s); + // Transform all blocks + rpi_execute_transform(s); ++ // Perform inter prediction ++ rpi_execute_inter_cmds(s); ++ // Wait for transform completion ++ vpu_wait(s->vpu_id); + // Perform intra prediction and residual reconstruction + rpi_execute_pred_cmds(s); + // Perform deblocking for CTBs in this row +@@ -3415,6 +3419,7 @@ static av_cold int hevc_decode_free(AVCodecContext *avctx) + av_freep(&s->univ_pred_cmds); + + #ifdef EARLY_MALLOC ++ printf("hevc_decode_free\n"); + if (s->coeffs_buf_arm[0]) { + gpu_free(&s->coeffs_buf_default); + s->coeffs_buf_arm[0] = 0; +diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h +index e3046a2..89636e4 100644 +--- a/libavcodec/hevc.h ++++ b/libavcodec/hevc.h +@@ -922,6 +922,7 @@ typedef struct HEVCContext { + int num_xfm_cmds; + int num_mv_cmds; + int num_pred_cmds; ++ int vpu_id; + #endif + + uint8_t *cabac_state; +diff --git a/libavcodec/rpi_qpu.c b/libavcodec/rpi_qpu.c +index 12ad5fb..378dd74 100644 +--- a/libavcodec/rpi_qpu.c ++++ b/libavcodec/rpi_qpu.c +@@ -1,9 +1,13 @@ + #ifdef RPI +-// Use the vcsm device for shared memory ++// define RPI_USE_VCSM to use the vcsm device for shared memory + // This works better than the mmap in that the memory can be cached, but requires a kernel modification to enable the device. + #define RPI_USE_VCSM +-#define RPI_TIME_TOTAL_QPU +-#define RPI_TIME_TOTAL_VPU ++// define RPI_TIME_TOTAL_QPU to print out how much time is spent in the QPU code ++//#define RPI_TIME_TOTAL_QPU ++// define RPI_TIME_TOTAL_VPU to print out how much time is spent in the VPI code ++//#define RPI_TIME_TOTAL_VPU ++// define RPI_ASYNC to run the VPU in a separate thread, need to make a separate call to check for completion ++#define RPI_ASYNC + + #include <stdio.h> + #include <stdlib.h> +@@ -113,6 +117,19 @@ static unsigned int Microseconds(void) { + } + #endif + ++#ifdef RPI_ASYNC ++pthread_t vpu_thread; ++static void *vpu_start(void *arg); ++ ++#define MAXCMDS 128 ++static pthread_cond_t post_cond = PTHREAD_COND_INITIALIZER; ++static pthread_mutex_t post_mutex = PTHREAD_MUTEX_INITIALIZER; ++ ++static int vpu_cmds[MAXCMDS][8]; ++static volatile int vpu_async_tail=0; // Contains the number of posted jobs ++static volatile int vpu_async_head=0; ++#endif ++ + // Connect to QPU, returns 0 on success. + static int gpu_init(volatile struct GPU **gpu) { + int mb = mbox_open(); +@@ -164,12 +181,27 @@ static int gpu_init(volatile struct GPU **gpu) { + // And the transform coefficients + memcpy((void*)ptr->transMatrix2even, rpi_transMatrix2even, sizeof(rpi_transMatrix2even)); + ++#ifdef RPI_ASYNC ++ { ++ int err; ++ vpu_async_tail = 0; ++ vpu_async_head = 0; ++ err = pthread_create(&vpu_thread, NULL, vpu_start, NULL); ++ //printf("Created thread\n"); ++ if (err) { ++ printf("Failed to create vpu thread\n"); ++ return -4; ++ } ++ } ++#endif ++ + return 0; + } + + // Make sure we have exclusive access to the mailbox, and enable qpu if necessary. + static void gpu_lock(void) { + pthread_mutex_lock(&gpu_mutex); ++ + if (gpu==NULL) { + gpu_init(&gpu); + } +@@ -264,6 +296,16 @@ static void gpu_term(void) + unsigned handle = gpu->vc_handle; + if (gpu==NULL) + return; ++ ++#ifdef RPI_ASYNC ++ { ++ void *res; ++ vpu_post_code(0, 0, 0, 0, 0, 0, -1, NULL); ++ pthread_join(vpu_thread, &res); ++ } ++#endif ++ ++ + unmapmem((void*)gpu, sizeof(struct GPU)); + mem_unlock(mb, handle); + mem_free(mb, handle); +@@ -322,6 +364,79 @@ unsigned int vpu_get_constants(void) { + return gpu->vc + offsetof(struct GPU,transMatrix2even); + } + ++#ifdef RPI_ASYNC ++ ++static void *vpu_start(void *arg) { ++ while(1) { ++ pthread_mutex_lock(&post_mutex); ++ while( vpu_async_tail - vpu_async_head <= 0) ++ { ++ //printf("Checking number %d %d\n",vpu_async_head,vpu_async_tail); ++ pthread_cond_wait(&post_cond, &post_mutex); ++ } ++ int *p = vpu_cmds[vpu_async_head%MAXCMDS]; ++ pthread_mutex_unlock(&post_mutex); ++ ++ if (p[6] == -1) { ++ break; // Last job ++ } ++ if (p[7]) { ++ GPU_MEM_PTR_T *buf = (GPU_MEM_PTR_T *)p[7]; ++ //gpu_cache_flush(buf); ++ } ++ vpu_execute_code(p[0], p[1], p[2], p[3], p[4], p[5], p[6]); ++ ++ pthread_mutex_lock(&post_mutex); ++ vpu_async_head++; ++ pthread_cond_broadcast(&post_cond); ++ pthread_mutex_unlock(&post_mutex); ++ } ++ ++ return NULL; ++} ++ ++// Post a command to the queue ++// Returns an id which we can use to wait for completion ++int vpu_post_code(unsigned code, unsigned r0, unsigned r1, unsigned r2, unsigned r3, unsigned r4, unsigned r5, GPU_MEM_PTR_T *buf) ++{ ++ pthread_mutex_lock(&post_mutex); ++ { ++ int id = vpu_async_tail++; ++ int *p = vpu_cmds[id%MAXCMDS]; ++ int num = vpu_async_tail - vpu_async_head; ++ if (num>MAXCMDS) { ++ printf("Too many commands submitted\n"); ++ exit(-1); ++ } ++ p[0] = code; ++ p[1] = r0; ++ p[2] = r1; ++ p[3] = r2; ++ p[4] = r3; ++ p[5] = r4; ++ p[6] = r5; ++ p[7] = (int) buf; ++ if (num<=1) ++ pthread_cond_broadcast(&post_cond); // Otherwise the vpu thread must already be awake ++ pthread_mutex_unlock(&post_mutex); ++ return id; ++ } ++} ++ ++// Wait for completion of the given command ++void vpu_wait(int id) ++{ ++ pthread_mutex_lock(&post_mutex); ++ while( id + 1 - vpu_async_head > 0) ++ { ++ pthread_cond_wait(&post_cond, &post_mutex); ++ } ++ pthread_mutex_unlock(&post_mutex); ++} ++ ++#endif ++ ++ + unsigned vpu_execute_code( unsigned code, unsigned r0, unsigned r1, unsigned r2, unsigned r3, unsigned r4, unsigned r5) + { + unsigned r; +@@ -334,7 +449,9 @@ unsigned vpu_execute_code( unsigned code, unsigned r0, unsigned r1, unsigned r2, + static int count=0; + static long long countr2=0; + #endif ++#ifndef RPI_ASYNC + gpu_lock(); ++#endif + #ifdef RPI_TIME_TOTAL_VPU + start_time = Microseconds(); + if (last_time==0) +@@ -351,7 +468,9 @@ unsigned vpu_execute_code( unsigned code, unsigned r0, unsigned r1, unsigned r2, + if ((count&0x7f)==0) + printf("VPU %d %lld On=%dms, Off=%dms\n",count,countr2,(int)(on_time/1000),(int)(off_time/1000)); + #endif ++#ifndef RPI_ASYNC + gpu_unlock(); ++#endif + return r; + } + +diff --git a/libavcodec/rpi_qpu.h b/libavcodec/rpi_qpu.h +index 814fc3c..3526fce 100644 +--- a/libavcodec/rpi_qpu.h ++++ b/libavcodec/rpi_qpu.h +@@ -36,6 +36,8 @@ extern unsigned int qpu_get_fn(int num); + extern unsigned int vpu_get_fn(void); + extern unsigned int vpu_get_constants(void); + extern unsigned vpu_execute_code( unsigned code, unsigned r0, unsigned r1, unsigned r2, unsigned r3, unsigned r4, unsigned r5); ++extern int vpu_post_code( unsigned code, unsigned r0, unsigned r1, unsigned r2, unsigned r3, unsigned r4, unsigned r5, GPU_MEM_PTR_T *buf); ++extern void vpu_wait( int id); + + // Simple test of shader code + extern int rpi_test_shader(void); +-- +2.5.0 + + +From 6914dc93330c6d8494712589cdaeb0927ce9118d Mon Sep 17 00:00:00 2001 +From: Peter de Rivaz <peter.derivaz@gmail.com> +Date: Wed, 6 May 2015 15:03:37 +0100 +Subject: [PATCH 11/68] Added different signal when tail moves + +--- + libavcodec/rpi_qpu.c | 11 ++++++----- + 1 file changed, 6 insertions(+), 5 deletions(-) + +diff --git a/libavcodec/rpi_qpu.c b/libavcodec/rpi_qpu.c +index 378dd74..d1c3e20 100644 +--- a/libavcodec/rpi_qpu.c ++++ b/libavcodec/rpi_qpu.c +@@ -122,7 +122,8 @@ pthread_t vpu_thread; + static void *vpu_start(void *arg); + + #define MAXCMDS 128 +-static pthread_cond_t post_cond = PTHREAD_COND_INITIALIZER; ++static pthread_cond_t post_cond_head = PTHREAD_COND_INITIALIZER; ++static pthread_cond_t post_cond_tail = PTHREAD_COND_INITIALIZER; + static pthread_mutex_t post_mutex = PTHREAD_MUTEX_INITIALIZER; + + static int vpu_cmds[MAXCMDS][8]; +@@ -372,7 +373,7 @@ static void *vpu_start(void *arg) { + while( vpu_async_tail - vpu_async_head <= 0) + { + //printf("Checking number %d %d\n",vpu_async_head,vpu_async_tail); +- pthread_cond_wait(&post_cond, &post_mutex); ++ pthread_cond_wait(&post_cond_tail, &post_mutex); + } + int *p = vpu_cmds[vpu_async_head%MAXCMDS]; + pthread_mutex_unlock(&post_mutex); +@@ -388,7 +389,7 @@ static void *vpu_start(void *arg) { + + pthread_mutex_lock(&post_mutex); + vpu_async_head++; +- pthread_cond_broadcast(&post_cond); ++ pthread_cond_broadcast(&post_cond_head); + pthread_mutex_unlock(&post_mutex); + } + +@@ -417,7 +418,7 @@ int vpu_post_code(unsigned code, unsigned r0, unsigned r1, unsigned r2, unsigned + p[6] = r5; + p[7] = (int) buf; + if (num<=1) +- pthread_cond_broadcast(&post_cond); // Otherwise the vpu thread must already be awake ++ pthread_cond_broadcast(&post_cond_tail); // Otherwise the vpu thread must already be awake + pthread_mutex_unlock(&post_mutex); + return id; + } +@@ -429,7 +430,7 @@ void vpu_wait(int id) + pthread_mutex_lock(&post_mutex); + while( id + 1 - vpu_async_head > 0) + { +- pthread_cond_wait(&post_cond, &post_mutex); ++ pthread_cond_wait(&post_cond_head, &post_mutex); + } + pthread_mutex_unlock(&post_mutex); + } +-- +2.5.0 + + +From 0f997c095dc4aa3ddc5818c8188803ade60c8c72 Mon Sep 17 00:00:00 2001 +From: Peter de Rivaz <peter.derivaz@gmail.com> +Date: Thu, 7 May 2015 08:57:11 +0100 +Subject: [PATCH 12/68] Add option to test for gpu_idle + +--- + libavcodec/hevc.c | 3 ++- + libavcodec/rpi_qpu.c | 18 ++++++++++++++++++ + 2 files changed, 20 insertions(+), 1 deletion(-) + +diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c +index 7b0d951..b703200 100644 +--- a/libavcodec/hevc.c ++++ b/libavcodec/hevc.c +@@ -2516,7 +2516,6 @@ static void rpi_execute_transform(HEVCContext *s) + // s->hevcdsp.idct[4-2](coeffs, 16); + //} + +- + gpu_cache_flush(&s->coeffs_buf_accelerated); + s->vpu_id = vpu_post_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf_vc[2], s->num_coeffs[2] >> 8, s->coeffs_buf_vc[3], s->num_coeffs[3] >> 10, 0, &s->coeffs_buf_accelerated); + //vpu_execute_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf_vc[2], s->num_coeffs[2] >> 8, s->coeffs_buf_vc[3], s->num_coeffs[3] >> 10, 0); +@@ -2658,6 +2657,8 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) + if (s->enable_rpi && x_ctb + ctb_size >= s->ps.sps->width) { + int x; + // Transform all blocks ++ //printf("%d %d %d : %d %d %d %d\n",s->poc, x_ctb, y_ctb, s->num_pred_cmds,s->num_mv_cmds,s->num_coeffs[2] >> 8,s->num_coeffs[3] >> 10); ++ + rpi_execute_transform(s); + // Perform inter prediction + rpi_execute_inter_cmds(s); +diff --git a/libavcodec/rpi_qpu.c b/libavcodec/rpi_qpu.c +index d1c3e20..85f49db 100644 +--- a/libavcodec/rpi_qpu.c ++++ b/libavcodec/rpi_qpu.c +@@ -199,6 +199,17 @@ static int gpu_init(volatile struct GPU **gpu) { + return 0; + } + ++// Returns 1 if the gpu is currently idle ++static int gpu_idle(void) ++{ ++ int ret = pthread_mutex_trylock(&gpu_mutex); ++ if (ret==0) { ++ pthread_mutex_unlock(&gpu_mutex); ++ return 1; ++ } ++ return 0; ++} ++ + // Make sure we have exclusive access to the mailbox, and enable qpu if necessary. + static void gpu_lock(void) { + pthread_mutex_lock(&gpu_mutex); +@@ -400,6 +411,13 @@ static void *vpu_start(void *arg) { + // Returns an id which we can use to wait for completion + int vpu_post_code(unsigned code, unsigned r0, unsigned r1, unsigned r2, unsigned r3, unsigned r4, unsigned r5, GPU_MEM_PTR_T *buf) + { ++ // If the gpu is idle then just run the command immediately ++ // This works, but doesn't seem to give any benefit ++ // if (gpu_idle()) { ++ // vpu_execute_code( code, r0, r1, r2, r3, r4, r5); ++ // return -1; // TODO perhaps a wraparound bug here? ++ // } ++ + pthread_mutex_lock(&post_mutex); + { + int id = vpu_async_tail++; +-- +2.5.0 + + +From 3b7183a57c0936f10db7ae806db01ff6c977e095 Mon Sep 17 00:00:00 2001 +From: Peter de Rivaz <peter.derivaz@gmail.com> +Date: Thu, 7 May 2015 11:01:35 +0100 +Subject: [PATCH 13/68] Added deblocking pass + +--- + libavcodec/hevc.c | 33 +++++++++++++++++++++++++++------ + libavcodec/hevc.h | 7 ++++++- + libavcodec/hevc_filter.c | 6 +++++- + libavcodec/rpi_qpu.c | 2 +- + 4 files changed, 39 insertions(+), 9 deletions(-) + +diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c +index b703200..c12693b 100644 +--- a/libavcodec/hevc.c ++++ b/libavcodec/hevc.c +@@ -2507,6 +2507,17 @@ static void hls_decode_neighbour(HEVCContext *s, int x_ctb, int y_ctb, + } + + #ifdef RPI ++static void rpi_execute_dblk_cmds(HEVCContext *s) ++{ ++ int n; ++ int ctb_size = 1 << s->ps.sps->log2_ctb_size; ++ int (*p)[2] = s->dblk_cmds; ++ for(n = s->num_dblk_cmds; n>0 ;n--,p++) { ++ ff_hevc_hls_filters(s, (*p)[0], (*p)[1], ctb_size); ++ } ++ s->num_dblk_cmds = 0; ++} ++ + static void rpi_execute_transform(HEVCContext *s) + { + int i=2; +@@ -2620,7 +2631,6 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) + int ctb_addr_ts = s->ps.pps->ctb_addr_rs_to_ts[s->sh.slice_ctb_addr_rs]; + + #ifdef RPI +- int start_ctb_x = (s->sh.slice_ctb_addr_rs % ((s->ps.sps->width + ctb_size - 1) >> s->ps.sps->log2_ctb_size)) << s->ps.sps->log2_ctb_size; + s->enable_rpi = 1; // TODO this should depend on cross component and frame width etc. + #endif + +@@ -2654,7 +2664,10 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) + + more_data = hls_coding_quadtree(s, x_ctb, y_ctb, s->ps.sps->log2_ctb_size, 0); + #ifdef RPI +- if (s->enable_rpi && x_ctb + ctb_size >= s->ps.sps->width) { ++ if (s->enable_rpi) { ++ s->dblk_cmds[s->num_dblk_cmds][0] = x_ctb; ++ s->dblk_cmds[s->num_dblk_cmds++][1] = y_ctb; ++ if ( (((y_ctb + ctb_size)&63) == 0) && x_ctb + ctb_size >= s->ps.sps->width) { + int x; + // Transform all blocks + //printf("%d %d %d : %d %d %d %d\n",s->poc, x_ctb, y_ctb, s->num_pred_cmds,s->num_mv_cmds,s->num_coeffs[2] >> 8,s->num_coeffs[3] >> 10); +@@ -2667,10 +2680,8 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) + // Perform intra prediction and residual reconstruction + rpi_execute_pred_cmds(s); + // Perform deblocking for CTBs in this row +- for(x = start_ctb_x; x <= x_ctb; x += ctb_size) { // TODO this will fail for tiles +- ff_hevc_hls_filters(s, x, y_ctb, ctb_size); +- } +- start_ctb_x = 0; ++ rpi_execute_dblk_cmds(s); ++ } + } + #endif + if (more_data < 0) { +@@ -2688,6 +2699,16 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) + ff_hevc_hls_filters(s, x_ctb, y_ctb, ctb_size); + } + ++#ifdef RPI ++ if (s->enable_rpi && s->num_dblk_cmds) { ++ rpi_execute_transform(s); ++ rpi_execute_inter_cmds(s); ++ vpu_wait(s->vpu_id); ++ rpi_execute_pred_cmds(s); ++ rpi_execute_dblk_cmds(s); ++ } ++#endif ++ + if (x_ctb + ctb_size >= s->ps.sps->width && + y_ctb + ctb_size >= s->ps.sps->height) + ff_hevc_hls_filter(s, x_ctb, y_ctb, ctb_size); +diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h +index 89636e4..1fcf8b9 100644 +--- a/libavcodec/hevc.h ++++ b/libavcodec/hevc.h +@@ -834,6 +834,8 @@ typedef struct HEVCLocalContext { + #define RPI_MAX_XFM_CMDS (16*3*(RPI_MAX_WIDTH/4)) + // Each block can have an intra prediction and a transform_add command + #define RPI_MAX_PRED_CMDS (2*16*3*(RPI_MAX_WIDTH/4)) ++// Worst case is 16x16 CTUs ++#define RPI_MAX_DEBLOCK_CMDS (RPI_MAX_WIDTH*4/16) + + #define RPI_CMD_LUMA_UNI 0 + #define RPI_CMD_CHROMA_UNI 1 +@@ -893,6 +895,9 @@ typedef struct HEVCPredCmd { + #endif + + typedef struct HEVCContext { ++#ifdef RPI ++ int dblk_cmds[RPI_MAX_DEBLOCK_CMDS][2]; ++#endif + const AVClass *c; // needed by private avoptions + AVCodecContext *avctx; + +@@ -917,11 +922,11 @@ typedef struct HEVCContext { + GPU_MEM_PTR_T coeffs_buf_accelerated; + int16_t *coeffs_buf_arm[4]; + unsigned int coeffs_buf_vc[4]; +- + int num_coeffs[4]; + int num_xfm_cmds; + int num_mv_cmds; + int num_pred_cmds; ++ int num_dblk_cmds; + int vpu_id; + #endif + +diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c +index e4c3da7..ea0af91 100644 +--- a/libavcodec/hevc_filter.c ++++ b/libavcodec/hevc_filter.c +@@ -877,8 +877,12 @@ void ff_hevc_hls_filter(HEVCContext *s, int x, int y, int ctb_size) + if (s->threads_type & FF_THREAD_FRAME ) + ff_thread_report_progress(&s->ref->tf, y + ctb_size, 0); + } +- } else if (s->threads_type & FF_THREAD_FRAME && x_end) ++ } else if (s->threads_type & FF_THREAD_FRAME && x_end) { ++ int newh = y + ctb_size - 4; ++ //int currh = s->ref->tf.progress->data[0]; ++ //if (((y + ctb_size)&63)==0) + ff_thread_report_progress(&s->ref->tf, y + ctb_size - 4, 0); ++ } + } + + void ff_hevc_hls_filters(HEVCContext *s, int x_ctb, int y_ctb, int ctb_size) +diff --git a/libavcodec/rpi_qpu.c b/libavcodec/rpi_qpu.c +index 85f49db..3b6dae7 100644 +--- a/libavcodec/rpi_qpu.c ++++ b/libavcodec/rpi_qpu.c +@@ -105,7 +105,7 @@ struct GPU + static pthread_mutex_t gpu_mutex = PTHREAD_MUTEX_INITIALIZER; + static volatile struct GPU* gpu = NULL; + +-#ifdef RPI_TIME_TOTAL_QPU ++#if defined(RPI_TIME_TOTAL_QPU) || defined(RPI_TIME_TOTAL_VPU) + static unsigned int Microseconds(void) { + struct timespec ts; + unsigned int x; +-- +2.5.0 + + +From 2e30016cc84d7b30f26bdeb1fbed69c3f495cded Mon Sep 17 00:00:00 2001 +From: Peter de Rivaz <peter.derivaz@gmail.com> +Date: Thu, 7 May 2015 16:47:47 +0100 +Subject: [PATCH 14/68] Added option to disable deblocking for non-ref frames + +--- + libavcodec/hevc_filter.c | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c +index ea0af91..2cdd621 100644 +--- a/libavcodec/hevc_filter.c ++++ b/libavcodec/hevc_filter.c +@@ -25,6 +25,8 @@ + //#define DISABLE_SAO + //#define DISABLE_DEBLOCK + //#define DISABLE_STRENGTHS ++// define DISABLE_DEBLOCK_NONREF for a 6% speed boost (by skipping deblocking on unimportant frames) ++//#define DISABLE_DEBLOCK_NONREF + + #include "libavutil/common.h" + #include "libavutil/internal.h" +@@ -504,6 +506,14 @@ static void deblocking_filter_CTB(HEVCContext *s, int x0, int y0) + s->ps.sps->pcm.loop_filter_disable_flag) || + s->ps.pps->transquant_bypass_enable_flag; + ++#ifdef DISABLE_DEBLOCK_NONREF ++ if ( s->nal_unit_type == NAL_TRAIL_N || ++ s->nal_unit_type == NAL_TSA_N || ++ s->nal_unit_type == NAL_STSA_N || ++ s->nal_unit_type == NAL_RADL_N || ++ s->nal_unit_type == NAL_RASL_N ) ++ return; // Don't deblock non-reference frames ++#endif + #ifdef DISABLE_DEBLOCK + return; + #endif +-- +2.5.0 + + +From f5895e368e97fbd1ec04501b4be89a20f5cc5f29 Mon Sep 17 00:00:00 2001 +From: Peter de Rivaz <peter.derivaz@gmail.com> +Date: Mon, 11 May 2015 10:00:27 +0100 +Subject: [PATCH 15/68] Moved buffers to VPU memory + +--- + libavcodec/hevc_filter.c | 17 +++++++++++++- + libavcodec/utils.c | 59 ++++++++++++++++++++++++++++++++++++++++++++++++ + libavutil/buffer.c | 6 +++++ + libavutil/buffer.h | 3 +++ + 4 files changed, 84 insertions(+), 1 deletion(-) + +diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c +index 2cdd621..e1b32d4 100644 +--- a/libavcodec/hevc_filter.c ++++ b/libavcodec/hevc_filter.c +@@ -866,6 +866,13 @@ void ff_hevc_deblocking_boundary_strengths(HEVCContext *s, int x0, int y0, + #undef CB + #undef CR + ++#ifdef RPI_INTER_QPU ++static void flush_buffer(AVBufferRef *bref) { ++ GPU_MEM_PTR_T *p = av_buffer_pool_opaque(bref); ++ gpu_cache_flush(p); ++} ++#endif ++ + void ff_hevc_hls_filter(HEVCContext *s, int x, int y, int ctb_size) + { + int x_end = x >= s->ps.sps->width - ctb_size; +@@ -888,9 +895,17 @@ void ff_hevc_hls_filter(HEVCContext *s, int x, int y, int ctb_size) + ff_thread_report_progress(&s->ref->tf, y + ctb_size, 0); + } + } else if (s->threads_type & FF_THREAD_FRAME && x_end) { +- int newh = y + ctb_size - 4; ++ //int newh = y + ctb_size - 4; + //int currh = s->ref->tf.progress->data[0]; + //if (((y + ctb_size)&63)==0) ++ if (!( s->nal_unit_type == NAL_TRAIL_N || ++ s->nal_unit_type == NAL_TSA_N || ++ s->nal_unit_type == NAL_STSA_N || ++ s->nal_unit_type == NAL_RADL_N || ++ s->nal_unit_type == NAL_RASL_N )) { ++ flush_buffer(s->frame->buf[1]); ++ flush_buffer(s->frame->buf[2]); ++ } + ff_thread_report_progress(&s->ref->tf, y + ctb_size - 4, 0); + } + } +diff --git a/libavcodec/utils.c b/libavcodec/utils.c +index f532824..b32047a 100644 +--- a/libavcodec/utils.c ++++ b/libavcodec/utils.c +@@ -26,6 +26,12 @@ + */ + + #include "config.h" ++ ++#ifdef RPI ++// Move video buffers to GPU memory ++#define RPI_GPU_BUFFERS ++#endif ++ + #include "libavutil/atomic.h" + #include "libavutil/attributes.h" + #include "libavutil/avassert.h" +@@ -63,6 +69,10 @@ + #include "libavutil/ffversion.h" + const char av_codec_ffversion[] = "FFmpeg version " FFMPEG_VERSION; + ++#ifdef RPI_GPU_BUFFERS ++#include "rpi_qpu.h" ++#endif ++ + #if HAVE_PTHREADS || HAVE_W32THREADS || HAVE_OS2THREADS + static int default_lockmgr_cb(void **arg, enum AVLockOp op) + { +@@ -500,6 +510,47 @@ int avcodec_fill_audio_frame(AVFrame *frame, int nb_channels, + return ret; + } + ++#ifdef RPI_GPU_BUFFERS ++static void rpi_buffer_default_free(void *opaque, uint8_t *data) ++{ ++ GPU_MEM_PTR_T *p = opaque; ++ gpu_free(p); ++ av_free(p); ++} ++ ++static AVBufferRef *rpi_buffer_alloc(int size) ++{ ++ AVBufferRef *ret = NULL; ++ uint8_t *data = NULL; ++ GPU_MEM_PTR_T *p; ++ ++ static int total=0; ++ total+=size; ++ ++ p = av_malloc(sizeof *p); ++ if (!p) ++ return NULL; ++ ++ if (gpu_malloc_cached(size,p)<0) // Change this line to choose cached or uncached memory. The caching here refers to the ARM data cache. ++ return NULL; ++ ++ data = p->arm; ++ printf("Rpi alloc %d/%d ARM=%p VC=%x->%x\n",size,total,p->arm,p->vc,p->vc+size); ++ //memset(data, 64, size); ++ ++ if (!data) ++ return NULL; ++ ++ ret = av_buffer_create(data, size, rpi_buffer_default_free, p, 0); ++ if (!ret) { ++ gpu_free(p); ++ av_freep(&p); ++ } ++ ++ return ret; ++} ++#endif ++ + static int update_frame_pool(AVCodecContext *avctx, AVFrame *frame) + { + FramePool *pool = avctx->internal->pool; +@@ -547,6 +598,14 @@ static int update_frame_pool(AVCodecContext *avctx, AVFrame *frame) + av_buffer_pool_uninit(&pool->pools[i]); + pool->linesize[i] = linesize[i]; + if (size[i]) { ++#ifdef RPI_GPU_BUFFERS ++ if (avctx->codec_id == AV_CODEC_ID_HEVC) ++ pool->pools[i] = av_buffer_pool_init(size[i] + 16 + STRIDE_ALIGN - 1, ++ CONFIG_MEMORY_POISONING ? ++ NULL : ++ rpi_buffer_alloc); ++ else ++#endif + pool->pools[i] = av_buffer_pool_init(size[i] + 16 + STRIDE_ALIGN - 1, + CONFIG_MEMORY_POISONING ? + NULL : +diff --git a/libavutil/buffer.c b/libavutil/buffer.c +index bb112c2..7f8bfab 100644 +--- a/libavutil/buffer.c ++++ b/libavutil/buffer.c +@@ -400,3 +400,9 @@ AVBufferRef *av_buffer_pool_get(AVBufferPool *pool) + + return ret; + } ++ ++// Return the opaque for the underlying frame (gives us a GPU_MEM_PTR_T) ++void *av_buffer_pool_opaque(AVBufferRef *ref) { ++ BufferPoolEntry *buf = av_buffer_get_opaque(ref); ++ return buf->opaque; ++} +diff --git a/libavutil/buffer.h b/libavutil/buffer.h +index b4399fd..0489002 100644 +--- a/libavutil/buffer.h ++++ b/libavutil/buffer.h +@@ -267,6 +267,9 @@ void av_buffer_pool_uninit(AVBufferPool **pool); + */ + AVBufferRef *av_buffer_pool_get(AVBufferPool *pool); + ++// Return the opaque for the underlying frame ++void *av_buffer_pool_opaque(AVBufferRef *ref); ++ + /** + * @} + */ +-- +2.5.0 + + +From 969972796afe03290f6c2dd3251bce367b4c6847 Mon Sep 17 00:00:00 2001 +From: Peter de Rivaz <peter.derivaz@gmail.com> +Date: Mon, 11 May 2015 14:04:37 +0100 +Subject: [PATCH 16/68] Prepared QPU execute code + +--- + libavcodec/hevc.c | 227 ++++++++++++++++++++++++++++++++++++++++------- + libavcodec/hevc.h | 22 ++++- + libavcodec/hevc_filter.c | 7 +- + libavcodec/rpi_qpu.c | 55 +++++++++++- + libavcodec/rpi_qpu.h | 2 + + 5 files changed, 276 insertions(+), 37 deletions(-) + +diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c +index c12693b..3b10ea0 100644 +--- a/libavcodec/hevc.c ++++ b/libavcodec/hevc.c +@@ -42,17 +42,45 @@ + #include "profiles.h" + + #ifdef RPI +-#include "rpi_qpu.h" +-// For some unknown reason, the code seems to crash if I do a late malloc +-#define EARLY_MALLOC +-// Move Inter prediction into separate pass +-#define RPI_INTER ++ #include "rpi_qpu.h" ++ // For some unknown reason, the code seems to crash if I do a late malloc ++ #define EARLY_MALLOC ++ // Move Inter prediction into separate pass ++ #define RPI_INTER + #endif + + // #define DISABLE_MC + + const uint8_t ff_hevc_pel_weight[65] = { [2] = 0, [4] = 1, [6] = 2, [8] = 3, [12] = 4, [16] = 5, [24] = 6, [32] = 7, [48] = 8, [64] = 9 }; + ++ ++#ifdef RPI_INTER_QPU ++ ++#define RPI_CHROMA_COMMAND_WORDS 12 ++// The QPU code for UV blocks only works up to a block width of 8 ++#define RPI_CHROMA_BLOCK_WIDTH 8 ++ ++#define ENCODE_COEFFS(c0, c1, c2, c3) (((-c0) & 0xff) | ((-c1) & 0xff) << 8 | ((-c2) & 0xff) << 16 | ((-c3) & 0xff) << 24) ++ ++// TODO Chroma only needs 4 taps ++static uint32_t rpi_filter_coefs[8][2] = { ++ { ENCODE_COEFFS( 0, 0, 0, 128), ENCODE_COEFFS( 0, 0, 0, 0 ) }, ++ { ENCODE_COEFFS( 0, 0, -2, 58), ENCODE_COEFFS( 10, -2, 0, 0 ) }, ++ { ENCODE_COEFFS( 0, 0, -4, 54), ENCODE_COEFFS( 16, -2, 0, 0 ) }, ++ { ENCODE_COEFFS( 0, 0, -6, 46), ENCODE_COEFFS( 28, -4, 0, 0 ) }, ++ { ENCODE_COEFFS( 0, 0, -4, 36), ENCODE_COEFFS( 36, -4, 0, 0 ) }, ++ { ENCODE_COEFFS( 0, 0, -4, 28), ENCODE_COEFFS( 46, -6, 0, 0 ) }, ++ { ENCODE_COEFFS( 0, 0, -2, 16), ENCODE_COEFFS( 54, -4, 0, 0 ) }, ++ { ENCODE_COEFFS( 0, 0, -2, 10), ENCODE_COEFFS( 58, -2, 0, 0 ) } ++}; ++ ++static uint32_t get_vc_address(AVBufferRef *bref) { ++ GPU_MEM_PTR_T *p = av_buffer_pool_opaque(bref); ++ return p->vc; ++} ++ ++#endif ++ + /** + * NOTE: Each function hls_foo correspond to the function foo in the + * specification (HLS stands for High Level Syntax). +@@ -66,6 +94,7 @@ const uint8_t ff_hevc_pel_weight[65] = { [2] = 0, [4] = 1, [6] = 2, [8] = 3, [12 + static void pic_arrays_free(HEVCContext *s) + { + #ifdef RPI ++ + #ifdef EARLY_MALLOC + #else + printf("pic_arrays_free\n"); +@@ -1971,6 +2000,43 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, + s->sh.luma_offset_l0[current_mv.ref_idx[0]]); + + if (s->ps.sps->chroma_format_idc) { ++#ifdef RPI_INTER_QPU ++ if (s->enable_rpi) { ++ int reflist = 0; ++ int hshift = s->ps.sps->hshift[1]; ++ int vshift = s->ps.sps->vshift[1]; ++ const Mv *mv = &current_mv.mv[reflist]; ++ intptr_t mx = av_mod_uintp2(mv->x, 2 + hshift); ++ intptr_t my = av_mod_uintp2(mv->y, 2 + vshift); ++ intptr_t _mx = mx << (1 - hshift); ++ intptr_t _my = my << (1 - vshift); // Fractional part of motion vector ++ ++ int x1_c = x0_c + (mv->x >> (2 + hshift)); ++ int y1_c = y0_c + (mv->y >> (2 + hshift)); ++ int chan = x0>>8; // Allocate commands for the first 256 luma pixels across to the first QPU. This is optimised for images around 1920 width ++ ++ uint32_t *u = s->u_mvs[chan & 7]; ++ for(int start_y=0;start_y < nPbH_c;start_y+=16) { ++ for(int start_x=0;start_x < nPbW_c;start_x+=RPI_CHROMA_BLOCK_WIDTH) { ++ u++[-RPI_CHROMA_COMMAND_WORDS] = s->mc_filter_uv; ++ u++[-RPI_CHROMA_COMMAND_WORDS] = x1_c - 3 + start_x; ++ u++[-RPI_CHROMA_COMMAND_WORDS] = y1_c - 3 + start_y; ++ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[1]); ++ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[2]); ++ *u++ = ( (nPbW_c<RPI_CHROMA_BLOCK_WIDTH ? nPbW_c : RPI_CHROMA_BLOCK_WIDTH) << 16 ) + (nPbH_c<16 ? nPbH_c : 16); ++ // TODO chroma weight and offset... s->sh.chroma_weight_l0[current_mv.ref_idx[0]][0], s->sh.chroma_offset_l0[current_mv.ref_idx[0]][0] ++ *u++ = rpi_filter_coefs[_mx][0]; ++ *u++ = rpi_filter_coefs[_mx][1]; ++ *u++ = rpi_filter_coefs[_my][0]; ++ *u++ = rpi_filter_coefs[_my][1]; ++ *u++ = (get_vc_address(s->frame->buf[1]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[1]); ++ *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); ++ } ++ } ++ s->u_mvs[chan & 7] = u; ++ return; ++ } ++#endif + RPI_REDIRECT(chroma_mc_uni)(s, dst1, s->frame->linesize[1], ref0->frame->data[1], ref0->frame->linesize[1], + 0, x0_c, y0_c, nPbW_c, nPbH_c, &current_mv, + s->sh.chroma_weight_l0[current_mv.ref_idx[0]][0], s->sh.chroma_offset_l0[current_mv.ref_idx[0]][0]); +@@ -2621,6 +2687,54 @@ static void rpi_execute_inter_cmds(HEVCContext *s) + + #endif + ++#ifdef RPI_INTER_QPU ++static void rpi_inter_clear(HEVCContext *s) ++{ ++ int i; ++ int pic_width = s->ps.sps->width >> s->ps.sps->hshift[1]; ++ int pic_height = s->ps.sps->height >> s->ps.sps->vshift[1]; ++ for(i=0;i<8;i++) { ++ s->u_mvs[i] = s->mvs_base[i]; ++ *s->u_mvs[i]++ = 0; ++ *s->u_mvs[i]++ = 0; ++ *s->u_mvs[i]++ = 0; ++ *s->u_mvs[i]++ = 0; ++ *s->u_mvs[i]++ = 0; ++ *s->u_mvs[i]++ = pic_width; ++ *s->u_mvs[i]++ = pic_height; ++ *s->u_mvs[i]++ = s->frame->linesize[1]; ++ *s->u_mvs[i]++ = s->frame->linesize[2]; ++ s->u_mvs[i] += 3; // Padding words ++ } ++} ++ ++static void rpi_execute_inter_qpu(HEVCContext *s) ++{ ++ int k; ++ uint32_t *unif_vc = (uint32_t *)s->unif_mvs_ptr.vc; ++ ++ if (s->sh.slice_type == I_SLICE) ++ return; ++ for(k=0;k<8;k++) { ++ s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS] = qpu_get_fn(QPU_MC_EXIT); // Add exit command ++ s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS+3] = qpu_get_fn(QPU_MC_SETUP); // A dummy texture location (maps to our code) - this is needed as the texture requests are pipelined ++ } ++ ++ s->u_mvs[8-1][-RPI_CHROMA_COMMAND_WORDS] = qpu_get_fn(QPU_MC_INTERRUPT_EXIT8); // This QPU will signal interrupt when all others are done and have acquired a semaphore ++ ++ qpu_run_shader8(qpu_get_fn(QPU_MC_SETUP_UV), ++ (uint32_t)(unif_vc+(s->mvs_base[0 ] - (uint32_t*)s->unif_mvs_ptr.arm)), ++ (uint32_t)(unif_vc+(s->mvs_base[1 ] - (uint32_t*)s->unif_mvs_ptr.arm)), ++ (uint32_t)(unif_vc+(s->mvs_base[2 ] - (uint32_t*)s->unif_mvs_ptr.arm)), ++ (uint32_t)(unif_vc+(s->mvs_base[3 ] - (uint32_t*)s->unif_mvs_ptr.arm)), ++ (uint32_t)(unif_vc+(s->mvs_base[4 ] - (uint32_t*)s->unif_mvs_ptr.arm)), ++ (uint32_t)(unif_vc+(s->mvs_base[5 ] - (uint32_t*)s->unif_mvs_ptr.arm)), ++ (uint32_t)(unif_vc+(s->mvs_base[6 ] - (uint32_t*)s->unif_mvs_ptr.arm)), ++ (uint32_t)(unif_vc+(s->mvs_base[7 ] - (uint32_t*)s->unif_mvs_ptr.arm)) ++ ); ++} ++#endif ++ + static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) + { + HEVCContext *s = avctxt->priv_data; +@@ -2647,6 +2761,10 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) + } + } + ++#ifdef RPI_INTER_QPU ++ rpi_inter_clear(s); ++#endif ++ + while (more_data && ctb_addr_ts < s->ps.sps->ctb_size) { + int ctb_addr_rs = s->ps.pps->ctb_addr_ts_to_rs[ctb_addr_ts]; + +@@ -2668,19 +2786,30 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) + s->dblk_cmds[s->num_dblk_cmds][0] = x_ctb; + s->dblk_cmds[s->num_dblk_cmds++][1] = y_ctb; + if ( (((y_ctb + ctb_size)&63) == 0) && x_ctb + ctb_size >= s->ps.sps->width) { +- int x; ++#ifdef RPI_INTER_QPU ++ // Kick off inter prediction on QPUs ++ rpi_execute_inter_qpu(s); ++#endif + // Transform all blocks + //printf("%d %d %d : %d %d %d %d\n",s->poc, x_ctb, y_ctb, s->num_pred_cmds,s->num_mv_cmds,s->num_coeffs[2] >> 8,s->num_coeffs[3] >> 10); +- + rpi_execute_transform(s); + // Perform inter prediction + rpi_execute_inter_cmds(s); + // Wait for transform completion + vpu_wait(s->vpu_id); ++ ++ // Copy back reconstructed data ++ //memcpy(s->frame->data[0],s->dummy.arm,2048*64); ++ //memcpy(s->frame->data[1],s->dummy.arm,1024*32); ++ //memcpy(s->frame->data[2],s->dummy.arm,1024*32); ++ + // Perform intra prediction and residual reconstruction + rpi_execute_pred_cmds(s); + // Perform deblocking for CTBs in this row + rpi_execute_dblk_cmds(s); ++#ifdef RPI_INTER_QPU ++ rpi_inter_clear(s); ++#endif + } + } + #endif +@@ -2701,6 +2830,9 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) + + #ifdef RPI + if (s->enable_rpi && s->num_dblk_cmds) { ++#ifdef RPI_INTER_QPU ++ rpi_execute_inter_qpu(s); ++#endif + rpi_execute_transform(s); + rpi_execute_inter_cmds(s); + vpu_wait(s->vpu_id); +@@ -3440,6 +3572,14 @@ static av_cold int hevc_decode_free(AVCodecContext *avctx) + av_freep(&s->unif_xfm_cmds); + av_freep(&s->univ_pred_cmds); + ++#ifdef RPI_INTER_QPU ++ if (s->unif_mvs) { ++ gpu_free( &s->unif_mvs_ptr ); ++ s->unif_mvs = 0; ++ } ++#endif ++ //gpu_free(&s->dummy); ++ + #ifdef EARLY_MALLOC + printf("hevc_decode_free\n"); + if (s->coeffs_buf_arm[0]) { +@@ -3535,34 +3675,59 @@ static av_cold int hevc_init_context(AVCodecContext *avctx) + if (!s->univ_pred_cmds) + goto fail; + +- s->coeffs_buf_arm[0] = 0; +- s->coeffs_buf_arm[2] = 0; ++#ifdef RPI_INTER_QPU ++ // We divide the image into blocks 256 wide and 64 high ++ // We support up to 2048 widths ++ // We compute the number of chroma motion vector commands for 4:4:4 format and 4x4 chroma blocks - assuming all blocks are B predicted ++ // Also add space for the startup command for each stream. ++ ++ { ++ int uv_commands_per_qpu = (1 + (256*64*2)/(4*4)) * RPI_CHROMA_COMMAND_WORDS; ++ uint32_t *p; ++ gpu_malloc_uncached( 8 * uv_commands_per_qpu * sizeof(uint32_t), &s->unif_mvs_ptr ); ++ s->unif_mvs = (uint32_t *) s->unif_mvs_ptr.arm; // TODO support this allocation in non EARLY_MALLOC ++ ++ // Set up initial locations for uniform streams ++ p = s->unif_mvs; ++ for(i = 0; i < 8; i++) { ++ s->mvs_base[i] = p; ++ p += uv_commands_per_qpu; ++ } ++ s->mc_filter_uv = qpu_get_fn(QPU_MC_FILTER_UV); ++ s->mc_filter_uv_b = qpu_get_fn(QPU_MC_FILTER_UV_B); ++ ++ } ++#endif ++ //gpu_malloc_uncached(2048*64,&s->dummy); + + #ifdef EARLY_MALLOC +- int coeffs_in_ctb = 64*64; +- int coefs_per_row = (2048/64) * coeffs_in_ctb * 3; // Allow space for chroma +- printf("Allocated %d\n",coefs_per_row); +- gpu_malloc_cached(sizeof(int16_t) * coefs_per_row, &s->coeffs_buf_default); +- s->coeffs_buf_arm[0] = (int16_t*) s->coeffs_buf_default.arm; +- if (!s->coeffs_buf_arm[0]) +- goto fail; +- gpu_malloc_cached(sizeof(int16_t) * coefs_per_row * 2, &s->coeffs_buf_accelerated); +- s->coeffs_buf_arm[2] = (int16_t*) s->coeffs_buf_accelerated.arm; +- s->coeffs_buf_vc[2] = s->coeffs_buf_accelerated.vc; +- if (!s->coeffs_buf_arm[2]) +- goto fail; +- s->coeffs_buf_arm[3] = coefs_per_row + s->coeffs_buf_arm[2]; +- s->coeffs_buf_vc[3] = sizeof(int16_t) * coefs_per_row + s->coeffs_buf_vc[2]; +- printf("Done\n"); ++ { ++ int coeffs_in_ctb = 64*64; ++ int coefs_per_row = (2048/64) * coeffs_in_ctb * 3; // Allow space for chroma ++ s->coeffs_buf_arm[0] = 0; ++ s->coeffs_buf_arm[2] = 0; ++ printf("Allocated %d\n",coefs_per_row); ++ gpu_malloc_cached(sizeof(int16_t) * coefs_per_row, &s->coeffs_buf_default); ++ s->coeffs_buf_arm[0] = (int16_t*) s->coeffs_buf_default.arm; ++ if (!s->coeffs_buf_arm[0]) ++ goto fail; ++ gpu_malloc_cached(sizeof(int16_t) * coefs_per_row * 2, &s->coeffs_buf_accelerated); ++ s->coeffs_buf_arm[2] = (int16_t*) s->coeffs_buf_accelerated.arm; ++ s->coeffs_buf_vc[2] = s->coeffs_buf_accelerated.vc; ++ if (!s->coeffs_buf_arm[2]) ++ goto fail; ++ s->coeffs_buf_arm[3] = coefs_per_row + s->coeffs_buf_arm[2]; ++ s->coeffs_buf_vc[3] = sizeof(int16_t) * coefs_per_row + s->coeffs_buf_vc[2]; ++ printf("Done\n"); + #ifdef RPI_PRECLEAR +- //memset(s->coeffs_buf_arm[0],0, sizeof(int16_t) * coefs_per_row); +- memclear16(s->coeffs_buf_arm[0], coefs_per_row); +- //memset(s->coeffs_buf_arm[2],0, sizeof(int16_t) * coefs_per_row); +- memclear16(s->coeffs_buf_arm[2], coefs_per_row); +- //memset(s->coeffs_buf_arm[3],0, sizeof(int16_t) * coefs_per_row); +- memclear16(s->coeffs_buf_arm[3], coefs_per_row); ++ //memset(s->coeffs_buf_arm[0],0, sizeof(int16_t) * coefs_per_row); ++ memclear16(s->coeffs_buf_arm[0], coefs_per_row); ++ //memset(s->coeffs_buf_arm[2],0, sizeof(int16_t) * coefs_per_row); ++ memclear16(s->coeffs_buf_arm[2], coefs_per_row); ++ //memset(s->coeffs_buf_arm[3],0, sizeof(int16_t) * coefs_per_row); ++ memclear16(s->coeffs_buf_arm[3], coefs_per_row); + #endif +- ++ } + #endif + + s->enable_rpi = 0; +diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h +index 1fcf8b9..a19d3ab 100644 +--- a/libavcodec/hevc.h ++++ b/libavcodec/hevc.h +@@ -41,7 +41,11 @@ + + // define RPI to split the CABAC/prediction/transform into separate stages + #ifdef RPI +-#include "rpi_qpu.h" ++ ++ #include "rpi_qpu.h" ++ // Use QPU for inter prediction ++ //#define RPI_INTER_QPU ++ + #endif + + #define MAX_DPB_SIZE 16 // A.4.1 +@@ -914,7 +918,7 @@ typedef struct HEVCContext { + + #ifdef RPI + int enable_rpi; +- HEVCMvCmd *unif_mv_cmds; ++ HEVCMvCmd *unif_mv_cmds; // TODO rename + HEVCXfmCmd *unif_xfm_cmds; + HEVCPredCmd *univ_pred_cmds; + int buf_width; +@@ -928,6 +932,20 @@ typedef struct HEVCContext { + int num_pred_cmds; + int num_dblk_cmds; + int vpu_id; ++ //GPU_MEM_PTR_T dummy; ++#ifdef RPI_INTER_QPU ++ GPU_MEM_PTR_T unif_mvs_ptr; ++ uint32_t *unif_mvs; // Base of memory for motion vector commands ++ ++ // _base pointers are to the start of the row ++ uint32_t *mvs_base[8]; ++ // these pointers are to the next free space ++ uint32_t *u_mvs[8]; ++ // Function pointers ++ uint32_t mc_filter_uv; ++ uint32_t mc_filter_uv_b; ++#endif ++ + #endif + + uint8_t *cabac_state; +diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c +index e1b32d4..5b3d759 100644 +--- a/libavcodec/hevc_filter.c ++++ b/libavcodec/hevc_filter.c +@@ -903,8 +903,11 @@ void ff_hevc_hls_filter(HEVCContext *s, int x, int y, int ctb_size) + s->nal_unit_type == NAL_STSA_N || + s->nal_unit_type == NAL_RADL_N || + s->nal_unit_type == NAL_RASL_N )) { +- flush_buffer(s->frame->buf[1]); +- flush_buffer(s->frame->buf[2]); ++ //flush_buffer(s->frame->buf[1]); ++ //flush_buffer(s->frame->buf[2]); ++ //memcpy(s->dummy.arm,s->frame->data[0],2048*64); ++ //memcpy(s->dummy.arm,s->frame->data[1],1024*32); ++ //memcpy(s->dummy.arm,s->frame->data[2],1024*32); + } + ff_thread_report_progress(&s->ref->tf, y + ctb_size - 4, 0); + } +diff --git a/libavcodec/rpi_qpu.c b/libavcodec/rpi_qpu.c +index 3b6dae7..e4dd58a 100644 +--- a/libavcodec/rpi_qpu.c ++++ b/libavcodec/rpi_qpu.c +@@ -3,7 +3,7 @@ + // This works better than the mmap in that the memory can be cached, but requires a kernel modification to enable the device. + #define RPI_USE_VCSM + // define RPI_TIME_TOTAL_QPU to print out how much time is spent in the QPU code +-//#define RPI_TIME_TOTAL_QPU ++#define RPI_TIME_TOTAL_QPU + // define RPI_TIME_TOTAL_VPU to print out how much time is spent in the VPI code + //#define RPI_TIME_TOTAL_VPU + // define RPI_ASYNC to run the VPU in a separate thread, need to make a separate call to check for completion +@@ -30,7 +30,7 @@ + #endif + + // On Pi2 there is no way to access the VPU L2 cache +-// GPU_MEM_FLG should be 4 for uncached memory. ++// GPU_MEM_FLG should be 4 for uncached memory. (Or C for alias to allocate in the VPU L2 cache) + // However, if using VCSM allocated buffers, need to use C at the moment because VCSM does not allocate uncached memory correctly + // The QPU crashes if we mix L2 cached and L2 uncached accesses due to a HW bug. + #define GPU_MEM_FLG 0xC +@@ -549,6 +549,54 @@ void qpu_run_shader12(int code, int num, int code2, int num2, int unifs1, int un + gpu_unlock(); + } + ++// Run a program on 8 QPUs with the given code and uniform stream (given in GPU addresses) ++void qpu_run_shader8(int code, int unifs1, int unifs2, int unifs3, int unifs4, int unifs5, int unifs6, int unifs7, int unifs8) ++{ ++ int i; ++#ifdef RPI_TIME_TOTAL_QPU ++ static int last_time=0; ++ static long long on_time=0; ++ static long long off_time=0; ++ int start_time; ++ int end_time; ++ static int count=0; ++#endif ++ ++ gpu_lock(); ++#ifdef RPI_TIME_TOTAL_QPU ++ start_time = Microseconds(); ++ if (last_time==0) ++ last_time = start_time; ++ off_time += start_time-last_time; ++#endif ++ for(i=0;i<8;i++) { ++ gpu->mail[i*2 + 1] = code; ++ } ++ gpu->mail[0 ] = unifs1; ++ gpu->mail[2 ] = unifs2; ++ gpu->mail[4 ] = unifs3; ++ gpu->mail[6 ] = unifs4; ++ gpu->mail[8 ] = unifs5; ++ gpu->mail[10] = unifs6; ++ gpu->mail[12] = unifs7; ++ gpu->mail[14] = unifs8; ++ execute_qpu( ++ gpu->mb, ++ 8 /* Number of QPUs */, ++ gpu->vc + offsetof(struct GPU, mail), ++ 1 /* no flush */, // Don't flush VPU L1 cache ++ 5000 /* timeout ms */); ++#ifdef RPI_TIME_TOTAL_QPU ++ end_time = Microseconds(); ++ last_time = end_time; ++ on_time += end_time - start_time; ++ count++; ++ if ((count&0x7f)==0) ++ printf("On=%dms, Off=%dms\n",(int)(on_time/1000),(int)(off_time/1000)); ++#endif ++ gpu_unlock(); ++} ++ + unsigned int qpu_get_fn(int num) { + // Make sure that the gpu is initialized + unsigned int *fn; +@@ -585,6 +633,9 @@ unsigned int qpu_get_fn(int num) { + case QPU_MC_FILTER_UV_B: + fn = mc_filter_uv_b; + break; ++ case QPU_MC_INTERRUPT_EXIT8: ++ fn = mc_interrupt_exit8; ++ break; + case QPU_MC_END: + fn = mc_end; + break; +diff --git a/libavcodec/rpi_qpu.h b/libavcodec/rpi_qpu.h +index 3526fce..2b22d98 100644 +--- a/libavcodec/rpi_qpu.h ++++ b/libavcodec/rpi_qpu.h +@@ -16,6 +16,7 @@ extern void gpu_free(GPU_MEM_PTR_T *p); + extern void gpu_cache_flush(GPU_MEM_PTR_T *p); + + // QPU specific functions ++extern void qpu_run_shader8(int code, int unifs1, int unifs2, int unifs3, int unifs4, int unifs5, int unifs6, int unifs7, int unifs8); + extern void qpu_run_shader12(int code, int num, int code2, int num2, int unifs1, int unifs2, int unifs3, int unifs4, int unifs5, int unifs6, int unifs7, int unifs8, int unifs9, int unifs10, int unifs11, int unifs12); + + enum { +@@ -28,6 +29,7 @@ enum { + QPU_MC_SETUP_UV, + QPU_MC_FILTER_UV, + QPU_MC_FILTER_UV_B, ++ QPU_MC_INTERRUPT_EXIT8, + QPU_MC_END + }; + extern unsigned int qpu_get_fn(int num); +-- +2.5.0 + + +From 90df0cacf3bed37328d465a925e446c7d3e9583b Mon Sep 17 00:00:00 2001 +From: Peter de Rivaz <peter.derivaz@gmail.com> +Date: Wed, 13 May 2015 11:47:23 +0100 +Subject: [PATCH 17/68] Drafted chroma interpolation on QPUs + +--- + libavcodec/hevc.c | 5 ++- + libavcodec/hevc.h | 2 +- + libavcodec/hevc_filter.c | 6 ++- + libavcodec/rpi_qpu.c | 101 +++++++++++++++++++++++++++++++++++++++++++-- + libavcodec/rpi_qpu.h | 1 + + libavcodec/rpi_shader.c | 42 +++++++++---------- + libavcodec/rpi_shader.qasm | 42 +++++++++---------- + 7 files changed, 149 insertions(+), 50 deletions(-) + +diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c +index 3b10ea0..a5e1524 100644 +--- a/libavcodec/hevc.c ++++ b/libavcodec/hevc.c +@@ -60,11 +60,11 @@ const uint8_t ff_hevc_pel_weight[65] = { [2] = 0, [4] = 1, [6] = 2, [8] = 3, [12 + // The QPU code for UV blocks only works up to a block width of 8 + #define RPI_CHROMA_BLOCK_WIDTH 8 + +-#define ENCODE_COEFFS(c0, c1, c2, c3) (((-c0) & 0xff) | ((-c1) & 0xff) << 8 | ((-c2) & 0xff) << 16 | ((-c3) & 0xff) << 24) ++#define ENCODE_COEFFS(c0, c1, c2, c3) (((c0) & 0xff) | ((c1) & 0xff) << 8 | ((c2) & 0xff) << 16 | ((c3) & 0xff) << 24) + + // TODO Chroma only needs 4 taps + static uint32_t rpi_filter_coefs[8][2] = { +- { ENCODE_COEFFS( 0, 0, 0, 128), ENCODE_COEFFS( 0, 0, 0, 0 ) }, ++ { ENCODE_COEFFS( 0, 0, 0, 64), ENCODE_COEFFS( 0, 0, 0, 0 ) }, + { ENCODE_COEFFS( 0, 0, -2, 58), ENCODE_COEFFS( 10, -2, 0, 0 ) }, + { ENCODE_COEFFS( 0, 0, -4, 54), ENCODE_COEFFS( 16, -2, 0, 0 ) }, + { ENCODE_COEFFS( 0, 0, -6, 46), ENCODE_COEFFS( 28, -4, 0, 0 ) }, +@@ -2718,6 +2718,7 @@ static void rpi_execute_inter_qpu(HEVCContext *s) + for(k=0;k<8;k++) { + s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS] = qpu_get_fn(QPU_MC_EXIT); // Add exit command + s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS+3] = qpu_get_fn(QPU_MC_SETUP); // A dummy texture location (maps to our code) - this is needed as the texture requests are pipelined ++ s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS+4] = qpu_get_fn(QPU_MC_SETUP); // Also need a dummy for V + } + + s->u_mvs[8-1][-RPI_CHROMA_COMMAND_WORDS] = qpu_get_fn(QPU_MC_INTERRUPT_EXIT8); // This QPU will signal interrupt when all others are done and have acquired a semaphore +diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h +index a19d3ab..40470f5 100644 +--- a/libavcodec/hevc.h ++++ b/libavcodec/hevc.h +@@ -44,7 +44,7 @@ + + #include "rpi_qpu.h" + // Use QPU for inter prediction +- //#define RPI_INTER_QPU ++ // #define RPI_INTER_QPU + + #endif + +diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c +index 5b3d759..9b6e26d 100644 +--- a/libavcodec/hevc_filter.c ++++ b/libavcodec/hevc_filter.c +@@ -903,8 +903,10 @@ void ff_hevc_hls_filter(HEVCContext *s, int x, int y, int ctb_size) + s->nal_unit_type == NAL_STSA_N || + s->nal_unit_type == NAL_RADL_N || + s->nal_unit_type == NAL_RASL_N )) { +- //flush_buffer(s->frame->buf[1]); +- //flush_buffer(s->frame->buf[2]); ++#ifdef RPI_INTER_QPU ++ flush_buffer(s->frame->buf[1]); ++ flush_buffer(s->frame->buf[2]); ++#endif + //memcpy(s->dummy.arm,s->frame->data[0],2048*64); + //memcpy(s->dummy.arm,s->frame->data[1],1024*32); + //memcpy(s->dummy.arm,s->frame->data[2],1024*32); +diff --git a/libavcodec/rpi_qpu.c b/libavcodec/rpi_qpu.c +index e4dd58a..4d9eda8 100644 +--- a/libavcodec/rpi_qpu.c ++++ b/libavcodec/rpi_qpu.c +@@ -33,7 +33,8 @@ + // GPU_MEM_FLG should be 4 for uncached memory. (Or C for alias to allocate in the VPU L2 cache) + // However, if using VCSM allocated buffers, need to use C at the moment because VCSM does not allocate uncached memory correctly + // The QPU crashes if we mix L2 cached and L2 uncached accesses due to a HW bug. +-#define GPU_MEM_FLG 0xC ++#define GPU_MEM_FLG 0x4 ++// GPU_MEM_MAP is meaningless on the Pi2 and should be left at 0 (On Pi1 it allows ARM to access VPU L2 cache) + #define GPU_MEM_MAP 0x0 + + #define vcos_verify(x) ((x)>=0) +@@ -165,6 +166,8 @@ static int gpu_init(volatile struct GPU **gpu) { + ptr->vc_handle = handle; + ptr->vc = vc; + ++ printf("GPU allocated at 0x%x\n",vc); ++ + *gpu = ptr; + + // Now copy over the QPU code into GPU memory +@@ -304,10 +307,13 @@ int gpu_malloc_cached(int numbytes, GPU_MEM_PTR_T *p) { + + static void gpu_term(void) + { +- int mb = gpu->mb; +- unsigned handle = gpu->vc_handle; ++ int mb; ++ unsigned handle; ++ + if (gpu==NULL) + return; ++ mb = gpu->mb; ++ handle = gpu->vc_handle; + + #ifdef RPI_ASYNC + { +@@ -648,6 +654,95 @@ unsigned int qpu_get_fn(int num) { + } + + #if 0 ++typedef unsigned int uint32_t; ++ ++typedef struct mvs_s { ++ GPU_MEM_PTR_T unif_mvs_ptr; ++ uint32_t *unif_mvs; // Base of memory for motion vector commands ++ ++ // _base pointers are to the start of the row ++ uint32_t *mvs_base[8]; ++ // these pointers are to the next free space ++ uint32_t *u_mvs[8]; ++ ++} HEVCContext; ++ ++#define RPI_CHROMA_COMMAND_WORDS 12 ++ ++static void rpi_inter_clear(HEVCContext *s) ++{ ++ int i; ++ for(i=0;i<8;i++) { ++ s->u_mvs[i] = s->mvs_base[i]; ++ *s->u_mvs[i]++ = 0; ++ *s->u_mvs[i]++ = 0; ++ *s->u_mvs[i]++ = 0; ++ *s->u_mvs[i]++ = 0; ++ *s->u_mvs[i]++ = 0; ++ *s->u_mvs[i]++ = 128; // w ++ *s->u_mvs[i]++ = 128; // h ++ *s->u_mvs[i]++ = 128; // stride u ++ *s->u_mvs[i]++ = 128; // stride v ++ s->u_mvs[i] += 3; // Padding words ++ } ++} ++ ++static void rpi_execute_inter_qpu(HEVCContext *s) ++{ ++ int k; ++ uint32_t *unif_vc = (uint32_t *)s->unif_mvs_ptr.vc; ++ ++ for(k=0;k<8;k++) { ++ s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS] = qpu_get_fn(QPU_MC_EXIT); // Add exit command ++ s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS+3] = qpu_get_fn(QPU_MC_SETUP); // A dummy texture location (maps to our code) - this is needed as the texture requests are pipelined ++ s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS+4] = qpu_get_fn(QPU_MC_SETUP); // dummy location for V ++ } ++ ++ s->u_mvs[8-1][-RPI_CHROMA_COMMAND_WORDS] = qpu_get_fn(QPU_MC_INTERRUPT_EXIT8); // This QPU will signal interrupt when all others are done and have acquired a semaphore ++ ++ qpu_run_shader8(qpu_get_fn(QPU_MC_SETUP_UV), ++ (uint32_t)(unif_vc+(s->mvs_base[0 ] - (uint32_t*)s->unif_mvs_ptr.arm)), ++ (uint32_t)(unif_vc+(s->mvs_base[1 ] - (uint32_t*)s->unif_mvs_ptr.arm)), ++ (uint32_t)(unif_vc+(s->mvs_base[2 ] - (uint32_t*)s->unif_mvs_ptr.arm)), ++ (uint32_t)(unif_vc+(s->mvs_base[3 ] - (uint32_t*)s->unif_mvs_ptr.arm)), ++ (uint32_t)(unif_vc+(s->mvs_base[4 ] - (uint32_t*)s->unif_mvs_ptr.arm)), ++ (uint32_t)(unif_vc+(s->mvs_base[5 ] - (uint32_t*)s->unif_mvs_ptr.arm)), ++ (uint32_t)(unif_vc+(s->mvs_base[6 ] - (uint32_t*)s->unif_mvs_ptr.arm)), ++ (uint32_t)(unif_vc+(s->mvs_base[7 ] - (uint32_t*)s->unif_mvs_ptr.arm)) ++ ); ++} ++ ++void rpi_test_qpu(void) ++{ ++ HEVCContext mvs; ++ HEVCContext *s = &mvs; ++ int i; ++ int uv_commands_per_qpu = (1 + (256*64*2)/(4*4)) * RPI_CHROMA_COMMAND_WORDS; ++ uint32_t *p; ++ printf("Allocate memory\n"); ++ gpu_malloc_uncached( 8 * uv_commands_per_qpu * sizeof(uint32_t), &s->unif_mvs_ptr ); ++ s->unif_mvs = (uint32_t *) s->unif_mvs_ptr.arm; ++ ++ // Set up initial locations for uniform streams ++ p = s->unif_mvs; ++ for(i = 0; i < 8; i++) { ++ s->mvs_base[i] = p; ++ p += uv_commands_per_qpu; ++ } ++ // Now run a simple program that should just quit immediately after a single texture fetch ++ rpi_inter_clear(s); ++ for(i=0;i<4;i++) { ++ printf("Launch QPUs\n"); ++ rpi_execute_inter_qpu(s); ++ printf("Done\n"); ++ } ++ printf("Free memory\n"); ++ gpu_free(&s->unif_mvs_ptr); ++ return; ++} ++#endif ++ ++#if 0 + + int32_t hcoeffs[] = {-4, 10, -21, 70, 90, -24, 11, -4}; + //int32_t hcoeffs[] = {1, 1, 1, 1, 1, 1, 1, 1}; +diff --git a/libavcodec/rpi_qpu.h b/libavcodec/rpi_qpu.h +index 2b22d98..f9ad333 100644 +--- a/libavcodec/rpi_qpu.h ++++ b/libavcodec/rpi_qpu.h +@@ -18,6 +18,7 @@ extern void gpu_cache_flush(GPU_MEM_PTR_T *p); + // QPU specific functions + extern void qpu_run_shader8(int code, int unifs1, int unifs2, int unifs3, int unifs4, int unifs5, int unifs6, int unifs7, int unifs8); + extern void qpu_run_shader12(int code, int num, int code2, int num2, int unifs1, int unifs2, int unifs3, int unifs4, int unifs5, int unifs6, int unifs7, int unifs8, int unifs9, int unifs10, int unifs11, int unifs12); ++extern void rpi_test_qpu(void); + + enum { + QPU_MC_SETUP, +diff --git a/libavcodec/rpi_shader.c b/libavcodec/rpi_shader.c +index 41cc2e1..d7ed297 100644 +--- a/libavcodec/rpi_shader.c ++++ b/libavcodec/rpi_shader.c +@@ -152,23 +152,23 @@ unsigned int rpi_shader[] = { + /* [0x000003e8] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 + /* [0x000003f0] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 + /* [0x000003f8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-/* [0x00000400] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 +-/* [0x00000408] */ 0x40038031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra0 << 8, r1 << 8 +-/* [0x00000410] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 ++/* [0x00000400] */ 0x55015fc6, 0x100248a2, // mov r2, rb21 ; mul24 r2, r0, ra0 ++/* [0x00000408] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 ++/* [0x00000410] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 + /* [0x00000418] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 +-/* [0x00000420] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 ++/* [0x00000420] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 + /* [0x00000428] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 +-/* [0x00000430] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 ++/* [0x00000430] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 + /* [0x00000438] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 +-/* [0x00000440] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 ++/* [0x00000440] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 + /* [0x00000448] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 +-/* [0x00000450] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 ++/* [0x00000450] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 + /* [0x00000458] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 +-/* [0x00000460] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 ++/* [0x00000460] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 + /* [0x00000468] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 +-/* [0x00000470] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 ++/* [0x00000470] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 + /* [0x00000478] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 +-/* [0x00000480] */ 0x0d9e74c0, 0x10020827, // sub r0, r2, r3 ++/* [0x00000480] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 + /* [0x00000488] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 + /* [0x00000490] */ 0x15267d80, 0x10020227, // mov ra8, ra9 + /* [0x00000498] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 +@@ -179,20 +179,20 @@ unsigned int rpi_shader[] = { + /* [0x000004c0] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 + /* [0x000004c8] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop + /* [0x000004d0] */ 0x533c0dc1, 0xd00243a0, // max ra14, ra15, 0 ; mul24 r0, r0, r1 +-/* [0x000004d8] */ 0x8f54f1f6, 0xd0024821, // asr r0, r0, 15 ; mov r1, ra21 ++/* [0x000004d8] */ 0x8f54e1f6, 0xd0024821, // asr r0, r0, 14 ; mov r1, ra21 + /* [0x000004e0] */ 0x129d61c0, 0x100223e7, // min.setf ra15, r0, rb22 +-/* [0x000004e8] */ 0x4038e037, 0x100049e0, // nop ; mul24 r0, ra14, rb14 +-/* [0x000004f0] */ 0x4d34d237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra13, rb13 +-/* [0x000004f8] */ 0x4d30c237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra12, rb12 +-/* [0x00000500] */ 0x4d2cb237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra11, rb11 +-/* [0x00000508] */ 0x4d28a237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra10, rb10 +-/* [0x00000510] */ 0x4d249237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra9, rb9 +-/* [0x00000518] */ 0x4d208237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra8, rb8 +-/* [0x00000520] */ 0x4d3cf237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra15, rb15 +-/* [0x00000528] */ 0x8d9f223f, 0x100a0867, // sub.ifnn r1, r1, r0 ; mov -, vw_wait ++/* [0x000004e8] */ 0x4038e037, 0x100049e1, // nop ; mul24 r1, ra14, rb14 ++/* [0x000004f0] */ 0x4034d037, 0x100049e0, // nop ; mul24 r0, ra13, rb13 ++/* [0x000004f8] */ 0x4c30c237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb12 ++/* [0x00000500] */ 0x4c2cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb11 ++/* [0x00000508] */ 0x4c28a237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb10 ++/* [0x00000510] */ 0x4c249237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb9 ++/* [0x00000518] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 ++/* [0x00000520] */ 0x4c3cf237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb15 ++/* [0x00000528] */ 0x8c9f223f, 0x100a0867, // add.ifnn r1, r1, r0 ; mov -, vw_wait + /* [0x00000530] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 + /* [0x00000538] */ 0xfffffe50, 0xf06809e7, // brr.anyn -, r:uvloop +-/* [0x00000540] */ 0x0f9cf3c0, 0xd0020867, // asr r1, r1, 15 ++/* [0x00000540] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 + /* [0x00000548] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 + /* [0x00000550] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 + /* [0x00000558] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 +diff --git a/libavcodec/rpi_shader.qasm b/libavcodec/rpi_shader.qasm +index 6851e83..02fdcb2 100644 +--- a/libavcodec/rpi_shader.qasm ++++ b/libavcodec/rpi_shader.qasm +@@ -270,23 +270,23 @@ add t0s, ra_x2_base, r2 + + mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] + +-mov r2, rb21 ; mul24 r3, r0, ra0 +-nop ; mul24.ifnz r3, ra0 << 8, r1 << 8 +-sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 ++mov r2, rb21 ; mul24 r2, r0, ra0 ++nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 ++nop ; mul24 r3, ra1 << 1, r0 << 1 + nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 +-sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 ++add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 + nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 +-sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 ++add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 + nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 +-sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 ++add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 + nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 +-sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 ++add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 + nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 +-sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 ++add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 + nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 +-sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 ++add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 + nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 +-sub r0, r2, r3 ++add r0, r2, r3 + + mov r3, rb31 + +@@ -302,23 +302,23 @@ sub.setf -, r3, 8 ; mov r1, ra22 + # apply horizontal filter + brr.anyn -, r:uvloop + max ra14, ra15, 0 ; mul24 r0, r0, r1 # last bit of context scroll, including clamp to zero +-asr r0, r0, 15 ; mov r1, ra21 ++asr r0, r0, 14 ; mov r1, ra21 + min.setf ra15, r0, rb22 + + # apply vertical filter and write to VPM + +-nop ; mul24 r0, ra14, rb14 +-sub r1, r1, r0 ; mul24 r0, ra13, rb13 +-sub r1, r1, r0 ; mul24 r0, ra12, rb12 +-sub r1, r1, r0 ; mul24 r0, ra11, rb11 +-sub r1, r1, r0 ; mul24 r0, ra10, rb10 +-sub r1, r1, r0 ; mul24 r0, ra9, rb9 +-sub r1, r1, r0 ; mul24 r0, ra8, rb8 +-sub r1, r1, r0 ; mul24 r0, ra15, rb15 +-sub.ifnn r1, r1, r0 ; mov -, vw_wait ++nop ; mul24 r1, ra14, rb14 ++nop ; mul24 r0, ra13, rb13 ++add r1, r1, r0 ; mul24 r0, ra12, rb12 ++add r1, r1, r0 ; mul24 r0, ra11, rb11 ++add r1, r1, r0 ; mul24 r0, ra10, rb10 ++add r1, r1, r0 ; mul24 r0, ra9, rb9 ++add r1, r1, r0 ; mul24 r0, ra8, rb8 ++add r1, r1, r0 ; mul24 r0, ra15, rb15 ++add.ifnn r1, r1, r0 ; mov -, vw_wait + sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 + brr.anyn -, r:uvloop +-asr r1, r1, 15 ++asr r1, r1, 14 + min r1, r1, rb22 + max vpm, r1, 0 + +-- +2.5.0 + + +From 552770488305e7574028fe760aa16d00c1020afa Mon Sep 17 00:00:00 2001 +From: Peter de Rivaz <peter.derivaz@gmail.com> +Date: Wed, 13 May 2015 13:54:11 +0100 +Subject: [PATCH 18/68] Fixed chroma inter prediction + +--- + libavcodec/hevc.c | 8 +- + libavcodec/hevc.h | 2 +- + libavcodec/rpi_shader.c | 1170 ++++++++++++++++++++++---------------------- + libavcodec/rpi_shader.h | 22 +- + libavcodec/rpi_shader.qasm | 24 +- + 5 files changed, 617 insertions(+), 609 deletions(-) + +diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c +index a5e1524..d4d272a 100644 +--- a/libavcodec/hevc.c ++++ b/libavcodec/hevc.c +@@ -57,9 +57,11 @@ const uint8_t ff_hevc_pel_weight[65] = { [2] = 0, [4] = 1, [6] = 2, [8] = 3, [12 + #ifdef RPI_INTER_QPU + + #define RPI_CHROMA_COMMAND_WORDS 12 ++#define UV_COMMANDS_PER_QPU ((1 + (256*64*2)/(4*4)) * RPI_CHROMA_COMMAND_WORDS) + // The QPU code for UV blocks only works up to a block width of 8 + #define RPI_CHROMA_BLOCK_WIDTH 8 + ++ + #define ENCODE_COEFFS(c0, c1, c2, c3) (((c0) & 0xff) | ((c1) & 0xff) << 8 | ((c2) & 0xff) << 16 | ((c3) & 0xff) << 24) + + // TODO Chroma only needs 4 taps +@@ -2013,7 +2015,8 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, + + int x1_c = x0_c + (mv->x >> (2 + hshift)); + int y1_c = y0_c + (mv->y >> (2 + hshift)); +- int chan = x0>>8; // Allocate commands for the first 256 luma pixels across to the first QPU. This is optimised for images around 1920 width ++ //int chan = x0>>8; // Allocate commands for the first 256 luma pixels across to the first QPU. This is optimised for images around 1920 width ++ int chan = x0>>8; + + uint32_t *u = s->u_mvs[chan & 7]; + for(int start_y=0;start_y < nPbH_c;start_y+=16) { +@@ -2719,6 +2722,7 @@ static void rpi_execute_inter_qpu(HEVCContext *s) + s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS] = qpu_get_fn(QPU_MC_EXIT); // Add exit command + s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS+3] = qpu_get_fn(QPU_MC_SETUP); // A dummy texture location (maps to our code) - this is needed as the texture requests are pipelined + s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS+4] = qpu_get_fn(QPU_MC_SETUP); // Also need a dummy for V ++ assert(s->u_mvs[k] - s->mvs_base[k] < UV_COMMANDS_PER_QPU); + } + + s->u_mvs[8-1][-RPI_CHROMA_COMMAND_WORDS] = qpu_get_fn(QPU_MC_INTERRUPT_EXIT8); // This QPU will signal interrupt when all others are done and have acquired a semaphore +@@ -3683,7 +3687,7 @@ static av_cold int hevc_init_context(AVCodecContext *avctx) + // Also add space for the startup command for each stream. + + { +- int uv_commands_per_qpu = (1 + (256*64*2)/(4*4)) * RPI_CHROMA_COMMAND_WORDS; ++ int uv_commands_per_qpu = UV_COMMANDS_PER_QPU; + uint32_t *p; + gpu_malloc_uncached( 8 * uv_commands_per_qpu * sizeof(uint32_t), &s->unif_mvs_ptr ); + s->unif_mvs = (uint32_t *) s->unif_mvs_ptr.arm; // TODO support this allocation in non EARLY_MALLOC +diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h +index 40470f5..442516d 100644 +--- a/libavcodec/hevc.h ++++ b/libavcodec/hevc.h +@@ -44,7 +44,7 @@ + + #include "rpi_qpu.h" + // Use QPU for inter prediction +- // #define RPI_INTER_QPU ++ #define RPI_INTER_QPU + + #endif + +diff --git a/libavcodec/rpi_shader.c b/libavcodec/rpi_shader.c +index d7ed297..831633b 100644 +--- a/libavcodec/rpi_shader.c ++++ b/libavcodec/rpi_shader.c +@@ -33,7 +33,7 @@ unsigned int rpi_shader[] = { + /* [0x00000040] */ 0xc0000000, 0xe0020867, // mov r1, vdw_setup_1(0) + /* [0x00000048] */ 0x0c9e7200, 0x10021627, // add rb24, r1, r0 + /* [0x00000050] */ 0x00000001, 0xe0020527, // mov ra20, 1 +-/* [0x00000058] */ 0x00000040, 0xe0020567, // mov ra21, 64 ++/* [0x00000058] */ 0x00000020, 0xe0020567, // mov ra21, 32 + /* [0x00000060] */ 0x00000100, 0xe00205a7, // mov ra22, 256 + /* [0x00000068] */ 0x00000008, 0xe00205e7, // mov ra23, 8 + /* [0x00000070] */ 0xffffff00, 0xe0021527, // mov rb20, 0xffffff00 +@@ -152,7 +152,7 @@ unsigned int rpi_shader[] = { + /* [0x000003e8] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 + /* [0x000003f0] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 + /* [0x000003f8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-/* [0x00000400] */ 0x55015fc6, 0x100248a2, // mov r2, rb21 ; mul24 r2, r0, ra0 ++/* [0x00000400] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 + /* [0x00000408] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 + /* [0x00000410] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 + /* [0x00000418] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 +@@ -178,9 +178,9 @@ unsigned int rpi_shader[] = { + /* [0x000004b8] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 + /* [0x000004c0] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 + /* [0x000004c8] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop +-/* [0x000004d0] */ 0x533c0dc1, 0xd00243a0, // max ra14, ra15, 0 ; mul24 r0, r0, r1 +-/* [0x000004d8] */ 0x8f54e1f6, 0xd0024821, // asr r0, r0, 14 ; mov r1, ra21 +-/* [0x000004e0] */ 0x129d61c0, 0x100223e7, // min.setf ra15, r0, rb22 ++/* [0x000004d0] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 ++/* [0x000004d8] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop ++/* [0x000004e0] */ 0x009e7000, 0x100009e7, // nop ; nop + /* [0x000004e8] */ 0x4038e037, 0x100049e1, // nop ; mul24 r1, ra14, rb14 + /* [0x000004f0] */ 0x4034d037, 0x100049e0, // nop ; mul24 r0, ra13, rb13 + /* [0x000004f8] */ 0x4c30c237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb12 +@@ -189,400 +189,400 @@ unsigned int rpi_shader[] = { + /* [0x00000510] */ 0x4c249237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb9 + /* [0x00000518] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 + /* [0x00000520] */ 0x4c3cf237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb15 +-/* [0x00000528] */ 0x8c9f223f, 0x100a0867, // add.ifnn r1, r1, r0 ; mov -, vw_wait ++/* [0x00000528] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait + /* [0x00000530] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 +-/* [0x00000538] */ 0xfffffe50, 0xf06809e7, // brr.anyn -, r:uvloop +-/* [0x00000540] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 +-/* [0x00000548] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 +-/* [0x00000550] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 +-/* [0x00000558] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 +-/* [0x00000560] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 +-/* [0x00000568] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif +-/* [0x00000570] */ 0x00000010, 0xe0020827, // mov r0, 16 +-/* [0x00000578] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait +-/* [0x00000580] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 +-/* [0x00000588] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 +-/* [0x00000590] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 +-/* [0x00000598] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif ++/* [0x00000538] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 ++/* [0x00000540] */ 0x0c567380, 0x10020867, // add r1, r1, ra21 ++/* [0x00000548] */ 0xfffffe40, 0xf06809e7, // brr.anyn -, r:uvloop ++/* [0x00000550] */ 0x0f9c63c0, 0xd0020867, // asr r1, r1, 6 ++/* [0x00000558] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 ++/* [0x00000560] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 ++/* [0x00000568] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 ++/* [0x00000570] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 ++/* [0x00000578] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif ++/* [0x00000580] */ 0x00000010, 0xe0020827, // mov r0, 16 ++/* [0x00000588] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x00000590] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 ++/* [0x00000598] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 ++/* [0x000005a0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 ++/* [0x000005a8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif + // ::mc_filter +-/* [0x000005a0] */ 0x15827d80, 0x100207e7, // mov ra31, unif +-/* [0x000005a8] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next +-/* [0x000005b0] */ 0x156e7d80, 0x10020667, // mov ra_x2shift, ra_x2shift_next +-/* [0x000005b8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num +-/* [0x000005c0] */ 0x0c9c81c0, 0xd00208a7, // add r2, r0, 8 +-/* [0x000005c8] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif +-/* [0x000005d0] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3,unif +-/* [0x000005d8] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 +-/* [0x000005e0] */ 0x139c05c0, 0xd00208a7, // max r2, r2, 0 +-/* [0x000005e8] */ 0x129d95c0, 0x100208a7, // min r2, r2, rb_frame_width_minus_1 +-/* [0x000005f0] */ 0x119c35c0, 0xd00206e7, // shl ra_x2shift_next, r2, 3 +-/* [0x000005f8] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 +-/* [0x00000600] */ 0x0c9e74c0, 0x100208a7, // add r2, r2, r3 +-/* [0x00000608] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 +-/* [0x00000610] */ 0x149dc5c0, 0xd00206a7, // and ra_x2_base_next, r2, ~3 +-/* [0x00000618] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 +-/* [0x00000620] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 +-/* [0x00000628] */ 0x00000010, 0xe00208a7, // mov r2, 16 +-/* [0x00000630] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000638] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 +-/* [0x00000640] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 +-/* [0x00000648] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 +-/* [0x00000650] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 +-/* [0x00000658] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 +-/* [0x00000660] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 +-/* [0x00000668] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 +-/* [0x00000670] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 +-/* [0x00000678] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 +-/* [0x00000680] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 +-/* [0x00000688] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000690] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000698] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000006a0] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000006a8] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif +-/* [0x000006b0] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000006b8] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000006c0] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000006c8] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif +-/* [0x000006d0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000006d8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000006e0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000006e8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif +-/* [0x000006f0] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000006f8] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000700] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000708] */ 0x000001d0, 0xf07809e7, // brr.anynn -, r:fast_path +-/* [0x00000710] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 +-/* [0x00000718] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 +-/* [0x00000720] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-/* [0x00000728] */ 0x00000000, 0xe00208e7, // mov r3, 0 ++/* [0x000005b0] */ 0x15827d80, 0x100207e7, // mov ra31, unif ++/* [0x000005b8] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next ++/* [0x000005c0] */ 0x156e7d80, 0x10020667, // mov ra_x2shift, ra_x2shift_next ++/* [0x000005c8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num ++/* [0x000005d0] */ 0x0c9c81c0, 0xd00208a7, // add r2, r0, 8 ++/* [0x000005d8] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif ++/* [0x000005e0] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3,unif ++/* [0x000005e8] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 ++/* [0x000005f0] */ 0x139c05c0, 0xd00208a7, // max r2, r2, 0 ++/* [0x000005f8] */ 0x129d95c0, 0x100208a7, // min r2, r2, rb_frame_width_minus_1 ++/* [0x00000600] */ 0x119c35c0, 0xd00206e7, // shl ra_x2shift_next, r2, 3 ++/* [0x00000608] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 ++/* [0x00000610] */ 0x0c9e74c0, 0x100208a7, // add r2, r2, r3 ++/* [0x00000618] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 ++/* [0x00000620] */ 0x149dc5c0, 0xd00206a7, // and ra_x2_base_next, r2, ~3 ++/* [0x00000628] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 ++/* [0x00000630] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 ++/* [0x00000638] */ 0x00000010, 0xe00208a7, // mov r2, 16 ++/* [0x00000640] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000648] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 ++/* [0x00000650] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 ++/* [0x00000658] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 ++/* [0x00000660] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 ++/* [0x00000668] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 ++/* [0x00000670] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 ++/* [0x00000678] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 ++/* [0x00000680] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 ++/* [0x00000688] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 ++/* [0x00000690] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 ++/* [0x00000698] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x000006a0] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000006a8] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000006b0] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000006b8] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif ++/* [0x000006c0] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000006c8] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000006d0] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000006d8] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif ++/* [0x000006e0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000006e8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000006f0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000006f8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif ++/* [0x00000700] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000708] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000710] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000718] */ 0x000001d0, 0xf07809e7, // brr.anynn -, r:fast_path ++/* [0x00000720] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 ++/* [0x00000728] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 ++/* [0x00000730] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x00000738] */ 0x00000000, 0xe00208e7, // mov r3, 0 + // :loop +-/* [0x00000730] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 +-/* [0x00000738] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 +-/* [0x00000740] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 +-/* [0x00000748] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch +-/* [0x00000750] */ 0xee654987, 0x10024860, // shr r1, r4, ra_x2shift ; v8subs r0, r0, rb20 +-/* [0x00000758] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 +-/* [0x00000760] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 +-/* [0x00000768] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 +-/* [0x00000770] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 +-/* [0x00000778] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 +-/* [0x00000780] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-/* [0x00000788] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 +-/* [0x00000790] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 +-/* [0x00000798] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 +-/* [0x000007a0] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 +-/* [0x000007a8] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 +-/* [0x000007b0] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 +-/* [0x000007b8] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 +-/* [0x000007c0] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 +-/* [0x000007c8] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 +-/* [0x000007d0] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 +-/* [0x000007d8] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 +-/* [0x000007e0] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 +-/* [0x000007e8] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 +-/* [0x000007f0] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 +-/* [0x000007f8] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 +-/* [0x00000800] */ 0x0d9e74c0, 0x10020827, // sub r0, r2, r3 +-/* [0x00000808] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 +-/* [0x00000810] */ 0x15267d80, 0x10020227, // mov ra8, ra9 +-/* [0x00000818] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 +-/* [0x00000820] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 +-/* [0x00000828] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 +-/* [0x00000830] */ 0x15367d80, 0x10020327, // mov ra12, ra13 +-/* [0x00000838] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 +-/* [0x00000840] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 +-/* [0x00000848] */ 0xfffffec8, 0xf06809e7, // brr.anyn -, r:loop +-/* [0x00000850] */ 0x533c0dc1, 0xd00243a0, // max ra14, ra15, 0 ; mul24 r0, r0, r1 +-/* [0x00000858] */ 0x8f54f1f6, 0xd0024821, // asr r0, r0, 15 ; mov r1, ra21 +-/* [0x00000860] */ 0x129d61c0, 0x100223e7, // min.setf ra15, r0, rb22 +-/* [0x00000868] */ 0x4038e037, 0x100049e0, // nop ; mul24 r0, ra14, rb14 +-/* [0x00000870] */ 0x4d34d237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra13, rb13 +-/* [0x00000878] */ 0x4d30c237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra12, rb12 +-/* [0x00000880] */ 0x4d2cb237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra11, rb11 +-/* [0x00000888] */ 0x4d28a237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra10, rb10 +-/* [0x00000890] */ 0x4d249237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra9, rb9 +-/* [0x00000898] */ 0x4d208237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra8, rb8 +-/* [0x000008a0] */ 0x4d3cf237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra15, rb15 +-/* [0x000008a8] */ 0x8d9f223f, 0x100a0867, // sub.ifnn r1, r1, r0 ; mov -, vw_wait +-/* [0x000008b0] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 +-/* [0x000008b8] */ 0xfffffe58, 0xf06809e7, // brr.anyn -, r:loop +-/* [0x000008c0] */ 0x0f9cf3c0, 0xd0020867, // asr r1, r1, 15 +-/* [0x000008c8] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 +-/* [0x000008d0] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 +-/* [0x000008d8] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 +-/* [0x000008e0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 +-/* [0x000008e8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 +-/* [0x000008f0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif ++/* [0x00000740] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 ++/* [0x00000748] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 ++/* [0x00000750] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 ++/* [0x00000758] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch ++/* [0x00000760] */ 0xee654987, 0x10024860, // shr r1, r4, ra_x2shift ; v8subs r0, r0, rb20 ++/* [0x00000768] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 ++/* [0x00000770] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 ++/* [0x00000778] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 ++/* [0x00000780] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 ++/* [0x00000788] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 ++/* [0x00000790] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x00000798] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 ++/* [0x000007a0] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 ++/* [0x000007a8] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 ++/* [0x000007b0] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 ++/* [0x000007b8] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 ++/* [0x000007c0] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 ++/* [0x000007c8] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 ++/* [0x000007d0] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 ++/* [0x000007d8] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 ++/* [0x000007e0] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 ++/* [0x000007e8] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 ++/* [0x000007f0] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 ++/* [0x000007f8] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 ++/* [0x00000800] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 ++/* [0x00000808] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 ++/* [0x00000810] */ 0x0d9e74c0, 0x10020827, // sub r0, r2, r3 ++/* [0x00000818] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 ++/* [0x00000820] */ 0x15267d80, 0x10020227, // mov ra8, ra9 ++/* [0x00000828] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 ++/* [0x00000830] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 ++/* [0x00000838] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 ++/* [0x00000840] */ 0x15367d80, 0x10020327, // mov ra12, ra13 ++/* [0x00000848] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 ++/* [0x00000850] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 ++/* [0x00000858] */ 0xfffffec8, 0xf06809e7, // brr.anyn -, r:loop ++/* [0x00000860] */ 0x533c0dc1, 0xd00243a0, // max ra14, ra15, 0 ; mul24 r0, r0, r1 ++/* [0x00000868] */ 0x8f54f1f6, 0xd0024821, // asr r0, r0, 15 ; mov r1, ra21 ++/* [0x00000870] */ 0x129d61c0, 0x100223e7, // min.setf ra15, r0, rb22 ++/* [0x00000878] */ 0x4038e037, 0x100049e0, // nop ; mul24 r0, ra14, rb14 ++/* [0x00000880] */ 0x4d34d237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra13, rb13 ++/* [0x00000888] */ 0x4d30c237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra12, rb12 ++/* [0x00000890] */ 0x4d2cb237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra11, rb11 ++/* [0x00000898] */ 0x4d28a237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra10, rb10 ++/* [0x000008a0] */ 0x4d249237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra9, rb9 ++/* [0x000008a8] */ 0x4d208237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra8, rb8 ++/* [0x000008b0] */ 0x4d3cf237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra15, rb15 ++/* [0x000008b8] */ 0x8d9f223f, 0x100a0867, // sub.ifnn r1, r1, r0 ; mov -, vw_wait ++/* [0x000008c0] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 ++/* [0x000008c8] */ 0xfffffe58, 0xf06809e7, // brr.anyn -, r:loop ++/* [0x000008d0] */ 0x0f9cf3c0, 0xd0020867, // asr r1, r1, 15 ++/* [0x000008d8] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 ++/* [0x000008e0] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 ++/* [0x000008e8] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 ++/* [0x000008f0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 ++/* [0x000008f8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 ++/* [0x00000900] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif + // :fast_path +-/* [0x000008f8] */ 0x00000000, 0xe00208e7, // mov r3, 0 ++/* [0x00000908] */ 0x00000000, 0xe00208e7, // mov r3, 0 + // :fast_loop +-/* [0x00000900] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 +-/* [0x00000908] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 +-/* [0x00000910] */ 0x95727d9b, 0x1004475f, // mov.ifz ra_y, ra_y_next ; mov rb31, r3 +-/* [0x00000918] */ 0x95690dbf, 0x10044623, // mov.ifz ra_x2_base, ra_x2_base_next ; mov r3, rb_pitch +-/* [0x00000920] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 +-/* [0x00000928] */ 0x929de5e4, 0x100248a1, // min r2, r2, rb_frame_height_minus_1 ; mov r1, r4 +-/* [0x00000930] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 +-/* [0x00000938] */ 0xec414c87, 0x10024e20, // add t0s, ra_x_base, r2 ; v8subs r0, r0, rb20 +-/* [0x00000940] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 +-/* [0x00000948] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 +-/* [0x00000950] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 +-/* [0x00000958] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 +-/* [0x00000960] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 +-/* [0x00000968] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 +-/* [0x00000970] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 +-/* [0x00000978] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 +-/* [0x00000980] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 +-/* [0x00000988] */ 0x8d9df4ff, 0x10024823, // sub r0, r2, r3 ; mov r3, rb31 +-/* [0x00000990] */ 0x15267d80, 0x10020227, // mov ra8, ra9 +-/* [0x00000998] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 +-/* [0x000009a0] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 +-/* [0x000009a8] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 +-/* [0x000009b0] */ 0x15367d80, 0x10020327, // mov ra12, ra13 +-/* [0x000009b8] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 +-/* [0x000009c0] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 +-/* [0x000009c8] */ 0xffffff18, 0xf06809e7, // brr.anyn -, r:fast_loop +-/* [0x000009d0] */ 0x533c0dc1, 0xd00243a0, // max ra14, ra15, 0 ; mul24 r0, r0, r1 +-/* [0x000009d8] */ 0x8f54f1f6, 0xd0024821, // asr r0, r0, 15 ; mov r1, ra21 +-/* [0x000009e0] */ 0x129d61c0, 0x100223e7, // min.setf ra15, r0, rb22 +-/* [0x000009e8] */ 0x4038e037, 0x100049e0, // nop ; mul24 r0, ra14, rb14 +-/* [0x000009f0] */ 0x4d34d237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra13, rb13 +-/* [0x000009f8] */ 0x4d30c237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra12, rb12 +-/* [0x00000a00] */ 0x4d2cb237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra11, rb11 +-/* [0x00000a08] */ 0x4d28a237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra10, rb10 +-/* [0x00000a10] */ 0x4d249237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra9, rb9 +-/* [0x00000a18] */ 0x4d208237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra8, rb8 +-/* [0x00000a20] */ 0x4d3cf237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra15, rb15 +-/* [0x00000a28] */ 0x8d9f223f, 0x100a0867, // sub.ifnn r1, r1, r0 ; mov -, vw_wait +-/* [0x00000a30] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 +-/* [0x00000a38] */ 0xfffffea8, 0xf06809e7, // brr.anyn -, r:fast_loop +-/* [0x00000a40] */ 0x0f9cf3c0, 0xd0020867, // asr r1, r1, 15 +-/* [0x00000a48] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 +-/* [0x00000a50] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 +-/* [0x00000a58] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 +-/* [0x00000a60] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 +-/* [0x00000a68] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 +-/* [0x00000a70] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif ++/* [0x00000910] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 ++/* [0x00000918] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 ++/* [0x00000920] */ 0x95727d9b, 0x1004475f, // mov.ifz ra_y, ra_y_next ; mov rb31, r3 ++/* [0x00000928] */ 0x95690dbf, 0x10044623, // mov.ifz ra_x2_base, ra_x2_base_next ; mov r3, rb_pitch ++/* [0x00000930] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 ++/* [0x00000938] */ 0x929de5e4, 0x100248a1, // min r2, r2, rb_frame_height_minus_1 ; mov r1, r4 ++/* [0x00000940] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 ++/* [0x00000948] */ 0xec414c87, 0x10024e20, // add t0s, ra_x_base, r2 ; v8subs r0, r0, rb20 ++/* [0x00000950] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 ++/* [0x00000958] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 ++/* [0x00000960] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 ++/* [0x00000968] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 ++/* [0x00000970] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 ++/* [0x00000978] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 ++/* [0x00000980] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 ++/* [0x00000988] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 ++/* [0x00000990] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 ++/* [0x00000998] */ 0x8d9df4ff, 0x10024823, // sub r0, r2, r3 ; mov r3, rb31 ++/* [0x000009a0] */ 0x15267d80, 0x10020227, // mov ra8, ra9 ++/* [0x000009a8] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 ++/* [0x000009b0] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 ++/* [0x000009b8] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 ++/* [0x000009c0] */ 0x15367d80, 0x10020327, // mov ra12, ra13 ++/* [0x000009c8] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 ++/* [0x000009d0] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 ++/* [0x000009d8] */ 0xffffff18, 0xf06809e7, // brr.anyn -, r:fast_loop ++/* [0x000009e0] */ 0x533c0dc1, 0xd00243a0, // max ra14, ra15, 0 ; mul24 r0, r0, r1 ++/* [0x000009e8] */ 0x8f54f1f6, 0xd0024821, // asr r0, r0, 15 ; mov r1, ra21 ++/* [0x000009f0] */ 0x129d61c0, 0x100223e7, // min.setf ra15, r0, rb22 ++/* [0x000009f8] */ 0x4038e037, 0x100049e0, // nop ; mul24 r0, ra14, rb14 ++/* [0x00000a00] */ 0x4d34d237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra13, rb13 ++/* [0x00000a08] */ 0x4d30c237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra12, rb12 ++/* [0x00000a10] */ 0x4d2cb237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra11, rb11 ++/* [0x00000a18] */ 0x4d28a237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra10, rb10 ++/* [0x00000a20] */ 0x4d249237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra9, rb9 ++/* [0x00000a28] */ 0x4d208237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra8, rb8 ++/* [0x00000a30] */ 0x4d3cf237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra15, rb15 ++/* [0x00000a38] */ 0x8d9f223f, 0x100a0867, // sub.ifnn r1, r1, r0 ; mov -, vw_wait ++/* [0x00000a40] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 ++/* [0x00000a48] */ 0xfffffea8, 0xf06809e7, // brr.anyn -, r:fast_loop ++/* [0x00000a50] */ 0x0f9cf3c0, 0xd0020867, // asr r1, r1, 15 ++/* [0x00000a58] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 ++/* [0x00000a60] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 ++/* [0x00000a68] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 ++/* [0x00000a70] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 ++/* [0x00000a78] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 ++/* [0x00000a80] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif + // ::mc_filter_b +-/* [0x00000a78] */ 0x15827d80, 0x100207e7, // mov ra31, unif +-/* [0x00000a80] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next +-/* [0x00000a88] */ 0x156e7d80, 0x10020667, // mov ra_x2shift, ra_x2shift_next +-/* [0x00000a90] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num +-/* [0x00000a98] */ 0x0c9c81c0, 0xd00208a7, // add r2, r0, 8 +-/* [0x00000aa0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif +-/* [0x00000aa8] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3,unif +-/* [0x00000ab0] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 +-/* [0x00000ab8] */ 0x139c05c0, 0xd00208a7, // max r2, r2, 0 +-/* [0x00000ac0] */ 0x129d95c0, 0x100208a7, // min r2, r2, rb_frame_width_minus_1 +-/* [0x00000ac8] */ 0x119c35c0, 0xd00206e7, // shl ra_x2shift_next, r2, 3 +-/* [0x00000ad0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 +-/* [0x00000ad8] */ 0x0c9e74c0, 0x100208a7, // add r2, r2, r3 +-/* [0x00000ae0] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 +-/* [0x00000ae8] */ 0x149dc5c0, 0xd00206a7, // and ra_x2_base_next, r2, ~3 +-/* [0x00000af0] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 +-/* [0x00000af8] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 +-/* [0x00000b00] */ 0x00000010, 0xe00208a7, // mov r2, 16 +-/* [0x00000b08] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000b10] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 +-/* [0x00000b18] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 +-/* [0x00000b20] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 +-/* [0x00000b28] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 +-/* [0x00000b30] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 +-/* [0x00000b38] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 +-/* [0x00000b40] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 +-/* [0x00000b48] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 +-/* [0x00000b50] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 +-/* [0x00000b58] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 +-/* [0x00000b60] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 +-/* [0x00000b68] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 +-/* [0x00000b70] */ 0x0c9dc7c0, 0x10020c67, // add vr_setup, r3, rb28 +-/* [0x00000b78] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000b80] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000b88] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000b90] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000b98] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif +-/* [0x00000ba0] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000ba8] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000bb0] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000bb8] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif +-/* [0x00000bc0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000bc8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000bd0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000bd8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif +-/* [0x00000be0] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000be8] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000bf0] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000bf8] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 +-/* [0x00000c00] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 +-/* [0x00000c08] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-/* [0x00000c10] */ 0x00000000, 0xe00208e7, // mov r3, 0 ++/* [0x00000a88] */ 0x15827d80, 0x100207e7, // mov ra31, unif ++/* [0x00000a90] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next ++/* [0x00000a98] */ 0x156e7d80, 0x10020667, // mov ra_x2shift, ra_x2shift_next ++/* [0x00000aa0] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num ++/* [0x00000aa8] */ 0x0c9c81c0, 0xd00208a7, // add r2, r0, 8 ++/* [0x00000ab0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif ++/* [0x00000ab8] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3,unif ++/* [0x00000ac0] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 ++/* [0x00000ac8] */ 0x139c05c0, 0xd00208a7, // max r2, r2, 0 ++/* [0x00000ad0] */ 0x129d95c0, 0x100208a7, // min r2, r2, rb_frame_width_minus_1 ++/* [0x00000ad8] */ 0x119c35c0, 0xd00206e7, // shl ra_x2shift_next, r2, 3 ++/* [0x00000ae0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 ++/* [0x00000ae8] */ 0x0c9e74c0, 0x100208a7, // add r2, r2, r3 ++/* [0x00000af0] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 ++/* [0x00000af8] */ 0x149dc5c0, 0xd00206a7, // and ra_x2_base_next, r2, ~3 ++/* [0x00000b00] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 ++/* [0x00000b08] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 ++/* [0x00000b10] */ 0x00000010, 0xe00208a7, // mov r2, 16 ++/* [0x00000b18] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000b20] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 ++/* [0x00000b28] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 ++/* [0x00000b30] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 ++/* [0x00000b38] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 ++/* [0x00000b40] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 ++/* [0x00000b48] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 ++/* [0x00000b50] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 ++/* [0x00000b58] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 ++/* [0x00000b60] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 ++/* [0x00000b68] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 ++/* [0x00000b70] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 ++/* [0x00000b78] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 ++/* [0x00000b80] */ 0x0c9dc7c0, 0x10020c67, // add vr_setup, r3, rb28 ++/* [0x00000b88] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000b90] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000b98] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000ba0] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000ba8] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif ++/* [0x00000bb0] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000bb8] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000bc0] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000bc8] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif ++/* [0x00000bd0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000bd8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000be0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000be8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif ++/* [0x00000bf0] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000bf8] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000c00] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000c08] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 ++/* [0x00000c10] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 ++/* [0x00000c18] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x00000c20] */ 0x00000000, 0xe00208e7, // mov r3, 0 + // :bloop +-/* [0x00000c18] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 +-/* [0x00000c20] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 +-/* [0x00000c28] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 +-/* [0x00000c30] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch +-/* [0x00000c38] */ 0xee654987, 0x10024860, // shr r1, r4, ra_x2shift ; v8subs r0, r0, rb20 +-/* [0x00000c40] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 +-/* [0x00000c48] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 +-/* [0x00000c50] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 +-/* [0x00000c58] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 +-/* [0x00000c60] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 +-/* [0x00000c68] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-/* [0x00000c70] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 +-/* [0x00000c78] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 +-/* [0x00000c80] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 +-/* [0x00000c88] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 +-/* [0x00000c90] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 +-/* [0x00000c98] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 +-/* [0x00000ca0] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 +-/* [0x00000ca8] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 +-/* [0x00000cb0] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 +-/* [0x00000cb8] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 +-/* [0x00000cc0] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 +-/* [0x00000cc8] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 +-/* [0x00000cd0] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 +-/* [0x00000cd8] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 +-/* [0x00000ce0] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 +-/* [0x00000ce8] */ 0x0d9e74c0, 0x10020827, // sub r0, r2, r3 +-/* [0x00000cf0] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 +-/* [0x00000cf8] */ 0x15267d80, 0x10020227, // mov ra8, ra9 +-/* [0x00000d00] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 +-/* [0x00000d08] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 +-/* [0x00000d10] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 +-/* [0x00000d18] */ 0x15367d80, 0x10020327, // mov ra12, ra13 +-/* [0x00000d20] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 +-/* [0x00000d28] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 +-/* [0x00000d30] */ 0xfffffec8, 0xf06809e7, // brr.anyn -, r:bloop +-/* [0x00000d38] */ 0x533c0dc1, 0xd00243a0, // max ra14, ra15, 0 ; mul24 r0, r0, r1 +-/* [0x00000d40] */ 0x8f54f1f6, 0xd0024821, // asr r0, r0, 15 ; mov r1, ra21 +-/* [0x00000d48] */ 0x129d61c0, 0x100223e7, // min.setf ra15, r0, rb22 +-/* [0x00000d50] */ 0x4038e037, 0x100049e0, // nop ; mul24 r0, ra14, rb14 +-/* [0x00000d58] */ 0x4d34d237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra13, rb13 +-/* [0x00000d60] */ 0x4d30c237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra12, rb12 +-/* [0x00000d68] */ 0x4d2cb237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra11, rb11 +-/* [0x00000d70] */ 0x4d28a237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra10, rb10 +-/* [0x00000d78] */ 0x4d249237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra9, rb9 +-/* [0x00000d80] */ 0x4d208237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra8, rb8 +-/* [0x00000d88] */ 0x4d3cf237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra15, rb15 +-/* [0x00000d90] */ 0x8d9f223f, 0x100a0867, // sub.ifnn r1, r1, r0 ; mov -, vw_wait +-/* [0x00000d98] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 +-/* [0x00000da0] */ 0x8fc8f3f6, 0xd0020867, // asr r1, r1, 15 ; mov -, vr_wait +-/* [0x00000da8] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 +-/* [0x00000db0] */ 0x0cc01dc0, 0xd0020827, // add r0, vpm, 1 +-/* [0x00000db8] */ 0xfffffe40, 0xf06809e7, // brr.anyn -, r:bloop +-/* [0x00000dc0] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 +-/* [0x00000dc8] */ 0x0c9e7200, 0x10020867, // add r1, r1, r0 +-/* [0x00000dd0] */ 0x0e9c13c0, 0xd0020c27, // shr vpm, r1, 1 +-/* [0x00000dd8] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 +-/* [0x00000de0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 +-/* [0x00000de8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 +-/* [0x00000df0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif ++/* [0x00000c28] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 ++/* [0x00000c30] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 ++/* [0x00000c38] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 ++/* [0x00000c40] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch ++/* [0x00000c48] */ 0xee654987, 0x10024860, // shr r1, r4, ra_x2shift ; v8subs r0, r0, rb20 ++/* [0x00000c50] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 ++/* [0x00000c58] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 ++/* [0x00000c60] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 ++/* [0x00000c68] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 ++/* [0x00000c70] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 ++/* [0x00000c78] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x00000c80] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 ++/* [0x00000c88] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 ++/* [0x00000c90] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 ++/* [0x00000c98] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 ++/* [0x00000ca0] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 ++/* [0x00000ca8] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 ++/* [0x00000cb0] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 ++/* [0x00000cb8] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 ++/* [0x00000cc0] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 ++/* [0x00000cc8] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 ++/* [0x00000cd0] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 ++/* [0x00000cd8] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 ++/* [0x00000ce0] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 ++/* [0x00000ce8] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 ++/* [0x00000cf0] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 ++/* [0x00000cf8] */ 0x0d9e74c0, 0x10020827, // sub r0, r2, r3 ++/* [0x00000d00] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 ++/* [0x00000d08] */ 0x15267d80, 0x10020227, // mov ra8, ra9 ++/* [0x00000d10] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 ++/* [0x00000d18] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 ++/* [0x00000d20] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 ++/* [0x00000d28] */ 0x15367d80, 0x10020327, // mov ra12, ra13 ++/* [0x00000d30] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 ++/* [0x00000d38] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 ++/* [0x00000d40] */ 0xfffffec8, 0xf06809e7, // brr.anyn -, r:bloop ++/* [0x00000d48] */ 0x533c0dc1, 0xd00243a0, // max ra14, ra15, 0 ; mul24 r0, r0, r1 ++/* [0x00000d50] */ 0x8f54f1f6, 0xd0024821, // asr r0, r0, 15 ; mov r1, ra21 ++/* [0x00000d58] */ 0x129d61c0, 0x100223e7, // min.setf ra15, r0, rb22 ++/* [0x00000d60] */ 0x4038e037, 0x100049e0, // nop ; mul24 r0, ra14, rb14 ++/* [0x00000d68] */ 0x4d34d237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra13, rb13 ++/* [0x00000d70] */ 0x4d30c237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra12, rb12 ++/* [0x00000d78] */ 0x4d2cb237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra11, rb11 ++/* [0x00000d80] */ 0x4d28a237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra10, rb10 ++/* [0x00000d88] */ 0x4d249237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra9, rb9 ++/* [0x00000d90] */ 0x4d208237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra8, rb8 ++/* [0x00000d98] */ 0x4d3cf237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra15, rb15 ++/* [0x00000da0] */ 0x8d9f223f, 0x100a0867, // sub.ifnn r1, r1, r0 ; mov -, vw_wait ++/* [0x00000da8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 ++/* [0x00000db0] */ 0x8fc8f3f6, 0xd0020867, // asr r1, r1, 15 ; mov -, vr_wait ++/* [0x00000db8] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 ++/* [0x00000dc0] */ 0x0cc01dc0, 0xd0020827, // add r0, vpm, 1 ++/* [0x00000dc8] */ 0xfffffe40, 0xf06809e7, // brr.anyn -, r:bloop ++/* [0x00000dd0] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 ++/* [0x00000dd8] */ 0x0c9e7200, 0x10020867, // add r1, r1, r0 ++/* [0x00000de0] */ 0x0e9c13c0, 0xd0020c27, // shr vpm, r1, 1 ++/* [0x00000de8] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 ++/* [0x00000df0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 ++/* [0x00000df8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 ++/* [0x00000e00] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif + // ::mc_filter_honly +-/* [0x00000df8] */ 0x15827d80, 0x100207e7, // mov ra31, unif +-/* [0x00000e00] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next +-/* [0x00000e08] */ 0x156e7d80, 0x10020667, // mov ra_x2shift, ra_x2shift_next +-/* [0x00000e10] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num +-/* [0x00000e18] */ 0x0c9c81c0, 0xd00208a7, // add r2, r0, 8 +-/* [0x00000e20] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif +-/* [0x00000e28] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3,unif +-/* [0x00000e30] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 +-/* [0x00000e38] */ 0x139c05c0, 0xd00208a7, // max r2, r2, 0 +-/* [0x00000e40] */ 0x129d95c0, 0x100208a7, // min r2, r2, rb_frame_width_minus_1 +-/* [0x00000e48] */ 0x119c35c0, 0xd00206e7, // shl ra_x2shift_next, r2, 3 +-/* [0x00000e50] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 +-/* [0x00000e58] */ 0x0c9e74c0, 0x100208a7, // add r2, r2, r3 +-/* [0x00000e60] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 +-/* [0x00000e68] */ 0x149dc5c0, 0xd00206a7, // and ra_x2_base_next, r2, ~3 +-/* [0x00000e70] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 +-/* [0x00000e78] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 +-/* [0x00000e80] */ 0x00000010, 0xe00208a7, // mov r2, 16 +-/* [0x00000e88] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000e90] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 +-/* [0x00000e98] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 +-/* [0x00000ea0] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 +-/* [0x00000ea8] */ 0x0c9de1c0, 0xd0021467, // add rb17, r0, -2 +-/* [0x00000eb0] */ 0x919c71c0, 0xd0024812, // shl r0, r0, 7 ; mov rb18,r0 +-/* [0x00000eb8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 +-/* [0x00000ec0] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 +-/* [0x00000ec8] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 +-/* [0x00000ed0] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000ed8] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000ee0] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000ee8] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000ef0] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif +-/* [0x00000ef8] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000f00] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000f08] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000f10] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif +-/* [0x00000f18] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000f20] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 +-/* [0x00000f28] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-/* [0x00000f30] */ 0x00000000, 0xe00208e7, // mov r3, 0 ++/* [0x00000e08] */ 0x15827d80, 0x100207e7, // mov ra31, unif ++/* [0x00000e10] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next ++/* [0x00000e18] */ 0x156e7d80, 0x10020667, // mov ra_x2shift, ra_x2shift_next ++/* [0x00000e20] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num ++/* [0x00000e28] */ 0x0c9c81c0, 0xd00208a7, // add r2, r0, 8 ++/* [0x00000e30] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif ++/* [0x00000e38] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3,unif ++/* [0x00000e40] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 ++/* [0x00000e48] */ 0x139c05c0, 0xd00208a7, // max r2, r2, 0 ++/* [0x00000e50] */ 0x129d95c0, 0x100208a7, // min r2, r2, rb_frame_width_minus_1 ++/* [0x00000e58] */ 0x119c35c0, 0xd00206e7, // shl ra_x2shift_next, r2, 3 ++/* [0x00000e60] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 ++/* [0x00000e68] */ 0x0c9e74c0, 0x100208a7, // add r2, r2, r3 ++/* [0x00000e70] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 ++/* [0x00000e78] */ 0x149dc5c0, 0xd00206a7, // and ra_x2_base_next, r2, ~3 ++/* [0x00000e80] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 ++/* [0x00000e88] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 ++/* [0x00000e90] */ 0x00000010, 0xe00208a7, // mov r2, 16 ++/* [0x00000e98] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000ea0] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 ++/* [0x00000ea8] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 ++/* [0x00000eb0] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 ++/* [0x00000eb8] */ 0x0c9de1c0, 0xd0021467, // add rb17, r0, -2 ++/* [0x00000ec0] */ 0x919c71c0, 0xd0024812, // shl r0, r0, 7 ; mov rb18,r0 ++/* [0x00000ec8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 ++/* [0x00000ed0] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 ++/* [0x00000ed8] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 ++/* [0x00000ee0] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000ee8] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000ef0] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000ef8] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000f00] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif ++/* [0x00000f08] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000f10] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000f18] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000f20] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif ++/* [0x00000f28] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000f30] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 ++/* [0x00000f38] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x00000f40] */ 0x00000000, 0xe00208e7, // mov r3, 0 + // :loop_honly +-/* [0x00000f38] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 +-/* [0x00000f40] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 +-/* [0x00000f48] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 +-/* [0x00000f50] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch +-/* [0x00000f58] */ 0xee654987, 0x10024860, // shr r1, r4, ra_x2shift ; v8subs r0, r0, rb20 +-/* [0x00000f60] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 +-/* [0x00000f68] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 +-/* [0x00000f70] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 +-/* [0x00000f78] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 +-/* [0x00000f80] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 +-/* [0x00000f88] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-/* [0x00000f90] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 +-/* [0x00000f98] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 +-/* [0x00000fa0] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 +-/* [0x00000fa8] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 +-/* [0x00000fb0] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 +-/* [0x00000fb8] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 +-/* [0x00000fc0] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 +-/* [0x00000fc8] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 +-/* [0x00000fd0] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 +-/* [0x00000fd8] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 +-/* [0x00000fe0] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 +-/* [0x00000fe8] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 +-/* [0x00000ff0] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 +-/* [0x00000ff8] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 +-/* [0x00001000] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 +-/* [0x00001008] */ 0x8d9df4ff, 0x10024823, // sub r0, r2, r3 ; mov r3, rb31 +-/* [0x00001010] */ 0x8d5927f6, 0x100269e1, // sub.setf -, r3, rb18 ; mov r1, ra22 +-/* [0x00001018] */ 0x559f2fc1, 0x100049e0, // mov -, vw_wait ; mul24 r0, r0, r1 +-/* [0x00001020] */ 0xfffffef8, 0xf06809e7, // brr.anyn -, r:loop_honly +-/* [0x00001028] */ 0x0f9cf1c0, 0xd0020827, // asr r0, r0, 15 +-/* [0x00001030] */ 0x129d61c0, 0x10020827, // min r0, r0, rb22 +-/* [0x00001038] */ 0x139c01c0, 0xd0020c27, // max vpm, r0, 0 +-/* [0x00001040] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 +-/* [0x00001048] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 +-/* [0x00001050] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 +-/* [0x00001058] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif ++/* [0x00000f48] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 ++/* [0x00000f50] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 ++/* [0x00000f58] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 ++/* [0x00000f60] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch ++/* [0x00000f68] */ 0xee654987, 0x10024860, // shr r1, r4, ra_x2shift ; v8subs r0, r0, rb20 ++/* [0x00000f70] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 ++/* [0x00000f78] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 ++/* [0x00000f80] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 ++/* [0x00000f88] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 ++/* [0x00000f90] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 ++/* [0x00000f98] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x00000fa0] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 ++/* [0x00000fa8] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 ++/* [0x00000fb0] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 ++/* [0x00000fb8] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 ++/* [0x00000fc0] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 ++/* [0x00000fc8] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 ++/* [0x00000fd0] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 ++/* [0x00000fd8] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 ++/* [0x00000fe0] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 ++/* [0x00000fe8] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 ++/* [0x00000ff0] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 ++/* [0x00000ff8] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 ++/* [0x00001000] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 ++/* [0x00001008] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 ++/* [0x00001010] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 ++/* [0x00001018] */ 0x8d9df4ff, 0x10024823, // sub r0, r2, r3 ; mov r3, rb31 ++/* [0x00001020] */ 0x8d5927f6, 0x100269e1, // sub.setf -, r3, rb18 ; mov r1, ra22 ++/* [0x00001028] */ 0x559f2fc1, 0x100049e0, // mov -, vw_wait ; mul24 r0, r0, r1 ++/* [0x00001030] */ 0xfffffef8, 0xf06809e7, // brr.anyn -, r:loop_honly ++/* [0x00001038] */ 0x0f9cf1c0, 0xd0020827, // asr r0, r0, 15 ++/* [0x00001040] */ 0x129d61c0, 0x10020827, // min r0, r0, rb22 ++/* [0x00001048] */ 0x139c01c0, 0xd0020c27, // max vpm, r0, 0 ++/* [0x00001050] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 ++/* [0x00001058] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 ++/* [0x00001060] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 ++/* [0x00001068] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif + // ::mc_exit +-/* [0x00001060] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait +-/* [0x00001068] */ 0x00000000, 0xe80009e7, // mov -,srel(0) +-/* [0x00001070] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00001078] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00001070] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x00001078] */ 0x00000000, 0xe80009e7, // mov -,srel(0) + /* [0x00001080] */ 0x009e7000, 0xa00009e7, // ldtmu0 + /* [0x00001088] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00001090] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend +-/* [0x00001098] */ 0x009e7000, 0x100009e7, // nop ; nop +-/* [0x000010a0] */ 0x009e7000, 0x100009e7, // nop ; nop ++/* [0x00001090] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00001098] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x000010a0] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend ++/* [0x000010a8] */ 0x009e7000, 0x100009e7, // nop ; nop ++/* [0x000010b0] */ 0x009e7000, 0x100009e7, // nop ; nop + // ::mc_exit1 +-/* [0x000010a8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait +-/* [0x000010b0] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x000010b8] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x000010b8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait + /* [0x000010c0] */ 0x009e7000, 0xa00009e7, // ldtmu0 + /* [0x000010c8] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x000010d0] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend +-/* [0x000010d8] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop +-/* [0x000010e0] */ 0x009e7000, 0x100009e7, // nop ; nop ++/* [0x000010d0] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x000010d8] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x000010e0] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend ++/* [0x000010e8] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop ++/* [0x000010f0] */ 0x009e7000, 0x100009e7, // nop ; nop + // ::mc_interrupt_exit +-/* [0x000010e8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait +-/* [0x000010f0] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x000010f8] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x000010f8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait + /* [0x00001100] */ 0x009e7000, 0xa00009e7, // ldtmu0 + /* [0x00001108] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00001110] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00001118] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00001110] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00001118] */ 0x009e7000, 0xa00009e7, // ldtmu0 + /* [0x00001120] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) + /* [0x00001128] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) + /* [0x00001130] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +@@ -592,225 +592,227 @@ unsigned int rpi_shader[] = { + /* [0x00001150] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) + /* [0x00001158] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) + /* [0x00001160] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00001168] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend +-/* [0x00001170] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop +-/* [0x00001178] */ 0x009e7000, 0x100009e7, // nop ; nop ++/* [0x00001168] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00001170] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00001178] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend ++/* [0x00001180] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop ++/* [0x00001188] */ 0x009e7000, 0x100009e7, // nop ; nop + // ::mc_interrupt_exit4 +-/* [0x00001180] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait +-/* [0x00001188] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00001190] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00001190] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait + /* [0x00001198] */ 0x009e7000, 0xa00009e7, // ldtmu0 + /* [0x000011a0] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x000011a8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x000011b0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x000011a8] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x000011b0] */ 0x009e7000, 0xa00009e7, // ldtmu0 + /* [0x000011b8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x000011c0] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend +-/* [0x000011c8] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop +-/* [0x000011d0] */ 0x009e7000, 0x100009e7, // nop ; nop ++/* [0x000011c0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x000011c8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x000011d0] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend ++/* [0x000011d8] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop ++/* [0x000011e0] */ 0x009e7000, 0x100009e7, // nop ; nop + // ::mc_interrupt_exit8 +-/* [0x000011d8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait +-/* [0x000011e0] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x000011e8] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x000011e8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait + /* [0x000011f0] */ 0x009e7000, 0xa00009e7, // ldtmu0 + /* [0x000011f8] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00001200] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00001208] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00001200] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00001208] */ 0x009e7000, 0xa00009e7, // ldtmu0 + /* [0x00001210] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) + /* [0x00001218] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) + /* [0x00001220] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) + /* [0x00001228] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) + /* [0x00001230] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00001238] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend +-/* [0x00001240] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop +-/* [0x00001248] */ 0x009e7000, 0x100009e7, // nop ; nop ++/* [0x00001238] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00001240] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00001248] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend ++/* [0x00001250] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop ++/* [0x00001258] */ 0x009e7000, 0x100009e7, // nop ; nop + // ::mc_setup_uv +-/* [0x00001250] */ 0x15827d80, 0x100207e7, // mov ra31, unif +-/* [0x00001258] */ 0x0c9a0f80, 0x10020427, // add ra_x_base, unif, elem_num +-/* [0x00001260] */ 0x15827d80, 0x10020767, // mov ra_y, unif +-/* [0x00001268] */ 0x15827d80, 0x10020627, // mov ra_x2_base, unif +-/* [0x00001270] */ 0x009e7000, 0x100009e7, // nop +-/* [0x00001278] */ 0x0d620f80, 0x10020667, // sub ra_u2v_ref_offset, unif, ra_x2_base +-/* [0x00001280] */ 0x0d801dc0, 0xd0021667, // sub rb25,unif,1 +-/* [0x00001288] */ 0x0d801dc0, 0xd00217a7, // sub rb30,unif,1 +-/* [0x00001290] */ 0x15827d80, 0x10021427, // mov rb16, unif +-/* [0x00001298] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x000012a0] */ 0xc0000000, 0xe0020867, // mov r1, vdw_setup_1(0) +-/* [0x000012a8] */ 0x0c9e7200, 0x10021627, // add rb24, r1, r0 +-/* [0x000012b0] */ 0x00000001, 0xe0020527, // mov ra20, 1 +-/* [0x000012b8] */ 0x00000040, 0xe0020567, // mov ra21, 64 +-/* [0x000012c0] */ 0x00000100, 0xe00205a7, // mov ra22, 256 +-/* [0x000012c8] */ 0x00000008, 0xe00205e7, // mov ra23, 8 +-/* [0x000012d0] */ 0xffffff00, 0xe0021527, // mov rb20, 0xffffff00 +-/* [0x000012d8] */ 0x00000040, 0xe0021567, // mov rb21, 64 +-/* [0x000012e0] */ 0x000000ff, 0xe00215a7, // mov rb22, 255 +-/* [0x000012e8] */ 0x00000018, 0xe00215e7, // mov rb23, 24 +-/* [0x000012f0] */ 0x00000000, 0xe0020227, // mov ra8, 0 +-/* [0x000012f8] */ 0x00000000, 0xe0020267, // mov ra9, 0 +-/* [0x00001300] */ 0x00000000, 0xe00202a7, // mov ra10, 0 +-/* [0x00001308] */ 0x00000000, 0xe00202e7, // mov ra11, 0 +-/* [0x00001310] */ 0x00000000, 0xe0020327, // mov ra12, 0 +-/* [0x00001318] */ 0x00000000, 0xe0020367, // mov ra13, 0 +-/* [0x00001320] */ 0x00000000, 0xe00203a7, // mov ra14, 0 +-/* [0x00001328] */ 0x00000000, 0xe00203e7, // mov ra15, 0 +-/* [0x00001330] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num +-/* [0x00001338] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 +-/* [0x00001340] */ 0x159e7480, 0x10020867, // mov r1, r2 +-/* [0x00001348] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 +-/* [0x00001350] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 +-/* [0x00001358] */ 0x159e7480, 0x10020827, // mov r0, r2 +-/* [0x00001360] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 +-/* [0x00001368] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 +-/* [0x00001370] */ 0x80004004, 0xe0020867, // mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) +-/* [0x00001378] */ 0x119c51c0, 0xd0020827, // shl r0, r0, 5 +-/* [0x00001380] */ 0x0c9e7040, 0x100216e7, // add rb27, r0, r1 +-/* [0x00001388] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num +-/* [0x00001390] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 +-/* [0x00001398] */ 0x159e7480, 0x10020867, // mov r1, r2 +-/* [0x000013a0] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 +-/* [0x000013a8] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 +-/* [0x000013b0] */ 0x159e7480, 0x10020827, // mov r0, r2 +-/* [0x000013b8] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 +-/* [0x000013c0] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 +-/* [0x000013c8] */ 0x00004800, 0xe0020867, // mov r1, vpm_setup(0, 4, h8p(0, 0)) +-/* [0x000013d0] */ 0x0c9e7040, 0x10021727, // add rb28, r0, r1 +-/* [0x000013d8] */ 0x15427d80, 0x10020827, // mov r0, ra_x_base +-/* [0x000013e0] */ 0x937401f6, 0xd0024821, // max r0, r0, 0; mov r1, ra_y +-/* [0x000013e8] */ 0x926191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, ra_x2_base +-/* [0x000013f0] */ 0x916431f6, 0xd00244e2, // shl ra_xshift_next, r0, 3 ; mov r2, ra_u2v_ref_offset +-/* [0x000013f8] */ 0x0c9c13c0, 0xd0020767, // add ra_y, r1, 1 +-/* [0x00001400] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 +-/* [0x00001408] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 +-/* [0x00001410] */ 0x939c03c0, 0xd0025850, // max r1, r1, 0 ; mov ra_x_base, r0 +-/* [0x00001418] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 +-/* [0x00001420] */ 0x4c9d040f, 0x100248a1, // add r2, r2, r0 ; mul24 r1, r1, rb_pitch +-/* [0x00001428] */ 0x8c9e7052, 0x10025e18, // add t0s, r0, r1 ; mov ra_x2_base, r2 +-/* [0x00001430] */ 0x0c9e7440, 0x10020e27, // add t0s, r2, r1 +-/* [0x00001438] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00001440] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00001260] */ 0x15827d80, 0x100207e7, // mov ra31, unif ++/* [0x00001268] */ 0x0c9a0f80, 0x10020427, // add ra_x_base, unif, elem_num ++/* [0x00001270] */ 0x15827d80, 0x10020767, // mov ra_y, unif ++/* [0x00001278] */ 0x15827d80, 0x10020627, // mov ra_x2_base, unif ++/* [0x00001280] */ 0x009e7000, 0x100009e7, // nop ++/* [0x00001288] */ 0x0d620f80, 0x10020667, // sub ra_u2v_ref_offset, unif, ra_x2_base ++/* [0x00001290] */ 0x0d801dc0, 0xd0021667, // sub rb25,unif,1 ++/* [0x00001298] */ 0x0d801dc0, 0xd00217a7, // sub rb30,unif,1 ++/* [0x000012a0] */ 0x15827d80, 0x10021427, // mov rb16, unif ++/* [0x000012a8] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x000012b0] */ 0xc0000000, 0xe0020867, // mov r1, vdw_setup_1(0) ++/* [0x000012b8] */ 0x0c9e7200, 0x10021627, // add rb24, r1, r0 ++/* [0x000012c0] */ 0x00000001, 0xe0020527, // mov ra20, 1 ++/* [0x000012c8] */ 0x00000020, 0xe0020567, // mov ra21, 32 ++/* [0x000012d0] */ 0x00000100, 0xe00205a7, // mov ra22, 256 ++/* [0x000012d8] */ 0x00000008, 0xe00205e7, // mov ra23, 8 ++/* [0x000012e0] */ 0xffffff00, 0xe0021527, // mov rb20, 0xffffff00 ++/* [0x000012e8] */ 0x00000040, 0xe0021567, // mov rb21, 64 ++/* [0x000012f0] */ 0x000000ff, 0xe00215a7, // mov rb22, 255 ++/* [0x000012f8] */ 0x00000018, 0xe00215e7, // mov rb23, 24 ++/* [0x00001300] */ 0x00000000, 0xe0020227, // mov ra8, 0 ++/* [0x00001308] */ 0x00000000, 0xe0020267, // mov ra9, 0 ++/* [0x00001310] */ 0x00000000, 0xe00202a7, // mov ra10, 0 ++/* [0x00001318] */ 0x00000000, 0xe00202e7, // mov ra11, 0 ++/* [0x00001320] */ 0x00000000, 0xe0020327, // mov ra12, 0 ++/* [0x00001328] */ 0x00000000, 0xe0020367, // mov ra13, 0 ++/* [0x00001330] */ 0x00000000, 0xe00203a7, // mov ra14, 0 ++/* [0x00001338] */ 0x00000000, 0xe00203e7, // mov ra15, 0 ++/* [0x00001340] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num ++/* [0x00001348] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 ++/* [0x00001350] */ 0x159e7480, 0x10020867, // mov r1, r2 ++/* [0x00001358] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 ++/* [0x00001360] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 ++/* [0x00001368] */ 0x159e7480, 0x10020827, // mov r0, r2 ++/* [0x00001370] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 ++/* [0x00001378] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 ++/* [0x00001380] */ 0x80004004, 0xe0020867, // mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) ++/* [0x00001388] */ 0x119c51c0, 0xd0020827, // shl r0, r0, 5 ++/* [0x00001390] */ 0x0c9e7040, 0x100216e7, // add rb27, r0, r1 ++/* [0x00001398] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num ++/* [0x000013a0] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 ++/* [0x000013a8] */ 0x159e7480, 0x10020867, // mov r1, r2 ++/* [0x000013b0] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 ++/* [0x000013b8] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 ++/* [0x000013c0] */ 0x159e7480, 0x10020827, // mov r0, r2 ++/* [0x000013c8] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 ++/* [0x000013d0] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 ++/* [0x000013d8] */ 0x00004800, 0xe0020867, // mov r1, vpm_setup(0, 4, h8p(0, 0)) ++/* [0x000013e0] */ 0x0c9e7040, 0x10021727, // add rb28, r0, r1 ++/* [0x000013e8] */ 0x15427d80, 0x10020827, // mov r0, ra_x_base ++/* [0x000013f0] */ 0x937401f6, 0xd0024821, // max r0, r0, 0; mov r1, ra_y ++/* [0x000013f8] */ 0x926191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, ra_x2_base ++/* [0x00001400] */ 0x916431f6, 0xd00244e2, // shl ra_xshift_next, r0, 3 ; mov r2, ra_u2v_ref_offset ++/* [0x00001408] */ 0x0c9c13c0, 0xd0020767, // add ra_y, r1, 1 ++/* [0x00001410] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 ++/* [0x00001418] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 ++/* [0x00001420] */ 0x939c03c0, 0xd0025850, // max r1, r1, 0 ; mov ra_x_base, r0 ++/* [0x00001428] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 ++/* [0x00001430] */ 0x4c9d040f, 0x100248a1, // add r2, r2, r0 ; mul24 r1, r1, rb_pitch ++/* [0x00001438] */ 0x8c9e7052, 0x10025e18, // add t0s, r0, r1 ; mov ra_x2_base, r2 ++/* [0x00001440] */ 0x0c9e7440, 0x10020e27, // add t0s, r2, r1 + /* [0x00001448] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00001450] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 +-/* [0x00001458] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 +-/* [0x00001460] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 +-/* [0x00001468] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 +-/* [0x00001470] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch +-/* [0x00001478] */ 0x0c427380, 0x10020e27, // add t0s, r1, ra_x_base +-/* [0x00001480] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_x2_base ++/* [0x00001450] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00001458] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00001460] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 ++/* [0x00001468] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 ++/* [0x00001470] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 ++/* [0x00001478] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 ++/* [0x00001480] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch ++/* [0x00001488] */ 0x0c427380, 0x10020e27, // add t0s, r1, ra_x_base ++/* [0x00001490] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_x2_base + // ::mc_filter_uv_b +-/* [0x00001488] */ 0x15827d80, 0x100207e7, // mov ra31, unif +-/* [0x00001490] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next +-/* [0x00001498] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num +-/* [0x000014a0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif +-/* [0x000014a8] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif +-/* [0x000014b0] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 +-/* [0x000014b8] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 +-/* [0x000014c0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 +-/* [0x000014c8] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 +-/* [0x000014d0] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 +-/* [0x000014d8] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 +-/* [0x000014e0] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 +-/* [0x000014e8] */ 0x00000010, 0xe00208a7, // mov r2, 16 +-/* [0x000014f0] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x000014f8] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 +-/* [0x00001500] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 +-/* [0x00001508] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 +-/* [0x00001510] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 +-/* [0x00001518] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 +-/* [0x00001520] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 +-/* [0x00001528] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 +-/* [0x00001530] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 +-/* [0x00001538] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 +-/* [0x00001540] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 +-/* [0x00001548] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 +-/* [0x00001550] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 +-/* [0x00001558] */ 0x0c9dc7c0, 0x10020c67, // add vr_setup, r3, rb28 +-/* [0x00001560] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 +-/* [0x00001568] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00001570] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00001578] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00001580] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00001588] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif +-/* [0x00001590] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00001598] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000015a0] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000015a8] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif +-/* [0x000015b0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000015b8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000015c0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000015c8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif +-/* [0x000015d0] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000015d8] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000015e0] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000015e8] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 +-/* [0x000015f0] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 +-/* [0x000015f8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-/* [0x00001600] */ 0x00000000, 0xe00208e7, // mov r3, 0 ++/* [0x00001498] */ 0x15827d80, 0x100207e7, // mov ra31, unif ++/* [0x000014a0] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next ++/* [0x000014a8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num ++/* [0x000014b0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif ++/* [0x000014b8] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif ++/* [0x000014c0] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 ++/* [0x000014c8] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 ++/* [0x000014d0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 ++/* [0x000014d8] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 ++/* [0x000014e0] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 ++/* [0x000014e8] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 ++/* [0x000014f0] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 ++/* [0x000014f8] */ 0x00000010, 0xe00208a7, // mov r2, 16 ++/* [0x00001500] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00001508] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 ++/* [0x00001510] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 ++/* [0x00001518] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 ++/* [0x00001520] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 ++/* [0x00001528] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 ++/* [0x00001530] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 ++/* [0x00001538] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 ++/* [0x00001540] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 ++/* [0x00001548] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 ++/* [0x00001550] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 ++/* [0x00001558] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 ++/* [0x00001560] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 ++/* [0x00001568] */ 0x0c9dc7c0, 0x10020c67, // add vr_setup, r3, rb28 ++/* [0x00001570] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 ++/* [0x00001578] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00001580] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00001588] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00001590] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00001598] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif ++/* [0x000015a0] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000015a8] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000015b0] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000015b8] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif ++/* [0x000015c0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000015c8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000015d0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000015d8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif ++/* [0x000015e0] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000015e8] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000015f0] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000015f8] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 ++/* [0x00001600] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 ++/* [0x00001608] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x00001610] */ 0x00000000, 0xe00208e7, // mov r3, 0 + // :uvloop_b +-/* [0x00001608] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 +-/* [0x00001610] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 +-/* [0x00001618] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 +-/* [0x00001620] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch +-/* [0x00001628] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 +-/* [0x00001630] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 +-/* [0x00001638] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 +-/* [0x00001640] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 +-/* [0x00001648] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 +-/* [0x00001650] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 +-/* [0x00001658] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-/* [0x00001660] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 +-/* [0x00001668] */ 0x40038031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra0 << 8, r1 << 8 +-/* [0x00001670] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 +-/* [0x00001678] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 +-/* [0x00001680] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 +-/* [0x00001688] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 +-/* [0x00001690] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 +-/* [0x00001698] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 +-/* [0x000016a0] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 +-/* [0x000016a8] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 +-/* [0x000016b0] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 +-/* [0x000016b8] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 +-/* [0x000016c0] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 +-/* [0x000016c8] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 +-/* [0x000016d0] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 +-/* [0x000016d8] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 +-/* [0x000016e0] */ 0x0d9e74c0, 0x10020827, // sub r0, r2, r3 +-/* [0x000016e8] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 +-/* [0x000016f0] */ 0x15267d80, 0x10020227, // mov ra8, ra9 +-/* [0x000016f8] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 +-/* [0x00001700] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 +-/* [0x00001708] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 +-/* [0x00001710] */ 0x15367d80, 0x10020327, // mov ra12, ra13 +-/* [0x00001718] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 +-/* [0x00001720] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 +-/* [0x00001728] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop_b +-/* [0x00001730] */ 0x533c0dc1, 0xd00243a0, // max ra14, ra15, 0 ; mul24 r0, r0, r1 +-/* [0x00001738] */ 0x8f54f1f6, 0xd0024821, // asr r0, r0, 15 ; mov r1, ra21 +-/* [0x00001740] */ 0x129d61c0, 0x100223e7, // min.setf ra15, r0, rb22 +-/* [0x00001748] */ 0x4038e037, 0x100049e0, // nop ; mul24 r0, ra14, rb14 +-/* [0x00001750] */ 0x4d34d237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra13, rb13 +-/* [0x00001758] */ 0x4d30c237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra12, rb12 +-/* [0x00001760] */ 0x4d2cb237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra11, rb11 +-/* [0x00001768] */ 0x4d28a237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra10, rb10 +-/* [0x00001770] */ 0x4d249237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra9, rb9 +-/* [0x00001778] */ 0x4d208237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra8, rb8 +-/* [0x00001780] */ 0x4d3cf237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra15, rb15 +-/* [0x00001788] */ 0x8d9f223f, 0x100a0867, // sub.ifnn r1, r1, r0 ; mov -, vw_wait +-/* [0x00001790] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 +-/* [0x00001798] */ 0x0f9cf3c0, 0xd0020867, // asr r1, r1, 15 +-/* [0x000017a0] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 +-/* [0x000017a8] */ 0x0cc01dc0, 0xd0020827, // add r0, vpm, 1 +-/* [0x000017b0] */ 0xfffffe38, 0xf06809e7, // brr.anyn -, r:uvloop_b +-/* [0x000017b8] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 +-/* [0x000017c0] */ 0x0c9e7200, 0x10020867, // add r1, r1, r0 +-/* [0x000017c8] */ 0x0e9c13c0, 0xd0020c27, // shr vpm, r1, 1 +-/* [0x000017d0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 +-/* [0x000017d8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 +-/* [0x000017e0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif +-/* [0x000017e8] */ 0x00000010, 0xe0020827, // mov r0, 16 +-/* [0x000017f0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait +-/* [0x000017f8] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 +-/* [0x00001800] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 +-/* [0x00001808] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 +-/* [0x00001810] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif ++/* [0x00001618] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 ++/* [0x00001620] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 ++/* [0x00001628] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 ++/* [0x00001630] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch ++/* [0x00001638] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 ++/* [0x00001640] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 ++/* [0x00001648] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 ++/* [0x00001650] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 ++/* [0x00001658] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 ++/* [0x00001660] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 ++/* [0x00001668] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x00001670] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 ++/* [0x00001678] */ 0x40038031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra0 << 8, r1 << 8 ++/* [0x00001680] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 ++/* [0x00001688] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 ++/* [0x00001690] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 ++/* [0x00001698] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 ++/* [0x000016a0] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 ++/* [0x000016a8] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 ++/* [0x000016b0] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 ++/* [0x000016b8] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 ++/* [0x000016c0] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 ++/* [0x000016c8] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 ++/* [0x000016d0] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 ++/* [0x000016d8] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 ++/* [0x000016e0] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 ++/* [0x000016e8] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 ++/* [0x000016f0] */ 0x0d9e74c0, 0x10020827, // sub r0, r2, r3 ++/* [0x000016f8] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 ++/* [0x00001700] */ 0x15267d80, 0x10020227, // mov ra8, ra9 ++/* [0x00001708] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 ++/* [0x00001710] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 ++/* [0x00001718] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 ++/* [0x00001720] */ 0x15367d80, 0x10020327, // mov ra12, ra13 ++/* [0x00001728] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 ++/* [0x00001730] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 ++/* [0x00001738] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop_b ++/* [0x00001740] */ 0x533c0dc1, 0xd00243a0, // max ra14, ra15, 0 ; mul24 r0, r0, r1 ++/* [0x00001748] */ 0x8f54f1f6, 0xd0024821, // asr r0, r0, 15 ; mov r1, ra21 ++/* [0x00001750] */ 0x129d61c0, 0x100223e7, // min.setf ra15, r0, rb22 ++/* [0x00001758] */ 0x4038e037, 0x100049e0, // nop ; mul24 r0, ra14, rb14 ++/* [0x00001760] */ 0x4d34d237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra13, rb13 ++/* [0x00001768] */ 0x4d30c237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra12, rb12 ++/* [0x00001770] */ 0x4d2cb237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra11, rb11 ++/* [0x00001778] */ 0x4d28a237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra10, rb10 ++/* [0x00001780] */ 0x4d249237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra9, rb9 ++/* [0x00001788] */ 0x4d208237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra8, rb8 ++/* [0x00001790] */ 0x4d3cf237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra15, rb15 ++/* [0x00001798] */ 0x8d9f223f, 0x100a0867, // sub.ifnn r1, r1, r0 ; mov -, vw_wait ++/* [0x000017a0] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 ++/* [0x000017a8] */ 0x0f9cf3c0, 0xd0020867, // asr r1, r1, 15 ++/* [0x000017b0] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 ++/* [0x000017b8] */ 0x0cc01dc0, 0xd0020827, // add r0, vpm, 1 ++/* [0x000017c0] */ 0xfffffe38, 0xf06809e7, // brr.anyn -, r:uvloop_b ++/* [0x000017c8] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 ++/* [0x000017d0] */ 0x0c9e7200, 0x10020867, // add r1, r1, r0 ++/* [0x000017d8] */ 0x0e9c13c0, 0xd0020c27, // shr vpm, r1, 1 ++/* [0x000017e0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 ++/* [0x000017e8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 ++/* [0x000017f0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif ++/* [0x000017f8] */ 0x00000010, 0xe0020827, // mov r0, 16 ++/* [0x00001800] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x00001808] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 ++/* [0x00001810] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 ++/* [0x00001818] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 ++/* [0x00001820] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif + // ::mc_end + }; + #ifdef __HIGHC__ +diff --git a/libavcodec/rpi_shader.h b/libavcodec/rpi_shader.h +index db971f4..3464cdb 100644 +--- a/libavcodec/rpi_shader.h ++++ b/libavcodec/rpi_shader.h +@@ -5,16 +5,16 @@ extern unsigned int rpi_shader[]; + + #define mc_setup (rpi_shader + 0) + #define mc_filter_uv (rpi_shader + 146) +-#define mc_filter (rpi_shader + 360) +-#define mc_filter_b (rpi_shader + 670) +-#define mc_filter_honly (rpi_shader + 894) +-#define mc_exit (rpi_shader + 1048) +-#define mc_exit1 (rpi_shader + 1066) +-#define mc_interrupt_exit (rpi_shader + 1082) +-#define mc_interrupt_exit4 (rpi_shader + 1120) +-#define mc_interrupt_exit8 (rpi_shader + 1142) +-#define mc_setup_uv (rpi_shader + 1172) +-#define mc_filter_uv_b (rpi_shader + 1314) +-#define mc_end (rpi_shader + 1542) ++#define mc_filter (rpi_shader + 364) ++#define mc_filter_b (rpi_shader + 674) ++#define mc_filter_honly (rpi_shader + 898) ++#define mc_exit (rpi_shader + 1052) ++#define mc_exit1 (rpi_shader + 1070) ++#define mc_interrupt_exit (rpi_shader + 1086) ++#define mc_interrupt_exit4 (rpi_shader + 1124) ++#define mc_interrupt_exit8 (rpi_shader + 1146) ++#define mc_setup_uv (rpi_shader + 1176) ++#define mc_filter_uv_b (rpi_shader + 1318) ++#define mc_end (rpi_shader + 1546) + + #endif +diff --git a/libavcodec/rpi_shader.qasm b/libavcodec/rpi_shader.qasm +index 02fdcb2..4809e1d 100644 +--- a/libavcodec/rpi_shader.qasm ++++ b/libavcodec/rpi_shader.qasm +@@ -21,7 +21,7 @@ + # rb19 next ra16 + # + # ra20 1 +-# ra21 64 ++# ra21 32 + # ra22 256 + # ra23 8 + # +@@ -97,7 +97,7 @@ add rb24, r1, r0 + # load constants + + mov ra20, 1 +-mov ra21, 64 ++mov ra21, 32 + mov ra22, 256 + mov ra23, 8 + +@@ -270,7 +270,7 @@ add t0s, ra_x2_base, r2 + + mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] + +-mov r2, rb21 ; mul24 r2, r0, ra0 ++nop ; mul24 r2, r0, ra0 + nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 + nop ; mul24 r3, ra1 << 1, r0 << 1 + nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 +@@ -301,9 +301,9 @@ sub.setf -, r3, 8 ; mov r1, ra22 + + # apply horizontal filter + brr.anyn -, r:uvloop +-max ra14, ra15, 0 ; mul24 r0, r0, r1 # last bit of context scroll, including clamp to zero +-asr r0, r0, 14 ; mov r1, ra21 +-min.setf ra15, r0, rb22 ++mov ra14, ra15 ; mul24 r0, r0, r1 # last bit of context scroll ++asr ra15, r0, 8 ; nop ++nop ; nop # Delay slot 3 (TODO move more of the context scroll into here) + + # apply vertical filter and write to VPM + +@@ -315,12 +315,14 @@ add r1, r1, r0 ; mul24 r0, ra10, rb10 + add r1, r1, r0 ; mul24 r0, ra9, rb9 + add r1, r1, r0 ; mul24 r0, ra8, rb8 + add r1, r1, r0 ; mul24 r0, ra15, rb15 +-add.ifnn r1, r1, r0 ; mov -, vw_wait ++add r1, r1, r0 ; mov -, vw_wait + sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 +-brr.anyn -, r:uvloop + asr r1, r1, 14 +-min r1, r1, rb22 +-max vpm, r1, 0 ++add r1, r1, ra21 ++brr.anyn -, r:uvloop ++asr r1, r1, 6 # Delay 1 ++min r1, r1, rb22 # Delay 2 ++max vpm, r1, 0 # Delay 3 + + # DMA out for U + +@@ -1161,7 +1163,7 @@ add rb24, r1, r0 + # load constants + + mov ra20, 1 +-mov ra21, 64 ++mov ra21, 32 + mov ra22, 256 + mov ra23, 8 + +-- +2.5.0 + + +From 436c31805d8a53ace0fea63976a464c0e2d2a93c Mon Sep 17 00:00:00 2001 +From: Peter de Rivaz <peter.derivaz@gmail.com> +Date: Wed, 13 May 2015 14:37:32 +0100 +Subject: [PATCH 19/68] Removed unused luma functions + +--- + libavcodec/hevc.c | 4 +- + libavcodec/rpi_qpu.c | 32 +- + libavcodec/rpi_shader.c | 1097 +++++++++++++------------------------------- + libavcodec/rpi_shader.h | 19 +- + libavcodec/rpi_shader.qasm | 970 +++------------------------------------ + 5 files changed, 396 insertions(+), 1726 deletions(-) + +diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c +index d4d272a..b4a3707 100644 +--- a/libavcodec/hevc.c ++++ b/libavcodec/hevc.c +@@ -2720,8 +2720,8 @@ static void rpi_execute_inter_qpu(HEVCContext *s) + return; + for(k=0;k<8;k++) { + s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS] = qpu_get_fn(QPU_MC_EXIT); // Add exit command +- s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS+3] = qpu_get_fn(QPU_MC_SETUP); // A dummy texture location (maps to our code) - this is needed as the texture requests are pipelined +- s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS+4] = qpu_get_fn(QPU_MC_SETUP); // Also need a dummy for V ++ s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS+3] = qpu_get_fn(QPU_MC_SETUP_UV); // A dummy texture location (maps to our code) - this is needed as the texture requests are pipelined ++ s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS+4] = qpu_get_fn(QPU_MC_SETUP_UV); // Also need a dummy for V + assert(s->u_mvs[k] - s->mvs_base[k] < UV_COMMANDS_PER_QPU); + } + +diff --git a/libavcodec/rpi_qpu.c b/libavcodec/rpi_qpu.c +index 4d9eda8..4e90cc1 100644 +--- a/libavcodec/rpi_qpu.c ++++ b/libavcodec/rpi_qpu.c +@@ -172,7 +172,7 @@ static int gpu_init(volatile struct GPU **gpu) { + + // Now copy over the QPU code into GPU memory + { +- int num_bytes = qpu_get_fn(QPU_MC_END) - qpu_get_fn(QPU_MC_SETUP); ++ int num_bytes = qpu_get_fn(QPU_MC_END) - qpu_get_fn(QPU_MC_SETUP_UV); + assert(num_bytes<=QPU_CODE_SIZE*sizeof(unsigned int)); + memcpy((void*)ptr->qpu_code, rpi_shader, num_bytes); + } +@@ -612,24 +612,24 @@ unsigned int qpu_get_fn(int num) { + gpu_unlock(); + } + switch(num) { +- case QPU_MC_SETUP: +- fn = mc_setup; +- break; +- case QPU_MC_FILTER: +- fn = mc_filter; +- break; ++ //case QPU_MC_SETUP: ++ // fn = mc_setup; ++ // break; ++ //case QPU_MC_FILTER: ++ // fn = mc_filter; ++ // break; + case QPU_MC_EXIT: + fn = mc_exit; + break; +- case QPU_MC_INTERRUPT_EXIT: +- fn = mc_interrupt_exit; +- break; +- case QPU_MC_FILTER_B: +- fn = mc_filter_b; +- break; +- case QPU_MC_FILTER_HONLY: +- fn = mc_filter_honly; +- break; ++ //case QPU_MC_INTERRUPT_EXIT: ++ // fn = mc_interrupt_exit; ++ // break; ++ //case QPU_MC_FILTER_B: ++ // fn = mc_filter_b; ++ // break; ++ //case QPU_MC_FILTER_HONLY: ++ // fn = mc_filter_honly; ++ // break; + case QPU_MC_SETUP_UV: + fn = mc_setup_uv; + break; +diff --git a/libavcodec/rpi_shader.c b/libavcodec/rpi_shader.c +index 831633b..170e8ac 100644 +--- a/libavcodec/rpi_shader.c ++++ b/libavcodec/rpi_shader.c +@@ -21,798 +21,331 @@ __declspec(align(8)) + __attribute__((aligned(8))) + #endif + unsigned int rpi_shader[] = { +-// ::mc_setup ++// ::mc_setup_uv + /* [0x00000000] */ 0x15827d80, 0x100207e7, // mov ra31, unif + /* [0x00000008] */ 0x0c9a0f80, 0x10020427, // add ra_x_base, unif, elem_num + /* [0x00000010] */ 0x15827d80, 0x10020767, // mov ra_y, unif + /* [0x00000018] */ 0x15827d80, 0x10020627, // mov ra_x2_base, unif +-/* [0x00000020] */ 0x0d801dc0, 0xd0021667, // sub rb25,unif,1 +-/* [0x00000028] */ 0x0d801dc0, 0xd00217a7, // sub rb30,unif,1 +-/* [0x00000030] */ 0x15827d80, 0x10021427, // mov rb16, unif +-/* [0x00000038] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000040] */ 0xc0000000, 0xe0020867, // mov r1, vdw_setup_1(0) +-/* [0x00000048] */ 0x0c9e7200, 0x10021627, // add rb24, r1, r0 +-/* [0x00000050] */ 0x00000001, 0xe0020527, // mov ra20, 1 +-/* [0x00000058] */ 0x00000020, 0xe0020567, // mov ra21, 32 +-/* [0x00000060] */ 0x00000100, 0xe00205a7, // mov ra22, 256 +-/* [0x00000068] */ 0x00000008, 0xe00205e7, // mov ra23, 8 +-/* [0x00000070] */ 0xffffff00, 0xe0021527, // mov rb20, 0xffffff00 +-/* [0x00000078] */ 0x00000040, 0xe0021567, // mov rb21, 64 +-/* [0x00000080] */ 0x000000ff, 0xe00215a7, // mov rb22, 255 +-/* [0x00000088] */ 0x00000018, 0xe00215e7, // mov rb23, 24 +-/* [0x00000090] */ 0x00000000, 0xe0020227, // mov ra8, 0 +-/* [0x00000098] */ 0x00000000, 0xe0020267, // mov ra9, 0 +-/* [0x000000a0] */ 0x00000000, 0xe00202a7, // mov ra10, 0 +-/* [0x000000a8] */ 0x00000000, 0xe00202e7, // mov ra11, 0 +-/* [0x000000b0] */ 0x00000000, 0xe0020327, // mov ra12, 0 +-/* [0x000000b8] */ 0x00000000, 0xe0020367, // mov ra13, 0 +-/* [0x000000c0] */ 0x00000000, 0xe00203a7, // mov ra14, 0 +-/* [0x000000c8] */ 0x00000000, 0xe00203e7, // mov ra15, 0 +-/* [0x000000d0] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num +-/* [0x000000d8] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 +-/* [0x000000e0] */ 0x159e7480, 0x10020867, // mov r1, r2 +-/* [0x000000e8] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 +-/* [0x000000f0] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 +-/* [0x000000f8] */ 0x159e7480, 0x10020827, // mov r0, r2 +-/* [0x00000100] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 +-/* [0x00000108] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 +-/* [0x00000110] */ 0x80004004, 0xe0020867, // mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) +-/* [0x00000118] */ 0x119c51c0, 0xd0020827, // shl r0, r0, 5 +-/* [0x00000120] */ 0x0c9e7040, 0x100216e7, // add rb27, r0, r1 +-/* [0x00000128] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num +-/* [0x00000130] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 +-/* [0x00000138] */ 0x159e7480, 0x10020867, // mov r1, r2 +-/* [0x00000140] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 +-/* [0x00000148] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 +-/* [0x00000150] */ 0x159e7480, 0x10020827, // mov r0, r2 +-/* [0x00000158] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 +-/* [0x00000160] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 +-/* [0x00000168] */ 0x00004800, 0xe0020867, // mov r1, vpm_setup(0, 4, h8p(0, 0)) +-/* [0x00000170] */ 0x0c9e7040, 0x10021727, // add rb28, r0, r1 +-/* [0x00000178] */ 0x15427d80, 0x10020827, // mov r0, ra_x_base +-/* [0x00000180] */ 0x0c9c81c0, 0xd00208a7, // add r2, r0, 8 +-/* [0x00000188] */ 0x937401f6, 0xd0024821, // max r0, r0, 0; mov r1, ra_y +-/* [0x00000190] */ 0x926191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, ra_x2_base +-/* [0x00000198] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 +-/* [0x000001a0] */ 0x139c05c0, 0xd00208a7, // max r2, r2, 0 ++/* [0x00000020] */ 0x009e7000, 0x100009e7, // nop ++/* [0x00000028] */ 0x0d620f80, 0x10020667, // sub ra_u2v_ref_offset, unif, ra_x2_base ++/* [0x00000030] */ 0x0d801dc0, 0xd0021667, // sub rb25,unif,1 ++/* [0x00000038] */ 0x0d801dc0, 0xd00217a7, // sub rb30,unif,1 ++/* [0x00000040] */ 0x15827d80, 0x10021427, // mov rb16, unif ++/* [0x00000048] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000050] */ 0xc0000000, 0xe0020867, // mov r1, vdw_setup_1(0) ++/* [0x00000058] */ 0x0c9e7200, 0x10021627, // add rb24, r1, r0 ++/* [0x00000060] */ 0x00000001, 0xe0020527, // mov ra20, 1 ++/* [0x00000068] */ 0x00000020, 0xe0020567, // mov ra21, 32 ++/* [0x00000070] */ 0x00000100, 0xe00205a7, // mov ra22, 256 ++/* [0x00000078] */ 0x00000008, 0xe00205e7, // mov ra23, 8 ++/* [0x00000080] */ 0xffffff00, 0xe0021527, // mov rb20, 0xffffff00 ++/* [0x00000088] */ 0x00000040, 0xe0021567, // mov rb21, 64 ++/* [0x00000090] */ 0x000000ff, 0xe00215a7, // mov rb22, 255 ++/* [0x00000098] */ 0x00000018, 0xe00215e7, // mov rb23, 24 ++/* [0x000000a0] */ 0x00000000, 0xe0020227, // mov ra8, 0 ++/* [0x000000a8] */ 0x00000000, 0xe0020267, // mov ra9, 0 ++/* [0x000000b0] */ 0x00000000, 0xe00202a7, // mov ra10, 0 ++/* [0x000000b8] */ 0x00000000, 0xe00202e7, // mov ra11, 0 ++/* [0x000000c0] */ 0x00000000, 0xe0020327, // mov ra12, 0 ++/* [0x000000c8] */ 0x00000000, 0xe0020367, // mov ra13, 0 ++/* [0x000000d0] */ 0x00000000, 0xe00203a7, // mov ra14, 0 ++/* [0x000000d8] */ 0x00000000, 0xe00203e7, // mov ra15, 0 ++/* [0x000000e0] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num ++/* [0x000000e8] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 ++/* [0x000000f0] */ 0x159e7480, 0x10020867, // mov r1, r2 ++/* [0x000000f8] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 ++/* [0x00000100] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 ++/* [0x00000108] */ 0x159e7480, 0x10020827, // mov r0, r2 ++/* [0x00000110] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 ++/* [0x00000118] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 ++/* [0x00000120] */ 0x80004004, 0xe0020867, // mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) ++/* [0x00000128] */ 0x119c51c0, 0xd0020827, // shl r0, r0, 5 ++/* [0x00000130] */ 0x0c9e7040, 0x100216e7, // add rb27, r0, r1 ++/* [0x00000138] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num ++/* [0x00000140] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 ++/* [0x00000148] */ 0x159e7480, 0x10020867, // mov r1, r2 ++/* [0x00000150] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 ++/* [0x00000158] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 ++/* [0x00000160] */ 0x159e7480, 0x10020827, // mov r0, r2 ++/* [0x00000168] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 ++/* [0x00000170] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 ++/* [0x00000178] */ 0x00004800, 0xe0020867, // mov r1, vpm_setup(0, 4, h8p(0, 0)) ++/* [0x00000180] */ 0x0c9e7040, 0x10021727, // add rb28, r0, r1 ++/* [0x00000188] */ 0x15427d80, 0x10020827, // mov r0, ra_x_base ++/* [0x00000190] */ 0x937401f6, 0xd0024821, // max r0, r0, 0; mov r1, ra_y ++/* [0x00000198] */ 0x926191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, ra_x2_base ++/* [0x000001a0] */ 0x916431f6, 0xd00244e2, // shl ra_xshift_next, r0, 3 ; mov r2, ra_u2v_ref_offset + /* [0x000001a8] */ 0x0c9c13c0, 0xd0020767, // add ra_y, r1, 1 +-/* [0x000001b0] */ 0x129d95c0, 0x100208a7, // min r2, r2, rb_frame_width_minus_1 +-/* [0x000001b8] */ 0x119c35c0, 0xd00206e7, // shl ra_x2shift_next, r2, 3 +-/* [0x000001c0] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 ++/* [0x000001b0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 ++/* [0x000001b8] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 ++/* [0x000001c0] */ 0x939c03c0, 0xd0025850, // max r1, r1, 0 ; mov ra_x_base, r0 + /* [0x000001c8] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 +-/* [0x000001d0] */ 0x4c9d00cf, 0x10024821, // add r0, r0, r3; mul24 r1, r1, rb_pitch +-/* [0x000001d8] */ 0x0c9e74c0, 0x100208a7, // add r2, r2, r3 +-/* [0x000001e0] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 +-/* [0x000001e8] */ 0x949dc5c0, 0xd0025890, // and r2, r2, ~3; mov ra_x_base, r0 +-/* [0x000001f0] */ 0x8c9e7052, 0x10025e18, // add t0s, r0, r1 ; mov ra_x2_base, r2 +-/* [0x000001f8] */ 0x0c9e7440, 0x10020e27, // add t0s, r2, r1 +-/* [0x00000200] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000208] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000210] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 +-/* [0x00000218] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 +-/* [0x00000220] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 +-/* [0x00000228] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 +-/* [0x00000230] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch +-/* [0x00000238] */ 0x0c427380, 0x10020e27, // add t0s, r1, ra_x_base +-/* [0x00000240] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_x2_base ++/* [0x000001d0] */ 0x4c9d040f, 0x100248a1, // add r2, r2, r0 ; mul24 r1, r1, rb_pitch ++/* [0x000001d8] */ 0x8c9e7052, 0x10025e18, // add t0s, r0, r1 ; mov ra_x2_base, r2 ++/* [0x000001e0] */ 0x0c9e7440, 0x10020e27, // add t0s, r2, r1 ++/* [0x000001e8] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x000001f0] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x000001f8] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000200] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 ++/* [0x00000208] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 ++/* [0x00000210] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 ++/* [0x00000218] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 ++/* [0x00000220] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch ++/* [0x00000228] */ 0x0c427380, 0x10020e27, // add t0s, r1, ra_x_base ++/* [0x00000230] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_x2_base + // ::mc_filter_uv +-/* [0x00000248] */ 0x15827d80, 0x100207e7, // mov ra31, unif +-/* [0x00000250] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next +-/* [0x00000258] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num +-/* [0x00000260] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif +-/* [0x00000268] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif +-/* [0x00000270] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 +-/* [0x00000278] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 +-/* [0x00000280] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 +-/* [0x00000288] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 +-/* [0x00000290] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 +-/* [0x00000298] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 +-/* [0x000002a0] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 +-/* [0x000002a8] */ 0x00000010, 0xe00208a7, // mov r2, 16 +-/* [0x000002b0] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x000002b8] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 +-/* [0x000002c0] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 +-/* [0x000002c8] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 +-/* [0x000002d0] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 +-/* [0x000002d8] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 +-/* [0x000002e0] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 +-/* [0x000002e8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 +-/* [0x000002f0] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 +-/* [0x000002f8] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 +-/* [0x00000300] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 +-/* [0x00000308] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000310] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000318] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000320] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000328] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif +-/* [0x00000330] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000338] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000340] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000348] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif +-/* [0x00000350] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000358] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000360] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000368] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif +-/* [0x00000370] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000378] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000380] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000388] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 +-/* [0x00000390] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 +-/* [0x00000398] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-/* [0x000003a0] */ 0x00000000, 0xe00208e7, // mov r3, 0 ++/* [0x00000238] */ 0x15827d80, 0x100207e7, // mov ra31, unif ++/* [0x00000240] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next ++/* [0x00000248] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num ++/* [0x00000250] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif ++/* [0x00000258] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif ++/* [0x00000260] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 ++/* [0x00000268] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 ++/* [0x00000270] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 ++/* [0x00000278] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 ++/* [0x00000280] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 ++/* [0x00000288] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 ++/* [0x00000290] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 ++/* [0x00000298] */ 0x00000010, 0xe00208a7, // mov r2, 16 ++/* [0x000002a0] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x000002a8] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 ++/* [0x000002b0] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 ++/* [0x000002b8] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 ++/* [0x000002c0] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 ++/* [0x000002c8] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 ++/* [0x000002d0] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 ++/* [0x000002d8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 ++/* [0x000002e0] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 ++/* [0x000002e8] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 ++/* [0x000002f0] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 ++/* [0x000002f8] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000300] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000308] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000310] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000318] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif ++/* [0x00000320] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000328] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000330] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000338] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif ++/* [0x00000340] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000348] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000350] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000358] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif ++/* [0x00000360] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000368] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000370] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000378] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 ++/* [0x00000380] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 ++/* [0x00000388] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x00000390] */ 0x00000000, 0xe00208e7, // mov r3, 0 + // :uvloop +-/* [0x000003a8] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 +-/* [0x000003b0] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 +-/* [0x000003b8] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 +-/* [0x000003c0] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch +-/* [0x000003c8] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 +-/* [0x000003d0] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 +-/* [0x000003d8] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 +-/* [0x000003e0] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 +-/* [0x000003e8] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 +-/* [0x000003f0] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 +-/* [0x000003f8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-/* [0x00000400] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 +-/* [0x00000408] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 +-/* [0x00000410] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 +-/* [0x00000418] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 +-/* [0x00000420] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 +-/* [0x00000428] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 +-/* [0x00000430] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 +-/* [0x00000438] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 +-/* [0x00000440] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 +-/* [0x00000448] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 +-/* [0x00000450] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 +-/* [0x00000458] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 +-/* [0x00000460] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 +-/* [0x00000468] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 +-/* [0x00000470] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 +-/* [0x00000478] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 +-/* [0x00000480] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 +-/* [0x00000488] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 +-/* [0x00000490] */ 0x15267d80, 0x10020227, // mov ra8, ra9 +-/* [0x00000498] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 +-/* [0x000004a0] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 +-/* [0x000004a8] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 +-/* [0x000004b0] */ 0x15367d80, 0x10020327, // mov ra12, ra13 +-/* [0x000004b8] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 +-/* [0x000004c0] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 +-/* [0x000004c8] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop +-/* [0x000004d0] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 +-/* [0x000004d8] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop +-/* [0x000004e0] */ 0x009e7000, 0x100009e7, // nop ; nop +-/* [0x000004e8] */ 0x4038e037, 0x100049e1, // nop ; mul24 r1, ra14, rb14 +-/* [0x000004f0] */ 0x4034d037, 0x100049e0, // nop ; mul24 r0, ra13, rb13 +-/* [0x000004f8] */ 0x4c30c237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb12 +-/* [0x00000500] */ 0x4c2cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb11 +-/* [0x00000508] */ 0x4c28a237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb10 +-/* [0x00000510] */ 0x4c249237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb9 +-/* [0x00000518] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 +-/* [0x00000520] */ 0x4c3cf237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb15 +-/* [0x00000528] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait +-/* [0x00000530] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 +-/* [0x00000538] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 +-/* [0x00000540] */ 0x0c567380, 0x10020867, // add r1, r1, ra21 +-/* [0x00000548] */ 0xfffffe40, 0xf06809e7, // brr.anyn -, r:uvloop +-/* [0x00000550] */ 0x0f9c63c0, 0xd0020867, // asr r1, r1, 6 +-/* [0x00000558] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 +-/* [0x00000560] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 +-/* [0x00000568] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 +-/* [0x00000570] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 +-/* [0x00000578] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif +-/* [0x00000580] */ 0x00000010, 0xe0020827, // mov r0, 16 +-/* [0x00000588] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait +-/* [0x00000590] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 +-/* [0x00000598] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 +-/* [0x000005a0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 +-/* [0x000005a8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif +-// ::mc_filter +-/* [0x000005b0] */ 0x15827d80, 0x100207e7, // mov ra31, unif +-/* [0x000005b8] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next +-/* [0x000005c0] */ 0x156e7d80, 0x10020667, // mov ra_x2shift, ra_x2shift_next +-/* [0x000005c8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num +-/* [0x000005d0] */ 0x0c9c81c0, 0xd00208a7, // add r2, r0, 8 +-/* [0x000005d8] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif +-/* [0x000005e0] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3,unif +-/* [0x000005e8] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 +-/* [0x000005f0] */ 0x139c05c0, 0xd00208a7, // max r2, r2, 0 +-/* [0x000005f8] */ 0x129d95c0, 0x100208a7, // min r2, r2, rb_frame_width_minus_1 +-/* [0x00000600] */ 0x119c35c0, 0xd00206e7, // shl ra_x2shift_next, r2, 3 +-/* [0x00000608] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 +-/* [0x00000610] */ 0x0c9e74c0, 0x100208a7, // add r2, r2, r3 +-/* [0x00000618] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 +-/* [0x00000620] */ 0x149dc5c0, 0xd00206a7, // and ra_x2_base_next, r2, ~3 +-/* [0x00000628] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 +-/* [0x00000630] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 +-/* [0x00000638] */ 0x00000010, 0xe00208a7, // mov r2, 16 +-/* [0x00000640] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000648] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 +-/* [0x00000650] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 +-/* [0x00000658] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 +-/* [0x00000660] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 +-/* [0x00000668] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 +-/* [0x00000670] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 +-/* [0x00000678] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 +-/* [0x00000680] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 +-/* [0x00000688] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 +-/* [0x00000690] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 +-/* [0x00000698] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x000006a0] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000006a8] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000006b0] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000006b8] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif +-/* [0x000006c0] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000006c8] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000006d0] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000006d8] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif +-/* [0x000006e0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000006e8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000006f0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000006f8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif +-/* [0x00000700] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000708] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000710] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000718] */ 0x000001d0, 0xf07809e7, // brr.anynn -, r:fast_path +-/* [0x00000720] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 +-/* [0x00000728] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 +-/* [0x00000730] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-/* [0x00000738] */ 0x00000000, 0xe00208e7, // mov r3, 0 +-// :loop +-/* [0x00000740] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 +-/* [0x00000748] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 +-/* [0x00000750] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 +-/* [0x00000758] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch +-/* [0x00000760] */ 0xee654987, 0x10024860, // shr r1, r4, ra_x2shift ; v8subs r0, r0, rb20 +-/* [0x00000768] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 +-/* [0x00000770] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 +-/* [0x00000778] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 +-/* [0x00000780] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 +-/* [0x00000788] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 +-/* [0x00000790] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-/* [0x00000798] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 +-/* [0x000007a0] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 +-/* [0x000007a8] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 +-/* [0x000007b0] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 +-/* [0x000007b8] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 +-/* [0x000007c0] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 +-/* [0x000007c8] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 +-/* [0x000007d0] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 +-/* [0x000007d8] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 +-/* [0x000007e0] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 +-/* [0x000007e8] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 +-/* [0x000007f0] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 +-/* [0x000007f8] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 +-/* [0x00000800] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 +-/* [0x00000808] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 +-/* [0x00000810] */ 0x0d9e74c0, 0x10020827, // sub r0, r2, r3 +-/* [0x00000818] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 +-/* [0x00000820] */ 0x15267d80, 0x10020227, // mov ra8, ra9 +-/* [0x00000828] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 +-/* [0x00000830] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 +-/* [0x00000838] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 +-/* [0x00000840] */ 0x15367d80, 0x10020327, // mov ra12, ra13 +-/* [0x00000848] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 +-/* [0x00000850] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 +-/* [0x00000858] */ 0xfffffec8, 0xf06809e7, // brr.anyn -, r:loop +-/* [0x00000860] */ 0x533c0dc1, 0xd00243a0, // max ra14, ra15, 0 ; mul24 r0, r0, r1 +-/* [0x00000868] */ 0x8f54f1f6, 0xd0024821, // asr r0, r0, 15 ; mov r1, ra21 +-/* [0x00000870] */ 0x129d61c0, 0x100223e7, // min.setf ra15, r0, rb22 +-/* [0x00000878] */ 0x4038e037, 0x100049e0, // nop ; mul24 r0, ra14, rb14 +-/* [0x00000880] */ 0x4d34d237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra13, rb13 +-/* [0x00000888] */ 0x4d30c237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra12, rb12 +-/* [0x00000890] */ 0x4d2cb237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra11, rb11 +-/* [0x00000898] */ 0x4d28a237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra10, rb10 +-/* [0x000008a0] */ 0x4d249237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra9, rb9 +-/* [0x000008a8] */ 0x4d208237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra8, rb8 +-/* [0x000008b0] */ 0x4d3cf237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra15, rb15 +-/* [0x000008b8] */ 0x8d9f223f, 0x100a0867, // sub.ifnn r1, r1, r0 ; mov -, vw_wait +-/* [0x000008c0] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 +-/* [0x000008c8] */ 0xfffffe58, 0xf06809e7, // brr.anyn -, r:loop +-/* [0x000008d0] */ 0x0f9cf3c0, 0xd0020867, // asr r1, r1, 15 +-/* [0x000008d8] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 +-/* [0x000008e0] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 +-/* [0x000008e8] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 +-/* [0x000008f0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 +-/* [0x000008f8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 +-/* [0x00000900] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif +-// :fast_path +-/* [0x00000908] */ 0x00000000, 0xe00208e7, // mov r3, 0 +-// :fast_loop +-/* [0x00000910] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 +-/* [0x00000918] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 +-/* [0x00000920] */ 0x95727d9b, 0x1004475f, // mov.ifz ra_y, ra_y_next ; mov rb31, r3 +-/* [0x00000928] */ 0x95690dbf, 0x10044623, // mov.ifz ra_x2_base, ra_x2_base_next ; mov r3, rb_pitch +-/* [0x00000930] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 +-/* [0x00000938] */ 0x929de5e4, 0x100248a1, // min r2, r2, rb_frame_height_minus_1 ; mov r1, r4 +-/* [0x00000940] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 +-/* [0x00000948] */ 0xec414c87, 0x10024e20, // add t0s, ra_x_base, r2 ; v8subs r0, r0, rb20 +-/* [0x00000950] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 +-/* [0x00000958] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 +-/* [0x00000960] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 +-/* [0x00000968] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 +-/* [0x00000970] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 +-/* [0x00000978] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 +-/* [0x00000980] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 +-/* [0x00000988] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 +-/* [0x00000990] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 +-/* [0x00000998] */ 0x8d9df4ff, 0x10024823, // sub r0, r2, r3 ; mov r3, rb31 +-/* [0x000009a0] */ 0x15267d80, 0x10020227, // mov ra8, ra9 +-/* [0x000009a8] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 +-/* [0x000009b0] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 +-/* [0x000009b8] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 +-/* [0x000009c0] */ 0x15367d80, 0x10020327, // mov ra12, ra13 +-/* [0x000009c8] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 +-/* [0x000009d0] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 +-/* [0x000009d8] */ 0xffffff18, 0xf06809e7, // brr.anyn -, r:fast_loop +-/* [0x000009e0] */ 0x533c0dc1, 0xd00243a0, // max ra14, ra15, 0 ; mul24 r0, r0, r1 +-/* [0x000009e8] */ 0x8f54f1f6, 0xd0024821, // asr r0, r0, 15 ; mov r1, ra21 +-/* [0x000009f0] */ 0x129d61c0, 0x100223e7, // min.setf ra15, r0, rb22 +-/* [0x000009f8] */ 0x4038e037, 0x100049e0, // nop ; mul24 r0, ra14, rb14 +-/* [0x00000a00] */ 0x4d34d237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra13, rb13 +-/* [0x00000a08] */ 0x4d30c237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra12, rb12 +-/* [0x00000a10] */ 0x4d2cb237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra11, rb11 +-/* [0x00000a18] */ 0x4d28a237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra10, rb10 +-/* [0x00000a20] */ 0x4d249237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra9, rb9 +-/* [0x00000a28] */ 0x4d208237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra8, rb8 +-/* [0x00000a30] */ 0x4d3cf237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra15, rb15 +-/* [0x00000a38] */ 0x8d9f223f, 0x100a0867, // sub.ifnn r1, r1, r0 ; mov -, vw_wait +-/* [0x00000a40] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 +-/* [0x00000a48] */ 0xfffffea8, 0xf06809e7, // brr.anyn -, r:fast_loop +-/* [0x00000a50] */ 0x0f9cf3c0, 0xd0020867, // asr r1, r1, 15 +-/* [0x00000a58] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 +-/* [0x00000a60] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 +-/* [0x00000a68] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 +-/* [0x00000a70] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 +-/* [0x00000a78] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 +-/* [0x00000a80] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif +-// ::mc_filter_b +-/* [0x00000a88] */ 0x15827d80, 0x100207e7, // mov ra31, unif +-/* [0x00000a90] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next +-/* [0x00000a98] */ 0x156e7d80, 0x10020667, // mov ra_x2shift, ra_x2shift_next +-/* [0x00000aa0] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num +-/* [0x00000aa8] */ 0x0c9c81c0, 0xd00208a7, // add r2, r0, 8 +-/* [0x00000ab0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif +-/* [0x00000ab8] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3,unif +-/* [0x00000ac0] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 +-/* [0x00000ac8] */ 0x139c05c0, 0xd00208a7, // max r2, r2, 0 +-/* [0x00000ad0] */ 0x129d95c0, 0x100208a7, // min r2, r2, rb_frame_width_minus_1 +-/* [0x00000ad8] */ 0x119c35c0, 0xd00206e7, // shl ra_x2shift_next, r2, 3 +-/* [0x00000ae0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 +-/* [0x00000ae8] */ 0x0c9e74c0, 0x100208a7, // add r2, r2, r3 +-/* [0x00000af0] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 +-/* [0x00000af8] */ 0x149dc5c0, 0xd00206a7, // and ra_x2_base_next, r2, ~3 +-/* [0x00000b00] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 +-/* [0x00000b08] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 +-/* [0x00000b10] */ 0x00000010, 0xe00208a7, // mov r2, 16 +-/* [0x00000b18] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000b20] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 +-/* [0x00000b28] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 +-/* [0x00000b30] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 +-/* [0x00000b38] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 +-/* [0x00000b40] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 +-/* [0x00000b48] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 +-/* [0x00000b50] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 +-/* [0x00000b58] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 +-/* [0x00000b60] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 +-/* [0x00000b68] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 +-/* [0x00000b70] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 +-/* [0x00000b78] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 +-/* [0x00000b80] */ 0x0c9dc7c0, 0x10020c67, // add vr_setup, r3, rb28 +-/* [0x00000b88] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000b90] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000b98] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000ba0] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000ba8] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif +-/* [0x00000bb0] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000bb8] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000bc0] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000bc8] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif +-/* [0x00000bd0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000bd8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000be0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000be8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif +-/* [0x00000bf0] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000bf8] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000c00] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000c08] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 +-/* [0x00000c10] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 +-/* [0x00000c18] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-/* [0x00000c20] */ 0x00000000, 0xe00208e7, // mov r3, 0 +-// :bloop +-/* [0x00000c28] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 +-/* [0x00000c30] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 +-/* [0x00000c38] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 +-/* [0x00000c40] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch +-/* [0x00000c48] */ 0xee654987, 0x10024860, // shr r1, r4, ra_x2shift ; v8subs r0, r0, rb20 +-/* [0x00000c50] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 +-/* [0x00000c58] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 +-/* [0x00000c60] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 +-/* [0x00000c68] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 +-/* [0x00000c70] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 +-/* [0x00000c78] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-/* [0x00000c80] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 +-/* [0x00000c88] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 +-/* [0x00000c90] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 +-/* [0x00000c98] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 +-/* [0x00000ca0] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 +-/* [0x00000ca8] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 +-/* [0x00000cb0] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 +-/* [0x00000cb8] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 +-/* [0x00000cc0] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 +-/* [0x00000cc8] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 +-/* [0x00000cd0] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 +-/* [0x00000cd8] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 +-/* [0x00000ce0] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 +-/* [0x00000ce8] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 +-/* [0x00000cf0] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 +-/* [0x00000cf8] */ 0x0d9e74c0, 0x10020827, // sub r0, r2, r3 +-/* [0x00000d00] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 +-/* [0x00000d08] */ 0x15267d80, 0x10020227, // mov ra8, ra9 +-/* [0x00000d10] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 +-/* [0x00000d18] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 +-/* [0x00000d20] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 +-/* [0x00000d28] */ 0x15367d80, 0x10020327, // mov ra12, ra13 +-/* [0x00000d30] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 +-/* [0x00000d38] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 +-/* [0x00000d40] */ 0xfffffec8, 0xf06809e7, // brr.anyn -, r:bloop +-/* [0x00000d48] */ 0x533c0dc1, 0xd00243a0, // max ra14, ra15, 0 ; mul24 r0, r0, r1 +-/* [0x00000d50] */ 0x8f54f1f6, 0xd0024821, // asr r0, r0, 15 ; mov r1, ra21 +-/* [0x00000d58] */ 0x129d61c0, 0x100223e7, // min.setf ra15, r0, rb22 +-/* [0x00000d60] */ 0x4038e037, 0x100049e0, // nop ; mul24 r0, ra14, rb14 +-/* [0x00000d68] */ 0x4d34d237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra13, rb13 +-/* [0x00000d70] */ 0x4d30c237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra12, rb12 +-/* [0x00000d78] */ 0x4d2cb237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra11, rb11 +-/* [0x00000d80] */ 0x4d28a237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra10, rb10 +-/* [0x00000d88] */ 0x4d249237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra9, rb9 +-/* [0x00000d90] */ 0x4d208237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra8, rb8 +-/* [0x00000d98] */ 0x4d3cf237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra15, rb15 +-/* [0x00000da0] */ 0x8d9f223f, 0x100a0867, // sub.ifnn r1, r1, r0 ; mov -, vw_wait +-/* [0x00000da8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 +-/* [0x00000db0] */ 0x8fc8f3f6, 0xd0020867, // asr r1, r1, 15 ; mov -, vr_wait +-/* [0x00000db8] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 +-/* [0x00000dc0] */ 0x0cc01dc0, 0xd0020827, // add r0, vpm, 1 +-/* [0x00000dc8] */ 0xfffffe40, 0xf06809e7, // brr.anyn -, r:bloop +-/* [0x00000dd0] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 +-/* [0x00000dd8] */ 0x0c9e7200, 0x10020867, // add r1, r1, r0 +-/* [0x00000de0] */ 0x0e9c13c0, 0xd0020c27, // shr vpm, r1, 1 +-/* [0x00000de8] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 +-/* [0x00000df0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 +-/* [0x00000df8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 +-/* [0x00000e00] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif +-// ::mc_filter_honly +-/* [0x00000e08] */ 0x15827d80, 0x100207e7, // mov ra31, unif +-/* [0x00000e10] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next +-/* [0x00000e18] */ 0x156e7d80, 0x10020667, // mov ra_x2shift, ra_x2shift_next +-/* [0x00000e20] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num +-/* [0x00000e28] */ 0x0c9c81c0, 0xd00208a7, // add r2, r0, 8 +-/* [0x00000e30] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif +-/* [0x00000e38] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3,unif +-/* [0x00000e40] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 +-/* [0x00000e48] */ 0x139c05c0, 0xd00208a7, // max r2, r2, 0 +-/* [0x00000e50] */ 0x129d95c0, 0x100208a7, // min r2, r2, rb_frame_width_minus_1 +-/* [0x00000e58] */ 0x119c35c0, 0xd00206e7, // shl ra_x2shift_next, r2, 3 +-/* [0x00000e60] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 +-/* [0x00000e68] */ 0x0c9e74c0, 0x100208a7, // add r2, r2, r3 +-/* [0x00000e70] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 +-/* [0x00000e78] */ 0x149dc5c0, 0xd00206a7, // and ra_x2_base_next, r2, ~3 +-/* [0x00000e80] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 +-/* [0x00000e88] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 +-/* [0x00000e90] */ 0x00000010, 0xe00208a7, // mov r2, 16 +-/* [0x00000e98] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000ea0] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 +-/* [0x00000ea8] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 +-/* [0x00000eb0] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 +-/* [0x00000eb8] */ 0x0c9de1c0, 0xd0021467, // add rb17, r0, -2 +-/* [0x00000ec0] */ 0x919c71c0, 0xd0024812, // shl r0, r0, 7 ; mov rb18,r0 +-/* [0x00000ec8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 +-/* [0x00000ed0] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 +-/* [0x00000ed8] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 +-/* [0x00000ee0] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000ee8] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000ef0] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000ef8] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000f00] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif +-/* [0x00000f08] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000f10] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000f18] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000f20] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif +-/* [0x00000f28] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000f30] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 +-/* [0x00000f38] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-/* [0x00000f40] */ 0x00000000, 0xe00208e7, // mov r3, 0 +-// :loop_honly +-/* [0x00000f48] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 +-/* [0x00000f50] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 +-/* [0x00000f58] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 +-/* [0x00000f60] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch +-/* [0x00000f68] */ 0xee654987, 0x10024860, // shr r1, r4, ra_x2shift ; v8subs r0, r0, rb20 +-/* [0x00000f70] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 +-/* [0x00000f78] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 +-/* [0x00000f80] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 +-/* [0x00000f88] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 +-/* [0x00000f90] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 +-/* [0x00000f98] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-/* [0x00000fa0] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 +-/* [0x00000fa8] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 +-/* [0x00000fb0] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 +-/* [0x00000fb8] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 +-/* [0x00000fc0] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 +-/* [0x00000fc8] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 +-/* [0x00000fd0] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 +-/* [0x00000fd8] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 +-/* [0x00000fe0] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 +-/* [0x00000fe8] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 +-/* [0x00000ff0] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 +-/* [0x00000ff8] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 +-/* [0x00001000] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 +-/* [0x00001008] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 +-/* [0x00001010] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 +-/* [0x00001018] */ 0x8d9df4ff, 0x10024823, // sub r0, r2, r3 ; mov r3, rb31 +-/* [0x00001020] */ 0x8d5927f6, 0x100269e1, // sub.setf -, r3, rb18 ; mov r1, ra22 +-/* [0x00001028] */ 0x559f2fc1, 0x100049e0, // mov -, vw_wait ; mul24 r0, r0, r1 +-/* [0x00001030] */ 0xfffffef8, 0xf06809e7, // brr.anyn -, r:loop_honly +-/* [0x00001038] */ 0x0f9cf1c0, 0xd0020827, // asr r0, r0, 15 +-/* [0x00001040] */ 0x129d61c0, 0x10020827, // min r0, r0, rb22 +-/* [0x00001048] */ 0x139c01c0, 0xd0020c27, // max vpm, r0, 0 +-/* [0x00001050] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 +-/* [0x00001058] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 +-/* [0x00001060] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 +-/* [0x00001068] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif +-// ::mc_exit +-/* [0x00001070] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait +-/* [0x00001078] */ 0x00000000, 0xe80009e7, // mov -,srel(0) +-/* [0x00001080] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00001088] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00001090] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00001098] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x000010a0] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend +-/* [0x000010a8] */ 0x009e7000, 0x100009e7, // nop ; nop +-/* [0x000010b0] */ 0x009e7000, 0x100009e7, // nop ; nop +-// ::mc_exit1 +-/* [0x000010b8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait +-/* [0x000010c0] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x000010c8] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x000010d0] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x000010d8] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x000010e0] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend +-/* [0x000010e8] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop +-/* [0x000010f0] */ 0x009e7000, 0x100009e7, // nop ; nop +-// ::mc_interrupt_exit +-/* [0x000010f8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait +-/* [0x00001100] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00001108] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00001110] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00001118] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00001120] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00001128] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00001130] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00001138] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00001140] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00001148] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00001150] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00001158] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00001160] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00001168] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00001170] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00001178] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend +-/* [0x00001180] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop +-/* [0x00001188] */ 0x009e7000, 0x100009e7, // nop ; nop +-// ::mc_interrupt_exit4 +-/* [0x00001190] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait +-/* [0x00001198] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x000011a0] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x000011a8] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x000011b0] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x000011b8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x000011c0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x000011c8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x000011d0] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend +-/* [0x000011d8] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop +-/* [0x000011e0] */ 0x009e7000, 0x100009e7, // nop ; nop +-// ::mc_interrupt_exit8 +-/* [0x000011e8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait +-/* [0x000011f0] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x000011f8] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00001200] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00001208] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00001210] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00001218] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00001220] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00001228] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00001230] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00001238] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00001240] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00001248] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend +-/* [0x00001250] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop +-/* [0x00001258] */ 0x009e7000, 0x100009e7, // nop ; nop +-// ::mc_setup_uv +-/* [0x00001260] */ 0x15827d80, 0x100207e7, // mov ra31, unif +-/* [0x00001268] */ 0x0c9a0f80, 0x10020427, // add ra_x_base, unif, elem_num +-/* [0x00001270] */ 0x15827d80, 0x10020767, // mov ra_y, unif +-/* [0x00001278] */ 0x15827d80, 0x10020627, // mov ra_x2_base, unif +-/* [0x00001280] */ 0x009e7000, 0x100009e7, // nop +-/* [0x00001288] */ 0x0d620f80, 0x10020667, // sub ra_u2v_ref_offset, unif, ra_x2_base +-/* [0x00001290] */ 0x0d801dc0, 0xd0021667, // sub rb25,unif,1 +-/* [0x00001298] */ 0x0d801dc0, 0xd00217a7, // sub rb30,unif,1 +-/* [0x000012a0] */ 0x15827d80, 0x10021427, // mov rb16, unif +-/* [0x000012a8] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x000012b0] */ 0xc0000000, 0xe0020867, // mov r1, vdw_setup_1(0) +-/* [0x000012b8] */ 0x0c9e7200, 0x10021627, // add rb24, r1, r0 +-/* [0x000012c0] */ 0x00000001, 0xe0020527, // mov ra20, 1 +-/* [0x000012c8] */ 0x00000020, 0xe0020567, // mov ra21, 32 +-/* [0x000012d0] */ 0x00000100, 0xe00205a7, // mov ra22, 256 +-/* [0x000012d8] */ 0x00000008, 0xe00205e7, // mov ra23, 8 +-/* [0x000012e0] */ 0xffffff00, 0xe0021527, // mov rb20, 0xffffff00 +-/* [0x000012e8] */ 0x00000040, 0xe0021567, // mov rb21, 64 +-/* [0x000012f0] */ 0x000000ff, 0xe00215a7, // mov rb22, 255 +-/* [0x000012f8] */ 0x00000018, 0xe00215e7, // mov rb23, 24 +-/* [0x00001300] */ 0x00000000, 0xe0020227, // mov ra8, 0 +-/* [0x00001308] */ 0x00000000, 0xe0020267, // mov ra9, 0 +-/* [0x00001310] */ 0x00000000, 0xe00202a7, // mov ra10, 0 +-/* [0x00001318] */ 0x00000000, 0xe00202e7, // mov ra11, 0 +-/* [0x00001320] */ 0x00000000, 0xe0020327, // mov ra12, 0 +-/* [0x00001328] */ 0x00000000, 0xe0020367, // mov ra13, 0 +-/* [0x00001330] */ 0x00000000, 0xe00203a7, // mov ra14, 0 +-/* [0x00001338] */ 0x00000000, 0xe00203e7, // mov ra15, 0 +-/* [0x00001340] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num +-/* [0x00001348] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 +-/* [0x00001350] */ 0x159e7480, 0x10020867, // mov r1, r2 +-/* [0x00001358] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 +-/* [0x00001360] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 +-/* [0x00001368] */ 0x159e7480, 0x10020827, // mov r0, r2 +-/* [0x00001370] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 +-/* [0x00001378] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 +-/* [0x00001380] */ 0x80004004, 0xe0020867, // mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) +-/* [0x00001388] */ 0x119c51c0, 0xd0020827, // shl r0, r0, 5 +-/* [0x00001390] */ 0x0c9e7040, 0x100216e7, // add rb27, r0, r1 +-/* [0x00001398] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num +-/* [0x000013a0] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 +-/* [0x000013a8] */ 0x159e7480, 0x10020867, // mov r1, r2 +-/* [0x000013b0] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 +-/* [0x000013b8] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 +-/* [0x000013c0] */ 0x159e7480, 0x10020827, // mov r0, r2 +-/* [0x000013c8] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 +-/* [0x000013d0] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 +-/* [0x000013d8] */ 0x00004800, 0xe0020867, // mov r1, vpm_setup(0, 4, h8p(0, 0)) +-/* [0x000013e0] */ 0x0c9e7040, 0x10021727, // add rb28, r0, r1 +-/* [0x000013e8] */ 0x15427d80, 0x10020827, // mov r0, ra_x_base +-/* [0x000013f0] */ 0x937401f6, 0xd0024821, // max r0, r0, 0; mov r1, ra_y +-/* [0x000013f8] */ 0x926191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, ra_x2_base +-/* [0x00001400] */ 0x916431f6, 0xd00244e2, // shl ra_xshift_next, r0, 3 ; mov r2, ra_u2v_ref_offset +-/* [0x00001408] */ 0x0c9c13c0, 0xd0020767, // add ra_y, r1, 1 +-/* [0x00001410] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 +-/* [0x00001418] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 +-/* [0x00001420] */ 0x939c03c0, 0xd0025850, // max r1, r1, 0 ; mov ra_x_base, r0 +-/* [0x00001428] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 +-/* [0x00001430] */ 0x4c9d040f, 0x100248a1, // add r2, r2, r0 ; mul24 r1, r1, rb_pitch +-/* [0x00001438] */ 0x8c9e7052, 0x10025e18, // add t0s, r0, r1 ; mov ra_x2_base, r2 +-/* [0x00001440] */ 0x0c9e7440, 0x10020e27, // add t0s, r2, r1 +-/* [0x00001448] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00001450] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00001458] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00001460] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 +-/* [0x00001468] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 +-/* [0x00001470] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 +-/* [0x00001478] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 +-/* [0x00001480] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch +-/* [0x00001488] */ 0x0c427380, 0x10020e27, // add t0s, r1, ra_x_base +-/* [0x00001490] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_x2_base ++/* [0x00000398] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 ++/* [0x000003a0] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 ++/* [0x000003a8] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 ++/* [0x000003b0] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch ++/* [0x000003b8] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 ++/* [0x000003c0] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 ++/* [0x000003c8] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 ++/* [0x000003d0] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 ++/* [0x000003d8] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 ++/* [0x000003e0] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 ++/* [0x000003e8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x000003f0] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 ++/* [0x000003f8] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 ++/* [0x00000400] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 ++/* [0x00000408] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 ++/* [0x00000410] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 ++/* [0x00000418] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 ++/* [0x00000420] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 ++/* [0x00000428] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 ++/* [0x00000430] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 ++/* [0x00000438] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 ++/* [0x00000440] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 ++/* [0x00000448] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 ++/* [0x00000450] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 ++/* [0x00000458] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 ++/* [0x00000460] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 ++/* [0x00000468] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 ++/* [0x00000470] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 ++/* [0x00000478] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 ++/* [0x00000480] */ 0x15267d80, 0x10020227, // mov ra8, ra9 ++/* [0x00000488] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 ++/* [0x00000490] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 ++/* [0x00000498] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 ++/* [0x000004a0] */ 0x15367d80, 0x10020327, // mov ra12, ra13 ++/* [0x000004a8] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 ++/* [0x000004b0] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 ++/* [0x000004b8] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop ++/* [0x000004c0] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 ++/* [0x000004c8] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop ++/* [0x000004d0] */ 0x009e7000, 0x100009e7, // nop ; nop ++/* [0x000004d8] */ 0x4038e037, 0x100049e1, // nop ; mul24 r1, ra14, rb14 ++/* [0x000004e0] */ 0x4034d037, 0x100049e0, // nop ; mul24 r0, ra13, rb13 ++/* [0x000004e8] */ 0x4c30c237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb12 ++/* [0x000004f0] */ 0x4c2cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb11 ++/* [0x000004f8] */ 0x4c28a237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb10 ++/* [0x00000500] */ 0x4c249237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb9 ++/* [0x00000508] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 ++/* [0x00000510] */ 0x4c3cf237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb15 ++/* [0x00000518] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait ++/* [0x00000520] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 ++/* [0x00000528] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 ++/* [0x00000530] */ 0x0c567380, 0x10020867, // add r1, r1, ra21 ++/* [0x00000538] */ 0xfffffe40, 0xf06809e7, // brr.anyn -, r:uvloop ++/* [0x00000540] */ 0x0f9c63c0, 0xd0020867, // asr r1, r1, 6 ++/* [0x00000548] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 ++/* [0x00000550] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 ++/* [0x00000558] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 ++/* [0x00000560] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 ++/* [0x00000568] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif ++/* [0x00000570] */ 0x00000010, 0xe0020827, // mov r0, 16 ++/* [0x00000578] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x00000580] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 ++/* [0x00000588] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 ++/* [0x00000590] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 ++/* [0x00000598] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif + // ::mc_filter_uv_b +-/* [0x00001498] */ 0x15827d80, 0x100207e7, // mov ra31, unif +-/* [0x000014a0] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next +-/* [0x000014a8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num +-/* [0x000014b0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif +-/* [0x000014b8] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif +-/* [0x000014c0] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 +-/* [0x000014c8] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 +-/* [0x000014d0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 +-/* [0x000014d8] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 +-/* [0x000014e0] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 +-/* [0x000014e8] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 +-/* [0x000014f0] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 +-/* [0x000014f8] */ 0x00000010, 0xe00208a7, // mov r2, 16 +-/* [0x00001500] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00001508] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 +-/* [0x00001510] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 +-/* [0x00001518] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 +-/* [0x00001520] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 +-/* [0x00001528] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 +-/* [0x00001530] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 +-/* [0x00001538] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 +-/* [0x00001540] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 +-/* [0x00001548] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 +-/* [0x00001550] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 +-/* [0x00001558] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 +-/* [0x00001560] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 +-/* [0x00001568] */ 0x0c9dc7c0, 0x10020c67, // add vr_setup, r3, rb28 +-/* [0x00001570] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 +-/* [0x00001578] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00001580] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00001588] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00001590] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00001598] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif +-/* [0x000015a0] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000015a8] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000015b0] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000015b8] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif +-/* [0x000015c0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000015c8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000015d0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000015d8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif +-/* [0x000015e0] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000015e8] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000015f0] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000015f8] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 +-/* [0x00001600] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 +-/* [0x00001608] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-/* [0x00001610] */ 0x00000000, 0xe00208e7, // mov r3, 0 ++/* [0x000005a0] */ 0x15827d80, 0x100207e7, // mov ra31, unif ++/* [0x000005a8] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next ++/* [0x000005b0] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num ++/* [0x000005b8] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif ++/* [0x000005c0] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif ++/* [0x000005c8] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 ++/* [0x000005d0] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 ++/* [0x000005d8] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 ++/* [0x000005e0] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 ++/* [0x000005e8] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 ++/* [0x000005f0] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 ++/* [0x000005f8] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 ++/* [0x00000600] */ 0x00000010, 0xe00208a7, // mov r2, 16 ++/* [0x00000608] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000610] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 ++/* [0x00000618] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 ++/* [0x00000620] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 ++/* [0x00000628] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 ++/* [0x00000630] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 ++/* [0x00000638] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 ++/* [0x00000640] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 ++/* [0x00000648] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 ++/* [0x00000650] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 ++/* [0x00000658] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 ++/* [0x00000660] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 ++/* [0x00000668] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 ++/* [0x00000670] */ 0x0c9dc7c0, 0x10020c67, // add vr_setup, r3, rb28 ++/* [0x00000678] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 ++/* [0x00000680] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000688] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000690] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000698] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000006a0] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif ++/* [0x000006a8] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000006b0] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000006b8] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000006c0] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif ++/* [0x000006c8] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000006d0] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000006d8] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000006e0] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif ++/* [0x000006e8] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000006f0] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000006f8] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000700] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 ++/* [0x00000708] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 ++/* [0x00000710] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x00000718] */ 0x00000000, 0xe00208e7, // mov r3, 0 + // :uvloop_b +-/* [0x00001618] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 +-/* [0x00001620] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 +-/* [0x00001628] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 +-/* [0x00001630] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch +-/* [0x00001638] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 +-/* [0x00001640] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 +-/* [0x00001648] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 +-/* [0x00001650] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 +-/* [0x00001658] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 +-/* [0x00001660] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 +-/* [0x00001668] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-/* [0x00001670] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 +-/* [0x00001678] */ 0x40038031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra0 << 8, r1 << 8 +-/* [0x00001680] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 +-/* [0x00001688] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 +-/* [0x00001690] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 +-/* [0x00001698] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 +-/* [0x000016a0] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 +-/* [0x000016a8] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 +-/* [0x000016b0] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 +-/* [0x000016b8] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 +-/* [0x000016c0] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 +-/* [0x000016c8] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 +-/* [0x000016d0] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 +-/* [0x000016d8] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 +-/* [0x000016e0] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 +-/* [0x000016e8] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 +-/* [0x000016f0] */ 0x0d9e74c0, 0x10020827, // sub r0, r2, r3 +-/* [0x000016f8] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 +-/* [0x00001700] */ 0x15267d80, 0x10020227, // mov ra8, ra9 +-/* [0x00001708] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 +-/* [0x00001710] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 +-/* [0x00001718] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 +-/* [0x00001720] */ 0x15367d80, 0x10020327, // mov ra12, ra13 +-/* [0x00001728] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 +-/* [0x00001730] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 +-/* [0x00001738] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop_b +-/* [0x00001740] */ 0x533c0dc1, 0xd00243a0, // max ra14, ra15, 0 ; mul24 r0, r0, r1 +-/* [0x00001748] */ 0x8f54f1f6, 0xd0024821, // asr r0, r0, 15 ; mov r1, ra21 +-/* [0x00001750] */ 0x129d61c0, 0x100223e7, // min.setf ra15, r0, rb22 +-/* [0x00001758] */ 0x4038e037, 0x100049e0, // nop ; mul24 r0, ra14, rb14 +-/* [0x00001760] */ 0x4d34d237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra13, rb13 +-/* [0x00001768] */ 0x4d30c237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra12, rb12 +-/* [0x00001770] */ 0x4d2cb237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra11, rb11 +-/* [0x00001778] */ 0x4d28a237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra10, rb10 +-/* [0x00001780] */ 0x4d249237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra9, rb9 +-/* [0x00001788] */ 0x4d208237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra8, rb8 +-/* [0x00001790] */ 0x4d3cf237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra15, rb15 +-/* [0x00001798] */ 0x8d9f223f, 0x100a0867, // sub.ifnn r1, r1, r0 ; mov -, vw_wait +-/* [0x000017a0] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 +-/* [0x000017a8] */ 0x0f9cf3c0, 0xd0020867, // asr r1, r1, 15 +-/* [0x000017b0] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 +-/* [0x000017b8] */ 0x0cc01dc0, 0xd0020827, // add r0, vpm, 1 +-/* [0x000017c0] */ 0xfffffe38, 0xf06809e7, // brr.anyn -, r:uvloop_b +-/* [0x000017c8] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 +-/* [0x000017d0] */ 0x0c9e7200, 0x10020867, // add r1, r1, r0 +-/* [0x000017d8] */ 0x0e9c13c0, 0xd0020c27, // shr vpm, r1, 1 +-/* [0x000017e0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 +-/* [0x000017e8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 +-/* [0x000017f0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif +-/* [0x000017f8] */ 0x00000010, 0xe0020827, // mov r0, 16 +-/* [0x00001800] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait +-/* [0x00001808] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 +-/* [0x00001810] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 +-/* [0x00001818] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 +-/* [0x00001820] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif ++/* [0x00000720] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 ++/* [0x00000728] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 ++/* [0x00000730] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 ++/* [0x00000738] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch ++/* [0x00000740] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 ++/* [0x00000748] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 ++/* [0x00000750] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 ++/* [0x00000758] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 ++/* [0x00000760] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 ++/* [0x00000768] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 ++/* [0x00000770] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x00000778] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 ++/* [0x00000780] */ 0x40038031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra0 << 8, r1 << 8 ++/* [0x00000788] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 ++/* [0x00000790] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 ++/* [0x00000798] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 ++/* [0x000007a0] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 ++/* [0x000007a8] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 ++/* [0x000007b0] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 ++/* [0x000007b8] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 ++/* [0x000007c0] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 ++/* [0x000007c8] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 ++/* [0x000007d0] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 ++/* [0x000007d8] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 ++/* [0x000007e0] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 ++/* [0x000007e8] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 ++/* [0x000007f0] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 ++/* [0x000007f8] */ 0x0d9e74c0, 0x10020827, // sub r0, r2, r3 ++/* [0x00000800] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 ++/* [0x00000808] */ 0x15267d80, 0x10020227, // mov ra8, ra9 ++/* [0x00000810] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 ++/* [0x00000818] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 ++/* [0x00000820] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 ++/* [0x00000828] */ 0x15367d80, 0x10020327, // mov ra12, ra13 ++/* [0x00000830] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 ++/* [0x00000838] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 ++/* [0x00000840] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop_b ++/* [0x00000848] */ 0x533c0dc1, 0xd00243a0, // max ra14, ra15, 0 ; mul24 r0, r0, r1 ++/* [0x00000850] */ 0x8f54f1f6, 0xd0024821, // asr r0, r0, 15 ; mov r1, ra21 ++/* [0x00000858] */ 0x129d61c0, 0x100223e7, // min.setf ra15, r0, rb22 ++/* [0x00000860] */ 0x4038e037, 0x100049e0, // nop ; mul24 r0, ra14, rb14 ++/* [0x00000868] */ 0x4d34d237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra13, rb13 ++/* [0x00000870] */ 0x4d30c237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra12, rb12 ++/* [0x00000878] */ 0x4d2cb237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra11, rb11 ++/* [0x00000880] */ 0x4d28a237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra10, rb10 ++/* [0x00000888] */ 0x4d249237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra9, rb9 ++/* [0x00000890] */ 0x4d208237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra8, rb8 ++/* [0x00000898] */ 0x4d3cf237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra15, rb15 ++/* [0x000008a0] */ 0x8d9f223f, 0x100a0867, // sub.ifnn r1, r1, r0 ; mov -, vw_wait ++/* [0x000008a8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 ++/* [0x000008b0] */ 0x0f9cf3c0, 0xd0020867, // asr r1, r1, 15 ++/* [0x000008b8] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 ++/* [0x000008c0] */ 0x0cc01dc0, 0xd0020827, // add r0, vpm, 1 ++/* [0x000008c8] */ 0xfffffe38, 0xf06809e7, // brr.anyn -, r:uvloop_b ++/* [0x000008d0] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 ++/* [0x000008d8] */ 0x0c9e7200, 0x10020867, // add r1, r1, r0 ++/* [0x000008e0] */ 0x0e9c13c0, 0xd0020c27, // shr vpm, r1, 1 ++/* [0x000008e8] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 ++/* [0x000008f0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 ++/* [0x000008f8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif ++/* [0x00000900] */ 0x00000010, 0xe0020827, // mov r0, 16 ++/* [0x00000908] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x00000910] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 ++/* [0x00000918] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 ++/* [0x00000920] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 ++/* [0x00000928] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif ++// ::mc_exit ++/* [0x00000930] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x00000938] */ 0x00000000, 0xe80009e7, // mov -,srel(0) ++/* [0x00000940] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00000948] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00000950] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00000958] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00000960] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend ++/* [0x00000968] */ 0x009e7000, 0x100009e7, // nop ; nop ++/* [0x00000970] */ 0x009e7000, 0x100009e7, // nop ; nop ++// ::mc_interrupt_exit8 ++/* [0x00000978] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x00000980] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00000988] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00000990] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00000998] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x000009a0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x000009a8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x000009b0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x000009b8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x000009c0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x000009c8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x000009d0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x000009d8] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend ++/* [0x000009e0] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop ++/* [0x000009e8] */ 0x009e7000, 0x100009e7, // nop ; nop + // ::mc_end + }; + #ifdef __HIGHC__ +diff --git a/libavcodec/rpi_shader.h b/libavcodec/rpi_shader.h +index 3464cdb..9de4535 100644 +--- a/libavcodec/rpi_shader.h ++++ b/libavcodec/rpi_shader.h +@@ -3,18 +3,11 @@ + + extern unsigned int rpi_shader[]; + +-#define mc_setup (rpi_shader + 0) +-#define mc_filter_uv (rpi_shader + 146) +-#define mc_filter (rpi_shader + 364) +-#define mc_filter_b (rpi_shader + 674) +-#define mc_filter_honly (rpi_shader + 898) +-#define mc_exit (rpi_shader + 1052) +-#define mc_exit1 (rpi_shader + 1070) +-#define mc_interrupt_exit (rpi_shader + 1086) +-#define mc_interrupt_exit4 (rpi_shader + 1124) +-#define mc_interrupt_exit8 (rpi_shader + 1146) +-#define mc_setup_uv (rpi_shader + 1176) +-#define mc_filter_uv_b (rpi_shader + 1318) +-#define mc_end (rpi_shader + 1546) ++#define mc_setup_uv (rpi_shader + 0) ++#define mc_filter_uv (rpi_shader + 142) ++#define mc_filter_uv_b (rpi_shader + 360) ++#define mc_exit (rpi_shader + 588) ++#define mc_interrupt_exit8 (rpi_shader + 606) ++#define mc_end (rpi_shader + 636) + + #endif +diff --git a/libavcodec/rpi_shader.qasm b/libavcodec/rpi_shader.qasm +index 4809e1d..cd7346d 100644 +--- a/libavcodec/rpi_shader.qasm ++++ b/libavcodec/rpi_shader.qasm +@@ -71,8 +71,10 @@ + + .set rb_const_64, rb21 + +-# mc_setup(next_kernel, x, y, ref_base, frame_width, frame_height, pitch, dst_pitch, pad0, pad1) +-::mc_setup ++ ++################################################################################ ++# mc_setup_uv(next_kernel, x, y, ref_u_base, ref_v_base, frame_width, frame_height, pitch, dst_pitch, pad0, pad1, pad2) ++::mc_setup_uv + + # Read starting kernel + mov ra31, unif +@@ -80,7 +82,9 @@ mov ra31, unif + # Load first request location + add ra_x_base, unif, elem_num # Store x + mov ra_y, unif # Store y +-mov ra_x2_base, unif # Store frame base ++mov ra_x2_base, unif # Store frame u base ++nop ++sub ra_u2v_ref_offset, unif, ra_x2_base # Store offset to add to move from u to v in reference frame + + # Read image dimensions + sub rb25,unif,1 +@@ -143,29 +147,24 @@ mov r1, vpm_setup(0, 4, h8p(0, 0)) + add rb28, r0, r1 + + # Compute base address for first and second access +-#add r0, unif, elem_num # x + mov r0, ra_x_base # Load x +-add r2, r0, 8 # x+8 + max r0, r0, 0; mov r1, ra_y # Load y + min r0, r0, rb_frame_width_minus_1 ; mov r3, ra_x2_base # Load the frame base +-shl ra_xshift_next, r0, 3 +-max r2, r2, 0 ++shl ra_xshift_next, r0, 3 ; mov r2, ra_u2v_ref_offset + add ra_y, r1, 1 +-min r2, r2, rb_frame_width_minus_1 +-shl ra_x2shift_next, r2, 3 +-max r1, r1, 0 # y +-min r1, r1, rb_frame_height_minus_1 +-add r0, r0, r3; mul24 r1, r1, rb_pitch +-add r2, r2, r3 ++add r0, r0, r3 + and r0, r0, ~3 +-and r2, r2, ~3; mov ra_x_base, r0 ++max r1, r1, 0 ; mov ra_x_base, r0 # y ++min r1, r1, rb_frame_height_minus_1 + # submit texture requests for first line ++add r2, r2, r0 ; mul24 r1, r1, rb_pitch + add t0s, r0, r1 ; mov ra_x2_base, r2 + add t0s, r2, r1 + + # Dump padding words + mov r0, unif + mov r0, unif ++mov r0, unif + + # submit texture requests for second line + max r1, ra_y, 0 +@@ -176,6 +175,8 @@ nop ; mul24 r1, r1, rb_pitch + add t0s, r1, ra_x_base + add t0s, r1, ra_x2_base + ++ ++ + ################################################################################ + + # mc_filter_uv(next_kernel, x, y, frame_u_base, frame_v_base, height, hcoeffs[0], hcoeffs[1], vcoeffs[0], vcoeffs[1], this_u_dst, this_v_dst) +@@ -341,453 +342,26 @@ add vw_setup, rb26, r0 # VDW setup 0 + mov vw_setup, rb29 # Stride + mov vw_addr, unif # start the VDW + +-################################################################################ +- +- +-# mc_filter(next_kernel, x, y, frame_base, height, hcoeffs[0], hcoeffs[1], vcoeffs[0], vcoeffs[1], this_dst) +- +-# At this point we have already issued two pairs of texture requests for the current block +-# ra_x_base, ra_x16_base point to the current coordinates for this block +-::mc_filter +-mov ra31, unif +- +-# per-channel shifts were calculated on the *previous* invocation +- +-mov ra_xshift, ra_xshift_next +-mov ra_x2shift, ra_x2shift_next +- +-# get base addresses and per-channel shifts for *next* invocation +-add r0, unif, elem_num # x +-add r2, r0, 8 # x+8 +-max r0, r0, 0; mov r1, unif # y +-min r0, r0, rb_frame_width_minus_1 ; mov r3,unif # frame_base +-shl ra_xshift_next, r0, 3 +-max r2, r2, 0 +-min r2, r2, rb_frame_width_minus_1 +-shl ra_x2shift_next, r2, 3 +-add r0, r0, r3 +-add r2, r2, r3 +-and rb_x_base_next, r0, ~3 +-and ra_x2_base_next, r2, ~3 +-mov ra_y_next, r1 +- +-# set up VPM write +-mov vw_setup, rb28 +- +-# get width,height of block +-mov r2, 16 +-mov r0, unif +-shr r1, r0, r2 # Extract width +-sub rb29, rb24, r1 # Compute vdw_setup1(dst_pitch-width) +-and r0, r0, rb22 # Extract height +-add rb17, r0, 5 +-add rb18, r0, 7 +-shl r0, r0, 7 +-add r0, r0, r1 # Combine width and height of destination area +-shl r0, r0, r2 # Shift into bits 16 upwards of the vdw_setup0 register +-add rb26, r0, rb27 +- +-sub.setf -,8,r1 # 8-r1, so if <0 (negative) we need to use the full code +- +-# get filter coefficients +- +-mov r0, unif +-asr ra3, r0, rb23; mul24 r0, r0, ra22 +-asr ra2, r0, rb23; mul24 r0, r0, ra22 +-asr ra1, r0, rb23; mul24 r0, r0, ra22 +-asr ra0, r0, rb23; mov r0, unif +-asr ra7, r0, rb23; mul24 r0, r0, ra22 +-asr ra6, r0, rb23; mul24 r0, r0, ra22 +-asr ra5, r0, rb23; mul24 r0, r0, ra22 +-asr ra4, r0, rb23; mov r0, unif +-asr rb11, r0, rb23; mul24 r0, r0, ra22 +-asr rb10, r0, rb23; mul24 r0, r0, ra22 +-asr rb9, r0, rb23; mul24 r0, r0, ra22 +-asr rb8, r0, rb23; mov r0, unif +-asr rb15, r0, rb23; mul24 r0, r0, ra22 +-asr rb14, r0, rb23; mul24 r0, r0, ra22 +-asr rb13, r0, rb23; mul24 r0, r0, ra22 +-brr.anynn -, r:fast_path +-asr rb12, r0, rb23 # delay slot 1 +- +-# r2 is elem_num +-# r3 is loop counter +- +-mov r5rep, -8 # delay slot 2 +- +-mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] # delay slot 3 +- +-# retrieve texture results and pick out bytes +-# then submit two more texture requests +- +-## nop ; ldtmu0 # loop counter increment +-## shr r0, r4, ra17 ; ldtmu0 +-## shr r1, r4, ra17 ; v8subs r0, r0, rb20 +-## add t0s, ra16, r5 ; v8subs r1, r1, rb20 +-## add ra16, ra16, rb16 ; mov t0s, ra16 +-## +-## # generate seven shifted versions +-## # interleave with scroll of vertical context +-## +-## mov r2, rb21 ; mul24 r3, r0, ra0 +-## sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 +-## nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 +-## sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 +-## nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 +-## sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 +-## nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 +-## sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 +-## nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 +-## sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 +-## nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 +-## sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 +-## nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 +-## sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 +-## nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 +-## sub r2, r2, r3 ; ldtmu0 +-## +-## mov r0, ra22 +-## shr r0, r4, ra17 ; mul24 r2, r2, r0 ; ldtmu0 +-## shr r1, r4, ra17 ; v8subs r0, r0, rb20 +-## add t0s, ra16, r5 ; v8subs r1, r1, rb20 +-## add ra16, ra16, rb16 ; mov t0s, ra16 +-## +-## # apply horizontal filter +-## +-## asr r2, r2, 15 ; mul24 r3, r0, ra0 +-## min r2, r2, rb22 +-## max ra13, r2, 0 +-## +-## # generate seven shifted versions +-## # interleave with scroll of vertical context +-## +-## mov r2, rb21 +-## sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 +-## nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 +-## sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 +-## nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 +-## sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 +-## nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 +-## sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 +-## nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 +-## sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 +-## nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 +-## sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 +-## nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 +-## sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 +-## nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 +-## sub r0, r2, r3 +-## +-## # apply horizontal filter +-## +-## nop ; mul24 r0, r0, ra22 # last bit of context scroll, including clamp to zero +-## asr r0, r0, 15 +-## min r0, r0, rb22 +-## max ra14, r0, 0 +-## +-## +-## +-## +-## nop ; ldtmu0 # loop counter increment +-## shr r0, r4, ra17 ; ldtmu0 +-## shr r1, r4, ra17 ; v8subs r0, r0, rb20 +-## add t0s, ra16, r5 ; v8subs r1, r1, rb20 +-## add ra16, ra16, rb16 ; mov t0s, ra16 +-## +-## # generate seven shifted versions +-## # interleave with scroll of vertical context +-## +-## mov r2, rb21 ; mul24 r3, r0, ra0 +-## sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 +-## nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 +-## sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 +-## nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 +-## sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 +-## nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 +-## sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 +-## nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 +-## sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 +-## nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 +-## sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 +-## nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 +-## sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 +-## nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 +-## sub r0, r2, r3 +-## +-## # apply horizontal filter +-## +-## nop ; mul24 r0, r0, ra22 # last bit of context scroll, including clamp to zero +-## asr r0, r0, 15 +-## min r0, r0, rb22 +-## max ra15, r0, 0 +- +- +- +- +-mov r3, 0 +- +-:loop +-# retrieve texture results and pick out bytes +-# then submit two more texture requests +- +-sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 # loop counter increment +-shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 +-mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 +-mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch +-shr r1, r4, ra_x2shift ; v8subs r0, r0, rb20 # v8subs masks out all but bottom byte +- +-max r2, ra_y, 0 # y +-min r2, r2, rb_frame_height_minus_1 +-add ra_y, ra_y, 1 ; mul24 r2, r2, r3 +-add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 +-add t0s, ra_x2_base, r2 +- +-# generate seven shifted versions +-# interleave with scroll of vertical context +- +-mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +- +-mov r2, rb21 ; mul24 r3, r0, ra0 +-sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 +-nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 +-sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 +-nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 +-sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 +-nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 +-sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 +-nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 +-sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 +-nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 +-sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 +-nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 +-sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 +-nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 +-sub r0, r2, r3 +- +-mov r3, rb31 +- +-mov ra8, ra9 +-mov ra9, ra10 +-mov ra10, ra11 +-mov ra11, ra12 +-mov ra12, ra13 +-mov ra13, ra14 +- +-sub.setf -, r3, 8 ; mov r1, ra22 +- +-# apply horizontal filter +-brr.anyn -, r:loop +-max ra14, ra15, 0 ; mul24 r0, r0, r1 # last bit of context scroll, including clamp to zero +-asr r0, r0, 15 ; mov r1, ra21 +-min.setf ra15, r0, rb22 +- +-# apply vertical filter and write to VPM +- +-nop ; mul24 r0, ra14, rb14 +-sub r1, r1, r0 ; mul24 r0, ra13, rb13 +-sub r1, r1, r0 ; mul24 r0, ra12, rb12 +-sub r1, r1, r0 ; mul24 r0, ra11, rb11 +-sub r1, r1, r0 ; mul24 r0, ra10, rb10 +-sub r1, r1, r0 ; mul24 r0, ra9, rb9 +-sub r1, r1, r0 ; mul24 r0, ra8, rb8 +-sub r1, r1, r0 ; mul24 r0, ra15, rb15 +-sub.ifnn r1, r1, r0 ; mov -, vw_wait +-sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 +-brr.anyn -, r:loop +-asr r1, r1, 15 +-min r1, r1, rb22 +-max vpm, r1, 0 +- +-# DMA out +- +-bra -, ra31 +-mov vw_setup, rb26 # VDW: height rows, 16 8-bit units long +-mov vw_setup, rb29 +-mov vw_addr, unif # start the VDW +- +-#################################################### +- +-:fast_path +-## nop ; ldtmu0 # loop counter increment +-## shr r0, r4, ra17 ; ldtmu0 +-## shr r1, r4, ra17 ; v8subs r0, r0, rb20 +-## add t0s, ra16, r5 ; v8subs r1, r1, rb20 +-## add ra16, ra16, rb16 ; mov t0s, ra16 +-## +-## # generate seven shifted versions +-## # interleave with scroll of vertical context +-## +-## mov r2, rb21 ; mul24 r3, r0, ra0 +-## sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 +-## sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 +-## sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 +-## sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 +-## sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 +-## sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 +-## sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 +-## sub r2, r2, r3 ; ldtmu0 +-## +-## mov r0, ra22 +-## shr r0, r4, ra17 ; mul24 r2, r2, r0 ; ldtmu0 +-## shr r1, r4, ra17 ; v8subs r0, r0, rb20 +-## add t0s, ra16, r5 ; v8subs r1, r1, rb20 +-## add ra16, ra16, rb16 ; mov t0s, ra16 +-## +-## # apply horizontal filter +-## +-## asr r2, r2, 15 ; mul24 r3, r0, ra0 +-## min r2, r2, rb22 +-## max ra13, r2, 0 +-## +-## # generate seven shifted versions +-## # interleave with scroll of vertical context +-## +-## mov r2, rb21 +-## sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 +-## sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 +-## sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 +-## sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 +-## sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 +-## sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 +-## sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 +-## sub r0, r2, r3 +-## +-## # apply horizontal filter +-## +-## nop ; mul24 r0, r0, ra22 # last bit of context scroll, including clamp to zero +-## asr r0, r0, 15 +-## min r0, r0, rb22 +-## max ra14, r0, 0 +-## +-## +-## +-## +-## nop ; ldtmu0 # loop counter increment +-## shr r0, r4, ra17 ; ldtmu0 +-## shr r1, r4, ra17 ; v8subs r0, r0, rb20 +-## add t0s, ra16, r5 ; v8subs r1, r1, rb20 +-## add ra16, ra16, rb16 ; mov t0s, ra16 +-## +-## # generate seven shifted versions +-## # interleave with scroll of vertical context +-## +-## mov r2, rb21 ; mul24 r3, r0, ra0 +-## sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 +-## sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 +-## sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 +-## sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 +-## sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 +-## sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 +-## sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 +-## sub r0, r2, r3 +-## +-## # apply horizontal filter +-## +-## nop ; mul24 r0, r0, ra22 # last bit of context scroll, including clamp to zero +-## asr r0, r0, 15 +-## min r0, r0, rb22 +-## max ra15, r0, 0 +- +- +-mov r3, 0 # This signifies the amount of unrolling +- +-:fast_loop +-# retrieve texture results and pick out bytes +-# then submit two more texture requests +- +-# Due to pipelining we can only skip second pipeline instructions related to the fetched pixels +-sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 # loop counter increment +-shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 +-mov.ifz ra_y, ra_y_next ; mov rb31, r3 +-mov.ifz ra_x2_base, ra_x2_base_next ; mov r3, rb_pitch +- +-max r2, ra_y, 0 +-min r2, r2, rb_frame_height_minus_1 ; mov r1, r4 # discard texture read +-add ra_y, ra_y, 1 ; mul24 r2, r2, r3 +-add t0s, ra_x_base, r2 ; v8subs r0, r0, rb20 +-add t0s, ra_x2_base, r2 +- +-# generate seven shifted versions +-# interleave with scroll of vertical context +- +-mov r2, rb21 ; mul24 r3, r0, ra0 +-sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 +-sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 +-sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 +-sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 +-sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 +-sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 +-sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 +-sub r0, r2, r3 ; mov r3, rb31 +- +-mov ra8, ra9 +-mov ra9, ra10 +-mov ra10, ra11 +-mov ra11, ra12 +-mov ra12, ra13 +-mov ra13, ra14 +- +-sub.setf -, r3, 8 ; mov r1, ra22 +- +-# apply horizontal filter +- +-brr.anyn -, r:fast_loop +-max ra14, ra15, 0 ; mul24 r0, r0, r1 # last bit of context scroll, including clamp to zero +-asr r0, r0, 15 ; mov r1, ra21 +-min.setf ra15, r0, rb22 +- +-# apply vertical filter and write to VPM +- +-nop ; mul24 r0, ra14, rb14 +-sub r1, r1, r0 ; mul24 r0, ra13, rb13 +-sub r1, r1, r0 ; mul24 r0, ra12, rb12 +-sub r1, r1, r0 ; mul24 r0, ra11, rb11 +-sub r1, r1, r0 ; mul24 r0, ra10, rb10 +-sub r1, r1, r0 ; mul24 r0, ra9, rb9 +-sub r1, r1, r0 ; mul24 r0, ra8, rb8 +-sub r1, r1, r0 ; mul24 r0, ra15, rb15 +-sub.ifnn r1, r1, r0 ; mov -, vw_wait +-sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 +-brr.anyn -, r:fast_loop +-asr r1, r1, 15 +-min r1, r1, rb22 +-max vpm, r1, 0 +- +-# DMA out +- +-bra -, ra31 +-mov vw_setup, rb26 # VDW: height rows, 16 8-bit units long +-mov vw_setup, rb29 +-mov vw_addr, unif # start the VDW + + ################################################################################ + +-# mc_filter_b(next_kernel, x, y, frame_base, height, hcoeffs[0], hcoeffs[1], vcoeffs[0], vcoeffs[1], this_dst) +- +-# At this point we have already issued two pairs of texture requests for the current block +-# ra_x_base, ra_x16_base point to the current coordinates for this block +-::mc_filter_b ++::mc_filter_uv_b + mov ra31, unif + + # per-channel shifts were calculated on the *previous* invocation + + mov ra_xshift, ra_xshift_next +-mov ra_x2shift, ra_x2shift_next + + # get base addresses and per-channel shifts for *next* invocation + add r0, unif, elem_num # x +-add r2, r0, 8 # x+8 + max r0, r0, 0; mov r1, unif # y +-min r0, r0, rb_frame_width_minus_1 ; mov r3,unif # frame_base ++min r0, r0, rb_frame_width_minus_1 ; mov r3, unif # frame_base + shl ra_xshift_next, r0, 3 +-max r2, r2, 0 +-min r2, r2, rb_frame_width_minus_1 +-shl ra_x2shift_next, r2, 3 ++sub r2, unif, r3 # compute offset from frame base u to frame base v + add r0, r0, r3 +-add r2, r2, r3 + and rb_x_base_next, r0, ~3 +-and ra_x2_base_next, r2, ~3 + mov ra_y_next, r1 ++add ra_x2_base_next, rb_x_base_next, r2 + + # set up VPM write + mov vw_setup, rb28 +@@ -801,17 +375,22 @@ and r0, r0, rb22 # Extract height + add rb17, r0, 5 + add rb18, r0, 7 + shl r0, r0, 7 ++ + # r0 is currently height<<7 + # For vr_setup we want height<<20 (so 20-7=13 additional bits) + shl r3, r0, 13 + shl r3, r3, 8 # Mask off top 8 bits + shr r3, r3, 8 ++ + add r0, r0, r1 # Combine width and height of destination area + shl r0, r0, r2 # Shift into bits 16 upwards of the vdw_setup0 register + add rb26, r0, rb27 ++ + # In a B frame, so also set up VPM read + add vr_setup, r3, rb28 + ++sub.setf -,8,r1 # 8-r1, so if <0 (negative) we need to use the full code ++ + # get filter coefficients + + mov r0, unif +@@ -837,9 +416,13 @@ asr rb12, r0, rb23 + + mov r5rep, -8 + mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++ ++# retrieve texture results and pick out bytes ++# then submit two more texture requests ++ + mov r3, 0 + +-:bloop ++:uvloop_b + # retrieve texture results and pick out bytes + # then submit two more texture requests + +@@ -847,7 +430,7 @@ sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 + shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 + mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 + mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch +-shr r1, r4, ra_x2shift ; v8subs r0, r0, rb20 # v8subs masks out all but bottom byte ++shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 # v8subs masks out all but bottom byte + + max r2, ra_y, 0 # y + min r2, r2, rb_frame_height_minus_1 +@@ -861,6 +444,7 @@ add t0s, ra_x2_base, r2 + mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] + + mov r2, rb21 ; mul24 r3, r0, ra0 ++nop ; mul24.ifnz r3, ra0 << 8, r1 << 8 + sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 + nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 + sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 +@@ -889,7 +473,7 @@ mov ra13, ra14 + sub.setf -, r3, 8 ; mov r1, ra22 + + # apply horizontal filter +-brr.anyn -, r:bloop ++brr.anyn -, r:uvloop_b + max ra14, ra15, 0 ; mul24 r0, r0, r1 # last bit of context scroll, including clamp to zero + asr r0, r0, 15 ; mov r1, ra21 + min.setf ra15, r0, rb22 +@@ -906,213 +490,50 @@ sub r1, r1, r0 ; mul24 r0, ra8, rb8 + sub r1, r1, r0 ; mul24 r0, ra15, rb15 + sub.ifnn r1, r1, r0 ; mov -, vw_wait + sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 +-asr r1, r1, 15 ; mov -, vr_wait ++asr r1, r1, 15 + min r1, r1, rb22 + add r0, vpm, 1 # Blend in previous VPM contents at this location +-brr.anyn -, r:bloop ++brr.anyn -, r:uvloop_b + max r1, r1, 0 + add r1, r1, r0 + shr vpm, r1, 1 + +-# DMA out ++ ++# DMA out for U ++ ++mov vw_setup, rb26 # VDW setup 0 ++mov vw_setup, rb29 # Stride ++mov vw_addr, unif # start the VDW ++ ++# DMA out for V ++# We need to wait for the U to complete first, but have nothing useful to compute while we wait. ++# Could potentially push this write into the start of the next pipeline stage. ++mov r0, 16 ++mov -, vw_wait + + bra -, ra31 +-mov vw_setup, rb26 # VDW: height rows, 16 8-bit units long +-mov vw_setup, rb29 ++add vw_setup, rb26, r0 # VDW setup 0 ++mov vw_setup, rb29 # Stride + mov vw_addr, unif # start the VDW + + ################################################################################ + +-# mc_filter_honly(next_kernel, x, y, frame_base, height, hcoeffs[0], hcoeffs[1], vcoeffs[0], vcoeffs[1], this_dst) +-# This filter only does horizontal filtering. +-# It is assumed that the region to fetch does not include extra rows above. ++# mc_exit() + +-# At this point we have already issued two pairs of texture requests for the current block +-# ra_x_base, ra_x16_base point to the current coordinates for this block +-::mc_filter_honly +-mov ra31, unif ++::mc_exit ++mov -, vw_wait # wait on the VDW + +-# per-channel shifts were calculated on the *previous* invocation ++mov -,srel(0) + +-mov ra_xshift, ra_xshift_next +-mov ra_x2shift, ra_x2shift_next +- +-# get base addresses and per-channel shifts for *next* invocation +-add r0, unif, elem_num # x +-add r2, r0, 8 # x+8 +-max r0, r0, 0; mov r1, unif # y +-min r0, r0, rb_frame_width_minus_1 ; mov r3,unif # frame_base +-shl ra_xshift_next, r0, 3 +-max r2, r2, 0 +-min r2, r2, rb_frame_width_minus_1 +-shl ra_x2shift_next, r2, 3 +-add r0, r0, r3 +-add r2, r2, r3 +-and rb_x_base_next, r0, ~3 +-and ra_x2_base_next, r2, ~3 +-mov ra_y_next, r1 +- +-# set up VPM write +-mov vw_setup, rb28 +- +-# get width,height of block +-mov r2, 16 +-mov r0, unif +-shr r1, r0, r2 # Extract width +-sub rb29, rb24, r1 # Compute vdw_setup1(dst_pitch-width) +-and r0, r0, rb22 # Extract height +-add rb17, r0, -2 # Pipelining means we move data across 2 iterations early +-shl r0, r0, 7 ; mov rb18,r0 +-add r0, r0, r1 # Combine width and height of destination area +-shl r0, r0, r2 # Shift into bits 16 upwards of the vdw_setup0 register +-add rb26, r0, rb27 +- +-# get filter coefficients +- +-mov r0, unif +-asr ra3, r0, rb23; mul24 r0, r0, ra22 +-asr ra2, r0, rb23; mul24 r0, r0, ra22 +-asr ra1, r0, rb23; mul24 r0, r0, ra22 +-asr ra0, r0, rb23; mov r0, unif +-asr ra7, r0, rb23; mul24 r0, r0, ra22 +-asr ra6, r0, rb23; mul24 r0, r0, ra22 +-asr ra5, r0, rb23; mul24 r0, r0, ra22 +-asr ra4, r0, rb23; mov r0, unif +-mov r0, unif +- +-# r2 is elem_num +-# r3 is loop counter +-mov r5rep, -8 +-mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] # delay slot 3 +-mov r3, 0 +- +-:loop_honly +-# retrieve texture results and pick out bytes +-# then submit two more texture requests +- +-sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 # loop counter increment +-shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 +-mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 +-mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch +-shr r1, r4, ra_x2shift ; v8subs r0, r0, rb20 # v8subs masks out all but bottom byte +- +-max r2, ra_y, 0 # y +-min r2, r2, rb_frame_height_minus_1 +-add ra_y, ra_y, 1 ; mul24 r2, r2, r3 +-add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 +-add t0s, ra_x2_base, r2 +- +-# generate seven shifted versions +-# interleave with scroll of vertical context +- +-mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +- +-mov r2, rb21 ; mul24 r3, r0, ra0 +-sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 +-nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 +-sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 +-nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 +-sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 +-nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 +-sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 +-nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 +-sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 +-nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 +-sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 +-nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 +-sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 +-nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 +-sub r0, r2, r3 ; mov r3, rb31 +- +-sub.setf -, r3, rb18 ; mov r1, ra22 +- +-mov -, vw_wait ; mul24 r0, r0, r1 +-brr.anyn -, r:loop_honly +-asr r0, r0, 15 # delay 1 +-min r0, r0, rb22 # delay 2 +-max vpm, r0, 0 # delay 3 +- +-# DMA out +-bra -, ra31 +-mov vw_setup, rb26 # VDW: height rows, 16 8-bit units long +-mov vw_setup, rb29 +-mov vw_addr, unif # start the VDW +- +- +-################################################################################ +- +-# mc_exit() +- +-::mc_exit +-mov -, vw_wait # wait on the VDW +- +-mov -,srel(0) +- +-ldtmu0 +-ldtmu0 +-ldtmu0 +-ldtmu0 ++ldtmu0 ++ldtmu0 ++ldtmu0 ++ldtmu0 + + nop ; nop ; thrend + nop ; nop # delay slot 1 + nop ; nop # delay slot 2 + +-::mc_exit1 +-mov -, vw_wait # wait on the VDW +- +-#mov -,srel(1) +- +-ldtmu0 +-ldtmu0 +-ldtmu0 +-ldtmu0 +- +-nop ; nop ; thrend +-mov interrupt, 1; nop # delay slot 1 +-nop ; nop # delay slot 2 +- +-# mc_interrupt_exit() +-::mc_interrupt_exit +-mov -, vw_wait # wait on the VDW +- +-ldtmu0 +-ldtmu0 +-ldtmu0 +-ldtmu0 +- +-mov -,sacq(0) # 1 +-mov -,sacq(0) # 2 +-mov -,sacq(0) # 3 +-mov -,sacq(0) # 4 +-mov -,sacq(0) # 5 +-mov -,sacq(0) # 6 +-mov -,sacq(0) # 7 +-mov -,sacq(0) # 8 +-mov -,sacq(0) # 9 +-mov -,sacq(0) # 10 +-mov -,sacq(0) # 11 +- +-nop ; nop ; thrend +-mov interrupt, 1; nop # delay slot 1 +-nop ; nop # delay slot 2 +- +-# mc_interrupt_exit4() +-::mc_interrupt_exit4 +-mov -, vw_wait # wait on the VDW +- +-ldtmu0 +-ldtmu0 +-ldtmu0 +-ldtmu0 +- +-mov -,sacq(0) # 1 +-mov -,sacq(0) # 2 +-mov -,sacq(0) # 3 +- +-nop ; nop ; thrend +-mov interrupt, 1; nop # delay slot 1 +-nop ; nop # delay slot 2 +- + # mc_interrupt_exit8() + ::mc_interrupt_exit8 + mov -, vw_wait # wait on the VDW +@@ -1134,282 +555,5 @@ nop ; nop ; thrend + mov interrupt, 1; nop # delay slot 1 + nop ; nop # delay slot 2 + +-################################################################################ +-# mc_setup_uv(next_kernel, x, y, ref_u_base, ref_v_base, frame_width, frame_height, pitch, dst_pitch, pad0, pad1, pad2) +-::mc_setup_uv +- +-# Read starting kernel +-mov ra31, unif +- +-# Load first request location +-add ra_x_base, unif, elem_num # Store x +-mov ra_y, unif # Store y +-mov ra_x2_base, unif # Store frame u base +-nop +-sub ra_u2v_ref_offset, unif, ra_x2_base # Store offset to add to move from u to v in reference frame +- +-# Read image dimensions +-sub rb25,unif,1 +-sub rb30,unif,1 +- +-# get source pitch +-mov rb16, unif +- +-# get destination pitch +-mov r0, unif +-mov r1, vdw_setup_1(0) +-add rb24, r1, r0 +- +-# load constants +- +-mov ra20, 1 +-mov ra21, 32 +-mov ra22, 256 +-mov ra23, 8 +- +-mov rb20, 0xffffff00 +-mov rb21, 64 +-mov rb22, 255 +-mov rb23, 24 +- +-# touch vertical context to keep simulator happy +- +-mov ra8, 0 +-mov ra9, 0 +-mov ra10, 0 +-mov ra11, 0 +-mov ra12, 0 +-mov ra13, 0 +-mov ra14, 0 +-mov ra15, 0 +- +-# Compute part of VPM to use for DMA output +-mov r2, qpu_num +-and r2, r2, 15 +-mov r1, r2 +-asr r1, r1, 2 +-shl r1, r1, 6 +-mov r0, r2 +-and r0, r0, 3 +-add r0, r0, r1 +-mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) # height,width added later +-shl r0, r0, 5 +-add rb27, r0, r1 +- +-# Compute part of VPM to save data into +-mov r2, qpu_num +-and r2, r2, 15 +-mov r1, r2 +-asr r1, r1, 2 +-shl r1, r1, 6 +-mov r0, r2 +-and r0, r0, 3 +-add r0, r0, r1 +-mov r1, vpm_setup(0, 4, h8p(0, 0)) +-add rb28, r0, r1 +- +-# Compute base address for first and second access +-mov r0, ra_x_base # Load x +-max r0, r0, 0; mov r1, ra_y # Load y +-min r0, r0, rb_frame_width_minus_1 ; mov r3, ra_x2_base # Load the frame base +-shl ra_xshift_next, r0, 3 ; mov r2, ra_u2v_ref_offset +-add ra_y, r1, 1 +-add r0, r0, r3 +-and r0, r0, ~3 +-max r1, r1, 0 ; mov ra_x_base, r0 # y +-min r1, r1, rb_frame_height_minus_1 +-# submit texture requests for first line +-add r2, r2, r0 ; mul24 r1, r1, rb_pitch +-add t0s, r0, r1 ; mov ra_x2_base, r2 +-add t0s, r2, r1 +- +-# Dump padding words +-mov r0, unif +-mov r0, unif +-mov r0, unif +- +-# submit texture requests for second line +-max r1, ra_y, 0 +-min r1, r1, rb_frame_height_minus_1 +-add ra_y, ra_y, 1 +-bra -, ra31 +-nop ; mul24 r1, r1, rb_pitch +-add t0s, r1, ra_x_base +-add t0s, r1, ra_x2_base +- +- +- +-################################################################################ +- +-::mc_filter_uv_b +-mov ra31, unif +- +-# per-channel shifts were calculated on the *previous* invocation +- +-mov ra_xshift, ra_xshift_next +- +-# get base addresses and per-channel shifts for *next* invocation +-add r0, unif, elem_num # x +-max r0, r0, 0; mov r1, unif # y +-min r0, r0, rb_frame_width_minus_1 ; mov r3, unif # frame_base +-shl ra_xshift_next, r0, 3 +-sub r2, unif, r3 # compute offset from frame base u to frame base v +-add r0, r0, r3 +-and rb_x_base_next, r0, ~3 +-mov ra_y_next, r1 +-add ra_x2_base_next, rb_x_base_next, r2 +- +-# set up VPM write +-mov vw_setup, rb28 +- +-# get width,height of block +-mov r2, 16 +-mov r0, unif +-shr r1, r0, r2 # Extract width +-sub rb29, rb24, r1 # Compute vdw_setup1(dst_pitch-width) +-and r0, r0, rb22 # Extract height +-add rb17, r0, 5 +-add rb18, r0, 7 +-shl r0, r0, 7 +- +-# r0 is currently height<<7 +-# For vr_setup we want height<<20 (so 20-7=13 additional bits) +-shl r3, r0, 13 +-shl r3, r3, 8 # Mask off top 8 bits +-shr r3, r3, 8 +- +-add r0, r0, r1 # Combine width and height of destination area +-shl r0, r0, r2 # Shift into bits 16 upwards of the vdw_setup0 register +-add rb26, r0, rb27 +- +-# In a B frame, so also set up VPM read +-add vr_setup, r3, rb28 +- +-sub.setf -,8,r1 # 8-r1, so if <0 (negative) we need to use the full code +- +-# get filter coefficients +- +-mov r0, unif +-asr ra3, r0, rb23; mul24 r0, r0, ra22 +-asr ra2, r0, rb23; mul24 r0, r0, ra22 +-asr ra1, r0, rb23; mul24 r0, r0, ra22 +-asr ra0, r0, rb23; mov r0, unif +-asr ra7, r0, rb23; mul24 r0, r0, ra22 +-asr ra6, r0, rb23; mul24 r0, r0, ra22 +-asr ra5, r0, rb23; mul24 r0, r0, ra22 +-asr ra4, r0, rb23; mov r0, unif +-asr rb11, r0, rb23; mul24 r0, r0, ra22 +-asr rb10, r0, rb23; mul24 r0, r0, ra22 +-asr rb9, r0, rb23; mul24 r0, r0, ra22 +-asr rb8, r0, rb23; mov r0, unif +-asr rb15, r0, rb23; mul24 r0, r0, ra22 +-asr rb14, r0, rb23; mul24 r0, r0, ra22 +-asr rb13, r0, rb23; mul24 r0, r0, ra22 +-asr rb12, r0, rb23 +- +-# r2 is elem_num +-# r3 is loop counter +- +-mov r5rep, -8 +-mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +- +-# retrieve texture results and pick out bytes +-# then submit two more texture requests +- +-mov r3, 0 +- +-:uvloop_b +-# retrieve texture results and pick out bytes +-# then submit two more texture requests +- +-sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 # loop counter increment +-shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 +-mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 +-mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch +-shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 # v8subs masks out all but bottom byte +- +-max r2, ra_y, 0 # y +-min r2, r2, rb_frame_height_minus_1 +-add ra_y, ra_y, 1 ; mul24 r2, r2, r3 +-add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 +-add t0s, ra_x2_base, r2 +- +-# generate seven shifted versions +-# interleave with scroll of vertical context +- +-mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +- +-mov r2, rb21 ; mul24 r3, r0, ra0 +-nop ; mul24.ifnz r3, ra0 << 8, r1 << 8 +-sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 +-nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 +-sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 +-nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 +-sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 +-nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 +-sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 +-nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 +-sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 +-nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 +-sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 +-nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 +-sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 +-nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 +-sub r0, r2, r3 +- +-mov r3, rb31 +- +-mov ra8, ra9 +-mov ra9, ra10 +-mov ra10, ra11 +-mov ra11, ra12 +-mov ra12, ra13 +-mov ra13, ra14 +- +-sub.setf -, r3, 8 ; mov r1, ra22 +- +-# apply horizontal filter +-brr.anyn -, r:uvloop_b +-max ra14, ra15, 0 ; mul24 r0, r0, r1 # last bit of context scroll, including clamp to zero +-asr r0, r0, 15 ; mov r1, ra21 +-min.setf ra15, r0, rb22 +- +-# apply vertical filter and write to VPM +- +-nop ; mul24 r0, ra14, rb14 +-sub r1, r1, r0 ; mul24 r0, ra13, rb13 +-sub r1, r1, r0 ; mul24 r0, ra12, rb12 +-sub r1, r1, r0 ; mul24 r0, ra11, rb11 +-sub r1, r1, r0 ; mul24 r0, ra10, rb10 +-sub r1, r1, r0 ; mul24 r0, ra9, rb9 +-sub r1, r1, r0 ; mul24 r0, ra8, rb8 +-sub r1, r1, r0 ; mul24 r0, ra15, rb15 +-sub.ifnn r1, r1, r0 ; mov -, vw_wait +-sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 +-asr r1, r1, 15 +-min r1, r1, rb22 +-add r0, vpm, 1 # Blend in previous VPM contents at this location +-brr.anyn -, r:uvloop_b +-max r1, r1, 0 +-add r1, r1, r0 +-shr vpm, r1, 1 +- +- +-# DMA out for U +- +-mov vw_setup, rb26 # VDW setup 0 +-mov vw_setup, rb29 # Stride +-mov vw_addr, unif # start the VDW +- +-# DMA out for V +-# We need to wait for the U to complete first, but have nothing useful to compute while we wait. +-# Could potentially push this write into the start of the next pipeline stage. +-mov r0, 16 +-mov -, vw_wait +- +-bra -, ra31 +-add vw_setup, rb26, r0 # VDW setup 0 +-mov vw_setup, rb29 # Stride +-mov vw_addr, unif # start the VDW +- + ::mc_end ++# Do not add code here because mc_end must appear after all other code. +-- +2.5.0 + + +From b0d344c931394c7f734b12ab63b7067857f1a2b3 Mon Sep 17 00:00:00 2001 +From: Peter de Rivaz <peter.derivaz@gmail.com> +Date: Wed, 13 May 2015 14:54:25 +0100 +Subject: [PATCH 20/68] Moved chroma P1 to QPUs + +--- + libavcodec/hevc.c | 38 ++++++++++++++++++++++++++++++++++++++ + 1 file changed, 38 insertions(+) + +diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c +index b4a3707..4e9ac54 100644 +--- a/libavcodec/hevc.c ++++ b/libavcodec/hevc.c +@@ -2059,6 +2059,44 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, + s->sh.luma_offset_l1[current_mv.ref_idx[1]]); + + if (s->ps.sps->chroma_format_idc) { ++#ifdef RPI_INTER_QPU ++ if (s->enable_rpi) { ++ int reflist = 1; ++ int hshift = s->ps.sps->hshift[1]; ++ int vshift = s->ps.sps->vshift[1]; ++ const Mv *mv = &current_mv.mv[reflist]; ++ intptr_t mx = av_mod_uintp2(mv->x, 2 + hshift); ++ intptr_t my = av_mod_uintp2(mv->y, 2 + vshift); ++ intptr_t _mx = mx << (1 - hshift); ++ intptr_t _my = my << (1 - vshift); // Fractional part of motion vector ++ ++ int x1_c = x0_c + (mv->x >> (2 + hshift)); ++ int y1_c = y0_c + (mv->y >> (2 + hshift)); ++ //int chan = x0>>8; // Allocate commands for the first 256 luma pixels across to the first QPU. This is optimised for images around 1920 width ++ int chan = x0>>8; ++ ++ uint32_t *u = s->u_mvs[chan & 7]; ++ for(int start_y=0;start_y < nPbH_c;start_y+=16) { ++ for(int start_x=0;start_x < nPbW_c;start_x+=RPI_CHROMA_BLOCK_WIDTH) { ++ u++[-RPI_CHROMA_COMMAND_WORDS] = s->mc_filter_uv; ++ u++[-RPI_CHROMA_COMMAND_WORDS] = x1_c - 3 + start_x; ++ u++[-RPI_CHROMA_COMMAND_WORDS] = y1_c - 3 + start_y; ++ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[1]); ++ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[2]); ++ *u++ = ( (nPbW_c<RPI_CHROMA_BLOCK_WIDTH ? nPbW_c : RPI_CHROMA_BLOCK_WIDTH) << 16 ) + (nPbH_c<16 ? nPbH_c : 16); ++ // TODO chroma weight and offset... s->sh.chroma_weight_l0[current_mv.ref_idx[0]][0], s->sh.chroma_offset_l0[current_mv.ref_idx[0]][0] ++ *u++ = rpi_filter_coefs[_mx][0]; ++ *u++ = rpi_filter_coefs[_mx][1]; ++ *u++ = rpi_filter_coefs[_my][0]; ++ *u++ = rpi_filter_coefs[_my][1]; ++ *u++ = (get_vc_address(s->frame->buf[1]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[1]); ++ *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); ++ } ++ } ++ s->u_mvs[chan & 7] = u; ++ return; ++ } ++#endif + RPI_REDIRECT(chroma_mc_uni)(s, dst1, s->frame->linesize[1], ref1->frame->data[1], ref1->frame->linesize[1], + 1, x0_c, y0_c, nPbW_c, nPbH_c, &current_mv, + s->sh.chroma_weight_l1[current_mv.ref_idx[1]][0], s->sh.chroma_offset_l1[current_mv.ref_idx[1]][0]); +-- +2.5.0 + + +From 9e0a56b87c843033556835e00b562a76fa806f6e Mon Sep 17 00:00:00 2001 +From: Peter de Rivaz <peter.derivaz@gmail.com> +Date: Wed, 13 May 2015 15:13:47 +0100 +Subject: [PATCH 21/68] Added B prediction - not quite right + +--- + libavcodec/hevc.c | 58 ++++++++++++++++++++++++ + libavcodec/rpi_shader.c | 108 +++++++++++++++++++++++---------------------- + libavcodec/rpi_shader.h | 6 +-- + libavcodec/rpi_shader.qasm | 48 ++++++++++---------- + 4 files changed, 141 insertions(+), 79 deletions(-) + +diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c +index 4e9ac54..9a13fd4 100644 +--- a/libavcodec/hevc.c ++++ b/libavcodec/hevc.c +@@ -2116,6 +2116,64 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, + ref1->frame, &current_mv.mv[1], &current_mv); + + if (s->ps.sps->chroma_format_idc) { ++#ifdef RPI_INTER_QPU ++ if (s->enable_rpi) { ++ int hshift = s->ps.sps->hshift[1]; ++ int vshift = s->ps.sps->vshift[1]; ++ const Mv *mv = &current_mv.mv[0]; ++ intptr_t mx = av_mod_uintp2(mv->x, 2 + hshift); ++ intptr_t my = av_mod_uintp2(mv->y, 2 + vshift); ++ intptr_t _mx = mx << (1 - hshift); ++ intptr_t _my = my << (1 - vshift); // Fractional part of motion vector ++ int x1_c = x0_c + (mv->x >> (2 + hshift)); ++ int y1_c = y0_c + (mv->y >> (2 + hshift)); ++ ++ const Mv *mv2 = &current_mv.mv[1]; ++ intptr_t mx2 = av_mod_uintp2(mv2->x, 2 + hshift); ++ intptr_t my2 = av_mod_uintp2(mv2->y, 2 + vshift); ++ intptr_t _mx2 = mx2 << (1 - hshift); ++ intptr_t _my2 = my2 << (1 - vshift); // Fractional part of motion vector ++ ++ int x2_c = x0_c + (mv2->x >> (2 + hshift)); ++ int y2_c = y0_c + (mv2->y >> (2 + hshift)); ++ ++ int chan = x0>>8; // Allocate commands for the first 256 luma pixels across to the first QPU. This is optimised for images around 1920 width ++ ++ uint32_t *u = s->u_mvs[chan & 7]; ++ for(int start_y=0;start_y < nPbH_c;start_y+=16) { ++ for(int start_x=0;start_x < nPbW_c;start_x+=RPI_CHROMA_BLOCK_WIDTH) { ++ u++[-RPI_CHROMA_COMMAND_WORDS] = s->mc_filter_uv; ++ u++[-RPI_CHROMA_COMMAND_WORDS] = x1_c - 3 + start_x; ++ u++[-RPI_CHROMA_COMMAND_WORDS] = y1_c - 3 + start_y; ++ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[1]); ++ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[2]); ++ *u++ = ( (nPbW_c<RPI_CHROMA_BLOCK_WIDTH ? nPbW_c : RPI_CHROMA_BLOCK_WIDTH) << 16 ) + (nPbH_c<16 ? nPbH_c : 16); ++ *u++ = rpi_filter_coefs[_mx][0]; ++ *u++ = rpi_filter_coefs[_mx][1]; ++ *u++ = rpi_filter_coefs[_my][0]; ++ *u++ = rpi_filter_coefs[_my][1]; ++ *u++ = (get_vc_address(s->frame->buf[1]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[1]); // TODO this will become unused once we have a dedicated pass0 filter ++ *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); ++ ++ u++[-RPI_CHROMA_COMMAND_WORDS] = s->mc_filter_uv_b; ++ u++[-RPI_CHROMA_COMMAND_WORDS] = x2_c - 3 + start_x; ++ u++[-RPI_CHROMA_COMMAND_WORDS] = y2_c - 3 + start_y; ++ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[1]); ++ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[2]); ++ *u++ = ( (nPbW_c<RPI_CHROMA_BLOCK_WIDTH ? nPbW_c : RPI_CHROMA_BLOCK_WIDTH) << 16 ) + (nPbH_c<16 ? nPbH_c : 16); ++ // TODO chroma weight and offset... s->sh.chroma_weight_l0[current_mv.ref_idx[0]][0], s->sh.chroma_offset_l0[current_mv.ref_idx[0]][0] ++ *u++ = rpi_filter_coefs[_mx2][0]; ++ *u++ = rpi_filter_coefs[_mx2][1]; ++ *u++ = rpi_filter_coefs[_my2][0]; ++ *u++ = rpi_filter_coefs[_my2][1]; ++ *u++ = (get_vc_address(s->frame->buf[1]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[1]); ++ *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); ++ } ++ } ++ s->u_mvs[chan & 7] = u; ++ return; ++ } ++#endif + RPI_REDIRECT(chroma_mc_bi)(s, dst1, s->frame->linesize[1], ref0->frame, ref1->frame, + x0_c, y0_c, nPbW_c, nPbH_c, &current_mv, 0); + +diff --git a/libavcodec/rpi_shader.c b/libavcodec/rpi_shader.c +index 170e8ac..5d00cb2 100644 +--- a/libavcodec/rpi_shader.c ++++ b/libavcodec/rpi_shader.c +@@ -265,23 +265,23 @@ unsigned int rpi_shader[] = { + /* [0x00000760] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 + /* [0x00000768] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 + /* [0x00000770] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-/* [0x00000778] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 +-/* [0x00000780] */ 0x40038031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra0 << 8, r1 << 8 +-/* [0x00000788] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 ++/* [0x00000778] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 ++/* [0x00000780] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 ++/* [0x00000788] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 + /* [0x00000790] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 +-/* [0x00000798] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 ++/* [0x00000798] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 + /* [0x000007a0] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 +-/* [0x000007a8] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 ++/* [0x000007a8] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 + /* [0x000007b0] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 +-/* [0x000007b8] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 ++/* [0x000007b8] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 + /* [0x000007c0] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 +-/* [0x000007c8] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 ++/* [0x000007c8] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 + /* [0x000007d0] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 +-/* [0x000007d8] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 ++/* [0x000007d8] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 + /* [0x000007e0] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 +-/* [0x000007e8] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 ++/* [0x000007e8] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 + /* [0x000007f0] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 +-/* [0x000007f8] */ 0x0d9e74c0, 0x10020827, // sub r0, r2, r3 ++/* [0x000007f8] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 + /* [0x00000800] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 + /* [0x00000808] */ 0x15267d80, 0x10020227, // mov ra8, ra9 + /* [0x00000810] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 +@@ -291,61 +291,63 @@ unsigned int rpi_shader[] = { + /* [0x00000830] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 + /* [0x00000838] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 + /* [0x00000840] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop_b +-/* [0x00000848] */ 0x533c0dc1, 0xd00243a0, // max ra14, ra15, 0 ; mul24 r0, r0, r1 +-/* [0x00000850] */ 0x8f54f1f6, 0xd0024821, // asr r0, r0, 15 ; mov r1, ra21 +-/* [0x00000858] */ 0x129d61c0, 0x100223e7, // min.setf ra15, r0, rb22 +-/* [0x00000860] */ 0x4038e037, 0x100049e0, // nop ; mul24 r0, ra14, rb14 +-/* [0x00000868] */ 0x4d34d237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra13, rb13 +-/* [0x00000870] */ 0x4d30c237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra12, rb12 +-/* [0x00000878] */ 0x4d2cb237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra11, rb11 +-/* [0x00000880] */ 0x4d28a237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra10, rb10 +-/* [0x00000888] */ 0x4d249237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra9, rb9 +-/* [0x00000890] */ 0x4d208237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra8, rb8 +-/* [0x00000898] */ 0x4d3cf237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra15, rb15 +-/* [0x000008a0] */ 0x8d9f223f, 0x100a0867, // sub.ifnn r1, r1, r0 ; mov -, vw_wait ++/* [0x00000848] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 ++/* [0x00000850] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop ++/* [0x00000858] */ 0x009e7000, 0x100009e7, // nop ; nop ++/* [0x00000860] */ 0x4038e037, 0x100049e1, // nop ; mul24 r1, ra14, rb14 ++/* [0x00000868] */ 0x4034d037, 0x100049e0, // nop ; mul24 r0, ra13, rb13 ++/* [0x00000870] */ 0x4c30c237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb12 ++/* [0x00000878] */ 0x4c2cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb11 ++/* [0x00000880] */ 0x4c28a237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb10 ++/* [0x00000888] */ 0x4c249237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb9 ++/* [0x00000890] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 ++/* [0x00000898] */ 0x4c3cf237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb15 ++/* [0x000008a0] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait + /* [0x000008a8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 +-/* [0x000008b0] */ 0x0f9cf3c0, 0xd0020867, // asr r1, r1, 15 +-/* [0x000008b8] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 +-/* [0x000008c0] */ 0x0cc01dc0, 0xd0020827, // add r0, vpm, 1 +-/* [0x000008c8] */ 0xfffffe38, 0xf06809e7, // brr.anyn -, r:uvloop_b +-/* [0x000008d0] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 +-/* [0x000008d8] */ 0x0c9e7200, 0x10020867, // add r1, r1, r0 +-/* [0x000008e0] */ 0x0e9c13c0, 0xd0020c27, // shr vpm, r1, 1 +-/* [0x000008e8] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 +-/* [0x000008f0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 +-/* [0x000008f8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif +-/* [0x00000900] */ 0x00000010, 0xe0020827, // mov r0, 16 +-/* [0x00000908] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait +-/* [0x00000910] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 +-/* [0x00000918] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 +-/* [0x00000920] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 +-/* [0x00000928] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif ++/* [0x000008b0] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 ++/* [0x000008b8] */ 0x0c567380, 0x10020867, // add r1, r1, ra21 ++/* [0x000008c0] */ 0x0f9c63c0, 0xd0020867, // asr r1, r1, 6 ++/* [0x000008c8] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 ++/* [0x000008d0] */ 0x0cc01dc0, 0xd0020827, // add r0, vpm, 1 ++/* [0x000008d8] */ 0xfffffe28, 0xf06809e7, // brr.anyn -, r:uvloop_b ++/* [0x000008e0] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 ++/* [0x000008e8] */ 0x0c9e7200, 0x10020867, // add r1, r1, r0 ++/* [0x000008f0] */ 0x0e9c13c0, 0xd0020c27, // shr vpm, r1, 1 ++/* [0x000008f8] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 ++/* [0x00000900] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 ++/* [0x00000908] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif ++/* [0x00000910] */ 0x00000010, 0xe0020827, // mov r0, 16 ++/* [0x00000918] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x00000920] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 ++/* [0x00000928] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 ++/* [0x00000930] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 ++/* [0x00000938] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif + // ::mc_exit +-/* [0x00000930] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait +-/* [0x00000938] */ 0x00000000, 0xe80009e7, // mov -,srel(0) +-/* [0x00000940] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00000948] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00000940] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x00000948] */ 0x00000000, 0xe80009e7, // mov -,srel(0) + /* [0x00000950] */ 0x009e7000, 0xa00009e7, // ldtmu0 + /* [0x00000958] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00000960] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend +-/* [0x00000968] */ 0x009e7000, 0x100009e7, // nop ; nop +-/* [0x00000970] */ 0x009e7000, 0x100009e7, // nop ; nop ++/* [0x00000960] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00000968] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00000970] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend ++/* [0x00000978] */ 0x009e7000, 0x100009e7, // nop ; nop ++/* [0x00000980] */ 0x009e7000, 0x100009e7, // nop ; nop + // ::mc_interrupt_exit8 +-/* [0x00000978] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait +-/* [0x00000980] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00000988] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00000988] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait + /* [0x00000990] */ 0x009e7000, 0xa00009e7, // ldtmu0 + /* [0x00000998] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x000009a0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x000009a8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x000009a0] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x000009a8] */ 0x009e7000, 0xa00009e7, // ldtmu0 + /* [0x000009b0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) + /* [0x000009b8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) + /* [0x000009c0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) + /* [0x000009c8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) + /* [0x000009d0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x000009d8] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend +-/* [0x000009e0] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop +-/* [0x000009e8] */ 0x009e7000, 0x100009e7, // nop ; nop ++/* [0x000009d8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x000009e0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x000009e8] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend ++/* [0x000009f0] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop ++/* [0x000009f8] */ 0x009e7000, 0x100009e7, // nop ; nop + // ::mc_end + }; + #ifdef __HIGHC__ +diff --git a/libavcodec/rpi_shader.h b/libavcodec/rpi_shader.h +index 9de4535..e36c4ae 100644 +--- a/libavcodec/rpi_shader.h ++++ b/libavcodec/rpi_shader.h +@@ -6,8 +6,8 @@ extern unsigned int rpi_shader[]; + #define mc_setup_uv (rpi_shader + 0) + #define mc_filter_uv (rpi_shader + 142) + #define mc_filter_uv_b (rpi_shader + 360) +-#define mc_exit (rpi_shader + 588) +-#define mc_interrupt_exit8 (rpi_shader + 606) +-#define mc_end (rpi_shader + 636) ++#define mc_exit (rpi_shader + 592) ++#define mc_interrupt_exit8 (rpi_shader + 610) ++#define mc_end (rpi_shader + 640) + + #endif +diff --git a/libavcodec/rpi_shader.qasm b/libavcodec/rpi_shader.qasm +index cd7346d..870437d2 100644 +--- a/libavcodec/rpi_shader.qasm ++++ b/libavcodec/rpi_shader.qasm +@@ -443,23 +443,23 @@ add t0s, ra_x2_base, r2 + + mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] + +-mov r2, rb21 ; mul24 r3, r0, ra0 +-nop ; mul24.ifnz r3, ra0 << 8, r1 << 8 +-sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 ++nop ; mul24 r2, r0, ra0 ++nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 ++nop ; mul24 r3, ra1 << 1, r0 << 1 + nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 +-sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 ++add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 + nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 +-sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 ++add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 + nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 +-sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 ++add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 + nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 +-sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 ++add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 + nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 +-sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 ++add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 + nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 +-sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 ++add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 + nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 +-sub r0, r2, r3 ++add r0, r2, r3 + + mov r3, rb31 + +@@ -474,23 +474,25 @@ sub.setf -, r3, 8 ; mov r1, ra22 + + # apply horizontal filter + brr.anyn -, r:uvloop_b +-max ra14, ra15, 0 ; mul24 r0, r0, r1 # last bit of context scroll, including clamp to zero +-asr r0, r0, 15 ; mov r1, ra21 +-min.setf ra15, r0, rb22 ++mov ra14, ra15 ; mul24 r0, r0, r1 # last bit of context scroll, including clamp to zero ++asr ra15, r0, 8 ; nop ++nop ; nop + + # apply vertical filter and write to VPM + +-nop ; mul24 r0, ra14, rb14 +-sub r1, r1, r0 ; mul24 r0, ra13, rb13 +-sub r1, r1, r0 ; mul24 r0, ra12, rb12 +-sub r1, r1, r0 ; mul24 r0, ra11, rb11 +-sub r1, r1, r0 ; mul24 r0, ra10, rb10 +-sub r1, r1, r0 ; mul24 r0, ra9, rb9 +-sub r1, r1, r0 ; mul24 r0, ra8, rb8 +-sub r1, r1, r0 ; mul24 r0, ra15, rb15 +-sub.ifnn r1, r1, r0 ; mov -, vw_wait ++nop ; mul24 r1, ra14, rb14 ++nop ; mul24 r0, ra13, rb13 ++add r1, r1, r0 ; mul24 r0, ra12, rb12 ++add r1, r1, r0 ; mul24 r0, ra11, rb11 ++add r1, r1, r0 ; mul24 r0, ra10, rb10 ++add r1, r1, r0 ; mul24 r0, ra9, rb9 ++add r1, r1, r0 ; mul24 r0, ra8, rb8 ++add r1, r1, r0 ; mul24 r0, ra15, rb15 ++add r1, r1, r0 ; mov -, vw_wait + sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 +-asr r1, r1, 15 ++asr r1, r1, 14 ++add r1, r1, ra21 ++asr r1, r1, 6 + min r1, r1, rb22 + add r0, vpm, 1 # Blend in previous VPM contents at this location + brr.anyn -, r:uvloop_b +-- +2.5.0 + + +From 9bd4040dfa0e8146dd0a9d7ca191f98078e0d400 Mon Sep 17 00:00:00 2001 +From: Peter de Rivaz <peter.derivaz@gmail.com> +Date: Thu, 14 May 2015 08:15:55 +0100 +Subject: [PATCH 22/68] Added flush for SAO + +--- + libavcodec/hevc.c | 2 +- + libavcodec/hevc_filter.c | 39 ++++++++++++++++++++++++++------------- + 2 files changed, 27 insertions(+), 14 deletions(-) + +diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c +index 9a13fd4..96b3568 100644 +--- a/libavcodec/hevc.c ++++ b/libavcodec/hevc.c +@@ -2892,7 +2892,7 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) + rpi_execute_inter_qpu(s); + #endif + // Transform all blocks +- //printf("%d %d %d : %d %d %d %d\n",s->poc, x_ctb, y_ctb, s->num_pred_cmds,s->num_mv_cmds,s->num_coeffs[2] >> 8,s->num_coeffs[3] >> 10); ++ // printf("%d %d %d : %d %d %d %d\n",s->poc, x_ctb, y_ctb, s->num_pred_cmds,s->num_mv_cmds,s->num_coeffs[2] >> 8,s->num_coeffs[3] >> 10); + rpi_execute_transform(s); + // Perform inter prediction + rpi_execute_inter_cmds(s); +diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c +index 9b6e26d..92a8271 100644 +--- a/libavcodec/hevc_filter.c ++++ b/libavcodec/hevc_filter.c +@@ -871,6 +871,21 @@ static void flush_buffer(AVBufferRef *bref) { + GPU_MEM_PTR_T *p = av_buffer_pool_opaque(bref); + gpu_cache_flush(p); + } ++ ++static void ff_hevc_flush_chroma(HEVCContext *s) ++{ ++ if (s->enable_rpi && !( s->nal_unit_type == NAL_TRAIL_N || ++ s->nal_unit_type == NAL_TSA_N || ++ s->nal_unit_type == NAL_STSA_N || ++ s->nal_unit_type == NAL_RADL_N || ++ s->nal_unit_type == NAL_RASL_N )) { ++ flush_buffer(s->frame->buf[1]); ++ flush_buffer(s->frame->buf[2]); ++ //memcpy(s->dummy.arm,s->frame->data[0],2048*64); ++ //memcpy(s->dummy.arm,s->frame->data[1],1024*32); ++ //memcpy(s->dummy.arm,s->frame->data[2],1024*32); ++ } ++} + #endif + + void ff_hevc_hls_filter(HEVCContext *s, int x, int y, int ctb_size) +@@ -886,31 +901,29 @@ void ff_hevc_hls_filter(HEVCContext *s, int x, int y, int ctb_size) + sao_filter_CTB(s, x - ctb_size, y); + if (y && x_end) { + sao_filter_CTB(s, x, y - ctb_size); +- if (s->threads_type & FF_THREAD_FRAME ) ++ if (s->threads_type & FF_THREAD_FRAME ) { ++#ifdef RPI_INTER_QPU ++ ff_hevc_flush_chroma(s); ++#endif + ff_thread_report_progress(&s->ref->tf, y, 0); ++ } + } + if (x_end && y_end) { + sao_filter_CTB(s, x , y); +- if (s->threads_type & FF_THREAD_FRAME ) ++ if (s->threads_type & FF_THREAD_FRAME ) { ++#ifdef RPI_INTER_QPU ++ ff_hevc_flush_chroma(s); ++#endif + ff_thread_report_progress(&s->ref->tf, y + ctb_size, 0); ++ } + } + } else if (s->threads_type & FF_THREAD_FRAME && x_end) { + //int newh = y + ctb_size - 4; + //int currh = s->ref->tf.progress->data[0]; + //if (((y + ctb_size)&63)==0) +- if (!( s->nal_unit_type == NAL_TRAIL_N || +- s->nal_unit_type == NAL_TSA_N || +- s->nal_unit_type == NAL_STSA_N || +- s->nal_unit_type == NAL_RADL_N || +- s->nal_unit_type == NAL_RASL_N )) { + #ifdef RPI_INTER_QPU +- flush_buffer(s->frame->buf[1]); +- flush_buffer(s->frame->buf[2]); ++ ff_hevc_flush_chroma(s); + #endif +- //memcpy(s->dummy.arm,s->frame->data[0],2048*64); +- //memcpy(s->dummy.arm,s->frame->data[1],1024*32); +- //memcpy(s->dummy.arm,s->frame->data[2],1024*32); +- } + ff_thread_report_progress(&s->ref->tf, y + ctb_size - 4, 0); + } + } +-- +2.5.0 + + +From d9e8153a94d637578cd0cdb6a0b737957abb8b8f Mon Sep 17 00:00:00 2001 +From: Peter de Rivaz <peter.derivaz@gmail.com> +Date: Thu, 14 May 2015 09:17:28 +0100 +Subject: [PATCH 23/68] Stopped using acceleration in unsupported cases + +--- + libavcodec/hevc.c | 14 +++++++------- + libavcodec/hevc_cabac.c | 4 ++-- + 2 files changed, 9 insertions(+), 9 deletions(-) + +diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c +index 96b3568..b9ae06a 100644 +--- a/libavcodec/hevc.c ++++ b/libavcodec/hevc.c +@@ -1141,15 +1141,11 @@ static int hls_transform_unit(HEVCContext *s, int x0, int y0, + for (i = 0; i < (size * size); i++) { + coeffs[i] = ((lc->tu.res_scale_val * coeffs_y[i]) >> 3); + } +- printf("Cross component not supported\n"); // TODO +- exit(-1); + s->hevcdsp.transform_add[log2_trafo_size_c-2](dst, coeffs, stride); + } + } + + if (lc->tu.cross_pf) { +- printf("Cross component not supported\n"); // TODO +- exit(-1); + hls_cross_component_pred(s, 1); + } + for (i = 0; i < (s->ps.sps->chroma_format_idc == 2 ? 2 : 1); i++) { +@@ -1178,8 +1174,6 @@ static int hls_transform_unit(HEVCContext *s, int x0, int y0, + for (i = 0; i < (size * size); i++) { + coeffs[i] = ((lc->tu.res_scale_val * coeffs_y[i]) >> 3); + } +- printf("Cross component not supported\n"); // TODO +- exit(-1); + s->hevcdsp.transform_add[log2_trafo_size_c-2](dst, coeffs, stride); + } + } +@@ -2846,7 +2840,13 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) + int ctb_addr_ts = s->ps.pps->ctb_addr_rs_to_ts[s->sh.slice_ctb_addr_rs]; + + #ifdef RPI +- s->enable_rpi = 1; // TODO this should depend on cross component and frame width etc. ++ s->enable_rpi = s->ps.sps->bit_depth == 8 ++ && s->ps.sps->width <= RPI_MAX_WIDTH ++ && !s->ps.pps->cross_component_prediction_enabled_flag ++ && s->ps.pps->num_tile_rows <= 1 && s->ps.pps->num_tile_columns <= 1 ++ && !(s->ps.pps->weighted_pred_flag && s->sh.slice_type == P_SLICE) ++ && !(s->ps.pps->weighted_bipred_flag && s->sh.slice_type == B_SLICE); ++ + #endif + + if (!ctb_addr_ts && s->sh.dependent_slice_segment_flag) { +diff --git a/libavcodec/hevc_cabac.c b/libavcodec/hevc_cabac.c +index f28759b..ca76cb0 100644 +--- a/libavcodec/hevc_cabac.c ++++ b/libavcodec/hevc_cabac.c +@@ -1513,9 +1513,9 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, + #ifdef RPI + if (!use_vpu) { + int max_xy = FFMAX(last_significant_coeff_x, last_significant_coeff_y); +- if (max_xy == 0) ++ if (max_xy == 0) { + s->hevcdsp.idct_dc[log2_trafo_size-2](coeffs); +- else { ++ } else { + int col_limit = last_significant_coeff_x + last_significant_coeff_y + 4; + if (max_xy < 4) + col_limit = FFMIN(4, col_limit); +-- +2.5.0 + + +From 0e326aaea2fd684025bfbd676bb7fa6f08acca22 Mon Sep 17 00:00:00 2001 +From: Peter de Rivaz <peter.derivaz@gmail.com> +Date: Thu, 14 May 2015 09:42:16 +0100 +Subject: [PATCH 24/68] Split B prediction into two passes + +--- + libavcodec/hevc.c | 1 + + libavcodec/hevc.h | 1 + + libavcodec/rpi_qpu.c | 3 + + libavcodec/rpi_qpu.h | 1 + + libavcodec/rpi_shader.c | 559 +++++++++++++++++++++++++++------------------ + libavcodec/rpi_shader.h | 11 +- + libavcodec/rpi_shader.qasm | 196 ++++++++++++++-- + 7 files changed, 531 insertions(+), 241 deletions(-) + +diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c +index b9ae06a..3994f2e 100644 +--- a/libavcodec/hevc.c ++++ b/libavcodec/hevc.c +@@ -3795,6 +3795,7 @@ static av_cold int hevc_init_context(AVCodecContext *avctx) + p += uv_commands_per_qpu; + } + s->mc_filter_uv = qpu_get_fn(QPU_MC_FILTER_UV); ++ s->mc_filter_uv_b0 = qpu_get_fn(QPU_MC_FILTER_UV_B0); + s->mc_filter_uv_b = qpu_get_fn(QPU_MC_FILTER_UV_B); + + } +diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h +index 442516d..d33ab74 100644 +--- a/libavcodec/hevc.h ++++ b/libavcodec/hevc.h +@@ -943,6 +943,7 @@ typedef struct HEVCContext { + uint32_t *u_mvs[8]; + // Function pointers + uint32_t mc_filter_uv; ++ uint32_t mc_filter_uv_b0; + uint32_t mc_filter_uv_b; + #endif + +diff --git a/libavcodec/rpi_qpu.c b/libavcodec/rpi_qpu.c +index 4e90cc1..60bf079 100644 +--- a/libavcodec/rpi_qpu.c ++++ b/libavcodec/rpi_qpu.c +@@ -636,6 +636,9 @@ unsigned int qpu_get_fn(int num) { + case QPU_MC_FILTER_UV: + fn = mc_filter_uv; + break; ++ case QPU_MC_FILTER_UV_B0: ++ fn = mc_filter_uv_b0; ++ break; + case QPU_MC_FILTER_UV_B: + fn = mc_filter_uv_b; + break; +diff --git a/libavcodec/rpi_qpu.h b/libavcodec/rpi_qpu.h +index f9ad333..543c84b 100644 +--- a/libavcodec/rpi_qpu.h ++++ b/libavcodec/rpi_qpu.h +@@ -29,6 +29,7 @@ enum { + QPU_MC_FILTER_HONLY, + QPU_MC_SETUP_UV, + QPU_MC_FILTER_UV, ++ QPU_MC_FILTER_UV_B0, + QPU_MC_FILTER_UV_B, + QPU_MC_INTERRUPT_EXIT8, + QPU_MC_END +diff --git a/libavcodec/rpi_shader.c b/libavcodec/rpi_shader.c +index 5d00cb2..88ad20b 100644 +--- a/libavcodec/rpi_shader.c ++++ b/libavcodec/rpi_shader.c +@@ -39,18 +39,18 @@ unsigned int rpi_shader[] = { + /* [0x00000070] */ 0x00000100, 0xe00205a7, // mov ra22, 256 + /* [0x00000078] */ 0x00000008, 0xe00205e7, // mov ra23, 8 + /* [0x00000080] */ 0xffffff00, 0xe0021527, // mov rb20, 0xffffff00 +-/* [0x00000088] */ 0x00000040, 0xe0021567, // mov rb21, 64 +-/* [0x00000090] */ 0x000000ff, 0xe00215a7, // mov rb22, 255 +-/* [0x00000098] */ 0x00000018, 0xe00215e7, // mov rb23, 24 +-/* [0x000000a0] */ 0x00000000, 0xe0020227, // mov ra8, 0 +-/* [0x000000a8] */ 0x00000000, 0xe0020267, // mov ra9, 0 +-/* [0x000000b0] */ 0x00000000, 0xe00202a7, // mov ra10, 0 +-/* [0x000000b8] */ 0x00000000, 0xe00202e7, // mov ra11, 0 +-/* [0x000000c0] */ 0x00000000, 0xe0020327, // mov ra12, 0 +-/* [0x000000c8] */ 0x00000000, 0xe0020367, // mov ra13, 0 +-/* [0x000000d0] */ 0x00000000, 0xe00203a7, // mov ra14, 0 +-/* [0x000000d8] */ 0x00000000, 0xe00203e7, // mov ra15, 0 +-/* [0x000000e0] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num ++/* [0x00000088] */ 0x000000ff, 0xe00215a7, // mov rb22, 255 ++/* [0x00000090] */ 0x00000018, 0xe00215e7, // mov rb23, 24 ++/* [0x00000098] */ 0x00000000, 0xe0020227, // mov ra8, 0 ++/* [0x000000a0] */ 0x00000000, 0xe0020267, // mov ra9, 0 ++/* [0x000000a8] */ 0x00000000, 0xe00202a7, // mov ra10, 0 ++/* [0x000000b0] */ 0x00000000, 0xe00202e7, // mov ra11, 0 ++/* [0x000000b8] */ 0x00000000, 0xe0020327, // mov ra12, 0 ++/* [0x000000c0] */ 0x00000000, 0xe0020367, // mov ra13, 0 ++/* [0x000000c8] */ 0x00000000, 0xe00203a7, // mov ra14, 0 ++/* [0x000000d0] */ 0x00000000, 0xe00203e7, // mov ra15, 0 ++/* [0x000000d8] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num ++/* [0x000000e0] */ 0x119c15c0, 0xd00208a7, // shl r2, r2, 1 + /* [0x000000e8] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 + /* [0x000000f0] */ 0x159e7480, 0x10020867, // mov r1, r2 + /* [0x000000f8] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 +@@ -62,176 +62,176 @@ unsigned int rpi_shader[] = { + /* [0x00000128] */ 0x119c51c0, 0xd0020827, // shl r0, r0, 5 + /* [0x00000130] */ 0x0c9e7040, 0x100216e7, // add rb27, r0, r1 + /* [0x00000138] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num +-/* [0x00000140] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 +-/* [0x00000148] */ 0x159e7480, 0x10020867, // mov r1, r2 +-/* [0x00000150] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 +-/* [0x00000158] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 +-/* [0x00000160] */ 0x159e7480, 0x10020827, // mov r0, r2 +-/* [0x00000168] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 +-/* [0x00000170] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 +-/* [0x00000178] */ 0x00004800, 0xe0020867, // mov r1, vpm_setup(0, 4, h8p(0, 0)) +-/* [0x00000180] */ 0x0c9e7040, 0x10021727, // add rb28, r0, r1 +-/* [0x00000188] */ 0x15427d80, 0x10020827, // mov r0, ra_x_base +-/* [0x00000190] */ 0x937401f6, 0xd0024821, // max r0, r0, 0; mov r1, ra_y +-/* [0x00000198] */ 0x926191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, ra_x2_base +-/* [0x000001a0] */ 0x916431f6, 0xd00244e2, // shl ra_xshift_next, r0, 3 ; mov r2, ra_u2v_ref_offset +-/* [0x000001a8] */ 0x0c9c13c0, 0xd0020767, // add ra_y, r1, 1 +-/* [0x000001b0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 +-/* [0x000001b8] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 +-/* [0x000001c0] */ 0x939c03c0, 0xd0025850, // max r1, r1, 0 ; mov ra_x_base, r0 +-/* [0x000001c8] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 +-/* [0x000001d0] */ 0x4c9d040f, 0x100248a1, // add r2, r2, r0 ; mul24 r1, r1, rb_pitch +-/* [0x000001d8] */ 0x8c9e7052, 0x10025e18, // add t0s, r0, r1 ; mov ra_x2_base, r2 +-/* [0x000001e0] */ 0x0c9e7440, 0x10020e27, // add t0s, r2, r1 +-/* [0x000001e8] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x000001f0] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x000001f8] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000200] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 +-/* [0x00000208] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 +-/* [0x00000210] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 +-/* [0x00000218] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 +-/* [0x00000220] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch +-/* [0x00000228] */ 0x0c427380, 0x10020e27, // add t0s, r1, ra_x_base +-/* [0x00000230] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_x2_base ++/* [0x00000140] */ 0x119c15c0, 0xd00208a7, // shl r2, r2, 1 ++/* [0x00000148] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 ++/* [0x00000150] */ 0x159e7480, 0x10020867, // mov r1, r2 ++/* [0x00000158] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 ++/* [0x00000160] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 ++/* [0x00000168] */ 0x159e7480, 0x10020827, // mov r0, r2 ++/* [0x00000170] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 ++/* [0x00000178] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 ++/* [0x00000180] */ 0x00004800, 0xe0020867, // mov r1, vpm_setup(0, 4, h8p(0, 0)) ++/* [0x00000188] */ 0x0c9e7040, 0x10021727, // add rb28, r0, r1 ++/* [0x00000190] */ 0x0f9c11c0, 0xd0020827, // asr r0, r0, 1 ++/* [0x00000198] */ 0x00002900, 0xe0020867, // mov r1, vpm_setup(0, 2, h16p(0, 0)) ++/* [0x000001a0] */ 0x0c9e7040, 0x10021567, // add rb21, r0, r1 ++/* [0x000001a8] */ 0x15427d80, 0x10020827, // mov r0, ra_x_base ++/* [0x000001b0] */ 0x937401f6, 0xd0024821, // max r0, r0, 0; mov r1, ra_y ++/* [0x000001b8] */ 0x926191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, ra_x2_base ++/* [0x000001c0] */ 0x916431f6, 0xd00244e2, // shl ra_xshift_next, r0, 3 ; mov r2, ra_u2v_ref_offset ++/* [0x000001c8] */ 0x0c9c13c0, 0xd0020767, // add ra_y, r1, 1 ++/* [0x000001d0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 ++/* [0x000001d8] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 ++/* [0x000001e0] */ 0x939c03c0, 0xd0025850, // max r1, r1, 0 ; mov ra_x_base, r0 ++/* [0x000001e8] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 ++/* [0x000001f0] */ 0x4c9d040f, 0x100248a1, // add r2, r2, r0 ; mul24 r1, r1, rb_pitch ++/* [0x000001f8] */ 0x8c9e7052, 0x10025e18, // add t0s, r0, r1 ; mov ra_x2_base, r2 ++/* [0x00000200] */ 0x0c9e7440, 0x10020e27, // add t0s, r2, r1 ++/* [0x00000208] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000210] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000218] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000220] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 ++/* [0x00000228] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 ++/* [0x00000230] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 ++/* [0x00000238] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 ++/* [0x00000240] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch ++/* [0x00000248] */ 0x0c427380, 0x10020e27, // add t0s, r1, ra_x_base ++/* [0x00000250] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_x2_base + // ::mc_filter_uv +-/* [0x00000238] */ 0x15827d80, 0x100207e7, // mov ra31, unif +-/* [0x00000240] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next +-/* [0x00000248] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num +-/* [0x00000250] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif +-/* [0x00000258] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif +-/* [0x00000260] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 +-/* [0x00000268] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 +-/* [0x00000270] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 +-/* [0x00000278] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 +-/* [0x00000280] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 +-/* [0x00000288] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 +-/* [0x00000290] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 +-/* [0x00000298] */ 0x00000010, 0xe00208a7, // mov r2, 16 +-/* [0x000002a0] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x000002a8] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 +-/* [0x000002b0] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 +-/* [0x000002b8] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 +-/* [0x000002c0] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 +-/* [0x000002c8] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 +-/* [0x000002d0] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 +-/* [0x000002d8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 +-/* [0x000002e0] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 +-/* [0x000002e8] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 +-/* [0x000002f0] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 +-/* [0x000002f8] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000300] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000308] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000310] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000318] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif +-/* [0x00000320] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000328] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000330] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000338] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif +-/* [0x00000340] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000348] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000350] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000358] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif +-/* [0x00000360] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000368] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000370] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000378] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 +-/* [0x00000380] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 +-/* [0x00000388] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-/* [0x00000390] */ 0x00000000, 0xe00208e7, // mov r3, 0 ++/* [0x00000258] */ 0x15827d80, 0x100207e7, // mov ra31, unif ++/* [0x00000260] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next ++/* [0x00000268] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num ++/* [0x00000270] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif ++/* [0x00000278] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif ++/* [0x00000280] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 ++/* [0x00000288] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 ++/* [0x00000290] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 ++/* [0x00000298] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 ++/* [0x000002a0] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 ++/* [0x000002a8] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 ++/* [0x000002b0] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 ++/* [0x000002b8] */ 0x00000010, 0xe00208a7, // mov r2, 16 ++/* [0x000002c0] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x000002c8] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 ++/* [0x000002d0] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 ++/* [0x000002d8] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 ++/* [0x000002e0] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 ++/* [0x000002e8] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 ++/* [0x000002f0] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 ++/* [0x000002f8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 ++/* [0x00000300] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 ++/* [0x00000308] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 ++/* [0x00000310] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 ++/* [0x00000318] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000320] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000328] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000330] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000338] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif ++/* [0x00000340] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000348] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000350] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000358] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif ++/* [0x00000360] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000368] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000370] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000378] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif ++/* [0x00000380] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000388] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000390] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000398] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 ++/* [0x000003a0] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 ++/* [0x000003a8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x000003b0] */ 0x00000000, 0xe00208e7, // mov r3, 0 + // :uvloop +-/* [0x00000398] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 +-/* [0x000003a0] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 +-/* [0x000003a8] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 +-/* [0x000003b0] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch +-/* [0x000003b8] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 +-/* [0x000003c0] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 +-/* [0x000003c8] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 +-/* [0x000003d0] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 +-/* [0x000003d8] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 +-/* [0x000003e0] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 +-/* [0x000003e8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-/* [0x000003f0] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 +-/* [0x000003f8] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 +-/* [0x00000400] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 +-/* [0x00000408] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 +-/* [0x00000410] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 +-/* [0x00000418] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 +-/* [0x00000420] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 +-/* [0x00000428] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 +-/* [0x00000430] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 +-/* [0x00000438] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 +-/* [0x00000440] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 +-/* [0x00000448] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 +-/* [0x00000450] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 +-/* [0x00000458] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 +-/* [0x00000460] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 +-/* [0x00000468] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 +-/* [0x00000470] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 +-/* [0x00000478] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 +-/* [0x00000480] */ 0x15267d80, 0x10020227, // mov ra8, ra9 +-/* [0x00000488] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 +-/* [0x00000490] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 +-/* [0x00000498] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 +-/* [0x000004a0] */ 0x15367d80, 0x10020327, // mov ra12, ra13 +-/* [0x000004a8] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 +-/* [0x000004b0] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 +-/* [0x000004b8] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop +-/* [0x000004c0] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 +-/* [0x000004c8] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop +-/* [0x000004d0] */ 0x009e7000, 0x100009e7, // nop ; nop +-/* [0x000004d8] */ 0x4038e037, 0x100049e1, // nop ; mul24 r1, ra14, rb14 +-/* [0x000004e0] */ 0x4034d037, 0x100049e0, // nop ; mul24 r0, ra13, rb13 +-/* [0x000004e8] */ 0x4c30c237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb12 +-/* [0x000004f0] */ 0x4c2cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb11 +-/* [0x000004f8] */ 0x4c28a237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb10 +-/* [0x00000500] */ 0x4c249237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb9 +-/* [0x00000508] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 +-/* [0x00000510] */ 0x4c3cf237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb15 +-/* [0x00000518] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait +-/* [0x00000520] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 +-/* [0x00000528] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 +-/* [0x00000530] */ 0x0c567380, 0x10020867, // add r1, r1, ra21 +-/* [0x00000538] */ 0xfffffe40, 0xf06809e7, // brr.anyn -, r:uvloop +-/* [0x00000540] */ 0x0f9c63c0, 0xd0020867, // asr r1, r1, 6 +-/* [0x00000548] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 +-/* [0x00000550] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 +-/* [0x00000558] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 +-/* [0x00000560] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 +-/* [0x00000568] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif +-/* [0x00000570] */ 0x00000010, 0xe0020827, // mov r0, 16 +-/* [0x00000578] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait +-/* [0x00000580] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 +-/* [0x00000588] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 +-/* [0x00000590] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 +-/* [0x00000598] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif +-// ::mc_filter_uv_b +-/* [0x000005a0] */ 0x15827d80, 0x100207e7, // mov ra31, unif +-/* [0x000005a8] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next +-/* [0x000005b0] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num +-/* [0x000005b8] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif +-/* [0x000005c0] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif +-/* [0x000005c8] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 +-/* [0x000005d0] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 +-/* [0x000005d8] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 +-/* [0x000005e0] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 +-/* [0x000005e8] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 +-/* [0x000005f0] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 +-/* [0x000005f8] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 +-/* [0x00000600] */ 0x00000010, 0xe00208a7, // mov r2, 16 +-/* [0x00000608] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000610] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 +-/* [0x00000618] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 +-/* [0x00000620] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 +-/* [0x00000628] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 +-/* [0x00000630] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 +-/* [0x00000638] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 +-/* [0x00000640] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 +-/* [0x00000648] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 +-/* [0x00000650] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 +-/* [0x00000658] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 +-/* [0x00000660] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 +-/* [0x00000668] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 +-/* [0x00000670] */ 0x0c9dc7c0, 0x10020c67, // add vr_setup, r3, rb28 ++/* [0x000003b8] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 ++/* [0x000003c0] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 ++/* [0x000003c8] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 ++/* [0x000003d0] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch ++/* [0x000003d8] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 ++/* [0x000003e0] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 ++/* [0x000003e8] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 ++/* [0x000003f0] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 ++/* [0x000003f8] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 ++/* [0x00000400] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 ++/* [0x00000408] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x00000410] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 ++/* [0x00000418] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 ++/* [0x00000420] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 ++/* [0x00000428] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 ++/* [0x00000430] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 ++/* [0x00000438] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 ++/* [0x00000440] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 ++/* [0x00000448] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 ++/* [0x00000450] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 ++/* [0x00000458] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 ++/* [0x00000460] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 ++/* [0x00000468] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 ++/* [0x00000470] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 ++/* [0x00000478] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 ++/* [0x00000480] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 ++/* [0x00000488] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 ++/* [0x00000490] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 ++/* [0x00000498] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 ++/* [0x000004a0] */ 0x15267d80, 0x10020227, // mov ra8, ra9 ++/* [0x000004a8] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 ++/* [0x000004b0] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 ++/* [0x000004b8] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 ++/* [0x000004c0] */ 0x15367d80, 0x10020327, // mov ra12, ra13 ++/* [0x000004c8] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 ++/* [0x000004d0] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 ++/* [0x000004d8] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop ++/* [0x000004e0] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 ++/* [0x000004e8] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop ++/* [0x000004f0] */ 0x009e7000, 0x100009e7, // nop ; nop ++/* [0x000004f8] */ 0x4038e037, 0x100049e1, // nop ; mul24 r1, ra14, rb14 ++/* [0x00000500] */ 0x4034d037, 0x100049e0, // nop ; mul24 r0, ra13, rb13 ++/* [0x00000508] */ 0x4c30c237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb12 ++/* [0x00000510] */ 0x4c2cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb11 ++/* [0x00000518] */ 0x4c28a237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb10 ++/* [0x00000520] */ 0x4c249237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb9 ++/* [0x00000528] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 ++/* [0x00000530] */ 0x4c3cf237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb15 ++/* [0x00000538] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait ++/* [0x00000540] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 ++/* [0x00000548] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 ++/* [0x00000550] */ 0x0c567380, 0x10020867, // add r1, r1, ra21 ++/* [0x00000558] */ 0xfffffe40, 0xf06809e7, // brr.anyn -, r:uvloop ++/* [0x00000560] */ 0x0f9c63c0, 0xd0020867, // asr r1, r1, 6 ++/* [0x00000568] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 ++/* [0x00000570] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 ++/* [0x00000578] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 ++/* [0x00000580] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 ++/* [0x00000588] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif ++/* [0x00000590] */ 0x00000010, 0xe0020827, // mov r0, 16 ++/* [0x00000598] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x000005a0] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 ++/* [0x000005a8] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 ++/* [0x000005b0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 ++/* [0x000005b8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif ++// ::mc_filter_uv_b0 ++/* [0x000005c0] */ 0x15827d80, 0x100207e7, // mov ra31, unif ++/* [0x000005c8] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next ++/* [0x000005d0] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num ++/* [0x000005d8] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif ++/* [0x000005e0] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif ++/* [0x000005e8] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 ++/* [0x000005f0] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 ++/* [0x000005f8] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 ++/* [0x00000600] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 ++/* [0x00000608] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 ++/* [0x00000610] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 ++/* [0x00000618] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 ++/* [0x00000620] */ 0x00000010, 0xe00208a7, // mov r2, 16 ++/* [0x00000628] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000630] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 ++/* [0x00000638] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 ++/* [0x00000640] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 ++/* [0x00000648] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 ++/* [0x00000650] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 ++/* [0x00000658] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 ++/* [0x00000660] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 ++/* [0x00000668] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 ++/* [0x00000670] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 + /* [0x00000678] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 + /* [0x00000680] */ 0x15827d80, 0x10020827, // mov r0, unif + /* [0x00000688] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 +@@ -253,7 +253,7 @@ unsigned int rpi_shader[] = { + /* [0x00000708] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 + /* [0x00000710] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] + /* [0x00000718] */ 0x00000000, 0xe00208e7, // mov r3, 0 +-// :uvloop_b ++// :uvloop_b0 + /* [0x00000720] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 + /* [0x00000728] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 + /* [0x00000730] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 +@@ -290,7 +290,7 @@ unsigned int rpi_shader[] = { + /* [0x00000828] */ 0x15367d80, 0x10020327, // mov ra12, ra13 + /* [0x00000830] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 + /* [0x00000838] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 +-/* [0x00000840] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop_b ++/* [0x00000840] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop_b0 + /* [0x00000848] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 + /* [0x00000850] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop + /* [0x00000858] */ 0x009e7000, 0x100009e7, // nop ; nop +@@ -306,48 +306,163 @@ unsigned int rpi_shader[] = { + /* [0x000008a8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 + /* [0x000008b0] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 + /* [0x000008b8] */ 0x0c567380, 0x10020867, // add r1, r1, ra21 +-/* [0x000008c0] */ 0x0f9c63c0, 0xd0020867, // asr r1, r1, 6 +-/* [0x000008c8] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 +-/* [0x000008d0] */ 0x0cc01dc0, 0xd0020827, // add r0, vpm, 1 +-/* [0x000008d8] */ 0xfffffe28, 0xf06809e7, // brr.anyn -, r:uvloop_b +-/* [0x000008e0] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 +-/* [0x000008e8] */ 0x0c9e7200, 0x10020867, // add r1, r1, r0 +-/* [0x000008f0] */ 0x0e9c13c0, 0xd0020c27, // shr vpm, r1, 1 +-/* [0x000008f8] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 +-/* [0x00000900] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 +-/* [0x00000908] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif +-/* [0x00000910] */ 0x00000010, 0xe0020827, // mov r0, 16 +-/* [0x00000918] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait +-/* [0x00000920] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 +-/* [0x00000928] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 +-/* [0x00000930] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 +-/* [0x00000938] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif ++/* [0x000008c0] */ 0xfffffad8, 0xf06809e7, // brr.anyn -, r:uvloop ++/* [0x000008c8] */ 0x0f9c63c0, 0xd0020867, // asr r1, r1, 6 ++/* [0x000008d0] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 ++/* [0x000008d8] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 ++/* [0x000008e0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 ++/* [0x000008e8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 ++/* [0x000008f0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif ++/* [0x000008f8] */ 0x00000010, 0xe0020827, // mov r0, 16 ++/* [0x00000900] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x00000908] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 ++/* [0x00000910] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 ++/* [0x00000918] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 ++/* [0x00000920] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif ++// ::mc_filter_uv_b ++/* [0x00000928] */ 0x15827d80, 0x100207e7, // mov ra31, unif ++/* [0x00000930] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next ++/* [0x00000938] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num ++/* [0x00000940] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif ++/* [0x00000948] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif ++/* [0x00000950] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 ++/* [0x00000958] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 ++/* [0x00000960] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 ++/* [0x00000968] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 ++/* [0x00000970] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 ++/* [0x00000978] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 ++/* [0x00000980] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 ++/* [0x00000988] */ 0x00000010, 0xe00208a7, // mov r2, 16 ++/* [0x00000990] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000998] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 ++/* [0x000009a0] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 ++/* [0x000009a8] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 ++/* [0x000009b0] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 ++/* [0x000009b8] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 ++/* [0x000009c0] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 ++/* [0x000009c8] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 ++/* [0x000009d0] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 ++/* [0x000009d8] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 ++/* [0x000009e0] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 ++/* [0x000009e8] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 ++/* [0x000009f0] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 ++/* [0x000009f8] */ 0x0c9dc7c0, 0x10020c67, // add vr_setup, r3, rb28 ++/* [0x00000a00] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 ++/* [0x00000a08] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000a10] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000a18] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000a20] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000a28] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif ++/* [0x00000a30] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000a38] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000a40] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000a48] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif ++/* [0x00000a50] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000a58] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000a60] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000a68] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif ++/* [0x00000a70] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000a78] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000a80] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000a88] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 ++/* [0x00000a90] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 ++/* [0x00000a98] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x00000aa0] */ 0x00000000, 0xe00208e7, // mov r3, 0 ++// :uvloop_b ++/* [0x00000aa8] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 ++/* [0x00000ab0] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 ++/* [0x00000ab8] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 ++/* [0x00000ac0] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch ++/* [0x00000ac8] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 ++/* [0x00000ad0] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 ++/* [0x00000ad8] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 ++/* [0x00000ae0] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 ++/* [0x00000ae8] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 ++/* [0x00000af0] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 ++/* [0x00000af8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x00000b00] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 ++/* [0x00000b08] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 ++/* [0x00000b10] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 ++/* [0x00000b18] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 ++/* [0x00000b20] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 ++/* [0x00000b28] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 ++/* [0x00000b30] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 ++/* [0x00000b38] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 ++/* [0x00000b40] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 ++/* [0x00000b48] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 ++/* [0x00000b50] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 ++/* [0x00000b58] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 ++/* [0x00000b60] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 ++/* [0x00000b68] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 ++/* [0x00000b70] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 ++/* [0x00000b78] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 ++/* [0x00000b80] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 ++/* [0x00000b88] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 ++/* [0x00000b90] */ 0x15267d80, 0x10020227, // mov ra8, ra9 ++/* [0x00000b98] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 ++/* [0x00000ba0] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 ++/* [0x00000ba8] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 ++/* [0x00000bb0] */ 0x15367d80, 0x10020327, // mov ra12, ra13 ++/* [0x00000bb8] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 ++/* [0x00000bc0] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 ++/* [0x00000bc8] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop_b ++/* [0x00000bd0] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 ++/* [0x00000bd8] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop ++/* [0x00000be0] */ 0x009e7000, 0x100009e7, // nop ; nop ++/* [0x00000be8] */ 0x4038e037, 0x100049e1, // nop ; mul24 r1, ra14, rb14 ++/* [0x00000bf0] */ 0x4034d037, 0x100049e0, // nop ; mul24 r0, ra13, rb13 ++/* [0x00000bf8] */ 0x4c30c237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb12 ++/* [0x00000c00] */ 0x4c2cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb11 ++/* [0x00000c08] */ 0x4c28a237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb10 ++/* [0x00000c10] */ 0x4c249237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb9 ++/* [0x00000c18] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 ++/* [0x00000c20] */ 0x4c3cf237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb15 ++/* [0x00000c28] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait ++/* [0x00000c30] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 ++/* [0x00000c38] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 ++/* [0x00000c40] */ 0x0c567380, 0x10020867, // add r1, r1, ra21 ++/* [0x00000c48] */ 0x0f9c63c0, 0xd0020867, // asr r1, r1, 6 ++/* [0x00000c50] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 ++/* [0x00000c58] */ 0x0cc01dc0, 0xd0020827, // add r0, vpm, 1 ++/* [0x00000c60] */ 0xfffffe28, 0xf06809e7, // brr.anyn -, r:uvloop_b ++/* [0x00000c68] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 ++/* [0x00000c70] */ 0x0c9e7200, 0x10020867, // add r1, r1, r0 ++/* [0x00000c78] */ 0x0e9c13c0, 0xd0020c27, // shr vpm, r1, 1 ++/* [0x00000c80] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 ++/* [0x00000c88] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 ++/* [0x00000c90] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif ++/* [0x00000c98] */ 0x00000010, 0xe0020827, // mov r0, 16 ++/* [0x00000ca0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x00000ca8] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 ++/* [0x00000cb0] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 ++/* [0x00000cb8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 ++/* [0x00000cc0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif + // ::mc_exit +-/* [0x00000940] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait +-/* [0x00000948] */ 0x00000000, 0xe80009e7, // mov -,srel(0) +-/* [0x00000950] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00000958] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00000960] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00000968] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00000970] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend +-/* [0x00000978] */ 0x009e7000, 0x100009e7, // nop ; nop +-/* [0x00000980] */ 0x009e7000, 0x100009e7, // nop ; nop ++/* [0x00000cc8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x00000cd0] */ 0x00000000, 0xe80009e7, // mov -,srel(0) ++/* [0x00000cd8] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00000ce0] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00000ce8] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00000cf0] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00000cf8] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend ++/* [0x00000d00] */ 0x009e7000, 0x100009e7, // nop ; nop ++/* [0x00000d08] */ 0x009e7000, 0x100009e7, // nop ; nop + // ::mc_interrupt_exit8 +-/* [0x00000988] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait +-/* [0x00000990] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00000998] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x000009a0] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x000009a8] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x000009b0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x000009b8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x000009c0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x000009c8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x000009d0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x000009d8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x000009e0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x000009e8] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend +-/* [0x000009f0] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop +-/* [0x000009f8] */ 0x009e7000, 0x100009e7, // nop ; nop ++/* [0x00000d10] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x00000d18] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00000d20] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00000d28] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00000d30] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00000d38] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00000d40] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00000d48] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00000d50] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00000d58] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00000d60] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00000d68] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00000d70] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend ++/* [0x00000d78] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop ++/* [0x00000d80] */ 0x009e7000, 0x100009e7, // nop ; nop + // ::mc_end + }; + #ifdef __HIGHC__ +diff --git a/libavcodec/rpi_shader.h b/libavcodec/rpi_shader.h +index e36c4ae..809e582 100644 +--- a/libavcodec/rpi_shader.h ++++ b/libavcodec/rpi_shader.h +@@ -4,10 +4,11 @@ + extern unsigned int rpi_shader[]; + + #define mc_setup_uv (rpi_shader + 0) +-#define mc_filter_uv (rpi_shader + 142) +-#define mc_filter_uv_b (rpi_shader + 360) +-#define mc_exit (rpi_shader + 592) +-#define mc_interrupt_exit8 (rpi_shader + 610) +-#define mc_end (rpi_shader + 640) ++#define mc_filter_uv (rpi_shader + 150) ++#define mc_filter_uv_b0 (rpi_shader + 368) ++#define mc_filter_uv_b (rpi_shader + 586) ++#define mc_exit (rpi_shader + 818) ++#define mc_interrupt_exit8 (rpi_shader + 836) ++#define mc_end (rpi_shader + 866) + + #endif +diff --git a/libavcodec/rpi_shader.qasm b/libavcodec/rpi_shader.qasm +index 870437d2..635b894 100644 +--- a/libavcodec/rpi_shader.qasm ++++ b/libavcodec/rpi_shader.qasm +@@ -26,7 +26,7 @@ + # ra23 8 + # + # rb20 0xffffff00 +-# rb21 64 ++# rb21 vpm_setup for writing 16bit results into VPM + # rb22 255 + # rb23 24 + # +@@ -34,7 +34,7 @@ + # rb25 frame width-1 + # rb26 height<<23 + width<<16 + vdw_setup_0 + # rb27 vdw_setup_0 (depends on QPU number) +-# rb28 vpm_setup (depends on QPU number) ++# rb28 vpm_setup (depends on QPU number) for writing 8bit results into VPM + # rb29 vdw_setup_1(dst_pitch-width) + # rb30 frame height-1 + # rb31 used as temp to count loop iterations +@@ -69,8 +69,6 @@ + .set ra_y_next, ra28 + .set ra_y, ra29 + +-.set rb_const_64, rb21 +- + + ################################################################################ + # mc_setup_uv(next_kernel, x, y, ref_u_base, ref_v_base, frame_width, frame_height, pitch, dst_pitch, pad0, pad1, pad2) +@@ -106,7 +104,6 @@ mov ra22, 256 + mov ra23, 8 + + mov rb20, 0xffffff00 +-mov rb21, 64 + mov rb22, 255 + mov rb23, 24 + +@@ -123,6 +120,7 @@ mov ra15, 0 + + # Compute part of VPM to use for DMA output + mov r2, qpu_num ++shl r2, r2, 1 # Convert QPU numbers to be even (this means we can only use 8 QPUs, but is necessary as we need to save 16bit intermediate results) + and r2, r2, 15 + mov r1, r2 + asr r1, r1, 2 +@@ -135,16 +133,21 @@ shl r0, r0, 5 + add rb27, r0, r1 + + # Compute part of VPM to save data into +-mov r2, qpu_num +-and r2, r2, 15 +-mov r1, r2 +-asr r1, r1, 2 +-shl r1, r1, 6 +-mov r0, r2 +-and r0, r0, 3 +-add r0, r0, r1 +-mov r1, vpm_setup(0, 4, h8p(0, 0)) ++mov r2, qpu_num # qpu_num = abcd ++shl r2, r2, 1 ++and r2, r2, 15 # r2 = bcd0 ++mov r1, r2 # r1 = bcd0 ++asr r1, r1, 2 # r1 = bc ++shl r1, r1, 6 # r1 = bc000000 ++mov r0, r2 # r0 = bcd0 ++and r0, r0, 3 # r0 = d0 ++add r0, r0, r1 # r0 = bc0000d0 ++mov r1, vpm_setup(0, 4, h8p(0, 0)) # 4 is stride - stride acts on ADDR which is Y[5:0],B[1:0] for 8 bit + add rb28, r0, r1 ++asr r0, r0, 1 # r0 = bc0000d ++# Prepare VPM command for 16bit intermediates ++mov r1, vpm_setup(0, 2, h16p(0, 0)) # 2 is stride - stride acts on ADDR which is Y[5:0],H[0] for 16 bit ++add rb21, r0, r1 + + # Compute base address for first and second access + mov r0, ra_x_base # Load x +@@ -345,6 +348,171 @@ mov vw_addr, unif # start the VDW + + ################################################################################ + ++# mc_filter_uv_b0(next_kernel, x, y, frame_u_base, frame_v_base, height, hcoeffs[0], hcoeffs[1], vcoeffs[0], vcoeffs[1], this_u_dst, this_v_dst) ++ ++# At this point we have already issued two pairs of texture requests for the current block ++# ra_x_base, ra_x16_base point to the current coordinates for this block ++::mc_filter_uv_b0 ++mov ra31, unif ++ ++# per-channel shifts were calculated on the *previous* invocation ++ ++mov ra_xshift, ra_xshift_next ++ ++# get base addresses and per-channel shifts for *next* invocation ++add r0, unif, elem_num # x ++max r0, r0, 0; mov r1, unif # y ++min r0, r0, rb_frame_width_minus_1 ; mov r3, unif # frame_base ++shl ra_xshift_next, r0, 3 ++sub r2, unif, r3 # compute offset from frame base u to frame base v ++add r0, r0, r3 ++and rb_x_base_next, r0, ~3 ++mov ra_y_next, r1 ++add ra_x2_base_next, rb_x_base_next, r2 ++ ++# set up VPM write ++mov vw_setup, rb28 ++ ++# get width,height of block ++mov r2, 16 ++mov r0, unif ++shr r1, r0, r2 # Extract width ++sub rb29, rb24, r1 # Compute vdw_setup1(dst_pitch-width) ++and r0, r0, rb22 # Extract height ++add rb17, r0, 5 ++add rb18, r0, 7 ++shl r0, r0, 7 ++add r0, r0, r1 # Combine width and height of destination area ++shl r0, r0, r2 # Shift into bits 16 upwards of the vdw_setup0 register ++add rb26, r0, rb27 ++ ++sub.setf -,8,r1 # 8-r1, so if <0 (negative) we need to use the full code ++ ++# get filter coefficients ++ ++mov r0, unif ++asr ra3, r0, rb23; mul24 r0, r0, ra22 ++asr ra2, r0, rb23; mul24 r0, r0, ra22 ++asr ra1, r0, rb23; mul24 r0, r0, ra22 ++asr ra0, r0, rb23; mov r0, unif ++asr ra7, r0, rb23; mul24 r0, r0, ra22 ++asr ra6, r0, rb23; mul24 r0, r0, ra22 ++asr ra5, r0, rb23; mul24 r0, r0, ra22 ++asr ra4, r0, rb23; mov r0, unif ++asr rb11, r0, rb23; mul24 r0, r0, ra22 ++asr rb10, r0, rb23; mul24 r0, r0, ra22 ++asr rb9, r0, rb23; mul24 r0, r0, ra22 ++asr rb8, r0, rb23; mov r0, unif ++asr rb15, r0, rb23; mul24 r0, r0, ra22 ++asr rb14, r0, rb23; mul24 r0, r0, ra22 ++asr rb13, r0, rb23; mul24 r0, r0, ra22 ++asr rb12, r0, rb23 ++ ++# r2 is elem_num ++# r3 is loop counter ++ ++mov r5rep, -8 ++mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++ ++# retrieve texture results and pick out bytes ++# then submit two more texture requests ++ ++mov r3, 0 ++ ++:uvloop_b0 ++# retrieve texture results and pick out bytes ++# then submit two more texture requests ++ ++sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 # loop counter increment ++shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 ++mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 ++mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch ++shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 # v8subs masks out all but bottom byte ++ ++max r2, ra_y, 0 # y ++min r2, r2, rb_frame_height_minus_1 ++add ra_y, ra_y, 1 ; mul24 r2, r2, r3 ++add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 ++add t0s, ra_x2_base, r2 ++ ++# generate seven shifted versions ++# interleave with scroll of vertical context ++ ++mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++ ++nop ; mul24 r2, r0, ra0 ++nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 ++nop ; mul24 r3, ra1 << 1, r0 << 1 ++nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 ++add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 ++nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 ++add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 ++nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 ++add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 ++nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 ++add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 ++nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 ++add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 ++nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 ++add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 ++nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 ++add r0, r2, r3 ++ ++mov r3, rb31 ++ ++mov ra8, ra9 ++mov ra9, ra10 ++mov ra10, ra11 ++mov ra11, ra12 ++mov ra12, ra13 ++mov ra13, ra14 ++ ++sub.setf -, r3, 8 ; mov r1, ra22 ++ ++# apply horizontal filter ++brr.anyn -, r:uvloop_b0 ++mov ra14, ra15 ; mul24 r0, r0, r1 # last bit of context scroll ++asr ra15, r0, 8 ; nop ++nop ; nop # Delay slot 3 (TODO move more of the context scroll into here) ++ ++# apply vertical filter and write to VPM ++ ++nop ; mul24 r1, ra14, rb14 ++nop ; mul24 r0, ra13, rb13 ++add r1, r1, r0 ; mul24 r0, ra12, rb12 ++add r1, r1, r0 ; mul24 r0, ra11, rb11 ++add r1, r1, r0 ; mul24 r0, ra10, rb10 ++add r1, r1, r0 ; mul24 r0, ra9, rb9 ++add r1, r1, r0 ; mul24 r0, ra8, rb8 ++add r1, r1, r0 ; mul24 r0, ra15, rb15 ++add r1, r1, r0 ; mov -, vw_wait ++sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 ++asr r1, r1, 14 ++add r1, r1, ra21 ++brr.anyn -, r:uvloop ++asr r1, r1, 6 # Delay 1 ++min r1, r1, rb22 # Delay 2 ++max vpm, r1, 0 # Delay 3 ++ ++# DMA out for U ++ ++mov vw_setup, rb26 # VDW setup 0 ++mov vw_setup, rb29 # Stride ++mov vw_addr, unif # start the VDW ++ ++# DMA out for V ++# We need to wait for the U to complete first, but have nothing useful to compute while we wait. ++# Could potentially push this write into the start of the next pipeline stage. ++mov r0, 16 ++mov -, vw_wait ++ ++bra -, ra31 ++add vw_setup, rb26, r0 # VDW setup 0 ++mov vw_setup, rb29 # Stride ++mov vw_addr, unif # start the VDW ++ ++################################################################################ ++ + ::mc_filter_uv_b + mov ra31, unif + +-- +2.5.0 + + +From 2949df95e5f5008ac156336d9089e7b3e9e67841 Mon Sep 17 00:00:00 2001 +From: Peter de Rivaz <peter.derivaz@gmail.com> +Date: Thu, 14 May 2015 10:04:55 +0100 +Subject: [PATCH 25/68] Switch to using 16bit temp buffers + +--- + libavcodec/hevc.c | 2 +- + libavcodec/rpi_shader.c | 4 ++-- + libavcodec/rpi_shader.qasm | 10 +++++----- + 3 files changed, 8 insertions(+), 8 deletions(-) + +diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c +index 3994f2e..68cd237 100644 +--- a/libavcodec/hevc.c ++++ b/libavcodec/hevc.c +@@ -2136,7 +2136,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, + uint32_t *u = s->u_mvs[chan & 7]; + for(int start_y=0;start_y < nPbH_c;start_y+=16) { + for(int start_x=0;start_x < nPbW_c;start_x+=RPI_CHROMA_BLOCK_WIDTH) { +- u++[-RPI_CHROMA_COMMAND_WORDS] = s->mc_filter_uv; ++ u++[-RPI_CHROMA_COMMAND_WORDS] = s->mc_filter_uv_b0; + u++[-RPI_CHROMA_COMMAND_WORDS] = x1_c - 3 + start_x; + u++[-RPI_CHROMA_COMMAND_WORDS] = y1_c - 3 + start_y; + u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[1]); +diff --git a/libavcodec/rpi_shader.c b/libavcodec/rpi_shader.c +index 88ad20b..ffd3a07 100644 +--- a/libavcodec/rpi_shader.c ++++ b/libavcodec/rpi_shader.c +@@ -220,7 +220,7 @@ unsigned int rpi_shader[] = { + /* [0x00000600] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 + /* [0x00000608] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 + /* [0x00000610] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 +-/* [0x00000618] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 ++/* [0x00000618] */ 0x159d5fc0, 0x10021c67, // mov vw_setup, rb21 + /* [0x00000620] */ 0x00000010, 0xe00208a7, // mov r2, 16 + /* [0x00000628] */ 0x15827d80, 0x10020827, // mov r0, unif + /* [0x00000630] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 +@@ -346,7 +346,7 @@ unsigned int rpi_shader[] = { + /* [0x000009e0] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 + /* [0x000009e8] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 + /* [0x000009f0] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 +-/* [0x000009f8] */ 0x0c9dc7c0, 0x10020c67, // add vr_setup, r3, rb28 ++/* [0x000009f8] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 + /* [0x00000a00] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 + /* [0x00000a08] */ 0x15827d80, 0x10020827, // mov r0, unif + /* [0x00000a10] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 +diff --git a/libavcodec/rpi_shader.qasm b/libavcodec/rpi_shader.qasm +index 635b894..9577121 100644 +--- a/libavcodec/rpi_shader.qasm ++++ b/libavcodec/rpi_shader.qasm +@@ -26,7 +26,7 @@ + # ra23 8 + # + # rb20 0xffffff00 +-# rb21 vpm_setup for writing 16bit results into VPM ++# rb21 vpm_setup for reading/writing 16bit results into VPM + # rb22 255 + # rb23 24 + # +@@ -370,8 +370,8 @@ and rb_x_base_next, r0, ~3 + mov ra_y_next, r1 + add ra_x2_base_next, rb_x_base_next, r2 + +-# set up VPM write +-mov vw_setup, rb28 ++# set up VPM write, we need to save 16bit precision ++mov vw_setup, rb21 + + # get width,height of block + mov r2, 16 +@@ -554,8 +554,8 @@ add r0, r0, r1 # Combine width and height of destination area + shl r0, r0, r2 # Shift into bits 16 upwards of the vdw_setup0 register + add rb26, r0, rb27 + +-# In a B frame, so also set up VPM read +-add vr_setup, r3, rb28 ++# In a B frame, so also set up VPM read (reading back 16bit precision) ++add vr_setup, r3, rb21 + + sub.setf -,8,r1 # 8-r1, so if <0 (negative) we need to use the full code + +-- +2.5.0 + + +From 7a3732950264ea60ac26aeca55d3ac269798d0c3 Mon Sep 17 00:00:00 2001 +From: Peter de Rivaz <peter.derivaz@gmail.com> +Date: Thu, 14 May 2015 10:30:44 +0100 +Subject: [PATCH 26/68] Corrected B prediction: matching md5 sum for hobbit50 + +--- + libavcodec/rpi_shader.c | 815 ++++++++++++++++++++++----------------------- + libavcodec/rpi_shader.h | 12 +- + libavcodec/rpi_shader.qasm | 36 +- + 3 files changed, 429 insertions(+), 434 deletions(-) + +diff --git a/libavcodec/rpi_shader.c b/libavcodec/rpi_shader.c +index ffd3a07..77cca46 100644 +--- a/libavcodec/rpi_shader.c ++++ b/libavcodec/rpi_shader.c +@@ -38,431 +38,428 @@ unsigned int rpi_shader[] = { + /* [0x00000068] */ 0x00000020, 0xe0020567, // mov ra21, 32 + /* [0x00000070] */ 0x00000100, 0xe00205a7, // mov ra22, 256 + /* [0x00000078] */ 0x00000008, 0xe00205e7, // mov ra23, 8 +-/* [0x00000080] */ 0xffffff00, 0xe0021527, // mov rb20, 0xffffff00 +-/* [0x00000088] */ 0x000000ff, 0xe00215a7, // mov rb22, 255 +-/* [0x00000090] */ 0x00000018, 0xe00215e7, // mov rb23, 24 +-/* [0x00000098] */ 0x00000000, 0xe0020227, // mov ra8, 0 +-/* [0x000000a0] */ 0x00000000, 0xe0020267, // mov ra9, 0 +-/* [0x000000a8] */ 0x00000000, 0xe00202a7, // mov ra10, 0 +-/* [0x000000b0] */ 0x00000000, 0xe00202e7, // mov ra11, 0 +-/* [0x000000b8] */ 0x00000000, 0xe0020327, // mov ra12, 0 +-/* [0x000000c0] */ 0x00000000, 0xe0020367, // mov ra13, 0 +-/* [0x000000c8] */ 0x00000000, 0xe00203a7, // mov ra14, 0 +-/* [0x000000d0] */ 0x00000000, 0xe00203e7, // mov ra15, 0 +-/* [0x000000d8] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num +-/* [0x000000e0] */ 0x119c15c0, 0xd00208a7, // shl r2, r2, 1 +-/* [0x000000e8] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 +-/* [0x000000f0] */ 0x159e7480, 0x10020867, // mov r1, r2 +-/* [0x000000f8] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 +-/* [0x00000100] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 +-/* [0x00000108] */ 0x159e7480, 0x10020827, // mov r0, r2 +-/* [0x00000110] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 +-/* [0x00000118] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 +-/* [0x00000120] */ 0x80004004, 0xe0020867, // mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) +-/* [0x00000128] */ 0x119c51c0, 0xd0020827, // shl r0, r0, 5 +-/* [0x00000130] */ 0x0c9e7040, 0x100216e7, // add rb27, r0, r1 +-/* [0x00000138] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num +-/* [0x00000140] */ 0x119c15c0, 0xd00208a7, // shl r2, r2, 1 +-/* [0x00000148] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 +-/* [0x00000150] */ 0x159e7480, 0x10020867, // mov r1, r2 +-/* [0x00000158] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 +-/* [0x00000160] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 +-/* [0x00000168] */ 0x159e7480, 0x10020827, // mov r0, r2 +-/* [0x00000170] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 +-/* [0x00000178] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 +-/* [0x00000180] */ 0x00004800, 0xe0020867, // mov r1, vpm_setup(0, 4, h8p(0, 0)) +-/* [0x00000188] */ 0x0c9e7040, 0x10021727, // add rb28, r0, r1 +-/* [0x00000190] */ 0x0f9c11c0, 0xd0020827, // asr r0, r0, 1 +-/* [0x00000198] */ 0x00002900, 0xe0020867, // mov r1, vpm_setup(0, 2, h16p(0, 0)) +-/* [0x000001a0] */ 0x0c9e7040, 0x10021567, // add rb21, r0, r1 +-/* [0x000001a8] */ 0x15427d80, 0x10020827, // mov r0, ra_x_base +-/* [0x000001b0] */ 0x937401f6, 0xd0024821, // max r0, r0, 0; mov r1, ra_y +-/* [0x000001b8] */ 0x926191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, ra_x2_base +-/* [0x000001c0] */ 0x916431f6, 0xd00244e2, // shl ra_xshift_next, r0, 3 ; mov r2, ra_u2v_ref_offset +-/* [0x000001c8] */ 0x0c9c13c0, 0xd0020767, // add ra_y, r1, 1 +-/* [0x000001d0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 +-/* [0x000001d8] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 +-/* [0x000001e0] */ 0x939c03c0, 0xd0025850, // max r1, r1, 0 ; mov ra_x_base, r0 +-/* [0x000001e8] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 +-/* [0x000001f0] */ 0x4c9d040f, 0x100248a1, // add r2, r2, r0 ; mul24 r1, r1, rb_pitch +-/* [0x000001f8] */ 0x8c9e7052, 0x10025e18, // add t0s, r0, r1 ; mov ra_x2_base, r2 +-/* [0x00000200] */ 0x0c9e7440, 0x10020e27, // add t0s, r2, r1 +-/* [0x00000208] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000080] */ 0x00000040, 0xe00207a7, // mov ra30, 64 ++/* [0x00000088] */ 0xffffff00, 0xe0021527, // mov rb20, 0xffffff00 ++/* [0x00000090] */ 0x000000ff, 0xe00215a7, // mov rb22, 255 ++/* [0x00000098] */ 0x00000018, 0xe00215e7, // mov rb23, 24 ++/* [0x000000a0] */ 0x00000000, 0xe0020227, // mov ra8, 0 ++/* [0x000000a8] */ 0x00000000, 0xe0020267, // mov ra9, 0 ++/* [0x000000b0] */ 0x00000000, 0xe00202a7, // mov ra10, 0 ++/* [0x000000b8] */ 0x00000000, 0xe00202e7, // mov ra11, 0 ++/* [0x000000c0] */ 0x00000000, 0xe0020327, // mov ra12, 0 ++/* [0x000000c8] */ 0x00000000, 0xe0020367, // mov ra13, 0 ++/* [0x000000d0] */ 0x00000000, 0xe00203a7, // mov ra14, 0 ++/* [0x000000d8] */ 0x00000000, 0xe00203e7, // mov ra15, 0 ++/* [0x000000e0] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num ++/* [0x000000e8] */ 0x119c15c0, 0xd00208a7, // shl r2, r2, 1 ++/* [0x000000f0] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 ++/* [0x000000f8] */ 0x159e7480, 0x10020867, // mov r1, r2 ++/* [0x00000100] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 ++/* [0x00000108] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 ++/* [0x00000110] */ 0x159e7480, 0x10020827, // mov r0, r2 ++/* [0x00000118] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 ++/* [0x00000120] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 ++/* [0x00000128] */ 0x80004004, 0xe0020867, // mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) ++/* [0x00000130] */ 0x119c51c0, 0xd0020827, // shl r0, r0, 5 ++/* [0x00000138] */ 0x0c9e7040, 0x100216e7, // add rb27, r0, r1 ++/* [0x00000140] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num ++/* [0x00000148] */ 0x119c15c0, 0xd00208a7, // shl r2, r2, 1 ++/* [0x00000150] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 ++/* [0x00000158] */ 0x159e7480, 0x10020867, // mov r1, r2 ++/* [0x00000160] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 ++/* [0x00000168] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 ++/* [0x00000170] */ 0x159e7480, 0x10020827, // mov r0, r2 ++/* [0x00000178] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 ++/* [0x00000180] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 ++/* [0x00000188] */ 0x00004800, 0xe0020867, // mov r1, vpm_setup(0, 4, h8p(0, 0)) ++/* [0x00000190] */ 0x0c9e7040, 0x10021727, // add rb28, r0, r1 ++/* [0x00000198] */ 0x0f9c11c0, 0xd0020827, // asr r0, r0, 1 ++/* [0x000001a0] */ 0x00002900, 0xe0020867, // mov r1, vpm_setup(0, 2, h16p(0, 0)) ++/* [0x000001a8] */ 0x0c9e7040, 0x10021567, // add rb21, r0, r1 ++/* [0x000001b0] */ 0x15427d80, 0x10020827, // mov r0, ra_x_base ++/* [0x000001b8] */ 0x937401f6, 0xd0024821, // max r0, r0, 0; mov r1, ra_y ++/* [0x000001c0] */ 0x926191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, ra_x2_base ++/* [0x000001c8] */ 0x916431f6, 0xd00244e2, // shl ra_xshift_next, r0, 3 ; mov r2, ra_u2v_ref_offset ++/* [0x000001d0] */ 0x0c9c13c0, 0xd0020767, // add ra_y, r1, 1 ++/* [0x000001d8] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 ++/* [0x000001e0] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 ++/* [0x000001e8] */ 0x939c03c0, 0xd0025850, // max r1, r1, 0 ; mov ra_x_base, r0 ++/* [0x000001f0] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 ++/* [0x000001f8] */ 0x4c9d040f, 0x100248a1, // add r2, r2, r0 ; mul24 r1, r1, rb_pitch ++/* [0x00000200] */ 0x8c9e7052, 0x10025e18, // add t0s, r0, r1 ; mov ra_x2_base, r2 ++/* [0x00000208] */ 0x0c9e7440, 0x10020e27, // add t0s, r2, r1 + /* [0x00000210] */ 0x15827d80, 0x10020827, // mov r0, unif + /* [0x00000218] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000220] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 +-/* [0x00000228] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 +-/* [0x00000230] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 +-/* [0x00000238] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 +-/* [0x00000240] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch +-/* [0x00000248] */ 0x0c427380, 0x10020e27, // add t0s, r1, ra_x_base +-/* [0x00000250] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_x2_base ++/* [0x00000220] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000228] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 ++/* [0x00000230] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 ++/* [0x00000238] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 ++/* [0x00000240] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 ++/* [0x00000248] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch ++/* [0x00000250] */ 0x0c427380, 0x10020e27, // add t0s, r1, ra_x_base ++/* [0x00000258] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_x2_base + // ::mc_filter_uv +-/* [0x00000258] */ 0x15827d80, 0x100207e7, // mov ra31, unif +-/* [0x00000260] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next +-/* [0x00000268] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num +-/* [0x00000270] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif +-/* [0x00000278] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif +-/* [0x00000280] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 +-/* [0x00000288] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 +-/* [0x00000290] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 +-/* [0x00000298] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 +-/* [0x000002a0] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 +-/* [0x000002a8] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 +-/* [0x000002b0] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 +-/* [0x000002b8] */ 0x00000010, 0xe00208a7, // mov r2, 16 +-/* [0x000002c0] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x000002c8] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 +-/* [0x000002d0] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 +-/* [0x000002d8] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 +-/* [0x000002e0] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 +-/* [0x000002e8] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 +-/* [0x000002f0] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 +-/* [0x000002f8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 +-/* [0x00000300] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 +-/* [0x00000308] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 +-/* [0x00000310] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 +-/* [0x00000318] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000320] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000328] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000330] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000338] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif +-/* [0x00000340] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000348] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000350] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000358] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif +-/* [0x00000360] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000368] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000370] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000378] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif +-/* [0x00000380] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000388] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000390] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000398] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 +-/* [0x000003a0] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 +-/* [0x000003a8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-/* [0x000003b0] */ 0x00000000, 0xe00208e7, // mov r3, 0 ++/* [0x00000260] */ 0x15827d80, 0x100207e7, // mov ra31, unif ++/* [0x00000268] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next ++/* [0x00000270] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num ++/* [0x00000278] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif ++/* [0x00000280] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif ++/* [0x00000288] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 ++/* [0x00000290] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 ++/* [0x00000298] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 ++/* [0x000002a0] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 ++/* [0x000002a8] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 ++/* [0x000002b0] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 ++/* [0x000002b8] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 ++/* [0x000002c0] */ 0x00000010, 0xe00208a7, // mov r2, 16 ++/* [0x000002c8] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x000002d0] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 ++/* [0x000002d8] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 ++/* [0x000002e0] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 ++/* [0x000002e8] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 ++/* [0x000002f0] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 ++/* [0x000002f8] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 ++/* [0x00000300] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 ++/* [0x00000308] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 ++/* [0x00000310] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 ++/* [0x00000318] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 ++/* [0x00000320] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000328] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000330] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000338] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000340] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif ++/* [0x00000348] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000350] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000358] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000360] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif ++/* [0x00000368] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000370] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000378] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000380] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif ++/* [0x00000388] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000390] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000398] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000003a0] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 ++/* [0x000003a8] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 ++/* [0x000003b0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x000003b8] */ 0x00000000, 0xe00208e7, // mov r3, 0 + // :uvloop +-/* [0x000003b8] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 +-/* [0x000003c0] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 +-/* [0x000003c8] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 +-/* [0x000003d0] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch +-/* [0x000003d8] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 +-/* [0x000003e0] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 +-/* [0x000003e8] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 +-/* [0x000003f0] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 +-/* [0x000003f8] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 +-/* [0x00000400] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 +-/* [0x00000408] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-/* [0x00000410] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 +-/* [0x00000418] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 +-/* [0x00000420] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 +-/* [0x00000428] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 +-/* [0x00000430] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 +-/* [0x00000438] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 +-/* [0x00000440] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 +-/* [0x00000448] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 +-/* [0x00000450] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 +-/* [0x00000458] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 +-/* [0x00000460] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 +-/* [0x00000468] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 +-/* [0x00000470] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 +-/* [0x00000478] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 +-/* [0x00000480] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 +-/* [0x00000488] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 +-/* [0x00000490] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 +-/* [0x00000498] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 +-/* [0x000004a0] */ 0x15267d80, 0x10020227, // mov ra8, ra9 +-/* [0x000004a8] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 +-/* [0x000004b0] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 +-/* [0x000004b8] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 +-/* [0x000004c0] */ 0x15367d80, 0x10020327, // mov ra12, ra13 +-/* [0x000004c8] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 +-/* [0x000004d0] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 +-/* [0x000004d8] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop +-/* [0x000004e0] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 +-/* [0x000004e8] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop +-/* [0x000004f0] */ 0x009e7000, 0x100009e7, // nop ; nop +-/* [0x000004f8] */ 0x4038e037, 0x100049e1, // nop ; mul24 r1, ra14, rb14 +-/* [0x00000500] */ 0x4034d037, 0x100049e0, // nop ; mul24 r0, ra13, rb13 +-/* [0x00000508] */ 0x4c30c237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb12 +-/* [0x00000510] */ 0x4c2cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb11 +-/* [0x00000518] */ 0x4c28a237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb10 +-/* [0x00000520] */ 0x4c249237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb9 +-/* [0x00000528] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 +-/* [0x00000530] */ 0x4c3cf237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb15 +-/* [0x00000538] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait +-/* [0x00000540] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 +-/* [0x00000548] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 +-/* [0x00000550] */ 0x0c567380, 0x10020867, // add r1, r1, ra21 +-/* [0x00000558] */ 0xfffffe40, 0xf06809e7, // brr.anyn -, r:uvloop +-/* [0x00000560] */ 0x0f9c63c0, 0xd0020867, // asr r1, r1, 6 +-/* [0x00000568] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 +-/* [0x00000570] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 +-/* [0x00000578] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 +-/* [0x00000580] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 +-/* [0x00000588] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif +-/* [0x00000590] */ 0x00000010, 0xe0020827, // mov r0, 16 +-/* [0x00000598] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait +-/* [0x000005a0] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 +-/* [0x000005a8] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 +-/* [0x000005b0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 +-/* [0x000005b8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif ++/* [0x000003c0] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 ++/* [0x000003c8] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 ++/* [0x000003d0] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 ++/* [0x000003d8] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch ++/* [0x000003e0] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 ++/* [0x000003e8] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 ++/* [0x000003f0] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 ++/* [0x000003f8] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 ++/* [0x00000400] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 ++/* [0x00000408] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 ++/* [0x00000410] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x00000418] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 ++/* [0x00000420] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 ++/* [0x00000428] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 ++/* [0x00000430] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 ++/* [0x00000438] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 ++/* [0x00000440] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 ++/* [0x00000448] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 ++/* [0x00000450] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 ++/* [0x00000458] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 ++/* [0x00000460] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 ++/* [0x00000468] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 ++/* [0x00000470] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 ++/* [0x00000478] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 ++/* [0x00000480] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 ++/* [0x00000488] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 ++/* [0x00000490] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 ++/* [0x00000498] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 ++/* [0x000004a0] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 ++/* [0x000004a8] */ 0x15267d80, 0x10020227, // mov ra8, ra9 ++/* [0x000004b0] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 ++/* [0x000004b8] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 ++/* [0x000004c0] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 ++/* [0x000004c8] */ 0x15367d80, 0x10020327, // mov ra12, ra13 ++/* [0x000004d0] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 ++/* [0x000004d8] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 ++/* [0x000004e0] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop ++/* [0x000004e8] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 ++/* [0x000004f0] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop ++/* [0x000004f8] */ 0x009e7000, 0x100009e7, // nop ; nop ++/* [0x00000500] */ 0x4038e037, 0x100049e1, // nop ; mul24 r1, ra14, rb14 ++/* [0x00000508] */ 0x4034d037, 0x100049e0, // nop ; mul24 r0, ra13, rb13 ++/* [0x00000510] */ 0x4c30c237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb12 ++/* [0x00000518] */ 0x4c2cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb11 ++/* [0x00000520] */ 0x4c28a237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb10 ++/* [0x00000528] */ 0x4c249237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb9 ++/* [0x00000530] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 ++/* [0x00000538] */ 0x4c3cf237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb15 ++/* [0x00000540] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait ++/* [0x00000548] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 ++/* [0x00000550] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 ++/* [0x00000558] */ 0x0c567380, 0x10020867, // add r1, r1, ra21 ++/* [0x00000560] */ 0xfffffe40, 0xf06809e7, // brr.anyn -, r:uvloop ++/* [0x00000568] */ 0x0f9c63c0, 0xd0020867, // asr r1, r1, 6 ++/* [0x00000570] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 ++/* [0x00000578] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 ++/* [0x00000580] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 ++/* [0x00000588] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 ++/* [0x00000590] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif ++/* [0x00000598] */ 0x00000010, 0xe0020827, // mov r0, 16 ++/* [0x000005a0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x000005a8] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 ++/* [0x000005b0] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 ++/* [0x000005b8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 ++/* [0x000005c0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif + // ::mc_filter_uv_b0 +-/* [0x000005c0] */ 0x15827d80, 0x100207e7, // mov ra31, unif +-/* [0x000005c8] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next +-/* [0x000005d0] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num +-/* [0x000005d8] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif +-/* [0x000005e0] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif +-/* [0x000005e8] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 +-/* [0x000005f0] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 +-/* [0x000005f8] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 +-/* [0x00000600] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 +-/* [0x00000608] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 +-/* [0x00000610] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 +-/* [0x00000618] */ 0x159d5fc0, 0x10021c67, // mov vw_setup, rb21 +-/* [0x00000620] */ 0x00000010, 0xe00208a7, // mov r2, 16 +-/* [0x00000628] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000630] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 +-/* [0x00000638] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 +-/* [0x00000640] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 +-/* [0x00000648] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 +-/* [0x00000650] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 +-/* [0x00000658] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 +-/* [0x00000660] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 +-/* [0x00000668] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 +-/* [0x00000670] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 +-/* [0x00000678] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 +-/* [0x00000680] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000688] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000690] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000698] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000006a0] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif +-/* [0x000006a8] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000006b0] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000006b8] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000006c0] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif +-/* [0x000006c8] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000006d0] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000006d8] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000006e0] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif +-/* [0x000006e8] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000006f0] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000006f8] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000700] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 +-/* [0x00000708] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 +-/* [0x00000710] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-/* [0x00000718] */ 0x00000000, 0xe00208e7, // mov r3, 0 ++/* [0x000005c8] */ 0x15827d80, 0x100207e7, // mov ra31, unif ++/* [0x000005d0] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next ++/* [0x000005d8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num ++/* [0x000005e0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif ++/* [0x000005e8] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif ++/* [0x000005f0] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 ++/* [0x000005f8] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 ++/* [0x00000600] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 ++/* [0x00000608] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 ++/* [0x00000610] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 ++/* [0x00000618] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 ++/* [0x00000620] */ 0x159d5fc0, 0x10021c67, // mov vw_setup, rb21 ++/* [0x00000628] */ 0x00000010, 0xe00208a7, // mov r2, 16 ++/* [0x00000630] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000638] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 ++/* [0x00000640] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 ++/* [0x00000648] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 ++/* [0x00000650] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 ++/* [0x00000658] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 ++/* [0x00000660] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 ++/* [0x00000668] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 ++/* [0x00000670] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 ++/* [0x00000678] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 ++/* [0x00000680] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 ++/* [0x00000688] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000690] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000698] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000006a0] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000006a8] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif ++/* [0x000006b0] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000006b8] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000006c0] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000006c8] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif ++/* [0x000006d0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000006d8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000006e0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000006e8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif ++/* [0x000006f0] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000006f8] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000700] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000708] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 ++/* [0x00000710] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 ++/* [0x00000718] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x00000720] */ 0x00000000, 0xe00208e7, // mov r3, 0 + // :uvloop_b0 +-/* [0x00000720] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 +-/* [0x00000728] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 +-/* [0x00000730] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 +-/* [0x00000738] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch +-/* [0x00000740] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 +-/* [0x00000748] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 +-/* [0x00000750] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 +-/* [0x00000758] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 +-/* [0x00000760] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 +-/* [0x00000768] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 +-/* [0x00000770] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-/* [0x00000778] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 +-/* [0x00000780] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 +-/* [0x00000788] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 +-/* [0x00000790] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 +-/* [0x00000798] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 +-/* [0x000007a0] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 +-/* [0x000007a8] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 +-/* [0x000007b0] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 +-/* [0x000007b8] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 +-/* [0x000007c0] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 +-/* [0x000007c8] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 +-/* [0x000007d0] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 +-/* [0x000007d8] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 +-/* [0x000007e0] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 +-/* [0x000007e8] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 +-/* [0x000007f0] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 +-/* [0x000007f8] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 +-/* [0x00000800] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 +-/* [0x00000808] */ 0x15267d80, 0x10020227, // mov ra8, ra9 +-/* [0x00000810] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 +-/* [0x00000818] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 +-/* [0x00000820] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 +-/* [0x00000828] */ 0x15367d80, 0x10020327, // mov ra12, ra13 +-/* [0x00000830] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 +-/* [0x00000838] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 +-/* [0x00000840] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop_b0 +-/* [0x00000848] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 +-/* [0x00000850] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop +-/* [0x00000858] */ 0x009e7000, 0x100009e7, // nop ; nop +-/* [0x00000860] */ 0x4038e037, 0x100049e1, // nop ; mul24 r1, ra14, rb14 +-/* [0x00000868] */ 0x4034d037, 0x100049e0, // nop ; mul24 r0, ra13, rb13 +-/* [0x00000870] */ 0x4c30c237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb12 +-/* [0x00000878] */ 0x4c2cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb11 +-/* [0x00000880] */ 0x4c28a237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb10 +-/* [0x00000888] */ 0x4c249237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb9 +-/* [0x00000890] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 +-/* [0x00000898] */ 0x4c3cf237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb15 +-/* [0x000008a0] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait +-/* [0x000008a8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 +-/* [0x000008b0] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 +-/* [0x000008b8] */ 0x0c567380, 0x10020867, // add r1, r1, ra21 +-/* [0x000008c0] */ 0xfffffad8, 0xf06809e7, // brr.anyn -, r:uvloop +-/* [0x000008c8] */ 0x0f9c63c0, 0xd0020867, // asr r1, r1, 6 +-/* [0x000008d0] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 +-/* [0x000008d8] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 +-/* [0x000008e0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 +-/* [0x000008e8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 +-/* [0x000008f0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif +-/* [0x000008f8] */ 0x00000010, 0xe0020827, // mov r0, 16 +-/* [0x00000900] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait +-/* [0x00000908] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 +-/* [0x00000910] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 +-/* [0x00000918] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 +-/* [0x00000920] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif ++/* [0x00000728] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 ++/* [0x00000730] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 ++/* [0x00000738] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 ++/* [0x00000740] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch ++/* [0x00000748] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 ++/* [0x00000750] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 ++/* [0x00000758] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 ++/* [0x00000760] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 ++/* [0x00000768] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 ++/* [0x00000770] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 ++/* [0x00000778] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x00000780] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 ++/* [0x00000788] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 ++/* [0x00000790] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 ++/* [0x00000798] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 ++/* [0x000007a0] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 ++/* [0x000007a8] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 ++/* [0x000007b0] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 ++/* [0x000007b8] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 ++/* [0x000007c0] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 ++/* [0x000007c8] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 ++/* [0x000007d0] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 ++/* [0x000007d8] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 ++/* [0x000007e0] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 ++/* [0x000007e8] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 ++/* [0x000007f0] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 ++/* [0x000007f8] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 ++/* [0x00000800] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 ++/* [0x00000808] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 ++/* [0x00000810] */ 0x15267d80, 0x10020227, // mov ra8, ra9 ++/* [0x00000818] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 ++/* [0x00000820] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 ++/* [0x00000828] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 ++/* [0x00000830] */ 0x15367d80, 0x10020327, // mov ra12, ra13 ++/* [0x00000838] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 ++/* [0x00000840] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 ++/* [0x00000848] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop_b0 ++/* [0x00000850] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 ++/* [0x00000858] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop ++/* [0x00000860] */ 0x009e7000, 0x100009e7, // nop ; nop ++/* [0x00000868] */ 0x4038e037, 0x100049e1, // nop ; mul24 r1, ra14, rb14 ++/* [0x00000870] */ 0x4034d037, 0x100049e0, // nop ; mul24 r0, ra13, rb13 ++/* [0x00000878] */ 0x4c30c237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb12 ++/* [0x00000880] */ 0x4c2cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb11 ++/* [0x00000888] */ 0x4c28a237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb10 ++/* [0x00000890] */ 0x4c249237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb9 ++/* [0x00000898] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 ++/* [0x000008a0] */ 0x4c3cf237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb15 ++/* [0x000008a8] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait ++/* [0x000008b0] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 ++/* [0x000008b8] */ 0xfffffe50, 0xf06809e7, // brr.anyn -, r:uvloop_b0 ++/* [0x000008c0] */ 0x0f9ce3c0, 0xd0020c27, // asr vpm, r1, 14 ++/* [0x000008c8] */ 0x009e7000, 0x100009e7, // nop ++/* [0x000008d0] */ 0x009e7000, 0x100009e7, // nop ++/* [0x000008d8] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 ++/* [0x000008e0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 ++/* [0x000008e8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif ++/* [0x000008f0] */ 0x00000010, 0xe0020827, // mov r0, 16 ++/* [0x000008f8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x00000900] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 ++/* [0x00000908] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 ++/* [0x00000910] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 ++/* [0x00000918] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif + // ::mc_filter_uv_b +-/* [0x00000928] */ 0x15827d80, 0x100207e7, // mov ra31, unif +-/* [0x00000930] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next +-/* [0x00000938] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num +-/* [0x00000940] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif +-/* [0x00000948] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif +-/* [0x00000950] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 +-/* [0x00000958] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 +-/* [0x00000960] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 +-/* [0x00000968] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 +-/* [0x00000970] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 +-/* [0x00000978] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 +-/* [0x00000980] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 +-/* [0x00000988] */ 0x00000010, 0xe00208a7, // mov r2, 16 +-/* [0x00000990] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000998] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 +-/* [0x000009a0] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 +-/* [0x000009a8] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 +-/* [0x000009b0] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 +-/* [0x000009b8] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 +-/* [0x000009c0] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 +-/* [0x000009c8] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 +-/* [0x000009d0] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 +-/* [0x000009d8] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 +-/* [0x000009e0] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 +-/* [0x000009e8] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 +-/* [0x000009f0] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 +-/* [0x000009f8] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 +-/* [0x00000a00] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 +-/* [0x00000a08] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000a10] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000a18] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000a20] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000a28] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif +-/* [0x00000a30] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000a38] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000a40] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000a48] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif +-/* [0x00000a50] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000a58] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000a60] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000a68] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif +-/* [0x00000a70] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000a78] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000a80] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000a88] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 +-/* [0x00000a90] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 +-/* [0x00000a98] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-/* [0x00000aa0] */ 0x00000000, 0xe00208e7, // mov r3, 0 ++/* [0x00000920] */ 0x15827d80, 0x100207e7, // mov ra31, unif ++/* [0x00000928] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next ++/* [0x00000930] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num ++/* [0x00000938] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif ++/* [0x00000940] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif ++/* [0x00000948] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 ++/* [0x00000950] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 ++/* [0x00000958] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 ++/* [0x00000960] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 ++/* [0x00000968] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 ++/* [0x00000970] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 ++/* [0x00000978] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 ++/* [0x00000980] */ 0x00000010, 0xe00208a7, // mov r2, 16 ++/* [0x00000988] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000990] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 ++/* [0x00000998] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 ++/* [0x000009a0] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 ++/* [0x000009a8] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 ++/* [0x000009b0] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 ++/* [0x000009b8] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 ++/* [0x000009c0] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 ++/* [0x000009c8] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 ++/* [0x000009d0] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 ++/* [0x000009d8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 ++/* [0x000009e0] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 ++/* [0x000009e8] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 ++/* [0x000009f0] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 ++/* [0x000009f8] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 ++/* [0x00000a00] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000a08] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000a10] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000a18] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000a20] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif ++/* [0x00000a28] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000a30] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000a38] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000a40] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif ++/* [0x00000a48] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000a50] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000a58] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000a60] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif ++/* [0x00000a68] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000a70] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000a78] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000a80] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 ++/* [0x00000a88] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 ++/* [0x00000a90] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x00000a98] */ 0x00000000, 0xe00208e7, // mov r3, 0 + // :uvloop_b +-/* [0x00000aa8] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 +-/* [0x00000ab0] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 +-/* [0x00000ab8] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 +-/* [0x00000ac0] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch +-/* [0x00000ac8] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 +-/* [0x00000ad0] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 +-/* [0x00000ad8] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 +-/* [0x00000ae0] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 +-/* [0x00000ae8] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 +-/* [0x00000af0] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 +-/* [0x00000af8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-/* [0x00000b00] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 +-/* [0x00000b08] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 +-/* [0x00000b10] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 +-/* [0x00000b18] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 +-/* [0x00000b20] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 +-/* [0x00000b28] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 +-/* [0x00000b30] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 +-/* [0x00000b38] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 +-/* [0x00000b40] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 +-/* [0x00000b48] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 +-/* [0x00000b50] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 +-/* [0x00000b58] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 +-/* [0x00000b60] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 +-/* [0x00000b68] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 +-/* [0x00000b70] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 +-/* [0x00000b78] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 +-/* [0x00000b80] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 +-/* [0x00000b88] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 +-/* [0x00000b90] */ 0x15267d80, 0x10020227, // mov ra8, ra9 +-/* [0x00000b98] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 +-/* [0x00000ba0] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 +-/* [0x00000ba8] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 +-/* [0x00000bb0] */ 0x15367d80, 0x10020327, // mov ra12, ra13 +-/* [0x00000bb8] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 +-/* [0x00000bc0] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 +-/* [0x00000bc8] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop_b +-/* [0x00000bd0] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 +-/* [0x00000bd8] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop +-/* [0x00000be0] */ 0x009e7000, 0x100009e7, // nop ; nop +-/* [0x00000be8] */ 0x4038e037, 0x100049e1, // nop ; mul24 r1, ra14, rb14 +-/* [0x00000bf0] */ 0x4034d037, 0x100049e0, // nop ; mul24 r0, ra13, rb13 +-/* [0x00000bf8] */ 0x4c30c237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb12 +-/* [0x00000c00] */ 0x4c2cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb11 +-/* [0x00000c08] */ 0x4c28a237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb10 +-/* [0x00000c10] */ 0x4c249237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb9 +-/* [0x00000c18] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 +-/* [0x00000c20] */ 0x4c3cf237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb15 +-/* [0x00000c28] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait +-/* [0x00000c30] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 +-/* [0x00000c38] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 +-/* [0x00000c40] */ 0x0c567380, 0x10020867, // add r1, r1, ra21 +-/* [0x00000c48] */ 0x0f9c63c0, 0xd0020867, // asr r1, r1, 6 +-/* [0x00000c50] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 +-/* [0x00000c58] */ 0x0cc01dc0, 0xd0020827, // add r0, vpm, 1 +-/* [0x00000c60] */ 0xfffffe28, 0xf06809e7, // brr.anyn -, r:uvloop_b +-/* [0x00000c68] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 +-/* [0x00000c70] */ 0x0c9e7200, 0x10020867, // add r1, r1, r0 +-/* [0x00000c78] */ 0x0e9c13c0, 0xd0020c27, // shr vpm, r1, 1 +-/* [0x00000c80] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 +-/* [0x00000c88] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 +-/* [0x00000c90] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif +-/* [0x00000c98] */ 0x00000010, 0xe0020827, // mov r0, 16 +-/* [0x00000ca0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait +-/* [0x00000ca8] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 +-/* [0x00000cb0] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 +-/* [0x00000cb8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 +-/* [0x00000cc0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif ++/* [0x00000aa0] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 ++/* [0x00000aa8] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 ++/* [0x00000ab0] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 ++/* [0x00000ab8] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch ++/* [0x00000ac0] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 ++/* [0x00000ac8] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 ++/* [0x00000ad0] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 ++/* [0x00000ad8] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 ++/* [0x00000ae0] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 ++/* [0x00000ae8] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 ++/* [0x00000af0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x00000af8] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 ++/* [0x00000b00] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 ++/* [0x00000b08] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 ++/* [0x00000b10] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 ++/* [0x00000b18] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 ++/* [0x00000b20] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 ++/* [0x00000b28] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 ++/* [0x00000b30] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 ++/* [0x00000b38] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 ++/* [0x00000b40] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 ++/* [0x00000b48] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 ++/* [0x00000b50] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 ++/* [0x00000b58] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 ++/* [0x00000b60] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 ++/* [0x00000b68] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 ++/* [0x00000b70] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 ++/* [0x00000b78] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 ++/* [0x00000b80] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 ++/* [0x00000b88] */ 0x15267d80, 0x10020227, // mov ra8, ra9 ++/* [0x00000b90] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 ++/* [0x00000b98] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 ++/* [0x00000ba0] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 ++/* [0x00000ba8] */ 0x15367d80, 0x10020327, // mov ra12, ra13 ++/* [0x00000bb0] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 ++/* [0x00000bb8] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 ++/* [0x00000bc0] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop_b ++/* [0x00000bc8] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 ++/* [0x00000bd0] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop ++/* [0x00000bd8] */ 0x009e7000, 0x100009e7, // nop ; nop ++/* [0x00000be0] */ 0x4038e037, 0x100049e1, // nop ; mul24 r1, ra14, rb14 ++/* [0x00000be8] */ 0x4034d037, 0x100049e0, // nop ; mul24 r0, ra13, rb13 ++/* [0x00000bf0] */ 0x4c30c237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb12 ++/* [0x00000bf8] */ 0x4c2cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb11 ++/* [0x00000c00] */ 0x4c28a237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb10 ++/* [0x00000c08] */ 0x4c249237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb9 ++/* [0x00000c10] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 ++/* [0x00000c18] */ 0x4c3cf237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb15 ++/* [0x00000c20] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait ++/* [0x00000c28] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 ++/* [0x00000c30] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 ++/* [0x00000c38] */ 0x0cc27380, 0x10020867, // add r1, r1, vpm ++/* [0x00000c40] */ 0x0c7a7380, 0x10020867, // add r1, r1, ra30 ++/* [0x00000c48] */ 0xfffffe38, 0xf06809e7, // brr.anyn -, r:uvloop_b ++/* [0x00000c50] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 ++/* [0x00000c58] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 ++/* [0x00000c60] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 ++/* [0x00000c68] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 ++/* [0x00000c70] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 ++/* [0x00000c78] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif ++/* [0x00000c80] */ 0x00000010, 0xe0020827, // mov r0, 16 ++/* [0x00000c88] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x00000c90] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 ++/* [0x00000c98] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 ++/* [0x00000ca0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 ++/* [0x00000ca8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif + // ::mc_exit +-/* [0x00000cc8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait +-/* [0x00000cd0] */ 0x00000000, 0xe80009e7, // mov -,srel(0) ++/* [0x00000cb0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x00000cb8] */ 0x00000000, 0xe80009e7, // mov -,srel(0) ++/* [0x00000cc0] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00000cc8] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00000cd0] */ 0x009e7000, 0xa00009e7, // ldtmu0 + /* [0x00000cd8] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00000ce0] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00000ce8] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00000cf0] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00000cf8] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend +-/* [0x00000d00] */ 0x009e7000, 0x100009e7, // nop ; nop +-/* [0x00000d08] */ 0x009e7000, 0x100009e7, // nop ; nop ++/* [0x00000ce0] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend ++/* [0x00000ce8] */ 0x009e7000, 0x100009e7, // nop ; nop ++/* [0x00000cf0] */ 0x009e7000, 0x100009e7, // nop ; nop + // ::mc_interrupt_exit8 +-/* [0x00000d10] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x00000cf8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x00000d00] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00000d08] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00000d10] */ 0x009e7000, 0xa00009e7, // ldtmu0 + /* [0x00000d18] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00000d20] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00000d28] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00000d30] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00000d20] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00000d28] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00000d30] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) + /* [0x00000d38] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) + /* [0x00000d40] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) + /* [0x00000d48] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) + /* [0x00000d50] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00000d58] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00000d60] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00000d68] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00000d70] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend +-/* [0x00000d78] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop +-/* [0x00000d80] */ 0x009e7000, 0x100009e7, // nop ; nop ++/* [0x00000d58] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend ++/* [0x00000d60] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop ++/* [0x00000d68] */ 0x009e7000, 0x100009e7, // nop ; nop + // ::mc_end + }; + #ifdef __HIGHC__ +diff --git a/libavcodec/rpi_shader.h b/libavcodec/rpi_shader.h +index 809e582..6562fa9 100644 +--- a/libavcodec/rpi_shader.h ++++ b/libavcodec/rpi_shader.h +@@ -4,11 +4,11 @@ + extern unsigned int rpi_shader[]; + + #define mc_setup_uv (rpi_shader + 0) +-#define mc_filter_uv (rpi_shader + 150) +-#define mc_filter_uv_b0 (rpi_shader + 368) +-#define mc_filter_uv_b (rpi_shader + 586) +-#define mc_exit (rpi_shader + 818) +-#define mc_interrupt_exit8 (rpi_shader + 836) +-#define mc_end (rpi_shader + 866) ++#define mc_filter_uv (rpi_shader + 152) ++#define mc_filter_uv_b0 (rpi_shader + 370) ++#define mc_filter_uv_b (rpi_shader + 584) ++#define mc_exit (rpi_shader + 812) ++#define mc_interrupt_exit8 (rpi_shader + 830) ++#define mc_end (rpi_shader + 860) + + #endif +diff --git a/libavcodec/rpi_shader.qasm b/libavcodec/rpi_shader.qasm +index 9577121..562dc35 100644 +--- a/libavcodec/rpi_shader.qasm ++++ b/libavcodec/rpi_shader.qasm +@@ -39,13 +39,13 @@ + # rb30 frame height-1 + # rb31 used as temp to count loop iterations + # +-# ra24...ra30 15, 14, 13, 12, 11, 10, 9 + # ra24 clipped(row start address+8+elem_num)&~3 + # ra25 per-channel shifts 2 + # ra26 next ra24 + # ra27 next ra25 + # ra28 next y + # ra29 y for next texture access ++# ra30 64 + # + # ra31 next kernel address + +@@ -102,6 +102,7 @@ mov ra20, 1 + mov ra21, 32 + mov ra22, 256 + mov ra23, 8 ++mov ra30, 64 + + mov rb20, 0xffffff00 + mov rb22, 255 +@@ -472,7 +473,7 @@ sub.setf -, r3, 8 ; mov r1, ra22 + # apply horizontal filter + brr.anyn -, r:uvloop_b0 + mov ra14, ra15 ; mul24 r0, r0, r1 # last bit of context scroll +-asr ra15, r0, 8 ; nop ++asr ra15, r0, 8 ; nop # TODO isn't ra15 already in 24bit precision, may not need the sign extension here? + nop ; nop # Delay slot 3 (TODO move more of the context scroll into here) + + # apply vertical filter and write to VPM +@@ -487,18 +488,18 @@ add r1, r1, r0 ; mul24 r0, ra8, rb8 + add r1, r1, r0 ; mul24 r0, ra15, rb15 + add r1, r1, r0 ; mov -, vw_wait + sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 +-asr r1, r1, 14 +-add r1, r1, ra21 +-brr.anyn -, r:uvloop +-asr r1, r1, 6 # Delay 1 +-min r1, r1, rb22 # Delay 2 +-max vpm, r1, 0 # Delay 3 ++#asr r1, r1, 14 ++#add r1, r1, ra21 ++brr.anyn -, r:uvloop_b0 ++asr vpm, r1, 14 # Delay 1 shifts down by shift2=6, but results are still in 16bit precision TODO may be able to avoid the mul24 and use more delay slots ++nop # Delay 2 ++nop # Delay 3 + + # DMA out for U + + mov vw_setup, rb26 # VDW setup 0 + mov vw_setup, rb29 # Stride +-mov vw_addr, unif # start the VDW ++mov vw_addr, unif # start the VDW # TODO in pass0 we don't need to save any results + + # DMA out for V + # We need to wait for the U to complete first, but have nothing useful to compute while we wait. +@@ -639,12 +640,11 @@ mov ra12, ra13 + mov ra13, ra14 + + sub.setf -, r3, 8 ; mov r1, ra22 +- + # apply horizontal filter + brr.anyn -, r:uvloop_b + mov ra14, ra15 ; mul24 r0, r0, r1 # last bit of context scroll, including clamp to zero + asr ra15, r0, 8 ; nop +-nop ; nop ++nop ; nop # TODO improve use of delay slots + + # apply vertical filter and write to VPM + +@@ -658,15 +658,13 @@ add r1, r1, r0 ; mul24 r0, ra8, rb8 + add r1, r1, r0 ; mul24 r0, ra15, rb15 + add r1, r1, r0 ; mov -, vw_wait + sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 +-asr r1, r1, 14 +-add r1, r1, ra21 +-asr r1, r1, 6 +-min r1, r1, rb22 +-add r0, vpm, 1 # Blend in previous VPM contents at this location ++asr r1, r1, 14 # shift2=6 ++add r1, r1, vpm # Blend in previous VPM contents at this location ++add r1, r1, ra30 + brr.anyn -, r:uvloop_b +-max r1, r1, 0 +-add r1, r1, r0 +-shr vpm, r1, 1 ++asr r1, r1, 7 # Delay 1 ++min r1, r1, rb22 # Delay 2 ++max vpm, r1, 0 # Delay 3 + + + # DMA out for U +-- +2.5.0 + + +From 7f612d9e21849e339ef0ad0e2e5d8a2acaad2552 Mon Sep 17 00:00:00 2001 +From: Peter de Rivaz <peter.derivaz@gmail.com> +Date: Thu, 14 May 2015 10:55:07 +0100 +Subject: [PATCH 27/68] P prediction uses 4 tap filters + +--- + libavcodec/hevc.c | 50 ++-- + libavcodec/rpi_shader.c | 631 ++++++++++++++++++++++----------------------- + libavcodec/rpi_shader.h | 10 +- + libavcodec/rpi_shader.qasm | 43 +-- + 4 files changed, 344 insertions(+), 390 deletions(-) + +diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c +index 68cd237..8984585 100644 +--- a/libavcodec/hevc.c ++++ b/libavcodec/hevc.c +@@ -65,15 +65,15 @@ const uint8_t ff_hevc_pel_weight[65] = { [2] = 0, [4] = 1, [6] = 2, [8] = 3, [12 + #define ENCODE_COEFFS(c0, c1, c2, c3) (((c0) & 0xff) | ((c1) & 0xff) << 8 | ((c2) & 0xff) << 16 | ((c3) & 0xff) << 24) + + // TODO Chroma only needs 4 taps +-static uint32_t rpi_filter_coefs[8][2] = { +- { ENCODE_COEFFS( 0, 0, 0, 64), ENCODE_COEFFS( 0, 0, 0, 0 ) }, +- { ENCODE_COEFFS( 0, 0, -2, 58), ENCODE_COEFFS( 10, -2, 0, 0 ) }, +- { ENCODE_COEFFS( 0, 0, -4, 54), ENCODE_COEFFS( 16, -2, 0, 0 ) }, +- { ENCODE_COEFFS( 0, 0, -6, 46), ENCODE_COEFFS( 28, -4, 0, 0 ) }, +- { ENCODE_COEFFS( 0, 0, -4, 36), ENCODE_COEFFS( 36, -4, 0, 0 ) }, +- { ENCODE_COEFFS( 0, 0, -4, 28), ENCODE_COEFFS( 46, -6, 0, 0 ) }, +- { ENCODE_COEFFS( 0, 0, -2, 16), ENCODE_COEFFS( 54, -4, 0, 0 ) }, +- { ENCODE_COEFFS( 0, 0, -2, 10), ENCODE_COEFFS( 58, -2, 0, 0 ) } ++static uint32_t rpi_filter_coefs[8][1] = { ++ { ENCODE_COEFFS( 0, 64, 0, 0) }, ++ { ENCODE_COEFFS( -2, 58, 10, -2) }, ++ { ENCODE_COEFFS( -4, 54, 16, -2) }, ++ { ENCODE_COEFFS( -6, 46, 28, -4) }, ++ { ENCODE_COEFFS( -4, 36, 36, -4) }, ++ { ENCODE_COEFFS( -4, 28, 46, -6) }, ++ { ENCODE_COEFFS( -2, 16, 54, -4) }, ++ { ENCODE_COEFFS( -2, 10, 58, -2) } + }; + + static uint32_t get_vc_address(AVBufferRef *bref) { +@@ -2016,16 +2016,16 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, + for(int start_y=0;start_y < nPbH_c;start_y+=16) { + for(int start_x=0;start_x < nPbW_c;start_x+=RPI_CHROMA_BLOCK_WIDTH) { + u++[-RPI_CHROMA_COMMAND_WORDS] = s->mc_filter_uv; +- u++[-RPI_CHROMA_COMMAND_WORDS] = x1_c - 3 + start_x; +- u++[-RPI_CHROMA_COMMAND_WORDS] = y1_c - 3 + start_y; ++ u++[-RPI_CHROMA_COMMAND_WORDS] = x1_c - 1 + start_x; ++ u++[-RPI_CHROMA_COMMAND_WORDS] = y1_c - 1 + start_y; + u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[1]); + u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[2]); + *u++ = ( (nPbW_c<RPI_CHROMA_BLOCK_WIDTH ? nPbW_c : RPI_CHROMA_BLOCK_WIDTH) << 16 ) + (nPbH_c<16 ? nPbH_c : 16); + // TODO chroma weight and offset... s->sh.chroma_weight_l0[current_mv.ref_idx[0]][0], s->sh.chroma_offset_l0[current_mv.ref_idx[0]][0] + *u++ = rpi_filter_coefs[_mx][0]; +- *u++ = rpi_filter_coefs[_mx][1]; ++ u++; + *u++ = rpi_filter_coefs[_my][0]; +- *u++ = rpi_filter_coefs[_my][1]; ++ u++; + *u++ = (get_vc_address(s->frame->buf[1]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[1]); + *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); + } +@@ -2073,16 +2073,16 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, + for(int start_y=0;start_y < nPbH_c;start_y+=16) { + for(int start_x=0;start_x < nPbW_c;start_x+=RPI_CHROMA_BLOCK_WIDTH) { + u++[-RPI_CHROMA_COMMAND_WORDS] = s->mc_filter_uv; +- u++[-RPI_CHROMA_COMMAND_WORDS] = x1_c - 3 + start_x; +- u++[-RPI_CHROMA_COMMAND_WORDS] = y1_c - 3 + start_y; ++ u++[-RPI_CHROMA_COMMAND_WORDS] = x1_c - 1 + start_x; ++ u++[-RPI_CHROMA_COMMAND_WORDS] = y1_c - 1 + start_y; + u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[1]); + u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[2]); + *u++ = ( (nPbW_c<RPI_CHROMA_BLOCK_WIDTH ? nPbW_c : RPI_CHROMA_BLOCK_WIDTH) << 16 ) + (nPbH_c<16 ? nPbH_c : 16); + // TODO chroma weight and offset... s->sh.chroma_weight_l0[current_mv.ref_idx[0]][0], s->sh.chroma_offset_l0[current_mv.ref_idx[0]][0] + *u++ = rpi_filter_coefs[_mx][0]; +- *u++ = rpi_filter_coefs[_mx][1]; ++ u++; + *u++ = rpi_filter_coefs[_my][0]; +- *u++ = rpi_filter_coefs[_my][1]; ++ u++; + *u++ = (get_vc_address(s->frame->buf[1]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[1]); + *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); + } +@@ -2137,29 +2137,29 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, + for(int start_y=0;start_y < nPbH_c;start_y+=16) { + for(int start_x=0;start_x < nPbW_c;start_x+=RPI_CHROMA_BLOCK_WIDTH) { + u++[-RPI_CHROMA_COMMAND_WORDS] = s->mc_filter_uv_b0; +- u++[-RPI_CHROMA_COMMAND_WORDS] = x1_c - 3 + start_x; +- u++[-RPI_CHROMA_COMMAND_WORDS] = y1_c - 3 + start_y; ++ u++[-RPI_CHROMA_COMMAND_WORDS] = x1_c - 1 + start_x; ++ u++[-RPI_CHROMA_COMMAND_WORDS] = y1_c - 1 + start_y; + u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[1]); + u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[2]); + *u++ = ( (nPbW_c<RPI_CHROMA_BLOCK_WIDTH ? nPbW_c : RPI_CHROMA_BLOCK_WIDTH) << 16 ) + (nPbH_c<16 ? nPbH_c : 16); + *u++ = rpi_filter_coefs[_mx][0]; +- *u++ = rpi_filter_coefs[_mx][1]; ++ u++; + *u++ = rpi_filter_coefs[_my][0]; +- *u++ = rpi_filter_coefs[_my][1]; ++ u++; + *u++ = (get_vc_address(s->frame->buf[1]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[1]); // TODO this will become unused once we have a dedicated pass0 filter + *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); + + u++[-RPI_CHROMA_COMMAND_WORDS] = s->mc_filter_uv_b; +- u++[-RPI_CHROMA_COMMAND_WORDS] = x2_c - 3 + start_x; +- u++[-RPI_CHROMA_COMMAND_WORDS] = y2_c - 3 + start_y; ++ u++[-RPI_CHROMA_COMMAND_WORDS] = x2_c - 1 + start_x; ++ u++[-RPI_CHROMA_COMMAND_WORDS] = y2_c - 1 + start_y; + u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[1]); + u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[2]); + *u++ = ( (nPbW_c<RPI_CHROMA_BLOCK_WIDTH ? nPbW_c : RPI_CHROMA_BLOCK_WIDTH) << 16 ) + (nPbH_c<16 ? nPbH_c : 16); + // TODO chroma weight and offset... s->sh.chroma_weight_l0[current_mv.ref_idx[0]][0], s->sh.chroma_offset_l0[current_mv.ref_idx[0]][0] + *u++ = rpi_filter_coefs[_mx2][0]; +- *u++ = rpi_filter_coefs[_mx2][1]; ++ u++; + *u++ = rpi_filter_coefs[_my2][0]; +- *u++ = rpi_filter_coefs[_my2][1]; ++ u++; + *u++ = (get_vc_address(s->frame->buf[1]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[1]); + *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); + } +diff --git a/libavcodec/rpi_shader.c b/libavcodec/rpi_shader.c +index 77cca46..c8d0728 100644 +--- a/libavcodec/rpi_shader.c ++++ b/libavcodec/rpi_shader.c +@@ -116,8 +116,8 @@ unsigned int rpi_shader[] = { + /* [0x000002d0] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 + /* [0x000002d8] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 + /* [0x000002e0] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 +-/* [0x000002e8] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 +-/* [0x000002f0] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 ++/* [0x000002e8] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 ++/* [0x000002f0] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 + /* [0x000002f8] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 + /* [0x00000300] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 + /* [0x00000308] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 +@@ -128,338 +128,315 @@ unsigned int rpi_shader[] = { + /* [0x00000330] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 + /* [0x00000338] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 + /* [0x00000340] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif +-/* [0x00000348] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000350] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000358] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000360] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif +-/* [0x00000368] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000370] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000378] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000380] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif +-/* [0x00000388] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000390] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000398] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000003a0] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 +-/* [0x000003a8] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 +-/* [0x000003b0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-/* [0x000003b8] */ 0x00000000, 0xe00208e7, // mov r3, 0 ++/* [0x00000348] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000350] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000358] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000360] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000368] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif ++/* [0x00000370] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 ++/* [0x00000378] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x00000380] */ 0x00000000, 0xe00208e7, // mov r3, 0 + // :uvloop +-/* [0x000003c0] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 +-/* [0x000003c8] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 +-/* [0x000003d0] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 +-/* [0x000003d8] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch +-/* [0x000003e0] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 +-/* [0x000003e8] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 +-/* [0x000003f0] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 +-/* [0x000003f8] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 +-/* [0x00000400] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 +-/* [0x00000408] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 +-/* [0x00000410] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-/* [0x00000418] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 +-/* [0x00000420] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 +-/* [0x00000428] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 +-/* [0x00000430] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 +-/* [0x00000438] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 +-/* [0x00000440] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 +-/* [0x00000448] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 +-/* [0x00000450] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 +-/* [0x00000458] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 +-/* [0x00000460] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 +-/* [0x00000468] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 +-/* [0x00000470] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 +-/* [0x00000478] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 +-/* [0x00000480] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 +-/* [0x00000488] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 +-/* [0x00000490] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 +-/* [0x00000498] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 +-/* [0x000004a0] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 +-/* [0x000004a8] */ 0x15267d80, 0x10020227, // mov ra8, ra9 +-/* [0x000004b0] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 +-/* [0x000004b8] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 +-/* [0x000004c0] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 +-/* [0x000004c8] */ 0x15367d80, 0x10020327, // mov ra12, ra13 +-/* [0x000004d0] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 +-/* [0x000004d8] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 +-/* [0x000004e0] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop +-/* [0x000004e8] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 +-/* [0x000004f0] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop +-/* [0x000004f8] */ 0x009e7000, 0x100009e7, // nop ; nop +-/* [0x00000500] */ 0x4038e037, 0x100049e1, // nop ; mul24 r1, ra14, rb14 +-/* [0x00000508] */ 0x4034d037, 0x100049e0, // nop ; mul24 r0, ra13, rb13 +-/* [0x00000510] */ 0x4c30c237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb12 +-/* [0x00000518] */ 0x4c2cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb11 +-/* [0x00000520] */ 0x4c28a237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb10 +-/* [0x00000528] */ 0x4c249237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb9 +-/* [0x00000530] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 +-/* [0x00000538] */ 0x4c3cf237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb15 +-/* [0x00000540] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait +-/* [0x00000548] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 +-/* [0x00000550] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 +-/* [0x00000558] */ 0x0c567380, 0x10020867, // add r1, r1, ra21 +-/* [0x00000560] */ 0xfffffe40, 0xf06809e7, // brr.anyn -, r:uvloop +-/* [0x00000568] */ 0x0f9c63c0, 0xd0020867, // asr r1, r1, 6 +-/* [0x00000570] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 +-/* [0x00000578] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 +-/* [0x00000580] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 +-/* [0x00000588] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 +-/* [0x00000590] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif +-/* [0x00000598] */ 0x00000010, 0xe0020827, // mov r0, 16 +-/* [0x000005a0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait +-/* [0x000005a8] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 +-/* [0x000005b0] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 +-/* [0x000005b8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 +-/* [0x000005c0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif ++/* [0x00000388] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 ++/* [0x00000390] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 ++/* [0x00000398] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 ++/* [0x000003a0] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch ++/* [0x000003a8] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 ++/* [0x000003b0] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 ++/* [0x000003b8] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 ++/* [0x000003c0] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 ++/* [0x000003c8] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 ++/* [0x000003d0] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 ++/* [0x000003d8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x000003e0] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 ++/* [0x000003e8] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 ++/* [0x000003f0] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 ++/* [0x000003f8] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 ++/* [0x00000400] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 ++/* [0x00000408] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 ++/* [0x00000410] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 ++/* [0x00000418] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 ++/* [0x00000420] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 ++/* [0x00000428] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 ++/* [0x00000430] */ 0x15367d80, 0x10020327, // mov ra12, ra13 ++/* [0x00000438] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 ++/* [0x00000440] */ 0x8d5847f6, 0xd00269e1, // sub.setf -, r3, 4 ; mov r1, ra22 ++/* [0x00000448] */ 0xffffff20, 0xf06809e7, // brr.anyn -, r:uvloop ++/* [0x00000450] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 ++/* [0x00000458] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop ++/* [0x00000460] */ 0x009e7000, 0x100009e7, // nop ; nop ++/* [0x00000468] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 ++/* [0x00000470] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 ++/* [0x00000478] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 ++/* [0x00000480] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 ++/* [0x00000488] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait ++/* [0x00000490] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 ++/* [0x00000498] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 ++/* [0x000004a0] */ 0x0c567380, 0x10020867, // add r1, r1, ra21 ++/* [0x000004a8] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop ++/* [0x000004b0] */ 0x0f9c63c0, 0xd0020867, // asr r1, r1, 6 ++/* [0x000004b8] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 ++/* [0x000004c0] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 ++/* [0x000004c8] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 ++/* [0x000004d0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 ++/* [0x000004d8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif ++/* [0x000004e0] */ 0x00000010, 0xe0020827, // mov r0, 16 ++/* [0x000004e8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x000004f0] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 ++/* [0x000004f8] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 ++/* [0x00000500] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 ++/* [0x00000508] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif + // ::mc_filter_uv_b0 +-/* [0x000005c8] */ 0x15827d80, 0x100207e7, // mov ra31, unif +-/* [0x000005d0] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next +-/* [0x000005d8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num +-/* [0x000005e0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif +-/* [0x000005e8] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif +-/* [0x000005f0] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 +-/* [0x000005f8] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 +-/* [0x00000600] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 +-/* [0x00000608] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 +-/* [0x00000610] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 +-/* [0x00000618] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 +-/* [0x00000620] */ 0x159d5fc0, 0x10021c67, // mov vw_setup, rb21 +-/* [0x00000628] */ 0x00000010, 0xe00208a7, // mov r2, 16 +-/* [0x00000630] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000638] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 +-/* [0x00000640] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 +-/* [0x00000648] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 +-/* [0x00000650] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 +-/* [0x00000658] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 +-/* [0x00000660] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 +-/* [0x00000668] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 +-/* [0x00000670] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 +-/* [0x00000678] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 +-/* [0x00000680] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 +-/* [0x00000688] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000690] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000698] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000006a0] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000006a8] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif +-/* [0x000006b0] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000006b8] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000006c0] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000006c8] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif +-/* [0x000006d0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000006d8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000006e0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000006e8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif +-/* [0x000006f0] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000006f8] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000700] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000708] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 +-/* [0x00000710] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 +-/* [0x00000718] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-/* [0x00000720] */ 0x00000000, 0xe00208e7, // mov r3, 0 ++/* [0x00000510] */ 0x15827d80, 0x100207e7, // mov ra31, unif ++/* [0x00000518] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next ++/* [0x00000520] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num ++/* [0x00000528] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif ++/* [0x00000530] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif ++/* [0x00000538] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 ++/* [0x00000540] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 ++/* [0x00000548] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 ++/* [0x00000550] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 ++/* [0x00000558] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 ++/* [0x00000560] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 ++/* [0x00000568] */ 0x159d5fc0, 0x10021c67, // mov vw_setup, rb21 ++/* [0x00000570] */ 0x00000010, 0xe00208a7, // mov r2, 16 ++/* [0x00000578] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000580] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 ++/* [0x00000588] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 ++/* [0x00000590] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 ++/* [0x00000598] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 ++/* [0x000005a0] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 ++/* [0x000005a8] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 ++/* [0x000005b0] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 ++/* [0x000005b8] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 ++/* [0x000005c0] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 ++/* [0x000005c8] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 ++/* [0x000005d0] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x000005d8] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000005e0] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000005e8] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000005f0] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif ++/* [0x000005f8] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000600] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000608] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000610] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif ++/* [0x00000618] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000620] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000628] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000630] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif ++/* [0x00000638] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000640] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000648] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000650] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 ++/* [0x00000658] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 ++/* [0x00000660] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x00000668] */ 0x00000000, 0xe00208e7, // mov r3, 0 + // :uvloop_b0 +-/* [0x00000728] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 +-/* [0x00000730] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 +-/* [0x00000738] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 +-/* [0x00000740] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch +-/* [0x00000748] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 +-/* [0x00000750] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 +-/* [0x00000758] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 +-/* [0x00000760] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 +-/* [0x00000768] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 +-/* [0x00000770] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 +-/* [0x00000778] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-/* [0x00000780] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 +-/* [0x00000788] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 +-/* [0x00000790] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 +-/* [0x00000798] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 +-/* [0x000007a0] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 +-/* [0x000007a8] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 +-/* [0x000007b0] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 +-/* [0x000007b8] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 +-/* [0x000007c0] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 +-/* [0x000007c8] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 +-/* [0x000007d0] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 +-/* [0x000007d8] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 +-/* [0x000007e0] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 +-/* [0x000007e8] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 +-/* [0x000007f0] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 +-/* [0x000007f8] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 +-/* [0x00000800] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 +-/* [0x00000808] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 +-/* [0x00000810] */ 0x15267d80, 0x10020227, // mov ra8, ra9 +-/* [0x00000818] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 +-/* [0x00000820] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 +-/* [0x00000828] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 +-/* [0x00000830] */ 0x15367d80, 0x10020327, // mov ra12, ra13 +-/* [0x00000838] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 +-/* [0x00000840] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 +-/* [0x00000848] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop_b0 +-/* [0x00000850] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 +-/* [0x00000858] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop +-/* [0x00000860] */ 0x009e7000, 0x100009e7, // nop ; nop +-/* [0x00000868] */ 0x4038e037, 0x100049e1, // nop ; mul24 r1, ra14, rb14 +-/* [0x00000870] */ 0x4034d037, 0x100049e0, // nop ; mul24 r0, ra13, rb13 +-/* [0x00000878] */ 0x4c30c237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb12 +-/* [0x00000880] */ 0x4c2cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb11 +-/* [0x00000888] */ 0x4c28a237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb10 +-/* [0x00000890] */ 0x4c249237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb9 +-/* [0x00000898] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 +-/* [0x000008a0] */ 0x4c3cf237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb15 +-/* [0x000008a8] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait +-/* [0x000008b0] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 +-/* [0x000008b8] */ 0xfffffe50, 0xf06809e7, // brr.anyn -, r:uvloop_b0 +-/* [0x000008c0] */ 0x0f9ce3c0, 0xd0020c27, // asr vpm, r1, 14 +-/* [0x000008c8] */ 0x009e7000, 0x100009e7, // nop +-/* [0x000008d0] */ 0x009e7000, 0x100009e7, // nop +-/* [0x000008d8] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 +-/* [0x000008e0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 +-/* [0x000008e8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif +-/* [0x000008f0] */ 0x00000010, 0xe0020827, // mov r0, 16 +-/* [0x000008f8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait +-/* [0x00000900] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 +-/* [0x00000908] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 +-/* [0x00000910] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 +-/* [0x00000918] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif ++/* [0x00000670] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 ++/* [0x00000678] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 ++/* [0x00000680] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 ++/* [0x00000688] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch ++/* [0x00000690] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 ++/* [0x00000698] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 ++/* [0x000006a0] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 ++/* [0x000006a8] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 ++/* [0x000006b0] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 ++/* [0x000006b8] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 ++/* [0x000006c0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x000006c8] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 ++/* [0x000006d0] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 ++/* [0x000006d8] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 ++/* [0x000006e0] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 ++/* [0x000006e8] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 ++/* [0x000006f0] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 ++/* [0x000006f8] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 ++/* [0x00000700] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 ++/* [0x00000708] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 ++/* [0x00000710] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 ++/* [0x00000718] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 ++/* [0x00000720] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 ++/* [0x00000728] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 ++/* [0x00000730] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 ++/* [0x00000738] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 ++/* [0x00000740] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 ++/* [0x00000748] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 ++/* [0x00000750] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 ++/* [0x00000758] */ 0x15267d80, 0x10020227, // mov ra8, ra9 ++/* [0x00000760] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 ++/* [0x00000768] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 ++/* [0x00000770] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 ++/* [0x00000778] */ 0x15367d80, 0x10020327, // mov ra12, ra13 ++/* [0x00000780] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 ++/* [0x00000788] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 ++/* [0x00000790] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop_b0 ++/* [0x00000798] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 ++/* [0x000007a0] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop ++/* [0x000007a8] */ 0x009e7000, 0x100009e7, // nop ; nop ++/* [0x000007b0] */ 0x4038e037, 0x100049e1, // nop ; mul24 r1, ra14, rb14 ++/* [0x000007b8] */ 0x4034d037, 0x100049e0, // nop ; mul24 r0, ra13, rb13 ++/* [0x000007c0] */ 0x4c30c237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb12 ++/* [0x000007c8] */ 0x4c2cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb11 ++/* [0x000007d0] */ 0x4c28a237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb10 ++/* [0x000007d8] */ 0x4c249237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb9 ++/* [0x000007e0] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 ++/* [0x000007e8] */ 0x4c3cf237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb15 ++/* [0x000007f0] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait ++/* [0x000007f8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 ++/* [0x00000800] */ 0xfffffe50, 0xf06809e7, // brr.anyn -, r:uvloop_b0 ++/* [0x00000808] */ 0x0f9ce3c0, 0xd0020c27, // asr vpm, r1, 14 ++/* [0x00000810] */ 0x009e7000, 0x100009e7, // nop ++/* [0x00000818] */ 0x009e7000, 0x100009e7, // nop ++/* [0x00000820] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 ++/* [0x00000828] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 ++/* [0x00000830] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif ++/* [0x00000838] */ 0x00000010, 0xe0020827, // mov r0, 16 ++/* [0x00000840] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x00000848] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 ++/* [0x00000850] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 ++/* [0x00000858] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 ++/* [0x00000860] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif + // ::mc_filter_uv_b +-/* [0x00000920] */ 0x15827d80, 0x100207e7, // mov ra31, unif +-/* [0x00000928] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next +-/* [0x00000930] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num +-/* [0x00000938] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif +-/* [0x00000940] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif +-/* [0x00000948] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 +-/* [0x00000950] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 +-/* [0x00000958] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 +-/* [0x00000960] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 +-/* [0x00000968] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 +-/* [0x00000970] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 +-/* [0x00000978] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 +-/* [0x00000980] */ 0x00000010, 0xe00208a7, // mov r2, 16 +-/* [0x00000988] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000990] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 +-/* [0x00000998] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 +-/* [0x000009a0] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 +-/* [0x000009a8] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 +-/* [0x000009b0] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 +-/* [0x000009b8] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 +-/* [0x000009c0] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 +-/* [0x000009c8] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 +-/* [0x000009d0] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 +-/* [0x000009d8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 +-/* [0x000009e0] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 +-/* [0x000009e8] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 +-/* [0x000009f0] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 +-/* [0x000009f8] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 +-/* [0x00000a00] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000a08] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000a10] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000a18] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000a20] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif +-/* [0x00000a28] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000a30] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000a38] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000a40] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif +-/* [0x00000a48] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000a50] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000a58] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000a60] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif +-/* [0x00000a68] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000a70] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000a78] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000a80] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 +-/* [0x00000a88] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 +-/* [0x00000a90] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-/* [0x00000a98] */ 0x00000000, 0xe00208e7, // mov r3, 0 ++/* [0x00000868] */ 0x15827d80, 0x100207e7, // mov ra31, unif ++/* [0x00000870] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next ++/* [0x00000878] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num ++/* [0x00000880] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif ++/* [0x00000888] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif ++/* [0x00000890] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 ++/* [0x00000898] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 ++/* [0x000008a0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 ++/* [0x000008a8] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 ++/* [0x000008b0] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 ++/* [0x000008b8] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 ++/* [0x000008c0] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 ++/* [0x000008c8] */ 0x00000010, 0xe00208a7, // mov r2, 16 ++/* [0x000008d0] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x000008d8] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 ++/* [0x000008e0] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 ++/* [0x000008e8] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 ++/* [0x000008f0] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 ++/* [0x000008f8] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 ++/* [0x00000900] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 ++/* [0x00000908] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 ++/* [0x00000910] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 ++/* [0x00000918] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 ++/* [0x00000920] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 ++/* [0x00000928] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 ++/* [0x00000930] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 ++/* [0x00000938] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 ++/* [0x00000940] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 ++/* [0x00000948] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000950] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000958] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000960] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000968] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif ++/* [0x00000970] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000978] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000980] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000988] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif ++/* [0x00000990] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000998] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000009a0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000009a8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif ++/* [0x000009b0] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000009b8] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000009c0] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000009c8] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 ++/* [0x000009d0] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 ++/* [0x000009d8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x000009e0] */ 0x00000000, 0xe00208e7, // mov r3, 0 + // :uvloop_b +-/* [0x00000aa0] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 +-/* [0x00000aa8] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 +-/* [0x00000ab0] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 +-/* [0x00000ab8] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch +-/* [0x00000ac0] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 +-/* [0x00000ac8] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 +-/* [0x00000ad0] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 +-/* [0x00000ad8] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 +-/* [0x00000ae0] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 +-/* [0x00000ae8] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 +-/* [0x00000af0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-/* [0x00000af8] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 +-/* [0x00000b00] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 +-/* [0x00000b08] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 +-/* [0x00000b10] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 +-/* [0x00000b18] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 +-/* [0x00000b20] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 +-/* [0x00000b28] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 +-/* [0x00000b30] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 +-/* [0x00000b38] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 +-/* [0x00000b40] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 +-/* [0x00000b48] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 +-/* [0x00000b50] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 +-/* [0x00000b58] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 +-/* [0x00000b60] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 +-/* [0x00000b68] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 +-/* [0x00000b70] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 +-/* [0x00000b78] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 +-/* [0x00000b80] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 +-/* [0x00000b88] */ 0x15267d80, 0x10020227, // mov ra8, ra9 +-/* [0x00000b90] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 +-/* [0x00000b98] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 +-/* [0x00000ba0] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 +-/* [0x00000ba8] */ 0x15367d80, 0x10020327, // mov ra12, ra13 +-/* [0x00000bb0] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 +-/* [0x00000bb8] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 +-/* [0x00000bc0] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop_b +-/* [0x00000bc8] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 +-/* [0x00000bd0] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop +-/* [0x00000bd8] */ 0x009e7000, 0x100009e7, // nop ; nop +-/* [0x00000be0] */ 0x4038e037, 0x100049e1, // nop ; mul24 r1, ra14, rb14 +-/* [0x00000be8] */ 0x4034d037, 0x100049e0, // nop ; mul24 r0, ra13, rb13 +-/* [0x00000bf0] */ 0x4c30c237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb12 +-/* [0x00000bf8] */ 0x4c2cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb11 +-/* [0x00000c00] */ 0x4c28a237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb10 +-/* [0x00000c08] */ 0x4c249237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb9 +-/* [0x00000c10] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 +-/* [0x00000c18] */ 0x4c3cf237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb15 +-/* [0x00000c20] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait +-/* [0x00000c28] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 +-/* [0x00000c30] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 +-/* [0x00000c38] */ 0x0cc27380, 0x10020867, // add r1, r1, vpm +-/* [0x00000c40] */ 0x0c7a7380, 0x10020867, // add r1, r1, ra30 +-/* [0x00000c48] */ 0xfffffe38, 0xf06809e7, // brr.anyn -, r:uvloop_b +-/* [0x00000c50] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 +-/* [0x00000c58] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 +-/* [0x00000c60] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 +-/* [0x00000c68] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 +-/* [0x00000c70] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 +-/* [0x00000c78] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif +-/* [0x00000c80] */ 0x00000010, 0xe0020827, // mov r0, 16 +-/* [0x00000c88] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait +-/* [0x00000c90] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 +-/* [0x00000c98] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 +-/* [0x00000ca0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 +-/* [0x00000ca8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif ++/* [0x000009e8] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 ++/* [0x000009f0] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 ++/* [0x000009f8] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 ++/* [0x00000a00] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch ++/* [0x00000a08] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 ++/* [0x00000a10] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 ++/* [0x00000a18] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 ++/* [0x00000a20] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 ++/* [0x00000a28] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 ++/* [0x00000a30] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 ++/* [0x00000a38] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x00000a40] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 ++/* [0x00000a48] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 ++/* [0x00000a50] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 ++/* [0x00000a58] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 ++/* [0x00000a60] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 ++/* [0x00000a68] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 ++/* [0x00000a70] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 ++/* [0x00000a78] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 ++/* [0x00000a80] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 ++/* [0x00000a88] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 ++/* [0x00000a90] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 ++/* [0x00000a98] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 ++/* [0x00000aa0] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 ++/* [0x00000aa8] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 ++/* [0x00000ab0] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 ++/* [0x00000ab8] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 ++/* [0x00000ac0] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 ++/* [0x00000ac8] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 ++/* [0x00000ad0] */ 0x15267d80, 0x10020227, // mov ra8, ra9 ++/* [0x00000ad8] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 ++/* [0x00000ae0] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 ++/* [0x00000ae8] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 ++/* [0x00000af0] */ 0x15367d80, 0x10020327, // mov ra12, ra13 ++/* [0x00000af8] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 ++/* [0x00000b00] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 ++/* [0x00000b08] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop_b ++/* [0x00000b10] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 ++/* [0x00000b18] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop ++/* [0x00000b20] */ 0x009e7000, 0x100009e7, // nop ; nop ++/* [0x00000b28] */ 0x4038e037, 0x100049e1, // nop ; mul24 r1, ra14, rb14 ++/* [0x00000b30] */ 0x4034d037, 0x100049e0, // nop ; mul24 r0, ra13, rb13 ++/* [0x00000b38] */ 0x4c30c237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb12 ++/* [0x00000b40] */ 0x4c2cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb11 ++/* [0x00000b48] */ 0x4c28a237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb10 ++/* [0x00000b50] */ 0x4c249237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb9 ++/* [0x00000b58] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 ++/* [0x00000b60] */ 0x4c3cf237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb15 ++/* [0x00000b68] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait ++/* [0x00000b70] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 ++/* [0x00000b78] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 ++/* [0x00000b80] */ 0x0cc27380, 0x10020867, // add r1, r1, vpm ++/* [0x00000b88] */ 0x0c7a7380, 0x10020867, // add r1, r1, ra30 ++/* [0x00000b90] */ 0xfffffe38, 0xf06809e7, // brr.anyn -, r:uvloop_b ++/* [0x00000b98] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 ++/* [0x00000ba0] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 ++/* [0x00000ba8] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 ++/* [0x00000bb0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 ++/* [0x00000bb8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 ++/* [0x00000bc0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif ++/* [0x00000bc8] */ 0x00000010, 0xe0020827, // mov r0, 16 ++/* [0x00000bd0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x00000bd8] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 ++/* [0x00000be0] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 ++/* [0x00000be8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 ++/* [0x00000bf0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif + // ::mc_exit +-/* [0x00000cb0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait +-/* [0x00000cb8] */ 0x00000000, 0xe80009e7, // mov -,srel(0) +-/* [0x00000cc0] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00000cc8] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00000cd0] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00000cd8] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00000ce0] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend +-/* [0x00000ce8] */ 0x009e7000, 0x100009e7, // nop ; nop +-/* [0x00000cf0] */ 0x009e7000, 0x100009e7, // nop ; nop ++/* [0x00000bf8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x00000c00] */ 0x00000000, 0xe80009e7, // mov -,srel(0) ++/* [0x00000c08] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00000c10] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00000c18] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00000c20] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00000c28] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend ++/* [0x00000c30] */ 0x009e7000, 0x100009e7, // nop ; nop ++/* [0x00000c38] */ 0x009e7000, 0x100009e7, // nop ; nop + // ::mc_interrupt_exit8 +-/* [0x00000cf8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait +-/* [0x00000d00] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00000d08] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00000d10] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00000d18] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00000d20] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00000d28] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00000d30] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00000d38] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00000d40] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00000d48] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00000d50] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00000d58] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend +-/* [0x00000d60] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop +-/* [0x00000d68] */ 0x009e7000, 0x100009e7, // nop ; nop ++/* [0x00000c40] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x00000c48] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00000c50] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00000c58] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00000c60] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00000c68] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00000c70] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00000c78] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00000c80] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00000c88] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00000c90] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00000c98] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00000ca0] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend ++/* [0x00000ca8] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop ++/* [0x00000cb0] */ 0x009e7000, 0x100009e7, // nop ; nop + // ::mc_end + }; + #ifdef __HIGHC__ +diff --git a/libavcodec/rpi_shader.h b/libavcodec/rpi_shader.h +index 6562fa9..1bf7a68 100644 +--- a/libavcodec/rpi_shader.h ++++ b/libavcodec/rpi_shader.h +@@ -5,10 +5,10 @@ extern unsigned int rpi_shader[]; + + #define mc_setup_uv (rpi_shader + 0) + #define mc_filter_uv (rpi_shader + 152) +-#define mc_filter_uv_b0 (rpi_shader + 370) +-#define mc_filter_uv_b (rpi_shader + 584) +-#define mc_exit (rpi_shader + 812) +-#define mc_interrupt_exit8 (rpi_shader + 830) +-#define mc_end (rpi_shader + 860) ++#define mc_filter_uv_b0 (rpi_shader + 324) ++#define mc_filter_uv_b (rpi_shader + 538) ++#define mc_exit (rpi_shader + 766) ++#define mc_interrupt_exit8 (rpi_shader + 784) ++#define mc_end (rpi_shader + 814) + + #endif +diff --git a/libavcodec/rpi_shader.qasm b/libavcodec/rpi_shader.qasm +index 562dc35..8e4f18f 100644 +--- a/libavcodec/rpi_shader.qasm ++++ b/libavcodec/rpi_shader.qasm +@@ -16,8 +16,8 @@ + # ra19 next ra17 + # + # rb16 pitch +-# rb17 height + 5 +-# rb18 height + 7 ++# rb17 height + 1 ++# rb18 height + 3 + # rb19 next ra16 + # + # ra20 1 +@@ -214,8 +214,8 @@ mov r0, unif + shr r1, r0, r2 # Extract width + sub rb29, rb24, r1 # Compute vdw_setup1(dst_pitch-width) + and r0, r0, rb22 # Extract height +-add rb17, r0, 5 +-add rb18, r0, 7 ++add rb17, r0, 1 ++add rb18, r0, 3 + shl r0, r0, 7 + add r0, r0, r1 # Combine width and height of destination area + shl r0, r0, r2 # Shift into bits 16 upwards of the vdw_setup0 register +@@ -230,18 +230,11 @@ asr ra3, r0, rb23; mul24 r0, r0, ra22 + asr ra2, r0, rb23; mul24 r0, r0, ra22 + asr ra1, r0, rb23; mul24 r0, r0, ra22 + asr ra0, r0, rb23; mov r0, unif +-asr ra7, r0, rb23; mul24 r0, r0, ra22 +-asr ra6, r0, rb23; mul24 r0, r0, ra22 +-asr ra5, r0, rb23; mul24 r0, r0, ra22 +-asr ra4, r0, rb23; mov r0, unif ++ mov r0, unif + asr rb11, r0, rb23; mul24 r0, r0, ra22 + asr rb10, r0, rb23; mul24 r0, r0, ra22 + asr rb9, r0, rb23; mul24 r0, r0, ra22 + asr rb8, r0, rb23; mov r0, unif +-asr rb15, r0, rb23; mul24 r0, r0, ra22 +-asr rb14, r0, rb23; mul24 r0, r0, ra22 +-asr rb13, r0, rb23; mul24 r0, r0, ra22 +-asr rb12, r0, rb23 + + # r2 is elem_num + # r3 is loop counter +@@ -283,26 +276,14 @@ add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 + nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 + add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 + nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 +-add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 +-nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 +-add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 +-nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 +-add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 +-nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 +-add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 +-nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 + add r0, r2, r3 + + mov r3, rb31 + +-mov ra8, ra9 +-mov ra9, ra10 +-mov ra10, ra11 +-mov ra11, ra12 + mov ra12, ra13 + mov ra13, ra14 + +-sub.setf -, r3, 8 ; mov r1, ra22 ++sub.setf -, r3, 4 ; mov r1, ra22 + + # apply horizontal filter + brr.anyn -, r:uvloop +@@ -312,14 +293,10 @@ nop ; nop # Delay slot 3 (TODO move more of the context scr + + # apply vertical filter and write to VPM + +-nop ; mul24 r1, ra14, rb14 +-nop ; mul24 r0, ra13, rb13 +-add r1, r1, r0 ; mul24 r0, ra12, rb12 +-add r1, r1, r0 ; mul24 r0, ra11, rb11 +-add r1, r1, r0 ; mul24 r0, ra10, rb10 +-add r1, r1, r0 ; mul24 r0, ra9, rb9 +-add r1, r1, r0 ; mul24 r0, ra8, rb8 +-add r1, r1, r0 ; mul24 r0, ra15, rb15 ++nop ; mul24 r1, ra14, rb10 ++nop ; mul24 r0, ra13, rb9 ++add r1, r1, r0 ; mul24 r0, ra12, rb8 ++add r1, r1, r0 ; mul24 r0, ra15, rb11 + add r1, r1, r0 ; mov -, vw_wait + sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 + asr r1, r1, 14 +-- +2.5.0 + + +From b7f5bb6522a31aeb9e69f18f3b5cc9c73636685c Mon Sep 17 00:00:00 2001 +From: Peter de Rivaz <peter.derivaz@gmail.com> +Date: Thu, 14 May 2015 11:03:51 +0100 +Subject: [PATCH 28/68] Optimised B0 pass + +--- + libavcodec/rpi_shader.c | 424 +++++++++++++++++++++------------------------ + libavcodec/rpi_shader.h | 8 +- + libavcodec/rpi_shader.qasm | 43 +---- + 3 files changed, 212 insertions(+), 263 deletions(-) + +diff --git a/libavcodec/rpi_shader.c b/libavcodec/rpi_shader.c +index c8d0728..1f63ee0 100644 +--- a/libavcodec/rpi_shader.c ++++ b/libavcodec/rpi_shader.c +@@ -204,239 +204,215 @@ unsigned int rpi_shader[] = { + /* [0x00000580] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 + /* [0x00000588] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 + /* [0x00000590] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 +-/* [0x00000598] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 +-/* [0x000005a0] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 ++/* [0x00000598] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 ++/* [0x000005a0] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 + /* [0x000005a8] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 + /* [0x000005b0] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 + /* [0x000005b8] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 + /* [0x000005c0] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 +-/* [0x000005c8] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 +-/* [0x000005d0] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x000005d8] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000005e0] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000005e8] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000005f0] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif +-/* [0x000005f8] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000600] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000608] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000610] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif +-/* [0x00000618] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000620] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000628] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000630] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif +-/* [0x00000638] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000640] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000648] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000650] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 +-/* [0x00000658] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 +-/* [0x00000660] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-/* [0x00000668] */ 0x00000000, 0xe00208e7, // mov r3, 0 ++/* [0x000005c8] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x000005d0] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000005d8] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000005e0] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000005e8] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif ++/* [0x000005f0] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x000005f8] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000600] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000608] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000610] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif ++/* [0x00000618] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 ++/* [0x00000620] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x00000628] */ 0x00000000, 0xe00208e7, // mov r3, 0 + // :uvloop_b0 +-/* [0x00000670] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 +-/* [0x00000678] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 +-/* [0x00000680] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 +-/* [0x00000688] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch +-/* [0x00000690] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 +-/* [0x00000698] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 +-/* [0x000006a0] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 +-/* [0x000006a8] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 +-/* [0x000006b0] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 +-/* [0x000006b8] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 +-/* [0x000006c0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-/* [0x000006c8] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 +-/* [0x000006d0] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 +-/* [0x000006d8] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 +-/* [0x000006e0] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 +-/* [0x000006e8] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 +-/* [0x000006f0] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 +-/* [0x000006f8] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 +-/* [0x00000700] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 +-/* [0x00000708] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 +-/* [0x00000710] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 +-/* [0x00000718] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 +-/* [0x00000720] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 +-/* [0x00000728] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 +-/* [0x00000730] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 +-/* [0x00000738] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 +-/* [0x00000740] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 +-/* [0x00000748] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 +-/* [0x00000750] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 +-/* [0x00000758] */ 0x15267d80, 0x10020227, // mov ra8, ra9 +-/* [0x00000760] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 +-/* [0x00000768] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 +-/* [0x00000770] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 +-/* [0x00000778] */ 0x15367d80, 0x10020327, // mov ra12, ra13 +-/* [0x00000780] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 +-/* [0x00000788] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 +-/* [0x00000790] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop_b0 +-/* [0x00000798] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 +-/* [0x000007a0] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop +-/* [0x000007a8] */ 0x009e7000, 0x100009e7, // nop ; nop +-/* [0x000007b0] */ 0x4038e037, 0x100049e1, // nop ; mul24 r1, ra14, rb14 +-/* [0x000007b8] */ 0x4034d037, 0x100049e0, // nop ; mul24 r0, ra13, rb13 +-/* [0x000007c0] */ 0x4c30c237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb12 +-/* [0x000007c8] */ 0x4c2cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb11 +-/* [0x000007d0] */ 0x4c28a237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb10 +-/* [0x000007d8] */ 0x4c249237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb9 +-/* [0x000007e0] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 +-/* [0x000007e8] */ 0x4c3cf237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb15 +-/* [0x000007f0] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait +-/* [0x000007f8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 +-/* [0x00000800] */ 0xfffffe50, 0xf06809e7, // brr.anyn -, r:uvloop_b0 +-/* [0x00000808] */ 0x0f9ce3c0, 0xd0020c27, // asr vpm, r1, 14 +-/* [0x00000810] */ 0x009e7000, 0x100009e7, // nop +-/* [0x00000818] */ 0x009e7000, 0x100009e7, // nop +-/* [0x00000820] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 +-/* [0x00000828] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 +-/* [0x00000830] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif +-/* [0x00000838] */ 0x00000010, 0xe0020827, // mov r0, 16 +-/* [0x00000840] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait +-/* [0x00000848] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 +-/* [0x00000850] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 +-/* [0x00000858] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 +-/* [0x00000860] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif ++/* [0x00000630] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 ++/* [0x00000638] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 ++/* [0x00000640] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 ++/* [0x00000648] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch ++/* [0x00000650] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 ++/* [0x00000658] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 ++/* [0x00000660] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 ++/* [0x00000668] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 ++/* [0x00000670] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 ++/* [0x00000678] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 ++/* [0x00000680] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x00000688] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 ++/* [0x00000690] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 ++/* [0x00000698] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 ++/* [0x000006a0] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 ++/* [0x000006a8] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 ++/* [0x000006b0] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 ++/* [0x000006b8] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 ++/* [0x000006c0] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 ++/* [0x000006c8] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 ++/* [0x000006d0] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 ++/* [0x000006d8] */ 0x15367d80, 0x10020327, // mov ra12, ra13 ++/* [0x000006e0] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 ++/* [0x000006e8] */ 0x8d5847f6, 0xd00269e1, // sub.setf -, r3, 4 ; mov r1, ra22 ++/* [0x000006f0] */ 0xffffff20, 0xf06809e7, // brr.anyn -, r:uvloop_b0 ++/* [0x000006f8] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 ++/* [0x00000700] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop ++/* [0x00000708] */ 0x009e7000, 0x100009e7, // nop ; nop ++/* [0x00000710] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 ++/* [0x00000718] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 ++/* [0x00000720] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 ++/* [0x00000728] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 ++/* [0x00000730] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait ++/* [0x00000738] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 ++/* [0x00000740] */ 0xfffffed0, 0xf06809e7, // brr.anyn -, r:uvloop_b0 ++/* [0x00000748] */ 0x0f9ce3c0, 0xd0020c27, // asr vpm, r1, 14 ++/* [0x00000750] */ 0x009e7000, 0x100009e7, // nop ++/* [0x00000758] */ 0x009e7000, 0x100009e7, // nop ++/* [0x00000760] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 ++/* [0x00000768] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 ++/* [0x00000770] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif ++/* [0x00000778] */ 0x00000010, 0xe0020827, // mov r0, 16 ++/* [0x00000780] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x00000788] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 ++/* [0x00000790] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 ++/* [0x00000798] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 ++/* [0x000007a0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif + // ::mc_filter_uv_b +-/* [0x00000868] */ 0x15827d80, 0x100207e7, // mov ra31, unif +-/* [0x00000870] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next +-/* [0x00000878] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num +-/* [0x00000880] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif +-/* [0x00000888] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif +-/* [0x00000890] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 +-/* [0x00000898] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 +-/* [0x000008a0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 +-/* [0x000008a8] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 +-/* [0x000008b0] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 +-/* [0x000008b8] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 +-/* [0x000008c0] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 +-/* [0x000008c8] */ 0x00000010, 0xe00208a7, // mov r2, 16 +-/* [0x000008d0] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x000008d8] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 +-/* [0x000008e0] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 +-/* [0x000008e8] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 +-/* [0x000008f0] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 +-/* [0x000008f8] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 +-/* [0x00000900] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 +-/* [0x00000908] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 +-/* [0x00000910] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 +-/* [0x00000918] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 +-/* [0x00000920] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 +-/* [0x00000928] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 +-/* [0x00000930] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 +-/* [0x00000938] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 +-/* [0x00000940] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 +-/* [0x00000948] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000950] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000958] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000960] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000968] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif +-/* [0x00000970] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000978] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000980] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000988] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif +-/* [0x00000990] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000998] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000009a0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000009a8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif +-/* [0x000009b0] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000009b8] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000009c0] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000009c8] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 +-/* [0x000009d0] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 +-/* [0x000009d8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-/* [0x000009e0] */ 0x00000000, 0xe00208e7, // mov r3, 0 ++/* [0x000007a8] */ 0x15827d80, 0x100207e7, // mov ra31, unif ++/* [0x000007b0] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next ++/* [0x000007b8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num ++/* [0x000007c0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif ++/* [0x000007c8] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif ++/* [0x000007d0] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 ++/* [0x000007d8] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 ++/* [0x000007e0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 ++/* [0x000007e8] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 ++/* [0x000007f0] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 ++/* [0x000007f8] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 ++/* [0x00000800] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 ++/* [0x00000808] */ 0x00000010, 0xe00208a7, // mov r2, 16 ++/* [0x00000810] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000818] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 ++/* [0x00000820] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 ++/* [0x00000828] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 ++/* [0x00000830] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 ++/* [0x00000838] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 ++/* [0x00000840] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 ++/* [0x00000848] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 ++/* [0x00000850] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 ++/* [0x00000858] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 ++/* [0x00000860] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 ++/* [0x00000868] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 ++/* [0x00000870] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 ++/* [0x00000878] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 ++/* [0x00000880] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 ++/* [0x00000888] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000890] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000898] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000008a0] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000008a8] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif ++/* [0x000008b0] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000008b8] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000008c0] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000008c8] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif ++/* [0x000008d0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000008d8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000008e0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000008e8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif ++/* [0x000008f0] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000008f8] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000900] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000908] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 ++/* [0x00000910] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 ++/* [0x00000918] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x00000920] */ 0x00000000, 0xe00208e7, // mov r3, 0 + // :uvloop_b +-/* [0x000009e8] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 +-/* [0x000009f0] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 +-/* [0x000009f8] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 +-/* [0x00000a00] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch +-/* [0x00000a08] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 +-/* [0x00000a10] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 +-/* [0x00000a18] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 +-/* [0x00000a20] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 +-/* [0x00000a28] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 +-/* [0x00000a30] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 +-/* [0x00000a38] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-/* [0x00000a40] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 +-/* [0x00000a48] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 +-/* [0x00000a50] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 +-/* [0x00000a58] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 +-/* [0x00000a60] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 +-/* [0x00000a68] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 +-/* [0x00000a70] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 +-/* [0x00000a78] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 +-/* [0x00000a80] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 +-/* [0x00000a88] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 +-/* [0x00000a90] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 +-/* [0x00000a98] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 +-/* [0x00000aa0] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 +-/* [0x00000aa8] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 +-/* [0x00000ab0] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 +-/* [0x00000ab8] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 +-/* [0x00000ac0] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 +-/* [0x00000ac8] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 +-/* [0x00000ad0] */ 0x15267d80, 0x10020227, // mov ra8, ra9 +-/* [0x00000ad8] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 +-/* [0x00000ae0] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 +-/* [0x00000ae8] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 +-/* [0x00000af0] */ 0x15367d80, 0x10020327, // mov ra12, ra13 +-/* [0x00000af8] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 +-/* [0x00000b00] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 +-/* [0x00000b08] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop_b +-/* [0x00000b10] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 +-/* [0x00000b18] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop +-/* [0x00000b20] */ 0x009e7000, 0x100009e7, // nop ; nop +-/* [0x00000b28] */ 0x4038e037, 0x100049e1, // nop ; mul24 r1, ra14, rb14 +-/* [0x00000b30] */ 0x4034d037, 0x100049e0, // nop ; mul24 r0, ra13, rb13 +-/* [0x00000b38] */ 0x4c30c237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb12 +-/* [0x00000b40] */ 0x4c2cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb11 +-/* [0x00000b48] */ 0x4c28a237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb10 +-/* [0x00000b50] */ 0x4c249237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb9 +-/* [0x00000b58] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 +-/* [0x00000b60] */ 0x4c3cf237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb15 +-/* [0x00000b68] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait +-/* [0x00000b70] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 +-/* [0x00000b78] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 +-/* [0x00000b80] */ 0x0cc27380, 0x10020867, // add r1, r1, vpm +-/* [0x00000b88] */ 0x0c7a7380, 0x10020867, // add r1, r1, ra30 +-/* [0x00000b90] */ 0xfffffe38, 0xf06809e7, // brr.anyn -, r:uvloop_b +-/* [0x00000b98] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 +-/* [0x00000ba0] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 +-/* [0x00000ba8] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 +-/* [0x00000bb0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 +-/* [0x00000bb8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 +-/* [0x00000bc0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif +-/* [0x00000bc8] */ 0x00000010, 0xe0020827, // mov r0, 16 +-/* [0x00000bd0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait +-/* [0x00000bd8] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 +-/* [0x00000be0] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 +-/* [0x00000be8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 +-/* [0x00000bf0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif ++/* [0x00000928] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 ++/* [0x00000930] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 ++/* [0x00000938] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 ++/* [0x00000940] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch ++/* [0x00000948] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 ++/* [0x00000950] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 ++/* [0x00000958] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 ++/* [0x00000960] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 ++/* [0x00000968] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 ++/* [0x00000970] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 ++/* [0x00000978] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x00000980] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 ++/* [0x00000988] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 ++/* [0x00000990] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 ++/* [0x00000998] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 ++/* [0x000009a0] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 ++/* [0x000009a8] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 ++/* [0x000009b0] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 ++/* [0x000009b8] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 ++/* [0x000009c0] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 ++/* [0x000009c8] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 ++/* [0x000009d0] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 ++/* [0x000009d8] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 ++/* [0x000009e0] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 ++/* [0x000009e8] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 ++/* [0x000009f0] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 ++/* [0x000009f8] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 ++/* [0x00000a00] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 ++/* [0x00000a08] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 ++/* [0x00000a10] */ 0x15267d80, 0x10020227, // mov ra8, ra9 ++/* [0x00000a18] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 ++/* [0x00000a20] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 ++/* [0x00000a28] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 ++/* [0x00000a30] */ 0x15367d80, 0x10020327, // mov ra12, ra13 ++/* [0x00000a38] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 ++/* [0x00000a40] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 ++/* [0x00000a48] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop_b ++/* [0x00000a50] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 ++/* [0x00000a58] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop ++/* [0x00000a60] */ 0x009e7000, 0x100009e7, // nop ; nop ++/* [0x00000a68] */ 0x4038e037, 0x100049e1, // nop ; mul24 r1, ra14, rb14 ++/* [0x00000a70] */ 0x4034d037, 0x100049e0, // nop ; mul24 r0, ra13, rb13 ++/* [0x00000a78] */ 0x4c30c237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb12 ++/* [0x00000a80] */ 0x4c2cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb11 ++/* [0x00000a88] */ 0x4c28a237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb10 ++/* [0x00000a90] */ 0x4c249237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb9 ++/* [0x00000a98] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 ++/* [0x00000aa0] */ 0x4c3cf237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb15 ++/* [0x00000aa8] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait ++/* [0x00000ab0] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 ++/* [0x00000ab8] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 ++/* [0x00000ac0] */ 0x0cc27380, 0x10020867, // add r1, r1, vpm ++/* [0x00000ac8] */ 0x0c7a7380, 0x10020867, // add r1, r1, ra30 ++/* [0x00000ad0] */ 0xfffffe38, 0xf06809e7, // brr.anyn -, r:uvloop_b ++/* [0x00000ad8] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 ++/* [0x00000ae0] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 ++/* [0x00000ae8] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 ++/* [0x00000af0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 ++/* [0x00000af8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 ++/* [0x00000b00] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif ++/* [0x00000b08] */ 0x00000010, 0xe0020827, // mov r0, 16 ++/* [0x00000b10] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x00000b18] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 ++/* [0x00000b20] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 ++/* [0x00000b28] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 ++/* [0x00000b30] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif + // ::mc_exit +-/* [0x00000bf8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait +-/* [0x00000c00] */ 0x00000000, 0xe80009e7, // mov -,srel(0) +-/* [0x00000c08] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00000c10] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00000c18] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00000c20] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00000c28] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend +-/* [0x00000c30] */ 0x009e7000, 0x100009e7, // nop ; nop +-/* [0x00000c38] */ 0x009e7000, 0x100009e7, // nop ; nop ++/* [0x00000b38] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x00000b40] */ 0x00000000, 0xe80009e7, // mov -,srel(0) ++/* [0x00000b48] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00000b50] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00000b58] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00000b60] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00000b68] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend ++/* [0x00000b70] */ 0x009e7000, 0x100009e7, // nop ; nop ++/* [0x00000b78] */ 0x009e7000, 0x100009e7, // nop ; nop + // ::mc_interrupt_exit8 +-/* [0x00000c40] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait +-/* [0x00000c48] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00000c50] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00000c58] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00000c60] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00000c68] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00000c70] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00000c78] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00000c80] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00000c88] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00000c90] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00000c98] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00000ca0] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend +-/* [0x00000ca8] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop +-/* [0x00000cb0] */ 0x009e7000, 0x100009e7, // nop ; nop ++/* [0x00000b80] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x00000b88] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00000b90] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00000b98] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00000ba0] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00000ba8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00000bb0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00000bb8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00000bc0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00000bc8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00000bd0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00000bd8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00000be0] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend ++/* [0x00000be8] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop ++/* [0x00000bf0] */ 0x009e7000, 0x100009e7, // nop ; nop + // ::mc_end + }; + #ifdef __HIGHC__ +diff --git a/libavcodec/rpi_shader.h b/libavcodec/rpi_shader.h +index 1bf7a68..cb74887 100644 +--- a/libavcodec/rpi_shader.h ++++ b/libavcodec/rpi_shader.h +@@ -6,9 +6,9 @@ extern unsigned int rpi_shader[]; + #define mc_setup_uv (rpi_shader + 0) + #define mc_filter_uv (rpi_shader + 152) + #define mc_filter_uv_b0 (rpi_shader + 324) +-#define mc_filter_uv_b (rpi_shader + 538) +-#define mc_exit (rpi_shader + 766) +-#define mc_interrupt_exit8 (rpi_shader + 784) +-#define mc_end (rpi_shader + 814) ++#define mc_filter_uv_b (rpi_shader + 490) ++#define mc_exit (rpi_shader + 718) ++#define mc_interrupt_exit8 (rpi_shader + 736) ++#define mc_end (rpi_shader + 766) + + #endif +diff --git a/libavcodec/rpi_shader.qasm b/libavcodec/rpi_shader.qasm +index 8e4f18f..faa5755 100644 +--- a/libavcodec/rpi_shader.qasm ++++ b/libavcodec/rpi_shader.qasm +@@ -357,15 +357,13 @@ mov r0, unif + shr r1, r0, r2 # Extract width + sub rb29, rb24, r1 # Compute vdw_setup1(dst_pitch-width) + and r0, r0, rb22 # Extract height +-add rb17, r0, 5 +-add rb18, r0, 7 ++add rb17, r0, 1 ++add rb18, r0, 3 + shl r0, r0, 7 + add r0, r0, r1 # Combine width and height of destination area + shl r0, r0, r2 # Shift into bits 16 upwards of the vdw_setup0 register + add rb26, r0, rb27 + +-sub.setf -,8,r1 # 8-r1, so if <0 (negative) we need to use the full code +- + # get filter coefficients + + mov r0, unif +@@ -373,18 +371,11 @@ asr ra3, r0, rb23; mul24 r0, r0, ra22 + asr ra2, r0, rb23; mul24 r0, r0, ra22 + asr ra1, r0, rb23; mul24 r0, r0, ra22 + asr ra0, r0, rb23; mov r0, unif +-asr ra7, r0, rb23; mul24 r0, r0, ra22 +-asr ra6, r0, rb23; mul24 r0, r0, ra22 +-asr ra5, r0, rb23; mul24 r0, r0, ra22 +-asr ra4, r0, rb23; mov r0, unif ++ mov r0, unif + asr rb11, r0, rb23; mul24 r0, r0, ra22 + asr rb10, r0, rb23; mul24 r0, r0, ra22 + asr rb9, r0, rb23; mul24 r0, r0, ra22 + asr rb8, r0, rb23; mov r0, unif +-asr rb15, r0, rb23; mul24 r0, r0, ra22 +-asr rb14, r0, rb23; mul24 r0, r0, ra22 +-asr rb13, r0, rb23; mul24 r0, r0, ra22 +-asr rb12, r0, rb23 + + # r2 is elem_num + # r3 is loop counter +@@ -426,26 +417,14 @@ add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 + nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 + add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 + nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 +-add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 +-nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 +-add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 +-nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 +-add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 +-nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 +-add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 +-nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 + add r0, r2, r3 + + mov r3, rb31 + +-mov ra8, ra9 +-mov ra9, ra10 +-mov ra10, ra11 +-mov ra11, ra12 + mov ra12, ra13 + mov ra13, ra14 + +-sub.setf -, r3, 8 ; mov r1, ra22 ++sub.setf -, r3, 4 ; mov r1, ra22 + + # apply horizontal filter + brr.anyn -, r:uvloop_b0 +@@ -455,18 +434,12 @@ nop ; nop # Delay slot 3 (TODO move more of the context scr + + # apply vertical filter and write to VPM + +-nop ; mul24 r1, ra14, rb14 +-nop ; mul24 r0, ra13, rb13 +-add r1, r1, r0 ; mul24 r0, ra12, rb12 +-add r1, r1, r0 ; mul24 r0, ra11, rb11 +-add r1, r1, r0 ; mul24 r0, ra10, rb10 +-add r1, r1, r0 ; mul24 r0, ra9, rb9 +-add r1, r1, r0 ; mul24 r0, ra8, rb8 +-add r1, r1, r0 ; mul24 r0, ra15, rb15 ++nop ; mul24 r1, ra14, rb10 ++nop ; mul24 r0, ra13, rb9 ++add r1, r1, r0 ; mul24 r0, ra12, rb8 ++add r1, r1, r0 ; mul24 r0, ra15, rb11 + add r1, r1, r0 ; mov -, vw_wait + sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 +-#asr r1, r1, 14 +-#add r1, r1, ra21 + brr.anyn -, r:uvloop_b0 + asr vpm, r1, 14 # Delay 1 shifts down by shift2=6, but results are still in 16bit precision TODO may be able to avoid the mul24 and use more delay slots + nop # Delay 2 +-- +2.5.0 + + +From 6e69afcdf13d39d3f108824ae4496df799f7a6bd Mon Sep 17 00:00:00 2001 +From: Peter de Rivaz <peter.derivaz@gmail.com> +Date: Thu, 14 May 2015 11:12:43 +0100 +Subject: [PATCH 29/68] Optimised B pass + +--- + libavcodec/rpi_shader.c | 202 ++++++++++++++++++++------------------------- + libavcodec/rpi_shader.h | 6 +- + libavcodec/rpi_shader.qasm | 41 ++------- + 3 files changed, 100 insertions(+), 149 deletions(-) + +diff --git a/libavcodec/rpi_shader.c b/libavcodec/rpi_shader.c +index 1f63ee0..4e6c5ea 100644 +--- a/libavcodec/rpi_shader.c ++++ b/libavcodec/rpi_shader.c +@@ -289,8 +289,8 @@ unsigned int rpi_shader[] = { + /* [0x00000818] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 + /* [0x00000820] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 + /* [0x00000828] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 +-/* [0x00000830] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 +-/* [0x00000838] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 ++/* [0x00000830] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 ++/* [0x00000838] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 + /* [0x00000840] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 + /* [0x00000848] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 + /* [0x00000850] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 +@@ -299,120 +299,96 @@ unsigned int rpi_shader[] = { + /* [0x00000868] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 + /* [0x00000870] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 + /* [0x00000878] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 +-/* [0x00000880] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 +-/* [0x00000888] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000890] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000898] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000008a0] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000008a8] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif +-/* [0x000008b0] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000008b8] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000008c0] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000008c8] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif +-/* [0x000008d0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000008d8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000008e0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000008e8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif +-/* [0x000008f0] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000008f8] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000900] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000908] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 +-/* [0x00000910] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 +-/* [0x00000918] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-/* [0x00000920] */ 0x00000000, 0xe00208e7, // mov r3, 0 ++/* [0x00000880] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000888] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000890] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000898] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000008a0] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif ++/* [0x000008a8] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x000008b0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000008b8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000008c0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000008c8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif ++/* [0x000008d0] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 ++/* [0x000008d8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x000008e0] */ 0x00000000, 0xe00208e7, // mov r3, 0 + // :uvloop_b +-/* [0x00000928] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 +-/* [0x00000930] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 +-/* [0x00000938] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 +-/* [0x00000940] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch +-/* [0x00000948] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 +-/* [0x00000950] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 +-/* [0x00000958] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 +-/* [0x00000960] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 +-/* [0x00000968] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 +-/* [0x00000970] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 +-/* [0x00000978] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-/* [0x00000980] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 +-/* [0x00000988] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 +-/* [0x00000990] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 +-/* [0x00000998] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 +-/* [0x000009a0] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 +-/* [0x000009a8] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 +-/* [0x000009b0] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 +-/* [0x000009b8] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 +-/* [0x000009c0] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 +-/* [0x000009c8] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 +-/* [0x000009d0] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 +-/* [0x000009d8] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 +-/* [0x000009e0] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 +-/* [0x000009e8] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 +-/* [0x000009f0] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 +-/* [0x000009f8] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 +-/* [0x00000a00] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 +-/* [0x00000a08] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 +-/* [0x00000a10] */ 0x15267d80, 0x10020227, // mov ra8, ra9 +-/* [0x00000a18] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 +-/* [0x00000a20] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 +-/* [0x00000a28] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 +-/* [0x00000a30] */ 0x15367d80, 0x10020327, // mov ra12, ra13 +-/* [0x00000a38] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 +-/* [0x00000a40] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 +-/* [0x00000a48] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop_b +-/* [0x00000a50] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 +-/* [0x00000a58] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop +-/* [0x00000a60] */ 0x009e7000, 0x100009e7, // nop ; nop +-/* [0x00000a68] */ 0x4038e037, 0x100049e1, // nop ; mul24 r1, ra14, rb14 +-/* [0x00000a70] */ 0x4034d037, 0x100049e0, // nop ; mul24 r0, ra13, rb13 +-/* [0x00000a78] */ 0x4c30c237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb12 +-/* [0x00000a80] */ 0x4c2cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb11 +-/* [0x00000a88] */ 0x4c28a237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb10 +-/* [0x00000a90] */ 0x4c249237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb9 +-/* [0x00000a98] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 +-/* [0x00000aa0] */ 0x4c3cf237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb15 +-/* [0x00000aa8] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait +-/* [0x00000ab0] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 +-/* [0x00000ab8] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 +-/* [0x00000ac0] */ 0x0cc27380, 0x10020867, // add r1, r1, vpm +-/* [0x00000ac8] */ 0x0c7a7380, 0x10020867, // add r1, r1, ra30 +-/* [0x00000ad0] */ 0xfffffe38, 0xf06809e7, // brr.anyn -, r:uvloop_b +-/* [0x00000ad8] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 +-/* [0x00000ae0] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 +-/* [0x00000ae8] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 +-/* [0x00000af0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 +-/* [0x00000af8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 +-/* [0x00000b00] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif +-/* [0x00000b08] */ 0x00000010, 0xe0020827, // mov r0, 16 +-/* [0x00000b10] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait +-/* [0x00000b18] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 +-/* [0x00000b20] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 +-/* [0x00000b28] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 +-/* [0x00000b30] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif ++/* [0x000008e8] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 ++/* [0x000008f0] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 ++/* [0x000008f8] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 ++/* [0x00000900] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch ++/* [0x00000908] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 ++/* [0x00000910] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 ++/* [0x00000918] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 ++/* [0x00000920] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 ++/* [0x00000928] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 ++/* [0x00000930] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 ++/* [0x00000938] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x00000940] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 ++/* [0x00000948] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 ++/* [0x00000950] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 ++/* [0x00000958] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 ++/* [0x00000960] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 ++/* [0x00000968] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 ++/* [0x00000970] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 ++/* [0x00000978] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 ++/* [0x00000980] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 ++/* [0x00000988] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 ++/* [0x00000990] */ 0x15367d80, 0x10020327, // mov ra12, ra13 ++/* [0x00000998] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 ++/* [0x000009a0] */ 0x8d5847f6, 0xd00269e1, // sub.setf -, r3, 4 ; mov r1, ra22 ++/* [0x000009a8] */ 0xffffff20, 0xf06809e7, // brr.anyn -, r:uvloop_b ++/* [0x000009b0] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 ++/* [0x000009b8] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop ++/* [0x000009c0] */ 0x009e7000, 0x100009e7, // nop ; nop ++/* [0x000009c8] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 ++/* [0x000009d0] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 ++/* [0x000009d8] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 ++/* [0x000009e0] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 ++/* [0x000009e8] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait ++/* [0x000009f0] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 ++/* [0x000009f8] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 ++/* [0x00000a00] */ 0x0cc27380, 0x10020867, // add r1, r1, vpm ++/* [0x00000a08] */ 0x0c7a7380, 0x10020867, // add r1, r1, ra30 ++/* [0x00000a10] */ 0xfffffeb8, 0xf06809e7, // brr.anyn -, r:uvloop_b ++/* [0x00000a18] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 ++/* [0x00000a20] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 ++/* [0x00000a28] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 ++/* [0x00000a30] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 ++/* [0x00000a38] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 ++/* [0x00000a40] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif ++/* [0x00000a48] */ 0x00000010, 0xe0020827, // mov r0, 16 ++/* [0x00000a50] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x00000a58] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 ++/* [0x00000a60] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 ++/* [0x00000a68] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 ++/* [0x00000a70] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif + // ::mc_exit +-/* [0x00000b38] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait +-/* [0x00000b40] */ 0x00000000, 0xe80009e7, // mov -,srel(0) +-/* [0x00000b48] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00000b50] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00000b58] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00000b60] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00000b68] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend +-/* [0x00000b70] */ 0x009e7000, 0x100009e7, // nop ; nop +-/* [0x00000b78] */ 0x009e7000, 0x100009e7, // nop ; nop ++/* [0x00000a78] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x00000a80] */ 0x00000000, 0xe80009e7, // mov -,srel(0) ++/* [0x00000a88] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00000a90] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00000a98] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00000aa0] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00000aa8] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend ++/* [0x00000ab0] */ 0x009e7000, 0x100009e7, // nop ; nop ++/* [0x00000ab8] */ 0x009e7000, 0x100009e7, // nop ; nop + // ::mc_interrupt_exit8 +-/* [0x00000b80] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait +-/* [0x00000b88] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00000b90] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00000b98] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00000ba0] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00000ba8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00000bb0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00000bb8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00000bc0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00000bc8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00000bd0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00000bd8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00000be0] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend +-/* [0x00000be8] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop +-/* [0x00000bf0] */ 0x009e7000, 0x100009e7, // nop ; nop ++/* [0x00000ac0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x00000ac8] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00000ad0] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00000ad8] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00000ae0] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00000ae8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00000af0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00000af8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00000b00] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00000b08] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00000b10] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00000b18] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00000b20] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend ++/* [0x00000b28] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop ++/* [0x00000b30] */ 0x009e7000, 0x100009e7, // nop ; nop + // ::mc_end + }; + #ifdef __HIGHC__ +diff --git a/libavcodec/rpi_shader.h b/libavcodec/rpi_shader.h +index cb74887..53da629 100644 +--- a/libavcodec/rpi_shader.h ++++ b/libavcodec/rpi_shader.h +@@ -7,8 +7,8 @@ extern unsigned int rpi_shader[]; + #define mc_filter_uv (rpi_shader + 152) + #define mc_filter_uv_b0 (rpi_shader + 324) + #define mc_filter_uv_b (rpi_shader + 490) +-#define mc_exit (rpi_shader + 718) +-#define mc_interrupt_exit8 (rpi_shader + 736) +-#define mc_end (rpi_shader + 766) ++#define mc_exit (rpi_shader + 670) ++#define mc_interrupt_exit8 (rpi_shader + 688) ++#define mc_end (rpi_shader + 718) + + #endif +diff --git a/libavcodec/rpi_shader.qasm b/libavcodec/rpi_shader.qasm +index faa5755..f38c926 100644 +--- a/libavcodec/rpi_shader.qasm ++++ b/libavcodec/rpi_shader.qasm +@@ -491,8 +491,8 @@ mov r0, unif + shr r1, r0, r2 # Extract width + sub rb29, rb24, r1 # Compute vdw_setup1(dst_pitch-width) + and r0, r0, rb22 # Extract height +-add rb17, r0, 5 +-add rb18, r0, 7 ++add rb17, r0, 1 ++add rb18, r0, 3 + shl r0, r0, 7 + + # r0 is currently height<<7 +@@ -508,8 +508,6 @@ add rb26, r0, rb27 + # In a B frame, so also set up VPM read (reading back 16bit precision) + add vr_setup, r3, rb21 + +-sub.setf -,8,r1 # 8-r1, so if <0 (negative) we need to use the full code +- + # get filter coefficients + + mov r0, unif +@@ -517,18 +515,11 @@ asr ra3, r0, rb23; mul24 r0, r0, ra22 + asr ra2, r0, rb23; mul24 r0, r0, ra22 + asr ra1, r0, rb23; mul24 r0, r0, ra22 + asr ra0, r0, rb23; mov r0, unif +-asr ra7, r0, rb23; mul24 r0, r0, ra22 +-asr ra6, r0, rb23; mul24 r0, r0, ra22 +-asr ra5, r0, rb23; mul24 r0, r0, ra22 +-asr ra4, r0, rb23; mov r0, unif ++ mov r0, unif + asr rb11, r0, rb23; mul24 r0, r0, ra22 + asr rb10, r0, rb23; mul24 r0, r0, ra22 + asr rb9, r0, rb23; mul24 r0, r0, ra22 + asr rb8, r0, rb23; mov r0, unif +-asr rb15, r0, rb23; mul24 r0, r0, ra22 +-asr rb14, r0, rb23; mul24 r0, r0, ra22 +-asr rb13, r0, rb23; mul24 r0, r0, ra22 +-asr rb12, r0, rb23 + + # r2 is elem_num + # r3 is loop counter +@@ -570,26 +561,14 @@ add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 + nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 + add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 + nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 +-add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 +-nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 +-add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 +-nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 +-add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 +-nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 +-add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 +-nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 + add r0, r2, r3 + + mov r3, rb31 + +-mov ra8, ra9 +-mov ra9, ra10 +-mov ra10, ra11 +-mov ra11, ra12 + mov ra12, ra13 + mov ra13, ra14 + +-sub.setf -, r3, 8 ; mov r1, ra22 ++sub.setf -, r3, 4 ; mov r1, ra22 + # apply horizontal filter + brr.anyn -, r:uvloop_b + mov ra14, ra15 ; mul24 r0, r0, r1 # last bit of context scroll, including clamp to zero +@@ -598,14 +577,10 @@ nop ; nop # TODO improve use of delay slots + + # apply vertical filter and write to VPM + +-nop ; mul24 r1, ra14, rb14 +-nop ; mul24 r0, ra13, rb13 +-add r1, r1, r0 ; mul24 r0, ra12, rb12 +-add r1, r1, r0 ; mul24 r0, ra11, rb11 +-add r1, r1, r0 ; mul24 r0, ra10, rb10 +-add r1, r1, r0 ; mul24 r0, ra9, rb9 +-add r1, r1, r0 ; mul24 r0, ra8, rb8 +-add r1, r1, r0 ; mul24 r0, ra15, rb15 ++nop ; mul24 r1, ra14, rb10 ++nop ; mul24 r0, ra13, rb9 ++add r1, r1, r0 ; mul24 r0, ra12, rb8 ++add r1, r1, r0 ; mul24 r0, ra15, rb11 + add r1, r1, r0 ; mov -, vw_wait + sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 + asr r1, r1, 14 # shift2=6 +-- +2.5.0 + + +From 75ce019e80ff7f2234d56949c191413ab1d9ad7e Mon Sep 17 00:00:00 2001 +From: Peter de Rivaz <peter.derivaz@gmail.com> +Date: Thu, 14 May 2015 11:17:09 +0100 +Subject: [PATCH 30/68] Used P delay slots more efficiently + +--- + libavcodec/rpi_shader.c | 437 ++++++++++++++++++++++----------------------- + libavcodec/rpi_shader.h | 10 +- + libavcodec/rpi_shader.qasm | 19 +- + 3 files changed, 228 insertions(+), 238 deletions(-) + +diff --git a/libavcodec/rpi_shader.c b/libavcodec/rpi_shader.c +index 4e6c5ea..a1af4e3 100644 +--- a/libavcodec/rpi_shader.c ++++ b/libavcodec/rpi_shader.c +@@ -156,239 +156,236 @@ unsigned int rpi_shader[] = { + /* [0x00000408] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 + /* [0x00000410] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 + /* [0x00000418] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 +-/* [0x00000420] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 +-/* [0x00000428] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 +-/* [0x00000430] */ 0x15367d80, 0x10020327, // mov ra12, ra13 ++/* [0x00000420] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 ++/* [0x00000428] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 ++/* [0x00000430] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop + /* [0x00000438] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 +-/* [0x00000440] */ 0x8d5847f6, 0xd00269e1, // sub.setf -, r3, 4 ; mov r1, ra22 +-/* [0x00000448] */ 0xffffff20, 0xf06809e7, // brr.anyn -, r:uvloop +-/* [0x00000450] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 +-/* [0x00000458] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop +-/* [0x00000460] */ 0x009e7000, 0x100009e7, // nop ; nop +-/* [0x00000468] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 +-/* [0x00000470] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 +-/* [0x00000478] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 +-/* [0x00000480] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 +-/* [0x00000488] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait +-/* [0x00000490] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 +-/* [0x00000498] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 +-/* [0x000004a0] */ 0x0c567380, 0x10020867, // add r1, r1, ra21 +-/* [0x000004a8] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop +-/* [0x000004b0] */ 0x0f9c63c0, 0xd0020867, // asr r1, r1, 6 +-/* [0x000004b8] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 +-/* [0x000004c0] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 +-/* [0x000004c8] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 +-/* [0x000004d0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 +-/* [0x000004d8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif +-/* [0x000004e0] */ 0x00000010, 0xe0020827, // mov r0, 16 +-/* [0x000004e8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait +-/* [0x000004f0] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 +-/* [0x000004f8] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 +-/* [0x00000500] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 +-/* [0x00000508] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif ++/* [0x00000440] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 ++/* [0x00000448] */ 0x159e7000, 0x100203e7, // mov ra15, r0 ++/* [0x00000450] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 ++/* [0x00000458] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 ++/* [0x00000460] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 ++/* [0x00000468] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 ++/* [0x00000470] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait ++/* [0x00000478] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 ++/* [0x00000480] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 ++/* [0x00000488] */ 0x0c567380, 0x10020867, // add r1, r1, ra21 ++/* [0x00000490] */ 0xfffffed8, 0xf06809e7, // brr.anyn -, r:uvloop ++/* [0x00000498] */ 0x0f9c63c0, 0xd0020867, // asr r1, r1, 6 ++/* [0x000004a0] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 ++/* [0x000004a8] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 ++/* [0x000004b0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 ++/* [0x000004b8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 ++/* [0x000004c0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif ++/* [0x000004c8] */ 0x00000010, 0xe0020827, // mov r0, 16 ++/* [0x000004d0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x000004d8] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 ++/* [0x000004e0] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 ++/* [0x000004e8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 ++/* [0x000004f0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif + // ::mc_filter_uv_b0 +-/* [0x00000510] */ 0x15827d80, 0x100207e7, // mov ra31, unif +-/* [0x00000518] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next +-/* [0x00000520] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num +-/* [0x00000528] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif +-/* [0x00000530] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif +-/* [0x00000538] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 +-/* [0x00000540] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 +-/* [0x00000548] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 +-/* [0x00000550] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 +-/* [0x00000558] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 +-/* [0x00000560] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 +-/* [0x00000568] */ 0x159d5fc0, 0x10021c67, // mov vw_setup, rb21 +-/* [0x00000570] */ 0x00000010, 0xe00208a7, // mov r2, 16 +-/* [0x00000578] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000580] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 +-/* [0x00000588] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 +-/* [0x00000590] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 +-/* [0x00000598] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 +-/* [0x000005a0] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 +-/* [0x000005a8] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 +-/* [0x000005b0] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 +-/* [0x000005b8] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 +-/* [0x000005c0] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 +-/* [0x000005c8] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x000005d0] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000005d8] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000005e0] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000005e8] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif +-/* [0x000005f0] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x000005f8] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000600] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000608] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000610] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif +-/* [0x00000618] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 +-/* [0x00000620] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-/* [0x00000628] */ 0x00000000, 0xe00208e7, // mov r3, 0 ++/* [0x000004f8] */ 0x15827d80, 0x100207e7, // mov ra31, unif ++/* [0x00000500] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next ++/* [0x00000508] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num ++/* [0x00000510] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif ++/* [0x00000518] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif ++/* [0x00000520] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 ++/* [0x00000528] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 ++/* [0x00000530] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 ++/* [0x00000538] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 ++/* [0x00000540] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 ++/* [0x00000548] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 ++/* [0x00000550] */ 0x159d5fc0, 0x10021c67, // mov vw_setup, rb21 ++/* [0x00000558] */ 0x00000010, 0xe00208a7, // mov r2, 16 ++/* [0x00000560] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000568] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 ++/* [0x00000570] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 ++/* [0x00000578] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 ++/* [0x00000580] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 ++/* [0x00000588] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 ++/* [0x00000590] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 ++/* [0x00000598] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 ++/* [0x000005a0] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 ++/* [0x000005a8] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 ++/* [0x000005b0] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x000005b8] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000005c0] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000005c8] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000005d0] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif ++/* [0x000005d8] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x000005e0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000005e8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000005f0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000005f8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif ++/* [0x00000600] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 ++/* [0x00000608] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x00000610] */ 0x00000000, 0xe00208e7, // mov r3, 0 + // :uvloop_b0 +-/* [0x00000630] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 +-/* [0x00000638] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 +-/* [0x00000640] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 +-/* [0x00000648] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch +-/* [0x00000650] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 +-/* [0x00000658] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 +-/* [0x00000660] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 +-/* [0x00000668] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 +-/* [0x00000670] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 +-/* [0x00000678] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 +-/* [0x00000680] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-/* [0x00000688] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 +-/* [0x00000690] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 +-/* [0x00000698] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 +-/* [0x000006a0] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 +-/* [0x000006a8] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 +-/* [0x000006b0] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 +-/* [0x000006b8] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 +-/* [0x000006c0] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 +-/* [0x000006c8] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 +-/* [0x000006d0] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 +-/* [0x000006d8] */ 0x15367d80, 0x10020327, // mov ra12, ra13 +-/* [0x000006e0] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 +-/* [0x000006e8] */ 0x8d5847f6, 0xd00269e1, // sub.setf -, r3, 4 ; mov r1, ra22 +-/* [0x000006f0] */ 0xffffff20, 0xf06809e7, // brr.anyn -, r:uvloop_b0 +-/* [0x000006f8] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 +-/* [0x00000700] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop +-/* [0x00000708] */ 0x009e7000, 0x100009e7, // nop ; nop +-/* [0x00000710] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 +-/* [0x00000718] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 +-/* [0x00000720] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 +-/* [0x00000728] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 +-/* [0x00000730] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait +-/* [0x00000738] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 +-/* [0x00000740] */ 0xfffffed0, 0xf06809e7, // brr.anyn -, r:uvloop_b0 +-/* [0x00000748] */ 0x0f9ce3c0, 0xd0020c27, // asr vpm, r1, 14 +-/* [0x00000750] */ 0x009e7000, 0x100009e7, // nop +-/* [0x00000758] */ 0x009e7000, 0x100009e7, // nop +-/* [0x00000760] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 +-/* [0x00000768] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 +-/* [0x00000770] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif +-/* [0x00000778] */ 0x00000010, 0xe0020827, // mov r0, 16 +-/* [0x00000780] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait +-/* [0x00000788] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 +-/* [0x00000790] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 +-/* [0x00000798] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 +-/* [0x000007a0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif ++/* [0x00000618] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 ++/* [0x00000620] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 ++/* [0x00000628] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 ++/* [0x00000630] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch ++/* [0x00000638] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 ++/* [0x00000640] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 ++/* [0x00000648] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 ++/* [0x00000650] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 ++/* [0x00000658] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 ++/* [0x00000660] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 ++/* [0x00000668] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x00000670] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 ++/* [0x00000678] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 ++/* [0x00000680] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 ++/* [0x00000688] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 ++/* [0x00000690] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 ++/* [0x00000698] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 ++/* [0x000006a0] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 ++/* [0x000006a8] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 ++/* [0x000006b0] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 ++/* [0x000006b8] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 ++/* [0x000006c0] */ 0x15367d80, 0x10020327, // mov ra12, ra13 ++/* [0x000006c8] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 ++/* [0x000006d0] */ 0x8d5847f6, 0xd00269e1, // sub.setf -, r3, 4 ; mov r1, ra22 ++/* [0x000006d8] */ 0xffffff20, 0xf06809e7, // brr.anyn -, r:uvloop_b0 ++/* [0x000006e0] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 ++/* [0x000006e8] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop ++/* [0x000006f0] */ 0x009e7000, 0x100009e7, // nop ; nop ++/* [0x000006f8] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 ++/* [0x00000700] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 ++/* [0x00000708] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 ++/* [0x00000710] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 ++/* [0x00000718] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait ++/* [0x00000720] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 ++/* [0x00000728] */ 0xfffffed0, 0xf06809e7, // brr.anyn -, r:uvloop_b0 ++/* [0x00000730] */ 0x0f9ce3c0, 0xd0020c27, // asr vpm, r1, 14 ++/* [0x00000738] */ 0x009e7000, 0x100009e7, // nop ++/* [0x00000740] */ 0x009e7000, 0x100009e7, // nop ++/* [0x00000748] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 ++/* [0x00000750] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 ++/* [0x00000758] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif ++/* [0x00000760] */ 0x00000010, 0xe0020827, // mov r0, 16 ++/* [0x00000768] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x00000770] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 ++/* [0x00000778] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 ++/* [0x00000780] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 ++/* [0x00000788] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif + // ::mc_filter_uv_b +-/* [0x000007a8] */ 0x15827d80, 0x100207e7, // mov ra31, unif +-/* [0x000007b0] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next +-/* [0x000007b8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num +-/* [0x000007c0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif +-/* [0x000007c8] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif +-/* [0x000007d0] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 +-/* [0x000007d8] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 +-/* [0x000007e0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 +-/* [0x000007e8] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 +-/* [0x000007f0] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 +-/* [0x000007f8] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 +-/* [0x00000800] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 +-/* [0x00000808] */ 0x00000010, 0xe00208a7, // mov r2, 16 +-/* [0x00000810] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000818] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 +-/* [0x00000820] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 +-/* [0x00000828] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 +-/* [0x00000830] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 +-/* [0x00000838] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 +-/* [0x00000840] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 +-/* [0x00000848] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 +-/* [0x00000850] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 +-/* [0x00000858] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 +-/* [0x00000860] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 +-/* [0x00000868] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 +-/* [0x00000870] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 +-/* [0x00000878] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 +-/* [0x00000880] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000888] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000890] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000898] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000008a0] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif +-/* [0x000008a8] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x000008b0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000008b8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000008c0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000008c8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif +-/* [0x000008d0] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 +-/* [0x000008d8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-/* [0x000008e0] */ 0x00000000, 0xe00208e7, // mov r3, 0 ++/* [0x00000790] */ 0x15827d80, 0x100207e7, // mov ra31, unif ++/* [0x00000798] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next ++/* [0x000007a0] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num ++/* [0x000007a8] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif ++/* [0x000007b0] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif ++/* [0x000007b8] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 ++/* [0x000007c0] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 ++/* [0x000007c8] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 ++/* [0x000007d0] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 ++/* [0x000007d8] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 ++/* [0x000007e0] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 ++/* [0x000007e8] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 ++/* [0x000007f0] */ 0x00000010, 0xe00208a7, // mov r2, 16 ++/* [0x000007f8] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000800] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 ++/* [0x00000808] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 ++/* [0x00000810] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 ++/* [0x00000818] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 ++/* [0x00000820] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 ++/* [0x00000828] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 ++/* [0x00000830] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 ++/* [0x00000838] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 ++/* [0x00000840] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 ++/* [0x00000848] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 ++/* [0x00000850] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 ++/* [0x00000858] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 ++/* [0x00000860] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 ++/* [0x00000868] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000870] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000878] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000880] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000888] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif ++/* [0x00000890] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000898] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000008a0] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000008a8] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000008b0] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif ++/* [0x000008b8] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 ++/* [0x000008c0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x000008c8] */ 0x00000000, 0xe00208e7, // mov r3, 0 + // :uvloop_b +-/* [0x000008e8] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 +-/* [0x000008f0] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 +-/* [0x000008f8] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 +-/* [0x00000900] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch +-/* [0x00000908] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 +-/* [0x00000910] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 +-/* [0x00000918] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 +-/* [0x00000920] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 +-/* [0x00000928] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 +-/* [0x00000930] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 +-/* [0x00000938] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-/* [0x00000940] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 +-/* [0x00000948] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 +-/* [0x00000950] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 +-/* [0x00000958] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 +-/* [0x00000960] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 +-/* [0x00000968] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 +-/* [0x00000970] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 +-/* [0x00000978] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 +-/* [0x00000980] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 +-/* [0x00000988] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 +-/* [0x00000990] */ 0x15367d80, 0x10020327, // mov ra12, ra13 +-/* [0x00000998] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 +-/* [0x000009a0] */ 0x8d5847f6, 0xd00269e1, // sub.setf -, r3, 4 ; mov r1, ra22 +-/* [0x000009a8] */ 0xffffff20, 0xf06809e7, // brr.anyn -, r:uvloop_b +-/* [0x000009b0] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 +-/* [0x000009b8] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop +-/* [0x000009c0] */ 0x009e7000, 0x100009e7, // nop ; nop +-/* [0x000009c8] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 +-/* [0x000009d0] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 +-/* [0x000009d8] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 +-/* [0x000009e0] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 +-/* [0x000009e8] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait +-/* [0x000009f0] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 +-/* [0x000009f8] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 +-/* [0x00000a00] */ 0x0cc27380, 0x10020867, // add r1, r1, vpm +-/* [0x00000a08] */ 0x0c7a7380, 0x10020867, // add r1, r1, ra30 +-/* [0x00000a10] */ 0xfffffeb8, 0xf06809e7, // brr.anyn -, r:uvloop_b +-/* [0x00000a18] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 +-/* [0x00000a20] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 +-/* [0x00000a28] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 +-/* [0x00000a30] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 +-/* [0x00000a38] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 +-/* [0x00000a40] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif +-/* [0x00000a48] */ 0x00000010, 0xe0020827, // mov r0, 16 +-/* [0x00000a50] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait +-/* [0x00000a58] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 +-/* [0x00000a60] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 +-/* [0x00000a68] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 +-/* [0x00000a70] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif ++/* [0x000008d0] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 ++/* [0x000008d8] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 ++/* [0x000008e0] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 ++/* [0x000008e8] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch ++/* [0x000008f0] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 ++/* [0x000008f8] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 ++/* [0x00000900] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 ++/* [0x00000908] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 ++/* [0x00000910] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 ++/* [0x00000918] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 ++/* [0x00000920] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x00000928] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 ++/* [0x00000930] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 ++/* [0x00000938] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 ++/* [0x00000940] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 ++/* [0x00000948] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 ++/* [0x00000950] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 ++/* [0x00000958] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 ++/* [0x00000960] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 ++/* [0x00000968] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 ++/* [0x00000970] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 ++/* [0x00000978] */ 0x15367d80, 0x10020327, // mov ra12, ra13 ++/* [0x00000980] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 ++/* [0x00000988] */ 0x8d5847f6, 0xd00269e1, // sub.setf -, r3, 4 ; mov r1, ra22 ++/* [0x00000990] */ 0xffffff20, 0xf06809e7, // brr.anyn -, r:uvloop_b ++/* [0x00000998] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 ++/* [0x000009a0] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop ++/* [0x000009a8] */ 0x009e7000, 0x100009e7, // nop ; nop ++/* [0x000009b0] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 ++/* [0x000009b8] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 ++/* [0x000009c0] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 ++/* [0x000009c8] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 ++/* [0x000009d0] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait ++/* [0x000009d8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 ++/* [0x000009e0] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 ++/* [0x000009e8] */ 0x0cc27380, 0x10020867, // add r1, r1, vpm ++/* [0x000009f0] */ 0x0c7a7380, 0x10020867, // add r1, r1, ra30 ++/* [0x000009f8] */ 0xfffffeb8, 0xf06809e7, // brr.anyn -, r:uvloop_b ++/* [0x00000a00] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 ++/* [0x00000a08] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 ++/* [0x00000a10] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 ++/* [0x00000a18] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 ++/* [0x00000a20] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 ++/* [0x00000a28] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif ++/* [0x00000a30] */ 0x00000010, 0xe0020827, // mov r0, 16 ++/* [0x00000a38] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x00000a40] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 ++/* [0x00000a48] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 ++/* [0x00000a50] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 ++/* [0x00000a58] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif + // ::mc_exit +-/* [0x00000a78] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait +-/* [0x00000a80] */ 0x00000000, 0xe80009e7, // mov -,srel(0) ++/* [0x00000a60] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x00000a68] */ 0x00000000, 0xe80009e7, // mov -,srel(0) ++/* [0x00000a70] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00000a78] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00000a80] */ 0x009e7000, 0xa00009e7, // ldtmu0 + /* [0x00000a88] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00000a90] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00000a98] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00000aa0] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00000aa8] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend +-/* [0x00000ab0] */ 0x009e7000, 0x100009e7, // nop ; nop +-/* [0x00000ab8] */ 0x009e7000, 0x100009e7, // nop ; nop ++/* [0x00000a90] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend ++/* [0x00000a98] */ 0x009e7000, 0x100009e7, // nop ; nop ++/* [0x00000aa0] */ 0x009e7000, 0x100009e7, // nop ; nop + // ::mc_interrupt_exit8 +-/* [0x00000ac0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x00000aa8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x00000ab0] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00000ab8] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00000ac0] */ 0x009e7000, 0xa00009e7, // ldtmu0 + /* [0x00000ac8] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00000ad0] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00000ad8] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00000ae0] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00000ad0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00000ad8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00000ae0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) + /* [0x00000ae8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) + /* [0x00000af0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) + /* [0x00000af8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) + /* [0x00000b00] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00000b08] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00000b10] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00000b18] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00000b20] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend +-/* [0x00000b28] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop +-/* [0x00000b30] */ 0x009e7000, 0x100009e7, // nop ; nop ++/* [0x00000b08] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend ++/* [0x00000b10] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop ++/* [0x00000b18] */ 0x009e7000, 0x100009e7, // nop ; nop + // ::mc_end + }; + #ifdef __HIGHC__ +diff --git a/libavcodec/rpi_shader.h b/libavcodec/rpi_shader.h +index 53da629..1fb3e37 100644 +--- a/libavcodec/rpi_shader.h ++++ b/libavcodec/rpi_shader.h +@@ -5,10 +5,10 @@ extern unsigned int rpi_shader[]; + + #define mc_setup_uv (rpi_shader + 0) + #define mc_filter_uv (rpi_shader + 152) +-#define mc_filter_uv_b0 (rpi_shader + 324) +-#define mc_filter_uv_b (rpi_shader + 490) +-#define mc_exit (rpi_shader + 670) +-#define mc_interrupt_exit8 (rpi_shader + 688) +-#define mc_end (rpi_shader + 718) ++#define mc_filter_uv_b0 (rpi_shader + 318) ++#define mc_filter_uv_b (rpi_shader + 484) ++#define mc_exit (rpi_shader + 664) ++#define mc_interrupt_exit8 (rpi_shader + 682) ++#define mc_end (rpi_shader + 712) + + #endif +diff --git a/libavcodec/rpi_shader.qasm b/libavcodec/rpi_shader.qasm +index f38c926..02e95dd 100644 +--- a/libavcodec/rpi_shader.qasm ++++ b/libavcodec/rpi_shader.qasm +@@ -268,6 +268,7 @@ add t0s, ra_x2_base, r2 + + mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] + ++# apply horizontal filter + nop ; mul24 r2, r0, ra0 + nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 + nop ; mul24 r3, ra1 << 1, r0 << 1 +@@ -276,20 +277,12 @@ add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 + nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 + add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 + nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 +-add r0, r2, r3 +- +-mov r3, rb31 +- +-mov ra12, ra13 +-mov ra13, ra14 +- +-sub.setf -, r3, 4 ; mov r1, ra22 +- +-# apply horizontal filter ++add r0, r2, r3 ; mov r3, rb31 ++sub.setf -, r3, 4 ; mov ra12, ra13 + brr.anyn -, r:uvloop +-mov ra14, ra15 ; mul24 r0, r0, r1 # last bit of context scroll +-asr ra15, r0, 8 ; nop +-nop ; nop # Delay slot 3 (TODO move more of the context scroll into here) ++mov ra13, ra14 # Delay slot 1 ++mov ra14, ra15 # Delay slot 2 ++mov ra15, r0 # Delay slot 3 + + # apply vertical filter and write to VPM + +-- +2.5.0 + + +From a92dda80bf8043b39fa85752d9a9592e90370d77 Mon Sep 17 00:00:00 2001 +From: Peter de Rivaz <peter.derivaz@gmail.com> +Date: Thu, 14 May 2015 11:22:25 +0100 +Subject: [PATCH 31/68] Improved use of delay slots + +--- + libavcodec/rpi_shader.c | 503 ++++++++++++++++++++++----------------------- + libavcodec/rpi_shader.h | 10 +- + libavcodec/rpi_shader.qasm | 41 ++-- + 3 files changed, 265 insertions(+), 289 deletions(-) + +diff --git a/libavcodec/rpi_shader.c b/libavcodec/rpi_shader.c +index a1af4e3..c498f28 100644 +--- a/libavcodec/rpi_shader.c ++++ b/libavcodec/rpi_shader.c +@@ -122,270 +122,263 @@ unsigned int rpi_shader[] = { + /* [0x00000300] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 + /* [0x00000308] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 + /* [0x00000310] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 +-/* [0x00000318] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 +-/* [0x00000320] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000328] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000330] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000338] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000340] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif +-/* [0x00000348] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000350] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000358] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000360] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000368] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif +-/* [0x00000370] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 +-/* [0x00000378] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-/* [0x00000380] */ 0x00000000, 0xe00208e7, // mov r3, 0 ++/* [0x00000318] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000320] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000328] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000330] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000338] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif ++/* [0x00000340] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000348] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000350] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000358] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000360] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif ++/* [0x00000368] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 ++/* [0x00000370] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x00000378] */ 0x00000000, 0xe00208e7, // mov r3, 0 + // :uvloop +-/* [0x00000388] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 +-/* [0x00000390] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 +-/* [0x00000398] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 +-/* [0x000003a0] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch +-/* [0x000003a8] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 +-/* [0x000003b0] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 +-/* [0x000003b8] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 +-/* [0x000003c0] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 +-/* [0x000003c8] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 +-/* [0x000003d0] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 +-/* [0x000003d8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-/* [0x000003e0] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 +-/* [0x000003e8] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 +-/* [0x000003f0] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 +-/* [0x000003f8] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 +-/* [0x00000400] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 +-/* [0x00000408] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 +-/* [0x00000410] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 +-/* [0x00000418] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 +-/* [0x00000420] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 +-/* [0x00000428] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 +-/* [0x00000430] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop +-/* [0x00000438] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 +-/* [0x00000440] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 +-/* [0x00000448] */ 0x159e7000, 0x100203e7, // mov ra15, r0 +-/* [0x00000450] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 +-/* [0x00000458] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 +-/* [0x00000460] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 +-/* [0x00000468] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 +-/* [0x00000470] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait +-/* [0x00000478] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 +-/* [0x00000480] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 +-/* [0x00000488] */ 0x0c567380, 0x10020867, // add r1, r1, ra21 +-/* [0x00000490] */ 0xfffffed8, 0xf06809e7, // brr.anyn -, r:uvloop +-/* [0x00000498] */ 0x0f9c63c0, 0xd0020867, // asr r1, r1, 6 +-/* [0x000004a0] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 +-/* [0x000004a8] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 +-/* [0x000004b0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 +-/* [0x000004b8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 +-/* [0x000004c0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif +-/* [0x000004c8] */ 0x00000010, 0xe0020827, // mov r0, 16 +-/* [0x000004d0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait +-/* [0x000004d8] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 +-/* [0x000004e0] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 +-/* [0x000004e8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 +-/* [0x000004f0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif ++/* [0x00000380] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 ++/* [0x00000388] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 ++/* [0x00000390] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 ++/* [0x00000398] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch ++/* [0x000003a0] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 ++/* [0x000003a8] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 ++/* [0x000003b0] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 ++/* [0x000003b8] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 ++/* [0x000003c0] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 ++/* [0x000003c8] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 ++/* [0x000003d0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x000003d8] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 ++/* [0x000003e0] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 ++/* [0x000003e8] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 ++/* [0x000003f0] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 ++/* [0x000003f8] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 ++/* [0x00000400] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 ++/* [0x00000408] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 ++/* [0x00000410] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 ++/* [0x00000418] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 ++/* [0x00000420] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 ++/* [0x00000428] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop ++/* [0x00000430] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 ++/* [0x00000438] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 ++/* [0x00000440] */ 0x159e7000, 0x100203e7, // mov ra15, r0 ++/* [0x00000448] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 ++/* [0x00000450] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 ++/* [0x00000458] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 ++/* [0x00000460] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 ++/* [0x00000468] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait ++/* [0x00000470] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 ++/* [0x00000478] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 ++/* [0x00000480] */ 0x0c567380, 0x10020867, // add r1, r1, ra21 ++/* [0x00000488] */ 0xfffffed8, 0xf06809e7, // brr.anyn -, r:uvloop ++/* [0x00000490] */ 0x0f9c63c0, 0xd0020867, // asr r1, r1, 6 ++/* [0x00000498] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 ++/* [0x000004a0] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 ++/* [0x000004a8] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 ++/* [0x000004b0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 ++/* [0x000004b8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif ++/* [0x000004c0] */ 0x00000010, 0xe0020827, // mov r0, 16 ++/* [0x000004c8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x000004d0] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 ++/* [0x000004d8] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 ++/* [0x000004e0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 ++/* [0x000004e8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif + // ::mc_filter_uv_b0 +-/* [0x000004f8] */ 0x15827d80, 0x100207e7, // mov ra31, unif +-/* [0x00000500] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next +-/* [0x00000508] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num +-/* [0x00000510] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif +-/* [0x00000518] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif +-/* [0x00000520] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 +-/* [0x00000528] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 +-/* [0x00000530] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 +-/* [0x00000538] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 +-/* [0x00000540] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 +-/* [0x00000548] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 +-/* [0x00000550] */ 0x159d5fc0, 0x10021c67, // mov vw_setup, rb21 +-/* [0x00000558] */ 0x00000010, 0xe00208a7, // mov r2, 16 +-/* [0x00000560] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000568] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 +-/* [0x00000570] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 +-/* [0x00000578] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 +-/* [0x00000580] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 +-/* [0x00000588] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 +-/* [0x00000590] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 +-/* [0x00000598] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 +-/* [0x000005a0] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 +-/* [0x000005a8] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 +-/* [0x000005b0] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x000005b8] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000005c0] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000005c8] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000005d0] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif +-/* [0x000005d8] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x000005e0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000005e8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000005f0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000005f8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif +-/* [0x00000600] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 +-/* [0x00000608] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-/* [0x00000610] */ 0x00000000, 0xe00208e7, // mov r3, 0 ++/* [0x000004f0] */ 0x15827d80, 0x100207e7, // mov ra31, unif ++/* [0x000004f8] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next ++/* [0x00000500] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num ++/* [0x00000508] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif ++/* [0x00000510] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif ++/* [0x00000518] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 ++/* [0x00000520] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 ++/* [0x00000528] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 ++/* [0x00000530] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 ++/* [0x00000538] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 ++/* [0x00000540] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 ++/* [0x00000548] */ 0x159d5fc0, 0x10021c67, // mov vw_setup, rb21 ++/* [0x00000550] */ 0x00000010, 0xe00208a7, // mov r2, 16 ++/* [0x00000558] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000560] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 ++/* [0x00000568] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 ++/* [0x00000570] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 ++/* [0x00000578] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 ++/* [0x00000580] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 ++/* [0x00000588] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 ++/* [0x00000590] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 ++/* [0x00000598] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 ++/* [0x000005a0] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 ++/* [0x000005a8] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x000005b0] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000005b8] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000005c0] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000005c8] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif ++/* [0x000005d0] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x000005d8] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000005e0] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000005e8] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000005f0] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif ++/* [0x000005f8] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 ++/* [0x00000600] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x00000608] */ 0x00000000, 0xe00208e7, // mov r3, 0 + // :uvloop_b0 +-/* [0x00000618] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 +-/* [0x00000620] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 +-/* [0x00000628] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 +-/* [0x00000630] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch +-/* [0x00000638] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 +-/* [0x00000640] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 +-/* [0x00000648] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 +-/* [0x00000650] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 +-/* [0x00000658] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 +-/* [0x00000660] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 +-/* [0x00000668] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-/* [0x00000670] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 +-/* [0x00000678] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 +-/* [0x00000680] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 +-/* [0x00000688] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 +-/* [0x00000690] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 +-/* [0x00000698] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 +-/* [0x000006a0] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 +-/* [0x000006a8] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 +-/* [0x000006b0] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 +-/* [0x000006b8] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 +-/* [0x000006c0] */ 0x15367d80, 0x10020327, // mov ra12, ra13 +-/* [0x000006c8] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 +-/* [0x000006d0] */ 0x8d5847f6, 0xd00269e1, // sub.setf -, r3, 4 ; mov r1, ra22 +-/* [0x000006d8] */ 0xffffff20, 0xf06809e7, // brr.anyn -, r:uvloop_b0 +-/* [0x000006e0] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 +-/* [0x000006e8] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop +-/* [0x000006f0] */ 0x009e7000, 0x100009e7, // nop ; nop +-/* [0x000006f8] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 +-/* [0x00000700] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 +-/* [0x00000708] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 +-/* [0x00000710] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 +-/* [0x00000718] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait +-/* [0x00000720] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 +-/* [0x00000728] */ 0xfffffed0, 0xf06809e7, // brr.anyn -, r:uvloop_b0 +-/* [0x00000730] */ 0x0f9ce3c0, 0xd0020c27, // asr vpm, r1, 14 +-/* [0x00000738] */ 0x009e7000, 0x100009e7, // nop +-/* [0x00000740] */ 0x009e7000, 0x100009e7, // nop +-/* [0x00000748] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 +-/* [0x00000750] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 +-/* [0x00000758] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif +-/* [0x00000760] */ 0x00000010, 0xe0020827, // mov r0, 16 +-/* [0x00000768] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait +-/* [0x00000770] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 +-/* [0x00000778] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 +-/* [0x00000780] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 +-/* [0x00000788] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif ++/* [0x00000610] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 ++/* [0x00000618] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 ++/* [0x00000620] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 ++/* [0x00000628] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch ++/* [0x00000630] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 ++/* [0x00000638] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 ++/* [0x00000640] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 ++/* [0x00000648] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 ++/* [0x00000650] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 ++/* [0x00000658] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 ++/* [0x00000660] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x00000668] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 ++/* [0x00000670] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 ++/* [0x00000678] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 ++/* [0x00000680] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 ++/* [0x00000688] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 ++/* [0x00000690] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 ++/* [0x00000698] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 ++/* [0x000006a0] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 ++/* [0x000006a8] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 ++/* [0x000006b0] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 ++/* [0x000006b8] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b0 ++/* [0x000006c0] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 ++/* [0x000006c8] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 ++/* [0x000006d0] */ 0x159e7000, 0x100203e7, // mov ra15, r0 ++/* [0x000006d8] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 ++/* [0x000006e0] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 ++/* [0x000006e8] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 ++/* [0x000006f0] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 ++/* [0x000006f8] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait ++/* [0x00000700] */ 0x0d9d27c0, 0x100229e7, // sub.setf -, r3, rb18 ++/* [0x00000708] */ 0xfffffee8, 0xf06809e7, // brr.anyn -, r:uvloop_b0 ++/* [0x00000710] */ 0x0f9c63c0, 0xd0020c27, // asr vpm, r1, 6 ++/* [0x00000718] */ 0x009e7000, 0x100009e7, // nop ++/* [0x00000720] */ 0x009e7000, 0x100009e7, // nop ++/* [0x00000728] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 ++/* [0x00000730] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 ++/* [0x00000738] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif ++/* [0x00000740] */ 0x00000010, 0xe0020827, // mov r0, 16 ++/* [0x00000748] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x00000750] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 ++/* [0x00000758] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 ++/* [0x00000760] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 ++/* [0x00000768] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif + // ::mc_filter_uv_b +-/* [0x00000790] */ 0x15827d80, 0x100207e7, // mov ra31, unif +-/* [0x00000798] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next +-/* [0x000007a0] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num +-/* [0x000007a8] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif +-/* [0x000007b0] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif +-/* [0x000007b8] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 +-/* [0x000007c0] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 +-/* [0x000007c8] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 +-/* [0x000007d0] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 +-/* [0x000007d8] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 +-/* [0x000007e0] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 +-/* [0x000007e8] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 +-/* [0x000007f0] */ 0x00000010, 0xe00208a7, // mov r2, 16 +-/* [0x000007f8] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000800] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 +-/* [0x00000808] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 +-/* [0x00000810] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 +-/* [0x00000818] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 +-/* [0x00000820] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 +-/* [0x00000828] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 +-/* [0x00000830] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 +-/* [0x00000838] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 +-/* [0x00000840] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 +-/* [0x00000848] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 +-/* [0x00000850] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 +-/* [0x00000858] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 +-/* [0x00000860] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 +-/* [0x00000868] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000870] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000878] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000880] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000888] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif +-/* [0x00000890] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000898] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000008a0] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000008a8] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000008b0] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif +-/* [0x000008b8] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 +-/* [0x000008c0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-/* [0x000008c8] */ 0x00000000, 0xe00208e7, // mov r3, 0 ++/* [0x00000770] */ 0x15827d80, 0x100207e7, // mov ra31, unif ++/* [0x00000778] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next ++/* [0x00000780] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num ++/* [0x00000788] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif ++/* [0x00000790] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif ++/* [0x00000798] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 ++/* [0x000007a0] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 ++/* [0x000007a8] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 ++/* [0x000007b0] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 ++/* [0x000007b8] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 ++/* [0x000007c0] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 ++/* [0x000007c8] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 ++/* [0x000007d0] */ 0x00000010, 0xe00208a7, // mov r2, 16 ++/* [0x000007d8] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x000007e0] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 ++/* [0x000007e8] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 ++/* [0x000007f0] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 ++/* [0x000007f8] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 ++/* [0x00000800] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 ++/* [0x00000808] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 ++/* [0x00000810] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 ++/* [0x00000818] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 ++/* [0x00000820] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 ++/* [0x00000828] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 ++/* [0x00000830] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 ++/* [0x00000838] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 ++/* [0x00000840] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 ++/* [0x00000848] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000850] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000858] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000860] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000868] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif ++/* [0x00000870] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000878] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000880] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000888] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000890] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif ++/* [0x00000898] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 ++/* [0x000008a0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x000008a8] */ 0x00000000, 0xe00208e7, // mov r3, 0 + // :uvloop_b +-/* [0x000008d0] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 +-/* [0x000008d8] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 +-/* [0x000008e0] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 +-/* [0x000008e8] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch +-/* [0x000008f0] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 +-/* [0x000008f8] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 +-/* [0x00000900] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 +-/* [0x00000908] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 +-/* [0x00000910] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 +-/* [0x00000918] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 +-/* [0x00000920] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-/* [0x00000928] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 +-/* [0x00000930] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 +-/* [0x00000938] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 +-/* [0x00000940] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 +-/* [0x00000948] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 +-/* [0x00000950] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 +-/* [0x00000958] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 +-/* [0x00000960] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 +-/* [0x00000968] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 +-/* [0x00000970] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 +-/* [0x00000978] */ 0x15367d80, 0x10020327, // mov ra12, ra13 +-/* [0x00000980] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 +-/* [0x00000988] */ 0x8d5847f6, 0xd00269e1, // sub.setf -, r3, 4 ; mov r1, ra22 +-/* [0x00000990] */ 0xffffff20, 0xf06809e7, // brr.anyn -, r:uvloop_b +-/* [0x00000998] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 +-/* [0x000009a0] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop +-/* [0x000009a8] */ 0x009e7000, 0x100009e7, // nop ; nop +-/* [0x000009b0] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 +-/* [0x000009b8] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 +-/* [0x000009c0] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 +-/* [0x000009c8] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 +-/* [0x000009d0] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait +-/* [0x000009d8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 +-/* [0x000009e0] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 +-/* [0x000009e8] */ 0x0cc27380, 0x10020867, // add r1, r1, vpm +-/* [0x000009f0] */ 0x0c7a7380, 0x10020867, // add r1, r1, ra30 +-/* [0x000009f8] */ 0xfffffeb8, 0xf06809e7, // brr.anyn -, r:uvloop_b +-/* [0x00000a00] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 +-/* [0x00000a08] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 +-/* [0x00000a10] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 +-/* [0x00000a18] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 +-/* [0x00000a20] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 +-/* [0x00000a28] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif +-/* [0x00000a30] */ 0x00000010, 0xe0020827, // mov r0, 16 +-/* [0x00000a38] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait +-/* [0x00000a40] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 +-/* [0x00000a48] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 +-/* [0x00000a50] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 +-/* [0x00000a58] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif ++/* [0x000008b0] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 ++/* [0x000008b8] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 ++/* [0x000008c0] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 ++/* [0x000008c8] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch ++/* [0x000008d0] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 ++/* [0x000008d8] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 ++/* [0x000008e0] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 ++/* [0x000008e8] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 ++/* [0x000008f0] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 ++/* [0x000008f8] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 ++/* [0x00000900] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x00000908] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 ++/* [0x00000910] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 ++/* [0x00000918] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 ++/* [0x00000920] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 ++/* [0x00000928] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 ++/* [0x00000930] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 ++/* [0x00000938] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 ++/* [0x00000940] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 ++/* [0x00000948] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 ++/* [0x00000950] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 ++/* [0x00000958] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b ++/* [0x00000960] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 ++/* [0x00000968] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 ++/* [0x00000970] */ 0x159e7000, 0x100203e7, // mov ra15, r0 ++/* [0x00000978] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 ++/* [0x00000980] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 ++/* [0x00000988] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 ++/* [0x00000990] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 ++/* [0x00000998] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait ++/* [0x000009a0] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 ++/* [0x000009a8] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 ++/* [0x000009b0] */ 0x0cc27380, 0x10020867, // add r1, r1, vpm ++/* [0x000009b8] */ 0x0c7a7380, 0x10020867, // add r1, r1, ra30 ++/* [0x000009c0] */ 0xfffffed0, 0xf06809e7, // brr.anyn -, r:uvloop_b ++/* [0x000009c8] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 ++/* [0x000009d0] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 ++/* [0x000009d8] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 ++/* [0x000009e0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 ++/* [0x000009e8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 ++/* [0x000009f0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif ++/* [0x000009f8] */ 0x00000010, 0xe0020827, // mov r0, 16 ++/* [0x00000a00] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x00000a08] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 ++/* [0x00000a10] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 ++/* [0x00000a18] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 ++/* [0x00000a20] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif + // ::mc_exit +-/* [0x00000a60] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait +-/* [0x00000a68] */ 0x00000000, 0xe80009e7, // mov -,srel(0) +-/* [0x00000a70] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00000a28] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x00000a30] */ 0x00000000, 0xe80009e7, // mov -,srel(0) ++/* [0x00000a38] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00000a40] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00000a48] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00000a50] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00000a58] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend ++/* [0x00000a60] */ 0x009e7000, 0x100009e7, // nop ; nop ++/* [0x00000a68] */ 0x009e7000, 0x100009e7, // nop ; nop ++// ::mc_interrupt_exit8 ++/* [0x00000a70] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait + /* [0x00000a78] */ 0x009e7000, 0xa00009e7, // ldtmu0 + /* [0x00000a80] */ 0x009e7000, 0xa00009e7, // ldtmu0 + /* [0x00000a88] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00000a90] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend +-/* [0x00000a98] */ 0x009e7000, 0x100009e7, // nop ; nop +-/* [0x00000aa0] */ 0x009e7000, 0x100009e7, // nop ; nop +-// ::mc_interrupt_exit8 +-/* [0x00000aa8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait +-/* [0x00000ab0] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00000ab8] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00000ac0] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00000ac8] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00000ad0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00000ad8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00000ae0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00000ae8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00000af0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00000af8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00000b00] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00000b08] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend +-/* [0x00000b10] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop +-/* [0x00000b18] */ 0x009e7000, 0x100009e7, // nop ; nop ++/* [0x00000a90] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00000a98] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00000aa0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00000aa8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00000ab0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00000ab8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00000ac0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00000ac8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00000ad0] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend ++/* [0x00000ad8] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop ++/* [0x00000ae0] */ 0x009e7000, 0x100009e7, // nop ; nop + // ::mc_end + }; + #ifdef __HIGHC__ +diff --git a/libavcodec/rpi_shader.h b/libavcodec/rpi_shader.h +index 1fb3e37..3fac45f 100644 +--- a/libavcodec/rpi_shader.h ++++ b/libavcodec/rpi_shader.h +@@ -5,10 +5,10 @@ extern unsigned int rpi_shader[]; + + #define mc_setup_uv (rpi_shader + 0) + #define mc_filter_uv (rpi_shader + 152) +-#define mc_filter_uv_b0 (rpi_shader + 318) +-#define mc_filter_uv_b (rpi_shader + 484) +-#define mc_exit (rpi_shader + 664) +-#define mc_interrupt_exit8 (rpi_shader + 682) +-#define mc_end (rpi_shader + 712) ++#define mc_filter_uv_b0 (rpi_shader + 316) ++#define mc_filter_uv_b (rpi_shader + 476) ++#define mc_exit (rpi_shader + 650) ++#define mc_interrupt_exit8 (rpi_shader + 668) ++#define mc_end (rpi_shader + 698) + + #endif +diff --git a/libavcodec/rpi_shader.qasm b/libavcodec/rpi_shader.qasm +index 02e95dd..10f5113 100644 +--- a/libavcodec/rpi_shader.qasm ++++ b/libavcodec/rpi_shader.qasm +@@ -221,8 +221,6 @@ add r0, r0, r1 # Combine width and height of destination area + shl r0, r0, r2 # Shift into bits 16 upwards of the vdw_setup0 register + add rb26, r0, rb27 + +-sub.setf -,8,r1 # 8-r1, so if <0 (negative) we need to use the full code +- + # get filter coefficients + + mov r0, unif +@@ -410,20 +408,12 @@ add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 + nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 + add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 + nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 +-add r0, r2, r3 +- +-mov r3, rb31 +- +-mov ra12, ra13 +-mov ra13, ra14 +- +-sub.setf -, r3, 4 ; mov r1, ra22 +- +-# apply horizontal filter ++add r0, r2, r3 ; mov r3, rb31 ++sub.setf -, r3, 4 ; mov ra12, ra13 + brr.anyn -, r:uvloop_b0 +-mov ra14, ra15 ; mul24 r0, r0, r1 # last bit of context scroll +-asr ra15, r0, 8 ; nop # TODO isn't ra15 already in 24bit precision, may not need the sign extension here? +-nop ; nop # Delay slot 3 (TODO move more of the context scroll into here) ++mov ra13, ra14 # Delay slot 1 ++mov ra14, ra15 # Delay slot 2 ++mov ra15, r0 # Delay slot 3 + + # apply vertical filter and write to VPM + +@@ -432,9 +422,9 @@ nop ; mul24 r0, ra13, rb9 + add r1, r1, r0 ; mul24 r0, ra12, rb8 + add r1, r1, r0 ; mul24 r0, ra15, rb11 + add r1, r1, r0 ; mov -, vw_wait +-sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 ++sub.setf -, r3, rb18 + brr.anyn -, r:uvloop_b0 +-asr vpm, r1, 14 # Delay 1 shifts down by shift2=6, but results are still in 16bit precision TODO may be able to avoid the mul24 and use more delay slots ++asr vpm, r1, 6 # Delay 1 shifts down by shift2=6, but results are still in 16bit precision + nop # Delay 2 + nop # Delay 3 + +@@ -554,19 +544,12 @@ add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 + nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 + add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 + nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 +-add r0, r2, r3 +- +-mov r3, rb31 +- +-mov ra12, ra13 +-mov ra13, ra14 +- +-sub.setf -, r3, 4 ; mov r1, ra22 +-# apply horizontal filter ++add r0, r2, r3 ; mov r3, rb31 ++sub.setf -, r3, 4 ; mov ra12, ra13 + brr.anyn -, r:uvloop_b +-mov ra14, ra15 ; mul24 r0, r0, r1 # last bit of context scroll, including clamp to zero +-asr ra15, r0, 8 ; nop +-nop ; nop # TODO improve use of delay slots ++mov ra13, ra14 # Delay slot 1 ++mov ra14, ra15 # Delay slot 2 ++mov ra15, r0 # Delay slot 3 + + # apply vertical filter and write to VPM + +-- +2.5.0 + + +From 70bf426922557224722d0b6c3ca5d688b4e91f00 Mon Sep 17 00:00:00 2001 +From: Peter de Rivaz <peter.derivaz@gmail.com> +Date: Thu, 14 May 2015 11:31:23 +0100 +Subject: [PATCH 32/68] Avoid writeback of first B results + +--- + libavcodec/rpi_shader.c | 229 ++++++++++++++++++++++----------------------- + libavcodec/rpi_shader.h | 8 +- + libavcodec/rpi_shader.qasm | 18 +--- + 3 files changed, 121 insertions(+), 134 deletions(-) + +diff --git a/libavcodec/rpi_shader.c b/libavcodec/rpi_shader.c +index c498f28..ba453a2 100644 +--- a/libavcodec/rpi_shader.c ++++ b/libavcodec/rpi_shader.c +@@ -255,130 +255,125 @@ unsigned int rpi_shader[] = { + /* [0x00000710] */ 0x0f9c63c0, 0xd0020c27, // asr vpm, r1, 6 + /* [0x00000718] */ 0x009e7000, 0x100009e7, // nop + /* [0x00000720] */ 0x009e7000, 0x100009e7, // nop +-/* [0x00000728] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 +-/* [0x00000730] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 +-/* [0x00000738] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif +-/* [0x00000740] */ 0x00000010, 0xe0020827, // mov r0, 16 +-/* [0x00000748] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait +-/* [0x00000750] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 +-/* [0x00000758] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 +-/* [0x00000760] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 +-/* [0x00000768] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif ++/* [0x00000728] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 ++/* [0x00000730] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000738] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000740] */ 0x009e7000, 0x100009e7, // nop + // ::mc_filter_uv_b +-/* [0x00000770] */ 0x15827d80, 0x100207e7, // mov ra31, unif +-/* [0x00000778] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next +-/* [0x00000780] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num +-/* [0x00000788] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif +-/* [0x00000790] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif +-/* [0x00000798] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 +-/* [0x000007a0] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 +-/* [0x000007a8] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 +-/* [0x000007b0] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 +-/* [0x000007b8] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 +-/* [0x000007c0] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 +-/* [0x000007c8] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 +-/* [0x000007d0] */ 0x00000010, 0xe00208a7, // mov r2, 16 +-/* [0x000007d8] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x000007e0] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 +-/* [0x000007e8] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 +-/* [0x000007f0] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 +-/* [0x000007f8] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 +-/* [0x00000800] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 +-/* [0x00000808] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 +-/* [0x00000810] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 +-/* [0x00000818] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 +-/* [0x00000820] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 +-/* [0x00000828] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 +-/* [0x00000830] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 +-/* [0x00000838] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 +-/* [0x00000840] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 ++/* [0x00000748] */ 0x15827d80, 0x100207e7, // mov ra31, unif ++/* [0x00000750] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next ++/* [0x00000758] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num ++/* [0x00000760] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif ++/* [0x00000768] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif ++/* [0x00000770] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 ++/* [0x00000778] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 ++/* [0x00000780] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 ++/* [0x00000788] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 ++/* [0x00000790] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 ++/* [0x00000798] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 ++/* [0x000007a0] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 ++/* [0x000007a8] */ 0x00000010, 0xe00208a7, // mov r2, 16 ++/* [0x000007b0] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x000007b8] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 ++/* [0x000007c0] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 ++/* [0x000007c8] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 ++/* [0x000007d0] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 ++/* [0x000007d8] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 ++/* [0x000007e0] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 ++/* [0x000007e8] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 ++/* [0x000007f0] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 ++/* [0x000007f8] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 ++/* [0x00000800] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 ++/* [0x00000808] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 ++/* [0x00000810] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 ++/* [0x00000818] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 ++/* [0x00000820] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000828] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000830] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000838] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000840] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif + /* [0x00000848] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000850] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000858] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000860] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000868] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif +-/* [0x00000870] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000878] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000880] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000888] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000890] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif +-/* [0x00000898] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 +-/* [0x000008a0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-/* [0x000008a8] */ 0x00000000, 0xe00208e7, // mov r3, 0 ++/* [0x00000850] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000858] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000860] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000868] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif ++/* [0x00000870] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 ++/* [0x00000878] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x00000880] */ 0x00000000, 0xe00208e7, // mov r3, 0 + // :uvloop_b +-/* [0x000008b0] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 +-/* [0x000008b8] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 +-/* [0x000008c0] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 +-/* [0x000008c8] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch +-/* [0x000008d0] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 +-/* [0x000008d8] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 +-/* [0x000008e0] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 +-/* [0x000008e8] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 +-/* [0x000008f0] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 +-/* [0x000008f8] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 +-/* [0x00000900] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-/* [0x00000908] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 +-/* [0x00000910] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 +-/* [0x00000918] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 +-/* [0x00000920] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 +-/* [0x00000928] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 +-/* [0x00000930] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 +-/* [0x00000938] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 +-/* [0x00000940] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 +-/* [0x00000948] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 +-/* [0x00000950] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 +-/* [0x00000958] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b +-/* [0x00000960] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 +-/* [0x00000968] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 +-/* [0x00000970] */ 0x159e7000, 0x100203e7, // mov ra15, r0 +-/* [0x00000978] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 +-/* [0x00000980] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 +-/* [0x00000988] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 +-/* [0x00000990] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 +-/* [0x00000998] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait +-/* [0x000009a0] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 +-/* [0x000009a8] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 +-/* [0x000009b0] */ 0x0cc27380, 0x10020867, // add r1, r1, vpm +-/* [0x000009b8] */ 0x0c7a7380, 0x10020867, // add r1, r1, ra30 +-/* [0x000009c0] */ 0xfffffed0, 0xf06809e7, // brr.anyn -, r:uvloop_b +-/* [0x000009c8] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 +-/* [0x000009d0] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 +-/* [0x000009d8] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 +-/* [0x000009e0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 +-/* [0x000009e8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 +-/* [0x000009f0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif +-/* [0x000009f8] */ 0x00000010, 0xe0020827, // mov r0, 16 +-/* [0x00000a00] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait +-/* [0x00000a08] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 +-/* [0x00000a10] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 +-/* [0x00000a18] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 +-/* [0x00000a20] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif ++/* [0x00000888] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 ++/* [0x00000890] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 ++/* [0x00000898] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 ++/* [0x000008a0] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch ++/* [0x000008a8] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 ++/* [0x000008b0] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 ++/* [0x000008b8] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 ++/* [0x000008c0] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 ++/* [0x000008c8] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 ++/* [0x000008d0] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 ++/* [0x000008d8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x000008e0] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 ++/* [0x000008e8] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 ++/* [0x000008f0] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 ++/* [0x000008f8] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 ++/* [0x00000900] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 ++/* [0x00000908] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 ++/* [0x00000910] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 ++/* [0x00000918] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 ++/* [0x00000920] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 ++/* [0x00000928] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 ++/* [0x00000930] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b ++/* [0x00000938] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 ++/* [0x00000940] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 ++/* [0x00000948] */ 0x159e7000, 0x100203e7, // mov ra15, r0 ++/* [0x00000950] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 ++/* [0x00000958] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 ++/* [0x00000960] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 ++/* [0x00000968] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 ++/* [0x00000970] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait ++/* [0x00000978] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 ++/* [0x00000980] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 ++/* [0x00000988] */ 0x0cc27380, 0x10020867, // add r1, r1, vpm ++/* [0x00000990] */ 0x0c7a7380, 0x10020867, // add r1, r1, ra30 ++/* [0x00000998] */ 0xfffffed0, 0xf06809e7, // brr.anyn -, r:uvloop_b ++/* [0x000009a0] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 ++/* [0x000009a8] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 ++/* [0x000009b0] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 ++/* [0x000009b8] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 ++/* [0x000009c0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 ++/* [0x000009c8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif ++/* [0x000009d0] */ 0x00000010, 0xe0020827, // mov r0, 16 ++/* [0x000009d8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x000009e0] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 ++/* [0x000009e8] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 ++/* [0x000009f0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 ++/* [0x000009f8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif + // ::mc_exit +-/* [0x00000a28] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait +-/* [0x00000a30] */ 0x00000000, 0xe80009e7, // mov -,srel(0) +-/* [0x00000a38] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00000a40] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00000a48] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00000a50] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00000a58] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend +-/* [0x00000a60] */ 0x009e7000, 0x100009e7, // nop ; nop +-/* [0x00000a68] */ 0x009e7000, 0x100009e7, // nop ; nop ++/* [0x00000a00] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x00000a08] */ 0x00000000, 0xe80009e7, // mov -,srel(0) ++/* [0x00000a10] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00000a18] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00000a20] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00000a28] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00000a30] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend ++/* [0x00000a38] */ 0x009e7000, 0x100009e7, // nop ; nop ++/* [0x00000a40] */ 0x009e7000, 0x100009e7, // nop ; nop + // ::mc_interrupt_exit8 +-/* [0x00000a70] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait +-/* [0x00000a78] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00000a80] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00000a88] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00000a90] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00000a48] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x00000a50] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00000a58] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00000a60] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00000a68] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00000a70] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00000a78] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00000a80] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00000a88] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00000a90] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) + /* [0x00000a98] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) + /* [0x00000aa0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00000aa8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00000ab0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00000ab8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00000ac0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00000ac8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00000ad0] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend +-/* [0x00000ad8] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop +-/* [0x00000ae0] */ 0x009e7000, 0x100009e7, // nop ; nop ++/* [0x00000aa8] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend ++/* [0x00000ab0] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop ++/* [0x00000ab8] */ 0x009e7000, 0x100009e7, // nop ; nop + // ::mc_end + }; + #ifdef __HIGHC__ +diff --git a/libavcodec/rpi_shader.h b/libavcodec/rpi_shader.h +index 3fac45f..45dbe0e 100644 +--- a/libavcodec/rpi_shader.h ++++ b/libavcodec/rpi_shader.h +@@ -6,9 +6,9 @@ extern unsigned int rpi_shader[]; + #define mc_setup_uv (rpi_shader + 0) + #define mc_filter_uv (rpi_shader + 152) + #define mc_filter_uv_b0 (rpi_shader + 316) +-#define mc_filter_uv_b (rpi_shader + 476) +-#define mc_exit (rpi_shader + 650) +-#define mc_interrupt_exit8 (rpi_shader + 668) +-#define mc_end (rpi_shader + 698) ++#define mc_filter_uv_b (rpi_shader + 466) ++#define mc_exit (rpi_shader + 640) ++#define mc_interrupt_exit8 (rpi_shader + 658) ++#define mc_end (rpi_shader + 688) + + #endif +diff --git a/libavcodec/rpi_shader.qasm b/libavcodec/rpi_shader.qasm +index 10f5113..e138c95 100644 +--- a/libavcodec/rpi_shader.qasm ++++ b/libavcodec/rpi_shader.qasm +@@ -428,22 +428,14 @@ asr vpm, r1, 6 # Delay 1 shifts down by shift2=6, but results are still + nop # Delay 2 + nop # Delay 3 + ++# in pass0 we don't really need to save any results, but need to discard the uniforms + # DMA out for U + +-mov vw_setup, rb26 # VDW setup 0 +-mov vw_setup, rb29 # Stride +-mov vw_addr, unif # start the VDW # TODO in pass0 we don't need to save any results +- +-# DMA out for V +-# We need to wait for the U to complete first, but have nothing useful to compute while we wait. +-# Could potentially push this write into the start of the next pipeline stage. +-mov r0, 16 +-mov -, vw_wait +- + bra -, ra31 +-add vw_setup, rb26, r0 # VDW setup 0 +-mov vw_setup, rb29 # Stride +-mov vw_addr, unif # start the VDW ++mov r0, unif # Delay 1 ++mov r0, unif # Delay 2 ++nop # Delay 3 ++ + + ################################################################################ + +-- +2.5.0 + + +From fb7061693c79444c178f700799776ffd736f3561 Mon Sep 17 00:00:00 2001 +From: Peter de Rivaz <peter.derivaz@gmail.com> +Date: Thu, 14 May 2015 11:36:24 +0100 +Subject: [PATCH 33/68] Cutdown size of chroma prediction commands + +--- + libavcodec/hevc.c | 17 +- + libavcodec/rpi_shader.c | 543 ++++++++++++++++++++++----------------------- + libavcodec/rpi_shader.h | 12 +- + libavcodec/rpi_shader.qasm | 11 +- + 4 files changed, 281 insertions(+), 302 deletions(-) + +diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c +index 8984585..c65af74 100644 +--- a/libavcodec/hevc.c ++++ b/libavcodec/hevc.c +@@ -56,7 +56,7 @@ const uint8_t ff_hevc_pel_weight[65] = { [2] = 0, [4] = 1, [6] = 2, [8] = 3, [12 + + #ifdef RPI_INTER_QPU + +-#define RPI_CHROMA_COMMAND_WORDS 12 ++#define RPI_CHROMA_COMMAND_WORDS 10 + #define UV_COMMANDS_PER_QPU ((1 + (256*64*2)/(4*4)) * RPI_CHROMA_COMMAND_WORDS) + // The QPU code for UV blocks only works up to a block width of 8 + #define RPI_CHROMA_BLOCK_WIDTH 8 +@@ -2021,11 +2021,8 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, + u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[1]); + u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[2]); + *u++ = ( (nPbW_c<RPI_CHROMA_BLOCK_WIDTH ? nPbW_c : RPI_CHROMA_BLOCK_WIDTH) << 16 ) + (nPbH_c<16 ? nPbH_c : 16); +- // TODO chroma weight and offset... s->sh.chroma_weight_l0[current_mv.ref_idx[0]][0], s->sh.chroma_offset_l0[current_mv.ref_idx[0]][0] + *u++ = rpi_filter_coefs[_mx][0]; +- u++; + *u++ = rpi_filter_coefs[_my][0]; +- u++; + *u++ = (get_vc_address(s->frame->buf[1]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[1]); + *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); + } +@@ -2080,9 +2077,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, + *u++ = ( (nPbW_c<RPI_CHROMA_BLOCK_WIDTH ? nPbW_c : RPI_CHROMA_BLOCK_WIDTH) << 16 ) + (nPbH_c<16 ? nPbH_c : 16); + // TODO chroma weight and offset... s->sh.chroma_weight_l0[current_mv.ref_idx[0]][0], s->sh.chroma_offset_l0[current_mv.ref_idx[0]][0] + *u++ = rpi_filter_coefs[_mx][0]; +- u++; + *u++ = rpi_filter_coefs[_my][0]; +- u++; + *u++ = (get_vc_address(s->frame->buf[1]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[1]); + *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); + } +@@ -2143,11 +2138,8 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, + u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[2]); + *u++ = ( (nPbW_c<RPI_CHROMA_BLOCK_WIDTH ? nPbW_c : RPI_CHROMA_BLOCK_WIDTH) << 16 ) + (nPbH_c<16 ? nPbH_c : 16); + *u++ = rpi_filter_coefs[_mx][0]; +- u++; + *u++ = rpi_filter_coefs[_my][0]; +- u++; +- *u++ = (get_vc_address(s->frame->buf[1]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[1]); // TODO this will become unused once we have a dedicated pass0 filter +- *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); ++ u+=2; // Intermediate results are not written back in first pass of B filtering + + u++[-RPI_CHROMA_COMMAND_WORDS] = s->mc_filter_uv_b; + u++[-RPI_CHROMA_COMMAND_WORDS] = x2_c - 1 + start_x; +@@ -2155,11 +2147,8 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, + u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[1]); + u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[2]); + *u++ = ( (nPbW_c<RPI_CHROMA_BLOCK_WIDTH ? nPbW_c : RPI_CHROMA_BLOCK_WIDTH) << 16 ) + (nPbH_c<16 ? nPbH_c : 16); +- // TODO chroma weight and offset... s->sh.chroma_weight_l0[current_mv.ref_idx[0]][0], s->sh.chroma_offset_l0[current_mv.ref_idx[0]][0] + *u++ = rpi_filter_coefs[_mx2][0]; +- u++; + *u++ = rpi_filter_coefs[_my2][0]; +- u++; + *u++ = (get_vc_address(s->frame->buf[1]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[1]); + *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); + } +@@ -2797,7 +2786,7 @@ static void rpi_inter_clear(HEVCContext *s) + *s->u_mvs[i]++ = pic_height; + *s->u_mvs[i]++ = s->frame->linesize[1]; + *s->u_mvs[i]++ = s->frame->linesize[2]; +- s->u_mvs[i] += 3; // Padding words ++ s->u_mvs[i] += 1; // Padding words + } + } + +diff --git a/libavcodec/rpi_shader.c b/libavcodec/rpi_shader.c +index ba453a2..b0b93b5 100644 +--- a/libavcodec/rpi_shader.c ++++ b/libavcodec/rpi_shader.c +@@ -89,291 +89,286 @@ unsigned int rpi_shader[] = { + /* [0x00000200] */ 0x8c9e7052, 0x10025e18, // add t0s, r0, r1 ; mov ra_x2_base, r2 + /* [0x00000208] */ 0x0c9e7440, 0x10020e27, // add t0s, r2, r1 + /* [0x00000210] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000218] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000220] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000228] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 +-/* [0x00000230] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 +-/* [0x00000238] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 +-/* [0x00000240] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 +-/* [0x00000248] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch +-/* [0x00000250] */ 0x0c427380, 0x10020e27, // add t0s, r1, ra_x_base +-/* [0x00000258] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_x2_base ++/* [0x00000218] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 ++/* [0x00000220] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 ++/* [0x00000228] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 ++/* [0x00000230] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 ++/* [0x00000238] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch ++/* [0x00000240] */ 0x0c427380, 0x10020e27, // add t0s, r1, ra_x_base ++/* [0x00000248] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_x2_base + // ::mc_filter_uv +-/* [0x00000260] */ 0x15827d80, 0x100207e7, // mov ra31, unif +-/* [0x00000268] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next +-/* [0x00000270] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num +-/* [0x00000278] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif +-/* [0x00000280] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif +-/* [0x00000288] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 +-/* [0x00000290] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 +-/* [0x00000298] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 +-/* [0x000002a0] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 +-/* [0x000002a8] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 +-/* [0x000002b0] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 +-/* [0x000002b8] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 +-/* [0x000002c0] */ 0x00000010, 0xe00208a7, // mov r2, 16 +-/* [0x000002c8] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x000002d0] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 +-/* [0x000002d8] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 +-/* [0x000002e0] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 +-/* [0x000002e8] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 +-/* [0x000002f0] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 +-/* [0x000002f8] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 +-/* [0x00000300] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 +-/* [0x00000308] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 +-/* [0x00000310] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 +-/* [0x00000318] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000320] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000328] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000330] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000338] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif +-/* [0x00000340] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000348] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000350] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000358] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000360] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif +-/* [0x00000368] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 +-/* [0x00000370] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-/* [0x00000378] */ 0x00000000, 0xe00208e7, // mov r3, 0 ++/* [0x00000250] */ 0x15827d80, 0x100207e7, // mov ra31, unif ++/* [0x00000258] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next ++/* [0x00000260] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num ++/* [0x00000268] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif ++/* [0x00000270] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif ++/* [0x00000278] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 ++/* [0x00000280] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 ++/* [0x00000288] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 ++/* [0x00000290] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 ++/* [0x00000298] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 ++/* [0x000002a0] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 ++/* [0x000002a8] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 ++/* [0x000002b0] */ 0x00000010, 0xe00208a7, // mov r2, 16 ++/* [0x000002b8] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x000002c0] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 ++/* [0x000002c8] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 ++/* [0x000002d0] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 ++/* [0x000002d8] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 ++/* [0x000002e0] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 ++/* [0x000002e8] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 ++/* [0x000002f0] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 ++/* [0x000002f8] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 ++/* [0x00000300] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 ++/* [0x00000308] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000310] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000318] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000320] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000328] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif ++/* [0x00000330] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000338] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000340] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000348] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 ++/* [0x00000350] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 ++/* [0x00000358] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x00000360] */ 0x00000000, 0xe00208e7, // mov r3, 0 + // :uvloop +-/* [0x00000380] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 +-/* [0x00000388] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 +-/* [0x00000390] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 +-/* [0x00000398] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch +-/* [0x000003a0] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 +-/* [0x000003a8] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 +-/* [0x000003b0] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 +-/* [0x000003b8] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 +-/* [0x000003c0] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 +-/* [0x000003c8] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 +-/* [0x000003d0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-/* [0x000003d8] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 +-/* [0x000003e0] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 +-/* [0x000003e8] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 +-/* [0x000003f0] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 +-/* [0x000003f8] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 +-/* [0x00000400] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 +-/* [0x00000408] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 +-/* [0x00000410] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 +-/* [0x00000418] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 +-/* [0x00000420] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 +-/* [0x00000428] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop +-/* [0x00000430] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 +-/* [0x00000438] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 +-/* [0x00000440] */ 0x159e7000, 0x100203e7, // mov ra15, r0 +-/* [0x00000448] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 +-/* [0x00000450] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 +-/* [0x00000458] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 +-/* [0x00000460] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 +-/* [0x00000468] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait +-/* [0x00000470] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 +-/* [0x00000478] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 +-/* [0x00000480] */ 0x0c567380, 0x10020867, // add r1, r1, ra21 +-/* [0x00000488] */ 0xfffffed8, 0xf06809e7, // brr.anyn -, r:uvloop +-/* [0x00000490] */ 0x0f9c63c0, 0xd0020867, // asr r1, r1, 6 +-/* [0x00000498] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 +-/* [0x000004a0] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 +-/* [0x000004a8] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 +-/* [0x000004b0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 +-/* [0x000004b8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif +-/* [0x000004c0] */ 0x00000010, 0xe0020827, // mov r0, 16 +-/* [0x000004c8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait +-/* [0x000004d0] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 +-/* [0x000004d8] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 +-/* [0x000004e0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 +-/* [0x000004e8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif ++/* [0x00000368] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 ++/* [0x00000370] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 ++/* [0x00000378] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 ++/* [0x00000380] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch ++/* [0x00000388] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 ++/* [0x00000390] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 ++/* [0x00000398] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 ++/* [0x000003a0] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 ++/* [0x000003a8] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 ++/* [0x000003b0] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 ++/* [0x000003b8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x000003c0] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 ++/* [0x000003c8] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 ++/* [0x000003d0] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 ++/* [0x000003d8] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 ++/* [0x000003e0] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 ++/* [0x000003e8] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 ++/* [0x000003f0] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 ++/* [0x000003f8] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 ++/* [0x00000400] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 ++/* [0x00000408] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 ++/* [0x00000410] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop ++/* [0x00000418] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 ++/* [0x00000420] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 ++/* [0x00000428] */ 0x159e7000, 0x100203e7, // mov ra15, r0 ++/* [0x00000430] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 ++/* [0x00000438] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 ++/* [0x00000440] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 ++/* [0x00000448] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 ++/* [0x00000450] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait ++/* [0x00000458] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 ++/* [0x00000460] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 ++/* [0x00000468] */ 0x0c567380, 0x10020867, // add r1, r1, ra21 ++/* [0x00000470] */ 0xfffffed8, 0xf06809e7, // brr.anyn -, r:uvloop ++/* [0x00000478] */ 0x0f9c63c0, 0xd0020867, // asr r1, r1, 6 ++/* [0x00000480] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 ++/* [0x00000488] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 ++/* [0x00000490] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 ++/* [0x00000498] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 ++/* [0x000004a0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif ++/* [0x000004a8] */ 0x00000010, 0xe0020827, // mov r0, 16 ++/* [0x000004b0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x000004b8] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 ++/* [0x000004c0] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 ++/* [0x000004c8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 ++/* [0x000004d0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif + // ::mc_filter_uv_b0 +-/* [0x000004f0] */ 0x15827d80, 0x100207e7, // mov ra31, unif +-/* [0x000004f8] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next +-/* [0x00000500] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num +-/* [0x00000508] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif +-/* [0x00000510] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif +-/* [0x00000518] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 +-/* [0x00000520] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 +-/* [0x00000528] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 +-/* [0x00000530] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 +-/* [0x00000538] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 +-/* [0x00000540] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 +-/* [0x00000548] */ 0x159d5fc0, 0x10021c67, // mov vw_setup, rb21 +-/* [0x00000550] */ 0x00000010, 0xe00208a7, // mov r2, 16 +-/* [0x00000558] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000560] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 +-/* [0x00000568] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 +-/* [0x00000570] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 +-/* [0x00000578] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 +-/* [0x00000580] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 +-/* [0x00000588] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 +-/* [0x00000590] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 +-/* [0x00000598] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 +-/* [0x000005a0] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 +-/* [0x000005a8] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x000005b0] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000005b8] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000005c0] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000005c8] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif +-/* [0x000005d0] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x000005d8] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000005e0] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000005e8] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000005f0] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif +-/* [0x000005f8] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 +-/* [0x00000600] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-/* [0x00000608] */ 0x00000000, 0xe00208e7, // mov r3, 0 ++/* [0x000004d8] */ 0x15827d80, 0x100207e7, // mov ra31, unif ++/* [0x000004e0] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next ++/* [0x000004e8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num ++/* [0x000004f0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif ++/* [0x000004f8] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif ++/* [0x00000500] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 ++/* [0x00000508] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 ++/* [0x00000510] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 ++/* [0x00000518] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 ++/* [0x00000520] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 ++/* [0x00000528] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 ++/* [0x00000530] */ 0x159d5fc0, 0x10021c67, // mov vw_setup, rb21 ++/* [0x00000538] */ 0x00000010, 0xe00208a7, // mov r2, 16 ++/* [0x00000540] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000548] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 ++/* [0x00000550] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 ++/* [0x00000558] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 ++/* [0x00000560] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 ++/* [0x00000568] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 ++/* [0x00000570] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 ++/* [0x00000578] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 ++/* [0x00000580] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 ++/* [0x00000588] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 ++/* [0x00000590] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000598] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000005a0] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000005a8] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000005b0] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif ++/* [0x000005b8] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000005c0] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000005c8] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000005d0] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 ++/* [0x000005d8] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 ++/* [0x000005e0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x000005e8] */ 0x00000000, 0xe00208e7, // mov r3, 0 + // :uvloop_b0 +-/* [0x00000610] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 +-/* [0x00000618] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 +-/* [0x00000620] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 +-/* [0x00000628] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch +-/* [0x00000630] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 +-/* [0x00000638] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 +-/* [0x00000640] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 +-/* [0x00000648] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 +-/* [0x00000650] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 +-/* [0x00000658] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 +-/* [0x00000660] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-/* [0x00000668] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 +-/* [0x00000670] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 +-/* [0x00000678] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 +-/* [0x00000680] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 +-/* [0x00000688] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 +-/* [0x00000690] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 +-/* [0x00000698] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 +-/* [0x000006a0] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 +-/* [0x000006a8] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 +-/* [0x000006b0] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 +-/* [0x000006b8] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b0 +-/* [0x000006c0] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 +-/* [0x000006c8] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 +-/* [0x000006d0] */ 0x159e7000, 0x100203e7, // mov ra15, r0 +-/* [0x000006d8] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 +-/* [0x000006e0] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 +-/* [0x000006e8] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 +-/* [0x000006f0] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 +-/* [0x000006f8] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait +-/* [0x00000700] */ 0x0d9d27c0, 0x100229e7, // sub.setf -, r3, rb18 +-/* [0x00000708] */ 0xfffffee8, 0xf06809e7, // brr.anyn -, r:uvloop_b0 +-/* [0x00000710] */ 0x0f9c63c0, 0xd0020c27, // asr vpm, r1, 6 +-/* [0x00000718] */ 0x009e7000, 0x100009e7, // nop ++/* [0x000005f0] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 ++/* [0x000005f8] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 ++/* [0x00000600] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 ++/* [0x00000608] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch ++/* [0x00000610] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 ++/* [0x00000618] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 ++/* [0x00000620] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 ++/* [0x00000628] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 ++/* [0x00000630] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 ++/* [0x00000638] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 ++/* [0x00000640] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x00000648] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 ++/* [0x00000650] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 ++/* [0x00000658] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 ++/* [0x00000660] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 ++/* [0x00000668] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 ++/* [0x00000670] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 ++/* [0x00000678] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 ++/* [0x00000680] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 ++/* [0x00000688] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 ++/* [0x00000690] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 ++/* [0x00000698] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b0 ++/* [0x000006a0] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 ++/* [0x000006a8] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 ++/* [0x000006b0] */ 0x159e7000, 0x100203e7, // mov ra15, r0 ++/* [0x000006b8] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 ++/* [0x000006c0] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 ++/* [0x000006c8] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 ++/* [0x000006d0] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 ++/* [0x000006d8] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait ++/* [0x000006e0] */ 0x0d9d27c0, 0x100229e7, // sub.setf -, r3, rb18 ++/* [0x000006e8] */ 0xfffffee8, 0xf06809e7, // brr.anyn -, r:uvloop_b0 ++/* [0x000006f0] */ 0x0f9c63c0, 0xd0020c27, // asr vpm, r1, 6 ++/* [0x000006f8] */ 0x009e7000, 0x100009e7, // nop ++/* [0x00000700] */ 0x009e7000, 0x100009e7, // nop ++/* [0x00000708] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 ++/* [0x00000710] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000718] */ 0x15827d80, 0x10020827, // mov r0, unif + /* [0x00000720] */ 0x009e7000, 0x100009e7, // nop +-/* [0x00000728] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 +-/* [0x00000730] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000738] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000740] */ 0x009e7000, 0x100009e7, // nop + // ::mc_filter_uv_b +-/* [0x00000748] */ 0x15827d80, 0x100207e7, // mov ra31, unif +-/* [0x00000750] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next +-/* [0x00000758] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num +-/* [0x00000760] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif +-/* [0x00000768] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif +-/* [0x00000770] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 +-/* [0x00000778] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 +-/* [0x00000780] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 +-/* [0x00000788] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 +-/* [0x00000790] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 +-/* [0x00000798] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 +-/* [0x000007a0] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 +-/* [0x000007a8] */ 0x00000010, 0xe00208a7, // mov r2, 16 +-/* [0x000007b0] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x000007b8] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 +-/* [0x000007c0] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 +-/* [0x000007c8] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 +-/* [0x000007d0] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 +-/* [0x000007d8] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 +-/* [0x000007e0] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 +-/* [0x000007e8] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 +-/* [0x000007f0] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 +-/* [0x000007f8] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 +-/* [0x00000800] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 +-/* [0x00000808] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 +-/* [0x00000810] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 +-/* [0x00000818] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 +-/* [0x00000820] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000828] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000830] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000838] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000840] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif +-/* [0x00000848] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000850] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000858] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000860] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000868] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif +-/* [0x00000870] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 +-/* [0x00000878] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-/* [0x00000880] */ 0x00000000, 0xe00208e7, // mov r3, 0 ++/* [0x00000728] */ 0x15827d80, 0x100207e7, // mov ra31, unif ++/* [0x00000730] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next ++/* [0x00000738] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num ++/* [0x00000740] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif ++/* [0x00000748] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif ++/* [0x00000750] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 ++/* [0x00000758] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 ++/* [0x00000760] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 ++/* [0x00000768] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 ++/* [0x00000770] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 ++/* [0x00000778] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 ++/* [0x00000780] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 ++/* [0x00000788] */ 0x00000010, 0xe00208a7, // mov r2, 16 ++/* [0x00000790] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000798] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 ++/* [0x000007a0] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 ++/* [0x000007a8] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 ++/* [0x000007b0] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 ++/* [0x000007b8] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 ++/* [0x000007c0] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 ++/* [0x000007c8] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 ++/* [0x000007d0] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 ++/* [0x000007d8] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 ++/* [0x000007e0] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 ++/* [0x000007e8] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 ++/* [0x000007f0] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 ++/* [0x000007f8] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 ++/* [0x00000800] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000808] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000810] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000818] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000820] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif ++/* [0x00000828] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000830] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000838] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000840] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 ++/* [0x00000848] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 ++/* [0x00000850] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x00000858] */ 0x00000000, 0xe00208e7, // mov r3, 0 + // :uvloop_b +-/* [0x00000888] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 +-/* [0x00000890] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 +-/* [0x00000898] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 +-/* [0x000008a0] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch +-/* [0x000008a8] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 +-/* [0x000008b0] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 +-/* [0x000008b8] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 +-/* [0x000008c0] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 +-/* [0x000008c8] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 +-/* [0x000008d0] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 +-/* [0x000008d8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-/* [0x000008e0] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 +-/* [0x000008e8] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 +-/* [0x000008f0] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 +-/* [0x000008f8] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 +-/* [0x00000900] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 +-/* [0x00000908] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 +-/* [0x00000910] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 +-/* [0x00000918] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 +-/* [0x00000920] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 +-/* [0x00000928] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 +-/* [0x00000930] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b +-/* [0x00000938] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 +-/* [0x00000940] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 +-/* [0x00000948] */ 0x159e7000, 0x100203e7, // mov ra15, r0 +-/* [0x00000950] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 +-/* [0x00000958] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 +-/* [0x00000960] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 +-/* [0x00000968] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 +-/* [0x00000970] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait +-/* [0x00000978] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 +-/* [0x00000980] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 +-/* [0x00000988] */ 0x0cc27380, 0x10020867, // add r1, r1, vpm +-/* [0x00000990] */ 0x0c7a7380, 0x10020867, // add r1, r1, ra30 +-/* [0x00000998] */ 0xfffffed0, 0xf06809e7, // brr.anyn -, r:uvloop_b +-/* [0x000009a0] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 +-/* [0x000009a8] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 +-/* [0x000009b0] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 +-/* [0x000009b8] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 +-/* [0x000009c0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 +-/* [0x000009c8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif +-/* [0x000009d0] */ 0x00000010, 0xe0020827, // mov r0, 16 +-/* [0x000009d8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait +-/* [0x000009e0] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 +-/* [0x000009e8] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 +-/* [0x000009f0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 +-/* [0x000009f8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif ++/* [0x00000860] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 ++/* [0x00000868] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 ++/* [0x00000870] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 ++/* [0x00000878] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch ++/* [0x00000880] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 ++/* [0x00000888] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 ++/* [0x00000890] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 ++/* [0x00000898] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 ++/* [0x000008a0] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 ++/* [0x000008a8] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 ++/* [0x000008b0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x000008b8] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 ++/* [0x000008c0] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 ++/* [0x000008c8] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 ++/* [0x000008d0] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 ++/* [0x000008d8] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 ++/* [0x000008e0] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 ++/* [0x000008e8] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 ++/* [0x000008f0] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 ++/* [0x000008f8] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 ++/* [0x00000900] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 ++/* [0x00000908] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b ++/* [0x00000910] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 ++/* [0x00000918] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 ++/* [0x00000920] */ 0x159e7000, 0x100203e7, // mov ra15, r0 ++/* [0x00000928] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 ++/* [0x00000930] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 ++/* [0x00000938] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 ++/* [0x00000940] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 ++/* [0x00000948] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait ++/* [0x00000950] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 ++/* [0x00000958] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 ++/* [0x00000960] */ 0x0cc27380, 0x10020867, // add r1, r1, vpm ++/* [0x00000968] */ 0x0c7a7380, 0x10020867, // add r1, r1, ra30 ++/* [0x00000970] */ 0xfffffed0, 0xf06809e7, // brr.anyn -, r:uvloop_b ++/* [0x00000978] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 ++/* [0x00000980] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 ++/* [0x00000988] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 ++/* [0x00000990] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 ++/* [0x00000998] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 ++/* [0x000009a0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif ++/* [0x000009a8] */ 0x00000010, 0xe0020827, // mov r0, 16 ++/* [0x000009b0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x000009b8] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 ++/* [0x000009c0] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 ++/* [0x000009c8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 ++/* [0x000009d0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif + // ::mc_exit +-/* [0x00000a00] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait +-/* [0x00000a08] */ 0x00000000, 0xe80009e7, // mov -,srel(0) +-/* [0x00000a10] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00000a18] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00000a20] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00000a28] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00000a30] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend +-/* [0x00000a38] */ 0x009e7000, 0x100009e7, // nop ; nop +-/* [0x00000a40] */ 0x009e7000, 0x100009e7, // nop ; nop ++/* [0x000009d8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x000009e0] */ 0x00000000, 0xe80009e7, // mov -,srel(0) ++/* [0x000009e8] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x000009f0] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x000009f8] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00000a00] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00000a08] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend ++/* [0x00000a10] */ 0x009e7000, 0x100009e7, // nop ; nop ++/* [0x00000a18] */ 0x009e7000, 0x100009e7, // nop ; nop + // ::mc_interrupt_exit8 +-/* [0x00000a48] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait +-/* [0x00000a50] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00000a58] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00000a60] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00000a68] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00000a20] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x00000a28] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00000a30] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00000a38] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00000a40] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00000a48] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00000a50] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00000a58] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00000a60] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00000a68] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) + /* [0x00000a70] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) + /* [0x00000a78] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00000a80] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00000a88] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00000a90] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00000a98] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00000aa0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00000aa8] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend +-/* [0x00000ab0] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop +-/* [0x00000ab8] */ 0x009e7000, 0x100009e7, // nop ; nop ++/* [0x00000a80] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend ++/* [0x00000a88] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop ++/* [0x00000a90] */ 0x009e7000, 0x100009e7, // nop ; nop + // ::mc_end + }; + #ifdef __HIGHC__ +diff --git a/libavcodec/rpi_shader.h b/libavcodec/rpi_shader.h +index 45dbe0e..99927c4 100644 +--- a/libavcodec/rpi_shader.h ++++ b/libavcodec/rpi_shader.h +@@ -4,11 +4,11 @@ + extern unsigned int rpi_shader[]; + + #define mc_setup_uv (rpi_shader + 0) +-#define mc_filter_uv (rpi_shader + 152) +-#define mc_filter_uv_b0 (rpi_shader + 316) +-#define mc_filter_uv_b (rpi_shader + 466) +-#define mc_exit (rpi_shader + 640) +-#define mc_interrupt_exit8 (rpi_shader + 658) +-#define mc_end (rpi_shader + 688) ++#define mc_filter_uv (rpi_shader + 148) ++#define mc_filter_uv_b0 (rpi_shader + 310) ++#define mc_filter_uv_b (rpi_shader + 458) ++#define mc_exit (rpi_shader + 630) ++#define mc_interrupt_exit8 (rpi_shader + 648) ++#define mc_end (rpi_shader + 678) + + #endif +diff --git a/libavcodec/rpi_shader.qasm b/libavcodec/rpi_shader.qasm +index e138c95..d9ffcda 100644 +--- a/libavcodec/rpi_shader.qasm ++++ b/libavcodec/rpi_shader.qasm +@@ -167,8 +167,6 @@ add t0s, r2, r1 + + # Dump padding words + mov r0, unif +-mov r0, unif +-mov r0, unif + + # submit texture requests for second line + max r1, ra_y, 0 +@@ -228,11 +226,10 @@ asr ra3, r0, rb23; mul24 r0, r0, ra22 + asr ra2, r0, rb23; mul24 r0, r0, ra22 + asr ra1, r0, rb23; mul24 r0, r0, ra22 + asr ra0, r0, rb23; mov r0, unif +- mov r0, unif + asr rb11, r0, rb23; mul24 r0, r0, ra22 + asr rb10, r0, rb23; mul24 r0, r0, ra22 + asr rb9, r0, rb23; mul24 r0, r0, ra22 +-asr rb8, r0, rb23; mov r0, unif ++asr rb8, r0, rb23 + + # r2 is elem_num + # r3 is loop counter +@@ -362,11 +359,10 @@ asr ra3, r0, rb23; mul24 r0, r0, ra22 + asr ra2, r0, rb23; mul24 r0, r0, ra22 + asr ra1, r0, rb23; mul24 r0, r0, ra22 + asr ra0, r0, rb23; mov r0, unif +- mov r0, unif + asr rb11, r0, rb23; mul24 r0, r0, ra22 + asr rb10, r0, rb23; mul24 r0, r0, ra22 + asr rb9, r0, rb23; mul24 r0, r0, ra22 +-asr rb8, r0, rb23; mov r0, unif ++asr rb8, r0, rb23 + + # r2 is elem_num + # r3 is loop counter +@@ -490,11 +486,10 @@ asr ra3, r0, rb23; mul24 r0, r0, ra22 + asr ra2, r0, rb23; mul24 r0, r0, ra22 + asr ra1, r0, rb23; mul24 r0, r0, ra22 + asr ra0, r0, rb23; mov r0, unif +- mov r0, unif + asr rb11, r0, rb23; mul24 r0, r0, ra22 + asr rb10, r0, rb23; mul24 r0, r0, ra22 + asr rb9, r0, rb23; mul24 r0, r0, ra22 +-asr rb8, r0, rb23; mov r0, unif ++asr rb8, r0, rb23 + + # r2 is elem_num + # r3 is loop counter +-- +2.5.0 + + +From 87ea97549920ec537d6bb03b6848be12b7b4e252 Mon Sep 17 00:00:00 2001 +From: popcornmix <popcornmix@gmail.com> +Date: Thu, 14 May 2015 15:21:49 +0100 +Subject: [PATCH 34/68] hevc: don't redirect when not rpi_enabled + +--- + libavcodec/hevc.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c +index c65af74..e2f8a87 100644 +--- a/libavcodec/hevc.c ++++ b/libavcodec/hevc.c +@@ -1457,7 +1457,7 @@ static int hls_pcm_sample(HEVCContext *s, int x0, int y0, int log2_cb_size) + */ + + #ifdef RPI_INTER +-#define RPI_REDIRECT(fn) rpi_ ## fn ++#define RPI_REDIRECT(fn) (s->enable_rpi ? rpi_ ## fn : fn) + static void rpi_luma_mc_uni(HEVCContext *s, uint8_t *dst, ptrdiff_t dststride, + AVFrame *ref, const Mv *mv, int x_off, int y_off, + int block_w, int block_h, int luma_weight, int luma_offset) +-- +2.5.0 + + +From d922347fd57c0320b6c6983a6c0b7c3200dae393 Mon Sep 17 00:00:00 2001 +From: popcornmix <popcornmix@gmail.com> +Date: Thu, 14 May 2015 15:22:02 +0100 +Subject: [PATCH 35/68] Use /dev/vcio for mailbox access + +--- + libavcodec/rpi_mailbox.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libavcodec/rpi_mailbox.c b/libavcodec/rpi_mailbox.c +index 536896f..77a56dd 100644 +--- a/libavcodec/rpi_mailbox.c ++++ b/libavcodec/rpi_mailbox.c +@@ -39,7 +39,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + #define MAJOR_NUM 100 + #define IOCTL_MBOX_PROPERTY _IOWR(MAJOR_NUM, 0, char *) +-#define DEVICE_FILE_NAME "/dev/char_dev" ++#define DEVICE_FILE_NAME "/dev/vcio" + + #include "rpi_mailbox.h" + +-- +2.5.0 + + +From 70688cd4e7a3bb073fe32a1dbdded4c4dfee3a42 Mon Sep 17 00:00:00 2001 +From: popcornmix <popcornmix@gmail.com> +Date: Thu, 14 May 2015 15:25:25 +0100 +Subject: [PATCH 36/68] Use vcsm for all memory allocations + +--- + libavcodec/rpi_qpu.c | 174 +++++++++++++++++++-------------------------------- + 1 file changed, 64 insertions(+), 110 deletions(-) + +diff --git a/libavcodec/rpi_qpu.c b/libavcodec/rpi_qpu.c +index 60bf079..f62051f 100644 +--- a/libavcodec/rpi_qpu.c ++++ b/libavcodec/rpi_qpu.c +@@ -1,7 +1,5 @@ + #ifdef RPI +-// define RPI_USE_VCSM to use the vcsm device for shared memory + // This works better than the mmap in that the memory can be cached, but requires a kernel modification to enable the device. +-#define RPI_USE_VCSM + // define RPI_TIME_TOTAL_QPU to print out how much time is spent in the QPU code + #define RPI_TIME_TOTAL_QPU + // define RPI_TIME_TOTAL_VPU to print out how much time is spent in the VPI code +@@ -25,9 +23,7 @@ + #include "rpi_shader.h" + #include "rpi_hevc_transform.h" + +-#ifdef RPI_USE_VCSM + #include "rpi_user_vcsm.h" +-#endif + + // On Pi2 there is no way to access the VPU L2 cache + // GPU_MEM_FLG should be 4 for uncached memory. (Or C for alias to allocate in the VPU L2 cache) +@@ -96,7 +92,6 @@ struct GPU + unsigned int vpu_code[VPU_CODE_SIZE]; + short transMatrix2even[16*16*2]; + int open_count; // Number of allocated video buffers +- unsigned int vc_handle; // Handle of this memory + int mb; // Mailbox handle + int vc; // Address in GPU memory + int mail[12]; // These are used to pass pairs of code/unifs to the QPUs +@@ -105,6 +100,7 @@ struct GPU + // Stop more than one thread trying to allocate memory or use the processing resources at once + static pthread_mutex_t gpu_mutex = PTHREAD_MUTEX_INITIALIZER; + static volatile struct GPU* gpu = NULL; ++static GPU_MEM_PTR_T gpu_mem_ptr; + + #if defined(RPI_TIME_TOTAL_QPU) || defined(RPI_TIME_TOTAL_VPU) + static unsigned int Microseconds(void) { +@@ -132,39 +128,27 @@ static volatile int vpu_async_tail=0; // Contains the number of posted jobs + static volatile int vpu_async_head=0; + #endif + ++static int gpu_malloc_uncached_internal(int numbytes, GPU_MEM_PTR_T *p, int mb); ++static void gpu_free_internal(GPU_MEM_PTR_T *p); ++ + // Connect to QPU, returns 0 on success. + static int gpu_init(volatile struct GPU **gpu) { + int mb = mbox_open(); + int vc; +- int handle; + volatile struct GPU* ptr; + if (mb < 0) + return -1; + + if (qpu_enable(mb, 1)) return -2; + +-#ifdef RPI_USE_VCSM + vcsm_init(); +-#endif ++ gpu_malloc_uncached_internal(sizeof(struct GPU), &gpu_mem_ptr, mb); ++ ptr = (volatile struct GPU*)gpu_mem_ptr.arm; ++ memset(ptr, 0, sizeof *ptr); ++ vc = gpu_mem_ptr.vc; + +- handle = mem_alloc(mb, sizeof(struct GPU), 4096, GPU_MEM_FLG); +- if (!handle) +- { +- qpu_enable(mb, 0); +- return -3; +- } +- vc = mem_lock(mb, handle); +- ptr = mapmem_shared((vc+GPU_MEM_MAP)&~0xc0000000, sizeof(struct GPU)); +- if (ptr == NULL) +- { mem_free(mb, handle); +- mem_unlock(mb, handle); +- qpu_enable(mb, 0); +- return -4; +- } +- +- ptr->mb = mb; +- ptr->vc_handle = handle; +- ptr->vc = vc; ++ ptr->mb = mb; ++ ptr->vc = vc; + + printf("GPU allocated at 0x%x\n",vc); + +@@ -226,94 +210,74 @@ static void gpu_unlock(void) { + pthread_mutex_unlock(&gpu_mutex); + } + ++static int gpu_malloc_uncached_internal(int numbytes, GPU_MEM_PTR_T *p, int mb) { ++ p->vcsm_handle = vcsm_malloc_cache(numbytes, VCSM_CACHE_TYPE_NONE, (char *)"Video Frame" ); ++ assert(p->vcsm_handle); ++ p->vc_handle = vcsm_vc_hdl_from_hdl(p->vcsm_handle); ++ assert(p->vc_handle); ++ p->arm = vcsm_lock(p->vcsm_handle); ++ assert(p->arm); ++ p->vc = mem_lock(mb, p->vc_handle); ++ assert(p->vc); ++ return 0; ++} ++ + // Allocate memory on GPU + // Fills in structure <p> containing ARM pointer, videocore handle, videocore memory address, numbytes + // Returns 0 on success. + // This allocates memory that will not be cached in ARM's data cache. + // Therefore safe to use without data cache flushing. +-int gpu_malloc_uncached(int numbytes, GPU_MEM_PTR_T *p) { ++int gpu_malloc_uncached(int numbytes, GPU_MEM_PTR_T *p) ++{ ++ int r; + gpu_lock(); +- p->vc_handle = mem_alloc(gpu->mb, numbytes, 4096, GPU_MEM_FLG); +- p->vcsm_handle = 0; +- if (!p->vc_handle) +- { +- qpu_enable(gpu->mb, 0); +- return -3; +- } +- p->vc = mem_lock(gpu->mb, p->vc_handle); +- p->arm = mapmem_shared((p->vc+GPU_MEM_MAP)&~0xc0000000,numbytes); +- p->numbytes = numbytes; +- if (p->arm == NULL) +- { +- mem_free(gpu->mb, p->vc_handle); +- mem_unlock(gpu->mb, p->vc_handle); +- gpu_unlock(); +- qpu_enable(gpu->mb, 0); +- return -4; +- } ++ r = gpu_malloc_uncached_internal(numbytes, p, gpu->mb); + gpu->open_count++; + gpu_unlock(); +- return 0; ++ return r; + } + + void gpu_cache_flush(GPU_MEM_PTR_T *p) + { +- // This only works when using RPI_USE_VCSM + void *tmp = vcsm_lock(p->vcsm_handle); + vcsm_unlock_ptr(tmp); + } + ++static int gpu_malloc_cached_internal(int numbytes, GPU_MEM_PTR_T *p) { ++ p->vcsm_handle = vcsm_malloc_cache(numbytes, VCSM_CACHE_TYPE_HOST, (char *)"Video Frame" ); ++ //p->vcsm_handle = vcsm_malloc_cache(numbytes, VCSM_CACHE_TYPE_VC, (char *)"Video Frame" ); ++ //p->vcsm_handle = vcsm_malloc_cache(numbytes, VCSM_CACHE_TYPE_NONE, (char *)"Video Frame" ); ++ //p->vcsm_handle = vcsm_malloc_cache(numbytes, VCSM_CACHE_TYPE_HOST_AND_VC, (char *)"Video Frame" ); ++ assert(p->vcsm_handle); ++ p->vc_handle = vcsm_vc_hdl_from_hdl(p->vcsm_handle); ++ assert(p->vc_handle); ++ p->arm = vcsm_lock(p->vcsm_handle); ++ assert(p->arm); ++ p->vc = mem_lock(gpu->mb, p->vc_handle); ++ assert(p->vc); ++ return 0; ++} ++ + // This allocates data that will be + // Cached in ARM L2 + // Uncached in VPU L2 +-int gpu_malloc_cached(int numbytes, GPU_MEM_PTR_T *p) { ++int gpu_malloc_cached(int numbytes, GPU_MEM_PTR_T *p) ++{ ++ int r; + gpu_lock(); +-#ifdef RPI_USE_VCSM +- { +- p->vcsm_handle = vcsm_malloc_cache(numbytes, VCSM_CACHE_TYPE_HOST, (char *)"Video Frame" ); // f....... locks up for VP9 - retest this? +- //p->vcsm_handle = vcsm_malloc_cache(numbytes, VCSM_CACHE_TYPE_VC, (char *)"Video Frame" ); // 3b...... works +- //p->vcsm_handle = vcsm_malloc_cache(numbytes, VCSM_CACHE_TYPE_NONE, (char *)"Video Frame" ); //fb...... locks up +- //p->vcsm_handle = vcsm_malloc_cache(numbytes, VCSM_CACHE_TYPE_HOST_AND_VC, (char *)"Video Frame" ); // 3b works (but corrupted due to caching) +- p->vc_handle = vcsm_vc_hdl_from_hdl(p->vcsm_handle); +- p->arm = vcsm_lock(p->vcsm_handle); +- p->vc = mem_lock(gpu->mb, p->vc_handle); +- } +-#else +- p->vc_handle = mem_alloc(gpu->mb, numbytes, 4096, GPU_MEM_FLG); +- p->vcsm_handle = 0; +- if (!p->handle) +- { +- qpu_enable(gpu->mb, 0); +- return -3; +- } +- p->vc = mem_lock(gpu->mb, p->vc_handle); +- printf("This mapmem_private does not seem to work\n"); +- exit(-1); +- p->arm = mapmem_private((p->vc+GPU_MEM_MAP)&~0xc0000000,numbytes); +- p->numbytes = numbytes; +- if (p->arm == NULL) +- { +- mem_free(gpu->mb, p->handle); +- mem_unlock(gpu->mb, p->handle); +- gpu_unlock(); +- qpu_enable(gpu->mb, 0); +- return -4; +- } +-#endif ++ r = gpu_malloc_cached_internal(numbytes, p); + gpu->open_count++; + gpu_unlock(); +- return 0; ++ return r; + } + + static void gpu_term(void) + { +- int mb; +- unsigned handle; ++ int mb; + + if (gpu==NULL) + return; + mb = gpu->mb; +- handle = gpu->vc_handle; + + #ifdef RPI_ASYNC + { +@@ -323,37 +287,26 @@ static void gpu_term(void) + } + #endif + ++ qpu_enable(mb, 0); ++ gpu_free_internal(&gpu_mem_ptr); + +- unmapmem((void*)gpu, sizeof(struct GPU)); +- mem_unlock(mb, handle); +- mem_free(mb, handle); +- qpu_enable(mb, 0); +-#ifdef RPI_USE_VCSM + vcsm_exit(); +-#endif +- mbox_close(mb); ++ ++ mbox_close(mb); + gpu = NULL; + } + +-void gpu_free(GPU_MEM_PTR_T *p) { ++void gpu_free_internal(GPU_MEM_PTR_T *p) { + int mb = gpu->mb; +- unsigned handle = p->vc_handle; ++ mem_unlock(mb,p->vc_handle); ++ vcsm_unlock_ptr(p->arm); ++ vcsm_free(p->vcsm_handle); ++} ++ ++void gpu_free(GPU_MEM_PTR_T *p) { + gpu_lock(); +-#ifdef RPI_USE_VCSM +- if (p->vcsm_handle) { +- mem_unlock(mb,p->vc_handle); +- vcsm_unlock_ptr(p->arm); +- vcsm_free(p->vcsm_handle); +- } else { +- unmapmem((void*)p->arm, sizeof(struct GPU)); +- mem_unlock(mb, handle); +- mem_free(mb, handle); +- } +-#else +- unmapmem((void*)p->arm, sizeof(struct GPU)); +- mem_unlock(mb, handle); +- mem_free(mb, handle); +-#endif ++ ++ gpu_free_internal(p); + + gpu->open_count--; + if (gpu->open_count==0) { +@@ -386,20 +339,21 @@ unsigned int vpu_get_constants(void) { + + static void *vpu_start(void *arg) { + while(1) { ++ int *p; + pthread_mutex_lock(&post_mutex); + while( vpu_async_tail - vpu_async_head <= 0) + { + //printf("Checking number %d %d\n",vpu_async_head,vpu_async_tail); + pthread_cond_wait(&post_cond_tail, &post_mutex); + } +- int *p = vpu_cmds[vpu_async_head%MAXCMDS]; ++ p = vpu_cmds[vpu_async_head%MAXCMDS]; + pthread_mutex_unlock(&post_mutex); + + if (p[6] == -1) { + break; // Last job + } + if (p[7]) { +- GPU_MEM_PTR_T *buf = (GPU_MEM_PTR_T *)p[7]; ++ //GPU_MEM_PTR_T *buf = (GPU_MEM_PTR_T *)p[7]; + //gpu_cache_flush(buf); + } + vpu_execute_code(p[0], p[1], p[2], p[3], p[4], p[5], p[6]); +-- +2.5.0 + + +From a98ba0c30ea93bdf25308e679ed5a38f09b63f9d Mon Sep 17 00:00:00 2001 +From: popcornmix <popcornmix@gmail.com> +Date: Thu, 14 May 2015 15:43:17 +0100 +Subject: [PATCH 37/68] Enable EARLY_MALLOC and fix sps access bug + +--- + libavcodec/hevc.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c +index e2f8a87..61f6dfb 100644 +--- a/libavcodec/hevc.c ++++ b/libavcodec/hevc.c +@@ -44,7 +44,7 @@ + #ifdef RPI + #include "rpi_qpu.h" + // For some unknown reason, the code seems to crash if I do a late malloc +- #define EARLY_MALLOC ++ //#define EARLY_MALLOC + // Move Inter prediction into separate pass + #define RPI_INTER + #endif +@@ -149,7 +149,8 @@ static int pic_arrays_init(HEVCContext *s, const HEVCSPS *sps) + #ifdef RPI + #ifdef EARLY_MALLOC + #else +- int coeffs_in_ctb = (1 << s->ps.sps->log2_ctb_size) * (1 << s->ps.sps->log2_ctb_size); ++ assert(sps); ++ int coeffs_in_ctb = (1 << sps->log2_ctb_size) * (1 << sps->log2_ctb_size); + int coefs_per_row = sps->ctb_width * coeffs_in_ctb * 3; // Allow space for chroma + printf("pic_arrays_init\n"); + printf("Allocated %d\n",coefs_per_row); +-- +2.5.0 + + +From 3e7256195852455e030586a1945cccc3fc7eb44a Mon Sep 17 00:00:00 2001 +From: popcornmix <popcornmix@gmail.com> +Date: Thu, 14 May 2015 16:40:51 +0100 +Subject: [PATCH 38/68] Add copy of av_mod_uintp2 for use with stable ffmpeg + +--- + libavcodec/hevc.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c +index 61f6dfb..d27c7f3 100644 +--- a/libavcodec/hevc.c ++++ b/libavcodec/hevc.c +@@ -51,6 +51,14 @@ + + // #define DISABLE_MC + ++#ifndef av_mod_uintp2 ++static av_always_inline av_const unsigned av_mod_uintp2_c(unsigned a, unsigned p) ++{ ++ return a & ((1 << p) - 1); ++} ++# define av_mod_uintp2 av_mod_uintp2_c ++#endif ++ + const uint8_t ff_hevc_pel_weight[65] = { [2] = 0, [4] = 1, [6] = 2, [8] = 3, [12] = 4, [16] = 5, [24] = 6, [32] = 7, [48] = 8, [64] = 9 }; + + +-- +2.5.0 + + +From ba9624fdc6073af3392753925bcb712dba984be8 Mon Sep 17 00:00:00 2001 +From: Peter de Rivaz <peter.derivaz@gmail.com> +Date: Mon, 18 May 2015 11:11:02 +0100 +Subject: [PATCH 39/68] Added support for weighted prediction in P frames + +--- + libavcodec/hevc.c | 52 ++++- + libavcodec/rpi_shader.c | 566 +++++++++++++++++++++++---------------------- + libavcodec/rpi_shader.h | 12 +- + libavcodec/rpi_shader.qasm | 39 +++- + 4 files changed, 384 insertions(+), 285 deletions(-) + +diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c +index d27c7f3..98f8461 100644 +--- a/libavcodec/hevc.c ++++ b/libavcodec/hevc.c +@@ -64,7 +64,7 @@ const uint8_t ff_hevc_pel_weight[65] = { [2] = 0, [4] = 1, [6] = 2, [8] = 3, [12 + + #ifdef RPI_INTER_QPU + +-#define RPI_CHROMA_COMMAND_WORDS 10 ++#define RPI_CHROMA_COMMAND_WORDS 12 + #define UV_COMMANDS_PER_QPU ((1 + (256*64*2)/(4*4)) * RPI_CHROMA_COMMAND_WORDS) + // The QPU code for UV blocks only works up to a block width of 8 + #define RPI_CHROMA_BLOCK_WIDTH 8 +@@ -2020,6 +2020,8 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, + int y1_c = y0_c + (mv->y >> (2 + hshift)); + //int chan = x0>>8; // Allocate commands for the first 256 luma pixels across to the first QPU. This is optimised for images around 1920 width + int chan = x0>>8; ++ int weight_flag = (s->sh.slice_type == P_SLICE && s->ps.pps->weighted_pred_flag) || ++ (s->sh.slice_type == B_SLICE && s->ps.pps->weighted_bipred_flag); + + uint32_t *u = s->u_mvs[chan & 7]; + for(int start_y=0;start_y < nPbH_c;start_y+=16) { +@@ -2032,6 +2034,13 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, + *u++ = ( (nPbW_c<RPI_CHROMA_BLOCK_WIDTH ? nPbW_c : RPI_CHROMA_BLOCK_WIDTH) << 16 ) + (nPbH_c<16 ? nPbH_c : 16); + *u++ = rpi_filter_coefs[_mx][0]; + *u++ = rpi_filter_coefs[_my][0]; ++ if (weight_flag) { ++ *u++ = (s->sh.chroma_offset_l0[current_mv.ref_idx[0]][0] << 16) + (s->sh.chroma_weight_l0[current_mv.ref_idx[0]][0] & 0xffff); ++ *u++ = (s->sh.chroma_offset_l0[current_mv.ref_idx[0]][1] << 16) + (s->sh.chroma_weight_l0[current_mv.ref_idx[0]][1] & 0xffff); ++ } else { ++ *u++ = 1; // Weight of 1 and offset of 0 ++ *u++ = 1; ++ } + *u++ = (get_vc_address(s->frame->buf[1]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[1]); + *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); + } +@@ -2074,6 +2083,8 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, + int y1_c = y0_c + (mv->y >> (2 + hshift)); + //int chan = x0>>8; // Allocate commands for the first 256 luma pixels across to the first QPU. This is optimised for images around 1920 width + int chan = x0>>8; ++ int weight_flag = (s->sh.slice_type == P_SLICE && s->ps.pps->weighted_pred_flag) || ++ (s->sh.slice_type == B_SLICE && s->ps.pps->weighted_bipred_flag); + + uint32_t *u = s->u_mvs[chan & 7]; + for(int start_y=0;start_y < nPbH_c;start_y+=16) { +@@ -2087,6 +2098,13 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, + // TODO chroma weight and offset... s->sh.chroma_weight_l0[current_mv.ref_idx[0]][0], s->sh.chroma_offset_l0[current_mv.ref_idx[0]][0] + *u++ = rpi_filter_coefs[_mx][0]; + *u++ = rpi_filter_coefs[_my][0]; ++ if (weight_flag) { ++ *u++ = (s->sh.chroma_offset_l0[current_mv.ref_idx[1]][0] << 16) + (s->sh.chroma_weight_l0[current_mv.ref_idx[1]][0] & 0xffff); ++ *u++ = (s->sh.chroma_offset_l0[current_mv.ref_idx[1]][1] << 16) + (s->sh.chroma_weight_l0[current_mv.ref_idx[1]][1] & 0xffff); ++ } else { ++ *u++ = 1; // Weight of 1 and offset of 0 ++ *u++ = 1; ++ } + *u++ = (get_vc_address(s->frame->buf[1]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[1]); + *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); + } +@@ -2148,6 +2166,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, + *u++ = ( (nPbW_c<RPI_CHROMA_BLOCK_WIDTH ? nPbW_c : RPI_CHROMA_BLOCK_WIDTH) << 16 ) + (nPbH_c<16 ? nPbH_c : 16); + *u++ = rpi_filter_coefs[_mx][0]; + *u++ = rpi_filter_coefs[_my][0]; ++ u+=2; // Weights not supported in B slices + u+=2; // Intermediate results are not written back in first pass of B filtering + + u++[-RPI_CHROMA_COMMAND_WORDS] = s->mc_filter_uv_b; +@@ -2158,6 +2177,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, + *u++ = ( (nPbW_c<RPI_CHROMA_BLOCK_WIDTH ? nPbW_c : RPI_CHROMA_BLOCK_WIDTH) << 16 ) + (nPbH_c<16 ? nPbH_c : 16); + *u++ = rpi_filter_coefs[_mx2][0]; + *u++ = rpi_filter_coefs[_my2][0]; ++ u+=2; // Weights not supported in B slices + *u++ = (get_vc_address(s->frame->buf[1]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[1]); + *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); + } +@@ -2784,6 +2804,9 @@ static void rpi_inter_clear(HEVCContext *s) + int i; + int pic_width = s->ps.sps->width >> s->ps.sps->hshift[1]; + int pic_height = s->ps.sps->height >> s->ps.sps->vshift[1]; ++ int weight_flag = (s->sh.slice_type == P_SLICE && s->ps.pps->weighted_pred_flag) || ++ (s->sh.slice_type == B_SLICE && s->ps.pps->weighted_bipred_flag); ++ + for(i=0;i<8;i++) { + s->u_mvs[i] = s->mvs_base[i]; + *s->u_mvs[i]++ = 0; +@@ -2795,6 +2818,13 @@ static void rpi_inter_clear(HEVCContext *s) + *s->u_mvs[i]++ = pic_height; + *s->u_mvs[i]++ = s->frame->linesize[1]; + *s->u_mvs[i]++ = s->frame->linesize[2]; ++ if (weight_flag) { ++ *s->u_mvs[i]++ = 1 << (s->sh.chroma_log2_weight_denom + 6 - 1); ++ *s->u_mvs[i]++ = s->sh.chroma_log2_weight_denom + 6; ++ } else { ++ *s->u_mvs[i]++ = 1 << 5; ++ *s->u_mvs[i]++ = 6; ++ } + s->u_mvs[i] += 1; // Padding words + } + } +@@ -2838,12 +2868,29 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) + int ctb_addr_ts = s->ps.pps->ctb_addr_rs_to_ts[s->sh.slice_ctb_addr_rs]; + + #ifdef RPI ++#ifdef RPI_INTER_QPU + s->enable_rpi = s->ps.sps->bit_depth == 8 + && s->ps.sps->width <= RPI_MAX_WIDTH + && !s->ps.pps->cross_component_prediction_enabled_flag + && s->ps.pps->num_tile_rows <= 1 && s->ps.pps->num_tile_columns <= 1 +- && !(s->ps.pps->weighted_pred_flag && s->sh.slice_type == P_SLICE) + && !(s->ps.pps->weighted_bipred_flag && s->sh.slice_type == B_SLICE); ++#else ++ s->enable_rpi = s->ps.sps->bit_depth == 8 ++ && s->ps.sps->width <= RPI_MAX_WIDTH ++ && !s->ps.pps->cross_component_prediction_enabled_flag ++ && s->ps.pps->num_tile_rows <= 1 && s->ps.pps->num_tile_columns <= 1; ++#endif ++ ++ /*if (!s->enable_rpi) { ++ if (s->ps.pps->cross_component_prediction_enabled_flag) ++ printf("Cross component\n"); ++ if (s->ps.pps->num_tile_rows > 1 || s->ps.pps->num_tile_columns > 1) ++ printf("Tiles\n"); ++ if (s->ps.pps->weighted_pred_flag && s->sh.slice_type == P_SLICE) ++ printf("Weighted P slice\n"); ++ if (s->ps.pps->weighted_bipred_flag && s->sh.slice_type == B_SLICE) ++ printf("Weighted B slice\n"); ++ }*/ + + #endif + +@@ -2976,6 +3023,7 @@ static int hls_decode_entry_wpp(AVCodecContext *avctxt, void *input_ctb_row, int + + #ifdef RPI + s->enable_rpi = 0; ++ //printf("Wavefront\n"); + #endif + + if(ctb_row) { +diff --git a/libavcodec/rpi_shader.c b/libavcodec/rpi_shader.c +index b0b93b5..3f04d80 100644 +--- a/libavcodec/rpi_shader.c ++++ b/libavcodec/rpi_shader.c +@@ -88,287 +88,307 @@ unsigned int rpi_shader[] = { + /* [0x000001f8] */ 0x4c9d040f, 0x100248a1, // add r2, r2, r0 ; mul24 r1, r1, rb_pitch + /* [0x00000200] */ 0x8c9e7052, 0x10025e18, // add t0s, r0, r1 ; mov ra_x2_base, r2 + /* [0x00000208] */ 0x0c9e7440, 0x10020e27, // add t0s, r2, r1 +-/* [0x00000210] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000218] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 +-/* [0x00000220] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 +-/* [0x00000228] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 +-/* [0x00000230] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 +-/* [0x00000238] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch +-/* [0x00000240] */ 0x0c427380, 0x10020e27, // add t0s, r1, ra_x_base +-/* [0x00000248] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_x2_base ++/* [0x00000210] */ 0x15827d80, 0x10021327, // mov rb12,unif ++/* [0x00000218] */ 0x15827d80, 0x10021367, // mov rb13,unif ++/* [0x00000220] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000228] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 ++/* [0x00000230] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 ++/* [0x00000238] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 ++/* [0x00000240] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 ++/* [0x00000248] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch ++/* [0x00000250] */ 0x0c427380, 0x10020e27, // add t0s, r1, ra_x_base ++/* [0x00000258] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_x2_base + // ::mc_filter_uv +-/* [0x00000250] */ 0x15827d80, 0x100207e7, // mov ra31, unif +-/* [0x00000258] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next +-/* [0x00000260] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num +-/* [0x00000268] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif +-/* [0x00000270] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif +-/* [0x00000278] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 +-/* [0x00000280] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 +-/* [0x00000288] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 +-/* [0x00000290] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 +-/* [0x00000298] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 +-/* [0x000002a0] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 +-/* [0x000002a8] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 +-/* [0x000002b0] */ 0x00000010, 0xe00208a7, // mov r2, 16 +-/* [0x000002b8] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x000002c0] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 +-/* [0x000002c8] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 +-/* [0x000002d0] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 +-/* [0x000002d8] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 +-/* [0x000002e0] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 +-/* [0x000002e8] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 +-/* [0x000002f0] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 +-/* [0x000002f8] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 +-/* [0x00000300] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 +-/* [0x00000308] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000310] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000318] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000320] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000328] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif +-/* [0x00000330] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000338] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000340] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000348] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 +-/* [0x00000350] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 +-/* [0x00000358] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-/* [0x00000360] */ 0x00000000, 0xe00208e7, // mov r3, 0 ++/* [0x00000260] */ 0x15827d80, 0x100207e7, // mov ra31, unif ++/* [0x00000268] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next ++/* [0x00000270] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num ++/* [0x00000278] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif ++/* [0x00000280] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif ++/* [0x00000288] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 ++/* [0x00000290] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 ++/* [0x00000298] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 ++/* [0x000002a0] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 ++/* [0x000002a8] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 ++/* [0x000002b0] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 ++/* [0x000002b8] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 ++/* [0x000002c0] */ 0x00000010, 0xe00208a7, // mov r2, 16 ++/* [0x000002c8] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x000002d0] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 ++/* [0x000002d8] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 ++/* [0x000002e0] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 ++/* [0x000002e8] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 ++/* [0x000002f0] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 ++/* [0x000002f8] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 ++/* [0x00000300] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 ++/* [0x00000308] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 ++/* [0x00000310] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 ++/* [0x00000318] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000320] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000328] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000330] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000338] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif ++/* [0x00000340] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000348] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000350] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000358] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 ++/* [0x00000360] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x00000368] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000370] */ 0x0f9e7080, 0x100213e7, // asr rb15, r0, r2 ++/* [0x00000378] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 ++/* [0x00000380] */ 0x0f9e7080, 0x100213a7, // asr rb14, r0, r2 ++/* [0x00000388] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000390] */ 0x0f9e7080, 0x100613e7, // asr.ifnz rb15, r0, r2 ++/* [0x00000398] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 ++/* [0x000003a0] */ 0x0f9e7080, 0x100613a7, // asr.ifnz rb14, r0, r2 ++/* [0x000003a8] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 ++/* [0x000003b0] */ 0x00000000, 0xe00208e7, // mov r3, 0 + // :uvloop +-/* [0x00000368] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 +-/* [0x00000370] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 +-/* [0x00000378] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 +-/* [0x00000380] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch +-/* [0x00000388] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 +-/* [0x00000390] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 +-/* [0x00000398] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 +-/* [0x000003a0] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 +-/* [0x000003a8] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 +-/* [0x000003b0] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 +-/* [0x000003b8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-/* [0x000003c0] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 +-/* [0x000003c8] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 +-/* [0x000003d0] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 +-/* [0x000003d8] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 +-/* [0x000003e0] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 +-/* [0x000003e8] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 +-/* [0x000003f0] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 +-/* [0x000003f8] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 +-/* [0x00000400] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 +-/* [0x00000408] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 +-/* [0x00000410] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop +-/* [0x00000418] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 +-/* [0x00000420] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 +-/* [0x00000428] */ 0x159e7000, 0x100203e7, // mov ra15, r0 +-/* [0x00000430] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 +-/* [0x00000438] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 +-/* [0x00000440] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 +-/* [0x00000448] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 +-/* [0x00000450] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait +-/* [0x00000458] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 +-/* [0x00000460] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 +-/* [0x00000468] */ 0x0c567380, 0x10020867, // add r1, r1, ra21 +-/* [0x00000470] */ 0xfffffed8, 0xf06809e7, // brr.anyn -, r:uvloop +-/* [0x00000478] */ 0x0f9c63c0, 0xd0020867, // asr r1, r1, 6 +-/* [0x00000480] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 +-/* [0x00000488] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 +-/* [0x00000490] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 +-/* [0x00000498] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 +-/* [0x000004a0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif +-/* [0x000004a8] */ 0x00000010, 0xe0020827, // mov r0, 16 +-/* [0x000004b0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait +-/* [0x000004b8] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 +-/* [0x000004c0] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 +-/* [0x000004c8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 +-/* [0x000004d0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif ++/* [0x000003b8] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 ++/* [0x000003c0] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 ++/* [0x000003c8] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 ++/* [0x000003d0] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch ++/* [0x000003d8] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 ++/* [0x000003e0] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 ++/* [0x000003e8] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 ++/* [0x000003f0] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 ++/* [0x000003f8] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 ++/* [0x00000400] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 ++/* [0x00000408] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x00000410] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 ++/* [0x00000418] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 ++/* [0x00000420] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 ++/* [0x00000428] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 ++/* [0x00000430] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 ++/* [0x00000438] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 ++/* [0x00000440] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 ++/* [0x00000448] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 ++/* [0x00000450] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 ++/* [0x00000458] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 ++/* [0x00000460] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop ++/* [0x00000468] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 ++/* [0x00000470] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 ++/* [0x00000478] */ 0x159e7000, 0x100203e7, // mov ra15, r0 ++/* [0x00000480] */ 0x00000020, 0xe0021327, // mov rb12,32 ++/* [0x00000488] */ 0x00000006, 0xe0021367, // mov rb13,6 ++/* [0x00000490] */ 0x00000001, 0xe00213a7, // mov rb14,1 ++/* [0x00000498] */ 0x00000000, 0xe00213e7, // mov rb15,0 ++/* [0x000004a0] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 ++/* [0x000004a8] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 ++/* [0x000004b0] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 ++/* [0x000004b8] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 ++/* [0x000004c0] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait ++/* [0x000004c8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 ++/* [0x000004d0] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 ++/* [0x000004d8] */ 0x409ce00f, 0x100049e1, // nop ; mul24 r1, r1, rb14 ++/* [0x000004e0] */ 0x0c9cc3c0, 0x10020867, // add r1, r1, rb12 ++/* [0x000004e8] */ 0x0f9cd3c0, 0x10020867, // asr r1, r1, rb13 ++/* [0x000004f0] */ 0xfffffea8, 0xf06809e7, // brr.anyn -, r:uvloop ++/* [0x000004f8] */ 0x0c9cf3c0, 0x10020867, // add r1, r1, rb15 ++/* [0x00000500] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 ++/* [0x00000508] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 ++/* [0x00000510] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 ++/* [0x00000518] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 ++/* [0x00000520] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif ++/* [0x00000528] */ 0x00000010, 0xe0020827, // mov r0, 16 ++/* [0x00000530] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x00000538] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 ++/* [0x00000540] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 ++/* [0x00000548] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 ++/* [0x00000550] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif + // ::mc_filter_uv_b0 +-/* [0x000004d8] */ 0x15827d80, 0x100207e7, // mov ra31, unif +-/* [0x000004e0] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next +-/* [0x000004e8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num +-/* [0x000004f0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif +-/* [0x000004f8] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif +-/* [0x00000500] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 +-/* [0x00000508] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 +-/* [0x00000510] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 +-/* [0x00000518] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 +-/* [0x00000520] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 +-/* [0x00000528] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 +-/* [0x00000530] */ 0x159d5fc0, 0x10021c67, // mov vw_setup, rb21 +-/* [0x00000538] */ 0x00000010, 0xe00208a7, // mov r2, 16 +-/* [0x00000540] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000548] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 +-/* [0x00000550] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 +-/* [0x00000558] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 +-/* [0x00000560] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 +-/* [0x00000568] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 +-/* [0x00000570] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 +-/* [0x00000578] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 +-/* [0x00000580] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 +-/* [0x00000588] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 +-/* [0x00000590] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000598] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000005a0] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000005a8] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000005b0] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif +-/* [0x000005b8] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000005c0] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000005c8] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000005d0] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 +-/* [0x000005d8] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 +-/* [0x000005e0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-/* [0x000005e8] */ 0x00000000, 0xe00208e7, // mov r3, 0 ++/* [0x00000558] */ 0x15827d80, 0x100207e7, // mov ra31, unif ++/* [0x00000560] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next ++/* [0x00000568] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num ++/* [0x00000570] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif ++/* [0x00000578] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif ++/* [0x00000580] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 ++/* [0x00000588] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 ++/* [0x00000590] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 ++/* [0x00000598] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 ++/* [0x000005a0] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 ++/* [0x000005a8] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 ++/* [0x000005b0] */ 0x159d5fc0, 0x10021c67, // mov vw_setup, rb21 ++/* [0x000005b8] */ 0x00000010, 0xe00208a7, // mov r2, 16 ++/* [0x000005c0] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x000005c8] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 ++/* [0x000005d0] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 ++/* [0x000005d8] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 ++/* [0x000005e0] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 ++/* [0x000005e8] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 ++/* [0x000005f0] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 ++/* [0x000005f8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 ++/* [0x00000600] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 ++/* [0x00000608] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 ++/* [0x00000610] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000618] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000620] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000628] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000630] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif ++/* [0x00000638] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000640] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000648] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000650] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 ++/* [0x00000658] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000660] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000668] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 ++/* [0x00000670] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x00000678] */ 0x00000000, 0xe00208e7, // mov r3, 0 + // :uvloop_b0 +-/* [0x000005f0] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 +-/* [0x000005f8] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 +-/* [0x00000600] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 +-/* [0x00000608] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch +-/* [0x00000610] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 +-/* [0x00000618] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 +-/* [0x00000620] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 +-/* [0x00000628] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 +-/* [0x00000630] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 +-/* [0x00000638] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 +-/* [0x00000640] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-/* [0x00000648] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 +-/* [0x00000650] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 +-/* [0x00000658] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 +-/* [0x00000660] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 +-/* [0x00000668] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 +-/* [0x00000670] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 +-/* [0x00000678] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 +-/* [0x00000680] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 +-/* [0x00000688] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 +-/* [0x00000690] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 +-/* [0x00000698] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b0 +-/* [0x000006a0] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 +-/* [0x000006a8] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 +-/* [0x000006b0] */ 0x159e7000, 0x100203e7, // mov ra15, r0 +-/* [0x000006b8] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 +-/* [0x000006c0] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 +-/* [0x000006c8] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 +-/* [0x000006d0] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 +-/* [0x000006d8] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait +-/* [0x000006e0] */ 0x0d9d27c0, 0x100229e7, // sub.setf -, r3, rb18 +-/* [0x000006e8] */ 0xfffffee8, 0xf06809e7, // brr.anyn -, r:uvloop_b0 +-/* [0x000006f0] */ 0x0f9c63c0, 0xd0020c27, // asr vpm, r1, 6 +-/* [0x000006f8] */ 0x009e7000, 0x100009e7, // nop +-/* [0x00000700] */ 0x009e7000, 0x100009e7, // nop +-/* [0x00000708] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 +-/* [0x00000710] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000718] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000720] */ 0x009e7000, 0x100009e7, // nop ++/* [0x00000680] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 ++/* [0x00000688] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 ++/* [0x00000690] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 ++/* [0x00000698] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch ++/* [0x000006a0] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 ++/* [0x000006a8] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 ++/* [0x000006b0] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 ++/* [0x000006b8] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 ++/* [0x000006c0] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 ++/* [0x000006c8] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 ++/* [0x000006d0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x000006d8] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 ++/* [0x000006e0] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 ++/* [0x000006e8] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 ++/* [0x000006f0] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 ++/* [0x000006f8] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 ++/* [0x00000700] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 ++/* [0x00000708] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 ++/* [0x00000710] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 ++/* [0x00000718] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 ++/* [0x00000720] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 ++/* [0x00000728] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b0 ++/* [0x00000730] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 ++/* [0x00000738] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 ++/* [0x00000740] */ 0x159e7000, 0x100203e7, // mov ra15, r0 ++/* [0x00000748] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 ++/* [0x00000750] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 ++/* [0x00000758] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 ++/* [0x00000760] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 ++/* [0x00000768] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait ++/* [0x00000770] */ 0x0d9d27c0, 0x100229e7, // sub.setf -, r3, rb18 ++/* [0x00000778] */ 0xfffffee8, 0xf06809e7, // brr.anyn -, r:uvloop_b0 ++/* [0x00000780] */ 0x0f9c63c0, 0xd0020c27, // asr vpm, r1, 6 ++/* [0x00000788] */ 0x009e7000, 0x100009e7, // nop ++/* [0x00000790] */ 0x009e7000, 0x100009e7, // nop ++/* [0x00000798] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 ++/* [0x000007a0] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x000007a8] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x000007b0] */ 0x009e7000, 0x100009e7, // nop + // ::mc_filter_uv_b +-/* [0x00000728] */ 0x15827d80, 0x100207e7, // mov ra31, unif +-/* [0x00000730] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next +-/* [0x00000738] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num +-/* [0x00000740] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif +-/* [0x00000748] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif +-/* [0x00000750] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 +-/* [0x00000758] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 +-/* [0x00000760] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 +-/* [0x00000768] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 +-/* [0x00000770] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 +-/* [0x00000778] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 +-/* [0x00000780] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 +-/* [0x00000788] */ 0x00000010, 0xe00208a7, // mov r2, 16 +-/* [0x00000790] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000798] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 +-/* [0x000007a0] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 +-/* [0x000007a8] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 +-/* [0x000007b0] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 +-/* [0x000007b8] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 +-/* [0x000007c0] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 +-/* [0x000007c8] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 +-/* [0x000007d0] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 +-/* [0x000007d8] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 +-/* [0x000007e0] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 +-/* [0x000007e8] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 +-/* [0x000007f0] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 +-/* [0x000007f8] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 +-/* [0x00000800] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000808] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000810] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000818] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000820] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif +-/* [0x00000828] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000830] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000838] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000840] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 +-/* [0x00000848] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 +-/* [0x00000850] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-/* [0x00000858] */ 0x00000000, 0xe00208e7, // mov r3, 0 ++/* [0x000007b8] */ 0x15827d80, 0x100207e7, // mov ra31, unif ++/* [0x000007c0] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next ++/* [0x000007c8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num ++/* [0x000007d0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif ++/* [0x000007d8] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif ++/* [0x000007e0] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 ++/* [0x000007e8] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 ++/* [0x000007f0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 ++/* [0x000007f8] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 ++/* [0x00000800] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 ++/* [0x00000808] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 ++/* [0x00000810] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 ++/* [0x00000818] */ 0x00000010, 0xe00208a7, // mov r2, 16 ++/* [0x00000820] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000828] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 ++/* [0x00000830] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 ++/* [0x00000838] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 ++/* [0x00000840] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 ++/* [0x00000848] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 ++/* [0x00000850] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 ++/* [0x00000858] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 ++/* [0x00000860] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 ++/* [0x00000868] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 ++/* [0x00000870] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 ++/* [0x00000878] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 ++/* [0x00000880] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 ++/* [0x00000888] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 ++/* [0x00000890] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000898] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000008a0] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000008a8] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000008b0] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif ++/* [0x000008b8] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000008c0] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000008c8] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000008d0] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 ++/* [0x000008d8] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x000008e0] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x000008e8] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 ++/* [0x000008f0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x000008f8] */ 0x00000000, 0xe00208e7, // mov r3, 0 + // :uvloop_b +-/* [0x00000860] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 +-/* [0x00000868] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 +-/* [0x00000870] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 +-/* [0x00000878] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch +-/* [0x00000880] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 +-/* [0x00000888] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 +-/* [0x00000890] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 +-/* [0x00000898] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 +-/* [0x000008a0] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 +-/* [0x000008a8] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 +-/* [0x000008b0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-/* [0x000008b8] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 +-/* [0x000008c0] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 +-/* [0x000008c8] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 +-/* [0x000008d0] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 +-/* [0x000008d8] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 +-/* [0x000008e0] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 +-/* [0x000008e8] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 +-/* [0x000008f0] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 +-/* [0x000008f8] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 +-/* [0x00000900] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 +-/* [0x00000908] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b +-/* [0x00000910] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 +-/* [0x00000918] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 +-/* [0x00000920] */ 0x159e7000, 0x100203e7, // mov ra15, r0 +-/* [0x00000928] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 +-/* [0x00000930] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 +-/* [0x00000938] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 +-/* [0x00000940] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 +-/* [0x00000948] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait +-/* [0x00000950] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 +-/* [0x00000958] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 +-/* [0x00000960] */ 0x0cc27380, 0x10020867, // add r1, r1, vpm +-/* [0x00000968] */ 0x0c7a7380, 0x10020867, // add r1, r1, ra30 +-/* [0x00000970] */ 0xfffffed0, 0xf06809e7, // brr.anyn -, r:uvloop_b +-/* [0x00000978] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 +-/* [0x00000980] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 +-/* [0x00000988] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 +-/* [0x00000990] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 +-/* [0x00000998] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 +-/* [0x000009a0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif +-/* [0x000009a8] */ 0x00000010, 0xe0020827, // mov r0, 16 +-/* [0x000009b0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait +-/* [0x000009b8] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 +-/* [0x000009c0] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 +-/* [0x000009c8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 +-/* [0x000009d0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif ++/* [0x00000900] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 ++/* [0x00000908] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 ++/* [0x00000910] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 ++/* [0x00000918] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch ++/* [0x00000920] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 ++/* [0x00000928] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 ++/* [0x00000930] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 ++/* [0x00000938] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 ++/* [0x00000940] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 ++/* [0x00000948] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 ++/* [0x00000950] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x00000958] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 ++/* [0x00000960] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 ++/* [0x00000968] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 ++/* [0x00000970] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 ++/* [0x00000978] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 ++/* [0x00000980] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 ++/* [0x00000988] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 ++/* [0x00000990] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 ++/* [0x00000998] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 ++/* [0x000009a0] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 ++/* [0x000009a8] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b ++/* [0x000009b0] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 ++/* [0x000009b8] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 ++/* [0x000009c0] */ 0x159e7000, 0x100203e7, // mov ra15, r0 ++/* [0x000009c8] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 ++/* [0x000009d0] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 ++/* [0x000009d8] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 ++/* [0x000009e0] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 ++/* [0x000009e8] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait ++/* [0x000009f0] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 ++/* [0x000009f8] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 ++/* [0x00000a00] */ 0x0cc27380, 0x10020867, // add r1, r1, vpm ++/* [0x00000a08] */ 0x0c7a7380, 0x10020867, // add r1, r1, ra30 ++/* [0x00000a10] */ 0xfffffed0, 0xf06809e7, // brr.anyn -, r:uvloop_b ++/* [0x00000a18] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 ++/* [0x00000a20] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 ++/* [0x00000a28] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 ++/* [0x00000a30] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 ++/* [0x00000a38] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 ++/* [0x00000a40] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif ++/* [0x00000a48] */ 0x00000010, 0xe0020827, // mov r0, 16 ++/* [0x00000a50] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x00000a58] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 ++/* [0x00000a60] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 ++/* [0x00000a68] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 ++/* [0x00000a70] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif + // ::mc_exit +-/* [0x000009d8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait +-/* [0x000009e0] */ 0x00000000, 0xe80009e7, // mov -,srel(0) +-/* [0x000009e8] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x000009f0] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x000009f8] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00000a00] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00000a08] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend +-/* [0x00000a10] */ 0x009e7000, 0x100009e7, // nop ; nop +-/* [0x00000a18] */ 0x009e7000, 0x100009e7, // nop ; nop ++/* [0x00000a78] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x00000a80] */ 0x00000000, 0xe80009e7, // mov -,srel(0) ++/* [0x00000a88] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00000a90] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00000a98] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00000aa0] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00000aa8] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend ++/* [0x00000ab0] */ 0x009e7000, 0x100009e7, // nop ; nop ++/* [0x00000ab8] */ 0x009e7000, 0x100009e7, // nop ; nop + // ::mc_interrupt_exit8 +-/* [0x00000a20] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait +-/* [0x00000a28] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00000a30] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00000a38] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00000a40] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00000a48] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00000a50] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00000a58] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00000a60] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00000a68] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00000a70] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00000a78] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00000a80] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend +-/* [0x00000a88] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop +-/* [0x00000a90] */ 0x009e7000, 0x100009e7, // nop ; nop ++/* [0x00000ac0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x00000ac8] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00000ad0] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00000ad8] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00000ae0] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00000ae8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00000af0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00000af8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00000b00] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00000b08] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00000b10] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00000b18] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00000b20] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend ++/* [0x00000b28] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop ++/* [0x00000b30] */ 0x009e7000, 0x100009e7, // nop ; nop + // ::mc_end + }; + #ifdef __HIGHC__ +diff --git a/libavcodec/rpi_shader.h b/libavcodec/rpi_shader.h +index 99927c4..cec9901 100644 +--- a/libavcodec/rpi_shader.h ++++ b/libavcodec/rpi_shader.h +@@ -4,11 +4,11 @@ + extern unsigned int rpi_shader[]; + + #define mc_setup_uv (rpi_shader + 0) +-#define mc_filter_uv (rpi_shader + 148) +-#define mc_filter_uv_b0 (rpi_shader + 310) +-#define mc_filter_uv_b (rpi_shader + 458) +-#define mc_exit (rpi_shader + 630) +-#define mc_interrupt_exit8 (rpi_shader + 648) +-#define mc_end (rpi_shader + 678) ++#define mc_filter_uv (rpi_shader + 152) ++#define mc_filter_uv_b0 (rpi_shader + 342) ++#define mc_filter_uv_b (rpi_shader + 494) ++#define mc_exit (rpi_shader + 670) ++#define mc_interrupt_exit8 (rpi_shader + 688) ++#define mc_end (rpi_shader + 718) + + #endif +diff --git a/libavcodec/rpi_shader.qasm b/libavcodec/rpi_shader.qasm +index d9ffcda..97c4c02 100644 +--- a/libavcodec/rpi_shader.qasm ++++ b/libavcodec/rpi_shader.qasm +@@ -9,7 +9,12 @@ + # (ra15 isn't clamped to zero - this happens during the + # copy to ra14, and during its use in the vertical filter) + # +-# rb8...rb15 eight vertical filter coefficients ++# rb8...rb11 eight vertical filter coefficients ++ ++# rb12 offset to add before shift ++# rb13 shift ++# rb14 weight (U on left, V on right) ++# rb15 offset (U on left, V on right) + # + # ra16 clipped(row start address+elem_num)&~3 + # ra17 per-channel shifts +@@ -165,6 +170,9 @@ add r2, r2, r0 ; mul24 r1, r1, rb_pitch + add t0s, r0, r1 ; mov ra_x2_base, r2 + add t0s, r2, r1 + ++mov rb12,unif # offset before shift ++mov rb13,unif # offset after shift ++ + # Dump padding words + mov r0, unif + +@@ -231,11 +239,21 @@ asr rb10, r0, rb23; mul24 r0, r0, ra22 + asr rb9, r0, rb23; mul24 r0, r0, ra22 + asr rb8, r0, rb23 + ++mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++ ++mov r0, unif # U offset/weight ++asr rb15, r0, r2 # Compute offset from MSBs ++shl r0, r0, r2 ++asr rb14, r0, r2 # Compute weight from LSBs ++mov r0, unif # V offset/weight ++asr.ifnz rb15, r0, r2 ++shl r0, r0, r2 ++asr.ifnz rb14, r0, r2 ++ + # r2 is elem_num + # r3 is loop counter + + mov r5rep, -8 +-mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] + + # retrieve texture results and pick out bytes + # then submit two more texture requests +@@ -279,6 +297,11 @@ mov ra13, ra14 # Delay slot 1 + mov ra14, ra15 # Delay slot 2 + mov ra15, r0 # Delay slot 3 + ++mov rb12,32 ++mov rb13,6 ++mov rb14,1 ++mov rb15,0 ++ + # apply vertical filter and write to VPM + + nop ; mul24 r1, ra14, rb10 +@@ -288,9 +311,11 @@ add r1, r1, r0 ; mul24 r0, ra15, rb11 + add r1, r1, r0 ; mov -, vw_wait + sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 + asr r1, r1, 14 +-add r1, r1, ra21 ++nop ; mul24 r1, r1, rb14 ++add r1, r1, rb12 ++asr r1, r1, rb13 + brr.anyn -, r:uvloop +-asr r1, r1, 6 # Delay 1 ++add r1, r1, rb15 # Delay 1 + min r1, r1, rb22 # Delay 2 + max vpm, r1, 0 # Delay 3 + +@@ -364,6 +389,9 @@ asr rb10, r0, rb23; mul24 r0, r0, ra22 + asr rb9, r0, rb23; mul24 r0, r0, ra22 + asr rb8, r0, rb23 + ++mov r0, unif # U offset/weight ++mov r0, unif # V offset/weight ++ + # r2 is elem_num + # r3 is loop counter + +@@ -491,6 +519,9 @@ asr rb10, r0, rb23; mul24 r0, r0, ra22 + asr rb9, r0, rb23; mul24 r0, r0, ra22 + asr rb8, r0, rb23 + ++mov r0, unif # U offset/weight ++mov r0, unif # V offset/weight ++ + # r2 is elem_num + # r3 is loop counter + +-- +2.5.0 + + +From b789dfe8032e13b13384315c6e40d59891c1d248 Mon Sep 17 00:00:00 2001 +From: Peter de Rivaz <peter.derivaz@gmail.com> +Date: Tue, 19 May 2015 08:43:30 +0100 +Subject: [PATCH 40/68] Improved ordering of tasks + +--- + libavcodec/hevc.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c +index 98f8461..01898fd 100644 +--- a/libavcodec/hevc.c ++++ b/libavcodec/hevc.c +@@ -2932,15 +2932,15 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) + s->dblk_cmds[s->num_dblk_cmds][0] = x_ctb; + s->dblk_cmds[s->num_dblk_cmds++][1] = y_ctb; + if ( (((y_ctb + ctb_size)&63) == 0) && x_ctb + ctb_size >= s->ps.sps->width) { +-#ifdef RPI_INTER_QPU +- // Kick off inter prediction on QPUs +- rpi_execute_inter_qpu(s); +-#endif + // Transform all blocks + // printf("%d %d %d : %d %d %d %d\n",s->poc, x_ctb, y_ctb, s->num_pred_cmds,s->num_mv_cmds,s->num_coeffs[2] >> 8,s->num_coeffs[3] >> 10); + rpi_execute_transform(s); + // Perform inter prediction + rpi_execute_inter_cmds(s); ++#ifdef RPI_INTER_QPU ++ // Kick off inter prediction on QPUs ++ rpi_execute_inter_qpu(s); ++#endif + // Wait for transform completion + vpu_wait(s->vpu_id); + +-- +2.5.0 + + +From 005310ce2e038c9d9d8d6761b11718d218983975 Mon Sep 17 00:00:00 2001 +From: Peter de Rivaz <peter.derivaz@gmail.com> +Date: Wed, 20 May 2015 19:58:19 +0100 +Subject: [PATCH 41/68] Drafted Luma inter prediction + +--- + libavcodec/rpi_shader.qasm | 594 ++++++++++++++++++++++++++++++++++++++++++--- + 1 file changed, 554 insertions(+), 40 deletions(-) + +diff --git a/libavcodec/rpi_shader.qasm b/libavcodec/rpi_shader.qasm +index 97c4c02..9cfc0d9 100644 +--- a/libavcodec/rpi_shader.qasm ++++ b/libavcodec/rpi_shader.qasm +@@ -2,7 +2,10 @@ + # + # ra0...ra7 eight horizontal filter coefficients + # +-# rb1...rb7 seven shifted copies of the current unfiltered row ++# rb0 rx_shift2 ++# rb1 ra_y2_next ++# ++# rb4...rb7 + # + # ra8...ra15 eight filtered rows of context (rb15 == most recent) + # +@@ -26,9 +29,9 @@ + # rb19 next ra16 + # + # ra20 1 +-# ra21 32 ++# ra21 ra_21 + # ra22 256 +-# ra23 8 ++# ra23 rx_shift2_next + # + # rb20 0xffffff00 + # rb21 vpm_setup for reading/writing 16bit results into VPM +@@ -57,16 +60,23 @@ + .set rb_frame_width_minus_1, rb25 + .set rb_frame_height_minus_1, rb30 + .set rb_pitch, rb16 +-.set ra_x_base, ra16 +-.set rb_x_base_next, rb19 +-.set ra_x2_base, ra24 +-.set ra_x2_base_next, ra26 ++.set ra_x, ra16 ++.set ra_y2, ra21 ++.set ra_y2_next, rb1 ++ ++.set rb_x_next, rb19 ++.set rx_frame_base2_next, rb19 ++ ++.set ra_frame_base, ra24 ++.set ra_frame_base_next, ra26 + .set ra_xshift, ra17 + +-.set ra_x2shift, ra25 + .set ra_u2v_ref_offset, ra25 ++.set ra_frame_base2, ra25 + + .set ra_xshift_next, ra19 ++.set rx_xshift2, rb0 ++.set rx_xshift2_next, ra23 + + .set ra_x2shift_next, ra27 + .set ra_u2v_dst_offset, ra27 +@@ -83,11 +93,11 @@ + mov ra31, unif + + # Load first request location +-add ra_x_base, unif, elem_num # Store x ++add ra_x, unif, elem_num # Store x + mov ra_y, unif # Store y +-mov ra_x2_base, unif # Store frame u base ++mov ra_frame_base, unif # Store frame u base + nop +-sub ra_u2v_ref_offset, unif, ra_x2_base # Store offset to add to move from u to v in reference frame ++sub ra_u2v_ref_offset, unif, ra_frame_base # Store offset to add to move from u to v in reference frame + + # Read image dimensions + sub rb25,unif,1 +@@ -104,9 +114,7 @@ add rb24, r1, r0 + # load constants + + mov ra20, 1 +-mov ra21, 32 + mov ra22, 256 +-mov ra23, 8 + mov ra30, 64 + + mov rb20, 0xffffff00 +@@ -156,18 +164,18 @@ mov r1, vpm_setup(0, 2, h16p(0, 0)) # 2 is stride - stride acts on ADDR which i + add rb21, r0, r1 + + # Compute base address for first and second access +-mov r0, ra_x_base # Load x ++mov r0, ra_x # Load x + max r0, r0, 0; mov r1, ra_y # Load y +-min r0, r0, rb_frame_width_minus_1 ; mov r3, ra_x2_base # Load the frame base ++min r0, r0, rb_frame_width_minus_1 ; mov r3, ra_frame_base # Load the frame base + shl ra_xshift_next, r0, 3 ; mov r2, ra_u2v_ref_offset + add ra_y, r1, 1 + add r0, r0, r3 + and r0, r0, ~3 +-max r1, r1, 0 ; mov ra_x_base, r0 # y ++max r1, r1, 0 ; mov ra_x, r0 # y + min r1, r1, rb_frame_height_minus_1 + # submit texture requests for first line + add r2, r2, r0 ; mul24 r1, r1, rb_pitch +-add t0s, r0, r1 ; mov ra_x2_base, r2 ++add t0s, r0, r1 ; mov ra_frame_base, r2 + add t0s, r2, r1 + + mov rb12,unif # offset before shift +@@ -182,8 +190,8 @@ min r1, r1, rb_frame_height_minus_1 + add ra_y, ra_y, 1 + bra -, ra31 + nop ; mul24 r1, r1, rb_pitch +-add t0s, r1, ra_x_base +-add t0s, r1, ra_x2_base ++add t0s, r1, ra_x ++add t0s, r1, ra_frame_base + + + +@@ -192,7 +200,7 @@ add t0s, r1, ra_x2_base + # mc_filter_uv(next_kernel, x, y, frame_u_base, frame_v_base, height, hcoeffs[0], hcoeffs[1], vcoeffs[0], vcoeffs[1], this_u_dst, this_v_dst) + + # At this point we have already issued two pairs of texture requests for the current block +-# ra_x_base, ra_x16_base point to the current coordinates for this block ++# ra_x, ra_x16_base point to the current coordinates for this block + ::mc_filter_uv + mov ra31, unif + +@@ -207,9 +215,9 @@ min r0, r0, rb_frame_width_minus_1 ; mov r3, unif # frame_base + shl ra_xshift_next, r0, 3 + sub r2, unif, r3 # compute offset from frame base u to frame base v + add r0, r0, r3 +-and rb_x_base_next, r0, ~3 ++and rb_x_next, r0, ~3 + mov ra_y_next, r1 +-add ra_x2_base_next, rb_x_base_next, r2 ++add ra_frame_base_next, rb_x_next, r2 + + # set up VPM write + mov vw_setup, rb28 +@@ -265,16 +273,16 @@ mov r3, 0 + # then submit two more texture requests + + sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 # loop counter increment +-shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 +-mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 ++shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu0 ++mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 + mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch + shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 # v8subs masks out all but bottom byte + + max r2, ra_y, 0 # y + min r2, r2, rb_frame_height_minus_1 + add ra_y, ra_y, 1 ; mul24 r2, r2, r3 +-add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 +-add t0s, ra_x2_base, r2 ++add t0s, ra_x, r2 ; v8subs r1, r1, rb20 ++add t0s, ra_frame_base, r2 + + # generate seven shifted versions + # interleave with scroll of vertical context +@@ -297,7 +305,7 @@ mov ra13, ra14 # Delay slot 1 + mov ra14, ra15 # Delay slot 2 + mov ra15, r0 # Delay slot 3 + +-mov rb12,32 ++mov rb12,32 # TODO remove these to make P weighted prediction work properly + mov rb13,6 + mov rb14,1 + mov rb15,0 +@@ -342,7 +350,7 @@ mov vw_addr, unif # start the VDW + # mc_filter_uv_b0(next_kernel, x, y, frame_u_base, frame_v_base, height, hcoeffs[0], hcoeffs[1], vcoeffs[0], vcoeffs[1], this_u_dst, this_v_dst) + + # At this point we have already issued two pairs of texture requests for the current block +-# ra_x_base, ra_x16_base point to the current coordinates for this block ++# ra_x, ra_x16_base point to the current coordinates for this block + ::mc_filter_uv_b0 + mov ra31, unif + +@@ -357,9 +365,9 @@ min r0, r0, rb_frame_width_minus_1 ; mov r3, unif # frame_base + shl ra_xshift_next, r0, 3 + sub r2, unif, r3 # compute offset from frame base u to frame base v + add r0, r0, r3 +-and rb_x_base_next, r0, ~3 ++and rb_x_next, r0, ~3 + mov ra_y_next, r1 +-add ra_x2_base_next, rb_x_base_next, r2 ++add ra_frame_base_next, rb_x_next, r2 + + # set up VPM write, we need to save 16bit precision + mov vw_setup, rb21 +@@ -408,16 +416,16 @@ mov r3, 0 + # then submit two more texture requests + + sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 # loop counter increment +-shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 +-mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 ++shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu0 ++mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 + mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch + shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 # v8subs masks out all but bottom byte + + max r2, ra_y, 0 # y + min r2, r2, rb_frame_height_minus_1 + add ra_y, ra_y, 1 ; mul24 r2, r2, r3 +-add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 +-add t0s, ra_x2_base, r2 ++add t0s, ra_x, r2 ; v8subs r1, r1, rb20 ++add t0s, ra_frame_base, r2 + + # generate seven shifted versions + # interleave with scroll of vertical context +@@ -477,9 +485,9 @@ min r0, r0, rb_frame_width_minus_1 ; mov r3, unif # frame_base + shl ra_xshift_next, r0, 3 + sub r2, unif, r3 # compute offset from frame base u to frame base v + add r0, r0, r3 +-and rb_x_base_next, r0, ~3 ++and rb_x_next, r0, ~3 + mov ra_y_next, r1 +-add ra_x2_base_next, rb_x_base_next, r2 ++add ra_frame_base_next, rb_x_next, r2 + + # set up VPM write + mov vw_setup, rb28 +@@ -538,16 +546,16 @@ mov r3, 0 + # then submit two more texture requests + + sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 # loop counter increment +-shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 +-mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 ++shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu0 ++mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 + mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch + shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 # v8subs masks out all but bottom byte + + max r2, ra_y, 0 # y + min r2, r2, rb_frame_height_minus_1 + add ra_y, ra_y, 1 ; mul24 r2, r2, r3 +-add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 +-add t0s, ra_x2_base, r2 ++add t0s, ra_x, r2 ; v8subs r1, r1, rb20 ++add t0s, ra_frame_base, r2 + + # generate seven shifted versions + # interleave with scroll of vertical context +@@ -642,5 +650,511 @@ nop ; nop ; thrend + mov interrupt, 1; nop # delay slot 1 + nop ; nop # delay slot 2 + ++ ++ ++ ++ ++# LUMA CODE ++ ++# The idea is to form B predictions by doing 8 pixels from ref0 in parallel with 8 pixels from ref1. ++# For P frames we make the second x,y coordinates offset by +8 ++ ++################################################################################ ++# mc_setup(next_kernel, x, y, ref_y_base, x2, y2, ref_y2_base, frame_width, frame_height, pitch, dst_pitch, offset, shift, pad2) ++::mc_setup ++ ++# Read starting kernel ++mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++mov ra31, unif ++ ++# Compute base address for first and second access ++add r0, unif, elem_num # Load x ++max r0, r0, 0; mov r1, unif # Load y ++min r0, r0, rb_frame_width_minus_1 ; mov r2, unif # Load the frame base ++shl ra_xshift_next, r0, 3 # Compute shifts ++add ra_y, r1, 1 ++and r0, r0, ~3 # r0 gives the clipped and aligned x coordinate ++add r2, r2, r0 # r2 is address for frame0 (not including y offset) ++max r1, r1, 0 ++min r1, r1, rb_frame_height_minus_1 ++nop ; mul24 r1, r1, rb_pitch # r2 contains the addresses (not including y offset) for frame0 ++add t0s, r2, r1 ; mov ra_frame_base, r2 ++ ++add r0, unif, elem_num # Load x ++max r0, r0, 0; mov r1, unif # Load y ++min r0, r0, rb_frame_width_minus_1 ; mov r2, unif # Load the frame base ++shl rx_xshift2_next, r0, 3 # Compute shifts ++add ra_y2, r1, 1 ++and r0, r0, ~3 # r0 gives the clipped and aligned x coordinate ++add r2, r2, r0 # r2 is address for frame1 (not including y offset) ++max r1, r1, 0 ++min r1, r1, rb_frame_height_minus_1 ++nop ; mul24 r1, r1, rb_pitch # r2 contains the addresses (not including y offset) for frame0 ++add t0s, r2, r1 ; mov ra_frame_base2, r2 ++ ++ ++# Read image dimensions ++sub rb25,unif,1 ++sub rb30,unif,1 ++ ++# get source pitch ++mov rb16, unif ++ ++# get destination pitch ++mov r0, unif ++mov r1, vdw_setup_1(0) ++add rb24, r1, r0 ++ ++# load constants ++ ++mov ra20, 1 ++mov ra22, 256 ++mov ra30, 64 ++ ++mov rb20, 0xffffff00 ++mov rb22, 255 ++mov rb23, 24 ++ ++# touch vertical context to keep simulator happy ++ ++mov ra8, 0 ++mov ra9, 0 ++mov ra10, 0 ++mov ra11, 0 ++mov ra12, 0 ++mov ra13, 0 ++mov ra14, 0 ++mov ra15, 0 ++ ++# Compute part of VPM to use for DMA output ++mov r2, qpu_num ++mov r1, r2 ++asr r1, r1, 2 ++shl r1, r1, 6 ++mov r0, r2 ++and r0, r0, 3 ++add r0, r0, r1 ++mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) # height,width added later ++shl r0, r0, 5 ++add rb27, r0, r1 ++ ++# Compute part of VPM to save data into ++mov r2, qpu_num # qpu_num = abcd ++mov r1, r2 ++asr r1, r1, 2 ++shl r1, r1, 6 ++mov r0, r2 ++and r0, r0, 3 ++add r0, r0, r1 ++mov r1, vpm_setup(0, 4, h8p(0, 0)) # 4 is stride - stride acts on ADDR which is Y[5:0],B[1:0] for 8 bit ++add rb28, r0, r1 ++ ++mov rb12,unif # offset before shift ++mov rb13,unif # shift ++ ++# Dump padding words ++mov r0, unif ++ ++# submit texture requests for second line ++max r1, ra_y, 0 ++min r1, r1, rb_frame_height_minus_1 ++add ra_y, ra_y, 1 ++nop ; mul24 r1, r1, rb_pitch ++add t0s, r1, ra_frame_base ++ ++max r1, ra_y2, 0 ++min r1, r1, rb_frame_height_minus_1 ++bra -, ra31 ++add ra_y2, ra_y2, 1 # Delay 1 ++nop ; mul24 r1, r1, rb_pitch # Delay 2 ++add t0s, r1, ra_frame_base2 # Delay 3 ++ ++ ++################################################################################ ++ ++# mc_filter(next_kernel, x, y, frame_base, x2, y2, frame_base2, height, hcoeffs[0], hcoeffs2[0], hcoeffs[1], hcoeffs2[1], vcoeffs[0], vcoeffs2[0], vcoeffs[1], vcoeffs2[1], offsetweight0, offsetweight1, this_dst) ++# In a P block, only the first half of coefficients contain used information. ++# At this point we have already issued two pairs of texture requests for the current block ++# ra_x, ra_x16_base point to the current coordinates for this block ++::mc_filter ++mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++mov ra31, unif ++ ++# per-channel shifts were calculated on the *previous* invocation ++ ++mov ra_xshift, ra_xshift_next ++mov rx_xshift2, rx_xshift2_next ++ ++# get base addresses and per-channel shifts for *next* invocation ++add r0, unif, elem_num # Load x ++max r0, r0, 0; mov r1, unif # Load y ++min r0, r0, rb_frame_width_minus_1 ; mov r2, unif # Load the frame base ++shl ra_xshift_next, r0, 3 # Compute shifts ++mov ra_y_next, r1 ++and r0, r0, ~3 # r0 gives the clipped and aligned x coordinate ++add ra_frame_base_next, r2, r0 # r2 is address for frame0 (not including y offset) ++ ++add r0, unif, elem_num # Load x ++max r0, r0, 0 ; mov r1, unif # Load y ++min r0, r0, rb_frame_width_minus_1 ; mov r2, unif # Load the frame base ++shl rx_xshift2_next, r0, 3 # Compute shifts ++add ra_y2_next, r1, 1 ++and r0, r0, ~3 # r0 gives the clipped and aligned x coordinate ++add rx_frame_base2_next, r2, r0 # r2 is address for frame1 (not including y offset) ++ ++ ++# set up VPM write ++mov vw_setup, rb28 ++ ++# get width,height of block ++mov r2, 16 ++mov r0, unif ++shr r1, r0, r2 # Extract width ++sub rb29, rb24, r1 # Compute vdw_setup1(dst_pitch-width) ++and r0, r0, rb22 # Extract height ++add rb17, r0, 5 ++add rb18, r0, 7 ++shl r0, r0, 7 ++add r0, r0, r1 # Combine width and height of destination area ++shl r0, r0, r2 # Shift into bits 16 upwards of the vdw_setup0 register ++add rb26, r0, rb27 ++ ++# get filter coefficients and discard unused B frame values ++mov r0, unif ++mov.ifnz -, unif # Alternate coefficients are unused for P frames ++asr ra3, r0, rb23; mul24 r0, r0, ra22 # These may need some pre-rotation to be used in B frames correctly ++asr ra2, r0, rb23; mul24 r0, r0, ra22 ++asr ra1, r0, rb23; mul24 r0, r0, ra22 ++asr ra0, r0, rb23; mov r0, unif ++mov.ifnz -, unif ++asr ra7, r0, rb23; mul24 r0, r0, ra22 ++asr ra6, r0, rb23; mul24 r0, r0, ra22 ++asr ra5, r0, rb23; mul24 r0, r0, ra22 ++asr ra4, r0, rb23; mov r0, unif ++mov.ifnz -, unif ++asr rb11, r0, rb23; mul24 r0, r0, ra22 ++asr rb10, r0, rb23; mul24 r0, r0, ra22 ++asr rb9, r0, rb23; mul24 r0, r0, ra22 ++asr rb8, r0, rb23; mov r0, unif ++mov.ifnz -, unif ++asr rb7, r0, rb23; mul24 r0, r0, ra22 ++asr rb6, r0, rb23; mul24 r0, r0, ra22 ++asr rb5, r0, rb23; mul24 r0, r0, ra22 ++asr rb4, r0, rb23 ++ ++mov r0, unif # Frame0 offset/weight ++mov.ifnz -, unif # Frame1 offset/weight unused ++asr rb15, r0, r2 # Compute offset from MSBs ++shl r0, r0, r2 ++asr rb14, r0, r2 # Compute weight from LSBs ++ ++# r3 is loop counter ++ ++# retrieve texture results and pick out bytes ++# then submit two more texture requests ++ ++mov r3, 0 ++ ++:yloop ++# retrieve texture results and pick out bytes ++# then submit two more texture requests ++ ++# If we knew there was no clipping then this code would get simpler. ++# Perhaps we could add on the pitch and clip using larger values? ++ ++sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 ++shr r0, r4, ra_xshift ; mov.ifz ra_frame_base2, rx_frame_base2_next ; ldtmu0 ++mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 ++mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch ++shr r1, r4, rx_xshift2 ++mov.ifz ra_y2, ra_y2_next ++ ++max r2, ra_y, 0 # y ++min r2, r2, rb_frame_height_minus_1 ++add ra_y, ra_y, 1 ; mul24 r2, r2, r3 ++add t0s, ra_frame_base, r2 ; v8subs r0, r0, rb20 # v8subs masks out all but bottom byte ++ ++max r2, ra_y2, 0 # y ++min r2, r2, rb_frame_height_minus_1 ++add ra_y2, ra_y2, 1 ; mul24 r2, r2, r3 ++add t0s, ra_frame_base2, r2 ; v8subs r0, r0, rb20 ++ ++ ++# generate seven shifted versions ++# interleave with scroll of vertical context ++ ++mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++ ++# apply horizontal filter ++nop ; mul24 r2, r0, ra0 ++nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 ++nop ; mul24 r3, ra1 << 1, r0 << 1 ++nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 ++add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 ++nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 ++add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 ++nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 ++add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 ++nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 ++add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 ++nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 ++add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 ++nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 ++add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 ++nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 ++add r0, r2, r3 ; mov r3, rb31 ++sub.setf -, r3, 8 ; mov ra12, ra13 ++mov ra9, ra10 ++mov ra10, ra11 ++mov ra11, ra12 ++mov ra12, ra13 ++brr.anyn -, r:yloop ++mov ra13, ra14 # Delay slot 1 ++mov ra14, ra15 # Delay slot 2 ++mov ra15, r0 # Delay slot 3 ++ ++# apply vertical filter and write to VPM ++ ++nop ; mul24 r1, ra14, rb10 ++nop ; mul24 r0, ra13, rb9 ++add r1, r1, r0 ; mul24 r0, ra12, rb8 ++add r1, r1, r0 ; mul24 r0, ra15, rb11 ++add r1, r1, r0 ; mul24 r0, ra8, rb4 ++add r1, r1, r0 ; mul24 r0, ra9, rb5 ++add r1, r1, r0 ; mul24 r0, ra10, rb6 ++add r1, r1, r0 ; mul24 r0, ra11, rb7 ++ ++add r1, r1, r0 ; mov -, vw_wait ++sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 ++asr r1, r1, 14 ++nop ; mul24 r1, r1, rb14 ++add r1, r1, rb12 ++asr r1, r1, rb13 ++brr.anyn -, r:yloop ++add r1, r1, rb15 # Delay 1 ++min r1, r1, rb22 # Delay 2 ++max vpm, r1, 0 # Delay 3 ++ ++# DMA out ++ ++bra -, ra31 ++mov vw_setup, rb26 # VDW setup 0 Delay 1 ++mov vw_setup, rb29 # Stride Delay 2 ++mov vw_addr, unif # start the VDW Delay 3 ++ ++ ++ ++################################################################################ ++ ++# mc_filter_b(next_kernel, x, y, frame_base, x2, y2, frame_base2, width_height, hcoeffs[0], hcoeffs2[0], hcoeffs[1], hcoeffs2[1], vcoeffs[0], vcoeffs2[0], vcoeffs[1], vcoeffs2[1], offsetweight0, offsetweight1, this_dst) ++# In a P block, only the first half of coefficients contain used information. ++# At this point we have already issued two pairs of texture requests for the current block ++# May be better to just send 16.16 motion vector and figure out the coefficients inside this block (only 4 cases so can compute hcoeffs in around 24 cycles?) ++# Can fill in the coefficients so only ++# Can also assume default weighted prediction for B frames. ++# Perhaps can unpack coefficients in a more efficient manner by doing H/V for a and b at the same time? ++# Or possibly by taking advantage of symmetry? ++# From 19->7 32bits per command. ++::mc_filter_b ++mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++mov ra31, unif ++ ++# per-channel shifts were calculated on the *previous* invocation ++ ++mov ra_xshift, ra_xshift_next ++mov rx_xshift2, rx_xshift2_next ++ ++# get base addresses and per-channel shifts for *next* invocation ++add r0, unif, elem_num # Load x ++max r0, r0, 0; mov r1, unif # Load y ++min r0, r0, rb_frame_width_minus_1 ; mov r2, unif # Load the frame base ++shl ra_xshift_next, r0, 3 # Compute shifts ++mov ra_y_next, r1 ++and r0, r0, ~3 # r0 gives the clipped and aligned x coordinate ++add ra_frame_base_next, r2, r0 # r2 is address for frame0 (not including y offset) ++ ++add r0, unif, elem_num # Load x ++max r0, r0, 0 ; mov r1, unif # Load y ++min r0, r0, rb_frame_width_minus_1 ; mov r2, unif # Load the frame base ++shl rx_xshift2_next, r0, 3 # Compute shifts ++add ra_y2_next, r1, 1 ++and r0, r0, ~3 # r0 gives the clipped and aligned x coordinate ++add rx_frame_base2_next, r2, r0 # r2 is address for frame1 (not including y offset) ++ ++ ++# set up VPM write ++mov vw_setup, rb28 ++ ++# get width,height of block ++mov r2, 16 ++mov r0, unif ++shr r1, r0, r2 # Extract width ++sub rb29, rb24, r1 # Compute vdw_setup1(dst_pitch-width) ++and r0, r0, rb22 # Extract height ++add rb17, r0, 5 ++add rb18, r0, 7 ++shl r0, r0, 7 ++add r0, r0, r1 # Combine width and height of destination area ++shl r0, r0, r2 # Shift into bits 16 upwards of the vdw_setup0 register ++add rb26, r0, rb27 ++ ++# get filter coefficients and discard unused B frame values ++mov r0, unif ++mov r1, 1 ++mov.ifnz r0, unif # Alternate coefficients are unused for P frames ++nop ; mul24 r0, r0 << 13, r1 << 13 ++asr ra3, r0, rb23; mul24 r0, r0, ra22 ++nop ; mul24 r0, r0 << 14, r1 << 14 ++asr ra2, r0, rb23; mul24 r0, r0, ra22 ++nop ; mul24 r0, r0 << 15, r1 << 15 # Adjust such that a rotate of 1 will produce the values with first 8 on left, second 8 on right ++asr ra1, r0, rb23; mul24 r0, r0, ra22 ++asr ra0, r0, rb23; mov r0, unif ++mov.ifnz r0, unif ++nop ; mul24 r0, r0 << 9, r1 << 9 ++asr ra7, r0, rb23; mul24 r0, r0, ra22 ++nop ; mul24 r0, r0 << 10, r1 << 10 ++asr ra6, r0, rb23; mul24 r0, r0, ra22 ++nop ; mul24 r0, r0 << 11, r1 << 11 ++asr ra5, r0, rb23; mul24 r0, r0, ra22 ++nop ; mul24 r0, r0 << 12, r1 << 12 ++asr ra4, r0, rb23; mov r0, unif ++mov.ifnz r0, unif ++asr rb11, r0, rb23; mul24 r0, r0, ra22 ++asr rb10, r0, rb23; mul24 r0, r0, ra22 ++asr rb9, r0, rb23; mul24 r0, r0, ra22 ++asr rb8, r0, rb23; mov r0, unif ++mov.ifnz r0, unif ++asr rb7, r0, rb23; mul24 r0, r0, ra22 ++asr rb6, r0, rb23; mul24 r0, r0, ra22 ++asr rb5, r0, rb23; mul24 r0, r0, ra22 ++asr rb4, r0, rb23 ++ ++mov r0, unif # Frame0 offset/weight ++mov.ifnz r0, unif # Frame1 offset/weight unused ++asr rb15, r0, r2 # Compute offset from MSBs ++shl r0, r0, r2 ++asr rb14, r0, r2 # Compute weight from LSBs ++ ++# r3 is loop counter ++ ++# retrieve texture results and pick out bytes ++# then submit two more texture requests ++ ++mov r3, 0 ++ ++:yloopb ++# retrieve texture results and pick out bytes ++# then submit two more texture requests ++ ++# If we knew there was no clipping then this code would get simpler. ++# Perhaps we could add on the pitch and clip using larger values? ++ ++sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 ++shr r0, r4, ra_xshift ; mov.ifz ra_frame_base2, rx_frame_base2_next ; ldtmu0 ++mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 ++mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch ++shr r1, r4, rx_xshift2 ++mov.ifz ra_y2, ra_y2_next ++ ++max r2, ra_y, 0 # y ++min r2, r2, rb_frame_height_minus_1 ++add ra_y, ra_y, 1 ; mul24 r2, r2, r3 ++add t0s, ra_frame_base, r2 ; v8subs r0, r0, rb20 # v8subs masks out all but bottom byte ++ ++max r2, ra_y2, 0 # y ++min r2, r2, rb_frame_height_minus_1 ++add ra_y2, ra_y2, 1 ; mul24 r2, r2, r3 ++add t0s, ra_frame_base2, r2 ; v8subs r0, r0, rb20 ++ ++ ++# generate seven shifted versions ++# interleave with scroll of vertical context ++ ++mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++ ++# apply horizontal filter ++nop ; mul24 r2, r0, ra0 ++nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 ++nop ; mul24 r3, ra1 << 1, r0 << 1 ++nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 ++add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 ++nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 ++add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 ++nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 ++add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 ++nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 ++add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 ++nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 ++add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 ++nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 ++add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 ++nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 ++add r0, r2, r3 ; mov r3, rb31 ++sub.setf -, r3, 8 ; mov ra12, ra13 ++mov ra9, ra10 ++mov ra10, ra11 ++mov ra11, ra12 ++mov ra12, ra13 ++brr.anyn -, r:yloopb ++mov ra13, ra14 # Delay slot 1 ++mov ra14, ra15 # Delay slot 2 ++mov ra15, r0 # Delay slot 3 ++ ++# apply vertical filter and write to VPM ++ ++nop ; mul24 r1, ra14, rb10 ++nop ; mul24 r0, ra13, rb9 ++add r1, r1, r0 ; mul24 r0, ra12, rb8 ++add r1, r1, r0 ; mul24 r0, ra15, rb11 ++add r1, r1, r0 ; mul24 r0, ra8, rb4 ++add r1, r1, r0 ; mul24 r0, ra9, rb5 ++add r1, r1, r0 ; mul24 r0, ra10, rb6 ++add r1, r1, r0 ; mul24 r0, ra11, rb7 ++ ++add r1, r1, r0 ; mov -, vw_wait ++sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 ++asr r1, r1, 14 ++nop ; mul24 r1, r1 << 8, ra20 << 8 # Rotate to align left and right halves ++add r1, r1, ra30 ; mul24 r0, r1, rb14 ++add r1, r1, r0 ++brr.anyn -, r:yloopb ++asr r1, r1, 7 # Delay 1 ++min r1, r1, rb22 # Delay 2 ++max vpm, r1, 0 # Delay 3 ++ ++# DMA out ++bra -, ra31 ++mov vw_setup, rb26 # VDW setup 0 Delay 1 ++mov vw_setup, rb29 # Stride Delay 2 ++mov vw_addr, unif # start the VDW Delay 3 ++ ++################################################################################ ++ ++# mc_interrupt_exit12() ++::mc_interrupt_exit12 ++mov -, vw_wait # wait on the VDW ++ ++ldtmu0 ++ldtmu0 ++ldtmu0 ++ldtmu0 ++ ++mov -,sacq(0) # 1 ++mov -,sacq(0) # 2 ++mov -,sacq(0) # 3 ++mov -,sacq(0) # 4 ++mov -,sacq(0) # 5 ++mov -,sacq(0) # 6 ++mov -,sacq(0) # 7 ++mov -,sacq(0) # 8 ++mov -,sacq(0) # 9 ++mov -,sacq(0) # 10 ++mov -,sacq(0) # 11 ++ ++nop ; nop ; thrend ++mov interrupt, 1; nop # delay slot 1 ++nop ; nop # delay slot 2 ++ ++ + ::mc_end + # Do not add code here because mc_end must appear after all other code. +-- +2.5.0 + + +From e6e832826a1f27e07c1c9ff48e0690fe4a732dd3 Mon Sep 17 00:00:00 2001 +From: Peter de Rivaz <peter.derivaz@gmail.com> +Date: Wed, 20 May 2015 19:58:30 +0100 +Subject: [PATCH 42/68] Added support for fast cache flush in deblocker + +--- + libavcodec/hevc_filter.c | 44 +- + libavcodec/rpi_qpu.c | 6 + + libavcodec/rpi_qpu.h | 2 + + libavcodec/rpi_shader.c | 1028 +++++++++++++++++++++++++++++--------------- + libavcodec/rpi_shader.h | 16 +- + libavcodec/rpi_user_vcsm.h | 22 + + 6 files changed, 768 insertions(+), 350 deletions(-) + +diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c +index 92a8271..186317a 100644 +--- a/libavcodec/hevc_filter.c ++++ b/libavcodec/hevc_filter.c +@@ -37,6 +37,11 @@ + + #include "bit_depth_template.c" + ++#ifdef RPI ++#include "rpi_user_vcsm.h" ++#include "rpi_qpu.h" ++#endif ++ + #define LUMA 0 + #define CB 1 + #define CR 2 +@@ -872,15 +877,46 @@ static void flush_buffer(AVBufferRef *bref) { + gpu_cache_flush(p); + } + +-static void ff_hevc_flush_chroma(HEVCContext *s) ++// Return Physical address for this image ++static int ff_hevc_buf_base(AVBufferRef *bref) { ++ GPU_MEM_PTR_T *p = av_buffer_pool_opaque(bref); ++ return p->vc & 0x3fffffff; ++} ++ ++static void ff_hevc_flush_chroma(HEVCContext *s, ThreadFrame *f, int n) + { + if (s->enable_rpi && !( s->nal_unit_type == NAL_TRAIL_N || + s->nal_unit_type == NAL_TSA_N || + s->nal_unit_type == NAL_STSA_N || + s->nal_unit_type == NAL_RADL_N || + s->nal_unit_type == NAL_RASL_N )) { ++#define RPI_FAST_CACHEFLUSH ++#ifdef RPI_FAST_CACHEFLUSH ++ struct vcsm_user_clean_invalid_s iocache = {}; ++ int curr_y = f->progress->data[0]; ++ int sz,base; ++ if (curr_y < 0) curr_y = 0; ++ if (n<=curr_y) return; // Should not happen ++ sz = s->frame->linesize[1] * (n-curr_y); ++ base = s->frame->linesize[1] * curr_y; ++ iocache.s[0].cmd = 3; // Flush L1 cache ++ iocache.s[0].addr = 0; ++ iocache.s[0].size = 0; ++ ++ iocache.s[1].cmd = 2; ++ iocache.s[1].addr = ff_hevc_buf_base(s->frame->buf[1]) + base; ++ iocache.s[1].size = sz; ++ ++ iocache.s[2].cmd = 2; ++ iocache.s[2].addr = ff_hevc_buf_base(s->frame->buf[2]) + base; ++ iocache.s[2].size = sz; ++ ++ vcsm_clean_invalid( gpu_get_mailbox(), &iocache ); ++ ++#else + flush_buffer(s->frame->buf[1]); + flush_buffer(s->frame->buf[2]); ++#endif + //memcpy(s->dummy.arm,s->frame->data[0],2048*64); + //memcpy(s->dummy.arm,s->frame->data[1],1024*32); + //memcpy(s->dummy.arm,s->frame->data[2],1024*32); +@@ -903,7 +939,7 @@ void ff_hevc_hls_filter(HEVCContext *s, int x, int y, int ctb_size) + sao_filter_CTB(s, x, y - ctb_size); + if (s->threads_type & FF_THREAD_FRAME ) { + #ifdef RPI_INTER_QPU +- ff_hevc_flush_chroma(s); ++ ff_hevc_flush_chroma(s,&s->ref->tf, y); + #endif + ff_thread_report_progress(&s->ref->tf, y, 0); + } +@@ -912,7 +948,7 @@ void ff_hevc_hls_filter(HEVCContext *s, int x, int y, int ctb_size) + sao_filter_CTB(s, x , y); + if (s->threads_type & FF_THREAD_FRAME ) { + #ifdef RPI_INTER_QPU +- ff_hevc_flush_chroma(s); ++ ff_hevc_flush_chroma(s, &s->ref->tf, y + ctb_size); + #endif + ff_thread_report_progress(&s->ref->tf, y + ctb_size, 0); + } +@@ -922,7 +958,7 @@ void ff_hevc_hls_filter(HEVCContext *s, int x, int y, int ctb_size) + //int currh = s->ref->tf.progress->data[0]; + //if (((y + ctb_size)&63)==0) + #ifdef RPI_INTER_QPU +- ff_hevc_flush_chroma(s); ++ ff_hevc_flush_chroma(s, &s->ref->tf, y + ctb_size - 4); + #endif + ff_thread_report_progress(&s->ref->tf, y + ctb_size - 4, 0); + } +diff --git a/libavcodec/rpi_qpu.c b/libavcodec/rpi_qpu.c +index f62051f..fd8a276 100644 +--- a/libavcodec/rpi_qpu.c ++++ b/libavcodec/rpi_qpu.c +@@ -237,6 +237,12 @@ int gpu_malloc_uncached(int numbytes, GPU_MEM_PTR_T *p) + return r; + } + ++int gpu_get_mailbox(void) ++{ ++ assert(gpu); ++ return gpu->mb; ++} ++ + void gpu_cache_flush(GPU_MEM_PTR_T *p) + { + void *tmp = vcsm_lock(p->vcsm_handle); +diff --git a/libavcodec/rpi_qpu.h b/libavcodec/rpi_qpu.h +index 543c84b..88965e5 100644 +--- a/libavcodec/rpi_qpu.h ++++ b/libavcodec/rpi_qpu.h +@@ -49,4 +49,6 @@ extern int rpi_test_shader(void); + extern void rpi_do_block(const unsigned char *in_buffer_vc, int src_pitch, unsigned char *dst_vc, int dst_pitch, unsigned char *dst); + extern void rpi_do_block_arm(const unsigned char *in_buffer, int src_pitch, unsigned char *dst, int dst_pitch); + ++extern int gpu_get_mailbox(void); ++ + #endif +diff --git a/libavcodec/rpi_shader.c b/libavcodec/rpi_shader.c +index 3f04d80..9c30e32 100644 +--- a/libavcodec/rpi_shader.c ++++ b/libavcodec/rpi_shader.c +@@ -23,11 +23,11 @@ __attribute__((aligned(8))) + unsigned int rpi_shader[] = { + // ::mc_setup_uv + /* [0x00000000] */ 0x15827d80, 0x100207e7, // mov ra31, unif +-/* [0x00000008] */ 0x0c9a0f80, 0x10020427, // add ra_x_base, unif, elem_num ++/* [0x00000008] */ 0x0c9a0f80, 0x10020427, // add ra_x, unif, elem_num + /* [0x00000010] */ 0x15827d80, 0x10020767, // mov ra_y, unif +-/* [0x00000018] */ 0x15827d80, 0x10020627, // mov ra_x2_base, unif ++/* [0x00000018] */ 0x15827d80, 0x10020627, // mov ra_frame_base, unif + /* [0x00000020] */ 0x009e7000, 0x100009e7, // nop +-/* [0x00000028] */ 0x0d620f80, 0x10020667, // sub ra_u2v_ref_offset, unif, ra_x2_base ++/* [0x00000028] */ 0x0d620f80, 0x10020667, // sub ra_u2v_ref_offset, unif, ra_frame_base + /* [0x00000030] */ 0x0d801dc0, 0xd0021667, // sub rb25,unif,1 + /* [0x00000038] */ 0x0d801dc0, 0xd00217a7, // sub rb30,unif,1 + /* [0x00000040] */ 0x15827d80, 0x10021427, // mov rb16, unif +@@ -35,360 +35,708 @@ unsigned int rpi_shader[] = { + /* [0x00000050] */ 0xc0000000, 0xe0020867, // mov r1, vdw_setup_1(0) + /* [0x00000058] */ 0x0c9e7200, 0x10021627, // add rb24, r1, r0 + /* [0x00000060] */ 0x00000001, 0xe0020527, // mov ra20, 1 +-/* [0x00000068] */ 0x00000020, 0xe0020567, // mov ra21, 32 +-/* [0x00000070] */ 0x00000100, 0xe00205a7, // mov ra22, 256 +-/* [0x00000078] */ 0x00000008, 0xe00205e7, // mov ra23, 8 +-/* [0x00000080] */ 0x00000040, 0xe00207a7, // mov ra30, 64 +-/* [0x00000088] */ 0xffffff00, 0xe0021527, // mov rb20, 0xffffff00 +-/* [0x00000090] */ 0x000000ff, 0xe00215a7, // mov rb22, 255 +-/* [0x00000098] */ 0x00000018, 0xe00215e7, // mov rb23, 24 +-/* [0x000000a0] */ 0x00000000, 0xe0020227, // mov ra8, 0 +-/* [0x000000a8] */ 0x00000000, 0xe0020267, // mov ra9, 0 +-/* [0x000000b0] */ 0x00000000, 0xe00202a7, // mov ra10, 0 +-/* [0x000000b8] */ 0x00000000, 0xe00202e7, // mov ra11, 0 +-/* [0x000000c0] */ 0x00000000, 0xe0020327, // mov ra12, 0 +-/* [0x000000c8] */ 0x00000000, 0xe0020367, // mov ra13, 0 +-/* [0x000000d0] */ 0x00000000, 0xe00203a7, // mov ra14, 0 +-/* [0x000000d8] */ 0x00000000, 0xe00203e7, // mov ra15, 0 +-/* [0x000000e0] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num +-/* [0x000000e8] */ 0x119c15c0, 0xd00208a7, // shl r2, r2, 1 +-/* [0x000000f0] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 +-/* [0x000000f8] */ 0x159e7480, 0x10020867, // mov r1, r2 +-/* [0x00000100] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 +-/* [0x00000108] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 +-/* [0x00000110] */ 0x159e7480, 0x10020827, // mov r0, r2 +-/* [0x00000118] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 +-/* [0x00000120] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 +-/* [0x00000128] */ 0x80004004, 0xe0020867, // mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) +-/* [0x00000130] */ 0x119c51c0, 0xd0020827, // shl r0, r0, 5 +-/* [0x00000138] */ 0x0c9e7040, 0x100216e7, // add rb27, r0, r1 +-/* [0x00000140] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num +-/* [0x00000148] */ 0x119c15c0, 0xd00208a7, // shl r2, r2, 1 +-/* [0x00000150] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 +-/* [0x00000158] */ 0x159e7480, 0x10020867, // mov r1, r2 +-/* [0x00000160] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 +-/* [0x00000168] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 +-/* [0x00000170] */ 0x159e7480, 0x10020827, // mov r0, r2 +-/* [0x00000178] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 +-/* [0x00000180] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 +-/* [0x00000188] */ 0x00004800, 0xe0020867, // mov r1, vpm_setup(0, 4, h8p(0, 0)) +-/* [0x00000190] */ 0x0c9e7040, 0x10021727, // add rb28, r0, r1 +-/* [0x00000198] */ 0x0f9c11c0, 0xd0020827, // asr r0, r0, 1 +-/* [0x000001a0] */ 0x00002900, 0xe0020867, // mov r1, vpm_setup(0, 2, h16p(0, 0)) +-/* [0x000001a8] */ 0x0c9e7040, 0x10021567, // add rb21, r0, r1 +-/* [0x000001b0] */ 0x15427d80, 0x10020827, // mov r0, ra_x_base +-/* [0x000001b8] */ 0x937401f6, 0xd0024821, // max r0, r0, 0; mov r1, ra_y +-/* [0x000001c0] */ 0x926191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, ra_x2_base +-/* [0x000001c8] */ 0x916431f6, 0xd00244e2, // shl ra_xshift_next, r0, 3 ; mov r2, ra_u2v_ref_offset +-/* [0x000001d0] */ 0x0c9c13c0, 0xd0020767, // add ra_y, r1, 1 +-/* [0x000001d8] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 +-/* [0x000001e0] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 +-/* [0x000001e8] */ 0x939c03c0, 0xd0025850, // max r1, r1, 0 ; mov ra_x_base, r0 +-/* [0x000001f0] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 +-/* [0x000001f8] */ 0x4c9d040f, 0x100248a1, // add r2, r2, r0 ; mul24 r1, r1, rb_pitch +-/* [0x00000200] */ 0x8c9e7052, 0x10025e18, // add t0s, r0, r1 ; mov ra_x2_base, r2 +-/* [0x00000208] */ 0x0c9e7440, 0x10020e27, // add t0s, r2, r1 +-/* [0x00000210] */ 0x15827d80, 0x10021327, // mov rb12,unif +-/* [0x00000218] */ 0x15827d80, 0x10021367, // mov rb13,unif +-/* [0x00000220] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000228] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 +-/* [0x00000230] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 +-/* [0x00000238] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 +-/* [0x00000240] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 +-/* [0x00000248] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch +-/* [0x00000250] */ 0x0c427380, 0x10020e27, // add t0s, r1, ra_x_base +-/* [0x00000258] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_x2_base ++/* [0x00000068] */ 0x00000100, 0xe00205a7, // mov ra22, 256 ++/* [0x00000070] */ 0x00000040, 0xe00207a7, // mov ra30, 64 ++/* [0x00000078] */ 0xffffff00, 0xe0021527, // mov rb20, 0xffffff00 ++/* [0x00000080] */ 0x000000ff, 0xe00215a7, // mov rb22, 255 ++/* [0x00000088] */ 0x00000018, 0xe00215e7, // mov rb23, 24 ++/* [0x00000090] */ 0x00000000, 0xe0020227, // mov ra8, 0 ++/* [0x00000098] */ 0x00000000, 0xe0020267, // mov ra9, 0 ++/* [0x000000a0] */ 0x00000000, 0xe00202a7, // mov ra10, 0 ++/* [0x000000a8] */ 0x00000000, 0xe00202e7, // mov ra11, 0 ++/* [0x000000b0] */ 0x00000000, 0xe0020327, // mov ra12, 0 ++/* [0x000000b8] */ 0x00000000, 0xe0020367, // mov ra13, 0 ++/* [0x000000c0] */ 0x00000000, 0xe00203a7, // mov ra14, 0 ++/* [0x000000c8] */ 0x00000000, 0xe00203e7, // mov ra15, 0 ++/* [0x000000d0] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num ++/* [0x000000d8] */ 0x119c15c0, 0xd00208a7, // shl r2, r2, 1 ++/* [0x000000e0] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 ++/* [0x000000e8] */ 0x159e7480, 0x10020867, // mov r1, r2 ++/* [0x000000f0] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 ++/* [0x000000f8] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 ++/* [0x00000100] */ 0x159e7480, 0x10020827, // mov r0, r2 ++/* [0x00000108] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 ++/* [0x00000110] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 ++/* [0x00000118] */ 0x80004004, 0xe0020867, // mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) ++/* [0x00000120] */ 0x119c51c0, 0xd0020827, // shl r0, r0, 5 ++/* [0x00000128] */ 0x0c9e7040, 0x100216e7, // add rb27, r0, r1 ++/* [0x00000130] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num ++/* [0x00000138] */ 0x119c15c0, 0xd00208a7, // shl r2, r2, 1 ++/* [0x00000140] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 ++/* [0x00000148] */ 0x159e7480, 0x10020867, // mov r1, r2 ++/* [0x00000150] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 ++/* [0x00000158] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 ++/* [0x00000160] */ 0x159e7480, 0x10020827, // mov r0, r2 ++/* [0x00000168] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 ++/* [0x00000170] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 ++/* [0x00000178] */ 0x00004800, 0xe0020867, // mov r1, vpm_setup(0, 4, h8p(0, 0)) ++/* [0x00000180] */ 0x0c9e7040, 0x10021727, // add rb28, r0, r1 ++/* [0x00000188] */ 0x0f9c11c0, 0xd0020827, // asr r0, r0, 1 ++/* [0x00000190] */ 0x00002900, 0xe0020867, // mov r1, vpm_setup(0, 2, h16p(0, 0)) ++/* [0x00000198] */ 0x0c9e7040, 0x10021567, // add rb21, r0, r1 ++/* [0x000001a0] */ 0x15427d80, 0x10020827, // mov r0, ra_x ++/* [0x000001a8] */ 0x937401f6, 0xd0024821, // max r0, r0, 0; mov r1, ra_y ++/* [0x000001b0] */ 0x926191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, ra_frame_base ++/* [0x000001b8] */ 0x916431f6, 0xd00244e2, // shl ra_xshift_next, r0, 3 ; mov r2, ra_u2v_ref_offset ++/* [0x000001c0] */ 0x0c9c13c0, 0xd0020767, // add ra_y, r1, 1 ++/* [0x000001c8] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 ++/* [0x000001d0] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 ++/* [0x000001d8] */ 0x939c03c0, 0xd0025850, // max r1, r1, 0 ; mov ra_x, r0 ++/* [0x000001e0] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 ++/* [0x000001e8] */ 0x4c9d040f, 0x100248a1, // add r2, r2, r0 ; mul24 r1, r1, rb_pitch ++/* [0x000001f0] */ 0x8c9e7052, 0x10025e18, // add t0s, r0, r1 ; mov ra_frame_base, r2 ++/* [0x000001f8] */ 0x0c9e7440, 0x10020e27, // add t0s, r2, r1 ++/* [0x00000200] */ 0x15827d80, 0x10021327, // mov rb12,unif ++/* [0x00000208] */ 0x15827d80, 0x10021367, // mov rb13,unif ++/* [0x00000210] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000218] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 ++/* [0x00000220] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 ++/* [0x00000228] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 ++/* [0x00000230] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 ++/* [0x00000238] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch ++/* [0x00000240] */ 0x0c427380, 0x10020e27, // add t0s, r1, ra_x ++/* [0x00000248] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_frame_base + // ::mc_filter_uv +-/* [0x00000260] */ 0x15827d80, 0x100207e7, // mov ra31, unif +-/* [0x00000268] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next +-/* [0x00000270] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num +-/* [0x00000278] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif +-/* [0x00000280] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif +-/* [0x00000288] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 +-/* [0x00000290] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 +-/* [0x00000298] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 +-/* [0x000002a0] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 +-/* [0x000002a8] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 +-/* [0x000002b0] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 +-/* [0x000002b8] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 +-/* [0x000002c0] */ 0x00000010, 0xe00208a7, // mov r2, 16 +-/* [0x000002c8] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x000002d0] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 +-/* [0x000002d8] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 +-/* [0x000002e0] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 +-/* [0x000002e8] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 +-/* [0x000002f0] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 +-/* [0x000002f8] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 +-/* [0x00000300] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 +-/* [0x00000308] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 +-/* [0x00000310] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 +-/* [0x00000318] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000320] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000328] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000330] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000338] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif +-/* [0x00000340] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000348] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000350] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000358] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 +-/* [0x00000360] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-/* [0x00000368] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000370] */ 0x0f9e7080, 0x100213e7, // asr rb15, r0, r2 +-/* [0x00000378] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 +-/* [0x00000380] */ 0x0f9e7080, 0x100213a7, // asr rb14, r0, r2 +-/* [0x00000388] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000390] */ 0x0f9e7080, 0x100613e7, // asr.ifnz rb15, r0, r2 +-/* [0x00000398] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 +-/* [0x000003a0] */ 0x0f9e7080, 0x100613a7, // asr.ifnz rb14, r0, r2 +-/* [0x000003a8] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 +-/* [0x000003b0] */ 0x00000000, 0xe00208e7, // mov r3, 0 ++/* [0x00000250] */ 0x15827d80, 0x100207e7, // mov ra31, unif ++/* [0x00000258] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next ++/* [0x00000260] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num ++/* [0x00000268] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif ++/* [0x00000270] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif ++/* [0x00000278] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 ++/* [0x00000280] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 ++/* [0x00000288] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 ++/* [0x00000290] */ 0x149dc1c0, 0xd00214e7, // and rb_x_next, r0, ~3 ++/* [0x00000298] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 ++/* [0x000002a0] */ 0x0c9d3e80, 0x100206a7, // add ra_frame_base_next, rb_x_next, r2 ++/* [0x000002a8] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 ++/* [0x000002b0] */ 0x00000010, 0xe00208a7, // mov r2, 16 ++/* [0x000002b8] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x000002c0] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 ++/* [0x000002c8] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 ++/* [0x000002d0] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 ++/* [0x000002d8] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 ++/* [0x000002e0] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 ++/* [0x000002e8] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 ++/* [0x000002f0] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 ++/* [0x000002f8] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 ++/* [0x00000300] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 ++/* [0x00000308] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000310] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000318] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000320] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000328] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif ++/* [0x00000330] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000338] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000340] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000348] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 ++/* [0x00000350] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x00000358] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000360] */ 0x0f9e7080, 0x100213e7, // asr rb15, r0, r2 ++/* [0x00000368] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 ++/* [0x00000370] */ 0x0f9e7080, 0x100213a7, // asr rb14, r0, r2 ++/* [0x00000378] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000380] */ 0x0f9e7080, 0x100613e7, // asr.ifnz rb15, r0, r2 ++/* [0x00000388] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 ++/* [0x00000390] */ 0x0f9e7080, 0x100613a7, // asr.ifnz rb14, r0, r2 ++/* [0x00000398] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 ++/* [0x000003a0] */ 0x00000000, 0xe00208e7, // mov r3, 0 + // :uvloop +-/* [0x000003b8] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 +-/* [0x000003c0] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 +-/* [0x000003c8] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 +-/* [0x000003d0] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch +-/* [0x000003d8] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 +-/* [0x000003e0] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 +-/* [0x000003e8] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 +-/* [0x000003f0] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 +-/* [0x000003f8] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 +-/* [0x00000400] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 +-/* [0x00000408] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-/* [0x00000410] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 +-/* [0x00000418] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 +-/* [0x00000420] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 +-/* [0x00000428] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 +-/* [0x00000430] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 +-/* [0x00000438] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 +-/* [0x00000440] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 +-/* [0x00000448] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 +-/* [0x00000450] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 +-/* [0x00000458] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 +-/* [0x00000460] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop +-/* [0x00000468] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 +-/* [0x00000470] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 +-/* [0x00000478] */ 0x159e7000, 0x100203e7, // mov ra15, r0 +-/* [0x00000480] */ 0x00000020, 0xe0021327, // mov rb12,32 +-/* [0x00000488] */ 0x00000006, 0xe0021367, // mov rb13,6 +-/* [0x00000490] */ 0x00000001, 0xe00213a7, // mov rb14,1 +-/* [0x00000498] */ 0x00000000, 0xe00213e7, // mov rb15,0 +-/* [0x000004a0] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 +-/* [0x000004a8] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 +-/* [0x000004b0] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 +-/* [0x000004b8] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 +-/* [0x000004c0] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait +-/* [0x000004c8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 +-/* [0x000004d0] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 +-/* [0x000004d8] */ 0x409ce00f, 0x100049e1, // nop ; mul24 r1, r1, rb14 +-/* [0x000004e0] */ 0x0c9cc3c0, 0x10020867, // add r1, r1, rb12 +-/* [0x000004e8] */ 0x0f9cd3c0, 0x10020867, // asr r1, r1, rb13 +-/* [0x000004f0] */ 0xfffffea8, 0xf06809e7, // brr.anyn -, r:uvloop +-/* [0x000004f8] */ 0x0c9cf3c0, 0x10020867, // add r1, r1, rb15 +-/* [0x00000500] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 +-/* [0x00000508] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 +-/* [0x00000510] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 +-/* [0x00000518] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 +-/* [0x00000520] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif +-/* [0x00000528] */ 0x00000010, 0xe0020827, // mov r0, 16 +-/* [0x00000530] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait +-/* [0x00000538] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 +-/* [0x00000540] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 +-/* [0x00000548] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 +-/* [0x00000550] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif ++/* [0x000003a8] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 ++/* [0x000003b0] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu0 ++/* [0x000003b8] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 ++/* [0x000003c0] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch ++/* [0x000003c8] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 ++/* [0x000003d0] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 ++/* [0x000003d8] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 ++/* [0x000003e0] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 ++/* [0x000003e8] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x, r2 ; v8subs r1, r1, rb20 ++/* [0x000003f0] */ 0x0c627c80, 0x10020e27, // add t0s, ra_frame_base, r2 ++/* [0x000003f8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x00000400] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 ++/* [0x00000408] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 ++/* [0x00000410] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 ++/* [0x00000418] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 ++/* [0x00000420] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 ++/* [0x00000428] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 ++/* [0x00000430] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 ++/* [0x00000438] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 ++/* [0x00000440] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 ++/* [0x00000448] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 ++/* [0x00000450] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop ++/* [0x00000458] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 ++/* [0x00000460] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 ++/* [0x00000468] */ 0x159e7000, 0x100203e7, // mov ra15, r0 ++/* [0x00000470] */ 0x00000020, 0xe0021327, // mov rb12,32 ++/* [0x00000478] */ 0x00000006, 0xe0021367, // mov rb13,6 ++/* [0x00000480] */ 0x00000001, 0xe00213a7, // mov rb14,1 ++/* [0x00000488] */ 0x00000000, 0xe00213e7, // mov rb15,0 ++/* [0x00000490] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 ++/* [0x00000498] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 ++/* [0x000004a0] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 ++/* [0x000004a8] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 ++/* [0x000004b0] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait ++/* [0x000004b8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 ++/* [0x000004c0] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 ++/* [0x000004c8] */ 0x409ce00f, 0x100049e1, // nop ; mul24 r1, r1, rb14 ++/* [0x000004d0] */ 0x0c9cc3c0, 0x10020867, // add r1, r1, rb12 ++/* [0x000004d8] */ 0x0f9cd3c0, 0x10020867, // asr r1, r1, rb13 ++/* [0x000004e0] */ 0xfffffea8, 0xf06809e7, // brr.anyn -, r:uvloop ++/* [0x000004e8] */ 0x0c9cf3c0, 0x10020867, // add r1, r1, rb15 ++/* [0x000004f0] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 ++/* [0x000004f8] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 ++/* [0x00000500] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 ++/* [0x00000508] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 ++/* [0x00000510] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif ++/* [0x00000518] */ 0x00000010, 0xe0020827, // mov r0, 16 ++/* [0x00000520] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x00000528] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 ++/* [0x00000530] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 ++/* [0x00000538] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 ++/* [0x00000540] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif + // ::mc_filter_uv_b0 +-/* [0x00000558] */ 0x15827d80, 0x100207e7, // mov ra31, unif +-/* [0x00000560] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next +-/* [0x00000568] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num +-/* [0x00000570] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif +-/* [0x00000578] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif +-/* [0x00000580] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 +-/* [0x00000588] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 +-/* [0x00000590] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 +-/* [0x00000598] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 +-/* [0x000005a0] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 +-/* [0x000005a8] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 +-/* [0x000005b0] */ 0x159d5fc0, 0x10021c67, // mov vw_setup, rb21 +-/* [0x000005b8] */ 0x00000010, 0xe00208a7, // mov r2, 16 +-/* [0x000005c0] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x000005c8] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 +-/* [0x000005d0] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 +-/* [0x000005d8] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 +-/* [0x000005e0] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 +-/* [0x000005e8] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 +-/* [0x000005f0] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 +-/* [0x000005f8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 +-/* [0x00000600] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 +-/* [0x00000608] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 +-/* [0x00000610] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000618] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000620] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000628] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000630] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif +-/* [0x00000638] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000640] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000648] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000650] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 +-/* [0x00000658] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000660] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000668] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 +-/* [0x00000670] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-/* [0x00000678] */ 0x00000000, 0xe00208e7, // mov r3, 0 ++/* [0x00000548] */ 0x15827d80, 0x100207e7, // mov ra31, unif ++/* [0x00000550] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next ++/* [0x00000558] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num ++/* [0x00000560] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif ++/* [0x00000568] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif ++/* [0x00000570] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 ++/* [0x00000578] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 ++/* [0x00000580] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 ++/* [0x00000588] */ 0x149dc1c0, 0xd00214e7, // and rb_x_next, r0, ~3 ++/* [0x00000590] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 ++/* [0x00000598] */ 0x0c9d3e80, 0x100206a7, // add ra_frame_base_next, rb_x_next, r2 ++/* [0x000005a0] */ 0x159d5fc0, 0x10021c67, // mov vw_setup, rb21 ++/* [0x000005a8] */ 0x00000010, 0xe00208a7, // mov r2, 16 ++/* [0x000005b0] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x000005b8] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 ++/* [0x000005c0] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 ++/* [0x000005c8] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 ++/* [0x000005d0] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 ++/* [0x000005d8] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 ++/* [0x000005e0] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 ++/* [0x000005e8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 ++/* [0x000005f0] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 ++/* [0x000005f8] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 ++/* [0x00000600] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000608] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000610] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000618] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000620] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif ++/* [0x00000628] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000630] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000638] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000640] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 ++/* [0x00000648] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000650] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000658] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 ++/* [0x00000660] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x00000668] */ 0x00000000, 0xe00208e7, // mov r3, 0 + // :uvloop_b0 +-/* [0x00000680] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 +-/* [0x00000688] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 +-/* [0x00000690] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 +-/* [0x00000698] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch +-/* [0x000006a0] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 +-/* [0x000006a8] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 +-/* [0x000006b0] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 +-/* [0x000006b8] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 +-/* [0x000006c0] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 +-/* [0x000006c8] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 +-/* [0x000006d0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-/* [0x000006d8] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 +-/* [0x000006e0] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 +-/* [0x000006e8] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 +-/* [0x000006f0] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 +-/* [0x000006f8] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 +-/* [0x00000700] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 +-/* [0x00000708] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 +-/* [0x00000710] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 +-/* [0x00000718] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 +-/* [0x00000720] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 +-/* [0x00000728] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b0 +-/* [0x00000730] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 +-/* [0x00000738] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 +-/* [0x00000740] */ 0x159e7000, 0x100203e7, // mov ra15, r0 +-/* [0x00000748] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 +-/* [0x00000750] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 +-/* [0x00000758] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 +-/* [0x00000760] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 +-/* [0x00000768] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait +-/* [0x00000770] */ 0x0d9d27c0, 0x100229e7, // sub.setf -, r3, rb18 +-/* [0x00000778] */ 0xfffffee8, 0xf06809e7, // brr.anyn -, r:uvloop_b0 +-/* [0x00000780] */ 0x0f9c63c0, 0xd0020c27, // asr vpm, r1, 6 +-/* [0x00000788] */ 0x009e7000, 0x100009e7, // nop +-/* [0x00000790] */ 0x009e7000, 0x100009e7, // nop +-/* [0x00000798] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 +-/* [0x000007a0] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x000007a8] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x000007b0] */ 0x009e7000, 0x100009e7, // nop ++/* [0x00000670] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 ++/* [0x00000678] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu0 ++/* [0x00000680] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 ++/* [0x00000688] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch ++/* [0x00000690] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 ++/* [0x00000698] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 ++/* [0x000006a0] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 ++/* [0x000006a8] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 ++/* [0x000006b0] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x, r2 ; v8subs r1, r1, rb20 ++/* [0x000006b8] */ 0x0c627c80, 0x10020e27, // add t0s, ra_frame_base, r2 ++/* [0x000006c0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x000006c8] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 ++/* [0x000006d0] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 ++/* [0x000006d8] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 ++/* [0x000006e0] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 ++/* [0x000006e8] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 ++/* [0x000006f0] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 ++/* [0x000006f8] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 ++/* [0x00000700] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 ++/* [0x00000708] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 ++/* [0x00000710] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 ++/* [0x00000718] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b0 ++/* [0x00000720] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 ++/* [0x00000728] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 ++/* [0x00000730] */ 0x159e7000, 0x100203e7, // mov ra15, r0 ++/* [0x00000738] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 ++/* [0x00000740] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 ++/* [0x00000748] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 ++/* [0x00000750] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 ++/* [0x00000758] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait ++/* [0x00000760] */ 0x0d9d27c0, 0x100229e7, // sub.setf -, r3, rb18 ++/* [0x00000768] */ 0xfffffee8, 0xf06809e7, // brr.anyn -, r:uvloop_b0 ++/* [0x00000770] */ 0x0f9c63c0, 0xd0020c27, // asr vpm, r1, 6 ++/* [0x00000778] */ 0x009e7000, 0x100009e7, // nop ++/* [0x00000780] */ 0x009e7000, 0x100009e7, // nop ++/* [0x00000788] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 ++/* [0x00000790] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000798] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x000007a0] */ 0x009e7000, 0x100009e7, // nop + // ::mc_filter_uv_b +-/* [0x000007b8] */ 0x15827d80, 0x100207e7, // mov ra31, unif +-/* [0x000007c0] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next +-/* [0x000007c8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num +-/* [0x000007d0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif +-/* [0x000007d8] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif +-/* [0x000007e0] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 +-/* [0x000007e8] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 +-/* [0x000007f0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 +-/* [0x000007f8] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 +-/* [0x00000800] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 +-/* [0x00000808] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 +-/* [0x00000810] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 +-/* [0x00000818] */ 0x00000010, 0xe00208a7, // mov r2, 16 +-/* [0x00000820] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000828] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 +-/* [0x00000830] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 +-/* [0x00000838] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 +-/* [0x00000840] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 +-/* [0x00000848] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 +-/* [0x00000850] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 +-/* [0x00000858] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 +-/* [0x00000860] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 +-/* [0x00000868] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 +-/* [0x00000870] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 +-/* [0x00000878] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 +-/* [0x00000880] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 +-/* [0x00000888] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 +-/* [0x00000890] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000898] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000008a0] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000008a8] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000008b0] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif +-/* [0x000008b8] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000008c0] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000008c8] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000008d0] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 +-/* [0x000008d8] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x000008e0] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x000008e8] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 +-/* [0x000008f0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-/* [0x000008f8] */ 0x00000000, 0xe00208e7, // mov r3, 0 ++/* [0x000007a8] */ 0x15827d80, 0x100207e7, // mov ra31, unif ++/* [0x000007b0] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next ++/* [0x000007b8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num ++/* [0x000007c0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif ++/* [0x000007c8] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif ++/* [0x000007d0] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 ++/* [0x000007d8] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 ++/* [0x000007e0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 ++/* [0x000007e8] */ 0x149dc1c0, 0xd00214e7, // and rb_x_next, r0, ~3 ++/* [0x000007f0] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 ++/* [0x000007f8] */ 0x0c9d3e80, 0x100206a7, // add ra_frame_base_next, rb_x_next, r2 ++/* [0x00000800] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 ++/* [0x00000808] */ 0x00000010, 0xe00208a7, // mov r2, 16 ++/* [0x00000810] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000818] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 ++/* [0x00000820] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 ++/* [0x00000828] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 ++/* [0x00000830] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 ++/* [0x00000838] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 ++/* [0x00000840] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 ++/* [0x00000848] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 ++/* [0x00000850] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 ++/* [0x00000858] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 ++/* [0x00000860] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 ++/* [0x00000868] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 ++/* [0x00000870] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 ++/* [0x00000878] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 ++/* [0x00000880] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000888] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000890] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000898] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000008a0] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif ++/* [0x000008a8] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000008b0] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000008b8] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000008c0] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 ++/* [0x000008c8] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x000008d0] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x000008d8] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 ++/* [0x000008e0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x000008e8] */ 0x00000000, 0xe00208e7, // mov r3, 0 + // :uvloop_b +-/* [0x00000900] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 +-/* [0x00000908] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 +-/* [0x00000910] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 +-/* [0x00000918] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch +-/* [0x00000920] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 +-/* [0x00000928] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 +-/* [0x00000930] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 +-/* [0x00000938] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 +-/* [0x00000940] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 +-/* [0x00000948] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 +-/* [0x00000950] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-/* [0x00000958] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 +-/* [0x00000960] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 +-/* [0x00000968] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 +-/* [0x00000970] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 +-/* [0x00000978] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 +-/* [0x00000980] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 +-/* [0x00000988] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 +-/* [0x00000990] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 +-/* [0x00000998] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 +-/* [0x000009a0] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 +-/* [0x000009a8] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b +-/* [0x000009b0] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 +-/* [0x000009b8] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 +-/* [0x000009c0] */ 0x159e7000, 0x100203e7, // mov ra15, r0 +-/* [0x000009c8] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 +-/* [0x000009d0] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 +-/* [0x000009d8] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 +-/* [0x000009e0] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 +-/* [0x000009e8] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait +-/* [0x000009f0] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 +-/* [0x000009f8] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 +-/* [0x00000a00] */ 0x0cc27380, 0x10020867, // add r1, r1, vpm +-/* [0x00000a08] */ 0x0c7a7380, 0x10020867, // add r1, r1, ra30 +-/* [0x00000a10] */ 0xfffffed0, 0xf06809e7, // brr.anyn -, r:uvloop_b +-/* [0x00000a18] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 +-/* [0x00000a20] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 +-/* [0x00000a28] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 +-/* [0x00000a30] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 +-/* [0x00000a38] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 +-/* [0x00000a40] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif +-/* [0x00000a48] */ 0x00000010, 0xe0020827, // mov r0, 16 +-/* [0x00000a50] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait +-/* [0x00000a58] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 +-/* [0x00000a60] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 +-/* [0x00000a68] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 +-/* [0x00000a70] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif ++/* [0x000008f0] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 ++/* [0x000008f8] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu0 ++/* [0x00000900] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 ++/* [0x00000908] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch ++/* [0x00000910] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 ++/* [0x00000918] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 ++/* [0x00000920] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 ++/* [0x00000928] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 ++/* [0x00000930] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x, r2 ; v8subs r1, r1, rb20 ++/* [0x00000938] */ 0x0c627c80, 0x10020e27, // add t0s, ra_frame_base, r2 ++/* [0x00000940] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x00000948] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 ++/* [0x00000950] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 ++/* [0x00000958] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 ++/* [0x00000960] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 ++/* [0x00000968] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 ++/* [0x00000970] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 ++/* [0x00000978] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 ++/* [0x00000980] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 ++/* [0x00000988] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 ++/* [0x00000990] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 ++/* [0x00000998] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b ++/* [0x000009a0] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 ++/* [0x000009a8] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 ++/* [0x000009b0] */ 0x159e7000, 0x100203e7, // mov ra15, r0 ++/* [0x000009b8] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 ++/* [0x000009c0] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 ++/* [0x000009c8] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 ++/* [0x000009d0] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 ++/* [0x000009d8] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait ++/* [0x000009e0] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 ++/* [0x000009e8] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 ++/* [0x000009f0] */ 0x0cc27380, 0x10020867, // add r1, r1, vpm ++/* [0x000009f8] */ 0x0c7a7380, 0x10020867, // add r1, r1, ra30 ++/* [0x00000a00] */ 0xfffffed0, 0xf06809e7, // brr.anyn -, r:uvloop_b ++/* [0x00000a08] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 ++/* [0x00000a10] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 ++/* [0x00000a18] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 ++/* [0x00000a20] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 ++/* [0x00000a28] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 ++/* [0x00000a30] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif ++/* [0x00000a38] */ 0x00000010, 0xe0020827, // mov r0, 16 ++/* [0x00000a40] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x00000a48] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 ++/* [0x00000a50] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 ++/* [0x00000a58] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 ++/* [0x00000a60] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif + // ::mc_exit +-/* [0x00000a78] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait +-/* [0x00000a80] */ 0x00000000, 0xe80009e7, // mov -,srel(0) ++/* [0x00000a68] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x00000a70] */ 0x00000000, 0xe80009e7, // mov -,srel(0) ++/* [0x00000a78] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00000a80] */ 0x009e7000, 0xa00009e7, // ldtmu0 + /* [0x00000a88] */ 0x009e7000, 0xa00009e7, // ldtmu0 + /* [0x00000a90] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00000a98] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00000aa0] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00000aa8] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend +-/* [0x00000ab0] */ 0x009e7000, 0x100009e7, // nop ; nop +-/* [0x00000ab8] */ 0x009e7000, 0x100009e7, // nop ; nop ++/* [0x00000a98] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend ++/* [0x00000aa0] */ 0x009e7000, 0x100009e7, // nop ; nop ++/* [0x00000aa8] */ 0x009e7000, 0x100009e7, // nop ; nop + // ::mc_interrupt_exit8 +-/* [0x00000ac0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x00000ab0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x00000ab8] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00000ac0] */ 0x009e7000, 0xa00009e7, // ldtmu0 + /* [0x00000ac8] */ 0x009e7000, 0xa00009e7, // ldtmu0 + /* [0x00000ad0] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00000ad8] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00000ae0] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00000ad8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00000ae0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) + /* [0x00000ae8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) + /* [0x00000af0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) + /* [0x00000af8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) + /* [0x00000b00] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) + /* [0x00000b08] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00000b10] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00000b18] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00000b20] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend +-/* [0x00000b28] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop +-/* [0x00000b30] */ 0x009e7000, 0x100009e7, // nop ; nop ++/* [0x00000b10] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend ++/* [0x00000b18] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop ++/* [0x00000b20] */ 0x009e7000, 0x100009e7, // nop ; nop ++// ::mc_setup ++/* [0x00000b28] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x00000b30] */ 0x15827d80, 0x100207e7, // mov ra31, unif ++/* [0x00000b38] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num ++/* [0x00000b40] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif ++/* [0x00000b48] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif ++/* [0x00000b50] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 ++/* [0x00000b58] */ 0x0c9c13c0, 0xd0020767, // add ra_y, r1, 1 ++/* [0x00000b60] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 ++/* [0x00000b68] */ 0x0c9e7400, 0x100208a7, // add r2, r2, r0 ++/* [0x00000b70] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 ++/* [0x00000b78] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 ++/* [0x00000b80] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch ++/* [0x00000b88] */ 0x8c9e7452, 0x10025e18, // add t0s, r2, r1 ; mov ra_frame_base, r2 ++/* [0x00000b90] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num ++/* [0x00000b98] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif ++/* [0x00000ba0] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif ++/* [0x00000ba8] */ 0x119c31c0, 0xd00205e7, // shl rx_xshift2_next, r0, 3 ++/* [0x00000bb0] */ 0x0c9c13c0, 0xd0020567, // add ra_y2, r1, 1 ++/* [0x00000bb8] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 ++/* [0x00000bc0] */ 0x0c9e7400, 0x100208a7, // add r2, r2, r0 ++/* [0x00000bc8] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 ++/* [0x00000bd0] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 ++/* [0x00000bd8] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch ++/* [0x00000be0] */ 0x8c9e7452, 0x10025e19, // add t0s, r2, r1 ; mov ra_frame_base2, r2 ++/* [0x00000be8] */ 0x0d801dc0, 0xd0021667, // sub rb25,unif,1 ++/* [0x00000bf0] */ 0x0d801dc0, 0xd00217a7, // sub rb30,unif,1 ++/* [0x00000bf8] */ 0x15827d80, 0x10021427, // mov rb16, unif ++/* [0x00000c00] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000c08] */ 0xc0000000, 0xe0020867, // mov r1, vdw_setup_1(0) ++/* [0x00000c10] */ 0x0c9e7200, 0x10021627, // add rb24, r1, r0 ++/* [0x00000c18] */ 0x00000001, 0xe0020527, // mov ra20, 1 ++/* [0x00000c20] */ 0x00000100, 0xe00205a7, // mov ra22, 256 ++/* [0x00000c28] */ 0x00000040, 0xe00207a7, // mov ra30, 64 ++/* [0x00000c30] */ 0xffffff00, 0xe0021527, // mov rb20, 0xffffff00 ++/* [0x00000c38] */ 0x000000ff, 0xe00215a7, // mov rb22, 255 ++/* [0x00000c40] */ 0x00000018, 0xe00215e7, // mov rb23, 24 ++/* [0x00000c48] */ 0x00000000, 0xe0020227, // mov ra8, 0 ++/* [0x00000c50] */ 0x00000000, 0xe0020267, // mov ra9, 0 ++/* [0x00000c58] */ 0x00000000, 0xe00202a7, // mov ra10, 0 ++/* [0x00000c60] */ 0x00000000, 0xe00202e7, // mov ra11, 0 ++/* [0x00000c68] */ 0x00000000, 0xe0020327, // mov ra12, 0 ++/* [0x00000c70] */ 0x00000000, 0xe0020367, // mov ra13, 0 ++/* [0x00000c78] */ 0x00000000, 0xe00203a7, // mov ra14, 0 ++/* [0x00000c80] */ 0x00000000, 0xe00203e7, // mov ra15, 0 ++/* [0x00000c88] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num ++/* [0x00000c90] */ 0x159e7480, 0x10020867, // mov r1, r2 ++/* [0x00000c98] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 ++/* [0x00000ca0] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 ++/* [0x00000ca8] */ 0x159e7480, 0x10020827, // mov r0, r2 ++/* [0x00000cb0] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 ++/* [0x00000cb8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 ++/* [0x00000cc0] */ 0x80004004, 0xe0020867, // mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) ++/* [0x00000cc8] */ 0x119c51c0, 0xd0020827, // shl r0, r0, 5 ++/* [0x00000cd0] */ 0x0c9e7040, 0x100216e7, // add rb27, r0, r1 ++/* [0x00000cd8] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num ++/* [0x00000ce0] */ 0x159e7480, 0x10020867, // mov r1, r2 ++/* [0x00000ce8] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 ++/* [0x00000cf0] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 ++/* [0x00000cf8] */ 0x159e7480, 0x10020827, // mov r0, r2 ++/* [0x00000d00] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 ++/* [0x00000d08] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 ++/* [0x00000d10] */ 0x00004800, 0xe0020867, // mov r1, vpm_setup(0, 4, h8p(0, 0)) ++/* [0x00000d18] */ 0x0c9e7040, 0x10021727, // add rb28, r0, r1 ++/* [0x00000d20] */ 0x15827d80, 0x10021327, // mov rb12,unif ++/* [0x00000d28] */ 0x15827d80, 0x10021367, // mov rb13,unif ++/* [0x00000d30] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000d38] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 ++/* [0x00000d40] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 ++/* [0x00000d48] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 ++/* [0x00000d50] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch ++/* [0x00000d58] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_frame_base ++/* [0x00000d60] */ 0x13540dc0, 0xd0020867, // max r1, ra_y2, 0 ++/* [0x00000d68] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 ++/* [0x00000d70] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 ++/* [0x00000d78] */ 0x0c541dc0, 0xd0020567, // add ra_y2, ra_y2, 1 ++/* [0x00000d80] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch ++/* [0x00000d88] */ 0x0c667380, 0x10020e27, // add t0s, r1, ra_frame_base2 ++// ::mc_filter ++/* [0x00000d90] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x00000d98] */ 0x15827d80, 0x100207e7, // mov ra31, unif ++/* [0x00000da0] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next ++/* [0x00000da8] */ 0x155e7d80, 0x10021027, // mov rx_xshift2, rx_xshift2_next ++/* [0x00000db0] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num ++/* [0x00000db8] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif ++/* [0x00000dc0] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif ++/* [0x00000dc8] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 ++/* [0x00000dd0] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 ++/* [0x00000dd8] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 ++/* [0x00000de0] */ 0x0c9e7400, 0x100206a7, // add ra_frame_base_next, r2, r0 ++/* [0x00000de8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num ++/* [0x00000df0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0 ; mov r1, unif ++/* [0x00000df8] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif ++/* [0x00000e00] */ 0x119c31c0, 0xd00205e7, // shl rx_xshift2_next, r0, 3 ++/* [0x00000e08] */ 0x0c9c13c0, 0xd0021067, // add ra_y2_next, r1, 1 ++/* [0x00000e10] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 ++/* [0x00000e18] */ 0x0c9e7400, 0x100214e7, // add rx_frame_base2_next, r2, r0 ++/* [0x00000e20] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 ++/* [0x00000e28] */ 0x00000010, 0xe00208a7, // mov r2, 16 ++/* [0x00000e30] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000e38] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 ++/* [0x00000e40] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 ++/* [0x00000e48] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 ++/* [0x00000e50] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 ++/* [0x00000e58] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 ++/* [0x00000e60] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 ++/* [0x00000e68] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 ++/* [0x00000e70] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 ++/* [0x00000e78] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 ++/* [0x00000e80] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000e88] */ 0x15827d80, 0x100009e7, // mov.ifnz -, unif ++/* [0x00000e90] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000e98] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000ea0] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000ea8] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif ++/* [0x00000eb0] */ 0x15827d80, 0x100009e7, // mov.ifnz -, unif ++/* [0x00000eb8] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000ec0] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000ec8] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000ed0] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif ++/* [0x00000ed8] */ 0x15827d80, 0x100009e7, // mov.ifnz -, unif ++/* [0x00000ee0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000ee8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000ef0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000ef8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif ++/* [0x00000f00] */ 0x15827d80, 0x100009e7, // mov.ifnz -, unif ++/* [0x00000f08] */ 0x4f5971c6, 0x100251e0, // asr rb7, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000f10] */ 0x4f5971c6, 0x100251a0, // asr rb6, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000f18] */ 0x4f5971c6, 0x10025160, // asr rb5, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000f20] */ 0x0f9d71c0, 0x10021127, // asr rb4, r0, rb23 ++/* [0x00000f28] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000f30] */ 0x15827d80, 0x100009e7, // mov.ifnz -, unif ++/* [0x00000f38] */ 0x0f9e7080, 0x100213e7, // asr rb15, r0, r2 ++/* [0x00000f40] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 ++/* [0x00000f48] */ 0x0f9e7080, 0x100213a7, // asr rb14, r0, r2 ++/* [0x00000f50] */ 0x00000000, 0xe00208e7, // mov r3, 0 ++// :yloop ++/* [0x00000f58] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 ++/* [0x00000f60] */ 0x8e4539bf, 0xa0029819, // shr r0, r4, ra_xshift ; mov.ifz ra_frame_base2, rx_frame_base2_next ; ldtmu0 ++/* [0x00000f68] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 ++/* [0x00000f70] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch ++/* [0x00000f78] */ 0x0e9c09c0, 0x10020867, // shr r1, r4, rx_xshift2 ++/* [0x00000f80] */ 0x159c1fc0, 0x10040567, // mov.ifz ra_y2, ra_y2_next ++/* [0x00000f88] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 ++/* [0x00000f90] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 ++/* [0x00000f98] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 ++/* [0x00000fa0] */ 0xec614c87, 0x10024e20, // add t0s, ra_frame_base, r2 ; v8subs r0, r0, rb20 ++/* [0x00000fa8] */ 0x13540dc0, 0xd00208a7, // max r2, ra_y2, 0 ++/* [0x00000fb0] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 ++/* [0x00000fb8] */ 0x4c541dd3, 0xd0024562, // add ra_y2, ra_y2, 1 ; mul24 r2, r2, r3 ++/* [0x00000fc0] */ 0xec654c87, 0x10024e20, // add t0s, ra_frame_base2, r2 ; v8subs r0, r0, rb20 ++/* [0x00000fc8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x00000fd0] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 ++/* [0x00000fd8] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 ++/* [0x00000fe0] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 ++/* [0x00000fe8] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 ++/* [0x00000ff0] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 ++/* [0x00000ff8] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 ++/* [0x00001000] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 ++/* [0x00001008] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 ++/* [0x00001010] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 ++/* [0x00001018] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 ++/* [0x00001020] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 ++/* [0x00001028] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 ++/* [0x00001030] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 ++/* [0x00001038] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 ++/* [0x00001040] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 ++/* [0x00001048] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 ++/* [0x00001050] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 ++/* [0x00001058] */ 0x8d3487f6, 0xd00279cc, // sub.setf -, r3, 8 ; mov ra12, ra13 ++/* [0x00001060] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 ++/* [0x00001068] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 ++/* [0x00001070] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 ++/* [0x00001078] */ 0x15367d80, 0x10020327, // mov ra12, ra13 ++/* [0x00001080] */ 0xfffffeb8, 0xf06809e7, // brr.anyn -, r:yloop ++/* [0x00001088] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 ++/* [0x00001090] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 ++/* [0x00001098] */ 0x159e7000, 0x100203e7, // mov ra15, r0 ++/* [0x000010a0] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 ++/* [0x000010a8] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 ++/* [0x000010b0] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 ++/* [0x000010b8] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 ++/* [0x000010c0] */ 0x4c204237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb4 ++/* [0x000010c8] */ 0x4c245237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb5 ++/* [0x000010d0] */ 0x4c286237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb6 ++/* [0x000010d8] */ 0x4c2c7237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb7 ++/* [0x000010e0] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait ++/* [0x000010e8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 ++/* [0x000010f0] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 ++/* [0x000010f8] */ 0x409ce00f, 0x100049e1, // nop ; mul24 r1, r1, rb14 ++/* [0x00001100] */ 0x0c9cc3c0, 0x10020867, // add r1, r1, rb12 ++/* [0x00001108] */ 0x0f9cd3c0, 0x10020867, // asr r1, r1, rb13 ++/* [0x00001110] */ 0xfffffe28, 0xf06809e7, // brr.anyn -, r:yloop ++/* [0x00001118] */ 0x0c9cf3c0, 0x10020867, // add r1, r1, rb15 ++/* [0x00001120] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 ++/* [0x00001128] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 ++/* [0x00001130] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 ++/* [0x00001138] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 ++/* [0x00001140] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 ++/* [0x00001148] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif ++// ::mc_filter_b ++/* [0x00001150] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x00001158] */ 0x15827d80, 0x100207e7, // mov ra31, unif ++/* [0x00001160] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next ++/* [0x00001168] */ 0x155e7d80, 0x10021027, // mov rx_xshift2, rx_xshift2_next ++/* [0x00001170] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num ++/* [0x00001178] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif ++/* [0x00001180] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif ++/* [0x00001188] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 ++/* [0x00001190] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 ++/* [0x00001198] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 ++/* [0x000011a0] */ 0x0c9e7400, 0x100206a7, // add ra_frame_base_next, r2, r0 ++/* [0x000011a8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num ++/* [0x000011b0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0 ; mov r1, unif ++/* [0x000011b8] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif ++/* [0x000011c0] */ 0x119c31c0, 0xd00205e7, // shl rx_xshift2_next, r0, 3 ++/* [0x000011c8] */ 0x0c9c13c0, 0xd0021067, // add ra_y2_next, r1, 1 ++/* [0x000011d0] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 ++/* [0x000011d8] */ 0x0c9e7400, 0x100214e7, // add rx_frame_base2_next, r2, r0 ++/* [0x000011e0] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 ++/* [0x000011e8] */ 0x00000010, 0xe00208a7, // mov r2, 16 ++/* [0x000011f0] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x000011f8] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 ++/* [0x00001200] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 ++/* [0x00001208] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 ++/* [0x00001210] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 ++/* [0x00001218] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 ++/* [0x00001220] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 ++/* [0x00001228] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 ++/* [0x00001230] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 ++/* [0x00001238] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 ++/* [0x00001240] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00001248] */ 0x00000001, 0xe0020867, // mov r1, 1 ++/* [0x00001250] */ 0x15827d80, 0x10060827, // mov.ifnz r0, unif ++/* [0x00001258] */ 0x409f3001, 0xd00049e0, // nop ; mul24 r0, r0 << 13, r1 << 13 ++/* [0x00001260] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00001268] */ 0x409f2001, 0xd00049e0, // nop ; mul24 r0, r0 << 14, r1 << 14 ++/* [0x00001270] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00001278] */ 0x409f1001, 0xd00049e0, // nop ; mul24 r0, r0 << 15, r1 << 15 ++/* [0x00001280] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00001288] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif ++/* [0x00001290] */ 0x15827d80, 0x10060827, // mov.ifnz r0, unif ++/* [0x00001298] */ 0x409f7001, 0xd00049e0, // nop ; mul24 r0, r0 << 9, r1 << 9 ++/* [0x000012a0] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000012a8] */ 0x409f6001, 0xd00049e0, // nop ; mul24 r0, r0 << 10, r1 << 10 ++/* [0x000012b0] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000012b8] */ 0x409f5001, 0xd00049e0, // nop ; mul24 r0, r0 << 11, r1 << 11 ++/* [0x000012c0] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000012c8] */ 0x409f4001, 0xd00049e0, // nop ; mul24 r0, r0 << 12, r1 << 12 ++/* [0x000012d0] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif ++/* [0x000012d8] */ 0x15827d80, 0x10060827, // mov.ifnz r0, unif ++/* [0x000012e0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000012e8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000012f0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000012f8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif ++/* [0x00001300] */ 0x15827d80, 0x10060827, // mov.ifnz r0, unif ++/* [0x00001308] */ 0x4f5971c6, 0x100251e0, // asr rb7, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00001310] */ 0x4f5971c6, 0x100251a0, // asr rb6, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00001318] */ 0x4f5971c6, 0x10025160, // asr rb5, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00001320] */ 0x0f9d71c0, 0x10021127, // asr rb4, r0, rb23 ++/* [0x00001328] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00001330] */ 0x15827d80, 0x10060827, // mov.ifnz r0, unif ++/* [0x00001338] */ 0x0f9e7080, 0x100213e7, // asr rb15, r0, r2 ++/* [0x00001340] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 ++/* [0x00001348] */ 0x0f9e7080, 0x100213a7, // asr rb14, r0, r2 ++/* [0x00001350] */ 0x00000000, 0xe00208e7, // mov r3, 0 ++// :yloopb ++/* [0x00001358] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 ++/* [0x00001360] */ 0x8e4539bf, 0xa0029819, // shr r0, r4, ra_xshift ; mov.ifz ra_frame_base2, rx_frame_base2_next ; ldtmu0 ++/* [0x00001368] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 ++/* [0x00001370] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch ++/* [0x00001378] */ 0x0e9c09c0, 0x10020867, // shr r1, r4, rx_xshift2 ++/* [0x00001380] */ 0x159c1fc0, 0x10040567, // mov.ifz ra_y2, ra_y2_next ++/* [0x00001388] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 ++/* [0x00001390] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 ++/* [0x00001398] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 ++/* [0x000013a0] */ 0xec614c87, 0x10024e20, // add t0s, ra_frame_base, r2 ; v8subs r0, r0, rb20 ++/* [0x000013a8] */ 0x13540dc0, 0xd00208a7, // max r2, ra_y2, 0 ++/* [0x000013b0] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 ++/* [0x000013b8] */ 0x4c541dd3, 0xd0024562, // add ra_y2, ra_y2, 1 ; mul24 r2, r2, r3 ++/* [0x000013c0] */ 0xec654c87, 0x10024e20, // add t0s, ra_frame_base2, r2 ; v8subs r0, r0, rb20 ++/* [0x000013c8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x000013d0] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 ++/* [0x000013d8] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 ++/* [0x000013e0] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 ++/* [0x000013e8] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 ++/* [0x000013f0] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 ++/* [0x000013f8] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 ++/* [0x00001400] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 ++/* [0x00001408] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 ++/* [0x00001410] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 ++/* [0x00001418] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 ++/* [0x00001420] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 ++/* [0x00001428] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 ++/* [0x00001430] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 ++/* [0x00001438] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 ++/* [0x00001440] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 ++/* [0x00001448] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 ++/* [0x00001450] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 ++/* [0x00001458] */ 0x8d3487f6, 0xd00279cc, // sub.setf -, r3, 8 ; mov ra12, ra13 ++/* [0x00001460] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 ++/* [0x00001468] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 ++/* [0x00001470] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 ++/* [0x00001478] */ 0x15367d80, 0x10020327, // mov ra12, ra13 ++/* [0x00001480] */ 0xfffffeb8, 0xf06809e7, // brr.anyn -, r:yloopb ++/* [0x00001488] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 ++/* [0x00001490] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 ++/* [0x00001498] */ 0x159e7000, 0x100203e7, // mov ra15, r0 ++/* [0x000014a0] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 ++/* [0x000014a8] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 ++/* [0x000014b0] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 ++/* [0x000014b8] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 ++/* [0x000014c0] */ 0x4c204237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb4 ++/* [0x000014c8] */ 0x4c245237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb5 ++/* [0x000014d0] */ 0x4c286237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb6 ++/* [0x000014d8] */ 0x4c2c7237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb7 ++/* [0x000014e0] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait ++/* [0x000014e8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 ++/* [0x000014f0] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 ++/* [0x000014f8] */ 0x4053800e, 0xd00049e1, // nop ; mul24 r1, r1 << 8, ra20 << 8 ++/* [0x00001500] */ 0x4c78e38f, 0x10024860, // add r1, r1, ra30 ; mul24 r0, r1, rb14 ++/* [0x00001508] */ 0x0c9e7200, 0x10020867, // add r1, r1, r0 ++/* [0x00001510] */ 0xfffffe28, 0xf06809e7, // brr.anyn -, r:yloopb ++/* [0x00001518] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 ++/* [0x00001520] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 ++/* [0x00001528] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 ++/* [0x00001530] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 ++/* [0x00001538] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 ++/* [0x00001540] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 ++/* [0x00001548] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif ++// ::mc_interrupt_exit12 ++/* [0x00001550] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x00001558] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00001560] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00001568] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00001570] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00001578] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00001580] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00001588] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00001590] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00001598] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x000015a0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x000015a8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x000015b0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x000015b8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x000015c0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x000015c8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x000015d0] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend ++/* [0x000015d8] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop ++/* [0x000015e0] */ 0x009e7000, 0x100009e7, // nop ; nop + // ::mc_end + }; + #ifdef __HIGHC__ +diff --git a/libavcodec/rpi_shader.h b/libavcodec/rpi_shader.h +index cec9901..3fa8531 100644 +--- a/libavcodec/rpi_shader.h ++++ b/libavcodec/rpi_shader.h +@@ -4,11 +4,15 @@ + extern unsigned int rpi_shader[]; + + #define mc_setup_uv (rpi_shader + 0) +-#define mc_filter_uv (rpi_shader + 152) +-#define mc_filter_uv_b0 (rpi_shader + 342) +-#define mc_filter_uv_b (rpi_shader + 494) +-#define mc_exit (rpi_shader + 670) +-#define mc_interrupt_exit8 (rpi_shader + 688) +-#define mc_end (rpi_shader + 718) ++#define mc_filter_uv (rpi_shader + 148) ++#define mc_filter_uv_b0 (rpi_shader + 338) ++#define mc_filter_uv_b (rpi_shader + 490) ++#define mc_exit (rpi_shader + 666) ++#define mc_interrupt_exit8 (rpi_shader + 684) ++#define mc_setup (rpi_shader + 714) ++#define mc_filter (rpi_shader + 868) ++#define mc_filter_b (rpi_shader + 1108) ++#define mc_interrupt_exit12 (rpi_shader + 1364) ++#define mc_end (rpi_shader + 1402) + + #endif +diff --git a/libavcodec/rpi_user_vcsm.h b/libavcodec/rpi_user_vcsm.h +index fbebbbe..95e6de1 100644 +--- a/libavcodec/rpi_user_vcsm.h ++++ b/libavcodec/rpi_user_vcsm.h +@@ -418,6 +418,28 @@ int vcsm_unlock_hdl( unsigned int handle ); + */ + int vcsm_unlock_hdl_sp( unsigned int handle, int cache_no_flush ); + ++/* Clean and/or invalidate the memory associated with this user opaque handle ++** ++** Returns: non-zero on error ++** ++** structure contains a list of flush/invalidate commands. Commands are: ++** 0: nop ++** 1: invalidate given physical range in L2 ++** 2: clean given physical range in L2 ++** 3: clean+invalidate all of L1 ++** 4: flush all of L2 and all of L1 ++*/ ++struct vcsm_user_clean_invalid_s { ++ struct { ++ unsigned int cmd; ++ unsigned int addr; ++ unsigned int size; ++ } s[8]; ++}; ++ ++int vcsm_clean_invalid( unsigned int handle, struct vcsm_user_clean_invalid_s *s ); ++ ++ + #ifdef __cplusplus + } + #endif +-- +2.5.0 + + +From b3e42f057641ce7855d21f7c45f533df8c6c462d Mon Sep 17 00:00:00 2001 +From: Peter de Rivaz <peter.derivaz@gmail.com> +Date: Wed, 20 May 2015 21:12:55 +0100 +Subject: [PATCH 43/68] Added multi mailbox - not working + +--- + libavcodec/hevc.c | 40 ++++++++++++++++++++++++++++--- + libavcodec/rpi_mailbox.c | 47 +++++++++++++++++++++++++++++++++++++ + libavcodec/rpi_mailbox.h | 5 ++++ + libavcodec/rpi_qpu.c | 61 ++++++++++++++++++++++++++++++++++++++++++++---- + libavcodec/rpi_qpu.h | 2 ++ + 5 files changed, 147 insertions(+), 8 deletions(-) + +diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c +index 01898fd..2ca783a 100644 +--- a/libavcodec/hevc.c ++++ b/libavcodec/hevc.c +@@ -47,6 +47,11 @@ + //#define EARLY_MALLOC + // Move Inter prediction into separate pass + #define RPI_INTER ++ ++ #ifdef RPI_INTER_QPU ++ // Define RPI_MULTI_MAILBOX to use the updated mailbox that can launch both QPU and VPU ++ #define RPI_MULTI_MAILBOX ++ #endif + #endif + + // #define DISABLE_MC +@@ -2832,10 +2837,14 @@ static void rpi_inter_clear(HEVCContext *s) + static void rpi_execute_inter_qpu(HEVCContext *s) + { + int k; ++ int i; + uint32_t *unif_vc = (uint32_t *)s->unif_mvs_ptr.vc; +- +- if (s->sh.slice_type == I_SLICE) +- return; ++ if (s->sh.slice_type == I_SLICE) { ++#ifdef RPI_MULTI_MAILBOX ++ rpi_execute_transform(s); ++ return; ++#endif ++ } + for(k=0;k<8;k++) { + s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS] = qpu_get_fn(QPU_MC_EXIT); // Add exit command + s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS+3] = qpu_get_fn(QPU_MC_SETUP_UV); // A dummy texture location (maps to our code) - this is needed as the texture requests are pipelined +@@ -2845,6 +2854,22 @@ static void rpi_execute_inter_qpu(HEVCContext *s) + + s->u_mvs[8-1][-RPI_CHROMA_COMMAND_WORDS] = qpu_get_fn(QPU_MC_INTERRUPT_EXIT8); // This QPU will signal interrupt when all others are done and have acquired a semaphore + ++#ifdef RPI_MULTI_MAILBOX ++ gpu_cache_flush(&s->coeffs_buf_accelerated); ++ s->vpu_id = vpu_qpu_post_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf_vc[2], s->num_coeffs[2] >> 8, s->coeffs_buf_vc[3], s->num_coeffs[3] >> 10, 0, ++ qpu_get_fn(QPU_MC_SETUP_UV), ++ (uint32_t)(unif_vc+(s->mvs_base[0 ] - (uint32_t*)s->unif_mvs_ptr.arm)), ++ (uint32_t)(unif_vc+(s->mvs_base[1 ] - (uint32_t*)s->unif_mvs_ptr.arm)), ++ (uint32_t)(unif_vc+(s->mvs_base[2 ] - (uint32_t*)s->unif_mvs_ptr.arm)), ++ (uint32_t)(unif_vc+(s->mvs_base[3 ] - (uint32_t*)s->unif_mvs_ptr.arm)), ++ (uint32_t)(unif_vc+(s->mvs_base[4 ] - (uint32_t*)s->unif_mvs_ptr.arm)), ++ (uint32_t)(unif_vc+(s->mvs_base[5 ] - (uint32_t*)s->unif_mvs_ptr.arm)), ++ (uint32_t)(unif_vc+(s->mvs_base[6 ] - (uint32_t*)s->unif_mvs_ptr.arm)), ++ (uint32_t)(unif_vc+(s->mvs_base[7 ] - (uint32_t*)s->unif_mvs_ptr.arm)) ++ ); ++ for(i=0;i<4;i++) ++ s->num_coeffs[i] = 0; ++#else + qpu_run_shader8(qpu_get_fn(QPU_MC_SETUP_UV), + (uint32_t)(unif_vc+(s->mvs_base[0 ] - (uint32_t*)s->unif_mvs_ptr.arm)), + (uint32_t)(unif_vc+(s->mvs_base[1 ] - (uint32_t*)s->unif_mvs_ptr.arm)), +@@ -2855,6 +2880,7 @@ static void rpi_execute_inter_qpu(HEVCContext *s) + (uint32_t)(unif_vc+(s->mvs_base[6 ] - (uint32_t*)s->unif_mvs_ptr.arm)), + (uint32_t)(unif_vc+(s->mvs_base[7 ] - (uint32_t*)s->unif_mvs_ptr.arm)) + ); ++#endif + } + #endif + +@@ -2934,6 +2960,12 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) + if ( (((y_ctb + ctb_size)&63) == 0) && x_ctb + ctb_size >= s->ps.sps->width) { + // Transform all blocks + // printf("%d %d %d : %d %d %d %d\n",s->poc, x_ctb, y_ctb, s->num_pred_cmds,s->num_mv_cmds,s->num_coeffs[2] >> 8,s->num_coeffs[3] >> 10); ++#ifdef RPI_MULTI_MAILBOX ++ // Kick off inter prediction on QPUs ++ rpi_execute_inter_qpu(s); ++ // Perform luma inter prediction ++ rpi_execute_inter_cmds(s); ++#else + rpi_execute_transform(s); + // Perform inter prediction + rpi_execute_inter_cmds(s); +@@ -2941,6 +2973,8 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) + // Kick off inter prediction on QPUs + rpi_execute_inter_qpu(s); + #endif ++#endif ++ + // Wait for transform completion + vpu_wait(s->vpu_id); + +diff --git a/libavcodec/rpi_mailbox.c b/libavcodec/rpi_mailbox.c +index 77a56dd..3904efc 100644 +--- a/libavcodec/rpi_mailbox.c ++++ b/libavcodec/rpi_mailbox.c +@@ -276,6 +276,53 @@ unsigned execute_qpu(int file_desc, unsigned num_qpus, unsigned control, unsigne + return p[5]; + } + ++void execute_multi(int file_desc, ++ unsigned num_qpus, unsigned control, unsigned noflush, unsigned timeout, ++ unsigned num_qpus_2, unsigned control_2, unsigned noflush_2, unsigned timeout_2, ++ unsigned code, unsigned r0, unsigned r1, unsigned r2, unsigned r3, unsigned r4, unsigned r5, ++ unsigned code_2, unsigned r0_2, unsigned r1_2, unsigned r2_2, unsigned r3_2, unsigned r4_2, unsigned r5_2) { ++ int i=0; ++ unsigned p[32]; ++ ++ p[i++] = 0; // size ++ p[i++] = 0x00000000; // process request ++ p[i++] = 0x30018; // (the tag id) ++ p[i++] = 88; // (size of the buffer) ++ p[i++] = 88; // (size of the data) ++ ++ p[i++] = num_qpus; ++ p[i++] = control; ++ p[i++] = noflush; ++ p[i++] = timeout; // ms ++ ++ p[i++] = num_qpus_2; ++ p[i++] = control_2; ++ p[i++] = noflush_2; ++ p[i++] = timeout_2; // ms ++ ++ p[i++] = code; ++ p[i++] = r0; ++ p[i++] = r1; ++ p[i++] = r2; ++ p[i++] = r3; ++ p[i++] = r4; ++ p[i++] = r5; ++ ++ p[i++] = code_2; ++ p[i++] = r0_2; ++ p[i++] = r1_2; ++ p[i++] = r2_2; ++ p[i++] = r3_2; ++ p[i++] = r4_2; ++ p[i++] = r5_2; ++ ++ p[i++] = 0x00000000; // end tag ++ p[0] = i*sizeof *p; // actual size ++ ++ mbox_property(file_desc, p); ++ return; ++} ++ + int mbox_open() { + int file_desc; + +diff --git a/libavcodec/rpi_mailbox.h b/libavcodec/rpi_mailbox.h +index c264d2e..5898102 100644 +--- a/libavcodec/rpi_mailbox.h ++++ b/libavcodec/rpi_mailbox.h +@@ -15,6 +15,11 @@ extern void unmapmem(void *addr, unsigned size); + + extern unsigned execute_code(int file_desc, unsigned code, unsigned r0, unsigned r1, unsigned r2, unsigned r3, unsigned r4, unsigned r5); + extern unsigned execute_qpu(int file_desc, unsigned num_qpus, unsigned control, unsigned noflush, unsigned timeout); ++extern void execute_multi(int file_desc, ++ unsigned num_qpus, unsigned control, unsigned noflush, unsigned timeout, ++ unsigned num_qpus_2, unsigned control_2, unsigned noflush_2, unsigned timeout_2, ++ unsigned code, unsigned r0, unsigned r1, unsigned r2, unsigned r3, unsigned r4, unsigned r5, ++ unsigned code_2, unsigned r0_2, unsigned r1_2, unsigned r2_2, unsigned r3_2, unsigned r4_2, unsigned r5_2); + extern unsigned qpu_enable(int file_desc, unsigned enable); + + #endif +diff --git a/libavcodec/rpi_qpu.c b/libavcodec/rpi_qpu.c +index fd8a276..feb3284 100644 +--- a/libavcodec/rpi_qpu.c ++++ b/libavcodec/rpi_qpu.c +@@ -123,7 +123,7 @@ static pthread_cond_t post_cond_head = PTHREAD_COND_INITIALIZER; + static pthread_cond_t post_cond_tail = PTHREAD_COND_INITIALIZER; + static pthread_mutex_t post_mutex = PTHREAD_MUTEX_INITIALIZER; + +-static int vpu_cmds[MAXCMDS][8]; ++static int vpu_cmds[MAXCMDS][16]; + static volatile int vpu_async_tail=0; // Contains the number of posted jobs + static volatile int vpu_async_head=0; + #endif +@@ -346,6 +346,7 @@ unsigned int vpu_get_constants(void) { + static void *vpu_start(void *arg) { + while(1) { + int *p; ++ int qpu_code; + pthread_mutex_lock(&post_mutex); + while( vpu_async_tail - vpu_async_head <= 0) + { +@@ -358,12 +359,25 @@ static void *vpu_start(void *arg) { + if (p[6] == -1) { + break; // Last job + } +- if (p[7]) { ++ qpu_code = p[7]; ++ //if (p[7]) { + //GPU_MEM_PTR_T *buf = (GPU_MEM_PTR_T *)p[7]; + //gpu_cache_flush(buf); +- } +- vpu_execute_code(p[0], p[1], p[2], p[3], p[4], p[5], p[6]); ++ //} ++ if (!qpu_code) { ++ vpu_execute_code(p[0], p[1], p[2], p[3], p[4], p[5], p[6]); ++ } else { ++ int i; ++ for(i=0;i<8;i++) { ++ gpu->mail[i*2] = p[8+i]; ++ gpu->mail[i*2 + 1] = qpu_code; ++ } + ++ execute_multi(gpu->mb,8,gpu->vc + offsetof(struct GPU, mail), 1 /* no flush */, 5000 /* timeout ms */, ++ 0, 0, 0, 0, ++ p[0], p[1], p[2], p[3], p[4], p[5], p[6], // VPU0 ++ 0, 0 , 0 , 0 , 0 , 0 , 0); // VPU1 ++ } + pthread_mutex_lock(&post_mutex); + vpu_async_head++; + pthread_cond_broadcast(&post_cond_head); +@@ -400,7 +414,43 @@ int vpu_post_code(unsigned code, unsigned r0, unsigned r1, unsigned r2, unsigned + p[4] = r3; + p[5] = r4; + p[6] = r5; +- p[7] = (int) buf; ++ p[7] = 0; ++ if (num<=1) ++ pthread_cond_broadcast(&post_cond_tail); // Otherwise the vpu thread must already be awake ++ pthread_mutex_unlock(&post_mutex); ++ return id; ++ } ++} ++ ++int vpu_qpu_post_code(unsigned vpu_code, unsigned r0, unsigned r1, unsigned r2, unsigned r3, unsigned r4, unsigned r5, ++ int qpu_code, int unifs1, int unifs2, int unifs3, int unifs4, int unifs5, int unifs6, int unifs7, int unifs8) ++{ ++ ++ pthread_mutex_lock(&post_mutex); ++ { ++ int id = vpu_async_tail++; ++ int *p = vpu_cmds[id%MAXCMDS]; ++ int num = vpu_async_tail - vpu_async_head; ++ if (num>MAXCMDS) { ++ printf("Too many commands submitted\n"); ++ exit(-1); ++ } ++ p[0] = vpu_code; ++ p[1] = r0; ++ p[2] = r1; ++ p[3] = r2; ++ p[4] = r3; ++ p[5] = r4; ++ p[6] = r5; ++ p[7] = qpu_code; ++ p[8 ] = unifs1; ++ p[9 ] = unifs2; ++ p[10] = unifs3; ++ p[11] = unifs4; ++ p[12] = unifs5; ++ p[13] = unifs6; ++ p[14] = unifs7; ++ p[15] = unifs8; + if (num<=1) + pthread_cond_broadcast(&post_cond_tail); // Otherwise the vpu thread must already be awake + pthread_mutex_unlock(&post_mutex); +@@ -966,6 +1016,7 @@ void rpi_do_block(const uint8_t *in_buffer_vc, int src_pitch, uint8_t *dst_vc, i + } + + ++ + #endif + + #endif // RPI +diff --git a/libavcodec/rpi_qpu.h b/libavcodec/rpi_qpu.h +index 88965e5..2f08f03 100644 +--- a/libavcodec/rpi_qpu.h ++++ b/libavcodec/rpi_qpu.h +@@ -41,6 +41,8 @@ extern unsigned int vpu_get_fn(void); + extern unsigned int vpu_get_constants(void); + extern unsigned vpu_execute_code( unsigned code, unsigned r0, unsigned r1, unsigned r2, unsigned r3, unsigned r4, unsigned r5); + extern int vpu_post_code( unsigned code, unsigned r0, unsigned r1, unsigned r2, unsigned r3, unsigned r4, unsigned r5, GPU_MEM_PTR_T *buf); ++int vpu_qpu_post_code(unsigned vpu_code, unsigned r0, unsigned r1, unsigned r2, unsigned r3, unsigned r4, unsigned r5, ++ int qpu_code, int unifs1, int unifs2, int unifs3, int unifs4, int unifs5, int unifs6, int unifs7, int unifs8); + extern void vpu_wait( int id); + + // Simple test of shader code +-- +2.5.0 + + +From 71b8a1d77652d1cc298df2a1441ef3c913c2926b Mon Sep 17 00:00:00 2001 +From: popcornmix <popcornmix@gmail.com> +Date: Thu, 21 May 2015 16:50:02 +0100 +Subject: [PATCH 44/68] Pass qpu number in as uniform + +--- + libavcodec/hevc.c | 2 +- + libavcodec/rpi_shader.c | 1288 ++++++++++++++++++++++---------------------- + libavcodec/rpi_shader.h | 20 +- + libavcodec/rpi_shader.qasm | 10 +- + 4 files changed, 657 insertions(+), 663 deletions(-) + +diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c +index 2ca783a..9605459 100644 +--- a/libavcodec/hevc.c ++++ b/libavcodec/hevc.c +@@ -2823,6 +2823,7 @@ static void rpi_inter_clear(HEVCContext *s) + *s->u_mvs[i]++ = pic_height; + *s->u_mvs[i]++ = s->frame->linesize[1]; + *s->u_mvs[i]++ = s->frame->linesize[2]; ++ *s->u_mvs[i]++ = i; + if (weight_flag) { + *s->u_mvs[i]++ = 1 << (s->sh.chroma_log2_weight_denom + 6 - 1); + *s->u_mvs[i]++ = s->sh.chroma_log2_weight_denom + 6; +@@ -2830,7 +2831,6 @@ static void rpi_inter_clear(HEVCContext *s) + *s->u_mvs[i]++ = 1 << 5; + *s->u_mvs[i]++ = 6; + } +- s->u_mvs[i] += 1; // Padding words + } + } + +diff --git a/libavcodec/rpi_shader.c b/libavcodec/rpi_shader.c +index 9c30e32..a0f0282 100644 +--- a/libavcodec/rpi_shader.c ++++ b/libavcodec/rpi_shader.c +@@ -48,8 +48,8 @@ unsigned int rpi_shader[] = { + /* [0x000000b8] */ 0x00000000, 0xe0020367, // mov ra13, 0 + /* [0x000000c0] */ 0x00000000, 0xe00203a7, // mov ra14, 0 + /* [0x000000c8] */ 0x00000000, 0xe00203e7, // mov ra15, 0 +-/* [0x000000d0] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num +-/* [0x000000d8] */ 0x119c15c0, 0xd00208a7, // shl r2, r2, 1 ++/* [0x000000d0] */ 0x15827d80, 0x100208e7, // mov r3, unif ++/* [0x000000d8] */ 0x119c17c0, 0xd00208a7, // shl r2, r3, 1 + /* [0x000000e0] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 + /* [0x000000e8] */ 0x159e7480, 0x10020867, // mov r1, r2 + /* [0x000000f0] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 +@@ -60,669 +60,669 @@ unsigned int rpi_shader[] = { + /* [0x00000118] */ 0x80004004, 0xe0020867, // mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) + /* [0x00000120] */ 0x119c51c0, 0xd0020827, // shl r0, r0, 5 + /* [0x00000128] */ 0x0c9e7040, 0x100216e7, // add rb27, r0, r1 +-/* [0x00000130] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num +-/* [0x00000138] */ 0x119c15c0, 0xd00208a7, // shl r2, r2, 1 +-/* [0x00000140] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 +-/* [0x00000148] */ 0x159e7480, 0x10020867, // mov r1, r2 +-/* [0x00000150] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 +-/* [0x00000158] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 +-/* [0x00000160] */ 0x159e7480, 0x10020827, // mov r0, r2 +-/* [0x00000168] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 +-/* [0x00000170] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 +-/* [0x00000178] */ 0x00004800, 0xe0020867, // mov r1, vpm_setup(0, 4, h8p(0, 0)) +-/* [0x00000180] */ 0x0c9e7040, 0x10021727, // add rb28, r0, r1 +-/* [0x00000188] */ 0x0f9c11c0, 0xd0020827, // asr r0, r0, 1 +-/* [0x00000190] */ 0x00002900, 0xe0020867, // mov r1, vpm_setup(0, 2, h16p(0, 0)) +-/* [0x00000198] */ 0x0c9e7040, 0x10021567, // add rb21, r0, r1 +-/* [0x000001a0] */ 0x15427d80, 0x10020827, // mov r0, ra_x +-/* [0x000001a8] */ 0x937401f6, 0xd0024821, // max r0, r0, 0; mov r1, ra_y +-/* [0x000001b0] */ 0x926191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, ra_frame_base +-/* [0x000001b8] */ 0x916431f6, 0xd00244e2, // shl ra_xshift_next, r0, 3 ; mov r2, ra_u2v_ref_offset +-/* [0x000001c0] */ 0x0c9c13c0, 0xd0020767, // add ra_y, r1, 1 +-/* [0x000001c8] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 +-/* [0x000001d0] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 +-/* [0x000001d8] */ 0x939c03c0, 0xd0025850, // max r1, r1, 0 ; mov ra_x, r0 +-/* [0x000001e0] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 +-/* [0x000001e8] */ 0x4c9d040f, 0x100248a1, // add r2, r2, r0 ; mul24 r1, r1, rb_pitch +-/* [0x000001f0] */ 0x8c9e7052, 0x10025e18, // add t0s, r0, r1 ; mov ra_frame_base, r2 +-/* [0x000001f8] */ 0x0c9e7440, 0x10020e27, // add t0s, r2, r1 +-/* [0x00000200] */ 0x15827d80, 0x10021327, // mov rb12,unif +-/* [0x00000208] */ 0x15827d80, 0x10021367, // mov rb13,unif +-/* [0x00000210] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000218] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 +-/* [0x00000220] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 +-/* [0x00000228] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 +-/* [0x00000230] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 +-/* [0x00000238] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch +-/* [0x00000240] */ 0x0c427380, 0x10020e27, // add t0s, r1, ra_x +-/* [0x00000248] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_frame_base ++/* [0x00000130] */ 0x119c17c0, 0xd00208a7, // shl r2, r3, 1 ++/* [0x00000138] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 ++/* [0x00000140] */ 0x159e7480, 0x10020867, // mov r1, r2 ++/* [0x00000148] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 ++/* [0x00000150] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 ++/* [0x00000158] */ 0x159e7480, 0x10020827, // mov r0, r2 ++/* [0x00000160] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 ++/* [0x00000168] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 ++/* [0x00000170] */ 0x00004800, 0xe0020867, // mov r1, vpm_setup(0, 4, h8p(0, 0)) ++/* [0x00000178] */ 0x0c9e7040, 0x10021727, // add rb28, r0, r1 ++/* [0x00000180] */ 0x0f9c11c0, 0xd0020827, // asr r0, r0, 1 ++/* [0x00000188] */ 0x00002900, 0xe0020867, // mov r1, vpm_setup(0, 2, h16p(0, 0)) ++/* [0x00000190] */ 0x0c9e7040, 0x10021567, // add rb21, r0, r1 ++/* [0x00000198] */ 0x15427d80, 0x10020827, // mov r0, ra_x ++/* [0x000001a0] */ 0x937401f6, 0xd0024821, // max r0, r0, 0; mov r1, ra_y ++/* [0x000001a8] */ 0x926191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, ra_frame_base ++/* [0x000001b0] */ 0x916431f6, 0xd00244e2, // shl ra_xshift_next, r0, 3 ; mov r2, ra_u2v_ref_offset ++/* [0x000001b8] */ 0x0c9c13c0, 0xd0020767, // add ra_y, r1, 1 ++/* [0x000001c0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 ++/* [0x000001c8] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 ++/* [0x000001d0] */ 0x939c03c0, 0xd0025850, // max r1, r1, 0 ; mov ra_x, r0 ++/* [0x000001d8] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 ++/* [0x000001e0] */ 0x4c9d040f, 0x100248a1, // add r2, r2, r0 ; mul24 r1, r1, rb_pitch ++/* [0x000001e8] */ 0x8c9e7052, 0x10025e18, // add t0s, r0, r1 ; mov ra_frame_base, r2 ++/* [0x000001f0] */ 0x0c9e7440, 0x10020e27, // add t0s, r2, r1 ++/* [0x000001f8] */ 0x15827d80, 0x10021327, // mov rb12,unif ++/* [0x00000200] */ 0x15827d80, 0x10021367, // mov rb13,unif ++/* [0x00000208] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 ++/* [0x00000210] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 ++/* [0x00000218] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 ++/* [0x00000220] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 ++/* [0x00000228] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch ++/* [0x00000230] */ 0x0c427380, 0x10020e27, // add t0s, r1, ra_x ++/* [0x00000238] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_frame_base + // ::mc_filter_uv +-/* [0x00000250] */ 0x15827d80, 0x100207e7, // mov ra31, unif +-/* [0x00000258] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next +-/* [0x00000260] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num +-/* [0x00000268] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif +-/* [0x00000270] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif +-/* [0x00000278] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 +-/* [0x00000280] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 +-/* [0x00000288] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 +-/* [0x00000290] */ 0x149dc1c0, 0xd00214e7, // and rb_x_next, r0, ~3 +-/* [0x00000298] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 +-/* [0x000002a0] */ 0x0c9d3e80, 0x100206a7, // add ra_frame_base_next, rb_x_next, r2 +-/* [0x000002a8] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 +-/* [0x000002b0] */ 0x00000010, 0xe00208a7, // mov r2, 16 +-/* [0x000002b8] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x000002c0] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 +-/* [0x000002c8] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 +-/* [0x000002d0] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 +-/* [0x000002d8] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 +-/* [0x000002e0] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 +-/* [0x000002e8] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 +-/* [0x000002f0] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 +-/* [0x000002f8] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 +-/* [0x00000300] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 +-/* [0x00000308] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000310] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000318] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000320] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000328] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif +-/* [0x00000330] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000338] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000340] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000348] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 +-/* [0x00000350] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-/* [0x00000358] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000360] */ 0x0f9e7080, 0x100213e7, // asr rb15, r0, r2 +-/* [0x00000368] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 +-/* [0x00000370] */ 0x0f9e7080, 0x100213a7, // asr rb14, r0, r2 +-/* [0x00000378] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000380] */ 0x0f9e7080, 0x100613e7, // asr.ifnz rb15, r0, r2 +-/* [0x00000388] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 +-/* [0x00000390] */ 0x0f9e7080, 0x100613a7, // asr.ifnz rb14, r0, r2 +-/* [0x00000398] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 +-/* [0x000003a0] */ 0x00000000, 0xe00208e7, // mov r3, 0 ++/* [0x00000240] */ 0x15827d80, 0x100207e7, // mov ra31, unif ++/* [0x00000248] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next ++/* [0x00000250] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num ++/* [0x00000258] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif ++/* [0x00000260] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif ++/* [0x00000268] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 ++/* [0x00000270] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 ++/* [0x00000278] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 ++/* [0x00000280] */ 0x149dc1c0, 0xd00214e7, // and rb_x_next, r0, ~3 ++/* [0x00000288] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 ++/* [0x00000290] */ 0x0c9d3e80, 0x100206a7, // add ra_frame_base_next, rb_x_next, r2 ++/* [0x00000298] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 ++/* [0x000002a0] */ 0x00000010, 0xe00208a7, // mov r2, 16 ++/* [0x000002a8] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x000002b0] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 ++/* [0x000002b8] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 ++/* [0x000002c0] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 ++/* [0x000002c8] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 ++/* [0x000002d0] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 ++/* [0x000002d8] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 ++/* [0x000002e0] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 ++/* [0x000002e8] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 ++/* [0x000002f0] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 ++/* [0x000002f8] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000300] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000308] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000310] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000318] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif ++/* [0x00000320] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000328] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000330] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000338] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 ++/* [0x00000340] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x00000348] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000350] */ 0x0f9e7080, 0x100213e7, // asr rb15, r0, r2 ++/* [0x00000358] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 ++/* [0x00000360] */ 0x0f9e7080, 0x100213a7, // asr rb14, r0, r2 ++/* [0x00000368] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000370] */ 0x0f9e7080, 0x100613e7, // asr.ifnz rb15, r0, r2 ++/* [0x00000378] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 ++/* [0x00000380] */ 0x0f9e7080, 0x100613a7, // asr.ifnz rb14, r0, r2 ++/* [0x00000388] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 ++/* [0x00000390] */ 0x00000000, 0xe00208e7, // mov r3, 0 + // :uvloop +-/* [0x000003a8] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 +-/* [0x000003b0] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu0 +-/* [0x000003b8] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 +-/* [0x000003c0] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch +-/* [0x000003c8] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 +-/* [0x000003d0] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 +-/* [0x000003d8] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 +-/* [0x000003e0] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 +-/* [0x000003e8] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x, r2 ; v8subs r1, r1, rb20 +-/* [0x000003f0] */ 0x0c627c80, 0x10020e27, // add t0s, ra_frame_base, r2 +-/* [0x000003f8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-/* [0x00000400] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 +-/* [0x00000408] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 +-/* [0x00000410] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 +-/* [0x00000418] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 +-/* [0x00000420] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 +-/* [0x00000428] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 +-/* [0x00000430] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 +-/* [0x00000438] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 +-/* [0x00000440] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 +-/* [0x00000448] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 +-/* [0x00000450] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop +-/* [0x00000458] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 +-/* [0x00000460] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 +-/* [0x00000468] */ 0x159e7000, 0x100203e7, // mov ra15, r0 +-/* [0x00000470] */ 0x00000020, 0xe0021327, // mov rb12,32 +-/* [0x00000478] */ 0x00000006, 0xe0021367, // mov rb13,6 +-/* [0x00000480] */ 0x00000001, 0xe00213a7, // mov rb14,1 +-/* [0x00000488] */ 0x00000000, 0xe00213e7, // mov rb15,0 +-/* [0x00000490] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 +-/* [0x00000498] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 +-/* [0x000004a0] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 +-/* [0x000004a8] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 +-/* [0x000004b0] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait +-/* [0x000004b8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 +-/* [0x000004c0] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 +-/* [0x000004c8] */ 0x409ce00f, 0x100049e1, // nop ; mul24 r1, r1, rb14 +-/* [0x000004d0] */ 0x0c9cc3c0, 0x10020867, // add r1, r1, rb12 +-/* [0x000004d8] */ 0x0f9cd3c0, 0x10020867, // asr r1, r1, rb13 +-/* [0x000004e0] */ 0xfffffea8, 0xf06809e7, // brr.anyn -, r:uvloop +-/* [0x000004e8] */ 0x0c9cf3c0, 0x10020867, // add r1, r1, rb15 +-/* [0x000004f0] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 +-/* [0x000004f8] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 +-/* [0x00000500] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 +-/* [0x00000508] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 +-/* [0x00000510] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif +-/* [0x00000518] */ 0x00000010, 0xe0020827, // mov r0, 16 +-/* [0x00000520] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait +-/* [0x00000528] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 +-/* [0x00000530] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 +-/* [0x00000538] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 +-/* [0x00000540] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif ++/* [0x00000398] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 ++/* [0x000003a0] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu0 ++/* [0x000003a8] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 ++/* [0x000003b0] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch ++/* [0x000003b8] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 ++/* [0x000003c0] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 ++/* [0x000003c8] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 ++/* [0x000003d0] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 ++/* [0x000003d8] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x, r2 ; v8subs r1, r1, rb20 ++/* [0x000003e0] */ 0x0c627c80, 0x10020e27, // add t0s, ra_frame_base, r2 ++/* [0x000003e8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x000003f0] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 ++/* [0x000003f8] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 ++/* [0x00000400] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 ++/* [0x00000408] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 ++/* [0x00000410] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 ++/* [0x00000418] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 ++/* [0x00000420] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 ++/* [0x00000428] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 ++/* [0x00000430] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 ++/* [0x00000438] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 ++/* [0x00000440] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop ++/* [0x00000448] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 ++/* [0x00000450] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 ++/* [0x00000458] */ 0x159e7000, 0x100203e7, // mov ra15, r0 ++/* [0x00000460] */ 0x00000020, 0xe0021327, // mov rb12,32 ++/* [0x00000468] */ 0x00000006, 0xe0021367, // mov rb13,6 ++/* [0x00000470] */ 0x00000001, 0xe00213a7, // mov rb14,1 ++/* [0x00000478] */ 0x00000000, 0xe00213e7, // mov rb15,0 ++/* [0x00000480] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 ++/* [0x00000488] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 ++/* [0x00000490] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 ++/* [0x00000498] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 ++/* [0x000004a0] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait ++/* [0x000004a8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 ++/* [0x000004b0] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 ++/* [0x000004b8] */ 0x409ce00f, 0x100049e1, // nop ; mul24 r1, r1, rb14 ++/* [0x000004c0] */ 0x0c9cc3c0, 0x10020867, // add r1, r1, rb12 ++/* [0x000004c8] */ 0x0f9cd3c0, 0x10020867, // asr r1, r1, rb13 ++/* [0x000004d0] */ 0xfffffea8, 0xf06809e7, // brr.anyn -, r:uvloop ++/* [0x000004d8] */ 0x0c9cf3c0, 0x10020867, // add r1, r1, rb15 ++/* [0x000004e0] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 ++/* [0x000004e8] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 ++/* [0x000004f0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 ++/* [0x000004f8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 ++/* [0x00000500] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif ++/* [0x00000508] */ 0x00000010, 0xe0020827, // mov r0, 16 ++/* [0x00000510] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x00000518] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 ++/* [0x00000520] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 ++/* [0x00000528] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 ++/* [0x00000530] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif + // ::mc_filter_uv_b0 +-/* [0x00000548] */ 0x15827d80, 0x100207e7, // mov ra31, unif +-/* [0x00000550] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next +-/* [0x00000558] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num +-/* [0x00000560] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif +-/* [0x00000568] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif +-/* [0x00000570] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 +-/* [0x00000578] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 +-/* [0x00000580] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 +-/* [0x00000588] */ 0x149dc1c0, 0xd00214e7, // and rb_x_next, r0, ~3 +-/* [0x00000590] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 +-/* [0x00000598] */ 0x0c9d3e80, 0x100206a7, // add ra_frame_base_next, rb_x_next, r2 +-/* [0x000005a0] */ 0x159d5fc0, 0x10021c67, // mov vw_setup, rb21 +-/* [0x000005a8] */ 0x00000010, 0xe00208a7, // mov r2, 16 +-/* [0x000005b0] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x000005b8] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 +-/* [0x000005c0] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 +-/* [0x000005c8] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 +-/* [0x000005d0] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 +-/* [0x000005d8] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 +-/* [0x000005e0] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 +-/* [0x000005e8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 +-/* [0x000005f0] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 +-/* [0x000005f8] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 +-/* [0x00000600] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000608] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000610] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000618] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000620] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif +-/* [0x00000628] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000630] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000638] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000640] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 +-/* [0x00000648] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000650] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000658] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 +-/* [0x00000660] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-/* [0x00000668] */ 0x00000000, 0xe00208e7, // mov r3, 0 ++/* [0x00000538] */ 0x15827d80, 0x100207e7, // mov ra31, unif ++/* [0x00000540] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next ++/* [0x00000548] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num ++/* [0x00000550] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif ++/* [0x00000558] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif ++/* [0x00000560] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 ++/* [0x00000568] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 ++/* [0x00000570] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 ++/* [0x00000578] */ 0x149dc1c0, 0xd00214e7, // and rb_x_next, r0, ~3 ++/* [0x00000580] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 ++/* [0x00000588] */ 0x0c9d3e80, 0x100206a7, // add ra_frame_base_next, rb_x_next, r2 ++/* [0x00000590] */ 0x159d5fc0, 0x10021c67, // mov vw_setup, rb21 ++/* [0x00000598] */ 0x00000010, 0xe00208a7, // mov r2, 16 ++/* [0x000005a0] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x000005a8] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 ++/* [0x000005b0] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 ++/* [0x000005b8] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 ++/* [0x000005c0] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 ++/* [0x000005c8] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 ++/* [0x000005d0] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 ++/* [0x000005d8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 ++/* [0x000005e0] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 ++/* [0x000005e8] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 ++/* [0x000005f0] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x000005f8] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000600] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000608] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000610] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif ++/* [0x00000618] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000620] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000628] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000630] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 ++/* [0x00000638] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000640] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000648] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 ++/* [0x00000650] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x00000658] */ 0x00000000, 0xe00208e7, // mov r3, 0 + // :uvloop_b0 +-/* [0x00000670] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 +-/* [0x00000678] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu0 +-/* [0x00000680] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 +-/* [0x00000688] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch +-/* [0x00000690] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 +-/* [0x00000698] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 +-/* [0x000006a0] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 +-/* [0x000006a8] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 +-/* [0x000006b0] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x, r2 ; v8subs r1, r1, rb20 +-/* [0x000006b8] */ 0x0c627c80, 0x10020e27, // add t0s, ra_frame_base, r2 +-/* [0x000006c0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-/* [0x000006c8] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 +-/* [0x000006d0] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 +-/* [0x000006d8] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 +-/* [0x000006e0] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 +-/* [0x000006e8] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 +-/* [0x000006f0] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 +-/* [0x000006f8] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 +-/* [0x00000700] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 +-/* [0x00000708] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 +-/* [0x00000710] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 +-/* [0x00000718] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b0 +-/* [0x00000720] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 +-/* [0x00000728] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 +-/* [0x00000730] */ 0x159e7000, 0x100203e7, // mov ra15, r0 +-/* [0x00000738] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 +-/* [0x00000740] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 +-/* [0x00000748] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 +-/* [0x00000750] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 +-/* [0x00000758] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait +-/* [0x00000760] */ 0x0d9d27c0, 0x100229e7, // sub.setf -, r3, rb18 +-/* [0x00000768] */ 0xfffffee8, 0xf06809e7, // brr.anyn -, r:uvloop_b0 +-/* [0x00000770] */ 0x0f9c63c0, 0xd0020c27, // asr vpm, r1, 6 +-/* [0x00000778] */ 0x009e7000, 0x100009e7, // nop +-/* [0x00000780] */ 0x009e7000, 0x100009e7, // nop +-/* [0x00000788] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 +-/* [0x00000790] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000798] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x000007a0] */ 0x009e7000, 0x100009e7, // nop ++/* [0x00000660] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 ++/* [0x00000668] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu0 ++/* [0x00000670] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 ++/* [0x00000678] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch ++/* [0x00000680] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 ++/* [0x00000688] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 ++/* [0x00000690] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 ++/* [0x00000698] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 ++/* [0x000006a0] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x, r2 ; v8subs r1, r1, rb20 ++/* [0x000006a8] */ 0x0c627c80, 0x10020e27, // add t0s, ra_frame_base, r2 ++/* [0x000006b0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x000006b8] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 ++/* [0x000006c0] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 ++/* [0x000006c8] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 ++/* [0x000006d0] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 ++/* [0x000006d8] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 ++/* [0x000006e0] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 ++/* [0x000006e8] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 ++/* [0x000006f0] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 ++/* [0x000006f8] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 ++/* [0x00000700] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 ++/* [0x00000708] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b0 ++/* [0x00000710] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 ++/* [0x00000718] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 ++/* [0x00000720] */ 0x159e7000, 0x100203e7, // mov ra15, r0 ++/* [0x00000728] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 ++/* [0x00000730] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 ++/* [0x00000738] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 ++/* [0x00000740] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 ++/* [0x00000748] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait ++/* [0x00000750] */ 0x0d9d27c0, 0x100229e7, // sub.setf -, r3, rb18 ++/* [0x00000758] */ 0xfffffee8, 0xf06809e7, // brr.anyn -, r:uvloop_b0 ++/* [0x00000760] */ 0x0f9c63c0, 0xd0020c27, // asr vpm, r1, 6 ++/* [0x00000768] */ 0x009e7000, 0x100009e7, // nop ++/* [0x00000770] */ 0x009e7000, 0x100009e7, // nop ++/* [0x00000778] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 ++/* [0x00000780] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000788] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000790] */ 0x009e7000, 0x100009e7, // nop + // ::mc_filter_uv_b +-/* [0x000007a8] */ 0x15827d80, 0x100207e7, // mov ra31, unif +-/* [0x000007b0] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next +-/* [0x000007b8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num +-/* [0x000007c0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif +-/* [0x000007c8] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif +-/* [0x000007d0] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 +-/* [0x000007d8] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 +-/* [0x000007e0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 +-/* [0x000007e8] */ 0x149dc1c0, 0xd00214e7, // and rb_x_next, r0, ~3 +-/* [0x000007f0] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 +-/* [0x000007f8] */ 0x0c9d3e80, 0x100206a7, // add ra_frame_base_next, rb_x_next, r2 +-/* [0x00000800] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 +-/* [0x00000808] */ 0x00000010, 0xe00208a7, // mov r2, 16 +-/* [0x00000810] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000818] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 +-/* [0x00000820] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 +-/* [0x00000828] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 +-/* [0x00000830] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 +-/* [0x00000838] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 +-/* [0x00000840] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 +-/* [0x00000848] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 +-/* [0x00000850] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 +-/* [0x00000858] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 +-/* [0x00000860] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 +-/* [0x00000868] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 +-/* [0x00000870] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 +-/* [0x00000878] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 +-/* [0x00000880] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000888] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000890] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000898] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000008a0] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif +-/* [0x000008a8] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000008b0] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000008b8] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000008c0] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 +-/* [0x000008c8] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x000008d0] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x000008d8] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 +-/* [0x000008e0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-/* [0x000008e8] */ 0x00000000, 0xe00208e7, // mov r3, 0 ++/* [0x00000798] */ 0x15827d80, 0x100207e7, // mov ra31, unif ++/* [0x000007a0] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next ++/* [0x000007a8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num ++/* [0x000007b0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif ++/* [0x000007b8] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif ++/* [0x000007c0] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 ++/* [0x000007c8] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 ++/* [0x000007d0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 ++/* [0x000007d8] */ 0x149dc1c0, 0xd00214e7, // and rb_x_next, r0, ~3 ++/* [0x000007e0] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 ++/* [0x000007e8] */ 0x0c9d3e80, 0x100206a7, // add ra_frame_base_next, rb_x_next, r2 ++/* [0x000007f0] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 ++/* [0x000007f8] */ 0x00000010, 0xe00208a7, // mov r2, 16 ++/* [0x00000800] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000808] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 ++/* [0x00000810] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 ++/* [0x00000818] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 ++/* [0x00000820] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 ++/* [0x00000828] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 ++/* [0x00000830] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 ++/* [0x00000838] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 ++/* [0x00000840] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 ++/* [0x00000848] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 ++/* [0x00000850] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 ++/* [0x00000858] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 ++/* [0x00000860] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 ++/* [0x00000868] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 ++/* [0x00000870] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000878] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000880] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000888] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000890] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif ++/* [0x00000898] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000008a0] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000008a8] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000008b0] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 ++/* [0x000008b8] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x000008c0] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x000008c8] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 ++/* [0x000008d0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x000008d8] */ 0x00000000, 0xe00208e7, // mov r3, 0 + // :uvloop_b +-/* [0x000008f0] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 +-/* [0x000008f8] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu0 +-/* [0x00000900] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 +-/* [0x00000908] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch +-/* [0x00000910] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 +-/* [0x00000918] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 +-/* [0x00000920] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 +-/* [0x00000928] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 +-/* [0x00000930] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x, r2 ; v8subs r1, r1, rb20 +-/* [0x00000938] */ 0x0c627c80, 0x10020e27, // add t0s, ra_frame_base, r2 +-/* [0x00000940] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-/* [0x00000948] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 +-/* [0x00000950] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 +-/* [0x00000958] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 +-/* [0x00000960] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 +-/* [0x00000968] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 +-/* [0x00000970] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 +-/* [0x00000978] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 +-/* [0x00000980] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 +-/* [0x00000988] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 +-/* [0x00000990] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 +-/* [0x00000998] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b +-/* [0x000009a0] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 +-/* [0x000009a8] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 +-/* [0x000009b0] */ 0x159e7000, 0x100203e7, // mov ra15, r0 +-/* [0x000009b8] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 +-/* [0x000009c0] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 +-/* [0x000009c8] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 +-/* [0x000009d0] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 +-/* [0x000009d8] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait +-/* [0x000009e0] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 +-/* [0x000009e8] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 +-/* [0x000009f0] */ 0x0cc27380, 0x10020867, // add r1, r1, vpm +-/* [0x000009f8] */ 0x0c7a7380, 0x10020867, // add r1, r1, ra30 +-/* [0x00000a00] */ 0xfffffed0, 0xf06809e7, // brr.anyn -, r:uvloop_b +-/* [0x00000a08] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 +-/* [0x00000a10] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 +-/* [0x00000a18] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 +-/* [0x00000a20] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 +-/* [0x00000a28] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 +-/* [0x00000a30] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif +-/* [0x00000a38] */ 0x00000010, 0xe0020827, // mov r0, 16 +-/* [0x00000a40] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait +-/* [0x00000a48] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 +-/* [0x00000a50] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 +-/* [0x00000a58] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 +-/* [0x00000a60] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif ++/* [0x000008e0] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 ++/* [0x000008e8] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu0 ++/* [0x000008f0] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 ++/* [0x000008f8] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch ++/* [0x00000900] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 ++/* [0x00000908] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 ++/* [0x00000910] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 ++/* [0x00000918] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 ++/* [0x00000920] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x, r2 ; v8subs r1, r1, rb20 ++/* [0x00000928] */ 0x0c627c80, 0x10020e27, // add t0s, ra_frame_base, r2 ++/* [0x00000930] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x00000938] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 ++/* [0x00000940] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 ++/* [0x00000948] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 ++/* [0x00000950] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 ++/* [0x00000958] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 ++/* [0x00000960] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 ++/* [0x00000968] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 ++/* [0x00000970] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 ++/* [0x00000978] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 ++/* [0x00000980] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 ++/* [0x00000988] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b ++/* [0x00000990] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 ++/* [0x00000998] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 ++/* [0x000009a0] */ 0x159e7000, 0x100203e7, // mov ra15, r0 ++/* [0x000009a8] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 ++/* [0x000009b0] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 ++/* [0x000009b8] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 ++/* [0x000009c0] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 ++/* [0x000009c8] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait ++/* [0x000009d0] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 ++/* [0x000009d8] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 ++/* [0x000009e0] */ 0x0cc27380, 0x10020867, // add r1, r1, vpm ++/* [0x000009e8] */ 0x0c7a7380, 0x10020867, // add r1, r1, ra30 ++/* [0x000009f0] */ 0xfffffed0, 0xf06809e7, // brr.anyn -, r:uvloop_b ++/* [0x000009f8] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 ++/* [0x00000a00] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 ++/* [0x00000a08] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 ++/* [0x00000a10] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 ++/* [0x00000a18] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 ++/* [0x00000a20] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif ++/* [0x00000a28] */ 0x00000010, 0xe0020827, // mov r0, 16 ++/* [0x00000a30] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x00000a38] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 ++/* [0x00000a40] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 ++/* [0x00000a48] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 ++/* [0x00000a50] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif + // ::mc_exit +-/* [0x00000a68] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait +-/* [0x00000a70] */ 0x00000000, 0xe80009e7, // mov -,srel(0) ++/* [0x00000a58] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x00000a60] */ 0x00000000, 0xe80009e7, // mov -,srel(0) ++/* [0x00000a68] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00000a70] */ 0x009e7000, 0xa00009e7, // ldtmu0 + /* [0x00000a78] */ 0x009e7000, 0xa00009e7, // ldtmu0 + /* [0x00000a80] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00000a88] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00000a90] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00000a98] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend +-/* [0x00000aa0] */ 0x009e7000, 0x100009e7, // nop ; nop +-/* [0x00000aa8] */ 0x009e7000, 0x100009e7, // nop ; nop ++/* [0x00000a88] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend ++/* [0x00000a90] */ 0x009e7000, 0x100009e7, // nop ; nop ++/* [0x00000a98] */ 0x009e7000, 0x100009e7, // nop ; nop + // ::mc_interrupt_exit8 +-/* [0x00000ab0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x00000aa0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x00000aa8] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00000ab0] */ 0x009e7000, 0xa00009e7, // ldtmu0 + /* [0x00000ab8] */ 0x009e7000, 0xa00009e7, // ldtmu0 + /* [0x00000ac0] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00000ac8] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00000ad0] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00000ac8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00000ad0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) + /* [0x00000ad8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) + /* [0x00000ae0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) + /* [0x00000ae8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) + /* [0x00000af0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) + /* [0x00000af8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00000b00] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00000b08] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00000b10] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend +-/* [0x00000b18] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop +-/* [0x00000b20] */ 0x009e7000, 0x100009e7, // nop ; nop ++/* [0x00000b00] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend ++/* [0x00000b08] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop ++/* [0x00000b10] */ 0x009e7000, 0x100009e7, // nop ; nop + // ::mc_setup +-/* [0x00000b28] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-/* [0x00000b30] */ 0x15827d80, 0x100207e7, // mov ra31, unif +-/* [0x00000b38] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num +-/* [0x00000b40] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif +-/* [0x00000b48] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif +-/* [0x00000b50] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 +-/* [0x00000b58] */ 0x0c9c13c0, 0xd0020767, // add ra_y, r1, 1 +-/* [0x00000b60] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 +-/* [0x00000b68] */ 0x0c9e7400, 0x100208a7, // add r2, r2, r0 +-/* [0x00000b70] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 +-/* [0x00000b78] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 +-/* [0x00000b80] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch +-/* [0x00000b88] */ 0x8c9e7452, 0x10025e18, // add t0s, r2, r1 ; mov ra_frame_base, r2 +-/* [0x00000b90] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num +-/* [0x00000b98] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif +-/* [0x00000ba0] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif +-/* [0x00000ba8] */ 0x119c31c0, 0xd00205e7, // shl rx_xshift2_next, r0, 3 +-/* [0x00000bb0] */ 0x0c9c13c0, 0xd0020567, // add ra_y2, r1, 1 +-/* [0x00000bb8] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 +-/* [0x00000bc0] */ 0x0c9e7400, 0x100208a7, // add r2, r2, r0 +-/* [0x00000bc8] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 +-/* [0x00000bd0] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 +-/* [0x00000bd8] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch +-/* [0x00000be0] */ 0x8c9e7452, 0x10025e19, // add t0s, r2, r1 ; mov ra_frame_base2, r2 +-/* [0x00000be8] */ 0x0d801dc0, 0xd0021667, // sub rb25,unif,1 +-/* [0x00000bf0] */ 0x0d801dc0, 0xd00217a7, // sub rb30,unif,1 +-/* [0x00000bf8] */ 0x15827d80, 0x10021427, // mov rb16, unif +-/* [0x00000c00] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000c08] */ 0xc0000000, 0xe0020867, // mov r1, vdw_setup_1(0) +-/* [0x00000c10] */ 0x0c9e7200, 0x10021627, // add rb24, r1, r0 +-/* [0x00000c18] */ 0x00000001, 0xe0020527, // mov ra20, 1 +-/* [0x00000c20] */ 0x00000100, 0xe00205a7, // mov ra22, 256 +-/* [0x00000c28] */ 0x00000040, 0xe00207a7, // mov ra30, 64 +-/* [0x00000c30] */ 0xffffff00, 0xe0021527, // mov rb20, 0xffffff00 +-/* [0x00000c38] */ 0x000000ff, 0xe00215a7, // mov rb22, 255 +-/* [0x00000c40] */ 0x00000018, 0xe00215e7, // mov rb23, 24 +-/* [0x00000c48] */ 0x00000000, 0xe0020227, // mov ra8, 0 +-/* [0x00000c50] */ 0x00000000, 0xe0020267, // mov ra9, 0 +-/* [0x00000c58] */ 0x00000000, 0xe00202a7, // mov ra10, 0 +-/* [0x00000c60] */ 0x00000000, 0xe00202e7, // mov ra11, 0 +-/* [0x00000c68] */ 0x00000000, 0xe0020327, // mov ra12, 0 +-/* [0x00000c70] */ 0x00000000, 0xe0020367, // mov ra13, 0 +-/* [0x00000c78] */ 0x00000000, 0xe00203a7, // mov ra14, 0 +-/* [0x00000c80] */ 0x00000000, 0xe00203e7, // mov ra15, 0 +-/* [0x00000c88] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num +-/* [0x00000c90] */ 0x159e7480, 0x10020867, // mov r1, r2 +-/* [0x00000c98] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 +-/* [0x00000ca0] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 +-/* [0x00000ca8] */ 0x159e7480, 0x10020827, // mov r0, r2 +-/* [0x00000cb0] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 +-/* [0x00000cb8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 +-/* [0x00000cc0] */ 0x80004004, 0xe0020867, // mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) +-/* [0x00000cc8] */ 0x119c51c0, 0xd0020827, // shl r0, r0, 5 +-/* [0x00000cd0] */ 0x0c9e7040, 0x100216e7, // add rb27, r0, r1 +-/* [0x00000cd8] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num +-/* [0x00000ce0] */ 0x159e7480, 0x10020867, // mov r1, r2 +-/* [0x00000ce8] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 +-/* [0x00000cf0] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 +-/* [0x00000cf8] */ 0x159e7480, 0x10020827, // mov r0, r2 +-/* [0x00000d00] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 +-/* [0x00000d08] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 +-/* [0x00000d10] */ 0x00004800, 0xe0020867, // mov r1, vpm_setup(0, 4, h8p(0, 0)) +-/* [0x00000d18] */ 0x0c9e7040, 0x10021727, // add rb28, r0, r1 +-/* [0x00000d20] */ 0x15827d80, 0x10021327, // mov rb12,unif +-/* [0x00000d28] */ 0x15827d80, 0x10021367, // mov rb13,unif +-/* [0x00000d30] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000d38] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 +-/* [0x00000d40] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 +-/* [0x00000d48] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 +-/* [0x00000d50] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch +-/* [0x00000d58] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_frame_base +-/* [0x00000d60] */ 0x13540dc0, 0xd0020867, // max r1, ra_y2, 0 +-/* [0x00000d68] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 +-/* [0x00000d70] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 +-/* [0x00000d78] */ 0x0c541dc0, 0xd0020567, // add ra_y2, ra_y2, 1 +-/* [0x00000d80] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch +-/* [0x00000d88] */ 0x0c667380, 0x10020e27, // add t0s, r1, ra_frame_base2 ++/* [0x00000b18] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x00000b20] */ 0x15827d80, 0x100207e7, // mov ra31, unif ++/* [0x00000b28] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num ++/* [0x00000b30] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif ++/* [0x00000b38] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif ++/* [0x00000b40] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 ++/* [0x00000b48] */ 0x0c9c13c0, 0xd0020767, // add ra_y, r1, 1 ++/* [0x00000b50] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 ++/* [0x00000b58] */ 0x0c9e7400, 0x100208a7, // add r2, r2, r0 ++/* [0x00000b60] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 ++/* [0x00000b68] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 ++/* [0x00000b70] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch ++/* [0x00000b78] */ 0x8c9e7452, 0x10025e18, // add t0s, r2, r1 ; mov ra_frame_base, r2 ++/* [0x00000b80] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num ++/* [0x00000b88] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif ++/* [0x00000b90] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif ++/* [0x00000b98] */ 0x119c31c0, 0xd00205e7, // shl rx_xshift2_next, r0, 3 ++/* [0x00000ba0] */ 0x0c9c13c0, 0xd0020567, // add ra_y2, r1, 1 ++/* [0x00000ba8] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 ++/* [0x00000bb0] */ 0x0c9e7400, 0x100208a7, // add r2, r2, r0 ++/* [0x00000bb8] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 ++/* [0x00000bc0] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 ++/* [0x00000bc8] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch ++/* [0x00000bd0] */ 0x8c9e7452, 0x10025e19, // add t0s, r2, r1 ; mov ra_frame_base2, r2 ++/* [0x00000bd8] */ 0x0d801dc0, 0xd0021667, // sub rb25,unif,1 ++/* [0x00000be0] */ 0x0d801dc0, 0xd00217a7, // sub rb30,unif,1 ++/* [0x00000be8] */ 0x15827d80, 0x10021427, // mov rb16, unif ++/* [0x00000bf0] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000bf8] */ 0xc0000000, 0xe0020867, // mov r1, vdw_setup_1(0) ++/* [0x00000c00] */ 0x0c9e7200, 0x10021627, // add rb24, r1, r0 ++/* [0x00000c08] */ 0x00000001, 0xe0020527, // mov ra20, 1 ++/* [0x00000c10] */ 0x00000100, 0xe00205a7, // mov ra22, 256 ++/* [0x00000c18] */ 0x00000040, 0xe00207a7, // mov ra30, 64 ++/* [0x00000c20] */ 0xffffff00, 0xe0021527, // mov rb20, 0xffffff00 ++/* [0x00000c28] */ 0x000000ff, 0xe00215a7, // mov rb22, 255 ++/* [0x00000c30] */ 0x00000018, 0xe00215e7, // mov rb23, 24 ++/* [0x00000c38] */ 0x00000000, 0xe0020227, // mov ra8, 0 ++/* [0x00000c40] */ 0x00000000, 0xe0020267, // mov ra9, 0 ++/* [0x00000c48] */ 0x00000000, 0xe00202a7, // mov ra10, 0 ++/* [0x00000c50] */ 0x00000000, 0xe00202e7, // mov ra11, 0 ++/* [0x00000c58] */ 0x00000000, 0xe0020327, // mov ra12, 0 ++/* [0x00000c60] */ 0x00000000, 0xe0020367, // mov ra13, 0 ++/* [0x00000c68] */ 0x00000000, 0xe00203a7, // mov ra14, 0 ++/* [0x00000c70] */ 0x00000000, 0xe00203e7, // mov ra15, 0 ++/* [0x00000c78] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num ++/* [0x00000c80] */ 0x159e7480, 0x10020867, // mov r1, r2 ++/* [0x00000c88] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 ++/* [0x00000c90] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 ++/* [0x00000c98] */ 0x159e7480, 0x10020827, // mov r0, r2 ++/* [0x00000ca0] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 ++/* [0x00000ca8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 ++/* [0x00000cb0] */ 0x80004004, 0xe0020867, // mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) ++/* [0x00000cb8] */ 0x119c51c0, 0xd0020827, // shl r0, r0, 5 ++/* [0x00000cc0] */ 0x0c9e7040, 0x100216e7, // add rb27, r0, r1 ++/* [0x00000cc8] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num ++/* [0x00000cd0] */ 0x159e7480, 0x10020867, // mov r1, r2 ++/* [0x00000cd8] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 ++/* [0x00000ce0] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 ++/* [0x00000ce8] */ 0x159e7480, 0x10020827, // mov r0, r2 ++/* [0x00000cf0] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 ++/* [0x00000cf8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 ++/* [0x00000d00] */ 0x00004800, 0xe0020867, // mov r1, vpm_setup(0, 4, h8p(0, 0)) ++/* [0x00000d08] */ 0x0c9e7040, 0x10021727, // add rb28, r0, r1 ++/* [0x00000d10] */ 0x15827d80, 0x10021327, // mov rb12,unif ++/* [0x00000d18] */ 0x15827d80, 0x10021367, // mov rb13,unif ++/* [0x00000d20] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000d28] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 ++/* [0x00000d30] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 ++/* [0x00000d38] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 ++/* [0x00000d40] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch ++/* [0x00000d48] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_frame_base ++/* [0x00000d50] */ 0x13540dc0, 0xd0020867, // max r1, ra_y2, 0 ++/* [0x00000d58] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 ++/* [0x00000d60] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 ++/* [0x00000d68] */ 0x0c541dc0, 0xd0020567, // add ra_y2, ra_y2, 1 ++/* [0x00000d70] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch ++/* [0x00000d78] */ 0x0c667380, 0x10020e27, // add t0s, r1, ra_frame_base2 + // ::mc_filter +-/* [0x00000d90] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-/* [0x00000d98] */ 0x15827d80, 0x100207e7, // mov ra31, unif +-/* [0x00000da0] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next +-/* [0x00000da8] */ 0x155e7d80, 0x10021027, // mov rx_xshift2, rx_xshift2_next +-/* [0x00000db0] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num +-/* [0x00000db8] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif +-/* [0x00000dc0] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif +-/* [0x00000dc8] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 +-/* [0x00000dd0] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 +-/* [0x00000dd8] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 +-/* [0x00000de0] */ 0x0c9e7400, 0x100206a7, // add ra_frame_base_next, r2, r0 +-/* [0x00000de8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num +-/* [0x00000df0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0 ; mov r1, unif +-/* [0x00000df8] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif +-/* [0x00000e00] */ 0x119c31c0, 0xd00205e7, // shl rx_xshift2_next, r0, 3 +-/* [0x00000e08] */ 0x0c9c13c0, 0xd0021067, // add ra_y2_next, r1, 1 +-/* [0x00000e10] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 +-/* [0x00000e18] */ 0x0c9e7400, 0x100214e7, // add rx_frame_base2_next, r2, r0 +-/* [0x00000e20] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 +-/* [0x00000e28] */ 0x00000010, 0xe00208a7, // mov r2, 16 +-/* [0x00000e30] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000e38] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 +-/* [0x00000e40] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 +-/* [0x00000e48] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 +-/* [0x00000e50] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 +-/* [0x00000e58] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 +-/* [0x00000e60] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 +-/* [0x00000e68] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 +-/* [0x00000e70] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 +-/* [0x00000e78] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 +-/* [0x00000e80] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000e88] */ 0x15827d80, 0x100009e7, // mov.ifnz -, unif +-/* [0x00000e90] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000e98] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000ea0] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000ea8] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif +-/* [0x00000eb0] */ 0x15827d80, 0x100009e7, // mov.ifnz -, unif +-/* [0x00000eb8] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000ec0] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000ec8] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000ed0] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif +-/* [0x00000ed8] */ 0x15827d80, 0x100009e7, // mov.ifnz -, unif +-/* [0x00000ee0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000ee8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000ef0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000ef8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif +-/* [0x00000f00] */ 0x15827d80, 0x100009e7, // mov.ifnz -, unif +-/* [0x00000f08] */ 0x4f5971c6, 0x100251e0, // asr rb7, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000f10] */ 0x4f5971c6, 0x100251a0, // asr rb6, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000f18] */ 0x4f5971c6, 0x10025160, // asr rb5, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000f20] */ 0x0f9d71c0, 0x10021127, // asr rb4, r0, rb23 +-/* [0x00000f28] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000f30] */ 0x15827d80, 0x100009e7, // mov.ifnz -, unif +-/* [0x00000f38] */ 0x0f9e7080, 0x100213e7, // asr rb15, r0, r2 +-/* [0x00000f40] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 +-/* [0x00000f48] */ 0x0f9e7080, 0x100213a7, // asr rb14, r0, r2 +-/* [0x00000f50] */ 0x00000000, 0xe00208e7, // mov r3, 0 ++/* [0x00000d80] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x00000d88] */ 0x15827d80, 0x100207e7, // mov ra31, unif ++/* [0x00000d90] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next ++/* [0x00000d98] */ 0x155e7d80, 0x10021027, // mov rx_xshift2, rx_xshift2_next ++/* [0x00000da0] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num ++/* [0x00000da8] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif ++/* [0x00000db0] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif ++/* [0x00000db8] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 ++/* [0x00000dc0] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 ++/* [0x00000dc8] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 ++/* [0x00000dd0] */ 0x0c9e7400, 0x100206a7, // add ra_frame_base_next, r2, r0 ++/* [0x00000dd8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num ++/* [0x00000de0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0 ; mov r1, unif ++/* [0x00000de8] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif ++/* [0x00000df0] */ 0x119c31c0, 0xd00205e7, // shl rx_xshift2_next, r0, 3 ++/* [0x00000df8] */ 0x0c9c13c0, 0xd0021067, // add ra_y2_next, r1, 1 ++/* [0x00000e00] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 ++/* [0x00000e08] */ 0x0c9e7400, 0x100214e7, // add rx_frame_base2_next, r2, r0 ++/* [0x00000e10] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 ++/* [0x00000e18] */ 0x00000010, 0xe00208a7, // mov r2, 16 ++/* [0x00000e20] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000e28] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 ++/* [0x00000e30] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 ++/* [0x00000e38] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 ++/* [0x00000e40] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 ++/* [0x00000e48] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 ++/* [0x00000e50] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 ++/* [0x00000e58] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 ++/* [0x00000e60] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 ++/* [0x00000e68] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 ++/* [0x00000e70] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000e78] */ 0x15827d80, 0x100009e7, // mov.ifnz -, unif ++/* [0x00000e80] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000e88] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000e90] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000e98] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif ++/* [0x00000ea0] */ 0x15827d80, 0x100009e7, // mov.ifnz -, unif ++/* [0x00000ea8] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000eb0] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000eb8] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000ec0] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif ++/* [0x00000ec8] */ 0x15827d80, 0x100009e7, // mov.ifnz -, unif ++/* [0x00000ed0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000ed8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000ee0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000ee8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif ++/* [0x00000ef0] */ 0x15827d80, 0x100009e7, // mov.ifnz -, unif ++/* [0x00000ef8] */ 0x4f5971c6, 0x100251e0, // asr rb7, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000f00] */ 0x4f5971c6, 0x100251a0, // asr rb6, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000f08] */ 0x4f5971c6, 0x10025160, // asr rb5, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000f10] */ 0x0f9d71c0, 0x10021127, // asr rb4, r0, rb23 ++/* [0x00000f18] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000f20] */ 0x15827d80, 0x100009e7, // mov.ifnz -, unif ++/* [0x00000f28] */ 0x0f9e7080, 0x100213e7, // asr rb15, r0, r2 ++/* [0x00000f30] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 ++/* [0x00000f38] */ 0x0f9e7080, 0x100213a7, // asr rb14, r0, r2 ++/* [0x00000f40] */ 0x00000000, 0xe00208e7, // mov r3, 0 + // :yloop +-/* [0x00000f58] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 +-/* [0x00000f60] */ 0x8e4539bf, 0xa0029819, // shr r0, r4, ra_xshift ; mov.ifz ra_frame_base2, rx_frame_base2_next ; ldtmu0 +-/* [0x00000f68] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 +-/* [0x00000f70] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch +-/* [0x00000f78] */ 0x0e9c09c0, 0x10020867, // shr r1, r4, rx_xshift2 +-/* [0x00000f80] */ 0x159c1fc0, 0x10040567, // mov.ifz ra_y2, ra_y2_next +-/* [0x00000f88] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 +-/* [0x00000f90] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 +-/* [0x00000f98] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 +-/* [0x00000fa0] */ 0xec614c87, 0x10024e20, // add t0s, ra_frame_base, r2 ; v8subs r0, r0, rb20 +-/* [0x00000fa8] */ 0x13540dc0, 0xd00208a7, // max r2, ra_y2, 0 +-/* [0x00000fb0] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 +-/* [0x00000fb8] */ 0x4c541dd3, 0xd0024562, // add ra_y2, ra_y2, 1 ; mul24 r2, r2, r3 +-/* [0x00000fc0] */ 0xec654c87, 0x10024e20, // add t0s, ra_frame_base2, r2 ; v8subs r0, r0, rb20 +-/* [0x00000fc8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-/* [0x00000fd0] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 +-/* [0x00000fd8] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 +-/* [0x00000fe0] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 +-/* [0x00000fe8] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 +-/* [0x00000ff0] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 +-/* [0x00000ff8] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 +-/* [0x00001000] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 +-/* [0x00001008] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 +-/* [0x00001010] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 +-/* [0x00001018] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 +-/* [0x00001020] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 +-/* [0x00001028] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 +-/* [0x00001030] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 +-/* [0x00001038] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 +-/* [0x00001040] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 +-/* [0x00001048] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 +-/* [0x00001050] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 +-/* [0x00001058] */ 0x8d3487f6, 0xd00279cc, // sub.setf -, r3, 8 ; mov ra12, ra13 +-/* [0x00001060] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 +-/* [0x00001068] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 +-/* [0x00001070] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 +-/* [0x00001078] */ 0x15367d80, 0x10020327, // mov ra12, ra13 +-/* [0x00001080] */ 0xfffffeb8, 0xf06809e7, // brr.anyn -, r:yloop +-/* [0x00001088] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 +-/* [0x00001090] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 +-/* [0x00001098] */ 0x159e7000, 0x100203e7, // mov ra15, r0 +-/* [0x000010a0] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 +-/* [0x000010a8] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 +-/* [0x000010b0] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 +-/* [0x000010b8] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 +-/* [0x000010c0] */ 0x4c204237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb4 +-/* [0x000010c8] */ 0x4c245237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb5 +-/* [0x000010d0] */ 0x4c286237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb6 +-/* [0x000010d8] */ 0x4c2c7237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb7 +-/* [0x000010e0] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait +-/* [0x000010e8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 +-/* [0x000010f0] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 +-/* [0x000010f8] */ 0x409ce00f, 0x100049e1, // nop ; mul24 r1, r1, rb14 +-/* [0x00001100] */ 0x0c9cc3c0, 0x10020867, // add r1, r1, rb12 +-/* [0x00001108] */ 0x0f9cd3c0, 0x10020867, // asr r1, r1, rb13 +-/* [0x00001110] */ 0xfffffe28, 0xf06809e7, // brr.anyn -, r:yloop +-/* [0x00001118] */ 0x0c9cf3c0, 0x10020867, // add r1, r1, rb15 +-/* [0x00001120] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 +-/* [0x00001128] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 +-/* [0x00001130] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 +-/* [0x00001138] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 +-/* [0x00001140] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 +-/* [0x00001148] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif ++/* [0x00000f48] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 ++/* [0x00000f50] */ 0x8e4539bf, 0xa0029819, // shr r0, r4, ra_xshift ; mov.ifz ra_frame_base2, rx_frame_base2_next ; ldtmu0 ++/* [0x00000f58] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 ++/* [0x00000f60] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch ++/* [0x00000f68] */ 0x0e9c09c0, 0x10020867, // shr r1, r4, rx_xshift2 ++/* [0x00000f70] */ 0x159c1fc0, 0x10040567, // mov.ifz ra_y2, ra_y2_next ++/* [0x00000f78] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 ++/* [0x00000f80] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 ++/* [0x00000f88] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 ++/* [0x00000f90] */ 0xec614c87, 0x10024e20, // add t0s, ra_frame_base, r2 ; v8subs r0, r0, rb20 ++/* [0x00000f98] */ 0x13540dc0, 0xd00208a7, // max r2, ra_y2, 0 ++/* [0x00000fa0] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 ++/* [0x00000fa8] */ 0x4c541dd3, 0xd0024562, // add ra_y2, ra_y2, 1 ; mul24 r2, r2, r3 ++/* [0x00000fb0] */ 0xec654c87, 0x10024e20, // add t0s, ra_frame_base2, r2 ; v8subs r0, r0, rb20 ++/* [0x00000fb8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x00000fc0] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 ++/* [0x00000fc8] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 ++/* [0x00000fd0] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 ++/* [0x00000fd8] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 ++/* [0x00000fe0] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 ++/* [0x00000fe8] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 ++/* [0x00000ff0] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 ++/* [0x00000ff8] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 ++/* [0x00001000] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 ++/* [0x00001008] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 ++/* [0x00001010] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 ++/* [0x00001018] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 ++/* [0x00001020] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 ++/* [0x00001028] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 ++/* [0x00001030] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 ++/* [0x00001038] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 ++/* [0x00001040] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 ++/* [0x00001048] */ 0x8d3487f6, 0xd00279cc, // sub.setf -, r3, 8 ; mov ra12, ra13 ++/* [0x00001050] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 ++/* [0x00001058] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 ++/* [0x00001060] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 ++/* [0x00001068] */ 0x15367d80, 0x10020327, // mov ra12, ra13 ++/* [0x00001070] */ 0xfffffeb8, 0xf06809e7, // brr.anyn -, r:yloop ++/* [0x00001078] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 ++/* [0x00001080] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 ++/* [0x00001088] */ 0x159e7000, 0x100203e7, // mov ra15, r0 ++/* [0x00001090] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 ++/* [0x00001098] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 ++/* [0x000010a0] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 ++/* [0x000010a8] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 ++/* [0x000010b0] */ 0x4c204237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb4 ++/* [0x000010b8] */ 0x4c245237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb5 ++/* [0x000010c0] */ 0x4c286237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb6 ++/* [0x000010c8] */ 0x4c2c7237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb7 ++/* [0x000010d0] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait ++/* [0x000010d8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 ++/* [0x000010e0] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 ++/* [0x000010e8] */ 0x409ce00f, 0x100049e1, // nop ; mul24 r1, r1, rb14 ++/* [0x000010f0] */ 0x0c9cc3c0, 0x10020867, // add r1, r1, rb12 ++/* [0x000010f8] */ 0x0f9cd3c0, 0x10020867, // asr r1, r1, rb13 ++/* [0x00001100] */ 0xfffffe28, 0xf06809e7, // brr.anyn -, r:yloop ++/* [0x00001108] */ 0x0c9cf3c0, 0x10020867, // add r1, r1, rb15 ++/* [0x00001110] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 ++/* [0x00001118] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 ++/* [0x00001120] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 ++/* [0x00001128] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 ++/* [0x00001130] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 ++/* [0x00001138] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif + // ::mc_filter_b +-/* [0x00001150] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-/* [0x00001158] */ 0x15827d80, 0x100207e7, // mov ra31, unif +-/* [0x00001160] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next +-/* [0x00001168] */ 0x155e7d80, 0x10021027, // mov rx_xshift2, rx_xshift2_next +-/* [0x00001170] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num +-/* [0x00001178] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif +-/* [0x00001180] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif +-/* [0x00001188] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 +-/* [0x00001190] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 +-/* [0x00001198] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 +-/* [0x000011a0] */ 0x0c9e7400, 0x100206a7, // add ra_frame_base_next, r2, r0 +-/* [0x000011a8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num +-/* [0x000011b0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0 ; mov r1, unif +-/* [0x000011b8] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif +-/* [0x000011c0] */ 0x119c31c0, 0xd00205e7, // shl rx_xshift2_next, r0, 3 +-/* [0x000011c8] */ 0x0c9c13c0, 0xd0021067, // add ra_y2_next, r1, 1 +-/* [0x000011d0] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 +-/* [0x000011d8] */ 0x0c9e7400, 0x100214e7, // add rx_frame_base2_next, r2, r0 +-/* [0x000011e0] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 +-/* [0x000011e8] */ 0x00000010, 0xe00208a7, // mov r2, 16 +-/* [0x000011f0] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x000011f8] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 +-/* [0x00001200] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 +-/* [0x00001208] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 +-/* [0x00001210] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 +-/* [0x00001218] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 +-/* [0x00001220] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 +-/* [0x00001228] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 +-/* [0x00001230] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 +-/* [0x00001238] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 +-/* [0x00001240] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00001248] */ 0x00000001, 0xe0020867, // mov r1, 1 +-/* [0x00001250] */ 0x15827d80, 0x10060827, // mov.ifnz r0, unif +-/* [0x00001258] */ 0x409f3001, 0xd00049e0, // nop ; mul24 r0, r0 << 13, r1 << 13 +-/* [0x00001260] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00001268] */ 0x409f2001, 0xd00049e0, // nop ; mul24 r0, r0 << 14, r1 << 14 +-/* [0x00001270] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00001278] */ 0x409f1001, 0xd00049e0, // nop ; mul24 r0, r0 << 15, r1 << 15 +-/* [0x00001280] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00001288] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif +-/* [0x00001290] */ 0x15827d80, 0x10060827, // mov.ifnz r0, unif +-/* [0x00001298] */ 0x409f7001, 0xd00049e0, // nop ; mul24 r0, r0 << 9, r1 << 9 +-/* [0x000012a0] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000012a8] */ 0x409f6001, 0xd00049e0, // nop ; mul24 r0, r0 << 10, r1 << 10 +-/* [0x000012b0] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000012b8] */ 0x409f5001, 0xd00049e0, // nop ; mul24 r0, r0 << 11, r1 << 11 +-/* [0x000012c0] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000012c8] */ 0x409f4001, 0xd00049e0, // nop ; mul24 r0, r0 << 12, r1 << 12 +-/* [0x000012d0] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif +-/* [0x000012d8] */ 0x15827d80, 0x10060827, // mov.ifnz r0, unif +-/* [0x000012e0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000012e8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000012f0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000012f8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif +-/* [0x00001300] */ 0x15827d80, 0x10060827, // mov.ifnz r0, unif +-/* [0x00001308] */ 0x4f5971c6, 0x100251e0, // asr rb7, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00001310] */ 0x4f5971c6, 0x100251a0, // asr rb6, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00001318] */ 0x4f5971c6, 0x10025160, // asr rb5, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00001320] */ 0x0f9d71c0, 0x10021127, // asr rb4, r0, rb23 +-/* [0x00001328] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00001330] */ 0x15827d80, 0x10060827, // mov.ifnz r0, unif +-/* [0x00001338] */ 0x0f9e7080, 0x100213e7, // asr rb15, r0, r2 +-/* [0x00001340] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 +-/* [0x00001348] */ 0x0f9e7080, 0x100213a7, // asr rb14, r0, r2 +-/* [0x00001350] */ 0x00000000, 0xe00208e7, // mov r3, 0 ++/* [0x00001140] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x00001148] */ 0x15827d80, 0x100207e7, // mov ra31, unif ++/* [0x00001150] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next ++/* [0x00001158] */ 0x155e7d80, 0x10021027, // mov rx_xshift2, rx_xshift2_next ++/* [0x00001160] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num ++/* [0x00001168] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif ++/* [0x00001170] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif ++/* [0x00001178] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 ++/* [0x00001180] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 ++/* [0x00001188] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 ++/* [0x00001190] */ 0x0c9e7400, 0x100206a7, // add ra_frame_base_next, r2, r0 ++/* [0x00001198] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num ++/* [0x000011a0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0 ; mov r1, unif ++/* [0x000011a8] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif ++/* [0x000011b0] */ 0x119c31c0, 0xd00205e7, // shl rx_xshift2_next, r0, 3 ++/* [0x000011b8] */ 0x0c9c13c0, 0xd0021067, // add ra_y2_next, r1, 1 ++/* [0x000011c0] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 ++/* [0x000011c8] */ 0x0c9e7400, 0x100214e7, // add rx_frame_base2_next, r2, r0 ++/* [0x000011d0] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 ++/* [0x000011d8] */ 0x00000010, 0xe00208a7, // mov r2, 16 ++/* [0x000011e0] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x000011e8] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 ++/* [0x000011f0] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 ++/* [0x000011f8] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 ++/* [0x00001200] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 ++/* [0x00001208] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 ++/* [0x00001210] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 ++/* [0x00001218] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 ++/* [0x00001220] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 ++/* [0x00001228] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 ++/* [0x00001230] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00001238] */ 0x00000001, 0xe0020867, // mov r1, 1 ++/* [0x00001240] */ 0x15827d80, 0x10060827, // mov.ifnz r0, unif ++/* [0x00001248] */ 0x409f3001, 0xd00049e0, // nop ; mul24 r0, r0 << 13, r1 << 13 ++/* [0x00001250] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00001258] */ 0x409f2001, 0xd00049e0, // nop ; mul24 r0, r0 << 14, r1 << 14 ++/* [0x00001260] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00001268] */ 0x409f1001, 0xd00049e0, // nop ; mul24 r0, r0 << 15, r1 << 15 ++/* [0x00001270] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00001278] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif ++/* [0x00001280] */ 0x15827d80, 0x10060827, // mov.ifnz r0, unif ++/* [0x00001288] */ 0x409f7001, 0xd00049e0, // nop ; mul24 r0, r0 << 9, r1 << 9 ++/* [0x00001290] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00001298] */ 0x409f6001, 0xd00049e0, // nop ; mul24 r0, r0 << 10, r1 << 10 ++/* [0x000012a0] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000012a8] */ 0x409f5001, 0xd00049e0, // nop ; mul24 r0, r0 << 11, r1 << 11 ++/* [0x000012b0] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000012b8] */ 0x409f4001, 0xd00049e0, // nop ; mul24 r0, r0 << 12, r1 << 12 ++/* [0x000012c0] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif ++/* [0x000012c8] */ 0x15827d80, 0x10060827, // mov.ifnz r0, unif ++/* [0x000012d0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000012d8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000012e0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000012e8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif ++/* [0x000012f0] */ 0x15827d80, 0x10060827, // mov.ifnz r0, unif ++/* [0x000012f8] */ 0x4f5971c6, 0x100251e0, // asr rb7, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00001300] */ 0x4f5971c6, 0x100251a0, // asr rb6, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00001308] */ 0x4f5971c6, 0x10025160, // asr rb5, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00001310] */ 0x0f9d71c0, 0x10021127, // asr rb4, r0, rb23 ++/* [0x00001318] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00001320] */ 0x15827d80, 0x10060827, // mov.ifnz r0, unif ++/* [0x00001328] */ 0x0f9e7080, 0x100213e7, // asr rb15, r0, r2 ++/* [0x00001330] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 ++/* [0x00001338] */ 0x0f9e7080, 0x100213a7, // asr rb14, r0, r2 ++/* [0x00001340] */ 0x00000000, 0xe00208e7, // mov r3, 0 + // :yloopb +-/* [0x00001358] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 +-/* [0x00001360] */ 0x8e4539bf, 0xa0029819, // shr r0, r4, ra_xshift ; mov.ifz ra_frame_base2, rx_frame_base2_next ; ldtmu0 +-/* [0x00001368] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 +-/* [0x00001370] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch +-/* [0x00001378] */ 0x0e9c09c0, 0x10020867, // shr r1, r4, rx_xshift2 +-/* [0x00001380] */ 0x159c1fc0, 0x10040567, // mov.ifz ra_y2, ra_y2_next +-/* [0x00001388] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 +-/* [0x00001390] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 +-/* [0x00001398] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 +-/* [0x000013a0] */ 0xec614c87, 0x10024e20, // add t0s, ra_frame_base, r2 ; v8subs r0, r0, rb20 +-/* [0x000013a8] */ 0x13540dc0, 0xd00208a7, // max r2, ra_y2, 0 +-/* [0x000013b0] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 +-/* [0x000013b8] */ 0x4c541dd3, 0xd0024562, // add ra_y2, ra_y2, 1 ; mul24 r2, r2, r3 +-/* [0x000013c0] */ 0xec654c87, 0x10024e20, // add t0s, ra_frame_base2, r2 ; v8subs r0, r0, rb20 +-/* [0x000013c8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-/* [0x000013d0] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 +-/* [0x000013d8] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 +-/* [0x000013e0] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 +-/* [0x000013e8] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 +-/* [0x000013f0] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 +-/* [0x000013f8] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 +-/* [0x00001400] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 +-/* [0x00001408] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 +-/* [0x00001410] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 +-/* [0x00001418] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 +-/* [0x00001420] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 +-/* [0x00001428] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 +-/* [0x00001430] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 +-/* [0x00001438] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 +-/* [0x00001440] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 +-/* [0x00001448] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 +-/* [0x00001450] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 +-/* [0x00001458] */ 0x8d3487f6, 0xd00279cc, // sub.setf -, r3, 8 ; mov ra12, ra13 +-/* [0x00001460] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 +-/* [0x00001468] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 +-/* [0x00001470] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 +-/* [0x00001478] */ 0x15367d80, 0x10020327, // mov ra12, ra13 +-/* [0x00001480] */ 0xfffffeb8, 0xf06809e7, // brr.anyn -, r:yloopb +-/* [0x00001488] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 +-/* [0x00001490] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 +-/* [0x00001498] */ 0x159e7000, 0x100203e7, // mov ra15, r0 +-/* [0x000014a0] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 +-/* [0x000014a8] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 +-/* [0x000014b0] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 +-/* [0x000014b8] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 +-/* [0x000014c0] */ 0x4c204237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb4 +-/* [0x000014c8] */ 0x4c245237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb5 +-/* [0x000014d0] */ 0x4c286237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb6 +-/* [0x000014d8] */ 0x4c2c7237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb7 +-/* [0x000014e0] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait +-/* [0x000014e8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 +-/* [0x000014f0] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 +-/* [0x000014f8] */ 0x4053800e, 0xd00049e1, // nop ; mul24 r1, r1 << 8, ra20 << 8 +-/* [0x00001500] */ 0x4c78e38f, 0x10024860, // add r1, r1, ra30 ; mul24 r0, r1, rb14 +-/* [0x00001508] */ 0x0c9e7200, 0x10020867, // add r1, r1, r0 +-/* [0x00001510] */ 0xfffffe28, 0xf06809e7, // brr.anyn -, r:yloopb +-/* [0x00001518] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 +-/* [0x00001520] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 +-/* [0x00001528] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 +-/* [0x00001530] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 +-/* [0x00001538] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 +-/* [0x00001540] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 +-/* [0x00001548] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif ++/* [0x00001348] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 ++/* [0x00001350] */ 0x8e4539bf, 0xa0029819, // shr r0, r4, ra_xshift ; mov.ifz ra_frame_base2, rx_frame_base2_next ; ldtmu0 ++/* [0x00001358] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 ++/* [0x00001360] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch ++/* [0x00001368] */ 0x0e9c09c0, 0x10020867, // shr r1, r4, rx_xshift2 ++/* [0x00001370] */ 0x159c1fc0, 0x10040567, // mov.ifz ra_y2, ra_y2_next ++/* [0x00001378] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 ++/* [0x00001380] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 ++/* [0x00001388] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 ++/* [0x00001390] */ 0xec614c87, 0x10024e20, // add t0s, ra_frame_base, r2 ; v8subs r0, r0, rb20 ++/* [0x00001398] */ 0x13540dc0, 0xd00208a7, // max r2, ra_y2, 0 ++/* [0x000013a0] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 ++/* [0x000013a8] */ 0x4c541dd3, 0xd0024562, // add ra_y2, ra_y2, 1 ; mul24 r2, r2, r3 ++/* [0x000013b0] */ 0xec654c87, 0x10024e20, // add t0s, ra_frame_base2, r2 ; v8subs r0, r0, rb20 ++/* [0x000013b8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x000013c0] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 ++/* [0x000013c8] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 ++/* [0x000013d0] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 ++/* [0x000013d8] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 ++/* [0x000013e0] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 ++/* [0x000013e8] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 ++/* [0x000013f0] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 ++/* [0x000013f8] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 ++/* [0x00001400] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 ++/* [0x00001408] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 ++/* [0x00001410] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 ++/* [0x00001418] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 ++/* [0x00001420] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 ++/* [0x00001428] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 ++/* [0x00001430] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 ++/* [0x00001438] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 ++/* [0x00001440] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 ++/* [0x00001448] */ 0x8d3487f6, 0xd00279cc, // sub.setf -, r3, 8 ; mov ra12, ra13 ++/* [0x00001450] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 ++/* [0x00001458] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 ++/* [0x00001460] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 ++/* [0x00001468] */ 0x15367d80, 0x10020327, // mov ra12, ra13 ++/* [0x00001470] */ 0xfffffeb8, 0xf06809e7, // brr.anyn -, r:yloopb ++/* [0x00001478] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 ++/* [0x00001480] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 ++/* [0x00001488] */ 0x159e7000, 0x100203e7, // mov ra15, r0 ++/* [0x00001490] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 ++/* [0x00001498] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 ++/* [0x000014a0] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 ++/* [0x000014a8] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 ++/* [0x000014b0] */ 0x4c204237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb4 ++/* [0x000014b8] */ 0x4c245237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb5 ++/* [0x000014c0] */ 0x4c286237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb6 ++/* [0x000014c8] */ 0x4c2c7237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb7 ++/* [0x000014d0] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait ++/* [0x000014d8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 ++/* [0x000014e0] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 ++/* [0x000014e8] */ 0x4053800e, 0xd00049e1, // nop ; mul24 r1, r1 << 8, ra20 << 8 ++/* [0x000014f0] */ 0x4c78e38f, 0x10024860, // add r1, r1, ra30 ; mul24 r0, r1, rb14 ++/* [0x000014f8] */ 0x0c9e7200, 0x10020867, // add r1, r1, r0 ++/* [0x00001500] */ 0xfffffe28, 0xf06809e7, // brr.anyn -, r:yloopb ++/* [0x00001508] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 ++/* [0x00001510] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 ++/* [0x00001518] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 ++/* [0x00001520] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 ++/* [0x00001528] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 ++/* [0x00001530] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 ++/* [0x00001538] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif + // ::mc_interrupt_exit12 +-/* [0x00001550] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x00001540] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x00001548] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00001550] */ 0x009e7000, 0xa00009e7, // ldtmu0 + /* [0x00001558] */ 0x009e7000, 0xa00009e7, // ldtmu0 + /* [0x00001560] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00001568] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00001570] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00001568] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00001570] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) + /* [0x00001578] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) + /* [0x00001580] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) + /* [0x00001588] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +@@ -732,11 +732,9 @@ unsigned int rpi_shader[] = { + /* [0x000015a8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) + /* [0x000015b0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) + /* [0x000015b8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x000015c0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x000015c8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x000015d0] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend +-/* [0x000015d8] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop +-/* [0x000015e0] */ 0x009e7000, 0x100009e7, // nop ; nop ++/* [0x000015c0] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend ++/* [0x000015c8] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop ++/* [0x000015d0] */ 0x009e7000, 0x100009e7, // nop ; nop + // ::mc_end + }; + #ifdef __HIGHC__ +diff --git a/libavcodec/rpi_shader.h b/libavcodec/rpi_shader.h +index 3fa8531..6e552d9 100644 +--- a/libavcodec/rpi_shader.h ++++ b/libavcodec/rpi_shader.h +@@ -4,15 +4,15 @@ + extern unsigned int rpi_shader[]; + + #define mc_setup_uv (rpi_shader + 0) +-#define mc_filter_uv (rpi_shader + 148) +-#define mc_filter_uv_b0 (rpi_shader + 338) +-#define mc_filter_uv_b (rpi_shader + 490) +-#define mc_exit (rpi_shader + 666) +-#define mc_interrupt_exit8 (rpi_shader + 684) +-#define mc_setup (rpi_shader + 714) +-#define mc_filter (rpi_shader + 868) +-#define mc_filter_b (rpi_shader + 1108) +-#define mc_interrupt_exit12 (rpi_shader + 1364) +-#define mc_end (rpi_shader + 1402) ++#define mc_filter_uv (rpi_shader + 144) ++#define mc_filter_uv_b0 (rpi_shader + 334) ++#define mc_filter_uv_b (rpi_shader + 486) ++#define mc_exit (rpi_shader + 662) ++#define mc_interrupt_exit8 (rpi_shader + 680) ++#define mc_setup (rpi_shader + 710) ++#define mc_filter (rpi_shader + 864) ++#define mc_filter_b (rpi_shader + 1104) ++#define mc_interrupt_exit12 (rpi_shader + 1360) ++#define mc_end (rpi_shader + 1398) + + #endif +diff --git a/libavcodec/rpi_shader.qasm b/libavcodec/rpi_shader.qasm +index 9cfc0d9..a0b8e5a 100644 +--- a/libavcodec/rpi_shader.qasm ++++ b/libavcodec/rpi_shader.qasm +@@ -133,8 +133,8 @@ mov ra14, 0 + mov ra15, 0 + + # Compute part of VPM to use for DMA output +-mov r2, qpu_num +-shl r2, r2, 1 # Convert QPU numbers to be even (this means we can only use 8 QPUs, but is necessary as we need to save 16bit intermediate results) ++mov r3, unif ++shl r2, r3, 1 # Convert QPU numbers to be even (this means we can only use 8 QPUs, but is necessary as we need to save 16bit intermediate results) + and r2, r2, 15 + mov r1, r2 + asr r1, r1, 2 +@@ -147,8 +147,7 @@ shl r0, r0, 5 + add rb27, r0, r1 + + # Compute part of VPM to save data into +-mov r2, qpu_num # qpu_num = abcd +-shl r2, r2, 1 ++shl r2, r3, 1 + and r2, r2, 15 # r2 = bcd0 + mov r1, r2 # r1 = bcd0 + asr r1, r1, 2 # r1 = bc +@@ -181,9 +180,6 @@ add t0s, r2, r1 + mov rb12,unif # offset before shift + mov rb13,unif # offset after shift + +-# Dump padding words +-mov r0, unif +- + # submit texture requests for second line + max r1, ra_y, 0 + min r1, r1, rb_frame_height_minus_1 +-- +2.5.0 + + +From f9771d28dc02023eb3d051fb9104b6e051f0a58b Mon Sep 17 00:00:00 2001 +From: popcornmix <popcornmix@gmail.com> +Date: Sat, 23 May 2015 13:20:21 +0100 +Subject: [PATCH 45/68] Add new cache flushing routine + +--- + libavcodec/hevc.c | 8 +++-- + libavcodec/hevc_filter.c | 39 ++++++++++----------- + libavcodec/rpi_qpu.c | 17 +++++++-- + libavcodec/rpi_qpu.h | 2 ++ + libavcodec/rpi_user_vcsm.h | 86 ++++++++++++++++++++++++++-------------------- + 5 files changed, 91 insertions(+), 61 deletions(-) + +diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c +index 9605459..52293bf 100644 +--- a/libavcodec/hevc.c ++++ b/libavcodec/hevc.c +@@ -3564,9 +3564,13 @@ static int decode_nal_units(HEVCContext *s, const uint8_t *buf, int length) + } + + fail: +- if (s->ref && s->threads_type == FF_THREAD_FRAME) ++ if (s->ref && s->threads_type == FF_THREAD_FRAME) { ++#ifdef RPI_INTER_QPU ++ void ff_hevc_flush_chroma(HEVCContext *s, ThreadFrame *f, int n); ++ ff_hevc_flush_chroma(s, &s->ref->tf, s->ps.sps->height); ++#endif + ff_thread_report_progress(&s->ref->tf, INT_MAX, 0); +- ++ } + return ret; + } + +diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c +index 186317a..ec84e8a 100644 +--- a/libavcodec/hevc_filter.c ++++ b/libavcodec/hevc_filter.c +@@ -883,36 +883,35 @@ static int ff_hevc_buf_base(AVBufferRef *bref) { + return p->vc & 0x3fffffff; + } + +-static void ff_hevc_flush_chroma(HEVCContext *s, ThreadFrame *f, int n) ++void ff_hevc_flush_chroma(HEVCContext *s, ThreadFrame *f, int n); ++void ff_hevc_flush_chroma(HEVCContext *s, ThreadFrame *f, int n) + { + if (s->enable_rpi && !( s->nal_unit_type == NAL_TRAIL_N || + s->nal_unit_type == NAL_TSA_N || + s->nal_unit_type == NAL_STSA_N || + s->nal_unit_type == NAL_RADL_N || + s->nal_unit_type == NAL_RASL_N )) { +-#define RPI_FAST_CACHEFLUSH + #ifdef RPI_FAST_CACHEFLUSH + struct vcsm_user_clean_invalid_s iocache = {}; +- int curr_y = f->progress->data[0]; ++ int curr_y = ((int *)f->progress->data)[0]; ++ int curr_uv = curr_y >> s->ps.sps->vshift[1]; ++ int n_uv = n >> s->ps.sps->vshift[1]; + int sz,base; +- if (curr_y < 0) curr_y = 0; +- if (n<=curr_y) return; // Should not happen +- sz = s->frame->linesize[1] * (n-curr_y); +- base = s->frame->linesize[1] * curr_y; +- iocache.s[0].cmd = 3; // Flush L1 cache +- iocache.s[0].addr = 0; +- iocache.s[0].size = 0; +- +- iocache.s[1].cmd = 2; +- iocache.s[1].addr = ff_hevc_buf_base(s->frame->buf[1]) + base; ++ if (curr_uv < 0) curr_uv = 0; ++ if (n_uv<=curr_uv) { assert(0); return; } // Should not happen ++ sz = s->frame->linesize[1] * (n_uv-curr_uv); ++ base = s->frame->linesize[1] * curr_uv; ++ GPU_MEM_PTR_T *p = av_buffer_pool_opaque(s->frame->buf[1]); ++ iocache.s[0].handle = p->vcsm_handle; ++ iocache.s[0].cmd = 3; // clean+invalidate ++ iocache.s[0].addr = p->arm + base; ++ iocache.s[0].size = sz; ++ p = av_buffer_pool_opaque(s->frame->buf[2]); ++ iocache.s[1].handle = p->vcsm_handle; ++ iocache.s[1].cmd = 3; // clean+invalidate ++ iocache.s[1].addr = p->arm + base; + iocache.s[1].size = sz; +- +- iocache.s[2].cmd = 2; +- iocache.s[2].addr = ff_hevc_buf_base(s->frame->buf[2]) + base; +- iocache.s[2].size = sz; +- +- vcsm_clean_invalid( gpu_get_mailbox(), &iocache ); +- ++ vcsm_clean_invalid( &iocache ); + #else + flush_buffer(s->frame->buf[1]); + flush_buffer(s->frame->buf[2]); +diff --git a/libavcodec/rpi_qpu.c b/libavcodec/rpi_qpu.c +index feb3284..aa65a77 100644 +--- a/libavcodec/rpi_qpu.c ++++ b/libavcodec/rpi_qpu.c +@@ -211,6 +211,7 @@ static void gpu_unlock(void) { + } + + static int gpu_malloc_uncached_internal(int numbytes, GPU_MEM_PTR_T *p, int mb) { ++ p->numbytes = numbytes; + p->vcsm_handle = vcsm_malloc_cache(numbytes, VCSM_CACHE_TYPE_NONE, (char *)"Video Frame" ); + assert(p->vcsm_handle); + p->vc_handle = vcsm_vc_hdl_from_hdl(p->vcsm_handle); +@@ -243,13 +244,25 @@ int gpu_get_mailbox(void) + return gpu->mb; + } + ++// Call this to clean and invalidate a region of memory + void gpu_cache_flush(GPU_MEM_PTR_T *p) + { +- void *tmp = vcsm_lock(p->vcsm_handle); +- vcsm_unlock_ptr(tmp); ++#define RPI_FAST_CACHEFLUSH ++#ifdef RPI_FAST_CACHEFLUSH ++ struct vcsm_user_clean_invalid_s iocache = {}; ++ iocache.s[0].handle = p->vcsm_handle; ++ iocache.s[0].cmd = 3; // clean+invalidate ++ iocache.s[0].addr = p->arm; ++ iocache.s[0].size = p->numbytes; ++ vcsm_clean_invalid( &iocache ); ++#else ++ void *tmp = vcsm_lock(p->vcsm_handle); ++ vcsm_unlock_ptr(tmp); ++#endif + } + + static int gpu_malloc_cached_internal(int numbytes, GPU_MEM_PTR_T *p) { ++ p->numbytes = numbytes; + p->vcsm_handle = vcsm_malloc_cache(numbytes, VCSM_CACHE_TYPE_HOST, (char *)"Video Frame" ); + //p->vcsm_handle = vcsm_malloc_cache(numbytes, VCSM_CACHE_TYPE_VC, (char *)"Video Frame" ); + //p->vcsm_handle = vcsm_malloc_cache(numbytes, VCSM_CACHE_TYPE_NONE, (char *)"Video Frame" ); +diff --git a/libavcodec/rpi_qpu.h b/libavcodec/rpi_qpu.h +index 2f08f03..0565a60 100644 +--- a/libavcodec/rpi_qpu.h ++++ b/libavcodec/rpi_qpu.h +@@ -1,6 +1,8 @@ + #ifndef RPI_QPU_H + #define RPI_QPU_H + ++#define RPI_FAST_CACHEFLUSH ++ + typedef struct gpu_mem_ptr_s { + unsigned char *arm; // Pointer to memory mapped on ARM side + int vc_handle; // Videocore handle of relocatable memory +diff --git a/libavcodec/rpi_user_vcsm.h b/libavcodec/rpi_user_vcsm.h +index 95e6de1..db41a4d 100644 +--- a/libavcodec/rpi_user_vcsm.h ++++ b/libavcodec/rpi_user_vcsm.h +@@ -1,29 +1,41 @@ +-/* +-Copyright (c) 2012, Broadcom Europe Ltd +-All rights reserved. +- +-Redistribution and use in source and binary forms, with or without +-modification, are permitted provided that the following conditions are met: +- * Redistributions of source code must retain the above copyright +- notice, this list of conditions and the following disclaimer. +- * 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. +- * Neither the name of the copyright holder nor the +- names of its contributors may be used to endorse or promote products +- derived from this software without specific prior written permission. +- +-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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. +-*/ ++/***************************************************************************** ++* Copyright 2001 - 2011 Broadcom Corporation. All rights reserved. ++* ++* This program is the proprietary software of Broadcom Corporation and/or ++* its licensors, and may only be used, duplicated, modified or distributed ++* pursuant to the terms and conditions of a separate, written license ++* agreement executed between you and Broadcom (an "Authorized License"). ++* Except as set forth in an Authorized License, Broadcom grants no license ++* (express or implied), right to use, or waiver of any kind with respect to ++* the Software, and Broadcom expressly reserves all rights in and to the ++* Software and all intellectual property rights therein. IF YOU HAVE NO ++* AUTHORIZED LICENSE, THEN YOU HAVE NO RIGHT TO USE THIS SOFTWARE IN ANY ++* WAY, AND SHOULD IMMEDIATELY NOTIFY BROADCOM AND DISCONTINUE ALL USE OF ++* THE SOFTWARE. ++* ++* Except as expressly set forth in the Authorized License, ++* 1. This program, including its structure, sequence and organization, ++* constitutes the valuable trade secrets of Broadcom, and you shall use ++* all reasonable efforts to protect the confidentiality thereof, and to ++* use this information only in connection with your use of Broadcom ++* integrated circuit products. ++* 2. TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS" ++* AND WITH ALL FAULTS AND BROADCOM MAKES NO PROMISES, REPRESENTATIONS OR ++* WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH ++* RESPECT TO THE SOFTWARE. BROADCOM SPECIFICALLY DISCLAIMS ANY AND ALL ++* IMPLIED WARRANTIES OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS ++* FOR A PARTICULAR PURPOSE, LACK OF VIRUSES, ACCURACY OR COMPLETENESS, ++* QUIET ENJOYMENT, QUIET POSSESSION OR CORRESPONDENCE TO DESCRIPTION. YOU ++* ASSUME THE ENTIRE RISK ARISING OUT OF USE OR PERFORMANCE OF THE SOFTWARE. ++* 3. TO THE MAXIMUM EXTENT PERMITTED BY LAW, IN NO EVENT SHALL BROADCOM OR ITS ++* LICENSORS BE LIABLE FOR (i) CONSEQUENTIAL, INCIDENTAL, SPECIAL, INDIRECT, ++* OR EXEMPLARY DAMAGES WHATSOEVER ARISING OUT OF OR IN ANY WAY RELATING TO ++* YOUR USE OF OR INABILITY TO USE THE SOFTWARE EVEN IF BROADCOM HAS BEEN ++* ADVISED OF THE POSSIBILITY OF SUCH DAMAGES; OR (ii) ANY AMOUNT IN EXCESS ++* OF THE AMOUNT ACTUALLY PAID FOR THE SOFTWARE ITSELF OR U.S. $1, WHICHEVER ++* IS GREATER. THESE LIMITATIONS SHALL APPLY NOTWITHSTANDING ANY FAILURE OF ++* ESSENTIAL PURPOSE OF ANY LIMITED REMEDY. ++*****************************************************************************/ + + #ifndef __USER_VCSM__H__INCLUDED__ + #define __USER_VCSM__H__INCLUDED__ +@@ -424,21 +436,21 @@ int vcsm_unlock_hdl_sp( unsigned int handle, int cache_no_flush ); + ** + ** structure contains a list of flush/invalidate commands. Commands are: + ** 0: nop +-** 1: invalidate given physical range in L2 +-** 2: clean given physical range in L2 +-** 3: clean+invalidate all of L1 +-** 4: flush all of L2 and all of L1 ++** 1: invalidate given virtual range in L1/L2 ++** 2: clean given virtual range in L1/L2 ++** 3: clean+invalidate given virtual range in L1/L2 ++** 4: flush all L1/L2 + */ + struct vcsm_user_clean_invalid_s { +- struct { +- unsigned int cmd; +- unsigned int addr; +- unsigned int size; +- } s[8]; ++ struct { ++ unsigned int cmd; ++ unsigned int handle; ++ unsigned int addr; ++ unsigned int size; ++ } s[8]; + }; + +-int vcsm_clean_invalid( unsigned int handle, struct vcsm_user_clean_invalid_s *s ); +- ++int vcsm_clean_invalid( struct vcsm_user_clean_invalid_s *s ); + + #ifdef __cplusplus + } +-- +2.5.0 + + +From b91ec9a8437e65c59dddf323de875e62ee227403 Mon Sep 17 00:00:00 2001 +From: popcornmix <popcornmix@gmail.com> +Date: Sat, 23 May 2015 21:10:10 +0100 +Subject: [PATCH 46/68] Fix multi mailbox extra transform call + +--- + libavcodec/hevc.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c +index 52293bf..fa6d788 100644 +--- a/libavcodec/hevc.c ++++ b/libavcodec/hevc.c +@@ -3013,7 +3013,9 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) + #ifdef RPI_INTER_QPU + rpi_execute_inter_qpu(s); + #endif ++#ifndef RPI_MULTI_MAILBOX + rpi_execute_transform(s); ++#endif + rpi_execute_inter_cmds(s); + vpu_wait(s->vpu_id); + rpi_execute_pred_cmds(s); +-- +2.5.0 + + +From 03bbcfdda2db59b9603018b1cf0ca340d9ffc088 Mon Sep 17 00:00:00 2001 +From: Peter de Rivaz <peter.derivaz@gmail.com> +Date: Wed, 27 May 2015 16:44:29 +0100 +Subject: [PATCH 47/68] Added support for running luma prediction on QPUs + +--- + libavcodec/hevc.c | 237 +++++++- + libavcodec/hevc.h | 26 +- + libavcodec/hevc_filter.c | 23 +- + libavcodec/rpi_qpu.c | 156 ++++-- + libavcodec/rpi_qpu.h | 8 +- + libavcodec/rpi_shader.c | 1313 ++++++++++++++++++++++---------------------- + libavcodec/rpi_shader.h | 21 +- + libavcodec/rpi_shader.qasm | 883 ++++++++++++++--------------- + 8 files changed, 1464 insertions(+), 1203 deletions(-) + +diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c +index fa6d788..11b9e60 100644 +--- a/libavcodec/hevc.c ++++ b/libavcodec/hevc.c +@@ -52,6 +52,11 @@ + // Define RPI_MULTI_MAILBOX to use the updated mailbox that can launch both QPU and VPU + #define RPI_MULTI_MAILBOX + #endif ++ ++ // Define RPI_CACHE_UNIF_MVS to write motion vector uniform stream to cached memory ++ // RPI_CACHE_UNIF_MVS doesn't seem to make much difference, so left undefined. ++ ++ + #endif + + // #define DISABLE_MC +@@ -74,6 +79,13 @@ const uint8_t ff_hevc_pel_weight[65] = { [2] = 0, [4] = 1, [6] = 2, [8] = 3, [12 + // The QPU code for UV blocks only works up to a block width of 8 + #define RPI_CHROMA_BLOCK_WIDTH 8 + ++// Split image of 2048 into parts 64 wide ++// So some QPUs will have 3 blocks of 64 to do, and others 2 blocks for an image 2048 wide with 32 blocks across ++// Each block of 64*64 ++// Smallest CTU size is 16x16, so smallest block is 8x8 ++// Corresponds to a total of 83kbytes over all 12 QPUs ++#define RPI_LUMA_COMMAND_WORDS 9 ++#define Y_COMMANDS_PER_QPU ((1+3*(64*64)/(8*8)) * RPI_LUMA_COMMAND_WORDS) + + #define ENCODE_COEFFS(c0, c1, c2, c3) (((c0) & 0xff) | ((c1) & 0xff) << 8 | ((c2) & 0xff) << 16 | ((c3) & 0xff) << 24) + +@@ -2004,10 +2016,46 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, + int nPbW_c = nPbW >> s->ps.sps->hshift[1]; + int nPbH_c = nPbH >> s->ps.sps->vshift[1]; + +- RPI_REDIRECT(luma_mc_uni)(s, dst0, s->frame->linesize[0], ref0->frame, ++#ifdef RPI_LUMA_QPU ++ if (s->enable_rpi) { ++ int reflist = 0; ++ const Mv *mv = &current_mv.mv[reflist]; ++ int mx = mv->x & 3; ++ int my = mv->y & 3; ++ int my_mx = (my<<8) + mx; ++ int my2_mx2_my_mx = (my_mx << 16) + my_mx; ++ int x1 = x0 + (mv->x >> 2); ++ int y1 = y0 + (mv->y >> 2); ++ int chan = x0>>6; // 64 wide blocks per QPU ++ int weight_flag = (s->sh.slice_type == P_SLICE && s->ps.pps->weighted_pred_flag) || ++ (s->sh.slice_type == B_SLICE && s->ps.pps->weighted_bipred_flag); ++ uint32_t *y = s->y_mvs[chan % 12]; ++ for(int start_y=0;start_y < nPbH;start_y+=16) { // Potentially we could change the assembly code to support taller sizes in one go ++ for(int start_x=0;start_x < nPbW;start_x+=16) { ++ y++[-RPI_LUMA_COMMAND_WORDS] = ((y1 - 3 + start_y) << 16) + ( (x1 - 3 + start_x) & 0xffff); ++ y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[0]); ++ y++[-RPI_LUMA_COMMAND_WORDS] = ((y1 - 3 + start_y) << 16) + ( (x1 - 3 + 8 + start_x) & 0xffff); ++ y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[0]); ++ *y++ = ( (nPbW<16 ? nPbW : 16) << 16 ) + (nPbH<16 ? nPbH : 16); ++ *y++ = my2_mx2_my_mx; ++ if (weight_flag) { ++ *y++ = (s->sh.luma_offset_l0[current_mv.ref_idx[reflist]] << 16) + (s->sh.luma_weight_l0[current_mv.ref_idx[reflist]] & 0xffff); ++ } else { ++ *y++ = 1; // Weight of 1 and offset of 0 ++ } ++ *y++ = (get_vc_address(s->frame->buf[0]) + x0 + start_x + (start_y + y0) * s->frame->linesize[0]); ++ y++[-RPI_LUMA_COMMAND_WORDS] = s->mc_filter; ++ } ++ } ++ s->y_mvs[chan % 12] = y; ++ } else ++#endif ++ { ++ RPI_REDIRECT(luma_mc_uni)(s, dst0, s->frame->linesize[0], ref0->frame, + &current_mv.mv[0], x0, y0, nPbW, nPbH, + s->sh.luma_weight_l0[current_mv.ref_idx[0]], + s->sh.luma_offset_l0[current_mv.ref_idx[0]]); ++ } + + if (s->ps.sps->chroma_format_idc) { + #ifdef RPI_INTER_QPU +@@ -2067,10 +2115,47 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, + int nPbW_c = nPbW >> s->ps.sps->hshift[1]; + int nPbH_c = nPbH >> s->ps.sps->vshift[1]; + +- RPI_REDIRECT(luma_mc_uni)(s, dst0, s->frame->linesize[0], ref1->frame, ++#ifdef RPI_LUMA_QPU ++ if (s->enable_rpi) { ++ int reflist = 1; ++ const Mv *mv = &current_mv.mv[reflist]; ++ int mx = mv->x & 3; ++ int my = mv->y & 3; ++ int my_mx = (my<<8) + mx; ++ int my2_mx2_my_mx = (my_mx << 16) + my_mx; ++ int x1 = x0 + (mv->x >> 2); ++ int y1 = y0 + (mv->y >> 2); ++ int chan = x0>>6; // 64 wide blocks per QPU ++ int weight_flag = (s->sh.slice_type == P_SLICE && s->ps.pps->weighted_pred_flag) || ++ (s->sh.slice_type == B_SLICE && s->ps.pps->weighted_bipred_flag); ++ uint32_t *y = s->y_mvs[chan % 12]; ++ for(int start_y=0;start_y < nPbH;start_y+=16) { // Potentially we could change the assembly code to support taller sizes in one go ++ for(int start_x=0;start_x < nPbW;start_x+=16) { ++ y++[-RPI_LUMA_COMMAND_WORDS] = ((y1 - 3 + start_y) << 16) + ( (x1 - 3 + start_x) & 0xffff); ++ y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[0]); ++ y++[-RPI_LUMA_COMMAND_WORDS] = ((y1 - 3 + start_y) << 16) + ( (x1 - 3 + 8 + start_x) & 0xffff); ++ y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[0]); ++ *y++ = ( (nPbW<16 ? nPbW : 16) << 16 ) + (nPbH<16 ? nPbH : 16); ++ *y++ = my2_mx2_my_mx; ++ if (weight_flag) { ++ *y++ = (s->sh.luma_offset_l0[current_mv.ref_idx[reflist]] << 16) + (s->sh.luma_weight_l0[current_mv.ref_idx[reflist]] & 0xffff); ++ } else { ++ *y++ = 1; // Weight of 1 and offset of 0 ++ } ++ *y++ = (get_vc_address(s->frame->buf[0]) + x0 + start_x + (start_y + y0) * s->frame->linesize[0]); ++ y++[-RPI_LUMA_COMMAND_WORDS] = s->mc_filter; ++ } ++ } ++ s->y_mvs[chan % 12] = y; ++ } else ++#endif ++ ++ { ++ RPI_REDIRECT(luma_mc_uni)(s, dst0, s->frame->linesize[0], ref1->frame, + &current_mv.mv[1], x0, y0, nPbW, nPbH, + s->sh.luma_weight_l1[current_mv.ref_idx[1]], + s->sh.luma_offset_l1[current_mv.ref_idx[1]]); ++ } + + if (s->ps.sps->chroma_format_idc) { + #ifdef RPI_INTER_QPU +@@ -2104,8 +2189,8 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, + *u++ = rpi_filter_coefs[_mx][0]; + *u++ = rpi_filter_coefs[_my][0]; + if (weight_flag) { +- *u++ = (s->sh.chroma_offset_l0[current_mv.ref_idx[1]][0] << 16) + (s->sh.chroma_weight_l0[current_mv.ref_idx[1]][0] & 0xffff); +- *u++ = (s->sh.chroma_offset_l0[current_mv.ref_idx[1]][1] << 16) + (s->sh.chroma_weight_l0[current_mv.ref_idx[1]][1] & 0xffff); ++ *u++ = (s->sh.chroma_offset_l0[current_mv.ref_idx[reflist]][0] << 16) + (s->sh.chroma_weight_l0[current_mv.ref_idx[reflist]][0] & 0xffff); ++ *u++ = (s->sh.chroma_offset_l0[current_mv.ref_idx[reflist]][1] << 16) + (s->sh.chroma_weight_l0[current_mv.ref_idx[reflist]][1] & 0xffff); + } else { + *u++ = 1; // Weight of 1 and offset of 0 + *u++ = 1; +@@ -2132,9 +2217,44 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, + int nPbW_c = nPbW >> s->ps.sps->hshift[1]; + int nPbH_c = nPbH >> s->ps.sps->vshift[1]; + +- RPI_REDIRECT(luma_mc_bi)(s, dst0, s->frame->linesize[0], ref0->frame, ++#ifdef RPI_LUMA_QPU ++ if (s->enable_rpi) { ++ const Mv *mv = &current_mv.mv[0]; ++ int mx = mv->x & 3; ++ int my = mv->y & 3; ++ int my_mx = (my<<8) + mx; ++ const Mv *mv2 = &current_mv.mv[1]; ++ int mx2 = mv2->x & 3; ++ int my2 = mv2->y & 3; ++ int my2_mx2 = (my2<<8) + mx2; ++ int my2_mx2_my_mx = (my2_mx2 << 16) + my_mx; ++ int x1 = x0 + (mv->x >> 2); ++ int y1 = y0 + (mv->y >> 2); ++ int x2 = x0 + (mv2->x >> 2); ++ int y2 = y0 + (mv2->y >> 2); ++ int chan = x0>>6; // 64 wide blocks per QPU ++ uint32_t *y = s->y_mvs[chan % 12]; ++ for(int start_y=0;start_y < nPbH;start_y+=16) { // Potentially we could change the assembly code to support taller sizes in one go ++ for(int start_x=0;start_x < nPbW;start_x+=8) { // B blocks work 8 at a time ++ y++[-RPI_LUMA_COMMAND_WORDS] = ((y1 - 3 + start_y) << 16) + ( (x1 - 3 + start_x) & 0xffff); ++ y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[0]); ++ y++[-RPI_LUMA_COMMAND_WORDS] = ((y2 - 3 + start_y) << 16) + ( (x2 - 3 + start_x) & 0xffff); // Second fetch is for ref1 ++ y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[0]); ++ *y++ = ( (nPbW<8 ? nPbW : 8) << 16 ) + (nPbH<16 ? nPbH : 16); ++ *y++ = my2_mx2_my_mx; ++ *y++ = 1; // B frame weighted prediction not supported ++ *y++ = (get_vc_address(s->frame->buf[0]) + x0 + start_x + (start_y + y0) * s->frame->linesize[0]); ++ y++[-RPI_LUMA_COMMAND_WORDS] = s->mc_filter_b; ++ } ++ } ++ s->y_mvs[chan % 12] = y; ++ } else ++#endif ++ { ++ RPI_REDIRECT(luma_mc_bi)(s, dst0, s->frame->linesize[0], ref0->frame, + &current_mv.mv[0], x0, y0, nPbW, nPbH, + ref1->frame, &current_mv.mv[1], &current_mv); ++ } + + if (s->ps.sps->chroma_format_idc) { + #ifdef RPI_INTER_QPU +@@ -2823,7 +2943,6 @@ static void rpi_inter_clear(HEVCContext *s) + *s->u_mvs[i]++ = pic_height; + *s->u_mvs[i]++ = s->frame->linesize[1]; + *s->u_mvs[i]++ = s->frame->linesize[2]; +- *s->u_mvs[i]++ = i; + if (weight_flag) { + *s->u_mvs[i]++ = 1 << (s->sh.chroma_log2_weight_denom + 6 - 1); + *s->u_mvs[i]++ = s->sh.chroma_log2_weight_denom + 6; +@@ -2831,7 +2950,31 @@ static void rpi_inter_clear(HEVCContext *s) + *s->u_mvs[i]++ = 1 << 5; + *s->u_mvs[i]++ = 6; + } ++ *s->u_mvs[i]++ = i; // Select section of VPM (avoid collisions with 3d unit) ++ } ++ ++#ifdef RPI_LUMA_QPU ++ for(i=0;i<12;i++) { ++ s->y_mvs[i] = s->y_mvs_base[i]; ++ *s->y_mvs[i]++ = 0; // y_x ++ *s->y_mvs[i]++ = 0; // ref_y_base ++ *s->y_mvs[i]++ = 0; // y2_x2 ++ *s->y_mvs[i]++ = 0; // ref_y2_base ++ *s->y_mvs[i]++ = (s->ps.sps->width << 16) + s->ps.sps->height; ++ *s->y_mvs[i]++ = s->frame->linesize[0]; // pitch ++ *s->y_mvs[i]++ = s->frame->linesize[0]; // dst_pitch ++ if (weight_flag) { ++ int offset = 1 << (s->sh.luma_log2_weight_denom + 6 - 1); ++ int shift = s->sh.luma_log2_weight_denom + 6; ++ *s->y_mvs[i]++ = (offset << 16) + shift; ++ } else { ++ int offset = 1 << 5; ++ int shift = 6; ++ *s->y_mvs[i]++ = (offset << 16) + shift; ++ } ++ *s->y_mvs[i]++ = 0; // Next kernel + } ++#endif + } + + static void rpi_execute_inter_qpu(HEVCContext *s) +@@ -2839,6 +2982,9 @@ static void rpi_execute_inter_qpu(HEVCContext *s) + int k; + int i; + uint32_t *unif_vc = (uint32_t *)s->unif_mvs_ptr.vc; ++#ifdef RPI_LUMA_QPU ++ uint32_t *y_unif_vc = (uint32_t *)s->y_unif_mvs_ptr.vc; ++#endif + if (s->sh.slice_type == I_SLICE) { + #ifdef RPI_MULTI_MAILBOX + rpi_execute_transform(s); +@@ -2854,8 +3000,23 @@ static void rpi_execute_inter_qpu(HEVCContext *s) + + s->u_mvs[8-1][-RPI_CHROMA_COMMAND_WORDS] = qpu_get_fn(QPU_MC_INTERRUPT_EXIT8); // This QPU will signal interrupt when all others are done and have acquired a semaphore + ++#ifdef RPI_LUMA_QPU ++ for(k=0;k<12;k++) { ++ s->y_mvs[k][-RPI_LUMA_COMMAND_WORDS+1] = qpu_get_fn(QPU_MC_SETUP_UV); // A dummy texture location (maps to our code) - this is needed as the texture requests are pipelined ++ s->y_mvs[k][-RPI_LUMA_COMMAND_WORDS+3] = qpu_get_fn(QPU_MC_SETUP_UV); // Also need a dummy for second request ++ s->y_mvs[k][-RPI_LUMA_COMMAND_WORDS+8] = qpu_get_fn(QPU_MC_EXIT); // Add exit command ++ assert(s->y_mvs[k] - s->y_mvs_base[k] < Y_COMMANDS_PER_QPU); ++ } ++ s->y_mvs[12-1][-RPI_LUMA_COMMAND_WORDS+8] = qpu_get_fn(QPU_MC_INTERRUPT_EXIT12); // This QPU will signal interrupt when all others are done and have acquired a semaphore ++#endif ++ ++ + #ifdef RPI_MULTI_MAILBOX ++#ifdef RPI_CACHE_UNIF_MVS ++ gpu_cache_flush3(&s->coeffs_buf_accelerated,&s->y_unif_mvs_ptr, &s->unif_mvs_ptr); ++#else + gpu_cache_flush(&s->coeffs_buf_accelerated); ++#endif + s->vpu_id = vpu_qpu_post_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf_vc[2], s->num_coeffs[2] >> 8, s->coeffs_buf_vc[3], s->num_coeffs[3] >> 10, 0, + qpu_get_fn(QPU_MC_SETUP_UV), + (uint32_t)(unif_vc+(s->mvs_base[0 ] - (uint32_t*)s->unif_mvs_ptr.arm)), +@@ -2865,7 +3026,27 @@ static void rpi_execute_inter_qpu(HEVCContext *s) + (uint32_t)(unif_vc+(s->mvs_base[4 ] - (uint32_t*)s->unif_mvs_ptr.arm)), + (uint32_t)(unif_vc+(s->mvs_base[5 ] - (uint32_t*)s->unif_mvs_ptr.arm)), + (uint32_t)(unif_vc+(s->mvs_base[6 ] - (uint32_t*)s->unif_mvs_ptr.arm)), +- (uint32_t)(unif_vc+(s->mvs_base[7 ] - (uint32_t*)s->unif_mvs_ptr.arm)) ++ (uint32_t)(unif_vc+(s->mvs_base[7 ] - (uint32_t*)s->unif_mvs_ptr.arm)), ++#ifdef RPI_LUMA_QPU ++ qpu_get_fn(QPU_MC_SETUP), ++ (uint32_t)(y_unif_vc+(s->y_mvs_base[0 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)), ++ (uint32_t)(y_unif_vc+(s->y_mvs_base[1 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)), ++ (uint32_t)(y_unif_vc+(s->y_mvs_base[2 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)), ++ (uint32_t)(y_unif_vc+(s->y_mvs_base[3 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)), ++ (uint32_t)(y_unif_vc+(s->y_mvs_base[4 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)), ++ (uint32_t)(y_unif_vc+(s->y_mvs_base[5 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)), ++ (uint32_t)(y_unif_vc+(s->y_mvs_base[6 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)), ++ (uint32_t)(y_unif_vc+(s->y_mvs_base[7 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)), ++ (uint32_t)(y_unif_vc+(s->y_mvs_base[8 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)), ++ (uint32_t)(y_unif_vc+(s->y_mvs_base[9 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)), ++ (uint32_t)(y_unif_vc+(s->y_mvs_base[10 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)), ++ (uint32_t)(y_unif_vc+(s->y_mvs_base[11 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)) ++#else ++ 0, ++ 0,0,0,0, ++ 0,0,0,0, ++ 0,0,0,0 ++#endif + ); + for(i=0;i<4;i++) + s->num_coeffs[i] = 0; +@@ -2881,6 +3062,8 @@ static void rpi_execute_inter_qpu(HEVCContext *s) + (uint32_t)(unif_vc+(s->mvs_base[7 ] - (uint32_t*)s->unif_mvs_ptr.arm)) + ); + #endif ++ ++ + } + #endif + +@@ -3568,8 +3751,7 @@ static int decode_nal_units(HEVCContext *s, const uint8_t *buf, int length) + fail: + if (s->ref && s->threads_type == FF_THREAD_FRAME) { + #ifdef RPI_INTER_QPU +- void ff_hevc_flush_chroma(HEVCContext *s, ThreadFrame *f, int n); +- ff_hevc_flush_chroma(s, &s->ref->tf, s->ps.sps->height); ++ ff_hevc_flush_buffer(s, &s->ref->tf, s->ps.sps->height); + #endif + ff_thread_report_progress(&s->ref->tf, INT_MAX, 0); + } +@@ -3756,7 +3938,6 @@ static av_cold int hevc_decode_free(AVCodecContext *avctx) + + #ifdef RPI + av_freep(&s->unif_mv_cmds); +- av_freep(&s->unif_xfm_cmds); + av_freep(&s->univ_pred_cmds); + + #ifdef RPI_INTER_QPU +@@ -3765,7 +3946,12 @@ static av_cold int hevc_decode_free(AVCodecContext *avctx) + s->unif_mvs = 0; + } + #endif +- //gpu_free(&s->dummy); ++#ifdef RPI_LUMA_QPU ++ if (s->y_unif_mvs) { ++ gpu_free( &s->y_unif_mvs_ptr ); ++ s->y_unif_mvs = 0; ++ } ++#endif + + #ifdef EARLY_MALLOC + printf("hevc_decode_free\n"); +@@ -3855,9 +4041,6 @@ static av_cold int hevc_init_context(AVCodecContext *avctx) + s->unif_mv_cmds = av_mallocz(sizeof(HEVCMvCmd)*RPI_MAX_MV_CMDS); + if (!s->unif_mv_cmds) + goto fail; +- s->unif_xfm_cmds = av_mallocz(sizeof(HEVCXfmCmd)*RPI_MAX_XFM_CMDS); +- if (!s->unif_xfm_cmds) +- goto fail; + s->univ_pred_cmds = av_mallocz(sizeof(HEVCPredCmd)*RPI_MAX_PRED_CMDS); + if (!s->univ_pred_cmds) + goto fail; +@@ -3871,7 +4054,11 @@ static av_cold int hevc_init_context(AVCodecContext *avctx) + { + int uv_commands_per_qpu = UV_COMMANDS_PER_QPU; + uint32_t *p; ++#ifdef RPI_CACHE_UNIF_MVS ++ gpu_malloc_cached( 8 * uv_commands_per_qpu * sizeof(uint32_t), &s->unif_mvs_ptr ); ++#else + gpu_malloc_uncached( 8 * uv_commands_per_qpu * sizeof(uint32_t), &s->unif_mvs_ptr ); ++#endif + s->unif_mvs = (uint32_t *) s->unif_mvs_ptr.arm; // TODO support this allocation in non EARLY_MALLOC + + // Set up initial locations for uniform streams +@@ -3886,6 +4073,28 @@ static av_cold int hevc_init_context(AVCodecContext *avctx) + + } + #endif ++#ifdef RPI_LUMA_QPU ++ { ++ int y_commands_per_qpu = Y_COMMANDS_PER_QPU; ++ uint32_t *p; ++#ifdef RPI_CACHE_UNIF_MVS ++ gpu_malloc_cached( 12 * y_commands_per_qpu * sizeof(uint32_t), &s->y_unif_mvs_ptr ); ++#else ++ gpu_malloc_uncached( 12 * y_commands_per_qpu * sizeof(uint32_t), &s->y_unif_mvs_ptr ); ++#endif ++ s->y_unif_mvs = (uint32_t *) s->y_unif_mvs_ptr.arm; // TODO support this allocation in non EARLY_MALLOC ++ ++ // Set up initial locations for uniform streams ++ p = s->y_unif_mvs; ++ for(i = 0; i < 12; i++) { ++ s->y_mvs_base[i] = p; ++ p += y_commands_per_qpu; ++ } ++ s->mc_filter = qpu_get_fn(QPU_MC_FILTER); ++ s->mc_filter_b = qpu_get_fn(QPU_MC_FILTER_B); ++ ++ } ++#endif + //gpu_malloc_uncached(2048*64,&s->dummy); + + #ifdef EARLY_MALLOC +diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h +index d33ab74..a3668a2 100644 +--- a/libavcodec/hevc.h ++++ b/libavcodec/hevc.h +@@ -43,9 +43,13 @@ + #ifdef RPI + + #include "rpi_qpu.h" +- // Use QPU for inter prediction ++ // Define RPI_INTER_QPU to use QPU for chroma inter prediction + #define RPI_INTER_QPU + ++ #ifdef RPI_INTER_QPU ++ // Define RPI_LUMA_QPU to also use QPU for luma inter prediction ++ #define RPI_LUMA_QPU ++ #endif + #endif + + #define MAX_DPB_SIZE 16 // A.4.1 +@@ -835,7 +839,6 @@ typedef struct HEVCLocalContext { + + // Worst case is for 4:4:4 4x4 blocks with 64 high coding tree blocks, so 16 MV cmds per 4 pixels across for each colour plane, * 2 for bi + #define RPI_MAX_MV_CMDS (2*16*3*(RPI_MAX_WIDTH/4)) +-#define RPI_MAX_XFM_CMDS (16*3*(RPI_MAX_WIDTH/4)) + // Each block can have an intra prediction and a transform_add command + #define RPI_MAX_PRED_CMDS (2*16*3*(RPI_MAX_WIDTH/4)) + // Worst case is 16x16 CTUs +@@ -870,9 +873,6 @@ typedef struct HEVCMvCmd { + int8_t ref_idx[2]; + } HEVCMvCmd; + +-// Command for transform to process a block of coefficients +-typedef struct HEVCXfmCmd { +-} HEVCXfmCmd; + + // Command for intra prediction and transform_add of predictions to coefficients + #define RPI_PRED_TRANSFORM_ADD 0 +@@ -918,8 +918,7 @@ typedef struct HEVCContext { + + #ifdef RPI + int enable_rpi; +- HEVCMvCmd *unif_mv_cmds; // TODO rename +- HEVCXfmCmd *unif_xfm_cmds; ++ HEVCMvCmd *unif_mv_cmds; + HEVCPredCmd *univ_pred_cmds; + int buf_width; + GPU_MEM_PTR_T coeffs_buf_default; +@@ -946,6 +945,15 @@ typedef struct HEVCContext { + uint32_t mc_filter_uv_b0; + uint32_t mc_filter_uv_b; + #endif ++#ifdef RPI_LUMA_QPU ++ GPU_MEM_PTR_T y_unif_mvs_ptr; ++ uint32_t *y_unif_mvs; // Base of memory for motion vector commands ++ uint32_t *y_mvs_base[12]; ++ uint32_t *y_mvs[12]; ++ // Function pointers ++ uint32_t mc_filter; ++ uint32_t mc_filter_b; ++#endif + + #endif + +@@ -1192,6 +1200,10 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, + int log2_trafo_size, enum ScanType scan_idx, + int c_idx); + ++#ifdef RPI_INTER_QPU ++extern void ff_hevc_flush_buffer(HEVCContext *s, ThreadFrame *f, int n); ++#endif ++ + void ff_hevc_hls_mvd_coding(HEVCContext *s, int x0, int y0, int log2_cb_size); + + +diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c +index ec84e8a..11629e4 100644 +--- a/libavcodec/hevc_filter.c ++++ b/libavcodec/hevc_filter.c +@@ -883,8 +883,7 @@ static int ff_hevc_buf_base(AVBufferRef *bref) { + return p->vc & 0x3fffffff; + } + +-void ff_hevc_flush_chroma(HEVCContext *s, ThreadFrame *f, int n); +-void ff_hevc_flush_chroma(HEVCContext *s, ThreadFrame *f, int n) ++void ff_hevc_flush_buffer(HEVCContext *s, ThreadFrame *f, int n) + { + if (s->enable_rpi && !( s->nal_unit_type == NAL_TRAIL_N || + s->nal_unit_type == NAL_TSA_N || +@@ -911,10 +910,24 @@ void ff_hevc_flush_chroma(HEVCContext *s, ThreadFrame *f, int n) + iocache.s[1].cmd = 3; // clean+invalidate + iocache.s[1].addr = p->arm + base; + iocache.s[1].size = sz; ++ ++#ifdef RPI_LUMA_QPU ++ p = av_buffer_pool_opaque(s->frame->buf[0]); ++ sz = s->frame->linesize[0] * (n-curr_y); ++ base = s->frame->linesize[0] * curr_y; ++ iocache.s[2].handle = p->vcsm_handle; ++ iocache.s[2].cmd = 3; // clean+invalidate ++ iocache.s[2].addr = p->arm + base; ++ iocache.s[2].size = sz; ++#endif + vcsm_clean_invalid( &iocache ); + #else + flush_buffer(s->frame->buf[1]); + flush_buffer(s->frame->buf[2]); ++#ifdef RPI_LUMA_QPU ++ flush_buffer(s->frame->buf[1]); ++#endif ++ + #endif + //memcpy(s->dummy.arm,s->frame->data[0],2048*64); + //memcpy(s->dummy.arm,s->frame->data[1],1024*32); +@@ -938,7 +951,7 @@ void ff_hevc_hls_filter(HEVCContext *s, int x, int y, int ctb_size) + sao_filter_CTB(s, x, y - ctb_size); + if (s->threads_type & FF_THREAD_FRAME ) { + #ifdef RPI_INTER_QPU +- ff_hevc_flush_chroma(s,&s->ref->tf, y); ++ ff_hevc_flush_buffer(s,&s->ref->tf, y); + #endif + ff_thread_report_progress(&s->ref->tf, y, 0); + } +@@ -947,7 +960,7 @@ void ff_hevc_hls_filter(HEVCContext *s, int x, int y, int ctb_size) + sao_filter_CTB(s, x , y); + if (s->threads_type & FF_THREAD_FRAME ) { + #ifdef RPI_INTER_QPU +- ff_hevc_flush_chroma(s, &s->ref->tf, y + ctb_size); ++ ff_hevc_flush_buffer(s, &s->ref->tf, y + ctb_size); + #endif + ff_thread_report_progress(&s->ref->tf, y + ctb_size, 0); + } +@@ -957,7 +970,7 @@ void ff_hevc_hls_filter(HEVCContext *s, int x, int y, int ctb_size) + //int currh = s->ref->tf.progress->data[0]; + //if (((y + ctb_size)&63)==0) + #ifdef RPI_INTER_QPU +- ff_hevc_flush_chroma(s, &s->ref->tf, y + ctb_size - 4); ++ ff_hevc_flush_buffer(s, &s->ref->tf, y + ctb_size - 4); + #endif + ff_thread_report_progress(&s->ref->tf, y + ctb_size - 4, 0); + } +diff --git a/libavcodec/rpi_qpu.c b/libavcodec/rpi_qpu.c +index aa65a77..e12304b 100644 +--- a/libavcodec/rpi_qpu.c ++++ b/libavcodec/rpi_qpu.c +@@ -1,9 +1,11 @@ + #ifdef RPI + // This works better than the mmap in that the memory can be cached, but requires a kernel modification to enable the device. + // define RPI_TIME_TOTAL_QPU to print out how much time is spent in the QPU code +-#define RPI_TIME_TOTAL_QPU ++//#define RPI_TIME_TOTAL_QPU + // define RPI_TIME_TOTAL_VPU to print out how much time is spent in the VPI code + //#define RPI_TIME_TOTAL_VPU ++// define RPI_TIME_TOTAL_POSTED to print out how much time is spent in the multi execute QPU/VPU combined ++//#define RPI_TIME_TOTAL_POSTED + // define RPI_ASYNC to run the VPU in a separate thread, need to make a separate call to check for completion + #define RPI_ASYNC + +@@ -94,7 +96,8 @@ struct GPU + int open_count; // Number of allocated video buffers + int mb; // Mailbox handle + int vc; // Address in GPU memory +- int mail[12]; // These are used to pass pairs of code/unifs to the QPUs ++ int mail[12*2]; // These are used to pass pairs of code/unifs to the QPUs for the first QPU task ++ int mail2[12*2]; // These are used to pass pairs of code/unifs to the QPUs for the second QPU task + }; + + // Stop more than one thread trying to allocate memory or use the processing resources at once +@@ -102,7 +105,7 @@ static pthread_mutex_t gpu_mutex = PTHREAD_MUTEX_INITIALIZER; + static volatile struct GPU* gpu = NULL; + static GPU_MEM_PTR_T gpu_mem_ptr; + +-#if defined(RPI_TIME_TOTAL_QPU) || defined(RPI_TIME_TOTAL_VPU) ++#if defined(RPI_TIME_TOTAL_QPU) || defined(RPI_TIME_TOTAL_VPU) || defined(RPI_TIME_TOTAL_POSTED) + static unsigned int Microseconds(void) { + struct timespec ts; + unsigned int x; +@@ -123,7 +126,7 @@ static pthread_cond_t post_cond_head = PTHREAD_COND_INITIALIZER; + static pthread_cond_t post_cond_tail = PTHREAD_COND_INITIALIZER; + static pthread_mutex_t post_mutex = PTHREAD_MUTEX_INITIALIZER; + +-static int vpu_cmds[MAXCMDS][16]; ++static int vpu_cmds[MAXCMDS][32]; + static volatile int vpu_async_tail=0; // Contains the number of posted jobs + static volatile int vpu_async_head=0; + #endif +@@ -247,7 +250,6 @@ int gpu_get_mailbox(void) + // Call this to clean and invalidate a region of memory + void gpu_cache_flush(GPU_MEM_PTR_T *p) + { +-#define RPI_FAST_CACHEFLUSH + #ifdef RPI_FAST_CACHEFLUSH + struct vcsm_user_clean_invalid_s iocache = {}; + iocache.s[0].handle = p->vcsm_handle; +@@ -261,6 +263,34 @@ void gpu_cache_flush(GPU_MEM_PTR_T *p) + #endif + } + ++void gpu_cache_flush3(GPU_MEM_PTR_T *p0,GPU_MEM_PTR_T *p1,GPU_MEM_PTR_T *p2) ++{ ++#ifdef RPI_FAST_CACHEFLUSH ++ struct vcsm_user_clean_invalid_s iocache = {}; ++ iocache.s[0].handle = p0->vcsm_handle; ++ iocache.s[0].cmd = 3; // clean+invalidate ++ iocache.s[0].addr = (int) p0->arm; ++ iocache.s[0].size = p0->numbytes; ++ iocache.s[1].handle = p1->vcsm_handle; ++ iocache.s[1].cmd = 3; // clean+invalidate ++ iocache.s[1].addr = (int) p1->arm; ++ iocache.s[1].size = p1->numbytes; ++ iocache.s[2].handle = p2->vcsm_handle; ++ iocache.s[2].cmd = 3; // clean+invalidate ++ iocache.s[2].addr = (int) p2->arm; ++ iocache.s[2].size = p2->numbytes; ++ vcsm_clean_invalid( &iocache ); ++#else ++ void *tmp; ++ tmp = vcsm_lock(p0->vcsm_handle); ++ vcsm_unlock_ptr(tmp); ++ tmp = vcsm_lock(p1->vcsm_handle); ++ vcsm_unlock_ptr(tmp); ++ tmp = vcsm_lock(p2->vcsm_handle); ++ vcsm_unlock_ptr(tmp); ++#endif ++} ++ + static int gpu_malloc_cached_internal(int numbytes, GPU_MEM_PTR_T *p) { + p->numbytes = numbytes; + p->vcsm_handle = vcsm_malloc_cache(numbytes, VCSM_CACHE_TYPE_HOST, (char *)"Video Frame" ); +@@ -357,9 +387,19 @@ unsigned int vpu_get_constants(void) { + #ifdef RPI_ASYNC + + static void *vpu_start(void *arg) { ++#ifdef RPI_TIME_TOTAL_POSTED ++ int last_time=0; ++ long long on_time=0; ++ long long off_time=0; ++ int start_time; ++ int end_time; ++ int count=0; ++#endif + while(1) { ++ int i; + int *p; + int qpu_code; ++ int qpu_codeb; + pthread_mutex_lock(&post_mutex); + while( vpu_async_tail - vpu_async_head <= 0) + { +@@ -373,24 +413,49 @@ static void *vpu_start(void *arg) { + break; // Last job + } + qpu_code = p[7]; ++ qpu_codeb = p[16]; + //if (p[7]) { + //GPU_MEM_PTR_T *buf = (GPU_MEM_PTR_T *)p[7]; + //gpu_cache_flush(buf); + //} ++ ++#ifdef RPI_TIME_TOTAL_POSTED ++ start_time = Microseconds(); ++ if (last_time==0) ++ last_time = start_time; ++ off_time += start_time-last_time; ++#endif ++ + if (!qpu_code) { + vpu_execute_code(p[0], p[1], p[2], p[3], p[4], p[5], p[6]); + } else { +- int i; + for(i=0;i<8;i++) { + gpu->mail[i*2] = p[8+i]; + gpu->mail[i*2 + 1] = qpu_code; + } +- +- execute_multi(gpu->mb,8,gpu->vc + offsetof(struct GPU, mail), 1 /* no flush */, 5000 /* timeout ms */, +- 0, 0, 0, 0, ++ for(i=0;i<12;i++) { ++ gpu->mail2[i*2] = p[17+i]; ++ gpu->mail2[i*2 + 1] = qpu_codeb; ++ } ++#if (0) ++ vpu_execute_code(p[0], p[1], p[2], p[3], p[4], p[5], p[6]); ++ execute_qpu(gpu->mb,8,gpu->vc + offsetof(struct GPU, mail), 1 /* no flush */, 5000 /* timeout ms */); ++#else ++ execute_multi(gpu->mb, ++ 12,gpu->vc + offsetof(struct GPU, mail2), 1, 5000, ++ 8,gpu->vc + offsetof(struct GPU, mail), 1 /* no flush */, 5000 /* timeout ms */, + p[0], p[1], p[2], p[3], p[4], p[5], p[6], // VPU0 + 0, 0 , 0 , 0 , 0 , 0 , 0); // VPU1 ++#endif + } ++#ifdef RPI_TIME_TOTAL_POSTED ++ end_time = Microseconds(); ++ last_time = end_time; ++ on_time += end_time - start_time; ++ count++; ++ if ((count&0x7f)==0) ++ printf("Posted %d On=%dms, Off=%dms\n",count,(int)(on_time/1000),(int)(off_time/1000)); ++#endif + pthread_mutex_lock(&post_mutex); + vpu_async_head++; + pthread_cond_broadcast(&post_cond_head); +@@ -436,7 +501,9 @@ int vpu_post_code(unsigned code, unsigned r0, unsigned r1, unsigned r2, unsigned + } + + int vpu_qpu_post_code(unsigned vpu_code, unsigned r0, unsigned r1, unsigned r2, unsigned r3, unsigned r4, unsigned r5, +- int qpu_code, int unifs1, int unifs2, int unifs3, int unifs4, int unifs5, int unifs6, int unifs7, int unifs8) ++ int qpu_code, int unifs1, int unifs2, int unifs3, int unifs4, int unifs5, int unifs6, int unifs7, int unifs8, ++ int qpu_codeb, int unifs1b, int unifs2b, int unifs3b, int unifs4b, int unifs5b, int unifs6b, int unifs7b, int unifs8b, int unifs9b, int unifs10b, int unifs11b, int unifs12b ++ ) + { + + pthread_mutex_lock(&post_mutex); +@@ -464,6 +531,21 @@ int vpu_qpu_post_code(unsigned vpu_code, unsigned r0, unsigned r1, unsigned r2, + p[13] = unifs6; + p[14] = unifs7; + p[15] = unifs8; ++ ++ p[16] = qpu_codeb; ++ p[17] = unifs1b; ++ p[18] = unifs2b; ++ p[19] = unifs3b; ++ p[20] = unifs4b; ++ p[21] = unifs5b; ++ p[22] = unifs6b; ++ p[23] = unifs7b; ++ p[24] = unifs8b; ++ p[25] = unifs9b; ++ p[26] = unifs10b; ++ p[27] = unifs11b; ++ p[28] = unifs12b; ++ + if (num<=1) + pthread_cond_broadcast(&post_cond_tail); // Otherwise the vpu thread must already be awake + pthread_mutex_unlock(&post_mutex); +@@ -544,27 +626,27 @@ void qpu_run_shader12(int code, int num, int code2, int num2, int unifs1, int un + off_time += start_time-last_time; + #endif + for(i=0;i<num;i++) { +- gpu->mail[i*2 + 1] = code; ++ gpu->mail2[i*2 + 1] = code; + } + for(;i<num+num2;i++) { +- gpu->mail[i*2 + 1] = code2; ++ gpu->mail2[i*2 + 1] = code2; + } +- gpu->mail[0 ] = unifs1; +- gpu->mail[2 ] = unifs2; +- gpu->mail[4 ] = unifs3; +- gpu->mail[6 ] = unifs4; +- gpu->mail[8 ] = unifs5; +- gpu->mail[10] = unifs6; +- gpu->mail[12] = unifs7; +- gpu->mail[14] = unifs8; +- gpu->mail[16] = unifs9; +- gpu->mail[18] = unifs10; +- gpu->mail[20] = unifs11; +- gpu->mail[22] = unifs12; ++ gpu->mail2[0 ] = unifs1; ++ gpu->mail2[2 ] = unifs2; ++ gpu->mail2[4 ] = unifs3; ++ gpu->mail2[6 ] = unifs4; ++ gpu->mail2[8 ] = unifs5; ++ gpu->mail2[10] = unifs6; ++ gpu->mail2[12] = unifs7; ++ gpu->mail2[14] = unifs8; ++ gpu->mail2[16] = unifs9; ++ gpu->mail2[18] = unifs10; ++ gpu->mail2[20] = unifs11; ++ gpu->mail2[22] = unifs12; + execute_qpu( + gpu->mb, + 12 /* Number of QPUs */, +- gpu->vc + offsetof(struct GPU, mail), ++ gpu->vc + offsetof(struct GPU, mail2), + 1 /* no flush */, // Don't flush VPU L1 cache + 5000 /* timeout ms */); + #ifdef RPI_TIME_TOTAL_QPU +@@ -635,21 +717,21 @@ unsigned int qpu_get_fn(int num) { + gpu_unlock(); + } + switch(num) { +- //case QPU_MC_SETUP: +- // fn = mc_setup; +- // break; +- //case QPU_MC_FILTER: +- // fn = mc_filter; +- // break; ++ case QPU_MC_SETUP: ++ fn = mc_setup; ++ break; ++ case QPU_MC_FILTER: ++ fn = mc_filter; ++ break; + case QPU_MC_EXIT: + fn = mc_exit; + break; +- //case QPU_MC_INTERRUPT_EXIT: +- // fn = mc_interrupt_exit; +- // break; +- //case QPU_MC_FILTER_B: +- // fn = mc_filter_b; +- // break; ++ case QPU_MC_INTERRUPT_EXIT12: ++ fn = mc_interrupt_exit12; ++ break; ++ case QPU_MC_FILTER_B: ++ fn = mc_filter_b; ++ break; + //case QPU_MC_FILTER_HONLY: + // fn = mc_filter_honly; + // break; +diff --git a/libavcodec/rpi_qpu.h b/libavcodec/rpi_qpu.h +index 0565a60..81c2bb1 100644 +--- a/libavcodec/rpi_qpu.h ++++ b/libavcodec/rpi_qpu.h +@@ -1,6 +1,7 @@ + #ifndef RPI_QPU_H + #define RPI_QPU_H + ++// Define RPI_FAST_CACHEFLUSH to use the VCSM cache flush code + #define RPI_FAST_CACHEFLUSH + + typedef struct gpu_mem_ptr_s { +@@ -16,6 +17,7 @@ extern int gpu_malloc_cached(int numbytes, GPU_MEM_PTR_T *p); + extern int gpu_malloc_uncached(int numbytes, GPU_MEM_PTR_T *p); + extern void gpu_free(GPU_MEM_PTR_T *p); + extern void gpu_cache_flush(GPU_MEM_PTR_T *p); ++extern void gpu_cache_flush3(GPU_MEM_PTR_T *p0,GPU_MEM_PTR_T *p1,GPU_MEM_PTR_T *p2); + + // QPU specific functions + extern void qpu_run_shader8(int code, int unifs1, int unifs2, int unifs3, int unifs4, int unifs5, int unifs6, int unifs7, int unifs8); +@@ -26,7 +28,7 @@ enum { + QPU_MC_SETUP, + QPU_MC_FILTER, + QPU_MC_EXIT, +- QPU_MC_INTERRUPT_EXIT, ++ QPU_MC_INTERRUPT_EXIT12, + QPU_MC_FILTER_B, + QPU_MC_FILTER_HONLY, + QPU_MC_SETUP_UV, +@@ -44,7 +46,9 @@ extern unsigned int vpu_get_constants(void); + extern unsigned vpu_execute_code( unsigned code, unsigned r0, unsigned r1, unsigned r2, unsigned r3, unsigned r4, unsigned r5); + extern int vpu_post_code( unsigned code, unsigned r0, unsigned r1, unsigned r2, unsigned r3, unsigned r4, unsigned r5, GPU_MEM_PTR_T *buf); + int vpu_qpu_post_code(unsigned vpu_code, unsigned r0, unsigned r1, unsigned r2, unsigned r3, unsigned r4, unsigned r5, +- int qpu_code, int unifs1, int unifs2, int unifs3, int unifs4, int unifs5, int unifs6, int unifs7, int unifs8); ++ int qpu_code, int unifs1, int unifs2, int unifs3, int unifs4, int unifs5, int unifs6, int unifs7, int unifs8, ++ int qpu_codeb, int unifs1b, int unifs2b, int unifs3b, int unifs4b, int unifs5b, int unifs6b, int unifs7b, int unifs8b, int unifs9b, int unifs10b, int unifs11b, int unifs12b ++ ); + extern void vpu_wait( int id); + + // Simple test of shader code +diff --git a/libavcodec/rpi_shader.c b/libavcodec/rpi_shader.c +index a0f0282..e86eb30 100644 +--- a/libavcodec/rpi_shader.c ++++ b/libavcodec/rpi_shader.c +@@ -48,693 +48,674 @@ unsigned int rpi_shader[] = { + /* [0x000000b8] */ 0x00000000, 0xe0020367, // mov ra13, 0 + /* [0x000000c0] */ 0x00000000, 0xe00203a7, // mov ra14, 0 + /* [0x000000c8] */ 0x00000000, 0xe00203e7, // mov ra15, 0 +-/* [0x000000d0] */ 0x15827d80, 0x100208e7, // mov r3, unif +-/* [0x000000d8] */ 0x119c17c0, 0xd00208a7, // shl r2, r3, 1 +-/* [0x000000e0] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 +-/* [0x000000e8] */ 0x159e7480, 0x10020867, // mov r1, r2 +-/* [0x000000f0] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 +-/* [0x000000f8] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 +-/* [0x00000100] */ 0x159e7480, 0x10020827, // mov r0, r2 +-/* [0x00000108] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 +-/* [0x00000110] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 +-/* [0x00000118] */ 0x80004004, 0xe0020867, // mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) +-/* [0x00000120] */ 0x119c51c0, 0xd0020827, // shl r0, r0, 5 +-/* [0x00000128] */ 0x0c9e7040, 0x100216e7, // add rb27, r0, r1 +-/* [0x00000130] */ 0x119c17c0, 0xd00208a7, // shl r2, r3, 1 +-/* [0x00000138] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 +-/* [0x00000140] */ 0x159e7480, 0x10020867, // mov r1, r2 +-/* [0x00000148] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 +-/* [0x00000150] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 +-/* [0x00000158] */ 0x159e7480, 0x10020827, // mov r0, r2 +-/* [0x00000160] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 +-/* [0x00000168] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 +-/* [0x00000170] */ 0x00004800, 0xe0020867, // mov r1, vpm_setup(0, 4, h8p(0, 0)) +-/* [0x00000178] */ 0x0c9e7040, 0x10021727, // add rb28, r0, r1 +-/* [0x00000180] */ 0x0f9c11c0, 0xd0020827, // asr r0, r0, 1 +-/* [0x00000188] */ 0x00002900, 0xe0020867, // mov r1, vpm_setup(0, 2, h16p(0, 0)) +-/* [0x00000190] */ 0x0c9e7040, 0x10021567, // add rb21, r0, r1 +-/* [0x00000198] */ 0x15427d80, 0x10020827, // mov r0, ra_x +-/* [0x000001a0] */ 0x937401f6, 0xd0024821, // max r0, r0, 0; mov r1, ra_y +-/* [0x000001a8] */ 0x926191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, ra_frame_base +-/* [0x000001b0] */ 0x916431f6, 0xd00244e2, // shl ra_xshift_next, r0, 3 ; mov r2, ra_u2v_ref_offset +-/* [0x000001b8] */ 0x0c9c13c0, 0xd0020767, // add ra_y, r1, 1 +-/* [0x000001c0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 +-/* [0x000001c8] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 +-/* [0x000001d0] */ 0x939c03c0, 0xd0025850, // max r1, r1, 0 ; mov ra_x, r0 ++/* [0x000000d0] */ 0x15427d80, 0x10020827, // mov r0, ra_x ++/* [0x000000d8] */ 0x937401f6, 0xd0024821, // max r0, r0, 0; mov r1, ra_y ++/* [0x000000e0] */ 0x926191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, ra_frame_base ++/* [0x000000e8] */ 0x916431f6, 0xd00244e2, // shl ra_xshift_next, r0, 3 ; mov r2, ra_u2v_ref_offset ++/* [0x000000f0] */ 0x0c9c13c0, 0xd0020767, // add ra_y, r1, 1 ++/* [0x000000f8] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 ++/* [0x00000100] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 ++/* [0x00000108] */ 0x939c03c0, 0xd0025850, // max r1, r1, 0 ; mov ra_x, r0 ++/* [0x00000110] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 ++/* [0x00000118] */ 0x4c9d040f, 0x100248a1, // add r2, r2, r0 ; mul24 r1, r1, rb_pitch ++/* [0x00000120] */ 0x8c9e7052, 0x10025e18, // add t0s, r0, r1 ; mov ra_frame_base, r2 ++/* [0x00000128] */ 0x0c9e7440, 0x10020f27, // add t1s, r2, r1 ++/* [0x00000130] */ 0x00000008, 0xe00208a7, // mov r2,8 ++/* [0x00000138] */ 0x11827c80, 0x10021327, // shl rb12,unif, r2 ++/* [0x00000140] */ 0x0c827c80, 0x10021367, // add rb13,unif,r2 ++/* [0x00000148] */ 0x15827d80, 0x100208a7, // mov r2, unif ++/* [0x00000150] */ 0x119c15c0, 0xd00208a7, // shl r2, r2, 1 ++/* [0x00000158] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 ++/* [0x00000160] */ 0x159e7480, 0x10020867, // mov r1, r2 ++/* [0x00000168] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 ++/* [0x00000170] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 ++/* [0x00000178] */ 0x159e7480, 0x10020827, // mov r0, r2 ++/* [0x00000180] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 ++/* [0x00000188] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 ++/* [0x00000190] */ 0x00004800, 0xe0020867, // mov r1, vpm_setup(0, 4, h8p(0, 0)) ++/* [0x00000198] */ 0x0c9e7040, 0x10021727, // add rb28, r0, r1 ++/* [0x000001a0] */ 0x0f9c11c0, 0xd00208a7, // asr r2, r0, 1 ++/* [0x000001a8] */ 0x00002900, 0xe0020867, // mov r1, vpm_setup(0, 2, h16p(0, 0)) ++/* [0x000001b0] */ 0x0c9e7440, 0x10021567, // add rb21, r2, r1 ++/* [0x000001b8] */ 0x80004004, 0xe0020867, // mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) ++/* [0x000001c0] */ 0x119c51c0, 0xd0020827, // shl r0, r0, 5 ++/* [0x000001c8] */ 0x0c9e7040, 0x100216e7, // add rb27, r0, r1 ++/* [0x000001d0] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 + /* [0x000001d8] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 +-/* [0x000001e0] */ 0x4c9d040f, 0x100248a1, // add r2, r2, r0 ; mul24 r1, r1, rb_pitch +-/* [0x000001e8] */ 0x8c9e7052, 0x10025e18, // add t0s, r0, r1 ; mov ra_frame_base, r2 +-/* [0x000001f0] */ 0x0c9e7440, 0x10020e27, // add t0s, r2, r1 +-/* [0x000001f8] */ 0x15827d80, 0x10021327, // mov rb12,unif +-/* [0x00000200] */ 0x15827d80, 0x10021367, // mov rb13,unif +-/* [0x00000208] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 +-/* [0x00000210] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 +-/* [0x00000218] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 +-/* [0x00000220] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 +-/* [0x00000228] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch +-/* [0x00000230] */ 0x0c427380, 0x10020e27, // add t0s, r1, ra_x +-/* [0x00000238] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_frame_base ++/* [0x000001e0] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 ++/* [0x000001e8] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 ++/* [0x000001f0] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch ++/* [0x000001f8] */ 0x0c427380, 0x10020e27, // add t0s, r1, ra_x ++/* [0x00000200] */ 0x0c627380, 0x10020f27, // add t1s, r1, ra_frame_base + // ::mc_filter_uv +-/* [0x00000240] */ 0x15827d80, 0x100207e7, // mov ra31, unif +-/* [0x00000248] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next +-/* [0x00000250] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num +-/* [0x00000258] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif +-/* [0x00000260] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif +-/* [0x00000268] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 +-/* [0x00000270] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 +-/* [0x00000278] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 +-/* [0x00000280] */ 0x149dc1c0, 0xd00214e7, // and rb_x_next, r0, ~3 +-/* [0x00000288] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 +-/* [0x00000290] */ 0x0c9d3e80, 0x100206a7, // add ra_frame_base_next, rb_x_next, r2 +-/* [0x00000298] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 +-/* [0x000002a0] */ 0x00000010, 0xe00208a7, // mov r2, 16 +-/* [0x000002a8] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x000002b0] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 +-/* [0x000002b8] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 +-/* [0x000002c0] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 +-/* [0x000002c8] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 +-/* [0x000002d0] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 +-/* [0x000002d8] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 +-/* [0x000002e0] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 +-/* [0x000002e8] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 +-/* [0x000002f0] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 +-/* [0x000002f8] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000300] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000308] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000310] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000318] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif +-/* [0x00000320] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000328] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000330] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000338] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 +-/* [0x00000340] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-/* [0x00000348] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000350] */ 0x0f9e7080, 0x100213e7, // asr rb15, r0, r2 +-/* [0x00000358] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 +-/* [0x00000360] */ 0x0f9e7080, 0x100213a7, // asr rb14, r0, r2 +-/* [0x00000368] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000370] */ 0x0f9e7080, 0x100613e7, // asr.ifnz rb15, r0, r2 +-/* [0x00000378] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 +-/* [0x00000380] */ 0x0f9e7080, 0x100613a7, // asr.ifnz rb14, r0, r2 +-/* [0x00000388] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 +-/* [0x00000390] */ 0x00000000, 0xe00208e7, // mov r3, 0 ++/* [0x00000208] */ 0x15827d80, 0x100207e7, // mov ra31, unif ++/* [0x00000210] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next ++/* [0x00000218] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num ++/* [0x00000220] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif ++/* [0x00000228] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif ++/* [0x00000230] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 ++/* [0x00000238] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 ++/* [0x00000240] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 ++/* [0x00000248] */ 0x149dc1c0, 0xd00214e7, // and rb_x_next, r0, ~3 ++/* [0x00000250] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 ++/* [0x00000258] */ 0x0c9d3e80, 0x100206a7, // add ra_frame_base_next, rb_x_next, r2 ++/* [0x00000260] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 ++/* [0x00000268] */ 0x00000010, 0xe00208a7, // mov r2, 16 ++/* [0x00000270] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000278] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 ++/* [0x00000280] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 ++/* [0x00000288] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 ++/* [0x00000290] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 ++/* [0x00000298] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 ++/* [0x000002a0] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 ++/* [0x000002a8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 ++/* [0x000002b0] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 ++/* [0x000002b8] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 ++/* [0x000002c0] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x000002c8] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000002d0] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000002d8] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000002e0] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif ++/* [0x000002e8] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000002f0] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000002f8] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000300] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 ++/* [0x00000308] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x00000310] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000318] */ 0x0f9e7080, 0x100213e7, // asr rb15, r0, r2 ++/* [0x00000320] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 ++/* [0x00000328] */ 0x0f9e7080, 0x100208e7, // asr r3, r0, r2 ++/* [0x00000330] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000338] */ 0x0f9e7080, 0x100613e7, // asr.ifnz rb15, r0, r2 ++/* [0x00000340] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 ++/* [0x00000348] */ 0x0f9e7080, 0x100608e7, // asr.ifnz r3, r0, r2 ++/* [0x00000350] */ 0x119c87c0, 0xd00213a7, // shl rb14,r3,8 ++/* [0x00000358] */ 0x00000000, 0xe00208e7, // mov r3, 0 + // :uvloop +-/* [0x00000398] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 +-/* [0x000003a0] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu0 +-/* [0x000003a8] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 +-/* [0x000003b0] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch +-/* [0x000003b8] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 +-/* [0x000003c0] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 +-/* [0x000003c8] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 +-/* [0x000003d0] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 +-/* [0x000003d8] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x, r2 ; v8subs r1, r1, rb20 +-/* [0x000003e0] */ 0x0c627c80, 0x10020e27, // add t0s, ra_frame_base, r2 +-/* [0x000003e8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-/* [0x000003f0] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 +-/* [0x000003f8] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 +-/* [0x00000400] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 +-/* [0x00000408] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 +-/* [0x00000410] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 +-/* [0x00000418] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 +-/* [0x00000420] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 +-/* [0x00000428] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 +-/* [0x00000430] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 +-/* [0x00000438] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 +-/* [0x00000440] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop +-/* [0x00000448] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 +-/* [0x00000450] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 +-/* [0x00000458] */ 0x159e7000, 0x100203e7, // mov ra15, r0 +-/* [0x00000460] */ 0x00000020, 0xe0021327, // mov rb12,32 +-/* [0x00000468] */ 0x00000006, 0xe0021367, // mov rb13,6 +-/* [0x00000470] */ 0x00000001, 0xe00213a7, // mov rb14,1 +-/* [0x00000478] */ 0x00000000, 0xe00213e7, // mov rb15,0 +-/* [0x00000480] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 +-/* [0x00000488] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 +-/* [0x00000490] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 +-/* [0x00000498] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 +-/* [0x000004a0] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait +-/* [0x000004a8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 +-/* [0x000004b0] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 +-/* [0x000004b8] */ 0x409ce00f, 0x100049e1, // nop ; mul24 r1, r1, rb14 +-/* [0x000004c0] */ 0x0c9cc3c0, 0x10020867, // add r1, r1, rb12 +-/* [0x000004c8] */ 0x0f9cd3c0, 0x10020867, // asr r1, r1, rb13 +-/* [0x000004d0] */ 0xfffffea8, 0xf06809e7, // brr.anyn -, r:uvloop +-/* [0x000004d8] */ 0x0c9cf3c0, 0x10020867, // add r1, r1, rb15 +-/* [0x000004e0] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 +-/* [0x000004e8] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 +-/* [0x000004f0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 +-/* [0x000004f8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 +-/* [0x00000500] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif +-/* [0x00000508] */ 0x00000010, 0xe0020827, // mov r0, 16 +-/* [0x00000510] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait +-/* [0x00000518] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 +-/* [0x00000520] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 +-/* [0x00000528] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 +-/* [0x00000530] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif ++/* [0x00000360] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 ++/* [0x00000368] */ 0x8e4539bf, 0xb0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu1 ++/* [0x00000370] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 ++/* [0x00000378] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch ++/* [0x00000380] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 ++/* [0x00000388] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 ++/* [0x00000390] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 ++/* [0x00000398] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 ++/* [0x000003a0] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x, r2 ; v8subs r1, r1, rb20 ++/* [0x000003a8] */ 0x0c627c80, 0x10020f27, // add t1s, ra_frame_base, r2 ++/* [0x000003b0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x000003b8] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 ++/* [0x000003c0] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 ++/* [0x000003c8] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 ++/* [0x000003d0] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 ++/* [0x000003d8] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 ++/* [0x000003e0] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 ++/* [0x000003e8] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 ++/* [0x000003f0] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 ++/* [0x000003f8] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 ++/* [0x00000400] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 ++/* [0x00000408] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop ++/* [0x00000410] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 ++/* [0x00000418] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 ++/* [0x00000420] */ 0x159e7000, 0x100203e7, // mov ra15, r0 ++/* [0x00000428] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 ++/* [0x00000430] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 ++/* [0x00000438] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 ++/* [0x00000440] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 ++/* [0x00000448] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait ++/* [0x00000450] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 ++/* [0x00000458] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 ++/* [0x00000460] */ 0x409ce00f, 0x100049e1, // nop ; mul24 r1, r1, rb14 ++/* [0x00000468] */ 0x0c9cc3c0, 0x10020867, // add r1, r1, rb12 ++/* [0x00000470] */ 0x0f9cd3c0, 0x10020867, // asr r1, r1, rb13 ++/* [0x00000478] */ 0xfffffec8, 0xf06809e7, // brr.anyn -, r:uvloop ++/* [0x00000480] */ 0x0c9cf3c0, 0x10020867, // add r1, r1, rb15 ++/* [0x00000488] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 ++/* [0x00000490] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 ++/* [0x00000498] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 ++/* [0x000004a0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 ++/* [0x000004a8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif ++/* [0x000004b0] */ 0x00000010, 0xe0020827, // mov r0, 16 ++/* [0x000004b8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x000004c0] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 ++/* [0x000004c8] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 ++/* [0x000004d0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 ++/* [0x000004d8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif + // ::mc_filter_uv_b0 +-/* [0x00000538] */ 0x15827d80, 0x100207e7, // mov ra31, unif +-/* [0x00000540] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next +-/* [0x00000548] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num +-/* [0x00000550] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif +-/* [0x00000558] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif +-/* [0x00000560] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 +-/* [0x00000568] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 +-/* [0x00000570] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 +-/* [0x00000578] */ 0x149dc1c0, 0xd00214e7, // and rb_x_next, r0, ~3 +-/* [0x00000580] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 +-/* [0x00000588] */ 0x0c9d3e80, 0x100206a7, // add ra_frame_base_next, rb_x_next, r2 +-/* [0x00000590] */ 0x159d5fc0, 0x10021c67, // mov vw_setup, rb21 +-/* [0x00000598] */ 0x00000010, 0xe00208a7, // mov r2, 16 +-/* [0x000005a0] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x000005a8] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 +-/* [0x000005b0] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 +-/* [0x000005b8] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 +-/* [0x000005c0] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 +-/* [0x000005c8] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 +-/* [0x000005d0] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 +-/* [0x000005d8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 +-/* [0x000005e0] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 +-/* [0x000005e8] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 +-/* [0x000005f0] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x000005f8] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000600] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000608] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000610] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif +-/* [0x00000618] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000620] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000628] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000630] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 +-/* [0x00000638] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000640] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000648] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 +-/* [0x00000650] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-/* [0x00000658] */ 0x00000000, 0xe00208e7, // mov r3, 0 ++/* [0x000004e0] */ 0x15827d80, 0x100207e7, // mov ra31, unif ++/* [0x000004e8] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next ++/* [0x000004f0] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num ++/* [0x000004f8] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif ++/* [0x00000500] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif ++/* [0x00000508] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 ++/* [0x00000510] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 ++/* [0x00000518] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 ++/* [0x00000520] */ 0x149dc1c0, 0xd00214e7, // and rb_x_next, r0, ~3 ++/* [0x00000528] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 ++/* [0x00000530] */ 0x0c9d3e80, 0x100206a7, // add ra_frame_base_next, rb_x_next, r2 ++/* [0x00000538] */ 0x159d5fc0, 0x10021c67, // mov vw_setup, rb21 ++/* [0x00000540] */ 0x00000010, 0xe00208a7, // mov r2, 16 ++/* [0x00000548] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000550] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 ++/* [0x00000558] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 ++/* [0x00000560] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 ++/* [0x00000568] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 ++/* [0x00000570] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 ++/* [0x00000578] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 ++/* [0x00000580] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 ++/* [0x00000588] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 ++/* [0x00000590] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 ++/* [0x00000598] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x000005a0] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000005a8] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000005b0] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000005b8] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif ++/* [0x000005c0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000005c8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000005d0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 ++/* [0x000005d8] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 ++/* [0x000005e0] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x000005e8] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x000005f0] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 ++/* [0x000005f8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x00000600] */ 0x00000000, 0xe00208e7, // mov r3, 0 + // :uvloop_b0 +-/* [0x00000660] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 +-/* [0x00000668] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu0 +-/* [0x00000670] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 +-/* [0x00000678] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch +-/* [0x00000680] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 +-/* [0x00000688] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 +-/* [0x00000690] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 +-/* [0x00000698] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 +-/* [0x000006a0] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x, r2 ; v8subs r1, r1, rb20 +-/* [0x000006a8] */ 0x0c627c80, 0x10020e27, // add t0s, ra_frame_base, r2 +-/* [0x000006b0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-/* [0x000006b8] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 +-/* [0x000006c0] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 +-/* [0x000006c8] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 +-/* [0x000006d0] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 +-/* [0x000006d8] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 +-/* [0x000006e0] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 +-/* [0x000006e8] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 +-/* [0x000006f0] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 +-/* [0x000006f8] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 +-/* [0x00000700] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 +-/* [0x00000708] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b0 +-/* [0x00000710] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 +-/* [0x00000718] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 +-/* [0x00000720] */ 0x159e7000, 0x100203e7, // mov ra15, r0 +-/* [0x00000728] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 +-/* [0x00000730] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 +-/* [0x00000738] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 +-/* [0x00000740] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 +-/* [0x00000748] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait +-/* [0x00000750] */ 0x0d9d27c0, 0x100229e7, // sub.setf -, r3, rb18 +-/* [0x00000758] */ 0xfffffee8, 0xf06809e7, // brr.anyn -, r:uvloop_b0 +-/* [0x00000760] */ 0x0f9c63c0, 0xd0020c27, // asr vpm, r1, 6 +-/* [0x00000768] */ 0x009e7000, 0x100009e7, // nop +-/* [0x00000770] */ 0x009e7000, 0x100009e7, // nop +-/* [0x00000778] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 +-/* [0x00000780] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000788] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000790] */ 0x009e7000, 0x100009e7, // nop ++/* [0x00000608] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 ++/* [0x00000610] */ 0x8e4539bf, 0xb0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu1 ++/* [0x00000618] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 ++/* [0x00000620] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch ++/* [0x00000628] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 ++/* [0x00000630] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 ++/* [0x00000638] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 ++/* [0x00000640] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 ++/* [0x00000648] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x, r2 ; v8subs r1, r1, rb20 ++/* [0x00000650] */ 0x0c627c80, 0x10020f27, // add t1s, ra_frame_base, r2 ++/* [0x00000658] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x00000660] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 ++/* [0x00000668] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 ++/* [0x00000670] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 ++/* [0x00000678] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 ++/* [0x00000680] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 ++/* [0x00000688] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 ++/* [0x00000690] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 ++/* [0x00000698] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 ++/* [0x000006a0] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 ++/* [0x000006a8] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 ++/* [0x000006b0] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b0 ++/* [0x000006b8] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 ++/* [0x000006c0] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 ++/* [0x000006c8] */ 0x159e7000, 0x100203e7, // mov ra15, r0 ++/* [0x000006d0] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 ++/* [0x000006d8] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 ++/* [0x000006e0] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 ++/* [0x000006e8] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 ++/* [0x000006f0] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait ++/* [0x000006f8] */ 0x0d9d27c0, 0x100229e7, // sub.setf -, r3, rb18 ++/* [0x00000700] */ 0xfffffee8, 0xf06809e7, // brr.anyn -, r:uvloop_b0 ++/* [0x00000708] */ 0x0f9c63c0, 0xd0020c27, // asr vpm, r1, 6 ++/* [0x00000710] */ 0x009e7000, 0x100009e7, // nop ++/* [0x00000718] */ 0x009e7000, 0x100009e7, // nop ++/* [0x00000720] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 ++/* [0x00000728] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000730] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000738] */ 0x009e7000, 0x100009e7, // nop + // ::mc_filter_uv_b +-/* [0x00000798] */ 0x15827d80, 0x100207e7, // mov ra31, unif +-/* [0x000007a0] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next +-/* [0x000007a8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num +-/* [0x000007b0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif +-/* [0x000007b8] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif +-/* [0x000007c0] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 +-/* [0x000007c8] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 +-/* [0x000007d0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 +-/* [0x000007d8] */ 0x149dc1c0, 0xd00214e7, // and rb_x_next, r0, ~3 +-/* [0x000007e0] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 +-/* [0x000007e8] */ 0x0c9d3e80, 0x100206a7, // add ra_frame_base_next, rb_x_next, r2 +-/* [0x000007f0] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 +-/* [0x000007f8] */ 0x00000010, 0xe00208a7, // mov r2, 16 +-/* [0x00000800] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000808] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 +-/* [0x00000810] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 +-/* [0x00000818] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 +-/* [0x00000820] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 +-/* [0x00000828] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 +-/* [0x00000830] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 +-/* [0x00000838] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 +-/* [0x00000840] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 +-/* [0x00000848] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 +-/* [0x00000850] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 +-/* [0x00000858] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 +-/* [0x00000860] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 +-/* [0x00000868] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 +-/* [0x00000870] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000878] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000880] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000888] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000890] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif +-/* [0x00000898] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000008a0] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000008a8] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000008b0] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 +-/* [0x000008b8] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x000008c0] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x000008c8] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 +-/* [0x000008d0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-/* [0x000008d8] */ 0x00000000, 0xe00208e7, // mov r3, 0 ++/* [0x00000740] */ 0x15827d80, 0x100207e7, // mov ra31, unif ++/* [0x00000748] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next ++/* [0x00000750] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num ++/* [0x00000758] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif ++/* [0x00000760] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif ++/* [0x00000768] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 ++/* [0x00000770] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 ++/* [0x00000778] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 ++/* [0x00000780] */ 0x149dc1c0, 0xd00214e7, // and rb_x_next, r0, ~3 ++/* [0x00000788] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 ++/* [0x00000790] */ 0x0c9d3e80, 0x100206a7, // add ra_frame_base_next, rb_x_next, r2 ++/* [0x00000798] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 ++/* [0x000007a0] */ 0x00000010, 0xe00208a7, // mov r2, 16 ++/* [0x000007a8] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x000007b0] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 ++/* [0x000007b8] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 ++/* [0x000007c0] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 ++/* [0x000007c8] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 ++/* [0x000007d0] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 ++/* [0x000007d8] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 ++/* [0x000007e0] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 ++/* [0x000007e8] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 ++/* [0x000007f0] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 ++/* [0x000007f8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 ++/* [0x00000800] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 ++/* [0x00000808] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 ++/* [0x00000810] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 ++/* [0x00000818] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000820] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000828] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000830] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000838] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif ++/* [0x00000840] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000848] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000850] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000858] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 ++/* [0x00000860] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000868] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000870] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 ++/* [0x00000878] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x00000880] */ 0x00000000, 0xe00208e7, // mov r3, 0 + // :uvloop_b +-/* [0x000008e0] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 +-/* [0x000008e8] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu0 +-/* [0x000008f0] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 +-/* [0x000008f8] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch +-/* [0x00000900] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 +-/* [0x00000908] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 +-/* [0x00000910] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 +-/* [0x00000918] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 +-/* [0x00000920] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x, r2 ; v8subs r1, r1, rb20 +-/* [0x00000928] */ 0x0c627c80, 0x10020e27, // add t0s, ra_frame_base, r2 +-/* [0x00000930] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-/* [0x00000938] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 +-/* [0x00000940] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 +-/* [0x00000948] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 +-/* [0x00000950] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 +-/* [0x00000958] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 +-/* [0x00000960] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 +-/* [0x00000968] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 +-/* [0x00000970] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 +-/* [0x00000978] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 +-/* [0x00000980] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 +-/* [0x00000988] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b +-/* [0x00000990] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 +-/* [0x00000998] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 +-/* [0x000009a0] */ 0x159e7000, 0x100203e7, // mov ra15, r0 +-/* [0x000009a8] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 +-/* [0x000009b0] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 +-/* [0x000009b8] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 +-/* [0x000009c0] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 +-/* [0x000009c8] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait +-/* [0x000009d0] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 +-/* [0x000009d8] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 +-/* [0x000009e0] */ 0x0cc27380, 0x10020867, // add r1, r1, vpm +-/* [0x000009e8] */ 0x0c7a7380, 0x10020867, // add r1, r1, ra30 +-/* [0x000009f0] */ 0xfffffed0, 0xf06809e7, // brr.anyn -, r:uvloop_b +-/* [0x000009f8] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 +-/* [0x00000a00] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 +-/* [0x00000a08] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 +-/* [0x00000a10] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 +-/* [0x00000a18] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 +-/* [0x00000a20] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif +-/* [0x00000a28] */ 0x00000010, 0xe0020827, // mov r0, 16 +-/* [0x00000a30] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait +-/* [0x00000a38] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 +-/* [0x00000a40] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 +-/* [0x00000a48] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 +-/* [0x00000a50] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif ++/* [0x00000888] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 ++/* [0x00000890] */ 0x8e4539bf, 0xb0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu1 ++/* [0x00000898] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 ++/* [0x000008a0] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch ++/* [0x000008a8] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 ++/* [0x000008b0] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 ++/* [0x000008b8] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 ++/* [0x000008c0] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 ++/* [0x000008c8] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x, r2 ; v8subs r1, r1, rb20 ++/* [0x000008d0] */ 0x0c627c80, 0x10020f27, // add t1s, ra_frame_base, r2 ++/* [0x000008d8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x000008e0] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 ++/* [0x000008e8] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 ++/* [0x000008f0] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 ++/* [0x000008f8] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 ++/* [0x00000900] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 ++/* [0x00000908] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 ++/* [0x00000910] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 ++/* [0x00000918] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 ++/* [0x00000920] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 ++/* [0x00000928] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 ++/* [0x00000930] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b ++/* [0x00000938] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 ++/* [0x00000940] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 ++/* [0x00000948] */ 0x159e7000, 0x100203e7, // mov ra15, r0 ++/* [0x00000950] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 ++/* [0x00000958] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 ++/* [0x00000960] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 ++/* [0x00000968] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 ++/* [0x00000970] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait ++/* [0x00000978] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 ++/* [0x00000980] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 ++/* [0x00000988] */ 0x0cc27380, 0x10020867, // add r1, r1, vpm ++/* [0x00000990] */ 0x0c7a7380, 0x10020867, // add r1, r1, ra30 ++/* [0x00000998] */ 0xfffffed0, 0xf06809e7, // brr.anyn -, r:uvloop_b ++/* [0x000009a0] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 ++/* [0x000009a8] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 ++/* [0x000009b0] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 ++/* [0x000009b8] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 ++/* [0x000009c0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 ++/* [0x000009c8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif ++/* [0x000009d0] */ 0x00000010, 0xe0020827, // mov r0, 16 ++/* [0x000009d8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x000009e0] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 ++/* [0x000009e8] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 ++/* [0x000009f0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 ++/* [0x000009f8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif + // ::mc_exit +-/* [0x00000a58] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait +-/* [0x00000a60] */ 0x00000000, 0xe80009e7, // mov -,srel(0) +-/* [0x00000a68] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00000a70] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00000a78] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00000a80] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00000a88] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend +-/* [0x00000a90] */ 0x009e7000, 0x100009e7, // nop ; nop +-/* [0x00000a98] */ 0x009e7000, 0x100009e7, // nop ; nop ++/* [0x00000a00] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x00000a08] */ 0x00000000, 0xe80009e7, // mov -,srel(0) ++/* [0x00000a10] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00000a18] */ 0x009e7000, 0xb00009e7, // ldtmu1 ++/* [0x00000a20] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00000a28] */ 0x009e7000, 0xb00009e7, // ldtmu1 ++/* [0x00000a30] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend ++/* [0x00000a38] */ 0x009e7000, 0x100009e7, // nop ; nop ++/* [0x00000a40] */ 0x009e7000, 0x100009e7, // nop ; nop + // ::mc_interrupt_exit8 +-/* [0x00000aa0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait +-/* [0x00000aa8] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00000ab0] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00000ab8] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00000ac0] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00000ac8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00000ad0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00000ad8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00000ae0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00000ae8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00000af0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00000af8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00000b00] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend +-/* [0x00000b08] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop +-/* [0x00000b10] */ 0x009e7000, 0x100009e7, // nop ; nop ++/* [0x00000a48] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x00000a50] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00000a58] */ 0x009e7000, 0xb00009e7, // ldtmu1 ++/* [0x00000a60] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00000a68] */ 0x009e7000, 0xb00009e7, // ldtmu1 ++/* [0x00000a70] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00000a78] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00000a80] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00000a88] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00000a90] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00000a98] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00000aa0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00000aa8] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend ++/* [0x00000ab0] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop ++/* [0x00000ab8] */ 0x009e7000, 0x100009e7, // nop ; nop + // ::mc_setup +-/* [0x00000b18] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-/* [0x00000b20] */ 0x15827d80, 0x100207e7, // mov ra31, unif +-/* [0x00000b28] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num +-/* [0x00000b30] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif +-/* [0x00000b38] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif +-/* [0x00000b40] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 +-/* [0x00000b48] */ 0x0c9c13c0, 0xd0020767, // add ra_y, r1, 1 +-/* [0x00000b50] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 +-/* [0x00000b58] */ 0x0c9e7400, 0x100208a7, // add r2, r2, r0 +-/* [0x00000b60] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 +-/* [0x00000b68] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 +-/* [0x00000b70] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch +-/* [0x00000b78] */ 0x8c9e7452, 0x10025e18, // add t0s, r2, r1 ; mov ra_frame_base, r2 +-/* [0x00000b80] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num +-/* [0x00000b88] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif +-/* [0x00000b90] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif +-/* [0x00000b98] */ 0x119c31c0, 0xd00205e7, // shl rx_xshift2_next, r0, 3 +-/* [0x00000ba0] */ 0x0c9c13c0, 0xd0020567, // add ra_y2, r1, 1 +-/* [0x00000ba8] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 +-/* [0x00000bb0] */ 0x0c9e7400, 0x100208a7, // add r2, r2, r0 +-/* [0x00000bb8] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 +-/* [0x00000bc0] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 +-/* [0x00000bc8] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch +-/* [0x00000bd0] */ 0x8c9e7452, 0x10025e19, // add t0s, r2, r1 ; mov ra_frame_base2, r2 +-/* [0x00000bd8] */ 0x0d801dc0, 0xd0021667, // sub rb25,unif,1 +-/* [0x00000be0] */ 0x0d801dc0, 0xd00217a7, // sub rb30,unif,1 +-/* [0x00000be8] */ 0x15827d80, 0x10021427, // mov rb16, unif +-/* [0x00000bf0] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000bf8] */ 0xc0000000, 0xe0020867, // mov r1, vdw_setup_1(0) +-/* [0x00000c00] */ 0x0c9e7200, 0x10021627, // add rb24, r1, r0 +-/* [0x00000c08] */ 0x00000001, 0xe0020527, // mov ra20, 1 +-/* [0x00000c10] */ 0x00000100, 0xe00205a7, // mov ra22, 256 +-/* [0x00000c18] */ 0x00000040, 0xe00207a7, // mov ra30, 64 +-/* [0x00000c20] */ 0xffffff00, 0xe0021527, // mov rb20, 0xffffff00 +-/* [0x00000c28] */ 0x000000ff, 0xe00215a7, // mov rb22, 255 +-/* [0x00000c30] */ 0x00000018, 0xe00215e7, // mov rb23, 24 +-/* [0x00000c38] */ 0x00000000, 0xe0020227, // mov ra8, 0 +-/* [0x00000c40] */ 0x00000000, 0xe0020267, // mov ra9, 0 +-/* [0x00000c48] */ 0x00000000, 0xe00202a7, // mov ra10, 0 +-/* [0x00000c50] */ 0x00000000, 0xe00202e7, // mov ra11, 0 +-/* [0x00000c58] */ 0x00000000, 0xe0020327, // mov ra12, 0 +-/* [0x00000c60] */ 0x00000000, 0xe0020367, // mov ra13, 0 +-/* [0x00000c68] */ 0x00000000, 0xe00203a7, // mov ra14, 0 +-/* [0x00000c70] */ 0x00000000, 0xe00203e7, // mov ra15, 0 +-/* [0x00000c78] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num +-/* [0x00000c80] */ 0x159e7480, 0x10020867, // mov r1, r2 +-/* [0x00000c88] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 +-/* [0x00000c90] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 +-/* [0x00000c98] */ 0x159e7480, 0x10020827, // mov r0, r2 +-/* [0x00000ca0] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 +-/* [0x00000ca8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 +-/* [0x00000cb0] */ 0x80004004, 0xe0020867, // mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) +-/* [0x00000cb8] */ 0x119c51c0, 0xd0020827, // shl r0, r0, 5 +-/* [0x00000cc0] */ 0x0c9e7040, 0x100216e7, // add rb27, r0, r1 +-/* [0x00000cc8] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num +-/* [0x00000cd0] */ 0x159e7480, 0x10020867, // mov r1, r2 +-/* [0x00000cd8] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 +-/* [0x00000ce0] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 +-/* [0x00000ce8] */ 0x159e7480, 0x10020827, // mov r0, r2 +-/* [0x00000cf0] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 +-/* [0x00000cf8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 +-/* [0x00000d00] */ 0x00004800, 0xe0020867, // mov r1, vpm_setup(0, 4, h8p(0, 0)) +-/* [0x00000d08] */ 0x0c9e7040, 0x10021727, // add rb28, r0, r1 +-/* [0x00000d10] */ 0x15827d80, 0x10021327, // mov rb12,unif +-/* [0x00000d18] */ 0x15827d80, 0x10021367, // mov rb13,unif +-/* [0x00000d20] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000d28] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 +-/* [0x00000d30] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 +-/* [0x00000d38] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 +-/* [0x00000d40] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch +-/* [0x00000d48] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_frame_base +-/* [0x00000d50] */ 0x13540dc0, 0xd0020867, // max r1, ra_y2, 0 +-/* [0x00000d58] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 +-/* [0x00000d60] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 ++/* [0x00000ac0] */ 0x00000010, 0xe00208e7, // mov r3, 16 ++/* [0x00000ac8] */ 0x15827d80, 0x10020227, // mov ra8, unif ++/* [0x00000ad0] */ 0x15827d80, 0x10020267, // mov ra9, unif ++/* [0x00000ad8] */ 0x15827d80, 0x100202a7, // mov ra10, unif ++/* [0x00000ae0] */ 0x15827d80, 0x100202e7, // mov ra11, unif ++/* [0x00000ae8] */ 0x15827d80, 0x10020867, // mov r1, unif ++/* [0x00000af0] */ 0x119e72c0, 0x10020827, // shl r0,r1,r3 ++/* [0x00000af8] */ 0x0f9e72c0, 0x10020867, // asr r1,r1,r3 ++/* [0x00000b00] */ 0x0f9e70c0, 0x10020827, // asr r0,r0,r3 ++/* [0x00000b08] */ 0x0d9c13c0, 0xd0021667, // sub rb_frame_width_minus_1,r1,1 ++/* [0x00000b10] */ 0x0d9c11c0, 0xd00217a7, // sub rb_frame_height_minus_1,r0,1 ++/* [0x00000b18] */ 0x15827d80, 0x10021427, // mov rb_pitch, unif ++/* [0x00000b20] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000b28] */ 0xc0000000, 0xe0020867, // mov r1, vdw_setup_1(0) ++/* [0x00000b30] */ 0x0c9e7200, 0x10021627, // add rb24, r1, r0 ++/* [0x00000b38] */ 0x15227d80, 0x10020867, // mov r1, ra8 ++/* [0x00000b40] */ 0x119e72c0, 0x10020827, // shl r0,r1,r3 ++/* [0x00000b48] */ 0x0f9e72c0, 0x10020867, // asr r1,r1,r3 ++/* [0x00000b50] */ 0x0f9e70c0, 0x10020827, // asr r0,r0,r3 ++/* [0x00000b58] */ 0x0c9a7180, 0x10020827, // add r0, r0, elem_num ++/* [0x00000b60] */ 0x139c01c0, 0xd0020827, // max r0, r0, 0 ++/* [0x00000b68] */ 0x922591f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, ra9 ++/* [0x00000b70] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 ++/* [0x00000b78] */ 0x0c9c13c0, 0xd0020767, // add ra_y, r1, 1 ++/* [0x00000b80] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 ++/* [0x00000b88] */ 0x0c9e7400, 0x100208a7, // add r2, r2, r0 ++/* [0x00000b90] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 ++/* [0x00000b98] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 ++/* [0x00000ba0] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch ++/* [0x00000ba8] */ 0x8c9e7452, 0x10025e18, // add t0s, r2, r1 ; mov ra_frame_base, r2 ++/* [0x00000bb0] */ 0x152a7d80, 0x10020867, // mov r1, ra10 ++/* [0x00000bb8] */ 0x119e72c0, 0x10020827, // shl r0,r1,r3 ++/* [0x00000bc0] */ 0x0f9e72c0, 0x10020867, // asr r1,r1,r3 ++/* [0x00000bc8] */ 0x0f9e70c0, 0x10020827, // asr r0,r0,r3 ++/* [0x00000bd0] */ 0x0c9a7180, 0x10020827, // add r0, r0, elem_num ++/* [0x00000bd8] */ 0x139c01c0, 0xd0020827, // max r0, r0, 0 ++/* [0x00000be0] */ 0x922d91f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, ra11 ++/* [0x00000be8] */ 0x119c31c0, 0xd00205e7, // shl rx_xshift2_next, r0, 3 ++/* [0x00000bf0] */ 0x0c9c13c0, 0xd0020567, // add ra_y2, r1, 1 ++/* [0x00000bf8] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 ++/* [0x00000c00] */ 0x0c9e7400, 0x100208a7, // add r2, r2, r0 ++/* [0x00000c08] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 ++/* [0x00000c10] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 ++/* [0x00000c18] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch ++/* [0x00000c20] */ 0x8c9e7452, 0x10025f19, // add t1s, r2, r1 ; mov ra_frame_base2, r2 ++/* [0x00000c28] */ 0x00000001, 0xe0020527, // mov ra20, 1 ++/* [0x00000c30] */ 0x00000100, 0xe00205a7, // mov ra22, 256 ++/* [0x00000c38] */ 0x00000040, 0xe00207a7, // mov ra30, 64 ++/* [0x00000c40] */ 0xffffff00, 0xe0021527, // mov rb20, 0xffffff00 ++/* [0x00000c48] */ 0x000000ff, 0xe00215a7, // mov rb22, 255 ++/* [0x00000c50] */ 0x00000018, 0xe00215e7, // mov rb23, 24 ++/* [0x00000c58] */ 0x00000000, 0xe0020227, // mov ra8, 0 ++/* [0x00000c60] */ 0x00000000, 0xe0020267, // mov ra9, 0 ++/* [0x00000c68] */ 0x00000000, 0xe00202a7, // mov ra10, 0 ++/* [0x00000c70] */ 0x00000000, 0xe00202e7, // mov ra11, 0 ++/* [0x00000c78] */ 0x00000000, 0xe0020327, // mov ra12, 0 ++/* [0x00000c80] */ 0x00000000, 0xe0020367, // mov ra13, 0 ++/* [0x00000c88] */ 0x00000000, 0xe00203a7, // mov ra14, 0 ++/* [0x00000c90] */ 0x00000000, 0xe00203e7, // mov ra15, 0 ++/* [0x00000c98] */ 0x00004000, 0xe00204a7, // mov ra18, 0x4000 ++/* [0x00000ca0] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num ++/* [0x00000ca8] */ 0x159e7480, 0x10020867, // mov r1, r2 ++/* [0x00000cb0] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 ++/* [0x00000cb8] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 ++/* [0x00000cc0] */ 0x159e7480, 0x10020827, // mov r0, r2 ++/* [0x00000cc8] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 ++/* [0x00000cd0] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 ++/* [0x00000cd8] */ 0x00004800, 0xe0020867, // mov r1, vpm_setup(0, 4, h8p(0, 0)) ++/* [0x00000ce0] */ 0x0c9e7040, 0x10021727, // add rb28, r0, r1 ++/* [0x00000ce8] */ 0x80004004, 0xe0020867, // mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) ++/* [0x00000cf0] */ 0x119c51c0, 0xd0020827, // shl r0, r0, 5 ++/* [0x00000cf8] */ 0x0c9e7040, 0x100216e7, // add rb27, r0, r1 ++/* [0x00000d00] */ 0x15827d80, 0x10020867, // mov r1, unif ++/* [0x00000d08] */ 0x919c82ff, 0xd0024822, // shl r0,r1,r3 ; mov r2,8 ++/* [0x00000d10] */ 0x0f9e70c0, 0x10021367, // asr rb13,r0,r3 ++/* [0x00000d18] */ 0x0f9e72c0, 0x10021327, // asr rb12,r1,r3 ++/* [0x00000d20] */ 0x0c9cde80, 0x10021367, // add rb13,rb13,r2 ++/* [0x00000d28] */ 0x119cce80, 0x10021327, // shl rb12, rb12, r2 ++/* [0x00000d30] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 ++/* [0x00000d38] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 ++/* [0x00000d40] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 ++/* [0x00000d48] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch ++/* [0x00000d50] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_frame_base ++/* [0x00000d58] */ 0x13540dc0, 0xd0020867, // max r1, ra_y2, 0 ++/* [0x00000d60] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 + /* [0x00000d68] */ 0x0c541dc0, 0xd0020567, // add ra_y2, ra_y2, 1 + /* [0x00000d70] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch +-/* [0x00000d78] */ 0x0c667380, 0x10020e27, // add t0s, r1, ra_frame_base2 +-// ::mc_filter ++/* [0x00000d78] */ 0x0c667380, 0x10020f27, // add t1s, r1, ra_frame_base2 ++// :per_block_setup + /* [0x00000d80] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] + /* [0x00000d88] */ 0x15827d80, 0x100207e7, // mov ra31, unif + /* [0x00000d90] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next + /* [0x00000d98] */ 0x155e7d80, 0x10021027, // mov rx_xshift2, rx_xshift2_next +-/* [0x00000da0] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num +-/* [0x00000da8] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif +-/* [0x00000db0] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif +-/* [0x00000db8] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 +-/* [0x00000dc0] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 +-/* [0x00000dc8] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 +-/* [0x00000dd0] */ 0x0c9e7400, 0x100206a7, // add ra_frame_base_next, r2, r0 +-/* [0x00000dd8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num +-/* [0x00000de0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0 ; mov r1, unif +-/* [0x00000de8] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif +-/* [0x00000df0] */ 0x119c31c0, 0xd00205e7, // shl rx_xshift2_next, r0, 3 +-/* [0x00000df8] */ 0x0c9c13c0, 0xd0021067, // add ra_y2_next, r1, 1 +-/* [0x00000e00] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 +-/* [0x00000e08] */ 0x0c9e7400, 0x100214e7, // add rx_frame_base2_next, r2, r0 +-/* [0x00000e10] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 +-/* [0x00000e18] */ 0x00000010, 0xe00208a7, // mov r2, 16 +-/* [0x00000e20] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000e28] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 +-/* [0x00000e30] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 +-/* [0x00000e38] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 +-/* [0x00000e40] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 +-/* [0x00000e48] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 +-/* [0x00000e50] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 +-/* [0x00000e58] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 +-/* [0x00000e60] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 +-/* [0x00000e68] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 +-/* [0x00000e70] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000e78] */ 0x15827d80, 0x100009e7, // mov.ifnz -, unif +-/* [0x00000e80] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000e88] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000e90] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000e98] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif +-/* [0x00000ea0] */ 0x15827d80, 0x100009e7, // mov.ifnz -, unif +-/* [0x00000ea8] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000eb0] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000eb8] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000ec0] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif +-/* [0x00000ec8] */ 0x15827d80, 0x100009e7, // mov.ifnz -, unif +-/* [0x00000ed0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000ed8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000ee0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000ee8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif +-/* [0x00000ef0] */ 0x15827d80, 0x100009e7, // mov.ifnz -, unif +-/* [0x00000ef8] */ 0x4f5971c6, 0x100251e0, // asr rb7, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000f00] */ 0x4f5971c6, 0x100251a0, // asr rb6, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00000f08] */ 0x4f5971c6, 0x10025160, // asr rb5, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000da0] */ 0x00000010, 0xe00208e7, // mov r3, 16 ++/* [0x00000da8] */ 0x15827d80, 0x10020867, // mov r1, unif ++/* [0x00000db0] */ 0x119e72c0, 0x10020827, // shl r0,r1,r3 ++/* [0x00000db8] */ 0x0f9e72c0, 0x10020867, // asr r1,r1,r3 ++/* [0x00000dc0] */ 0x0f9e70c0, 0x10020827, // asr r0,r0,r3 ++/* [0x00000dc8] */ 0x0c9a7180, 0x10020827, // add r0, r0, elem_num ++/* [0x00000dd0] */ 0x139c01c0, 0xd0020827, // max r0, r0, 0 ++/* [0x00000dd8] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif ++/* [0x00000de0] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 ++/* [0x00000de8] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 ++/* [0x00000df0] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 ++/* [0x00000df8] */ 0x8c827436, 0x100246a1, // add ra_frame_base_next, r2, r0 ; mov r1, unif ++/* [0x00000e00] */ 0x119e72c0, 0x10020827, // shl r0,r1,r3 ++/* [0x00000e08] */ 0x0f9e72c0, 0x10020867, // asr r1,r1,r3 ++/* [0x00000e10] */ 0x0f9e70c0, 0x10020827, // asr r0,r0,r3 ++/* [0x00000e18] */ 0x0c9a7180, 0x10020827, // add r0, r0, elem_num ++/* [0x00000e20] */ 0x139c01c0, 0xd0020827, // max r0, r0, 0 ++/* [0x00000e28] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif ++/* [0x00000e30] */ 0x119c31c0, 0xd00205e7, // shl rx_xshift2_next, r0, 3 ++/* [0x00000e38] */ 0x159e7240, 0x10021067, // mov ra_y2_next, r1 ++/* [0x00000e40] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 ++/* [0x00000e48] */ 0x0c9e7400, 0x100214e7, // add rx_frame_base2_next, r2, r0 ++/* [0x00000e50] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 ++/* [0x00000e58] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00000e60] */ 0x0e9e70c0, 0x10020867, // shr r1, r0, r3 ++/* [0x00000e68] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 ++/* [0x00000e70] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 ++/* [0x00000e78] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 ++/* [0x00000e80] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 ++/* [0x00000e88] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 ++/* [0x00000e90] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 ++/* [0x00000e98] */ 0x119e70c0, 0x10020827, // shl r0, r0, r3 ++/* [0x00000ea0] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 ++/* [0x00000ea8] */ 0x95801dbf, 0xd0024821, // mov r0, unif ; mov r1,1 ++/* [0x00000eb0] */ 0x4f5971c6, 0x10024260, // asr ra9, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000eb8] */ 0x4f5971c6, 0x10024220, // asr ra8, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000ec0] */ 0x4f5971c6, 0x10044260, // asr.ifz ra9, r0, rb23; mul24 r0, r0, ra22 ++/* [0x00000ec8] */ 0x0f9d71c0, 0x10040227, // asr.ifz ra8, r0, rb23 ++/* [0x00000ed0] */ 0x0d243f80, 0xd0020267, // sub ra9,3,ra9 ++/* [0x00000ed8] */ 0x0d203f80, 0xd0020227, // sub ra8,3,ra8 ++/* [0x00000ee0] */ 0x11243dc0, 0xd0020267, // shl ra9,ra9,3 ++/* [0x00000ee8] */ 0x11203dc0, 0xd0020227, // shl ra8,ra8,3 ++/* [0x00000ef0] */ 0x00ffff00, 0xe0020867, // mov r1,0xffff00 ++/* [0x00000ef8] */ 0x11227380, 0x10020827, // shl r0, r1, ra8 ++/* [0x00000f00] */ 0x0f9d71c0, 0x10020027, // asr ra0, r0, rb23 ++/* [0x00000f08] */ 0x11267380, 0x10020827, // shl r0, r1, ra9 + /* [0x00000f10] */ 0x0f9d71c0, 0x10021127, // asr rb4, r0, rb23 +-/* [0x00000f18] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00000f20] */ 0x15827d80, 0x100009e7, // mov.ifnz -, unif +-/* [0x00000f28] */ 0x0f9e7080, 0x100213e7, // asr rb15, r0, r2 +-/* [0x00000f30] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 +-/* [0x00000f38] */ 0x0f9e7080, 0x100213a7, // asr rb14, r0, r2 +-/* [0x00000f40] */ 0x00000000, 0xe00208e7, // mov r3, 0 ++/* [0x00000f18] */ 0x01040400, 0xe0020867, // mov r1,0x1040400 ++/* [0x00000f20] */ 0x11227380, 0x10020827, // shl r0, r1, ra8 ++/* [0x00000f28] */ 0x0f9d71c0, 0x10020067, // asr ra1, r0, rb23 ++/* [0x00000f30] */ 0x11267380, 0x10020827, // shl r0, r1, ra9 ++/* [0x00000f38] */ 0x0f9d71c0, 0x10021167, // asr rb5, r0, rb23 ++/* [0x00000f40] */ 0xfbf5f600, 0xe0020867, // mov r1,0xfbf5f600 ++/* [0x00000f48] */ 0x11227380, 0x10020827, // shl r0, r1, ra8 ++/* [0x00000f50] */ 0x0f9d71c0, 0x100200a7, // asr ra2, r0, rb23 ++/* [0x00000f58] */ 0x11267380, 0x10020827, // shl r0, r1, ra9 ++/* [0x00000f60] */ 0x0f9d71c0, 0x100211a7, // asr rb6, r0, rb23 ++/* [0x00000f68] */ 0x11283a40, 0xe0020867, // mov r1,0x11283a40 ++/* [0x00000f70] */ 0x11227380, 0x10020827, // shl r0, r1, ra8 ++/* [0x00000f78] */ 0x0f9d71c0, 0x100200e7, // asr ra3, r0, rb23 ++/* [0x00000f80] */ 0x11267380, 0x10020827, // shl r0, r1, ra9 ++/* [0x00000f88] */ 0x0f9d71c0, 0x100211e7, // asr rb7, r0, rb23 ++/* [0x00000f90] */ 0x3a281100, 0xe0020867, // mov r1,0x3a281100 ++/* [0x00000f98] */ 0x11227380, 0x10020827, // shl r0, r1, ra8 ++/* [0x00000fa0] */ 0x0f9d71c0, 0x10020127, // asr ra4, r0, rb23 ++/* [0x00000fa8] */ 0x11267380, 0x10020827, // shl r0, r1, ra9 ++/* [0x00000fb0] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 ++/* [0x00000fb8] */ 0xf6f5fb00, 0xe0020867, // mov r1,0xf6f5fb00 ++/* [0x00000fc0] */ 0x11227380, 0x10020827, // shl r0, r1, ra8 ++/* [0x00000fc8] */ 0x0f9d71c0, 0x10020167, // asr ra5, r0, rb23 ++/* [0x00000fd0] */ 0x11267380, 0x10020827, // shl r0, r1, ra9 ++/* [0x00000fd8] */ 0x0f9d71c0, 0x10021267, // asr rb9, r0, rb23 ++/* [0x00000fe0] */ 0x04040100, 0xe0020867, // mov r1,0x4040100 ++/* [0x00000fe8] */ 0x11227380, 0x10020827, // shl r0, r1, ra8 ++/* [0x00000ff0] */ 0x0f9d71c0, 0x100201a7, // asr ra6, r0, rb23 ++/* [0x00000ff8] */ 0x11267380, 0x10020827, // shl r0, r1, ra9 ++/* [0x00001000] */ 0x0f9d71c0, 0x100212a7, // asr rb10, r0, rb23 ++/* [0x00001008] */ 0xffff0000, 0xe0020867, // mov r1,0xffff0000 ++/* [0x00001010] */ 0x11227380, 0x10020827, // shl r0, r1, ra8 ++/* [0x00001018] */ 0x0f9d71c0, 0x100201e7, // asr ra7, r0, rb23 ++/* [0x00001020] */ 0x11267380, 0x10020827, // shl r0, r1, ra9 ++/* [0x00001028] */ 0x0f9d71c0, 0x100212e7, // asr rb11, r0, rb23 ++/* [0x00001030] */ 0x15827d80, 0x10020827, // mov r0, unif ++/* [0x00001038] */ 0x0f9e70c0, 0x100213e7, // asr rb15, r0, r3 ++/* [0x00001040] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 ++/* [0x00001048] */ 0x119e70c0, 0x10020827, // shl r0, r0, r3 ++/* [0x00001050] */ 0x8f9c00ff, 0xd0024823, // asr r0, r0, r3 ; mov r3, 0 ++/* [0x00001058] */ 0x119c81c0, 0xd00213a7, // shl rb14, r0, 8 ++// ::mc_filter + // :yloop +-/* [0x00000f48] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 +-/* [0x00000f50] */ 0x8e4539bf, 0xa0029819, // shr r0, r4, ra_xshift ; mov.ifz ra_frame_base2, rx_frame_base2_next ; ldtmu0 +-/* [0x00000f58] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 +-/* [0x00000f60] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch +-/* [0x00000f68] */ 0x0e9c09c0, 0x10020867, // shr r1, r4, rx_xshift2 +-/* [0x00000f70] */ 0x159c1fc0, 0x10040567, // mov.ifz ra_y2, ra_y2_next +-/* [0x00000f78] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 +-/* [0x00000f80] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 +-/* [0x00000f88] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 +-/* [0x00000f90] */ 0xec614c87, 0x10024e20, // add t0s, ra_frame_base, r2 ; v8subs r0, r0, rb20 +-/* [0x00000f98] */ 0x13540dc0, 0xd00208a7, // max r2, ra_y2, 0 +-/* [0x00000fa0] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 +-/* [0x00000fa8] */ 0x4c541dd3, 0xd0024562, // add ra_y2, ra_y2, 1 ; mul24 r2, r2, r3 +-/* [0x00000fb0] */ 0xec654c87, 0x10024e20, // add t0s, ra_frame_base2, r2 ; v8subs r0, r0, rb20 +-/* [0x00000fb8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-/* [0x00000fc0] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 +-/* [0x00000fc8] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 +-/* [0x00000fd0] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 +-/* [0x00000fd8] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 +-/* [0x00000fe0] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 +-/* [0x00000fe8] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 +-/* [0x00000ff0] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 +-/* [0x00000ff8] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 +-/* [0x00001000] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 +-/* [0x00001008] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 +-/* [0x00001010] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 +-/* [0x00001018] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 +-/* [0x00001020] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 +-/* [0x00001028] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 +-/* [0x00001030] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 +-/* [0x00001038] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 +-/* [0x00001040] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 +-/* [0x00001048] */ 0x8d3487f6, 0xd00279cc, // sub.setf -, r3, 8 ; mov ra12, ra13 +-/* [0x00001050] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 +-/* [0x00001058] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 +-/* [0x00001060] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 +-/* [0x00001068] */ 0x15367d80, 0x10020327, // mov ra12, ra13 +-/* [0x00001070] */ 0xfffffeb8, 0xf06809e7, // brr.anyn -, r:yloop +-/* [0x00001078] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 +-/* [0x00001080] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 +-/* [0x00001088] */ 0x159e7000, 0x100203e7, // mov ra15, r0 +-/* [0x00001090] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 +-/* [0x00001098] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 +-/* [0x000010a0] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 +-/* [0x000010a8] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 +-/* [0x000010b0] */ 0x4c204237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb4 +-/* [0x000010b8] */ 0x4c245237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb5 +-/* [0x000010c0] */ 0x4c286237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb6 +-/* [0x000010c8] */ 0x4c2c7237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb7 +-/* [0x000010d0] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait +-/* [0x000010d8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 +-/* [0x000010e0] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 +-/* [0x000010e8] */ 0x409ce00f, 0x100049e1, // nop ; mul24 r1, r1, rb14 +-/* [0x000010f0] */ 0x0c9cc3c0, 0x10020867, // add r1, r1, rb12 +-/* [0x000010f8] */ 0x0f9cd3c0, 0x10020867, // asr r1, r1, rb13 +-/* [0x00001100] */ 0xfffffe28, 0xf06809e7, // brr.anyn -, r:yloop +-/* [0x00001108] */ 0x0c9cf3c0, 0x10020867, // add r1, r1, rb15 +-/* [0x00001110] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 +-/* [0x00001118] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 +-/* [0x00001120] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 +-/* [0x00001128] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 +-/* [0x00001130] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 +-/* [0x00001138] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif ++/* [0x00001060] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 ++/* [0x00001068] */ 0x8e4539bf, 0xb0029819, // shr r0, r4, ra_xshift ; mov.ifz ra_frame_base2, rx_frame_base2_next ; ldtmu1 ++/* [0x00001070] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 ++/* [0x00001078] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch ++/* [0x00001080] */ 0x0e9c09c0, 0x10020867, // shr r1, r4, rx_xshift2 ++/* [0x00001088] */ 0x159c1fc0, 0x10040567, // mov.ifz ra_y2, ra_y2_next ++/* [0x00001090] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 ++/* [0x00001098] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 ++/* [0x000010a0] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 ++/* [0x000010a8] */ 0xec614c87, 0x10024e20, // add t0s, ra_frame_base, r2 ; v8subs r0, r0, rb20 ++/* [0x000010b0] */ 0x13540dc0, 0xd00208a7, // max r2, ra_y2, 0 ++/* [0x000010b8] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 ++/* [0x000010c0] */ 0x4c541dd3, 0xd0024562, // add ra_y2, ra_y2, 1 ; mul24 r2, r2, r3 ++/* [0x000010c8] */ 0xec654c8f, 0x10024f21, // add t1s, ra_frame_base2, r2 ; v8subs r1, r1, rb20 ++/* [0x000010d0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x000010d8] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 ++/* [0x000010e0] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 ++/* [0x000010e8] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 ++/* [0x000010f0] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 ++/* [0x000010f8] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 ++/* [0x00001100] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 ++/* [0x00001108] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 ++/* [0x00001110] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 ++/* [0x00001118] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 ++/* [0x00001120] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 ++/* [0x00001128] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 ++/* [0x00001130] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 ++/* [0x00001138] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 ++/* [0x00001140] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 ++/* [0x00001148] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 ++/* [0x00001150] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 ++/* [0x00001158] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 ++/* [0x00001160] */ 0x8d2487f6, 0xd00279c8, // sub.setf -, r3, 8 ; mov ra8, ra9 ++/* [0x00001168] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 ++/* [0x00001170] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 ++/* [0x00001178] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 ++/* [0x00001180] */ 0x15367d80, 0x10020327, // mov ra12, ra13 ++/* [0x00001188] */ 0xfffffeb8, 0xf06809e7, // brr.anyn -, r:yloop ++/* [0x00001190] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 ++/* [0x00001198] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 ++/* [0x000011a0] */ 0x159e7000, 0x100203e7, // mov ra15, r0 ++/* [0x000011a8] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 ++/* [0x000011b0] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 ++/* [0x000011b8] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 ++/* [0x000011c0] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 ++/* [0x000011c8] */ 0x4c204237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb4 ++/* [0x000011d0] */ 0x4c245237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb5 ++/* [0x000011d8] */ 0x4c286237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb6 ++/* [0x000011e0] */ 0x4c2c7237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb7 ++/* [0x000011e8] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait ++/* [0x000011f0] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 ++/* [0x000011f8] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 ++/* [0x00001200] */ 0x409ce00f, 0x100049e1, // nop ; mul24 r1, r1, rb14 ++/* [0x00001208] */ 0x0c9cc3c0, 0x10020867, // add r1, r1, rb12 ++/* [0x00001210] */ 0x0f9cd3c0, 0x10020867, // asr r1, r1, rb13 ++/* [0x00001218] */ 0xfffffe28, 0xf06809e7, // brr.anyn -, r:yloop ++/* [0x00001220] */ 0x0c9cf3c0, 0x10020867, // add r1, r1, rb15 ++/* [0x00001228] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 ++/* [0x00001230] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 ++/* [0x00001238] */ 0xfffffb28, 0xf0f809e7, // brr -, r:per_block_setup ++/* [0x00001240] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 ++/* [0x00001248] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 ++/* [0x00001250] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif + // ::mc_filter_b +-/* [0x00001140] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-/* [0x00001148] */ 0x15827d80, 0x100207e7, // mov ra31, unif +-/* [0x00001150] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next +-/* [0x00001158] */ 0x155e7d80, 0x10021027, // mov rx_xshift2, rx_xshift2_next +-/* [0x00001160] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num +-/* [0x00001168] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif +-/* [0x00001170] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif +-/* [0x00001178] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 +-/* [0x00001180] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 +-/* [0x00001188] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 +-/* [0x00001190] */ 0x0c9e7400, 0x100206a7, // add ra_frame_base_next, r2, r0 +-/* [0x00001198] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num +-/* [0x000011a0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0 ; mov r1, unif +-/* [0x000011a8] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif +-/* [0x000011b0] */ 0x119c31c0, 0xd00205e7, // shl rx_xshift2_next, r0, 3 +-/* [0x000011b8] */ 0x0c9c13c0, 0xd0021067, // add ra_y2_next, r1, 1 +-/* [0x000011c0] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 +-/* [0x000011c8] */ 0x0c9e7400, 0x100214e7, // add rx_frame_base2_next, r2, r0 +-/* [0x000011d0] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 +-/* [0x000011d8] */ 0x00000010, 0xe00208a7, // mov r2, 16 +-/* [0x000011e0] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x000011e8] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 +-/* [0x000011f0] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 +-/* [0x000011f8] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 +-/* [0x00001200] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 +-/* [0x00001208] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 +-/* [0x00001210] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 +-/* [0x00001218] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 +-/* [0x00001220] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 +-/* [0x00001228] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 +-/* [0x00001230] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00001238] */ 0x00000001, 0xe0020867, // mov r1, 1 +-/* [0x00001240] */ 0x15827d80, 0x10060827, // mov.ifnz r0, unif +-/* [0x00001248] */ 0x409f3001, 0xd00049e0, // nop ; mul24 r0, r0 << 13, r1 << 13 +-/* [0x00001250] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00001258] */ 0x409f2001, 0xd00049e0, // nop ; mul24 r0, r0 << 14, r1 << 14 +-/* [0x00001260] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00001268] */ 0x409f1001, 0xd00049e0, // nop ; mul24 r0, r0 << 15, r1 << 15 +-/* [0x00001270] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00001278] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif +-/* [0x00001280] */ 0x15827d80, 0x10060827, // mov.ifnz r0, unif +-/* [0x00001288] */ 0x409f7001, 0xd00049e0, // nop ; mul24 r0, r0 << 9, r1 << 9 +-/* [0x00001290] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00001298] */ 0x409f6001, 0xd00049e0, // nop ; mul24 r0, r0 << 10, r1 << 10 +-/* [0x000012a0] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000012a8] */ 0x409f5001, 0xd00049e0, // nop ; mul24 r0, r0 << 11, r1 << 11 +-/* [0x000012b0] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000012b8] */ 0x409f4001, 0xd00049e0, // nop ; mul24 r0, r0 << 12, r1 << 12 +-/* [0x000012c0] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif +-/* [0x000012c8] */ 0x15827d80, 0x10060827, // mov.ifnz r0, unif +-/* [0x000012d0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000012d8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000012e0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 +-/* [0x000012e8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif +-/* [0x000012f0] */ 0x15827d80, 0x10060827, // mov.ifnz r0, unif +-/* [0x000012f8] */ 0x4f5971c6, 0x100251e0, // asr rb7, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00001300] */ 0x4f5971c6, 0x100251a0, // asr rb6, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00001308] */ 0x4f5971c6, 0x10025160, // asr rb5, r0, rb23; mul24 r0, r0, ra22 +-/* [0x00001310] */ 0x0f9d71c0, 0x10021127, // asr rb4, r0, rb23 +-/* [0x00001318] */ 0x15827d80, 0x10020827, // mov r0, unif +-/* [0x00001320] */ 0x15827d80, 0x10060827, // mov.ifnz r0, unif +-/* [0x00001328] */ 0x0f9e7080, 0x100213e7, // asr rb15, r0, r2 +-/* [0x00001330] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 +-/* [0x00001338] */ 0x0f9e7080, 0x100213a7, // asr rb14, r0, r2 +-/* [0x00001340] */ 0x00000000, 0xe00208e7, // mov r3, 0 + // :yloopb +-/* [0x00001348] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 +-/* [0x00001350] */ 0x8e4539bf, 0xa0029819, // shr r0, r4, ra_xshift ; mov.ifz ra_frame_base2, rx_frame_base2_next ; ldtmu0 +-/* [0x00001358] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 +-/* [0x00001360] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch +-/* [0x00001368] */ 0x0e9c09c0, 0x10020867, // shr r1, r4, rx_xshift2 +-/* [0x00001370] */ 0x159c1fc0, 0x10040567, // mov.ifz ra_y2, ra_y2_next +-/* [0x00001378] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 +-/* [0x00001380] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 +-/* [0x00001388] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 +-/* [0x00001390] */ 0xec614c87, 0x10024e20, // add t0s, ra_frame_base, r2 ; v8subs r0, r0, rb20 +-/* [0x00001398] */ 0x13540dc0, 0xd00208a7, // max r2, ra_y2, 0 +-/* [0x000013a0] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 +-/* [0x000013a8] */ 0x4c541dd3, 0xd0024562, // add ra_y2, ra_y2, 1 ; mul24 r2, r2, r3 +-/* [0x000013b0] */ 0xec654c87, 0x10024e20, // add t0s, ra_frame_base2, r2 ; v8subs r0, r0, rb20 +-/* [0x000013b8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-/* [0x000013c0] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 +-/* [0x000013c8] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 +-/* [0x000013d0] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 +-/* [0x000013d8] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 +-/* [0x000013e0] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 +-/* [0x000013e8] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 +-/* [0x000013f0] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 +-/* [0x000013f8] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 +-/* [0x00001400] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 +-/* [0x00001408] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 +-/* [0x00001410] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 +-/* [0x00001418] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 +-/* [0x00001420] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 +-/* [0x00001428] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 +-/* [0x00001430] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 +-/* [0x00001438] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 +-/* [0x00001440] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 +-/* [0x00001448] */ 0x8d3487f6, 0xd00279cc, // sub.setf -, r3, 8 ; mov ra12, ra13 +-/* [0x00001450] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 +-/* [0x00001458] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 +-/* [0x00001460] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 +-/* [0x00001468] */ 0x15367d80, 0x10020327, // mov ra12, ra13 +-/* [0x00001470] */ 0xfffffeb8, 0xf06809e7, // brr.anyn -, r:yloopb +-/* [0x00001478] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 +-/* [0x00001480] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 +-/* [0x00001488] */ 0x159e7000, 0x100203e7, // mov ra15, r0 +-/* [0x00001490] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 +-/* [0x00001498] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 +-/* [0x000014a0] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 +-/* [0x000014a8] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 +-/* [0x000014b0] */ 0x4c204237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb4 +-/* [0x000014b8] */ 0x4c245237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb5 +-/* [0x000014c0] */ 0x4c286237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb6 +-/* [0x000014c8] */ 0x4c2c7237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb7 +-/* [0x000014d0] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait +-/* [0x000014d8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 +-/* [0x000014e0] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 +-/* [0x000014e8] */ 0x4053800e, 0xd00049e1, // nop ; mul24 r1, r1 << 8, ra20 << 8 +-/* [0x000014f0] */ 0x4c78e38f, 0x10024860, // add r1, r1, ra30 ; mul24 r0, r1, rb14 +-/* [0x000014f8] */ 0x0c9e7200, 0x10020867, // add r1, r1, r0 +-/* [0x00001500] */ 0xfffffe28, 0xf06809e7, // brr.anyn -, r:yloopb +-/* [0x00001508] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 +-/* [0x00001510] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 +-/* [0x00001518] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 +-/* [0x00001520] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 +-/* [0x00001528] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 +-/* [0x00001530] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 +-/* [0x00001538] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif ++/* [0x00001258] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 ++/* [0x00001260] */ 0x8e4539bf, 0xb0029819, // shr r0, r4, ra_xshift ; mov.ifz ra_frame_base2, rx_frame_base2_next ; ldtmu1 ++/* [0x00001268] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 ++/* [0x00001270] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch ++/* [0x00001278] */ 0x0e9c09c0, 0x10020867, // shr r1, r4, rx_xshift2 ++/* [0x00001280] */ 0x159c1fc0, 0x10040567, // mov.ifz ra_y2, ra_y2_next ++/* [0x00001288] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 ++/* [0x00001290] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 ++/* [0x00001298] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 ++/* [0x000012a0] */ 0xec614c87, 0x10024e20, // add t0s, ra_frame_base, r2 ; v8subs r0, r0, rb20 ++/* [0x000012a8] */ 0x13540dc0, 0xd00208a7, // max r2, ra_y2, 0 ++/* [0x000012b0] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 ++/* [0x000012b8] */ 0x4c541dd3, 0xd0024562, // add ra_y2, ra_y2, 1 ; mul24 r2, r2, r3 ++/* [0x000012c0] */ 0xec654c8f, 0x10024f21, // add t1s, ra_frame_base2, r2 ; v8subs r1, r1, rb20 ++/* [0x000012c8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++/* [0x000012d0] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 ++/* [0x000012d8] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 ++/* [0x000012e0] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 ++/* [0x000012e8] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 ++/* [0x000012f0] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 ++/* [0x000012f8] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 ++/* [0x00001300] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 ++/* [0x00001308] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 ++/* [0x00001310] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 ++/* [0x00001318] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 ++/* [0x00001320] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 ++/* [0x00001328] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 ++/* [0x00001330] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 ++/* [0x00001338] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 ++/* [0x00001340] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 ++/* [0x00001348] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 ++/* [0x00001350] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 ++/* [0x00001358] */ 0x8d2487f6, 0xd00279c8, // sub.setf -, r3, 8 ; mov ra8, ra9 ++/* [0x00001360] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 ++/* [0x00001368] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 ++/* [0x00001370] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 ++/* [0x00001378] */ 0x15367d80, 0x10020327, // mov ra12, ra13 ++/* [0x00001380] */ 0xfffffeb8, 0xf06809e7, // brr.anyn -, r:yloopb ++/* [0x00001388] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 ++/* [0x00001390] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 ++/* [0x00001398] */ 0x159e7000, 0x100203e7, // mov ra15, r0 ++/* [0x000013a0] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 ++/* [0x000013a8] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 ++/* [0x000013b0] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 ++/* [0x000013b8] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 ++/* [0x000013c0] */ 0x4c204237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb4 ++/* [0x000013c8] */ 0x4c245237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb5 ++/* [0x000013d0] */ 0x4c286237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb6 ++/* [0x000013d8] */ 0x4c2c7237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb7 ++/* [0x000013e0] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait ++/* [0x000013e8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 ++/* [0x000013f0] */ 0x0f9ce3c0, 0xd0020827, // asr r0, r1, 14 ++/* [0x000013f8] */ 0x0f9c63c0, 0xd0020867, // asr r1, r1, 6 ++/* [0x00001400] */ 0x405b8006, 0xd00049e0, // nop ; mul24 r0, r0 << 8, ra22 << 8 ++/* [0x00001408] */ 0x0c4a7380, 0x10020867, // add r1, r1, ra18 ++/* [0x00001410] */ 0x0c9e7200, 0x10020867, // add r1, r1, r0 ++/* [0x00001418] */ 0xfffffe20, 0xf06809e7, // brr.anyn -, r:yloopb ++/* [0x00001420] */ 0x0f9cf3c0, 0xd0020867, // asr r1, r1, 15 ++/* [0x00001428] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 ++/* [0x00001430] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 ++/* [0x00001438] */ 0xfffff928, 0xf0f809e7, // brr -, r:per_block_setup ++/* [0x00001440] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 ++/* [0x00001448] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 ++/* [0x00001450] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif + // ::mc_interrupt_exit12 +-/* [0x00001540] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait +-/* [0x00001548] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00001550] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00001558] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00001560] */ 0x009e7000, 0xa00009e7, // ldtmu0 +-/* [0x00001568] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00001570] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00001578] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00001580] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00001588] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00001590] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x00001598] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x000015a0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x000015a8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x000015b0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x000015b8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) +-/* [0x000015c0] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend +-/* [0x000015c8] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop +-/* [0x000015d0] */ 0x009e7000, 0x100009e7, // nop ; nop ++/* [0x00001458] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x00001460] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00001468] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00001470] */ 0x009e7000, 0xb00009e7, // ldtmu1 ++/* [0x00001478] */ 0x009e7000, 0xb00009e7, // ldtmu1 ++/* [0x00001480] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00001488] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00001490] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x00001498] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x000014a0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x000014a8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x000014b0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x000014b8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x000014c0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x000014c8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x000014d0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) ++/* [0x000014d8] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend ++/* [0x000014e0] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop ++/* [0x000014e8] */ 0x009e7000, 0x100009e7, // nop ; nop ++// ::mc_exit1 ++/* [0x000014f0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x000014f8] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00001500] */ 0x009e7000, 0xb00009e7, // ldtmu1 ++/* [0x00001508] */ 0x009e7000, 0xa00009e7, // ldtmu0 ++/* [0x00001510] */ 0x009e7000, 0xb00009e7, // ldtmu1 ++/* [0x00001518] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend ++/* [0x00001520] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop ++/* [0x00001528] */ 0x009e7000, 0x100009e7, // nop ; nop + // ::mc_end + }; + #ifdef __HIGHC__ +diff --git a/libavcodec/rpi_shader.h b/libavcodec/rpi_shader.h +index 6e552d9..760bd17 100644 +--- a/libavcodec/rpi_shader.h ++++ b/libavcodec/rpi_shader.h +@@ -4,15 +4,16 @@ + extern unsigned int rpi_shader[]; + + #define mc_setup_uv (rpi_shader + 0) +-#define mc_filter_uv (rpi_shader + 144) +-#define mc_filter_uv_b0 (rpi_shader + 334) +-#define mc_filter_uv_b (rpi_shader + 486) +-#define mc_exit (rpi_shader + 662) +-#define mc_interrupt_exit8 (rpi_shader + 680) +-#define mc_setup (rpi_shader + 710) +-#define mc_filter (rpi_shader + 864) +-#define mc_filter_b (rpi_shader + 1104) +-#define mc_interrupt_exit12 (rpi_shader + 1360) +-#define mc_end (rpi_shader + 1398) ++#define mc_filter_uv (rpi_shader + 130) ++#define mc_filter_uv_b0 (rpi_shader + 312) ++#define mc_filter_uv_b (rpi_shader + 464) ++#define mc_exit (rpi_shader + 640) ++#define mc_interrupt_exit8 (rpi_shader + 658) ++#define mc_setup (rpi_shader + 688) ++#define mc_filter (rpi_shader + 1048) ++#define mc_filter_b (rpi_shader + 1174) ++#define mc_interrupt_exit12 (rpi_shader + 1302) ++#define mc_exit1 (rpi_shader + 1340) ++#define mc_end (rpi_shader + 1356) + + #endif +diff --git a/libavcodec/rpi_shader.qasm b/libavcodec/rpi_shader.qasm +index a0b8e5a..60d1ec2 100644 +--- a/libavcodec/rpi_shader.qasm ++++ b/libavcodec/rpi_shader.qasm +@@ -21,6 +21,7 @@ + # + # ra16 clipped(row start address+elem_num)&~3 + # ra17 per-channel shifts ++# ra18 0x4000 + # ra19 next ra17 + # + # rb16 pitch +@@ -86,7 +87,7 @@ + + + ################################################################################ +-# mc_setup_uv(next_kernel, x, y, ref_u_base, ref_v_base, frame_width, frame_height, pitch, dst_pitch, pad0, pad1, pad2) ++# mc_setup_uv(next_kernel, x, y, ref_u_base, ref_v_base, frame_width, frame_height, pitch, dst_pitch, offset, denom, vpm_id) + ::mc_setup_uv + + # Read starting kernel +@@ -132,36 +133,6 @@ mov ra13, 0 + mov ra14, 0 + mov ra15, 0 + +-# Compute part of VPM to use for DMA output +-mov r3, unif +-shl r2, r3, 1 # Convert QPU numbers to be even (this means we can only use 8 QPUs, but is necessary as we need to save 16bit intermediate results) +-and r2, r2, 15 +-mov r1, r2 +-asr r1, r1, 2 +-shl r1, r1, 6 +-mov r0, r2 +-and r0, r0, 3 +-add r0, r0, r1 +-mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) # height,width added later +-shl r0, r0, 5 +-add rb27, r0, r1 +- +-# Compute part of VPM to save data into +-shl r2, r3, 1 +-and r2, r2, 15 # r2 = bcd0 +-mov r1, r2 # r1 = bcd0 +-asr r1, r1, 2 # r1 = bc +-shl r1, r1, 6 # r1 = bc000000 +-mov r0, r2 # r0 = bcd0 +-and r0, r0, 3 # r0 = d0 +-add r0, r0, r1 # r0 = bc0000d0 +-mov r1, vpm_setup(0, 4, h8p(0, 0)) # 4 is stride - stride acts on ADDR which is Y[5:0],B[1:0] for 8 bit +-add rb28, r0, r1 +-asr r0, r0, 1 # r0 = bc0000d +-# Prepare VPM command for 16bit intermediates +-mov r1, vpm_setup(0, 2, h16p(0, 0)) # 2 is stride - stride acts on ADDR which is Y[5:0],H[0] for 16 bit +-add rb21, r0, r1 +- + # Compute base address for first and second access + mov r0, ra_x # Load x + max r0, r0, 0; mov r1, ra_y # Load y +@@ -175,10 +146,31 @@ min r1, r1, rb_frame_height_minus_1 + # submit texture requests for first line + add r2, r2, r0 ; mul24 r1, r1, rb_pitch + add t0s, r0, r1 ; mov ra_frame_base, r2 +-add t0s, r2, r1 ++add t1s, r2, r1 ++ ++mov r2,8 ++shl rb12,unif, r2 # offset before shift ++add rb13,unif,r2 # offset after shift ++ ++# Compute part of VPM to use for DMA output ++mov r2, unif ++shl r2, r2, 1 # Convert QPU numbers to be even (this means we can only use 8 QPUs, but is necessary as we need to save 16bit intermediate results) ++and r2, r2, 15 ++mov r1, r2 ++asr r1, r1, 2 ++shl r1, r1, 6 ++mov r0, r2 ++and r0, r0, 3 ++add r0, r0, r1 + +-mov rb12,unif # offset before shift +-mov rb13,unif # offset after shift ++mov r1, vpm_setup(0, 4, h8p(0, 0)) # 4 is stride - stride acts on ADDR which is Y[5:0],B[1:0] for 8 bit ++add rb28, r0, r1 # VPM 8bit storage ++asr r2, r0, 1 # r0 = bc0000d ++mov r1, vpm_setup(0, 2, h16p(0, 0)) # 2 is stride - stride acts on ADDR which is Y[5:0],H[0] for 16 bit ++add rb21, r2, r1 # VPM for 16bit intermediates ++mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) # height,width added later ++shl r0, r0, 5 ++add rb27, r0, r1 # DMA out + + # submit texture requests for second line + max r1, ra_y, 0 +@@ -187,7 +179,7 @@ add ra_y, ra_y, 1 + bra -, ra31 + nop ; mul24 r1, r1, rb_pitch + add t0s, r1, ra_x +-add t0s, r1, ra_frame_base ++add t1s, r1, ra_frame_base + + + +@@ -248,17 +240,15 @@ mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] + mov r0, unif # U offset/weight + asr rb15, r0, r2 # Compute offset from MSBs + shl r0, r0, r2 +-asr rb14, r0, r2 # Compute weight from LSBs ++asr r3, r0, r2 # Compute weight from LSBs + mov r0, unif # V offset/weight + asr.ifnz rb15, r0, r2 + shl r0, r0, r2 +-asr.ifnz rb14, r0, r2 ++asr.ifnz r3, r0, r2 ++shl rb14,r3,8 # Scale up weights so we can use mul24 in signed fashion + + # r2 is elem_num + # r3 is loop counter +- +-mov r5rep, -8 +- + # retrieve texture results and pick out bytes + # then submit two more texture requests + +@@ -269,7 +259,7 @@ mov r3, 0 + # then submit two more texture requests + + sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 # loop counter increment +-shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu0 ++shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu1 + mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 + mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch + shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 # v8subs masks out all but bottom byte +@@ -278,7 +268,7 @@ max r2, ra_y, 0 # y + min r2, r2, rb_frame_height_minus_1 + add ra_y, ra_y, 1 ; mul24 r2, r2, r3 + add t0s, ra_x, r2 ; v8subs r1, r1, rb20 +-add t0s, ra_frame_base, r2 ++add t1s, ra_frame_base, r2 + + # generate seven shifted versions + # interleave with scroll of vertical context +@@ -301,11 +291,6 @@ mov ra13, ra14 # Delay slot 1 + mov ra14, ra15 # Delay slot 2 + mov ra15, r0 # Delay slot 3 + +-mov rb12,32 # TODO remove these to make P weighted prediction work properly +-mov rb13,6 +-mov rb14,1 +-mov rb15,0 +- + # apply vertical filter and write to VPM + + nop ; mul24 r1, ra14, rb10 +@@ -412,7 +397,7 @@ mov r3, 0 + # then submit two more texture requests + + sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 # loop counter increment +-shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu0 ++shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu1 + mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 + mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch + shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 # v8subs masks out all but bottom byte +@@ -421,7 +406,7 @@ max r2, ra_y, 0 # y + min r2, r2, rb_frame_height_minus_1 + add ra_y, ra_y, 1 ; mul24 r2, r2, r3 + add t0s, ra_x, r2 ; v8subs r1, r1, rb20 +-add t0s, ra_frame_base, r2 ++add t1s, ra_frame_base, r2 + + # generate seven shifted versions + # interleave with scroll of vertical context +@@ -542,7 +527,7 @@ mov r3, 0 + # then submit two more texture requests + + sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 # loop counter increment +-shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu0 ++shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu1 + mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 + mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch + shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 # v8subs masks out all but bottom byte +@@ -551,7 +536,7 @@ max r2, ra_y, 0 # y + min r2, r2, rb_frame_height_minus_1 + add ra_y, ra_y, 1 ; mul24 r2, r2, r3 + add t0s, ra_x, r2 ; v8subs r1, r1, rb20 +-add t0s, ra_frame_base, r2 ++add t1s, ra_frame_base, r2 + + # generate seven shifted versions + # interleave with scroll of vertical context +@@ -617,9 +602,9 @@ mov -, vw_wait # wait on the VDW + mov -,srel(0) + + ldtmu0 ++ldtmu1 + ldtmu0 +-ldtmu0 +-ldtmu0 ++ldtmu1 + + nop ; nop ; thrend + nop ; nop # delay slot 1 +@@ -630,9 +615,9 @@ nop ; nop # delay slot 2 + mov -, vw_wait # wait on the VDW + + ldtmu0 ++ldtmu1 + ldtmu0 +-ldtmu0 +-ldtmu0 ++ldtmu1 + + mov -,sacq(0) # 1 + mov -,sacq(0) # 2 +@@ -656,200 +641,249 @@ nop ; nop # delay slot 2 + # For P frames we make the second x,y coordinates offset by +8 + + ################################################################################ +-# mc_setup(next_kernel, x, y, ref_y_base, x2, y2, ref_y2_base, frame_width, frame_height, pitch, dst_pitch, offset, shift, pad2) ++# mc_setup(y_x, ref_y_base, y2_x2, ref_y2_base, frame_width_height, pitch, dst_pitch, offset_shift, next_kernel) + ::mc_setup ++ mov r3, 16 + +-# Read starting kernel +-mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-mov ra31, unif +- +-# Compute base address for first and second access +-add r0, unif, elem_num # Load x +-max r0, r0, 0; mov r1, unif # Load y +-min r0, r0, rb_frame_width_minus_1 ; mov r2, unif # Load the frame base +-shl ra_xshift_next, r0, 3 # Compute shifts +-add ra_y, r1, 1 +-and r0, r0, ~3 # r0 gives the clipped and aligned x coordinate +-add r2, r2, r0 # r2 is address for frame0 (not including y offset) +-max r1, r1, 0 +-min r1, r1, rb_frame_height_minus_1 +-nop ; mul24 r1, r1, rb_pitch # r2 contains the addresses (not including y offset) for frame0 +-add t0s, r2, r1 ; mov ra_frame_base, r2 +- +-add r0, unif, elem_num # Load x +-max r0, r0, 0; mov r1, unif # Load y +-min r0, r0, rb_frame_width_minus_1 ; mov r2, unif # Load the frame base +-shl rx_xshift2_next, r0, 3 # Compute shifts +-add ra_y2, r1, 1 +-and r0, r0, ~3 # r0 gives the clipped and aligned x coordinate +-add r2, r2, r0 # r2 is address for frame1 (not including y offset) +-max r1, r1, 0 +-min r1, r1, rb_frame_height_minus_1 +-nop ; mul24 r1, r1, rb_pitch # r2 contains the addresses (not including y offset) for frame0 +-add t0s, r2, r1 ; mov ra_frame_base2, r2 +- ++ # Need to save these because we need to know the frame dimensions before computing texture coordinates ++ mov ra8, unif ++ mov ra9, unif ++ mov ra10, unif ++ mov ra11, unif + + # Read image dimensions +-sub rb25,unif,1 +-sub rb30,unif,1 ++ mov r1, unif # width_height ++ shl r0,r1,r3 ++ asr r1,r1,r3 # width ++ asr r0,r0,r3 # height ++ sub rb_frame_width_minus_1,r1,1 ++ sub rb_frame_height_minus_1,r0,1 + + # get source pitch +-mov rb16, unif ++ mov rb_pitch, unif + + # get destination pitch +-mov r0, unif +-mov r1, vdw_setup_1(0) +-add rb24, r1, r0 ++ mov r0, unif ++ mov r1, vdw_setup_1(0) ++ add rb24, r1, r0 + +-# load constants +- +-mov ra20, 1 +-mov ra22, 256 +-mov ra30, 64 +- +-mov rb20, 0xffffff00 +-mov rb22, 255 +-mov rb23, 24 ++# Compute base address for first and second access ++ mov r1, ra8 # y_x ++ shl r0,r1,r3 # r0 is x<<16 ++ asr r1,r1,r3 # r1 is y ++ asr r0,r0,r3 # r0 is x ++ add r0, r0, elem_num # Load x ++ max r0, r0, 0 ++ min r0, r0, rb_frame_width_minus_1 ; mov r2, ra9 # Load the frame base ++ shl ra_xshift_next, r0, 3 # Compute shifts ++ add ra_y, r1, 1 ++ and r0, r0, ~3 # r0 gives the clipped and aligned x coordinate ++ add r2, r2, r0 # r2 is address for frame0 (not including y offset) ++ max r1, r1, 0 ++ min r1, r1, rb_frame_height_minus_1 ++ nop ; mul24 r1, r1, rb_pitch # r2 contains the addresses (not including y offset) for frame0 ++ add t0s, r2, r1 ; mov ra_frame_base, r2 ++ ++ mov r1, ra10 # y_x ++ shl r0,r1,r3 # r0 is x<<16 ++ asr r1,r1,r3 # r1 is y ++ asr r0,r0,r3 # r0 is x ++ add r0, r0, elem_num # Load x ++ max r0, r0, 0 ++ min r0, r0, rb_frame_width_minus_1 ; mov r2, ra11 # Load the frame base ++ shl rx_xshift2_next, r0, 3 # Compute shifts ++ add ra_y2, r1, 1 ++ and r0, r0, ~3 # r0 gives the clipped and aligned x coordinate ++ add r2, r2, r0 # r2 is address for frame1 (not including y offset) ++ max r1, r1, 0 ++ min r1, r1, rb_frame_height_minus_1 ++ nop ; mul24 r1, r1, rb_pitch # r2 contains the addresses (not including y offset) for frame0 ++ add t1s, r2, r1 ; mov ra_frame_base2, r2 + +-# touch vertical context to keep simulator happy + +-mov ra8, 0 +-mov ra9, 0 +-mov ra10, 0 +-mov ra11, 0 +-mov ra12, 0 +-mov ra13, 0 +-mov ra14, 0 +-mov ra15, 0 ++# load constants + +-# Compute part of VPM to use for DMA output +-mov r2, qpu_num +-mov r1, r2 +-asr r1, r1, 2 +-shl r1, r1, 6 +-mov r0, r2 +-and r0, r0, 3 +-add r0, r0, r1 +-mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) # height,width added later +-shl r0, r0, 5 +-add rb27, r0, r1 ++ mov ra20, 1 ++ mov ra22, 256 ++ mov ra30, 64 + +-# Compute part of VPM to save data into +-mov r2, qpu_num # qpu_num = abcd +-mov r1, r2 +-asr r1, r1, 2 +-shl r1, r1, 6 +-mov r0, r2 +-and r0, r0, 3 +-add r0, r0, r1 +-mov r1, vpm_setup(0, 4, h8p(0, 0)) # 4 is stride - stride acts on ADDR which is Y[5:0],B[1:0] for 8 bit +-add rb28, r0, r1 ++ mov rb20, 0xffffff00 ++ mov rb22, 255 ++ mov rb23, 24 + +-mov rb12,unif # offset before shift +-mov rb13,unif # shift ++# touch vertical context to keep simulator happy + +-# Dump padding words +-mov r0, unif ++ mov ra8, 0 ++ mov ra9, 0 ++ mov ra10, 0 ++ mov ra11, 0 ++ mov ra12, 0 ++ mov ra13, 0 ++ mov ra14, 0 ++ mov ra15, 0 ++ mov ra18, 0x4000 ++ ++# Compute part of VPM to use ++ mov r2, qpu_num ++ mov r1, r2 ++ asr r1, r1, 2 ++ shl r1, r1, 6 ++ mov r0, r2 ++ and r0, r0, 3 ++ add r0, r0, r1 ++ mov r1, vpm_setup(0, 4, h8p(0, 0)) # 4 is stride - stride acts on ADDR which is Y[5:0],B[1:0] for 8 bit ++ add rb28, r0, r1 # VPM for saving data ++ mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) # height,width added later ++ shl r0, r0, 5 ++ add rb27, r0, r1 # Command for dma output ++ ++# Weighted prediction denom ++ ++ mov r1, unif # offset_shift ++ shl r0,r1,r3 ; mov r2,8 ++ asr rb13,r0,r3 # shift ++ asr rb12,r1,r3 # offset ++ add rb13,rb13,r2 # mul24 is unsigned so scale up into high bits ++ shl rb12, rb12, r2 # Account for larger shift + + # submit texture requests for second line +-max r1, ra_y, 0 +-min r1, r1, rb_frame_height_minus_1 +-add ra_y, ra_y, 1 +-nop ; mul24 r1, r1, rb_pitch +-add t0s, r1, ra_frame_base +- +-max r1, ra_y2, 0 +-min r1, r1, rb_frame_height_minus_1 +-bra -, ra31 +-add ra_y2, ra_y2, 1 # Delay 1 +-nop ; mul24 r1, r1, rb_pitch # Delay 2 +-add t0s, r1, ra_frame_base2 # Delay 3 +- +- +-################################################################################ +- +-# mc_filter(next_kernel, x, y, frame_base, x2, y2, frame_base2, height, hcoeffs[0], hcoeffs2[0], hcoeffs[1], hcoeffs2[1], vcoeffs[0], vcoeffs2[0], vcoeffs[1], vcoeffs2[1], offsetweight0, offsetweight1, this_dst) +-# In a P block, only the first half of coefficients contain used information. +-# At this point we have already issued two pairs of texture requests for the current block +-# ra_x, ra_x16_base point to the current coordinates for this block +-::mc_filter +-mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-mov ra31, unif ++ max r1, ra_y, 0 ++ min r1, r1, rb_frame_height_minus_1 ++ add ra_y, ra_y, 1 ++ nop ; mul24 r1, r1, rb_pitch ++ add t0s, r1, ra_frame_base ++ ++ max r1, ra_y2, 0 ++ min r1, r1, rb_frame_height_minus_1 ++ add ra_y2, ra_y2, 1 ++ nop ; mul24 r1, r1, rb_pitch ++ add t1s, r1, ra_frame_base2 ++ ++# FALL THROUGHT TO PER-BLOCK SETUP ++ ++# Start of per-block setup code ++# P and B blocks share the same setup code to save on Icache space ++:per_block_setup ++ mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++ mov ra31, unif + + # per-channel shifts were calculated on the *previous* invocation +- +-mov ra_xshift, ra_xshift_next +-mov rx_xshift2, rx_xshift2_next ++ mov ra_xshift, ra_xshift_next ++ mov rx_xshift2, rx_xshift2_next + + # get base addresses and per-channel shifts for *next* invocation +-add r0, unif, elem_num # Load x +-max r0, r0, 0; mov r1, unif # Load y +-min r0, r0, rb_frame_width_minus_1 ; mov r2, unif # Load the frame base +-shl ra_xshift_next, r0, 3 # Compute shifts +-mov ra_y_next, r1 +-and r0, r0, ~3 # r0 gives the clipped and aligned x coordinate +-add ra_frame_base_next, r2, r0 # r2 is address for frame0 (not including y offset) +- +-add r0, unif, elem_num # Load x +-max r0, r0, 0 ; mov r1, unif # Load y +-min r0, r0, rb_frame_width_minus_1 ; mov r2, unif # Load the frame base +-shl rx_xshift2_next, r0, 3 # Compute shifts +-add ra_y2_next, r1, 1 +-and r0, r0, ~3 # r0 gives the clipped and aligned x coordinate +-add rx_frame_base2_next, r2, r0 # r2 is address for frame1 (not including y offset) +- ++ mov r3, 16 ++ mov r1, unif # y_x ++ shl r0,r1,r3 # r0 is x<<16 ++ asr r1,r1,r3 # r1 is y ++ asr r0,r0,r3 # r0 is x ++ add r0, r0, elem_num # Load x ++ max r0, r0, 0 ++ min r0, r0, rb_frame_width_minus_1 ; mov r2, unif # Load the frame base ++ shl ra_xshift_next, r0, 3 # Compute shifts ++ mov ra_y_next, r1 ++ and r0, r0, ~3 # r0 gives the clipped and aligned x coordinate ++ add ra_frame_base_next, r2, r0 ; mov r1, unif # y2_x2 ++ ++ shl r0,r1,r3 # r0 is x2<<16 ++ asr r1,r1,r3 # r1 is y2 ++ asr r0,r0,r3 # r0 is x2 ++ add r0, r0, elem_num # Load x ++ max r0, r0, 0 ++ min r0, r0, rb_frame_width_minus_1 ; mov r2, unif # Load the frame base ++ shl rx_xshift2_next, r0, 3 # Compute shifts ++ mov ra_y2_next, r1 ++ and r0, r0, ~3 # r0 gives the clipped and aligned x coordinate ++ add rx_frame_base2_next, r2, r0 # r2 is address for frame1 (not including y offset) + + # set up VPM write +-mov vw_setup, rb28 ++ mov vw_setup, rb28 + + # get width,height of block +-mov r2, 16 +-mov r0, unif +-shr r1, r0, r2 # Extract width +-sub rb29, rb24, r1 # Compute vdw_setup1(dst_pitch-width) +-and r0, r0, rb22 # Extract height +-add rb17, r0, 5 +-add rb18, r0, 7 +-shl r0, r0, 7 +-add r0, r0, r1 # Combine width and height of destination area +-shl r0, r0, r2 # Shift into bits 16 upwards of the vdw_setup0 register +-add rb26, r0, rb27 ++ mov r0, unif ++ shr r1, r0, r3 # Extract width ++ sub rb29, rb24, r1 # Compute vdw_setup1(dst_pitch-width) ++ and r0, r0, rb22 # Extract height ++ add rb17, r0, 5 ++ add rb18, r0, 7 ++ shl r0, r0, 7 ++ add r0, r0, r1 # Combine width and height of destination area ++ shl r0, r0, r3 # Shift into bits 16 upwards of the vdw_setup0 register ++ add rb26, r0, rb27 + + # get filter coefficients and discard unused B frame values +-mov r0, unif +-mov.ifnz -, unif # Alternate coefficients are unused for P frames +-asr ra3, r0, rb23; mul24 r0, r0, ra22 # These may need some pre-rotation to be used in B frames correctly +-asr ra2, r0, rb23; mul24 r0, r0, ra22 +-asr ra1, r0, rb23; mul24 r0, r0, ra22 +-asr ra0, r0, rb23; mov r0, unif +-mov.ifnz -, unif +-asr ra7, r0, rb23; mul24 r0, r0, ra22 +-asr ra6, r0, rb23; mul24 r0, r0, ra22 +-asr ra5, r0, rb23; mul24 r0, r0, ra22 +-asr ra4, r0, rb23; mov r0, unif +-mov.ifnz -, unif +-asr rb11, r0, rb23; mul24 r0, r0, ra22 +-asr rb10, r0, rb23; mul24 r0, r0, ra22 +-asr rb9, r0, rb23; mul24 r0, r0, ra22 +-asr rb8, r0, rb23; mov r0, unif +-mov.ifnz -, unif +-asr rb7, r0, rb23; mul24 r0, r0, ra22 +-asr rb6, r0, rb23; mul24 r0, r0, ra22 +-asr rb5, r0, rb23; mul24 r0, r0, ra22 +-asr rb4, r0, rb23 +- +-mov r0, unif # Frame0 offset/weight +-mov.ifnz -, unif # Frame1 offset/weight unused +-asr rb15, r0, r2 # Compute offset from MSBs +-shl r0, r0, r2 +-asr rb14, r0, r2 # Compute weight from LSBs +- +-# r3 is loop counter ++ mov r0, unif ; mov r1,1 # Packed filter offsets, unpack into ra8... (to be used for vertical context later) ++ asr ra9, r0, rb23; mul24 r0, r0, ra22 # my2 ++ asr ra8, r0, rb23; mul24 r0, r0, ra22 # mx2 ++ asr.ifz ra9, r0, rb23; mul24 r0, r0, ra22 # my:my2 ++ asr.ifz ra8, r0, rb23 # mx:mx2 ++ sub ra9,3,ra9 ++ sub ra8,3,ra8 ++ shl ra9,ra9,3 # Scale up by 8 ++ shl ra8,ra8,3 # Scale up by 8 ++# Now if we want aligned we have a mul of 1, so put 0 coefficients at the top ++ mov r1,0xffff00 ++ shl r0, r1, ra8 ++ asr ra0, r0, rb23 ++ shl r0, r1, ra9 ++ asr rb4, r0, rb23 ++ ++ mov r1,0x1040400 ++ shl r0, r1, ra8 ++ asr ra1, r0, rb23 ++ shl r0, r1, ra9 ++ asr rb5, r0, rb23 ++ ++ mov r1,0xfbf5f600 ++ shl r0, r1, ra8 ++ asr ra2, r0, rb23 ++ shl r0, r1, ra9 ++ asr rb6, r0, rb23 ++ ++ mov r1,0x11283a40 ++ shl r0, r1, ra8 ++ asr ra3, r0, rb23 ++ shl r0, r1, ra9 ++ asr rb7, r0, rb23 ++ ++ mov r1,0x3a281100 ++ shl r0, r1, ra8 ++ asr ra4, r0, rb23 ++ shl r0, r1, ra9 ++ asr rb8, r0, rb23 ++ ++ mov r1,0xf6f5fb00 ++ shl r0, r1, ra8 ++ asr ra5, r0, rb23 ++ shl r0, r1, ra9 ++ asr rb9, r0, rb23 ++ ++ mov r1,0x4040100 ++ shl r0, r1, ra8 ++ asr ra6, r0, rb23 ++ shl r0, r1, ra9 ++ asr rb10, r0, rb23 ++ ++ mov r1,0xffff0000 ++ shl r0, r1, ra8 ++ asr ra7, r0, rb23 ++ shl r0, r1, ra9 ++ asr rb11, r0, rb23 ++ ++# Extract weighted prediction information ++ mov r0, unif # offset/weight TODO move up ++ asr rb15, r0, r3 # Compute offset from MSBs ++ bra -, ra31 ++ shl r0, r0, r3 # Delay 1 ++ asr r0, r0, r3 ; mov r3, 0 # Compute weight from LSBs and reset loop counter Delay 2 ++ shl rb14, r0, 8 # Use a larger shift to avoid unsigned multiply problem Delay 3 + +-# retrieve texture results and pick out bytes +-# then submit two more texture requests ++################################################################################ ++# mc_filter(y_x, frame_base, y2_x2, frame_base2, width_height, my2_mx2_my_mx, offsetweight0, this_dst, next_kernel) ++# In a P block, y2_x2 should be y_x+8 ++# At this point we have already issued two pairs of texture requests for the current block + +-mov r3, 0 ++::mc_filter + + :yloop + # retrieve texture results and pick out bytes +@@ -858,91 +892,90 @@ mov r3, 0 + # If we knew there was no clipping then this code would get simpler. + # Perhaps we could add on the pitch and clip using larger values? + +-sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 +-shr r0, r4, ra_xshift ; mov.ifz ra_frame_base2, rx_frame_base2_next ; ldtmu0 +-mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 +-mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch +-shr r1, r4, rx_xshift2 +-mov.ifz ra_y2, ra_y2_next ++ sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 ++ shr r0, r4, ra_xshift ; mov.ifz ra_frame_base2, rx_frame_base2_next ; ldtmu1 ++ mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 ++ mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch ++ shr r1, r4, rx_xshift2 ++ mov.ifz ra_y2, ra_y2_next + +-max r2, ra_y, 0 # y +-min r2, r2, rb_frame_height_minus_1 +-add ra_y, ra_y, 1 ; mul24 r2, r2, r3 +-add t0s, ra_frame_base, r2 ; v8subs r0, r0, rb20 # v8subs masks out all but bottom byte +- +-max r2, ra_y2, 0 # y +-min r2, r2, rb_frame_height_minus_1 +-add ra_y2, ra_y2, 1 ; mul24 r2, r2, r3 +-add t0s, ra_frame_base2, r2 ; v8subs r0, r0, rb20 ++ max r2, ra_y, 0 # y ++ min r2, r2, rb_frame_height_minus_1 ++ add ra_y, ra_y, 1 ; mul24 r2, r2, r3 ++ add t0s, ra_frame_base, r2 ; v8subs r0, r0, rb20 # v8subs masks out all but bottom byte + ++ max r2, ra_y2, 0 # y ++ min r2, r2, rb_frame_height_minus_1 ++ add ra_y2, ra_y2, 1 ; mul24 r2, r2, r3 ++ add t1s, ra_frame_base2, r2 ; v8subs r1, r1, rb20 + + # generate seven shifted versions + # interleave with scroll of vertical context + +-mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++ mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] + + # apply horizontal filter +-nop ; mul24 r2, r0, ra0 +-nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 +-nop ; mul24 r3, ra1 << 1, r0 << 1 +-nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 +-add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 +-nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 +-add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 +-nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 +-add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 +-nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 +-add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 +-nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 +-add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 +-nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 +-add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 +-nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 +-add r0, r2, r3 ; mov r3, rb31 +-sub.setf -, r3, 8 ; mov ra12, ra13 +-mov ra9, ra10 +-mov ra10, ra11 +-mov ra11, ra12 +-mov ra12, ra13 +-brr.anyn -, r:yloop +-mov ra13, ra14 # Delay slot 1 +-mov ra14, ra15 # Delay slot 2 +-mov ra15, r0 # Delay slot 3 ++ nop ; mul24 r2, r0, ra0 ++ nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 ++ nop ; mul24 r3, ra1 << 1, r0 << 1 ++ nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 ++ add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 ++ nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 ++ add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 ++ nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 ++ add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 ++ nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 ++ add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 ++ nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 ++ add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 ++ nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 ++ add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 ++ nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 ++ add r0, r2, r3 ; mov r3, rb31 ++ sub.setf -, r3, 8 ; mov ra8, ra9 ++ mov ra9, ra10 ++ mov ra10, ra11 ++ mov ra11, ra12 ++ mov ra12, ra13 ++ brr.anyn -, r:yloop ++ mov ra13, ra14 # Delay slot 1 ++ mov ra14, ra15 # Delay slot 2 ++ mov ra15, r0 # Delay slot 3 + + # apply vertical filter and write to VPM + +-nop ; mul24 r1, ra14, rb10 +-nop ; mul24 r0, ra13, rb9 +-add r1, r1, r0 ; mul24 r0, ra12, rb8 +-add r1, r1, r0 ; mul24 r0, ra15, rb11 +-add r1, r1, r0 ; mul24 r0, ra8, rb4 +-add r1, r1, r0 ; mul24 r0, ra9, rb5 +-add r1, r1, r0 ; mul24 r0, ra10, rb6 +-add r1, r1, r0 ; mul24 r0, ra11, rb7 +- +-add r1, r1, r0 ; mov -, vw_wait +-sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 +-asr r1, r1, 14 +-nop ; mul24 r1, r1, rb14 +-add r1, r1, rb12 +-asr r1, r1, rb13 +-brr.anyn -, r:yloop +-add r1, r1, rb15 # Delay 1 +-min r1, r1, rb22 # Delay 2 +-max vpm, r1, 0 # Delay 3 ++ nop ; mul24 r1, ra14, rb10 ++ nop ; mul24 r0, ra13, rb9 ++ add r1, r1, r0 ; mul24 r0, ra12, rb8 ++ add r1, r1, r0 ; mul24 r0, ra15, rb11 ++ add r1, r1, r0 ; mul24 r0, ra8, rb4 ++ add r1, r1, r0 ; mul24 r0, ra9, rb5 ++ add r1, r1, r0 ; mul24 r0, ra10, rb6 ++ add r1, r1, r0 ; mul24 r0, ra11, rb7 ++ ++ add r1, r1, r0 ; mov -, vw_wait ++ sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 ++ asr r1, r1, 14 ++ nop ; mul24 r1, r1, rb14 ++ add r1, r1, rb12 ++ asr r1, r1, rb13 ++ brr.anyn -, r:yloop ++ add r1, r1, rb15 # Delay 1 ++ min r1, r1, rb22 # Delay 2 ++ max vpm, r1, 0 # Delay 3 + + # DMA out + +-bra -, ra31 +-mov vw_setup, rb26 # VDW setup 0 Delay 1 +-mov vw_setup, rb29 # Stride Delay 2 +-mov vw_addr, unif # start the VDW Delay 3 ++ brr -, r:per_block_setup ++ mov vw_setup, rb26 # VDW setup 0 Delay 1 ++ mov vw_setup, rb29 # Stride Delay 2 ++ mov vw_addr, unif # start the VDW Delay 3 + + + + ################################################################################ + +-# mc_filter_b(next_kernel, x, y, frame_base, x2, y2, frame_base2, width_height, hcoeffs[0], hcoeffs2[0], hcoeffs[1], hcoeffs2[1], vcoeffs[0], vcoeffs2[0], vcoeffs[1], vcoeffs2[1], offsetweight0, offsetweight1, this_dst) ++# mc_filter_b(y_x, frame_base, y2_x2, frame_base2, width_height, my2_mx2_my_mx, offsetweight0, this_dst, next_kernel) + # In a P block, only the first half of coefficients contain used information. + # At this point we have already issued two pairs of texture requests for the current block + # May be better to just send 16.16 motion vector and figure out the coefficients inside this block (only 4 cases so can compute hcoeffs in around 24 cycles?) +@@ -952,92 +985,6 @@ mov vw_addr, unif # start the VDW Delay 3 + # Or possibly by taking advantage of symmetry? + # From 19->7 32bits per command. + ::mc_filter_b +-mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] +-mov ra31, unif +- +-# per-channel shifts were calculated on the *previous* invocation +- +-mov ra_xshift, ra_xshift_next +-mov rx_xshift2, rx_xshift2_next +- +-# get base addresses and per-channel shifts for *next* invocation +-add r0, unif, elem_num # Load x +-max r0, r0, 0; mov r1, unif # Load y +-min r0, r0, rb_frame_width_minus_1 ; mov r2, unif # Load the frame base +-shl ra_xshift_next, r0, 3 # Compute shifts +-mov ra_y_next, r1 +-and r0, r0, ~3 # r0 gives the clipped and aligned x coordinate +-add ra_frame_base_next, r2, r0 # r2 is address for frame0 (not including y offset) +- +-add r0, unif, elem_num # Load x +-max r0, r0, 0 ; mov r1, unif # Load y +-min r0, r0, rb_frame_width_minus_1 ; mov r2, unif # Load the frame base +-shl rx_xshift2_next, r0, 3 # Compute shifts +-add ra_y2_next, r1, 1 +-and r0, r0, ~3 # r0 gives the clipped and aligned x coordinate +-add rx_frame_base2_next, r2, r0 # r2 is address for frame1 (not including y offset) +- +- +-# set up VPM write +-mov vw_setup, rb28 +- +-# get width,height of block +-mov r2, 16 +-mov r0, unif +-shr r1, r0, r2 # Extract width +-sub rb29, rb24, r1 # Compute vdw_setup1(dst_pitch-width) +-and r0, r0, rb22 # Extract height +-add rb17, r0, 5 +-add rb18, r0, 7 +-shl r0, r0, 7 +-add r0, r0, r1 # Combine width and height of destination area +-shl r0, r0, r2 # Shift into bits 16 upwards of the vdw_setup0 register +-add rb26, r0, rb27 +- +-# get filter coefficients and discard unused B frame values +-mov r0, unif +-mov r1, 1 +-mov.ifnz r0, unif # Alternate coefficients are unused for P frames +-nop ; mul24 r0, r0 << 13, r1 << 13 +-asr ra3, r0, rb23; mul24 r0, r0, ra22 +-nop ; mul24 r0, r0 << 14, r1 << 14 +-asr ra2, r0, rb23; mul24 r0, r0, ra22 +-nop ; mul24 r0, r0 << 15, r1 << 15 # Adjust such that a rotate of 1 will produce the values with first 8 on left, second 8 on right +-asr ra1, r0, rb23; mul24 r0, r0, ra22 +-asr ra0, r0, rb23; mov r0, unif +-mov.ifnz r0, unif +-nop ; mul24 r0, r0 << 9, r1 << 9 +-asr ra7, r0, rb23; mul24 r0, r0, ra22 +-nop ; mul24 r0, r0 << 10, r1 << 10 +-asr ra6, r0, rb23; mul24 r0, r0, ra22 +-nop ; mul24 r0, r0 << 11, r1 << 11 +-asr ra5, r0, rb23; mul24 r0, r0, ra22 +-nop ; mul24 r0, r0 << 12, r1 << 12 +-asr ra4, r0, rb23; mov r0, unif +-mov.ifnz r0, unif +-asr rb11, r0, rb23; mul24 r0, r0, ra22 +-asr rb10, r0, rb23; mul24 r0, r0, ra22 +-asr rb9, r0, rb23; mul24 r0, r0, ra22 +-asr rb8, r0, rb23; mov r0, unif +-mov.ifnz r0, unif +-asr rb7, r0, rb23; mul24 r0, r0, ra22 +-asr rb6, r0, rb23; mul24 r0, r0, ra22 +-asr rb5, r0, rb23; mul24 r0, r0, ra22 +-asr rb4, r0, rb23 +- +-mov r0, unif # Frame0 offset/weight +-mov.ifnz r0, unif # Frame1 offset/weight unused +-asr rb15, r0, r2 # Compute offset from MSBs +-shl r0, r0, r2 +-asr rb14, r0, r2 # Compute weight from LSBs +- +-# r3 is loop counter +- +-# retrieve texture results and pick out bytes +-# then submit two more texture requests +- +-mov r3, 0 +- + :yloopb + # retrieve texture results and pick out bytes + # then submit two more texture requests +@@ -1045,111 +992,123 @@ mov r3, 0 + # If we knew there was no clipping then this code would get simpler. + # Perhaps we could add on the pitch and clip using larger values? + +-sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 +-shr r0, r4, ra_xshift ; mov.ifz ra_frame_base2, rx_frame_base2_next ; ldtmu0 +-mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 +-mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch +-shr r1, r4, rx_xshift2 +-mov.ifz ra_y2, ra_y2_next ++ sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 ++ shr r0, r4, ra_xshift ; mov.ifz ra_frame_base2, rx_frame_base2_next ; ldtmu1 ++ mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 ++ mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch ++ shr r1, r4, rx_xshift2 ++ mov.ifz ra_y2, ra_y2_next + +-max r2, ra_y, 0 # y +-min r2, r2, rb_frame_height_minus_1 +-add ra_y, ra_y, 1 ; mul24 r2, r2, r3 +-add t0s, ra_frame_base, r2 ; v8subs r0, r0, rb20 # v8subs masks out all but bottom byte +- +-max r2, ra_y2, 0 # y +-min r2, r2, rb_frame_height_minus_1 +-add ra_y2, ra_y2, 1 ; mul24 r2, r2, r3 +-add t0s, ra_frame_base2, r2 ; v8subs r0, r0, rb20 ++ max r2, ra_y, 0 # y ++ min r2, r2, rb_frame_height_minus_1 ++ add ra_y, ra_y, 1 ; mul24 r2, r2, r3 ++ add t0s, ra_frame_base, r2 ; v8subs r0, r0, rb20 # v8subs masks out all but bottom byte + ++ max r2, ra_y2, 0 # y ++ min r2, r2, rb_frame_height_minus_1 ++ add ra_y2, ra_y2, 1 ; mul24 r2, r2, r3 ++ add t1s, ra_frame_base2, r2 ; v8subs r1, r1, rb20 + + # generate seven shifted versions + # interleave with scroll of vertical context + +-mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ++ mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] + + # apply horizontal filter +-nop ; mul24 r2, r0, ra0 +-nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 +-nop ; mul24 r3, ra1 << 1, r0 << 1 +-nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 +-add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 +-nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 +-add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 +-nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 +-add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 +-nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 +-add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 +-nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 +-add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 +-nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 +-add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 +-nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 +-add r0, r2, r3 ; mov r3, rb31 +-sub.setf -, r3, 8 ; mov ra12, ra13 +-mov ra9, ra10 +-mov ra10, ra11 +-mov ra11, ra12 +-mov ra12, ra13 +-brr.anyn -, r:yloopb +-mov ra13, ra14 # Delay slot 1 +-mov ra14, ra15 # Delay slot 2 +-mov ra15, r0 # Delay slot 3 +- +-# apply vertical filter and write to VPM +- +-nop ; mul24 r1, ra14, rb10 +-nop ; mul24 r0, ra13, rb9 +-add r1, r1, r0 ; mul24 r0, ra12, rb8 +-add r1, r1, r0 ; mul24 r0, ra15, rb11 +-add r1, r1, r0 ; mul24 r0, ra8, rb4 +-add r1, r1, r0 ; mul24 r0, ra9, rb5 +-add r1, r1, r0 ; mul24 r0, ra10, rb6 +-add r1, r1, r0 ; mul24 r0, ra11, rb7 +- +-add r1, r1, r0 ; mov -, vw_wait +-sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 +-asr r1, r1, 14 +-nop ; mul24 r1, r1 << 8, ra20 << 8 # Rotate to align left and right halves +-add r1, r1, ra30 ; mul24 r0, r1, rb14 +-add r1, r1, r0 +-brr.anyn -, r:yloopb +-asr r1, r1, 7 # Delay 1 +-min r1, r1, rb22 # Delay 2 +-max vpm, r1, 0 # Delay 3 ++ nop ; mul24 r2, r0, ra0 ++ nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 ++ nop ; mul24 r3, ra1 << 1, r0 << 1 ++ nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 ++ add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 ++ nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 ++ add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 ++ nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 ++ add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 ++ nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 ++ add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 ++ nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 ++ add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 ++ nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 ++ add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 ++ nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 ++ add r0, r2, r3 ; mov r3, rb31 ++ sub.setf -, r3, 8 ; mov ra8, ra9 ++ mov ra9, ra10 ++ mov ra10, ra11 ++ mov ra11, ra12 ++ mov ra12, ra13 ++ brr.anyn -, r:yloopb ++ mov ra13, ra14 # Delay slot 1 ++ mov ra14, ra15 # Delay slot 2 ++ mov ra15, r0 # Delay slot 3 ++ ++ # apply vertical filter and write to VPM ++ ++ nop ; mul24 r1, ra14, rb10 ++ nop ; mul24 r0, ra13, rb9 ++ add r1, r1, r0 ; mul24 r0, ra12, rb8 ++ add r1, r1, r0 ; mul24 r0, ra15, rb11 ++ add r1, r1, r0 ; mul24 r0, ra8, rb4 ++ add r1, r1, r0 ; mul24 r0, ra9, rb5 ++ add r1, r1, r0 ; mul24 r0, ra10, rb6 ++ add r1, r1, r0 ; mul24 r0, ra11, rb7 ++ ++ add r1, r1, r0 ; mov -, vw_wait ++ sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 ++ asr r0, r1, 14 ++ asr r1, r1, 6 # Wait state so we can use the rotate instruction ++ nop ; mul24 r0, r0 << 8, ra22 << 8 # Rotate to align left and right halves ++ add r1, r1, ra18 ++ add r1, r1, r0 ++ brr.anyn -, r:yloopb ++ asr r1, r1, 15 # Delay 1 ++ min r1, r1, rb22 # Delay 2 ++ max vpm, r1, 0 # Delay 3 + + # DMA out +-bra -, ra31 +-mov vw_setup, rb26 # VDW setup 0 Delay 1 +-mov vw_setup, rb29 # Stride Delay 2 +-mov vw_addr, unif # start the VDW Delay 3 ++ brr -, r:per_block_setup ++ mov vw_setup, rb26 # VDW setup 0 Delay 1 ++ mov vw_setup, rb29 # Stride Delay 2 ++ mov vw_addr, unif # start the VDW Delay 3 + + ################################################################################ + + # mc_interrupt_exit12() + ::mc_interrupt_exit12 +-mov -, vw_wait # wait on the VDW +- +-ldtmu0 +-ldtmu0 +-ldtmu0 +-ldtmu0 +- +-mov -,sacq(0) # 1 +-mov -,sacq(0) # 2 +-mov -,sacq(0) # 3 +-mov -,sacq(0) # 4 +-mov -,sacq(0) # 5 +-mov -,sacq(0) # 6 +-mov -,sacq(0) # 7 +-mov -,sacq(0) # 8 +-mov -,sacq(0) # 9 +-mov -,sacq(0) # 10 +-mov -,sacq(0) # 11 +- +-nop ; nop ; thrend +-mov interrupt, 1; nop # delay slot 1 +-nop ; nop # delay slot 2 ++ mov -, vw_wait # wait on the VDW ++ ++ ldtmu0 ++ ldtmu0 ++ ldtmu1 ++ ldtmu1 ++ ++ mov -,sacq(0) # 1 ++ mov -,sacq(0) # 2 ++ mov -,sacq(0) # 3 ++ mov -,sacq(0) # 4 ++ mov -,sacq(0) # 5 ++ mov -,sacq(0) # 6 ++ mov -,sacq(0) # 7 ++ mov -,sacq(0) # 8 ++ mov -,sacq(0) # 9 ++ mov -,sacq(0) # 10 ++ mov -,sacq(0) # 11 ++ ++ nop ; nop ; thrend ++ mov interrupt, 1; nop # delay slot 1 ++ nop ; nop # delay slot 2 ++ ++ ++::mc_exit1 ++ mov -, vw_wait # wait on the VDW ++ ++ ldtmu0 ++ ldtmu1 ++ ldtmu0 ++ ldtmu1 ++ nop ; nop ; thrend ++ mov interrupt, 1; nop # delay slot 1 ++ nop ; nop # delay slot 2 + + + ::mc_end +-- +2.5.0 + + +From e5b20751b9a026e127ff0cdd8768b1d37ca5aa27 Mon Sep 17 00:00:00 2001 +From: Peter de Rivaz <peter.derivaz@gmail.com> +Date: Tue, 2 Jun 2015 10:58:25 +0100 +Subject: [PATCH 48/68] Added option to simulate QPUs + +--- + libavcodec/hevc.c | 288 +++++++++++++++++++++++++++++++++++++++++++-- + libavcodec/rpi_qpu.c | 24 ++-- + libavcodec/rpi_shader.qasm | 6 +- + 3 files changed, 295 insertions(+), 23 deletions(-) + +diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c +index 11b9e60..9be5276 100644 +--- a/libavcodec/hevc.c ++++ b/libavcodec/hevc.c +@@ -56,6 +56,8 @@ + // Define RPI_CACHE_UNIF_MVS to write motion vector uniform stream to cached memory + // RPI_CACHE_UNIF_MVS doesn't seem to make much difference, so left undefined. + ++ // Define RPI_SIMULATE_QPUS for debugging to run QPU code on the ARMs ++ //#define RPI_SIMULATE_QPUS + + #endif + +@@ -124,7 +126,6 @@ static void pic_arrays_free(HEVCContext *s) + + #ifdef EARLY_MALLOC + #else +- printf("pic_arrays_free\n"); + if (s->coeffs_buf_arm[0]) { + gpu_free(&s->coeffs_buf_default); + s->coeffs_buf_arm[0] = 0; +@@ -174,11 +175,9 @@ static int pic_arrays_init(HEVCContext *s, const HEVCSPS *sps) + #ifdef RPI + #ifdef EARLY_MALLOC + #else +- assert(sps); ++ av_assert0(sps); + int coeffs_in_ctb = (1 << sps->log2_ctb_size) * (1 << sps->log2_ctb_size); + int coefs_per_row = sps->ctb_width * coeffs_in_ctb * 3; // Allow space for chroma +- printf("pic_arrays_init\n"); +- printf("Allocated %d\n",coefs_per_row); + gpu_malloc_cached(sizeof(int16_t) * coefs_per_row, &s->coeffs_buf_default); + s->coeffs_buf_arm[0] = (int16_t*) s->coeffs_buf_default.arm; + if (!s->coeffs_buf_arm[0]) +@@ -2977,6 +2976,274 @@ static void rpi_inter_clear(HEVCContext *s) + #endif + } + ++ ++#ifdef RPI_SIMULATE_QPUS ++ ++static int32_t clipx(int x,int FRAME_WIDTH) ++{ ++ if (x<=0) return 0; ++ if (x>=FRAME_WIDTH) return FRAME_WIDTH-1; ++ return x; ++} ++ ++static int32_t clipy(int y,int FRAME_HEIGHT) ++{ ++ if (y<=0) return 0; ++ if (y>=FRAME_HEIGHT) return FRAME_HEIGHT-1; ++ return y; ++} ++ ++/*static int32_t filter8(uint8_t *data, int x0, int y0, int pitch, int mx, int my,int round,int denom,int weight,int offset) ++{ ++ int32_t vsum = 0; ++ int x, y; ++ ++ for (y = 0; y < 8; y++) { ++ int32_t hsum = 0; ++ ++ for (x = 0; x < 8; x++) ++ hsum += lumaFilter[mx][x]*data[clipx(x + x0) + clipy(y + y0) * pitch]; ++ ++ vsum += lumaFilter[my][y]*hsum; ++ } ++ vsum >>= 6; ++ vsum = (((vsum*weight)+round)>>denom)+offset; ++ ++ return av_clip_uint8( vsum ); ++}*/ ++ ++static int32_t filter8_chroma(uint8_t *data, int x0, int y0, int pitch, int hcoeffs, int vcoeffs,int offset_weight,int offset_before,int denom,int pic_width, int pic_height) ++{ ++ int32_t vsum = 0; ++ int x, y; ++ int chromaFilterH[4]; ++ int chromaFilterV[4]; ++ int i; ++ int offset_after = offset_weight>>16; ++ int weight = (offset_weight<<16)>>16; ++ for(i=0;i<4;i++) { ++ chromaFilterH[i] = ((hcoeffs>>(8*i))<<24)>>24; ++ chromaFilterV[i] = ((vcoeffs>>(8*i))<<24)>>24; ++ } ++ ++ for (y = 0; y < 4; y++) { ++ int32_t hsum = 0; ++ ++ for (x = 0; x < 4; x++) ++ hsum += chromaFilterH[x]*data[clipx(x + x0,pic_width) + clipy(y + y0,pic_height) * pitch]; ++ ++ vsum += chromaFilterV[y]*hsum; ++ } ++ vsum >>= 6; ++ vsum = (((vsum*weight)+offset_before)>>denom)+offset_after; ++ ++ return vsum; ++} ++ ++int lumaFilter[4][8]={ {0,0,0,64,0,0,0,0},{-1,4,-10,58,17,-5,1,0},{-1,4,-11,40,40,-11,4,-1},{0,1,-5,17,58,-10,4,-1} }; ++ ++static int32_t filter8_luma(uint8_t *data, int x0, int y0, int pitch, int my_mx,int offset_weight,int offset_before,int denom,int pic_width, int pic_height) ++{ ++ int32_t vsum = 0; ++ int x, y; ++ int i; ++ int offset_after = offset_weight>>16; ++ int weight = (offset_weight<<16)>>16; ++ ++ for (y = 0; y < 8; y++) { ++ int32_t hsum = 0; ++ ++ for (x = 0; x < 8; x++) ++ hsum += lumaFilter[my_mx&3][x]*data[clipx(x + x0,pic_width) + clipy(y + y0,pic_height) * pitch]; ++ ++ vsum += lumaFilter[(my_mx>>8)&3][y]*hsum; ++ } ++ vsum >>= 6; ++ vsum = (((vsum*weight)+offset_before)>>denom)+offset_after; ++ ++ return vsum; ++} ++ ++static uint8_t *test_frame(HEVCContext *s,uint32_t p, AVFrame *frame, int cIdx) ++{ ++ //int pic_width = s->ps.sps->width >> s->ps.sps->hshift[cIdx]; ++ int pic_height = s->ps.sps->height >> s->ps.sps->vshift[cIdx]; ++ int pitch = frame->linesize[cIdx]; ++ uint32_t base = get_vc_address(frame->buf[cIdx]); ++ if (p>=base && p<base+pitch*pic_height) { ++ return frame->data[cIdx] + (p-base); ++ } ++ return NULL; ++} ++ ++static uint8_t *compute_arm_addr(HEVCContext *s,uint32_t p, int cIdx) ++{ ++ SliceHeader *sh = &s->sh; ++ uint8_t *arm = test_frame(s,p,s->frame,cIdx); ++ int i; ++ if (arm) return arm; ++ if (sh->slice_type == P_SLICE || sh->slice_type == B_SLICE) ++ { ++ for(i=0;i<sh->nb_refs[L0];i++) { ++ arm = test_frame(s,p,s->ref->refPicList[0].ref[i]->frame,cIdx); ++ if (arm) return arm; ++ } ++ } ++ if (sh->slice_type == B_SLICE) { ++ for(i=0;i<sh->nb_refs[L1];i++) { ++ arm = test_frame(s,p,s->ref->refPicList[1].ref[i]->frame,cIdx); ++ if (arm) return arm; ++ } ++ } ++ printf("Frame 0x%x not found! Exit=%x\n",p,qpu_get_fn(QPU_MC_EXIT)); ++ exit(-1); ++ return NULL; ++} ++ ++static void rpi_simulate_inter_chroma(HEVCContext *s,uint32_t *p) ++{ ++ uint32_t next_kernel; ++ uint32_t x0; ++ uint32_t y0; ++ uint8_t *ref_u_base; ++ uint8_t *ref_v_base; ++ uint32_t frame_width = p[5]; ++ uint32_t frame_height = p[6]; ++ uint32_t pitch = p[7]; ++ uint32_t dst_pitch = p[8]; ++ int32_t offset_before = p[9]; ++ int32_t denom = p[10]; ++ uint32_t vpm_id = p[11]; ++ uint32_t tmp_u_dst[256]; ++ uint32_t tmp_v_dst[256]; ++ while(1) { ++ p += 12; ++ next_kernel = p[0-12]; ++ x0 = p[1-12]; ++ y0 = p[2-12]; ++ if (next_kernel==s->mc_filter_uv || next_kernel==s->mc_filter_uv_b0 || next_kernel==s->mc_filter_uv_b) { ++ int x,y; ++ uint32_t width_height = p[5]; ++ uint32_t hcoeffs = p[6]; ++ uint32_t vcoeffs = p[7]; ++ uint32_t offset_weight_u = p[8]; ++ uint32_t offset_weight_v = p[9]; ++ uint8_t *this_u_dst; ++ uint8_t *this_v_dst; ++ uint32_t width = width_height >> 16; ++ uint32_t height = (width_height << 16) >> 16; ++ ref_u_base = compute_arm_addr(s,p[3-12],1); ++ ref_v_base = compute_arm_addr(s,p[4-12],2); ++ if (next_kernel!=s->mc_filter_uv_b0) ++ { ++ this_u_dst = compute_arm_addr(s,p[10],1); ++ this_v_dst = compute_arm_addr(s,p[11],2); ++ } ++ for (y=0; y<height; ++y) { ++ for (x=0; x<width; ++x) { ++ if (next_kernel==s->mc_filter_uv) { ++ int32_t refa = filter8_chroma(ref_u_base,x+x0, y+y0, pitch, hcoeffs, vcoeffs, offset_weight_u,offset_before,denom,frame_width,frame_height); ++ int32_t refb = filter8_chroma(ref_v_base,x+x0, y+y0, pitch, hcoeffs, vcoeffs, offset_weight_v,offset_before,denom,frame_width,frame_height); ++ this_u_dst[x+y*dst_pitch] = av_clip_uint8(refa); ++ this_v_dst[x+y*dst_pitch] = av_clip_uint8(refb); ++ } else if (next_kernel==s->mc_filter_uv_b0) { ++ int32_t refa = filter8_chroma(ref_u_base, x+x0, y+y0, pitch, hcoeffs, vcoeffs, 1,0,0,frame_width,frame_height); ++ int32_t refb = filter8_chroma(ref_v_base, x+x0, y+y0, pitch, hcoeffs, vcoeffs, 1,0,0,frame_width,frame_height); ++ tmp_u_dst[x+y*16] = refa; ++ tmp_v_dst[x+y*16] = refb; ++ } else { ++ int32_t refa = filter8_chroma(ref_u_base, x+x0, y+y0, pitch, hcoeffs, vcoeffs, 1, 64 + tmp_u_dst[x+y*16], 7, frame_width, frame_height); ++ int32_t refb = filter8_chroma(ref_v_base, x+x0, y+y0, pitch, hcoeffs, vcoeffs, 1, 64 + tmp_v_dst[x+y*16], 7, frame_width, frame_height); ++ this_u_dst[x+y*dst_pitch] = av_clip_uint8(refa); ++ this_v_dst[x+y*dst_pitch] = av_clip_uint8(refb); ++ } ++ } ++ } ++ } else { ++ av_assert0(next_kernel==qpu_get_fn(QPU_MC_INTERRUPT_EXIT8) || next_kernel==qpu_get_fn(QPU_MC_EXIT) ); ++ break; ++ } ++ } ++} ++ ++// mc_setup(y_x, ref_y_base, y2_x2, ref_y2_base, frame_width_height, pitch, dst_pitch, offset_shift, next_kernel) ++static void rpi_simulate_inter_luma(HEVCContext *s,uint32_t *p) ++{ ++ uint32_t next_kernel; ++ int y_x,y2_x2; ++ uint32_t x0; ++ uint32_t y0; ++ uint32_t x2; ++ uint32_t y2; ++ uint8_t *ref_y_base; ++ uint8_t *ref_y2_base; ++ uint32_t frame_width_height = p[4]; ++ uint32_t frame_width = frame_width_height>>16; ++ uint32_t frame_height = (frame_width_height<<16)>>16; ++ uint32_t pitch = p[5]; ++ uint32_t dst_pitch = p[6]; ++ int offset_shift = p[7]; ++ int32_t offset_before = offset_shift>>16; ++ int32_t denom = (offset_shift<<16)>>16; ++ while(1) { ++ p += 9; ++ next_kernel = p[8-9]; ++ y_x = p[0-9]; ++ x0 = (y_x<<16)>>16; ++ y0 = y_x>>16; ++ y2_x2 = p[2-9]; ++ x2 = (y2_x2<<16)>>16; ++ y2 = y2_x2>>16; ++ ++ if (next_kernel==s->mc_filter || next_kernel==s->mc_filter_b) { ++ // y_x, frame_base, y2_x2, frame_base2, width_height, my2_mx2_my_mx, offsetweight0, this_dst, next_kernel) ++ int x,y; ++ uint32_t width_height = p[4]; ++ uint32_t my2_mx2_my_mx = p[5]; ++ uint32_t offset_weight = p[6]; ++ uint8_t *this_dst = compute_arm_addr(s,p[7],0); ++ uint32_t width = width_height >> 16; ++ uint32_t height = (width_height << 16) >> 16; ++ ref_y_base = compute_arm_addr(s,p[1-9],0); ++ ref_y2_base = compute_arm_addr(s,p[3-9],0); ++ for (y=0; y<height; ++y) { ++ for (x=0; x<width; ++x) { ++ if (next_kernel==s->mc_filter) { ++ int32_t refa = filter8_luma(ref_y_base,x+x0, y+y0, pitch, my2_mx2_my_mx, offset_weight,offset_before,denom,frame_width,frame_height); ++ this_dst[x+y*dst_pitch] = av_clip_uint8(refa); ++ } ++ else { ++ int32_t refa = filter8_luma(ref_y_base, x+x0, y+y0, pitch, my2_mx2_my_mx, 1, 0, 0, frame_width, frame_height); ++ int32_t refb = filter8_luma(ref_y2_base, x+x2, y+y2, pitch, my2_mx2_my_mx>>16, 1, 64 + refa, 7, frame_width, frame_height); ++ this_dst[x+y*dst_pitch] = av_clip_uint8(refb); ++ } ++ } ++ } ++ } else { ++ av_assert0(next_kernel==qpu_get_fn(QPU_MC_INTERRUPT_EXIT12) || next_kernel==qpu_get_fn(QPU_MC_EXIT) ); ++ break; ++ } ++ } ++} ++ ++static void rpi_simulate_inter_qpu(HEVCContext *s) ++{ ++ // First run the transform as normal ++ int i; ++ rpi_execute_transform(s); ++ for(i=0;i<8;i++) ++ { ++ rpi_simulate_inter_chroma(s,s->mvs_base[i]); ++ } ++ for(i=0;i<12;i++) ++ { ++ rpi_simulate_inter_luma(s,s->y_mvs_base[i]); ++ } ++} ++ ++#endif ++ ++ + static void rpi_execute_inter_qpu(HEVCContext *s) + { + int k; +@@ -2995,7 +3262,7 @@ static void rpi_execute_inter_qpu(HEVCContext *s) + s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS] = qpu_get_fn(QPU_MC_EXIT); // Add exit command + s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS+3] = qpu_get_fn(QPU_MC_SETUP_UV); // A dummy texture location (maps to our code) - this is needed as the texture requests are pipelined + s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS+4] = qpu_get_fn(QPU_MC_SETUP_UV); // Also need a dummy for V +- assert(s->u_mvs[k] - s->mvs_base[k] < UV_COMMANDS_PER_QPU); ++ av_assert0(s->u_mvs[k] - s->mvs_base[k] < UV_COMMANDS_PER_QPU); + } + + s->u_mvs[8-1][-RPI_CHROMA_COMMAND_WORDS] = qpu_get_fn(QPU_MC_INTERRUPT_EXIT8); // This QPU will signal interrupt when all others are done and have acquired a semaphore +@@ -3005,11 +3272,16 @@ static void rpi_execute_inter_qpu(HEVCContext *s) + s->y_mvs[k][-RPI_LUMA_COMMAND_WORDS+1] = qpu_get_fn(QPU_MC_SETUP_UV); // A dummy texture location (maps to our code) - this is needed as the texture requests are pipelined + s->y_mvs[k][-RPI_LUMA_COMMAND_WORDS+3] = qpu_get_fn(QPU_MC_SETUP_UV); // Also need a dummy for second request + s->y_mvs[k][-RPI_LUMA_COMMAND_WORDS+8] = qpu_get_fn(QPU_MC_EXIT); // Add exit command +- assert(s->y_mvs[k] - s->y_mvs_base[k] < Y_COMMANDS_PER_QPU); ++ av_assert0(s->y_mvs[k] - s->y_mvs_base[k] < Y_COMMANDS_PER_QPU); + } + s->y_mvs[12-1][-RPI_LUMA_COMMAND_WORDS+8] = qpu_get_fn(QPU_MC_INTERRUPT_EXIT12); // This QPU will signal interrupt when all others are done and have acquired a semaphore + #endif + ++#ifdef RPI_SIMULATE_QPUS ++ rpi_simulate_inter_qpu(s); ++ s->vpu_id = -1; ++ return; ++#endif + + #ifdef RPI_MULTI_MAILBOX + #ifdef RPI_CACHE_UNIF_MVS +@@ -3090,7 +3362,7 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) + && s->ps.pps->num_tile_rows <= 1 && s->ps.pps->num_tile_columns <= 1; + #endif + +- /*if (!s->enable_rpi) { ++ if (!s->enable_rpi) { + if (s->ps.pps->cross_component_prediction_enabled_flag) + printf("Cross component\n"); + if (s->ps.pps->num_tile_rows > 1 || s->ps.pps->num_tile_columns > 1) +@@ -3099,7 +3371,7 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) + printf("Weighted P slice\n"); + if (s->ps.pps->weighted_bipred_flag && s->sh.slice_type == B_SLICE) + printf("Weighted B slice\n"); +- }*/ ++ } + + #endif + +diff --git a/libavcodec/rpi_qpu.c b/libavcodec/rpi_qpu.c +index e12304b..4480f72 100644 +--- a/libavcodec/rpi_qpu.c ++++ b/libavcodec/rpi_qpu.c +@@ -13,7 +13,7 @@ + #include <stdlib.h> + #include <string.h> + #include <stddef.h> +-#include <assert.h> ++#include "libavutil/avassert.h" + + #include "config.h" + +@@ -160,13 +160,13 @@ static int gpu_init(volatile struct GPU **gpu) { + // Now copy over the QPU code into GPU memory + { + int num_bytes = qpu_get_fn(QPU_MC_END) - qpu_get_fn(QPU_MC_SETUP_UV); +- assert(num_bytes<=QPU_CODE_SIZE*sizeof(unsigned int)); ++ av_assert0(num_bytes<=QPU_CODE_SIZE*sizeof(unsigned int)); + memcpy((void*)ptr->qpu_code, rpi_shader, num_bytes); + } + // And the VPU code + { + int num_bytes = sizeof(rpi_hevc_transform); +- assert(num_bytes<=VPU_CODE_SIZE*sizeof(unsigned int)); ++ av_assert0(num_bytes<=VPU_CODE_SIZE*sizeof(unsigned int)); + memcpy((void*)ptr->vpu_code, rpi_hevc_transform, num_bytes); + } + // And the transform coefficients +@@ -216,13 +216,13 @@ static void gpu_unlock(void) { + static int gpu_malloc_uncached_internal(int numbytes, GPU_MEM_PTR_T *p, int mb) { + p->numbytes = numbytes; + p->vcsm_handle = vcsm_malloc_cache(numbytes, VCSM_CACHE_TYPE_NONE, (char *)"Video Frame" ); +- assert(p->vcsm_handle); ++ av_assert0(p->vcsm_handle); + p->vc_handle = vcsm_vc_hdl_from_hdl(p->vcsm_handle); +- assert(p->vc_handle); ++ av_assert0(p->vc_handle); + p->arm = vcsm_lock(p->vcsm_handle); +- assert(p->arm); ++ av_assert0(p->arm); + p->vc = mem_lock(mb, p->vc_handle); +- assert(p->vc); ++ av_assert0(p->vc); + return 0; + } + +@@ -243,7 +243,7 @@ int gpu_malloc_uncached(int numbytes, GPU_MEM_PTR_T *p) + + int gpu_get_mailbox(void) + { +- assert(gpu); ++ av_assert0(gpu); + return gpu->mb; + } + +@@ -297,13 +297,13 @@ static int gpu_malloc_cached_internal(int numbytes, GPU_MEM_PTR_T *p) { + //p->vcsm_handle = vcsm_malloc_cache(numbytes, VCSM_CACHE_TYPE_VC, (char *)"Video Frame" ); + //p->vcsm_handle = vcsm_malloc_cache(numbytes, VCSM_CACHE_TYPE_NONE, (char *)"Video Frame" ); + //p->vcsm_handle = vcsm_malloc_cache(numbytes, VCSM_CACHE_TYPE_HOST_AND_VC, (char *)"Video Frame" ); +- assert(p->vcsm_handle); ++ av_assert0(p->vcsm_handle); + p->vc_handle = vcsm_vc_hdl_from_hdl(p->vcsm_handle); +- assert(p->vc_handle); ++ av_assert0(p->vc_handle); + p->arm = vcsm_lock(p->vcsm_handle); +- assert(p->arm); ++ av_assert0(p->arm); + p->vc = mem_lock(gpu->mb, p->vc_handle); +- assert(p->vc); ++ av_assert0(p->vc); + return 0; + } + +diff --git a/libavcodec/rpi_shader.qasm b/libavcodec/rpi_shader.qasm +index 60d1ec2..0686249 100644 +--- a/libavcodec/rpi_shader.qasm ++++ b/libavcodec/rpi_shader.qasm +@@ -149,8 +149,8 @@ add t0s, r0, r1 ; mov ra_frame_base, r2 + add t1s, r2, r1 + + mov r2,8 +-shl rb12,unif, r2 # offset before shift +-add rb13,unif,r2 # offset after shift ++shl rb12,unif,r2 # offset before shift ++add rb13,unif,r2 # denominator + + # Compute part of VPM to use for DMA output + mov r2, unif +@@ -185,7 +185,7 @@ add t1s, r1, ra_frame_base + + ################################################################################ + +-# mc_filter_uv(next_kernel, x, y, frame_u_base, frame_v_base, height, hcoeffs[0], hcoeffs[1], vcoeffs[0], vcoeffs[1], this_u_dst, this_v_dst) ++# mc_filter_uv(next_kernel, x, y, frame_u_base, frame_v_base, width_height, hcoeffs, vcoeffs, offset_weight_u, offset_weight_v, this_u_dst, this_v_dst) + + # At this point we have already issued two pairs of texture requests for the current block + # ra_x, ra_x16_base point to the current coordinates for this block +-- +2.5.0 + + +From 1c4e1f07dbed84272a36cd8c25cf9d40be5cfd7c Mon Sep 17 00:00:00 2001 +From: Peter de Rivaz <peter.derivaz@gmail.com> +Date: Tue, 2 Jun 2015 13:17:50 +0100 +Subject: [PATCH 49/68] Increased motion vector memory and fixed block size + computation for non-multiple of 2 block sizes + +--- + libavcodec/hevc.c | 50 +++++++++++++++++++++++++++++++------------------- + 1 file changed, 31 insertions(+), 19 deletions(-) + +diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c +index 9be5276..c864ddb 100644 +--- a/libavcodec/hevc.c ++++ b/libavcodec/hevc.c +@@ -83,11 +83,9 @@ const uint8_t ff_hevc_pel_weight[65] = { [2] = 0, [4] = 1, [6] = 2, [8] = 3, [12 + + // Split image of 2048 into parts 64 wide + // So some QPUs will have 3 blocks of 64 to do, and others 2 blocks for an image 2048 wide with 32 blocks across +-// Each block of 64*64 +-// Smallest CTU size is 16x16, so smallest block is 8x8 +-// Corresponds to a total of 83kbytes over all 12 QPUs ++// For each block of 64*64 the smallest block size is 8x4 + #define RPI_LUMA_COMMAND_WORDS 9 +-#define Y_COMMANDS_PER_QPU ((1+3*(64*64)/(8*8)) * RPI_LUMA_COMMAND_WORDS) ++#define Y_COMMANDS_PER_QPU ((1+3*(64*64)/(8*4)) * RPI_LUMA_COMMAND_WORDS) + + #define ENCODE_COEFFS(c0, c1, c2, c3) (((c0) & 0xff) | ((c1) & 0xff) << 8 | ((c2) & 0xff) << 16 | ((c3) & 0xff) << 24) + +@@ -2031,11 +2029,13 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, + uint32_t *y = s->y_mvs[chan % 12]; + for(int start_y=0;start_y < nPbH;start_y+=16) { // Potentially we could change the assembly code to support taller sizes in one go + for(int start_x=0;start_x < nPbW;start_x+=16) { ++ int bw = nPbW-start_x; ++ int bh = nPbH-start_y; + y++[-RPI_LUMA_COMMAND_WORDS] = ((y1 - 3 + start_y) << 16) + ( (x1 - 3 + start_x) & 0xffff); + y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[0]); + y++[-RPI_LUMA_COMMAND_WORDS] = ((y1 - 3 + start_y) << 16) + ( (x1 - 3 + 8 + start_x) & 0xffff); + y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[0]); +- *y++ = ( (nPbW<16 ? nPbW : 16) << 16 ) + (nPbH<16 ? nPbH : 16); ++ *y++ = ( (bw<16 ? bw : 16) << 16 ) + (bh<16 ? bh : 16); + *y++ = my2_mx2_my_mx; + if (weight_flag) { + *y++ = (s->sh.luma_offset_l0[current_mv.ref_idx[reflist]] << 16) + (s->sh.luma_weight_l0[current_mv.ref_idx[reflist]] & 0xffff); +@@ -2078,12 +2078,14 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, + uint32_t *u = s->u_mvs[chan & 7]; + for(int start_y=0;start_y < nPbH_c;start_y+=16) { + for(int start_x=0;start_x < nPbW_c;start_x+=RPI_CHROMA_BLOCK_WIDTH) { ++ int bw = nPbW_c-start_x; ++ int bh = nPbH_c-start_y; + u++[-RPI_CHROMA_COMMAND_WORDS] = s->mc_filter_uv; + u++[-RPI_CHROMA_COMMAND_WORDS] = x1_c - 1 + start_x; + u++[-RPI_CHROMA_COMMAND_WORDS] = y1_c - 1 + start_y; + u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[1]); + u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[2]); +- *u++ = ( (nPbW_c<RPI_CHROMA_BLOCK_WIDTH ? nPbW_c : RPI_CHROMA_BLOCK_WIDTH) << 16 ) + (nPbH_c<16 ? nPbH_c : 16); ++ *u++ = ( (bw<RPI_CHROMA_BLOCK_WIDTH ? bw : RPI_CHROMA_BLOCK_WIDTH) << 16 ) + (bh<16 ? bh : 16); + *u++ = rpi_filter_coefs[_mx][0]; + *u++ = rpi_filter_coefs[_my][0]; + if (weight_flag) { +@@ -2130,11 +2132,13 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, + uint32_t *y = s->y_mvs[chan % 12]; + for(int start_y=0;start_y < nPbH;start_y+=16) { // Potentially we could change the assembly code to support taller sizes in one go + for(int start_x=0;start_x < nPbW;start_x+=16) { ++ int bw = nPbW-start_x; ++ int bh = nPbH-start_y; + y++[-RPI_LUMA_COMMAND_WORDS] = ((y1 - 3 + start_y) << 16) + ( (x1 - 3 + start_x) & 0xffff); + y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[0]); + y++[-RPI_LUMA_COMMAND_WORDS] = ((y1 - 3 + start_y) << 16) + ( (x1 - 3 + 8 + start_x) & 0xffff); + y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[0]); +- *y++ = ( (nPbW<16 ? nPbW : 16) << 16 ) + (nPbH<16 ? nPbH : 16); ++ *y++ = ( (bw<16 ? bw : 16) << 16 ) + (bh<16 ? bh : 16); + *y++ = my2_mx2_my_mx; + if (weight_flag) { + *y++ = (s->sh.luma_offset_l0[current_mv.ref_idx[reflist]] << 16) + (s->sh.luma_weight_l0[current_mv.ref_idx[reflist]] & 0xffff); +@@ -2178,12 +2182,14 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, + uint32_t *u = s->u_mvs[chan & 7]; + for(int start_y=0;start_y < nPbH_c;start_y+=16) { + for(int start_x=0;start_x < nPbW_c;start_x+=RPI_CHROMA_BLOCK_WIDTH) { ++ int bw = nPbW_c-start_x; ++ int bh = nPbH_c-start_y; + u++[-RPI_CHROMA_COMMAND_WORDS] = s->mc_filter_uv; + u++[-RPI_CHROMA_COMMAND_WORDS] = x1_c - 1 + start_x; + u++[-RPI_CHROMA_COMMAND_WORDS] = y1_c - 1 + start_y; + u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[1]); + u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[2]); +- *u++ = ( (nPbW_c<RPI_CHROMA_BLOCK_WIDTH ? nPbW_c : RPI_CHROMA_BLOCK_WIDTH) << 16 ) + (nPbH_c<16 ? nPbH_c : 16); ++ *u++ = ( (bw<RPI_CHROMA_BLOCK_WIDTH ? bw : RPI_CHROMA_BLOCK_WIDTH) << 16 ) + (bh<16 ? bh : 16); + // TODO chroma weight and offset... s->sh.chroma_weight_l0[current_mv.ref_idx[0]][0], s->sh.chroma_offset_l0[current_mv.ref_idx[0]][0] + *u++ = rpi_filter_coefs[_mx][0]; + *u++ = rpi_filter_coefs[_my][0]; +@@ -2235,11 +2241,13 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, + uint32_t *y = s->y_mvs[chan % 12]; + for(int start_y=0;start_y < nPbH;start_y+=16) { // Potentially we could change the assembly code to support taller sizes in one go + for(int start_x=0;start_x < nPbW;start_x+=8) { // B blocks work 8 at a time ++ int bw = nPbW-start_x; ++ int bh = nPbH-start_y; + y++[-RPI_LUMA_COMMAND_WORDS] = ((y1 - 3 + start_y) << 16) + ( (x1 - 3 + start_x) & 0xffff); + y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[0]); + y++[-RPI_LUMA_COMMAND_WORDS] = ((y2 - 3 + start_y) << 16) + ( (x2 - 3 + start_x) & 0xffff); // Second fetch is for ref1 + y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[0]); +- *y++ = ( (nPbW<8 ? nPbW : 8) << 16 ) + (nPbH<16 ? nPbH : 16); ++ *y++ = ( (bw<8 ? bw : 8) << 16 ) + (bh<16 ? bh : 16); + *y++ = my2_mx2_my_mx; + *y++ = 1; // B frame weighted prediction not supported + *y++ = (get_vc_address(s->frame->buf[0]) + x0 + start_x + (start_y + y0) * s->frame->linesize[0]); +@@ -2282,12 +2290,14 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, + uint32_t *u = s->u_mvs[chan & 7]; + for(int start_y=0;start_y < nPbH_c;start_y+=16) { + for(int start_x=0;start_x < nPbW_c;start_x+=RPI_CHROMA_BLOCK_WIDTH) { ++ int bw = nPbW_c-start_x; ++ int bh = nPbH_c-start_y; + u++[-RPI_CHROMA_COMMAND_WORDS] = s->mc_filter_uv_b0; + u++[-RPI_CHROMA_COMMAND_WORDS] = x1_c - 1 + start_x; + u++[-RPI_CHROMA_COMMAND_WORDS] = y1_c - 1 + start_y; + u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[1]); + u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[2]); +- *u++ = ( (nPbW_c<RPI_CHROMA_BLOCK_WIDTH ? nPbW_c : RPI_CHROMA_BLOCK_WIDTH) << 16 ) + (nPbH_c<16 ? nPbH_c : 16); ++ *u++ = ( (bw<RPI_CHROMA_BLOCK_WIDTH ? bw : RPI_CHROMA_BLOCK_WIDTH) << 16 ) + (bh<16 ? bh : 16); + *u++ = rpi_filter_coefs[_mx][0]; + *u++ = rpi_filter_coefs[_my][0]; + u+=2; // Weights not supported in B slices +@@ -2298,7 +2308,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, + u++[-RPI_CHROMA_COMMAND_WORDS] = y2_c - 1 + start_y; + u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[1]); + u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[2]); +- *u++ = ( (nPbW_c<RPI_CHROMA_BLOCK_WIDTH ? nPbW_c : RPI_CHROMA_BLOCK_WIDTH) << 16 ) + (nPbH_c<16 ? nPbH_c : 16); ++ *u++ = ( (bw<RPI_CHROMA_BLOCK_WIDTH ? bw : RPI_CHROMA_BLOCK_WIDTH) << 16 ) + (bh<16 ? bh : 16); + *u++ = rpi_filter_coefs[_mx2][0]; + *u++ = rpi_filter_coefs[_my2][0]; + u+=2; // Weights not supported in B slices +@@ -3167,14 +3177,15 @@ static void rpi_simulate_inter_chroma(HEVCContext *s,uint32_t *p) + } + + // mc_setup(y_x, ref_y_base, y2_x2, ref_y2_base, frame_width_height, pitch, dst_pitch, offset_shift, next_kernel) +-static void rpi_simulate_inter_luma(HEVCContext *s,uint32_t *p) ++static void rpi_simulate_inter_luma(HEVCContext *s,uint32_t *p,int chan) + { + uint32_t next_kernel; + int y_x,y2_x2; +- uint32_t x0; +- uint32_t y0; +- uint32_t x2; +- uint32_t y2; ++ int x0; ++ int y0; ++ int x2; ++ int y2; ++ uint32_t *p0 = p; + uint8_t *ref_y_base; + uint8_t *ref_y2_base; + uint32_t frame_width_height = p[4]; +@@ -3204,13 +3215,15 @@ static void rpi_simulate_inter_luma(HEVCContext *s,uint32_t *p) + uint8_t *this_dst = compute_arm_addr(s,p[7],0); + uint32_t width = width_height >> 16; + uint32_t height = (width_height << 16) >> 16; ++ uint8_t *dst_base = s->frame->data[0]; + ref_y_base = compute_arm_addr(s,p[1-9],0); + ref_y2_base = compute_arm_addr(s,p[3-9],0); + for (y=0; y<height; ++y) { + for (x=0; x<width; ++x) { + if (next_kernel==s->mc_filter) { + int32_t refa = filter8_luma(ref_y_base,x+x0, y+y0, pitch, my2_mx2_my_mx, offset_weight,offset_before,denom,frame_width,frame_height); +- this_dst[x+y*dst_pitch] = av_clip_uint8(refa); ++ refa = av_clip_uint8(refa); ++ this_dst[x+y*dst_pitch] = refa; + } + else { + int32_t refa = filter8_luma(ref_y_base, x+x0, y+y0, pitch, my2_mx2_my_mx, 1, 0, 0, frame_width, frame_height); +@@ -3237,7 +3250,7 @@ static void rpi_simulate_inter_qpu(HEVCContext *s) + } + for(i=0;i<12;i++) + { +- rpi_simulate_inter_luma(s,s->y_mvs_base[i]); ++ rpi_simulate_inter_luma(s,s->y_mvs_base[i],i); + } + } + +@@ -3279,7 +3292,6 @@ static void rpi_execute_inter_qpu(HEVCContext *s) + + #ifdef RPI_SIMULATE_QPUS + rpi_simulate_inter_qpu(s); +- s->vpu_id = -1; + return; + #endif + +-- +2.5.0 + + +From e6447ea51d299460471d5ac7e2fb6efe374574ee Mon Sep 17 00:00:00 2001 +From: Peter de Rivaz <peter.derivaz@gmail.com> +Date: Tue, 2 Jun 2015 14:36:54 +0100 +Subject: [PATCH 50/68] Added support for skip deblock + +--- + libavcodec/hevc.c | 5 +++++ + libavcodec/hevc.h | 2 ++ + libavcodec/hevc_filter.c | 14 ++++---------- + 3 files changed, 11 insertions(+), 10 deletions(-) + +diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c +index c864ddb..7acd243 100644 +--- a/libavcodec/hevc.c ++++ b/libavcodec/hevc.c +@@ -3386,6 +3386,11 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) + } + + #endif ++ s->used_for_ref = !(s->nal_unit_type == NAL_TRAIL_N || ++ s->nal_unit_type == NAL_TSA_N || ++ s->nal_unit_type == NAL_STSA_N || ++ s->nal_unit_type == NAL_RADL_N || ++ s->nal_unit_type == NAL_RASL_N); + + if (!ctb_addr_ts && s->sh.dependent_slice_segment_flag) { + av_log(s->avctx, AV_LOG_ERROR, "Impossible initial tile.\n"); +diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h +index a3668a2..520d16f 100644 +--- a/libavcodec/hevc.h ++++ b/libavcodec/hevc.h +@@ -916,6 +916,8 @@ typedef struct HEVCContext { + int width; + int height; + ++ int used_for_ref; ++ + #ifdef RPI + int enable_rpi; + HEVCMvCmd *unif_mv_cmds; +diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c +index 11629e4..14a0952 100644 +--- a/libavcodec/hevc_filter.c ++++ b/libavcodec/hevc_filter.c +@@ -512,16 +512,14 @@ static void deblocking_filter_CTB(HEVCContext *s, int x0, int y0) + s->ps.pps->transquant_bypass_enable_flag; + + #ifdef DISABLE_DEBLOCK_NONREF +- if ( s->nal_unit_type == NAL_TRAIL_N || +- s->nal_unit_type == NAL_TSA_N || +- s->nal_unit_type == NAL_STSA_N || +- s->nal_unit_type == NAL_RADL_N || +- s->nal_unit_type == NAL_RASL_N ) ++ if (!s->used_for_ref) + return; // Don't deblock non-reference frames + #endif + #ifdef DISABLE_DEBLOCK + return; + #endif ++ if (!s->used_for_ref && s->avctx->skip_loop_filter >= AVDISCARD_NONREF) ++ return; + + if (x0) { + left_tc_offset = s->deblock[ctb - 1].tc_offset; +@@ -885,11 +883,7 @@ static int ff_hevc_buf_base(AVBufferRef *bref) { + + void ff_hevc_flush_buffer(HEVCContext *s, ThreadFrame *f, int n) + { +- if (s->enable_rpi && !( s->nal_unit_type == NAL_TRAIL_N || +- s->nal_unit_type == NAL_TSA_N || +- s->nal_unit_type == NAL_STSA_N || +- s->nal_unit_type == NAL_RADL_N || +- s->nal_unit_type == NAL_RASL_N )) { ++ if (s->enable_rpi && s->used_for_ref) { + #ifdef RPI_FAST_CACHEFLUSH + struct vcsm_user_clean_invalid_s iocache = {}; + int curr_y = ((int *)f->progress->data)[0]; +-- +2.5.0 + + +From 0b1f5a86b7b99b237d1eae321ed4083365f4103b Mon Sep 17 00:00:00 2001 +From: Peter de Rivaz <peter.derivaz@gmail.com> +Date: Tue, 2 Jun 2015 15:22:52 +0100 +Subject: [PATCH 51/68] Added support for skip_frame + +--- + libavcodec/hevc.c | 15 ++++++++++----- + 1 file changed, 10 insertions(+), 5 deletions(-) + +diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c +index 7acd243..0324968 100644 +--- a/libavcodec/hevc.c ++++ b/libavcodec/hevc.c +@@ -3386,11 +3386,6 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) + } + + #endif +- s->used_for_ref = !(s->nal_unit_type == NAL_TRAIL_N || +- s->nal_unit_type == NAL_TSA_N || +- s->nal_unit_type == NAL_STSA_N || +- s->nal_unit_type == NAL_RADL_N || +- s->nal_unit_type == NAL_RASL_N); + + if (!ctb_addr_ts && s->sh.dependent_slice_segment_flag) { + av_log(s->avctx, AV_LOG_ERROR, "Impossible initial tile.\n"); +@@ -3914,6 +3909,16 @@ static int decode_nal_unit(HEVCContext *s, const HEVCNAL *nal) + if (ret < 0) + return ret; + ++ s->used_for_ref = !(s->nal_unit_type == NAL_TRAIL_N || ++ s->nal_unit_type == NAL_TSA_N || ++ s->nal_unit_type == NAL_STSA_N || ++ s->nal_unit_type == NAL_RADL_N || ++ s->nal_unit_type == NAL_RASL_N); ++ ++ if (!s->used_for_ref && s->avctx->skip_frame >= AVDISCARD_NONREF) { ++ s->is_decoded = 0; ++ break; ++ } + if (s->max_ra == INT_MAX) { + if (s->nal_unit_type == NAL_CRA_NUT || IS_BLA(s)) { + s->max_ra = s->poc; +-- +2.5.0 + + +From 04e23231d9f7c40c6b6d124a048fac976f302a52 Mon Sep 17 00:00:00 2001 +From: Peter de Rivaz <peter.derivaz@gmail.com> +Date: Wed, 3 Jun 2015 09:15:38 +0100 +Subject: [PATCH 52/68] Fixed cache flushing of luma when using old method + +--- + libavcodec/hevc_filter.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c +index 14a0952..b286bbf 100644 +--- a/libavcodec/hevc_filter.c ++++ b/libavcodec/hevc_filter.c +@@ -919,7 +919,7 @@ void ff_hevc_flush_buffer(HEVCContext *s, ThreadFrame *f, int n) + flush_buffer(s->frame->buf[1]); + flush_buffer(s->frame->buf[2]); + #ifdef RPI_LUMA_QPU +- flush_buffer(s->frame->buf[1]); ++ flush_buffer(s->frame->buf[0]); + #endif + + #endif +-- +2.5.0 + + +From 26eae6b28ba1027063a48258f47d4702ccba53cc Mon Sep 17 00:00:00 2001 +From: Peter de Rivaz <peter.derivaz@gmail.com> +Date: Wed, 3 Jun 2015 11:37:27 +0100 +Subject: [PATCH 53/68] Option to parallelise coefficient decode and inter + prediction and deblock for each frame + +--- + libavcodec/hevc.c | 701 +++++++++++++++++++++++++++-------------- + libavcodec/hevc.h | 74 +++-- + libavcodec/hevc_cabac.c | 12 +- + libavcodec/hevcpred_template.c | 5 +- + 4 files changed, 522 insertions(+), 270 deletions(-) + +diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c +index 0324968..6f67872 100644 +--- a/libavcodec/hevc.c ++++ b/libavcodec/hevc.c +@@ -43,8 +43,6 @@ + + #ifdef RPI + #include "rpi_qpu.h" +- // For some unknown reason, the code seems to crash if I do a late malloc +- //#define EARLY_MALLOC + // Move Inter prediction into separate pass + #define RPI_INTER + +@@ -58,6 +56,21 @@ + + // Define RPI_SIMULATE_QPUS for debugging to run QPU code on the ARMs + //#define RPI_SIMULATE_QPUS ++ #ifdef RPI_WORKER ++ #include "pthread.h" ++ #endif ++ ++ static void rpi_execute_dblk_cmds(HEVCContext *s); ++ static void rpi_execute_transform(HEVCContext *s); ++ static void rpi_execute_inter_qpu(HEVCContext *s); ++ static void rpi_execute_pred_cmds(HEVCContext *s); ++ static void rpi_execute_inter_cmds(HEVCContext *s); ++ static void rpi_inter_clear(HEVCContext *s); ++ ++ // Define INTER_PASS0 to do inter prediction in first pass ++ //#define INTER_PASS0 ++ // Define LAUNCH_PASS0 to launch QPU/VPU from pass0 ++ //#define LAUNCH_PASS0 + + #endif + +@@ -105,6 +118,143 @@ static uint32_t get_vc_address(AVBufferRef *bref) { + GPU_MEM_PTR_T *p = av_buffer_pool_opaque(bref); + return p->vc; + } ++#endif ++ ++ ++#ifdef RPI_WORKER ++ ++//#define LOG_ENTER printf("Enter %s: p0=%d p1=%d (%d jobs) %p\n", __func__,s->pass0_job,s->pass1_job,s->worker_tail-s->worker_head,s); ++//#define LOG_EXIT printf("Exit %s: p0=%d p1=%d (%d jobs) %p\n", __func__,s->pass0_job,s->pass1_job,s->worker_tail-s->worker_head,s); ++ ++#define LOG_ENTER ++#define LOG_EXIT ++ ++// Call this when we have completed pass0 and wish to trigger pass1 for the current job ++static void worker_submit_job(HEVCContext *s) ++{ ++ LOG_ENTER ++ //pthread_mutex_lock(&s->worker_mutex); ++ s->worker_tail++; // This is the only place that can change tail so we do not need the mutex ++ s->pass0_job = (s->pass0_job + 1) % RPI_MAX_JOBS; // Move onto the next slot ++ pthread_cond_broadcast(&s->worker_cond_tail); // Let people know that the tail has moved ++ //pthread_mutex_unlock(&s->worker_mutex); ++ LOG_EXIT ++} ++ ++// Call this to say we have completed pass1 ++static void worker_complete_middle_job(HEVCContext *s) ++{ ++ LOG_ENTER ++ //pthread_mutex_lock(&s->worker_mutex); ++ s->worker_middle++; // This is the only place that can change head so we do not need the mutex ++ s->pass1_job = (s->pass1_job + 1) % RPI_MAX_JOBS; // Move onto the next slot ++ pthread_cond_broadcast(&s->worker_cond_middle); // Let people know that the tail has moved ++ //pthread_mutex_unlock(&s->worker_mutex); ++ LOG_EXIT ++} ++ ++// Call this to say we have completed pass2 ++static void worker_complete_job(HEVCContext *s) ++{ ++ LOG_ENTER ++ //pthread_mutex_lock(&s->worker_mutex); ++ s->worker_head++; // This is the only place that can change head so we do not need the mutex ++ s->pass2_job = (s->pass2_job + 1) % RPI_MAX_JOBS; // Move onto the next slot ++ pthread_cond_broadcast(&s->worker_cond_head); // Let people know that the tail has moved ++ //pthread_mutex_unlock(&s->worker_mutex); ++ LOG_EXIT ++} ++ ++// Call this to wait for all jobs to have completed at the end of a frame ++static void worker_wait(HEVCContext *s) ++{ ++ LOG_ENTER ++ pthread_mutex_lock(&s->worker_mutex); ++ while( s->worker_head !=s->worker_tail) ++ { ++ pthread_cond_wait(&s->worker_cond_head, &s->worker_mutex); ++ } ++ pthread_mutex_unlock(&s->worker_mutex); ++ LOG_EXIT ++} ++ ++// Call worker_pass0_ready to wait until the s->pass0_job slot becomes ++// available to receive the next job. ++static void worker_pass0_ready(HEVCContext *s) ++{ ++ LOG_ENTER ++ pthread_mutex_lock(&s->worker_mutex); ++ // tail is number of submitted jobs ++ // head is number of completed jobs ++ // tail-head is number of outstanding jobs in the queue ++ // we need to ensure there is at least 1 space left for us to use ++ while( s->worker_tail - s->worker_head >= RPI_MAX_JOBS) ++ { ++ // Wait until another job is completed ++ pthread_cond_wait(&s->worker_cond_head, &s->worker_mutex); ++ } ++ pthread_mutex_unlock(&s->worker_mutex); ++ LOG_EXIT ++} ++ ++static void *worker_start(void *arg) ++{ ++ HEVCContext *s = (HEVCContext *)arg; ++ while(1) { ++ pthread_mutex_lock(&s->worker_mutex); ++ ++ while( !s->kill_worker && s->worker_tail - s->worker_middle <= 0) ++ { ++ pthread_cond_wait(&s->worker_cond_tail, &s->worker_mutex); ++ } ++ pthread_mutex_unlock(&s->worker_mutex); ++ ++ if (s->kill_worker) { ++ break; ++ } ++ LOG_ENTER ++ // printf("%d %d %d : %d %d %d %d\n",s->poc, x_ctb, y_ctb, s->num_pred_cmds,s->num_mv_cmds,s->num_coeffs[2] >> 8,s->num_coeffs[3] >> 10); ++#ifndef LAUNCH_PASS0 ++ rpi_execute_inter_qpu(s); ++#endif ++#ifndef INTER_PASS0 ++ // Perform inter prediction ++ rpi_execute_inter_cmds(s); ++#endif ++ // Wait for transform completion ++ vpu_wait(s->vpu_id); ++ ++ worker_complete_middle_job(s); ++ LOG_EXIT ++ } ++ return NULL; ++} ++ ++static void *worker_deblock_start(void *arg) ++{ ++ HEVCContext *s = (HEVCContext *)arg; ++ while(1) { ++ pthread_mutex_lock(&s->worker_mutex); ++ while( !s->kill_worker && s->worker_middle - s->worker_head <= 0) ++ { ++ pthread_cond_wait(&s->worker_cond_middle, &s->worker_mutex); ++ } ++ pthread_mutex_unlock(&s->worker_mutex); ++ ++ if (s->kill_worker) { ++ break; ++ } ++ LOG_ENTER ++ // Perform intra prediction and residual reconstruction ++ rpi_execute_pred_cmds(s); ++ // Perform deblocking for CTBs in this row ++ rpi_execute_dblk_cmds(s); ++ ++ worker_complete_job(s); ++ LOG_EXIT ++ } ++ return NULL; ++} + + #endif + +@@ -121,19 +271,18 @@ static uint32_t get_vc_address(AVBufferRef *bref) { + static void pic_arrays_free(HEVCContext *s) + { + #ifdef RPI +- +-#ifdef EARLY_MALLOC +-#else +- if (s->coeffs_buf_arm[0]) { +- gpu_free(&s->coeffs_buf_default); +- s->coeffs_buf_arm[0] = 0; +- } +- if (s->coeffs_buf_arm[2]) { +- gpu_free(&s->coeffs_buf_accelerated); +- s->coeffs_buf_arm[2] = 0; ++ int job; ++ for(job=0;job<RPI_MAX_JOBS;job++) { ++ if (s->coeffs_buf_arm[job][0]) { ++ gpu_free(&s->coeffs_buf_default[job]); ++ s->coeffs_buf_arm[job][0] = 0; ++ } ++ if (s->coeffs_buf_arm[job][2]) { ++ gpu_free(&s->coeffs_buf_accelerated[job]); ++ s->coeffs_buf_arm[job][2] = 0; ++ } + } + #endif +-#endif + av_freep(&s->sao); + av_freep(&s->deblock); + +@@ -171,24 +320,26 @@ static int pic_arrays_init(HEVCContext *s, const HEVCSPS *sps) + int min_pu_size = sps->min_pu_width * sps->min_pu_height; + + #ifdef RPI +-#ifdef EARLY_MALLOC +-#else + av_assert0(sps); + int coeffs_in_ctb = (1 << sps->log2_ctb_size) * (1 << sps->log2_ctb_size); + int coefs_per_row = sps->ctb_width * coeffs_in_ctb * 3; // Allow space for chroma +- gpu_malloc_cached(sizeof(int16_t) * coefs_per_row, &s->coeffs_buf_default); +- s->coeffs_buf_arm[0] = (int16_t*) s->coeffs_buf_default.arm; +- if (!s->coeffs_buf_arm[0]) +- goto fail; +- gpu_malloc_cached(sizeof(int16_t) * coefs_per_row * 2, &s->coeffs_buf_accelerated); +- s->coeffs_buf_arm[2] = (int16_t*) s->coeffs_buf_accelerated.arm; +- s->coeffs_buf_vc[2] = s->coeffs_buf_accelerated.vc; +- if (!s->coeffs_buf_arm[2]) +- goto fail; +- s->coeffs_buf_arm[3] = coefs_per_row + s->coeffs_buf_arm[2]; +- s->coeffs_buf_vc[3] = sizeof(int16_t) * coefs_per_row + s->coeffs_buf_vc[2]; +- printf("Done\n"); +-#endif ++ int job; ++ for(job=0;job<RPI_MAX_JOBS;job++) { ++ printf("Allocated %d\n",coefs_per_row); ++ for(job=0;job<RPI_MAX_JOBS;job++) { ++ gpu_malloc_cached(sizeof(int16_t) * coefs_per_row, &s->coeffs_buf_default[job]); ++ s->coeffs_buf_arm[job][0] = (int16_t*) s->coeffs_buf_default[job].arm; ++ if (!s->coeffs_buf_arm[job][0]) ++ goto fail; ++ gpu_malloc_cached(sizeof(int16_t) * coefs_per_row * 2, &s->coeffs_buf_accelerated[job]); ++ s->coeffs_buf_arm[job][2] = (int16_t*) s->coeffs_buf_accelerated[job].arm; ++ s->coeffs_buf_vc[job][2] = s->coeffs_buf_accelerated[job].vc; ++ if (!s->coeffs_buf_arm[job][2]) ++ goto fail; ++ s->coeffs_buf_arm[job][3] = coefs_per_row + s->coeffs_buf_arm[job][2]; ++ s->coeffs_buf_vc[job][3] = sizeof(int16_t) * coefs_per_row + s->coeffs_buf_vc[job][2]; ++ } ++ } + #endif + + s->bs_width = (width >> 2) + 1; +@@ -1025,7 +1176,7 @@ static void rpi_intra_pred(HEVCContext *s, int log2_trafo_size, int x0, int y0, + { + if (s->enable_rpi) { + HEVCLocalContext *lc = s->HEVClc; +- HEVCPredCmd *cmd = s->univ_pred_cmds + s->num_pred_cmds++; ++ HEVCPredCmd *cmd = s->univ_pred_cmds[s->pass0_job] + s->num_pred_cmds[s->pass0_job]++; + cmd->type = RPI_PRED_INTRA; + cmd->size = log2_trafo_size; + cmd->c_idx = c_idx; +@@ -1485,7 +1636,7 @@ static void rpi_luma_mc_uni(HEVCContext *s, uint8_t *dst, ptrdiff_t dststride, + AVFrame *ref, const Mv *mv, int x_off, int y_off, + int block_w, int block_h, int luma_weight, int luma_offset) + { +- HEVCMvCmd *cmd = s->unif_mv_cmds + s->num_mv_cmds++; ++ HEVCMvCmd *cmd = s->unif_mv_cmds[s->pass0_job] + s->num_mv_cmds[s->pass0_job]++; + cmd->cmd = RPI_CMD_LUMA_UNI; + cmd->dst = dst; + cmd->dststride = dststride; +@@ -1504,7 +1655,7 @@ static void rpi_luma_mc_bi(HEVCContext *s, uint8_t *dst, ptrdiff_t dststride, + AVFrame *ref0, const Mv *mv0, int x_off, int y_off, + int block_w, int block_h, AVFrame *ref1, const Mv *mv1, struct MvField *current_mv) + { +- HEVCMvCmd *cmd = s->unif_mv_cmds + s->num_mv_cmds++; ++ HEVCMvCmd *cmd = s->unif_mv_cmds[s->pass0_job] + s->num_mv_cmds[s->pass0_job]++; + cmd->cmd = RPI_CMD_LUMA_BI; + cmd->dst = dst; + cmd->dststride = dststride; +@@ -1526,7 +1677,7 @@ static void rpi_chroma_mc_uni(HEVCContext *s, uint8_t *dst0, + ptrdiff_t dststride, uint8_t *src0, ptrdiff_t srcstride, int reflist, + int x_off, int y_off, int block_w, int block_h, struct MvField *current_mv, int chroma_weight, int chroma_offset) + { +- HEVCMvCmd *cmd = s->unif_mv_cmds + s->num_mv_cmds++; ++ HEVCMvCmd *cmd = s->unif_mv_cmds[s->pass0_job] + s->num_mv_cmds[s->pass0_job]++; + cmd->cmd = RPI_CMD_CHROMA_UNI; + cmd->dst = dst0; + cmd->dststride = dststride; +@@ -1544,7 +1695,7 @@ static void rpi_chroma_mc_uni(HEVCContext *s, uint8_t *dst0, + static void rpi_chroma_mc_bi(HEVCContext *s, uint8_t *dst0, ptrdiff_t dststride, AVFrame *ref0, AVFrame *ref1, + int x_off, int y_off, int block_w, int block_h, struct MvField *current_mv, int cidx) + { +- HEVCMvCmd *cmd = s->unif_mv_cmds + s->num_mv_cmds++; ++ HEVCMvCmd *cmd = s->unif_mv_cmds[s->pass0_job] + s->num_mv_cmds[s->pass0_job]++; + cmd->cmd = RPI_CMD_CHROMA_BI+cidx; + cmd->dst = dst0; + cmd->dststride = dststride; +@@ -2026,7 +2177,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, + int chan = x0>>6; // 64 wide blocks per QPU + int weight_flag = (s->sh.slice_type == P_SLICE && s->ps.pps->weighted_pred_flag) || + (s->sh.slice_type == B_SLICE && s->ps.pps->weighted_bipred_flag); +- uint32_t *y = s->y_mvs[chan % 12]; ++ uint32_t *y = s->y_mvs[s->pass0_job][chan % 12]; + for(int start_y=0;start_y < nPbH;start_y+=16) { // Potentially we could change the assembly code to support taller sizes in one go + for(int start_x=0;start_x < nPbW;start_x+=16) { + int bw = nPbW-start_x; +@@ -2046,7 +2197,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, + y++[-RPI_LUMA_COMMAND_WORDS] = s->mc_filter; + } + } +- s->y_mvs[chan % 12] = y; ++ s->y_mvs[s->pass0_job][chan % 12] = y; + } else + #endif + { +@@ -2075,7 +2226,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, + int weight_flag = (s->sh.slice_type == P_SLICE && s->ps.pps->weighted_pred_flag) || + (s->sh.slice_type == B_SLICE && s->ps.pps->weighted_bipred_flag); + +- uint32_t *u = s->u_mvs[chan & 7]; ++ uint32_t *u = s->u_mvs[s->pass0_job][chan & 7]; + for(int start_y=0;start_y < nPbH_c;start_y+=16) { + for(int start_x=0;start_x < nPbW_c;start_x+=RPI_CHROMA_BLOCK_WIDTH) { + int bw = nPbW_c-start_x; +@@ -2099,7 +2250,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, + *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); + } + } +- s->u_mvs[chan & 7] = u; ++ s->u_mvs[s->pass0_job][chan & 7] = u; + return; + } + #endif +@@ -2129,7 +2280,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, + int chan = x0>>6; // 64 wide blocks per QPU + int weight_flag = (s->sh.slice_type == P_SLICE && s->ps.pps->weighted_pred_flag) || + (s->sh.slice_type == B_SLICE && s->ps.pps->weighted_bipred_flag); +- uint32_t *y = s->y_mvs[chan % 12]; ++ uint32_t *y = s->y_mvs[s->pass0_job][chan % 12]; + for(int start_y=0;start_y < nPbH;start_y+=16) { // Potentially we could change the assembly code to support taller sizes in one go + for(int start_x=0;start_x < nPbW;start_x+=16) { + int bw = nPbW-start_x; +@@ -2149,7 +2300,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, + y++[-RPI_LUMA_COMMAND_WORDS] = s->mc_filter; + } + } +- s->y_mvs[chan % 12] = y; ++ s->y_mvs[s->pass0_job][chan % 12] = y; + } else + #endif + +@@ -2179,7 +2330,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, + int weight_flag = (s->sh.slice_type == P_SLICE && s->ps.pps->weighted_pred_flag) || + (s->sh.slice_type == B_SLICE && s->ps.pps->weighted_bipred_flag); + +- uint32_t *u = s->u_mvs[chan & 7]; ++ uint32_t *u = s->u_mvs[s->pass0_job][chan & 7]; + for(int start_y=0;start_y < nPbH_c;start_y+=16) { + for(int start_x=0;start_x < nPbW_c;start_x+=RPI_CHROMA_BLOCK_WIDTH) { + int bw = nPbW_c-start_x; +@@ -2204,7 +2355,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, + *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); + } + } +- s->u_mvs[chan & 7] = u; ++ s->u_mvs[s->pass0_job][chan & 7] = u; + return; + } + #endif +@@ -2238,7 +2389,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, + int x2 = x0 + (mv2->x >> 2); + int y2 = y0 + (mv2->y >> 2); + int chan = x0>>6; // 64 wide blocks per QPU +- uint32_t *y = s->y_mvs[chan % 12]; ++ uint32_t *y = s->y_mvs[s->pass0_job][chan % 12]; + for(int start_y=0;start_y < nPbH;start_y+=16) { // Potentially we could change the assembly code to support taller sizes in one go + for(int start_x=0;start_x < nPbW;start_x+=8) { // B blocks work 8 at a time + int bw = nPbW-start_x; +@@ -2254,7 +2405,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, + y++[-RPI_LUMA_COMMAND_WORDS] = s->mc_filter_b; + } + } +- s->y_mvs[chan % 12] = y; ++ s->y_mvs[s->pass0_job][chan % 12] = y; + } else + #endif + { +@@ -2287,7 +2438,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, + + int chan = x0>>8; // Allocate commands for the first 256 luma pixels across to the first QPU. This is optimised for images around 1920 width + +- uint32_t *u = s->u_mvs[chan & 7]; ++ uint32_t *u = s->u_mvs[s->pass0_job][chan & 7]; + for(int start_y=0;start_y < nPbH_c;start_y+=16) { + for(int start_x=0;start_x < nPbW_c;start_x+=RPI_CHROMA_BLOCK_WIDTH) { + int bw = nPbW_c-start_x; +@@ -2316,7 +2467,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, + *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); + } + } +- s->u_mvs[chan & 7] = u; ++ s->u_mvs[s->pass0_job][chan & 7] = u; + return; + } + #endif +@@ -2821,40 +2972,54 @@ static void hls_decode_neighbour(HEVCContext *s, int x_ctb, int y_ctb, + static void rpi_execute_dblk_cmds(HEVCContext *s) + { + int n; ++ int job = s->pass2_job; + int ctb_size = 1 << s->ps.sps->log2_ctb_size; +- int (*p)[2] = s->dblk_cmds; +- for(n = s->num_dblk_cmds; n>0 ;n--,p++) { ++ int (*p)[2] = s->dblk_cmds[job]; ++ for(n = s->num_dblk_cmds[job]; n>0 ;n--,p++) { + ff_hevc_hls_filters(s, (*p)[0], (*p)[1], ctb_size); + } +- s->num_dblk_cmds = 0; ++ s->num_dblk_cmds[job] = 0; + } + + static void rpi_execute_transform(HEVCContext *s) + { + int i=2; ++#ifdef LAUNCH_PASS0 ++ int job = s->pass0_job; ++#else ++ int job = s->pass1_job; ++#endif + //int j; + //int16_t *coeffs = s->coeffs_buf_arm[i]; + //for(j=s->num_coeffs[i]; j > 0; j-= 16*16, coeffs+=16*16) { + // s->hevcdsp.idct[4-2](coeffs, 16); + //} + +- gpu_cache_flush(&s->coeffs_buf_accelerated); +- s->vpu_id = vpu_post_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf_vc[2], s->num_coeffs[2] >> 8, s->coeffs_buf_vc[3], s->num_coeffs[3] >> 10, 0, &s->coeffs_buf_accelerated); ++ gpu_cache_flush(&s->coeffs_buf_accelerated[job]); ++ s->vpu_id = vpu_post_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf_vc[job][2], ++ s->num_coeffs[job][2] >> 8, s->coeffs_buf_vc[job][3], ++ s->num_coeffs[job][3] >> 10, 0, &s->coeffs_buf_accelerated[job]); + //vpu_execute_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf_vc[2], s->num_coeffs[2] >> 8, s->coeffs_buf_vc[3], s->num_coeffs[3] >> 10, 0); + //gpu_cache_flush(&s->coeffs_buf_accelerated); + //vpu_wait(s->vpu_id); + + for(i=0;i<4;i++) +- s->num_coeffs[i] = 0; ++ s->num_coeffs[job][i] = 0; + } + + static void rpi_execute_pred_cmds(HEVCContext *s) + { + int i; +- HEVCPredCmd *cmd = s->univ_pred_cmds; ++ int job = s->pass2_job; ++ HEVCPredCmd *cmd = s->univ_pred_cmds[job]; ++#ifdef RPI_WORKER ++ HEVCLocalContextIntra *lc = &s->HEVClcIntra; ++#else + HEVCLocalContext *lc = s->HEVClc; ++#endif + +- for(i = s->num_pred_cmds; i > 0; i--, cmd++) { ++ for(i = s->num_pred_cmds[job]; i > 0; i--, cmd++) { ++ //printf("i=%d cmd=%p job1=%d job0=%d\n",i,cmd,s->pass1_job,s->pass0_job); + if (cmd->type == RPI_PRED_INTRA) { + lc->tu.intra_pred_mode_c = lc->tu.intra_pred_mode = cmd->mode; + lc->na.cand_bottom_left = (cmd->na >> 4) & 1; +@@ -2873,21 +3038,26 @@ static void rpi_execute_pred_cmds(HEVCContext *s) + #endif + } + } +- s->num_pred_cmds = 0; ++ s->num_pred_cmds[job] = 0; + } + + static void rpi_execute_inter_cmds(HEVCContext *s) + { +- HEVCMvCmd *cmd = s->unif_mv_cmds; ++#ifdef INTER_PASS0 ++ int job = s->pass0_job; ++#else ++ int job = s->pass1_job; ++#endif ++ HEVCMvCmd *cmd = s->unif_mv_cmds[job]; + int n,cidx; + AVFrame myref; + AVFrame myref1; + struct MvField mymv; +- if (s->num_mv_cmds > RPI_MAX_MV_CMDS) { ++ if (s->num_mv_cmds[job] > RPI_MAX_MV_CMDS) { + printf("Overflow inter_cmds\n"); + exit(-1); + } +- for(n = s->num_mv_cmds; n>0 ; n--, cmd++) { ++ for(n = s->num_mv_cmds[job]; n>0 ; n--, cmd++) { + switch(cmd->cmd) { + case RPI_CMD_LUMA_UNI: + myref.data[0] = cmd->src; +@@ -2927,7 +3097,28 @@ static void rpi_execute_inter_cmds(HEVCContext *s) + break; + } + } +- s->num_mv_cmds = 0; ++ s->num_mv_cmds[job] = 0; ++} ++ ++static void rpi_do_all_passes(HEVCContext *s) ++{ ++#ifdef RPI_INTER_QPU ++ // Kick off inter prediction on QPUs ++ rpi_execute_inter_qpu(s); ++#else ++ rpi_execute_transform(s); ++#endif ++ // Perform luma inter prediction ++ rpi_execute_inter_cmds(s); ++ // Wait for transform completion ++ vpu_wait(s->vpu_id); ++ // Perform intra prediction and residual reconstruction ++ rpi_execute_pred_cmds(s); ++ // Perform deblocking for CTBs in this row ++ rpi_execute_dblk_cmds(s); ++#ifdef RPI_INTER_QPU ++ rpi_inter_clear(s); ++#endif + } + + #endif +@@ -2935,6 +3126,7 @@ static void rpi_execute_inter_cmds(HEVCContext *s) + #ifdef RPI_INTER_QPU + static void rpi_inter_clear(HEVCContext *s) + { ++ int job = s->pass0_job; + int i; + int pic_width = s->ps.sps->width >> s->ps.sps->hshift[1]; + int pic_height = s->ps.sps->height >> s->ps.sps->vshift[1]; +@@ -2942,51 +3134,50 @@ static void rpi_inter_clear(HEVCContext *s) + (s->sh.slice_type == B_SLICE && s->ps.pps->weighted_bipred_flag); + + for(i=0;i<8;i++) { +- s->u_mvs[i] = s->mvs_base[i]; +- *s->u_mvs[i]++ = 0; +- *s->u_mvs[i]++ = 0; +- *s->u_mvs[i]++ = 0; +- *s->u_mvs[i]++ = 0; +- *s->u_mvs[i]++ = 0; +- *s->u_mvs[i]++ = pic_width; +- *s->u_mvs[i]++ = pic_height; +- *s->u_mvs[i]++ = s->frame->linesize[1]; +- *s->u_mvs[i]++ = s->frame->linesize[2]; ++ s->u_mvs[job][i] = s->mvs_base[job][i]; ++ *s->u_mvs[job][i]++ = 0; ++ *s->u_mvs[job][i]++ = 0; ++ *s->u_mvs[job][i]++ = 0; ++ *s->u_mvs[job][i]++ = 0; ++ *s->u_mvs[job][i]++ = 0; ++ *s->u_mvs[job][i]++ = pic_width; ++ *s->u_mvs[job][i]++ = pic_height; ++ *s->u_mvs[job][i]++ = s->frame->linesize[1]; ++ *s->u_mvs[job][i]++ = s->frame->linesize[2]; + if (weight_flag) { +- *s->u_mvs[i]++ = 1 << (s->sh.chroma_log2_weight_denom + 6 - 1); +- *s->u_mvs[i]++ = s->sh.chroma_log2_weight_denom + 6; ++ *s->u_mvs[job][i]++ = 1 << (s->sh.chroma_log2_weight_denom + 6 - 1); ++ *s->u_mvs[job][i]++ = s->sh.chroma_log2_weight_denom + 6; + } else { +- *s->u_mvs[i]++ = 1 << 5; +- *s->u_mvs[i]++ = 6; ++ *s->u_mvs[job][i]++ = 1 << 5; ++ *s->u_mvs[job][i]++ = 6; + } +- *s->u_mvs[i]++ = i; // Select section of VPM (avoid collisions with 3d unit) ++ *s->u_mvs[job][i]++ = i; // Select section of VPM (avoid collisions with 3d unit) + } + + #ifdef RPI_LUMA_QPU + for(i=0;i<12;i++) { +- s->y_mvs[i] = s->y_mvs_base[i]; +- *s->y_mvs[i]++ = 0; // y_x +- *s->y_mvs[i]++ = 0; // ref_y_base +- *s->y_mvs[i]++ = 0; // y2_x2 +- *s->y_mvs[i]++ = 0; // ref_y2_base +- *s->y_mvs[i]++ = (s->ps.sps->width << 16) + s->ps.sps->height; +- *s->y_mvs[i]++ = s->frame->linesize[0]; // pitch +- *s->y_mvs[i]++ = s->frame->linesize[0]; // dst_pitch ++ s->y_mvs[job][i] = s->y_mvs_base[job][i]; ++ *s->y_mvs[job][i]++ = 0; // y_x ++ *s->y_mvs[job][i]++ = 0; // ref_y_base ++ *s->y_mvs[job][i]++ = 0; // y2_x2 ++ *s->y_mvs[job][i]++ = 0; // ref_y2_base ++ *s->y_mvs[job][i]++ = (s->ps.sps->width << 16) + s->ps.sps->height; ++ *s->y_mvs[job][i]++ = s->frame->linesize[0]; // pitch ++ *s->y_mvs[job][i]++ = s->frame->linesize[0]; // dst_pitch + if (weight_flag) { + int offset = 1 << (s->sh.luma_log2_weight_denom + 6 - 1); + int shift = s->sh.luma_log2_weight_denom + 6; +- *s->y_mvs[i]++ = (offset << 16) + shift; ++ *s->y_mvs[job][i]++ = (offset << 16) + shift; + } else { + int offset = 1 << 5; + int shift = 6; +- *s->y_mvs[i]++ = (offset << 16) + shift; ++ *s->y_mvs[job][i]++ = (offset << 16) + shift; + } +- *s->y_mvs[i]++ = 0; // Next kernel ++ *s->y_mvs[job][i]++ = 0; // Next kernel + } + #endif + } + +- + #ifdef RPI_SIMULATE_QPUS + + static int32_t clipx(int x,int FRAME_WIDTH) +@@ -3260,10 +3451,15 @@ static void rpi_simulate_inter_qpu(HEVCContext *s) + static void rpi_execute_inter_qpu(HEVCContext *s) + { + int k; ++#ifdef LAUNCH_PASS0 ++ int job = s->pass0_job; ++#else ++ int job = s->pass1_job; ++#endif + int i; +- uint32_t *unif_vc = (uint32_t *)s->unif_mvs_ptr.vc; ++ uint32_t *unif_vc = (uint32_t *)s->unif_mvs_ptr[job].vc; + #ifdef RPI_LUMA_QPU +- uint32_t *y_unif_vc = (uint32_t *)s->y_unif_mvs_ptr.vc; ++ uint32_t *y_unif_vc = (uint32_t *)s->y_unif_mvs_ptr[job].vc; + #endif + if (s->sh.slice_type == I_SLICE) { + #ifdef RPI_MULTI_MAILBOX +@@ -3272,22 +3468,22 @@ static void rpi_execute_inter_qpu(HEVCContext *s) + #endif + } + for(k=0;k<8;k++) { +- s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS] = qpu_get_fn(QPU_MC_EXIT); // Add exit command +- s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS+3] = qpu_get_fn(QPU_MC_SETUP_UV); // A dummy texture location (maps to our code) - this is needed as the texture requests are pipelined +- s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS+4] = qpu_get_fn(QPU_MC_SETUP_UV); // Also need a dummy for V +- av_assert0(s->u_mvs[k] - s->mvs_base[k] < UV_COMMANDS_PER_QPU); ++ s->u_mvs[job][k][-RPI_CHROMA_COMMAND_WORDS] = qpu_get_fn(QPU_MC_EXIT); // Add exit command ++ s->u_mvs[job][k][-RPI_CHROMA_COMMAND_WORDS+3] = qpu_get_fn(QPU_MC_SETUP_UV); // A dummy texture location (maps to our code) - this is needed as the texture requests are pipelined ++ s->u_mvs[job][k][-RPI_CHROMA_COMMAND_WORDS+4] = qpu_get_fn(QPU_MC_SETUP_UV); // Also need a dummy for V ++ av_assert0(s->u_mvs[job][k] - s->mvs_base[job][k] < UV_COMMANDS_PER_QPU); + } + +- s->u_mvs[8-1][-RPI_CHROMA_COMMAND_WORDS] = qpu_get_fn(QPU_MC_INTERRUPT_EXIT8); // This QPU will signal interrupt when all others are done and have acquired a semaphore ++ s->u_mvs[job][8-1][-RPI_CHROMA_COMMAND_WORDS] = qpu_get_fn(QPU_MC_INTERRUPT_EXIT8); // This QPU will signal interrupt when all others are done and have acquired a semaphore + + #ifdef RPI_LUMA_QPU + for(k=0;k<12;k++) { +- s->y_mvs[k][-RPI_LUMA_COMMAND_WORDS+1] = qpu_get_fn(QPU_MC_SETUP_UV); // A dummy texture location (maps to our code) - this is needed as the texture requests are pipelined +- s->y_mvs[k][-RPI_LUMA_COMMAND_WORDS+3] = qpu_get_fn(QPU_MC_SETUP_UV); // Also need a dummy for second request +- s->y_mvs[k][-RPI_LUMA_COMMAND_WORDS+8] = qpu_get_fn(QPU_MC_EXIT); // Add exit command +- av_assert0(s->y_mvs[k] - s->y_mvs_base[k] < Y_COMMANDS_PER_QPU); ++ s->y_mvs[job][k][-RPI_LUMA_COMMAND_WORDS+1] = qpu_get_fn(QPU_MC_SETUP_UV); // A dummy texture location (maps to our code) - this is needed as the texture requests are pipelined ++ s->y_mvs[job][k][-RPI_LUMA_COMMAND_WORDS+3] = qpu_get_fn(QPU_MC_SETUP_UV); // Also need a dummy for second request ++ s->y_mvs[job][k][-RPI_LUMA_COMMAND_WORDS+8] = qpu_get_fn(QPU_MC_EXIT); // Add exit command ++ av_assert0(s->y_mvs[job][k] - s->y_mvs_base[job][k] < Y_COMMANDS_PER_QPU); + } +- s->y_mvs[12-1][-RPI_LUMA_COMMAND_WORDS+8] = qpu_get_fn(QPU_MC_INTERRUPT_EXIT12); // This QPU will signal interrupt when all others are done and have acquired a semaphore ++ s->y_mvs[job][12-1][-RPI_LUMA_COMMAND_WORDS+8] = qpu_get_fn(QPU_MC_INTERRUPT_EXIT12); // This QPU will signal interrupt when all others are done and have acquired a semaphore + #endif + + #ifdef RPI_SIMULATE_QPUS +@@ -3297,34 +3493,34 @@ static void rpi_execute_inter_qpu(HEVCContext *s) + + #ifdef RPI_MULTI_MAILBOX + #ifdef RPI_CACHE_UNIF_MVS +- gpu_cache_flush3(&s->coeffs_buf_accelerated,&s->y_unif_mvs_ptr, &s->unif_mvs_ptr); ++ gpu_cache_flush3(&s->coeffs_buf_accelerated[job],&s->y_unif_mvs_ptr[job], &s->unif_mvs_ptr[job]); + #else +- gpu_cache_flush(&s->coeffs_buf_accelerated); ++ gpu_cache_flush(&s->coeffs_buf_accelerated[job]); + #endif +- s->vpu_id = vpu_qpu_post_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf_vc[2], s->num_coeffs[2] >> 8, s->coeffs_buf_vc[3], s->num_coeffs[3] >> 10, 0, ++ s->vpu_id = vpu_qpu_post_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf_vc[job][2], s->num_coeffs[job][2] >> 8, s->coeffs_buf_vc[job][3], s->num_coeffs[job][3] >> 10, 0, + qpu_get_fn(QPU_MC_SETUP_UV), +- (uint32_t)(unif_vc+(s->mvs_base[0 ] - (uint32_t*)s->unif_mvs_ptr.arm)), +- (uint32_t)(unif_vc+(s->mvs_base[1 ] - (uint32_t*)s->unif_mvs_ptr.arm)), +- (uint32_t)(unif_vc+(s->mvs_base[2 ] - (uint32_t*)s->unif_mvs_ptr.arm)), +- (uint32_t)(unif_vc+(s->mvs_base[3 ] - (uint32_t*)s->unif_mvs_ptr.arm)), +- (uint32_t)(unif_vc+(s->mvs_base[4 ] - (uint32_t*)s->unif_mvs_ptr.arm)), +- (uint32_t)(unif_vc+(s->mvs_base[5 ] - (uint32_t*)s->unif_mvs_ptr.arm)), +- (uint32_t)(unif_vc+(s->mvs_base[6 ] - (uint32_t*)s->unif_mvs_ptr.arm)), +- (uint32_t)(unif_vc+(s->mvs_base[7 ] - (uint32_t*)s->unif_mvs_ptr.arm)), ++ (uint32_t)(unif_vc+(s->mvs_base[job][0 ] - (uint32_t*)s->unif_mvs_ptr[job].arm)), ++ (uint32_t)(unif_vc+(s->mvs_base[job][1 ] - (uint32_t*)s->unif_mvs_ptr[job].arm)), ++ (uint32_t)(unif_vc+(s->mvs_base[job][2 ] - (uint32_t*)s->unif_mvs_ptr[job].arm)), ++ (uint32_t)(unif_vc+(s->mvs_base[job][3 ] - (uint32_t*)s->unif_mvs_ptr[job].arm)), ++ (uint32_t)(unif_vc+(s->mvs_base[job][4 ] - (uint32_t*)s->unif_mvs_ptr[job].arm)), ++ (uint32_t)(unif_vc+(s->mvs_base[job][5 ] - (uint32_t*)s->unif_mvs_ptr[job].arm)), ++ (uint32_t)(unif_vc+(s->mvs_base[job][6 ] - (uint32_t*)s->unif_mvs_ptr[job].arm)), ++ (uint32_t)(unif_vc+(s->mvs_base[job][7 ] - (uint32_t*)s->unif_mvs_ptr[job].arm)), + #ifdef RPI_LUMA_QPU + qpu_get_fn(QPU_MC_SETUP), +- (uint32_t)(y_unif_vc+(s->y_mvs_base[0 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)), +- (uint32_t)(y_unif_vc+(s->y_mvs_base[1 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)), +- (uint32_t)(y_unif_vc+(s->y_mvs_base[2 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)), +- (uint32_t)(y_unif_vc+(s->y_mvs_base[3 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)), +- (uint32_t)(y_unif_vc+(s->y_mvs_base[4 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)), +- (uint32_t)(y_unif_vc+(s->y_mvs_base[5 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)), +- (uint32_t)(y_unif_vc+(s->y_mvs_base[6 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)), +- (uint32_t)(y_unif_vc+(s->y_mvs_base[7 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)), +- (uint32_t)(y_unif_vc+(s->y_mvs_base[8 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)), +- (uint32_t)(y_unif_vc+(s->y_mvs_base[9 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)), +- (uint32_t)(y_unif_vc+(s->y_mvs_base[10 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)), +- (uint32_t)(y_unif_vc+(s->y_mvs_base[11 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)) ++ (uint32_t)(y_unif_vc+(s->y_mvs_base[job][0 ] - (uint32_t*)s->y_unif_mvs_ptr[job].arm)), ++ (uint32_t)(y_unif_vc+(s->y_mvs_base[job][1 ] - (uint32_t*)s->y_unif_mvs_ptr[job].arm)), ++ (uint32_t)(y_unif_vc+(s->y_mvs_base[job][2 ] - (uint32_t*)s->y_unif_mvs_ptr[job].arm)), ++ (uint32_t)(y_unif_vc+(s->y_mvs_base[job][3 ] - (uint32_t*)s->y_unif_mvs_ptr[job].arm)), ++ (uint32_t)(y_unif_vc+(s->y_mvs_base[job][4 ] - (uint32_t*)s->y_unif_mvs_ptr[job].arm)), ++ (uint32_t)(y_unif_vc+(s->y_mvs_base[job][5 ] - (uint32_t*)s->y_unif_mvs_ptr[job].arm)), ++ (uint32_t)(y_unif_vc+(s->y_mvs_base[job][6 ] - (uint32_t*)s->y_unif_mvs_ptr[job].arm)), ++ (uint32_t)(y_unif_vc+(s->y_mvs_base[job][7 ] - (uint32_t*)s->y_unif_mvs_ptr[job].arm)), ++ (uint32_t)(y_unif_vc+(s->y_mvs_base[job][8 ] - (uint32_t*)s->y_unif_mvs_ptr[job].arm)), ++ (uint32_t)(y_unif_vc+(s->y_mvs_base[job][9 ] - (uint32_t*)s->y_unif_mvs_ptr[job].arm)), ++ (uint32_t)(y_unif_vc+(s->y_mvs_base[job][10 ] - (uint32_t*)s->y_unif_mvs_ptr[job].arm)), ++ (uint32_t)(y_unif_vc+(s->y_mvs_base[job][11 ] - (uint32_t*)s->y_unif_mvs_ptr[job].arm)) + #else + 0, + 0,0,0,0, +@@ -3333,17 +3529,17 @@ static void rpi_execute_inter_qpu(HEVCContext *s) + #endif + ); + for(i=0;i<4;i++) +- s->num_coeffs[i] = 0; ++ s->num_coeffs[job][i] = 0; + #else + qpu_run_shader8(qpu_get_fn(QPU_MC_SETUP_UV), +- (uint32_t)(unif_vc+(s->mvs_base[0 ] - (uint32_t*)s->unif_mvs_ptr.arm)), +- (uint32_t)(unif_vc+(s->mvs_base[1 ] - (uint32_t*)s->unif_mvs_ptr.arm)), +- (uint32_t)(unif_vc+(s->mvs_base[2 ] - (uint32_t*)s->unif_mvs_ptr.arm)), +- (uint32_t)(unif_vc+(s->mvs_base[3 ] - (uint32_t*)s->unif_mvs_ptr.arm)), +- (uint32_t)(unif_vc+(s->mvs_base[4 ] - (uint32_t*)s->unif_mvs_ptr.arm)), +- (uint32_t)(unif_vc+(s->mvs_base[5 ] - (uint32_t*)s->unif_mvs_ptr.arm)), +- (uint32_t)(unif_vc+(s->mvs_base[6 ] - (uint32_t*)s->unif_mvs_ptr.arm)), +- (uint32_t)(unif_vc+(s->mvs_base[7 ] - (uint32_t*)s->unif_mvs_ptr.arm)) ++ (uint32_t)(unif_vc+(s->mvs_base[job][0 ] - (uint32_t*)s->unif_mvs_ptr[job].arm)), ++ (uint32_t)(unif_vc+(s->mvs_base[job][1 ] - (uint32_t*)s->unif_mvs_ptr[job].arm)), ++ (uint32_t)(unif_vc+(s->mvs_base[job][2 ] - (uint32_t*)s->unif_mvs_ptr[job].arm)), ++ (uint32_t)(unif_vc+(s->mvs_base[job][3 ] - (uint32_t*)s->unif_mvs_ptr[job].arm)), ++ (uint32_t)(unif_vc+(s->mvs_base[job][4 ] - (uint32_t*)s->unif_mvs_ptr[job].arm)), ++ (uint32_t)(unif_vc+(s->mvs_base[job][5 ] - (uint32_t*)s->unif_mvs_ptr[job].arm)), ++ (uint32_t)(unif_vc+(s->mvs_base[job][6 ] - (uint32_t*)s->unif_mvs_ptr[job].arm)), ++ (uint32_t)(unif_vc+(s->mvs_base[job][7 ] - (uint32_t*)s->unif_mvs_ptr[job].arm)) + ); + #endif + +@@ -3400,6 +3596,11 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) + } + } + ++#ifdef RPI_WORKER ++ s->pass0_job = 0; ++ s->pass1_job = 0; ++ s->pass2_job = 0; ++#endif + #ifdef RPI_INTER_QPU + rpi_inter_clear(s); + #endif +@@ -3420,46 +3621,42 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) + s->filter_slice_edges[ctb_addr_rs] = s->sh.slice_loop_filter_across_slices_enabled_flag; + + more_data = hls_coding_quadtree(s, x_ctb, y_ctb, s->ps.sps->log2_ctb_size, 0); ++ + #ifdef RPI + if (s->enable_rpi) { +- s->dblk_cmds[s->num_dblk_cmds][0] = x_ctb; +- s->dblk_cmds[s->num_dblk_cmds++][1] = y_ctb; ++ s->dblk_cmds[s->pass0_job][s->num_dblk_cmds[s->pass0_job]][0] = x_ctb; ++ s->dblk_cmds[s->pass0_job][s->num_dblk_cmds[s->pass0_job]++][1] = y_ctb; + if ( (((y_ctb + ctb_size)&63) == 0) && x_ctb + ctb_size >= s->ps.sps->width) { +- // Transform all blocks +- // printf("%d %d %d : %d %d %d %d\n",s->poc, x_ctb, y_ctb, s->num_pred_cmds,s->num_mv_cmds,s->num_coeffs[2] >> 8,s->num_coeffs[3] >> 10); +-#ifdef RPI_MULTI_MAILBOX +- // Kick off inter prediction on QPUs +- rpi_execute_inter_qpu(s); +- // Perform luma inter prediction +- rpi_execute_inter_cmds(s); +-#else +- rpi_execute_transform(s); +- // Perform inter prediction +- rpi_execute_inter_cmds(s); +-#ifdef RPI_INTER_QPU +- // Kick off inter prediction on QPUs +- rpi_execute_inter_qpu(s); +-#endif +-#endif +- +- // Wait for transform completion +- vpu_wait(s->vpu_id); +- +- // Copy back reconstructed data +- //memcpy(s->frame->data[0],s->dummy.arm,2048*64); +- //memcpy(s->frame->data[1],s->dummy.arm,1024*32); +- //memcpy(s->frame->data[2],s->dummy.arm,1024*32); ++#ifdef RPI_WORKER ++ if (s->used_for_ref) { ++ // Split work load onto separate threads so we make as rapid progress as possible with this frame ++ #ifdef INTER_PASS0 ++ rpi_execute_inter_cmds(s); ++ #endif ++ #ifdef LAUNCH_PASS0 ++ rpi_execute_inter_qpu(s); ++ #endif ++ // Pass on this job to worker thread ++ worker_submit_job(s); ++ // Make sure we have space to prepare the next job ++ worker_pass0_ready(s); + +- // Perform intra prediction and residual reconstruction +- rpi_execute_pred_cmds(s); +- // Perform deblocking for CTBs in this row +- rpi_execute_dblk_cmds(s); ++ // Prepare the next batch of commands + #ifdef RPI_INTER_QPU +- rpi_inter_clear(s); ++ rpi_inter_clear(s); ++#endif ++ } else { ++ // Non-ref frame so do it all on this thread ++ rpi_do_all_passes(s); ++ } ++#else ++ rpi_do_all_passes(s); + #endif + } + } + #endif ++ ++ + if (more_data < 0) { + s->tab_slice_address[ctb_addr_rs] = -1; + return more_data; +@@ -3476,18 +3673,21 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) + } + + #ifdef RPI +- if (s->enable_rpi && s->num_dblk_cmds) { +-#ifdef RPI_INTER_QPU +- rpi_execute_inter_qpu(s); +-#endif +-#ifndef RPI_MULTI_MAILBOX +- rpi_execute_transform(s); ++ ++#ifdef RPI_WORKER ++ // Wait for the worker to finish all its jobs ++ if (s->enable_rpi) { ++ worker_wait(s); ++ av_assert0(s->pass0_job==s->pass1_job); ++ av_assert0(s->pass1_job==s->pass2_job); ++ } + #endif +- rpi_execute_inter_cmds(s); +- vpu_wait(s->vpu_id); +- rpi_execute_pred_cmds(s); +- rpi_execute_dblk_cmds(s); ++ ++ // Finish off any half-completed rows ++ if (s->enable_rpi && s->num_dblk_cmds[s->pass0_job]) { ++ rpi_do_all_passes(s); + } ++ + #endif + + if (x_ctb + ctb_size >= s->ps.sps->width && +@@ -4219,6 +4419,48 @@ fail: + return AVERROR(ENOMEM); + } + ++#ifdef RPI_WORKER ++static av_cold void hevc_init_worker(HEVCContext *s) ++{ ++ int err; ++ pthread_cond_init(&s->worker_cond_head, NULL); ++ pthread_cond_init(&s->worker_cond_middle, NULL); ++ pthread_cond_init(&s->worker_cond_tail, NULL); ++ pthread_mutex_init(&s->worker_mutex, NULL); ++ ++ s->worker_tail=0; ++ s->worker_middle=0; ++ s->worker_head=0; ++ s->kill_worker=0; ++ err = pthread_create(&s->worker_thread, NULL, worker_start, s); ++ err = pthread_create(&s->worker_deblock_thread, NULL, worker_deblock_start, s); ++ if (err) { ++ printf("Failed to create worker thread\n"); ++ exit(-1); ++ } ++} ++ ++static av_cold void hevc_exit_worker(HEVCContext *s) ++{ ++ void *res; ++ s->kill_worker=1; ++ pthread_cond_broadcast(&s->worker_cond_tail); ++ pthread_cond_broadcast(&s->worker_cond_middle); ++ pthread_join(s->worker_thread, &res); ++ pthread_join(s->worker_deblock_thread, &res); ++ ++ pthread_cond_destroy(&s->worker_cond_head); ++ pthread_cond_destroy(&s->worker_cond_middle); ++ pthread_cond_destroy(&s->worker_cond_tail); ++ pthread_mutex_destroy(&s->worker_mutex); ++ ++ s->worker_tail=0; ++ s->worker_middle=0; ++ s->worker_head=0; ++ s->kill_worker=0; ++} ++#endif ++ + static av_cold int hevc_decode_free(AVCodecContext *avctx) + { + HEVCContext *s = avctx->priv_data; +@@ -4231,33 +4473,29 @@ static av_cold int hevc_decode_free(AVCodecContext *avctx) + av_freep(&s->cabac_state); + + #ifdef RPI +- av_freep(&s->unif_mv_cmds); +- av_freep(&s->univ_pred_cmds); ++ ++#ifdef RPI_WORKER ++ hevc_exit_worker(s); ++#endif ++ ++ for(i=0;i<RPI_MAX_JOBS;i++) { ++ av_freep(&s->unif_mv_cmds[i]); ++ av_freep(&s->univ_pred_cmds[i]); + + #ifdef RPI_INTER_QPU +- if (s->unif_mvs) { +- gpu_free( &s->unif_mvs_ptr ); +- s->unif_mvs = 0; +- } ++ if (s->unif_mvs[i]) { ++ gpu_free( &s->unif_mvs_ptr[i] ); ++ s->unif_mvs[i] = 0; ++ } + #endif + #ifdef RPI_LUMA_QPU +- if (s->y_unif_mvs) { +- gpu_free( &s->y_unif_mvs_ptr ); +- s->y_unif_mvs = 0; +- } ++ if (s->y_unif_mvs[i]) { ++ gpu_free( &s->y_unif_mvs_ptr[i] ); ++ s->y_unif_mvs[i] = 0; ++ } + #endif +- +-#ifdef EARLY_MALLOC +- printf("hevc_decode_free\n"); +- if (s->coeffs_buf_arm[0]) { +- gpu_free(&s->coeffs_buf_default); +- s->coeffs_buf_arm[0] = 0; +- } +- if (s->coeffs_buf_arm[2]) { +- gpu_free(&s->coeffs_buf_accelerated); +- s->coeffs_buf_arm[2] = 0; + } +-#endif ++ + #endif + + for (i = 0; i < 3; i++) { +@@ -4322,6 +4560,7 @@ static av_cold int hevc_init_context(AVCodecContext *avctx) + { + HEVCContext *s = avctx->priv_data; + int i; ++ int job; + + s->avctx = avctx; + +@@ -4332,12 +4571,14 @@ static av_cold int hevc_init_context(AVCodecContext *avctx) + s->sList[0] = s; + + #ifdef RPI +- s->unif_mv_cmds = av_mallocz(sizeof(HEVCMvCmd)*RPI_MAX_MV_CMDS); +- if (!s->unif_mv_cmds) +- goto fail; +- s->univ_pred_cmds = av_mallocz(sizeof(HEVCPredCmd)*RPI_MAX_PRED_CMDS); +- if (!s->univ_pred_cmds) +- goto fail; ++ for(job=0;job<RPI_MAX_JOBS;job++) { ++ s->unif_mv_cmds[job] = av_mallocz(sizeof(HEVCMvCmd)*RPI_MAX_MV_CMDS); ++ if (!s->unif_mv_cmds[job]) ++ goto fail; ++ s->univ_pred_cmds[job] = av_mallocz(sizeof(HEVCPredCmd)*RPI_MAX_PRED_CMDS); ++ if (!s->univ_pred_cmds[job]) ++ goto fail; ++ } + + #ifdef RPI_INTER_QPU + // We divide the image into blocks 256 wide and 64 high +@@ -4348,18 +4589,20 @@ static av_cold int hevc_init_context(AVCodecContext *avctx) + { + int uv_commands_per_qpu = UV_COMMANDS_PER_QPU; + uint32_t *p; ++ for(job=0;job<RPI_MAX_JOBS;job++) { + #ifdef RPI_CACHE_UNIF_MVS +- gpu_malloc_cached( 8 * uv_commands_per_qpu * sizeof(uint32_t), &s->unif_mvs_ptr ); ++ gpu_malloc_cached( 8 * uv_commands_per_qpu * sizeof(uint32_t), &s->unif_mvs_ptr[job] ); + #else +- gpu_malloc_uncached( 8 * uv_commands_per_qpu * sizeof(uint32_t), &s->unif_mvs_ptr ); ++ gpu_malloc_uncached( 8 * uv_commands_per_qpu * sizeof(uint32_t), &s->unif_mvs_ptr[job] ); + #endif +- s->unif_mvs = (uint32_t *) s->unif_mvs_ptr.arm; // TODO support this allocation in non EARLY_MALLOC ++ s->unif_mvs[job] = (uint32_t *) s->unif_mvs_ptr[job].arm; + +- // Set up initial locations for uniform streams +- p = s->unif_mvs; +- for(i = 0; i < 8; i++) { +- s->mvs_base[i] = p; ++ // Set up initial locations for uniform streams ++ p = s->unif_mvs[job]; ++ for(i = 0; i < 8; i++) { ++ s->mvs_base[job][i] = p; + p += uv_commands_per_qpu; ++ } + } + s->mc_filter_uv = qpu_get_fn(QPU_MC_FILTER_UV); + s->mc_filter_uv_b0 = qpu_get_fn(QPU_MC_FILTER_UV_B0); +@@ -4368,61 +4611,35 @@ static av_cold int hevc_init_context(AVCodecContext *avctx) + } + #endif + #ifdef RPI_LUMA_QPU ++ for(job=0;job<RPI_MAX_JOBS;job++) + { + int y_commands_per_qpu = Y_COMMANDS_PER_QPU; + uint32_t *p; + #ifdef RPI_CACHE_UNIF_MVS +- gpu_malloc_cached( 12 * y_commands_per_qpu * sizeof(uint32_t), &s->y_unif_mvs_ptr ); ++ gpu_malloc_cached( 12 * y_commands_per_qpu * sizeof(uint32_t), &s->y_unif_mvs_ptr[job] ); + #else +- gpu_malloc_uncached( 12 * y_commands_per_qpu * sizeof(uint32_t), &s->y_unif_mvs_ptr ); ++ gpu_malloc_uncached( 12 * y_commands_per_qpu * sizeof(uint32_t), &s->y_unif_mvs_ptr[job] ); + #endif +- s->y_unif_mvs = (uint32_t *) s->y_unif_mvs_ptr.arm; // TODO support this allocation in non EARLY_MALLOC ++ s->y_unif_mvs[job] = (uint32_t *) s->y_unif_mvs_ptr[job].arm; + + // Set up initial locations for uniform streams +- p = s->y_unif_mvs; ++ p = s->y_unif_mvs[job]; + for(i = 0; i < 12; i++) { +- s->y_mvs_base[i] = p; ++ s->y_mvs_base[job][i] = p; + p += y_commands_per_qpu; + } +- s->mc_filter = qpu_get_fn(QPU_MC_FILTER); +- s->mc_filter_b = qpu_get_fn(QPU_MC_FILTER_B); +- + } ++ s->mc_filter = qpu_get_fn(QPU_MC_FILTER); ++ s->mc_filter_b = qpu_get_fn(QPU_MC_FILTER_B); + #endif + //gpu_malloc_uncached(2048*64,&s->dummy); + +-#ifdef EARLY_MALLOC +- { +- int coeffs_in_ctb = 64*64; +- int coefs_per_row = (2048/64) * coeffs_in_ctb * 3; // Allow space for chroma +- s->coeffs_buf_arm[0] = 0; +- s->coeffs_buf_arm[2] = 0; +- printf("Allocated %d\n",coefs_per_row); +- gpu_malloc_cached(sizeof(int16_t) * coefs_per_row, &s->coeffs_buf_default); +- s->coeffs_buf_arm[0] = (int16_t*) s->coeffs_buf_default.arm; +- if (!s->coeffs_buf_arm[0]) +- goto fail; +- gpu_malloc_cached(sizeof(int16_t) * coefs_per_row * 2, &s->coeffs_buf_accelerated); +- s->coeffs_buf_arm[2] = (int16_t*) s->coeffs_buf_accelerated.arm; +- s->coeffs_buf_vc[2] = s->coeffs_buf_accelerated.vc; +- if (!s->coeffs_buf_arm[2]) +- goto fail; +- s->coeffs_buf_arm[3] = coefs_per_row + s->coeffs_buf_arm[2]; +- s->coeffs_buf_vc[3] = sizeof(int16_t) * coefs_per_row + s->coeffs_buf_vc[2]; +- printf("Done\n"); +-#ifdef RPI_PRECLEAR +- //memset(s->coeffs_buf_arm[0],0, sizeof(int16_t) * coefs_per_row); +- memclear16(s->coeffs_buf_arm[0], coefs_per_row); +- //memset(s->coeffs_buf_arm[2],0, sizeof(int16_t) * coefs_per_row); +- memclear16(s->coeffs_buf_arm[2], coefs_per_row); +- //memset(s->coeffs_buf_arm[3],0, sizeof(int16_t) * coefs_per_row); +- memclear16(s->coeffs_buf_arm[3], coefs_per_row); +-#endif +- } +-#endif +- + s->enable_rpi = 0; + ++#ifdef RPI_WORKER ++ hevc_init_worker(s); ++#endif ++ + #endif + + s->cabac_state = av_malloc(HEVC_CONTEXTS); +diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h +index 520d16f..b540ca5 100644 +--- a/libavcodec/hevc.h ++++ b/libavcodec/hevc.h +@@ -50,6 +50,12 @@ + // Define RPI_LUMA_QPU to also use QPU for luma inter prediction + #define RPI_LUMA_QPU + #endif ++ ++ // By passing jobs to a worker thread we hope to be able to catch up during slow frames ++ #define RPI_MAX_JOBS 2 ++ // Define RPI_WORKER to launch a worker thread for pixel processing tasks ++ #define RPI_WORKER ++ + #endif + + #define MAX_DPB_SIZE 16 // A.4.1 +@@ -832,6 +838,13 @@ typedef struct HEVCLocalContext { + int boundary_flags; + } HEVCLocalContext; + ++#ifdef RPI_WORKER ++typedef struct HEVCLocalContextIntra { ++ TransformUnit tu; ++ NeighbourAvailable na; ++} HEVCLocalContextIntra; ++#endif ++ + #ifdef RPI + + // RPI_MAX_WIDTH is maximum width in pixels supported by the accelerated code +@@ -900,7 +913,7 @@ typedef struct HEVCPredCmd { + + typedef struct HEVCContext { + #ifdef RPI +- int dblk_cmds[RPI_MAX_DEBLOCK_CMDS][2]; ++ int dblk_cmds[RPI_MAX_JOBS][RPI_MAX_DEBLOCK_CMDS][2]; + #endif + const AVClass *c; // needed by private avoptions + AVCodecContext *avctx; +@@ -909,7 +922,9 @@ typedef struct HEVCContext { + + HEVCLocalContext *HEVClcList[MAX_NB_THREADS]; + HEVCLocalContext *HEVClc; +- ++#ifdef RPI_WORKER ++ HEVCLocalContextIntra HEVClcIntra; ++#endif + uint8_t threads_type; + uint8_t threads_number; + +@@ -920,43 +935,60 @@ typedef struct HEVCContext { + + #ifdef RPI + int enable_rpi; +- HEVCMvCmd *unif_mv_cmds; +- HEVCPredCmd *univ_pred_cmds; ++ HEVCMvCmd *unif_mv_cmds[RPI_MAX_JOBS]; ++ HEVCPredCmd *univ_pred_cmds[RPI_MAX_JOBS]; + int buf_width; +- GPU_MEM_PTR_T coeffs_buf_default; +- GPU_MEM_PTR_T coeffs_buf_accelerated; +- int16_t *coeffs_buf_arm[4]; +- unsigned int coeffs_buf_vc[4]; +- int num_coeffs[4]; +- int num_xfm_cmds; +- int num_mv_cmds; +- int num_pred_cmds; +- int num_dblk_cmds; ++ GPU_MEM_PTR_T coeffs_buf_default[RPI_MAX_JOBS]; ++ GPU_MEM_PTR_T coeffs_buf_accelerated[RPI_MAX_JOBS]; ++ int16_t *coeffs_buf_arm[RPI_MAX_JOBS][4]; ++ unsigned int coeffs_buf_vc[RPI_MAX_JOBS][4]; ++ int num_coeffs[RPI_MAX_JOBS][4]; ++ int num_xfm_cmds[RPI_MAX_JOBS]; ++ int num_mv_cmds[RPI_MAX_JOBS]; ++ int num_pred_cmds[RPI_MAX_JOBS]; ++ int num_dblk_cmds[RPI_MAX_JOBS]; + int vpu_id; + //GPU_MEM_PTR_T dummy; ++ int pass0_job; // Pass0 does coefficient decode ++ int pass1_job; // Pass1 does pixel processing ++ int pass2_job; // Pass2 does reconstruction and deblocking + #ifdef RPI_INTER_QPU +- GPU_MEM_PTR_T unif_mvs_ptr; +- uint32_t *unif_mvs; // Base of memory for motion vector commands ++ GPU_MEM_PTR_T unif_mvs_ptr[RPI_MAX_JOBS]; ++ uint32_t *unif_mvs[RPI_MAX_JOBS]; // Base of memory for motion vector commands + + // _base pointers are to the start of the row +- uint32_t *mvs_base[8]; ++ uint32_t *mvs_base[RPI_MAX_JOBS][8]; + // these pointers are to the next free space +- uint32_t *u_mvs[8]; ++ uint32_t *u_mvs[RPI_MAX_JOBS][8]; + // Function pointers + uint32_t mc_filter_uv; + uint32_t mc_filter_uv_b0; + uint32_t mc_filter_uv_b; + #endif + #ifdef RPI_LUMA_QPU +- GPU_MEM_PTR_T y_unif_mvs_ptr; +- uint32_t *y_unif_mvs; // Base of memory for motion vector commands +- uint32_t *y_mvs_base[12]; +- uint32_t *y_mvs[12]; ++ GPU_MEM_PTR_T y_unif_mvs_ptr[RPI_MAX_JOBS]; ++ uint32_t *y_unif_mvs[RPI_MAX_JOBS]; // Base of memory for motion vector commands ++ uint32_t *y_mvs_base[RPI_MAX_JOBS][12]; ++ uint32_t *y_mvs[RPI_MAX_JOBS][12]; + // Function pointers + uint32_t mc_filter; + uint32_t mc_filter_b; + #endif + ++#ifdef RPI_WORKER ++ pthread_t worker_thread; ++ pthread_t worker_deblock_thread; ++ pthread_cond_t worker_cond_head; ++ pthread_cond_t worker_cond_tail; ++ pthread_cond_t worker_cond_middle; ++ pthread_mutex_t worker_mutex; ++ ++ int worker_tail; // Contains the number of posted jobs ++ int worker_head; // Contains the number of completed jobs ++ int worker_middle; // Contains the number of completed jobs ++ int kill_worker; // set to 1 to terminate the worker ++#endif ++ + #endif + + uint8_t *cabac_state; +diff --git a/libavcodec/hevc_cabac.c b/libavcodec/hevc_cabac.c +index ca76cb0..b9f773b 100644 +--- a/libavcodec/hevc_cabac.c ++++ b/libavcodec/hevc_cabac.c +@@ -1051,11 +1051,11 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, + if (s->enable_rpi) { + int n = trafo_size * trafo_size; + if (use_vpu) { +- coeffs = s->coeffs_buf_arm[log2_trafo_size - 2] + s->num_coeffs[log2_trafo_size - 2]; +- s->num_coeffs[log2_trafo_size - 2] += n; ++ coeffs = s->coeffs_buf_arm[s->pass0_job][log2_trafo_size - 2] + s->num_coeffs[s->pass0_job][log2_trafo_size - 2]; ++ s->num_coeffs[s->pass0_job][log2_trafo_size - 2] += n; + } else { +- coeffs = s->coeffs_buf_arm[0] + s->num_coeffs[0]; +- s->num_coeffs[0] += n; ++ coeffs = s->coeffs_buf_arm[s->pass0_job][0] + s->num_coeffs[s->pass0_job][0]; ++ s->num_coeffs[s->pass0_job][0] += n; + } + } + // We now do the memset after transform_add while we know the data is cached. +@@ -1508,7 +1508,7 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, + s->hevcdsp.transform_rdpcm(coeffs, log2_trafo_size, mode); + } + } else if (lc->cu.pred_mode == MODE_INTRA && c_idx == 0 && log2_trafo_size == 2) { +- s->hevcdsp.idct_4x4_luma(coeffs); ++ s->hevcdsp.idct_4x4_luma(coeffs); + } else { + #ifdef RPI + if (!use_vpu) { +@@ -1553,7 +1553,7 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, + } + #ifdef RPI + if (s->enable_rpi) { +- HEVCPredCmd *cmd = s->univ_pred_cmds + s->num_pred_cmds++; ++ HEVCPredCmd *cmd = s->univ_pred_cmds[s->pass0_job] + s->num_pred_cmds[s->pass0_job]++; + cmd->type = RPI_PRED_TRANSFORM_ADD; + cmd->size = log2_trafo_size; + cmd->buf = coeffs; +diff --git a/libavcodec/hevcpred_template.c b/libavcodec/hevcpred_template.c +index 71c6d52..344e021 100644 +--- a/libavcodec/hevcpred_template.c ++++ b/libavcodec/hevcpred_template.c +@@ -71,8 +71,11 @@ do { \ + AV_WN4P(&ptr[i], a); \ + else \ + a = PIXEL_SPLAT_X4(ptr[i + 3]) +- ++#ifdef RPI_WORKER ++ HEVCLocalContextIntra *lc = &s->HEVClcIntra; ++#else + HEVCLocalContext *lc = s->HEVClc; ++#endif + int i; + int hshift = s->ps.sps->hshift[c_idx]; + int vshift = s->ps.sps->vshift[c_idx]; +-- +2.5.0 + + +From ec8c58875a457dcda45e8bbe1edc0efec41e4707 Mon Sep 17 00:00:00 2001 +From: Peter de Rivaz <peter.derivaz@gmail.com> +Date: Wed, 3 Jun 2015 13:43:48 +0100 +Subject: [PATCH 54/68] Avoid lockup bug with RPI_WORKER enabled + +--- + libavcodec/hevc.c | 22 +++++++++++----------- + libavcodec/hevc_cabac.c | 1 - + 2 files changed, 11 insertions(+), 12 deletions(-) + +diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c +index 6f67872..865f5ec 100644 +--- a/libavcodec/hevc.c ++++ b/libavcodec/hevc.c +@@ -133,11 +133,11 @@ static uint32_t get_vc_address(AVBufferRef *bref) { + static void worker_submit_job(HEVCContext *s) + { + LOG_ENTER +- //pthread_mutex_lock(&s->worker_mutex); +- s->worker_tail++; // This is the only place that can change tail so we do not need the mutex ++ pthread_mutex_lock(&s->worker_mutex); ++ s->worker_tail++; + s->pass0_job = (s->pass0_job + 1) % RPI_MAX_JOBS; // Move onto the next slot + pthread_cond_broadcast(&s->worker_cond_tail); // Let people know that the tail has moved +- //pthread_mutex_unlock(&s->worker_mutex); ++ pthread_mutex_unlock(&s->worker_mutex); + LOG_EXIT + } + +@@ -145,11 +145,11 @@ static void worker_submit_job(HEVCContext *s) + static void worker_complete_middle_job(HEVCContext *s) + { + LOG_ENTER +- //pthread_mutex_lock(&s->worker_mutex); +- s->worker_middle++; // This is the only place that can change head so we do not need the mutex ++ pthread_mutex_lock(&s->worker_mutex); ++ s->worker_middle++; + s->pass1_job = (s->pass1_job + 1) % RPI_MAX_JOBS; // Move onto the next slot +- pthread_cond_broadcast(&s->worker_cond_middle); // Let people know that the tail has moved +- //pthread_mutex_unlock(&s->worker_mutex); ++ pthread_cond_broadcast(&s->worker_cond_middle); // Let people know that the middle has moved ++ pthread_mutex_unlock(&s->worker_mutex); + LOG_EXIT + } + +@@ -157,11 +157,11 @@ static void worker_complete_middle_job(HEVCContext *s) + static void worker_complete_job(HEVCContext *s) + { + LOG_ENTER +- //pthread_mutex_lock(&s->worker_mutex); +- s->worker_head++; // This is the only place that can change head so we do not need the mutex ++ pthread_mutex_lock(&s->worker_mutex); ++ s->worker_head++; + s->pass2_job = (s->pass2_job + 1) % RPI_MAX_JOBS; // Move onto the next slot +- pthread_cond_broadcast(&s->worker_cond_head); // Let people know that the tail has moved +- //pthread_mutex_unlock(&s->worker_mutex); ++ pthread_cond_broadcast(&s->worker_cond_head); // Let people know that the head has moved ++ pthread_mutex_unlock(&s->worker_mutex); + LOG_EXIT + } + +diff --git a/libavcodec/hevc_cabac.c b/libavcodec/hevc_cabac.c +index b9f773b..16e7ac3 100644 +--- a/libavcodec/hevc_cabac.c ++++ b/libavcodec/hevc_cabac.c +@@ -1497,7 +1497,6 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, + for (i = 0; i < 8; i++) + FFSWAP(int16_t, coeffs[i], coeffs[16 - i - 1]); + } +- + s->hevcdsp.transform_skip(coeffs, log2_trafo_size); + + if (explicit_rdpcm_flag || (s->ps.sps->implicit_rdpcm_enabled_flag && +-- +2.5.0 + + +From d9e7ab6809af47b65372b9fd99e2d519c3d44b10 Mon Sep 17 00:00:00 2001 +From: Peter de Rivaz <peter.derivaz@gmail.com> +Date: Wed, 3 Jun 2015 15:37:19 +0100 +Subject: [PATCH 55/68] Added code to flush buffers at start of frame + +--- + libavcodec/hevc.c | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 72 insertions(+) + +diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c +index 865f5ec..3a94830 100644 +--- a/libavcodec/hevc.c ++++ b/libavcodec/hevc.c +@@ -43,6 +43,7 @@ + + #ifdef RPI + #include "rpi_qpu.h" ++ #include "rpi_user_vcsm.h" + // Move Inter prediction into separate pass + #define RPI_INTER + +@@ -3497,6 +3498,7 @@ static void rpi_execute_inter_qpu(HEVCContext *s) + #else + gpu_cache_flush(&s->coeffs_buf_accelerated[job]); + #endif ++ + s->vpu_id = vpu_qpu_post_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf_vc[job][2], s->num_coeffs[job][2] >> 8, s->coeffs_buf_vc[job][3], s->num_coeffs[job][3] >> 10, 0, + qpu_get_fn(QPU_MC_SETUP_UV), + (uint32_t)(unif_vc+(s->mvs_base[job][0 ] - (uint32_t*)s->unif_mvs_ptr[job].arm)), +@@ -3547,6 +3549,71 @@ static void rpi_execute_inter_qpu(HEVCContext *s) + } + #endif + ++#ifdef RPI ++ ++static void flush_buffer(AVBufferRef *bref) { ++ GPU_MEM_PTR_T *p = av_buffer_pool_opaque(bref); ++ gpu_cache_flush(p); ++} ++ ++static void flush_frame(HEVCContext *s,AVFrame *frame) ++{ ++#if 1 ++ struct vcsm_user_clean_invalid_s iocache = {}; ++ int n = s->ps.sps->height; ++ int curr_y = 0; ++ int curr_uv = 0; ++ int n_uv = n >> s->ps.sps->vshift[1]; ++ int sz,base; ++ sz = s->frame->linesize[1] * (n_uv-curr_uv); ++ base = s->frame->linesize[1] * curr_uv; ++ GPU_MEM_PTR_T *p = av_buffer_pool_opaque(frame->buf[1]); ++ iocache.s[0].handle = p->vcsm_handle; ++ iocache.s[0].cmd = 3; // clean+invalidate ++ iocache.s[0].addr = p->arm + base; ++ iocache.s[0].size = sz; ++ p = av_buffer_pool_opaque(frame->buf[2]); ++ iocache.s[1].handle = p->vcsm_handle; ++ iocache.s[1].cmd = 3; // clean+invalidate ++ iocache.s[1].addr = p->arm + base; ++ iocache.s[1].size = sz; ++ p = av_buffer_pool_opaque(frame->buf[0]); ++ sz = s->frame->linesize[0] * (n-curr_y); ++ base = s->frame->linesize[0] * curr_y; ++ iocache.s[2].handle = p->vcsm_handle; ++ iocache.s[2].cmd = 3; // clean+invalidate ++ iocache.s[2].addr = p->arm + base; ++ iocache.s[2].size = sz; ++ vcsm_clean_invalid( &iocache ); ++#else ++ flush_buffer(frame->buf[0]); ++ flush_buffer(frame->buf[1]); ++ flush_buffer(frame->buf[2]); ++#endif ++} ++ ++static void flush_all(HEVCContext *s) ++{ ++#if 0 ++ struct vcsm_user_clean_invalid_s iocache = {}; ++ GPU_MEM_PTR_T *p = av_buffer_pool_opaque(s->frame->buf[0]); ++ iocache.s[0].handle = p->vcsm_handle; ++ iocache.s[0].cmd = 4; // Flush all ++ iocache.s[0].addr = p->arm; ++ iocache.s[0].size = 4096; ++ vcsm_clean_invalid( &iocache ); ++#else ++ int i,k; ++ for(i=0;i<2;i++) { ++ for (k = 0; k < s->sh.nb_refs[i]; k++) { ++ flush_frame(s,s->ref->refPicList[i].ref[k]->frame); ++ } ++ } ++ flush_frame(s,s->frame); ++#endif ++} ++#endif ++ + static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) + { + HEVCContext *s = avctxt->priv_data; +@@ -3581,8 +3648,12 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) + printf("Weighted B slice\n"); + } + ++ // Now flush all reference frames and our destination frame to get everything ready for decode ++ flush_all(s); + #endif + ++ //printf("L0=%d L1=%d\n",s->sh.nb_refs[L1],s->sh.nb_refs[L1]); ++ + if (!ctb_addr_ts && s->sh.dependent_slice_segment_flag) { + av_log(s->avctx, AV_LOG_ERROR, "Impossible initial tile.\n"); + return AVERROR_INVALIDDATA; +@@ -3653,6 +3724,7 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) + rpi_do_all_passes(s); + #endif + } ++ + } + #endif + +-- +2.5.0 + + +From 2e0fc42393a67cc61d84311640d1e44b32f2bffb Mon Sep 17 00:00:00 2001 +From: Peter de Rivaz <peter.derivaz@gmail.com> +Date: Wed, 3 Jun 2015 16:42:24 +0100 +Subject: [PATCH 56/68] Reduce the amount that needs to be flushed + +--- + libavcodec/hevc.c | 35 +++++++++++------------------------ + 1 file changed, 11 insertions(+), 24 deletions(-) + +diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c +index 3a94830..3fcbc57 100644 +--- a/libavcodec/hevc.c ++++ b/libavcodec/hevc.c +@@ -3558,7 +3558,7 @@ static void flush_buffer(AVBufferRef *bref) { + + static void flush_frame(HEVCContext *s,AVFrame *frame) + { +-#if 1 ++#ifdef RPI_FAST_CACHEFLUSH + struct vcsm_user_clean_invalid_s iocache = {}; + int n = s->ps.sps->height; + int curr_y = 0; +@@ -3592,26 +3592,6 @@ static void flush_frame(HEVCContext *s,AVFrame *frame) + #endif + } + +-static void flush_all(HEVCContext *s) +-{ +-#if 0 +- struct vcsm_user_clean_invalid_s iocache = {}; +- GPU_MEM_PTR_T *p = av_buffer_pool_opaque(s->frame->buf[0]); +- iocache.s[0].handle = p->vcsm_handle; +- iocache.s[0].cmd = 4; // Flush all +- iocache.s[0].addr = p->arm; +- iocache.s[0].size = 4096; +- vcsm_clean_invalid( &iocache ); +-#else +- int i,k; +- for(i=0;i<2;i++) { +- for (k = 0; k < s->sh.nb_refs[i]; k++) { +- flush_frame(s,s->ref->refPicList[i].ref[k]->frame); +- } +- } +- flush_frame(s,s->frame); +-#endif +-} + #endif + + static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) +@@ -3647,9 +3627,6 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) + if (s->ps.pps->weighted_bipred_flag && s->sh.slice_type == B_SLICE) + printf("Weighted B slice\n"); + } +- +- // Now flush all reference frames and our destination frame to get everything ready for decode +- flush_all(s); + #endif + + //printf("L0=%d L1=%d\n",s->sh.nb_refs[L1],s->sh.nb_refs[L1]); +@@ -4119,6 +4096,11 @@ static int hevc_frame_start(HEVCContext *s) + if (!s->avctx->hwaccel) + ff_thread_finish_setup(s->avctx); + ++#ifdef RPI_INTER_QPU ++ // Invalidate the output data buffer so it is ready for the QPUs to write into it. ++ flush_frame(s,s->frame); ++#endif ++ + return 0; + + fail: +@@ -4320,6 +4302,11 @@ fail: + ff_hevc_flush_buffer(s, &s->ref->tf, s->ps.sps->height); + #endif + ff_thread_report_progress(&s->ref->tf, INT_MAX, 0); ++ } else if (s->ref) { ++#ifdef RPI_INTER_QPU ++ // When running single threaded we need to flush the whole frame ++ flush_frame(s,s->frame); ++#endif + } + return ret; + } +-- +2.5.0 + + +From 0cc4754dcc1c36647d92c3f42be39f24d24c48a2 Mon Sep 17 00:00:00 2001 +From: Peter de Rivaz <peter.derivaz@gmail.com> +Date: Thu, 4 Jun 2015 07:59:28 +0100 +Subject: [PATCH 57/68] Corrected support for disabled rpi when using + RPI_WORKER + +--- + libavcodec/hevc.h | 18 ++++++++++-------- + libavcodec/hevcpred_template.c | 2 +- + 2 files changed, 11 insertions(+), 9 deletions(-) + +diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h +index b540ca5..c48d0cd 100644 +--- a/libavcodec/hevc.h ++++ b/libavcodec/hevc.h +@@ -795,7 +795,17 @@ typedef struct HEVCPacket { + int nals_allocated; + } HEVCPacket; + ++#ifdef RPI_WORKER ++typedef struct HEVCLocalContextIntra { ++ TransformUnit tu; ++ NeighbourAvailable na; ++} HEVCLocalContextIntra; ++#endif ++ + typedef struct HEVCLocalContext { ++ TransformUnit tu; ++ NeighbourAvailable na; // WARNING tu and na must be the first two fields to match HEVCLocalContextIntra ++ + uint8_t cabac_state[HEVC_CONTEXTS]; + + uint8_t stat_coeff[4]; +@@ -810,7 +820,6 @@ typedef struct HEVCLocalContext { + + int qPy_pred; + +- TransformUnit tu; + + uint8_t ctb_left_flag; + uint8_t ctb_up_flag; +@@ -827,7 +836,6 @@ typedef struct HEVCLocalContext { + int ct_depth; + CodingUnit cu; + PredictionUnit pu; +- NeighbourAvailable na; + + #define BOUNDARY_LEFT_SLICE (1 << 0) + #define BOUNDARY_LEFT_TILE (1 << 1) +@@ -838,12 +846,6 @@ typedef struct HEVCLocalContext { + int boundary_flags; + } HEVCLocalContext; + +-#ifdef RPI_WORKER +-typedef struct HEVCLocalContextIntra { +- TransformUnit tu; +- NeighbourAvailable na; +-} HEVCLocalContextIntra; +-#endif + + #ifdef RPI + +diff --git a/libavcodec/hevcpred_template.c b/libavcodec/hevcpred_template.c +index 344e021..325b60e 100644 +--- a/libavcodec/hevcpred_template.c ++++ b/libavcodec/hevcpred_template.c +@@ -72,7 +72,7 @@ do { \ + else \ + a = PIXEL_SPLAT_X4(ptr[i + 3]) + #ifdef RPI_WORKER +- HEVCLocalContextIntra *lc = &s->HEVClcIntra; ++ HEVCLocalContextIntra *lc = s->enable_rpi ? &s->HEVClcIntra : (HEVCLocalContextIntra *)s->HEVClc ; + #else + HEVCLocalContext *lc = s->HEVClc; + #endif +-- +2.5.0 + + +From b1ca5230c3a2e5e74945c6f06f75c5dcec62d9d0 Mon Sep 17 00:00:00 2001 +From: Peter de Rivaz <peter.derivaz@gmail.com> +Date: Thu, 4 Jun 2015 11:52:55 +0100 +Subject: [PATCH 58/68] Draft support for tiles + +--- + libavcodec/hevc.c | 140 +++++++++++++++++++++++------------------ + libavcodec/hevc.h | 21 +++++-- + libavcodec/hevc_filter.c | 2 +- + libavcodec/hevcpred_template.c | 2 +- + 4 files changed, 99 insertions(+), 66 deletions(-) + +diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c +index 3fcbc57..23c4e17 100644 +--- a/libavcodec/hevc.c ++++ b/libavcodec/hevc.c +@@ -63,10 +63,10 @@ + + static void rpi_execute_dblk_cmds(HEVCContext *s); + static void rpi_execute_transform(HEVCContext *s); +- static void rpi_execute_inter_qpu(HEVCContext *s); ++ static void rpi_launch_vpu_qpu(HEVCContext *s); + static void rpi_execute_pred_cmds(HEVCContext *s); + static void rpi_execute_inter_cmds(HEVCContext *s); +- static void rpi_inter_clear(HEVCContext *s); ++ static void rpi_begin(HEVCContext *s); + + // Define INTER_PASS0 to do inter prediction in first pass + //#define INTER_PASS0 +@@ -90,16 +90,18 @@ const uint8_t ff_hevc_pel_weight[65] = { [2] = 0, [4] = 1, [6] = 2, [8] = 3, [12 + + #ifdef RPI_INTER_QPU + ++// Each luma QPU processes 2*RPI_NUM_CHUNKS 64x64 blocks ++// Each chroma QPU processes 3*RPI_NUM_CHUNKS 64x64 blocks, but requires two commands for B blocks ++// For each block of 64*64 the smallest block size is 8x4 ++// We also need an extra command for the setup information ++ + #define RPI_CHROMA_COMMAND_WORDS 12 +-#define UV_COMMANDS_PER_QPU ((1 + (256*64*2)/(4*4)) * RPI_CHROMA_COMMAND_WORDS) ++#define UV_COMMANDS_PER_QPU ((1 + 3*RPI_NUM_CHUNKS*(64*64)*2/(8*4)) * RPI_CHROMA_COMMAND_WORDS) + // The QPU code for UV blocks only works up to a block width of 8 + #define RPI_CHROMA_BLOCK_WIDTH 8 + +-// Split image of 2048 into parts 64 wide +-// So some QPUs will have 3 blocks of 64 to do, and others 2 blocks for an image 2048 wide with 32 blocks across +-// For each block of 64*64 the smallest block size is 8x4 + #define RPI_LUMA_COMMAND_WORDS 9 +-#define Y_COMMANDS_PER_QPU ((1+3*(64*64)/(8*4)) * RPI_LUMA_COMMAND_WORDS) ++#define Y_COMMANDS_PER_QPU ((1+2*RPI_NUM_CHUNKS*(64*64)/(8*4)) * RPI_LUMA_COMMAND_WORDS) + + #define ENCODE_COEFFS(c0, c1, c2, c3) (((c0) & 0xff) | ((c1) & 0xff) << 8 | ((c2) & 0xff) << 16 | ((c3) & 0xff) << 24) + +@@ -216,7 +218,7 @@ static void *worker_start(void *arg) + LOG_ENTER + // printf("%d %d %d : %d %d %d %d\n",s->poc, x_ctb, y_ctb, s->num_pred_cmds,s->num_mv_cmds,s->num_coeffs[2] >> 8,s->num_coeffs[3] >> 10); + #ifndef LAUNCH_PASS0 +- rpi_execute_inter_qpu(s); ++ rpi_launch_vpu_qpu(s); + #endif + #ifndef INTER_PASS0 + // Perform inter prediction +@@ -322,9 +324,14 @@ static int pic_arrays_init(HEVCContext *s, const HEVCSPS *sps) + + #ifdef RPI + av_assert0(sps); +- int coeffs_in_ctb = (1 << sps->log2_ctb_size) * (1 << sps->log2_ctb_size); +- int coefs_per_row = sps->ctb_width * coeffs_in_ctb * 3; // Allow space for chroma ++ int coefs_in_ctb = (1 << sps->log2_ctb_size) * (1 << sps->log2_ctb_size); ++ int coefs_per_luma = 64*64*24*RPI_NUM_CHUNKS; ++ int coefs_per_chroma = (coefs_per_luma * 2) >> sps->vshift[1] >> sps->hshift[1]; ++ int coefs_per_row = coefs_per_luma + coefs_per_chroma; + int job; ++ s->max_ctu_count = coefs_per_luma / coefs_in_ctb; ++ s->ctu_per_y_chan = s->max_ctu_count / 12; ++ s->ctu_per_uv_chan = s->max_ctu_count / 8; + for(job=0;job<RPI_MAX_JOBS;job++) { + printf("Allocated %d\n",coefs_per_row); + for(job=0;job<RPI_MAX_JOBS;job++) { +@@ -2175,10 +2182,9 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, + int my2_mx2_my_mx = (my_mx << 16) + my_mx; + int x1 = x0 + (mv->x >> 2); + int y1 = y0 + (mv->y >> 2); +- int chan = x0>>6; // 64 wide blocks per QPU + int weight_flag = (s->sh.slice_type == P_SLICE && s->ps.pps->weighted_pred_flag) || + (s->sh.slice_type == B_SLICE && s->ps.pps->weighted_bipred_flag); +- uint32_t *y = s->y_mvs[s->pass0_job][chan % 12]; ++ uint32_t *y = s->curr_y_mvs; + for(int start_y=0;start_y < nPbH;start_y+=16) { // Potentially we could change the assembly code to support taller sizes in one go + for(int start_x=0;start_x < nPbW;start_x+=16) { + int bw = nPbW-start_x; +@@ -2198,7 +2204,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, + y++[-RPI_LUMA_COMMAND_WORDS] = s->mc_filter; + } + } +- s->y_mvs[s->pass0_job][chan % 12] = y; ++ s->curr_y_mvs = y; + } else + #endif + { +@@ -2222,12 +2228,10 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, + + int x1_c = x0_c + (mv->x >> (2 + hshift)); + int y1_c = y0_c + (mv->y >> (2 + hshift)); +- //int chan = x0>>8; // Allocate commands for the first 256 luma pixels across to the first QPU. This is optimised for images around 1920 width +- int chan = x0>>8; + int weight_flag = (s->sh.slice_type == P_SLICE && s->ps.pps->weighted_pred_flag) || + (s->sh.slice_type == B_SLICE && s->ps.pps->weighted_bipred_flag); + +- uint32_t *u = s->u_mvs[s->pass0_job][chan & 7]; ++ uint32_t *u = s->curr_u_mvs; + for(int start_y=0;start_y < nPbH_c;start_y+=16) { + for(int start_x=0;start_x < nPbW_c;start_x+=RPI_CHROMA_BLOCK_WIDTH) { + int bw = nPbW_c-start_x; +@@ -2251,7 +2255,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, + *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); + } + } +- s->u_mvs[s->pass0_job][chan & 7] = u; ++ s->curr_u_mvs = u; + return; + } + #endif +@@ -2278,10 +2282,9 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, + int my2_mx2_my_mx = (my_mx << 16) + my_mx; + int x1 = x0 + (mv->x >> 2); + int y1 = y0 + (mv->y >> 2); +- int chan = x0>>6; // 64 wide blocks per QPU + int weight_flag = (s->sh.slice_type == P_SLICE && s->ps.pps->weighted_pred_flag) || + (s->sh.slice_type == B_SLICE && s->ps.pps->weighted_bipred_flag); +- uint32_t *y = s->y_mvs[s->pass0_job][chan % 12]; ++ uint32_t *y = s->curr_y_mvs; + for(int start_y=0;start_y < nPbH;start_y+=16) { // Potentially we could change the assembly code to support taller sizes in one go + for(int start_x=0;start_x < nPbW;start_x+=16) { + int bw = nPbW-start_x; +@@ -2301,7 +2304,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, + y++[-RPI_LUMA_COMMAND_WORDS] = s->mc_filter; + } + } +- s->y_mvs[s->pass0_job][chan % 12] = y; ++ s->curr_y_mvs = y; + } else + #endif + +@@ -2326,12 +2329,10 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, + + int x1_c = x0_c + (mv->x >> (2 + hshift)); + int y1_c = y0_c + (mv->y >> (2 + hshift)); +- //int chan = x0>>8; // Allocate commands for the first 256 luma pixels across to the first QPU. This is optimised for images around 1920 width +- int chan = x0>>8; + int weight_flag = (s->sh.slice_type == P_SLICE && s->ps.pps->weighted_pred_flag) || + (s->sh.slice_type == B_SLICE && s->ps.pps->weighted_bipred_flag); + +- uint32_t *u = s->u_mvs[s->pass0_job][chan & 7]; ++ uint32_t *u = s->curr_u_mvs; + for(int start_y=0;start_y < nPbH_c;start_y+=16) { + for(int start_x=0;start_x < nPbW_c;start_x+=RPI_CHROMA_BLOCK_WIDTH) { + int bw = nPbW_c-start_x; +@@ -2356,7 +2357,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, + *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); + } + } +- s->u_mvs[s->pass0_job][chan & 7] = u; ++ s->curr_u_mvs = u; + return; + } + #endif +@@ -2389,8 +2390,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, + int y1 = y0 + (mv->y >> 2); + int x2 = x0 + (mv2->x >> 2); + int y2 = y0 + (mv2->y >> 2); +- int chan = x0>>6; // 64 wide blocks per QPU +- uint32_t *y = s->y_mvs[s->pass0_job][chan % 12]; ++ uint32_t *y = s->curr_y_mvs; + for(int start_y=0;start_y < nPbH;start_y+=16) { // Potentially we could change the assembly code to support taller sizes in one go + for(int start_x=0;start_x < nPbW;start_x+=8) { // B blocks work 8 at a time + int bw = nPbW-start_x; +@@ -2406,7 +2406,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, + y++[-RPI_LUMA_COMMAND_WORDS] = s->mc_filter_b; + } + } +- s->y_mvs[s->pass0_job][chan % 12] = y; ++ s->curr_y_mvs = y; + } else + #endif + { +@@ -2437,9 +2437,8 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, + int x2_c = x0_c + (mv2->x >> (2 + hshift)); + int y2_c = y0_c + (mv2->y >> (2 + hshift)); + +- int chan = x0>>8; // Allocate commands for the first 256 luma pixels across to the first QPU. This is optimised for images around 1920 width + +- uint32_t *u = s->u_mvs[s->pass0_job][chan & 7]; ++ uint32_t *u = s->curr_u_mvs; + for(int start_y=0;start_y < nPbH_c;start_y+=16) { + for(int start_x=0;start_x < nPbW_c;start_x+=RPI_CHROMA_BLOCK_WIDTH) { + int bw = nPbW_c-start_x; +@@ -2468,7 +2467,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, + *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); + } + } +- s->u_mvs[s->pass0_job][chan & 7] = u; ++ s->curr_u_mvs = u; + return; + } + #endif +@@ -3103,12 +3102,8 @@ static void rpi_execute_inter_cmds(HEVCContext *s) + + static void rpi_do_all_passes(HEVCContext *s) + { +-#ifdef RPI_INTER_QPU +- // Kick off inter prediction on QPUs +- rpi_execute_inter_qpu(s); +-#else +- rpi_execute_transform(s); +-#endif ++ // Kick off QPUs and VPUs ++ rpi_launch_vpu_qpu(s); + // Perform luma inter prediction + rpi_execute_inter_cmds(s); + // Wait for transform completion +@@ -3117,18 +3112,18 @@ static void rpi_do_all_passes(HEVCContext *s) + rpi_execute_pred_cmds(s); + // Perform deblocking for CTBs in this row + rpi_execute_dblk_cmds(s); +-#ifdef RPI_INTER_QPU +- rpi_inter_clear(s); +-#endif ++ // Prepare next batch ++ rpi_begin(s); + } + + #endif + +-#ifdef RPI_INTER_QPU +-static void rpi_inter_clear(HEVCContext *s) ++#ifdef RPI ++static void rpi_begin(HEVCContext *s) + { + int job = s->pass0_job; + int i; ++#ifdef RPI_INTER_QPU + int pic_width = s->ps.sps->width >> s->ps.sps->hshift[1]; + int pic_height = s->ps.sps->height >> s->ps.sps->vshift[1]; + int weight_flag = (s->sh.slice_type == P_SLICE && s->ps.pps->weighted_pred_flag) || +@@ -3154,6 +3149,8 @@ static void rpi_inter_clear(HEVCContext *s) + } + *s->u_mvs[job][i]++ = i; // Select section of VPM (avoid collisions with 3d unit) + } ++ s->curr_u_mvs = s->u_mvs[job][0]; ++#endif + + #ifdef RPI_LUMA_QPU + for(i=0;i<12;i++) { +@@ -3176,8 +3173,11 @@ static void rpi_inter_clear(HEVCContext *s) + } + *s->y_mvs[job][i]++ = 0; // Next kernel + } ++ s->curr_y_mvs = s->y_mvs[job][0]; + #endif ++ s->ctu_count = 0; + } ++#endif + + #ifdef RPI_SIMULATE_QPUS + +@@ -3448,8 +3448,9 @@ static void rpi_simulate_inter_qpu(HEVCContext *s) + + #endif + ++#ifdef RPI_INTER_QPU + +-static void rpi_execute_inter_qpu(HEVCContext *s) ++static void rpi_launch_vpu_qpu(HEVCContext *s) + { + int k; + #ifdef LAUNCH_PASS0 +@@ -3547,6 +3548,15 @@ static void rpi_execute_inter_qpu(HEVCContext *s) + + + } ++#else ++ ++#ifdef RPI ++static void rpi_launch_vpu_qpu(HEVCContext *s) ++{ ++ rpi_execute_transform(s); ++} ++#endif ++ + #endif + + #ifdef RPI +@@ -3606,29 +3616,20 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) + #ifdef RPI + #ifdef RPI_INTER_QPU + s->enable_rpi = s->ps.sps->bit_depth == 8 +- && s->ps.sps->width <= RPI_MAX_WIDTH + && !s->ps.pps->cross_component_prediction_enabled_flag +- && s->ps.pps->num_tile_rows <= 1 && s->ps.pps->num_tile_columns <= 1 + && !(s->ps.pps->weighted_bipred_flag && s->sh.slice_type == B_SLICE); + #else + s->enable_rpi = s->ps.sps->bit_depth == 8 +- && s->ps.sps->width <= RPI_MAX_WIDTH +- && !s->ps.pps->cross_component_prediction_enabled_flag +- && s->ps.pps->num_tile_rows <= 1 && s->ps.pps->num_tile_columns <= 1; ++ && !s->ps.pps->cross_component_prediction_enabled_flag; + #endif + + if (!s->enable_rpi) { + if (s->ps.pps->cross_component_prediction_enabled_flag) + printf("Cross component\n"); +- if (s->ps.pps->num_tile_rows > 1 || s->ps.pps->num_tile_columns > 1) +- printf("Tiles\n"); +- if (s->ps.pps->weighted_pred_flag && s->sh.slice_type == P_SLICE) +- printf("Weighted P slice\n"); + if (s->ps.pps->weighted_bipred_flag && s->sh.slice_type == B_SLICE) + printf("Weighted B slice\n"); + } + #endif +- + //printf("L0=%d L1=%d\n",s->sh.nb_refs[L1],s->sh.nb_refs[L1]); + + if (!ctb_addr_ts && s->sh.dependent_slice_segment_flag) { +@@ -3649,8 +3650,8 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) + s->pass1_job = 0; + s->pass2_job = 0; + #endif +-#ifdef RPI_INTER_QPU +- rpi_inter_clear(s); ++#ifdef RPI ++ rpi_begin(s); + #endif + + while (more_data && ctb_addr_ts < s->ps.sps->ctb_size) { +@@ -3668,13 +3669,34 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) + s->deblock[ctb_addr_rs].tc_offset = s->sh.tc_offset; + s->filter_slice_edges[ctb_addr_rs] = s->sh.slice_loop_filter_across_slices_enabled_flag; + ++#ifdef RPI_INTER_QPU ++ s->curr_u_mvs = s->u_mvs[s->pass0_job][s->ctu_count / s->ctu_per_uv_chan]; ++#endif ++#ifdef RPI_LUMA_QPU ++ s->curr_y_mvs = s->y_mvs[s->pass0_job][s->ctu_count / s->ctu_per_y_chan]; ++#endif ++ + more_data = hls_coding_quadtree(s, x_ctb, y_ctb, s->ps.sps->log2_ctb_size, 0); + ++#ifdef RPI_INTER_QPU ++ s->u_mvs[s->pass0_job][s->ctu_count / s->ctu_per_uv_chan] = s->curr_u_mvs; ++#endif ++#ifdef RPI_LUMA_QPU ++ s->y_mvs[s->pass0_job][s->ctu_count / s->ctu_per_y_chan] = s->curr_y_mvs; ++#endif ++ + #ifdef RPI + if (s->enable_rpi) { ++ //av_assert0(s->num_dblk_cmds[s->pass0_job]>=0); ++ //av_assert0(s->num_dblk_cmds[s->pass0_job]<RPI_MAX_DEBLOCK_CMDS); ++ //av_assert0(s->pass0_job<RPI_MAX_JOBS); ++ //av_assert0(s->pass0_job>=0); + s->dblk_cmds[s->pass0_job][s->num_dblk_cmds[s->pass0_job]][0] = x_ctb; + s->dblk_cmds[s->pass0_job][s->num_dblk_cmds[s->pass0_job]++][1] = y_ctb; +- if ( (((y_ctb + ctb_size)&63) == 0) && x_ctb + ctb_size >= s->ps.sps->width) { ++ s->ctu_count++; ++ //printf("%d %d/%d job=%d\n",s->ctu_count,s->num_dblk_cmds[s->pass0_job],RPI_MAX_DEBLOCK_CMDS,s->pass0_job); ++ ++ if ( s->ctu_count >= s->max_ctu_count ) { + #ifdef RPI_WORKER + if (s->used_for_ref) { + // Split work load onto separate threads so we make as rapid progress as possible with this frame +@@ -3682,7 +3704,7 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) + rpi_execute_inter_cmds(s); + #endif + #ifdef LAUNCH_PASS0 +- rpi_execute_inter_qpu(s); ++ rpi_launch_vpu_qpu(s); + #endif + // Pass on this job to worker thread + worker_submit_job(s); +@@ -3690,9 +3712,7 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) + worker_pass0_ready(s); + + // Prepare the next batch of commands +-#ifdef RPI_INTER_QPU +- rpi_inter_clear(s); +-#endif ++ rpi_begin(s); + } else { + // Non-ref frame so do it all on this thread + rpi_do_all_passes(s); +@@ -3733,7 +3753,7 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) + #endif + + // Finish off any half-completed rows +- if (s->enable_rpi && s->num_dblk_cmds[s->pass0_job]) { ++ if (s->enable_rpi && s->ctu_count) { + rpi_do_all_passes(s); + } + +diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h +index c48d0cd..3aea745 100644 +--- a/libavcodec/hevc.h ++++ b/libavcodec/hevc.h +@@ -849,8 +849,15 @@ typedef struct HEVCLocalContext { + + #ifdef RPI + ++// The processing is done in chunks ++// Each chunk corresponds to 24 64x64 luma blocks (24 so it is divisible by 8 for chroma and 12 for luma) ++// This is a distance of 1536 pixels across the screen ++// Increasing RPI_NUM_CHUNKS will reduce time spent activating QPUs and cache flushing, ++// but allocate more memory and increase the latency before data in the next frame can be processed ++#define RPI_NUM_CHUNKS 1 ++ + // RPI_MAX_WIDTH is maximum width in pixels supported by the accelerated code +-#define RPI_MAX_WIDTH 2048 ++#define RPI_MAX_WIDTH (RPI_NUM_CHUNKS*64*24) + + // Worst case is for 4:4:4 4x4 blocks with 64 high coding tree blocks, so 16 MV cmds per 4 pixels across for each colour plane, * 2 for bi + #define RPI_MAX_MV_CMDS (2*16*3*(RPI_MAX_WIDTH/4)) +@@ -914,9 +921,6 @@ typedef struct HEVCPredCmd { + #endif + + typedef struct HEVCContext { +-#ifdef RPI +- int dblk_cmds[RPI_MAX_JOBS][RPI_MAX_DEBLOCK_CMDS][2]; +-#endif + const AVClass *c; // needed by private avoptions + AVCodecContext *avctx; + +@@ -954,6 +958,10 @@ typedef struct HEVCContext { + int pass0_job; // Pass0 does coefficient decode + int pass1_job; // Pass1 does pixel processing + int pass2_job; // Pass2 does reconstruction and deblocking ++ int ctu_count; // Number of CTUs done in pass0 so far ++ int max_ctu_count; // Number of CTUs when we trigger a round of processing ++ int ctu_per_y_chan; // Number of CTUs per luma QPU ++ int ctu_per_uv_chan; // Number of CTUs per chroma QPU + #ifdef RPI_INTER_QPU + GPU_MEM_PTR_T unif_mvs_ptr[RPI_MAX_JOBS]; + uint32_t *unif_mvs[RPI_MAX_JOBS]; // Base of memory for motion vector commands +@@ -962,6 +970,7 @@ typedef struct HEVCContext { + uint32_t *mvs_base[RPI_MAX_JOBS][8]; + // these pointers are to the next free space + uint32_t *u_mvs[RPI_MAX_JOBS][8]; ++ uint32_t *curr_u_mvs; // Current uniform stream to use for chroma + // Function pointers + uint32_t mc_filter_uv; + uint32_t mc_filter_uv_b0; +@@ -972,6 +981,7 @@ typedef struct HEVCContext { + uint32_t *y_unif_mvs[RPI_MAX_JOBS]; // Base of memory for motion vector commands + uint32_t *y_mvs_base[RPI_MAX_JOBS][12]; + uint32_t *y_mvs[RPI_MAX_JOBS][12]; ++ uint32_t *curr_y_mvs; // Current uniform stream for luma + // Function pointers + uint32_t mc_filter; + uint32_t mc_filter_b; +@@ -1110,6 +1120,9 @@ typedef struct HEVCContext { + uint32_t max_mastering_luminance; + uint32_t min_mastering_luminance; + ++#ifdef RPI ++ int dblk_cmds[RPI_MAX_JOBS][RPI_MAX_DEBLOCK_CMDS][2]; ++#endif + } HEVCContext; + + int ff_hevc_decode_short_term_rps(GetBitContext *gb, AVCodecContext *avctx, +diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c +index b286bbf..1f04790 100644 +--- a/libavcodec/hevc_filter.c ++++ b/libavcodec/hevc_filter.c +@@ -891,7 +891,7 @@ void ff_hevc_flush_buffer(HEVCContext *s, ThreadFrame *f, int n) + int n_uv = n >> s->ps.sps->vshift[1]; + int sz,base; + if (curr_uv < 0) curr_uv = 0; +- if (n_uv<=curr_uv) { assert(0); return; } // Should not happen ++ if (n_uv<=curr_uv) { return; } + sz = s->frame->linesize[1] * (n_uv-curr_uv); + base = s->frame->linesize[1] * curr_uv; + GPU_MEM_PTR_T *p = av_buffer_pool_opaque(s->frame->buf[1]); +diff --git a/libavcodec/hevcpred_template.c b/libavcodec/hevcpred_template.c +index 325b60e..28d2653 100644 +--- a/libavcodec/hevcpred_template.c ++++ b/libavcodec/hevcpred_template.c +@@ -72,7 +72,7 @@ do { \ + else \ + a = PIXEL_SPLAT_X4(ptr[i + 3]) + #ifdef RPI_WORKER +- HEVCLocalContextIntra *lc = s->enable_rpi ? &s->HEVClcIntra : (HEVCLocalContextIntra *)s->HEVClc ; ++ HEVCLocalContextIntra *lc = (s->enable_rpi) ? &s->HEVClcIntra : (HEVCLocalContextIntra *)s->HEVClc ; + #else + HEVCLocalContext *lc = s->HEVClc; + #endif +-- +2.5.0 + + +From eaaaee12acbb4d4c27191ceafadaa778d3ba0f2f Mon Sep 17 00:00:00 2001 +From: popcornmix <popcornmix@gmail.com> +Date: Thu, 4 Jun 2015 15:48:10 +0100 +Subject: [PATCH 59/68] Move deblocker into second pass + +--- + libavcodec/hevc.c | 79 +++++++++++++++++++++++++++++++++++++++++++++---------- + 1 file changed, 65 insertions(+), 14 deletions(-) + +diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c +index 23c4e17..dde932f 100644 +--- a/libavcodec/hevc.c ++++ b/libavcodec/hevc.c +@@ -67,6 +67,8 @@ + static void rpi_execute_pred_cmds(HEVCContext *s); + static void rpi_execute_inter_cmds(HEVCContext *s); + static void rpi_begin(HEVCContext *s); ++ static void flush_frame(HEVCContext *s,AVFrame *frame); ++ static void flush_frame3(HEVCContext *s,AVFrame *frame,GPU_MEM_PTR_T *p0,GPU_MEM_PTR_T *p1,GPU_MEM_PTR_T *p2); + + // Define INTER_PASS0 to do inter prediction in first pass + //#define INTER_PASS0 +@@ -227,6 +229,11 @@ static void *worker_start(void *arg) + // Wait for transform completion + vpu_wait(s->vpu_id); + ++ // Perform intra prediction and residual reconstruction ++ rpi_execute_pred_cmds(s); ++ // Perform deblocking for CTBs in this row ++ rpi_execute_dblk_cmds(s); ++ + worker_complete_middle_job(s); + LOG_EXIT + } +@@ -248,10 +255,6 @@ static void *worker_deblock_start(void *arg) + break; + } + LOG_ENTER +- // Perform intra prediction and residual reconstruction +- rpi_execute_pred_cmds(s); +- // Perform deblocking for CTBs in this row +- rpi_execute_dblk_cmds(s); + + worker_complete_job(s); + LOG_EXIT +@@ -2972,7 +2975,7 @@ static void hls_decode_neighbour(HEVCContext *s, int x_ctb, int y_ctb, + static void rpi_execute_dblk_cmds(HEVCContext *s) + { + int n; +- int job = s->pass2_job; ++ int job = s->pass1_job; + int ctb_size = 1 << s->ps.sps->log2_ctb_size; + int (*p)[2] = s->dblk_cmds[job]; + for(n = s->num_dblk_cmds[job]; n>0 ;n--,p++) { +@@ -3010,7 +3013,7 @@ static void rpi_execute_transform(HEVCContext *s) + static void rpi_execute_pred_cmds(HEVCContext *s) + { + int i; +- int job = s->pass2_job; ++ int job = s->pass1_job; + HEVCPredCmd *cmd = s->univ_pred_cmds[job]; + #ifdef RPI_WORKER + HEVCLocalContextIntra *lc = &s->HEVClcIntra; +@@ -3495,11 +3498,10 @@ static void rpi_launch_vpu_qpu(HEVCContext *s) + + #ifdef RPI_MULTI_MAILBOX + #ifdef RPI_CACHE_UNIF_MVS +- gpu_cache_flush3(&s->coeffs_buf_accelerated[job],&s->y_unif_mvs_ptr[job], &s->unif_mvs_ptr[job]); ++ flush_frame3(s, s->frame,&s->coeffs_buf_accelerated[job],&s->y_unif_mvs_ptr[job], &s->unif_mvs_ptr[job]); + #else +- gpu_cache_flush(&s->coeffs_buf_accelerated[job]); ++ flush_frame3(s, s->frame,&s->coeffs_buf_accelerated[job],NULL,NULL); + #endif +- + s->vpu_id = vpu_qpu_post_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf_vc[job][2], s->num_coeffs[job][2] >> 8, s->coeffs_buf_vc[job][3], s->num_coeffs[job][3] >> 10, 0, + qpu_get_fn(QPU_MC_SETUP_UV), + (uint32_t)(unif_vc+(s->mvs_base[job][0 ] - (uint32_t*)s->unif_mvs_ptr[job].arm)), +@@ -3602,6 +3604,60 @@ static void flush_frame(HEVCContext *s,AVFrame *frame) + #endif + } + ++static void flush_frame3(HEVCContext *s,AVFrame *frame,GPU_MEM_PTR_T *p0,GPU_MEM_PTR_T *p1,GPU_MEM_PTR_T *p2) ++{ ++#ifdef RPI_FAST_CACHEFLUSH ++ struct vcsm_user_clean_invalid_s iocache = {}; ++ int n = s->ps.sps->height; ++ int curr_y = 0; ++ int curr_uv = 0; ++ int n_uv = n >> s->ps.sps->vshift[1]; ++ int sz,base; ++ sz = s->frame->linesize[1] * (n_uv-curr_uv); ++ base = s->frame->linesize[1] * curr_uv; ++ GPU_MEM_PTR_T *p = av_buffer_pool_opaque(frame->buf[1]); ++ iocache.s[0].handle = p->vcsm_handle; ++ iocache.s[0].cmd = 3; // clean+invalidate ++ iocache.s[0].addr = p->arm + base; ++ iocache.s[0].size = sz; ++ p = av_buffer_pool_opaque(frame->buf[2]); ++ iocache.s[1].handle = p->vcsm_handle; ++ iocache.s[1].cmd = 3; // clean+invalidate ++ iocache.s[1].addr = p->arm + base; ++ iocache.s[1].size = sz; ++ p = av_buffer_pool_opaque(frame->buf[0]); ++ sz = s->frame->linesize[0] * (n-curr_y); ++ base = s->frame->linesize[0] * curr_y; ++ iocache.s[2].handle = p->vcsm_handle; ++ iocache.s[2].cmd = 3; // clean+invalidate ++ iocache.s[2].addr = p->arm + base; ++ iocache.s[2].size = sz; ++ ++ iocache.s[3].handle = p0->vcsm_handle; ++ iocache.s[3].cmd = 3; // clean+invalidate ++ iocache.s[3].addr = (int) p0->arm; ++ iocache.s[3].size = p0->numbytes; ++ if (p1) { ++ iocache.s[4].handle = p1->vcsm_handle; ++ iocache.s[4].cmd = 3; // clean+invalidate ++ iocache.s[4].addr = (int) p1->arm; ++ iocache.s[4].size = p1->numbytes; ++ } ++ if (p2) { ++ iocache.s[5].handle = p2->vcsm_handle; ++ iocache.s[5].cmd = 3; // clean+invalidate ++ iocache.s[5].addr = (int) p2->arm; ++ iocache.s[5].size = p2->numbytes; ++ } ++ vcsm_clean_invalid( &iocache ); ++#else ++ flush_buffer(frame->buf[0]); ++ flush_buffer(frame->buf[1]); ++ flush_buffer(frame->buf[2]); ++ gpu_cache_flush3(p0, p1, p2); ++#endif ++} ++ + #endif + + static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) +@@ -4116,11 +4172,6 @@ static int hevc_frame_start(HEVCContext *s) + if (!s->avctx->hwaccel) + ff_thread_finish_setup(s->avctx); + +-#ifdef RPI_INTER_QPU +- // Invalidate the output data buffer so it is ready for the QPUs to write into it. +- flush_frame(s,s->frame); +-#endif +- + return 0; + + fail: +-- +2.5.0 + + +From f45417c35888b74a36a5ecc6959480787e727b0c Mon Sep 17 00:00:00 2001 +From: popcornmix <popcornmix@gmail.com> +Date: Thu, 4 Jun 2015 16:10:23 +0100 +Subject: [PATCH 60/68] Change order of ctu accesses to improve qpu performance + +--- + libavcodec/hevc.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c +index dde932f..e247444 100644 +--- a/libavcodec/hevc.c ++++ b/libavcodec/hevc.c +@@ -3726,19 +3726,19 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) + s->filter_slice_edges[ctb_addr_rs] = s->sh.slice_loop_filter_across_slices_enabled_flag; + + #ifdef RPI_INTER_QPU +- s->curr_u_mvs = s->u_mvs[s->pass0_job][s->ctu_count / s->ctu_per_uv_chan]; ++ s->curr_u_mvs = s->u_mvs[s->pass0_job][s->ctu_count % 8]; + #endif + #ifdef RPI_LUMA_QPU +- s->curr_y_mvs = s->y_mvs[s->pass0_job][s->ctu_count / s->ctu_per_y_chan]; ++ s->curr_y_mvs = s->y_mvs[s->pass0_job][s->ctu_count % 12]; + #endif + + more_data = hls_coding_quadtree(s, x_ctb, y_ctb, s->ps.sps->log2_ctb_size, 0); + + #ifdef RPI_INTER_QPU +- s->u_mvs[s->pass0_job][s->ctu_count / s->ctu_per_uv_chan] = s->curr_u_mvs; ++ s->u_mvs[s->pass0_job][s->ctu_count % 8]= s->curr_u_mvs; + #endif + #ifdef RPI_LUMA_QPU +- s->y_mvs[s->pass0_job][s->ctu_count / s->ctu_per_y_chan] = s->curr_y_mvs; ++ s->y_mvs[s->pass0_job][s->ctu_count % 12] = s->curr_y_mvs; + #endif + + #ifdef RPI +-- +2.5.0 + + +From 8d8b31eeffebf0a40c3b267d1b16401ef267bbf5 Mon Sep 17 00:00:00 2001 +From: Peter de Rivaz <peter.derivaz@gmail.com> +Date: Mon, 8 Jun 2015 09:36:59 +0100 +Subject: [PATCH 61/68] Removed deblocker thread + +--- + libavcodec/hevc.c | 77 +++---------------------------------------------------- + libavcodec/hevc.h | 4 --- + 2 files changed, 4 insertions(+), 77 deletions(-) + +diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c +index e247444..bbb7ad3 100644 +--- a/libavcodec/hevc.c ++++ b/libavcodec/hevc.c +@@ -70,11 +70,6 @@ + static void flush_frame(HEVCContext *s,AVFrame *frame); + static void flush_frame3(HEVCContext *s,AVFrame *frame,GPU_MEM_PTR_T *p0,GPU_MEM_PTR_T *p1,GPU_MEM_PTR_T *p2); + +- // Define INTER_PASS0 to do inter prediction in first pass +- //#define INTER_PASS0 +- // Define LAUNCH_PASS0 to launch QPU/VPU from pass0 +- //#define LAUNCH_PASS0 +- + #endif + + // #define DISABLE_MC +@@ -147,24 +142,12 @@ static void worker_submit_job(HEVCContext *s) + } + + // Call this to say we have completed pass1 +-static void worker_complete_middle_job(HEVCContext *s) +-{ +- LOG_ENTER +- pthread_mutex_lock(&s->worker_mutex); +- s->worker_middle++; +- s->pass1_job = (s->pass1_job + 1) % RPI_MAX_JOBS; // Move onto the next slot +- pthread_cond_broadcast(&s->worker_cond_middle); // Let people know that the middle has moved +- pthread_mutex_unlock(&s->worker_mutex); +- LOG_EXIT +-} +- +-// Call this to say we have completed pass2 + static void worker_complete_job(HEVCContext *s) + { + LOG_ENTER + pthread_mutex_lock(&s->worker_mutex); + s->worker_head++; +- s->pass2_job = (s->pass2_job + 1) % RPI_MAX_JOBS; // Move onto the next slot ++ s->pass1_job = (s->pass1_job + 1) % RPI_MAX_JOBS; // Move onto the next slot + pthread_cond_broadcast(&s->worker_cond_head); // Let people know that the head has moved + pthread_mutex_unlock(&s->worker_mutex); + LOG_EXIT +@@ -208,7 +191,7 @@ static void *worker_start(void *arg) + while(1) { + pthread_mutex_lock(&s->worker_mutex); + +- while( !s->kill_worker && s->worker_tail - s->worker_middle <= 0) ++ while( !s->kill_worker && s->worker_tail - s->worker_head <= 0) + { + pthread_cond_wait(&s->worker_cond_tail, &s->worker_mutex); + } +@@ -219,13 +202,9 @@ static void *worker_start(void *arg) + } + LOG_ENTER + // printf("%d %d %d : %d %d %d %d\n",s->poc, x_ctb, y_ctb, s->num_pred_cmds,s->num_mv_cmds,s->num_coeffs[2] >> 8,s->num_coeffs[3] >> 10); +-#ifndef LAUNCH_PASS0 + rpi_launch_vpu_qpu(s); +-#endif +-#ifndef INTER_PASS0 + // Perform inter prediction + rpi_execute_inter_cmds(s); +-#endif + // Wait for transform completion + vpu_wait(s->vpu_id); + +@@ -234,28 +213,6 @@ static void *worker_start(void *arg) + // Perform deblocking for CTBs in this row + rpi_execute_dblk_cmds(s); + +- worker_complete_middle_job(s); +- LOG_EXIT +- } +- return NULL; +-} +- +-static void *worker_deblock_start(void *arg) +-{ +- HEVCContext *s = (HEVCContext *)arg; +- while(1) { +- pthread_mutex_lock(&s->worker_mutex); +- while( !s->kill_worker && s->worker_middle - s->worker_head <= 0) +- { +- pthread_cond_wait(&s->worker_cond_middle, &s->worker_mutex); +- } +- pthread_mutex_unlock(&s->worker_mutex); +- +- if (s->kill_worker) { +- break; +- } +- LOG_ENTER +- + worker_complete_job(s); + LOG_EXIT + } +@@ -2987,11 +2944,7 @@ static void rpi_execute_dblk_cmds(HEVCContext *s) + static void rpi_execute_transform(HEVCContext *s) + { + int i=2; +-#ifdef LAUNCH_PASS0 +- int job = s->pass0_job; +-#else + int job = s->pass1_job; +-#endif + //int j; + //int16_t *coeffs = s->coeffs_buf_arm[i]; + //for(j=s->num_coeffs[i]; j > 0; j-= 16*16, coeffs+=16*16) { +@@ -3046,11 +2999,7 @@ static void rpi_execute_pred_cmds(HEVCContext *s) + + static void rpi_execute_inter_cmds(HEVCContext *s) + { +-#ifdef INTER_PASS0 +- int job = s->pass0_job; +-#else + int job = s->pass1_job; +-#endif + HEVCMvCmd *cmd = s->unif_mv_cmds[job]; + int n,cidx; + AVFrame myref; +@@ -3456,11 +3405,7 @@ static void rpi_simulate_inter_qpu(HEVCContext *s) + static void rpi_launch_vpu_qpu(HEVCContext *s) + { + int k; +-#ifdef LAUNCH_PASS0 +- int job = s->pass0_job; +-#else + int job = s->pass1_job; +-#endif + int i; + uint32_t *unif_vc = (uint32_t *)s->unif_mvs_ptr[job].vc; + #ifdef RPI_LUMA_QPU +@@ -3563,10 +3508,12 @@ static void rpi_launch_vpu_qpu(HEVCContext *s) + + #ifdef RPI + ++#ifndef RPI_FAST_CACHEFLUSH + static void flush_buffer(AVBufferRef *bref) { + GPU_MEM_PTR_T *p = av_buffer_pool_opaque(bref); + gpu_cache_flush(p); + } ++#endif + + static void flush_frame(HEVCContext *s,AVFrame *frame) + { +@@ -3704,7 +3651,6 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) + #ifdef RPI_WORKER + s->pass0_job = 0; + s->pass1_job = 0; +- s->pass2_job = 0; + #endif + #ifdef RPI + rpi_begin(s); +@@ -3756,12 +3702,6 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) + #ifdef RPI_WORKER + if (s->used_for_ref) { + // Split work load onto separate threads so we make as rapid progress as possible with this frame +- #ifdef INTER_PASS0 +- rpi_execute_inter_cmds(s); +- #endif +- #ifdef LAUNCH_PASS0 +- rpi_launch_vpu_qpu(s); +- #endif + // Pass on this job to worker thread + worker_submit_job(s); + // Make sure we have space to prepare the next job +@@ -3803,8 +3743,6 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) + // Wait for the worker to finish all its jobs + if (s->enable_rpi) { + worker_wait(s); +- av_assert0(s->pass0_job==s->pass1_job); +- av_assert0(s->pass1_job==s->pass2_job); + } + #endif + +@@ -4554,16 +4492,13 @@ static av_cold void hevc_init_worker(HEVCContext *s) + { + int err; + pthread_cond_init(&s->worker_cond_head, NULL); +- pthread_cond_init(&s->worker_cond_middle, NULL); + pthread_cond_init(&s->worker_cond_tail, NULL); + pthread_mutex_init(&s->worker_mutex, NULL); + + s->worker_tail=0; +- s->worker_middle=0; + s->worker_head=0; + s->kill_worker=0; + err = pthread_create(&s->worker_thread, NULL, worker_start, s); +- err = pthread_create(&s->worker_deblock_thread, NULL, worker_deblock_start, s); + if (err) { + printf("Failed to create worker thread\n"); + exit(-1); +@@ -4575,17 +4510,13 @@ static av_cold void hevc_exit_worker(HEVCContext *s) + void *res; + s->kill_worker=1; + pthread_cond_broadcast(&s->worker_cond_tail); +- pthread_cond_broadcast(&s->worker_cond_middle); + pthread_join(s->worker_thread, &res); +- pthread_join(s->worker_deblock_thread, &res); + + pthread_cond_destroy(&s->worker_cond_head); +- pthread_cond_destroy(&s->worker_cond_middle); + pthread_cond_destroy(&s->worker_cond_tail); + pthread_mutex_destroy(&s->worker_mutex); + + s->worker_tail=0; +- s->worker_middle=0; + s->worker_head=0; + s->kill_worker=0; + } +diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h +index 3aea745..a577fcb 100644 +--- a/libavcodec/hevc.h ++++ b/libavcodec/hevc.h +@@ -957,7 +957,6 @@ typedef struct HEVCContext { + //GPU_MEM_PTR_T dummy; + int pass0_job; // Pass0 does coefficient decode + int pass1_job; // Pass1 does pixel processing +- int pass2_job; // Pass2 does reconstruction and deblocking + int ctu_count; // Number of CTUs done in pass0 so far + int max_ctu_count; // Number of CTUs when we trigger a round of processing + int ctu_per_y_chan; // Number of CTUs per luma QPU +@@ -989,15 +988,12 @@ typedef struct HEVCContext { + + #ifdef RPI_WORKER + pthread_t worker_thread; +- pthread_t worker_deblock_thread; + pthread_cond_t worker_cond_head; + pthread_cond_t worker_cond_tail; +- pthread_cond_t worker_cond_middle; + pthread_mutex_t worker_mutex; + + int worker_tail; // Contains the number of posted jobs + int worker_head; // Contains the number of completed jobs +- int worker_middle; // Contains the number of completed jobs + int kill_worker; // set to 1 to terminate the worker + #endif + +-- +2.5.0 + + +From 9ad14cb77eeec547db386bd2c3a6e25f41ae5b31 Mon Sep 17 00:00:00 2001 +From: Peter de Rivaz <peter.derivaz@gmail.com> +Date: Mon, 8 Jun 2015 11:04:43 +0100 +Subject: [PATCH 62/68] Reduced amount of output frame that is invalidated + +--- + libavcodec/hevc.c | 45 +++++++++++++++++++++++++++++---------------- + 1 file changed, 29 insertions(+), 16 deletions(-) + +diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c +index bbb7ad3..2374c2b 100644 +--- a/libavcodec/hevc.c ++++ b/libavcodec/hevc.c +@@ -68,7 +68,7 @@ + static void rpi_execute_inter_cmds(HEVCContext *s); + static void rpi_begin(HEVCContext *s); + static void flush_frame(HEVCContext *s,AVFrame *frame); +- static void flush_frame3(HEVCContext *s,AVFrame *frame,GPU_MEM_PTR_T *p0,GPU_MEM_PTR_T *p1,GPU_MEM_PTR_T *p2); ++ static void flush_frame3(HEVCContext *s,AVFrame *frame,GPU_MEM_PTR_T *p0,GPU_MEM_PTR_T *p1,GPU_MEM_PTR_T *p2, int job); + + #endif + +@@ -3443,9 +3443,9 @@ static void rpi_launch_vpu_qpu(HEVCContext *s) + + #ifdef RPI_MULTI_MAILBOX + #ifdef RPI_CACHE_UNIF_MVS +- flush_frame3(s, s->frame,&s->coeffs_buf_accelerated[job],&s->y_unif_mvs_ptr[job], &s->unif_mvs_ptr[job]); ++ flush_frame3(s, s->frame,&s->coeffs_buf_accelerated[job],&s->y_unif_mvs_ptr[job], &s->unif_mvs_ptr[job], job); + #else +- flush_frame3(s, s->frame,&s->coeffs_buf_accelerated[job],NULL,NULL); ++ flush_frame3(s, s->frame,&s->coeffs_buf_accelerated[job],NULL,NULL, job); + #endif + s->vpu_id = vpu_qpu_post_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf_vc[job][2], s->num_coeffs[job][2] >> 8, s->coeffs_buf_vc[job][3], s->num_coeffs[job][3] >> 10, 0, + qpu_get_fn(QPU_MC_SETUP_UV), +@@ -3519,6 +3519,7 @@ static void flush_frame(HEVCContext *s,AVFrame *frame) + { + #ifdef RPI_FAST_CACHEFLUSH + struct vcsm_user_clean_invalid_s iocache = {}; ++ GPU_MEM_PTR_T *p = av_buffer_pool_opaque(frame->buf[1]); + int n = s->ps.sps->height; + int curr_y = 0; + int curr_uv = 0; +@@ -3526,22 +3527,21 @@ static void flush_frame(HEVCContext *s,AVFrame *frame) + int sz,base; + sz = s->frame->linesize[1] * (n_uv-curr_uv); + base = s->frame->linesize[1] * curr_uv; +- GPU_MEM_PTR_T *p = av_buffer_pool_opaque(frame->buf[1]); + iocache.s[0].handle = p->vcsm_handle; + iocache.s[0].cmd = 3; // clean+invalidate +- iocache.s[0].addr = p->arm + base; ++ iocache.s[0].addr = (int)(p->arm) + base; + iocache.s[0].size = sz; + p = av_buffer_pool_opaque(frame->buf[2]); + iocache.s[1].handle = p->vcsm_handle; + iocache.s[1].cmd = 3; // clean+invalidate +- iocache.s[1].addr = p->arm + base; ++ iocache.s[1].addr = (int)(p->arm) + base; + iocache.s[1].size = sz; + p = av_buffer_pool_opaque(frame->buf[0]); + sz = s->frame->linesize[0] * (n-curr_y); + base = s->frame->linesize[0] * curr_y; + iocache.s[2].handle = p->vcsm_handle; + iocache.s[2].cmd = 3; // clean+invalidate +- iocache.s[2].addr = p->arm + base; ++ iocache.s[2].addr = (int)(p->arm) + base; + iocache.s[2].size = sz; + vcsm_clean_invalid( &iocache ); + #else +@@ -3551,33 +3551,46 @@ static void flush_frame(HEVCContext *s,AVFrame *frame) + #endif + } + +-static void flush_frame3(HEVCContext *s,AVFrame *frame,GPU_MEM_PTR_T *p0,GPU_MEM_PTR_T *p1,GPU_MEM_PTR_T *p2) ++static void flush_frame3(HEVCContext *s,AVFrame *frame,GPU_MEM_PTR_T *p0,GPU_MEM_PTR_T *p1,GPU_MEM_PTR_T *p2, int job) + { + #ifdef RPI_FAST_CACHEFLUSH + struct vcsm_user_clean_invalid_s iocache = {}; +- int n = s->ps.sps->height; +- int curr_y = 0; +- int curr_uv = 0; +- int n_uv = n >> s->ps.sps->vshift[1]; ++ int n; ++ int curr_y; ++ int curr_uv; ++ int n_uv; ++ GPU_MEM_PTR_T *p = av_buffer_pool_opaque(frame->buf[1]); + int sz,base; ++ int (*d)[2] = s->dblk_cmds[job]; ++ int low=(*d)[1]; ++ int high=(*d)[1]; ++ for(n = s->num_dblk_cmds[job]; n>0 ;n--,d++) { ++ int y = (*d)[1]; ++ low=FFMIN(low,y); ++ high=FFMAX(high,y); ++ } ++ curr_y = low; ++ n = high+(1 << s->ps.sps->log2_ctb_size); ++ curr_uv = curr_y >> s->ps.sps->vshift[1]; ++ n_uv = n >> s->ps.sps->vshift[1]; ++ + sz = s->frame->linesize[1] * (n_uv-curr_uv); + base = s->frame->linesize[1] * curr_uv; +- GPU_MEM_PTR_T *p = av_buffer_pool_opaque(frame->buf[1]); + iocache.s[0].handle = p->vcsm_handle; + iocache.s[0].cmd = 3; // clean+invalidate +- iocache.s[0].addr = p->arm + base; ++ iocache.s[0].addr = (int)(p->arm) + base; + iocache.s[0].size = sz; + p = av_buffer_pool_opaque(frame->buf[2]); + iocache.s[1].handle = p->vcsm_handle; + iocache.s[1].cmd = 3; // clean+invalidate +- iocache.s[1].addr = p->arm + base; ++ iocache.s[1].addr = (int)(p->arm) + base; + iocache.s[1].size = sz; + p = av_buffer_pool_opaque(frame->buf[0]); + sz = s->frame->linesize[0] * (n-curr_y); + base = s->frame->linesize[0] * curr_y; + iocache.s[2].handle = p->vcsm_handle; + iocache.s[2].cmd = 3; // clean+invalidate +- iocache.s[2].addr = p->arm + base; ++ iocache.s[2].addr = (int)(p->arm) + base; + iocache.s[2].size = sz; + + iocache.s[3].handle = p0->vcsm_handle; +-- +2.5.0 + + +From e5e5d6e39c9361a4c842656103b7411b75098c0c Mon Sep 17 00:00:00 2001 +From: Peter de Rivaz <peter.derivaz@gmail.com> +Date: Mon, 8 Jun 2015 11:55:29 +0100 +Subject: [PATCH 63/68] Packed 16x16 and 32x32 into the same buffer + +--- + libavcodec/hevc.c | 24 +++++++++++++++--------- + libavcodec/hevc_cabac.c | 9 ++++++++- + libavcodec/rpi_qpu.c | 2 +- + 3 files changed, 24 insertions(+), 11 deletions(-) + +diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c +index 2374c2b..3df6308 100644 +--- a/libavcodec/hevc.c ++++ b/libavcodec/hevc.c +@@ -299,12 +299,12 @@ static int pic_arrays_init(HEVCContext *s, const HEVCSPS *sps) + s->coeffs_buf_arm[job][0] = (int16_t*) s->coeffs_buf_default[job].arm; + if (!s->coeffs_buf_arm[job][0]) + goto fail; +- gpu_malloc_cached(sizeof(int16_t) * coefs_per_row * 2, &s->coeffs_buf_accelerated[job]); ++ gpu_malloc_cached(sizeof(int16_t) * (coefs_per_row + 32*32), &s->coeffs_buf_accelerated[job]); // We prefetch past the end so provide an extra blocks worth of data + s->coeffs_buf_arm[job][2] = (int16_t*) s->coeffs_buf_accelerated[job].arm; + s->coeffs_buf_vc[job][2] = s->coeffs_buf_accelerated[job].vc; + if (!s->coeffs_buf_arm[job][2]) + goto fail; +- s->coeffs_buf_arm[job][3] = coefs_per_row + s->coeffs_buf_arm[job][2]; ++ s->coeffs_buf_arm[job][3] = coefs_per_row + s->coeffs_buf_arm[job][2]; // This points to just beyond the end of the buffer. Coefficients fill in backwards. + s->coeffs_buf_vc[job][3] = sizeof(int16_t) * coefs_per_row + s->coeffs_buf_vc[job][2]; + } + } +@@ -2945,15 +2945,20 @@ static void rpi_execute_transform(HEVCContext *s) + { + int i=2; + int job = s->pass1_job; +- //int j; +- //int16_t *coeffs = s->coeffs_buf_arm[i]; +- //for(j=s->num_coeffs[i]; j > 0; j-= 16*16, coeffs+=16*16) { +- // s->hevcdsp.idct[4-2](coeffs, 16); +- //} ++ /*int j; ++ int16_t *coeffs = s->coeffs_buf_arm[job][i]; ++ for(j=s->num_coeffs[job][i]; j > 0; j-= 16*16, coeffs+=16*16) { ++ s->hevcdsp.idct[4-2](coeffs, 16); ++ } ++ i=3; ++ coeffs = s->coeffs_buf_arm[job][i] - s->num_coeffs[job][i]; ++ for(j=s->num_coeffs[job][i]; j > 0; j-= 32*32, coeffs+=32*32) { ++ s->hevcdsp.idct[5-2](coeffs, 32); ++ }*/ + + gpu_cache_flush(&s->coeffs_buf_accelerated[job]); + s->vpu_id = vpu_post_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf_vc[job][2], +- s->num_coeffs[job][2] >> 8, s->coeffs_buf_vc[job][3], ++ s->num_coeffs[job][2] >> 8, s->coeffs_buf_vc[job][3] - sizeof(int16_t) * s->num_coeffs[job][3], + s->num_coeffs[job][3] >> 10, 0, &s->coeffs_buf_accelerated[job]); + //vpu_execute_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf_vc[2], s->num_coeffs[2] >> 8, s->coeffs_buf_vc[3], s->num_coeffs[3] >> 10, 0); + //gpu_cache_flush(&s->coeffs_buf_accelerated); +@@ -3447,7 +3452,8 @@ static void rpi_launch_vpu_qpu(HEVCContext *s) + #else + flush_frame3(s, s->frame,&s->coeffs_buf_accelerated[job],NULL,NULL, job); + #endif +- s->vpu_id = vpu_qpu_post_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf_vc[job][2], s->num_coeffs[job][2] >> 8, s->coeffs_buf_vc[job][3], s->num_coeffs[job][3] >> 10, 0, ++ s->vpu_id = vpu_qpu_post_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf_vc[job][2], s->num_coeffs[job][2] >> 8, ++ s->coeffs_buf_vc[job][3] - sizeof(int16_t) * s->num_coeffs[job][3], s->num_coeffs[job][3] >> 10, 0, + qpu_get_fn(QPU_MC_SETUP_UV), + (uint32_t)(unif_vc+(s->mvs_base[job][0 ] - (uint32_t*)s->unif_mvs_ptr[job].arm)), + (uint32_t)(unif_vc+(s->mvs_base[job][1 ] - (uint32_t*)s->unif_mvs_ptr[job].arm)), +diff --git a/libavcodec/hevc_cabac.c b/libavcodec/hevc_cabac.c +index 16e7ac3..271e17a 100644 +--- a/libavcodec/hevc_cabac.c ++++ b/libavcodec/hevc_cabac.c +@@ -1051,7 +1051,14 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, + if (s->enable_rpi) { + int n = trafo_size * trafo_size; + if (use_vpu) { +- coeffs = s->coeffs_buf_arm[s->pass0_job][log2_trafo_size - 2] + s->num_coeffs[s->pass0_job][log2_trafo_size - 2]; ++ // We support size 4 and size 5. ++ // Size 4 grows from the front (Coeffs_buf_arm[2] points to start of buf) ++ // Size 5 grows from the back (Coeffs_buf_arm[3] points to end of buf) ++ // num_coeffs is indexed by log2_trafo_size-2 ++ if (log2_trafo_size == 4) ++ coeffs = s->coeffs_buf_arm[s->pass0_job][log2_trafo_size - 2] + s->num_coeffs[s->pass0_job][log2_trafo_size - 2]; ++ else ++ coeffs = s->coeffs_buf_arm[s->pass0_job][log2_trafo_size - 2] - s->num_coeffs[s->pass0_job][log2_trafo_size - 2] - n; + s->num_coeffs[s->pass0_job][log2_trafo_size - 2] += n; + } else { + coeffs = s->coeffs_buf_arm[s->pass0_job][0] + s->num_coeffs[s->pass0_job][0]; +diff --git a/libavcodec/rpi_qpu.c b/libavcodec/rpi_qpu.c +index 4480f72..0121fca 100644 +--- a/libavcodec/rpi_qpu.c ++++ b/libavcodec/rpi_qpu.c +@@ -5,7 +5,7 @@ + // define RPI_TIME_TOTAL_VPU to print out how much time is spent in the VPI code + //#define RPI_TIME_TOTAL_VPU + // define RPI_TIME_TOTAL_POSTED to print out how much time is spent in the multi execute QPU/VPU combined +-//#define RPI_TIME_TOTAL_POSTED ++#define RPI_TIME_TOTAL_POSTED + // define RPI_ASYNC to run the VPU in a separate thread, need to make a separate call to check for completion + #define RPI_ASYNC + +-- +2.5.0 + + +From a1c0980a8ce8b0059637e9fdc61b1cbd64c58e43 Mon Sep 17 00:00:00 2001 +From: Peter de Rivaz <peter.derivaz@gmail.com> +Date: Thu, 25 Jun 2015 09:02:47 +0100 +Subject: [PATCH 64/68] Moved luma deblock to VPU + +--- + libavcodec/hevc.c | 18 +- + libavcodec/hevc.h | 11 + + libavcodec/hevc_filter.c | 120 ++- + libavcodec/rpi_hevc_transform.h | 1802 ++++++++++++++++++++++++++++++++++++++- + libavcodec/rpi_hevc_transform.s | 426 +++++++++ + libavcodec/rpi_qpu.c | 12 +- + libavcodec/rpi_shader.c | 2 +- + 7 files changed, 2378 insertions(+), 13 deletions(-) + +diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c +index 3df6308..0ecaf05 100644 +--- a/libavcodec/hevc.c ++++ b/libavcodec/hevc.c +@@ -246,6 +246,12 @@ static void pic_arrays_free(HEVCContext *s) + } + } + #endif ++#ifdef RPI_DEBLOCK_VPU ++ if (s->y_setup_arm) { ++ gpu_free(&s->y_setup_ptr); ++ s->y_setup_arm = 0; ++ } ++#endif + av_freep(&s->sao); + av_freep(&s->deblock); + +@@ -283,12 +289,12 @@ static int pic_arrays_init(HEVCContext *s, const HEVCSPS *sps) + int min_pu_size = sps->min_pu_width * sps->min_pu_height; + + #ifdef RPI +- av_assert0(sps); + int coefs_in_ctb = (1 << sps->log2_ctb_size) * (1 << sps->log2_ctb_size); + int coefs_per_luma = 64*64*24*RPI_NUM_CHUNKS; + int coefs_per_chroma = (coefs_per_luma * 2) >> sps->vshift[1] >> sps->hshift[1]; + int coefs_per_row = coefs_per_luma + coefs_per_chroma; + int job; ++ av_assert0(sps); + s->max_ctu_count = coefs_per_luma / coefs_in_ctb; + s->ctu_per_y_chan = s->max_ctu_count / 12; + s->ctu_per_uv_chan = s->max_ctu_count / 8; +@@ -309,6 +315,16 @@ static int pic_arrays_init(HEVCContext *s, const HEVCSPS *sps) + } + } + #endif ++#ifdef RPI_DEBLOCK_VPU ++ s->enable_rpi_deblock = !sps->sao_enabled; ++ s->setup_width = (sps->width+15) / 16; ++ s->setup_height = (sps->height+15) / 16; ++ gpu_malloc_uncached(sizeof(*s->y_setup_arm) * s->setup_width * s->setup_height, &s->y_setup_ptr); // TODO make this cached ++ s->y_setup_arm = (void*)s->y_setup_ptr.arm; ++ s->y_setup_vc = (void*)s->y_setup_ptr.vc; ++ memset(s->y_setup_arm, 0, s->y_setup_ptr.numbytes); ++ printf("Setup %d by %d by %d\n",s->setup_width,s->setup_height,sizeof(*s->y_setup_arm)); ++#endif + + s->bs_width = (width >> 2) + 1; + s->bs_height = (height >> 2) + 1; +diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h +index a577fcb..b1d3ee0 100644 +--- a/libavcodec/hevc.h ++++ b/libavcodec/hevc.h +@@ -56,6 +56,8 @@ + // Define RPI_WORKER to launch a worker thread for pixel processing tasks + #define RPI_WORKER + ++ #define RPI_DEBLOCK_VPU ++ + #endif + + #define MAX_DPB_SIZE 16 // A.4.1 +@@ -997,6 +999,15 @@ typedef struct HEVCContext { + int kill_worker; // set to 1 to terminate the worker + #endif + ++#ifdef RPI_DEBLOCK_VPU ++ int enable_rpi_deblock; ++ GPU_MEM_PTR_T y_setup_ptr; ++ uint8_t (*y_setup_arm)[2][2][2][4]; ++ uint8_t (*y_setup_vc)[2][2][2][4]; ++ int setup_width; // Number of 16x16 blocks across the image ++ int setup_height; // Number of 16x16 blocks down the image ++#endif ++ + #endif + + uint8_t *cabac_state; +diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c +index 1f04790..06371da 100644 +--- a/libavcodec/hevc_filter.c ++++ b/libavcodec/hevc_filter.c +@@ -564,6 +564,19 @@ static void deblocking_filter_CTB(HEVCContext *s, int x0, int y0) + s->frame->linesize[LUMA], + beta, tc, no_p, no_q); + } else ++#ifdef RPI_DEBLOCK_VPU ++ if (s->enable_rpi_deblock) { ++ uint8_t (*setup)[2][2][4]; ++ int num16 = (y>>4)*s->setup_width + (x>>4); ++ int a = ((y>>3) & 1) << 1; ++ int b = (x>>3) & 1; ++ setup = s->y_setup_arm[num16]; ++ setup[0][b][0][a] = beta; ++ setup[0][b][0][a + 1] = beta; ++ setup[0][b][1][a] = tc[0]; ++ setup[0][b][1][a + 1] = tc[1]; ++ } else ++#endif + s->hevcdsp.hevc_v_loop_filter_luma(src, + s->frame->linesize[LUMA], + beta, tc, no_p, no_q); +@@ -596,6 +609,19 @@ static void deblocking_filter_CTB(HEVCContext *s, int x0, int y0) + s->frame->linesize[LUMA], + beta, tc, no_p, no_q); + } else ++#ifdef RPI_DEBLOCK_VPU ++ if (s->enable_rpi_deblock) { ++ uint8_t (*setup)[2][2][4]; ++ int num16 = (y>>4)*s->setup_width + (x>>4); ++ int a = ((x>>3) & 1) << 1; ++ int b = (y>>3) & 1; ++ setup = s->y_setup_arm[num16]; ++ setup[1][b][0][a] = beta; ++ setup[1][b][0][a + 1] = beta; ++ setup[1][b][1][a] = tc[0]; ++ setup[1][b][1][a + 1] = tc[1]; ++ } else ++#endif + s->hevcdsp.hevc_h_loop_filter_luma(src, + s->frame->linesize[LUMA], + beta, tc, no_p, no_q); +@@ -876,33 +902,85 @@ static void flush_buffer(AVBufferRef *bref) { + } + + // Return Physical address for this image +-static int ff_hevc_buf_base(AVBufferRef *bref) { ++static uint32_t get_vc_address(AVBufferRef *bref) { + GPU_MEM_PTR_T *p = av_buffer_pool_opaque(bref); +- return p->vc & 0x3fffffff; ++ return p->vc; + } + ++// ff_hevc_flush_buffer_lines ++// flushes and invalidates all pixel rows in [start,end-1] ++static void ff_hevc_flush_buffer_lines(HEVCContext *s, int start, int end, int flush_luma, int flush_chroma) ++{ ++#ifdef RPI_FAST_CACHEFLUSH ++ struct vcsm_user_clean_invalid_s iocache = {}; ++ int curr_y = start; ++ int n = end; ++ int curr_uv = curr_y >> s->ps.sps->vshift[1]; ++ int n_uv = n >> s->ps.sps->vshift[1]; ++ int sz,base; ++ GPU_MEM_PTR_T *p; ++ if (curr_uv < 0) curr_uv = 0; ++ if (n_uv<=curr_uv) { return; } ++ sz = s->frame->linesize[1] * (n_uv-curr_uv); ++ base = s->frame->linesize[1] * curr_uv; ++ if (flush_chroma) { ++ p = av_buffer_pool_opaque(s->frame->buf[1]); ++ iocache.s[0].handle = p->vcsm_handle; ++ iocache.s[0].cmd = 3; // clean+invalidate ++ iocache.s[0].addr = (int)p->arm + base; ++ iocache.s[0].size = sz; ++ p = av_buffer_pool_opaque(s->frame->buf[2]); ++ iocache.s[1].handle = p->vcsm_handle; ++ iocache.s[1].cmd = 3; // clean+invalidate ++ iocache.s[1].addr = (int)p->arm + base; ++ iocache.s[1].size = sz; ++ } ++ if (flush_luma) { ++ p = av_buffer_pool_opaque(s->frame->buf[0]); ++ sz = s->frame->linesize[0] * (n-curr_y); ++ base = s->frame->linesize[0] * curr_y; ++ iocache.s[2].handle = p->vcsm_handle; ++ iocache.s[2].cmd = 3; // clean+invalidate ++ iocache.s[2].addr = (int)p->arm + base; ++ iocache.s[2].size = sz; ++ } ++ vcsm_clean_invalid( &iocache ); ++#else ++ if (flush_chroma) { ++ flush_buffer(s->frame->buf[1]); ++ flush_buffer(s->frame->buf[2]); ++ } ++ if (flush_luma) { ++ flush_buffer(s->frame->buf[0]); ++ } ++#endif ++} ++ ++ + void ff_hevc_flush_buffer(HEVCContext *s, ThreadFrame *f, int n) + { + if (s->enable_rpi && s->used_for_ref) { ++ // TODO make this use ff_hevc_flush_buffer_lines + #ifdef RPI_FAST_CACHEFLUSH + struct vcsm_user_clean_invalid_s iocache = {}; + int curr_y = ((int *)f->progress->data)[0]; + int curr_uv = curr_y >> s->ps.sps->vshift[1]; + int n_uv = n >> s->ps.sps->vshift[1]; + int sz,base; ++ GPU_MEM_PTR_T *p; + if (curr_uv < 0) curr_uv = 0; + if (n_uv<=curr_uv) { return; } + sz = s->frame->linesize[1] * (n_uv-curr_uv); + base = s->frame->linesize[1] * curr_uv; +- GPU_MEM_PTR_T *p = av_buffer_pool_opaque(s->frame->buf[1]); ++ p = av_buffer_pool_opaque(s->frame->buf[1]); + iocache.s[0].handle = p->vcsm_handle; + iocache.s[0].cmd = 3; // clean+invalidate +- iocache.s[0].addr = p->arm + base; ++ iocache.s[0].addr = (int)p->arm + base; + iocache.s[0].size = sz; + p = av_buffer_pool_opaque(s->frame->buf[2]); + iocache.s[1].handle = p->vcsm_handle; + iocache.s[1].cmd = 3; // clean+invalidate +- iocache.s[1].addr = p->arm + base; ++ iocache.s[1].addr = (int)p->arm + base; + iocache.s[1].size = sz; + + #ifdef RPI_LUMA_QPU +@@ -911,7 +989,7 @@ void ff_hevc_flush_buffer(HEVCContext *s, ThreadFrame *f, int n) + base = s->frame->linesize[0] * curr_y; + iocache.s[2].handle = p->vcsm_handle; + iocache.s[2].cmd = 3; // clean+invalidate +- iocache.s[2].addr = p->arm + base; ++ iocache.s[2].addr = (int)p->arm + base; + iocache.s[2].size = sz; + #endif + vcsm_clean_invalid( &iocache ); +@@ -930,11 +1008,40 @@ void ff_hevc_flush_buffer(HEVCContext *s, ThreadFrame *f, int n) + } + #endif + ++#ifdef RPI_DEBLOCK_VPU ++/* rpi_deblock deblocks an entire row of ctbs using the VPU */ ++static void rpi_deblock(HEVCContext *s, int y, int ctb_size) ++{ ++ // Flush image, 4 lines above to bottom of ctb stripe ++ ff_hevc_flush_buffer_lines(s, FFMAX(y-4,0), y+ctb_size, 1, 0); ++ // TODO flush buffer of beta/tc setup when it becomes cached ++ // Call VPU ++ // TODO add this to a separate pipeline of VPU jobs that can be run in parallel and wait for completion ++ vpu_wait(vpu_post_code( vpu_get_fn(), get_vc_address(s->frame->buf[0]) + s->frame->linesize[0] * y, s->frame->linesize[0], ++ s->setup_width, (int) ( s->y_setup_vc + s->setup_width * (y>>4) ), ++ ctb_size>>4, 2, 0)); // 2 means to do the deblocking code ++} ++ ++static void rpi_deblock2(HEVCContext *s, int y, int ctb_size) ++{ ++ int y2; ++ for(y2=y;y2<y+ctb_size;y2+=16) { ++ rpi_deblock(s,y2,16); ++ } ++} ++#endif ++ + void ff_hevc_hls_filter(HEVCContext *s, int x, int y, int ctb_size) + { + int x_end = x >= s->ps.sps->width - ctb_size; + if (s->avctx->skip_loop_filter < AVDISCARD_ALL) + deblocking_filter_CTB(s, x, y); ++#ifdef RPI_DEBLOCK_VPU ++ if (s->enable_rpi_deblock && x_end) ++ { ++ rpi_deblock(s, y, ctb_size); ++ } ++#endif + if (s->ps.sps->sao_enabled) { + int y_end = y >= s->ps.sps->height - ctb_size; + if (y && x) +@@ -965,6 +1072,7 @@ void ff_hevc_hls_filter(HEVCContext *s, int x, int y, int ctb_size) + //if (((y + ctb_size)&63)==0) + #ifdef RPI_INTER_QPU + ff_hevc_flush_buffer(s, &s->ref->tf, y + ctb_size - 4); ++ // TODO we no longer need to flush the luma buffer as it is in GPU memory when using deblocking on the rpi + #endif + ff_thread_report_progress(&s->ref->tf, y + ctb_size - 4, 0); + } +diff --git a/libavcodec/rpi_hevc_transform.h b/libavcodec/rpi_hevc_transform.h +index 4f13622..b3f155f 100644 +--- a/libavcodec/rpi_hevc_transform.h ++++ b/libavcodec/rpi_hevc_transform.h +@@ -3,7 +3,13 @@ unsigned char rpi_hevc_transform [] = { + 106, + 0, + 144, +-35, ++38, ++1, ++37, ++106, ++0, ++144, ++57, + 1, + 169, + 3, +@@ -627,4 +633,1798 @@ unsigned char rpi_hevc_transform [] = { + 30, + 90, + 0, ++169, ++3, ++73, ++64, ++52, ++64, ++45, ++64, ++2, ++64, ++10, ++64, ++64, ++198, ++1, ++7, ++8, ++232, ++63, ++0, ++0, ++0, ++6, ++232, ++253, ++255, ++255, ++255, ++0, ++246, ++0, ++0, ++0, ++4, ++215, ++64, ++3, ++96, ++2, ++248, ++0, ++35, ++0, ++0, ++64, ++56, ++0, ++0, ++4, ++248, ++0, ++36, ++0, ++0, ++64, ++56, ++8, ++0, ++0, ++240, ++64, ++0, ++132, ++3, ++128, ++240, ++0, ++0, ++132, ++3, ++128, ++144, ++137, ++0, ++131, ++98, ++0, ++255, ++64, ++0, ++0, ++20, ++200, ++243, ++0, ++0, ++128, ++144, ++129, ++0, ++131, ++102, ++0, ++158, ++67, ++0, ++2, ++248, ++0, ++35, ++0, ++0, ++64, ++56, ++0, ++0, ++4, ++248, ++0, ++36, ++0, ++0, ++64, ++56, ++8, ++0, ++0, ++240, ++64, ++0, ++132, ++3, ++128, ++240, ++0, ++0, ++132, ++3, ++128, ++144, ++108, ++0, ++131, ++98, ++0, ++255, ++64, ++0, ++0, ++20, ++200, ++243, ++0, ++0, ++128, ++144, ++100, ++0, ++131, ++102, ++0, ++248, ++64, ++0, ++112, ++0, ++192, ++243, ++211, ++31, ++128, ++248, ++0, ++0, ++112, ++0, ++192, ++243, ++211, ++31, ++128, ++144, ++161, ++0, ++188, ++64, ++67, ++232, ++0, ++2, ++0, ++0, ++0, ++255, ++64, ++0, ++0, ++20, ++200, ++243, ++0, ++0, ++128, ++144, ++150, ++0, ++195, ++232, ++0, ++2, ++0, ++0, ++12, ++128, ++7, ++192, ++130, ++248, ++0, ++0, ++112, ++192, ++224, ++16, ++195, ++31, ++132, ++248, ++1, ++0, ++112, ++0, ++224, ++16, ++203, ++31, ++3, ++99, ++131, ++71, ++68, ++232, ++32, ++0, ++0, ++0, ++0, ++99, ++2, ++99, ++23, ++102, ++7, ++106, ++127, ++156, ++182, ++255, ++0, ++248, ++64, ++0, ++112, ++0, ++192, ++243, ++211, ++31, ++128, ++248, ++0, ++0, ++112, ++0, ++192, ++243, ++211, ++31, ++128, ++144, ++112, ++0, ++188, ++64, ++67, ++232, ++0, ++2, ++0, ++0, ++0, ++255, ++64, ++0, ++0, ++20, ++200, ++243, ++0, ++0, ++128, ++144, ++101, ++0, ++195, ++232, ++0, ++2, ++0, ++0, ++12, ++128, ++7, ++192, ++130, ++248, ++0, ++0, ++112, ++192, ++224, ++16, ++195, ++31, ++132, ++248, ++1, ++0, ++112, ++0, ++224, ++16, ++203, ++31, ++25, ++102, ++9, ++106, ++2, ++30, ++41, ++3, ++26, ++87, ++162, ++64, ++64, ++198, ++1, ++23, ++127, ++158, ++103, ++255, ++239, ++3, ++0, ++254, ++0, ++143, ++92, ++0, ++0, ++240, ++12, ++0, ++0, ++254, ++64, ++143, ++93, ++0, ++0, ++240, ++12, ++0, ++0, ++254, ++128, ++143, ++94, ++0, ++0, ++240, ++12, ++0, ++0, ++254, ++192, ++143, ++95, ++0, ++0, ++240, ++12, ++0, ++0, ++254, ++192, ++142, ++208, ++0, ++0, ++240, ++12, ++0, ++0, ++254, ++128, ++142, ++209, ++0, ++0, ++240, ++12, ++0, ++0, ++254, ++64, ++142, ++210, ++0, ++0, ++240, ++12, ++0, ++0, ++254, ++0, ++142, ++211, ++0, ++0, ++240, ++12, ++0, ++128, ++144, ++107, ++0, ++8, ++255, ++99, ++23, ++0, ++212, ++192, ++51, ++0, ++0, ++8, ++255, ++163, ++23, ++0, ++228, ++192, ++51, ++0, ++0, ++8, ++255, ++227, ++23, ++0, ++244, ++192, ++51, ++0, ++0, ++8, ++255, ++35, ++52, ++0, ++180, ++192, ++51, ++0, ++0, ++8, ++255, ++99, ++52, ++0, ++164, ++192, ++51, ++0, ++0, ++8, ++255, ++163, ++52, ++0, ++148, ++192, ++51, ++0, ++0, ++111, ++3, ++239, ++3, ++0, ++254, ++0, ++143, ++12, ++0, ++0, ++240, ++12, ++0, ++0, ++254, ++64, ++143, ++13, ++0, ++0, ++240, ++12, ++0, ++0, ++254, ++128, ++143, ++14, ++0, ++0, ++240, ++12, ++0, ++0, ++254, ++192, ++143, ++15, ++0, ++0, ++240, ++12, ++0, ++0, ++254, ++192, ++142, ++16, ++0, ++0, ++240, ++12, ++0, ++0, ++254, ++128, ++142, ++17, ++0, ++0, ++240, ++12, ++0, ++0, ++254, ++64, ++142, ++18, ++0, ++0, ++240, ++12, ++0, ++0, ++254, ++0, ++142, ++19, ++0, ++0, ++240, ++12, ++0, ++128, ++144, ++33, ++0, ++8, ++255, ++99, ++3, ++0, ++212, ++192, ++51, ++0, ++0, ++8, ++255, ++163, ++3, ++0, ++228, ++192, ++51, ++0, ++0, ++8, ++255, ++227, ++3, ++0, ++244, ++192, ++51, ++0, ++0, ++8, ++255, ++35, ++4, ++0, ++180, ++192, ++51, ++0, ++0, ++8, ++255, ++99, ++4, ++0, ++164, ++192, ++51, ++0, ++0, ++8, ++255, ++163, ++4, ++0, ++148, ++192, ++51, ++0, ++0, ++111, ++3, ++32, ++246, ++192, ++11, ++1, ++16, ++32, ++246, ++2, ++137, ++47, ++240, ++40, ++246, ++2, ++140, ++47, ++240, ++128, ++245, ++99, ++140, ++5, ++4, ++0, ++247, ++99, ++140, ++1, ++20, ++88, ++246, ++99, ++140, ++1, ++20, ++0, ++247, ++35, ++136, ++62, ++226, ++32, ++247, ++35, ++136, ++32, ++210, ++0, ++247, ++34, ++136, ++63, ++2, ++208, ++246, ++34, ++136, ++0, ++4, ++0, ++247, ++99, ++136, ++58, ++162, ++32, ++247, ++99, ++136, ++33, ++146, ++0, ++247, ++98, ++136, ++59, ++18, ++208, ++246, ++98, ++136, ++0, ++20, ++0, ++247, ++162, ++136, ++33, ++2, ++88, ++246, ++98, ++137, ++2, ++68, ++88, ++246, ++162, ++137, ++3, ++68, ++208, ++254, ++227, ++136, ++60, ++242, ++192, ++243, ++188, ++11, ++208, ++254, ++227, ++136, ++56, ++178, ++192, ++243, ++188, ++10, ++32, ++255, ++226, ++136, ++38, ++58, ++192, ++243, ++60, ++0, ++208, ++254, ++227, ++136, ++59, ++242, ++192, ++243, ++60, ++128, ++32, ++255, ++226, ++136, ++49, ++58, ++192, ++243, ++60, ++128, ++0, ++255, ++226, ++136, ++34, ++34, ++192, ++243, ++60, ++128, ++32, ++255, ++226, ++136, ++37, ++58, ++192, ++243, ++60, ++128, ++0, ++254, ++192, ++136, ++1, ++4, ++0, ++240, ++0, ++160, ++0, ++255, ++194, ++8, ++0, ++52, ++195, ++243, ++0, ++128, ++0, ++255, ++202, ++40, ++0, ++52, ++195, ++243, ++0, ++128, ++0, ++254, ++0, ++240, ++35, ++10, ++0, ++240, ++60, ++0, ++0, ++254, ++192, ++136, ++1, ++4, ++0, ++240, ++0, ++160, ++0, ++255, ++226, ++140, ++34, ++34, ++195, ++243, ++60, ++0, ++32, ++255, ++227, ++140, ++36, ++58, ++192, ++243, ++60, ++0, ++0, ++254, ++192, ++136, ++0, ++4, ++0, ++240, ++0, ++160, ++16, ++246, ++226, ++136, ++35, ++50, ++16, ++246, ++226, ++136, ++35, ++50, ++32, ++246, ++226, ++136, ++35, ++50, ++32, ++254, ++226, ++136, ++35, ++58, ++192, ++243, ++60, ++0, ++11, ++96, ++0, ++254, ++0, ++240, ++1, ++4, ++0, ++240, ++64, ++115, ++5, ++106, ++0, ++144, ++173, ++1, ++27, ++96, ++0, ++254, ++0, ++240, ++1, ++4, ++0, ++240, ++64, ++147, ++5, ++106, ++0, ++144, ++227, ++0, ++64, ++246, ++163, ++140, ++1, ++4, ++0, ++246, ++192, ++175, ++63, ++2, ++0, ++246, ++192, ++174, ++59, ++2, ++0, ++246, ++128, ++175, ++62, ++2, ++0, ++246, ++128, ++174, ++58, ++2, ++0, ++246, ++64, ++175, ++61, ++2, ++0, ++246, ++64, ++174, ++57, ++2, ++0, ++255, ++43, ++240, ++4, ++212, ++192, ++243, ++128, ++11, ++64, ++254, ++43, ++240, ++1, ++228, ++192, ++243, ++128, ++10, ++64, ++254, ++43, ++240, ++1, ++244, ++192, ++243, ++128, ++10, ++64, ++254, ++43, ++240, ++1, ++180, ++192, ++243, ++128, ++10, ++64, ++254, ++43, ++141, ++0, ++164, ++192, ++243, ++128, ++10, ++88, ++246, ++35, ++141, ++3, ++68, ++32, ++247, ++35, ++141, ++191, ++66, ++240, ++246, ++35, ++141, ++50, ++66, ++0, ++255, ++235, ++143, ++52, ++242, ++192, ++243, ++60, ++128, ++0, ++255, ++43, ++240, ++2, ++212, ++192, ++243, ++128, ++11, ++0, ++255, ++43, ++240, ++191, ++226, ++192, ++243, ++188, ++10, ++64, ++254, ++43, ++141, ++0, ++180, ++192, ++243, ++128, ++10, ++88, ++246, ++35, ++141, ++2, ++68, ++32, ++247, ++35, ++141, ++190, ++66, ++240, ++246, ++35, ++141, ++50, ++66, ++0, ++255, ++171, ++143, ++52, ++226, ++192, ++243, ++60, ++128, ++0, ++255, ++43, ++240, ++4, ++180, ++192, ++243, ++128, ++11, ++0, ++255, ++43, ++240, ++191, ++226, ++192, ++243, ++188, ++10, ++128, ++253, ++43, ++240, ++3, ++212, ++192, ++243, ++128, ++10, ++64, ++254, ++35, ++141, ++1, ++196, ++192, ++243, ++128, ++10, ++88, ++246, ++35, ++141, ++3, ++68, ++32, ++247, ++35, ++141, ++189, ++66, ++240, ++246, ++35, ++141, ++50, ++66, ++0, ++255, ++107, ++143, ++52, ++210, ++192, ++243, ++60, ++128, ++0, ++255, ++43, ++240, ++4, ++148, ++192, ++243, ++128, ++11, ++64, ++254, ++43, ++240, ++1, ++164, ++192, ++243, ++128, ++10, ++64, ++254, ++43, ++240, ++1, ++180, ++192, ++243, ++128, ++10, ++64, ++254, ++43, ++240, ++1, ++244, ++192, ++243, ++128, ++10, ++64, ++254, ++43, ++141, ++0, ++228, ++192, ++243, ++128, ++10, ++88, ++246, ++35, ++141, ++3, ++68, ++32, ++247, ++35, ++141, ++187, ++66, ++240, ++246, ++35, ++141, ++50, ++66, ++0, ++255, ++235, ++142, ++52, ++178, ++192, ++243, ++60, ++128, ++0, ++255, ++43, ++240, ++2, ++148, ++192, ++243, ++128, ++11, ++0, ++255, ++43, ++240, ++187, ++162, ++192, ++243, ++188, ++10, ++64, ++254, ++43, ++141, ++0, ++244, ++192, ++243, ++128, ++10, ++88, ++246, ++35, ++141, ++2, ++68, ++32, ++247, ++35, ++141, ++186, ++66, ++240, ++246, ++35, ++141, ++50, ++66, ++0, ++255, ++171, ++142, ++52, ++162, ++192, ++243, ++60, ++128, ++0, ++255, ++43, ++240, ++4, ++244, ++192, ++243, ++128, ++11, ++0, ++255, ++43, ++240, ++187, ++162, ++192, ++243, ++188, ++10, ++128, ++253, ++43, ++240, ++3, ++148, ++192, ++243, ++128, ++10, ++64, ++254, ++35, ++141, ++1, ++132, ++192, ++243, ++128, ++10, ++88, ++246, ++35, ++141, ++3, ++68, ++32, ++247, ++35, ++141, ++185, ++66, ++240, ++246, ++35, ++141, ++50, ++66, ++0, ++255, ++107, ++142, ++52, ++146, ++192, ++243, ++60, ++128, ++64, ++255, ++98, ++141, ++0, ++52, ++192, ++243, ++0, ++0, ++0, ++254, ++0, ++240, ++53, ++10, ++0, ++240, ++60, ++0, ++0, ++254, ++0, ++240, ++1, ++4, ++0, ++240, ++64, ++147, ++5, ++106, ++0, ++144, ++177, ++0, ++88, ++246, ++163, ++140, ++1, ++4, ++128, ++245, ++99, ++141, ++10, ++4, ++88, ++246, ++162, ++138, ++1, ++68, ++0, ++247, ++162, ++138, ++36, ++162, ++88, ++254, ++162, ++138, ++3, ++164, ++192, ++243, ++128, ++11, ++0, ++255, ++226, ++137, ++32, ++2, ++195, ++243, ++60, ++0, ++32, ++247, ++226, ++137, ++42, ++114, ++0, ++255, ++34, ++138, ++33, ++18, ++195, ++243, ++60, ++0, ++32, ++247, ++34, ++138, ++42, ++130, ++16, ++246, ++98, ++138, ++40, ++114, ++16, ++246, ++98, ++138, ++41, ++146, ++32, ++246, ++98, ++138, ++41, ++146, ++32, ++246, ++226, ++137, ++41, ++146, ++40, ++246, ++34, ++138, ++41, ++146, ++32, ++247, ++163, ++141, ++63, ++178, ++32, ++247, ++227, ++141, ++62, ++162, ++0, ++254, ++0, ++240, ++8, ++4, ++0, ++240, ++128, ++11, ++128, ++253, ++35, ++240, ++9, ++100, ++192, ++243, ++128, ++10, ++128, ++253, ++163, ++141, ++128, ++115, ++192, ++243, ++152, ++10, ++88, ++246, ++163, ++141, ++4, ++100, ++208, ++246, ++35, ++139, ++0, ++100, ++32, ++255, ++34, ++139, ++53, ++202, ++192, ++243, ++60, ++128, ++0, ++254, ++0, ++139, ++0, ++4, ++0, ++240, ++0, ++160, ++240, ++246, ++163, ++141, ++48, ++98, ++0, ++247, ++99, ++139, ++63, ++210, ++0, ++247, ++98, ++139, ++1, ++212, ++88, ++254, ++98, ++139, ++1, ++212, ++192, ++243, ++128, ++11, ++32, ++255, ++99, ++139, ++62, ++98, ++192, ++243, ++188, ++10, ++88, ++246, ++98, ++139, ++1, ++212, ++240, ++246, ++98, ++139, ++50, ++210, ++0, ++247, ++163, ++128, ++59, ++146, ++0, ++247, ++160, ++128, ++1, ++36, ++88, ++254, ++160, ++128, ++1, ++36, ++192, ++243, ++128, ++11, ++0, ++247, ++163, ++128, ++58, ++98, ++64, ++255, ++35, ++240, ++0, ++100, ++192, ++243, ++128, ++10, ++64, ++255, ++163, ++128, ++0, ++164, ++192, ++243, ++128, ++10, ++88, ++246, ++160, ++128, ++1, ++36, ++240, ++246, ++160, ++128, ++50, ++34, ++8, ++255, ++227, ++143, ++54, ++242, ++192, ++243, ++60, ++128, ++40, ++255, ++227, ++142, ++54, ++178, ++192, ++243, ++60, ++128, ++0, ++254, ++0, ++240, ++39, ++10, ++0, ++240, ++60, ++128, ++8, ++255, ++163, ++143, ++45, ++226, ++192, ++243, ++60, ++128, ++0, ++254, ++0, ++240, ++44, ++10, ++0, ++240, ++60, ++0, ++0, ++254, ++0, ++240, ++40, ++10, ++0, ++240, ++60, ++128, ++8, ++255, ++163, ++142, ++2, ++162, ++192, ++243, ++60, ++128, ++90, ++0, + }; +diff --git a/libavcodec/rpi_hevc_transform.s b/libavcodec/rpi_hevc_transform.s +index fd159bc..b055208 100644 +--- a/libavcodec/rpi_hevc_transform.s ++++ b/libavcodec/rpi_hevc_transform.s +@@ -83,6 +83,8 @@ + hevc_trans_16x16: + cmp r5,1 + beq memclear16 ++ cmp r5,2 ++ beq hevc_deblock_16x16 + push r6-r15, lr # TODO cut down number of used registers + mov r14,r3 # coeffs32 + mov r15,r4 # num32 +@@ -282,3 +284,427 @@ loop: + cmp r1,0 + bgt loop + b lr ++ ++ ++################################################################################ ++# HEVC VPU Deblock ++# ++# Vertical edges before horizontal ++# Decision can change every 4 pixels, but only 8 pixel boundaries are deblocked ++# ++# ARM is responsible for storing beta and tc for each 4 pixels horiz and vert edge. ++# The VPU code works in units of 16x16 blocks. ++# We do vertical filtering for the current block followed by horizontal filtering for the previous (except for the first time). ++# One final horizontal filter is required at the end. ++# PCM is not allowed in this code. ++# ++# ++# H(16-4:16+15,0) contains previous block (note that we need 4 lines above of context that may get altered during filtering) ++# H(16:31,16) contains current block (note that we do not need the upper lines until the horizontal filtering. ++ ++.set P0,63 ++.set P1,62 ++.set P2,61 ++.set P3,60 ++.set Q0,59 ++.set Q1,58 ++.set Q2,57 ++.set Q3,56 ++ ++.set dp,32 ++.set dq,33 ++.set d,34 ++.set decision,35 ++.set beta,36 ++.set beta2,37 ++.set beta3,38 ++.set ptest,39 ++.set qtest,40 ++.set pqtest,41 ++.set thresh,42 ++.set deltatest, 44 ++.set deltap1, 45 ++.set tc25, 46 ++.set setup,47 ++.set tc,48 ++.set tc25,49 ++.set tc2, 50 ++.set do_filter, 51 ++.set delta, 52 ++.set tc10, 53 ++.set delta0, 54 ++.set delta1, 55 ++.set zeros, 0 ++.set setup_input, 1 ++.set deltaq1, 2 ++ ++ ++ ++# hevc_deblock_16x16 deblocks an entire row that is 16 pixels high by the full width of the image. ++# Row has num16 16x16 blocks across ++# Beta goes from 0 to 64 ++# tc goes from 0 to 24 ++# setup[block_idx][0=vert,1=horz][0=first edge, 1=second edge][0=beta,1=tc][0..3=edge number] ++# has 8 bytes per edge ++# has 16 bytes per direction ++# has 32 bytes per 16x16 block ++# hevc_deblock_16x16(uint8_t *img (r0), int stride (r1), int num16w (r2), uint8_t setup[num16][2][2][2][4](r3),int num16h(r4)) ++hevc_deblock_16x16: ++ push r6-r15, lr ++ mov r9,r4 ++ mov r4,r3 ++ mov r13,r2 ++ mov r2,r0 ++ mov r10,r0 ++ subscale4 r0,r1 ++ mov r8,63 ++ mov r6,-3 ++ vmov H(zeros,0),0 ++# r7 is number of blocks still to load ++# r0 is location of current block - 4 * stride ++# r1 is stride ++# r2 is location of current block ++# r3 is offset of start of block (actual edges start at H(16,16)+r3 for horizontal and H(16,0)+r3 for vertical ++# r4 is setup ++# r5 is for temporary calculations ++# r8 holds 63 ++# r6 holds -3 ++# r9 holds the number of 16 high rows to process ++# r10 holds the original img base ++# r11 returns 0 if no filtering was done on the edge ++# r12 saves a copy of this ++# r13 is copy of width ++ ++process_row: ++ # First iteration does not do horizontal filtering on previous ++ mov r7, r13 ++ mov r3,0 ++ vldb H(12++,16)+r3,(r0 += r1) REP 4 # Load the current block ++ vldb H(16++,16)+r3,(r2 += r1) REP 16 ++ vldb H(setup_input,0), (r4) # We may wish to prefetch these ++ vstb H(zeros,0),(r4) ++ bl vert_filter ++ add r3,8 ++ vadd H(setup_input,0),H(setup_input,8),0 # Rotate to second set of 8 ++ bl vert_filter ++ sub r3,8 ++ b start_deblock_loop ++deblock_loop: ++ # Middle iterations do vertical on current block and horizontal on preceding ++ vldb H(12++,16)+r3,(r0 += r1) REP 4 # load the current block ++ vldb H(16++,16)+r3,(r2 += r1) REP 16 ++ vldb H(setup_input,0), (r4) ++ vstb H(zeros,0),(r4) ++ bl vert_filter ++ add r3,8 ++ vadd H(setup_input,0),H(setup_input,8),0 ++ bl vert_filter ++ sub r3,8 ++ vldb H(setup_input,0), -16(r4) ++ vstb H(zeros,0),-16(r4) ++ bl horz_filter ++ mov r12,r11 ++ add r3,8*64 ++ vadd H(setup_input,0),H(setup_input,8),0 ++ bl horz_filter ++ sub r3,8*64 ++ addcmpbeq r12,0,0,skip_save_top ++ vstb H(12++,0)+r3,-16(r0 += r1) REP 4 # Save the deblocked pixels for the previous block ++skip_save_top: ++ vstb H(16++,0)+r3,-16(r2 += r1) REP 16 ++start_deblock_loop: ++ # move onto next 16x16 (could do this with circular buffer support instead) ++ add r3,16 ++ and r3,r8 ++ add r4,32 ++ # Perform loop counter operations (may work with an addcmpbgt as well?) ++ add r0,16 ++ add r2,16 ++ sub r7,1 ++ cmp r7,0 # Are there still more blocks to load ++ bgt deblock_loop ++ ++ # Final iteration needs to just do horizontal filtering ++ vldb H(setup_input,0), -16(r4) ++ vstb H(zeros,0),-16(r4) ++ bl horz_filter ++ mov r12,r11 ++ add r3,8*64 ++ vadd H(setup_input,0),H(setup_input,8),0 ++ bl horz_filter ++ sub r3,64*8 ++ addcmpbeq r12,0,0,skip_save_top2 ++ vstb H(12++,0)+r3,-16(r0 += r1) REP 4 # Save the deblocked pixels for the previous block ++skip_save_top2: ++ vstb H(16++,0)+r3,-16(r2 += r1) REP 16 ++ ++# Now look to see if we should do another row ++ sub r9,1 ++ cmp r9,0 ++ bgt start_again ++ pop r6-r15, pc ++start_again: ++ # Need to sort out r0,r2 to point to next row down ++ addscale16 r10,r1 ++ mov r2,r10 ++ subscale4 r0,r2,r1 ++ b process_row ++ ++ ++# At this stage H(16,16)+r3 points to the first pixel of the 16 high edge to be filtered ++# So we can reuse the code we move the parts to be filtered into HX(P0/P1/P2/P3/Q0/Q1/Q2/Q3,0) - we will perform a final saturation step on placing them back into the correct locations ++ ++vert_filter: ++ push lr ++ ++ vmov HX(P3,0), V(16,12)+r3 ++ vmov HX(P2,0), V(16,13)+r3 ++ vmov HX(P1,0), V(16,14)+r3 ++ vmov HX(P0,0), V(16,15)+r3 ++ vmov HX(Q0,0), V(16,16)+r3 ++ vmov HX(Q1,0), V(16,17)+r3 ++ vmov HX(Q2,0), V(16,18)+r3 ++ vmov HX(Q3,0), V(16,19)+r3 ++ ++ bl do_luma_filter ++ ++ vadds V(16,13)+r3, HX(P2,0), 0 ++ vadds V(16,14)+r3, HX(P1,0), 0 ++ vadds V(16,15)+r3, HX(P0,0), 0 ++ # P3 and Q3 never change so don't bother saving back ++ vadds V(16,16)+r3, HX(Q0,0), 0 ++ vadds V(16,17)+r3, HX(Q1,0), 0 ++ vadds V(16,18)+r3, HX(Q2,0), 0 ++ ++ pop pc ++ ++# Filter edge at H(16,0)+r3 ++horz_filter: ++ push lr ++ ++ vmov HX(P3,0), H(12,0)+r3 ++ vmov HX(P2,0), H(13,0)+r3 ++ vmov HX(P1,0), H(14,0)+r3 ++ vmov HX(P0,0), H(15,0)+r3 ++ vmov HX(Q0,0), H(16,0)+r3 ++ vmov HX(Q1,0), H(17,0)+r3 ++ vmov HX(Q2,0), H(18,0)+r3 ++ vmov HX(Q3,0), H(19,0)+r3 ++ ++ bl do_luma_filter ++ ++ vadds H(13,0)+r3, HX(P2,0), 0 ++ vadds H(14,0)+r3, HX(P1,0), 0 ++ vadds H(15,0)+r3, HX(P0,0), 0 ++ # P3 and Q3 never change so don't bother saving back ++ vadds H(16,0)+r3, HX(Q0,0), 0 ++ vadds H(17,0)+r3, HX(Q1,0), 0 ++ vadds H(18,0)+r3, HX(Q2,0), 0 ++ ++ pop pc ++ ++# r4 points to array of beta/tc for each 4 length edge ++do_luma_filter: ++ valtl H(setup,0),H(setup_input,0),H(setup_input,0) # b*8tc*8 ++ valtl HX(beta,0),H(setup,0),H(setup,0) ++ valtu HX(tc,0),H(setup,0),H(setup,0) ++ vmul HX(tc25,0), HX(tc,0), 5 ++ vadd HX(tc25,0),HX(tc25,0), 1 ++ vasr HX(tc25,0), HX(tc25,0), 1 ++ ++ # Compute decision ++ vadd HX(dp,0),HX(P1,0),HX(P1,0) # 2*P1 ++ vsub HX(dp,0),HX(P2,0),HX(dp,0) # P2-2*P1 ++ vadd HX(dp,0),HX(dp,0),HX(P0,0) # P2-2*P1+P0 ++ vdist HX(dp,0),HX(dp,0),0 # abs(P2-2*P1+P0) # dp0 ++ ++ vadd HX(dq,0),HX(Q1,0),HX(Q1,0) # 2*Q1 ++ vsub HX(dq,0),HX(Q2,0),HX(dq,0) # Q2-2*Q1 ++ vadd HX(dq,0),HX(dq,0),HX(Q0,0) # Q2-2*Q1+Q0 ++ vdist HX(dq,0),HX(dq,0),0 # abs(Q2-2*Q1+Q0) # dq0 ++ ++ vadd HX(d,0), HX(dp,0), HX(dq,0) ++ vasr HX(beta2,0),HX(beta,0),2 ++ vasr HX(beta3,0),HX(beta,0),3 ++ ++ # Compute flags that are negative if all conditions pass ++ vdist HX(decision,0), HX(P0,0), HX(P3,0) CLRA SACC ++ vdist HX(decision,0), HX(Q0,0), HX(Q3,0) SACC ++ vsub HX(decision,0), HX(decision,0), HX(beta3,0) SETF ++ ++ vdist HX(decision,0), HX(P0,0), HX(Q0,0) IFN ++ vsub HX(decision,0), HX(decision,0), HX(tc25,0) IFN SETF ++ vadd HX(decision,0), HX(d,0), HX(d,0) IFN ++ vsub HX(decision,0), HX(decision,0), HX(beta2,0) IFN SETF ++ vmov HX(decision,0), 1 IFNN ++ vadd H(decision,0),H(decision,3),0 IFN ++ vadd H(decision,16),H(decision,19),0 IFN ++ vmov -,HX(decision,0) SETF # N marks strong filter ++ vmov HX(decision,0), 1 IFNN # NN marks normal filter ++ ++ vadd HX(do_filter,0), HX(d,3), HX(d,0) ++ vsub HX(do_filter,0), HX(do_filter,0), HX(beta,0) SETF # IFNN means no filter ++ vmov HX(decision,0),0 IFNN # Z marks no filter ++ ++ # Expand out decision (currently valid one every 4 pixels) 0...1...2...3 ++ # First extract out even terms ++ vodd HX(decision,0),HX(decision,0),HX(decision,0) # 0.1.2.3 ++ vodd HX(decision,0),HX(decision,0),HX(decision,0) # 0123 ++ # Now expand back ++ valtl HX(decision,0),HX(decision,0),HX(decision,0) # 00112233 ++ valtl HX(decision,0),HX(decision,0),HX(decision,0) SETF # 0000111122223333 ++ ++ # HX(decision,0) is negative if want strong filtering, 1 if want normal filtering, 0 if want no filtering ++ ++ # Do a quick check to see if there is anything to do ++ mov r11, 0 # Signal no filtering ++ vmov -,1 IFNZ SUMS r5 ++ cmp r5,0 ++ beq filtering_done ++ mov r11, 1 # Signal some filtering ++ # And whether there is any strong filtering ++ vmov -,1 IFN SUMS r5 ++ cmp r5,0 ++ beq normal_filtering ++ ++ ############################################################################## ++ # Strong filtering - could maybe fast case if all have same sign? (especially if all disabled!) ++ vshl HX(tc2,0), HX(tc,0), 1 # Note that in normal filtering tx2 is tc/2, while here it is tc*2 ++ ++ # Take a copy of the original pixels for use in decision calculation ++ vmov HX(P0,32),HX(P0,0) ++ vmov HX(Q0,32),HX(Q0,0) ++ vmov HX(P1,32),HX(P1,0) ++ vmov HX(Q1,32),HX(Q1,0) ++ vmov HX(P2,32),HX(P2,0) ++ vmov HX(Q2,32),HX(Q2,0) ++ ++ vadd -,HX(P2,32),4 CLRA SACC ++ vshl -,HX(P1,32),1 SACC ++ vshl -,HX(P0,32),1 SACC ++ vshl -,HX(Q0,32),1 SACC ++ vshl HX(delta,0),HX(Q1,32),0 SACC ++ vasr HX(delta,0),HX(delta,0), 3 ++ vsub HX(delta,0),HX(delta,0),HX(P0,32) ++ vclamps HX(delta,0), HX(delta,0), HX(tc2,0) ++ vadd HX(P0,0),HX(P0,32),HX(delta,0) IFN ++ ++ vadd -,HX(P2,32),2 CLRA SACC ++ vadd -,HX(P1,32),HX(P0,32) SACC ++ vshl HX(delta,0),HX(Q0,32),0 SACC ++ vasr HX(delta,0),HX(delta,0), 2 ++ vsub HX(delta,0),HX(delta,0),HX(P1,32) ++ vclamps HX(delta,0), HX(delta,0), HX(tc2,0) ++ vadd HX(P1,0),HX(P1,32),HX(delta,0) IFN ++ ++ vadd -,HX(Q0,32),4 CLRA SACC ++ vadd -,HX(P1,32),HX(P0,32) SACC ++ vmul -,HX(P2,32),3 SACC ++ vshl HX(delta,0),HX(P3,0),1 SACC # Note that we have not made a copy of P3, so using P3,0 is correct ++ vasr HX(delta,0),HX(delta,0), 3 ++ vsub HX(delta,0),HX(delta,0),HX(P2,32) ++ vclamps HX(delta,0), HX(delta,0), HX(tc2,0) ++ vadd HX(P2,0),HX(P2,32),HX(delta,0) IFN ++ #vmov HX(P2,0),3 IFN ++ ++ # Now reverse all P/Qs ++ ++ vadd -,HX(Q2,32),4 CLRA SACC ++ vshl -,HX(Q1,32),1 SACC ++ vshl -,HX(Q0,32),1 SACC ++ vshl -,HX(P0,32),1 SACC ++ vshl HX(delta,0),HX(P1,32),0 SACC ++ vasr HX(delta,0),HX(delta,0), 3 ++ vsub HX(delta,0),HX(delta,0),HX(Q0,32) ++ vclamps HX(delta,0), HX(delta,0), HX(tc2,0) ++ vadd HX(Q0,0),HX(Q0,32),HX(delta,0) IFN ++ ++ vadd -,HX(Q2,32),2 CLRA SACC ++ vadd -,HX(Q1,32),HX(Q0,32) SACC ++ vshl HX(delta,0),HX(P0,32),0 SACC ++ vasr HX(delta,0),HX(delta,0), 2 ++ vsub HX(delta,0),HX(delta,0),HX(Q1,32) ++ vclamps HX(delta,0), HX(delta,0), HX(tc2,0) ++ vadd HX(Q1,0),HX(Q1,32),HX(delta,0) IFN ++ ++ vadd -,HX(P0,32),4 CLRA SACC ++ vadd -,HX(Q1,32),HX(Q0,32) SACC ++ vmul -,HX(Q2,32),3 SACC ++ vshl HX(delta,0),HX(Q3,0),1 SACC # Note that we have not made a copy of Q3, so using Q3,0 is correct ++ vasr HX(delta,0),HX(delta,0), 3 ++ vsub HX(delta,0),HX(delta,0),HX(Q2,32) ++ vclamps HX(delta,0), HX(delta,0), HX(tc2,0) ++ vadd HX(Q2,0),HX(Q2,32),HX(delta,0) IFN ++ ++ ############################################################################## ++ # Normal filtering ++normal_filtering: ++ # Invert the decision flags ++ # make instruction more complicated as assembler has error and loses SETF ++ vrsub HX(tc10,0), HX(decision,0), 0 SETF # IFN means normal filtering ++ vmov -, HX(tc10,0) SETF # IFN means normal filtering ++ ++ vmov -,1 IFN SUMS r5 ++ cmp r5,0 ++ beq filtering_done ++ ++ vasr HX(tc2,0), HX(tc,0), 1 ++ vmul HX(tc10,0), HX(tc,0), 10 ++ ++ vasr HX(thresh,0), HX(beta,0), 1 ++ vadd HX(thresh,0), HX(thresh,0), HX(beta,0) ++ vasr HX(thresh,0), HX(thresh,0), 3 CLRA SACC ++ ++ vadd HX(ptest,0),HX(dp,3),HX(dp,0) ++ vsub HX(ptest,0),HX(ptest,0),HX(thresh,0) # ptest is negative if we need to do the P2 pixel ++ vadd HX(qtest,0),HX(dq,3),HX(dq,0) ++ vsub HX(qtest,0),HX(qtest,0),HX(thresh,0) # qtest is negative if we need to do the Q2 pixel ++ # Expand ptest and qtest together ++ vodd HX(pqtest,0),HX(ptest,0),HX(qtest,0) # p.p.p.p.q.q.q.q ++ vodd HX(pqtest,0),HX(pqtest,0),HX(pqtest,0) # ppppqqqq........ ++ valtl HX(pqtest,0),HX(pqtest,0),HX(pqtest,0) # ppppppppqqqqqqqq ++ valtl HX(ptest,0),HX(pqtest,0),HX(pqtest,0) ++ valtu HX(qtest,0),HX(pqtest,0),HX(pqtest,0) ++ ++ vsub HX(delta0,0), HX(Q0,0), HX(P0,0) ++ vsub HX(delta1,0), HX(Q1,0), HX(P1,0) ++ vmov -,8 CLRA SACC ++ vmul -,HX(delta0,0), 9 SACC ++ vmul HX(delta0,0),HX(delta1,0), r6 SACC ++ vasr HX(delta0,0), HX(delta0,0), 4 ++ vdist HX(deltatest,0), HX(delta0,0), 0 ++ vsub HX(deltatest,0), HX(deltatest,0), HX(tc10,0) IFN SETF # negative if still need to do something ++ vmov HX(deltatest,0), 0 IFNN # clear if no need to do anything so we can reload flags later ++ ++ vclamps HX(delta0,0), HX(delta0,0), HX(tc,0) ++ ++ vadd HX(deltap1,0), HX(P2,0), HX(P0,0) ++ vadd HX(deltap1,0), HX(deltap1,0), 1 ++ vasr HX(deltap1,0), HX(deltap1,0), 1 CLRA SACC ++ vsub HX(deltap1,0), HX(delta0,0), HX(P1,0) SACC ++ vasr HX(deltap1,0), HX(deltap1,0), 1 ++ vclamps HX(deltap1,0), HX(deltap1,0), HX(tc2,0) ++ ++ vadd HX(deltaq1,0), HX(Q2,0), HX(Q0,0) ++ vadd HX(deltaq1,0), HX(deltaq1,0), 1 ++ vasr HX(deltaq1,0), HX(deltaq1,0), 1 CLRA SACC ++ vadd HX(deltaq1,0), HX(delta0,0), HX(Q1,0) ++ vrsub -, HX(delta0,0), 0 SACC ++ vrsub HX(deltaq1,0), HX(Q1,0), 0 SACC ++ vasr HX(deltaq1,0), HX(deltaq1,0), 1 ++ vclamps HX(deltaq1,0), HX(deltaq1,0), HX(tc2,0) ++ ++ vadds HX(P0,0), HX(P0,0), HX(delta0,0) IFN ++ vsubs HX(Q0,0), HX(Q0,0), HX(delta0,0) IFN ++ ++ vmov -,HX(ptest,0) IFN SETF # Negative if need to do p1 ++ vadds HX(P1,0), HX(P1,0), HX(deltap1,0) IFN ++ ++ vmov -,HX(deltatest,0) SETF ++ vmov -,HX(qtest,0) IFN SETF # Negative if need to do q1 ++ vadds HX(Q1,0), HX(Q1,0), HX(deltaq1,0) IFN ++ ++ #vmov HX(P2,0),1 IFN ++ ++filtering_done: ++ b lr +diff --git a/libavcodec/rpi_qpu.c b/libavcodec/rpi_qpu.c +index 0121fca..05b2169 100644 +--- a/libavcodec/rpi_qpu.c ++++ b/libavcodec/rpi_qpu.c +@@ -147,7 +147,7 @@ static int gpu_init(volatile struct GPU **gpu) { + vcsm_init(); + gpu_malloc_uncached_internal(sizeof(struct GPU), &gpu_mem_ptr, mb); + ptr = (volatile struct GPU*)gpu_mem_ptr.arm; +- memset(ptr, 0, sizeof *ptr); ++ memset((void*)ptr, 0, sizeof *ptr); + vc = gpu_mem_ptr.vc; + + ptr->mb = mb; +@@ -254,7 +254,7 @@ void gpu_cache_flush(GPU_MEM_PTR_T *p) + struct vcsm_user_clean_invalid_s iocache = {}; + iocache.s[0].handle = p->vcsm_handle; + iocache.s[0].cmd = 3; // clean+invalidate +- iocache.s[0].addr = p->arm; ++ iocache.s[0].addr = (int) p->arm; + iocache.s[0].size = p->numbytes; + vcsm_clean_invalid( &iocache ); + #else +@@ -390,6 +390,7 @@ static void *vpu_start(void *arg) { + #ifdef RPI_TIME_TOTAL_POSTED + int last_time=0; + long long on_time=0; ++ long long on_time_deblock=0; + long long off_time=0; + int start_time; + int end_time; +@@ -451,10 +452,13 @@ static void *vpu_start(void *arg) { + #ifdef RPI_TIME_TOTAL_POSTED + end_time = Microseconds(); + last_time = end_time; +- on_time += end_time - start_time; ++ if (p[6]==2) ++ on_time_deblock += end_time - start_time; ++ else ++ on_time += end_time - start_time; + count++; + if ((count&0x7f)==0) +- printf("Posted %d On=%dms, Off=%dms\n",count,(int)(on_time/1000),(int)(off_time/1000)); ++ printf("Posted %d On=%dms, On_deblock=%dms, Off=%dms\n",count,(int)(on_time/1000),(int)(on_time_deblock/1000),(int)(off_time/1000)); + #endif + pthread_mutex_lock(&post_mutex); + vpu_async_head++; +diff --git a/libavcodec/rpi_shader.c b/libavcodec/rpi_shader.c +index e86eb30..c5d8b29 100644 +--- a/libavcodec/rpi_shader.c ++++ b/libavcodec/rpi_shader.c +@@ -61,7 +61,7 @@ unsigned int rpi_shader[] = { + /* [0x00000120] */ 0x8c9e7052, 0x10025e18, // add t0s, r0, r1 ; mov ra_frame_base, r2 + /* [0x00000128] */ 0x0c9e7440, 0x10020f27, // add t1s, r2, r1 + /* [0x00000130] */ 0x00000008, 0xe00208a7, // mov r2,8 +-/* [0x00000138] */ 0x11827c80, 0x10021327, // shl rb12,unif, r2 ++/* [0x00000138] */ 0x11827c80, 0x10021327, // shl rb12,unif,r2 + /* [0x00000140] */ 0x0c827c80, 0x10021367, // add rb13,unif,r2 + /* [0x00000148] */ 0x15827d80, 0x100208a7, // mov r2, unif + /* [0x00000150] */ 0x119c15c0, 0xd00208a7, // shl r2, r2, 1 +-- +2.5.0 + + +From 1c7aae12a916196defd7ca1d5e8f052551535034 Mon Sep 17 00:00:00 2001 +From: Peter de Rivaz <peter.derivaz@gmail.com> +Date: Wed, 1 Jul 2015 09:21:17 +0100 +Subject: [PATCH 65/68] Added ability to combine jobs + +--- + libavcodec/rpi_qpu.c | 81 +++++++++++++++++++++++++++++++++++++++++++++++++++- + 1 file changed, 80 insertions(+), 1 deletion(-) + +diff --git a/libavcodec/rpi_qpu.c b/libavcodec/rpi_qpu.c +index 05b2169..91777be 100644 +--- a/libavcodec/rpi_qpu.c ++++ b/libavcodec/rpi_qpu.c +@@ -8,6 +8,8 @@ + #define RPI_TIME_TOTAL_POSTED + // define RPI_ASYNC to run the VPU in a separate thread, need to make a separate call to check for completion + #define RPI_ASYNC ++// Define RPI_COMBINE_JOBS to find jobs that can be executed in parallel ++#define RPI_COMBINE_JOBS + + #include <stdio.h> + #include <stdlib.h> +@@ -398,9 +400,15 @@ static void *vpu_start(void *arg) { + #endif + while(1) { + int i; +- int *p; ++ int *p; // Pointer for a QPU/VPU job ++#ifdef RPI_COMBINE_JOBS ++ int *q = NULL; // Pointer for a VPU only job ++ int have_qpu = 0; ++ int have_vpu = 0; ++#endif + int qpu_code; + int qpu_codeb; ++ int num_jobs; // Number of jobs available + pthread_mutex_lock(&post_mutex); + while( vpu_async_tail - vpu_async_head <= 0) + { +@@ -408,13 +416,38 @@ static void *vpu_start(void *arg) { + pthread_cond_wait(&post_cond_tail, &post_mutex); + } + p = vpu_cmds[vpu_async_head%MAXCMDS]; ++ num_jobs = vpu_async_tail - vpu_async_head; + pthread_mutex_unlock(&post_mutex); + + if (p[6] == -1) { + break; // Last job + } ++ if (p[7] == 0 && p[0] == 0 && p[16]==0) ++ goto job_done_early; ++ ++#ifdef RPI_COMBINE_JOBS ++ // First scan for a qpu job ++ for (int x=0;x<num_jobs;x++) { ++ p = vpu_cmds[(vpu_async_head+x)%MAXCMDS]; ++ if (p[7]) { ++ have_qpu = 1; ++ break; ++ } ++ } ++ // Now scan for a non-qpu job ++ for (int x=0;x<num_jobs;x++) { ++ q = vpu_cmds[(vpu_async_head+x)%MAXCMDS]; ++ if (!q[7]) { ++ have_vpu = 1; ++ break; ++ } ++ } ++ printf("Have_qpu = %d, have_vpu=%d\n",have_qpu,have_vpu); ++#endif + qpu_code = p[7]; + qpu_codeb = p[16]; ++ ++ + //if (p[7]) { + //GPU_MEM_PTR_T *buf = (GPU_MEM_PTR_T *)p[7]; + //gpu_cache_flush(buf); +@@ -427,6 +460,40 @@ static void *vpu_start(void *arg) { + off_time += start_time-last_time; + #endif + ++#ifdef RPI_COMBINE_JOBS ++ if (have_qpu) { ++ for(i=0;i<8;i++) { ++ gpu->mail[i*2] = p[8+i]; ++ gpu->mail[i*2 + 1] = qpu_code; ++ } ++ for(i=0;i<12;i++) { ++ gpu->mail2[i*2] = p[17+i]; ++ gpu->mail2[i*2 + 1] = qpu_codeb; ++ } ++ if (have_vpu) { ++ execute_multi(gpu->mb, ++ 12,gpu->vc + offsetof(struct GPU, mail2), 1, 5000, ++ 8,gpu->vc + offsetof(struct GPU, mail), 1 /* no flush */, 5000 /* timeout ms */, ++ p[0], p[1], p[2], p[3], p[4], p[5], p[6], // VPU0 ++ q[0], q[1], q[2], q[3], q[4], q[5], q[6]); // VPU1 ++ q[0] = 0; ++ } else { ++ execute_multi(gpu->mb, ++ 12,gpu->vc + offsetof(struct GPU, mail2), 1, 5000, ++ 8,gpu->vc + offsetof(struct GPU, mail), 1 /* no flush */, 5000 /* timeout ms */, ++ p[0], p[1], p[2], p[3], p[4], p[5], p[6], // VPU0 ++ 0, 0 , 0 , 0 , 0 , 0 , 0); // VPU1 ++ } ++ p[0] = 0; ++ p[7] = 0; ++ p[16] = 0; ++ } else { ++ av_assert0(have_vpu); ++ vpu_execute_code(q[0], q[1], q[2], q[3], q[4], q[5], q[6]); ++ q[0] = 0; ++ } ++#else ++ + if (!qpu_code) { + vpu_execute_code(p[0], p[1], p[2], p[3], p[4], p[5], p[6]); + } else { +@@ -449,17 +516,29 @@ static void *vpu_start(void *arg) { + 0, 0 , 0 , 0 , 0 , 0 , 0); // VPU1 + #endif + } ++#endif ++ + #ifdef RPI_TIME_TOTAL_POSTED + end_time = Microseconds(); + last_time = end_time; ++#ifdef RPI_COMBINE_JOBS ++ // There are three cases we may wish to distinguish of VPU/QPU activity ++ on_time += end_time - start_time; ++#else + if (p[6]==2) + on_time_deblock += end_time - start_time; + else + on_time += end_time - start_time; ++#endif + count++; + if ((count&0x7f)==0) ++#ifdef RPI_COMBINE_JOBS + printf("Posted %d On=%dms, On_deblock=%dms, Off=%dms\n",count,(int)(on_time/1000),(int)(on_time_deblock/1000),(int)(off_time/1000)); ++#else ++ printf("Posted %d On=%dms, Off=%dms\n",count,(int)(on_time/1000),(int)(off_time/1000)); ++#endif + #endif ++job_done_early: + pthread_mutex_lock(&post_mutex); + vpu_async_head++; + pthread_cond_broadcast(&post_cond_head); +-- +2.5.0 + + +From 3b056ce7d9bc16ac6d62fc84cb26e0991741ec26 Mon Sep 17 00:00:00 2001 +From: Peter de Rivaz <peter.derivaz@gmail.com> +Date: Wed, 1 Jul 2015 12:53:10 +0100 +Subject: [PATCH 66/68] Added chroma deblocking + +--- + libavcodec/hevc.c | 20 ++ + libavcodec/hevc.h | 12 +- + libavcodec/hevc_filter.c | 92 +++++- + libavcodec/rpi_hevc_transform.h | 644 +++++++++++++++++++++++++++++++++++++++- + libavcodec/rpi_hevc_transform.s | 207 +++++++++++++ + libavcodec/rpi_qpu.c | 27 +- + libavcodec/rpi_shader.qasm | 11 + + 7 files changed, 988 insertions(+), 25 deletions(-) + +diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c +index 0ecaf05..35a1394 100644 +--- a/libavcodec/hevc.c ++++ b/libavcodec/hevc.c +@@ -251,6 +251,14 @@ static void pic_arrays_free(HEVCContext *s) + gpu_free(&s->y_setup_ptr); + s->y_setup_arm = 0; + } ++ if (s->uv_setup_arm) { ++ gpu_free(&s->uv_setup_ptr); ++ s->uv_setup_arm = 0; ++ } ++ if (s->vpu_cmds_arm) { ++ gpu_free(&s->vpu_cmds_ptr); ++ s->vpu_cmds_arm = 0; ++ } + #endif + av_freep(&s->sao); + av_freep(&s->deblock); +@@ -324,6 +332,18 @@ static int pic_arrays_init(HEVCContext *s, const HEVCSPS *sps) + s->y_setup_vc = (void*)s->y_setup_ptr.vc; + memset(s->y_setup_arm, 0, s->y_setup_ptr.numbytes); + printf("Setup %d by %d by %d\n",s->setup_width,s->setup_height,sizeof(*s->y_setup_arm)); ++ ++ s->uv_setup_width = ( (sps->width >> sps->hshift[1]) + 15) / 16; ++ s->uv_setup_height = ( (sps->height >> sps->vshift[1]) + 15) / 16; ++ gpu_malloc_uncached(sizeof(*s->uv_setup_arm) * s->uv_setup_width * s->uv_setup_height, &s->uv_setup_ptr); // TODO make this cached ++ s->uv_setup_arm = (void*)s->uv_setup_ptr.arm; ++ s->uv_setup_vc = (void*)s->uv_setup_ptr.vc; ++ memset(s->uv_setup_arm, 0, s->uv_setup_ptr.numbytes); ++ printf("Setup uv %d by %d by %d\n",s->uv_setup_width,s->uv_setup_height,sizeof(*s->uv_setup_arm)); ++ ++ gpu_malloc_uncached(sizeof(*s->vpu_cmds_arm) * 3,&s->vpu_cmds_ptr); ++ s->vpu_cmds_arm = (void*) s->vpu_cmds_ptr.arm; ++ s->vpu_cmds_vc = s->vpu_cmds_ptr.vc; + #endif + + s->bs_width = (width >> 2) + 1; +diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h +index b1d3ee0..aa7cdc3 100644 +--- a/libavcodec/hevc.h ++++ b/libavcodec/hevc.h +@@ -55,7 +55,7 @@ + #define RPI_MAX_JOBS 2 + // Define RPI_WORKER to launch a worker thread for pixel processing tasks + #define RPI_WORKER +- ++ // Define RPI_DEBLOCK_VPU to perform deblocking on the VPUs + #define RPI_DEBLOCK_VPU + + #endif +@@ -1006,6 +1006,16 @@ typedef struct HEVCContext { + uint8_t (*y_setup_vc)[2][2][2][4]; + int setup_width; // Number of 16x16 blocks across the image + int setup_height; // Number of 16x16 blocks down the image ++ ++ GPU_MEM_PTR_T uv_setup_ptr; ++ uint8_t (*uv_setup_arm)[2][2][2][4]; // Half of this is unused [][][1][], but easier for the VPU as it allows us to store with zeros and addresses are aligned ++ uint8_t (*uv_setup_vc)[2][2][2][4]; ++ int uv_setup_width; ++ int uv_setup_height; ++ ++ GPU_MEM_PTR_T vpu_cmds_ptr; ++ int (*vpu_cmds_arm)[6]; // r0-r5 for each command ++ int vpu_cmds_vc; + #endif + + #endif +diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c +index 06371da..6367068 100644 +--- a/libavcodec/hevc_filter.c ++++ b/libavcodec/hevc_filter.c +@@ -656,9 +656,23 @@ static void deblocking_filter_CTB(HEVCContext *s, int x0, int y0) + s->frame->linesize[chroma], + c_tc, no_p, no_q); + } else ++#ifdef RPI_DEBLOCK_VPU ++ if (s->enable_rpi_deblock) { ++ uint8_t (*setup)[2][2][4]; ++ int xc = x>>s->ps.sps->hshift[chroma]; ++ int yc = y>>s->ps.sps->vshift[chroma]; ++ int num16 = (yc>>4)*s->uv_setup_width + (xc>>4); ++ int a = ((yc>>3) & 1) << 1; ++ int b = (xc>>3) & 1; ++ setup = s->uv_setup_arm[num16]; ++ setup[0][b][0][a] = c_tc[0]; ++ setup[0][b][0][a + 1] = c_tc[1]; ++ } else ++#endif + s->hevcdsp.hevc_v_loop_filter_chroma(src, + s->frame->linesize[chroma], + c_tc, no_p, no_q); ++ + } + } + +@@ -689,6 +703,19 @@ static void deblocking_filter_CTB(HEVCContext *s, int x0, int y0) + s->frame->linesize[chroma], + c_tc, no_p, no_q); + } else ++#ifdef RPI_DEBLOCK_VPU ++ if (s->enable_rpi_deblock) { ++ uint8_t (*setup)[2][2][4]; ++ int xc = x>>s->ps.sps->hshift[chroma]; ++ int yc = y>>s->ps.sps->vshift[chroma]; ++ int num16 = (yc>>4)*s->uv_setup_width + (xc>>4); ++ int a = ((xc>>3) & 1) << 1; ++ int b = (yc>>3) & 1; ++ setup = s->uv_setup_arm[num16]; ++ setup[1][b][0][a] = c_tc[0]; ++ setup[1][b][0][a + 1] = c_tc[1]; ++ } else ++#endif + s->hevcdsp.hevc_h_loop_filter_chroma(src, + s->frame->linesize[chroma], + c_tc, no_p, no_q); +@@ -1013,33 +1040,56 @@ void ff_hevc_flush_buffer(HEVCContext *s, ThreadFrame *f, int n) + static void rpi_deblock(HEVCContext *s, int y, int ctb_size) + { + // Flush image, 4 lines above to bottom of ctb stripe +- ff_hevc_flush_buffer_lines(s, FFMAX(y-4,0), y+ctb_size, 1, 0); ++ ff_hevc_flush_buffer_lines(s, FFMAX(y-4,0), y+ctb_size, 1, 1); + // TODO flush buffer of beta/tc setup when it becomes cached ++ ++ // Prepare three commands at once to avoid calling overhead ++ s->vpu_cmds_arm[0][0] = get_vc_address(s->frame->buf[0]) + s->frame->linesize[0] * y; ++ s->vpu_cmds_arm[0][1] = s->frame->linesize[0]; ++ s->vpu_cmds_arm[0][2] = s->setup_width; ++ s->vpu_cmds_arm[0][3] = (int) ( s->y_setup_vc + s->setup_width * (y>>4) ); ++ s->vpu_cmds_arm[0][4] = ctb_size>>4; ++ s->vpu_cmds_arm[0][5] = 2; ++ ++ s->vpu_cmds_arm[1][0] = get_vc_address(s->frame->buf[1]) + s->frame->linesize[1] * (y>> s->ps.sps->vshift[1]); ++ s->vpu_cmds_arm[1][1] = s->frame->linesize[1]; ++ s->vpu_cmds_arm[1][2] = s->uv_setup_width; ++ s->vpu_cmds_arm[1][3] = (int) ( s->uv_setup_vc + s->uv_setup_width * ((y>>4)>> s->ps.sps->vshift[1]) ); ++ s->vpu_cmds_arm[1][4] = (ctb_size>>4)>> s->ps.sps->vshift[1]; ++ s->vpu_cmds_arm[1][5] = 3; ++ ++ s->vpu_cmds_arm[2][0] = get_vc_address(s->frame->buf[2]) + s->frame->linesize[2] * (y>> s->ps.sps->vshift[2]); ++ s->vpu_cmds_arm[2][1] = s->frame->linesize[2]; ++ s->vpu_cmds_arm[2][2] = s->uv_setup_width; ++ s->vpu_cmds_arm[2][3] = (int) ( s->uv_setup_vc + s->uv_setup_width * ((y>>4)>> s->ps.sps->vshift[1]) ); ++ s->vpu_cmds_arm[2][4] = (ctb_size>>4)>> s->ps.sps->vshift[1]; ++ s->vpu_cmds_arm[2][5] = 4; ++ + // Call VPU +- // TODO add this to a separate pipeline of VPU jobs that can be run in parallel and wait for completion +- vpu_wait(vpu_post_code( vpu_get_fn(), get_vc_address(s->frame->buf[0]) + s->frame->linesize[0] * y, s->frame->linesize[0], +- s->setup_width, (int) ( s->y_setup_vc + s->setup_width * (y>>4) ), +- ctb_size>>4, 2, 0)); // 2 means to do the deblocking code ++ vpu_wait(vpu_post_code( vpu_get_fn(), s->vpu_cmds_vc, 3, 0, 0, 0, 5, 0)); // 5 means to do all the commands + } + +-static void rpi_deblock2(HEVCContext *s, int y, int ctb_size) +-{ +- int y2; +- for(y2=y;y2<y+ctb_size;y2+=16) { +- rpi_deblock(s,y2,16); +- } +-} + #endif + + void ff_hevc_hls_filter(HEVCContext *s, int x, int y, int ctb_size) + { + int x_end = x >= s->ps.sps->width - ctb_size; ++#ifdef RPI_DEBLOCK_VPU ++ int done_deblock = 0; ++#endif + if (s->avctx->skip_loop_filter < AVDISCARD_ALL) + deblocking_filter_CTB(s, x, y); + #ifdef RPI_DEBLOCK_VPU + if (s->enable_rpi_deblock && x_end) + { +- rpi_deblock(s, y, ctb_size); ++ int y_at_end = y >= s->ps.sps->height - ctb_size; ++ int height = 64; // Deblock in units 64 high to avoid too many VPU calls ++ int y_start = y&~63; ++ if (y_at_end) height = s->ps.sps->height - y_start; ++ if ((((y+ctb_size)&63)==0) || y_at_end) { ++ done_deblock = 1; ++ rpi_deblock(s, y_start, height); ++ } + } + #endif + if (s->ps.sps->sao_enabled) { +@@ -1070,11 +1120,25 @@ void ff_hevc_hls_filter(HEVCContext *s, int x, int y, int ctb_size) + //int newh = y + ctb_size - 4; + //int currh = s->ref->tf.progress->data[0]; + //if (((y + ctb_size)&63)==0) ++#ifdef RPI_DEBLOCK_VPU ++ if (s->enable_rpi_deblock) { ++ // we no longer need to flush the luma buffer as it is in GPU memory when using deblocking on the rpi ++ if (done_deblock) { ++ ff_thread_report_progress(&s->ref->tf, y + ctb_size - 4, 0); ++ } ++ } else { ++#ifdef RPI_INTER_QPU ++ ff_hevc_flush_buffer(s, &s->ref->tf, y + ctb_size - 4); ++#endif ++ ff_thread_report_progress(&s->ref->tf, y + ctb_size - 4, 0); ++ } ++#else + #ifdef RPI_INTER_QPU + ff_hevc_flush_buffer(s, &s->ref->tf, y + ctb_size - 4); +- // TODO we no longer need to flush the luma buffer as it is in GPU memory when using deblocking on the rpi ++ // we no longer need to flush the luma buffer as it is in GPU memory when using deblocking on the rpi + #endif + ff_thread_report_progress(&s->ref->tf, y + ctb_size - 4, 0); ++#endif + } + } + +diff --git a/libavcodec/rpi_hevc_transform.h b/libavcodec/rpi_hevc_transform.h +index b3f155f..4309f1c 100644 +--- a/libavcodec/rpi_hevc_transform.h ++++ b/libavcodec/rpi_hevc_transform.h +@@ -3,14 +3,32 @@ unsigned char rpi_hevc_transform [] = { + 106, + 0, + 144, +-38, ++47, + 1, + 37, + 106, + 0, + 144, +-57, ++66, + 1, ++53, ++106, ++0, ++144, ++192, ++4, ++69, ++106, ++0, ++144, ++192, ++4, ++85, ++106, ++0, ++144, ++220, ++5, + 169, + 3, + 62, +@@ -2427,4 +2445,626 @@ unsigned char rpi_hevc_transform [] = { + 128, + 90, + 0, ++169, ++3, ++14, ++96, ++4, ++31, ++169, ++3, ++30, ++96, ++1, ++31, ++73, ++64, ++52, ++64, ++45, ++64, ++2, ++64, ++10, ++64, ++64, ++198, ++1, ++7, ++8, ++232, ++63, ++0, ++0, ++0, ++6, ++232, ++253, ++255, ++255, ++255, ++0, ++246, ++0, ++0, ++0, ++4, ++215, ++64, ++3, ++96, ++2, ++248, ++0, ++35, ++0, ++0, ++64, ++56, ++0, ++0, ++4, ++248, ++0, ++36, ++0, ++0, ++64, ++56, ++8, ++0, ++0, ++240, ++64, ++0, ++132, ++3, ++30, ++106, ++132, ++24, ++128, ++240, ++0, ++0, ++132, ++3, ++128, ++144, ++143, ++0, ++131, ++98, ++0, ++255, ++64, ++0, ++0, ++20, ++200, ++243, ++0, ++0, ++128, ++144, ++135, ++0, ++131, ++102, ++0, ++158, ++71, ++0, ++2, ++248, ++0, ++35, ++0, ++0, ++64, ++56, ++0, ++0, ++4, ++248, ++0, ++36, ++0, ++0, ++64, ++56, ++8, ++0, ++0, ++240, ++64, ++0, ++132, ++3, ++30, ++106, ++132, ++24, ++128, ++240, ++0, ++0, ++132, ++3, ++128, ++144, ++112, ++0, ++131, ++98, ++0, ++255, ++64, ++0, ++0, ++20, ++200, ++243, ++0, ++0, ++128, ++144, ++104, ++0, ++131, ++102, ++0, ++248, ++64, ++0, ++112, ++0, ++192, ++243, ++211, ++31, ++30, ++106, ++134, ++24, ++128, ++248, ++0, ++0, ++112, ++0, ++192, ++243, ++211, ++31, ++128, ++144, ++123, ++0, ++188, ++64, ++67, ++232, ++0, ++2, ++0, ++0, ++0, ++255, ++64, ++0, ++0, ++20, ++200, ++243, ++0, ++0, ++128, ++144, ++112, ++0, ++195, ++232, ++0, ++2, ++0, ++0, ++12, ++128, ++7, ++192, ++130, ++248, ++0, ++0, ++112, ++192, ++224, ++16, ++195, ++31, ++132, ++248, ++1, ++0, ++112, ++0, ++224, ++16, ++203, ++31, ++3, ++99, ++131, ++71, ++68, ++232, ++32, ++0, ++0, ++0, ++0, ++99, ++2, ++99, ++23, ++102, ++7, ++106, ++127, ++156, ++178, ++255, ++0, ++248, ++64, ++0, ++112, ++0, ++192, ++243, ++211, ++31, ++30, ++106, ++134, ++24, ++128, ++248, ++0, ++0, ++112, ++0, ++192, ++243, ++211, ++31, ++128, ++144, ++72, ++0, ++188, ++64, ++67, ++232, ++0, ++2, ++0, ++0, ++0, ++255, ++64, ++0, ++0, ++20, ++200, ++243, ++0, ++0, ++128, ++144, ++61, ++0, ++195, ++232, ++0, ++2, ++0, ++0, ++12, ++128, ++7, ++192, ++130, ++248, ++0, ++0, ++112, ++192, ++224, ++16, ++195, ++31, ++132, ++248, ++1, ++0, ++112, ++0, ++224, ++16, ++203, ++31, ++25, ++102, ++9, ++106, ++2, ++30, ++41, ++3, ++26, ++87, ++162, ++64, ++64, ++198, ++1, ++23, ++127, ++158, ++95, ++255, ++239, ++3, ++0, ++254, ++128, ++143, ++94, ++0, ++0, ++240, ++12, ++0, ++0, ++254, ++192, ++143, ++95, ++0, ++0, ++240, ++12, ++0, ++0, ++254, ++192, ++142, ++208, ++0, ++0, ++240, ++12, ++0, ++0, ++254, ++128, ++142, ++209, ++0, ++0, ++240, ++12, ++0, ++128, ++144, ++47, ++0, ++8, ++255, ++227, ++23, ++0, ++244, ++192, ++51, ++0, ++0, ++8, ++255, ++35, ++52, ++0, ++180, ++192, ++51, ++0, ++0, ++111, ++3, ++239, ++3, ++0, ++254, ++128, ++143, ++14, ++0, ++0, ++240, ++12, ++0, ++0, ++254, ++192, ++143, ++15, ++0, ++0, ++240, ++12, ++0, ++0, ++254, ++192, ++142, ++16, ++0, ++0, ++240, ++12, ++0, ++0, ++254, ++128, ++142, ++17, ++0, ++0, ++240, ++12, ++0, ++128, ++144, ++13, ++0, ++8, ++255, ++227, ++3, ++0, ++244, ++192, ++51, ++0, ++0, ++8, ++255, ++35, ++4, ++0, ++180, ++192, ++51, ++0, ++0, ++111, ++3, ++32, ++246, ++192, ++11, ++1, ++16, ++32, ++246, ++2, ++140, ++47, ++240, ++32, ++247, ++35, ++141, ++63, ++178, ++64, ++254, ++35, ++141, ++2, ++68, ++192, ++243, ++128, ++11, ++32, ++255, ++35, ++240, ++58, ++226, ++192, ++243, ++188, ++10, ++0, ++254, ++0, ++141, ++4, ++4, ++0, ++240, ++128, ++10, ++88, ++246, ++35, ++141, ++3, ++68, ++240, ++246, ++35, ++141, ++48, ++66, ++0, ++247, ++227, ++143, ++52, ++242, ++32, ++247, ++227, ++142, ++52, ++178, ++90, ++0, ++161, ++3, ++6, ++64, ++23, ++64, ++96, ++8, ++70, ++98, ++97, ++8, ++70, ++98, ++98, ++8, ++70, ++98, ++99, ++8, ++70, ++98, ++100, ++8, ++70, ++98, ++101, ++8, ++70, ++98, ++255, ++159, ++8, ++250, ++23, ++102, ++7, ++106, ++112, ++30, ++33, ++3, + }; +diff --git a/libavcodec/rpi_hevc_transform.s b/libavcodec/rpi_hevc_transform.s +index b055208..5543093 100644 +--- a/libavcodec/rpi_hevc_transform.s ++++ b/libavcodec/rpi_hevc_transform.s +@@ -85,6 +85,13 @@ hevc_trans_16x16: + beq memclear16 + cmp r5,2 + beq hevc_deblock_16x16 ++ cmp r5,3 ++ beq hevc_uv_deblock_16x16 ++ cmp r5,4 ++ beq hevc_uv_deblock_16x16_with_clear ++ cmp r5,5 ++ beq hevc_run_command_list ++ + push r6-r15, lr # TODO cut down number of used registers + mov r14,r3 # coeffs32 + mov r15,r4 # num32 +@@ -708,3 +715,203 @@ normal_filtering: + + filtering_done: + b lr ++ ++ ++hevc_uv_deblock_16x16: ++ push r6-r15, lr ++ mov r14,0 ++ b hevc_uv_start ++hevc_uv_deblock_16x16_with_clear: ++ push r6-r15, lr ++ mov r14,1 ++ b hevc_uv_start ++ ++hevc_uv_start: ++ mov r9,r4 ++ mov r4,r3 ++ mov r13,r2 ++ mov r2,r0 ++ mov r10,r0 ++ subscale4 r0,r1 ++ mov r8,63 ++ mov r6,-3 ++ vmov H(zeros,0),0 ++# r7 is number of blocks still to load ++# r0 is location of current block - 4 * stride ++# r1 is stride ++# r2 is location of current block ++# r3 is offset of start of block (actual edges start at H(16,16)+r3 for horizontal and H(16,0)+r3 for vertical ++# r4 is setup ++# r5 is for temporary calculations ++# r8 holds 63 ++# r6 holds -3 ++# r9 holds the number of 16 high rows to process ++# r10 holds the original img base ++# r11 returns 0 if no filtering was done on the edge ++# r12 saves a copy of this ++# r13 is copy of width ++# r14 is 1 if we should clear the old contents, or 0 if not ++ ++uv_process_row: ++ # First iteration does not do horizontal filtering on previous ++ mov r7, r13 ++ mov r3,0 ++ vldb H(12++,16)+r3,(r0 += r1) REP 4 # Load the current block ++ vldb H(16++,16)+r3,(r2 += r1) REP 16 ++ vldb H(setup_input,0), (r4) # We may wish to prefetch these ++ cmp r14,1 ++ bne uv_skip0 ++ vstb H(zeros,0),(r4) ++uv_skip0: ++ bl uv_vert_filter ++ add r3,8 ++ vadd H(setup_input,0),H(setup_input,8),0 # Rotate to second set of 8 ++ bl uv_vert_filter ++ sub r3,8 ++ b uv_start_deblock_loop ++uv_deblock_loop: ++ # Middle iterations do vertical on current block and horizontal on preceding ++ vldb H(12++,16)+r3,(r0 += r1) REP 4 # load the current block ++ vldb H(16++,16)+r3,(r2 += r1) REP 16 ++ vldb H(setup_input,0), (r4) ++ cmp r14,1 ++ bne uv_skip1 ++ vstb H(zeros,0),(r4) ++uv_skip1: ++ bl uv_vert_filter ++ add r3,8 ++ vadd H(setup_input,0),H(setup_input,8),0 ++ bl uv_vert_filter ++ sub r3,8 ++ vldb H(setup_input,0), -16(r4) ++ cmp r14,1 ++ bne uv_skip3 ++ vstb H(zeros,0),-16(r4) ++uv_skip3: ++ bl uv_horz_filter ++ mov r12,r11 ++ add r3,8*64 ++ vadd H(setup_input,0),H(setup_input,8),0 ++ bl uv_horz_filter ++ sub r3,8*64 ++ addcmpbeq r12,0,0,uv_skip_save_top ++ vstb H(12++,0)+r3,-16(r0 += r1) REP 4 # Save the deblocked pixels for the previous block ++uv_skip_save_top: ++ vstb H(16++,0)+r3,-16(r2 += r1) REP 16 ++uv_start_deblock_loop: ++ # move onto next 16x16 (could do this with circular buffer support instead) ++ add r3,16 ++ and r3,r8 ++ add r4,32 ++ # Perform loop counter operations (may work with an addcmpbgt as well?) ++ add r0,16 ++ add r2,16 ++ sub r7,1 ++ cmp r7,0 # Are there still more blocks to load ++ bgt uv_deblock_loop ++ ++ # Final iteration needs to just do horizontal filtering ++ vldb H(setup_input,0), -16(r4) ++ cmp r14,1 ++ bne uv_skip2 ++ vstb H(zeros,0),-16(r4) ++uv_skip2: ++ bl uv_horz_filter ++ mov r12,r11 ++ add r3,8*64 ++ vadd H(setup_input,0),H(setup_input,8),0 ++ bl uv_horz_filter ++ sub r3,64*8 ++ addcmpbeq r12,0,0,uv_skip_save_top2 ++ vstb H(12++,0)+r3,-16(r0 += r1) REP 4 # Save the deblocked pixels for the previous block ++uv_skip_save_top2: ++ vstb H(16++,0)+r3,-16(r2 += r1) REP 16 ++ ++# Now look to see if we should do another row ++ sub r9,1 ++ cmp r9,0 ++ bgt uv_start_again ++ pop r6-r15, pc ++uv_start_again: ++ # Need to sort out r0,r2 to point to next row down ++ addscale16 r10,r1 ++ mov r2,r10 ++ subscale4 r0,r2,r1 ++ b uv_process_row ++ ++ ++# At this stage H(16,16)+r3 points to the first pixel of the 16 high edge to be filtered ++# So we can reuse the code we move the parts to be filtered into HX(P0/P1/P2/P3/Q0/Q1/Q2/Q3,0) - we will perform a final saturation step on placing them back into the correct locations ++ ++uv_vert_filter: ++ push lr ++ ++ vmov HX(P1,0), V(16,14)+r3 ++ vmov HX(P0,0), V(16,15)+r3 ++ vmov HX(Q0,0), V(16,16)+r3 ++ vmov HX(Q1,0), V(16,17)+r3 ++ ++ bl do_chroma_filter ++ ++ vadds V(16,15)+r3, HX(P0,0), 0 ++ vadds V(16,16)+r3, HX(Q0,0), 0 ++ ++ pop pc ++ ++# Filter edge at H(16,0)+r3 ++uv_horz_filter: ++ push lr ++ ++ vmov HX(P1,0), H(14,0)+r3 ++ vmov HX(P0,0), H(15,0)+r3 ++ vmov HX(Q0,0), H(16,0)+r3 ++ vmov HX(Q1,0), H(17,0)+r3 ++ ++ bl do_chroma_filter ++ ++ vadds H(15,0)+r3, HX(P0,0), 0 ++ # P3 and Q3 never change so don't bother saving back ++ vadds H(16,0)+r3, HX(Q0,0), 0 ++ ++ pop pc ++ ++# r4 points to array of beta/tc for each 4 length edge ++do_chroma_filter: ++ valtl H(setup,0),H(setup_input,0),H(setup_input,0) # tc*8 ++ valtl HX(tc,0),H(setup,0),H(setup,0) ++ ++ vsub HX(delta,0),HX(Q0,0),HX(P0,0) ++ vshl HX(delta,0),HX(delta,0),2 CLRA SACC ++ vsub -,HX(P1,0),HX(Q1,0) SACC ++ vmov HX(delta,0),4 SACC ++ vasr HX(delta,0),HX(delta,0),3 ++ vclamps HX(delta,0), HX(delta,0), HX(tc,0) ++ vadd HX(P0,0),HX(P0,0),HX(delta,0) ++ vsub HX(Q0,0),HX(Q0,0),HX(delta,0) ++ b lr ++ ++# r0 = list ++# r1 = number ++hevc_run_command_list: ++ push r6-r7, lr ++ mov r6, r0 ++ mov r7, r1 ++loop_cmds: ++ ld r0,(r6) # How to encode r6++? ++ add r6,4 ++ ld r1,(r6) ++ add r6,4 ++ ld r2,(r6) ++ add r6,4 ++ ld r3,(r6) ++ add r6,4 ++ ld r4,(r6) ++ add r6,4 ++ ld r5,(r6) ++ add r6,4 ++ bl hevc_trans_16x16 ++ sub r7,1 ++ cmp r7,0 ++ bgt loop_cmds ++ ++ pop r6-r7, pc +diff --git a/libavcodec/rpi_qpu.c b/libavcodec/rpi_qpu.c +index 91777be..5aa0432 100644 +--- a/libavcodec/rpi_qpu.c ++++ b/libavcodec/rpi_qpu.c +@@ -397,6 +397,8 @@ static void *vpu_start(void *arg) { + int start_time; + int end_time; + int count=0; ++ int count_deblock=0; ++ int count_qpu=0; + #endif + while(1) { + int i; +@@ -442,7 +444,7 @@ static void *vpu_start(void *arg) { + break; + } + } +- printf("Have_qpu = %d, have_vpu=%d\n",have_qpu,have_vpu); ++ //printf("Have_qpu = %d, have_vpu=%d\n",have_qpu,have_vpu); + #endif + qpu_code = p[7]; + qpu_codeb = p[16]; +@@ -460,6 +462,12 @@ static void *vpu_start(void *arg) { + off_time += start_time-last_time; + #endif + ++#define NO_FLUSH 1 ++#define CLEAR_PROFILE 2 ++#define OUTPUT_COUNTS 4 ++ ++#define FLAGS_FOR_PROFILING (NO_FLUSH) ++ + #ifdef RPI_COMBINE_JOBS + if (have_qpu) { + for(i=0;i<8;i++) { +@@ -472,14 +480,14 @@ static void *vpu_start(void *arg) { + } + if (have_vpu) { + execute_multi(gpu->mb, +- 12,gpu->vc + offsetof(struct GPU, mail2), 1, 5000, ++ 12,gpu->vc + offsetof(struct GPU, mail2), FLAGS_FOR_PROFILING, 5000, + 8,gpu->vc + offsetof(struct GPU, mail), 1 /* no flush */, 5000 /* timeout ms */, + p[0], p[1], p[2], p[3], p[4], p[5], p[6], // VPU0 + q[0], q[1], q[2], q[3], q[4], q[5], q[6]); // VPU1 + q[0] = 0; + } else { + execute_multi(gpu->mb, +- 12,gpu->vc + offsetof(struct GPU, mail2), 1, 5000, ++ 12,gpu->vc + offsetof(struct GPU, mail2), FLAGS_FOR_PROFILING, 5000, + 8,gpu->vc + offsetof(struct GPU, mail), 1 /* no flush */, 5000 /* timeout ms */, + p[0], p[1], p[2], p[3], p[4], p[5], p[6], // VPU0 + 0, 0 , 0 , 0 , 0 , 0 , 0); // VPU1 +@@ -510,7 +518,7 @@ static void *vpu_start(void *arg) { + execute_qpu(gpu->mb,8,gpu->vc + offsetof(struct GPU, mail), 1 /* no flush */, 5000 /* timeout ms */); + #else + execute_multi(gpu->mb, +- 12,gpu->vc + offsetof(struct GPU, mail2), 1, 5000, ++ 12,gpu->vc + offsetof(struct GPU, mail2), FLAGS_FOR_PROFILING , 5000, + 8,gpu->vc + offsetof(struct GPU, mail), 1 /* no flush */, 5000 /* timeout ms */, + p[0], p[1], p[2], p[3], p[4], p[5], p[6], // VPU0 + 0, 0 , 0 , 0 , 0 , 0 , 0); // VPU1 +@@ -525,17 +533,20 @@ static void *vpu_start(void *arg) { + // There are three cases we may wish to distinguish of VPU/QPU activity + on_time += end_time - start_time; + #else +- if (p[6]==2) ++ if (p[6]>1) { ++ count_deblock++; + on_time_deblock += end_time - start_time; +- else ++ } else { + on_time += end_time - start_time; ++ count_qpu++; ++ } + #endif + count++; + if ((count&0x7f)==0) + #ifdef RPI_COMBINE_JOBS +- printf("Posted %d On=%dms, On_deblock=%dms, Off=%dms\n",count,(int)(on_time/1000),(int)(on_time_deblock/1000),(int)(off_time/1000)); +-#else + printf("Posted %d On=%dms, Off=%dms\n",count,(int)(on_time/1000),(int)(off_time/1000)); ++#else ++ printf("Posted %d On=%dms (%d calls), On_deblock=%dms (%d calls), Off=%dms\n",count,(int)(on_time/1000),count_qpu,(int)(on_time_deblock/1000),count_deblock,(int)(off_time/1000)); + #endif + #endif + job_done_early: +diff --git a/libavcodec/rpi_shader.qasm b/libavcodec/rpi_shader.qasm +index 0686249..64bf5b0 100644 +--- a/libavcodec/rpi_shader.qasm ++++ b/libavcodec/rpi_shader.qasm +@@ -1077,6 +1077,17 @@ nop ; nop # delay slot 2 + ::mc_interrupt_exit12 + mov -, vw_wait # wait on the VDW + ++ # Dummy wait to test instructions ++# mov r3,1000000 ++#:dummy_loop ++# sub.setf r3, r3, 1 ++# nop ++# nop ++# brr.anynn -, r:dummy_loop ++# nop ++# nop ++# nop ++ + ldtmu0 + ldtmu0 + ldtmu1 +-- +2.5.0 + + +From 9f07110097a85bc056c338f9bd1891ca2027f580 Mon Sep 17 00:00:00 2001 +From: Ben Avison <bavison@riscosopen.org> +Date: Tue, 23 Jun 2015 23:42:03 +0100 +Subject: [PATCH 67/68] armv7/hevc: Optimise deblocking boundary strength + calculation + +--- + libavcodec/arm/hevcdsp_deblock_neon.S | 115 +++++++++++++++++ + libavcodec/arm/hevcdsp_init_neon.c | 9 ++ + libavcodec/hevc.h | 11 -- + libavcodec/hevc_filter.c | 224 ++++++++++++++-------------------- + libavcodec/hevcdsp.c | 116 ++++++++++++++++++ + libavcodec/hevcdsp.h | 14 +++ + 6 files changed, 344 insertions(+), 145 deletions(-) + +diff --git a/libavcodec/arm/hevcdsp_deblock_neon.S b/libavcodec/arm/hevcdsp_deblock_neon.S +index 166bddb..bad4589 100644 +--- a/libavcodec/arm/hevcdsp_deblock_neon.S ++++ b/libavcodec/arm/hevcdsp_deblock_neon.S +@@ -383,3 +383,118 @@ function ff_hevc_h_loop_filter_chroma_neon, export=1 + vst1.8 {d4}, [r0] + bx lr + endfunc ++ ++/* ff_hevc_deblocking_boundary_strengths_neon(int pus, int dup, int in_inc, int out_inc, ++ * int *curr_rpl0, int *curr_rpl1, int *neigh_rpl0, int *neigh_rpl1, ++ * MvField *curr, MvField *neigh, uint8_t *bs) ++ */ ++function ff_hevc_deblocking_boundary_strengths_neon, export=1 ++ add ip, sp, #4*4 ++ push {a2-a4,v1-v8,lr} ++ ldmia ip, {v5-v7} ++1: ldmdb ip, {v1-v4} ++ ldrsb a3, [v5, #8] @ curr->ref_idx ++ ldrsb v8, [v5, #9] ++ ldrsb ip, [v6, #8] @ neigh->ref_idx ++ ldrsb lr, [v6, #9] ++ ldr v1, [v1, a3, lsl #2] ++ ldrb a3, [v5, #10] @ curr->pred_flag ++ ldr v2, [v2, v8, lsl #2] ++ ldrb v8, [v6, #10] @ neigh->pred_flag ++ ldr v3, [v3, ip, lsl #2] ++ ldr v4, [v4, lr, lsl #2] ++ teq a3, #3 ++ beq 20f ++ teq v8, #3 ++ beq 90f ++ ++ tst a3, #1 ++ ldrne a3, [v5, #0] @ curr->mv[0] ++ ldreq a3, [v5, #4] @ curr->mv[1] ++ moveq v1, v2 ++ tst v8, #1 ++ ldrne v8, [v6, #0] @ neigh->mv[0] ++ ldreq v8, [v6, #4] @ neigh->mv[1] ++ moveq v3, v4 ++ teq v1, v3 ++ bne 10f ++ ldr lr, =0xFFFCFFFC ++ ssub16 ip, v8, a3 ++ ssub16 a3, a3, v8 ++ sel a3, a3, ip ++ ands a3, a3, lr ++ @ drop through ++10: movne a3, #1 ++11: subs a2, a2, #1 ++12: strbhs a3, [v7], a4 ++ subs a2, a2, #1 ++ bhs 12b ++ ++ ldm sp, {a2, a3} ++ add ip, sp, #16*4 ++ subs a1, a1, #1 ++ add v5, v5, a3 ++ add v6, v6, a3 ++ bhi 1b ++ pop {a2-a4,v1-v8,pc} ++ ++20: teq v8, #3 ++ bne 10b ++ ++ teq v1, v3 ++ teqeq v2, v4 ++ bne 40f ++ teq v1, v2 ++ bne 30f ++ ++ ldrd v1, v2, [v5] @ curr->mv ++ ldrd v3, v4, [v6] @ neigh->mv ++ ldr lr, =0xFFFCFFFC ++ ssub16 ip, v3, v1 ++ ssub16 a3, v1, v3 ++ sel a3, a3, ip ++ ands a3, a3, lr ++ bne 25f ++ ssub16 ip, v4, v2 ++ ssub16 a3, v2, v4 ++ sel a3, a3, ip ++ ands a3, a3, lr ++ beq 11b ++ @ drop through ++25: ssub16 ip, v4, v1 ++ ssub16 a3, v1, v4 ++ sel a3, a3, ip ++ ands a3, a3, lr ++ bne 10b ++ ssub16 ip, v3, v2 ++ ssub16 a3, v2, v3 ++ sel a3, a3, ip ++ ands a3, a3, lr ++ b 10b ++ ++30: ldrd v1, v2, [v5] @ curr->mv ++ ldrd v3, v4, [v6] @ neigh->mv ++ ldr lr, =0xFFFCFFFC ++ ssub16 ip, v3, v1 ++ ssub16 a3, v1, v3 ++ sel a3, a3, ip ++ ands a3, a3, lr ++ bne 10b ++ ssub16 ip, v4, v2 ++ ssub16 a3, v2, v4 ++ sel a3, a3, ip ++ ands a3, a3, lr ++ b 10b ++ ++40: teq v1, v4 ++ teqeq v2, v3 ++ bne 10b ++ ++ ldrd v1, v2, [v5] @ curr->mv ++ ldrd v3, v4, [v6] @ neigh->mv ++ ldr lr, =0xFFFCFFFC ++ b 25b ++ ++90: mov a3, #1 ++ b 11b ++endfunc +diff --git a/libavcodec/arm/hevcdsp_init_neon.c b/libavcodec/arm/hevcdsp_init_neon.c +index e5da7e9..49c70dd 100644 +--- a/libavcodec/arm/hevcdsp_init_neon.c ++++ b/libavcodec/arm/hevcdsp_init_neon.c +@@ -290,6 +290,10 @@ static void ff_hevc_sao_edge_neon_wrapper(uint8_t *_dst /* align 16 */, uint8_t + } + #undef CMP + ++void ff_hevc_deblocking_boundary_strengths_neon(int pus, int dup, int in_inc, int out_inc, ++ int *curr_rpl0, int *curr_rpl1, int *neigh_rpl0, int *neigh_rpl1, ++ MvField *curr, MvField *neigh, uint8_t *bs); ++ + av_cold void ff_hevcdsp_init_neon(HEVCDSPContext *c, const int bit_depth) + { + if (bit_depth == 8) { +@@ -387,4 +391,9 @@ av_cold void ff_hevcdsp_init_neon(HEVCDSPContext *c, const int bit_depth) + c->put_hevc_qpel_uni[8][0][0] = ff_hevc_put_qpel_uw_pixels_w48_neon_8; + c->put_hevc_qpel_uni[9][0][0] = ff_hevc_put_qpel_uw_pixels_w64_neon_8; + } ++ ++ assert(offsetof(MvField, mv) == 0); ++ assert(offsetof(MvField, ref_idx) == 8); ++ assert(offsetof(MvField, pred_flag) == 10); ++ c->hevc_deblocking_boundary_strengths = ff_hevc_deblocking_boundary_strengths_neon; + } +diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h +index aa7cdc3..cfa7c61 100644 +--- a/libavcodec/hevc.h ++++ b/libavcodec/hevc.h +@@ -683,17 +683,6 @@ typedef struct CodingUnit { + uint8_t cu_transquant_bypass_flag; + } CodingUnit; + +-typedef struct Mv { +- int16_t x; ///< horizontal component of motion vector +- int16_t y; ///< vertical component of motion vector +-} Mv; +- +-typedef struct MvField { +- DECLARE_ALIGNED(4, Mv, mv)[2]; +- int8_t ref_idx[2]; +- int8_t pred_flag; +-} MvField; +- + typedef struct NeighbourAvailable { + int cand_bottom_left; + int cand_left; +diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c +index 6367068..826a82f 100644 +--- a/libavcodec/hevc_filter.c ++++ b/libavcodec/hevc_filter.c +@@ -726,69 +726,6 @@ static void deblocking_filter_CTB(HEVCContext *s, int x0, int y0) + } + } + +-static int boundary_strength(HEVCContext *s, MvField *curr, MvField *neigh, +- RefPicList *neigh_refPicList) +-{ +- if (curr->pred_flag == PF_BI && neigh->pred_flag == PF_BI) { +- // same L0 and L1 +- if (s->ref->refPicList[0].list[curr->ref_idx[0]] == neigh_refPicList[0].list[neigh->ref_idx[0]] && +- s->ref->refPicList[0].list[curr->ref_idx[0]] == s->ref->refPicList[1].list[curr->ref_idx[1]] && +- neigh_refPicList[0].list[neigh->ref_idx[0]] == neigh_refPicList[1].list[neigh->ref_idx[1]]) { +- if ((FFABS(neigh->mv[0].x - curr->mv[0].x) >= 4 || FFABS(neigh->mv[0].y - curr->mv[0].y) >= 4 || +- FFABS(neigh->mv[1].x - curr->mv[1].x) >= 4 || FFABS(neigh->mv[1].y - curr->mv[1].y) >= 4) && +- (FFABS(neigh->mv[1].x - curr->mv[0].x) >= 4 || FFABS(neigh->mv[1].y - curr->mv[0].y) >= 4 || +- FFABS(neigh->mv[0].x - curr->mv[1].x) >= 4 || FFABS(neigh->mv[0].y - curr->mv[1].y) >= 4)) +- return 1; +- else +- return 0; +- } else if (neigh_refPicList[0].list[neigh->ref_idx[0]] == s->ref->refPicList[0].list[curr->ref_idx[0]] && +- neigh_refPicList[1].list[neigh->ref_idx[1]] == s->ref->refPicList[1].list[curr->ref_idx[1]]) { +- if (FFABS(neigh->mv[0].x - curr->mv[0].x) >= 4 || FFABS(neigh->mv[0].y - curr->mv[0].y) >= 4 || +- FFABS(neigh->mv[1].x - curr->mv[1].x) >= 4 || FFABS(neigh->mv[1].y - curr->mv[1].y) >= 4) +- return 1; +- else +- return 0; +- } else if (neigh_refPicList[1].list[neigh->ref_idx[1]] == s->ref->refPicList[0].list[curr->ref_idx[0]] && +- neigh_refPicList[0].list[neigh->ref_idx[0]] == s->ref->refPicList[1].list[curr->ref_idx[1]]) { +- if (FFABS(neigh->mv[1].x - curr->mv[0].x) >= 4 || FFABS(neigh->mv[1].y - curr->mv[0].y) >= 4 || +- FFABS(neigh->mv[0].x - curr->mv[1].x) >= 4 || FFABS(neigh->mv[0].y - curr->mv[1].y) >= 4) +- return 1; +- else +- return 0; +- } else { +- return 1; +- } +- } else if ((curr->pred_flag != PF_BI) && (neigh->pred_flag != PF_BI)){ // 1 MV +- Mv A, B; +- int ref_A, ref_B; +- +- if (curr->pred_flag & 1) { +- A = curr->mv[0]; +- ref_A = s->ref->refPicList[0].list[curr->ref_idx[0]]; +- } else { +- A = curr->mv[1]; +- ref_A = s->ref->refPicList[1].list[curr->ref_idx[1]]; +- } +- +- if (neigh->pred_flag & 1) { +- B = neigh->mv[0]; +- ref_B = neigh_refPicList[0].list[neigh->ref_idx[0]]; +- } else { +- B = neigh->mv[1]; +- ref_B = neigh_refPicList[1].list[neigh->ref_idx[1]]; +- } +- +- if (ref_A == ref_B) { +- if (FFABS(A.x - B.x) >= 4 || FFABS(A.y - B.y) >= 4) +- return 1; +- else +- return 0; +- } else +- return 1; +- } +- +- return 1; +-} + + void ff_hevc_deblocking_boundary_strengths(HEVCContext *s, int x0, int y0, + int log2_trafo_size) +@@ -799,10 +736,17 @@ void ff_hevc_deblocking_boundary_strengths(HEVCContext *s, int x0, int y0, + int log2_min_tu_size = s->ps.sps->log2_min_tb_size; + int min_pu_width = s->ps.sps->min_pu_width; + int min_tu_width = s->ps.sps->min_tb_width; +- int is_intra = tab_mvf[(y0 >> log2_min_pu_size) * min_pu_width + +- (x0 >> log2_min_pu_size)].pred_flag == PF_INTRA; + int boundary_upper, boundary_left; +- int i, j, bs; ++ int i, j; ++ RefPicList *rpl = s->ref->refPicList; ++ int min_pu_in_4pix = (1 << log2_min_pu_size) >> 2; ++ int trafo_in_min_pus = (1 << log2_trafo_size) >> log2_min_pu_size; ++ int y_pu = y0 >> log2_min_pu_size; ++ int x_pu = x0 >> log2_min_pu_size; ++ MvField *curr = &tab_mvf[y_pu * min_pu_width + x_pu]; ++ int is_intra = curr->pred_flag == PF_INTRA; ++ int inc = log2_min_pu_size == 2 ? 2 : 1; ++ uint8_t *bs; + + #ifdef DISABLE_STRENGTHS + return; +@@ -818,34 +762,56 @@ void ff_hevc_deblocking_boundary_strengths(HEVCContext *s, int x0, int y0, + (y0 % (1 << s->ps.sps->log2_ctb_size)) == 0))) + boundary_upper = 0; + ++ bs = &s->horizontal_bs[(x0 + y0 * s->bs_width) >> 2]; ++ + if (boundary_upper) { + RefPicList *rpl_top = (lc->boundary_flags & BOUNDARY_UPPER_SLICE) ? + ff_hevc_get_ref_list(s, s->ref, x0, y0 - 1) : +- s->ref->refPicList; +- int yp_pu = (y0 - 1) >> log2_min_pu_size; +- int yq_pu = y0 >> log2_min_pu_size; +- int yp_tu = (y0 - 1) >> log2_min_tu_size; +- int yq_tu = y0 >> log2_min_tu_size; ++ rpl; ++ MvField *top = curr - min_pu_width; ++ ++ if (is_intra) { ++ for (i = 0; i < (1 << log2_trafo_size); i += 4) ++ bs[i >> 2] = 2; ++ ++ } else { ++ int y_tu = y0 >> log2_min_tu_size; ++ int x_tu = x0 >> log2_min_tu_size; ++ uint8_t *curr_cbf_luma = &s->cbf_luma[y_tu * min_tu_width + x_tu]; ++ uint8_t *top_cbf_luma = curr_cbf_luma - min_tu_width; ++ ++ s->hevcdsp.hevc_deblocking_boundary_strengths(trafo_in_min_pus, ++ min_pu_in_4pix, sizeof (MvField), 4 >> 2, ++ rpl[0].list, rpl[1].list, rpl_top[0].list, rpl_top[1].list, ++ curr, top, bs); + + for (i = 0; i < (1 << log2_trafo_size); i += 4) { +- int x_pu = (x0 + i) >> log2_min_pu_size; +- int x_tu = (x0 + i) >> log2_min_tu_size; +- MvField *top = &tab_mvf[yp_pu * min_pu_width + x_pu]; +- MvField *curr = &tab_mvf[yq_pu * min_pu_width + x_pu]; +- uint8_t top_cbf_luma = s->cbf_luma[yp_tu * min_tu_width + x_tu]; +- uint8_t curr_cbf_luma = s->cbf_luma[yq_tu * min_tu_width + x_tu]; +- +- if (curr->pred_flag == PF_INTRA || top->pred_flag == PF_INTRA) +- bs = 2; +- else if (curr_cbf_luma || top_cbf_luma) +- bs = 1; +- else +- bs = boundary_strength(s, curr, top, rpl_top); +- s->horizontal_bs[((x0 + i) + y0 * s->bs_width) >> 2] = bs; ++ int i_pu = i >> log2_min_pu_size; ++ int i_tu = i >> log2_min_tu_size; ++ ++ if (top[i_pu].pred_flag == PF_INTRA) ++ bs[i >> 2] = 2; ++ else if (curr_cbf_luma[i_tu] || top_cbf_luma[i_tu]) ++ bs[i >> 2] = 1; + } ++ } ++ } ++ ++ if (!is_intra) { ++ for (j = inc; j < trafo_in_min_pus; j += inc) { ++ MvField *top; ++ ++ curr += min_pu_width * inc; ++ top = curr - min_pu_width; ++ bs += s->bs_width * inc << log2_min_pu_size >> 2; ++ ++ s->hevcdsp.hevc_deblocking_boundary_strengths(trafo_in_min_pus, ++ min_pu_in_4pix, sizeof (MvField), 4 >> 2, ++ rpl[0].list, rpl[1].list, rpl[0].list, rpl[1].list, ++ curr, top, bs); ++ } + } + +- // bs for vertical TU boundaries + boundary_left = x0 > 0 && !(x0 & 7); + if (boundary_left && + ((!s->sh.slice_loop_filter_across_slices_enabled_flag && +@@ -856,64 +822,54 @@ void ff_hevc_deblocking_boundary_strengths(HEVCContext *s, int x0, int y0, + (x0 % (1 << s->ps.sps->log2_ctb_size)) == 0))) + boundary_left = 0; + ++ curr = &tab_mvf[y_pu * min_pu_width + x_pu]; ++ bs = &s->vertical_bs[(x0 + y0 * s->bs_width) >> 2]; ++ + if (boundary_left) { + RefPicList *rpl_left = (lc->boundary_flags & BOUNDARY_LEFT_SLICE) ? + ff_hevc_get_ref_list(s, s->ref, x0 - 1, y0) : +- s->ref->refPicList; +- int xp_pu = (x0 - 1) >> log2_min_pu_size; +- int xq_pu = x0 >> log2_min_pu_size; +- int xp_tu = (x0 - 1) >> log2_min_tu_size; +- int xq_tu = x0 >> log2_min_tu_size; +- +- for (i = 0; i < (1 << log2_trafo_size); i += 4) { +- int y_pu = (y0 + i) >> log2_min_pu_size; +- int y_tu = (y0 + i) >> log2_min_tu_size; +- MvField *left = &tab_mvf[y_pu * min_pu_width + xp_pu]; +- MvField *curr = &tab_mvf[y_pu * min_pu_width + xq_pu]; +- uint8_t left_cbf_luma = s->cbf_luma[y_tu * min_tu_width + xp_tu]; +- uint8_t curr_cbf_luma = s->cbf_luma[y_tu * min_tu_width + xq_tu]; +- +- if (curr->pred_flag == PF_INTRA || left->pred_flag == PF_INTRA) +- bs = 2; +- else if (curr_cbf_luma || left_cbf_luma) +- bs = 1; +- else +- bs = boundary_strength(s, curr, left, rpl_left); +- s->vertical_bs[(x0 + (y0 + i) * s->bs_width) >> 2] = bs; +- } +- } ++ rpl; ++ MvField *left = curr - 1; + +- if (log2_trafo_size > log2_min_pu_size && !is_intra) { +- RefPicList *rpl = s->ref->refPicList; ++ if (is_intra) { ++ for (j = 0; j < (1 << log2_trafo_size); j += 4) ++ bs[j * s->bs_width >> 2] = 2; + +- // bs for TU internal horizontal PU boundaries +- for (j = 8; j < (1 << log2_trafo_size); j += 8) { +- int yp_pu = (y0 + j - 1) >> log2_min_pu_size; +- int yq_pu = (y0 + j) >> log2_min_pu_size; +- +- for (i = 0; i < (1 << log2_trafo_size); i += 4) { +- int x_pu = (x0 + i) >> log2_min_pu_size; +- MvField *top = &tab_mvf[yp_pu * min_pu_width + x_pu]; +- MvField *curr = &tab_mvf[yq_pu * min_pu_width + x_pu]; +- +- bs = boundary_strength(s, curr, top, rpl); +- s->horizontal_bs[((x0 + i) + (y0 + j) * s->bs_width) >> 2] = bs; ++ } else { ++ int y_tu = y0 >> log2_min_tu_size; ++ int x_tu = x0 >> log2_min_tu_size; ++ uint8_t *curr_cbf_luma = &s->cbf_luma[y_tu * min_tu_width + x_tu]; ++ uint8_t *left_cbf_luma = curr_cbf_luma - 1; ++ ++ s->hevcdsp.hevc_deblocking_boundary_strengths(trafo_in_min_pus, ++ min_pu_in_4pix, min_pu_width * sizeof (MvField), 4 * s->bs_width >> 2, ++ rpl[0].list, rpl[1].list, rpl_left[0].list, rpl_left[1].list, ++ curr, left, bs); ++ ++ for (j = 0; j < (1 << log2_trafo_size); j += 4) { ++ int j_pu = j >> log2_min_pu_size; ++ int j_tu = j >> log2_min_tu_size; ++ ++ if (left[j_pu * min_pu_width].pred_flag == PF_INTRA) ++ bs[j * s->bs_width >> 2] = 2; ++ else if (curr_cbf_luma[j_tu * min_tu_width] || left_cbf_luma[j_tu * min_tu_width]) ++ bs[j * s->bs_width >> 2] = 1; + } + } ++ } + +- // bs for TU internal vertical PU boundaries +- for (j = 0; j < (1 << log2_trafo_size); j += 4) { +- int y_pu = (y0 + j) >> log2_min_pu_size; ++ if (!is_intra) { ++ for (i = inc; i < trafo_in_min_pus; i += inc) { ++ MvField *left; + +- for (i = 8; i < (1 << log2_trafo_size); i += 8) { +- int xp_pu = (x0 + i - 1) >> log2_min_pu_size; +- int xq_pu = (x0 + i) >> log2_min_pu_size; +- MvField *left = &tab_mvf[y_pu * min_pu_width + xp_pu]; +- MvField *curr = &tab_mvf[y_pu * min_pu_width + xq_pu]; ++ curr += inc; ++ left = curr - 1; ++ bs += inc << log2_min_pu_size >> 2; + +- bs = boundary_strength(s, curr, left, rpl); +- s->vertical_bs[((x0 + i) + (y0 + j) * s->bs_width) >> 2] = bs; +- } ++ s->hevcdsp.hevc_deblocking_boundary_strengths(trafo_in_min_pus, ++ min_pu_in_4pix, min_pu_width * sizeof (MvField), 4 * s->bs_width >> 2, ++ rpl[0].list, rpl[1].list, rpl[0].list, rpl[1].list, ++ curr, left, bs); + } + } + } +diff --git a/libavcodec/hevcdsp.c b/libavcodec/hevcdsp.c +index 9d773d9..a6534a9 100644 +--- a/libavcodec/hevcdsp.c ++++ b/libavcodec/hevcdsp.c +@@ -123,6 +123,120 @@ DECLARE_ALIGNED(16, const int8_t, ff_hevc_qpel_filters[3][16]) = { + #include "hevcdsp_template.c" + #undef BIT_DEPTH + ++static void hevc_deblocking_boundary_strengths(int pus, int dup, int in_inc, int out_inc, ++ int *curr_rpl0, int *curr_rpl1, int *neigh_rpl0, int *neigh_rpl1, ++ MvField *curr, MvField *neigh, uint8_t *bs) ++{ ++ for (; pus > 0; pus--) { ++ int strength, out; ++ int curr_refL0 = curr_rpl0[curr->ref_idx[0]]; ++ int curr_refL1 = curr_rpl1[curr->ref_idx[1]]; ++ int neigh_refL0 = neigh_rpl0[neigh->ref_idx[0]]; ++ int neigh_refL1 = neigh_rpl1[neigh->ref_idx[1]]; ++ ++#if 1 // This more directly matches the original implementation ++ if (curr->pred_flag == PF_BI && neigh->pred_flag == PF_BI) { ++ // same L0 and L1 ++ if (curr_refL0 == neigh_refL0 && ++ curr_refL0 == curr_refL1 && ++ neigh_refL0 == neigh_refL1) { ++ if ((FFABS(neigh->mv[0].x - curr->mv[0].x) >= 4 || FFABS(neigh->mv[0].y - curr->mv[0].y) >= 4 || ++ FFABS(neigh->mv[1].x - curr->mv[1].x) >= 4 || FFABS(neigh->mv[1].y - curr->mv[1].y) >= 4) && ++ (FFABS(neigh->mv[1].x - curr->mv[0].x) >= 4 || FFABS(neigh->mv[1].y - curr->mv[0].y) >= 4 || ++ FFABS(neigh->mv[0].x - curr->mv[1].x) >= 4 || FFABS(neigh->mv[0].y - curr->mv[1].y) >= 4)) ++ strength = 1; ++ else ++ strength = 0; ++ } else if (neigh_refL0 == curr_refL0 && ++ neigh_refL1 == curr_refL1) { ++ if (FFABS(neigh->mv[0].x - curr->mv[0].x) >= 4 || FFABS(neigh->mv[0].y - curr->mv[0].y) >= 4 || ++ FFABS(neigh->mv[1].x - curr->mv[1].x) >= 4 || FFABS(neigh->mv[1].y - curr->mv[1].y) >= 4) ++ strength = 1; ++ else ++ strength = 0; ++ } else if (neigh_refL1 == curr_refL0 && ++ neigh_refL0 == curr_refL1) { ++ if (FFABS(neigh->mv[1].x - curr->mv[0].x) >= 4 || FFABS(neigh->mv[1].y - curr->mv[0].y) >= 4 || ++ FFABS(neigh->mv[0].x - curr->mv[1].x) >= 4 || FFABS(neigh->mv[0].y - curr->mv[1].y) >= 4) ++ strength = 1; ++ else ++ strength = 0; ++ } else { ++ strength = 1; ++ } ++ } else if ((curr->pred_flag != PF_BI) && (neigh->pred_flag != PF_BI)){ // 1 MV ++ Mv curr_mv0, neigh_mv0; ++ ++ if (curr->pred_flag & 1) { ++ curr_mv0 = curr->mv[0]; ++ } else { ++ curr_mv0 = curr->mv[1]; ++ curr_refL0 = curr_refL1; ++ } ++ ++ if (neigh->pred_flag & 1) { ++ neigh_mv0 = neigh->mv[0]; ++ } else { ++ neigh_mv0 = neigh->mv[1]; ++ neigh_refL0 = neigh_refL1; ++ } ++ ++ if (curr_refL0 == neigh_refL0) { ++ if (FFABS(curr_mv0.x - neigh_mv0.x) >= 4 || FFABS(curr_mv0.y - neigh_mv0.y) >= 4) ++ strength = 1; ++ else ++ strength = 0; ++ } else ++ strength = 1; ++ } else ++ strength = 1; ++#else // This has exactly the same effect, but is more suitable for vectorisation ++ Mv curr_mv[2]; ++ Mv neigh_mv[2]; ++ memcpy(curr_mv, curr->mv, sizeof curr_mv); ++ memcpy(neigh_mv, neigh->mv, sizeof neigh_mv); ++ ++ if (!(curr->pred_flag & 2)) { ++ curr_mv[1] = curr_mv[0]; ++ curr_refL1 = curr_refL0; ++ } ++ if (!(neigh->pred_flag & 2)) { ++ neigh_mv[1] = neigh_mv[0]; ++ neigh_refL1 = neigh_refL0; ++ } ++ if (!(curr->pred_flag & 1)) { ++ curr_mv[0] = curr_mv[1]; ++ curr_refL0 = curr_refL1; ++ } ++ if (!(neigh->pred_flag & 1)) { ++ neigh_mv[0] = neigh_mv[1]; ++ neigh_refL0 = neigh_refL1; ++ } ++ ++ strength = 1; ++ ++ strength &= (neigh_refL0 != curr_refL0) | (neigh_refL1 != curr_refL1) | ++ (FFABS(neigh_mv[0].x - curr_mv[0].x) >= 4) | (FFABS(neigh_mv[0].y - curr_mv[0].y) >= 4) | ++ (FFABS(neigh_mv[1].x - curr_mv[1].x) >= 4) | (FFABS(neigh_mv[1].y - curr_mv[1].y) >= 4); ++ ++ strength &= (neigh_refL1 != curr_refL0) | (neigh_refL0 != curr_refL1) | ++ (FFABS(neigh_mv[1].x - curr_mv[0].x) >= 4) | (FFABS(neigh_mv[1].y - curr_mv[0].y) >= 4) | ++ (FFABS(neigh_mv[0].x - curr_mv[1].x) >= 4) | (FFABS(neigh_mv[0].y - curr_mv[1].y) >= 4); ++ ++ strength |= (((curr->pred_flag + 1) ^ (neigh->pred_flag + 1)) >> 2); ++#endif ++ ++ curr += in_inc / sizeof (MvField); ++ neigh += in_inc / sizeof (MvField); ++ ++ for (out = dup; out > 0; out--) ++ { ++ *bs = strength; ++ bs += out_inc; ++ } ++ } ++} ++ + void ff_hevc_dsp_init(HEVCDSPContext *hevcdsp, int bit_depth) + { + #undef FUNC +@@ -257,6 +371,8 @@ int i = 0; + break; + } + ++ hevcdsp->hevc_deblocking_boundary_strengths = hevc_deblocking_boundary_strengths; ++ + if (ARCH_X86) + ff_hevc_dsp_init_x86(hevcdsp, bit_depth); + if (ARCH_ARM) +diff --git a/libavcodec/hevcdsp.h b/libavcodec/hevcdsp.h +index 9f1f6dd..e221e54 100644 +--- a/libavcodec/hevcdsp.h ++++ b/libavcodec/hevcdsp.h +@@ -42,6 +42,17 @@ typedef struct SAOParams { + uint8_t type_idx[3]; ///< sao_type_idx + } SAOParams; + ++typedef struct Mv { ++ int16_t x; ///< horizontal component of motion vector ++ int16_t y; ///< vertical component of motion vector ++} Mv; ++ ++typedef struct MvField { ++ DECLARE_ALIGNED(4, Mv, mv)[2]; ++ int8_t ref_idx[2]; ++ int8_t pred_flag; ++} MvField; ++ + typedef struct HEVCDSPContext { + void (*put_pcm)(uint8_t *_dst, ptrdiff_t _stride, int width, int height, + struct GetBitContext *gb, int pcm_bit_depth); +@@ -120,6 +131,9 @@ typedef struct HEVCDSPContext { + void (*hevc_v_loop_filter_chroma_c)(uint8_t *pix, ptrdiff_t stride, + int32_t *tc, uint8_t *no_p, + uint8_t *no_q); ++ void (*hevc_deblocking_boundary_strengths)(int pus, int dup, int in_inc, int out_inc, ++ int *curr_rpl0, int *curr_rpl1, int *neigh_rpl0, int *neigh_rpl1, ++ MvField *curr, MvField *neigh, uint8_t *bs); + } HEVCDSPContext; + + void ff_hevc_dsp_init(HEVCDSPContext *hpc, int bit_depth); +-- +2.5.0 + + +From 50c89ce45ad633db0a48f084d5ecae0ae989e704 Mon Sep 17 00:00:00 2001 +From: Peter de Rivaz <peter.derivaz@gmail.com> +Date: Wed, 15 Jul 2015 09:09:11 +0100 +Subject: [PATCH 68/68] Only enable qpu when needed + +--- + libavcodec/hevc.h | 2 +- + libavcodec/rpi_qpu.c | 21 ++++++++++++++++----- + 2 files changed, 17 insertions(+), 6 deletions(-) + +diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h +index cfa7c61..cb4350d 100644 +--- a/libavcodec/hevc.h ++++ b/libavcodec/hevc.h +@@ -56,7 +56,7 @@ + // Define RPI_WORKER to launch a worker thread for pixel processing tasks + #define RPI_WORKER + // Define RPI_DEBLOCK_VPU to perform deblocking on the VPUs +- #define RPI_DEBLOCK_VPU ++ //#define RPI_DEBLOCK_VPU + + #endif + +diff --git a/libavcodec/rpi_qpu.c b/libavcodec/rpi_qpu.c +index 5aa0432..ffd13ca 100644 +--- a/libavcodec/rpi_qpu.c ++++ b/libavcodec/rpi_qpu.c +@@ -9,7 +9,7 @@ + // define RPI_ASYNC to run the VPU in a separate thread, need to make a separate call to check for completion + #define RPI_ASYNC + // Define RPI_COMBINE_JOBS to find jobs that can be executed in parallel +-#define RPI_COMBINE_JOBS ++//#define RPI_COMBINE_JOBS + + #include <stdio.h> + #include <stdlib.h> +@@ -143,9 +143,9 @@ static int gpu_init(volatile struct GPU **gpu) { + volatile struct GPU* ptr; + if (mb < 0) + return -1; +- ++#ifndef RPI_ASYNC + if (qpu_enable(mb, 1)) return -2; +- ++#endif + vcsm_init(); + gpu_malloc_uncached_internal(sizeof(struct GPU), &gpu_mem_ptr, mb); + ptr = (volatile struct GPU*)gpu_mem_ptr.arm; +@@ -336,9 +336,9 @@ static void gpu_term(void) + vpu_post_code(0, 0, 0, 0, 0, 0, -1, NULL); + pthread_join(vpu_thread, &res); + } +-#endif +- ++#else + qpu_enable(mb, 0); ++#endif + gpu_free_internal(&gpu_mem_ptr); + + vcsm_exit(); +@@ -400,6 +400,7 @@ static void *vpu_start(void *arg) { + int count_deblock=0; + int count_qpu=0; + #endif ++ int qpu_started = 0; + while(1) { + int i; + int *p; // Pointer for a QPU/VPU job +@@ -427,6 +428,12 @@ static void *vpu_start(void *arg) { + if (p[7] == 0 && p[0] == 0 && p[16]==0) + goto job_done_early; + ++ if (!qpu_started) { ++ int result = qpu_enable(gpu->mb, 1); ++ av_assert0(result==0); ++ qpu_started = 1; ++ } ++ + #ifdef RPI_COMBINE_JOBS + // First scan for a qpu job + for (int x=0;x<num_jobs;x++) { +@@ -556,6 +563,10 @@ job_done_early: + pthread_mutex_unlock(&post_mutex); + } + ++ if (qpu_started) { ++ qpu_enable(gpu->mb, 0); ++ } ++ + return NULL; + } + +-- +2.5.0 + +From 544f5eb0b6f8cc1ad316a94cae5e78eadf2e1ec9 Mon Sep 17 00:00:00 2001 +From: John Cox <jc@kynesim.co.uk> +Date: Tue, 9 Feb 2016 11:57:40 +0000 +Subject: [PATCH 1/2] Zero copy code v6 + +This version has GPU buffer pooling code +--- + ffmpeg.c | 123 +++++++++----- + libavcodec/Makefile | 2 + + libavcodec/avcodec.h | 6 + + libavcodec/hevc.c | 92 ++++++----- + libavcodec/hevc_filter.c | 83 +++++----- + libavcodec/rpi_qpu.c | 2 +- + libavcodec/rpi_qpu.h | 109 ++++++++++++- + libavcodec/rpi_zc.c | 406 +++++++++++++++++++++++++++++++++++++++++++++++ + libavcodec/rpi_zc.h | 83 ++++++++++ + 9 files changed, 779 insertions(+), 127 deletions(-) + create mode 100644 libavcodec/rpi_zc.c + create mode 100644 libavcodec/rpi_zc.h + +diff --git a/ffmpeg.c b/ffmpeg.c +index 8828f48..36dc1a3 100644 +--- a/ffmpeg.c ++++ b/ffmpeg.c +@@ -25,7 +25,7 @@ + + #ifdef RPI + #define RPI_DISPLAY +-//#define RPI_ZERO_COPY ++#define RPI_ZERO_COPY + #endif + + #include "config.h" +@@ -80,9 +80,7 @@ + #include <interface/mmal/util/mmal_default_components.h> + #include <interface/mmal/util/mmal_connection.h> + #include <interface/mmal/util/mmal_util_params.h> +-#ifdef RPI_ZERO_COPY +-#include "libavcodec/rpi_qpu.h" +-#endif ++#include "libavcodec/rpi_zc.h" + #endif + + #if HAVE_SYS_RESOURCE_H +@@ -183,13 +181,7 @@ static void free_input_threads(void); + + static MMAL_COMPONENT_T* rpi_display = NULL; + static MMAL_POOL_T *rpi_pool = NULL; +- +-#ifdef RPI_ZERO_COPY +-static uint8_t *get_vc_handle(AVBufferRef *bref) { +- GPU_MEM_PTR_T *p = av_buffer_pool_opaque(bref); +- return (uint8_t *)p->vc_handle; +-} +-#endif ++static volatile int rpi_display_count = 0; + + static MMAL_POOL_T* display_alloc_pool(MMAL_PORT_T* port, size_t w, size_t h) + { +@@ -206,7 +198,7 @@ static MMAL_POOL_T* display_alloc_pool(MMAL_PORT_T* port, size_t w, size_t h) + for (i = 0; i < NUM_BUFFERS; ++i) + { + MMAL_BUFFER_HEADER_T* buffer = pool->header[i]; +- void* bufPtr = buffer->data; ++ char * bufPtr = buffer->data; + memset(bufPtr, i*30, w*h); + memset(bufPtr+w*h, 128, (w*h)/2); + } +@@ -215,23 +207,31 @@ static MMAL_POOL_T* display_alloc_pool(MMAL_PORT_T* port, size_t w, size_t h) + return pool; + } + +-static void display_cb_input(MMAL_PORT_T *port,MMAL_BUFFER_HEADER_T *buffer) { ++static void display_cb_input(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buffer) { ++#ifdef RPI_ZERO_COPY ++ av_rpi_zc_unref(buffer->user_data); ++ --rpi_display_count; ++#endif ++ mmal_buffer_header_release(buffer); ++} ++ ++static void display_cb_control(MMAL_PORT_T *port,MMAL_BUFFER_HEADER_T *buffer) { + mmal_buffer_header_release(buffer); + } + + static MMAL_COMPONENT_T* display_init(size_t x, size_t y, size_t w, size_t h) + { + MMAL_COMPONENT_T* display; +- int w2 = (w+31)&~31; +- int h2 = (h+15)&~15; + MMAL_DISPLAYREGION_T region = + { +- {MMAL_PARAMETER_DISPLAYREGION, sizeof(region)}, ++ .hdr = {MMAL_PARAMETER_DISPLAYREGION, sizeof(region)}, + .set = MMAL_DISPLAY_SET_LAYER | MMAL_DISPLAY_SET_FULLSCREEN | MMAL_DISPLAY_SET_DEST_RECT, + .layer = 2, + .fullscreen = 0, + .dest_rect = {x, y, w, h} + }; ++ const AVRpiZcFrameGeometry geo = av_rpi_zc_frame_geometry(w, h); ++ + bcm_host_init(); // TODO is this needed? + mmal_component_create(MMAL_COMPONENT_DEFAULT_VIDEO_RENDERER, &display); + assert(display); +@@ -240,8 +240,8 @@ static MMAL_COMPONENT_T* display_init(size_t x, size_t y, size_t w, size_t h) + + MMAL_ES_FORMAT_T* format = display->input[0]->format; + format->encoding = MMAL_ENCODING_I420; +- format->es->video.width = w2; +- format->es->video.height = h2; ++ format->es->video.width = geo.stride_y; ++ format->es->video.height = geo.height_y; + format->es->video.crop.x = 0; + format->es->video.crop.y = 0; + format->es->video.crop.width = w; +@@ -250,46 +250,75 @@ static MMAL_COMPONENT_T* display_init(size_t x, size_t y, size_t w, size_t h) + + mmal_component_enable(display); + +- rpi_pool = display_alloc_pool(display->input[0], w2, h2); ++ rpi_pool = display_alloc_pool(display->input[0], geo.stride_y, geo.height_y); + + mmal_port_enable(display->input[0],display_cb_input); +- mmal_port_enable(display->control,display_cb_input); ++ mmal_port_enable(display->control,display_cb_control); + +- printf("Allocated display %d %d\n",w,h); ++ printf("Allocated display %dx%d in %dx%d\n", w, h, geo.stride_y, geo.height_y); + + return display; + } + +-static void display_frame(MMAL_COMPONENT_T* display,AVFrame* fr) ++static void display_frame(struct AVCodecContext * const s, MMAL_COMPONENT_T* const display, const AVFrame* const fr) + { +- int w = fr->width; +- int h = fr->height; +- int w2 = (w+31)&~31; +- int h2 = (h+15)&~15; + if (!display || !rpi_pool) + return; ++ ++ if (rpi_display_count >= 3) { ++ av_log(s, AV_LOG_VERBOSE, "Frame dropped\n"); ++ return; ++ } ++ + MMAL_BUFFER_HEADER_T* buf = mmal_queue_get(rpi_pool->queue); + if (!buf) { +- // Running too fast so drop the frame +- return; ++ // Running too fast so drop the frame ++ printf("Q alloc failure\n"); ++ return; + } + assert(buf); + buf->cmd = 0; +- buf->length = (w2 * h2 * 3)/2; + buf->offset = 0; // Offset to valid data + buf->flags = 0; + #ifdef RPI_ZERO_COPY +- buf->data = get_vc_handle(fr->buf[0]); +- buf->alloc_size = (w2*h2*3)/2; ++{ ++ const AVRpiZcRefPtr fr_buf = av_rpi_zc_ref(s, fr, 1); ++ ++ buf->user_data = fr_buf; ++ buf->data = av_rpi_zc_vc_handle(fr_buf); ++ buf->alloc_size = ++ buf->length = av_rpi_zc_numbytes(fr_buf); ++ ++ ++rpi_display_count; ++} + #else ++{ ++#error YYY ++ int w = fr->width; ++ int h = fr->height; ++ int w2 = (w+31)&~31; ++ int h2 = (h+15)&~15; ++ ++ buf->length = (w2 * h2 * 3)/2; ++ buf->user_data = NULL; ++ + //mmal_buffer_header_mem_lock(buf); + memcpy(buf->data, fr->data[0], w2 * h); + memcpy(buf->data+w2*h2, fr->data[1], w2 * h / 4); + memcpy(buf->data+w2*h2*5/4, fr->data[2], w2 * h / 4); + //mmal_buffer_header_mem_unlock(buf); ++} + #endif + +- mmal_port_send_buffer(display->input[0], buf); // I assume this will automatically get released ++ while (rpi_display_count >= 3) { ++ usleep(5000); ++ } ++ ++ if (mmal_port_send_buffer(display->input[0], buf) != MMAL_SUCCESS) ++ { ++ printf("** send failed: depth=%d\n", rpi_display_count); ++ display_cb_input(NULL, buf); ++ } + } + + static void display_exit(MMAL_COMPONENT_T* display) +@@ -687,6 +716,11 @@ static void ffmpeg_cleanup(int ret) + avformat_close_input(&input_files[i]->ctx); + av_freep(&input_files[i]); + } ++ ++#ifdef RPI_DISPLAY ++ display_exit(rpi_display); ++#endif ++ + for (i = 0; i < nb_input_streams; i++) { + InputStream *ist = input_streams[i]; + +@@ -698,6 +732,9 @@ static void ffmpeg_cleanup(int ret) + av_freep(&ist->filters); + av_freep(&ist->hwaccel_device); + ++#ifdef RPI_ZERO_COPY ++ av_rpi_zc_uninit(ist->dec_ctx); ++#endif + avcodec_free_context(&ist->dec_ctx); + + av_freep(&input_streams[i]); +@@ -729,9 +766,6 @@ static void ffmpeg_cleanup(int ret) + term_exit(); + ffmpeg_exited = 1; + +-#ifdef RPI_DISPLAY +- display_exit(rpi_display); +-#endif + } + + void remove_avoptions(AVDictionary **a, AVDictionary *b) +@@ -1079,18 +1113,19 @@ static void do_video_out(AVFormatContext *s, + int frame_size = 0; + InputStream *ist = NULL; + AVFilterContext *filter = ost->filter->filter; ++ ++ if (ost->source_index >= 0) ++ ist = input_streams[ost->source_index]; ++ + #ifdef RPI_DISPLAY +- if (next_picture) ++ if (next_picture && ist != NULL) + { +- if (!rpi_display) ++ if (!rpi_display) + rpi_display = display_init(0,0,next_picture->width,next_picture->height); +- display_frame(rpi_display,next_picture); ++ display_frame(ist->dec_ctx, rpi_display, next_picture); + } + #endif + +- if (ost->source_index >= 0) +- ist = input_streams[ost->source_index]; +- + if (filter->inputs[0]->frame_rate.num > 0 && + filter->inputs[0]->frame_rate.den > 0) + duration = 1/(av_q2d(filter->inputs[0]->frame_rate) * av_q2d(enc->time_base)); +@@ -2692,6 +2727,12 @@ static int init_input_stream(int ist_index, char *error, int error_len) + ist->dec_ctx->opaque = ist; + ist->dec_ctx->get_format = get_format; + ist->dec_ctx->get_buffer2 = get_buffer; ++ ++#ifdef RPI_ZERO_COPY ++ // Overrides the above get_buffer2 ++ av_rpi_zc_init(ist->dec_ctx); ++#endif ++ + ist->dec_ctx->thread_safe_callbacks = 1; + + av_opt_set_int(ist->dec_ctx, "refcounted_frames", 1, 0); +diff --git a/libavcodec/Makefile b/libavcodec/Makefile +index 0fd6767..bae3f2d 100644 +--- a/libavcodec/Makefile ++++ b/libavcodec/Makefile +@@ -9,6 +9,7 @@ HEADERS = avcodec.h \ + rpi_shader.h \ + rpi_mailbox.h \ + rpi_hevc_transform.h \ ++ rpi_zc.h \ + dv_profile.h \ + d3d11va.h \ + dirac.h \ +@@ -46,6 +47,7 @@ OBJS = allcodecs.o \ + rpi_qpu.o \ + rpi_shader.o \ + rpi_mailbox.o \ ++ rpi_zc.o \ + vorbis_parser.o \ + xiph.o \ + +diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h +index d849765..b934740 100644 +--- a/libavcodec/avcodec.h ++++ b/libavcodec/avcodec.h +@@ -3355,6 +3355,12 @@ typedef struct AVCodecContext { + AVPacketSideData *coded_side_data; + int nb_coded_side_data; + ++ /** ++ * Opaque pointer for use by replacement get_buffer2 code ++ * ++ * @author jc (08/02/2016) ++ */ ++ void * get_buffer_context; + } AVCodecContext; + + AVRational av_codec_get_pkt_timebase (const AVCodecContext *avctx); +diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c +index 35a1394..001c9e8 100644 +--- a/libavcodec/hevc.c ++++ b/libavcodec/hevc.c +@@ -114,10 +114,6 @@ static uint32_t rpi_filter_coefs[8][1] = { + { ENCODE_COEFFS( -2, 10, 58, -2) } + }; + +-static uint32_t get_vc_address(AVBufferRef *bref) { +- GPU_MEM_PTR_T *p = av_buffer_pool_opaque(bref); +- return p->vc; +-} + #endif + + +@@ -2186,9 +2182,9 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, + int bw = nPbW-start_x; + int bh = nPbH-start_y; + y++[-RPI_LUMA_COMMAND_WORDS] = ((y1 - 3 + start_y) << 16) + ( (x1 - 3 + start_x) & 0xffff); +- y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[0]); ++ y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address_y(ref0->frame); + y++[-RPI_LUMA_COMMAND_WORDS] = ((y1 - 3 + start_y) << 16) + ( (x1 - 3 + 8 + start_x) & 0xffff); +- y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[0]); ++ y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address_y(ref0->frame); + *y++ = ( (bw<16 ? bw : 16) << 16 ) + (bh<16 ? bh : 16); + *y++ = my2_mx2_my_mx; + if (weight_flag) { +@@ -2196,7 +2192,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, + } else { + *y++ = 1; // Weight of 1 and offset of 0 + } +- *y++ = (get_vc_address(s->frame->buf[0]) + x0 + start_x + (start_y + y0) * s->frame->linesize[0]); ++ *y++ = (get_vc_address_y(s->frame) + x0 + start_x + (start_y + y0) * s->frame->linesize[0]); + y++[-RPI_LUMA_COMMAND_WORDS] = s->mc_filter; + } + } +@@ -2235,8 +2231,8 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, + u++[-RPI_CHROMA_COMMAND_WORDS] = s->mc_filter_uv; + u++[-RPI_CHROMA_COMMAND_WORDS] = x1_c - 1 + start_x; + u++[-RPI_CHROMA_COMMAND_WORDS] = y1_c - 1 + start_y; +- u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[1]); +- u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[2]); ++ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address_u(ref0->frame); ++ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address_v(ref0->frame); + *u++ = ( (bw<RPI_CHROMA_BLOCK_WIDTH ? bw : RPI_CHROMA_BLOCK_WIDTH) << 16 ) + (bh<16 ? bh : 16); + *u++ = rpi_filter_coefs[_mx][0]; + *u++ = rpi_filter_coefs[_my][0]; +@@ -2247,8 +2243,8 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, + *u++ = 1; // Weight of 1 and offset of 0 + *u++ = 1; + } +- *u++ = (get_vc_address(s->frame->buf[1]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[1]); +- *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); ++ *u++ = (get_vc_address_u(s->frame) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[1]); ++ *u++ = (get_vc_address_v(s->frame) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); + } + } + s->curr_u_mvs = u; +@@ -2286,9 +2282,9 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, + int bw = nPbW-start_x; + int bh = nPbH-start_y; + y++[-RPI_LUMA_COMMAND_WORDS] = ((y1 - 3 + start_y) << 16) + ( (x1 - 3 + start_x) & 0xffff); +- y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[0]); ++ y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address_y(ref1->frame); + y++[-RPI_LUMA_COMMAND_WORDS] = ((y1 - 3 + start_y) << 16) + ( (x1 - 3 + 8 + start_x) & 0xffff); +- y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[0]); ++ y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address_y(ref1->frame); + *y++ = ( (bw<16 ? bw : 16) << 16 ) + (bh<16 ? bh : 16); + *y++ = my2_mx2_my_mx; + if (weight_flag) { +@@ -2296,7 +2292,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, + } else { + *y++ = 1; // Weight of 1 and offset of 0 + } +- *y++ = (get_vc_address(s->frame->buf[0]) + x0 + start_x + (start_y + y0) * s->frame->linesize[0]); ++ *y++ = (get_vc_address_y(s->frame) + x0 + start_x + (start_y + y0) * s->frame->linesize[0]); + y++[-RPI_LUMA_COMMAND_WORDS] = s->mc_filter; + } + } +@@ -2336,8 +2332,8 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, + u++[-RPI_CHROMA_COMMAND_WORDS] = s->mc_filter_uv; + u++[-RPI_CHROMA_COMMAND_WORDS] = x1_c - 1 + start_x; + u++[-RPI_CHROMA_COMMAND_WORDS] = y1_c - 1 + start_y; +- u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[1]); +- u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[2]); ++ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address_u(ref1->frame); ++ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address_v(ref1->frame); + *u++ = ( (bw<RPI_CHROMA_BLOCK_WIDTH ? bw : RPI_CHROMA_BLOCK_WIDTH) << 16 ) + (bh<16 ? bh : 16); + // TODO chroma weight and offset... s->sh.chroma_weight_l0[current_mv.ref_idx[0]][0], s->sh.chroma_offset_l0[current_mv.ref_idx[0]][0] + *u++ = rpi_filter_coefs[_mx][0]; +@@ -2349,8 +2345,8 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, + *u++ = 1; // Weight of 1 and offset of 0 + *u++ = 1; + } +- *u++ = (get_vc_address(s->frame->buf[1]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[1]); +- *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); ++ *u++ = (get_vc_address_u(s->frame) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[1]); ++ *u++ = (get_vc_address_v(s->frame) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); + } + } + s->curr_u_mvs = u; +@@ -2392,13 +2388,13 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, + int bw = nPbW-start_x; + int bh = nPbH-start_y; + y++[-RPI_LUMA_COMMAND_WORDS] = ((y1 - 3 + start_y) << 16) + ( (x1 - 3 + start_x) & 0xffff); +- y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[0]); ++ y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address_y(ref0->frame); + y++[-RPI_LUMA_COMMAND_WORDS] = ((y2 - 3 + start_y) << 16) + ( (x2 - 3 + start_x) & 0xffff); // Second fetch is for ref1 +- y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[0]); ++ y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address_y(ref1->frame); + *y++ = ( (bw<8 ? bw : 8) << 16 ) + (bh<16 ? bh : 16); + *y++ = my2_mx2_my_mx; + *y++ = 1; // B frame weighted prediction not supported +- *y++ = (get_vc_address(s->frame->buf[0]) + x0 + start_x + (start_y + y0) * s->frame->linesize[0]); ++ *y++ = (get_vc_address_y(s->frame) + x0 + start_x + (start_y + y0) * s->frame->linesize[0]); + y++[-RPI_LUMA_COMMAND_WORDS] = s->mc_filter_b; + } + } +@@ -2442,8 +2438,8 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, + u++[-RPI_CHROMA_COMMAND_WORDS] = s->mc_filter_uv_b0; + u++[-RPI_CHROMA_COMMAND_WORDS] = x1_c - 1 + start_x; + u++[-RPI_CHROMA_COMMAND_WORDS] = y1_c - 1 + start_y; +- u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[1]); +- u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[2]); ++ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address_u(ref0->frame); ++ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address_v(ref0->frame); + *u++ = ( (bw<RPI_CHROMA_BLOCK_WIDTH ? bw : RPI_CHROMA_BLOCK_WIDTH) << 16 ) + (bh<16 ? bh : 16); + *u++ = rpi_filter_coefs[_mx][0]; + *u++ = rpi_filter_coefs[_my][0]; +@@ -2453,14 +2449,14 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, + u++[-RPI_CHROMA_COMMAND_WORDS] = s->mc_filter_uv_b; + u++[-RPI_CHROMA_COMMAND_WORDS] = x2_c - 1 + start_x; + u++[-RPI_CHROMA_COMMAND_WORDS] = y2_c - 1 + start_y; +- u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[1]); +- u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[2]); ++ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address_u(ref1->frame); ++ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address_v(ref1->frame); + *u++ = ( (bw<RPI_CHROMA_BLOCK_WIDTH ? bw : RPI_CHROMA_BLOCK_WIDTH) << 16 ) + (bh<16 ? bh : 16); + *u++ = rpi_filter_coefs[_mx2][0]; + *u++ = rpi_filter_coefs[_my2][0]; + u+=2; // Weights not supported in B slices +- *u++ = (get_vc_address(s->frame->buf[1]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[1]); +- *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); ++ *u++ = (get_vc_address_u(s->frame) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[1]); ++ *u++ = (get_vc_address_v(s->frame) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); + } + } + s->curr_u_mvs = u; +@@ -3259,12 +3255,13 @@ static int32_t filter8_luma(uint8_t *data, int x0, int y0, int pitch, int my_mx, + return vsum; + } + +-static uint8_t *test_frame(HEVCContext *s,uint32_t p, AVFrame *frame, int cIdx) ++static uint8_t *test_frame(HEVCContext *s,uint32_t p, AVFrame *frame, const int cIdx) + { + //int pic_width = s->ps.sps->width >> s->ps.sps->hshift[cIdx]; + int pic_height = s->ps.sps->height >> s->ps.sps->vshift[cIdx]; + int pitch = frame->linesize[cIdx]; +- uint32_t base = get_vc_address(frame->buf[cIdx]); ++ uint32_t base = c_idx == 0 ? get_vc_address_y(frame); ++ c_idx == 1 ? get_vc_address_u(frame) : get_vc_address_v(frame); + if (p>=base && p<base+pitch*pic_height) { + return frame->data[cIdx] + (p-base); + } +@@ -3551,6 +3548,7 @@ static void rpi_launch_vpu_qpu(HEVCContext *s) + #ifdef RPI + + #ifndef RPI_FAST_CACHEFLUSH ++#error RPI_FAST_CACHEFLUSH is broken + static void flush_buffer(AVBufferRef *bref) { + GPU_MEM_PTR_T *p = av_buffer_pool_opaque(bref); + gpu_cache_flush(p); +@@ -3561,7 +3559,7 @@ static void flush_frame(HEVCContext *s,AVFrame *frame) + { + #ifdef RPI_FAST_CACHEFLUSH + struct vcsm_user_clean_invalid_s iocache = {}; +- GPU_MEM_PTR_T *p = av_buffer_pool_opaque(frame->buf[1]); ++ GPU_MEM_PTR_T p = get_gpu_mem_ptr_u(s->frame); + int n = s->ps.sps->height; + int curr_y = 0; + int curr_uv = 0; +@@ -3569,21 +3567,21 @@ static void flush_frame(HEVCContext *s,AVFrame *frame) + int sz,base; + sz = s->frame->linesize[1] * (n_uv-curr_uv); + base = s->frame->linesize[1] * curr_uv; +- iocache.s[0].handle = p->vcsm_handle; ++ iocache.s[0].handle = p.vcsm_handle; + iocache.s[0].cmd = 3; // clean+invalidate +- iocache.s[0].addr = (int)(p->arm) + base; ++ iocache.s[0].addr = (int)(p.arm) + base; + iocache.s[0].size = sz; +- p = av_buffer_pool_opaque(frame->buf[2]); +- iocache.s[1].handle = p->vcsm_handle; ++ p = get_gpu_mem_ptr_v(s->frame); ++ iocache.s[1].handle = p.vcsm_handle; + iocache.s[1].cmd = 3; // clean+invalidate +- iocache.s[1].addr = (int)(p->arm) + base; ++ iocache.s[1].addr = (int)(p.arm) + base; + iocache.s[1].size = sz; +- p = av_buffer_pool_opaque(frame->buf[0]); ++ p = get_gpu_mem_ptr_y(s->frame); + sz = s->frame->linesize[0] * (n-curr_y); + base = s->frame->linesize[0] * curr_y; +- iocache.s[2].handle = p->vcsm_handle; ++ iocache.s[2].handle = p.vcsm_handle; + iocache.s[2].cmd = 3; // clean+invalidate +- iocache.s[2].addr = (int)(p->arm) + base; ++ iocache.s[2].addr = (int)(p.arm) + base; + iocache.s[2].size = sz; + vcsm_clean_invalid( &iocache ); + #else +@@ -3601,7 +3599,7 @@ static void flush_frame3(HEVCContext *s,AVFrame *frame,GPU_MEM_PTR_T *p0,GPU_MEM + int curr_y; + int curr_uv; + int n_uv; +- GPU_MEM_PTR_T *p = av_buffer_pool_opaque(frame->buf[1]); ++ GPU_MEM_PTR_T p = get_gpu_mem_ptr_u(s->frame); + int sz,base; + int (*d)[2] = s->dblk_cmds[job]; + int low=(*d)[1]; +@@ -3618,21 +3616,21 @@ static void flush_frame3(HEVCContext *s,AVFrame *frame,GPU_MEM_PTR_T *p0,GPU_MEM + + sz = s->frame->linesize[1] * (n_uv-curr_uv); + base = s->frame->linesize[1] * curr_uv; +- iocache.s[0].handle = p->vcsm_handle; ++ iocache.s[0].handle = p.vcsm_handle; + iocache.s[0].cmd = 3; // clean+invalidate +- iocache.s[0].addr = (int)(p->arm) + base; ++ iocache.s[0].addr = (int)(p.arm) + base; + iocache.s[0].size = sz; +- p = av_buffer_pool_opaque(frame->buf[2]); +- iocache.s[1].handle = p->vcsm_handle; ++ p = get_gpu_mem_ptr_v(s->frame); ++ iocache.s[1].handle = p.vcsm_handle; + iocache.s[1].cmd = 3; // clean+invalidate +- iocache.s[1].addr = (int)(p->arm) + base; ++ iocache.s[1].addr = (int)(p.arm) + base; + iocache.s[1].size = sz; +- p = av_buffer_pool_opaque(frame->buf[0]); ++ p = get_gpu_mem_ptr_y(s->frame); + sz = s->frame->linesize[0] * (n-curr_y); + base = s->frame->linesize[0] * curr_y; +- iocache.s[2].handle = p->vcsm_handle; ++ iocache.s[2].handle = p.vcsm_handle; + iocache.s[2].cmd = 3; // clean+invalidate +- iocache.s[2].addr = (int)(p->arm) + base; ++ iocache.s[2].addr = (int)(p.arm) + base; + iocache.s[2].size = sz; + + iocache.s[3].handle = p0->vcsm_handle; +diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c +index 826a82f..c4fa305 100644 +--- a/libavcodec/hevc_filter.c ++++ b/libavcodec/hevc_filter.c +@@ -879,17 +879,25 @@ void ff_hevc_deblocking_boundary_strengths(HEVCContext *s, int x0, int y0, + #undef CR + + #ifdef RPI_INTER_QPU +-static void flush_buffer(AVBufferRef *bref) { +- GPU_MEM_PTR_T *p = av_buffer_pool_opaque(bref); +- gpu_cache_flush(p); ++static void flush_buffer_y(const AVFrame * const frame) { ++ GPU_MEM_PTR_T p = get_gpu_mem_ptr_y(frame); ++ gpu_cache_flush(&p); + } + +-// Return Physical address for this image +-static uint32_t get_vc_address(AVBufferRef *bref) { +- GPU_MEM_PTR_T *p = av_buffer_pool_opaque(bref); +- return p->vc; ++static void flush_buffer_u(const AVFrame * const frame) { ++ GPU_MEM_PTR_T p = get_gpu_mem_ptr_u(frame); ++ gpu_cache_flush(&p); + } + ++static void flush_buffer_v(const AVFrame * const frame) { ++ GPU_MEM_PTR_T p = get_gpu_mem_ptr_v(frame); ++ gpu_cache_flush(&p); ++} ++ ++ ++#ifdef RPI_DEBLOCK_VPU ++#error Not fixed yet ++ + // ff_hevc_flush_buffer_lines + // flushes and invalidates all pixel rows in [start,end-1] + static void ff_hevc_flush_buffer_lines(HEVCContext *s, int start, int end, int flush_luma, int flush_chroma) +@@ -901,44 +909,44 @@ static void ff_hevc_flush_buffer_lines(HEVCContext *s, int start, int end, int f + int curr_uv = curr_y >> s->ps.sps->vshift[1]; + int n_uv = n >> s->ps.sps->vshift[1]; + int sz,base; +- GPU_MEM_PTR_T *p; ++ GPU_MEM_PTR_T p; + if (curr_uv < 0) curr_uv = 0; + if (n_uv<=curr_uv) { return; } + sz = s->frame->linesize[1] * (n_uv-curr_uv); + base = s->frame->linesize[1] * curr_uv; + if (flush_chroma) { +- p = av_buffer_pool_opaque(s->frame->buf[1]); +- iocache.s[0].handle = p->vcsm_handle; ++ p = get_gpu_mem_ptr_u(s->frame); ++ iocache.s[0].handle = p.vcsm_handle; + iocache.s[0].cmd = 3; // clean+invalidate +- iocache.s[0].addr = (int)p->arm + base; ++ iocache.s[0].addr = (int)p.arm + base; + iocache.s[0].size = sz; +- p = av_buffer_pool_opaque(s->frame->buf[2]); +- iocache.s[1].handle = p->vcsm_handle; ++ p = get_gpu_mem_ptr_v(s->frame); ++ iocache.s[1].handle = p.vcsm_handle; + iocache.s[1].cmd = 3; // clean+invalidate +- iocache.s[1].addr = (int)p->arm + base; ++ iocache.s[1].addr = (int)p.arm + base; + iocache.s[1].size = sz; + } + if (flush_luma) { +- p = av_buffer_pool_opaque(s->frame->buf[0]); ++ p = get_gpu_mem_ptr_y(s->frame); + sz = s->frame->linesize[0] * (n-curr_y); + base = s->frame->linesize[0] * curr_y; +- iocache.s[2].handle = p->vcsm_handle; ++ iocache.s[2].handle = p.vcsm_handle; + iocache.s[2].cmd = 3; // clean+invalidate +- iocache.s[2].addr = (int)p->arm + base; ++ iocache.s[2].addr = (int)p.arm + base; + iocache.s[2].size = sz; + } + vcsm_clean_invalid( &iocache ); + #else + if (flush_chroma) { +- flush_buffer(s->frame->buf[1]); +- flush_buffer(s->frame->buf[2]); ++ flush_buffer_u(s->frame); ++ flush_buffer_v(s->frame); + } + if (flush_luma) { +- flush_buffer(s->frame->buf[0]); ++ flush_buffer_y(s->frame); + } + #endif + } +- ++#endif + + void ff_hevc_flush_buffer(HEVCContext *s, ThreadFrame *f, int n) + { +@@ -950,37 +958,37 @@ void ff_hevc_flush_buffer(HEVCContext *s, ThreadFrame *f, int n) + int curr_uv = curr_y >> s->ps.sps->vshift[1]; + int n_uv = n >> s->ps.sps->vshift[1]; + int sz,base; +- GPU_MEM_PTR_T *p; ++ GPU_MEM_PTR_T p; + if (curr_uv < 0) curr_uv = 0; + if (n_uv<=curr_uv) { return; } + sz = s->frame->linesize[1] * (n_uv-curr_uv); + base = s->frame->linesize[1] * curr_uv; +- p = av_buffer_pool_opaque(s->frame->buf[1]); +- iocache.s[0].handle = p->vcsm_handle; ++ p = get_gpu_mem_ptr_u(s->frame); ++ iocache.s[0].handle = p.vcsm_handle; + iocache.s[0].cmd = 3; // clean+invalidate +- iocache.s[0].addr = (int)p->arm + base; ++ iocache.s[0].addr = (int)p.arm + base; + iocache.s[0].size = sz; +- p = av_buffer_pool_opaque(s->frame->buf[2]); +- iocache.s[1].handle = p->vcsm_handle; ++ p = get_gpu_mem_ptr_v(s->frame); ++ iocache.s[1].handle = p.vcsm_handle; + iocache.s[1].cmd = 3; // clean+invalidate +- iocache.s[1].addr = (int)p->arm + base; ++ iocache.s[1].addr = (int)p.arm + base; + iocache.s[1].size = sz; + + #ifdef RPI_LUMA_QPU +- p = av_buffer_pool_opaque(s->frame->buf[0]); ++ p = get_gpu_mem_ptr_y(s->frame); + sz = s->frame->linesize[0] * (n-curr_y); + base = s->frame->linesize[0] * curr_y; +- iocache.s[2].handle = p->vcsm_handle; ++ iocache.s[2].handle = p.vcsm_handle; + iocache.s[2].cmd = 3; // clean+invalidate +- iocache.s[2].addr = (int)p->arm + base; ++ iocache.s[2].addr = (int)p.arm + base; + iocache.s[2].size = sz; + #endif + vcsm_clean_invalid( &iocache ); + #else +- flush_buffer(s->frame->buf[1]); +- flush_buffer(s->frame->buf[2]); ++ flush_buffer_u(s->frame); ++ flush_buffer_v(s->frame); + #ifdef RPI_LUMA_QPU +- flush_buffer(s->frame->buf[0]); ++ flush_buffer_y(s->frame); + #endif + + #endif +@@ -992,6 +1000,7 @@ void ff_hevc_flush_buffer(HEVCContext *s, ThreadFrame *f, int n) + #endif + + #ifdef RPI_DEBLOCK_VPU ++#error XXX + /* rpi_deblock deblocks an entire row of ctbs using the VPU */ + static void rpi_deblock(HEVCContext *s, int y, int ctb_size) + { +@@ -1000,21 +1009,21 @@ static void rpi_deblock(HEVCContext *s, int y, int ctb_size) + // TODO flush buffer of beta/tc setup when it becomes cached + + // Prepare three commands at once to avoid calling overhead +- s->vpu_cmds_arm[0][0] = get_vc_address(s->frame->buf[0]) + s->frame->linesize[0] * y; ++ s->vpu_cmds_arm[0][0] = get_vc_address_y(s->frame) + s->frame->linesize[0] * y; + s->vpu_cmds_arm[0][1] = s->frame->linesize[0]; + s->vpu_cmds_arm[0][2] = s->setup_width; + s->vpu_cmds_arm[0][3] = (int) ( s->y_setup_vc + s->setup_width * (y>>4) ); + s->vpu_cmds_arm[0][4] = ctb_size>>4; + s->vpu_cmds_arm[0][5] = 2; + +- s->vpu_cmds_arm[1][0] = get_vc_address(s->frame->buf[1]) + s->frame->linesize[1] * (y>> s->ps.sps->vshift[1]); ++ s->vpu_cmds_arm[1][0] = get_vc_address_u(s->frame) + s->frame->linesize[1] * (y>> s->ps.sps->vshift[1]); + s->vpu_cmds_arm[1][1] = s->frame->linesize[1]; + s->vpu_cmds_arm[1][2] = s->uv_setup_width; + s->vpu_cmds_arm[1][3] = (int) ( s->uv_setup_vc + s->uv_setup_width * ((y>>4)>> s->ps.sps->vshift[1]) ); + s->vpu_cmds_arm[1][4] = (ctb_size>>4)>> s->ps.sps->vshift[1]; + s->vpu_cmds_arm[1][5] = 3; + +- s->vpu_cmds_arm[2][0] = get_vc_address(s->frame->buf[2]) + s->frame->linesize[2] * (y>> s->ps.sps->vshift[2]); ++ s->vpu_cmds_arm[2][0] = get_vc_address_v(s->frame) + s->frame->linesize[2] * (y>> s->ps.sps->vshift[2]); + s->vpu_cmds_arm[2][1] = s->frame->linesize[2]; + s->vpu_cmds_arm[2][2] = s->uv_setup_width; + s->vpu_cmds_arm[2][3] = (int) ( s->uv_setup_vc + s->uv_setup_width * ((y>>4)>> s->ps.sps->vshift[1]) ); +diff --git a/libavcodec/rpi_qpu.c b/libavcodec/rpi_qpu.c +index ffd13ca..b0c9bc5 100644 +--- a/libavcodec/rpi_qpu.c ++++ b/libavcodec/rpi_qpu.c +@@ -250,7 +250,7 @@ int gpu_get_mailbox(void) + } + + // Call this to clean and invalidate a region of memory +-void gpu_cache_flush(GPU_MEM_PTR_T *p) ++void gpu_cache_flush(const GPU_MEM_PTR_T * const p) + { + #ifdef RPI_FAST_CACHEFLUSH + struct vcsm_user_clean_invalid_s iocache = {}; +diff --git a/libavcodec/rpi_qpu.h b/libavcodec/rpi_qpu.h +index 81c2bb1..b913f79 100644 +--- a/libavcodec/rpi_qpu.h ++++ b/libavcodec/rpi_qpu.h +@@ -2,8 +2,11 @@ + #define RPI_QPU_H + + // Define RPI_FAST_CACHEFLUSH to use the VCSM cache flush code ++// *** N.B. Code has rotted & crashes if this is unset (before this set of changes) + #define RPI_FAST_CACHEFLUSH + ++#define RPI_ONE_BUF 1 ++ + typedef struct gpu_mem_ptr_s { + unsigned char *arm; // Pointer to memory mapped on ARM side + int vc_handle; // Videocore handle of relocatable memory +@@ -16,9 +19,113 @@ typedef struct gpu_mem_ptr_s { + extern int gpu_malloc_cached(int numbytes, GPU_MEM_PTR_T *p); + extern int gpu_malloc_uncached(int numbytes, GPU_MEM_PTR_T *p); + extern void gpu_free(GPU_MEM_PTR_T *p); +-extern void gpu_cache_flush(GPU_MEM_PTR_T *p); ++extern void gpu_cache_flush(const GPU_MEM_PTR_T * const p); + extern void gpu_cache_flush3(GPU_MEM_PTR_T *p0,GPU_MEM_PTR_T *p1,GPU_MEM_PTR_T *p2); + ++#include "libavutil/frame.h" ++#if !RPI_ONE_BUF ++static inline uint32_t get_vc_address_y(const AVFrame * const frame) { ++ GPU_MEM_PTR_T *p = av_buffer_pool_opaque(frame->buf[0]); ++ return p->vc; ++} ++ ++static inline uint32_t get_vc_address_u(const AVFrame * const frame) { ++ GPU_MEM_PTR_T *p = av_buffer_pool_opaque(frame->buf[1]); ++ return p->vc; ++} ++ ++static inline uint32_t get_vc_address_v(const AVFrame * const frame) { ++ GPU_MEM_PTR_T *p = av_buffer_pool_opaque(frame->buf[2]); ++ return p->vc; ++} ++ ++static inline GPU_MEM_PTR_T get_gpu_mem_ptr_y(const AVFrame * const frame) { ++ return *(GPU_MEM_PTR_T *)av_buffer_pool_opaque(frame->buf[0]); ++} ++ ++static inline GPU_MEM_PTR_T get_gpu_mem_ptr_u(const AVFrame * const frame) { ++ return *(GPU_MEM_PTR_T *)av_buffer_pool_opaque(frame->buf[1]); ++} ++ ++static inline GPU_MEM_PTR_T get_gpu_mem_ptr_v(const AVFrame * const frame) { ++ return *(GPU_MEM_PTR_T *)av_buffer_pool_opaque(frame->buf[2]); ++} ++ ++#else ++ ++static inline int gpu_is_buf1(const AVFrame * const frame) ++{ ++ return frame->buf[1] == NULL; ++} ++ ++static inline GPU_MEM_PTR_T * gpu_buf1_gmem(const AVFrame * const frame) ++{ ++ return av_buffer_get_opaque(frame->buf[0]); ++} ++ ++static inline GPU_MEM_PTR_T * gpu_buf3_gmem(const AVFrame * const frame, const int n) ++{ ++ return av_buffer_pool_opaque(frame->buf[n]); ++} ++ ++ ++static inline uint32_t get_vc_address_y(const AVFrame * const frame) { ++ return gpu_is_buf1(frame) ? gpu_buf1_gmem(frame)->vc : gpu_buf3_gmem(frame, 0)->vc; ++} ++ ++static inline uint32_t get_vc_address_u(const AVFrame * const frame) { ++ return gpu_is_buf1(frame) ? ++ gpu_buf1_gmem(frame)->vc + frame->data[1] - frame->data[0] : ++ gpu_buf3_gmem(frame, 1)->vc; ++} ++ ++static inline uint32_t get_vc_address_v(const AVFrame * const frame) { ++ return gpu_is_buf1(frame) ? ++ gpu_buf1_gmem(frame)->vc + frame->data[2] - frame->data[0] : ++ gpu_buf3_gmem(frame, 2)->vc; ++} ++ ++ ++static inline GPU_MEM_PTR_T get_gpu_mem_ptr_y(const AVFrame * const frame) { ++ if (gpu_is_buf1(frame)) ++ { ++ GPU_MEM_PTR_T g = *gpu_buf1_gmem(frame); ++ g.numbytes = frame->data[1] - frame->data[0]; ++ return g; ++ } ++ else ++ return *gpu_buf3_gmem(frame, 0); ++} ++ ++static inline GPU_MEM_PTR_T get_gpu_mem_ptr_u(const AVFrame * const frame) { ++ if (gpu_is_buf1(frame)) ++ { ++ GPU_MEM_PTR_T g = *gpu_buf1_gmem(frame); ++ g.arm += frame->data[1] - frame->data[0]; ++ g.vc += frame->data[1] - frame->data[0]; ++ g.numbytes = frame->data[2] - frame->data[1]; // chroma size ++ return g; ++ } ++ else ++ return *gpu_buf3_gmem(frame, 1); ++} ++ ++static inline GPU_MEM_PTR_T get_gpu_mem_ptr_v(const AVFrame * const frame) { ++ if (gpu_is_buf1(frame)) ++ { ++ GPU_MEM_PTR_T g = *gpu_buf1_gmem(frame); ++ g.arm += frame->data[2] - frame->data[0]; ++ g.vc += frame->data[2] - frame->data[0]; ++ g.numbytes = frame->data[2] - frame->data[1]; // chroma size ++ return g; ++ } ++ else ++ return *gpu_buf3_gmem(frame, 2); ++} ++ ++#endif ++ ++ + // QPU specific functions + extern void qpu_run_shader8(int code, int unifs1, int unifs2, int unifs3, int unifs4, int unifs5, int unifs6, int unifs7, int unifs8); + extern void qpu_run_shader12(int code, int num, int code2, int num2, int unifs1, int unifs2, int unifs3, int unifs4, int unifs5, int unifs6, int unifs7, int unifs8, int unifs9, int unifs10, int unifs11, int unifs12); +diff --git a/libavcodec/rpi_zc.c b/libavcodec/rpi_zc.c +new file mode 100644 +index 0000000..9580165 +--- /dev/null ++++ b/libavcodec/rpi_zc.c +@@ -0,0 +1,406 @@ ++#include "config.h" ++#ifdef RPI ++#include "rpi_qpu.h" ++#include "rpi_zc.h" ++ ++#include "libavutil/buffer_internal.h" ++ ++struct ZcPoolEnt; ++ ++typedef struct ZcPool ++{ ++ int numbytes; ++ struct ZcPoolEnt * head; ++ pthread_mutex_t lock; ++} ZcPool; ++ ++typedef struct ZcPoolEnt ++{ ++ // It is important that we start with gmem as other bits of code will expect to see that ++ GPU_MEM_PTR_T gmem; ++ struct ZcPoolEnt * next; ++ struct ZcPool * pool; ++} ZcPoolEnt; ++ ++static ZcPoolEnt * zc_pool_ent_alloc(ZcPool * const pool, const int size) ++{ ++ ZcPoolEnt * const zp = av_malloc(sizeof(ZcPoolEnt)); ++ ++ if (zp == NULL) { ++ av_log(NULL, AV_LOG_ERROR, "av_malloc(ZcPoolEnt) failed\n"); ++ goto fail0; ++ } ++ ++ if (gpu_malloc_cached(size, &zp->gmem) != 0) ++ { ++ av_log(NULL, AV_LOG_ERROR, "av_gpu_malloc_cached(%d) failed\n", size); ++ goto fail1; ++ } ++ ++ zp->next = NULL; ++ zp->pool = pool; ++ return zp; ++ ++fail1: ++ av_free(zp); ++fail0: ++ return NULL; ++} ++ ++static void zc_pool_ent_free(ZcPoolEnt * const zp) ++{ ++ gpu_free(&zp->gmem); ++ av_free(zp); ++} ++ ++static void zc_pool_flush(ZcPool * const pool) ++{ ++ ZcPoolEnt * p = pool->head; ++ pool->head = NULL; ++ while (p != NULL) ++ { ++ ZcPoolEnt * const zp = p; ++ p = p->next; ++ zc_pool_ent_free(zp); ++ } ++} ++ ++static ZcPoolEnt * zc_pool_alloc(ZcPool * const pool, const int numbytes) ++{ ++ ZcPoolEnt * zp; ++ pthread_mutex_lock(&pool->lock); ++ ++ if (numbytes != pool->numbytes) ++ { ++ zc_pool_flush(pool); ++ pool->numbytes = numbytes; ++ } ++ ++ if (pool->head != NULL) ++ { ++ zp = pool->head; ++ pool->head = zp->next; ++ } ++ else ++ { ++ zp = zc_pool_ent_alloc(pool, numbytes); ++ } ++ ++ pthread_mutex_unlock(&pool->lock); ++ return zp; ++} ++ ++static void zc_pool_free(ZcPoolEnt * const zp) ++{ ++ ZcPool * const pool = zp == NULL ? NULL : zp->pool; ++ if (zp != NULL) ++ { ++ pthread_mutex_lock(&pool->lock); ++ if (pool->numbytes == zp->gmem.numbytes) ++ { ++ zp->next = pool->head; ++ pool->head = zp; ++ pthread_mutex_unlock(&pool->lock); ++ } ++ else ++ { ++ pthread_mutex_unlock(&pool->lock); ++ zc_pool_ent_free(zp); ++ } ++ } ++} ++ ++static void ++zc_pool_init(ZcPool * const pool) ++{ ++ pool->numbytes = -1; ++ pool->head = NULL; ++ pthread_mutex_init(&pool->lock, NULL); ++} ++ ++static void ++zc_pool_destroy(ZcPool * const pool) ++{ ++ pool->numbytes = -1; ++ zc_pool_flush(pool); ++ pthread_mutex_destroy(&pool->lock); ++} ++ ++ ++typedef struct AVZcEnv ++{ ++ ZcPool pool; ++} ZcEnv; ++ ++// Callback when buffer unrefed to zero ++static void rpi_free_display_buffer(void *opaque, uint8_t *data) ++{ ++ ZcPoolEnt *const zp = opaque; ++// printf("%s: data=%p\n", __func__, data); ++ zc_pool_free(zp); ++} ++ ++static inline GPU_MEM_PTR_T * pic_gm_ptr(AVBufferRef * const buf) ++{ ++ // Kludge where we check the free fn to check this is really ++ // one of our buffers - can't think of a better way ++ return buf == NULL || buf->buffer->free != rpi_free_display_buffer ? NULL : ++ av_buffer_get_opaque(buf); ++} ++ ++AVRpiZcFrameGeometry av_rpi_zc_frame_geometry( ++ const unsigned int video_width, const unsigned int video_height) ++{ ++ AVRpiZcFrameGeometry geo; ++ geo.stride_y = (video_width + 32 + 31) & ~31; ++ geo.stride_c = geo.stride_y / 2; ++// geo.height_y = (video_height + 15) & ~15; ++ geo.height_y = (video_height + 32 + 31) & ~31; ++ geo.height_c = geo.height_y / 2; ++ return geo; ++} ++ ++static AVBufferRef * rpi_buf_pool_alloc(ZcPool * const pool, int size) ++{ ++ ZcPoolEnt *const zp = zc_pool_alloc(pool, size); ++ AVBufferRef * buf; ++ ++ if (zp == NULL) { ++ av_log(NULL, AV_LOG_ERROR, "zc_pool_alloc(%d) failed\n", size); ++ goto fail0; ++ } ++ ++ if ((buf = av_buffer_create(zp->gmem.arm, size, rpi_free_display_buffer, zp, AV_BUFFER_FLAG_READONLY)) == NULL) ++ { ++ av_log(NULL, AV_LOG_ERROR, "av_buffer_create() failed\n"); ++ goto fail2; ++ } ++ ++ return buf; ++ ++fail2: ++ zc_pool_free(zp); ++fail0: ++ return NULL; ++} ++ ++static int rpi_get_display_buffer(struct AVCodecContext * const s, AVFrame * const frame) ++{ ++ ZcEnv *const zc = s->get_buffer_context; ++ const AVRpiZcFrameGeometry geo = av_rpi_zc_frame_geometry(frame->width, frame->height); ++ const unsigned int size_y = geo.stride_y * geo.height_y; ++ const unsigned int size_c = geo.stride_c * geo.height_c; ++ const unsigned int size_pic = size_y + size_c * 2; ++ AVBufferRef * buf; ++ unsigned int i; ++ ++// printf("Do local alloc: format=%#x, %dx%d: %u\n", frame->format, frame->width, frame->height, size_pic); ++ ++ if ((buf = rpi_buf_pool_alloc(&zc->pool, size_pic)) == NULL) ++ { ++ av_log(s, AV_LOG_ERROR, "rpi_get_display_buffer: Failed to get buffer from pool\n"); ++ return AVERROR(ENOMEM); ++ } ++ ++ for (i = 0; i < AV_NUM_DATA_POINTERS; i++) { ++ frame->buf[i] = NULL; ++ frame->data[i] = NULL; ++ frame->linesize[i] = 0; ++ } ++ ++ frame->buf[0] = buf; ++ frame->linesize[0] = geo.stride_y; ++ frame->linesize[1] = geo.stride_c; ++ frame->linesize[2] = geo.stride_c; ++ frame->data[0] = buf->data; ++ frame->data[1] = frame->data[0] + size_y; ++ frame->data[2] = frame->data[1] + size_c; ++ frame->extended_data = frame->data; ++ // Leave extended buf alone ++ ++ return 0; ++} ++ ++ ++#define RPI_GET_BUFFER2 1 ++ ++int av_rpi_zc_get_buffer2(struct AVCodecContext *s, AVFrame *frame, int flags) ++{ ++#if !RPI_GET_BUFFER2 ++ return avcodec_default_get_buffer2(s, frame, flags); ++#else ++ int rv; ++ ++ if ((s->codec->capabilities & AV_CODEC_CAP_DR1) == 0 || ++ frame->format != AV_PIX_FMT_YUV420P) ++ { ++// printf("Do default alloc: format=%#x\n", frame->format); ++ rv = avcodec_default_get_buffer2(s, frame, flags); ++ } ++ else ++ { ++ rv = rpi_get_display_buffer(s, frame); ++ } ++ ++#if 0 ++ printf("%s: %dx%d lsize=%d/%d/%d data=%p/%p/%p bref=%p/%p/%p opaque[0]=%p\n", __func__, ++ frame->width, frame->height, ++ frame->linesize[0], frame->linesize[1], frame->linesize[2], ++ frame->data[0], frame->data[1], frame->data[2], ++ frame->buf[0], frame->buf[1], frame->buf[2], ++ av_buffer_get_opaque(frame->buf[0])); ++#endif ++ return rv; ++#endif ++} ++ ++ ++static AVBufferRef * zc_copy(struct AVCodecContext * const s, ++ const AVFrame * const src) ++{ ++ AVFrame dest_frame; ++ AVFrame * const dest = &dest_frame; ++ unsigned int i; ++ uint8_t * psrc, * pdest; ++ ++ dest->width = src->width; ++ dest->height = src->height; ++ ++ if (rpi_get_display_buffer(s, dest) != 0) ++ { ++ return NULL; ++ } ++ ++ for (i = 0, psrc = src->data[0], pdest = dest->data[0]; ++ i != dest->height; ++ ++i, psrc += src->linesize[0], pdest += dest->linesize[0]) ++ { ++ memcpy(pdest, psrc, dest->width); ++ } ++ for (i = 0, psrc = src->data[1], pdest = dest->data[1]; ++ i != dest->height / 2; ++ ++i, psrc += src->linesize[1], pdest += dest->linesize[1]) ++ { ++ memcpy(pdest, psrc, dest->width / 2); ++ } ++ for (i = 0, psrc = src->data[2], pdest = dest->data[2]; ++ i != dest->height / 2; ++ ++i, psrc += src->linesize[2], pdest += dest->linesize[2]) ++ { ++ memcpy(pdest, psrc, dest->width / 2); ++ } ++ ++ return dest->buf[0]; ++} ++ ++ ++AVRpiZcRefPtr av_rpi_zc_ref(struct AVCodecContext * const s, ++ const AVFrame * const frame, const int maycopy) ++{ ++ assert(s != NULL); ++ ++ if (frame->format != AV_PIX_FMT_YUV420P) ++ { ++ av_log(s, AV_LOG_WARNING, "%s: *** Format not YUV420P: %d\n", __func__, frame->format); ++ return NULL; ++ } ++ ++ if (frame->buf[1] != NULL) ++ { ++ if (maycopy) ++ { ++ av_log(s, AV_LOG_INFO, "%s: *** Not a single buf frame: copying\n", __func__); ++ return zc_copy(s, frame); ++ } ++ else ++ { ++ av_log(s, AV_LOG_WARNING, "%s: *** Not a single buf frame: NULL\n", __func__); ++ return NULL; ++ } ++ } ++ ++ if (pic_gm_ptr(frame->buf[0]) == NULL) ++ { ++ if (maycopy) ++ { ++ av_log(s, AV_LOG_INFO, "%s: *** Not one of our buffers: copying\n", __func__); ++ return zc_copy(s, frame); ++ } ++ else ++ { ++ av_log(s, AV_LOG_WARNING, "%s: *** Not one of our buffers: NULL\n", __func__); ++ return NULL; ++ } ++ } ++ ++ return av_buffer_ref(frame->buf[0]); ++} ++ ++int av_rpi_zc_vc_handle(const AVRpiZcRefPtr fr_ref) ++{ ++ const GPU_MEM_PTR_T * const p = pic_gm_ptr(fr_ref); ++ return p == NULL ? -1 : p->vc_handle; ++} ++ ++int av_rpi_zc_numbytes(const AVRpiZcRefPtr fr_ref) ++{ ++ const GPU_MEM_PTR_T * const p = pic_gm_ptr(fr_ref); ++ return p == NULL ? 0 : p->numbytes; ++} ++ ++void av_rpi_zc_unref(AVRpiZcRefPtr fr_ref) ++{ ++ if (fr_ref != NULL) ++ { ++ av_buffer_unref(&fr_ref); ++ } ++} ++ ++AVZcEnvPtr av_rpi_zc_env_alloc(void) ++{ ++ ZcEnv * const zc = av_mallocz(sizeof(ZcEnv)); ++ if (zc == NULL) ++ { ++ av_log(NULL, AV_LOG_ERROR, "av_rpi_zc_env_alloc: Context allocation failed\n"); ++ return NULL; ++ } ++ ++ zc_pool_init(&zc->pool); ++ return zc; ++} ++ ++void av_rpi_zc_env_free(AVZcEnvPtr zc) ++{ ++ if (zc != NULL) ++ { ++ zc_pool_destroy(&zc->pool); ; ++ av_free(zc); ++ } ++} ++ ++int av_rpi_zc_init(struct AVCodecContext * const s) ++{ ++ ZcEnv * const zc = av_rpi_zc_env_alloc(); ++ if (zc == NULL) ++ { ++ return AVERROR(ENOMEM); ++ } ++ ++ s->get_buffer_context = zc; ++ s->get_buffer2 = av_rpi_zc_get_buffer2; ++ return 0; ++} ++ ++void av_rpi_zc_uninit(struct AVCodecContext * const s) ++{ ++ if (s->get_buffer2 == av_rpi_zc_get_buffer2) ++ { ++ ZcEnv * const zc = s->get_buffer_context; ++ s->get_buffer2 = avcodec_default_get_buffer2; ++ s->get_buffer_context = NULL; ++ av_rpi_zc_env_free(zc); ++ } ++} ++ ++#endif // RPI ++ +diff --git a/libavcodec/rpi_zc.h b/libavcodec/rpi_zc.h +new file mode 100644 +index 0000000..f0109f4 +--- /dev/null ++++ b/libavcodec/rpi_zc.h +@@ -0,0 +1,83 @@ ++#ifndef LIBAVCODEC_RPI_ZC_H ++#define LIBAVCODEC_RPI_ZC_H ++ ++// Zero-Copy frame code for RPi ++// RPi needs Y/U/V planes to be contiguous for display. By default ++// ffmpeg will allocate separated planes so a memcpy is needed before ++// display. This code prodes a method a making ffmpeg allocate a single ++// bit of memory for the frame when can then be refrence counted until ++// display ahs finsihed with it. ++ ++#include "libavutil/frame.h" ++#include "libavcodec/avcodec.h" ++ ++// "Opaque" pointer to whatever we are using as a buffer reference ++typedef AVBufferRef * AVRpiZcRefPtr; ++ ++struct AVZcEnv; ++typedef struct AVZcEnv * AVZcEnvPtr; ++ ++typedef struct AVRpiZcFrameGeometry ++{ ++ unsigned int stride_y; ++ unsigned int height_y; ++ unsigned int stride_c; ++ unsigned int height_c; ++} AVRpiZcFrameGeometry; ++ ++ ++AVRpiZcFrameGeometry av_rpi_zc_frame_geometry( ++ const unsigned int video_width, const unsigned int video_height); ++ ++// Replacement fn for avctx->get_buffer2 ++// Should be set before calling avcodec_decode_open2 ++// ++// N.B. in addition to to setting avctx->get_buffer2, avctx->refcounted_frames ++// must be set to 1 as otherwise the buffer info is killed before being returned ++// by avcodec_decode_video2. Note also that this means that the AVFrame that is ++// return must be manually derefed with av_frame_unref. This should be done ++// after av_rpi_zc_ref has been called. ++int av_rpi_zc_get_buffer2(struct AVCodecContext *s, AVFrame *frame, int flags); ++ ++// Generate a ZC reference to the buffer(s) in this frame ++// If the buffer doesn't appear to be one allocated by _get_buffer_2 ++// then the behaviour depends on maycopy: ++// If maycopy=0 then return NULL ++// If maycopy=1 && the src frame is in a form where we can easily copy ++// the data, then allocate a new buffer and copy the data into it ++// Otherwise return NULL ++AVRpiZcRefPtr av_rpi_zc_ref(struct AVCodecContext * const s, ++ const AVFrame * const frame, const int maycopy); ++ ++// Get the vc_handle from the frame ref ++// Returns -1 if ref doesn't look valid ++int av_rpi_zc_vc_handle(const AVRpiZcRefPtr fr_ref); ++// Get the number of bytes allocated from the frame ref ++// Returns 0 if ref doesn't look valid ++int av_rpi_zc_numbytes(const AVRpiZcRefPtr fr_ref); ++ ++// Unreference the buffer refed/allocated by _zc_ref ++// If fr_ref is NULL then this will NOP ++void av_rpi_zc_unref(AVRpiZcRefPtr fr_ref); ++ ++// Allocate an environment for the buffer pool used by the ZC code ++// This should be put in avctx->get_buffer_context so it can be found by ++// av_rpi_zc_get_buffer2 when it is called from ffmpeg ++AVZcEnvPtr av_rpi_zc_env_alloc(void); ++ ++// Allocate the environment used by the ZC code ++void av_rpi_zc_env_free(AVZcEnvPtr); ++ ++ ++// Init ZC into a context ++// There is nothing magic in this fn - it just packages setting ++// get_buffer2 & get_buffer_context ++int av_rpi_zc_init(struct AVCodecContext * const s); ++ ++// Free ZC from a context ++// There is nothing magic in this fn - it just packages unsetting ++// get_buffer2 & get_buffer_context ++void av_rpi_zc_uninit(struct AVCodecContext * const s); ++ ++#endif ++ +-- +2.5.0 + + +From 4d8bccc7b9a611a54253c26dd55fbffbf9db4c48 Mon Sep 17 00:00:00 2001 +From: John Cox <jc@kynesim.co.uk> +Date: Tue, 1 Mar 2016 14:21:25 +0000 +Subject: [PATCH 2/2] Set VPU scheduling thread to high priority after creation + +--- + libavcodec/rpi_qpu.c | 48 +++++++++++++++++++++++++++++++++++++++++++++++- + 1 file changed, 47 insertions(+), 1 deletion(-) + +diff --git a/libavcodec/rpi_qpu.c b/libavcodec/rpi_qpu.c +index b0c9bc5..ee19231 100644 +--- a/libavcodec/rpi_qpu.c ++++ b/libavcodec/rpi_qpu.c +@@ -182,9 +182,55 @@ static int gpu_init(volatile struct GPU **gpu) { + err = pthread_create(&vpu_thread, NULL, vpu_start, NULL); + //printf("Created thread\n"); + if (err) { +- printf("Failed to create vpu thread\n"); ++ av_log(NULL, AV_LOG_FATAL, "Failed to create vpu thread\n"); + return -4; + } ++ ++ { ++ struct sched_param param = {0}; ++ int policy = 0; ++ ++ if (pthread_getschedparam(vpu_thread, &policy, &param) != 0) ++ { ++ av_log(NULL, AV_LOG_ERROR, "Unable to get VPU thread scheduling parameters\n"); ++ } ++ else ++ { ++ av_log(NULL, AV_LOG_INFO, "VPU thread: policy=%d (%s), pri=%d\n", ++ policy, ++ policy == SCHED_RR ? "RR" : policy == SCHED_FIFO ? "FIFO" : "???" , ++ param.sched_priority); ++ ++ policy = SCHED_FIFO; ++ param.sched_priority = sched_get_priority_max(SCHED_FIFO); ++ ++ av_log(NULL, AV_LOG_INFO, "Attempt to set: policy=%d (%s), pri=%d\n", ++ policy, ++ policy == SCHED_RR ? "RR" : policy == SCHED_FIFO ? "FIFO" : "???" , ++ param.sched_priority); ++ ++ if (pthread_setschedparam(vpu_thread, policy, &param) != 0) ++ { ++ av_log(NULL, AV_LOG_ERROR, "Unable to set VPU thread scheduling parameters\n"); ++ } ++ else ++ { ++ if (pthread_getschedparam(vpu_thread, &policy, &param) != 0) ++ { ++ av_log(NULL, AV_LOG_ERROR, "Unable to get VPU thread scheduling parameters\n"); ++ } ++ else ++ { ++ av_log(NULL, AV_LOG_INFO, "VPU thread (after): policy=%d (%s), pri=%d\n", ++ policy, ++ policy == SCHED_RR ? "RR" : policy == SCHED_FIFO ? "FIFO" : "???" , ++ param.sched_priority); ++ } ++ } ++ } ++ ++ } ++ + } + #endif + +-- +2.5.0 + + diff --git a/packages/multimedia/ffmpeg/patches/ffmpeg-99.1004-0001-Squashed-commit-of-the-following.patch b/packages/multimedia/ffmpeg/patches/ffmpeg-99.1004-0001-Squashed-commit-of-the-following.patch new file mode 100644 index 00000000000..5b2f81c1fcf --- /dev/null +++ b/packages/multimedia/ffmpeg/patches/ffmpeg-99.1004-0001-Squashed-commit-of-the-following.patch @@ -0,0 +1,2181 @@ +From ccb1eff2e6dd1259c6a8ca262076553875c5abe2 Mon Sep 17 00:00:00 2001 +From: John Cox <jc@kynesim.co.uk> +Date: Wed, 13 Jan 2016 16:13:33 +0000 +Subject: [PATCH] H.265 residual decode rework (v2) + +Rework the cabac decode functions +Simplify the code flow and variable usage where possible + +(Remove profiling and other spurious deltas that were in v1) +--- + libavcodec/arm/cabac.h | 155 ++++- + libavcodec/arm/hevc_cabac.h | 491 +++++++++++++++ + libavcodec/arm/hevcdsp_deblock_neon.S | 13 +- + libavcodec/arm/hevcdsp_epel_neon.S | 9 +- + libavcodec/cabac.h | 9 +- + libavcodec/hevc_cabac.c | 1098 +++++++++++++++++++++++++-------- + 6 files changed, 1510 insertions(+), 265 deletions(-) + create mode 100644 libavcodec/arm/hevc_cabac.h + +diff --git a/libavcodec/arm/cabac.h b/libavcodec/arm/cabac.h +index fdbf86b..0a3980a 100644 +--- a/libavcodec/arm/cabac.h ++++ b/libavcodec/arm/cabac.h +@@ -26,13 +26,34 @@ + #include "libavutil/internal.h" + #include "libavcodec/cabac.h" + ++ ++#if UNCHECKED_BITSTREAM_READER ++#define LOAD_16BITS_BEHI\ ++ "ldrh %[tmp] , [%[ptr]] , #2 \n\t"\ ++ "rev %[tmp] , %[tmp] \n\t" ++#elif CONFIG_THUMB ++#define LOAD_16BITS_BEHI\ ++ "ldr %[tmp] , [%[c], %[end]] \n\t"\ ++ "cmp %[tmp] , %[ptr] \n\t"\ ++ "it cs \n\t"\ ++ "ldrhcs %[tmp] , [%[ptr]] , #2 \n\t"\ ++ "rev %[tmp] , %[tmp] \n\t" ++#else ++#define LOAD_16BITS_BEHI\ ++ "ldr %[tmp] , [%[c], %[end]] \n\t"\ ++ "cmp %[tmp] , %[ptr] \n\t"\ ++ "ldrcsh %[tmp] , [%[ptr]] , #2 \n\t"\ ++ "rev %[tmp] , %[tmp] \n\t" ++#endif ++ ++ + #define get_cabac_inline get_cabac_inline_arm + static av_always_inline int get_cabac_inline_arm(CABACContext *c, + uint8_t *const state) + { + int bit; ++#if 0 + void *reg_b, *reg_c, *tmp; +- + __asm__ volatile( + "ldrb %[bit] , [%[state]] \n\t" + "add %[r_b] , %[tables] , %[lps_off] \n\t" +@@ -100,9 +121,141 @@ static av_always_inline int get_cabac_inline_arm(CABACContext *c, + [mlps_off]"I"(H264_MLPS_STATE_OFFSET + 128) + : "memory", "cc" + ); ++#else ++ // *** Not thumb compatible yet ++ unsigned int reg_b, tmp; ++ __asm__ ( ++ "ldrb %[bit] , [%[state]] \n\t" ++ "sub %[r_b] , %[mlps_tables], %[lps_off] \n\t" ++ "and %[tmp] , %[range] , #0xC0 \n\t" ++ "add %[r_b] , %[r_b] , %[bit] \n\t" ++ "ldrb %[tmp] , [%[r_b] , %[tmp], lsl #1] \n\t" ++// %bit = *state ++// %range = range ++// %tmp = RangeLPS ++ "sub %[range] , %[range] , %[tmp] \n\t" ++ ++ "cmp %[low] , %[range] , lsl #17 \n\t" ++ "ittt ge \n\t" ++ "subge %[low] , %[low] , %[range], lsl #17 \n\t" ++ "mvnge %[bit] , %[bit] \n\t" ++ "movge %[range] , %[tmp] \n\t" ++ ++ "clz %[tmp] , %[range] \n\t" ++ "sub %[tmp] , #23 \n\t" ++ ++ "ldrb %[r_b] , [%[mlps_tables], %[bit]] \n\t" ++ "lsl %[low] , %[low] , %[tmp] \n\t" ++ "lsl %[range] , %[range] , %[tmp] \n\t" ++ ++ "strb %[r_b] , [%[state]] \n\t" ++ "lsls %[tmp] , %[low] , #16 \n\t" ++ ++ "bne 2f \n\t" ++ LOAD_16BITS_BEHI ++ "lsr %[tmp] , %[tmp] , #15 \n\t" ++ "movw %[r_b] , #0xFFFF \n\t" ++ "sub %[tmp] , %[tmp] , %[r_b] \n\t" ++ ++ "rbit %[r_b] , %[low] \n\t" ++ "clz %[r_b] , %[r_b] \n\t" ++ "sub %[r_b] , %[r_b] , #16 \n\t" ++#if CONFIG_THUMB ++ "lsl %[tmp] , %[tmp] , %[r_b] \n\t" ++ "add %[low] , %[low] , %[tmp] \n\t" ++#else ++ "add %[low] , %[low] , %[tmp], lsl %[r_b] \n\t" ++#endif ++ "2: \n\t" ++ : [bit]"=&r"(bit), ++ [low]"+&r"(c->low), ++ [range]"+&r"(c->range), ++ [r_b]"=&r"(reg_b), ++ [ptr]"+&r"(c->bytestream), ++ [tmp]"=&r"(tmp) ++ : [state]"r"(state), ++ [mlps_tables]"r"(ff_h264_cabac_tables + H264_MLPS_STATE_OFFSET + 128), ++ [byte]"M"(offsetof(CABACContext, bytestream)), ++#if !UNCHECKED_BITSTREAM_READER ++ [c]"r"(c), ++ [end]"M"(offsetof(CABACContext, bytestream_end)), ++#endif ++ [lps_off]"I"((H264_MLPS_STATE_OFFSET + 128) - H264_LPS_RANGE_OFFSET) ++ : "memory", "cc" ++ ); ++#endif + + return bit & 1; + } ++ ++#define get_cabac_bypass get_cabac_bypass_arm ++static inline int get_cabac_bypass_arm(CABACContext * const c) ++{ ++ int rv = 0; ++ unsigned int tmp; ++ __asm ( ++ "lsl %[low] , #1 \n\t" ++ "cmp %[low] , %[range] , lsl #17 \n\t" ++ "adc %[rv] , %[rv] , #0 \n\t" ++ "it cs \n\t" ++ "subcs %[low] , %[low] , %[range], lsl #17 \n\t" ++ "lsls %[tmp] , %[low] , #16 \n\t" ++ "bne 1f \n\t" ++ LOAD_16BITS_BEHI ++ "add %[low] , %[low] , %[tmp], lsr #15 \n\t" ++ "movw %[tmp] , #0xFFFF \n\t" ++ "sub %[low] , %[low] , %[tmp] \n\t" ++ "1: \n\t" ++ : // Outputs ++ [rv]"+&r"(rv), ++ [low]"+&r"(c->low), ++ [tmp]"=&r"(tmp), ++ [ptr]"+&r"(c->bytestream) ++ : // Inputs ++#if !UNCHECKED_BITSTREAM_READER ++ [c]"r"(c), ++ [end]"M"(offsetof(CABACContext, bytestream_end)), ++#endif ++ [range]"r"(c->range) ++ : "cc" ++ ); ++ return rv; ++} ++ ++ ++#define get_cabac_bypass_sign get_cabac_bypass_sign_arm ++static inline int get_cabac_bypass_sign_arm(CABACContext * const c, int rv) ++{ ++ unsigned int tmp; ++ __asm ( ++ "lsl %[low] , #1 \n\t" ++ "cmp %[low] , %[range] , lsl #17 \n\t" ++ "ite cc \n\t" ++ "rsbcc %[rv] , %[rv] , #0 \n\t" ++ "subcs %[low] , %[low] , %[range], lsl #17 \n\t" ++ "lsls %[tmp] , %[low] , #16 \n\t" ++ "bne 1f \n\t" ++ LOAD_16BITS_BEHI ++ "add %[low] , %[low] , %[tmp], lsr #15 \n\t" ++ "movw %[tmp] , #0xFFFF \n\t" ++ "sub %[low] , %[low] , %[tmp] \n\t" ++ "1: \n\t" ++ : // Outputs ++ [rv]"+&r"(rv), ++ [low]"+&r"(c->low), ++ [tmp]"=&r"(tmp), ++ [ptr]"+&r"(c->bytestream) ++ : // Inputs ++#if !UNCHECKED_BITSTREAM_READER ++ [c]"r"(c), ++ [end]"M"(offsetof(CABACContext, bytestream_end)), ++#endif ++ [range]"r"(c->range) ++ : "cc" ++ ); ++ return rv; ++} ++ + #endif /* HAVE_ARMV6T2_INLINE */ + + #endif /* AVCODEC_ARM_CABAC_H */ +diff --git a/libavcodec/arm/hevc_cabac.h b/libavcodec/arm/hevc_cabac.h +new file mode 100644 +index 0000000..31d3c59 +--- /dev/null ++++ b/libavcodec/arm/hevc_cabac.h +@@ -0,0 +1,491 @@ ++/* ++ * This file is part of FFmpeg. ++ * ++ * FFmpeg is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * FFmpeg is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FFmpeg; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ */ ++ ++#ifndef AVCODEC_ARM_HEVC_CABAC_H ++#define AVCODEC_ARM_HEVC_CABAC_H ++ ++#include "config.h" ++#if HAVE_ARMV6T2_INLINE ++ ++#define hevc_mem_bits32 hevc_mem_bits32_arm ++static inline uint32_t hevc_mem_bits32_arm(const void * p, const unsigned int bits) ++{ ++ unsigned int n; ++ __asm__ ( ++ "rev %[n], %[x] \n\t" ++ : [n]"=r"(n) ++ : [x]"r"(*(const uint32_t *)((const uint8_t *)p + (bits >> 3))) ++ : ++ ); ++ return n << (bits & 7); ++} ++ ++ ++// --------------------------------------------------------------------------- ++// ++// Helper fns - little bits of code where ARM has an instraction that the ++// compiler doesn't know about / use ++ ++#define trans_scale_sat trans_scale_sat_arm ++static inline int trans_scale_sat_arm(const int level, const unsigned int scale, const unsigned int scale_m, const unsigned int shift) ++{ ++ int rv; ++ int t = ((level * (int)(scale * scale_m)) >> shift) + 1; ++ ++ __asm__ ( ++ "ssat %[rv], #16, %[t], ASR #1 \n\t" ++ : [rv]"=r"(rv) ++ : [t]"r"(t) ++ : ++ ); ++ return rv; ++} ++ ++#define update_rice update_rice_arm ++static inline void update_rice_arm(uint8_t * const stat_coeff, ++ const unsigned int last_coeff_abs_level_remaining, ++ const unsigned int c_rice_param) ++{ ++ int t; ++ __asm__ ( ++ "lsl %[t], %[coeff], #1 \n\t" ++ "lsrs %[t], %[t], %[shift] \n\t" ++ "it eq \n\t" ++ "subeq %[stat], %[stat], #1 \n\t" ++ "cmp %[t], #6 \n\t" ++ "adc %[stat], %[stat], #0 \n\t" ++ "usat %[stat], #8, %[stat] \n\t" ++ : [stat]"+&r"(*stat_coeff), ++ [t]"=&r"(t) ++ : [coeff]"r"(last_coeff_abs_level_remaining), ++ [shift]"r"(c_rice_param) ++ : "cc" ++ ); ++} ++ ++// --------------------------------------------------------------------------- ++// ++// CABAC get loops ++// ++// Where the loop is simple enough we can normally do 10-30% better than the ++// compiler ++ ++// Get the residual greater than 1 bits ++ ++#define get_cabac_greater1_bits get_cabac_greater1_bits_arm ++static inline unsigned int get_cabac_greater1_bits_arm(CABACContext * const c, const unsigned int n, ++ uint8_t * const state0) ++{ ++ unsigned int i, reg_b, st, tmp, bit, rv; ++ __asm__ ( ++ "mov %[i] , #0 \n\t" ++ "mov %[rv] , #0 \n\t" ++ "1: \n\t" ++ "add %[i] , %[i] , #1 \n\t" ++ "cmp %[rv] , #0 \n\t" ++ "ite eq \n\t" ++ "usateq %[st] , #2 , %[i] \n\t" ++ "movne %[st] , #0 \n\t" ++ ++ "ldrb %[bit] , [%[state0], %[st]] \n\t" ++ "sub %[r_b] , %[mlps_tables], %[lps_off] \n\t" ++ "and %[tmp] , %[range] , #0xC0 \n\t" ++ "add %[r_b] , %[r_b] , %[bit] \n\t" ++ "ldrb %[tmp] , [%[r_b], %[tmp], lsl #1] \n\t" ++ "sub %[range] , %[range] , %[tmp] \n\t" ++ ++ "cmp %[low] , %[range], lsl #17 \n\t" ++ "ittt ge \n\t" ++ "subge %[low] , %[low] , %[range], lsl #17 \n\t" ++ "mvnge %[bit] , %[bit] \n\t" ++ "movge %[range] , %[tmp] \n\t" ++ ++ "ldrb %[r_b] , [%[mlps_tables], %[bit]] \n\t" ++ "and %[bit] , %[bit] , #1 \n\t" ++ "orr %[rv] , %[bit] , %[rv], lsl #1 \n\t" ++ ++ "clz %[tmp] , %[range] \n\t" ++ "sub %[tmp] , #23 \n\t" ++ ++ "lsl %[low] , %[low] , %[tmp] \n\t" ++ "lsl %[range] , %[range] , %[tmp] \n\t" ++ ++ "strb %[r_b] , [%[state0], %[st]] \n\t" ++// There is a small speed gain from combining both conditions, using a single ++// branch and then working out what that meant later ++ "lsls %[tmp] , %[low] , #16 \n\t" ++ "it ne \n\t" ++ "cmpne %[n] , %[i] \n\t" ++ "bne 1b \n\t" ++ ++// If reload is not required then we must have run out of flags to decode ++ "tst %[tmp] , %[tmp] \n\t" ++ "bne 2f \n\t" ++ ++// Do reload ++ "ldrh %[tmp] , [%[bptr]] , #2 \n\t" ++ "movw %[r_b] , #0xFFFF \n\t" ++ "rev %[tmp] , %[tmp] \n\t" ++ "rsb %[tmp] , %[r_b] , %[tmp], lsr #15 \n\t" ++ ++ "rbit %[r_b] , %[low] \n\t" ++ "clz %[r_b] , %[r_b] \n\t" ++ "sub %[r_b] , %[r_b] , #16 \n\t" ++ ++#if CONFIG_THUMB ++ "lsl %[tmp] , %[tmp] , %[r_b] \n\t" ++ "add %[low] , %[low] , %[tmp] \n\t" ++#else ++ "add %[low] , %[low] , %[tmp], lsl %[r_b] \n\t" ++#endif ++ ++ "cmp %[n] , %[i] \n\t" ++ "bne 1b \n\t" ++ "2: \n\t" ++ : [bit]"=&r"(bit), ++ [low]"+&r"(c->low), ++ [range]"+&r"(c->range), ++ [r_b]"=&r"(reg_b), ++ [bptr]"+&r"(c->bytestream), ++ [i]"=&r"(i), ++ [tmp]"=&r"(tmp), ++ [st]"=&r"(st), ++ [rv]"=&r"(rv) ++ : [state0]"r"(state0), ++ [n]"r"(n), ++ [mlps_tables]"r"(ff_h264_cabac_tables + H264_MLPS_STATE_OFFSET + 128), ++ [byte]"M"(offsetof(CABACContext, bytestream)), ++ [lps_off]"I"((H264_MLPS_STATE_OFFSET + 128) - H264_LPS_RANGE_OFFSET) ++ : "memory", "cc" ++ ); ++ return rv; ++} ++ ++ ++// n must be > 0 on entry ++#define get_cabac_sig_coeff_flag_idxs get_cabac_sig_coeff_flag_idxs_arm ++static inline uint8_t * get_cabac_sig_coeff_flag_idxs_arm(CABACContext * const c, uint8_t * const state0, ++ unsigned int n, ++ const uint8_t const * ctx_map, ++ uint8_t * p) ++{ ++ unsigned int reg_b, tmp, st, bit; ++ __asm__ ( ++ "1: \n\t" ++// Get bin from map ++ "ldrb %[st] , [%[ctx_map], %[n]] \n\t" ++ ++// Load state & ranges ++ "sub %[r_b] , %[mlps_tables], %[lps_off] \n\t" ++ "ldrb %[bit] , [%[state0], %[st]] \n\t" ++ "and %[tmp] , %[range] , #0xC0 \n\t" ++ "add %[r_b] , %[r_b] , %[tmp], lsl #1 \n\t" ++ "ldrb %[tmp] , [%[r_b], %[bit]] \n\t" ++ "sub %[range] , %[range] , %[tmp] \n\t" ++ ++ "cmp %[low] , %[range], lsl #17 \n\t" ++ "ittt ge \n\t" ++ "subge %[low] , %[low] , %[range], lsl #17 \n\t" ++ "mvnge %[bit] , %[bit] \n\t" ++ "movge %[range] , %[tmp] \n\t" ++ ++ "ldrb %[r_b] , [%[mlps_tables], %[bit]] \n\t" ++ "tst %[bit] , #1 \n\t" ++// GCC asm seems to need strbne written differently for thumb and arm ++#if CONFIG_THUMB ++ "it ne \n\t" ++ "strbne %[n] , [%[idx]] , #1 \n\t" ++#else ++ "strneb %[n] , [%[idx]] , #1 \n\t" ++#endif ++ ++// Renorm ++ "clz %[tmp] , %[range] \n\t" ++ "sub %[tmp] , #23 \n\t" ++ "lsl %[low] , %[low] , %[tmp] \n\t" ++ "lsl %[range] , %[range] , %[tmp] \n\t" ++ ++ "strb %[r_b] , [%[state0], %[st]] \n\t" ++// There is a small speed gain from combining both conditions, using a single ++// branch and then working out what that meant later ++ "subs %[n] , %[n] , #1 \n\t" ++#if CONFIG_THUMB ++ "itt ne \n\t" ++ "lslsne %[tmp] , %[low] , #16 \n\t" ++ "bne 1b \n\t" ++#else ++ "lslnes %[tmp] , %[low] , #16 \n\t" ++ "bne 1b \n\t" ++#endif ++ ++// If we have bits left then n must be 0 so give up now ++ "lsls %[tmp] , %[low] , #16 \n\t" ++ "bne 2f \n\t" ++ ++// Do reload ++ "ldrh %[tmp] , [%[bptr]] , #2 \n\t" ++ "movw %[r_b] , #0xFFFF \n\t" ++ "rev %[tmp] , %[tmp] \n\t" ++ "rsb %[tmp] , %[r_b] , %[tmp], lsr #15 \n\t" ++ ++ "rbit %[r_b] , %[low] \n\t" ++ "clz %[r_b] , %[r_b] \n\t" ++ "sub %[r_b] , %[r_b] , #16 \n\t" ++ ++#if CONFIG_THUMB ++ "lsl %[tmp] , %[tmp] , %[r_b] \n\t" ++ "add %[low] , %[low] , %[tmp] \n\t" ++#else ++ "add %[low] , %[low] , %[tmp], lsl %[r_b] \n\t" ++#endif ++ ++// Check to see if we still have more to do ++ "cmp %[n] , #0 \n\t" ++ "bne 1b \n\t" ++ "2: \n\t" ++ : [bit]"=&r"(bit), ++ [low]"+&r"(c->low), ++ [range]"+&r"(c->range), ++ [r_b]"=&r"(reg_b), ++ [bptr]"+&r"(c->bytestream), ++ [idx]"+&r"(p), ++ [n]"+&r"(n), ++ [tmp]"=&r"(tmp), ++ [st]"=&r"(st) ++ : [state0]"r"(state0), ++ [ctx_map]"r"(ctx_map), ++ [mlps_tables]"r"(ff_h264_cabac_tables + H264_MLPS_STATE_OFFSET + 128), ++ [byte]"M"(offsetof(CABACContext, bytestream)), ++ [lps_off]"I"((H264_MLPS_STATE_OFFSET + 128) - H264_LPS_RANGE_OFFSET) ++ : "memory", "cc" ++ ); ++ ++ return p; ++} ++ ++// --------------------------------------------------------------------------- ++// ++// CABAC_BY22 functions ++// ++// By and large these are (at best) no faster than their C equivalents - the ++// only one worth having is _peek where we do a slightly better job than the ++// compiler ++// ++// The others have been stashed here for reference in case larger scale asm ++// is attempted in which case they might be a useful base ++ ++ ++#define get_cabac_by22_peek get_cabac_by22_peek_arm ++static inline uint32_t get_cabac_by22_peek_arm(const CABACContext *const c) ++{ ++ uint32_t rv, tmp; ++ __asm__ ( ++ "bic %[rv] , %[low], #1 \n\t" ++ "cmp %[inv] , #0 \n\t" ++ "it ne \n\t" ++ "umullne %[tmp] , %[rv] , %[inv], %[rv] \n\t" ++ : // Outputs ++ [rv]"=&r"(rv), ++ [tmp]"=r"(tmp) ++ : // Inputs ++ [low]"r"(c->low), ++ [inv]"r"(c->range) ++ : // Clobbers ++ "cc" ++ ); ++ return rv << 1; ++} ++ ++#if 0 ++ ++// ***** Slower than the C :-( ++#define get_cabac_by22_flush get_cabac_by22_flush_arm ++static inline void get_cabac_by22_flush_arm(CABACContext *const c, const unsigned int n, const uint32_t val) ++{ ++ uint32_t m, tmp; ++ __asm__ ( ++ "add %[bits], %[bits], %[n] \n\t" ++ "ldr %[m], [%[ptr], %[bits], lsr #3] \n\t" ++ ++ "rsb %[tmp], %[n], #32 \n\t" ++ "lsr %[tmp], %[val], %[tmp] \n\t" ++ "mul %[tmp], %[range], %[tmp] \n\t" ++ ++ "rev %[m], %[m] \n\t" ++ ++ "lsl %[tmp], %[tmp], #23 \n\t" ++ "rsb %[low], %[tmp], %[low], lsl %[n] \n\t" ++ ++ "and %[tmp], %[bits], #7 \n\t" ++ "lsl %[m], %[m], %[tmp] \n\t" ++ ++ "orr %[low], %[low], %[m], lsr #9 \n\t" ++ : // Outputs ++ [m]"=&r"(m), ++ [tmp]"=&r"(tmp), ++ [bits]"+&r"(c->by22.bits), ++ [low]"+&r"(c->low) ++ : // Inputs ++ [n]"r"(n), ++ [val]"r"(val), ++ [inv]"r"(c->range), ++ [range]"r"(c->by22.range), ++ [ptr]"r"(c->bytestream) ++ : // Clobbers ++ ); ++} ++ ++ ++// Works but slower than C ++#define coeff_abs_level_remaining_decode_by22(c,r) coeff_abs_level_remaining_decode_by22_arm(c, r) ++static int coeff_abs_level_remaining_decode_by22_arm(CABACContext * const c, const unsigned int c_rice_param) ++{ ++ uint32_t n, val, tmp, level; ++ ++// PROFILE_START(); ++ ++ __asm__ ( ++ // Peek ++ "bic %[val], %[low], #1 \n\t" ++ "cmp %[inv], #0 \n\t" ++ "umullne %[tmp], %[val], %[inv], %[val] \n\t" ++ "lsl %[val], %[val], #1 \n\t" ++ ++ // Count bits (n = prefix) ++ "mvn %[n], %[val] \n\t" ++ "clz %[n], %[n] \n\t" ++ ++ "lsl %[level], %[val], %[n] \n\t" ++ "subs %[tmp], %[n], #3 \n\t" ++ "blo 2f \n\t" ++ ++ // prefix >= 3 ++ // < tmp = prefix - 3 ++ // > tmp = prefix + rice - 3 ++ "add %[tmp], %[tmp], %[rice] \n\t" ++ // > n = prefix * 2 + rice - 3 ++ "add %[n], %[tmp], %[n] \n\t" ++ "cmp %[n], #21 \n\t" ++ "bhi 3f \n\t" ++ ++ "orr %[level], %[level], #0x80000000 \n\t" ++ "rsb %[tmp], %[tmp], #31 \n\t" ++ "lsr %[level], %[level], %[tmp] \n\t" ++ ++ "mov %[tmp], #2 \n\t" ++ "add %[level], %[level], %[tmp], lsl %[rice] \n\t" ++ "b 1f \n\t" ++ ++ // > 22 bits used in total - need reload ++ "3: \n\t" ++ ++ // Stash prefix + rice - 3 in level (only spare reg) ++ "mov %[level], %[tmp] \n\t" ++ // Restore n to flush value (prefix) ++ "sub %[n], %[n], %[tmp] \n\t" ++ ++ // Flush + reload ++ ++// "rsb %[tmp], %[n], #32 \n\t" ++// "lsr %[tmp], %[val], %[tmp] \n\t" ++// "mul %[tmp], %[range], %[tmp] \n\t" ++ ++ // As it happens we know that all the bits we are flushing are 1 ++ // so we can cheat slightly ++ "rsb %[tmp], %[range], %[range], lsl %[n] \n\t" ++ "lsl %[tmp], %[tmp], #23 \n\t" ++ "rsb %[low], %[tmp], %[low], lsl %[n] \n\t" ++ ++ "add %[bits], %[bits], %[n] \n\t" ++ "ldr %[n], [%[ptr], %[bits], lsr #3] \n\t" ++ "rev %[n], %[n] \n\t" ++ "and %[tmp], %[bits], #7 \n\t" ++ "lsl %[n], %[n], %[tmp] \n\t" ++ ++ "orr %[low], %[low], %[n], lsr #9 \n\t" ++ ++ // (reload) ++ ++ "bic %[val], %[low], #1 \n\t" ++ "cmp %[inv], #0 \n\t" ++ "umullne %[tmp], %[val], %[inv], %[val] \n\t" ++ "lsl %[val], %[val], #1 \n\t" ++ ++ // Build value ++ ++ "mov %[n], %[level] \n\t" ++ ++ "orr %[tmp], %[val], #0x80000000 \n\t" ++ "rsb %[level], %[level], #31 \n\t" ++ "lsr %[level], %[tmp], %[level] \n\t" ++ ++ "mov %[tmp], #2 \n\t" ++ "add %[level], %[level], %[tmp], lsl %[rice] \n\t" ++ "b 1f \n\t" ++ ++ // prefix < 3 ++ "2: \n\t" ++ "rsb %[tmp], %[rice], #31 \n\t" ++ "lsr %[level], %[level], %[tmp] \n\t" ++ "orr %[level], %[level], %[n], lsl %[rice] \n\t" ++ "add %[n], %[n], %[rice] \n\t" ++ ++ "1: \n\t" ++ // Flush ++ "add %[n], %[n], #1 \n\t" ++ ++ "rsb %[tmp], %[n], #32 \n\t" ++ "lsr %[tmp], %[val], %[tmp] \n\t" ++ ++ "add %[bits], %[bits], %[n] \n\t" ++ "ldr %[val], [%[ptr], %[bits], lsr #3] \n\t" ++ ++ "mul %[tmp], %[range], %[tmp] \n\t" ++ "lsl %[tmp], %[tmp], #23 \n\t" ++ "rsb %[low], %[tmp], %[low], lsl %[n] \n\t" ++ ++ "rev %[val], %[val] \n\t" ++ "and %[tmp], %[bits], #7 \n\t" ++ "lsl %[val], %[val], %[tmp] \n\t" ++ ++ "orr %[low], %[low], %[val], lsr #9 \n\t" ++ : // Outputs ++ [level]"=&r"(level), ++ [n]"=&r"(n), ++ [val]"=&r"(val), ++ [tmp]"=&r"(tmp), ++ [bits]"+&r"(c->by22.bits), ++ [low]"+&r"(c->low) ++ : // Inputs ++ [rice]"r"(c_rice_param), ++ [inv]"r"(c->range), ++ [range]"r"(c->by22.range), ++ [ptr]"r"(c->bytestream) ++ : // Clobbers ++ "cc" ++ ); ++ ++// PROFILE_ACC(residual_abs); ++ ++ return level; ++} ++#endif ++ ++#endif /* HAVE_ARMV6T2_INLINE */ ++ ++#endif /* AVCODEC_ARM_HEVC_CABAC_H */ +diff --git a/libavcodec/arm/hevcdsp_deblock_neon.S b/libavcodec/arm/hevcdsp_deblock_neon.S +index bad4589..a088cc3 100644 +--- a/libavcodec/arm/hevcdsp_deblock_neon.S ++++ b/libavcodec/arm/hevcdsp_deblock_neon.S +@@ -409,10 +409,12 @@ function ff_hevc_deblocking_boundary_strengths_neon, export=1 + beq 90f + + tst a3, #1 ++ itee ne + ldrne a3, [v5, #0] @ curr->mv[0] + ldreq a3, [v5, #4] @ curr->mv[1] + moveq v1, v2 + tst v8, #1 ++ itee ne + ldrne v8, [v6, #0] @ neigh->mv[0] + ldreq v8, [v6, #4] @ neigh->mv[1] + moveq v3, v4 +@@ -424,9 +426,14 @@ function ff_hevc_deblocking_boundary_strengths_neon, export=1 + sel a3, a3, ip + ands a3, a3, lr + @ drop through +-10: movne a3, #1 ++10: it ne ++ movne a3, #1 + 11: subs a2, a2, #1 +-12: strbhs a3, [v7], a4 ++12: ++A strbhs a3, [v7], a4 ++T itt hs ++T strbhs a3, [v7] ++T addhs v7, v7, a4 + subs a2, a2, #1 + bhs 12b + +@@ -442,6 +449,7 @@ function ff_hevc_deblocking_boundary_strengths_neon, export=1 + bne 10b + + teq v1, v3 ++ it eq + teqeq v2, v4 + bne 40f + teq v1, v2 +@@ -487,6 +495,7 @@ function ff_hevc_deblocking_boundary_strengths_neon, export=1 + b 10b + + 40: teq v1, v4 ++ ite eq + teqeq v2, v3 + bne 10b + +diff --git a/libavcodec/arm/hevcdsp_epel_neon.S b/libavcodec/arm/hevcdsp_epel_neon.S +index 516ae5b..00eab9e 100644 +--- a/libavcodec/arm/hevcdsp_epel_neon.S ++++ b/libavcodec/arm/hevcdsp_epel_neon.S +@@ -110,7 +110,9 @@ function ff_hevc_put_epel_h_neon_8, export=1 + sub r7, #1 + lsl r7, #2 + vpush {d8-d15} +- adrl r12, epel_coeffs ++@ adr reaches if we are in thumb mode but not in arm ++T adr r12, epel_coeffs ++A adrl r12, epel_coeffs + add r7, r12 + sub r1, #1 + lsl r4, #1 +@@ -170,7 +172,8 @@ function ff_hevc_put_epel_v_neon_8, export=1 + sub r7, #1 + lsl r7, #2 + vpush {d8-d15} +- adrl r12, epel_coeffs ++T adr r12, epel_coeffs ++A adrl r12, epel_coeffs + add r7, r12 + load_coeffs_16b r7 + sub r1, r2 +@@ -246,7 +249,7 @@ function ff_hevc_put_epel_hv_neon_8, export=1 + sub r7, #1 + lsl r7, #2 + vpush {d8-d15} +- adrl r12, epel_coeffs ++ adr r12, epel_coeffs + sub r6, #1 + lsl r6, #2 + add r6, r12 // mx epel coeff offset +diff --git a/libavcodec/cabac.h b/libavcodec/cabac.h +index 1bf1c62..ccfa991 100644 +--- a/libavcodec/cabac.h ++++ b/libavcodec/cabac.h +@@ -43,7 +43,14 @@ extern const uint8_t ff_h264_cabac_tables[512 + 4*2*64 + 4*64 + 63]; + typedef struct CABACContext{ + int low; + int range; +- int outstanding_count; ++ union ++ { ++ int outstanding_count; ++ struct { ++ uint16_t bits; ++ uint16_t range; ++ } by22; ++ }; + const uint8_t *bytestream_start; + const uint8_t *bytestream; + const uint8_t *bytestream_end; +diff --git a/libavcodec/hevc_cabac.c b/libavcodec/hevc_cabac.c +index 271e17a..4caf720 100644 +--- a/libavcodec/hevc_cabac.c ++++ b/libavcodec/hevc_cabac.c +@@ -21,14 +21,72 @@ + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + ++#define UNCHECKED_BITSTREAM_READER 1 ++ + #include "libavutil/attributes.h" + #include "libavutil/common.h" + +-#include "cabac_functions.h" + #include "hevc.h" ++#include "cabac_functions.h" ++ ++// BY22 is probably faster than simple bypass if the processor has ++// either a fast 32-bit divide or a fast 32x32->64[63:32] instruction ++// x86 has fast int divide ++// Arm doesn't have divide or general fast 64 bit, but does have the multiply ++// * Beware: ARCH_xxx isn't set if configure --disable-asm is used ++#define USE_BY22 (HAVE_FAST_64BIT || ARCH_ARM || ARCH_X86) ++// Use native divide if we have a fast one - otherwise use mpy 1/x ++// x86 has a fast integer divide - arm doesn't - unsure about other ++// architectures ++#define USE_BY22_DIV ARCH_X86 ++ ++// Special case blocks with a single significant ceoff ++// Decreases the complexity of the code for a common case but increases the ++// code size. ++#define USE_N_END_1 1 ++ ++#if ARCH_ARM ++#include "arm/hevc_cabac.h" ++#endif + + #define CABAC_MAX_BIN 31 + ++ ++#if USE_BY22 && !USE_BY22_DIV ++#define I(x) (uint32_t)((0x10000000000ULL / (uint64_t)(x)) + 1ULL) ++ ++static const uint32_t cabac_by22_inv_range[256] = { ++ 0, I(257), I(258), I(259), ++ I(260), I(261), I(262), I(263), I(264), I(265), I(266), I(267), I(268), I(269), ++ I(270), I(271), I(272), I(273), I(274), I(275), I(276), I(277), I(278), I(279), ++ I(280), I(281), I(282), I(283), I(284), I(285), I(286), I(287), I(288), I(289), ++ I(290), I(291), I(292), I(293), I(294), I(295), I(296), I(297), I(298), I(299), ++ I(300), I(301), I(302), I(303), I(304), I(305), I(306), I(307), I(308), I(309), ++ I(310), I(311), I(312), I(313), I(314), I(315), I(316), I(317), I(318), I(319), ++ I(320), I(321), I(322), I(323), I(324), I(325), I(326), I(327), I(328), I(329), ++ I(330), I(331), I(332), I(333), I(334), I(335), I(336), I(337), I(338), I(339), ++ I(340), I(341), I(342), I(343), I(344), I(345), I(346), I(347), I(348), I(349), ++ I(350), I(351), I(352), I(353), I(354), I(355), I(356), I(357), I(358), I(359), ++ I(360), I(361), I(362), I(363), I(364), I(365), I(366), I(367), I(368), I(369), ++ I(370), I(371), I(372), I(373), I(374), I(375), I(376), I(377), I(378), I(379), ++ I(380), I(381), I(382), I(383), I(384), I(385), I(386), I(387), I(388), I(389), ++ I(390), I(391), I(392), I(393), I(394), I(395), I(396), I(397), I(398), I(399), ++ I(400), I(401), I(402), I(403), I(404), I(405), I(406), I(407), I(408), I(409), ++ I(410), I(411), I(412), I(413), I(414), I(415), I(416), I(417), I(418), I(419), ++ I(420), I(421), I(422), I(423), I(424), I(425), I(426), I(427), I(428), I(429), ++ I(430), I(431), I(432), I(433), I(434), I(435), I(436), I(437), I(438), I(439), ++ I(440), I(441), I(442), I(443), I(444), I(445), I(446), I(447), I(448), I(449), ++ I(450), I(451), I(452), I(453), I(454), I(455), I(456), I(457), I(458), I(459), ++ I(460), I(461), I(462), I(463), I(464), I(465), I(466), I(467), I(468), I(469), ++ I(470), I(471), I(472), I(473), I(474), I(475), I(476), I(477), I(478), I(479), ++ I(480), I(481), I(482), I(483), I(484), I(485), I(486), I(487), I(488), I(489), ++ I(490), I(491), I(492), I(493), I(494), I(495), I(496), I(497), I(498), I(499), ++ I(500), I(501), I(502), I(503), I(504), I(505), I(506), I(507), I(508), I(509), ++ I(510), I(511) ++}; ++#undef I ++#endif // USE_BY22 ++ + /** + * number of bin by SyntaxElement. + */ +@@ -445,6 +503,211 @@ static const uint8_t diag_scan8x8_inv[8][8] = { + { 28, 36, 43, 49, 54, 58, 61, 63, }, + }; + ++ ++typedef struct ++{ ++ uint16_t coeff; ++ uint16_t scale; ++} xy_off_t; ++ ++#define XYT_C(x,y,t) ((x) + ((y) << (t))) ++#define SCALE_TRAFO(t) ((t) > 3 ? 3 : (t)) ++#define SCALE_SHR(t) ((t) - SCALE_TRAFO(t)) ++#define XYT_S(x,y,t) (((x) >> SCALE_SHR(t)) + (((y) >> SCALE_SHR(t)) << SCALE_TRAFO(t))) ++ ++#define XYT(x,y,t) {XYT_C(x,y,t), XYT_S(x,y,t)} ++ ++#define OFF_DIAG(t) {\ ++ XYT(0,0,t), XYT(0,1,t), XYT(1,0,t), XYT(0,2,t),\ ++ XYT(1,1,t), XYT(2,0,t), XYT(0,3,t), XYT(1,2,t),\ ++ XYT(2,1,t), XYT(3,0,t), XYT(1,3,t), XYT(2,2,t),\ ++ XYT(3,1,t), XYT(2,3,t), XYT(3,2,t), XYT(3,3,t)\ ++} ++ ++#define OFF_HORIZ(t) {\ ++ XYT(0,0,t), XYT(1,0,t), XYT(2,0,t), XYT(3,0,t),\ ++ XYT(0,1,t), XYT(1,1,t), XYT(2,1,t), XYT(3,1,t),\ ++ XYT(0,2,t), XYT(1,2,t), XYT(2,2,t), XYT(3,2,t),\ ++ XYT(0,3,t), XYT(1,3,t), XYT(2,3,t), XYT(3,3,t)\ ++} ++ ++#define OFF_VERT(t) {\ ++ XYT(0,0,t), XYT(0,1,t), XYT(0,2,t), XYT(0,3,t),\ ++ XYT(1,0,t), XYT(1,1,t), XYT(1,2,t), XYT(1,3,t),\ ++ XYT(2,0,t), XYT(2,1,t), XYT(2,2,t), XYT(2,3,t),\ ++ XYT(3,0,t), XYT(3,1,t), XYT(3,2,t), XYT(3,3,t)\ ++} ++ ++static const xy_off_t off_xys[3][4][16] = ++{ ++ {OFF_DIAG(2), OFF_DIAG(3), OFF_DIAG(4), OFF_DIAG(5)}, ++ {OFF_HORIZ(2), OFF_HORIZ(3), OFF_HORIZ(4), OFF_HORIZ(5)}, ++ {OFF_VERT(2), OFF_VERT(3), OFF_VERT(4), OFF_VERT(5)} ++}; ++ ++ ++// Helper fns ++#ifndef hevc_mem_bits32 ++static av_always_inline uint32_t hevc_mem_bits32(const void * buf, const unsigned int offset) ++{ ++ return AV_RB32((const uint8_t *)buf + (offset >> 3)) << (offset & 7); ++} ++#endif ++ ++#if AV_GCC_VERSION_AT_LEAST(3,4) && !defined(hevc_clz32) ++#define hevc_clz32 hevc_clz32_builtin ++static av_always_inline unsigned int hevc_clz32_builtin(const uint32_t x) ++{ ++ // __builtin_clz says it works on ints - so adjust if int is >32 bits long ++ return __builtin_clz(x) - (sizeof(int) * 8 - 32); ++} ++#endif ++ ++// It is unlikely that we will ever need this but include for completeness ++#ifndef hevc_clz32 ++static inline unsigned int hevc_clz32(unsigned int x) ++{ ++ unsigned int n = 1; ++ if ((x & 0xffff0000) == 0) { ++ n += 16; ++ x <<= 16; ++ } ++ if ((x & 0xff000000) == 0) { ++ n += 8; ++ x <<= 8; ++ } ++ if ((x & 0xf0000000) == 0) { ++ n += 4; ++ x <<= 4; ++ } ++ if ((x & 0xc0000000) == 0) { ++ n += 2; ++ x <<= 2; ++ } ++ return n - ((x >> 31) & 1); ++} ++#endif ++ ++ ++#if !USE_BY22 ++// If no by22 then _by22 functions will revert to normal and so _peek/_flush ++// will no longer be called but the setup calls will still exist and we want ++// to null them out ++#define bypass_start(s) ++#define bypass_finish(s) ++#else ++// Use BY22 for residual bypass block ++ ++#define bypass_start(s) get_cabac_by22_start(&s->HEVClc->cc) ++#define bypass_finish(s) get_cabac_by22_finish(&s->HEVClc->cc) ++ ++// BY22 notes that bypass is simply a divide into the bitstream and so we ++// can peek out large quantities of bits at one and treat the result as if ++// it was VLC. In many cases this will lead to O(1) processing rather than ++// O(n) though the setup and teardown is sufficiently expensive that it is ++// only worth using if we expect to be dealing with more than a few bits ++// The definition of "a few bits" will vary from platform to platform but ++// tests on ARM show that it probably isn't worth it for a single coded ++// residual, but is for >1 - this is probaly reinforced that if there are ++// more residuals then they are likely to be bigger and this will make the ++// O(1) nature of the code more worthwhile. ++ ++ ++#if !USE_BY22_DIV ++// * 1/x @ 32 bits gets us 22 bits of accuracy ++#define CABAC_BY22_PEEK_BITS 22 ++#else ++// A real 32-bit divide gets us another bit ++// If we have a 64 bit int & a unit time divider then we should get a lot ++// of bits (55) but that is untested and it is unclear if it would give ++// us a large advantage ++#define CABAC_BY22_PEEK_BITS 23 ++#endif ++ ++// Bypass block start ++// Must be called before _by22_peek is used as it sets the CABAC environment ++// into the correct state. _by22_finish must be called to return to 'normal' ++// (i.e. non-bypass) cabac decoding ++static inline void get_cabac_by22_start(CABACContext * const c) ++{ ++ const unsigned int bits = __builtin_ctz(c->low); ++ const uint32_t m = hevc_mem_bits32(c->bytestream, 0); ++ uint32_t x = (c->low << (22 - CABAC_BITS)) ^ ((m ^ 0x80000000U) >> (9 + CABAC_BITS - bits)); ++#if !USE_BY22_DIV ++ const uint32_t inv = cabac_by22_inv_range[c->range & 0xff]; ++#endif ++ ++ c->bytestream -= (CABAC_BITS / 8); ++ c->by22.bits = bits; ++#if !USE_BY22_DIV ++ c->by22.range = c->range; ++ c->range = inv; ++#endif ++ c->low = x; ++} ++ ++// Bypass block finish ++// Must be called at the end of the bypass block to return to normal operation ++static inline void get_cabac_by22_finish(CABACContext * const c) ++{ ++ unsigned int used = c->by22.bits; ++ unsigned int bytes_used = (used / CABAC_BITS) * (CABAC_BITS / 8); ++ unsigned int bits_used = used & (CABAC_BITS == 16 ? 15 : 7); ++ ++ c->bytestream += bytes_used + (CABAC_BITS / 8); ++ c->low = (((uint32_t)c->low >> (22 - CABAC_BITS + bits_used)) | 1) << bits_used; ++#if !USE_BY22_DIV ++ c->range = c->by22.range; ++#endif ++} ++ ++// Peek bypass bits ++// _by22_start must be called before _by22_peek is called and _by22_flush ++// must be called afterwards to flush any used bits ++// The actual number of valid bits returned is ++// min(<coded bypass block length>, CABAC_BY22_PEEK_BITS). CABAC_BY22_PEEK_BITS ++// will be at least 22 which should be long enough for any prefix or suffix ++// though probably not long enough for the worst case combination ++#ifndef get_cabac_by22_peek ++static inline uint32_t get_cabac_by22_peek(const CABACContext * const c) ++{ ++#if USE_BY22_DIV ++ return ((unsigned int)c->low / (unsigned int)c->range) << 9; ++#else ++ uint32_t x = c->low & ~1U; ++ const uint32_t inv = c->range; ++ ++ if (inv != 0) ++ x = (uint32_t)(((uint64_t)x * (uint64_t)inv) >> 32); ++ ++ return x << 1; ++#endif ++} ++#endif ++ ++// Flush bypass bits peeked by _by22_peek ++// Flush n bypass bits. n must be >= 1 to guarantee correct operation ++// val is an unmodified copy of whatever _by22_peek returned ++#ifndef get_cabac_by22_flush ++static inline void get_cabac_by22_flush(CABACContext * c, const unsigned int n, const uint32_t val) ++{ ++ // Subtract the bits used & reshift up to the top of the word ++#if USE_BY22_DIV ++ const uint32_t low = (((unsigned int)c->low << n) - (((val >> (32 - n)) * (unsigned int)c->range) << 23)); ++#else ++ const uint32_t low = (((uint32_t)c->low << n) - (((val >> (32 - n)) * c->by22.range) << 23)); ++#endif ++ ++ // and refill lower bits ++ // We will probably OR over some existing bits but that doesn't matter ++ c->by22.bits += n; ++ c->low = low | (hevc_mem_bits32(c->bytestream, c->by22.bits) >> 9); ++} ++#endif ++ ++#endif // USE_BY22 ++ ++ + void ff_hevc_save_states(HEVCContext *s, int ctb_addr_ts) + { + if (s->ps.pps->entropy_coding_sync_enabled_flag && +@@ -863,19 +1126,19 @@ int ff_hevc_cbf_luma_decode(HEVCContext *s, int trafo_depth) + return GET_CABAC(elem_offset[CBF_LUMA] + !trafo_depth); + } + +-static int hevc_transform_skip_flag_decode(HEVCContext *s, int c_idx) ++static int hevc_transform_skip_flag_decode(HEVCContext *s, int c_idx_nz) + { +- return GET_CABAC(elem_offset[TRANSFORM_SKIP_FLAG] + !!c_idx); ++ return GET_CABAC(elem_offset[TRANSFORM_SKIP_FLAG] + c_idx_nz); + } + +-static int explicit_rdpcm_flag_decode(HEVCContext *s, int c_idx) ++static int explicit_rdpcm_flag_decode(HEVCContext *s, int c_idx_nz) + { +- return GET_CABAC(elem_offset[EXPLICIT_RDPCM_FLAG] + !!c_idx); ++ return GET_CABAC(elem_offset[EXPLICIT_RDPCM_FLAG] + c_idx_nz); + } + +-static int explicit_rdpcm_dir_flag_decode(HEVCContext *s, int c_idx) ++static int explicit_rdpcm_dir_flag_decode(HEVCContext *s, int c_idx_nz) + { +- return GET_CABAC(elem_offset[EXPLICIT_RDPCM_DIR_FLAG] + !!c_idx); ++ return GET_CABAC(elem_offset[EXPLICIT_RDPCM_DIR_FLAG] + c_idx_nz); + } + + int ff_hevc_log2_res_scale_abs(HEVCContext *s, int idx) { +@@ -891,14 +1154,14 @@ int ff_hevc_res_scale_sign_flag(HEVCContext *s, int idx) { + return GET_CABAC(elem_offset[RES_SCALE_SIGN_FLAG] + idx); + } + +-static av_always_inline void last_significant_coeff_xy_prefix_decode(HEVCContext *s, int c_idx, ++static av_always_inline void last_significant_coeff_xy_prefix_decode(HEVCContext *s, int c_idx_nz, + int log2_size, int *last_scx_prefix, int *last_scy_prefix) + { + int i = 0; + int max = (log2_size << 1) - 1; + int ctx_offset, ctx_shift; + +- if (!c_idx) { ++ if (!c_idx_nz) { + ctx_offset = 3 * (log2_size - 2) + ((log2_size - 1) >> 2); + ctx_shift = (log2_size + 1) >> 2; + } else { +@@ -929,22 +1192,16 @@ static av_always_inline int last_significant_coeff_suffix_decode(HEVCContext *s, + return value; + } + +-static av_always_inline int significant_coeff_group_flag_decode(HEVCContext *s, int c_idx, int ctx_cg) ++static av_always_inline int significant_coeff_group_flag_decode(HEVCContext *s, int c_idx_nz, int ctx_cg) + { + int inc; + +- inc = FFMIN(ctx_cg, 1) + (c_idx>0 ? 2 : 0); ++ inc = (ctx_cg != 0) + (c_idx_nz << 1); + + return GET_CABAC(elem_offset[SIGNIFICANT_COEFF_GROUP_FLAG] + inc); + } +-static av_always_inline int significant_coeff_flag_decode(HEVCContext *s, int x_c, int y_c, +- int offset, const uint8_t *ctx_idx_map) +-{ +- int inc = ctx_idx_map[(y_c << 2) + x_c] + offset; +- return GET_CABAC(elem_offset[SIGNIFICANT_COEFF_FLAG] + inc); +-} + +-static av_always_inline int significant_coeff_flag_decode_0(HEVCContext *s, int c_idx, int offset) ++static av_always_inline int significant_coeff_flag_decode_0(HEVCContext *s, int offset) + { + return GET_CABAC(elem_offset[SIGNIFICANT_COEFF_FLAG] + offset); + } +@@ -966,65 +1223,305 @@ static av_always_inline int coeff_abs_level_greater2_flag_decode(HEVCContext *s, + return GET_CABAC(elem_offset[COEFF_ABS_LEVEL_GREATER2_FLAG] + inc); + } + +-static av_always_inline int coeff_abs_level_remaining_decode(HEVCContext *s, int rc_rice_param) ++ ++#if !USE_BY22 ++#define coeff_abs_level_remaining_decode_bypass(s,r) coeff_abs_level_remaining_decode(s, r) ++#endif ++ ++ ++#ifndef coeff_abs_level_remaining_decode_bypass ++static int coeff_abs_level_remaining_decode_bypass(HEVCContext * const s, const unsigned int rice_param) ++{ ++ CABACContext * const c = &s->HEVClc->cc; ++ uint32_t y; ++ unsigned int prefix; ++ unsigned int last_coeff_abs_level_remaining; ++ unsigned int n; ++ ++ y = get_cabac_by22_peek(c); ++ prefix = hevc_clz32(~y); ++ // y << prefix will always have top bit 0 ++ ++ if (prefix < 3) { ++ const unsigned int suffix = (y << prefix) >> (31 - rice_param); ++ last_coeff_abs_level_remaining = (prefix << rice_param) + suffix; ++ n = prefix + 1 + rice_param; ++ } ++ else if (prefix * 2 + rice_param <= CABAC_BY22_PEEK_BITS + 2) ++ { ++ const uint32_t suffix = ((y << prefix) | 0x80000000) >> (34 - (prefix + rice_param)); ++ ++ last_coeff_abs_level_remaining = (2 << rice_param) + suffix; ++ n = prefix * 2 + rice_param - 2; ++ } ++ else { ++ unsigned int suffix; ++ ++ get_cabac_by22_flush(c, prefix, y); ++ y = get_cabac_by22_peek(c); ++ ++ suffix = (y | 0x80000000) >> (34 - (prefix + rice_param)); ++ last_coeff_abs_level_remaining = (2 << rice_param) + suffix; ++ n = prefix + rice_param - 2; ++ } ++ ++ get_cabac_by22_flush(c, n, y); ++ ++ return last_coeff_abs_level_remaining; ++} ++#endif ++ ++static int coeff_abs_level_remaining_decode(HEVCContext * const s, int rc_rice_param) + { ++ CABACContext * const c = &s->HEVClc->cc; + int prefix = 0; + int suffix = 0; + int last_coeff_abs_level_remaining; + int i; + +- while (prefix < CABAC_MAX_BIN && get_cabac_bypass(&s->HEVClc->cc)) ++ while (prefix < CABAC_MAX_BIN && get_cabac_bypass(c)) + prefix++; + if (prefix == CABAC_MAX_BIN) { + av_log(s->avctx, AV_LOG_ERROR, "CABAC_MAX_BIN : %d\n", prefix); + return 0; + } ++ + if (prefix < 3) { + for (i = 0; i < rc_rice_param; i++) +- suffix = (suffix << 1) | get_cabac_bypass(&s->HEVClc->cc); ++ suffix = (suffix << 1) | get_cabac_bypass(c); + last_coeff_abs_level_remaining = (prefix << rc_rice_param) + suffix; + } else { + int prefix_minus3 = prefix - 3; + for (i = 0; i < prefix_minus3 + rc_rice_param; i++) +- suffix = (suffix << 1) | get_cabac_bypass(&s->HEVClc->cc); ++ suffix = (suffix << 1) | get_cabac_bypass(c); + last_coeff_abs_level_remaining = (((1 << prefix_minus3) + 3 - 1) + << rc_rice_param) + suffix; + } ++ + return last_coeff_abs_level_remaining; + } + +-static av_always_inline int coeff_sign_flag_decode(HEVCContext *s, uint8_t nb) ++#if !USE_BY22 ++#define coeff_sign_flag_decode_bypass coeff_sign_flag_decode ++static inline uint32_t coeff_sign_flag_decode(HEVCContext * const s, const unsigned int nb) + { +- int i; +- int ret = 0; ++ CABACContext * const c = &s->HEVClc->cc; ++ unsigned int i; ++ uint32_t ret = 0; + + for (i = 0; i < nb; i++) +- ret = (ret << 1) | get_cabac_bypass(&s->HEVClc->cc); +- return ret; ++ ret = (ret << 1) | get_cabac_bypass(c); ++ ++ return ret << (32 - nb); + } ++#endif ++ ++#ifndef coeff_sign_flag_decode_bypass ++static inline uint32_t coeff_sign_flag_decode_bypass(HEVCContext * const s, const unsigned int nb) ++{ ++ CABACContext * const c = &s->HEVClc->cc; ++ uint32_t y; ++ y = get_cabac_by22_peek(c); ++ get_cabac_by22_flush(c, nb, y); ++ return y & ~(0xffffffffU >> nb); ++} ++#endif ++ ++ ++#ifndef get_cabac_greater1_bits ++static inline unsigned int get_cabac_greater1_bits(CABACContext * const c, const unsigned int n, ++ uint8_t * const state0) ++{ ++ unsigned int i; ++ unsigned int rv = 0; ++ for (i = 0; i != n; ++i) { ++ const unsigned int idx = rv != 0 ? 0 : i < 3 ? i + 1 : 3; ++ const unsigned int b = get_cabac(c, state0 + idx); ++ rv = (rv << 1) | b; ++ } ++ return rv; ++} ++#endif ++ ++ ++// N.B. levels returned are the values assuming coeff_abs_level_remaining ++// is uncoded, so 1 must be added if it is coded. sum_abs also reflects ++// this version of events. ++static inline uint32_t get_greaterx_bits(HEVCContext * const s, const unsigned int n_end, int * const levels, ++ int * const pprev_subset_coded, int * const psum, ++ const unsigned int idx0_gt1, const unsigned int idx_gt2) ++{ ++ CABACContext * const c = &s->HEVClc->cc; ++ uint8_t * const state0 = s->HEVClc->cabac_state + idx0_gt1; ++ uint8_t * const state_gt2 = s->HEVClc->cabac_state + idx_gt2; ++ unsigned int rv; ++ unsigned int i; ++ const unsigned int n = FFMIN(n_end, 8); ++ ++ // Really this is i != n but the simple unconditional loop is cheaper ++ // and faster ++ for (i = 0; i != 8; ++i) ++ levels[i] = 1; ++ ++ rv = get_cabac_greater1_bits(c, n, state0); ++ ++ *pprev_subset_coded = 0; ++ *psum = n; ++ ++ rv <<= (32 - n); ++ if (rv != 0) ++ { ++ *pprev_subset_coded = 1; ++ *psum = n + 1; ++ i = hevc_clz32(rv); ++ levels[i] = 2; ++ if (get_cabac(c, state_gt2) == 0) ++ { ++ // Unset first coded bit ++ rv &= ~(0x80000000U >> i); ++ } ++ } ++ ++ if (n_end > 8) { ++ const unsigned int g8 = n_end - 8; ++ rv |= ((1 << g8) - 1) << (24 - g8); ++ for (i = 0; i != g8; ++i) { ++ levels[i + 8] = 0; ++ } ++ } ++ ++ return rv; ++} ++ ++// extended_precision_processing_flag must be false given we are ++// putting the result into a 16-bit array ++// So trans_coeff_level must fit in 16 bits too (7.4.9.1 definition of coeff_abs_level_remaining) ++// scale_m is uint8_t ++// ++// scale is [40 - 72] << [0..12] based on qp- worst case is (45 << 12) ++// or it can be 2 (if we have transquant_bypass) ++// shift is set to one less than we really want but would normally be ++// s->ps.sps->bit_depth (max 16, min 8) + log2_trafo_size (max 5, min 2?) - 5 = max 16 min 5? ++// however the scale shift is substracted from shift to a min 0 so scale_m worst = 45 << 6 ++// This can still theoretically lead to overflow but the coding would have to be very odd (& inefficient) ++// to achieve it ++ ++#ifndef trans_scale_sat ++static inline int trans_scale_sat(const int level, const unsigned int scale, const unsigned int scale_m, const unsigned int shift) ++{ ++ return av_clip_int16((((level * (int)(scale * scale_m)) >> shift) + 1) >> 1); ++} ++#endif ++ ++ ++#ifndef update_rice ++static inline void update_rice(uint8_t * const stat_coeff, ++ const unsigned int last_coeff_abs_level_remaining, ++ const unsigned int c_rice_param) ++{ ++ const unsigned int x = (last_coeff_abs_level_remaining << 1) >> c_rice_param; ++ if (x >= 6) ++ (*stat_coeff)++; ++ else if (x == 0 && *stat_coeff > 0) ++ (*stat_coeff)--; ++} ++#endif ++ ++ ++// n must be > 0 on entry ++#ifndef get_cabac_sig_coeff_flag_idxs ++static inline uint8_t * get_cabac_sig_coeff_flag_idxs(CABACContext * const c, uint8_t * const state0, ++ unsigned int n, ++ const uint8_t const * ctx_map, ++ uint8_t * p) ++{ ++ do { ++ if (get_cabac(c, state0 + ctx_map[n])) ++ *p++ = n; ++ } while (--n != 0); ++ return p; ++} ++#endif ++ ++ ++static int get_sig_coeff_flag_idxs(CABACContext * const c, uint8_t * const state0, ++ unsigned int n, ++ const uint8_t const * ctx_map, ++ uint8_t * const flag_idx) ++{ ++ int rv; ++ ++ rv = get_cabac_sig_coeff_flag_idxs(c, state0, n, ctx_map, flag_idx) - flag_idx; ++ ++ return rv; ++} ++ ++#define H4x4(x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15) {\ ++ x0, x1, x2, x3,\ ++ x4, x5, x6, x7,\ ++ x8, x9, x10, x11,\ ++ x12, x13, x14, x15} ++ ++#define V4x4(x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15) {\ ++ x0, x4, x8, x12,\ ++ x1, x5, x9, x13,\ ++ x2, x6, x10, x14,\ ++ x3, x7, x11, x15} ++ ++#define D4x4(x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15) {\ ++ x0, x4, x1, x8,\ ++ x5, x2, x12, x9,\ ++ x6, x3, x13, x10,\ ++ x7, x14, x11, x15} ++ ++ ++static inline int next_subset(HEVCContext * const s, int i, const int c_idx_nz, ++ uint8_t * const significant_coeff_group_flag, ++ const uint8_t * const scan_x_cg, const uint8_t * const scan_y_cg, ++ int * const pPrev_sig) ++{ ++ while (--i >= 0) { ++ unsigned int x_cg = scan_x_cg[i]; ++ unsigned int y_cg = scan_y_cg[i]; ++ ++ // For the flag decode we only care about Z/NZ but ++ // we use the full Right + Down * 2 when calculating ++ // significant coeff flags so we obtain it here ++ //. ++ // The group flag array is one longer than it needs to ++ // be so we don't need to check for y_cg limits ++ unsigned int prev_sig = ((significant_coeff_group_flag[y_cg] >> (x_cg + 1)) & 1) | ++ (((significant_coeff_group_flag[y_cg + 1] >> x_cg) & 1) << 1); ++ ++ if (i == 0 || ++ significant_coeff_group_flag_decode(s, c_idx_nz, prev_sig)) ++ { ++ significant_coeff_group_flag[y_cg] |= (1 << x_cg); ++ *pPrev_sig = prev_sig; ++ break; ++ } ++ } ++ ++ return i; ++} ++ + + void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, + int log2_trafo_size, enum ScanType scan_idx, + int c_idx) + { +-#define GET_COORD(offset, n) \ +- do { \ +- x_c = (x_cg << 2) + scan_x_off[n]; \ +- y_c = (y_cg << 2) + scan_y_off[n]; \ +- } while (0) +- HEVCLocalContext *lc = s->HEVClc; +- int transform_skip_flag = 0; ++ HEVCLocalContext * const lc = s->HEVClc; ++ int trans_skip_or_bypass = lc->cu.cu_transquant_bypass_flag; + + int last_significant_coeff_x, last_significant_coeff_y; +- int last_scan_pos; +- int n_end; + int num_coeff = 0; +- int greater1_ctx = 1; ++ int prev_subset_coded = 0; + + int num_last_subset; + int x_cg_last_sig, y_cg_last_sig; + +- const uint8_t *scan_x_cg, *scan_y_cg, *scan_x_off, *scan_y_off; ++ const uint8_t *scan_x_cg, *scan_y_cg; ++ const xy_off_t * scan_xy_off; + + ptrdiff_t stride = s->frame->linesize[c_idx]; + int hshift = s->ps.sps->hshift[c_idx]; +@@ -1032,21 +1529,28 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, + uint8_t *dst = &s->frame->data[c_idx][(y0 >> vshift) * stride + + ((x0 >> hshift) << s->ps.sps->pixel_shift)]; + #ifdef RPI +- int use_vpu = s->enable_rpi && !lc->cu.cu_transquant_bypass_flag && !transform_skip_flag && !lc->tu.cross_pf && log2_trafo_size>=4; ++ //***** transform_skip_flag decoded later! ++ int use_vpu = s->enable_rpi && !lc->cu.cu_transquant_bypass_flag /* && !transform_skip_flag*/ && !lc->tu.cross_pf && log2_trafo_size>=4; + #endif + int16_t *coeffs = (int16_t*)(c_idx ? lc->edge_emu_buffer2 : lc->edge_emu_buffer); +- uint8_t significant_coeff_group_flag[8][8] = {{0}}; ++ uint8_t significant_coeff_group_flag[9] = {0}; // Allow 1 final byte that is always zero + int explicit_rdpcm_flag = 0; + int explicit_rdpcm_dir_flag; + + int trafo_size = 1 << log2_trafo_size; + int i; +- int qp,shift,add,scale,scale_m; +- const uint8_t level_scale[] = { 40, 45, 51, 57, 64, 72 }; ++ int qp,shift,scale; ++ static const uint8_t level_scale[] = { 40, 45, 51, 57, 64, 72 }; + const uint8_t *scale_matrix = NULL; + uint8_t dc_scale; + int pred_mode_intra = (c_idx == 0) ? lc->tu.intra_pred_mode : + lc->tu.intra_pred_mode_c; ++ ++ int prev_sig = 0; ++ const int c_idx_nz = (c_idx != 0); ++ ++ int may_hide_sign; ++ + #ifdef RPI + if (s->enable_rpi) { + int n = trafo_size * trafo_size; +@@ -1078,7 +1582,7 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, + + // Derive QP for dequant + if (!lc->cu.cu_transquant_bypass_flag) { +- static const int qp_c[] = { 29, 30, 31, 32, 33, 33, 34, 34, 35, 35, 36, 36, 37, 37 }; ++ static const uint8_t qp_c[] = { 29, 30, 31, 32, 33, 33, 34, 34, 35, 35, 36, 36, 37, 37 }; + static const uint8_t rem6[51 + 4 * 6 + 1] = { + 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, + 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, +@@ -1094,9 +1598,19 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, + }; + int qp_y = lc->qp_y; + ++ may_hide_sign = s->ps.pps->sign_data_hiding_flag; ++ + if (s->ps.pps->transform_skip_enabled_flag && + log2_trafo_size <= s->ps.pps->log2_max_transform_skip_block_size) { +- transform_skip_flag = hevc_transform_skip_flag_decode(s, c_idx); ++ int transform_skip_flag = hevc_transform_skip_flag_decode(s, c_idx_nz); ++ if (transform_skip_flag) { ++ trans_skip_or_bypass = 1; ++ if (lc->cu.pred_mode == MODE_INTRA && ++ s->ps.sps->implicit_rdpcm_enabled_flag && ++ (pred_mode_intra == 10 || pred_mode_intra == 26)) { ++ may_hide_sign = 0; ++ } ++ } + } + + if (c_idx == 0) { +@@ -1129,39 +1643,73 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, + qp += s->ps.sps->qp_bd_offset; + } + +- shift = s->ps.sps->bit_depth + log2_trafo_size - 5; +- add = 1 << (shift-1); +- scale = level_scale[rem6[qp]] << (div6[qp]); +- scale_m = 16; // default when no custom scaling lists. +- dc_scale = 16; ++ // Shift is set to one less than will actually occur as the scale ++ // and saturate step adds 1 and then shifts right again ++ shift = s->ps.sps->bit_depth + log2_trafo_size - 6; ++ scale = level_scale[rem6[qp]]; ++ if (div6[qp] >= shift) { ++ scale <<= (div6[qp] - shift); ++ shift = 0; ++ } else { ++ shift -= div6[qp]; ++ } + +- if (s->ps.sps->scaling_list_enable_flag && !(transform_skip_flag && log2_trafo_size > 2)) { ++ if (s->ps.sps->scaling_list_enable_flag && !(trans_skip_or_bypass && log2_trafo_size > 2)) { + const ScalingList *sl = s->ps.pps->scaling_list_data_present_flag ? +- &s->ps.pps->scaling_list : &s->ps.sps->scaling_list; ++ &s->ps.pps->scaling_list : &s->ps.sps->scaling_list; + int matrix_id = lc->cu.pred_mode != MODE_INTRA; + + matrix_id = 3 * matrix_id + c_idx; + + scale_matrix = sl->sl[log2_trafo_size - 2][matrix_id]; ++ dc_scale = scale_matrix[0]; + if (log2_trafo_size >= 4) + dc_scale = sl->sl_dc[log2_trafo_size - 4][matrix_id]; + } ++ else ++ { ++ static const uint8_t sixteen_scale[64] = { ++ 16, 16, 16, 16, 16, 16, 16, 16, ++ 16, 16, 16, 16, 16, 16, 16, 16, ++ 16, 16, 16, 16, 16, 16, 16, 16, ++ 16, 16, 16, 16, 16, 16, 16, 16, ++ 16, 16, 16, 16, 16, 16, 16, 16, ++ 16, 16, 16, 16, 16, 16, 16, 16, ++ 16, 16, 16, 16, 16, 16, 16, 16, ++ 16, 16, 16, 16, 16, 16, 16, 16 ++ }; ++ scale_matrix = sixteen_scale; ++ dc_scale = 16; ++ } + } else { ++ static const uint8_t unit_scale[64] = { ++ 1, 1, 1, 1, 1, 1, 1, 1, ++ 1, 1, 1, 1, 1, 1, 1, 1, ++ 1, 1, 1, 1, 1, 1, 1, 1, ++ 1, 1, 1, 1, 1, 1, 1, 1, ++ 1, 1, 1, 1, 1, 1, 1, 1, ++ 1, 1, 1, 1, 1, 1, 1, 1, ++ 1, 1, 1, 1, 1, 1, 1, 1, ++ 1, 1, 1, 1, 1, 1, 1, 1, ++ }; ++ scale_matrix = unit_scale; + shift = 0; +- add = 0; +- scale = 0; +- dc_scale = 0; ++ scale = 2; // We will shift right to kill this ++ dc_scale = 1; ++ ++ may_hide_sign = 0; + } + + if (lc->cu.pred_mode == MODE_INTER && s->ps.sps->explicit_rdpcm_enabled_flag && +- (transform_skip_flag || lc->cu.cu_transquant_bypass_flag)) { +- explicit_rdpcm_flag = explicit_rdpcm_flag_decode(s, c_idx); ++ trans_skip_or_bypass) { ++ explicit_rdpcm_flag = explicit_rdpcm_flag_decode(s, c_idx_nz); + if (explicit_rdpcm_flag) { +- explicit_rdpcm_dir_flag = explicit_rdpcm_dir_flag_decode(s, c_idx); ++ may_hide_sign = 0; ++ explicit_rdpcm_dir_flag = explicit_rdpcm_dir_flag_decode(s, c_idx_nz); + } + } + +- last_significant_coeff_xy_prefix_decode(s, c_idx, log2_trafo_size, ++ last_significant_coeff_xy_prefix_decode(s, c_idx_nz, log2_trafo_size, + &last_significant_coeff_x, &last_significant_coeff_y); + + if (last_significant_coeff_x > 3) { +@@ -1189,119 +1737,113 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, + int last_x_c = last_significant_coeff_x & 3; + int last_y_c = last_significant_coeff_y & 3; + +- scan_x_off = ff_hevc_diag_scan4x4_x; +- scan_y_off = ff_hevc_diag_scan4x4_y; + num_coeff = diag_scan4x4_inv[last_y_c][last_x_c]; +- if (trafo_size == 4) { ++ ++ switch (log2_trafo_size) { ++ case 2: + scan_x_cg = scan_1x1; + scan_y_cg = scan_1x1; +- } else if (trafo_size == 8) { ++ break; ++ case 3: + num_coeff += diag_scan2x2_inv[y_cg_last_sig][x_cg_last_sig] << 4; + scan_x_cg = diag_scan2x2_x; + scan_y_cg = diag_scan2x2_y; +- } else if (trafo_size == 16) { ++ break; ++ case 4: + num_coeff += diag_scan4x4_inv[y_cg_last_sig][x_cg_last_sig] << 4; + scan_x_cg = ff_hevc_diag_scan4x4_x; + scan_y_cg = ff_hevc_diag_scan4x4_y; +- } else { // trafo_size == 32 ++ break; ++ case 5: ++ default: + num_coeff += diag_scan8x8_inv[y_cg_last_sig][x_cg_last_sig] << 4; + scan_x_cg = ff_hevc_diag_scan8x8_x; + scan_y_cg = ff_hevc_diag_scan8x8_y; ++ break; + } + break; + } + case SCAN_HORIZ: + scan_x_cg = horiz_scan2x2_x; + scan_y_cg = horiz_scan2x2_y; +- scan_x_off = horiz_scan4x4_x; +- scan_y_off = horiz_scan4x4_y; + num_coeff = horiz_scan8x8_inv[last_significant_coeff_y][last_significant_coeff_x]; + break; + default: //SCAN_VERT + scan_x_cg = horiz_scan2x2_y; + scan_y_cg = horiz_scan2x2_x; +- scan_x_off = horiz_scan4x4_y; +- scan_y_off = horiz_scan4x4_x; + num_coeff = horiz_scan8x8_inv[last_significant_coeff_x][last_significant_coeff_y]; + break; + } + num_coeff++; + num_last_subset = (num_coeff - 1) >> 4; + +- for (i = num_last_subset; i >= 0; i--) { +- int n, m; +- int x_cg, y_cg, x_c, y_c, pos; +- int implicit_non_zero_coeff = 0; +- int64_t trans_coeff_level; +- int prev_sig = 0; +- int offset = i << 4; +- int rice_init = 0; +- +- uint8_t significant_coeff_flag_idx[16]; +- uint8_t nb_significant_coeff_flag = 0; ++ significant_coeff_group_flag[y_cg_last_sig] = 1 << x_cg_last_sig; // 1st subset always significant + +- x_cg = scan_x_cg[i]; +- y_cg = scan_y_cg[i]; ++ scan_xy_off = off_xys[scan_idx][log2_trafo_size - 2]; + +- if ((i < num_last_subset) && (i > 0)) { +- int ctx_cg = 0; +- if (x_cg < (1 << (log2_trafo_size - 2)) - 1) +- ctx_cg += significant_coeff_group_flag[x_cg + 1][y_cg]; +- if (y_cg < (1 << (log2_trafo_size - 2)) - 1) +- ctx_cg += significant_coeff_group_flag[x_cg][y_cg + 1]; +- +- significant_coeff_group_flag[x_cg][y_cg] = +- significant_coeff_group_flag_decode(s, c_idx, ctx_cg); +- implicit_non_zero_coeff = 1; +- } else { +- significant_coeff_group_flag[x_cg][y_cg] = +- ((x_cg == x_cg_last_sig && y_cg == y_cg_last_sig) || +- (x_cg == 0 && y_cg == 0)); +- } ++ i = num_last_subset; ++ do { ++ int implicit_non_zero_coeff = 0; ++ int n_end; + +- last_scan_pos = num_coeff - offset - 1; ++ uint8_t significant_coeff_flag_idx[16]; ++ unsigned int nb_significant_coeff_flag = 0; + + if (i == num_last_subset) { ++ // First time through ++ int last_scan_pos = num_coeff - (i << 4) - 1; + n_end = last_scan_pos - 1; + significant_coeff_flag_idx[0] = last_scan_pos; + nb_significant_coeff_flag = 1; + } else { + n_end = 15; ++ implicit_non_zero_coeff = (i != 0); + } + +- if (x_cg < ((1 << log2_trafo_size) - 1) >> 2) +- prev_sig = !!significant_coeff_group_flag[x_cg + 1][y_cg]; +- if (y_cg < ((1 << log2_trafo_size) - 1) >> 2) +- prev_sig += (!!significant_coeff_group_flag[x_cg][y_cg + 1] << 1); +- +- if (significant_coeff_group_flag[x_cg][y_cg] && n_end >= 0) { +- static const uint8_t ctx_idx_map[] = { +- 0, 1, 4, 5, 2, 3, 4, 5, 6, 6, 8, 8, 7, 7, 8, 8, // log2_trafo_size == 2 +- 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, // prev_sig == 0 +- 2, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, // prev_sig == 1 +- 2, 1, 0, 0, 2, 1, 0, 0, 2, 1, 0, 0, 2, 1, 0, 0, // prev_sig == 2 +- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 // default ++ if (n_end >= 0) { ++ static const uint8_t ctx_idx_maps_ts2[3][16] = { ++ D4x4(0, 1, 4, 5, 2, 3, 4, 5, 6, 6, 8, 8, 7, 7, 8, 8), // log2_trafo_size == 2 ++ H4x4(0, 1, 4, 5, 2, 3, 4, 5, 6, 6, 8, 8, 7, 7, 8, 8), // log2_trafo_size == 2 ++ V4x4(0, 1, 4, 5, 2, 3, 4, 5, 6, 6, 8, 8, 7, 7, 8, 8) // log2_trafo_size == 2 ++ }; ++ static const uint8_t ctx_idx_maps[3][4][16] = { ++ { ++ D4x4(1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0), // prev_sig == 0 ++ D4x4(2, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0), // prev_sig == 1 ++ D4x4(2, 1, 0, 0, 2, 1, 0, 0, 2, 1, 0, 0, 2, 1, 0, 0), // prev_sig == 2 ++ D4x4(2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2) // prev_sig == 3, default ++ }, ++ { ++ H4x4(1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0), // prev_sig == 0 ++ H4x4(2, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0), // prev_sig == 1 ++ H4x4(2, 1, 0, 0, 2, 1, 0, 0, 2, 1, 0, 0, 2, 1, 0, 0), // prev_sig == 2 ++ H4x4(2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2) // prev_sig == 3, default ++ }, ++ { ++ V4x4(1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0), // prev_sig == 0 ++ V4x4(2, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0), // prev_sig == 1 ++ V4x4(2, 1, 0, 0, 2, 1, 0, 0, 2, 1, 0, 0, 2, 1, 0, 0), // prev_sig == 2 ++ V4x4(2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2) // prev_sig == 3, default ++ } + }; + const uint8_t *ctx_idx_map_p; + int scf_offset = 0; +- if (s->ps.sps->transform_skip_context_enabled_flag && +- (transform_skip_flag || lc->cu.cu_transquant_bypass_flag)) { +- ctx_idx_map_p = (uint8_t*) &ctx_idx_map[4 * 16]; +- if (c_idx == 0) { +- scf_offset = 40; +- } else { +- scf_offset = 14 + 27; +- } ++ ++ if (s->ps.sps->transform_skip_context_enabled_flag && trans_skip_or_bypass) { ++ ctx_idx_map_p = ctx_idx_maps[0][3]; ++ scf_offset = 40 + c_idx_nz; + } else { +- if (c_idx != 0) ++ if (c_idx_nz != 0) + scf_offset = 27; ++ + if (log2_trafo_size == 2) { +- ctx_idx_map_p = (uint8_t*) &ctx_idx_map[0]; ++ ctx_idx_map_p = ctx_idx_maps_ts2[scan_idx]; + } else { +- ctx_idx_map_p = (uint8_t*) &ctx_idx_map[(prev_sig + 1) << 4]; +- if (c_idx == 0) { +- if ((x_cg > 0 || y_cg > 0)) ++ ctx_idx_map_p = ctx_idx_maps[scan_idx][prev_sig]; ++ if (!c_idx_nz) { ++ if (i != 0) + scf_offset += 3; ++ + if (log2_trafo_size == 3) { + scf_offset += (scan_idx == SCAN_DIAG) ? 9 : 15; + } else { +@@ -1315,34 +1857,30 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, + } + } + } +- for (n = n_end; n > 0; n--) { +- x_c = scan_x_off[n]; +- y_c = scan_y_off[n]; +- if (significant_coeff_flag_decode(s, x_c, y_c, scf_offset, ctx_idx_map_p)) { +- significant_coeff_flag_idx[nb_significant_coeff_flag] = n; +- nb_significant_coeff_flag++; ++ ++ if (n_end > 0) { ++ int cnt = get_sig_coeff_flag_idxs(&s->HEVClc->cc, ++ s->HEVClc->cabac_state + elem_offset[SIGNIFICANT_COEFF_FLAG] + scf_offset, ++ n_end, ctx_idx_map_p, ++ significant_coeff_flag_idx + nb_significant_coeff_flag); ++ ++ nb_significant_coeff_flag += cnt; ++ if (cnt != 0) { + implicit_non_zero_coeff = 0; + } + } ++ + if (implicit_non_zero_coeff == 0) { +- if (s->ps.sps->transform_skip_context_enabled_flag && +- (transform_skip_flag || lc->cu.cu_transquant_bypass_flag)) { +- if (c_idx == 0) { +- scf_offset = 42; +- } else { +- scf_offset = 16 + 27; +- } ++ if (s->ps.sps->transform_skip_context_enabled_flag && trans_skip_or_bypass) { ++ scf_offset = 42 + c_idx_nz; + } else { + if (i == 0) { +- if (c_idx == 0) +- scf_offset = 0; +- else +- scf_offset = 27; ++ scf_offset = c_idx_nz ? 27 : 0; + } else { + scf_offset = 2 + scf_offset; + } + } +- if (significant_coeff_flag_decode_0(s, c_idx, scf_offset) == 1) { ++ if (significant_coeff_flag_decode_0(s, scf_offset) == 1) { + significant_coeff_flag_idx[nb_significant_coeff_flag] = 0; + nb_significant_coeff_flag++; + } +@@ -1352,141 +1890,185 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, + } + } + +- n_end = nb_significant_coeff_flag; +- ++ if (nb_significant_coeff_flag != 0) { ++ const unsigned int gt1_idx_delta = (c_idx_nz << 2) | ++ ((i != 0 && !c_idx_nz) ? 2 : 0) | ++ prev_subset_coded; ++ const unsigned int idx0_gt1 = elem_offset[COEFF_ABS_LEVEL_GREATER1_FLAG] + ++ (gt1_idx_delta << 2); ++ const unsigned int idx_gt2 = elem_offset[COEFF_ABS_LEVEL_GREATER2_FLAG] + ++ gt1_idx_delta; ++ ++ const unsigned int x_cg = scan_x_cg[i]; ++ const unsigned int y_cg = scan_y_cg[i]; ++ int16_t * const blk_coeffs = coeffs + ++ ((x_cg + (y_cg << log2_trafo_size)) << 2); ++ // This calculation is 'wrong' for log2_traffo_size == 2 ++ // but that doesn't mattor as in this case x_cg & y_cg ++ // are always 0 so result is correct (0) anyway ++ const uint8_t * const blk_scale = scale_matrix + ++ (((x_cg + (y_cg << 3)) << (5 - log2_trafo_size))); ++ ++ // * THe following code block doesn't deal with these flags: ++ // (nor did the one it replaces) ++ // ++ // cabac_bypass_alignment_enabled_flag ++ // This should be easy but I can't find a test case ++ // extended_precision_processing_flag ++ // This can extend the required precision past 16bits ++ // so is probably tricky - also no example found yet ++ ++#if USE_N_END_1 ++ if (nb_significant_coeff_flag == 1) { ++ // There is a small gain to be had from special casing the single ++ // transform coefficient case. The reduction in complexity ++ // makes up for the code duplicatioon. ++ ++ int trans_coeff_level = 1; ++ int coeff_sign_flag; ++ int coded_val = 0; ++ ++ // initialize first elem of coeff_bas_level_greater1_flag ++ prev_subset_coded = 0; ++ ++ if (get_cabac(&s->HEVClc->cc, s->HEVClc->cabac_state + idx0_gt1 + 1)) { ++ trans_coeff_level = 2; ++ prev_subset_coded = 1; ++ coded_val = get_cabac(&s->HEVClc->cc, s->HEVClc->cabac_state + idx_gt2); ++ } + +- if (n_end) { +- int first_nz_pos_in_cg; +- int last_nz_pos_in_cg; +- int c_rice_param = 0; +- int first_greater1_coeff_idx = -1; +- uint8_t coeff_abs_level_greater1_flag[8]; +- uint16_t coeff_sign_flag; +- int sum_abs = 0; +- int sign_hidden; +- int sb_type; ++ // Probably not worth the overhead of starting by22 for just one value ++ coeff_sign_flag = get_cabac_bypass(&s->HEVClc->cc); + ++ if (coded_val) ++ { ++ if (!s->ps.sps->persistent_rice_adaptation_enabled_flag) { ++ trans_coeff_level = 3 + coeff_abs_level_remaining_decode(s, 0); ++ } else { ++ uint8_t * const stat_coeff = ++ lc->stat_coeff + trans_skip_or_bypass + 2 - ((c_idx_nz) << 1); ++ const unsigned int c_rice_param = *stat_coeff >> 2; ++ const int last_coeff_abs_level_remaining = coeff_abs_level_remaining_decode(s, c_rice_param); + +- // initialize first elem of coeff_bas_level_greater1_flag +- int ctx_set = (i > 0 && c_idx == 0) ? 2 : 0; ++ trans_coeff_level = 3 + last_coeff_abs_level_remaining; ++ update_rice(stat_coeff, last_coeff_abs_level_remaining, c_rice_param); ++ } ++ } + +- if (s->ps.sps->persistent_rice_adaptation_enabled_flag) { +- if (!transform_skip_flag && !lc->cu.cu_transquant_bypass_flag) +- sb_type = 2 * (c_idx == 0 ? 1 : 0); +- else +- sb_type = 2 * (c_idx == 0 ? 1 : 0) + 1; +- c_rice_param = lc->stat_coeff[sb_type] / 4; +- } ++ { ++ const xy_off_t * const xy_off = scan_xy_off + significant_coeff_flag_idx[0]; ++ const int k = (int32_t)(coeff_sign_flag << 31) >> 31; ++ const unsigned int scale_m = blk_scale[xy_off->scale]; + +- if (!(i == num_last_subset) && greater1_ctx == 0) +- ctx_set++; +- greater1_ctx = 1; +- last_nz_pos_in_cg = significant_coeff_flag_idx[0]; +- +- for (m = 0; m < (n_end > 8 ? 8 : n_end); m++) { +- int inc = (ctx_set << 2) + greater1_ctx; +- coeff_abs_level_greater1_flag[m] = +- coeff_abs_level_greater1_flag_decode(s, c_idx, inc); +- if (coeff_abs_level_greater1_flag[m]) { +- greater1_ctx = 0; +- if (first_greater1_coeff_idx == -1) +- first_greater1_coeff_idx = m; +- } else if (greater1_ctx > 0 && greater1_ctx < 3) { +- greater1_ctx++; ++ blk_coeffs[xy_off->coeff] = trans_scale_sat( ++ (trans_coeff_level ^ k) - k, // Apply sign ++ scale, ++ i == 0 && xy_off->coeff == 0 ? dc_scale : scale_m, ++ shift); + } + } +- first_nz_pos_in_cg = significant_coeff_flag_idx[n_end - 1]; +- +- if (lc->cu.cu_transquant_bypass_flag || +- (lc->cu.pred_mode == MODE_INTRA && +- s->ps.sps->implicit_rdpcm_enabled_flag && transform_skip_flag && +- (pred_mode_intra == 10 || pred_mode_intra == 26 )) || +- explicit_rdpcm_flag) +- sign_hidden = 0; + else +- sign_hidden = (last_nz_pos_in_cg - first_nz_pos_in_cg >= 4); ++#endif ++ { ++ int sign_hidden = may_hide_sign; ++ int levels[16]; // Should be able to get away with int16_t but that fails some tests ++ uint32_t coeff_sign_flags; ++ uint32_t coded_vals = 0; ++ // Sum(abs(level[])) ++ // In fact we only need the bottom bit and in some future ++ // version that may be all we calculate ++ unsigned int sum_abs; ++ ++ coded_vals = get_greaterx_bits(s, nb_significant_coeff_flag, levels, ++ &prev_subset_coded, &sum_abs, idx0_gt1, idx_gt2); ++ ++ if (significant_coeff_flag_idx[0] - significant_coeff_flag_idx[nb_significant_coeff_flag - 1] <= 3) ++ sign_hidden = 0; ++ ++ // -- Start bypass block ++ ++ bypass_start(s); ++ ++ coeff_sign_flags = coeff_sign_flag_decode_bypass(s, nb_significant_coeff_flag - sign_hidden); ++ ++ if (coded_vals != 0) ++ { ++ const int rice_adaptation_enabled = s->ps.sps->persistent_rice_adaptation_enabled_flag; ++ uint8_t * stat_coeff = !rice_adaptation_enabled ? NULL : ++ lc->stat_coeff + trans_skip_or_bypass + 2 - ((c_idx_nz) << 1); ++ int c_rice_param = !rice_adaptation_enabled ? 0 : *stat_coeff >> 2; ++ int * level = levels - 1; ++ ++ do { ++ { ++ const unsigned int z = hevc_clz32(coded_vals) + 1; ++ level += z; ++ coded_vals <<= z; ++ } + +- if (first_greater1_coeff_idx != -1) { +- coeff_abs_level_greater1_flag[first_greater1_coeff_idx] += coeff_abs_level_greater2_flag_decode(s, c_idx, ctx_set); +- } +- if (!s->ps.pps->sign_data_hiding_flag || !sign_hidden ) { +- coeff_sign_flag = coeff_sign_flag_decode(s, nb_significant_coeff_flag) << (16 - nb_significant_coeff_flag); +- } else { +- coeff_sign_flag = coeff_sign_flag_decode(s, nb_significant_coeff_flag - 1) << (16 - (nb_significant_coeff_flag - 1)); +- } ++ { ++ const int last_coeff_abs_level_remaining = coeff_abs_level_remaining_decode_bypass(s, c_rice_param); ++ const int trans_coeff_level = *level + last_coeff_abs_level_remaining + 1; ++ ++ sum_abs += last_coeff_abs_level_remaining + 1; ++ *level = trans_coeff_level; + +- for (m = 0; m < n_end; m++) { +- n = significant_coeff_flag_idx[m]; +- GET_COORD(offset, n); +- if (m < 8) { +- trans_coeff_level = 1 + coeff_abs_level_greater1_flag[m]; +- if (trans_coeff_level == ((m == first_greater1_coeff_idx) ? 3 : 2)) { +- int last_coeff_abs_level_remaining = coeff_abs_level_remaining_decode(s, c_rice_param); +- +- trans_coeff_level += last_coeff_abs_level_remaining; +- if (trans_coeff_level > (3 << c_rice_param)) +- c_rice_param = s->ps.sps->persistent_rice_adaptation_enabled_flag ? c_rice_param + 1 : FFMIN(c_rice_param + 1, 4); +- if (s->ps.sps->persistent_rice_adaptation_enabled_flag && !rice_init) { +- int c_rice_p_init = lc->stat_coeff[sb_type] / 4; +- if (last_coeff_abs_level_remaining >= (3 << c_rice_p_init)) +- lc->stat_coeff[sb_type]++; +- else if (2 * last_coeff_abs_level_remaining < (1 << c_rice_p_init)) +- if (lc->stat_coeff[sb_type] > 0) +- lc->stat_coeff[sb_type]--; +- rice_init = 1; ++ if (stat_coeff != NULL) ++ update_rice(stat_coeff, last_coeff_abs_level_remaining, c_rice_param); ++ stat_coeff = NULL; ++ ++ if (trans_coeff_level > (3 << c_rice_param) && ++ (c_rice_param < 4 || rice_adaptation_enabled)) ++ ++c_rice_param; + } +- } +- } else { +- int last_coeff_abs_level_remaining = coeff_abs_level_remaining_decode(s, c_rice_param); +- +- trans_coeff_level = 1 + last_coeff_abs_level_remaining; +- if (trans_coeff_level > (3 << c_rice_param)) +- c_rice_param = s->ps.sps->persistent_rice_adaptation_enabled_flag ? c_rice_param + 1 : FFMIN(c_rice_param + 1, 4); +- if (s->ps.sps->persistent_rice_adaptation_enabled_flag && !rice_init) { +- int c_rice_p_init = lc->stat_coeff[sb_type] / 4; +- if (last_coeff_abs_level_remaining >= (3 << c_rice_p_init)) +- lc->stat_coeff[sb_type]++; +- else if (2 * last_coeff_abs_level_remaining < (1 << c_rice_p_init)) +- if (lc->stat_coeff[sb_type] > 0) +- lc->stat_coeff[sb_type]--; +- rice_init = 1; +- } ++ } while (coded_vals != 0); + } +- if (s->ps.pps->sign_data_hiding_flag && sign_hidden) { +- sum_abs += trans_coeff_level; +- if (n == first_nz_pos_in_cg && (sum_abs&1)) +- trans_coeff_level = -trans_coeff_level; ++ ++ // sign_hidden = 0 or 1 so we can combine the tests ++ if ((sign_hidden & sum_abs) != 0) { ++ levels[nb_significant_coeff_flag - 1] = -levels[nb_significant_coeff_flag - 1]; + } +- if (coeff_sign_flag >> 15) +- trans_coeff_level = -trans_coeff_level; +- coeff_sign_flag <<= 1; +- if(!lc->cu.cu_transquant_bypass_flag) { +- if (s->ps.sps->scaling_list_enable_flag && !(transform_skip_flag && log2_trafo_size > 2)) { +- if(y_c || x_c || log2_trafo_size < 4) { +- switch(log2_trafo_size) { +- case 3: pos = (y_c << 3) + x_c; break; +- case 4: pos = ((y_c >> 1) << 3) + (x_c >> 1); break; +- case 5: pos = ((y_c >> 2) << 3) + (x_c >> 2); break; +- default: pos = (y_c << 2) + x_c; break; +- } +- scale_m = scale_matrix[pos]; +- } else { +- scale_m = dc_scale; +- } ++ ++ bypass_finish(s); ++ ++ // -- Finish bypass block ++ ++ // Scale loop ++ { ++ int m = nb_significant_coeff_flag - 1; ++ ++ // Deal with DC component (if any) first ++ if (i == 0 && significant_coeff_flag_idx[m] == 0) ++ { ++ const int k = (int32_t)(coeff_sign_flags << m) >> 31; ++ blk_coeffs[0] = trans_scale_sat( ++ (levels[m] ^ k) - k, scale, dc_scale, shift); ++ --m; + } +- trans_coeff_level = (trans_coeff_level * (int64_t)scale * (int64_t)scale_m + add) >> shift; +- if(trans_coeff_level < 0) { +- if((~trans_coeff_level) & 0xFffffffffff8000) +- trans_coeff_level = -32768; +- } else { +- if(trans_coeff_level & 0xffffffffffff8000) +- trans_coeff_level = 32767; ++ ++#if !USE_N_END_1 ++ // If N_END_! set then m was at least 1 initially ++ if (m >= 0) ++#endif ++ { ++ do { ++ const xy_off_t * const xy_off = scan_xy_off + ++ significant_coeff_flag_idx[m]; ++ const int k = (int32_t)(coeff_sign_flags << m) >> 31; ++ ++ blk_coeffs[xy_off->coeff] = trans_scale_sat( ++ (levels[m] ^ k) - k, ++ scale, ++ blk_scale[xy_off->scale], ++ shift); ++ } while (--m >= 0); + } + } +- coeffs[y_c * trafo_size + x_c] = trans_coeff_level; ++ + } + } +- } ++ } while ((i = next_subset(s, i, c_idx_nz, ++ significant_coeff_group_flag, scan_x_cg, scan_y_cg, &prev_sig)) >= 0); + + if (lc->cu.cu_transquant_bypass_flag) { + if (explicit_rdpcm_flag || (s->ps.sps->implicit_rdpcm_enabled_flag && +@@ -1496,7 +2078,7 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, + s->hevcdsp.transform_rdpcm(coeffs, log2_trafo_size, mode); + } + } else { +- if (transform_skip_flag) { ++ if (trans_skip_or_bypass) { // Must be trans_skip as we've already dealt with bypass + int rot = s->ps.sps->transform_skip_rotation_enabled_flag && + log2_trafo_size == 2 && + lc->cu.pred_mode == MODE_INTRA; +-- +2.5.0 + + diff --git a/packages/multimedia/ffmpeg/patches/ffmpeg-99.1005-0001-avcodec-add-h264_mvc-codec-id-and-profiles.patch b/packages/multimedia/ffmpeg/patches/ffmpeg-99.1005-0001-avcodec-add-h264_mvc-codec-id-and-profiles.patch new file mode 100644 index 00000000000..bce4e2597b1 --- /dev/null +++ b/packages/multimedia/ffmpeg/patches/ffmpeg-99.1005-0001-avcodec-add-h264_mvc-codec-id-and-profiles.patch @@ -0,0 +1,68 @@ +From f2e011c656b3579b6ede184bb5c56a7b97fad0f3 Mon Sep 17 00:00:00 2001 +From: Hendrik Leppkes <h.leppkes@gmail.com> +Date: Sat, 9 Jan 2016 15:34:09 +0100 +Subject: [PATCH] avcodec: add h264_mvc codec id and profiles + +avcodec: add h264_mvc codec id and profiles +--- + libavcodec/avcodec.h | 5 +++++ + libavcodec/codec_desc.c | 7 +++++++ + libavcodec/profiles.c | 3 +++ + libavformat/mpegts.c | 2 +- + 4 files changed, 16 insertions(+), 1 deletion(-) + +diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h +index f365775..8498921 100644 +--- a/libavcodec/avcodec.h ++++ b/libavcodec/avcodec.h +@@ -316,6 +316,8 @@ enum AVCodecID { + AV_CODEC_ID_APNG, + AV_CODEC_ID_DAALA, + ++ AV_CODEC_ID_H264_MVC, ++ + /* various PCM "codecs" */ + AV_CODEC_ID_FIRST_AUDIO = 0x10000, ///< A dummy id pointing at the start of audio codecs + AV_CODEC_ID_PCM_S16LE = 0x10000, +@@ -3086,6 +3088,9 @@ typedef struct AVCodecContext { + #define FF_PROFILE_H264_HIGH_444_PREDICTIVE 244 + #define FF_PROFILE_H264_HIGH_444_INTRA (244|FF_PROFILE_H264_INTRA) + #define FF_PROFILE_H264_CAVLC_444 44 ++#define FF_PROFILE_H264_MULTIVIEW_HIGH 118 ++#define FF_PROFILE_H264_STEREO_HIGH 128 ++#define FF_PROFILE_H264_MULTIVIEW_HIGH_DEPTH 138 + + #define FF_PROFILE_VC1_SIMPLE 0 + #define FF_PROFILE_VC1_MAIN 1 +diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c +index 5fbe624..9431bd8 100644 +--- a/libavcodec/codec_desc.c ++++ b/libavcodec/codec_desc.c +@@ -1521,6 +1521,13 @@ static const AVCodecDescriptor codec_descriptors[] = { + .props = AV_CODEC_PROP_LOSSLESS, + .mime_types= MT("image/png"), + }, ++ { ++ .id = AV_CODEC_ID_H264_MVC, ++ .type = AVMEDIA_TYPE_VIDEO, ++ .name = "h264_mvc", ++ .long_name = NULL_IF_CONFIG_SMALL("H264 MVC"), ++ .props = AV_CODEC_PROP_LOSSY, ++ }, + + /* various PCM "codecs" */ + { +diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c +index 22874e6..34b6987 100644 +--- a/libavformat/mpegts.c ++++ b/libavformat/mpegts.c +@@ -698,7 +698,7 @@ static const StreamType ISO_types[] = { + { 0x11, AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_AAC_LATM }, /* LATM syntax */ + #endif + { 0x1b, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_H264 }, +- { 0x20, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_H264 }, ++ { 0x20, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_H264_MVC }, + { 0x21, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_JPEG2000 }, + { 0x24, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_HEVC }, + { 0x42, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_CAVS }, + diff --git a/packages/multimedia/ffmpeg/patches/ffmpeg-99.1006-0001-h264_parser-add-support-for-parsing-h264-mvc-NALUs.patch b/packages/multimedia/ffmpeg/patches/ffmpeg-99.1006-0001-h264_parser-add-support-for-parsing-h264-mvc-NALUs.patch new file mode 100644 index 00000000000..fb4028881fe --- /dev/null +++ b/packages/multimedia/ffmpeg/patches/ffmpeg-99.1006-0001-h264_parser-add-support-for-parsing-h264-mvc-NALUs.patch @@ -0,0 +1,114 @@ +From 0b857974bc3f2f48800526efbe02b9e72fdeb266 Mon Sep 17 00:00:00 2001 +From: Hendrik Leppkes <h.leppkes@gmail.com> +Date: Sat, 9 Jan 2016 16:34:40 +0100 +Subject: [PATCH] h264_parser: add support for parsing h264 mvc NALUs + +--- + libavcodec/allcodecs.c | 1 + + libavcodec/h264.h | 2 ++ + libavcodec/h264_parser.c | 34 ++++++++++++++++++++++++++++++---- + 3 files changed, 33 insertions(+), 4 deletions(-) + +diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c +index 2097db0..66eb571 100644 +--- a/libavcodec/allcodecs.c ++++ b/libavcodec/allcodecs.c +@@ -633,6 +633,7 @@ void avcodec_register_all(void) + REGISTER_PARSER(H261, h261); + REGISTER_PARSER(H263, h263); + REGISTER_PARSER(H264, h264); ++ REGISTER_PARSER(H264_MVC, h264_mvc); + REGISTER_PARSER(HEVC, hevc); + REGISTER_PARSER(MJPEG, mjpeg); + REGISTER_PARSER(MLP, mlp); +diff --git a/libavcodec/h264.h b/libavcodec/h264.h +index 78f4eed..9e1d377 100644 +--- a/libavcodec/h264.h ++++ b/libavcodec/h264.h +@@ -123,7 +123,9 @@ enum { + NAL_END_STREAM = 11, + NAL_FILLER_DATA = 12, + NAL_SPS_EXT = 13, ++ NAL_SPS_SUBSET = 15, + NAL_AUXILIARY_SLICE = 19, ++ NAL_SLICE_EXT = 20, + NAL_FF_IGNORE = 0xff0f001, + }; + +diff --git a/libavcodec/h264_parser.c b/libavcodec/h264_parser.c +index 12d6397..4337c8c 100644 +--- a/libavcodec/h264_parser.c ++++ b/libavcodec/h264_parser.c +@@ -38,6 +38,7 @@ typedef struct H264ParseContext { + H264Context h; + ParseContext pc; + int got_first; ++ int is_mvc; + } H264ParseContext; + + +@@ -86,14 +87,18 @@ static int h264_find_frame_end(H264ParseContext *p, const uint8_t *buf, + } else if (state <= 5) { + int nalu_type = buf[i] & 0x1F; + if (nalu_type == NAL_SEI || nalu_type == NAL_SPS || +- nalu_type == NAL_PPS || nalu_type == NAL_AUD) { ++ nalu_type == NAL_PPS || nalu_type == NAL_AUD || ++ nalu_type == NAL_SPS_SUBSET) { + if (pc->frame_start_found) { + i++; + goto found; + } + } else if (nalu_type == NAL_SLICE || nalu_type == NAL_DPA || +- nalu_type == NAL_IDR_SLICE) { ++ nalu_type == NAL_IDR_SLICE || (p->is_mvc && nalu_type == NAL_SLICE_EXT)) { + state += 8; ++ ++ if (nalu_type == NAL_SLICE_EXT) ++ i += 3; // skip mvc extension + continue; + } + state = 7; +@@ -532,7 +537,8 @@ static int h264_parse(AVCodecParserContext *s, + } + } + +- parse_nal_units(s, avctx, buf, buf_size); ++ if (!p->is_mvc) ++ parse_nal_units(s, avctx, buf, buf_size); + + if (avctx->framerate.num) + avctx->time_base = av_inv_q(av_mul_q(avctx->framerate, (AVRational){avctx->ticks_per_frame, 1})); +@@ -569,7 +575,7 @@ static int h264_split(AVCodecContext *avctx, + if ((state & 0xFFFFFF00) != 0x100) + break; + nalu_type = state & 0x1F; +- if (nalu_type == NAL_SPS) { ++ if (nalu_type == NAL_SPS || nalu_type == NAL_SPS_SUBSET) { + has_sps = 1; + } else if (nalu_type == NAL_PPS) + has_pps = 1; +@@ -625,3 +631,23 @@ AVCodecParser ff_h264_parser = { + .parser_close = h264_close, + .split = h264_split, + }; ++ ++static av_cold int init_mvc(AVCodecParserContext *s) ++{ ++ H264ParseContext *p = s->priv_data; ++ int ret = init(s); ++ if (ret < 0) ++ return ret; ++ ++ p->is_mvc = 1; ++ return 0; ++} ++ ++AVCodecParser ff_h264_mvc_parser = { ++ .codec_ids = { AV_CODEC_ID_H264_MVC }, ++ .priv_data_size = sizeof(H264ParseContext), ++ .parser_init = init_mvc, ++ .parser_parse = h264_parse, ++ .parser_close = h264_close, ++ .split = h264_split, ++}; + diff --git a/packages/multimedia/ffmpeg/patches/ffmpeg-99.1007-h264_parser_fix_parsing_of_mvc_slices_in_some_corner_cases.patch b/packages/multimedia/ffmpeg/patches/ffmpeg-99.1007-h264_parser_fix_parsing_of_mvc_slices_in_some_corner_cases.patch new file mode 100644 index 00000000000..8b89f535187 --- /dev/null +++ b/packages/multimedia/ffmpeg/patches/ffmpeg-99.1007-h264_parser_fix_parsing_of_mvc_slices_in_some_corner_cases.patch @@ -0,0 +1,67 @@ +From fd627f6435db524f3e1fd8df6f64a17dcda5c8b9 Mon Sep 17 00:00:00 2001 +From: Hendrik Leppkes <h.leppkes@gmail.com> +Date: Fri, 26 Feb 2016 00:23:53 +0100 +Subject: [PATCH] h264_parser: fix parsing of mvc slices in some corner cases + +--- + libavcodec/h264.h | 2 +- + libavcodec/h264_parser.c | 10 +++++----- + 2 files changed, 6 insertions(+), 6 deletions(-) + +diff --git a/libavcodec/h264.h b/libavcodec/h264.h +index 9e1d377..846e4dc 100644 +--- a/libavcodec/h264.h ++++ b/libavcodec/h264.h +@@ -828,7 +828,7 @@ typedef struct H264Context { + int cur_bit_depth_luma; + int16_t slice_row[MAX_SLICES]; ///< to detect when MAX_SLICES is too low + +- uint8_t parse_history[6]; ++ uint8_t parse_history[9]; + int parse_history_count; + int parse_last_mb; + +diff --git a/libavcodec/h264_parser.c b/libavcodec/h264_parser.c +index 4337c8c..2fd3f2b 100644 +--- a/libavcodec/h264_parser.c ++++ b/libavcodec/h264_parser.c +@@ -39,6 +39,7 @@ typedef struct H264ParseContext { + ParseContext pc; + int got_first; + int is_mvc; ++ int slice_ext; + } H264ParseContext; + + +@@ -97,18 +98,17 @@ static int h264_find_frame_end(H264ParseContext *p, const uint8_t *buf, + nalu_type == NAL_IDR_SLICE || (p->is_mvc && nalu_type == NAL_SLICE_EXT)) { + state += 8; + +- if (nalu_type == NAL_SLICE_EXT) +- i += 3; // skip mvc extension ++ p->slice_ext = (nalu_type == NAL_SLICE_EXT); + continue; + } + state = 7; + } else { + h->parse_history[h->parse_history_count++]= buf[i]; +- if (h->parse_history_count>5) { ++ if (h->parse_history_count>8) { + unsigned int mb, last_mb= h->parse_last_mb; + GetBitContext gb; + +- init_get_bits(&gb, h->parse_history, 8*h->parse_history_count); ++ init_get_bits8(&gb, h->parse_history + 3*p->slice_ext, h->parse_history_count - 3*p->slice_ext); + h->parse_history_count=0; + mb= get_ue_golomb_long(&gb); + h->parse_last_mb= mb; +@@ -131,7 +131,7 @@ static int h264_find_frame_end(H264ParseContext *p, const uint8_t *buf, + pc->frame_start_found = 0; + if (h->is_avc) + return next_avc; +- return i - (state & 5) - 5 * (state > 7); ++ return i - (state & 5) - 8 * (state > 7); + } + + static int scan_mmco_reset(AVCodecParserContext *s) + diff --git a/packages/multimedia/ffmpeg/patches/ffmpeg-99.1008-73fde6f9f3d01f7fc0f3ae4b66f6c725f9fb1105.patch b/packages/multimedia/ffmpeg/patches/ffmpeg-99.1008-73fde6f9f3d01f7fc0f3ae4b66f6c725f9fb1105.patch new file mode 100644 index 00000000000..721a0654497 --- /dev/null +++ b/packages/multimedia/ffmpeg/patches/ffmpeg-99.1008-73fde6f9f3d01f7fc0f3ae4b66f6c725f9fb1105.patch @@ -0,0 +1,25 @@ +From 73fde6f9f3d01f7fc0f3ae4b66f6c725f9fb1105 Mon Sep 17 00:00:00 2001 +From: Hendrik Leppkes <h.leppkes@gmail.com> +Date: Mon, 1 Sep 2014 11:39:09 +0200 +Subject: [PATCH] h264_parser: force grabing a new timestamp until a frame + start was found + +--- + libavcodec/h264_parser.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/libavcodec/h264_parser.c b/libavcodec/h264_parser.c +index 2fd3f2b..7165652 100644 +--- a/libavcodec/h264_parser.c ++++ b/libavcodec/h264_parser.c +@@ -525,6 +525,9 @@ static int h264_parse(AVCodecParserContext *s, + } else { + next = h264_find_frame_end(p, buf, buf_size); + ++ if (next == END_NOT_FOUND && pc->frame_start_found == 0) ++ s->fetch_timestamp = 1; ++ + if (ff_combine_frame(pc, next, &buf, &buf_size) < 0) { + *poutbuf = NULL; + *poutbuf_size = 0; + diff --git a/packages/multimedia/ffmpeg/patches/ffmpeg-Speed_up_wtv_index_creation.patch b/packages/multimedia/ffmpeg/patches/ffmpeg-Speed_up_wtv_index_creation.patch deleted file mode 100644 index d8298982949..00000000000 --- a/packages/multimedia/ffmpeg/patches/ffmpeg-Speed_up_wtv_index_creation.patch +++ /dev/null @@ -1,47 +0,0 @@ -commit 0e7427498cb1131671f6fe9d054245ae7e5a36f5 -Author: popcornmix <popcornmix@gmail.com> -Date: Tue Mar 25 19:43:07 2014 +0000 - - [ffmpeg] Speed up wtv index creation - - The index creation is O(N^2) with number of entries (typically thousands). - On a Pi this can take more than 60 seconds to execute for a recording of a few hours. - - By replacing with an O(N) loop, this takes virtually zero time - -diff --git a/libavformat/wtvdec.c b/libavformat/wtvdec.c -index e423370..70898bd 100644 ---- a/libavformat/wtvdec.c -+++ b/libavformat/wtvdec.c -@@ -980,21 +980,23 @@ static int read_header(AVFormatContext *s) - pb = wtvfile_open(s, root, root_size, ff_timeline_table_0_entries_Events_le16); - if (pb) { - int i; -+ AVIndexEntry *e = wtv->index_entries; -+ AVIndexEntry *e_end = wtv->index_entries + wtv->nb_index_entries - 1; -+ uint64_t last_position = 0; - while (1) { - uint64_t frame_nb = avio_rl64(pb); - uint64_t position = avio_rl64(pb); -+ while (frame_nb > e->size && e <= e_end) { -+ e->pos = last_position; -+ e++; -+ } - if (avio_feof(pb)) - break; -- for (i = wtv->nb_index_entries - 1; i >= 0; i--) { -- AVIndexEntry *e = wtv->index_entries + i; -- if (frame_nb > e->size) -- break; -- if (position > e->pos) -- e->pos = position; -- } -+ last_position = position; - } -+ e_end->pos = last_position; - wtvfile_close(pb); -- st->duration = wtv->index_entries[wtv->nb_index_entries - 1].timestamp; -+ st->duration = e_end->timestamp; - } - } - } diff --git a/packages/multimedia/libamcodec/package.mk b/packages/multimedia/libamcodec/package.mk index e5b84b8a780..32993ee16d7 100644 --- a/packages/multimedia/libamcodec/package.mk +++ b/packages/multimedia/libamcodec/package.mk @@ -17,12 +17,20 @@ ################################################################################ PKG_NAME="libamcodec" -PKG_VERSION="45a1086" PKG_REV="1" -PKG_ARCH="arm" +PKG_ARCH="arm aarch64" PKG_LICENSE="other" PKG_SITE="http://openlinux.amlogic.com" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +case $PROJECT in + WeTek_Core|WeTek_Play) + PKG_VERSION="45a1086" + PKG_URL="https://github.com/codesnake/libamcodec/archive/$PKG_VERSION.tar.gz" + ;; + Odroid_C2) + PKG_VERSION="210755d" + PKG_URL="http://amlinux.ru/source/$PKG_NAME-$PKG_VERSION.tar.gz" + ;; +esac PKG_DEPENDS_TARGET="toolchain" PKG_PRIORITY="optional" PKG_SECTION="multimedia" diff --git a/packages/multimedia/libbdplus/package.mk b/packages/multimedia/libbdplus/package.mk index 4111baa2681..067b5fc179f 100644 --- a/packages/multimedia/libbdplus/package.mk +++ b/packages/multimedia/libbdplus/package.mk @@ -22,7 +22,7 @@ PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="https://www.videolan.org/developers/libbdplus.html" -PKG_URL="ftp://ftp.videolan.org/pub/videolan/libbdplus/$PKG_VERSION/$PKG_NAME-$PKG_VERSION.tar.bz2" +PKG_URL="https://ftp.videolan.org/pub/videolan/$PKG_NAME/$PKG_VERSION/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS_TARGET="toolchain libgcrypt libgpg-error" PKG_PRIORITY="optional" PKG_SECTION="multimedia" diff --git a/packages/multimedia/libdvdcss/package.mk b/packages/multimedia/libdvdcss/package.mk new file mode 100644 index 00000000000..0184aa1dbc5 --- /dev/null +++ b/packages/multimedia/libdvdcss/package.mk @@ -0,0 +1,35 @@ +################################################################################ +# This file is part of LibreELEC - http://www.libreelec.tv +# Copyright (C) 2009-2016 Team LibreELEC (team@libreelec.tv) +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see <http://www.gnu.org/licenses/>. +################################################################################ + +PKG_NAME="libdvdcss" +PKG_VERSION="2f12236" +PKG_REV="1" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/xbmc/libdvdcss" +PKG_URL="https://github.com/xbmc/libdvdcss/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain" +PKG_PRIORITY="optional" +PKG_SECTION="multimedia" +PKG_SHORTDESC="libdvdcss: a simple library designed for accessing DVDs as a block device without having to bother about the decryption." +PKG_LONGDESC="libdvdcss is a simple library designed for accessing DVDs as a block device without having to bother about the decryption." + +PKG_IS_ADDON="no" +PKG_AUTORECONF="yes" + +PKG_CONFIGURE_OPTS_TARGET="--enable-static --disable-shared --with-pic" diff --git a/packages/multimedia/libdvdnav/package.mk b/packages/multimedia/libdvdnav/package.mk new file mode 100644 index 00000000000..e9f6872d145 --- /dev/null +++ b/packages/multimedia/libdvdnav/package.mk @@ -0,0 +1,39 @@ +################################################################################ +# This file is part of LibreELEC - http://www.libreelec.tv +# Copyright (C) 2009-2016 Team LibreELEC (team@libreelec.tv) +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see <http://www.gnu.org/licenses/>. +################################################################################ + +PKG_NAME="libdvdnav" +PKG_VERSION="43b5f81" +PKG_REV="1" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/xbmc/libdvdnav" +PKG_URL="https://github.com/xbmc/libdvdnav/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain libdvdread" +PKG_PRIORITY="optional" +PKG_SECTION="multimedia" +PKG_SHORTDESC="libdvdnav: a library that allows easy use of sophisticated DVD navigation features such as DVD menus, multiangle playback and even interactive DVD games." +PKG_LONGDESC="libdvdnav is a library that allows easy use of sophisticated DVD navigation features such as DVD menus, multiangle playback and even interactive DVD games." + +PKG_IS_ADDON="no" +PKG_AUTORECONF="yes" + +PKG_CONFIGURE_OPTS_TARGET="--enable-static --disable-shared --with-pic" + +pre_configure_target() { + export CFLAGS="$CFLAGS -D_XBMC -DHAVE_DVDCSS_DVDCSS_H" +} diff --git a/packages/multimedia/libdvdread/package.mk b/packages/multimedia/libdvdread/package.mk new file mode 100644 index 00000000000..99d742179a4 --- /dev/null +++ b/packages/multimedia/libdvdread/package.mk @@ -0,0 +1,39 @@ +################################################################################ +# This file is part of LibreELEC - http://www.libreelec.tv +# Copyright (C) 2009-2016 Team LibreELEC (team@libreelec.tv) +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see <http://www.gnu.org/licenses/>. +################################################################################ + +PKG_NAME="libdvdread" +PKG_VERSION="17d99db" +PKG_REV="1" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/xbmc/libdvdread" +PKG_URL="https://github.com/xbmc/libdvdread/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain libdvdcss" +PKG_PRIORITY="optional" +PKG_SECTION="multimedia" +PKG_SHORTDESC="libdvdread: a library which provides a simple foundation for reading DVDs." +PKG_LONGDESC="libdvdread is a library which provides a simple foundation for reading DVDs." + +PKG_IS_ADDON="no" +PKG_AUTORECONF="yes" + +PKG_CONFIGURE_OPTS_TARGET="--enable-static --disable-shared --with-libdvdcss --with-pic" + +pre_configure_target() { + export CFLAGS="$CFLAGS -D_XBMC -DHAVE_DVDCSS_DVDCSS_H" +} diff --git a/packages/multimedia/libva-intel-driver/package.mk b/packages/multimedia/libva-intel-driver/package.mk index 3dcd68ec19b..dac7575200e 100644 --- a/packages/multimedia/libva-intel-driver/package.mk +++ b/packages/multimedia/libva-intel-driver/package.mk @@ -17,7 +17,7 @@ ################################################################################ PKG_NAME="libva-intel-driver" -PKG_VERSION="1.6.2" +PKG_VERSION="1.7.0" PKG_REV="1" PKG_ARCH="x86_64" PKG_LICENSE="GPL" diff --git a/packages/multimedia/libva/package.mk b/packages/multimedia/libva/package.mk index 3fa40497735..58b1e53b075 100644 --- a/packages/multimedia/libva/package.mk +++ b/packages/multimedia/libva/package.mk @@ -17,7 +17,7 @@ ################################################################################ PKG_NAME="libva" -PKG_VERSION="1.6.2" +PKG_VERSION="1.7.0" PKG_REV="1" PKG_ARCH="x86_64" PKG_LICENSE="GPL" @@ -37,7 +37,7 @@ PKG_CONFIGURE_OPTS_TARGET="--disable-silent-rules \ --enable-drm \ --enable-x11 \ --enable-glx \ - --disable-egl \ + --enable-egl \ --disable-wayland \ --disable-dummy-driver \ --with-drivers-path=/usr/lib/va" diff --git a/packages/multimedia/rtmpdump/package.mk b/packages/multimedia/rtmpdump/package.mk index 2f431843dd2..ffb0f6ea2bf 100644 --- a/packages/multimedia/rtmpdump/package.mk +++ b/packages/multimedia/rtmpdump/package.mk @@ -22,8 +22,7 @@ PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://rtmpdump.mplayerhq.hu/" -#PKG_URL="http://rtmpdump.mplayerhq.hu/download/$PKG_NAME-$PKG_VERSION.tgz" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_URL="http://repo.or.cz/rtmpdump.git/snapshot/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain zlib libressl" PKG_PRIORITY="optional" PKG_SECTION="multimedia" diff --git a/packages/multimedia/vdr-satip/patches/vdr-satip-02-upstream.patch b/packages/multimedia/vdr-satip/patches/vdr-satip-02-upstream.patch deleted file mode 100644 index 4f459f510f3..00000000000 --- a/packages/multimedia/vdr-satip/patches/vdr-satip-02-upstream.patch +++ /dev/null @@ -1,402 +0,0 @@ -From 165fd5b14af2327f3cd5d5b6fbe814737a0ea423 Mon Sep 17 00:00:00 2001 -From: Tobias Grimm <etobi@debian.org> -Date: Sat, 5 Dec 2015 16:59:28 +0100 -Subject: [PATCH 1/5] Reorderd the transponder URL parameter in a way the - Panasonic CXW804 expects them (src/freq/pol/ro/msys/mtype/plts/sr/fec) - -This only applies to DVB-S. DVB-C and DVB-T might need further tweaking. -It's actually a bug of the Panasonic TV to expect the transponder parameters in -a specific order in the query string, but for now this seems to be the most -pragmatic workaround. ---- - param.c | 22 +++++++++++----------- - 1 file changed, 11 insertions(+), 11 deletions(-) - -diff --git a/param.c b/param.c -index c71902d..b5eaf1c 100644 ---- a/param.c -+++ b/param.c -@@ -163,11 +163,20 @@ cString GetTransponderUrlParameters(const cChannel *channelP) - dtp.SetModulation(QPSK); - dtp.SetRollOff(ROLLOFF_35); - } -+ ST(" S *") q += snprintf(q, STBUFLEFT, "src=%d&", ((src > 0) && (src <= 255)) ? src : 1); - q += snprintf(q, STBUFLEFT, "freq=%s", *dtoa(freq, "%lg")); -- ST(" S *") q += snprintf(q, STBUFLEFT, "&src=%d", ((src > 0) && (src <= 255)) ? src : 1); -+ ST(" S *") q += snprintf(q, STBUFLEFT, "&pol=%c", tolower(dtp.Polarization())); -+ ST(" S *") q += PrintUrlString(q, STBUFLEFT, dtp.RollOff(), SatipRollOffValues); -+ ST(" S *") q += PrintUrlString(q, STBUFLEFT, dtp.System(), SatipSystemValuesSat); -+ ST("C *") q += PrintUrlString(q, STBUFLEFT, dtp.System(), SatipSystemValuesCable); -+ ST(" T*") q += PrintUrlString(q, STBUFLEFT, dtp.System(), SatipSystemValuesTerrestrial); -+ ST(" S *") q += PrintUrlString(q, STBUFLEFT, dtp.Modulation(), SatipModulationValues); -+ ST(" T*") q += PrintUrlString(q, STBUFLEFT, dtp.Modulation(), SatipModulationValues); -+ ST("C 1") q += PrintUrlString(q, STBUFLEFT, dtp.Modulation(), SatipModulationValues); -+ ST(" S *") q += PrintUrlString(q, STBUFLEFT, dtp.Pilot(), SatipPilotValues); - ST(" S *") q += snprintf(q, STBUFLEFT, "&sr=%d", channelP->Srate()); -+ ST("CST*") q += PrintUrlString(q, STBUFLEFT, dtp.CoderateH(), SatipCodeRateValues); - ST("C 1") q += snprintf(q, STBUFLEFT, "&sr=%d", channelP->Srate()); -- ST(" S *") q += snprintf(q, STBUFLEFT, "&pol=%c", tolower(dtp.Polarization())); - ST("C T2") q += snprintf(q, STBUFLEFT, "&plp=%d", dtp.StreamId()); - ST(" T2") q += snprintf(q, STBUFLEFT, "&t2id=%d", dtp.T2SystemId()); - ST("C 2") q += snprintf(q, STBUFLEFT, "&c2tft=%d", C2TuningFrequencyType); -@@ -177,15 +186,6 @@ cString GetTransponderUrlParameters(const cChannel *channelP) - ST(" T*") q += PrintUrlString(q, STBUFLEFT, dtp.Bandwidth(), SatipBandwidthValues); - ST("C 2") q += PrintUrlString(q, STBUFLEFT, dtp.Bandwidth(), SatipBandwidthValues); - ST(" T*") q += PrintUrlString(q, STBUFLEFT, dtp.Guard(), SatipGuardValues); -- ST("CST*") q += PrintUrlString(q, STBUFLEFT, dtp.CoderateH(), SatipCodeRateValues); -- ST(" S *") q += PrintUrlString(q, STBUFLEFT, dtp.Pilot(), SatipPilotValues); -- ST(" S *") q += PrintUrlString(q, STBUFLEFT, dtp.Modulation(), SatipModulationValues); -- ST(" T*") q += PrintUrlString(q, STBUFLEFT, dtp.Modulation(), SatipModulationValues); -- ST("C 1") q += PrintUrlString(q, STBUFLEFT, dtp.Modulation(), SatipModulationValues); -- ST(" S *") q += PrintUrlString(q, STBUFLEFT, dtp.RollOff(), SatipRollOffValues); -- ST(" S *") q += PrintUrlString(q, STBUFLEFT, dtp.System(), SatipSystemValuesSat); -- ST("C *") q += PrintUrlString(q, STBUFLEFT, dtp.System(), SatipSystemValuesCable); -- ST(" T*") q += PrintUrlString(q, STBUFLEFT, dtp.System(), SatipSystemValuesTerrestrial); - ST(" T*") q += PrintUrlString(q, STBUFLEFT, dtp.Transmission(), SatipTransmissionValues); - if ((channelP->Rid() % 100) > 0) - snprintf(q, STBUFLEFT, "&fe=%d", channelP->Rid() % 100); - -From c1a881ba9459146541ef07ea1519fd45e5603d2c Mon Sep 17 00:00:00 2001 -From: Rolf Ahrenberg <Rolf.Ahrenberg@sci.fi> -Date: Sat, 5 Dec 2015 20:23:32 +0200 -Subject: [PATCH 2/5] Reorder also terrestrial and cable query parameters as - introduced in the satip specification 1.2.2, although the ordering shouldn't - matter according to it. - ---- - param.c | 20 ++++++++++---------- - 1 file changed, 10 insertions(+), 10 deletions(-) - -diff --git a/param.c b/param.c -index b5eaf1c..c9c4529 100644 ---- a/param.c -+++ b/param.c -@@ -163,32 +163,32 @@ cString GetTransponderUrlParameters(const cChannel *channelP) - dtp.SetModulation(QPSK); - dtp.SetRollOff(ROLLOFF_35); - } -+ if ((channelP->Rid() % 100) > 0) -+ q += snprintf(q, STBUFLEFT, "&fe=%d", channelP->Rid() % 100); - ST(" S *") q += snprintf(q, STBUFLEFT, "src=%d&", ((src > 0) && (src <= 255)) ? src : 1); - q += snprintf(q, STBUFLEFT, "freq=%s", *dtoa(freq, "%lg")); - ST(" S *") q += snprintf(q, STBUFLEFT, "&pol=%c", tolower(dtp.Polarization())); - ST(" S *") q += PrintUrlString(q, STBUFLEFT, dtp.RollOff(), SatipRollOffValues); -+ ST("C 2") q += snprintf(q, STBUFLEFT, "&c2tft=%d", C2TuningFrequencyType); -+ ST(" T*") q += PrintUrlString(q, STBUFLEFT, dtp.Bandwidth(), SatipBandwidthValues); -+ ST("C 2") q += PrintUrlString(q, STBUFLEFT, dtp.Bandwidth(), SatipBandwidthValues); - ST(" S *") q += PrintUrlString(q, STBUFLEFT, dtp.System(), SatipSystemValuesSat); - ST("C *") q += PrintUrlString(q, STBUFLEFT, dtp.System(), SatipSystemValuesCable); - ST(" T*") q += PrintUrlString(q, STBUFLEFT, dtp.System(), SatipSystemValuesTerrestrial); -+ ST(" T*") q += PrintUrlString(q, STBUFLEFT, dtp.Transmission(), SatipTransmissionValues); - ST(" S *") q += PrintUrlString(q, STBUFLEFT, dtp.Modulation(), SatipModulationValues); - ST(" T*") q += PrintUrlString(q, STBUFLEFT, dtp.Modulation(), SatipModulationValues); - ST("C 1") q += PrintUrlString(q, STBUFLEFT, dtp.Modulation(), SatipModulationValues); - ST(" S *") q += PrintUrlString(q, STBUFLEFT, dtp.Pilot(), SatipPilotValues); - ST(" S *") q += snprintf(q, STBUFLEFT, "&sr=%d", channelP->Srate()); -- ST("CST*") q += PrintUrlString(q, STBUFLEFT, dtp.CoderateH(), SatipCodeRateValues); - ST("C 1") q += snprintf(q, STBUFLEFT, "&sr=%d", channelP->Srate()); -+ ST(" T*") q += PrintUrlString(q, STBUFLEFT, dtp.Guard(), SatipGuardValues); -+ ST("CST*") q += PrintUrlString(q, STBUFLEFT, dtp.CoderateH(), SatipCodeRateValues); -+ ST("C 2") q += snprintf(q, STBUFLEFT, "&ds=%d", DataSlice); - ST("C T2") q += snprintf(q, STBUFLEFT, "&plp=%d", dtp.StreamId()); - ST(" T2") q += snprintf(q, STBUFLEFT, "&t2id=%d", dtp.T2SystemId()); -- ST("C 2") q += snprintf(q, STBUFLEFT, "&c2tft=%d", C2TuningFrequencyType); -- ST("C 2") q += snprintf(q, STBUFLEFT, "&ds=%d", DataSlice); -- ST("C 1") q += PrintUrlString(q, STBUFLEFT, dtp.Inversion(), SatipInversionValues); - ST(" T2") q += PrintUrlString(q, STBUFLEFT, dtp.SisoMiso(), SatipSisoMisoValues); -- ST(" T*") q += PrintUrlString(q, STBUFLEFT, dtp.Bandwidth(), SatipBandwidthValues); -- ST("C 2") q += PrintUrlString(q, STBUFLEFT, dtp.Bandwidth(), SatipBandwidthValues); -- ST(" T*") q += PrintUrlString(q, STBUFLEFT, dtp.Guard(), SatipGuardValues); -- ST(" T*") q += PrintUrlString(q, STBUFLEFT, dtp.Transmission(), SatipTransmissionValues); -- if ((channelP->Rid() % 100) > 0) -- snprintf(q, STBUFLEFT, "&fe=%d", channelP->Rid() % 100); -+ ST("C 1") q += PrintUrlString(q, STBUFLEFT, dtp.Inversion(), SatipInversionValues); - #undef ST - return buffer; - } - -From 9d5f7cc7030657f38c56f6041ff7f697774a9624 Mon Sep 17 00:00:00 2001 -From: chriszero <zerov83@gmail.com> -Date: Thu, 7 Jan 2016 20:56:39 +0100 -Subject: [PATCH 3/5] Make it possible to specify the rtp and rtcp ports this - makes it possible to use the satip through a NAT (e.g. a docker bridged - network) - ---- - README | 5 +++++ - config.c | 2 ++ - config.h | 6 ++++++ - satip.c | 40 ++++++++++++++++++++++++++++++++++++++-- - socket.c | 4 ++-- - socket.h | 2 +- - tuner.c | 7 +++++-- - 7 files changed, 59 insertions(+), 7 deletions(-) - -diff --git a/README b/README -index 49b0b38..1c3b610 100644 ---- a/README -+++ b/README -@@ -56,6 +56,11 @@ vdr -P 'satip -s <ipaddress>|<model>|<description>;...' - vdr -P 'satip -s 192.168.0.1|DVBS2-2,DVBT2-2|Octo1' - vdr -P 'satip -s 192.168.0.1|DVBS2-4|Octo1;192.168.0.2|DVBT2-4|Octo2' - -+The plugin accepts a "--portrange" (-p) command-line parameter, that can -+be used to manually specify the RTP & RTCP port range and therefore -+enables using the plugin through a NAT (e.g. Docker bridged network). -+A minimum of 2 ports per device is required. -+ - SAT>IP satellite positions (aka. signal sources) shall be defined via - sources.conf. If the source description begins with a number, it's used - as SAT>IP signal source selection parameter. A special number zero can -diff --git a/config.c b/config.c -index 050453c..2243aaa 100644 ---- a/config.c -+++ b/config.c -@@ -17,6 +17,8 @@ cSatipConfig::cSatipConfig(void) - ciExtensionM(0), - eitScanM(1), - useBytesM(1), -+ portRangeStartM(0), -+ portRangeStopM(0), - detachedModeM(false), - disableServerQuirksM(false), - useSingleModelServersM(false) -diff --git a/config.h b/config.h -index b7745cf..b11b1d8 100644 ---- a/config.h -+++ b/config.h -@@ -19,6 +19,8 @@ class cSatipConfig - unsigned int ciExtensionM; - unsigned int eitScanM; - unsigned int useBytesM; -+ unsigned int portRangeStartM; -+ unsigned int portRangeStopM; - bool detachedModeM; - bool disableServerQuirksM; - bool useSingleModelServersM; -@@ -74,6 +76,8 @@ class cSatipConfig - int GetDisabledSources(unsigned int indexP) const; - unsigned int GetDisabledFiltersCount(void) const; - int GetDisabledFilters(unsigned int indexP) const; -+ unsigned int GetPortRangeStart(void) const { return portRangeStartM; } -+ unsigned int GetPortRangeStop(void) const { return portRangeStopM; } - - void SetOperatingMode(unsigned int operatingModeP) { operatingModeM = operatingModeP; } - void SetTraceMode(unsigned int modeP) { traceModeM = (modeP & eTraceModeMask); } -@@ -86,6 +90,8 @@ class cSatipConfig - void SetUseSingleModelServers(bool onOffP) { useSingleModelServersM = onOffP; } - void SetDisabledSources(unsigned int indexP, int sourceP); - void SetDisabledFilters(unsigned int indexP, int numberP); -+ void SetPortRangeStart(unsigned int rangeStartP) { portRangeStartM = rangeStartP; } -+ void SetPortRangeStop(unsigned int rangeStopP) { portRangeStopM = rangeStopP; } - }; - - extern cSatipConfig SatipConfig; -diff --git a/satip.c b/satip.c -index 3453c48..35a92fe 100644 ---- a/satip.c -+++ b/satip.c -@@ -35,6 +35,7 @@ class cPluginSatip : public cPlugin { - unsigned int deviceCountM; - cSatipDiscoverServers *serversM; - void ParseServer(const char *paramP); -+ void ParsePortRange(const char *paramP); - int ParseCicams(const char *valueP, int *cicamsP); - int ParseSources(const char *valueP, int *sourcesP); - int ParseFilters(const char *valueP, int *filtersP); -@@ -87,7 +88,9 @@ const char *cPluginSatip::CommandLineHelp(void) - " define hard-coded SAT>IP server(s)\n" - " -D, --detach set the detached mode on\n" - " -S, --single set the single model server mode on\n" -- " -n, --noquirks disable all the server quirks\n"; -+ " -n, --noquirks disable all the server quirks\n" -+ " -p, --portrange=<start>-<end> set a range of ports used for the RT[C]P server\n" -+ " a minimum of 2 ports per device is required.\n"; - } - - bool cPluginSatip::ProcessArgs(int argc, char *argv[]) -@@ -98,6 +101,7 @@ bool cPluginSatip::ProcessArgs(int argc, char *argv[]) - { "devices", required_argument, NULL, 'd' }, - { "trace", required_argument, NULL, 't' }, - { "server", required_argument, NULL, 's' }, -+ { "portrange",required_argument, NULL, 'p' }, - { "detach", no_argument, NULL, 'D' }, - { "single", no_argument, NULL, 'S' }, - { "noquirks", no_argument, NULL, 'n' }, -@@ -105,8 +109,9 @@ bool cPluginSatip::ProcessArgs(int argc, char *argv[]) - }; - - cString server; -+ cString portrange; - int c; -- while ((c = getopt_long(argc, argv, "d:t:s:DSn", long_options, NULL)) != -1) { -+ while ((c = getopt_long(argc, argv, "d:t:s:p:DSn", long_options, NULL)) != -1) { - switch (c) { - case 'd': - deviceCountM = strtol(optarg, NULL, 0); -@@ -126,10 +131,15 @@ bool cPluginSatip::ProcessArgs(int argc, char *argv[]) - case 'n': - SatipConfig.SetDisableServerQuirks(true); - break; -+ case 'p': -+ portrange = optarg; -+ break; - default: - return false; - } - } -+ if (!isempty(*portrange)) -+ ParsePortRange(portrange); - // this must be done after all parameters are parsed - if (!isempty(*server)) - ParseServer(*server); -@@ -255,6 +265,32 @@ void cPluginSatip::ParseServer(const char *paramP) - FREE_POINTER(p); - } - -+void cPluginSatip::ParsePortRange(const char *paramP) -+{ -+ char *s, *p = skipspace(paramP); -+ char *r = strtok_r(p, "-", &s); -+ unsigned int rangeStart = 0; -+ unsigned int rangeStop = 0; -+ if (r) { -+ rangeStart = strtol(r, NULL, 0); -+ r = strtok_r(NULL, "-", &s); -+ } -+ if (r) -+ rangeStop = strtol(r, NULL, 0); -+ else { -+ error("Port range argument not valid '%s'", paramP); -+ rangeStart = 0; -+ rangeStop = 0; -+ } -+ if (rangeStop - rangeStart + 1 < deviceCountM * 2) { -+ error("The given port range is to small: %d < %d!", rangeStop - rangeStart + 1, deviceCountM * 2); -+ rangeStart = 0; -+ rangeStop = 0; -+ } -+ SatipConfig.SetPortRangeStart(rangeStart); -+ SatipConfig.SetPortRangeStop(rangeStop); -+} -+ - int cPluginSatip::ParseCicams(const char *valueP, int *cicamsP) - { - debug1("%s (%s,)", __PRETTY_FUNCTION__, valueP); -diff --git a/socket.c b/socket.c -index 29c2602..35bc035 100644 ---- a/socket.c -+++ b/socket.c -@@ -34,7 +34,7 @@ cSatipSocket::~cSatipSocket() - Close(); - } - --bool cSatipSocket::Open(const int portP) -+bool cSatipSocket::Open(const int portP, const bool reuseAddrP) - { - // Bind to the socket if it is not active already - if (socketDescM < 0) { -@@ -46,7 +46,7 @@ bool cSatipSocket::Open(const int portP) - ERROR_IF_FUNC(fcntl(socketDescM, F_SETFL, O_NONBLOCK), "fcntl(O_NONBLOCK)", - Close(), return false); - // Allow multiple sockets to use the same PORT number -- int yes = 1; -+ int yes = reuseAddrP; - ERROR_IF_FUNC(setsockopt(socketDescM, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(yes)) < 0, - "setsockopt(SO_REUSEADDR)", Close(), return false); - // Bind socket -diff --git a/socket.h b/socket.h -index f9a93d8..79bc991 100644 ---- a/socket.h -+++ b/socket.h -@@ -19,7 +19,7 @@ class cSatipSocket { - public: - cSatipSocket(); - virtual ~cSatipSocket(); -- bool Open(const int portP = 0); -+ bool Open(const int portP = 0, const bool reuseAddrP = false); - virtual void Close(void); - int Fd(void) { return socketDescM; } - int Port(void) { return socketPortM; } -diff --git a/tuner.c b/tuner.c -index c12a19e..fc47b51 100644 ---- a/tuner.c -+++ b/tuner.c -@@ -50,12 +50,15 @@ cSatipTuner::cSatipTuner(cSatipDeviceIf &deviceP, unsigned int packetLenP) - debug1("%s (, %d) [device %d]", __PRETTY_FUNCTION__, packetLenP, deviceIdM); - - // Open sockets -- int i = 100; -+ int i = SatipConfig.GetPortRangeStart() ? SatipConfig.GetPortRangeStop() - SatipConfig.GetPortRangeStart() - 1 : 100; -+ int port = SatipConfig.GetPortRangeStart(); - while (i-- > 0) { -- if (rtpM.Open(0) && rtcpM.Open(rtpM.Port() + 1)) -+ if (rtpM.Open(port) && rtcpM.Open(rtpM.Port() + 1)) - break; - rtpM.Close(); - rtcpM.Close(); -+ if (SatipConfig.GetPortRangeStart()) -+ ++port; - } - if ((rtpM.Port() <= 0) || (rtcpM.Port() <= 0)) { - error("Cannot open required RTP/RTCP ports [device %d]", deviceIdM); - -From 8f12ce6f55d0db46e516cf9f471438f8ed84c403 Mon Sep 17 00:00:00 2001 -From: Rolf Ahrenberg <Rolf.Ahrenberg@sci.fi> -Date: Sat, 30 Jan 2016 21:41:10 +0200 -Subject: [PATCH 4/5] Add a missing device name update. - ---- - device.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/device.c b/device.c -index ad96434..4a59291 100644 ---- a/device.c -+++ b/device.c -@@ -355,6 +355,7 @@ bool cSatipDevice::SetChannelDevice(const cChannel *channelP, bool liveViewP) - } - else if (pTunerM) { - pTunerM->SetSource(NULL, 0, NULL, deviceIndexM); -+ deviceNameM = cString::sprintf("%s %d", *DeviceType(), deviceIndexM); - return true; - } - return false; - -From b755dbf318874e4dadc5f4e4c7405e90dc4eeb2e Mon Sep 17 00:00:00 2001 -From: Tobias Grimm <git@e-tobi.net> -Date: Sat, 23 Jan 2016 18:38:44 +0100 -Subject: [PATCH 5/5] C++11 requires a mandatory space when concatenating - string literals - ---- - common.h | 18 +++++++++--------- - 1 file changed, 9 insertions(+), 9 deletions(-) - -diff --git a/common.h b/common.h -index ac9ea20..c85404b 100644 ---- a/common.h -+++ b/common.h -@@ -48,15 +48,15 @@ - esyslog("curl_easy_perform() [%s,%d] failed: %s (%d)", __FILE__, __LINE__, curl_easy_strerror(res), res); \ - } - --#define ERROR_IF_FUNC(exp, errstr, func, ret) \ -- do { \ -- if (exp) { \ -- char tmp[64]; \ -- esyslog("[%s,%d]: "errstr": %s", __FILE__, __LINE__, \ -- strerror_r(errno, tmp, sizeof(tmp))); \ -- func; \ -- ret; \ -- } \ -+#define ERROR_IF_FUNC(exp, errstr, func, ret) \ -+ do { \ -+ if (exp) { \ -+ char tmp[64]; \ -+ esyslog("[%s,%d]: " errstr ": %s", __FILE__, __LINE__, \ -+ strerror_r(errno, tmp, sizeof(tmp))); \ -+ func; \ -+ ret; \ -+ } \ - } while (0) diff --git a/packages/network/avahi/system.d/avahi-daemon.service b/packages/network/avahi/system.d/avahi-daemon.service index ef4478669a9..63cd640cb8a 100644 --- a/packages/network/avahi/system.d/avahi-daemon.service +++ b/packages/network/avahi/system.d/avahi-daemon.service @@ -6,7 +6,7 @@ ConditionPathExists=/storage/.cache/services/avahi.conf [Service] Restart=on-failure -EnvironmentFile=-/run/openelec/debug/avahi.conf +EnvironmentFile=-/run/libreelec/debug/avahi.conf ExecStart=/usr/sbin/avahi-daemon -s $AVAHI_DEBUG ExecReload=/usr/sbin/avahi-daemon -r TimeoutStopSec=1s diff --git a/packages/network/bluez/package.mk b/packages/network/bluez/package.mk index 610b2a40c9f..252c4a68020 100644 --- a/packages/network/bluez/package.mk +++ b/packages/network/bluez/package.mk @@ -17,7 +17,7 @@ ################################################################################ PKG_NAME="bluez" -PKG_VERSION="5.37" +PKG_VERSION="5.39" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" @@ -64,6 +64,8 @@ pre_configure_target() { # bluez fails to build in subdirs cd $ROOT/$PKG_BUILD rm -rf .$TARGET_NAME + + export LIBS="-ltermcap" } post_makeinstall_target() { diff --git a/packages/network/bluez/patches/bluez-11_sixaxis-fix-PID-navigation-controller.patch b/packages/network/bluez/patches/bluez-11_sixaxis-fix-PID-navigation-controller.patch new file mode 100644 index 00000000000..60b4067e758 --- /dev/null +++ b/packages/network/bluez/patches/bluez-11_sixaxis-fix-PID-navigation-controller.patch @@ -0,0 +1,56 @@ +From: Szymon Janc <szymon.janc@...> +Subject: [PATCH 1/5] sixaxis: Fix PID for Navigation Controller +Newsgroups: gmane.linux.bluez.kernel +Date: 2015-06-15 18:28:26 GMT (36 weeks, 4 days, 21 hours and 32 minutes ago) + +Navigation Controller is using PID 0x042f over USB but PID 0x0268 +(same as Dualshock 3) over BT. +--- + plugins/sixaxis.c | 17 +++++++++++++++-- + 1 file changed, 15 insertions(+), 2 deletions(-) + +diff --git a/plugins/sixaxis.c b/plugins/sixaxis.c +index fcc93bc..50db6c1 100644 +--- a/plugins/sixaxis.c ++++ b/plugins/sixaxis.c +@@ -54,6 +54,7 @@ static const struct { + uint16_t vid; + uint16_t pid; + uint16_t version; ++ uint16_t bt_pid; + } devices[] = { + { + .name = "PLAYSTATION(R)3 Controller", +@@ -68,6 +69,7 @@ static const struct { + .vid = 0x054c, + .pid = 0x042f, + .version = 0x0000, ++ .bt_pid = 0x0268, + }, + }; + +@@ -300,8 +302,19 @@ static bool setup_device(int fd, int index, struct btd_adapter *adapter) + info("sixaxis: setting up new device"); + + btd_device_device_set_name(device, devices[index].name); +- btd_device_set_pnpid(device, devices[index].source, devices[index].vid, +- devices[index].pid, devices[index].version); ++ ++ /* if device reports different pid/vid on BT prefer those over USB */ ++ if (devices[index].bt_pid) ++ btd_device_set_pnpid(device, devices[index].source, ++ devices[index].vid, ++ devices[index].bt_pid, ++ devices[index].version); ++ else ++ btd_device_set_pnpid(device, devices[index].source, ++ devices[index].vid, ++ devices[index].pid, ++ devices[index].version); ++ + btd_device_set_temporary(device, false); + + return true; +-- +2.1.4 + diff --git a/packages/network/bluez/patches/bluez-12_sixaxis-add-support-for-setting-SDP-record.patch b/packages/network/bluez/patches/bluez-12_sixaxis-add-support-for-setting-SDP-record.patch new file mode 100644 index 00000000000..18a3160f58e --- /dev/null +++ b/packages/network/bluez/patches/bluez-12_sixaxis-add-support-for-setting-SDP-record.patch @@ -0,0 +1,71 @@ +From: Szymon Janc <szymon.janc@...> +Subject: [PATCH 2/5] core/device: Add support for setting SDP record +Newsgroups: gmane.linux.bluez.kernel +Date: 2015-06-15 18:28:27 GMT (36 weeks, 4 days, 21 hours and 33 minutes ago) + +This allows to set SDP record for device without resolving services +over SDP. After SDP is provided profiles are probed. +--- + src/device.c | 31 +++++++++++++++++++++++++++++++ + src/device.h | 3 +++ + 2 files changed, 34 insertions(+) + +diff --git a/src/device.c b/src/device.c +index 3ef0340..859aa3c 100644 +--- a/src/device.c ++++ b/src/device.c +@@ -5542,6 +5542,37 @@ static sdp_list_t *read_device_records(struct btd_device *device) + return recs; + } + ++void btd_device_set_record(struct btd_device *device, const char *uuid, ++ sdp_record_t *rec) ++{ ++ /* This API is only used for BR/EDR */ ++ struct bearer_state *state = &device->bredr_state; ++ struct browse_req *req; ++ sdp_list_t *recs = NULL; ++ ++ if (!rec) ++ return; ++ ++ req = browse_request_new(device, NULL); ++ if (!req) ++ return; ++ ++ recs = sdp_list_append(recs, rec); ++ update_bredr_services(req, recs); ++ sdp_list_free(recs, NULL); ++ ++ device->svc_refreshed = true; ++ state->svc_resolved = true; ++ ++ device_probe_profiles(device, req->profiles_added); ++ ++ /* Propagate services changes */ ++ g_dbus_emit_property_changed(dbus_conn, req->device->path, ++ DEVICE_INTERFACE, "UUIDs"); ++ ++ device_svc_resolved(device, device->bdaddr_type, 0); ++} ++ + const sdp_record_t *btd_device_get_record(struct btd_device *device, + const char *uuid) + { +diff --git a/src/device.h b/src/device.h +index 1955f54..aee677a 100644 +--- a/src/device.h ++++ b/src/device.h +@@ -62,6 +62,9 @@ struct device_addr_type { + int device_addr_type_cmp(gconstpointer a, gconstpointer b); + GSList *btd_device_get_uuids(struct btd_device *device); + void device_probe_profiles(struct btd_device *device, GSList *profiles); ++ ++void btd_device_set_record(struct btd_device *device, const char *uuid, ++ sdp_record_t *rec); + const sdp_record_t *btd_device_get_record(struct btd_device *device, + const char *uuid); + struct gatt_primary *btd_device_get_primary(struct btd_device *device, +-- +2.1.4 + diff --git a/packages/network/bluez/patches/bluez-13_sixaxis-provide-dualshock-3-SDP-record.patch b/packages/network/bluez/patches/bluez-13_sixaxis-provide-dualshock-3-SDP-record.patch new file mode 100644 index 00000000000..91aa83af1b9 --- /dev/null +++ b/packages/network/bluez/patches/bluez-13_sixaxis-provide-dualshock-3-SDP-record.patch @@ -0,0 +1,216 @@ +From: Szymon Janc <szymon.janc@...> +Subject: [PATCH 3/5] sixaxis: Provide DualShock 3 SDP record while adding new device +Newsgroups: gmane.linux.bluez.kernel +Date: 2015-06-15 18:28:28 GMT (36 weeks, 4 days, 21 hours and 33 minutes ago) + +This allows to skip SDP search for DualShock 3 devices. Since some +DS3 clones were reported to not provide any SDP record this should +allow to operate them. +--- + Makefile.plugins | 1 + + plugins/sixaxis.c | 166 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 167 insertions(+) + +diff --git a/Makefile.plugins b/Makefile.plugins +index cae43d9..2c2385d 100644 +--- a/Makefile.plugins ++++ b/Makefile.plugins +@@ -118,4 +118,5 @@ plugins_sixaxis_la_SOURCES = plugins/sixaxis.c + plugins_sixaxis_la_LDFLAGS = $(AM_LDFLAGS) -module -avoid-version \ + -no-undefined @UDEV_LIBS@ + plugins_sixaxis_la_CFLAGS = $(AM_CFLAGS) -fvisibility=hidden @UDEV_CFLAGS@ ++plugins_sixaxis_la_LIBADD = lib/libbluetooth-internal.la + endif +diff --git a/plugins/sixaxis.c b/plugins/sixaxis.c +index 50db6c1..782a89f 100644 +--- a/plugins/sixaxis.c ++++ b/plugins/sixaxis.c +@@ -40,4 +40,6 @@ + + #include "lib/bluetooth.h" ++#include "lib/sdp.h" ++#include "lib/sdp_lib.h" + #include "lib/uuid.h" + #include "src/adapter.h" +@@ -257,6 +258,170 @@ out: + return false; + } + ++static sdp_record_t *get_sdp_record(void) ++{ ++ sdp_record_t *record; ++ uint16_t hid_release, hid_parser, version, timeout; ++ uint8_t sdp_disable, battery, remote_wakeup, norm_connect, boot_device; ++ uint8_t subclass, country, virtual_cable, reconnect; ++ sdp_list_t *svclass_id, *pfseq, *apseq, *root; ++ uuid_t root_uuid, hidkb_uuid, l2cap_uuid, hidp_uuid; ++ sdp_profile_desc_t profile; ++ sdp_list_t *aproto, *proto[3]; ++ sdp_data_t *psm, *lang_lst, *lang_lst2, *hid_spec_lst, *hid_spec_lst2; ++ uint8_t dtd = SDP_UINT16; ++ uint8_t dtd2 = SDP_UINT8; ++ uint8_t dtd_data = SDP_TEXT_STR8; ++ void *dtds[2]; ++ void *values[2]; ++ void *dtds2[2]; ++ void *values2[2]; ++ int leng[2]; ++ uint8_t hid_spec_type = 0x22; ++ uint16_t hid_attr_lang[] = { 0x409, 0x100 }; ++ static const uint16_t ctrl = 0x11; ++ static const uint16_t intr = 0x13; ++ uint8_t hid_spec[] = { ++ 0x05, 0x01, 0x09, 0x04, 0xa1, 0x01, 0xa1, 0x02, 0x85, 0x01, ++ 0x75, 0x08, 0x95, 0x01, 0x15, 0x00, 0x26, 0xff, 0x00, 0x81, ++ 0x03, 0x75, 0x01, 0x95, 0x13, 0x15, 0x00, 0x25, 0x01, 0x35, ++ 0x00, 0x45, 0x01, 0x05, 0x09, 0x19, 0x01, 0x29, 0x13, 0x81, ++ 0x02, 0x75, 0x01, 0x95, 0x0d, 0x06, 0x00, 0xff, 0x81, 0x03, ++ 0x15, 0x00, 0x26, 0xff, 0x00, 0x05, 0x01, 0x09, 0x01, 0xa1, ++ 0x00, 0x75, 0x08, 0x95, 0x04, 0x35, 0x00, 0x46, 0xff, 0x00, ++ 0x09, 0x30, 0x09, 0x31, 0x09, 0x32, 0x09, 0x35, 0x81, 0x02, ++ 0xc0, 0x05, 0x01, 0x75, 0x08, 0x95, 0x27, 0x09, 0x01, 0x81, ++ 0x02, 0x75, 0x08, 0x95, 0x30, 0x09, 0x01, 0x91, 0x02, 0x75, ++ 0x08, 0x95, 0x30, 0x09, 0x01, 0xb1, 0x02, 0xc0, 0xa1, 0x02, ++ 0x85, 0x02, 0x75, 0x08, 0x95, 0x30, 0x09, 0x01, 0xb1, 0x02, ++ 0xc0, 0xa1, 0x02, 0x85, 0xee, 0x75, 0x08, 0x95, 0x30, 0x09, ++ 0x01, 0xb1, 0x02, 0xc0, 0xa1, 0x02, 0x85, 0xef, 0x75, 0x08, ++ 0x95, 0x30, 0x09, 0x01, 0xb1, 0x02, 0xc0, 0xc0, 0x00 ++ }; ++ ++ record = sdp_record_alloc(); ++ if (!record) ++ return NULL; ++ ++ sdp_uuid16_create(&root_uuid, PUBLIC_BROWSE_GROUP); ++ root = sdp_list_append(0, &root_uuid); ++ sdp_set_browse_groups(record, root); ++ ++ sdp_add_lang_attr(record); ++ ++ sdp_uuid16_create(&hidkb_uuid, HID_SVCLASS_ID); ++ svclass_id = sdp_list_append(0, &hidkb_uuid); ++ sdp_set_service_classes(record, svclass_id); ++ ++ sdp_uuid16_create(&profile.uuid, HID_PROFILE_ID); ++ profile.version = 0x0100; ++ pfseq = sdp_list_append(0, &profile); ++ sdp_set_profile_descs(record, pfseq); ++ ++ /* protocols */ ++ sdp_uuid16_create(&l2cap_uuid, L2CAP_UUID); ++ proto[1] = sdp_list_append(0, &l2cap_uuid); ++ psm = sdp_data_alloc(SDP_UINT16, &ctrl); ++ proto[1] = sdp_list_append(proto[1], psm); ++ apseq = sdp_list_append(0, proto[1]); ++ ++ sdp_uuid16_create(&hidp_uuid, HIDP_UUID); ++ proto[2] = sdp_list_append(0, &hidp_uuid); ++ apseq = sdp_list_append(apseq, proto[2]); ++ ++ aproto = sdp_list_append(0, apseq); ++ sdp_set_access_protos(record, aproto); ++ ++ /* additional protocols */ ++ proto[1] = sdp_list_append(0, &l2cap_uuid); ++ psm = sdp_data_alloc(SDP_UINT16, &intr); ++ proto[1] = sdp_list_append(proto[1], psm); ++ apseq = sdp_list_append(0, proto[1]); ++ ++ sdp_uuid16_create(&hidp_uuid, HIDP_UUID); ++ proto[2] = sdp_list_append(0, &hidp_uuid); ++ apseq = sdp_list_append(apseq, proto[2]); ++ ++ aproto = sdp_list_append(0, apseq); ++ sdp_set_add_access_protos(record, aproto); ++ ++ sdp_set_info_attr(record, "Wireless Controller", ++ "Sony Computer Entertainment", ++ "Wireless Controller"); ++ ++ hid_release = 0x0100; ++ sdp_attr_add_new(record, SDP_ATTR_HID_DEVICE_RELEASE_NUMBER, SDP_UINT16, ++ &hid_release); ++ ++ hid_parser = 0x0100; ++ sdp_attr_add_new(record, SDP_ATTR_HID_PARSER_VERSION, SDP_UINT16, ++ &hid_parser); ++ ++ subclass = 0x00; ++ sdp_attr_add_new(record, SDP_ATTR_HID_DEVICE_SUBCLASS, SDP_UINT8, ++ &subclass); ++ ++ country = 0x21; ++ sdp_attr_add_new(record, SDP_ATTR_HID_COUNTRY_CODE, SDP_UINT8, ++ &country); ++ ++ virtual_cable = 0x01; ++ sdp_attr_add_new(record, SDP_ATTR_HID_VIRTUAL_CABLE, SDP_BOOL, ++ &virtual_cable); ++ ++ reconnect = 0x01; ++ sdp_attr_add_new(record, SDP_ATTR_HID_RECONNECT_INITIATE, SDP_BOOL, ++ &reconnect); ++ ++ dtds[0] = &dtd2; ++ values[0] = &hid_spec_type; ++ dtds[1] = &dtd_data; ++ values[1] = hid_spec; ++ leng[0] = 0; ++ leng[1] = sizeof(hid_spec); ++ hid_spec_lst = sdp_seq_alloc_with_length(dtds, values, leng, 2); ++ hid_spec_lst2 = sdp_data_alloc(SDP_SEQ8, hid_spec_lst); ++ sdp_attr_add(record, SDP_ATTR_HID_DESCRIPTOR_LIST, hid_spec_lst2); ++ ++ dtds2[0] = &dtd; ++ values2[0] = &hid_attr_lang[0]; ++ dtds2[1] = &dtd; ++ values2[1] = &hid_attr_lang[1]; ++ lang_lst = sdp_seq_alloc(dtds2, values2, sizeof(hid_attr_lang) / 2); ++ lang_lst2 = sdp_data_alloc(SDP_SEQ8, lang_lst); ++ sdp_attr_add(record, SDP_ATTR_HID_LANG_ID_BASE_LIST, lang_lst2); ++ ++ sdp_disable = 0x00; ++ sdp_attr_add_new(record, SDP_ATTR_HID_SDP_DISABLE, SDP_BOOL, ++ &sdp_disable); ++ ++ battery = 0x01; ++ sdp_attr_add_new(record, SDP_ATTR_HID_BATTERY_POWER, SDP_BOOL, ++ &battery); ++ ++ remote_wakeup = 0x01; ++ sdp_attr_add_new(record, SDP_ATTR_HID_REMOTE_WAKEUP, SDP_BOOL, ++ &remote_wakeup); ++ ++ version = 0x0100; ++ sdp_attr_add_new(record, SDP_ATTR_HID_PROFILE_VERSION, SDP_UINT16, ++ &version); ++ ++ timeout = 0x3e80; ++ sdp_attr_add_new(record, SDP_ATTR_HID_SUPERVISION_TIMEOUT, SDP_UINT16, ++ &timeout); ++ ++ norm_connect = 0x00; ++ sdp_attr_add_new(record, SDP_ATTR_HID_NORMALLY_CONNECTABLE, SDP_BOOL, ++ &norm_connect); ++ ++ boot_device = 0x00; ++ sdp_attr_add_new(record, SDP_ATTR_HID_BOOT_DEVICE, SDP_BOOL, ++ &boot_device); ++ ++ return record; ++} ++ + static bool setup_device(int fd, int index, struct btd_adapter *adapter) + { + char device_addr[18], master_addr[18], adapter_addr[18]; +@@ -316,6 +481,7 @@ static bool setup_device(int fd, int index, struct btd_adapter *adapter) + devices[index].version); + + btd_device_set_temporary(device, false); ++ btd_device_set_record(device, HID_UUID, get_sdp_record()); + + return true; + } +-- +2.1.4 + diff --git a/packages/network/bluez/patches/bluez-14_sixaxis-remove-not-needed-checks.patch b/packages/network/bluez/patches/bluez-14_sixaxis-remove-not-needed-checks.patch new file mode 100644 index 00000000000..04caec68c03 --- /dev/null +++ b/packages/network/bluez/patches/bluez-14_sixaxis-remove-not-needed-checks.patch @@ -0,0 +1,36 @@ +From: Szymon Janc <szymon.janc@...> +Subject: [PATCH 4/5] profiles/input: Remove not needed sixaxis checks +Newsgroups: gmane.linux.bluez.kernel +Date: 2015-06-15 18:28:29 GMT (36 weeks, 4 days, 21 hours and 33 minutes ago) + +This check is now needed only for DualShock 4. +--- + profiles/input/server.c | 8 -------- + 1 file changed, 8 deletions(-) + +diff --git a/profiles/input/server.c b/profiles/input/server.c +index eb3fcf8..101108b 100644 +--- a/profiles/input/server.c ++++ b/profiles/input/server.c +@@ -131,18 +131,10 @@ static bool dev_is_sixaxis(const bdaddr_t *src, const bdaddr_t *dst) + vid = btd_device_get_vendor(device); + pid = btd_device_get_product(device); + +- /* DualShock 3 */ +- if (vid == 0x054c && pid == 0x0268) +- return true; +- + /* DualShock 4 */ + if (vid == 0x054c && pid == 0x05c4) + return true; + +- /* Navigation Controller */ +- if (vid == 0x054c && pid == 0x042f) +- return true; +- + return false; + } + +-- +2.1.4 + diff --git a/packages/network/bluez/patches/bluez-15_sixaxis-fix-multi-line-comments-style.patch b/packages/network/bluez/patches/bluez-15_sixaxis-fix-multi-line-comments-style.patch new file mode 100644 index 00000000000..ac8f462fbfa --- /dev/null +++ b/packages/network/bluez/patches/bluez-15_sixaxis-fix-multi-line-comments-style.patch @@ -0,0 +1,43 @@ +From: Szymon Janc <szymon.janc@...> +Subject: [PATCH 5/5] sixaxis: Fix multi-line comments style +Newsgroups: gmane.linux.bluez.kernel +Date: 2015-06-15 18:28:30 GMT (36 weeks, 4 days, 21 hours and 33 minutes ago) + +--- + plugins/sixaxis.c | 12 ++++++++---- + 1 file changed, 8 insertions(+), 4 deletions(-) + +diff --git a/plugins/sixaxis.c b/plugins/sixaxis.c +index 782a89f..9b6cad4 100644 +--- a/plugins/sixaxis.c ++++ b/plugins/sixaxis.c +@@ -435,9 +435,11 @@ static bool setup_device(int fd, int index, struct btd_adapter *adapter) + if (get_master_bdaddr(fd, &master_bdaddr) < 0) + return false; + +- /* This can happen if controller was plugged while already connected ++ /* ++ * This can happen if controller was plugged while already connected + * eg. to charge up battery. +- * Don't set LEDs in that case, hence return false */ ++ * Don't set LEDs in that case, hence return false ++ */ + device = btd_adapter_find_device(adapter, &device_bdaddr, + BDADDR_BREDR); + if (device && btd_device_is_connected(device)) +@@ -533,8 +535,10 @@ static int get_js_number(struct udev_device *udevice) + if (!input_parent) + goto next; + +- /* check if this is the joystick relative to the hidraw device +- * above */ ++ /* ++ * check if this is the joystick relative to the hidraw device ++ * above ++ */ + input_id = udev_device_get_sysattr_value(input_parent, "uniq"); + + /* +-- +2.1.4 + diff --git a/packages/network/bluez/patches/bluez-20-sixaxis-autotrust.patch b/packages/network/bluez/patches/bluez-20-sixaxis-autotrust.patch new file mode 100644 index 00000000000..e6daa7321a1 --- /dev/null +++ b/packages/network/bluez/patches/bluez-20-sixaxis-autotrust.patch @@ -0,0 +1,11 @@ +diff -Naur bluez-5.37/plugins/sixaxis.c bluez-5.37.patch/plugins/sixaxis.c +--- bluez-5.37/plugins/sixaxis.c 2016-04-21 21:38:45.805962009 +0200 ++++ bluez-5.37.patch/plugins/sixaxis.c 2016-04-24 15:22:36.852107941 +0200 +@@ -484,6 +484,7 @@ + devices[index].version); + + btd_device_set_temporary(device, false); ++ btd_device_set_trusted(device, true); + btd_device_set_record(device, HID_UUID, get_sdp_record()); + + return true; diff --git a/packages/network/bluez/system.d/bluetooth.service b/packages/network/bluez/system.d/bluetooth.service index 316b33b8a79..d3514531fa8 100644 --- a/packages/network/bluez/system.d/bluetooth.service +++ b/packages/network/bluez/system.d/bluetooth.service @@ -7,11 +7,14 @@ ConditionPathExists=/storage/.cache/services/bluez.conf [Service] NotifyAccess=main EnvironmentFile=/storage/.cache/services/bluez.conf -EnvironmentFile=-/run/openelec/debug/bluez.conf +EnvironmentFile=-/run/libreelec/debug/bluez.conf ExecStart=/usr/lib/bluetooth/bluetoothd $BLUEZ_ARGS $BLUEZ_DEBUG CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE CAP_NET_RAW LimitNPROC=1 TimeoutStopSec=1s +Restart=on-failure +RestartSec=2 +StartLimitInterval=0 [Install] WantedBy=bluetooth.target diff --git a/packages/network/bluez/system.d/obex.service b/packages/network/bluez/system.d/obex.service index 1a42d44f604..919d75babd4 100644 --- a/packages/network/bluez/system.d/obex.service +++ b/packages/network/bluez/system.d/obex.service @@ -8,7 +8,7 @@ ConditionPathExists=/storage/.cache/services/bluez.conf [Service] EnvironmentFile=/storage/.cache/services/obexd.conf -EnvironmentFile=-/run/openelec/debug/obexd.conf +EnvironmentFile=-/run/libreelec/debug/obexd.conf ExecStartPre=/bin/sh -c 'mkdir -p $OBEXD_ROOT' ExecStart=/usr/lib/bluetooth/obexd -r $OBEXD_ROOT $OBEXD_DEBUG TimeoutStopSec=1s diff --git a/packages/network/connman/config/hosts.conf b/packages/network/connman/config/hosts.conf index 4ceb01e50c0..82ec2eea77d 100644 --- a/packages/network/connman/config/hosts.conf +++ b/packages/network/connman/config/hosts.conf @@ -4,7 +4,7 @@ # IP addresses # Format: <ipaddress> <hostname1> <hostname2> -# Example: 192.168.0.3 openelec openelec.mynetwork +# Example: 192.168.0.3 libreelec libreelec.mynetwork # NOTE: do not edit /etc/hosts directly # edit /storage/.config/hosts.conf then reboot diff --git a/packages/network/connman/package.mk b/packages/network/connman/package.mk index 776ef2240a1..2bbe16ad0e2 100644 --- a/packages/network/connman/package.mk +++ b/packages/network/connman/package.mk @@ -18,7 +18,7 @@ PKG_NAME="connman" # DO NOT UPGRADE!! -PKG_VERSION="1.31" +PKG_VERSION="1.32" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" diff --git a/packages/network/connman/patches/connman-05_link-against-ncurses.patch b/packages/network/connman/patches/connman-05_link-against-ncurses.patch index a74af3a3e15..659051aae68 100644 --- a/packages/network/connman/patches/connman-05_link-against-ncurses.patch +++ b/packages/network/connman/patches/connman-05_link-against-ncurses.patch @@ -16,7 +16,7 @@ index 41efc1f..d1d3ddc 100644 client_connmanctl_LDADD = gdbus/libgdbus-internal.la @DBUS_LIBS@ @GLIB_LIBS@ \ - -lreadline -ldl -+ -lreadline -lncurses -ldl ++ -lreadline -lncurses -ltermcap -ldl endif noinst_PROGRAMS += unit/test-pbkdf2-sha1 unit/test-prf-sha1 unit/test-ippool diff --git a/packages/network/connman/patches/connman-06-fix-lease-expiry-issues.patch b/packages/network/connman/patches/connman-06-fix-lease-expiry-issues.patch deleted file mode 100644 index 65675e604e2..00000000000 --- a/packages/network/connman/patches/connman-06-fix-lease-expiry-issues.patch +++ /dev/null @@ -1,67 +0,0 @@ -From f61f547e64aaf466522cf2a92af2ab450dc1134f Mon Sep 17 00:00:00 2001 -From: nasingh <naveensingh0977@gmail.com> -Date: Wed, 6 Jan 2016 22:19:36 -0800 -Subject: dhcp: Nameserver issue on IP address renewal after lease expiry - -After lease expiry and releasing its current IP, when device eventually -gets an IP address, DNS resolution stops working. This is because -nameserver list in service structure is empty. On lease expiry when -apply_dhcp_invalidate_on_network(dhcp) is called, it removes -nameservers from the service structure but it does not free namservers in -dhcp structure. Now next time when device gets an IP address and -apply_lease_available_on_network is called, nameserver is not updated as -compare_string_arrays(nameservers, dhcp->nameservers) would return true. -The fix for this would be to free dhcp->nameservers when lease is lost so -that on successful renewal next time, nameserver properly gets updated. ---- - src/dhcp.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/src/dhcp.c b/src/dhcp.c -index e4497fc..159fecb 100644 ---- a/src/dhcp.c -+++ b/src/dhcp.c -@@ -114,6 +114,8 @@ static bool apply_dhcp_invalidate_on_network(struct connman_dhcp *dhcp) - __connman_service_nameserver_remove(service, - dhcp->nameservers[i], false); - } -+ g_strfreev(dhcp->nameservers); -+ dhcp->nameservers = NULL; - } - - return true; --- -cgit v0.12 - -From ccfae23093a170ffac92bc3c633bcec5a00c974c Mon Sep 17 00:00:00 2001 -From: Patrik Flykt <patrik.flykt@linux.intel.com> -Date: Mon, 11 Jan 2016 10:52:26 +0200 -Subject: dhcp: Timeserver issue on IP address renewal after lease expiry - -Similar to nameservers, timeservers are also checked against previous -values when added. When there is no change in timeservers when the DHCP -lease is lost and reacquired, the service will not be notified if the -timeservers have changed. With timeservers removed on lease lost, -timeservers are not properly updated once reacquired. - -Fix this by removing timeservers from the dhcp struct when lease is lost. ---- - src/dhcp.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/src/dhcp.c b/src/dhcp.c -index 159fecb..4040ad1 100644 ---- a/src/dhcp.c -+++ b/src/dhcp.c -@@ -108,6 +108,8 @@ static bool apply_dhcp_invalidate_on_network(struct connman_dhcp *dhcp) - __connman_service_timeserver_remove(service, - dhcp->timeservers[i]); - } -+ g_strfreev(dhcp->timeservers); -+ dhcp->timeservers = NULL; - } - if (dhcp->nameservers) { - for (i = 0; dhcp->nameservers[i]; i++) { --- -cgit v0.12 - diff --git a/packages/network/connman/patches/connman-99-iptables-1.6.patch b/packages/network/connman/patches/connman-99-iptables-1.6.patch deleted file mode 100644 index 30131e690bb..00000000000 --- a/packages/network/connman/patches/connman-99-iptables-1.6.patch +++ /dev/null @@ -1,36 +0,0 @@ -From acea08a0e4234a4c1a87bedc087c73ff36de0c7b Mon Sep 17 00:00:00 2001 -From: Wu Zheng <wu.zheng@intel.com> -Date: Thu, 28 Jan 2016 18:04:17 +0800 -Subject: iptables: Add missing function item of xtables to match iptables 1.6 - -The struct of xtables_globals has been modified in iptables 1.6. -If connman runs with iptables 1.6, it can crash. - -Program received signal SIGSEGV, Segmentation fault. -0x00000000 in ?? () -0xb7dea89c in xtables_find_target () from /usr/lib/libxtables.so.11 -0xb7deac1c in ?? () from /usr/lib/libxtables.so.11 -0xb7dea793 in xtables_find_target () from /usr/lib/libxtables.so.11 - -The the missing function item of xtables is added to xtables_globals. ---- - src/iptables.c | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/src/iptables.c b/src/iptables.c -index bc0c763..5ef757a 100644 ---- a/src/iptables.c -+++ b/src/iptables.c -@@ -1566,6 +1566,9 @@ struct xtables_globals iptables_globals = { - .option_offset = 0, - .opts = iptables_opts, - .orig_opts = iptables_opts, -+#if XTABLES_VERSION_CODE > 10 -+ .compat_rev = xtables_compatible_revision, -+#endif - }; - - static struct xtables_target *prepare_target(struct connman_iptables *table, --- -cgit v0.12 - diff --git a/packages/network/connman/system.d/connman.service b/packages/network/connman/system.d/connman.service index 47610ce0445..f65dfa8e983 100644 --- a/packages/network/connman/system.d/connman.service +++ b/packages/network/connman/system.d/connman.service @@ -10,7 +10,7 @@ Wants=network.target Type=dbus BusName=net.connman Restart=on-failure -EnvironmentFile=-/run/openelec/debug/connman.conf +EnvironmentFile=-/run/libreelec/debug/connman.conf ExecStartPre=-/bin/sh -c "echo -e 'nameserver 8.8.8.8\nnameserver 8.8.4.4' > /etc/resolv.conf" ExecStartPre=-/bin/sh -c "cat /storage/.cache/hostname > /proc/sys/kernel/hostname" ExecStartPre=-/bin/sh -c "cat /storage/.config/hosts.conf > /etc/hosts" diff --git a/packages/audio/dcadec/package.mk b/packages/network/libdnet/package.mk similarity index 57% rename from packages/audio/dcadec/package.mk rename to packages/network/libdnet/package.mk index 633ffb62f85..0bb994e14cd 100644 --- a/packages/audio/dcadec/package.mk +++ b/packages/network/libdnet/package.mk @@ -16,33 +16,33 @@ # along with OpenELEC. If not, see <http://www.gnu.org/licenses/>. ################################################################################ -PKG_NAME="dcadec" -PKG_VERSION="37d8e68" +PKG_NAME="libdnet" +PKG_VERSION="1.12" PKG_REV="1" PKG_ARCH="any" -PKG_LICENSE="GPL" -PKG_SITE="https://github.com/foo86/dcadec" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_LICENSE="BSD" +PKG_SITE="http://code.google.com/p/libdnet/" +PKG_URL="http://libdnet.googlecode.com/files/$PKG_NAME-$PKG_VERSION.tgz" PKG_DEPENDS_TARGET="toolchain" PKG_PRIORITY="optional" -PKG_SECTION="audio" -PKG_SHORTDESC="DTS Coherent Acoustics decoder with support for HD extensions" -PKG_LONGDESC="DTS Coherent Acoustics decoder with support for HD extensions" +PKG_SECTION="network" +PKG_SHORTDESC="A simplified, portable interface to several low-level networking routines" +PKG_LONGDESC="A simplified, portable interface to several low-level networking routines" PKG_IS_ADDON="no" PKG_AUTORECONF="no" -# todo: we need to build as shared library, otherwise sond dont work -# in kodi with enabled dcadec support and we have 100% CPU usage -# (to test disable passtrough and use a DTS-HD sample) -PKG_MAKE_OPTS_TARGET="PREFIX=/usr BINDIR=/usr/bin LIBDIR=/usr/lib INCLUDEDIR=/usr/include PKG_CONFIG_PATH=/usr/lib/pkgconfig CONFIG_SHARED=1" -PKG_MAKEINSTALL_OPTS_TARGET="$PKG_MAKE_OPTS_TARGET" +PKG_CONFIGURE_OPTS_TARGET="ac_cv_func_strlcat=no \ + ac_cv_func_strlcpy=no \ + --enable-static \ + --disable-shared \ + --without-python" pre_configure_target() { - export CFLAGS="$CFLAGS -fPIC -DPIC" - export LDFLAGS="$LDFLAGS -fPIC -DPIC" + sed "s|@prefix@|$SYSROOT_PREFIX/usr|g" -i $ROOT/$PKG_BUILD/dnet-config.in } post_makeinstall_target() { - rm -rf $INSTALL/usr/bin + mkdir -p $ROOT/$TOOLCHAIN/bin + cp dnet-config $ROOT/$TOOLCHAIN/bin/ } diff --git a/packages/network/libshairplay/package.mk b/packages/network/libshairplay/package.mk index de5f00ea8a7..73dbf344d98 100644 --- a/packages/network/libshairplay/package.mk +++ b/packages/network/libshairplay/package.mk @@ -17,12 +17,13 @@ ################################################################################ PKG_NAME="libshairplay" -PKG_VERSION="498bc5b" +PKG_VERSION="ce80e00" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="https://github.com/juhovh/shairplay" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_URL="https://github.com/juhovh/shairplay/archive/$PKG_VERSION.tar.gz" +PKG_SOURCE_DIR="shairplay-$PKG_VERSION*" PKG_DEPENDS_TARGET="toolchain" PKG_PRIORITY="optional" PKG_SECTION="network" diff --git a/packages/network/openssh/package.mk b/packages/network/openssh/package.mk index e847aff4d6a..267972c396d 100644 --- a/packages/network/openssh/package.mk +++ b/packages/network/openssh/package.mk @@ -17,7 +17,7 @@ ################################################################################ PKG_NAME="openssh" -PKG_VERSION="7.2p1" +PKG_VERSION="7.2p2" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="OSS" @@ -66,6 +66,8 @@ post_makeinstall_target() { sed -i $INSTALL/etc/ssh/sshd_config -e "s|^#PermitRootLogin.*|PermitRootLogin yes|g" echo "PubkeyAcceptedKeyTypes +ssh-dss" >> $INSTALL/etc/ssh/sshd_config + + debug_strip $INSTALL/usr } post_install() { diff --git a/packages/network/openvpn/package.mk b/packages/network/openvpn/package.mk new file mode 100644 index 00000000000..a2557c63ae7 --- /dev/null +++ b/packages/network/openvpn/package.mk @@ -0,0 +1,52 @@ +################################################################################ +# This file is part of LibreELEC - http://libreelec.tv +# Copyright (C) 2016 Christian Hewitt (chewitt@libreelec.tv) +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +# along with LibreELEC. If not, see <http://www.gnu.org/licenses/>. +################################################################################ + +PKG_NAME="openvpn" +PKG_VERSION="2.3.11" +PKG_REV="1" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="http://openvpn.net" +PKG_URL="http://swupdate.openvpn.org/community/releases/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_DEPENDS_TARGET="toolchain lzo libressl" +PKG_PRIORITY="optional" +PKG_SECTION="network" +PKG_SHORTDESC="openvpn: a full featured SSL VPN software solution that integrates OpenVPN server capabilities." +PKG_LONGDESC="OpenVPN Access Server is a full featured SSL VPN software solution that integrates OpenVPN server capabilities, enterprise management capabilities, simplified OpenVPN Connect UI, and OpenVPN Client software packages that accommodate Windows, MAC, and Linux OS environments. OpenVPN Access Server supports a wide range of configurations, including secure and granular remote access to internal network and/ or private cloud network resources and applications with fine-grained access control." + +PKG_IS_ADDON="no" +PKG_AUTORECONF="yes" + +PKG_CONFIGURE_OPTS_TARGET="ac_cv_have_decl_TUNSETPERSIST=no \ + --disable-server \ + --enable-password-save \ + --disable-plugins \ + --enable-iproute2 IPROUTE=/sbin/ip \ + --enable-management \ + --disable-socks \ + --disable-http-proxy \ + --enable-fragment \ + --disable-multihome \ + --disable-port-share \ + --disable-debug" + +post_makeinstall_target() { + mkdir -p $INSTALL/usr/bin + ln -sf ../sbin/openvpn $INSTALL/usr/bin/openvpn +} diff --git a/packages/network/samba/config/smb.conf b/packages/network/samba/config/smb.conf index ca80c539a6b..c22d5e64e15 100644 --- a/packages/network/samba/config/smb.conf +++ b/packages/network/samba/config/smb.conf @@ -21,7 +21,7 @@ # available from your machine [global] - server string = OpenELEC + server string = LibreELEC workgroup = WORKGROUP netbios name = %h security = share @@ -158,3 +158,11 @@ public = yes writable = yes root preexec = mkdir -p /storage/backup + +[Picons] + path = /storage/picons + available = yes + browsable = yes + public = yes + writable = yes + root preexec = mkdir -p /storage/picons/tvh /storage/picons/vdr diff --git a/packages/network/samba/default.d/samba.conf b/packages/network/samba/default.d/samba.conf index bdb07b1ff19..d77b5bca248 100644 --- a/packages/network/samba/default.d/samba.conf +++ b/packages/network/samba/default.d/samba.conf @@ -1,4 +1,4 @@ SAMBA_AUTOSHARE="true" -SAMBA_USERNAME="openelec" -SAMBA_PASSWORD="openelec" +SAMBA_USERNAME="libreelec" +SAMBA_PASSWORD="libreelec" SAMBA_SECURE="false" diff --git a/packages/network/samba/package.mk b/packages/network/samba/package.mk index 854b613fd59..c3641c0d327 100644 --- a/packages/network/samba/package.mk +++ b/packages/network/samba/package.mk @@ -23,7 +23,7 @@ PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.samba.org" PKG_URL="http://samba.org/samba/ftp/stable/$PKG_NAME-$PKG_VERSION.tar.gz" -PKG_DEPENDS_TARGET="toolchain zlib attr connman" +PKG_DEPENDS_TARGET="toolchain zlib connman" PKG_PRIORITY="optional" PKG_SECTION="network" PKG_SHORTDESC="samba: The free SMB / CIFS fileserver and client" @@ -174,6 +174,9 @@ makeinstall_target() { if [ -f $PROJECT_DIR/$PROJECT/config/smb.conf ]; then mkdir -p $INSTALL/etc/samba cp $PROJECT_DIR/$PROJECT/config/smb.conf $INSTALL/etc/samba + elif [ -f $DISTRO_DIR/$DISTRO/config/smb.conf ]; then + mkdir -p $INSTALL/etc/samba + cp $DISTRO_DIR/$DISTRO/config/smb.conf $INSTALL/etc/samba else mkdir -p $INSTALL/etc/samba cp $PKG_DIR/config/smb.conf $INSTALL/etc/samba @@ -186,7 +189,6 @@ makeinstall_target() { post_install() { if [ "$SAMBA_SERVER" = "yes" ]; then - enable_service samba-defaults.service enable_service nmbd.service enable_service smbd.service fi diff --git a/packages/network/samba/scripts/samba-config b/packages/network/samba/scripts/samba-config index dd59572bce6..f7fe7db5bd4 100755 --- a/packages/network/samba/scripts/samba-config +++ b/packages/network/samba/scripts/samba-config @@ -21,44 +21,46 @@ SMB_USERCONF="/storage/.config/samba.conf" SMB_DEFCONF="/etc/samba/smb.conf" SMB_CONF="/run/samba/smb.conf" -if [ -f /storage/.cache/services/samba.conf ]; then - . /storage/.cache/services/samba.conf +if [ ! -f /storage/.cache/services/samba.conf ]; then + /bin/cp /usr/share/services/samba.conf /storage/.cache/services +fi + +. /storage/.cache/services/samba.conf - mkdir -p /run/samba - if [ -f $SMB_USERCONF ]; then - cp $SMB_USERCONF $SMB_CONF - else - cp $SMB_DEFCONF $SMB_CONF - fi +mkdir -p /run/samba +if [ -f $SMB_USERCONF ]; then + cp $SMB_USERCONF $SMB_CONF +else + cp $SMB_DEFCONF $SMB_CONF +fi - # handle external drives - if [ "$SAMBA_AUTOSHARE" == "true" ] ; then - for dir in /media/* ; do - if [ -d "$dir" ] ; then - name=$(basename "$dir") - echo -e "[$name]\n path = $dir\n available = yes\n browsable = yes\n public = yes\n writable = yes\n" >> $SMB_CONF - fi - done - fi +# handle external drives +if [ "$SAMBA_AUTOSHARE" == "true" ] ; then + for dir in /media/* ; do + if [ -d "$dir" ] ; then + name=$(basename "$dir") + echo -e "[$name]\n path = $dir\n available = yes\n browsable = yes\n public = yes\n writable = yes\n" >> $SMB_CONF + fi + done +fi - # only letters & numbers permitted for username & password - SAMBA_USERNAME=`echo $SAMBA_USERNAME | sed "s/[^a-zA-Z0-9]//g;"` - SAMBA_PASSWORD=`echo $SAMBA_PASSWORD | sed "s/[^a-zA-Z0-9]//g;"` +# only letters & numbers permitted for username & password +SAMBA_USERNAME=`echo $SAMBA_USERNAME | sed "s/[^a-zA-Z0-9]//g;"` +SAMBA_PASSWORD=`echo $SAMBA_PASSWORD | sed "s/[^a-zA-Z0-9]//g;"` - if [ "$SAMBA_SECURE" == "true" -a ! "$SAMBA_USERNAME" == "" -a ! "$SAMBA_PASSWORD" == "" ] ; then - # username map: first line makes sure plain root does not work all the time - # processing continues, so if user chooses root as username, second line overrides the first - # this is done always in case user uses passwords in userconf. - # many thanks to viljoviitanen for this - echo -e "$SAMBA_PASSWORD\n$SAMBA_PASSWORD" | smbpasswd -s -a root >/dev/null 2>&1 - echo -e "nobody = root\nroot = $SAMBA_USERNAME" > /var/run/samba.map +if [ "$SAMBA_SECURE" == "true" -a ! "$SAMBA_USERNAME" == "" -a ! "$SAMBA_PASSWORD" == "" ] ; then + # username map: first line makes sure plain root does not work all the time + # processing continues, so if user chooses root as username, second line overrides the first + # this is done always in case user uses passwords in userconf. + # many thanks to viljoviitanen for this + echo -e "$SAMBA_PASSWORD\n$SAMBA_PASSWORD" | smbpasswd -s -a root >/dev/null 2>&1 + echo -e "nobody = root\nroot = $SAMBA_USERNAME" > /var/run/samba.map - sed -e 's|^.[ \t]*.public.=.*| public = no |' -i $SMB_CONF - sed -e 's|^.[ \t]*.username map.=.*||' -i $SMB_CONF - sed -e 's|^.[ \t]*.security.=.*| security = user\n username map = /var/run/samba.map|' -i $SMB_CONF - else - sed -e 's|^.[ \t]*.public.=.*| public = yes |' -i $SMB_CONF - sed -e 's|^.[ \t]*.username map.=.*||' -i $SMB_CONF - sed -e 's|^.[ \t]*.security.=.*| security = share|' -i $SMB_CONF - fi + sed -e 's|^.[ \t]*.public.=.*| public = no |' -i $SMB_CONF + sed -e 's|^.[ \t]*.username map.=.*||' -i $SMB_CONF + sed -e 's|^.[ \t]*.security.=.*| security = user\n username map = /var/run/samba.map|' -i $SMB_CONF +else + sed -e 's|^.[ \t]*.public.=.*| public = yes |' -i $SMB_CONF + sed -e 's|^.[ \t]*.username map.=.*||' -i $SMB_CONF + sed -e 's|^.[ \t]*.security.=.*| security = share|' -i $SMB_CONF fi diff --git a/packages/network/samba/system.d.opt/nmbd.service b/packages/network/samba/system.d.opt/nmbd.service index 1c38d9f02ad..dd02e2fd773 100644 --- a/packages/network/samba/system.d.opt/nmbd.service +++ b/packages/network/samba/system.d.opt/nmbd.service @@ -1,10 +1,6 @@ [Unit] Description=Samba NMB Daemon -After=network.target samba-config.service -Requires=samba-config.service - -ConditionPathExists=/storage/.cache/services/samba.conf -ConditionPathExists=/run/samba/smb.conf +After=network.target smbd.service [Service] Type=forking diff --git a/packages/network/samba/system.d.opt/samba-config.service b/packages/network/samba/system.d.opt/samba-config.service deleted file mode 100644 index 8cf1374c135..00000000000 --- a/packages/network/samba/system.d.opt/samba-config.service +++ /dev/null @@ -1,11 +0,0 @@ -[Unit] -Description=Samba configfile writer -After=samba-defaults.service -Requires=samba-defaults.service - -ConditionPathExists=/storage/.cache/services/samba.conf - -[Service] -Type=oneshot -ExecStart=/usr/lib/samba/samba-config -StartLimitInterval=0 diff --git a/packages/network/samba/system.d.opt/samba-defaults.service b/packages/network/samba/system.d.opt/samba-defaults.service deleted file mode 100644 index de6291a8ffc..00000000000 --- a/packages/network/samba/system.d.opt/samba-defaults.service +++ /dev/null @@ -1,10 +0,0 @@ -[Unit] -Description=Samba defaults - -ConditionPathExists=!/storage/.cache/services/samba.conf -ConditionPathExists=!/storage/.cache/services/samba.disabled - -[Service] -Type=oneshot -ExecStart=/bin/cp /usr/share/services/samba.conf /storage/.cache/services/ -RemainAfterExit=yes diff --git a/packages/network/samba/system.d.opt/smbd.service b/packages/network/samba/system.d.opt/smbd.service index 960d7019d6a..1eb903d2f01 100644 --- a/packages/network/samba/system.d.opt/smbd.service +++ b/packages/network/samba/system.d.opt/smbd.service @@ -1,16 +1,13 @@ [Unit] Description=Samba SMB Daemon -After=network.target samba-config.service nmbd.service -Requires=samba-config.service - -ConditionPathExists=/storage/.cache/services/samba.conf -ConditionPathExists=/run/samba/smb.conf +After=network.target [Service] Type=forking PIDFile=/var/run/smbd-smb.conf.pid LimitNOFILE=16384 ExecStart=/usr/bin/smbd --configfile=/run/samba/smb.conf +ExecStartPre=/usr/lib/samba/samba-config ExecReload=/bin/kill -HUP $MAINPID TimeoutStopSec=1s Restart=always diff --git a/packages/python/devel/setuptools/package.mk b/packages/python/devel/setuptools/package.mk index 6933fe2c87e..3e4b5468318 100644 --- a/packages/python/devel/setuptools/package.mk +++ b/packages/python/devel/setuptools/package.mk @@ -17,7 +17,7 @@ ################################################################################ PKG_NAME="setuptools" -PKG_VERSION="19.7" +PKG_VERSION="20.6.7" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="OSS" diff --git a/packages/python/graphics/Pillow/package.mk b/packages/python/graphics/Pillow/package.mk index a769cfb1302..a53b9def920 100644 --- a/packages/python/graphics/Pillow/package.mk +++ b/packages/python/graphics/Pillow/package.mk @@ -17,7 +17,7 @@ ################################################################################ PKG_NAME="Pillow" -PKG_VERSION="3.1.0" +PKG_VERSION="3.2.0" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="BSD" diff --git a/packages/python/graphics/Pillow/patches/Pillow-3.1.0-crosscompiling-0.1.patch b/packages/python/graphics/Pillow/patches/Pillow-0001-crosscompiling.patch similarity index 77% rename from packages/python/graphics/Pillow/patches/Pillow-3.1.0-crosscompiling-0.1.patch rename to packages/python/graphics/Pillow/patches/Pillow-0001-crosscompiling.patch index da996daede5..a8593a71d16 100644 --- a/packages/python/graphics/Pillow/patches/Pillow-3.1.0-crosscompiling-0.1.patch +++ b/packages/python/graphics/Pillow/patches/Pillow-0001-crosscompiling.patch @@ -1,7 +1,7 @@ diff -Naur Pillow-3.1.0/setup.py Pillow-3.1.0.patch/setup.py --- Pillow-3.1.0/setup.py 2016-01-04 11:07:30.000000000 +0100 +++ Pillow-3.1.0.patch/setup.py 2016-01-11 02:05:31.504822915 +0100 -@@ -241,66 +241,10 @@ +@@ -236,65 +236,10 @@ _add_directory(include_dirs, "/usr/X11/include") elif sys.platform.startswith("linux"): @@ -18,38 +18,37 @@ diff -Naur Pillow-3.1.0/setup.py Pillow-3.1.0.patch/setup.py - if platform_ in ["x86_64", "64bit"]: - _add_directory(library_dirs, "/lib64") - _add_directory(library_dirs, "/usr/lib64") -- _add_directory( -- library_dirs, "/usr/lib/x86_64-linux-gnu") +- _add_directory(library_dirs, +- "/usr/lib/x86_64-linux-gnu") - break - elif platform_ in ["i386", "i686", "32bit"]: -- _add_directory( -- library_dirs, "/usr/lib/i386-linux-gnu") +- _add_directory(library_dirs, "/usr/lib/i386-linux-gnu") - break - elif platform_ in ["aarch64"]: - _add_directory(library_dirs, "/usr/lib64") -- _add_directory( -- library_dirs, "/usr/lib/aarch64-linux-gnu") +- _add_directory(library_dirs, +- "/usr/lib/aarch64-linux-gnu") - break - elif platform_ in ["arm", "armv7l"]: -- _add_directory( -- library_dirs, "/usr/lib/arm-linux-gnueabi") +- _add_directory(library_dirs, +- "/usr/lib/arm-linux-gnueabi") - break - elif platform_ in ["ppc64"]: - _add_directory(library_dirs, "/usr/lib64") -- _add_directory( -- library_dirs, "/usr/lib/ppc64-linux-gnu") -- _add_directory( -- library_dirs, "/usr/lib/powerpc64-linux-gnu") +- _add_directory(library_dirs, +- "/usr/lib/ppc64-linux-gnu") +- _add_directory(library_dirs, +- "/usr/lib/powerpc64-linux-gnu") - break - elif platform_ in ["ppc"]: - _add_directory(library_dirs, "/usr/lib/ppc-linux-gnu") -- _add_directory( -- library_dirs, "/usr/lib/powerpc-linux-gnu") +- _add_directory(library_dirs, +- "/usr/lib/powerpc-linux-gnu") - break - elif platform_ in ["s390x"]: - _add_directory(library_dirs, "/usr/lib64") -- _add_directory( -- library_dirs, "/usr/lib/s390x-linux-gnu") +- _add_directory(library_dirs, +- "/usr/lib/s390x-linux-gnu") - break - elif platform_ in ["s390"]: - _add_directory(library_dirs, "/usr/lib/s390-linux-gnu") diff --git a/packages/security/libressl/cert/ca-bundle.crt b/packages/security/libressl/cert/ca-bundle.crt deleted file mode 100644 index c783c93094a..00000000000 --- a/packages/security/libressl/cert/ca-bundle.crt +++ /dev/null @@ -1,4320 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIE2DCCBEGgAwIBAgIEN0rSQzANBgkqhkiG9w0BAQUFADCBwzELMAkGA1UEBhMC -VVMxFDASBgNVBAoTC0VudHJ1c3QubmV0MTswOQYDVQQLEzJ3d3cuZW50cnVzdC5u -ZXQvQ1BTIGluY29ycC4gYnkgcmVmLiAobGltaXRzIGxpYWIuKTElMCMGA1UECxMc -KGMpIDE5OTkgRW50cnVzdC5uZXQgTGltaXRlZDE6MDgGA1UEAxMxRW50cnVzdC5u -ZXQgU2VjdXJlIFNlcnZlciBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw05OTA1 -MjUxNjA5NDBaFw0xOTA1MjUxNjM5NDBaMIHDMQswCQYDVQQGEwJVUzEUMBIGA1UE -ChMLRW50cnVzdC5uZXQxOzA5BgNVBAsTMnd3dy5lbnRydXN0Lm5ldC9DUFMgaW5j -b3JwLiBieSByZWYuIChsaW1pdHMgbGlhYi4pMSUwIwYDVQQLExwoYykgMTk5OSBF -bnRydXN0Lm5ldCBMaW1pdGVkMTowOAYDVQQDEzFFbnRydXN0Lm5ldCBTZWN1cmUg -U2VydmVyIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIGdMA0GCSqGSIb3DQEBAQUA -A4GLADCBhwKBgQDNKIM0VBuJ8w+vN5Ex/68xYMmo6LIQaO2f55M28Qpku0f1BBc/ -I0dNxScZgSYMVHINiC3ZH5oSn7yzcdOAGT9HZnuMNSjSuQrfJNqc1lB5gXpa0zf3 -wkrYKZImZNHkmGw6AIr1NJtl+O3jEP/9uElY3KDegjlrgbEWGWG5VLbmQwIBA6OC -AdcwggHTMBEGCWCGSAGG+EIBAQQEAwIABzCCARkGA1UdHwSCARAwggEMMIHeoIHb -oIHYpIHVMIHSMQswCQYDVQQGEwJVUzEUMBIGA1UEChMLRW50cnVzdC5uZXQxOzA5 -BgNVBAsTMnd3dy5lbnRydXN0Lm5ldC9DUFMgaW5jb3JwLiBieSByZWYuIChsaW1p -dHMgbGlhYi4pMSUwIwYDVQQLExwoYykgMTk5OSBFbnRydXN0Lm5ldCBMaW1pdGVk -MTowOAYDVQQDEzFFbnRydXN0Lm5ldCBTZWN1cmUgU2VydmVyIENlcnRpZmljYXRp -b24gQXV0aG9yaXR5MQ0wCwYDVQQDEwRDUkwxMCmgJ6AlhiNodHRwOi8vd3d3LmVu -dHJ1c3QubmV0L0NSTC9uZXQxLmNybDArBgNVHRAEJDAigA8xOTk5MDUyNTE2MDk0 -MFqBDzIwMTkwNTI1MTYwOTQwWjALBgNVHQ8EBAMCAQYwHwYDVR0jBBgwFoAU8Bdi -E1U9s/8KAGv7UISX8+1i0BowHQYDVR0OBBYEFPAXYhNVPbP/CgBr+1CEl/PtYtAa -MAwGA1UdEwQFMAMBAf8wGQYJKoZIhvZ9B0EABAwwChsEVjQuMAMCBJAwDQYJKoZI -hvcNAQEFBQADgYEAkNwwAvpkdMKnCqV8IY00F6j7Rw7/JXyNEwr75Ji174z4xRAN -95K+8cPV1ZVqBLssziY2ZcgxxufuP+NXdYR6Ee9GTxj005i7qIcyunL2POI9n9cd -2cNgQ4xYDiKWL2KjLB+6rQXvqzJ4h6BUcxm1XAX5Uj5tLUUL9wqT6u0G+bI= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIICkDCCAfmgAwIBAgIBATANBgkqhkiG9w0BAQQFADBaMQswCQYDVQQGEwJVUzEc -MBoGA1UEChMTRXF1aWZheCBTZWN1cmUgSW5jLjEtMCsGA1UEAxMkRXF1aWZheCBT -ZWN1cmUgR2xvYmFsIGVCdXNpbmVzcyBDQS0xMB4XDTk5MDYyMTA0MDAwMFoXDTIw -MDYyMTA0MDAwMFowWjELMAkGA1UEBhMCVVMxHDAaBgNVBAoTE0VxdWlmYXggU2Vj -dXJlIEluYy4xLTArBgNVBAMTJEVxdWlmYXggU2VjdXJlIEdsb2JhbCBlQnVzaW5l -c3MgQ0EtMTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAuucXkAJlsTRVPEnC -UdXfp9E3j9HngXNBUmCbnaEXJnitx7HoJpQytd4zjTov2/KaelpzmKNc6fuKcxtc -58O/gGzNqfTWK8D3+ZmqY6KxRwIP1ORROhI8bIpaVIRw28HFkM9yRcuoWcDNM50/ -o5brhTMhHD4ePmBudpxnhcXIw2ECAwEAAaNmMGQwEQYJYIZIAYb4QgEBBAQDAgAH -MA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUvqigdHJQa0S3ySPY+6j/s1dr -aGwwHQYDVR0OBBYEFL6ooHRyUGtEt8kj2Puo/7NXa2hsMA0GCSqGSIb3DQEBBAUA -A4GBADDiAVGqx+pf2rnQZQ8w1j7aDRRJbpGTJxQx78T3LUX47Me/okENI7SS+RkA -Z70Br83gcfxaz2TE4JaY0KNA4gGK7ycH8WUBikQtBmV1UsCGECAhX2xrD2yuCRyv -8qIYNMR1pHMc8Y3c7635s3a0kr/clRAevsvIO1qEYBlWlKlV ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIICgjCCAeugAwIBAgIBBDANBgkqhkiG9w0BAQQFADBTMQswCQYDVQQGEwJVUzEc -MBoGA1UEChMTRXF1aWZheCBTZWN1cmUgSW5jLjEmMCQGA1UEAxMdRXF1aWZheCBT -ZWN1cmUgZUJ1c2luZXNzIENBLTEwHhcNOTkwNjIxMDQwMDAwWhcNMjAwNjIxMDQw -MDAwWjBTMQswCQYDVQQGEwJVUzEcMBoGA1UEChMTRXF1aWZheCBTZWN1cmUgSW5j -LjEmMCQGA1UEAxMdRXF1aWZheCBTZWN1cmUgZUJ1c2luZXNzIENBLTEwgZ8wDQYJ -KoZIhvcNAQEBBQADgY0AMIGJAoGBAM4vGbwXt3fek6lfWg0XTzQaDJj0ItlZ1MRo -RvC0NcWFAyDGr0WlIVFFQesWWDYyb+JQYmT5/VGcqiTZ9J2DKocKIdMSODRsjQBu -WqDZQu4aIZX5UkxVWsUPOE9G+m34LjXWHXzr4vCwdYDIqROsvojvOm6rXyo4YgKw -Env+j6YDAgMBAAGjZjBkMBEGCWCGSAGG+EIBAQQEAwIABzAPBgNVHRMBAf8EBTAD -AQH/MB8GA1UdIwQYMBaAFEp4MlIR21kWNl7fwRQ2QGpHfEyhMB0GA1UdDgQWBBRK -eDJSEdtZFjZe38EUNkBqR3xMoTANBgkqhkiG9w0BAQQFAAOBgQB1W6ibAxHm6VZM -zfmpTMANmvPMZWnmJXbMWbfWVMMdzZmsGd20hdXgPfxiIKeES1hl8eL5lSE/9dR+ -WB5Hh1Q+WKG1tfgq73HnvMP2sUlG4tega+VWeponmHxGYhTnyfxuAxJ5gDgdSIKN -/Bf+KpYrtWKmpj29f5JZzVoqgrI3eQ== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIICWjCCAcMCAgGlMA0GCSqGSIb3DQEBBAUAMHUxCzAJBgNVBAYTAlVTMRgwFgYD -VQQKEw9HVEUgQ29ycG9yYXRpb24xJzAlBgNVBAsTHkdURSBDeWJlclRydXN0IFNv -bHV0aW9ucywgSW5jLjEjMCEGA1UEAxMaR1RFIEN5YmVyVHJ1c3QgR2xvYmFsIFJv -b3QwHhcNOTgwODEzMDAyOTAwWhcNMTgwODEzMjM1OTAwWjB1MQswCQYDVQQGEwJV -UzEYMBYGA1UEChMPR1RFIENvcnBvcmF0aW9uMScwJQYDVQQLEx5HVEUgQ3liZXJU -cnVzdCBTb2x1dGlvbnMsIEluYy4xIzAhBgNVBAMTGkdURSBDeWJlclRydXN0IEds -b2JhbCBSb290MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCVD6C28FCc6HrH -iM3dFw4usJTQGz0O9pTAipTHBsiQl8i4ZBp6fmw8U+E3KHNgf7KXUwefU/ltWJTS -r41tiGeA5u2ylc9yMcqlHHK6XALnZELn+aks1joNrI1CqiQBOeacPwGFVw1Yh0X4 -04Wqk2kmhXBIgD8SFcd5tB8FLztimQIDAQABMA0GCSqGSIb3DQEBBAUAA4GBAG3r -GwnpXtlR22ciYaQqPEh346B8pt5zohQDhT37qw4wxYMWM4ETCJ57NE7fQMh017l9 -3PR2VX2bY1QY6fDq81yx2YtCHrnAlU66+tXifPVoYb+O7AWXX1uw16OFNMQkpw0P -lZPvy5TYnh+dXIVtx6quTx8itc2VrbqnzPmrC3p/ ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIFSzCCBLSgAwIBAgIBaTANBgkqhkiG9w0BAQQFADCBmTELMAkGA1UEBhMCSFUx -ETAPBgNVBAcTCEJ1ZGFwZXN0MScwJQYDVQQKEx5OZXRMb2NrIEhhbG96YXRiaXp0 -b25zYWdpIEtmdC4xGjAYBgNVBAsTEVRhbnVzaXR2YW55a2lhZG9rMTIwMAYDVQQD -EylOZXRMb2NrIFV6bGV0aSAoQ2xhc3MgQikgVGFudXNpdHZhbnlraWFkbzAeFw05 -OTAyMjUxNDEwMjJaFw0xOTAyMjAxNDEwMjJaMIGZMQswCQYDVQQGEwJIVTERMA8G -A1UEBxMIQnVkYXBlc3QxJzAlBgNVBAoTHk5ldExvY2sgSGFsb3phdGJpenRvbnNh -Z2kgS2Z0LjEaMBgGA1UECxMRVGFudXNpdHZhbnlraWFkb2sxMjAwBgNVBAMTKU5l -dExvY2sgVXpsZXRpIChDbGFzcyBCKSBUYW51c2l0dmFueWtpYWRvMIGfMA0GCSqG -SIb3DQEBAQUAA4GNADCBiQKBgQCx6gTsIKAjwo84YM/HRrPVG/77uZmeBNwcf4xK -gZjupNTKihe5In+DCnVMm8Bp2GQ5o+2So/1bXHQawEfKOml2mrriRBf8TKPV/riX -iK+IA4kfpPIEPsgHC+b5sy96YhQJRhTKZPWLgLViqNhr1nGTLbO/CVRY7QbrqHvc -Q7GhaQIDAQABo4ICnzCCApswEgYDVR0TAQH/BAgwBgEB/wIBBDAOBgNVHQ8BAf8E -BAMCAAYwEQYJYIZIAYb4QgEBBAQDAgAHMIICYAYJYIZIAYb4QgENBIICURaCAk1G -SUdZRUxFTSEgRXplbiB0YW51c2l0dmFueSBhIE5ldExvY2sgS2Z0LiBBbHRhbGFu -b3MgU3pvbGdhbHRhdGFzaSBGZWx0ZXRlbGVpYmVuIGxlaXJ0IGVsamFyYXNvayBh -bGFwamFuIGtlc3p1bHQuIEEgaGl0ZWxlc2l0ZXMgZm9seWFtYXRhdCBhIE5ldExv -Y2sgS2Z0LiB0ZXJtZWtmZWxlbG9zc2VnLWJpenRvc2l0YXNhIHZlZGkuIEEgZGln -aXRhbGlzIGFsYWlyYXMgZWxmb2dhZGFzYW5hayBmZWx0ZXRlbGUgYXogZWxvaXJ0 -IGVsbGVub3J6ZXNpIGVsamFyYXMgbWVndGV0ZWxlLiBBeiBlbGphcmFzIGxlaXJh -c2EgbWVndGFsYWxoYXRvIGEgTmV0TG9jayBLZnQuIEludGVybmV0IGhvbmxhcGph -biBhIGh0dHBzOi8vd3d3Lm5ldGxvY2submV0L2RvY3MgY2ltZW4gdmFneSBrZXJo -ZXRvIGF6IGVsbGVub3J6ZXNAbmV0bG9jay5uZXQgZS1tYWlsIGNpbWVuLiBJTVBP -UlRBTlQhIFRoZSBpc3N1YW5jZSBhbmQgdGhlIHVzZSBvZiB0aGlzIGNlcnRpZmlj -YXRlIGlzIHN1YmplY3QgdG8gdGhlIE5ldExvY2sgQ1BTIGF2YWlsYWJsZSBhdCBo -dHRwczovL3d3dy5uZXRsb2NrLm5ldC9kb2NzIG9yIGJ5IGUtbWFpbCBhdCBjcHNA -bmV0bG9jay5uZXQuMA0GCSqGSIb3DQEBBAUAA4GBAATbrowXr/gOkDFOzT4JwG06 -sPgzTEdM43WIEJessDgVkcYplswhwG08pXTP2IKlOcNl40JwuyKQ433bNXbhoLXa -n3BukxowOR0w2y7jfLKRstE3Kfq51hdcR0/jHTjrn9V7lagonhVK0dHQKwCXoOKS -NitjrFgBazMpUIaD8QFI ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIFTzCCBLigAwIBAgIBaDANBgkqhkiG9w0BAQQFADCBmzELMAkGA1UEBhMCSFUx -ETAPBgNVBAcTCEJ1ZGFwZXN0MScwJQYDVQQKEx5OZXRMb2NrIEhhbG96YXRiaXp0 -b25zYWdpIEtmdC4xGjAYBgNVBAsTEVRhbnVzaXR2YW55a2lhZG9rMTQwMgYDVQQD -EytOZXRMb2NrIEV4cHJlc3N6IChDbGFzcyBDKSBUYW51c2l0dmFueWtpYWRvMB4X -DTk5MDIyNTE0MDgxMVoXDTE5MDIyMDE0MDgxMVowgZsxCzAJBgNVBAYTAkhVMREw -DwYDVQQHEwhCdWRhcGVzdDEnMCUGA1UEChMeTmV0TG9jayBIYWxvemF0Yml6dG9u -c2FnaSBLZnQuMRowGAYDVQQLExFUYW51c2l0dmFueWtpYWRvazE0MDIGA1UEAxMr -TmV0TG9jayBFeHByZXNzeiAoQ2xhc3MgQykgVGFudXNpdHZhbnlraWFkbzCBnzAN -BgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA6+ywbGGKIyWvYCDj2Z/8kwvbXY2wobNA -OoLO/XXgeDIDhlqGlZHtU/qdQPzm6N3ZW3oDvV3zOwzDUXmbrVWg6dADEK8KuhRC -2VImESLH0iDMgqSaqf64gXadarfSNnU+sYYJ9m5tfk63euyucYT2BDMIJTLrdKwW -RMbkQJMdf60CAwEAAaOCAp8wggKbMBIGA1UdEwEB/wQIMAYBAf8CAQQwDgYDVR0P -AQH/BAQDAgAGMBEGCWCGSAGG+EIBAQQEAwIABzCCAmAGCWCGSAGG+EIBDQSCAlEW -ggJNRklHWUVMRU0hIEV6ZW4gdGFudXNpdHZhbnkgYSBOZXRMb2NrIEtmdC4gQWx0 -YWxhbm9zIFN6b2xnYWx0YXRhc2kgRmVsdGV0ZWxlaWJlbiBsZWlydCBlbGphcmFz -b2sgYWxhcGphbiBrZXN6dWx0LiBBIGhpdGVsZXNpdGVzIGZvbHlhbWF0YXQgYSBO -ZXRMb2NrIEtmdC4gdGVybWVrZmVsZWxvc3NlZy1iaXp0b3NpdGFzYSB2ZWRpLiBB -IGRpZ2l0YWxpcyBhbGFpcmFzIGVsZm9nYWRhc2FuYWsgZmVsdGV0ZWxlIGF6IGVs -b2lydCBlbGxlbm9yemVzaSBlbGphcmFzIG1lZ3RldGVsZS4gQXogZWxqYXJhcyBs -ZWlyYXNhIG1lZ3RhbGFsaGF0byBhIE5ldExvY2sgS2Z0LiBJbnRlcm5ldCBob25s -YXBqYW4gYSBodHRwczovL3d3dy5uZXRsb2NrLm5ldC9kb2NzIGNpbWVuIHZhZ3kg -a2VyaGV0byBheiBlbGxlbm9yemVzQG5ldGxvY2submV0IGUtbWFpbCBjaW1lbi4g -SU1QT1JUQU5UISBUaGUgaXNzdWFuY2UgYW5kIHRoZSB1c2Ugb2YgdGhpcyBjZXJ0 -aWZpY2F0ZSBpcyBzdWJqZWN0IHRvIHRoZSBOZXRMb2NrIENQUyBhdmFpbGFibGUg -YXQgaHR0cHM6Ly93d3cubmV0bG9jay5uZXQvZG9jcyBvciBieSBlLW1haWwgYXQg -Y3BzQG5ldGxvY2submV0LjANBgkqhkiG9w0BAQQFAAOBgQAQrX/XDDKACtiG8XmY -ta3UzbM2xJZIwVzNmtkFLp++UOv0JhQQLdRmF/iewSf98e3ke0ugbLWrmldwpu2g -pO0u9f38vf5NNwgMvOOWgyL1SRt/Syu0VMGAfJlOHdCM7tCs5ZL6dVb+ZKATj7i4 -Fp1hBWeAyNDYpQcCNJgEjTME1A== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIC5zCCAlACAQEwDQYJKoZIhvcNAQEFBQAwgbsxJDAiBgNVBAcTG1ZhbGlDZXJ0 -IFZhbGlkYXRpb24gTmV0d29yazEXMBUGA1UEChMOVmFsaUNlcnQsIEluYy4xNTAz -BgNVBAsTLFZhbGlDZXJ0IENsYXNzIDMgUG9saWN5IFZhbGlkYXRpb24gQXV0aG9y -aXR5MSEwHwYDVQQDExhodHRwOi8vd3d3LnZhbGljZXJ0LmNvbS8xIDAeBgkqhkiG -9w0BCQEWEWluZm9AdmFsaWNlcnQuY29tMB4XDTk5MDYyNjAwMjIzM1oXDTE5MDYy -NjAwMjIzM1owgbsxJDAiBgNVBAcTG1ZhbGlDZXJ0IFZhbGlkYXRpb24gTmV0d29y -azEXMBUGA1UEChMOVmFsaUNlcnQsIEluYy4xNTAzBgNVBAsTLFZhbGlDZXJ0IENs -YXNzIDMgUG9saWN5IFZhbGlkYXRpb24gQXV0aG9yaXR5MSEwHwYDVQQDExhodHRw -Oi8vd3d3LnZhbGljZXJ0LmNvbS8xIDAeBgkqhkiG9w0BCQEWEWluZm9AdmFsaWNl -cnQuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDjmFGWHOjVsQaBalfD -cnWTq8+epvzzFlLWLU2fNUSoLgRNB0mKOCn1dzfnt6td3zZxFJmP3MKS8edgkpfs -2Ejcv8ECIMYkpChMMFp2bbFc893enhBxoYjHW5tBbcqwuI4V7q0zK89HBFx1cQqY -JJgpp0lZpd34t0NiYfPT4tBVPwIDAQABMA0GCSqGSIb3DQEBBQUAA4GBAFa7AliE -Zwgs3x/be0kz9dNnnfS0ChCzycUs4pJqcXgn8nCDQtM+z6lU9PHYkhaM0QTLS6vJ -n0WuPIqpsHEzXcjFV9+vqDWzf4mH6eglkrh/hXqu1rweN1gqZ8mRzyqBPu3GOd/A -PhmcGcwTTYJBtYze4D1gCCAPRX5ron+jjBXu ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDJzCCApCgAwIBAgIBATANBgkqhkiG9w0BAQQFADCBzjELMAkGA1UEBhMCWkEx -FTATBgNVBAgTDFdlc3Rlcm4gQ2FwZTESMBAGA1UEBxMJQ2FwZSBUb3duMR0wGwYD -VQQKExRUaGF3dGUgQ29uc3VsdGluZyBjYzEoMCYGA1UECxMfQ2VydGlmaWNhdGlv -biBTZXJ2aWNlcyBEaXZpc2lvbjEhMB8GA1UEAxMYVGhhd3RlIFByZW1pdW0gU2Vy -dmVyIENBMSgwJgYJKoZIhvcNAQkBFhlwcmVtaXVtLXNlcnZlckB0aGF3dGUuY29t -MB4XDTk2MDgwMTAwMDAwMFoXDTIwMTIzMTIzNTk1OVowgc4xCzAJBgNVBAYTAlpB -MRUwEwYDVQQIEwxXZXN0ZXJuIENhcGUxEjAQBgNVBAcTCUNhcGUgVG93bjEdMBsG -A1UEChMUVGhhd3RlIENvbnN1bHRpbmcgY2MxKDAmBgNVBAsTH0NlcnRpZmljYXRp -b24gU2VydmljZXMgRGl2aXNpb24xITAfBgNVBAMTGFRoYXd0ZSBQcmVtaXVtIFNl -cnZlciBDQTEoMCYGCSqGSIb3DQEJARYZcHJlbWl1bS1zZXJ2ZXJAdGhhd3RlLmNv -bTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA0jY2aovXwlue2oFBYo847kkE -VdbQ7xwblRZH7xhINTpS9CtqBo87L+pW46+GjZ4X9560ZXUCTe/LCaIhUdib0GfQ -ug2SBhRz1JPLlyoAnFxODLz6FVL88kRu2hFKbgifLy3j+ao6hnO2RlNYyIkFvYMR -uHM/qgeN9EJN50CdHDcCAwEAAaMTMBEwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG -9w0BAQQFAAOBgQAmSCwWwlj66BZ0DKqqX1Q/8tfJeGBeXm43YyJ3Nn6yF8Q0ufUI -hfzJATj/Tb7yFkJD57taRvvBxhEf8UqwKEbJw8RCfbz6q1lu1bdRiBHjpIUZa4JM -pAwSremkrj/xw0llmozFyD4lt5SZu5IycQfwhl7tUCemDaYj+bvLpgcUQg== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDEzCCAnygAwIBAgIBATANBgkqhkiG9w0BAQQFADCBxDELMAkGA1UEBhMCWkEx -FTATBgNVBAgTDFdlc3Rlcm4gQ2FwZTESMBAGA1UEBxMJQ2FwZSBUb3duMR0wGwYD -VQQKExRUaGF3dGUgQ29uc3VsdGluZyBjYzEoMCYGA1UECxMfQ2VydGlmaWNhdGlv -biBTZXJ2aWNlcyBEaXZpc2lvbjEZMBcGA1UEAxMQVGhhd3RlIFNlcnZlciBDQTEm -MCQGCSqGSIb3DQEJARYXc2VydmVyLWNlcnRzQHRoYXd0ZS5jb20wHhcNOTYwODAx -MDAwMDAwWhcNMjAxMjMxMjM1OTU5WjCBxDELMAkGA1UEBhMCWkExFTATBgNVBAgT -DFdlc3Rlcm4gQ2FwZTESMBAGA1UEBxMJQ2FwZSBUb3duMR0wGwYDVQQKExRUaGF3 -dGUgQ29uc3VsdGluZyBjYzEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2aWNl -cyBEaXZpc2lvbjEZMBcGA1UEAxMQVGhhd3RlIFNlcnZlciBDQTEmMCQGCSqGSIb3 -DQEJARYXc2VydmVyLWNlcnRzQHRoYXd0ZS5jb20wgZ8wDQYJKoZIhvcNAQEBBQAD -gY0AMIGJAoGBANOkUG7I/1Zr5s9dtuoMaHVHoqrC2oQl/Kj0R1HahbUgdJSGHg91 -yekIYfUGbTBuFRkC6VLAYttNmZ7iagxEOM3+vuNkCXDF/rFrKbYvScg71CcEJRCX -L+eQbcAoQpnXTEPew/UhbVSfXcNY4cDk2VuwuNy0e982OsK1ZiIS1ocNAgMBAAGj -EzARMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEEBQADgYEAB/pMaVz7lcxG -7oWDTSEwjsrZqG9JGubaUeNgcGyEYRGhGshIPllDfU+VPaGLtwtimHp1it2ITk6e -QNuozDJ0uW8NxuOzRAvZim+aKZuZGCg70eNAKJpaPNW15yAbi8qkq43pUdniTCxZ -qdq5snUb9kLy78fyGPmJvKP/iiMucEc= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIC5zCCAlACAQEwDQYJKoZIhvcNAQEFBQAwgbsxJDAiBgNVBAcTG1ZhbGlDZXJ0 -IFZhbGlkYXRpb24gTmV0d29yazEXMBUGA1UEChMOVmFsaUNlcnQsIEluYy4xNTAz -BgNVBAsTLFZhbGlDZXJ0IENsYXNzIDEgUG9saWN5IFZhbGlkYXRpb24gQXV0aG9y -aXR5MSEwHwYDVQQDExhodHRwOi8vd3d3LnZhbGljZXJ0LmNvbS8xIDAeBgkqhkiG -9w0BCQEWEWluZm9AdmFsaWNlcnQuY29tMB4XDTk5MDYyNTIyMjM0OFoXDTE5MDYy -NTIyMjM0OFowgbsxJDAiBgNVBAcTG1ZhbGlDZXJ0IFZhbGlkYXRpb24gTmV0d29y -azEXMBUGA1UEChMOVmFsaUNlcnQsIEluYy4xNTAzBgNVBAsTLFZhbGlDZXJ0IENs -YXNzIDEgUG9saWN5IFZhbGlkYXRpb24gQXV0aG9yaXR5MSEwHwYDVQQDExhodHRw -Oi8vd3d3LnZhbGljZXJ0LmNvbS8xIDAeBgkqhkiG9w0BCQEWEWluZm9AdmFsaWNl -cnQuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDYWYJ6ibiWuqYvaG9Y -LqdUHAZu9OqNSLwxlBfw8068srg1knaw0KWlAdcAAxIiGQj4/xEjm84H9b9pGib+ -TunRf50sQB1ZaG6m+FiwnRqP0z/x3BkGgagO4DrdyFNFCQbmD3DD+kCmDuJWBQ8Y -TfwggtFzVXSNdnKgHZ0dwN0/cQIDAQABMA0GCSqGSIb3DQEBBQUAA4GBAFBoPUn0 -LBwGlN+VYH+Wexf+T3GtZMjdd9LvWVXoP+iOBSoh8gfStadS/pyxtuJbdxdA6nLW -I8sogTLDAHkY7FkXicnGah5xyf23dKUlRWnFSKsZ4UWKJWsZ7uW7EvV/96aNUcPw -nXS3qT6gpf+2SQMT2iLM7XGCK5nPOrf1LXLI ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIC5zCCAlACAQEwDQYJKoZIhvcNAQEFBQAwgbsxJDAiBgNVBAcTG1ZhbGlDZXJ0 -IFZhbGlkYXRpb24gTmV0d29yazEXMBUGA1UEChMOVmFsaUNlcnQsIEluYy4xNTAz -BgNVBAsTLFZhbGlDZXJ0IENsYXNzIDIgUG9saWN5IFZhbGlkYXRpb24gQXV0aG9y -aXR5MSEwHwYDVQQDExhodHRwOi8vd3d3LnZhbGljZXJ0LmNvbS8xIDAeBgkqhkiG -9w0BCQEWEWluZm9AdmFsaWNlcnQuY29tMB4XDTk5MDYyNjAwMTk1NFoXDTE5MDYy -NjAwMTk1NFowgbsxJDAiBgNVBAcTG1ZhbGlDZXJ0IFZhbGlkYXRpb24gTmV0d29y -azEXMBUGA1UEChMOVmFsaUNlcnQsIEluYy4xNTAzBgNVBAsTLFZhbGlDZXJ0IENs -YXNzIDIgUG9saWN5IFZhbGlkYXRpb24gQXV0aG9yaXR5MSEwHwYDVQQDExhodHRw -Oi8vd3d3LnZhbGljZXJ0LmNvbS8xIDAeBgkqhkiG9w0BCQEWEWluZm9AdmFsaWNl -cnQuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDOOnHK5avIWZJV16vY -dA757tn2VUdZZUcOBVXc65g2PFxTXdMwzzjsvUGJ7SVCCSRrCl6zfN1SLUzm1NZ9 -WlmpZdRJEy0kTRxQb7XBhVQ7/nHk01xC+YDgkRoKWzk2Z/M/VXwbP7RfZHM047QS -v4dk+NoS/zcnwbNDu+97bi5p9wIDAQABMA0GCSqGSIb3DQEBBQUAA4GBADt/UG9v -UJSZSWI4OB9L+KXIPqeCgfYrx+jFzug6EILLGACOTb2oWH+heQC1u+mNr0HZDzTu -IYEZoDJJKPTEjlbVUjP9UNV+mWwD5MlM/Mtsq2azSiGM5bUMMj4QssxsodyamEwC -W/POuZ6lcg5Ktz885hZo+L7tdEy8W9ViH0Pd ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIICPDCCAaUCEHC65B0Q2Sk0tjjKewPMur8wDQYJKoZIhvcNAQECBQAwXzELMAkG -A1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFz -cyAzIFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTk2 -MDEyOTAwMDAwMFoXDTI4MDgwMTIzNTk1OVowXzELMAkGA1UEBhMCVVMxFzAVBgNV -BAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFzcyAzIFB1YmxpYyBQcmlt -YXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIGfMA0GCSqGSIb3DQEBAQUAA4GN -ADCBiQKBgQDJXFme8huKARS0EN8EQNvjV69qRUCPhAwL0TPZ2RHP7gJYHyX3KqhE -BarsAx94f56TuZoAqiN91qyFomNFx3InzPRMxnVx0jnvT0Lwdd8KkMaOIG+YD/is -I19wKTakyYbnsZogy1Olhec9vn2a/iRFM9x2Fe0PonFkTGUugWhFpwIDAQABMA0G -CSqGSIb3DQEBAgUAA4GBALtMEivPLCYATxQT3ab7/AoRhIzzKBxnki98tsX63/Do -lbwdj2wsqFHMc9ikwFPwTtYmwHYBV4GSXiHx0bH/59AhWM1pF+NEHJwZRDmJXNyc -AA9WjQKZ7aKQRUzkuxCkPfAyAw7xzvjoyVGM5mKf5p/AfbdynMk2OmufTqj/ZA1k ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIICPDCCAaUCEDyRMcsf9tAbDpq40ES/Er4wDQYJKoZIhvcNAQEFBQAwXzELMAkG -A1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFz -cyAzIFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTk2 -MDEyOTAwMDAwMFoXDTI4MDgwMjIzNTk1OVowXzELMAkGA1UEBhMCVVMxFzAVBgNV -BAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFzcyAzIFB1YmxpYyBQcmlt -YXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIGfMA0GCSqGSIb3DQEBAQUAA4GN -ADCBiQKBgQDJXFme8huKARS0EN8EQNvjV69qRUCPhAwL0TPZ2RHP7gJYHyX3KqhE -BarsAx94f56TuZoAqiN91qyFomNFx3InzPRMxnVx0jnvT0Lwdd8KkMaOIG+YD/is -I19wKTakyYbnsZogy1Olhec9vn2a/iRFM9x2Fe0PonFkTGUugWhFpwIDAQABMA0G -CSqGSIb3DQEBBQUAA4GBABByUqkFFBkyCEHwxWsKzH4PIRnN5GfcX6kb5sroc50i -2JhucwNhkcV8sEVAbkSdjbCxlnRhLQ2pRdKkkirWmnWXbj9T/UWZYB2oK0z5XqcJ -2HUw19JlYD1n1khVdWk/kfVIC0dpImmClr7JyDiGSnoscxlIaU5rfGW/D/xwzoiQ ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDAjCCAmsCEH3Z/gfPqB63EHln+6eJNMYwDQYJKoZIhvcNAQEFBQAwgcExCzAJ -BgNVBAYTAlVTMRcwFQYDVQQKEw5WZXJpU2lnbiwgSW5jLjE8MDoGA1UECxMzQ2xh -c3MgMyBQdWJsaWMgUHJpbWFyeSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEcy -MTowOAYDVQQLEzEoYykgMTk5OCBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3Jp -emVkIHVzZSBvbmx5MR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBOZXR3b3JrMB4X -DTk4MDUxODAwMDAwMFoXDTI4MDgwMTIzNTk1OVowgcExCzAJBgNVBAYTAlVTMRcw -FQYDVQQKEw5WZXJpU2lnbiwgSW5jLjE8MDoGA1UECxMzQ2xhc3MgMyBQdWJsaWMg -UHJpbWFyeSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEcyMTowOAYDVQQLEzEo -YykgMTk5OCBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVkIHVzZSBvbmx5 -MR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBOZXR3b3JrMIGfMA0GCSqGSIb3DQEB -AQUAA4GNADCBiQKBgQDMXtERXVxp0KvTuWpMmR9ZmDCOFoUgRm1HP9SFIIThbbP4 -pO0M8RcPO/mn+SXXwc+EY/J8Y8+iR/LGWzOOZEAEaMGAuWQcRXfH2G71lSk8UOg0 -13gfqLptQ5GVj0VXXn7F+8qkBOvqlzdUMG+7AUcyM83cV5tkaWH4mx0ciU9cZwID -AQABMA0GCSqGSIb3DQEBBQUAA4GBAFFNzb5cy5gZnBWyATl4Lk0PZ3BwmcYQWpSk -U01UbSuvDV1Ai2TT1+7eVmGSX6bEHRBhNtMsJzzoKQm5EWR0zLVznxxIqbxhAe7i -F6YM40AIOw7n60RzKprxaZLvcRTDOaxxp5EJb+RxBrO6WVcmeQD2+A2iMzAo1KpY -oJ2daZH9 ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDzzCCAregAwIBAgIDAWweMA0GCSqGSIb3DQEBBQUAMIGNMQswCQYDVQQGEwJB -VDFIMEYGA1UECgw/QS1UcnVzdCBHZXMuIGYuIFNpY2hlcmhlaXRzc3lzdGVtZSBp -bSBlbGVrdHIuIERhdGVudmVya2VociBHbWJIMRkwFwYDVQQLDBBBLVRydXN0LW5R -dWFsLTAzMRkwFwYDVQQDDBBBLVRydXN0LW5RdWFsLTAzMB4XDTA1MDgxNzIyMDAw -MFoXDTE1MDgxNzIyMDAwMFowgY0xCzAJBgNVBAYTAkFUMUgwRgYDVQQKDD9BLVRy -dXN0IEdlcy4gZi4gU2ljaGVyaGVpdHNzeXN0ZW1lIGltIGVsZWt0ci4gRGF0ZW52 -ZXJrZWhyIEdtYkgxGTAXBgNVBAsMEEEtVHJ1c3QtblF1YWwtMDMxGTAXBgNVBAMM -EEEtVHJ1c3QtblF1YWwtMDMwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB -AQCtPWFuA/OQO8BBC4SAzewqo51ru27CQoT3URThoKgtUaNR8t4j8DRE/5TrzAUj -lUC5B3ilJfYKvUWG6Nm9wASOhURh73+nyfrBJcyFLGM/BWBzSQXgYHiVEEvc+RFZ -znF/QJuKqiTfC0Li21a8StKlDJu3Qz7dg9MmEALP6iPESU7l0+m0iKsMrmKS1GWH -2WrX9IWf5DMiJaXlyDO6w8dB3F/GaswADm0yqLaHNgBid5seHzTLkDx4iHQF63n1 -k3Flyp3HaxgtPVxO59X4PzF9j4fsCiIvI+n+u33J4PTs63zEsMMtYrWacdaxaujs -2e3Vcuy+VwHOBVWf3tFgiBCzAgMBAAGjNjA0MA8GA1UdEwEB/wQFMAMBAf8wEQYD -VR0OBAoECERqlWdVeRFPMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQUFAAOC -AQEAVdRU0VlIXLOThaq/Yy/kgM40ozRiPvbY7meIMQQDbwvUB/tOdQ/TLtPAF8fG -KOwGDREkDg6lXb+MshOWcdzUzg4NCmgybLlBMRmrsQd7TZjTXLDR8KdCoLXEjq/+ -8T/0709GAHbrAvv5ndJAlseIOrifEXnzgGWovR/TeIGgUUw3tKZdJXDRZslo+S4R -FGjxVJgIrCaSD96JntT6s3kr0qN51OyLrIdTaEJMUVF0HhsnLuP1Hyl0Te2v9+GS -mYHovjrHF1D2t8b8m7CKa9aIA5GPBnc6hQLdmNVDeD/GMBWsm2vLV7eJUYs66MmE -DNuxUCAKGkq6ahq97BvIxYSazQ== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIH0zCCBbugAwIBAgIIXsO3pkN/pOAwDQYJKoZIhvcNAQEFBQAwQjESMBAGA1UE -AwwJQUNDVlJBSVoxMRAwDgYDVQQLDAdQS0lBQ0NWMQ0wCwYDVQQKDARBQ0NWMQsw -CQYDVQQGEwJFUzAeFw0xMTA1MDUwOTM3MzdaFw0zMDEyMzEwOTM3MzdaMEIxEjAQ -BgNVBAMMCUFDQ1ZSQUlaMTEQMA4GA1UECwwHUEtJQUNDVjENMAsGA1UECgwEQUND -VjELMAkGA1UEBhMCRVMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCb -qau/YUqXry+XZpp0X9DZlv3P4uRm7x8fRzPCRKPfmt4ftVTdFXxpNRFvu8gMjmoY -HtiP2Ra8EEg2XPBjs5BaXCQ316PWywlxufEBcoSwfdtNgM3802/J+Nq2DoLSRYWo -G2ioPej0RGy9ocLLA76MPhMAhN9KSMDjIgro6TenGEyxCQ0jVn8ETdkXhBilyNpA -lHPrzg5XPAOBOp0KoVdDaaxXbXmQeOW1tDvYvEyNKKGno6e6Ak4l0Squ7a4DIrhr -IA8wKFSVf+DuzgpmndFALW4ir50awQUZ0m/A8p/4e7MCQvtQqR0tkw8jq8bBD5L/ -0KIV9VMJcRz/RROE5iZe+OCIHAr8Fraocwa48GOEAqDGWuzndN9wrqODJerWx5eH -k6fGioozl2A3ED6XPm4pFdahD9GILBKfb6qkxkLrQaLjlUPTAYVtjrs78yM2x/47 -4KElB0iryYl0/wiPgL/AlmXz7uxLaL2diMMxs0Dx6M/2OLuc5NF/1OVYm3z61PMO -m3WR5LpSLhl+0fXNWhn8ugb2+1KoS5kE3fj5tItQo05iifCHJPqDQsGH+tUtKSpa -cXpkatcnYGMN285J9Y0fkIkyF/hzQ7jSWpOGYdbhdQrqeWZ2iE9x6wQl1gpaepPl -uUsXQA+xtrn13k/c4LOsOxFwYIRKQ26ZIMApcQrAZQIDAQABo4ICyzCCAscwfQYI -KwYBBQUHAQEEcTBvMEwGCCsGAQUFBzAChkBodHRwOi8vd3d3LmFjY3YuZXMvZmls -ZWFkbWluL0FyY2hpdm9zL2NlcnRpZmljYWRvcy9yYWl6YWNjdjEuY3J0MB8GCCsG -AQUFBzABhhNodHRwOi8vb2NzcC5hY2N2LmVzMB0GA1UdDgQWBBTSh7Tj3zcnk1X2 -VuqB5TbMjB4/vTAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFNKHtOPfNyeT -VfZW6oHlNsyMHj+9MIIBcwYDVR0gBIIBajCCAWYwggFiBgRVHSAAMIIBWDCCASIG -CCsGAQUFBwICMIIBFB6CARAAQQB1AHQAbwByAGkAZABhAGQAIABkAGUAIABDAGUA -cgB0AGkAZgBpAGMAYQBjAGkA8wBuACAAUgBhAO0AegAgAGQAZQAgAGwAYQAgAEEA -QwBDAFYAIAAoAEEAZwBlAG4AYwBpAGEAIABkAGUAIABUAGUAYwBuAG8AbABvAGcA -7QBhACAAeQAgAEMAZQByAHQAaQBmAGkAYwBhAGMAaQDzAG4AIABFAGwAZQBjAHQA -cgDzAG4AaQBjAGEALAAgAEMASQBGACAAUQA0ADYAMAAxADEANQA2AEUAKQAuACAA -QwBQAFMAIABlAG4AIABoAHQAdABwADoALwAvAHcAdwB3AC4AYQBjAGMAdgAuAGUA -czAwBggrBgEFBQcCARYkaHR0cDovL3d3dy5hY2N2LmVzL2xlZ2lzbGFjaW9uX2Mu -aHRtMFUGA1UdHwROMEwwSqBIoEaGRGh0dHA6Ly93d3cuYWNjdi5lcy9maWxlYWRt -aW4vQXJjaGl2b3MvY2VydGlmaWNhZG9zL3JhaXphY2N2MV9kZXIuY3JsMA4GA1Ud -DwEB/wQEAwIBBjAXBgNVHREEEDAOgQxhY2N2QGFjY3YuZXMwDQYJKoZIhvcNAQEF -BQADggIBAJcxAp/n/UNnSEQU5CmH7UwoZtCPNdpNYbdKl02125DgBS4OxnnQ8pdp -D70ER9m+27Up2pvZrqmZ1dM8MJP1jaGo/AaNRPTKFpV8M9xii6g3+CfYCS0b78gU -JyCpZET/LtZ1qmxNYEAZSUNUY9rizLpm5U9EelvZaoErQNV/+QEnWCzI7UiRfD+m -AM/EKXMRNt6GGT6d7hmKG9Ww7Y49nCrADdg9ZuM8Db3VlFzi4qc1GwQA9j9ajepD -vV+JHanBsMyZ4k0ACtrJJ1vnE5Bc5PUzolVt3OAJTS+xJlsndQAJxGJ3KQhfnlms -tn6tn1QwIgPBHnFk/vk4CpYY3QIUrCPLBhwepH2NDd4nQeit2hW3sCPdK6jT2iWH -7ehVRE2I9DZ+hJp4rPcOVkkO1jMl1oRQQmwgEh0q1b688nCBpHBgvgW1m54ERL5h -I6zppSSMEYCUWqKiuUnSwdzRp+0xESyeGabu4VXhwOrPDYTkF7eifKXeVSUG7szA -h1xA2syVP1XgNce4hL60Xc16gwFy7ofmXx2utYXGJt/mwZrpHgJHnyqobalbz+xF -d3+YJ5oyXSrjhO7FmGYvliAd3djDJ9ew+f7Zfc3Qn48LFFhRny+Lwzgt3uiP1o2H -pPVWQxaZLPSkVrQ0uGE3ycJYgBugl6H8WY3pEfbRD0tVNEYqi4Y7 ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIFtTCCA52gAwIBAgIIYY3HhjsBggUwDQYJKoZIhvcNAQEFBQAwRDEWMBQGA1UE -AwwNQUNFRElDT00gUm9vdDEMMAoGA1UECwwDUEtJMQ8wDQYDVQQKDAZFRElDT00x -CzAJBgNVBAYTAkVTMB4XDTA4MDQxODE2MjQyMloXDTI4MDQxMzE2MjQyMlowRDEW -MBQGA1UEAwwNQUNFRElDT00gUm9vdDEMMAoGA1UECwwDUEtJMQ8wDQYDVQQKDAZF -RElDT00xCzAJBgNVBAYTAkVTMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKC -AgEA/5KV4WgGdrQsyFhIyv2AVClVYyT/kGWbEHV7w2rbYgIB8hiGtXxaOLHkWLn7 -09gtn70yN78sFW2+tfQh0hOR2QetAQXW8713zl9CgQr5auODAKgrLlUTY4HKRxx7 -XBZXehuDYAQ6PmXDzQHe3qTWDLqO3tkE7hdWIpuPY/1NFgu3e3eM+SW10W2ZEi5P -Grjm6gSSrj0RuVFCPYewMYWveVqc/udOXpJPQ/yrOq2lEiZmueIM15jO1FillUAK -t0SdE3QrwqXrIhWYENiLxQSfHY9g5QYbm8+5eaA9oiM/Qj9r+hwDezCNzmzAv+Yb -X79nuIQZ1RXve8uQNjFiybwCq0Zfm/4aaJQ0PZCOrfbkHQl/Sog4P75n/TSW9R28 -MHTLOO7VbKvU/PQAtwBbhTIWdjPp2KOZnQUAqhbm84F9b32qhm2tFXTTxKJxqvQU -fecyuB+81fFOvW8XAjnXDpVCOscAPukmYxHqC9FK/xidstd7LzrZlvvoHpKuE1XI -2Sf23EgbsCTBheN3nZqk8wwRHQ3ItBTutYJXCb8gWH8vIiPYcMt5bMlL8qkqyPyH -K9caUPgn6C9D4zq92Fdx/c6mUlv53U3t5fZvie27k5x2IXXwkkwp9y+cAS7+UEae -ZAwUswdbxcJzbPEHXEUkFDWug/FqTYl6+rPYLWbwNof1K1MCAwEAAaOBqjCBpzAP -BgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFKaz4SsrSbbXc6GqlPUB53NlTKxQ -MA4GA1UdDwEB/wQEAwIBhjAdBgNVHQ4EFgQUprPhKytJttdzoaqU9QHnc2VMrFAw -RAYDVR0gBD0wOzA5BgRVHSAAMDEwLwYIKwYBBQUHAgEWI2h0dHA6Ly9hY2VkaWNv -bS5lZGljb21ncm91cC5jb20vZG9jMA0GCSqGSIb3DQEBBQUAA4ICAQDOLAtSUWIm -fQwng4/F9tqgaHtPkl7qpHMyEVNEskTLnewPeUKzEKbHDZ3Ltvo/Onzqv4hTGzz3 -gvoFNTPhNahXwOf9jU8/kzJPeGYDdwdY6ZXIfj7QeQCM8htRM5u8lOk6e25SLTKe -I6RF+7YuE7CLGLHdztUdp0J/Vb77W7tH1PwkzQSulgUV1qzOMPPKC8W64iLgpq0i -5ALudBF/TP94HTXa5gI06xgSYXcGCRZj6hitoocf8seACQl1ThCojz2GuHURwCRi -ipZ7SkXp7FnFvmuD5uHorLUwHv4FB4D54SMNUI8FmP8sX+g7tq3PgbUhh8oIKiMn -MCArz+2UW6yyetLHKKGKC5tNSixthT8Jcjxn4tncB7rrZXtaAWPWkFtPF2Y9fwsZ -o5NjEFIqnxQWWOLcpfShFosOkYuByptZ+thrkQdlVV9SH686+5DdaaVbnG0OLLb6 -zqylfDJKZ0DcMDQj3dcEI2bw/FWAp/tmGYI1Z2JwOV5vx+qQQEQIHriy1tvuWacN -GHk0vFQYXlPKNFHtRQrmjseCNj6nOGOpMCwXEGCSn1WHElkQwg9naRHMTh5+Spqt -r0CodaxWkHS4oJyleW/c6RrIaQXpuvoDs3zk4E7Czp3otkYNbn5XOmeUwssfnHdK -Z05phkOTOPu220+DkdRgfks+KzgHVZhepA== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIFuzCCA6OgAwIBAgIIVwoRl0LE48wwDQYJKoZIhvcNAQELBQAwazELMAkGA1UE -BhMCSVQxDjAMBgNVBAcMBU1pbGFuMSMwIQYDVQQKDBpBY3RhbGlzIFMucC5BLi8w -MzM1ODUyMDk2NzEnMCUGA1UEAwweQWN0YWxpcyBBdXRoZW50aWNhdGlvbiBSb290 -IENBMB4XDTExMDkyMjExMjIwMloXDTMwMDkyMjExMjIwMlowazELMAkGA1UEBhMC -SVQxDjAMBgNVBAcMBU1pbGFuMSMwIQYDVQQKDBpBY3RhbGlzIFMucC5BLi8wMzM1 -ODUyMDk2NzEnMCUGA1UEAwweQWN0YWxpcyBBdXRoZW50aWNhdGlvbiBSb290IENB -MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAp8bEpSmkLO/lGMWwUKNv -UTufClrJwkg4CsIcoBh/kbWHuUA/3R1oHwiD1S0eiKD4j1aPbZkCkpAW1V8IbInX -4ay8IMKx4INRimlNAJZaby/ARH6jDuSRzVju3PvHHkVH3Se5CAGfpiEd9UEtL0z9 -KK3giq0itFZljoZUj5NDKd45RnijMCO6zfB9E1fAXdKDa0hMxKufgFpbOr3JpyI/ -gCczWw63igxdBzcIy2zSekciRDXFzMwujt0q7bd9Zg1fYVEiVRvjRuPjPdA1Yprb -rxTIW6HMiRvhMCb8oJsfgadHHwTrozmSBp+Z07/T6k9QnBn+locePGX2oxgkg4YQ -51Q+qDp2JE+BIcXjDwL4k5RHILv+1A7TaLndxHqEguNTVHnd25zS8gebLra8Pu2F -be8lEfKXGkJh90qX6IuxEAf6ZYGyojnP9zz/GPvG8VqLWeICrHuS0E4UT1lF9gxe -KF+w6D9Fz8+vm2/7hNN3WpVvrJSEnu68wEqPSpP4RCHiMUVhUE4Q2OM1fEwZtN4F -v6MGn8i1zeQf1xcGDXqVdFUNaBr8EBtiZJ1t4JWgw5QHVw0U5r0F+7if5t+L4sbn -fpb2U8WANFAoWPASUHEXMLrmeGO89LKtmyuy/uE5jF66CyCU3nuDuP/jVo23Eek7 -jPKxwV2dpAtMK9myGPW1n0sCAwEAAaNjMGEwHQYDVR0OBBYEFFLYiDrIn3hm7Ynz -ezhwlMkCAjbQMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUUtiIOsifeGbt -ifN7OHCUyQICNtAwDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEBCwUAA4ICAQAL -e3KHwGCmSUyIWOYdiPcUZEim2FgKDk8TNd81HdTtBjHIgT5q1d07GjLukD0R0i70 -jsNjLiNmsGe+b7bAEzlgqqI0JZN1Ut6nna0Oh4lScWoWPBkdg/iaKWW+9D+a2fDz -WochcYBNy+A4mz+7+uAwTc+G02UQGRjRlwKxK3JCaKygvU5a2hi/a5iB0P2avl4V -SM0RFbnAKVy06Ij3Pjaut2L9HmLecHgQHEhb2rykOLpn7VU+Xlff1ANATIGk0k9j -pwlCCRT8AKnCgHNPLsBA2RF7SOp6AsDT6ygBJlh0wcBzIm2Tlf05fbsq4/aC4yyX -X04fkZT6/iyj2HYauE2yOE+b+h1IYHkm4vP9qdCa6HCPSXrW5b0KDtst842/6+Ok -fcvHlXHo2qN8xcL4dJIEG4aspCJTQLas/kx2z/uUMsA1n3Y/buWQbqCmJqK4LL7R -K4X9p2jIugErsWx0Hbhzlefut8cl8ABMALJ+tguLHPPAUJ4lueAI3jZm/zel0btU -ZCzJJ7VLkn5l/9Mt4blOvH+kQSGQQXemOR/qnuOf0GZvBeyqdn6/axag67XH/JJU -LysRJyU3eExRarDzzFhdFPFqSBX/wge2sY0PjlxQRrM9vwGYT7JZVEc+NHt4bVaT -LnPqZih4zR0Uv6CPLy64Lo7yFIrM6bV8+2ydDKXhlg== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIENjCCAx6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBvMQswCQYDVQQGEwJTRTEU -MBIGA1UEChMLQWRkVHJ1c3QgQUIxJjAkBgNVBAsTHUFkZFRydXN0IEV4dGVybmFs -IFRUUCBOZXR3b3JrMSIwIAYDVQQDExlBZGRUcnVzdCBFeHRlcm5hbCBDQSBSb290 -MB4XDTAwMDUzMDEwNDgzOFoXDTIwMDUzMDEwNDgzOFowbzELMAkGA1UEBhMCU0Ux -FDASBgNVBAoTC0FkZFRydXN0IEFCMSYwJAYDVQQLEx1BZGRUcnVzdCBFeHRlcm5h -bCBUVFAgTmV0d29yazEiMCAGA1UEAxMZQWRkVHJ1c3QgRXh0ZXJuYWwgQ0EgUm9v -dDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALf3GjPm8gAELTngTlvt -H7xsD821+iO2zt6bETOXpClMfZOfvUq8k+0DGuOPz+VtUFrWlymUWoCwSXrbLpX9 -uMq/NzgtHj6RQa1wVsfwTz/oMp50ysiQVOnGXw94nZpAPA6sYapeFI+eh6FqUNzX -mk6vBbOmcZSccbNQYArHE504B4YCqOmoaSYYkKtMsE8jqzpPhNjfzp/haW+710LX -a0Tkx63ubUFfclpxCDezeWWkWaCUN/cALw3CknLa0Dhy2xSoRcRdKn23tNbE7qzN -E0S3ySvdQwAl+mG5aWpYIxG3pzOPVnVZ9c0p10a3CitlttNCbxWyuHv77+ldU9U0 -WicCAwEAAaOB3DCB2TAdBgNVHQ4EFgQUrb2YejS0Jvf6xCZU7wO94CTLVBowCwYD -VR0PBAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wgZkGA1UdIwSBkTCBjoAUrb2YejS0 -Jvf6xCZU7wO94CTLVBqhc6RxMG8xCzAJBgNVBAYTAlNFMRQwEgYDVQQKEwtBZGRU -cnVzdCBBQjEmMCQGA1UECxMdQWRkVHJ1c3QgRXh0ZXJuYWwgVFRQIE5ldHdvcmsx -IjAgBgNVBAMTGUFkZFRydXN0IEV4dGVybmFsIENBIFJvb3SCAQEwDQYJKoZIhvcN -AQEFBQADggEBALCb4IUlwtYj4g+WBpKdQZic2YR5gdkeWxQHIzZlj7DYd7usQWxH -YINRsPkyPef89iYTx4AWpb9a/IfPeHmJIZriTAcKhjW88t5RxNKWt9x+Tu5w/Rw5 -6wwCURQtjr0W4MHfRnXnJK3s9EK0hZNwEGe6nQY1ShjTK3rMUUKhemPR5ruhxSvC -Nr4TDea9Y355e6cJDUCrat2PisP29owaQgVR1EX1n6diIWgVIEM8med8vSTYqZEX -c4g/VhsxOBi0cQ+azcgOno4uG+GMmIPLHzHxREzGBHNJdmAPx/i9F4BrLunMTA5a -mnkPIAou1Z5jJh5VkpTYghdae9C8x49OhgQ= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIEGDCCAwCgAwIBAgIBATANBgkqhkiG9w0BAQUFADBlMQswCQYDVQQGEwJTRTEU -MBIGA1UEChMLQWRkVHJ1c3QgQUIxHTAbBgNVBAsTFEFkZFRydXN0IFRUUCBOZXR3 -b3JrMSEwHwYDVQQDExhBZGRUcnVzdCBDbGFzcyAxIENBIFJvb3QwHhcNMDAwNTMw -MTAzODMxWhcNMjAwNTMwMTAzODMxWjBlMQswCQYDVQQGEwJTRTEUMBIGA1UEChML -QWRkVHJ1c3QgQUIxHTAbBgNVBAsTFEFkZFRydXN0IFRUUCBOZXR3b3JrMSEwHwYD -VQQDExhBZGRUcnVzdCBDbGFzcyAxIENBIFJvb3QwggEiMA0GCSqGSIb3DQEBAQUA -A4IBDwAwggEKAoIBAQCWltQhSWDia+hBBwzexODcEyPNwTXH+9ZOEQpnXvUGW2ul -CDtbKRY654eyNAbFvAWlA3yCyykQruGIgb3WntP+LVbBFc7jJp0VLhD7Bo8wBN6n -tGO0/7Gcrjyvd7ZWxbWroulpOj0OM3kyP3CCkplhbY0wCI9xP6ZIVxn4JdxLZlyl -dI+Yrsj5wAYi56xz36Uu+1LcsRVlIPo1Zmne3yzxbrww2ywkEtvrNTVokMsAsJch -PXQhI2U0K7t4WaPW4XY5mqRJjox0r26kmqPZm9I4XJuiGMx1I4S+6+JNM3GOGvDC -+Mcdoq0Dlyz4zyXG9rgkMbFjXZJ/Y/AlyVMuH79NAgMBAAGjgdIwgc8wHQYDVR0O -BBYEFJWxtPCUtr3H2tERCSG+wa9J/RB7MAsGA1UdDwQEAwIBBjAPBgNVHRMBAf8E -BTADAQH/MIGPBgNVHSMEgYcwgYSAFJWxtPCUtr3H2tERCSG+wa9J/RB7oWmkZzBl -MQswCQYDVQQGEwJTRTEUMBIGA1UEChMLQWRkVHJ1c3QgQUIxHTAbBgNVBAsTFEFk -ZFRydXN0IFRUUCBOZXR3b3JrMSEwHwYDVQQDExhBZGRUcnVzdCBDbGFzcyAxIENB -IFJvb3SCAQEwDQYJKoZIhvcNAQEFBQADggEBACxtZBsfzQ3duQH6lmM0MkhHma6X -7f1yFqZzR1r0693p9db7RcwpiURdv0Y5PejuvE1Uhh4dbOMXJ0PhiVYrqW9yTkkz -43J8KiOavD7/KCrto/8cI7pDVwlnTUtiBi34/2ydYB7YHEt9tTEv2dB8Xfjea4MY -eDdXL+gzB2ffHsdrKpV2ro9Xo/D0UrSpUwjP4E/TelOL/bscVjby/rK25Xa71SJl -pz/+0WatC7xrmYbvP33zGDLKe8bjq2RGlfgmadlVg3sslgf/WSxEo8bl6ancoWOA -WiFeIc9TVPC6b4nbqKqVz4vjccweGyBECMB6tkD9xOQ14R0WHNC8K47Wcdk= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIEFTCCAv2gAwIBAgIBATANBgkqhkiG9w0BAQUFADBkMQswCQYDVQQGEwJTRTEU -MBIGA1UEChMLQWRkVHJ1c3QgQUIxHTAbBgNVBAsTFEFkZFRydXN0IFRUUCBOZXR3 -b3JrMSAwHgYDVQQDExdBZGRUcnVzdCBQdWJsaWMgQ0EgUm9vdDAeFw0wMDA1MzAx -MDQxNTBaFw0yMDA1MzAxMDQxNTBaMGQxCzAJBgNVBAYTAlNFMRQwEgYDVQQKEwtB -ZGRUcnVzdCBBQjEdMBsGA1UECxMUQWRkVHJ1c3QgVFRQIE5ldHdvcmsxIDAeBgNV -BAMTF0FkZFRydXN0IFB1YmxpYyBDQSBSb290MIIBIjANBgkqhkiG9w0BAQEFAAOC -AQ8AMIIBCgKCAQEA6Rowj4OIFMEg2Dybjxt+A3S72mnTRqX4jsIMEZBRpS9mVEBV -6tsfSlbunyNu9DnLoblv8n75XYcmYZ4c+OLspoH4IcUkzBEMP9smcnrHAZcHF/nX -GCwwfQ56HmIexkvA/X1id9NEHif2P0tEs7c42TkfYNVRknMDtABp4/MUTu7R3AnP -dzRGULD4EfL+OHn3Bzn+UZKXC1sIXzSGAa2Il+tmzV7R/9x98oTaunet3IAIx6eH -1lWfl2royBFkuucZKT8Rs3iQhCBSWxHveNCD9tVIkNAwHM+A+WD+eeSI8t0A65RF -62WUaUC6wNW0uLp9BBGo6zEFlpROWCGOn9Bg/QIDAQABo4HRMIHOMB0GA1UdDgQW -BBSBPjfYkrAfd59ctKtzquf2NGAv+jALBgNVHQ8EBAMCAQYwDwYDVR0TAQH/BAUw -AwEB/zCBjgYDVR0jBIGGMIGDgBSBPjfYkrAfd59ctKtzquf2NGAv+qFopGYwZDEL -MAkGA1UEBhMCU0UxFDASBgNVBAoTC0FkZFRydXN0IEFCMR0wGwYDVQQLExRBZGRU -cnVzdCBUVFAgTmV0d29yazEgMB4GA1UEAxMXQWRkVHJ1c3QgUHVibGljIENBIFJv -b3SCAQEwDQYJKoZIhvcNAQEFBQADggEBAAP3FUr4JNojVhaTdt02KLmuG7jD8WS6 -IBh4lSknVwW8fCr0uVFV2ocC3g8WFzH4qnkuCRO7r7IgGRLlk/lL+YPoRNWyQSW/ -iHVv/xD8SlTQX/D67zZzfRs2RcYhbbQVuE7PnFylPVoAjgbjPGsye/Kf8Lb93/Ao -GEjwxrzQvzSAlsJKsW2Ox5BF3i9nrEUEo3rcVZLJR2bYGozH7ZxOmuASu7VqTITh -4SINhwBk/ox9Yjllpu9CtoAlEmEBqCQTcAARJl/6NVDFSMwGR+gn2HCNX2TmoUQm -XiLsks3/QppEIW1cxeMiHV9HEufOX1362KqxMy3ZdvJOOjMMK7MtkAY= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIEHjCCAwagAwIBAgIBATANBgkqhkiG9w0BAQUFADBnMQswCQYDVQQGEwJTRTEU -MBIGA1UEChMLQWRkVHJ1c3QgQUIxHTAbBgNVBAsTFEFkZFRydXN0IFRUUCBOZXR3 -b3JrMSMwIQYDVQQDExpBZGRUcnVzdCBRdWFsaWZpZWQgQ0EgUm9vdDAeFw0wMDA1 -MzAxMDQ0NTBaFw0yMDA1MzAxMDQ0NTBaMGcxCzAJBgNVBAYTAlNFMRQwEgYDVQQK -EwtBZGRUcnVzdCBBQjEdMBsGA1UECxMUQWRkVHJ1c3QgVFRQIE5ldHdvcmsxIzAh -BgNVBAMTGkFkZFRydXN0IFF1YWxpZmllZCBDQSBSb290MIIBIjANBgkqhkiG9w0B -AQEFAAOCAQ8AMIIBCgKCAQEA5B6a/twJWoekn0e+EV+vhDTbYjx5eLfpMLXsDBwq -xBb/4Oxx64r1EW7tTw2R0hIYLUkVAcKkIhPHEWT/IhKauY5cLwjPcWqzZwFZ8V1G -87B4pfYOQnrjfxvM0PC3KP0q6p6zsLkEqv32x7SxuCqg+1jxGaBvcCV+PmlKfw8i -2O+tCBGaKZnhqkRFmhJePp1tUvznoD1oL/BLcHwTOK28FSXx1s6rosAx1i+f4P8U -WfyEk9mHfExUE+uf0S0R+Bg6Ot4l2ffTQO2kBhLEO+GRwVY18BTcZTYJbqukB8c1 -0cIDMzZbdSZtQvESa0NvS3GU+jQd7RNuyoB/mC9suWXY6QIDAQABo4HUMIHRMB0G -A1UdDgQWBBQ5lYtii1zJ1IC6WA+XPxUIQ8yYpzALBgNVHQ8EBAMCAQYwDwYDVR0T -AQH/BAUwAwEB/zCBkQYDVR0jBIGJMIGGgBQ5lYtii1zJ1IC6WA+XPxUIQ8yYp6Fr -pGkwZzELMAkGA1UEBhMCU0UxFDASBgNVBAoTC0FkZFRydXN0IEFCMR0wGwYDVQQL -ExRBZGRUcnVzdCBUVFAgTmV0d29yazEjMCEGA1UEAxMaQWRkVHJ1c3QgUXVhbGlm -aWVkIENBIFJvb3SCAQEwDQYJKoZIhvcNAQEFBQADggEBABmrder4i2VhlRO6aQTv -hsoToMeqT2QbPxj2qC0sVY8FtzDqQmodwCVRLae/DLPt7wh/bDxGGuoYQ992zPlm -hpwsaPXpF/gxsxjE1kh9I0xowX67ARRvxdlu3rsEQmr49lx95dr6h+sNNVJn0J6X -dgWTP5XHAeZpVTh/EGGZyeNfpso+gmNIquIISD6q8rKFYqa0p9m9N5xotS1WfbC3 -P6CxB9bpT9zeRXEwMn8bLgn5v1Kh7sKAPgZcLlVAwRv1cEWw3F369nJad9Jjzc9Y -iQBCYz95OdBEsIJuQRno3eDBiFrRHnGTHyQwdOUeqN48Jzd/g66ed8/wMLH/S5no -xqE= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDTDCCAjSgAwIBAgIId3cGJyapsXwwDQYJKoZIhvcNAQELBQAwRDELMAkGA1UE -BhMCVVMxFDASBgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVz -dCBDb21tZXJjaWFsMB4XDTEwMDEyOTE0MDYwNloXDTMwMTIzMTE0MDYwNlowRDEL -MAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZp -cm1UcnVzdCBDb21tZXJjaWFsMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKC -AQEA9htPZwcroRX1BiLLHwGy43NFBkRJLLtJJRTWzsO3qyxPxkEylFf6EqdbDuKP -Hx6GGaeqtS25Xw2Kwq+FNXkyLbscYjfysVtKPcrNcV/pQr6U6Mje+SJIZMblq8Yr -ba0F8PrVC8+a5fBQpIs7R6UjW3p6+DM/uO+Zl+MgwdYoic+U+7lF7eNAFxHUdPAL -MeIrJmqbTFeurCA+ukV6BfO9m2kVrn1OIGPENXY6BwLJN/3HR+7o8XYdcxXyl6S1 -yHp52UKqK39c/s4mT6NmgTWvRLpUHhwwMmWd5jyTXlBOeuM61G7MGvv50jeuJCqr -VwMiKA1JdX+3KNp1v47j3A55MQIDAQABo0IwQDAdBgNVHQ4EFgQUnZPGU4teyq8/ -nx4P5ZmVvCT2lI8wDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwDQYJ -KoZIhvcNAQELBQADggEBAFis9AQOzcAN/wr91LoWXym9e2iZWEnStB03TX8nfUYG -XUPGhi4+c7ImfU+TqbbEKpqrIZcUsd6M06uJFdhrJNTxFq7YpFzUf1GO7RgBsZNj -vbz4YYCanrHOQnDiqX0GJX0nof5v7LMeJNrjS1UaADs1tDvZ110w/YETifLCBivt -Z8SOyUOyXGsViQK8YvxO8rUzqrJv0wqiUOP2O+guRMLbZjipM1ZI8W0bM40NjD9g -N53Tym1+NH4Nn3J2ixufcv1SNUFFApYvHLKac0khsUlHRUe072o0EclNmsxZt9YC -nlpOZbWUrhvfKbAW8b8Angc6F2S1BLUjIZkKlTuXfO8= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDTDCCAjSgAwIBAgIIfE8EORzUmS0wDQYJKoZIhvcNAQEFBQAwRDELMAkGA1UE -BhMCVVMxFDASBgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVz -dCBOZXR3b3JraW5nMB4XDTEwMDEyOTE0MDgyNFoXDTMwMTIzMTE0MDgyNFowRDEL -MAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZp -cm1UcnVzdCBOZXR3b3JraW5nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKC -AQEAtITMMxcua5Rsa2FSoOujz3mUTOWUgJnLVWREZY9nZOIG41w3SfYvm4SEHi3y -YJ0wTsyEheIszx6e/jarM3c1RNg1lho9Nuh6DtjVR6FqaYvZ/Ls6rnla1fTWcbua -kCNrmreIdIcMHl+5ni36q1Mr3Lt2PpNMCAiMHqIjHNRqrSK6mQEubWXLviRmVSRL -QESxG9fhwoXA3hA/Pe24/PHxI1Pcv2WXb9n5QHGNfb2V1M6+oF4nI979ptAmDgAp -6zxG8D1gvz9Q0twmQVGeFDdCBKNwV6gbh+0t+nvujArjqWaJGctB+d1ENmHP4ndG -yH329JKBNv3bNPFyfvMMFr20FQIDAQABo0IwQDAdBgNVHQ4EFgQUBx/S55zawm6i -QLSwelAQUHTEyL0wDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwDQYJ -KoZIhvcNAQEFBQADggEBAIlXshZ6qML91tmbmzTCnLQyFE2npN/svqe++EPbkTfO -tDIuUFUaNU52Q3Eg75N3ThVwLofDwR1t3Mu1J9QsVtFSUzpE0nPIxBsFZVpikpzu -QY0x2+c06lkh1QF612S4ZDnNye2v7UsDSKegmQGA3GWjNq5lWUhPgkvIZfFXHeVZ -Lgo/bNjR9eUJtGxUAArgFU2HdW23WJZa3W3SAKD0m0i+wzekujbgfIeFlxoVot4u -olu9rxj5kFDNcFn4J2dHy8egBzp90SxdbBk6ZrV9/ZFvgrG+CJPbFEfxojfHRZ48 -x3evZKiT3/Zpg4Jg8klCNO1aAFSFHBY2kgxc+qatv9s= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIFRjCCAy6gAwIBAgIIbYwURrGmCu4wDQYJKoZIhvcNAQEMBQAwQTELMAkGA1UE -BhMCVVMxFDASBgNVBAoMC0FmZmlybVRydXN0MRwwGgYDVQQDDBNBZmZpcm1UcnVz -dCBQcmVtaXVtMB4XDTEwMDEyOTE0MTAzNloXDTQwMTIzMTE0MTAzNlowQTELMAkG -A1UEBhMCVVMxFDASBgNVBAoMC0FmZmlybVRydXN0MRwwGgYDVQQDDBNBZmZpcm1U -cnVzdCBQcmVtaXVtMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAxBLf -qV/+Qd3d9Z+K4/as4Tx4mrzY8H96oDMq3I0gW64tb+eT2TZwamjPjlGjhVtnBKAQ -JG9dKILBl1fYSCkTtuG+kU3fhQxTGJoeJKJPj/CihQvL9Cl/0qRY7iZNyaqoe5rZ -+jjeRFcV5fiMyNlI4g0WJx0eyIOFJbe6qlVBzAMiSy2RjYvmia9mx+n/K+k8rNrS -s8PhaJyJ+HoAVt70VZVs+7pk3WKL3wt3MutizCaam7uqYoNMtAZ6MMgpv+0GTZe5 -HMQxK9VfvFMSF5yZVylmd2EhMQcuJUmdGPLu8ytxjLW6OQdJd/zvLpKQBY0tL3d7 -70O/Nbua2Plzpyzy0FfuKE4mX4+QaAkvuPjcBukumj5Rp9EixAqnOEhss/n/fauG -V+O61oV4d7pD6kh/9ti+I20ev9E2bFhc8e6kGVQa9QPSdubhjL08s9NIS+LI+H+S -qHZGnEJlPqQewQcDWkYtuJfzt9WyVSHvutxMAJf7FJUnM7/oQ0dG0giZFmA7mn7S -5u046uwBHjxIVkkJx0w3AJ6IDsBz4W9m6XJHMD4Q5QsDyZpCAGzFlH5hxIrff4Ia -C1nEWTJ3s7xgaVY5/bQGeyzWZDbZvUjthB9+pSKPKrhC9IK31FOQeE4tGv2Bb0TX -OwF0lkLgAOIua+rF7nKsu7/+6qqo+Nz2snmKtmcCAwEAAaNCMEAwHQYDVR0OBBYE -FJ3AZ6YMItkm9UWrpmVSESfYRaxjMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/ -BAQDAgEGMA0GCSqGSIb3DQEBDAUAA4ICAQCzV00QYk465KzquByvMiPIs0laUZx2 -KI15qldGF9X1Uva3ROgIRL8YhNILgM3FEv0AVQVhh0HctSSePMTYyPtwni94loMg -Nt58D2kTiKV1NpgIpsbfrM7jWNa3Pt668+s0QNiigfV4Py/VpfzZotReBA4Xrf5B -8OWycvpEgjNC6C1Y91aMYj+6QrCcDFx+LmUmXFNPALJ4fqENmS2NuB2OosSw/WDQ -MKSOyARiqcTtNd56l+0OOF6SL5Nwpamcb6d9Ex1+xghIsV5n61EIJenmJWtSKZGc -0jlzCFfemQa0W50QBuHCAKi4HEoCChTQwUHK+4w1IX2COPKpVJEZNZOUbWo6xbLQ -u4mGk+ibyQ86p3q4ofB4Rvr8Ny/lioTz3/4E2aFooC8k4gmVBtWVyuEklut89pMF -u+1z6S3RdTnX5yTb2E5fQ4+e0BQ5v1VwSJlXMbSc7kqYA5YwH2AG7hsj/oFgIxpH -YoWlzBk0gG+zrBrjn/B7SK3VAdlntqlyk+otZrWyuOQ9PLLvTIzq6we/qzWaVYa8 -GKa1qF60g2xraUDTn9zxw2lrueFtCfTxqlB2Cnp9ehehVZZCmTEJ3WARjQUwfuaO -RtGdFNrHF+QFlozEJLUbzxQHskD4o55BhrwE0GuWyCqANP2/7waj3VjFhT0+j/6e -KeC2uAloGRwYQw== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIB/jCCAYWgAwIBAgIIdJclisc/elQwCgYIKoZIzj0EAwMwRTELMAkGA1UEBhMC -VVMxFDASBgNVBAoMC0FmZmlybVRydXN0MSAwHgYDVQQDDBdBZmZpcm1UcnVzdCBQ -cmVtaXVtIEVDQzAeFw0xMDAxMjkxNDIwMjRaFw00MDEyMzExNDIwMjRaMEUxCzAJ -BgNVBAYTAlVTMRQwEgYDVQQKDAtBZmZpcm1UcnVzdDEgMB4GA1UEAwwXQWZmaXJt -VHJ1c3QgUHJlbWl1bSBFQ0MwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQNMF4bFZ0D -0KF5Nbc6PJJ6yhUczWLznCZcBz3lVPqj1swS6vQUX+iOGasvLkjmrBhDeKzQN8O9 -ss0s5kfiGuZjuD0uL3jET9v0D6RoTFVya5UdThhClXjMNzyR4ptlKymjQjBAMB0G -A1UdDgQWBBSaryl6wBE1NSZRMADDav5A1a7WPDAPBgNVHRMBAf8EBTADAQH/MA4G -A1UdDwEB/wQEAwIBBjAKBggqhkjOPQQDAwNnADBkAjAXCfOHiFBar8jAQr9HX/Vs -aobgxCd05DhT1wV/GzTjxi+zygk8N53X57hG8f2h4nECMEJZh0PUUd+60wkyWs6I -flc9nF9Ca/UHLbXwgpP5WW+uZPpY5Yse42O+tYHNbwKMeQ== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDoDCCAoigAwIBAgIBMTANBgkqhkiG9w0BAQUFADBDMQswCQYDVQQGEwJKUDEc -MBoGA1UEChMTSmFwYW5lc2UgR292ZXJubWVudDEWMBQGA1UECxMNQXBwbGljYXRp -b25DQTAeFw0wNzEyMTIxNTAwMDBaFw0xNzEyMTIxNTAwMDBaMEMxCzAJBgNVBAYT -AkpQMRwwGgYDVQQKExNKYXBhbmVzZSBHb3Zlcm5tZW50MRYwFAYDVQQLEw1BcHBs -aWNhdGlvbkNBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAp23gdE6H -j6UG3mii24aZS2QNcfAKBZuOquHMLtJqO8F6tJdhjYq+xpqcBrSGUeQ3DnR4fl+K -f5Sk10cI/VBaVuRorChzoHvpfxiSQE8tnfWuREhzNgaeZCw7NCPbXCbkcXmP1G55 -IrmTwcrNwVbtiGrXoDkhBFcsovW8R0FPXjQilbUfKW1eSvNNcr5BViCH/OlQR9cw -FO5cjFW6WY2H/CPek9AEjP3vbb3QesmlOmpyM8ZKDQUXKi17safY1vC+9D/qDiht -QWEjdnjDuGWk81quzMKq2edY3rZ+nYVunyoKb58DKTCXKB28t89UKU5RMfkntigm -/qJj5kEW8DOYRwIDAQABo4GeMIGbMB0GA1UdDgQWBBRUWssmP3HMlEYNllPqa0jQ -k/5CdTAOBgNVHQ8BAf8EBAMCAQYwWQYDVR0RBFIwUKROMEwxCzAJBgNVBAYTAkpQ -MRgwFgYDVQQKDA/ml6XmnKzlm73mlL/lupwxIzAhBgNVBAsMGuOCouODl+ODquOC -seODvOOCt+ODp+ODs0NBMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEFBQAD -ggEBADlqRHZ3ODrso2dGD/mLBqj7apAxzn7s2tGJfHrrLgy9mTLnsCTWw//1sogJ -hyzjVOGjprIIC8CFqMjSnHH2HZ9g/DgzE+Ge3Atf2hZQKXsvcJEPmbo0NI2VdMV+ -eKlmXb3KIXdCEKxmJj3ekav9FfBv7WxfEPjzFvYDio+nEhEMy/0/ecGc/WLuo89U -DNErXxc+4z6/wCs+CZv+iKZ+tJIX/COUgb1up8WMwusRRdv4QcmWdupwX3kSa+Sj -B1oF7ydJzyGfikwJcGapJsErEU4z0g781mzSDjJkaP+tBXhfAx2o45CsJOAPQKdL -rosot4LKGAfmt1t06SAZf7IbiVQ= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDdzCCAl+gAwIBAgIIXDPLYixfszIwDQYJKoZIhvcNAQELBQAwPDEeMBwGA1UE -AwwVQXRvcyBUcnVzdGVkUm9vdCAyMDExMQ0wCwYDVQQKDARBdG9zMQswCQYDVQQG -EwJERTAeFw0xMTA3MDcxNDU4MzBaFw0zMDEyMzEyMzU5NTlaMDwxHjAcBgNVBAMM -FUF0b3MgVHJ1c3RlZFJvb3QgMjAxMTENMAsGA1UECgwEQXRvczELMAkGA1UEBhMC -REUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCVhTuXbyo7LjvPpvMp -Nb7PGKw+qtn4TaA+Gke5vJrf8v7MPkfoepbCJI419KkM/IL9bcFyYie96mvr54rM -VD6QUM+A1JX76LWC1BTFtqlVJVfbsVD2sGBkWXppzwO3bw2+yj5vdHLqqjAqc2K+ -SZFhyBH+DgMq92og3AIVDV4VavzjgsG1xZ1kCWyjWZgHJ8cblithdHFsQ/H3NYkQ -4J7sVaE3IqKHBAUsR320HLliKWYoyrfhk/WklAOZuXCFteZI6o1Q/NnezG8HDt0L -cp2AMBYHlT8oDv3FdU9T1nSatCQujgKRz3bFmx5VdJx4IbHwLfELn8LVlhgf8FQi -eowHAgMBAAGjfTB7MB0GA1UdDgQWBBSnpQaxLKYJYO7Rl+lwrrw7GWzbITAPBgNV -HRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFKelBrEspglg7tGX6XCuvDsZbNshMBgG -A1UdIAQRMA8wDQYLKwYBBAGwLQMEAQEwDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3 -DQEBCwUAA4IBAQAmdzTblEiGKkGdLD4GkGDEjKwLVLgfuXvTBznk+j57sj1O7Z8j -vZfza1zv7v1Apt+hk6EKhqzvINB5Ab149xnYJDE0BAGmuhWawyfc2E8PzBhj/5kP -DpFrdRbhIfzYJsdHt6bPWHJxfrrhTZVHO8mvbaG0weyJ9rQPOLXiZNwlz6bb65pc -maHFCN795trV1lpFDMS3wrUU77QR/w4VtfX128a961qn8FYiqTxlVMYVqL2Gns2D -lmh6cYGJ4Qvh6hEbaAjMaZ7snkGeRDImeuKHCnE96+RapNLbxc3G3mB/ufNPRJLv -KrcYPqcZ2Qt9sTdBQrC6YB3y/gkRsPCHe6ed ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIGFDCCA/ygAwIBAgIIU+w77vuySF8wDQYJKoZIhvcNAQEFBQAwUTELMAkGA1UE -BhMCRVMxQjBABgNVBAMMOUF1dG9yaWRhZCBkZSBDZXJ0aWZpY2FjaW9uIEZpcm1h -cHJvZmVzaW9uYWwgQ0lGIEE2MjYzNDA2ODAeFw0wOTA1MjAwODM4MTVaFw0zMDEy -MzEwODM4MTVaMFExCzAJBgNVBAYTAkVTMUIwQAYDVQQDDDlBdXRvcmlkYWQgZGUg -Q2VydGlmaWNhY2lvbiBGaXJtYXByb2Zlc2lvbmFsIENJRiBBNjI2MzQwNjgwggIi -MA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDKlmuO6vj78aI14H9M2uDDUtd9 -thDIAl6zQyrET2qyyhxdKJp4ERppWVevtSBC5IsP5t9bpgOSL/UR5GLXMnE42QQM -cas9UX4PB99jBVzpv5RvwSmCwLTaUbDBPLutN0pcyvFLNg4kq7/DhHf9qFD0sefG -L9ItWY16Ck6WaVICqjaY7Pz6FIMMNx/Jkjd/14Et5cS54D40/mf0PmbR0/RAz15i -NA9wBj4gGFrO93IbJWyTdBSTo3OxDqqHECNZXyAFGUftaI6SEspd/NYrspI8IM/h -X68gvqB2f3bl7BqGYTM+53u0P6APjqK5am+5hyZvQWyIplD9amML9ZMWGxmPsu2b -m8mQ9QEM3xk9Dz44I8kvjwzRAv4bVdZO0I08r0+k8/6vKtMFnXkIoctXMbScyJCy -Z/QYFpM6/EfY0XiWMR+6KwxfXZmtY4laJCB22N/9q06mIqqdXuYnin1oKaPnirja -EbsXLZmdEyRG98Xi2J+Of8ePdG1asuhy9azuJBCtLxTa/y2aRnFHvkLfuwHb9H/T -KI8xWVvTyQKmtFLKbpf7Q8UIJm+K9Lv9nyiqDdVF8xM6HdjAeI9BZzwelGSuewvF -6NkBiDkal4ZkQdU7hwxu+g/GvUgUvzlN1J5Bto+WHWOWk9mVBngxaJ43BjuAiUVh -OSPHG0SjFeUc+JIwuwIDAQABo4HvMIHsMBIGA1UdEwEB/wQIMAYBAf8CAQEwDgYD -VR0PAQH/BAQDAgEGMB0GA1UdDgQWBBRlzeurNR4APn7VdMActHNHDhpkLzCBpgYD -VR0gBIGeMIGbMIGYBgRVHSAAMIGPMC8GCCsGAQUFBwIBFiNodHRwOi8vd3d3LmZp -cm1hcHJvZmVzaW9uYWwuY29tL2NwczBcBggrBgEFBQcCAjBQHk4AUABhAHMAZQBv -ACAAZABlACAAbABhACAAQgBvAG4AYQBuAG8AdgBhACAANAA3ACAAQgBhAHIAYwBl -AGwAbwBuAGEAIAAwADgAMAAxADcwDQYJKoZIhvcNAQEFBQADggIBABd9oPm03cXF -661LJLWhAqvdpYhKsg9VSytXjDvlMd3+xDLx51tkljYyGOylMnfX40S2wBEqgLk9 -am58m9Ot/MPWo+ZkKXzR4Tgegiv/J2Wv+xYVxC5xhOW1//qkR71kMrv2JYSiJ0L1 -ILDCExARzRAVukKQKtJE4ZYm6zFIEv0q2skGz3QeqUvVhyj5eTSSPi5E6PaPT481 -PyWzOdxjKpBrIF/EUhJOlywqrJ2X3kjyo2bbwtKDlaZmp54lD+kLM5FlClrD2VQS -3a/DTg4fJl4N3LON7NWBcN7STyQF82xO9UxJZo3R/9ILJUFI/lGExkKvgATP0H5k -SeTy36LssUzAKh3ntLFlosS88Zj0qnAHY7S42jtM+kAiMFsRpvAFDsYCA0irhpuF -3dvd6qJ2gHN99ZwExEWN57kci57q13XRcrHedUTnQn3iV2t93Jm8PYMo6oCTjcVM -ZcFwgbg4/EMxsvYDNEeyrPsiBsse3RdHHF9mudMaotoRsaS8I8nkvof/uZS2+F0g -StRf571oe2XyFR7SOqkt6dhrJKyXWERHrVkY8SFlcN7ONGCoQPHzPKTDKCOM/icz -Q0CgFzzr6juwcqajuUpLXhZI9LK8yIySxZ2frHI2vDSANGupi5LAuBft7HZT9SQB -jLMi6Et8Vcad+qMUu2WFbm5PEn4KPJ2V ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDdzCCAl+gAwIBAgIEAgAAuTANBgkqhkiG9w0BAQUFADBaMQswCQYDVQQGEwJJ -RTESMBAGA1UEChMJQmFsdGltb3JlMRMwEQYDVQQLEwpDeWJlclRydXN0MSIwIAYD -VQQDExlCYWx0aW1vcmUgQ3liZXJUcnVzdCBSb290MB4XDTAwMDUxMjE4NDYwMFoX -DTI1MDUxMjIzNTkwMFowWjELMAkGA1UEBhMCSUUxEjAQBgNVBAoTCUJhbHRpbW9y -ZTETMBEGA1UECxMKQ3liZXJUcnVzdDEiMCAGA1UEAxMZQmFsdGltb3JlIEN5YmVy -VHJ1c3QgUm9vdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKMEuyKr -mD1X6CZymrV51Cni4eiVgLGw41uOKymaZN+hXe2wCQVt2yguzmKiYv60iNoS6zjr -IZ3AQSsBUnuId9Mcj8e6uYi1agnnc+gRQKfRzMpijS3ljwumUNKoUMMo6vWrJYeK -mpYcqWe4PwzV9/lSEy/CG9VwcPCPwBLKBsua4dnKM3p31vjsufFoREJIE9LAwqSu -XmD+tqYF/LTdB1kC1FkYmGP1pWPgkAx9XbIGevOF6uvUA65ehD5f/xXtabz5OTZy -dc93Uk3zyZAsuT3lySNTPx8kmCFcB5kpvcY67Oduhjprl3RjM71oGDHweI12v/ye -jl0qhqdNkNwnGjkCAwEAAaNFMEMwHQYDVR0OBBYEFOWdWTCCR1jMrPoIVDaGezq1 -BE3wMBIGA1UdEwEB/wQIMAYBAf8CAQMwDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3 -DQEBBQUAA4IBAQCFDF2O5G9RaEIFoN27TyclhAO992T9Ldcw46QQF+vaKSm2eT92 -9hkTI7gQCvlYpNRhcL0EYWoSihfVCr3FvDB81ukMJY2GQE/szKN+OMY3EU/t3Wgx -jkzSswF07r51XgdIGn9w/xZchMB5hbgF/X++ZRGjD8ACtPhSNzkE1akxehi/oCr0 -Epn3o0WC4zxe9Z2etciefC7IpJ5OCBRLbf1wbWsaY71k5h+3zvDyny67G7fyUIhz -ksLi4xaNmjICq44Y3ekQEe5+NauQrz4wlHrQMz2nZQ/1/I6eYs9HRCwBXbsdtTLS -R9I4LtD+gdwyah617jzV/OeBHRnDJELqYzmp ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDUzCCAjugAwIBAgIBATANBgkqhkiG9w0BAQUFADBLMQswCQYDVQQGEwJOTzEd -MBsGA1UECgwUQnV5cGFzcyBBUy05ODMxNjMzMjcxHTAbBgNVBAMMFEJ1eXBhc3Mg -Q2xhc3MgMiBDQSAxMB4XDTA2MTAxMzEwMjUwOVoXDTE2MTAxMzEwMjUwOVowSzEL -MAkGA1UEBhMCTk8xHTAbBgNVBAoMFEJ1eXBhc3MgQVMtOTgzMTYzMzI3MR0wGwYD -VQQDDBRCdXlwYXNzIENsYXNzIDIgQ0EgMTCCASIwDQYJKoZIhvcNAQEBBQADggEP -ADCCAQoCggEBAIs8B0XY9t/mx8q6jUPFR42wWsE425KEHK8T1A9vNkYgxC7McXA0 -ojTTNy7Y3Tp3L8DrKehc0rWpkTSHIln+zNvnma+WwajHQN2lFYxuyHyXA8vmIPLX -l18xoS830r7uvqmtqEyeIWZDO6i88wmjONVZJMHCR3axiFyCO7srpgTXjAePzdVB -HfCuuCkslFJgNJQ72uA40Z0zPhX0kzLFANq1KWYOOngPIVJfAuWSeyXTkh4vFZ2B -5J2O6O+JzhRMVB0cgRJNcKi+EAUXfh/RuFdV7c27UsKwHnjCTTZoy1YmwVLBvXb3 -WNVyfh9EdrsAiR0WnVE1703CVu9r4Iw7DekCAwEAAaNCMEAwDwYDVR0TAQH/BAUw -AwEB/zAdBgNVHQ4EFgQUP42aWYv8e3uco684sDntkHGA1sgwDgYDVR0PAQH/BAQD -AgEGMA0GCSqGSIb3DQEBBQUAA4IBAQAVGn4TirnoB6NLJzKyQJHyIdFkhb5jatLP -gcIV1Xp+DCmsNx4cfHZSldq1fyOhKXdlyTKdqC5Wq2B2zha0jX94wNWZUYN/Xtm+ -DKhQ7SLHrQVMdvvt7h5HZPb3J31cKA9FxVxiXqaakZG3Uxcu3K1gnZZkOb1naLKu -BctN518fV4bVIJwo+28TOPX2EZL2fZleHwzoq0QkKXJAPTZSr4xYkHPB7GEseaHs -h7U/2k3ZIQAw3pDaDtMaSKk+hQsUi4y8QZ5q9w5wwDX3OaJdZtB7WZ+oRxKaJyOk -LY4ng5IgodcVf/EuGO70SH8vf/GhGLWhC5SgYiAynB321O+/TIho ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIFWTCCA0GgAwIBAgIBAjANBgkqhkiG9w0BAQsFADBOMQswCQYDVQQGEwJOTzEd -MBsGA1UECgwUQnV5cGFzcyBBUy05ODMxNjMzMjcxIDAeBgNVBAMMF0J1eXBhc3Mg -Q2xhc3MgMiBSb290IENBMB4XDTEwMTAyNjA4MzgwM1oXDTQwMTAyNjA4MzgwM1ow -TjELMAkGA1UEBhMCTk8xHTAbBgNVBAoMFEJ1eXBhc3MgQVMtOTgzMTYzMzI3MSAw -HgYDVQQDDBdCdXlwYXNzIENsYXNzIDIgUm9vdCBDQTCCAiIwDQYJKoZIhvcNAQEB -BQADggIPADCCAgoCggIBANfHXvfBB9R3+0Mh9PT1aeTuMgHbo4Yf5FkNuud1g1Lr -6hxhFUi7HQfKjK6w3Jad6sNgkoaCKHOcVgb/S2TwDCo3SbXlzwx87vFKu3MwZfPV -L4O2fuPn9Z6rYPnT8Z2SdIrkHJasW4DptfQxh6NR/Md+oW+OU3fUl8FVM5I+GC91 -1K2GScuVr1QGbNgGE41b/+EmGVnAJLqBcXmQRFBoJJRfuLMR8SlBYaNByyM21cHx -MlAQTn/0hpPshNOOvEu/XAFOBz3cFIqUCqTqc/sLUegTBxj6DvEr0VQVfTzh97QZ -QmdiXnfgolXsttlpF9U6r0TtSsWe5HonfOV116rLJeffawrbD02TTqigzXsu8lkB -arcNuAeBfos4GzjmCleZPe4h6KP1DBbdi+w0jpwqHAAVF41og9JwnxgIzRFo1clr -Us3ERo/ctfPYV3Me6ZQ5BL/T3jjetFPsaRyifsSP5BtwrfKi+fv3FmRmaZ9JUaLi -FRhnBkp/1Wy1TbMz4GHrXb7pmA8y1x1LPC5aAVKRCfLf6o3YBkBjqhHk/sM3nhRS -P/TizPJhk9H9Z2vXUq6/aKtAQ6BXNVN48FP4YUIHZMbXb5tMOA1jrGKvNouicwoN -9SG9dKpN6nIDSdvHXx1iY8f93ZHsM+71bbRuMGjeyNYmsHVee7QHIJihdjK4TWxP -AgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFMmAd+BikoL1Rpzz -uvdMw964o605MA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsFAAOCAgEAU18h -9bqwOlI5LJKwbADJ784g7wbylp7ppHR/ehb8t/W2+xUbP6umwHJdELFx7rxP462s -A20ucS6vxOOto70MEae0/0qyexAQH6dXQbLArvQsWdZHEIjzIVEpMMpghq9Gqx3t -OluwlN5E40EIosHsHdb9T7bWR9AUC8rmyrV7d35BH16Dx7aMOZawP5aBQW9gkOLo -+fsicdl9sz1Gv7SEr5AcD48Saq/v7h56rgJKihcrdv6sVIkkLE8/trKnToyokZf7 -KcZ7XC25y2a2t6hbElGFtQl+Ynhw/qlqYLYdDnkM/crqJIByw5c/8nerQyIKx+u2 -DISCLIBrQYoIwOula9+ZEsuK1V6ADJHgJgg2SMX6OBE1/yWDLfJ6v9r9jv6ly0Us -H8SIU653DtmadsWOLB2jutXsMq7Aqqz30XpN69QH4kj3Io6wpJ9qzo6ysmD0oyLQ -I+uUWnpp3Q+/QFesa1lQ2aOZ4W7+jQF5JyMV3pKdewlNWudLSDBaGOYKbeaP4NK7 -5t98biGCwWg5TbSYWGZizEqQXsP6JwSxeRV0mcy+rSDeJmAc61ZRpqPq5KM/p/9h -3PFaTWwyI0PurKju7koSCTxdccK+efrCh2gdC/1cacwG0Jp9VJkqyTkaGa9LKkPz -Y11aWOIv4x3kqdbQCtCev9eBCfHJxyYNrJgWVqA= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIFWTCCA0GgAwIBAgIBAjANBgkqhkiG9w0BAQsFADBOMQswCQYDVQQGEwJOTzEd -MBsGA1UECgwUQnV5cGFzcyBBUy05ODMxNjMzMjcxIDAeBgNVBAMMF0J1eXBhc3Mg -Q2xhc3MgMyBSb290IENBMB4XDTEwMTAyNjA4Mjg1OFoXDTQwMTAyNjA4Mjg1OFow -TjELMAkGA1UEBhMCTk8xHTAbBgNVBAoMFEJ1eXBhc3MgQVMtOTgzMTYzMzI3MSAw -HgYDVQQDDBdCdXlwYXNzIENsYXNzIDMgUm9vdCBDQTCCAiIwDQYJKoZIhvcNAQEB -BQADggIPADCCAgoCggIBAKXaCpUWUOOV8l6ddjEGMnqb8RB2uACatVI2zSRHsJ8Y -ZLya9vrVediQYkwiL944PdbgqOkcLNt4EemOaFEVcsfzM4fkoF0LXOBXByow9c3E -N3coTRiR5r/VUv1xLXA+58bEiuPwKAv0dpihi4dVsjoT/Lc+JzeOIuOoTyrvYLs9 -tznDDgFHmV0ST9tD+leh7fmdvhFHJlsTmKtdFoqwNxxXnUX/iJY2v7vKB3tvh2PX -0DJq1l1sDPGzbjniazEuOQAnFN44wOwZZoYS6J1yFhNkUsepNxz9gjDthBgd9K5c -/3ATAOux9TN6S9ZV+AWNS2mw9bMoNlwUxFFzTWsL8TQH2xc519woe2v1n/MuwU8X -KhDzzMro6/1rqy6any2CbgTUUgGTLT2G/H783+9CHaZr77kgxve9oKeV/afmiSTY -zIw0bOIjL9kSGiG5VZFvC5F5GQytQIgLcOJ60g7YaEi7ghM5EFjp2CoHxhLbWNvS -O1UQRwUVZ2J+GGOmRj8JDlQyXr8NYnon74Do29lLBlo3WiXQCBJ31G8JUJc9yB3D -34xFMFbG02SrZvPAXpacw8Tvw3xrizp5f7NJzz3iiZ+gMEuFuZyUJHmPfWupRWgP -K9Dx2hzLabjKSWJtyNBjYt1gD1iqj6G8BaVmos8bdrKEZLFMOVLAMLrwjEsCsLa3 -AgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFEe4zf/lb+74suwv -Tg75JbCOPGvDMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsFAAOCAgEAACAj -QTUEkMJAYmDv4jVM1z+s4jSQuKFvdvoWFqRINyzpkMLyPPgKn9iB5btb2iUspKdV -cSQy9sgL8rxq+JOssgfCX5/bzMiKqr5qb+FJEMwx14C7u8jYog5kV+qi9cKpMRXS -IGrs/CIBKM+GuIAeqcwRpTzyFrNHnfzSgCHEy9BHcEGhyoMZCCxt8l13nIoUE9Q2 -HJLw5QY33KbmkJs4j1xrG0aGQ0JfPgEHU1RdZX33inOhmlRaHylDFCfChQ+1iHsa -O5S3HWCntZznKWlXWpuTekMwGwPXYshApqr8ZORK15FTAaggiG6cX0S5y2CBNOxv -033aSF/rtJC8LakcC6wc1aJoIIAE1vyxjy+7SjENSoYc6+I2KSb12tjE8nVhz36u -dmNKekBlk4f4HoCMhuWG1o8O/FMsYOgWYRqiPkN7zTlgVGr18okmAWiDSKIz6MkE -kbIRNBE+6tBDGR8Dk5AM/1E9V/RBbuHLoL7ryWPNbczk+DaqaJ3tvV2XcEQNtg41 -3OEMXbugUZTLfhbrES+jkkXITHHZvMmZUldGL1DPvTVp9D0VzgalLA8+9oG6lLvD -u79leNKGef9JOxqDDPDeeOzI8k1MGt6CKfjBWtrt7uYnXuhF0J0cUahoq0Tj0Itq -4/g7u9xN12TyUb7mqqta6THuBrxzvxNiCp/HuZc= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIEDzCCAvegAwIBAgIBATANBgkqhkiG9w0BAQUFADBKMQswCQYDVQQGEwJTSzET -MBEGA1UEBxMKQnJhdGlzbGF2YTETMBEGA1UEChMKRGlzaWcgYS5zLjERMA8GA1UE -AxMIQ0EgRGlzaWcwHhcNMDYwMzIyMDEzOTM0WhcNMTYwMzIyMDEzOTM0WjBKMQsw -CQYDVQQGEwJTSzETMBEGA1UEBxMKQnJhdGlzbGF2YTETMBEGA1UEChMKRGlzaWcg -YS5zLjERMA8GA1UEAxMIQ0EgRGlzaWcwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAw -ggEKAoIBAQCS9jHBfYj9mQGp2HvycXXxMcbzdWb6UShGhJd4NLxs/LxFWYgmGErE -Nx+hSkS943EE9UQX4j/8SFhvXJ56CbpRNyIjZkMhsDxkovhqFQ4/61HhVKndBpnX -mjxUizkDPw/Fzsbrg3ICqB9x8y34dQjbYkzo+s7552oftms1grrijxaSfQUMbEYD -XcDtab86wYqg6I7ZuUUohwjstMoVvoLdtUSLLa2GDGhibYVW8qwUYzrG0ZmsNHhW -S8+2rT+MitcE5eN4TPWGqvWP+j1scaMtymfraHtuM6kMgiioTGohQBUgDCZbg8Kp -FhXAJIJdKxatymP2dACw30PEEGBWZ2NFAgMBAAGjgf8wgfwwDwYDVR0TAQH/BAUw -AwEB/zAdBgNVHQ4EFgQUjbJJaJ1yCCW5wCf1UJNWSEZx+Y8wDgYDVR0PAQH/BAQD -AgEGMDYGA1UdEQQvMC2BE2Nhb3BlcmF0b3JAZGlzaWcuc2uGFmh0dHA6Ly93d3cu -ZGlzaWcuc2svY2EwZgYDVR0fBF8wXTAtoCugKYYnaHR0cDovL3d3dy5kaXNpZy5z -ay9jYS9jcmwvY2FfZGlzaWcuY3JsMCygKqAohiZodHRwOi8vY2EuZGlzaWcuc2sv -Y2EvY3JsL2NhX2Rpc2lnLmNybDAaBgNVHSAEEzARMA8GDSuBHpGT5goAAAABAQEw -DQYJKoZIhvcNAQEFBQADggEBAF00dGFMrzvY/59tWDYcPQuBDRIrRhCA/ec8J9B6 -yKm2fnQwM6M6int0wHl5QpNt/7EpFIKrIYwvF/k/Ji/1WcbvgAa3mkkp7M5+cTxq -EEHA9tOasnxakZzArFvITV734VP/Q3f8nktnbNfzg9Gg4H8l37iYC5oyOGwwoPP/ -CBUz91BKez6jPiCp3C9WgArtQVCwyfTssuMmRAAOb54GvCKWU3BlxFAKRmukLyeB -EicTXxChds6KezfqwzlhA5WYOudsiCUI/HloDYd9Yvi0X/vF2Ey9WLw/Q1vUHgFN -PGO+I++MzVpQuGhU+QqZMxEA4Z7CRneC9VkGjCFMhwnN5ag= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIFaTCCA1GgAwIBAgIJAMMDmu5QkG4oMA0GCSqGSIb3DQEBBQUAMFIxCzAJBgNV -BAYTAlNLMRMwEQYDVQQHEwpCcmF0aXNsYXZhMRMwEQYDVQQKEwpEaXNpZyBhLnMu -MRkwFwYDVQQDExBDQSBEaXNpZyBSb290IFIxMB4XDTEyMDcxOTA5MDY1NloXDTQy -MDcxOTA5MDY1NlowUjELMAkGA1UEBhMCU0sxEzARBgNVBAcTCkJyYXRpc2xhdmEx -EzARBgNVBAoTCkRpc2lnIGEucy4xGTAXBgNVBAMTEENBIERpc2lnIFJvb3QgUjEw -ggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCqw3j33Jijp1pedxiy3QRk -D2P9m5YJgNXoqqXinCaUOuiZc4yd39ffg/N4T0Dhf9Kn0uXKE5Pn7cZ3Xza1lK/o -OI7bm+V8u8yN63Vz4STN5qctGS7Y1oprFOsIYgrY3LMATcMjfF9DCCMyEtztDK3A -fQ+lekLZWnDZv6fXARz2m6uOt0qGeKAeVjGu74IKgEH3G8muqzIm1Cxr7X1r5OJe -IgpFy4QxTaz+29FHuvlglzmxZcfe+5nkCiKxLU3lSCZpq+Kq8/v8kiky6bM+TR8n -oc2OuRf7JT7JbvN32g0S9l3HuzYQ1VTW8+DiR0jm3hTaYVKvJrT1cU/J19IG32PK -/yHoWQbgCNWEFVP3Q+V8xaCJmGtzxmjOZd69fwX3se72V6FglcXM6pM6vpmumwKj -rckWtc7dXpl4fho5frLABaTAgqWjR56M6ly2vGfb5ipN0gTco65F97yLnByn1tUD -3AjLLhbKXEAz6GfDLuemROoRRRw1ZS0eRWEkG4IupZ0zXWX4Qfkuy5Q/H6MMMSRE -7cderVC6xkGbrPAXZcD4XW9boAo0PO7X6oifmPmvTiT6l7Jkdtqr9O3jw2Dv1fkC -yC2fg69naQanMVXVz0tv/wQFx1isXxYb5dKj6zHbHzMVTdDypVP1y+E9Tmgt2BLd -qvLmTZtJ5cUoobqwWsagtQIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1Ud -DwEB/wQEAwIBBjAdBgNVHQ4EFgQUiQq0OJMa5qvum5EY+fU8PjXQ04IwDQYJKoZI -hvcNAQEFBQADggIBADKL9p1Kyb4U5YysOMo6CdQbzoaz3evUuii+Eq5FLAR0rBNR -xVgYZk2C2tXck8An4b58n1KeElb21Zyp9HWc+jcSjxyT7Ff+Bw+r1RL3D65hXlaA -SfX8MPWbTx9BLxyE04nH4toCdu0Jz2zBuByDHBb6lM19oMgY0sidbvW9adRtPTXo -HqJPYNcHKfyyo6SdbhWSVhlMCrDpfNIZTUJG7L399ldb3Zh+pE3McgODWF3vkzpB -emOqfDqo9ayk0d2iLbYq/J8BjuIQscTK5GfbVSUZP/3oNn6z4eGBrxEWi1CXYBmC -AMBrTXO40RMHPuq2MU/wQppt4hF05ZSsjYSVPCGvxdpHyN85YmLLW1AL14FABZyb -7bq2ix4Eb5YgOe2kfSnbSM6C3NQCjR0EMVrHS/BsYVLXtFHCgWzN4funodKSds+x -DzdYpPJScWc/DIh4gInByLUfkmO+p3qKViwaqKactV2zY9ATIKHrkWzQjX2v3wvk -F7mGnjixlAxYjOBVqjtjbZqJYLhkKpLGN/R+Q0O3c+gB53+XD9fyexn9GtePyfqF -a3qdnom2piiZk4hA9z7NUaPK6u95RyG1/jLix8NRb76AdPCkwzryT+lf3xkK8jsT -Q6wxpLPn6/wY1gGp8yqPNg7rtLG8t0zJa7+h89n07eLw4+1knj0vllJPgFOL ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIFaTCCA1GgAwIBAgIJAJK4iNuwisFjMA0GCSqGSIb3DQEBCwUAMFIxCzAJBgNV -BAYTAlNLMRMwEQYDVQQHEwpCcmF0aXNsYXZhMRMwEQYDVQQKEwpEaXNpZyBhLnMu -MRkwFwYDVQQDExBDQSBEaXNpZyBSb290IFIyMB4XDTEyMDcxOTA5MTUzMFoXDTQy -MDcxOTA5MTUzMFowUjELMAkGA1UEBhMCU0sxEzARBgNVBAcTCkJyYXRpc2xhdmEx -EzARBgNVBAoTCkRpc2lnIGEucy4xGTAXBgNVBAMTEENBIERpc2lnIFJvb3QgUjIw -ggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCio8QACdaFXS1tFPbCw3Oe -NcJxVX6B+6tGUODBfEl45qt5WDza/3wcn9iXAng+a0EE6UG9vgMsRfYvZNSrXaNH -PWSb6WiaxswbP7q+sos0Ai6YVRn8jG+qX9pMzk0DIaPY0jSTVpbLTAwAFjxfGs3I -x2ymrdMxp7zo5eFm1tL7A7RBZckQrg4FY8aAamkw/dLukO8NJ9+flXP04SXabBbe -QTg06ov80egEFGEtQX6sx3dOy1FU+16SGBsEWmjGycT6txOgmLcRK7fWV8x8nhfR -yyX+hk4kLlYMeE2eARKmK6cBZW58Yh2EhN/qwGu1pSqVg8NTEQxzHQuyRpDRQjrO -QG6Vrf/GlK1ul4SOfW+eioANSW1z4nuSHsPzwfPrLgVv2RvPN3YEyLRa5Beny912 -H9AZdugsBbPWnDTYltxhh5EF5EQIM8HauQhl1K6yNg3ruji6DOWbnuuNZt2Zz9aJ -QfYEkoopKW1rOhzndX0CcQ7zwOe9yxndnWCywmZgtrEE7snmhrmaZkCo5xHtgUUD -i/ZnWejBBhG93c+AAk9lQHhcR1DIm+YfgXvkRKhbhZri3lrVx/k6RGZL5DJUfORs -nLMOPReisjQS1n6yqEm70XooQL6iFh/f5DcfEXP7kAplQ6INfPgGAVUzfbANuPT1 -rqVCV3w2EYx7XsQDnYx5nQIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1Ud -DwEB/wQEAwIBBjAdBgNVHQ4EFgQUtZn4r7CU9eMg1gqtzk5WpC5uQu0wDQYJKoZI -hvcNAQELBQADggIBACYGXnDnZTPIgm7ZnBc6G3pmsgH2eDtpXi/q/075KMOYKmFM -tCQSin1tERT3nLXK5ryeJ45MGcipvXrA1zYObYVybqjGom32+nNjf7xueQgcnYqf -GopTpti72TVVsRHFqQOzVju5hJMiXn7B9hJSi+osZ7z+Nkz1uM/Rs0mSO9MpDpkb -lvdhuDvEK7Z4bLQjb/D907JedR+Zlais9trhxTF7+9FGs9K8Z7RiVLoJ92Owk6Ka -+elSLotgEqv89WBW7xBci8QaQtyDW2QOy7W81k/BfDxujRNt+3vrMNDcTa/F1bal -TFtxyegxvug4BkihGuLq0t4SOVga/4AOgnXmt8kHbA7v/zjxmHHEt38OFdAlab0i -nSvtBfZGR6ztwPDUO+Ls7pZbkBNOHlY667DvlruWIxG68kOGdGSVyCh13x01utI3 -gzhTODY7z2zp+WsO0PsE6E9312UBeIYMej4hYvF/Y3EMyZ9E26gnonW+boE+18Dr -G5gPcFw0sorMwIUY6256s/daoQe/qUKS82Ail+QUoQebTnbAjn39pCXHR+3/H3Os -zMOl6W8KjptlwlCFtaOgUxLMVYdh84GuEEZhvUQhuMI9dM9+JDX6HAcOmz0iyu8x -L4ysEr3vQCj8KWefshNPZiTEUxnpHikV7+ZtsH8tZ/3zbBt1RqPlShfppNcL ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIFjTCCA3WgAwIBAgIEGErM1jANBgkqhkiG9w0BAQsFADBWMQswCQYDVQQGEwJD -TjEwMC4GA1UECgwnQ2hpbmEgRmluYW5jaWFsIENlcnRpZmljYXRpb24gQXV0aG9y -aXR5MRUwEwYDVQQDDAxDRkNBIEVWIFJPT1QwHhcNMTIwODA4MDMwNzAxWhcNMjkx -MjMxMDMwNzAxWjBWMQswCQYDVQQGEwJDTjEwMC4GA1UECgwnQ2hpbmEgRmluYW5j -aWFsIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MRUwEwYDVQQDDAxDRkNBIEVWIFJP -T1QwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDXXWvNED8fBVnVBU03 -sQ7smCuOFR36k0sXgiFxEFLXUWRwFsJVaU2OFW2fvwwbwuCjZ9YMrM8irq93VCpL -TIpTUnrD7i7es3ElweldPe6hL6P3KjzJIx1qqx2hp/Hz7KDVRM8Vz3IvHWOX6Jn5 -/ZOkVIBMUtRSqy5J35DNuF++P96hyk0g1CXohClTt7GIH//62pCfCqktQT+x8Rgp -7hZZLDRJGqgG16iI0gNyejLi6mhNbiyWZXvKWfry4t3uMCz7zEasxGPrb382KzRz -EpR/38wmnvFyXVBlWY9ps4deMm/DGIq1lY+wejfeWkU7xzbh72fROdOXW3NiGUgt -hxwG+3SYIElz8AXSG7Ggo7cbcNOIabla1jj0Ytwli3i/+Oh+uFzJlU9fpy25IGvP -a931DfSCt/SyZi4QKPaXWnuWFo8BGS1sbn85WAZkgwGDg8NNkt0yxoekN+kWzqot -aK8KgWU6cMGbrU1tVMoqLUuFG7OA5nBFDWteNfB/O7ic5ARwiRIlk9oKmSJgamNg -TnYGmE69g60dWIolhdLHZR4tjsbftsbhf4oEIRUpdPA+nJCdDC7xij5aqgwJHsfV -PKPtl8MeNPo4+QgO48BdK4PRVmrJtqhUUy54Mmc9gn900PvhtgVguXDbjgv5E1hv -cWAQUhC5wUEJ73IfZzF4/5YFjQIDAQABo2MwYTAfBgNVHSMEGDAWgBTj/i39KNAL -tbq2osS/BqoFjJP7LzAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAd -BgNVHQ4EFgQU4/4t/SjQC7W6tqLEvwaqBYyT+y8wDQYJKoZIhvcNAQELBQADggIB -ACXGumvrh8vegjmWPfBEp2uEcwPenStPuiB/vHiyz5ewG5zz13ku9Ui20vsXiObT -ej/tUxPQ4i9qecsAIyjmHjdXNYmEwnZPNDatZ8POQQaIxffu2Bq41gt/UP+TqhdL -jOztUmCypAbqTuv0axn96/Ua4CUqmtzHQTb3yHQFhDmVOdYLO6Qn+gjYXB74BGBS -ESgoA//vU2YApUo0FmZ8/Qmkrp5nGm9BC2sGE5uPhnEFtC+NiWYzKXZUmhH4J/qy -P5Hgzg0b8zAarb8iXRvTvyUFTeGSGn+ZnzxEk8rUQElsgIfXBDrDMlI1Dlb4pd19 -xIsNER9Tyx6yF7Zod1rg1MvIB671Oi6ON7fQAUtDKXeMOZePglr4UeWJoBjnaH9d -Ci77o0cOPaYjesYBx4/IXr9tgFa+iiS6M+qf4TIRnvHST4D2G0CvOJ4RUHlzEhLN -5mydLIhyPDCBBpEi6lmt2hkuIsKNuYyH4Ga8cyNfIWRjgEj1oDwYPZTISEEdQLpe -/v5WOaHIz16eGWRGENoXkbcFgKyLmZJ956LYBws2J+dIeWCKw9cTXPhyQN9Ky8+Z -AAoACxGV2lZFA4gKn2fQ1XmxqI1AbQ3CekD6819kR5LLU7m7Wc5P/dAVUwHY3+vZ -5nbv0CO7O6l5s9UCKc2Jo5YPSjXnTkLAdc0Hz+Ys63su ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDVTCCAj2gAwIBAgIESTMAATANBgkqhkiG9w0BAQUFADAyMQswCQYDVQQGEwJD -TjEOMAwGA1UEChMFQ05OSUMxEzARBgNVBAMTCkNOTklDIFJPT1QwHhcNMDcwNDE2 -MDcwOTE0WhcNMjcwNDE2MDcwOTE0WjAyMQswCQYDVQQGEwJDTjEOMAwGA1UEChMF -Q05OSUMxEzARBgNVBAMTCkNOTklDIFJPT1QwggEiMA0GCSqGSIb3DQEBAQUAA4IB -DwAwggEKAoIBAQDTNfc/c3et6FtzF8LRb+1VvG7q6KR5smzDo+/hn7E7SIX1mlwh -IhAsxYLO2uOabjfhhyzcuQxauohV3/2q2x8x6gHx3zkBwRP9SFIhxFXf2tizVHa6 -dLG3fdfA6PZZxU3Iva0fFNrfWEQlMhkqx35+jq44sDB7R3IJMfAw28Mbdim7aXZO -V/kbZKKTVrdvmW7bCgScEeOAH8tjlBAKqeFkgjH5jCftppkA9nCTGPihNIaj3XrC -GHn2emU1z5DrvTOTn1OrczvmmzQgLx3vqR1jGqCA2wMv+SYahtKNu6m+UjqHZ0gN -v7Sg2Ca+I19zN38m5pIEo3/PIKe38zrKy5nLAgMBAAGjczBxMBEGCWCGSAGG+EIB -AQQEAwIABzAfBgNVHSMEGDAWgBRl8jGtKvf33VKWCscCwQ7vptU7ETAPBgNVHRMB -Af8EBTADAQH/MAsGA1UdDwQEAwIB/jAdBgNVHQ4EFgQUZfIxrSr3991SlgrHAsEO -76bVOxEwDQYJKoZIhvcNAQEFBQADggEBAEs17szkrr/Dbq2flTtLP1se31cpolnK -OOK5Gv+e5m4y3R6u6jW39ZORTtpC4cMXYFDy0VwmuYK36m3knITnA3kXr5g9lNvH -ugDnuL8BV8F3RTIMO/G0HAiw/VGgod2aHRM2mm23xzy54cXZF/qD1T0VoDy7Hgvi -yJA/qIYM/PmLXoXLT1tLYhFHxUV8BS9BsZ4QaRuZluBVeftOhpm4lNqGOGqTo+fL -buXf6iFViZx9fX+Y9QCJ7uOEwFyWtcVG6kbghVW2G8kS1sHNzYDzAgE8yGnLRUhj -2JTQ7IUOO04RZfSCjKY9ri4ilAnIXOo8gV0WKgOXFlUJ24pBgp5mmxE= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIEHTCCAwWgAwIBAgIQToEtioJl4AsC7j41AkblPTANBgkqhkiG9w0BAQUFADCB -gTELMAkGA1UEBhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4G -A1UEBxMHU2FsZm9yZDEaMBgGA1UEChMRQ09NT0RPIENBIExpbWl0ZWQxJzAlBgNV -BAMTHkNPTU9ETyBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNjEyMDEwMDAw -MDBaFw0yOTEyMzEyMzU5NTlaMIGBMQswCQYDVQQGEwJHQjEbMBkGA1UECBMSR3Jl -YXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHEwdTYWxmb3JkMRowGAYDVQQKExFDT01P -RE8gQ0EgTGltaXRlZDEnMCUGA1UEAxMeQ09NT0RPIENlcnRpZmljYXRpb24gQXV0 -aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0ECLi3LjkRv3 -UcEbVASY06m/weaKXTuH+7uIzg3jLz8GlvCiKVCZrts7oVewdFFxze1CkU1B/qnI -2GqGd0S7WWaXUF601CxwRM/aN5VCaTwwxHGzUvAhTaHYujl8HJ6jJJ3ygxaYqhZ8 -Q5sVW7euNJH+1GImGEaaP+vB+fGQV+useg2L23IwambV4EajcNxo2f8ESIl33rXp -+2dtQem8Ob0y2WIC8bGoPW43nOIv4tOiJovGuFVDiOEjPqXSJDlqR6sA1KGzqSX+ -DT+nHbrTUcELpNqsOO9VUCQFZUaTNE8tja3G1CEZ0o7KBWFxB3NH5YoZEr0ETc5O -nKVIrLsm9wIDAQABo4GOMIGLMB0GA1UdDgQWBBQLWOWLxkwVN6RAqTCpIb5HNlpW -/zAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zBJBgNVHR8EQjBAMD6g -PKA6hjhodHRwOi8vY3JsLmNvbW9kb2NhLmNvbS9DT01PRE9DZXJ0aWZpY2F0aW9u -QXV0aG9yaXR5LmNybDANBgkqhkiG9w0BAQUFAAOCAQEAPpiem/Yb6dc5t3iuHXIY -SdOH5EOC6z/JqvWote9VfCFSZfnVDeFs9D6Mk3ORLgLETgdxb8CPOGEIqB6BCsAv -IC9Bi5HcSEW88cbeunZrM8gALTFGTO3nnc+IlP8zwFboJIYmuNg4ON8qa90SzMc/ -RxdMosIGlgnW2/4/PEZB31jiVg88O8EckzXZOFKs7sjsLjBOlDW0JB9LeGna8gI4 -zJVSk/BwJVmcIGfE7vmLV2H0knZ9P4SNVbfo5azV8fUZVqZa+5Acr5Pr5RzUZ5dd -BA6+C4OmF4O5MBKgxTMVBbkN+8cFduPYSo38NBejxiEovjBFMR7HeL5YYTisO+IB -ZQ== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIICiTCCAg+gAwIBAgIQH0evqmIAcFBUTAGem2OZKjAKBggqhkjOPQQDAzCBhTEL -MAkGA1UEBhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UE -BxMHU2FsZm9yZDEaMBgGA1UEChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMT -IkNPTU9ETyBFQ0MgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMDgwMzA2MDAw -MDAwWhcNMzgwMTE4MjM1OTU5WjCBhTELMAkGA1UEBhMCR0IxGzAZBgNVBAgTEkdy -ZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UEChMRQ09N -T0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBFQ0MgQ2VydGlmaWNhdGlv -biBBdXRob3JpdHkwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQDR3svdcmCFYX7deSR -FtSrYpn1PlILBs5BAH+X4QokPB0BBO490o0JlwzgdeT6+3eKKvUDYEs2ixYjFq0J -cfRK9ChQtP6IHG4/bC8vCVlbpVsLM5niwz2J+Wos77LTBumjQjBAMB0GA1UdDgQW -BBR1cacZSBm8nZ3qQUfflMRId5nTeTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/ -BAUwAwEB/zAKBggqhkjOPQQDAwNoADBlAjEA7wNbeqy3eApyt4jf/7VGFAkK+qDm -fQjGGoe9GKhzvSbKYAydzpmfz1wPMOG+FDHqAjAU9JM8SaczepBGR7NjfRObTrdv -GDeAU/7dIOA1mjbRxwG55tzd8/8dLDoWV9mSOdY= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIF2DCCA8CgAwIBAgIQTKr5yttjb+Af907YWwOGnTANBgkqhkiG9w0BAQwFADCB -hTELMAkGA1UEBhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4G -A1UEBxMHU2FsZm9yZDEaMBgGA1UEChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNV -BAMTIkNPTU9ETyBSU0EgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMTAwMTE5 -MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBhTELMAkGA1UEBhMCR0IxGzAZBgNVBAgT -EkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UEChMR -Q09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBSU0EgQ2VydGlmaWNh -dGlvbiBBdXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCR -6FSS0gpWsawNJN3Fz0RndJkrN6N9I3AAcbxT38T6KhKPS38QVr2fcHK3YX/JSw8X -pz3jsARh7v8Rl8f0hj4K+j5c+ZPmNHrZFGvnnLOFoIJ6dq9xkNfs/Q36nGz637CC -9BR++b7Epi9Pf5l/tfxnQ3K9DADWietrLNPtj5gcFKt+5eNu/Nio5JIk2kNrYrhV -/erBvGy2i/MOjZrkm2xpmfh4SDBF1a3hDTxFYPwyllEnvGfDyi62a+pGx8cgoLEf -Zd5ICLqkTqnyg0Y3hOvozIFIQ2dOciqbXL1MGyiKXCJ7tKuY2e7gUYPDCUZObT6Z -+pUX2nwzV0E8jVHtC7ZcryxjGt9XyD+86V3Em69FmeKjWiS0uqlWPc9vqv9JWL7w -qP/0uK3pN/u6uPQLOvnoQ0IeidiEyxPx2bvhiWC4jChWrBQdnArncevPDt09qZah -SL0896+1DSJMwBGB7FY79tOi4lu3sgQiUpWAk2nojkxl8ZEDLXB0AuqLZxUpaVIC -u9ffUGpVRr+goyhhf3DQw6KqLCGqR84onAZFdr+CGCe01a60y1Dma/RMhnEw6abf -Fobg2P9A3fvQQoh/ozM6LlweQRGBY84YcWsr7KaKtzFcOmpH4MN5WdYgGq/yapiq -crxXStJLnbsQ/LBMQeXtHT1eKJ2czL+zUdqnR+WEUwIDAQABo0IwQDAdBgNVHQ4E -FgQUu69+Aj36pvE8hI6t7jiY7NkyMtQwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB -/wQFMAMBAf8wDQYJKoZIhvcNAQEMBQADggIBAArx1UaEt65Ru2yyTUEUAJNMnMvl -wFTPoCWOAvn9sKIN9SCYPBMtrFaisNZ+EZLpLrqeLppysb0ZRGxhNaKatBYSaVqM -4dc+pBroLwP0rmEdEBsqpIt6xf4FpuHA1sj+nq6PK7o9mfjYcwlYRm6mnPTXJ9OV -2jeDchzTc+CiR5kDOF3VSXkAKRzH7JsgHAckaVd4sjn8OoSgtZx8jb8uk2Intzna -FxiuvTwJaP+EmzzV1gsD41eeFPfR60/IvYcjt7ZJQ3mFXLrrkguhxuhoqEwWsRqZ -CuhTLJK7oQkYdQxlqHvLI7cawiiFwxv/0Cti76R7CZGYZ4wUAc1oBmpjIXUDgIiK -boHGhfKppC3n9KUkEEeDys30jXlYsQab5xoq2Z0B15R97QNKyvDb6KkBPvVWmcke -jkk9u+UJueBPSZI9FoJAzMxZxuY67RIuaTxslbH9qh17f4a+Hg4yRvv7E491f0yL -S0Zj/gA0QHDBw7mh3aZw4gSzQbzpgJHqZJx64SIDqZxubw5lT2yHh17zbqD5daWb -QOhTsiedSrnAdyGN/4fy3ryM7xfft0kL0fJuMAsaDk527RH89elWsn2/x20Kk4yl -0MC2Hb46TpSi125sC8KKfPog88Tk5c0NqMuRkrF8hey1FGlmDoLnzc7ILaZRfyHB -NVOFBkpdn627G190 ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIEvTCCA6WgAwIBAgIBADANBgkqhkiG9w0BAQUFADB/MQswCQYDVQQGEwJFVTEn -MCUGA1UEChMeQUMgQ2FtZXJmaXJtYSBTQSBDSUYgQTgyNzQzMjg3MSMwIQYDVQQL -ExpodHRwOi8vd3d3LmNoYW1iZXJzaWduLm9yZzEiMCAGA1UEAxMZQ2hhbWJlcnMg -b2YgQ29tbWVyY2UgUm9vdDAeFw0wMzA5MzAxNjEzNDNaFw0zNzA5MzAxNjEzNDRa -MH8xCzAJBgNVBAYTAkVVMScwJQYDVQQKEx5BQyBDYW1lcmZpcm1hIFNBIENJRiBB -ODI3NDMyODcxIzAhBgNVBAsTGmh0dHA6Ly93d3cuY2hhbWJlcnNpZ24ub3JnMSIw -IAYDVQQDExlDaGFtYmVycyBvZiBDb21tZXJjZSBSb290MIIBIDANBgkqhkiG9w0B -AQEFAAOCAQ0AMIIBCAKCAQEAtzZV5aVdGDDg2olUkfzIx1L4L1DZ77F1c2VHfRtb -unXF/KGIJPov7coISjlUxFF6tdpg6jg8gbLL8bvZkSM/SAFwdakFKq0fcfPJVD0d -BmpAPrMMhe5cG3nCYsS4No41XQEMIwRHNaqbYE6gZj3LJgqcQKH0XZi/caulAGgq -7YN6D6IUtdQis4CwPAxaUWktWBiP7Zme8a7ileb2R6jWDA+wWFjbw2Y3npuRVDM3 -0pQcakjJyfKl2qUMI/cjDpwyVV5xnIQFUZot/eZOKjRa3spAN2cMVCFVd9oKDMyX -roDclDZK9D7ONhMeU+SsTjoF7Nuucpw4i9A5O4kKPnf+dQIBA6OCAUQwggFAMBIG -A1UdEwEB/wQIMAYBAf8CAQwwPAYDVR0fBDUwMzAxoC+gLYYraHR0cDovL2NybC5j -aGFtYmVyc2lnbi5vcmcvY2hhbWJlcnNyb290LmNybDAdBgNVHQ4EFgQU45T1sU3p -26EpW1eLTXYGduHRooowDgYDVR0PAQH/BAQDAgEGMBEGCWCGSAGG+EIBAQQEAwIA -BzAnBgNVHREEIDAegRxjaGFtYmVyc3Jvb3RAY2hhbWJlcnNpZ24ub3JnMCcGA1Ud -EgQgMB6BHGNoYW1iZXJzcm9vdEBjaGFtYmVyc2lnbi5vcmcwWAYDVR0gBFEwTzBN -BgsrBgEEAYGHLgoDATA+MDwGCCsGAQUFBwIBFjBodHRwOi8vY3BzLmNoYW1iZXJz -aWduLm9yZy9jcHMvY2hhbWJlcnNyb290Lmh0bWwwDQYJKoZIhvcNAQEFBQADggEB -AAxBl8IahsAifJ/7kPMa0QOx7xP5IV8EnNrJpY0nbJaHkb5BkAFyk+cefV/2icZd -p0AJPaxJRUXcLo0waLIJuvvDL8y6C98/d3tGfToSJI6WjzwFCm/SlCgdbQzALogi -1djPHRPH8EjX1wWnz8dHnjs8NMiAT9QUu/wNUPf6s+xCX6ndbcj0dc97wXImsQEc -XCz9ek60AcUFV7nnPKoF2YjpB0ZBzu9Bga5Y34OirsrXdx/nADydb47kMgkdTXg0 -eDQ8lJsm7U9xxhl6vSAiSFr+S30Dt+dYvsYyTnQeaN2oaFuzPu5ifdmA6Ap1erfu -tGWaIZDgqtCYvDi1czyL+Nw= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIExTCCA62gAwIBAgIBADANBgkqhkiG9w0BAQUFADB9MQswCQYDVQQGEwJFVTEn -MCUGA1UEChMeQUMgQ2FtZXJmaXJtYSBTQSBDSUYgQTgyNzQzMjg3MSMwIQYDVQQL -ExpodHRwOi8vd3d3LmNoYW1iZXJzaWduLm9yZzEgMB4GA1UEAxMXR2xvYmFsIENo -YW1iZXJzaWduIFJvb3QwHhcNMDMwOTMwMTYxNDE4WhcNMzcwOTMwMTYxNDE4WjB9 -MQswCQYDVQQGEwJFVTEnMCUGA1UEChMeQUMgQ2FtZXJmaXJtYSBTQSBDSUYgQTgy -NzQzMjg3MSMwIQYDVQQLExpodHRwOi8vd3d3LmNoYW1iZXJzaWduLm9yZzEgMB4G -A1UEAxMXR2xvYmFsIENoYW1iZXJzaWduIFJvb3QwggEgMA0GCSqGSIb3DQEBAQUA -A4IBDQAwggEIAoIBAQCicKLQn0KuWxfH2H3PFIP8T8mhtxOviteePgQKkotgVvq0 -Mi+ITaFgCPS3CU6gSS9J1tPfnZdan5QEcOw/Wdm3zGaLmFIoCQLfxS+EjXqXd7/s -QJ0lcqu1PzKY+7e3/HKE5TWH+VX6ox8Oby4o3Wmg2UIQxvi1RMLQQ3/bvOSiPGpV -eAp3qdjqGTK3L/5cPxvusZjsyq16aUXjlg9V9ubtdepl6DJWk0aJqCWKZQbua795 -B9Dxt6/tLE2Su8CoX6dnfQTyFQhwrJLWfQTSM/tMtgsL+xrJxI0DqX5c8lCrEqWh -z0hQpe/SyBoT+rB/sYIcd2oPX9wLlY/vQ37mRQklAgEDo4IBUDCCAUwwEgYDVR0T -AQH/BAgwBgEB/wIBDDA/BgNVHR8EODA2MDSgMqAwhi5odHRwOi8vY3JsLmNoYW1i -ZXJzaWduLm9yZy9jaGFtYmVyc2lnbnJvb3QuY3JsMB0GA1UdDgQWBBRDnDafsJ4w -TcbOX60Qq+UDpfqpFDAOBgNVHQ8BAf8EBAMCAQYwEQYJYIZIAYb4QgEBBAQDAgAH -MCoGA1UdEQQjMCGBH2NoYW1iZXJzaWducm9vdEBjaGFtYmVyc2lnbi5vcmcwKgYD -VR0SBCMwIYEfY2hhbWJlcnNpZ25yb290QGNoYW1iZXJzaWduLm9yZzBbBgNVHSAE -VDBSMFAGCysGAQQBgYcuCgEBMEEwPwYIKwYBBQUHAgEWM2h0dHA6Ly9jcHMuY2hh -bWJlcnNpZ24ub3JnL2Nwcy9jaGFtYmVyc2lnbnJvb3QuaHRtbDANBgkqhkiG9w0B -AQUFAAOCAQEAPDtwkfkEVCeR4e3t/mh/YV3lQWVPMvEYBZRqHN4fcNs+ezICNLUM -bKGKfKX0j//U2K0X1S0E0T9YgOKBWYi+wONGkyT+kL0mojAt6JcmVzWJdJYY9hXi -ryQZVgICsroPFOrGimbBhkVVi76SvpykBMdJPJ7oKXqJ1/6v/2j1pReQvayZzKWG -VwlnRtvWFsJG8eSpUPWP0ZIV018+xgBJOm5YstHRJw0lyDL4IBHNfTIzSJRUTN3c -ecQwn+uOuFW114hcxWokPbLTBQNRxgfvzBRydD1ucs4YKIxKoHflCStFREest2d/ -AYoFWpO+ocH/+OcOZ6RHSXZddZAa9SaP8A== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDqDCCApCgAwIBAgIJAP7c4wEPyUj/MA0GCSqGSIb3DQEBBQUAMDQxCzAJBgNV -BAYTAkZSMRIwEAYDVQQKDAlEaGlteW90aXMxETAPBgNVBAMMCENlcnRpZ25hMB4X -DTA3MDYyOTE1MTMwNVoXDTI3MDYyOTE1MTMwNVowNDELMAkGA1UEBhMCRlIxEjAQ -BgNVBAoMCURoaW15b3RpczERMA8GA1UEAwwIQ2VydGlnbmEwggEiMA0GCSqGSIb3 -DQEBAQUAA4IBDwAwggEKAoIBAQDIaPHJ1tazNHUmgh7stL7qXOEm7RFHYeGifBZ4 -QCHkYJ5ayGPhxLGWkv8YbWkj4Sti993iNi+RB7lIzw7sebYs5zRLcAglozyHGxny -gQcPOJAZ0xH+hrTy0V4eHpbNgGzOOzGTtvKg0KmVEn2lmsxryIRWijOp5yIVUxbw -zBfsV1/pogqYCd7jX5xv3EjjhQsVWqa6n6xI4wmy9/Qy3l40vhx4XUJbzg4ij02Q -130yGLMLLGq/jj8UEYkgDncUtT2UCIf3JR7VsmAA7G8qKCVuKj4YYxclPz5EIBb2 -JsglrgVKtOdjLPOMFlN+XPsRGgjBRmKfIrjxwo1p3Po6WAbfAgMBAAGjgbwwgbkw -DwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUGu3+QTmQtCRZvgHyUtVF9lo53BEw -ZAYDVR0jBF0wW4AUGu3+QTmQtCRZvgHyUtVF9lo53BGhOKQ2MDQxCzAJBgNVBAYT -AkZSMRIwEAYDVQQKDAlEaGlteW90aXMxETAPBgNVBAMMCENlcnRpZ25hggkA/tzj -AQ/JSP8wDgYDVR0PAQH/BAQDAgEGMBEGCWCGSAGG+EIBAQQEAwIABzANBgkqhkiG -9w0BAQUFAAOCAQEAhQMeknH2Qq/ho2Ge6/PAD/Kl1NqV5ta+aDY9fm4fTIrv0Q8h -bV6lUmPOEvjvKtpv6zf+EwLHyzs+ImvaYS5/1HI93TDhHkxAGYwP15zRgzB7mFnc -fca5DClMoTOi62c6ZYTTluLtdkVwj7Ur3vkj1kluPBS1xp81HlDQwY9qcEQCYsuu -HWhBp6pX6FOqB9IG9tUUBguRA3UsbHK1YZWaDYu5Def131TN3ubY1gkIl2PlwS6w -t0QmwCbAr1UwnjvVNioZBPRcHv/PLLf/0P2HQBHVESO7SMAhqaQoLf0V+LBOK/Qw -WyH8EZE0vkHve52Xdf+XlcCWWC/qu0bXu+TZLg== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIFnDCCA4SgAwIBAgIBATANBgkqhkiG9w0BAQUFADBjMQswCQYDVQQGEwJGUjET -MBEGA1UEChMKQ2VydGlub21pczEXMBUGA1UECxMOMDAwMiA0MzM5OTg5MDMxJjAk -BgNVBAMMHUNlcnRpbm9taXMgLSBBdXRvcml0w6kgUmFjaW5lMB4XDTA4MDkxNzA4 -Mjg1OVoXDTI4MDkxNzA4Mjg1OVowYzELMAkGA1UEBhMCRlIxEzARBgNVBAoTCkNl -cnRpbm9taXMxFzAVBgNVBAsTDjAwMDIgNDMzOTk4OTAzMSYwJAYDVQQDDB1DZXJ0 -aW5vbWlzIC0gQXV0b3JpdMOpIFJhY2luZTCCAiIwDQYJKoZIhvcNAQEBBQADggIP -ADCCAgoCggIBAJ2Fn4bT46/HsmtuM+Cet0I0VZ35gb5j2CN2DpdUzZlMGvE5x4jY -F1AMnmHawE5V3udauHpOd4cN5bjr+p5eex7Ezyh0x5P1FMYiKAT5kcOrJ3NqDi5N -8y4oH3DfVS9O7cdxbwlyLu3VMpfQ8Vh30WC8Tl7bmoT2R2FFK/ZQpn9qcSdIhDWe -rP5pqZ56XjUl+rSnSTV3lqc2W+HN3yNw2F1MpQiD8aYkOBOo7C+ooWfHpi2GR+6K -/OybDnT0K0kCe5B1jPyZOQE51kqJ5Z52qz6WKDgmi92NjMD2AR5vpTESOH2VwnHu -7XSu5DaiQ3XV8QCb4uTXzEIDS3h65X27uK4uIJPT5GHfceF2Z5c/tt9qc1pkIuVC -28+BA5PY9OMQ4HL2AHCs8MF6DwV/zzRpRbWT5BnbUhYjBYkOjUjkJW+zeL9i9Qf6 -lSTClrLooyPCXQP8w9PlfMl1I9f09bze5N/NgL+RiH2nE7Q5uiy6vdFrzPOlKO1E -nn1So2+WLhl+HPNbxxaOu2B9d2ZHVIIAEWBsMsGoOBvrbpgT1u449fCfDu/+MYHB -0iSVL1N6aaLwD4ZFjliCK0wi1F6g530mJ0jfJUaNSih8hp75mxpZuWW/Bd22Ql09 -5gBIgl4g9xGC3srYn+Y3RyYe63j3YcNBZFgCQfna4NH4+ej9Uji29YnfAgMBAAGj -WzBZMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBQN -jLZh2kS40RR9w759XkjwzspqsDAXBgNVHSAEEDAOMAwGCiqBegFWAgIAAQEwDQYJ -KoZIhvcNAQEFBQADggIBACQ+YAZ+He86PtvqrxyaLAEL9MW12Ukx9F1BjYkMTv9s -ov3/4gbIOZ/xWqndIlgVqIrTseYyCYIDbNc/CMf4uboAbbnW/FIyXaR/pDGUu7ZM -OH8oMDX/nyNTt7buFHAAQCvaR6s0fl6nVjBhK4tDrP22iCj1a7Y+YEq6QpA0Z43q -619FVDsXrIvkxmUP7tCMXWY5zjKn2BCXwH40nJ+U8/aGH88bc62UeYdocMMzpXDn -2NU4lG9jeeu/Cg4I58UvD0KgKxRA/yHgBcUn4YQRE7rWhh1BCxMjidPJC+iKunqj -o3M3NYB9Ergzd0A4wPpeMNLytqOx1qKVl4GbUu1pTP+A5FPbVFsDbVRfsbjvJL1v -nxHDx2TCDyhihWZeGnuyt++uNckZM6i4J9szVb9o4XVIRFb7zdNIu0eJOqxp9YDG -5ERQL1TEqkPFMTFYvZbF6nVsmnWxTfj3l/+WFvKXTej28xH5On2KOG4Ey+HTRRWq -pdEdnV1j6CTmNhTih60bWfVEm/vXd3wfAXBioSAaosUaKPQhA+4u2cGA6rnZgtZb -dsLLO7XSAPCjDuGtbkD326C00EauFddEwk01+dIL8hf2rGbVJLJP0RyZwG71fet0 -BLj5TXcJ17TPBzAJ8bgAVtkXFhYKK4bfjwEZGuW7gmP/vgt2Fl43N+bYdJeimUV5 ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIFkjCCA3qgAwIBAgIBATANBgkqhkiG9w0BAQsFADBaMQswCQYDVQQGEwJGUjET -MBEGA1UEChMKQ2VydGlub21pczEXMBUGA1UECxMOMDAwMiA0MzM5OTg5MDMxHTAb -BgNVBAMTFENlcnRpbm9taXMgLSBSb290IENBMB4XDTEzMTAyMTA5MTcxOFoXDTMz -MTAyMTA5MTcxOFowWjELMAkGA1UEBhMCRlIxEzARBgNVBAoTCkNlcnRpbm9taXMx -FzAVBgNVBAsTDjAwMDIgNDMzOTk4OTAzMR0wGwYDVQQDExRDZXJ0aW5vbWlzIC0g -Um9vdCBDQTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANTMCQosP5L2 -fxSeC5yaah1AMGT9qt8OHgZbn1CF6s2Nq0Nn3rD6foCWnoR4kkjW4znuzuRZWJfl -LieY6pOod5tK8O90gC3rMB+12ceAnGInkYjwSond3IjmFPnVAy//ldu9n+ws+hQV -WZUKxkd8aRi5pwP5ynapz8dvtF4F/u7BUrJ1Mofs7SlmO/NKFoL21prbcpjp3vDF -TKWrteoB4owuZH9kb/2jJZOLyKIOSY008B/sWEUuNKqEUL3nskoTuLAPrjhdsKkb -5nPJWqHZZkCqqU2mNAKthH6yI8H7KsZn9DS2sJVqM09xRLWtwHkziOC/7aOgFLSc -CbAK42C++PhmiM1b8XcF4LVzbsF9Ri6OSyemzTUK/eVNfaoqoynHWmgE6OXWk6Ri -wsXm9E/G+Z8ajYJJGYrKWUM66A0ywfRMEwNvbqY/kXPLynNvEiCL7sCCeN5LLsJJ -wx3tFvYk9CcbXFcx3FXuqB5vbKziRcxXV4p1VxngtViZSTYxPDMBbRZKzbgqg4SG -m/lg0h9tkQPTYKbVPZrdd5A9NaSfD171UkRpucC63M9933zZxKyGIjK8e2uR73r4 -F2iw4lNVYC2vPsKD2NkJK/DAZNuHi5HMkesE/Xa0lZrmFAYb1TQdvtj/dBxThZng -WVJKYe2InmtJiUZ+IFrZ50rlau7SZRFDAgMBAAGjYzBhMA4GA1UdDwEB/wQEAwIB -BjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBTvkUz1pcMw6C8I6tNxIqSSaHh0 -2TAfBgNVHSMEGDAWgBTvkUz1pcMw6C8I6tNxIqSSaHh02TANBgkqhkiG9w0BAQsF -AAOCAgEAfj1U2iJdGlg+O1QnurrMyOMaauo++RLrVl89UM7g6kgmJs95Vn6RHJk/ -0KGRHCwPT5iVWVO90CLYiF2cN/z7ZMF4jIuaYAnq1fohX9B0ZedQxb8uuQsLrbWw -F6YSjNRieOpWauwK0kDDPAUwPk2Ut59KA9N9J0u2/kTO+hkzGm2kQtHdzMjI1xZS -g081lLMSVX3l4kLr5JyTCcBMWwerx20RoFAXlCOotQqSD7J6wWAsOMwaplv/8gzj -qh8c3LigkyfeY+N/IZ865Z764BNqdeuWXGKRlI5nU7aJ+BIJy29SWwNyhlCVCNSN -h4YVH5Uk2KRvms6knZtt0rJ2BobGVgjF6wnaNsIbW0G+YSrjcOa4pvi2WsS9Iff/ -ql+hbHY5ZtbqTFXhADObE5hjyW/QASAJN1LnDE8+zbz1X5YnpyACleAu6AdBBR8V -btaw5BngDwKTACdyxYvRVB9dSsNAl35VpnzBMwQUAR1JIGkLGZOdblgi90AMRgwj -Y/M50n92Uaf0yKHxDHYiI0ZSKS3io0EHVmmY0gUJvGnHWmHNj4FgFU2A3ZDifcRQ -8ow7bkrHxuaAKzyBvBGAFhAn1/DNP3nMcyrDflOR1m749fPH0FFNjkulW+YZFzvW -gQncItzujrnEj1PhZ7szuIgVRs/taTX/dQ1G885x4cVrhkIGuUE= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDkjCCAnqgAwIBAgIRAIW9S/PY2uNp9pTXX8OlRCMwDQYJKoZIhvcNAQEFBQAw -PTELMAkGA1UEBhMCRlIxETAPBgNVBAoTCENlcnRwbHVzMRswGQYDVQQDExJDbGFz -cyAyIFByaW1hcnkgQ0EwHhcNOTkwNzA3MTcwNTAwWhcNMTkwNzA2MjM1OTU5WjA9 -MQswCQYDVQQGEwJGUjERMA8GA1UEChMIQ2VydHBsdXMxGzAZBgNVBAMTEkNsYXNz -IDIgUHJpbWFyeSBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANxQ -ltAS+DXSCHh6tlJw/W/uz7kRy1134ezpfgSN1sxvc0NXYKwzCkTsA18cgCSR5aiR -VhKC9+Ar9NuuYS6JEI1rbLqzAr3VNsVINyPi8Fo3UjMXEuLRYE2+L0ER4/YXJQyL -kcAbmXuZVg2v7tK8R1fjeUl7NIknJITesezpWE7+Tt9avkGtrAjFGA7v0lPubNCd -EgETjdyAYveVqUSISnFOYFWe2yMZeVYHDD9jC1yw4r5+FfyUM1hBOHTE4Y+L3yas -H7WLO7dDWWuwJKZtkIvEcupdM5i3y95ee++U8Rs+yskhwcWYAqqi9lt3m/V+llU0 -HGdpwPFC40es/CgcZlUCAwEAAaOBjDCBiTAPBgNVHRMECDAGAQH/AgEKMAsGA1Ud -DwQEAwIBBjAdBgNVHQ4EFgQU43Mt38sOKAze3bOkynm4jrvoMIkwEQYJYIZIAYb4 -QgEBBAQDAgEGMDcGA1UdHwQwMC4wLKAqoCiGJmh0dHA6Ly93d3cuY2VydHBsdXMu -Y29tL0NSTC9jbGFzczIuY3JsMA0GCSqGSIb3DQEBBQUAA4IBAQCnVM+IRBnL39R/ -AN9WM2K191EBkOvDP9GIROkkXe/nFL0gt5o8AP5tn9uQ3Nf0YtaLcF3n5QRIqWh8 -yfFC82x/xXp8HVGIutIKPidd3i1RTtMTZGnkLuPT55sJmabglZvOGtd/vjzOUrMR -FcEPF80Du5wlFbqidon8BvEY0JNLDnyCt6X09l/+7UCmnYR0ObncHoUW2ikbhiMA -ybuJfm6AiB4vFLQDJKgybwOaRywwvlbGp0ICcBvqQNi6BQNwB6SW//1IMwrh3KWB -kJtN3X3n57LNXMhqlfil9o3EXXgIvnsG1knPGTZQIy4I5p4FTUcY1Rbpsda2ENW7 -l7+ijrRU ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDDDCCAfSgAwIBAgIDAQAgMA0GCSqGSIb3DQEBBQUAMD4xCzAJBgNVBAYTAlBM -MRswGQYDVQQKExJVbml6ZXRvIFNwLiB6IG8uby4xEjAQBgNVBAMTCUNlcnR1bSBD -QTAeFw0wMjA2MTExMDQ2MzlaFw0yNzA2MTExMDQ2MzlaMD4xCzAJBgNVBAYTAlBM -MRswGQYDVQQKExJVbml6ZXRvIFNwLiB6IG8uby4xEjAQBgNVBAMTCUNlcnR1bSBD -QTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAM6xwS7TT3zNJc4YPk/E -jG+AanPIW1H4m9LcuwBcsaD8dQPugfCI7iNS6eYVM42sLQnFdvkrOYCJ5JdLkKWo -ePhzQ3ukYbDYWMzhbGZ+nPMJXlVjhNWo7/OxLjBos8Q82KxujZlakE403Daaj4GI -ULdtlkIJ89eVgw1BS7Bqa/j8D35in2fE7SZfECYPCE/wpFcozo+47UX2bu4lXapu -Ob7kky/ZR6By6/qmW6/KUz/iDsaWVhFu9+lmqSbYf5VT7QqFiLpPKaVCjF62/IUg -AKpoC6EahQGcxEZjgoi2IrHu/qpGWX7PNSzVttpd90gzFFS269lvzs2I1qsb2pY7 -HVkCAwEAAaMTMBEwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQUFAAOCAQEA -uI3O7+cUus/usESSbLQ5PqKEbq24IXfS1HeCh+YgQYHu4vgRt2PRFze+GXYkHAQa -TOs9qmdvLdTN/mUxcMUbpgIKumB7bVjCmkn+YzILa+M6wKyrO7Do0wlRjBCDxjTg -xSvgGrZgFCdsMneMvLJymM/NzD+5yCRCFNZX/OYmQ6kd5YCQzgNUKD73P9P4Te1q -CjqTE5s7FCMTY5w/0YcneeVMUeMBrYVdGjux1XMQpNPyvG5k9VpWkKjHDkx0Dy5x -O/fIR/RpbxXyEV6DHpx8Uq79AtoSqFlnGNu8cN2bsWntgM6JQEhqDjXKKWYVIZQs -6GAqm4VKQPNriiTsBhYscw== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDuzCCAqOgAwIBAgIDBETAMA0GCSqGSIb3DQEBBQUAMH4xCzAJBgNVBAYTAlBM -MSIwIAYDVQQKExlVbml6ZXRvIFRlY2hub2xvZ2llcyBTLkEuMScwJQYDVQQLEx5D -ZXJ0dW0gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkxIjAgBgNVBAMTGUNlcnR1bSBU -cnVzdGVkIE5ldHdvcmsgQ0EwHhcNMDgxMDIyMTIwNzM3WhcNMjkxMjMxMTIwNzM3 -WjB+MQswCQYDVQQGEwJQTDEiMCAGA1UEChMZVW5pemV0byBUZWNobm9sb2dpZXMg -Uy5BLjEnMCUGA1UECxMeQ2VydHVtIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MSIw -IAYDVQQDExlDZXJ0dW0gVHJ1c3RlZCBOZXR3b3JrIENBMIIBIjANBgkqhkiG9w0B -AQEFAAOCAQ8AMIIBCgKCAQEA4/t9o3K6wvDJFIf1awFO4W5AB7ptJ11/91sts1rH -UV+rpDKmYYe2bg+G0jACl/jXaVehGDldamR5xgFZrDwxSjh80gTSSyjoIF87B6LM -TXPb865Px1bVWqeWifrzq2jUI4ZZJ88JJ7ysbnKDHDBy3+Ci6dLhdHUZvSqeexVU -BBvXQzmtVSjF4hq79MDkrjhJM8x2hZ85RdKknvISjFH4fOQtf/WsX+sWn7Et0brM -kUJ3TCXJkDhv2/DM+44el1k+1WBO5gUo7Ul5E0u6SNsv+XLTOcr+H9g0cvW0QM8x -AcPs3hEtF10fuFDRXhmnad4HMyjKUJX5p1TLVIZQRan5SQIDAQABo0IwQDAPBgNV -HRMBAf8EBTADAQH/MB0GA1UdDgQWBBQIds3LB/8k9sXN7buQvOKEN0Z19zAOBgNV -HQ8BAf8EBAMCAQYwDQYJKoZIhvcNAQEFBQADggEBAKaorSLOAT2mo/9i0Eidi15y -sHhE49wcrwn9I0j6vSrEuVUEtRCjjSfeC4Jj0O7eDDd5QVsisrCaQVymcODU0HfL -I9MA4GxWL+FpDQ3Zqr8hgVDZBqWo/5U30Kr+4rP1mS1FhIrlQgnXdAIv94nYmem8 -J9RHjboNRhx3zxSkHLmkMcScKHQDNP8zGSal6Q10tz6XxnboJ5ajZt3hrvJBW8qY -VoNzcOSGGtIxQbovvi0TWnZvTuhOgQ4/WwMioBK+ZlgRSssDxLQqKi2WF+A5VLxI -03YnnZotBqbJ7DnSq9ufmgsnAjUpsUCV5/nonFWIGUbWtzT1fs45mtk48VH3Tyw= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIHTzCCBTegAwIBAgIJAKPaQn6ksa7aMA0GCSqGSIb3DQEBBQUAMIGuMQswCQYD -VQQGEwJFVTFDMEEGA1UEBxM6TWFkcmlkIChzZWUgY3VycmVudCBhZGRyZXNzIGF0 -IHd3dy5jYW1lcmZpcm1hLmNvbS9hZGRyZXNzKTESMBAGA1UEBRMJQTgyNzQzMjg3 -MRswGQYDVQQKExJBQyBDYW1lcmZpcm1hIFMuQS4xKTAnBgNVBAMTIENoYW1iZXJz -IG9mIENvbW1lcmNlIFJvb3QgLSAyMDA4MB4XDTA4MDgwMTEyMjk1MFoXDTM4MDcz -MTEyMjk1MFowga4xCzAJBgNVBAYTAkVVMUMwQQYDVQQHEzpNYWRyaWQgKHNlZSBj -dXJyZW50IGFkZHJlc3MgYXQgd3d3LmNhbWVyZmlybWEuY29tL2FkZHJlc3MpMRIw -EAYDVQQFEwlBODI3NDMyODcxGzAZBgNVBAoTEkFDIENhbWVyZmlybWEgUy5BLjEp -MCcGA1UEAxMgQ2hhbWJlcnMgb2YgQ29tbWVyY2UgUm9vdCAtIDIwMDgwggIiMA0G -CSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCvAMtwNyuAWko6bHiUfaN/Gh/2NdW9 -28sNRHI+JrKQUrpjOyhYb6WzbZSm891kDFX29ufyIiKAXuFixrYp4YFs8r/lfTJq -VKAyGVn+H4vXPWCGhSRv4xGzdz4gljUha7MI2XAuZPeEklPWDrCQiorjh40G072Q -DuKZoRuGDtqaCrsLYVAGUvGef3bsyw/QHg3PmTA9HMRFEFis1tPo1+XqxQEHd9ZR -5gN/ikilTWh1uem8nk4ZcfUyS5xtYBkL+8ydddy/Js2Pk3g5eXNeJQ7KXOt3EgfL -ZEFHcpOrUMPrCXZkNNI5t3YRCQ12RcSprj1qr7V9ZS+UWBDsXHyvfuK2GNnQm05a -Sd+pZgvMPMZ4fKecHePOjlO+Bd5gD2vlGts/4+EhySnB8esHnFIbAURRPHsl18Tl -UlRdJQfKFiC4reRB7noI/plvg6aRArBsNlVq5331lubKgdaX8ZSD6e2wsWsSaR6s -+12pxZjptFtYer49okQ6Y1nUCyXeG0+95QGezdIp1Z8XGQpvvwyQ0wlf2eOKNcx5 -Wk0ZN5K3xMGtr/R5JJqyAQuxr1yW84Ay+1w9mPGgP0revq+ULtlVmhduYJ1jbLhj -ya6BXBg14JC7vjxPNyK5fuvPnnchpj04gftI2jE9K+OJ9dC1vX7gUMQSibMjmhAx -hduub+84Mxh2EQIDAQABo4IBbDCCAWgwEgYDVR0TAQH/BAgwBgEB/wIBDDAdBgNV -HQ4EFgQU+SSsD7K1+HnA+mCIG8TZTQKeFxkwgeMGA1UdIwSB2zCB2IAU+SSsD7K1 -+HnA+mCIG8TZTQKeFxmhgbSkgbEwga4xCzAJBgNVBAYTAkVVMUMwQQYDVQQHEzpN -YWRyaWQgKHNlZSBjdXJyZW50IGFkZHJlc3MgYXQgd3d3LmNhbWVyZmlybWEuY29t -L2FkZHJlc3MpMRIwEAYDVQQFEwlBODI3NDMyODcxGzAZBgNVBAoTEkFDIENhbWVy -ZmlybWEgUy5BLjEpMCcGA1UEAxMgQ2hhbWJlcnMgb2YgQ29tbWVyY2UgUm9vdCAt -IDIwMDiCCQCj2kJ+pLGu2jAOBgNVHQ8BAf8EBAMCAQYwPQYDVR0gBDYwNDAyBgRV -HSAAMCowKAYIKwYBBQUHAgEWHGh0dHA6Ly9wb2xpY3kuY2FtZXJmaXJtYS5jb20w -DQYJKoZIhvcNAQEFBQADggIBAJASryI1wqM58C7e6bXpeHxIvj99RZJe6dqxGfwW -PJ+0W2aeaufDuV2I6A+tzyMP3iU6XsxPpcG1Lawk0lgH3qLPaYRgM+gQDROpI9CF -5Y57pp49chNyM/WqfcZjHwj0/gF/JM8rLFQJ3uIrbZLGOU8W6jx+ekbURWpGqOt1 -glanq6B8aBMz9p0w8G8nOSQjKpD9kCk18pPfNKXG9/jvjA9iSnyu0/VU+I22mlaH -FoI6M6taIgj3grrqLuBHmrS1RaMFO9ncLkVAO+rcf+g769HsJtg1pDDFOqxXnrN2 -pSB7+R5KBWIBpih1YJeSDW4+TTdDDZIVnBgizVGZoCkaPF+KMjNbMMeJL0eYD6MD -xvbxrN8y8NmBGuScvfaAFPDRLLmF9dijscilIeUcE5fuDr3fKanvNFNb0+RqE4QG -tjICxFKuItLcsiFCGtpA8CnJ7AoMXOLQusxI0zcKzBIKinmwPQN/aUv0NCB9szTq -jktk9T79syNnFQ0EuPAtwQlRPLJsFfClI9eDdOTlLsn+mCdCxqvGnrDQWzilm1De -fhiYtUU79nm06PcaewaD+9CL2rvHvRirCG88gGtAPxkZumWK5r7VXNM21+9AUiRg -OGcEMeyP84LG3rlV8zsxkVrctQgVrXYlCg17LofiDKYGvCYQbTed7N14jHyAxfDZ -d0jQ ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIID9zCCAt+gAwIBAgIESJ8AATANBgkqhkiG9w0BAQUFADCBijELMAkGA1UEBhMC -Q04xMjAwBgNVBAoMKUNoaW5hIEludGVybmV0IE5ldHdvcmsgSW5mb3JtYXRpb24g -Q2VudGVyMUcwRQYDVQQDDD5DaGluYSBJbnRlcm5ldCBOZXR3b3JrIEluZm9ybWF0 -aW9uIENlbnRlciBFViBDZXJ0aWZpY2F0ZXMgUm9vdDAeFw0xMDA4MzEwNzExMjVa -Fw0zMDA4MzEwNzExMjVaMIGKMQswCQYDVQQGEwJDTjEyMDAGA1UECgwpQ2hpbmEg -SW50ZXJuZXQgTmV0d29yayBJbmZvcm1hdGlvbiBDZW50ZXIxRzBFBgNVBAMMPkNo -aW5hIEludGVybmV0IE5ldHdvcmsgSW5mb3JtYXRpb24gQ2VudGVyIEVWIENlcnRp -ZmljYXRlcyBSb290MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAm35z -7r07eKpkQ0H1UN+U8i6yjUqORlTSIRLIOTJCBumD1Z9S7eVnAztUwYyZmczpwA// -DdmEEbK40ctb3B75aDFk4Zv6dOtouSCV98YPjUesWgbdYavi7NifFy2cyjw1l1Vx -zUOFsUcW9SxTgHbP0wBkvUCZ3czY28Sf1hNfQYOL+Q2HklY0bBoQCxfVWhyXWIQ8 -hBouXJE0bhlffxdpxWXvayHG1VA6v2G5BY3vbzQ6sm8UY78WO5upKv23KzhmBsUs -4qpnHkWnjQRmQvaPK++IIGmPMowUc9orhpFjIpryp9vOiYurXccUwVswah+xt54u -gQEC7c+WXmPbqOY4twIDAQABo2MwYTAfBgNVHSMEGDAWgBR8cks5x8DbYqVPm6oY -NJKiyoOCWTAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4E -FgQUfHJLOcfA22KlT5uqGDSSosqDglkwDQYJKoZIhvcNAQEFBQADggEBACrDx0M3 -j92tpLIM7twUbY8opJhJywyA6vPtI2Z1fcXTIWd50XPFtQO3WKwMVC/GVhMPMdoG -52U7HW8228gd+f2ABsqjPWYWqJ1MFn3AlUa1UeTiH9fqBk1jjZaM7+czV0I664zB -echNdn3e9rG3geCg+aF4RhcaVpjwTj2rHO3sOdwHSPdj/gauwqRcalsyiMXHM4Ws -ZkJHwlgkmeHlPuV1LI5D1l08eB6olYIpUNHRFrrvwb562bTYzB5MRuF3sTGrvSrI -zo9uoV1/A3U05K2JRVRevq4opbs/eHnrc7MKDf2+yfdWrPa37S+bISnHOLaVxATy -wy39FCqQmbkHzJ8= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIEMjCCAxqgAwIBAgIBATANBgkqhkiG9w0BAQUFADB7MQswCQYDVQQGEwJHQjEb -MBkGA1UECAwSR3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHDAdTYWxmb3JkMRow -GAYDVQQKDBFDb21vZG8gQ0EgTGltaXRlZDEhMB8GA1UEAwwYQUFBIENlcnRpZmlj -YXRlIFNlcnZpY2VzMB4XDTA0MDEwMTAwMDAwMFoXDTI4MTIzMTIzNTk1OVowezEL -MAkGA1UEBhMCR0IxGzAZBgNVBAgMEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UE -BwwHU2FsZm9yZDEaMBgGA1UECgwRQ29tb2RvIENBIExpbWl0ZWQxITAfBgNVBAMM -GEFBQSBDZXJ0aWZpY2F0ZSBTZXJ2aWNlczCCASIwDQYJKoZIhvcNAQEBBQADggEP -ADCCAQoCggEBAL5AnfRu4ep2hxxNRUSOvkbIgwadwSr+GB+O5AL686tdUIoWMQua -BtDFcCLNSS1UY8y2bmhGC1Pqy0wkwLxyTurxFa70VJoSCsN6sjNg4tqJVfMiWPPe -3M/vg4aijJRPn2jymJBGhCfHdr/jzDUsi14HZGWCwEiwqJH5YZ92IFCokcdmtet4 -YgNW8IoaE+oxox6gmf049vYnMlhvB/VruPsUK6+3qszWY19zjNoFmag4qMsXeDZR -rOme9Hg6jc8P2ULimAyrL58OAd7vn5lJ8S3frHRNG5i1R8XlKdH5kBjHYpy+g8cm -ez6KJcfA3Z3mNWgQIJ2P2N7Sw4ScDV7oL8kCAwEAAaOBwDCBvTAdBgNVHQ4EFgQU -oBEKIz6W8Qfs4q8p74Klf9AwpLQwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQF -MAMBAf8wewYDVR0fBHQwcjA4oDagNIYyaHR0cDovL2NybC5jb21vZG9jYS5jb20v -QUFBQ2VydGlmaWNhdGVTZXJ2aWNlcy5jcmwwNqA0oDKGMGh0dHA6Ly9jcmwuY29t -b2RvLm5ldC9BQUFDZXJ0aWZpY2F0ZVNlcnZpY2VzLmNybDANBgkqhkiG9w0BAQUF -AAOCAQEACFb8AvCb6P+k+tZ7xkSAzk/ExfYAWMymtrwUSWgEdujm7l3sAg9g1o1Q -GE8mTgHj5rCl7r+8dFRBv/38ErjHT1r0iWAFf2C3BUrz9vHCv8S5dIa2LX1rzNLz -Rt0vxuBqw8M0Ayx9lt1awg6nCpnBBYurDC/zXDrPbDdVCYfeU0BsWO/8tqtlbgT2 -G9w84FoVxp7Z8VlIMCFlA2zs6SFz7JsDoeA3raAVGI/6ugLOpyypEBMs1OUIJqsi -l2D4kF501KKaU73yqWjgom7C12yxow+ev+to51byrvLjKzg6CYG1a4XXvi3tPxq3 -smPi9WIsgtRqAEFQ8TmDn5XpNpaYbg== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIEPzCCAyegAwIBAgIBATANBgkqhkiG9w0BAQUFADB+MQswCQYDVQQGEwJHQjEb -MBkGA1UECAwSR3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHDAdTYWxmb3JkMRow -GAYDVQQKDBFDb21vZG8gQ0EgTGltaXRlZDEkMCIGA1UEAwwbU2VjdXJlIENlcnRp -ZmljYXRlIFNlcnZpY2VzMB4XDTA0MDEwMTAwMDAwMFoXDTI4MTIzMTIzNTk1OVow -fjELMAkGA1UEBhMCR0IxGzAZBgNVBAgMEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4G -A1UEBwwHU2FsZm9yZDEaMBgGA1UECgwRQ29tb2RvIENBIExpbWl0ZWQxJDAiBgNV -BAMMG1NlY3VyZSBDZXJ0aWZpY2F0ZSBTZXJ2aWNlczCCASIwDQYJKoZIhvcNAQEB -BQADggEPADCCAQoCggEBAMBxM4KK0HDrc4eCQNUd5MvJDkKQ+d40uaG6EfQlhfPM -cm3ye5drswfxdySRXyWP9nQ95IDC+DwN879A6vfIUtFyb+/Iq0G4bi4XKpVpDM3S -HpR7LZQdqnXXs5jLrLxkU0C8j6ysNstcrbvd4JQX7NFc0L/vpZXJkMWwrPsbQ996 -CF23uPJAGysnnlDOXmWCiIxe004MeuoIkbY2qitC++rCoznl2yY4rYsK7hljxxwk -3wN42ubqwUcaCwtGCd0C/N7Lh1/XMGNooa7cMqG6vv5Eq2i2pRcV/b3Vp6ea5EQz -6YiO/O1R65NxTq0B50SOqy3LqP4BSUjwwN3HaNiS/j0CAwEAAaOBxzCBxDAdBgNV -HQ4EFgQUPNiTiMLAggnMAZkGkyDpnnAJY08wDgYDVR0PAQH/BAQDAgEGMA8GA1Ud -EwEB/wQFMAMBAf8wgYEGA1UdHwR6MHgwO6A5oDeGNWh0dHA6Ly9jcmwuY29tb2Rv -Y2EuY29tL1NlY3VyZUNlcnRpZmljYXRlU2VydmljZXMuY3JsMDmgN6A1hjNodHRw -Oi8vY3JsLmNvbW9kby5uZXQvU2VjdXJlQ2VydGlmaWNhdGVTZXJ2aWNlcy5jcmww -DQYJKoZIhvcNAQEFBQADggEBAIcBbSMdflsXfcFhMs+P5/OKlFlm4J4oqF7Tt/Q0 -5qo5spcWxYJvMqTpjOev/e/C6LlLqqP05tqNZSH7uoDrJiiFGv45jN5bBAS0VPmj -Z55B+glSzAVIqMk/IQQezkhr/IXownuvf7fM+F86/TXGDe+X3EyrEeFryzHRbPtI -gKvcnDe4IRRLDXE97IMzbtFuMhbsmMcWi1mmNKsFVy2T96oTy9IT4rcuO81rUBcJ -aD61JlfutuC23bkpgHl9j6PwpCikFcSF9CfUa7/lXORlAnZUtOM3ZiTTGWHIUhDl -izeauan5Hb/qmZJhlv8BzaFfDbxxvA6sCx1HRR3B7Hzs/Sk= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIEQzCCAyugAwIBAgIBATANBgkqhkiG9w0BAQUFADB/MQswCQYDVQQGEwJHQjEb -MBkGA1UECAwSR3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHDAdTYWxmb3JkMRow -GAYDVQQKDBFDb21vZG8gQ0EgTGltaXRlZDElMCMGA1UEAwwcVHJ1c3RlZCBDZXJ0 -aWZpY2F0ZSBTZXJ2aWNlczAeFw0wNDAxMDEwMDAwMDBaFw0yODEyMzEyMzU5NTla -MH8xCzAJBgNVBAYTAkdCMRswGQYDVQQIDBJHcmVhdGVyIE1hbmNoZXN0ZXIxEDAO -BgNVBAcMB1NhbGZvcmQxGjAYBgNVBAoMEUNvbW9kbyBDQSBMaW1pdGVkMSUwIwYD -VQQDDBxUcnVzdGVkIENlcnRpZmljYXRlIFNlcnZpY2VzMIIBIjANBgkqhkiG9w0B -AQEFAAOCAQ8AMIIBCgKCAQEA33FvNlhTWvI2VFeAxHQIIO0Yfyod5jWaHiWsnOWW -fnJSoBVC21ndZHoa0Lh73TkVvFVIxO06AOoxEbrycXQaZ7jPM8yoMa+j49d/vzMt -TGo87IvDktJTdyR0nAducPy9C1t2ul/y/9c3S0pgePfw+spwtOpZqqPOSC+pw7IL -fhdyFgymBwwbOM/JYrc/oJOlh0Hyt3BAd9i+FHzjqMB6juljatEPmsbS9Is6FARW -1O24zG71++IsWL1/T2sr92AkWCTOJu80kTrV44HQsvAEAtdbtz6SrGsSivnkBbA7 -kUlcsutT6vifR4buv5XAwAaf0lteERv0xwQ1KdJVXOTt6wIDAQABo4HJMIHGMB0G -A1UdDgQWBBTFe1i97doladL3WRaoszLAeydb9DAOBgNVHQ8BAf8EBAMCAQYwDwYD -VR0TAQH/BAUwAwEB/zCBgwYDVR0fBHwwejA8oDqgOIY2aHR0cDovL2NybC5jb21v -ZG9jYS5jb20vVHJ1c3RlZENlcnRpZmljYXRlU2VydmljZXMuY3JsMDqgOKA2hjRo -dHRwOi8vY3JsLmNvbW9kby5uZXQvVHJ1c3RlZENlcnRpZmljYXRlU2VydmljZXMu -Y3JsMA0GCSqGSIb3DQEBBQUAA4IBAQDIk4E7ibSvuIQSTI3S8NtwuleGFTQQuS9/ -HrCoiWChisJ3DFBKmwCL2Iv0QeLQg4pKHBQGsKNoBXAxMKdTmw7pSqBYaWcOrp32 -pSxBvzwGa+RZzG0Q8ZZvH9/0BAKkn0U+yNj6NkZEUD+Cl5EfKNsYEYwq5GWDVxIS -jBc/lDb+XbDABHcTuPQV1T84zJQ6VdCsmPW6AF/ghhmBeC8owH7TzEIK9a5QoNE+ -xqFx7D+gIIxmOom0jtTYsU0lR+4viMi14QVFwL4Ucd56/Y57fU0IlqUSc/Atyjcn -dBInTMu2l+nZrghtWjlA3QVHdWpaIbOjGM9O9y5Xt5hwXsjEeLBi ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDoTCCAomgAwIBAgILBAAAAAABD4WqLUgwDQYJKoZIhvcNAQEFBQAwOzEYMBYG -A1UEChMPQ3liZXJ0cnVzdCwgSW5jMR8wHQYDVQQDExZDeWJlcnRydXN0IEdsb2Jh -bCBSb290MB4XDTA2MTIxNTA4MDAwMFoXDTIxMTIxNTA4MDAwMFowOzEYMBYGA1UE -ChMPQ3liZXJ0cnVzdCwgSW5jMR8wHQYDVQQDExZDeWJlcnRydXN0IEdsb2JhbCBS -b290MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA+Mi8vRRQZhP/8NN5 -7CPytxrHjoXxEnOmGaoQ25yiZXRadz5RfVb23CO21O1fWLE3TdVJDm71aofW0ozS -J8bi/zafmGWgE07GKmSb1ZASzxQG9Dvj1Ci+6A74q05IlG2OlTEQXO2iLb3VOm2y -HLtgwEZLAfVJrn5GitB0jaEMAs7u/OePuGtm839EAL9mJRQr3RAwHQeWP032a7iP -t3sMpTjr3kfb1V05/Iin89cqdPHoWqI7n1C6poxFNcJQZZXcY4Lv3b93TZxiyWNz -FtApD0mpSPCzqrdsxacwOUBdrsTiXSZT8M4cIwhhqJQZugRiQOwfOHB3EgZxpzAY -XSUnpQIDAQABo4GlMIGiMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/ -MB0GA1UdDgQWBBS2CHsNesysIEyGVjJez6tuhS1wVzA/BgNVHR8EODA2MDSgMqAw -hi5odHRwOi8vd3d3Mi5wdWJsaWMtdHJ1c3QuY29tL2NybC9jdC9jdHJvb3QuY3Js -MB8GA1UdIwQYMBaAFLYIew16zKwgTIZWMl7Pq26FLXBXMA0GCSqGSIb3DQEBBQUA -A4IBAQBW7wojoFROlZfJ+InaRcHUowAl9B8Tq7ejhVhpwjCt2BWKLePJzYFa+HMj -Wqd8BfP9IjsO0QbE2zZMcwSO5bAi5MXzLqXZI+O4Tkogp24CJJ8iYGd7ix1yCcUx -XOl5n4BHPa2hCwcUPUf/A2kaDAtE52Mlp3+yybh2hO0j9n0Hq0V+09+zv+mKts2o -omcrUtW3ZfA5TGOgkXmTUg9U3YO7n9GPp1Nzw8v/MOx8BLjYRB+TX3EJIrduPuoc -A06dGiBh+4E37F78CkWr1+cXVdCg6mCbpvbjjFspwgZgFJ0tl0ypkxWdYcQBX0jW -WL1WMRJOEcgh4LMRkWXbtKaIOM5V ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIEMzCCAxugAwIBAgIDCYPzMA0GCSqGSIb3DQEBCwUAME0xCzAJBgNVBAYTAkRF -MRUwEwYDVQQKDAxELVRydXN0IEdtYkgxJzAlBgNVBAMMHkQtVFJVU1QgUm9vdCBD -bGFzcyAzIENBIDIgMjAwOTAeFw0wOTExMDUwODM1NThaFw0yOTExMDUwODM1NTha -ME0xCzAJBgNVBAYTAkRFMRUwEwYDVQQKDAxELVRydXN0IEdtYkgxJzAlBgNVBAMM -HkQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgMjAwOTCCASIwDQYJKoZIhvcNAQEB -BQADggEPADCCAQoCggEBANOySs96R+91myP6Oi/WUEWJNTrGa9v+2wBoqOADER03 -UAifTUpolDWzU9GUY6cgVq/eUXjsKj3zSEhQPgrfRlWLJ23DEE0NkVJD2IfgXU42 -tSHKXzlABF9bfsyjxiupQB7ZNoTWSPOSHjRGICTBpFGOShrvUD9pXRl/RcPHAY9R -ySPocq60vFYJfxLLHLGvKZAKyVXMD9O0Gu1HNVpK7ZxzBCHQqr0ME7UAyiZsxGsM -lFqVlNpQmvH/pStmMaTJOKDfHR+4CS7zp+hnUquVH+BGPtikw8paxTGA6Eian5Rp -/hnd2HN8gcqW3o7tszIFZYQ05ub9VxC1X3a/L7AQDcUCAwEAAaOCARowggEWMA8G -A1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFP3aFMSfMN4hvR5COfyrYyNJ4PGEMA4G -A1UdDwEB/wQEAwIBBjCB0wYDVR0fBIHLMIHIMIGAoH6gfIZ6bGRhcDovL2RpcmVj -dG9yeS5kLXRydXN0Lm5ldC9DTj1ELVRSVVNUJTIwUm9vdCUyMENsYXNzJTIwMyUy -MENBJTIwMiUyMDIwMDksTz1ELVRydXN0JTIwR21iSCxDPURFP2NlcnRpZmljYXRl -cmV2b2NhdGlvbmxpc3QwQ6BBoD+GPWh0dHA6Ly93d3cuZC10cnVzdC5uZXQvY3Js -L2QtdHJ1c3Rfcm9vdF9jbGFzc18zX2NhXzJfMjAwOS5jcmwwDQYJKoZIhvcNAQEL -BQADggEBAH+X2zDI36ScfSF6gHDOFBJpiBSVYEQBrLLpME+bUMJm2H6NMLVwMeni -acfzcNsgFYbQDfC+rAF1hM5+n02/t2A7nPPKHeJeaNijnZflQGDSNiH+0LS4F9p0 -o3/U37CYAqxva2ssJSRyoWXuJVrl5jLn8t+rSfrzkGkj2wTZ51xY/GXUl77M/C4K -zCUqNQT4YJEVdT1B/yMfGchs64JTBKbkTCJNjYy6zltz7GRUUG3RnFX7acM2w4y8 -PIWmawomDeCTmGCufsYkl4phX5GOZpIJhzbNi5stPvZR1FDUWSi9g/LMKHtThm3Y -Johw1+qRzT65ysCQblrGXnRl11z+o+I= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIEQzCCAyugAwIBAgIDCYP0MA0GCSqGSIb3DQEBCwUAMFAxCzAJBgNVBAYTAkRF -MRUwEwYDVQQKDAxELVRydXN0IEdtYkgxKjAoBgNVBAMMIUQtVFJVU1QgUm9vdCBD -bGFzcyAzIENBIDIgRVYgMjAwOTAeFw0wOTExMDUwODUwNDZaFw0yOTExMDUwODUw -NDZaMFAxCzAJBgNVBAYTAkRFMRUwEwYDVQQKDAxELVRydXN0IEdtYkgxKjAoBgNV -BAMMIUQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgRVYgMjAwOTCCASIwDQYJKoZI -hvcNAQEBBQADggEPADCCAQoCggEBAJnxhDRwui+3MKCOvXwEz75ivJn9gpfSegpn -ljgJ9hBOlSJzmY3aFS3nBfwZcyK3jpgAvDw9rKFs+9Z5JUut8Mxk2og+KbgPCdM0 -3TP1YtHhzRnp7hhPTFiu4h7WDFsVWtg6uMQYZB7jM7K1iXdODL/ZlGsTl28So/6Z -qQTMFexgaDbtCHu39b+T7WYxg4zGcTSHThfqr4uRjRxWQa4iN1438h3Z0S0NL2lR -p75mpoo6Kr3HGrHhFPC+Oh25z1uxav60sUYgovseO3Dvk5h9jHOW8sXvhXCtKSb8 -HgQ+HKDYD8tSg2J87otTlZCpV6LqYQXY+U3EJ/pure3511H3a6UCAwEAAaOCASQw -ggEgMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFNOUikxiEyoZLsyvcop9Ntea -HNxnMA4GA1UdDwEB/wQEAwIBBjCB3QYDVR0fBIHVMIHSMIGHoIGEoIGBhn9sZGFw -Oi8vZGlyZWN0b3J5LmQtdHJ1c3QubmV0L0NOPUQtVFJVU1QlMjBSb290JTIwQ2xh -c3MlMjAzJTIwQ0ElMjAyJTIwRVYlMjAyMDA5LE89RC1UcnVzdCUyMEdtYkgsQz1E -RT9jZXJ0aWZpY2F0ZXJldm9jYXRpb25saXN0MEagRKBChkBodHRwOi8vd3d3LmQt -dHJ1c3QubmV0L2NybC9kLXRydXN0X3Jvb3RfY2xhc3NfM19jYV8yX2V2XzIwMDku -Y3JsMA0GCSqGSIb3DQEBCwUAA4IBAQA07XtaPKSUiO8aEXUHL7P+PPoeUSbrh/Yp -3uDx1MYkCenBz1UbtDDZzhr+BlGmFaQt77JLvyAoJUnRpjZ3NOhk31KxEcdzes05 -nsKtjHEh8lprr988TlWvsoRlFIm5d8sqMb7Po23Pb0iUMkZv53GMoKaEGTcH8gNF -CSuGdXzfX2lXANtu2KZyIktQ1HWYVt+3GP9DQ1CuekR78HlR10M9p9OB0/DJT7na -xpeG0ILD5EJt/rDiZE4OJudANCa1CInXCGNjOCd1HjPqbqjdn5lPdE2BiYBL3ZqX -KVwvvoFBuYz/6n1gBp7N1z3TLqMVvKjmJuVvw9y4AyHqnxbxLFS1 ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIECTCCAvGgAwIBAgIQDV6ZCtadt3js2AdWO4YV2TANBgkqhkiG9w0BAQUFADBb -MQswCQYDVQQGEwJVUzEgMB4GA1UEChMXRGlnaXRhbCBTaWduYXR1cmUgVHJ1c3Qx -ETAPBgNVBAsTCERTVCBBQ0VTMRcwFQYDVQQDEw5EU1QgQUNFUyBDQSBYNjAeFw0w -MzExMjAyMTE5NThaFw0xNzExMjAyMTE5NThaMFsxCzAJBgNVBAYTAlVTMSAwHgYD -VQQKExdEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdDERMA8GA1UECxMIRFNUIEFDRVMx -FzAVBgNVBAMTDkRTVCBBQ0VTIENBIFg2MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A -MIIBCgKCAQEAuT31LMmU3HWKlV1j6IR3dma5WZFcRt2SPp/5DgO0PWGSvSMmtWPu -ktKe1jzIDZBfZIGxqAgNTNj50wUoUrQBJcWVHAx+PhCEdc/BGZFjz+iokYi5Q1K7 -gLFViYsx+tC3dr5BPTCapCIlF3PoHuLTrCq9Wzgh1SpL11V94zpVvddtawJXa+ZH -fAjIgrrep4c9oW24MFbCswKBXy314powGCi4ZtPLAZZv6opFVdbgnf9nKxcCpk4a -ahELfrd755jWjHZvwTvbUJN+5dCOHze4vbrGn2zpfDPyMjwmR/onJALJfh1biEIT -ajV8fTXpLmaRcpPVMibEdPVTo7NdmvYJywIDAQABo4HIMIHFMA8GA1UdEwEB/wQF -MAMBAf8wDgYDVR0PAQH/BAQDAgHGMB8GA1UdEQQYMBaBFHBraS1vcHNAdHJ1c3Rk -c3QuY29tMGIGA1UdIARbMFkwVwYKYIZIAWUDAgEBATBJMEcGCCsGAQUFBwIBFjto -dHRwOi8vd3d3LnRydXN0ZHN0LmNvbS9jZXJ0aWZpY2F0ZXMvcG9saWN5L0FDRVMt -aW5kZXguaHRtbDAdBgNVHQ4EFgQUCXIGThhDD+XWzMNqizF7eI+og7gwDQYJKoZI -hvcNAQEFBQADggEBAKPYjtay284F5zLNAdMEA+V25FYrnJmQ6AgwbN99Pe7lv7Uk -QIRJ4dEorsTCOlMwiPH1d25Ryvr/ma8kXxug/fKshMrfqfBfBC6tFr8hlxCBPeP/ -h40y3JTlR4peahPJlJU90u7INJXQgNStMgiAVDzgvVJT11J8smk/f3rPanTK+gQq -nExaBqXpIK1FZg9p8d2/6eMyi/rgwYZNcjwu2JN4Cir42NInPRmJX1p7ijvMDNpR -rscL9yuwNwXsvFcj4jjSm2jzVhKIT0J8uDHEtdvkyCE06UgRNe76x5JXxZ805Mf2 -9w4LTJxoeHtxMcfrHuBnQfO3oKfN5XozNmr6mis= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDSjCCAjKgAwIBAgIQRK+wgNajJ7qJMDmGLvhAazANBgkqhkiG9w0BAQUFADA/ -MSQwIgYDVQQKExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMT -DkRTVCBSb290IENBIFgzMB4XDTAwMDkzMDIxMTIxOVoXDTIxMDkzMDE0MDExNVow -PzEkMCIGA1UEChMbRGlnaXRhbCBTaWduYXR1cmUgVHJ1c3QgQ28uMRcwFQYDVQQD -Ew5EU1QgUm9vdCBDQSBYMzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB -AN+v6ZdQCINXtMxiZfaQguzH0yxrMMpb7NnDfcdAwRgUi+DoM3ZJKuM/IUmTrE4O -rz5Iy2Xu/NMhD2XSKtkyj4zl93ewEnu1lcCJo6m67XMuegwGMoOifooUMM0RoOEq -OLl5CjH9UL2AZd+3UWODyOKIYepLYYHsUmu5ouJLGiifSKOeDNoJjj4XLh7dIN9b -xiqKqy69cK3FCxolkHRyxXtqqzTWMIn/5WgTe1QLyNau7Fqckh49ZLOMxt+/yUFw -7BZy1SbsOFU5Q9D8/RhcQPGX69Wam40dutolucbY38EVAjqr2m7xPi71XAicPNaD -aeQQmxkqtilX4+U9m5/wAl0CAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNV -HQ8BAf8EBAMCAQYwHQYDVR0OBBYEFMSnsaR7LHH62+FLkHX/xBVghYkQMA0GCSqG -SIb3DQEBBQUAA4IBAQCjGiybFwBcqR7uKGY3Or+Dxz9LwwmglSBd49lZRNI+DT69 -ikugdB/OEIKcdBodfpga3csTS7MgROSR6cz8faXbauX+5v3gTt23ADq1cEmv8uXr -AvHRAosZy5Q6XkjEGB5YGV8eAlrwDPGxrancWYaLbumR9YbK+rlmM6pZW87ipxZz -R8srzJmwN0jP41ZL9c8PDHIyh8bwRLtTcm1D9SZImlJnt1ir/md2cXjbDaJWFBM5 -JDGFoqgCWjBH4d1QB7wCCZAA62RjYJsWvIjJEubSfZGL+T0yjWW06XyxV3bqxbYo -Ob8VZRzI9neWagqNdwvYkQsEjgfbKbYK7p2CNTUQ ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDnzCCAoegAwIBAgIBJjANBgkqhkiG9w0BAQUFADBxMQswCQYDVQQGEwJERTEc -MBoGA1UEChMTRGV1dHNjaGUgVGVsZWtvbSBBRzEfMB0GA1UECxMWVC1UZWxlU2Vj -IFRydXN0IENlbnRlcjEjMCEGA1UEAxMaRGV1dHNjaGUgVGVsZWtvbSBSb290IENB -IDIwHhcNOTkwNzA5MTIxMTAwWhcNMTkwNzA5MjM1OTAwWjBxMQswCQYDVQQGEwJE -RTEcMBoGA1UEChMTRGV1dHNjaGUgVGVsZWtvbSBBRzEfMB0GA1UECxMWVC1UZWxl -U2VjIFRydXN0IENlbnRlcjEjMCEGA1UEAxMaRGV1dHNjaGUgVGVsZWtvbSBSb290 -IENBIDIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCrC6M14IspFLEU -ha88EOQ5bzVdSq7d6mGNlUn0b2SjGmBmpKlAIoTZ1KXleJMOaAGtuU1cOs7TuKhC -QN/Po7qCWWqSG6wcmtoIKyUn+WkjR/Hg6yx6m/UTAtB+NHzCnjwAWav12gz1Mjwr -rFDa1sPeg5TKqAyZMg4ISFZbavva4VhYAUlfckE8FQYBjl2tqriTtM2e66foai1S -NNs671x1Udrb8zH57nGYMsRUFUQM+ZtV7a3fGAigo4aKSe5TBY8ZTNXeWHmb0moc -QqvF1afPaA+W5OFhmHZhyJF81j4A4pFQh+GdCuatl9Idxjp9y7zaAzTVjlsB9WoH -txa2bkp/AgMBAAGjQjBAMB0GA1UdDgQWBBQxw3kbuvVT1xfgiXotF2wKsyudMzAP -BgNVHRMECDAGAQH/AgEFMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQUFAAOC -AQEAlGRZrTlk5ynrE/5aw4sTV8gEJPB0d8Bg42f76Ymmg7+Wgnxu1MM9756Abrsp -tJh6sTtU6zkXR34ajgv8HzFZMQSyzhfzLMdiNlXiItiJVbSYSKpk+tYcNthEeFpa -IzpXl/V6ME+un2pMSyuOoAPjPuCp1NJ70rOo4nI8rZ7/gFnkm0W09juwzTkZmDLl -6iFhkOQxIY40sfcvNUqFENrnijchvllj4PKFiDFT1FQUhXB59C4Gdyd1Lx+4ivn+ -xbrYNuSD7Odlt79jWvNGr4GUN9RBjNYj1h7P9WgbRGOiWrqnNVmh5XAFmw4jV5mU -Cm26OWMohpLzGITY+9HPBVZkVw== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDtzCCAp+gAwIBAgIQDOfg5RfYRv6P5WD8G/AwOTANBgkqhkiG9w0BAQUFADBl -MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3 -d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJv -b3QgQ0EwHhcNMDYxMTEwMDAwMDAwWhcNMzExMTEwMDAwMDAwWjBlMQswCQYDVQQG -EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNl -cnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgQ0EwggEi -MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCtDhXO5EOAXLGH87dg+XESpa7c -JpSIqvTO9SA5KFhgDPiA2qkVlTJhPLWxKISKityfCgyDF3qPkKyK53lTXDGEKvYP -mDI2dsze3Tyoou9q+yHyUmHfnyDXH+Kx2f4YZNISW1/5WBg1vEfNoTb5a3/UsDg+ -wRvDjDPZ2C8Y/igPs6eD1sNuRMBhNZYW/lmci3Zt1/GiSw0r/wty2p5g0I6QNcZ4 -VYcgoc/lbQrISXwxmDNsIumH0DJaoroTghHtORedmTpyoeb6pNnVFzF1roV9Iq4/ -AUaG9ih5yLHa5FcXxH4cDrC0kqZWs72yl+2qp/C3xag/lRbQ/6GW6whfGHdPAgMB -AAGjYzBhMA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQW -BBRF66Kv9JLLgjEtUYunpyGd823IDzAfBgNVHSMEGDAWgBRF66Kv9JLLgjEtUYun -pyGd823IDzANBgkqhkiG9w0BAQUFAAOCAQEAog683+Lt8ONyc3pklL/3cmbYMuRC -dWKuh+vy1dneVrOfzM4UKLkNl2BcEkxY5NM9g0lFWJc1aRqoR+pWxnmrEthngYTf -fwk8lOa4JiwgvT2zKIn3X/8i4peEH+ll74fg38FnSbNd67IJKusm7Xi+fT8r87cm -NW1fiQG2SVufAQWbqz0lwcy2f8Lxb4bG+mRo64EtlOtCt/qMHt1i8b5QZ7dsvfPx -H2sMNgcWfzd8qVttevESRmCD1ycEvkvOl77DZypoEd+A5wwzZr8TDRRu838fYxAe -+o0bJW1sj6W3YQGx0qMmoRBxna3iw/nDmVG3KwcIzi7mULKn+gpFL6Lw8g== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDljCCAn6gAwIBAgIQC5McOtY5Z+pnI7/Dr5r0SzANBgkqhkiG9w0BAQsFADBl -MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3 -d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJv -b3QgRzIwHhcNMTMwODAxMTIwMDAwWhcNMzgwMTE1MTIwMDAwWjBlMQswCQYDVQQG -EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNl -cnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzIwggEi -MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDZ5ygvUj82ckmIkzTz+GoeMVSA -n61UQbVH35ao1K+ALbkKz3X9iaV9JPrjIgwrvJUXCzO/GU1BBpAAvQxNEP4Htecc -biJVMWWXvdMX0h5i89vqbFCMP4QMls+3ywPgym2hFEwbid3tALBSfK+RbLE4E9Hp -EgjAALAcKxHad3A2m67OeYfcgnDmCXRwVWmvo2ifv922ebPynXApVfSr/5Vh88lA -bx3RvpO704gqu52/clpWcTs/1PPRCv4o76Pu2ZmvA9OPYLfykqGxvYmJHzDNw6Yu -YjOuFgJ3RFrngQo8p0Quebg/BLxcoIfhG69Rjs3sLPr4/m3wOnyqi+RnlTGNAgMB -AAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQW -BBTOw0q5mVXyuNtgv6l+vVa1lzan1jANBgkqhkiG9w0BAQsFAAOCAQEAyqVVjOPI -QW5pJ6d1Ee88hjZv0p3GeDgdaZaikmkuOGybfQTUiaWxMTeKySHMq2zNixya1r9I -0jJmwYrA8y8678Dj1JGG0VDjA9tzd29KOVPt3ibHtX2vK0LRdWLjSisCx1BL4Gni -lmwORGYQRI+tBev4eaymG+g3NJ1TyWGqolKvSnAWhsI6yLETcDbYz+70CjTVW0z9 -B5yiutkBclzzTcHdDrEcDcRjvq30FPuJ7KJBDkzMyFdA0G4Dqs0MjomZmWzwPDCv -ON9vvKO+KSAnq3T/EyJ43pdSVR6DtVQgA+6uwE9W3jfMw3+qBCe703e4YtsXfJwo -IhNzbM8m9Yop5w== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIICRjCCAc2gAwIBAgIQC6Fa+h3foLVJRK/NJKBs7DAKBggqhkjOPQQDAzBlMQsw -CQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cu -ZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3Qg -RzMwHhcNMTMwODAxMTIwMDAwWhcNMzgwMTE1MTIwMDAwWjBlMQswCQYDVQQGEwJV -UzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQu -Y29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzMwdjAQBgcq -hkjOPQIBBgUrgQQAIgNiAAQZ57ysRGXtzbg/WPuNsVepRC0FFfLvC/8QdJ+1YlJf -Zn4f5dwbRXkLzMZTCp2NXQLZqVneAlr2lSoOjThKiknGvMYDOAdfVdp+CW7if17Q -RSAPWXYQ1qAk8C3eNvJsKTmjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/ -BAQDAgGGMB0GA1UdDgQWBBTL0L2p4ZgFUaFNN6KDec6NHSrkhDAKBggqhkjOPQQD -AwNnADBkAjAlpIFFAmsSS3V0T8gj43DydXLefInwz5FyYZ5eEJJZVrmDxxDnOOlY -JjZ91eQ0hjkCMHw2U/Aw5WJjOpnitqM7mzT6HtoQknFekROn3aRukswy1vUhZscv -6pZjamVFkpUBtA== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDrzCCApegAwIBAgIQCDvgVpBCRrGhdWrJWZHHSjANBgkqhkiG9w0BAQUFADBh -MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3 -d3cuZGlnaWNlcnQuY29tMSAwHgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBD -QTAeFw0wNjExMTAwMDAwMDBaFw0zMTExMTAwMDAwMDBaMGExCzAJBgNVBAYTAlVT -MRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5kaWdpY2VydC5j -b20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IENBMIIBIjANBgkqhkiG -9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4jvhEXLeqKTTo1eqUKKPC3eQyaKl7hLOllsB -CSDMAZOnTjC3U/dDxGkAV53ijSLdhwZAAIEJzs4bg7/fzTtxRuLWZscFs3YnFo97 -nh6Vfe63SKMI2tavegw5BmV/Sl0fvBf4q77uKNd0f3p4mVmFaG5cIzJLv07A6Fpt -43C/dxC//AH2hdmoRBBYMql1GNXRor5H4idq9Joz+EkIYIvUX7Q6hL+hqkpMfT7P -T19sdl6gSzeRntwi5m3OFBqOasv+zbMUZBfHWymeMr/y7vrTC0LUq7dBMtoM1O/4 -gdW7jVg/tRvoSSiicNoxBN33shbyTApOB6jtSj1etX+jkMOvJwIDAQABo2MwYTAO -BgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUA95QNVbR -TLtm8KPiGxvDl7I90VUwHwYDVR0jBBgwFoAUA95QNVbRTLtm8KPiGxvDl7I90VUw -DQYJKoZIhvcNAQEFBQADggEBAMucN6pIExIK+t1EnE9SsPTfrgT1eXkIoyQY/Esr -hMAtudXH/vTBH1jLuG2cenTnmCmrEbXjcKChzUyImZOMkXDiqw8cvpOp/2PV5Adg -06O/nVsJ8dWO41P0jmP6P6fbtGbfYmbW0W5BjfIttep3Sp+dWOIrWcBAI+0tKIJF -PnlUkiaY4IBIqDfv8NZ5YBberOgOzW6sRBc4L0na4UU+Krk2U886UAb3LujEV0ls -YSEY1QSteDwsOoBrp+uvFRTp2InBuThs4pFsiv9kuXclVzDAGySj4dzp30d8tbQk -CAUw7C29C79Fv1C5qfPrmAESrciIxpg0X40KPMbp1ZWVbd4= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDjjCCAnagAwIBAgIQAzrx5qcRqaC7KGSxHQn65TANBgkqhkiG9w0BAQsFADBh -MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3 -d3cuZGlnaWNlcnQuY29tMSAwHgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBH -MjAeFw0xMzA4MDExMjAwMDBaFw0zODAxMTUxMjAwMDBaMGExCzAJBgNVBAYTAlVT -MRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5kaWdpY2VydC5j -b20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IEcyMIIBIjANBgkqhkiG -9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuzfNNNx7a8myaJCtSnX/RrohCgiN9RlUyfuI -2/Ou8jqJkTx65qsGGmvPrC3oXgkkRLpimn7Wo6h+4FR1IAWsULecYxpsMNzaHxmx -1x7e/dfgy5SDN67sH0NO3Xss0r0upS/kqbitOtSZpLYl6ZtrAGCSYP9PIUkY92eQ -q2EGnI/yuum06ZIya7XzV+hdG82MHauVBJVJ8zUtluNJbd134/tJS7SsVQepj5Wz -tCO7TG1F8PapspUwtP1MVYwnSlcUfIKdzXOS0xZKBgyMUNGPHgm+F6HmIcr9g+UQ -vIOlCsRnKPZzFBQ9RnbDhxSJITRNrw9FDKZJobq7nMWxM4MphQIDAQABo0IwQDAP -BgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBhjAdBgNVHQ4EFgQUTiJUIBiV -5uNu5g/6+rkS7QYXjzkwDQYJKoZIhvcNAQELBQADggEBAGBnKJRvDkhj6zHd6mcY -1Yl9PMWLSn/pvtsrF9+wX3N3KjITOYFnQoQj8kVnNeyIv/iPsGEMNKSuIEyExtv4 -NeF22d+mQrvHRAiGfzZ0JFrabA0UWTW98kndth/Jsw1HKj2ZL7tcu7XUIOGZX1NG -Fdtom/DzMNU+MeKNhJ7jitralj41E6Vf8PlwUHBHQRFXGU7Aj64GxJUTFy8bJZ91 -8rGOmaFvE7FBcf6IKshPECBV1/MUReXgRPTqh5Uykw7+U0b6LJ3/iyK5S9kJRaTe -pLiaWN0bfVKfjllDiIGknibVb63dDcY3fe0Dkhvld1927jyNxF1WW6LZZm6zNTfl -MrY= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIICPzCCAcWgAwIBAgIQBVVWvPJepDU1w6QP1atFcjAKBggqhkjOPQQDAzBhMQsw -CQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cu -ZGlnaWNlcnQuY29tMSAwHgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBHMzAe -Fw0xMzA4MDExMjAwMDBaFw0zODAxMTUxMjAwMDBaMGExCzAJBgNVBAYTAlVTMRUw -EwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5kaWdpY2VydC5jb20x -IDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IEczMHYwEAYHKoZIzj0CAQYF -K4EEACIDYgAE3afZu4q4C/sLfyHS8L6+c/MzXRq8NOrexpu80JX28MzQC7phW1FG -fp4tn+6OYwwX7Adw9c+ELkCDnOg/QW07rdOkFFk2eJ0DQ+4QE2xy3q6Ip6FrtUPO -Z9wj/wMco+I+o0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBhjAd -BgNVHQ4EFgQUs9tIpPmhxdiuNkHMEWNpYim8S8YwCgYIKoZIzj0EAwMDaAAwZQIx -AK288mw/EkrRLTnDCgmXc/SINoyIJ7vmiI1Qhadj+Z4y3maTD/HMsQmP3Wyr+mt/ -oAIwOWZbwmSNuJ5Q3KjVSaLtx9zRSX8XAbjIho9OjIgrqJqpisXRAL34VOKa5Vt8 -sycX ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDxTCCAq2gAwIBAgIQAqxcJmoLQJuPC3nyrkYldzANBgkqhkiG9w0BAQUFADBs -MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3 -d3cuZGlnaWNlcnQuY29tMSswKQYDVQQDEyJEaWdpQ2VydCBIaWdoIEFzc3VyYW5j -ZSBFViBSb290IENBMB4XDTA2MTExMDAwMDAwMFoXDTMxMTExMDAwMDAwMFowbDEL -MAkGA1UEBhMCVVMxFTATBgNVBAoTDERpZ2lDZXJ0IEluYzEZMBcGA1UECxMQd3d3 -LmRpZ2ljZXJ0LmNvbTErMCkGA1UEAxMiRGlnaUNlcnQgSGlnaCBBc3N1cmFuY2Ug -RVYgUm9vdCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMbM5XPm -+9S75S0tMqbf5YE/yc0lSbZxKsPVlDRnogocsF9ppkCxxLeyj9CYpKlBWTrT3JTW -PNt0OKRKzE0lgvdKpVMSOO7zSW1xkX5jtqumX8OkhPhPYlG++MXs2ziS4wblCJEM -xChBVfvLWokVfnHoNb9Ncgk9vjo4UFt3MRuNs8ckRZqnrG0AFFoEt7oT61EKmEFB -Ik5lYYeBQVCmeVyJ3hlKV9Uu5l0cUyx+mM0aBhakaHPQNAQTXKFx01p8VdteZOE3 -hzBWBOURtCmAEvF5OYiiAhF8J2a3iLd48soKqDirCmTCv2ZdlYTBoSUeh10aUAsg -EsxBu24LUTi4S8sCAwEAAaNjMGEwDgYDVR0PAQH/BAQDAgGGMA8GA1UdEwEB/wQF -MAMBAf8wHQYDVR0OBBYEFLE+w2kD+L9HAdSYJhoIAu9jZCvDMB8GA1UdIwQYMBaA -FLE+w2kD+L9HAdSYJhoIAu9jZCvDMA0GCSqGSIb3DQEBBQUAA4IBAQAcGgaX3Nec -nzyIZgYIVyHbIUf4KmeqvxgydkAQV8GK83rZEWWONfqe/EW1ntlMMUu4kehDLI6z -eM7b41N5cdblIZQB2lWHmiRk9opmzN6cN82oNLFpmyPInngiK3BD41VHMWEZ71jF -hS9OMPagMRYjyOfiZRYzy78aG6A9+MpeizGLYAiJLQwGXFK3xPkKmNEVX58Svnw2 -Yzi9RKR/5CYrCsSXaQ3pjOLAEFe4yHYSkVXySGnYvCoCWw9E1CAx2/S6cCZdkGCe -vEsXCS+0yx5DaMkHJ8HSXPfqIbloEpw8nL+e/IBcm2PN7EeqJSdnoDfzAIJ9VNep -+OkuE6N36B9K ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIFkDCCA3igAwIBAgIQBZsbV56OITLiOQe9p3d1XDANBgkqhkiG9w0BAQwFADBi -MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3 -d3cuZGlnaWNlcnQuY29tMSEwHwYDVQQDExhEaWdpQ2VydCBUcnVzdGVkIFJvb3Qg -RzQwHhcNMTMwODAxMTIwMDAwWhcNMzgwMTE1MTIwMDAwWjBiMQswCQYDVQQGEwJV -UzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQu -Y29tMSEwHwYDVQQDExhEaWdpQ2VydCBUcnVzdGVkIFJvb3QgRzQwggIiMA0GCSqG -SIb3DQEBAQUAA4ICDwAwggIKAoICAQC/5pBzaN675F1KPDAiMGkz7MKnJS7JIT3y -ithZwuEppz1Yq3aaza57G4QNxDAf8xukOBbrVsaXbR2rsnnyyhHS5F/WBTxSD1If -xp4VpX6+n6lXFllVcq9ok3DCsrp1mWpzMpTREEQQLt+C8weE5nQ7bXHiLQwb7iDV -ySAdYyktzuxeTsiT+CFhmzTrBcZe7FsavOvJz82sNEBfsXpm7nfISKhmV1efVFiO -DCu3T6cw2Vbuyntd463JT17lNecxy9qTXtyOj4DatpGYQJB5w3jHtrHEtWoYOAMQ -jdjUN6QuBX2I9YI+EJFwq1WCQTLX2wRzKm6RAXwhTNS8rhsDdV14Ztk6MUSaM0C/ -CNdaSaTC5qmgZ92kJ7yhTzm1EVgX9yRcRo9k98FpiHaYdj1ZXUJ2h4mXaXpI8OCi -EhtmmnTK3kse5w5jrubU75KSOp493ADkRSWJtppEGSt+wJS00mFt6zPZxd9LBADM -fRyVw4/3IbKyEbe7f/LVjHAsQWCqsWMYRJUadmJ+9oCw++hkpjPRiQfhvbfmQ6QY -uKZ3AeEPlAwhHbJUKSWJbOUOUlFHdL4mrLZBdd56rF+NP8m800ERElvlEFDrMcXK -chYiCd98THU/Y+whX8QgUWtvsauGi0/C1kVfnSD8oR7FwI+isX4KJpn15GkvmB0t -9dmpsh3lGwIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIB -hjAdBgNVHQ4EFgQU7NfjgtJxXWRM3y5nP+e6mK4cD08wDQYJKoZIhvcNAQEMBQAD -ggIBALth2X2pbL4XxJEbw6GiAI3jZGgPVs93rnD5/ZpKmbnJeFwMDF/k5hQpVgs2 -SV1EY+CtnJYYZhsjDT156W1r1lT40jzBQ0CuHVD1UvyQO7uYmWlrx8GnqGikJ9yd -+SeuMIW59mdNOj6PWTkiU0TryF0Dyu1Qen1iIQqAyHNm0aAFYF/opbSnr6j3bTWc -fFqK1qI4mfN4i/RN0iAL3gTujJtHgXINwBQy7zBZLq7gcfJW5GqXb5JQbZaNaHqa -sjYUegbyJLkJEVDXCLG4iXqEI2FCKeWjzaIgQdfRnGTZ6iahixTXTBmyUEFxPT9N -cCOGDErcgdLMMpSEDQgJlxxPwO5rIHQw0uA5NBCFIRUBCOhVMt5xSdkoF1BN5r5N -0XWs0Mr7QbhDparTwwVETyw2m+L64kW4I1NsBm9nVX9GtUw/bihaeSbSpKhil9Ie -4u1Ki7wb/UdKDd9nZn6yW0HQO+T0O/QEY+nvwlQAUaCKKsnOeMzV6ocEGLPOr0mI -r/OSmbaz5mEP0oUA51Aa5BuVnRmhuZyxm7EAHu/QD09CbMkKvO5D+jpxpchNJqU1 -/YldvIViHTLSoCtU7ZpXwdv6EM8Zt4tKG48BtieVU+i2iW1bvGjUI+iLUaJW+fCm -gKDWHrO8Dw9TdSmq6hN35N6MgSGtBxBHEa2HPQfRdbzP82Z+ ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIGSzCCBDOgAwIBAgIIamg+nFGby1MwDQYJKoZIhvcNAQELBQAwgbIxCzAJBgNV -BAYTAlRSMQ8wDQYDVQQHDAZBbmthcmExQDA+BgNVBAoMN0UtVHXEn3JhIEVCRyBC -aWxpxZ9pbSBUZWtub2xvamlsZXJpIHZlIEhpem1ldGxlcmkgQS7Fni4xJjAkBgNV -BAsMHUUtVHVncmEgU2VydGlmaWthc3lvbiBNZXJrZXppMSgwJgYDVQQDDB9FLVR1 -Z3JhIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTEzMDMwNTEyMDk0OFoXDTIz -MDMwMzEyMDk0OFowgbIxCzAJBgNVBAYTAlRSMQ8wDQYDVQQHDAZBbmthcmExQDA+ -BgNVBAoMN0UtVHXEn3JhIEVCRyBCaWxpxZ9pbSBUZWtub2xvamlsZXJpIHZlIEhp -em1ldGxlcmkgQS7Fni4xJjAkBgNVBAsMHUUtVHVncmEgU2VydGlmaWthc3lvbiBN -ZXJrZXppMSgwJgYDVQQDDB9FLVR1Z3JhIENlcnRpZmljYXRpb24gQXV0aG9yaXR5 -MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA4vU/kwVRHoViVF56C/UY -B4Oufq9899SKa6VjQzm5S/fDxmSJPZQuVIBSOTkHS0vdhQd2h8y/L5VMzH2nPbxH -D5hw+IyFHnSOkm0bQNGZDbt1bsipa5rAhDGvykPL6ys06I+XawGb1Q5KCKpbknSF -Q9OArqGIW66z6l7LFpp3RMih9lRozt6Plyu6W0ACDGQXwLWTzeHxE2bODHnv0ZEo -q1+gElIwcxmOj+GMB6LDu0rw6h8VqO4lzKRG+Bsi77MOQ7osJLjFLFzUHPhdZL3D -k14opz8n8Y4e0ypQBaNV2cvnOVPAmJ6MVGKLJrD3fY185MaeZkJVgkfnsliNZvcH -fC425lAcP9tDJMW/hkd5s3kc91r0E+xs+D/iWR+V7kI+ua2oMoVJl0b+SzGPWsut -dEcf6ZG33ygEIqDUD13ieU/qbIWGvaimzuT6w+Gzrt48Ue7LE3wBf4QOXVGUnhMM -ti6lTPk5cDZvlsouDERVxcr6XQKj39ZkjFqzAQqptQpHF//vkUAqjqFGOjGY5RH8 -zLtJVor8udBhmm9lbObDyz51Sf6Pp+KJxWfXnUYTTjF2OySznhFlhqt/7x3U+Lzn -rFpct1pHXFXOVbQicVtbC/DP3KBhZOqp12gKY6fgDT+gr9Oq0n7vUaDmUStVkhUX -U8u3Zg5mTPj5dUyQ5xJwx0UCAwEAAaNjMGEwHQYDVR0OBBYEFC7j27JJ0JxUeVz6 -Jyr+zE7S6E5UMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAULuPbsknQnFR5 -XPonKv7MTtLoTlQwDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEBCwUAA4ICAQAF -Nzr0TbdF4kV1JI+2d1LoHNgQk2Xz8lkGpD4eKexd0dCrfOAKkEh47U6YA5n+KGCR -HTAduGN8qOY1tfrTYXbm1gdLymmasoR6d5NFFxWfJNCYExL/u6Au/U5Mh/jOXKqY -GwXgAEZKgoClM4so3O0409/lPun++1ndYYRP0lSWE2ETPo+Aab6TR7U1Q9Jauz1c -77NCR807VRMGsAnb/WP2OogKmW9+4c4bU2pEZiNRCHu8W1Ki/QY3OEBhj0qWuJA3 -+GbHeJAAFS6LrVE1Uweoa2iu+U48BybNCAVwzDk/dr2l02cmAYamU9JgO3xDf1WK -vJUawSg5TB9D0pH0clmKuVb8P7Sd2nCcdlqMQ1DujjByTd//SffGqWfZbawCEeI6 -FiWnWAjLb1NBnEg4R2gz0dfHj9R0IdTDBZB6/86WiLEVKV0jq9BgoRJP3vQXzTLl -yb/IQ639Lo7xr+L0mPoSHyDYwKcMhcWQ9DstliaxLL5Mq+ux0orJ23gTDx4JnW2P -AJ8C2sH6H3p6CcRK5ogql5+Ji/03X186zjhZhkuvcQu02PJwT58yE+Owp1fl2tpD -y4Q08ijE6m30Ku/Ba3ba+367hTzSU8JNvnHhRdH9I2cNE3X7z2VnIp2usAnRCf8d -NL/+I5c30jn6PQ0GC7TbO6Orb1wdtn7os4I07QZcJA== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIF5zCCA8+gAwIBAgIITK9zQhyOdAIwDQYJKoZIhvcNAQEFBQAwgYAxODA2BgNV -BAMML0VCRyBFbGVrdHJvbmlrIFNlcnRpZmlrYSBIaXptZXQgU2HEn2xhecSxY8Sx -c8SxMTcwNQYDVQQKDC5FQkcgQmlsacWfaW0gVGVrbm9sb2ppbGVyaSB2ZSBIaXpt -ZXRsZXJpIEEuxZ4uMQswCQYDVQQGEwJUUjAeFw0wNjA4MTcwMDIxMDlaFw0xNjA4 -MTQwMDMxMDlaMIGAMTgwNgYDVQQDDC9FQkcgRWxla3Ryb25payBTZXJ0aWZpa2Eg -SGl6bWV0IFNhxJ9sYXnEsWPEsXPEsTE3MDUGA1UECgwuRUJHIEJpbGnFn2ltIFRl -a25vbG9qaWxlcmkgdmUgSGl6bWV0bGVyaSBBLsWeLjELMAkGA1UEBhMCVFIwggIi -MA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDuoIRh0DpqZhAy2DE4f6en5f2h -4fuXd7hxlugTlkaDT7byX3JWbhNgpQGR4lvFzVcfd2NR/y8927k/qqk153nQ9dAk -tiHq6yOU/im/+4mRDGSaBUorzAzu8T2bgmmkTPiab+ci2hC6X5L8GCcKqKpE+i4s -tPtGmggDg3KriORqcsnlZR9uKg+ds+g75AxuetpX/dfreYteIAbTdgtsApWjluTL -dlHRKJ2hGvxEok3MenaoDT2/F08iiFD9rrbskFBKW5+VQarKD7JK/oCZTqNGFav4 -c0JqwmZ2sQomFd2TkuzbqV9UIlKRcF0T6kjsbgNs2d1s/OsNA/+mgxKb8amTD8Um -TDGyY5lhcucqZJnSuOl14nypqZoaqsNW2xCaPINStnuWt6yHd6i58mcLlEOzrz5z -+kI2sSXFCjEmN1ZnuqMLfdb3ic1nobc6HmZP9qBVFCVMLDMNpkGMvQQxahByCp0O -Lna9XvNRiYuoP1Vzv9s6xiQFlpJIqkuNKgPlV5EQ9GooFW5Hd4RcUXSfGenmHmMW -OeMRFeNYGkS9y8RsZteEBt8w9DeiQyJ50hBs37vmExH8nYQKE3vwO9D8owrXieqW -fo1IhR5kX9tUoqzVegJ5a9KK8GfaZXINFHDk6Y54jzJ0fFfy1tb0Nokb+Clsi7n2 -l9GkLqq+CxnCRelwXQIDAJ3Zo2MwYTAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB -/wQEAwIBBjAdBgNVHQ4EFgQU587GT/wWZ5b6SqMHwQSny2re2kcwHwYDVR0jBBgw -FoAU587GT/wWZ5b6SqMHwQSny2re2kcwDQYJKoZIhvcNAQEFBQADggIBAJuYml2+ -8ygjdsZs93/mQJ7ANtyVDR2tFcU22NU57/IeIl6zgrRdu0waypIN30ckHrMk2pGI -6YNw3ZPX6bqz3xZaPt7gyPvT/Wwp+BVGoGgmzJNSroIBk5DKd8pNSe/iWtkqvTDO -TLKBtjDOWU/aWR1qeqRFsIImgYZ29fUQALjuswnoT4cCB64kXPBfrAowzIpAoHME -wfuJJPaaHFy3PApnNgUIMbOv2AFoKuB4j3TeuFGkjGwgPaL7s9QJ/XvCgKqTbCmY -Iai7FvOpEl90tYeY8pUm3zTvilORiF0alKM/fCL414i6poyWqD1SNGKfAB5UVUJn -xk1Gj7sURT0KlhaOEKGXmdXTMIXM3rRyt7yKPBgpaP3ccQfuJDlq+u2lrDgv+R4Q -DgZxGhBM/nV+/x5XOULK1+EVoVZVWRvRo68R2E7DpSvvkL/A7IITW43WciyTTo9q -Kd+FPNMN4KIYEsxVL0e3p5sC/kH2iExt2qkBR4NkJ2IQgtYSe14DHzSpyZH+r11t -hie3I6p1GMog57AP14kOpmciY/SDQSsGS7tY1dHXt7kQY9iJSrSq3RZj9W6+YKH4 -7ejWkE8axsWgKdOnIaj1Wjz3x0miIZpKlVIglnKaZsv30oZDfCK+lvm9AahH3eU7 -QPl1K5srRmSGjR70j/sHd9DqSaIcjVIUpgqT ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIFVjCCBD6gAwIBAgIQ7is969Qh3hSoYqwE893EATANBgkqhkiG9w0BAQUFADCB -8zELMAkGA1UEBhMCRVMxOzA5BgNVBAoTMkFnZW5jaWEgQ2F0YWxhbmEgZGUgQ2Vy -dGlmaWNhY2lvIChOSUYgUS0wODAxMTc2LUkpMSgwJgYDVQQLEx9TZXJ2ZWlzIFB1 -YmxpY3MgZGUgQ2VydGlmaWNhY2lvMTUwMwYDVQQLEyxWZWdldSBodHRwczovL3d3 -dy5jYXRjZXJ0Lm5ldC92ZXJhcnJlbCAoYykwMzE1MDMGA1UECxMsSmVyYXJxdWlh -IEVudGl0YXRzIGRlIENlcnRpZmljYWNpbyBDYXRhbGFuZXMxDzANBgNVBAMTBkVD -LUFDQzAeFw0wMzAxMDcyMzAwMDBaFw0zMTAxMDcyMjU5NTlaMIHzMQswCQYDVQQG -EwJFUzE7MDkGA1UEChMyQWdlbmNpYSBDYXRhbGFuYSBkZSBDZXJ0aWZpY2FjaW8g -KE5JRiBRLTA4MDExNzYtSSkxKDAmBgNVBAsTH1NlcnZlaXMgUHVibGljcyBkZSBD -ZXJ0aWZpY2FjaW8xNTAzBgNVBAsTLFZlZ2V1IGh0dHBzOi8vd3d3LmNhdGNlcnQu -bmV0L3ZlcmFycmVsIChjKTAzMTUwMwYDVQQLEyxKZXJhcnF1aWEgRW50aXRhdHMg -ZGUgQ2VydGlmaWNhY2lvIENhdGFsYW5lczEPMA0GA1UEAxMGRUMtQUNDMIIBIjAN -BgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsyLHT+KXQpWIR4NA9h0X84NzJB5R -85iKw5K4/0CQBXCHYMkAqbWUZRkiFRfCQ2xmRJoNBD45b6VLeqpjt4pEndljkYRm -4CgPukLjbo73FCeTae6RDqNfDrHrZqJyTxIThmV6PttPB/SnCWDaOkKZx7J/sxaV -HMf5NLWUhdWZXqBIoH7nF2W4onW4HvPlQn2v7fOKSGRdghST2MDk/7NQcvJ29rNd -QlB50JQ+awwAvthrDk4q7D7SzIKiGGUzE3eeml0aE9jD2z3Il3rucO2n5nzbcc8t -lGLfbdb1OL4/pYUKGbio2Al1QnDE6u/LDsg0qBIimAy4E5S2S+zw0JDnJwIDAQAB -o4HjMIHgMB0GA1UdEQQWMBSBEmVjX2FjY0BjYXRjZXJ0Lm5ldDAPBgNVHRMBAf8E -BTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUoMOLRKo3pUW/l4Ba0fF4 -opvpXY0wfwYDVR0gBHgwdjB0BgsrBgEEAfV4AQMBCjBlMCwGCCsGAQUFBwIBFiBo -dHRwczovL3d3dy5jYXRjZXJ0Lm5ldC92ZXJhcnJlbDA1BggrBgEFBQcCAjApGidW -ZWdldSBodHRwczovL3d3dy5jYXRjZXJ0Lm5ldC92ZXJhcnJlbCAwDQYJKoZIhvcN -AQEFBQADggEBAKBIW4IB9k1IuDlVNZyAelOZ1Vr/sXE7zDkJlF7W2u++AVtd0x7Y -/X1PzaBB4DSTv8vihpw3kpBWHNzrKQXlxJ7HNd+KDM3FIUPpqojlNcAZQmNaAl6k -SBg6hW/cnbw/nZzBh7h6YQjpdwt/cKt63dmXLGQehb+8dJahw3oS7AwaboMMPOhy -Rp/7SNVel+axofjk70YllJyJ22k4vuxcDlbHZVHlUIiIv0LVKz3l+bqeLrPK9HOS -Agu+TGbrIP65y7WZf+a2E/rKS03Z7lNGBjvGTq2TWoF+bCpLagVFjPIhpDGQh2xl -nJ2lYJU6Un/10asIbvPuW/mIPX64b24D5EI= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIEAzCCAuugAwIBAgIQVID5oHPtPwBMyonY43HmSjANBgkqhkiG9w0BAQUFADB1 -MQswCQYDVQQGEwJFRTEiMCAGA1UECgwZQVMgU2VydGlmaXRzZWVyaW1pc2tlc2t1 -czEoMCYGA1UEAwwfRUUgQ2VydGlmaWNhdGlvbiBDZW50cmUgUm9vdCBDQTEYMBYG -CSqGSIb3DQEJARYJcGtpQHNrLmVlMCIYDzIwMTAxMDMwMTAxMDMwWhgPMjAzMDEy -MTcyMzU5NTlaMHUxCzAJBgNVBAYTAkVFMSIwIAYDVQQKDBlBUyBTZXJ0aWZpdHNl -ZXJpbWlza2Vza3VzMSgwJgYDVQQDDB9FRSBDZXJ0aWZpY2F0aW9uIENlbnRyZSBS -b290IENBMRgwFgYJKoZIhvcNAQkBFglwa2lAc2suZWUwggEiMA0GCSqGSIb3DQEB -AQUAA4IBDwAwggEKAoIBAQDIIMDs4MVLqwd4lfNE7vsLDP90jmG7sWLqI9iroWUy -euuOF0+W2Ap7kaJjbMeMTC55v6kF/GlclY1i+blw7cNRfdCT5mzrMEvhvH2/UpvO -bntl8jixwKIy72KyaOBhU8E2lf/slLo2rpwcpzIP5Xy0xm90/XsY6KxX7QYgSzIw -WFv9zajmofxwvI6Sc9uXp3whrj3B9UiHbCe9nyV0gVWw93X2PaRka9ZP585ArQ/d -MtO8ihJTmMmJ+xAdTX7Nfh9WDSFwhfYggx/2uh8Ej+p3iDXE/+pOoYtNP2MbRMNE -1CV2yreN1x5KZmTNXMWcg+HCCIia7E6j8T4cLNlsHaFLAgMBAAGjgYowgYcwDwYD -VR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFBLyWj7qVhy/ -zQas8fElyalL1BSZMEUGA1UdJQQ+MDwGCCsGAQUFBwMCBggrBgEFBQcDAQYIKwYB -BQUHAwMGCCsGAQUFBwMEBggrBgEFBQcDCAYIKwYBBQUHAwkwDQYJKoZIhvcNAQEF -BQADggEBAHv25MANqhlHt01Xo/6tu7Fq1Q+e2+RjxY6hUFaTlrg4wCQiZrxTFGGV -v9DHKpY5P30osxBAIWrEr7BSdxjhlthWXePdNl4dp1BUoMUq5KqMlIpPnTX/dqQG -E5Gion0ARD9V04I8GtVbvFZMIi5GQ4okQC3zErg7cBqklrkar4dBGmoYDQZPxz5u -uSlNDUmJEYcyW+ZLBMjkXOZ0c5RdFpgTlf7727FE5TpwrDdr5rMzcijJs1eg9gIW -iAYLtqZLICjU3j2LrTcFU3T+bsy8QxdxXvnFzBqpYe73dgzzcvRyrc9yAjYHR8/v -GVCJYMzpJJUPwssd8m92kMfMdcGWxZ0= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIEKjCCAxKgAwIBAgIEOGPe+DANBgkqhkiG9w0BAQUFADCBtDEUMBIGA1UEChML -RW50cnVzdC5uZXQxQDA+BgNVBAsUN3d3dy5lbnRydXN0Lm5ldC9DUFNfMjA0OCBp -bmNvcnAuIGJ5IHJlZi4gKGxpbWl0cyBsaWFiLikxJTAjBgNVBAsTHChjKSAxOTk5 -IEVudHJ1c3QubmV0IExpbWl0ZWQxMzAxBgNVBAMTKkVudHJ1c3QubmV0IENlcnRp -ZmljYXRpb24gQXV0aG9yaXR5ICgyMDQ4KTAeFw05OTEyMjQxNzUwNTFaFw0yOTA3 -MjQxNDE1MTJaMIG0MRQwEgYDVQQKEwtFbnRydXN0Lm5ldDFAMD4GA1UECxQ3d3d3 -LmVudHJ1c3QubmV0L0NQU18yMDQ4IGluY29ycC4gYnkgcmVmLiAobGltaXRzIGxp -YWIuKTElMCMGA1UECxMcKGMpIDE5OTkgRW50cnVzdC5uZXQgTGltaXRlZDEzMDEG -A1UEAxMqRW50cnVzdC5uZXQgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgKDIwNDgp -MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArU1LqRKGsuqjIAcVFmQq -K0vRvwtKTY7tgHalZ7d4QMBzQshowNtTK91euHaYNZOLGp18EzoOH1u3Hs/lJBQe -sYGpjX24zGtLA/ECDNyrpUAkAH90lKGdCCmziAv1h3edVc3kw37XamSrhRSGlVuX -MlBvPci6Zgzj/L24ScF2iUkZ/cCovYmjZy/Gn7xxGWC4LeksyZB2ZnuU4q941mVT -XTzWnLLPKQP5L6RQstRIzgUyVYr9smRMDuSYB3Xbf9+5CFVghTAp+XtIpGmG4zU/ -HoZdenoVve8AjhUiVBcAkCaTvA5JaJG/+EfTnZVCwQ5N328mz8MYIWJmQ3DW1cAH -4QIDAQABo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNV -HQ4EFgQUVeSB0RGAvtiJuQijMfmhJAkWuXAwDQYJKoZIhvcNAQEFBQADggEBADub -j1abMOdTmXx6eadNl9cZlZD7Bh/KM3xGY4+WZiT6QBshJ8rmcnPyT/4xmf3IDExo -U8aAghOY+rat2l098c5u9hURlIIM7j+VrxGrD9cv3h8Dj1csHsm7mhpElesYT6Yf -zX1XEC+bBAlahLVu2B064dae0Wx5XnkcFMXj0EyTO2U87d89vqbllRrDtRnDvV5b -u/8j72gZyxKTJ1wDLW8w0B62GqzeWvfRqqgnpv55gcR5mTNXuhKwqeBCbJPKVt7+ -bYQLCIt+jerXmCHG8+c8eS9enNFMFY3h7CI3zJpDC5fcgJCNs2ebb0gIFVbPv/Er -fF6adulZkMV8gzURZVE= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIEkTCCA3mgAwIBAgIERWtQVDANBgkqhkiG9w0BAQUFADCBsDELMAkGA1UEBhMC -VVMxFjAUBgNVBAoTDUVudHJ1c3QsIEluYy4xOTA3BgNVBAsTMHd3dy5lbnRydXN0 -Lm5ldC9DUFMgaXMgaW5jb3Jwb3JhdGVkIGJ5IHJlZmVyZW5jZTEfMB0GA1UECxMW -KGMpIDIwMDYgRW50cnVzdCwgSW5jLjEtMCsGA1UEAxMkRW50cnVzdCBSb290IENl -cnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTA2MTEyNzIwMjM0MloXDTI2MTEyNzIw -NTM0MlowgbAxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1FbnRydXN0LCBJbmMuMTkw -NwYDVQQLEzB3d3cuZW50cnVzdC5uZXQvQ1BTIGlzIGluY29ycG9yYXRlZCBieSBy -ZWZlcmVuY2UxHzAdBgNVBAsTFihjKSAyMDA2IEVudHJ1c3QsIEluYy4xLTArBgNV -BAMTJEVudHJ1c3QgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCASIwDQYJ -KoZIhvcNAQEBBQADggEPADCCAQoCggEBALaVtkNC+sZtKm9I35RMOVcF7sN5EUFo -Nu3s/poBj6E4KPz3EEZmLk0eGrEaTsbRwJWIsMn/MYszA9u3g3s+IIRe7bJWKKf4 -4LlAcTfFy0cOlypowCKVYhXbR9n10Cv/gkvJrT7eTNuQgFA/CYqEAOwwCj0Yzfv9 -KlmaI5UXLEWeH25DeW0MXJj+SKfFI0dcXv1u5x609mhF0YaDW6KKjbHjKYD+JXGI -rb68j6xSlkuqUY3kEzEZ6E5Nn9uss2rVvDlUccp6en+Q3X0dgNmBu1kmwhH+5pPi -94DkZfs0Nw4pgHBNrziGLp5/V6+eF67rHMsoIV+2HNjnogQi+dPa2MsCAwEAAaOB -sDCBrTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zArBgNVHRAEJDAi -gA8yMDA2MTEyNzIwMjM0MlqBDzIwMjYxMTI3MjA1MzQyWjAfBgNVHSMEGDAWgBRo -kORnpKZTgMeGZqTx90tD+4S9bTAdBgNVHQ4EFgQUaJDkZ6SmU4DHhmak8fdLQ/uE -vW0wHQYJKoZIhvZ9B0EABBAwDhsIVjcuMTo0LjADAgSQMA0GCSqGSIb3DQEBBQUA -A4IBAQCT1DCw1wMgKtD5Y+iRDAUgqV8ZyntyTtSx29CW+1RaGSwMCPeyvIWonX9t -O1KzKtvn1ISMY/YPyyYBkVBs9F8U4pN0wBOeMDpQ47RgxRzwIkSNcUesyBrJ6Zua -AGAT/3B+XxFNSRuzFVJ7yVTav52Vr2ua2J7p8eRDjeIRRDq/r72DQnNSi6q7pynP -9WQcCk3RvKqsnyrQ/39/2n3qse0wJcGE2jTSW3iDVuycNsMm4hH2Z0kdkquM++v/ -eu6FSqdQgPCnXEqULl8FmTxSQeDNtGPPAUO6nIPcj2A781q0tHuu2guQOHXvgR1m -0vdXcDazv/wor3ElhVsT/h5/WrQ8 ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIC+TCCAoCgAwIBAgINAKaLeSkAAAAAUNCR+TAKBggqhkjOPQQDAzCBvzELMAkG -A1UEBhMCVVMxFjAUBgNVBAoTDUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3 -d3cuZW50cnVzdC5uZXQvbGVnYWwtdGVybXMxOTA3BgNVBAsTMChjKSAyMDEyIEVu -dHJ1c3QsIEluYy4gLSBmb3IgYXV0aG9yaXplZCB1c2Ugb25seTEzMDEGA1UEAxMq -RW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRUMxMB4XDTEy -MTIxODE1MjUzNloXDTM3MTIxODE1NTUzNlowgb8xCzAJBgNVBAYTAlVTMRYwFAYD -VQQKEw1FbnRydXN0LCBJbmMuMSgwJgYDVQQLEx9TZWUgd3d3LmVudHJ1c3QubmV0 -L2xlZ2FsLXRlcm1zMTkwNwYDVQQLEzAoYykgMjAxMiBFbnRydXN0LCBJbmMuIC0g -Zm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxMzAxBgNVBAMTKkVudHJ1c3QgUm9vdCBD -ZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEVDMTB2MBAGByqGSM49AgEGBSuBBAAi -A2IABIQTydC6bUF74mzQ61VfZgIaJPRbiWlH47jCffHyAsWfoPZb1YsGGYZPUxBt -ByQnoaD41UcZYUx9ypMn6nQM72+WCf5j7HBdNq1nd67JnXxVRDqiY1Ef9eNi1KlH -Bz7MIKNCMEAwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0O -BBYEFLdj5xrdjekIplWDpOBqUEFlEUJJMAoGCCqGSM49BAMDA2cAMGQCMGF52OVC -R98crlOZF7ZvHH3hvxGU0QOIdeSNiaSKd0bebWHvAvX7td/M/k7//qnmpwIwW5nX -hTcGtXsI/esni0qU+eH6p44mCOh8kmhtc9hvJqwhAriZtyZBWyVgrtBIGu4G ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIEPjCCAyagAwIBAgIESlOMKDANBgkqhkiG9w0BAQsFADCBvjELMAkGA1UEBhMC -VVMxFjAUBgNVBAoTDUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50 -cnVzdC5uZXQvbGVnYWwtdGVybXMxOTA3BgNVBAsTMChjKSAyMDA5IEVudHJ1c3Qs -IEluYy4gLSBmb3IgYXV0aG9yaXplZCB1c2Ugb25seTEyMDAGA1UEAxMpRW50cnVz -dCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzIwHhcNMDkwNzA3MTcy -NTU0WhcNMzAxMjA3MTc1NTU0WjCBvjELMAkGA1UEBhMCVVMxFjAUBgNVBAoTDUVu -dHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50cnVzdC5uZXQvbGVnYWwt -dGVybXMxOTA3BgNVBAsTMChjKSAyMDA5IEVudHJ1c3QsIEluYy4gLSBmb3IgYXV0 -aG9yaXplZCB1c2Ugb25seTEyMDAGA1UEAxMpRW50cnVzdCBSb290IENlcnRpZmlj -YXRpb24gQXV0aG9yaXR5IC0gRzIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK -AoIBAQC6hLZy254Ma+KZ6TABp3bqMriVQRrJ2mFOWHLP/vaCeb9zYQYKpSfYs1/T -RU4cctZOMvJyig/3gxnQaoCAAEUesMfnmr8SVycco2gvCoe9amsOXmXzHHfV1IWN -cCG0szLni6LVhjkCsbjSR87kyUnEO6fe+1R9V77w6G7CebI6C1XiUJgWMhNcL3hW -wcKUs/Ja5CeanyTXxuzQmyWC48zCxEXFjJd6BmsqEZ+pCm5IO2/b1BEZQvePB7/1 -U1+cPvQXLOZprE4yTGJ36rfo5bs0vBmLrpxR57d+tVOxMyLlbc9wPBr64ptntoP0 -jaWvYkxN4FisZDQSA/i2jZRjJKRxAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAP -BgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRqciZ60B7vfec7aVHUbI2fkBJmqzAN -BgkqhkiG9w0BAQsFAAOCAQEAeZ8dlsa2eT8ijYfThwMEYGprmi5ZiXMRrEPR9RP/ -jTkrwPK9T3CMqS/qF8QLVJ7UG5aYMzyorWKiAHarWWluBh1+xLlEjZivEtRh2woZ -Rkfz6/djwUAFQKXSt/S1mja/qYh2iARVBCuch38aNzx+LaUa2NSJXsq9rD1s2G2v -1fN2D807iDginWyTmsQ9v4IbZT+mD12q/OWyFcq1rca8PdCE6OoGcrBNOTJ4vz4R -nAuknZoh8/CbCzB428Hch0P+vGOaysXCHMnHjf87ElgI5rY97HosTvuDls4MPGmH -VHOkc8KT/1EQrBVUAdj8BbGJoX90g5pJ19xOe4pIb4tF9g== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDIDCCAomgAwIBAgIENd70zzANBgkqhkiG9w0BAQUFADBOMQswCQYDVQQGEwJV -UzEQMA4GA1UEChMHRXF1aWZheDEtMCsGA1UECxMkRXF1aWZheCBTZWN1cmUgQ2Vy -dGlmaWNhdGUgQXV0aG9yaXR5MB4XDTk4MDgyMjE2NDE1MVoXDTE4MDgyMjE2NDE1 -MVowTjELMAkGA1UEBhMCVVMxEDAOBgNVBAoTB0VxdWlmYXgxLTArBgNVBAsTJEVx -dWlmYXggU2VjdXJlIENlcnRpZmljYXRlIEF1dGhvcml0eTCBnzANBgkqhkiG9w0B -AQEFAAOBjQAwgYkCgYEAwV2xWGcIYu6gmi0fCG2RFGiYCh7+2gRvE4RiIcPRfM6f -BeC4AfBONOziipUEZKzxa1NfBbPLZ4C/QgKO/t0BCezhABRP/PvwDN1Dulsr4R+A -cJkVV5MW8Q+XarfCaCMczE1ZMKxRHjuvK9buY0V7xdlfUNLjUA86iOe/FP3gx7kC -AwEAAaOCAQkwggEFMHAGA1UdHwRpMGcwZaBjoGGkXzBdMQswCQYDVQQGEwJVUzEQ -MA4GA1UEChMHRXF1aWZheDEtMCsGA1UECxMkRXF1aWZheCBTZWN1cmUgQ2VydGlm -aWNhdGUgQXV0aG9yaXR5MQ0wCwYDVQQDEwRDUkwxMBoGA1UdEAQTMBGBDzIwMTgw -ODIyMTY0MTUxWjALBgNVHQ8EBAMCAQYwHwYDVR0jBBgwFoAUSOZo+SvSspXXR9gj -IBBPM5iQn9QwHQYDVR0OBBYEFEjmaPkr0rKV10fYIyAQTzOYkJ/UMAwGA1UdEwQF -MAMBAf8wGgYJKoZIhvZ9B0EABA0wCxsFVjMuMGMDAgbAMA0GCSqGSIb3DQEBBQUA -A4GBAFjOKer89961zgK5F7WF0bnj4JXMJTENAKaSbn+2kmOeUJXRmm/kEd5jhW6Y -7qj/WsjTVbJmcVfewCHrPSqnI0kBBIZCe/zuf6IWUrVnZ9NA2zsmWLIodz2uFHdh -1voqZiegDfqnc1zqcPGUIWVEX/r87yloqaKHee9570+sB3c4 ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDVDCCAjygAwIBAgIDAjRWMA0GCSqGSIb3DQEBBQUAMEIxCzAJBgNVBAYTAlVT -MRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMRswGQYDVQQDExJHZW9UcnVzdCBHbG9i -YWwgQ0EwHhcNMDIwNTIxMDQwMDAwWhcNMjIwNTIxMDQwMDAwWjBCMQswCQYDVQQG -EwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5jLjEbMBkGA1UEAxMSR2VvVHJ1c3Qg -R2xvYmFsIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2swYYzD9 -9BcjGlZ+W988bDjkcbd4kdS8odhM+KhDtgPpTSEHCIjaWC9mOSm9BXiLnTjoBbdq -fnGk5sRgprDvgOSJKA+eJdbtg/OtppHHmMlCGDUUna2YRpIuT8rxh0PBFpVXLVDv -iS2Aelet8u5fa9IAjbkU+BQVNdnARqN7csiRv8lVK83Qlz6cJmTM386DGXHKTubU -1XupGc1V3sjs0l44U+VcT4wt/lAjNvxm5suOpDkZALeVAjmRCw7+OC7RHQWa9k0+ -bw8HHa8sHo9gOeL6NlMTOdReJivbPagUvTLrGAMoUgRx5aszPeE4uwc2hGKceeoW -MPRfwCvocWvk+QIDAQABo1MwUTAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBTA -ephojYn7qwVkDBF9qn1luMrMTjAfBgNVHSMEGDAWgBTAephojYn7qwVkDBF9qn1l -uMrMTjANBgkqhkiG9w0BAQUFAAOCAQEANeMpauUvXVSOKVCUn5kaFOSPeCpilKIn -Z57QzxpeR+nBsqTP3UEaBU6bS+5Kb1VSsyShNwrrZHYqLizz/Tt1kL/6cdjHPTfS -tQWVYrmm3ok9Nns4d0iXrKYgjy6myQzCsplFAMfOEVEiIuCl6rYVSAlk6l5PdPcF -PseKUgzbFbS9bZvlxrFUaKnjaZC2mqUPuLk/IH2uSrW4nOQdtqvmlKXBx4Ot2/Un -hw4EbNX/3aBd7YdStysVAq45pmp06drE57xNNB6pXE0zX5IJL4hmXXeXxx12E6nV -5fEWCRE11azbJHFwLJhWC9kXtNHjUStedejV0NxPNO3CBWaAocvmMw== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDZjCCAk6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBEMQswCQYDVQQGEwJVUzEW -MBQGA1UEChMNR2VvVHJ1c3QgSW5jLjEdMBsGA1UEAxMUR2VvVHJ1c3QgR2xvYmFs -IENBIDIwHhcNMDQwMzA0MDUwMDAwWhcNMTkwMzA0MDUwMDAwWjBEMQswCQYDVQQG -EwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5jLjEdMBsGA1UEAxMUR2VvVHJ1c3Qg -R2xvYmFsIENBIDIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDvPE1A -PRDfO1MA4Wf+lGAVPoWI8YkNkMgoI5kF6CsgncbzYEbYwbLVjDHZ3CB5JIG/NTL8 -Y2nbsSpr7iFY8gjpeMtvy/wWUsiRxP89c96xPqfCfWbB9X5SJBri1WeR0IIQ13hL -TytCOb1kLUCgsBDTOEhGiKEMuzozKmKY+wCdE1l/bztyqu6mD4b5BWHqZ38MN5aL -5mkWRxHCJ1kDs6ZgwiFAVvqgx306E+PsV8ez1q6diYD3Aecs9pYrEw15LNnA5IZ7 -S4wMcoKK+xfNAGw6EzywhIdLFnopsk/bHdQL82Y3vdj2V7teJHq4PIu5+pIaGoSe -2HSPqht/XvT+RSIhAgMBAAGjYzBhMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYE -FHE4NvICMVNHK266ZUapEBVYIAUJMB8GA1UdIwQYMBaAFHE4NvICMVNHK266ZUap -EBVYIAUJMA4GA1UdDwEB/wQEAwIBhjANBgkqhkiG9w0BAQUFAAOCAQEAA/e1K6td -EPx7srJerJsOflN4WT5CBP51o62sgU7XAotexC3IUnbHLB/8gTKY0UvGkpMzNTEv -/NgdRN3ggX+d6YvhZJFiCzkIjKx0nVnZellSlxG5FntvRdOW2TF9AjYPnDtuzywN -A0ZF66D0f0hExghAzN4bcLUprbqLOzRldRtxIR0sFAqwlpW41uryZfspuk/qkZN0 -abby/+Ea0AzRdoXLiiW9l14sbxWZJue2Kf8i7MkCx1YAzUm5s2x7UwQa4qjJqhIF -I8LO57sEAszAR6LkxCkvW0VXiVHuPOtSCP8HNR6fNWpHSlaY0VqFH4z1Ir+rzoPz -4iIprn2DQKi6bA== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDfDCCAmSgAwIBAgIQGKy1av1pthU6Y2yv2vrEoTANBgkqhkiG9w0BAQUFADBY -MQswCQYDVQQGEwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5jLjExMC8GA1UEAxMo -R2VvVHJ1c3QgUHJpbWFyeSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNjEx -MjcwMDAwMDBaFw0zNjA3MTYyMzU5NTlaMFgxCzAJBgNVBAYTAlVTMRYwFAYDVQQK -Ew1HZW9UcnVzdCBJbmMuMTEwLwYDVQQDEyhHZW9UcnVzdCBQcmltYXJ5IENlcnRp -ZmljYXRpb24gQXV0aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKC -AQEAvrgVe//UfH1nrYNke8hCUy3f9oQIIGHWAVlqnEQRr+92/ZV+zmEwu3qDXwK9 -AWbK7hWNb6EwnL2hhZ6UOvNWiAAxz9juapYC2e0DjPt1befquFUWBRaa9OBesYjA -ZIVcFU2Ix7e64HXprQU9nceJSOC7KMgD4TCTZF5SwFlwIjVXiIrxlQqD17wxcwE0 -7e9GceBrAqg1cmuXm2bgyxx5X9gaBGgeRwLmnWDiNpcB3841kt++Z8dtd1k7j53W -kBWUvEI0EME5+bEnPn7WinXFsq+W06Lem+SYvn3h6YGttm/81w7a4DSwDRp35+MI -mO9Y+pyEtzavwt+s0vQQBnBxNQIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4G -A1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQULNVQQZcVi/CPNmFbSvtr2ZnJM5IwDQYJ -KoZIhvcNAQEFBQADggEBAFpwfyzdtzRP9YZRqSa+S7iq8XEN3GHHoOo0Hnp3DwQ1 -6CePbJC/kRYkRj5KTs4rFtULUh38H2eiAkUxT87z+gOneZ1TatnaYzr4gNfTmeGl -4b7UVXGYNTq+k+qurUKykG/g/CFNNWMziUnWm07Kx+dOCQD32sfvmWKZd7aVIl6K -oKv0uHiYyjgZmclynnjNS6yvGaBzEi38wkG6gZHaFloxt/m0cYASSJlyc1pZU8Fj -UjPtp8nSOQJw+uCxQmYpqptR7TBUIhRf2asdweSU8Pj1K/fqynhG1riR/aYNKxoU -AT6A8EKglQdebc3MS6RFjasS6LPeWuWgfOgPIh1a6Vk= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIICrjCCAjWgAwIBAgIQPLL0SAoA4v7rJDteYD7DazAKBggqhkjOPQQDAzCBmDEL -MAkGA1UEBhMCVVMxFjAUBgNVBAoTDUdlb1RydXN0IEluYy4xOTA3BgNVBAsTMChj -KSAyMDA3IEdlb1RydXN0IEluYy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25seTE2 -MDQGA1UEAxMtR2VvVHJ1c3QgUHJpbWFyeSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0 -eSAtIEcyMB4XDTA3MTEwNTAwMDAwMFoXDTM4MDExODIzNTk1OVowgZgxCzAJBgNV -BAYTAlVTMRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMTkwNwYDVQQLEzAoYykgMjAw -NyBHZW9UcnVzdCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxNjA0BgNV -BAMTLUdlb1RydXN0IFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBH -MjB2MBAGByqGSM49AgEGBSuBBAAiA2IABBWx6P0DFUPlrOuHNxFi79KDNlJ9RVcL -So17VDs6bl8VAsBQps8lL33KSLjHUGMcKiEIfJo22Av+0SbFWDEwKCXzXV2juLal -tJLtbCyf691DiaI8S0iRHVDsJt/WYC69IaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAO -BgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFBVfNVdRVfslsq0DafwBo/q+EVXVMAoG -CCqGSM49BAMDA2cAMGQCMGSWWaboCd6LuvpaiIjwH5HTRqjySkwCY/tsXzjbLkGT -qQ7mndwxHLKgpxgceeHHNgIwOlavmnRs9vuD4DPTCF+hnMJbn0bWtsuRBmOiBucz -rD6ogRLQy7rQkgu2npaqBA+K ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIID/jCCAuagAwIBAgIQFaxulBmyeUtB9iepwxgPHzANBgkqhkiG9w0BAQsFADCB -mDELMAkGA1UEBhMCVVMxFjAUBgNVBAoTDUdlb1RydXN0IEluYy4xOTA3BgNVBAsT -MChjKSAyMDA4IEdlb1RydXN0IEluYy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25s -eTE2MDQGA1UEAxMtR2VvVHJ1c3QgUHJpbWFyeSBDZXJ0aWZpY2F0aW9uIEF1dGhv -cml0eSAtIEczMB4XDTA4MDQwMjAwMDAwMFoXDTM3MTIwMTIzNTk1OVowgZgxCzAJ -BgNVBAYTAlVTMRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMTkwNwYDVQQLEzAoYykg -MjAwOCBHZW9UcnVzdCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxNjA0 -BgNVBAMTLUdlb1RydXN0IFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkg -LSBHMzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANziXmJYHTNXOTIz -+uvLh4yn1ErdBojqZI4xmKU4kB6Yzy5jK/BGvESyiaHAKAxJcCGVn2TAppMSAmUm -hsalifD614SgcK9PGpc/BkTVyetyEH3kMSj7HGHmKAdEc5IiaacDiGydY8hS2pgn -5whMcD60yRLBxWeDXTPzAxHsatBT4tG6NmCUgLthY2xbF37fQJQeqw3CIShwiP/W -JmxsYAQlTlV+fe+/lEjetx3dcI0FX4ilm/LC7urRQEFtYjgdVgbFA0dRIBn8exAL -DmKudlW/X3e+PkkBUz2YJQN2JFodtNuJ6nnltrM7P7pMKEF/BqxqjsHQ9gUdfeZC -huOl1UcCAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYw -HQYDVR0OBBYEFMR5yo6hTgMdHNxr2zFblD4/MH8tMA0GCSqGSIb3DQEBCwUAA4IB -AQAtxRPPVoB7eni9n64smefv2t+UXglpp+duaIy9cr5HqQ6XErhK8WTTOd8lNNTB -zU6B8A8ExCSzNJbGpqow32hhc9f5joWJ7w5elShKKiePEI4ufIbEAp7aDHdlDkQN -kv39sxY2+hENHYwOB4lqKVb3cvTdFZx3NWZXqxNT2I7BQMXXExZacse3aQHEerGD -AWh9jUGhlBjBJVz88P6DAod8DQ3PLghcSkANPuyBYeYk28rgDi0Hsj5W3I31QYUH -SJsMC8tJP33st/3LjWeJGqvtux6jAAgIFyqCXDFdRootD4abdNlF+9RAsXqqaC2G -spki4cErx5z481+oghLrGREt ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIFaDCCA1CgAwIBAgIBATANBgkqhkiG9w0BAQUFADBFMQswCQYDVQQGEwJVUzEW -MBQGA1UEChMNR2VvVHJ1c3QgSW5jLjEeMBwGA1UEAxMVR2VvVHJ1c3QgVW5pdmVy -c2FsIENBMB4XDTA0MDMwNDA1MDAwMFoXDTI5MDMwNDA1MDAwMFowRTELMAkGA1UE -BhMCVVMxFjAUBgNVBAoTDUdlb1RydXN0IEluYy4xHjAcBgNVBAMTFUdlb1RydXN0 -IFVuaXZlcnNhbCBDQTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAKYV -VaCjxuAfjJ0hUNfBvitbtaSeodlyWL0AG0y/YckUHUWCq8YdgNY96xCcOq9tJPi8 -cQGeBvV8Xx7BDlXKg5pZMK4ZyzBIle0iN430SppyZj6tlcDgFgDgEB8rMQ7XlFTT -QjOgNB0eRXbdT8oYN+yFFXoZCPzVx5zw8qkuEKmS5j1YPakWaDwvdSEYfyh3peFh -F7em6fgemdtzbvQKoiFs7tqqhZJmr/Z6a4LauiIINQ/PQvE1+mrufislzDoR5G2v -c7J2Ha3QsnhnGqQ5HFELZ1aD/ThdDc7d8Lsrlh/eezJS/R27tQahsiFepdaVaH/w -mZ7cRQg+59IJDTWU3YBOU5fXtQlEIGQWFwMCTFMNaN7VqnJNk22CDtucvc+081xd -VHppCZbW2xHBjXWotM85yM48vCR85mLK4b19p71XZQvk/iXttmkQ3CgaRr0BHdCX -teGYO8A3ZNY9lO4L4fUorgtWv3GLIylBjobFS1J72HGrH4oVpjuDWtdYAVHGTEHZ -f9hBZ3KiKN9gg6meyHv8U3NyWfWTehd2Ds735VzZC1U0oqpbtWpU5xPKV+yXbfRe -Bi9Fi1jUIxaS5BZuKGNZMN9QAZxjiRqf2xeUgnA3wySemkfWWspOqGmJch+RbNt+ -nhutxx9z3SxPGWX9f5NAEC7S8O08ni4oPmkmM8V7AgMBAAGjYzBhMA8GA1UdEwEB -/wQFMAMBAf8wHQYDVR0OBBYEFNq7LqqwDLiIJlF0XG0D08DYj3rWMB8GA1UdIwQY -MBaAFNq7LqqwDLiIJlF0XG0D08DYj3rWMA4GA1UdDwEB/wQEAwIBhjANBgkqhkiG -9w0BAQUFAAOCAgEAMXjmx7XfuJRAyXHEqDXsRh3ChfMoWIawC/yOsjmPRFWrZIRc -aanQmjg8+uUfNeVE44B5lGiku8SfPeE0zTBGi1QrlaXv9z+ZhP015s8xxtxqv6fX -IwjhmF7DWgh2qaavdy+3YL1ERmrvl/9zlcGO6JP7/TG37FcREUWbMPEaiDnBTzyn -ANXH/KttgCJwpQzgXQQpAvvLoJHRfNbDflDVnVi+QTjruXU8FdmbyUqDWcDaU/0z -uzYYm4UPFd3uLax2k7nZAY1IEKj79TiG8dsKxr2EoyNB3tZ3b4XUhRxQ4K5RirqN -Pnbiucon8l+f725ZDQbYKxek0nxru18UGkiPGkzns0ccjkxFKyDuSN/n3QmOGKja -QI2SJhFTYXNd673nxE0pN2HrrDktZy4W1vUAg4WhzH92xH3kt0tm7wNFYGm2DFKW -koRepqO1pD4r2czYG0eq8kTaT/kD6PAUyz/zg97QwVTjt+gKN02LIFkDMBmhLMi9 -ER/frslKxfMnZmaGrGiR/9nmUxwPi1xpZQomyB40w11Re9epnAahNt3ViZS82eQt -DF4JbAiXfKM9fJP/P6EUp8+1Xevb2xzEdt+Iub1FBZUbrvxGakyvSOPOrg/Sfuvm -bJxPgWp6ZKy7PtXny3YuxadIwVyQD8vIP/rmMuGNG2+k5o7Y+SlIis5z/iw= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIFbDCCA1SgAwIBAgIBATANBgkqhkiG9w0BAQUFADBHMQswCQYDVQQGEwJVUzEW -MBQGA1UEChMNR2VvVHJ1c3QgSW5jLjEgMB4GA1UEAxMXR2VvVHJ1c3QgVW5pdmVy -c2FsIENBIDIwHhcNMDQwMzA0MDUwMDAwWhcNMjkwMzA0MDUwMDAwWjBHMQswCQYD -VQQGEwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5jLjEgMB4GA1UEAxMXR2VvVHJ1 -c3QgVW5pdmVyc2FsIENBIDIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoIC -AQCzVFLByT7y2dyxUxpZKeexw0Uo5dfR7cXFS6GqdHtXr0om/Nj1XqduGdt0DE81 -WzILAePb63p3NeqqWuDW6KFXlPCQo3RWlEQwAx5cTiuFJnSCegx2oG9NzkEtoBUG -FF+3Qs17j1hhNNwqCPkuwwGmIkQcTAeC5lvO0Ep8BNMZcyfwqph/Lq9O64ceJHdq -XbboW0W63MOhBW9Wjo8QJqVJwy7XQYci4E+GymC16qFjwAGXEHm9ADwSbSsVsaxL -se4YuU6W3Nx2/zu+z18DwPw76L5GG//aQMJS9/7jOvdqdzXQ2o3rXhhqMcceujwb -KNZrVMaqW9eiLBsZzKIC9ptZvTdrhrVtgrrY6slWvKk2WP0+GfPtDCapkzj4T8Fd -IgbQl+rhrcZV4IErKIM6+vR7IVEAvlI4zs1meaj0gVbi0IMJR1FbUGrP20gaXT73 -y/Zl92zxlfgCOzJWgjl6W70viRu/obTo/3+NjN8D8WBOWBFM66M/ECuDmgFz2ZRt -hAAnZqzwcEAJQpKtT5MNYQlRJNiS1QuUYbKHsu3/mjX/hVTK7URDrBs8FmtISgoc -QIgfksILAAX/8sgCSqSqqcyZlpwvWOB94b67B9xfBHJcMTTD7F8t4D1kkCLm0ey4 -Lt1ZrtmhN79UNdxzMk+MBB4zsslG8dhcyFVQyWi9qLo2CQIDAQABo2MwYTAPBgNV -HRMBAf8EBTADAQH/MB0GA1UdDgQWBBR281Xh+qQ2+/CfXGJx7Tz0RzgQKzAfBgNV -HSMEGDAWgBR281Xh+qQ2+/CfXGJx7Tz0RzgQKzAOBgNVHQ8BAf8EBAMCAYYwDQYJ -KoZIhvcNAQEFBQADggIBAGbBxiPz2eAubl/oz66wsCVNK/g7WJtAJDday6sWSf+z -dXkzoS9tcBc0kf5nfo/sm+VegqlVHy/c1FEHEv6sFj4sNcZj/NwQ6w2jqtB8zNHQ -L1EuxBRa3ugZ4T7GzKQp5y6EqgYweHZUcyiYWTjgAA1i00J9IZ+uPTqM1fp3DRgr -Fg5fNuH8KrUwJM/gYwx7WBr+mbpCErGR9Hxo4sjoryzqyX6uuyo9DRXcNJW2GHSo -ag/HtPQTxORb7QrSpJdMKu0vbBKJPfEncKpqA1Ihn0CoZ1Dy81of398j9tx4TuaY -T1U6U+Pv8vSfx3zYWK8pIpe44L2RLrB27FcRz+8pRPPphXpgY+RdM4kX2TGq2tbz -GDVyz4crL2MjhF2EjD9XoIj8mZEoJmmZ1I+XRL6O1UixpCgp8RW04eWe3fiPpm8m -1wk8OhwRDqZsN/etRIcsKMfYdIKz0G9KV7s1KSegi+ghp4dkNl3M2Basx7InQJJV -OCiNUW7dFGdTbHFcJoRNdVq2fmBWqU2t+5sel/MN2dKXVHfaPRK34B7vCAas+YWH -6aLcr34YEoP9VhdBLtUpgn2Z9DH2canPLAEnpQW5qrJITirvn5NSUZU8UnOOVkwX -QMAJKOSLakhT2+zNVVXxxvjpoixMptEmX36vWkzaH6byHCx+rgIW0lbQL1dTR+iS ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIB4TCCAYegAwIBAgIRKjikHJYKBN5CsiilC+g0mAIwCgYIKoZIzj0EAwIwUDEk -MCIGA1UECxMbR2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI0MRMwEQYDVQQKEwpH -bG9iYWxTaWduMRMwEQYDVQQDEwpHbG9iYWxTaWduMB4XDTEyMTExMzAwMDAwMFoX -DTM4MDExOTAzMTQwN1owUDEkMCIGA1UECxMbR2xvYmFsU2lnbiBFQ0MgUm9vdCBD -QSAtIFI0MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQDEwpHbG9iYWxTaWdu -MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEuMZ5049sJQ6fLjkZHAOkrprlOQcJ -FspjsbmG+IpXwVfOQvpzofdlQv8ewQCybnMO/8ch5RikqtlxP6jUuc6MHaNCMEAw -DgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFFSwe61F -uOJAf/sKbvu+M8k8o4TVMAoGCCqGSM49BAMCA0gAMEUCIQDckqGgE6bPA7DmxCGX -kPoUVy0D7O48027KqGx2vKLeuwIgJ6iFJzWbVsaj8kfSt24bAgAXqmemFZHe+pTs -ewv4n4Q= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIICHjCCAaSgAwIBAgIRYFlJ4CYuu1X5CneKcflK2GwwCgYIKoZIzj0EAwMwUDEk -MCIGA1UECxMbR2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI1MRMwEQYDVQQKEwpH -bG9iYWxTaWduMRMwEQYDVQQDEwpHbG9iYWxTaWduMB4XDTEyMTExMzAwMDAwMFoX -DTM4MDExOTAzMTQwN1owUDEkMCIGA1UECxMbR2xvYmFsU2lnbiBFQ0MgUm9vdCBD -QSAtIFI1MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQDEwpHbG9iYWxTaWdu -MHYwEAYHKoZIzj0CAQYFK4EEACIDYgAER0UOlvt9Xb/pOdEh+J8LttV7HpI6SFkc -8GIxLcB6KP4ap1yztsyX50XUWPrRd21DosCHZTQKH3rd6zwzocWdTaRvQZU4f8ke -hOvRnkmSh5SHDDqFSmafnVmTTZdhBoZKo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYD -VR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUPeYpSJvqB8ohREom3m7e0oPQn1kwCgYI -KoZIzj0EAwMDaAAwZQIxAOVpEslu28YxuglB4Zf4+/2a4n0Sye18ZNPLBSWLVtmg -515dTguDnFt2KaAJJiFqYgIwcdK1j1zqO+F4CYWodZI7yFz9SO8NdCKoCOJuxUnO -xwy8p2Fp8fc74SrL+SvzZpA3 ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDdTCCAl2gAwIBAgILBAAAAAABFUtaw5QwDQYJKoZIhvcNAQEFBQAwVzELMAkG -A1UEBhMCQkUxGTAXBgNVBAoTEEdsb2JhbFNpZ24gbnYtc2ExEDAOBgNVBAsTB1Jv -b3QgQ0ExGzAZBgNVBAMTEkdsb2JhbFNpZ24gUm9vdCBDQTAeFw05ODA5MDExMjAw -MDBaFw0yODAxMjgxMjAwMDBaMFcxCzAJBgNVBAYTAkJFMRkwFwYDVQQKExBHbG9i -YWxTaWduIG52LXNhMRAwDgYDVQQLEwdSb290IENBMRswGQYDVQQDExJHbG9iYWxT -aWduIFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDaDuaZ -jc6j40+Kfvvxi4Mla+pIH/EqsLmVEQS98GPR4mdmzxzdzxtIK+6NiY6arymAZavp -xy0Sy6scTHAHoT0KMM0VjU/43dSMUBUc71DuxC73/OlS8pF94G3VNTCOXkNz8kHp -1Wrjsok6Vjk4bwY8iGlbKk3Fp1S4bInMm/k8yuX9ifUSPJJ4ltbcdG6TRGHRjcdG -snUOhugZitVtbNV4FpWi6cgKOOvyJBNPc1STE4U6G7weNLWLBYy5d4ux2x8gkasJ -U26Qzns3dLlwR5EiUWMWea6xrkEmCMgZK9FGqkjWZCrXgzT/LCrBbBlDSgeF59N8 -9iFo7+ryUp9/k5DPAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8E -BTADAQH/MB0GA1UdDgQWBBRge2YaRQ2XyolQL30EzTSo//z9SzANBgkqhkiG9w0B -AQUFAAOCAQEA1nPnfE920I2/7LqivjTFKDK1fPxsnCwrvQmeU79rXqoRSLblCKOz -yj1hTdNGCbM+w6DjY1Ub8rrvrTnhQ7k4o+YviiY776BQVvnGCv04zcQLcFGUl5gE -38NflNUVyRRBnMRddWQVDf9VMOyGj/8N7yy5Y0b2qvzfvGn9LhJIZJrglfCm7ymP -AbEVtQwdpf5pLGkkeB6zpxxxYu7KyJesF12KwvhHhm4qxFYxldBniYUr+WymXUad -DKqC5JlR3XC321Y9YeRq4VzW9v493kHMB65jUr9TU/Qr6cf9tveCX4XSQRjbgbME -HMUfpIBvFSDJ3gyICh3WZlXi/EjJKSZp4A== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDujCCAqKgAwIBAgILBAAAAAABD4Ym5g0wDQYJKoZIhvcNAQEFBQAwTDEgMB4G -A1UECxMXR2xvYmFsU2lnbiBSb290IENBIC0gUjIxEzARBgNVBAoTCkdsb2JhbFNp -Z24xEzARBgNVBAMTCkdsb2JhbFNpZ24wHhcNMDYxMjE1MDgwMDAwWhcNMjExMjE1 -MDgwMDAwWjBMMSAwHgYDVQQLExdHbG9iYWxTaWduIFJvb3QgQ0EgLSBSMjETMBEG -A1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2lnbjCCASIwDQYJKoZI -hvcNAQEBBQADggEPADCCAQoCggEBAKbPJA6+Lm8omUVCxKs+IVSbC9N/hHD6ErPL -v4dfxn+G07IwXNb9rfF73OX4YJYJkhD10FPe+3t+c4isUoh7SqbKSaZeqKeMWhG8 -eoLrvozps6yWJQeXSpkqBy+0Hne/ig+1AnwblrjFuTosvNYSuetZfeLQBoZfXklq -tTleiDTsvHgMCJiEbKjNS7SgfQx5TfC4LcshytVsW33hoCmEofnTlEnLJGKRILzd -C9XZzPnqJworc5HGnRusyMvo4KD0L5CLTfuwNhv2GXqF4G3yYROIXJ/gkwpRl4pa -zq+r1feqCapgvdzZX99yqWATXgAByUr6P6TqBwMhAo6CygPCm48CAwEAAaOBnDCB -mTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUm+IH -V2ccHsBqBt5ZtJot39wZhi4wNgYDVR0fBC8wLTAroCmgJ4YlaHR0cDovL2NybC5n -bG9iYWxzaWduLm5ldC9yb290LXIyLmNybDAfBgNVHSMEGDAWgBSb4gdXZxwewGoG -3lm0mi3f3BmGLjANBgkqhkiG9w0BAQUFAAOCAQEAmYFThxxol4aR7OBKuEQLq4Gs -J0/WwbgcQ3izDJr86iw8bmEbTUsp9Z8FHSbBuOmDAGJFtqkIk7mpM0sYmsL4h4hO -291xNBrBVNpGP+DTKqttVCL1OmLNIG+6KYnX3ZHu01yiPqFbQfXf5WRDLenVOavS -ot+3i9DAgBkcRcAtjOj4LaR0VknFBbVPFd5uRHg5h6h+u/N5GJG79G+dwfCMNYxd -AfvDbbnvRG15RjF+Cv6pgsH/76tuIMRQyV+dTZsXjAzlAcmgQWpzU/qlULRuJQ/7 -TBj0/VLZjmmx6BEP3ojY+x1J96relc8geMJgEtslQIxq/H5COEBkEveegeGTLg== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDXzCCAkegAwIBAgILBAAAAAABIVhTCKIwDQYJKoZIhvcNAQELBQAwTDEgMB4G -A1UECxMXR2xvYmFsU2lnbiBSb290IENBIC0gUjMxEzARBgNVBAoTCkdsb2JhbFNp -Z24xEzARBgNVBAMTCkdsb2JhbFNpZ24wHhcNMDkwMzE4MTAwMDAwWhcNMjkwMzE4 -MTAwMDAwWjBMMSAwHgYDVQQLExdHbG9iYWxTaWduIFJvb3QgQ0EgLSBSMzETMBEG -A1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2lnbjCCASIwDQYJKoZI -hvcNAQEBBQADggEPADCCAQoCggEBAMwldpB5BngiFvXAg7aEyiie/QV2EcWtiHL8 -RgJDx7KKnQRfJMsuS+FggkbhUqsMgUdwbN1k0ev1LKMPgj0MK66X17YUhhB5uzsT -gHeMCOFJ0mpiLx9e+pZo34knlTifBtc+ycsmWQ1z3rDI6SYOgxXG71uL0gRgykmm -KPZpO/bLyCiR5Z2KYVc3rHQU3HTgOu5yLy6c+9C7v/U9AOEGM+iCK65TpjoWc4zd -QQ4gOsC0p6Hpsk+QLjJg6VfLuQSSaGjlOCZgdbKfd/+RFO+uIEn8rUAVSNECMWEZ -XriX7613t2Saer9fwRPvm2L7DWzgVGkWqQPabumDk3F2xmmFghcCAwEAAaNCMEAw -DgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFI/wS3+o -LkUkrk1Q+mOai97i3Ru8MA0GCSqGSIb3DQEBCwUAA4IBAQBLQNvAUKr+yAzv95ZU -RUm7lgAJQayzE4aGKAczymvmdLm6AC2upArT9fHxD4q/c2dKg8dEe3jgr25sbwMp -jjM5RcOO5LlXbKr8EpbsU8Yt5CRsuZRj+9xTaGdWPoO4zzUhw8lo/s7awlOqzJCK -6fBdRoyV3XpYKBovHd7NADdBj+1EbddTKJd+82cEHhXXipa0095MJ6RMG3NzdvQX -mcIfeg7jLQitChws/zyrVQ4PkX4268NXSb7hLi18YIvDQVETI53O9zJrlAGomecs -Mx86OyXShkDOOyyGeMlhLxS67ttVb9+E7gUJTb0o2HLO02JQZR7rkpeDMdmztcpH -WD9f ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIHSTCCBTGgAwIBAgIJAMnN0+nVfSPOMA0GCSqGSIb3DQEBBQUAMIGsMQswCQYD -VQQGEwJFVTFDMEEGA1UEBxM6TWFkcmlkIChzZWUgY3VycmVudCBhZGRyZXNzIGF0 -IHd3dy5jYW1lcmZpcm1hLmNvbS9hZGRyZXNzKTESMBAGA1UEBRMJQTgyNzQzMjg3 -MRswGQYDVQQKExJBQyBDYW1lcmZpcm1hIFMuQS4xJzAlBgNVBAMTHkdsb2JhbCBD -aGFtYmVyc2lnbiBSb290IC0gMjAwODAeFw0wODA4MDExMjMxNDBaFw0zODA3MzEx -MjMxNDBaMIGsMQswCQYDVQQGEwJFVTFDMEEGA1UEBxM6TWFkcmlkIChzZWUgY3Vy -cmVudCBhZGRyZXNzIGF0IHd3dy5jYW1lcmZpcm1hLmNvbS9hZGRyZXNzKTESMBAG -A1UEBRMJQTgyNzQzMjg3MRswGQYDVQQKExJBQyBDYW1lcmZpcm1hIFMuQS4xJzAl -BgNVBAMTHkdsb2JhbCBDaGFtYmVyc2lnbiBSb290IC0gMjAwODCCAiIwDQYJKoZI -hvcNAQEBBQADggIPADCCAgoCggIBAMDfVtPkOpt2RbQT2//BthmLN0EYlVJH6xed -KYiONWwGMi5HYvNJBL99RDaxccy9Wglz1dmFRP+RVyXfXjaOcNFccUMd2drvXNL7 -G706tcuto8xEpw2uIRU/uXpbknXYpBI4iRmKt4DS4jJvVpyR1ogQC7N0ZJJ0YPP2 -zxhPYLIj0Mc7zmFLmY/CDNBAspjcDahOo7kKrmCgrUVSY7pmvWjg+b4aqIG7HkF4 -ddPB/gBVsIdU6CeQNR1MM62X/JcumIS/LMmjv9GYERTtY/jKmIhYF5ntRQOXfjyG -HoiMvvKRhI9lNNgATH23MRdaKXoKGCQwoze1eqkBfSbW+Q6OWfH9GzO1KTsXO0G2 -Id3UwD2ln58fQ1DJu7xsepeY7s2MH/ucUa6LcL0nn3HAa6x9kGbo1106DbDVwo3V -yJ2dwW3Q0L9R5OP4wzg2rtandeavhENdk5IMagfeOx2YItaswTXbo6Al/3K1dh3e -beksZixShNBFks4c5eUzHdwHU1SjqoI7mjcv3N2gZOnm3b2u/GSFHTynyQbehP9r -6GsaPMWis0L7iwk+XwhSx2LE1AVxv8Rk5Pihg+g+EpuoHtQ2TS9x9o0o9oOpE9Jh -wZG7SMA0j0GMS0zbaRL/UJScIINZc+18ofLx/d33SdNDWKBWY8o9PeU1VlnpDsog -zCtLkykPAgMBAAGjggFqMIIBZjASBgNVHRMBAf8ECDAGAQH/AgEMMB0GA1UdDgQW -BBS5CcqcHtvTbDprru1U8VuTBjUuXjCB4QYDVR0jBIHZMIHWgBS5CcqcHtvTbDpr -ru1U8VuTBjUuXqGBsqSBrzCBrDELMAkGA1UEBhMCRVUxQzBBBgNVBAcTOk1hZHJp -ZCAoc2VlIGN1cnJlbnQgYWRkcmVzcyBhdCB3d3cuY2FtZXJmaXJtYS5jb20vYWRk -cmVzcykxEjAQBgNVBAUTCUE4Mjc0MzI4NzEbMBkGA1UEChMSQUMgQ2FtZXJmaXJt -YSBTLkEuMScwJQYDVQQDEx5HbG9iYWwgQ2hhbWJlcnNpZ24gUm9vdCAtIDIwMDiC -CQDJzdPp1X0jzjAOBgNVHQ8BAf8EBAMCAQYwPQYDVR0gBDYwNDAyBgRVHSAAMCow -KAYIKwYBBQUHAgEWHGh0dHA6Ly9wb2xpY3kuY2FtZXJmaXJtYS5jb20wDQYJKoZI -hvcNAQEFBQADggIBAICIf3DekijZBZRG/5BXqfEv3xoNa/p8DhxJJHkn2EaqbylZ -UohwEurdPfWbU1Rv4WCiqAm57OtZfMY18dwY6fFn5a+6ReAJ3spED8IXDneRRXoz -X1+WLGiLwUePmJs9wOzL9dWCkoQ10b42OFZyMVtHLaoXpGNR6woBrX/sdZ7LoR/x -fxKxueRkf2fWIyr0uDldmOghp+G9PUIadJpwr2hsUF1Jz//7Dl3mLEfXgTpZALVz -a2Mg9jFFCDkO9HB+QHBaP9BrQql0PSgvAm11cpUJjUhjxsYjV5KTXjXBjfkK9yyd -Yhz2rXzdpjEetrHHfoUm+qRqtdpjMNHvkzeyZi99Bffnt0uYlDXA2TopwZ2yUDMd -SqlapskD7+3056huirRXhOukP9DuqqqHW2Pok+JrqNS4cnhrG+055F3Lm6qH1U9O -AP7Zap88MQ8oAgF9mOinsKJknnn4SPIVqczmyETrP3iZ8ntxPjzxmKfFGBI/5rso -M0LpRQp8bfKGeS/Fghl9CYl8slR2iK7ewfPM4W7bMdaTrpmg7yVqc5iJWzouE4ge -v8CSlDQb4ye3ix5vQv/n6TebUB0tovkC7stYWDpxvGjjqsGvHCgfotwjZT+B6q6Z -09gwzxMNTxXJhLynSC34MCN32EZLeW32jO06f2ARePTpm67VVMB0gNELQp/B ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIEADCCAuigAwIBAgIBADANBgkqhkiG9w0BAQUFADBjMQswCQYDVQQGEwJVUzEh -MB8GA1UEChMYVGhlIEdvIERhZGR5IEdyb3VwLCBJbmMuMTEwLwYDVQQLEyhHbyBE -YWRkeSBDbGFzcyAyIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTA0MDYyOTE3 -MDYyMFoXDTM0MDYyOTE3MDYyMFowYzELMAkGA1UEBhMCVVMxITAfBgNVBAoTGFRo -ZSBHbyBEYWRkeSBHcm91cCwgSW5jLjExMC8GA1UECxMoR28gRGFkZHkgQ2xhc3Mg -MiBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCASAwDQYJKoZIhvcNAQEBBQADggEN -ADCCAQgCggEBAN6d1+pXGEmhW+vXX0iG6r7d/+TvZxz0ZWizV3GgXne77ZtJ6XCA -PVYYYwhv2vLM0D9/AlQiVBDYsoHUwHU9S3/Hd8M+eKsaA7Ugay9qK7HFiH7Eux6w -wdhFJ2+qN1j3hybX2C32qRe3H3I2TqYXP2WYktsqbl2i/ojgC95/5Y0V4evLOtXi -EqITLdiOr18SPaAIBQi2XKVlOARFmR6jYGB0xUGlcmIbYsUfb18aQr4CUWWoriMY -avx4A6lNf4DD+qta/KFApMoZFv6yyO9ecw3ud72a9nmYvLEHZ6IVDd2gWMZEewo+ -YihfukEHU1jPEX44dMX4/7VpkI+EdOqXG68CAQOjgcAwgb0wHQYDVR0OBBYEFNLE -sNKR1EwRcbNhyz2h/t2oatTjMIGNBgNVHSMEgYUwgYKAFNLEsNKR1EwRcbNhyz2h -/t2oatTjoWekZTBjMQswCQYDVQQGEwJVUzEhMB8GA1UEChMYVGhlIEdvIERhZGR5 -IEdyb3VwLCBJbmMuMTEwLwYDVQQLEyhHbyBEYWRkeSBDbGFzcyAyIENlcnRpZmlj -YXRpb24gQXV0aG9yaXR5ggEAMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQAD -ggEBADJL87LKPpH8EsahB4yOd6AzBhRckB4Y9wimPQoZ+YeAEW5p5JYXMP80kWNy -OO7MHAGjHZQopDH2esRU1/blMVgDoszOYtuURXO1v0XJJLXVggKtI3lpjbi2Tc7P -TMozI+gciKqdi0FuFskg5YmezTvacPd+mSYgFFQlq25zheabIZ0KbIIOqPjCDPoQ -HmyW74cNxA9hi63ugyuV+I6ShHI56yDqg+2DzZduCLzrTia2cyvk0/ZM/iZx4mER -dEr/VxqHD3VILs9RaRegAhJhldXRQLIQTO7ErBBDpqWeCtWVYpoNz4iCxTIM5Cuf -ReYNnyicsbkqWletNw+vHX/bvZ8= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDxTCCAq2gAwIBAgIBADANBgkqhkiG9w0BAQsFADCBgzELMAkGA1UEBhMCVVMx -EDAOBgNVBAgTB0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxGjAYBgNVBAoT -EUdvRGFkZHkuY29tLCBJbmMuMTEwLwYDVQQDEyhHbyBEYWRkeSBSb290IENlcnRp -ZmljYXRlIEF1dGhvcml0eSAtIEcyMB4XDTA5MDkwMTAwMDAwMFoXDTM3MTIzMTIz -NTk1OVowgYMxCzAJBgNVBAYTAlVTMRAwDgYDVQQIEwdBcml6b25hMRMwEQYDVQQH -EwpTY290dHNkYWxlMRowGAYDVQQKExFHb0RhZGR5LmNvbSwgSW5jLjExMC8GA1UE -AxMoR28gRGFkZHkgUm9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgLSBHMjCCASIw -DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAL9xYgjx+lk09xvJGKP3gElY6SKD -E6bFIEMBO4Tx5oVJnyfq9oQbTqC023CYxzIBsQU+B07u9PpPL1kwIuerGVZr4oAH -/PMWdYA5UXvl+TW2dE6pjYIT5LY/qQOD+qK+ihVqf94Lw7YZFAXK6sOoBJQ7Rnwy -DfMAZiLIjWltNowRGLfTshxgtDj6AozO091GB94KPutdfMh8+7ArU6SSYmlRJQVh -GkSBjCypQ5Yj36w6gZoOKcUcqeldHraenjAKOc7xiID7S13MMuyFYkMlNAJWJwGR -tDtwKj9useiciAF9n9T521NtYJ2/LOdYq7hfRvzOxBsDPAnrSTFcaUaz4EcCAwEA -AaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYE -FDqahQcQZyi27/a9BUFuIMGU2g/eMA0GCSqGSIb3DQEBCwUAA4IBAQCZ21151fmX -WWcDYfF+OwYxdS2hII5PZYe096acvNjpL9DbWu7PdIxztDhC2gV7+AJ1uP2lsdeu -9tfeE8tTEH6KRtGX+rcuKxGrkLAngPnon1rpN5+r5N9ss4UXnT3ZJE95kTXWXwTr -gIOrmgIttRD02JDHBHNA7XIloKmf7J6raBKZV8aPEjoJpL1E/QYVN8Gb5DKj7Tjo -2GTzLH4U/ALqn83/B2gX2yKQOC16jdFU8WnjXzPKej17CuPKf1855eJ1usV2GDPO -LPAvTK33sefOT6jEm0pUBsV/fdUID+Ic/n4XuKxe9tQWskMJDE32p2u0mYRlynqI -4uJEvlz36hz1 ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIEMTCCAxmgAwIBAgIBADANBgkqhkiG9w0BAQUFADCBlTELMAkGA1UEBhMCR1Ix -RDBCBgNVBAoTO0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1 -dGlvbnMgQ2VydC4gQXV0aG9yaXR5MUAwPgYDVQQDEzdIZWxsZW5pYyBBY2FkZW1p -YyBhbmQgUmVzZWFyY2ggSW5zdGl0dXRpb25zIFJvb3RDQSAyMDExMB4XDTExMTIw -NjEzNDk1MloXDTMxMTIwMTEzNDk1MlowgZUxCzAJBgNVBAYTAkdSMUQwQgYDVQQK -EztIZWxsZW5pYyBBY2FkZW1pYyBhbmQgUmVzZWFyY2ggSW5zdGl0dXRpb25zIENl -cnQuIEF1dGhvcml0eTFAMD4GA1UEAxM3SGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJl -c2VhcmNoIEluc3RpdHV0aW9ucyBSb290Q0EgMjAxMTCCASIwDQYJKoZIhvcNAQEB -BQADggEPADCCAQoCggEBAKlTAOMupvaO+mDYLZU++CwqVE7NuYRhlFhPjz2L5EPz -dYmNUeTDN9KKiE15HrcS3UN4SoqS5tdI1Q+kOilENbgH9mgdVc04UfCMJDGFr4PJ -fel3r+0ae50X+bOdOFAPplp5kYCvN66m0zH7tSYJnTxa71HFK9+WXesyHgLacEns -bgzImjeN9/E2YEsmLIKe0HjzDQ9jpFEw4fkrJxIH2Oq9GGKYsFk3fb7u8yBRQlqD -75O6aRXxYp2fmTmCobd0LovUxQt7L/DICto9eQqakxylKHJzkUOap9FNhYS5qXSP -FEDH3N6sQWRstBmbAmNtJGSPRLIl6s5ddAxjMlyNh+UCAwEAAaOBiTCBhjAPBgNV -HRMBAf8EBTADAQH/MAsGA1UdDwQEAwIBBjAdBgNVHQ4EFgQUppFC/RNhSiOeCKQp -5dgTBCPuQSUwRwYDVR0eBEAwPqA8MAWCAy5ncjAFggMuZXUwBoIELmVkdTAGggQu -b3JnMAWBAy5ncjAFgQMuZXUwBoEELmVkdTAGgQQub3JnMA0GCSqGSIb3DQEBBQUA -A4IBAQAf73lB4XtuP7KMhjdCSk4cNx6NZrokgclPEg8hwAOXhiVtXdMiKahsog2p -6z0GW5k6x8zDmjR/qw7IThzh+uTczQ2+vyT+bOdrwg3IBp5OjWEopmr95fZi6hg8 -TqBTnbI6nOulnJEWtk2C4AwFSKls9cz4y51JtPACpf1wA+2KIaWuE4ZJwzNzvoc7 -dIsXRSZMFpGD/md9zU1jZ/rzAxKWeAaNsWftjj++n08C9bMJL/NMh98qy5V8Acys -Nnq/onN694/BtZqhFLKPM58N7yLcZnuEvUUXBj08yrl3NI/K6s8/MT7jiOOASSXI -l7WdmplNsDz4SgCbZN2fOUvRJ9e4 ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDMDCCAhigAwIBAgICA+gwDQYJKoZIhvcNAQEFBQAwRzELMAkGA1UEBhMCSEsx -FjAUBgNVBAoTDUhvbmdrb25nIFBvc3QxIDAeBgNVBAMTF0hvbmdrb25nIFBvc3Qg -Um9vdCBDQSAxMB4XDTAzMDUxNTA1MTMxNFoXDTIzMDUxNTA0NTIyOVowRzELMAkG -A1UEBhMCSEsxFjAUBgNVBAoTDUhvbmdrb25nIFBvc3QxIDAeBgNVBAMTF0hvbmdr -b25nIFBvc3QgUm9vdCBDQSAxMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKC -AQEArP84tulmAknjorThkPlAj3n54r15/gK97iSSHSL22oVyaf7XPwnU3ZG1ApzQ -jVrhVcNQhrkpJsLj2aDxaQMoIIBFIi1WpztUlVYiWR8o3x8gPW2iNr4joLFutbEn -PzlTCeqrauh0ssJlXI6/fMN4hM2eFvz1Lk8gKgifd/PFHsSaUmYeSF7jEAaPIpjh -ZY4bXSNmO7ilMlHIhqqhqZ5/dpTCpmy3QfDVyAY45tQM4vM7TG1QjMSDJ8EThFk9 -nnV0ttgCXjqQesBCNnLsak3c78QA3xMYV18meMjWCnl3v/evt3a5pQuEF10Q6m/h -q5URX208o1xNg1vysxmKgIsLhwIDAQABoyYwJDASBgNVHRMBAf8ECDAGAQH/AgED -MA4GA1UdDwEB/wQEAwIBxjANBgkqhkiG9w0BAQUFAAOCAQEADkbVPK7ih9legYsC -mEEIjEy82tvuJxuC52pF7BaLT4Wg87JwvVqWuspube5Gi27nKi6Wsxkz67SfqLI3 -7piol7Yutmcn1KZJ/RyTZXaeQi/cImyaT/JaFTmxcdcrUehtHJjA2Sr0oYJ71clB -oiMBdDhViw+5LmeiIAQ32pwL0xch4I+XeTRvhEgCIDMb5jREn5Fw9IBehEPCKdJs -EhTkYY2sEJCehFC78JZvRZ+K88psT/oROhUVRsPNH4NbLUES7VBnQRM9IauUiqpO -fMGx+6fWtScvl6tu4B3i0RwsH0Ti/L6RoZz71ilTc4afU9hDDl3WY4JxHYB0yvbi -AmvZWg== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIEAjCCAuqgAwIBAgIFORFFEJQwDQYJKoZIhvcNAQEFBQAwgYUxCzAJBgNVBAYT -AkZSMQ8wDQYDVQQIEwZGcmFuY2UxDjAMBgNVBAcTBVBhcmlzMRAwDgYDVQQKEwdQ -TS9TR0ROMQ4wDAYDVQQLEwVEQ1NTSTEOMAwGA1UEAxMFSUdDL0ExIzAhBgkqhkiG -9w0BCQEWFGlnY2FAc2dkbi5wbS5nb3V2LmZyMB4XDTAyMTIxMzE0MjkyM1oXDTIw -MTAxNzE0MjkyMlowgYUxCzAJBgNVBAYTAkZSMQ8wDQYDVQQIEwZGcmFuY2UxDjAM -BgNVBAcTBVBhcmlzMRAwDgYDVQQKEwdQTS9TR0ROMQ4wDAYDVQQLEwVEQ1NTSTEO -MAwGA1UEAxMFSUdDL0ExIzAhBgkqhkiG9w0BCQEWFGlnY2FAc2dkbi5wbS5nb3V2 -LmZyMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsh/R0GLFMzvABIaI -s9z4iPf930Pfeo2aSVz2TqrMHLmh6yeJ8kbpO0px1R2OLc/mratjUMdUC24SyZA2 -xtgv2pGqaMVy/hcKshd+ebUyiHDKcMCWSo7kVc0dJ5S/znIq7Fz5cyD+vfcuiWe4 -u0dzEvfRNWk68gq5rv9GQkaiv6GFGvm/5P9JhfejcIYyHF2fYPepraX/z9E0+X1b -F8bc1g4oa8Ld8fUzaJ1O/Id8NhLWo4DoQw1VYZTqZDdH6nfK0LJYBcNdfrGoRpAx -Vs5wKpayMLh35nnAvSk7/ZR3TL0gzUEl4C7HG7vupARB0l2tEmqKm0f7yd1GQOGd -PDPQtQIDAQABo3cwdTAPBgNVHRMBAf8EBTADAQH/MAsGA1UdDwQEAwIBRjAVBgNV -HSAEDjAMMAoGCCqBegF5AQEBMB0GA1UdDgQWBBSjBS8YYFDCiQrdKyFP/45OqDAx -NjAfBgNVHSMEGDAWgBSjBS8YYFDCiQrdKyFP/45OqDAxNjANBgkqhkiG9w0BAQUF -AAOCAQEABdwm2Pp3FURo/C9mOnTgXeQp/wYHE4RKq89toB9RlPhJy3Q2FLwV3duJ -L92PoF189RLrn544pEfMs5bZvpwlqwN+Mw+VgQ39FuCIvjfwbF3QMZsyK10XZZOY -YLxuj7GoPB7ZHPOpJkL5ZB3C55L29B5aqhlSXa/oovdgoPaN8In1buAKBQGVyYsg -Crpa/JosPL3Dt8ldeCUFP1YUmwza+zpI/pdpXsoQhvdOlgQITeywvl3cO45Pwf2a -NjSaTFR+FwNIlQgRHAdvhQh+XU3Endv7rs6y0bO4g2wdsrN58dhwmX7wEwLOXt1R -0982gaEbeC9xs/FZTEYYKKuF0mBWWg== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIFYDCCA0igAwIBAgIQCgFCgAAAAUUjyES1AAAAAjANBgkqhkiG9w0BAQsFADBK -MQswCQYDVQQGEwJVUzESMBAGA1UEChMJSWRlblRydXN0MScwJQYDVQQDEx5JZGVu -VHJ1c3QgQ29tbWVyY2lhbCBSb290IENBIDEwHhcNMTQwMTE2MTgxMjIzWhcNMzQw -MTE2MTgxMjIzWjBKMQswCQYDVQQGEwJVUzESMBAGA1UEChMJSWRlblRydXN0MScw -JQYDVQQDEx5JZGVuVHJ1c3QgQ29tbWVyY2lhbCBSb290IENBIDEwggIiMA0GCSqG -SIb3DQEBAQUAA4ICDwAwggIKAoICAQCnUBneP5k91DNG8W9RYYKyqU+PZ4ldhNlT -3Qwo2dfw/66VQ3KZ+bVdfIrBQuExUHTRgQ18zZshq0PirK1ehm7zCYofWjK9ouuU -+ehcCuz/mNKvcbO0U59Oh++SvL3sTzIwiEsXXlfEU8L2ApeN2WIrvyQfYo3fw7gp -S0l4PJNgiCL8mdo2yMKi1CxUAGc1bnO/AljwpN3lsKImesrgNqUZFvX9t++uP0D1 -bVoE/c40yiTcdCMbXTMTEl3EASX2MN0CXZ/g1Ue9tOsbobtJSdifWwLziuQkkORi -T0/Br4sOdBeo0XKIanoBScy0RnnGF7HamB4HWfp1IYVl3ZBWzvurpWCdxJ35UrCL -vYf5jysjCiN2O/cz4ckA82n5S6LgTrx+kzmEB/dEcH7+B1rlsazRGMzyNeVJSQjK -Vsk9+w8YfYs7wRPCTY/JTw436R+hDmrfYi7LNQZReSzIJTj0+kuniVyc0uMNOYZK -dHzVWYfCP04MXFL0PfdSgvHqo6z9STQaKPNBiDoT7uje/5kdX7rL6B7yuVBgwDHT -c+XvvqDtMwt0viAgxGds8AgDelWAf0ZOlqf0Hj7h9tgJ4TNkK2PXMl6f+cB7D3hv -l7yTmvmcEpB4eoCHFddydJxVdHixuuFucAS6T6C6aMN7/zHwcz09lCqxC0EOoP5N -iGVreTO01wIDAQABo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB -/zAdBgNVHQ4EFgQU7UQZwNPwBovupHu+QucmVMiONnYwDQYJKoZIhvcNAQELBQAD -ggIBAA2ukDL2pkt8RHYZYR4nKM1eVO8lvOMIkPkp165oCOGUAFjvLi5+U1KMtlwH -6oi6mYtQlNeCgN9hCQCTrQ0U5s7B8jeUeLBfnLOic7iPBZM4zY0+sLj7wM+x8uwt -LRvM7Kqas6pgghstO8OEPVeKlh6cdbjTMM1gCIOQ045U8U1mwF10A0Cj7oV+wh93 -nAbowacYXVKV7cndJZ5t+qntozo00Fl72u1Q8zW/7esUTTHHYPTa8Yec4kjixsU3 -+wYQ+nVZZjFHKdp2mhzpgq7vmrlR94gjmmmVYjzlVYA211QC//G5Xc7UI2/YRYRK -W2XviQzdFKcgyxilJbQN+QHwotL0AMh0jqEqSI5l2xPE4iUXfeu+h1sXIFRRk0pT -AwvsXcoz7WL9RccvW9xYoIA55vrX/hMUpu09lEpCdNTDd1lzzY9GvlU47/rokTLq -l1gEIt44w8y8bckzOmoKaT+gyOpyj4xjhiO9bTyWnpXgSUyqorkqG5w2gXjtw+hG -4iZZRHUe2XWJUc0QhJ1hYMtd+ZciTY6Y5uN/9lu7rs3KSoFrXgvzUeF0K+l+J6fZ -mUlO+KWA2yUPHGNiiskzZ2s8EIPGrd6ozRaOjfAHN3Gf8qv8QfXBi+wAN10J5U6A -7/qxXDgGpRtK4dw4LTzcqx+QGtVKnO7RcGzM7vRX+Bi6hG6H ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIFZjCCA06gAwIBAgIQCgFCgAAAAUUjz0Z8AAAAAjANBgkqhkiG9w0BAQsFADBN -MQswCQYDVQQGEwJVUzESMBAGA1UEChMJSWRlblRydXN0MSowKAYDVQQDEyFJZGVu -VHJ1c3QgUHVibGljIFNlY3RvciBSb290IENBIDEwHhcNMTQwMTE2MTc1MzMyWhcN -MzQwMTE2MTc1MzMyWjBNMQswCQYDVQQGEwJVUzESMBAGA1UEChMJSWRlblRydXN0 -MSowKAYDVQQDEyFJZGVuVHJ1c3QgUHVibGljIFNlY3RvciBSb290IENBIDEwggIi -MA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC2IpT8pEiv6EdrCvsnduTyP4o7 -ekosMSqMjbCpwzFrqHd2hCa2rIFCDQjrVVi7evi8ZX3yoG2LqEfpYnYeEe4IFNGy -RBb06tD6Hi9e28tzQa68ALBKK0CyrOE7S8ItneShm+waOh7wCLPQ5CQ1B5+ctMlS -bdsHyo+1W/CD80/HLaXIrcuVIKQxKFdYWuSNG5qrng0M8gozOSI5Cpcu81N3uURF -/YTLNiCBWS2ab21ISGHKTN9T0a9SvESfqy9rg3LvdYDaBjMbXcjaY8ZNzaxmMc3R -3j6HEDbhuaR672BQssvKplbgN6+rNBM5Jeg5ZuSYeqoSmJxZZoY+rfGwyj4GD3vw -EUs3oERte8uojHH01bWRNszwFcYr3lEXsZdMUD2xlVl8BX0tIdUAvwFnol57plzy -9yLxkA2T26pEUWbMfXYD62qoKjgZl3YNa4ph+bz27nb9cCvdKTz4Ch5bQhyLVi9V -GxyhLrXHFub4qjySjmm2AcG1hp2JDws4lFTo6tyePSW8Uybt1as5qsVATFSrsrTZ -2fjXctscvG29ZV/viDUqZi/u9rNl8DONfJhBaUYPQxxp+pu10GFqzcpL2UyQRqsV -WaFHVCkugyhfHMKiq3IXAAaOReyL4jM9f9oZRORicsPfIsbyVtTdX5Vy7W1f90gD -W/3FKqD2cyOEEBsB5wIDAQABo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/ -BAUwAwEB/zAdBgNVHQ4EFgQU43HgntinQtnbcZFrlJPrw6PRFKMwDQYJKoZIhvcN -AQELBQADggIBAEf63QqwEZE4rU1d9+UOl1QZgkiHVIyqZJnYWv6IAcVYpZmxI1Qj -t2odIFflAWJBF9MJ23XLblSQdf4an4EKwt3X9wnQW3IV5B4Jaj0z8yGa5hV+rVHV -DRDtfULAj+7AmgjVQdZcDiFpboBhDhXAuM/FSRJSzL46zNQuOAXeNf0fb7iAaJg9 -TaDKQGXSc3z1i9kKlT/YPyNtGtEqJBnZhbMX73huqVjRI9PHE+1yJX9dsXNw0H8G -lwmEKYBhHfpe/3OsoOOJuBxxFcbeMX8S3OFtm6/n6J91eEyrRjuazr8FGF1NFTwW -mhlQBJqymm9li1JfPFgEKCXAZmExfrngdbkaqIHWchezxQMxNRF4eKLg6TCMf4Df -WN88uieW4oA0beOY02QnrEh+KHdcxiVhJfiFDGX6xDIvpZgF5PgLZxYWxoK4Mhn5 -+bl53B/N66+rDt0b20XkeucC4pVd/GnwU2lhlXV5C15V5jgclKlZM57IcXR5f1GJ -tshquDDIajjDbp7hNxbqBWJMWxJH7ae0s1hWx0nzfxJoCTFx8G34Tkf71oXuxVhA -GaQdp/lLQzfcaFpPz+vCZHTetBXZ9FRUGi8c15dxVJCO2SCdUyt/q4/i6jC8UDfv -8Ue1fXwsBOxonbRJRBD0ckscZOf85muQ3Wl9af0AVqW3rLatt8o+Ae+c ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIF8TCCA9mgAwIBAgIQALC3WhZIX7/hy/WL1xnmfTANBgkqhkiG9w0BAQsFADA4 -MQswCQYDVQQGEwJFUzEUMBIGA1UECgwLSVpFTlBFIFMuQS4xEzARBgNVBAMMCkl6 -ZW5wZS5jb20wHhcNMDcxMjEzMTMwODI4WhcNMzcxMjEzMDgyNzI1WjA4MQswCQYD -VQQGEwJFUzEUMBIGA1UECgwLSVpFTlBFIFMuQS4xEzARBgNVBAMMCkl6ZW5wZS5j -b20wggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDJ03rKDx6sp4boFmVq -scIbRTJxldn+EFvMr+eleQGPicPK8lVx93e+d5TzcqQsRNiekpsUOqHnJJAKClaO -xdgmlOHZSOEtPtoKct2jmRXagaKH9HtuJneJWK3W6wyyQXpzbm3benhB6QiIEn6H -LmYRY2xU+zydcsC8Lv/Ct90NduM61/e0aL6i9eOBbsFGb12N4E3GVFWJGjMxCrFX -uaOKmMPsOzTFlUFpfnXCPCDFYbpRR6AgkJOhkEvzTnyFRVSa0QUmQbC1TR0zvsQD -yCV8wXDbO/QJLVQnSKwv4cSsPsjLkkxTOTcj7NMB+eAJRE1NZMDhDVqHIrytG6P+ -JrUV86f8hBnp7KGItERphIPzidF0BqnMC9bC3ieFUCbKF7jJeodWLBoBHmy+E60Q -rLUk9TiRodZL2vG70t5HtfG8gfZZa88ZU+mNFctKy6lvROUbQc/hhqfK0GqfvEyN -BjNaooXlkDWgYlwWTvDjovoDGrQscbNYLN57C9saD+veIR8GdwYDsMnvmfzAuU8L -hij+0rnq49qlw0dpEuDb8PYZi+17cNcC1u2HGCgsBCRMd+RIihrGO5rUD8r6ddIB -QFqNeb+Lz0vPqhbBleStTIo+F5HUsWLlguWABKQDfo2/2n+iD5dPDNMN+9fR5XJ+ -HMh3/1uaD7euBUbl8agW7EekFwIDAQABo4H2MIHzMIGwBgNVHREEgagwgaWBD2lu -Zm9AaXplbnBlLmNvbaSBkTCBjjFHMEUGA1UECgw+SVpFTlBFIFMuQS4gLSBDSUYg -QTAxMzM3MjYwLVJNZXJjLlZpdG9yaWEtR2FzdGVpeiBUMTA1NSBGNjIgUzgxQzBB -BgNVBAkMOkF2ZGEgZGVsIE1lZGl0ZXJyYW5lbyBFdG9yYmlkZWEgMTQgLSAwMTAx -MCBWaXRvcmlhLUdhc3RlaXowDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC -AQYwHQYDVR0OBBYEFB0cZQ6o8iV7tJHP5LGx5r1VdGwFMA0GCSqGSIb3DQEBCwUA -A4ICAQB4pgwWSp9MiDrAyw6lFn2fuUhfGI8NYjb2zRlrrKvV9pF9rnHzP7MOeIWb -laQnIUdCSnxIOvVFfLMMjlF4rJUT3sb9fbgakEyrkgPH7UIBzg/YsfqikuFgba56 -awmqxinuaElnMIAkejEWOVt+8Rwu3WwJrfIxwYJOubv5vr8qhT/AQKM6WfxZSzwo -JNu0FXWuDYi6LnPAvViH5ULy617uHjAimcs30cQhbIHsvm0m5hzkQiCeR7Csg1lw -LDXWrzY0tM07+DKo7+N4ifuNRSzanLh+QBxh5z6ikixL8s36mLYp//Pye6kfLqCT -VyvehQP5aTfLnnhqBbTFMXiJ7HqnheG5ezzevh55hM6fcA5ZwjUukCox2eRFekGk -LhObNA5me0mrZJfQRsN5nXJQY6aYWwa9SG3YOYNw6DXwBdGqvOPbyALqfP2C2sJb -UjWumDqtujWTI6cfSN01RpiyEGjkpTHCClguGYEQyVB1/OpaFs4R1+7vUIgtYf8/ -QnMFlEPVjjxOAToZpR9GTnfQXeWBIiGH/pR9hNiTrdZoQ0iy2+tzJOeRf1SktoA+ -naM8THLCV8Sg1Mw4J87VBp6iSNnpn86CcDaTmjvfliHjWbcM2pE38P1ZWrOZyGls -QyYBNWNgVYkDOnXYukrZVP/u3oDYLdE41V4tC5h9Pmzb/CaIxw== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIE5jCCA86gAwIBAgIEO45L/DANBgkqhkiG9w0BAQUFADBdMRgwFgYJKoZIhvcN -AQkBFglwa2lAc2suZWUxCzAJBgNVBAYTAkVFMSIwIAYDVQQKExlBUyBTZXJ0aWZp -dHNlZXJpbWlza2Vza3VzMRAwDgYDVQQDEwdKdXVyLVNLMB4XDTAxMDgzMDE0MjMw -MVoXDTE2MDgyNjE0MjMwMVowXTEYMBYGCSqGSIb3DQEJARYJcGtpQHNrLmVlMQsw -CQYDVQQGEwJFRTEiMCAGA1UEChMZQVMgU2VydGlmaXRzZWVyaW1pc2tlc2t1czEQ -MA4GA1UEAxMHSnV1ci1TSzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB -AIFxNj4zB9bjMI0TfncyRsvPGbJgMUaXhvSYRqTCZUXP00B841oiqBB4M8yIsdOB -SvZiF3tfTQou0M+LI+5PAk676w7KvRhj6IAcjeEcjT3g/1tf6mTll+g/mX8MCgkz -ABpTpyHhOEvWgxutr2TC+Rx6jGZITWYfGAriPrsfB2WThbkasLnE+w0R9vXW+RvH -LCu3GFH+4Hv2qEivbDtPL+/40UceJlfwUR0zlv/vWT3aTdEVNMfqPxZIe5EcgEMP -PbgFPtGzlc3Yyg/CQ2fbt5PgIoIuvvVoKIO5wTtpeyDaTpxt4brNj3pssAki14sL -2xzVWiZbDcDq5WDQn/413z8CAwEAAaOCAawwggGoMA8GA1UdEwEB/wQFMAMBAf8w -ggEWBgNVHSAEggENMIIBCTCCAQUGCisGAQQBzh8BAQEwgfYwgdAGCCsGAQUFBwIC -MIHDHoHAAFMAZQBlACAAcwBlAHIAdABpAGYAaQBrAGEAYQB0ACAAbwBuACAAdgDk -AGwAagBhAHMAdABhAHQAdQBkACAAQQBTAC0AaQBzACAAUwBlAHIAdABpAGYAaQB0 -AHMAZQBlAHIAaQBtAGkAcwBrAGUAcwBrAHUAcwAgAGEAbABhAG0ALQBTAEsAIABz -AGUAcgB0AGkAZgBpAGsAYQBhAHQAaQBkAGUAIABrAGkAbgBuAGkAdABhAG0AaQBz -AGUAawBzMCEGCCsGAQUFBwIBFhVodHRwOi8vd3d3LnNrLmVlL2Nwcy8wKwYDVR0f -BCQwIjAgoB6gHIYaaHR0cDovL3d3dy5zay5lZS9qdXVyL2NybC8wHQYDVR0OBBYE -FASqekej5ImvGs8KQKcYP2/v6X2+MB8GA1UdIwQYMBaAFASqekej5ImvGs8KQKcY -P2/v6X2+MA4GA1UdDwEB/wQEAwIB5jANBgkqhkiG9w0BAQUFAAOCAQEAe8EYlFOi -CfP+JmeaUOTDBS8rNXiRTHyoERF5TElZrMj3hWVcRrs7EKACr81Ptcw2Kuxd/u+g -kcm2k298gFTsxwhwDY77guwqYHhpNjbRxZyLabVAyJRld/JXIWY7zoVAtjNjGr95 -HvxcHdMdkxuLDF2FvZkwMhgJkVLpfKG6/2SSmuz+Ne6ML678IIbsSt4beDI3poHS -na9aEhbKmVv8b20OxaAehsmR0FyYgl9jDIpaq9iVpszLita/ZEuOyoqysOkhMp6q -qIWYNIE5ITuoOlIyPfZrN4YGWhWY3PARZv40ILcD9EEQfTmEeZZyY7aWAuVrua0Z -TbvGRNs2yyqcjg== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIHqDCCBpCgAwIBAgIRAMy4579OKRr9otxmpRwsDxEwDQYJKoZIhvcNAQEFBQAw -cjELMAkGA1UEBhMCSFUxETAPBgNVBAcTCEJ1ZGFwZXN0MRYwFAYDVQQKEw1NaWNy -b3NlYyBMdGQuMRQwEgYDVQQLEwtlLVN6aWdubyBDQTEiMCAGA1UEAxMZTWljcm9z -ZWMgZS1Temlnbm8gUm9vdCBDQTAeFw0wNTA0MDYxMjI4NDRaFw0xNzA0MDYxMjI4 -NDRaMHIxCzAJBgNVBAYTAkhVMREwDwYDVQQHEwhCdWRhcGVzdDEWMBQGA1UEChMN -TWljcm9zZWMgTHRkLjEUMBIGA1UECxMLZS1Temlnbm8gQ0ExIjAgBgNVBAMTGU1p -Y3Jvc2VjIGUtU3ppZ25vIFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAw -ggEKAoIBAQDtyADVgXvNOABHzNuEwSFpLHSQDCHZU4ftPkNEU6+r+ICbPHiN1I2u -uO/TEdyB5s87lozWbxXGd36hL+BfkrYn13aaHUM86tnsL+4582pnS4uCzyL4ZVX+ -LMsvfUh6PXX5qqAnu3jCBspRwn5mS6/NoqdNAoI/gqyFxuEPkEeZlApxcpMqyabA -vjxWTHOSJ/FrtfX9/DAFYJLG65Z+AZHCabEeHXtTRbjcQR/Ji3HWVBTji1R4P770 -Yjtb9aPs1ZJ04nQw7wHb4dSrmZsqa/i9phyGI0Jf7Enemotb9HI6QMVJPqW+jqpx -62z69Rrkav17fVVA71hu5tnVvCSrwe+3AgMBAAGjggQ3MIIEMzBnBggrBgEFBQcB -AQRbMFkwKAYIKwYBBQUHMAGGHGh0dHBzOi8vcmNhLmUtc3ppZ25vLmh1L29jc3Aw -LQYIKwYBBQUHMAKGIWh0dHA6Ly93d3cuZS1zemlnbm8uaHUvUm9vdENBLmNydDAP -BgNVHRMBAf8EBTADAQH/MIIBcwYDVR0gBIIBajCCAWYwggFiBgwrBgEEAYGoGAIB -AQEwggFQMCgGCCsGAQUFBwIBFhxodHRwOi8vd3d3LmUtc3ppZ25vLmh1L1NaU1ov -MIIBIgYIKwYBBQUHAgIwggEUHoIBEABBACAAdABhAG4A+gBzAO0AdAB2AOEAbgB5 -ACAA6QByAHQAZQBsAG0AZQB6AOkAcwDpAGgAZQB6ACAA6QBzACAAZQBsAGYAbwBn -AGEAZADhAHMA4QBoAG8AegAgAGEAIABTAHoAbwBsAGcA4QBsAHQAYQB0APMAIABT -AHoAbwBsAGcA4QBsAHQAYQB0AOEAcwBpACAAUwB6AGEAYgDhAGwAeQB6AGEAdABh -ACAAcwB6AGUAcgBpAG4AdAAgAGsAZQBsAGwAIABlAGwAagDhAHIAbgBpADoAIABo -AHQAdABwADoALwAvAHcAdwB3AC4AZQAtAHMAegBpAGcAbgBvAC4AaAB1AC8AUwBa -AFMAWgAvMIHIBgNVHR8EgcAwgb0wgbqggbeggbSGIWh0dHA6Ly93d3cuZS1zemln -bm8uaHUvUm9vdENBLmNybIaBjmxkYXA6Ly9sZGFwLmUtc3ppZ25vLmh1L0NOPU1p -Y3Jvc2VjJTIwZS1Temlnbm8lMjBSb290JTIwQ0EsT1U9ZS1Temlnbm8lMjBDQSxP -PU1pY3Jvc2VjJTIwTHRkLixMPUJ1ZGFwZXN0LEM9SFU/Y2VydGlmaWNhdGVSZXZv -Y2F0aW9uTGlzdDtiaW5hcnkwDgYDVR0PAQH/BAQDAgEGMIGWBgNVHREEgY4wgYuB -EGluZm9AZS1zemlnbm8uaHWkdzB1MSMwIQYDVQQDDBpNaWNyb3NlYyBlLVN6aWdu -w7MgUm9vdCBDQTEWMBQGA1UECwwNZS1TemlnbsOzIEhTWjEWMBQGA1UEChMNTWlj -cm9zZWMgS2Z0LjERMA8GA1UEBxMIQnVkYXBlc3QxCzAJBgNVBAYTAkhVMIGsBgNV -HSMEgaQwgaGAFMegSXUWYYTbMUuE0vE3QJDvTtz3oXakdDByMQswCQYDVQQGEwJI -VTERMA8GA1UEBxMIQnVkYXBlc3QxFjAUBgNVBAoTDU1pY3Jvc2VjIEx0ZC4xFDAS -BgNVBAsTC2UtU3ppZ25vIENBMSIwIAYDVQQDExlNaWNyb3NlYyBlLVN6aWdubyBS -b290IENBghEAzLjnv04pGv2i3GalHCwPETAdBgNVHQ4EFgQUx6BJdRZhhNsxS4TS -8TdAkO9O3PcwDQYJKoZIhvcNAQEFBQADggEBANMTnGZjWS7KXHAM/IO8VbH0jgds -ZifOwTsgqRy7RlRw7lrMoHfqaEQn6/Ip3Xep1fvj1KcExJW4C+FEaGAHQzAxQmHl -7tnlJNUb3+FKG6qfx1/4ehHqE5MAyopYse7tDk2016g2JnzgOsHVV4Lxdbb9iV/a -86g4nzUGCM4ilb7N1fy+W955a9x6qWVmvrElWl/tftOsRm1M9DKHtCAE4Gx4sHfR -hUZLphK3dehKyVZs15KrnfVJONJPU+NVkBHbmJbGSfI+9J8b4PeI3CVimUTYc78/ -MPMMNz7UwiiAc7EBt51alhQBS6kRnSlqLtBdgcDPsiBDxwPgN05dCtxZICU= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIECjCCAvKgAwIBAgIJAMJ+QwRORz8ZMA0GCSqGSIb3DQEBCwUAMIGCMQswCQYD -VQQGEwJIVTERMA8GA1UEBwwIQnVkYXBlc3QxFjAUBgNVBAoMDU1pY3Jvc2VjIEx0 -ZC4xJzAlBgNVBAMMHk1pY3Jvc2VjIGUtU3ppZ25vIFJvb3QgQ0EgMjAwOTEfMB0G -CSqGSIb3DQEJARYQaW5mb0BlLXN6aWduby5odTAeFw0wOTA2MTYxMTMwMThaFw0y -OTEyMzAxMTMwMThaMIGCMQswCQYDVQQGEwJIVTERMA8GA1UEBwwIQnVkYXBlc3Qx -FjAUBgNVBAoMDU1pY3Jvc2VjIEx0ZC4xJzAlBgNVBAMMHk1pY3Jvc2VjIGUtU3pp -Z25vIFJvb3QgQ0EgMjAwOTEfMB0GCSqGSIb3DQEJARYQaW5mb0BlLXN6aWduby5o -dTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOn4j/NjrdqG2KfgQvvP -kd6mJviZpWNwrZuuyjNAfW2WbqEORO7hE52UQlKavXWFdCyoDh2Tthi3jCyoz/tc -cbna7P7ofo/kLx2yqHWH2Leh5TvPmUpG0IMZfcChEhyVbUr02MelTTMuhTlAdX4U -fIASmFDHQWe4oIBhVKZsTh/gnQ4H6cm6M+f+wFUoLAKApxn1ntxVUwOXewdI/5n7 -N4okxFnMUBBjjqqpGrCEGob5X7uxUG6k0QrM1XF+H6cbfPVTbiJfyyvm1HxdrtbC -xkzlBQHZ7Vf8wSN5/PrIJIOV87VqUQHQd9bpEqH5GoP7ghu5sJf0dgYzQ0mg/wu1 -+rUCAwEAAaOBgDB+MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0G -A1UdDgQWBBTLD8bfQkPMPcu1SCOhGnqmKrs0aDAfBgNVHSMEGDAWgBTLD8bfQkPM -Pcu1SCOhGnqmKrs0aDAbBgNVHREEFDASgRBpbmZvQGUtc3ppZ25vLmh1MA0GCSqG -SIb3DQEBCwUAA4IBAQDJ0Q5eLtXMs3w+y/w9/w0olZMEyL/azXm4Q5DwpL7v8u8h -mLzU1F0G9u5C7DBsoKqpyvGvivo/C3NqPuouQH4frlRheesuCDfXI/OMn74dseGk -ddug4lQUsbocKaQY9hK6ohQU4zE1yED/t+AFdlfBHFny+L/k7SViXITwfn4fs775 -tyERzAMBVnCnEJIeGzSBHq2cGsMEPO0CYdYeBvNfOofyK/FFh+U9rNHHV4S9a67c -2Pm2G2JwCz02yULyMtd6YebS2z3PyKnJm9zbWETXbzivf3jTo60adbocwTZ8jx5t -HMN1Rq41Bab2XD0h7lbwyYIiLXpUq3DDfSJlgnCW ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIEFTCCAv2gAwIBAgIGSUEs5AAQMA0GCSqGSIb3DQEBCwUAMIGnMQswCQYDVQQG -EwJIVTERMA8GA1UEBwwIQnVkYXBlc3QxFTATBgNVBAoMDE5ldExvY2sgS2Z0LjE3 -MDUGA1UECwwuVGFuw7pzw610dsOhbnlraWFkw7NrIChDZXJ0aWZpY2F0aW9uIFNl -cnZpY2VzKTE1MDMGA1UEAwwsTmV0TG9jayBBcmFueSAoQ2xhc3MgR29sZCkgRsWR -dGFuw7pzw610dsOhbnkwHhcNMDgxMjExMTUwODIxWhcNMjgxMjA2MTUwODIxWjCB -pzELMAkGA1UEBhMCSFUxETAPBgNVBAcMCEJ1ZGFwZXN0MRUwEwYDVQQKDAxOZXRM -b2NrIEtmdC4xNzA1BgNVBAsMLlRhbsO6c8OtdHbDoW55a2lhZMOzayAoQ2VydGlm -aWNhdGlvbiBTZXJ2aWNlcykxNTAzBgNVBAMMLE5ldExvY2sgQXJhbnkgKENsYXNz -IEdvbGQpIEbFkXRhbsO6c8OtdHbDoW55MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A -MIIBCgKCAQEAxCRec75LbRTDofTjl5Bu0jBFHjzuZ9lk4BqKf8owyoPjIMHj9DrT -lF8afFttvzBPhCf2nx9JvMaZCpDyD/V/Q4Q3Y1GLeqVw/HpYzY6b7cNGbIRwXdrz -AZAj/E4wqX7hJ2Pn7WQ8oLjJM2P+FpD/sLj916jAwJRDC7bVWaaeVtAkH3B5r9s5 -VA1lddkVQZQBr17s9o3x/61k/iCa11zr/qYfCGSji3ZVrR47KGAuhyXoqq8fxmRG -ILdwfzzeSNuWU7c5d+Qa4scWhHaXWy+7GRWF+GmF9ZmnqfI0p6m2pgP8b4Y9VHx2 -BJtr+UBdADTHLpl1neWIA6pN+APSQnbAGwIDAKiLo0UwQzASBgNVHRMBAf8ECDAG -AQH/AgEEMA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUzPpnk/C2uNClwB7zU/2M -U9+D15YwDQYJKoZIhvcNAQELBQADggEBAKt/7hwWqZw8UQCgwBEIBaeZ5m8BiFRh -bvG5GK1Krf6BQCOUL/t1fC8oS2IkgYIL9WHxHG64YTjrgfpioTtaYtOUZcTh5m2C -+C8lcLIhJsFyUR+MLMOEkMNaj7rP9KdlpeuY0fsFskZ1FSNqb4VjMIDw1Z4fKRzC -bLBQWV2QWzuoDTDPv31/zvGdg73JRm4gpvlhUbohL3u+pRVjodSVh/GeufOJ8z2F -uLjbvrW5KfnaNwUASZQDhETnv0Mxz3WLJdH0pmT1kvarBes96aULNmLazAZfNou2 -XjG4Kvte9nHfRCaexOYNkbQudZWAUWpLMKawYqGT8ZvYzsRjdT9ZR7E= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIGfTCCBWWgAwIBAgICAQMwDQYJKoZIhvcNAQEEBQAwga8xCzAJBgNVBAYTAkhV -MRAwDgYDVQQIEwdIdW5nYXJ5MREwDwYDVQQHEwhCdWRhcGVzdDEnMCUGA1UEChMe -TmV0TG9jayBIYWxvemF0Yml6dG9uc2FnaSBLZnQuMRowGAYDVQQLExFUYW51c2l0 -dmFueWtpYWRvazE2MDQGA1UEAxMtTmV0TG9jayBLb3pqZWd5em9pIChDbGFzcyBB -KSBUYW51c2l0dmFueWtpYWRvMB4XDTk5MDIyNDIzMTQ0N1oXDTE5MDIxOTIzMTQ0 -N1owga8xCzAJBgNVBAYTAkhVMRAwDgYDVQQIEwdIdW5nYXJ5MREwDwYDVQQHEwhC -dWRhcGVzdDEnMCUGA1UEChMeTmV0TG9jayBIYWxvemF0Yml6dG9uc2FnaSBLZnQu -MRowGAYDVQQLExFUYW51c2l0dmFueWtpYWRvazE2MDQGA1UEAxMtTmV0TG9jayBL -b3pqZWd5em9pIChDbGFzcyBBKSBUYW51c2l0dmFueWtpYWRvMIIBIjANBgkqhkiG -9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvHSMD7tM9DceqQWC2ObhbHDqeLVu0ThEDaiD -zl3S1tWBxdRL51uUcCbbO51qTGL3cfNk1mE7PetzozfZz+qMkjvN9wfcZnSX9EUi -3fRc4L9t875lM+QVOr/bmJBVOMTtplVjC7B4BPTjbsE/jvxReB+SnoPC/tmwqcm8 -WgD/qaiYdPv2LD4VOQ22BFWoDpggQrOxJa1+mm9dU7GrDPzr4PN6s6iz/0b2Y6LY -Oph7tqyF/7AlT3Rj5xMHpQqPBffAZG9+pyeAlt7ULoZgx2srXnN7F+eRP2QM2Esi -NCubMvJIH5+hCoR64sKtlz2O1cH5VqNQ6ca0+pii7pXmKgOM3wIDAQABo4ICnzCC -ApswDgYDVR0PAQH/BAQDAgAGMBIGA1UdEwEB/wQIMAYBAf8CAQQwEQYJYIZIAYb4 -QgEBBAQDAgAHMIICYAYJYIZIAYb4QgENBIICURaCAk1GSUdZRUxFTSEgRXplbiB0 -YW51c2l0dmFueSBhIE5ldExvY2sgS2Z0LiBBbHRhbGFub3MgU3pvbGdhbHRhdGFz -aSBGZWx0ZXRlbGVpYmVuIGxlaXJ0IGVsamFyYXNvayBhbGFwamFuIGtlc3p1bHQu -IEEgaGl0ZWxlc2l0ZXMgZm9seWFtYXRhdCBhIE5ldExvY2sgS2Z0LiB0ZXJtZWtm -ZWxlbG9zc2VnLWJpenRvc2l0YXNhIHZlZGkuIEEgZGlnaXRhbGlzIGFsYWlyYXMg -ZWxmb2dhZGFzYW5hayBmZWx0ZXRlbGUgYXogZWxvaXJ0IGVsbGVub3J6ZXNpIGVs -amFyYXMgbWVndGV0ZWxlLiBBeiBlbGphcmFzIGxlaXJhc2EgbWVndGFsYWxoYXRv -IGEgTmV0TG9jayBLZnQuIEludGVybmV0IGhvbmxhcGphbiBhIGh0dHBzOi8vd3d3 -Lm5ldGxvY2submV0L2RvY3MgY2ltZW4gdmFneSBrZXJoZXRvIGF6IGVsbGVub3J6 -ZXNAbmV0bG9jay5uZXQgZS1tYWlsIGNpbWVuLiBJTVBPUlRBTlQhIFRoZSBpc3N1 -YW5jZSBhbmQgdGhlIHVzZSBvZiB0aGlzIGNlcnRpZmljYXRlIGlzIHN1YmplY3Qg -dG8gdGhlIE5ldExvY2sgQ1BTIGF2YWlsYWJsZSBhdCBodHRwczovL3d3dy5uZXRs -b2NrLm5ldC9kb2NzIG9yIGJ5IGUtbWFpbCBhdCBjcHNAbmV0bG9jay5uZXQuMA0G -CSqGSIb3DQEBBAUAA4IBAQBIJEb3ulZv+sgoA0BO5TE5ayZrU3/b39/zcT0mwBQO -xmd7I6gMc90Bu8bKbjc5VdXHjFYgDigKDtIqpLBJUsY4B/6+CgmM0ZjPytoUMaFP -0jn8DxEsQ8Pdq5PHVT5HfBgaANzze9jyf1JsIPQLX2lS9O74silg6+NJMSEN1rUQ -QeJBCWziGppWS3cC9qCbmieH6FUpccKQn0V4GuEVZD3QDtigdp+uxdAu6tYPVuxk -f1qbFFgBJ34TUMdrKuZoPL9coAob4Q566eKAw+np9v1sEZ7Q5SgnK1QyQhSCdeZK -8CtmdWOMovsEPoMOmzbwGOQmIMOM8CgHrTwXZoi1/baI ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIID5jCCAs6gAwIBAgIQV8szb8JcFuZHFhfjkDFo4DANBgkqhkiG9w0BAQUFADBi -MQswCQYDVQQGEwJVUzEhMB8GA1UEChMYTmV0d29yayBTb2x1dGlvbnMgTC5MLkMu -MTAwLgYDVQQDEydOZXR3b3JrIFNvbHV0aW9ucyBDZXJ0aWZpY2F0ZSBBdXRob3Jp -dHkwHhcNMDYxMjAxMDAwMDAwWhcNMjkxMjMxMjM1OTU5WjBiMQswCQYDVQQGEwJV -UzEhMB8GA1UEChMYTmV0d29yayBTb2x1dGlvbnMgTC5MLkMuMTAwLgYDVQQDEydO -ZXR3b3JrIFNvbHV0aW9ucyBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwggEiMA0GCSqG -SIb3DQEBAQUAA4IBDwAwggEKAoIBAQDkvH6SMG3G2I4rC7xGzuAnlt7e+foS0zwz -c7MEL7xxjOWftiJgPl9dzgn/ggwbmlFQGiaJ3dVhXRncEg8tCqJDXRfQNJIg6nPP -OCwGJgl6cvf6UDL4wpPTaaIjzkGxzOTVHzbRijr4jGPiFFlp7Q3Tf2vouAPlT2rl -mGNpSAW+Lv8ztumXWWn4Zxmuk2GWRBXTcrA/vGp97Eh/jcOrqnErU2lBUzS1sLnF -BgrEsEX1QV1uiUV7PTsmjHTC5dLRfbIR1PtYMiKagMnc/Qzpf14Dl847ABSHJ3A4 -qY5usyd2mFHgBeMhqxrVhSI8KbWaFsWAqPS7azCPL0YCorEMIuDTAgMBAAGjgZcw -gZQwHQYDVR0OBBYEFCEwyfsA106Y2oeqKtCnLrFAMadMMA4GA1UdDwEB/wQEAwIB -BjAPBgNVHRMBAf8EBTADAQH/MFIGA1UdHwRLMEkwR6BFoEOGQWh0dHA6Ly9jcmwu -bmV0c29sc3NsLmNvbS9OZXR3b3JrU29sdXRpb25zQ2VydGlmaWNhdGVBdXRob3Jp -dHkuY3JsMA0GCSqGSIb3DQEBBQUAA4IBAQC7rkvnt1frf6ott3NHhWrB5KUd5Oc8 -6fRZZXe1eltajSU24HqXLjjAV2CDmAaDn7l2em5Q4LqILPxFzBiwmZVRDuwduIj/ -h1AcgsLj4DKAv6ALR8jDMe+ZZzKATxcheQxpXN5eNK4CtSbqUN9/GGUsyfJj4akH -/nxxH2szJGoeBfcFaMBqEssuXmHLrijTfsK0ZpEmXzwuJF/LWA/rKOyvEZbz3Htv -wKeI8lN3s2Berq4o2jUsbzRF0ybh3uxbTydrFny9RAQYgrOJeRcQcT16ohZO9QHN -pGxlaKFJdlxDydi8NmdspZS11My5vWo1ViHe2MPr+8ukYEywVaCge1ey ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIID8TCCAtmgAwIBAgIQQT1yx/RrH4FDffHSKFTfmjANBgkqhkiG9w0BAQUFADCB -ijELMAkGA1UEBhMCQ0gxEDAOBgNVBAoTB1dJU2VLZXkxGzAZBgNVBAsTEkNvcHly -aWdodCAoYykgMjAwNTEiMCAGA1UECxMZT0lTVEUgRm91bmRhdGlvbiBFbmRvcnNl -ZDEoMCYGA1UEAxMfT0lTVEUgV0lTZUtleSBHbG9iYWwgUm9vdCBHQSBDQTAeFw0w -NTEyMTExNjAzNDRaFw0zNzEyMTExNjA5NTFaMIGKMQswCQYDVQQGEwJDSDEQMA4G -A1UEChMHV0lTZUtleTEbMBkGA1UECxMSQ29weXJpZ2h0IChjKSAyMDA1MSIwIAYD -VQQLExlPSVNURSBGb3VuZGF0aW9uIEVuZG9yc2VkMSgwJgYDVQQDEx9PSVNURSBX -SVNlS2V5IEdsb2JhbCBSb290IEdBIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A -MIIBCgKCAQEAy0+zAJs9Nt350UlqaxBJH+zYK7LG+DKBKUOVTJoZIyEVRd7jyBxR -VVuuk+g3/ytr6dTqvirdqFEr12bDYVxgAsj1znJ7O7jyTmUIms2kahnBAbtzptf2 -w93NvKSLtZlhuAGio9RN1AU9ka34tAhxZK9w8RxrfvbDd50kc3vkDIzh2TbhmYsF -mQvtRTEJysIA2/dyoJaqlYfQjse2YXMNdmaM3Bu0Y6Kff5MTMPGhJ9vZ/yxViJGg -4E8HsChWjBgbl0SOid3gF27nKu+POQoxhILYQBRJLnpB5Kf+42TMwVlxSywhp1t9 -4B3RLoGbw9ho972WG6xwsRYUC9tguSYBBQIDAQABo1EwTzALBgNVHQ8EBAMCAYYw -DwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUswN+rja8sHnR3JQmthG+IbJphpQw -EAYJKwYBBAGCNxUBBAMCAQAwDQYJKoZIhvcNAQEFBQADggEBAEuh/wuHbrP5wUOx -SPMowB0uyQlB+pQAHKSkq0lPjz0e701vvbyk9vImMMkQyh2I+3QZH4VFvbBsUfk2 -ftv1TDI6QU9bR8/oCy22xBmddMVHxjtqD6wU2zz0c5ypBd8A3HR4+vg1YFkCExh8 -vPtNsCBtQ7tgMHpnM1zFmdH4LTlSc/uMqpclXHLZCB6rTjzjgTGfA6b7wP4piFXa -hNVQA7bihKOmNqoROgHhGEvWRGizPflTdISzRpFGlgC3gCy24eMQ4tui5yiPAZZi -Fj4A4xylNoEYokxSdsARo27mHbrjWr42U8U+dY+GaSlYU7Wcu2+fXMUY7N0v4ZjJ -/L7fCg0= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIJhjCCB26gAwIBAgIBCzANBgkqhkiG9w0BAQsFADCCAR4xPjA8BgNVBAMTNUF1 -dG9yaWRhZCBkZSBDZXJ0aWZpY2FjaW9uIFJhaXogZGVsIEVzdGFkbyBWZW5lem9s -YW5vMQswCQYDVQQGEwJWRTEQMA4GA1UEBxMHQ2FyYWNhczEZMBcGA1UECBMQRGlz -dHJpdG8gQ2FwaXRhbDE2MDQGA1UEChMtU2lzdGVtYSBOYWNpb25hbCBkZSBDZXJ0 -aWZpY2FjaW9uIEVsZWN0cm9uaWNhMUMwQQYDVQQLEzpTdXBlcmludGVuZGVuY2lh -IGRlIFNlcnZpY2lvcyBkZSBDZXJ0aWZpY2FjaW9uIEVsZWN0cm9uaWNhMSUwIwYJ -KoZIhvcNAQkBFhZhY3JhaXpAc3VzY2VydGUuZ29iLnZlMB4XDTEwMTIyODE2NTEw -MFoXDTIwMTIyNTIzNTk1OVowgdExJjAkBgkqhkiG9w0BCQEWF2NvbnRhY3RvQHBy -b2NlcnQubmV0LnZlMQ8wDQYDVQQHEwZDaGFjYW8xEDAOBgNVBAgTB01pcmFuZGEx -KjAoBgNVBAsTIVByb3ZlZWRvciBkZSBDZXJ0aWZpY2Fkb3MgUFJPQ0VSVDE2MDQG -A1UEChMtU2lzdGVtYSBOYWNpb25hbCBkZSBDZXJ0aWZpY2FjaW9uIEVsZWN0cm9u -aWNhMQswCQYDVQQGEwJWRTETMBEGA1UEAxMKUFNDUHJvY2VydDCCAiIwDQYJKoZI -hvcNAQEBBQADggIPADCCAgoCggIBANW39KOUM6FGqVVhSQ2oh3NekS1wwQYalNo9 -7BVCwfWMrmoX8Yqt/ICV6oNEolt6Vc5Pp6XVurgfoCfAUFM+jbnADrgV3NZs+J74 -BCXfgI8Qhd19L3uA3VcAZCP4bsm+lU/hdezgfl6VzbHvvnpC2Mks0+saGiKLt38G -ieU89RLAu9MLmV+QfI4tL3czkkohRqipCKzx9hEC2ZUWno0vluYC3XXCFCpa1sl9 -JcLB/KpnheLsvtF8PPqv1W7/U0HU9TI4seJfxPmOEO8GqQKJ/+MMbpfg353bIdD0 -PghpbNjU5Db4g7ayNo+c7zo3Fn2/omnXO1ty0K+qP1xmk6wKImG20qCZyFSTXai2 -0b1dCl53lKItwIKOvMoDKjSuc/HUtQy9vmebVOvh+qBa7Dh+PsHMosdEMXXqP+UH -0quhJZb25uSgXTcYOWEAM11G1ADEtMo88aKjPvM6/2kwLkDd9p+cJsmWN63nOaK/ -6mnbVSKVUyqUtd+tFjiBdWbjxywbk5yqjKPK2Ww8F22c3HxT4CAnQzb5EuE8XL1m -v6JpIzi4mWCZDlZTOpx+FIywBm/xhnaQr/2v/pDGj59/i5IjnOcVdo/Vi5QTcmn7 -K2FjiO/mpF7moxdqWEfLcU8UC17IAggmosvpr2uKGcfLFFb14dq12fy/czja+eev -bqQ34gcnAgMBAAGjggMXMIIDEzASBgNVHRMBAf8ECDAGAQH/AgEBMDcGA1UdEgQw -MC6CD3N1c2NlcnRlLmdvYi52ZaAbBgVghl4CAqASDBBSSUYtRy0yMDAwNDAzNi0w -MB0GA1UdDgQWBBRBDxk4qpl/Qguk1yeYVKIXTC1RVDCCAVAGA1UdIwSCAUcwggFD -gBStuyIdxuDSAaj9dlBSk+2YwU2u06GCASakggEiMIIBHjE+MDwGA1UEAxM1QXV0 -b3JpZGFkIGRlIENlcnRpZmljYWNpb24gUmFpeiBkZWwgRXN0YWRvIFZlbmV6b2xh -bm8xCzAJBgNVBAYTAlZFMRAwDgYDVQQHEwdDYXJhY2FzMRkwFwYDVQQIExBEaXN0 -cml0byBDYXBpdGFsMTYwNAYDVQQKEy1TaXN0ZW1hIE5hY2lvbmFsIGRlIENlcnRp -ZmljYWNpb24gRWxlY3Ryb25pY2ExQzBBBgNVBAsTOlN1cGVyaW50ZW5kZW5jaWEg -ZGUgU2VydmljaW9zIGRlIENlcnRpZmljYWNpb24gRWxlY3Ryb25pY2ExJTAjBgkq -hkiG9w0BCQEWFmFjcmFpekBzdXNjZXJ0ZS5nb2IudmWCAQowDgYDVR0PAQH/BAQD -AgEGME0GA1UdEQRGMESCDnByb2NlcnQubmV0LnZloBUGBWCGXgIBoAwMClBTQy0w -MDAwMDKgGwYFYIZeAgKgEgwQUklGLUotMzE2MzUzNzMtNzB2BgNVHR8EbzBtMEag -RKBChkBodHRwOi8vd3d3LnN1c2NlcnRlLmdvYi52ZS9sY3IvQ0VSVElGSUNBRE8t -UkFJWi1TSEEzODRDUkxERVIuY3JsMCOgIaAfhh1sZGFwOi8vYWNyYWl6LnN1c2Nl -cnRlLmdvYi52ZTA3BggrBgEFBQcBAQQrMCkwJwYIKwYBBQUHMAGGG2h0dHA6Ly9v -Y3NwLnN1c2NlcnRlLmdvYi52ZTBBBgNVHSAEOjA4MDYGBmCGXgMBAjAsMCoGCCsG -AQUFBwIBFh5odHRwOi8vd3d3LnN1c2NlcnRlLmdvYi52ZS9kcGMwDQYJKoZIhvcN -AQELBQADggIBACtZ6yKZu4SqT96QxtGGcSOeSwORR3C7wJJg7ODU523G0+1ng3dS -1fLld6c2suNUvtm7CpsR72H0xpkzmfWvADmNg7+mvTV+LFwxNG9s2/NkAZiqlCxB -3RWGymspThbASfzXg0gTB1GEMVKIu4YXx2sviiCtxQuPcD4quxtxj7mkoP3Yldmv -Wb8lK5jpY5MvYB7Eqvh39YtsL+1+LrVPQA3uvFd359m21D+VJzog1eWuq2w1n8Gh -HVnchIHuTQfiSLaeS5UtQbHh6N5+LwUeaO6/u5BlOsju6rEYNxxik6SgMexxbJHm -pHmJWhSnFFAFTKQAVzAswbVhltw+HoSvOULP5dAssSS830DD7X9jSr3hTxJkhpXz -sOfIt+FTvZLm8wyWuevo5pLtp4EJFAv8lXrPj9Y0TzYS3F7RNHXGRoAvlQSMx4bE -qCaJqD8Zm4G7UaRKhqsLEQ+xrmNTbSjq3TNWOByyrYDT13K9mmyZY+gAu0F2Bbdb -mRiKw7gSXFbPVgx96OLP7bx0R/vu0xdOIk9W/1DzLuY5poLWccret9W6aAjtmcz9 -opLLabid+Qqkpj5PkygqYWwHJgD/ll9ohri4zspV4KuxPX+Y1zMOWj3YeMLEYC/H -YvBhkdI4sPaeVdtAgAUSM84dkpvRabP/v/GSCmE1P93+hvS84Bpxs2Km ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIF0DCCBLigAwIBAgIEOrZQizANBgkqhkiG9w0BAQUFADB/MQswCQYDVQQGEwJC -TTEZMBcGA1UEChMQUXVvVmFkaXMgTGltaXRlZDElMCMGA1UECxMcUm9vdCBDZXJ0 -aWZpY2F0aW9uIEF1dGhvcml0eTEuMCwGA1UEAxMlUXVvVmFkaXMgUm9vdCBDZXJ0 -aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wMTAzMTkxODMzMzNaFw0yMTAzMTcxODMz -MzNaMH8xCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMSUw -IwYDVQQLExxSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MS4wLAYDVQQDEyVR -dW9WYWRpcyBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIIBIjANBgkqhkiG -9w0BAQEFAAOCAQ8AMIIBCgKCAQEAv2G1lVO6V/z68mcLOhrfEYBklbTRvM16z/Yp -li4kVEAkOPcahdxYTMukJ0KX0J+DisPkBgNbAKVRHnAEdOLB1Dqr1607BxgFjv2D -rOpm2RgbaIr1VxqYuvXtdj182d6UajtLF8HVj71lODqV0D1VNk7feVcxKh7YWWVJ -WCCYfqtffp/p1k3sg3Spx2zY7ilKhSoGFPlU5tPaZQeLYzcS19Dsw3sgQUSj7cug -F+FxZc4dZjH3dgEZyH0DWLaVSR2mEiboxgx24ONmy+pdpibu5cxfvWenAScOospU -xbF6lR1xHkopigPcakXBpBlebzbNw6Kwt/5cOOJSvPhEQ+aQuwIDAQABo4ICUjCC -Ak4wPQYIKwYBBQUHAQEEMTAvMC0GCCsGAQUFBzABhiFodHRwczovL29jc3AucXVv -dmFkaXNvZmZzaG9yZS5jb20wDwYDVR0TAQH/BAUwAwEB/zCCARoGA1UdIASCAREw -ggENMIIBCQYJKwYBBAG+WAABMIH7MIHUBggrBgEFBQcCAjCBxxqBxFJlbGlhbmNl -IG9uIHRoZSBRdW9WYWRpcyBSb290IENlcnRpZmljYXRlIGJ5IGFueSBwYXJ0eSBh -c3N1bWVzIGFjY2VwdGFuY2Ugb2YgdGhlIHRoZW4gYXBwbGljYWJsZSBzdGFuZGFy -ZCB0ZXJtcyBhbmQgY29uZGl0aW9ucyBvZiB1c2UsIGNlcnRpZmljYXRpb24gcHJh -Y3RpY2VzLCBhbmQgdGhlIFF1b1ZhZGlzIENlcnRpZmljYXRlIFBvbGljeS4wIgYI -KwYBBQUHAgEWFmh0dHA6Ly93d3cucXVvdmFkaXMuYm0wHQYDVR0OBBYEFItLbe3T -KbkGGew5Oanwl4Rqy+/fMIGuBgNVHSMEgaYwgaOAFItLbe3TKbkGGew5Oanwl4Rq -y+/foYGEpIGBMH8xCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBMaW1p -dGVkMSUwIwYDVQQLExxSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MS4wLAYD -VQQDEyVRdW9WYWRpcyBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5ggQ6tlCL -MA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQUFAAOCAQEAitQUtf70mpKnGdSk -fnIYj9lofFIk3WdvOXrEql494liwTXCYhGHoG+NpGA7O+0dQoE7/8CQfvbLO9Sf8 -7C9TqnN7Az10buYWnuulLsS/VidQK2K6vkscPFVcQR0kvoIgR13VRH56FmjffU1R -cHhXHTMe/QKZnAzNCgVPx7uOpHX6Sm2xgI4JVrmcGmD+XcHXetwReNDWXcG31a0y -mQM6isxUJTkxgXsTIlG6Rmyhu576BGxJJnSP0nPrzDCi5upZIof4l/UO/erMkqQW -xFIY6iHOsfHmhIHluqmGKPJDWl0Snawe2ajlCmqnf6CHKc/yiU3U7MXi5nrQNiOK -SnQ2+Q== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIFYDCCA0igAwIBAgIUeFhfLq0sGUvjNwc1NBMotZbUZZMwDQYJKoZIhvcNAQEL -BQAwSDELMAkGA1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAc -BgNVBAMTFVF1b1ZhZGlzIFJvb3QgQ0EgMSBHMzAeFw0xMjAxMTIxNzI3NDRaFw00 -MjAxMTIxNzI3NDRaMEgxCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBM -aW1pdGVkMR4wHAYDVQQDExVRdW9WYWRpcyBSb290IENBIDEgRzMwggIiMA0GCSqG -SIb3DQEBAQUAA4ICDwAwggIKAoICAQCgvlAQjunybEC0BJyFuTHK3C3kEakEPBtV -wedYMB0ktMPvhd6MLOHBPd+C5k+tR4ds7FtJwUrVu4/sh6x/gpqG7D0DmVIB0jWe -rNrwU8lmPNSsAgHaJNM7qAJGr6Qc4/hzWHa39g6QDbXwz8z6+cZM5cOGMAqNF341 -68Xfuw6cwI2H44g4hWf6Pser4BOcBRiYz5P1sZK0/CPTz9XEJ0ngnjybCKOLXSoh -4Pw5qlPafX7PGglTvF0FBM+hSo+LdoINofjSxxR3W5A2B4GbPgb6Ul5jxaYA/qXp -UhtStZI5cgMJYr2wYBZupt0lwgNm3fME0UDiTouG9G/lg6AnhF4EwfWQvTA9xO+o -abw4m6SkltFi2mnAAZauy8RRNOoMqv8hjlmPSlzkYZqn0ukqeI1RPToV7qJZjqlc -3sX5kCLliEVx3ZGZbHqfPT2YfF72vhZooF6uCyP8Wg+qInYtyaEQHeTTRCOQiJ/G -KubX9ZqzWB4vMIkIG1SitZgj7Ah3HJVdYdHLiZxfokqRmu8hqkkWCKi9YSgxyXSt -hfbZxbGL0eUQMk1fiyA6PEkfM4VZDdvLCXVDaXP7a3F98N/ETH3Goy7IlXnLc6KO -Tk0k+17kBL5yG6YnLUlamXrXXAkgt3+UuU/xDRxeiEIbEbfnkduebPRq34wGmAOt -zCjvpUfzUwIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIB -BjAdBgNVHQ4EFgQUo5fW816iEOGrRZ88F2Q87gFwnMwwDQYJKoZIhvcNAQELBQAD -ggIBABj6W3X8PnrHX3fHyt/PX8MSxEBd1DKquGrX1RUVRpgjpeaQWxiZTOOtQqOC -MTaIzen7xASWSIsBx40Bz1szBpZGZnQdT+3Btrm0DWHMY37XLneMlhwqI2hrhVd2 -cDMT/uFPpiN3GPoajOi9ZcnPP/TJF9zrx7zABC4tRi9pZsMbj/7sPtPKlL92CiUN -qXsCHKnQO18LwIE6PWThv6ctTr1NxNgpxiIY0MWscgKCP6o6ojoilzHdCGPDdRS5 -YCgtW2jgFqlmgiNR9etT2DGbe+m3nUvriBbP+V04ikkwj+3x6xn0dxoxGE1nVGwv -b2X52z3sIexe9PSLymBlVNFxZPT5pqOBMzYzcfCkeF9OrYMh3jRJjehZrJ3ydlo2 -8hP0r+AJx2EqbPfgna67hkooby7utHnNkDPDs3b69fBsnQGQ+p6Q9pxyz0fawx/k -NSBT8lTR32GDpgLiJTjehTItXnOQUl1CxM49S+H5GYQd1aJQzEH7QRTDvdbJWqNj -ZgKAvQU6O0ec7AAmTPWIUb+oI38YB7AL7YsmoWTTYUrrXJ/es69nA7Mf3W1daWhp -q1467HxpvMc7hU6eFbm0FU/DlXpY18ls6Wy58yljXrQs8C097Vpl4KlbQMJImYFt -nh8GKjwStIsPm6Ik8KaN1nrgS7ZklmOVhMJKzRwuJIczYOXD ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIFtzCCA5+gAwIBAgICBQkwDQYJKoZIhvcNAQEFBQAwRTELMAkGA1UEBhMCQk0x -GTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMTElF1b1ZhZGlzIFJv -b3QgQ0EgMjAeFw0wNjExMjQxODI3MDBaFw0zMTExMjQxODIzMzNaMEUxCzAJBgNV -BAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMRswGQYDVQQDExJRdW9W -YWRpcyBSb290IENBIDIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCa -GMpLlA0ALa8DKYrwD4HIrkwZhR0In6spRIXzL4GtMh6QRr+jhiYaHv5+HBg6XJxg -Fyo6dIMzMH1hVBHL7avg5tKifvVrbxi3Cgst/ek+7wrGsxDp3MJGF/hd/aTa/55J -WpzmM+Yklvc/ulsrHHo1wtZn/qtmUIttKGAr79dgw8eTvI02kfN/+NsRE8Scd3bB -rrcCaoF6qUWD4gXmuVbBlDePSHFjIuwXZQeVikvfj8ZaCuWw419eaxGrDPmF60Tp -+ARz8un+XJiM9XOva7R+zdRcAitMOeGylZUtQofX1bOQQ7dsE/He3fbE+Ik/0XX1 -ksOR1YqI0JDs3G3eicJlcZaLDQP9nL9bFqyS2+r+eXyt66/3FsvbzSUr5R/7mp/i -Ucw6UwxI5g69ybR2BlLmEROFcmMDBOAENisgGQLodKcftslWZvB1JdxnwQ5hYIiz -PtGo/KPaHbDRsSNU30R2be1B2MGyIrZTHN81Hdyhdyox5C315eXbyOD/5YDXC2Og -/zOhD7osFRXql7PSorW+8oyWHhqPHWykYTe5hnMz15eWniN9gqRMgeKh0bpnX5UH -oycR7hYQe7xFSkyyBNKr79X9DFHOUGoIMfmR2gyPZFwDwzqLID9ujWc9Otb+fVuI -yV77zGHcizN300QyNQliBJIWENieJ0f7OyHj+OsdWwIDAQABo4GwMIGtMA8GA1Ud -EwEB/wQFMAMBAf8wCwYDVR0PBAQDAgEGMB0GA1UdDgQWBBQahGK8SEwzJQTU7tD2 -A8QZRtGUazBuBgNVHSMEZzBlgBQahGK8SEwzJQTU7tD2A8QZRtGUa6FJpEcwRTEL -MAkGA1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMT -ElF1b1ZhZGlzIFJvb3QgQ0EgMoICBQkwDQYJKoZIhvcNAQEFBQADggIBAD4KFk2f -BluornFdLwUvZ+YTRYPENvbzwCYMDbVHZF34tHLJRqUDGCdViXh9duqWNIAXINzn -g/iN/Ae42l9NLmeyhP3ZRPx3UIHmfLTJDQtyU/h2BwdBR5YM++CCJpNVjP4iH2Bl -fF/nJrP3MpCYUNQ3cVX2kiF495V5+vgtJodmVjB3pjd4M1IQWK4/YY7yarHvGH5K -WWPKjaJW1acvvFYfzznB4vsKqBUsfU16Y8Zsl0Q80m/DShcK+JDSV6IZUaUtl0Ha -B0+pUNqQjZRG4T7wlP0QADj1O+hA4bRuVhogzG9Yje0uRY/W6ZM/57Es3zrWIozc -hLsib9D45MY56QSIPMO661V6bYCZJPVsAfv4l7CUW+v90m/xd2gNNWQjrLhVoQPR -TUIZ3Ph1WVaj+ahJefivDrkRoHy3au000LYmYjgahwz46P0u05B/B5EqHdZ+XIWD -mbA4CD/pXvk1B+TJYm5Xf6dQlfe6yJvmjqIBxdZmv3lh8zwc4bmCXF2gw+nYSL0Z -ohEUGW6yhhtoPkg3Goi3XZZenMfvJ2II4pEZXNLxId26F0KCl3GBUzGpn/Z9Yr9y -4aOTHcyKJloJONDO1w2AFrR4pTqHTI2KpdVGl/IsELm8VCLAAVBpQ570su9t+Oza -8eOx79+Rj1QqCyXBJhnEUhAFZdWCEOrCMc0u ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIFYDCCA0igAwIBAgIURFc0JFuBiZs18s64KztbpybwdSgwDQYJKoZIhvcNAQEL -BQAwSDELMAkGA1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAc -BgNVBAMTFVF1b1ZhZGlzIFJvb3QgQ0EgMiBHMzAeFw0xMjAxMTIxODU5MzJaFw00 -MjAxMTIxODU5MzJaMEgxCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBM -aW1pdGVkMR4wHAYDVQQDExVRdW9WYWRpcyBSb290IENBIDIgRzMwggIiMA0GCSqG -SIb3DQEBAQUAA4ICDwAwggIKAoICAQChriWyARjcV4g/Ruv5r+LrI3HimtFhZiFf -qq8nUeVuGxbULX1QsFN3vXg6YOJkApt8hpvWGo6t/x8Vf9WVHhLL5hSEBMHfNrMW -n4rjyduYNM7YMxcoRvynyfDStNVNCXJJ+fKH46nafaF9a7I6JaltUkSs+L5u+9ym -c5GQYaYDFCDy54ejiK2toIz/pgslUiXnFgHVy7g1gQyjO/Dh4fxaXc6AcW34Sas+ -O7q414AB+6XrW7PFXmAqMaCvN+ggOp+oMiwMzAkd056OXbxMmO7FGmh77FOm6RQ1 -o9/NgJ8MSPsc9PG/Srj61YxxSscfrf5BmrODXfKEVu+lV0POKa2Mq1W/xPtbAd0j -IaFYAI7D0GoT7RPjEiuA3GfmlbLNHiJuKvhB1PLKFAeNilUSxmn1uIZoL1NesNKq -IcGY5jDjZ1XHm26sGahVpkUG0CM62+tlXSoREfA7T8pt9DTEceT/AFr2XK4jYIVz -8eQQsSWu1ZK7E8EM4DnatDlXtas1qnIhO4M15zHfeiFuuDIIfR0ykRVKYnLP43eh -vNURG3YBZwjgQQvD6xVu+KQZ2aKrr+InUlYrAoosFCT5v0ICvybIxo/gbjh9Uy3l -7ZizlWNof/k19N+IxWA1ksB8aRxhlRbQ694Lrz4EEEVlWFA4r0jyWbYW8jwNkALG -cC4BrTwV1wIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIB -BjAdBgNVHQ4EFgQU7edvdlq/YOxJW8ald7tyFnGbxD0wDQYJKoZIhvcNAQELBQAD -ggIBAJHfgD9DCX5xwvfrs4iP4VGyvD11+ShdyLyZm3tdquXK4Qr36LLTn91nMX66 -AarHakE7kNQIXLJgapDwyM4DYvmL7ftuKtwGTTwpD4kWilhMSA/ohGHqPHKmd+RC -roijQ1h5fq7KpVMNqT1wvSAZYaRsOPxDMuHBR//47PERIjKWnML2W2mWeyAMQ0Ga -W/ZZGYjeVYg3UQt4XAoeo0L9x52ID8DyeAIkVJOviYeIyUqAHerQbj5hLja7NQ4n -lv1mNDthcnPxFlxHBlRJAHpYErAK74X9sbgzdWqTHBLmYF5vHX/JHyPLhGGfHoJE -+V+tYlUkmlKY7VHnoX6XOuYvHxHaU4AshZ6rNRDbIl9qxV6XU/IyAgkwo1jwDQHV -csaxfGl7w/U2Rcxhbl5MlMVerugOXou/983g7aEOGzPuVBj+D77vfoRrQ+NwmNtd -dbINWQeFFSM51vHfqSYP1kjHs6Yi9TM3WpVHn3u6GBVv/9YUZINJ0gpnIdsPNWNg -KCLjsZWDzYWm3S8P52dSbrsvhXz1SnPnxT7AvSESBT/8twNJAlvIJebiVDj1eYeM -HVOyToV7BjjHLPj4sHKNJeV3UvQDHEimUF+IIDBu8oJDqz2XhOdT+yHBTw8imoa4 -WSr2Rz0ZiC3oheGe7IUIarFsNMkd7EgrO3jtZsSOeWmD3n+M ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIGnTCCBIWgAwIBAgICBcYwDQYJKoZIhvcNAQEFBQAwRTELMAkGA1UEBhMCQk0x -GTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMTElF1b1ZhZGlzIFJv -b3QgQ0EgMzAeFw0wNjExMjQxOTExMjNaFw0zMTExMjQxOTA2NDRaMEUxCzAJBgNV -BAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMRswGQYDVQQDExJRdW9W -YWRpcyBSb290IENBIDMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDM -V0IWVJzmmNPTTe7+7cefQzlKZbPoFog02w1ZkXTPkrgEQK0CSzGrvI2RaNggDhoB -4hp7Thdd4oq3P5kazethq8Jlph+3t723j/z9cI8LoGe+AaJZz3HmDyl2/7FWeUUr -H556VOijKTVopAFPD6QuN+8bv+OPEKhyq1hX51SGyMnzW9os2l2ObjyjPtr7guXd -8lyyBTNvijbO0BNO/79KDDRMpsMhvVAEVeuxu537RR5kFd5VAYwCdrXLoT9Cabwv -vWhDFlaJKjdhkf2mrk7AyxRllDdLkgbvBNDInIjbC3uBr7E9KsRlOni27tyAsdLT -mZw67mtaa7ONt9XOnMK+pUsvFrGeaDsGb659n/je7Mwpp5ijJUMv7/FfJuGITfhe -btfZFG4ZM2mnO4SJk8RTVROhUXhA+LjJou57ulJCg54U7QVSWllWp5f8nT8KKdjc -T5EOE7zelaTfi5m+rJsziO+1ga8bxiJTyPbH7pcUsMV8eFLI8M5ud2CEpukqdiDt -WAEXMJPpGovgc2PZapKUSU60rUqFxKMiMPwJ7Wgic6aIDFUhWMXhOp8q3crhkODZ -c6tsgLjoC2SToJyMGf+z0gzskSaHirOi4XCPLArlzW1oUevaPwV/izLmE1xr/l9A -4iLItLRkT9a6fUg+qGkM17uGcclzuD87nSVL2v9A6wIDAQABo4IBlTCCAZEwDwYD -VR0TAQH/BAUwAwEB/zCB4QYDVR0gBIHZMIHWMIHTBgkrBgEEAb5YAAMwgcUwgZMG -CCsGAQUFBwICMIGGGoGDQW55IHVzZSBvZiB0aGlzIENlcnRpZmljYXRlIGNvbnN0 -aXR1dGVzIGFjY2VwdGFuY2Ugb2YgdGhlIFF1b1ZhZGlzIFJvb3QgQ0EgMyBDZXJ0 -aWZpY2F0ZSBQb2xpY3kgLyBDZXJ0aWZpY2F0aW9uIFByYWN0aWNlIFN0YXRlbWVu -dC4wLQYIKwYBBQUHAgEWIWh0dHA6Ly93d3cucXVvdmFkaXNnbG9iYWwuY29tL2Nw -czALBgNVHQ8EBAMCAQYwHQYDVR0OBBYEFPLAE+CCQz777i9nMpY1XNu4ywLQMG4G -A1UdIwRnMGWAFPLAE+CCQz777i9nMpY1XNu4ywLQoUmkRzBFMQswCQYDVQQGEwJC -TTEZMBcGA1UEChMQUXVvVmFkaXMgTGltaXRlZDEbMBkGA1UEAxMSUXVvVmFkaXMg -Um9vdCBDQSAzggIFxjANBgkqhkiG9w0BAQUFAAOCAgEAT62gLEz6wPJv92ZVqyM0 -7ucp2sNbtrCD2dDQ4iH782CnO11gUyeim/YIIirnv6By5ZwkajGxkHon24QRiSem -d1o417+shvzuXYO8BsbRd2sPbSQvS3pspweWyuOEn62Iix2rFo1bZhfZFvSLgNLd -+LJ2w/w4E6oM3kJpK27zPOuAJ9v1pkQNn1pVWQvVDVJIxa6f8i+AxeoyUDUSly7B -4f/xI4hROJ/yZlZ25w9Rl6VSDE1JUZU2Pb+iSwwQHYaZTKrzchGT5Or2m9qoXadN -t54CrnMAyNojA+j56hl0YgCUyyIgvpSnWbWCar6ZeXqp8kokUvd0/bpO5qgdAm6x -DYBEwa7TIzdfu4V8K5Iu6H6li92Z4b8nby1dqnuH/grdS/yO9SbkbnBCbjPsMZ57 -k8HkyWkaPcBrTiJt7qtYTcbQQcEr6k8Sh17rRdhs9ZgC06DYVYoGmRmioHfRMJ6s -zHXug/WwYjnPbFfiTNKRCw51KBuav/0aQ/HKd/s7j2G4aSgWQgRecCocIdiP4b0j -Wy10QJLZYxkNc91pvGJHvOB0K7Lrfb5BG7XARsWhIstfTsEokt4YutUqKLsRixeT -mJlglFwjz1onl14LBQaTNx47aTbrqZ5hHY8y2o4M1nQ+ewkk2gF3R8Q7zTSMmfXK -4SVhM7JZG+Ju1zdXtg2pEto= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIFYDCCA0igAwIBAgIULvWbAiin23r/1aOp7r0DoM8Sah0wDQYJKoZIhvcNAQEL -BQAwSDELMAkGA1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAc -BgNVBAMTFVF1b1ZhZGlzIFJvb3QgQ0EgMyBHMzAeFw0xMjAxMTIyMDI2MzJaFw00 -MjAxMTIyMDI2MzJaMEgxCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBM -aW1pdGVkMR4wHAYDVQQDExVRdW9WYWRpcyBSb290IENBIDMgRzMwggIiMA0GCSqG -SIb3DQEBAQUAA4ICDwAwggIKAoICAQCzyw4QZ47qFJenMioKVjZ/aEzHs286IxSR -/xl/pcqs7rN2nXrpixurazHb+gtTTK/FpRp5PIpM/6zfJd5O2YIyC0TeytuMrKNu -FoM7pmRLMon7FhY4futD4tN0SsJiCnMK3UmzV9KwCoWdcTzeo8vAMvMBOSBDGzXR -U7Ox7sWTaYI+FrUoRqHe6okJ7UO4BUaKhvVZR74bbwEhELn9qdIoyhA5CcoTNs+c -ra1AdHkrAj80//ogaX3T7mH1urPnMNA3I4ZyYUUpSFlob3emLoG+B01vr87ERROR -FHAGjx+f+IdpsQ7vw4kZ6+ocYfx6bIrc1gMLnia6Et3UVDmrJqMz6nWB2i3ND0/k -A9HvFZcba5DFApCTZgIhsUfei5pKgLlVj7WiL8DWM2fafsSntARE60f75li59wzw -eyuxwHApw0BiLTtIadwjPEjrewl5qW3aqDCYz4ByA4imW0aucnl8CAMhZa634Ryl -sSqiMd5mBPfAdOhx3v89WcyWJhKLhZVXGqtrdQtEPREoPHtht+KPZ0/l7DxMYIBp -VzgeAVuNVejH38DMdyM0SXV89pgR6y3e7UEuFAUCf+D+IOs15xGsIs5XPd7JMG0Q -A4XN8f+MFrXBsj6IbGB/kE+V9/YtrQE5BwT6dYB9v0lQ7e/JxHwc64B+27bQ3RP+ -ydOc17KXqQIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIB -BjAdBgNVHQ4EFgQUxhfQvKjqAkPyGwaZXSuQILnXnOQwDQYJKoZIhvcNAQELBQAD -ggIBADRh2Va1EodVTd2jNTFGu6QHcrxfYWLopfsLN7E8trP6KZ1/AvWkyaiTt3px -KGmPc+FSkNrVvjrlt3ZqVoAh313m6Tqe5T72omnHKgqwGEfcIHB9UqM+WXzBusnI -FUBhynLWcKzSt/Ac5IYp8M7vaGPQtSCKFWGafoaYtMnCdvvMujAWzKNhxnQT5Wvv -oxXqA/4Ti2Tk08HS6IT7SdEQTXlm66r99I0xHnAUrdzeZxNMgRVhvLfZkXdxGYFg -u/BYpbWcC/ePIlUnwEsBbTuZDdQdm2NnL9DuDcpmvJRPpq3t/O5jrFc/ZSXPsoaP -0Aj/uHYUbt7lJ+yreLVTubY/6CD50qi+YUbKh4yE8/nxoGibIh6BJpsQBJFxwAYf -3KDTuVan45gtf4Od34wrnDKOMpTwATwiKp9Dwi7DmDkHOHv8XgBCH/MyJnmDhPbl -8MFREsALHgQjDFSlTC9JxUrRtm5gDWv8a4uFJGS3iQ6rJUdbPM9+Sb3H6QrG2vd+ -DhcI00iX0HGS8A85PjRqHH3Y8iKuu2n0M7SmSFXRDw4m6Oy2Cy2nhTXN/VnIn9HN -PlopNLk9hM6xZdRZkZFWdSHBd575euFgndOtBBj0fOtek49TSiIp+EgrPk2GrFt/ -ywaZWWDYWGWVjUTR939+J399roD1B0y2PpxxVJkES/1Y+Zj0 ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDYTCCAkmgAwIBAgIQCgEBAQAAAnwAAAAKAAAAAjANBgkqhkiG9w0BAQUFADA6 -MRkwFwYDVQQKExBSU0EgU2VjdXJpdHkgSW5jMR0wGwYDVQQLExRSU0EgU2VjdXJp -dHkgMjA0OCBWMzAeFw0wMTAyMjIyMDM5MjNaFw0yNjAyMjIyMDM5MjNaMDoxGTAX -BgNVBAoTEFJTQSBTZWN1cml0eSBJbmMxHTAbBgNVBAsTFFJTQSBTZWN1cml0eSAy -MDQ4IFYzMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAt49VcdKA3Xtp -eafwGFAyPGJn9gqVB93mG/Oe2dJBVGutn3y+Gc37RqtBaB4Y6lXIL5F4iSj7Jylg -/9+PjDvJSZu1pJTOAeo+tWN7fyb9Gd3AIb2E0S1PRsNO3Ng3OTsor8udGuorryGl -wSMiuLgbWhOHV4PR8CDn6E8jQrAApX2J6elhc5SYcSa8LWrg903w8bYqODGBDSnh -AMFRD0xS+ARaqn1y07iHKrtjEAMqs6FPDVpeRrc9DvV07Jmf+T0kgYim3WBU6JU2 -PcYJk5qjEoAAVZkZR73QpXzDuvsf9/UP+Ky5tfQ3mBMY3oVbtwyCO4dvlTlYMNpu -AWgXIszACwIDAQABo2MwYTAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIB -BjAfBgNVHSMEGDAWgBQHw1EwpKrpRa41JPr/JCwz0LGdjDAdBgNVHQ4EFgQUB8NR -MKSq6UWuNST6/yQsM9CxnYwwDQYJKoZIhvcNAQEFBQADggEBAF8+hnZuuDU8TjYc -HnmYv/3VEhF5Ug7uMYm83X/50cYVIeiKAVQNOvtUudZj1LGqlk2iQk3UUx+LEN5/ -Zb5gEydxiKRz44Rj0aRV4VCT5hsOedBnvEbIvz8XDZXmxpBp3ue0L96VfdASPz0+ -f00/FGj1EVDVwfSQpQgdMWD/YIwjVAqv/qFuxdF6Kmh4zx6CCiC0H63lhbJqaHVO -rSU3lIW+vaHU6rcMSzyd6BIA8F+sDeGscGNz9395nzIlQnQFgCi/vcEkllgVsRch -6YlL2weIZ/QVrXA+L02FO8K32/6YaCOJ4XQP3vTFhGMpG8zLB8kApKnXwiJPZ9d3 -7CAFYd4= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIGizCCBXOgAwIBAgIEO0XlaDANBgkqhkiG9w0BAQUFADBoMQswCQYDVQQGEwJF -UzEfMB0GA1UEChMWR2VuZXJhbGl0YXQgVmFsZW5jaWFuYTEPMA0GA1UECxMGUEtJ -R1ZBMScwJQYDVQQDEx5Sb290IENBIEdlbmVyYWxpdGF0IFZhbGVuY2lhbmEwHhcN -MDEwNzA2MTYyMjQ3WhcNMjEwNzAxMTUyMjQ3WjBoMQswCQYDVQQGEwJFUzEfMB0G -A1UEChMWR2VuZXJhbGl0YXQgVmFsZW5jaWFuYTEPMA0GA1UECxMGUEtJR1ZBMScw -JQYDVQQDEx5Sb290IENBIEdlbmVyYWxpdGF0IFZhbGVuY2lhbmEwggEiMA0GCSqG -SIb3DQEBAQUAA4IBDwAwggEKAoIBAQDGKqtXETcvIorKA3Qdyu0togu8M1JAJke+ -WmmmO3I2F0zo37i7L3bhQEZ0ZQKQUgi0/6iMweDHiVYQOTPvaLRfX9ptI6GJXiKj -SgbwJ/BXufjpTjJ3Cj9BZPPrZe52/lSqfR0grvPXdMIKX/UIKFIIzFVd0g/bmoGl -u6GzwZTNVOAydTGRGmKy3nXiz0+J2ZGQD0EbtFpKd71ng+CT516nDOeB0/RSrFOy -A8dEJvt55cs0YFAQexvba9dHq198aMpunUEDEO5rmXteJajCq+TA81yc477OMUxk -Hl6AovWDfgzWyoxVjr7gvkkHD6MkQXpYHYTqWBLI4bft75PelAgxAgMBAAGjggM7 -MIIDNzAyBggrBgEFBQcBAQQmMCQwIgYIKwYBBQUHMAGGFmh0dHA6Ly9vY3NwLnBr -aS5ndmEuZXMwEgYDVR0TAQH/BAgwBgEB/wIBAjCCAjQGA1UdIASCAiswggInMIIC -IwYKKwYBBAG/VQIBADCCAhMwggHoBggrBgEFBQcCAjCCAdoeggHWAEEAdQB0AG8A -cgBpAGQAYQBkACAAZABlACAAQwBlAHIAdABpAGYAaQBjAGEAYwBpAPMAbgAgAFIA -YQDtAHoAIABkAGUAIABsAGEAIABHAGUAbgBlAHIAYQBsAGkAdABhAHQAIABWAGEA -bABlAG4AYwBpAGEAbgBhAC4ADQAKAEwAYQAgAEQAZQBjAGwAYQByAGEAYwBpAPMA -bgAgAGQAZQAgAFAAcgDhAGMAdABpAGMAYQBzACAAZABlACAAQwBlAHIAdABpAGYA -aQBjAGEAYwBpAPMAbgAgAHEAdQBlACAAcgBpAGcAZQAgAGUAbAAgAGYAdQBuAGMA -aQBvAG4AYQBtAGkAZQBuAHQAbwAgAGQAZQAgAGwAYQAgAHAAcgBlAHMAZQBuAHQA -ZQAgAEEAdQB0AG8AcgBpAGQAYQBkACAAZABlACAAQwBlAHIAdABpAGYAaQBjAGEA -YwBpAPMAbgAgAHMAZQAgAGUAbgBjAHUAZQBuAHQAcgBhACAAZQBuACAAbABhACAA -ZABpAHIAZQBjAGMAaQDzAG4AIAB3AGUAYgAgAGgAdAB0AHAAOgAvAC8AdwB3AHcA -LgBwAGsAaQAuAGcAdgBhAC4AZQBzAC8AYwBwAHMwJQYIKwYBBQUHAgEWGWh0dHA6 -Ly93d3cucGtpLmd2YS5lcy9jcHMwHQYDVR0OBBYEFHs100DSHHgZZu90ECjcPk+y -eAT8MIGVBgNVHSMEgY0wgYqAFHs100DSHHgZZu90ECjcPk+yeAT8oWykajBoMQsw -CQYDVQQGEwJFUzEfMB0GA1UEChMWR2VuZXJhbGl0YXQgVmFsZW5jaWFuYTEPMA0G -A1UECxMGUEtJR1ZBMScwJQYDVQQDEx5Sb290IENBIEdlbmVyYWxpdGF0IFZhbGVu -Y2lhbmGCBDtF5WgwDQYJKoZIhvcNAQEFBQADggEBACRhTvW1yEICKrNcda3Fbcrn -lD+laJWIwVTAEGmiEi8YPyVQqHxK6sYJ2fR1xkDar1CdPaUWu20xxsdzCkj+IHLt -b8zog2EWRpABlUt9jppSCS/2bxzkoXHPjCpaF3ODR00PNvsETUlR4hTJZGH71BTg -9J63NI8KJr2XXPR5OkowGcytT6CYirQxlyric21+eLj4iIlPsSKRZEv1UN4D2+XF -ducTZnV+ZfsBn5OHiJ35Rld8TWCvmHMTI6QgkYH60GFmuH3Rr9ZvHmw96RH9qfmC -IoaZM3Fa6hlXPZHNqcCjbgcTpsnt+GijnsNacgmHKNHEc8RzGF9QdRYxn7fofMM= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDbTCCAlWgAwIBAgIBATANBgkqhkiG9w0BAQUFADBYMQswCQYDVQQGEwJKUDEr -MCkGA1UEChMiSmFwYW4gQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcywgSW5jLjEcMBoG -A1UEAxMTU2VjdXJlU2lnbiBSb290Q0ExMTAeFw0wOTA0MDgwNDU2NDdaFw0yOTA0 -MDgwNDU2NDdaMFgxCzAJBgNVBAYTAkpQMSswKQYDVQQKEyJKYXBhbiBDZXJ0aWZp -Y2F0aW9uIFNlcnZpY2VzLCBJbmMuMRwwGgYDVQQDExNTZWN1cmVTaWduIFJvb3RD -QTExMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA/XeqpRyQBTvLTJsz -i1oURaTnkBbR31fSIRCkF/3frNYfp+TbfPfs37gD2pRY/V1yfIw/XwFndBWW4wI8 -h9uuywGOwvNmxoVF9ALGOrVisq/6nL+k5tSAMJjzDbaTj6nU2DbysPyKyiyhFTOV -MdrAG/LuYpmGYz+/3ZMqg6h2uRMft85OQoWPIucuGvKVCbIFtUROd6EgvanyTgp9 -UK31BQ1FT0Zx/Sg+U/sE2C3XZR1KG/rPO7AxmjVuyIsG0wCR8pQIZUyxNAYAeoni -8McDWc/V1uinMrPmmECGxc0nEovMe863ETxiYAcjPitAbpSACW22s293bzUIUPsC -h8U+iQIDAQABo0IwQDAdBgNVHQ4EFgQUW/hNT7KlhtQ60vFjmqC+CfZXt94wDgYD -VR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEB -AKChOBZmLqdWHyGcBvod7bkixTgm2E5P7KN/ed5GIaGHd48HCJqypMWvDzKYC3xm -KbabfSVSSUOrTC4rbnpwrxYO4wJs+0LmGJ1F2FXI6Dvd5+H0LgscNFxsWEr7jIhQ -X5Ucv+2rIrVls4W6ng+4reV6G4pQOh29Dbx7VFALuUKvVaAYga1lme++5Jy/xIWr -QbJUb9wlze144o4MjQlJ3WN7WmmWAiGovVJZ6X01y8hSyn+B/tlr0/cR7SXf+Of5 -pPpyl4RTDaXQMhhRdlkUbA/r7F+AjHVDg8OFmP9Mni0N5HeDk061lgeLKBObjBmN -QSdJQO7e5iNEOdyhIta6A/I= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDuDCCAqCgAwIBAgIQDPCOXAgWpa1Cf/DrJxhZ0DANBgkqhkiG9w0BAQUFADBI -MQswCQYDVQQGEwJVUzEgMB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24x -FzAVBgNVBAMTDlNlY3VyZVRydXN0IENBMB4XDTA2MTEwNzE5MzExOFoXDTI5MTIz -MTE5NDA1NVowSDELMAkGA1UEBhMCVVMxIDAeBgNVBAoTF1NlY3VyZVRydXN0IENv -cnBvcmF0aW9uMRcwFQYDVQQDEw5TZWN1cmVUcnVzdCBDQTCCASIwDQYJKoZIhvcN -AQEBBQADggEPADCCAQoCggEBAKukgeWVzfX2FI7CT8rU4niVWJxB4Q2ZQCQXOZEz -Zum+4YOvYlyJ0fwkW2Gz4BERQRwdbvC4u/jep4G6pkjGnx29vo6pQT64lO0pGtSO -0gMdA+9tDWccV9cGrcrI9f4Or2YlSASWC12juhbDCE/RRvgUXPLIXgGZbf2IzIao -wW8xQmxSPmjL8xk037uHGFaAJsTQ3MBv396gwpEWoGQRS0S8Hvbn+mPeZqx2pHGj -7DaUaHp3pLHnDi+BeuK1cobvomuL8A/b01k/unK8RCSc43Oz969XL0Imnal0ugBS -8kvNU3xHCzaFDmapCJcWNFfBZveA4+1wVMeT4C4oFVmHursCAwEAAaOBnTCBmjAT -BgkrBgEEAYI3FAIEBh4EAEMAQTALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB -/zAdBgNVHQ4EFgQUQjK2FvoE/f5dS3rD/fdMQB1aQ68wNAYDVR0fBC0wKzApoCeg -JYYjaHR0cDovL2NybC5zZWN1cmV0cnVzdC5jb20vU1RDQS5jcmwwEAYJKwYBBAGC -NxUBBAMCAQAwDQYJKoZIhvcNAQEFBQADggEBADDtT0rhWDpSclu1pqNlGKa7UTt3 -6Z3q059c4EVlew3KW+JwULKUBRSuSceNQQcSc5R+DCMh/bwQf2AQWnL1mA6s7Ll/ -3XpvXdMc9P+IBWlCqQVxyLesJugutIxq/3HcuLHfmbx8IVQr5Fiiu1cprp6poxkm -D5kuCLDv/WnPmRoJjeOnnyvJNjR7JLN4TJUXpAYmHrZkUjZfYGfZnMUFdAvnZyPS -CPyI6a6Lf+Ew9Dd+/cYy2i2eRDAwbO4H3tI0/NL/QPZL9GZGBlSm8jIKYyYwa5vR -3ItHuuG51WLQoqD0ZwV4KWMabwTW+MZMo5qxN7SN5ShLHZ4swrhovO0C7jE= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDvDCCAqSgAwIBAgIQB1YipOjUiolN9BPI8PjqpTANBgkqhkiG9w0BAQUFADBK -MQswCQYDVQQGEwJVUzEgMB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24x -GTAXBgNVBAMTEFNlY3VyZSBHbG9iYWwgQ0EwHhcNMDYxMTA3MTk0MjI4WhcNMjkx -MjMxMTk1MjA2WjBKMQswCQYDVQQGEwJVUzEgMB4GA1UEChMXU2VjdXJlVHJ1c3Qg -Q29ycG9yYXRpb24xGTAXBgNVBAMTEFNlY3VyZSBHbG9iYWwgQ0EwggEiMA0GCSqG -SIb3DQEBAQUAA4IBDwAwggEKAoIBAQCvNS7YrGxVaQZx5RNoJLNP2MwhR/jxYDiJ -iQPpvepeRlMJ3Fz1Wuj3RSoC6zFh1ykzTM7HfAo3fg+6MpjhHZevj8fcyTiW89sa -/FHtaMbQbqR8JNGuQsiWUGMu4P51/pinX0kuleM5M2SOHqRfkNJnPLLZ/kG5VacJ -jnIFHovdRIWCQtBJwB1g8NEXLJXr9qXBkqPFwqcIYA1gBBCWeZ4WNOaptvolRTnI -HmX5k/Wq8VLcmZg9pYYaDDUz+kulBAYVHDGA76oYa8J719rO+TMg1fW9ajMtgQT7 -sFzUnKPiXB3jqUJ1XnvUd+85VLrJChgbEplJL4hL/VBi0XPnj3pDAgMBAAGjgZ0w -gZowEwYJKwYBBAGCNxQCBAYeBABDAEEwCwYDVR0PBAQDAgGGMA8GA1UdEwEB/wQF -MAMBAf8wHQYDVR0OBBYEFK9EBMJBfkiD2045AuzshHrmzsmkMDQGA1UdHwQtMCsw -KaAnoCWGI2h0dHA6Ly9jcmwuc2VjdXJldHJ1c3QuY29tL1NHQ0EuY3JsMBAGCSsG -AQQBgjcVAQQDAgEAMA0GCSqGSIb3DQEBBQUAA4IBAQBjGghAfaReUw132HquHw0L -URYD7xh8yOOvaliTFGCRsoTciE6+OYo68+aCiV0BN7OrJKQVDpI1WkpEXk5X+nXO -H0jOZvQ8QCaSmGwb7iRGDBezUqXbpZGRzzfTb+cnCDpOGR86p1hcF895P4vkp9Mm -I50mD1hp/Ed+stCNi5O/KU9DaXR2Z0vPB4zmAve14bRDtUstFJ/53CYNv6ZHdAbY -iNE6KTCEztI5gGIbqMdXSbxqVVFnFUq+NQfk1XWYN3kwFNspnWzFacxHVaIw98xc -f8LDmBxrThaA63p4ZUWiABqvDA1VZDRIuJK58bRQKfJPIx/abKwfROHdI3hRW8cW ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDfTCCAmWgAwIBAgIBADANBgkqhkiG9w0BAQUFADBgMQswCQYDVQQGEwJKUDEl -MCMGA1UEChMcU0VDT00gVHJ1c3QgU3lzdGVtcyBDTy4sTFRELjEqMCgGA1UECxMh -U2VjdXJpdHkgQ29tbXVuaWNhdGlvbiBFViBSb290Q0ExMB4XDTA3MDYwNjAyMTIz -MloXDTM3MDYwNjAyMTIzMlowYDELMAkGA1UEBhMCSlAxJTAjBgNVBAoTHFNFQ09N -IFRydXN0IFN5c3RlbXMgQ08uLExURC4xKjAoBgNVBAsTIVNlY3VyaXR5IENvbW11 -bmljYXRpb24gRVYgUm9vdENBMTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC -ggEBALx/7FebJOD+nLpCeamIivqA4PUHKUPqjgo0No0c+qe1OXj/l3X3L+SqawSE -RMqm4miO/VVQYg+kcQ7OBzgtQoVQrTyWb4vVog7P3kmJPdZkLjjlHmy1V4qe70gO -zXppFodEtZDkBp2uoQSXWHnvIEqCa4wiv+wfD+mEce3xDuS4GBPMVjZd0ZoeUWs5 -bmB2iDQL87PRsJ3KYeJkHcFGB7hj3R4zZbOOCVVSPbW9/wfrrWFVGCypaZhKqkDF -MxRldAD5kd6vA0jFQFTcD4SQaCDFkpbcLuUCRarAX1T4bepJz11sS6/vmsJWXMY1 -VkJqMF/Cq/biPT+zyRGPMUzXn0kCAwEAAaNCMEAwHQYDVR0OBBYEFDVK9U2vP9eC -OKyrcWUXdYydVZPmMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MA0G -CSqGSIb3DQEBBQUAA4IBAQCoh+ns+EBnXcPBZsdAS5f8hxOQWsTvoMpfi7ent/HW -tWS3irO4G8za+6xmiEHO6Pzk2x6Ipu0nUBsCMCRGef4Eh3CXQHPRwMFXGZpppSeZ -q51ihPZRwSzJIxXYKLerJRO1RuGGAv8mjMSIkh1W/hln8lXkgKNrnKt34VFxDSDb -EJrbvXZ5B3eZKK2aXtqxT0QsNY6llsf9g/BYxnnWmHyojf6GPgcWkuF75x3sM3Z+ -Qi5KhfmRiWiEA4Glm5q+4zfFVKtWOxgtQaQM+ELbmaDgcm+7XeEWT1MKZPlO9L9O -VL14bIjqv5wTJMJwaaJ/D8g8rQjJsJhAoyrniIPtd490 ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDdzCCAl+gAwIBAgIBADANBgkqhkiG9w0BAQsFADBdMQswCQYDVQQGEwJKUDEl -MCMGA1UEChMcU0VDT00gVHJ1c3QgU3lzdGVtcyBDTy4sTFRELjEnMCUGA1UECxMe -U2VjdXJpdHkgQ29tbXVuaWNhdGlvbiBSb290Q0EyMB4XDTA5MDUyOTA1MDAzOVoX -DTI5MDUyOTA1MDAzOVowXTELMAkGA1UEBhMCSlAxJTAjBgNVBAoTHFNFQ09NIFRy -dXN0IFN5c3RlbXMgQ08uLExURC4xJzAlBgNVBAsTHlNlY3VyaXR5IENvbW11bmlj -YXRpb24gUm9vdENBMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANAV -OVKxUrO6xVmCxF1SrjpDZYBLx/KWvNs2l9amZIyoXvDjChz335c9S672XewhtUGr -zbl+dp+++T42NKA7wfYxEUV0kz1XgMX5iZnK5atq1LXaQZAQwdbWQonCv/Q4EpVM -VAX3NuRFg3sUZdbcDE3R3n4MqzvEFb46VqZab3ZpUql6ucjrappdUtAtCms1FgkQ -hNBqyjoGADdH5H5XTz+L62e4iKrFvlNVspHEfbmwhRkGeC7bYRr6hfVKkaHnFtWO -ojnflLhwHyg/i/xAXmODPIMqGplrz95Zajv8bxbXH/1KEOtOghY6rCcMU/Gt1SSw -awNQwS08Ft1ENCcadfsCAwEAAaNCMEAwHQYDVR0OBBYEFAqFqXdlBZh8QIH4D5cs -OPEK7DzPMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3 -DQEBCwUAA4IBAQBMOqNErLlFsceTfsgLCkLfZOoc7llsCLqJX2rKSpWeeo8HxdpF -coJxDjrSzG+ntKEju/Ykn8sX/oymzsLS28yN/HH8AynBbF0zX2S2ZTuJbxh2ePXc -okgfGT+Ok+vx+hfuzU7jBBJV1uXk3fs+BXziHV7Gp7yXT2g69ekuCkO2r1dcYmh8 -t/2jioSgrGK+KwmHNPBqAbubKVY8/gA3zyNs8U6qtnRGEmyR7jTV7JqR50S+kDFy -1UkC9gLl9B/rfNmWVan/7Ir5mUf/NVoCqgTLiluHcSmRvaS0eg29mvVXIwAHIRc/ -SjnRBUkLp7Y3gaVdjKozXoEofKd9J+sAro03 ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDWjCCAkKgAwIBAgIBADANBgkqhkiG9w0BAQUFADBQMQswCQYDVQQGEwJKUDEY -MBYGA1UEChMPU0VDT00gVHJ1c3QubmV0MScwJQYDVQQLEx5TZWN1cml0eSBDb21t -dW5pY2F0aW9uIFJvb3RDQTEwHhcNMDMwOTMwMDQyMDQ5WhcNMjMwOTMwMDQyMDQ5 -WjBQMQswCQYDVQQGEwJKUDEYMBYGA1UEChMPU0VDT00gVHJ1c3QubmV0MScwJQYD -VQQLEx5TZWN1cml0eSBDb21tdW5pY2F0aW9uIFJvb3RDQTEwggEiMA0GCSqGSIb3 -DQEBAQUAA4IBDwAwggEKAoIBAQCzs/5/022x7xZ8V6UMbXaKL0u/ZPtM7orw8yl8 -9f/uKuDp6bpbZCKamm8sOiZpUQWZJtzVHGpxxpp9Hp3dfGzGjGdnSj74cbAZJ6kJ -DKaVv0uMDPpVmDvY6CKhS3E4eayXkmmziX7qIWgGmBSWh9JhNrxtJ1aeV+7AwFb9 -Ms+k2Y7CI9eNqPPYJayX5HA49LY6tJ07lyZDo6G8SVlyTCMwhwFY9k6+HGhWZq/N -QV3Is00qVUarH9oe4kA92819uZKAnDfdDJZkndwi92SL32HeFZRSFaB9UslLqCHJ -xrHty8OVYNEP8Ktw+N/LTX7s1vqr2b1/VPKl6Xn62dZ2JChzAgMBAAGjPzA9MB0G -A1UdDgQWBBSgc0mZaNyFW2XjmygvV5+9M7wHSDALBgNVHQ8EBAMCAQYwDwYDVR0T -AQH/BAUwAwEB/zANBgkqhkiG9w0BAQUFAAOCAQEAaECpqLvkT115swW1F7NgE+vG -kl3g0dNq/vu+m22/xwVtWSDEHPC32oRYAmP6SBbvT6UL90qY8j+eG61Ha2POCEfr -Uj94nK9NrvjVT8+amCoQQTlSxN3Zmw7vkwGusi7KaEIkQmywszo+zenaSMQVy+n5 -Bw+SUEmK3TGXX8npN6o7WWWXlDLJs58+OmJYxUmtYg5xpTKqL8aJdkNAExNnPaJU -JRDL8Try2frbSVa7pv6nQTXD4IhhyYjH3zYQIphZ6rBK+1YWc26sTfcioU+tHXot -RSflMMFe8toTyyVCUZVHA4xsIcx0Qu1T/zOLjw9XARYvz6buyXAiFL39vmwLAw== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDIDCCAgigAwIBAgIBHTANBgkqhkiG9w0BAQUFADA5MQswCQYDVQQGEwJGSTEP -MA0GA1UEChMGU29uZXJhMRkwFwYDVQQDExBTb25lcmEgQ2xhc3MyIENBMB4XDTAx -MDQwNjA3Mjk0MFoXDTIxMDQwNjA3Mjk0MFowOTELMAkGA1UEBhMCRkkxDzANBgNV -BAoTBlNvbmVyYTEZMBcGA1UEAxMQU29uZXJhIENsYXNzMiBDQTCCASIwDQYJKoZI -hvcNAQEBBQADggEPADCCAQoCggEBAJAXSjWdyvANlsdE+hY3/Ei9vX+ALTU74W+o -Z6m/AxxNjG8yR9VBaKQTBME1DJqEQ/xcHf+Js+gXGM2RX/uJ4+q/Tl18GybTdXnt -5oTjV+WtKcT0OijnpXuENmmz/V52vaMtmdOQTiMofRhj8VQ7Jp12W5dCsv+u8E7s -3TmVToMGf+dJQMjFAbJUWmYdPfz56TwKnoG4cPABi+QjVHzIrviQHgCWctRUz2Ej -vOr7nQKV0ba5cTppCD8PtOFCx4j1P5iop7oc4HFx71hXgVB6XGt0Rg6DA5jDjqhu -8nYybieDwnPz3BjotJPqdURrBGAgcVeHnfO+oJAjPYok4doh28MCAwEAAaMzMDEw -DwYDVR0TAQH/BAUwAwEB/zARBgNVHQ4ECgQISqCqWITTXjwwCwYDVR0PBAQDAgEG -MA0GCSqGSIb3DQEBBQUAA4IBAQBazof5FnIVV0sd2ZvnoiYw7JNn39Yt0jSv9zil -zqsWuasvfDXLrNAPtEwr/IDva4yRXzZ299uzGxnq9LIR/WFxRL8oszodv7ND6J+/ -3DEIcbCdjdY0RzKQxmUk96BKfARzjzlvF4xytb1LyHr4e4PDKE6cCepnP7JnBBvD -FNr450kkkdAdavphOe9r5yF1BgfYErQhIHBCcYHaPJo2vqZbDWpsmh+Re/n570K6 -Tk6ezAyNlNzZRZxe7EJQY670XcSxEtzKO6gunRRaBXW37Ndj4ro1tgQIkejanZz2 -ZrUYrAqmVCY0M9IbwdR/GjqOC6oybtv8TyWf2TLHllpwrN9M ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIFcDCCA1igAwIBAgIEAJiWjTANBgkqhkiG9w0BAQsFADBYMQswCQYDVQQGEwJO -TDEeMBwGA1UECgwVU3RhYXQgZGVyIE5lZGVybGFuZGVuMSkwJwYDVQQDDCBTdGFh -dCBkZXIgTmVkZXJsYW5kZW4gRVYgUm9vdCBDQTAeFw0xMDEyMDgxMTE5MjlaFw0y -MjEyMDgxMTEwMjhaMFgxCzAJBgNVBAYTAk5MMR4wHAYDVQQKDBVTdGFhdCBkZXIg -TmVkZXJsYW5kZW4xKTAnBgNVBAMMIFN0YWF0IGRlciBOZWRlcmxhbmRlbiBFViBS -b290IENBMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA48d+ifkkSzrS -M4M1LGns3Amk41GoJSt5uAg94JG6hIXGhaTK5skuU6TJJB79VWZxXSzFYGgEt9nC -UiY4iKTWO0Cmws0/zZiTs1QUWJZV1VD+hq2kY39ch/aO5ieSZxeSAgMs3NZmdO3d -Z//BYY1jTw+bbRcwJu+r0h8QoPnFfxZpgQNH7R5ojXKhTbImxrpsX23Wr9GxE46p -rfNeaXUmGD5BKyF/7otdBwadQ8QpCiv8Kj6GyzyDOvnJDdrFmeK8eEEzduG/L13l -pJhQDBXd4Pqcfzho0LKmeqfRMb1+ilgnQ7O6M5HTp5gVXJrm0w912fxBmJc+qiXb -j5IusHsMX/FjqTf5m3VpTCgmJdrV8hJwRVXj33NeN/UhbJCONVrJ0yPr08C+eKxC -KFhmpUZtcALXEPlLVPxdhkqHz3/KRawRWrUgUY0viEeXOcDPusBCAUCZSCELa6fS -/ZbV0b5GnUngC6agIk440ME8MLxwjyx1zNDFjFE7PZQIZCZhfbnDZY8UnCHQqv0X -cgOPvZuM5l5Tnrmd74K74bzickFbIZTTRTeU0d8JOV3nI6qaHcptqAqGhYqCvkIH -1vI4gnPah1vlPNOePqc7nvQDs/nxfRN0Av+7oeX6AHkcpmZBiFxgV6YuCcS6/ZrP -px9Aw7vMWgpVSzs4dlG4Y4uElBbmVvMCAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB -/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFP6rAJCYniT8qcwaivsnuL8wbqg7 -MA0GCSqGSIb3DQEBCwUAA4ICAQDPdyxuVr5Os7aEAJSrR8kN0nbHhp8dB9O2tLsI -eK9p0gtJ3jPFrK3CiAJ9Brc1AsFgyb/E6JTe1NOpEyVa/m6irn0F3H3zbPB+po3u -2dfOWBfoqSmuc0iH55vKbimhZF8ZE/euBhD/UcabTVUlT5OZEAFTdfETzsemQUHS -v4ilf0X8rLiltTMMgsT7B/Zq5SWEXwbKwYY5EdtYzXc7LMJMD16a4/CrPmEbUCTC -wPTxGfARKbalGAKb12NMcIxHowNDXLldRqANb/9Zjr7dn3LDWyvfjFvO5QxGbJKy -CqNMVEIYFRIYvdr8unRu/8G2oGTYqV9Vrp9canaW2HNnh/tNf1zuacpzEPuKqf2e -vTY4SUmH9A4U8OmHuD+nT3pajnnUk+S7aFKErGzp85hwVXIy+TSrK0m1zSBi5Dp6 -Z2Orltxtrpfs/J92VoguZs9btsmksNcFuuEnL5O7Jiqik7Ab846+HUCjuTaPPoIa -Gl6I6lD4WeKDRikL40Rc4ZW2aZCaFG+XroHPaO+Zmr615+F/+PoTRxZMzG0IQOeL -eG9QgkRQP2YGiqtDhFZKDyAthg710tvSeopLzaXoTvFeJiUBWSOgftL2fiFX1ye8 -FVdMpEbB4IMeDExNH08GGeL5qPQ6gqGyeUN51q1veieQA6TqJIc/2b3Z6fJfUEkc -7uzXLg== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDujCCAqKgAwIBAgIEAJiWijANBgkqhkiG9w0BAQUFADBVMQswCQYDVQQGEwJO -TDEeMBwGA1UEChMVU3RhYXQgZGVyIE5lZGVybGFuZGVuMSYwJAYDVQQDEx1TdGFh -dCBkZXIgTmVkZXJsYW5kZW4gUm9vdCBDQTAeFw0wMjEyMTcwOTIzNDlaFw0xNTEy -MTYwOTE1MzhaMFUxCzAJBgNVBAYTAk5MMR4wHAYDVQQKExVTdGFhdCBkZXIgTmVk -ZXJsYW5kZW4xJjAkBgNVBAMTHVN0YWF0IGRlciBOZWRlcmxhbmRlbiBSb290IENB -MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmNK1URF6gaYUmHFtvszn -ExvWJw56s2oYHLZhWtVhCb/ekBPHZ+7d89rFDBKeNVU+LCeIQGv33N0iYfXCxw71 -9tV2U02PjLwYdjeFnejKScfST5gTCaI+Ioicf9byEGW07l8Y1Rfj+MX94p2i71MO -hXeiD+EwR+4A5zN9RGcaC1Hoi6CeUJhoNFIfLm0B8mBF8jHrqTFoKbt6QZ7GGX+U -tFE5A3+y3qcym7RHjm+0Sq7lr7HcsBthvJly3uSJt3omXdozSVtSnA71iq3DuD3o -BmrC1SoLbHuEvVYFy4ZlkuxEK7COudxwC0barbxjiDn622r+I/q85Ej0ZytqERAh -SQIDAQABo4GRMIGOMAwGA1UdEwQFMAMBAf8wTwYDVR0gBEgwRjBEBgRVHSAAMDww -OgYIKwYBBQUHAgEWLmh0dHA6Ly93d3cucGtpb3ZlcmhlaWQubmwvcG9saWNpZXMv -cm9vdC1wb2xpY3kwDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBSofeu8Y6R0E3QA -7Jbg0zTBLL9s+DANBgkqhkiG9w0BAQUFAAOCAQEABYSHVXQ2YcG70dTGFagTtJ+k -/rvuFbQvBgwp8qiSpGEN/KtcCFtREytNwiphyPgJWPwtArI5fZlmgb9uXJVFIGzm -eafR2Bwp/MIgJ1HI8XxdNGdphREwxgDS1/PTfLbwMVcoEoJz6TMvplW0C5GUR5z6 -u3pCMuiufi3IvKwUv9kP2Vv8wfl6leF9fpb8cbDCTMjfRTTJzg3ynGQI0DvDKcWy -7ZAEwbEpkcUwb8GpcjPM/l0WFywRaed+/sWDCN+83CI6LiBpIzlWYGeQiy52OfsR -iJf2fL1LuCAWZwWN4jvBcj+UlTfHXbme2JOhF4//DGYVwSR8MnwDHTuhWEUykw== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIFyjCCA7KgAwIBAgIEAJiWjDANBgkqhkiG9w0BAQsFADBaMQswCQYDVQQGEwJO -TDEeMBwGA1UECgwVU3RhYXQgZGVyIE5lZGVybGFuZGVuMSswKQYDVQQDDCJTdGFh -dCBkZXIgTmVkZXJsYW5kZW4gUm9vdCBDQSAtIEcyMB4XDTA4MDMyNjExMTgxN1oX -DTIwMDMyNTExMDMxMFowWjELMAkGA1UEBhMCTkwxHjAcBgNVBAoMFVN0YWF0IGRl -ciBOZWRlcmxhbmRlbjErMCkGA1UEAwwiU3RhYXQgZGVyIE5lZGVybGFuZGVuIFJv -b3QgQ0EgLSBHMjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMVZ5291 -qj5LnLW4rJ4L5PnZyqtdj7U5EILXr1HgO+EASGrP2uEGQxGZqhQlEq0i6ABtQ8Sp -uOUfiUtnvWFI7/3S4GCI5bkYYCjDdyutsDeqN95kWSpGV+RLufg3fNU254DBtvPU -Z5uW6M7XxgpT0GtJlvOjCwV3SPcl5XCsMBQgJeN/dVrlSPhOewMHBPqCYYdu8DvE -pMfQ9XQ+pV0aCPKbJdL2rAQmPlU6Yiile7Iwr/g3wtG61jj99O9JMDeZJiFIhQGp -5Rbn3JBV3w/oOM2ZNyFPXfUib2rFEhZgF1XyZWampzCROME4HYYEhLoaJXhena/M -UGDWE4dS7WMfbWV9whUYdMrhfmQpjHLYFhN9C0lK8SgbIHRrxT3dsKpICT0ugpTN -GmXZK4iambwYfp/ufWZ8Pr2UuIHOzZgweMFvZ9C+X+Bo7d7iscksWXiSqt8rYGPy -5V6548r6f1CGPqI0GAwJaCgRHOThuVw+R7oyPxjMW4T182t0xHJ04eOLoEq9jWYv -6q012iDTiIJh8BIitrzQ1aTsr1SIJSQ8p22xcik/Plemf1WvbibG/ufMQFxRRIEK -eN5KzlW/HdXZt1bv8Hb/C3m1r737qWmRRpdogBQ2HbN/uymYNqUg+oJgYjOk7Na6 -B6duxc8UpufWkjTYgfX8HV2qXB72o007uPc5AgMBAAGjgZcwgZQwDwYDVR0TAQH/ -BAUwAwEB/zBSBgNVHSAESzBJMEcGBFUdIAAwPzA9BggrBgEFBQcCARYxaHR0cDov -L3d3dy5wa2lvdmVyaGVpZC5ubC9wb2xpY2llcy9yb290LXBvbGljeS1HMjAOBgNV -HQ8BAf8EBAMCAQYwHQYDVR0OBBYEFJFoMocVHYnitfGsNig0jQt8YojrMA0GCSqG -SIb3DQEBCwUAA4ICAQCoQUpnKpKBglBu4dfYszk78wIVCVBR7y29JHuIhjv5tLyS -CZa59sCrI2AGeYwRTlHSeYAz+51IvuxBQ4EffkdAHOV6CMqqi3WtFMTC6GY8ggen -5ieCWxjmD27ZUD6KQhgpxrRW/FYQoAUXvQwjf/ST7ZwaUb7dRUG/kSS0H4zpX897 -IZmflZ85OkYcbPnNe5yQzSipx6lVu6xiNGI1E0sUOlWDuYaNkqbG9AclVMwWVxJK -gnjIFNkXgiYtXSAfea7+1HAWFpWD2DU5/1JddRwWxRNVz0fMdWVSSt7wsKfkCpYL -+63C4iWEst3kvX5ZbJvw8NjnyvLplzh+ib7M+zkXYT9y2zqR2GUBGR2tUKRXCnxL -vJxxcypFURmFzI79R6d0lR2o0a9OF7FpJsKqeFdbxU2n5Z4FF5TKsl+gSRiNNOkm -bEgeqmiSBeGCc1qb3AdbCG19ndeNIdn8FCCqwkXfP+cAslHkwvgFuXkajDTznlvk -N1trSt8sV4pAWja63XVECDdCcAz+3F4hoKOKwJCcaNpQ5kUQR3i2TtJlycM33+FC -Y7BXN0Ute4qcvwXqZVUz9zkQxSgqIXobisQk+T8VyJoVIPVVYpbtbZNQvOSqeK3Z -ywplh6ZmwcSBo3c6WB4L7oOLnR7SUqTMHW+wmG2UMbX4cQrcufx9MmDm66+KAQ== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIFdDCCA1ygAwIBAgIEAJiiOTANBgkqhkiG9w0BAQsFADBaMQswCQYDVQQGEwJO -TDEeMBwGA1UECgwVU3RhYXQgZGVyIE5lZGVybGFuZGVuMSswKQYDVQQDDCJTdGFh -dCBkZXIgTmVkZXJsYW5kZW4gUm9vdCBDQSAtIEczMB4XDTEzMTExNDExMjg0MloX -DTI4MTExMzIzMDAwMFowWjELMAkGA1UEBhMCTkwxHjAcBgNVBAoMFVN0YWF0IGRl -ciBOZWRlcmxhbmRlbjErMCkGA1UEAwwiU3RhYXQgZGVyIE5lZGVybGFuZGVuIFJv -b3QgQ0EgLSBHMzCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAL4yolQP -cPssXFnrbMSkUeiFKrPMSjTysF/zDsccPVMeiAho2G89rcKezIJnByeHaHE6n3WW -IkYFsO2tx1ueKt6c/DrGlaf1F2cY5y9JCAxcz+bMNO14+1Cx3Gsy8KL+tjzk7FqX -xz8ecAgwoNzFs21v0IJyEavSgWhZghe3eJJg+szeP4TrjTgzkApyI/o1zCZxMdFy -KJLZWyNtZrVtB0LrpjPOktvA9mxjeM3KTj215VKb8b475lRgsGYeCasH/lSJEULR -9yS6YHgamPfJEf0WwTUaVHXvQ9Plrk7O53vDxk5hUUurmkVLoR9BvUhTFXFkC4az -5S6+zqQbwSmEorXLCCN2QyIkHxcE1G6cxvx/K2Ya7Irl1s9N9WMJtxU51nus6+N8 -6U78dULI7ViVDAZCopz35HCz33JvWjdAidiFpNfxC95DGdRKWCyMijmev4SH8RY7 -Ngzp07TKbBlBUgmhHbBqv4LvcFEhMtwFdozL92TkA1CvjJFnq8Xy7ljY3r735zHP -bMk7ccHViLVlvMDoFxcHErVc0qsgk7TmgoNwNsXNo42ti+yjwUOH5kPiNL6VizXt -BznaqB16nzaeErAMZRKQFWDZJkBE41ZgpRDUajz9QdwOWke275dhdU/Z/seyHdTt -XUmzqWrLZoQT1Vyg3N9udwbRcXXIV2+vD3dbAgMBAAGjQjBAMA8GA1UdEwEB/wQF -MAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBRUrfrHkleuyjWcLhL75Lpd -INyUVzANBgkqhkiG9w0BAQsFAAOCAgEAMJmdBTLIXg47mAE6iqTnB/d6+Oea31BD -U5cqPco8R5gu4RV78ZLzYdqQJRZlwJ9UXQ4DO1t3ApyEtg2YXzTdO2PCwyiBwpwp -LiniyMMB8jPqKqrMCQj3ZWfGzd/TtiunvczRDnBfuCPRy5FOCvTIeuXZYzbB1N/8 -Ipf3YF3qKS9Ysr1YvY2WTxB1v0h7PVGHoTx0IsL8B3+A3MSs/mrBcDCw6Y5p4ixp -gZQJut3+TcCDjJRYwEYgr5wfAvg1VUkvRtTA8KCWAg8zxXHzniN9lLf9OtMJgwYh -/WA9rjLA0u6NpvDntIJ8CsxwyXmA+P5M9zWEGYox+wrZ13+b8KKaa8MFSu1BYBQw -0aoRQm7TIwIEC8Zl3d1Sd9qBa7Ko+gE4uZbqKmxnl4mUnrzhVNXkanjvSr0rmj1A -fsbAddJu+2gw7OyLnflJNZoaLNmzlTnVHpL3prllL+U9bTpITAjc5CgSKL59NVzq -4BZ+Extq1z7XnvwtdbLBFNUjA9tbbws+eC8N3jONFrdI54OagQ97wUNNVQQXOEpR -1VmiiXTTn74eS9fGbbeIJG9gkaSChVtWQbzQRKtqE77RLFi3EjNYsjdj3BP1lB0/ -QFH1T/U67cjF68IeHRaVesd+QnGTbksVtzDfqu1XhUisHWrdOWnk4Xl4vs4Fv6EM -94B7IWcnMFk= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIEDzCCAvegAwIBAgIBADANBgkqhkiG9w0BAQUFADBoMQswCQYDVQQGEwJVUzEl -MCMGA1UEChMcU3RhcmZpZWxkIFRlY2hub2xvZ2llcywgSW5jLjEyMDAGA1UECxMp -U3RhcmZpZWxkIENsYXNzIDIgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMDQw -NjI5MTczOTE2WhcNMzQwNjI5MTczOTE2WjBoMQswCQYDVQQGEwJVUzElMCMGA1UE -ChMcU3RhcmZpZWxkIFRlY2hub2xvZ2llcywgSW5jLjEyMDAGA1UECxMpU3RhcmZp -ZWxkIENsYXNzIDIgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggEgMA0GCSqGSIb3 -DQEBAQUAA4IBDQAwggEIAoIBAQC3Msj+6XGmBIWtDBFk385N78gDGIc/oav7PKaf -8MOh2tTYbitTkPskpD6E8J7oX+zlJ0T1KKY/e97gKvDIr1MvnsoFAZMej2YcOadN -+lq2cwQlZut3f+dZxkqZJRRU6ybH838Z1TBwj6+wRir/resp7defqgSHo9T5iaU0 -X9tDkYI22WY8sbi5gv2cOj4QyDvvBmVmepsZGD3/cVE8MC5fvj13c7JdBmzDI1aa -K4UmkhynArPkPw2vCHmCuDY96pzTNbO8acr1zJ3o/WSNF4Azbl5KXZnJHoe0nRrA -1W4TNSNe35tfPe/W93bC6j67eA0cQmdrBNj41tpvi/JEoAGrAgEDo4HFMIHCMB0G -A1UdDgQWBBS/X7fRzt0fhvRbVazc1xDCDqmI5zCBkgYDVR0jBIGKMIGHgBS/X7fR -zt0fhvRbVazc1xDCDqmI56FspGowaDELMAkGA1UEBhMCVVMxJTAjBgNVBAoTHFN0 -YXJmaWVsZCBUZWNobm9sb2dpZXMsIEluYy4xMjAwBgNVBAsTKVN0YXJmaWVsZCBD -bGFzcyAyIENlcnRpZmljYXRpb24gQXV0aG9yaXR5ggEAMAwGA1UdEwQFMAMBAf8w -DQYJKoZIhvcNAQEFBQADggEBAAWdP4id0ckaVaGsafPzWdqbAYcaT1epoXkJKtv3 -L7IezMdeatiDh6GX70k1PncGQVhiv45YuApnP+yz3SFmH8lU+nLMPUxA2IGvd56D -eruix/U0F47ZEUD0/CwqTRV/p2JdLiXTAAsgGh1o+Re49L2L7ShZ3U0WixeDyLJl -xy16paq8U4Zt3VekyvggQQto8PT7dL5WXXp59fkdheMtlb71cZBDzI0fmgAKhynp -VSJYACPq4xJDKVtHCN2MQWplBqjlIapBtJUhlbl90TSrE9atvNziPTnNvT51cKEY -WQPJIrSPnNVeKtelttQKbfi3QBFGmh95DmK/D5fs4C8fF5Q= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIID3TCCAsWgAwIBAgIBADANBgkqhkiG9w0BAQsFADCBjzELMAkGA1UEBhMCVVMx -EDAOBgNVBAgTB0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxJTAjBgNVBAoT -HFN0YXJmaWVsZCBUZWNobm9sb2dpZXMsIEluYy4xMjAwBgNVBAMTKVN0YXJmaWVs -ZCBSb290IENlcnRpZmljYXRlIEF1dGhvcml0eSAtIEcyMB4XDTA5MDkwMTAwMDAw -MFoXDTM3MTIzMTIzNTk1OVowgY8xCzAJBgNVBAYTAlVTMRAwDgYDVQQIEwdBcml6 -b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMSUwIwYDVQQKExxTdGFyZmllbGQgVGVj -aG5vbG9naWVzLCBJbmMuMTIwMAYDVQQDEylTdGFyZmllbGQgUm9vdCBDZXJ0aWZp -Y2F0ZSBBdXRob3JpdHkgLSBHMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC -ggEBAL3twQP89o/8ArFvW59I2Z154qK3A2FWGMNHttfKPTUuiUP3oWmb3ooa/RMg -nLRJdzIpVv257IzdIvpy3Cdhl+72WoTsbhm5iSzchFvVdPtrX8WJpRBSiUZV9Lh1 -HOZ/5FSuS/hVclcCGfgXcVnrHigHdMWdSL5stPSksPNkN3mSwOxGXn/hbVNMYq/N -Hwtjuzqd+/x5AJhhdM8mgkBj87JyahkNmcrUDnXMN/uLicFZ8WJ/X7NfZTD4p7dN -dloedl40wOiWVpmKs/B/pM293DIxfJHP4F8R+GuqSVzRmZTRouNjWwl2tVZi4Ut0 -HZbUJtQIBFnQmA4O5t78w+wfkPECAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAO -BgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFHwMMh+n2TB/xH1oo2Kooc6rB1snMA0G -CSqGSIb3DQEBCwUAA4IBAQARWfolTwNvlJk7mh+ChTnUdgWUXuEok21iXQnCoKjU -sHU48TRqneSfioYmUeYs0cYtbpUgSpIB7LiKZ3sx4mcujJUDJi5DnUox9g61DLu3 -4jd/IroAow57UvtruzvE03lRTs2Q9GcHGcg8RnoNAX3FWOdt5oUwF5okxBDgBPfg -8n/Uqgr/Qh037ZTlZFkSIHc40zI+OIF1lnP6aI+xy84fxez6nH7PfrHxBy22/L/K -pL/QlwVKvOoYKAKQvVR4CSFx09F9HdkWsKlhPdAKACL8x3vLCWRFCztAgfd9fDL1 -mMpYjn0q7pBZc2T5NnReJaH1ZgUufzkVqSr7UIuOhWn0 ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIID7zCCAtegAwIBAgIBADANBgkqhkiG9w0BAQsFADCBmDELMAkGA1UEBhMCVVMx -EDAOBgNVBAgTB0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxJTAjBgNVBAoT -HFN0YXJmaWVsZCBUZWNobm9sb2dpZXMsIEluYy4xOzA5BgNVBAMTMlN0YXJmaWVs -ZCBTZXJ2aWNlcyBSb290IENlcnRpZmljYXRlIEF1dGhvcml0eSAtIEcyMB4XDTA5 -MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgZgxCzAJBgNVBAYTAlVTMRAwDgYD -VQQIEwdBcml6b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMSUwIwYDVQQKExxTdGFy -ZmllbGQgVGVjaG5vbG9naWVzLCBJbmMuMTswOQYDVQQDEzJTdGFyZmllbGQgU2Vy -dmljZXMgUm9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgLSBHMjCCASIwDQYJKoZI -hvcNAQEBBQADggEPADCCAQoCggEBANUMOsQq+U7i9b4Zl1+OiFOxHz/Lz58gE20p -OsgPfTz3a3Y4Y9k2YKibXlwAgLIvWX/2h/klQ4bnaRtSmpDhcePYLQ1Ob/bISdm2 -8xpWriu2dBTrz/sm4xq6HZYuajtYlIlHVv8loJNwU4PahHQUw2eeBGg6345AWh1K -Ts9DkTvnVtYAcMtS7nt9rjrnvDH5RfbCYM8TWQIrgMw0R9+53pBlbQLPLJGmpufe -hRhJfGZOozptqbXuNC66DQO4M99H67FrjSXZm86B0UVGMpZwh94CDklDhbZsc7tk -6mFBrMnUVN+HL8cisibMn1lUaJ/8viovxFUcdUBgF4UCVTmLfwUCAwEAAaNCMEAw -DwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFJxfAN+q -AdcwKziIorhtSpzyEZGDMA0GCSqGSIb3DQEBCwUAA4IBAQBLNqaEd2ndOxmfZyMI -bw5hyf2E3F/YNoHN2BtBLZ9g3ccaaNnRbobhiCPPE95Dz+I0swSdHynVv/heyNXB -ve6SbzJ08pGCL72CQnqtKrcgfU28elUSwhXqvfdqlS5sdJ/PHLTyxQGjhdByPq1z -qwubdQxtRbeOlKyWN7Wg0I8VRw7j6IPdj/3vQQF3zCepYoUz8jcI73HPdwbeyBkd -iEDPfUYd/x7H4c7/I9vG+o1VTqkC50cRRj70/b17KSa7qWFiNyi2LSr2EIZkyXCn -0q23KXB56jzaYyWf/Wi3MOxw+3WKt21gZ7IeyLnp2KhvAotnDU0mV3HaIPzBSlCN -sSi6 ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIHyTCCBbGgAwIBAgIBATANBgkqhkiG9w0BAQUFADB9MQswCQYDVQQGEwJJTDEW -MBQGA1UEChMNU3RhcnRDb20gTHRkLjErMCkGA1UECxMiU2VjdXJlIERpZ2l0YWwg -Q2VydGlmaWNhdGUgU2lnbmluZzEpMCcGA1UEAxMgU3RhcnRDb20gQ2VydGlmaWNh -dGlvbiBBdXRob3JpdHkwHhcNMDYwOTE3MTk0NjM2WhcNMzYwOTE3MTk0NjM2WjB9 -MQswCQYDVQQGEwJJTDEWMBQGA1UEChMNU3RhcnRDb20gTHRkLjErMCkGA1UECxMi -U2VjdXJlIERpZ2l0YWwgQ2VydGlmaWNhdGUgU2lnbmluZzEpMCcGA1UEAxMgU3Rh -cnRDb20gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUA -A4ICDwAwggIKAoICAQDBiNsJvGxGfHiflXu1M5DycmLWwTYgIiRezul38kMKogZk -pMyONvg45iPwbm2xPN1yo4UcodM9tDMr0y+v/uqwQVlntsQGfQqedIXWeUyAN3rf -OQVSWff0G0ZDpNKFhdLDcfN1YjS6LIp/Ho/u7TTQEceWzVI9ujPW3U3eCztKS5/C -Ji/6tRYccjV3yjxd5srhJosaNnZcAdt0FCX+7bWgiA/deMotHweXMAEtcnn6RtYT -Kqi5pquDSR3l8u/d5AGOGAqPY1MWhWKpDhk6zLVmpsJrdAfkK+F2PrRt2PZE4XNi -HzvEvqBTViVsUQn3qqvKv3b9bZvzndu/PWa8DFaqr5hIlTpL36dYUNk4dalb6kMM -Av+Z6+hsTXBbKWWc3apdzK8BMewM69KN6Oqce+Zu9ydmDBpI125C4z/eIT574Q1w -+2OqqGwaVLRcJXrJosmLFqa7LH4XXgVNWG4SHQHuEhANxjJ/GP/89PrNbpHoNkm+ -Gkhpi8KWTRoSsmkXwQqQ1vp5Iki/untp+HDH+no32NgN0nZPV/+Qt+OR0t3vwmC3 -Zzrd/qqc8NSLf3Iizsafl7b4r4qgEKjZ+xjGtrVcUjyJthkqcwEKDwOzEmDyei+B -26Nu/yYwl/WL3YlXtq09s68rxbd2AvCl1iuahhQqcvbjM4xdCUsT37uMdBNSSwID -AQABo4ICUjCCAk4wDAYDVR0TBAUwAwEB/zALBgNVHQ8EBAMCAa4wHQYDVR0OBBYE -FE4L7xqkQFulF2mHMMo0aEPQQa7yMGQGA1UdHwRdMFswLKAqoCiGJmh0dHA6Ly9j -ZXJ0LnN0YXJ0Y29tLm9yZy9zZnNjYS1jcmwuY3JsMCugKaAnhiVodHRwOi8vY3Js -LnN0YXJ0Y29tLm9yZy9zZnNjYS1jcmwuY3JsMIIBXQYDVR0gBIIBVDCCAVAwggFM -BgsrBgEEAYG1NwEBATCCATswLwYIKwYBBQUHAgEWI2h0dHA6Ly9jZXJ0LnN0YXJ0 -Y29tLm9yZy9wb2xpY3kucGRmMDUGCCsGAQUFBwIBFilodHRwOi8vY2VydC5zdGFy -dGNvbS5vcmcvaW50ZXJtZWRpYXRlLnBkZjCB0AYIKwYBBQUHAgIwgcMwJxYgU3Rh -cnQgQ29tbWVyY2lhbCAoU3RhcnRDb20pIEx0ZC4wAwIBARqBl0xpbWl0ZWQgTGlh -YmlsaXR5LCByZWFkIHRoZSBzZWN0aW9uICpMZWdhbCBMaW1pdGF0aW9ucyogb2Yg -dGhlIFN0YXJ0Q29tIENlcnRpZmljYXRpb24gQXV0aG9yaXR5IFBvbGljeSBhdmFp -bGFibGUgYXQgaHR0cDovL2NlcnQuc3RhcnRjb20ub3JnL3BvbGljeS5wZGYwEQYJ -YIZIAYb4QgEBBAQDAgAHMDgGCWCGSAGG+EIBDQQrFilTdGFydENvbSBGcmVlIFNT -TCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTANBgkqhkiG9w0BAQUFAAOCAgEAFmyZ -9GYMNPXQhV59CuzaEE44HF7fpiUFS5Eyweg78T3dRAlbB0mKKctmArexmvclmAk8 -jhvh3TaHK0u7aNM5Zj2gJsfyOZEdUauCe37Vzlrk4gNXcGmXCPleWKYK34wGmkUW -FjgKXlf2Ysd6AgXmvB618p70qSmD+LIU424oh0TDkBreOKk8rENNZEXO3SipXPJz -ewT4F+irsfMuXGRuczE6Eri8sxHkfY+BUZo7jYn0TZNmezwD7dOaHZrzZVD1oNB1 -ny+v8OqCQ5j4aZyJecRDjkZy42Q2Eq/3JR44iZB3fsNrarnDy0RLrHiQi+fHLB5L -EUTINFInzQpdn4XBidUaePKVEFMy3YCEZnXZtWgo+2EuvoSoOMCZEoalHmdkrQYu -L6lwhceWD3yJZfWOQ1QOq92lgDmUYMA0yZZwLKMS9R9Ie70cfmu3nZD0Ijuu+Pwq -yvqCUqDvr0tVk+vBtfAii6w0TiYiBKGHLHVKt+V9E9e4DGTANtLJL4YSjCMJwRuC -O3NJo2pXh5Tl1njFmUNj403gdy3hZZlyaQQaRwnmDwFWJPsfvw55qVguucQJAX6V -um0ABj6y6koQOdjQK/W/7HW/lwLFCRsI3FU34oH7N4RDYiDK51ZLZer+bMEkkySh -NOsF/5oirpt9P/FlUQqmMGqz9IgcgA38corog14= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIHhzCCBW+gAwIBAgIBLTANBgkqhkiG9w0BAQsFADB9MQswCQYDVQQGEwJJTDEW -MBQGA1UEChMNU3RhcnRDb20gTHRkLjErMCkGA1UECxMiU2VjdXJlIERpZ2l0YWwg -Q2VydGlmaWNhdGUgU2lnbmluZzEpMCcGA1UEAxMgU3RhcnRDb20gQ2VydGlmaWNh -dGlvbiBBdXRob3JpdHkwHhcNMDYwOTE3MTk0NjM3WhcNMzYwOTE3MTk0NjM2WjB9 -MQswCQYDVQQGEwJJTDEWMBQGA1UEChMNU3RhcnRDb20gTHRkLjErMCkGA1UECxMi -U2VjdXJlIERpZ2l0YWwgQ2VydGlmaWNhdGUgU2lnbmluZzEpMCcGA1UEAxMgU3Rh -cnRDb20gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUA -A4ICDwAwggIKAoICAQDBiNsJvGxGfHiflXu1M5DycmLWwTYgIiRezul38kMKogZk -pMyONvg45iPwbm2xPN1yo4UcodM9tDMr0y+v/uqwQVlntsQGfQqedIXWeUyAN3rf -OQVSWff0G0ZDpNKFhdLDcfN1YjS6LIp/Ho/u7TTQEceWzVI9ujPW3U3eCztKS5/C -Ji/6tRYccjV3yjxd5srhJosaNnZcAdt0FCX+7bWgiA/deMotHweXMAEtcnn6RtYT -Kqi5pquDSR3l8u/d5AGOGAqPY1MWhWKpDhk6zLVmpsJrdAfkK+F2PrRt2PZE4XNi -HzvEvqBTViVsUQn3qqvKv3b9bZvzndu/PWa8DFaqr5hIlTpL36dYUNk4dalb6kMM -Av+Z6+hsTXBbKWWc3apdzK8BMewM69KN6Oqce+Zu9ydmDBpI125C4z/eIT574Q1w -+2OqqGwaVLRcJXrJosmLFqa7LH4XXgVNWG4SHQHuEhANxjJ/GP/89PrNbpHoNkm+ -Gkhpi8KWTRoSsmkXwQqQ1vp5Iki/untp+HDH+no32NgN0nZPV/+Qt+OR0t3vwmC3 -Zzrd/qqc8NSLf3Iizsafl7b4r4qgEKjZ+xjGtrVcUjyJthkqcwEKDwOzEmDyei+B -26Nu/yYwl/WL3YlXtq09s68rxbd2AvCl1iuahhQqcvbjM4xdCUsT37uMdBNSSwID -AQABo4ICEDCCAgwwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYD -VR0OBBYEFE4L7xqkQFulF2mHMMo0aEPQQa7yMB8GA1UdIwQYMBaAFE4L7xqkQFul -F2mHMMo0aEPQQa7yMIIBWgYDVR0gBIIBUTCCAU0wggFJBgsrBgEEAYG1NwEBATCC -ATgwLgYIKwYBBQUHAgEWImh0dHA6Ly93d3cuc3RhcnRzc2wuY29tL3BvbGljeS5w -ZGYwNAYIKwYBBQUHAgEWKGh0dHA6Ly93d3cuc3RhcnRzc2wuY29tL2ludGVybWVk -aWF0ZS5wZGYwgc8GCCsGAQUFBwICMIHCMCcWIFN0YXJ0IENvbW1lcmNpYWwgKFN0 -YXJ0Q29tKSBMdGQuMAMCAQEagZZMaW1pdGVkIExpYWJpbGl0eSwgcmVhZCB0aGUg -c2VjdGlvbiAqTGVnYWwgTGltaXRhdGlvbnMqIG9mIHRoZSBTdGFydENvbSBDZXJ0 -aWZpY2F0aW9uIEF1dGhvcml0eSBQb2xpY3kgYXZhaWxhYmxlIGF0IGh0dHA6Ly93 -d3cuc3RhcnRzc2wuY29tL3BvbGljeS5wZGYwEQYJYIZIAYb4QgEBBAQDAgAHMDgG -CWCGSAGG+EIBDQQrFilTdGFydENvbSBGcmVlIFNTTCBDZXJ0aWZpY2F0aW9uIEF1 -dGhvcml0eTANBgkqhkiG9w0BAQsFAAOCAgEAjo/n3JR5fPGFf59Jb2vKXfuM/gTF -wWLRfUKKvFO3lANmMD+x5wqnUCBVJX92ehQN6wQOQOY+2IirByeDqXWmN3PH/UvS -Ta0XQMhGvjt/UfzDtgUx3M2FIk5xt/JxXrAaxrqTi3iSSoX4eA+D/i+tLPfkpLst -0OcNOrg+zvZ49q5HJMqjNTbOx8aHmNrs++myziebiMMEofYLWWivydsQD032ZGNc -pRJvkrKTlMeIFw6Ttn5ii5B/q06f/ON1FE8qMt9bDeD1e5MNq6HPh+GlBEXoPBKl -CcWw0bdT82AUuoVpaiF8H3VhFyAXe2w7QSlc4axa0c2Mm+tgHRns9+Ww2vl5GKVF -P0lDV9LdJNUso/2RjSe15esUBppMeyG7Oq0wBhjA2MFrLH9ZXF2RsXAiV+uKa0hK -1Q8p7MZAwC+ITGgBF3f0JBlPvfrhsiAhS90a2Cl9qrjeVOwhVYBsHvUwyKMQ5bLm -KhQxw4UtjJixhlpPiVktucf3HMiKf8CdBUrmQk9io20ppB+Fq9vlgcitKj1MXVuE -JnHEhV5xJMqlG2zYYdMa4FTbzrqpMrUi9nNBCV24F10OD5mQ1kfabwo6YigUZ4LZ -8dCAWZvLMdibD4x3TrVoivJs9iQOLWxwxXPR3hTQcY+203sC9uO41Alua551hDnm -fyWl8kgAwKQB2j8= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIFYzCCA0ugAwIBAgIBOzANBgkqhkiG9w0BAQsFADBTMQswCQYDVQQGEwJJTDEW -MBQGA1UEChMNU3RhcnRDb20gTHRkLjEsMCoGA1UEAxMjU3RhcnRDb20gQ2VydGlm -aWNhdGlvbiBBdXRob3JpdHkgRzIwHhcNMTAwMTAxMDEwMDAxWhcNMzkxMjMxMjM1 -OTAxWjBTMQswCQYDVQQGEwJJTDEWMBQGA1UEChMNU3RhcnRDb20gTHRkLjEsMCoG -A1UEAxMjU3RhcnRDb20gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgRzIwggIiMA0G -CSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC2iTZbB7cgNr2Cu+EWIAOVeq8Oo1XJ -JZlKxdBWQYeQTSFgpBSHO839sj60ZwNq7eEPS8CRhXBF4EKe3ikj1AENoBB5uNsD -vfOpL9HG4A/LnooUCri99lZi8cVytjIl2bLzvWXFDSxu1ZJvGIsAQRSCb0AgJnoo -D/Uefyf3lLE3PbfHkffiAez9lInhzG7TNtYKGXmu1zSCZf98Qru23QumNK9LYP5/ -Q0kGi4xDuFby2X8hQxfqp0iVAXV16iulQ5XqFYSdCI0mblWbq9zSOdIxHWDirMxW -RST1HFSr7obdljKF+ExP6JV2tgXdNiNnvP8V4so75qbsO+wmETRIjfaAKxojAuuK -HDp2KntWFhxyKrOq42ClAJ8Em+JvHhRYW6Vsi1g8w7pOOlz34ZYrPu8HvKTlXcxN -nw3h3Kq74W4a7I/htkxNeXJdFzULHdfBR9qWJODQcqhaX2YtENwvKhOuJv4KHBnM -0D4LnMgJLvlblnpHnOl68wVQdJVznjAJ85eCXuaPOQgeWeU1FEIT/wCc976qUM/i -UUjXuG+v+E5+M5iSFGI6dWPPe/regjupuznixL0sAA7IF6wT700ljtizkC+p2il9 -Ha90OrInwMEePnWjFqmveiJdnxMaz6eg6+OGCtP95paV1yPIN93EfKo2rJgaErHg -TuixO/XWb/Ew1wIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQE -AwIBBjAdBgNVHQ4EFgQUS8W0QGutHLOlHGVuRjaJhwUMDrYwDQYJKoZIhvcNAQEL -BQADggIBAHNXPyzVlTJ+N9uWkusZXn5T50HsEbZH77Xe7XRcxfGOSeD8bpkTzZ+K -2s06Ctg6Wgk/XzTQLwPSZh0avZyQN8gMjgdalEVGKua+etqhqaRpEpKwfTbURIfX -UfEpY9Z1zRbkJ4kd+MIySP3bmdCPX1R0zKxnNBFi2QwKN4fRoxdIjtIXHfbX/dtl -6/2o1PXWT6RbdejF0mCy2wl+JYt7ulKSnj7oxXehPOBKc2thz4bcQ///If4jXSRK -9dNtD2IEBVeC2m6kMyV5Sy5UGYvMLD0w6dEG/+gyRr61M3Z3qAFdlsHB1b6uJcDJ -HgoJIIihDsnzb02CVAAgp9KP5DlUFy6NHrgbuxu9mk47EDTcnIhT76IxW1hPkWLI -wpqazRVdOKnWvvgTtZ8SafJQYqz7Fzf07rh1Z2AQ+4NQ+US1dZxAF7L+/XldblhY -XzD8AK6vM8EOTmy6p6ahfzLbOOCxchcKK5HsamMm7YnUeMx0HgX4a/6ManY5Ka5l -IxKVCCIcl85bBu4M4ru8H0ST9tg4RQUh7eStqxK2A6RCLi3ECToDZ2mEmuFZkIoo -hdVddLHRDiBYmxOlsGOm7XtH/UVVMKTumtTm4ofvmMkyghEpIrwACjFeLQ/Ajulr -so8uBtjRkcfGEvRM/TAXw8HaOFvjqermobp573PYtlNXLfbQ4ddI ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIFujCCA6KgAwIBAgIJALtAHEP1Xk+wMA0GCSqGSIb3DQEBBQUAMEUxCzAJBgNV -BAYTAkNIMRUwEwYDVQQKEwxTd2lzc1NpZ24gQUcxHzAdBgNVBAMTFlN3aXNzU2ln -biBHb2xkIENBIC0gRzIwHhcNMDYxMDI1MDgzMDM1WhcNMzYxMDI1MDgzMDM1WjBF -MQswCQYDVQQGEwJDSDEVMBMGA1UEChMMU3dpc3NTaWduIEFHMR8wHQYDVQQDExZT -d2lzc1NpZ24gR29sZCBDQSAtIEcyMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIIC -CgKCAgEAr+TufoskDhJuqVAtFkQ7kpJcyrhdhJJCEyq8ZVeCQD5XJM1QiyUqt2/8 -76LQwB8CJEoTlo8jE+YoWACjR8cGp4QjK7u9lit/VcyLwVcfDmJlD909Vopz2q5+ -bbqBHH5CjCA12UNNhPqE21Is8w4ndwtrvxEvcnifLtg+5hg3Wipy+dpikJKVyh+c -6bM8K8vzARO/Ws/BtQpgvd21mWRTuKCWs2/iJneRjOBiEAKfNA+k1ZIzUd6+jbqE -emA8atufK+ze3gE/bk3lUIbLtK/tREDFylqM2tIrfKjuvqblCqoOpd8FUrdVxyJd -MmqXl2MT28nbeTZ7hTpKxVKJ+STnnXepgv9VHKVxaSvRAiTysybUa9oEVeXBCsdt -MDeQKuSeFDNeFhdVxVu1yzSJkvGdJo+hB9TGsnhQ2wwMC3wLjEHXuendjIj3o02y -MszYF9rNt85mndT9Xv+9lz4pded+p2JYryU0pUHHPbwNUMoDAw8IWh+Vc3hiv69y -FGkOpeUDDniOJihC8AcLYiAQZzlG+qkDzAQ4embvIIO1jEpWjpEA/I5cgt6IoMPi -aG59je883WX0XaxR7ySArqpWl2/5rX3aYT+YdzylkbYcjCbaZaIJbcHiVOO5ykxM -gI93e2CaHt+28kgeDrpOVG2Y4OGiGqJ3UM/EY5LsRxmd6+ZrzsECAwEAAaOBrDCB -qTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUWyV7 -lqRlUX64OfPAeGZe6Drn8O4wHwYDVR0jBBgwFoAUWyV7lqRlUX64OfPAeGZe6Drn -8O4wRgYDVR0gBD8wPTA7BglghXQBWQECAQEwLjAsBggrBgEFBQcCARYgaHR0cDov -L3JlcG9zaXRvcnkuc3dpc3NzaWduLmNvbS8wDQYJKoZIhvcNAQEFBQADggIBACe6 -45R88a7A3hfm5djV9VSwg/S7zV4Fe0+fdWavPOhWfvxyeDgD2StiGwC5+OlgzczO -UYrHUDFu4Up+GC9pWbY9ZIEr44OE5iKHjn3g7gKZYbge9LgriBIWhMIxkziWMaa5 -O1M/wySTVltpkuzFwbs4AOPsF6m43Md8AYOfMke6UiI0HTJ6CVanfCU2qT1L2sCC -bwq7EsiHSycR+R4tx5M/nttfJmtS2S6K8RTGRI0Vqbe/vd6mGu6uLftIdxf+u+yv -GPUqUfA5hJeVbG4bwyvEdGB5JbAKJ9/fXtI5z0V9QkvfsywexcZdylU6oJxpmo/a -77KwPJ+HbBIrZXAVUjEaJM9vMSNQH4xPjyPDdEFjHFWoFN0+4FFQz/EbMFYOkrCC -hdiDyyJkvC24JdVUorgG6q2SpCSgwYa1ShNqR88uC1aVVMvOmttqtKay20EIhid3 -92qgQmwLOM7XdVAyksLfKzAiSNDVQTglXaTpXZ/GlHXQRf0wl0OPkKsKx4ZzYEpp -Ld6leNcG2mqeSz53OiATIgHQv2ieY2BrNU0LbbqhPcCT4H8js1WtciVORvnSFu+w -ZMEBnunKoGqYDs/YYPIvSbjkQuE4NRb0yG5P94FW6LqjviOvrv1vA+ACOzB2+htt -Qc8Bsem4yWb02ybzOqR08kkkW8mw0FfB+j564ZfJ ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIFvTCCA6WgAwIBAgIITxvUL1S7L0swDQYJKoZIhvcNAQEFBQAwRzELMAkGA1UE -BhMCQ0gxFTATBgNVBAoTDFN3aXNzU2lnbiBBRzEhMB8GA1UEAxMYU3dpc3NTaWdu -IFNpbHZlciBDQSAtIEcyMB4XDTA2MTAyNTA4MzI0NloXDTM2MTAyNTA4MzI0Nlow -RzELMAkGA1UEBhMCQ0gxFTATBgNVBAoTDFN3aXNzU2lnbiBBRzEhMB8GA1UEAxMY -U3dpc3NTaWduIFNpbHZlciBDQSAtIEcyMIICIjANBgkqhkiG9w0BAQEFAAOCAg8A -MIICCgKCAgEAxPGHf9N4Mfc4yfjDmUO8x/e8N+dOcbpLj6VzHVxumK4DV644N0Mv -Fz0fyM5oEMF4rhkDKxD6LHmD9ui5aLlV8gREpzn5/ASLHvGiTSf5YXu6t+WiE7br -YT7QbNHm+/pe7R20nqA1W6GSy/BJkv6FCgU+5tkL4k+73JU3/JHpMjUi0R86TieF -nbAVlDLaYQ1HTWBCrpJH6INaUFjpiou5XaHc3ZlKHzZnu0jkg7Y360g6rw9njxcH -6ATK72oxh9TAtvmUcXtnZLi2kUpCe2UuMGoM9ZDulebyzYLs2aFK7PayS+VFheZt -eJMELpyCbTapxDFkH4aDCyr0NQp4yVXPQbBH6TCfmb5hqAaEuSh6XzjZG6k4sIN/ -c8HDO0gqgg8hm7jMqDXDhBuDsz6+pJVpATqJAHgE2cn0mRmrVn5bi4Y5FZGkECwJ -MoBgs5PAKrYYC51+jUnyEEp/+dVGLxmSo5mnJqy7jDzmDrxHB9xzUfFwZC8I+bRH -HTBsROopN4WSaGa8gzj+ezku01DwH/teYLappvonQfGbGHLy9YR0SslnxFSuSGTf -jNFusB3hB48IHpmccelM2KX3RxIfdNFRnobzwqIjQAtz20um53MGjMGg6cFZrEb6 -5i/4z3GcRm25xBWNOHkDRUjvxF3XCO6HOSKGsg0PWEP3calILv3q1h8CAwEAAaOB -rDCBqTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU -F6DNweRBtjpbO8tFnb0cwpj6hlgwHwYDVR0jBBgwFoAUF6DNweRBtjpbO8tFnb0c -wpj6hlgwRgYDVR0gBD8wPTA7BglghXQBWQEDAQEwLjAsBggrBgEFBQcCARYgaHR0 -cDovL3JlcG9zaXRvcnkuc3dpc3NzaWduLmNvbS8wDQYJKoZIhvcNAQEFBQADggIB -AHPGgeAn0i0P4JUw4ppBf1AsX19iYamGamkYDHRJ1l2E6kFSGG9YrVBWIGrGvShp -WJHckRE1qTodvBqlYJ7YH39FkWnZfrt4csEGDyrOj4VwYaygzQu4OSlWhDJOhrs9 -xCrZ1x9y7v5RoSJBsXECYxqCsGKrXlcSH9/L3XWgwF15kIwb4FDm3jH+mHtwX6WQ -2K34ArZv02DdQEsixT2tOnqfGhpHkXkzuoLcMmkDlm4fS/Bx/uNncqCxv1yL5PqZ -IseEuRuNI5c/7SXgz2W79WEE790eslpBIlqhn10s6FvJbakMDHiqYMZWjwFaDGi8 -aRl5xB9+lwW/xekkUV7U1UtT7dkjWjYDZaPBA61BMPNGG4WQr2W11bHkFlt4dR2X -em1ZqSqPe97Dh4kQmUlzeMg9vVE1dCrV8X5pGyq7O70luJpaPXJhkGaH7gzWTdQR -dAtq/gsD/KNVV4n+SsuuWxcFyPKNIzFTONItaj+CuY0IavdeQXRuwxF+B6wpYJE/ -OMpXEA29MC/HpeZBoNquBYeaoKRlbEwJDIm6uNO5wJOKMPqN5ZprFQFOZ6raYlY+ -hAhm0sQ2fac+EPyI4NSA5QC9qvNOBqN6avlicuMJT+ubDgEj8Z+7fNzcbBGXJbLy -tGMU0gYqZ4yD9c7qB9iaah7s5Aq7KkzrCWA5zspi2C5u ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIF2TCCA8GgAwIBAgIQXAuFXAvnWUHfV8w/f52oNjANBgkqhkiG9w0BAQUFADBk -MQswCQYDVQQGEwJjaDERMA8GA1UEChMIU3dpc3Njb20xJTAjBgNVBAsTHERpZ2l0 -YWwgQ2VydGlmaWNhdGUgU2VydmljZXMxGzAZBgNVBAMTElN3aXNzY29tIFJvb3Qg -Q0EgMTAeFw0wNTA4MTgxMjA2MjBaFw0yNTA4MTgyMjA2MjBaMGQxCzAJBgNVBAYT -AmNoMREwDwYDVQQKEwhTd2lzc2NvbTElMCMGA1UECxMcRGlnaXRhbCBDZXJ0aWZp -Y2F0ZSBTZXJ2aWNlczEbMBkGA1UEAxMSU3dpc3Njb20gUm9vdCBDQSAxMIICIjAN -BgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA0LmwqAzZuz8h+BvVM5OAFmUgdbI9 -m2BtRsiMMW8Xw/qabFbtPMWRV8PNq5ZJkCoZSx6jbVfd8StiKHVFXqrWW/oLJdih -FvkcxC7mlSpnzNApbjyFNDhhSbEAn9Y6cV9Nbc5fuankiX9qUvrKm/LcqfmdmUc/ -TilftKaNXXsLmREDA/7n29uj/x2lzZAeAR81sH8A25Bvxn570e56eqeqDFdvpG3F -EzuwpdntMhy0XmeLVNxzh+XTF3xmUHJd1BpYwdnP2IkCb6dJtDZd0KTeByy2dbco -kdaXvij1mB7qWybJvbCXc9qukSbraMH5ORXWZ0sKbU/Lz7DkQnGMU3nn7uHbHaBu -HYwadzVcFh4rUx80i9Fs/PJnB3r1re3WmquhsUvhzDdf/X/NTa64H5xD+SpYVUNF -vJbNcA78yeNmuk6NO4HLFWR7uZToXTNShXEuT46iBhFRyePLoW4xCGQMwtI89Tbo -19AOeCMgkckkKmUpWyL3Ic6DXqTz3kvTaI9GdVyDCW4pa8RwjPWd1yAv/0bSKzjC -L3UcPX7ape8eYIVpQtPM+GP+HkM5haa2Y0EQs3MevNP6yn0WR+Kn1dCjigoIlmJW -bjTb2QK5MHXjBNLnj8KwEUAKrNVxAmKLMb7dxiNYMUJDLXT5xp6mig/p/r+D5kNX -JLrvRjSq1xIBOO0CAwEAAaOBhjCBgzAOBgNVHQ8BAf8EBAMCAYYwHQYDVR0hBBYw -FDASBgdghXQBUwABBgdghXQBUwABMBIGA1UdEwEB/wQIMAYBAf8CAQcwHwYDVR0j -BBgwFoAUAyUv3m+CATpcLNwroWm1Z9SM0/0wHQYDVR0OBBYEFAMlL95vggE6XCzc -K6FptWfUjNP9MA0GCSqGSIb3DQEBBQUAA4ICAQA1EMvspgQNDQ/NwNurqPKIlwzf -ky9NfEBWMXrrpA9gzXrzvsMnjgM+pN0S734edAY8PzHyHHuRMSG08NBsl9Tpl7Ik -Vh5WwzW9iAUPWxAaZOHHgjD5Mq2eUCzneAXQMbFamIp1TpBcahQq4FJHgmDmHtqB -sfsUC1rxn9KVuj7QG9YVHaO+htXbD8BJZLsuUBlL0iT43R4HVtA4oJVwIHaM190e -3p9xxCPvgxNcoyQVTSlAPGrEqdi3pkSlDfTgnXceQHAm/NrZNuR55LU/vJtlvrsR -ls/bxig5OgjOR1tTWsWZ/l2p3e9M1MalrQLmjAcSHm8D0W+go/MpvRLHUKKwf4ip -mXeascClOS5cfGniLLDqN2qk4Vrh9VDlg++luyqI54zb/W1elxmofmZ1a3Hqv7HH -b6D0jqTsNFFbjCYDcKF31QESVwA12yPeDooomf2xEG9L/zgtYE4snOtnta1J7ksf -rK/7DZBaZmBwXarNeNQk7shBoJMBkpxqnvy5JMWzFYJ+vq6VK+uxwNrjAWALXmms -hFZhvnEX/h0TD/7Gh0Xp/jKgGg0TpJRVcaUWi7rKibCyx/yP2FS1k2Kdzs9Z+z0Y -zirLNRWCXf9UIltxUvu3yf5gmwBBZPCqKuy2QkPOiWaByIufOVQDJdMWNY6E0F/6 -MBr1mmz0DlP5OlvRHA== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIF2TCCA8GgAwIBAgIQHp4o6Ejy5e/DfEoeWhhntjANBgkqhkiG9w0BAQsFADBk -MQswCQYDVQQGEwJjaDERMA8GA1UEChMIU3dpc3Njb20xJTAjBgNVBAsTHERpZ2l0 -YWwgQ2VydGlmaWNhdGUgU2VydmljZXMxGzAZBgNVBAMTElN3aXNzY29tIFJvb3Qg -Q0EgMjAeFw0xMTA2MjQwODM4MTRaFw0zMTA2MjUwNzM4MTRaMGQxCzAJBgNVBAYT -AmNoMREwDwYDVQQKEwhTd2lzc2NvbTElMCMGA1UECxMcRGlnaXRhbCBDZXJ0aWZp -Y2F0ZSBTZXJ2aWNlczEbMBkGA1UEAxMSU3dpc3Njb20gUm9vdCBDQSAyMIICIjAN -BgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAlUJOhJ1R5tMJ6HJaI2nbeHCOFvEr -jw0DzpPMLgAIe6szjPTpQOYXTKueuEcUMncy3SgM3hhLX3af+Dk7/E6J2HzFZ++r -0rk0X2s682Q2zsKwzxNoysjL67XiPS4h3+os1OD5cJZM/2pYmLcX5BtS5X4HAB1f -2uY+lQS3aYg5oUFgJWFLlTloYhyxCwWJwDaCFCE/rtuh/bxvHGCGtlOUSbkrRsVP -ACu/obvLP+DHVxxX6NZp+MEkUp2IVd3Chy50I9AU/SpHWrumnf2U5NGKpV+GY3aF -y6//SSj8gO1MedK75MDvAe5QQQg1I3ArqRa0jG6F6bYRzzHdUyYb3y1aSgJA/MTA -tukxGggo5WDDH8SQjhBiYEQN7Aq+VRhxLKX0srwVYv8c474d2h5Xszx+zYIdkeNL -6yxSNLCK/RJOlrDrcH+eOfdmQrGrrFLadkBXeyq96G4DsguAhYidDMfCd7Camlf0 -uPoTXGiTOmekl9AbmbeGMktg2M7v0Ax/lZ9vh0+Hio5fCHyqW/xavqGRn1V9TrAL -acywlKinh/LTSlDcX3KwFnUey7QYYpqwpzmqm59m2I2mbJYV4+by+PGDYmy7Velh -k6M99bFXi08jsJvllGov34zflVEpYKELKeRcVVi3qPyZ7iVNTA6z00yPhOgpD/0Q -VAKFyPnlw4vP5w8CAwEAAaOBhjCBgzAOBgNVHQ8BAf8EBAMCAYYwHQYDVR0hBBYw -FDASBgdghXQBUwIBBgdghXQBUwIBMBIGA1UdEwEB/wQIMAYBAf8CAQcwHQYDVR0O -BBYEFE0mICKJS9PVpAqhb97iEoHF8TwuMB8GA1UdIwQYMBaAFE0mICKJS9PVpAqh -b97iEoHF8TwuMA0GCSqGSIb3DQEBCwUAA4ICAQAyCrKkG8t9voJXiblqf/P0wS4R -fbgZPnm3qKhyN2abGu2sEzsOv2LwnN+ee6FTSA5BesogpxcbtnjsQJHzQq0Qw1zv -/2BZf82Fo4s9SBwlAjxnffUy6S8w5X2lejjQ82YqZh6NM4OKb3xuqFp1mrjX2lhI -REeoTPpMSQpKwhI3qEAMw8jh0FcNlzKVxzqfl9NX+Ave5XLzo9v/tdhZsnPdTSpx -srpJ9csc1fV5yJmz/MFMdOO0vSk3FQQoHt5FRnDsr7p4DooqzgB53MBfGWcsa0vv -aGgLQ+OswWIJ76bdZWGgr4RVSJFSHMYlkSrQwSIjYVmvRRGFHQEkNI/Ps/8XciAT -woCqISxxOQ7Qj1zB09GOInJGTB2Wrk9xseEFKZZZ9LuedT3PDTcNYtsmjGOpI99n -Bjx8Oto0QuFmtEYE3saWmA9LSHokMnWRn6z3aOkquVVlzl1h0ydw2Df+n7mvoC5W -t6NlUe07qxS/TFED6F+KBZvuim6c779o+sjaC+NCydAXFJy3SuCvkychVSa1ZC+N -8f+mQAWFBVzKBxlcCxMoTFh/wqXvRdpg065lYZ1Tg3TCrvJcwhbtkj6EPnNgiLx2 -9CzP0H1907he0ZESEOnN3col49XtmS++dYFLJPlFRpTJKSFTnCZFqhMX5OfNeOI5 -wSsSnqaeG8XmDtkx2Q== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIF4DCCA8igAwIBAgIRAPL6ZOJ0Y9ON/RAdBB92ylgwDQYJKoZIhvcNAQELBQAw -ZzELMAkGA1UEBhMCY2gxETAPBgNVBAoTCFN3aXNzY29tMSUwIwYDVQQLExxEaWdp -dGFsIENlcnRpZmljYXRlIFNlcnZpY2VzMR4wHAYDVQQDExVTd2lzc2NvbSBSb290 -IEVWIENBIDIwHhcNMTEwNjI0MDk0NTA4WhcNMzEwNjI1MDg0NTA4WjBnMQswCQYD -VQQGEwJjaDERMA8GA1UEChMIU3dpc3Njb20xJTAjBgNVBAsTHERpZ2l0YWwgQ2Vy -dGlmaWNhdGUgU2VydmljZXMxHjAcBgNVBAMTFVN3aXNzY29tIFJvb3QgRVYgQ0Eg -MjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMT3HS9X6lds93BdY7Bx -UglgRCgzo3pOCvrY6myLURYaVa5UJsTMRQdBTxB5f3HSek4/OE6zAMaVylvNwSqD -1ycfMQ4jFrclyxy0uYAyXhqdk/HoPGAsp15XGVhRXrwsVgu42O+LgrQ8uMIkqBPH -oCE2G3pXKSinLr9xJZDzRINpUKTk4RtiGZQJo/PDvO/0vezbE53PnUgJUmfANykR -HvvSEaeFGHR55E+FFOtSN+KxRdjMDUN/rhPSays/p8LiqG12W0OfvrSdsyaGOx9/ -5fLoZigWJdBLlzin5M8J0TbDC77aO0RYjb7xnglrPvMyxyuHxuxenPaHZa0zKcQv -idm5y8kDnftslFGXEBuGCxobP/YCfnvUxVFkKJ3106yDgYjTdLRZncHrYTNaRdHL -OdAGalNgHa/2+2m8atwBz735j9m9W8E6X47aD0upm50qKGsaCnw8qyIL5XctcfaC -NYGu+HuB5ur+rPQam3Rc6I8k9l2dRsQs0h4rIWqDJ2dVSqTjyDKXZpBy2uPUZC5f -46Fq9mDU5zXNysRojddxyNMkM3OxbPlq4SjbX8Y96L5V5jcb7STZDxmPX2MYWFCB -UWVv8p9+agTnNCRxunZLWB4ZvRVgRaoMEkABnRDixzgHcgplwLa7JSnaFp6LNYth -7eVxV4O1PHGf40+/fh6Bn0GXAgMBAAGjgYYwgYMwDgYDVR0PAQH/BAQDAgGGMB0G -A1UdIQQWMBQwEgYHYIV0AVMCAgYHYIV0AVMCAjASBgNVHRMBAf8ECDAGAQH/AgED -MB0GA1UdDgQWBBRF2aWBbj2ITY1x0kbBbkUe88SAnTAfBgNVHSMEGDAWgBRF2aWB -bj2ITY1x0kbBbkUe88SAnTANBgkqhkiG9w0BAQsFAAOCAgEAlDpzBp9SSzBc1P6x -XCX5145v9Ydkn+0UjrgEjihLj6p7jjm02Vj2e6E1CqGdivdj5eu9OYLU43otb98T -PLr+flaYC/NUn81ETm484T4VvwYmneTwkLbUwp4wLh/vx3rEUMfqe9pQy3omywC0 -Wqu1kx+AiYQElY2NfwmTv9SoqORjbdlk5LgpWgi/UOGED1V7XwgiG/W9mR4U9s70 -WBCCswo9GcG/W6uqmdjyMb3lOGbcWAXH7WMaLgqXfIeTK7KK4/HsGOV1timH59yL -Gn602MnTihdsfSlEvoqq9X46Lmgxk7lq2prg2+kupYTNHAq4Sgj5nPFhJpiTt3tm -7JFe3VE/23MPrQRYCd0EApUKPtN236YQHoA96M2kZNEzx5LH4k5E4wnJTsJdhw4S -nr8PyQUQ3nqjsTzyP6WqJ3mtMX0f/fwZacXduT98zca0wjAefm6S139hdlqP65VN -vBFuIXxZN5nQBrz5Bm0yFqXZaajh3DyAHmBR3NdUIR7KYndP+tiPsys6DXhyyWhB -WkdKwqPrGtcKqzwyVcgKEZzfdNbwQBUdyLmPtTbFr/giuMod89a2GQ+fYWVq6nTI -fI/DT11lgh/ZDYnadXL77/FHZxOzyNEZiCcmmpl5fx7kLD977vHeTYuWl8PVP3wb -I+2ksx0WckNLIOFZfsLorSa/ovc= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDwzCCAqugAwIBAgIBATANBgkqhkiG9w0BAQsFADCBgjELMAkGA1UEBhMCREUx -KzApBgNVBAoMIlQtU3lzdGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAd -BgNVBAsMFlQtU3lzdGVtcyBUcnVzdCBDZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNl -YyBHbG9iYWxSb290IENsYXNzIDIwHhcNMDgxMDAxMTA0MDE0WhcNMzMxMDAxMjM1 -OTU5WjCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoMIlQtU3lzdGVtcyBFbnRlcnBy -aXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBUcnVzdCBDZW50 -ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDIwggEiMA0G -CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCqX9obX+hzkeXaXPSi5kfl82hVYAUd -AqSzm1nzHoqvNK38DcLZSBnuaY/JIPwhqgcZ7bBcrGXHX+0CfHt8LRvWurmAwhiC -FoT6ZrAIxlQjgeTNuUk/9k9uN0goOA/FvudocP05l03Sx5iRUKrERLMjfTlH6VJi -1hKTXrcxlkIF+3anHqP1wvzpesVsqXFP6st4vGCvx9702cu+fjOlbpSD8DT6Iavq -jnKgP6TeMFvvhk1qlVtDRKgQFRzlAVfFmPHmBiiRqiDFt1MmUUOyCxGVWOHAD3bZ -wI18gfNycJ5v/hqO2V81xrJvNHy+SE/iWjnX2J14np+GPgNeGYtEotXHAgMBAAGj -QjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBS/ -WSA2AHmgoCJrjNXyYdK4LMuCSjANBgkqhkiG9w0BAQsFAAOCAQEAMQOiYQsfdOhy -NsZt+U2e+iKo4YFWz827n+qrkRk4r6p8FU3ztqONpfSO9kSpp+ghla0+AGIWiPAC -uvxhI+YzmzB6azZie60EI4RYZeLbK4rnJVM3YlNfvNoBYimipidx5joifsFvHZVw -IEoHNN/q/xWA5brXethbdXwFeilHfkCoMRN3zUA7tFFHei4R40cR3p1m0IvVVGb6 -g1XqfMIpiRvpb7PO4gWEyS8+eIVibslfwXhjdFjASBgMmTnrpMwatXlajRWc2BQN -9noHV8cigwUtPJslJj0Ys6lDfMjIq2SPDqO/nBudMNva0Bkuqjzx+zOAduTNrRlP -BSeOE6Fuwg== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDwzCCAqugAwIBAgIBATANBgkqhkiG9w0BAQsFADCBgjELMAkGA1UEBhMCREUx -KzApBgNVBAoMIlQtU3lzdGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAd -BgNVBAsMFlQtU3lzdGVtcyBUcnVzdCBDZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNl -YyBHbG9iYWxSb290IENsYXNzIDMwHhcNMDgxMDAxMTAyOTU2WhcNMzMxMDAxMjM1 -OTU5WjCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoMIlQtU3lzdGVtcyBFbnRlcnBy -aXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBUcnVzdCBDZW50 -ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDMwggEiMA0G -CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC9dZPwYiJvJK7genasfb3ZJNW4t/zN -8ELg63iIVl6bmlQdTQyK9tPPcPRStdiTBONGhnFBSivwKixVA9ZIw+A5OO3yXDw/ -RLyTPWGrTs0NvvAgJ1gORH8EGoel15YUNpDQSXuhdfsaa3Ox+M6pCSzyU9XDFES4 -hqX2iys52qMzVNn6chr3IhUciJFrf2blw2qAsCTz34ZFiP0Zf3WHHx+xGwpzJFu5 -ZeAsVMhg02YXP+HMVDNzkQI6pn97djmiH5a2OK61yJN0HZ65tOVgnS9W0eDrXltM -EnAMbEQgqxHY9Bn20pxSN+f6tsIxO0rUFJmtxxr1XV/6B7h8DR/Wgx6zAgMBAAGj -QjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBS1 -A/d2O2GCahKqGFPrAyGUv/7OyjANBgkqhkiG9w0BAQsFAAOCAQEAVj3vlNW92nOy -WL6ukK2YJ5f+AbGwUgC4TeQbIXQbfsDuXmkqJa9c1h3a0nnJ85cp4IaH3gRZD/FZ -1GSFS5mvJQQeyUapl96Cshtwn5z2r3Ex3XsFpSzTucpH9sry9uetuUg/vBa3wW30 -6gmv7PO15wWeph6KU1HWk4HMdJP2udqmJQV0eVp+QD6CSyYRMG7hP0HHRwA11fXT -91Q+gT3aSWqas+8QPebrb9HIIkfLzM8BMZLZGOMivgkeGj5asuRrDFR6fUNOuIml -e9eiPZaGzPImNC1qkp2aGtAw4l1OBLBfiyB+d8E9lYLRRpo7PHi4b6HQDWSieB4p -TpPDpFQUWw== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIEPTCCAyWgAwIBAgIBATANBgkqhkiG9w0BAQUFADCBvzE/MD0GA1UEAww2VMOc -UktUUlVTVCBFbGVrdHJvbmlrIFNlcnRpZmlrYSBIaXptZXQgU2HEn2xhecSxY8Sx -c8SxMQswCQYDVQQGEwJUUjEPMA0GA1UEBwwGQW5rYXJhMV4wXAYDVQQKDFVUw5xS -S1RSVVNUIEJpbGdpIMSwbGV0acWfaW0gdmUgQmlsacWfaW0gR8O8dmVubGnEn2kg -SGl6bWV0bGVyaSBBLsWeLiAoYykgQXJhbMSxayAyMDA3MB4XDTA3MTIyNTE4Mzcx -OVoXDTE3MTIyMjE4MzcxOVowgb8xPzA9BgNVBAMMNlTDnFJLVFJVU1QgRWxla3Ry -b25payBTZXJ0aWZpa2EgSGl6bWV0IFNhxJ9sYXnEsWPEsXPEsTELMAkGA1UEBhMC -VFIxDzANBgNVBAcMBkFua2FyYTFeMFwGA1UECgxVVMOcUktUUlVTVCBCaWxnaSDE -sGxldGnFn2ltIHZlIEJpbGnFn2ltIEfDvHZlbmxpxJ9pIEhpem1ldGxlcmkgQS7F -ni4gKGMpIEFyYWzEsWsgMjAwNzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC -ggEBAKu3PgqMyKVYFeaK7yc9SrToJdPNM8Ig3BnuiD9NYvDdE3ePYakqtdTyuTFY -KTsvP2qcb3N2Je40IIDu6rfwxArNK4aUyeNgsURSsloptJGXg9i3phQvKUmi8wUG -+7RP2qFsmmaf8EMJyupyj+sA1zU511YXRxcw9L6/P8JorzZAwan0qafoEGsIiveG -HtyaKhUG9qPw9ODHFNRRf8+0222vR5YXm3dx2KdxnSQM9pQ/hTEST7ruToK4uT6P -IzdezKKqdfcYbwnTrqdUKDT74eA7YH2gvnmJhsifLfkKS8RQouf9eRbHegsYz85M -733WB2+Y8a+xwXrXgTW4qhe04MsCAwEAAaNCMEAwHQYDVR0OBBYEFCnFkKslrxHk -Yb+j/4hhkeYO/pyBMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MA0G -CSqGSIb3DQEBBQUAA4IBAQAQDdr4Ouwo0RSVgrESLFF6QSU2TJ/sPx+EnWVUXKgW -AkD6bho3hO9ynYYKVZ1WKKxmLNA6VpM0ByWtCLCPyA8JWcqdmBzlVPi5RX9ql2+I -aE1KBiY3iAIOtsbWcpnOa3faYjGkVh+uX4132l32iPwa2Z61gfAyuOOI0JzzaqC5 -mxRZNTZPz/OOXl0XrRWV2N2y1RVuAE6zS89mlOTgzbUF2mNXi+WzqtvALhyQRNsa -XRik7r4EW5nVcV9VZWRi1aKbBFmGyGJ353yCRWo9F7/snXUMrqNvWtMvmDb08PUZ -qxFdyKbjKlhqQgnDvZImZjINXQhVdP+MmNAKpoRq0Tl9 ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIEPDCCAySgAwIBAgIBATANBgkqhkiG9w0BAQUFADCBvjE/MD0GA1UEAww2VMOc -UktUUlVTVCBFbGVrdHJvbmlrIFNlcnRpZmlrYSBIaXptZXQgU2HEn2xhecSxY8Sx -c8SxMQswCQYDVQQGEwJUUjEPMA0GA1UEBwwGQW5rYXJhMV0wWwYDVQQKDFRUw5xS -S1RSVVNUIEJpbGdpIMSwbGV0acWfaW0gdmUgQmlsacWfaW0gR8O8dmVubGnEn2kg -SGl6bWV0bGVyaSBBLsWeLiAoYykgS2FzxLFtIDIwMDUwHhcNMDUxMTA3MTAwNzU3 -WhcNMTUwOTE2MTAwNzU3WjCBvjE/MD0GA1UEAww2VMOcUktUUlVTVCBFbGVrdHJv -bmlrIFNlcnRpZmlrYSBIaXptZXQgU2HEn2xhecSxY8Sxc8SxMQswCQYDVQQGEwJU -UjEPMA0GA1UEBwwGQW5rYXJhMV0wWwYDVQQKDFRUw5xSS1RSVVNUIEJpbGdpIMSw -bGV0acWfaW0gdmUgQmlsacWfaW0gR8O8dmVubGnEn2kgSGl6bWV0bGVyaSBBLsWe -LiAoYykgS2FzxLFtIDIwMDUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB -AQCpNn7DkUNMwxmYCMjHWHtPFoylzkkBH3MOrHUTpvqeLCDe2JAOCtFp0if7qnef -J1Il4std2NiDUBd9irWCPwSOtNXwSadktx4uXyCcUHVPr+G1QRT0mJKIx+XlZEdh -R3n9wFHxwZnn3M5q+6+1ATDcRhzviuyV79z/rxAc653YsKpqhRgNF8k+v/Gb0AmJ -Qv2gQrSdiVFVKc8bcLyEVK3BEx+Y9C52YItdP5qtygy/p1Zbj3e41Z55SZI/4PGX -JHpsmxcPbe9TmJEr5A++WXkHeLuXlfSfadRYhwqp48y2WBmfJiGxxFmNskF1wK1p -zpwACPI2/z7woQ8arBT9pmAPAgMBAAGjQzBBMB0GA1UdDgQWBBTZN7NOBf3Zz58S -Fq62iS/rJTqIHDAPBgNVHQ8BAf8EBQMDBwYAMA8GA1UdEwEB/wQFMAMBAf8wDQYJ -KoZIhvcNAQEFBQADggEBAHJglrfJ3NgpXiOFX7KzLXb7iNcX/nttRbj2hWyfIvwq -ECLsqrkw9qtY1jkQMZkpAL2JZkH7dN6RwRgLn7Vhy506vvWolKMiVW4XSf/SKfE4 -Jl3vpao6+XF75tpYHdN0wgH6PmlYX63LaL4ULptswLbcoCb6dxriJNoaN+BnrdFz -gw2lGh1uEpJ+hGIAF728JRhX8tepb1mIvDS3LoV4nZbcFMMsilKbloxSZj2GFotH -uFEJjOp9zYhys2AzsfAKRO8P9Qk3iCQOLGsgOqL6EfJANZxEaGM7rDNvY7wsu/LS -y3Z9fYjYHcgFHW68lKlmjHdxx/qR+i9Rnuk5UrbnBEI= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIFQTCCAymgAwIBAgICDL4wDQYJKoZIhvcNAQELBQAwUTELMAkGA1UEBhMCVFcx -EjAQBgNVBAoTCVRBSVdBTi1DQTEQMA4GA1UECxMHUm9vdCBDQTEcMBoGA1UEAxMT -VFdDQSBHbG9iYWwgUm9vdCBDQTAeFw0xMjA2MjcwNjI4MzNaFw0zMDEyMzExNTU5 -NTlaMFExCzAJBgNVBAYTAlRXMRIwEAYDVQQKEwlUQUlXQU4tQ0ExEDAOBgNVBAsT -B1Jvb3QgQ0ExHDAaBgNVBAMTE1RXQ0EgR2xvYmFsIFJvb3QgQ0EwggIiMA0GCSqG -SIb3DQEBAQUAA4ICDwAwggIKAoICAQCwBdvI64zEbooh745NnHEKH1Jw7W2CnJfF -10xORUnLQEK1EjRsGcJ0pDFfhQKX7EMzClPSnIyOt7h52yvVavKOZsTuKwEHktSz -0ALfUPZVr2YOy+BHYC8rMjk1Ujoog/h7FsYYuGLWRyWRzvAZEk2tY/XTP3VfKfCh -MBwqoJimFb3u/Rk28OKRQ4/6ytYQJ0lM793B8YVwm8rqqFpD/G2Gb3PpN0Wp8DbH -zIh1HrtsBv+baz4X7GGqcXzGHaL3SekVtTzWoWH1EfcFbx39Eb7QMAfCKbAJTibc -46KokWofwpFFiFzlmLhxpRUZyXx1EcxwdE8tmx2RRP1WKKD+u4ZqyPpcC1jcxkt2 -yKsi2XMPpfRaAok/T54igu6idFMqPVMnaR1sjjIsZAAmY2E2TqNGtz99sy2sbZCi -laLOz9qC5wc0GZbpuCGqKX6mOL6OKUohZnkfs8O1CWfe1tQHRvMq2uYiN2DLgbYP -oA/pyJV/v1WRBXrPPRXAb94JlAGD1zQbzECl8LibZ9WYkTunhHiVJqRaCPgrdLQA -BDzfuBSO6N+pjWxnkjMdwLfS7JLIvgm/LCkFbwJrnu+8vyq8W8BQj0FwcYeyTbcE -qYSjMq+u7msXi7Kx/mzhkIyIqJdIzshNy/MGz19qCkKxHh53L46g5pIOBvwFItIm -4TFRfTLcDwIDAQABoyMwITAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB -/zANBgkqhkiG9w0BAQsFAAOCAgEAXzSBdu+WHdXltdkCY4QWwa6gcFGn90xHNcgL -1yg9iXHZqjNB6hQbbCEAwGxCGX6faVsgQt+i0trEfJdLjbDorMjupWkEmQqSpqsn -LhpNgb+E1HAerUf+/UqdM+DyucRFCCEK2mlpc3INvjT+lIutwx4116KD7+U4x6WF -H6vPNOw/KP4M8VeGTslV9xzU2KV9Bnpv1d8Q34FOIWWxtuEXeZVFBs5fzNxGiWNo -RI2T9GRwoD2dKAXDOXC4Ynsg/eTb6QihuJ49CcdP+yz4k3ZB3lLg4VfSnQO8d57+ -nile98FRYB/e2guyLXW3Q0iT5/Z5xoRdgFlglPx4mI88k1HtQJAH32RjJMtOcQWh -15QaiDLxInQirqWm2BJpTGCjAu4r7NRjkgtevi92a6O2JryPA9gK8kxkRr05YuWW -6zRjESjMlfGt7+/cgFhI6Uu46mWs6fyAtbXIRfmswZ/ZuepiiI7E8UuDEq3mi4TW -nsLrgxifarsbJGAzcMzs9zLzXNl5fe+epP7JI8Mk7hWSsT2RTyaGvWZzJBPqpK5j -wa19hAM8EHiGG3njxPPyBJUgriOCxLM6AGK/5jYk4Ve6xx6QddVfP5VhK8E7zeWz -aGHQRiapIVJpLesux+t3zqY6tQMzT3bR51xUAV3LePTJDL/PEo4XLSNolOer/qmy -KwbQBM0= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDezCCAmOgAwIBAgIBATANBgkqhkiG9w0BAQUFADBfMQswCQYDVQQGEwJUVzES -MBAGA1UECgwJVEFJV0FOLUNBMRAwDgYDVQQLDAdSb290IENBMSowKAYDVQQDDCFU -V0NBIFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMDgwODI4MDcyNDMz -WhcNMzAxMjMxMTU1OTU5WjBfMQswCQYDVQQGEwJUVzESMBAGA1UECgwJVEFJV0FO -LUNBMRAwDgYDVQQLDAdSb290IENBMSowKAYDVQQDDCFUV0NBIFJvb3QgQ2VydGlm -aWNhdGlvbiBBdXRob3JpdHkwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB -AQCwfnK4pAOU5qfeCTiRShFAh6d8WWQUe7UREN3+v9XAu1bihSX0NXIP+FPQQeFE -AcK0HMMxQhZHhTMidrIKbw/lJVBPhYa+v5guEGcevhEFhgWQxFnQfHgQsIBct+HH -K3XLfJ+utdGdIzdjp9xCoi2SBBtQwXu4PhvJVgSLL1KbralW6cH/ralYhzC2gfeX -RfwZVzsrb+RH9JlF/h3x+JejiB03HFyP4HYlmlD4oFT/RJB2I9IyxsOrBr/8+7/z -rX2SYgJbKdM1o5OaQ2RgXbL6Mv87BK9NQGr5x+PvI/1ry+UPizgN7gr8/g+YnzAx -3WxSZfmLgb4i4RxYA7qRG4kHAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNV -HRMBAf8EBTADAQH/MB0GA1UdDgQWBBRqOFsmjd6LWvJPelSDGRjjCDWmujANBgkq -hkiG9w0BAQUFAAOCAQEAPNV3PdrfibqHDAhUaiBQkr6wQT25JmSDCi/oQMCXKCeC -MErJk/9q56YAf4lCmtYR5VPOL8zy2gXE/uJQxDqGfczafhAJO5I1KlOy/usrBdls -XebQ79NqZp4VKIV66IIArB6nCWlWQtNoURi+VJq/REG6Sb4gumlc7rh3zc5sH62D -lhh9DrUUOYTxKOkto557HnpyWoOzeW/vtPzQCqVYT0bf+215WfKEIlKuD8z7fDvn -aspHYcN6+NOSBB+4IIThNlQWx0DeO4pz3N/GCUzf7Nr/1FNCocnyYh0igzyXxfkZ -YiesZSLX0zzG5Y6yU8xJzrww/nsOM5D77dIUkR8Hrw== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIFcjCCA1qgAwIBAgIQH51ZWtcvwgZEpYAIaeNe9jANBgkqhkiG9w0BAQUFADA/ -MQswCQYDVQQGEwJUVzEwMC4GA1UECgwnR292ZXJubWVudCBSb290IENlcnRpZmlj -YXRpb24gQXV0aG9yaXR5MB4XDTAyMTIwNTEzMjMzM1oXDTMyMTIwNTEzMjMzM1ow -PzELMAkGA1UEBhMCVFcxMDAuBgNVBAoMJ0dvdmVybm1lbnQgUm9vdCBDZXJ0aWZp -Y2F0aW9uIEF1dGhvcml0eTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIB -AJoluOzMonWoe/fOW1mKydGGEghU7Jzy50b2iPN86aXfTEc2pBsBHH8eV4qNw8XR -IePaJD9IK/ufLqGU5ywck9G/GwGHU5nOp/UKIXZ3/6m3xnOUT0b3EEk3+qhZSV1q -gQdW8or5BtD3cCJNtLdBuTK4sfCxw5w/cP1T3YGq2GN49thTbqGsaoQkclSGxtKy -yhwOeYHWtXBiCAEuTk8O1RGvqa/lmr/czIdtJuTJV6L7lvnM4T9TjGxMfptTCAts -F/tnyMKtsc2AtJfcdgEWFelq16TheEfOhtX7MfP6Mb40qij7cEwdScevLJ1tZqa2 -jWR+tSBqnTuBto9AAGdLiYa4zGX+FVPpBMHWXx1E1wovJ5pGfaENda1UhhXcSTvx -ls4Pm6Dso3pdvtUqdULle96ltqqvKKyskKw4t9VoNSZ63Pc78/1Fm9G7Q3hub/FC -VGqY8A2tl+lSXunVanLeavcbYBT0peS2cWeqH+riTcFCQP5nRhc4L0c/cZyu5SHK -YS1tB6iEfC3uUSXxY5Ce/eFXiGvviiNtsea9P63RPZYLhY3Naye7twWb7LuRqQoH -EgKXTiCQ8P8NHuJBO9NAOueNXdpm5AKwB1KYXA6OM5zCppX7VRluTI6uSw+9wThN -Xo+EHWbNxWCWtFJaBYmOlXqYwZE8lSOyDvR5tMl8wUohAgMBAAGjajBoMB0GA1Ud -DgQWBBTMzO/MKWCkO7GStjz6MmKPrCUVOzAMBgNVHRMEBTADAQH/MDkGBGcqBwAE -MTAvMC0CAQAwCQYFKw4DAhoFADAHBgVnKgMAAAQUA5vwIhP/lSg209yewDL7MTqK -UWUwDQYJKoZIhvcNAQEFBQADggIBAECASvomyc5eMN1PhnR2WPWus4MzeKR6dBcZ -TulStbngCnRiqmjKeKBMmo4sIy7VahIkv9Ro04rQ2JyftB8M3jh+Vzj8jeJPXgyf -qzvS/3WXy6TjZwj/5cAWtUgBfen5Cv8b5Wppv3ghqMKnI6mGq3ZW6A4M9hPdKmaK -ZEk9GhiHkASfQlK3T8v+R0F2Ne//AHY2RTKbxkaFXeIksB7jSJaYV0eUVXoPQbFE -JPPB/hprv4j9wabak2BegUqZIJxIZhm1AHlUD7gsL0u8qV1bYH+Mh6XgUmMqvtg7 -hUAV/h62ZT/FS9p+tXo1KaMuephgIqP0fSdOLeq0dDzpD6QzDxARvBMB1uUO07+1 -EqLhRSPAzAhuYbeJq4PjJB7mXQfnHyA+z2fI56wwbSdLaG5LKlwCCDTb+HbkZ6Mm -nD+iMsJKxYEYMRBWqoTvLQr/uB930r+lWKBi5NdLkXWNiYCYfm3LU05er/ayl4WX -udpVBrkk7tfGOB5jGxI7leFYrPLfhNVfmS8NVVvmONsuP3LpSIXLuykTjx44Vbnz -ssQwmSNOXfJIoRIM3BKQCZBUkQM8R+XVyWXgt0t97EfTsws+rZ7QdAAO671RrcDe -LMDDav7v3Aun+kbfYNucpllQdSNpc5Oy+fwC00fmcc4QAu4njIT/rEUNE1yDMuAl -pYYsfPQS ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIFODCCAyCgAwIBAgIRAJW+FqD3LkbxezmCcvqLzZYwDQYJKoZIhvcNAQEFBQAw -NzEUMBIGA1UECgwLVGVsaWFTb25lcmExHzAdBgNVBAMMFlRlbGlhU29uZXJhIFJv -b3QgQ0EgdjEwHhcNMDcxMDE4MTIwMDUwWhcNMzIxMDE4MTIwMDUwWjA3MRQwEgYD -VQQKDAtUZWxpYVNvbmVyYTEfMB0GA1UEAwwWVGVsaWFTb25lcmEgUm9vdCBDQSB2 -MTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMK+6yfwIaPzaSZVfp3F -VRaRXP3vIb9TgHot0pGMYzHw7CTww6XScnwQbfQ3t+XmfHnqjLWCi65ItqwA3GV1 -7CpNX8GH9SBlK4GoRz6JI5UwFpB/6FcHSOcZrr9FZ7E3GwYq/t75rH2D+1665I+X -Z75Ljo1kB1c4VWk0Nj0TSO9P4tNmHqTPGrdeNjPUtAa9GAH9d4RQAEX1jF3oI7x+ -/jXh7VB7qTCNGdMJjmhnXb88lxhTuylixcpecsHHltTbLaC0H2kD7OriUPEMPPCs -81Mt8Bz17Ww5OXOAFshSsCPN4D7c3TxHoLs1iuKYaIu+5b9y7tL6pe0S7fyYGKkm -dtwoSxAgHNN/Fnct7W+A90m7UwW7XWjH1Mh1Fj+JWov3F0fUTPHSiXk+TT2YqGHe -Oh7S+F4D4MHJHIzTjU3TlTazN19jY5szFPAtJmtTfImMMsJu7D0hADnJoWjiUIMu -sDor8zagrC/kb2HCUQk5PotTubtn2txTuXZZNp1D5SDgPTJghSJRt8czu90VL6R4 -pgd7gUY2BIbdeTXHlSw7sKMXNeVzH7RcWe/a6hBle3rQf5+ztCo3O3CLm1u5K7fs -slESl1MpWtTwEhDcTwK7EpIvYtQ/aUN8Ddb8WHUBiJ1YFkveupD/RwGJBmr2X7KQ -arMCpgKIv7NHfirZ1fpoeDVNAgMBAAGjPzA9MA8GA1UdEwEB/wQFMAMBAf8wCwYD -VR0PBAQDAgEGMB0GA1UdDgQWBBTwj1k4ALP1j5qWDNXr+nuqF+gTEjANBgkqhkiG -9w0BAQUFAAOCAgEAvuRcYk4k9AwI//DTDGjkk0kiP0Qnb7tt3oNmzqjMDfz1mgbl -dxSR651Be5kqhOX//CHBXfDkH1e3damhXwIm/9fH907eT/j3HEbAek9ALCI18Bmx -0GtnLLCo4MBANzX2hFxc469CeP6nyQ1Q6g2EdvZR74NTxnr/DlZJLo961gzmJ1Tj -TQpgcmLNkQfWpb/ImWvtxBnmq0wROMVvMeJuScg/doAmAyYp4Db29iBT4xdwNBed -Y2gea+zDTYa4EzAvXUYNR0PVG6pZDrlcjQZIrXSHX8f8MVRBE+LHIQ6e4B4N4cB7 -Q4WQxYpYxmUKeFfyxiMPAdkgS94P+5KFdSpcc41teyWRyu5FrgZLAMzTsVlQ2jqI -OylDRl6XK1TOU2+NSueW+r9xDkKLfP0ooNBIytrEgUy7onOTJsjrDNYmiLbAJM+7 -vVvrdX3pCI6GMyx5dwlppYn8s3CQh3aP0yK7Qs69cwsgJirQmz1wHiRszYd2qReW -t88NkvuOGKmYSdGe/mBEciG5Ge3C9THxOUiIkCR1VBatzvT4aRRkOfujuLpwQMcn -HL/EVlP6Y2XQ8xwOFvVrhlhNGNTkDY6lnVuR3HYkUD/GKvvZt5y11ubQ2egZixVx -SK236thZiNSQvxaz2emsWWFUyBy6ysHK4bkgTI86k4mloMy/0/Z1pHWWbVY= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDZzCCAk+gAwIBAgIQGx+ttiD5JNM2a/fH8YygWTANBgkqhkiG9w0BAQUFADBF -MQswCQYDVQQGEwJHQjEYMBYGA1UEChMPVHJ1c3RpcyBMaW1pdGVkMRwwGgYDVQQL -ExNUcnVzdGlzIEZQUyBSb290IENBMB4XDTAzMTIyMzEyMTQwNloXDTI0MDEyMTEx -MzY1NFowRTELMAkGA1UEBhMCR0IxGDAWBgNVBAoTD1RydXN0aXMgTGltaXRlZDEc -MBoGA1UECxMTVHJ1c3RpcyBGUFMgUm9vdCBDQTCCASIwDQYJKoZIhvcNAQEBBQAD -ggEPADCCAQoCggEBAMVQe547NdDfxIzNjpvto8A2mfRC6qc+gIMPpqdZh8mQRUN+ -AOqGeSoDvT03mYlmt+WKVoaTnGhLaASMk5MCPjDSNzoiYYkchU59j9WvezX2fihH -iTHcDnlkH5nSW7r+f2C/revnPDgpai/lkQtV/+xvWNUtyd5MZnGPDNcE2gfmHhjj -vSkCqPoc4Vu5g6hBSLwacY3nYuUtsuvffM/bq1rKMfFMIvMFE/eC+XN5DL7XSxzA -0RU8k0Fk0ea+IxciAIleH2ulrG6nS4zto3Lmr2NNL4XSFDWaLk6M6jKYKIahkQlB -OrTh4/L68MkKokHdqeMDx4gVOxzUGpTXn2RZEm0CAwEAAaNTMFEwDwYDVR0TAQH/ -BAUwAwEB/zAfBgNVHSMEGDAWgBS6+nEleYtXQSUhhgtx67JkDoshZzAdBgNVHQ4E -FgQUuvpxJXmLV0ElIYYLceuyZA6LIWcwDQYJKoZIhvcNAQEFBQADggEBAH5Y//01 -GX2cGE+esCu8jowU/yyg2kdbw++BLa8F6nRIW/M+TgfHbcWzk88iNVy2P3UnXwmW -zaD+vkAMXBJV+JOCyinpXj9WV4s4NvdFGkwozZ5BuO1WTISkQMi4sKUraXAEasP4 -1BIy+Q7DsdwyhEQsb8tGD+pmQQ9P8Vilpg0ND2HepZ5dfWWhPBfnqFVO76DH7cZE -f1T1o+CP8HxVIo8ptoGj4W1OLBuAZ+ytIJ8MYmHVl/9D7S3B2l0pKoU/rGXuhg8F -jZBf3+6f9L/uHfuY5H+QK4R4EA5sSVPvFVtlRkpdr7r7OnIdzfYliB6XzCGcKQEN -ZetX2fNXlrtIzYE= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIFFzCCA/+gAwIBAgIBETANBgkqhkiG9w0BAQUFADCCASsxCzAJBgNVBAYTAlRS -MRgwFgYDVQQHDA9HZWJ6ZSAtIEtvY2FlbGkxRzBFBgNVBAoMPlTDvHJraXllIEJp -bGltc2VsIHZlIFRla25vbG9qaWsgQXJhxZ90xLFybWEgS3VydW11IC0gVMOcQsSw -VEFLMUgwRgYDVQQLDD9VbHVzYWwgRWxla3Ryb25payB2ZSBLcmlwdG9sb2ppIEFy -YcWfdMSxcm1hIEVuc3RpdMO8c8O8IC0gVUVLQUUxIzAhBgNVBAsMGkthbXUgU2Vy -dGlmaWthc3lvbiBNZXJrZXppMUowSAYDVQQDDEFUw5xCxLBUQUsgVUVLQUUgS8O2 -ayBTZXJ0aWZpa2EgSGl6bWV0IFNhxJ9sYXnEsWPEsXPEsSAtIFPDvHLDvG0gMzAe -Fw0wNzA4MjQxMTM3MDdaFw0xNzA4MjExMTM3MDdaMIIBKzELMAkGA1UEBhMCVFIx -GDAWBgNVBAcMD0dlYnplIC0gS29jYWVsaTFHMEUGA1UECgw+VMO8cmtpeWUgQmls -aW1zZWwgdmUgVGVrbm9sb2ppayBBcmHFn3TEsXJtYSBLdXJ1bXUgLSBUw5xCxLBU -QUsxSDBGBgNVBAsMP1VsdXNhbCBFbGVrdHJvbmlrIHZlIEtyaXB0b2xvamkgQXJh -xZ90xLFybWEgRW5zdGl0w7xzw7wgLSBVRUtBRTEjMCEGA1UECwwaS2FtdSBTZXJ0 -aWZpa2FzeW9uIE1lcmtlemkxSjBIBgNVBAMMQVTDnELEsFRBSyBVRUtBRSBLw7Zr -IFNlcnRpZmlrYSBIaXptZXQgU2HEn2xhecSxY8Sxc8SxIC0gU8O8csO8bSAzMIIB -IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAim1L/xCIOsP2fpTo6iBkcK4h -gb46ezzb8R1Sf1n68yJMlaCQvEhOEav7t7WNeoMojCZG2E6VQIdhn8WebYGHV2yK -O7Rm6sxA/OOqbLLLAdsyv9Lrhc+hDVXDWzhXcLh1xnnRFDDtG1hba+818qEhTsXO -fJlfbLm4IpNQp81McGq+agV/E5wrHur+R84EpW+sky58K5+eeROR6Oqeyjh1jmKw -lZMq5d/pXpduIF9fhHpEORlAHLpVK/swsoHvhOPc7Jg4OQOFCKlUAwUp8MmPi+oL -hmUZEdPpCSPeaJMDyTYcIW7OjGbxmTDY17PDHfiBLqi9ggtm/oLL4eAagsNAgQID -AQABo0IwQDAdBgNVHQ4EFgQUvYiHyY/2pAoLquvF/pEjnatKijIwDgYDVR0PAQH/ -BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAB18+kmP -NOm3JpIWmgV050vQbTlswyb2zrgxvMTfvCr4N5EY3ATIZJkrGG2AA1nJrvhY0D7t -wyOfaTyGOBye79oneNGEN3GKPEs5z35FBtYt2IpNeBLWrcLTy9LQQfMmNkqblWwM -7uXRQydmwYj3erMgbOqwaSvHIOgMA8RBBZniP+Rr+KCGgceExh/VS4ESshYhLBOh -gLJeDEoTniDYYkCrkOpkSi+sDQESeUWoL4cZaMjihccwsnX5OD+ywJO0a+IDRM5n -oN+J1q2MdqMTw5RhK2vZbMEHCiIHhWyFJEapvj+LeISCfiQMnf2BN+MlqO02TpUs -yZyQ2uypQjyttgI= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIEJzCCAw+gAwIBAgIHAI4X/iQggTANBgkqhkiG9w0BAQsFADCBsTELMAkGA1UE -BhMCVFIxDzANBgNVBAcMBkFua2FyYTFNMEsGA1UECgxEVMOcUktUUlVTVCBCaWxn -aSDEsGxldGnFn2ltIHZlIEJpbGnFn2ltIEfDvHZlbmxpxJ9pIEhpem1ldGxlcmkg -QS7Fni4xQjBABgNVBAMMOVTDnFJLVFJVU1QgRWxla3Ryb25payBTZXJ0aWZpa2Eg -SGl6bWV0IFNhxJ9sYXnEsWPEsXPEsSBINTAeFw0xMzA0MzAwODA3MDFaFw0yMzA0 -MjgwODA3MDFaMIGxMQswCQYDVQQGEwJUUjEPMA0GA1UEBwwGQW5rYXJhMU0wSwYD -VQQKDERUw5xSS1RSVVNUIEJpbGdpIMSwbGV0acWfaW0gdmUgQmlsacWfaW0gR8O8 -dmVubGnEn2kgSGl6bWV0bGVyaSBBLsWeLjFCMEAGA1UEAww5VMOcUktUUlVTVCBF -bGVrdHJvbmlrIFNlcnRpZmlrYSBIaXptZXQgU2HEn2xhecSxY8Sxc8SxIEg1MIIB -IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEApCUZ4WWe60ghUEoI5RHwWrom -/4NZzkQqL/7hzmAD/I0Dpe3/a6i6zDQGn1k19uwsu537jVJp45wnEFPzpALFp/kR -Gml1bsMdi9GYjZOHp3GXDSHHmflS0yxjXVW86B8BSLlg/kJK9siArs1mep5Fimh3 -4khon6La8eHBEJ/rPCmBp+EyCNSgBbGM+42WAA4+Jd9ThiI7/PS98wl+d+yG6w8z -5UNP9FR1bSmZLmZaQ9/LXMrI5Tjxfjs1nQ/0xVqhzPMggCTTV+wVunUlm+hkS7M0 -hO8EuPbJbKoCPrZV4jI3X/xml1/N1p7HIL9Nxqw/dV8c7TKcfGkAaZHjIxhT6QID -AQABo0IwQDAdBgNVHQ4EFgQUVpkHHtOsDGlktAxQR95DLL4gwPswDgYDVR0PAQH/ -BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEBAJ5FdnsX -SDLyOIspve6WSk6BGLFRRyDN0GSxDsnZAdkJzsiZ3GglE9Rc8qPoBP5yCccLqh0l -VX6Wmle3usURehnmp349hQ71+S4pL+f5bFgWV1Al9j4uPqrtd3GqqpmWRgqujuwq -URawXs3qZwQcWDD1YIq9pr1N5Za0/EKJAWv2cMhQOQwt1WbZyNKzMrcbGW3LM/nf -peYVhDfwwvJllpKQd/Ct9JDpEXjXk4nAPQu6KfTomZ1yju2dL+6SfaHx/126M2CF -Yv4HAqGEVka+lgqaE9chTLd8B59OTj+RdPsnnRHM3eaxynFNExc5JsUpISuTKWqW -+qtB4Uu2NQvAmxU= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIEJjCCAw6gAwIBAgIGfaHyZeyKMA0GCSqGSIb3DQEBCwUAMIGxMQswCQYDVQQG -EwJUUjEPMA0GA1UEBwwGQW5rYXJhMU0wSwYDVQQKDERUw5xSS1RSVVNUIEJpbGdp -IMSwbGV0acWfaW0gdmUgQmlsacWfaW0gR8O8dmVubGnEn2kgSGl6bWV0bGVyaSBB -LsWeLjFCMEAGA1UEAww5VMOcUktUUlVTVCBFbGVrdHJvbmlrIFNlcnRpZmlrYSBI -aXptZXQgU2HEn2xhecSxY8Sxc8SxIEg2MB4XDTEzMTIxODA5MDQxMFoXDTIzMTIx -NjA5MDQxMFowgbExCzAJBgNVBAYTAlRSMQ8wDQYDVQQHDAZBbmthcmExTTBLBgNV -BAoMRFTDnFJLVFJVU1QgQmlsZ2kgxLBsZXRpxZ9pbSB2ZSBCaWxpxZ9pbSBHw7x2 -ZW5sacSfaSBIaXptZXRsZXJpIEEuxZ4uMUIwQAYDVQQDDDlUw5xSS1RSVVNUIEVs -ZWt0cm9uaWsgU2VydGlmaWthIEhpem1ldCBTYcSfbGF5xLFjxLFzxLEgSDYwggEi -MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCdsGjW6L0UlqMACprx9MfMkU1x -eHe59yEmFXNRFpQJRwXiM/VomjX/3EsvMsew7eKC5W/a2uqsxgbPJQ1BgfbBOCK9 -+bGlprMBvD9QFyv26WZV1DOzXPhDIHiTVRZwGTLmiddk671IUP320EEDwnS3/faA -z1vFq6TWlRKb55cTMgPp1KtDWxbtMyJkKbbSk60vbNg9tvYdDjTu0n2pVQ8g9P0p -u5FbHH3GQjhtQiht1AH7zYiXSX6484P4tZgvsycLSF5W506jM7NE1qXyGJTtHB6p -lVxiSvgNZ1GpryHV+DKdeboaX+UEVU0TRv/yz3THGmNtwx8XEsMeED5gCLMxAgMB -AAGjQjBAMB0GA1UdDgQWBBTdVRcT9qzoSCHK77Wv0QAy7Z6MtTAOBgNVHQ8BAf8E -BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAQEAb1gNl0Oq -FlQ+v6nfkkU/hQu7VtMMUszIv3ZnXuaqs6fvuay0EBQNdH49ba3RfdCaqaXKGDsC -QC4qnFAUi/5XfldcEQlLNkVS9z2sFP1E34uXI9TDwe7UU5X+LEr+DXCqu4svLcsy -o4LyVN/Y8t3XSHLuSqMplsNEzm61kod2pLv0kmzOLBQJZo6NrRa1xxsJYTvjIKID -gI6tflEATseWhvtDmHd9KMeP2Cpu54Rvl0EpABZeTeIT6lnAY2c6RPuY/ATTMHKm -9ocJV612ph1jmv3XZch4gyt1O6VbuA1df74jrlZVlFjvH4GMKrLN5ptjnhi85WsG -tAuYSyher4hYyw== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIICjzCCAhWgAwIBAgIQXIuZxVqUxdJxVt7NiYDMJjAKBggqhkjOPQQDAzCBiDEL -MAkGA1UEBhMCVVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNl -eSBDaXR5MR4wHAYDVQQKExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMT -JVVTRVJUcnVzdCBFQ0MgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMTAwMjAx -MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBiDELMAkGA1UEBhMCVVMxEzARBgNVBAgT -Ck5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQKExVUaGUg -VVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBFQ0MgQ2VydGlm -aWNhdGlvbiBBdXRob3JpdHkwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQarFRaqflo -I+d61SRvU8Za2EurxtW20eZzca7dnNYMYf3boIkDuAUU7FfO7l0/4iGzzvfUinng -o4N+LZfQYcTxmdwlkWOrfzCjtHDix6EznPO/LlxTsV+zfTJ/ijTjeXmjQjBAMB0G -A1UdDgQWBBQ64QmG1M8ZwpZ2dEl23OA1xmNjmjAOBgNVHQ8BAf8EBAMCAQYwDwYD -VR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAwNoADBlAjA2Z6EWCNzklwBBHU6+4WMB -zzuqQhFkoJ2UOQIReVx7Hfpkue4WQrO/isIJxOzksU0CMQDpKmFHjFJKS04YcPbW -RNZu9YO6bVi9JNlWSOrvxKJGgYhqOkbRqZtNyWHa0V1Xahg= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIF3jCCA8agAwIBAgIQAf1tMPyjylGoG7xkDjUDLTANBgkqhkiG9w0BAQwFADCB -iDELMAkGA1UEBhMCVVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0pl -cnNleSBDaXR5MR4wHAYDVQQKExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNV -BAMTJVVTRVJUcnVzdCBSU0EgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMTAw -MjAxMDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBiDELMAkGA1UEBhMCVVMxEzARBgNV -BAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQKExVU -aGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBSU0EgQ2Vy -dGlmaWNhdGlvbiBBdXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIK -AoICAQCAEmUXNg7D2wiz0KxXDXbtzSfTTK1Qg2HiqiBNCS1kCdzOiZ/MPans9s/B -3PHTsdZ7NygRK0faOca8Ohm0X6a9fZ2jY0K2dvKpOyuR+OJv0OwWIJAJPuLodMkY -tJHUYmTbf6MG8YgYapAiPLz+E/CHFHv25B+O1ORRxhFnRghRy4YUVD+8M/5+bJz/ -Fp0YvVGONaanZshyZ9shZrHUm3gDwFA66Mzw3LyeTP6vBZY1H1dat//O+T23LLb2 -VN3I5xI6Ta5MirdcmrS3ID3KfyI0rn47aGYBROcBTkZTmzNg95S+UzeQc0PzMsNT -79uq/nROacdrjGCT3sTHDN/hMq7MkztReJVni+49Vv4M0GkPGw/zJSZrM233bkf6 -c0Plfg6lZrEpfDKEY1WJxA3Bk1QwGROs0303p+tdOmw1XNtB1xLaqUkL39iAigmT -Yo61Zs8liM2EuLE/pDkP2QKe6xJMlXzzawWpXhaDzLhn4ugTncxbgtNMs+1b/97l -c6wjOy0AvzVVdAlJ2ElYGn+SNuZRkg7zJn0cTRe8yexDJtC/QV9AqURE9JnnV4ee -UB9XVKg+/XRjL7FQZQnmWEIuQxpMtPAlR1n6BB6T1CZGSlCBst6+eLf8ZxXhyVeE -Hg9j1uliutZfVS7qXMYoCAQlObgOK6nyTJccBz8NUvXt7y+CDwIDAQABo0IwQDAd -BgNVHQ4EFgQUU3m/WqorSs9UgOHYm8Cd8rIDZsswDgYDVR0PAQH/BAQDAgEGMA8G -A1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEMBQADggIBAFzUfA3P9wF9QZllDHPF -Up/L+M+ZBn8b2kMVn54CVVeWFPFSPCeHlCjtHzoBN6J2/FNQwISbxmtOuowhT6KO -VWKR82kV2LyI48SqC/3vqOlLVSoGIG1VeCkZ7l8wXEskEVX/JJpuXior7gtNn3/3 -ATiUFJVDBwn7YKnuHKsSjKCaXqeYalltiz8I+8jRRa8YFWSQEg9zKC7F4iRO/Fjs -8PRF/iKz6y+O0tlFYQXBl2+odnKPi4w2r78NBc5xjeambx9spnFixdjQg3IM8WcR -iQycE0xyNN+81XHfqnHd4blsjDwSXWXavVcStkNr/+XeTWYRUc+ZruwXtuhxkYze -Sf7dNXGiFSeUHM9h4ya7b6NnJSFd5t0dCy5oGzuCr+yDZ4XUmFF0sbmZgIn/f3gZ -XHlKYC6SQK5MNyosycdiyA5d9zZbyuAlJQG03RoHnHcAP9Dc1ew91Pq7P8yF1m9/ -qS3fuQL39ZeatTXaw2ewh0qpKJ4jjv9cJ2vhsE/zB+4ALtRZh8tSQZXq9EfX7mRB -VXyNWQKV3WKdwrnuWih0hKWbt5DHDAff9Yk2dDLWKMGwsAvgnEzDHNb842m1R0aB -L6KCq9NjRHDEjf8tM7qtj3u1cIiuPhnPQCjY/MiQu12ZIvVS5ljFH4gxQ+6IHdfG -jjxDah2nGN59PRbxYvnKkKj9 ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIEXjCCA0agAwIBAgIQRL4Mi1AAIbQR0ypoBqmtaTANBgkqhkiG9w0BAQUFADCB -kzELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAlVUMRcwFQYDVQQHEw5TYWx0IExha2Ug -Q2l0eTEeMBwGA1UEChMVVGhlIFVTRVJUUlVTVCBOZXR3b3JrMSEwHwYDVQQLExho -dHRwOi8vd3d3LnVzZXJ0cnVzdC5jb20xGzAZBgNVBAMTElVUTiAtIERBVEFDb3Jw -IFNHQzAeFw05OTA2MjQxODU3MjFaFw0xOTA2MjQxOTA2MzBaMIGTMQswCQYDVQQG -EwJVUzELMAkGA1UECBMCVVQxFzAVBgNVBAcTDlNhbHQgTGFrZSBDaXR5MR4wHAYD -VQQKExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxITAfBgNVBAsTGGh0dHA6Ly93d3cu -dXNlcnRydXN0LmNvbTEbMBkGA1UEAxMSVVROIC0gREFUQUNvcnAgU0dDMIIBIjAN -BgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA3+5YEKIrblXEjr8uRgnn4AgPLit6 -E5Qbvfa2gI5lBZMAHryv4g+OGQ0SR+ysraP6LnD43m77VkIVni5c7yPeIbkFdicZ -D0/Ww5y0vpQZY/KmEQrrU0icvvIpOxboGqBMpsn0GFlowHDyUwDAXlCCpVZvNvlK -4ESGoE1O1kduSUrLZ9emxAW5jh70/P/N5zbgnAVssjMiFdC04MwXwLLA9P4yPykq -lXvY8qdOD1R8oQ2AswkDwf9c3V6aPryuvEeKaq5xyh+xKrhfQgUL7EYw0XILyulW -bfXv33i+Ybqypa4ETLyorGkVl73v67SMvzX41MPRKA5cOp9wGDMgd8SirwIDAQAB -o4GrMIGoMAsGA1UdDwQEAwIBxjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRT -MtGzz3/64PGgXYVOktKeRR20TzA9BgNVHR8ENjA0MDKgMKAuhixodHRwOi8vY3Js -LnVzZXJ0cnVzdC5jb20vVVROLURBVEFDb3JwU0dDLmNybDAqBgNVHSUEIzAhBggr -BgEFBQcDAQYKKwYBBAGCNwoDAwYJYIZIAYb4QgQBMA0GCSqGSIb3DQEBBQUAA4IB -AQAnNZcAiosovcYzMB4p/OL31ZjUQLtgyr+rFywJNn9Q+kHcrpY6CiM+iVnJowft -Gzet/Hy+UUla3joKVAgWRcKZsYfNjGjgaQPpxE6YsjuMFrMOoAyYUJuTqXAJyCyj -j98C5OBxOvG0I3KgqgHf35g+FFCgMSa9KOlaMCZ1+XtgHI3zzVAmbQQnmt/VDUVH -KWss5nbZqSl9Mt3JNjy9rjXxEZ4du5A/EkdOjtd+D2JzHVImOBwYSf0wdJrE5SIv -2MCN7ZF6TACPcn9d2t0bi0Vr591pl6jFVkwPDPafepE39peC4N1xaf92P2BNPM/3 -mfnGV/TJVTl4uix5yaaIK/QI ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIEdDCCA1ygAwIBAgIQRL4Mi1AAJLQR0zYq/mUK/TANBgkqhkiG9w0BAQUFADCB -lzELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAlVUMRcwFQYDVQQHEw5TYWx0IExha2Ug -Q2l0eTEeMBwGA1UEChMVVGhlIFVTRVJUUlVTVCBOZXR3b3JrMSEwHwYDVQQLExho -dHRwOi8vd3d3LnVzZXJ0cnVzdC5jb20xHzAdBgNVBAMTFlVUTi1VU0VSRmlyc3Qt -SGFyZHdhcmUwHhcNOTkwNzA5MTgxMDQyWhcNMTkwNzA5MTgxOTIyWjCBlzELMAkG -A1UEBhMCVVMxCzAJBgNVBAgTAlVUMRcwFQYDVQQHEw5TYWx0IExha2UgQ2l0eTEe -MBwGA1UEChMVVGhlIFVTRVJUUlVTVCBOZXR3b3JrMSEwHwYDVQQLExhodHRwOi8v -d3d3LnVzZXJ0cnVzdC5jb20xHzAdBgNVBAMTFlVUTi1VU0VSRmlyc3QtSGFyZHdh -cmUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCx98M4P7Sof885glFn -0G2f0v9Y8+efK+wNiVSZuTiZFvfgIXlIwrthdBKWHTxqctU8EGc6Oe0rE81m65UJ -M6Rsl7HoxuzBdXmcRl6Nq9Bq/bkqVRcQVLMZ8Jr28bFdtqdt++BxF2uiiPsA3/4a -MXcMmgF6sTLjKwEHOG7DpV4jvEWbe1DByTCP2+UretNb+zNAHqDVmBe8i4fDidNd -oI6yqqr2jmmIBsX6iSHzCJ1pLgkzmykNRg+MzEk0sGlRvfkGzWitZky8PqxhvQqI -DsjfPe58BEydCl5rkdbux+0ojatNh4lz0G6k0B4WixThdkQDf2Os5M1JnMWS9Ksy -oUhbAgMBAAGjgbkwgbYwCwYDVR0PBAQDAgHGMA8GA1UdEwEB/wQFMAMBAf8wHQYD -VR0OBBYEFKFyXyYbKJhDlV0HN9WFlp1L0sNFMEQGA1UdHwQ9MDswOaA3oDWGM2h0 -dHA6Ly9jcmwudXNlcnRydXN0LmNvbS9VVE4tVVNFUkZpcnN0LUhhcmR3YXJlLmNy -bDAxBgNVHSUEKjAoBggrBgEFBQcDAQYIKwYBBQUHAwUGCCsGAQUFBwMGBggrBgEF -BQcDBzANBgkqhkiG9w0BAQUFAAOCAQEARxkP3nTGmZev/K0oXnWO6y1n7k57K9cM -//bey1WiCuFMVGWTYGufEpytXoMs61quwOQt9ABjHbjAbPLPSbtNk28Gpgoiskli -CE7/yMgUsogWXecB5BKV5UU0s4tpvc+0hY91UZ59Ojg6FEgSxvunOxqNDYJAB+gE -CJChicsZUN/KHAG8HQQZexB2lzvukJDKxA4fFm517zP4029bHpbj4HR3dHuKom4t -3XbWOTCC8KucUvIqx69JXn7HaOWCgchqJ/kniCrVWFCVH/A7HFe7fRQ5YiuayZSS -KqMiDP+JJn1fIytH1xUdqWqeUQ0qUZ6B+dQ7XnASfxAynB67nfhmqA== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDhDCCAwqgAwIBAgIQL4D+I4wOIg9IZxIokYesszAKBggqhkjOPQQDAzCByjEL -MAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZW -ZXJpU2lnbiBUcnVzdCBOZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNyBWZXJpU2ln -biwgSW5jLiAtIEZvciBhdXRob3JpemVkIHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJp -U2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9y -aXR5IC0gRzQwHhcNMDcxMTA1MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCByjELMAkG -A1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJp -U2lnbiBUcnVzdCBOZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNyBWZXJpU2lnbiwg -SW5jLiAtIEZvciBhdXRob3JpemVkIHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2ln -biBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5 -IC0gRzQwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAASnVnp8Utpkmw4tXNherJI9/gHm -GUo9FANL+mAnINmDiWn6VMaaGF5VKmTeBvaNSjutEDxlPZCIBIngMGGzrl0Bp3ve -fLK+ymVhAIau2o970ImtTR1ZmkGxvEeA3J5iw/mjgbIwga8wDwYDVR0TAQH/BAUw -AwEB/zAOBgNVHQ8BAf8EBAMCAQYwbQYIKwYBBQUHAQwEYTBfoV2gWzBZMFcwVRYJ -aW1hZ2UvZ2lmMCEwHzAHBgUrDgMCGgQUj+XTGoasjY5rw8+AatRIGCx7GS4wJRYj -aHR0cDovL2xvZ28udmVyaXNpZ24uY29tL3ZzbG9nby5naWYwHQYDVR0OBBYEFLMW -kf3upm7ktS5Jj4d4gYDs5bG1MAoGCCqGSM49BAMDA2gAMGUCMGYhDBgmYFo4e1ZC -4Kf8NoRRkSAsdk1DPcQdhCPQrNZ8NQbOzWm9kA3bbEhCHQ6qQgIxAJw9SDkjOVga -FRJZap7v1VmyHVIsmXHNxynfGyphe3HR3vPA5Q06Sqotp9iGKt0uEA== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIE0zCCA7ugAwIBAgIQGNrRniZ96LtKIVjNzGs7SjANBgkqhkiG9w0BAQUFADCB -yjELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQL -ExZWZXJpU2lnbiBUcnVzdCBOZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNiBWZXJp -U2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVkIHVzZSBvbmx5MUUwQwYDVQQDEzxW -ZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0 -aG9yaXR5IC0gRzUwHhcNMDYxMTA4MDAwMDAwWhcNMzYwNzE2MjM1OTU5WjCByjEL -MAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZW -ZXJpU2lnbiBUcnVzdCBOZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNiBWZXJpU2ln -biwgSW5jLiAtIEZvciBhdXRob3JpemVkIHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJp -U2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9y -aXR5IC0gRzUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCvJAgIKXo1 -nmAMqudLO07cfLw8RRy7K+D+KQL5VwijZIUVJ/XxrcgxiV0i6CqqpkKzj/i5Vbex -t0uz/o9+B1fs70PbZmIVYc9gDaTY3vjgw2IIPVQT60nKWVSFJuUrjxuf6/WhkcIz -SdhDY2pSS9KP6HBRTdGJaXvHcPaz3BJ023tdS1bTlr8Vd6Gw9KIl8q8ckmcY5fQG -BO+QueQA5N06tRn/Arr0PO7gi+s3i+z016zy9vA9r911kTMZHRxAy3QkGSGT2RT+ -rCpSx4/VBEnkjWNHiDxpg8v+R70rfk/Fla4OndTRQ8Bnc+MUCH7lP59zuDMKz10/ -NIeWiu5T6CUVAgMBAAGjgbIwga8wDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8E -BAMCAQYwbQYIKwYBBQUHAQwEYTBfoV2gWzBZMFcwVRYJaW1hZ2UvZ2lmMCEwHzAH -BgUrDgMCGgQUj+XTGoasjY5rw8+AatRIGCx7GS4wJRYjaHR0cDovL2xvZ28udmVy -aXNpZ24uY29tL3ZzbG9nby5naWYwHQYDVR0OBBYEFH/TZafC3ey78DAJ80M5+gKv -MzEzMA0GCSqGSIb3DQEBBQUAA4IBAQCTJEowX2LP2BqYLz3q3JktvXf2pXkiOOzE -p6B4Eq1iDkVwZMXnl2YtmAl+X6/WzChl8gGqCBpH3vn5fJJaCGkgDdk+bW48DW7Y -5gaRQBi5+MHt39tBquCWIMnNZBU4gcmU7qKEKQsTb47bDN0lAtukixlE0kF6BWlK -WE9gyn6CagsCqiUXObXbf+eEZSqVir2G3l6BFoMtEMze/aiCKm0oHw0LxOXnGiYZ -4fQRbxC1lfznQgUy286dUV4otp6F01vvpX1FQHKOtw5rDgb7MzVIcbidJ4vEZV8N -hnacRHr2lVz2XTIIM6RUthg/aFzyQkqFOFSDX9HoLPKsEdao7WNq ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIEuTCCA6GgAwIBAgIQQBrEZCGzEyEDDrvkEhrFHTANBgkqhkiG9w0BAQsFADCB -vTELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQL -ExZWZXJpU2lnbiBUcnVzdCBOZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwOCBWZXJp -U2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVkIHVzZSBvbmx5MTgwNgYDVQQDEy9W -ZXJpU2lnbiBVbml2ZXJzYWwgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAe -Fw0wODA0MDIwMDAwMDBaFw0zNzEyMDEyMzU5NTlaMIG9MQswCQYDVQQGEwJVUzEX -MBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRydXN0 -IE5ldHdvcmsxOjA4BgNVBAsTMShjKSAyMDA4IFZlcmlTaWduLCBJbmMuIC0gRm9y -IGF1dGhvcml6ZWQgdXNlIG9ubHkxODA2BgNVBAMTL1ZlcmlTaWduIFVuaXZlcnNh -bCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEF -AAOCAQ8AMIIBCgKCAQEAx2E3XrEBNNti1xWb/1hajCMj1mCOkdeQmIN65lgZOIzF -9uVkhbSicfvtvbnazU0AtMgtc6XHaXGVHzk8skQHnOgO+k1KxCHfKWGPMiJhgsWH -H26MfF8WIFFE0XBPV+rjHOPMee5Y2A7Cs0WTwCznmhcrewA3ekEzeOEz4vMQGn+H -LL729fdC4uW/h2KJXwBL38Xd5HVEMkE6HnFuacsLdUYI0crSK5XQz/u5QGtkjFdN -/BMReYTtXlT2NJ8IAfMQJQYXStrxHXpma5hgZqTZ79IugvHw7wnqRMkVauIDbjPT -rJ9VAMf2CGqUuV/c4DPxhGD5WycRtPwW8rtWaoAljQIDAQABo4GyMIGvMA8GA1Ud -EwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMG0GCCsGAQUFBwEMBGEwX6FdoFsw -WTBXMFUWCWltYWdlL2dpZjAhMB8wBwYFKw4DAhoEFI/l0xqGrI2Oa8PPgGrUSBgs -exkuMCUWI2h0dHA6Ly9sb2dvLnZlcmlzaWduLmNvbS92c2xvZ28uZ2lmMB0GA1Ud -DgQWBBS2d/ppSEefUxLVwuoHMnYH0ZcHGTANBgkqhkiG9w0BAQsFAAOCAQEASvj4 -sAPmLGd75JR3Y8xuTPl9Dg3cyLk1uXBPY/ok+myDjEedO2Pzmvl2MpWRsXe8rJq+ -seQxIcaBlVZaDrHC1LGmWazxY8u4TB1ZkErvkBYoH1quEPuBUDgMbMzxPcP1Y+Oz -4yHJJDnp/RVmRvQbEdBNc6N9Rvk97ahfYtTxP/jgdFcrGJ2BtMQo2pSXpXDrrB2+ -BxHw1dvd5Yzw1TKwg+ZX4o+/vqGqvz0dtdQ46tewXDpPaj+PwGZsY6rp2aQW9IHR -lRQOfc2VNNnSj3BzgXucfr2YYdhFh5iQxeuGMMY1v/D/w1WIg0vvBZIGcfK4mJO3 -7M2CYfE45k+XmCpajQ== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIEGjCCAwICEQCbfgZJoz5iudXukEhxKe9XMA0GCSqGSIb3DQEBBQUAMIHKMQsw -CQYDVQQGEwJVUzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZl -cmlTaWduIFRydXN0IE5ldHdvcmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWdu -LCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxRTBDBgNVBAMTPFZlcmlT -aWduIENsYXNzIDMgUHVibGljIFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3Jp -dHkgLSBHMzAeFw05OTEwMDEwMDAwMDBaFw0zNjA3MTYyMzU5NTlaMIHKMQswCQYD -VQQGEwJVUzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlT -aWduIFRydXN0IE5ldHdvcmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWduLCBJ -bmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxRTBDBgNVBAMTPFZlcmlTaWdu -IENsYXNzIDMgUHVibGljIFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkg -LSBHMzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMu6nFL8eB8aHm8b -N3O9+MlrlBIwT/A2R/XQkQr1F8ilYcEWQE37imGQ5XYgwREGfassbqb1EUGO+i2t -KmFZpGcmTNDovFJbcCAEWNF6yaRpvIMXZK0Fi7zQWM6NjPXr8EJJC52XJ2cybuGu -kxUccLwgTS8Y3pKI6GyFVxEa6X7jJhFUokWWVYPKMIno3Nij7SqAP395ZVc+FSBm -CC+Vk7+qRy+oRpfwEuL+wgorUeZ25rdGt+INpsyow0xZVYnm6FNcHOqd8GIWC6fJ -Xwzw3sJ2zq/3avL6QaaiMxTJ5Xpj055iN9WFZZ4O5lMkdBteHRJTW8cs54NJOxWu -imi5V5cCAwEAATANBgkqhkiG9w0BAQUFAAOCAQEAERSWwauSCPc/L8my/uRan2Te -2yFPhpk0djZX3dAVL8WtfxUfN2JzPtTnX84XA9s1+ivbrmAJXx5fj267Cz3qWhMe -DGBvtcC1IyIuBwvLqXTLR7sdwdela8wv0kL9Sd2nic9TutoAWii/gt/4uhMdUIaC -/Y4wjylGsB49Ndo4YhYYSq3mtlFs3q9i6wHQHiT+eo8SGhJouPtmmRQURVyu565p -F4ErWjfJXir0xuKhXFSbplQAz/DxwceYMBo7Nhbbo27q/a2ywtrvAkcTisDxszGt -TxzhT5yvDwyd93gN2PQ1VoDat20Xj50egWTh/sVFuq1ruQp6Tk9LhO5L8X3dEQ== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIEGjCCAwICEQDsoKeLbnVqAc/EfMwvlF7XMA0GCSqGSIb3DQEBBQUAMIHKMQsw -CQYDVQQGEwJVUzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZl -cmlTaWduIFRydXN0IE5ldHdvcmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWdu -LCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxRTBDBgNVBAMTPFZlcmlT -aWduIENsYXNzIDQgUHVibGljIFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3Jp -dHkgLSBHMzAeFw05OTEwMDEwMDAwMDBaFw0zNjA3MTYyMzU5NTlaMIHKMQswCQYD -VQQGEwJVUzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlT -aWduIFRydXN0IE5ldHdvcmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWduLCBJ -bmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxRTBDBgNVBAMTPFZlcmlTaWdu -IENsYXNzIDQgUHVibGljIFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkg -LSBHMzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAK3LpRFpxlmr8Y+1 -GQ9Wzsy1HyDkniYlS+BzZYlZ3tCD5PUPtbut8XzoIfzk6AzufEUiGXaStBO3IFsJ -+mGuqPKljYXCKtbeZjbSmwL0qJJgfJxptI8kHtCGUvYynEFYHiK9zUVilQhu0Gbd -U6LM8BDcVHOLBKFGMzNcF0C5nk3T875Vg+ixiY5afJqWIpA7iCXy0lOIAgwLePLm -NxdLMEYH5IBtptiWLugs+BGzOA1mppvqySNb247i8xOOGlktqgLw7KSHZtzBP/XY -ufTsgsbSPZUd5cBPhMnZo0QoBmrXRazwa2rvTl/4EYIeOGM0ZlDUPpNz+jDDZq3/ -ky2X7wMCAwEAATANBgkqhkiG9w0BAQUFAAOCAQEAj/ola09b5KROJ1WrIhVZPMq1 -CtRK26vdoV9TxaBXOcLORyu+OshWv8LZJxA6sQU8wHcxuzrTBXttmhwwjIDLk5Mq -g6sFUYICABFna/OIYUdfA5PVWw3g8dShMjWFsjrbsIKr0csKvE+MW8VLADsfKoKm -fjaF3H48ZwC15DtS4KjrXRX5xm3wrR0OhbepmnMUWluPQSjA1egtTaRezarZ7c7c -2NU8Qh0XwRJdRTjDOPP8hS6DRkiy1yBfkjaP53kPmF6Z6PDQpLv1U70qzlmwr25/ -bLvSHgCwIe34QWKCudiyxLtGUPMxxY8BqHTr9Xgn2uf3ZkPznoM+IKrDNWCRzg== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDojCCAoqgAwIBAgIQE4Y1TR0/BvLB+WUF1ZAcYjANBgkqhkiG9w0BAQUFADBr -MQswCQYDVQQGEwJVUzENMAsGA1UEChMEVklTQTEvMC0GA1UECxMmVmlzYSBJbnRl -cm5hdGlvbmFsIFNlcnZpY2UgQXNzb2NpYXRpb24xHDAaBgNVBAMTE1Zpc2EgZUNv -bW1lcmNlIFJvb3QwHhcNMDIwNjI2MDIxODM2WhcNMjIwNjI0MDAxNjEyWjBrMQsw -CQYDVQQGEwJVUzENMAsGA1UEChMEVklTQTEvMC0GA1UECxMmVmlzYSBJbnRlcm5h -dGlvbmFsIFNlcnZpY2UgQXNzb2NpYXRpb24xHDAaBgNVBAMTE1Zpc2EgZUNvbW1l -cmNlIFJvb3QwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCvV95WHm6h -2mCxlCfLF9sHP4CFT8icttD0b0/Pmdjh28JIXDqsOTPHH2qLJj0rNfVIsZHBAk4E -lpF7sDPwsRROEW+1QK8bRaVK7362rPKgH1g/EkZgPI2h4H3PVz4zHvtH8aoVlwdV -ZqW1LS7YgFmypw23RuwhY/81q6UCzyr0TP579ZRdhE2o8mCP2w4lPJ9zcc+U30rq -299yOIzzlr3xF7zSujtFWsan9sYXiwGd/BmoKoMWuDpI/k4+oKsGGelT84ATB+0t -vz8KPFUgOSwsAGl0lUq8ILKpeeUYiZGo3BxN77t+Nwtd/jmliFKMAGzsGHxBvfaL -dXe6YJ2E5/4tAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQD -AgEGMB0GA1UdDgQWBBQVOIMPPyw/cDMezUb+B4wg4NfDtzANBgkqhkiG9w0BAQUF -AAOCAQEAX/FBfXxcCLkr4NWSR/pnXKUTwwMhmytMiUbPWU3J/qVAtmPN3XEolWcR -zCSs00Rsca4BIGsDoo8Ytyk6feUWYFN4PMCvFYP3j1IzJL1kk5fui/fbGKhtcbP3 -LBfQdCVp9/5rPJS+TUtBjE7ic9DjkCJzQ83z7+pzzkWKsKZJ/0x9nXGIxHYdkFsd -7v3M9+79YKWxehZx0RbQfBI8bGmX265fOZpwLwU8GUYEmSA20GBuYQa7FkKMcPcw -++DbZqMAAb3mLNqRX6BGi01qnD093QVG/na/oAo85ADmJ7f/hC3euiInlhBx6yLt -398znM/jra6O1I7mT1GvFpLgXPYHDw== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIEvTCCA6WgAwIBAgIBATANBgkqhkiG9w0BAQUFADCBhTELMAkGA1UEBhMCVVMx -IDAeBgNVBAoMF1dlbGxzIEZhcmdvIFdlbGxzU2VjdXJlMRwwGgYDVQQLDBNXZWxs -cyBGYXJnbyBCYW5rIE5BMTYwNAYDVQQDDC1XZWxsc1NlY3VyZSBQdWJsaWMgUm9v -dCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcNMDcxMjEzMTcwNzU0WhcNMjIxMjE0 -MDAwNzU0WjCBhTELMAkGA1UEBhMCVVMxIDAeBgNVBAoMF1dlbGxzIEZhcmdvIFdl -bGxzU2VjdXJlMRwwGgYDVQQLDBNXZWxscyBGYXJnbyBCYW5rIE5BMTYwNAYDVQQD -DC1XZWxsc1NlY3VyZSBQdWJsaWMgUm9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkw -ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDub7S9eeKPCCGeOARBJe+r -WxxTkqxtnt3CxC5FlAM1iGd0V+PfjLindo8796jE2yljDpFoNoqXjopxaAkH5OjU -Dk/41itMpBb570OYj7OeUt9tkTmPOL13i0Nj67eT/DBMHAGTthP796EfvyXhdDcs -HqRePGj4S78NuR4uNuip5Kf4D8uCdXw1LSLWwr8L87T8bJVhHlfXBIEyg1J55oNj -z7fLY4sR4r1e6/aN7ZVyKLSsEmLpSjPmgzKuBXWVvYSV2ypcm44uDLiBK0HmOFaf -SZtsdvqKXfcBeYF8wYNABf5x/Qw/zE5gCQ5lRxAvAcAFP4/4s0HvWkJ+We/Slwxl -AgMBAAGjggE0MIIBMDAPBgNVHRMBAf8EBTADAQH/MDkGA1UdHwQyMDAwLqAsoCqG -KGh0dHA6Ly9jcmwucGtpLndlbGxzZmFyZ28uY29tL3dzcHJjYS5jcmwwDgYDVR0P -AQH/BAQDAgHGMB0GA1UdDgQWBBQmlRkQ2eihl5H/3BnZtQQ+0nMKajCBsgYDVR0j -BIGqMIGngBQmlRkQ2eihl5H/3BnZtQQ+0nMKaqGBi6SBiDCBhTELMAkGA1UEBhMC -VVMxIDAeBgNVBAoMF1dlbGxzIEZhcmdvIFdlbGxzU2VjdXJlMRwwGgYDVQQLDBNX -ZWxscyBGYXJnbyBCYW5rIE5BMTYwNAYDVQQDDC1XZWxsc1NlY3VyZSBQdWJsaWMg -Um9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHmCAQEwDQYJKoZIhvcNAQEFBQADggEB -ALkVsUSRzCPIK0134/iaeycNzXK7mQDKfGYZUMbVmO2rvwNa5U3lHshPcZeG1eMd -/ZDJPHV3V3p9+N701NX3leZ0bh08rnyd2wIDBSxxSyU+B+NemvVmFymIGjifz6pB -A4SXa5M4esowRBskRDPQ5NHcKDj0E0M1NSljqHyita04pO2t/caaH/+Xc/77szWn -k4bGdpEA5qxRFsQnMlzbc9qlk1eOPm01JghZ1edE13YgY+esE2fDbbFwRnzVlhE9 -iW9dqKHrjQrawx0zbKPqZxmamX9LPYNRKh3KL4YMon4QLSvUFpULB6ouFJJJtylv -2G0xffX8oRAHh84vWdw+WNs= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIFdjCCA16gAwIBAgIQXmjWEXGUY1BWAGjzPsnFkTANBgkqhkiG9w0BAQUFADBV -MQswCQYDVQQGEwJDTjEaMBgGA1UEChMRV29TaWduIENBIExpbWl0ZWQxKjAoBgNV -BAMTIUNlcnRpZmljYXRpb24gQXV0aG9yaXR5IG9mIFdvU2lnbjAeFw0wOTA4MDgw -MTAwMDFaFw0zOTA4MDgwMTAwMDFaMFUxCzAJBgNVBAYTAkNOMRowGAYDVQQKExFX -b1NpZ24gQ0EgTGltaXRlZDEqMCgGA1UEAxMhQ2VydGlmaWNhdGlvbiBBdXRob3Jp -dHkgb2YgV29TaWduMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAvcqN -rLiRFVaXe2tcesLea9mhsMMQI/qnobLMMfo+2aYpbxY94Gv4uEBf2zmoAHqLoE1U -fcIiePyOCbiohdfMlZdLdNiefvAA5A6JrkkoRBoQmTIPJYhTpA2zDxIIFgsDcScc -f+Hb0v1naMQFXQoOXXDX2JegvFNBmpGN9J42Znp+VsGQX+axaCA2pIwkLCxHC1l2 -ZjC1vt7tj/id07sBMOby8w7gLJKA84X5KIq0VC6a7fd2/BVoFutKbOsuEo/Uz/4M -x1wdC34FMr5esAkqQtXJTpCzWQ27en7N1QhatH/YHGkR+ScPewavVIMYe+HdVHpR -aG53/Ma/UkpmRqGyZxq7o093oL5d//xWC0Nyd5DKnvnyOfUNqfTq1+ezEC8wQjch -zDBwyYaYD8xYTYO7feUapTeNtqwylwA6Y3EkHp43xP901DfA4v6IRmAR3Qg/UDar -uHqklWJqbrDKaiFaafPz+x1wOZXzp26mgYmhiMU7ccqjUu6Du/2gd/Tkb+dC221K -mYo0SLwX3OSACCK28jHAPwQ+658geda4BmRkAjHXqc1S+4RFaQkAKtxVi8QGRkvA -Sh0JWzko/amrzgD5LkhLJuYwTKVYyrREgk/nkR4zw7CT/xH8gdLKH3Ep3XZPkiWv -HYG3Dy+MwwbMLyejSuQOmbp8HkUff6oZRZb9/D0CAwEAAaNCMEAwDgYDVR0PAQH/ -BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFOFmzw7R8bNLtwYgFP6H -EtX2/vs+MA0GCSqGSIb3DQEBBQUAA4ICAQCoy3JAsnbBfnv8rWTjMnvMPLZdRtP1 -LOJwXcgu2AZ9mNELIaCJWSQBnfmvCX0KI4I01fx8cpm5o9dU9OpScA7F9dY74ToJ -MuYhOZO9sxXqT2r09Ys/L3yNWC7F4TmgPsc9SnOeQHrAK2GpZ8nzJLmzbVUsWh2e -JXLOC62qx1ViC777Y7NhRCOjy+EaDveaBk3e1CNOIZZbOVtXHS9dCF4Jef98l7VN -g64N1uajeeAz0JmWAjCnPv/So0M/BVoG6kQC2nz4SNAzqfkHx5Xh9T71XXG68pWp -dIhhWeO/yloTunK0jF02h+mmxTwTv97QRCbut+wucPrXnbes5cVAWubXbHssw1ab -R80LzvobtCHXt2a49CUwi1wNuepnsvRtrtWhnk/Yn+knArAdBtaP4/tIEp9/EaEQ -PkxROpaw0RPxx9gmrjrKkcRpnd8BKWRRb2jaFOwIQZeQjdCygPLPwj2/kWjFgGce -xGATVdVhmVd8upUPYUk6ynW8yQqTP2cOEvIo4jEbwFcW3wh8GcF+Dx+FHgo2fFt+ -J7x6v+Db9NpSvd4MVHAxkUOVyLzwPt0JfjBkUO1/AaQzZ01oT74V77D2AhGiGxMl -OtzCWfHjXEa7ZywCRuoeSKbmW9m1vFGikpbbqsY3Iqb+zCB0oy2pLmvLwIIRIbWT -ee5Ehr7XHuQe+w== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIFWDCCA0CgAwIBAgIQUHBrzdgT/BtOOzNy0hFIjTANBgkqhkiG9w0BAQsFADBG -MQswCQYDVQQGEwJDTjEaMBgGA1UEChMRV29TaWduIENBIExpbWl0ZWQxGzAZBgNV -BAMMEkNBIOayg+mAmuagueivgeS5pjAeFw0wOTA4MDgwMTAwMDFaFw0zOTA4MDgw -MTAwMDFaMEYxCzAJBgNVBAYTAkNOMRowGAYDVQQKExFXb1NpZ24gQ0EgTGltaXRl -ZDEbMBkGA1UEAwwSQ0Eg5rKD6YCa5qC56K+B5LmmMIICIjANBgkqhkiG9w0BAQEF -AAOCAg8AMIICCgKCAgEA0EkhHiX8h8EqwqzbdoYGTufQdDTc7WU1/FDWiD+k8H/r -D195L4mx/bxjWDeTmzj4t1up+thxx7S8gJeNbEvxUNUqKaqoGXqW5pWOdO2XCld1 -9AXbbQs5uQF/qvbW2mzmBeCkTVL829B0txGMe41P/4eDrv8FAxNXUDf+jJZSEExf -v5RxadmWPgxDT74wwJ85dE8GRV2j1lY5aAfMh09Qd5Nx2UQIsYo06Yms25tO4dnk -UkWMLhQfkWsZHWgpLFbE4h4TV2TwYeO5Ed+w4VegG63XX9Gv2ystP9Bojg/qnw+L -NVgbExz03jWhCl3W6t8Sb8D7aQdGctyB9gQjF+BNdeFyb7Ao65vh4YOhn0pdr8yb -+gIgthhid5E7o9Vlrdx8kHccREGkSovrlXLp9glk3Kgtn3R46MGiCWOc76DbT52V -qyBPt7D3h1ymoOQ3OMdc4zUPLK2jgKLsLl3Az+2LBcLmc272idX10kaO6m1jGx6K -yX2m+Jzr5dVjhU1zZmkR/sgO9MHHZklTfuQZa/HpelmjbX7FF+Ynxu8b22/8DU0G -AbQOXDBGVWCvOGU6yke6rCzMRh+yRpY/8+0mBe53oWprfi1tWFxK1I5nuPHa1UaK -J/kR8slC/k7e3x9cxKSGhxYzoacXGKUN5AXlK8IrC6KVkLn9YDxOiT7nnO4fuwEC -AwEAAaNCMEAwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0O -BBYEFOBNv9ybQV0T6GTwp+kVpOGBwboxMA0GCSqGSIb3DQEBCwUAA4ICAQBqinA4 -WbbaixjIvirTthnVZil6Xc1bL3McJk6jfW+rtylNpumlEYOnOXOvEESS5iVdT2H6 -yAa+Tkvv/vMx/sZ8cApBWNromUuWyXi8mHwCKe0JgOYKOoICKuLJL8hWGSbueBwj -/feTZU7n85iYr83d2Z5AiDEoOqsuC7CsDCT6eiaY8xJhEPRdF/d+4niXVOKM6Cm6 -jBAyvd0zaziGfjk9DgNyp115j0WKWa5bIW4xRtVZjc8VX90xJc/bYNaBRHIpAlf2 -ltTW/+op2znFuCyKGo3Oy+dCMYYFaA6eFN0AkLppRQjbbpCBhqcqBT/mhDn4t/lX -X0ykeVoQDF7Va/81XwVRHmyjdanPUIPTfPRm94KNPQx96N97qA4bLJyuQHCH2u2n -FoJavjVsIE4iYdm8UXrNemHcSxH5/mc0zy4EZmFcV5cjjPOGG0jfKq+nwf/Yjj4D -u9gqsPoUJbJRa4ZDhS4HIxaAjUz7tGM7zMN07RujHv41D198HRaG9Q7DlfEvr10l -O1Hm13ZBONFLAzkopR6RctR9q5czxNM+4Gm2KHmgCY0c0f9BckgG/Jou5yD5m6Le -ie2uPAmvylezkolwQOQvT8Jwg0DXJCxr5wkf09XHwQj02w47HAcLQxGEIYbpgNR1 -2KvxAmLBsX5VYc8T1yaw15zLKYs4SgsOkI26oQ== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIEMDCCAxigAwIBAgIQUJRs7Bjq1ZxN1ZfvdY+grTANBgkqhkiG9w0BAQUFADCB -gjELMAkGA1UEBhMCVVMxHjAcBgNVBAsTFXd3dy54cmFtcHNlY3VyaXR5LmNvbTEk -MCIGA1UEChMbWFJhbXAgU2VjdXJpdHkgU2VydmljZXMgSW5jMS0wKwYDVQQDEyRY -UmFtcCBHbG9iYWwgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMDQxMTAxMTcx -NDA0WhcNMzUwMTAxMDUzNzE5WjCBgjELMAkGA1UEBhMCVVMxHjAcBgNVBAsTFXd3 -dy54cmFtcHNlY3VyaXR5LmNvbTEkMCIGA1UEChMbWFJhbXAgU2VjdXJpdHkgU2Vy -dmljZXMgSW5jMS0wKwYDVQQDEyRYUmFtcCBHbG9iYWwgQ2VydGlmaWNhdGlvbiBB -dXRob3JpdHkwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCYJB69FbS6 -38eMpSe2OAtp87ZOqCwuIR1cRN8hXX4jdP5efrRKt6atH67gBhbim1vZZ3RrXYCP -KZ2GG9mcDZhtdhAoWORlsH9KmHmf4MMxfoArtYzAQDsRhtDLooY2YKTVMIJt2W7Q -DxIEM5dfT2Fa8OT5kavnHTu86M/0ay00fOJIYRyO82FEzG+gSqmUsE3a56k0enI4 -qEHMPJQRfevIpoy3hsvKMzvZPTeL+3o+hiznc9cKV6xkmxnr9A8ECIqsAxcZZPRa -JSKNNCyy9mgdEm3Tih4U2sSPpuIjhdV6Db1q4Ons7Be7QhtnqiXtRYMh/MHJfNVi -PvryxS3T/dRlAgMBAAGjgZ8wgZwwEwYJKwYBBAGCNxQCBAYeBABDAEEwCwYDVR0P -BAQDAgGGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFMZPoj0GY4QJnM5i5ASs -jVy16bYbMDYGA1UdHwQvMC0wK6ApoCeGJWh0dHA6Ly9jcmwueHJhbXBzZWN1cml0 -eS5jb20vWEdDQS5jcmwwEAYJKwYBBAGCNxUBBAMCAQEwDQYJKoZIhvcNAQEFBQAD -ggEBAJEVOQMBG2f7Shz5CmBbodpNl2L5JFMn14JkTpAuw0kbK5rc/Kh4ZzXxHfAR -vbdI4xD2Dd8/0sm2qlWkSLoC295ZLhVbO50WfUfXN+pfTXYSNrsf16GBBEYgoyxt -qZ4Bfj8pzgCT3/3JknOJiWSe5yvkHJEs0rnOfc5vMZnT5r7SHpDwCRR5XCOrTdLa -IR9NmXmd4c8nnxCbHIgNsIpkQTG4DmyQJKSbXHGPurt+HBvbaoAPIbzp26a3QPSy -i6mx5O+aGtA9aZnuqCij4Tyz8LIRnM98QObd50N9otg6tamN8jSZxNQQ4Qb9CYQQ -O+7ETPTsJ3xCwnR8gooJybQDJbw= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDODCCAiCgAwIBAgIGIAYFFnACMA0GCSqGSIb3DQEBBQUAMDsxCzAJBgNVBAYT -AlJPMREwDwYDVQQKEwhjZXJ0U0lHTjEZMBcGA1UECxMQY2VydFNJR04gUk9PVCBD -QTAeFw0wNjA3MDQxNzIwMDRaFw0zMTA3MDQxNzIwMDRaMDsxCzAJBgNVBAYTAlJP -MREwDwYDVQQKEwhjZXJ0U0lHTjEZMBcGA1UECxMQY2VydFNJR04gUk9PVCBDQTCC -ASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALczuX7IJUqOtdu0KBuqV5Do -0SLTZLrTk+jUrIZhQGpgV2hUhE28alQCBf/fm5oqrl0Hj0rDKH/v+yv6efHHrfAQ -UySQi2bJqIirr1qjAOm+ukbuW3N7LBeCgV5iLKECZbO9xSsAfsT8AzNXDe3i+s5d -RdY4zTW2ssHQnIFKquSyAVwdj1+ZxLGt24gh65AIgoDzMKND5pCCrlUoSe1b16kQ -OA7+j0xbm0bqQfWwCHTD0IgztnzXdN/chNFDDnU5oSVAKOp4yw4sLjmdjItuFhwv -JoIQ4uNllAoEwF73XVv4EOLQunpL+943AAAaWyjj0pxzPjKHmKHJUS/X3qwzs08C -AwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAcYwHQYDVR0O -BBYEFOCMm9slSbPxfIbWskKHC9BroNnkMA0GCSqGSIb3DQEBBQUAA4IBAQA+0hyJ -LjX8+HXd5n9liPRyTMks1zJO890ZeUe9jjtbkw9QSSQTaxQGcu8J06Gh40CEyecY -MnQ8SG4Pn0vU9x7Tk4ZkVJdjclDVVc/6IJMCopvDI5NOFlV2oHB5bc0hH88vLbwZ -44gx+FkagQnIl6Z0x2DEW8xXjrJ1/RsCCdtZb3KTafcxQdaIOL+Hsr0Wefmq5L6I -Jd1hJyMctTEHBDa0GpC9oHRxUIltvBTjD4au8as+x6AJzKNI0eDbZOeStc+vckNw -i/nDhDwTqn6Sm1dTk/pwwpEOMfmbZ13pljheX7NzTogVZ96edhBiIL5VaZVDADlN -9u6wWk5JRFRYX0KD ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIFsDCCA5igAwIBAgIQFci9ZUdcr7iXAF7kBtK8nTANBgkqhkiG9w0BAQUFADBe -MQswCQYDVQQGEwJUVzEjMCEGA1UECgwaQ2h1bmdod2EgVGVsZWNvbSBDby4sIEx0 -ZC4xKjAoBgNVBAsMIWVQS0kgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAe -Fw0wNDEyMjAwMjMxMjdaFw0zNDEyMjAwMjMxMjdaMF4xCzAJBgNVBAYTAlRXMSMw -IQYDVQQKDBpDaHVuZ2h3YSBUZWxlY29tIENvLiwgTHRkLjEqMCgGA1UECwwhZVBL -SSBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIICIjANBgkqhkiG9w0BAQEF -AAOCAg8AMIICCgKCAgEA4SUP7o3biDN1Z82tH306Tm2d0y8U82N0ywEhajfqhFAH -SyZbCUNsIZ5qyNUD9WBpj8zwIuQf5/dqIjG3LBXy4P4AakP/h2XGtRrBp0xtInAh -ijHyl3SJCRImHJ7K2RKilTza6We/CKBk49ZCt0Xvl/T29de1ShUCWH2YWEtgvM3X -DZoTM1PRYfl61dd4s5oz9wCGzh1NlDivqOx4UXCKXBCDUSH3ET00hl7lSM2XgYI1 -TBnsZfZrxQWh7kcT1rMhJ5QQCtkkO7q+RBNGMD+XPNjX12ruOzjjK9SXDrkb5wdJ -fzcq+Xd4z1TtW0ado4AOkUPB1ltfFLqfpo0kR0BZv3I4sjZsN/+Z0V0OWQqraffA -sgRFelQArr5T9rXn4fg8ozHSqf4hUmTFpmfwdQcGlBSBVcYn5AGPF8Fqcde+S/uU -WH1+ETOxQvdibBjWzwloPn9s9h6PYq2lY9sJpx8iQkEeb5mKPtf5P0B6ebClAZLS -nT0IFaUQAS2zMnaolQ2zepr7BxB4EW/hj8e6DyUadCrlHJhBmd8hh+iVBmoKs2pH -dmX2Os+PYhcZewoozRrSgx4hxyy/vv9haLdnG7t4TY3OZ+XkwY63I2binZB1NJip -NiuKmpS5nezMirH4JYlcWrYvjB9teSSnUmjDhDXiZo1jDiVN1Rmy5nk3pyKdVDEC -AwEAAaNqMGgwHQYDVR0OBBYEFB4M97Zn8uGSJglFwFU5Lnc/QkqiMAwGA1UdEwQF -MAMBAf8wOQYEZyoHAAQxMC8wLQIBADAJBgUrDgMCGgUAMAcGBWcqAwAABBRFsMLH -ClZ87lt4DJX5GFPBphzYEDANBgkqhkiG9w0BAQUFAAOCAgEACbODU1kBPpVJufGB -uvl2ICO1J2B01GqZNF5sAFPZn/KmsSQHRGoqxqWOeBLoR9lYGxMqXnmbnwoqZ6Yl -PwZpVnPDimZI+ymBV3QGypzqKOg4ZyYr8dW1P2WT+DZdjo2NQCCHGervJ8A9tDkP -JXtoUHRVnAxZfVo9QZQlUgjgRywVMRnVvwdVxrsStZf0X4OFunHB2WyBEXYKCrC/ -gpf36j36+uwtqSiUO1bd0lEursC9CBWMd1I0ltabrNMdjmEPNXubrjlpC2JgQCA2 -j6/7Nu4tCEoduL+bXPjqpRugc6bY+G7gMwRfaKonh+3ZwZCc7b3jajWvY9+rGNm6 -5ulK6lCKD2GTHuItGeIwlDWSXQ62B68ZgI9HkFFLLk3dheLSClIKF5r8GrBQAuUB -o2M3IUxExJtRmREOc5wGj1QupyheRDmHVi03vYVElOEMSyycw5KFNGHLD7ibSkNS -/jQ6fbjpKdx2qcgw+BRxgMYeNkh0IkFch4LoGHGLQYlE535YW6i4jRPpp2zDR+2z -Gp1iro2C6pSe3VkQw63d4k3jMdXH7OjysP6SHhYKGvzZ8/gntsm+HbRsZJB/9OTE -W9c3rkIO3aQab3yIVMUWbuF6aC74Or8NpDyJO3inTmODBCEIZ43ygknQW/2xzQ+D -hNQ+IIX3Sj0rnP0qCglN6oH4EZw= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIEIDCCAwigAwIBAgIQNE7VVyDV7exJ9C/ON9srbTANBgkqhkiG9w0BAQUFADCB -qTELMAkGA1UEBhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjEoMCYGA1UECxMf -Q2VydGlmaWNhdGlvbiBTZXJ2aWNlcyBEaXZpc2lvbjE4MDYGA1UECxMvKGMpIDIw -MDYgdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxHzAdBgNV -BAMTFnRoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EwHhcNMDYxMTE3MDAwMDAwWhcNMzYw -NzE2MjM1OTU5WjCBqTELMAkGA1UEBhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5j -LjEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcyBEaXZpc2lvbjE4MDYG -A1UECxMvKGMpIDIwMDYgdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNl -IG9ubHkxHzAdBgNVBAMTFnRoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EwggEiMA0GCSqG -SIb3DQEBAQUAA4IBDwAwggEKAoIBAQCsoPD7gFnUnMekz52hWXMJEEUMDSxuaPFs -W0hoSVk3/AszGcJ3f8wQLZU0HObrTQmnHNK4yZc2AreJ1CRfBsDMRJSUjQJib+ta -3RGNKJpchJAQeg29dGYvajig4tVUROsdB58Hum/u6f1OCyn1PoSgAfGcq/gcfomk -6KHYcWUNo1F77rzSImANuVud37r8UVsLr5iy6S7pBOhih94ryNdOwUxkHt3Ph1i6 -Sk/KaAcdHJ1KxtUvkcx8cXIcxcBn6zL9yZJclNqFwJu/U30rCfSMnZEfl2pSy94J -NqR32HuHUETVPm4pafs5SSYeCaWAe0At6+gnhcn+Yf1+5nyXHdWdAgMBAAGjQjBA -MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBR7W0XP -r87Lev0xkhpqtvNG61dIUDANBgkqhkiG9w0BAQUFAAOCAQEAeRHAS7ORtvzw6WfU -DW5FvlXok9LOAz/t2iWwHVfLHjp2oEzsUHboZHIMpKnxuIvW1oeEuzLlQRHAd9mz -YJ3rG9XRbkREqaYB7FViHXe4XI5ISXycO1cRrK1zN44veFyQaEfZYGDm/Ac9IiAX -xPcW6cTYcvnIc3zfFi8VqT79aie2oetaupgf1eNNZAqdE8hhuvU5HIe6uL17In/2 -/qxAeeWsEG89jxt5dovEN7MhGITlNgDrYyCZuen+MwS7QcjBAvlEYyCegc5C09Y/ -LHbTY5xZ3Y+m4Q6gLkH3LpVHz7z9M/P2C2F+fpErgUfCJzDupxBdN49cOSvkBPB7 -jVaMaA== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIICiDCCAg2gAwIBAgIQNfwmXNmET8k9Jj1Xm67XVjAKBggqhkjOPQQDAzCBhDEL -MAkGA1UEBhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjE4MDYGA1UECxMvKGMp -IDIwMDcgdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxJDAi -BgNVBAMTG3RoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EgLSBHMjAeFw0wNzExMDUwMDAw -MDBaFw0zODAxMTgyMzU5NTlaMIGEMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMdGhh -d3RlLCBJbmMuMTgwNgYDVQQLEy8oYykgMjAwNyB0aGF3dGUsIEluYy4gLSBGb3Ig -YXV0aG9yaXplZCB1c2Ugb25seTEkMCIGA1UEAxMbdGhhd3RlIFByaW1hcnkgUm9v -dCBDQSAtIEcyMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEotWcgnuVnfFSeIf+iha/ -BebfowJPDQfGAFG6DAJSLSKkQjnE/o/qycG+1E3/n3qe4rF8mq2nhglzh9HnmuN6 -papu+7qzcMBniKI11KOasf2twu8x+qi58/sIxpHR+ymVo0IwQDAPBgNVHRMBAf8E -BTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUmtgAMADna3+FGO6Lts6K -DPgR4bswCgYIKoZIzj0EAwMDaQAwZgIxAN344FdHW6fmCsO99YCKlzUNG4k8VIZ3 -KMqh9HneteY4sPBlcIx/AlTCv//YoT7ZzwIxAMSNlPzcU9LcnXgWHxUzI1NS41ox -XZ3Krr0TKUQNJ1uo52icEvdYPy5yAlejj6EULg== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIEKjCCAxKgAwIBAgIQYAGXt0an6rS0mtZLL/eQ+zANBgkqhkiG9w0BAQsFADCB -rjELMAkGA1UEBhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjEoMCYGA1UECxMf -Q2VydGlmaWNhdGlvbiBTZXJ2aWNlcyBEaXZpc2lvbjE4MDYGA1UECxMvKGMpIDIw -MDggdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxJDAiBgNV -BAMTG3RoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EgLSBHMzAeFw0wODA0MDIwMDAwMDBa -Fw0zNzEyMDEyMzU5NTlaMIGuMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMdGhhd3Rl -LCBJbmMuMSgwJgYDVQQLEx9DZXJ0aWZpY2F0aW9uIFNlcnZpY2VzIERpdmlzaW9u -MTgwNgYDVQQLEy8oYykgMjAwOCB0aGF3dGUsIEluYy4gLSBGb3IgYXV0aG9yaXpl -ZCB1c2Ugb25seTEkMCIGA1UEAxMbdGhhd3RlIFByaW1hcnkgUm9vdCBDQSAtIEcz -MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsr8nLPvb2FvdeHsbnndm -gcs+vHyu86YnmjSjaDFxODNi5PNxZnmxqWWjpYvVj2AtP0LMqmsywCPLLEHd5N/8 -YZzic7IilRFDGF/Eth9XbAoFWCLINkw6fKXRz4aviKdEAhN0cXMKQlkC+BsUa0Lf -b1+6a4KinVvnSr0eAXLbS3ToO39/fR8EtCab4LRarEc9VbjXsCZSKAExQGbY2SS9 -9irY7CFJXJv2eul/VTV+lmuNk5Mny5K76qxAwJ/C+IDPXfRa3M50hqY+bAtTyr2S -zhkGcuYMXDhpxwTWvGzOW/b3aJzcJRVIiKHpqfiYnODz1TEoYRFsZ5aNOZnLwkUk -OQIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNV -HQ4EFgQUrWyqlGCc7eT/+j4KdCtjA/e2Wb8wDQYJKoZIhvcNAQELBQADggEBABpA -2JVlrAmSicY59BDlqQ5mU1143vokkbvnRFHfxhY0Cu9qRFHqKweKA3rD6z8KLFIW -oCtDuSWQP3CpMyVtRRooOyfPqsMpQhvfO0zAMzRbQYi/aytlryjvsvXDqmbOe1bu -t8jLZ8HJnBoYuMTDSQPxYA5QzUbF83d597YV4Djbxy8ooAw/dyZ02SUS2jHaGh7c -KUGRIjxpp7sC8rZcJwOJ9Abqm+RyguOhCcHpABnTPtRwa7pxpqpYrvS76Wy274fM -m7v/OeZWYdMKp8RcTGB7BXcmer/YB1IsYvdwY9k5vG8cwnncdimvzsUsZAReiDZu -MdRAGmI0Nj81Aa6sY6A= ------END CERTIFICATE----- diff --git a/packages/security/libressl/package.mk b/packages/security/libressl/package.mk index 28bddbd0251..05ddb3e0c71 100644 --- a/packages/security/libressl/package.mk +++ b/packages/security/libressl/package.mk @@ -17,7 +17,7 @@ ################################################################################ PKG_NAME="libressl" -PKG_VERSION="2.2.6" +PKG_VERSION="2.3.4" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="BSD" @@ -33,11 +33,7 @@ PKG_IS_ADDON="no" PKG_AUTORECONF="yes" post_makeinstall_target() { -# create new cert: ./mkcerts.sh - mkdir -p $INSTALL/$SSL_CERTIFICATES - cp $PKG_DIR/cert/ca-bundle.crt $INSTALL/$SSL_CERTIFICATES/cacert.pem # backwards comatibility mkdir -p $INSTALL/etc/pki/tls - ln -sf $SSL_CERTIFICATES/cacert.pem $INSTALL/etc/pki/tls/cacert.pem - ln -sf $SSL_CERTIFICATES/cacert.pem $INSTALL/etc/ssl/cert.pem + ln -sf /etc/ssl/cert.pem $INSTALL/etc/pki/tls/cacert.pem } diff --git a/packages/security/libressl/patches/libressl-trusted-first.patch b/packages/security/libressl/patches/libressl-trusted-first.patch new file mode 100644 index 00000000000..f02b6e101a5 --- /dev/null +++ b/packages/security/libressl/patches/libressl-trusted-first.patch @@ -0,0 +1,62 @@ +From 779c075d93f339ee4043ea026586a463376b301c Mon Sep 17 00:00:00 2001 +From: Jonas Karlman <jonas@kwiboo.se> +Date: Wed, 20 Apr 2016 22:26:49 +0200 +Subject: [PATCH] trusted first + +--- + apps/openssl/apps.c | 2 ++ + crypto/x509/x509_vfy.c | 14 ++++++++++++++ + include/openssl/x509_vfy.h | 2 ++ + 3 files changed, 18 insertions(+) + +diff --git a/apps/openssl/apps.c b/apps/openssl/apps.c +index 6e40965..cbdd080 100644 +--- a/apps/openssl/apps.c ++++ b/apps/openssl/apps.c +@@ -1943,6 +1943,8 @@ args_verify(char ***pargs, int *pargc, int *badarg, BIO *err, + flags |= X509_V_FLAG_NOTIFY_POLICY; + else if (!strcmp(arg, "-check_ss_sig")) + flags |= X509_V_FLAG_CHECK_SS_SIGNATURE; ++ else if (!strcmp(arg, "-trusted_first")) ++ flags |= X509_V_FLAG_TRUSTED_FIRST; + else + return 0; + +diff --git a/crypto/x509/x509_vfy.c b/crypto/x509/x509_vfy.c +index f9fd3a0..6e51edb 100644 +--- a/crypto/x509/x509_vfy.c ++++ b/crypto/x509/x509_vfy.c +@@ -209,6 +209,20 @@ X509_verify_cert(X509_STORE_CTX *ctx) + if (ctx->check_issued(ctx, x, x)) + break; + ++ /* If asked see if we can find issuer in trusted store first */ ++ if (ctx->param->flags & X509_V_FLAG_TRUSTED_FIRST) { ++ ok = ctx->get_issuer(&xtmp, ctx, x); ++ if (ok < 0) ++ goto end; ++ /* If successful for now free up cert so it ++ * will be picked up again later. ++ */ ++ if (ok > 0) { ++ X509_free(xtmp); ++ break; ++ } ++ } ++ + /* If we were passed a cert chain, use it first */ + if (ctx->untrusted != NULL) { + xtmp = find_issuer(ctx, sktmp, x); +diff --git a/include/openssl/x509_vfy.h b/include/openssl/x509_vfy.h +index e4050b2..ddf77e7 100644 +--- a/include/openssl/x509_vfy.h ++++ b/include/openssl/x509_vfy.h +@@ -383,6 +383,8 @@ void X509_STORE_CTX_set_depth(X509_STORE_CTX *ctx, int depth); + #define X509_V_FLAG_USE_DELTAS 0x2000 + /* Check selfsigned CA signature */ + #define X509_V_FLAG_CHECK_SS_SIGNATURE 0x4000 ++/* Use trusted store first */ ++#define X509_V_FLAG_TRUSTED_FIRST 0x8000 + /* Do not check certificate or CRL validity against current time. */ + #define X509_V_FLAG_NO_CHECK_TIME 0x200000 + diff --git a/packages/security/libressl/scripts/certdata2pem.py b/packages/security/libressl/scripts/certdata2pem.py deleted file mode 100644 index 44cc9e03b62..00000000000 --- a/packages/security/libressl/scripts/certdata2pem.py +++ /dev/null @@ -1,243 +0,0 @@ -#!/usr/bin/python -# vim:set et sw=4: -# -# certdata2pem.py - splits certdata.txt into multiple files -# -# Copyright (C) 2009 Philipp Kern <pkern@debian.org> -# Copyright (C) 2013 Kai Engert <kaie@redhat.com> -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, -# USA. - -import base64 -import os.path -import re -import sys -import textwrap -import urllib - -objects = [] - -def printable_serial(obj): - return ".".join(map(lambda x:str(ord(x)), obj['CKA_SERIAL_NUMBER'])) - -# Dirty file parser. -in_data, in_multiline, in_obj = False, False, False -field, type, value, obj = None, None, None, dict() -for line in open('certdata.txt', 'r'): - # Ignore the file header. - if not in_data: - if line.startswith('BEGINDATA'): - in_data = True - continue - # Ignore comment lines. - if line.startswith('#'): - continue - # Empty lines are significant if we are inside an object. - if in_obj and len(line.strip()) == 0: - objects.append(obj) - obj = dict() - in_obj = False - continue - if len(line.strip()) == 0: - continue - if in_multiline: - if not line.startswith('END'): - if type == 'MULTILINE_OCTAL': - line = line.strip() - for i in re.finditer(r'\\([0-3][0-7][0-7])', line): - value += chr(int(i.group(1), 8)) - else: - value += line - continue - obj[field] = value - in_multiline = False - continue - if line.startswith('CKA_CLASS'): - in_obj = True - line_parts = line.strip().split(' ', 2) - if len(line_parts) > 2: - field, type = line_parts[0:2] - value = ' '.join(line_parts[2:]) - elif len(line_parts) == 2: - field, type = line_parts - value = None - else: - raise NotImplementedError, 'line_parts < 2 not supported.\n' + line - if type == 'MULTILINE_OCTAL': - in_multiline = True - value = "" - continue - obj[field] = value -if len(obj.items()) > 0: - objects.append(obj) - -# Build up trust database. -trustmap = dict() -for obj in objects: - if obj['CKA_CLASS'] != 'CKO_NSS_TRUST': - continue - key = obj['CKA_LABEL'] + printable_serial(obj) - trustmap[key] = obj - print " added trust", key - -# Build up cert database. -certmap = dict() -for obj in objects: - if obj['CKA_CLASS'] != 'CKO_CERTIFICATE': - continue - key = obj['CKA_LABEL'] + printable_serial(obj) - certmap[key] = obj - print " added cert", key - -def obj_to_filename(obj): - label = obj['CKA_LABEL'][1:-1] - label = label.replace('/', '_')\ - .replace(' ', '_')\ - .replace('(', '=')\ - .replace(')', '=')\ - .replace(',', '_') - label = re.sub(r'\\x[0-9a-fA-F]{2}', lambda m:chr(int(m.group(0)[2:], 16)), label) - serial = printable_serial(obj) - return label + ":" + serial - -trust_types = { - "CKA_TRUST_DIGITAL_SIGNATURE": "digital-signature", - "CKA_TRUST_NON_REPUDIATION": "non-repudiation", - "CKA_TRUST_KEY_ENCIPHERMENT": "key-encipherment", - "CKA_TRUST_DATA_ENCIPHERMENT": "data-encipherment", - "CKA_TRUST_KEY_AGREEMENT": "key-agreement", - "CKA_TRUST_KEY_CERT_SIGN": "cert-sign", - "CKA_TRUST_CRL_SIGN": "crl-sign", - "CKA_TRUST_SERVER_AUTH": "server-auth", - "CKA_TRUST_CLIENT_AUTH": "client-auth", - "CKA_TRUST_CODE_SIGNING": "code-signing", - "CKA_TRUST_EMAIL_PROTECTION": "email-protection", - "CKA_TRUST_IPSEC_END_SYSTEM": "ipsec-end-system", - "CKA_TRUST_IPSEC_TUNNEL": "ipsec-tunnel", - "CKA_TRUST_IPSEC_USER": "ipsec-user", - "CKA_TRUST_TIME_STAMPING": "time-stamping", - "CKA_TRUST_STEP_UP_APPROVED": "step-up-approved", -} - -legacy_trust_types = { - "LEGACY_CKA_TRUST_SERVER_AUTH": "server-auth", - "LEGACY_CKA_TRUST_CODE_SIGNING": "code-signing", - "LEGACY_CKA_TRUST_EMAIL_PROTECTION": "email-protection", -} - -legacy_to_real_trust_types = { - "LEGACY_CKA_TRUST_SERVER_AUTH": "CKA_TRUST_SERVER_AUTH", - "LEGACY_CKA_TRUST_CODE_SIGNING": "CKA_TRUST_CODE_SIGNING", - "LEGACY_CKA_TRUST_EMAIL_PROTECTION": "CKA_TRUST_EMAIL_PROTECTION", -} - -openssl_trust = { - "CKA_TRUST_SERVER_AUTH": "serverAuth", - "CKA_TRUST_CLIENT_AUTH": "clientAuth", - "CKA_TRUST_CODE_SIGNING": "codeSigning", - "CKA_TRUST_EMAIL_PROTECTION": "emailProtection", -} - -for tobj in objects: - if tobj['CKA_CLASS'] == 'CKO_NSS_TRUST': - key = tobj['CKA_LABEL'] + printable_serial(tobj) - print "producing trust for " + key - trustbits = [] - distrustbits = [] - openssl_trustflags = [] - openssl_distrustflags = [] - legacy_trustbits = [] - legacy_openssl_trustflags = [] - for t in trust_types.keys(): - if tobj.has_key(t) and tobj[t] == 'CKT_NSS_TRUSTED_DELEGATOR': - trustbits.append(t) - if t in openssl_trust: - openssl_trustflags.append(openssl_trust[t]) - if tobj.has_key(t) and tobj[t] == 'CKT_NSS_NOT_TRUSTED': - distrustbits.append(t) - if t in openssl_trust: - openssl_distrustflags.append(openssl_trust[t]) - - for t in legacy_trust_types.keys(): - if tobj.has_key(t) and tobj[t] == 'CKT_NSS_TRUSTED_DELEGATOR': - real_t = legacy_to_real_trust_types[t] - legacy_trustbits.append(real_t) - if real_t in openssl_trust: - legacy_openssl_trustflags.append(openssl_trust[real_t]) - if tobj.has_key(t) and tobj[t] == 'CKT_NSS_NOT_TRUSTED': - raise NotImplementedError, 'legacy distrust not supported.\n' + line - - fname = obj_to_filename(tobj) - try: - obj = certmap[key] - except: - obj = None - - if obj != None: - fname += ".crt" - else: - fname += ".p11-kit" - - is_legacy = 0 - if tobj.has_key('LEGACY_CKA_TRUST_SERVER_AUTH') or tobj.has_key('LEGACY_CKA_TRUST_EMAIL_PROTECTION') or tobj.has_key('LEGACY_CKA_TRUST_CODE_SIGNING'): - is_legacy = 1 - if obj == None: - raise NotImplementedError, 'found legacy trust without certificate.\n' + line - legacy_fname = "legacy-default/" + fname - f = open(legacy_fname, 'w') - f.write("# alias=%s\n"%tobj['CKA_LABEL']) - f.write("# trust=" + " ".join(legacy_trustbits) + "\n") - if legacy_openssl_trustflags: - f.write("# openssl-trust=" + " ".join(legacy_openssl_trustflags) + "\n") - f.write("-----BEGIN CERTIFICATE-----\n") - f.write("\n".join(textwrap.wrap(base64.b64encode(obj['CKA_VALUE']), 64))) - f.write("\n-----END CERTIFICATE-----\n") - f.close() - if tobj.has_key('CKA_TRUST_SERVER_AUTH') or tobj.has_key('CKA_TRUST_EMAIL_PROTECTION') or tobj.has_key('CKA_TRUST_CODE_SIGNING'): - fname = "legacy-disable/" + fname - else: - continue - - f = open(fname, 'w') - if obj != None: - f.write("# alias=%s\n"%tobj['CKA_LABEL']) - f.write("# trust=" + " ".join(trustbits) + "\n") - f.write("# distrust=" + " ".join(distrustbits) + "\n") - if openssl_trustflags: - f.write("# openssl-trust=" + " ".join(openssl_trustflags) + "\n") - if openssl_distrustflags: - f.write("# openssl-distrust=" + " ".join(openssl_distrustflags) + "\n") - f.write("-----BEGIN CERTIFICATE-----\n") - f.write("\n".join(textwrap.wrap(base64.b64encode(obj['CKA_VALUE']), 64))) - f.write("\n-----END CERTIFICATE-----\n") - else: - f.write("[p11-kit-object-v1]\n") - f.write("label: "); - f.write(tobj['CKA_LABEL']); - f.write("\n") - f.write("class: certificate\n") - f.write("certificate-type: x-509\n") - f.write("issuer: \""); - f.write(urllib.quote(tobj['CKA_ISSUER'])); - f.write("\"\n") - f.write("serial-number: \""); - f.write(urllib.quote(tobj['CKA_SERIAL_NUMBER'])); - f.write("\"\n") - if (tobj['CKA_TRUST_SERVER_AUTH'] == 'CKT_NSS_NOT_TRUSTED') or (tobj['CKA_TRUST_EMAIL_PROTECTION'] == 'CKT_NSS_NOT_TRUSTED') or (tobj['CKA_TRUST_CODE_SIGNING'] == 'CKT_NSS_NOT_TRUSTED'): - f.write("x-distrusted: true\n") - f.write("\n\n") - f.close() - print " -> written as '%s', trust = %s, openssl-trust = %s, distrust = %s, openssl-distrust = %s" % (fname, trustbits, openssl_trustflags, distrustbits, openssl_distrustflags) diff --git a/packages/security/libressl/scripts/mkcerts.sh b/packages/security/libressl/scripts/mkcerts.sh deleted file mode 100755 index b9362ab2b9d..00000000000 --- a/packages/security/libressl/scripts/mkcerts.sh +++ /dev/null @@ -1,116 +0,0 @@ -#!/bin/bash - -# adapted from fedora http://pkgs.fedoraproject.org/cgit/ca-certificates.git/tree/ca-certificates.spec - -curl -L -O -s https://hg.mozilla.org/releases/mozilla-release/raw-file/default/security/nss/lib/ckfw/builtins/nssckbi.h > /dev/null -curl -L -O -s https://hg.mozilla.org/releases/mozilla-release/raw-file/default/security/nss/lib/ckfw/builtins/certdata.txt > /dev/null - -mkdir bundle -mkdir certs -mkdir certs/legacy-default -mkdir certs/legacy-disable -mkdir java - -cd certs - cp ../certdata.txt . - python ../certdata2pem.py >/dev/null -cd .. - - ( - cat <<EOF -# This is a bundle of X.509 certificates of public Certificate -# Authorities. It was generated from the Mozilla root CA list. -# These certificates are in the OpenSSL "TRUSTED CERTIFICATE" -# format and have trust bits set accordingly. -# An exception are auxiliary certificates, without positive or negative -# trust, but are used to assist in finding a preferred trust path. -# Those neutral certificates use the plain BEGIN CERTIFICATE format. -# -# Source: nss/lib/ckfw/builtins/certdata.txt -# Source: nss/lib/ckfw/builtins/nssckbi.h -# -# Generated from: -EOF - cat nssckbi.h | grep -w NSS_BUILTINS_LIBRARY_VERSION | awk '{print "# " $2 " " $3}'; - echo '#'; - ) > bundle/ca-bundle.trust.crt - touch bundle/ca-bundle.neutral-trust.crt - for f in certs/*.crt; do - echo "processing $f" - tbits=`sed -n '/^# openssl-trust/{s/^.*=//;p;}' $f` - distbits=`sed -n '/^# openssl-distrust/{s/^.*=//;p;}' $f` - alias=`sed -n '/^# alias=/{s/^.*=//;p;q;}' $f | sed "s/'//g" | sed 's/"//g'` - targs="" - if [ -n "$tbits" ]; then - for t in $tbits; do - targs="${targs} -addtrust $t" - done - fi - if [ -n "$distbits" ]; then - for t in $distbits; do - targs="${targs} -addreject $t" - done - fi - if [ -n "$targs" ]; then - echo "trust flags $targs for $f" >> bundle/info.trust - openssl x509 -text -in "$f" -trustout $targs -setalias "$alias" >> bundle/ca-bundle.trust.crt - else - echo "no trust flags for $f" >> bundle/info.notrust - # p11-kit-trust defines empty trust lists as "rejected for all purposes". - # That's why we use the simple file format - # (BEGIN CERTIFICATE, no trust information) - # because p11-kit-trust will treat it as a certificate with neutral trust. - # This means we cannot use the -setalias feature for neutral trust certs. - openssl x509 -text -in "$f" >> bundle/ca-bundle.neutral-trust.crt - fi - done - - for f in certs/legacy-default/*.crt; do - echo "processing $f" - tbits=`sed -n '/^# openssl-trust/{s/^.*=//;p;}' $f` - alias=`sed -n '/^# alias=/{s/^.*=//;p;q;}' $f | sed "s/'//g" | sed 's/"//g'` - targs="" - if [ -n "$tbits" ]; then - for t in $tbits; do - targs="${targs} -addtrust $t" - done - fi - if [ -n "$targs" ]; then - echo "legacy default flags $targs for $f" >> bundle/info.trust - openssl x509 -text -in "$f" -trustout $targs -setalias "$alias" >> bundle/ca-bundle.legacy.default.crt - fi - done - - for f in certs/legacy-disable/*.crt; do - echo "processing $f" - tbits=`sed -n '/^# openssl-trust/{s/^.*=//;p;}' $f` - alias=`sed -n '/^# alias=/{s/^.*=//;p;q;}' $f | sed "s/'//g" | sed 's/"//g'` - targs="" - if [ -n "$tbits" ]; then - for t in $tbits; do - targs="${targs} -addtrust $t" - done - fi - if [ -n "$targs" ]; then - echo "legacy disable flags $targs for $f" >> bundle/info.trust - openssl x509 -text -in "$f" -trustout $targs -setalias "$alias" >> bundle/ca-bundle.legacy.disable.crt - fi - done - - P11FILES=`find certs -name *.p11-kit | wc -l` - if [ $P11FILES -ne 0 ]; then - for p in certs/*.p11-kit; do - cat "$p" >> bundle/ca-bundle.supplement.p11-kit - done - fi - -./update-ca-trust etc/ssl - -cp -f etc/ssl/pem/tls-ca-bundle.pem ../cert/ca-bundle.crt - -rm -rf nssckbi.h -rm -rf certdata.txt -rm -rf bundle -rm -rf certs -rm -rf java -rm -rf etc diff --git a/packages/security/libressl/scripts/update-ca-trust b/packages/security/libressl/scripts/update-ca-trust deleted file mode 100755 index 523211349d2..00000000000 --- a/packages/security/libressl/scripts/update-ca-trust +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/sh - -#set -vx - -# At this time, while this script is trivial, we ignore any parameters given. -# However, for backwards compatibility reasons, future versions of this script must -# support the syntax "update-ca-trust extract" trigger the generation of output -# files in $DEST. - -DEST=$1 - -mkdir -p $DEST/openssl -mkdir -p $DEST/pem -mkdir -p $DEST/java - -# OpenSSL PEM bundle that includes trust flags -# (BEGIN TRUSTED CERTIFICATE) -/usr/bin/p11-kit extract --format=openssl-bundle --filter=certificates --overwrite $DEST/openssl/ca-bundle.trust.crt -/usr/bin/p11-kit extract --format=pem-bundle --filter=ca-anchors --overwrite --purpose server-auth $DEST/pem/tls-ca-bundle.pem -/usr/bin/p11-kit extract --format=pem-bundle --filter=ca-anchors --overwrite --purpose email $DEST/pem/email-ca-bundle.pem -/usr/bin/p11-kit extract --format=pem-bundle --filter=ca-anchors --overwrite --purpose code-signing $DEST/pem/objsign-ca-bundle.pem -/usr/bin/p11-kit extract --format=java-cacerts --filter=ca-anchors --overwrite --purpose server-auth $DEST/java/cacerts diff --git a/packages/sysutils/amremote/config/openelec.conf b/packages/sysutils/amremote/config/libreelec.conf similarity index 100% rename from packages/sysutils/amremote/config/openelec.conf rename to packages/sysutils/amremote/config/libreelec.conf diff --git a/packages/sysutils/amremote/package.mk b/packages/sysutils/amremote/package.mk index 7b43b3b7336..aec7ad48ad2 100644 --- a/packages/sysutils/amremote/package.mk +++ b/packages/sysutils/amremote/package.mk @@ -22,7 +22,7 @@ PKG_REV="1" PKG_ARCH="arm" PKG_LICENSE="other" PKG_SITE="http://www.amlogic.com" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_URL="https://github.com/codesnake/amremote/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain usbutils" PKG_PRIORITY="optional" PKG_SECTION="sysutils/remote" @@ -36,8 +36,8 @@ makeinstall_target() { mkdir -p $INSTALL/usr/bin cp remotecfg $INSTALL/usr/bin - mkdir -p $INSTALL/usr/lib/openelec - cp $PKG_DIR/scripts/* $INSTALL/usr/lib/openelec + mkdir -p $INSTALL/usr/lib/libreelec + cp $PKG_DIR/scripts/* $INSTALL/usr/lib/libreelec mkdir -p $INSTALL/etc/amremote cp $PKG_DIR/config/*.conf $INSTALL/etc/amremote diff --git a/packages/sysutils/amremote/scripts/remote-config b/packages/sysutils/amremote/scripts/remote-config index f565ef579f6..e1215c7e5a0 100755 --- a/packages/sysutils/amremote/scripts/remote-config +++ b/packages/sysutils/amremote/scripts/remote-config @@ -28,5 +28,5 @@ elif [ -f /storage/.config/remote.conf ]; then elif [ "$LSUSB_RET" = 0 ]; then /usr/bin/remotecfg /etc/amremote/wetek.conf elif [ "$LSUSB_RET" = 1 ]; then - /usr/bin/remotecfg /etc/amremote/openelec.conf + /usr/bin/remotecfg /etc/amremote/libreelec.conf fi diff --git a/packages/sysutils/amremote/system.d/amlogic-remotecfg.service b/packages/sysutils/amremote/system.d/amlogic-remotecfg.service index 26e9b2c985c..a2c8c627671 100644 --- a/packages/sysutils/amremote/system.d/amlogic-remotecfg.service +++ b/packages/sysutils/amremote/system.d/amlogic-remotecfg.service @@ -3,7 +3,7 @@ Description=Amlogic IR remote support [Service] Type=oneshot -ExecStart=/usr/lib/openelec/remote-config +ExecStart=/usr/lib/libreelec/remote-config RemainAfterExit=yes [Install] diff --git a/packages/sysutils/busybox/config/busybox-init.conf b/packages/sysutils/busybox/config/busybox-init.conf index 038f8b58e00..ae44b49bbab 100644 --- a/packages/sysutils/busybox/config/busybox-init.conf +++ b/packages/sysutils/busybox/config/busybox-init.conf @@ -139,7 +139,7 @@ CONFIG_FEATURE_SEAMLESS_GZ=y # CONFIG_FEATURE_AR_LONG_FILENAMES is not set # CONFIG_FEATURE_AR_CREATE is not set # CONFIG_UNCOMPRESS is not set -# CONFIG_GUNZIP is not set +CONFIG_GUNZIP=y # CONFIG_BUNZIP2 is not set # CONFIG_UNLZMA is not set # CONFIG_FEATURE_LZMA_FAST is not set @@ -153,10 +153,10 @@ CONFIG_FEATURE_SEAMLESS_GZ=y # CONFIG_DPKG is not set # CONFIG_DPKG_DEB is not set # CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY is not set -# CONFIG_GZIP is not set +CONFIG_GZIP=y # CONFIG_FEATURE_GZIP_LONG_OPTIONS is not set CONFIG_GZIP_FAST=0 -# CONFIG_FEATURE_GZIP_LEVELS is not set +CONFIG_FEATURE_GZIP_LEVELS=y # CONFIG_LZOP is not set # CONFIG_LZOP_COMPR_HIGH is not set # CONFIG_RPM2CPIO is not set @@ -257,7 +257,7 @@ CONFIG_MD5SUM=y CONFIG_MKDIR=y # CONFIG_FEATURE_MKDIR_LONG_OPTIONS is not set # CONFIG_MKFIFO is not set -# CONFIG_MKNOD is not set +CONFIG_MKNOD=y CONFIG_MV=y # CONFIG_FEATURE_MV_LONG_OPTIONS is not set CONFIG_NICE=y @@ -577,14 +577,14 @@ CONFIG_FEATURE_FBSET_FANCY=y CONFIG_FEATURE_FBSET_READMODE=y # CONFIG_FDFLUSH is not set # CONFIG_FDFORMAT is not set -# CONFIG_FDISK is not set +CONFIG_FDISK=y # CONFIG_FDISK_SUPPORT_LARGE_DISKS is not set -# CONFIG_FEATURE_FDISK_WRITABLE is not set +CONFIG_FEATURE_FDISK_WRITABLE=y # CONFIG_FEATURE_AIX_LABEL is not set # CONFIG_FEATURE_SGI_LABEL is not set # CONFIG_FEATURE_SUN_LABEL is not set # CONFIG_FEATURE_OSF_LABEL is not set -# CONFIG_FEATURE_GPT_LABEL is not set +CONFIG_FEATURE_GPT_LABEL=y # CONFIG_FEATURE_FDISK_ADVANCED is not set # CONFIG_FINDFS is not set # CONFIG_FLOCK is not set @@ -605,7 +605,7 @@ CONFIG_FEATURE_FBSET_READMODE=y # CONFIG_FEATURE_HWCLOCK_ADJTIME_FHS is not set # CONFIG_IPCRM is not set # CONFIG_IPCS is not set -# CONFIG_LOSETUP is not set +CONFIG_LOSETUP=y # CONFIG_LSPCI is not set # CONFIG_LSUSB is not set # CONFIG_MKSWAP is not set diff --git a/packages/sysutils/busybox/config/busybox-target.conf b/packages/sysutils/busybox/config/busybox-target.conf index 1a07262da04..59489962418 100644 --- a/packages/sysutils/busybox/config/busybox-target.conf +++ b/packages/sysutils/busybox/config/busybox-target.conf @@ -1,7 +1,7 @@ # # Automatically generated make config: don't edit -# Busybox version: 1.24.0 -# Tue Oct 13 14:36:02 2015 +# Busybox version: 1.24.2 +# Fri Apr 22 12:32:06 2016 # CONFIG_HAVE_DOT_CONFIG=y @@ -933,13 +933,13 @@ CONFIG_PMAP=y CONFIG_PSTREE=y CONFIG_PWDX=y CONFIG_SMEMCAP=y -CONFIG_TOP=y -CONFIG_FEATURE_TOP_CPU_USAGE_PERCENTAGE=y -CONFIG_FEATURE_TOP_CPU_GLOBAL_PERCENTS=y -CONFIG_FEATURE_TOP_SMP_CPU=y -CONFIG_FEATURE_TOP_DECIMALS=y -CONFIG_FEATURE_TOP_SMP_PROCESS=y -CONFIG_FEATURE_TOPMEM=y +# CONFIG_TOP is not set +# CONFIG_FEATURE_TOP_CPU_USAGE_PERCENTAGE is not set +# CONFIG_FEATURE_TOP_CPU_GLOBAL_PERCENTS is not set +# CONFIG_FEATURE_TOP_SMP_CPU is not set +# CONFIG_FEATURE_TOP_DECIMALS is not set +# CONFIG_FEATURE_TOP_SMP_PROCESS is not set +# CONFIG_FEATURE_TOPMEM is not set CONFIG_UPTIME=y # CONFIG_FEATURE_UPTIME_UTMP_SUPPORT is not set CONFIG_FREE=y diff --git a/packages/sysutils/busybox/config/profile b/packages/sysutils/busybox/config/profile index b03a5c4eabf..77986d235a7 100644 --- a/packages/sysutils/busybox/config/profile +++ b/packages/sysutils/busybox/config/profile @@ -28,7 +28,7 @@ esac done - if [ -e /storage/.cache/debug.openelec ] ; then + if [ -e /storage/.cache/debug.libreelec ] ; then export DEBUG=yes fi diff --git a/packages/sysutils/busybox/config/suspend-modules.conf b/packages/sysutils/busybox/config/suspend-modules.conf index 6a0956732fe..54ee22373b3 100644 --- a/packages/sysutils/busybox/config/suspend-modules.conf +++ b/packages/sysutils/busybox/config/suspend-modules.conf @@ -1 +1 @@ -SUSPEND_MODULES="jme asix anysee rtl8192se imon r8712u cx23885 cdc_acm ddbridge brcmfmac" +SUSPEND_MODULES="jme asix anysee rtl8192se imon r8712u cx23885 cdc_acm ddbridge brcmfmac 8812au" diff --git a/packages/sysutils/busybox/package.mk b/packages/sysutils/busybox/package.mk index 23f6b756495..338cd3c046b 100644 --- a/packages/sysutils/busybox/package.mk +++ b/packages/sysutils/busybox/package.mk @@ -17,14 +17,14 @@ ################################################################################ PKG_NAME="busybox" -PKG_VERSION="1.24.1" +PKG_VERSION="1.24.2" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.busybox.net" PKG_URL="http://busybox.net/downloads/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS_HOST="" -PKG_DEPENDS_TARGET="toolchain busybox:host hdparm dosfstools e2fsprogs zip unzip pciutils usbutils parted" +PKG_DEPENDS_TARGET="toolchain busybox:host hdparm dosfstools e2fsprogs zip unzip pciutils usbutils parted procps-ng" PKG_DEPENDS_INIT="toolchain" PKG_PRIORITY="required" PKG_SECTION="system" @@ -165,8 +165,11 @@ makeinstall_target() { cp $PKG_DIR/scripts/pastebinit $INSTALL/usr/bin/ ln -sf pastebinit $INSTALL/usr/bin/paste - mkdir -p $INSTALL/usr/lib/openelec - cp $PKG_DIR/scripts/fs-resize $INSTALL/usr/lib/openelec + mkdir -p $INSTALL/usr/lib/libreelec + cp $PKG_DIR/scripts/functions $INSTALL/usr/lib/libreelec + cp $PKG_DIR/scripts/fs-resize $INSTALL/usr/lib/libreelec + sed -e "s/@DISTRONAME@/$DISTRONAME/g" \ + -i $INSTALL/usr/lib/libreelec/fs-resize mkdir -p $INSTALL/etc cp $PKG_DIR/config/profile $INSTALL/etc @@ -181,7 +184,7 @@ makeinstall_target() { touch $INSTALL/etc/fstab # /etc/machine-id, needed by systemd and dbus - ln -sf /run/machine-id $INSTALL/etc/machine-id + ln -sf /storage/.cache/machine-id $INSTALL/etc/machine-id # /etc/mtab is needed by udisks etc... ln -sf /proc/self/mounts $INSTALL/etc/mtab @@ -247,6 +250,9 @@ makeinstall_init() { chmod 755 $INSTALL/platform_init fi + cp $PKG_DIR/scripts/functions $INSTALL cp $PKG_DIR/scripts/init $INSTALL + sed -e "s/@DISTRONAME@/$DISTRONAME/g" \ + -i $INSTALL/init chmod 755 $INSTALL/init } diff --git a/packages/sysutils/busybox/scripts/apt-get b/packages/sysutils/busybox/scripts/apt-get index 09182ea1244..9cd607615e3 100755 --- a/packages/sysutils/busybox/scripts/apt-get +++ b/packages/sysutils/busybox/scripts/apt-get @@ -26,15 +26,15 @@ message="$message\n repo, downloads the software, unpacks the software, updates message="$message\n local database with all filepaths and other informations about the" message="$message\n installed software or removes or updates installed Software." message="$message\n " -message="$message\n With OpenELEC it is not possible to change the system for security and" +message="$message\n With LibreELEC it is not possible to change the system for security and" message="$message\n stability reasons so even 'apt-get' would not be able to do this." message="$message\n We also dont have and want to maintain such a repo for various other" message="$message\n great reasons." message="$message\n " message="$message\n Also Ubuntu or Debian packages are often outdated and not compatible" -message="$message\n with OpenELEC" +message="$message\n with LibreELEC" message="$message\n " -message="$message\n TIP: use XBMC's addon browser to enhance your OpenELEC system" +message="$message\n TIP: use XBMC's addon browser to enhance your LibreELEC system" echo -e $message exit 1 diff --git a/packages/sysutils/busybox/scripts/createlog b/packages/sysutils/busybox/scripts/createlog index 036dd09ebbe..52d15bc1a3f 100755 --- a/packages/sysutils/busybox/scripts/createlog +++ b/packages/sysutils/busybox/scripts/createlog @@ -30,7 +30,7 @@ getlog_cmd() { if which $1 >/dev/null; then echo "################################################################################" >> $BASEDIR/$LOGDIR/$LOGFILE echo "# ... output of $@" >> $BASEDIR/$LOGDIR/$LOGFILE - echo "# OpenELEC release: $RELEASE" >> $BASEDIR/$LOGDIR/$LOGFILE + echo "# LibreELEC release: $RELEASE" >> $BASEDIR/$LOGDIR/$LOGFILE echo "# $GIT" >> $BASEDIR/$LOGDIR/$LOGFILE echo "################################################################################" >> $BASEDIR/$LOGDIR/$LOGFILE $@ >> $BASEDIR/$LOGDIR/$LOGFILE 2>/dev/null diff --git a/packages/sysutils/busybox/scripts/fs-resize b/packages/sysutils/busybox/scripts/fs-resize index 192723c694a..741e7e0a11f 100755 --- a/packages/sysutils/busybox/scripts/fs-resize +++ b/packages/sysutils/busybox/scripts/fs-resize @@ -18,15 +18,20 @@ ################################################################################ if [ -e /storage/.please_resize_me ] ; then + . /usr/lib/libreelec/functions + + hidecursor + # this sh** was never intended to be used # on already installed and runing system if [ -d /storage/.kodi -o -d /storage/.config -o -d /storage/.cache ] ; then rm -f /storage/.please_resize_me sync - echo "resizing not allowed. rebooting in 15s" - sleep 15 + echo "Resizing is not permitted - the system has already been initialised." + StartProgress countdown "Rebooting in 15s... " 15 "NOW" reboot -f fi + # get the disk. /storage on 2nd partition PART=$(grep "/storage " /proc/mounts | cut -d" " -f1 | grep '2$') @@ -51,18 +56,18 @@ if [ -e /storage/.please_resize_me ] ; then # failed to get partition start offset ? if [ ! -z "$PART_START" ] ; then umount $PART - echo "resizing /storage..." - echo "this may take a while. please do not reboot or turn off your computer" - echo "... parted -s -m $DISK rm 2" - parted -s -m $DISK rm 2 &>/dev/null - echo "... parted -s -m $DISK unit b mkpart primary $PART_START 100%" - parted -s -m $DISK unit b mkpart primary $PART_START 100% &>/dev/null - echo "... e2fsck -f -p $PART" - e2fsck -f -p $PART &>/dev/null - echo "... resize2fs $PART" - resize2fs $PART &>/dev/null - echo "...done. rebooting in 15s" - sleep 15 + + echo "PARTITION RESIZING IN PROGRESS" + echo "" + echo "Please do not reboot or turn off your @DISTRONAME@ device!" + echo "" + + StartProgress spinner "Deleting /storage... " "parted -s -m $DISK rm 2 &>/dev/null" + StartProgress spinner "Creating /storage ..." "parted -s -m $DISK unit b mkpart primary $PART_START 100% &>/dev/null" + StartProgress spinner "Checking /storage... " "e2fsck -f -p $PART &>/dev/null" + StartProgress spinner "Resizing /storage... " "resize2fs $PART &>/dev/null" + + StartProgress countdown "Rebooting in 15s... " 15 "NOW" fi fi fi diff --git a/packages/sysutils/busybox/scripts/functions b/packages/sysutils/busybox/scripts/functions new file mode 100755 index 00000000000..fb31490d56f --- /dev/null +++ b/packages/sysutils/busybox/scripts/functions @@ -0,0 +1,171 @@ +################################################################################ +# This file is part of LibreELEC - https://libreelec.tv +# Copyright (C) 2016 Neil MacLeod (milhouse@kodi.tv) +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see <http://www.gnu.org/licenses/>. +################################################################################ + +# Need a read/write location, as tmp may not always be available +mkdir -p /dev/.progress +rm -f /dev/.progress/* + +# Show frame-buffer cursor +showcursor() { + echo -en "\033[?25h" + + # show cursor + if [ -f /sys/devices/virtual/graphics/fbcon/cursor_blink ] ; then + echo 1 > /sys/devices/virtual/graphics/fbcon/cursor_blink + fi +} + +# Hide frame-buffer cursor +hidecursor() { + echo -en "\033[?25l" + + if [ -f /sys/devices/virtual/graphics/fbcon/cursor_blink ] ; then + echo 0 > /sys/devices/virtual/graphics/fbcon/cursor_blink + fi +} + +# Start a progress meter +# $1: spinner, percent, countdown +# $2: message to display +# [spinner] +# $3: optional command to execute +# $4: optional success completion message (nothing if not specified) +# $5: optional failure completion message ($4 if not specified) +# [percent] +# $3: name of filename to be progress monitored +# $4: terminal size (in bytes) of $3 when progress is complete +# $5: optional command to execute +# $6: optional success message (100% if not specified) +# $7: optional failure message ($6 if not specified) +# [countdown] +# $3: number of seconds to start counting down from +# $4: optional completion message, default is nothing +StartProgress() { + local cmdresult=0 + + # Use files for inter-process communication. + # This file is used to indicate a metter is running/active + + echo > /dev/.progress/run + + case "$1" in + spinner) + ProgressTask_Spinner "$2" & + if [ -n "$3" ]; then + eval "$3" + cmdresult=$? + [ $cmdresult -eq 0 ] && StopProgress "${4}" || StopProgress "${5:-$4}" + fi + ;; + percent) + ProgressTask_Percent "$2" "$3" $4 & + if [ -n "$5" ]; then + eval "$5" + cmdresult=$? + [ $cmdresult -eq 0 ] && StopProgress "${6}" || StopProgress "${7:-$6}" + fi + ;; + countdown) + ProgressTask_Countdown "$2" $3 "$4" + ;; + *) + echo "Unknown spinner type: $1" + return 1 + ;; + esac + + return $cmdresult +} + +# Stop a progress meter, displaying optional completion message +# $1: optional completion message (appropriate default used if not specified) +StopProgress() { + # Instruct running progress meter to end, showing specified completion message + echo "${1}" > /dev/.progress/stop + + # Wait for progress meter to stop running + while [ -f /dev/.progress/run ]; do + usleep 250000 + done + + # Clean up + rm -f /dev/.progress/stop + return 0 +} + +# Use this task for processes of indeterminate duration +ProgressTask_Spinner() { + local msg="$1" + local spinner="|/-\\|/-\\" + local count=0 donemsg + + echo -n "${msg} " + + while [ ! -f /dev/.progress/stop ]; do + echo -en "\b${spinner:$count:1}" + usleep 500000 + count=$(((count + 1) % 8)) + done + + donemsg="$(cat /dev/.progress/stop)" + echo -e "\b${donemsg:-done}" + + rm -f /dev/.progress/run + + exit 0 +} + +# Use this task when transferring a file of known size +ProgressTask_Percent() { + local msg="$1" filename="$2" fsize=$3 csize donemsg + + echo -n "${msg} " + + while [ ! -f /dev/.progress/stop ]; do + [ -f ${filename} ] && csize=$(stat -t "${filename}" | awk '{print $2}') || csize=0 + echo $csize $fsize | awk '{ printf "\b\b\b\b%3d%%", ($1 * 100 / $2) }' + usleep 250000 + done + + donemsg="$(cat /dev/.progress/stop)" + echo -e "\b\b\b\b${donemsg:-100%}" + + rm -f /dev/.progress/run + + exit 0 +} + +# Use this task to countdown a number of seconds +# (needs more work for durations > 99 seconds) +ProgressTask_Countdown() { + local msg="$1" countfrom=$2 donemsg="$3" + + echo -n "${msg} " + + while [ ${countfrom} -gt 0 ]; do + echo ${countfrom} | awk '{ printf "\b\b%2d", $1 }' + sleep 1 + countfrom=$((countfrom - 1)) + done + + echo -e "\b\b${donemsg:- }" + + rm -f /dev/.progress/run + + return 0 +} diff --git a/packages/sysutils/busybox/scripts/init b/packages/sysutils/busybox/scripts/init index 0f8bfc56517..bb3c57d6382 100755 --- a/packages/sysutils/busybox/scripts/init +++ b/packages/sysutils/busybox/scripts/init @@ -24,6 +24,7 @@ /bin/busybox mkdir -p /dev /bin/busybox mkdir -p /proc /bin/busybox mkdir -p /sys + /bin/busybox mkdir -p /tmp /bin/busybox mkdir -p /flash /bin/busybox mkdir -p /sysroot /bin/busybox mkdir -p /storage @@ -33,10 +34,15 @@ /bin/busybox mount -t proc proc /proc /bin/busybox mount -t sysfs sysfs /sys + # common functions + . /functions + # set needed variables MODULE_DIR=/lib/modules - UPDATE_DIR=/storage/.update + UPDATE_ROOT=/storage/.update + UPDATE_DIR="$UPDATE_ROOT" + UPDATE_KERNEL="KERNEL" UPDATE_SYSTEM="SYSTEM" IMAGE_KERNEL="KERNEL" @@ -44,8 +50,6 @@ BOOT_STEP="start" MD5_FAILED="0" - MD5_NOCHECK="0" - SIZE_FAILED="0" RUN_FSCK="yes" RUN_FSCK_DISKS="" @@ -72,9 +76,7 @@ # clear screen and hide cursor clear - if [ -f /sys/devices/virtual/graphics/fbcon/cursor_blink ] ; then - echo 0 > /sys/devices/virtual/graphics/fbcon/cursor_blink - fi + hidecursor # parse command line arguments for arg in $(cat /proc/cmdline); do @@ -142,6 +144,10 @@ overlay) OVERLAY=yes ;; + setfbres=*) + SWITCH_FRAMEBUFFER="${arg#*=}" + SWITCH_FRAMEBUFFER="${SWITCH_FRAMEBUFFER//,/ }" + ;; break=*) BREAK="${arg#*=}" ;; @@ -161,11 +167,14 @@ fi } + debug_msg() { + echo "$1" >&$SILENT_OUT + } + debug_shell() { echo "### Starting debugging shell... type exit to quit ###" - # show cursor - echo 0 > /sys/devices/virtual/graphics/fbcon/cursor_blink + showcursor sh </dev/tty1 >/dev/tty1 2>&1 } @@ -334,9 +343,16 @@ update_file() { if [ -f "$UPDATE_DIR/$2" -a -f "$3" ]; then - echo "updating $1..." mount -o remount,rw /flash - mv $UPDATE_DIR/$2 $3 2>/dev/null + + StartProgress percent "Updating $1... " "$3" $(stat -t "$UPDATE_DIR/$2" | awk '{print $2}') + # use dd here with conv=fsync so that all writes are non-buffered + # ensuring accurate progress - take the sync hit during the + # transfer, rather than when flushing file buffers after the progress + # meter declares the transfer already complete + dd if=$UPDATE_DIR/$2 of=$3 bs=1M conv=fsync 2>/dev/null + StopProgress + # loopback file needs writable /flash all the time if [ "${disk%%=*}" != "FILE" ]; then mount -o remount,ro /flash @@ -346,22 +362,30 @@ } update_partition() { + local result + if [ -f "$UPDATE_DIR/$2" -a -b "$3" ]; then - echo "updating $1..." - dd if="$UPDATE_DIR/$2" of="$3" - fi + StartProgress spinner "Updating $1... " + result="$(dd if="$UPDATE_DIR/$2" of="$3" conv=fsync 2>&1)" + StopProgress "done" + echo "${result}" + fi } update_bootloader() { + local result + export BOOT_ROOT="/flash" export SYSTEM_ROOT="/sysroot" mount_part "/flash/$IMAGE_SYSTEM" "/sysroot" "ro,loop" if [ -f $SYSTEM_ROOT/usr/share/bootloader/update.sh ]; then - echo "updating Bootloader..." - sh $SYSTEM_ROOT/usr/share/bootloader/update.sh - sync + StartProgress spinner "Updating Bootloader... " + result="$(sh $SYSTEM_ROOT/usr/share/bootloader/update.sh 2>&1)" + sync + StopProgress "done" + [ -n "${result}" ] && echo "${result}" fi umount /sysroot @@ -379,33 +403,72 @@ } load_splash() { + local set_default_res=no + local vres + if [ ! "$SPLASH" = "no" ]; then progress "Loading bootsplash" - SPLASHIMAGE="/splash/splash-full.png" - # load uvesafb module if needed if [ -f "$MODULE_DIR/uvesafb.ko" -a ! -e /dev/fb0 ]; then progress "Loading kernel module uvesafb.ko" - insmod "$MODULE_DIR/uvesafb.ko" || \ + insmod "$MODULE_DIR/uvesafb.ko" && \ + set_default_res=yes || \ progress "... Failed to load kernel module uvesafb, skipping" + fi - # set framebuffer to a default resolution (1024x768-32) + if [ -e /dev/fb0 ]; then + # Set framebuffer to a custom resolution and/or fallback to default resolution (1024x768-32), if required. if [ ! "$SWITCH_FRAMEBUFFER" = "no" ]; then - fbset -g 1024 768 1024 768 32 - SPLASHIMAGE="/splash/splash-1024.png" + if [ "$SWITCH_FRAMEBUFFER" = "1080" ]; then + SWITCH_FRAMEBUFFER="1920 1080 1920 1080 32" + elif [ "$SWITCH_FRAMEBUFFER" = "720" ]; then + SWITCH_FRAMEBUFFER="1280 720 1280 720 32" + fi + + # Try setting a custom framebuffer resolution + if [ ! "${SWITCH_FRAMEBUFFER:-yes}" = "yes" ]; then + fbset -g $SWITCH_FRAMEBUFFER 2>/dev/null && set_default_res=no + fi + + # Set a default resolution if required + if [ "$set_default_res" = "yes" ]; then + fbset -g 1024 768 1024 768 32 + fi fi - fi - if [ -e /dev/fb0 ]; then # load splash - if [ -f /flash/oemsplash.png ]; then - SPLASHIMAGE="/flash/oemsplash.png" - elif [ -f /splash/splash.conf ]; then + if [ -f /splash/splash.conf ]; then . /splash/splash.conf fi - ply-image $SPLASHIMAGE > /dev/null 2>&1 + # Select splash image based on current native resolution + if [ -z "$SPLASHIMAGE" ]; then + vres="$(fbset 2>/dev/null | awk '/geometry/ { print $3 }')" + + if [ -f /flash/oemsplash.png -o -f /flash/oemsplash-1080.png ]; then + if [ -n "$vres" -a -f /flash/oemsplash-$vres.png ]; then + SPLASHIMAGE="/flash/oemsplash-$vres.png" + elif [ -f /flash/oemsplash-1080.png ]; then + SPLASHIMAGE="/flash/oemsplash-1080.png" + else + SPLASHIMAGE="/flash/oemsplash.png" + fi + else + if [ -n "$vres" -a -f /splash/splash-$vres.png ]; then + SPLASHIMAGE="/splash/splash-$vres.png" + else + SPLASHIMAGE="/splash/splash-1080.png" + fi + fi + fi + + if [ -n "$SPLASHIMAGE" -a -f "$SPLASHIMAGE" ]; then + ply-image $SPLASHIMAGE > /dev/null 2>&1 + fi + + debug_msg "Framebuffer vertical res: $vres" + debug_msg "Framebuffer splash image: $SPLASHIMAGE" fi fi } @@ -414,38 +477,38 @@ echo "System reboots now..." # syncing filesystem - sync + sync # unmount filesystems - if /bin/busybox mountpoint -q /flash ; then - /bin/busybox umount /flash - fi + if /bin/busybox mountpoint -q /flash ; then + /bin/busybox umount /flash + fi - if /bin/busybox mountpoint -q /storage ; then - /bin/busybox umount /storage - fi + if /bin/busybox mountpoint -q /storage ; then + /bin/busybox umount /storage + fi usleep 2000000 /bin/busybox reboot } force_fsck() { - echo "Filesystem corruption has been detected" - echo "To prevent an automatic repair attempt continuing" + echo "Filesystem corruption has been detected!" + echo "To prevent an automatic repair attempt continuing," echo "press any key or power off your system within the next 120 seconds" echo "" read -t120 -n1 # The exit status is 0 if input is available # The exit status is greater than 128 if the timeout is exceeded if [ "$?" -ne "0" -o "$?" -gt "128" ] ; then - echo "repairing filesystem.." + echo "Repairing filesystem..." echo "" /sbin/fsck -T -M -y $RUN_FSCK_DISKS FSCK_RET="$?" if [ "$(( $FSCK_RET & 8 ))" = 8 ] ; then # fubar echo "Forced fsck failed. Your system is broken beyond repair" - echo "Please re-install OpenELEC" + echo "Please re-install @DISTRONAME@" echo "" echo "Press enter to shutdown now" echo "" @@ -454,7 +517,7 @@ fi do_reboot else - echo "shutting down..." + echo "Shutting down..." sleep 5 sync poweroff @@ -464,24 +527,24 @@ check_disks() { if [ "$RUN_FSCK" = "yes" -a -n "$RUN_FSCK_DISKS" ]; then progress "Checking disk(s): $RUN_FSCK_DISKS" - /sbin/fsck -T -M -p -a $RUN_FSCK_DISKS > /dev/null 2>&1 - FSCK_RET="$?" - - # FSCK_RET is the bit-wise OR of the exit codes for each filesystem that is checked. - if [ "$(( $FSCK_RET & 4 ))" = 4 ] ; then - # errors left - force_fsck - elif [ "$(( $FSCK_RET & 2 ))" = 2 ] ; then - # reboot needed - echo "filesystem repaired, reboot needed..." - do_reboot - elif [ "$(( $FSCK_RET & 1 ))" = 1 ] ; then - # filesystem errors corrected - progress "filesystem errors corrected , continuing..." - elif [ "$(( $FSCK_RET & 0 ))" = 0 ] ; then - # no errors found - progress "no filesystem errors found, continuing..." - fi + /sbin/fsck -T -M -p -a $RUN_FSCK_DISKS > /dev/null 2>&1 + FSCK_RET="$?" + + # FSCK_RET is the bit-wise OR of the exit codes for each filesystem that is checked. + if [ "$(( $FSCK_RET & 4 ))" = 4 ] ; then + # errors left + force_fsck + elif [ "$(( $FSCK_RET & 2 ))" = 2 ] ; then + # reboot needed + echo "Filesystem repaired, reboot needed..." + do_reboot + elif [ "$(( $FSCK_RET & 1 ))" = 1 ] ; then + # filesystem errors corrected + progress "Filesystem errors corrected , continuing..." + elif [ "$(( $FSCK_RET & 0 ))" = 0 ] ; then + # no errors found + progress "No filesystem errors found, continuing..." + fi fi } @@ -501,7 +564,7 @@ if ! ping -q -c 2 "$wol_ip" &>/dev/null; then ether-wake "$wol_mac" - sleep "$wol_wait" + StartProgress countdown "WOL magic packet sent to $wol_ip, waiting $wol_wait seconds... " $wol_wait "done" fi fi } @@ -549,115 +612,221 @@ fi } + do_cleanup() { + StartProgress spinner "Cleaning up... " + + if [ -d $UPDATE_ROOT/.tmp/mnt ]; then + if mountpoint -q $UPDATE_ROOT/.tmp/mnt ; then + # busybox umount deletes loop device automatically + umount $UPDATE_ROOT/.tmp/mnt + fi + + [ -n $LOOP ] && losetup -d $LOOP &>/dev/null + fi + + [ -f "$UPDATE_TAR" ] && rm -f "$UPDATE_TAR" &>/dev/null + [ -f "$UPDATE_IMG_GZ" ] && rm -f "$UPDATE_IMG_GZ" &>/dev/null + [ -f "$UPDATE_IMG" ] && rm -f "$UPDATE_IMG" &>/dev/null + + rm -rf $UPDATE_ROOT/.tmp &>/dev/null + rm -rf $UPDATE_ROOT/[0-9a-zA-Z]* &>/dev/null + + sync + + StopProgress "done" + } + check_update() { progress "Checking for updates" - UPDATE_TAR=`ls -1 "$UPDATE_DIR"/*.tar 2>/dev/null | head -n 1` - if [ -f "$UPDATE_DIR/$UPDATE_KERNEL" -a -f "$UPDATE_DIR/$UPDATE_SYSTEM" -o -f "$UPDATE_TAR" ] ; then - if [ "$UPDATE_DISABLED" = "yes" ] ; then - rm -rf $UPDATE_DIR/[0-9a-zA-Z]* &>/dev/null - echo "Updating not supported on netboot. normal startup in 10s..." - sync - usleep 10000000 - return 0 - fi + UPDATE_IMG_GZ=`ls -1 "$UPDATE_DIR"/*.img.gz 2>/dev/null | head -n 1` + UPDATE_IMG=`ls -1 "$UPDATE_DIR"/*.img 2>/dev/null | head -n 1` - # check for .tar - if [ -f "$UPDATE_TAR" ] ; then - echo "Found new .tar archive. extracting..." + if ! [ -f "$UPDATE_DIR/$UPDATE_KERNEL" -a -f "$UPDATE_DIR/$UPDATE_SYSTEM" ] && + ! [ -f "$UPDATE_TAR" -o -f "$UPDATE_IMG_GZ" -o -f "$UPDATE_IMG" ]; then + return 0 + fi + + if [ "$UPDATE_DISABLED" = "yes" ] ; then + echo "Updating is not supported on netboot" + do_cleanup + StartProgress countdown "Normal startup in 10s... " 10 "NOW" + return 0 + fi + + # remove temporary folder if exist from previous run + rm -fr "$UPDATE_DIR/.tmp" &>/dev/null + + echo "UPGRADE IN PROGRESS" + echo "" + echo "Please do not reboot or turn off your @DISTRONAME@ device!" + echo "" + + if [ -f "$UPDATE_TAR" ] ; then + echo "Found new .tar archive" + StartProgress spinner "Extracting contents of archive... " mkdir -p $UPDATE_DIR/.tmp &>/dev/null tar -xf "$UPDATE_TAR" -C $UPDATE_DIR/.tmp &>/dev/null mv $UPDATE_DIR/.tmp/*/target/* $UPDATE_DIR &>/dev/null - rm -f "$UPDATE_TAR" &>/dev/null - rm -rf $UPDATE_DIR/.tmp &>/dev/null sync - if [ ! -f "$UPDATE_DIR/$UPDATE_KERNEL" -o ! -f "$UPDATE_DIR/$UPDATE_SYSTEM" ] ; then - echo "missing ${UPDATE_KERNEL} or ${UPDATE_SYSTEM}... normal startup in 10s" + StopProgress "done" + elif [ -f "$UPDATE_IMG_GZ" -o -f "$UPDATE_IMG" ] ; then + mkdir -p $UPDATE_DIR/.tmp/mnt &>/dev/null + IMG_FILE="$UPDATE_DIR/.tmp/update.img" + GZRESULT="0" + + if [ -f "$UPDATE_IMG_GZ" ]; then + echo "Found new compressed image file" + + StartProgress spinner "Decompressing image file... " + gunzip -d -c "$UPDATE_IMG_GZ" 1>$IMG_FILE 2>/tmp/gzresult.txt || GZRESULT="1" sync - usleep 10000000 + [ "${GZRESULT}" -eq "0" ] && StopProgress "OK" || StopProgress "FAILED" + + if [ "${GZRESULT}" -eq "1" ]; then + echo "Failed to decompress image file!" + echo "gunzip result: '$(cat /tmp/gzresult.txt)'" + do_cleanup + StartProgress countdown "Normal startup in 30s... " 30 "NOW" return 0 fi + else + echo "Found new image file" + mv "$UPDATE_IMG" $IMG_FILE fi - if [ -f "$UPDATE_DIR/.nocheck" ] ; then - MD5_NOCHECK="1" + LOOP=$(losetup -f) + LOOP_NUM=$(echo $LOOP | sed 's|/dev/loop||') + mknod $LOOP b 7 $LOOP_NUM &>/dev/null + losetup $LOOP $IMG_FILE + + # check for MBR partititon + OFFSET=$(fdisk -u -l $LOOP 2>/dev/null | awk '/^[ ]*Device/{part=1; next}; part{if ($2 == "*") {print $3} else {print $2} ; exit}') + if [ -z "$OFFSET" ]; then + # check for GPT partititon + OFFSET=$(fdisk -u -l $LOOP 2>/dev/null | awk '/^Number/{part=1; next}; part{print $2; exit}') + if [ -z "$OFFSET" ]; then + echo "Could not find a valid system partition in image file!" + do_cleanup + StartProgress countdown "Normal startup in 10s... " 10 "NOW" + return 0 + fi fi - # check md5 sums if .nocheck doesn't exist - if [ "$MD5_NOCHECK" -eq "0" ] ; then - if [ -f "$UPDATE_DIR/${UPDATE_KERNEL}.md5" -a -f "$UPDATE_DIR/${UPDATE_SYSTEM}.md5" ] ; then - # *.md5 size-check - if [ ! -s "$UPDATE_DIR/${UPDATE_KERNEL}.md5" -o ! -s "$UPDATE_DIR/${UPDATE_SYSTEM}.md5" ] ; then - echo "zero-sized .md5 file..." - MD5_FAILED="1" - else - sed -i 's#target#/storage/.update#g' "$UPDATE_DIR/${UPDATE_KERNEL}.md5" - sed -i 's#target#/storage/.update#g' "$UPDATE_DIR/${UPDATE_SYSTEM}.md5" + SECTOR_SIZE=$(cat /sys/devices/virtual/block/loop${LOOP_NUM}/queue/hw_sector_size) + losetup -d $LOOP + sync - echo "Checking ${UPDATE_KERNEL}.md5..." - md5sum -c "$UPDATE_DIR/${UPDATE_KERNEL}.md5" || MD5_FAILED="1" + OFFSET=$(($OFFSET * $SECTOR_SIZE)) - echo "Checking ${UPDATE_SYSTEM}.md5..." - md5sum -c "$UPDATE_DIR/${UPDATE_SYSTEM}.md5" || MD5_FAILED="1" - fi - else - echo "missing ${UPDATE_KERNEL}.md5 or ${UPDATE_SYSTEM}.md5..." + # use losetup because busybox mount does not support the -o offset option + echo "Mounting system partition..." + losetup -o $OFFSET $LOOP $IMG_FILE + mount -o ro,loop $LOOP $UPDATE_DIR/.tmp/mnt + + # don't make temporary files but instead copy + # directly from mountpoint to /flash + UPDATE_DIR=$UPDATE_ROOT/.tmp/mnt + UPDATE_KERNEL=$(basename $IMAGE_KERNEL) + fi + + sync + + if [ ! -f "$UPDATE_DIR/$UPDATE_KERNEL" -o ! -f "$UPDATE_DIR/$UPDATE_SYSTEM" ] ; then + echo "Missing ${UPDATE_KERNEL} or ${UPDATE_SYSTEM}!" + do_cleanup + StartProgress countdown "Normal startup in 10s... " 10 "NOW" + return 0 + fi + + # check md5 sums if .nocheck doesn't exist + if [ ! -f "$UPDATE_DIR/.nocheck" ]; then + if [ -f "$UPDATE_DIR/${UPDATE_KERNEL}.md5" -a -f "$UPDATE_DIR/${UPDATE_SYSTEM}.md5" ] ; then + # *.md5 size-check + if [ ! -s "$UPDATE_DIR/${UPDATE_KERNEL}.md5" -o ! -s "$UPDATE_DIR/${UPDATE_SYSTEM}.md5" ] ; then + echo "Zero-sized .md5 file!" MD5_FAILED="1" + else + sed "s#target/KERNEL#$UPDATE_DIR/$UPDATE_KERNEL#g" "$UPDATE_DIR/${UPDATE_KERNEL}.md5" >"$UPDATE_ROOT/${UPDATE_KERNEL}.check.md5" + sed "s#target#$UPDATE_DIR#g" "$UPDATE_DIR/${UPDATE_SYSTEM}.md5" >"$UPDATE_ROOT/${UPDATE_SYSTEM}.check.md5" + + StartProgress spinner "Checking ${UPDATE_KERNEL}.md5... " + if md5sum -sc "$UPDATE_ROOT/${UPDATE_KERNEL}.check.md5"; then + StopProgress "OK" + else + StopProgress "FAILED" + MD5_FAILED="1" + fi + + StartProgress spinner "Checking ${UPDATE_SYSTEM}.md5... " + if md5sum -sc "$UPDATE_ROOT/${UPDATE_SYSTEM}.check.md5"; then + StopProgress "OK" + else + StopProgress "FAILED" + MD5_FAILED="1" + fi fi + else + echo "Missing ${UPDATE_KERNEL}.md5 or ${UPDATE_SYSTEM}.md5!" + MD5_FAILED="1" fi - # get sizes - FLASH_FREE=$(df /flash/ | awk '/[0-9]%/{print $4}') - FLASH_FREE=$(( $FLASH_FREE * 1024 )) + if [ "$MD5_FAILED" -eq "1" ]; then + echo "md5 check failed!" + do_cleanup + StartProgress countdown "Normal startup in 30s... " 30 "NOW" + return 0 + fi + fi + + # get sizes + FLASH_FREE=$(df /flash/ | awk '/[0-9]%/{print $4}') + FLASH_FREE=$(( $FLASH_FREE * 1024 )) + # Disregard kernel size if it's a a block device, which is the case on Amlogic/WeTek devices + if [ ! -b $IMAGE_KERNEL ]; then + OLD_KERNEL=$(stat -t "/flash/$IMAGE_KERNEL" | awk '{print $2}') + else OLD_KERNEL="0" - if [ ! -b $IMAGE_KERNEL ]; then - OLD_KERNEL=$(stat -t "/flash/$IMAGE_KERNEL" | awk '{print $2}') - fi + fi - OLD_SYSTEM=$(stat -t "/flash/$IMAGE_SYSTEM" | awk '{print $2}') - NEW_KERNEL=$(stat -t "$UPDATE_DIR/$UPDATE_KERNEL" | awk '{print $2}') - NEW_SYSTEM=$(stat -t "$UPDATE_DIR/$UPDATE_SYSTEM" | awk '{print $2}') + OLD_SYSTEM=$(stat -t "/flash/$IMAGE_SYSTEM" | awk '{print $2}') + NEW_KERNEL=$(stat -t "$UPDATE_DIR/$UPDATE_KERNEL" | awk '{print $2}') + NEW_SYSTEM=$(stat -t "$UPDATE_DIR/$UPDATE_SYSTEM" | awk '{print $2}') - # old KERNEL+SYSTEM+free space - new KERNEL+SYSTEM must be higher then 5MB - # at least 5MB free after update + # old KERNEL+SYSTEM+free space - new KERNEL+SYSTEM must be higher then 5MB + # at least 5MB free after update - TMP_SIZE=$(($OLD_KERNEL+$OLD_SYSTEM+$FLASH_FREE-$NEW_KERNEL-$NEW_SYSTEM)) - FLASH_FREE_MIN=$(($FLASH_FREE_MIN*1024*1024)) + TMP_SIZE=$(($OLD_KERNEL+$OLD_SYSTEM+$FLASH_FREE-$NEW_KERNEL-$NEW_SYSTEM)) + FLASH_FREE_MIN=$(($FLASH_FREE_MIN*1024*1024)) - if [ $TMP_SIZE -ge $FLASH_FREE_MIN ]; then - echo "Checking size: OK" - else - echo "Checking size: FAILED" - SIZE_FAILED="1" - fi + if [ $TMP_SIZE -ge $FLASH_FREE_MIN ]; then + echo "Checking size: OK" + else + echo "Checking size: FAILED" + echo "" + echo "Your System (FAT) partition is too small for this update," + echo "and there is not enough space for the update to be installed!" + echo "" + echo "You must re-install your system using the disk image of a" + echo "current release, or you must re-size your existing partitions" + echo "so that the System (FAT) partition is at least 512MB in size." + echo "" + do_cleanup + StartProgress countdown "Normal startup in 60s... " 60 "NOW" + return 0 + fi - # update if size check is ok - if [ "$SIZE_FAILED" -eq "0" ] ; then - # update if md5 check is ok or .nocheck exists - if [ "$MD5_FAILED" -eq "0" -o "$MD5_NOCHECK" -eq "1" ] ; then - if [ -b $IMAGE_KERNEL ]; then - update_partition "Kernel" "$UPDATE_KERNEL" "$IMAGE_KERNEL" - else - update_file "Kernel" "$UPDATE_KERNEL" "/flash/$IMAGE_KERNEL" - fi - update_file "System" "$UPDATE_SYSTEM" "/flash/$IMAGE_SYSTEM" - update_bootloader - rm -rf $UPDATE_DIR/[0-9a-zA-Z]* &>/dev/null - do_reboot - else - rm -rf $UPDATE_DIR/[0-9a-zA-Z]* &>/dev/null - echo "md5 check failed. normal startup in 30s..." - sync - usleep 30000000 - fi - else - rm -rf $UPDATE_DIR/[0-9a-zA-Z]* &>/dev/null - echo "size check failed. normal startup in 30s..." - sync - usleep 30000000 - fi + # all ok, update + if [ -b $IMAGE_KERNEL ]; then + update_partition "Kernel" "$UPDATE_KERNEL" "$IMAGE_KERNEL" + else + update_file "Kernel" "$UPDATE_KERNEL" "/flash/$IMAGE_KERNEL" fi + update_file "System" "$UPDATE_SYSTEM" "/flash/$IMAGE_SYSTEM" + update_bootloader + do_cleanup + do_reboot } prepare_sysroot() { @@ -675,17 +844,14 @@ if [ ! -d "/sysroot/lib/modules/$(uname -r)/" -a -f "/sysroot/usr/lib/systemd/systemd" ]; then echo "" - echo "NEVER TOUCH boot= in extlinux.conf / cmdline.txt" - echo "if you dont know what you are doing" + echo "NEVER TOUCH boot= in extlinux.conf / cmdline.txt!" + echo "If you don't know what you are doing," + echo "your installation is now broken." echo "" - echo "your installation is now broken" - echo "" - echo "normal boot in 60s..." - usleep 60000000 + StartProgress countdown "Normal startup in 60s... " 60 "NOW" fi - - [ -f "/sysroot/usr/lib/systemd/systemd" ] || error "final_check" "Could not find system." + [ -f "/sysroot/usr/lib/systemd/systemd" ] || error "final_check" "Could not find systemd!" } if [ "${boot%%=*}" = "FILE" ]; then @@ -725,6 +891,7 @@ /bin/busybox mount --move /dev /sysroot/dev /bin/busybox mount --move /proc /sysroot/proc /bin/busybox mount --move /sys /sysroot/sys + /bin/busybox rm -fr /tmp # tell OE settings addon to disable updates if [ "$UPDATE_DISABLED" = "yes" ] ; then @@ -747,6 +914,7 @@ if [ -f /sysroot/storage/.cache/reset_oe -o -f /sysroot/storage/.cache/reset_xbmc ] ; then INIT_UNIT="--unit=factory-reset.target" fi + # switch to new sysroot and start real init exec /bin/busybox switch_root /sysroot /usr/lib/systemd/systemd $INIT_ARGS $INIT_UNIT diff --git a/packages/sysutils/busybox/scripts/passwd b/packages/sysutils/busybox/scripts/passwd index e40f083f891..b413879a05d 100755 --- a/packages/sysutils/busybox/scripts/passwd +++ b/packages/sysutils/busybox/scripts/passwd @@ -22,7 +22,7 @@ message="$message\n There is no working 'passwd'." message="$message\n" message="$message\n The 'passwd' command changes passwords for user accounts." message="$message\n" -message="$message\n With OpenELEC it is not possible to change the system password" +message="$message\n With LibreELEC it is not possible to change the system password" message="$message\n" message="$message\n SSH is included only as a last support resort. SSH is off by default." message="$message\n Most users never need SSH and need help using it so we need a default" diff --git a/packages/sysutils/busybox/scripts/sudo b/packages/sysutils/busybox/scripts/sudo index 4980194de03..67a25133902 100755 --- a/packages/sysutils/busybox/scripts/sudo +++ b/packages/sysutils/busybox/scripts/sudo @@ -24,7 +24,7 @@ message="$message\n On debian/ubuntu/all general purpose linux distributions 'su message="$message\n allows a permitted user to execute a command as the superuser" message="$message\n or another user, as specified by the security policy" message="$message\n " -message="$message\n With OpenELEC you have root access by default, so you dont need 'sudo'" +message="$message\n With LibreELEC you have root access by default, so you dont need 'sudo'" message="$message\n " echo -e $message diff --git a/packages/sysutils/busybox/sleep.d.serial/99-suspend-modules.sh b/packages/sysutils/busybox/sleep.d.serial/99-suspend-modules.sh index b100eb13b16..110959e27c1 100755 --- a/packages/sysutils/busybox/sleep.d.serial/99-suspend-modules.sh +++ b/packages/sysutils/busybox/sleep.d.serial/99-suspend-modules.sh @@ -55,7 +55,7 @@ modunload() _rmmod() { if modprobe -r "$1"; then - touch "/run/openelec/suspend/module:$1" + touch "/run/libreelec/suspend/module:$1" return 0 else logger -t suspend-modules "# could not unload '$1', usage count was $2" @@ -65,7 +65,7 @@ _rmmod() resume_modules() { - for x in /run/openelec/suspend/module:* ; do + for x in /run/libreelec/suspend/module:* ; do [ -O "${x}" ] || continue modprobe "${x##*:}" &>/dev/null && \ logger -t resume-modules "Reloaded module ${x##*:}." || \ @@ -77,8 +77,8 @@ suspend_modules() { [ -z "$SUSPEND_MODULES" ] && return 0 # clean up - rm -rf /run/openelec/suspend - mkdir -p /run/openelec/suspend + rm -rf /run/libreelec/suspend + mkdir -p /run/libreelec/suspend for x in $SUSPEND_MODULES ; do modunload $x && \ logger -t suspend-modules "Unloading kernel module $x: Done" || \ diff --git a/packages/sysutils/busybox/system.d/debug-shell.service b/packages/sysutils/busybox/system.d/debug-shell.service index f1469bd9c41..ce7cfc45b3a 100644 --- a/packages/sysutils/busybox/system.d/debug-shell.service +++ b/packages/sysutils/busybox/system.d/debug-shell.service @@ -4,7 +4,7 @@ Description=Debug Shell DefaultDependencies=no ConditionKernelCommandLine=|tty ConditionKernelCommandLine=|debugging -ConditionPathExists=|/storage/.cache/debug.openelec +ConditionPathExists=|/storage/.cache/debug.libreelec [Service] Environment=TTY=3 diff --git a/packages/sysutils/busybox/system.d/fs-resize.service b/packages/sysutils/busybox/system.d/fs-resize.service index 2f2aaa4ab56..b3a85d6460f 100644 --- a/packages/sysutils/busybox/system.d/fs-resize.service +++ b/packages/sysutils/busybox/system.d/fs-resize.service @@ -4,7 +4,7 @@ DefaultDependencies=no [Service] Type=idle -ExecStart=/usr/lib/openelec/fs-resize +ExecStart=/usr/lib/libreelec/fs-resize StandardInput=tty-force StandardOutput=inherit StandardError=inherit diff --git a/packages/sysutils/busybox/system.d/shell.service b/packages/sysutils/busybox/system.d/shell.service index 8b6d98bdf53..7b2a0da78b7 100644 --- a/packages/sysutils/busybox/system.d/shell.service +++ b/packages/sysutils/busybox/system.d/shell.service @@ -5,6 +5,7 @@ After=multi-user.target [Service] Environment=TTY=1 WorkingDirectory=/storage +ExecStartPre=/bin/sh -c 'echo -en "\033[?25h"' ExecStart=/bin/sh -c 'clear; lsb_release; . /etc/profile; exec /bin/sh' Restart=always diff --git a/packages/sysutils/busybox/system.d/var-log-debug.service b/packages/sysutils/busybox/system.d/var-log-debug.service index 9bf55bebc53..a8e9efc0fdd 100644 --- a/packages/sysutils/busybox/system.d/var-log-debug.service +++ b/packages/sysutils/busybox/system.d/var-log-debug.service @@ -5,7 +5,7 @@ After=var.mount Before=systemd-journal-flush.service ConditionKernelCommandLine=!installer ConditionKernelCommandLine=|debugging -ConditionPathExists=|/storage/.cache/debug.openelec +ConditionPathExists=|/storage/.cache/debug.libreelec [Service] Type=oneshot diff --git a/packages/sysutils/dbus/package.mk b/packages/sysutils/dbus/package.mk index 367b90b4b68..1d69e3c1228 100644 --- a/packages/sysutils/dbus/package.mk +++ b/packages/sysutils/dbus/package.mk @@ -17,7 +17,7 @@ ################################################################################ PKG_NAME="dbus" -PKG_VERSION="1.10.6" +PKG_VERSION="1.10.8" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" diff --git a/packages/sysutils/eventlircd/evmap/osmc_rf.evmap b/packages/sysutils/eventlircd/evmap/osmc_rf.evmap new file mode 100644 index 00000000000..2cea5616cdb --- /dev/null +++ b/packages/sysutils/eventlircd/evmap/osmc_rf.evmap @@ -0,0 +1,14 @@ +#KEY_HOME = KEY_HOME +#KEY_INFO = KEY_INFO +#KEY_UP = KEY_UP +#KEY_DOWN = KEY_DOWN +#KEY_LEFT = KEY_LEFT +#KEY_RIGHT = KEY_RIGHT +KEY_ENTER = KEY_OK +#KEY_BACK = KEY_BACK +KEY_CONTEXT_MENU = KEY_TITLE +#KEY_PLAYPAUSE = KEY_PLAYPAUSE +#KEY_STOP = KEY_STOP +#KEY_REWIND = KEY_REWIND +#KEY_FASTFORWARD = KEY_FASTFORWARD + diff --git a/packages/sysutils/eventlircd/package.mk b/packages/sysutils/eventlircd/package.mk index f9b90c70e2c..76ee498a74e 100644 --- a/packages/sysutils/eventlircd/package.mk +++ b/packages/sysutils/eventlircd/package.mk @@ -17,12 +17,13 @@ ################################################################################ PKG_NAME="eventlircd" -PKG_VERSION="42" +PKG_VERSION="7faaf9d" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" -PKG_SITE="http://code.google.com/p/eventlircd" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.bz2" +PKG_SITE="https://github.com/OpenELEC/eventlircd" +PKG_URL="https://github.com/OpenELEC/eventlircd/archive/$PKG_VERSION.tar.gz" +PKG_SOURCE_DIR="${PKG_NAME}-${PKG_VERSION}*" PKG_DEPENDS_TARGET="toolchain systemd lirc" PKG_PRIORITY="optional" PKG_SECTION="system/remote" diff --git a/packages/sysutils/eventlircd/patches/eventlircd-42-001-path.patch b/packages/sysutils/eventlircd/patches/eventlircd-42-001-path.patch deleted file mode 100644 index e85edbf3bc7..00000000000 --- a/packages/sysutils/eventlircd/patches/eventlircd-42-001-path.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -Naur eventlircd-42/udev/wakeup_enable.in eventlircd-42.patch/udev/wakeup_enable.in ---- eventlircd-42/udev/wakeup_enable.in 2011-04-01 16:42:27.000000000 +0200 -+++ eventlircd-42.patch/udev/wakeup_enable.in 2011-11-28 02:05:59.743690557 +0100 -@@ -4,7 +4,7 @@ - ################################################################################ - - devpath=`readlink -f "/sys/${DEVPATH}"` --while echo "${devpath}" | /bin/grep -q '^/sys/devices/' > /dev/null 2>&1 ; do -+while echo "${devpath}" | grep -q '^/sys/devices/' > /dev/null 2>&1 ; do - if test -e "${devpath}/power/wakeup" ; then - state=`cat "${devpath}/power/wakeup"` - if test "x${state}" = "xdisabled" ; then diff --git a/packages/sysutils/eventlircd/patches/eventlircd-kernel-4.4.patch b/packages/sysutils/eventlircd/patches/eventlircd-kernel-4.4.patch deleted file mode 100644 index d5b9bdd242b..00000000000 --- a/packages/sysutils/eventlircd/patches/eventlircd-kernel-4.4.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 424810e45bb065151bed0cd8f5e03a3283c06f21 Mon Sep 17 00:00:00 2001 -From: Stephan Raue <stephan@openelec.tv> -Date: Fri, 18 Dec 2015 19:09:25 +0100 -Subject: [PATCH] [configure.ac] add support for kernel 4.4 - -Signed-off-by: Stephan Raue <stephan@openelec.tv> ---- - configure.ac | 11 ++++++++--- - 1 file changed, 8 insertions(+), 3 deletions(-) - -diff --git a/configure.ac b/configure.ac -index b5de94d..f04ffc0 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -92,10 +92,15 @@ dnl event_name_to_code.h.sh, evkey_code_to_name.h.sh and evkey_type.h.sh - dnl in order for them to generate the header files event_name_to_code.h, - dnl evkey_code_to_name.h and evkey_type.h respectively - AX_ABSOLUTE_HEADER(linux/input.h) --if test "x$gl_cv_absolute_linux_input_h" = "x" ; then -- AC_MSG_ERROR([failed to find the absolute path to header file linux/input.h]) -+AX_ABSOLUTE_HEADER(linux/input-event-codes.h) -+if test "x$gl_cv_absolute_linux_input_event_codes_h" = "x" ; then -+ if test "x$gl_cv_absolute_linux_input_h" = "x" ; then -+ AC_MSG_ERROR([failed to find the absolute path to header file linux/input.h or linux/input-event-codes.h]) -+ fi -+ AC_SUBST(ABSOLUTE_LINUX_INPUT_H, $gl_cv_absolute_linux_input_h) -+else -+ AC_SUBST(ABSOLUTE_LINUX_INPUT_H, $gl_cv_absolute_linux_input_event_codes_h) - fi --AC_SUBST(ABSOLUTE_LINUX_INPUT_H, $gl_cv_absolute_linux_input_h) - - PKG_CHECK_MODULES(LIBUDEV, [libudev >= 136]) - --- -1.9.3 - diff --git a/packages/sysutils/eventlircd/udev.d/98-eventlircd.rules b/packages/sysutils/eventlircd/udev.d/98-eventlircd.rules index bf564e8866c..d35d855f40f 100644 --- a/packages/sysutils/eventlircd/udev.d/98-eventlircd.rules +++ b/packages/sysutils/eventlircd/udev.d/98-eventlircd.rules @@ -182,6 +182,10 @@ ENV{ID_VENDOR_ID}=="0471", ENV{ID_MODEL_ID}=="20cc", \ ENV{eventlircd_enable}="true", \ ENV{eventlircd_evmap}="spinelplus.evmap" +ENV{ID_VENDOR_ID}=="2252", ENV{ID_MODEL_ID}=="1037", \ +ENV{eventlircd_enable}="true", \ +ENV{eventlircd_evmap}="osmc_rf.evmap" + # Enable wake-on-usb for the USB remotes. RUN+="wakeup_enable" diff --git a/tools/mkpkg/mkpkg_amremote b/packages/sysutils/exfat-utils/package.mk old mode 100755 new mode 100644 similarity index 59% rename from tools/mkpkg/mkpkg_amremote rename to packages/sysutils/exfat-utils/package.mk index 917a1e051e0..59bb2c8cca2 --- a/tools/mkpkg/mkpkg_amremote +++ b/packages/sysutils/exfat-utils/package.mk @@ -1,7 +1,6 @@ -#!/bin/sh ################################################################################ # This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) # # OpenELEC is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -17,25 +16,18 @@ # along with OpenELEC. If not, see <http://www.gnu.org/licenses/>. ################################################################################ -echo "getting sources..." - if [ ! -d libamcodec.git ]; then - git clone https://github.com/codesnake/amremote.git amremote.git - fi +PKG_NAME="exfat-utils" +PKG_VERSION="1.2.1" +PKG_REV="1" +PKG_ARCH="any" +PKG_LICENSE="GPLv2+" +PKG_SITE="https://github.com/relan/exfat" +PKG_URL="https://github.com/relan/exfat/releases/download/v$PKG_VERSION/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain" +PKG_PRIORITY="optional" +PKG_SECTION="system" +PKG_SHORTDESC="exFAT utils" +PKG_LONGDESC="This project aims to provide a full-featured exFAT file system implementation for GNU/Linux other Unix-like systems as a FUSE module." - cd amremote.git - git pull - GIT_REV=`git log -n1 --format=%h` - cd .. - -echo "copying sources..." - rm -rf amremote-$GIT_REV - cp -R amremote.git amremote-$GIT_REV - -echo "cleaning sources..." - rm -rf amremote-$GIT_REV/.git - -echo "packing sources..." - tar cvJf amremote-$GIT_REV.tar.xz amremote-$GIT_REV - -echo "remove temporary sourcedir..." - rm -rf amremote-$GIT_REV +PKG_IS_ADDON="no" +PKG_AUTORECONF="yes" diff --git a/packages/sysutils/fuse-exfat/package.mk b/packages/sysutils/fuse-exfat/package.mk index 196b5243970..e3e80d2ed67 100644 --- a/packages/sysutils/fuse-exfat/package.mk +++ b/packages/sysutils/fuse-exfat/package.mk @@ -23,7 +23,7 @@ PKG_ARCH="any" PKG_LICENSE="GPLv2+" PKG_SITE="https://github.com/relan/exfat" PKG_URL="https://github.com/relan/exfat/releases/download/v$PKG_VERSION/$PKG_NAME-$PKG_VERSION.tar.gz" -PKG_DEPENDS_TARGET="toolchain fuse" +PKG_DEPENDS_TARGET="toolchain fuse exfat-utils" PKG_PRIORITY="optional" PKG_SECTION="system" PKG_SHORTDESC="fuse-exfat: aims to provide a full-featured exFAT file system implementation for GNU/Linux other Unix-like systems as a FUSE module." diff --git a/packages/sysutils/fuse/package.mk b/packages/sysutils/fuse/package.mk index 5a13de928ad..98854a8846c 100644 --- a/packages/sysutils/fuse/package.mk +++ b/packages/sysutils/fuse/package.mk @@ -17,12 +17,12 @@ ################################################################################ PKG_NAME="fuse" -PKG_VERSION="2.9.5" +PKG_VERSION="2.9.6" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="https://github.com/libfuse/libfuse/" -PKG_URL="https://github.com/libfuse/libfuse/releases/download/${PKG_NAME}_${PKG_VERSION//./_}/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_URL="https://github.com/libfuse/libfuse/releases/download/$PKG_NAME-$PKG_VERSION/$PKG_NAME-$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain" PKG_PRIORITY="optional" PKG_SECTION="system" diff --git a/packages/sysutils/imx6-soc-fan/bin/imx6-soc-fan-control b/packages/sysutils/imx6-soc-fan/bin/imx6-soc-fan-control index 92d07ec0ad0..699706848f6 100755 --- a/packages/sysutils/imx6-soc-fan/bin/imx6-soc-fan-control +++ b/packages/sysutils/imx6-soc-fan/bin/imx6-soc-fan-control @@ -18,7 +18,7 @@ # along with OpenELEC. If not, see <http://www.gnu.org/licenses/>. ################################################################################ -. /usr/lib/openelec/imx6-system-type +. /usr/lib/libreelec/imx6-system-type if [ "$SYSTEM_TYPE" != "matrix" ]; then echo "Only for TBS Matrix system." diff --git a/packages/sysutils/imx6-soc-fan/package.mk b/packages/sysutils/imx6-soc-fan/package.mk index 7904e67f0d9..25f92fc06cd 100644 --- a/packages/sysutils/imx6-soc-fan/package.mk +++ b/packages/sysutils/imx6-soc-fan/package.mk @@ -42,8 +42,8 @@ makeinstall_target() { mkdir -p $INSTALL/usr/bin cp $PKG_DIR/bin/* $INSTALL/usr/bin - mkdir -p $INSTALL/usr/lib/openelec - cp $PKG_DIR/scripts/* $INSTALL/usr/lib/openelec + mkdir -p $INSTALL/usr/lib/libreelec + cp $PKG_DIR/scripts/* $INSTALL/usr/lib/libreelec } post_install() { diff --git a/packages/sysutils/imx6-soc-fan/scripts/imx6-soc-fan-monitor b/packages/sysutils/imx6-soc-fan/scripts/imx6-soc-fan-monitor index c27fa246a26..4f1cbae8043 100755 --- a/packages/sysutils/imx6-soc-fan/scripts/imx6-soc-fan-monitor +++ b/packages/sysutils/imx6-soc-fan/scripts/imx6-soc-fan-monitor @@ -18,7 +18,7 @@ # along with OpenELEC. If not, see <http://www.gnu.org/licenses/>. ################################################################################ -. /usr/lib/openelec/imx6-system-type +. /usr/lib/libreelec/imx6-system-type if [ "$SYSTEM_TYPE" != "matrix" ]; then echo "Only for TBS Matrix system." diff --git a/packages/sysutils/imx6-soc-fan/system.d/imx6-soc-fan-monitor.service b/packages/sysutils/imx6-soc-fan/system.d/imx6-soc-fan-monitor.service index 5311b9ab5f0..33053c75d9a 100644 --- a/packages/sysutils/imx6-soc-fan/system.d/imx6-soc-fan-monitor.service +++ b/packages/sysutils/imx6-soc-fan/system.d/imx6-soc-fan-monitor.service @@ -2,7 +2,7 @@ Description=i.MX6 SoC fan monitor service [Service] -ExecStart=/bin/sh -c "exec /bin/sh /usr/lib/openelec/imx6-soc-fan-monitor" +ExecStart=/bin/sh -c "exec /bin/sh /usr/lib/libreelec/imx6-soc-fan-monitor" RestartPreventExitStatus=12 TimeoutStopSec=5 Restart=always diff --git a/packages/sysutils/imx6-status-led/package.mk b/packages/sysutils/imx6-status-led/package.mk index 497ded225ca..0b0f2a216c6 100644 --- a/packages/sysutils/imx6-status-led/package.mk +++ b/packages/sysutils/imx6-status-led/package.mk @@ -36,8 +36,8 @@ make_target() { } makeinstall_target() { - mkdir -p $INSTALL/usr/lib/openelec - cp $PKG_DIR/scripts/* $INSTALL/usr/lib/openelec + mkdir -p $INSTALL/usr/lib/libreelec + cp $PKG_DIR/scripts/* $INSTALL/usr/lib/libreelec } post_install() { diff --git a/packages/sysutils/imx6-status-led/scripts/imx6-status-led b/packages/sysutils/imx6-status-led/scripts/imx6-status-led index 46e08d58cb4..d3ef9e05b0b 100755 --- a/packages/sysutils/imx6-status-led/scripts/imx6-status-led +++ b/packages/sysutils/imx6-status-led/scripts/imx6-status-led @@ -18,7 +18,7 @@ # along with OpenELEC. If not, see <http://www.gnu.org/licenses/>. ################################################################################ -. /usr/lib/openelec/imx6-system-type +. /usr/lib/libreelec/imx6-system-type case "$1" in "on") diff --git a/packages/sysutils/imx6-status-led/system.d/imx6-status-led.service b/packages/sysutils/imx6-status-led/system.d/imx6-status-led.service index f04bd3eafe7..464739f6656 100644 --- a/packages/sysutils/imx6-status-led/system.d/imx6-status-led.service +++ b/packages/sysutils/imx6-status-led/system.d/imx6-status-led.service @@ -4,8 +4,8 @@ After=kodi.service [Service] Type=oneshot -ExecStart=-/bin/sh -c "/usr/lib/openelec/imx6-status-led on" -ExecStop=-/bin/sh -c "/usr/lib/openelec/imx6-status-led heartbeat" +ExecStart=-/bin/sh -c "/usr/lib/libreelec/imx6-status-led on" +ExecStop=-/bin/sh -c "/usr/lib/libreelec/imx6-status-led heartbeat" RemainAfterExit=yes [Install] diff --git a/packages/sysutils/irqbalanced/package.mk b/packages/sysutils/irqbalanced/package.mk new file mode 100644 index 00000000000..0e672bfdab4 --- /dev/null +++ b/packages/sysutils/irqbalanced/package.mk @@ -0,0 +1,40 @@ +################################################################################ +# This file is part of LibreELEC - https://LibreELEC.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see <http://www.gnu.org/licenses/>. +################################################################################ + +PKG_NAME="irqbalanced" +PKG_VERSION="7f31046" +PKG_REV="1" +PKG_ARCH="arm" +PKG_LICENSE="other" +PKG_SITE="http://www.freescale.com" +PKG_URL="https://github.com/dv1/irqbalanced/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain systemd glib" +PKG_PRIORITY="optional" +PKG_SECTION="system" +PKG_SHORTDESC="irqbalanced: distribute hardware interrupts across processors on a multiprocessor system." +PKG_LONGDESC="irqbalanced: distribute hardware interrupts across processors on a multiprocessor system." +PKG_IS_ADDON="no" +PKG_AUTORECONF="no" + +pre_configure_target() { + sh -c ./autogen.sh +} + +post_install() { + enable_service irqbalance.service +} diff --git a/packages/sysutils/irqbalanced/system.d/irqbalance.service b/packages/sysutils/irqbalanced/system.d/irqbalance.service new file mode 100644 index 00000000000..a9d97d14bf9 --- /dev/null +++ b/packages/sysutils/irqbalanced/system.d/irqbalance.service @@ -0,0 +1,10 @@ +[Unit] +Description=irqbalance +After=proc.mount + +[Service] +ExecStart=/usr/sbin/irqbalance +Type=forking + +[Install] +WantedBy=sysinit.target diff --git a/packages/sysutils/lcdproc/package.mk b/packages/sysutils/lcdproc/package.mk index efc8b1cb904..27a99a87b33 100644 --- a/packages/sysutils/lcdproc/package.mk +++ b/packages/sysutils/lcdproc/package.mk @@ -72,8 +72,8 @@ post_makeinstall_target() { -e "s|^#normal_font=.*$|normal_font=/usr/share/fonts/liberation/LiberationMono-Bold.ttf|" \ -i $INSTALL/etc/LCDd.conf - mkdir -p $INSTALL/usr/lib/openelec - cp $PKG_DIR/scripts/lcd-wrapper $INSTALL/usr/lib/openelec + mkdir -p $INSTALL/usr/lib/libreelec + cp $PKG_DIR/scripts/lcd-wrapper $INSTALL/usr/lib/libreelec } diff --git a/packages/sysutils/lcdproc/system.d/lcdd.service b/packages/sysutils/lcdproc/system.d/lcdd.service index 3cc45cdf66f..83dadf65960 100644 --- a/packages/sysutils/lcdproc/system.d/lcdd.service +++ b/packages/sysutils/lcdproc/system.d/lcdd.service @@ -5,7 +5,7 @@ After=multi-user.target [Service] EnvironmentFile=-/storage/.cache/services/lcdd.conf -ExecStart=/bin/sh -c 'exec /usr/lib/openelec/lcd-wrapper' +ExecStart=/bin/sh -c 'exec /usr/lib/libreelec/lcd-wrapper' TimeoutStopSec=1s Restart=always RestartSec=5 diff --git a/packages/sysutils/lirc/config/lircd.conf.amremote b/packages/sysutils/lirc/config/lircd.conf.amremote new file mode 100644 index 00000000000..eed2e9fd10a --- /dev/null +++ b/packages/sysutils/lirc/config/lircd.conf.amremote @@ -0,0 +1,34 @@ +begin remote + + name odroid-amremote + bits 16 + flags SPACE_ENC|CONST_LENGTH + eps 30 + aeps 100 + + header 8964 4507 + one 544 1692 + zero 544 561 + ptrail 544 + pre_data_bits 16 + pre_data 0x4DB2 + min_repeat 1 + suppress_repeat 5 + toggle_bit_mask 0x0 + + begin codes + KEY_LEFT 0x9966 + KEY_RIGHT 0x837C + KEY_UP 0x53AC + KEY_DOWN 0x4BB4 + KEY_ENTER 0x738C + KEY_HOME 0x41BE + KEY_MUTE 0x11EE + KEY_MENU 0xA35C + KEY_BACK 0x59A6 + KEY_VOLUMEDOWN 0x817E + KEY_VOLUMEUP 0x01FE + KEY_POWER 0x3BC4 + + end codes +end remote diff --git a/packages/sysutils/lirc/package.mk b/packages/sysutils/lirc/package.mk index 0b097de711b..7407dc3d804 100644 --- a/packages/sysutils/lirc/package.mk +++ b/packages/sysutils/lirc/package.mk @@ -56,11 +56,10 @@ post_makeinstall_target() { rm -rf $INSTALL/usr/bin/pronto2lirc mkdir -p $INSTALL/etc/lirc - cp $PKG_DIR/config/lircd.conf.xbox $INSTALL/etc/lirc - cp $PKG_DIR/config/lircd.conf.rpi $INSTALL/etc/lirc + cp $PKG_DIR/config/lircd.conf.* $INSTALL/etc/lirc - mkdir -p $INSTALL/usr/lib/openelec - cp $PKG_DIR/scripts/lircd_helper $INSTALL/usr/lib/openelec + mkdir -p $INSTALL/usr/lib/libreelec + cp $PKG_DIR/scripts/lircd_helper $INSTALL/usr/lib/libreelec mkdir -p $INSTALL/usr/lib/udev cp $PKG_DIR/scripts/lircd_wakeup_enable $INSTALL/usr/lib/udev diff --git a/packages/sysutils/lirc/system.d/lircd@.service b/packages/sysutils/lirc/system.d/lircd@.service index ff293c7bffa..60d9c010eac 100644 --- a/packages/sysutils/lirc/system.d/lircd@.service +++ b/packages/sysutils/lirc/system.d/lircd@.service @@ -3,8 +3,8 @@ Description=Lirc with %I [Service] Type=oneshot -ExecStart=/usr/lib/openelec/lircd_helper add %I -ExecStop=/usr/lib/openelec/lircd_helper remove %I +ExecStart=/usr/lib/libreelec/lircd_helper add %I +ExecStop=/usr/lib/libreelec/lircd_helper remove %I TimeoutStopSec=1 RemainAfterExit=yes diff --git a/packages/sysutils/lirc/udev.d/98-lircd.rules b/packages/sysutils/lirc/udev.d/98-lircd.rules index 0f22df5f817..985b0592313 100644 --- a/packages/sysutils/lirc/udev.d/98-lircd.rules +++ b/packages/sysutils/lirc/udev.d/98-lircd.rules @@ -32,6 +32,11 @@ SUBSYSTEM=="lirc", DRIVERS=="lirc_rpi", \ ENV{lircd_driver}="default", \ ENV{lircd_conf}="lircd.conf.rpi" +### Odroid AMLogic IR Receiver +SUBSYSTEMS=="platform", DRIVERS=="meson-ir", \ + ENV{lircd_driver}="default", \ + ENV{lircd_conf}="lircd.conf.amremote" + #------------------------------------------------------------------------------- # Ask lircd_helper to handle USB devices that do not show up as lirc devices # and are supported by lircd. Remote controls that are USB HID devices that show diff --git a/packages/sysutils/ntfs-3g_ntfsprogs/package.mk b/packages/sysutils/ntfs-3g_ntfsprogs/package.mk index 22cb58edaaf..d8b7ff52334 100644 --- a/packages/sysutils/ntfs-3g_ntfsprogs/package.mk +++ b/packages/sysutils/ntfs-3g_ntfsprogs/package.mk @@ -17,7 +17,7 @@ ################################################################################ PKG_NAME="ntfs-3g_ntfsprogs" -PKG_VERSION="2015.3.14" +PKG_VERSION="2016.2.22" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" diff --git a/packages/sysutils/open-iscsi/package.mk b/packages/sysutils/open-iscsi/package.mk index 127e7d3951d..30137f5d47f 100644 --- a/packages/sysutils/open-iscsi/package.mk +++ b/packages/sysutils/open-iscsi/package.mk @@ -23,7 +23,7 @@ PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="https://github.com/mikechristie/open-iscsi" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_URL="https://github.com/mikechristie/open-iscsi/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_INIT="toolchain util-linux" PKG_PRIORITY="optional" PKG_SECTION="initramfs/system" diff --git a/packages/sysutils/open-vm-tools/modules-load.d/open-vm-tools.conf b/packages/sysutils/open-vm-tools/modules-load.d/open-vm-tools.conf new file mode 100644 index 00000000000..c0ee39caed1 --- /dev/null +++ b/packages/sysutils/open-vm-tools/modules-load.d/open-vm-tools.conf @@ -0,0 +1,2 @@ +# load vmxnet kernel module +vmxnet diff --git a/packages/sysutils/open-vm-tools/package.mk b/packages/sysutils/open-vm-tools/package.mk new file mode 100644 index 00000000000..ad50475a2ee --- /dev/null +++ b/packages/sysutils/open-vm-tools/package.mk @@ -0,0 +1,71 @@ +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2011 Anthony Nash (nash.ant@gmail.com) +# +# OpenELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# OpenELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with OpenELEC. If not, see <http://www.gnu.org/licenses/>. +################################################################################ + +PKG_NAME="open-vm-tools" +PKG_VERSION="stable-10.0.7" +PKG_REV="1" +PKG_ARCH="x86_64" +PKG_LICENSE="GPL" +PKG_SITE="http://open-vm-tools.sourceforge.net" +PKG_URL="https://github.com/vmware/open-vm-tools/archive/${PKG_VERSION}.tar.gz" +PKG_DEPENDS_TARGET="toolchain glib:host glib libdnet" +PKG_PRIORITY="optional" +PKG_SECTION="virtualization" +PKG_SHORTDESC="open-vm-tools: open source implementation of VMware Tools" +PKG_LONGDESC="open-vm-tools: open source implementation of VMware Tools" + +PKG_IS_ADDON="no" +PKG_AUTORECONF="yes" + +OPENVMTOOLS_KERNEL_VER=$(basename $(ls -d $ROOT/$BUILD/linux-[0-9]*)| sed 's|linux-||g') + +PKG_CONFIGURE_OPTS_TARGET="--disable-docs \ + --disable-tests \ + --disable-deploypkg \ + --without-pam \ + --without-gtk2 \ + --without-gtkmm \ + --without-ssl \ + --without-x \ + --without-xerces \ + --without-icu \ + --without-procps \ + --without-kernel-modules \ + --with-sysroot=$SYSROOT_PREFIX" + +post_unpack() { + mv $PKG_BUILD/$PKG_NAME/* $PKG_BUILD/ +} + +pre_configure_target() { + export LIBS="-ldnet" +} + +makeinstall_target() { + mkdir -p $INSTALL/usr/lib + cp -PR libvmtools/.libs/libvmtools.so* $INSTALL/usr/lib + + mkdir -p $INSTALL/usr/bin + cp -PR services/vmtoolsd/.libs/vmtoolsd $INSTALL/usr/bin + cp -PR checkvm/.libs/vmware-checkvm $INSTALL/usr/bin +} + +post_install() { + enable_service open-vm-tools.service +} diff --git a/packages/sysutils/open-vm-tools/patches/open-vm-tools-0001_glib-static.patch b/packages/sysutils/open-vm-tools/patches/open-vm-tools-0001_glib-static.patch new file mode 100644 index 00000000000..da5671f3ea9 --- /dev/null +++ b/packages/sysutils/open-vm-tools/patches/open-vm-tools-0001_glib-static.patch @@ -0,0 +1,1507 @@ +diff -Naur a/lib/glibUtils/fileLogger.c b/lib/glibUtils/fileLogger.c +--- a/lib/glibUtils/fileLogger.c 2015-11-24 07:59:42.000000000 +0100 ++++ b/lib/glibUtils/fileLogger.c 2016-01-15 10:22:59.976153011 +0100 +@@ -44,7 +44,7 @@ + guint maxFiles; + gboolean append; + gboolean error; +- GStaticMutex lock; ++ GMutex lock; + } FileLogger; + + +@@ -327,7 +327,7 @@ + FileLogger *logger = data; + gsize written; + +- g_static_mutex_lock(&logger->lock); ++ g_mutex_lock(&logger->lock); + + if (logger->error) { + goto exit; +@@ -366,7 +366,7 @@ + } + + exit: +- g_static_mutex_unlock(&logger->lock); ++ g_mutex_unlock(&logger->lock); + } + + +@@ -388,7 +388,7 @@ + if (logger->file != NULL) { + g_io_channel_unref(logger->file); + } +- g_static_mutex_free(&logger->lock); ++ g_mutex_free(&logger->lock); + g_free(logger->path); + g_free(logger); + } +@@ -435,7 +435,7 @@ + data->append = append; + data->maxSize = maxSize * 1024 * 1024; + data->maxFiles = maxFiles + 1; /* To account for the active log file. */ +- g_static_mutex_init(&data->lock); ++ g_mutex_init(&data->lock); + + return &data->handler; + } +diff -Naur a/lib/glibUtils/stdLogger.c b/lib/glibUtils/stdLogger.c +--- a/lib/glibUtils/stdLogger.c 2015-11-24 07:59:42.000000000 +0100 ++++ b/lib/glibUtils/stdLogger.c 2016-01-15 10:24:07.078256206 +0100 +@@ -66,12 +66,12 @@ + StdLogger *sdata = data; + + if (!sdata->attached) { +- g_static_mutex_lock(&gConsoleLock); ++ g_mutex_lock(&gConsoleLock); + if (gRefCount != 0 || GlibUtils_AttachConsole()) { + gRefCount++; + sdata->attached = TRUE; + } +- g_static_mutex_unlock(&gConsoleLock); ++ g_mutex_unlock(&gConsoleLock); + } + + if (!sdata->attached) { +@@ -105,11 +105,11 @@ + { + #if defined(_WIN32) + StdLogger *sdata = data; +- g_static_mutex_lock(&gConsoleLock); ++ g_mutex_lock(&gConsoleLock); + if (sdata->attached && --gRefCount == 0) { + FreeConsole(); + } +- g_static_mutex_unlock(&gConsoleLock); ++ g_mutex_unlock(&gConsoleLock); + #endif + g_free(data); + } +diff -Naur a/lib/glibUtils/sysLogger.c b/lib/glibUtils/sysLogger.c +--- a/lib/glibUtils/sysLogger.c 2015-11-24 07:59:42.000000000 +0100 ++++ b/lib/glibUtils/sysLogger.c 2016-01-15 10:37:53.148968674 +0100 +@@ -38,7 +38,7 @@ + + + static SysLogger *gSysLogger; +-static GStaticMutex gSysLoggerLock = G_STATIC_MUTEX_INIT; ++static GMutex gSysLoggerLock; + + + /* +@@ -105,7 +105,7 @@ + { + g_return_if_fail(data == gSysLogger); + g_return_if_fail(gSysLogger->refcount > 0); +- g_static_mutex_lock(&gSysLoggerLock); ++ g_mutex_lock(&gSysLoggerLock); + gSysLogger->refcount -= 1; + if (gSysLogger->refcount == 0) { + closelog(); +@@ -113,7 +113,7 @@ + g_free(gSysLogger); + gSysLogger = NULL; + } +- g_static_mutex_unlock(&gSysLoggerLock); ++ g_mutex_unlock(&gSysLoggerLock); + } + + +@@ -140,7 +140,7 @@ + GlibUtils_CreateSysLogger(const char *domain, + const char *facility) + { +- g_static_mutex_lock(&gSysLoggerLock); ++ g_mutex_lock(&gSysLoggerLock); + if (gSysLogger == NULL) { + int facid = LOG_USER; + +@@ -203,7 +203,7 @@ + } else { + gSysLogger->refcount += 1; + } +- g_static_mutex_unlock(&gSysLoggerLock); ++ g_mutex_unlock(&gSysLoggerLock); + return &gSysLogger->handler; + } + +diff -Naur a/lib/rpcChannel/rpcChannelInt.h b/lib/rpcChannel/rpcChannelInt.h +--- a/lib/rpcChannel/rpcChannelInt.h 2015-11-24 07:59:42.000000000 +0100 ++++ b/lib/rpcChannel/rpcChannelInt.h 2016-01-15 11:30:31.403376775 +0100 +@@ -53,7 +53,7 @@ + GMainContext *mainCtx; + const char *appName; + gpointer appCtx; +- GStaticMutex outLock; ++ GMutex outLock; + struct RpcIn *in; + gboolean inStarted; + gboolean outStarted; +diff -Naur a/libvmtools/vmtoolsLog.c b/libvmtools/vmtoolsLog.c +--- a/libvmtools/vmtoolsLog.c 2015-11-24 07:59:42.000000000 +0100 ++++ b/libvmtools/vmtoolsLog.c 2016-01-15 11:34:45.221864504 +0100 +@@ -160,7 +160,7 @@ + static LogHandler *gErrorSyslog; + static GPtrArray *gDomains = NULL; + static gboolean gLogInitialized = FALSE; +-static GStaticRecMutex gLogStateMutex = G_STATIC_REC_MUTEX_INIT; ++static GRecMutex gLogStateMutex; + static gboolean gLoggingStopped = FALSE; + static gboolean gLogIOSuspended = FALSE; + +@@ -1055,7 +1055,7 @@ + gLogEnabled |= force; + if (!gLogInitialized) { + gLogInitialized = TRUE; +- g_static_rec_mutex_init(&gLogStateMutex); ++ g_rec_mutex_init(&gLogStateMutex); + } + + gMaxCacheEntries = g_key_file_get_integer(cfg, LOGGING_GROUP, +@@ -1221,7 +1221,7 @@ + void + VMTools_AcquireLogStateLock(void) + { +- g_static_rec_mutex_lock(&gLogStateMutex); ++ g_rec_mutex_lock(&gLogStateMutex); + } + + +@@ -1232,7 +1232,7 @@ + void + VMTools_ReleaseLogStateLock(void) + { +- g_static_rec_mutex_unlock(&gLogStateMutex); ++ g_rec_mutex_unlock(&gLogStateMutex); + } + + +diff -Naur a/libvmtools/i18n.c b/libvmtools/i18n.c +--- a/libvmtools/i18n.c 2015-11-24 07:59:42.000000000 +0100 ++++ b/libvmtools/i18n.c 2016-01-15 11:37:18.900142179 +0100 +@@ -54,7 +54,7 @@ + + typedef struct MsgState { + HashTable *domains; /* List of text domains. */ +- GStaticMutex lock; /* Mutex to protect shared state. */ ++ GMutex lock; /* Mutex to protect shared state. */ + } MsgState; + + +@@ -132,7 +132,7 @@ + { + ASSERT(gMsgState == NULL); + gMsgState = g_new0(MsgState, 1); +- g_static_mutex_init(&gMsgState->lock); ++ g_mutex_init(&gMsgState->lock); + return NULL; + } + +@@ -343,7 +343,7 @@ + * This lock is pretty coarse-grained, but a lot of the code below just runs + * in exceptional situations, so it should be OK. + */ +- g_static_mutex_lock(&state->lock); ++ g_mutex_lock(&state->lock); + + catalog = MsgGetCatalog(domain); + if (catalog != NULL) { +@@ -414,7 +414,7 @@ + } + } + +- g_static_mutex_unlock(&state->lock); ++ g_mutex_unlock(&state->lock); + + return strp; + } +@@ -681,7 +681,7 @@ + if (gMsgState->domains != NULL) { + HashTable_Free(gMsgState->domains); + } +- g_static_mutex_free(&gMsgState->lock); ++ g_mutex_free(&gMsgState->lock); + g_free(gMsgState); + } + } +@@ -774,9 +774,9 @@ + "catalog dir '%s'.\n", domain, lang, catdir); + } + } else { +- g_static_mutex_lock(&state->lock); ++ g_mutex_lock(&state->lock); + MsgSetCatalog(domain, catalog); +- g_static_mutex_unlock(&state->lock); ++ g_mutex_unlock(&state->lock); + } + g_free(file); + free(dfltdir); +diff -Naur a/lib/rpcChannel/rpcChannel.c b/lib/rpcChannel/rpcChannel.c +--- a/lib/rpcChannel/rpcChannel.c 2015-11-24 07:59:42.000000000 +0100 ++++ b/lib/rpcChannel/rpcChannel.c 2016-01-15 11:46:08.061147289 +0100 +@@ -675,7 +675,7 @@ + chan = BackdoorChannel_New(); + #endif + if (chan) { +- g_static_mutex_init(&chan->outLock); ++ g_mutex_init(&chan->outLock); + } + return chan; + } +@@ -691,7 +691,7 @@ + RpcChannel_Shutdown(RpcChannel *chan) + { + if (chan != NULL) { +- g_static_mutex_free(&chan->outLock); ++ g_mutex_free(&chan->outLock); + } + + if (chan != NULL && chan->funcs != NULL && chan->funcs->shutdown != NULL) { +@@ -776,7 +776,7 @@ + g_return_if_fail(chan->funcs != NULL); + g_return_if_fail(chan->funcs->stop != NULL); + +- g_static_mutex_lock(&chan->outLock); ++ g_mutex_lock(&chan->outLock); + chan->funcs->stop(chan); + + if (chan->in != NULL) { +@@ -787,7 +787,7 @@ + } else { + ASSERT(!chan->inStarted); + } +- g_static_mutex_unlock(&chan->outLock); ++ g_mutex_unlock(&chan->outLock); + } + + +@@ -853,7 +853,7 @@ + + ASSERT(chan && chan->funcs); + +- g_static_mutex_lock(&chan->outLock); ++ g_mutex_lock(&chan->outLock); + + funcs = chan->funcs; + ASSERT(funcs->send); +@@ -902,7 +902,7 @@ + } + + exit: +- g_static_mutex_unlock(&chan->outLock); ++ g_mutex_unlock(&chan->outLock); + return ok; + } + +diff -Naur a/lib/rpcChannel/rpcChannel.c.save b/lib/rpcChannel/rpcChannel.c.save +--- a/lib/rpcChannel/rpcChannel.c.save 1970-01-01 01:00:00.000000000 +0100 ++++ b/lib/rpcChannel/rpcChannel.c.save 2016-01-15 11:44:57.245012048 +0100 +@@ -0,0 +1,1049 @@ ++/********************************************************* ++ * Copyright (C) 2008-2015 VMware, Inc. All rights reserved. ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU Lesser General Public License as published ++ * by the Free Software Foundation version 2.1 and no later version. ++ * ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ++ * or FITNESS FOR A PARTICULAR PURPOSE. See the Lesser GNU General Public ++ * License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public License ++ * along with this program; if not, write to the Free Software Foundation, Inc., ++ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. ++ * ++ *********************************************************/ ++ ++/** ++ * @file rpcChannel.c ++ * ++ * Common functions to all RPC channel implementations. ++ */ ++ ++#include <string.h> ++#include "vm_assert.h" ++#include "dynxdr.h" ++#include "rpcChannelInt.h" ++#include "str.h" ++#include "strutil.h" ++#include "vmxrpc.h" ++#include "xdrutil.h" ++#include "rpcin.h" ++#include "debug.h" ++ ++/** Internal state of a channel. */ ++typedef struct RpcChannelInt { ++ RpcChannel impl; ++ gchar *appName; ++ GHashTable *rpcs; ++ GMainContext *mainCtx; ++ GSource *resetCheck; ++ gpointer appCtx; ++ RpcChannelCallback resetReg; ++ RpcChannelResetCb resetCb; ++ gpointer resetData; ++ gboolean rpcError; ++ guint rpcErrorCount; ++} RpcChannelInt; ++ ++/** Max number of times to attempt a channel restart. */ ++#define RPCIN_MAX_RESTARTS 60 ++ ++#define LGPFX "RpcChannel: " ++ ++static gboolean ++RpcChannelPing(RpcInData *data); ++ ++static RpcChannelCallback gRpcHandlers[] = { ++ { "ping", RpcChannelPing, NULL, NULL, NULL, 0 } ++}; ++ ++static gboolean gUseBackdoorOnly = FALSE; ++ ++/* ++ * Track the vSocket connection failure, so that we can ++ * avoid using vSockets until a channel reset/restart or ++ * the service itself gets restarted. ++ */ ++static gboolean gVSocketFailed = FALSE; ++ ++/** ++ * Handler for a "ping" message. Does nothing. ++ * ++ * @param[in] data The RPC data. ++ * ++ * @return TRUE. ++ */ ++ ++static gboolean ++RpcChannelPing(RpcInData *data) ++{ ++ return RPCIN_SETRETVALS(data, "", TRUE); ++} ++ ++ ++/** ++ * Callback for restarting the RPC channel. ++ * ++ * @param[in] _chan The RPC channel ++ * ++ * @return FALSE ++ */ ++ ++static gboolean ++RpcChannelRestart(gpointer _chan) ++{ ++ RpcChannelInt *chan = _chan; ++ ++ RpcChannel_Stop(&chan->impl); ++ /* Clear vSocket channel failure */ ++ Debug(LGPFX "Clearing backdoor behavior ...\n"); ++ gVSocketFailed = FALSE; ++ ++ if (!RpcChannel_Start(&chan->impl)) { ++ Warning("Channel restart failed [%d]\n", chan->rpcErrorCount); ++ if (chan->resetCb != NULL) { ++ chan->resetCb(&chan->impl, FALSE, chan->resetData); ++ } ++ } else { ++ chan->rpcError = FALSE; ++ } ++ ++ return FALSE; ++} ++ ++ ++/** ++ * Checks and potentially resets the RPC channel. This code is based on the ++ * toolsDaemon.c function "ToolsDaemon_CheckReset". ++ * ++ * @param[in] _chan The RPC channel. ++ * ++ * @return FALSE. The reset callback will schedule a new check when it's called. ++ */ ++ ++static gboolean ++RpcChannelCheckReset(gpointer _chan) ++{ ++ static int channelTimeoutAttempts = RPCIN_MAX_RESTARTS; ++ RpcChannelInt *chan = _chan; ++ ++ /* Check the channel state. */ ++ if (chan->rpcError) { ++ GSource *src; ++ ++ if (++(chan->rpcErrorCount) > channelTimeoutAttempts) { ++ Warning("Failed to reset channel after %u attempts\n", ++ chan->rpcErrorCount - 1); ++ if (chan->resetCb != NULL) { ++ chan->resetCb(&chan->impl, FALSE, chan->resetData); ++ } ++ goto exit; ++ } ++ ++ /* Schedule the channel restart for 1 sec in the future. */ ++ Debug(LGPFX "Resetting channel [%u]\n", chan->rpcErrorCount); ++ src = g_timeout_source_new(1000); ++ g_source_set_callback(src, RpcChannelRestart, chan, NULL); ++ g_source_attach(src, chan->mainCtx); ++ g_source_unref(src); ++ goto exit; ++ } ++ ++ /* Reset was successful. */ ++ Debug(LGPFX "Channel was reset successfully.\n"); ++ chan->rpcErrorCount = 0; ++ Debug(LGPFX "Clearing backdoor behavior ...\n"); ++ gVSocketFailed = FALSE; ++ ++ if (chan->resetCb != NULL) { ++ chan->resetCb(&chan->impl, TRUE, chan->resetData); ++ } ++ ++exit: ++ g_source_unref(chan->resetCheck); ++ chan->resetCheck = NULL; ++ return FALSE; ++} ++ ++ ++/** ++ * Handles an RPC reset. Calls the reset callback of all loaded plugins. ++ * ++ * @param[in] data The RPC data. ++ * ++ * @return TRUE. ++ */ ++ ++static gboolean ++RpcChannelReset(RpcInData *data) ++{ ++ gchar *msg; ++ RpcChannelInt *chan = data->clientData; ++ ++ if (chan->resetCheck == NULL) { ++ chan->resetCheck = g_idle_source_new(); ++ g_source_set_priority(chan->resetCheck, G_PRIORITY_HIGH); ++ g_source_set_callback(chan->resetCheck, RpcChannelCheckReset, chan, NULL); ++ g_source_attach(chan->resetCheck, chan->mainCtx); ++ } ++ ++ msg = Str_Asprintf(NULL, "ATR %s", chan->appName); ++ ASSERT_MEM_ALLOC(msg); ++ return RPCIN_SETRETVALSF(data, msg, TRUE); ++} ++ ++ ++/** ++ * A wrapper for standard RPC callback functions which provides automatic ++ * XDR serialization / deserialization if requested by the application. ++ * ++ * @param[in] data RpcIn data. ++ * @param[in] rpc The RPC registration data. ++ * ++ * @return Whether the RPC was handled successfully. ++ */ ++ ++static Bool ++RpcChannelXdrWrapper(RpcInData *data, ++ RpcChannelCallback *rpc) ++{ ++ Bool ret; ++ RpcInData copy; ++ void *xdrData = NULL; ++ ++ if (rpc->xdrIn != NULL) { ++ xdrData = malloc(rpc->xdrInSize); ++ if (xdrData == NULL) { ++ ret = RPCIN_SETRETVALS(data, "Out of memory.", FALSE); ++ goto exit; ++ } ++ ++ memset(xdrData, 0, rpc->xdrInSize); ++ if (!XdrUtil_Deserialize(data->args + 1, data->argsSize - 1, ++ rpc->xdrIn, xdrData)) { ++ ret = RPCIN_SETRETVALS(data, "XDR deserialization failed.", FALSE); ++ free(xdrData); ++ goto exit; ++ } ++ ++ copy.name = data->name; ++ copy.args = xdrData; ++ copy.argsSize = rpc->xdrInSize; ++ copy.result = data->result; ++ copy.resultLen = data->resultLen; ++ copy.freeResult = data->freeResult; ++ copy.appCtx = data->appCtx; ++ copy.clientData = rpc->clientData; ++ } else { ++ memcpy(&copy, data, sizeof copy); ++ } ++ ++ ret = rpc->callback(&copy); ++ ++ if (rpc->xdrIn != NULL) { ++ VMX_XDR_FREE(rpc->xdrIn, xdrData); ++ free(xdrData); ++ copy.args = NULL; ++ data->result = copy.result; ++ data->resultLen = copy.resultLen; ++ data->freeResult = copy.freeResult; ++ } ++ ++ if (rpc->xdrOut != NULL && copy.result != NULL) { ++ XDR xdrs; ++ xdrproc_t xdrProc = rpc->xdrOut; ++ ++ if (DynXdr_Create(&xdrs) == NULL) { ++ ret = RPCIN_SETRETVALS(data, "Out of memory.", FALSE); ++ goto exit; ++ } ++ ++ if (!xdrProc(&xdrs, copy.result)) { ++ ret = RPCIN_SETRETVALS(data, "XDR serialization failed.", FALSE); ++ DynXdr_Destroy(&xdrs, TRUE); ++ goto exit; ++ } ++ ++ if (copy.freeResult) { ++ VMX_XDR_FREE(rpc->xdrOut, copy.result); ++ } ++ data->result = DynXdr_Get(&xdrs); ++ data->resultLen = XDR_GETPOS(&xdrs); ++ data->freeResult = TRUE; ++ DynXdr_Destroy(&xdrs, FALSE); ++ } ++ ++exit: ++ if (copy.freeResult && copy.result != NULL) { ++ g_free(copy.result); ++ } ++ return ret; ++} ++ ++ ++/** ++ * Builds an "rpcout" command to send a XDR struct. ++ * ++ * @param[in] cmd The command name. ++ * @param[in] xdrProc Function to use for serializing the XDR struct. ++ * @param[in] xdrData The XDR struct to serialize. ++ * @param[out] result Where to store the serialized data. ++ * @param[out] resultLen Where to store the serialized data length. ++ * ++ * @return Whether successfully built the command. ++ */ ++ ++gboolean ++RpcChannel_BuildXdrCommand(const char *cmd, ++ void *xdrProc, ++ void *xdrData, ++ char **result, ++ size_t *resultLen) ++{ ++ Bool ret = FALSE; ++ xdrproc_t proc = xdrProc; ++ XDR xdrs; ++ ++ if (DynXdr_Create(&xdrs) == NULL) { ++ return FALSE; ++ } ++ ++ if (!DynXdr_AppendRaw(&xdrs, cmd, strlen(cmd))) { ++ goto exit; ++ } ++ ++ if (!DynXdr_AppendRaw(&xdrs, " ", 1)) { ++ goto exit; ++ } ++ ++ if (!proc(&xdrs, xdrData)) { ++ goto exit; ++ } ++ ++ *result = DynXdr_Get(&xdrs); ++ *resultLen = xdr_getpos(&xdrs); ++ ++ ret = TRUE; ++ ++exit: ++ DynXdr_Destroy(&xdrs, !ret); ++ return ret; ++} ++ ++ ++/** ++ * Creates a new RpcChannel without any implementation. ++ * ++ * This is mainly for use of code that is implementing a custom RpcChannel. ++ * Such implementations should provide their own "constructor"-type function ++ * which should then call this function to get an RpcChannel instance. They ++ * should then fill in the function pointers that provide the implementation ++ * for the channel before making the channel available to the callers. ++ * ++ * @return A new RpcChannel instance. ++ */ ++ ++RpcChannel * ++RpcChannel_Create(void) ++{ ++ RpcChannelInt *chan = g_new0(RpcChannelInt, 1); ++ return &chan->impl; ++} ++ ++ ++/** ++ * Dispatches the given RPC to the registered handler. This mimics the behavior ++ * of the RpcIn library (but is not tied to that particular implementation of ++ * an RPC channel). ++ * ++ * @param[in,out] data The RPC data. ++ * ++ * @return Whether the RPC was handled successfully. ++ */ ++ ++gboolean ++RpcChannel_Dispatch(RpcInData *data) ++{ ++ char *name = NULL; ++ unsigned int index = 0; ++ size_t nameLen; ++ Bool status; ++ RpcChannelCallback *rpc = NULL; ++ RpcChannelInt *chan = data->clientData; ++ ++ name = StrUtil_GetNextToken(&index, data->args, " "); ++ if (name == NULL) { ++ Debug(LGPFX "Bad command (null) received.\n"); ++ status = RPCIN_SETRETVALS(data, "Bad command", FALSE); ++ goto exit; ++ } ++ ++ if (chan->rpcs != NULL) { ++ rpc = g_hash_table_lookup(chan->rpcs, name); ++ } ++ ++ if (rpc == NULL) { ++ Debug(LGPFX "Unknown Command '%s': Handler not registered.\n", name); ++ status = RPCIN_SETRETVALS(data, "Unknown Command", FALSE); ++ goto exit; ++ } ++ ++ /* Adjust the RPC arguments. */ ++ nameLen = strlen(name); ++ data->name = name; ++ data->args = data->args + nameLen; ++ data->argsSize -= nameLen; ++ data->appCtx = chan->appCtx; ++ data->clientData = rpc->clientData; ++ ++ if (rpc->xdrIn != NULL || rpc->xdrOut != NULL) { ++ status = RpcChannelXdrWrapper(data, rpc); ++ } else { ++ status = rpc->callback(data); ++ } ++ ++ ASSERT(data->result != NULL); ++ ++exit: ++ data->name = NULL; ++ free(name); ++ return status; ++} ++ ++ ++/** ++ * Shuts down an RPC channel and release any held resources. ++ * ++ * @param[in] chan The RPC channel. ++ * ++ * @return Whether the channel was shut down successfully. ++ */ ++ ++gboolean ++RpcChannel_Destroy(RpcChannel *chan) ++{ ++ size_t i; ++ RpcChannelInt *cdata = (RpcChannelInt *) chan; ++ ++ if (cdata->impl.funcs != NULL && cdata->impl.funcs->shutdown != NULL) { ++ cdata->impl.funcs->shutdown(chan); ++ } ++ ++ RpcChannel_UnregisterCallback(chan, &cdata->resetReg); ++ for (i = 0; i < ARRAYSIZE(gRpcHandlers); i++) { ++ RpcChannel_UnregisterCallback(chan, &gRpcHandlers[i]); ++ } ++ ++ if (cdata->rpcs != NULL) { ++ g_hash_table_destroy(cdata->rpcs); ++ cdata->rpcs = NULL; ++ } ++ ++ cdata->resetCb = NULL; ++ cdata->resetData = NULL; ++ cdata->appCtx = NULL; ++ ++ g_free(cdata->appName); ++ cdata->appName = NULL; ++ ++ if (cdata->mainCtx != NULL) { ++ g_main_context_unref(cdata->mainCtx); ++ cdata->mainCtx = NULL; ++ } ++ ++ if (cdata->resetCheck != NULL) { ++ g_source_destroy(cdata->resetCheck); ++ cdata->resetCheck = NULL; ++ } ++ ++ g_free(cdata); ++ return TRUE; ++} ++ ++ ++/** ++ * Error handling function for the RPC channel. Enqueues the "check reset" ++ * function for running later, if it's not yet enqueued. ++ * ++ * @param[in] _chan The RPC channel. ++ * @param[in] status Error description. ++ */ ++ ++void ++RpcChannel_Error(void *_chan, ++ char const *status) ++{ ++ RpcChannelInt *chan = _chan; ++ chan->rpcError = TRUE; ++ /* ++ * XXX: Workaround for PR 935520. ++ * Revert the log call to Warning() after fixing PR 955746. ++ */ ++ Debug(LGPFX "Error in the RPC receive loop: %s.\n", status); ++ ++ if (chan->resetCheck == NULL) { ++ chan->resetCheck = g_idle_source_new(); ++ g_source_set_callback(chan->resetCheck, RpcChannelCheckReset, chan, NULL); ++ g_source_attach(chan->resetCheck, chan->mainCtx); ++ } ++} ++ ++ ++/** ++ * Initializes the RPC channel for inbound operations. ++ * ++ * This function must be called before starting the channel if the application ++ * wants to receive messages on the channel. Applications don't need to call it ++ * if only using the outbound functionality. ++ * ++ * @param[in] chan The RPC channel. ++ * @param[in] appName TCLO application name. ++ * @param[in] mainCtx Application event context. ++ * @param[in] appCtx Application context. ++ * @param[in] resetCb Callback for when a reset occurs. ++ * @param[in] resetData Client data for the reset callback. ++ */ ++ ++void ++RpcChannel_Setup(RpcChannel *chan, ++ const gchar *appName, ++ GMainContext *mainCtx, ++ gpointer appCtx, ++ RpcChannelResetCb resetCb, ++ gpointer resetData) ++{ ++ size_t i; ++ RpcChannelInt *cdata = (RpcChannelInt *) chan; ++ ++ cdata->appName = g_strdup(appName); ++ cdata->appCtx = appCtx; ++ cdata->mainCtx = g_main_context_ref(mainCtx); ++ cdata->resetCb = resetCb; ++ cdata->resetData = resetData; ++ ++ cdata->resetReg.name = "reset"; ++ cdata->resetReg.callback = RpcChannelReset; ++ cdata->resetReg.clientData = chan; ++ ++ /* Register the callbacks handled by the rpcChannel library. */ ++ RpcChannel_RegisterCallback(chan, &cdata->resetReg); ++ ++ for (i = 0; i < ARRAYSIZE(gRpcHandlers); i++) { ++ RpcChannel_RegisterCallback(chan, &gRpcHandlers[i]); ++ } ++ ++ if (chan->funcs != NULL && chan->funcs->setup != NULL) { ++ chan->funcs->setup(chan, mainCtx, appName, appCtx); ++ } else { ++ chan->mainCtx = g_main_context_ref(mainCtx); ++ chan->in = RpcIn_Construct(mainCtx, RpcChannel_Dispatch, chan); ++ ASSERT(chan->in != NULL); ++ } ++} ++ ++ ++/** ++ * Sets the non-freeable result of the given RPC context to the given value. ++ * The result should be a NULL-terminated string. ++ * ++ * @param[in] data RPC context. ++ * @param[in] result Result string. ++ * @param[in] retVal Return value of this function. ++ * ++ * @return @a retVal ++ */ ++ ++gboolean ++RpcChannel_SetRetVals(RpcInData *data, ++ char const *result, ++ gboolean retVal) ++{ ++ ASSERT(data); ++ ++ /* This cast is safe: data->result will not be freed. */ ++ data->result = (char *)result; ++ data->resultLen = strlen(data->result); ++ data->freeResult = FALSE; ++ ++ return retVal; ++} ++ ++ ++/** ++ * Sets the freeable result of the given RPC context to the given value. ++ * The result should be a NULL-terminated string. ++ * ++ * @param[in] data RPC context. ++ * @param[in] result Result string. ++ * @param[in] retVal Return value of this function. ++ * ++ * @return @a retVal ++ */ ++ ++gboolean ++RpcChannel_SetRetValsF(RpcInData *data, ++ char *result, ++ gboolean retVal) ++{ ++ ASSERT(data); ++ ++ data->result = result; ++ data->resultLen = strlen(data->result); ++ data->freeResult = TRUE; ++ ++ return retVal; ++} ++ ++ ++/** ++ * Registers a new RPC handler in the given RPC channel. This function is ++ * not thread-safe. ++ * ++ * @param[in] chan The channel instance. ++ * @param[in] rpc Info about the RPC being registered. ++ */ ++ ++void ++RpcChannel_RegisterCallback(RpcChannel *chan, ++ RpcChannelCallback *rpc) ++{ ++ RpcChannelInt *cdata = (RpcChannelInt *) chan; ++ ASSERT(rpc->name != NULL && strlen(rpc->name) > 0); ++ ASSERT(rpc->callback); ++ ASSERT(rpc->xdrIn == NULL || rpc->xdrInSize > 0); ++ if (cdata->rpcs == NULL) { ++ cdata->rpcs = g_hash_table_new(g_str_hash, g_str_equal); ++ } ++ if (g_hash_table_lookup(cdata->rpcs, rpc->name) != NULL) { ++ Panic("Trying to overwrite existing RPC registration for %s!\n", rpc->name); ++ } ++ g_hash_table_insert(cdata->rpcs, (gpointer) rpc->name, rpc); ++} ++ ++ ++/** ++ * Unregisters a new RPC handler from the given RPC channel. This function is ++ * not thread-safe. ++ * ++ * @param[in] chan The channel instance. ++ * @param[in] rpc Info about the RPC being unregistered. ++ */ ++ ++void ++RpcChannel_UnregisterCallback(RpcChannel *chan, ++ RpcChannelCallback *rpc) ++{ ++ RpcChannelInt *cdata = (RpcChannelInt *) chan; ++ if (cdata->rpcs != NULL) { ++ g_hash_table_remove(cdata->rpcs, rpc->name); ++ } ++} ++ ++ ++/** ++ * Force to create backdoor channels only. ++ * This provides a kill-switch to disable vsocket channels if needed. ++ * This needs to be called before RpcChannel_New to take effect. ++ */ ++ ++void ++RpcChannel_SetBackdoorOnly(void) ++{ ++ gUseBackdoorOnly = TRUE; ++ Debug(LGPFX "Using vsocket is disabled.\n"); ++} ++ ++ ++/** ++ * Create an RpcChannel instance using a prefered channel implementation, ++ * currently this is VSockChannel. ++ * ++ * @return RpcChannel ++ */ ++ ++RpcChannel * ++RpcChannel_New(void) ++{ ++ RpcChannel *chan; ++#if (defined(__linux__) && !defined(USERWORLD)) || defined(_WIN32) ++ chan = (gUseBackdoorOnly || gVSocketFailed) ? ++ BackdoorChannel_New() : VSockChannel_New(); ++#else ++ chan = BackdoorChannel_New(); ++#endif ++ if (chan) { ++ g_mutex_init(&chan->outLock); ++ } ++ return chan; ++} ++ ++ ++/** ++ * Wrapper for the shutdown function of an RPC channel struct. ++ * ++ * @param[in] chan The RPC channel instance. ++ */ ++ ++void ++RpcChannel_Shutdown(RpcChannel *chan) ++{ ++ if (chan != NULL) { ++ g_static_mutex_free(&chan->outLock); ++ } ++ ++ if (chan != NULL && chan->funcs != NULL && chan->funcs->shutdown != NULL) { ++ if (chan->in != NULL) { ++ if (chan->inStarted) { ++ RpcIn_stop(chan->in); ++ } ++ chan->inStarted = FALSE; ++ RpcIn_Destruct(chan->in); ++ chan->in = NULL; ++ } else { ++ ASSERT(!chan->inStarted); ++ } ++ ++ if (chan->mainCtx != NULL) { ++ g_main_context_unref(chan->mainCtx); ++ } ++ chan->funcs->shutdown(chan); ++ } ++} ++ ++ ++/** ++ * Start an RPC channel. We may fallback to backdoor channel when other type ++ * of channel fails to start. ++ * ++ * @param[in] chan The RPC channel instance. ++ * ++ * @return TRUE on success. ++ */ ++ ++gboolean ++RpcChannel_Start(RpcChannel *chan) ++{ ++ gboolean ok; ++ const RpcChannelFuncs *funcs; ++ ++ if (chan == NULL || chan->funcs == NULL || chan->funcs->start == NULL) { ++ return FALSE; ++ } ++ ++ if (chan->outStarted) { ++ /* Already started. Make sure both channels are in sync and return. */ ++ ASSERT(chan->in == NULL || chan->inStarted); ++ return TRUE; ++ } ++ ++ if (chan->in != NULL && !chan->inStarted) { ++ ok = RpcIn_start(chan->in, RPCIN_MAX_DELAY, RpcChannel_Error, chan); ++ chan->inStarted = ok; ++ } ++ ++ funcs = chan->funcs; ++ ok = funcs->start(chan); ++ ++ if (!ok && funcs->onStartErr != NULL) { ++ Debug(LGPFX "Fallback to backdoor ...\n"); ++ funcs->onStartErr(chan); ++ ok = BackdoorChannel_Fallback(chan); ++ /* ++ * As vSocket is not available, we stick the backdoor ++ * behavior until the channel is reset/restarted. ++ */ ++ Debug(LGPFX "Sticking backdoor behavior ...\n"); ++ gVSocketFailed = TRUE; ++ } ++ ++ return ok; ++} ++ ++ ++/** ++ * Wrapper for the stop function of an RPC channel struct. ++ * ++ * @param[in] chan The RPC channel instance. ++ */ ++ ++void ++RpcChannel_Stop(RpcChannel *chan) ++{ ++ g_return_if_fail(chan != NULL); ++ g_return_if_fail(chan->funcs != NULL); ++ g_return_if_fail(chan->funcs->stop != NULL); ++ ++ g_static_mutex_lock(&chan->outLock); ++ chan->funcs->stop(chan); ++ ++ if (chan->in != NULL) { ++ if (chan->inStarted) { ++ RpcIn_stop(chan->in); ++ } ++ chan->inStarted = FALSE; ++ } else { ++ ASSERT(!chan->inStarted); ++ } ++ g_static_mutex_unlock(&chan->outLock); ++} ++ ++ ++/** ++ * Wrapper for get channel type function of an RPC channel struct. ++ * ++ * @param[in] chan The RPC channel instance. ++ */ ++ ++RpcChannelType ++RpcChannel_GetType(RpcChannel *chan) ++{ ++ if (chan == NULL || chan->funcs == NULL || chan->funcs->getType == NULL) { ++ return RPCCHANNEL_TYPE_INACTIVE; ++ } ++ return chan->funcs->getType(chan); ++} ++ ++ ++/** ++ * Free the allocated memory for the results from RpcChannel_Send* calls. ++ * ++ * @param[in] ptr result from RpcChannel_Send* calls. ++ * ++ * @return none ++ */ ++ ++void ++RpcChannel_Free(void *ptr) ++{ ++ free(ptr); ++} ++ ++ ++/** ++ * Send function of an RPC channel struct. Retry once if it fails for ++ * non-backdoor Channels. Backdoor channel already tries inside. A second try ++ * may create a different type of channel. ++ * ++ * @param[in] chan The RPC channel instance. ++ * @param[in] data Data to send. ++ * @param[in] dataLen Number of bytes to send. ++ * @param[out] result Response from other side (should be freed by ++ * calling RpcChannel_Free). ++ * @param[out] resultLen Number of bytes in response. ++ * ++ * @return The status from the remote end (TRUE if call was successful). ++ */ ++ ++gboolean ++RpcChannel_Send(RpcChannel *chan, ++ char const *data, ++ size_t dataLen, ++ char **result, ++ size_t *resultLen) ++{ ++ gboolean ok; ++ char *res = NULL; ++ size_t resLen = 0; ++ const RpcChannelFuncs *funcs; ++ ++ Debug(LGPFX "Sending: %"FMTSZ"u bytes\n", dataLen); ++ ++ ASSERT(chan && chan->funcs); ++ ++ g_static_mutex_lock(&chan->outLock); ++ ++ funcs = chan->funcs; ++ ASSERT(funcs->send); ++ ++ if (result != NULL) { ++ *result = NULL; ++ } ++ if (resultLen != NULL) { ++ *resultLen = 0; ++ } ++ ++ ok = funcs->send(chan, data, dataLen, &res, &resLen); ++ ++ if (!ok && (funcs->getType(chan) != RPCCHANNEL_TYPE_BKDOOR) && ++ (funcs->stopRpcOut != NULL)) { ++ ++ free(res); ++ res = NULL; ++ resLen = 0; ++ ++ /* retry once */ ++ Debug(LGPFX "Stop RpcOut channel and try to send again ...\n"); ++ funcs->stopRpcOut(chan); ++ if (RpcChannel_Start(chan)) { ++ /* The channel may get switched from vsocket to backdoor */ ++ funcs = chan->funcs; ++ ASSERT(funcs->send); ++ ok = funcs->send(chan, data, dataLen, &res, &resLen); ++ goto done; ++ } ++ ++ ok = FALSE; ++ goto exit; ++ } ++ ++done: ++ if (ok) { ++ Debug(LGPFX "Recved %"FMTSZ"u bytes\n", resLen); ++ } ++ ++ if (result != NULL) { ++ *result = res; ++ } ++ if (resultLen != NULL) { ++ *resultLen = resLen; ++ } ++ ++exit: ++ g_static_mutex_unlock(&chan->outLock); ++ return ok; ++} ++ ++ ++/** ++ * Open/close RpcChannel each time for sending a Rpc message, this is a wrapper ++ * for RpcChannel APIs. ++ * ++ * @param[in] data request data ++ * @param[in] dataLen data length ++ * @param[in] result reply, should be freed by calling RpcChannel_Free. ++ * @param[in] resultLen reply length ++ ++ * @returns TRUE on success. ++ */ ++ ++gboolean ++RpcChannel_SendOneRaw(const char *data, ++ size_t dataLen, ++ char **result, ++ size_t *resultLen) ++{ ++ RpcChannel *chan; ++ gboolean status; ++ ++ status = FALSE; ++ ++ chan = RpcChannel_New(); ++ if (chan == NULL) { ++ if (result != NULL) { ++ *result = Util_SafeStrdup("RpcChannel: Unable to create " ++ "the RpcChannel object"); ++ if (resultLen != NULL) { ++ *resultLen = strlen(*result); ++ } ++ } ++ goto sent; ++ } else if (!RpcChannel_Start(chan)) { ++ if (result != NULL) { ++ *result = Util_SafeStrdup("RpcChannel: Unable to open the " ++ "communication channel"); ++ if (resultLen != NULL) { ++ *resultLen = strlen(*result); ++ } ++ } ++ goto sent; ++ } else if (!RpcChannel_Send(chan, data, dataLen, result, resultLen)) { ++ /* We already have the description of the error */ ++ goto sent; ++ } ++ ++ status = TRUE; ++ ++sent: ++ Debug(LGPFX "Request %s: reqlen=%"FMTSZ"u, replyLen=%"FMTSZ"u\n", ++ status ? "OK" : "FAILED", dataLen, resultLen ? *resultLen : 0); ++ if (chan) { ++ RpcChannel_Stop(chan); ++ RpcChannel_Destroy(chan); ++ } ++ ++ return status; ++} ++ ++ ++/** ++ * Open/close RpcChannel each time for sending a Rpc message, this is a wrapper ++ * for RpcChannel APIs. ++ * ++ * @param[out] reply reply, should be freed by calling RpcChannel_Free. ++ * @param[out] repLen reply length ++ * @param[in] reqFmt request data ++ * @param[in] ... optional arguments depending on reqFmt. ++ ++ * @returns TRUE on success. ++ */ ++ ++gboolean ++RpcChannel_SendOne(char **reply, ++ size_t *repLen, ++ char const *reqFmt, ++ ...) ++{ ++ va_list args; ++ gboolean status; ++ char *request; ++ size_t reqLen = 0; ++ ++ status = FALSE; ++ ++ /* Format the request string */ ++ va_start(args, reqFmt); ++ request = Str_Vasprintf(&reqLen, reqFmt, args); ++ va_end(args); ++ ++ /* ++ * If Str_Vasprintf failed, write NULL into the reply if the caller wanted ++ * a reply back. ++ */ ++ if (request == NULL) { ++ goto error; ++ } ++ ++ /* ++ * If the command doesn't contain a space, add one to the end to maintain ++ * compatibility with old VMXs. ++ * ++ * For a long time, the GuestRpc logic in the VMX was wired to expect a ++ * trailing space in every command, even commands without arguments. That is ++ * no longer true, but we must continue to add a trailing space because we ++ * don't know whether we're talking to an old or new VMX. ++ */ ++ if (request[reqLen - 1] != ' ') { ++ char *tmp; ++ ++ tmp = Str_Asprintf(NULL, "%s ", request); ++ free(request); ++ request = tmp; ++ ++ /* ++ * If Str_Asprintf failed, write NULL into reply if the caller wanted ++ * a reply back. ++ */ ++ if (request == NULL) { ++ goto error; ++ } ++ } ++ ++ status = RpcChannel_SendOneRaw(request, reqLen, reply, repLen); ++ ++ free(request); ++ ++ return status; ++ ++error: ++ if (reply) { ++ *reply = NULL; ++ } ++ ++ if (repLen) { ++ *repLen = 0; ++ } ++ return FALSE; ++} +diff -Naur a/services/vmtoolsd/mainLoop.c b/services/vmtoolsd/mainLoop.c +--- a/services/vmtoolsd/mainLoop.c 2015-11-24 07:59:42.000000000 +0100 ++++ b/services/vmtoolsd/mainLoop.c 2016-01-15 11:52:19.332545573 +0100 +@@ -384,9 +384,7 @@ + GMainContext *gctx; + ToolsServiceProperty ctxProp = { TOOLS_CORE_PROP_CTX }; + +- if (!g_thread_supported()) { +- g_thread_init(NULL); +- } ++ g_thread_init(NULL); + + /* + * Useful for debugging purposes. Log the vesion and build information. +diff -Naur a/services/plugins/vmbackup/stateMachine.c b/services/plugins/vmbackup/stateMachine.c +--- a/services/plugins/vmbackup/stateMachine.c 2015-11-24 07:59:42.000000000 +0100 ++++ b/services/plugins/vmbackup/stateMachine.c 2016-01-15 11:58:56.387357439 +0100 +@@ -279,12 +279,12 @@ + g_source_unref(gBackupState->abortTimer); + } + +- g_static_mutex_lock(&gBackupState->opLock); ++ g_mutex_lock(&gBackupState->opLock); + if (gBackupState->currentOp != NULL) { + VmBackup_Cancel(gBackupState->currentOp); + VmBackup_Release(gBackupState->currentOp); + } +- g_static_mutex_unlock(&gBackupState->opLock); ++ g_mutex_unlock(&gBackupState->opLock); + + VmBackup_SendEvent(VMBACKUP_EVENT_REQUESTOR_DONE, VMBACKUP_SUCCESS, ""); + +@@ -299,7 +299,7 @@ + } + + gBackupState->provider->release(gBackupState->provider); +- g_static_mutex_free(&gBackupState->opLock); ++ g_mutex_free(&gBackupState->opLock); + g_free(gBackupState->scriptArg); + g_free(gBackupState->volumes); + g_free(gBackupState->snapshots); +@@ -418,13 +418,13 @@ + if (gBackupState->machineState != VMBACKUP_MSTATE_SCRIPT_ERROR && + gBackupState->machineState != VMBACKUP_MSTATE_SYNC_ERROR) { + /* Mark the current operation as cancelled. */ +- g_static_mutex_lock(&gBackupState->opLock); ++ g_mutex_lock(&gBackupState->opLock); + if (gBackupState->currentOp != NULL) { + VmBackup_Cancel(gBackupState->currentOp); + VmBackup_Release(gBackupState->currentOp); + gBackupState->currentOp = NULL; + } +- g_static_mutex_unlock(&gBackupState->opLock); ++ g_mutex_unlock(&gBackupState->opLock); + + VmBackup_SendEvent(VMBACKUP_EVENT_REQUESTOR_ABORT, + VMBACKUP_REMOTE_ABORT, +@@ -478,32 +478,32 @@ + g_source_unref(gBackupState->timerEvent); + gBackupState->timerEvent = NULL; + +- g_static_mutex_lock(&gBackupState->opLock); ++ g_mutex_lock(&gBackupState->opLock); + if (gBackupState->currentOp != NULL) { + g_debug("VmBackupAsyncCallback: checking %s\n", gBackupState->currentOpName); + status = VmBackup_QueryStatus(gBackupState->currentOp); + } +- g_static_mutex_unlock(&gBackupState->opLock); ++ g_mutex_unlock(&gBackupState->opLock); + + switch (status) { + case VMBACKUP_STATUS_PENDING: + goto exit; + + case VMBACKUP_STATUS_FINISHED: +- g_static_mutex_lock(&gBackupState->opLock); ++ g_mutex_lock(&gBackupState->opLock); + if (gBackupState->currentOpName != NULL) { + g_debug("Async request '%s' completed\n", gBackupState->currentOpName); + VmBackup_Release(gBackupState->currentOp); + gBackupState->currentOpName = NULL; + } + gBackupState->currentOp = NULL; +- g_static_mutex_unlock(&gBackupState->opLock); ++ g_mutex_unlock(&gBackupState->opLock); + break; + + default: + { + gchar *msg; +- g_static_mutex_lock(&gBackupState->opLock); ++ g_mutex_lock(&gBackupState->opLock); + if (gBackupState->errorMsg != NULL) { + msg = g_strdup_printf("'%s' operation failed: %s", + gBackupState->currentOpName, +@@ -519,7 +519,7 @@ + + VmBackup_Release(gBackupState->currentOp); + gBackupState->currentOp = NULL; +- g_static_mutex_unlock(&gBackupState->opLock); ++ g_mutex_unlock(&gBackupState->opLock); + VmBackupOnError(); + goto exit; + } +@@ -534,12 +534,12 @@ + gBackupState->callback = NULL; + + if (cb(gBackupState)) { +- g_static_mutex_lock(&gBackupState->opLock); ++ g_mutex_lock(&gBackupState->opLock); + if (gBackupState->currentOp != NULL || gBackupState->forceRequeue) { +- g_static_mutex_unlock(&gBackupState->opLock); ++ g_mutex_unlock(&gBackupState->opLock); + goto exit; + } +- g_static_mutex_unlock(&gBackupState->opLock); ++ g_mutex_unlock(&gBackupState->opLock); + } else { + VmBackupOnError(); + goto exit; +@@ -823,7 +823,7 @@ + gBackupState->freezeStatus = VMBACKUP_FREEZE_FINISHED; + gBackupState->provider = provider; + gBackupState->needsPriv = FALSE; +- g_static_mutex_init(&gBackupState->opLock); ++ g_mutex_init(&gBackupState->opLock); + gBackupState->enableNullDriver = VmBackupConfigGetBoolean(ctx->config, + "enableNullDriver", + TRUE); +diff -Naur a/services/plugins/vmbackup/vmBackupInt.h b/services/plugins/vmbackup/vmBackupInt.h +--- a/services/plugins/vmbackup/vmBackupInt.h 2015-11-24 07:59:42.000000000 +0100 ++++ b/services/plugins/vmbackup/vmBackupInt.h 2016-01-15 11:55:41.944020643 +0100 +@@ -98,7 +98,7 @@ + ToolsAppCtx *ctx; + VmBackupOp *currentOp; + const char *currentOpName; +- GStaticMutex opLock; // See note above ++ GMutex opLock; // See note above + char *volumes; + char *snapshots; + guint pollPeriod; +@@ -171,14 +171,14 @@ + ASSERT(state->currentOp == NULL); + ASSERT(currentOpName != NULL); + +- g_static_mutex_lock(&state->opLock); ++ g_mutex_lock(&state->opLock); + + state->currentOp = op; + state->callback = callback; + state->currentOpName = currentOpName; + state->forceRequeue = (callback != NULL && op == NULL); + +- g_static_mutex_unlock(&state->opLock); ++ g_mutex_unlock(&state->opLock); + + return (op != NULL); + } diff --git a/packages/sysutils/open-vm-tools/system.d/open-vm-tools.service b/packages/sysutils/open-vm-tools/system.d/open-vm-tools.service new file mode 100644 index 00000000000..7117805fe20 --- /dev/null +++ b/packages/sysutils/open-vm-tools/system.d/open-vm-tools.service @@ -0,0 +1,15 @@ +[Unit] +Description=OpenVMTools Server +After=xorg-server.service + +ConditionPathExists=/usr/bin/vmware-checkvm +ConditionPathExists=/usr/bin/vmtoolsd + +[Service] +Type=forking +PIDFile=/var/run/vmtoolsd.pid +ExecStart=-/bin/sh -c '/usr/bin/vmware-checkvm && /usr/bin/vmtoolsd --background /var/run/vmtoolsd.pid' +ExecReload=/bin/kill -HUP $MAINPID + +[Install] +WantedBy=graphical.target diff --git a/packages/sysutils/systemd/config/system.d/openvpn.service.sample b/packages/sysutils/systemd/config/system.d/openvpn.service.sample new file mode 100644 index 00000000000..d6f0ac445e5 --- /dev/null +++ b/packages/sysutils/systemd/config/system.d/openvpn.service.sample @@ -0,0 +1,44 @@ +[Unit] +Description=OpenVPN Autorun Service + +[Service] +Type=forking +Requires=network-online.service +After=network-online.service +ExecStart=/usr/sbin/openvpn --daemon --config /storage/.config/openvpn.config +Restart=always +RestartSec=15 + +[Install] +WantedBy=kodi.target + +# NOTES: +# +# 1) Edit /storage/.config/openvpn.config to the .config/.conf/.ovpn file +# from your VPN service provider and test it works first by connecting at +# the console: +# +# /usr/sbin/openvpn --daemon --config /storage/.config/openvpn.config +# +# 2) The openvpn.service file must be addeded to the active systemd config +# before it will work. This is done by running: +# +# systemctl enable openvpn.service +# +# 3) If you suspend/resume your LibreELEC system you will need to stop and +# restart the connection with a systemd *.power script, e.g. +# +# mkdir -p /storage/.config/sleep.d +# nano /storage/.config/sleep.d/01-openvpn.power +# +# Copy the sample script below. Remove # marks except for #!/bin/bash +# +# #!/bin/sh +# case "$1" in +# pre) +# systemctl stop openvpn.service +# ;; +# post) +# systemctl start openvpn.service +# ;; +# esac diff --git a/packages/sysutils/systemd/package.mk b/packages/sysutils/systemd/package.mk index 853393169b1..cae9bfe1cf2 100644 --- a/packages/sysutils/systemd/package.mk +++ b/packages/sysutils/systemd/package.mk @@ -17,7 +17,7 @@ ################################################################################ PKG_NAME="systemd" -PKG_VERSION="229" +PKG_VERSION="230" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" @@ -41,7 +41,6 @@ PKG_CONFIGURE_OPTS_TARGET="ac_cv_func_malloc_0_nonnull=yes \ --disable-nls \ --disable-dbus \ --disable-utmp \ - --disable-compat-libs \ --disable-coverage \ --enable-kmod \ --disable-xkbcommon \ @@ -69,7 +68,6 @@ PKG_CONFIGURE_OPTS_TARGET="ac_cv_func_malloc_0_nonnull=yes \ --disable-libiptc \ --disable-binfmt \ --disable-vconsole \ - --disable-bootchart \ --disable-quotacheck \ --enable-tmpfiles \ --disable-sysusers \ @@ -105,14 +103,9 @@ PKG_CONFIGURE_OPTS_TARGET="ac_cv_func_malloc_0_nonnull=yes \ --with-dbuspolicydir=/etc/dbus-1/system.d \ --with-dbussessionservicedir=/usr/share/dbus-1/services \ --with-dbussystemservicedir=/usr/share/dbus-1/system-services \ - --with-dbusinterfacedir=/usr/share/dbus-1/interfaces \ --with-rootprefix=/usr \ --with-rootlibdir=/lib" -unpack() { - tar xf $ROOT/$SOURCES/systemd/v$PKG_VERSION.tar.gz -C $ROOT/$BUILD -} - pre_build_target() { # broken autoreconf ( cd $PKG_BUILD @@ -179,8 +172,9 @@ post_makeinstall_target() { rm -rf $INSTALL/usr/lib/systemd/system-generators rm -rf $INSTALL/usr/lib/systemd/catalog - # meh presets - rm -rf $INSTALL/usr/lib/systemd/system-preset + # distro preset policy + rm -f $INSTALL/usr/lib/systemd/system-preset/* + echo "disable *" > $INSTALL/usr/lib/systemd/system-preset/99-default.preset # remove networkd rm -rf $INSTALL/usr/lib/systemd/network @@ -213,6 +207,10 @@ post_makeinstall_target() { ln -sf /usr/bin/systemctl $INSTALL/usr/sbin/shutdown ln -sf /usr/bin/systemctl $INSTALL/usr/sbin/telinit + # strip + debug_strip $INSTALL/usr + + # defaults mkdir -p $INSTALL/usr/config cp -PR $PKG_DIR/config/* $INSTALL/usr/config diff --git a/packages/sysutils/systemd/patches/systemd-06_stop-execute_preset-doing-stupid-things.patch b/packages/sysutils/systemd/patches/systemd-06_stop-execute_preset-doing-stupid-things.patch deleted file mode 100644 index ac582bff94e..00000000000 --- a/packages/sysutils/systemd/patches/systemd-06_stop-execute_preset-doing-stupid-things.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 8cfc723a596bcdab404f4861571b178d76eb1f7a Mon Sep 17 00:00:00 2001 -From: Stefan Saraev <stefan@saraev.ca> -Date: Tue, 28 Oct 2014 22:32:18 +0200 -Subject: [PATCH] stop execute_preset doing stupid things - -populating shitload of useless symlinks into /storage/.config/system.d -is not so-nice fuckery. and systemctl preset-all is useless on an -embedded distro like openelec anyway. ---- - src/shared/install.c | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/src/shared/install.c b/src/shared/install.c -index 17e03e5..f7e51af 100644 ---- a/src/shared/install.c -+++ b/src/shared/install.c -@@ -2165,6 +2165,11 @@ static int execute_preset( - UnitFileChange **changes, - unsigned *n_changes) { - -+ // meh systemctl preset-all. -+ // I DONT WANT shitload of symlink populated -+ // just because systemd "thinks" (o_O) /etc is empty -+ return 0; -+ - int r; - - assert(plus); diff --git a/packages/sysutils/systemd/patches/systemd-08_systemctl-disable-dangerous-options.patch b/packages/sysutils/systemd/patches/systemd-08_systemctl-disable-dangerous-options.patch index 8dfc477739d..f808d555add 100644 --- a/packages/sysutils/systemd/patches/systemd-08_systemctl-disable-dangerous-options.patch +++ b/packages/sysutils/systemd/patches/systemd-08_systemctl-disable-dangerous-options.patch @@ -23,7 +23,7 @@ index 420a246..06bca92 100644 static void systemctl_help(void) { pager_open_if_enabled(); -@@ -7370,21 +7370,21 @@ +@@ -7370,22 +7370,22 @@ { "enable", 2, VERB_ANY, 0, enable_unit }, { "disable", 2, VERB_ANY, 0, enable_unit }, { "is-enabled", 2, VERB_ANY, 0, unit_is_enabled }, @@ -39,6 +39,7 @@ index 420a246..06bca92 100644 + { "mask", 2, VERB_ANY, 0, nope }, + { "unmask", 2, VERB_ANY, 0, nope }, + { "link", 2, VERB_ANY, 0, nope }, + { "revert", 2, VERB_ANY, 0, enable_unit }, { "switch-root", 2, VERB_ANY, VERB_NOCHROOT, switch_root }, { "list-dependencies", VERB_ANY, 2, VERB_NOCHROOT, list_dependencies }, - { "set-default", 2, 2, 0, set_default }, diff --git a/packages/sysutils/systemd/patches/systemd-09_dont_support_btrfs.patch b/packages/sysutils/systemd/patches/systemd-09_dont_support_btrfs.patch deleted file mode 100644 index ac89ff4845a..00000000000 --- a/packages/sysutils/systemd/patches/systemd-09_dont_support_btrfs.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 0c50b670dc1466ce697a72b34cbb7a1a41d1b24f Mon Sep 17 00:00:00 2001 -From: Stefan Saraev <stefan@saraev.ca> -Date: Wed, 18 Nov 2015 20:15:43 +0200 -Subject: [PATCH 8/8] unsupported btrfs bull**** - ---- - src/basic/btrfs-util.c | 3 --- - 1 file changed, 3 deletions(-) - -diff --git a/src/basic/btrfs-util.c b/src/basic/btrfs-util.c -index be40dc5..e5efe4f 100644 ---- a/src/basic/btrfs-util.c -+++ b/src/basic/btrfs-util.c -@@ -1103,9 +1103,6 @@ int btrfs_quota_scan_start(int fd) { - int btrfs_quota_scan_wait(int fd) { - assert(fd >= 0); - -- if (ioctl(fd, BTRFS_IOC_QUOTA_RESCAN_WAIT) < 0) -- return -errno; -- - return 0; - } - --- -2.1.4 diff --git a/packages/sysutils/systemd/scripts/systemd-machine-id-setup b/packages/sysutils/systemd/scripts/systemd-machine-id-setup index 866f153effb..4f7142d183b 100755 --- a/packages/sysutils/systemd/scripts/systemd-machine-id-setup +++ b/packages/sysutils/systemd/scripts/systemd-machine-id-setup @@ -17,21 +17,26 @@ # along with OpenELEC. If not, see <http://www.gnu.org/licenses/>. ################################################################################ -# Attempts to generate a unique machine ID based on one local MAC address -# MACHINEID SHOULD be the same between upgrades/reinstalls -# MAC is hashed so that it cant be reversed making it anonymous -# Used to help with global usage statistics, also used for dbus and systemd +# Creates a unique machine-id based on a local MAC address which persists over +# reboots, upgrades and reinstallation. For systems with slow loading network +# drivers (no MAC's available) dbus-uuidgen is used which persists over reboot +# and upgrades but not reinstallation. If a MAC is used it is hashed to make it +# anonymous. The machine-id is used by dbus and systemd, and to collect basic +# active-installation statistics on LibreELEC users. -# creating machine-id, systemd otherwise does this automatically if not present. -# this we want to avoid to have the same machine-id over reboot, fallback -# to systemd's solution if this dont work here - -if [ -e "/sys/class/net/eth0/address" ]; then - MAC_ADRESS=`cat /sys/class/net/eth0/address` +if [ -e "/storage/.cache/machine-id" ]; then + MACHINEID=`cat /storage/.cache/machine-id` +elif [ -e "/sys/class/net/eth0/address" ]; then + MAC_ADDRESS=`cat /sys/class/net/eth0/address` elif [ -e "/sys/class/net/wlan0/address" ]; then - MAC_ADRESS=`cat /sys/class/net/wlan0/address` + MAC_ADDRESS=`cat /sys/class/net/wlan0/address` +else + MAC_ADDRESS=`/usr/bin/dbus-uuidgen` fi -MACHINEID=`echo $MAC_ADRESS | md5sum | cut -f1 -d" "` +if [ -z "$MACHINEID" ]; then + MACHINEID=`echo $MAC_ADDRESS | md5sum | cut -f1 -d" "` + mkdir -p /storage/.cache +fi -echo "$MACHINEID" > /run/machine-id +echo "$MACHINEID" > /storage/.cache/machine-id diff --git a/packages/sysutils/systemd/system.d/debugconfig.service b/packages/sysutils/systemd/system.d/debugconfig.service index e77759b5e9b..4261d0cf44a 100644 --- a/packages/sysutils/systemd/system.d/debugconfig.service +++ b/packages/sysutils/systemd/system.d/debugconfig.service @@ -3,11 +3,11 @@ Description=Setup debug config DefaultDependencies=no After=systemd-tmpfiles-setup.service ConditionKernelCommandLine=|debugging -ConditionPathExists=|/storage/.cache/debug.openelec +ConditionPathExists=|/storage/.cache/debug.libreelec [Service] Type=oneshot -ExecStart=/bin/sh -c 'cp /usr/share/debugconf/*.conf /run/openelec/debug' +ExecStart=/bin/sh -c 'cp /usr/share/debugconf/*.conf /run/libreelec/debug' RemainAfterExit=yes [Install] diff --git a/packages/sysutils/systemd/tmpfiles.d/z_01_openelec.conf b/packages/sysutils/systemd/tmpfiles.d/z_01_openelec.conf index f61bd9c102b..0cf4959b10b 100644 --- a/packages/sysutils/systemd/tmpfiles.d/z_01_openelec.conf +++ b/packages/sysutils/systemd/tmpfiles.d/z_01_openelec.conf @@ -16,5 +16,5 @@ # along with OpenELEC. If not, see <http://www.gnu.org/licenses/>. ################################################################################ -d /run/openelec 0755 root root - - -d /run/openelec/debug 0755 root root - - +d /run/libreelec 0755 root root - - +d /run/libreelec/debug 0755 root root - - diff --git a/packages/sysutils/udevil/udev.d/95-udevil-mount.rules b/packages/sysutils/udevil/udev.d/95-udevil-mount.rules index ef5506942f4..42c88d00d95 100644 --- a/packages/sysutils/udevil/udev.d/95-udevil-mount.rules +++ b/packages/sysutils/udevil/udev.d/95-udevil-mount.rules @@ -7,7 +7,7 @@ SUBSYSTEM!="block", KERNEL!="sd*|sr*|mmc*", GOTO="exit" # check for special partitions we dont want mount IMPORT{builtin}="blkid" -ENV{ID_FS_LABEL}=="EFI|BOOT|Recovery", GOTO="exit" +ENV{ID_FS_LABEL}=="EFI|BOOT|Recovery|RECOVERY|SETTINGS|boot|root0|share0", GOTO="exit" # /dev/sd* and /dev/mmc* ith partitions/disk and filesystems only and /dev/sr* disks only KERNEL=="sd*|mmc*", ENV{DEVTYPE}=="partition|disk", ENV{ID_FS_USAGE}=="filesystem", GOTO="harddisk" diff --git a/packages/sysutils/util-linux/package.mk b/packages/sysutils/util-linux/package.mk index 0327e211b14..24967f04275 100644 --- a/packages/sysutils/util-linux/package.mk +++ b/packages/sysutils/util-linux/package.mk @@ -17,11 +17,11 @@ ################################################################################ PKG_NAME="util-linux" -PKG_VERSION="2.27.1" +PKG_VERSION="2.28" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" -PKG_URL="http://www.kernel.org/pub/linux/utils/util-linux/v2.27/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_URL="http://www.kernel.org/pub/linux/utils/util-linux/v2.28/$PKG_NAME-$PKG_VERSION.tar.xz" PKG_DEPENDS_TARGET="toolchain" PKG_DEPENDS_INIT="toolchain" PKG_PRIORITY="optional" @@ -100,8 +100,8 @@ fi post_makeinstall_target() { if [ "$SWAP_SUPPORT" = "yes" ]; then - mkdir -p $INSTALL/usr/lib/openelec - cp -PR $PKG_DIR/scripts/mount-swap $INSTALL/usr/lib/openelec + mkdir -p $INSTALL/usr/lib/libreelec + cp -PR $PKG_DIR/scripts/mount-swap $INSTALL/usr/lib/libreelec mkdir -p $INSTALL/etc cat $PKG_DIR/config/swap.conf | \ diff --git a/packages/sysutils/util-linux/system.d/swap.service b/packages/sysutils/util-linux/system.d/swap.service index ba56099aaa4..4bf0f8fb0b8 100644 --- a/packages/sysutils/util-linux/system.d/swap.service +++ b/packages/sysutils/util-linux/system.d/swap.service @@ -13,8 +13,8 @@ ConditionKernelCommandLine=!installer [Service] Environment=HOME=/storage Type=oneshot -ExecStartPre=/usr/lib/openelec/mount-swap create -ExecStart=/usr/lib/openelec/mount-swap mount +ExecStartPre=/usr/lib/libreelec/mount-swap create +ExecStart=/usr/lib/libreelec/mount-swap mount RemainAfterExit=yes [Install] diff --git a/packages/sysutils/v86d/package.mk b/packages/sysutils/v86d/package.mk index db29ff80cd5..0d939bfdb6f 100644 --- a/packages/sysutils/v86d/package.mk +++ b/packages/sysutils/v86d/package.mk @@ -22,7 +22,7 @@ PKG_REV="1" PKG_ARCH="x86_64" PKG_LICENSE="GPL" PKG_SITE="http://dev.gentoo.org/~spock/projects/uvesafb/" -PKG_URL="http://dev.gentoo.org/~spock/projects/uvesafb/archive/$PKG_NAME-$PKG_VERSION.tar.bz2" +PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS_INIT="toolchain gcc:init" PKG_PRIORITY="optional" PKG_SECTION="system" diff --git a/packages/textproc/expat/package.mk b/packages/textproc/expat/package.mk index 2315085055d..c599ed71613 100644 --- a/packages/textproc/expat/package.mk +++ b/packages/textproc/expat/package.mk @@ -17,12 +17,12 @@ ################################################################################ PKG_NAME="expat" -PKG_VERSION="2.1.0" +PKG_VERSION="2.1.1" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="OSS" PKG_SITE="http://expat.sourceforge.net/" -PKG_URL="$SOURCEFORGE_SRC/$PKG_NAME/$PKG_VERSION/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_URL="$SOURCEFORGE_SRC/$PKG_NAME/$PKG_VERSION/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS_TARGET="toolchain" PKG_PRIORITY="optional" PKG_SECTION="textproc" diff --git a/packages/textproc/libxml2/package.mk b/packages/textproc/libxml2/package.mk index 6525348e285..f1ab5c10f74 100644 --- a/packages/textproc/libxml2/package.mk +++ b/packages/textproc/libxml2/package.mk @@ -23,6 +23,7 @@ PKG_ARCH="any" PKG_LICENSE="MIT" PKG_SITE="http://xmlsoft.org" PKG_URL="ftp://xmlsoft.org/libxml2/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_DEPENDS_HOST="toolchain zlib:host" PKG_DEPENDS_TARGET="toolchain zlib" PKG_PRIORITY="optional" PKG_SECTION="textproc" @@ -32,16 +33,19 @@ PKG_IS_ADDON="no" PKG_AUTORECONF="yes" -PKG_CONFIGURE_OPTS_TARGET="ac_cv_header_ansidecl_h=no \ +PKG_CONFIGURE_OPTS_ALL="ac_cv_header_ansidecl_h=no \ --enable-static \ --enable-shared \ --disable-silent-rules \ --enable-ipv6 \ --without-python \ - --with-zlib=$SYSROOT_PREFIX/usr \ - --with-sysroot=$SYSROOT_PREFIX \ + --with-zlib=$ROOT/$TOOLCHAIN \ --without-lzma" +PKG_CONFIGURE_OPTS_HOST="$PKG_CONFIGURE_OPTS_ALL --with-zlib=$ROOT/$TOOLCHAIN" + +PKG_CONFIGURE_OPTS_TARGET="$PKG_CONFIGURE_OPTS_ALL --with-zlib=$SYSROOT_PREFIX/usr --with-sysroot=$SYSROOT_PREFIX" + post_makeinstall_target() { $SED "s:\(['= ]\)/usr:\\1$SYSROOT_PREFIX/usr:g" $SYSROOT_PREFIX/usr/bin/xml2-config diff --git a/packages/textproc/libxslt/package.mk b/packages/textproc/libxslt/package.mk index b4378cbfb82..a1d25ae91fd 100644 --- a/packages/textproc/libxslt/package.mk +++ b/packages/textproc/libxslt/package.mk @@ -23,6 +23,7 @@ PKG_ARCH="any" PKG_LICENSE="MIT" PKG_SITE="http://xmlsoft.org/xslt/" PKG_URL="ftp://xmlsoft.org/libxml2/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_DEPENDS_HOST="toolchain libxml2:host" PKG_DEPENDS_TARGET="toolchain libxml2" PKG_PRIORITY="optional" PKG_SECTION="textproc" @@ -32,6 +33,13 @@ PKG_LONGDESC="libxslt" PKG_IS_ADDON="no" PKG_AUTORECONF="yes" +PKG_CONFIGURE_OPTS_HOST=" ac_cv_header_ansidecl_h=no \ + --enable-static \ + --disable-shared \ + --without-python \ + --with-libxml-prefix=$ROOT/$TOOLCHAIN \ + --without-crypto" + PKG_CONFIGURE_OPTS_TARGET="ac_cv_header_ansidecl_h=no \ --enable-static \ --disable-shared \ diff --git a/packages/textproc/tinyxml2/package.mk b/packages/textproc/tinyxml2/package.mk index 9f0a8161fe5..04dc2bf138f 100644 --- a/packages/textproc/tinyxml2/package.mk +++ b/packages/textproc/tinyxml2/package.mk @@ -39,10 +39,10 @@ pre_configure_target() { configure_target() { cmake -DCMAKE_TOOLCHAIN_FILE=$CMAKE_CONF \ -DCMAKE_INSTALL_PREFIX=/usr \ + -DBUILD_SHARED_LIBS=off \ .. } post_makeinstall_target() { - rm $SYSROOT_PREFIX/usr/lib/libtinyxml2.so* rm -rf $INSTALL/usr } diff --git a/packages/textproc/tinyxml2/patches/tinyxml2-0001-really-disable-shared-build.patch b/packages/textproc/tinyxml2/patches/tinyxml2-0001-really-disable-shared-build.patch new file mode 100644 index 00000000000..917c759d14c --- /dev/null +++ b/packages/textproc/tinyxml2/patches/tinyxml2-0001-really-disable-shared-build.patch @@ -0,0 +1,30 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -51,26 +51,12 @@ if(BUILD_STATIC_LIBS) + add_library(tinyxml2static STATIC tinyxml2.cpp tinyxml2.h) + set_target_properties(tinyxml2static PROPERTIES OUTPUT_NAME tinyxml2) + endif(BUILD_STATIC_LIBS) +-add_library(tinyxml2 SHARED tinyxml2.cpp tinyxml2.h) +-set_target_properties(tinyxml2 PROPERTIES +- VERSION "${GENERIC_LIB_VERSION}" +- SOVERSION "${GENERIC_LIB_SOVERSION}") +- +-add_executable(test xmltest.cpp) +-add_dependencies(test tinyxml2) +-add_dependencies(test ${TARGET_DATA_COPY}) +-target_link_libraries(test tinyxml2) +- + + if(BUILD_STATIC_LIBS) +- install(TARGETS tinyxml2 tinyxml2static ++ install(TARGETS tinyxml2static + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) +-else(BUILD_STATIC_LIBS) +- install(TARGETS tinyxml2 +- RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +- LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) + endif(BUILD_STATIC_LIBS) + install(FILES tinyxml2.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) + diff --git a/packages/textproc/xmlstarlet/package.mk b/packages/textproc/xmlstarlet/package.mk new file mode 100644 index 00000000000..d4d1ec33dc3 --- /dev/null +++ b/packages/textproc/xmlstarlet/package.mk @@ -0,0 +1,62 @@ +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# +# OpenELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# OpenELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with OpenELEC. If not, see <http://www.gnu.org/licenses/>. +################################################################################ + +PKG_NAME="xmlstarlet" +PKG_VERSION="1.6.1" +PKG_REV="0" +PKG_ARCH="any" +PKG_LICENSE="MIT" +PKG_SITE="http://xmlstar.sourceforge.net" +PKG_URL="http://netcologne.dl.sourceforge.net/project/xmlstar/$PKG_NAME/$PKG_VERSION/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_DEPENDS_HOST="toolchain libxml2:host libxslt:host" +PKG_DEPENDS_TARGET="toolchain libxml2 libxslt" +PKG_PRIORITY="optional" +PKG_SECTION="tools" +PKG_SHORTDESC="XMLStarlet is a command-line XML utility which allows the modification and validation of XML documents" +PKG_LONGDESC="XMLStarlet is a command line XML toolkit which can be used to transform,query, validate, and edit XML documents and files using simple set of shellcommands in similar way it is done for plain text files using grep/sed/awk/tr/diff/patch." + +PKG_IS_ADDON="no" +PKG_AUTORECONF="yes" + +PKG_CONFIGURE_OPTS_HOST=" ac_cv_func_malloc_0_nonnull=yes \ + ac_cv_func_realloc_0_nonnull=yes \ + --enable-static-libs \ + LIBXML_CONFIG=$ROOT/$TOOLCHAIN/bin/xml2-config \ + LIBXSLT_CONFIG=$ROOT/$TOOLCHAIN/bin/xslt-config \ + --with-libxml-include-prefix=$ROOT/$TOOLCHAIN/include/libxml2 \ + --with-libxml-libs-prefix=$ROOT/$TOOLCHAIN/lib \ + --with-libxslt-include-prefix=$ROOT/$TOOLCHAIN/include \ + --with-libxslt-libs-prefix=$ROOT/$TOOLCHAIN/lib" + +PKG_CONFIGURE_OPTS_TARGET="ac_cv_func_malloc_0_nonnull=yes \ + ac_cv_func_realloc_0_nonnull=yes \ + --enable-static-libs \ + LIBXML_CONFIG=$SYSROOT_PREFIX/usr/bin/xml2-config \ + LIBXSLT_CONFIG=$SYSROOT_PREFIX/usr/bin/xslt-config \ + --with-libxml-include-prefix=$SYSROOT_PREFIX/usr/include/libxml2 \ + --with-libxml-libs-prefix=$SYSROOT_PREFIX/usr/lib \ + --with-libxslt-include-prefix=$SYSROOT_PREFIX/usr/include \ + --with-libxslt-libs-prefix=$SYSROOT_PREFIX/usr/lib" + +post_makeinstall_host() { + ln -sf xml $ROOT/$TOOLCHAIN/bin/xmlstarlet +} + +post_makeinstall_target() { + ln -sf xml $INSTALL/usr/bin/xmlstarlet +} diff --git a/packages/textproc/xmlstarlet/patches/xmlstarlet-0001-usage2c.awk-fix-wrong-basename-regexp.patch b/packages/textproc/xmlstarlet/patches/xmlstarlet-0001-usage2c.awk-fix-wrong-basename-regexp.patch new file mode 100644 index 00000000000..24b187f2ac9 --- /dev/null +++ b/packages/textproc/xmlstarlet/patches/xmlstarlet-0001-usage2c.awk-fix-wrong-basename-regexp.patch @@ -0,0 +1,37 @@ +Upstream-Status: Submitted [sourceforge] + +From 75d789d0ea9716c9a9ae72f42a2fcfa907cf4a12 Mon Sep 17 00:00:00 2001 +From: Matthieu Crapet <mcrapet@gmail.com> +Date: Mon, 30 Jun 2014 13:52:25 +0200 +Subject: [PATCH] usage2c.awk: fix wrong basename regexp + +Previously not matching with filename argument with absolute path. + +Signed-off-by: Matthieu Crapet <mcrapet@gmail.com> +--- + usage2c.awk | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/usage2c.awk b/usage2c.awk +index 94b897a..9aea212 100755 +--- a/usage2c.awk ++++ b/usage2c.awk +@@ -6,13 +6,13 @@ BEGIN { + } + + # text in src/foo-bar.txt results in +-# static const char foo_text[] = { ++# static const char foo_bar[] = { + # 't', 'h', 'e', ' ', 't', 'e', 'x', 't', ... + # } + length(command_name) == 0 { + command_name = FILENAME; + sub(/\.txt$/, "", command_name); +- sub(/^([^\/]+\/)*/, "", command_name); ++ sub(/^.*\//, "", command_name); + gsub(/-/, "_", command_name); + printf("static const char %s[] = {\n", command_name); + progs = 0; +-- +2.0.0 + diff --git a/packages/tools/bcm2835-bootloader/files/3rdparty/bootloader/config.txt b/packages/tools/bcm2835-bootloader/files/3rdparty/bootloader/config.txt index 7bf5c438691..f3b4b9a9279 100644 --- a/packages/tools/bcm2835-bootloader/files/3rdparty/bootloader/config.txt +++ b/packages/tools/bcm2835-bootloader/files/3rdparty/bootloader/config.txt @@ -51,13 +51,13 @@ # mode 'Turbo' : 1000 | 500 | 600 | 6 # mode 'Pi2' : 1000 | 500 | 500 | 2 -# arm_freq=700 -# core_freq=250 -# sdram_freq=400 -# over_voltage=0 +arm_freq=900 +core_freq=300 +sdram_freq=450 +over_voltage=6 # set to 'force_turbo=1' to disable dynamic overclocking (you can lose your warranty!) - force_turbo=0 +force_turbo=1 # If you have any data corruption using Turbo Mode and overclocking # try with this setting uncommented diff --git a/packages/tools/bcm2835-bootloader/package.mk b/packages/tools/bcm2835-bootloader/package.mk index 9817d3a9a33..1321a5725da 100644 --- a/packages/tools/bcm2835-bootloader/package.mk +++ b/packages/tools/bcm2835-bootloader/package.mk @@ -17,7 +17,7 @@ ################################################################################ PKG_NAME="bcm2835-bootloader" -PKG_VERSION="b48c36f" +PKG_VERSION="70143fe" PKG_REV="1" PKG_ARCH="arm" PKG_LICENSE="nonfree" @@ -33,7 +33,10 @@ PKG_IS_ADDON="no" PKG_AUTORECONF="no" make_target() { - : # nothing to make + if [ -f $DISTRO_DIR/$DISTRO/config/dt-blob.dts ]; then + echo Compiling device tree blob + $(kernel_path)/scripts/dtc/dtc -O dtb -o dt-blob.bin $DISTRO_DIR/$DISTRO/config/dt-blob.dts + fi } makeinstall_target() { @@ -42,7 +45,13 @@ makeinstall_target() { cp -PRv bootcode.bin $INSTALL/usr/share/bootloader cp -PRv fixup_x.dat $INSTALL/usr/share/bootloader/fixup.dat cp -PRv start_x.elf $INSTALL/usr/share/bootloader/start.elf + [ -f dt-blob.bin ] && cp -PRv dt-blob.bin $INSTALL/usr/share/bootloader/dt-blob.bin cp -PRv $PKG_DIR/scripts/update.sh $INSTALL/usr/share/bootloader - cp -PRv $PKG_DIR/files/3rdparty/bootloader/config.txt $INSTALL/usr/share/bootloader + + if [ -f $DISTRO_DIR/$DISTRO/config/config.txt ]; then + cp -PRv $DISTRO_DIR/$DISTRO/config/config.txt $INSTALL/usr/share/bootloader + else + cp -PRv $PKG_DIR/files/3rdparty/bootloader/config.txt $INSTALL/usr/share/bootloader + fi } diff --git a/packages/tools/bcm2835-bootloader/release b/packages/tools/bcm2835-bootloader/release index 39ec945f5fb..33d13783451 100755 --- a/packages/tools/bcm2835-bootloader/release +++ b/packages/tools/bcm2835-bootloader/release @@ -25,5 +25,7 @@ mkdir -p $RELEASE_DIR/3rdparty/bootloader cp -PR $BUILD/bcm2835-bootloader-*/bootcode.bin $RELEASE_DIR/3rdparty/bootloader/ cp -PR $BUILD/bcm2835-bootloader-*/fixup_x.dat $RELEASE_DIR/3rdparty/bootloader/fixup.dat cp -PR $BUILD/bcm2835-bootloader-*/start_x.elf $RELEASE_DIR/3rdparty/bootloader/start.elf + [ -f $BUILD/bcm2835-bootloader-*/dt-blob.bin ] && cp -PR $BUILD/bcm2835-bootloader-*/dt-blob.bin $RELEASE_DIR/3rdparty/bootloader/ cp -PR $INSTALL/usr/share/bootloader/*.dtb $RELEASE_DIR/3rdparty/bootloader/ - cp -PR $INSTALL/usr/share/bootloader/overlays $RELEASE_DIR/3rdparty/bootloader/ \ No newline at end of file + cp -PR $INSTALL/usr/share/bootloader/overlays $RELEASE_DIR/3rdparty/bootloader/ + cp -PR $INSTALL/usr/share/bootloader/config.txt $RELEASE_DIR/3rdparty/bootloader/ diff --git a/packages/tools/bcm2835-bootloader/scripts/update.sh b/packages/tools/bcm2835-bootloader/scripts/update.sh index 7054650000f..f4ee582e500 100755 --- a/packages/tools/bcm2835-bootloader/scripts/update.sh +++ b/packages/tools/bcm2835-bootloader/scripts/update.sh @@ -29,6 +29,7 @@ cp -p $SYSTEM_ROOT/usr/share/bootloader/bootcode.bin $BOOT_ROOT cp -p $SYSTEM_ROOT/usr/share/bootloader/fixup.dat $BOOT_ROOT cp -p $SYSTEM_ROOT/usr/share/bootloader/start.elf $BOOT_ROOT + [ -f $SYSTEM_ROOT/usr/share/bootloader/dt-blob.bin ] && cp -p $SYSTEM_ROOT/usr/share/bootloader/dt-blob.bin $BOOT_ROOT cp -p $SYSTEM_ROOT/usr/share/bootloader/*.dtb $BOOT_ROOT cp -pR $SYSTEM_ROOT/usr/share/bootloader/overlays $BOOT_ROOT @@ -49,8 +50,21 @@ # sed -e "s,gpu_mem=100,gpu_mem=128,g" -i $BOOT_ROOT/config.txt # sed -e "s,gpu_mem_256=100,# gpu_mem_256=128,g" -i $BOOT_ROOT/config.txt # sed -e "s,gpu_mem_512=128,# gpu_mem_512=128,g" -i $BOOT_ROOT/config.txt + elif [ -z "`grep "^[ ]*arm_freq.*" $BOOT_ROOT/config.txt`" ]; then + sed -e "s,#.*arm_freq=.*,arm_freq=900,g" -i $BOOT_ROOT/config.txt + sed -e "s,#.*core_freq=.*,core_freq=300,g" -i $BOOT_ROOT/config.txt + sed -e "s,#.*sdram_freq=.*,sdram_freq=450,g" -i $BOOT_ROOT/config.txt + sed -e "s,#.*over_voltage=.*,over_voltage=6,g" -i $BOOT_ROOT/config.txt + sed -e "s,.*force_turbo=0.*,force_turbo=1,g" -i $BOOT_ROOT/config.txt + + fi + + if [ -z "`grep "^[ ]*dtoverlay=mmc" $BOOT_ROOT/config.txt`" ]; then + echo "dtoverlay=mmc" >> $BOOT_ROOT/config.txt fi +cp $SYSTEM_ROOT/usr/config/shutdown.sh /storage/.config/ + # mount $BOOT_ROOT r/o sync mount -o remount,ro $BOOT_ROOT diff --git a/packages/tools/dialog/package.mk b/packages/tools/dialog/package.mk index b1bd7096630..4ff19994c6f 100644 --- a/packages/tools/dialog/package.mk +++ b/packages/tools/dialog/package.mk @@ -23,7 +23,7 @@ PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://invisible-island.net/dialog/" PKG_URL="ftp://invisible-island.net/dialog/$PKG_NAME-$PKG_VERSION.tgz" -PKG_DEPENDS_TARGET="toolchain ncurses" +PKG_DEPENDS_TARGET="toolchain netbsd-curses" PKG_PRIORITY="optional" PKG_SECTION="tools" PKG_SHORTDESC="dialog: A utility for creating TTY dialog boxes" @@ -43,7 +43,3 @@ PKG_CONFIGURE_OPTS_TARGET="--disable-nls \ --disable-mixedform \ --disable-tailbox" -pre_configure_target() { - export NCURSES_CONFIG="$ROOT/$TOOLCHAIN/bin/ncurses-config" -} - diff --git a/packages/tools/dtc/package.mk b/packages/tools/dtc/package.mk new file mode 100644 index 00000000000..0d32bac6f4d --- /dev/null +++ b/packages/tools/dtc/package.mk @@ -0,0 +1,39 @@ +################################################################################ +# This file is part of LibreELEC - https://libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see <http://www.gnu.org/licenses/>. +################################################################################ + +PKG_NAME="dtc" +PKG_VERSION="beef80b" +PKG_REV="1" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="https://git.kernel.org/cgit/utils/dtc/dtc.git" +PKG_URL="https://git.kernel.org/cgit/utils/dtc/dtc.git/snapshot/$PKG_VERSION.tar.xz" +PKG_SOURCE_DIR="$PKG_VERSION" +PKG_DEPENDS_TARGET="toolchain" +PKG_PRIORITY="optional" +PKG_SECTION="tools" +PKG_SHORTDESC="The Device Tree Compiler" +PKG_LONGDESC="The Device Tree Compiler" +PKG_AUTORECONF="no" + +PKG_MAKE_OPTS_TARGET="dtc" + +makeinstall_target() { + mkdir -p $INSTALL/usr/bin + cp -P $ROOT/$PKG_BUILD/dtc $INSTALL/usr/bin +} diff --git a/packages/tools/installer/config/installer.conf b/packages/tools/installer/config/installer.conf index 5c88d15d763..4ceb68528e8 100644 --- a/packages/tools/installer/config/installer.conf +++ b/packages/tools/installer/config/installer.conf @@ -19,11 +19,14 @@ DISKLABEL_SYSTEM="System" DISKLABEL_STORAGE="Storage" -# Defaultsize of system partition (Cylinder: 16=132MB, 31=255MB, 66=517MiB) - PARTSIZE_SYSTEM="66" +# Default size of system partition, in MB, eg. 512 + PARTSIZE_SYSTEM="@SYSTEM_SIZE@" + +# Default starting offset for system partition, in sectors (1 sector = 512B), eg. 2048 + PARTSIZE_SYSTEM_OFFSET="@SYSTEM_PART_START@" # additional parameters to extlinux - EXTLINUX_PARAMETERS="" + EXTLINUX_PARAMETERS="@EXTLINUX_PARAMETERS@" # enable BIOS update function BIOS_UPDATE="no" diff --git a/packages/tools/installer/package.mk b/packages/tools/installer/package.mk index 900dfa7e84a..dd4e4811f2a 100644 --- a/packages/tools/installer/package.mk +++ b/packages/tools/installer/package.mk @@ -26,8 +26,8 @@ PKG_URL="" PKG_DEPENDS_TARGET="toolchain busybox dialog parted e2fsprogs syslinux" PKG_PRIORITY="optional" PKG_SECTION="tools" -PKG_SHORTDESC="installer: OpenELEC.tv Install manager" -PKG_LONGDESC="OpenELEC.tv Install manager to install the system on any disk" +PKG_SHORTDESC="installer: LibreELEC.tv Install manager" +PKG_LONGDESC="LibreELEC.tv Install manager to install the system on any disk" PKG_IS_ADDON="no" PKG_AUTORECONF="no" @@ -43,6 +43,8 @@ makeinstall_target() { post_install() { mkdir -p $INSTALL/usr/bin cp $PKG_DIR/scripts/installer $INSTALL/usr/bin + sed -e "s/@DISTRONAME@/$DISTRONAME/g" \ + -i $INSTALL/usr/bin/installer mkdir -p $INSTALL/etc if [ -f $PROJECT_DIR/$PROJECT/installer/installer.conf ]; then @@ -50,6 +52,10 @@ post_install() { else cp $PKG_DIR/config/installer.conf $INSTALL/etc fi + sed -e "s/@SYSTEM_SIZE@/$SYSTEM_SIZE/g" \ + -e "s/@SYSTEM_PART_START@/$SYSTEM_PART_START/g" \ + -e "s/@EXTLINUX_PARAMETERS@/$EXTLINUX_PARAMETERS/g" \ + -i $INSTALL/etc/installer.conf enable_service installer.service } diff --git a/packages/tools/installer/scripts/installer b/packages/tools/installer/scripts/installer index 8c029381be0..4bf88711d4f 100755 --- a/packages/tools/installer/scripts/installer +++ b/packages/tools/installer/scripts/installer @@ -253,15 +253,20 @@ do_install_quick() { cat /usr/share/syslinux/mbr.bin > $INSTALL_DEVICE fi + partsize_system_start=$PARTSIZE_SYSTEM_OFFSET + partsize_system_end=$(((PARTSIZE_SYSTEM * 1024 * 1024 / 512) + partsize_system_start)) + partsize_storage_start=$((partsize_system_end + 2048)) + partsize_storage_end=-1024 + msg_progress_install "10" "creating partition on $INSTALL_DEVICE" if [ "$UEFI" = "1" ]; then - parted -s $INSTALL_DEVICE unit cyl mkpart primary fat32 -- 0 $PARTSIZE_SYSTEM >> $LOGFILE 2>&1 + parted -s $INSTALL_DEVICE unit s mkpart primary fat32 -- $partsize_system_start $partsize_system_end >> $LOGFILE 2>&1 else - parted -s $INSTALL_DEVICE unit cyl mkpart primary ext2 -- 0 $PARTSIZE_SYSTEM >> $LOGFILE 2>&1 + parted -s $INSTALL_DEVICE unit s mkpart primary ext2 -- $partsize_system_start $partsize_system_end >> $LOGFILE 2>&1 fi msg_progress_install "13" "creating partition on $INSTALL_DEVICE" - parted -s $INSTALL_DEVICE unit cyl mkpart primary ext2 -- $PARTSIZE_SYSTEM -2 >> $LOGFILE 2>&1 + parted -s $INSTALL_DEVICE unit s mkpart primary ext2 -- $partsize_storage_start $partsize_storage_end >> $LOGFILE 2>&1 msg_progress_install "16" "setup bootflag on partition 1 of $INSTALL_DEVICE" parted -s $INSTALL_DEVICE set 1 boot on >> $LOGFILE 2>&1 @@ -366,6 +371,11 @@ do_install_quick() { rmdir $TMPDIR/part2 >> $LOGFILE 2>&1 fi + # install complete + MSG_TITLE="\Z1[ @DISTRONAME@ Install Complete ]\Zn" + MSG_DETAIL="\nYou may now remove the install media and reboot\n" + dialog --colors --backtitle "$BACKTITLE" --title "$MSG_TITLE" --msgbox "$MSG_DETAIL" 6 52 + menu_main ;; 1) @@ -484,6 +494,11 @@ do_install_custom() { msg_progress_install "100" "remove $TMPDIR/part1" rmdir $TMPDIR/part1 >> $LOGFILE 2>&1 + # install complete + MSG_TITLE="\Z1[ @DISTRONAME@ Install Complete ]\Zn" + MSG_DETAIL="\nYou may now remove the install media and reboot\n" + dialog --colors --backtitle "$BACKTITLE" --title "$MSG_TITLE" --msgbox "$MSG_DETAIL" 6 52 + menu_main ;; 1) @@ -576,7 +591,7 @@ menu_main() { dialog --colors --backtitle "$BACKTITLE" --cancel-label "$MSG_CANCEL" \ --title "$MSG_TITLE" --menu "$MSG_MENU" 20 70 5 \ - 1 "Quick Install of OpenELEC" \ + 1 "Quick Install of @DISTRONAME@" \ 2 "Repair / Upgrade" \ 3 "Show logfile" 2> $TMPDIR/mainmenu @@ -619,9 +634,9 @@ do_poweroff() { } # setup needed variables -INSTALLER_VERSION="0.2.6" +INSTALLER_VERSION="0.2.8" OS_VERSION=$(lsb_release) -BACKTITLE="OpenELEC Installer $INSTALLER_VERSION - $OS_VERSION" +BACKTITLE="@DISTRONAME@ Installer $INSTALLER_VERSION - $OS_VERSION" TMPDIR="/tmp/installer" LOGFILE="$TMPDIR/install.log" diff --git a/packages/tools/led_tools/package.mk b/packages/tools/led_tools/package.mk new file mode 100644 index 00000000000..2f3716a5ce0 --- /dev/null +++ b/packages/tools/led_tools/package.mk @@ -0,0 +1,47 @@ +################################################################################ +# Slice LED driver +# Copyright (C) 2014 Gordon Hollingworth (gordon@fiveninjas.com) +# +# This is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# It is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Slice. If not, see <http://www.gnu.org/licenses/>. +################################################################################ + +PKG_NAME="led_tools" +PKG_VERSION="0.1" +PKG_REV="1" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="http://www.fiveninjas.com" +PKG_URL="http://updates.fiveninjas.com/src/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain zlib libpng" +PKG_DEPENDS_HOST="toolchain" +PKG_PRIORITY="optional" +PKG_SECTION="tools" +PKG_SHORTDESC="led_tools" +PKG_LONGDESC="LED tools, these are a set of tools to control the LEDs on Slice" + +PKG_IS_ADDON="no" +PKG_AUTORECONF="no" + +make_target() { + make CC="$CC" \ + CFLAGS="$CFLAGS" \ + LDFLAGS="$LDFLAGS" +} + +makeinstall_target() { + + mkdir -p $INSTALL/usr/bin + cp led_png $INSTALL/usr/bin + +} diff --git a/packages/tools/mkbootimg/package.mk b/packages/tools/mkbootimg/package.mk index 4291944f63e..2e78a0716f6 100644 --- a/packages/tools/mkbootimg/package.mk +++ b/packages/tools/mkbootimg/package.mk @@ -22,7 +22,7 @@ PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="https://android.googlesource.com/platform/system/core/+/master/mkbootimg/" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_URL="https://github.com/codesnake/mkbootimg/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_HOST="" PKG_PRIORITY="optional" PKG_SECTION="tools" diff --git a/packages/tools/mtools/patches/mtools-05-fix-install.patch b/packages/tools/mtools/patches/mtools-05-fix-install.patch new file mode 100644 index 00000000000..962d8864333 --- /dev/null +++ b/packages/tools/mtools/patches/mtools-05-fix-install.patch @@ -0,0 +1,16 @@ +removes installing of floppyd, manuals and info +should fix occasional mtools installation problems few of us had + +--- a/Makefile.in 2010-10-17 17:41:09.000000000 +0200 ++++ b/Makefile.in 2016-04-28 11:42:28.015052786 +0200 +@@ -236,8 +236,8 @@ + uninstall-info: + cd $(DESTDIR)$(infodir) && rm -f mtools.info* + +-install: $(DESTDIR)$(bindir)/mtools @BINFLOPPYD@ install-man install-links \ +- $(DESTDIR)$(bindir)/mkmanifest install-scripts install-info ++install: $(DESTDIR)$(bindir)/mtools install-links \ ++ $(DESTDIR)$(bindir)/mkmanifest install-scripts + + uninstall: uninstall-bin uninstall-man uninstall-links \ + uninstall-scripts diff --git a/packages/tools/nano/package.mk b/packages/tools/nano/package.mk index cd8b8a9a3df..fc9efecd56b 100644 --- a/packages/tools/nano/package.mk +++ b/packages/tools/nano/package.mk @@ -23,7 +23,7 @@ PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.nano-editor.org/" PKG_URL="http://ftp.gnu.org/gnu/nano/$PKG_NAME-$PKG_VERSION.tar.gz" -PKG_DEPENDS_TARGET="toolchain ncurses" +PKG_DEPENDS_TARGET="toolchain netbsd-curses" PKG_PRIORITY="optional" PKG_SECTION="shell/texteditor" PKG_SHORTDESC="nano: Pico editor clone with enhancements" @@ -33,10 +33,10 @@ PKG_IS_ADDON="no" PKG_AUTORECONF="yes" PKG_CONFIGURE_OPTS_TARGET="--disable-utf8 \ - --disable-nls" + --disable-nls \ + --disable-libmagic" pre_configure_target() { - export CFLAGS="$CFLAGS -I$SYSROOT_PREFIX/usr/include/ncurses" export LDFLAGS=`echo $LDFLAGS | sed -e "s|-Wl,--as-needed||"` export LIBS="$LIBS -lz" } diff --git a/packages/tools/plymouth-lite/package.mk b/packages/tools/plymouth-lite/package.mk index a2016169bc2..31ae9dfcee6 100644 --- a/packages/tools/plymouth-lite/package.mk +++ b/packages/tools/plymouth-lite/package.mk @@ -50,14 +50,12 @@ makeinstall_init() { if [ -f $PROJECT_DIR/$PROJECT/splash/splash.conf ]; then cp $PROJECT_DIR/$PROJECT/splash/splash.conf $INSTALL/splash cp $PROJECT_DIR/$PROJECT/splash/*.png $INSTALL/splash - elif [ -f $PROJECT_DIR/$PROJECT/splash/splash-1024.png \ - -o -f $PROJECT_DIR/$PROJECT/splash/splash-full.png ]; then + elif ls $PROJECT_DIR/$PROJECT/splash/splash-*.png 1>/dev/null 2>&1; then cp $PROJECT_DIR/$PROJECT/splash/splash-*.png $INSTALL/splash elif [ -f $DISTRO_DIR/$DISTRO/splash/splash.conf ]; then cp $DISTRO_DIR/$DISTRO/splash/splash.conf $INSTALL/splash cp $DISTRO_DIR/$DISTRO/splash/*.png $INSTALL/splash - elif [ -f $DISTRO_DIR/$DISTRO/splash/splash-1024.png \ - -o -f $DISTRO_DIR/$DISTRO/splash/splash-full.png ]; then + elif ls $DISTRO_DIR/$DISTRO/splash/splash-*.png 1>/dev/null 2>&1; then cp $DISTRO_DIR/$DISTRO/splash/splash-*.png $INSTALL/splash else cp $PKG_DIR/splash/splash-*.png $INSTALL/splash diff --git a/packages/tools/populatefs/package.mk b/packages/tools/populatefs/package.mk index 70a65193443..d5bf2aa4894 100644 --- a/packages/tools/populatefs/package.mk +++ b/packages/tools/populatefs/package.mk @@ -22,7 +22,7 @@ PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="https://github.com/oskarirauta/populatefs" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_URL="https://github.com/oskarirauta/populatefs/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_HOST="e2fsprogs:host" PKG_PRIORITY="optional" PKG_SECTION="tools" diff --git a/packages/tools/procps-ng/package.mk b/packages/tools/procps-ng/package.mk new file mode 100644 index 00000000000..5a2f068b6e3 --- /dev/null +++ b/packages/tools/procps-ng/package.mk @@ -0,0 +1,42 @@ +################################################################################ +# This file is part of LibreELEC - https://libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see <http://www.gnu.org/licenses/>. +################################################################################ + +PKG_NAME="procps-ng" +PKG_VERSION="3.3.11" +PKG_REV="1" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="https://gitlab.com/procps-ng/procps" +PKG_URL="$SOURCEFORGE_SRC/$PKG_NAME/Production/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_DEPENDS_TARGET="toolchain netbsd-curses" +PKG_PRIORITY="optional" +PKG_SECTION="tools" +PKG_SHORTDESC="Command line and full screen utilities for browsing procfs" +PKG_LONGDESC="Command line and full screen utilities for browsing procfs, a "pseudo" file system dynamically generated by the kernel to provide information about the status of entries in its process table." +PKG_AUTORECONF="yes" + +PKG_CONFIGURE_OPTS_TARGET="ac_cv_func_malloc_0_nonnull=yes \ + ac_cv_func_realloc_0_nonnull=yes \ + --disable-shared \ + --disable-modern-top \ + --enable-static" + +makeinstall_target() { + mkdir -p $INSTALL/usr/bin + cp -P $ROOT/$PKG_BUILD/.$TARGET_NAME/top/top $INSTALL/usr/bin +} diff --git a/packages/tools/procps-ng/patches/procps-ng-0001-netbsd-curses-fix.patch b/packages/tools/procps-ng/patches/procps-ng-0001-netbsd-curses-fix.patch new file mode 100644 index 00000000000..d598254555a --- /dev/null +++ b/packages/tools/procps-ng/patches/procps-ng-0001-netbsd-curses-fix.patch @@ -0,0 +1,24 @@ +diff -Naur a/top/top.c b/top/top.c +--- a/top/top.c 2015-08-08 22:54:54.310117082 -0700 ++++ b/top/top.c 2016-04-22 12:17:49.833157898 -0700 +@@ -715,15 +715,15 @@ + the job's done until he/she/it has a change-of-heart */ + STRLCPY(q->cap_bold, CHKw(q, View_NOBOLD) ? Cap_norm : tIF(enter_bold_mode)) + if (CHKw(q, Show_COLORS) && max_colors > 0) { +- STRLCPY(q->capclr_sum, tparm(set_a_foreground, q->rc.summclr)) ++ STRLCPY(q->capclr_sum, tiparm(set_a_foreground, q->rc.summclr)) + snprintf(q->capclr_msg, sizeof(q->capclr_msg), "%s%s" +- , tparm(set_a_foreground, q->rc.msgsclr), Cap_reverse); ++ , tiparm(set_a_foreground, q->rc.msgsclr), Cap_reverse); + snprintf(q->capclr_pmt, sizeof(q->capclr_pmt), "%s%s" +- , tparm(set_a_foreground, q->rc.msgsclr), q->cap_bold); ++ , tiparm(set_a_foreground, q->rc.msgsclr), q->cap_bold); + snprintf(q->capclr_hdr, sizeof(q->capclr_hdr), "%s%s" +- , tparm(set_a_foreground, q->rc.headclr), Cap_reverse); ++ , tiparm(set_a_foreground, q->rc.headclr), Cap_reverse); + snprintf(q->capclr_rownorm, sizeof(q->capclr_rownorm), "%s%s" +- , Caps_off, tparm(set_a_foreground, q->rc.taskclr)); ++ , Caps_off, tiparm(set_a_foreground, q->rc.taskclr)); + } else { + q->capclr_sum[0] = '\0'; + #ifdef USE_X_COLHDR diff --git a/packages/tools/syslinux/unsupported/create_virtualimage b/packages/tools/syslinux/unsupported/create_virtualimage new file mode 100755 index 00000000000..642f1e7fcad --- /dev/null +++ b/packages/tools/syslinux/unsupported/create_virtualimage @@ -0,0 +1,332 @@ +#!/bin/sh + +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) +# +# OpenELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# OpenELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with OpenELEC. If not, see <http://www.gnu.org/licenses/>. +################################################################################ + +# usage: sudo ./create_virtualmachine <path> <size(MB)> [<type>] [system partition size(MB)] +# example: sudo ./create_virtualmachine /home/test/VM 512 [vdi] [128] + +if [ "$(id -u)" != "0" ]; then + echo "##############################################################" + echo "# please execute with 'sudo' or -DANGEROUS!!!- as root #" + echo "# example: #" + echo "# sudo ./create_virtualmachine <path> <size(MB)> [<type>] #" + echo "##############################################################" + exit 1 +fi + +if [ -z "$1" -o -z "$2" ]; then + echo "##############################################################" + echo "# please execute as follows #" + echo "# example: #" + echo "# sudo ./create_virtualmachine <path> <size(MB)> [<type>] #" + echo "##############################################################" + exit 1 +fi + +if [ ! -d "$1" ]; then + echo "##############################################################" + echo "# please create target directory #" + echo "# example: #" + echo "# mkdir <path> #" + echo "##############################################################" + exit 1 +fi + +if [ "$2" -lt "200" -o "$2" -gt "2048" ]; then + echo "##############################################################" + echo "# use a value between 200MB and 2048MB (2GB) #" + echo "# example: #" + echo "# sudo ./create_virtualmachine /home/test/VM 512 #" + echo "##############################################################" + exit 1 +fi + +if [ ! -z "$3" -a "$3" != "vdi" -a "$3" != "vmdk" ]; then + echo "##############################################################" + echo "# only vdi or vmdk types are supported #" + echo "# example: #" + echo "# sudo ./create_virtualmachine /home/test/VM 512 [vdi] #" + echo "##############################################################" + exit 1 +elif [ "$3" = "vdi" ]; then + TYPE="vdi" +elif [ -z "$3" -o "$3" = "vmdk" ]; then + TYPE="vmdk" +fi + +if [ -z "$4" ]; then + SYSTEM_SIZE=192 +else + if [ "$4" -lt "128" -o "$4" -gt "1024" -o "$4" -gt "$2" ]; then + echo "##############################################################" + echo "# use a value between 128MB and 1024MB #" + echo "# example: #" + echo "# sudo ./create_virtualmachine /home/test/VM 512 [vdi] [256] #" + echo "##############################################################" + exit 1 + else + SYSTEM_SIZE=$4 + fi +fi + +DISK="$1/OpenELEC.img" +IMAGE="$1/OpenELEC.$TYPE" +LOOP=$(losetup -f) +DISK_SIZE=$2 +STORAGE_SIZE=$(( $DISK_SIZE - $SYSTEM_SIZE )) + +echo "" +echo " folder: $1" +echo " loop: $LOOP" +echo " disk: $DISK" +echo " image: $IMAGE" +echo " type: $TYPE" +echo " disk size: $DISK_SIZE MB" +echo " system size: $SYSTEM_SIZE MB" +echo "storage size: $STORAGE_SIZE MB" + +# check for some required tools + + # this is needed to create a bootloader + which syslinux > /dev/null + if [ "$?" = "1" ]; then + echo "#########################################################" + echo "# #" + echo "# OpenELEC.tv missing tool - Installation will quit #" + echo "# #" + echo "# We can't find the required tool \"syslinux\" #" + echo "# on your system. #" + echo "# Please install it via your package manager. #" + echo "# #" + echo "#########################################################" + exit 1 + fi + + # this is needed to create a bootloader + which extlinux > /dev/null + if [ "$?" = "1" ]; then + echo "#########################################################" + echo "# #" + echo "# OpenELEC.tv missing tool - Installation will quit #" + echo "# #" + echo "# We can't find the required tool \"extlinux\" #" + echo "# on your system. #" + echo "# Please install it via your package manager. #" + echo "# #" + echo "#########################################################" + exit 1 + fi + + # this is needed by syslinux + which mcopy > /dev/null + if [ "$?" = "1" ]; then + echo "#########################################################" + echo "# #" + echo "# OpenELEC.tv missing tool - Installation will quit #" + echo "# #" + echo "# We can't find the required tool \"mcopy\" #" + echo "# on your system. #" + echo "# Please install it via your package manager. #" + echo "# NOTE: Some distributions call this package #" + echo "# \"mtools\". #" + echo "# #" + echo "#########################################################" + exit 1 + fi + + # this is needed to partion the drive + which parted > /dev/null + if [ "$?" = "1" ]; then + echo "#########################################################" + echo "# #" + echo "# OpenELEC.tv missing tool - Installation will quit #" + echo "# #" + echo "# We can't find the required tool \"parted\" #" + echo "# on your system. #" + echo "# Please install it via your package manager. #" + echo "# #" + echo "#########################################################" + exit 1 + fi + + # this is needed fo convert harddisk image to vmdk or vdi format + which qemu-img > /dev/null + if [ "$?" = "1" ]; then + echo "#########################################################" + echo "# #" + echo "# OpenELEC.tv missing tool - Installation will quit #" + echo "# #" + echo "# We can't find the required tool \"qemu-img\" #" + echo "# on your system. #" + echo "# Please install it via your package manager. #" + echo "# #" + echo "#########################################################" + exit 1 + fi + +# ensure loopX not in use + echo "" + echo "next two errors can be ignored..." + sync + umount "$LOOP" + losetup -d "$LOOP" + +# create an image + echo "" + echo "creating new empty harddisk image: $DISK..." + dd if=/dev/zero of="$DISK" bs=1M count="$DISK_SIZE" + +# write a disklabel + echo "" + echo "creating new partition table: $DISK..." + sync + losetup "$LOOP" "$DISK" + parted -s "$LOOP" mklabel msdos + +# create partition1 + echo "" + echo "creating partition1 on $DISK..." + SYSTEM_PART_END=$(( $SYSTEM_SIZE * 1024 * 1024 / 512 + 64 )) + parted -s "$LOOP" -a min unit s mkpart primary ext4 64 $SYSTEM_PART_END + +# create partition2 + echo "" + echo "creating partition2 on $DISK..." + STORAGE_PART_START=$(( $SYSTEM_PART_END + 1 )) + parted -s "$LOOP" -a min unit s mkpart primary ext4 $STORAGE_PART_START 100% + +# make partition1 active (bootable) + echo "" + echo "marking partition1 active..." + parted -s "$LOOP" set 1 boot on + +# write mbr + echo "" + echo "writing mbr..." + if [ -f /usr/lib/syslinux/mbr.bin ]; then + MBR="/usr/lib/syslinux/mbr.bin" # example: debian, ubuntu + elif [ -f /usr/share/syslinux/mbr.bin ]; then + MBR="/usr/share/syslinux/mbr.bin" # example: fedora + elif [ -f /usr/lib/syslinux/bios/mbr.bin ]; then + MBR="/usr/lib/syslinux/bios/mbr.bin" + else + echo "Can't find syslinux's mbr.bin on Host OS" + exit 1 + fi + + if [ -n "$MBR" ]; then + cat "$MBR" > "$LOOP" + fi + +# sync disk + echo "" + echo "syncing disk..." + sync + +# create filesystem on partition1 + echo "" + sync + losetup -d "$LOOP" + echo "creating filesystem on partition1..." + OFFSET=$(( 64 * 512 )) + SIZELIMIT=$(( $SYSTEM_SIZE * 1024 * 1024 )) + losetup -o $OFFSET --sizelimit $SIZELIMIT "$LOOP" "$DISK" + mke2fs -q -t ext4 -m 0 "$LOOP" + tune2fs -U random -L "System" "$LOOP" + sync + e2fsck -n "$LOOP" + +# mount partition + echo "" + echo "mounting partition1 on /tmp/vmware_install..." + mkdir -p /tmp/vmware_install + mount "$LOOP" /tmp/vmware_install + +# create bootloader configuration + echo "" + echo "creating bootloader configuration..." + + cat >/tmp/vmware_install/syslinux.cfg << EOF +DEFAULT linux +PROMPT 0 + +LABEL linux + KERNEL /KERNEL + APPEND boot=LABEL=System disk=LABEL=Storage quiet ssh + +EOF + +# install extlinux + echo "" + echo "installing extlinux to partition1..." + extlinux --heads=4 --sector=32 -i /tmp/vmware_install + +# copy files + echo "" + echo "copying files to partition1..." + cp target/KERNEL /tmp/vmware_install + cp target/SYSTEM /tmp/vmware_install + +# sync disk + echo "" + echo "syncing disk..." + sync + +# unmount partition1 + echo "" + echo "unmounting partition1..." + umount "$LOOP" + sync + +# create filesystem on partition2 + echo "" + sync + losetup -d "$LOOP" + echo "creating filesystem on partition2..." + OFFSET=$(( $STORAGE_PART_START * 512 )) + losetup -o $OFFSET "$LOOP" "$DISK" + mke2fs -q -t ext4 -m 0 "$LOOP" + tune2fs -U random -L "Storage" "$LOOP" + sync + e2fsck -n "$LOOP" + +# detach loopX + sync + losetup -d "$LOOP" + +# cleaning + echo "" + echo "cleaning tempdir..." + [ -f /tmp/vmware_install/ldlinux.sys ] && chattr -i /tmp/vmware_install/ldlinux.sys + rm -rf /tmp/vmware_install + +# convert image to vmdk or vdi + echo "" + echo "converting $DISK to $TYPE format..." + qemu-img convert -O $TYPE "$DISK" "$IMAGE" + rm -f "$DISK" + +# sync disk + echo "" + echo "syncing disk..." + sync + + echo "" + echo "installation finished..." + echo "" diff --git a/packages/tools/u-boot/package.mk b/packages/tools/u-boot/package.mk index e0e4070121e..3dce887d04c 100644 --- a/packages/tools/u-boot/package.mk +++ b/packages/tools/u-boot/package.mk @@ -17,21 +17,23 @@ ################################################################################ PKG_NAME="u-boot" -if [ "$UBOOT_VERSION" = "default" ]; then - PKG_VERSION="2011.03-rc1" - PKG_SITE="http://www.denx.de/wiki/U-Boot/WebHome" - PKG_URL="ftp://ftp.denx.de/pub/u-boot/$PKG_NAME-$PKG_VERSION.tar.bz2" -elif [ "$UBOOT_VERSION" = "imx6-cuboxi" ]; then - PKG_VERSION="imx6-e817fa3" +PKG_DEPENDS_TARGET="toolchain" +if [ "$UBOOT_VERSION" = "imx6-cuboxi" ]; then + PKG_VERSION="imx6-408544d" PKG_SITE="http://imx.solid-run.com/wiki/index.php?title=Building_the_kernel_and_u-boot_for_the_CuBox-i_and_the_HummingBoard" + # https://github.com/SolidRun/u-boot-imx6.git PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +elif [ "$UBOOT_VERSION" = "hardkernel" ]; then + PKG_VERSION="502b13b" + PKG_SITE="https://github.com/hardkernel/u-boot" + PKG_URL="https://github.com/hardkernel/u-boot/archive/$PKG_VERSION.tar.gz" + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET gcc-linaro-aarch64-none-elf:host" else exit 0 fi PKG_REV="1" -PKG_ARCH="arm" +PKG_ARCH="arm aarch64" PKG_LICENSE="GPL" -PKG_DEPENDS_TARGET="toolchain" PKG_PRIORITY="optional" PKG_SECTION="tools" PKG_SHORTDESC="u-boot: Universal Bootloader project" @@ -64,9 +66,16 @@ make_target() { done for UBOOT_TARGET in $UBOOT_CONFIG; do - make CROSS_COMPILE="$TARGET_PREFIX" ARCH="$TARGET_ARCH" mrproper - make CROSS_COMPILE="$TARGET_PREFIX" ARCH="$TARGET_ARCH" $UBOOT_TARGET - make CROSS_COMPILE="$TARGET_PREFIX" ARCH="$TARGET_ARCH" HOSTCC="$HOST_CC" HOSTSTRIP="true" + if [ "$PROJECT" = "Odroid_C2" ]; then + export PATH=$ROOT/$TOOLCHAIN/lib/gcc-linaro-aarch64-none-elf/bin/:$PATH + make CROSS_COMPILE=aarch64-none-elf- ARCH=arm mrproper + make CROSS_COMPILE=aarch64-none-elf- ARCH=arm $UBOOT_TARGET + make CROSS_COMPILE=aarch64-none-elf- ARCH=arm HOSTCC="$HOST_CC" HOSTSTRIP="true" + else + make CROSS_COMPILE="$TARGET_PREFIX" ARCH=arm mrproper + make CROSS_COMPILE="$TARGET_PREFIX" ARCH=arm $UBOOT_TARGET + make CROSS_COMPILE="$TARGET_PREFIX" ARCH=arm HOSTCC="$HOST_CC" HOSTSTRIP="true" + fi # rename files in case of multiple targets if [ $UBOOT_TARGET_CNT -gt 1 ]; then @@ -109,13 +118,22 @@ makeinstall_target() { mkdir -p $INSTALL/usr/share/bootloader - cp ./u-boot*.imx $INSTALL/usr/share/bootloader 2>/dev/null || : - cp ./u-boot*.img $INSTALL/usr/share/bootloader 2>/dev/null || : - cp ./SPL* $INSTALL/usr/share/bootloader 2>/dev/null || : - - cp ./$UBOOT_CONFIGFILE $INSTALL/usr/share/bootloader 2>/dev/null || : + cp $ROOT/$PKG_BUILD/u-boot*.imx $INSTALL/usr/share/bootloader 2>/dev/null || : + cp $ROOT/$PKG_BUILD/u-boot*.img $INSTALL/usr/share/bootloader 2>/dev/null || : + cp $ROOT/$PKG_BUILD/SPL* $INSTALL/usr/share/bootloader 2>/dev/null || : - cp -PRv $PKG_DIR/scripts/update.sh $INSTALL/usr/share/bootloader + cp $ROOT/$PKG_BUILD/$UBOOT_CONFIGFILE $INSTALL/usr/share/bootloader 2>/dev/null || : cp -PR $PROJECT_DIR/$PROJECT/bootloader/uEnv*.txt $INSTALL/usr/share/bootloader 2>/dev/null || : + + case $PROJECT in + Odroid_C2) + cp -PRv $PKG_DIR/scripts/update-c2.sh $INSTALL/usr/share/bootloader/update.sh + cp -PRv $ROOT/$PKG_BUILD/sd_fuse/bl1.bin.hardkernel $INSTALL/usr/share/bootloader/bl1 + cp -PRv $ROOT/$PKG_BUILD/sd_fuse/u-boot.bin $INSTALL/usr/share/bootloader/u-boot + ;; + imx6) + cp -PRv $PKG_DIR/scripts/update.sh $INSTALL/usr/share/bootloader + ;; + esac } diff --git a/packages/tools/u-boot/patches/2011.03-rc1/README b/packages/tools/u-boot/patches/2011.03-rc1/README deleted file mode 100644 index 18082d8db12..00000000000 --- a/packages/tools/u-boot/patches/2011.03-rc1/README +++ /dev/null @@ -1,4 +0,0 @@ -u-boot: add MMC SPL for OMAP4 patches by Aneesh V - -http://groups.google.com/group/x-loader/browse_frm/thread/ffa060e158ae220e -http://dev.omapzoom.org/?p=bootloader/u-boot.git;a=shortlog;h=refs/heads/omap_upstream_next \ No newline at end of file diff --git a/packages/tools/u-boot/patches/2011.03-rc1/u-boot-2011.03-rc1-0001-mkimage-Add-OMAP-boot-image-support.patch b/packages/tools/u-boot/patches/2011.03-rc1/u-boot-2011.03-rc1-0001-mkimage-Add-OMAP-boot-image-support.patch deleted file mode 100644 index 2373a86443c..00000000000 --- a/packages/tools/u-boot/patches/2011.03-rc1/u-boot-2011.03-rc1-0001-mkimage-Add-OMAP-boot-image-support.patch +++ /dev/null @@ -1,380 +0,0 @@ -From b295d8676ccb5b01d4ea7ba75ec6321a3c8837b7 Mon Sep 17 00:00:00 2001 -From: John Rigby <john.rigby@linaro.org> -Date: Thu, 17 Feb 2011 19:43:43 +0530 -Subject: [PATCH 01/22] mkimage: Add OMAP boot image support - -Signed-off-by: John Rigby <john.rigby@linaro.org> ---- - common/image.c | 1 + - include/image.h | 1 + - tools/Makefile | 2 + - tools/mkimage.c | 2 + - tools/mkimage.h | 1 + - tools/omapimage.c | 229 +++++++++++++++++++++++++++++++++++++++++++++++++++++ - tools/omapimage.h | 50 ++++++++++++ - 7 files changed, 286 insertions(+), 0 deletions(-) - create mode 100644 tools/omapimage.c - create mode 100644 tools/omapimage.h - -diff --git a/common/image.c b/common/image.c -index f63a2ff..4198d76 100644 ---- a/common/image.c -+++ b/common/image.c -@@ -141,6 +141,7 @@ static const table_entry_t uimage_type[] = { - { IH_TYPE_FLATDT, "flat_dt", "Flat Device Tree", }, - { IH_TYPE_KWBIMAGE, "kwbimage", "Kirkwood Boot Image",}, - { IH_TYPE_IMXIMAGE, "imximage", "Freescale i.MX Boot Image",}, -+ { IH_TYPE_OMAPIMAGE, "omapimage", "TI OMAP CH/GP Boot Image",}, - { -1, "", "", }, - }; - -diff --git a/include/image.h b/include/image.h -index 005e0d2..f74e2b9 100644 ---- a/include/image.h -+++ b/include/image.h -@@ -157,6 +157,7 @@ - #define IH_TYPE_FLATDT 8 /* Binary Flat Device Tree Blob */ - #define IH_TYPE_KWBIMAGE 9 /* Kirkwood Boot Image */ - #define IH_TYPE_IMXIMAGE 10 /* Freescale IMXBoot Image */ -+#define IH_TYPE_OMAPIMAGE 11 /* TI OMAP Config Header Image */ - - /* - * Compression Types -diff --git a/tools/Makefile b/tools/Makefile -index 623f908..a1c4ed7 100644 ---- a/tools/Makefile -+++ b/tools/Makefile -@@ -84,6 +84,7 @@ OBJ_FILES-$(CONFIG_CMD_LOADS) += img2srec.o - OBJ_FILES-$(CONFIG_INCA_IP) += inca-swap-bytes.o - NOPED_OBJ_FILES-y += kwbimage.o - NOPED_OBJ_FILES-y += imximage.o -+NOPED_OBJ_FILES-y += omapimage.o - NOPED_OBJ_FILES-y += mkimage.o - OBJ_FILES-$(CONFIG_NETCONSOLE) += ncb.o - NOPED_OBJ_FILES-y += os_support.o -@@ -180,6 +181,7 @@ $(obj)mkimage$(SFX): $(obj)crc32.o \ - $(obj)fit_image.o \ - $(obj)image.o \ - $(obj)imximage.o \ -+ $(obj)omapimage.o \ - $(obj)kwbimage.o \ - $(obj)md5.o \ - $(obj)mkimage.o \ -diff --git a/tools/mkimage.c b/tools/mkimage.c -index f5859d7..ec6d75e 100644 ---- a/tools/mkimage.c -+++ b/tools/mkimage.c -@@ -155,6 +155,8 @@ main (int argc, char **argv) - init_imx_image_type (); - /* Init FIT image generation/list support */ - init_fit_image_type (); -+ /* Init TI OMAP Boot image generation/list support */ -+ init_omap_image_type(); - /* Init Default image generation/list support */ - init_default_image_type (); - -diff --git a/tools/mkimage.h b/tools/mkimage.h -index 9033a7d..3b49645 100644 ---- a/tools/mkimage.h -+++ b/tools/mkimage.h -@@ -143,5 +143,6 @@ void init_kwb_image_type (void); - void init_imx_image_type (void); - void init_default_image_type (void); - void init_fit_image_type (void); -+void init_omap_image_type(void); - - #endif /* _MKIIMAGE_H_ */ -diff --git a/tools/omapimage.c b/tools/omapimage.c -new file mode 100644 -index 0000000..67fa056 ---- /dev/null -+++ b/tools/omapimage.c -@@ -0,0 +1,229 @@ -+/* -+ * (C) Copyright 2010 -+ * Linaro LTD, www.linaro.org -+ * Author: John Rigby <john.rigby@linaro.org> -+ * Based on TI's signGP.c -+ * -+ * (C) Copyright 2009 -+ * Stefano Babic, DENX Software Engineering, sbabic@denx.de. -+ * -+ * (C) Copyright 2008 -+ * Marvell Semiconductor <www.marvell.com> -+ * Written-by: Prafulla Wadaskar <prafulla@marvell.com> -+ * -+ * See file CREDITS for list of people who contributed to this -+ * project. -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License as -+ * published by the Free Software Foundation; either version 2 of -+ * the License, or (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+ * MA 02111-1307 USA -+ */ -+ -+/* Required to obtain the getline prototype from stdio.h */ -+#define _GNU_SOURCE -+ -+#include "mkimage.h" -+#include <image.h> -+#include "omapimage.h" -+ -+/* Header size is CH header rounded up to 512 bytes plus GP header */ -+#define OMAP_CH_HDR_SIZE 512 -+#define OMAP_GP_HDR_SIZE (sizeof(struct gp_header)) -+#define OMAP_FILE_HDR_SIZE (OMAP_CH_HDR_SIZE+OMAP_GP_HDR_SIZE) -+ -+static uint8_t omapimage_header[OMAP_FILE_HDR_SIZE]; -+ -+static int omapimage_check_image_types(uint8_t type) -+{ -+ if (type == IH_TYPE_OMAPIMAGE) -+ return EXIT_SUCCESS; -+ else -+ return EXIT_FAILURE; -+} -+ -+/* -+ * Only the simplest image type is currently supported: -+ * TOC pointing to CHSETTINGS -+ * TOC terminator -+ * CHSETTINGS -+ * -+ * padding to OMAP_CH_HDR_SIZE bytes -+ * -+ * gp header -+ * size -+ * load_addr -+ */ -+static int valid_gph_size(uint32_t size) -+{ -+ return size; -+} -+ -+static int valid_gph_load_addr(uint32_t load_addr) -+{ -+ return load_addr; -+} -+ -+static int omapimage_verify_header(unsigned char *ptr, int image_size, -+ struct mkimage_params *params) -+{ -+ struct ch_toc *toc = (struct ch_toc *)ptr; -+ struct gp_header *gph = (struct gp_header *)(ptr+OMAP_CH_HDR_SIZE); -+ uint32_t offset, size; -+ -+ while (toc->section_offset != 0xffffffff -+ && toc->section_size != 0xffffffff) { -+ offset = toc->section_offset; -+ size = toc->section_size; -+ if (!offset || !size) -+ return -1; -+ if (offset >= OMAP_CH_HDR_SIZE || -+ offset+size >= OMAP_CH_HDR_SIZE) -+ return -1; -+ toc++; -+ } -+ if (!valid_gph_size(gph->size)) -+ return -1; -+ if (!valid_gph_load_addr(gph->load_addr)) -+ return -1; -+ -+ return 0; -+} -+ -+static void omapimage_print_section(struct ch_settings *chs) -+{ -+ switch (chs->section_key) { -+ case KEY_CHSETTINGS: -+ printf("CHSETTINGS (%x) " -+ "valid:%x " -+ "version:%x " -+ "reserved:%x " -+ "flags:%x\n", -+ chs->section_key, -+ chs->valid, -+ chs->version, -+ chs->reserved, -+ chs->flags); -+ break; -+ default: -+ printf("UNKNOWNKEY (%x) " -+ "valid:%x " -+ "version:%x " -+ "reserved:%x " -+ "flags:%x\n", -+ chs->section_key, -+ chs->valid, -+ chs->version, -+ chs->reserved, -+ chs->flags); -+ break; -+ } -+} -+ -+static void omapimage_print_header(const void *ptr) -+{ -+ struct ch_toc *toc = (struct ch_toc *)ptr; -+ struct gp_header *gph = (struct gp_header *)(ptr+OMAP_CH_HDR_SIZE); -+ uint32_t offset, size; -+ -+ while (toc->section_offset != 0xffffffff -+ && toc->section_size != 0xffffffff) { -+ offset = toc->section_offset; -+ size = toc->section_size; -+ -+ if (offset >= OMAP_CH_HDR_SIZE || -+ offset+size >= OMAP_CH_HDR_SIZE) -+ exit(EXIT_FAILURE); -+ -+ printf("Section %s offset %x length %x\n", -+ toc->section_name, -+ toc->section_offset, -+ toc->section_size); -+ -+ omapimage_print_section((struct ch_settings *)(ptr+offset)); -+ toc++; -+ } -+ -+ if (!valid_gph_size(gph->size)) { -+ fprintf(stderr, -+ "Error: invalid image size %x\n", -+ gph->size); -+ exit(EXIT_FAILURE); -+ } -+ -+ if (!valid_gph_load_addr(gph->load_addr)) { -+ fprintf(stderr, -+ "Error: invalid image load address %x\n", -+ gph->size); -+ exit(EXIT_FAILURE); -+ } -+ -+ printf("GP Header: Size %x LoadAddr %x\n", -+ gph->size, gph->load_addr); -+} -+ -+static int toc_offset(void *hdr, void *member) -+{ -+ return member - hdr; -+} -+ -+static void omapimage_set_header(void *ptr, struct stat *sbuf, int ifd, -+ struct mkimage_params *params) -+{ -+ struct ch_toc *toc = (struct ch_toc *)ptr; -+ struct ch_settings *chs = (struct ch_settings *) -+ (ptr + 2 * sizeof(*toc)); -+ struct gp_header *gph = (struct gp_header *)(ptr + OMAP_CH_HDR_SIZE); -+ -+ toc->section_offset = toc_offset(ptr, chs); -+ toc->section_size = sizeof(struct ch_settings); -+ strcpy((char *)toc->section_name, "CHSETTINGS"); -+ -+ chs->section_key = KEY_CHSETTINGS; -+ chs->valid = 0; -+ chs->version = 1; -+ chs->reserved = 0; -+ chs->flags = 0; -+ -+ toc++; -+ memset(toc, 0xff, sizeof(*toc)); -+ -+ gph->size = sbuf->st_size - OMAP_FILE_HDR_SIZE; -+ gph->load_addr = params->addr; -+} -+ -+int omapimage_check_params(struct mkimage_params *params) -+{ -+ return (params->dflag && (params->fflag || params->lflag)) || -+ (params->fflag && (params->dflag || params->lflag)) || -+ (params->lflag && (params->dflag || params->fflag)); -+} -+ -+/* -+ * omapimage parameters -+ */ -+static struct image_type_params omapimage_params = { -+ .name = "TI OMAP CH/GP Boot Image support", -+ .header_size = OMAP_FILE_HDR_SIZE, -+ .hdr = (void *)&omapimage_header, -+ .check_image_type = omapimage_check_image_types, -+ .verify_header = omapimage_verify_header, -+ .print_header = omapimage_print_header, -+ .set_header = omapimage_set_header, -+ .check_params = omapimage_check_params, -+}; -+ -+void init_omap_image_type(void) -+{ -+ mkimage_register(&omapimage_params); -+} -diff --git a/tools/omapimage.h b/tools/omapimage.h -new file mode 100644 -index 0000000..7ff5404 ---- /dev/null -+++ b/tools/omapimage.h -@@ -0,0 +1,50 @@ -+/* -+ * (C) Copyright 2010 -+ * Linaro LTD, www.linaro.org -+ * Author John Rigby <john.rigby@linaro.org> -+ * Based on TI's signGP.c -+ * -+ * See file CREDITS for list of people who contributed to this -+ * project. -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License as -+ * published by the Free Software Foundation; either version 2 of -+ * the License, or (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+ * MA 02111-1307 USA -+ */ -+ -+#ifndef _OMAPIMAGE_H_ -+#define _OMAPIMAGE_H_ -+ -+struct ch_toc { -+ uint32_t section_offset; -+ uint32_t section_size; -+ uint8_t unused[12]; -+ uint8_t section_name[12]; -+} __attribute__ ((__packed__)); -+ -+struct ch_settings { -+ uint32_t section_key; -+ uint8_t valid; -+ uint8_t version; -+ uint16_t reserved; -+ uint32_t flags; -+} __attribute__ ((__packed__)); -+ -+struct gp_header { -+ uint32_t size; -+ uint32_t load_addr; -+} __attribute__ ((__packed__)); -+ -+#define KEY_CHSETTINGS 0xC0C0C0C1 -+#endif /* _OMAPIMAGE_H_ */ --- -1.7.2.3 - diff --git a/packages/tools/u-boot/patches/2011.03-rc1/u-boot-2011.03-rc1-0002-omap-add-miscellaneous-utility-macros-for-bit-field-.patch b/packages/tools/u-boot/patches/2011.03-rc1/u-boot-2011.03-rc1-0002-omap-add-miscellaneous-utility-macros-for-bit-field-.patch deleted file mode 100644 index 31fcded64fb..00000000000 --- a/packages/tools/u-boot/patches/2011.03-rc1/u-boot-2011.03-rc1-0002-omap-add-miscellaneous-utility-macros-for-bit-field-.patch +++ /dev/null @@ -1,71 +0,0 @@ -From d8a745be3a5d821ac9ab06a0899163681767941b Mon Sep 17 00:00:00 2001 -From: Aneesh V <aneesh@ti.com> -Date: Wed, 16 Feb 2011 23:45:35 +0530 -Subject: [PATCH 02/22] omap: add miscellaneous utility macros for bit-field operations - -Signed-off-by: Aneesh V <aneesh@ti.com> ---- - arch/arm/include/asm/omap_common.h | 51 ++++++++++++++++++++++++++++++++++++ - 1 files changed, 51 insertions(+), 0 deletions(-) - create mode 100644 arch/arm/include/asm/omap_common.h - -diff --git a/arch/arm/include/asm/omap_common.h b/arch/arm/include/asm/omap_common.h -new file mode 100644 -index 0000000..03db2f5 ---- /dev/null -+++ b/arch/arm/include/asm/omap_common.h -@@ -0,0 +1,51 @@ -+/* -+ * (C) Copyright 2010 -+ * Texas Instruments, <www.ti.com> -+ * -+ * Aneesh V <aneesh@ti.com> -+ * -+ * See file CREDITS for list of people who contributed to this -+ * project. -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License as -+ * published by the Free Software Foundation; either version 2 of -+ * the License, or (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+ * MA 02111-1307 USA -+ */ -+#ifndef _OMAP_COMMON_H_ -+#define _OMAP_COMMON_H_ -+ -+/* extract a bit field from a bit vector */ -+#define get_bit_field(nr, start, mask)\ -+ (((nr) & (mask)) >> (start)) -+ -+/* Set a field in a bit vector */ -+#define set_bit_field(nr, start, mask, val)\ -+ do { \ -+ (nr) = ((nr) & ~(mask)) | (((val) << (start)) & (mask));\ -+ } while (0); -+ -+/* -+ * Utility macro for read-modify-write of a hardware register -+ * addr - address of the register -+ * shift - starting bit position of the field to be modified -+ * msk - mask for the field -+ * val - value to be shifted masked and written to the field -+ */ -+#define modify_reg_32(addr, shift, msk, val) \ -+ do {\ -+ writel(((readl(addr) & ~(msk))|(((val) << (shift)) & (msk))),\ -+ (addr));\ -+ } while (0); -+ -+#endif /* _OMAP_COMMON_H_ */ --- -1.7.2.3 - diff --git a/packages/tools/u-boot/patches/2011.03-rc1/u-boot-2011.03-rc1-0003-omap4-add-OMAP4430-revision-check.patch b/packages/tools/u-boot/patches/2011.03-rc1/u-boot-2011.03-rc1-0003-omap4-add-OMAP4430-revision-check.patch deleted file mode 100644 index 2ad6af9a5c5..00000000000 --- a/packages/tools/u-boot/patches/2011.03-rc1/u-boot-2011.03-rc1-0003-omap4-add-OMAP4430-revision-check.patch +++ /dev/null @@ -1,137 +0,0 @@ -From 3130b153ed6d6d1e486973a5d782e0480db748d6 Mon Sep 17 00:00:00 2001 -From: Aneesh V <aneesh@ti.com> -Date: Wed, 16 Feb 2011 23:51:21 +0530 -Subject: [PATCH 03/22] omap4: add OMAP4430 revision check - -Signed-off-by: Aneesh V <aneesh@ti.com> ---- - arch/arm/cpu/armv7/omap4/board.c | 35 +++++++++++++++++++++++++++++++ - arch/arm/include/asm/arch-omap4/omap4.h | 17 +++++++++----- - arch/arm/include/asm/armv7.h | 31 +++++++++++++++++++++++++++ - 3 files changed, 77 insertions(+), 6 deletions(-) - create mode 100644 arch/arm/include/asm/armv7.h - -diff --git a/arch/arm/cpu/armv7/omap4/board.c b/arch/arm/cpu/armv7/omap4/board.c -index fcd29a7..7583a0d 100644 ---- a/arch/arm/cpu/armv7/omap4/board.c -+++ b/arch/arm/cpu/armv7/omap4/board.c -@@ -28,6 +28,7 @@ - * MA 02111-1307 USA - */ - #include <common.h> -+#include <asm/armv7.h> - #include <asm/arch/cpu.h> - #include <asm/arch/sys_proto.h> - #include <asm/sizes.h> -@@ -127,3 +128,37 @@ int arch_cpu_init(void) - set_muxconf_regs(); - return 0; - } -+ -+static u32 cortex_a9_rev(void) -+{ -+ -+ unsigned int rev; -+ -+ /* Read Main ID Register (MIDR) */ -+ asm ("mrc p15, 0, %0, c0, c0, 0" : "=r" (rev)); -+ -+ return rev; -+} -+ -+u32 omap4_revision(void) -+{ -+ if (readl(CONTROL_ID_CODE) == OMAP4_CONTROL_ID_CODE_ES2_1) -+ return OMAP4430_ES2_1; -+ else if (readl(CONTROL_ID_CODE) == OMAP4_CONTROL_ID_CODE_ES2_2) -+ return OMAP4430_ES2_2; -+ /* -+ * For some of the ES2/ES1 boards ID_CODE is not reliable: -+ * Also, ES1 and ES2 have different ARM revisions -+ * So use ARM revision for identification -+ */ -+ unsigned int rev = cortex_a9_rev(); -+ -+ switch (rev) { -+ case MIDR_CORTEX_A9_R0P1: -+ return OMAP4430_ES1_0; -+ case MIDR_CORTEX_A9_R1P2: -+ return OMAP4430_ES2_0; -+ default: -+ return OMAP4430_SILICON_ID_INVALID; -+ } -+} -diff --git a/arch/arm/include/asm/arch-omap4/omap4.h b/arch/arm/include/asm/arch-omap4/omap4.h -index a30bb33..1f88732 100644 ---- a/arch/arm/include/asm/arch-omap4/omap4.h -+++ b/arch/arm/include/asm/arch-omap4/omap4.h -@@ -51,6 +51,11 @@ - #define CONTROL_PADCONF_CORE (OMAP44XX_L4_CORE_BASE + 0x100000) - #define CONTROL_PADCONF_WKUP (OMAP44XX_L4_CORE_BASE + 0x31E000) - -+/* CONTROL_ID_CODE */ -+#define CONTROL_ID_CODE (CTRL_BASE + 0x204) -+ -+#define OMAP4_CONTROL_ID_CODE_ES2_1 0x3B95C02F -+#define OMAP4_CONTROL_ID_CODE_ES2_2 0x4B95C02F - /* UART */ - #define UART1_BASE (OMAP44XX_L4_PER_BASE + 0x6a000) - #define UART2_BASE (OMAP44XX_L4_PER_BASE + 0x6c000) -@@ -121,11 +126,11 @@ struct s32ktimer { - /* Temporary SRAM stack used while low level init is done */ - #define LOW_LEVEL_SRAM_STACK NON_SECURE_SRAM_END - --/* -- * OMAP4 real hardware: -- * TODO: Change this to the IDCODE in the hw regsiter -- */ --#define CPU_OMAP4430_ES10 1 --#define CPU_OMAP4430_ES20 2 -+/* Silicon revisions */ -+#define OMAP4430_SILICON_ID_INVALID 0 -+#define OMAP4430_ES1_0 1 -+#define OMAP4430_ES2_0 2 -+#define OMAP4430_ES2_1 3 -+#define OMAP4430_ES2_2 4 - - #endif -diff --git a/arch/arm/include/asm/armv7.h b/arch/arm/include/asm/armv7.h -new file mode 100644 -index 0000000..6c24a80 ---- /dev/null -+++ b/arch/arm/include/asm/armv7.h -@@ -0,0 +1,31 @@ -+/* -+ * (C) Copyright 2010 -+ * Texas Instruments Incorporated - http://www.ti.com/ -+ * -+ * Aneesh V <aneesh@ti.com> -+ * -+ * See file CREDITS for list of people who contributed to this -+ * project. -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License as -+ * published by the Free Software Foundation; either version 2 of -+ * the License, or (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+ * MA 02111-1307 USA -+ */ -+#ifndef ARMV7_H -+#define ARMV7_H -+ -+#define MIDR_CORTEX_A9_R0P1 0x410FC091 -+#define MIDR_CORTEX_A9_R1P2 0x411FC092 -+ -+#endif /* ARMV7_H */ --- -1.7.2.3 - diff --git a/packages/tools/u-boot/patches/2011.03-rc1/u-boot-2011.03-rc1-0004-armv7-start.S-provide-a-hook-for-saving-boot-params.patch b/packages/tools/u-boot/patches/2011.03-rc1/u-boot-2011.03-rc1-0004-armv7-start.S-provide-a-hook-for-saving-boot-params.patch deleted file mode 100644 index 7dc0a596ef2..00000000000 --- a/packages/tools/u-boot/patches/2011.03-rc1/u-boot-2011.03-rc1-0004-armv7-start.S-provide-a-hook-for-saving-boot-params.patch +++ /dev/null @@ -1,51 +0,0 @@ -From 19eb02e3bb2e569b7269019eb0e116220daac23f Mon Sep 17 00:00:00 2001 -From: Aneesh V <aneesh@ti.com> -Date: Thu, 17 Feb 2011 16:49:05 +0530 -Subject: [PATCH 04/22] armv7: start.S: provide a hook for saving boot params - -Provide a means by which u-boot/SPL can save parameters passed -to it by ROM code or the pre-loader. - -A new function 'save_boot_params' has been defined and a default -implentation provided. Please note that we do not have a stack yet. -So, any implementation of this function should not use stack. - -Signed-off-by: Aneesh V <aneesh@ti.com> ---- - arch/arm/cpu/armv7/cpu.c | 7 +++++++ - arch/arm/cpu/armv7/start.S | 1 + - 2 files changed, 8 insertions(+), 0 deletions(-) - -diff --git a/arch/arm/cpu/armv7/cpu.c b/arch/arm/cpu/armv7/cpu.c -index a01e0d6..54533fc 100644 ---- a/arch/arm/cpu/armv7/cpu.c -+++ b/arch/arm/cpu/armv7/cpu.c -@@ -41,6 +41,13 @@ - - static void cache_flush(void); - -+void save_boot_params_default(u32 r0, u32 r1, u32 r2, u32 r3) -+{ -+} -+ -+void save_boot_params(u32 r0, u32 r1, u32 r2, u32 r3) -+ __attribute__((weak, alias("save_boot_params_default"))); -+ - int cleanup_before_linux(void) - { - unsigned int i; -diff --git a/arch/arm/cpu/armv7/start.S b/arch/arm/cpu/armv7/start.S -index cb4f92f..3618190 100644 ---- a/arch/arm/cpu/armv7/start.S -+++ b/arch/arm/cpu/armv7/start.S -@@ -103,6 +103,7 @@ IRQ_STACK_START_IN: - */ - - reset: -+ bl save_boot_params - /* - * set the cpu to SVC32 mode - */ --- -1.7.2.3 - diff --git a/packages/tools/u-boot/patches/2011.03-rc1/u-boot-2011.03-rc1-0005-omap4-save-parameters-passed-by-ROM-code-to-SPL.patch b/packages/tools/u-boot/patches/2011.03-rc1/u-boot-2011.03-rc1-0005-omap4-save-parameters-passed-by-ROM-code-to-SPL.patch deleted file mode 100644 index a1a8c235faa..00000000000 --- a/packages/tools/u-boot/patches/2011.03-rc1/u-boot-2011.03-rc1-0005-omap4-save-parameters-passed-by-ROM-code-to-SPL.patch +++ /dev/null @@ -1,151 +0,0 @@ -From de5b300f43e95b8b73252147a3ea492a8647d27d Mon Sep 17 00:00:00 2001 -From: Aneesh V <aneesh@ti.com> -Date: Sun, 27 Feb 2011 19:25:16 +0530 -Subject: [PATCH 05/22] omap4: save parameters passed by ROM code to SPL - -Save boot device information passed by OMAP4 rom code - -ROM code in OMAP4 passes information such as the media from -which it picked up the first boot image(SPL in our case), -the mode(raw mode/FAT mode) etc. - -Save this information in SPL so that we can use the same media -and mode to bootload u-boot. - -Signed-off-by: Aneesh V <aneesh@ti.com> ---- - arch/arm/cpu/armv7/omap4/board.c | 14 ++++++++++++ - arch/arm/cpu/armv7/omap4/lowlevel_init.S | 31 +++++++++++++++++++++++++++ - arch/arm/include/asm/arch-omap4/omap4.h | 8 +++++++ - arch/arm/include/asm/arch-omap4/sys_proto.h | 1 + - arch/arm/include/asm/omap_common.h | 20 +++++++++++++++++ - 5 files changed, 74 insertions(+), 0 deletions(-) - -diff --git a/arch/arm/cpu/armv7/omap4/board.c b/arch/arm/cpu/armv7/omap4/board.c -index 7583a0d..a5d585b 100644 ---- a/arch/arm/cpu/armv7/omap4/board.c -+++ b/arch/arm/cpu/armv7/omap4/board.c -@@ -35,6 +35,20 @@ - - DECLARE_GLOBAL_DATA_PTR; - -+#ifdef CONFIG_PRELOADER -+u32 omap4_boot_device = BOOT_DEVICE_MMC1; -+u32 omap4_boot_mode = MMCSD_MODE_FAT; -+u32 omap_boot_device(void) -+{ -+ return omap4_boot_device; -+} -+ -+u32 omap_boot_mode(void) -+{ -+ return omap4_boot_mode; -+} -+#endif -+ - /* - * Routine: s_init - * Description: Does early system init of muxing and clocks. -diff --git a/arch/arm/cpu/armv7/omap4/lowlevel_init.S b/arch/arm/cpu/armv7/omap4/lowlevel_init.S -index 026dfa4..250c73d 100644 ---- a/arch/arm/cpu/armv7/omap4/lowlevel_init.S -+++ b/arch/arm/cpu/armv7/omap4/lowlevel_init.S -@@ -27,6 +27,37 @@ - */ - - #include <asm/arch/omap4.h> -+#ifdef CONFIG_PRELOADER -+.global save_boot_params -+save_boot_params: -+ /* -+ * See if the rom code passed pointer is valid: -+ * It is not valid if it is not in non-secure SRAM -+ * This may happen if you are booting with the help of -+ * debugger -+ */ -+ ldr r2, =NON_SECURE_SRAM_START -+ cmp r2, r0 -+ bgt 1f -+ ldr r2, =NON_SECURE_SRAM_END -+ cmp r2, r0 -+ blt 1f -+ -+ /* Store the boot device in omap4_boot_device */ -+ ldr r2, [r0, #BOOT_DEVICE_OFFSET] @ r1 <- value of boot device -+ and r2, #BOOT_DEVICE_MASK -+ ldr r3, =omap4_boot_device -+ str r2, [r3] @ omap4_boot_device <- r1 -+ -+ /* Store the boot mode (raw/FAT) in omap4_boot_mode */ -+ ldr r2, [r0, #DEV_DESC_PTR_OFFSET] @ get the device descriptor ptr -+ ldr r2, [r2, #DEV_DATA_PTR_OFFSET] @ get the pDeviceData ptr -+ ldr r2, [r2, #BOOT_MODE_OFFSET] @ get the boot mode -+ ldr r3, =omap4_boot_mode -+ str r2, [r3] -+1: -+ bx lr -+#endif - - .globl lowlevel_init - lowlevel_init: -diff --git a/arch/arm/include/asm/arch-omap4/omap4.h b/arch/arm/include/asm/arch-omap4/omap4.h -index 1f88732..740ca9d 100644 ---- a/arch/arm/include/asm/arch-omap4/omap4.h -+++ b/arch/arm/include/asm/arch-omap4/omap4.h -@@ -133,4 +133,12 @@ struct s32ktimer { - #define OMAP4430_ES2_1 3 - #define OMAP4430_ES2_2 4 - -+/* ROM code defines */ -+/* Boot device */ -+#define BOOT_DEVICE_MASK 0xFF -+#define BOOT_DEVICE_OFFSET 0x8 -+#define DEV_DESC_PTR_OFFSET 0x4 -+#define DEV_DATA_PTR_OFFSET 0x18 -+#define BOOT_MODE_OFFSET 0x8 -+ - #endif -diff --git a/arch/arm/include/asm/arch-omap4/sys_proto.h b/arch/arm/include/asm/arch-omap4/sys_proto.h -index 4813e9e..ce86b36 100644 ---- a/arch/arm/include/asm/arch-omap4/sys_proto.h -+++ b/arch/arm/include/asm/arch-omap4/sys_proto.h -@@ -23,6 +23,7 @@ - - #include <asm/arch/omap4.h> - #include <asm/io.h> -+#include <asm/omap_common.h> - - struct omap_sysinfo { - char *board_string; -diff --git a/arch/arm/include/asm/omap_common.h b/arch/arm/include/asm/omap_common.h -index 03db2f5..06c511c 100644 ---- a/arch/arm/include/asm/omap_common.h -+++ b/arch/arm/include/asm/omap_common.h -@@ -48,4 +48,24 @@ - (addr));\ - } while (0); - -+/* Boot device */ -+#define BOOT_DEVICE_NONE 0 -+#define BOOT_DEVICE_XIP 1 -+#define BOOT_DEVICE_XIPWAIT 2 -+#define BOOT_DEVICE_NAND 3 -+#define BOOT_DEVICE_ONE_NAND 4 -+#define BOOT_DEVICE_MMC1 5 -+#define BOOT_DEVICE_MMC2 6 -+ -+/* Boot type */ -+#define MMCSD_MODE_UNDEFINED 0 -+#define MMCSD_MODE_RAW 1 -+#define MMCSD_MODE_FAT 2 -+ -+/* Magic number passed from SPL to U-Boot */ -+#define OMAP_SPL_TO_UBOOT_MAGIC_NUMBER 0xDEADBEEF -+ -+u32 omap_boot_device(void); -+u32 omap_boot_mode(void); -+ - #endif /* _OMAP_COMMON_H_ */ --- -1.7.2.3 - diff --git a/packages/tools/u-boot/patches/2011.03-rc1/u-boot-2011.03-rc1-0006-arm-new-labels-in-the-linker-script-file.patch b/packages/tools/u-boot/patches/2011.03-rc1/u-boot-2011.03-rc1-0006-arm-new-labels-in-the-linker-script-file.patch deleted file mode 100644 index dfcc7732bf8..00000000000 --- a/packages/tools/u-boot/patches/2011.03-rc1/u-boot-2011.03-rc1-0006-arm-new-labels-in-the-linker-script-file.patch +++ /dev/null @@ -1,72 +0,0 @@ -From 230ff2d889e392b64ce3bc86541bb4591aeabad2 Mon Sep 17 00:00:00 2001 -From: Aneesh V <aneesh@ti.com> -Date: Thu, 17 Feb 2011 03:16:38 +0530 -Subject: [PATCH 06/22] arm: new labels in the linker script file - -_bss_start_ofs is used in start.S to indicate end of copied -image. This may not be correct when we have a discontiguous -memory map. For instance, .bss may be placed in SDRAM for -some SPLS while rest of the image is placed in SRAM. - -Define a new label in linker script to indicate the end of the -image copied during relocation and use it appropriately in -start.S. - -Also, add a new label to indicate the end of flash image. -This will be useful in identifying the size of flash image - -Signed-off-by: Aneesh V <aneesh@ti.com> ---- - arch/arm/cpu/armv7/start.S | 6 +++++- - arch/arm/cpu/armv7/u-boot.lds | 4 ++++ - 2 files changed, 9 insertions(+), 1 deletions(-) - -diff --git a/arch/arm/cpu/armv7/start.S b/arch/arm/cpu/armv7/start.S -index 3618190..8215d26 100644 ---- a/arch/arm/cpu/armv7/start.S -+++ b/arch/arm/cpu/armv7/start.S -@@ -77,6 +77,10 @@ _TEXT_BASE: - _bss_start_ofs: - .word __bss_start - _start - -+.global _image_copy_end_ofs -+_image_copy_end_ofs: -+ .word __image_copy_end - _start -+ - .globl _bss_end_ofs - _bss_end_ofs: - .word _end - _start -@@ -172,7 +176,7 @@ stack_setup: - beq clear_bss /* skip relocation */ - #endif - mov r1, r6 /* r1 <- scratch for copy_loop */ -- ldr r3, _bss_start_ofs -+ ldr r3, _image_copy_end_ofs - add r2, r0, r3 /* r2 <- source end address */ - - copy_loop: -diff --git a/arch/arm/cpu/armv7/u-boot.lds b/arch/arm/cpu/armv7/u-boot.lds -index 5725c30..c3ad587 100644 ---- a/arch/arm/cpu/armv7/u-boot.lds -+++ b/arch/arm/cpu/armv7/u-boot.lds -@@ -55,6 +55,8 @@ SECTIONS - - . = ALIGN(4); - -+ __image_copy_end = .; -+ - .rel.dyn : { - __rel_dyn_start = .; - *(.rel*) -@@ -66,6 +68,8 @@ SECTIONS - *(.dynsym) - } - -+ __flash_image_end = .; -+ - .bss __rel_dyn_start (OVERLAY) : { - __bss_start = .; - *(.bss) --- -1.7.2.3 - diff --git a/packages/tools/u-boot/patches/2011.03-rc1/u-boot-2011.03-rc1-0007-Add-generic-spl-infrastructure.patch b/packages/tools/u-boot/patches/2011.03-rc1/u-boot-2011.03-rc1-0007-Add-generic-spl-infrastructure.patch deleted file mode 100644 index 5ac6bba9f9e..00000000000 --- a/packages/tools/u-boot/patches/2011.03-rc1/u-boot-2011.03-rc1-0007-Add-generic-spl-infrastructure.patch +++ /dev/null @@ -1,91 +0,0 @@ -From 9b4dfdc49a0e88f6a5292dbcb6c4260888258380 Mon Sep 17 00:00:00 2001 -From: Aneesh V <aneesh@ti.com> -Date: Thu, 17 Feb 2011 01:23:29 +0530 -Subject: [PATCH 07/22] Add generic spl infrastructure - -Define a new type of SPL that is not tied to any particular media. -- Create a top level directory 'spl' that has a structure similar - to the existing 'nand_spl' -- Make necessary changes to top-level Makefile to build such an spl - -Rationale for this approach: -- There may be SPLs(like the OMAP x-loader) that support booting from - multiple media. -- Also, there is no harm in keeping SPLs specific to a particular media - also under this directory. In fact it makes sense to merge all the - different spl directories into this one. - -Signed-off-by: Aneesh V <aneesh@ti.com> ---- - Makefile | 11 +++++++++++ - arch/arm/include/asm/global_data.h | 5 +++++ - 2 files changed, 16 insertions(+), 0 deletions(-) - -diff --git a/Makefile b/Makefile -index dc2e3d8..21e51c8 100644 ---- a/Makefile -+++ b/Makefile -@@ -293,6 +293,11 @@ NAND_SPL = nand_spl - U_BOOT_NAND = $(obj)u-boot-nand.bin - endif - -+ifeq ($(CONFIG_SPL),y) -+.PHONEY : SPL -+ALL += SPL -+endif -+ - ifeq ($(CONFIG_ONENAND_U_BOOT),y) - ONENAND_IPL = onenand_ipl - U_BOOT_ONENAND = $(obj)u-boot-onenand.bin -@@ -402,6 +407,9 @@ $(LDSCRIPT): depend - $(obj)u-boot.lds: $(LDSCRIPT) - $(CPP) $(CPPFLAGS) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ -P - <$^ >$@ - -+SPL :$(TIMESTAMP_FILE) $(VERSION_FILE) depend tools -+ $(MAKE) -C spl/board/$(BOARDDIR) all -+ - $(NAND_SPL): $(TIMESTAMP_FILE) $(VERSION_FILE) depend - $(MAKE) -C nand_spl/board/$(BOARDDIR) all - -@@ -1138,6 +1146,7 @@ clean: - @rm -f $(obj)include/bmp_logo.h - @rm -f $(obj)lib/asm-offsets.s - @rm -f $(obj)nand_spl/{u-boot.lds,u-boot-spl,u-boot-spl.map,System.map} -+ @rm -f $(obj)spl/{u-boot-spl-generated.lds,u-boot-spl,u-boot-spl.map} - @rm -f $(obj)onenand_ipl/onenand-{ipl,ipl.bin,ipl.map} - @rm -f $(ONENAND_BIN) - @rm -f $(obj)onenand_ipl/u-boot.lds -@@ -1157,12 +1166,14 @@ clobber: clean - @rm -f $(obj)u-boot $(obj)u-boot.map $(obj)u-boot.hex $(ALL) - @rm -f $(obj)u-boot.kwb - @rm -f $(obj)u-boot.imx -+ @rm -f $(obj)MLO - @rm -f $(obj)tools/{env/crc32.c,inca-swap-bytes} - @rm -f $(obj)arch/powerpc/cpu/mpc824x/bedbug_603e.c - @rm -fr $(obj)include/asm/proc $(obj)include/asm/arch $(obj)include/asm - @rm -fr $(obj)include/generated - @[ ! -d $(obj)nand_spl ] || find $(obj)nand_spl -name "*" -type l -print | xargs rm -f - @[ ! -d $(obj)onenand_ipl ] || find $(obj)onenand_ipl -name "*" -type l -print | xargs rm -f -+ @[ ! -d $(obj)spl ] || find $(obj)spl -name "*" -type l -print | xargs rm -f - - ifeq ($(OBJTREE),$(SRCTREE)) - mrproper \ -diff --git a/arch/arm/include/asm/global_data.h b/arch/arm/include/asm/global_data.h -index 2a84d27..2ce020e 100644 ---- a/arch/arm/include/asm/global_data.h -+++ b/arch/arm/include/asm/global_data.h -@@ -89,6 +89,11 @@ typedef struct global_data { - #define GD_FLG_DISABLE_CONSOLE 0x00040 /* Disable console (in & out) */ - #define GD_FLG_ENV_READY 0x00080 /* Environment imported into hash table */ - -+#ifdef CONFIG_PRELOADER -+/* SPL works from internal RAM. gd pointer can be in .data section */ -+#define DECLARE_GLOBAL_DATA_PTR extern gd_t *gd -+#else - #define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("r8") -+#endif - - #endif /* __ASM_GBL_DATA_H */ --- -1.7.2.3 - diff --git a/packages/tools/u-boot/patches/2011.03-rc1/u-boot-2011.03-rc1-0008-armv7-start.S-add-SPL-support.patch b/packages/tools/u-boot/patches/2011.03-rc1/u-boot-2011.03-rc1-0008-armv7-start.S-add-SPL-support.patch deleted file mode 100644 index bb6de4a0688..00000000000 --- a/packages/tools/u-boot/patches/2011.03-rc1/u-boot-2011.03-rc1-0008-armv7-start.S-add-SPL-support.patch +++ /dev/null @@ -1,110 +0,0 @@ -From cd0fbadb46f30c0630519d7b3e4388dc5a5c7baf Mon Sep 17 00:00:00 2001 -From: Aneesh V <aneesh@ti.com> -Date: Thu, 17 Feb 2011 15:47:21 +0530 -Subject: [PATCH 08/22] armv7: start.S: add SPL support - -Changes for supporting SPL - -Signed-off-by: Aneesh V <aneesh@ti.com> ---- - arch/arm/cpu/armv7/start.S | 36 +++++++++++++++++++++++++----------- - 1 files changed, 25 insertions(+), 11 deletions(-) - -diff --git a/arch/arm/cpu/armv7/start.S b/arch/arm/cpu/armv7/start.S -index 8215d26..f5f08d9 100644 ---- a/arch/arm/cpu/armv7/start.S -+++ b/arch/arm/cpu/armv7/start.S -@@ -42,7 +42,16 @@ _start: b reset - ldr pc, _not_used - ldr pc, _irq - ldr pc, _fiq -- -+#ifdef CONFIG_PRELOADER -+_undefined_instruction: .word _undefined_instruction -+_software_interrupt: .word _software_interrupt -+_prefetch_abort: .word _prefetch_abort -+_data_abort: .word _data_abort -+_not_used: .word _not_used -+_irq: .word _irq -+_fiq: .word _fiq -+_pad: .word 0x12345678 /* now 16*4=64 */ -+#else - _undefined_instruction: .word undefined_instruction - _software_interrupt: .word software_interrupt - _prefetch_abort: .word prefetch_abort -@@ -51,6 +60,8 @@ _not_used: .word not_used - _irq: .word irq - _fiq: .word fiq - _pad: .word 0x12345678 /* now 16*4=64 */ -+#endif /* CONFIG_PRELOADER */ -+ - .global _end_vect - _end_vect: - -@@ -171,10 +182,9 @@ stack_setup: - mov sp, r4 - - adr r0, _start --#ifndef CONFIG_PRELOADER - cmp r0, r6 -+ moveq r9, #0 /* no relocation. relocation offset(r9) = 0 */ - beq clear_bss /* skip relocation */ --#endif - mov r1, r6 /* r1 <- scratch for copy_loop */ - ldr r3, _image_copy_end_ofs - add r2, r0, r3 /* r2 <- source end address */ -@@ -224,6 +234,15 @@ fixnext: - add r2, r2, #8 /* each rel.dyn entry is 8 bytes */ - cmp r2, r3 - blo fixloop -+ b clear_bss -+_rel_dyn_start_ofs: -+ .word __rel_dyn_start - _start -+_rel_dyn_end_ofs: -+ .word __rel_dyn_end - _start -+_dynsym_start_ofs: -+ .word __dynsym_start - _start -+ -+#endif /* #ifndef CONFIG_PRELOADER */ - - clear_bss: - ldr r0, _bss_start_ofs -@@ -237,7 +256,6 @@ clbss_l:str r2, [r0] /* clear loop... */ - add r0, r0, #4 - cmp r0, r1 - bne clbss_l --#endif /* #ifndef CONFIG_PRELOADER */ - - /* - * We are done. Do not return, instead branch to second part of board -@@ -257,13 +275,6 @@ jump_2_ram: - _board_init_r_ofs: - .word board_init_r - _start - --_rel_dyn_start_ofs: -- .word __rel_dyn_start - _start --_rel_dyn_end_ofs: -- .word __rel_dyn_end - _start --_dynsym_start_ofs: -- .word __dynsym_start - _start -- - /************************************************************************* - * - * CPU_init_critical registers -@@ -300,6 +311,8 @@ cpu_init_crit: - bl lowlevel_init @ go setup pll,mux,memory - mov lr, ip @ restore link - mov pc, lr @ back to my caller -+ -+#ifndef CONFIG_PRELOADER - /* - ************************************************************************* - * -@@ -488,3 +501,4 @@ fiq: - bl do_fiq - - #endif -+#endif /* CONFIG_PRELOADER */ --- -1.7.2.3 - diff --git a/packages/tools/u-boot/patches/2011.03-rc1/u-boot-2011.03-rc1-0009-omap-add-spl-support.patch b/packages/tools/u-boot/patches/2011.03-rc1/u-boot-2011.03-rc1-0009-omap-add-spl-support.patch deleted file mode 100644 index 9bf74fa33ec..00000000000 --- a/packages/tools/u-boot/patches/2011.03-rc1/u-boot-2011.03-rc1-0009-omap-add-spl-support.patch +++ /dev/null @@ -1,140 +0,0 @@ -From 973a64f88d69d1c50409beaf83987f258b19cf8d Mon Sep 17 00:00:00 2001 -From: Aneesh V <aneesh@ti.com> -Date: Thu, 17 Feb 2011 17:50:06 +0530 -Subject: [PATCH 09/22] omap: add spl support - -Add the basic spl framework and linker script common for OMAP3/4 -platforms. - -Signed-off-by: Aneesh V <aneesh@ti.com> ---- - spl/board/ti/spl-omap.c | 47 ++++++++++++++++++++++++++++++++++ - spl/board/ti/spl-omap.lds | 62 +++++++++++++++++++++++++++++++++++++++++++++ - 2 files changed, 109 insertions(+), 0 deletions(-) - create mode 100644 spl/board/ti/spl-omap.c - create mode 100644 spl/board/ti/spl-omap.lds - -diff --git a/spl/board/ti/spl-omap.c b/spl/board/ti/spl-omap.c -new file mode 100644 -index 0000000..0e08f4f ---- /dev/null -+++ b/spl/board/ti/spl-omap.c -@@ -0,0 +1,47 @@ -+/* -+ * -+ * Clock initialization for OMAP4 -+ * -+ * (C) Copyright 2010 -+ * Texas Instruments, <www.ti.com> -+ * -+ * Aneesh V <aneesh@ti.com> -+ * -+ * See file CREDITS for list of people who contributed to this -+ * project. -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License as -+ * published by the Free Software Foundation; either version 2 of -+ * the License, or (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+ * MA 02111-1307 USA -+ */ -+#include <common.h> -+#include <asm/u-boot.h> -+#include <asm/arch/sys_proto.h> -+#include <timestamp_autogenerated.h> -+ -+/* Define global data structure pointer to it*/ -+gd_t gdata __attribute__ ((section(".data"))); -+bd_t bdata __attribute__ ((section(".data"))); -+gd_t *gd = &gdata; -+ -+void board_init_f(ulong dummy) -+{ -+ relocate_code(CONFIG_SYS_SPL_STACK, &gdata, CONFIG_SYS_SPL_TEXT_BASE); -+} -+ -+void board_init_r(gd_t *id, ulong dummy) -+{ -+ for (;;) -+ ; -+} -diff --git a/spl/board/ti/spl-omap.lds b/spl/board/ti/spl-omap.lds -new file mode 100644 -index 0000000..27b5295 ---- /dev/null -+++ b/spl/board/ti/spl-omap.lds -@@ -0,0 +1,62 @@ -+/* -+ * (C) Copyright 2002 -+ * Gary Jennejohn, DENX Software Engineering, <garyj@denx.de> -+ * -+ * (C) Copyright 2010 -+ * Texas Instruments, <www.ti.com> -+ * Aneesh V <aneesh@ti.com> -+ * -+ * See file CREDITS for list of people who contributed to this -+ * project. -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License as -+ * published by the Free Software Foundation; either version 2 of -+ * the License, or (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+ * MA 02111-1307 USA -+ */ -+ -+MEMORY { .sram : ORIGIN = CONFIG_SYS_SPL_TEXT_BASE,\ -+ LENGTH = CONFIG_SYS_SPL_MAX_SIZE } -+MEMORY { .sdram : ORIGIN = CONFIG_SYS_SPL_BSS_START_ADDR, \ -+ LENGTH = CONFIG_SYS_SPL_BSS_MAX_SIZE } -+ -+OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm") -+OUTPUT_ARCH(arm) -+ENTRY(_start) -+SECTIONS -+{ -+ .text : -+ { -+ . = ALIGN(32); -+ __start = .; -+ start.o (.text) -+ *(.text*) -+ } >.sram -+ -+ . = ALIGN(4); -+ .rodata : { *(SORT_BY_ALIGNMENT(.rodata*)) } >.sram -+ -+ . = ALIGN(4); -+ .data : { *(SORT_BY_ALIGNMENT(.data*)) } >.sram -+ . = ALIGN(4); -+ __image_copy_end = .; -+ -+ .bss : -+ { -+ . = ALIGN(4); -+ __bss_start = .; -+ *(.bss*) -+ . = ALIGN(4); -+ _end = .; -+ } >.sdram -+} --- -1.7.2.3 - diff --git a/packages/tools/u-boot/patches/2011.03-rc1/u-boot-2011.03-rc1-0010-omap4-add-spl-support-for-OMAP4-SDP.patch b/packages/tools/u-boot/patches/2011.03-rc1/u-boot-2011.03-rc1-0010-omap4-add-spl-support-for-OMAP4-SDP.patch deleted file mode 100644 index 1dedf5c3dd2..00000000000 --- a/packages/tools/u-boot/patches/2011.03-rc1/u-boot-2011.03-rc1-0010-omap4-add-spl-support-for-OMAP4-SDP.patch +++ /dev/null @@ -1,194 +0,0 @@ -From ec08ceb0d0ed2e6c2deb5c6d81ebf0087e6fc5f8 Mon Sep 17 00:00:00 2001 -From: Aneesh V <aneesh@ti.com> -Date: Thu, 17 Feb 2011 18:23:31 +0530 -Subject: [PATCH 10/22] omap4: add spl support for OMAP4 SDP - -Adapted from: nand_spl/board/samsung/smdk6400/Makefile - -- Add the SPL makefile for OMAP4430 SDP -- Add the necessary CONFIG flags in the board config file - -Signed-off-by: Aneesh V <aneesh@ti.com> ---- - board/ti/sdp4430/config.mk | 3 +- - include/configs/omap4_sdp4430.h | 19 ++++++ - spl/board/ti/sdp4430/Makefile | 120 +++++++++++++++++++++++++++++++++++++++ - 3 files changed, 141 insertions(+), 1 deletions(-) - create mode 100644 spl/board/ti/sdp4430/Makefile - -diff --git a/board/ti/sdp4430/config.mk b/board/ti/sdp4430/config.mk -index 33901a7..c62965d 100644 ---- a/board/ti/sdp4430/config.mk -+++ b/board/ti/sdp4430/config.mk -@@ -28,4 +28,5 @@ - # Linux-Kernel is expected to be at 8000'8000, entry 8000'8000 - # (mem base + reserved) - --CONFIG_SYS_TEXT_BASE = 0x80e80000 -+# 1MB into the SDRAM to allow for SPL's bss at the beginning of SDRAM -+CONFIG_SYS_TEXT_BASE = 0x80100000 -diff --git a/include/configs/omap4_sdp4430.h b/include/configs/omap4_sdp4430.h -index 9a8bb73..5b20841 100644 ---- a/include/configs/omap4_sdp4430.h -+++ b/include/configs/omap4_sdp4430.h -@@ -122,7 +122,9 @@ - - /* USB device configuration */ - #define CONFIG_USB_DEVICE 1 -+#ifndef CONFIG_PRELOADER - #define CONFIG_USB_TTY 1 -+#endif - #define CONFIG_SYS_CONSOLE_IS_IN_ENV 1 - - /* Flash */ -@@ -240,4 +242,21 @@ - CONFIG_SYS_INIT_RAM_SIZE - \ - GENERATED_GBL_DATA_SIZE) - -+/* Defines for Clock init */ -+#define CONFIG_SYS_OMAP4_ABE_SYSCK -+ -+/* Defines for SDRAM init */ -+#define CONFIG_SYS_AUTOMATIC_SDRAM_DETECTION 1 -+#define CONFIG_SYS_EMIF_UPDATE_TIMINGS 1 -+#define CONFIG_SYS_DEFAULT_LPDDR2_TIMINGS 1 -+ -+/* Defines for SPL */ -+#define CONFIG_SPL -+#define CONFIG_SYS_SPL_TEXT_BASE 0x40304360 -+#define CONFIG_SYS_SPL_MAX_SIZE 0x7800 /* 30 K */ -+#define CONFIG_SYS_SPL_STACK LOW_LEVEL_SRAM_STACK -+ -+#define CONFIG_SYS_SPL_BSS_START_ADDR 0x80000000 -+#define CONFIG_SYS_SPL_BSS_MAX_SIZE 0x80000 /* 512 KB */ -+ - #endif /* __CONFIG_H */ -diff --git a/spl/board/ti/sdp4430/Makefile b/spl/board/ti/sdp4430/Makefile -new file mode 100644 -index 0000000..dd56a40 ---- /dev/null -+++ b/spl/board/ti/sdp4430/Makefile -@@ -0,0 +1,120 @@ -+# -+# (C) Copyright 2006-2007 -+# Stefan Roese, DENX Software Engineering, sr@denx.de. -+# -+# (C) Copyright 2008 -+# Guennadi Liakhovetki, DENX Software Engineering, <lg@denx.de> -+# -+# See file CREDITS for list of people who contributed to this -+# project. -+# -+# This program is free software; you can redistribute it and/or -+# modify it under the terms of the GNU General Public License as -+# published by the Free Software Foundation; either version 2 of -+# the License, or (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program; if not, write to the Free Software -+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+# MA 02111-1307 USA -+# -+splobj := $(OBJTREE)/spl/ -+include $(TOPDIR)/config.mk -+SOBJS = -+COBJS = -+ -+# armv7 -+$(obj)start.S: -+ @rm -f $@ -+ @ln -s $(TOPDIR)/arch/arm/cpu/armv7/start.S $@ -+ -+$(obj)syslib.c: -+ @rm -f $@ -+ @ln -s $(TOPDIR)/arch/arm/cpu/armv7/syslib.c $@ -+ -+SOBJS += start.o -+COBJS += syslib.o -+ -+# omap-common -+$(obj)timer.c: -+ @rm -f $@ -+ @ln -s $(TOPDIR)/arch/arm/cpu/armv7/omap-common/timer.c $@ -+ -+$(obj)reset.S: -+ @rm -f $@ -+ @ln -s $(TOPDIR)/arch/arm/cpu/armv7/omap-common/reset.S $@ -+ -+$(obj)spl-omap.c: -+ @rm -f $@ -+ @ln -s $(TOPDIR)/spl/board/ti/spl-omap.c $@ -+ -+SOBJS += reset.o -+COBJS += timer.o spl-omap.o -+ -+$(OBJTREE)/MLO: $(splobj)u-boot-spl.bin -+ $(OBJTREE)/tools/mkimage -T omapimage \ -+ -a $(CONFIG_SYS_SPL_TEXT_BASE) -d $< $@ -+ -+LDSCRIPT_SOURCE = $(TOPDIR)/spl/board/ti/spl-omap.lds -+ -+# omap4 -+$(obj)lowlevel_init.S: -+ @rm -f $@ -+ @ln -s $(TOPDIR)/arch/arm/cpu/armv7/omap4/lowlevel_init.S $@ -+ -+$(obj)omap4_mux_data.h: -+ @rm -f $@ -+ @ln -s $(TOPDIR)/arch/arm/cpu/armv7/omap4/omap4_mux_data.h $@ -+ -+$(obj)board.c:$(obj)omap4_mux_data.h -+ @rm -f $@ -+ @ln -s $(TOPDIR)/arch/arm/cpu/armv7/omap4/board.c $@ -+ -+SOBJS += lowlevel_init.o -+COBJS += board.o -+ -+# rules -+LDPPFLAGS += -include $(TOPDIR)/include/config.h -+LDSCRIPT = $(splobj)u-boot-spl-generated.lds -+$(LDSCRIPT): $(LDSCRIPT_SOURCE) -+ $(CPP) $(CPPFLAGS) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ -P - <$^ >$@ -+LDFLAGS = -Bstatic -T $(LDSCRIPT) \ -+ $(PLATFORM_LDFLAGS) --gc-sections -+AFLAGS += -DCONFIG_PRELOADER -Os -ffixed-r8 -+CFLAGS += -DCONFIG_PRELOADER -Os -ffixed-r8 -ffunction-sections \ -+ -fdata-sections -march=armv7-a -mthumb -+PLATFORM_LIBGCC = -L $(shell dirname `$(CC) $(CFLAGS) \ -+ -print-libgcc-file-name`) -lgcc -+ -+$(obj)%.o: $(obj)%.S -+ $(CC) $(AFLAGS) -c -o $@ $< -+ -+$(obj)%.o: $(obj)%.c -+ $(CC) $(CFLAGS) -c -o $@ $< -+ -+SRCS := $(addprefix $(obj),$(SOBJS:.o=.S) $(COBJS:.o=.c)) -+OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS)) -+__OBJS := $(SOBJS) $(COBJS) -+LNDIR := $(OBJTREE)/spl/board/$(BOARDDIR) -+ -+$(splobj)u-boot-spl.bin: $(splobj)u-boot-spl -+ $(OBJCOPY) ${OBJCFLAGS} -O binary $< $@ -+ -+$(splobj)u-boot-spl: $(OBJS) $(LDSCRIPT) -+ cd $(LNDIR) && $(LD) $(LDFLAGS) $(__OBJS) \ -+ $(PLATFORM_LIBGCC) \ -+ -Map $(splobj)u-boot-spl.map \ -+ -o $(splobj)u-boot-spl -+ -+ALL = $(OBJTREE)/MLO -+all: $(obj).depend $(ALL) -+ -+# defines $(obj).depend target -+include $(SRCTREE)/rules.mk -+ -+sinclude $(obj).depend --- -1.7.2.3 - diff --git a/packages/tools/u-boot/patches/2011.03-rc1/u-boot-2011.03-rc1-0011-omap4-add-serial-console-support-to-SPL.patch b/packages/tools/u-boot/patches/2011.03-rc1/u-boot-2011.03-rc1-0011-omap4-add-serial-console-support-to-SPL.patch deleted file mode 100644 index e22a91d59c8..00000000000 --- a/packages/tools/u-boot/patches/2011.03-rc1/u-boot-2011.03-rc1-0011-omap4-add-serial-console-support-to-SPL.patch +++ /dev/null @@ -1,110 +0,0 @@ -From eb26c57b60b026cd827be2470697111418b5ca61 Mon Sep 17 00:00:00 2001 -From: Aneesh V <aneesh@ti.com> -Date: Sun, 27 Feb 2011 19:45:01 +0530 -Subject: [PATCH 11/22] omap4: add serial console support to SPL - -Signed-off-by: Aneesh V <aneesh@ti.com> ---- - arch/arm/cpu/armv7/omap4/board.c | 3 ++ - arch/arm/include/asm/omap_common.h | 1 + - spl/board/ti/sdp4430/Makefile | 40 ++++++++++++++++++++++++++++++++++++ - spl/board/ti/spl-omap.c | 10 +++++++++ - 4 files changed, 54 insertions(+), 0 deletions(-) - -diff --git a/arch/arm/cpu/armv7/omap4/board.c b/arch/arm/cpu/armv7/omap4/board.c -index a5d585b..da79669 100644 ---- a/arch/arm/cpu/armv7/omap4/board.c -+++ b/arch/arm/cpu/armv7/omap4/board.c -@@ -57,6 +57,9 @@ u32 omap_boot_mode(void) - void s_init(void) - { - watchdog_init(); -+#ifdef CONFIG_PRELOADER -+ preloader_console_init(); -+#endif - } - - /* -diff --git a/arch/arm/include/asm/omap_common.h b/arch/arm/include/asm/omap_common.h -index 06c511c..95116f4 100644 ---- a/arch/arm/include/asm/omap_common.h -+++ b/arch/arm/include/asm/omap_common.h -@@ -67,5 +67,6 @@ - - u32 omap_boot_device(void); - u32 omap_boot_mode(void); -+void preloader_console_init(void); - - #endif /* _OMAP_COMMON_H_ */ -diff --git a/spl/board/ti/sdp4430/Makefile b/spl/board/ti/sdp4430/Makefile -index dd56a40..6a6aa42 100644 ---- a/spl/board/ti/sdp4430/Makefile -+++ b/spl/board/ti/sdp4430/Makefile -@@ -28,6 +28,46 @@ include $(TOPDIR)/config.mk - SOBJS = - COBJS = - -+# serial console -+$(obj)eabi_compat.c: -+ @rm -f $@ -+ @ln -s $(TOPDIR)/arch/arm/lib/eabi_compat.c $@ -+ -+$(obj)string.c: -+ @rm -f $@ -+ @ln -s $(TOPDIR)/lib/string.c $@ -+ -+$(obj)vsprintf.c: -+ @rm -f $@ -+ @ln -s $(TOPDIR)/lib/vsprintf.c $@ -+ -+$(obj)console.c: -+ @rm -f $@ -+ @ln -s $(TOPDIR)/common/console.c $@ -+ -+$(obj)stdio.c: -+ @rm -f $@ -+ @ln -s $(TOPDIR)/common/stdio.c $@ -+ -+$(obj)serial.c: -+ @rm -f $@ -+ @ln -s $(TOPDIR)/drivers/serial/serial.c $@ -+ -+$(obj)ns16550.c: -+ @rm -f $@ -+ @ln -s $(TOPDIR)/drivers/serial/ns16550.c $@ -+ -+$(obj)div64.c: -+ @rm -f $@ -+ @ln -s $(TOPDIR)/lib/div64.c $@ -+ -+$(obj)ctype.c: -+ @rm -f $@ -+ @ln -s $(TOPDIR)/lib/ctype.c $@ -+ -+COBJS += serial.o ns16550.o string.o vsprintf.o console.o stdio.o -+COBJS += ctype.o eabi_compat.o div64.o -+ - # armv7 - $(obj)start.S: - @rm -f $@ -diff --git a/spl/board/ti/spl-omap.c b/spl/board/ti/spl-omap.c -index 0e08f4f..57ddb7d 100644 ---- a/spl/board/ti/spl-omap.c -+++ b/spl/board/ti/spl-omap.c -@@ -45,3 +45,13 @@ void board_init_r(gd_t *id, ulong dummy) - for (;;) - ; - } -+ -+void preloader_console_init(void) -+{ -+ gd->bd = &bdata; -+ gd->flags |= GD_FLG_RELOC; -+ gd->baudrate = CONFIG_BAUDRATE; -+ serial_init(); /* serial communications setup */ -+ printf("\nU-Boot SPL for Texas Instruments OMAP4 (%s - %s)\n", -+ U_BOOT_DATE, U_BOOT_TIME); -+} --- -1.7.2.3 - diff --git a/packages/tools/u-boot/patches/2011.03-rc1/u-boot-2011.03-rc1-0012-omap4-utility-function-to-identify-the-context-of-hw.patch b/packages/tools/u-boot/patches/2011.03-rc1/u-boot-2011.03-rc1-0012-omap4-utility-function-to-identify-the-context-of-hw.patch deleted file mode 100644 index 2bf6ad0a473..00000000000 --- a/packages/tools/u-boot/patches/2011.03-rc1/u-boot-2011.03-rc1-0012-omap4-utility-function-to-identify-the-context-of-hw.patch +++ /dev/null @@ -1,100 +0,0 @@ -From 4ddea7506c79c6309e65baf0484650b816f6e3c9 Mon Sep 17 00:00:00 2001 -From: Aneesh V <aneesh@ti.com> -Date: Sun, 20 Feb 2011 16:15:42 +0530 -Subject: [PATCH 12/22] omap4: utility function to identify the context of hw init - -The basic hardware init of OMAP4(s_init()) can happen in 4 -different contexts: - 1. SPL running from SRAM - 2. U-Boot running from FLASH - 3. Non-XIP U-Boot loaded to SDRAM by SPL - 4. Non-XIP U-Boot loaded to SDRAM by ROM code using the - Configuration Header feature - -What level of hw initialization gets done depends on this -context. Add a utility function to find this context. - -Signed-off-by: Aneesh V <aneesh@ti.com> ---- - arch/arm/include/asm/arch-omap4/sys_proto.h | 47 +++++++++++++++++++++++++++ - arch/arm/include/asm/omap_common.h | 6 +++ - 2 files changed, 53 insertions(+), 0 deletions(-) - -diff --git a/arch/arm/include/asm/arch-omap4/sys_proto.h b/arch/arm/include/asm/arch-omap4/sys_proto.h -index ce86b36..19da2e1 100644 ---- a/arch/arm/include/asm/arch-omap4/sys_proto.h -+++ b/arch/arm/include/asm/arch-omap4/sys_proto.h -@@ -38,6 +38,53 @@ void sr32(void *, u32, u32, u32); - u32 wait_on_value(u32, u32, void *, u32); - void sdelay(unsigned long); - -+static inline u32 running_from_sdram(void) -+{ -+ u32 pc; -+ asm volatile ("mov %0, pc" : "=r" (pc)); -+ return ((pc >= OMAP44XX_DRAM_ADDR_SPACE_START) && -+ (pc < OMAP44XX_DRAM_ADDR_SPACE_END)); -+} -+ -+static inline u8 uboot_loaded_by_spl(void) -+{ -+ /* -+ * Configuration Header is not supported yet, so u-boot init running -+ * from SDRAM implies that it was loaded by SPL. When this situation -+ * changes one of these approaches could be taken: -+ * i. Pass a magic from SPL to U-Boot and U-Boot save it at a known -+ * location. -+ * ii. Check the OPP. CH can support only 50% OPP while SPL initializes -+ * the DPLLs at 100% OPP. -+ */ -+ return running_from_sdram(); -+} -+/* -+ * The basic hardware init of OMAP(s_init()) can happen in 4 -+ * different contexts: -+ * 1. SPL running from SRAM -+ * 2. U-Boot running from FLASH -+ * 3. Non-XIP U-Boot loaded to SDRAM by SPL -+ * 4. Non-XIP U-Boot loaded to SDRAM by ROM code using the -+ * Configuration Header feature -+ * -+ * This function finds this context. -+ * Defining as inline may help in compiling out unused functions in SPL -+ */ -+static inline u32 omap4_hw_init_context(void) -+{ -+#ifdef CONFIG_PRELOADER -+ return OMAP_INIT_CONTEXT_SPL; -+#else -+ if (uboot_loaded_by_spl()) -+ return OMAP_INIT_CONTEXT_UBOOT_LOADED_BY_SPL; -+ else if (running_from_sdram()) -+ return OMAP_INIT_CONTEXT_UBOOT_LOADED_BY_CH; -+ else -+ return OMAP_INIT_CONTEXT_XIP_UBOOT; -+#endif -+} -+ - extern const struct omap_sysinfo sysinfo; - - #endif -diff --git a/arch/arm/include/asm/omap_common.h b/arch/arm/include/asm/omap_common.h -index 95116f4..50247af 100644 ---- a/arch/arm/include/asm/omap_common.h -+++ b/arch/arm/include/asm/omap_common.h -@@ -65,6 +65,12 @@ - /* Magic number passed from SPL to U-Boot */ - #define OMAP_SPL_TO_UBOOT_MAGIC_NUMBER 0xDEADBEEF - -+/* HW Init Context */ -+#define OMAP_INIT_CONTEXT_SPL 0 -+#define OMAP_INIT_CONTEXT_XIP_UBOOT 1 -+#define OMAP_INIT_CONTEXT_UBOOT_LOADED_BY_SPL 2 -+#define OMAP_INIT_CONTEXT_UBOOT_LOADED_BY_CH 3 -+ - u32 omap_boot_device(void); - u32 omap_boot_mode(void); - void preloader_console_init(void); --- -1.7.2.3 - diff --git a/packages/tools/u-boot/patches/2011.03-rc1/u-boot-2011.03-rc1-0013-omap4-separate-mux-settings-into-essential-and-non-e.patch b/packages/tools/u-boot/patches/2011.03-rc1/u-boot-2011.03-rc1-0013-omap4-separate-mux-settings-into-essential-and-non-e.patch deleted file mode 100644 index 3f9c7845b3f..00000000000 --- a/packages/tools/u-boot/patches/2011.03-rc1/u-boot-2011.03-rc1-0013-omap4-separate-mux-settings-into-essential-and-non-e.patch +++ /dev/null @@ -1,1328 +0,0 @@ -From c46103152b4875805e05752b3684038798ffaf32 Mon Sep 17 00:00:00 2001 -From: Aneesh V <aneesh@ti.com> -Date: Thu, 17 Feb 2011 01:48:11 +0530 -Subject: [PATCH 13/22] omap4: separate mux settings into essential and non essential parts - -Do the essential part from SPL and non-essential part from U-Boot -- Essential part is what is essential for u-boot to function -- Essential part is also largely board independent(at least - as of now) -- So essential part is moved out to SoC directory instead of - keeping in board directory. This helps in having single SPL - that works for Panda and SDP. -- Non-essential part is what is set by u-boot for kernel to - function correctly -- Ideally non-essential part should be phased out eventually - -Signed-off-by: Aneesh V <aneesh@ti.com> ---- - arch/arm/cpu/armv7/omap4/board.c | 53 +++++- - arch/arm/cpu/armv7/omap4/omap4_mux_data.h | 76 ++++++++ - arch/arm/include/asm/arch-omap4/sys_proto.h | 4 +- - board/ti/panda/panda.c | 25 +-- - board/ti/panda/panda.h | 264 --------------------------- - board/ti/panda/panda_mux_data.h | 229 +++++++++++++++++++++++ - board/ti/sdp4430/sdp.c | 25 +-- - board/ti/sdp4430/sdp.h | 264 --------------------------- - board/ti/sdp4430/sdp4430_mux_data.h | 227 +++++++++++++++++++++++ - 9 files changed, 597 insertions(+), 570 deletions(-) - create mode 100644 arch/arm/cpu/armv7/omap4/omap4_mux_data.h - delete mode 100644 board/ti/panda/panda.h - create mode 100644 board/ti/panda/panda_mux_data.h - delete mode 100644 board/ti/sdp4430/sdp.h - create mode 100644 board/ti/sdp4430/sdp4430_mux_data.h - -diff --git a/arch/arm/cpu/armv7/omap4/board.c b/arch/arm/cpu/armv7/omap4/board.c -index da79669..95b6a96 100644 ---- a/arch/arm/cpu/armv7/omap4/board.c -+++ b/arch/arm/cpu/armv7/omap4/board.c -@@ -32,9 +32,30 @@ - #include <asm/arch/cpu.h> - #include <asm/arch/sys_proto.h> - #include <asm/sizes.h> -+#include "omap4_mux_data.h" - - DECLARE_GLOBAL_DATA_PTR; - -+void do_set_mux(u32 base, struct pad_conf_entry const *array, int size) -+{ -+ int i; -+ struct pad_conf_entry *pad = (struct pad_conf_entry *) array; -+ -+ for (i = 0; i < size; i++, pad++) -+ writew(pad->val, base + pad->offset); -+} -+ -+static void set_muxconf_regs_essential(void) -+{ -+ do_set_mux(CONTROL_PADCONF_CORE, core_padconf_array_essential, -+ sizeof(core_padconf_array_essential) / -+ sizeof(struct pad_conf_entry)); -+ -+ do_set_mux(CONTROL_PADCONF_WKUP, wkup_padconf_array_essential, -+ sizeof(wkup_padconf_array_essential) / -+ sizeof(struct pad_conf_entry)); -+} -+ - #ifdef CONFIG_PRELOADER - u32 omap4_boot_device = BOOT_DEVICE_MMC1; - u32 omap4_boot_mode = MMCSD_MODE_FAT; -@@ -49,14 +70,41 @@ u32 omap_boot_mode(void) - } - #endif - -+static void set_mux_conf_regs(void) -+{ -+ switch (omap4_hw_init_context()) { -+ case OMAP_INIT_CONTEXT_SPL: -+ set_muxconf_regs_essential(); -+ break; -+ case OMAP_INIT_CONTEXT_UBOOT_LOADED_BY_SPL: -+ set_muxconf_regs_non_essential(); -+ break; -+ case OMAP_INIT_CONTEXT_XIP_UBOOT: -+ case OMAP_INIT_CONTEXT_UBOOT_LOADED_BY_CH: -+ set_muxconf_regs_essential(); -+ set_muxconf_regs_non_essential(); -+ break; -+ } -+} -+ - /* - * Routine: s_init -- * Description: Does early system init of muxing and clocks. -- * - Called path is with SRAM stack. -+ * Description: Does early system init of watchdog, muxing, clocks, and -+ * sdram. Watchdog disable is done always. For the rest what gets done -+ * depends on the boot mode in which this function is executed -+ * 1. s_init of SPL running from SRAM -+ * 2. s_init of U-Boot running from FLASH -+ * 3. s_init of U-Boot loaded to SDRAM by SPL -+ * 4. s_init of U-Boot loaded to SDRAM by ROM code using the Configuration -+ * Header feature -+ * Please have a look at the respective functions to see what gets done in -+ * each of these cases -+ * This function is called with SRAM stack. - */ - void s_init(void) - { - watchdog_init(); -+ set_mux_conf_regs(); - #ifdef CONFIG_PRELOADER - preloader_console_init(); - #endif -@@ -142,7 +190,6 @@ int checkboard(void) - */ - int arch_cpu_init(void) - { -- set_muxconf_regs(); - return 0; - } - -diff --git a/arch/arm/cpu/armv7/omap4/omap4_mux_data.h b/arch/arm/cpu/armv7/omap4/omap4_mux_data.h -new file mode 100644 -index 0000000..00c52f8 ---- /dev/null -+++ b/arch/arm/cpu/armv7/omap4/omap4_mux_data.h -@@ -0,0 +1,76 @@ -+ /* -+ * (C) Copyright 2010 -+ * Texas Instruments Incorporated, <www.ti.com> -+ * -+ * Balaji Krishnamoorthy <balajitk@ti.com> -+ * Aneesh V <aneesh@ti.com> -+ * -+ * See file CREDITS for list of people who contributed to this -+ * project. -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License as -+ * published by the Free Software Foundation; either version 2 of -+ * the License, or (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+ * MA 02111-1307 USA -+ */ -+#ifndef _OMAP4_MUX_DATA_H_ -+#define _OMAP4_MUX_DATA_H_ -+ -+#include <asm/arch/mux_omap4.h> -+ -+const struct pad_conf_entry core_padconf_array_essential[] = { -+ -+{GPMC_AD0, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1)}, /* sdmmc2_dat0 */ -+{GPMC_AD1, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1)}, /* sdmmc2_dat1 */ -+{GPMC_AD2, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1)}, /* sdmmc2_dat2 */ -+{GPMC_AD3, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1)}, /* sdmmc2_dat3 */ -+{GPMC_AD4, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1)}, /* sdmmc2_dat4 */ -+{GPMC_AD5, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1)}, /* sdmmc2_dat5 */ -+{GPMC_AD6, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1)}, /* sdmmc2_dat6 */ -+{GPMC_AD7, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1)}, /* sdmmc2_dat7 */ -+{GPMC_NOE, (PTU | IEN | OFF_EN | OFF_OUT_PTD | M1)}, /* sdmmc2_clk */ -+{GPMC_NWE, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1)}, /* sdmmc2_cmd */ -+{SDMMC1_CLK, (PTU | OFF_EN | OFF_OUT_PTD | M0)}, /* sdmmc1_clk */ -+{SDMMC1_CMD, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* sdmmc1_cmd */ -+{SDMMC1_DAT0, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* sdmmc1_dat0 */ -+{SDMMC1_DAT1, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* sdmmc1_dat1 */ -+{SDMMC1_DAT2, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* sdmmc1_dat2 */ -+{SDMMC1_DAT3, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* sdmmc1_dat3 */ -+{SDMMC1_DAT4, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* sdmmc1_dat4 */ -+{SDMMC1_DAT5, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* sdmmc1_dat5 */ -+{SDMMC1_DAT6, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* sdmmc1_dat6 */ -+{SDMMC1_DAT7, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* sdmmc1_dat7 */ -+{I2C1_SCL, (PTU | IEN | M0)}, /* i2c1_scl */ -+{I2C1_SDA, (PTU | IEN | M0)}, /* i2c1_sda */ -+{I2C2_SCL, (PTU | IEN | M0)}, /* i2c2_scl */ -+{I2C2_SDA, (PTU | IEN | M0)}, /* i2c2_sda */ -+{I2C3_SCL, (PTU | IEN | M0)}, /* i2c3_scl */ -+{I2C3_SDA, (PTU | IEN | M0)}, /* i2c3_sda */ -+{I2C4_SCL, (PTU | IEN | M0)}, /* i2c4_scl */ -+{I2C4_SDA, (PTU | IEN | M0)}, /* i2c4_sda */ -+{UART3_CTS_RCTX, (PTU | IEN | M0)}, /* uart3_tx */ -+{UART3_RTS_SD, (M0)}, /* uart3_rts_sd */ -+{UART3_RX_IRRX, (IEN | M0)}, /* uart3_rx */ -+{UART3_TX_IRTX, (M0)} /* uart3_tx */ -+ -+}; -+ -+const struct pad_conf_entry wkup_padconf_array_essential[] = { -+ -+{PAD1_SR_SCL, (PTU | IEN | M0)}, /* sr_scl */ -+{PAD0_SR_SDA, (PTU | IEN | M0)}, /* sr_sda */ -+{PAD1_SYS_32K, (IEN | M0)} /* sys_32k */ -+ -+}; -+ -+#endif /* _OMAP4_MUX_DATA_H_ */ -diff --git a/arch/arm/include/asm/arch-omap4/sys_proto.h b/arch/arm/include/asm/arch-omap4/sys_proto.h -index 19da2e1..33a1666 100644 ---- a/arch/arm/include/asm/arch-omap4/sys_proto.h -+++ b/arch/arm/include/asm/arch-omap4/sys_proto.h -@@ -24,6 +24,7 @@ - #include <asm/arch/omap4.h> - #include <asm/io.h> - #include <asm/omap_common.h> -+#include <asm/arch/mux_omap4.h> - - struct omap_sysinfo { - char *board_string; -@@ -33,7 +34,8 @@ void gpmc_init(void); - void watchdog_init(void); - u32 get_device_type(void); - void invalidate_dcache(u32); --void set_muxconf_regs(void); -+void do_set_mux(u32 base, struct pad_conf_entry const *array, int size); -+void set_muxconf_regs_non_essential(void); - void sr32(void *, u32, u32, u32); - u32 wait_on_value(u32, u32, void *, u32); - void sdelay(unsigned long); -diff --git a/board/ti/panda/panda.c b/board/ti/panda/panda.c -index 78e1910..9afed80 100644 ---- a/board/ti/panda/panda.c -+++ b/board/ti/panda/panda.c -@@ -25,7 +25,7 @@ - #include <asm/arch/sys_proto.h> - #include <asm/arch/mmc_host_def.h> - --#include "panda.h" -+#include "panda_mux_data.h" - - DECLARE_GLOBAL_DATA_PTR; - -@@ -65,27 +65,14 @@ int misc_init_r(void) - return 0; - } - --void do_set_mux(u32 base, struct pad_conf_entry const *array, int size) -+void set_muxconf_regs_non_essential(void) - { -- int i; -- struct pad_conf_entry *pad = (struct pad_conf_entry *) array; -- -- for (i = 0; i < size; i++, pad++) -- writew(pad->val, base + pad->offset); --} -- --/** -- * @brief set_muxconf_regs Setting up the configuration Mux registers -- * specific to the board. -- */ --void set_muxconf_regs(void) --{ -- do_set_mux(CONTROL_PADCONF_CORE, core_padconf_array, -- sizeof(core_padconf_array) / -+ do_set_mux(CONTROL_PADCONF_CORE, core_padconf_array_non_essential, -+ sizeof(core_padconf_array_non_essential) / - sizeof(struct pad_conf_entry)); - -- do_set_mux(CONTROL_PADCONF_WKUP, wkup_padconf_array, -- sizeof(wkup_padconf_array) / -+ do_set_mux(CONTROL_PADCONF_WKUP, wkup_padconf_array_non_essential, -+ sizeof(wkup_padconf_array_non_essential) / - sizeof(struct pad_conf_entry)); - } - -diff --git a/board/ti/panda/panda.h b/board/ti/panda/panda.h -deleted file mode 100644 -index e3d090e..0000000 ---- a/board/ti/panda/panda.h -+++ /dev/null -@@ -1,264 +0,0 @@ --/* -- * (C) Copyright 2010 -- * Texas Instruments Incorporated, <www.ti.com> -- * -- * Balaji Krishnamoorthy <balajitk@ti.com> -- * Aneesh V <aneesh@ti.com> -- * -- * See file CREDITS for list of people who contributed to this -- * project. -- * -- * This program is free software; you can redistribute it and/or -- * modify it under the terms of the GNU General Public License as -- * published by the Free Software Foundation; either version 2 of -- * the License, or (at your option) any later version. -- * -- * This program is distributed in the hope that it will be useful, -- * but WITHOUT ANY WARRANTY; without even the implied warranty of -- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- * GNU General Public License for more details. -- * -- * You should have received a copy of the GNU General Public License -- * along with this program; if not, write to the Free Software -- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, -- * MA 02111-1307 USA -- */ -- --#ifndef _PANDA_H_ --#define _PANDA_H_ -- --#include <asm/io.h> --#include <asm/arch/mux_omap4.h> -- --const struct pad_conf_entry core_padconf_array[] = { -- {GPMC_AD0, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1)}, /* sdmmc2_dat0 */ -- {GPMC_AD1, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1)}, /* sdmmc2_dat1 */ -- {GPMC_AD2, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1)}, /* sdmmc2_dat2 */ -- {GPMC_AD3, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1)}, /* sdmmc2_dat3 */ -- {GPMC_AD4, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1)}, /* sdmmc2_dat4 */ -- {GPMC_AD5, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1)}, /* sdmmc2_dat5 */ -- {GPMC_AD6, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1)}, /* sdmmc2_dat6 */ -- {GPMC_AD7, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1)}, /* sdmmc2_dat7 */ -- {GPMC_AD8, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M3)}, /* gpio_32 */ -- {GPMC_AD9, (PTU | IEN | M3)}, /* gpio_33 */ -- {GPMC_AD10, (PTU | IEN | M3)}, /* gpio_34 */ -- {GPMC_AD11, (PTU | IEN | M3)}, /* gpio_35 */ -- {GPMC_AD12, (PTU | IEN | M3)}, /* gpio_36 */ -- {GPMC_AD13, (PTD | OFF_EN | OFF_PD | OFF_OUT_PTD | M3)}, /* gpio_37 */ -- {GPMC_AD14, (PTD | OFF_EN | OFF_PD | OFF_OUT_PTD | M3)}, /* gpio_38 */ -- {GPMC_AD15, (PTD | OFF_EN | OFF_PD | OFF_OUT_PTD | M3)}, /* gpio_39 */ -- {GPMC_A16, (M3)}, /* gpio_40 */ -- {GPMC_A17, (PTD | M3)}, /* gpio_41 */ -- {GPMC_A18, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1)}, /* kpd_row6 */ -- {GPMC_A19, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1)}, /* kpd_row7 */ -- {GPMC_A20, (IEN | M3)}, /* gpio_44 */ -- {GPMC_A21, (M3)}, /* gpio_45 */ -- {GPMC_A22, (M3)}, /* gpio_46 */ -- {GPMC_A23, (OFF_EN | OFF_PD | OFF_IN | M1)}, /* kpd_col7 */ -- {GPMC_A24, (PTD | M3)}, /* gpio_48 */ -- {GPMC_A25, (PTD | M3)}, /* gpio_49 */ -- {GPMC_NCS0, (M3)}, /* gpio_50 */ -- {GPMC_NCS1, (IEN | M3)}, /* gpio_51 */ -- {GPMC_NCS2, (IEN | M3)}, /* gpio_52 */ -- {GPMC_NCS3, (IEN | M3)}, /* gpio_53 */ -- {GPMC_NWP, (M3)}, /* gpio_54 */ -- {GPMC_CLK, (PTD | M3)}, /* gpio_55 */ -- {GPMC_NADV_ALE, (M3)}, /* gpio_56 */ -- {GPMC_NOE, (PTU | IEN | OFF_EN | OFF_OUT_PTD | M1)}, /* sdmmc2_clk */ -- {GPMC_NWE, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1)}, /* sdmmc2_cmd */ -- {GPMC_NBE0_CLE, (M3)}, /* gpio_59 */ -- {GPMC_NBE1, (PTD | M3)}, /* gpio_60 */ -- {GPMC_WAIT0, (PTU | IEN | M3)}, /* gpio_61 */ -- {GPMC_WAIT1, (PTD | OFF_EN | OFF_PD | OFF_OUT_PTD | M3)}, /* gpio_62 */ -- {C2C_DATA11, (PTD | M3)}, /* gpio_100 */ -- {C2C_DATA12, (PTU | IEN | M3)}, /* gpio_101 */ -- {C2C_DATA13, (PTD | M3)}, /* gpio_102 */ -- {C2C_DATA14, (M1)}, /* dsi2_te0 */ -- {C2C_DATA15, (PTD | M3)}, /* gpio_104 */ -- {HDMI_HPD, (M0)}, /* hdmi_hpd */ -- {HDMI_CEC, (M0)}, /* hdmi_cec */ -- {HDMI_DDC_SCL, (PTU | M0)}, /* hdmi_ddc_scl */ -- {HDMI_DDC_SDA, (PTU | IEN | M0)}, /* hdmi_ddc_sda */ -- {CSI21_DX0, (IEN | M0)}, /* csi21_dx0 */ -- {CSI21_DY0, (IEN | M0)}, /* csi21_dy0 */ -- {CSI21_DX1, (IEN | M0)}, /* csi21_dx1 */ -- {CSI21_DY1, (IEN | M0)}, /* csi21_dy1 */ -- {CSI21_DX2, (IEN | M0)}, /* csi21_dx2 */ -- {CSI21_DY2, (IEN | M0)}, /* csi21_dy2 */ -- {CSI21_DX3, (PTD | M7)}, /* csi21_dx3 */ -- {CSI21_DY3, (PTD | M7)}, /* csi21_dy3 */ -- {CSI21_DX4, (PTD | OFF_EN | OFF_PD | OFF_IN | M7)}, /* csi21_dx4 */ -- {CSI21_DY4, (PTD | OFF_EN | OFF_PD | OFF_IN | M7)}, /* csi21_dy4 */ -- {CSI22_DX0, (IEN | M0)}, /* csi22_dx0 */ -- {CSI22_DY0, (IEN | M0)}, /* csi22_dy0 */ -- {CSI22_DX1, (IEN | M0)}, /* csi22_dx1 */ -- {CSI22_DY1, (IEN | M0)}, /* csi22_dy1 */ -- {CAM_SHUTTER, (OFF_EN | OFF_PD | OFF_OUT_PTD | M0)}, /* cam_shutter */ -- {CAM_STROBE, (OFF_EN | OFF_PD | OFF_OUT_PTD | M0)}, /* cam_strobe */ -- {CAM_GLOBALRESET, (PTD | OFF_EN | OFF_PD | OFF_OUT_PTD | M3)}, /* gpio_83 */ -- {USBB1_ULPITLL_CLK, (PTD | IEN | OFF_EN | OFF_PD | OFF_IN | M4)},/* usbb1_ulpiphy_clk */ -- {USBB1_ULPITLL_STP, (OFF_EN | OFF_OUT_PTD | M4)}, /* usbb1_ulpiphy_stp */ -- {USBB1_ULPITLL_DIR, (IEN | OFF_EN | OFF_PD | OFF_IN | M4)}, /* usbb1_ulpiphy_dir */ -- {USBB1_ULPITLL_NXT, (IEN | OFF_EN | OFF_PD | OFF_IN | M4)}, /* usbb1_ulpiphy_nxt */ -- {USBB1_ULPITLL_DAT0, (IEN | OFF_EN | OFF_PD | OFF_IN | M4)}, /* usbb1_ulpiphy_dat0 */ -- {USBB1_ULPITLL_DAT1, (IEN | OFF_EN | OFF_PD | OFF_IN | M4)}, /* usbb1_ulpiphy_dat1 */ -- {USBB1_ULPITLL_DAT2, (IEN | OFF_EN | OFF_PD | OFF_IN | M4)}, /* usbb1_ulpiphy_dat2 */ -- {USBB1_ULPITLL_DAT3, (IEN | OFF_EN | OFF_PD | OFF_IN | M4)}, /* usbb1_ulpiphy_dat3 */ -- {USBB1_ULPITLL_DAT4, (IEN | OFF_EN | OFF_PD | OFF_IN | M4)}, /* usbb1_ulpiphy_dat4 */ -- {USBB1_ULPITLL_DAT5, (IEN | OFF_EN | OFF_PD | OFF_IN | M4)}, /* usbb1_ulpiphy_dat5 */ -- {USBB1_ULPITLL_DAT6, (IEN | OFF_EN | OFF_PD | OFF_IN | M4)}, /* usbb1_ulpiphy_dat6 */ -- {USBB1_ULPITLL_DAT7, (IEN | OFF_EN | OFF_PD | OFF_IN | M4)}, /* usbb1_ulpiphy_dat7 */ -- {USBB1_HSIC_DATA, (IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* usbb1_hsic_data */ -- {USBB1_HSIC_STROBE, (IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* usbb1_hsic_strobe */ -- {USBC1_ICUSB_DP, (IEN | M0)}, /* usbc1_icusb_dp */ -- {USBC1_ICUSB_DM, (IEN | M0)}, /* usbc1_icusb_dm */ -- {SDMMC1_CLK, (PTU | OFF_EN | OFF_OUT_PTD | M0)}, /* sdmmc1_clk */ -- {SDMMC1_CMD, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* sdmmc1_cmd */ -- {SDMMC1_DAT0, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* sdmmc1_dat0 */ -- {SDMMC1_DAT1, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* sdmmc1_dat1 */ -- {SDMMC1_DAT2, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* sdmmc1_dat2 */ -- {SDMMC1_DAT3, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* sdmmc1_dat3 */ -- {SDMMC1_DAT4, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* sdmmc1_dat4 */ -- {SDMMC1_DAT5, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* sdmmc1_dat5 */ -- {SDMMC1_DAT6, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* sdmmc1_dat6 */ -- {SDMMC1_DAT7, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* sdmmc1_dat7 */ -- {ABE_MCBSP2_CLKX, (IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* abe_mcbsp2_clkx */ -- {ABE_MCBSP2_DR, (IEN | OFF_EN | OFF_OUT_PTD | M0)}, /* abe_mcbsp2_dr */ -- {ABE_MCBSP2_DX, (OFF_EN | OFF_OUT_PTD | M0)}, /* abe_mcbsp2_dx */ -- {ABE_MCBSP2_FSX, (IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* abe_mcbsp2_fsx */ -- {ABE_MCBSP1_CLKX, (IEN | M1)}, /* abe_slimbus1_clock */ -- {ABE_MCBSP1_DR, (IEN | M1)}, /* abe_slimbus1_data */ -- {ABE_MCBSP1_DX, (OFF_EN | OFF_OUT_PTD | M0)}, /* abe_mcbsp1_dx */ -- {ABE_MCBSP1_FSX, (IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* abe_mcbsp1_fsx */ -- {ABE_PDM_UL_DATA, (PTD | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* abe_pdm_ul_data */ -- {ABE_PDM_DL_DATA, (PTD | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* abe_pdm_dl_data */ -- {ABE_PDM_FRAME, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* abe_pdm_frame */ -- {ABE_PDM_LB_CLK, (PTD | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* abe_pdm_lb_clk */ -- {ABE_CLKS, (PTD | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* abe_clks */ -- {ABE_DMIC_CLK1, (M0)}, /* abe_dmic_clk1 */ -- {ABE_DMIC_DIN1, (IEN | M0)}, /* abe_dmic_din1 */ -- {ABE_DMIC_DIN2, (IEN | M0)}, /* abe_dmic_din2 */ -- {ABE_DMIC_DIN3, (IEN | M0)}, /* abe_dmic_din3 */ -- {UART2_CTS, (PTU | IEN | M0)}, /* uart2_cts */ -- {UART2_RTS, (M0)}, /* uart2_rts */ -- {UART2_RX, (PTU | IEN | M0)}, /* uart2_rx */ -- {UART2_TX, (M0)}, /* uart2_tx */ -- {HDQ_SIO, (M3)}, /* gpio_127 */ -- {I2C1_SCL, (PTU | IEN | M0)}, /* i2c1_scl */ -- {I2C1_SDA, (PTU | IEN | M0)}, /* i2c1_sda */ -- {I2C2_SCL, (PTU | IEN | M0)}, /* i2c2_scl */ -- {I2C2_SDA, (PTU | IEN | M0)}, /* i2c2_sda */ -- {I2C3_SCL, (PTU | IEN | M0)}, /* i2c3_scl */ -- {I2C3_SDA, (PTU | IEN | M0)}, /* i2c3_sda */ -- {I2C4_SCL, (PTU | IEN | M0)}, /* i2c4_scl */ -- {I2C4_SDA, (PTU | IEN | M0)}, /* i2c4_sda */ -- {MCSPI1_CLK, (IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* mcspi1_clk */ -- {MCSPI1_SOMI, (IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* mcspi1_somi */ -- {MCSPI1_SIMO, (IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* mcspi1_simo */ -- {MCSPI1_CS0, (PTD | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* mcspi1_cs0 */ -- {MCSPI1_CS1, (PTD | IEN | OFF_EN | OFF_PD | OFF_IN | M3)}, /* mcspi1_cs1 */ -- {MCSPI1_CS2, (PTU | OFF_EN | OFF_OUT_PTU | M3)}, /* gpio_139 */ -- {MCSPI1_CS3, (PTU | IEN | M3)}, /* gpio_140 */ -- {UART3_CTS_RCTX, (PTU | IEN | M0)}, /* uart3_tx */ -- {UART3_RTS_SD, (M0)}, /* uart3_rts_sd */ -- {UART3_RX_IRRX, (IEN | M0)}, /* uart3_rx */ -- {UART3_TX_IRTX, (M0)}, /* uart3_tx */ -- {SDMMC5_CLK, (PTU | IEN | OFF_EN | OFF_OUT_PTD | M0)}, /* sdmmc5_clk */ -- {SDMMC5_CMD, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* sdmmc5_cmd */ -- {SDMMC5_DAT0, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* sdmmc5_dat0 */ -- {SDMMC5_DAT1, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* sdmmc5_dat1 */ -- {SDMMC5_DAT2, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* sdmmc5_dat2 */ -- {SDMMC5_DAT3, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* sdmmc5_dat3 */ -- {MCSPI4_CLK, (IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* mcspi4_clk */ -- {MCSPI4_SIMO, (IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* mcspi4_simo */ -- {MCSPI4_SOMI, (IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* mcspi4_somi */ -- {MCSPI4_CS0, (PTD | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* mcspi4_cs0 */ -- {UART4_RX, (IEN | M0)}, /* uart4_rx */ -- {UART4_TX, (M0)}, /* uart4_tx */ -- {USBB2_ULPITLL_CLK, (IEN | M3)}, /* gpio_157 */ -- {USBB2_ULPITLL_STP, (IEN | M5)}, /* dispc2_data23 */ -- {USBB2_ULPITLL_DIR, (IEN | M5)}, /* dispc2_data22 */ -- {USBB2_ULPITLL_NXT, (IEN | M5)}, /* dispc2_data21 */ -- {USBB2_ULPITLL_DAT0, (IEN | M5)}, /* dispc2_data20 */ -- {USBB2_ULPITLL_DAT1, (IEN | M5)}, /* dispc2_data19 */ -- {USBB2_ULPITLL_DAT2, (IEN | M5)}, /* dispc2_data18 */ -- {USBB2_ULPITLL_DAT3, (IEN | M5)}, /* dispc2_data15 */ -- {USBB2_ULPITLL_DAT4, (IEN | M5)}, /* dispc2_data14 */ -- {USBB2_ULPITLL_DAT5, (IEN | M5)}, /* dispc2_data13 */ -- {USBB2_ULPITLL_DAT6, (IEN | M5)}, /* dispc2_data12 */ -- {USBB2_ULPITLL_DAT7, (IEN | M5)}, /* dispc2_data11 */ -- {USBB2_HSIC_DATA, (PTD | OFF_EN | OFF_OUT_PTU | M3)}, /* gpio_169 */ -- {USBB2_HSIC_STROBE, (PTD | OFF_EN | OFF_OUT_PTU | M3)}, /* gpio_170 */ -- {UNIPRO_TX0, (PTD | IEN | M3)}, /* gpio_171 */ -- {UNIPRO_TY0, (OFF_EN | OFF_PD | OFF_IN | M1)}, /* kpd_col1 */ -- {UNIPRO_TX1, (OFF_EN | OFF_PD | OFF_IN | M1)}, /* kpd_col2 */ -- {UNIPRO_TY1, (OFF_EN | OFF_PD | OFF_IN | M1)}, /* kpd_col3 */ -- {UNIPRO_TX2, (PTU | IEN | M3)}, /* gpio_0 */ -- {UNIPRO_TY2, (PTU | IEN | M3)}, /* gpio_1 */ -- {UNIPRO_RX0, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1)}, /* kpd_row0 */ -- {UNIPRO_RY0, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1)}, /* kpd_row1 */ -- {UNIPRO_RX1, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1)}, /* kpd_row2 */ -- {UNIPRO_RY1, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1)}, /* kpd_row3 */ -- {UNIPRO_RX2, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1)}, /* kpd_row4 */ -- {UNIPRO_RY2, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1)}, /* kpd_row5 */ -- {USBA0_OTG_CE, (PTD | OFF_EN | OFF_PD | OFF_OUT_PTD | M0)}, /* usba0_otg_ce */ -- {USBA0_OTG_DP, (IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* usba0_otg_dp */ -- {USBA0_OTG_DM, (IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* usba0_otg_dm */ -- {FREF_CLK1_OUT, (M0)}, /* fref_clk1_out */ -- {FREF_CLK2_OUT, (PTU | IEN | M3)}, /* gpio_182 */ -- {SYS_NIRQ1, (PTU | IEN | M0)}, /* sys_nirq1 */ -- {SYS_NIRQ2, (PTU | IEN | M0)}, /* sys_nirq2 */ -- {SYS_BOOT0, (PTU | IEN | M3)}, /* gpio_184 */ -- {SYS_BOOT1, (M3)}, /* gpio_185 */ -- {SYS_BOOT2, (PTD | IEN | M3)}, /* gpio_186 */ -- {SYS_BOOT3, (M3)}, /* gpio_187 */ -- {SYS_BOOT4, (M3)}, /* gpio_188 */ -- {SYS_BOOT5, (PTD | IEN | M3)}, /* gpio_189 */ -- {DPM_EMU0, (IEN | M0)}, /* dpm_emu0 */ -- {DPM_EMU1, (IEN | M0)}, /* dpm_emu1 */ -- {DPM_EMU2, (IEN | M0)}, /* dpm_emu2 */ -- {DPM_EMU3, (IEN | M5)}, /* dispc2_data10 */ -- {DPM_EMU4, (IEN | M5)}, /* dispc2_data9 */ -- {DPM_EMU5, (IEN | M5)}, /* dispc2_data16 */ -- {DPM_EMU6, (IEN | M5)}, /* dispc2_data17 */ -- {DPM_EMU7, (IEN | M5)}, /* dispc2_hsync */ -- {DPM_EMU8, (IEN | M5)}, /* dispc2_pclk */ -- {DPM_EMU9, (IEN | M5)}, /* dispc2_vsync */ -- {DPM_EMU10, (IEN | M5)}, /* dispc2_de */ -- {DPM_EMU11, (IEN | M5)}, /* dispc2_data8 */ -- {DPM_EMU12, (IEN | M5)}, /* dispc2_data7 */ -- {DPM_EMU13, (IEN | M5)}, /* dispc2_data6 */ -- {DPM_EMU14, (IEN | M5)}, /* dispc2_data5 */ -- {DPM_EMU15, (IEN | M5)}, /* dispc2_data4 */ -- {DPM_EMU16, (M3)}, /* gpio_27 */ -- {DPM_EMU17, (IEN | M5)}, /* dispc2_data2 */ -- {DPM_EMU18, (IEN | M5)}, /* dispc2_data1 */ -- {DPM_EMU19, (IEN | M5)}, /* dispc2_data0 */ --}; -- --const struct pad_conf_entry wkup_padconf_array[] = { -- {PAD0_SIM_IO, (IEN | M0)}, /* sim_io */ -- {PAD1_SIM_CLK, (M0)}, /* sim_clk */ -- {PAD0_SIM_RESET, (M0)}, /* sim_reset */ -- {PAD1_SIM_CD, (PTU | IEN | M0)}, /* sim_cd */ -- {PAD0_SIM_PWRCTRL, (M0)}, /* sim_pwrctrl */ -- {PAD1_SR_SCL, (PTU | IEN | M0)}, /* sr_scl */ -- {PAD0_SR_SDA, (PTU | IEN | M0)}, /* sr_sda */ -- {PAD1_FREF_XTAL_IN, (M0)}, /* # */ -- {PAD0_FREF_SLICER_IN, (M0)}, /* fref_slicer_in */ -- {PAD1_FREF_CLK_IOREQ, (M0)}, /* fref_clk_ioreq */ -- {PAD0_FREF_CLK0_OUT, (M2)}, /* sys_drm_msecure */ -- {PAD1_FREF_CLK3_REQ, (M3)}, /* gpio_wk30 */ -- {PAD0_FREF_CLK3_OUT, (M0)}, /* fref_clk3_out */ -- {PAD1_FREF_CLK4_REQ, (PTU | OFF_EN | OFF_OUT_PTU | M3)}, /* led status_1 */ -- {PAD0_FREF_CLK4_OUT, (PTU | OFF_EN | OFF_OUT_PTU | M3)}, /* led status_2 */ -- {PAD1_SYS_32K, (IEN | M0)}, /* sys_32k */ -- {PAD0_SYS_NRESPWRON, (M0)}, /* sys_nrespwron */ -- {PAD1_SYS_NRESWARM, (M0)}, /* sys_nreswarm */ -- {PAD0_SYS_PWR_REQ, (PTU | M0)}, /* sys_pwr_req */ -- {PAD1_SYS_PWRON_RESET, (M3)}, /* gpio_wk29 */ -- {PAD0_SYS_BOOT6, (IEN | M3)}, /* gpio_wk9 */ -- {PAD1_SYS_BOOT7, (IEN | M3)}, /* gpio_wk10 */ --}; -- --#endif -diff --git a/board/ti/panda/panda_mux_data.h b/board/ti/panda/panda_mux_data.h -new file mode 100644 -index 0000000..8bb7fe5 ---- /dev/null -+++ b/board/ti/panda/panda_mux_data.h -@@ -0,0 +1,229 @@ -+/* -+ * (C) Copyright 2010 -+ * Texas Instruments Incorporated, <www.ti.com> -+ * -+ * Balaji Krishnamoorthy <balajitk@ti.com> -+ * Aneesh V <aneesh@ti.com> -+ * -+ * See file CREDITS for list of people who contributed to this -+ * project. -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License as -+ * published by the Free Software Foundation; either version 2 of -+ * the License, or (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+ * MA 02111-1307 USA -+ */ -+ -+#ifndef _PANDA_MUX_DATA_H_ -+#define _PANDA_MUX_DATA_H_ -+ -+#include <asm/io.h> -+#include <asm/arch/mux_omap4.h> -+ -+const struct pad_conf_entry core_padconf_array_non_essential[] = { -+ {GPMC_AD8, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M3)}, /* gpio_32 */ -+ {GPMC_AD9, (PTU | IEN | M3)}, /* gpio_33 */ -+ {GPMC_AD10, (PTU | IEN | M3)}, /* gpio_34 */ -+ {GPMC_AD11, (PTU | IEN | M3)}, /* gpio_35 */ -+ {GPMC_AD12, (PTU | IEN | M3)}, /* gpio_36 */ -+ {GPMC_AD13, (PTD | OFF_EN | OFF_PD | OFF_OUT_PTD | M3)}, /* gpio_37 */ -+ {GPMC_AD14, (PTD | OFF_EN | OFF_PD | OFF_OUT_PTD | M3)}, /* gpio_38 */ -+ {GPMC_AD15, (PTD | OFF_EN | OFF_PD | OFF_OUT_PTD | M3)}, /* gpio_39 */ -+ {GPMC_A16, (M3)}, /* gpio_40 */ -+ {GPMC_A17, (PTD | M3)}, /* gpio_41 */ -+ {GPMC_A18, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1)}, /* kpd_row6 */ -+ {GPMC_A19, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1)}, /* kpd_row7 */ -+ {GPMC_A20, (IEN | M3)}, /* gpio_44 */ -+ {GPMC_A21, (M3)}, /* gpio_45 */ -+ {GPMC_A22, (M3)}, /* gpio_46 */ -+ {GPMC_A23, (OFF_EN | OFF_PD | OFF_IN | M1)}, /* kpd_col7 */ -+ {GPMC_A24, (PTD | M3)}, /* gpio_48 */ -+ {GPMC_A25, (PTD | M3)}, /* gpio_49 */ -+ {GPMC_NCS0, (M3)}, /* gpio_50 */ -+ {GPMC_NCS1, (IEN | M3)}, /* gpio_51 */ -+ {GPMC_NCS2, (IEN | M3)}, /* gpio_52 */ -+ {GPMC_NCS3, (IEN | M3)}, /* gpio_53 */ -+ {GPMC_NWP, (M3)}, /* gpio_54 */ -+ {GPMC_CLK, (PTD | M3)}, /* gpio_55 */ -+ {GPMC_NADV_ALE, (M3)}, /* gpio_56 */ -+ {GPMC_NBE0_CLE, (M3)}, /* gpio_59 */ -+ {GPMC_NBE1, (PTD | M3)}, /* gpio_60 */ -+ {GPMC_WAIT0, (PTU | IEN | M3)}, /* gpio_61 */ -+ {GPMC_WAIT1, (PTD | OFF_EN | OFF_PD | OFF_OUT_PTD | M3)}, /* gpio_62 */ -+ {C2C_DATA11, (PTD | M3)}, /* gpio_100 */ -+ {C2C_DATA12, (PTU | IEN | M3)}, /* gpio_101 */ -+ {C2C_DATA13, (PTD | M3)}, /* gpio_102 */ -+ {C2C_DATA14, (M1)}, /* dsi2_te0 */ -+ {C2C_DATA15, (PTD | M3)}, /* gpio_104 */ -+ {HDMI_HPD, (M0)}, /* hdmi_hpd */ -+ {HDMI_CEC, (M0)}, /* hdmi_cec */ -+ {HDMI_DDC_SCL, (PTU | M0)}, /* hdmi_ddc_scl */ -+ {HDMI_DDC_SDA, (PTU | IEN | M0)}, /* hdmi_ddc_sda */ -+ {CSI21_DX0, (IEN | M0)}, /* csi21_dx0 */ -+ {CSI21_DY0, (IEN | M0)}, /* csi21_dy0 */ -+ {CSI21_DX1, (IEN | M0)}, /* csi21_dx1 */ -+ {CSI21_DY1, (IEN | M0)}, /* csi21_dy1 */ -+ {CSI21_DX2, (IEN | M0)}, /* csi21_dx2 */ -+ {CSI21_DY2, (IEN | M0)}, /* csi21_dy2 */ -+ {CSI21_DX3, (PTD | M7)}, /* csi21_dx3 */ -+ {CSI21_DY3, (PTD | M7)}, /* csi21_dy3 */ -+ {CSI21_DX4, (PTD | OFF_EN | OFF_PD | OFF_IN | M7)}, /* csi21_dx4 */ -+ {CSI21_DY4, (PTD | OFF_EN | OFF_PD | OFF_IN | M7)}, /* csi21_dy4 */ -+ {CSI22_DX0, (IEN | M0)}, /* csi22_dx0 */ -+ {CSI22_DY0, (IEN | M0)}, /* csi22_dy0 */ -+ {CSI22_DX1, (IEN | M0)}, /* csi22_dx1 */ -+ {CSI22_DY1, (IEN | M0)}, /* csi22_dy1 */ -+ {CAM_SHUTTER, (OFF_EN | OFF_PD | OFF_OUT_PTD | M0)}, /* cam_shutter */ -+ {CAM_STROBE, (OFF_EN | OFF_PD | OFF_OUT_PTD | M0)}, /* cam_strobe */ -+ {CAM_GLOBALRESET, (PTD | OFF_EN | OFF_PD | OFF_OUT_PTD | M3)}, /* gpio_83 */ -+ {USBB1_ULPITLL_CLK, (PTD | IEN | OFF_EN | OFF_PD | OFF_IN | M4)},/* usbb1_ulpiphy_clk */ -+ {USBB1_ULPITLL_STP, (OFF_EN | OFF_OUT_PTD | M4)}, /* usbb1_ulpiphy_stp */ -+ {USBB1_ULPITLL_DIR, (IEN | OFF_EN | OFF_PD | OFF_IN | M4)}, /* usbb1_ulpiphy_dir */ -+ {USBB1_ULPITLL_NXT, (IEN | OFF_EN | OFF_PD | OFF_IN | M4)}, /* usbb1_ulpiphy_nxt */ -+ {USBB1_ULPITLL_DAT0, (IEN | OFF_EN | OFF_PD | OFF_IN | M4)}, /* usbb1_ulpiphy_dat0 */ -+ {USBB1_ULPITLL_DAT1, (IEN | OFF_EN | OFF_PD | OFF_IN | M4)}, /* usbb1_ulpiphy_dat1 */ -+ {USBB1_ULPITLL_DAT2, (IEN | OFF_EN | OFF_PD | OFF_IN | M4)}, /* usbb1_ulpiphy_dat2 */ -+ {USBB1_ULPITLL_DAT3, (IEN | OFF_EN | OFF_PD | OFF_IN | M4)}, /* usbb1_ulpiphy_dat3 */ -+ {USBB1_ULPITLL_DAT4, (IEN | OFF_EN | OFF_PD | OFF_IN | M4)}, /* usbb1_ulpiphy_dat4 */ -+ {USBB1_ULPITLL_DAT5, (IEN | OFF_EN | OFF_PD | OFF_IN | M4)}, /* usbb1_ulpiphy_dat5 */ -+ {USBB1_ULPITLL_DAT6, (IEN | OFF_EN | OFF_PD | OFF_IN | M4)}, /* usbb1_ulpiphy_dat6 */ -+ {USBB1_ULPITLL_DAT7, (IEN | OFF_EN | OFF_PD | OFF_IN | M4)}, /* usbb1_ulpiphy_dat7 */ -+ {USBB1_HSIC_DATA, (IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* usbb1_hsic_data */ -+ {USBB1_HSIC_STROBE, (IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* usbb1_hsic_strobe */ -+ {USBC1_ICUSB_DP, (IEN | M0)}, /* usbc1_icusb_dp */ -+ {USBC1_ICUSB_DM, (IEN | M0)}, /* usbc1_icusb_dm */ -+ {ABE_MCBSP2_CLKX, (IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* abe_mcbsp2_clkx */ -+ {ABE_MCBSP2_DR, (IEN | OFF_EN | OFF_OUT_PTD | M0)}, /* abe_mcbsp2_dr */ -+ {ABE_MCBSP2_DX, (OFF_EN | OFF_OUT_PTD | M0)}, /* abe_mcbsp2_dx */ -+ {ABE_MCBSP2_FSX, (IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* abe_mcbsp2_fsx */ -+ {ABE_MCBSP1_CLKX, (IEN | M1)}, /* abe_slimbus1_clock */ -+ {ABE_MCBSP1_DR, (IEN | M1)}, /* abe_slimbus1_data */ -+ {ABE_MCBSP1_DX, (OFF_EN | OFF_OUT_PTD | M0)}, /* abe_mcbsp1_dx */ -+ {ABE_MCBSP1_FSX, (IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* abe_mcbsp1_fsx */ -+ {ABE_PDM_UL_DATA, (PTD | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* abe_pdm_ul_data */ -+ {ABE_PDM_DL_DATA, (PTD | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* abe_pdm_dl_data */ -+ {ABE_PDM_FRAME, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* abe_pdm_frame */ -+ {ABE_PDM_LB_CLK, (PTD | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* abe_pdm_lb_clk */ -+ {ABE_CLKS, (PTD | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* abe_clks */ -+ {ABE_DMIC_CLK1, (M0)}, /* abe_dmic_clk1 */ -+ {ABE_DMIC_DIN1, (IEN | M0)}, /* abe_dmic_din1 */ -+ {ABE_DMIC_DIN2, (IEN | M0)}, /* abe_dmic_din2 */ -+ {ABE_DMIC_DIN3, (IEN | M0)}, /* abe_dmic_din3 */ -+ {UART2_CTS, (PTU | IEN | M0)}, /* uart2_cts */ -+ {UART2_RTS, (M0)}, /* uart2_rts */ -+ {UART2_RX, (PTU | IEN | M0)}, /* uart2_rx */ -+ {UART2_TX, (M0)}, /* uart2_tx */ -+ {HDQ_SIO, (M3)}, /* gpio_127 */ -+ {MCSPI1_CLK, (IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* mcspi1_clk */ -+ {MCSPI1_SOMI, (IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* mcspi1_somi */ -+ {MCSPI1_SIMO, (IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* mcspi1_simo */ -+ {MCSPI1_CS0, (PTD | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* mcspi1_cs0 */ -+ {MCSPI1_CS1, (PTD | IEN | OFF_EN | OFF_PD | OFF_IN | M3)}, /* mcspi1_cs1 */ -+ {MCSPI1_CS2, (PTU | OFF_EN | OFF_OUT_PTU | M3)}, /* gpio_139 */ -+ {MCSPI1_CS3, (PTU | IEN | M3)}, /* gpio_140 */ -+ {SDMMC5_CLK, (PTU | IEN | OFF_EN | OFF_OUT_PTD | M0)}, /* sdmmc5_clk */ -+ {SDMMC5_CMD, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* sdmmc5_cmd */ -+ {SDMMC5_DAT0, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* sdmmc5_dat0 */ -+ {SDMMC5_DAT1, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* sdmmc5_dat1 */ -+ {SDMMC5_DAT2, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* sdmmc5_dat2 */ -+ {SDMMC5_DAT3, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* sdmmc5_dat3 */ -+ {MCSPI4_CLK, (IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* mcspi4_clk */ -+ {MCSPI4_SIMO, (IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* mcspi4_simo */ -+ {MCSPI4_SOMI, (IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* mcspi4_somi */ -+ {MCSPI4_CS0, (PTD | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* mcspi4_cs0 */ -+ {UART4_RX, (IEN | M0)}, /* uart4_rx */ -+ {UART4_TX, (M0)}, /* uart4_tx */ -+ {USBB2_ULPITLL_CLK, (IEN | M3)}, /* gpio_157 */ -+ {USBB2_ULPITLL_STP, (IEN | M5)}, /* dispc2_data23 */ -+ {USBB2_ULPITLL_DIR, (IEN | M5)}, /* dispc2_data22 */ -+ {USBB2_ULPITLL_NXT, (IEN | M5)}, /* dispc2_data21 */ -+ {USBB2_ULPITLL_DAT0, (IEN | M5)}, /* dispc2_data20 */ -+ {USBB2_ULPITLL_DAT1, (IEN | M5)}, /* dispc2_data19 */ -+ {USBB2_ULPITLL_DAT2, (IEN | M5)}, /* dispc2_data18 */ -+ {USBB2_ULPITLL_DAT3, (IEN | M5)}, /* dispc2_data15 */ -+ {USBB2_ULPITLL_DAT4, (IEN | M5)}, /* dispc2_data14 */ -+ {USBB2_ULPITLL_DAT5, (IEN | M5)}, /* dispc2_data13 */ -+ {USBB2_ULPITLL_DAT6, (IEN | M5)}, /* dispc2_data12 */ -+ {USBB2_ULPITLL_DAT7, (IEN | M5)}, /* dispc2_data11 */ -+ {USBB2_HSIC_DATA, (PTD | OFF_EN | OFF_OUT_PTU | M3)}, /* gpio_169 */ -+ {USBB2_HSIC_STROBE, (PTD | OFF_EN | OFF_OUT_PTU | M3)}, /* gpio_170 */ -+ {UNIPRO_TX0, (PTD | IEN | M3)}, /* gpio_171 */ -+ {UNIPRO_TY0, (OFF_EN | OFF_PD | OFF_IN | M1)}, /* kpd_col1 */ -+ {UNIPRO_TX1, (OFF_EN | OFF_PD | OFF_IN | M1)}, /* kpd_col2 */ -+ {UNIPRO_TY1, (OFF_EN | OFF_PD | OFF_IN | M1)}, /* kpd_col3 */ -+ {UNIPRO_TX2, (PTU | IEN | M3)}, /* gpio_0 */ -+ {UNIPRO_TY2, (PTU | IEN | M3)}, /* gpio_1 */ -+ {UNIPRO_RX0, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1)}, /* kpd_row0 */ -+ {UNIPRO_RY0, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1)}, /* kpd_row1 */ -+ {UNIPRO_RX1, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1)}, /* kpd_row2 */ -+ {UNIPRO_RY1, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1)}, /* kpd_row3 */ -+ {UNIPRO_RX2, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1)}, /* kpd_row4 */ -+ {UNIPRO_RY2, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1)}, /* kpd_row5 */ -+ {USBA0_OTG_CE, (PTD | OFF_EN | OFF_PD | OFF_OUT_PTD | M0)}, /* usba0_otg_ce */ -+ {USBA0_OTG_DP, (IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* usba0_otg_dp */ -+ {USBA0_OTG_DM, (IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* usba0_otg_dm */ -+ {FREF_CLK1_OUT, (M0)}, /* fref_clk1_out */ -+ {FREF_CLK2_OUT, (PTU | IEN | M3)}, /* gpio_182 */ -+ {SYS_NIRQ1, (PTU | IEN | M0)}, /* sys_nirq1 */ -+ {SYS_NIRQ2, (PTU | IEN | M0)}, /* sys_nirq2 */ -+ {SYS_BOOT0, (PTU | IEN | M3)}, /* gpio_184 */ -+ {SYS_BOOT1, (M3)}, /* gpio_185 */ -+ {SYS_BOOT2, (PTD | IEN | M3)}, /* gpio_186 */ -+ {SYS_BOOT3, (M3)}, /* gpio_187 */ -+ {SYS_BOOT4, (M3)}, /* gpio_188 */ -+ {SYS_BOOT5, (PTD | IEN | M3)}, /* gpio_189 */ -+ {DPM_EMU0, (IEN | M0)}, /* dpm_emu0 */ -+ {DPM_EMU1, (IEN | M0)}, /* dpm_emu1 */ -+ {DPM_EMU2, (IEN | M0)}, /* dpm_emu2 */ -+ {DPM_EMU3, (IEN | M5)}, /* dispc2_data10 */ -+ {DPM_EMU4, (IEN | M5)}, /* dispc2_data9 */ -+ {DPM_EMU5, (IEN | M5)}, /* dispc2_data16 */ -+ {DPM_EMU6, (IEN | M5)}, /* dispc2_data17 */ -+ {DPM_EMU7, (IEN | M5)}, /* dispc2_hsync */ -+ {DPM_EMU8, (IEN | M5)}, /* dispc2_pclk */ -+ {DPM_EMU9, (IEN | M5)}, /* dispc2_vsync */ -+ {DPM_EMU10, (IEN | M5)}, /* dispc2_de */ -+ {DPM_EMU11, (IEN | M5)}, /* dispc2_data8 */ -+ {DPM_EMU12, (IEN | M5)}, /* dispc2_data7 */ -+ {DPM_EMU13, (IEN | M5)}, /* dispc2_data6 */ -+ {DPM_EMU14, (IEN | M5)}, /* dispc2_data5 */ -+ {DPM_EMU15, (IEN | M5)}, /* dispc2_data4 */ -+ {DPM_EMU16, (M3)}, /* gpio_27 */ -+ {DPM_EMU17, (IEN | M5)}, /* dispc2_data2 */ -+ {DPM_EMU18, (IEN | M5)}, /* dispc2_data1 */ -+ {DPM_EMU19, (IEN | M5)}, /* dispc2_data0 */ -+}; -+ -+const struct pad_conf_entry wkup_padconf_array_non_essential[] = { -+ {PAD0_SIM_IO, (IEN | M0)}, /* sim_io */ -+ {PAD1_SIM_CLK, (M0)}, /* sim_clk */ -+ {PAD0_SIM_RESET, (M0)}, /* sim_reset */ -+ {PAD1_SIM_CD, (PTU | IEN | M0)}, /* sim_cd */ -+ {PAD0_SIM_PWRCTRL, (M0)}, /* sim_pwrctrl */ -+ {PAD1_FREF_XTAL_IN, (M0)}, /* # */ -+ {PAD0_FREF_SLICER_IN, (M0)}, /* fref_slicer_in */ -+ {PAD1_FREF_CLK_IOREQ, (M0)}, /* fref_clk_ioreq */ -+ {PAD0_FREF_CLK0_OUT, (M2)}, /* sys_drm_msecure */ -+ {PAD1_FREF_CLK3_REQ, (M3)}, /* gpio_wk30 */ -+ {PAD0_FREF_CLK3_OUT, (M0)}, /* fref_clk3_out */ -+ {PAD1_FREF_CLK4_REQ, (PTU | OFF_EN | OFF_OUT_PTU | M3)}, /* led status_1 */ -+ {PAD0_FREF_CLK4_OUT, (PTU | OFF_EN | OFF_OUT_PTU | M3)}, /* led status_2 */ -+ {PAD0_SYS_NRESPWRON, (M0)}, /* sys_nrespwron */ -+ {PAD1_SYS_NRESWARM, (M0)}, /* sys_nreswarm */ -+ {PAD0_SYS_PWR_REQ, (PTU | M0)}, /* sys_pwr_req */ -+ {PAD1_SYS_PWRON_RESET, (M3)}, /* gpio_wk29 */ -+ {PAD0_SYS_BOOT6, (IEN | M3)}, /* gpio_wk9 */ -+ {PAD1_SYS_BOOT7, (IEN | M3)}, /* gpio_wk10 */ -+}; -+ -+#endif /* _PANDA_MUX_DATA_H_ */ -diff --git a/board/ti/sdp4430/sdp.c b/board/ti/sdp4430/sdp.c -index b13c4c5..a5ea682 100644 ---- a/board/ti/sdp4430/sdp.c -+++ b/board/ti/sdp4430/sdp.c -@@ -27,7 +27,7 @@ - #include <asm/arch/sys_proto.h> - #include <asm/arch/mmc_host_def.h> - --#include "sdp.h" -+#include "sdp4430_mux_data.h" - - DECLARE_GLOBAL_DATA_PTR; - -@@ -70,27 +70,14 @@ int misc_init_r(void) - return 0; - } - --void do_set_mux(u32 base, struct pad_conf_entry const *array, int size) -+void set_muxconf_regs_non_essential(void) - { -- int i; -- struct pad_conf_entry *pad = (struct pad_conf_entry *) array; -- -- for (i = 0; i < size; i++, pad++) -- writew(pad->val, base + pad->offset); --} -- --/** -- * @brief set_muxconf_regs Setting up the configuration Mux registers -- * specific to the board. -- */ --void set_muxconf_regs(void) --{ -- do_set_mux(CONTROL_PADCONF_CORE, core_padconf_array, -- sizeof(core_padconf_array) / -+ do_set_mux(CONTROL_PADCONF_CORE, core_padconf_array_non_essential, -+ sizeof(core_padconf_array_non_essential) / - sizeof(struct pad_conf_entry)); - -- do_set_mux(CONTROL_PADCONF_WKUP, wkup_padconf_array, -- sizeof(wkup_padconf_array) / -+ do_set_mux(CONTROL_PADCONF_WKUP, wkup_padconf_array_non_essential, -+ sizeof(wkup_padconf_array_non_essential) / - sizeof(struct pad_conf_entry)); - } - -diff --git a/board/ti/sdp4430/sdp.h b/board/ti/sdp4430/sdp.h -deleted file mode 100644 -index bf41067..0000000 ---- a/board/ti/sdp4430/sdp.h -+++ /dev/null -@@ -1,264 +0,0 @@ --/* -- * (C) Copyright 2010 -- * Texas Instruments Incorporated, <www.ti.com> -- * -- * Balaji Krishnamoorthy <balajitk@ti.com> -- * Aneesh V <aneesh@ti.com> -- * -- * See file CREDITS for list of people who contributed to this -- * project. -- * -- * This program is free software; you can redistribute it and/or -- * modify it under the terms of the GNU General Public License as -- * published by the Free Software Foundation; either version 2 of -- * the License, or (at your option) any later version. -- * -- * This program is distributed in the hope that it will be useful, -- * but WITHOUT ANY WARRANTY; without even the implied warranty of -- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- * GNU General Public License for more details. -- * -- * You should have received a copy of the GNU General Public License -- * along with this program; if not, write to the Free Software -- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, -- * MA 02111-1307 USA -- */ -- --#ifndef _SDP_H_ --#define _SDP_H_ -- --#include <asm/io.h> --#include <asm/arch/mux_omap4.h> -- --const struct pad_conf_entry core_padconf_array[] = { -- {GPMC_AD0, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1)}, /* sdmmc2_dat0 */ -- {GPMC_AD1, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1)}, /* sdmmc2_dat1 */ -- {GPMC_AD2, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1)}, /* sdmmc2_dat2 */ -- {GPMC_AD3, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1)}, /* sdmmc2_dat3 */ -- {GPMC_AD4, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1)}, /* sdmmc2_dat4 */ -- {GPMC_AD5, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1)}, /* sdmmc2_dat5 */ -- {GPMC_AD6, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1)}, /* sdmmc2_dat6 */ -- {GPMC_AD7, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1)}, /* sdmmc2_dat7 */ -- {GPMC_AD8, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M3)}, /* gpio_32 */ -- {GPMC_AD9, (PTU | IEN | M3)}, /* gpio_33 */ -- {GPMC_AD10, (PTU | IEN | M3)}, /* gpio_34 */ -- {GPMC_AD11, (PTU | IEN | M3)}, /* gpio_35 */ -- {GPMC_AD12, (PTU | IEN | M3)}, /* gpio_36 */ -- {GPMC_AD13, (PTD | OFF_EN | OFF_PD | OFF_OUT_PTD | M3)}, /* gpio_37 */ -- {GPMC_AD14, (PTD | OFF_EN | OFF_PD | OFF_OUT_PTD | M3)}, /* gpio_38 */ -- {GPMC_AD15, (PTD | OFF_EN | OFF_PD | OFF_OUT_PTD | M3)}, /* gpio_39 */ -- {GPMC_A16, (M3)}, /* gpio_40 */ -- {GPMC_A17, (PTD | M3)}, /* gpio_41 */ -- {GPMC_A18, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1)}, /* kpd_row6 */ -- {GPMC_A19, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1)}, /* kpd_row7 */ -- {GPMC_A20, (IEN | M3)}, /* gpio_44 */ -- {GPMC_A21, (M3)}, /* gpio_45 */ -- {GPMC_A22, (OFF_EN | OFF_PD | OFF_IN | M1)}, /* kpd_col6 */ -- {GPMC_A23, (OFF_EN | OFF_PD | OFF_IN | M1)}, /* kpd_col7 */ -- {GPMC_A24, (PTD | M3)}, /* gpio_48 */ -- {GPMC_A25, (PTD | M3)}, /* gpio_49 */ -- {GPMC_NCS0, (M3)}, /* gpio_50 */ -- {GPMC_NCS1, (IEN | M3)}, /* gpio_51 */ -- {GPMC_NCS2, (IEN | M3)}, /* gpio_52 */ -- {GPMC_NCS3, (IEN | M3)}, /* gpio_53 */ -- {GPMC_NWP, (M3)}, /* gpio_54 */ -- {GPMC_CLK, (PTD | M3)}, /* gpio_55 */ -- {GPMC_NADV_ALE, (M3)}, /* gpio_56 */ -- {GPMC_NOE, (PTU | IEN | OFF_EN | OFF_OUT_PTD | M1)}, /* sdmmc2_clk */ -- {GPMC_NWE, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1)}, /* sdmmc2_cmd */ -- {GPMC_NBE0_CLE, (M3)}, /* gpio_59 */ -- {GPMC_NBE1, (PTD | M3)}, /* gpio_60 */ -- {GPMC_WAIT0, (PTU | IEN | M3)}, /* gpio_61 */ -- {GPMC_WAIT1, (IEN | M3)}, /* gpio_62 */ -- {C2C_DATA11, (PTD | M3)}, /* gpio_100 */ -- {C2C_DATA12, (M1)}, /* dsi1_te0 */ -- {C2C_DATA13, (PTD | M3)}, /* gpio_102 */ -- {C2C_DATA14, (M1)}, /* dsi2_te0 */ -- {C2C_DATA15, (PTD | M3)}, /* gpio_104 */ -- {HDMI_HPD, (M0)}, /* hdmi_hpd */ -- {HDMI_CEC, (M0)}, /* hdmi_cec */ -- {HDMI_DDC_SCL, (PTU | M0)}, /* hdmi_ddc_scl */ -- {HDMI_DDC_SDA, (PTU | IEN | M0)}, /* hdmi_ddc_sda */ -- {CSI21_DX0, (IEN | M0)}, /* csi21_dx0 */ -- {CSI21_DY0, (IEN | M0)}, /* csi21_dy0 */ -- {CSI21_DX1, (IEN | M0)}, /* csi21_dx1 */ -- {CSI21_DY1, (IEN | M0)}, /* csi21_dy1 */ -- {CSI21_DX2, (IEN | M0)}, /* csi21_dx2 */ -- {CSI21_DY2, (IEN | M0)}, /* csi21_dy2 */ -- {CSI21_DX3, (PTD | M7)}, /* csi21_dx3 */ -- {CSI21_DY3, (PTD | M7)}, /* csi21_dy3 */ -- {CSI21_DX4, (PTD | OFF_EN | OFF_PD | OFF_IN | M7)}, /* csi21_dx4 */ -- {CSI21_DY4, (PTD | OFF_EN | OFF_PD | OFF_IN | M7)}, /* csi21_dy4 */ -- {CSI22_DX0, (IEN | M0)}, /* csi22_dx0 */ -- {CSI22_DY0, (IEN | M0)}, /* csi22_dy0 */ -- {CSI22_DX1, (IEN | M0)}, /* csi22_dx1 */ -- {CSI22_DY1, (IEN | M0)}, /* csi22_dy1 */ -- {CAM_SHUTTER, (OFF_EN | OFF_PD | OFF_OUT_PTD | M0)}, /* cam_shutter */ -- {CAM_STROBE, (OFF_EN | OFF_PD | OFF_OUT_PTD | M0)}, /* cam_strobe */ -- {CAM_GLOBALRESET, (PTD | OFF_EN | OFF_PD | OFF_OUT_PTD | M3)}, /* gpio_83 */ -- {USBB1_ULPITLL_CLK, (PTD | IEN | OFF_EN | OFF_PD | OFF_IN | M4)},/* usbb1_ulpiphy_clk */ -- {USBB1_ULPITLL_STP, (OFF_EN | OFF_OUT_PTD | M4)}, /* usbb1_ulpiphy_stp */ -- {USBB1_ULPITLL_DIR, (IEN | OFF_EN | OFF_PD | OFF_IN | M4)}, /* usbb1_ulpiphy_dir */ -- {USBB1_ULPITLL_NXT, (IEN | OFF_EN | OFF_PD | OFF_IN | M4)}, /* usbb1_ulpiphy_nxt */ -- {USBB1_ULPITLL_DAT0, (IEN | OFF_EN | OFF_PD | OFF_IN | M4)}, /* usbb1_ulpiphy_dat0 */ -- {USBB1_ULPITLL_DAT1, (IEN | OFF_EN | OFF_PD | OFF_IN | M4)}, /* usbb1_ulpiphy_dat1 */ -- {USBB1_ULPITLL_DAT2, (IEN | OFF_EN | OFF_PD | OFF_IN | M4)}, /* usbb1_ulpiphy_dat2 */ -- {USBB1_ULPITLL_DAT3, (IEN | OFF_EN | OFF_PD | OFF_IN | M4)}, /* usbb1_ulpiphy_dat3 */ -- {USBB1_ULPITLL_DAT4, (IEN | OFF_EN | OFF_PD | OFF_IN | M4)}, /* usbb1_ulpiphy_dat4 */ -- {USBB1_ULPITLL_DAT5, (IEN | OFF_EN | OFF_PD | OFF_IN | M4)}, /* usbb1_ulpiphy_dat5 */ -- {USBB1_ULPITLL_DAT6, (IEN | OFF_EN | OFF_PD | OFF_IN | M4)}, /* usbb1_ulpiphy_dat6 */ -- {USBB1_ULPITLL_DAT7, (IEN | OFF_EN | OFF_PD | OFF_IN | M4)}, /* usbb1_ulpiphy_dat7 */ -- {USBB1_HSIC_DATA, (IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* usbb1_hsic_data */ -- {USBB1_HSIC_STROBE, (IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* usbb1_hsic_strobe */ -- {USBC1_ICUSB_DP, (IEN | M0)}, /* usbc1_icusb_dp */ -- {USBC1_ICUSB_DM, (IEN | M0)}, /* usbc1_icusb_dm */ -- {SDMMC1_CLK, (PTU | OFF_EN | OFF_OUT_PTD | M0)}, /* sdmmc1_clk */ -- {SDMMC1_CMD, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* sdmmc1_cmd */ -- {SDMMC1_DAT0, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* sdmmc1_dat0 */ -- {SDMMC1_DAT1, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* sdmmc1_dat1 */ -- {SDMMC1_DAT2, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* sdmmc1_dat2 */ -- {SDMMC1_DAT3, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* sdmmc1_dat3 */ -- {SDMMC1_DAT4, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* sdmmc1_dat4 */ -- {SDMMC1_DAT5, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* sdmmc1_dat5 */ -- {SDMMC1_DAT6, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* sdmmc1_dat6 */ -- {SDMMC1_DAT7, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* sdmmc1_dat7 */ -- {ABE_MCBSP2_CLKX, (IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* abe_mcbsp2_clkx */ -- {ABE_MCBSP2_DR, (IEN | OFF_EN | OFF_OUT_PTD | M0)}, /* abe_mcbsp2_dr */ -- {ABE_MCBSP2_DX, (OFF_EN | OFF_OUT_PTD | M0)}, /* abe_mcbsp2_dx */ -- {ABE_MCBSP2_FSX, (IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* abe_mcbsp2_fsx */ -- {ABE_MCBSP1_CLKX, (IEN | M1)}, /* abe_slimbus1_clock */ -- {ABE_MCBSP1_DR, (IEN | M1)}, /* abe_slimbus1_data */ -- {ABE_MCBSP1_DX, (OFF_EN | OFF_OUT_PTD | M0)}, /* abe_mcbsp1_dx */ -- {ABE_MCBSP1_FSX, (IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* abe_mcbsp1_fsx */ -- {ABE_PDM_UL_DATA, (PTD | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* abe_pdm_ul_data */ -- {ABE_PDM_DL_DATA, (PTD | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* abe_pdm_dl_data */ -- {ABE_PDM_FRAME, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* abe_pdm_frame */ -- {ABE_PDM_LB_CLK, (PTD | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* abe_pdm_lb_clk */ -- {ABE_CLKS, (PTD | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* abe_clks */ -- {ABE_DMIC_CLK1, (M0)}, /* abe_dmic_clk1 */ -- {ABE_DMIC_DIN1, (IEN | M0)}, /* abe_dmic_din1 */ -- {ABE_DMIC_DIN2, (IEN | M0)}, /* abe_dmic_din2 */ -- {ABE_DMIC_DIN3, (IEN | M0)}, /* abe_dmic_din3 */ -- {UART2_CTS, (PTU | IEN | M0)}, /* uart2_cts */ -- {UART2_RTS, (M0)}, /* uart2_rts */ -- {UART2_RX, (PTU | IEN | M0)}, /* uart2_rx */ -- {UART2_TX, (M0)}, /* uart2_tx */ -- {HDQ_SIO, (M3)}, /* gpio_127 */ -- {I2C1_SCL, (PTU | IEN | M0)}, /* i2c1_scl */ -- {I2C1_SDA, (PTU | IEN | M0)}, /* i2c1_sda */ -- {I2C2_SCL, (PTU | IEN | M0)}, /* i2c2_scl */ -- {I2C2_SDA, (PTU | IEN | M0)}, /* i2c2_sda */ -- {I2C3_SCL, (PTU | IEN | M0)}, /* i2c3_scl */ -- {I2C3_SDA, (PTU | IEN | M0)}, /* i2c3_sda */ -- {I2C4_SCL, (PTU | IEN | M0)}, /* i2c4_scl */ -- {I2C4_SDA, (PTU | IEN | M0)}, /* i2c4_sda */ -- {MCSPI1_CLK, (IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* mcspi1_clk */ -- {MCSPI1_SOMI, (IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* mcspi1_somi */ -- {MCSPI1_SIMO, (IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* mcspi1_simo */ -- {MCSPI1_CS0, (PTD | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* mcspi1_cs0 */ -- {MCSPI1_CS1, (PTD | IEN | OFF_EN | OFF_PD | OFF_IN | M3)}, /* mcspi1_cs1 */ -- {MCSPI1_CS2, (PTU | OFF_EN | OFF_OUT_PTU | M3)}, /* gpio_139 */ -- {MCSPI1_CS3, (PTU | IEN | M3)}, /* gpio_140 */ -- {UART3_CTS_RCTX, (PTU | IEN | M0)}, /* uart3_tx */ -- {UART3_RTS_SD, (M0)}, /* uart3_rts_sd */ -- {UART3_RX_IRRX, (IEN | M0)}, /* uart3_rx */ -- {UART3_TX_IRTX, (M0)}, /* uart3_tx */ -- {SDMMC5_CLK, (PTU | IEN | OFF_EN | OFF_OUT_PTD | M0)}, /* sdmmc5_clk */ -- {SDMMC5_CMD, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* sdmmc5_cmd */ -- {SDMMC5_DAT0, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* sdmmc5_dat0 */ -- {SDMMC5_DAT1, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* sdmmc5_dat1 */ -- {SDMMC5_DAT2, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* sdmmc5_dat2 */ -- {SDMMC5_DAT3, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* sdmmc5_dat3 */ -- {MCSPI4_CLK, (IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* mcspi4_clk */ -- {MCSPI4_SIMO, (IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* mcspi4_simo */ -- {MCSPI4_SOMI, (IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* mcspi4_somi */ -- {MCSPI4_CS0, (PTD | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* mcspi4_cs0 */ -- {UART4_RX, (IEN | M0)}, /* uart4_rx */ -- {UART4_TX, (M0)}, /* uart4_tx */ -- {USBB2_ULPITLL_CLK, (IEN | M3)}, /* gpio_157 */ -- {USBB2_ULPITLL_STP, (IEN | M5)}, /* dispc2_data23 */ -- {USBB2_ULPITLL_DIR, (IEN | M5)}, /* dispc2_data22 */ -- {USBB2_ULPITLL_NXT, (IEN | M5)}, /* dispc2_data21 */ -- {USBB2_ULPITLL_DAT0, (IEN | M5)}, /* dispc2_data20 */ -- {USBB2_ULPITLL_DAT1, (IEN | M5)}, /* dispc2_data19 */ -- {USBB2_ULPITLL_DAT2, (IEN | M5)}, /* dispc2_data18 */ -- {USBB2_ULPITLL_DAT3, (IEN | M5)}, /* dispc2_data15 */ -- {USBB2_ULPITLL_DAT4, (IEN | M5)}, /* dispc2_data14 */ -- {USBB2_ULPITLL_DAT5, (IEN | M5)}, /* dispc2_data13 */ -- {USBB2_ULPITLL_DAT6, (IEN | M5)}, /* dispc2_data12 */ -- {USBB2_ULPITLL_DAT7, (IEN | M5)}, /* dispc2_data11 */ -- {USBB2_HSIC_DATA, (PTD | OFF_EN | OFF_OUT_PTU | M3)}, /* gpio_169 */ -- {USBB2_HSIC_STROBE, (PTD | OFF_EN | OFF_OUT_PTU | M3)}, /* gpio_170 */ -- {UNIPRO_TX0, (OFF_EN | OFF_PD | OFF_IN | M1)}, /* kpd_col0 */ -- {UNIPRO_TY0, (OFF_EN | OFF_PD | OFF_IN | M1)}, /* kpd_col1 */ -- {UNIPRO_TX1, (OFF_EN | OFF_PD | OFF_IN | M1)}, /* kpd_col2 */ -- {UNIPRO_TY1, (OFF_EN | OFF_PD | OFF_IN | M1)}, /* kpd_col3 */ -- {UNIPRO_TX2, (OFF_EN | OFF_PD | OFF_IN | M1)}, /* kpd_col4 */ -- {UNIPRO_TY2, (OFF_EN | OFF_PD | OFF_IN | M1)}, /* kpd_col5 */ -- {UNIPRO_RX0, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1)}, /* kpd_row0 */ -- {UNIPRO_RY0, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1)}, /* kpd_row1 */ -- {UNIPRO_RX1, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1)}, /* kpd_row2 */ -- {UNIPRO_RY1, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1)}, /* kpd_row3 */ -- {UNIPRO_RX2, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1)}, /* kpd_row4 */ -- {UNIPRO_RY2, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1)}, /* kpd_row5 */ -- {USBA0_OTG_CE, (PTD | OFF_EN | OFF_PD | OFF_OUT_PTD | M0)}, /* usba0_otg_ce */ -- {USBA0_OTG_DP, (IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* usba0_otg_dp */ -- {USBA0_OTG_DM, (IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* usba0_otg_dm */ -- {FREF_CLK1_OUT, (M0)}, /* fref_clk1_out */ -- {FREF_CLK2_OUT, (M0)}, /* fref_clk2_out */ -- {SYS_NIRQ1, (PTU | IEN | M0)}, /* sys_nirq1 */ -- {SYS_NIRQ2, (PTU | IEN | M0)}, /* sys_nirq2 */ -- {SYS_BOOT0, (PTU | IEN | M3)}, /* gpio_184 */ -- {SYS_BOOT1, (M3)}, /* gpio_185 */ -- {SYS_BOOT2, (PTD | IEN | M3)}, /* gpio_186 */ -- {SYS_BOOT3, (M3)}, /* gpio_187 */ -- {SYS_BOOT4, (M3)}, /* gpio_188 */ -- {SYS_BOOT5, (PTD | IEN | M3)}, /* gpio_189 */ -- {DPM_EMU0, (IEN | M0)}, /* dpm_emu0 */ -- {DPM_EMU1, (IEN | M0)}, /* dpm_emu1 */ -- {DPM_EMU2, (IEN | M0)}, /* dpm_emu2 */ -- {DPM_EMU3, (IEN | M5)}, /* dispc2_data10 */ -- {DPM_EMU4, (IEN | M5)}, /* dispc2_data9 */ -- {DPM_EMU5, (IEN | M5)}, /* dispc2_data16 */ -- {DPM_EMU6, (IEN | M5)}, /* dispc2_data17 */ -- {DPM_EMU7, (IEN | M5)}, /* dispc2_hsync */ -- {DPM_EMU8, (IEN | M5)}, /* dispc2_pclk */ -- {DPM_EMU9, (IEN | M5)}, /* dispc2_vsync */ -- {DPM_EMU10, (IEN | M5)}, /* dispc2_de */ -- {DPM_EMU11, (IEN | M5)}, /* dispc2_data8 */ -- {DPM_EMU12, (IEN | M5)}, /* dispc2_data7 */ -- {DPM_EMU13, (IEN | M5)}, /* dispc2_data6 */ -- {DPM_EMU14, (IEN | M5)}, /* dispc2_data5 */ -- {DPM_EMU15, (IEN | M5)}, /* dispc2_data4 */ -- {DPM_EMU16, (M3)}, /* gpio_27 */ -- {DPM_EMU17, (IEN | M5)}, /* dispc2_data2 */ -- {DPM_EMU18, (IEN | M5)}, /* dispc2_data1 */ -- {DPM_EMU19, (IEN | M5)}, /* dispc2_data0 */ --}; -- --const struct pad_conf_entry wkup_padconf_array[] = { -- {PAD0_SIM_IO, (IEN | M0)}, /* sim_io */ -- {PAD1_SIM_CLK, (M0)}, /* sim_clk */ -- {PAD0_SIM_RESET, (M0)}, /* sim_reset */ -- {PAD1_SIM_CD, (PTU | IEN | M0)}, /* sim_cd */ -- {PAD0_SIM_PWRCTRL, (M0)}, /* sim_pwrctrl */ -- {PAD1_SR_SCL, (PTU | IEN | M0)}, /* sr_scl */ -- {PAD0_SR_SDA, (PTU | IEN | M0)}, /* sr_sda */ -- {PAD1_FREF_XTAL_IN, (M0)}, /* # */ -- {PAD0_FREF_SLICER_IN, (M0)}, /* fref_slicer_in */ -- {PAD1_FREF_CLK_IOREQ, (M0)}, /* fref_clk_ioreq */ -- {PAD0_FREF_CLK0_OUT, (M2)}, /* sys_drm_msecure */ -- {PAD1_FREF_CLK3_REQ, (PTU | IEN | M0)}, /* # */ -- {PAD0_FREF_CLK3_OUT, (M0)}, /* fref_clk3_out */ -- {PAD1_FREF_CLK4_REQ, (PTU | IEN | M0)}, /* # */ -- {PAD0_FREF_CLK4_OUT, (M0)}, /* # */ -- {PAD1_SYS_32K, (IEN | M0)}, /* sys_32k */ -- {PAD0_SYS_NRESPWRON, (M0)}, /* sys_nrespwron */ -- {PAD1_SYS_NRESWARM, (M0)}, /* sys_nreswarm */ -- {PAD0_SYS_PWR_REQ, (PTU | M0)}, /* sys_pwr_req */ -- {PAD1_SYS_PWRON_RESET, (M3)}, /* gpio_wk29 */ -- {PAD0_SYS_BOOT6, (IEN | M3)}, /* gpio_wk9 */ -- {PAD1_SYS_BOOT7, (IEN | M3)}, /* gpio_wk10 */ --}; -- --#endif -diff --git a/board/ti/sdp4430/sdp4430_mux_data.h b/board/ti/sdp4430/sdp4430_mux_data.h -new file mode 100644 -index 0000000..e6081dc ---- /dev/null -+++ b/board/ti/sdp4430/sdp4430_mux_data.h -@@ -0,0 +1,227 @@ -+/* -+ * (C) Copyright 2010 -+ * Texas Instruments Incorporated, <www.ti.com> -+ * -+ * Balaji Krishnamoorthy <balajitk@ti.com> -+ * Aneesh V <aneesh@ti.com> -+ * -+ * See file CREDITS for list of people who contributed to this -+ * project. -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License as -+ * published by the Free Software Foundation; either version 2 of -+ * the License, or (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+ * MA 02111-1307 USA -+ */ -+#ifndef _SDP4430_MUX_DATA_H -+#define _SDP4430_MUX_DATA_H -+ -+#include <asm/arch/mux_omap4.h> -+ -+const struct pad_conf_entry core_padconf_array_non_essential[] = { -+ {GPMC_AD8, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M3)}, /* gpio_32 */ -+ {GPMC_AD9, (PTU | IEN | M3)}, /* gpio_33 */ -+ {GPMC_AD10, (PTU | IEN | M3)}, /* gpio_34 */ -+ {GPMC_AD11, (PTU | IEN | M3)}, /* gpio_35 */ -+ {GPMC_AD12, (PTU | IEN | M3)}, /* gpio_36 */ -+ {GPMC_AD13, (PTD | OFF_EN | OFF_PD | OFF_OUT_PTD | M3)}, /* gpio_37 */ -+ {GPMC_AD14, (PTD | OFF_EN | OFF_PD | OFF_OUT_PTD | M3)}, /* gpio_38 */ -+ {GPMC_AD15, (PTD | OFF_EN | OFF_PD | OFF_OUT_PTD | M3)}, /* gpio_39 */ -+ {GPMC_A16, (M3)}, /* gpio_40 */ -+ {GPMC_A17, (PTD | M3)}, /* gpio_41 */ -+ {GPMC_A18, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1)}, /* kpd_row6 */ -+ {GPMC_A19, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1)}, /* kpd_row7 */ -+ {GPMC_A20, (IEN | M3)}, /* gpio_44 */ -+ {GPMC_A21, (M3)}, /* gpio_45 */ -+ {GPMC_A22, (OFF_EN | OFF_PD | OFF_IN | M1)}, /* kpd_col6 */ -+ {GPMC_A23, (OFF_EN | OFF_PD | OFF_IN | M1)}, /* kpd_col7 */ -+ {GPMC_A24, (PTD | M3)}, /* gpio_48 */ -+ {GPMC_A25, (PTD | M3)}, /* gpio_49 */ -+ {GPMC_NCS0, (M3)}, /* gpio_50 */ -+ {GPMC_NCS1, (IEN | M3)}, /* gpio_51 */ -+ {GPMC_NCS2, (IEN | M3)}, /* gpio_52 */ -+ {GPMC_NCS3, (IEN | M3)}, /* gpio_53 */ -+ {GPMC_NWP, (M3)}, /* gpio_54 */ -+ {GPMC_CLK, (PTD | M3)}, /* gpio_55 */ -+ {GPMC_NADV_ALE, (M3)}, /* gpio_56 */ -+ {GPMC_NBE0_CLE, (M3)}, /* gpio_59 */ -+ {GPMC_NBE1, (PTD | M3)}, /* gpio_60 */ -+ {GPMC_WAIT0, (PTU | IEN | M3)}, /* gpio_61 */ -+ {GPMC_WAIT1, (IEN | M3)}, /* gpio_62 */ -+ {C2C_DATA11, (PTD | M3)}, /* gpio_100 */ -+ {C2C_DATA12, (M1)}, /* dsi1_te0 */ -+ {C2C_DATA13, (PTD | M3)}, /* gpio_102 */ -+ {C2C_DATA14, (M1)}, /* dsi2_te0 */ -+ {C2C_DATA15, (PTD | M3)}, /* gpio_104 */ -+ {HDMI_HPD, (M0)}, /* hdmi_hpd */ -+ {HDMI_CEC, (M0)}, /* hdmi_cec */ -+ {HDMI_DDC_SCL, (PTU | M0)}, /* hdmi_ddc_scl */ -+ {HDMI_DDC_SDA, (PTU | IEN | M0)}, /* hdmi_ddc_sda */ -+ {CSI21_DX0, (IEN | M0)}, /* csi21_dx0 */ -+ {CSI21_DY0, (IEN | M0)}, /* csi21_dy0 */ -+ {CSI21_DX1, (IEN | M0)}, /* csi21_dx1 */ -+ {CSI21_DY1, (IEN | M0)}, /* csi21_dy1 */ -+ {CSI21_DX2, (IEN | M0)}, /* csi21_dx2 */ -+ {CSI21_DY2, (IEN | M0)}, /* csi21_dy2 */ -+ {CSI21_DX3, (PTD | M7)}, /* csi21_dx3 */ -+ {CSI21_DY3, (PTD | M7)}, /* csi21_dy3 */ -+ {CSI21_DX4, (PTD | OFF_EN | OFF_PD | OFF_IN | M7)}, /* csi21_dx4 */ -+ {CSI21_DY4, (PTD | OFF_EN | OFF_PD | OFF_IN | M7)}, /* csi21_dy4 */ -+ {CSI22_DX0, (IEN | M0)}, /* csi22_dx0 */ -+ {CSI22_DY0, (IEN | M0)}, /* csi22_dy0 */ -+ {CSI22_DX1, (IEN | M0)}, /* csi22_dx1 */ -+ {CSI22_DY1, (IEN | M0)}, /* csi22_dy1 */ -+ {CAM_SHUTTER, (OFF_EN | OFF_PD | OFF_OUT_PTD | M0)}, /* cam_shutter */ -+ {CAM_STROBE, (OFF_EN | OFF_PD | OFF_OUT_PTD | M0)}, /* cam_strobe */ -+ {CAM_GLOBALRESET, (PTD | OFF_EN | OFF_PD | OFF_OUT_PTD | M3)}, /* gpio_83 */ -+ {USBB1_ULPITLL_CLK, (PTD | IEN | OFF_EN | OFF_PD | OFF_IN | M4)},/* usbb1_ulpiphy_clk */ -+ {USBB1_ULPITLL_STP, (OFF_EN | OFF_OUT_PTD | M4)}, /* usbb1_ulpiphy_stp */ -+ {USBB1_ULPITLL_DIR, (IEN | OFF_EN | OFF_PD | OFF_IN | M4)}, /* usbb1_ulpiphy_dir */ -+ {USBB1_ULPITLL_NXT, (IEN | OFF_EN | OFF_PD | OFF_IN | M4)}, /* usbb1_ulpiphy_nxt */ -+ {USBB1_ULPITLL_DAT0, (IEN | OFF_EN | OFF_PD | OFF_IN | M4)}, /* usbb1_ulpiphy_dat0 */ -+ {USBB1_ULPITLL_DAT1, (IEN | OFF_EN | OFF_PD | OFF_IN | M4)}, /* usbb1_ulpiphy_dat1 */ -+ {USBB1_ULPITLL_DAT2, (IEN | OFF_EN | OFF_PD | OFF_IN | M4)}, /* usbb1_ulpiphy_dat2 */ -+ {USBB1_ULPITLL_DAT3, (IEN | OFF_EN | OFF_PD | OFF_IN | M4)}, /* usbb1_ulpiphy_dat3 */ -+ {USBB1_ULPITLL_DAT4, (IEN | OFF_EN | OFF_PD | OFF_IN | M4)}, /* usbb1_ulpiphy_dat4 */ -+ {USBB1_ULPITLL_DAT5, (IEN | OFF_EN | OFF_PD | OFF_IN | M4)}, /* usbb1_ulpiphy_dat5 */ -+ {USBB1_ULPITLL_DAT6, (IEN | OFF_EN | OFF_PD | OFF_IN | M4)}, /* usbb1_ulpiphy_dat6 */ -+ {USBB1_ULPITLL_DAT7, (IEN | OFF_EN | OFF_PD | OFF_IN | M4)}, /* usbb1_ulpiphy_dat7 */ -+ {USBB1_HSIC_DATA, (IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* usbb1_hsic_data */ -+ {USBB1_HSIC_STROBE, (IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* usbb1_hsic_strobe */ -+ {USBC1_ICUSB_DP, (IEN | M0)}, /* usbc1_icusb_dp */ -+ {USBC1_ICUSB_DM, (IEN | M0)}, /* usbc1_icusb_dm */ -+ {ABE_MCBSP2_CLKX, (IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* abe_mcbsp2_clkx */ -+ {ABE_MCBSP2_DR, (IEN | OFF_EN | OFF_OUT_PTD | M0)}, /* abe_mcbsp2_dr */ -+ {ABE_MCBSP2_DX, (OFF_EN | OFF_OUT_PTD | M0)}, /* abe_mcbsp2_dx */ -+ {ABE_MCBSP2_FSX, (IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* abe_mcbsp2_fsx */ -+ {ABE_MCBSP1_CLKX, (IEN | M1)}, /* abe_slimbus1_clock */ -+ {ABE_MCBSP1_DR, (IEN | M1)}, /* abe_slimbus1_data */ -+ {ABE_MCBSP1_DX, (OFF_EN | OFF_OUT_PTD | M0)}, /* abe_mcbsp1_dx */ -+ {ABE_MCBSP1_FSX, (IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* abe_mcbsp1_fsx */ -+ {ABE_PDM_UL_DATA, (PTD | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* abe_pdm_ul_data */ -+ {ABE_PDM_DL_DATA, (PTD | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* abe_pdm_dl_data */ -+ {ABE_PDM_FRAME, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* abe_pdm_frame */ -+ {ABE_PDM_LB_CLK, (PTD | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* abe_pdm_lb_clk */ -+ {ABE_CLKS, (PTD | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* abe_clks */ -+ {ABE_DMIC_CLK1, (M0)}, /* abe_dmic_clk1 */ -+ {ABE_DMIC_DIN1, (IEN | M0)}, /* abe_dmic_din1 */ -+ {ABE_DMIC_DIN2, (IEN | M0)}, /* abe_dmic_din2 */ -+ {ABE_DMIC_DIN3, (IEN | M0)}, /* abe_dmic_din3 */ -+ {UART2_CTS, (PTU | IEN | M0)}, /* uart2_cts */ -+ {UART2_RTS, (M0)}, /* uart2_rts */ -+ {UART2_RX, (PTU | IEN | M0)}, /* uart2_rx */ -+ {UART2_TX, (M0)}, /* uart2_tx */ -+ {HDQ_SIO, (M3)}, /* gpio_127 */ -+ {MCSPI1_CLK, (IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* mcspi1_clk */ -+ {MCSPI1_SOMI, (IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* mcspi1_somi */ -+ {MCSPI1_SIMO, (IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* mcspi1_simo */ -+ {MCSPI1_CS0, (PTD | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* mcspi1_cs0 */ -+ {MCSPI1_CS1, (PTD | IEN | OFF_EN | OFF_PD | OFF_IN | M3)}, /* mcspi1_cs1 */ -+ {MCSPI1_CS2, (PTU | OFF_EN | OFF_OUT_PTU | M3)}, /* gpio_139 */ -+ {MCSPI1_CS3, (PTU | IEN | M3)}, /* gpio_140 */ -+ {SDMMC5_CLK, (PTU | IEN | OFF_EN | OFF_OUT_PTD | M0)}, /* sdmmc5_clk */ -+ {SDMMC5_CMD, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* sdmmc5_cmd */ -+ {SDMMC5_DAT0, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* sdmmc5_dat0 */ -+ {SDMMC5_DAT1, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* sdmmc5_dat1 */ -+ {SDMMC5_DAT2, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* sdmmc5_dat2 */ -+ {SDMMC5_DAT3, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* sdmmc5_dat3 */ -+ {MCSPI4_CLK, (IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* mcspi4_clk */ -+ {MCSPI4_SIMO, (IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* mcspi4_simo */ -+ {MCSPI4_SOMI, (IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* mcspi4_somi */ -+ {MCSPI4_CS0, (PTD | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* mcspi4_cs0 */ -+ {UART4_RX, (IEN | M0)}, /* uart4_rx */ -+ {UART4_TX, (M0)}, /* uart4_tx */ -+ {USBB2_ULPITLL_CLK, (IEN | M3)}, /* gpio_157 */ -+ {USBB2_ULPITLL_STP, (IEN | M5)}, /* dispc2_data23 */ -+ {USBB2_ULPITLL_DIR, (IEN | M5)}, /* dispc2_data22 */ -+ {USBB2_ULPITLL_NXT, (IEN | M5)}, /* dispc2_data21 */ -+ {USBB2_ULPITLL_DAT0, (IEN | M5)}, /* dispc2_data20 */ -+ {USBB2_ULPITLL_DAT1, (IEN | M5)}, /* dispc2_data19 */ -+ {USBB2_ULPITLL_DAT2, (IEN | M5)}, /* dispc2_data18 */ -+ {USBB2_ULPITLL_DAT3, (IEN | M5)}, /* dispc2_data15 */ -+ {USBB2_ULPITLL_DAT4, (IEN | M5)}, /* dispc2_data14 */ -+ {USBB2_ULPITLL_DAT5, (IEN | M5)}, /* dispc2_data13 */ -+ {USBB2_ULPITLL_DAT6, (IEN | M5)}, /* dispc2_data12 */ -+ {USBB2_ULPITLL_DAT7, (IEN | M5)}, /* dispc2_data11 */ -+ {USBB2_HSIC_DATA, (PTD | OFF_EN | OFF_OUT_PTU | M3)}, /* gpio_169 */ -+ {USBB2_HSIC_STROBE, (PTD | OFF_EN | OFF_OUT_PTU | M3)}, /* gpio_170 */ -+ {UNIPRO_TX0, (OFF_EN | OFF_PD | OFF_IN | M1)}, /* kpd_col0 */ -+ {UNIPRO_TY0, (OFF_EN | OFF_PD | OFF_IN | M1)}, /* kpd_col1 */ -+ {UNIPRO_TX1, (OFF_EN | OFF_PD | OFF_IN | M1)}, /* kpd_col2 */ -+ {UNIPRO_TY1, (OFF_EN | OFF_PD | OFF_IN | M1)}, /* kpd_col3 */ -+ {UNIPRO_TX2, (OFF_EN | OFF_PD | OFF_IN | M1)}, /* kpd_col4 */ -+ {UNIPRO_TY2, (OFF_EN | OFF_PD | OFF_IN | M1)}, /* kpd_col5 */ -+ {UNIPRO_RX0, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1)}, /* kpd_row0 */ -+ {UNIPRO_RY0, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1)}, /* kpd_row1 */ -+ {UNIPRO_RX1, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1)}, /* kpd_row2 */ -+ {UNIPRO_RY1, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1)}, /* kpd_row3 */ -+ {UNIPRO_RX2, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1)}, /* kpd_row4 */ -+ {UNIPRO_RY2, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1)}, /* kpd_row5 */ -+ {USBA0_OTG_CE, (PTD | OFF_EN | OFF_PD | OFF_OUT_PTD | M0)}, /* usba0_otg_ce */ -+ {USBA0_OTG_DP, (IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* usba0_otg_dp */ -+ {USBA0_OTG_DM, (IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* usba0_otg_dm */ -+ {FREF_CLK1_OUT, (M0)}, /* fref_clk1_out */ -+ {FREF_CLK2_OUT, (M0)}, /* fref_clk2_out */ -+ {SYS_NIRQ1, (PTU | IEN | M0)}, /* sys_nirq1 */ -+ {SYS_NIRQ2, (PTU | IEN | M0)}, /* sys_nirq2 */ -+ {SYS_BOOT0, (PTU | IEN | M3)}, /* gpio_184 */ -+ {SYS_BOOT1, (M3)}, /* gpio_185 */ -+ {SYS_BOOT2, (PTD | IEN | M3)}, /* gpio_186 */ -+ {SYS_BOOT3, (M3)}, /* gpio_187 */ -+ {SYS_BOOT4, (M3)}, /* gpio_188 */ -+ {SYS_BOOT5, (PTD | IEN | M3)}, /* gpio_189 */ -+ {DPM_EMU0, (IEN | M0)}, /* dpm_emu0 */ -+ {DPM_EMU1, (IEN | M0)}, /* dpm_emu1 */ -+ {DPM_EMU2, (IEN | M0)}, /* dpm_emu2 */ -+ {DPM_EMU3, (IEN | M5)}, /* dispc2_data10 */ -+ {DPM_EMU4, (IEN | M5)}, /* dispc2_data9 */ -+ {DPM_EMU5, (IEN | M5)}, /* dispc2_data16 */ -+ {DPM_EMU6, (IEN | M5)}, /* dispc2_data17 */ -+ {DPM_EMU7, (IEN | M5)}, /* dispc2_hsync */ -+ {DPM_EMU8, (IEN | M5)}, /* dispc2_pclk */ -+ {DPM_EMU9, (IEN | M5)}, /* dispc2_vsync */ -+ {DPM_EMU10, (IEN | M5)}, /* dispc2_de */ -+ {DPM_EMU11, (IEN | M5)}, /* dispc2_data8 */ -+ {DPM_EMU12, (IEN | M5)}, /* dispc2_data7 */ -+ {DPM_EMU13, (IEN | M5)}, /* dispc2_data6 */ -+ {DPM_EMU14, (IEN | M5)}, /* dispc2_data5 */ -+ {DPM_EMU15, (IEN | M5)}, /* dispc2_data4 */ -+ {DPM_EMU16, (M3)}, /* gpio_27 */ -+ {DPM_EMU17, (IEN | M5)}, /* dispc2_data2 */ -+ {DPM_EMU18, (IEN | M5)}, /* dispc2_data1 */ -+ {DPM_EMU19, (IEN | M5)}, /* dispc2_data0 */ -+}; -+ -+const struct pad_conf_entry wkup_padconf_array_non_essential[] = { -+ {PAD0_SIM_IO, (IEN | M0)}, /* sim_io */ -+ {PAD1_SIM_CLK, (M0)}, /* sim_clk */ -+ {PAD0_SIM_RESET, (M0)}, /* sim_reset */ -+ {PAD1_SIM_CD, (PTU | IEN | M0)}, /* sim_cd */ -+ {PAD0_SIM_PWRCTRL, (M0)}, /* sim_pwrctrl */ -+ {PAD1_FREF_XTAL_IN, (M0)}, /* # */ -+ {PAD0_FREF_SLICER_IN, (M0)}, /* fref_slicer_in */ -+ {PAD1_FREF_CLK_IOREQ, (M0)}, /* fref_clk_ioreq */ -+ {PAD0_FREF_CLK0_OUT, (M2)}, /* sys_drm_msecure */ -+ {PAD1_FREF_CLK3_REQ, (PTU | IEN | M0)}, /* # */ -+ {PAD0_FREF_CLK3_OUT, (M0)}, /* fref_clk3_out */ -+ {PAD1_FREF_CLK4_REQ, (PTU | IEN | M0)}, /* # */ -+ {PAD0_FREF_CLK4_OUT, (M0)}, /* # */ -+ {PAD0_SYS_NRESPWRON, (M0)}, /* sys_nrespwron */ -+ {PAD1_SYS_NRESWARM, (M0)}, /* sys_nreswarm */ -+ {PAD0_SYS_PWR_REQ, (PTU | M0)}, /* sys_pwr_req */ -+ {PAD1_SYS_PWRON_RESET, (M3)}, /* gpio_wk29 */ -+ {PAD0_SYS_BOOT6, (IEN | M3)}, /* gpio_wk9 */ -+ {PAD1_SYS_BOOT7, (IEN | M3)}, /* gpio_wk10 */ -+}; -+ -+#endif /* _SDP4430_MUX_DATA_H */ --- -1.7.2.3 - diff --git a/packages/tools/u-boot/patches/2011.03-rc1/u-boot-2011.03-rc1-0014-omap4-correct-mux-data-for-sdp4430.patch b/packages/tools/u-boot/patches/2011.03-rc1/u-boot-2011.03-rc1-0014-omap4-correct-mux-data-for-sdp4430.patch deleted file mode 100644 index ad616ae20cb..00000000000 --- a/packages/tools/u-boot/patches/2011.03-rc1/u-boot-2011.03-rc1-0014-omap4-correct-mux-data-for-sdp4430.patch +++ /dev/null @@ -1,251 +0,0 @@ -From 984aa865e9cc09a61c3238c6493ae3f845c38da6 Mon Sep 17 00:00:00 2001 -From: Aneesh V <aneesh@ti.com> -Date: Sat, 19 Feb 2011 18:31:42 +0530 -Subject: [PATCH 14/22] omap4: correct mux data for sdp4430 - -sync up mux settings with the latest in x-loader - -Signed-off-by: Aneesh V <aneesh@ti.com> ---- - board/ti/panda/panda_mux_data.h | 89 ++++++++++++++++++----------------- - board/ti/sdp4430/sdp4430_mux_data.h | 29 ++++++----- - 2 files changed, 61 insertions(+), 57 deletions(-) - -diff --git a/board/ti/panda/panda_mux_data.h b/board/ti/panda/panda_mux_data.h -index 8bb7fe5..16cc0ad 100644 ---- a/board/ti/panda/panda_mux_data.h -+++ b/board/ti/panda/panda_mux_data.h -@@ -23,11 +23,9 @@ - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - */ -+#ifndef _SDP4430_MUX_DATA_H -+#define _SDP4430_MUX_DATA_H - --#ifndef _PANDA_MUX_DATA_H_ --#define _PANDA_MUX_DATA_H_ -- --#include <asm/io.h> - #include <asm/arch/mux_omap4.h> - - const struct pad_conf_entry core_padconf_array_non_essential[] = { -@@ -45,7 +43,7 @@ const struct pad_conf_entry core_padconf_array_non_essential[] = { - {GPMC_A19, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1)}, /* kpd_row7 */ - {GPMC_A20, (IEN | M3)}, /* gpio_44 */ - {GPMC_A21, (M3)}, /* gpio_45 */ -- {GPMC_A22, (M3)}, /* gpio_46 */ -+ {GPMC_A22, (OFF_EN | OFF_PD | OFF_IN | M1)}, /* kpd_col6 */ - {GPMC_A23, (OFF_EN | OFF_PD | OFF_IN | M1)}, /* kpd_col7 */ - {GPMC_A24, (PTD | M3)}, /* gpio_48 */ - {GPMC_A25, (PTD | M3)}, /* gpio_49 */ -@@ -59,9 +57,9 @@ const struct pad_conf_entry core_padconf_array_non_essential[] = { - {GPMC_NBE0_CLE, (M3)}, /* gpio_59 */ - {GPMC_NBE1, (PTD | M3)}, /* gpio_60 */ - {GPMC_WAIT0, (PTU | IEN | M3)}, /* gpio_61 */ -- {GPMC_WAIT1, (PTD | OFF_EN | OFF_PD | OFF_OUT_PTD | M3)}, /* gpio_62 */ -+ {GPMC_WAIT1, (IEN | M3)}, /* gpio_62 */ - {C2C_DATA11, (PTD | M3)}, /* gpio_100 */ -- {C2C_DATA12, (PTU | IEN | M3)}, /* gpio_101 */ -+ {C2C_DATA12, (M1)}, /* dsi1_te0 */ - {C2C_DATA13, (PTD | M3)}, /* gpio_102 */ - {C2C_DATA14, (M1)}, /* dsi2_te0 */ - {C2C_DATA15, (PTD | M3)}, /* gpio_104 */ -@@ -86,14 +84,14 @@ const struct pad_conf_entry core_padconf_array_non_essential[] = { - {CAM_SHUTTER, (OFF_EN | OFF_PD | OFF_OUT_PTD | M0)}, /* cam_shutter */ - {CAM_STROBE, (OFF_EN | OFF_PD | OFF_OUT_PTD | M0)}, /* cam_strobe */ - {CAM_GLOBALRESET, (PTD | OFF_EN | OFF_PD | OFF_OUT_PTD | M3)}, /* gpio_83 */ -- {USBB1_ULPITLL_CLK, (PTD | IEN | OFF_EN | OFF_PD | OFF_IN | M4)},/* usbb1_ulpiphy_clk */ -- {USBB1_ULPITLL_STP, (OFF_EN | OFF_OUT_PTD | M4)}, /* usbb1_ulpiphy_stp */ -- {USBB1_ULPITLL_DIR, (IEN | OFF_EN | OFF_PD | OFF_IN | M4)}, /* usbb1_ulpiphy_dir */ -- {USBB1_ULPITLL_NXT, (IEN | OFF_EN | OFF_PD | OFF_IN | M4)}, /* usbb1_ulpiphy_nxt */ -- {USBB1_ULPITLL_DAT0, (IEN | OFF_EN | OFF_PD | OFF_IN | M4)}, /* usbb1_ulpiphy_dat0 */ -- {USBB1_ULPITLL_DAT1, (IEN | OFF_EN | OFF_PD | OFF_IN | M4)}, /* usbb1_ulpiphy_dat1 */ -- {USBB1_ULPITLL_DAT2, (IEN | OFF_EN | OFF_PD | OFF_IN | M4)}, /* usbb1_ulpiphy_dat2 */ -- {USBB1_ULPITLL_DAT3, (IEN | OFF_EN | OFF_PD | OFF_IN | M4)}, /* usbb1_ulpiphy_dat3 */ -+ {USBB1_ULPITLL_CLK, (IEN | OFF_EN | OFF_IN | M1)}, /* hsi1_cawake */ -+ {USBB1_ULPITLL_STP, (IEN | OFF_EN | OFF_IN | M1)}, /* hsi1_cadata */ -+ {USBB1_ULPITLL_DIR, (IEN | OFF_EN | OFF_IN | M1)}, /* hsi1_caflag */ -+ {USBB1_ULPITLL_NXT, (OFF_EN | M1)}, /* hsi1_acready */ -+ {USBB1_ULPITLL_DAT0, (OFF_EN | M1)}, /* hsi1_acwake */ -+ {USBB1_ULPITLL_DAT1, (OFF_EN | M1)}, /* hsi1_acdata */ -+ {USBB1_ULPITLL_DAT2, (OFF_EN | M1)}, /* hsi1_acflag */ -+ {USBB1_ULPITLL_DAT3, (IEN | OFF_EN | OFF_IN | M1)}, /* hsi1_caready */ - {USBB1_ULPITLL_DAT4, (IEN | OFF_EN | OFF_PD | OFF_IN | M4)}, /* usbb1_ulpiphy_dat4 */ - {USBB1_ULPITLL_DAT5, (IEN | OFF_EN | OFF_PD | OFF_IN | M4)}, /* usbb1_ulpiphy_dat5 */ - {USBB1_ULPITLL_DAT6, (IEN | OFF_EN | OFF_PD | OFF_IN | M4)}, /* usbb1_ulpiphy_dat6 */ -@@ -106,8 +104,8 @@ const struct pad_conf_entry core_padconf_array_non_essential[] = { - {ABE_MCBSP2_DR, (IEN | OFF_EN | OFF_OUT_PTD | M0)}, /* abe_mcbsp2_dr */ - {ABE_MCBSP2_DX, (OFF_EN | OFF_OUT_PTD | M0)}, /* abe_mcbsp2_dx */ - {ABE_MCBSP2_FSX, (IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* abe_mcbsp2_fsx */ -- {ABE_MCBSP1_CLKX, (IEN | M1)}, /* abe_slimbus1_clock */ -- {ABE_MCBSP1_DR, (IEN | M1)}, /* abe_slimbus1_data */ -+ {ABE_MCBSP1_CLKX, (IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* abe_mcbsp1_clkx */ -+ {ABE_MCBSP1_DR, (IEN | OFF_EN | OFF_OUT_PTD | M0)}, /* abe_mcbsp1_dr */ - {ABE_MCBSP1_DX, (OFF_EN | OFF_OUT_PTD | M0)}, /* abe_mcbsp1_dx */ - {ABE_MCBSP1_FSX, (IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* abe_mcbsp1_fsx */ - {ABE_PDM_UL_DATA, (PTD | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* abe_pdm_ul_data */ -@@ -143,7 +141,7 @@ const struct pad_conf_entry core_padconf_array_non_essential[] = { - {MCSPI4_CS0, (PTD | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* mcspi4_cs0 */ - {UART4_RX, (IEN | M0)}, /* uart4_rx */ - {UART4_TX, (M0)}, /* uart4_tx */ -- {USBB2_ULPITLL_CLK, (IEN | M3)}, /* gpio_157 */ -+ {USBB2_ULPITLL_CLK, (PTD | IEN | M3)}, /* gpio_157 */ - {USBB2_ULPITLL_STP, (IEN | M5)}, /* dispc2_data23 */ - {USBB2_ULPITLL_DIR, (IEN | M5)}, /* dispc2_data22 */ - {USBB2_ULPITLL_NXT, (IEN | M5)}, /* dispc2_data21 */ -@@ -157,12 +155,12 @@ const struct pad_conf_entry core_padconf_array_non_essential[] = { - {USBB2_ULPITLL_DAT7, (IEN | M5)}, /* dispc2_data11 */ - {USBB2_HSIC_DATA, (PTD | OFF_EN | OFF_OUT_PTU | M3)}, /* gpio_169 */ - {USBB2_HSIC_STROBE, (PTD | OFF_EN | OFF_OUT_PTU | M3)}, /* gpio_170 */ -- {UNIPRO_TX0, (PTD | IEN | M3)}, /* gpio_171 */ -+ {UNIPRO_TX0, (OFF_EN | OFF_PD | OFF_IN | M1)}, /* kpd_col0 */ - {UNIPRO_TY0, (OFF_EN | OFF_PD | OFF_IN | M1)}, /* kpd_col1 */ - {UNIPRO_TX1, (OFF_EN | OFF_PD | OFF_IN | M1)}, /* kpd_col2 */ - {UNIPRO_TY1, (OFF_EN | OFF_PD | OFF_IN | M1)}, /* kpd_col3 */ -- {UNIPRO_TX2, (PTU | IEN | M3)}, /* gpio_0 */ -- {UNIPRO_TY2, (PTU | IEN | M3)}, /* gpio_1 */ -+ {UNIPRO_TX2, (OFF_EN | OFF_PD | OFF_IN | M1)}, /* kpd_col4 */ -+ {UNIPRO_TY2, (OFF_EN | OFF_PD | OFF_IN | M1)}, /* kpd_col5 */ - {UNIPRO_RX0, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1)}, /* kpd_row0 */ - {UNIPRO_RY0, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1)}, /* kpd_row1 */ - {UNIPRO_RX1, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1)}, /* kpd_row2 */ -@@ -173,13 +171,13 @@ const struct pad_conf_entry core_padconf_array_non_essential[] = { - {USBA0_OTG_DP, (IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* usba0_otg_dp */ - {USBA0_OTG_DM, (IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* usba0_otg_dm */ - {FREF_CLK1_OUT, (M0)}, /* fref_clk1_out */ -- {FREF_CLK2_OUT, (PTU | IEN | M3)}, /* gpio_182 */ -+ {FREF_CLK2_OUT, (M0)}, /* fref_clk2_out */ - {SYS_NIRQ1, (PTU | IEN | M0)}, /* sys_nirq1 */ -- {SYS_NIRQ2, (PTU | IEN | M0)}, /* sys_nirq2 */ -+ {SYS_NIRQ2, (M7)}, /* sys_nirq2 */ - {SYS_BOOT0, (PTU | IEN | M3)}, /* gpio_184 */ - {SYS_BOOT1, (M3)}, /* gpio_185 */ - {SYS_BOOT2, (PTD | IEN | M3)}, /* gpio_186 */ -- {SYS_BOOT3, (M3)}, /* gpio_187 */ -+ {SYS_BOOT3, (PTD | IEN | M3)}, /* gpio_187 */ - {SYS_BOOT4, (M3)}, /* gpio_188 */ - {SYS_BOOT5, (PTD | IEN | M3)}, /* gpio_189 */ - {DPM_EMU0, (IEN | M0)}, /* dpm_emu0 */ -@@ -205,25 +203,28 @@ const struct pad_conf_entry core_padconf_array_non_essential[] = { - }; - - const struct pad_conf_entry wkup_padconf_array_non_essential[] = { -- {PAD0_SIM_IO, (IEN | M0)}, /* sim_io */ -- {PAD1_SIM_CLK, (M0)}, /* sim_clk */ -- {PAD0_SIM_RESET, (M0)}, /* sim_reset */ -- {PAD1_SIM_CD, (PTU | IEN | M0)}, /* sim_cd */ -- {PAD0_SIM_PWRCTRL, (M0)}, /* sim_pwrctrl */ -- {PAD1_FREF_XTAL_IN, (M0)}, /* # */ -- {PAD0_FREF_SLICER_IN, (M0)}, /* fref_slicer_in */ -- {PAD1_FREF_CLK_IOREQ, (M0)}, /* fref_clk_ioreq */ -- {PAD0_FREF_CLK0_OUT, (M2)}, /* sys_drm_msecure */ -- {PAD1_FREF_CLK3_REQ, (M3)}, /* gpio_wk30 */ -- {PAD0_FREF_CLK3_OUT, (M0)}, /* fref_clk3_out */ -- {PAD1_FREF_CLK4_REQ, (PTU | OFF_EN | OFF_OUT_PTU | M3)}, /* led status_1 */ -- {PAD0_FREF_CLK4_OUT, (PTU | OFF_EN | OFF_OUT_PTU | M3)}, /* led status_2 */ -- {PAD0_SYS_NRESPWRON, (M0)}, /* sys_nrespwron */ -- {PAD1_SYS_NRESWARM, (M0)}, /* sys_nreswarm */ -- {PAD0_SYS_PWR_REQ, (PTU | M0)}, /* sys_pwr_req */ -- {PAD1_SYS_PWRON_RESET, (M3)}, /* gpio_wk29 */ -- {PAD0_SYS_BOOT6, (IEN | M3)}, /* gpio_wk9 */ -- {PAD1_SYS_BOOT7, (IEN | M3)}, /* gpio_wk10 */ -+ {PAD0_SIM_IO, (IEN | M0)}, /* sim_io */ -+ {PAD1_SIM_CLK, (M0)}, /* sim_clk */ -+ {PAD0_SIM_RESET, (M0)}, /* sim_reset */ -+ {PAD1_SIM_CD, (PTU | IEN | M0)}, /* sim_cd */ -+ {PAD0_SIM_PWRCTRL, (M0)}, /* sim_pwrctrl */ -+ {PAD1_FREF_XTAL_IN, (M0)}, /* # */ -+ {PAD0_FREF_SLICER_IN, (M0)}, /* fref_slicer_in */ -+ {PAD1_FREF_CLK_IOREQ, (M0)}, /* fref_clk_ioreq */ -+ {PAD0_FREF_CLK0_OUT, (M2)}, /* sys_drm_msecure */ -+ {PAD1_FREF_CLK3_REQ, (PTU | IEN | M0)}, /* # */ -+ {PAD0_FREF_CLK3_OUT, (M0)}, /* fref_clk3_out */ -+ {PAD1_FREF_CLK4_REQ, (PTU | IEN | M0)}, /* # */ -+ {PAD0_FREF_CLK4_OUT, (M0)}, /* # */ -+ {PAD0_SYS_NRESPWRON, (M0)}, /* sys_nrespwron */ -+ {PAD1_SYS_NRESWARM, (M0)}, /* sys_nreswarm */ -+ {PAD0_SYS_PWR_REQ, (PTU | M0)}, /* sys_pwr_req */ -+ {PAD1_SYS_PWRON_RESET, (M3)}, /* gpio_wk29 */ -+ {PAD0_SYS_BOOT6, (IEN | M3)}, /* gpio_wk9 */ -+ {PAD1_SYS_BOOT7, (IEN | M3)}, /* gpio_wk10 */ -+ {PAD1_FREF_CLK3_REQ, (M3)}, /* gpio_wk30 */ -+ {PAD1_FREF_CLK4_REQ, (M3)}, /* gpio_wk7 */ -+ {PAD0_FREF_CLK4_OUT, (M3)}, /* gpio_wk8 */ - }; - --#endif /* _PANDA_MUX_DATA_H_ */ -+#endif /* _SDP4430_MUX_DATA_H */ -diff --git a/board/ti/sdp4430/sdp4430_mux_data.h b/board/ti/sdp4430/sdp4430_mux_data.h -index e6081dc..16cc0ad 100644 ---- a/board/ti/sdp4430/sdp4430_mux_data.h -+++ b/board/ti/sdp4430/sdp4430_mux_data.h -@@ -84,14 +84,14 @@ const struct pad_conf_entry core_padconf_array_non_essential[] = { - {CAM_SHUTTER, (OFF_EN | OFF_PD | OFF_OUT_PTD | M0)}, /* cam_shutter */ - {CAM_STROBE, (OFF_EN | OFF_PD | OFF_OUT_PTD | M0)}, /* cam_strobe */ - {CAM_GLOBALRESET, (PTD | OFF_EN | OFF_PD | OFF_OUT_PTD | M3)}, /* gpio_83 */ -- {USBB1_ULPITLL_CLK, (PTD | IEN | OFF_EN | OFF_PD | OFF_IN | M4)},/* usbb1_ulpiphy_clk */ -- {USBB1_ULPITLL_STP, (OFF_EN | OFF_OUT_PTD | M4)}, /* usbb1_ulpiphy_stp */ -- {USBB1_ULPITLL_DIR, (IEN | OFF_EN | OFF_PD | OFF_IN | M4)}, /* usbb1_ulpiphy_dir */ -- {USBB1_ULPITLL_NXT, (IEN | OFF_EN | OFF_PD | OFF_IN | M4)}, /* usbb1_ulpiphy_nxt */ -- {USBB1_ULPITLL_DAT0, (IEN | OFF_EN | OFF_PD | OFF_IN | M4)}, /* usbb1_ulpiphy_dat0 */ -- {USBB1_ULPITLL_DAT1, (IEN | OFF_EN | OFF_PD | OFF_IN | M4)}, /* usbb1_ulpiphy_dat1 */ -- {USBB1_ULPITLL_DAT2, (IEN | OFF_EN | OFF_PD | OFF_IN | M4)}, /* usbb1_ulpiphy_dat2 */ -- {USBB1_ULPITLL_DAT3, (IEN | OFF_EN | OFF_PD | OFF_IN | M4)}, /* usbb1_ulpiphy_dat3 */ -+ {USBB1_ULPITLL_CLK, (IEN | OFF_EN | OFF_IN | M1)}, /* hsi1_cawake */ -+ {USBB1_ULPITLL_STP, (IEN | OFF_EN | OFF_IN | M1)}, /* hsi1_cadata */ -+ {USBB1_ULPITLL_DIR, (IEN | OFF_EN | OFF_IN | M1)}, /* hsi1_caflag */ -+ {USBB1_ULPITLL_NXT, (OFF_EN | M1)}, /* hsi1_acready */ -+ {USBB1_ULPITLL_DAT0, (OFF_EN | M1)}, /* hsi1_acwake */ -+ {USBB1_ULPITLL_DAT1, (OFF_EN | M1)}, /* hsi1_acdata */ -+ {USBB1_ULPITLL_DAT2, (OFF_EN | M1)}, /* hsi1_acflag */ -+ {USBB1_ULPITLL_DAT3, (IEN | OFF_EN | OFF_IN | M1)}, /* hsi1_caready */ - {USBB1_ULPITLL_DAT4, (IEN | OFF_EN | OFF_PD | OFF_IN | M4)}, /* usbb1_ulpiphy_dat4 */ - {USBB1_ULPITLL_DAT5, (IEN | OFF_EN | OFF_PD | OFF_IN | M4)}, /* usbb1_ulpiphy_dat5 */ - {USBB1_ULPITLL_DAT6, (IEN | OFF_EN | OFF_PD | OFF_IN | M4)}, /* usbb1_ulpiphy_dat6 */ -@@ -104,8 +104,8 @@ const struct pad_conf_entry core_padconf_array_non_essential[] = { - {ABE_MCBSP2_DR, (IEN | OFF_EN | OFF_OUT_PTD | M0)}, /* abe_mcbsp2_dr */ - {ABE_MCBSP2_DX, (OFF_EN | OFF_OUT_PTD | M0)}, /* abe_mcbsp2_dx */ - {ABE_MCBSP2_FSX, (IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* abe_mcbsp2_fsx */ -- {ABE_MCBSP1_CLKX, (IEN | M1)}, /* abe_slimbus1_clock */ -- {ABE_MCBSP1_DR, (IEN | M1)}, /* abe_slimbus1_data */ -+ {ABE_MCBSP1_CLKX, (IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* abe_mcbsp1_clkx */ -+ {ABE_MCBSP1_DR, (IEN | OFF_EN | OFF_OUT_PTD | M0)}, /* abe_mcbsp1_dr */ - {ABE_MCBSP1_DX, (OFF_EN | OFF_OUT_PTD | M0)}, /* abe_mcbsp1_dx */ - {ABE_MCBSP1_FSX, (IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* abe_mcbsp1_fsx */ - {ABE_PDM_UL_DATA, (PTD | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* abe_pdm_ul_data */ -@@ -141,7 +141,7 @@ const struct pad_conf_entry core_padconf_array_non_essential[] = { - {MCSPI4_CS0, (PTD | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* mcspi4_cs0 */ - {UART4_RX, (IEN | M0)}, /* uart4_rx */ - {UART4_TX, (M0)}, /* uart4_tx */ -- {USBB2_ULPITLL_CLK, (IEN | M3)}, /* gpio_157 */ -+ {USBB2_ULPITLL_CLK, (PTD | IEN | M3)}, /* gpio_157 */ - {USBB2_ULPITLL_STP, (IEN | M5)}, /* dispc2_data23 */ - {USBB2_ULPITLL_DIR, (IEN | M5)}, /* dispc2_data22 */ - {USBB2_ULPITLL_NXT, (IEN | M5)}, /* dispc2_data21 */ -@@ -173,11 +173,11 @@ const struct pad_conf_entry core_padconf_array_non_essential[] = { - {FREF_CLK1_OUT, (M0)}, /* fref_clk1_out */ - {FREF_CLK2_OUT, (M0)}, /* fref_clk2_out */ - {SYS_NIRQ1, (PTU | IEN | M0)}, /* sys_nirq1 */ -- {SYS_NIRQ2, (PTU | IEN | M0)}, /* sys_nirq2 */ -+ {SYS_NIRQ2, (M7)}, /* sys_nirq2 */ - {SYS_BOOT0, (PTU | IEN | M3)}, /* gpio_184 */ - {SYS_BOOT1, (M3)}, /* gpio_185 */ - {SYS_BOOT2, (PTD | IEN | M3)}, /* gpio_186 */ -- {SYS_BOOT3, (M3)}, /* gpio_187 */ -+ {SYS_BOOT3, (PTD | IEN | M3)}, /* gpio_187 */ - {SYS_BOOT4, (M3)}, /* gpio_188 */ - {SYS_BOOT5, (PTD | IEN | M3)}, /* gpio_189 */ - {DPM_EMU0, (IEN | M0)}, /* dpm_emu0 */ -@@ -222,6 +222,9 @@ const struct pad_conf_entry wkup_padconf_array_non_essential[] = { - {PAD1_SYS_PWRON_RESET, (M3)}, /* gpio_wk29 */ - {PAD0_SYS_BOOT6, (IEN | M3)}, /* gpio_wk9 */ - {PAD1_SYS_BOOT7, (IEN | M3)}, /* gpio_wk10 */ -+ {PAD1_FREF_CLK3_REQ, (M3)}, /* gpio_wk30 */ -+ {PAD1_FREF_CLK4_REQ, (M3)}, /* gpio_wk7 */ -+ {PAD0_FREF_CLK4_OUT, (M3)}, /* gpio_wk8 */ - }; - - #endif /* _SDP4430_MUX_DATA_H */ --- -1.7.2.3 - diff --git a/packages/tools/u-boot/patches/2011.03-rc1/u-boot-2011.03-rc1-0015-omap4-add-clock-support.patch b/packages/tools/u-boot/patches/2011.03-rc1/u-boot-2011.03-rc1-0015-omap4-add-clock-support.patch deleted file mode 100644 index abd279af029..00000000000 --- a/packages/tools/u-boot/patches/2011.03-rc1/u-boot-2011.03-rc1-0015-omap4-add-clock-support.patch +++ /dev/null @@ -1,1335 +0,0 @@ -From d669bac9f088cb5b0291e1c059c54ba95d527112 Mon Sep 17 00:00:00 2001 -From: Aneesh V <aneesh@ti.com> -Date: Wed, 16 Feb 2011 23:25:54 +0530 -Subject: [PATCH 15/22] omap4: add clock support - -Add support for: -1. DPLL locking -2. Initialization of clock domains and clock modules - -This work draws upon previous work done for x-loader mainly by: - Santosh Shilimkar <santosh.shilimkar@ti.com> - Rajendra Nayak <rnayak@ti.com> - -Signed-off-by: Aneesh V <aneesh@ti.com> ---- - arch/arm/cpu/armv7/omap4/Makefile | 1 + - arch/arm/cpu/armv7/omap4/board.c | 1 + - arch/arm/cpu/armv7/omap4/clocks.c | 717 +++++++++++++++++++++++++++ - arch/arm/include/asm/arch-omap4/clocks.h | 504 +++++++++++++++++++ - arch/arm/include/asm/arch-omap4/sys_proto.h | 6 + - arch/arm/include/asm/omap_common.h | 3 + - spl/board/ti/sdp4430/Makefile | 6 +- - 7 files changed, 1237 insertions(+), 1 deletions(-) - create mode 100644 arch/arm/cpu/armv7/omap4/clocks.c - create mode 100644 arch/arm/include/asm/arch-omap4/clocks.h - -diff --git a/arch/arm/cpu/armv7/omap4/Makefile b/arch/arm/cpu/armv7/omap4/Makefile -index 987dc9d..6154e86 100644 ---- a/arch/arm/cpu/armv7/omap4/Makefile -+++ b/arch/arm/cpu/armv7/omap4/Makefile -@@ -30,6 +30,7 @@ SOBJS += lowlevel_init.o - COBJS += board.o - COBJS += mem.o - COBJS += sys_info.o -+COBJS += clocks.o - - SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) - OBJS := $(addprefix $(obj),$(COBJS) $(SOBJS)) -diff --git a/arch/arm/cpu/armv7/omap4/board.c b/arch/arm/cpu/armv7/omap4/board.c -index 95b6a96..62a59ad 100644 ---- a/arch/arm/cpu/armv7/omap4/board.c -+++ b/arch/arm/cpu/armv7/omap4/board.c -@@ -105,6 +105,7 @@ void s_init(void) - { - watchdog_init(); - set_mux_conf_regs(); -+ prcm_init(); - #ifdef CONFIG_PRELOADER - preloader_console_init(); - #endif -diff --git a/arch/arm/cpu/armv7/omap4/clocks.c b/arch/arm/cpu/armv7/omap4/clocks.c -new file mode 100644 -index 0000000..317f30f ---- /dev/null -+++ b/arch/arm/cpu/armv7/omap4/clocks.c -@@ -0,0 +1,717 @@ -+/* -+ * -+ * Clock initialization for OMAP4 -+ * -+ * (C) Copyright 2010 -+ * Texas Instruments, <www.ti.com> -+ * -+ * Aneesh V <aneesh@ti.com> -+ * -+ * Based on previous work by: -+ * Santosh Shilimkar <santosh.shilimkar@ti.com> -+ * Rajendra Nayak <rnayak@ti.com> -+ * -+ * See file CREDITS for list of people who contributed to this -+ * project. -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License as -+ * published by the Free Software Foundation; either version 2 of -+ * the License, or (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+ * MA 02111-1307 USA -+ */ -+#include <common.h> -+#include <asm/omap_common.h> -+#include <asm/arch/clocks.h> -+#include <asm/arch/sys_proto.h> -+ -+#define abs(x) (((x) < 0) ? ((x)*-1) : (x)) -+ -+static const u32 sys_clk_array[8] = { -+ 0, /* Uninitialized */ -+ 12000000, /* 12 MHz */ -+ 13000000, /* 13 MHz */ -+ 16800000, /* 16.8 MHz */ -+ 19200000, /* 19.2 MHz */ -+ 26000000, /* 26 MHz */ -+ 27000000, /* 27 MHz */ -+ 38400000, /* 38.4 MHz */ -+}; -+ -+static const struct dpll_params core_dpll_params_opp100 = { -+ 0, 0, 1600000, 1, 5, 8, 4, 6, 5 -+}; -+ -+static const struct dpll_params core_dpll_params_opp100_ddr200 = { -+ 0, 0, 1600000, 2, 5, 8, 4, 6, 5 -+}; -+ -+static const struct dpll_params core_dpll_params_es1_l3_190 = { -+ 0, 0, 1523712, 1, 5, 8, 4, 6, 5 -+}; -+ -+static const struct dpll_params per_dpll_params_opp100 = { -+ 0, 0, 1536000, 8, 6, 12, 9, 4, 5 -+}; -+ -+/* TODO - fix MPU mult */ -+static const struct dpll_params mpu_dpll_params_600mhz = { -+ 0, 0, 1200000, 1, -1, -1, -1, -1, -1 -+}; -+ -+static const struct dpll_params mpu_dpll_params_1000mhz = { -+ 0, 0, 2000000, 1, -1, -1, -1, -1, -1 -+}; -+ -+static const struct dpll_params usb_dpll_params = { -+ 0, 0, 1920000, 2, -1, -1, -1, -1, -1 -+}; -+ -+static const struct dpll_params iva_dpll_params = { -+ 0, 0, 1862000, -1, -1, 4, 7, -1, -1 -+}; -+ -+static const struct dpll_params abe_dpll_params = { -+ 0, 0, 196608, 1, 1, -1, -1, -1, -1 -+}; -+ -+static const u32 clk_domains_essential[] = { -+ CM_L4PER_CLKSTCTRL, -+ CM_L3INIT_CLKSTCTRL, -+ CM_MEMIF_CLKSTCTRL, -+ CM_L4CFG_CLKSTCTRL, -+ 0 -+}; -+ -+static const u32 clk_domains_non_essential[] = { -+ CM_MPU_M3_CLKSTCTRL, -+ CM_IVAHD_CLKSTCTRL, -+ CM_DSP_CLKSTCTRL, -+ CM_DSS_CLKSTCTRL, -+ CM_SGX_CLKSTCTRL, -+ CM1_ABE_CLKSTCTRL, -+ CM_C2C_CLKSTCTRL, -+ CM_CAM_CLKSTCTRL, -+ CM_DSS_CLKSTCTRL, -+ CM_SDMA_CLKSTCTRL, -+ 0 -+}; -+ -+static const u32 clk_modules_hw_auto_essential[] = { -+ CM_WKUP_GPIO1_CLKCTRL, -+ CM_L4PER_GPIO2_CLKCTRL, -+ CM_L4PER_GPIO3_CLKCTRL, -+ CM_L4PER_GPIO4_CLKCTRL, -+ CM_L4PER_GPIO5_CLKCTRL, -+ CM_L4PER_GPIO6_CLKCTRL, -+ CM_MEMIF_EMIF_1_CLKCTRL, -+ CM_MEMIF_EMIF_2_CLKCTRL, -+ CM_L3INIT_HSUSBOTG_CLKCTRL, -+ CM_L3INIT_USBPHY_CLKCTRL, -+ CM_L4CFG_L4_CFG_CLKCTRL, -+ 0 -+}; -+ -+static const u32 clk_modules_hw_auto_non_essential[] = { -+ CM_MPU_M3_MPU_M3_CLKCTRL, -+ CM_IVAHD_IVAHD_CLKCTRL, -+ CM_IVAHD_SL2_CLKCTRL, -+ CM_DSP_DSP_CLKCTRL, -+ CM_L3_2_GPMC_CLKCTRL, -+ CM_L3INSTR_L3_3_CLKCTRL, -+ CM_L3INSTR_L3_INSTR_CLKCTRL, -+ CM_L3INSTR_INTRCONN_WP1_CLKCTRL, -+ CM_L3INIT_HSI_CLKCTRL, -+ CM_L3INIT_HSUSBTLL_CLKCTRL, -+ 0 -+}; -+ -+static const u32 clk_modules_explicit_en_essential[] = { -+ CM_L4PER_GPTIMER2_CLKCTRL, -+ CM_L3INIT_HSMMC1_CLKCTRL, -+ CM_L3INIT_HSMMC2_CLKCTRL, -+ CM_L4PER_MCSPI1_CLKCTRL, -+ CM_WKUP_GPTIMER1_CLKCTRL, -+ CM_L4PER_I2C1_CLKCTRL, -+ CM_L4PER_I2C2_CLKCTRL, -+ CM_L4PER_I2C3_CLKCTRL, -+ CM_L4PER_I2C4_CLKCTRL, -+ CM_WKUP_WDTIMER2_CLKCTRL, -+ CM_L4PER_UART3_CLKCTRL, -+ 0 -+}; -+ -+static const u32 clk_modules_explicit_en_non_essential[] = { -+ CM1_ABE_AESS_CLKCTRL, -+ CM1_ABE_PDM_CLKCTRL, -+ CM1_ABE_DMIC_CLKCTRL, -+ CM1_ABE_MCASP_CLKCTRL, -+ CM1_ABE_MCBSP1_CLKCTRL, -+ CM1_ABE_MCBSP2_CLKCTRL, -+ CM1_ABE_MCBSP3_CLKCTRL, -+ CM1_ABE_SLIMBUS_CLKCTRL, -+ CM1_ABE_TIMER5_CLKCTRL, -+ CM1_ABE_TIMER6_CLKCTRL, -+ CM1_ABE_TIMER7_CLKCTRL, -+ CM1_ABE_TIMER8_CLKCTRL, -+ CM1_ABE_WDT3_CLKCTRL, -+ CM_L4PER_GPTIMER9_CLKCTRL, -+ CM_L4PER_GPTIMER10_CLKCTRL, -+ CM_L4PER_GPTIMER11_CLKCTRL, -+ CM_L4PER_GPTIMER3_CLKCTRL, -+ CM_L4PER_GPTIMER4_CLKCTRL, -+ CM_L4PER_HDQ1W_CLKCTRL, -+ CM_L4PER_MCBSP4_CLKCTRL, -+ CM_L4PER_MCSPI2_CLKCTRL, -+ CM_L4PER_MCSPI3_CLKCTRL, -+ CM_L4PER_MCSPI4_CLKCTRL, -+ CM_L4PER_MMCSD3_CLKCTRL, -+ CM_L4PER_MMCSD4_CLKCTRL, -+ CM_L4PER_MMCSD5_CLKCTRL, -+ CM_L4PER_UART1_CLKCTRL, -+ CM_L4PER_UART2_CLKCTRL, -+ CM_L4PER_UART4_CLKCTRL, -+ CM_WKUP_KEYBOARD_CLKCTRL, -+ CM_WKUP_WDTIMER2_CLKCTRL, -+ CM_CAM_ISS_CLKCTRL, -+ CM_CAM_FDIF_CLKCTRL, -+ CM_DSS_DSS_CLKCTRL, -+ CM_SGX_SGX_CLKCTRL, -+ CM_L3INIT_HSUSBHOST_CLKCTRL, -+ CM_L3INIT_FSUSB_CLKCTRL, -+ 0 -+}; -+ -+static u32 get_m_n(u32 target_freq_khz, u32 ref_freq_khz, u32 *m, u32 *n, -+ u32 tolerance_khz) -+{ -+ u32 min_freq = target_freq_khz - tolerance_khz; -+ u32 max_freq = target_freq_khz; -+ u32 freq, freq_old; -+ *n = 1; -+ while (1) { -+ *m = min_freq / ref_freq_khz / 2 * (*n); -+ freq_old = 0; -+ while (1) { -+ freq = ref_freq_khz * 2 * (*m) / (*n); -+ if (abs(target_freq_khz - freq_old) <= -+ abs(target_freq_khz - freq)) { -+ freq = freq_old; -+ (*m)--; -+ break; -+ } -+ (*m)++; -+ freq_old = freq; -+ } -+ if (freq >= min_freq && freq <= max_freq) -+ break; -+ (*n)++; -+ if ((*n) > OMAP_DPLL_MAX_N + 1) -+ return 1; -+ } -+ (*n)--; -+ return 0; -+} -+ -+static u32 __get_syc_clk_freq(void) -+{ -+ /* -+ * For ES1 the ROM code calibration of sys clock is not reliable -+ * due to hw issue. So, use hard-coded value. If this value is not -+ * correct for any board over-ride this function in board file -+ * From ES2.0 onwards you will get this information from -+ * CM_SYS_CLKSEL -+ */ -+ if (omap4_revision() == OMAP4430_ES1_0) -+ return OMAP_SYS_CLK_FREQ_38_4_MHZ; -+ else { -+ u32 sys_clk_ind = readl(CM_SYS_CLKSEL) & -+ CM_SYS_CLKSEL_SYS_CLKSEL_MASK; -+ return sys_clk_array[sys_clk_ind]; -+ } -+} -+ -+static inline void do_bypass_dpll(u32 base) -+{ -+ struct dpll_regs *dpll_regs = (struct dpll_regs *)base; -+ -+ modify_reg_32(&dpll_regs->cm_clkmode_dpll, -+ CM_CLKMODE_DPLL_DPLL_EN_SHIFT, -+ CM_CLKMODE_DPLL_DPLL_EN_MASK, DPLL_EN_FAST_RELOCK_BYPASS); -+} -+ -+static inline void wait_for_bypass(u32 base) -+{ -+ struct dpll_regs *dpll_regs = (struct dpll_regs *)base; -+ -+ while (readl(&dpll_regs->cm_idlest_dpll) & ST_DPLL_CLK_MASK) -+ ; -+} -+ -+static inline void do_lock_dpll(u32 base) -+{ -+ struct dpll_regs *dpll_regs = (struct dpll_regs *)base; -+ -+ modify_reg_32(&dpll_regs->cm_clkmode_dpll, -+ CM_CLKMODE_DPLL_DPLL_EN_SHIFT, -+ CM_CLKMODE_DPLL_DPLL_EN_MASK, DPLL_EN_LOCK); -+} -+ -+static inline void wait_for_lock(u32 base) -+{ -+ struct dpll_regs *dpll_regs = (struct dpll_regs *)base; -+ -+ while (!(readl(&dpll_regs->cm_idlest_dpll) & ST_DPLL_CLK_MASK)) -+ ; -+} -+ -+static void do_setup_dpll(u32 base, const struct dpll_params *params, -+ u32 ref_clk_khz, u32 tolerance, u8 lock) -+{ -+ u32 temp, m, n; -+ struct dpll_regs *dpll_regs = (struct dpll_regs *)base; -+ -+ do_bypass_dpll(base); -+ -+ /* Get the M & N values */ -+ m = params->m; -+ n = params->n; -+ /* if m & n are not specified calculate them */ -+ if (!(m && n)) { -+ if (get_m_n(params->locked_freq_khz, ref_clk_khz, -+ &m, &n, tolerance)) { -+ /* DPLL locking is critical if it fails just hang */ -+ for (;;) -+ ; -+ return; -+ } -+ } -+ -+ /* Wait till the DPLL is in BYPASS */ -+ wait_for_bypass(base); -+ -+ /* Set M & N */ -+ temp = readl(&dpll_regs->cm_clksel_dpll); -+ set_bit_field(temp, CM_CLKSEL_DPLL_M_SHIFT, CM_CLKSEL_DPLL_M_MASK, m); -+ set_bit_field(temp, CM_CLKSEL_DPLL_N_SHIFT, CM_CLKSEL_DPLL_N_MASK, n); -+ writel(temp, &dpll_regs->cm_clksel_dpll); -+ -+ /* Lock */ -+ if (lock) -+ do_lock_dpll(base); -+ -+ /* Setup post-dividers */ -+ if (params->m2 >= 0) -+ writel(params->m2, &dpll_regs->cm_div_m2_dpll); -+ if (params->m3 >= 0) -+ writel(params->m3, &dpll_regs->cm_div_m3_dpll); -+ if (params->m4 >= 0) -+ writel(params->m4, &dpll_regs->cm_div_m4_dpll); -+ if (params->m5 >= 0) -+ writel(params->m5, &dpll_regs->cm_div_m5_dpll); -+ if (params->m6 >= 0) -+ writel(params->m6, &dpll_regs->cm_div_m6_dpll); -+ if (params->m7 >= 0) -+ writel(params->m7, &dpll_regs->cm_div_m7_dpll); -+ -+ /* Wait till the DPLL locks */ -+ if (lock) -+ wait_for_lock(base); -+} -+ -+const struct dpll_params *get_core_dpll_params(void) -+{ -+ switch (omap4_revision()) { -+ case OMAP4430_ES1_0: -+ return &core_dpll_params_es1_l3_190; -+ case OMAP4430_ES2_0: -+ case OMAP4430_SILICON_ID_INVALID: -+ return &core_dpll_params_opp100_ddr200; /* safest */ -+ case OMAP4430_ES2_1: -+ case OMAP4430_ES2_2: -+ return &core_dpll_params_opp100; -+ default: -+ return NULL; -+ } -+} -+ -+u32 omap4_ddr_clk(void) -+{ -+ u32 ddr_clk; -+ const struct dpll_params *core_dpll_params; -+ -+ core_dpll_params = get_core_dpll_params(); -+ /* -+ * DDR frequency is PHY_ROOT_CLK/2 -+ * PHY_ROOT_CLK = Fdpll/2/M2 -+ */ -+ ddr_clk = core_dpll_params->locked_freq_khz / 4 / core_dpll_params->m2; -+ ddr_clk *= 1000; /* convert to Hz */ -+ return ddr_clk; -+} -+ -+static void setup_dplls(void) -+{ -+ u32 sys_clk_khz, temp; -+ const struct dpll_params *params; -+ -+ sys_clk_khz = get_syc_clk_freq() / 1000; -+ -+ /* CORE dpll */ -+ params = get_core_dpll_params(); /* default - safest */ -+ /* -+ * Do not lock the core DPLL now. Just set it up. -+ * Core DPLL will be locked after setting up EMIF -+ * using the FREQ_UPDATE method(freq_update_core()) -+ */ -+ do_setup_dpll(CM_CLKMODE_DPLL_CORE, params, sys_clk_khz, -+ DPLL_LOCKED_FREQ_TOLERANCE_0, CONFIGURE_NO_LOCK); -+ /* Set the ratios for CORE_CLK, L3_CLK, L4_CLK */ -+ temp = (CLKSEL_CORE_X2_DIV_1 << CLKSEL_CORE_SHIFT) | -+ (CLKSEL_L3_CORE_DIV_2 << CLKSEL_L3_SHIFT) | -+ (CLKSEL_L4_L3_DIV_2 << CLKSEL_L4_SHIFT); -+ writel(temp, CM_CLKSEL_CORE); -+ -+ /* lock PER dpll */ -+ do_setup_dpll(CM_CLKMODE_DPLL_PER, &per_dpll_params_opp100, sys_clk_khz, -+ DPLL_LOCKED_FREQ_TOLERANCE_0, CONFIGURE_AND_LOCK); -+ -+ /* MPU dpll */ -+ if (omap4_revision() == OMAP4430_ES1_0) -+ params = &mpu_dpll_params_600mhz; -+ else -+ params = &mpu_dpll_params_1000mhz; -+ do_setup_dpll(CM_CLKMODE_DPLL_MPU, params, sys_clk_khz, -+ DPLL_LOCKED_FREQ_TOLERANCE_0, CONFIGURE_AND_LOCK); -+} -+ -+static void setup_non_essential_dplls(void) -+{ -+ u32 sys_clk_khz, temp, abe_ref_clk; -+ u32 m, n, sd_div, num, den; -+ struct dpll_params tmp_params; -+ -+ sys_clk_khz = get_syc_clk_freq() / 1000; -+ -+ /* IVA */ -+ do_setup_dpll(CM_CLKMODE_DPLL_IVA, &iva_dpll_params, sys_clk_khz, -+ DPLL_LOCKED_FREQ_TOLERANCE_500_KHZ, CONFIGURE_AND_LOCK); -+ -+ /* USB */ -+ tmp_params = usb_dpll_params; -+ get_m_n(tmp_params.locked_freq_khz, sys_clk_khz, &m, &n, -+ DPLL_LOCKED_FREQ_TOLERANCE_0); -+ /* -+ * USB dpll is J-type. Need to set DPLL_SD_DIV for jitter correction -+ * DPLL_SD_DIV = CEILING ([DPLL_MULT/(DPLL_DIV+1)]* CLKINP / 250) -+ * - where CLKINP is sys_clk in MHz -+ * Use CLKINP in KHz and adjust the denominator accordingly so -+ * that we have enough accuracy and at the same time no overflow -+ */ -+ num = m * sys_clk_khz; -+ den = (n + 1) * 250 * 1000; -+ num += den - 1; -+ sd_div = num / den; -+ temp = readl(CM_CLKSEL_DPLL_USB); -+ set_bit_field(temp, CM_CLKSEL_DPLL_DPLL_SD_DIV_SHIFT, -+ CM_CLKSEL_DPLL_DPLL_SD_DIV_MASK, sd_div); -+ writel(temp, CM_CLKSEL_DPLL_USB); -+ /* Now setup the dpll with the regular function */ -+ tmp_params.m = m; -+ tmp_params.n = n; -+ do_setup_dpll(CM_CLKMODE_DPLL_USB, &tmp_params, sys_clk_khz, -+ DPLL_LOCKED_FREQ_TOLERANCE_0, CONFIGURE_AND_LOCK); -+ -+ /* ABE dpll */ -+ tmp_params = abe_dpll_params; -+#ifdef CONFIG_SYS_OMAP4_ABE_SYSCK -+ abe_ref_clk = sys_clk_khz; -+#else -+ /* Enable REGM4XEN to achieve 196.608MHz from 32768 Hz */ -+ writel(readl(CM_CLKMODE_DPLL_ABE) | CM_CLKMODE_DPLL_DPLL_REGM4XEN_MASK, -+ CM_CLKMODE_DPLL_ABE); -+ -+ /* -+ * Converting the input clock 32768 Hz to KHz would result in accuracy -+ * loss. Instead make both target frequency and reference clock to be -+ * in terms of Hz. -+ * -+ * Also, REGM4XEN is enabled so there is an additional -+ * multiplier of 4 for M. So adjust for this while passing target -+ * frequency to get_m_n() -+ */ -+ tmp_params.locked_freq_khz = tmp_params.locked_freq_khz * 1000 / 4; -+ abe_ref_clk = OMAP_32K_CLK_FREQ; -+#endif -+ temp = (abe_ref_clk == OMAP_32K_CLK_FREQ) ? -+ CM_ABE_PLL_REF_CLKSEL_CLKSEL_32KCLK : -+ CM_ABE_PLL_REF_CLKSEL_CLKSEL_SYSCLK; -+ /* Select the right reference clk */ -+ modify_reg_32(CM_ABE_PLL_REF_CLKSEL, -+ CM_ABE_PLL_REF_CLKSEL_CLKSEL_SHIFT, -+ CM_ABE_PLL_REF_CLKSEL_CLKSEL_MASK, -+ temp); -+ /* Lock the dpll */ -+ do_setup_dpll(CM_CLKMODE_DPLL_ABE, &tmp_params, abe_ref_clk, -+ DPLL_LOCKED_FREQ_TOLERANCE_0, CONFIGURE_AND_LOCK); -+} -+ -+static void do_scale_vcore(u32 vcore_reg, u32 volt) -+{ -+ u32 temp; -+ -+ temp = SMPS_I2C_SLAVE_ADDR | -+ (vcore_reg << PRM_VC_VAL_BYPASS_REGADDR_SHIFT) | -+ (volt << PRM_VC_VAL_BYPASS_DATA_SHIFT) | -+ PRM_VC_VAL_BYPASS_VALID_BIT; -+ writel(temp, PRM_VC_VAL_BYPASS); -+ while (readl(PRM_VC_VAL_BYPASS) & PRM_VC_VAL_BYPASS_VALID_BIT) -+ ; -+} -+ -+static void scale_vcores(void) -+{ -+ u32 volt, sys_clk_khz, cycles_hi, cycles_low, temp; -+ u32 omap4_rev = omap4_revision(); -+ -+ sys_clk_khz = get_syc_clk_freq() / 1000; -+ -+ /* -+ * Setup the dedicated I2C controller for Voltage Control -+ * I2C clk - high period 40% low period 60% -+ */ -+ cycles_hi = sys_clk_khz * 4 / PRM_VC_I2C_CHANNEL_FREQ_KHZ / 10; -+ cycles_low = sys_clk_khz * 6 / PRM_VC_I2C_CHANNEL_FREQ_KHZ / 10; -+ /* values to be set in register - less by 5 & 7 respectively */ -+ cycles_hi -= 5; -+ cycles_low -= 7; -+ temp = (cycles_hi << PRM_VC_CFG_I2C_CLK_SCLH_SHIFT) | -+ (cycles_low << PRM_VC_CFG_I2C_CLK_SCLL_SHIFT); -+ writel(temp, PRM_VC_CFG_I2C_CLK); -+ -+ /* Disable high speed mode and all advanced features */ -+ writel(0x0, PRM_VC_CFG_I2C_MODE); -+ -+ /* VCORE 1 */ -+ if ((omap4_rev == OMAP4430_ES2_0) || (omap4_rev == OMAP4430_ES2_1)) -+ volt = SMPS_VOLT_1_3500_V; -+ else -+ volt = SMPS_VOLT_1_5000_V; -+ do_scale_vcore(SMPS_REG_ADDR_VCORE1, volt); -+ -+ /* VCORE 2 */ -+ if ((omap4_rev == OMAP4430_ES2_0) || (omap4_rev == OMAP4430_ES2_1)) -+ volt = SMPS_VOLT_1_1000_V; -+ else -+ volt = SMPS_VOLT_1_2000_V; -+ do_scale_vcore(SMPS_REG_ADDR_VCORE2, volt); -+ -+ /* VCORE 3 */ -+ if (omap4_rev == OMAP4430_ES2_0) -+ volt = SMPS_VOLT_1_1000_V; -+ else if (omap4_rev == OMAP4430_ES2_1) -+ volt = SMPS_VOLT_1_1125_V; -+ else -+ volt = SMPS_VOLT_1_2000_V; -+ -+ do_scale_vcore(SMPS_REG_ADDR_VCORE3, volt); -+} -+ -+static void enable_clock_domain(u32 clkctrl_reg, u32 enable_mode) -+{ -+ modify_reg_32(clkctrl_reg, CD_CLKCTRL_CLKTRCTRL_SHIFT, -+ CD_CLKCTRL_CLKTRCTRL_MASK, enable_mode); -+} -+ -+static inline void wait_for_clk_enable(u32 clkctrl_addr) -+{ -+ u32 idlest = MODULE_CLKCTRL_IDLEST_DISABLED; -+ -+ while ((idlest == MODULE_CLKCTRL_IDLEST_DISABLED) || -+ (idlest == MODULE_CLKCTRL_IDLEST_TRANSITIONING)) { -+ idlest = readl(clkctrl_addr); -+ idlest = get_bit_field(idlest, MODULE_CLKCTRL_IDLEST_SHIFT, -+ MODULE_CLKCTRL_IDLEST_MASK); -+ } -+} -+ -+static void enable_clock_module(u32 clkctrl_addr, u32 enable_mode, -+ u32 wait_for_enable) -+{ -+ modify_reg_32(clkctrl_addr, MODULE_CLKCTRL_MODULEMODE_SHIFT, -+ MODULE_CLKCTRL_MODULEMODE_MASK, enable_mode); -+ if (wait_for_enable) -+ wait_for_clk_enable(clkctrl_addr); -+} -+ -+/* -+ * Enable a set of clock domains and clock modules associated with them -+ */ -+static void enable_clocks(const u32 *clock_domains, -+ const u32 *clock_modules_hw_auto, -+ const u32 *clock_modules_explicit_en, -+ u32 wait_for_enable) -+{ -+ int i = 0, max = 100; -+ /* Put the clock domains in SW_WKUP mode */ -+ for (i = 0; (i < max) && clock_domains[i]; i++) { -+ enable_clock_domain(clock_domains[i], -+ CD_CLKCTRL_CLKTRCTRL_SW_WKUP); -+ } -+ -+ /* Clock modules that need to be put in HW_AUTO */ -+ for (i = 0; (i < max) && clock_modules_hw_auto[i]; i++) { -+ enable_clock_module(clock_modules_hw_auto[i], -+ MODULE_CLKCTRL_MODULEMODE_HW_AUTO, -+ wait_for_enable); -+ }; -+ -+ /* Clock modules that need to be put in SW_EXPLICIT_EN mode */ -+ for (i = 0; (i < max) && clock_modules_explicit_en[i]; i++) { -+ enable_clock_module(clock_modules_explicit_en[i], -+ MODULE_CLKCTRL_MODULEMODE_SW_EXPLICIT_EN, -+ wait_for_enable); -+ }; -+ -+ /* Put the clock domains in HW_AUTO mode now */ -+ for (i = 0; (i < max) && clock_domains[i]; i++) { -+ enable_clock_domain(clock_domains[i], -+ CD_CLKCTRL_CLKTRCTRL_HW_AUTO); -+ } -+} -+ -+/* -+ * Enable essential clock domains, modules and -+ * do some additional special settings needed -+ */ -+static void enable_basic_clocks(void) -+{ -+ /* Enable optional additional functional clock for GPIO4 */ -+ writel(readl(CM_L4PER_GPIO4_CLKCTRL) | GPIO4_CLKCTRL_OPTFCLKEN_SHIFT, -+ CM_L4PER_GPIO4_CLKCTRL); -+ -+ /* Enable 96 MHz clock for MMC1 & MMC2 */ -+ writel(readl(CM_L3INIT_HSMMC1_CLKCTRL) | HSMMC_CLKCTRL_CLKSEL_SHIFT, -+ CM_L3INIT_HSMMC1_CLKCTRL); -+ writel(readl(CM_L3INIT_HSMMC2_CLKCTRL) | HSMMC_CLKCTRL_CLKSEL_SHIFT, -+ CM_L3INIT_HSMMC2_CLKCTRL); -+ -+ /* Select 32KHz clock as the source of GPTIMER1 */ -+ writel(readl(CM_WKUP_GPTIMER1_CLKCTRL) | GPTIMER1_CLKCTRL_CLKSEL_SHIFT, -+ CM_WKUP_GPTIMER1_CLKCTRL); -+ -+ /* Enable optional 48M functional clock for USB PHY */ -+ writel(readl(CM_L3INIT_USBPHY_CLKCTRL) | -+ USBPHY_CLKCTRL_OPTFCLKEN_PHY_48M_MASK, CM_L3INIT_USBPHY_CLKCTRL); -+ -+ /* Enable all essential clock domains and modules */ -+ enable_clocks(clk_domains_essential, -+ clk_modules_hw_auto_essential, -+ clk_modules_explicit_en_essential, 1); -+} -+ -+/* -+ * Enable non-essential clock domains, modules and -+ * do some additional special settings needed -+ */ -+static void enable_non_essential_clocks(void) -+{ -+ u32 tmp; -+ /* Enable optional functional clock for ISS */ -+ writel(readl(CM_CAM_ISS_CLKCTRL) | ISS_CLKCTRL_OPTFCLKEN_SHIFT, -+ CM_CAM_ISS_CLKCTRL); -+ -+ /* Enable all optional functional clocks of DSS */ -+ writel(readl(CM_DSS_DSS_CLKCTRL) | DSS_CLKCTRL_OPTFCLKEN_MASK, -+ CM_DSS_DSS_CLKCTRL); -+ -+ /* Enable all non-essential clock domains and modules */ -+ enable_clocks(clk_domains_non_essential, -+ clk_modules_hw_auto_non_essential, -+ clk_modules_explicit_en_non_essential, 0); -+ -+ /* Put camera module in no sleep mode */ -+ tmp = readl(CM_CAM_CLKSTCTRL); -+ set_bit_field(tmp, MODULE_CLKCTRL_MODULEMODE_SHIFT, -+ MODULE_CLKCTRL_MODULEMODE_MASK, -+ CD_CLKCTRL_CLKTRCTRL_NO_SLEEP); -+ writel(tmp, CM_CAM_CLKSTCTRL); -+} -+ -+void freq_update_core(void) -+{ -+ u32 freq_config1 = 0; -+ const struct dpll_params *core_dpll_params; -+ -+ core_dpll_params = get_core_dpll_params(); -+ /* Put EMIF clock domain in sw wakeup mode */ -+ enable_clock_domain(CM_MEMIF_CLKSTCTRL, CD_CLKCTRL_CLKTRCTRL_SW_WKUP); -+ wait_for_clk_enable(CM_MEMIF_EMIF_1_CLKCTRL); -+ wait_for_clk_enable(CM_MEMIF_EMIF_2_CLKCTRL); -+ -+ freq_config1 = SHADOW_FREQ_CONFIG1_FREQ_UPDATE_MASK | -+ SHADOW_FREQ_CONFIG1_DLL_RESET_MASK; -+ -+ set_bit_field(freq_config1, SHADOW_FREQ_CONFIG1_DPLL_EN_SHIFT, -+ SHADOW_FREQ_CONFIG1_DPLL_EN_MASK, DPLL_EN_LOCK); -+ -+ set_bit_field(freq_config1, SHADOW_FREQ_CONFIG1_M2_DIV_SHIFT, -+ SHADOW_FREQ_CONFIG1_M2_DIV_MASK, core_dpll_params->m2); -+ -+ writel(freq_config1, CM_SHADOW_FREQ_CONFIG1); -+ while (readl(CM_SHADOW_FREQ_CONFIG1) & -+ SHADOW_FREQ_CONFIG1_FREQ_UPDATE_MASK) -+ ; -+ -+ /* Put EMIF clock domain back in hw auto mode */ -+ enable_clock_domain(CM_MEMIF_CLKSTCTRL, CD_CLKCTRL_CLKTRCTRL_HW_AUTO); -+ wait_for_clk_enable(CM_MEMIF_EMIF_1_CLKCTRL); -+ wait_for_clk_enable(CM_MEMIF_EMIF_2_CLKCTRL); -+} -+ -+void bypass_dpll(u32 base) -+{ -+ do_bypass_dpll(base); -+ wait_for_bypass(base); -+} -+ -+void lock_dpll(u32 base) -+{ -+ do_lock_dpll(base); -+ wait_for_lock(base); -+} -+ -+u32 get_syc_clk_freq(void) -+ __attribute__ ((weak, alias("__get_syc_clk_freq"))); -+ -+void prcm_init(void) -+{ -+ switch (omap4_hw_init_context()) { -+ case OMAP_INIT_CONTEXT_SPL: -+ scale_vcores(); -+ setup_dplls(); -+ enable_basic_clocks(); -+ break; -+ case OMAP_INIT_CONTEXT_UBOOT_LOADED_BY_SPL: -+ setup_non_essential_dplls(); -+ enable_non_essential_clocks(); -+ break; -+ case OMAP_INIT_CONTEXT_XIP_UBOOT: -+ case OMAP_INIT_CONTEXT_UBOOT_LOADED_BY_CH: -+ scale_vcores(); -+ setup_dplls(); -+ enable_basic_clocks(); -+ setup_non_essential_dplls(); -+ enable_non_essential_clocks(); -+ break; -+ } -+} -diff --git a/arch/arm/include/asm/arch-omap4/clocks.h b/arch/arm/include/asm/arch-omap4/clocks.h -new file mode 100644 -index 0000000..fdbe632 ---- /dev/null -+++ b/arch/arm/include/asm/arch-omap4/clocks.h -@@ -0,0 +1,504 @@ -+/* -+ * (C) Copyright 2010 -+ * Texas Instruments, <www.ti.com> -+ * -+ * Aneesh V <aneesh@ti.com> -+ * -+ * See file CREDITS for list of people who contributed to this -+ * project. -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License as -+ * published by the Free Software Foundation; either version 2 of -+ * the License, or (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+ * MA 02111-1307 USA -+ */ -+#ifndef _CLOCKS_OMAP4_H_ -+#define _CLOCKS_OMAP4_H_ -+#include <common.h> -+ -+#define CM_CLKMODE_DPLL_CORE (OMAP44XX_L4_CORE_BASE + 0x4120) -+#define CM_CLKMODE_DPLL_PER (OMAP44XX_L4_CORE_BASE + 0x8140) -+#define CM_CLKMODE_DPLL_MPU (OMAP44XX_L4_CORE_BASE + 0x4160) -+#define CM_CLKSEL_CORE (OMAP44XX_L4_CORE_BASE + 0x4100) -+ -+/* PRM.CKGEN module registers */ -+#define CM_ABE_PLL_REF_CLKSEL (OMAP44XX_L4_WKUP_BASE + 0x610C) -+#define CM_SYS_CLKSEL (OMAP44XX_L4_WKUP_BASE + 0x6110) -+ -+/* PRM.WKUP_CM module registers */ -+#define CM_WKUP_CLKSTCTRL (OMAP44XX_L4_WKUP_BASE + 0x7800) -+#define CM_WKUP_L4WKUP_CLKCTRL (OMAP44XX_L4_WKUP_BASE + 0x7820) -+#define CM_WKUP_WDTIMER1_CLKCTRL (OMAP44XX_L4_WKUP_BASE + 0x7828) -+#define CM_WKUP_WDTIMER2_CLKCTRL (OMAP44XX_L4_WKUP_BASE + 0x7830) -+#define CM_WKUP_GPIO1_CLKCTRL (OMAP44XX_L4_WKUP_BASE + 0x7838) -+#define CM_WKUP_GPTIMER1_CLKCTRL (OMAP44XX_L4_WKUP_BASE + 0x7840) -+#define CM_WKUP_GPTIMER12_CLKCTRL (OMAP44XX_L4_WKUP_BASE + 0x7848) -+#define CM_WKUP_SYNCTIMER_CLKCTRL (OMAP44XX_L4_WKUP_BASE + 0x7850) -+#define CM_WKUP_USIM_CLKCTRL (OMAP44XX_L4_WKUP_BASE + 0x7858) -+#define CM_WKUP_SARRAM_CLKCTRL (OMAP44XX_L4_WKUP_BASE + 0x7860) -+#define CM_WKUP_KEYBOARD_CLKCTRL (OMAP44XX_L4_WKUP_BASE + 0x7878) -+#define CM_WKUP_RTC_CLKCTRL (OMAP44XX_L4_WKUP_BASE + 0x7880) -+#define CM_WKUP_BANDGAP_CLKCTRL (OMAP44XX_L4_WKUP_BASE + 0x7888) -+ -+/* DEVICE_PRM Registers */ -+#define PRM_VC_VAL_BYPASS (OMAP44XX_L4_WKUP_BASE + 0x7BA0) -+#define PRM_VC_CFG_CHANNEL (OMAP44XX_L4_WKUP_BASE + 0x7BA4) -+#define PRM_VC_CFG_I2C_MODE (OMAP44XX_L4_WKUP_BASE + 0x7BA8) -+#define PRM_VC_CFG_I2C_CLK (OMAP44XX_L4_WKUP_BASE + 0x7BAC) -+ -+/* CM1.CKGEN module registers */ -+#define CM_CLKSEL_CORE (OMAP44XX_L4_CORE_BASE + 0x4100) -+#define CM_CLKSEL_ABE (OMAP44XX_L4_CORE_BASE + 0x4108) -+#define CM_DLL_CTRL (OMAP44XX_L4_CORE_BASE + 0x4110) -+#define CM_CLKMODE_DPLL_CORE (OMAP44XX_L4_CORE_BASE + 0x4120) -+#define CM_IDLEST_DPLL_CORE (OMAP44XX_L4_CORE_BASE + 0x4124) -+#define CM_AUTOIDLE_DPLL_CORE (OMAP44XX_L4_CORE_BASE + 0x4128) -+#define CM_CLKSEL_DPLL_CORE (OMAP44XX_L4_CORE_BASE + 0x412c) -+#define CM_DIV_M2_DPLL_CORE (OMAP44XX_L4_CORE_BASE + 0x4130) -+#define CM_DIV_M3_DPLL_CORE (OMAP44XX_L4_CORE_BASE + 0x4134) -+#define CM_DIV_M4_DPLL_CORE (OMAP44XX_L4_CORE_BASE + 0x4138) -+#define CM_DIV_M5_DPLL_CORE (OMAP44XX_L4_CORE_BASE + 0x413c) -+#define CM_DIV_M6_DPLL_CORE (OMAP44XX_L4_CORE_BASE + 0x4140) -+#define CM_DIV_M7_DPLL_CORE (OMAP44XX_L4_CORE_BASE + 0x4144) -+#define CM_SSC_DELTAMSTEP_DPLL_CORE (OMAP44XX_L4_CORE_BASE + 0x4148) -+#define CM_SSC_MODFREQDIV_DPLL_CORE (OMAP44XX_L4_CORE_BASE + 0x414c) -+#define CM_EMU_OVERRIDE_DPLL_CORE (OMAP44XX_L4_CORE_BASE + 0x4150) -+#define CM_CLKMODE_DPLL_MPU (OMAP44XX_L4_CORE_BASE + 0x4160) -+#define CM_IDLEST_DPLL_MPU (OMAP44XX_L4_CORE_BASE + 0x4164) -+#define CM_AUTOIDLE_DPLL_MPU (OMAP44XX_L4_CORE_BASE + 0x4168) -+#define CM_CLKSEL_DPLL_MPU (OMAP44XX_L4_CORE_BASE + 0x416c) -+#define CM_DIV_M2_DPLL_MPU (OMAP44XX_L4_CORE_BASE + 0x4170) -+#define CM_SSC_DELTAMSTEP_DPLL_MPU (OMAP44XX_L4_CORE_BASE + 0x4188) -+#define CM_SSC_MODFREQDIV_DPLL_MPU (OMAP44XX_L4_CORE_BASE + 0x418c) -+#define CM_BYPCLK_DPLL_MPU (OMAP44XX_L4_CORE_BASE + 0x419c) -+#define CM_CLKMODE_DPLL_IVA (OMAP44XX_L4_CORE_BASE + 0x41a0) -+#define CM_IDLEST_DPLL_IVA (OMAP44XX_L4_CORE_BASE + 0x41a4) -+#define CM_AUTOIDLE_DPLL_IVA (OMAP44XX_L4_CORE_BASE + 0x41a8) -+#define CM_CLKSEL_DPLL_IVA (OMAP44XX_L4_CORE_BASE + 0x41ac) -+#define CM_DIV_M4_DPLL_IVA (OMAP44XX_L4_CORE_BASE + 0x41b8) -+#define CM_DIV_M5_DPLL_IVA (OMAP44XX_L4_CORE_BASE + 0x41bc) -+#define CM_SSC_DELTAMSTEP_DPLL_IVA (OMAP44XX_L4_CORE_BASE + 0x41c8) -+#define CM_SSC_MODFREQDIV_DPLL_IVA (OMAP44XX_L4_CORE_BASE + 0x41cc) -+#define CM_BYPCLK_DPLL_IVA (OMAP44XX_L4_CORE_BASE + 0x41dc) -+#define CM_CLKMODE_DPLL_ABE (OMAP44XX_L4_CORE_BASE + 0x41e0) -+#define CM_IDLEST_DPLL_ABE (OMAP44XX_L4_CORE_BASE + 0x41e4) -+#define CM_AUTOIDLE_DPLL_ABE (OMAP44XX_L4_CORE_BASE + 0x41e8) -+#define CM_CLKSEL_DPLL_ABE (OMAP44XX_L4_CORE_BASE + 0x41ec) -+#define CM_DIV_M2_DPLL_ABE (OMAP44XX_L4_CORE_BASE + 0x41f0) -+#define CM_DIV_M3_DPLL_ABE (OMAP44XX_L4_CORE_BASE + 0x41f4) -+#define CM_SSC_DELTAMSTEP_DPLL_ABE (OMAP44XX_L4_CORE_BASE + 0x4208) -+#define CM_SSC_MODFREQDIV_DPLL_ABE (OMAP44XX_L4_CORE_BASE + 0x420c) -+#define CM_CLKMODE_DPLL_DDRPHY (OMAP44XX_L4_CORE_BASE + 0x4220) -+#define CM_IDLEST_DPLL_DDRPHY (OMAP44XX_L4_CORE_BASE + 0x4224) -+#define CM_AUTOIDLE_DPLL_DDRPHY (OMAP44XX_L4_CORE_BASE + 0x4228) -+#define CM_CLKSEL_DPLL_DDRPHY (OMAP44XX_L4_CORE_BASE + 0x422c) -+#define CM_DIV_M2_DPLL_DDRPHY (OMAP44XX_L4_CORE_BASE + 0x4230) -+#define CM_DIV_M4_DPLL_DDRPHY (OMAP44XX_L4_CORE_BASE + 0x4238) -+#define CM_DIV_M5_DPLL_DDRPHY (OMAP44XX_L4_CORE_BASE + 0x423c) -+#define CM_DIV_M6_DPLL_DDRPHY (OMAP44XX_L4_CORE_BASE + 0x4240) -+#define CM_SSC_DELTAMSTEP_DPLL_DDRPHY (OMAP44XX_L4_CORE_BASE + 0x4248) -+#define CM_SHADOW_FREQ_CONFIG1 (OMAP44XX_L4_CORE_BASE + 0x4260) -+ -+/* CM1.ABE register offsets */ -+#define CM1_ABE_CLKSTCTRL (OMAP44XX_L4_CORE_BASE + 0x4500) -+#define CM1_ABE_L4ABE_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x4520) -+#define CM1_ABE_AESS_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x4528) -+#define CM1_ABE_PDM_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x4530) -+#define CM1_ABE_DMIC_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x4538) -+#define CM1_ABE_MCASP_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x4540) -+#define CM1_ABE_MCBSP1_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x4548) -+#define CM1_ABE_MCBSP2_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x4550) -+#define CM1_ABE_MCBSP3_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x4558) -+#define CM1_ABE_SLIMBUS_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x4560) -+#define CM1_ABE_TIMER5_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x4568) -+#define CM1_ABE_TIMER6_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x4570) -+#define CM1_ABE_TIMER7_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x4578) -+#define CM1_ABE_TIMER8_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x4580) -+#define CM1_ABE_WDT3_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x4588) -+ -+/* CM1.DSP register offsets */ -+#define CM_DSP_CLKSTCTRL (OMAP44XX_L4_CORE_BASE + 0x4400) -+#define CM_DSP_DSP_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x4420) -+ -+/* CM2.CKGEN module registers */ -+#define CM_CLKSEL_MPU_M3_ISS_ROOT (OMAP44XX_L4_CORE_BASE + 0x8100) -+#define CM_CLKSEL_USB_60MHz (OMAP44XX_L4_CORE_BASE + 0x8104) -+#define CM_SCALE_FCLK (OMAP44XX_L4_CORE_BASE + 0x8108) -+#define CM_CORE_DVFS_PERF1 (OMAP44XX_L4_CORE_BASE + 0x8110) -+#define CM_CORE_DVFS_PERF2 (OMAP44XX_L4_CORE_BASE + 0x8114) -+#define CM_CORE_DVFS_PERF3 (OMAP44XX_L4_CORE_BASE + 0x8118) -+#define CM_CORE_DVFS_PERF4 (OMAP44XX_L4_CORE_BASE + 0x811c) -+#define CM_CORE_DVFS_CURRENT (OMAP44XX_L4_CORE_BASE + 0x8124) -+#define CM_IVA_DVFS_PERF_TESLA (OMAP44XX_L4_CORE_BASE + 0x8128) -+#define CM_IVA_DVFS_PERF_IVAHD (OMAP44XX_L4_CORE_BASE + 0x812c) -+#define CM_IVA_DVFS_PERF_ABE (OMAP44XX_L4_CORE_BASE + 0x8130) -+#define CM_IVA_DVFS_CURRENT (OMAP44XX_L4_CORE_BASE + 0x8138) -+#define CM_CLKMODE_DPLL_PER (OMAP44XX_L4_CORE_BASE + 0x8140) -+#define CM_IDLEST_DPLL_PER (OMAP44XX_L4_CORE_BASE + 0x8144) -+#define CM_AUTOIDLE_DPLL_PER (OMAP44XX_L4_CORE_BASE + 0x8148) -+#define CM_CLKSEL_DPLL_PER (OMAP44XX_L4_CORE_BASE + 0x814c) -+#define CM_DIV_M2_DPLL_PER (OMAP44XX_L4_CORE_BASE + 0x8150) -+#define CM_DIV_M3_DPLL_PER (OMAP44XX_L4_CORE_BASE + 0x8154) -+#define CM_DIV_M4_DPLL_PER (OMAP44XX_L4_CORE_BASE + 0x8158) -+#define CM_DIV_M5_DPLL_PER (OMAP44XX_L4_CORE_BASE + 0x815c) -+#define CM_DIV_M6_DPLL_PER (OMAP44XX_L4_CORE_BASE + 0x8160) -+#define CM_DIV_M7_DPLL_PER (OMAP44XX_L4_CORE_BASE + 0x8164) -+#define CM_SSC_DELTAMSTEP_DPLL_PER (OMAP44XX_L4_CORE_BASE + 0x8168) -+#define CM_SSC_MODFREQDIV_DPLL_PER (OMAP44XX_L4_CORE_BASE + 0x816c) -+#define CM_EMU_OVERRIDE_DPLL_PER (OMAP44XX_L4_CORE_BASE + 0x8170) -+#define CM_CLKMODE_DPLL_USB (OMAP44XX_L4_CORE_BASE + 0x8180) -+#define CM_IDLEST_DPLL_USB (OMAP44XX_L4_CORE_BASE + 0x8184) -+#define CM_AUTOIDLE_DPLL_USB (OMAP44XX_L4_CORE_BASE + 0x8188) -+#define CM_CLKSEL_DPLL_USB (OMAP44XX_L4_CORE_BASE + 0x818c) -+#define CM_DIV_M2_DPLL_USB (OMAP44XX_L4_CORE_BASE + 0x8190) -+#define CM_SSC_DELTAMSTEP_DPLL_USB (OMAP44XX_L4_CORE_BASE + 0x81a8) -+#define CM_SSC_MODFREQDIV_DPLL_USB (OMAP44XX_L4_CORE_BASE + 0x81ac) -+#define CM_CLKDCOLDO_DPLL_USB (OMAP44XX_L4_CORE_BASE + 0x81b4) -+#define CM_CLKMODE_DPLL_UNIPRO (OMAP44XX_L4_CORE_BASE + 0x81c0) -+#define CM_IDLEST_DPLL_UNIPRO (OMAP44XX_L4_CORE_BASE + 0x81c4) -+#define CM_AUTOIDLE_DPLL_UNIPRO (OMAP44XX_L4_CORE_BASE + 0x81c8) -+#define CM_CLKSEL_DPLL_UNIPRO (OMAP44XX_L4_CORE_BASE + 0x81cc) -+#define CM_DIV_M2_DPLL_UNIPRO (OMAP44XX_L4_CORE_BASE + 0x81d0) -+#define CM_SSC_DELTAMSTEP_DPLL_UNIPRO (OMAP44XX_L4_CORE_BASE + 0x81e8) -+#define CM_SSC_MODFREQDIV_DPLL_UNIPRO (OMAP44XX_L4_CORE_BASE + 0x81ec) -+ -+/* CM2.CORE module registers */ -+#define CM_L3_1_CLKSTCTRL (OMAP44XX_L4_CORE_BASE + 0x8700) -+#define CM_L3_1_DYNAMICDEP (OMAP44XX_L4_CORE_BASE + 0x8708) -+#define CM_L3_1_L3_1_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x8720) -+#define CM_L3_2_CLKSTCTRL (OMAP44XX_L4_CORE_BASE + 0x8800) -+#define CM_L3_2_DYNAMICDEP (OMAP44XX_L4_CORE_BASE + 0x8808) -+#define CM_L3_2_L3_2_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x8820) -+#define CM_L3_2_GPMC_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x8828) -+#define CM_L3_2_OCMC_RAM_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x8830) -+#define CM_MPU_M3_CLKSTCTRL (OMAP44XX_L4_CORE_BASE + 0x8900) -+#define CM_MPU_M3_STATICDEP (OMAP44XX_L4_CORE_BASE + 0x8904) -+#define CM_MPU_M3_DYNAMICDEP (OMAP44XX_L4_CORE_BASE + 0x8908) -+#define CM_MPU_M3_MPU_M3_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x8920) -+#define CM_SDMA_CLKSTCTRL (OMAP44XX_L4_CORE_BASE + 0x8a00) -+#define CM_SDMA_STATICDEP (OMAP44XX_L4_CORE_BASE + 0x8a04) -+#define CM_SDMA_DYNAMICDEP (OMAP44XX_L4_CORE_BASE + 0x8a08) -+#define CM_SDMA_SDMA_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x8a20) -+#define CM_MEMIF_CLKSTCTRL (OMAP44XX_L4_CORE_BASE + 0x8b00) -+#define CM_MEMIF_DMM_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x8b20) -+#define CM_MEMIF_EMIF_FW_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x8b28) -+#define CM_MEMIF_EMIF_1_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x8b30) -+#define CM_MEMIF_EMIF_2_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x8b38) -+#define CM_MEMIF_DLL_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x8b40) -+#define CM_MEMIF_EMIF_H1_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x8b50) -+#define CM_MEMIF_EMIF_H2_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x8b58) -+#define CM_MEMIF_DLL_H_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x8b60) -+#define CM_C2C_CLKSTCTRL (OMAP44XX_L4_CORE_BASE + 0x8c00) -+#define CM_C2C_STATICDEP (OMAP44XX_L4_CORE_BASE + 0x8c04) -+#define CM_C2C_DYNAMICDEP (OMAP44XX_L4_CORE_BASE + 0x8c08) -+#define CM_C2C_SAD2D_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x8c20) -+#define CM_C2C_MODEM_ICR_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x8c28) -+#define CM_C2C_SAD2D_FW_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x8c30) -+#define CM_L4CFG_CLKSTCTRL (OMAP44XX_L4_CORE_BASE + 0x8d00) -+#define CM_L4CFG_DYNAMICDEP (OMAP44XX_L4_CORE_BASE + 0x8d08) -+#define CM_L4CFG_L4_CFG_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x8d20) -+#define CM_L4CFG_HW_SEM_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x8d28) -+#define CM_L4CFG_MAILBOX_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x8d30) -+#define CM_L4CFG_SAR_ROM_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x8d38) -+#define CM_L3INSTR_CLKSTCTRL (OMAP44XX_L4_CORE_BASE + 0x8e00) -+#define CM_L3INSTR_L3_3_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x8e20) -+#define CM_L3INSTR_L3_INSTR_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x8e28) -+#define CM_L3INSTR_INTRCONN_WP1_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x8e40) -+ -+/* CM2.L3INIT register offsets */ -+#define CM_L3INIT_CLKSTCTRL (OMAP44XX_L4_CORE_BASE + 0x9300) -+ -+/* CM2.L4PER register offsets */ -+#define CM_L4PER_CLKSTCTRL (OMAP44XX_L4_CORE_BASE + 0x9400) -+#define CM_L4PER_DYNAMICDEP (OMAP44XX_L4_CORE_BASE + 0x9408) -+#define CM_L4PER_ADC_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x9420) -+#define CM_L4PER_GPTIMER10_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x9428) -+#define CM_L4PER_GPTIMER11_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x9430) -+#define CM_L4PER_GPTIMER2_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x9438) -+#define CM_L4PER_GPTIMER3_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x9440) -+#define CM_L4PER_GPTIMER4_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x9448) -+#define CM_L4PER_GPTIMER9_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x9450) -+#define CM_L4PER_ELM_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x9458) -+#define CM_L4PER_GPIO2_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x9460) -+#define CM_L4PER_GPIO3_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x9468) -+#define CM_L4PER_GPIO4_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x9470) -+#define CM_L4PER_GPIO5_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x9478) -+#define CM_L4PER_GPIO6_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x9480) -+#define CM_L4PER_HDQ1W_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x9488) -+#define CM_L4PER_HECC1_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x9490) -+#define CM_L4PER_HECC2_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x9498) -+#define CM_L4PER_I2C1_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x94a0) -+#define CM_L4PER_I2C2_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x94a8) -+#define CM_L4PER_I2C3_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x94b0) -+#define CM_L4PER_I2C4_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x94b8) -+#define CM_L4PER_L4PER_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x94c0) -+#define CM_L4PER_MCASP2_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x94d0) -+#define CM_L4PER_MCASP3_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x94d8) -+#define CM_L4PER_MCBSP4_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x94e0) -+#define CM_L4PER_MGATE_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x94e8) -+#define CM_L4PER_MCSPI1_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x94f0) -+#define CM_L4PER_MCSPI2_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x94f8) -+#define CM_L4PER_MCSPI3_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x9500) -+#define CM_L4PER_MCSPI4_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x9508) -+#define CM_L4PER_MMCSD3_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x9520) -+#define CM_L4PER_MMCSD4_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x9528) -+#define CM_L4PER_MSPROHG_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x9530) -+#define CM_L4PER_SLIMBUS2_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x9538) -+#define CM_L4PER_UART1_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x9540) -+#define CM_L4PER_UART2_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x9548) -+#define CM_L4PER_UART3_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x9550) -+#define CM_L4PER_UART4_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x9558) -+#define CM_L4PER_MMCSD5_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x9560) -+#define CM_L4PER_I2C5_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x9568) -+#define CM_L4SEC_CLKSTCTRL (OMAP44XX_L4_CORE_BASE + 0x9580) -+#define CM_L4SEC_STATICDEP (OMAP44XX_L4_CORE_BASE + 0x9584) -+#define CM_L4SEC_DYNAMICDEP (OMAP44XX_L4_CORE_BASE + 0x9588) -+#define CM_L4SEC_AES1_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x95a0) -+#define CM_L4SEC_AES2_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x95a8) -+#define CM_L4SEC_DES3DES_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x95b0) -+#define CM_L4SEC_PKAEIP29_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x95b8) -+#define CM_L4SEC_RNG_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x95c0) -+#define CM_L4SEC_SHA2MD51_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x95c8) -+#define CM_L4SEC_CRYPTODMA_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x95d8) -+ -+/* CM2.IVAHD */ -+#define CM_IVAHD_CLKSTCTRL (OMAP44XX_L4_CORE_BASE + 0x8f00) -+#define CM_IVAHD_IVAHD_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x8f20) -+#define CM_IVAHD_SL2_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x8f28) -+ -+/* CM2.L3INIT */ -+#define CM_L3INIT_HSMMC1_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x9328) -+#define CM_L3INIT_HSMMC2_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x9330) -+#define CM_L3INIT_HSI_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x9338) -+#define CM_L3INIT_HSUSBHOST_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x9358) -+#define CM_L3INIT_HSUSBOTG_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x9360) -+#define CM_L3INIT_HSUSBTLL_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x9368) -+#define CM_L3INIT_P1500_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x9378) -+#define CM_L3INIT_FSUSB_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x93d0) -+#define CM_L3INIT_USBPHY_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x93e0) -+ -+/* CM2.CAM */ -+#define CM_CAM_CLKSTCTRL (OMAP44XX_L4_CORE_BASE + 0x9000) -+#define CM_CAM_ISS_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x9020) -+#define CM_CAM_FDIF_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x9028) -+ -+/* CM2.DSS */ -+#define CM_DSS_CLKSTCTRL (OMAP44XX_L4_CORE_BASE + 0x9100) -+#define CM_DSS_DSS_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x9120) -+ -+/* CM2.SGX */ -+#define CM_SGX_CLKSTCTRL (OMAP44XX_L4_CORE_BASE + 0x9200) -+#define CM_SGX_SGX_CLKCTRL (OMAP44XX_L4_CORE_BASE + 0x9220) -+ -+/* DPLL register offsets */ -+#define CM_CLKMODE_DPLL 0 -+#define CM_IDLEST_DPLL 0x4 -+#define CM_AUTOIDLE_DPLL 0x8 -+#define CM_CLKSEL_DPLL 0xC -+#define CM_DIV_M2_DPLL 0x10 -+#define CM_DIV_M3_DPLL 0x14 -+#define CM_DIV_M4_DPLL 0x18 -+#define CM_DIV_M5_DPLL 0x1C -+#define CM_DIV_M6_DPLL 0x20 -+#define CM_DIV_M7_DPLL 0x24 -+ -+#define DPLL_CLKOUT_DIV_MASK 0x1F /* post-divider mask */ -+ -+/* CM_CLKMODE_DPLL */ -+#define CM_CLKMODE_DPLL_DPLL_REGM4XEN_MASK 11 -+#define CM_CLKMODE_DPLL_DPLL_EN_SHIFT 0 -+#define CM_CLKMODE_DPLL_DPLL_EN_SHIFT 0 -+#define CM_CLKMODE_DPLL_DPLL_EN_MASK 7 -+ -+#define DPLL_EN_STOP 1 -+#define DPLL_EN_MN_BYPASS 4 -+#define DPLL_EN_LOW_POWER_BYPASS 5 -+#define DPLL_EN_FAST_RELOCK_BYPASS 6 -+#define DPLL_EN_LOCK 7 -+ -+/* CM_IDLEST_DPLL fields */ -+#define ST_DPLL_CLK_MASK 1 -+ -+/* CM_CLKSEL_DPLL */ -+#define CM_CLKSEL_DPLL_DPLL_SD_DIV_SHIFT 24 -+#define CM_CLKSEL_DPLL_DPLL_SD_DIV_MASK (0xFF << 24) -+#define CM_CLKSEL_DPLL_M_SHIFT 8 -+#define CM_CLKSEL_DPLL_M_MASK (0x7FF << 8) -+#define CM_CLKSEL_DPLL_N_SHIFT 0 -+#define CM_CLKSEL_DPLL_N_MASK 0x7F -+ -+#define OMAP4_DPLL_MAX_N 127 -+ -+/* CM_SYS_CLKSEL */ -+#define CM_SYS_CLKSEL_SYS_CLKSEL_MASK 7 -+ -+/* CM_CLKSEL_CORE */ -+#define CLKSEL_CORE_SHIFT 0 -+#define CLKSEL_L3_SHIFT 4 -+#define CLKSEL_L4_SHIFT 8 -+ -+#define CLKSEL_CORE_X2_DIV_1 0 -+#define CLKSEL_L3_CORE_DIV_2 1 -+#define CLKSEL_L4_L3_DIV_2 1 -+ -+/* CM_ABE_PLL_REF_CLKSEL */ -+#define CM_ABE_PLL_REF_CLKSEL_CLKSEL_SHIFT 0 -+#define CM_ABE_PLL_REF_CLKSEL_CLKSEL_MASK 1 -+#define CM_ABE_PLL_REF_CLKSEL_CLKSEL_SYSCLK 0 -+#define CM_ABE_PLL_REF_CLKSEL_CLKSEL_32KCLK 1 -+ -+ -+/* CM_SHADOW_FREQ_CONFIG1 */ -+#define SHADOW_FREQ_CONFIG1_FREQ_UPDATE_MASK 1 -+#define SHADOW_FREQ_CONFIG1_DLL_OVERRIDE_MASK 4 -+#define SHADOW_FREQ_CONFIG1_DLL_RESET_MASK 8 -+ -+#define SHADOW_FREQ_CONFIG1_DPLL_EN_SHIFT 8 -+#define SHADOW_FREQ_CONFIG1_DPLL_EN_MASK (7 << 8) -+ -+#define SHADOW_FREQ_CONFIG1_M2_DIV_SHIFT 11 -+#define SHADOW_FREQ_CONFIG1_M2_DIV_MASK (0x1F << 11) -+ -+/*CM_<clock_domain>__CLKCTRL */ -+#define CD_CLKCTRL_CLKTRCTRL_SHIFT 0 -+#define CD_CLKCTRL_CLKTRCTRL_MASK 3 -+ -+#define CD_CLKCTRL_CLKTRCTRL_NO_SLEEP 0 -+#define CD_CLKCTRL_CLKTRCTRL_SW_SLEEP 1 -+#define CD_CLKCTRL_CLKTRCTRL_SW_WKUP 2 -+#define CD_CLKCTRL_CLKTRCTRL_HW_AUTO 3 -+ -+ -+/* CM_<clock_domain>_<module>_CLKCTRL */ -+#define MODULE_CLKCTRL_MODULEMODE_SHIFT 0 -+#define MODULE_CLKCTRL_MODULEMODE_MASK 3 -+#define MODULE_CLKCTRL_IDLEST_SHIFT 16 -+#define MODULE_CLKCTRL_IDLEST_MASK (3 << 16) -+ -+#define MODULE_CLKCTRL_MODULEMODE_SW_DISABLE 0 -+#define MODULE_CLKCTRL_MODULEMODE_HW_AUTO 1 -+#define MODULE_CLKCTRL_MODULEMODE_SW_EXPLICIT_EN 2 -+ -+#define MODULE_CLKCTRL_IDLEST_FULLY_FUNCTIONAL 0 -+#define MODULE_CLKCTRL_IDLEST_TRANSITIONING 1 -+#define MODULE_CLKCTRL_IDLEST_IDLE 2 -+#define MODULE_CLKCTRL_IDLEST_DISABLED 3 -+ -+/* CM_L4PER_GPIO4_CLKCTRL */ -+#define GPIO4_CLKCTRL_OPTFCLKEN_SHIFT 8 -+ -+/* CM_L3INIT_HSMMCn_CLKCTRL */ -+#define HSMMC_CLKCTRL_CLKSEL_SHIFT 24 -+ -+/* CM_WKUP_GPTIMER1_CLKCTRL */ -+#define GPTIMER1_CLKCTRL_CLKSEL_SHIFT 24 -+ -+/* CM_CAM_ISS_CLKCTRL */ -+#define ISS_CLKCTRL_OPTFCLKEN_SHIFT 8 -+ -+/* CM_DSS_DSS_CLKCTRL */ -+#define DSS_CLKCTRL_OPTFCLKEN_MASK 0xF00 -+ -+/* CM_L3INIT_USBPHY_CLKCTRL */ -+#define USBPHY_CLKCTRL_OPTFCLKEN_PHY_48M_MASK 8 -+ -+/* Clock frequencies */ -+#define OMAP_SYS_CLK_FREQ_38_4_MHZ 38400000 -+#define OMAP_32K_CLK_FREQ 32768 -+ -+/* PRM_VC_CFG_I2C_CLK */ -+#define PRM_VC_CFG_I2C_CLK_SCLH_SHIFT 0 -+#define PRM_VC_CFG_I2C_CLK_SCLH_MASK 0xFF -+#define PRM_VC_CFG_I2C_CLK_SCLL_SHIFT 8 -+#define PRM_VC_CFG_I2C_CLK_SCLL_MASK (0xFF << 8) -+ -+/* PRM_VC_VAL_BYPASS */ -+#define PRM_VC_I2C_CHANNEL_FREQ_KHZ 400 -+ -+#define PRM_VC_VAL_BYPASS_VALID_BIT 0x1000000 -+#define PRM_VC_VAL_BYPASS_SLAVEADDR_SHIFT 0 -+#define PRM_VC_VAL_BYPASS_SLAVEADDR_MASK 0x7F -+#define PRM_VC_VAL_BYPASS_REGADDR_SHIFT 8 -+#define PRM_VC_VAL_BYPASS_REGADDR_MASK 0xFF -+#define PRM_VC_VAL_BYPASS_DATA_SHIFT 16 -+#define PRM_VC_VAL_BYPASS_DATA_MASK 0xFF -+ -+#define SMPS_I2C_SLAVE_ADDR 0x12 -+#define SMPS_REG_ADDR_VCORE1 0x55 -+#define SMPS_REG_ADDR_VCORE2 0x5B -+#define SMPS_REG_ADDR_VCORE3 0x61 -+ -+#define SMPS_VOLT_1_0000_V 0x21 -+#define SMPS_VOLT_1_0125_V 0x22 -+#define SMPS_VOLT_1_0250_V 0x23 -+#define SMPS_VOLT_1_0375_V 0x24 -+#define SMPS_VOLT_1_0500_V 0x25 -+#define SMPS_VOLT_1_0625_V 0x26 -+#define SMPS_VOLT_1_0750_V 0x27 -+#define SMPS_VOLT_1_0875_V 0x28 -+#define SMPS_VOLT_1_1000_V 0x29 -+#define SMPS_VOLT_1_1125_V 0x2A -+#define SMPS_VOLT_1_1250_V 0x2B -+#define SMPS_VOLT_1_1375_V 0x2C -+#define SMPS_VOLT_1_1500_V 0x2D -+#define SMPS_VOLT_1_1625_V 0x2E -+#define SMPS_VOLT_1_1750_V 0x2F -+#define SMPS_VOLT_1_1875_V 0x30 -+#define SMPS_VOLT_1_2000_V 0x31 -+#define SMPS_VOLT_1_2125_V 0x32 -+#define SMPS_VOLT_1_2250_V 0x33 -+#define SMPS_VOLT_1_2375_V 0x34 -+#define SMPS_VOLT_1_2500_V 0x35 -+#define SMPS_VOLT_1_2625_V 0x36 -+#define SMPS_VOLT_1_2750_V 0x37 -+#define SMPS_VOLT_1_2875_V 0x38 -+#define SMPS_VOLT_1_3000_V 0x39 -+#define SMPS_VOLT_1_3500_V 0x3A -+#define SMPS_VOLT_1_5000_V 0x3B -+#define SMPS_VOLT_1_5000_V 0x3B -+ -+/* Defines for DPLL setup */ -+#define DPLL_LOCKED_FREQ_TOLERANCE_0 0 -+#define DPLL_LOCKED_FREQ_TOLERANCE_500_KHZ 500 -+#define DPLL_LOCKED_FREQ_TOLERANCE_1_MHZ 1000 -+ -+#define CONFIGURE_NO_LOCK 0 -+#define CONFIGURE_AND_LOCK 1 -+ -+struct dpll_regs { -+ u32 cm_clkmode_dpll; -+ u32 cm_idlest_dpll; -+ u32 cm_autoidle_dpll; -+ u32 cm_clksel_dpll; -+ u32 cm_div_m2_dpll; -+ u32 cm_div_m3_dpll; -+ u32 cm_div_m4_dpll; -+ u32 cm_div_m5_dpll; -+ u32 cm_div_m6_dpll; -+ u32 cm_div_m7_dpll; -+}; -+ -+/* DPLL parameter table */ -+struct dpll_params { -+ s32 m; -+ s32 n; -+ u32 locked_freq_khz; -+ s32 m2; -+ s32 m3; -+ s32 m4; -+ s32 m5; -+ s32 m6; -+ s32 m7; -+}; -+ -+#endif /* _CLOCKS_OMAP4_H_ */ -diff --git a/arch/arm/include/asm/arch-omap4/sys_proto.h b/arch/arm/include/asm/arch-omap4/sys_proto.h -index 33a1666..fd21afd 100644 ---- a/arch/arm/include/asm/arch-omap4/sys_proto.h -+++ b/arch/arm/include/asm/arch-omap4/sys_proto.h -@@ -39,6 +39,12 @@ void set_muxconf_regs_non_essential(void); - void sr32(void *, u32, u32, u32); - u32 wait_on_value(u32, u32, void *, u32); - void sdelay(unsigned long); -+void prcm_init(void); -+void bypass_dpll(u32 base); -+void freq_update_core(void); -+u32 get_syc_clk_freq(void); -+u32 omap4_ddr_clk(void); -+u32 omap4_revision(void); - - static inline u32 running_from_sdram(void) - { -diff --git a/arch/arm/include/asm/omap_common.h b/arch/arm/include/asm/omap_common.h -index 50247af..49daa85 100644 ---- a/arch/arm/include/asm/omap_common.h -+++ b/arch/arm/include/asm/omap_common.h -@@ -25,6 +25,9 @@ - #ifndef _OMAP_COMMON_H_ - #define _OMAP_COMMON_H_ - -+/* Max value for DPLL multiplier M */ -+#define OMAP_DPLL_MAX_N 127 -+ - /* extract a bit field from a bit vector */ - #define get_bit_field(nr, start, mask)\ - (((nr) & (mask)) >> (start)) -diff --git a/spl/board/ti/sdp4430/Makefile b/spl/board/ti/sdp4430/Makefile -index 6a6aa42..40e3e79 100644 ---- a/spl/board/ti/sdp4430/Makefile -+++ b/spl/board/ti/sdp4430/Makefile -@@ -115,8 +115,12 @@ $(obj)board.c:$(obj)omap4_mux_data.h - @rm -f $@ - @ln -s $(TOPDIR)/arch/arm/cpu/armv7/omap4/board.c $@ - -+$(obj)clocks.c: -+ @rm -f $@ -+ @ln -s $(TOPDIR)/arch/arm/cpu/armv7/omap4/clocks.c $@ -+ - SOBJS += lowlevel_init.o --COBJS += board.o -+COBJS += board.o clocks.o - - # rules - LDPPFLAGS += -include $(TOPDIR)/include/config.h --- -1.7.2.3 - diff --git a/packages/tools/u-boot/patches/2011.03-rc1/u-boot-2011.03-rc1-0016-omap4-add-sdram-init-support.patch b/packages/tools/u-boot/patches/2011.03-rc1/u-boot-2011.03-rc1-0016-omap4-add-sdram-init-support.patch deleted file mode 100644 index 40d85ac0bee..00000000000 --- a/packages/tools/u-boot/patches/2011.03-rc1/u-boot-2011.03-rc1-0016-omap4-add-sdram-init-support.patch +++ /dev/null @@ -1,1272 +0,0 @@ -From c978b5c00d5b6c19364a171c9c44a65bc0c96c59 Mon Sep 17 00:00:00 2001 -From: Aneesh V <aneesh@ti.com> -Date: Fri, 25 Feb 2011 16:30:28 +0530 -Subject: [PATCH 16/22] omap4: add sdram init support - -Add support for the SDRAM controller (EMIF). - -Signed-off-by: Aneesh V <aneesh@ti.com> ---- - arch/arm/cpu/armv7/omap4/Makefile | 3 + - arch/arm/cpu/armv7/omap4/board.c | 2 +- - arch/arm/cpu/armv7/omap4/emif.c | 281 +++++++++++ - arch/arm/cpu/armv7/omap4/sdram_elpida.c | 118 +++++ - arch/arm/include/asm/arch-omap4/emif.h | 719 +++++++++++++++++++++++++++ - arch/arm/include/asm/arch-omap4/omap4.h | 11 + - arch/arm/include/asm/arch-omap4/sys_proto.h | 1 + - include/configs/omap4_sdp4430.h | 5 - - spl/board/ti/sdp4430/Makefile | 10 +- - 9 files changed, 1143 insertions(+), 7 deletions(-) - create mode 100644 arch/arm/cpu/armv7/omap4/emif.c - create mode 100644 arch/arm/cpu/armv7/omap4/sdram_elpida.c - create mode 100644 arch/arm/include/asm/arch-omap4/emif.h - -diff --git a/arch/arm/cpu/armv7/omap4/Makefile b/arch/arm/cpu/armv7/omap4/Makefile -index 6154e86..d9714fe 100644 ---- a/arch/arm/cpu/armv7/omap4/Makefile -+++ b/arch/arm/cpu/armv7/omap4/Makefile -@@ -31,6 +31,9 @@ COBJS += board.o - COBJS += mem.o - COBJS += sys_info.o - COBJS += clocks.o -+COBJS += emif.o -+COBJS += sdram_elpida.o -+ - - SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) - OBJS := $(addprefix $(obj),$(COBJS) $(SOBJS)) -diff --git a/arch/arm/cpu/armv7/omap4/board.c b/arch/arm/cpu/armv7/omap4/board.c -index 62a59ad..89b1213 100644 ---- a/arch/arm/cpu/armv7/omap4/board.c -+++ b/arch/arm/cpu/armv7/omap4/board.c -@@ -109,6 +109,7 @@ void s_init(void) - #ifdef CONFIG_PRELOADER - preloader_console_init(); - #endif -+ sdram_init(); - } - - /* -@@ -169,7 +170,6 @@ u32 sdram_size(void) - */ - int dram_init(void) - { -- - gd->ram_size = sdram_size(); - - return 0; -diff --git a/arch/arm/cpu/armv7/omap4/emif.c b/arch/arm/cpu/armv7/omap4/emif.c -new file mode 100644 -index 0000000..ee77743 ---- /dev/null -+++ b/arch/arm/cpu/armv7/omap4/emif.c -@@ -0,0 +1,281 @@ -+/* -+ * EMIF programming -+ * -+ * (C) Copyright 2010 -+ * Texas Instruments, <www.ti.com> -+ * -+ * Aneesh V <aneesh@ti.com> -+ * -+ * See file CREDITS for list of people who contributed to this -+ * project. -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License as -+ * published by the Free Software Foundation; either version 2 of -+ * the License, or (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+ * MA 02111-1307 USA -+ */ -+ -+#include <common.h> -+#include <asm/arch/emif.h> -+#include <asm/arch/clocks.h> -+#include <asm/arch/sys_proto.h> -+#include <asm/omap_common.h> -+ -+static inline u32 emif_num(u32 base) -+{ -+ if (base == OMAP44XX_EMIF1) -+ return 1; -+ else if (base == OMAP44XX_EMIF2) -+ return 2; -+ else -+ return 0; -+} -+ -+static inline u32 get_mr(u32 base, u32 cs, u32 mr_addr) -+{ -+ u32 mr; -+ struct emif_reg_struct *emif = (struct emif_reg_struct *)base; -+ -+ mr_addr |= cs << OMAP44XX_REG_CS_SHIFT; -+ writel(mr_addr, &emif->emif_lpddr2_mode_reg_cfg); -+ if (omap4_revision() == OMAP4430_ES2_0) -+ mr = readl(&emif->emif_lpddr2_mode_reg_data_es2); -+ else -+ mr = readl(&emif->emif_lpddr2_mode_reg_data); -+ debug("get_mr: EMIF%d cs %d mr %08x val 0x%x\n", emif_num(base), -+ cs, mr_addr, mr); -+ return mr; -+} -+ -+static inline void set_mr(u32 base, u32 cs, u32 mr_addr, u32 mr_val) -+{ -+ struct emif_reg_struct *emif = (struct emif_reg_struct *)base; -+ -+ mr_addr |= cs << OMAP44XX_REG_CS_SHIFT; -+ writel(mr_addr, &emif->emif_lpddr2_mode_reg_cfg); -+ writel(mr_val, &emif->emif_lpddr2_mode_reg_data); -+} -+void emif_reset_phy(u32 base) -+{ -+ struct emif_reg_struct *emif = (struct emif_reg_struct *)base; -+ u32 iodft; -+ -+ iodft = readl(&emif->emif_iodft_tlgc); -+ iodft |= OMAP44XX_REG_RESET_PHY_MASK; -+ writel(iodft, &emif->emif_iodft_tlgc); -+} -+ -+static void do_lpddr2_init(u32 base, u32 cs) -+{ -+ u32 mr_addr; -+ -+ /* Wait till device auto initialization is complete */ -+ while (get_mr(base, cs, LPDDR2_MR0) & LPDDR2_MR0_DAI_MASK) -+ ; -+ set_mr(base, cs, LPDDR2_MR10, MR10_ZQ_ZQINIT); -+ sdelay(10); -+ set_mr(base, cs, LPDDR2_MR1, MR1_BL_8_BT_SEQ_WRAP_EN_NWR_3); -+ set_mr(base, cs, LPDDR2_MR16, MR16_REF_FULL_ARRAY); -+ /* -+ * Enable refresh along with writing MR2 -+ * Encoding of RL in MR2 is (RL - 2) -+ */ -+ mr_addr = LPDDR2_MR2 | OMAP44XX_REG_REFRESH_EN_MASK; -+ set_mr(base, cs, mr_addr, RL_FINAL - 2); -+} -+ -+static void lpddr2_init(u32 base, const struct emif_regs *regs) -+{ -+ struct emif_reg_struct *emif = (struct emif_reg_struct *)base; -+ u32 nvm; -+ -+ /* Not NVM */ -+ nvm = readl(&emif->emif_lpddr2_nvm_config); -+ nvm &= (~OMAP44XX_REG_CS1NVMEN_MASK); -+ writel(nvm, &emif->emif_lpddr2_nvm_config); -+ /* -+ * Set the SDRAM_CONFIG and PHY_CTRL for the -+ * un-locked frequency & default RL -+ */ -+ writel(regs->sdram_config_init, &emif->emif_sdram_config); -+ writel(regs->emif_ddr_phy_ctlr_1_init, &emif->emif_ddr_phy_ctrl_1); -+ -+ do_lpddr2_init(base, CS0); -+ if (regs->sdram_config & OMAP44XX_REG_EBANK_MASK) -+ do_lpddr2_init(base, CS1); -+ -+ writel(regs->sdram_config, &emif->emif_sdram_config); -+ writel(regs->emif_ddr_phy_ctlr_1, &emif->emif_ddr_phy_ctrl_1); -+} -+ -+static void emif_update_timings(u32 base, const struct emif_regs *regs) -+{ -+ struct emif_reg_struct *emif = (struct emif_reg_struct *)base; -+ -+ writel(regs->ref_ctrl, &emif->emif_sdram_ref_ctrl_shdw); -+ writel(regs->sdram_tim1, &emif->emif_sdram_tim_1_shdw); -+ writel(regs->sdram_tim2, &emif->emif_sdram_tim_2_shdw); -+ writel(regs->sdram_tim3, &emif->emif_sdram_tim_3_shdw); -+ if (omap4_revision() == OMAP4430_ES1_0) { -+ /* ES1 bug EMIF should be in force idle during freq_update */ -+ writel(0, &emif->emif_pwr_mgmt_ctrl); -+ } else { -+ writel(EMIF_PWR_MGMT_CTRL, &emif->emif_pwr_mgmt_ctrl); -+ writel(EMIF_PWR_MGMT_CTRL_SHDW, &emif->emif_pwr_mgmt_ctrl_shdw); -+ } -+ writel(regs->read_idle_ctrl, &emif->emif_read_idlectrl_shdw); -+ writel(regs->zq_config, &emif->emif_zq_config); -+ writel(regs->temp_alert_config, &emif->emif_temp_alert_config); -+ writel(regs->emif_ddr_phy_ctlr_1, &emif->emif_ddr_phy_ctrl_1_shdw); -+ /* -+ * Workaround: -+ * In a specific situation, the OCP interface between the DMM and -+ * EMIF may hang. -+ * 1. A TILER port is used to perform 2D burst writes of -+ * width 1 and height 8 -+ * 2. ELLAn port is used to perform reads -+ * 3. All accesses are routed to the same EMIF controller -+ * -+ * Work around to avoid this issue REG_SYS_THRESH_MAX value should -+ * be kept higher than default 0x7. As per recommondation 0x0A will -+ * be used for better performance with REG_LL_THRESH_MAX = 0x00 -+ */ -+ if (omap4_revision() == OMAP4430_ES1_0) { -+ writel(EMIF_L3_CONFIG_VAL_SYS_THRESH_0A_LL_THRESH_00, -+ &emif->emif_l3_config); -+ } -+} -+ -+static void do_sdram_init(u32 base) -+{ -+ const struct emif_regs *regs, *tmp_regs; -+ u32 in_sdram, emif_nr; -+ -+ in_sdram = running_from_sdram(); -+ emif_nr = (base == OMAP44XX_EMIF1) ? 1 : 2; -+ -+ emif_get_reg_dump(&regs, &tmp_regs); -+ regs = (emif_nr == 1) ? regs : tmp_regs; -+ -+ /* -+ * Initializing the LPDDR2 device can not happen from SDRAM. -+ * Changing the timing registers in EMIF can happen(going from one -+ * OPP to another) -+ */ -+ if (!in_sdram) -+ lpddr2_init(base, regs); -+ -+ /* Write to the shadow registers */ -+ emif_update_timings(base, regs); -+} -+ -+void sdram_init_pads(void) -+{ -+ u32 lpddr2io; -+ u32 omap4_rev = omap4_revision(); -+ -+ if (omap4_rev == OMAP4430_ES1_0) -+ lpddr2io = CONTROL_LPDDR2IO_SLEW_125PS_DRV8_PULL_DOWN; -+ else if (omap4_rev == OMAP4430_ES2_0) -+ lpddr2io = CONTROL_LPDDR2IO_SLEW_325PS_DRV8_GATE_KEEPER; -+ else -+ return; /* Post ES2.1 reset values will work */ -+ -+ writel(lpddr2io, CONTROL_LPDDR2IO1_0); -+ writel(lpddr2io, CONTROL_LPDDR2IO1_1); -+ writel(lpddr2io, CONTROL_LPDDR2IO1_2); -+ writel(lpddr2io, CONTROL_LPDDR2IO2_0); -+ writel(lpddr2io, CONTROL_LPDDR2IO2_1); -+ writel(lpddr2io, CONTROL_LPDDR2IO2_2); -+ -+ writel(CONTROL_EFUSE_2_NMOS_PMOS_PTV_CODE_1, CONTROL_EFUSE_2); -+} -+ -+static void emif_post_init_config(u32 base) -+{ -+ struct emif_reg_struct *emif = (struct emif_reg_struct *)base; -+ u32 omap4_rev = omap4_revision(); -+ -+ /* reset phy on ES2.0 */ -+ if (omap4_rev == OMAP4430_ES2_0) -+ emif_reset_phy(base); -+ -+ /* Put EMIF back in smart idle on ES1.0 */ -+ if (omap4_rev == OMAP4430_ES1_0) -+ writel(0x80000000, &emif->emif_pwr_mgmt_ctrl); -+} -+ -+static void dmm_init(u32 base) -+{ -+ const struct dmm_lisa_map_regs *lisa_map_regs; -+ -+ emif_get_dmm_regs(&lisa_map_regs); -+ -+ struct dmm_lisa_map_regs *hw_lisa_map_regs = -+ (struct dmm_lisa_map_regs *)base; -+ -+ writel(0, &hw_lisa_map_regs->dmm_lisa_map_3); -+ writel(0, &hw_lisa_map_regs->dmm_lisa_map_2); -+ writel(0, &hw_lisa_map_regs->dmm_lisa_map_1); -+ writel(0, &hw_lisa_map_regs->dmm_lisa_map_0); -+ -+ writel(lisa_map_regs->dmm_lisa_map_3, -+ &hw_lisa_map_regs->dmm_lisa_map_3); -+ writel(lisa_map_regs->dmm_lisa_map_2, -+ &hw_lisa_map_regs->dmm_lisa_map_2); -+ writel(lisa_map_regs->dmm_lisa_map_1, -+ &hw_lisa_map_regs->dmm_lisa_map_1); -+ writel(lisa_map_regs->dmm_lisa_map_0, -+ &hw_lisa_map_regs->dmm_lisa_map_0); -+} -+ -+/* -+ * SDRAM initialization: -+ * SDRAM initialization has two parts: -+ * 1. Configuring the SDRAM device -+ * 2. Update the AC timings related parameters in the EMIF module -+ * (1) should be done only once and should not be done while we are -+ * running from SDRAM. -+ * (2) can and should be done more than once if OPP changes. -+ * Particularly, this may be needed when we boot without SPL and -+ * and using Configuration Header(CH). ROM code supports only at 50% OPP -+ * at boot (low power boot). So u-boot has to switch to OPP100 and update -+ * the frequency. So, -+ * Doing (1) and (2) makes sense - first time initialization -+ * Doing (2) and not (1) makes sense - OPP change (when using CH) -+ * Doing (1) and not (2) doen't make sense -+ * See do_sdram_init() for the details -+ */ -+void sdram_init(void) -+{ -+ u32 in_sdram; -+ -+ in_sdram = running_from_sdram(); -+ -+ if (!in_sdram) { -+ sdram_init_pads(); -+ bypass_dpll(CM_CLKMODE_DPLL_CORE); -+ } -+ -+ do_sdram_init(OMAP44XX_EMIF1); -+ do_sdram_init(OMAP44XX_EMIF2); -+ -+ if (!in_sdram) { -+ dmm_init(OMAP44XX_DMM_LISA_MAP_BASE); -+ emif_post_init_config(OMAP44XX_EMIF1); -+ emif_post_init_config(OMAP44XX_EMIF2); -+ } -+ -+ /* for the shadow registers to take effect */ -+ freq_update_core(); -+} -diff --git a/arch/arm/cpu/armv7/omap4/sdram_elpida.c b/arch/arm/cpu/armv7/omap4/sdram_elpida.c -new file mode 100644 -index 0000000..37e808c ---- /dev/null -+++ b/arch/arm/cpu/armv7/omap4/sdram_elpida.c -@@ -0,0 +1,118 @@ -+/* -+ * Timing and Organization details of the Elpida parts used in OMAP4 -+ * SDPs and Panda -+ * -+ * (C) Copyright 2010 -+ * Texas Instruments, <www.ti.com> -+ * -+ * Aneesh V <aneesh@ti.com> -+ * -+ * See file CREDITS for list of people who contributed to this -+ * project. -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License as -+ * published by the Free Software Foundation; either version 2 of -+ * the License, or (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+ * MA 02111-1307 USA -+ */ -+ -+#include <asm/arch/emif.h> -+#include <asm/arch/sys_proto.h> -+ -+static const struct emif_regs emif_regs_elpida_200_mhz_2cs = { -+ .sdram_config_init = 0x80000eb9, -+ .sdram_config = 0x80001ab9, -+ .ref_ctrl = 0x0000030c, -+ .sdram_tim1 = 0x08648311, -+ .sdram_tim2 = 0x101b06ca, -+ .sdram_tim3 = 0x0048a19f, -+ .read_idle_ctrl = 0x000501ff, -+ .zq_config = 0x500b3214, -+ .temp_alert_config = 0xd8016893, -+ .emif_ddr_phy_ctlr_1_init = 0x049ffff5, -+ .emif_ddr_phy_ctlr_1 = 0x049ff808 -+}; -+ -+static const struct emif_regs emif_regs_elpida_380_mhz_1cs = { -+ .sdram_config_init = 0x80000eb1, -+ .sdram_config = 0x80001ab1, -+ .ref_ctrl = 0x000005cd, -+ .sdram_tim1 = 0x10cb0622, -+ .sdram_tim2 = 0x20350d52, -+ .sdram_tim3 = 0x00b1431f, -+ .read_idle_ctrl = 0x000501ff, -+ .zq_config = 0x500b3214, -+ .temp_alert_config = 0x58016893, -+ .emif_ddr_phy_ctlr_1_init = 0x049ffff5, -+ .emif_ddr_phy_ctlr_1 = 0x049ff418 -+}; -+ -+const struct emif_regs emif_regs_elpida_400_mhz_2cs = { -+ .sdram_config_init = 0x80000eb9, -+ .sdram_config = 0x80001ab9, -+ .ref_ctrl = 0x00000618, -+ .sdram_tim1 = 0x10eb0662, -+ .sdram_tim2 = 0x20370dd2, -+ .sdram_tim3 = 0x00b1c33f, -+ .read_idle_ctrl = 0x000501ff, -+ .zq_config = 0xd00b3214, -+ .temp_alert_config = 0xd8016893, -+ .emif_ddr_phy_ctlr_1_init = 0x049ffff5, -+ .emif_ddr_phy_ctlr_1 = 0x049ff418 -+}; -+const struct dmm_lisa_map_regs lisa_map_2G_x_1_x_2 = { -+ .dmm_lisa_map_0 = 0xFF020100, -+ .dmm_lisa_map_1 = 0, -+ .dmm_lisa_map_2 = 0, -+ .dmm_lisa_map_3 = 0x80540300 -+}; -+ -+const struct dmm_lisa_map_regs lisa_map_2G_x_2_x_2 = { -+ .dmm_lisa_map_0 = 0xFF020100, -+ .dmm_lisa_map_1 = 0, -+ .dmm_lisa_map_2 = 0, -+ .dmm_lisa_map_3 = 0x80640300 -+}; -+ -+void emif_get_reg_dump_sdp(const struct emif_regs **emif1_regs, -+ const struct emif_regs **emif2_regs) -+{ -+ u32 omap4_rev = omap4_revision(); -+ -+ if (omap4_rev == OMAP4430_ES1_0) { -+ *emif1_regs = &emif_regs_elpida_380_mhz_1cs; -+ *emif2_regs = &emif_regs_elpida_380_mhz_1cs; -+ } else if (omap4_rev == OMAP4430_ES2_0) { -+ *emif1_regs = &emif_regs_elpida_200_mhz_2cs; -+ *emif2_regs = &emif_regs_elpida_200_mhz_2cs; -+ } else { -+ *emif1_regs = &emif_regs_elpida_400_mhz_2cs; -+ *emif2_regs = &emif_regs_elpida_400_mhz_2cs; -+ } -+} -+void emif_get_reg_dump(const struct emif_regs **emif1_regs, -+ const struct emif_regs **emif2_regs) -+ __attribute__((weak, alias("emif_get_reg_dump_sdp"))); -+ -+void emif_get_dmm_regs_sdp(const struct dmm_lisa_map_regs **dmm_lisa_regs) -+{ -+ u32 omap_rev = omap4_revision(); -+ -+ if (omap_rev == OMAP4430_ES1_0) -+ *dmm_lisa_regs = &lisa_map_2G_x_1_x_2; -+ else -+ *dmm_lisa_regs = &lisa_map_2G_x_2_x_2; -+} -+ -+void emif_get_dmm_regs(const struct dmm_lisa_map_regs **dmm_lisa_regs) -+ __attribute__((weak, alias("emif_get_dmm_regs_sdp"))); -diff --git a/arch/arm/include/asm/arch-omap4/emif.h b/arch/arm/include/asm/arch-omap4/emif.h -new file mode 100644 -index 0000000..f2d54cb ---- /dev/null -+++ b/arch/arm/include/asm/arch-omap4/emif.h -@@ -0,0 +1,719 @@ -+/* -+ * OMAP44xx EMIF header -+ * -+ * Copyright (C) 2009-2010 Texas Instruments, Inc. -+ * -+ * Aneesh V <aneesh@ti.com> -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 as -+ * published by the Free Software Foundation. -+ */ -+ -+#ifndef _EMIF_H_ -+#define _EMIF_H_ -+#include <asm/types.h> -+#include <common.h> -+ -+/* Base address */ -+#define OMAP44XX_EMIF1 0x4c000000 -+#define OMAP44XX_EMIF2 0x4d000000 -+ -+/* Registers shifts and masks */ -+ -+/* EMIF_MOD_ID_REV */ -+#define OMAP44XX_REG_SCHEME_SHIFT 30 -+#define OMAP44XX_REG_SCHEME_MASK (0x3 << 30) -+#define OMAP44XX_REG_MODULE_ID_SHIFT 16 -+#define OMAP44XX_REG_MODULE_ID_MASK (0xfff << 16) -+#define OMAP44XX_REG_RTL_VERSION_SHIFT 11 -+#define OMAP44XX_REG_RTL_VERSION_MASK (0x1f << 11) -+#define OMAP44XX_REG_MAJOR_REVISION_SHIFT 8 -+#define OMAP44XX_REG_MAJOR_REVISION_MASK (0x7 << 8) -+#define OMAP44XX_REG_MINOR_REVISION_SHIFT 0 -+#define OMAP44XX_REG_MINOR_REVISION_MASK (0x3f << 0) -+ -+/* STATUS */ -+#define OMAP44XX_REG_BE_SHIFT 31 -+#define OMAP44XX_REG_BE_MASK (1 << 31) -+#define OMAP44XX_REG_DUAL_CLK_MODE_SHIFT 30 -+#define OMAP44XX_REG_DUAL_CLK_MODE_MASK (1 << 30) -+#define OMAP44XX_REG_FAST_INIT_SHIFT 29 -+#define OMAP44XX_REG_FAST_INIT_MASK (1 << 29) -+#define OMAP44XX_REG_PHY_DLL_READY_SHIFT 2 -+#define OMAP44XX_REG_PHY_DLL_READY_MASK (1 << 2) -+ -+/* SDRAM_CONFIG */ -+#define OMAP44XX_REG_SDRAM_TYPE_SHIFT 29 -+#define OMAP44XX_REG_SDRAM_TYPE_MASK (0x7 << 29) -+#define OMAP44XX_REG_IBANK_POS_SHIFT 27 -+#define OMAP44XX_REG_IBANK_POS_MASK (0x3 << 27) -+#define OMAP44XX_REG_DDR_TERM_SHIFT 24 -+#define OMAP44XX_REG_DDR_TERM_MASK (0x7 << 24) -+#define OMAP44XX_REG_DDR2_DDQS_SHIFT 23 -+#define OMAP44XX_REG_DDR2_DDQS_MASK (1 << 23) -+#define OMAP44XX_REG_DYN_ODT_SHIFT 21 -+#define OMAP44XX_REG_DYN_ODT_MASK (0x3 << 21) -+#define OMAP44XX_REG_DDR_DISABLE_DLL_SHIFT 20 -+#define OMAP44XX_REG_DDR_DISABLE_DLL_MASK (1 << 20) -+#define OMAP44XX_REG_SDRAM_DRIVE_SHIFT 18 -+#define OMAP44XX_REG_SDRAM_DRIVE_MASK (0x3 << 18) -+#define OMAP44XX_REG_CWL_SHIFT 16 -+#define OMAP44XX_REG_CWL_MASK (0x3 << 16) -+#define OMAP44XX_REG_NARROW_MODE_SHIFT 14 -+#define OMAP44XX_REG_NARROW_MODE_MASK (0x3 << 14) -+#define OMAP44XX_REG_CL_SHIFT 10 -+#define OMAP44XX_REG_CL_MASK (0xf << 10) -+#define OMAP44XX_REG_ROWSIZE_SHIFT 7 -+#define OMAP44XX_REG_ROWSIZE_MASK (0x7 << 7) -+#define OMAP44XX_REG_IBANK_SHIFT 4 -+#define OMAP44XX_REG_IBANK_MASK (0x7 << 4) -+#define OMAP44XX_REG_EBANK_SHIFT 3 -+#define OMAP44XX_REG_EBANK_MASK (1 << 3) -+#define OMAP44XX_REG_PAGESIZE_SHIFT 0 -+#define OMAP44XX_REG_PAGESIZE_MASK (0x7 << 0) -+ -+/* SDRAM_CONFIG_2 */ -+#define OMAP44XX_REG_CS1NVMEN_SHIFT 30 -+#define OMAP44XX_REG_CS1NVMEN_MASK (1 << 30) -+#define OMAP44XX_REG_EBANK_POS_SHIFT 27 -+#define OMAP44XX_REG_EBANK_POS_MASK (1 << 27) -+#define OMAP44XX_REG_RDBNUM_SHIFT 4 -+#define OMAP44XX_REG_RDBNUM_MASK (0x3 << 4) -+#define OMAP44XX_REG_RDBSIZE_SHIFT 0 -+#define OMAP44XX_REG_RDBSIZE_MASK (0x7 << 0) -+ -+/* SDRAM_REF_CTRL */ -+#define OMAP44XX_REG_INITREF_DIS_SHIFT 31 -+#define OMAP44XX_REG_INITREF_DIS_MASK (1 << 31) -+#define OMAP44XX_REG_SRT_SHIFT 29 -+#define OMAP44XX_REG_SRT_MASK (1 << 29) -+#define OMAP44XX_REG_ASR_SHIFT 28 -+#define OMAP44XX_REG_ASR_MASK (1 << 28) -+#define OMAP44XX_REG_PASR_SHIFT 24 -+#define OMAP44XX_REG_PASR_MASK (0x7 << 24) -+#define OMAP44XX_REG_REFRESH_RATE_SHIFT 0 -+#define OMAP44XX_REG_REFRESH_RATE_MASK (0xffff << 0) -+ -+/* SDRAM_REF_CTRL_SHDW */ -+#define OMAP44XX_REG_REFRESH_RATE_SHDW_SHIFT 0 -+#define OMAP44XX_REG_REFRESH_RATE_SHDW_MASK (0xffff << 0) -+ -+/* SDRAM_TIM_1 */ -+#define OMAP44XX_REG_T_RP_SHIFT 25 -+#define OMAP44XX_REG_T_RP_MASK (0xf << 25) -+#define OMAP44XX_REG_T_RCD_SHIFT 21 -+#define OMAP44XX_REG_T_RCD_MASK (0xf << 21) -+#define OMAP44XX_REG_T_WR_SHIFT 17 -+#define OMAP44XX_REG_T_WR_MASK (0xf << 17) -+#define OMAP44XX_REG_T_RAS_SHIFT 12 -+#define OMAP44XX_REG_T_RAS_MASK (0x1f << 12) -+#define OMAP44XX_REG_T_RC_SHIFT 6 -+#define OMAP44XX_REG_T_RC_MASK (0x3f << 6) -+#define OMAP44XX_REG_T_RRD_SHIFT 3 -+#define OMAP44XX_REG_T_RRD_MASK (0x7 << 3) -+#define OMAP44XX_REG_T_WTR_SHIFT 0 -+#define OMAP44XX_REG_T_WTR_MASK (0x7 << 0) -+ -+/* SDRAM_TIM_1_SHDW */ -+#define OMAP44XX_REG_T_RP_SHDW_SHIFT 25 -+#define OMAP44XX_REG_T_RP_SHDW_MASK (0xf << 25) -+#define OMAP44XX_REG_T_RCD_SHDW_SHIFT 21 -+#define OMAP44XX_REG_T_RCD_SHDW_MASK (0xf << 21) -+#define OMAP44XX_REG_T_WR_SHDW_SHIFT 17 -+#define OMAP44XX_REG_T_WR_SHDW_MASK (0xf << 17) -+#define OMAP44XX_REG_T_RAS_SHDW_SHIFT 12 -+#define OMAP44XX_REG_T_RAS_SHDW_MASK (0x1f << 12) -+#define OMAP44XX_REG_T_RC_SHDW_SHIFT 6 -+#define OMAP44XX_REG_T_RC_SHDW_MASK (0x3f << 6) -+#define OMAP44XX_REG_T_RRD_SHDW_SHIFT 3 -+#define OMAP44XX_REG_T_RRD_SHDW_MASK (0x7 << 3) -+#define OMAP44XX_REG_T_WTR_SHDW_SHIFT 0 -+#define OMAP44XX_REG_T_WTR_SHDW_MASK (0x7 << 0) -+ -+/* SDRAM_TIM_2 */ -+#define OMAP44XX_REG_T_XP_SHIFT 28 -+#define OMAP44XX_REG_T_XP_MASK (0x7 << 28) -+#define OMAP44XX_REG_T_ODT_SHIFT 25 -+#define OMAP44XX_REG_T_ODT_MASK (0x7 << 25) -+#define OMAP44XX_REG_T_XSNR_SHIFT 16 -+#define OMAP44XX_REG_T_XSNR_MASK (0x1ff << 16) -+#define OMAP44XX_REG_T_XSRD_SHIFT 6 -+#define OMAP44XX_REG_T_XSRD_MASK (0x3ff << 6) -+#define OMAP44XX_REG_T_RTP_SHIFT 3 -+#define OMAP44XX_REG_T_RTP_MASK (0x7 << 3) -+#define OMAP44XX_REG_T_CKE_SHIFT 0 -+#define OMAP44XX_REG_T_CKE_MASK (0x7 << 0) -+ -+/* SDRAM_TIM_2_SHDW */ -+#define OMAP44XX_REG_T_XP_SHDW_SHIFT 28 -+#define OMAP44XX_REG_T_XP_SHDW_MASK (0x7 << 28) -+#define OMAP44XX_REG_T_ODT_SHDW_SHIFT 25 -+#define OMAP44XX_REG_T_ODT_SHDW_MASK (0x7 << 25) -+#define OMAP44XX_REG_T_XSNR_SHDW_SHIFT 16 -+#define OMAP44XX_REG_T_XSNR_SHDW_MASK (0x1ff << 16) -+#define OMAP44XX_REG_T_XSRD_SHDW_SHIFT 6 -+#define OMAP44XX_REG_T_XSRD_SHDW_MASK (0x3ff << 6) -+#define OMAP44XX_REG_T_RTP_SHDW_SHIFT 3 -+#define OMAP44XX_REG_T_RTP_SHDW_MASK (0x7 << 3) -+#define OMAP44XX_REG_T_CKE_SHDW_SHIFT 0 -+#define OMAP44XX_REG_T_CKE_SHDW_MASK (0x7 << 0) -+ -+/* SDRAM_TIM_3 */ -+#define OMAP44XX_REG_T_CKESR_SHIFT 21 -+#define OMAP44XX_REG_T_CKESR_MASK (0x7 << 21) -+#define OMAP44XX_REG_ZQ_ZQCS_SHIFT 15 -+#define OMAP44XX_REG_ZQ_ZQCS_MASK (0x3f << 15) -+#define OMAP44XX_REG_T_TDQSCKMAX_SHIFT 13 -+#define OMAP44XX_REG_T_TDQSCKMAX_MASK (0x3 << 13) -+#define OMAP44XX_REG_T_RFC_SHIFT 4 -+#define OMAP44XX_REG_T_RFC_MASK (0x1ff << 4) -+#define OMAP44XX_REG_T_RAS_MAX_SHIFT 0 -+#define OMAP44XX_REG_T_RAS_MAX_MASK (0xf << 0) -+ -+/* SDRAM_TIM_3_SHDW */ -+#define OMAP44XX_REG_T_CKESR_SHDW_SHIFT 21 -+#define OMAP44XX_REG_T_CKESR_SHDW_MASK (0x7 << 21) -+#define OMAP44XX_REG_ZQ_ZQCS_SHDW_SHIFT 15 -+#define OMAP44XX_REG_ZQ_ZQCS_SHDW_MASK (0x3f << 15) -+#define OMAP44XX_REG_T_TDQSCKMAX_SHDW_SHIFT 13 -+#define OMAP44XX_REG_T_TDQSCKMAX_SHDW_MASK (0x3 << 13) -+#define OMAP44XX_REG_T_RFC_SHDW_SHIFT 4 -+#define OMAP44XX_REG_T_RFC_SHDW_MASK (0x1ff << 4) -+#define OMAP44XX_REG_T_RAS_MAX_SHDW_SHIFT 0 -+#define OMAP44XX_REG_T_RAS_MAX_SHDW_MASK (0xf << 0) -+ -+/* LPDDR2_NVM_TIM */ -+#define OMAP44XX_REG_NVM_T_XP_SHIFT 28 -+#define OMAP44XX_REG_NVM_T_XP_MASK (0x7 << 28) -+#define OMAP44XX_REG_NVM_T_WTR_SHIFT 24 -+#define OMAP44XX_REG_NVM_T_WTR_MASK (0x7 << 24) -+#define OMAP44XX_REG_NVM_T_RP_SHIFT 20 -+#define OMAP44XX_REG_NVM_T_RP_MASK (0xf << 20) -+#define OMAP44XX_REG_NVM_T_WRA_SHIFT 16 -+#define OMAP44XX_REG_NVM_T_WRA_MASK (0xf << 16) -+#define OMAP44XX_REG_NVM_T_RRD_SHIFT 8 -+#define OMAP44XX_REG_NVM_T_RRD_MASK (0xff << 8) -+#define OMAP44XX_REG_NVM_T_RCDMIN_SHIFT 0 -+#define OMAP44XX_REG_NVM_T_RCDMIN_MASK (0xff << 0) -+ -+/* LPDDR2_NVM_TIM_SHDW */ -+#define OMAP44XX_REG_NVM_T_XP_SHDW_SHIFT 28 -+#define OMAP44XX_REG_NVM_T_XP_SHDW_MASK (0x7 << 28) -+#define OMAP44XX_REG_NVM_T_WTR_SHDW_SHIFT 24 -+#define OMAP44XX_REG_NVM_T_WTR_SHDW_MASK (0x7 << 24) -+#define OMAP44XX_REG_NVM_T_RP_SHDW_SHIFT 20 -+#define OMAP44XX_REG_NVM_T_RP_SHDW_MASK (0xf << 20) -+#define OMAP44XX_REG_NVM_T_WRA_SHDW_SHIFT 16 -+#define OMAP44XX_REG_NVM_T_WRA_SHDW_MASK (0xf << 16) -+#define OMAP44XX_REG_NVM_T_RRD_SHDW_SHIFT 8 -+#define OMAP44XX_REG_NVM_T_RRD_SHDW_MASK (0xff << 8) -+#define OMAP44XX_REG_NVM_T_RCDMIN_SHDW_SHIFT 0 -+#define OMAP44XX_REG_NVM_T_RCDMIN_SHDW_MASK (0xff << 0) -+ -+/* PWR_MGMT_CTRL */ -+#define OMAP44XX_REG_IDLEMODE_SHIFT 30 -+#define OMAP44XX_REG_IDLEMODE_MASK (0x3 << 30) -+#define OMAP44XX_REG_PD_TIM_SHIFT 12 -+#define OMAP44XX_REG_PD_TIM_MASK (0xf << 12) -+#define OMAP44XX_REG_DPD_EN_SHIFT 11 -+#define OMAP44XX_REG_DPD_EN_MASK (1 << 11) -+#define OMAP44XX_REG_LP_MODE_SHIFT 8 -+#define OMAP44XX_REG_LP_MODE_MASK (0x7 << 8) -+#define OMAP44XX_REG_SR_TIM_SHIFT 4 -+#define OMAP44XX_REG_SR_TIM_MASK (0xf << 4) -+#define OMAP44XX_REG_CS_TIM_SHIFT 0 -+#define OMAP44XX_REG_CS_TIM_MASK (0xf << 0) -+ -+/* PWR_MGMT_CTRL_SHDW */ -+#define OMAP44XX_REG_PD_TIM_SHDW_SHIFT 8 -+#define OMAP44XX_REG_PD_TIM_SHDW_MASK (0xf << 8) -+#define OMAP44XX_REG_SR_TIM_SHDW_SHIFT 4 -+#define OMAP44XX_REG_SR_TIM_SHDW_MASK (0xf << 4) -+#define OMAP44XX_REG_CS_TIM_SHDW_SHIFT 0 -+#define OMAP44XX_REG_CS_TIM_SHDW_MASK (0xf << 0) -+ -+/* LPDDR2_MODE_REG_DATA */ -+#define OMAP44XX_REG_VALUE_0_SHIFT 0 -+#define OMAP44XX_REG_VALUE_0_MASK (0x7f << 0) -+ -+/* LPDDR2_MODE_REG_CFG */ -+#define OMAP44XX_REG_CS_SHIFT 31 -+#define OMAP44XX_REG_CS_MASK (1 << 31) -+#define OMAP44XX_REG_REFRESH_EN_SHIFT 30 -+#define OMAP44XX_REG_REFRESH_EN_MASK (1 << 30) -+#define OMAP44XX_REG_ADDRESS_SHIFT 0 -+#define OMAP44XX_REG_ADDRESS_MASK (0xff << 0) -+ -+/* OCP_CONFIG */ -+#define OMAP44XX_REG_SYS_THRESH_MAX_SHIFT 24 -+#define OMAP44XX_REG_SYS_THRESH_MAX_MASK (0xf << 24) -+#define OMAP44XX_REG_LL_THRESH_MAX_SHIFT 16 -+#define OMAP44XX_REG_LL_THRESH_MAX_MASK (0xf << 16) -+#define OMAP44XX_REG_PR_OLD_COUNT_SHIFT 0 -+#define OMAP44XX_REG_PR_OLD_COUNT_MASK (0xff << 0) -+ -+/* OCP_CFG_VAL_1 */ -+#define OMAP44XX_REG_SYS_BUS_WIDTH_SHIFT 30 -+#define OMAP44XX_REG_SYS_BUS_WIDTH_MASK (0x3 << 30) -+#define OMAP44XX_REG_LL_BUS_WIDTH_SHIFT 28 -+#define OMAP44XX_REG_LL_BUS_WIDTH_MASK (0x3 << 28) -+#define OMAP44XX_REG_WR_FIFO_DEPTH_SHIFT 8 -+#define OMAP44XX_REG_WR_FIFO_DEPTH_MASK (0xff << 8) -+#define OMAP44XX_REG_CMD_FIFO_DEPTH_SHIFT 0 -+#define OMAP44XX_REG_CMD_FIFO_DEPTH_MASK (0xff << 0) -+ -+/* OCP_CFG_VAL_2 */ -+#define OMAP44XX_REG_RREG_FIFO_DEPTH_SHIFT 16 -+#define OMAP44XX_REG_RREG_FIFO_DEPTH_MASK (0xff << 16) -+#define OMAP44XX_REG_RSD_FIFO_DEPTH_SHIFT 8 -+#define OMAP44XX_REG_RSD_FIFO_DEPTH_MASK (0xff << 8) -+#define OMAP44XX_REG_RCMD_FIFO_DEPTH_SHIFT 0 -+#define OMAP44XX_REG_RCMD_FIFO_DEPTH_MASK (0xff << 0) -+ -+/* IODFT_TLGC */ -+#define OMAP44XX_REG_TLEC_SHIFT 16 -+#define OMAP44XX_REG_TLEC_MASK (0xffff << 16) -+#define OMAP44XX_REG_MT_SHIFT 14 -+#define OMAP44XX_REG_MT_MASK (1 << 14) -+#define OMAP44XX_REG_ACT_CAP_EN_SHIFT 13 -+#define OMAP44XX_REG_ACT_CAP_EN_MASK (1 << 13) -+#define OMAP44XX_REG_OPG_LD_SHIFT 12 -+#define OMAP44XX_REG_OPG_LD_MASK (1 << 12) -+#define OMAP44XX_REG_RESET_PHY_SHIFT 10 -+#define OMAP44XX_REG_RESET_PHY_MASK (1 << 10) -+#define OMAP44XX_REG_MMS_SHIFT 8 -+#define OMAP44XX_REG_MMS_MASK (1 << 8) -+#define OMAP44XX_REG_MC_SHIFT 4 -+#define OMAP44XX_REG_MC_MASK (0x3 << 4) -+#define OMAP44XX_REG_PC_SHIFT 1 -+#define OMAP44XX_REG_PC_MASK (0x7 << 1) -+#define OMAP44XX_REG_TM_SHIFT 0 -+#define OMAP44XX_REG_TM_MASK (1 << 0) -+ -+/* IODFT_CTRL_MISR_RSLT */ -+#define OMAP44XX_REG_DQM_TLMR_SHIFT 16 -+#define OMAP44XX_REG_DQM_TLMR_MASK (0x3ff << 16) -+#define OMAP44XX_REG_CTL_TLMR_SHIFT 0 -+#define OMAP44XX_REG_CTL_TLMR_MASK (0x7ff << 0) -+ -+/* IODFT_ADDR_MISR_RSLT */ -+#define OMAP44XX_REG_ADDR_TLMR_SHIFT 0 -+#define OMAP44XX_REG_ADDR_TLMR_MASK (0x1fffff << 0) -+ -+/* IODFT_DATA_MISR_RSLT_1 */ -+#define OMAP44XX_REG_DATA_TLMR_31_0_SHIFT 0 -+#define OMAP44XX_REG_DATA_TLMR_31_0_MASK (0xffffffff << 0) -+ -+/* IODFT_DATA_MISR_RSLT_2 */ -+#define OMAP44XX_REG_DATA_TLMR_63_32_SHIFT 0 -+#define OMAP44XX_REG_DATA_TLMR_63_32_MASK (0xffffffff << 0) -+ -+/* IODFT_DATA_MISR_RSLT_3 */ -+#define OMAP44XX_REG_DATA_TLMR_66_64_SHIFT 0 -+#define OMAP44XX_REG_DATA_TLMR_66_64_MASK (0x7 << 0) -+ -+/* PERF_CNT_1 */ -+#define OMAP44XX_REG_COUNTER1_SHIFT 0 -+#define OMAP44XX_REG_COUNTER1_MASK (0xffffffff << 0) -+ -+/* PERF_CNT_2 */ -+#define OMAP44XX_REG_COUNTER2_SHIFT 0 -+#define OMAP44XX_REG_COUNTER2_MASK (0xffffffff << 0) -+ -+/* PERF_CNT_CFG */ -+#define OMAP44XX_REG_CNTR2_MCONNID_EN_SHIFT 31 -+#define OMAP44XX_REG_CNTR2_MCONNID_EN_MASK (1 << 31) -+#define OMAP44XX_REG_CNTR2_REGION_EN_SHIFT 30 -+#define OMAP44XX_REG_CNTR2_REGION_EN_MASK (1 << 30) -+#define OMAP44XX_REG_CNTR2_CFG_SHIFT 16 -+#define OMAP44XX_REG_CNTR2_CFG_MASK (0xf << 16) -+#define OMAP44XX_REG_CNTR1_MCONNID_EN_SHIFT 15 -+#define OMAP44XX_REG_CNTR1_MCONNID_EN_MASK (1 << 15) -+#define OMAP44XX_REG_CNTR1_REGION_EN_SHIFT 14 -+#define OMAP44XX_REG_CNTR1_REGION_EN_MASK (1 << 14) -+#define OMAP44XX_REG_CNTR1_CFG_SHIFT 0 -+#define OMAP44XX_REG_CNTR1_CFG_MASK (0xf << 0) -+ -+/* PERF_CNT_SEL */ -+#define OMAP44XX_REG_MCONNID2_SHIFT 24 -+#define OMAP44XX_REG_MCONNID2_MASK (0xff << 24) -+#define OMAP44XX_REG_REGION_SEL2_SHIFT 16 -+#define OMAP44XX_REG_REGION_SEL2_MASK (0x3 << 16) -+#define OMAP44XX_REG_MCONNID1_SHIFT 8 -+#define OMAP44XX_REG_MCONNID1_MASK (0xff << 8) -+#define OMAP44XX_REG_REGION_SEL1_SHIFT 0 -+#define OMAP44XX_REG_REGION_SEL1_MASK (0x3 << 0) -+ -+/* PERF_CNT_TIM */ -+#define OMAP44XX_REG_TOTAL_TIME_SHIFT 0 -+#define OMAP44XX_REG_TOTAL_TIME_MASK (0xffffffff << 0) -+ -+/* READ_IDLE_CTRL */ -+#define OMAP44XX_REG_READ_IDLE_LEN_SHIFT 16 -+#define OMAP44XX_REG_READ_IDLE_LEN_MASK (0xf << 16) -+#define OMAP44XX_REG_READ_IDLE_INTERVAL_SHIFT 0 -+#define OMAP44XX_REG_READ_IDLE_INTERVAL_MASK (0x1ff << 0) -+ -+/* READ_IDLE_CTRL_SHDW */ -+#define OMAP44XX_REG_READ_IDLE_LEN_SHDW_SHIFT 16 -+#define OMAP44XX_REG_READ_IDLE_LEN_SHDW_MASK (0xf << 16) -+#define OMAP44XX_REG_READ_IDLE_INTERVAL_SHDW_SHIFT 0 -+#define OMAP44XX_REG_READ_IDLE_INTERVAL_SHDW_MASK (0x1ff << 0) -+ -+/* IRQ_EOI */ -+#define OMAP44XX_REG_EOI_SHIFT 0 -+#define OMAP44XX_REG_EOI_MASK (1 << 0) -+ -+/* IRQSTATUS_RAW_SYS */ -+#define OMAP44XX_REG_DNV_SYS_SHIFT 2 -+#define OMAP44XX_REG_DNV_SYS_MASK (1 << 2) -+#define OMAP44XX_REG_TA_SYS_SHIFT 1 -+#define OMAP44XX_REG_TA_SYS_MASK (1 << 1) -+#define OMAP44XX_REG_ERR_SYS_SHIFT 0 -+#define OMAP44XX_REG_ERR_SYS_MASK (1 << 0) -+ -+/* IRQSTATUS_RAW_LL */ -+#define OMAP44XX_REG_DNV_LL_SHIFT 2 -+#define OMAP44XX_REG_DNV_LL_MASK (1 << 2) -+#define OMAP44XX_REG_TA_LL_SHIFT 1 -+#define OMAP44XX_REG_TA_LL_MASK (1 << 1) -+#define OMAP44XX_REG_ERR_LL_SHIFT 0 -+#define OMAP44XX_REG_ERR_LL_MASK (1 << 0) -+ -+/* IRQSTATUS_SYS */ -+ -+/* IRQSTATUS_LL */ -+ -+/* IRQENABLE_SET_SYS */ -+#define OMAP44XX_REG_EN_DNV_SYS_SHIFT 2 -+#define OMAP44XX_REG_EN_DNV_SYS_MASK (1 << 2) -+#define OMAP44XX_REG_EN_TA_SYS_SHIFT 1 -+#define OMAP44XX_REG_EN_TA_SYS_MASK (1 << 1) -+#define OMAP44XX_REG_EN_ERR_SYS_SHIFT 0 -+#define OMAP44XX_REG_EN_ERR_SYS_MASK (1 << 0) -+ -+/* IRQENABLE_SET_LL */ -+#define OMAP44XX_REG_EN_DNV_LL_SHIFT 2 -+#define OMAP44XX_REG_EN_DNV_LL_MASK (1 << 2) -+#define OMAP44XX_REG_EN_TA_LL_SHIFT 1 -+#define OMAP44XX_REG_EN_TA_LL_MASK (1 << 1) -+#define OMAP44XX_REG_EN_ERR_LL_SHIFT 0 -+#define OMAP44XX_REG_EN_ERR_LL_MASK (1 << 0) -+ -+/* IRQENABLE_CLR_SYS */ -+ -+/* IRQENABLE_CLR_LL */ -+ -+/* ZQ_CONFIG */ -+#define OMAP44XX_REG_ZQ_CS1EN_SHIFT 31 -+#define OMAP44XX_REG_ZQ_CS1EN_MASK (1 << 31) -+#define OMAP44XX_REG_ZQ_CS0EN_SHIFT 30 -+#define OMAP44XX_REG_ZQ_CS0EN_MASK (1 << 30) -+#define OMAP44XX_REG_ZQ_DUALCALEN_SHIFT 29 -+#define OMAP44XX_REG_ZQ_DUALCALEN_MASK (1 << 29) -+#define OMAP44XX_REG_ZQ_SFEXITEN_SHIFT 28 -+#define OMAP44XX_REG_ZQ_SFEXITEN_MASK (1 << 28) -+#define OMAP44XX_REG_ZQ_ZQINIT_MULT_SHIFT 18 -+#define OMAP44XX_REG_ZQ_ZQINIT_MULT_MASK (0x3 << 18) -+#define OMAP44XX_REG_ZQ_ZQCL_MULT_SHIFT 16 -+#define OMAP44XX_REG_ZQ_ZQCL_MULT_MASK (0x3 << 16) -+#define OMAP44XX_REG_ZQ_REFINTERVAL_SHIFT 0 -+#define OMAP44XX_REG_ZQ_REFINTERVAL_MASK (0xffff << 0) -+ -+/* TEMP_ALERT_CONFIG */ -+#define OMAP44XX_REG_TA_CS1EN_SHIFT 31 -+#define OMAP44XX_REG_TA_CS1EN_MASK (1 << 31) -+#define OMAP44XX_REG_TA_CS0EN_SHIFT 30 -+#define OMAP44XX_REG_TA_CS0EN_MASK (1 << 30) -+#define OMAP44XX_REG_TA_SFEXITEN_SHIFT 28 -+#define OMAP44XX_REG_TA_SFEXITEN_MASK (1 << 28) -+#define OMAP44XX_REG_TA_DEVWDT_SHIFT 26 -+#define OMAP44XX_REG_TA_DEVWDT_MASK (0x3 << 26) -+#define OMAP44XX_REG_TA_DEVCNT_SHIFT 24 -+#define OMAP44XX_REG_TA_DEVCNT_MASK (0x3 << 24) -+#define OMAP44XX_REG_TA_REFINTERVAL_SHIFT 0 -+#define OMAP44XX_REG_TA_REFINTERVAL_MASK (0x3fffff << 0) -+ -+/* OCP_ERR_LOG */ -+#define OMAP44XX_REG_MADDRSPACE_SHIFT 14 -+#define OMAP44XX_REG_MADDRSPACE_MASK (0x3 << 14) -+#define OMAP44XX_REG_MBURSTSEQ_SHIFT 11 -+#define OMAP44XX_REG_MBURSTSEQ_MASK (0x7 << 11) -+#define OMAP44XX_REG_MCMD_SHIFT 8 -+#define OMAP44XX_REG_MCMD_MASK (0x7 << 8) -+#define OMAP44XX_REG_MCONNID_SHIFT 0 -+#define OMAP44XX_REG_MCONNID_MASK (0xff << 0) -+ -+/* DDR_PHY_CTRL_1 */ -+#define OMAP44XX_REG_DDR_PHY_CTRL_1_SHIFT 4 -+#define OMAP44XX_REG_DDR_PHY_CTRL_1_MASK (0xfffffff << 4) -+#define OMAP44XX_REG_READ_LATENCY_SHIFT 0 -+#define OMAP44XX_REG_READ_LATENCY_MASK (0xf << 0) -+#define OMAP44XX_REG_DLL_SLAVE_DLY_CTRL_SHIFT 4 -+#define OMAP44XX_REG_DLL_SLAVE_DLY_CTRL_MASK (0xFF << 4) -+#define OMAP44XX_EMIF_DDR_PHY_CTRL_1_BASE_VAL_SHIFT 12 -+#define OMAP44XX_EMIF_DDR_PHY_CTRL_1_BASE_VAL_MASK (0xFFFFF << 12) -+ -+/* DDR_PHY_CTRL_1_SHDW */ -+#define OMAP44XX_REG_DDR_PHY_CTRL_1_SHDW_SHIFT 4 -+#define OMAP44XX_REG_DDR_PHY_CTRL_1_SHDW_MASK (0xfffffff << 4) -+#define OMAP44XX_REG_READ_LATENCY_SHDW_SHIFT 0 -+#define OMAP44XX_REG_READ_LATENCY_SHDW_MASK (0xf << 0) -+#define OMAP44XX_REG_DLL_SLAVE_DLY_CTRL_SHDW_SHIFT 4 -+#define OMAP44XX_REG_DLL_SLAVE_DLY_CTRL_SHDW_MASK (0xFF << 4) -+#define OMAP44XX_EMIF_DDR_PHY_CTRL_1_BASE_VAL_SHDW_SHIFT 12 -+#define OMAP44XX_EMIF_DDR_PHY_CTRL_1_BASE_VAL_SHDW_MASK (0xFFFFF << 12) -+ -+/* DDR_PHY_CTRL_2 */ -+#define OMAP44XX_REG_DDR_PHY_CTRL_2_SHIFT 0 -+#define OMAP44XX_REG_DDR_PHY_CTRL_2_MASK (0xffffffff << 0) -+ -+/* DMM */ -+#define OMAP44XX_DMM_BASE 0x4E000000 -+#define OMAP44XX_DMM_LISA_MAP_BASE (0x4E000000 + 0x40) -+ -+/* DMM_LISA_MAP */ -+#define OMAP44XX_SYS_ADDR_SHIFT 24 -+#define OMAP44XX_SYS_ADDR_MASK (0xff << 24) -+#define OMAP44XX_SYS_SIZE_SHIFT 20 -+#define OMAP44XX_SYS_SIZE_MASK (0x7 << 20) -+#define OMAP44XX_SDRC_INTL_SHIFT 18 -+#define OMAP44XX_SDRC_INTL_MASK (0x3 << 18) -+#define OMAP44XX_SDRC_ADDRSPC_SHIFT 16 -+#define OMAP44XX_SDRC_ADDRSPC_MASK (0x3 << 16) -+#define OMAP44XX_SDRC_MAP_SHIFT 8 -+#define OMAP44XX_SDRC_MAP_MASK (0x3 << 8) -+#define OMAP44XX_SDRC_ADDR_SHIFT 0 -+#define OMAP44XX_SDRC_ADDR_MASK (0xff << 0) -+ -+/* DMM_LISA_MAP fields */ -+#define DMM_SDRC_MAP_UNMAPPED 0 -+#define DMM_SDRC_MAP_EMIF1_ONLY 1 -+#define DMM_SDRC_MAP_EMIF2_ONLY 2 -+#define DMM_SDRC_MAP_EMIF1_AND_EMIF2 3 -+ -+#define DMM_SDRC_INTL_NONE 0 -+#define DMM_SDRC_INTL_128B 1 -+#define DMM_SDRC_INTL_256B 2 -+#define DMM_SDRC_INTL_512 3 -+ -+#define DMM_SDRC_ADDR_SPC_SDRAM 0 -+#define DMM_SDRC_ADDR_SPC_NVM 1 -+#define DMM_SDRC_ADDR_SPC_INVALID 2 -+ -+#define DMM_LISA_MAP_INTERLEAVED_BASE_VAL (\ -+ (DMM_SDRC_MAP_EMIF1_AND_EMIF2 << OMAP44XX_SDRC_MAP_SHIFT) |\ -+ (DMM_SDRC_ADDR_SPC_SDRAM << OMAP44XX_SDRC_ADDRSPC_SHIFT) |\ -+ (DMM_SDRC_INTL_128B << OMAP44XX_SDRC_INTL_SHIFT) |\ -+ (CONFIG_SYS_SDRAM_BASE << OMAP44XX_SYS_ADDR_SHIFT)) -+ -+#define DMM_LISA_MAP_EMIF1_ONLY_BASE_VAL (\ -+ (DMM_SDRC_MAP_EMIF1_ONLY << OMAP44XX_SDRC_MAP_SHIFT)|\ -+ (DMM_SDRC_ADDR_SPC_SDRAM << OMAP44XX_SDRC_ADDRSPC_SHIFT)|\ -+ (DMM_SDRC_INTL_NONE << OMAP44XX_SDRC_INTL_SHIFT)) -+ -+#define DMM_LISA_MAP_EMIF2_ONLY_BASE_VAL (\ -+ (DMM_SDRC_MAP_EMIF2_ONLY << OMAP44XX_SDRC_MAP_SHIFT)|\ -+ (DMM_SDRC_ADDR_SPC_SDRAM << OMAP44XX_SDRC_ADDRSPC_SHIFT)|\ -+ (DMM_SDRC_INTL_NONE << OMAP44XX_SDRC_INTL_SHIFT)) -+ -+/* Trap for invalid TILER PAT entries */ -+#define DMM_LISA_MAP_0_INVAL_ADDR_TRAP (\ -+ (0 << OMAP44XX_SDRC_ADDR_SHIFT) |\ -+ (DMM_SDRC_MAP_EMIF1_ONLY << OMAP44XX_SDRC_MAP_SHIFT)|\ -+ (DMM_SDRC_ADDR_SPC_INVALID << OMAP44XX_SDRC_ADDRSPC_SHIFT)|\ -+ (DMM_SDRC_INTL_NONE << OMAP44XX_SDRC_INTL_SHIFT)|\ -+ (0xFF << OMAP44XX_SYS_ADDR_SHIFT)) -+ -+ -+/* Reg mapping structure */ -+struct __attribute__ ((__packed__)) emif_reg_struct{ -+ u32 emif_mod_id_rev; -+ u32 emif_status; -+ u32 emif_sdram_config; -+ u32 emif_lpddr2_nvm_config; -+ u32 emif_sdram_ref_ctrl; -+ u32 emif_sdram_ref_ctrl_shdw; -+ u32 emif_sdram_tim_1; -+ u32 emif_sdram_tim_1_shdw; -+ u32 emif_sdram_tim_2; -+ u32 emif_sdram_tim_2_shdw; -+ u32 emif_sdram_tim_3; -+ u32 emif_sdram_tim_3_shdw; -+ u32 emif_lpddr2_nvm_tim; -+ u32 emif_lpddr2_nvm_tim_shdw; -+ u32 emif_pwr_mgmt_ctrl; -+ u32 emif_pwr_mgmt_ctrl_shdw; -+ u32 emif_lpddr2_mode_reg_data; -+ u32 padding1[1]; -+ u32 emif_lpddr2_mode_reg_data_es2; -+ u32 padding11[1]; -+ u32 emif_lpddr2_mode_reg_cfg; -+ u32 emif_l3_config; -+ u32 emif_l3_cfg_val_1; -+ u32 emif_l3_cfg_val_2; -+ u32 emif_iodft_tlgc; -+ u32 padding2[7]; -+ u32 emif_perf_cnt_1; -+ u32 emif_perf_cnt_2; -+ u32 emif_perf_cnt_cfg; -+ u32 emif_perf_cnt_sel; -+ u32 emif_perf_cnt_tim; -+ u32 padding3; -+ u32 emif_read_idlectrl; -+ u32 emif_read_idlectrl_shdw; -+ u32 padding4; -+ u32 emif_irqstatus_raw_sys; -+ u32 emif_irqstatus_raw_ll; -+ u32 emif_irqstatus_sys; -+ u32 emif_irqstatus_ll; -+ u32 emif_irqenable_set_sys; -+ u32 emif_irqenable_set_ll; -+ u32 emif_irqenable_clr_sys; -+ u32 emif_irqenable_clr_ll; -+ u32 padding5; -+ u32 emif_zq_config; -+ u32 emif_temp_alert_config; -+ u32 emif_l3_err_log; -+ u32 padding6[4]; -+ u32 emif_ddr_phy_ctrl_1; -+ u32 emif_ddr_phy_ctrl_1_shdw; -+ u32 emif_ddr_phy_ctrl_2; -+}; -+ -+struct __attribute__ ((__packed__)) dmm_lisa_map_regs { -+ u32 dmm_lisa_map_0; -+ u32 dmm_lisa_map_1; -+ u32 dmm_lisa_map_2; -+ u32 dmm_lisa_map_3; -+}; -+ -+#define CS0 0 -+#define CS1 1 -+/* Read Latency used by the device at reset */ -+#define RL_BOOT 3 -+/* Read Latency for the highest frequency you want to use */ -+#define RL_FINAL 6 -+/* EMIF_PWR_MGMT_CTRL register */ -+/* Low power modes */ -+#define LP_MODE_DISABLE 0 -+#define LP_MODE_CLOCK_STOP 1 -+#define LP_MODE_SELF_REFRESH 2 -+#define LP_MODE_PWR_DN 3 -+ -+/* REG_DPD_EN */ -+#define DPD_DISABLE 0 -+#define DPD_ENABLE 1 -+ -+/* Maximum delay before Low Power Modes */ -+#define REG_CS_TIM 0xF -+#define REG_SR_TIM 0xF -+#define REG_PD_TIM 0xF -+ -+/* EMIF_PWR_MGMT_CTRL register */ -+#define EMIF_PWR_MGMT_CTRL (\ -+ ((REG_CS_TIM << OMAP44XX_REG_CS_TIM_SHIFT) & OMAP44XX_REG_CS_TIM_MASK)|\ -+ ((REG_SR_TIM << OMAP44XX_REG_SR_TIM_SHIFT) & OMAP44XX_REG_SR_TIM_MASK)|\ -+ ((REG_PD_TIM << OMAP44XX_REG_PD_TIM_SHIFT) & OMAP44XX_REG_PD_TIM_MASK)|\ -+ ((REG_PD_TIM << OMAP44XX_REG_PD_TIM_SHIFT) & OMAP44XX_REG_PD_TIM_MASK)|\ -+ ((LP_MODE_DISABLE << OMAP44XX_REG_LP_MODE_SHIFT)\ -+ & OMAP44XX_REG_LP_MODE_MASK) |\ -+ ((DPD_DISABLE << OMAP44XX_REG_DPD_EN_SHIFT)\ -+ & OMAP44XX_REG_DPD_EN_MASK))\ -+ -+#define EMIF_PWR_MGMT_CTRL_SHDW (\ -+ ((REG_CS_TIM << OMAP44XX_REG_CS_TIM_SHDW_SHIFT)\ -+ & OMAP44XX_REG_CS_TIM_SHDW_MASK) |\ -+ ((REG_SR_TIM << OMAP44XX_REG_SR_TIM_SHDW_SHIFT)\ -+ & OMAP44XX_REG_SR_TIM_SHDW_MASK) |\ -+ ((REG_PD_TIM << OMAP44XX_REG_PD_TIM_SHDW_SHIFT)\ -+ & OMAP44XX_REG_PD_TIM_SHDW_MASK) |\ -+ ((REG_PD_TIM << OMAP44XX_REG_PD_TIM_SHDW_SHIFT)\ -+ & OMAP44XX_REG_PD_TIM_SHDW_MASK)) -+ -+/* EMIF_L3_CONFIG register value for ES1*/ -+#define EMIF_L3_CONFIG_VAL_SYS_THRESH_0A_LL_THRESH_00 0x0A0000FF -+ -+/* -+* MR1 value: -+* Burst length : 8 -+* Burst type : sequential -+* Wrap : enabled -+* nWR : 3(default). EMIF does not do pre-charge. -+* : So nWR is don't care -+*/ -+#define MR1_BL_8_BT_SEQ_WRAP_EN_NWR_3 0x23 -+ -+/* MR2 */ -+#define MR2_RL3_WL1 1 -+#define MR2_RL4_WL2 2 -+#define MR2_RL5_WL2 3 -+#define MR2_RL6_WL3 4 -+ -+/* MR10: ZQ calibration codes */ -+#define MR10_ZQ_ZQCS 0x56 -+#define MR10_ZQ_ZQCL 0xAB -+#define MR10_ZQ_ZQINIT 0xFF -+#define MR10_ZQ_ZQRESET 0xC3 -+ -+/* MR16 value: refresh full array(no partial array self refresh) */ -+#define MR16_REF_FULL_ARRAY 0 -+ -+/* LPDDR2 IO reg values */ -+#define CONTROL_LPDDR2IO_SLEW_125PS_DRV8_PULL_DOWN 0x1C1C1C1C -+#define CONTROL_LPDDR2IO_SLEW_325PS_DRV8_GATE_KEEPER 0x9E9E9E9E -+ -+/* CONTROL_EFUSE_2 */ -+#define CONTROL_EFUSE_2_NMOS_PMOS_PTV_CODE_1 0x00ffc000 -+ -+/* Mode register numbers */ -+#define LPDDR2_MR0 0 -+#define LPDDR2_MR1 1 -+#define LPDDR2_MR2 2 -+#define LPDDR2_MR3 3 -+#define LPDDR2_MR4 4 -+#define LPDDR2_MR5 5 -+#define LPDDR2_MR6 6 -+#define LPDDR2_MR7 7 -+#define LPDDR2_MR8 8 -+#define LPDDR2_MR9 9 -+#define LPDDR2_MR10 10 -+#define LPDDR2_MR11 11 -+#define LPDDR2_MR16 16 -+#define LPDDR2_MR17 17 -+#define LPDDR2_MR18 18 -+ -+/* MR0 */ -+#define LPDDR2_MR0_DAI_SHIFT 0 -+#define LPDDR2_MR0_DAI_MASK 1 -+#define LPDDR2_MR0_DI_SHIFT 1 -+#define LPDDR2_MR0_DI_MASK (1 << 1) -+#define LPDDR2_MR0_DNVI_SHIFT 2 -+#define LPDDR2_MR0_DNVI_MASK (1 << 2) -+ -+/* -+ * Structure containing shadow of important registers in EMIF -+ * The calculation function fills in this structure to be later used for -+ * initialization and DVFS -+ */ -+struct emif_regs { -+ u32 freq; -+ u32 sdram_config_init; -+ u32 sdram_config; -+ u32 ref_ctrl; -+ u32 sdram_tim1; -+ u32 sdram_tim2; -+ u32 sdram_tim3; -+ u32 read_idle_ctrl; -+ u32 zq_config; -+ u32 temp_alert_config; -+ u32 emif_ddr_phy_ctlr_1_init; -+ u32 emif_ddr_phy_ctlr_1; -+}; -+ -+void emif_get_reg_dump(const struct emif_regs **emif1_regs, -+ const struct emif_regs **emif2_regs); -+void emif_get_dmm_regs(const struct dmm_lisa_map_regs **dmm_lisa_regs); -+ -+#endif -diff --git a/arch/arm/include/asm/arch-omap4/omap4.h b/arch/arm/include/asm/arch-omap4/omap4.h -index 740ca9d..a1c4883 100644 ---- a/arch/arm/include/asm/arch-omap4/omap4.h -+++ b/arch/arm/include/asm/arch-omap4/omap4.h -@@ -51,6 +51,17 @@ - #define CONTROL_PADCONF_CORE (OMAP44XX_L4_CORE_BASE + 0x100000) - #define CONTROL_PADCONF_WKUP (OMAP44XX_L4_CORE_BASE + 0x31E000) - -+/* LPDDR2 IO regs */ -+#define CONTROL_LPDDR2IO1_0 (CONTROL_PADCONF_CORE + 0x0638) -+#define CONTROL_LPDDR2IO1_1 (CONTROL_PADCONF_CORE + 0x063C) -+#define CONTROL_LPDDR2IO1_2 (CONTROL_PADCONF_CORE + 0x0640) -+#define CONTROL_LPDDR2IO1_3 (CONTROL_PADCONF_CORE + 0x0644) -+#define CONTROL_LPDDR2IO2_0 (CONTROL_PADCONF_CORE + 0x0648) -+#define CONTROL_LPDDR2IO2_1 (CONTROL_PADCONF_CORE + 0x064C) -+#define CONTROL_LPDDR2IO2_2 (CONTROL_PADCONF_CORE + 0x0650) -+#define CONTROL_LPDDR2IO2_3 (CONTROL_PADCONF_CORE + 0x0654) -+#define CONTROL_EFUSE_2 (CONTROL_PADCONF_CORE + 0x0704) -+ - /* CONTROL_ID_CODE */ - #define CONTROL_ID_CODE (CTRL_BASE + 0x204) - -diff --git a/arch/arm/include/asm/arch-omap4/sys_proto.h b/arch/arm/include/asm/arch-omap4/sys_proto.h -index fd21afd..4beff42 100644 ---- a/arch/arm/include/asm/arch-omap4/sys_proto.h -+++ b/arch/arm/include/asm/arch-omap4/sys_proto.h -@@ -44,6 +44,7 @@ void bypass_dpll(u32 base); - void freq_update_core(void); - u32 get_syc_clk_freq(void); - u32 omap4_ddr_clk(void); -+void sdram_init(void); - u32 omap4_revision(void); - - static inline u32 running_from_sdram(void) -diff --git a/include/configs/omap4_sdp4430.h b/include/configs/omap4_sdp4430.h -index 5b20841..07d45a0 100644 ---- a/include/configs/omap4_sdp4430.h -+++ b/include/configs/omap4_sdp4430.h -@@ -245,11 +245,6 @@ - /* Defines for Clock init */ - #define CONFIG_SYS_OMAP4_ABE_SYSCK - --/* Defines for SDRAM init */ --#define CONFIG_SYS_AUTOMATIC_SDRAM_DETECTION 1 --#define CONFIG_SYS_EMIF_UPDATE_TIMINGS 1 --#define CONFIG_SYS_DEFAULT_LPDDR2_TIMINGS 1 -- - /* Defines for SPL */ - #define CONFIG_SPL - #define CONFIG_SYS_SPL_TEXT_BASE 0x40304360 -diff --git a/spl/board/ti/sdp4430/Makefile b/spl/board/ti/sdp4430/Makefile -index 40e3e79..1f25f77 100644 ---- a/spl/board/ti/sdp4430/Makefile -+++ b/spl/board/ti/sdp4430/Makefile -@@ -115,12 +115,20 @@ $(obj)board.c:$(obj)omap4_mux_data.h - @rm -f $@ - @ln -s $(TOPDIR)/arch/arm/cpu/armv7/omap4/board.c $@ - -+$(obj)emif.c: -+ @rm -f $@ -+ @ln -s $(TOPDIR)/arch/arm/cpu/armv7/omap4/emif.c $@ -+ -+$(obj)sdram_elpida.c: -+ @rm -f $@ -+ @ln -s $(TOPDIR)/arch/arm/cpu/armv7/omap4/sdram_elpida.c $@ -+ - $(obj)clocks.c: - @rm -f $@ - @ln -s $(TOPDIR)/arch/arm/cpu/armv7/omap4/clocks.c $@ - - SOBJS += lowlevel_init.o --COBJS += board.o clocks.o -+COBJS += board.o clocks.o emif.o sdram_elpida.o - - # rules - LDPPFLAGS += -include $(TOPDIR)/include/config.h --- -1.7.2.3 - diff --git a/packages/tools/u-boot/patches/2011.03-rc1/u-boot-2011.03-rc1-0017-omap4-calculate-EMIF-register-values.patch b/packages/tools/u-boot/patches/2011.03-rc1/u-boot-2011.03-rc1-0017-omap4-calculate-EMIF-register-values.patch deleted file mode 100644 index 9e450604b87..00000000000 --- a/packages/tools/u-boot/patches/2011.03-rc1/u-boot-2011.03-rc1-0017-omap4-calculate-EMIF-register-values.patch +++ /dev/null @@ -1,1728 +0,0 @@ -From 7c2a9cc0c7311f4251b067f03912fa5996234ca2 Mon Sep 17 00:00:00 2001 -From: Aneesh V <aneesh@ti.com> -Date: Fri, 25 Feb 2011 17:27:15 +0530 -Subject: [PATCH 17/22] omap4: calculate EMIF register values - -Calculate EMIF register values based on AC timing parameters -from the SDRAM datasheet and the DDR frequency rather than -using the hard-coded values. - -For a new board the user doen't have to go through the tedious -process of calculating the register values. Instead, just -provide the AC timings from the device data sheet as input -and the driver will automatically calculate the register values. - -Signed-off-by: Aneesh V <aneesh@ti.com> ---- - arch/arm/cpu/armv7/omap-common/Makefile | 1 + - arch/arm/cpu/armv7/omap-common/utils.c | 61 ++ - arch/arm/cpu/armv7/omap4/Makefile | 1 - - arch/arm/cpu/armv7/omap4/board.c | 9 +- - arch/arm/cpu/armv7/omap4/emif.c | 861 ++++++++++++++++++++++++++- - arch/arm/cpu/armv7/omap4/sdram_elpida.c | 152 +++++- - arch/arm/include/asm/arch-omap4/emif.h | 304 ++++++++++- - arch/arm/include/asm/arch-omap4/omap4.h | 18 +- - arch/arm/include/asm/arch-omap4/sys_proto.h | 1 + - arch/arm/include/asm/omap_common.h | 21 + - include/configs/omap4_sdp4430.h | 5 + - spl/board/ti/sdp4430/Makefile | 6 +- - 12 files changed, 1424 insertions(+), 16 deletions(-) - create mode 100644 arch/arm/cpu/armv7/omap-common/utils.c - -diff --git a/arch/arm/cpu/armv7/omap-common/Makefile b/arch/arm/cpu/armv7/omap-common/Makefile -index dc01ee5..8f698f8 100644 ---- a/arch/arm/cpu/armv7/omap-common/Makefile -+++ b/arch/arm/cpu/armv7/omap-common/Makefile -@@ -28,6 +28,7 @@ LIB = $(obj)libomap-common.o - SOBJS := reset.o - - COBJS := timer.o -+COBJS += utils.o - - SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) - OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS)) -diff --git a/arch/arm/cpu/armv7/omap-common/utils.c b/arch/arm/cpu/armv7/omap-common/utils.c -new file mode 100644 -index 0000000..7dce7f1 ---- /dev/null -+++ b/arch/arm/cpu/armv7/omap-common/utils.c -@@ -0,0 +1,61 @@ -+/* -+ * Utility functions for OMAP4 -+ * -+ * (C) Copyright 2010 -+ * Texas Instruments, <www.ti.com> -+ * -+ * Aneesh V <aneesh@ti.com> -+ * -+ * See file CREDITS for list of people who contributed to this -+ * project. -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License as -+ * published by the Free Software Foundation; either version 2 of -+ * the License, or (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+ * MA 02111-1307 USA -+ */ -+#include <common.h> -+static void do_cancel_out(u32 *num, u32 *den, u32 factor) -+{ -+ while (1) { -+ if (((*num)/factor*factor == (*num)) && -+ ((*den)/factor*factor == (*den))) { -+ (*num) /= factor; -+ (*den) /= factor; -+ } else -+ break; -+ } -+} -+ -+/* -+ * Cancel out the denominator and numerator of a fraction -+ * to get smaller numerator and denominator. -+ */ -+void cancel_out(u32 *num, u32 *den, u32 den_limit) -+{ -+ do_cancel_out(num, den, 2); -+ do_cancel_out(num, den, 3); -+ do_cancel_out(num, den, 5); -+ do_cancel_out(num, den, 7); -+ do_cancel_out(num, den, 11); -+ do_cancel_out(num, den, 13); -+ do_cancel_out(num, den, 17); -+ while ((*den) > den_limit) { -+ *num /= 2; -+ /* -+ * Round up the denominator so that the final fraction -+ * (num/den) is always <= the desired value -+ */ -+ *den = (*den + 1) / 2; -+ } -+} -diff --git a/arch/arm/cpu/armv7/omap4/Makefile b/arch/arm/cpu/armv7/omap4/Makefile -index d9714fe..0b525e1 100644 ---- a/arch/arm/cpu/armv7/omap4/Makefile -+++ b/arch/arm/cpu/armv7/omap4/Makefile -@@ -34,7 +34,6 @@ COBJS += clocks.o - COBJS += emif.o - COBJS += sdram_elpida.o - -- - SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) - OBJS := $(addprefix $(obj),$(COBJS) $(SOBJS)) - -diff --git a/arch/arm/cpu/armv7/omap4/board.c b/arch/arm/cpu/armv7/omap4/board.c -index 89b1213..925601d 100644 ---- a/arch/arm/cpu/armv7/omap4/board.c -+++ b/arch/arm/cpu/armv7/omap4/board.c -@@ -32,6 +32,7 @@ - #include <asm/arch/cpu.h> - #include <asm/arch/sys_proto.h> - #include <asm/sizes.h> -+#include <asm/arch/emif.h> - #include "omap4_mux_data.h" - - DECLARE_GLOBAL_DATA_PTR; -@@ -148,13 +149,13 @@ u32 sdram_size(void) - { - u32 section, i, total_size = 0, size, addr; - for (i = 0; i < 4; i++) { -- section = __raw_readl(DMM_LISA_MAP_BASE + i*4); -- addr = section & DMM_LISA_MAP_SYS_ADDR_MASK; -+ section = __raw_readl(OMAP44XX_DMM_LISA_MAP_BASE + i*4); -+ addr = section & OMAP44XX_SYS_ADDR_MASK; - /* See if the address is valid */ - if ((addr >= OMAP44XX_DRAM_ADDR_SPACE_START) && - (addr < OMAP44XX_DRAM_ADDR_SPACE_END)) { -- size = ((section & DMM_LISA_MAP_SYS_SIZE_MASK) >> -- DMM_LISA_MAP_SYS_SIZE_SHIFT); -+ size = ((section & OMAP44XX_SYS_SIZE_MASK) >> -+ OMAP44XX_SYS_SIZE_SHIFT); - size = 1 << size; - size *= SZ_16M; - total_size += size; -diff --git a/arch/arm/cpu/armv7/omap4/emif.c b/arch/arm/cpu/armv7/omap4/emif.c -index ee77743..1bdb1d2 100644 ---- a/arch/arm/cpu/armv7/omap4/emif.c -+++ b/arch/arm/cpu/armv7/omap4/emif.c -@@ -31,6 +31,589 @@ - #include <asm/arch/sys_proto.h> - #include <asm/omap_common.h> - -+DECLARE_GLOBAL_DATA_PTR; -+ -+#define print_timing_reg(reg) debug(#reg" - 0x%08x\n", (reg)) -+ -+static u32 *const T_num = (u32 *)OMAP4_SRAM_SCRATCH_EMIF_T_NUM; -+static u32 *const T_den = (u32 *)OMAP4_SRAM_SCRATCH_EMIF_T_DEN; -+static u32 *const emif_sizes = (u32 *)OMAP4_SRAM_SCRATCH_EMIF_SIZE; -+ -+/* -+ * Organization and refresh requirements for LPDDR2 devices of different -+ * types and densities. Derived from JESD209-2 section 2.4 -+ */ -+const struct lpddr2_addressing addressing_table[] = { -+ /* Banks tREFIx10 rowx32,rowx16 colx32,colx16 density */ -+ {BANKS4, T_REFI_15_6, {ROW_12, ROW_12}, {COL_7, COL_8} },/*64M */ -+ {BANKS4, T_REFI_15_6, {ROW_12, ROW_12}, {COL_8, COL_9} },/*128M */ -+ {BANKS4, T_REFI_7_8, {ROW_13, ROW_13}, {COL_8, COL_9} },/*256M */ -+ {BANKS4, T_REFI_7_8, {ROW_13, ROW_13}, {COL_9, COL_10} },/*512M */ -+ {BANKS8, T_REFI_7_8, {ROW_13, ROW_13}, {COL_9, COL_10} },/*1GS4 */ -+ {BANKS8, T_REFI_3_9, {ROW_14, ROW_14}, {COL_9, COL_10} },/*2GS4 */ -+ {BANKS8, T_REFI_3_9, {ROW_14, ROW_14}, {COL_10, COL_11} },/*4G */ -+ {BANKS8, T_REFI_3_9, {ROW_15, ROW_15}, {COL_10, COL_11} },/*8G */ -+ {BANKS4, T_REFI_7_8, {ROW_14, ROW_14}, {COL_9, COL_10} },/*1GS2 */ -+ {BANKS4, T_REFI_3_9, {ROW_15, ROW_15}, {COL_9, COL_10} },/*2GS2 */ -+}; -+ -+static const u32 lpddr2_density_2_size_in_mbytes[] = { -+ 8, /* 64Mb */ -+ 16, /* 128Mb */ -+ 32, /* 256Mb */ -+ 64, /* 512Mb */ -+ 128, /* 1Gb */ -+ 256, /* 2Gb */ -+ 512, /* 4Gb */ -+ 1024, /* 8Gb */ -+ 2048, /* 16Gb */ -+ 4096 /* 32Gb */ -+}; -+ -+#ifdef CONFIG_SYS_DEFAULT_LPDDR2_TIMINGS -+/* Base AC Timing values specified by JESD209-2 for 400MHz operation */ -+static const struct lpddr2_ac_timings timings_jedec_400_mhz = { -+ .max_freq = 400000000, -+ .RL = 6, -+ .tRPab = 21, -+ .tRCD = 18, -+ .tWR = 15, -+ .tRASmin = 42, -+ .tRRD = 10, -+ .tWTRx2 = 15, -+ .tXSR = 140, -+ .tXPx2 = 15, -+ .tRFCab = 130, -+ .tRTPx2 = 15, -+ .tCKE = 3, -+ .tCKESR = 15, -+ .tZQCS = 90, -+ .tZQCL = 360, -+ .tZQINIT = 1000, -+ .tDQSCKMAXx2 = 11, -+ .tRASmax = 70, -+ .tFAW = 50 -+}; -+ -+/* Base AC Timing values specified by JESD209-2 for 333 MHz operation */ -+static const struct lpddr2_ac_timings timings_jedec_333_mhz = { -+ .max_freq = 333000000, -+ .RL = 5, -+ .tRPab = 21, -+ .tRCD = 18, -+ .tWR = 15, -+ .tRASmin = 42, -+ .tRRD = 10, -+ .tWTRx2 = 15, -+ .tXSR = 140, -+ .tXPx2 = 15, -+ .tRFCab = 130, -+ .tRTPx2 = 15, -+ .tCKE = 3, -+ .tCKESR = 15, -+ .tZQCS = 90, -+ .tZQCL = 360, -+ .tZQINIT = 1000, -+ .tDQSCKMAXx2 = 11, -+ .tRASmax = 70, -+ .tFAW = 50 -+}; -+ -+/* Base AC Timing values specified by JESD209-2 for 200 MHz operation */ -+static const struct lpddr2_ac_timings timings_jedec_200_mhz = { -+ .max_freq = 200000000, -+ .RL = 3, -+ .tRPab = 21, -+ .tRCD = 18, -+ .tWR = 15, -+ .tRASmin = 42, -+ .tRRD = 10, -+ .tWTRx2 = 20, -+ .tXSR = 140, -+ .tXPx2 = 15, -+ .tRFCab = 130, -+ .tRTPx2 = 15, -+ .tCKE = 3, -+ .tCKESR = 15, -+ .tZQCS = 90, -+ .tZQCL = 360, -+ .tZQINIT = 1000, -+ .tDQSCKMAXx2 = 11, -+ .tRASmax = 70, -+ .tFAW = 50 -+}; -+ -+/* -+ * Min tCK values specified by JESD209-2 -+ * Min tCK specifies the minimum duration of some AC timing parameters in terms -+ * of the number of cycles. If the calculated number of cycles based on the -+ * absolute time value is less than the min tCK value, min tCK value should -+ * be used instead. This typically happens at low frequencies. -+ */ -+static const struct lpddr2_min_tck min_tck_jedec = { -+ .tRL = 3, -+ .tRP_AB = 3, -+ .tRCD = 3, -+ .tWR = 3, -+ .tRAS_MIN = 3, -+ .tRRD = 2, -+ .tWTR = 2, -+ .tXP = 2, -+ .tRTP = 2, -+ .tCKE = 3, -+ .tCKESR = 3, -+ .tFAW = 8 -+}; -+ -+static const struct lpddr2_ac_timings *jedec_ac_timings[MAX_NUM_SPEEDBINS] = { -+ &timings_jedec_200_mhz, -+ &timings_jedec_333_mhz, -+ &timings_jedec_400_mhz -+}; -+ -+static const struct lpddr2_device_timings jedec_default_timings = { -+ .ac_timings = jedec_ac_timings, -+ .min_tck = &min_tck_jedec -+}; -+#endif /* CONFIG_SYS_DEFAULT_LPDDR2_TIMINGS */ -+ -+/* -+ * Calculate the period of DDR clock from frequency value and set the -+ * denominator and numerator in global variables for easy access later -+ */ -+static void set_ddr_clk_period(u32 freq) -+{ -+ /* -+ * period = 1/freq -+ * period_in_ns = 10^9/freq -+ */ -+ *T_num = 1000000000; -+ *T_den = freq; -+ cancel_out(T_num, T_den, 200); -+ -+} -+ -+/* -+ * Convert time in nano seconds to number of cycles of DDR clock -+ */ -+static inline u32 ns_2_cycles(u32 ns) -+{ -+ return ((ns * (*T_den)) + (*T_num) - 1) / (*T_num); -+} -+ -+/* -+ * ns_2_cycles with the difference that the time passed is 2 times the actual -+ * value(to avoid fractions). The cycles returned is for the original value of -+ * the timing parameter -+ */ -+static inline u32 ns_x2_2_cycles(u32 ns) -+{ -+ return ((ns * (*T_den)) + (*T_num) * 2 - 1) / ((*T_num) * 2); -+} -+ -+/* -+ * Find addressing table index based on the device's type(S2 or S4) and -+ * density -+ */ -+s8 addressing_table_index(u8 type, u8 density, u8 width) -+{ -+ u8 index; -+ if ((density > LPDDR2_DENSITY_8Gb) || (width == LPDDR2_IO_WIDTH_8)) -+ return -1; -+ -+ /* -+ * Look at the way ADDR_TABLE_INDEX* values have been defined -+ * in emif.h compared to LPDDR2_DENSITY_* values -+ * The table is layed out in the increasing order of density -+ * (ignoring type). The exceptions 1GS2 and 2GS2 have been placed -+ * at the end -+ */ -+ if ((type == LPDDR2_TYPE_S2) && (density == LPDDR2_DENSITY_1Gb)) -+ index = ADDR_TABLE_INDEX1GS2; -+ else if ((type == LPDDR2_TYPE_S2) && (density == LPDDR2_DENSITY_2Gb)) -+ index = ADDR_TABLE_INDEX2GS2; -+ else -+ index = density; -+ -+ debug("emif: addressing table index %d\n", index); -+ -+ return index; -+} -+ -+/* -+ * Find the the right timing table from the array of timing -+ * tables of the device using DDR clock frequency -+ */ -+static const struct lpddr2_ac_timings *get_timings_table(const struct -+ lpddr2_ac_timings const *const *device_timings, -+ u32 freq) -+{ -+ u32 i, temp, freq_nearest; -+ const struct lpddr2_ac_timings *timings = 0; -+ -+ emif_assert(freq <= MAX_LPDDR2_FREQ); -+ emif_assert(device_timings); -+ -+ /* -+ * Start with the maximum allowed frequency - that is always safe -+ */ -+ freq_nearest = MAX_LPDDR2_FREQ; -+ /* -+ * Find the timings table that has the max frequency value: -+ * i. Above or equal to the DDR frequency - safe -+ * ii. The lowest that satisfies condition (i) - optimal -+ */ -+ for (i = 0; (i < MAX_NUM_SPEEDBINS) && device_timings[i]; i++) { -+ temp = device_timings[i]->max_freq; -+ if ((temp >= freq) && (temp <= freq_nearest)) { -+ freq_nearest = temp; -+ timings = device_timings[i]; -+ } -+ } -+ debug("emif: timings table: %d\n", freq_nearest); -+ return timings; -+} -+ -+/* -+ * Finds the value of emif_sdram_config_reg -+ * All parameters are programmed based on the device on CS0. -+ * If there is a device on CS1, it will be same as that on CS0 or -+ * it will be NVM. We don't support NVM yet. -+ * If cs1_device pointer is NULL it is assumed that there is no device -+ * on CS1 -+ */ -+static u32 get_sdram_config_reg(const struct lpddr2_device_details *cs0_device, -+ const struct lpddr2_device_details *cs1_device, -+ const struct lpddr2_addressing *addressing, -+ u8 RL) -+{ -+ u32 config_reg = 0; -+ -+ set_bit_field(config_reg, OMAP44XX_REG_SDRAM_TYPE_SHIFT, -+ OMAP44XX_REG_SDRAM_TYPE_MASK, cs0_device->type + 4); -+ -+ set_bit_field(config_reg, OMAP44XX_REG_IBANK_POS_SHIFT, -+ OMAP44XX_REG_IBANK_POS_MASK, -+ EMIF_INTERLEAVING_POLICY_MAX_INTERLEAVING); -+ -+ set_bit_field(config_reg, OMAP44XX_REG_NARROW_MODE_SHIFT, -+ OMAP44XX_REG_NARROW_MODE_MASK, cs0_device->io_width); -+ -+ set_bit_field(config_reg, OMAP44XX_REG_CL_SHIFT, OMAP44XX_REG_CL_MASK, -+ RL); -+ -+ set_bit_field(config_reg, OMAP44XX_REG_ROWSIZE_SHIFT, -+ OMAP44XX_REG_ROWSIZE_MASK, -+ addressing->row_sz[cs0_device->io_width]); -+ -+ set_bit_field(config_reg, OMAP44XX_REG_IBANK_SHIFT, -+ OMAP44XX_REG_IBANK_MASK, addressing->num_banks); -+ -+ set_bit_field(config_reg, OMAP44XX_REG_EBANK_SHIFT, -+ OMAP44XX_REG_EBANK_MASK, -+ (cs1_device ? EBANK_CS1_EN : EBANK_CS1_DIS)); -+ -+ set_bit_field(config_reg, OMAP44XX_REG_PAGESIZE_SHIFT, -+ OMAP44XX_REG_PAGESIZE_MASK, -+ addressing->col_sz[cs0_device->io_width]); -+ -+ return config_reg; -+} -+ -+static u32 get_sdram_ref_ctrl(u32 freq, -+ const struct lpddr2_addressing *addressing) -+{ -+ u32 ref_ctrl = 0, val = 0, freq_khz; -+ freq_khz = freq / 1000; -+ /* -+ * refresh rate to be set is 'tREFI * freq in MHz -+ * division by 10000 to account for khz and x10 in t_REFI_us_x10 -+ */ -+ val = addressing->t_REFI_us_x10 * freq_khz / 10000; -+ set_bit_field(ref_ctrl, OMAP44XX_REG_REFRESH_RATE_SHIFT, -+ OMAP44XX_REG_REFRESH_RATE_MASK, val); -+ -+ return ref_ctrl; -+} -+ -+static u32 get_sdram_tim_1_reg(const struct lpddr2_ac_timings *timings, -+ const struct lpddr2_min_tck *min_tck, -+ const struct lpddr2_addressing *addressing) -+{ -+ u32 tim1 = 0, val = 0; -+ val = max(min_tck->tWTR, ns_x2_2_cycles(timings->tWTRx2)) - 1; -+ set_bit_field(tim1, OMAP44XX_REG_T_WTR_SHIFT, OMAP44XX_REG_T_WTR_MASK, -+ val); -+ -+ if (addressing->num_banks == BANKS8) -+ val = (timings->tFAW * (*T_den) + 4 * (*T_num) - 1) / -+ (4 * (*T_num)) - 1; -+ else -+ val = max(min_tck->tRRD, ns_2_cycles(timings->tRRD)) - 1; -+ -+ set_bit_field(tim1, OMAP44XX_REG_T_RRD_SHIFT, OMAP44XX_REG_T_RRD_MASK, -+ val); -+ -+ val = ns_2_cycles(timings->tRASmin + timings->tRPab) - 1; -+ set_bit_field(tim1, OMAP44XX_REG_T_RC_SHIFT, OMAP44XX_REG_T_RC_MASK, -+ val); -+ -+ val = max(min_tck->tRAS_MIN, ns_2_cycles(timings->tRASmin)) - 1; -+ set_bit_field(tim1, OMAP44XX_REG_T_RAS_SHIFT, OMAP44XX_REG_T_RAS_MASK, -+ val); -+ -+ val = max(min_tck->tWR, ns_2_cycles(timings->tWR)) - 1; -+ set_bit_field(tim1, OMAP44XX_REG_T_WR_SHIFT, OMAP44XX_REG_T_WR_MASK, -+ val); -+ -+ val = max(min_tck->tRCD, ns_2_cycles(timings->tRCD)) - 1; -+ set_bit_field(tim1, OMAP44XX_REG_T_RCD_SHIFT, OMAP44XX_REG_T_RCD_MASK, -+ val); -+ val = max(min_tck->tRP_AB, ns_2_cycles(timings->tRPab)) - 1; -+ set_bit_field(tim1, OMAP44XX_REG_T_RP_SHIFT, OMAP44XX_REG_T_RP_MASK, -+ val); -+ -+ return tim1; -+} -+ -+static u32 get_sdram_tim_2_reg(const struct lpddr2_ac_timings *timings, -+ const struct lpddr2_min_tck *min_tck) -+{ -+ u32 tim2 = 0, val = 0; -+ val = max(min_tck->tCKE, timings->tCKE) - 1; -+ set_bit_field(tim2, OMAP44XX_REG_T_CKE_SHIFT, OMAP44XX_REG_T_CKE_MASK, -+ val); -+ -+ val = max(min_tck->tRTP, ns_x2_2_cycles(timings->tRTPx2)) - 1; -+ set_bit_field(tim2, OMAP44XX_REG_T_RTP_SHIFT, OMAP44XX_REG_T_RTP_MASK, -+ val); -+ -+ /* -+ * tXSRD = tRFCab + 10 ns. XSRD and XSNR should have the -+ * same value -+ */ -+ val = ns_2_cycles(timings->tXSR) - 1; -+ set_bit_field(tim2, OMAP44XX_REG_T_XSRD_SHIFT, OMAP44XX_REG_T_XSRD_MASK, -+ val); -+ set_bit_field(tim2, OMAP44XX_REG_T_XSNR_SHIFT, OMAP44XX_REG_T_XSNR_MASK, -+ val); -+ -+ val = max(min_tck->tXP, ns_x2_2_cycles(timings->tXPx2)) - 1; -+ set_bit_field(tim2, OMAP44XX_REG_T_XP_SHIFT, OMAP44XX_REG_T_XP_MASK, -+ val); -+ -+ return tim2; -+} -+ -+static u32 get_sdram_tim_3_reg(const struct lpddr2_ac_timings *timings, -+ const struct lpddr2_min_tck *min_tck, -+ const struct lpddr2_addressing *addressing) -+{ -+ u32 tim3 = 0, val = 0; -+ val = min(timings->tRASmax * 10 / addressing->t_REFI_us_x10 - 1, 0xF); -+ set_bit_field(tim3, OMAP44XX_REG_T_RAS_MAX_SHIFT, -+ OMAP44XX_REG_T_RAS_MAX_MASK, val); -+ -+ val = ns_2_cycles(timings->tRFCab) - 1; -+ set_bit_field(tim3, OMAP44XX_REG_T_RFC_SHIFT, OMAP44XX_REG_T_RFC_MASK, -+ val); -+ -+ val = ns_x2_2_cycles(timings->tDQSCKMAXx2) - 1; -+ set_bit_field(tim3, OMAP44XX_REG_T_TDQSCKMAX_SHIFT, -+ OMAP44XX_REG_T_TDQSCKMAX_MASK, val); -+ -+ val = ns_2_cycles(timings->tZQCS) - 1; -+ set_bit_field(tim3, OMAP44XX_REG_ZQ_ZQCS_SHIFT, -+ OMAP44XX_REG_ZQ_ZQCS_MASK, val); -+ -+ val = max(min_tck->tCKESR, ns_2_cycles(timings->tCKESR)) - 1; -+ set_bit_field(tim3, OMAP44XX_REG_T_CKESR_SHIFT, -+ OMAP44XX_REG_T_CKESR_MASK, val); -+ -+ return tim3; -+} -+ -+static u32 get_zq_config_reg(const struct lpddr2_device_details *cs1_device, -+ const struct lpddr2_addressing *addressing, -+ u8 volt_ramp) -+{ -+ u32 zq = 0, val = 0; -+ if (volt_ramp) -+ val = -+ EMIF_ZQCS_INTERVAL_DVFS_IN_US * 10 / -+ addressing->t_REFI_us_x10; -+ else -+ val = -+ EMIF_ZQCS_INTERVAL_NORMAL_IN_US * 10 / -+ addressing->t_REFI_us_x10; -+ set_bit_field(zq, OMAP44XX_REG_ZQ_REFINTERVAL_SHIFT, -+ OMAP44XX_REG_ZQ_REFINTERVAL_MASK, val); -+ -+ set_bit_field(zq, OMAP44XX_REG_ZQ_ZQCL_MULT_SHIFT, -+ OMAP44XX_REG_ZQ_ZQCL_MULT_MASK, REG_ZQ_ZQCL_MULT - 1); -+ -+ set_bit_field(zq, OMAP44XX_REG_ZQ_ZQINIT_MULT_SHIFT, -+ OMAP44XX_REG_ZQ_ZQINIT_MULT_MASK, REG_ZQ_ZQINIT_MULT - 1); -+ -+ set_bit_field(zq, OMAP44XX_REG_ZQ_SFEXITEN_SHIFT, -+ OMAP44XX_REG_ZQ_SFEXITEN_MASK, REG_ZQ_SFEXITEN_ENABLE); -+ -+ /* -+ * Assuming that two chipselects have a single calibration resistor -+ * If there are indeed two calibration resistors, then this flag should -+ * be enabled to take advantage of dual calibration feature. -+ * This data should ideally come from board files. But considering -+ * that none of the boards today have calibration resistors per CS, -+ * it would be an unnecessary overhead. -+ */ -+ set_bit_field(zq, OMAP44XX_REG_ZQ_DUALCALEN_SHIFT, -+ OMAP44XX_REG_ZQ_DUALCALEN_MASK, REG_ZQ_DUALCALEN_DISABLE); -+ -+ set_bit_field(zq, OMAP44XX_REG_ZQ_CS0EN_SHIFT, -+ OMAP44XX_REG_ZQ_CS0EN_MASK, REG_ZQ_CS0EN_ENABLE); -+ -+ set_bit_field(zq, OMAP44XX_REG_ZQ_CS1EN_SHIFT, -+ OMAP44XX_REG_ZQ_CS1EN_MASK, (cs1_device ? 1 : 0)); -+ -+ return zq; -+} -+ -+static u32 get_temp_alert_config(const struct lpddr2_device_details *cs1_device, -+ const struct lpddr2_addressing *addressing, -+ u8 is_derated) -+{ -+ u32 alert = 0, interval; -+ interval = -+ TEMP_ALERT_POLL_INTERVAL_MS * 10000 / addressing->t_REFI_us_x10; -+ if (is_derated) -+ interval *= 4; -+ set_bit_field(alert, OMAP44XX_REG_TA_REFINTERVAL_SHIFT, -+ OMAP44XX_REG_TA_REFINTERVAL_MASK, interval); -+ -+ set_bit_field(alert, OMAP44XX_REG_TA_DEVCNT_SHIFT, -+ OMAP44XX_REG_TA_DEVCNT_MASK, TEMP_ALERT_CONFIG_DEVCT_1); -+ -+ set_bit_field(alert, OMAP44XX_REG_TA_DEVWDT_SHIFT, -+ OMAP44XX_REG_TA_DEVWDT_MASK, TEMP_ALERT_CONFIG_DEVWDT_32); -+ -+ set_bit_field(alert, OMAP44XX_REG_TA_SFEXITEN_SHIFT, -+ OMAP44XX_REG_TA_SFEXITEN_MASK, 1); -+ -+ set_bit_field(alert, OMAP44XX_REG_TA_CS0EN_SHIFT, -+ OMAP44XX_REG_TA_CS0EN_MASK, 1); -+ -+ set_bit_field(alert, OMAP44XX_REG_TA_CS1EN_SHIFT, -+ OMAP44XX_REG_TA_CS1EN_MASK, (cs1_device ? 1 : 0)); -+ -+ return alert; -+} -+ -+static u32 get_read_idle_ctrl_reg(u8 volt_ramp) -+{ -+ u32 idle = 0, val = 0; -+ if (volt_ramp) -+ val = ns_2_cycles(READ_IDLE_INTERVAL_DVFS) / 64 + 1; -+ else -+ /*Maximum value in normal conditions - suggested by hw team */ -+ val = 0x1FF; -+ set_bit_field(idle, OMAP44XX_REG_READ_IDLE_INTERVAL_SHIFT, -+ OMAP44XX_REG_READ_IDLE_INTERVAL_MASK, val); -+ -+ set_bit_field(idle, OMAP44XX_REG_READ_IDLE_LEN_SHIFT, -+ OMAP44XX_REG_READ_IDLE_LEN_MASK, -+ EMIF_REG_READ_IDLE_LEN_VAL); -+ -+ return idle; -+} -+ -+static u32 get_ddr_phy_ctrl_1(u32 freq, u8 RL) -+{ -+ u32 phy = 0, val = 0; -+ -+ set_bit_field(phy, OMAP44XX_REG_READ_LATENCY_SHIFT, -+ OMAP44XX_REG_READ_LATENCY_MASK, RL + 2); -+ -+ if (freq <= 100000000) -+ val = EMIF_DLL_SLAVE_DLY_CTRL_100_MHZ_AND_LESS; -+ else if (freq <= 200000000) -+ val = EMIF_DLL_SLAVE_DLY_CTRL_200_MHZ; -+ else -+ val = EMIF_DLL_SLAVE_DLY_CTRL_400_MHZ; -+ set_bit_field(phy, OMAP44XX_REG_DLL_SLAVE_DLY_CTRL_SHIFT, -+ OMAP44XX_REG_DLL_SLAVE_DLY_CTRL_MASK, val); -+ -+ /* Other fields are constant magic values. Hardcode them together */ -+ set_bit_field(phy, OMAP44XX_EMIF_DDR_PHY_CTRL_1_BASE_VAL_SHIFT, -+ OMAP44XX_EMIF_DDR_PHY_CTRL_1_BASE_VAL_MASK, -+ EMIF_DDR_PHY_CTRL_1_BASE_VAL); -+ -+ return phy; -+} -+ -+const char *get_lpddr2_type(u8 type_id) -+{ -+ switch (type_id) { -+ case LPDDR2_TYPE_S4: -+ return "LPDDR2-S4"; -+ case LPDDR2_TYPE_S2: -+ return "LPDDR2-S2"; -+ default: -+ return NULL; -+ } -+} -+ -+const char *get_lpddr2_io_width(u8 width_id) -+{ -+ switch (width_id) { -+ case LPDDR2_IO_WIDTH_8: -+ return "x8"; -+ case LPDDR2_IO_WIDTH_16: -+ return "x16"; -+ case LPDDR2_IO_WIDTH_32: -+ return "x32"; -+ default: -+ return NULL; -+ } -+} -+ -+const char *get_lpddr2_manufacturer(u32 manufacturer) -+{ -+ switch (manufacturer) { -+ case LPDDR2_MANUFACTURER_SAMSUNG: -+ return "Samsung"; -+ case LPDDR2_MANUFACTURER_QIMONDA: -+ return "Qimonda"; -+ case LPDDR2_MANUFACTURER_ELPIDA: -+ return "Elpida"; -+ case LPDDR2_MANUFACTURER_ETRON: -+ return "Etron"; -+ case LPDDR2_MANUFACTURER_NANYA: -+ return "Nanya"; -+ case LPDDR2_MANUFACTURER_HYNIX: -+ return "Hynix"; -+ case LPDDR2_MANUFACTURER_MOSEL: -+ return "Mosel"; -+ case LPDDR2_MANUFACTURER_WINBOND: -+ return "Winbond"; -+ case LPDDR2_MANUFACTURER_ESMT: -+ return "ESMT"; -+ case LPDDR2_MANUFACTURER_SPANSION: -+ return "Spansion"; -+ case LPDDR2_MANUFACTURER_SST: -+ return "SST"; -+ case LPDDR2_MANUFACTURER_ZMOS: -+ return "ZMOS"; -+ case LPDDR2_MANUFACTURER_INTEL: -+ return "Intel"; -+ case LPDDR2_MANUFACTURER_NUMONYX: -+ return "Numonyx"; -+ case LPDDR2_MANUFACTURER_MICRON: -+ return "Micron"; -+ default: -+ return NULL; -+ } -+} -+ - static inline u32 emif_num(u32 base) - { - if (base == OMAP44XX_EMIF1) -@@ -65,6 +648,127 @@ static inline void set_mr(u32 base, u32 cs, u32 mr_addr, u32 mr_val) - writel(mr_addr, &emif->emif_lpddr2_mode_reg_cfg); - writel(mr_val, &emif->emif_lpddr2_mode_reg_data); - } -+ -+static void emif_calculate_regs( -+ const struct emif_device_details *emif_dev_details, -+ u32 freq, struct emif_regs *regs) -+{ -+ u32 temp, sys_freq; -+ const struct lpddr2_addressing *addressing; -+ const struct lpddr2_ac_timings *timings; -+ const struct lpddr2_min_tck *min_tck; -+ const struct lpddr2_device_details *cs0_dev_details = -+ emif_dev_details->cs0_device_details; -+ const struct lpddr2_device_details *cs1_dev_details = -+ emif_dev_details->cs1_device_details; -+ const struct lpddr2_device_timings *cs0_dev_timings = -+ emif_dev_details->cs0_device_timings; -+ -+ emif_assert(emif_dev_details); -+ emif_assert(regs); -+ /* -+ * You can not have a device on CS1 without one on CS0 -+ * So configuring EMIF without a device on CS0 doesn't -+ * make sense -+ */ -+ emif_assert(cs0_dev_details); -+ emif_assert(cs0_dev_details->type != LPDDR2_TYPE_NVM); -+ /* -+ * If there is a device on CS1 it should be same type as CS0 -+ * (or NVM. But NVM is not supported in this driver yet) -+ */ -+ emif_assert((cs1_dev_details == NULL) || -+ (cs1_dev_details->type == LPDDR2_TYPE_NVM) || -+ (cs0_dev_details->type == cs1_dev_details->type)); -+ emif_assert(freq <= MAX_LPDDR2_FREQ); -+ -+ set_ddr_clk_period(freq); -+ -+ /* -+ * The device on CS0 is used for all timing calculations -+ * There is only one set of registers for timings per EMIF. So, if the -+ * second CS(CS1) has a device, it should have the same timings as the -+ * device on CS0 -+ */ -+ timings = get_timings_table(cs0_dev_timings->ac_timings, freq); -+ emif_assert(timings); -+ min_tck = cs0_dev_timings->min_tck; -+ -+ temp = addressing_table_index(cs0_dev_details->type, -+ cs0_dev_details->density, -+ cs0_dev_details->io_width); -+ -+ emif_assert((temp >= 0)); -+ addressing = &(addressing_table[temp]); -+ emif_assert(addressing); -+ -+ sys_freq = get_syc_clk_freq(); -+ -+ regs->sdram_config_init = get_sdram_config_reg(cs0_dev_details, -+ cs1_dev_details, -+ addressing, RL_BOOT); -+ -+ regs->sdram_config = get_sdram_config_reg(cs0_dev_details, -+ cs1_dev_details, -+ addressing, RL_FINAL); -+ -+ regs->ref_ctrl = get_sdram_ref_ctrl(freq, addressing); -+ -+ regs->sdram_tim1 = get_sdram_tim_1_reg(timings, min_tck, addressing); -+ -+ regs->sdram_tim2 = get_sdram_tim_2_reg(timings, min_tck); -+ -+ regs->sdram_tim3 = get_sdram_tim_3_reg(timings, min_tck, addressing); -+ -+ regs->read_idle_ctrl = get_read_idle_ctrl_reg(LPDDR2_VOLTAGE_STABLE); -+ -+ regs->temp_alert_config = -+ get_temp_alert_config(cs1_dev_details, addressing, 0); -+ -+ regs->zq_config = get_zq_config_reg(cs1_dev_details, addressing, -+ LPDDR2_VOLTAGE_STABLE); -+ -+ regs->emif_ddr_phy_ctlr_1_init = -+ get_ddr_phy_ctrl_1(sys_freq / 2, RL_BOOT); -+ -+ regs->emif_ddr_phy_ctlr_1 = -+ get_ddr_phy_ctrl_1(freq, RL_FINAL); -+ -+ regs->freq = freq; -+ -+ print_timing_reg(regs->sdram_config_init); -+ print_timing_reg(regs->sdram_config); -+ print_timing_reg(regs->ref_ctrl); -+ print_timing_reg(regs->sdram_tim1); -+ print_timing_reg(regs->sdram_tim2); -+ print_timing_reg(regs->sdram_tim3); -+ print_timing_reg(regs->read_idle_ctrl); -+ print_timing_reg(regs->temp_alert_config); -+ print_timing_reg(regs->zq_config); -+ print_timing_reg(regs->emif_ddr_phy_ctlr_1); -+ print_timing_reg(regs->emif_ddr_phy_ctlr_1_init); -+} -+ -+static u32 get_emif_mem_size(struct emif_device_details *devices) -+{ -+ u32 size_mbytes = 0, temp; -+ -+ if (!devices) -+ return 0; -+ -+ if (devices->cs0_device_details) { -+ temp = devices->cs0_device_details->density; -+ size_mbytes += lpddr2_density_2_size_in_mbytes[temp]; -+ } -+ -+ if (devices->cs1_device_details) { -+ temp = devices->cs1_device_details->density; -+ size_mbytes += lpddr2_density_2_size_in_mbytes[temp]; -+ } -+ /* convert to bytes */ -+ return size_mbytes << 20; -+} -+ - void emif_reset_phy(u32 base) - { - struct emif_reg_struct *emif = (struct emif_reg_struct *)base; -@@ -158,14 +862,66 @@ static void emif_update_timings(u32 base, const struct emif_regs *regs) - - static void do_sdram_init(u32 base) - { -- const struct emif_regs *regs, *tmp_regs; -+ struct emif_device_details dev_details; -+ const struct emif_regs *regs; -+ - u32 in_sdram, emif_nr; - - in_sdram = running_from_sdram(); - emif_nr = (base == OMAP44XX_EMIF1) ? 1 : 2; - -+#ifdef CONFIG_SYS_EMIF_PRECALCULATED_TIMING_REGS -+ const struct emif_regs *tmp_regs; - emif_get_reg_dump(&regs, &tmp_regs); - regs = (emif_nr == 1) ? regs : tmp_regs; -+#else -+ /* -+ * The user has not provided the register values. We need to -+ * calculate it based on the timings and the DDR frequency -+ */ -+ -+ const struct emif_device_details *dev_details_user_provided; -+ const struct emif_device_details *tmp_details; -+ struct emif_regs calculated_regs; -+ -+ /* We need some input about the devices from the user */ -+ emif_get_device_details(&dev_details_user_provided, &tmp_details); -+ dev_details_user_provided = (emif_nr == 1) ? dev_details_user_provided -+ : tmp_details; -+ if (!dev_details_user_provided) -+ return; -+ -+ dev_details.cs0_device_details = -+ dev_details_user_provided->cs0_device_details; -+ dev_details.cs1_device_details = -+ dev_details_user_provided->cs1_device_details; -+ -+ /* Return if no devices on this EMIF */ -+ if (!dev_details.cs0_device_details && -+ !dev_details.cs1_device_details) { -+ emif_sizes[emif_nr - 1] = 0; -+ return; -+ } -+ -+ if (!in_sdram) -+ emif_sizes[emif_nr - 1] = get_emif_mem_size(&dev_details); -+ -+#ifdef CONFIG_SYS_DEFAULT_LPDDR2_TIMINGS -+ /* Use the base timings specified by JESD209-2 */ -+ dev_details.cs0_device_timings = &jedec_default_timings; -+ dev_details.cs1_device_timings = &jedec_default_timings; -+ -+#else /* CONFIG_SYS_DEFAULT_LPDDR2_TIMINGS */ -+ dev_details.cs0_device_timings = -+ dev_details_user_provided->cs0_device_timings; -+ dev_details.cs1_device_timings = -+ dev_details_user_provided->cs1_device_timings; -+#endif /* CONFIG_SYS_DEFAULT_LPDDR2_TIMINGS */ -+ /* Calculate the register values */ -+ emif_calculate_regs(&dev_details, omap4_ddr_clk(), &calculated_regs); -+ regs = &calculated_regs; -+ -+#endif /* CONFIG_SYS_EMIF_PRECALCULATED_TIMING_REGS */ - - /* - * Initializing the LPDDR2 device can not happen from SDRAM. -@@ -215,12 +971,111 @@ static void emif_post_init_config(u32 base) - writel(0x80000000, &emif->emif_pwr_mgmt_ctrl); - } - -+/* Gets the encoding corresponding to a given DMM section size */ -+u32 get_dmm_section_size_map(u32 section_size) -+{ -+ /* -+ * Section size mapping: -+ * 0x0: 16-MiB section -+ * 0x1: 32-MiB section -+ * 0x2: 64-MiB section -+ * 0x3: 128-MiB section -+ * 0x4: 256-MiB section -+ * 0x5: 512-MiB section -+ * 0x6: 1-GiB section -+ * 0x7: 2-GiB section -+ */ -+ section_size >>= 24; /* divide by 16 MB */ -+ return log_2_n_round_down(section_size); -+} -+ - static void dmm_init(u32 base) - { - const struct dmm_lisa_map_regs *lisa_map_regs; - -+#ifdef CONFIG_SYS_EMIF_PRECALCULATED_TIMING_REGS - emif_get_dmm_regs(&lisa_map_regs); -+#else -+ u32 emif1_size, emif2_size, mapped_size, section_map; -+ u32 section_cnt, sys_addr; -+ struct dmm_lisa_map_regs lis_map_regs_calculated; -+ -+ mapped_size = 0; -+ section_cnt = 3; -+ sys_addr = CONFIG_SYS_SDRAM_BASE; -+ emif1_size = emif_sizes[0]; -+ emif2_size = emif_sizes[1]; -+ debug("emif1_size 0x%x emif2_size 0x%x\n", emif1_size, emif2_size); - -+ if (!emif1_size && !emif2_size) -+ return; -+ -+ /* symmetric interleaved section */ -+ if (emif1_size && emif2_size) { -+ mapped_size = min(emif1_size, emif2_size); -+ section_map = DMM_LISA_MAP_INTERLEAVED_BASE_VAL; -+ set_bit_field(section_map, OMAP44XX_SDRC_ADDR_SHIFT, -+ OMAP44XX_SDRC_ADDR_MASK, -+ 0); -+ set_bit_field(section_map, OMAP44XX_SYS_ADDR_SHIFT, -+ OMAP44XX_SYS_ADDR_MASK, -+ sys_addr >> 24); /* only MSB */ -+ set_bit_field(section_map, OMAP44XX_SYS_SIZE_SHIFT, -+ OMAP44XX_SYS_SIZE_MASK, -+ get_dmm_section_size_map(mapped_size * 2)); -+ lis_map_regs_calculated.dmm_lisa_map_3 = section_map; -+ emif1_size -= mapped_size; -+ emif2_size -= mapped_size; -+ sys_addr += (mapped_size * 2); -+ section_cnt--; -+ } -+ -+ /* -+ * Single EMIF section(we can have a maximum of 1 single EMIF -+ * section- either EMIF1 or EMIF2 or none, but not both) -+ */ -+ if (emif1_size) { -+ section_map = DMM_LISA_MAP_EMIF1_ONLY_BASE_VAL; -+ set_bit_field(section_map, OMAP44XX_SYS_SIZE_SHIFT, -+ OMAP44XX_SYS_SIZE_MASK, -+ get_dmm_section_size_map(emif1_size)); -+ set_bit_field(section_map, OMAP44XX_SDRC_ADDR_SHIFT, -+ OMAP44XX_SDRC_ADDR_MASK, -+ mapped_size >> 24); /* only MSB */ -+ set_bit_field(section_map, OMAP44XX_SYS_ADDR_SHIFT, -+ OMAP44XX_SYS_ADDR_MASK, -+ sys_addr >> 24); /* only MSB */ -+ section_cnt--; -+ } -+ if (emif2_size) { -+ section_map = DMM_LISA_MAP_EMIF2_ONLY_BASE_VAL; -+ set_bit_field(section_map, OMAP44XX_SYS_SIZE_SHIFT, -+ OMAP44XX_SYS_SIZE_MASK, -+ get_dmm_section_size_map(emif2_size)); -+ set_bit_field(section_map, OMAP44XX_SDRC_ADDR_SHIFT, -+ OMAP44XX_SDRC_ADDR_MASK, -+ mapped_size >> 24); /* only MSB */ -+ set_bit_field(section_map, OMAP44XX_SYS_ADDR_SHIFT, -+ OMAP44XX_SYS_ADDR_MASK, -+ sys_addr >> 24); /* only MSB */ -+ section_cnt--; -+ } -+ -+ if (section_cnt == 2) { -+ /* Only 1 section - either symmetric or single EMIF */ -+ lis_map_regs_calculated.dmm_lisa_map_3 = section_map; -+ lis_map_regs_calculated.dmm_lisa_map_2 = 0; -+ lis_map_regs_calculated.dmm_lisa_map_1 = 0; -+ } else { -+ /* 2 sections - 1 symmetric, 1 single EMIF */ -+ lis_map_regs_calculated.dmm_lisa_map_2 = section_map; -+ lis_map_regs_calculated.dmm_lisa_map_1 = 0; -+ } -+ /* TRAP for invalid TILER mappings in section 0 */ -+ lis_map_regs_calculated.dmm_lisa_map_0 = DMM_LISA_MAP_0_INVAL_ADDR_TRAP; -+ -+ lisa_map_regs = &lis_map_regs_calculated; -+#endif - struct dmm_lisa_map_regs *hw_lisa_map_regs = - (struct dmm_lisa_map_regs *)base; - -@@ -258,8 +1113,10 @@ static void dmm_init(u32 base) - */ - void sdram_init(void) - { -- u32 in_sdram; -+ if (omap4_hw_init_context() == OMAP_INIT_CONTEXT_UBOOT_LOADED_BY_SPL) -+ return; - -+ u32 in_sdram; - in_sdram = running_from_sdram(); - - if (!in_sdram) { -diff --git a/arch/arm/cpu/armv7/omap4/sdram_elpida.c b/arch/arm/cpu/armv7/omap4/sdram_elpida.c -index 37e808c..e7d2bd5 100644 ---- a/arch/arm/cpu/armv7/omap4/sdram_elpida.c -+++ b/arch/arm/cpu/armv7/omap4/sdram_elpida.c -@@ -29,6 +29,8 @@ - #include <asm/arch/emif.h> - #include <asm/arch/sys_proto.h> - -+#ifdef CONFIG_SYS_EMIF_PRECALCULATED_TIMING_REGS -+ - static const struct emif_regs emif_regs_elpida_200_mhz_2cs = { - .sdram_config_init = 0x80000eb9, - .sdram_config = 0x80001ab9, -@@ -86,6 +88,131 @@ const struct dmm_lisa_map_regs lisa_map_2G_x_2_x_2 = { - - void emif_get_reg_dump_sdp(const struct emif_regs **emif1_regs, - const struct emif_regs **emif2_regs) -+ -+#else -+ -+static const struct lpddr2_ac_timings timings_elpida_400_mhz = { -+ .max_freq = 400000000, -+ .RL = 6, -+ .tRPab = 21, -+ .tRCD = 18, -+ .tWR = 15, -+ .tRASmin = 42, -+ .tRRD = 10, -+ .tWTRx2 = 15, -+ .tXSR = 140, -+ .tXPx2 = 15, -+ .tRFCab = 130, -+ .tRTPx2 = 15, -+ .tCKE = 3, -+ .tCKESR = 15, -+ .tZQCS = 90, -+ .tZQCL = 360, -+ .tZQINIT = 1000, -+ .tDQSCKMAXx2 = 11, -+ .tRASmax = 70, -+ .tFAW = 50 -+}; -+ -+static const struct lpddr2_ac_timings timings_elpida_333_mhz = { -+ .max_freq = 333000000, -+ .RL = 5, -+ .tRPab = 21, -+ .tRCD = 18, -+ .tWR = 15, -+ .tRASmin = 42, -+ .tRRD = 10, -+ .tWTRx2 = 15, -+ .tXSR = 140, -+ .tXPx2 = 15, -+ .tRFCab = 130, -+ .tRTPx2 = 15, -+ .tCKE = 3, -+ .tCKESR = 15, -+ .tZQCS = 90, -+ .tZQCL = 360, -+ .tZQINIT = 1000, -+ .tDQSCKMAXx2 = 11, -+ .tRASmax = 70, -+ .tFAW = 50 -+}; -+ -+static const struct lpddr2_ac_timings timings_elpida_200_mhz = { -+ .max_freq = 200000000, -+ .RL = 3, -+ .tRPab = 21, -+ .tRCD = 18, -+ .tWR = 15, -+ .tRASmin = 42, -+ .tRRD = 10, -+ .tWTRx2 = 20, -+ .tXSR = 140, -+ .tXPx2 = 15, -+ .tRFCab = 130, -+ .tRTPx2 = 15, -+ .tCKE = 3, -+ .tCKESR = 15, -+ .tZQCS = 90, -+ .tZQCL = 360, -+ .tZQINIT = 1000, -+ .tDQSCKMAXx2 = 11, -+ .tRASmax = 70, -+ .tFAW = 50 -+}; -+ -+static const struct lpddr2_min_tck min_tck_elpida = { -+ .tRL = 3, -+ .tRP_AB = 3, -+ .tRCD = 3, -+ .tWR = 3, -+ .tRAS_MIN = 3, -+ .tRRD = 2, -+ .tWTR = 2, -+ .tXP = 2, -+ .tRTP = 2, -+ .tCKE = 3, -+ .tCKESR = 3, -+ .tFAW = 8 -+}; -+ -+static const struct lpddr2_ac_timings *elpida_ac_timings[MAX_NUM_SPEEDBINS] = { -+ &timings_elpida_200_mhz, -+ &timings_elpida_333_mhz, -+ &timings_elpida_400_mhz, -+}; -+ -+static const struct lpddr2_device_details elpida_2G_S4_details = { -+ .type = LPDDR2_TYPE_S4, -+ .density = LPDDR2_DENSITY_2Gb, -+ .io_width = LPDDR2_IO_WIDTH_32, -+ .manufacturer = LPDDR2_MANUFACTURER_ELPIDA -+}; -+ -+static const struct lpddr2_device_timings elpida_2G_S4_timings = { -+ .ac_timings = elpida_ac_timings, -+ .min_tck = &min_tck_elpida, -+}; -+ -+static const struct emif_device_details elpida_2G_S4_x_2 = { -+ .cs0_device_details = &elpida_2G_S4_details, -+ .cs1_device_details = &elpida_2G_S4_details, -+ .cs0_device_timings = &elpida_2G_S4_timings, -+ .cs1_device_timings = &elpida_2G_S4_timings -+}; -+ -+static const struct emif_device_details elpida_2G_S4_x_1 = { -+ .cs0_device_details = &elpida_2G_S4_details, -+ .cs1_device_details = NULL, -+ .cs0_device_timings = &elpida_2G_S4_timings, -+ .cs1_device_timings = NULL -+}; -+ -+#endif /* ifdef CONFIG_SYS_EMIF_PRECALCULATED_TIMING_REGS */ -+ -+#ifdef CONFIG_SYS_EMIF_PRECALCULATED_TIMING_REGS -+ -+static void emif_get_reg_dump_sdp(const struct emif_regs **emif1_regs, -+ const struct emif_regs **emif2_regs) - { - u32 omap4_rev = omap4_revision(); - -@@ -104,7 +231,8 @@ void emif_get_reg_dump(const struct emif_regs **emif1_regs, - const struct emif_regs **emif2_regs) - __attribute__((weak, alias("emif_get_reg_dump_sdp"))); - --void emif_get_dmm_regs_sdp(const struct dmm_lisa_map_regs **dmm_lisa_regs) -+static void emif_get_dmm_regs_sdp(const struct dmm_lisa_map_regs -+ **dmm_lisa_regs) - { - u32 omap_rev = omap4_revision(); - -@@ -116,3 +244,25 @@ void emif_get_dmm_regs_sdp(const struct dmm_lisa_map_regs **dmm_lisa_regs) - - void emif_get_dmm_regs(const struct dmm_lisa_map_regs **dmm_lisa_regs) - __attribute__((weak, alias("emif_get_dmm_regs_sdp"))); -+ -+#else -+ -+static void emif_get_device_details_sdp( -+ const struct emif_device_details **emif1_details, -+ const struct emif_device_details **emif2_details) -+{ -+ u32 omap_rev = omap4_revision(); -+ -+ if (omap_rev == OMAP4430_ES1_0) { -+ *emif1_details = &elpida_2G_S4_x_1; -+ *emif2_details = &elpida_2G_S4_x_1; -+ } else { -+ *emif1_details = &elpida_2G_S4_x_2; -+ *emif2_details = &elpida_2G_S4_x_2; -+ } -+} -+ -+void emif_get_device_details(const struct emif_device_details **emif1_details, -+ const struct emif_device_details **emif2_details) -+ __attribute__((weak, alias("emif_get_device_details_sdp"))); -+#endif -diff --git a/arch/arm/include/asm/arch-omap4/emif.h b/arch/arm/include/asm/arch-omap4/emif.h -index f2d54cb..8cc3230 100644 ---- a/arch/arm/include/asm/arch-omap4/emif.h -+++ b/arch/arm/include/asm/arch-omap4/emif.h -@@ -591,10 +591,142 @@ struct __attribute__ ((__packed__)) dmm_lisa_map_regs { - - #define CS0 0 - #define CS1 1 -+/* The maximum frequency at which the LPDDR2 interface can operate in Hz*/ -+#define MAX_LPDDR2_FREQ 400000000 /* 400 MHz */ -+ -+/* -+ * The period of DDR clk is represented as numerator and denominator for -+ * better accuracy in integer based calculations. However, if the numerator -+ * and denominator are very huge there may be chances of overflow in -+ * calculations. So, as a trade-off keep denominator(and consequently -+ * numerator) within a limit sacrificing some accuracy - but not much -+ * If denominator and numerator are already small (such as at 400 MHz) -+ * no adjustment is needed -+ */ -+#define EMIF_PERIOD_DEN_LIMIT 1000 -+/* -+ * Maximum number of different frequencies supported by EMIF driver -+ * Determines the number of entries in the pointer array for register -+ * cache -+ */ -+#define EMIF_MAX_NUM_FREQUENCIES 6 -+/* -+ * Indices into the Addressing Table array. -+ * One entry each for all the different types of devices with different -+ * addressing schemes -+ */ -+#define ADDR_TABLE_INDEX64M 0 -+#define ADDR_TABLE_INDEX128M 1 -+#define ADDR_TABLE_INDEX256M 2 -+#define ADDR_TABLE_INDEX512M 3 -+#define ADDR_TABLE_INDEX1GS4 4 -+#define ADDR_TABLE_INDEX2GS4 5 -+#define ADDR_TABLE_INDEX4G 6 -+#define ADDR_TABLE_INDEX8G 7 -+#define ADDR_TABLE_INDEX1GS2 8 -+#define ADDR_TABLE_INDEX2GS2 9 -+#define ADDR_TABLE_INDEXMAX 10 -+ -+/* Number of Row bits */ -+#define ROW_9 0 -+#define ROW_10 1 -+#define ROW_11 2 -+#define ROW_12 3 -+#define ROW_13 4 -+#define ROW_14 5 -+#define ROW_15 6 -+#define ROW_16 7 -+ -+/* Number of Column bits */ -+#define COL_8 0 -+#define COL_9 1 -+#define COL_10 2 -+#define COL_11 3 -+#define COL_7 4 /*Not supported by OMAP included for completeness */ -+ -+/* Number of Banks*/ -+#define BANKS1 0 -+#define BANKS2 1 -+#define BANKS4 2 -+#define BANKS8 3 -+ -+/* Refresh rate in micro seconds x 10 */ -+#define T_REFI_15_6 156 -+#define T_REFI_7_8 78 -+#define T_REFI_3_9 39 -+ -+#define EBANK_CS1_DIS 0 -+#define EBANK_CS1_EN 1 -+ - /* Read Latency used by the device at reset */ - #define RL_BOOT 3 - /* Read Latency for the highest frequency you want to use */ - #define RL_FINAL 6 -+ -+/* Interleaving policies at EMIF level- between banks and Chip Selects */ -+#define EMIF_INTERLEAVING_POLICY_MAX_INTERLEAVING 0 -+#define EMIF_INTERLEAVING_POLICY_NO_BANK_INTERLEAVING 3 -+ -+/* -+ * Interleaving policy to be used -+ * Currently set to MAX interleaving for better performance -+ */ -+#define EMIF_INTERLEAVING_POLICY EMIF_INTERLEAVING_POLICY_MAX_INTERLEAVING -+ -+/* State of the core voltage: -+ * This is important for some parameters such as read idle control and -+ * ZQ calibration timings. Timings are much stricter when voltage ramp -+ * is happening compared to when the voltage is stable. -+ * We need to calculate two sets of values for these parameters and use -+ * them accordingly -+ */ -+#define LPDDR2_VOLTAGE_STABLE 0 -+#define LPDDR2_VOLTAGE_RAMPING 1 -+ -+/* Length of the forced read idle period in terms of cycles */ -+#define EMIF_REG_READ_IDLE_LEN_VAL 5 -+ -+/* Interval between forced 'read idles' */ -+/* To be used when voltage is changed for DPS/DVFS - 1us */ -+#define READ_IDLE_INTERVAL_DVFS (1*1000) -+/* -+ * To be used when voltage is not scaled except by Smart Reflex -+ * 50us - or maximum value will do -+ */ -+#define READ_IDLE_INTERVAL_NORMAL (50*1000) -+ -+ -+/* -+ * Unless voltage is changing due to DVFS one ZQCS command every 50ms should -+ * be enough. This shoule be enough also in the case when voltage is changing -+ * due to smart-reflex. -+ */ -+#define EMIF_ZQCS_INTERVAL_NORMAL_IN_US (50*1000) -+/* -+ * If voltage is changing due to DVFS ZQCS should be performed more -+ * often(every 50us) -+ */ -+#define EMIF_ZQCS_INTERVAL_DVFS_IN_US 50 -+ -+/* The interval between ZQCL commands as a multiple of ZQCS interval */ -+#define REG_ZQ_ZQCL_MULT 4 -+/* The interval between ZQINIT commands as a multiple of ZQCL interval */ -+#define REG_ZQ_ZQINIT_MULT 3 -+/* Enable ZQ Calibration on exiting Self-refresh */ -+#define REG_ZQ_SFEXITEN_ENABLE 1 -+/* -+ * ZQ Calibration simultaneously on both chip-selects: -+ * Needs one calibration resistor per CS -+ * None of the boards that we know of have this capability -+ * So disabled by default -+ */ -+#define REG_ZQ_DUALCALEN_DISABLE 0 -+/* -+ * Enable ZQ Calibration by default on CS0. If we are asked to program -+ * the EMIF there will be something connected to CS0 for sure -+ */ -+#define REG_ZQ_CS0EN_ENABLE 1 -+ - /* EMIF_PWR_MGMT_CTRL register */ - /* Low power modes */ - #define LP_MODE_DISABLE 0 -@@ -634,6 +766,16 @@ struct __attribute__ ((__packed__)) dmm_lisa_map_regs { - - /* EMIF_L3_CONFIG register value for ES1*/ - #define EMIF_L3_CONFIG_VAL_SYS_THRESH_0A_LL_THRESH_00 0x0A0000FF -+/* -+ * Value of bits 12:31 of DDR_PHY_CTRL_1 register: -+ * All these fields have magic values dependent on frequency and -+ * determined by PHY and DLL integration with EMIF. Setting the magic -+ * values suggested by hw team. -+ */ -+#define EMIF_DDR_PHY_CTRL_1_BASE_VAL 0x049FF -+#define EMIF_DLL_SLAVE_DLY_CTRL_400_MHZ 0x41 -+#define EMIF_DLL_SLAVE_DLY_CTRL_200_MHZ 0x80 -+#define EMIF_DLL_SLAVE_DLY_CTRL_100_MHZ_AND_LESS 0xFF - - /* - * MR1 value: -@@ -657,16 +799,51 @@ struct __attribute__ ((__packed__)) dmm_lisa_map_regs { - #define MR10_ZQ_ZQINIT 0xFF - #define MR10_ZQ_ZQRESET 0xC3 - -+/* TEMP_ALERT_CONFIG */ -+#define TEMP_ALERT_POLL_INTERVAL_MS 360 /* for temp gradient - 5 C/s */ -+#define TEMP_ALERT_CONFIG_DEVCT_1 0 -+#define TEMP_ALERT_CONFIG_DEVWDT_32 2 -+ - /* MR16 value: refresh full array(no partial array self refresh) */ - #define MR16_REF_FULL_ARRAY 0 - --/* LPDDR2 IO reg values */ -+/* LPDDR2 IO regs */ - #define CONTROL_LPDDR2IO_SLEW_125PS_DRV8_PULL_DOWN 0x1C1C1C1C - #define CONTROL_LPDDR2IO_SLEW_325PS_DRV8_GATE_KEEPER 0x9E9E9E9E - - /* CONTROL_EFUSE_2 */ - #define CONTROL_EFUSE_2_NMOS_PMOS_PTV_CODE_1 0x00ffc000 - -+/* -+ * Maximum number of entries we keep in our array of timing tables -+ * We need not keep all the speed bins supported by the device -+ * We need to keep timing tables for only the speed bins that we -+ * are interested in -+ */ -+#define MAX_NUM_SPEEDBINS 4 -+ -+/* LPDDR2 Densities */ -+#define LPDDR2_DENSITY_64Mb 0 -+#define LPDDR2_DENSITY_128Mb 1 -+#define LPDDR2_DENSITY_256Mb 2 -+#define LPDDR2_DENSITY_512Mb 3 -+#define LPDDR2_DENSITY_1Gb 4 -+#define LPDDR2_DENSITY_2Gb 5 -+#define LPDDR2_DENSITY_4Gb 6 -+#define LPDDR2_DENSITY_8Gb 7 -+#define LPDDR2_DENSITY_16Gb 8 -+#define LPDDR2_DENSITY_32Gb 9 -+ -+/* LPDDR2 type */ -+#define LPDDR2_TYPE_S4 0 -+#define LPDDR2_TYPE_S2 1 -+#define LPDDR2_TYPE_NVM 2 -+ -+/* LPDDR2 IO width */ -+#define LPDDR2_IO_WIDTH_32 0 -+#define LPDDR2_IO_WIDTH_16 1 -+#define LPDDR2_IO_WIDTH_8 2 -+ - /* Mode register numbers */ - #define LPDDR2_MR0 0 - #define LPDDR2_MR1 1 -@@ -692,6 +869,119 @@ struct __attribute__ ((__packed__)) dmm_lisa_map_regs { - #define LPDDR2_MR0_DNVI_SHIFT 2 - #define LPDDR2_MR0_DNVI_MASK (1 << 2) - -+/* MR4 */ -+#define MR4_SDRAM_REF_RATE_SHIFT 0 -+#define MR4_SDRAM_REF_RATE_MASK 7 -+#define MR4_TUF_SHIFT 7 -+#define MR4_TUF_MASK (1 << 7) -+ -+/* MR4 SDRAM Refresh Rate field values */ -+#define SDRAM_TEMP_LESS_LOW_SHUTDOWN 0x0 -+#define SDRAM_TEMP_LESS_4X_REFRESH_AND_TIMINGS 0x1 -+#define SDRAM_TEMP_LESS_2X_REFRESH_AND_TIMINGS 0x2 -+#define SDRAM_TEMP_NOMINAL 0x3 -+#define SDRAM_TEMP_RESERVED_4 0x4 -+#define SDRAM_TEMP_HIGH_DERATE_REFRESH 0x5 -+#define SDRAM_TEMP_HIGH_DERATE_REFRESH_AND_TIMINGS 0x6 -+#define SDRAM_TEMP_VERY_HIGH_SHUTDOWN 0x7 -+ -+#define LPDDR2_MANUFACTURER_SAMSUNG 1 -+#define LPDDR2_MANUFACTURER_QIMONDA 2 -+#define LPDDR2_MANUFACTURER_ELPIDA 3 -+#define LPDDR2_MANUFACTURER_ETRON 4 -+#define LPDDR2_MANUFACTURER_NANYA 5 -+#define LPDDR2_MANUFACTURER_HYNIX 6 -+#define LPDDR2_MANUFACTURER_MOSEL 7 -+#define LPDDR2_MANUFACTURER_WINBOND 8 -+#define LPDDR2_MANUFACTURER_ESMT 9 -+#define LPDDR2_MANUFACTURER_SPANSION 11 -+#define LPDDR2_MANUFACTURER_SST 12 -+#define LPDDR2_MANUFACTURER_ZMOS 13 -+#define LPDDR2_MANUFACTURER_INTEL 14 -+#define LPDDR2_MANUFACTURER_NUMONYX 254 -+#define LPDDR2_MANUFACTURER_MICRON 255 -+ -+/* MR8 register fields */ -+#define MR8_TYPE_SHIFT 0x0 -+#define MR8_TYPE_MASK 0x3 -+#define MR8_DENSITY_SHIFT 0x2 -+#define MR8_DENSITY_MASK (0xF << 0x2) -+#define MR8_IO_WIDTH_SHIFT 0x6 -+#define MR8_IO_WIDTH_MASK (0x3 << 0x6) -+ -+struct lpddr2_addressing { -+ u8 num_banks; -+ u8 t_REFI_us_x10; -+ u8 row_sz[2]; /* One entry each for x32 and x16 */ -+ u8 col_sz[2]; /* One entry each for x32 and x16 */ -+}; -+ -+/* Structure for timings from the DDR datasheet */ -+struct lpddr2_ac_timings { -+ u32 max_freq; -+ u8 RL; -+ u8 tRPab; -+ u8 tRCD; -+ u8 tWR; -+ u8 tRASmin; -+ u8 tRRD; -+ u8 tWTRx2; -+ u8 tXSR; -+ u8 tXPx2; -+ u8 tRFCab; -+ u8 tRTPx2; -+ u8 tCKE; -+ u8 tCKESR; -+ u8 tZQCS; -+ u32 tZQCL; -+ u32 tZQINIT; -+ u8 tDQSCKMAXx2; -+ u8 tRASmax; -+ u8 tFAW; -+ -+}; -+ -+/* -+ * Min tCK values for some of the parameters: -+ * If the calculated clock cycles for the respective parameter is -+ * less than the corresponding min tCK value, we need to set the min -+ * tCK value. This may happen at lower frequencies. -+ */ -+struct lpddr2_min_tck { -+ u32 tRL; -+ u32 tRP_AB; -+ u32 tRCD; -+ u32 tWR; -+ u32 tRAS_MIN; -+ u32 tRRD; -+ u32 tWTR; -+ u32 tXP; -+ u32 tRTP; -+ u8 tCKE; -+ u32 tCKESR; -+ u32 tFAW; -+}; -+ -+struct lpddr2_device_details { -+ u8 type; -+ u8 density; -+ u8 io_width; -+ u8 manufacturer; -+}; -+ -+struct lpddr2_device_timings { -+ const struct lpddr2_ac_timings **ac_timings; -+ const struct lpddr2_min_tck *min_tck; -+}; -+ -+/* Details of the devices connected to each chip-select of an EMIF instance */ -+struct emif_device_details { -+ const struct lpddr2_device_details *cs0_device_details; -+ const struct lpddr2_device_details *cs1_device_details; -+ const struct lpddr2_device_timings *cs0_device_timings; -+ const struct lpddr2_device_timings *cs1_device_timings; -+}; -+ - /* - * Structure containing shadow of important registers in EMIF - * The calculation function fills in this structure to be later used for -@@ -712,8 +1002,20 @@ struct emif_regs { - u32 emif_ddr_phy_ctlr_1; - }; - -+/* assert macros */ -+#if defined(DEBUG) -+#define emif_assert(c) ({ if (!(c)) for (;;); }) -+#else -+#define emif_assert(c) ({ if (0) hang(); }) -+#endif -+ -+#ifdef CONFIG_SYS_EMIF_PRECALCULATED_TIMING_REGS - void emif_get_reg_dump(const struct emif_regs **emif1_regs, - const struct emif_regs **emif2_regs); - void emif_get_dmm_regs(const struct dmm_lisa_map_regs **dmm_lisa_regs); -+#else -+void emif_get_device_details(const struct emif_device_details **emif1_details, -+ const struct emif_device_details **emif2_details); -+#endif - - #endif -diff --git a/arch/arm/include/asm/arch-omap4/omap4.h b/arch/arm/include/asm/arch-omap4/omap4.h -index a1c4883..fd8fb10 100644 ---- a/arch/arm/include/asm/arch-omap4/omap4.h -+++ b/arch/arm/include/asm/arch-omap4/omap4.h -@@ -86,12 +86,7 @@ - /* GPMC */ - #define OMAP44XX_GPMC_BASE 0x50000000 - --/* DMM */ --#define OMAP44XX_DMM_BASE 0x4E000000 --#define DMM_LISA_MAP_BASE (OMAP44XX_DMM_BASE + 0x40) --#define DMM_LISA_MAP_SYS_SIZE_MASK (7 << 20) --#define DMM_LISA_MAP_SYS_SIZE_SHIFT 20 --#define DMM_LISA_MAP_SYS_ADDR_MASK (0xFF << 24) -+ - /* - * Hardware Register Details - */ -@@ -137,6 +132,17 @@ struct s32ktimer { - /* Temporary SRAM stack used while low level init is done */ - #define LOW_LEVEL_SRAM_STACK NON_SECURE_SRAM_END - -+#define SRAM_SCRATCH_SPACE_ADDR NON_SECURE_SRAM_START -+ -+/* -+ * SRAM scratch space entries -+ */ -+ -+/* Boot parameter passed from SPL to U-Boot */ -+#define OMAP4_SRAM_SCRATCH_EMIF_SIZE SRAM_SCRATCH_SPACE_ADDR -+#define OMAP4_SRAM_SCRATCH_EMIF_T_NUM (SRAM_SCRATCH_SPACE_ADDR + 0x8) -+#define OMAP4_SRAM_SCRATCH_EMIF_T_DEN (SRAM_SCRATCH_SPACE_ADDR + 0xC) -+ - /* Silicon revisions */ - #define OMAP4430_SILICON_ID_INVALID 0 - #define OMAP4430_ES1_0 1 -diff --git a/arch/arm/include/asm/arch-omap4/sys_proto.h b/arch/arm/include/asm/arch-omap4/sys_proto.h -index 4beff42..211d3b8 100644 ---- a/arch/arm/include/asm/arch-omap4/sys_proto.h -+++ b/arch/arm/include/asm/arch-omap4/sys_proto.h -@@ -44,6 +44,7 @@ void bypass_dpll(u32 base); - void freq_update_core(void); - u32 get_syc_clk_freq(void); - u32 omap4_ddr_clk(void); -+void cancel_out(u32 *num, u32 *den, u32 den_limit); - void sdram_init(void); - u32 omap4_revision(void); - -diff --git a/arch/arm/include/asm/omap_common.h b/arch/arm/include/asm/omap_common.h -index 49daa85..9f2616c 100644 ---- a/arch/arm/include/asm/omap_common.h -+++ b/arch/arm/include/asm/omap_common.h -@@ -51,6 +51,27 @@ - (addr));\ - } while (0); - -+/* find log2 of number n - rounded up */ -+static inline u32 log_2_n_round_up(u32 n) -+{ -+ u32 clz; -+ /* count leading zeros */ -+ asm volatile ("CLZ %0, %1" : "=r" (clz) : "r" (n)); -+ if (n & (n - 1)) -+ return 31 - clz; /* power of 2 */ -+ else -+ return 32 - clz; /* not power of 2 - round up */ -+} -+ -+/* find log2 of number n - rounded down */ -+static inline u32 log_2_n_round_down(u32 n) -+{ -+ u32 clz; -+ /* count leading zeros */ -+ asm volatile ("CLZ %0, %1" : "=r" (clz) : "r" (n)); -+ return 31 - clz; -+} -+ - /* Boot device */ - #define BOOT_DEVICE_NONE 0 - #define BOOT_DEVICE_XIP 1 -diff --git a/include/configs/omap4_sdp4430.h b/include/configs/omap4_sdp4430.h -index 07d45a0..c29b184 100644 ---- a/include/configs/omap4_sdp4430.h -+++ b/include/configs/omap4_sdp4430.h -@@ -245,6 +245,11 @@ - /* Defines for Clock init */ - #define CONFIG_SYS_OMAP4_ABE_SYSCK - -+/* Defines for SDRAM init */ -+#ifndef CONFIG_SYS_EMIF_PRECALCULATED_TIMING_REGS -+#define CONFIG_SYS_DEFAULT_LPDDR2_TIMINGS 1 -+#endif -+ - /* Defines for SPL */ - #define CONFIG_SPL - #define CONFIG_SYS_SPL_TEXT_BASE 0x40304360 -diff --git a/spl/board/ti/sdp4430/Makefile b/spl/board/ti/sdp4430/Makefile -index 1f25f77..d89dea0 100644 ---- a/spl/board/ti/sdp4430/Makefile -+++ b/spl/board/ti/sdp4430/Makefile -@@ -81,6 +81,10 @@ SOBJS += start.o - COBJS += syslib.o - - # omap-common -+$(obj)utils.c: -+ @rm -f $@ -+ @ln -s $(TOPDIR)/arch/arm/cpu/armv7/omap-common/utils.c $@ -+ - $(obj)timer.c: - @rm -f $@ - @ln -s $(TOPDIR)/arch/arm/cpu/armv7/omap-common/timer.c $@ -@@ -94,7 +98,7 @@ $(obj)spl-omap.c: - @ln -s $(TOPDIR)/spl/board/ti/spl-omap.c $@ - - SOBJS += reset.o --COBJS += timer.o spl-omap.o -+COBJS += utils.o timer.o spl-omap.o - - $(OBJTREE)/MLO: $(splobj)u-boot-spl.bin - $(OBJTREE)/tools/mkimage -T omapimage \ --- -1.7.2.3 - diff --git a/packages/tools/u-boot/patches/2011.03-rc1/u-boot-2011.03-rc1-0018-omap4-automatic-sdram-detection.patch b/packages/tools/u-boot/patches/2011.03-rc1/u-boot-2011.03-rc1-0018-omap4-automatic-sdram-detection.patch deleted file mode 100644 index c7bda75fc82..00000000000 --- a/packages/tools/u-boot/patches/2011.03-rc1/u-boot-2011.03-rc1-0018-omap4-automatic-sdram-detection.patch +++ /dev/null @@ -1,304 +0,0 @@ -From e7c2c0d5c3834c6ddfc826f1ae9f07406265afcf Mon Sep 17 00:00:00 2001 -From: Aneesh V <aneesh@ti.com> -Date: Fri, 25 Feb 2011 18:07:13 +0530 -Subject: [PATCH 18/22] omap4: automatic sdram detection - -Identify SDRAM devices connected to EMIF automatically: -LPDDR2 devices have some Mode Registers that provide details -about the device such as the type, density, bus width -etc. EMIF has the capability to read these registers. If there -are not devices connected to a given chip-select reading mode -registers will return junk values. After reading as many such -registers as possible and matching with expected ranges of -values the driver can identify if there is a device connected -to the respective CS. If we identify that a device is connected -the values read give us complete details about the device. - -This along with the base AC timings specified by JESD209-2 -allows us to do a complete automatic initialization of -SDRAM that works on all boards. - -Please note that the default AC timings specified by JESD209-2 -will be safe for all devices but not necessarily optimal. However, -for the Elpida devices used on Panda and SDP the default timings -are both safe and optimal. - -Signed-off-by: Aneesh V <aneesh@ti.com> ---- - arch/arm/cpu/armv7/omap4/emif.c | 177 +++++++++++++++++++++++++++++- - arch/arm/cpu/armv7/omap4/sdram_elpida.c | 9 +- - include/configs/omap4_sdp4430.h | 1 + - 3 files changed, 176 insertions(+), 11 deletions(-) - -diff --git a/arch/arm/cpu/armv7/omap4/emif.c b/arch/arm/cpu/armv7/omap4/emif.c -index 1bdb1d2..006d065 100644 ---- a/arch/arm/cpu/armv7/omap4/emif.c -+++ b/arch/arm/cpu/armv7/omap4/emif.c -@@ -165,7 +165,8 @@ static const struct lpddr2_min_tck min_tck_jedec = { - .tFAW = 8 - }; - --static const struct lpddr2_ac_timings *jedec_ac_timings[MAX_NUM_SPEEDBINS] = { -+static const struct lpddr2_ac_timings const* -+ jedec_ac_timings[MAX_NUM_SPEEDBINS] = { - &timings_jedec_200_mhz, - &timings_jedec_333_mhz, - &timings_jedec_400_mhz -@@ -779,6 +780,146 @@ void emif_reset_phy(u32 base) - writel(iodft, &emif->emif_iodft_tlgc); - } - -+#ifdef CONFIG_SYS_AUTOMATIC_SDRAM_DETECTION -+static void display_sdram_details(u32 emif_nr, u32 cs, -+ struct lpddr2_device_details *device) -+{ -+ const char *mfg_str; -+ const char *type_str; -+ char density_str[10]; -+ u32 density; -+ -+ debug("EMIF%d CS%d\t", emif_nr, cs); -+ -+ if (!device) { -+ debug("None\n"); -+ return; -+ } -+ -+ mfg_str = get_lpddr2_manufacturer(device->manufacturer); -+ type_str = get_lpddr2_type(device->type); -+ -+ density = lpddr2_density_2_size_in_mbytes[device->density]; -+ if ((density / 1024 * 1024) == density) { -+ density /= 1024; -+ sprintf(density_str, "%d GB", density); -+ } else -+ sprintf(density_str, "%d MB", density); -+ if (mfg_str && type_str) -+ debug("%s\t\t%s\t%s\n", mfg_str, type_str, density_str); -+} -+ -+static u8 is_lpddr2_sdram_present(u32 base, u32 cs, -+ struct lpddr2_device_details *lpddr2_device) -+{ -+ u32 mr = 0, temp; -+ -+ mr = get_mr(base, cs, LPDDR2_MR0); -+ if (mr > 0xFF) { -+ /* Mode register value bigger than 8 bit */ -+ return 0; -+ } -+ -+ temp = get_bit_field(mr, LPDDR2_MR0_DI_SHIFT, LPDDR2_MR0_DI_MASK); -+ if (temp) { -+ /* Not SDRAM */ -+ return 0; -+ } -+ temp = get_bit_field(mr, LPDDR2_MR0_DNVI_SHIFT, LPDDR2_MR0_DNVI_MASK); -+ -+ if (temp) { -+ /* DNV supported - But DNV is only supported for NVM */ -+ return 0; -+ } -+ -+ mr = get_mr(base, cs, LPDDR2_MR4); -+ if (mr > 0xFF) { -+ /* Mode register value bigger than 8 bit */ -+ return 0; -+ } -+ -+ mr = get_mr(base, cs, LPDDR2_MR5); -+ if (mr >= 0xFF) { -+ /* Mode register value bigger than 8 bit */ -+ return 0; -+ } -+ -+ if (!get_lpddr2_manufacturer(mr)) { -+ /* Manufacturer not identified */ -+ return 0; -+ } -+ lpddr2_device->manufacturer = mr; -+ -+ mr = get_mr(base, cs, LPDDR2_MR6); -+ if (mr >= 0xFF) { -+ /* Mode register value bigger than 8 bit */ -+ return 0; -+ } -+ -+ mr = get_mr(base, cs, LPDDR2_MR7); -+ if (mr >= 0xFF) { -+ /* Mode register value bigger than 8 bit */ -+ return 0; -+ } -+ -+ mr = get_mr(base, cs, LPDDR2_MR8); -+ if (mr >= 0xFF) { -+ /* Mode register value bigger than 8 bit */ -+ return 0; -+ } -+ -+ temp = get_bit_field(mr, MR8_TYPE_SHIFT, MR8_TYPE_MASK); -+ if (!get_lpddr2_type(temp)) { -+ /* Not SDRAM */ -+ return 0; -+ } -+ lpddr2_device->type = temp; -+ -+ temp = get_bit_field(mr, MR8_DENSITY_SHIFT, MR8_DENSITY_MASK); -+ if (temp > LPDDR2_DENSITY_32Gb) { -+ /* Density not supported */ -+ return 0; -+ } -+ lpddr2_device->density = temp; -+ -+ temp = get_bit_field(mr, MR8_IO_WIDTH_SHIFT, MR8_IO_WIDTH_MASK); -+ if (!get_lpddr2_io_width(temp)) { -+ /* IO width unsupported value */ -+ return 0; -+ } -+ lpddr2_device->io_width = temp; -+ -+ /* -+ * If all the above tests pass we should -+ * have a device on this chip-select -+ */ -+ return 1; -+} -+ -+static struct lpddr2_device_details *get_lpddr2_details(u32 base, u8 cs, -+ struct lpddr2_device_details *lpddr2_dev_details) -+{ -+ u32 phy; -+ struct emif_reg_struct *emif = (struct emif_reg_struct *)base; -+ -+ if (!lpddr2_dev_details) -+ return NULL; -+ -+ /* Do the minimum init for mode register accesses */ -+ if (!running_from_sdram()) { -+ phy = get_ddr_phy_ctrl_1(get_syc_clk_freq() / 2, RL_BOOT); -+ writel(phy, &emif->emif_ddr_phy_ctrl_1); -+ } -+ -+ if (!(is_lpddr2_sdram_present(base, cs, lpddr2_dev_details))) -+ return NULL; -+ -+ display_sdram_details(emif_num(base), cs, lpddr2_dev_details); -+ -+ return lpddr2_dev_details; -+} -+#endif /* CONFIG_SYS_AUTOMATIC_SDRAM_DETECTION */ -+ - static void do_lpddr2_init(u32 base, u32 cs) - { - u32 mr_addr; -@@ -862,9 +1003,7 @@ static void emif_update_timings(u32 base, const struct emif_regs *regs) - - static void do_sdram_init(u32 base) - { -- struct emif_device_details dev_details; - const struct emif_regs *regs; -- - u32 in_sdram, emif_nr; - - in_sdram = running_from_sdram(); -@@ -872,6 +1011,7 @@ static void do_sdram_init(u32 base) - - #ifdef CONFIG_SYS_EMIF_PRECALCULATED_TIMING_REGS - const struct emif_regs *tmp_regs; -+ - emif_get_reg_dump(&regs, &tmp_regs); - regs = (emif_nr == 1) ? regs : tmp_regs; - #else -@@ -879,23 +1019,48 @@ static void do_sdram_init(u32 base) - * The user has not provided the register values. We need to - * calculate it based on the timings and the DDR frequency - */ -+ struct emif_device_details dev_details = { NULL, NULL }; -+ struct emif_regs calculated_regs; - -+#if !defined(CONFIG_SYS_AUTOMATIC_SDRAM_DETECTION) || \ -+ !defined(CONFIG_SYS_DEFAULT_LPDDR2_TIMINGS) -+ -+ /* We need some input about the devices from the user */ - const struct emif_device_details *dev_details_user_provided; - const struct emif_device_details *tmp_details; -- struct emif_regs calculated_regs; - -- /* We need some input about the devices from the user */ - emif_get_device_details(&dev_details_user_provided, &tmp_details); - dev_details_user_provided = (emif_nr == 1) ? dev_details_user_provided - : tmp_details; - if (!dev_details_user_provided) - return; -+#endif - -+#ifdef CONFIG_SYS_AUTOMATIC_SDRAM_DETECTION -+ struct lpddr2_device_details cs0_dev_details, cs1_dev_details; -+ -+ /* Automatically find the device details */ -+ if (!in_sdram) { -+ dev_details.cs0_device_details = -+ get_lpddr2_details(base, CS0, &cs0_dev_details); -+ dev_details.cs1_device_details = -+ get_lpddr2_details(base, CS1, &cs1_dev_details); -+ /* -+ * Reset the PHY - if there is nothing connected on any -+ * of the chip selects(typically CS1) mode register reads -+ * will mess up with the PHY state and subsequent -+ * initialization won't work. PHY reset brings back PHY to -+ * a good state. -+ */ -+ emif_reset_phy(base); -+ } -+#else - dev_details.cs0_device_details = - dev_details_user_provided->cs0_device_details; - dev_details.cs1_device_details = - dev_details_user_provided->cs1_device_details; - -+#endif - /* Return if no devices on this EMIF */ - if (!dev_details.cs0_device_details && - !dev_details.cs1_device_details) { -diff --git a/arch/arm/cpu/armv7/omap4/sdram_elpida.c b/arch/arm/cpu/armv7/omap4/sdram_elpida.c -index e7d2bd5..8dfe6f9 100644 ---- a/arch/arm/cpu/armv7/omap4/sdram_elpida.c -+++ b/arch/arm/cpu/armv7/omap4/sdram_elpida.c -@@ -86,10 +86,8 @@ const struct dmm_lisa_map_regs lisa_map_2G_x_2_x_2 = { - .dmm_lisa_map_3 = 0x80640300 - }; - --void emif_get_reg_dump_sdp(const struct emif_regs **emif1_regs, -- const struct emif_regs **emif2_regs) -- --#else -+#elif !defined(CONFIG_SYS_AUTOMATIC_SDRAM_DETECTION) || \ -+ !defined(CONFIG_SYS_DEFAULT_LPDDR2_TIMINGS) - - static const struct lpddr2_ac_timings timings_elpida_400_mhz = { - .max_freq = 400000000, -@@ -245,7 +243,8 @@ static void emif_get_dmm_regs_sdp(const struct dmm_lisa_map_regs - void emif_get_dmm_regs(const struct dmm_lisa_map_regs **dmm_lisa_regs) - __attribute__((weak, alias("emif_get_dmm_regs_sdp"))); - --#else -+#elif !defined(CONFIG_SYS_AUTOMATIC_SDRAM_DETECTION) || \ -+ !defined(CONFIG_SYS_DEFAULT_LPDDR2_TIMINGS) - - static void emif_get_device_details_sdp( - const struct emif_device_details **emif1_details, -diff --git a/include/configs/omap4_sdp4430.h b/include/configs/omap4_sdp4430.h -index c29b184..a4332b7 100644 ---- a/include/configs/omap4_sdp4430.h -+++ b/include/configs/omap4_sdp4430.h -@@ -247,6 +247,7 @@ - - /* Defines for SDRAM init */ - #ifndef CONFIG_SYS_EMIF_PRECALCULATED_TIMING_REGS -+#define CONFIG_SYS_AUTOMATIC_SDRAM_DETECTION 1 - #define CONFIG_SYS_DEFAULT_LPDDR2_TIMINGS 1 - #endif - --- -1.7.2.3 - diff --git a/packages/tools/u-boot/patches/2011.03-rc1/u-boot-2011.03-rc1-0019-armv7-embed-u-boot-size-within-u-boot-for-use-from-S.patch b/packages/tools/u-boot/patches/2011.03-rc1/u-boot-2011.03-rc1-0019-armv7-embed-u-boot-size-within-u-boot-for-use-from-S.patch deleted file mode 100644 index eda823cf536..00000000000 --- a/packages/tools/u-boot/patches/2011.03-rc1/u-boot-2011.03-rc1-0019-armv7-embed-u-boot-size-within-u-boot-for-use-from-S.patch +++ /dev/null @@ -1,48 +0,0 @@ -From fe036a666363c51905cdf9a88d3c21f5e702b35c Mon Sep 17 00:00:00 2001 -From: Aneesh V <aneesh@ti.com> -Date: Sat, 26 Feb 2011 17:15:11 +0530 -Subject: [PATCH 19/22] armv7: embed u-boot size within u-boot for use from SPL - -Embed the u-boot flash image size at a known offset from the -start of u-boot so that SPL can use it while loading u-boot -from a non-XIP media. - -Signed-off-by: Aneesh V <aneesh@ti.com> ---- - arch/arm/cpu/armv7/start.S | 6 +++++- - spl/board/ti/spl-omap.lds | 1 + - 2 files changed, 6 insertions(+), 1 deletions(-) - -diff --git a/arch/arm/cpu/armv7/start.S b/arch/arm/cpu/armv7/start.S -index f5f08d9..1cbd128 100644 ---- a/arch/arm/cpu/armv7/start.S -+++ b/arch/arm/cpu/armv7/start.S -@@ -64,8 +64,12 @@ _pad: .word 0x12345678 /* now 16*4=64 */ - - .global _end_vect - _end_vect: -+.global _u_boot_size -+_u_boot_size: -+ .word 0xDEADBEEF -+ .word __flash_image_end - _start - -- .balignl 16,0xdeadbeef -+.balignl 16,0xdeadbeef - /************************************************************************* - * - * Startup Code (reset vector) -diff --git a/spl/board/ti/spl-omap.lds b/spl/board/ti/spl-omap.lds -index 27b5295..64eb4c9 100644 ---- a/spl/board/ti/spl-omap.lds -+++ b/spl/board/ti/spl-omap.lds -@@ -50,6 +50,7 @@ SECTIONS - .data : { *(SORT_BY_ALIGNMENT(.data*)) } >.sram - . = ALIGN(4); - __image_copy_end = .; -+ __flash_image_end = .; - - .bss : - { --- -1.7.2.3 - diff --git a/packages/tools/u-boot/patches/2011.03-rc1/u-boot-2011.03-rc1-0020-omap-add-MMC-support-to-SPL.patch b/packages/tools/u-boot/patches/2011.03-rc1/u-boot-2011.03-rc1-0020-omap-add-MMC-support-to-SPL.patch deleted file mode 100644 index 8d5a437f8b7..00000000000 --- a/packages/tools/u-boot/patches/2011.03-rc1/u-boot-2011.03-rc1-0020-omap-add-MMC-support-to-SPL.patch +++ /dev/null @@ -1,245 +0,0 @@ -From 8ead31f9eee7c63b1679c387af98b834f2123b6d Mon Sep 17 00:00:00 2001 -From: Aneesh V <aneesh@ti.com> -Date: Thu, 17 Feb 2011 18:02:44 +0530 -Subject: [PATCH 20/22] omap: add MMC support to SPL - -Signed-off-by: Aneesh V <aneesh@ti.com> ---- - arch/arm/cpu/armv7/start.S | 1 + - arch/arm/include/asm/omap_common.h | 4 + - include/configs/omap4_sdp4430.h | 7 ++- - spl/board/ti/sdp4430/Makefile | 35 +++++++++++ - spl/board/ti/spl-omap.c | 112 +++++++++++++++++++++++++++++++++++- - 5 files changed, 156 insertions(+), 3 deletions(-) - -diff --git a/arch/arm/cpu/armv7/start.S b/arch/arm/cpu/armv7/start.S -index 1cbd128..927476c 100644 ---- a/arch/arm/cpu/armv7/start.S -+++ b/arch/arm/cpu/armv7/start.S -@@ -64,6 +64,7 @@ _pad: .word 0x12345678 /* now 16*4=64 */ - - .global _end_vect - _end_vect: -+/* This label should be at the same location for SPL and U-Boot */ - .global _u_boot_size - _u_boot_size: - .word 0xDEADBEEF -diff --git a/arch/arm/include/asm/omap_common.h b/arch/arm/include/asm/omap_common.h -index 9f2616c..c2efa7c 100644 ---- a/arch/arm/include/asm/omap_common.h -+++ b/arch/arm/include/asm/omap_common.h -@@ -99,4 +99,8 @@ u32 omap_boot_device(void); - u32 omap_boot_mode(void); - void preloader_console_init(void); - -+/* symbols from start.S */ -+extern u32 _u_boot_size; -+extern u32 _start; -+ - #endif /* _OMAP_COMMON_H_ */ -diff --git a/include/configs/omap4_sdp4430.h b/include/configs/omap4_sdp4430.h -index a4332b7..0ed474d 100644 ---- a/include/configs/omap4_sdp4430.h -+++ b/include/configs/omap4_sdp4430.h -@@ -257,7 +257,10 @@ - #define CONFIG_SYS_SPL_MAX_SIZE 0x7800 /* 30 K */ - #define CONFIG_SYS_SPL_STACK LOW_LEVEL_SRAM_STACK - --#define CONFIG_SYS_SPL_BSS_START_ADDR 0x80000000 --#define CONFIG_SYS_SPL_BSS_MAX_SIZE 0x80000 /* 512 KB */ -+#define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR 0x300 /* address 0x60000 */ -+#define CONFIG_SYS_U_BOOT_MAX_SIZE_SECTORS 0x200 /* 256 KB */ -+ -+#define CONFIG_SYS_SPL_BSS_START_ADDR 0x80000000 -+#define CONFIG_SYS_SPL_BSS_MAX_SIZE 0x80000 /* 512 KB */ - - #endif /* __CONFIG_H */ -diff --git a/spl/board/ti/sdp4430/Makefile b/spl/board/ti/sdp4430/Makefile -index d89dea0..18c5b8e 100644 ---- a/spl/board/ti/sdp4430/Makefile -+++ b/spl/board/ti/sdp4430/Makefile -@@ -68,6 +68,41 @@ $(obj)ctype.c: - COBJS += serial.o ns16550.o string.o vsprintf.o console.o stdio.o - COBJS += ctype.o eabi_compat.o div64.o - -+ -+# mmc -+$(obj)mmc.c: -+ @rm -f $@ -+ @ln -s $(TOPDIR)/drivers/mmc/mmc.c $@ -+ -+$(obj)omap_hsmmc.c: -+ @rm -f $@ -+ @ln -s $(TOPDIR)/drivers/mmc/omap_hsmmc.c $@ -+ -+$(obj)omap24xx_i2c.c: $(obj)omap24xx_i2c.h -+ @rm -f $@ -+ @ln -s $(TOPDIR)/drivers/i2c/omap24xx_i2c.c $@ -+ -+$(obj)omap24xx_i2c.h: -+ @rm -f $@ -+ @ln -s $(TOPDIR)/drivers/i2c/omap24xx_i2c.h $@ -+ -+$(obj)time.c: -+ @rm -f $@ -+ @ln -s $(TOPDIR)/lib/time.c $@ -+ -+$(obj)part.c: -+ @rm -f $@ -+ @ln -s $(TOPDIR)/disk/part.c $@ -+ -+$(obj)part_dos.c: $(obj)part_dos.h -+ @rm -f $@ -+ @ln -s $(TOPDIR)/disk/part_dos.c $@ -+ -+$(obj)part_dos.h: -+ @rm -f $@ -+ @ln -s $(TOPDIR)/disk/part_dos.h $@ -+ -+COBJS += omap_hsmmc.o omap24xx_i2c.o mmc.o time.o part.o part_dos.o - # armv7 - $(obj)start.S: - @rm -f $@ -diff --git a/spl/board/ti/spl-omap.c b/spl/board/ti/spl-omap.c -index 57ddb7d..b64eac9 100644 ---- a/spl/board/ti/spl-omap.c -+++ b/spl/board/ti/spl-omap.c -@@ -28,24 +28,134 @@ - #include <common.h> - #include <asm/u-boot.h> - #include <asm/arch/sys_proto.h> -+#include <mmc.h> - #include <timestamp_autogenerated.h> -+#include <asm/omap_common.h> -+#include <asm/arch/mmc_host_def.h> -+#include <i2c.h> - - /* Define global data structure pointer to it*/ - gd_t gdata __attribute__ ((section(".data"))); - bd_t bdata __attribute__ ((section(".data"))); - gd_t *gd = &gdata; - -+typedef void (*u_boot_entry_t)(void)__attribute__ ((noreturn)); -+ - void board_init_f(ulong dummy) - { - relocate_code(CONFIG_SYS_SPL_STACK, &gdata, CONFIG_SYS_SPL_TEXT_BASE); - } - --void board_init_r(gd_t *id, ulong dummy) -+inline void hang(void) - { -+ puts("### ERROR ### Please RESET the board ###\n"); - for (;;) - ; - } - -+#ifdef CONFIG_GENERIC_MMC -+int board_mmc_init(bd_t *bis) -+{ -+ omap_mmc_init(0); -+ omap_mmc_init(1); -+ return 0; -+} -+#endif -+ -+static void mmc_load_uboot_raw(struct mmc *mmc, u32 mmc_dev) -+{ -+ u32 u_boot_size_sectors, err; -+ u32 *u_boot_size = (u32 *)(CONFIG_SYS_TEXT_BASE + -+ (u32) &_u_boot_size - (u32) &_start); -+ -+ /* read one sector first to find u-boot size */ -+ err = mmc->block_dev.block_read(mmc_dev, -+ CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR, 1, -+ (void *)CONFIG_SYS_TEXT_BASE); -+ if (err <= 0) -+ goto end; -+ -+ if (*u_boot_size != 0xDEADBEEF) { -+ err = 0xDEADBEEF; -+ goto end; -+ } -+ -+ /* move to the next word that has size */ -+ u_boot_size++; -+ -+ /* -+ * convert size to sectors - round down is fine because we have -+ * already read 1 sector -+ */ -+ u_boot_size_sectors = *u_boot_size/MMCSD_SECTOR_SIZE; -+ debug("spl: u-boot raw sectors - %d\n", u_boot_size_sectors + 1); -+ /* read one sector first to find u-boot size */ -+ err = mmc->block_dev.block_read(mmc_dev, -+ CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR + 1, -+ u_boot_size_sectors, -+ (void *)(CONFIG_SYS_TEXT_BASE + MMCSD_SECTOR_SIZE)); -+end: -+ if (err <= 0) { -+ printf("spl: mmc blk read err - %d\n", err); -+ hang(); -+ } -+} -+ -+static void mmc_load_uboot(u32 mmc_dev) -+{ -+ struct mmc *mmc; -+ int err; -+ u32 boot_mode; -+ -+ mmc_initialize(gd->bd); -+ mmc = find_mmc_device(mmc_dev); -+ if (!mmc) { -+ puts("spl: mmc device not found!!\n"); -+ hang(); -+ } -+ -+ err = mmc_init(mmc); -+ if (err) { -+ printf("spl: mmc init failed: mmc_dev - %d err - %d\n", -+ mmc_dev, err); -+ hang(); -+ } -+ -+ boot_mode = omap_boot_mode(); -+ if (boot_mode == MMCSD_MODE_RAW) -+ mmc_load_uboot_raw(mmc, mmc_dev); -+ else { -+ puts("spl: wrong MMC boot mode\n"); -+ hang(); -+ } -+} -+ -+void board_init_r(gd_t *id, ulong dummy) -+{ -+ u32 boot_device; -+ u_boot_entry_t u_boot_entry = (u_boot_entry_t) CONFIG_SYS_TEXT_BASE; -+ -+ timer_init(); -+ i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE); -+ boot_device = omap_boot_device(); -+ switch (boot_device) { -+ case BOOT_DEVICE_MMC1: -+ case BOOT_DEVICE_MMC2: -+ mmc_load_uboot(boot_device - BOOT_DEVICE_MMC1); -+ break; -+ default: -+ printf("SPL: Un-supported Boot Device - %d!!!\n", boot_device); -+ hang(); -+ break; -+ } -+ -+ /* -+ * Jump to u-boot with magic number as input to indicate that it -+ * was loaded by SPL -+ */ -+ u_boot_entry(); -+} -+ - void preloader_console_init(void) - { - gd->bd = &bdata; --- -1.7.2.3 - diff --git a/packages/tools/u-boot/patches/2011.03-rc1/u-boot-2011.03-rc1-0021-omap-spl-add-FAT-support-over-MMC.patch b/packages/tools/u-boot/patches/2011.03-rc1/u-boot-2011.03-rc1-0021-omap-spl-add-FAT-support-over-MMC.patch deleted file mode 100644 index 4213fe26a1b..00000000000 --- a/packages/tools/u-boot/patches/2011.03-rc1/u-boot-2011.03-rc1-0021-omap-spl-add-FAT-support-over-MMC.patch +++ /dev/null @@ -1,93 +0,0 @@ -From 2b9e1ea9f94b94388345a1b74d2ecf6b4f9be1c1 Mon Sep 17 00:00:00 2001 -From: Aneesh V <aneesh@ti.com> -Date: Thu, 17 Feb 2011 18:07:08 +0530 -Subject: [PATCH 21/22] omap: spl: add FAT support over MMC - -Signed-off-by: Aneesh V <aneesh@ti.com> ---- - include/configs/omap4_sdp4430.h | 1 + - spl/board/ti/sdp4430/Makefile | 8 ++++++++ - spl/board/ti/spl-omap.c | 22 ++++++++++++++++++++++ - 3 files changed, 31 insertions(+), 0 deletions(-) - -diff --git a/include/configs/omap4_sdp4430.h b/include/configs/omap4_sdp4430.h -index 0ed474d..dcc9e39 100644 ---- a/include/configs/omap4_sdp4430.h -+++ b/include/configs/omap4_sdp4430.h -@@ -259,6 +259,7 @@ - - #define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR 0x300 /* address 0x60000 */ - #define CONFIG_SYS_U_BOOT_MAX_SIZE_SECTORS 0x200 /* 256 KB */ -+#define CONFIG_SYS_MMC_SD_FAT_BOOT_PARTITION 1 - - #define CONFIG_SYS_SPL_BSS_START_ADDR 0x80000000 - #define CONFIG_SYS_SPL_BSS_MAX_SIZE 0x80000 /* 512 KB */ -diff --git a/spl/board/ti/sdp4430/Makefile b/spl/board/ti/sdp4430/Makefile -index 18c5b8e..8310db9 100644 ---- a/spl/board/ti/sdp4430/Makefile -+++ b/spl/board/ti/sdp4430/Makefile -@@ -103,6 +103,14 @@ $(obj)part_dos.h: - @ln -s $(TOPDIR)/disk/part_dos.h $@ - - COBJS += omap_hsmmc.o omap24xx_i2c.o mmc.o time.o part.o part_dos.o -+ -+# fat -+$(obj)fat.c: -+ @rm -f $@ -+ @ln -s $(TOPDIR)/fs/fat/fat.c $@ -+ -+COBJS += fat.o -+ - # armv7 - $(obj)start.S: - @rm -f $@ -diff --git a/spl/board/ti/spl-omap.c b/spl/board/ti/spl-omap.c -index b64eac9..3612434 100644 ---- a/spl/board/ti/spl-omap.c -+++ b/spl/board/ti/spl-omap.c -@@ -29,6 +29,7 @@ - #include <asm/u-boot.h> - #include <asm/arch/sys_proto.h> - #include <mmc.h> -+#include <fat.h> - #include <timestamp_autogenerated.h> - #include <asm/omap_common.h> - #include <asm/arch/mmc_host_def.h> -@@ -101,6 +102,25 @@ end: - } - } - -+static void mmc_load_uboot_fat(struct mmc *mmc) -+{ -+ s32 err; -+ -+ err = fat_register_device(&mmc->block_dev, -+ CONFIG_SYS_MMC_SD_FAT_BOOT_PARTITION); -+ if (err) { -+ printf("spl: fat register err - %d\n", err); -+ hang(); -+ } -+ -+ err = file_fat_read("u-boot.bin", (u8 *)CONFIG_SYS_TEXT_BASE, 0); -+ -+ if (err <= 0) { -+ printf("spl: error reading u-boot.bin - %d\n", err); -+ hang(); -+ } -+} -+ - static void mmc_load_uboot(u32 mmc_dev) - { - struct mmc *mmc; -@@ -124,6 +144,8 @@ static void mmc_load_uboot(u32 mmc_dev) - boot_mode = omap_boot_mode(); - if (boot_mode == MMCSD_MODE_RAW) - mmc_load_uboot_raw(mmc, mmc_dev); -+ else if (boot_mode == MMCSD_MODE_FAT) -+ mmc_load_uboot_fat(mmc); - else { - puts("spl: wrong MMC boot mode\n"); - hang(); --- -1.7.2.3 - diff --git a/packages/tools/u-boot/patches/2011.03-rc1/u-boot-2011.03-rc1-0022-omap4-add-spl-support-for-OMAP4-Panda.patch b/packages/tools/u-boot/patches/2011.03-rc1/u-boot-2011.03-rc1-0022-omap4-add-spl-support-for-OMAP4-Panda.patch deleted file mode 100644 index 262599afceb..00000000000 --- a/packages/tools/u-boot/patches/2011.03-rc1/u-boot-2011.03-rc1-0022-omap4-add-spl-support-for-OMAP4-Panda.patch +++ /dev/null @@ -1,303 +0,0 @@ -From 1f516cf960c96e77f722706726f273cf3f117d9c Mon Sep 17 00:00:00 2001 -From: Aneesh V <aneesh@ti.com> -Date: Fri, 18 Feb 2011 03:24:01 +0530 -Subject: [PATCH 22/22] omap4: add spl support for OMAP4 Panda - -Signed-off-by: Aneesh V <aneesh@ti.com> ---- - arch/arm/include/asm/arch-omap4/emif.h | 10 +- - include/configs/omap4_panda.h | 24 ++++ - spl/board/ti/panda/Makefile | 219 ++++++++++++++++++++++++++++++++ - 3 files changed, 248 insertions(+), 5 deletions(-) - create mode 100644 spl/board/ti/panda/Makefile - -diff --git a/arch/arm/include/asm/arch-omap4/emif.h b/arch/arm/include/asm/arch-omap4/emif.h -index 8cc3230..b95e545 100644 ---- a/arch/arm/include/asm/arch-omap4/emif.h -+++ b/arch/arm/include/asm/arch-omap4/emif.h -@@ -520,11 +520,11 @@ - - /* Trap for invalid TILER PAT entries */ - #define DMM_LISA_MAP_0_INVAL_ADDR_TRAP (\ -- (0 << OMAP44XX_SDRC_ADDR_SHIFT) |\ -- (DMM_SDRC_MAP_EMIF1_ONLY << OMAP44XX_SDRC_MAP_SHIFT)|\ -- (DMM_SDRC_ADDR_SPC_INVALID << OMAP44XX_SDRC_ADDRSPC_SHIFT)|\ -- (DMM_SDRC_INTL_NONE << OMAP44XX_SDRC_INTL_SHIFT)|\ -- (0xFF << OMAP44XX_SYS_ADDR_SHIFT)) -+ (0 << OMAP44XX_SDRC_ADDR_SHIFT) |\ -+ (DMM_SDRC_MAP_EMIF1_ONLY << OMAP44XX_SDRC_MAP_SHIFT)|\ -+ (DMM_SDRC_ADDR_SPC_INVALID << OMAP44XX_SDRC_ADDRSPC_SHIFT)|\ -+ (DMM_SDRC_INTL_NONE << OMAP44XX_SDRC_INTL_SHIFT)|\ -+ (0xFF << OMAP44XX_SYS_ADDR_SHIFT)) - - - /* Reg mapping structure */ -diff --git a/include/configs/omap4_panda.h b/include/configs/omap4_panda.h -index 2b03b0f..b389035 100644 ---- a/include/configs/omap4_panda.h -+++ b/include/configs/omap4_panda.h -@@ -117,7 +117,9 @@ - - /* USB device configuration */ - #define CONFIG_USB_DEVICE 1 -+#ifndef CONFIG_PRELOADER - #define CONFIG_USB_TTY 1 -+#endif - #define CONFIG_SYS_CONSOLE_IS_IN_ENV 1 - - /* Flash */ -@@ -234,4 +236,26 @@ - CONFIG_SYS_INIT_RAM_SIZE - \ - GENERATED_GBL_DATA_SIZE) - -+/* Defines for Clock init */ -+#define CONFIG_SYS_OMAP4_ABE_SYSCK -+ -+/* Defines for SDRAM init */ -+#ifndef CONFIG_SYS_EMIF_PRECALCULATED_TIMING_REGS -+#define CONFIG_SYS_AUTOMATIC_SDRAM_DETECTION 1 -+#define CONFIG_SYS_DEFAULT_LPDDR2_TIMINGS 1 -+#endif -+ -+/* Defines for SPL */ -+#define CONFIG_SPL -+#define CONFIG_SYS_SPL_TEXT_BASE 0x40304360 -+#define CONFIG_SYS_SPL_MAX_SIZE 0x7800 /* 30 K */ -+#define CONFIG_SYS_SPL_STACK LOW_LEVEL_SRAM_STACK -+ -+#define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR 0x300 /* address 0x60000 */ -+#define CONFIG_SYS_U_BOOT_MAX_SIZE_SECTORS 0x200 /* 256 KB */ -+#define CONFIG_SYS_MMC_SD_FAT_BOOT_PARTITION 1 -+ -+#define CONFIG_SYS_SPL_BSS_START_ADDR 0x80000000 -+#define CONFIG_SYS_SPL_BSS_MAX_SIZE 0x80000 /* 512 KB */ -+ - #endif /* __CONFIG_H */ -diff --git a/spl/board/ti/panda/Makefile b/spl/board/ti/panda/Makefile -new file mode 100644 -index 0000000..8310db9 ---- /dev/null -+++ b/spl/board/ti/panda/Makefile -@@ -0,0 +1,219 @@ -+# -+# (C) Copyright 2006-2007 -+# Stefan Roese, DENX Software Engineering, sr@denx.de. -+# -+# (C) Copyright 2008 -+# Guennadi Liakhovetki, DENX Software Engineering, <lg@denx.de> -+# -+# See file CREDITS for list of people who contributed to this -+# project. -+# -+# This program is free software; you can redistribute it and/or -+# modify it under the terms of the GNU General Public License as -+# published by the Free Software Foundation; either version 2 of -+# the License, or (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program; if not, write to the Free Software -+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+# MA 02111-1307 USA -+# -+splobj := $(OBJTREE)/spl/ -+include $(TOPDIR)/config.mk -+SOBJS = -+COBJS = -+ -+# serial console -+$(obj)eabi_compat.c: -+ @rm -f $@ -+ @ln -s $(TOPDIR)/arch/arm/lib/eabi_compat.c $@ -+ -+$(obj)string.c: -+ @rm -f $@ -+ @ln -s $(TOPDIR)/lib/string.c $@ -+ -+$(obj)vsprintf.c: -+ @rm -f $@ -+ @ln -s $(TOPDIR)/lib/vsprintf.c $@ -+ -+$(obj)console.c: -+ @rm -f $@ -+ @ln -s $(TOPDIR)/common/console.c $@ -+ -+$(obj)stdio.c: -+ @rm -f $@ -+ @ln -s $(TOPDIR)/common/stdio.c $@ -+ -+$(obj)serial.c: -+ @rm -f $@ -+ @ln -s $(TOPDIR)/drivers/serial/serial.c $@ -+ -+$(obj)ns16550.c: -+ @rm -f $@ -+ @ln -s $(TOPDIR)/drivers/serial/ns16550.c $@ -+ -+$(obj)div64.c: -+ @rm -f $@ -+ @ln -s $(TOPDIR)/lib/div64.c $@ -+ -+$(obj)ctype.c: -+ @rm -f $@ -+ @ln -s $(TOPDIR)/lib/ctype.c $@ -+ -+COBJS += serial.o ns16550.o string.o vsprintf.o console.o stdio.o -+COBJS += ctype.o eabi_compat.o div64.o -+ -+ -+# mmc -+$(obj)mmc.c: -+ @rm -f $@ -+ @ln -s $(TOPDIR)/drivers/mmc/mmc.c $@ -+ -+$(obj)omap_hsmmc.c: -+ @rm -f $@ -+ @ln -s $(TOPDIR)/drivers/mmc/omap_hsmmc.c $@ -+ -+$(obj)omap24xx_i2c.c: $(obj)omap24xx_i2c.h -+ @rm -f $@ -+ @ln -s $(TOPDIR)/drivers/i2c/omap24xx_i2c.c $@ -+ -+$(obj)omap24xx_i2c.h: -+ @rm -f $@ -+ @ln -s $(TOPDIR)/drivers/i2c/omap24xx_i2c.h $@ -+ -+$(obj)time.c: -+ @rm -f $@ -+ @ln -s $(TOPDIR)/lib/time.c $@ -+ -+$(obj)part.c: -+ @rm -f $@ -+ @ln -s $(TOPDIR)/disk/part.c $@ -+ -+$(obj)part_dos.c: $(obj)part_dos.h -+ @rm -f $@ -+ @ln -s $(TOPDIR)/disk/part_dos.c $@ -+ -+$(obj)part_dos.h: -+ @rm -f $@ -+ @ln -s $(TOPDIR)/disk/part_dos.h $@ -+ -+COBJS += omap_hsmmc.o omap24xx_i2c.o mmc.o time.o part.o part_dos.o -+ -+# fat -+$(obj)fat.c: -+ @rm -f $@ -+ @ln -s $(TOPDIR)/fs/fat/fat.c $@ -+ -+COBJS += fat.o -+ -+# armv7 -+$(obj)start.S: -+ @rm -f $@ -+ @ln -s $(TOPDIR)/arch/arm/cpu/armv7/start.S $@ -+ -+$(obj)syslib.c: -+ @rm -f $@ -+ @ln -s $(TOPDIR)/arch/arm/cpu/armv7/syslib.c $@ -+ -+SOBJS += start.o -+COBJS += syslib.o -+ -+# omap-common -+$(obj)utils.c: -+ @rm -f $@ -+ @ln -s $(TOPDIR)/arch/arm/cpu/armv7/omap-common/utils.c $@ -+ -+$(obj)timer.c: -+ @rm -f $@ -+ @ln -s $(TOPDIR)/arch/arm/cpu/armv7/omap-common/timer.c $@ -+ -+$(obj)reset.S: -+ @rm -f $@ -+ @ln -s $(TOPDIR)/arch/arm/cpu/armv7/omap-common/reset.S $@ -+ -+$(obj)spl-omap.c: -+ @rm -f $@ -+ @ln -s $(TOPDIR)/spl/board/ti/spl-omap.c $@ -+ -+SOBJS += reset.o -+COBJS += utils.o timer.o spl-omap.o -+ -+$(OBJTREE)/MLO: $(splobj)u-boot-spl.bin -+ $(OBJTREE)/tools/mkimage -T omapimage \ -+ -a $(CONFIG_SYS_SPL_TEXT_BASE) -d $< $@ -+ -+LDSCRIPT_SOURCE = $(TOPDIR)/spl/board/ti/spl-omap.lds -+ -+# omap4 -+$(obj)lowlevel_init.S: -+ @rm -f $@ -+ @ln -s $(TOPDIR)/arch/arm/cpu/armv7/omap4/lowlevel_init.S $@ -+ -+$(obj)omap4_mux_data.h: -+ @rm -f $@ -+ @ln -s $(TOPDIR)/arch/arm/cpu/armv7/omap4/omap4_mux_data.h $@ -+ -+$(obj)board.c:$(obj)omap4_mux_data.h -+ @rm -f $@ -+ @ln -s $(TOPDIR)/arch/arm/cpu/armv7/omap4/board.c $@ -+ -+$(obj)emif.c: -+ @rm -f $@ -+ @ln -s $(TOPDIR)/arch/arm/cpu/armv7/omap4/emif.c $@ -+ -+$(obj)sdram_elpida.c: -+ @rm -f $@ -+ @ln -s $(TOPDIR)/arch/arm/cpu/armv7/omap4/sdram_elpida.c $@ -+ -+$(obj)clocks.c: -+ @rm -f $@ -+ @ln -s $(TOPDIR)/arch/arm/cpu/armv7/omap4/clocks.c $@ -+ -+SOBJS += lowlevel_init.o -+COBJS += board.o clocks.o emif.o sdram_elpida.o -+ -+# rules -+LDPPFLAGS += -include $(TOPDIR)/include/config.h -+LDSCRIPT = $(splobj)u-boot-spl-generated.lds -+$(LDSCRIPT): $(LDSCRIPT_SOURCE) -+ $(CPP) $(CPPFLAGS) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ -P - <$^ >$@ -+LDFLAGS = -Bstatic -T $(LDSCRIPT) \ -+ $(PLATFORM_LDFLAGS) --gc-sections -+AFLAGS += -DCONFIG_PRELOADER -Os -ffixed-r8 -+CFLAGS += -DCONFIG_PRELOADER -Os -ffixed-r8 -ffunction-sections \ -+ -fdata-sections -march=armv7-a -mthumb -+PLATFORM_LIBGCC = -L $(shell dirname `$(CC) $(CFLAGS) \ -+ -print-libgcc-file-name`) -lgcc -+ -+$(obj)%.o: $(obj)%.S -+ $(CC) $(AFLAGS) -c -o $@ $< -+ -+$(obj)%.o: $(obj)%.c -+ $(CC) $(CFLAGS) -c -o $@ $< -+ -+SRCS := $(addprefix $(obj),$(SOBJS:.o=.S) $(COBJS:.o=.c)) -+OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS)) -+__OBJS := $(SOBJS) $(COBJS) -+LNDIR := $(OBJTREE)/spl/board/$(BOARDDIR) -+ -+$(splobj)u-boot-spl.bin: $(splobj)u-boot-spl -+ $(OBJCOPY) ${OBJCFLAGS} -O binary $< $@ -+ -+$(splobj)u-boot-spl: $(OBJS) $(LDSCRIPT) -+ cd $(LNDIR) && $(LD) $(LDFLAGS) $(__OBJS) \ -+ $(PLATFORM_LIBGCC) \ -+ -Map $(splobj)u-boot-spl.map \ -+ -o $(splobj)u-boot-spl -+ -+ALL = $(OBJTREE)/MLO -+all: $(obj).depend $(ALL) -+ -+# defines $(obj).depend target -+include $(SRCTREE)/rules.mk -+ -+sinclude $(obj).depend --- -1.7.2.3 - diff --git a/packages/tools/u-boot/patches/u-boot-001-gcc5-support.patch b/packages/tools/u-boot/patches/imx6-408544d/u-boot-001-gcc5-support.patch similarity index 100% rename from packages/tools/u-boot/patches/u-boot-001-gcc5-support.patch rename to packages/tools/u-boot/patches/imx6-408544d/u-boot-001-gcc5-support.patch diff --git a/packages/tools/u-boot/patches/u-boot-002-gcc5-use_gcc_inline_version_instead_c99.patch b/packages/tools/u-boot/patches/imx6-408544d/u-boot-002-gcc5-use_gcc_inline_version_instead_c99.patch similarity index 100% rename from packages/tools/u-boot/patches/u-boot-002-gcc5-use_gcc_inline_version_instead_c99.patch rename to packages/tools/u-boot/patches/imx6-408544d/u-boot-002-gcc5-use_gcc_inline_version_instead_c99.patch diff --git a/packages/tools/u-boot/patches/u-boot-003-gcc5-no-unalligned-access.patch b/packages/tools/u-boot/patches/imx6-408544d/u-boot-003-gcc5-no-unalligned-access.patch similarity index 100% rename from packages/tools/u-boot/patches/u-boot-003-gcc5-no-unalligned-access.patch rename to packages/tools/u-boot/patches/imx6-408544d/u-boot-003-gcc5-no-unalligned-access.patch diff --git a/packages/tools/u-boot/release b/packages/tools/u-boot/release index 80fa3a1cfb5..876cac8c68a 100755 --- a/packages/tools/u-boot/release +++ b/packages/tools/u-boot/release @@ -25,7 +25,10 @@ if [ -z "$UBOOT_CONFIGFILE" ]; then fi mkdir -p $RELEASE_DIR/3rdparty/bootloader - cp -PR $BUILD/u-boot-*/$UBOOT_CONFIGFILE $RELEASE_DIR/3rdparty/bootloader 2>/dev/null || : + if [ -e $BUILD/u-boot-*/$UBOOT_CONFIGFILE ]; then + cp -PR $BUILD/u-boot-*/$UBOOT_CONFIGFILE $RELEASE_DIR/3rdparty/bootloader + fi + cp -PR $BUILD/u-boot-*/SPL* $RELEASE_DIR/3rdparty/bootloader 2>/dev/null || : cp -PR $BUILD/u-boot-*/u-boot*.imx $RELEASE_DIR/3rdparty/bootloader 2>/dev/null || : cp -PR $BUILD/u-boot-*/u-boot*.img $RELEASE_DIR/3rdparty/bootloader 2>/dev/null || : @@ -35,3 +38,11 @@ mkdir -p $RELEASE_DIR/3rdparty/bootloader cp -PR $HOME/.openelec/projects/$PROJECT/bootloader/* $RELEASE_DIR/3rdparty/bootloader 2>/dev/null || : cp -PR $BUILD/linux-*/arch/$TARGET_KERNEL_ARCH/boot/dts/*.dtb $RELEASE_DIR/3rdparty/bootloader 2>/dev/null || : + + case $PROJECT in + Odroid_C2) + cp -PR $BUILD/$BOOTLOADER-*/sd_fuse/bl1.bin.hardkernel $RELEASE_DIR/3rdparty/bootloader/bl1 + cp -PR $BUILD/$BOOTLOADER-*/sd_fuse/u-boot.bin $RELEASE_DIR/3rdparty/bootloader/u-boot + cp -PR $PROJECT_DIR/$PROJECT/bootloader/boot.ini $RELEASE_DIR/3rdparty/bootloader + ;; + esac diff --git a/packages/tools/u-boot/scripts/update-c2.sh b/packages/tools/u-boot/scripts/update-c2.sh new file mode 100644 index 00000000000..a665655a66a --- /dev/null +++ b/packages/tools/u-boot/scripts/update-c2.sh @@ -0,0 +1,55 @@ +#!/bin/sh + +################################################################################ +# This file is part of LibreELEC - https://libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see <http://www.gnu.org/licenses/>. +################################################################################ + +[ -z "$SYSTEM_ROOT" ] && SYSTEM_ROOT="" +[ -z "$BOOT_ROOT" ] && BOOT_ROOT="/flash" +[ -z "$BOOT_PART" ] && BOOT_PART=$(df "$BOOT_ROOT" | tail -1 | awk {' print $1 '}) +if [ -z "$BOOT_DISK" ]; then + case $BOOT_PART in + /dev/sd[a-z][0-9]*) + BOOT_DISK=$(echo $BOOT_PART | sed -e "s,[0-9]*,,g") + ;; + /dev/mmcblk*) + BOOT_DISK=$(echo $BOOT_PART | sed -e "s,p[0-9]*,,g") + ;; + esac +fi + +# mount $BOOT_ROOT r/w + mount -o remount,rw $BOOT_ROOT + +# update Device Tree Blobs + for all_dtb in /flash/*.dtb /flash/DTB; do + dtb=$(basename $all_dtb) + if [ -f $SYSTEM_ROOT/usr/share/bootloader/$dtb ]; then + echo "*** updating Device Tree Blob: $dtb ..." + cp -p $SYSTEM_ROOT/usr/share/bootloader/$dtb $BOOT_ROOT + fi + done + +echo "*** updating u-boot for Odroid on: $BOOT_DISK ..." + +dd if=$SYSTEM_ROOT/usr/share/bootloader/bl1 of=$BOOT_DISK conv=fsync bs=1 count=442 +dd if=$SYSTEM_ROOT/usr/share/bootloader/bl1 of=$BOOT_DISK conv=fsync bs=512 seek=1 skip=1 +dd if=$SYSTEM_ROOT/usr/share/bootloader/u-boot of=$BOOT_DISK conv=fsync bs=512 seek=97 + +# mount $BOOT_ROOT r/o + sync + mount -o remount,ro $BOOT_ROOT diff --git a/packages/tools/u-boot/scripts/update.sh b/packages/tools/u-boot/scripts/update.sh index 71a5582a94f..a9dc9018e40 100755 --- a/packages/tools/u-boot/scripts/update.sh +++ b/packages/tools/u-boot/scripts/update.sh @@ -33,8 +33,8 @@ if [ -z "$BOOT_DISK" ]; then fi SYSTEM_TYPE="" -if [ -f $SYSTEM_ROOT/usr/lib/openelec/imx6-system-type ]; then - . $SYSTEM_ROOT/usr/lib/openelec/imx6-system-type +if [ -f $SYSTEM_ROOT/usr/lib/librenelec/imx6-system-type ]; then + . $SYSTEM_ROOT/usr/lib/libreelec/imx6-system-type fi # mount $BOOT_ROOT r/w @@ -58,7 +58,7 @@ fi # access boot partition 1 echo 0 > /sys/block/mmcblk0boot0/force_ro # write u-boot to eMMC - dd if=$SYSTEM_ROOT/usr/share/bootloader/u-boot-$SYSTEM_TYPE.imx of=/dev/mmcblk0boot0 bs=1k seek=1 conv=fsync + dd if=$SYSTEM_ROOT/usr/share/bootloader/u-boot-$SYSTEM_TYPE.imx of=/dev/mmcblk0boot0 bs=1k seek=1 conv=fsync &>/dev/null # re-enable read-only access echo 1 > /sys/block/mmcblk0boot0/force_ro # enable boot partion 1 to boot @@ -80,7 +80,7 @@ fi if [ -f $SYSTEM_ROOT/usr/share/bootloader/$SPL_SRC ]; then echo "*** updating u-boot SPL Blob on: $BOOT_DISK ..." - dd if="$SYSTEM_ROOT/usr/share/bootloader/$SPL_SRC" of="$BOOT_DISK" bs=1k seek=1 conv=fsync + dd if="$SYSTEM_ROOT/usr/share/bootloader/$SPL_SRC" of="$BOOT_DISK" bs=1k seek=1 conv=fsync &>/dev/null fi fi diff --git a/packages/unofficial b/packages/unofficial deleted file mode 160000 index 3fb1a2880b3..00000000000 --- a/packages/unofficial +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 3fb1a2880b3d2cb736f46ceb40c132ee36d57eaf diff --git a/packages/virtual/debug/package.mk b/packages/virtual/debug/package.mk index 552e97930e5..0e805ef701f 100644 --- a/packages/virtual/debug/package.mk +++ b/packages/virtual/debug/package.mk @@ -35,7 +35,7 @@ PKG_AUTORECONF="no" # configure GPU drivers and dependencies: get_graphicdrivers -if [ "$VDPAU_SUPPORT" = "yes" ]; then +if [ "$VDPAU_SUPPORT" = "yes" -a "$DISPLAYSERVER" = "x11" ]; then PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET vdpauinfo" fi diff --git a/packages/virtual/mediacenter/package.mk b/packages/virtual/mediacenter/package.mk index 45ce5964f0b..82722148c96 100644 --- a/packages/virtual/mediacenter/package.mk +++ b/packages/virtual/mediacenter/package.mk @@ -21,9 +21,9 @@ PKG_VERSION="" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" -PKG_SITE="http://www.openelec.tv" +PKG_SITE="https://libreelec.tv" PKG_URL="" -PKG_DEPENDS_TARGET="toolchain $MEDIACENTER $MEDIACENTER-theme-$SKIN_DEFAULT" +PKG_DEPENDS_TARGET="toolchain $MEDIACENTER" PKG_PRIORITY="optional" PKG_SECTION="virtual" PKG_SHORTDESC="Mediacenter: Metapackage" @@ -32,20 +32,19 @@ PKG_LONGDESC="" PKG_IS_ADDON="no" PKG_AUTORECONF="no" -for i in $SKINS; do - PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET $MEDIACENTER-theme-$i" -done - if [ "$MEDIACENTER" = "kodi" ]; then -# some python stuff needed for various addons - PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET Pillow" - PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET simplejson" - PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET pycrypto" + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET $MEDIACENTER-theme-$SKIN_DEFAULT" + for i in $SKINS; do + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET $MEDIACENTER-theme-$i" + done + +# some python stuff needed for various addons + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET Pillow \ + simplejson \ + pycrypto" # other packages - PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET OpenELEC-settings" - - if [ "$KODI_LANGUAGE_ADDONS" = "yes" ]; then - PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET kodi-language-addons" - fi + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET LibreELEC-settings \ + xmlstarlet \ + peripheral.joystick" fi diff --git a/packages/virtual/network/package.mk b/packages/virtual/network/package.mk index 8fc2b4efe39..69a61fe3f1e 100644 --- a/packages/virtual/network/package.mk +++ b/packages/virtual/network/package.mk @@ -23,7 +23,7 @@ PKG_ARCH="any" PKG_LICENSE="various" PKG_SITE="http://www.openelec.tv" PKG_URL="" -PKG_DEPENDS_TARGET="toolchain connman iana-etc ethtool openssh" +PKG_DEPENDS_TARGET="toolchain connman iana-etc ethtool openssh openvpn" PKG_PRIORITY="optional" PKG_SECTION="virtual" PKG_SHORTDESC="network: Metapackage for packages to install network support" diff --git a/packages/virtual/toolchain/package.mk b/packages/virtual/toolchain/package.mk index b2183095f0a..54c35c49944 100644 --- a/packages/virtual/toolchain/package.mk +++ b/packages/virtual/toolchain/package.mk @@ -23,7 +23,7 @@ PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.openelec.tv" PKG_URL="" -PKG_DEPENDS_TARGET="make:host xz:host sed:host pkg-config:host autoconf:host automake:host libtool:host intltool:host autoconf-archive:host gcc:host bison:host flex:host cmake:host yasm:host" +PKG_DEPENDS_TARGET="configtools:host make:host xz:host sed:host pkg-config:host autoconf:host automake:host libtool:host intltool:host autoconf-archive:host gcc:host bison:host flex:host cmake:host yasm:host" PKG_PRIORITY="optional" PKG_SECTION="virtual" PKG_SHORTDESC="toolchain: OpenELEC.tv' toolchain" diff --git a/packages/wayland/libinput/package.mk b/packages/wayland/libinput/package.mk index b7c9a3365fa..981b821722b 100644 --- a/packages/wayland/libinput/package.mk +++ b/packages/wayland/libinput/package.mk @@ -17,13 +17,13 @@ ################################################################################ PKG_NAME="libinput" -PKG_VERSION="1.2.1" +PKG_VERSION="1.2.4" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.freedesktop.org/wiki/Software/libinput/" PKG_URL="http://www.freedesktop.org/software/libinput/$PKG_NAME-$PKG_VERSION.tar.xz" -PKG_DEPENDS_TARGET="toolchain libevdev mtdev" +PKG_DEPENDS_TARGET="toolchain systemd libevdev mtdev" PKG_PRIORITY="optional" PKG_SECTION="wayland" PKG_SHORTDESC="libinput is a library to handle input devices in Wayland compositors and to provide a generic X.Org input driver." diff --git a/packages/wayland/libxkbcommon/package.mk b/packages/wayland/libxkbcommon/package.mk new file mode 100644 index 00000000000..cfb66c6c284 --- /dev/null +++ b/packages/wayland/libxkbcommon/package.mk @@ -0,0 +1,40 @@ +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# +# OpenELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# OpenELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with OpenELEC. If not, see <http://www.gnu.org/licenses/>. +################################################################################ + +PKG_NAME="libxkbcommon" +PKG_VERSION="0.6.1" +PKG_REV="1" +PKG_ARCH="any" +PKG_LICENSE="OSS" +PKG_SITE="http://xkbcommon.org" +PKG_URL="http://xkbcommon.org/download/${PKG_NAME}-${PKG_VERSION}.tar.xz" +PKG_DEPENDS_TARGET="toolchain" +PKG_PRIORITY="optional" +PKG_SECTION="wayland" +PKG_SHORTDESC="xkbcommon: a library to handle keyboard descriptions" +PKG_LONGDESC="xkbcommon is a library to handle keyboard descriptions, including loading them from disk, parsing them and handling their state. It's mainly meant for client toolkits, window systems, and other system applications; currently that includes Wayland, kmscon, GTK+, Qt, Clutter, and more. It is also used by some XCB applications for proper keyboard support." + +PKG_IS_ADDON="no" +PKG_AUTORECONF="yes" + +if [ "$DISPLAYSERVER" = "x11" ]; then + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET xkeyboard-config" + PKG_CONFIGURE_OPTS_TARGET="--enable-x11" +else + PKG_CONFIGURE_OPTS_TARGET="--disable-x11" +fi diff --git a/packages/wayland/mtdev/package.mk b/packages/wayland/mtdev/package.mk index 9b2c097432e..4f9b3948d50 100644 --- a/packages/wayland/mtdev/package.mk +++ b/packages/wayland/mtdev/package.mk @@ -32,3 +32,4 @@ PKG_LONGDESC="The mtdev is a stand-alone library which transforms all variants o PKG_IS_ADDON="no" PKG_AUTORECONF="yes" +PKG_CONFIGURE_OPTS_TARGET="--enable-static --disable-shared" \ No newline at end of file diff --git a/packages/web/curl/package.mk b/packages/web/curl/package.mk index 67d2ec66895..27bb50faf83 100644 --- a/packages/web/curl/package.mk +++ b/packages/web/curl/package.mk @@ -25,7 +25,7 @@ # there: http://forum.xbmc.org/showthread.php?tid=177557 PKG_NAME="curl" -PKG_VERSION="7.47.1" +PKG_VERSION="7.48.0" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="MIT" @@ -87,7 +87,7 @@ PKG_CONFIGURE_OPTS_TARGET="ac_cv_lib_rtmp_RTMP_Init=yes \ --with-ssl \ --without-polarssl \ --without-nss \ - --with-ca-bundle=$SSL_CERTIFICATES/cacert.pem \ + --with-ca-bundle=/etc/ssl/cert.pem \ --without-ca-path \ --without-libpsl \ --without-libmetalink \ diff --git a/packages/web/curl/patches/curl-01-upstream.patch b/packages/web/curl/patches/curl-01-upstream.patch new file mode 100644 index 00000000000..07922fdefea --- /dev/null +++ b/packages/web/curl/patches/curl-01-upstream.patch @@ -0,0 +1,27 @@ +From 240cd84b494e0ffee8ad261c43b927d246cf6be1 Mon Sep 17 00:00:00 2001 +From: Daniel Stenberg <daniel@haxx.se> +Date: Wed, 23 Mar 2016 10:04:48 +0100 +Subject: [PATCH] openssl: fix ERR_remove_thread_state() for boringssl/libressl + +The removed arg is only done in OpenSSL + +Bug: https://twitter.com/xtraemeat/status/712564874098917376 +--- + lib/vtls/openssl.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/lib/vtls/openssl.c b/lib/vtls/openssl.c +index cbf2d21..b7e4462 100644 +--- a/lib/vtls/openssl.c ++++ b/lib/vtls/openssl.c +@@ -95,7 +95,9 @@ + + #if (OPENSSL_VERSION_NUMBER >= 0x10000000L) + #define HAVE_ERR_REMOVE_THREAD_STATE 1 +-#if (OPENSSL_VERSION_NUMBER >= 0x10100004L) ++#if (OPENSSL_VERSION_NUMBER >= 0x10100004L) && \ ++ !defined(LIBRESSL_VERSION_NUMBER) && \ ++ !defined(OPENSSL_IS_BORINGSSL) + /* OpenSSL 1.1.0-pre4 removed the argument! */ + #define HAVE_ERR_REMOVE_THREAD_STATE_NOARG 1 + #endif diff --git a/packages/web/libmicrohttpd/package.mk b/packages/web/libmicrohttpd/package.mk index 0de4ca81c3c..b6de1b8d965 100644 --- a/packages/web/libmicrohttpd/package.mk +++ b/packages/web/libmicrohttpd/package.mk @@ -17,7 +17,7 @@ ################################################################################ PKG_NAME="libmicrohttpd" -PKG_VERSION="0.9.46" +PKG_VERSION="0.9.49" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="LGPLv2.1" diff --git a/packages/x11/driver/xf86-input-evdev/package.mk b/packages/x11/driver/xf86-input-evdev/package.mk index 9ff5af2752f..49f621a7a64 100644 --- a/packages/x11/driver/xf86-input-evdev/package.mk +++ b/packages/x11/driver/xf86-input-evdev/package.mk @@ -17,7 +17,7 @@ ################################################################################ PKG_NAME="xf86-input-evdev" -PKG_VERSION="2.10.1" +PKG_VERSION="2.10.2" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="OSS" diff --git a/packages/x11/driver/xf86-input-libinput/package.mk b/packages/x11/driver/xf86-input-libinput/package.mk index fcc825f79d9..0cbaeb2f820 100644 --- a/packages/x11/driver/xf86-input-libinput/package.mk +++ b/packages/x11/driver/xf86-input-libinput/package.mk @@ -17,7 +17,7 @@ ################################################################################ PKG_NAME="xf86-input-libinput" -PKG_VERSION="0.17.0" +PKG_VERSION="0.18.0" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" diff --git a/packages/x11/driver/xf86-video-amdgpu/package.mk b/packages/x11/driver/xf86-video-amdgpu/package.mk index 55f6f805cc1..3031b94b3dc 100644 --- a/packages/x11/driver/xf86-video-amdgpu/package.mk +++ b/packages/x11/driver/xf86-video-amdgpu/package.mk @@ -17,7 +17,7 @@ ################################################################################ PKG_NAME="xf86-video-amdgpu" -PKG_VERSION="1.0.1" +PKG_VERSION="1.1.0" PKG_REV="1" PKG_ARCH="x86_64" PKG_LICENSE="OSS" diff --git a/packages/x11/driver/xf86-video-ati/package.mk b/packages/x11/driver/xf86-video-ati/package.mk index 3841411230e..72f78bf4867 100644 --- a/packages/x11/driver/xf86-video-ati/package.mk +++ b/packages/x11/driver/xf86-video-ati/package.mk @@ -17,7 +17,7 @@ ################################################################################ PKG_NAME="xf86-video-ati" -PKG_VERSION="7.6.1" +PKG_VERSION="7.7.0" PKG_REV="1" PKG_ARCH="x86_64" PKG_LICENSE="OSS" diff --git a/packages/x11/driver/xf86-video-intel/package.mk b/packages/x11/driver/xf86-video-intel/package.mk index 027317def14..0581d40d43b 100644 --- a/packages/x11/driver/xf86-video-intel/package.mk +++ b/packages/x11/driver/xf86-video-intel/package.mk @@ -17,13 +17,13 @@ ################################################################################ PKG_NAME="xf86-video-intel" -PKG_VERSION="300319e" +PKG_VERSION="0204e55" PKG_REV="1" PKG_ARCH="x86_64" PKG_LICENSE="OSS" PKG_SITE="http://intellinuxgraphics.org/" -PKG_URL="http://xorg.freedesktop.org/archive/individual/driver/$PKG_NAME-$PKG_VERSION.tar.bz2" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_URL="https://cgit.freedesktop.org/xorg/driver/xf86-video-intel/snapshot/$PKG_VERSION.tar.xz" +PKG_SOURCE_DIR="$PKG_VERSION" PKG_DEPENDS_TARGET="toolchain libXcomposite util-macros fontsproto systemd xorg-server" PKG_PRIORITY="optional" PKG_SECTION="x11/driver" @@ -50,7 +50,6 @@ PKG_CONFIGURE_OPTS_TARGET="--disable-backlight \ --disable-xaa \ --disable-dga \ --disable-tear-free \ - --disable-rendernode \ --disable-create2 \ --disable-async-swap \ --with-xorg-module-dir=$XORG_PATH_MODULES" diff --git a/packages/x11/driver/xf86-video-nvidia-legacy/package.mk b/packages/x11/driver/xf86-video-nvidia-legacy/package.mk index 2f8a4df050e..3609de71b4a 100644 --- a/packages/x11/driver/xf86-video-nvidia-legacy/package.mk +++ b/packages/x11/driver/xf86-video-nvidia-legacy/package.mk @@ -17,7 +17,7 @@ ################################################################################ PKG_NAME="xf86-video-nvidia-legacy" -PKG_VERSION="304.131" +PKG_VERSION="340.96" PKG_REV="1" PKG_ARCH="x86_64" PKG_LICENSE="nonfree" @@ -34,10 +34,9 @@ PKG_IS_ADDON="no" PKG_AUTORECONF="no" unpack() { - NV_PKG="`echo $PKG_URL | sed 's%.*/\(.*\)$%\1%'`" [ -d $PKG_BUILD ] && rm -rf $PKG_BUILD - sh $SOURCES/$PKG_NAME/$NV_PKG --extract-only --target $BUILD/$PKG_NAME-$PKG_VERSION + sh $SOURCES/$PKG_NAME/$PKG_SOURCE_NAME --extract-only --target $PKG_BUILD } make_target() { diff --git a/packages/x11/driver/xf86-video-nvidia-legacy/patches/xf86-video-nvidia-legacy-0001-kernel-4.6-fix.patch b/packages/x11/driver/xf86-video-nvidia-legacy/patches/xf86-video-nvidia-legacy-0001-kernel-4.6-fix.patch new file mode 100644 index 00000000000..74c668d3d44 --- /dev/null +++ b/packages/x11/driver/xf86-video-nvidia-legacy/patches/xf86-video-nvidia-legacy-0001-kernel-4.6-fix.patch @@ -0,0 +1,30 @@ +--- a/kernel/os-mlock.c 2015-11-08 21:43:39.000000000 -0800 ++++ b/kernel/os-mlock.c 2016-04-18 15:09:59.940350210 -0700 +@@ -49,7 +49,7 @@ + } + + down_read(&mm->mmap_sem); +- ret = get_user_pages(current, mm, (unsigned long)address, ++ ret = get_user_pages((unsigned long)address, + page_count, write, force, user_pages, NULL); + up_read(&mm->mmap_sem); + pinned = ret; +@@ -62,7 +62,7 @@ + else if (pinned < page_count) + { + for (i = 0; i < pinned; i++) +- page_cache_release(user_pages[i]); ++ put_page(user_pages[i]); + os_free_mem(user_pages); + return RM_ERR_INVALID_ADDRESS; + } +@@ -114,7 +114,7 @@ + PAGE_SIZE, PCI_DMA_BIDIRECTIONAL); + if (write) + set_page_dirty_lock(user_pages[i]); +- page_cache_release(user_pages[i]); ++ put_page(user_pages[i]); + } + + os_free_mem(user_pages); + diff --git a/packages/x11/driver/xf86-video-nvidia/package.mk b/packages/x11/driver/xf86-video-nvidia/package.mk index 647b478f1d3..009e552b521 100644 --- a/packages/x11/driver/xf86-video-nvidia/package.mk +++ b/packages/x11/driver/xf86-video-nvidia/package.mk @@ -20,7 +20,7 @@ PKG_NAME="xf86-video-nvidia" # Remember to run "python packages/x11/driver/xf86-video-nvidia/scripts/make_nvidia_udev.py" and commit changes to # "packages/x11/driver/xf86-video-nvidia/udev.d/96-nvidia.rules" whenever bumping version. # Host may require installation of python-lxml and python-requests packages. -PKG_VERSION="352.79" +PKG_VERSION="361.42" PKG_REV="1" PKG_ARCH="x86_64" PKG_LICENSE="nonfree" @@ -37,10 +37,9 @@ PKG_IS_ADDON="no" PKG_AUTORECONF="no" unpack() { - NV_PKG="`echo $PKG_URL | sed 's%.*/\(.*\)$%\1%'`" [ -d $PKG_BUILD ] && rm -rf $PKG_BUILD - sh $SOURCES/$PKG_NAME/$NV_PKG --extract-only --target $BUILD/$PKG_NAME-$PKG_VERSION + sh $SOURCES/$PKG_NAME/$PKG_SOURCE_NAME --extract-only --target $PKG_BUILD } make_target() { @@ -70,13 +69,15 @@ makeinstall_target() { ln -sf /var/lib/libnvidia-ml.so.1 $INSTALL/usr/lib/libnvidia-ml.so.1 cp -P tls/libnvidia-tls.so.$PKG_VERSION $INSTALL/usr/lib # rename to not conflicting with Mesa libGL.so - cp -P libGL.so* $INSTALL/usr/lib/libGL_nvidia.so.1 + cp -P libGL.so.$PKG_VERSION $INSTALL/usr/lib/libGL_nvidia.so.1 mkdir -p $INSTALL/lib/modules/$(get_module_dir)/nvidia ln -sf /var/lib/nvidia.ko $INSTALL/lib/modules/$(get_module_dir)/nvidia/nvidia.ko + cp -P kernel/nvidia-uvm.ko $INSTALL/lib/modules/$(get_module_dir)/nvidia + cp -P kernel/nvidia-modeset.ko $INSTALL/lib/modules/$(get_module_dir)/nvidia mkdir -p $INSTALL/usr/lib/nvidia - cp kernel/nvidia.ko $INSTALL/usr/lib/nvidia + cp -P kernel/nvidia.ko $INSTALL/usr/lib/nvidia mkdir -p $INSTALL/usr/bin ln -s /var/lib/nvidia-smi $INSTALL/usr/bin/nvidia-smi diff --git a/packages/x11/driver/xf86-video-nvidia/patches/xf86-video-nvidia-0001-kernel-4.6-fix.patch b/packages/x11/driver/xf86-video-nvidia/patches/xf86-video-nvidia-0001-kernel-4.6-fix.patch new file mode 100644 index 00000000000..76fec72fea4 --- /dev/null +++ b/packages/x11/driver/xf86-video-nvidia/patches/xf86-video-nvidia-0001-kernel-4.6-fix.patch @@ -0,0 +1,60 @@ +--- a/kernel/nvidia/os-mlock.c 2016-05-23 19:41:41.487380938 +0100 ++++ b/kernel/nvidia/os-mlock.c 2016-05-23 19:42:34.716761233 +0100 +@@ -116,7 +116,7 @@ + } + + down_read(&mm->mmap_sem); +- ret = get_user_pages(current, mm, (unsigned long)address, ++ ret = get_user_pages((unsigned long)address, + page_count, write, force, user_pages, NULL); + up_read(&mm->mmap_sem); + pinned = ret; +@@ -129,7 +129,7 @@ + else if (pinned < page_count) + { + for (i = 0; i < pinned; i++) +- page_cache_release(user_pages[i]); ++ put_page(user_pages[i]); + os_free_mem(user_pages); + return NV_ERR_INVALID_ADDRESS; + } +@@ -156,7 +156,7 @@ + { + if (write) + set_page_dirty_lock(user_pages[i]); +- page_cache_release(user_pages[i]); ++ put_page(user_pages[i]); + } + + os_free_mem(user_pages); +--- a/kernel/nvidia-uvm/uvm_full_pagetbl_mgmt.c 2016-03-22 23:48:41.000000000 +0000 ++++ b/kernel/nvidia-uvm/uvm_full_pagetbl_mgmt.c 2016-05-23 20:17:26.337911381 +0100 +@@ -2907,7 +2907,7 @@ + + // get userPA for this range + down_read(&current->mm->mmap_sem); +- returnVal = get_user_pages(current, current->mm, (unsigned long)(UVM_ALIGN_ADDR(userCopyBuffer, PAGE_SIZE_4K)), ++ returnVal = get_user_pages((unsigned long)(UVM_ALIGN_ADDR(userCopyBuffer, PAGE_SIZE_4K)), + userPagesReq, 1, 0, tempUserPageArray, NULL); + up_read(&current->mm->mmap_sem); + +@@ -2937,7 +2937,7 @@ + set_page_dirty_lock(tempUserPageArray[i]); + + UVM_PANIC_ON(tempUserPageArray[i] == 0); +- page_cache_release(tempUserPageArray[i]); ++ put_page(tempUserPageArray[i]); + tempUserPageArray[i] = 0; + } + +--- a/kernel/nvidia-uvm/uvm8_tools.c 2016-05-23 20:17:47.218443656 +0100 ++++ b/kernel/nvidia-uvm/uvm8_tools.c 2016-05-23 20:18:02.002820423 +0100 +@@ -157,7 +157,7 @@ + } + + down_read(&current->mm->mmap_sem); +- ret = get_user_pages(current, current->mm, user_va, num_pages, 1, 0, *pages, NULL); ++ ret = get_user_pages(user_va, num_pages, 1, 0, *pages, NULL); + up_read(&current->mm->mmap_sem); + if (ret != num_pages) { + status = NV_ERR_INVALID_ARGUMENT; diff --git a/packages/x11/driver/xf86-video-nvidia/udev.d/96-nvidia.rules b/packages/x11/driver/xf86-video-nvidia/udev.d/96-nvidia.rules index 1e2c4d1123f..766e134a876 100644 --- a/packages/x11/driver/xf86-video-nvidia/udev.d/96-nvidia.rules +++ b/packages/x11/driver/xf86-video-nvidia/udev.d/96-nvidia.rules @@ -251,8 +251,12 @@ ATTRS{device}=="0x1341", GOTO="configure_nvidia" ATTRS{device}=="0x1344", GOTO="configure_nvidia" ATTRS{device}=="0x1346", GOTO="configure_nvidia" ATTRS{device}=="0x1347", GOTO="configure_nvidia" +ATTRS{device}=="0x1348", GOTO="configure_nvidia" ATTRS{device}=="0x1349", GOTO="configure_nvidia" ATTRS{device}=="0x134b", GOTO="configure_nvidia" +ATTRS{device}=="0x134d", GOTO="configure_nvidia" +ATTRS{device}=="0x134e", GOTO="configure_nvidia" +ATTRS{device}=="0x134f", GOTO="configure_nvidia" ATTRS{device}=="0x137a", GOTO="configure_nvidia" ATTRS{device}=="0x137d", GOTO="configure_nvidia" ATTRS{device}=="0x1380", GOTO="configure_nvidia" @@ -298,9 +302,11 @@ ATTRS{device}=="0x1618", GOTO="configure_nvidia" ATTRS{device}=="0x1619", GOTO="configure_nvidia" ATTRS{device}=="0x161a", GOTO="configure_nvidia" ATTRS{device}=="0x1667", GOTO="configure_nvidia" +ATTRS{device}=="0x179c", GOTO="configure_nvidia" ATTRS{device}=="0x17c2", GOTO="configure_nvidia" ATTRS{device}=="0x17c8", GOTO="configure_nvidia" ATTRS{device}=="0x17f0", GOTO="configure_nvidia" +ATTRS{device}=="0x17f1", GOTO="configure_nvidia" ATTRS{device}=="0x17fd", GOTO="configure_nvidia" GOTO="configure_nvidia-legacy" diff --git a/packages/x11/driver/xf86-video-virtualbox/config/xorg-vboxvideo.conf b/packages/x11/driver/xf86-video-virtualbox/config/xorg-vboxvideo.conf new file mode 100644 index 00000000000..1561f7003fc --- /dev/null +++ b/packages/x11/driver/xf86-video-virtualbox/config/xorg-vboxvideo.conf @@ -0,0 +1,31 @@ +Section "Device" + Identifier "Configured Video Device" + Driver "vboxvideo" +EndSection + +Section "Monitor" + Identifier "Configured Monitor" +EndSection + +Section "Screen" + Identifier "Default Screen" + Monitor "Configured Monitor" + Device "Configured Video Device" + DefaultDepth 24 + SubSection "Display" + Depth 24 + EndSubSection +EndSection + +Section "InputDevice" + Identifier "vboxmouse" + Driver "vboxmouse" + Option "CorePointer" + Option "Device" "/dev/input/mice" +EndSection + +Section "ServerLayout" + Identifier "Default Layout" + Screen "Default Screen" 0 0 + InputDevice "vboxmouse" +EndSection diff --git a/packages/x11/driver/xf86-video-virtualbox/modules-load.d/vboxvideo.conf b/packages/x11/driver/xf86-video-virtualbox/modules-load.d/vboxvideo.conf new file mode 100644 index 00000000000..5dd2cc22e96 --- /dev/null +++ b/packages/x11/driver/xf86-video-virtualbox/modules-load.d/vboxvideo.conf @@ -0,0 +1,2 @@ +# load vboxvideo kernel module +vboxvideo diff --git a/packages/x11/driver/xf86-video-virtualbox/package.mk b/packages/x11/driver/xf86-video-virtualbox/package.mk new file mode 100644 index 00000000000..1354770481e --- /dev/null +++ b/packages/x11/driver/xf86-video-virtualbox/package.mk @@ -0,0 +1,51 @@ +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) +# +# OpenELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# OpenELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with OpenELEC. If not, see <http://www.gnu.org/licenses/>. +################################################################################ + +PKG_NAME="xf86-video-virtualbox" +PKG_VERSION="5.0.20" +PKG_REV="1" +PKG_ARCH="x86_64" +PKG_LICENSE="OSS" +PKG_SITE="http://www.virtualbox.org" +PKG_URL="${DISTRO_SRC}/${PKG_NAME}-${PKG_VERSION}.tar.xz" +PKG_DEPENDS_TARGET="toolchain libXcomposite libXdamage libXfixes libXext libX11 libxcb libXau" +PKG_PRIORITY="optional" +PKG_SECTION="x11/driver" +PKG_SHORTDESC="xf86-video-virtualbox: The Xorg driver for virtualbox video" +PKG_LONGDESC="xf86-video-virtualbox: The Xorg driver for virtualbox video" + +PKG_IS_ADDON="no" +PKG_AUTORECONF="no" + +make_target() { + : # nothing todo +} + +makeinstall_target() { + mkdir -p $INSTALL/$XORG_PATH_MODULES/drivers + cp -P lib/VBoxGuestAdditions/vboxvideo_drv_118.so $INSTALL/$XORG_PATH_MODULES/drivers/vboxvideo_drv.so + + mkdir -p $INSTALL/usr/lib/dri + cp -P lib/VBoxOGL.so $INSTALL/usr/lib/dri/vboxvideo_dri.so + + mkdir -p $INSTALL/usr/lib + cp -aP lib/* $INSTALL/usr/lib + + mkdir -p $INSTALL/etc/X11 + cp $PKG_DIR/config/*.conf $INSTALL/etc/X11 +} diff --git a/packages/x11/driver/xf86-video-vmware/modules-load.d/vmwgfx.conf b/packages/x11/driver/xf86-video-vmware/modules-load.d/vmwgfx.conf new file mode 100644 index 00000000000..32aff16bbe4 --- /dev/null +++ b/packages/x11/driver/xf86-video-vmware/modules-load.d/vmwgfx.conf @@ -0,0 +1,3 @@ +# load vmwgfx kernel module +vmwgfx + diff --git a/packages/x11/driver/xf86-video-vmware/package.mk b/packages/x11/driver/xf86-video-vmware/package.mk new file mode 100644 index 00000000000..ea12d94bb5c --- /dev/null +++ b/packages/x11/driver/xf86-video-vmware/package.mk @@ -0,0 +1,36 @@ +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) +# +# OpenELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# OpenELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with OpenELEC. If not, see <http://www.gnu.org/licenses/>. +################################################################################ + +PKG_NAME="xf86-video-vmware" +PKG_VERSION="13.1.0" +PKG_REV="1" +PKG_ARCH="x86_64" +PKG_LICENSE="OSS" +PKG_SITE="http://www.vmware.com" +PKG_URL="http://xorg.freedesktop.org/releases/individual/driver/${PKG_NAME}-${PKG_VERSION}.tar.bz2" +PKG_DEPENDS_TARGET="toolchain mesa glu libX11 xorg-server open-vm-tools" +PKG_PRIORITY="optional" +PKG_SECTION="x11/driver" +PKG_SHORTDESC="xf86-video-vmware: The Xorg driver for vmware video" +PKG_LONGDESC="xf86-video-vmware: The Xorg driver for vmware video" + +PKG_IS_ADDON="no" +PKG_AUTORECONF="yes" + +PKG_CONFIGURE_OPTS_TARGET="--enable-vmwarectrl-client \ + --with-xorg-module-dir=$XORG_PATH_MODULES" diff --git a/packages/x11/lib/libXcomposite/package.mk b/packages/x11/lib/libXcomposite/package.mk index 55e69913d08..18cf201cfc8 100644 --- a/packages/x11/lib/libXcomposite/package.mk +++ b/packages/x11/lib/libXcomposite/package.mk @@ -32,7 +32,12 @@ PKG_LONGDESC="X Composite Library" PKG_IS_ADDON="no" PKG_AUTORECONF="yes" -PKG_CONFIGURE_OPTS_TARGET="--enable-static --disable-shared" +SHARED_SUPPORT="--disable-shared" +if [ "$PROJECT" = "Virtual" ]; then + SHARED_SUPPORT="--enable-shared" +fi + +PKG_CONFIGURE_OPTS_TARGET="--enable-static $SHARED_SUPPORT" pre_configure_target() { export CFLAGS="$CFLAGS -fPIC" diff --git a/packages/x11/lib/libXdamage/package.mk b/packages/x11/lib/libXdamage/package.mk index 878d7471b52..e4563a10c35 100644 --- a/packages/x11/lib/libXdamage/package.mk +++ b/packages/x11/lib/libXdamage/package.mk @@ -32,7 +32,12 @@ PKG_LONGDESC="LibXdamage provides an X Window System client interface to the DAM PKG_IS_ADDON="no" PKG_AUTORECONF="yes" -PKG_CONFIGURE_OPTS_TARGET="--enable-static --disable-shared" +SHARED_SUPPORT="--disable-shared" +if [ "$PROJECT" = "Virtual" ]; then + SHARED_SUPPORT="--enable-shared" +fi + +PKG_CONFIGURE_OPTS_TARGET="--enable-static $SHARED_SUPPORT" pre_configure_target() { export CFLAGS="$CFLAGS -fPIC" diff --git a/packages/x11/lib/libXfixes/package.mk b/packages/x11/lib/libXfixes/package.mk index c5af0422ffb..42ca9b804bf 100644 --- a/packages/x11/lib/libXfixes/package.mk +++ b/packages/x11/lib/libXfixes/package.mk @@ -32,7 +32,12 @@ PKG_LONGDESC="X Fixes Library" PKG_IS_ADDON="no" PKG_AUTORECONF="yes" -PKG_CONFIGURE_OPTS_TARGET="--enable-static --disable-shared" +SHARED_SUPPORT="--disable-shared" +if [ "$PROJECT" = "Virtual" ]; then + SHARED_SUPPORT="--enable-shared" +fi + +PKG_CONFIGURE_OPTS_TARGET="--enable-static $SHARED_SUPPORT" pre_configure_target() { export CFLAGS="$CFLAGS -fPIC" diff --git a/packages/x11/other/fluxbox/config/keys b/packages/x11/other/fluxbox/config/keys index 10dc635a300..31ed9344505 100644 --- a/packages/x11/other/fluxbox/config/keys +++ b/packages/x11/other/fluxbox/config/keys @@ -1,4 +1,4 @@ -# This is all we need in OpenELEC +# This is all we need # alt-tab Mod1 Tab :NextWindow {groups} (workspace=[current]) Mod1 Shift Tab :PrevWindow {groups} (workspace=[current]) @@ -6,6 +6,7 @@ Mod1 Shift Tab :PrevWindow {groups} (workspace=[current]) # current window commands Mod1 F10 :Maximize Mod1 F11 :Fullscreen +Mod1 Escape :Close # Normal window movement OnTitlebar Move1 :StartMoving diff --git a/packages/x11/other/fontconfig/package.mk b/packages/x11/other/fontconfig/package.mk index a7fc7bce6c6..4f7511aa620 100644 --- a/packages/x11/other/fontconfig/package.mk +++ b/packages/x11/other/fontconfig/package.mk @@ -17,7 +17,7 @@ ################################################################################ PKG_NAME="fontconfig" -PKG_VERSION="2.11.1" +PKG_VERSION="2.11.95" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="OSS" diff --git a/packages/x11/other/ratpoison/config/ratpoisonrc b/packages/x11/other/ratpoison/config/ratpoisonrc deleted file mode 100644 index f1c4e69587c..00000000000 --- a/packages/x11/other/ratpoison/config/ratpoisonrc +++ /dev/null @@ -1,6 +0,0 @@ -startup_message off -set wingravity static -set transgravity static -set maxsizegravity static -set historysize 0 -definekey top M-Tab next diff --git a/packages/x11/other/ratpoison/package.mk b/packages/x11/other/ratpoison/package.mk deleted file mode 100644 index 75d69597d34..00000000000 --- a/packages/x11/other/ratpoison/package.mk +++ /dev/null @@ -1,53 +0,0 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 2 of the License, or -# (at your option) any later version. -# -# OpenELEC is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see <http://www.gnu.org/licenses/>. -################################################################################ - -PKG_NAME="ratpoison" -PKG_VERSION="1.4.8" -PKG_REV="1" -PKG_ARCH="any" -PKG_LICENSE="GPL" -PKG_SITE="http://www.nongnu.org/ratpoison" -PKG_URL="http://download.savannah.nongnu.org/releases/ratpoison/$PKG_NAME-$PKG_VERSION.tar.xz" -PKG_DEPENDS_TARGET="toolchain util-macros libICE libX11 libXext libXtst libXinerama" -PKG_PRIORITY="optional" -PKG_SECTION="x11/other" -PKG_SHORTDESC="ratpoison: A window manager that lets you say good-bye to the rodent" -PKG_LONGDESC="Ratpoison is a simple window manager with no large library dependencies, no fancy graphics, no window decorations, and no rodent dependence. It is largely modeled after GNU Screen, which has done wonders in the virtual terminal market. All interaction with the window manager is done through keystrokes. Ratpoison has a prefix map to minimize the key clobbering that cripples EMACS and other quality pieces of software. All windows are maximized and kept maximized to avoid wasting precious screen space." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="yes" - -PKG_CONFIGURE_OPTS_TARGET="--x-includes=$SYSROOT_PREFIX/usr/include \ - --x-libraries=$SYSROOT_PREFIX/usr/lib \ - --disable-debug \ - --disable-history \ - --with-xterm=rxvt \ - --without-xft \ - --with-x" - -pre_configure_target() { - LDFLAGS="$LDFLAGS -fwhole-program" -} - -post_makeinstall_target() { - rm -rf $INSTALL/usr/bin/rpws - rm -rf $INSTALL/usr/share - - mkdir -p $INSTALL/etc - cp $PKG_DIR/config/ratpoisonrc $INSTALL/etc -} diff --git a/packages/x11/other/ratpoison/system.d/windowmanager.service b/packages/x11/other/ratpoison/system.d/windowmanager.service deleted file mode 100644 index d6d9cee209a..00000000000 --- a/packages/x11/other/ratpoison/system.d/windowmanager.service +++ /dev/null @@ -1,18 +0,0 @@ -[Unit] -Description=Ratpoison Window Manager -Requires=xorg.service -After=xorg.service -Before=kodi.service - -[Service] -Environment=DISPLAY=:0 -Environment=HOME=/storage -ExecStart=/usr/bin/ratpoison --file /etc/ratpoisonrc -KillMode=process -Restart=always -RestartSec=1 -StartLimitInterval=0 -TimeoutStopSec=1s - -[Install] -WantedBy=graphical.target diff --git a/packages/x11/proto/inputproto/package.mk b/packages/x11/proto/inputproto/package.mk index abfe833615d..f79f595c314 100644 --- a/packages/x11/proto/inputproto/package.mk +++ b/packages/x11/proto/inputproto/package.mk @@ -17,7 +17,7 @@ ################################################################################ PKG_NAME="inputproto" -PKG_VERSION="2.3.1" +PKG_VERSION="2.3.2" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="OSS" diff --git a/packages/x11/proto/videoproto/package.mk b/packages/x11/proto/videoproto/package.mk index a4e81176842..b6ff4ec9db6 100644 --- a/packages/x11/proto/videoproto/package.mk +++ b/packages/x11/proto/videoproto/package.mk @@ -17,7 +17,7 @@ ################################################################################ PKG_NAME="videoproto" -PKG_VERSION="2.3.2" +PKG_VERSION="2.3.3" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="OSS" diff --git a/packages/x11/util/xorg-launch-helper/scripts/xorg-launch b/packages/x11/util/xorg-launch-helper/scripts/xorg-launch index 1534c76e2f2..7e973c425fd 100755 --- a/packages/x11/util/xorg-launch-helper/scripts/xorg-launch +++ b/packages/x11/util/xorg-launch-helper/scripts/xorg-launch @@ -19,7 +19,7 @@ # wait for xorg-configure@.service # max 10 seconds -ARGS_FILE="/run/openelec/xorg-settings.conf" +ARGS_FILE="/run/libreelec/xorg-settings.conf" for i in $(seq 1 40) ; do if [ -e "$ARGS_FILE" ] ; then break @@ -28,7 +28,7 @@ for i in $(seq 1 40) ; do done if [ -e "$ARGS_FILE" ] ; then - . /run/openelec/xorg-settings.conf + . /run/libreelec/xorg-settings.conf exec xorg-launch-helper $@ $XORG_ARGS else echo "" > /dev/tty1 diff --git a/packages/x11/xserver/xorg-server/config/xorg-modesetting.conf b/packages/x11/xserver/xorg-server/config/xorg-modesetting.conf new file mode 100644 index 00000000000..80cc388dc8e --- /dev/null +++ b/packages/x11/xserver/xorg-server/config/xorg-modesetting.conf @@ -0,0 +1,4 @@ +Section "Device" + Identifier "Intel Graphics" + Driver "modesetting" +EndSection diff --git a/packages/x11/xserver/xorg-server/package.mk b/packages/x11/xserver/xorg-server/package.mk index d1f8a617fe6..885d367d5bc 100644 --- a/packages/x11/xserver/xorg-server/package.mk +++ b/packages/x11/xserver/xorg-server/package.mk @@ -17,7 +17,7 @@ ################################################################################ PKG_NAME="xorg-server" -PKG_VERSION="1.18.1" +PKG_VERSION="1.18.3" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="OSS" @@ -126,7 +126,7 @@ PKG_CONFIGURE_OPTS_TARGET="--disable-debug \ --with-gnu-ld \ --with-sha1=libcrypto \ --without-systemd-daemon \ - --with-os-vendor=OpenELEC.tv \ + --with-os-vendor=LibreELEC.tv \ --with-module-dir=$XORG_PATH_MODULES \ --with-xkb-path=$XORG_PATH_XKB \ --with-xkb-output=/var/cache/xkb \ @@ -165,9 +165,8 @@ post_makeinstall_target() { mkdir -p $INSTALL/etc/X11 if [ -f $PROJECT_DIR/$PROJECT/xorg/xorg.conf ]; then cp $PROJECT_DIR/$PROJECT/xorg/xorg.conf $INSTALL/etc/X11 - elif [ -f $PKG_DIR/config/xorg.conf ]; then - cp $PKG_DIR/config/xorg.conf $INSTALL/etc/X11 fi + cp $PKG_DIR/config/xorg*.conf $INSTALL/etc/X11 if [ ! "$DEVTOOLS" = yes ]; then rm -rf $INSTALL/usr/bin/cvt diff --git a/packages/x11/xserver/xorg-server/scripts/xorg-configure b/packages/x11/xserver/xorg-server/scripts/xorg-configure index 738d84e7d3c..e7c638254fa 100755 --- a/packages/x11/xserver/xorg-server/scripts/xorg-configure +++ b/packages/x11/xserver/xorg-server/scripts/xorg-configure @@ -104,5 +104,5 @@ logger -t Xorg "### creating needed directories and symlinks ###" ################################################################################ logger -t Xorg "### starting Xorg with '$DISPLAY vt01 $XORG_ARGS' ###" - mkdir -p /run/openelec - echo "XORG_ARGS=\"$XORG_ARGS\"" > /run/openelec/xorg-settings.conf + mkdir -p /run/libreelec + echo "XORG_ARGS=\"$XORG_ARGS\"" > /run/libreelec/xorg-settings.conf diff --git a/packages/x11/xserver/xorg-server/system.d/xorg.service b/packages/x11/xserver/xorg-server/system.d/xorg.service index 683e36ebea5..a9dbde6893a 100644 --- a/packages/x11/xserver/xorg-server/system.d/xorg.service +++ b/packages/x11/xserver/xorg-server/system.d/xorg.service @@ -6,7 +6,7 @@ ConditionKernelCommandLine=!installer [Service] Type=notify -EnvironmentFile=-/run/openelec/debug/xorg.conf +EnvironmentFile=-/run/libreelec/debug/xorg.conf ExecStart=/usr/bin/xorg-launch -nolisten tcp vt01 $XORG_DEBUG Restart=always RestartSec=2 diff --git a/packages/x11/xserver/xorg-server/udev.d/97-xorg.rules b/packages/x11/xserver/xorg-server/udev.d/97-xorg.rules index 3ea84ec9848..e88b79dc011 100644 --- a/packages/x11/xserver/xorg-server/udev.d/97-xorg.rules +++ b/packages/x11/xserver/xorg-server/udev.d/97-xorg.rules @@ -20,11 +20,18 @@ ACTION!="add|change", GOTO="end_video" # xorg_start only does something for subsystem "pci" and "video" class. SUBSYSTEM=="pci", ATTR{class}=="0x030000", GOTO="subsystem_pci" +SUBSYSTEM=="drivers", GOTO="subsystem_drivers" +GOTO="end_video" + +# check for drivers dont use the pci substem +LABEL="subsystem_drivers" +KERNEL=="vboxvideo", ENV{xorg_driver}="vboxvideo", TAG+="systemd", ENV{SYSTEMD_WANTS}+="xorg-configure@vboxvideo.service" +KERNEL=="vmwgfx", ENV{xorg_driver}="vmware", TAG+="systemd", ENV{SYSTEMD_WANTS}+="xorg-configure@vmware.service" GOTO="end_video" # check for drivers using the pci substem LABEL="subsystem_pci" -DRIVER=="i915", ENV{xorg_driver}="i915", TAG+="systemd", ENV{SYSTEMD_WANTS}+="xorg-configure@i915.service" +DRIVER=="i915", ENV{xorg_driver}="modesetting", TAG+="systemd", ENV{SYSTEMD_WANTS}+="xorg-configure@modesetting.service" DRIVER=="amdgpu", ENV{xorg_driver}="amdgpu", TAG+="systemd", ENV{SYSTEMD_WANTS}+="xorg-configure@amdgpu.service" DRIVER=="radeon", ENV{xorg_driver}="radeon", TAG+="systemd", ENV{SYSTEMD_WANTS}+="xorg-configure@radeon.service" GOTO="end_video" diff --git a/projects/Generic/linux/linux.x86_64.conf b/projects/Generic/linux/linux.x86_64.conf index 2f449f27708..081738f5e6e 100644 --- a/projects/Generic/linux/linux.x86_64.conf +++ b/projects/Generic/linux/linux.x86_64.conf @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/x86_64 4.4.2 Kernel Configuration +# Linux/x86 4.6.0-rc5 Kernel Configuration # CONFIG_64BIT=y CONFIG_X86_64=y @@ -11,8 +11,11 @@ CONFIG_OUTPUT_FORMAT="elf64-x86-64" CONFIG_ARCH_DEFCONFIG="arch/x86/configs/x86_64_defconfig" CONFIG_LOCKDEP_SUPPORT=y CONFIG_STACKTRACE_SUPPORT=y -CONFIG_HAVE_LATENCYTOP_SUPPORT=y CONFIG_MMU=y +CONFIG_ARCH_MMAP_RND_BITS_MIN=28 +CONFIG_ARCH_MMAP_RND_BITS_MAX=32 +CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MIN=8 +CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MAX=16 CONFIG_NEED_DMA_MAP_STATE=y CONFIG_NEED_SG_DMA_LENGTH=y CONFIG_GENERIC_ISA_DMA=y @@ -39,6 +42,7 @@ CONFIG_X86_64_SMP=y CONFIG_ARCH_HWEIGHT_CFLAGS="-fcall-saved-rdi -fcall-saved-rsi -fcall-saved-rdx -fcall-saved-rcx -fcall-saved-r8 -fcall-saved-r9 -fcall-saved-r10 -fcall-saved-r11" CONFIG_ARCH_SUPPORTS_UPROBES=y CONFIG_FIX_EARLYCON_MEM=y +CONFIG_DEBUG_RODATA=y CONFIG_PGTABLE_LEVELS=4 CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" CONFIG_IRQ_WORK=y @@ -141,26 +145,25 @@ CONFIG_ARCH_SUPPORTS_INT128=y CONFIG_NUMA_BALANCING=y CONFIG_NUMA_BALANCING_DEFAULT_ENABLED=y CONFIG_CGROUPS=y -# CONFIG_CGROUP_DEBUG is not set -CONFIG_CGROUP_FREEZER=y -# CONFIG_CGROUP_PIDS is not set -CONFIG_CGROUP_DEVICE=y -CONFIG_CPUSETS=y -CONFIG_PROC_PID_CPUSET=y -CONFIG_CGROUP_CPUACCT=y CONFIG_PAGE_COUNTER=y CONFIG_MEMCG=y CONFIG_MEMCG_SWAP=y CONFIG_MEMCG_SWAP_ENABLED=y -CONFIG_MEMCG_KMEM=y -CONFIG_CGROUP_PERF=y +CONFIG_BLK_CGROUP=y +# CONFIG_DEBUG_BLK_CGROUP is not set +CONFIG_CGROUP_WRITEBACK=y CONFIG_CGROUP_SCHED=y CONFIG_FAIR_GROUP_SCHED=y CONFIG_CFS_BANDWIDTH=y CONFIG_RT_GROUP_SCHED=y -CONFIG_BLK_CGROUP=y -# CONFIG_DEBUG_BLK_CGROUP is not set -CONFIG_CGROUP_WRITEBACK=y +# CONFIG_CGROUP_PIDS is not set +CONFIG_CGROUP_FREEZER=y +CONFIG_CPUSETS=y +CONFIG_PROC_PID_CPUSET=y +CONFIG_CGROUP_DEVICE=y +CONFIG_CGROUP_CPUACCT=y +CONFIG_CGROUP_PERF=y +# CONFIG_CGROUP_DEBUG is not set # CONFIG_CHECKPOINT_RESTORE is not set CONFIG_NAMESPACES=y CONFIG_UTS_NS=y @@ -196,6 +199,8 @@ CONFIG_MULTIUSER=y # CONFIG_SYSCTL_SYSCALL is not set CONFIG_KALLSYMS=y # CONFIG_KALLSYMS_ALL is not set +CONFIG_KALLSYMS_ABSOLUTE_PERCPU=y +CONFIG_KALLSYMS_BASE_RELATIVE=y CONFIG_PRINTK=y CONFIG_BUG=y CONFIG_ELF_CORE=y @@ -245,7 +250,6 @@ CONFIG_HAVE_KRETPROBES=y CONFIG_HAVE_OPTPROBES=y CONFIG_HAVE_KPROBES_ON_FTRACE=y CONFIG_HAVE_ARCH_TRACEHOOK=y -CONFIG_HAVE_DMA_ATTRS=y CONFIG_HAVE_DMA_CONTIGUOUS=y CONFIG_GENERIC_SMP_IDLE_THREAD=y CONFIG_ARCH_WANTS_DYNAMIC_TASK_STRUCT=y @@ -281,7 +285,12 @@ CONFIG_HAVE_ARCH_SOFT_DIRTY=y CONFIG_MODULES_USE_ELF_RELA=y CONFIG_HAVE_IRQ_EXIT_ON_IRQ_STACK=y CONFIG_ARCH_HAS_ELF_RANDOMIZE=y +CONFIG_HAVE_ARCH_MMAP_RND_BITS=y +CONFIG_ARCH_MMAP_RND_BITS=28 +CONFIG_HAVE_ARCH_MMAP_RND_COMPAT_BITS=y +CONFIG_ARCH_MMAP_RND_COMPAT_BITS=8 CONFIG_HAVE_COPY_THREAD_TLS=y +CONFIG_HAVE_STACK_VALIDATION=y CONFIG_OLD_SIGSUSPEND3=y CONFIG_COMPAT_OLD_SIGACTION=y @@ -367,18 +376,21 @@ CONFIG_FREEZER=y CONFIG_ZONE_DMA=y CONFIG_SMP=y CONFIG_X86_FEATURE_NAMES=y +CONFIG_X86_FAST_FEATURE_TESTS=y # CONFIG_X86_X2APIC is not set CONFIG_X86_MPPARSE=y +# CONFIG_GOLDFISH is not set # CONFIG_X86_EXTENDED_PLATFORM is not set CONFIG_X86_INTEL_LPSS=y CONFIG_X86_AMD_PLATFORM_DEVICE=y -CONFIG_IOSF_MBI=m +CONFIG_IOSF_MBI=y # CONFIG_IOSF_MBI_DEBUG is not set CONFIG_SCHED_OMIT_FRAME_POINTER=y CONFIG_HYPERVISOR_GUEST=y CONFIG_PARAVIRT=y # CONFIG_PARAVIRT_DEBUG is not set CONFIG_PARAVIRT_SPINLOCKS=y +# CONFIG_QUEUED_LOCK_STAT is not set # CONFIG_XEN is not set CONFIG_KVM_GUEST=y # CONFIG_KVM_DEBUG_FS is not set @@ -428,6 +440,7 @@ CONFIG_MICROCODE=y CONFIG_MICROCODE_INTEL=y CONFIG_MICROCODE_AMD=y CONFIG_MICROCODE_OLD_INTERFACE=y +# CONFIG_PERF_EVENTS_AMD_POWER is not set CONFIG_X86_MSR=y CONFIG_X86_CPUID=y CONFIG_ARCH_PHYS_ADDR_T_64BIT=y @@ -469,6 +482,7 @@ CONFIG_PHYS_ADDR_T_64BIT=y CONFIG_ZONE_DMA_FLAG=1 CONFIG_BOUNCE=y CONFIG_VIRT_TO_BUS=y +CONFIG_MMU_NOTIFIER=y # CONFIG_KSM is not set CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 CONFIG_TRANSPARENT_HUGEPAGE=y @@ -484,6 +498,8 @@ CONFIG_GENERIC_EARLY_IOREMAP=y CONFIG_ARCH_SUPPORTS_DEFERRED_STRUCT_PAGE_INIT=y # CONFIG_IDLE_PAGE_TRACKING is not set CONFIG_FRAME_VECTOR=y +CONFIG_ARCH_USES_HIGH_VMA_FLAGS=y +CONFIG_ARCH_HAS_PKEYS=y # CONFIG_X86_PMEM_LEGACY is not set CONFIG_X86_CHECK_BIOS_CORRUPTION=y CONFIG_X86_BOOTPARAM_MEMORY_CORRUPTION_CHECK=y @@ -497,6 +513,7 @@ CONFIG_ARCH_USES_PG_UNCACHED=y CONFIG_ARCH_RANDOM=y # CONFIG_X86_SMAP is not set # CONFIG_X86_INTEL_MPX is not set +CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS=y CONFIG_EFI=y CONFIG_EFI_STUB=y # CONFIG_EFI_MIXED is not set @@ -666,14 +683,15 @@ CONFIG_HT_IRQ=y # CONFIG_PCI_PRI is not set # CONFIG_PCI_PASID is not set CONFIG_PCI_LABEL=y +# CONFIG_HOTPLUG_PCI is not set # # PCI host controller drivers # +# CONFIG_PCIE_DW_PLAT is not set CONFIG_ISA_DMA_API=y CONFIG_AMD_NB=y # CONFIG_PCCARD is not set -# CONFIG_HOTPLUG_PCI is not set # CONFIG_RAPIDIO is not set # CONFIG_X86_SYSFB is not set @@ -696,6 +714,7 @@ CONFIG_SYSVIPC_COMPAT=y CONFIG_KEYS_COMPAT=y CONFIG_X86_DEV_DMA_OPS=y CONFIG_PMC_ATOM=y +# CONFIG_VMD is not set CONFIG_NET=y CONFIG_COMPAT_NETLINK_MESSAGES=y @@ -733,7 +752,6 @@ CONFIG_INET_TUNNEL=m # CONFIG_INET_XFRM_MODE_TRANSPORT is not set # CONFIG_INET_XFRM_MODE_TUNNEL is not set # CONFIG_INET_XFRM_MODE_BEET is not set -CONFIG_INET_LRO=y # CONFIG_INET_DIAG is not set # CONFIG_TCP_CONG_ADVANCED is not set CONFIG_TCP_CONG_CUBIC=y @@ -982,7 +1000,6 @@ CONFIG_DNS_RESOLVER=y # CONFIG_BATMAN_ADV is not set # CONFIG_OPENVSWITCH is not set # CONFIG_VSOCKETS is not set -# CONFIG_NETLINK_MMAP is not set # CONFIG_NETLINK_DIAG is not set # CONFIG_MPLS is not set # CONFIG_HSR is not set @@ -991,6 +1008,7 @@ CONFIG_DNS_RESOLVER=y CONFIG_RPS=y CONFIG_RFS_ACCEL=y CONFIG_XPS=y +# CONFIG_SOCK_CGROUP_DATA is not set # CONFIG_CGROUP_NET_PRIO is not set # CONFIG_CGROUP_NET_CLASSID is not set CONFIG_NET_RX_BUSY_POLL=y @@ -1015,6 +1033,7 @@ CONFIG_BT_BNEP_PROTO_FILTER=y CONFIG_BT_HIDP=m CONFIG_BT_HS=y CONFIG_BT_LE=y +# CONFIG_BT_LEDS is not set # CONFIG_BT_SELFTEST is not set # CONFIG_BT_DEBUGFS is not set @@ -1035,6 +1054,7 @@ CONFIG_BT_HCIBTUSB_RTL=y # CONFIG_BT_MRVL is not set CONFIG_BT_ATH3K=m # CONFIG_AF_RXRPC is not set +# CONFIG_AF_KCM is not set CONFIG_WIRELESS=y CONFIG_WIRELESS_EXT=y CONFIG_WEXT_CORE=y @@ -1044,7 +1064,6 @@ CONFIG_WEXT_PRIV=y CONFIG_CFG80211=m # CONFIG_NL80211_TESTMODE is not set # CONFIG_CFG80211_DEVELOPER_WARNINGS is not set -# CONFIG_CFG80211_REG_DEBUG is not set # CONFIG_CFG80211_CERTIFICATION_ONUS is not set CONFIG_CFG80211_DEFAULT_PS=y # CONFIG_CFG80211_DEBUGFS is not set @@ -1077,6 +1096,9 @@ CONFIG_MAC80211_STA_HASH_MAX_SIZE=0 # CONFIG_CEPH_LIB is not set # CONFIG_NFC is not set # CONFIG_LWTUNNEL is not set +CONFIG_DST_CACHE=y +# CONFIG_NET_DEVLINK is not set +CONFIG_MAY_USE_DEVLINK=y CONFIG_HAVE_BPF_JIT=y # @@ -1093,7 +1115,7 @@ CONFIG_STANDALONE=y # CONFIG_PREVENT_FIRMWARE_BUILD is not set CONFIG_FW_LOADER=y CONFIG_FIRMWARE_IN_KERNEL=y -CONFIG_EXTRA_FIRMWARE="i915/bxt_dmc_ver1_04.bin i915/bxt_dmc_ver1_05.bin i915/bxt_dmc_ver1_06.bin i915/bxt_dmc_ver1.bin i915/skl_dmc_ver1_21.bin i915/skl_dmc_ver1_22.bin i915/skl_dmc_ver1.bin i915/skl_guc_ver1_1059.bin i915/skl_guc_ver1.bin i915/skl_guc_ver4_3.bin i915/skl_guc_ver4.bin bnx2/bnx2-mips-06-6.2.1.fw bnx2/bnx2-mips-09-6.2.1a.fw bnx2/bnx2-rv2p-06-6.0.15.fw bnx2/bnx2-rv2p-09-6.0.17.fw bnx2/bnx2-rv2p-09ax-6.0.17.fw tigon/tg3.bin tigon/tg3_tso5.bin tigon/tg3_tso.bin rtl_nic/rtl8105e-1.fw rtl_nic/rtl8106e-1.fw rtl_nic/rtl8106e-2.fw rtl_nic/rtl8107e-1.fw rtl_nic/rtl8107e-2.fw rtl_nic/rtl8168d-1.fw rtl_nic/rtl8168d-2.fw rtl_nic/rtl8168e-1.fw rtl_nic/rtl8168e-2.fw rtl_nic/rtl8168e-3.fw rtl_nic/rtl8168f-1.fw rtl_nic/rtl8168f-2.fw rtl_nic/rtl8168g-1.fw rtl_nic/rtl8168g-2.fw rtl_nic/rtl8168g-3.fw rtl_nic/rtl8168h-1.fw rtl_nic/rtl8168h-2.fw rtl_nic/rtl8402-1.fw rtl_nic/rtl8411-1.fw rtl_nic/rtl8411-2.fw radeon/ARUBA_me.bin radeon/ARUBA_pfp.bin radeon/ARUBA_rlc.bin radeon/BARTS_mc.bin radeon/BARTS_me.bin radeon/BARTS_pfp.bin radeon/BARTS_smc.bin radeon/bonaire_ce.bin radeon/BONAIRE_ce.bin radeon/BONAIRE_mc2.bin radeon/bonaire_mc.bin radeon/BONAIRE_mc.bin radeon/bonaire_me.bin radeon/BONAIRE_me.bin radeon/bonaire_mec.bin radeon/BONAIRE_mec.bin radeon/bonaire_pfp.bin radeon/BONAIRE_pfp.bin radeon/bonaire_rlc.bin radeon/BONAIRE_rlc.bin radeon/bonaire_sdma.bin radeon/BONAIRE_sdma.bin radeon/bonaire_smc.bin radeon/BONAIRE_smc.bin radeon/BONAIRE_uvd.bin radeon/BONAIRE_vce.bin radeon/BTC_rlc.bin radeon/CAICOS_mc.bin radeon/CAICOS_me.bin radeon/CAICOS_pfp.bin radeon/CAICOS_smc.bin radeon/CAYMAN_mc.bin radeon/CAYMAN_me.bin radeon/CAYMAN_pfp.bin radeon/CAYMAN_rlc.bin radeon/CAYMAN_smc.bin radeon/CEDAR_me.bin radeon/CEDAR_pfp.bin radeon/CEDAR_rlc.bin radeon/CEDAR_smc.bin radeon/CYPRESS_me.bin radeon/CYPRESS_pfp.bin radeon/CYPRESS_rlc.bin radeon/CYPRESS_smc.bin radeon/CYPRESS_uvd.bin radeon/hainan_ce.bin radeon/HAINAN_ce.bin radeon/HAINAN_mc2.bin radeon/hainan_mc.bin radeon/HAINAN_mc.bin radeon/hainan_me.bin radeon/HAINAN_me.bin radeon/hainan_pfp.bin radeon/HAINAN_pfp.bin radeon/hainan_rlc.bin radeon/HAINAN_rlc.bin radeon/hainan_smc.bin radeon/HAINAN_smc.bin radeon/hawaii_ce.bin radeon/HAWAII_ce.bin radeon/HAWAII_mc2.bin radeon/hawaii_mc.bin radeon/HAWAII_mc.bin radeon/hawaii_me.bin radeon/HAWAII_me.bin radeon/hawaii_mec.bin radeon/HAWAII_mec.bin radeon/hawaii_pfp.bin radeon/HAWAII_pfp.bin radeon/hawaii_rlc.bin radeon/HAWAII_rlc.bin radeon/hawaii_sdma.bin radeon/HAWAII_sdma.bin radeon/hawaii_smc.bin radeon/HAWAII_smc.bin radeon/JUNIPER_me.bin radeon/JUNIPER_pfp.bin radeon/JUNIPER_rlc.bin radeon/JUNIPER_smc.bin radeon/kabini_ce.bin radeon/KABINI_ce.bin radeon/kabini_me.bin radeon/KABINI_me.bin radeon/kabini_mec.bin radeon/KABINI_mec.bin radeon/kabini_pfp.bin radeon/KABINI_pfp.bin radeon/kabini_rlc.bin radeon/KABINI_rlc.bin radeon/kabini_sdma.bin radeon/KABINI_sdma.bin radeon/kaveri_ce.bin radeon/KAVERI_ce.bin radeon/kaveri_me.bin radeon/KAVERI_me.bin radeon/kaveri_mec2.bin radeon/kaveri_mec.bin radeon/KAVERI_mec.bin radeon/kaveri_pfp.bin radeon/KAVERI_pfp.bin radeon/kaveri_rlc.bin radeon/KAVERI_rlc.bin radeon/kaveri_sdma.bin radeon/KAVERI_sdma.bin radeon/mullins_ce.bin radeon/MULLINS_ce.bin radeon/mullins_me.bin radeon/MULLINS_me.bin radeon/mullins_mec.bin radeon/MULLINS_mec.bin radeon/mullins_pfp.bin radeon/MULLINS_pfp.bin radeon/mullins_rlc.bin radeon/MULLINS_rlc.bin radeon/mullins_sdma.bin radeon/MULLINS_sdma.bin radeon/oland_ce.bin radeon/OLAND_ce.bin radeon/OLAND_mc2.bin radeon/oland_mc.bin radeon/OLAND_mc.bin radeon/oland_me.bin radeon/OLAND_me.bin radeon/oland_pfp.bin radeon/OLAND_pfp.bin radeon/oland_rlc.bin radeon/OLAND_rlc.bin radeon/oland_smc.bin radeon/OLAND_smc.bin radeon/PALM_me.bin radeon/PALM_pfp.bin radeon/pitcairn_ce.bin radeon/PITCAIRN_ce.bin radeon/PITCAIRN_mc2.bin radeon/pitcairn_mc.bin radeon/PITCAIRN_mc.bin radeon/pitcairn_me.bin radeon/PITCAIRN_me.bin radeon/pitcairn_pfp.bin radeon/PITCAIRN_pfp.bin radeon/pitcairn_rlc.bin radeon/PITCAIRN_rlc.bin radeon/pitcairn_smc.bin radeon/PITCAIRN_smc.bin radeon/R100_cp.bin radeon/R200_cp.bin radeon/R300_cp.bin radeon/R420_cp.bin radeon/R520_cp.bin radeon/R600_me.bin radeon/R600_pfp.bin radeon/R600_rlc.bin radeon/R600_uvd.bin radeon/R700_rlc.bin radeon/REDWOOD_me.bin radeon/REDWOOD_pfp.bin radeon/REDWOOD_rlc.bin radeon/REDWOOD_smc.bin radeon/RS600_cp.bin radeon/RS690_cp.bin radeon/RS780_me.bin radeon/RS780_pfp.bin radeon/RS780_uvd.bin radeon/RV610_me.bin radeon/RV610_pfp.bin radeon/RV620_me.bin radeon/RV620_pfp.bin radeon/RV630_me.bin radeon/RV630_pfp.bin radeon/RV635_me.bin radeon/RV635_pfp.bin radeon/RV670_me.bin radeon/RV670_pfp.bin radeon/RV710_me.bin radeon/RV710_pfp.bin radeon/RV710_smc.bin radeon/RV710_uvd.bin radeon/RV730_me.bin radeon/RV730_pfp.bin radeon/RV730_smc.bin radeon/RV740_smc.bin radeon/RV770_me.bin radeon/RV770_pfp.bin radeon/RV770_smc.bin radeon/RV770_uvd.bin radeon/SUMO2_me.bin radeon/SUMO2_pfp.bin radeon/SUMO_me.bin radeon/SUMO_pfp.bin radeon/SUMO_rlc.bin radeon/SUMO_uvd.bin radeon/tahiti_ce.bin radeon/TAHITI_ce.bin radeon/TAHITI_mc2.bin radeon/tahiti_mc.bin radeon/TAHITI_mc.bin radeon/tahiti_me.bin radeon/TAHITI_me.bin radeon/tahiti_pfp.bin radeon/TAHITI_pfp.bin radeon/tahiti_rlc.bin radeon/TAHITI_rlc.bin radeon/tahiti_smc.bin radeon/TAHITI_smc.bin radeon/TAHITI_uvd.bin radeon/TURKS_mc.bin radeon/TURKS_me.bin radeon/TURKS_pfp.bin radeon/TURKS_smc.bin radeon/verde_ce.bin radeon/VERDE_ce.bin radeon/VERDE_mc2.bin radeon/verde_mc.bin radeon/VERDE_mc.bin radeon/verde_me.bin radeon/VERDE_me.bin radeon/verde_pfp.bin radeon/VERDE_pfp.bin radeon/verde_rlc.bin radeon/VERDE_rlc.bin radeon/verde_smc.bin radeon/VERDE_smc.bin amdgpu/carrizo_ce.bin amdgpu/carrizo_me.bin amdgpu/carrizo_mec2.bin amdgpu/carrizo_mec.bin amdgpu/carrizo_pfp.bin amdgpu/carrizo_rlc.bin amdgpu/carrizo_sdma1.bin amdgpu/carrizo_sdma.bin amdgpu/carrizo_uvd.bin amdgpu/carrizo_vce.bin amdgpu/fiji_ce.bin amdgpu/fiji_mc.bin amdgpu/fiji_me.bin amdgpu/fiji_mec2.bin amdgpu/fiji_mec.bin amdgpu/fiji_pfp.bin amdgpu/fiji_rlc.bin amdgpu/fiji_sdma1.bin amdgpu/fiji_sdma.bin amdgpu/fiji_smc.bin amdgpu/fiji_uvd.bin amdgpu/fiji_vce.bin amdgpu/tonga_ce.bin amdgpu/tonga_mc.bin amdgpu/tonga_me.bin amdgpu/tonga_mec2.bin amdgpu/tonga_mec.bin amdgpu/tonga_pfp.bin amdgpu/tonga_rlc.bin amdgpu/tonga_sdma1.bin amdgpu/tonga_sdma.bin amdgpu/tonga_smc.bin amdgpu/tonga_uvd.bin amdgpu/tonga_vce.bin amdgpu/topaz_ce.bin amdgpu/topaz_mc.bin amdgpu/topaz_me.bin amdgpu/topaz_mec2.bin amdgpu/topaz_mec.bin amdgpu/topaz_pfp.bin amdgpu/topaz_rlc.bin amdgpu/topaz_sdma1.bin amdgpu/topaz_sdma.bin amdgpu/topaz_smc.bin" +CONFIG_EXTRA_FIRMWARE="amdgpu/carrizo_ce.bin amdgpu/carrizo_me.bin amdgpu/carrizo_mec2.bin amdgpu/carrizo_mec.bin amdgpu/carrizo_pfp.bin amdgpu/carrizo_rlc.bin amdgpu/carrizo_sdma1.bin amdgpu/carrizo_sdma.bin amdgpu/carrizo_uvd.bin amdgpu/carrizo_vce.bin amdgpu/fiji_ce.bin amdgpu/fiji_mc.bin amdgpu/fiji_me.bin amdgpu/fiji_mec2.bin amdgpu/fiji_mec.bin amdgpu/fiji_pfp.bin amdgpu/fiji_rlc.bin amdgpu/fiji_sdma1.bin amdgpu/fiji_sdma.bin amdgpu/fiji_smc.bin amdgpu/fiji_uvd.bin amdgpu/fiji_vce.bin amdgpu/polaris10_ce.bin amdgpu/polaris10_mc.bin amdgpu/polaris10_me.bin amdgpu/polaris10_mec2.bin amdgpu/polaris10_mec.bin amdgpu/polaris10_pfp.bin amdgpu/polaris10_rlc.bin amdgpu/polaris10_sdma1.bin amdgpu/polaris10_sdma.bin amdgpu/polaris10_smc.bin amdgpu/polaris10_smc_sk.bin amdgpu/polaris10_uvd.bin amdgpu/polaris10_vce.bin amdgpu/polaris11_ce.bin amdgpu/polaris11_mc.bin amdgpu/polaris11_me.bin amdgpu/polaris11_mec2.bin amdgpu/polaris11_mec.bin amdgpu/polaris11_pfp.bin amdgpu/polaris11_rlc.bin amdgpu/polaris11_sdma1.bin amdgpu/polaris11_sdma.bin amdgpu/polaris11_smc.bin amdgpu/polaris11_smc_sk.bin amdgpu/polaris11_uvd.bin amdgpu/polaris11_vce.bin amdgpu/stoney_ce.bin amdgpu/stoney_me.bin amdgpu/stoney_mec.bin amdgpu/stoney_pfp.bin amdgpu/stoney_rlc.bin amdgpu/stoney_sdma.bin amdgpu/stoney_uvd.bin amdgpu/stoney_vce.bin amdgpu/tonga_ce.bin amdgpu/tonga_mc.bin amdgpu/tonga_me.bin amdgpu/tonga_mec2.bin amdgpu/tonga_mec.bin amdgpu/tonga_pfp.bin amdgpu/tonga_rlc.bin amdgpu/tonga_sdma1.bin amdgpu/tonga_sdma.bin amdgpu/tonga_smc.bin amdgpu/tonga_uvd.bin amdgpu/tonga_vce.bin amdgpu/topaz_ce.bin amdgpu/topaz_mc.bin amdgpu/topaz_me.bin amdgpu/topaz_mec2.bin amdgpu/topaz_mec.bin amdgpu/topaz_pfp.bin amdgpu/topaz_rlc.bin amdgpu/topaz_sdma1.bin amdgpu/topaz_sdma.bin amdgpu/topaz_smc.bin i915/bxt_dmc_ver1_04.bin i915/bxt_dmc_ver1_05.bin i915/bxt_dmc_ver1_06.bin i915/bxt_dmc_ver1.bin i915/skl_dmc_ver1_21.bin i915/skl_dmc_ver1_22.bin i915/skl_dmc_ver1.bin i915/skl_guc_ver1_1059.bin i915/skl_guc_ver1.bin i915/skl_guc_ver4_3.bin i915/skl_guc_ver4.bin radeon/ARUBA_me.bin radeon/ARUBA_pfp.bin radeon/ARUBA_rlc.bin radeon/BARTS_mc.bin radeon/BARTS_me.bin radeon/BARTS_pfp.bin radeon/BARTS_smc.bin radeon/BONAIRE_ce.bin radeon/bonaire_ce.bin radeon/BONAIRE_mc2.bin radeon/BONAIRE_mc.bin radeon/bonaire_mc.bin radeon/BONAIRE_me.bin radeon/bonaire_me.bin radeon/BONAIRE_mec.bin radeon/bonaire_mec.bin radeon/BONAIRE_pfp.bin radeon/bonaire_pfp.bin radeon/BONAIRE_rlc.bin radeon/bonaire_rlc.bin radeon/bonaire_sdma1.bin radeon/BONAIRE_sdma.bin radeon/bonaire_sdma.bin radeon/BONAIRE_smc.bin radeon/bonaire_smc.bin radeon/BONAIRE_uvd.bin radeon/bonaire_uvd.bin radeon/BONAIRE_vce.bin radeon/bonaire_vce.bin radeon/BTC_rlc.bin radeon/CAICOS_mc.bin radeon/CAICOS_me.bin radeon/CAICOS_pfp.bin radeon/CAICOS_smc.bin radeon/CAYMAN_mc.bin radeon/CAYMAN_me.bin radeon/CAYMAN_pfp.bin radeon/CAYMAN_rlc.bin radeon/CAYMAN_smc.bin radeon/CEDAR_me.bin radeon/CEDAR_pfp.bin radeon/CEDAR_rlc.bin radeon/CEDAR_smc.bin radeon/CYPRESS_me.bin radeon/CYPRESS_pfp.bin radeon/CYPRESS_rlc.bin radeon/CYPRESS_smc.bin radeon/CYPRESS_uvd.bin radeon/HAINAN_ce.bin radeon/hainan_ce.bin radeon/HAINAN_mc2.bin radeon/HAINAN_mc.bin radeon/hainan_mc.bin radeon/HAINAN_me.bin radeon/hainan_me.bin radeon/HAINAN_pfp.bin radeon/hainan_pfp.bin radeon/HAINAN_rlc.bin radeon/hainan_rlc.bin radeon/HAINAN_smc.bin radeon/hainan_smc.bin radeon/HAWAII_ce.bin radeon/hawaii_ce.bin radeon/HAWAII_mc2.bin radeon/HAWAII_mc.bin radeon/hawaii_mc.bin radeon/HAWAII_me.bin radeon/hawaii_me.bin radeon/HAWAII_mec.bin radeon/hawaii_mec.bin radeon/HAWAII_pfp.bin radeon/hawaii_pfp.bin radeon/HAWAII_rlc.bin radeon/hawaii_rlc.bin radeon/hawaii_sdma1.bin radeon/HAWAII_sdma.bin radeon/hawaii_sdma.bin radeon/HAWAII_smc.bin radeon/hawaii_smc.bin radeon/hawaii_uvd.bin radeon/hawaii_vce.bin radeon/JUNIPER_me.bin radeon/JUNIPER_pfp.bin radeon/JUNIPER_rlc.bin radeon/JUNIPER_smc.bin radeon/KABINI_ce.bin radeon/kabini_ce.bin radeon/KABINI_me.bin radeon/kabini_me.bin radeon/KABINI_mec.bin radeon/kabini_mec.bin radeon/KABINI_pfp.bin radeon/kabini_pfp.bin radeon/KABINI_rlc.bin radeon/kabini_rlc.bin radeon/kabini_sdma1.bin radeon/KABINI_sdma.bin radeon/kabini_sdma.bin radeon/kabini_uvd.bin radeon/kabini_vce.bin radeon/KAVERI_ce.bin radeon/kaveri_ce.bin radeon/KAVERI_me.bin radeon/kaveri_me.bin radeon/kaveri_mec2.bin radeon/KAVERI_mec.bin radeon/kaveri_mec.bin radeon/KAVERI_pfp.bin radeon/kaveri_pfp.bin radeon/KAVERI_rlc.bin radeon/kaveri_rlc.bin radeon/kaveri_sdma1.bin radeon/KAVERI_sdma.bin radeon/kaveri_sdma.bin radeon/kaveri_uvd.bin radeon/kaveri_vce.bin radeon/LICENSE.radeon radeon/MULLINS_ce.bin radeon/mullins_ce.bin radeon/MULLINS_me.bin radeon/mullins_me.bin radeon/MULLINS_mec.bin radeon/mullins_mec.bin radeon/MULLINS_pfp.bin radeon/mullins_pfp.bin radeon/MULLINS_rlc.bin radeon/mullins_rlc.bin radeon/mullins_sdma1.bin radeon/MULLINS_sdma.bin radeon/mullins_sdma.bin radeon/mullins_uvd.bin radeon/mullins_vce.bin radeon/OLAND_ce.bin radeon/oland_ce.bin radeon/OLAND_mc2.bin radeon/OLAND_mc.bin radeon/oland_mc.bin radeon/OLAND_me.bin radeon/oland_me.bin radeon/OLAND_pfp.bin radeon/oland_pfp.bin radeon/OLAND_rlc.bin radeon/oland_rlc.bin radeon/OLAND_smc.bin radeon/oland_smc.bin radeon/PALM_me.bin radeon/PALM_pfp.bin radeon/PITCAIRN_ce.bin radeon/pitcairn_ce.bin radeon/PITCAIRN_mc2.bin radeon/PITCAIRN_mc.bin radeon/pitcairn_mc.bin radeon/PITCAIRN_me.bin radeon/pitcairn_me.bin radeon/PITCAIRN_pfp.bin radeon/pitcairn_pfp.bin radeon/PITCAIRN_rlc.bin radeon/pitcairn_rlc.bin radeon/PITCAIRN_smc.bin radeon/pitcairn_smc.bin radeon/R100_cp.bin radeon/R200_cp.bin radeon/R300_cp.bin radeon/R420_cp.bin radeon/R520_cp.bin radeon/R600_me.bin radeon/R600_pfp.bin radeon/R600_rlc.bin radeon/R600_uvd.bin radeon/R700_rlc.bin radeon/REDWOOD_me.bin radeon/REDWOOD_pfp.bin radeon/REDWOOD_rlc.bin radeon/REDWOOD_smc.bin radeon/RS600_cp.bin radeon/RS690_cp.bin radeon/RS780_me.bin radeon/RS780_pfp.bin radeon/RS780_uvd.bin radeon/RV610_me.bin radeon/RV610_pfp.bin radeon/RV620_me.bin radeon/RV620_pfp.bin radeon/RV630_me.bin radeon/RV630_pfp.bin radeon/RV635_me.bin radeon/RV635_pfp.bin radeon/RV670_me.bin radeon/RV670_pfp.bin radeon/RV710_me.bin radeon/RV710_pfp.bin radeon/RV710_smc.bin radeon/RV710_uvd.bin radeon/RV730_me.bin radeon/RV730_pfp.bin radeon/RV730_smc.bin radeon/RV740_smc.bin radeon/RV770_me.bin radeon/RV770_pfp.bin radeon/RV770_smc.bin radeon/RV770_uvd.bin radeon/SUMO2_me.bin radeon/SUMO2_pfp.bin radeon/SUMO_me.bin radeon/SUMO_pfp.bin radeon/SUMO_rlc.bin radeon/SUMO_uvd.bin radeon/TAHITI_ce.bin radeon/tahiti_ce.bin radeon/TAHITI_mc2.bin radeon/TAHITI_mc.bin radeon/tahiti_mc.bin radeon/TAHITI_me.bin radeon/tahiti_me.bin radeon/TAHITI_pfp.bin radeon/tahiti_pfp.bin radeon/TAHITI_rlc.bin radeon/tahiti_rlc.bin radeon/TAHITI_smc.bin radeon/tahiti_smc.bin radeon/TAHITI_uvd.bin radeon/TAHITI_vce.bin radeon/TURKS_mc.bin radeon/TURKS_me.bin radeon/TURKS_pfp.bin radeon/TURKS_smc.bin radeon/VERDE_ce.bin radeon/verde_ce.bin radeon/VERDE_mc2.bin radeon/VERDE_mc.bin radeon/verde_mc.bin radeon/VERDE_me.bin radeon/verde_me.bin radeon/VERDE_pfp.bin radeon/verde_pfp.bin radeon/VERDE_rlc.bin radeon/verde_rlc.bin radeon/VERDE_smc.bin radeon/verde_smc.bin rtl_nic/rtl8105e-1.fw rtl_nic/rtl8106e-1.fw rtl_nic/rtl8106e-2.fw rtl_nic/rtl8107e-1.fw rtl_nic/rtl8107e-2.fw rtl_nic/rtl8168d-1.fw rtl_nic/rtl8168d-2.fw rtl_nic/rtl8168e-1.fw rtl_nic/rtl8168e-2.fw rtl_nic/rtl8168e-3.fw rtl_nic/rtl8168f-1.fw rtl_nic/rtl8168f-2.fw rtl_nic/rtl8168g-1.fw rtl_nic/rtl8168g-2.fw rtl_nic/rtl8168g-3.fw rtl_nic/rtl8168h-1.fw rtl_nic/rtl8168h-2.fw rtl_nic/rtl8402-1.fw rtl_nic/rtl8411-1.fw rtl_nic/rtl8411-2.fw" CONFIG_EXTRA_FIRMWARE_DIR="firmware" # CONFIG_FW_LOADER_USER_HELPER_FALLBACK is not set CONFIG_WANT_DEV_COREDUMP=y @@ -1144,11 +1166,13 @@ CONFIG_BLK_DEV_RAM_COUNT=16 CONFIG_BLK_DEV_RAM_SIZE=16384 # CONFIG_CDROM_PKTCDVD is not set # CONFIG_ATA_OVER_ETH is not set -CONFIG_VIRTIO_BLK=m +CONFIG_VIRTIO_BLK=y # CONFIG_BLK_DEV_HD is not set # CONFIG_BLK_DEV_RBD is not set # CONFIG_BLK_DEV_RSXX is not set +CONFIG_NVME_CORE=y CONFIG_BLK_DEV_NVME=y +# CONFIG_BLK_DEV_NVME_SCSI is not set # # Misc devices @@ -1195,6 +1219,9 @@ CONFIG_EEPROM_93CX6=m # Altera FPGA firmware download module # CONFIG_ALTERA_STAPL=m +# CONFIG_INTEL_MEI is not set +# CONFIG_INTEL_MEI_ME is not set +# CONFIG_INTEL_MEI_TXE is not set # CONFIG_VMWARE_VMCI is not set # @@ -1207,6 +1234,11 @@ CONFIG_ALTERA_STAPL=m # # CONFIG_SCIF_BUS is not set +# +# VOP Bus Driver +# +# CONFIG_VOP_BUS is not set + # # Intel MIC Host Driver # @@ -1222,6 +1254,10 @@ CONFIG_ALTERA_STAPL=m # # Intel MIC Coprocessor State Management (COSM) Drivers # + +# +# VOP Driver +# # CONFIG_GENWQE is not set # CONFIG_ECHO is not set # CONFIG_CXL_BASE is not set @@ -1292,7 +1328,7 @@ CONFIG_SCSI_MVSAS=y # CONFIG_SCSI_ESAS2R is not set # CONFIG_MEGARAID_NEWGEN is not set # CONFIG_MEGARAID_LEGACY is not set -# CONFIG_MEGARAID_SAS is not set +CONFIG_MEGARAID_SAS=y # CONFIG_SCSI_MPT3SAS is not set # CONFIG_SCSI_MPT2SAS is not set # CONFIG_SCSI_UFSHCD is not set @@ -1439,13 +1475,14 @@ CONFIG_MACVLAN=m # CONFIG_MACVTAP is not set # CONFIG_IPVLAN is not set # CONFIG_VXLAN is not set +# CONFIG_MACSEC is not set CONFIG_NETCONSOLE=y CONFIG_NETPOLL=y CONFIG_NET_POLL_CONTROLLER=y CONFIG_TUN=y # CONFIG_TUN_VNET_CROSS_LE is not set CONFIG_VETH=m -CONFIG_VIRTIO_NET=m +CONFIG_VIRTIO_NET=y # CONFIG_NLMON is not set # CONFIG_ARCNET is not set @@ -1517,6 +1554,7 @@ CONFIG_NET_VENDOR_INTEL=y CONFIG_E100=y CONFIG_E1000=y CONFIG_E1000E=y +CONFIG_E1000E_HWTS=y CONFIG_IGB=y CONFIG_IGB_HWMON=y # CONFIG_IGBVF is not set @@ -1531,6 +1569,7 @@ CONFIG_NET_VENDOR_I825XX=y CONFIG_JME=y CONFIG_NET_VENDOR_MARVELL=y # CONFIG_MVMDIO is not set +# CONFIG_MVNETA_BM is not set CONFIG_SKGE=y # CONFIG_SKGE_DEBUG is not set CONFIG_SKGE_GENESIS=y @@ -1541,6 +1580,8 @@ CONFIG_SKY2=y # CONFIG_NET_VENDOR_MYRI is not set # CONFIG_FEALNX is not set # CONFIG_NET_VENDOR_NATSEMI is not set +CONFIG_NET_VENDOR_NETRONOME=y +# CONFIG_NFP_NETVF is not set CONFIG_NET_VENDOR_NVIDIA=y CONFIG_FORCEDETH=y # CONFIG_NET_VENDOR_OKI is not set @@ -1617,6 +1658,7 @@ CONFIG_REALTEK_PHY=y # CONFIG_FIXED_PHY is not set # CONFIG_MDIO_BITBANG is not set # CONFIG_MDIO_OCTEON is not set +# CONFIG_MDIO_THUNDER is not set # CONFIG_MDIO_BCM_UNIMAC is not set CONFIG_PPP=m CONFIG_PPP_BSDCOMP=m @@ -1665,24 +1707,10 @@ CONFIG_USB_IPHETH=m # CONFIG_USB_VL600 is not set # CONFIG_USB_NET_CH9200 is not set CONFIG_WLAN=y -CONFIG_LIBERTAS_THINFIRM=m -# CONFIG_LIBERTAS_THINFIRM_DEBUG is not set -CONFIG_LIBERTAS_THINFIRM_USB=m -# CONFIG_AIRO is not set -CONFIG_ATMEL=m -CONFIG_PCI_ATMEL=m -# CONFIG_AT76C50X_USB is not set -# CONFIG_PRISM54 is not set -CONFIG_USB_ZD1201=m -CONFIG_USB_NET_RNDIS_WLAN=m +CONFIG_WLAN_VENDOR_ADMTEK=y # CONFIG_ADM8211 is not set -CONFIG_RTL8180=m -CONFIG_RTL8187=m -CONFIG_RTL8187_LEDS=y -# CONFIG_MAC80211_HWSIM is not set -# CONFIG_MWL8K is not set CONFIG_ATH_COMMON=m -CONFIG_ATH_CARDS=m +CONFIG_WLAN_VENDOR_ATH=y # CONFIG_ATH_DEBUG is not set CONFIG_ATH5K=m # CONFIG_ATH5K_DEBUG is not set @@ -1700,6 +1728,7 @@ CONFIG_ATH9K_AHB=y CONFIG_ATH9K_PCOEM=y CONFIG_ATH9K_HTC=m # CONFIG_ATH9K_HTC_DEBUGFS is not set +CONFIG_ATH9K_HWRNG=y CONFIG_CARL9170=m CONFIG_CARL9170_LEDS=y CONFIG_CARL9170_WPC=y @@ -1713,6 +1742,11 @@ CONFIG_AR5523=m # CONFIG_ATH10K is not set CONFIG_WCN36XX=m # CONFIG_WCN36XX_DEBUGFS is not set +CONFIG_WLAN_VENDOR_ATMEL=y +CONFIG_ATMEL=m +CONFIG_PCI_ATMEL=m +# CONFIG_AT76C50X_USB is not set +CONFIG_WLAN_VENDOR_BROADCOM=y # CONFIG_B43 is not set # CONFIG_B43LEGACY is not set CONFIG_BRCMUTIL=m @@ -1725,11 +1759,9 @@ CONFIG_BRCMFMAC_USB=y CONFIG_BRCMFMAC_PCIE=y # CONFIG_BRCM_TRACING is not set # CONFIG_BRCMDBG is not set -CONFIG_HOSTAP=m -CONFIG_HOSTAP_FIRMWARE=y -CONFIG_HOSTAP_FIRMWARE_NVRAM=y -# CONFIG_HOSTAP_PLX is not set -# CONFIG_HOSTAP_PCI is not set +CONFIG_WLAN_VENDOR_CISCO=y +# CONFIG_AIRO is not set +CONFIG_WLAN_VENDOR_INTEL=y CONFIG_IPW2100=m CONFIG_IPW2100_MONITOR=y # CONFIG_IPW2100_DEBUG is not set @@ -1741,6 +1773,14 @@ CONFIG_IPW2200_QOS=y # CONFIG_IPW2200_DEBUG is not set CONFIG_LIBIPW=m # CONFIG_LIBIPW_DEBUG is not set +CONFIG_IWLEGACY=m +CONFIG_IWL4965=m +CONFIG_IWL3945=m + +# +# iwl3945 / iwl4965 Debugging Options +# +# CONFIG_IWLEGACY_DEBUG is not set CONFIG_IWLWIFI=m CONFIG_IWLWIFI_LEDS=y CONFIG_IWLDVM=m @@ -1748,29 +1788,38 @@ CONFIG_IWLMVM=m CONFIG_IWLWIFI_OPMODE_MODULAR=y # CONFIG_IWLWIFI_BCAST_FILTERING is not set # CONFIG_IWLWIFI_UAPSD is not set +# CONFIG_IWLWIFI_PCIE_RTPM is not set # # Debugging Options # # CONFIG_IWLWIFI_DEBUG is not set -CONFIG_IWLEGACY=m -CONFIG_IWL4965=m -CONFIG_IWL3945=m - -# -# iwl3945 / iwl4965 Debugging Options -# -# CONFIG_IWLEGACY_DEBUG is not set -CONFIG_LIBERTAS=m -# CONFIG_LIBERTAS_USB is not set -# CONFIG_LIBERTAS_SDIO is not set -# CONFIG_LIBERTAS_DEBUG is not set -# CONFIG_LIBERTAS_MESH is not set +CONFIG_WLAN_VENDOR_INTERSIL=y +CONFIG_HOSTAP=m +CONFIG_HOSTAP_FIRMWARE=y +CONFIG_HOSTAP_FIRMWARE_NVRAM=y +# CONFIG_HOSTAP_PLX is not set +# CONFIG_HOSTAP_PCI is not set # CONFIG_HERMES is not set CONFIG_P54_COMMON=m CONFIG_P54_USB=m CONFIG_P54_PCI=m CONFIG_P54_LEDS=y +# CONFIG_PRISM54 is not set +CONFIG_WLAN_VENDOR_MARVELL=y +CONFIG_LIBERTAS=m +# CONFIG_LIBERTAS_USB is not set +# CONFIG_LIBERTAS_SDIO is not set +# CONFIG_LIBERTAS_DEBUG is not set +# CONFIG_LIBERTAS_MESH is not set +CONFIG_LIBERTAS_THINFIRM=m +# CONFIG_LIBERTAS_THINFIRM_DEBUG is not set +CONFIG_LIBERTAS_THINFIRM_USB=m +# CONFIG_MWIFIEX is not set +# CONFIG_MWL8K is not set +CONFIG_WLAN_VENDOR_MEDIATEK=y +CONFIG_MT7601U=m +CONFIG_WLAN_VENDOR_RALINK=y CONFIG_RT2X00=m CONFIG_RT2400PCI=m CONFIG_RT2500PCI=m @@ -1799,8 +1848,10 @@ CONFIG_RT2X00_LIB_FIRMWARE=y CONFIG_RT2X00_LIB_CRYPTO=y CONFIG_RT2X00_LIB_LEDS=y # CONFIG_RT2X00_DEBUG is not set -CONFIG_WL_MEDIATEK=y -CONFIG_MT7601U=m +CONFIG_WLAN_VENDOR_REALTEK=y +CONFIG_RTL8180=m +CONFIG_RTL8187=m +CONFIG_RTL8187_LEDS=y CONFIG_RTL_CARDS=m CONFIG_RTL8192CE=m CONFIG_RTL8192SE=m @@ -1819,12 +1870,21 @@ CONFIG_RTL8723_COMMON=m CONFIG_RTLBTCOEXIST=m CONFIG_RTL8XXXU=m CONFIG_RTL8XXXU_UNTESTED=y -# CONFIG_WL_TI is not set +CONFIG_WLAN_VENDOR_RSI=y +# CONFIG_RSI_91X is not set +CONFIG_WLAN_VENDOR_ST=y +# CONFIG_CW1200 is not set +CONFIG_WLAN_VENDOR_TI=y +# CONFIG_WL1251 is not set +# CONFIG_WL12XX is not set +# CONFIG_WL18XX is not set +# CONFIG_WLCORE is not set +CONFIG_WLAN_VENDOR_ZYDAS=y +CONFIG_USB_ZD1201=m CONFIG_ZD1211RW=m # CONFIG_ZD1211RW_DEBUG is not set -# CONFIG_MWIFIEX is not set -# CONFIG_CW1200 is not set -# CONFIG_RSI_91X is not set +# CONFIG_MAC80211_HWSIM is not set +CONFIG_USB_NET_RNDIS_WLAN=m # # Enable WiMAX (Networking options) to see the WiMAX drivers @@ -1882,6 +1942,7 @@ CONFIG_KEYBOARD_ATKBD=y CONFIG_INPUT_MOUSE=y CONFIG_MOUSE_PS2=y CONFIG_MOUSE_PS2_ALPS=y +CONFIG_MOUSE_PS2_BYD=y CONFIG_MOUSE_PS2_LOGIPS2PP=y CONFIG_MOUSE_PS2_SYNAPTICS=y CONFIG_MOUSE_PS2_CYPRESS=y @@ -1936,8 +1997,8 @@ CONFIG_TOUCHSCREEN_PROPERTIES=y # CONFIG_TOUCHSCREEN_DYNAPRO is not set # CONFIG_TOUCHSCREEN_HAMPSHIRE is not set # CONFIG_TOUCHSCREEN_EETI is not set +# CONFIG_TOUCHSCREEN_EGALAX_SERIAL is not set # CONFIG_TOUCHSCREEN_FUJITSU is not set -# CONFIG_TOUCHSCREEN_GOODIX is not set # CONFIG_TOUCHSCREEN_ILI210X is not set # CONFIG_TOUCHSCREEN_GUNZE is not set # CONFIG_TOUCHSCREEN_ELAN is not set @@ -1947,6 +2008,7 @@ CONFIG_TOUCHSCREEN_PROPERTIES=y # CONFIG_TOUCHSCREEN_MAX11801 is not set # CONFIG_TOUCHSCREEN_MCS5000 is not set # CONFIG_TOUCHSCREEN_MMS114 is not set +# CONFIG_TOUCHSCREEN_MELFAS_MIP4 is not set # CONFIG_TOUCHSCREEN_MTOUCH is not set # CONFIG_TOUCHSCREEN_INEXIO is not set # CONFIG_TOUCHSCREEN_MK712 is not set @@ -2007,6 +2069,7 @@ CONFIG_INPUT_UINPUT=y # CONFIG_INPUT_IDEAPAD_SLIDEBAR is not set # CONFIG_INPUT_DRV2665_HAPTICS is not set # CONFIG_INPUT_DRV2667_HAPTICS is not set +# CONFIG_RMI4_CORE is not set # # Hardware I/O ports @@ -2061,6 +2124,7 @@ CONFIG_SERIAL_8250_RUNTIME_UARTS=4 # CONFIG_SERIAL_8250_RT288X is not set # CONFIG_SERIAL_8250_FINTEK is not set # CONFIG_SERIAL_8250_MID is not set +# CONFIG_SERIAL_8250_MOXA is not set # # Non-8250 serial port support @@ -2075,9 +2139,10 @@ CONFIG_SERIAL_CORE=y # CONFIG_SERIAL_ARC is not set # CONFIG_SERIAL_RP2 is not set # CONFIG_SERIAL_FSL_LPUART is not set +# CONFIG_SERIAL_MVEBU_UART is not set # CONFIG_TTY_PRINTK is not set CONFIG_HVC_DRIVER=y -CONFIG_VIRTIO_CONSOLE=m +CONFIG_VIRTIO_CONSOLE=y # CONFIG_IPMI_HANDLER is not set CONFIG_HW_RANDOM=m # CONFIG_HW_RANDOM_TIMERIOMEM is not set @@ -2151,6 +2216,7 @@ CONFIG_I2C_VIAPRO=y CONFIG_I2C_DESIGNWARE_CORE=y CONFIG_I2C_DESIGNWARE_PLATFORM=y # CONFIG_I2C_DESIGNWARE_PCI is not set +# CONFIG_I2C_DESIGNWARE_BAYTRAIL is not set # CONFIG_I2C_EMEV2 is not set # CONFIG_I2C_OCORES is not set # CONFIG_I2C_PCA_PLATFORM is not set @@ -2283,6 +2349,7 @@ CONFIG_SENSORS_IT87=m # CONFIG_SENSORS_POWR1220 is not set # CONFIG_SENSORS_LINEAGE is not set # CONFIG_SENSORS_LTC2945 is not set +# CONFIG_SENSORS_LTC2990 is not set # CONFIG_SENSORS_LTC4151 is not set # CONFIG_SENSORS_LTC4215 is not set # CONFIG_SENSORS_LTC4222 is not set @@ -2298,7 +2365,6 @@ CONFIG_SENSORS_IT87=m # CONFIG_SENSORS_MAX6650 is not set # CONFIG_SENSORS_MAX6697 is not set # CONFIG_SENSORS_MAX31790 is not set -# CONFIG_SENSORS_HTU21 is not set # CONFIG_SENSORS_MCP3021 is not set # CONFIG_SENSORS_LM63 is not set # CONFIG_SENSORS_LM73 is not set @@ -2398,7 +2464,6 @@ CONFIG_SSB_PCIHOST=y # CONFIG_SSB_B43_PCI_BRIDGE is not set CONFIG_SSB_SDIOHOST_POSSIBLE=y CONFIG_SSB_SDIOHOST=y -# CONFIG_SSB_HOST_SOC is not set # CONFIG_SSB_SILENT is not set # CONFIG_SSB_DEBUG is not set CONFIG_SSB_DRIVER_PCICORE_POSSIBLE=y @@ -2423,7 +2488,7 @@ CONFIG_MFD_CORE=y # CONFIG_MFD_AS3711 is not set # CONFIG_PMIC_ADP5520 is not set # CONFIG_MFD_BCM590XX is not set -# CONFIG_MFD_AXP20X is not set +# CONFIG_MFD_AXP20X_I2C is not set # CONFIG_MFD_CROS_EC is not set # CONFIG_PMIC_DA903X is not set # CONFIG_MFD_DA9052_I2C is not set @@ -2475,10 +2540,12 @@ CONFIG_MFD_RTSX_USB=y # CONFIG_MFD_PALMAS is not set # CONFIG_TPS6105X is not set # CONFIG_TPS6507X is not set +# CONFIG_MFD_TPS65086 is not set # CONFIG_MFD_TPS65090 is not set # CONFIG_MFD_TPS65217 is not set # CONFIG_MFD_TPS65218 is not set # CONFIG_MFD_TPS6586X is not set +# CONFIG_MFD_TPS65912_I2C is not set # CONFIG_MFD_TPS80031 is not set # CONFIG_TWL4030_CORE is not set # CONFIG_TWL6040_CORE is not set @@ -2746,10 +2813,6 @@ CONFIG_CYPRESS_FIRMWARE=m CONFIG_DVB_B2C2_FLEXCOP=m CONFIG_VIDEO_SAA7146=m CONFIG_VIDEO_SAA7146_VV=m -CONFIG_SAA716X_SUPPORT=y -CONFIG_SAA716X_CORE=m -CONFIG_DVB_SAA716X_BUDGET=m -CONFIG_DVB_SAA716X_HYBRID=m CONFIG_SMS_SIANO_MDTV=m CONFIG_SMS_SIANO_RC=y # CONFIG_SMS_SIANO_DEBUGFS is not set @@ -2765,6 +2828,7 @@ CONFIG_VIDEO_IR_I2C=m # Audio decoders, processors and mixers # CONFIG_VIDEO_MSP3400=m +CONFIG_VIDEO_CS3308=m CONFIG_VIDEO_CS5345=m CONFIG_VIDEO_CS53L32A=m CONFIG_VIDEO_WM8775=m @@ -2992,6 +3056,7 @@ CONFIG_VGA_ARB_MAX_GPUS=16 CONFIG_VGA_SWITCHEROO=y CONFIG_DRM=y CONFIG_DRM_MIPI_DSI=y +# CONFIG_DRM_DP_AUX_CHARDEV is not set CONFIG_DRM_KMS_HELPER=y CONFIG_DRM_KMS_FB_HELPER=y CONFIG_DRM_FBDEV_EMULATION=y @@ -3009,14 +3074,20 @@ CONFIG_DRM_TTM=y # CONFIG_DRM_R128 is not set CONFIG_DRM_RADEON=y # CONFIG_DRM_RADEON_USERPTR is not set -# CONFIG_DRM_RADEON_UMS is not set CONFIG_DRM_AMDGPU=y # CONFIG_DRM_AMDGPU_CIK is not set # CONFIG_DRM_AMDGPU_USERPTR is not set +# CONFIG_DRM_AMD_POWERPLAY is not set + +# +# ACP (Audio CoProcessor) Configuration +# +# CONFIG_DRM_AMD_ACP is not set # CONFIG_DRM_NOUVEAU is not set # CONFIG_DRM_I810 is not set CONFIG_DRM_I915=y # CONFIG_DRM_I915_PRELIMINARY_HW_SUPPORT is not set +CONFIG_DRM_I915_USERPTR=y # CONFIG_DRM_MGA is not set # CONFIG_DRM_SIS is not set # CONFIG_DRM_VIA is not set @@ -3048,6 +3119,7 @@ CONFIG_DRM_BRIDGE=y CONFIG_FB=y # CONFIG_FIRMWARE_EDID is not set CONFIG_FB_CMDLINE=y +CONFIG_FB_NOTIFY=y # CONFIG_FB_DDC is not set # CONFIG_FB_BOOT_VESA_SUPPORT is not set CONFIG_FB_CFB_FILLRECT=y @@ -3149,6 +3221,7 @@ CONFIG_SND_HWDEP=m CONFIG_SND_RAWMIDI=m CONFIG_SND_COMPRESS_OFFLOAD=y CONFIG_SND_JACK=y +CONFIG_SND_JACK_INPUT_DEV=y # CONFIG_SND_SEQUENCER is not set # CONFIG_SND_MIXER_OSS is not set # CONFIG_SND_PCM_OSS is not set @@ -3286,13 +3359,13 @@ CONFIG_SND_FIREWIRE=y # CONFIG_SND_DICE is not set # CONFIG_SND_OXFW is not set # CONFIG_SND_ISIGHT is not set -# CONFIG_SND_SCS1X is not set # CONFIG_SND_FIREWORKS is not set # CONFIG_SND_BEBOB is not set # CONFIG_SND_FIREWIRE_DIGI00X is not set # CONFIG_SND_FIREWIRE_TASCAM is not set CONFIG_SND_SOC=y CONFIG_SND_SOC_COMPRESS=y +# CONFIG_SND_SOC_AMD_ACP is not set # CONFIG_SND_ATMEL_SOC is not set # CONFIG_SND_DESIGNWARE_I2S is not set @@ -3309,22 +3382,21 @@ CONFIG_SND_SOC_COMPRESS=y # CONFIG_SND_SOC_FSL_SPDIF is not set # CONFIG_SND_SOC_FSL_ESAI is not set # CONFIG_SND_SOC_IMX_AUDMUX is not set +# CONFIG_SND_SOC_IMG is not set CONFIG_SND_SST_MFLD_PLATFORM=m CONFIG_SND_SST_IPC=m CONFIG_SND_SST_IPC_ACPI=m CONFIG_SND_SOC_INTEL_SST=m CONFIG_SND_SOC_INTEL_SST_ACPI=m -CONFIG_SND_SOC_INTEL_HASWELL=m -CONFIG_SND_SOC_INTEL_BAYTRAIL=m -CONFIG_SND_SOC_INTEL_HASWELL_MACH=m -CONFIG_SND_SOC_INTEL_BYT_RT5640_MACH=m -CONFIG_SND_SOC_INTEL_BYT_MAX98090_MACH=m -CONFIG_SND_SOC_INTEL_BROADWELL_MACH=m +CONFIG_SND_SOC_INTEL_SST_MATCH=m CONFIG_SND_SOC_INTEL_BYTCR_RT5640_MACH=m +# CONFIG_SND_SOC_INTEL_BYTCR_RT5651_MACH is not set CONFIG_SND_SOC_INTEL_CHT_BSW_RT5672_MACH=m CONFIG_SND_SOC_INTEL_CHT_BSW_RT5645_MACH=m CONFIG_SND_SOC_INTEL_CHT_BSW_MAX98090_TI_MACH=m # CONFIG_SND_SOC_INTEL_SKL_RT286_MACH is not set +# CONFIG_SND_SOC_INTEL_SKL_NAU88L25_SSM4567_MACH is not set +# CONFIG_SND_SOC_INTEL_SKL_NAU88L25_MAX98357A_MACH is not set # # Allwinner SoC Audio support @@ -3355,12 +3427,14 @@ CONFIG_SND_SOC_I2C_AND_SPI=y # CONFIG_SND_SOC_CS4349 is not set # CONFIG_SND_SOC_ES8328 is not set # CONFIG_SND_SOC_GTM601 is not set +# CONFIG_SND_SOC_INNO_RK3036 is not set CONFIG_SND_SOC_MAX98090=m # CONFIG_SND_SOC_PCM1681 is not set +# CONFIG_SND_SOC_PCM179X_I2C is not set +# CONFIG_SND_SOC_PCM3168A_I2C is not set # CONFIG_SND_SOC_PCM512x_I2C is not set CONFIG_SND_SOC_RL6231=m -CONFIG_SND_SOC_RL6347A=m -CONFIG_SND_SOC_RT286=m +# CONFIG_SND_SOC_RT5616 is not set # CONFIG_SND_SOC_RT5631 is not set CONFIG_SND_SOC_RT5640=m CONFIG_SND_SOC_RT5645=m @@ -3396,6 +3470,7 @@ CONFIG_SND_SOC_TS3A227E=m # CONFIG_SND_SOC_WM8804_I2C is not set # CONFIG_SND_SOC_WM8903 is not set # CONFIG_SND_SOC_WM8962 is not set +# CONFIG_SND_SOC_WM8974 is not set # CONFIG_SND_SOC_WM8978 is not set # CONFIG_SND_SOC_TPA6130A2 is not set CONFIG_SND_SIMPLE_CARD=m @@ -3425,6 +3500,7 @@ CONFIG_HID_CHERRY=y CONFIG_HID_CHICONY=y # CONFIG_HID_CORSAIR is not set # CONFIG_HID_PRODIKEYS is not set +# CONFIG_HID_CMEDIA is not set CONFIG_HID_CYPRESS=y CONFIG_HID_DRAGONRISE=m CONFIG_DRAGONRISE_FF=y @@ -3810,22 +3886,21 @@ CONFIG_RTC_INTF_DEV=y # CONFIG_RTC_DRV_DS1307 is not set # CONFIG_RTC_DRV_DS1374 is not set # CONFIG_RTC_DRV_DS1672 is not set -# CONFIG_RTC_DRV_DS3232 is not set # CONFIG_RTC_DRV_MAX6900 is not set # CONFIG_RTC_DRV_RS5C372 is not set # CONFIG_RTC_DRV_ISL1208 is not set # CONFIG_RTC_DRV_ISL12022 is not set # CONFIG_RTC_DRV_ISL12057 is not set # CONFIG_RTC_DRV_X1205 is not set -# CONFIG_RTC_DRV_PCF2127 is not set # CONFIG_RTC_DRV_PCF8523 is not set -# CONFIG_RTC_DRV_PCF8563 is not set # CONFIG_RTC_DRV_PCF85063 is not set +# CONFIG_RTC_DRV_PCF8563 is not set # CONFIG_RTC_DRV_PCF8583 is not set # CONFIG_RTC_DRV_M41T80 is not set # CONFIG_RTC_DRV_BQ32K is not set # CONFIG_RTC_DRV_S35390A is not set # CONFIG_RTC_DRV_FM3130 is not set +# CONFIG_RTC_DRV_RX8010 is not set # CONFIG_RTC_DRV_RX8581 is not set # CONFIG_RTC_DRV_RX8025 is not set # CONFIG_RTC_DRV_EM3027 is not set @@ -3835,6 +3910,13 @@ CONFIG_RTC_INTF_DEV=y # # SPI RTC drivers # +CONFIG_RTC_I2C_AND_SPI=y + +# +# SPI and I2C RTC drivers +# +# CONFIG_RTC_DRV_DS3232 is not set +# CONFIG_RTC_DRV_PCF2127 is not set # # Platform RTC drivers @@ -3874,6 +3956,8 @@ CONFIG_DMA_VIRTUAL_CHANNELS=m CONFIG_DMA_ACPI=y CONFIG_INTEL_IDMA64=m CONFIG_INTEL_IOATDMA=m +# CONFIG_QCOM_HIDMA_MGMT is not set +# CONFIG_QCOM_HIDMA is not set CONFIG_DW_DMAC_CORE=m CONFIG_DW_DMAC=m CONFIG_DW_DMAC_PCI=m @@ -3897,16 +3981,16 @@ CONFIG_UIO=y # CONFIG_UIO_PRUSS is not set # CONFIG_UIO_MF624 is not set # CONFIG_VIRT_DRIVERS is not set -CONFIG_VIRTIO=m +CONFIG_VIRTIO=y # # Virtio drivers # -CONFIG_VIRTIO_PCI=m +CONFIG_VIRTIO_PCI=y CONFIG_VIRTIO_PCI_LEGACY=y -CONFIG_VIRTIO_BALLOON=m -CONFIG_VIRTIO_INPUT=m -CONFIG_VIRTIO_MMIO=m +CONFIG_VIRTIO_BALLOON=y +CONFIG_VIRTIO_INPUT=y +CONFIG_VIRTIO_MMIO=y # CONFIG_VIRTIO_MMIO_CMDLINE_DEVICES is not set # @@ -3931,11 +4015,9 @@ CONFIG_VT6656=m # Speakup console speech # # CONFIG_SPEAKUP is not set -# CONFIG_TOUCHSCREEN_SYNAPTICS_I2C_RMI4 is not set CONFIG_STAGING_MEDIA=y CONFIG_DVB_CXD2099=m CONFIG_DVB_MN88472=m -CONFIG_DVB_MN88473=m CONFIG_LIRC_STAGING=y # CONFIG_LIRC_BT829 is not set # CONFIG_LIRC_IMON is not set @@ -3949,16 +4031,14 @@ CONFIG_LIRC_XBOX=m # # Android # -# CONFIG_WIMAX_GDM72XX is not set # CONFIG_LTE_GDM724X is not set # CONFIG_FIREWIRE_SERIAL is not set -# CONFIG_LUSTRE_FS is not set +# CONFIG_LNET is not set # CONFIG_DGNC is not set -# CONFIG_DGAP is not set # CONFIG_GS_FPGABOOT is not set # CONFIG_CRYPTO_SKEIN is not set # CONFIG_UNISYSSPAR is not set -# CONFIG_WILC1000_DRIVER is not set +# CONFIG_WILC1000_SDIO is not set # CONFIG_MOST is not set # CONFIG_X86_PLATFORM_DEVICES is not set # CONFIG_CHROME_PLATFORMS is not set @@ -3970,8 +4050,10 @@ CONFIG_COMMON_CLK=y # Common Clock Framework # # CONFIG_COMMON_CLK_SI5351 is not set -# CONFIG_COMMON_CLK_PXA is not set # CONFIG_COMMON_CLK_CDCE706 is not set +# CONFIG_COMMON_CLK_CS2000_CP is not set +# CONFIG_COMMON_CLK_NXP is not set +# CONFIG_COMMON_CLK_PXA is not set # # Hardware Spinlock drivers @@ -4011,6 +4093,7 @@ CONFIG_CLKBLD_I8253=y # CONFIG_NTB is not set # CONFIG_VME_BUS is not set # CONFIG_PWM is not set +CONFIG_ARM_GIC_MAX_NR=1 # CONFIG_IPACK_BUS is not set # CONFIG_RESET_CONTROLLER is not set # CONFIG_FMC is not set @@ -4039,8 +4122,6 @@ CONFIG_THUNDERBOLT=m # CONFIG_LIBNVDIMM is not set # CONFIG_NVMEM is not set # CONFIG_STM is not set -# CONFIG_STM_DUMMY is not set -# CONFIG_STM_SOURCE_CONSOLE is not set # CONFIG_INTEL_TH is not set # @@ -4060,6 +4141,7 @@ CONFIG_DMI_SYSFS=m CONFIG_DMI_SCAN_MACHINE_NON_EFI_FALLBACK=y CONFIG_ISCSI_IBFT_FIND=y CONFIG_ISCSI_IBFT=y +# CONFIG_FW_CFG_SYSFS is not set # CONFIG_GOOGLE_FIRMWARE is not set # @@ -4116,6 +4198,8 @@ CONFIG_F2FS_CHECK_FS=y CONFIG_FS_POSIX_ACL=y CONFIG_EXPORTFS=y CONFIG_FILE_LOCKING=y +CONFIG_MANDATORY_FILE_LOCKING=y +# CONFIG_FS_ENCRYPTION is not set CONFIG_FSNOTIFY=y CONFIG_DNOTIFY=y CONFIG_INOTIFY_USER=y @@ -4149,6 +4233,7 @@ CONFIG_FAT_FS=y CONFIG_VFAT_FS=y CONFIG_FAT_DEFAULT_CODEPAGE=437 CONFIG_FAT_DEFAULT_IOCHARSET="ascii" +# CONFIG_FAT_DEFAULT_UTF8 is not set # CONFIG_NTFS_FS is not set # @@ -4169,6 +4254,7 @@ CONFIG_TMPFS_XATTR=y # CONFIG_CONFIGFS_FS is not set CONFIG_EFIVAR_FS=y CONFIG_MISC_FILESYSTEMS=y +# CONFIG_ORANGEFS_FS is not set # CONFIG_ADFS_FS is not set # CONFIG_AFFS_FS is not set # CONFIG_ECRYPT_FS is not set @@ -4326,6 +4412,7 @@ CONFIG_DEBUG_FS=y CONFIG_SECTION_MISMATCH_WARN_ONLY=y CONFIG_ARCH_WANT_FRAME_POINTERS=y # CONFIG_FRAME_POINTER is not set +# CONFIG_STACK_VALIDATION is not set # CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set CONFIG_MAGIC_SYSRQ=y CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE=0x1 @@ -4336,6 +4423,7 @@ CONFIG_DEBUG_KERNEL=y # # CONFIG_PAGE_EXTENSION is not set # CONFIG_DEBUG_PAGEALLOC is not set +# CONFIG_PAGE_POISONING is not set # CONFIG_DEBUG_OBJECTS is not set # CONFIG_SLUB_DEBUG_ON is not set # CONFIG_SLUB_STATS is not set @@ -4351,6 +4439,8 @@ CONFIG_HAVE_DEBUG_STACKOVERFLOW=y CONFIG_HAVE_ARCH_KMEMCHECK=y CONFIG_HAVE_ARCH_KASAN=y # CONFIG_KASAN is not set +CONFIG_ARCH_HAS_KCOV=y +# CONFIG_KCOV is not set # CONFIG_DEBUG_SHIRQ is not set # @@ -4366,6 +4456,7 @@ CONFIG_DETECT_HUNG_TASK=y CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=120 # CONFIG_BOOTPARAM_HUNG_TASK_PANIC is not set CONFIG_BOOTPARAM_HUNG_TASK_PANIC_VALUE=0 +# CONFIG_WQ_WATCHDOG is not set # CONFIG_PANIC_ON_OOPS is not set CONFIG_PANIC_ON_OOPS_VALUE=0 CONFIG_PANIC_TIMEOUT=0 @@ -4408,7 +4499,9 @@ CONFIG_DEBUG_BUGVERBOSE=y CONFIG_RCU_CPU_STALL_TIMEOUT=60 # CONFIG_RCU_TRACE is not set # CONFIG_RCU_EQS_DEBUG is not set +# CONFIG_DEBUG_WQ_FORCE_RR_CPU is not set # CONFIG_DEBUG_BLOCK_EXT_DEVT is not set +# CONFIG_CPU_HOTPLUG_STATE_CONTROL is not set # CONFIG_NOTIFIER_ERROR_INJECTION is not set # CONFIG_FAULT_INJECTION is not set # CONFIG_LATENCYTOP is not set @@ -4441,6 +4534,7 @@ CONFIG_TRACING_SUPPORT=y # CONFIG_TEST_STRING_HELPERS is not set # CONFIG_TEST_KSTRTOX is not set # CONFIG_TEST_PRINTF is not set +# CONFIG_TEST_BITMAP is not set # CONFIG_TEST_RHASHTABLE is not set # CONFIG_PROVIDE_OHCI1394_DMA_INIT is not set # CONFIG_DMA_API_DEBUG is not set @@ -4454,13 +4548,16 @@ CONFIG_TRACING_SUPPORT=y # CONFIG_SAMPLES is not set CONFIG_HAVE_ARCH_KGDB=y # CONFIG_KGDB is not set +CONFIG_ARCH_HAS_UBSAN_SANITIZE_ALL=y +# CONFIG_UBSAN is not set +CONFIG_ARCH_HAS_DEVMEM_IS_ALLOWED=y CONFIG_STRICT_DEVMEM=y +# CONFIG_IO_STRICT_DEVMEM is not set # CONFIG_X86_VERBOSE_BOOTUP is not set # CONFIG_EARLY_PRINTK is not set # CONFIG_X86_PTDUMP_CORE is not set # CONFIG_X86_PTDUMP is not set # CONFIG_EFI_PGT_DUMP is not set -CONFIG_DEBUG_RODATA=y # CONFIG_DEBUG_RODATA_TEST is not set # CONFIG_DEBUG_WX is not set # CONFIG_DEBUG_SET_MODULE_RONX is not set @@ -4484,7 +4581,6 @@ CONFIG_DEFAULT_IO_DELAY_TYPE=0 CONFIG_OPTIMIZE_INLINING=y # CONFIG_DEBUG_ENTRY is not set # CONFIG_DEBUG_NMI_SELFTEST is not set -# CONFIG_X86_DEBUG_STATIC_CPU_HAS is not set CONFIG_X86_DEBUG_FPU=y # CONFIG_PUNIT_ATOM_DEBUG is not set @@ -4517,7 +4613,6 @@ CONFIG_CRYPTO_HASH2=y CONFIG_CRYPTO_RNG=m CONFIG_CRYPTO_RNG2=y CONFIG_CRYPTO_RNG_DEFAULT=m -CONFIG_CRYPTO_PCOMP2=y CONFIG_CRYPTO_AKCIPHER2=y # CONFIG_CRYPTO_RSA is not set CONFIG_CRYPTO_MANAGER=y @@ -4568,7 +4663,7 @@ CONFIG_CRYPTO_HMAC=y # CONFIG_CRYPTO_CRC32C=y # CONFIG_CRYPTO_CRC32C_INTEL is not set -# CONFIG_CRYPTO_CRC32 is not set +CONFIG_CRYPTO_CRC32=y # CONFIG_CRYPTO_CRC32_PCLMUL is not set # CONFIG_CRYPTO_CRCT10DIF is not set CONFIG_CRYPTO_GHASH=m @@ -4633,7 +4728,6 @@ CONFIG_CRYPTO_DES=y # Compression # # CONFIG_CRYPTO_DEFLATE is not set -# CONFIG_CRYPTO_ZLIB is not set # CONFIG_CRYPTO_LZO is not set # CONFIG_CRYPTO_842 is not set # CONFIG_CRYPTO_LZ4 is not set @@ -4724,6 +4818,7 @@ CONFIG_NLATTR=y CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE=y # CONFIG_CORDIC is not set # CONFIG_DDR is not set +# CONFIG_IRQ_POLL is not set CONFIG_OID_REGISTRY=y CONFIG_UCS2_STRING=y CONFIG_FONT_SUPPORT=y diff --git a/projects/Odroid_C2/bootloader/boot.ini b/projects/Odroid_C2/bootloader/boot.ini new file mode 100644 index 00000000000..dc27be913ed --- /dev/null +++ b/projects/Odroid_C2/bootloader/boot.ini @@ -0,0 +1,175 @@ +#------------------------------------------------------------------------------------------------------ +# +# boot.ini identification +# +#------------------------------------------------------------------------------------------------------ +ODROIDC2-UBOOT-CONFIG + +#------------------------------------------------------------------------------------------------------ +# +# Boot Specific Stuff +# +#------------------------------------------------------------------------------------------------------ +setenv bootrootfs "boot=/dev/mmcblk0p1 disk=/dev/mmcblk0p2" + +#------------------------------------------------------------------------------------------------------ +# +# Console Setup +# setenv condev "console=ttyS0,115200n8" # on serial port +# setenv condev "console=tty0" # on display (HDMI) +# setenv condev "console=tty0 console=ttyS0,115200n8" # on both +# +#------------------------------------------------------------------------------------------------------ +setenv console "console=tty0" + +#------------------------------------------------------------------------------------------------------ +# +# Video +# Setup the video output +# 480 Lines (720x480) +# setenv video_output "480i60hz" # Interlaced 60Hz +# setenv video_output "480i_rpt" # Interlaced for Rear Projection Televisions 60Hz +# setenv video_output "480p60hz" # 480 Progressive 60Hz +# setenv video_output "480p_rpt" # 480 Progressive for Rear Projection Televisions 60Hz +# 576 Lines (720x576) +# setenv video_output "576i50hz" # Interlaced 50Hz +# setenv video_output "576i_rpt" # Interlaced for Rear Projection Televisions 50Hz +# setenv video_output "576p50hz" # Progressive 50Hz +# setenv video_output "576p_rpt" # Progressive for Rear Projection Televisions 50Hz +# 720 Lines (1280x720) +# setenv video_output "720p50hz" # Progressive 50Hz +# setenv video_output "720p60hz" # Progressive 60Hz +# 1080 Lines (1920x1080) +# setenv video_output "1080i60hz" # Interlaced 60Hz +# setenv video_output "1080p60hz" # Progressive 60Hz +# setenv video_output "1080i50hz" # Interlaced 50Hz +# setenv video_output "1080p50hz" # Progressive 50Hz +# setenv video_output "1080p24hz" # Progressive 24Hz +# 4K (3840x2160) +# setenv video_output "2160p30hz" # Progressive 30Hz +# setenv video_output "2160p25hz" # Progressive 25Hz +# setenv video_output "2160p24hz" # Progressive 24Hz +# setenv video_output "smpte24hz" # Progressive 24Hz SMPTE +# setenv video_output "2160p50hz" # Progressive 50Hz +# setenv video_output "2160p60hz" # Progressive 60Hz +# setenv video_output "2160p50hz420" # Progressive 50Hz with YCbCr 4:2:0 (Requires TV/Monitor that supports it) +# setenv video_output "2160p60hz420" # Progressive 60Hz with YCbCr 4:2:0 (Requires TV/Monitor that supports it) +# VESA modes +# setenv video_output "640x480p60hz" +# setenv video_output "800x480p60hz" +# setenv video_output "800x600p60hz" +# setenv video_output "1024x600p60hz" +# setenv video_output "1024x768p60hz" +# setenv video_output "1280x800p60hz" +# setenv video_output "1280x1024p60hz" +# setenv video_output "1360x768p60hz" +# setenv video_output "1366x768p60hz" +# setenv video_output "1440x900p60hz" +# setenv video_output "1600x900p60hz" +# setenv video_output "1680x1050p60hz" +# setenv video_output "1920x1200p60hz" +# +# Setup the HDMI video mode (Must be one or the other) +# setenv video_mode "dvi" # DVI +# setenv video_mode "vga" # VGA +# +# Setup the HDMI BPP Mode +# setenv video_bpp "32" # 32-bit +# setenv video_bpp "24" # 24-bit +# setenv video_bpp "16" # 16-bit +# +# Enable|Disable HDMI Hotplug Detection +# setenv hdmihotplug "0" # Disabled +# setenv hdmihotplug "1" # Enabled +# +# Enable|Disable HDMI (Saves RAM) +# setenv hdmioutput "0" # Disabled +# setenv hdmioutput "1" # Enabled +# +# Enable|Disable VPU (Saves RAM) +# setenv vpu "0" # Disabled +# setenv vpu "1" # Enabled +# +#------------------------------------------------------------------------------------------------------ +setenv video_output "1080p60hz" +setenv video_mode "hdmi" +setenv video_bpp "32" +setenv hdmihotplug "1" +setenv hdmioutput "1" +setenv vpu "1" + +#------------------------------------------------------------------------------------------------------ +# +# LibreELEC variables +# +# Setup the LibreELEC options +# valid values are: textmode debugging progress nofsck nosplash noram overlay quiet ssh +#------------------------------------------------------------------------------------------------------ +setenv libreelec "quiet" + +#------------------------------------------------------------------------------------------------------ +# +# UHS Card Configuration +# Uncomment the line below to __DISABLE__ UHS-1 MicroSD support +# This might break boot for some brand models of cards. +# +#------------------------------------------------------------------------------------------------------ +# setenv disableuhs "disableuhs" + +#------------------------------------------------------------------------------------------------------ +# +# Enable|Disable HDMI CEC Control +# setenv hdmi_cec "0" # Disabled +# setenv hdmi_cec "1" # Enabled +# +#------------------------------------------------------------------------------------------------------ +setenv hdmi_cec "1" + +#------------------------------------------------------------------------------------------------------ +# +# PCM5102 I2S Audio DAC (HiFi Shield) +# PCM5102 is an I2S Audio DAC Addon board for ODROID-C1+ +# +# Enable|Disable Audio DAC +# setenv audio_dac "0" # Disabled +# setenv audio_dac "1" # Enabled +#------------------------------------------------------------------------------------------------------ +setenv audio_dac "0" + +#------------------------------------------------------------------------------------------------------ +# +# Odroid C1 specific +# +#------------------------------------------------------------------------------------------------------ +setenv odroidp1 "no_console_suspend hdmimode=${video_output} m_bpp=${video_bpp} vout=${video_mode}" +setenv odroidp2 "${disableuhs} consoleblank=0" +setenv odroid "${odroidp1} ${odroidp2}" + +#------------------------------------------------------------------------------------------------------ +# +# U-Boot bootcmd command +# +#------------------------------------------------------------------------------------------------------ +setenv kernel "fatload mmc 0:1 0x11000000 KERNEL" +setenv dtb "fatload mmc 0:1 0x1000000 meson64_odroidc2.dtb" +setenv bootseq "booti 0x11000000 - 0x1000000" +setenv bootcmd "${kernel}; ${dtb}; ${bootseq}" + +#------------------------------------------------------------------------------------------------------ +# +# Kernel boot +# +#------------------------------------------------------------------------------------------------------ + +# Prepare to boot +if test "${hdmi_cec}" = "1"; then setenv cec "hdmitx=cecf"; fi +if test "${hdmi_hotplug}" = "0"; then setenv hpd "disablehpd=true"; fi +if test "${audio_dac}" = "1"; then setenv dac "enabledac"; fi +if test "${vpu}" = "0"; then fdt rm /mesonstream; fdt rm /vdec; fdt rm /ppmgr; fi +if test "${hdmioutput}" = "0"; then fdt rm /mesonfb; fi + +# Populate the final bootcmd +setenv bootargs "${console} ${bootrootfs} ${odroid} ${cec} ${hpd} ${dac} ${libreelec}" + +# Boot the board +run bootcmd diff --git a/projects/Odroid_C2/filesystem/etc/asound.conf b/projects/Odroid_C2/filesystem/etc/asound.conf new file mode 100644 index 00000000000..8d0204666db --- /dev/null +++ b/projects/Odroid_C2/filesystem/etc/asound.conf @@ -0,0 +1,12 @@ +pcm.!default { + type plug + slave { + pcm "hw:0,0" + format S16_LE + } +} + +ctl.!default { + type hw + card 0 +} diff --git a/projects/Odroid_C2/filesystem/usr/lib/modules-load.d/mali.conf b/projects/Odroid_C2/filesystem/usr/lib/modules-load.d/mali.conf new file mode 100644 index 00000000000..29c66fc8c8f --- /dev/null +++ b/projects/Odroid_C2/filesystem/usr/lib/modules-load.d/mali.conf @@ -0,0 +1 @@ +mali diff --git a/projects/Odroid_C2/filesystem/usr/lib/modules-load.d/meson-ir.conf b/projects/Odroid_C2/filesystem/usr/lib/modules-load.d/meson-ir.conf new file mode 100644 index 00000000000..ac9cc29d2c0 --- /dev/null +++ b/projects/Odroid_C2/filesystem/usr/lib/modules-load.d/meson-ir.conf @@ -0,0 +1 @@ +meson-ir diff --git a/projects/Odroid_C2/filesystem/usr/lib/systemd/system/serial-console.service b/projects/Odroid_C2/filesystem/usr/lib/systemd/system/serial-console.service new file mode 100644 index 00000000000..5dffa1a8431 --- /dev/null +++ b/projects/Odroid_C2/filesystem/usr/lib/systemd/system/serial-console.service @@ -0,0 +1,22 @@ +[Unit] +Description=Debug Shell on /dev/console +DefaultDependencies=no +ConditionKernelCommandLine=console + +[Service] +WorkingDirectory=/storage +Environment="ENV=/etc/profile" +ExecStart=/bin/sh +Restart=always +RestartSec=0 +StandardInput=tty +TTYPath=/dev/console +TTYReset=yes +TTYVHangup=yes +KillMode=process +IgnoreSIGPIPE=no +# bash ignores SIGTERM +KillSignal=SIGHUP + +[Install] +WantedBy=sysinit.target diff --git a/projects/Odroid_C2/filesystem/usr/lib/udev/rules.d/10-odroid.rules b/projects/Odroid_C2/filesystem/usr/lib/udev/rules.d/10-odroid.rules new file mode 100644 index 00000000000..3f927bf6e06 --- /dev/null +++ b/projects/Odroid_C2/filesystem/usr/lib/udev/rules.d/10-odroid.rules @@ -0,0 +1,8 @@ +KERNEL=="mali",SUBSYSTEM=="misc",MODE="0777" +KERNEL=="mali0",SUBSYSTEM=="misc",MODE="0777" +KERNEL=="ump",SUBSYSTEM=="ump",MODE="0777" +KERNEL=="ttySAC0", SYMLINK+="ttyACM99" +KERNEL=="event*", SUBSYSTEM=="input", MODE="0777" +KERNEL=="CEC", MODE="0777" +KERNEL=="amvideo", MODE="0666" +KERNEL=="amstream*", MODE="0666" diff --git a/projects/Odroid_C2/initramfs/platform_init b/projects/Odroid_C2/initramfs/platform_init new file mode 100644 index 00000000000..67041292555 --- /dev/null +++ b/projects/Odroid_C2/initramfs/platform_init @@ -0,0 +1,54 @@ +#!/bin/sh + +for x in $(cat /proc/cmdline); do + case ${x} in + m_bpp=*) export bpp=${x#*=} ;; + hdmimode=*) export mode=${x#*=} ;; + esac +done + +common_display_setup() { + M="0 0 $(($X - 1)) $(($Y - 1))" + Y_VIRT=$(($Y * 2)) + fbset -fb /dev/fb0 -g $X $Y $X $Y_VIRT $bpp + fbset -fb /dev/fb1 -g 32 32 32 32 32 + echo $mode > /sys/class/display/mode + echo 0 > /sys/class/graphics/fb0/free_scale + echo 1 > /sys/class/graphics/fb0/freescale_mode + echo $M > /sys/class/graphics/fb0/free_scale_axis + echo $M > /sys/class/graphics/fb0/window_axis + echo 0 > /sys/class/graphics/fb1/free_scale + echo 1 > /sys/class/video/disable_video + + if [ "$bpp" = "32" ]; then + echo d01068b4 0x7fc0 > /sys/kernel/debug/aml_reg/paddr + fi +} + +case $mode in + 480*) export X=720 Y=480 ;; + 576*) export X=720 Y=576 ;; + 720p*) export X=1280 Y=720 ;; + 1080*) export X=1920 Y=1080 ;; + 2160p*) export X=3840 Y=2160 ;; + smpte24hz*) export X=3840 Y=2160 ;; + 640x480p60hz*) export X=640 Y=480 ;; + 800x480p60hz*) export X=800 Y=480 ;; + 800x600p60hz*) export X=800 Y=600 ;; + 1024x600p60hz*) export X=1024 Y=600 ;; + 1024x768p60hz*) export X=1024 Y=768 ;; + 1280x800p60hz*) export X=1280 Y=800 ;; + 1280x1024p60hz*) export X=1280 Y=1024 ;; + 1360x768p60hz*) export X=1360 Y=768 ;; + 1366x768p60hz*) export X=1366 Y=768 ;; + 1440x900p60hz*) export X=1440 Y=900 ;; + 1600x900p60hz*) export X=1600 Y=900 ;; + 1680x1050p60hz*) export X=1680 Y=1050 ;; + 1920x1200p60hz*) export X=1920 Y=1200 ;; +esac + +common_display_setup + +# Console unblack +echo 0 > /sys/class/graphics/fb0/blank +echo 0 > /sys/class/graphics/fb1/blank diff --git a/projects/Odroid_C2/linux/linux.aarch64.conf b/projects/Odroid_C2/linux/linux.aarch64.conf new file mode 100644 index 00000000000..9708ff64dc6 --- /dev/null +++ b/projects/Odroid_C2/linux/linux.aarch64.conf @@ -0,0 +1,3805 @@ +# +# Automatically generated file; DO NOT EDIT. +# Linux/arm64 3.14.29 Kernel Configuration +# +CONFIG_ARM64=y +CONFIG_ARM64_HAS_SG_CHAIN=y +CONFIG_64BIT=y +CONFIG_ARCH_PHYS_ADDR_T_64BIT=y +CONFIG_MMU=y +CONFIG_NO_IOPORT=y +CONFIG_STACKTRACE_SUPPORT=y +CONFIG_LOCKDEP_SUPPORT=y +CONFIG_TRACE_IRQFLAGS_SUPPORT=y +CONFIG_RWSEM_GENERIC_SPINLOCK=y +CONFIG_GENERIC_HWEIGHT=y +CONFIG_GENERIC_CSUM=y +CONFIG_GENERIC_CALIBRATE_DELAY=y +CONFIG_ARCH_DMA_ADDR_T_64BIT=y +CONFIG_NEED_DMA_MAP_STATE=y +CONFIG_NEED_SG_DMA_LENGTH=y +CONFIG_SWIOTLB=y +CONFIG_IOMMU_HELPER=y +CONFIG_KERNEL_MODE_NEON=y +CONFIG_FIX_EARLYCON_MEM=y +CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" +CONFIG_IRQ_WORK=y +CONFIG_BUILDTIME_EXTABLE_SORT=y + +# +# General setup +# +CONFIG_INIT_ENV_ARG_LIMIT=32 +CONFIG_CROSS_COMPILE="" +# CONFIG_COMPILE_TEST is not set +CONFIG_LOCALVERSION="" +# CONFIG_LOCALVERSION_AUTO is not set +CONFIG_DEFAULT_HOSTNAME="@DISTRONAME@" +# CONFIG_SWAP is not set +CONFIG_SYSVIPC=y +CONFIG_SYSVIPC_SYSCTL=y +CONFIG_POSIX_MQUEUE=y +CONFIG_POSIX_MQUEUE_SYSCTL=y +CONFIG_FHANDLE=y +CONFIG_AUDIT=y + +# +# IRQ subsystem +# +CONFIG_GENERIC_IRQ_PROBE=y +CONFIG_GENERIC_IRQ_SHOW=y +CONFIG_HARDIRQS_SW_RESEND=y +CONFIG_IRQ_DOMAIN=y +# CONFIG_IRQ_DOMAIN_DEBUG is not set +CONFIG_SPARSE_IRQ=y +CONFIG_GENERIC_TIME_VSYSCALL=y +CONFIG_GENERIC_CLOCKEVENTS=y +CONFIG_GENERIC_CLOCKEVENTS_BUILD=y +CONFIG_ARCH_HAS_TICK_BROADCAST=y +CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y + +# +# Timers subsystem +# +CONFIG_TICK_ONESHOT=y +CONFIG_NO_HZ_COMMON=y +# CONFIG_HZ_PERIODIC is not set +CONFIG_NO_HZ_IDLE=y +# CONFIG_NO_HZ_FULL is not set +CONFIG_NO_HZ=y +CONFIG_HIGH_RES_TIMERS=y + +# +# CPU/Task time and stats accounting +# +CONFIG_TICK_CPU_ACCOUNTING=y +# CONFIG_VIRT_CPU_ACCOUNTING_GEN is not set +CONFIG_BSD_PROCESS_ACCT=y +# CONFIG_BSD_PROCESS_ACCT_V3 is not set +# CONFIG_TASKSTATS is not set + +# +# RCU Subsystem +# +CONFIG_TREE_PREEMPT_RCU=y +CONFIG_PREEMPT_RCU=y +CONFIG_RCU_STALL_COMMON=y +# CONFIG_RCU_USER_QS is not set +CONFIG_RCU_FANOUT=64 +CONFIG_RCU_FANOUT_LEAF=16 +# CONFIG_RCU_FANOUT_EXACT is not set +# CONFIG_RCU_FAST_NO_HZ is not set +CONFIG_TREE_RCU_TRACE=y +# CONFIG_RCU_BOOST is not set +# CONFIG_RCU_NOCB_CPU is not set +CONFIG_IKCONFIG=y +CONFIG_IKCONFIG_PROC=y +CONFIG_LOG_BUF_SHIFT=19 +CONFIG_GENERIC_SCHED_CLOCK=y +CONFIG_CGROUPS=y +CONFIG_CGROUP_DEBUG=y +CONFIG_CGROUP_FREEZER=y +CONFIG_CGROUP_DEVICE=y +CONFIG_CPUSETS=y +CONFIG_PROC_PID_CPUSET=y +CONFIG_CGROUP_CPUACCT=y +CONFIG_RESOURCE_COUNTERS=y +# CONFIG_MEMCG is not set +CONFIG_CGROUP_PERF=y +CONFIG_CGROUP_SCHED=y +CONFIG_FAIR_GROUP_SCHED=y +CONFIG_CFS_BANDWIDTH=y +CONFIG_RT_GROUP_SCHED=y +CONFIG_BLK_CGROUP=y +# CONFIG_DEBUG_BLK_CGROUP is not set +# CONFIG_CHECKPOINT_RESTORE is not set +CONFIG_NAMESPACES=y +CONFIG_UTS_NS=y +CONFIG_IPC_NS=y +CONFIG_USER_NS=y +CONFIG_PID_NS=y +CONFIG_NET_NS=y +CONFIG_SCHED_AUTOGROUP=y +# CONFIG_SYSFS_DEPRECATED is not set +# CONFIG_RELAY is not set +CONFIG_BLK_DEV_INITRD=y +CONFIG_INITRAMFS_SOURCE="" +CONFIG_INITRAMFS_ROOT_UID=0 +CONFIG_INITRAMFS_ROOT_GID=0 +CONFIG_RD_GZIP=y +CONFIG_RD_BZIP2=y +CONFIG_RD_LZMA=y +CONFIG_RD_XZ=y +CONFIG_RD_LZO=y +# CONFIG_RD_LZ4 is not set +CONFIG_INITRAMFS_COMPRESSION_NONE=y +# CONFIG_INITRAMFS_COMPRESSION_GZIP is not set +# CONFIG_INITRAMFS_COMPRESSION_BZIP2 is not set +# CONFIG_INITRAMFS_COMPRESSION_LZMA is not set +# CONFIG_INITRAMFS_COMPRESSION_XZ is not set +# CONFIG_INITRAMFS_COMPRESSION_LZO is not set +# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set +CONFIG_SYSCTL=y +CONFIG_ANON_INODES=y +CONFIG_HAVE_UID16=y +CONFIG_SYSCTL_EXCEPTION_TRACE=y +CONFIG_EXPERT=y +CONFIG_UID16=y +# CONFIG_SYSCTL_SYSCALL is not set +CONFIG_KALLSYMS=y +# CONFIG_KALLSYMS_ALL is not set +CONFIG_PRINTK=y +CONFIG_BUG=y +CONFIG_ELF_CORE=y +CONFIG_BASE_FULL=y +CONFIG_FUTEX=y +CONFIG_EPOLL=y +CONFIG_SIGNALFD=y +CONFIG_TIMERFD=y +CONFIG_EVENTFD=y +CONFIG_SHMEM=y +CONFIG_AIO=y +CONFIG_EMBEDDED=y +CONFIG_HAVE_PERF_EVENTS=y +CONFIG_PERF_USE_VMALLOC=y + +# +# Kernel Performance Events And Counters +# +CONFIG_PERF_EVENTS=y +# CONFIG_DEBUG_PERF_USE_VMALLOC is not set +CONFIG_VM_EVENT_COUNTERS=y +CONFIG_SLUB_DEBUG=y +CONFIG_COMPAT_BRK=y +# CONFIG_SLAB is not set +CONFIG_SLUB=y +# CONFIG_SLOB is not set +# CONFIG_SLUB_CPU_PARTIAL is not set +# CONFIG_SYSTEM_TRUSTED_KEYRING is not set +# CONFIG_PROFILING is not set +CONFIG_TRACEPOINTS=y +# CONFIG_JUMP_LABEL is not set +# CONFIG_HAVE_64BIT_ALIGNED_ACCESS is not set +CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y +CONFIG_HAVE_ARCH_TRACEHOOK=y +CONFIG_HAVE_DMA_ATTRS=y +CONFIG_HAVE_DMA_CONTIGUOUS=y +CONFIG_GENERIC_SMP_IDLE_THREAD=y +CONFIG_HAVE_CLK=y +CONFIG_HAVE_DMA_API_DEBUG=y +CONFIG_HAVE_HW_BREAKPOINT=y +CONFIG_HAVE_PERF_REGS=y +CONFIG_HAVE_PERF_USER_STACK_DUMP=y +CONFIG_HAVE_ARCH_JUMP_LABEL=y +CONFIG_ARCH_WANT_COMPAT_IPC_PARSE_VERSION=y +CONFIG_HAVE_ARCH_SECCOMP_FILTER=y +CONFIG_SECCOMP_FILTER=y +# CONFIG_CC_STACKPROTECTOR is not set +CONFIG_HAVE_CONTEXT_TRACKING=y +CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y +CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE=y +CONFIG_MODULES_USE_ELF_RELA=y +CONFIG_CLONE_BACKWARDS=y +CONFIG_OLD_SIGSUSPEND3=y +CONFIG_COMPAT_OLD_SIGACTION=y + +# +# GCOV-based kernel profiling +# +# CONFIG_GCOV_KERNEL is not set +CONFIG_HAVE_GENERIC_DMA_COHERENT=y +CONFIG_SLABINFO=y +CONFIG_RT_MUTEXES=y +CONFIG_BASE_SMALL=0 +CONFIG_MODULES=y +# CONFIG_MODULE_FORCE_LOAD is not set +CONFIG_MODULE_UNLOAD=y +# CONFIG_MODULE_FORCE_UNLOAD is not set +# CONFIG_MODVERSIONS is not set +# CONFIG_MODULE_SRCVERSION_ALL is not set +# CONFIG_MODULE_SIG is not set +CONFIG_STOP_MACHINE=y +CONFIG_BLOCK=y +CONFIG_BLK_DEV_BSG=y +CONFIG_BLK_DEV_BSGLIB=y +# CONFIG_BLK_DEV_INTEGRITY is not set +# CONFIG_BLK_DEV_THROTTLING is not set +# CONFIG_BLK_CMDLINE_PARSER is not set + +# +# Partition Types +# +# CONFIG_PARTITION_ADVANCED is not set +CONFIG_MSDOS_PARTITION=y +CONFIG_EFI_PARTITION=y +CONFIG_BLOCK_COMPAT=y + +# +# IO Schedulers +# +CONFIG_IOSCHED_NOOP=y +CONFIG_IOSCHED_DEADLINE=y +CONFIG_IOSCHED_CFQ=y +# CONFIG_CFQ_GROUP_IOSCHED is not set +# CONFIG_DEFAULT_DEADLINE is not set +CONFIG_DEFAULT_CFQ=y +# CONFIG_DEFAULT_NOOP is not set +CONFIG_DEFAULT_IOSCHED="cfq" +CONFIG_UNINLINE_SPIN_UNLOCK=y +CONFIG_ARCH_SUPPORTS_ATOMIC_RMW=y +CONFIG_MUTEX_SPIN_ON_OWNER=y +CONFIG_FREEZER=y + +# +# Platform selection +# +# CONFIG_ARCH_VEXPRESS is not set +# CONFIG_ARCH_XGENE is not set +CONFIG_ARCH_MESON64_ODROIDC2=y + +# +# Bus support +# +CONFIG_ARM_AMBA=y + +# +# Kernel Features +# +# CONFIG_ARM64_64K_PAGES is not set +# CONFIG_CPU_BIG_ENDIAN is not set +CONFIG_SMP=y +CONFIG_SCHED_MC=y +CONFIG_SCHED_SMT=y +# CONFIG_DISABLE_CPU_SCHED_DOMAIN_BALANCE is not set +CONFIG_NR_CPUS=4 +CONFIG_HOTPLUG_CPU=y +CONFIG_SWP_EMULATE=y +# CONFIG_PREEMPT_NONE is not set +# CONFIG_PREEMPT_VOLUNTARY is not set +CONFIG_PREEMPT=y +CONFIG_PREEMPT_COUNT=y +CONFIG_HZ=100 +CONFIG_ARCH_HAS_HOLES_MEMORYMODEL=y +CONFIG_ARCH_SPARSEMEM_ENABLE=y +CONFIG_ARCH_SPARSEMEM_DEFAULT=y +CONFIG_ARCH_SELECT_MEMORY_MODEL=y +CONFIG_HAVE_ARCH_PFN_VALID=y +CONFIG_HW_PERF_EVENTS=y +CONFIG_ARMV7_COMPAT=y +CONFIG_ARMV7_COMPAT_CPUINFO=y +CONFIG_SYS_SUPPORTS_HUGETLBFS=y +CONFIG_ARCH_WANT_GENERAL_HUGETLB=y +CONFIG_ARCH_WANT_HUGE_PMD_SHARE=y +CONFIG_ARCH_HAS_CACHE_LINE_SIZE=y +CONFIG_SELECT_MEMORY_MODEL=y +CONFIG_SPARSEMEM_MANUAL=y +CONFIG_SPARSEMEM=y +CONFIG_HAVE_MEMORY_PRESENT=y +CONFIG_SPARSEMEM_EXTREME=y +CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y +CONFIG_SPARSEMEM_VMEMMAP=y +CONFIG_HAVE_MEMBLOCK=y +CONFIG_NO_BOOTMEM=y +CONFIG_MEMORY_ISOLATION=y +# CONFIG_HAVE_BOOTMEM_INFO_NODE is not set +CONFIG_PAGEFLAGS_EXTENDED=y +CONFIG_SPLIT_PTLOCK_CPUS=4 +CONFIG_COMPACTION=y +CONFIG_MIGRATION=y +CONFIG_PHYS_ADDR_T_64BIT=y +CONFIG_ZONE_DMA_FLAG=0 +CONFIG_KSM=y +CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 +# CONFIG_TRANSPARENT_HUGEPAGE is not set +CONFIG_CROSS_MEMORY_ATTACH=y +# CONFIG_CLEANCACHE is not set +CONFIG_CMA=y +# CONFIG_CMA_DEBUG is not set +CONFIG_CMA_AREAS=7 +# CONFIG_ZBUD is not set +# CONFIG_ZSMALLOC is not set +CONFIG_GENERIC_EARLY_IOREMAP=y +# CONFIG_XEN is not set +CONFIG_FORCE_MAX_ZONEORDER=11 +CONFIG_SECCOMP=y + +# +# Boot options +# +CONFIG_CMDLINE="console=ttyAMA0" +CONFIG_CMDLINE_FROM_BOOTLOADER=y +# CONFIG_CMDLINE_EXTEND is not set +# CONFIG_CMDLINE_FORCE is not set +# CONFIG_BUILD_ARM64_APPENDED_DTB_IMAGE is not set + +# +# Userspace binary formats +# +CONFIG_BINFMT_ELF=y +CONFIG_COMPAT_BINFMT_ELF=y +CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS=y +CONFIG_BINFMT_SCRIPT=y +# CONFIG_HAVE_AOUT is not set +CONFIG_BINFMT_MISC=y +CONFIG_COREDUMP=y +CONFIG_COMPAT=y +CONFIG_SYSVIPC_COMPAT=y + +# +# Power management options +# +CONFIG_SUSPEND=y +CONFIG_SUSPEND_FREEZER=y +CONFIG_HAS_WAKELOCK=y +CONFIG_HAS_EARLYSUSPEND=y +CONFIG_WAKELOCK=y +CONFIG_WAKELOCK_STAT=y +CONFIG_USER_WAKELOCK=y +CONFIG_EARLYSUSPEND=y +# CONFIG_NO_USER_SPACE_SCREEN_ACCESS_CONTROL is not set +# CONFIG_CONSOLE_EARLYSUSPEND is not set +CONFIG_FB_EARLYSUSPEND=y +# CONFIG_HIBERNATION is not set +CONFIG_PM_SLEEP=y +CONFIG_PM_SLEEP_SMP=y +# CONFIG_PM_AUTOSLEEP is not set +# CONFIG_PM_WAKELOCKS is not set +# CONFIG_PM_RUNTIME is not set +CONFIG_PM=y +# CONFIG_PM_DEBUG is not set +CONFIG_ARCH_HAS_OPP=y +CONFIG_PM_OPP=y +CONFIG_PM_CLK=y +# CONFIG_WQ_POWER_EFFICIENT_DEFAULT is not set +CONFIG_CPU_PM=y +# CONFIG_SUSPEND_TIME is not set + +# +# CPU Frequency scaling +# +CONFIG_CPU_FREQ=y +CONFIG_CPU_FREQ_GOV_COMMON=y +CONFIG_CPU_FREQ_STAT=y +# CONFIG_CPU_FREQ_STAT_DETAILS is not set +CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y +# CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE is not set +# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set +# CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set +# CONFIG_CPU_FREQ_DEFAULT_GOV_HOTPLUG is not set +# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set +# CONFIG_CPU_FREQ_DEFAULT_GOV_INTERACTIVE is not set +CONFIG_CPU_FREQ_GOV_PERFORMANCE=y +# CONFIG_CPU_FREQ_GOV_POWERSAVE is not set +# CONFIG_CPU_FREQ_GOV_USERSPACE is not set +# CONFIG_CPU_FREQ_GOV_ONDEMAND is not set +CONFIG_CPU_FREQ_GOV_HOTPLUG=y +# CONFIG_CPU_FREQ_GOV_INTERACTIVE is not set +# CONFIG_CPU_FREQ_GOV_CONSERVATIVE is not set +# CONFIG_GENERIC_CPUFREQ_CPU0 is not set +CONFIG_ARCH_SUSPEND_POSSIBLE=y +CONFIG_ARCH_HIBERNATION_POSSIBLE=y +CONFIG_ARM64_CPU_SUSPEND=y + +# +# CPU Power Management +# + +# +# CPU Idle +# +# CONFIG_CPU_IDLE is not set +# CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED is not set +CONFIG_NET=y +CONFIG_COMPAT_NETLINK_MESSAGES=y + +# +# Networking options +# +CONFIG_PACKET=y +# CONFIG_PACKET_DIAG is not set +CONFIG_UNIX=y +# CONFIG_UNIX_DIAG is not set +# CONFIG_XFRM_USER is not set +# CONFIG_NET_KEY is not set +CONFIG_INET=y +CONFIG_IP_MULTICAST=y +# CONFIG_IP_ADVANCED_ROUTER is not set +CONFIG_IP_PNP=y +CONFIG_IP_PNP_DHCP=y +CONFIG_IP_PNP_BOOTP=y +# CONFIG_IP_PNP_RARP is not set +# CONFIG_NET_IPIP is not set +# CONFIG_NET_IPGRE_DEMUX is not set +CONFIG_NET_IP_TUNNEL=m +CONFIG_IP_MROUTE=y +# CONFIG_IP_PIMSM_V1 is not set +# CONFIG_IP_PIMSM_V2 is not set +# CONFIG_SYN_COOKIES is not set +# CONFIG_INET_AH is not set +# CONFIG_INET_ESP is not set +# CONFIG_INET_IPCOMP is not set +# CONFIG_INET_XFRM_TUNNEL is not set +CONFIG_INET_TUNNEL=m +# CONFIG_INET_XFRM_MODE_TRANSPORT is not set +# CONFIG_INET_XFRM_MODE_TUNNEL is not set +# CONFIG_INET_XFRM_MODE_BEET is not set +CONFIG_INET_LRO=y +# CONFIG_INET_DIAG is not set +# CONFIG_TCP_CONG_ADVANCED is not set +CONFIG_TCP_CONG_CUBIC=y +CONFIG_DEFAULT_TCP_CONG="cubic" +# CONFIG_TCP_MD5SIG is not set +CONFIG_IPV6=y +# CONFIG_IPV6_ROUTER_PREF is not set +# CONFIG_IPV6_OPTIMISTIC_DAD is not set +# CONFIG_INET6_AH is not set +# CONFIG_INET6_ESP is not set +# CONFIG_INET6_IPCOMP is not set +# CONFIG_IPV6_MIP6 is not set +# CONFIG_INET6_XFRM_TUNNEL is not set +# CONFIG_INET6_TUNNEL is not set +# CONFIG_INET6_XFRM_MODE_TRANSPORT is not set +# CONFIG_INET6_XFRM_MODE_TUNNEL is not set +# CONFIG_INET6_XFRM_MODE_BEET is not set +# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set +CONFIG_IPV6_SIT=m +# CONFIG_IPV6_SIT_6RD is not set +CONFIG_IPV6_NDISC_NODETYPE=y +# CONFIG_IPV6_TUNNEL is not set +# CONFIG_IPV6_GRE is not set +# CONFIG_IPV6_MULTIPLE_TABLES is not set +# CONFIG_IPV6_MROUTE is not set +# CONFIG_ANDROID_PARANOID_NETWORK is not set +# CONFIG_NET_ACTIVITY_STATS is not set +# CONFIG_NETWORK_SECMARK is not set +# CONFIG_NETWORK_PHY_TIMESTAMPING is not set +CONFIG_NETFILTER=y +# CONFIG_NETFILTER_DEBUG is not set +CONFIG_NETFILTER_ADVANCED=y +# CONFIG_BRIDGE_NETFILTER is not set + +# +# Core Netfilter Configuration +# +CONFIG_NETFILTER_NETLINK=m +# CONFIG_NETFILTER_NETLINK_ACCT is not set +# CONFIG_NETFILTER_NETLINK_QUEUE is not set +CONFIG_NETFILTER_NETLINK_LOG=m +CONFIG_NF_CONNTRACK=m +# CONFIG_NF_CONNTRACK_MARK is not set +# CONFIG_NF_CONNTRACK_PROCFS is not set +# CONFIG_NF_CONNTRACK_EVENTS is not set +# CONFIG_NF_CONNTRACK_TIMEOUT is not set +# CONFIG_NF_CONNTRACK_TIMESTAMP is not set +# CONFIG_NF_CT_PROTO_DCCP is not set +# CONFIG_NF_CT_PROTO_SCTP is not set +# CONFIG_NF_CT_PROTO_UDPLITE is not set +# CONFIG_NF_CONNTRACK_AMANDA is not set +CONFIG_NF_CONNTRACK_FTP=m +# CONFIG_NF_CONNTRACK_H323 is not set +CONFIG_NF_CONNTRACK_IRC=m +CONFIG_NF_CONNTRACK_BROADCAST=m +CONFIG_NF_CONNTRACK_NETBIOS_NS=m +# CONFIG_NF_CONNTRACK_SNMP is not set +# CONFIG_NF_CONNTRACK_PPTP is not set +# CONFIG_NF_CONNTRACK_SANE is not set +CONFIG_NF_CONNTRACK_SIP=m +# CONFIG_NF_CONNTRACK_TFTP is not set +CONFIG_NF_CT_NETLINK=m +# CONFIG_NF_CT_NETLINK_TIMEOUT is not set +CONFIG_NF_NAT=m +CONFIG_NF_NAT_NEEDED=y +# CONFIG_NF_NAT_AMANDA is not set +CONFIG_NF_NAT_FTP=m +CONFIG_NF_NAT_IRC=m +CONFIG_NF_NAT_SIP=m +# CONFIG_NF_NAT_TFTP is not set +# CONFIG_NF_TABLES is not set +CONFIG_NETFILTER_XTABLES=m + +# +# Xtables combined modules +# +# CONFIG_NETFILTER_XT_MARK is not set +# CONFIG_NETFILTER_XT_CONNMARK is not set + +# +# Xtables targets +# +# CONFIG_NETFILTER_XT_TARGET_AUDIT is not set +# CONFIG_NETFILTER_XT_TARGET_CHECKSUM is not set +# CONFIG_NETFILTER_XT_TARGET_CLASSIFY is not set +# CONFIG_NETFILTER_XT_TARGET_CONNMARK is not set +# CONFIG_NETFILTER_XT_TARGET_DSCP is not set +# CONFIG_NETFILTER_XT_TARGET_HL is not set +# CONFIG_NETFILTER_XT_TARGET_HMARK is not set +# CONFIG_NETFILTER_XT_TARGET_IDLETIMER is not set +# CONFIG_NETFILTER_XT_TARGET_LED is not set +# CONFIG_NETFILTER_XT_TARGET_LOG is not set +# CONFIG_NETFILTER_XT_TARGET_MARK is not set +# CONFIG_NETFILTER_XT_TARGET_NETMAP is not set +# CONFIG_NETFILTER_XT_TARGET_NFLOG is not set +# CONFIG_NETFILTER_XT_TARGET_NFQUEUE is not set +# CONFIG_NETFILTER_XT_TARGET_RATEEST is not set +# CONFIG_NETFILTER_XT_TARGET_REDIRECT is not set +# CONFIG_NETFILTER_XT_TARGET_TEE is not set +# CONFIG_NETFILTER_XT_TARGET_TPROXY is not set +# CONFIG_NETFILTER_XT_TARGET_TCPMSS is not set +# CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP is not set + +# +# Xtables matches +# +# CONFIG_NETFILTER_XT_MATCH_ADDRTYPE is not set +# CONFIG_NETFILTER_XT_MATCH_BPF is not set +# CONFIG_NETFILTER_XT_MATCH_CGROUP is not set +# CONFIG_NETFILTER_XT_MATCH_CLUSTER is not set +# CONFIG_NETFILTER_XT_MATCH_COMMENT is not set +# CONFIG_NETFILTER_XT_MATCH_CONNBYTES is not set +# CONFIG_NETFILTER_XT_MATCH_CONNLABEL is not set +# CONFIG_NETFILTER_XT_MATCH_CONNLIMIT is not set +# CONFIG_NETFILTER_XT_MATCH_CONNMARK is not set +# CONFIG_NETFILTER_XT_MATCH_CONNTRACK is not set +# CONFIG_NETFILTER_XT_MATCH_CPU is not set +# CONFIG_NETFILTER_XT_MATCH_DCCP is not set +# CONFIG_NETFILTER_XT_MATCH_DEVGROUP is not set +# CONFIG_NETFILTER_XT_MATCH_DSCP is not set +# CONFIG_NETFILTER_XT_MATCH_ECN is not set +# CONFIG_NETFILTER_XT_MATCH_ESP is not set +# CONFIG_NETFILTER_XT_MATCH_HASHLIMIT is not set +# CONFIG_NETFILTER_XT_MATCH_HELPER is not set +# CONFIG_NETFILTER_XT_MATCH_HL is not set +# CONFIG_NETFILTER_XT_MATCH_IPCOMP is not set +CONFIG_NETFILTER_XT_MATCH_IPRANGE=m +# CONFIG_NETFILTER_XT_MATCH_L2TP is not set +# CONFIG_NETFILTER_XT_MATCH_LENGTH is not set +# CONFIG_NETFILTER_XT_MATCH_LIMIT is not set +# CONFIG_NETFILTER_XT_MATCH_MAC is not set +# CONFIG_NETFILTER_XT_MATCH_MARK is not set +# CONFIG_NETFILTER_XT_MATCH_MULTIPORT is not set +# CONFIG_NETFILTER_XT_MATCH_NFACCT is not set +# CONFIG_NETFILTER_XT_MATCH_OSF is not set +CONFIG_NETFILTER_XT_MATCH_OWNER=m +# CONFIG_NETFILTER_XT_MATCH_PKTTYPE is not set +# CONFIG_NETFILTER_XT_MATCH_QUOTA is not set +# CONFIG_NETFILTER_XT_MATCH_QUOTA2 is not set +# CONFIG_NETFILTER_XT_MATCH_RATEEST is not set +# CONFIG_NETFILTER_XT_MATCH_REALM is not set +# CONFIG_NETFILTER_XT_MATCH_RECENT is not set +# CONFIG_NETFILTER_XT_MATCH_SCTP is not set +# CONFIG_NETFILTER_XT_MATCH_SOCKET is not set +CONFIG_NETFILTER_XT_MATCH_STATE=m +# CONFIG_NETFILTER_XT_MATCH_STATISTIC is not set +# CONFIG_NETFILTER_XT_MATCH_STRING is not set +# CONFIG_NETFILTER_XT_MATCH_TCPMSS is not set +# CONFIG_NETFILTER_XT_MATCH_TIME is not set +# CONFIG_NETFILTER_XT_MATCH_U32 is not set +# CONFIG_IP_SET is not set +# CONFIG_IP_VS is not set + +# +# IP: Netfilter Configuration +# +CONFIG_NF_DEFRAG_IPV4=m +CONFIG_NF_CONNTRACK_IPV4=m +CONFIG_IP_NF_IPTABLES=m +# CONFIG_IP_NF_MATCH_AH is not set +# CONFIG_IP_NF_MATCH_ECN is not set +# CONFIG_IP_NF_MATCH_RPFILTER is not set +# CONFIG_IP_NF_MATCH_TTL is not set +CONFIG_IP_NF_FILTER=m +CONFIG_IP_NF_TARGET_REJECT=m +# CONFIG_IP_NF_TARGET_SYNPROXY is not set +# CONFIG_IP_NF_TARGET_ULOG is not set +CONFIG_NF_NAT_IPV4=m +CONFIG_IP_NF_TARGET_MASQUERADE=m +# CONFIG_IP_NF_TARGET_NETMAP is not set +# CONFIG_IP_NF_TARGET_REDIRECT is not set +# CONFIG_NF_NAT_PPTP is not set +# CONFIG_NF_NAT_H323 is not set +CONFIG_IP_NF_MANGLE=m +# CONFIG_IP_NF_TARGET_CLUSTERIP is not set +# CONFIG_IP_NF_TARGET_ECN is not set +# CONFIG_IP_NF_TARGET_TTL is not set +# CONFIG_IP_NF_RAW is not set +# CONFIG_IP_NF_ARPTABLES is not set + +# +# IPv6: Netfilter Configuration +# +CONFIG_NF_DEFRAG_IPV6=m +CONFIG_NF_CONNTRACK_IPV6=m +CONFIG_IP6_NF_IPTABLES=m +# CONFIG_IP6_NF_MATCH_AH is not set +# CONFIG_IP6_NF_MATCH_EUI64 is not set +# CONFIG_IP6_NF_MATCH_FRAG is not set +# CONFIG_IP6_NF_MATCH_OPTS is not set +# CONFIG_IP6_NF_MATCH_HL is not set +# CONFIG_IP6_NF_MATCH_IPV6HEADER is not set +# CONFIG_IP6_NF_MATCH_MH is not set +# CONFIG_IP6_NF_MATCH_RPFILTER is not set +# CONFIG_IP6_NF_MATCH_RT is not set +# CONFIG_IP6_NF_TARGET_HL is not set +CONFIG_IP6_NF_FILTER=m +CONFIG_IP6_NF_TARGET_REJECT=m +# CONFIG_IP6_NF_TARGET_SYNPROXY is not set +CONFIG_IP6_NF_MANGLE=m +# CONFIG_IP6_NF_RAW is not set +CONFIG_NF_NAT_IPV6=m +# CONFIG_IP6_NF_TARGET_MASQUERADE is not set +# CONFIG_IP6_NF_TARGET_NPT is not set +# CONFIG_BRIDGE_NF_EBTABLES is not set +# CONFIG_IP_DCCP is not set +# CONFIG_IP_SCTP is not set +# CONFIG_RDS is not set +# CONFIG_TIPC is not set +# CONFIG_ATM is not set +# CONFIG_L2TP is not set +CONFIG_STP=m +CONFIG_BRIDGE=m +CONFIG_BRIDGE_IGMP_SNOOPING=y +# CONFIG_BRIDGE_VLAN_FILTERING is not set +CONFIG_HAVE_NET_DSA=y +CONFIG_VLAN_8021Q=m +# CONFIG_VLAN_8021Q_GVRP is not set +# CONFIG_VLAN_8021Q_MVRP is not set +# CONFIG_DECNET is not set +CONFIG_LLC=m +# CONFIG_LLC2 is not set +# CONFIG_IPX is not set +# CONFIG_ATALK is not set +# CONFIG_X25 is not set +# CONFIG_LAPB is not set +# CONFIG_PHONET is not set +# CONFIG_IEEE802154 is not set +CONFIG_6LOWPAN_IPHC=m +# CONFIG_NET_SCHED is not set +# CONFIG_DCB is not set +CONFIG_DNS_RESOLVER=y +# CONFIG_BATMAN_ADV is not set +# CONFIG_OPENVSWITCH is not set +# CONFIG_VSOCKETS is not set +# CONFIG_NETLINK_MMAP is not set +# CONFIG_NETLINK_DIAG is not set +# CONFIG_NET_MPLS_GSO is not set +# CONFIG_HSR is not set +CONFIG_RPS=y +CONFIG_RFS_ACCEL=y +CONFIG_XPS=y +# CONFIG_CGROUP_NET_PRIO is not set +# CONFIG_CGROUP_NET_CLASSID is not set +CONFIG_NET_RX_BUSY_POLL=y +CONFIG_BQL=y +CONFIG_NET_FLOW_LIMIT=y + +# +# Network testing +# +# CONFIG_NET_PKTGEN is not set +# CONFIG_NET_DROP_MONITOR is not set +# CONFIG_HAMRADIO is not set +# CONFIG_CAN is not set +# CONFIG_IRDA is not set +CONFIG_BT=m +CONFIG_BT_RFCOMM=m +CONFIG_BT_RFCOMM_TTY=y +# CONFIG_BT_BNEP is not set +CONFIG_BT_HIDP=m + +# +# Bluetooth device drivers +# +CONFIG_BT_HCIBTUSB=m +CONFIG_BT_HCIBTSDIO=m +CONFIG_BT_HCIUART=m +CONFIG_BT_HCIUART_H4=y +CONFIG_BT_HCIUART_BCSP=y +CONFIG_BT_HCIUART_ATH3K=y +CONFIG_BT_HCIUART_LL=y +# CONFIG_BT_HCIUART_3WIRE is not set +CONFIG_BT_HCIBCM203X=m +CONFIG_BT_HCIBPA10X=m +CONFIG_BT_HCIBFUSB=m +# CONFIG_BT_HCIVHCI is not set +CONFIG_BT_MRVL=m +CONFIG_BT_MRVL_SDIO=m +CONFIG_BT_ATH3K=m +# CONFIG_AF_RXRPC is not set +CONFIG_WIRELESS=y +CONFIG_WIRELESS_EXT=y +CONFIG_WEXT_CORE=y +CONFIG_WEXT_PROC=y +CONFIG_WEXT_PRIV=y +CONFIG_CFG80211=m +# CONFIG_NL80211_TESTMODE is not set +# CONFIG_CFG80211_DEVELOPER_WARNINGS is not set +# CONFIG_CFG80211_REG_DEBUG is not set +# CONFIG_CFG80211_CERTIFICATION_ONUS is not set +CONFIG_CFG80211_DEFAULT_PS=y +# CONFIG_CFG80211_DEBUGFS is not set +CONFIG_CFG80211_INTERNAL_REGDB=y +CONFIG_CFG80211_WEXT=y +# CONFIG_LIB80211 is not set +CONFIG_MAC80211=m +CONFIG_MAC80211_HAS_RC=y +# CONFIG_MAC80211_RC_PID is not set +CONFIG_MAC80211_RC_MINSTREL=y +CONFIG_MAC80211_RC_MINSTREL_HT=y +CONFIG_MAC80211_RC_DEFAULT_MINSTREL=y +CONFIG_MAC80211_RC_DEFAULT="minstrel_ht" +# CONFIG_MAC80211_MESH is not set +CONFIG_MAC80211_LEDS=y +# CONFIG_MAC80211_DEBUGFS is not set +# CONFIG_MAC80211_MESSAGE_TRACING is not set +# CONFIG_MAC80211_DEBUG_MENU is not set +# CONFIG_WIMAX is not set +# CONFIG_RFKILL is not set +# CONFIG_RFKILL_REGULATOR is not set +# CONFIG_NET_9P is not set +# CONFIG_CAIF is not set +# CONFIG_CEPH_LIB is not set +# CONFIG_NFC is not set + +# +# Device Drivers +# + +# +# Amlogic Device Drivers +# +CONFIG_AML_AO_CEC=y +CONFIG_MESON_TIMER=y +CONFIG_AM_UART=y +CONFIG_SERIAL_MESON_CONSOLE=y +CONFIG_AML_CPU_VERSION=y +CONFIG_AML_MESON64_VERSION=y +# CONFIG_AML_M8_VERSION is not set +CONFIG_AMLOGIC_IOMAP=y +CONFIG_PINCTRL_AMLOGIC=y + +# +# USB Support +# +CONFIG_AMLOGIC_USB=y +CONFIG_USB_DWC_OTG_HCD=y +CONFIG_USB_HOST_ELECT_TEST=y + +# +# I2C Hardware Bus support +# +CONFIG_I2C_AML=y +# CONFIG_I2C_SW_AML is not set +# CONFIG_BCM2079X_I2C is not set + +# +# HDMI TX Support +# +CONFIG_AML_HDMI_TX=y +CONFIG_AML_HDMI_TX_20=y +# CONFIG_AML_HDMI_TX_14 is not set +# CONFIG_AML_RTC is not set +CONFIG_AML_VRTC=y +CONFIG_AM_IRBLASTER=y +# CONFIG_AML_DEBUG is not set +CONFIG_AML_REG_ACCESS=y + +# +# Power Management Support +# +# CONFIG_AML_POWER_SUPPORT is not set +# CONFIG_AML_PMU_ALGORITHM_SUPPORT is not set + +# +# Ethernet Support +# +CONFIG_AM_PHY=y +CONFIG_PHYLIB=y + +# +# MII PHY device drivers +# +CONFIG_AML_PHY=y +CONFIG_AML_SMSC=y +CONFIG_AML_ICPLUS=y +CONFIG_AML_MICREL=y +CONFIG_AML_REALTEK=y + +# +# MMC/SD/SDIO Host Controller Drivers +# + +# +# Multimedia Card support +# +CONFIG_MMC_AML=y +# CONFIG_MMC_AML_DEBUG is not set +# CONFIG_AML_MMC_DEBUG_FORCE_SINGLE_BLOCK_RW is not set + +# +# Amlogic VPU Drivers +# + +# +# Amlogic VPU Driver +# +CONFIG_AML_VPU=y +# CONFIG_AML_VPU_DYNAMIC_ADJ is not set + +# +# ION support +# +CONFIG_AMLOGIC_ION=y + +# +# Amlogic Display Driver +# +CONFIG_AML_DISPLAY=y + +# +# Amlogic VOUT Module +# +CONFIG_AM_VOUT=y +CONFIG_AM_TV_OUTPUT=y +CONFIG_AML_VOUT_FRAMERATE_AUTOMATION=y +# CONFIG_AML_VDAC_HW_SWITCH is not set +# CONFIG_AM_LCD_OUTPUT is not set + +# +# Amlogic OSD Module +# +CONFIG_AM_FB=y +CONFIG_FB_OSD_SUPPORT_SYNC_FENCE=y +CONFIG_FB_OSD_VSYNC_RDMA=y +CONFIG_FB_OSD2_ENABLE=y +CONFIG_FB_OSD2_CURSOR=y + +# +# Amlogic VOUT2 Module +# +# CONFIG_AM_VOUT2 is not set +# CONFIG_AM_TV_OUTPUT2 is not set + +# +# Amlogic OSD_EXT Module +# +# CONFIG_AM_FB_EXT is not set +CONFIG_AM_GE2D=y +CONFIG_AM_LOGO=y + +# +# Amlogic Backlight Support +# +# CONFIG_AMLOGIC_BACKLIGHT is not set +# CONFIG_AMLOGIC_LED is not set + +# +# Canvas management driver +# +CONFIG_AML_CANVAS=y +CONFIG_AMLOGIC_CLK=y +CONFIG_AMLOGIC_SEC=y +CONFIG_AMLOGIC_SECURITY_KEY=y +CONFIG_AM_PTSSERVER=y +# CONFIG_H264_4K2K_SINGLE_CORE is not set +CONFIG_VSYNC_RDMA=y +# CONFIG_TVIN_VIUIN is not set +CONFIG_AM_VIDEO=y +# CONFIG_AM_VIDEO2 is not set +# CONFIG_SUPPORT_VIDEO_ON_VPP2 is not set +CONFIG_GE2D_KEEP_FRAME=y + +# +# Video Decoders +# +CONFIG_AM_VDEC_MPEG12=y +CONFIG_AM_VDEC_MPEG4=y +CONFIG_AM_VDEC_VC1=y +CONFIG_AM_VDEC_H264=y +CONFIG_AM_VDEC_H264MVC=y +CONFIG_AM_VDEC_H264_4K2K=y +CONFIG_AM_VDEC_H265=y +CONFIG_AM_VDEC_MJPEG=y +CONFIG_AM_ENCODER=y +CONFIG_AM_JPEG_ENCODER=y +CONFIG_AM_PIC_DEC=y +CONFIG_AM_VDEC_REAL=y +CONFIG_AM_VDEC_AVS=y +# CONFIG_AM_JPEGDEC is not set +CONFIG_AM_TIMESYNC=y +CONFIG_AM_STREAMING=y +CONFIG_AM_SUBTITLE=y +# CONFIG_AM_VIDEOCAPTURE is not set + +# +# Deinterlace driver +# +CONFIG_DEINTERLACE=y +# CONFIG_AM_DEINTERLACE_SD_ONLY is not set +CONFIG_AML_VFM=y + +# +# EFUSE Support +# +CONFIG_EFUSE=y +# CONFIG_EFUSE_WRITE_VERSION_PERMIT is not set + +# +# key management Support +# +CONFIG_KEY_MANAGE=y + +# +# Audio Interface +# +CONFIG_AMAUDIO=y + +# +# Amlogic Audio Interface V2 +# +# CONFIG_AMAUDIO2 is not set + +# +# Audio dsp process +# +CONFIG_AML_AUDIO_DSP=y + +# +# Post Process Manager driver +# +CONFIG_POST_PROCESS_MANAGER=y +CONFIG_POST_PROCESS_MANAGER_PPSCALER=y +# CONFIG_POST_PROCESS_MANAGER_3D_PROCESS is not set + +# +# Amlogic Wifi Driver +# +# CONFIG_AM_WIFI is not set +CONFIG_AML_POWER_RESET=y +# CONFIG_M8_POWER_RESET is not set +CONFIG_GXBB_POWER_RESET=y + +# +# Amlogic Bt Rfkill Driver +# + +# +# Amlogic ion video support +# +CONFIG_VIDEOBUF2_ION=y +CONFIG_AMLOGIC_IONVIDEO=y + +# +# V4L2 Video Support +# +CONFIG_V4L_AMLOGIC_VIDEO=y +# CONFIG_V4L_AMLOGIC_VIDEO2 is not set + +# +# Amlogic TVIN Drivers +# +# CONFIG_TVIN is not set + +# +# Amlogic VECM Drivers +# + +# +# Amlogic amvecm Driver +# +CONFIG_AM_VECM=y +CONFIG_AML_NAND=y +CONFIG_AML_NEXT_GEN_NAND=y +CONFIG_AML_NFTL_NEW=m +CONFIG_AML_NAND_KEY=y +# CONFIG_SECURE_NAND is not set +CONFIG_AM_INPUT=y +CONFIG_AM_SARADC=y +CONFIG_MESON_NEW_INPUT_REMOTE=y +CONFIG_NEW_AM_REMOTE=y +CONFIG_MESON_INPUT_KEYBOARD=y +CONFIG_ADC_KEYPADS_AM=y +CONFIG_AML_GPIO_KEY=y +# CONFIG_SENSOR_DEVICES is not set +# CONFIG_AMLOGIC_MESON_CPUFREQ is not set +CONFIG_AMLOGIC_SCPI_CPUFREQ=y +CONFIG_MESON_SUSPEND=y +# CONFIG_M8M2_SUSPEND is not set +CONFIG_GXBB_SUSPEND=y + +# +# Amlogic DVB driver +# +# CONFIG_AM_DVB is not set +# CONFIG_AM_ATVDEMOD is not set + +# +# AMLOGIC CI Driver +# +# CONFIG_AM_PCMCIA is not set +# CONFIG_AM_IOBUS is not set + +# +# MESON MHU mailbox Support +# +CONFIG_MESON_MHU_MBOX=y +CONFIG_ARM_SCPI_PROTOCOL=y + +# +# RDMA management driver +# +CONFIG_AML_RDMA=y + +# +# Amlogic temperature sensor +# +# CONFIG_AML_TEMP_SENSOR is not set +CONFIG_AUDIO_DATA=y +# CONFIG_INSTABOOT is not set + +# +# Amlogic Camera Support +# +# CONFIG_VIDEO_AMLOGIC_CAPTURE is not set +CONFIG_AML_CODEC_MM=y +# CONFIG_AML_WDT is not set +CONFIG_MESON_PWM=y +CONFIG_MESON_PWM_CTRL=y + +# +# Generic Driver Options +# +CONFIG_UEVENT_HELPER_PATH="" +CONFIG_DEVTMPFS=y +CONFIG_DEVTMPFS_MOUNT=y +CONFIG_STANDALONE=y +CONFIG_PREVENT_FIRMWARE_BUILD=y +CONFIG_FW_LOADER=y +CONFIG_FIRMWARE_IN_KERNEL=y +CONFIG_EXTRA_FIRMWARE="" +# CONFIG_FW_LOADER_USER_HELPER is not set +# CONFIG_DEBUG_DRIVER is not set +# CONFIG_DEBUG_DEVRES is not set +# CONFIG_SYS_HYPERVISOR is not set +# CONFIG_GENERIC_CPU_DEVICES is not set +CONFIG_HAVE_CPU_AUTOPROBE=y +CONFIG_GENERIC_CPU_AUTOPROBE=y +CONFIG_REGMAP=y +CONFIG_REGMAP_I2C=y +CONFIG_REGMAP_SPI=y +CONFIG_REGMAP_MMIO=y +CONFIG_DMA_SHARED_BUFFER=y +CONFIG_DMA_CMA=y + +# +# Default contiguous memory area size: +# +CONFIG_CMA_SIZE_MBYTES=8 +CONFIG_CMA_SIZE_SEL_MBYTES=y +# CONFIG_CMA_SIZE_SEL_PERCENTAGE is not set +# CONFIG_CMA_SIZE_SEL_MIN is not set +# CONFIG_CMA_SIZE_SEL_MAX is not set +CONFIG_CMA_ALIGNMENT=8 + +# +# Bus devices +# +CONFIG_CONNECTOR=y +CONFIG_PROC_EVENTS=y +CONFIG_MTD=y +# CONFIG_MTD_TESTS is not set +# CONFIG_MTD_REDBOOT_PARTS is not set +CONFIG_MTD_CMDLINE_PARTS=y +CONFIG_MTD_OF_PARTS=y +# CONFIG_MTD_AR7_PARTS is not set + +# +# User Modules And Translation Layers +# +CONFIG_MTD_BLKDEVS=y +CONFIG_MTD_BLOCK=y +# CONFIG_FTL is not set +# CONFIG_NFTL is not set +# CONFIG_INFTL is not set +# CONFIG_RFD_FTL is not set +# CONFIG_SSFDC is not set +# CONFIG_SM_FTL is not set +CONFIG_MTD_OOPS=y + +# +# RAM/ROM/Flash chip drivers +# +CONFIG_MTD_CFI=y +# CONFIG_MTD_JEDECPROBE is not set +CONFIG_MTD_GEN_PROBE=y +# CONFIG_MTD_CFI_ADV_OPTIONS is not set +CONFIG_MTD_MAP_BANK_WIDTH_1=y +CONFIG_MTD_MAP_BANK_WIDTH_2=y +CONFIG_MTD_MAP_BANK_WIDTH_4=y +# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set +# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set +# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set +CONFIG_MTD_CFI_I1=y +CONFIG_MTD_CFI_I2=y +# CONFIG_MTD_CFI_I4 is not set +# CONFIG_MTD_CFI_I8 is not set +CONFIG_MTD_CFI_INTELEXT=y +# CONFIG_MTD_CFI_AMDSTD is not set +# CONFIG_MTD_CFI_STAA is not set +CONFIG_MTD_CFI_UTIL=y +# CONFIG_MTD_RAM is not set +# CONFIG_MTD_ROM is not set +# CONFIG_MTD_ABSENT is not set + +# +# Mapping drivers for chip access +# +# CONFIG_MTD_COMPLEX_MAPPINGS is not set +# CONFIG_MTD_PHYSMAP is not set +# CONFIG_MTD_PHYSMAP_OF is not set +# CONFIG_MTD_PLATRAM is not set + +# +# Self-contained MTD device drivers +# +# CONFIG_MTD_DATAFLASH is not set +# CONFIG_MTD_M25P80 is not set +# CONFIG_MTD_SST25L is not set +# CONFIG_MTD_SLRAM is not set +# CONFIG_MTD_PHRAM is not set +# CONFIG_MTD_MTDRAM is not set +# CONFIG_MTD_BLOCK2MTD is not set + +# +# Disk-On-Chip Device Drivers +# +# CONFIG_MTD_DOCG3 is not set +CONFIG_MTD_NAND_IDS=y +CONFIG_MTD_NAND_ECC=y +# CONFIG_MTD_NAND_ECC_SMC is not set +CONFIG_MTD_NAND=y +# CONFIG_MTD_NAND_ECC_BCH is not set +# CONFIG_MTD_SM_COMMON is not set +# CONFIG_MTD_NAND_DENALI is not set +# CONFIG_MTD_NAND_GPIO is not set +# CONFIG_MTD_NAND_DISKONCHIP is not set +# CONFIG_MTD_NAND_DOCG4 is not set +# CONFIG_MTD_NAND_NANDSIM is not set +# CONFIG_MTD_NAND_PLATFORM is not set +# CONFIG_MTD_ONENAND is not set + +# +# LPDDR flash memory drivers +# +# CONFIG_MTD_LPDDR is not set +# CONFIG_MTD_UBI is not set +CONFIG_DTC=y +CONFIG_OF=y + +# +# Device Tree and Open Firmware support +# +CONFIG_PROC_DEVICETREE=y +# CONFIG_OF_SELFTEST is not set +CONFIG_OF_FLATTREE=y +CONFIG_OF_EARLY_FLATTREE=y +CONFIG_OF_ADDRESS=y +CONFIG_OF_IRQ=y +CONFIG_OF_NET=y +CONFIG_OF_MDIO=y +CONFIG_OF_MTD=y +CONFIG_OF_RESERVED_MEM=y +# CONFIG_PARPORT is not set +CONFIG_BLK_DEV=y +# CONFIG_BLK_DEV_NULL_BLK is not set +# CONFIG_BLK_DEV_COW_COMMON is not set +CONFIG_BLK_DEV_LOOP=y +CONFIG_BLK_DEV_LOOP_MIN_COUNT=8 +# CONFIG_BLK_DEV_CRYPTOLOOP is not set +# CONFIG_BLK_DEV_DRBD is not set +# CONFIG_BLK_DEV_NBD is not set +# CONFIG_BLK_DEV_RAM is not set +# CONFIG_CDROM_PKTCDVD is not set +# CONFIG_ATA_OVER_ETH is not set +# CONFIG_BLK_DEV_RBD is not set + +# +# Misc devices +# +# CONFIG_SENSORS_LIS3LV02D is not set +# CONFIG_AD525X_DPOT is not set +# CONFIG_ATMEL_PWM is not set +# CONFIG_DUMMY_IRQ is not set +# CONFIG_ICS932S401 is not set +# CONFIG_ATMEL_SSC is not set +# CONFIG_ENCLOSURE_SERVICES is not set +# CONFIG_APDS9802ALS is not set +# CONFIG_ISL29003 is not set +# CONFIG_ISL29020 is not set +# CONFIG_SENSORS_TSL2550 is not set +# CONFIG_SENSORS_BH1780 is not set +# CONFIG_SENSORS_BH1770 is not set +# CONFIG_SENSORS_APDS990X is not set +# CONFIG_HMC6352 is not set +# CONFIG_DS1682 is not set +# CONFIG_TI_DAC7512 is not set +# CONFIG_UID_STAT is not set +# CONFIG_BMP085_I2C is not set +# CONFIG_BMP085_SPI is not set +# CONFIG_USB_SWITCH_FSA9480 is not set +# CONFIG_LATTICE_ECP3_CONFIG is not set +# CONFIG_SRAM is not set +# CONFIG_C2PORT is not set + +# +# EEPROM support +# +# CONFIG_EEPROM_AT24 is not set +# CONFIG_EEPROM_AT25 is not set +# CONFIG_EEPROM_LEGACY is not set +# CONFIG_EEPROM_MAX6875 is not set +CONFIG_EEPROM_93CX6=m +# CONFIG_EEPROM_93XX46 is not set + +# +# Texas Instruments shared transport line discipline +# +# CONFIG_TI_ST is not set +# CONFIG_SENSORS_LIS3_SPI is not set +# CONFIG_SENSORS_LIS3_I2C is not set + +# +# Altera FPGA firmware download module +# +# CONFIG_ALTERA_STAPL is not set + +# +# Intel MIC Host Driver +# + +# +# Intel MIC Card Driver +# + +# +# SCSI device support +# +CONFIG_SCSI_MOD=y +# CONFIG_RAID_ATTRS is not set +CONFIG_SCSI=y +CONFIG_SCSI_DMA=y +# CONFIG_SCSI_TGT is not set +# CONFIG_SCSI_NETLINK is not set +# CONFIG_SCSI_PROC_FS is not set + +# +# SCSI support type (disk, tape, CD-ROM) +# +CONFIG_BLK_DEV_SD=y +# CONFIG_CHR_DEV_ST is not set +# CONFIG_CHR_DEV_OSST is not set +CONFIG_BLK_DEV_SR=y +# CONFIG_BLK_DEV_SR_VENDOR is not set +# CONFIG_CHR_DEV_SG is not set +# CONFIG_CHR_DEV_SCH is not set +CONFIG_SCSI_MULTI_LUN=y +# CONFIG_SCSI_CONSTANTS is not set +# CONFIG_SCSI_LOGGING is not set +# CONFIG_SCSI_SCAN_ASYNC is not set + +# +# SCSI Transports +# +# CONFIG_SCSI_SPI_ATTRS is not set +# CONFIG_SCSI_FC_ATTRS is not set +CONFIG_SCSI_ISCSI_ATTRS=y +# CONFIG_SCSI_SAS_ATTRS is not set +# CONFIG_SCSI_SAS_LIBSAS is not set +# CONFIG_SCSI_SRP_ATTRS is not set +CONFIG_SCSI_LOWLEVEL=y +CONFIG_ISCSI_TCP=y +CONFIG_ISCSI_BOOT_SYSFS=y +# CONFIG_SCSI_UFSHCD is not set +# CONFIG_LIBFC is not set +# CONFIG_LIBFCOE is not set +# CONFIG_SCSI_DEBUG is not set +# CONFIG_SCSI_LOWLEVEL_PCMCIA is not set +# CONFIG_SCSI_DH is not set +# CONFIG_SCSI_OSD_INITIATOR is not set +CONFIG_HAVE_PATA_PLATFORM=y +# CONFIG_ATA is not set +# CONFIG_MD is not set +# CONFIG_TARGET_CORE is not set +CONFIG_NETDEVICES=y +CONFIG_MII=y +CONFIG_NET_CORE=y +# CONFIG_BONDING is not set +# CONFIG_DUMMY is not set +# CONFIG_EQUALIZER is not set +# CONFIG_NET_TEAM is not set +# CONFIG_MACVLAN is not set +# CONFIG_VXLAN is not set +CONFIG_NETCONSOLE=y +CONFIG_NETPOLL=y +# CONFIG_NETPOLL_TRAP is not set +CONFIG_NET_POLL_CONTROLLER=y +CONFIG_TUN=y +# CONFIG_VETH is not set +CONFIG_NLMON=m + +# +# CAIF transport drivers +# + +# +# Distributed Switch Architecture drivers +# +# CONFIG_NET_DSA_MV88E6XXX is not set +# CONFIG_NET_DSA_MV88E6060 is not set +# CONFIG_NET_DSA_MV88E6XXX_NEED_PPU is not set +# CONFIG_NET_DSA_MV88E6131 is not set +# CONFIG_NET_DSA_MV88E6123_61_65 is not set +CONFIG_ETHERNET=y +CONFIG_NET_VENDOR_ARC=y +# CONFIG_ARC_EMAC is not set +# CONFIG_NET_CADENCE is not set +# CONFIG_NET_VENDOR_BROADCOM is not set +# CONFIG_NET_CALXEDA_XGMAC is not set +# CONFIG_DNET is not set +# CONFIG_NET_VENDOR_INTEL is not set +# CONFIG_NET_VENDOR_MARVELL is not set +# CONFIG_NET_VENDOR_MICREL is not set +# CONFIG_NET_VENDOR_MICROCHIP is not set +# CONFIG_NET_VENDOR_NATSEMI is not set +# CONFIG_ETHOC is not set +# CONFIG_SH_ETH is not set +# CONFIG_NET_VENDOR_SEEQ is not set +# CONFIG_NET_VENDOR_SMSC is not set +CONFIG_NET_VENDOR_STMICRO=y +CONFIG_STMMAC_ETH=y +CONFIG_STMMAC_PLATFORM=y +CONFIG_DWMAC_MESON=y +CONFIG_STMMAC_DEBUG_FS=y +CONFIG_STMMAC_DA=y +CONFIG_NET_VENDOR_VIA=y +CONFIG_NET_VENDOR_WIZNET=y +# CONFIG_WIZNET_W5100 is not set +# CONFIG_WIZNET_W5300 is not set + +# +# MII PHY device drivers +# +# CONFIG_AT803X_PHY is not set +# CONFIG_AMD_PHY is not set +# CONFIG_MARVELL_PHY is not set +# CONFIG_DAVICOM_PHY is not set +# CONFIG_QSEMI_PHY is not set +# CONFIG_LXT_PHY is not set +# CONFIG_CICADA_PHY is not set +# CONFIG_VITESSE_PHY is not set +# CONFIG_SMSC_PHY is not set +# CONFIG_BROADCOM_PHY is not set +# CONFIG_BCM87XX_PHY is not set +# CONFIG_ICPLUS_PHY is not set +# CONFIG_REALTEK_PHY is not set +# CONFIG_NATIONAL_PHY is not set +# CONFIG_STE10XP is not set +# CONFIG_LSI_ET1011C_PHY is not set +# CONFIG_MICREL_PHY is not set +# CONFIG_FIXED_PHY is not set +# CONFIG_MDIO_BITBANG is not set +# CONFIG_MDIO_BUS_MUX_GPIO is not set +# CONFIG_MDIO_BUS_MUX_MMIOREG is not set +# CONFIG_MICREL_KS8995MA is not set +CONFIG_PPP=y +CONFIG_PPP_BSDCOMP=m +CONFIG_PPP_DEFLATE=m +# CONFIG_PPP_FILTER is not set +CONFIG_PPP_MPPE=m +# CONFIG_PPP_MULTILINK is not set +CONFIG_PPPOE=m +CONFIG_PPPOLAC=y +CONFIG_PPPOPNS=y +CONFIG_PPP_ASYNC=m +# CONFIG_PPP_SYNC_TTY is not set +# CONFIG_SLIP is not set +CONFIG_SLHC=y + +# +# USB Network Adapters +# +# CONFIG_USB_CATC is not set +# CONFIG_USB_KAWETH is not set +# CONFIG_USB_PEGASUS is not set +# CONFIG_USB_RTL8150 is not set +CONFIG_USB_RTL8152=m +CONFIG_USB_USBNET=y +CONFIG_USB_NET_AX8817X=m +CONFIG_USB_NET_AX88179_178A=m +CONFIG_USB_NET_CDCETHER=m +# CONFIG_USB_NET_CDC_EEM is not set +# CONFIG_USB_NET_CDC_NCM is not set +# CONFIG_USB_NET_HUAWEI_CDC_NCM is not set +# CONFIG_USB_NET_CDC_MBIM is not set +CONFIG_USB_NET_DM9601=m +CONFIG_USB_NET_SR9700=m +CONFIG_USB_NET_SR9800=m +CONFIG_USB_NET_SMSC75XX=m +CONFIG_USB_NET_SMSC95XX=y +# CONFIG_USB_NET_GL620A is not set +# CONFIG_USB_NET_NET1080 is not set +# CONFIG_USB_NET_PLUSB is not set +CONFIG_USB_NET_MCS7830=m +CONFIG_USB_NET_RNDIS_HOST=m +# CONFIG_USB_NET_CDC_SUBSET is not set +# CONFIG_USB_NET_ZAURUS is not set +# CONFIG_USB_NET_CX82310_ETH is not set +# CONFIG_USB_NET_KALMIA is not set +# CONFIG_USB_NET_QMI_WWAN is not set +# CONFIG_USB_NET_INT51X1 is not set +# CONFIG_USB_IPHETH is not set +# CONFIG_USB_SIERRA_NET is not set +# CONFIG_USB_VL600 is not set +CONFIG_WLAN=y +# CONFIG_LIBERTAS_THINFIRM is not set +# CONFIG_AT76C50X_USB is not set +CONFIG_USB_ZD1201=m +CONFIG_USB_NET_RNDIS_WLAN=m +CONFIG_RTL8187=m +CONFIG_RTL8187_LEDS=y +# CONFIG_MAC80211_HWSIM is not set +# CONFIG_WIFI_CONTROL_FUNC is not set +CONFIG_ATH_COMMON=m +CONFIG_ATH_CARDS=m +# CONFIG_ATH_DEBUG is not set +CONFIG_ATH9K_HW=m +CONFIG_ATH9K_COMMON=m +CONFIG_ATH9K_BTCOEX_SUPPORT=y +CONFIG_ATH9K=m +CONFIG_ATH9K_AHB=y +# CONFIG_ATH9K_DEBUGFS is not set +# CONFIG_ATH9K_WOW is not set +# CONFIG_ATH9K_LEGACY_RATE_CONTROL is not set +CONFIG_ATH9K_HTC=m +# CONFIG_ATH9K_HTC_DEBUGFS is not set +CONFIG_CARL9170=m +CONFIG_CARL9170_LEDS=y +CONFIG_CARL9170_WPC=y +CONFIG_CARL9170_HWRNG=y +CONFIG_ATH6KL=m +# CONFIG_ATH6KL_SDIO is not set +CONFIG_ATH6KL_USB=m +# CONFIG_ATH6KL_DEBUG is not set +# CONFIG_ATH6KL_TRACING is not set +CONFIG_AR5523=m +# CONFIG_ATH10K is not set +# CONFIG_WCN36XX is not set +CONFIG_B43=m +CONFIG_B43_SSB=y +# CONFIG_B43_SDIO is not set +CONFIG_B43_PIO=y +CONFIG_B43_PHY_N=y +CONFIG_B43_PHY_LP=y +CONFIG_B43_LEDS=y +CONFIG_B43_HWRNG=y +# CONFIG_B43_DEBUG is not set +# CONFIG_B43LEGACY is not set +CONFIG_BRCMUTIL=m +# CONFIG_BRCMSMAC is not set +CONFIG_BRCMFMAC=m +# CONFIG_BRCMFMAC_SDIO is not set +CONFIG_BRCMFMAC_USB=y +# CONFIG_BRCM_TRACING is not set +# CONFIG_BRCMDBG is not set +# CONFIG_HOSTAP is not set +# CONFIG_LIBERTAS is not set +CONFIG_P54_COMMON=m +CONFIG_P54_USB=m +# CONFIG_P54_SPI is not set +CONFIG_P54_LEDS=y +CONFIG_RT2X00=m +CONFIG_RT2500USB=m +CONFIG_RT73USB=m +CONFIG_RT2800USB=m +CONFIG_RT2800USB_RT33XX=y +CONFIG_RT2800USB_RT35XX=y +CONFIG_RT2800USB_RT3573=y +CONFIG_RT2800USB_RT53XX=y +CONFIG_RT2800USB_RT55XX=y +CONFIG_RT2800USB_UNKNOWN=y +CONFIG_RT2800_LIB=m +CONFIG_RT2X00_LIB_USB=m +CONFIG_RT2X00_LIB=m +CONFIG_RT2X00_LIB_FIRMWARE=y +CONFIG_RT2X00_LIB_CRYPTO=y +CONFIG_RT2X00_LIB_LEDS=y +# CONFIG_RT2X00_DEBUG is not set +# CONFIG_WL_TI is not set +CONFIG_ZD1211RW=m +# CONFIG_ZD1211RW_DEBUG is not set +# CONFIG_MWIFIEX is not set +# CONFIG_CW1200 is not set +# CONFIG_RTL8821AU is not set +# CONFIG_RTL8192CU is not set + +# +# Enable WiMAX (Networking options) to see the WiMAX drivers +# +# CONFIG_WAN is not set +# CONFIG_ISDN is not set + +# +# Input device support +# +CONFIG_INPUT=y +CONFIG_INPUT_FF_MEMLESS=y +# CONFIG_INPUT_POLLDEV is not set +# CONFIG_INPUT_SPARSEKMAP is not set +# CONFIG_INPUT_MATRIXKMAP is not set + +# +# Userland interfaces +# +CONFIG_INPUT_MOUSEDEV=y +# CONFIG_INPUT_MOUSEDEV_PSAUX is not set +CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 +CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 +CONFIG_INPUT_JOYDEV=y +CONFIG_INPUT_EVDEV=y +# CONFIG_INPUT_EVBUG is not set +# CONFIG_INPUT_KEYRESET is not set +# CONFIG_INPUT_KEYCOMBO is not set + +# +# Input Device Drivers +# +# CONFIG_INPUT_KEYBOARD is not set +# CONFIG_INPUT_MOUSE is not set +CONFIG_INPUT_JOYSTICK=y +# CONFIG_JOYSTICK_ANALOG is not set +# CONFIG_JOYSTICK_A3D is not set +# CONFIG_JOYSTICK_ADI is not set +# CONFIG_JOYSTICK_COBRA is not set +# CONFIG_JOYSTICK_GF2K is not set +# CONFIG_JOYSTICK_GRIP is not set +# CONFIG_JOYSTICK_GRIP_MP is not set +# CONFIG_JOYSTICK_GUILLEMOT is not set +# CONFIG_JOYSTICK_INTERACT is not set +# CONFIG_JOYSTICK_SIDEWINDER is not set +# CONFIG_JOYSTICK_TMDC is not set +# CONFIG_JOYSTICK_IFORCE is not set +# CONFIG_JOYSTICK_WARRIOR is not set +# CONFIG_JOYSTICK_MAGELLAN is not set +# CONFIG_JOYSTICK_SPACEORB is not set +# CONFIG_JOYSTICK_SPACEBALL is not set +# CONFIG_JOYSTICK_STINGER is not set +# CONFIG_JOYSTICK_TWIDJOY is not set +# CONFIG_JOYSTICK_ZHENHUA is not set +# CONFIG_JOYSTICK_AS5011 is not set +# CONFIG_JOYSTICK_JOYDUMP is not set +CONFIG_JOYSTICK_XPAD=m +CONFIG_JOYSTICK_XPAD_FF=y +CONFIG_JOYSTICK_XPAD_LEDS=y +# CONFIG_INPUT_TABLET is not set +# CONFIG_INPUT_TOUCHSCREEN is not set +CONFIG_INPUT_MISC=y +# CONFIG_INPUT_AD714X is not set +# CONFIG_INPUT_BMA150 is not set +# CONFIG_INPUT_MMA8450 is not set +# CONFIG_INPUT_MPU3050 is not set +# CONFIG_INPUT_GP2A is not set +# CONFIG_INPUT_GPIO_BEEPER is not set +# CONFIG_INPUT_GPIO_TILT_POLLED is not set +# CONFIG_INPUT_ATI_REMOTE2 is not set +# CONFIG_INPUT_KEYCHORD is not set +# CONFIG_INPUT_KEYSPAN_REMOTE is not set +# CONFIG_INPUT_KXTJ9 is not set +# CONFIG_INPUT_POWERMATE is not set +# CONFIG_INPUT_YEALINK is not set +# CONFIG_INPUT_CM109 is not set +CONFIG_INPUT_UINPUT=y +# CONFIG_INPUT_GPIO is not set +# CONFIG_INPUT_PCF8574 is not set +# CONFIG_INPUT_GPIO_ROTARY_ENCODER is not set +# CONFIG_INPUT_ADXL34X is not set +# CONFIG_INPUT_IMS_PCU is not set +# CONFIG_INPUT_CMA3000 is not set + +# +# Hardware I/O ports +# +# CONFIG_SERIO is not set +# CONFIG_GAMEPORT is not set + +# +# Character devices +# +CONFIG_TTY=y +CONFIG_VT=y +CONFIG_CONSOLE_TRANSLATIONS=y +CONFIG_VT_CONSOLE=y +CONFIG_VT_CONSOLE_SLEEP=y +CONFIG_HW_CONSOLE=y +CONFIG_VT_HW_CONSOLE_BINDING=y +CONFIG_UNIX98_PTYS=y +# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set +CONFIG_LEGACY_PTYS=y +CONFIG_LEGACY_PTY_COUNT=256 +# CONFIG_SERIAL_NONSTANDARD is not set +# CONFIG_N_GSM is not set +# CONFIG_TRACE_SINK is not set +CONFIG_DEVMEM=y +CONFIG_DEVKMEM=y + +# +# Serial drivers +# +# CONFIG_SERIAL_8250 is not set + +# +# Non-8250 serial port support +# +# CONFIG_SERIAL_AMBA_PL010 is not set +# CONFIG_SERIAL_AMBA_PL011 is not set +# CONFIG_SERIAL_MAX3100 is not set +# CONFIG_SERIAL_MAX310X is not set +CONFIG_SERIAL_CORE=y +CONFIG_SERIAL_CORE_CONSOLE=y +# CONFIG_SERIAL_SCCNXP is not set +# CONFIG_SERIAL_TIMBERDALE is not set +# CONFIG_SERIAL_ALTERA_JTAGUART is not set +# CONFIG_SERIAL_ALTERA_UART is not set +# CONFIG_SERIAL_IFX6X60 is not set +# CONFIG_SERIAL_XILINX_PS_UART is not set +# CONFIG_SERIAL_ARC is not set +# CONFIG_SERIAL_FSL_LPUART is not set +CONFIG_TTY_PRINTK=y +# CONFIG_IPMI_HANDLER is not set +CONFIG_HW_RANDOM=y +# CONFIG_HW_RANDOM_TIMERIOMEM is not set +# CONFIG_HW_RANDOM_ATMEL is not set +CONFIG_HW_RANDOM_MESON=y +# CONFIG_HW_RANDOM_EXYNOS is not set +# CONFIG_R3964 is not set + +# +# PCMCIA character devices +# +# CONFIG_RAW_DRIVER is not set +# CONFIG_TCG_TPM is not set +CONFIG_I2C=y +CONFIG_I2C_BOARDINFO=y +CONFIG_I2C_COMPAT=y +CONFIG_I2C_CHARDEV=y +CONFIG_I2C_MUX=y + +# +# Multiplexer I2C Chip support +# +# CONFIG_I2C_ARB_GPIO_CHALLENGE is not set +# CONFIG_I2C_MUX_GPIO is not set +# CONFIG_I2C_MUX_PCA9541 is not set +# CONFIG_I2C_MUX_PCA954x is not set +# CONFIG_I2C_MUX_PINCTRL is not set +CONFIG_I2C_HELPER_AUTO=y +CONFIG_I2C_ALGOBIT=y + +# +# I2C Hardware Bus support +# + +# +# I2C system bus drivers (mostly embedded / system-on-chip) +# +# CONFIG_I2C_CBUS_GPIO is not set +# CONFIG_I2C_DESIGNWARE_PLATFORM is not set +# CONFIG_I2C_GPIO is not set +# CONFIG_I2C_NOMADIK is not set +# CONFIG_I2C_OCORES is not set +# CONFIG_I2C_PCA_PLATFORM is not set +# CONFIG_I2C_PXA_PCI is not set +# CONFIG_I2C_SIMTEC is not set +# CONFIG_I2C_XILINX is not set + +# +# External I2C/SMBus adapter drivers +# +# CONFIG_I2C_DIOLAN_U2C is not set +# CONFIG_I2C_PARPORT_LIGHT is not set +# CONFIG_I2C_ROBOTFUZZ_OSIF is not set +# CONFIG_I2C_TAOS_EVM is not set +# CONFIG_I2C_TINY_USB is not set + +# +# Other I2C/SMBus bus drivers +# +# CONFIG_I2C_STUB is not set +# CONFIG_I2C_DEBUG_CORE is not set +# CONFIG_I2C_DEBUG_ALGO is not set +# CONFIG_I2C_DEBUG_BUS is not set +CONFIG_SPI=y +# CONFIG_SPI_DEBUG is not set +CONFIG_SPI_MASTER=y + +# +# SPI Master Controller Drivers +# +# CONFIG_SPI_ALTERA is not set +CONFIG_SPI_BITBANG=y +CONFIG_SPI_GPIO=y +# CONFIG_SPI_FSL_SPI is not set +# CONFIG_SPI_OC_TINY is not set +# CONFIG_SPI_PL022 is not set +# CONFIG_SPI_PXA2XX_PCI is not set +# CONFIG_SPI_SC18IS602 is not set +# CONFIG_SPI_XCOMM is not set +# CONFIG_SPI_XILINX is not set +# CONFIG_SPI_DESIGNWARE is not set + +# +# SPI Protocol Masters +# +CONFIG_SPI_SPIDEV=y +# CONFIG_SPI_TLE62X0 is not set +# CONFIG_HSI is not set + +# +# PPS support +# +CONFIG_PPS=y +# CONFIG_PPS_DEBUG is not set + +# +# PPS clients support +# +# CONFIG_PPS_CLIENT_KTIMER is not set +# CONFIG_PPS_CLIENT_LDISC is not set +# CONFIG_PPS_CLIENT_GPIO is not set + +# +# PPS generators support +# + +# +# PTP clock support +# +CONFIG_PTP_1588_CLOCK=y + +# +# Enable PHYLIB and NETWORK_PHY_TIMESTAMPING to see the additional clocks. +# +CONFIG_PINCTRL=y + +# +# Pin controllers +# +CONFIG_PINMUX=y +CONFIG_PINCONF=y +# CONFIG_DEBUG_PINCTRL is not set +# CONFIG_PINCTRL_CAPRI is not set +# CONFIG_PINCTRL_MSM8X74 is not set +# CONFIG_PINCTRL_SINGLE is not set +CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y +CONFIG_ARCH_REQUIRE_GPIOLIB=y +CONFIG_GPIOLIB=y +CONFIG_GPIO_DEVRES=y +CONFIG_OF_GPIO=y +# CONFIG_DEBUG_GPIO is not set +CONFIG_GPIO_SYSFS=y + +# +# Memory mapped GPIO drivers: +# +# CONFIG_GPIO_GENERIC_PLATFORM is not set +# CONFIG_GPIO_PL061 is not set +# CONFIG_GPIO_SCH311X is not set +# CONFIG_GPIO_TS5500 is not set +# CONFIG_GPIO_GRGPIO is not set + +# +# I2C GPIO expanders: +# +# CONFIG_GPIO_MAX7300 is not set +# CONFIG_GPIO_MAX732X is not set +# CONFIG_GPIO_PCA953X is not set +# CONFIG_GPIO_PCF857X is not set +# CONFIG_GPIO_SX150X is not set +# CONFIG_GPIO_ADP5588 is not set +# CONFIG_GPIO_ADNP is not set + +# +# PCI GPIO expanders: +# + +# +# SPI GPIO expanders: +# +# CONFIG_GPIO_MAX7301 is not set +# CONFIG_GPIO_MCP23S08 is not set +# CONFIG_GPIO_MC33880 is not set +# CONFIG_GPIO_74X164 is not set + +# +# AC97 GPIO expanders: +# + +# +# LPC GPIO expanders: +# + +# +# MODULbus GPIO expanders: +# +# CONFIG_GPIO_BCM_KONA is not set + +# +# USB GPIO expanders: +# +# CONFIG_W1 is not set +CONFIG_POWER_SUPPLY=y +# CONFIG_POWER_SUPPLY_DEBUG is not set +# CONFIG_PDA_POWER is not set +# CONFIG_TEST_POWER is not set +# CONFIG_BATTERY_DS2780 is not set +# CONFIG_BATTERY_DS2781 is not set +# CONFIG_BATTERY_DS2782 is not set +# CONFIG_BATTERY_SBS is not set +# CONFIG_BATTERY_BQ27x00 is not set +# CONFIG_BATTERY_MAX17040 is not set +# CONFIG_BATTERY_MAX17042 is not set +# CONFIG_CHARGER_ISP1704 is not set +# CONFIG_CHARGER_MAX8903 is not set +# CONFIG_CHARGER_LP8727 is not set +# CONFIG_CHARGER_GPIO is not set +# CONFIG_CHARGER_MANAGER is not set +# CONFIG_CHARGER_BQ2415X is not set +# CONFIG_CHARGER_BQ24190 is not set +# CONFIG_CHARGER_BQ24735 is not set +# CONFIG_CHARGER_SMB347 is not set +CONFIG_POWER_RESET=y +# CONFIG_POWER_RESET_GPIO is not set +CONFIG_POWER_RESET_VEXPRESS=y +# CONFIG_POWER_RESET_XGENE is not set +# CONFIG_POWER_AVS is not set +CONFIG_HWMON=y +# CONFIG_HWMON_VID is not set +# CONFIG_HWMON_DEBUG_CHIP is not set + +# +# Native drivers +# +# CONFIG_SENSORS_AD7314 is not set +# CONFIG_SENSORS_AD7414 is not set +# CONFIG_SENSORS_AD7418 is not set +# CONFIG_SENSORS_ADCXX is not set +# CONFIG_SENSORS_ADM1021 is not set +# CONFIG_SENSORS_ADM1025 is not set +# CONFIG_SENSORS_ADM1026 is not set +# CONFIG_SENSORS_ADM1029 is not set +# CONFIG_SENSORS_ADM1031 is not set +# CONFIG_SENSORS_ADM9240 is not set +# CONFIG_SENSORS_ADT7310 is not set +# CONFIG_SENSORS_ADT7410 is not set +# CONFIG_SENSORS_ADT7411 is not set +# CONFIG_SENSORS_ADT7462 is not set +# CONFIG_SENSORS_ADT7470 is not set +# CONFIG_SENSORS_ADT7475 is not set +# CONFIG_SENSORS_ASC7621 is not set +# CONFIG_SENSORS_ATXP1 is not set +# CONFIG_SENSORS_DS620 is not set +# CONFIG_SENSORS_DS1621 is not set +# CONFIG_SENSORS_F71805F is not set +# CONFIG_SENSORS_F71882FG is not set +# CONFIG_SENSORS_F75375S is not set +# CONFIG_SENSORS_G760A is not set +# CONFIG_SENSORS_G762 is not set +# CONFIG_SENSORS_GL518SM is not set +# CONFIG_SENSORS_GL520SM is not set +# CONFIG_SENSORS_GPIO_FAN is not set +# CONFIG_SENSORS_HIH6130 is not set +# CONFIG_SENSORS_HTU21 is not set +# CONFIG_SENSORS_IT87 is not set +# CONFIG_SENSORS_JC42 is not set +# CONFIG_SENSORS_LINEAGE is not set +# CONFIG_SENSORS_LM63 is not set +# CONFIG_SENSORS_LM70 is not set +# CONFIG_SENSORS_LM73 is not set +# CONFIG_SENSORS_LM75 is not set +# CONFIG_SENSORS_LM77 is not set +# CONFIG_SENSORS_LM78 is not set +# CONFIG_SENSORS_LM80 is not set +# CONFIG_SENSORS_LM83 is not set +# CONFIG_SENSORS_LM85 is not set +# CONFIG_SENSORS_LM87 is not set +# CONFIG_SENSORS_LM90 is not set +# CONFIG_SENSORS_LM92 is not set +# CONFIG_SENSORS_LM93 is not set +# CONFIG_SENSORS_LTC4151 is not set +# CONFIG_SENSORS_LTC4215 is not set +# CONFIG_SENSORS_LTC4245 is not set +# CONFIG_SENSORS_LTC4261 is not set +# CONFIG_SENSORS_LM95234 is not set +# CONFIG_SENSORS_LM95241 is not set +# CONFIG_SENSORS_LM95245 is not set +# CONFIG_SENSORS_MAX1111 is not set +# CONFIG_SENSORS_MAX16065 is not set +# CONFIG_SENSORS_MAX1619 is not set +# CONFIG_SENSORS_MAX1668 is not set +# CONFIG_SENSORS_MAX197 is not set +# CONFIG_SENSORS_MAX6639 is not set +# CONFIG_SENSORS_MAX6642 is not set +# CONFIG_SENSORS_MAX6650 is not set +# CONFIG_SENSORS_MAX6697 is not set +# CONFIG_SENSORS_MCP3021 is not set +# CONFIG_SENSORS_NCT6775 is not set +# CONFIG_SENSORS_NTC_THERMISTOR is not set +# CONFIG_SENSORS_PC87360 is not set +# CONFIG_SENSORS_PC87427 is not set +# CONFIG_SENSORS_PCF8591 is not set +# CONFIG_PMBUS is not set +# CONFIG_SENSORS_SHT15 is not set +# CONFIG_SENSORS_SHT21 is not set +# CONFIG_SENSORS_SMM665 is not set +# CONFIG_SENSORS_DME1737 is not set +# CONFIG_SENSORS_EMC1403 is not set +# CONFIG_SENSORS_EMC2103 is not set +# CONFIG_SENSORS_EMC6W201 is not set +# CONFIG_SENSORS_SMSC47M1 is not set +# CONFIG_SENSORS_SMSC47M192 is not set +# CONFIG_SENSORS_SMSC47B397 is not set +# CONFIG_SENSORS_SCH56XX_COMMON is not set +# CONFIG_SENSORS_ADS1015 is not set +# CONFIG_SENSORS_ADS7828 is not set +# CONFIG_SENSORS_ADS7871 is not set +# CONFIG_SENSORS_AMC6821 is not set +# CONFIG_SENSORS_INA209 is not set +# CONFIG_SENSORS_INA2XX is not set +# CONFIG_SENSORS_THMC50 is not set +# CONFIG_SENSORS_TMP102 is not set +# CONFIG_SENSORS_TMP401 is not set +# CONFIG_SENSORS_TMP421 is not set +# CONFIG_SENSORS_VEXPRESS is not set +# CONFIG_SENSORS_VT1211 is not set +# CONFIG_SENSORS_W83781D is not set +# CONFIG_SENSORS_W83791D is not set +# CONFIG_SENSORS_W83792D is not set +# CONFIG_SENSORS_W83793 is not set +# CONFIG_SENSORS_W83795 is not set +# CONFIG_SENSORS_W83L785TS is not set +# CONFIG_SENSORS_W83L786NG is not set +# CONFIG_SENSORS_W83627HF is not set +# CONFIG_SENSORS_W83627EHF is not set +CONFIG_THERMAL=y +CONFIG_THERMAL_HWMON=y +CONFIG_THERMAL_OF=y +CONFIG_THERMAL_WRITABLE_TRIPS=y +CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE=y +# CONFIG_THERMAL_DEFAULT_GOV_FAIR_SHARE is not set +# CONFIG_THERMAL_DEFAULT_GOV_USER_SPACE is not set +# CONFIG_THERMAL_DEFAULT_GOV_POWER_ALLOCATOR is not set +# CONFIG_THERMAL_GOV_FAIR_SHARE is not set +CONFIG_THERMAL_GOV_STEP_WISE=y +# CONFIG_THERMAL_GOV_USER_SPACE is not set +CONFIG_THERMAL_GOV_POWER_ALLOCATOR=y +CONFIG_CPU_THERMAL=y +CONFIG_CPUCORE_THERMAL=y +CONFIG_GPU_THERMAL=y +CONFIG_GPUCORE_THERMAL=y +# CONFIG_THERMAL_EMULATION is not set + +# +# Texas Instruments thermal drivers +# +# CONFIG_WATCHDOG is not set +CONFIG_SSB_POSSIBLE=y + +# +# Sonics Silicon Backplane +# +CONFIG_SSB=m +CONFIG_SSB_BLOCKIO=y +CONFIG_SSB_SDIOHOST_POSSIBLE=y +# CONFIG_SSB_SDIOHOST is not set +# CONFIG_SSB_SILENT is not set +# CONFIG_SSB_DEBUG is not set +# CONFIG_SSB_DRIVER_GPIO is not set +CONFIG_BCMA_POSSIBLE=y + +# +# Broadcom specific AMBA +# +# CONFIG_BCMA is not set + +# +# Multifunction device drivers +# +# CONFIG_MFD_CORE is not set +# CONFIG_MFD_AS3711 is not set +# CONFIG_MFD_AS3722 is not set +# CONFIG_PMIC_ADP5520 is not set +# CONFIG_MFD_AAT2870_CORE is not set +# CONFIG_MFD_CROS_EC is not set +# CONFIG_PMIC_DA903X is not set +# CONFIG_MFD_DA9052_SPI is not set +# CONFIG_MFD_DA9052_I2C is not set +# CONFIG_MFD_DA9055 is not set +# CONFIG_MFD_DA9063 is not set +# CONFIG_MFD_MC13XXX_SPI is not set +# CONFIG_MFD_MC13XXX_I2C is not set +# CONFIG_HTC_PASIC3 is not set +# CONFIG_HTC_I2CPLD is not set +# CONFIG_MFD_KEMPLD is not set +# CONFIG_MFD_88PM800 is not set +# CONFIG_MFD_88PM805 is not set +# CONFIG_MFD_88PM860X is not set +# CONFIG_MFD_MAX14577 is not set +# CONFIG_MFD_MAX77686 is not set +# CONFIG_MFD_MAX77693 is not set +# CONFIG_MFD_MAX8907 is not set +# CONFIG_MFD_MAX8925 is not set +# CONFIG_MFD_MAX8997 is not set +# CONFIG_MFD_MAX8998 is not set +# CONFIG_EZX_PCAP is not set +# CONFIG_MFD_VIPERBOARD is not set +# CONFIG_MFD_RETU is not set +# CONFIG_MFD_PCF50633 is not set +# CONFIG_MFD_RC5T583 is not set +# CONFIG_MFD_SEC_CORE is not set +# CONFIG_MFD_SI476X_CORE is not set +# CONFIG_MFD_SM501 is not set +# CONFIG_MFD_SMSC is not set +# CONFIG_ABX500_CORE is not set +# CONFIG_MFD_STMPE is not set +# CONFIG_MFD_SYSCON is not set +# CONFIG_MFD_TI_AM335X_TSCADC is not set +# CONFIG_MFD_LP3943 is not set +# CONFIG_MFD_LP8788 is not set +# CONFIG_MFD_PALMAS is not set +# CONFIG_TPS6105X is not set +# CONFIG_TPS65010 is not set +# CONFIG_TPS6507X is not set +# CONFIG_MFD_TPS65090 is not set +# CONFIG_MFD_TPS65217 is not set +# CONFIG_MFD_TPS6586X is not set +# CONFIG_MFD_TPS65910 is not set +# CONFIG_MFD_TPS65912 is not set +# CONFIG_MFD_TPS65912_I2C is not set +# CONFIG_MFD_TPS65912_SPI is not set +# CONFIG_MFD_TPS80031 is not set +# CONFIG_TWL4030_CORE is not set +# CONFIG_TWL6040_CORE is not set +# CONFIG_MFD_WL1273_CORE is not set +# CONFIG_MFD_LM3533 is not set +# CONFIG_MFD_TC3589X is not set +# CONFIG_MFD_TMIO is not set +# CONFIG_MFD_ARIZONA_I2C is not set +# CONFIG_MFD_ARIZONA_SPI is not set +# CONFIG_MFD_WM8400 is not set +# CONFIG_MFD_WM831X_I2C is not set +# CONFIG_MFD_WM831X_SPI is not set +# CONFIG_MFD_WM8350_I2C is not set +# CONFIG_MFD_WM8994 is not set +CONFIG_VEXPRESS_CONFIG=y +CONFIG_REGULATOR=y +# CONFIG_REGULATOR_DEBUG is not set +# CONFIG_REGULATOR_FIXED_VOLTAGE is not set +# CONFIG_REGULATOR_VIRTUAL_CONSUMER is not set +# CONFIG_REGULATOR_USERSPACE_CONSUMER is not set +# CONFIG_REGULATOR_ACT8865 is not set +# CONFIG_REGULATOR_AD5398 is not set +# CONFIG_REGULATOR_DA9210 is not set +# CONFIG_REGULATOR_FAN53555 is not set +# CONFIG_REGULATOR_GPIO is not set +# CONFIG_REGULATOR_ISL6271A is not set +# CONFIG_REGULATOR_LP3971 is not set +# CONFIG_REGULATOR_LP3972 is not set +# CONFIG_REGULATOR_LP872X is not set +# CONFIG_REGULATOR_LP8755 is not set +# CONFIG_REGULATOR_MAX1586 is not set +# CONFIG_REGULATOR_MAX8649 is not set +# CONFIG_REGULATOR_MAX8660 is not set +# CONFIG_REGULATOR_MAX8952 is not set +# CONFIG_REGULATOR_MAX8973 is not set +# CONFIG_REGULATOR_PFUZE100 is not set +# CONFIG_REGULATOR_TPS51632 is not set +# CONFIG_REGULATOR_TPS62360 is not set +# CONFIG_REGULATOR_TPS65023 is not set +# CONFIG_REGULATOR_TPS6507X is not set +# CONFIG_REGULATOR_TPS6524X is not set +# CONFIG_REGULATOR_VEXPRESS is not set +CONFIG_MEDIA_SUPPORT=y + +# +# Multimedia core support +# +CONFIG_MEDIA_CAMERA_SUPPORT=y +CONFIG_MEDIA_ANALOG_TV_SUPPORT=y +CONFIG_MEDIA_DIGITAL_TV_SUPPORT=y +CONFIG_MEDIA_RADIO_SUPPORT=y +CONFIG_MEDIA_RC_SUPPORT=y +# CONFIG_MEDIA_CONTROLLER is not set +CONFIG_VIDEO_DEV=y +CONFIG_VIDEO_V4L2=y +# CONFIG_VIDEO_ADV_DEBUG is not set +# CONFIG_VIDEO_FIXED_MINOR_RANGES is not set +CONFIG_VIDEO_TUNER=m +CONFIG_VIDEOBUF_GEN=y +CONFIG_VIDEOBUF_VMALLOC=m +CONFIG_VIDEOBUF_RESOURCE=y +CONFIG_VIDEOBUF_DVB=m +CONFIG_VIDEOBUF2_CORE=y +CONFIG_VIDEOBUF2_MEMOPS=y +CONFIG_DVB_CORE=y +CONFIG_DVB_NET=y +CONFIG_TTPCI_EEPROM=m +CONFIG_DVB_MAX_ADAPTERS=8 +# CONFIG_DVB_DYNAMIC_MINORS is not set + +# +# Media drivers +# +CONFIG_RC_CORE=y +CONFIG_RC_MAP=m +CONFIG_RC_DECODERS=y +CONFIG_LIRC=m +CONFIG_IR_LIRC_CODEC=m +CONFIG_IR_NEC_DECODER=m +CONFIG_IR_RC5_DECODER=m +CONFIG_IR_RC6_DECODER=m +CONFIG_IR_JVC_DECODER=m +CONFIG_IR_SONY_DECODER=m +CONFIG_IR_RC5_SZ_DECODER=m +CONFIG_IR_SANYO_DECODER=m +CONFIG_IR_MCE_KBD_DECODER=m +CONFIG_RC_DEVICES=y +CONFIG_RC_ATI_REMOTE=m +CONFIG_IR_IMON=m +CONFIG_IR_MCEUSB=m +CONFIG_IR_MESON=m +CONFIG_IR_REDRAT3=m +CONFIG_IR_STREAMZAP=m +CONFIG_IR_IGUANA=m +CONFIG_IR_TTUSBIR=m +# CONFIG_RC_LOOPBACK is not set +CONFIG_IR_GPIO_CIR=m +CONFIG_MEDIA_USB_SUPPORT=y + +# +# Webcam devices +# +# CONFIG_USB_VIDEO_CLASS is not set +# CONFIG_USB_GSPCA is not set +# CONFIG_USB_PWC is not set +# CONFIG_VIDEO_CPIA2 is not set +# CONFIG_USB_ZR364XX is not set +# CONFIG_USB_STKWEBCAM is not set +# CONFIG_USB_S2255 is not set +# CONFIG_VIDEO_USBTV is not set + +# +# Analog TV USB devices +# +CONFIG_VIDEO_PVRUSB2=m +CONFIG_VIDEO_PVRUSB2_SYSFS=y +CONFIG_VIDEO_PVRUSB2_DVB=y +# CONFIG_VIDEO_PVRUSB2_DEBUGIFC is not set +# CONFIG_VIDEO_HDPVR is not set +# CONFIG_VIDEO_TLG2300 is not set +# CONFIG_VIDEO_USBVISION is not set +# CONFIG_VIDEO_STK1160_COMMON is not set + +# +# Analog/digital TV USB devices +# +CONFIG_VIDEO_AU0828=m +CONFIG_VIDEO_AU0828_V4L2=y +CONFIG_VIDEO_CX231XX=m +CONFIG_VIDEO_CX231XX_RC=y +# CONFIG_VIDEO_CX231XX_ALSA is not set +CONFIG_VIDEO_CX231XX_DVB=m +CONFIG_VIDEO_TM6000=m +# CONFIG_VIDEO_TM6000_ALSA is not set +CONFIG_VIDEO_TM6000_DVB=m + +# +# Digital TV USB devices +# +CONFIG_DVB_USB=m +# CONFIG_DVB_USB_DEBUG is not set +# CONFIG_DVB_USB_A800 is not set +CONFIG_DVB_USB_DIBUSB_MB=m +CONFIG_DVB_USB_DIBUSB_MB_FAULTY=y +CONFIG_DVB_USB_DIBUSB_MC=m +CONFIG_DVB_USB_DIB0700=m +# CONFIG_DVB_USB_UMT_010 is not set +CONFIG_DVB_USB_CXUSB=m +# CONFIG_DVB_USB_M920X is not set +# CONFIG_DVB_USB_DIGITV is not set +CONFIG_DVB_USB_VP7045=m +# CONFIG_DVB_USB_VP702X is not set +# CONFIG_DVB_USB_GP8PSK is not set +CONFIG_DVB_USB_NOVA_T_USB2=m +CONFIG_DVB_USB_TTUSB2=m +CONFIG_DVB_USB_DTT200U=m +CONFIG_DVB_USB_OPERA1=m +CONFIG_DVB_USB_AF9005=m +CONFIG_DVB_USB_AF9005_REMOTE=m +CONFIG_DVB_USB_PCTV452E=m +CONFIG_DVB_USB_DW2102=m +CONFIG_DVB_USB_CINERGY_T2=m +CONFIG_DVB_USB_DTV5100=m +# CONFIG_DVB_USB_FRIIO is not set +CONFIG_DVB_USB_AZ6027=m +CONFIG_DVB_USB_TECHNISAT_USB2=m +CONFIG_DVB_USB_V2=m +CONFIG_DVB_USB_AF9015=m +CONFIG_DVB_USB_AF9035=m +CONFIG_DVB_USB_ANYSEE=m +# CONFIG_DVB_USB_AU6610 is not set +CONFIG_DVB_USB_AZ6007=m +CONFIG_DVB_USB_CE6230=m +CONFIG_DVB_USB_EC168=m +CONFIG_DVB_USB_GL861=m +CONFIG_DVB_USB_IT913X=m +CONFIG_DVB_USB_LME2510=m +CONFIG_DVB_USB_MXL111SF=m +CONFIG_DVB_USB_RTL28XXU=m +CONFIG_SMS_USB_DRV=m +CONFIG_DVB_B2C2_FLEXCOP_USB=m +# CONFIG_DVB_B2C2_FLEXCOP_USB_DEBUG is not set + +# +# Webcam, TV (analog/digital) USB devices +# +CONFIG_VIDEO_EM28XX=m +# CONFIG_VIDEO_EM28XX_V4L2 is not set +# CONFIG_VIDEO_EM28XX_ALSA is not set +CONFIG_VIDEO_EM28XX_DVB=m +CONFIG_VIDEO_EM28XX_RC=m +# CONFIG_V4L_PLATFORM_DRIVERS is not set +# CONFIG_V4L_MEM2MEM_DRIVERS is not set +# CONFIG_V4L_TEST_DRIVERS is not set + +# +# Supported MMC/SDIO adapters +# +CONFIG_SMS_SDIO_DRV=m +# CONFIG_RADIO_ADAPTERS is not set +CONFIG_MEDIA_COMMON_OPTIONS=y + +# +# common driver options +# +CONFIG_VIDEO_CX2341X=m +CONFIG_VIDEO_TVEEPROM=m +CONFIG_CYPRESS_FIRMWARE=m +CONFIG_DVB_B2C2_FLEXCOP=m +CONFIG_SMS_SIANO_MDTV=m +CONFIG_SMS_SIANO_RC=y +# CONFIG_SMS_SIANO_DEBUGFS is not set + +# +# Media ancillary drivers (tuners, sensors, i2c, frontends) +# +CONFIG_MEDIA_SUBDRV_AUTOSELECT=y +CONFIG_MEDIA_ATTACH=y +CONFIG_VIDEO_IR_I2C=y + +# +# Audio decoders, processors and mixers +# +CONFIG_VIDEO_MSP3400=m +CONFIG_VIDEO_CS53L32A=m +CONFIG_VIDEO_WM8775=m + +# +# RDS decoders +# + +# +# Video decoders +# +CONFIG_VIDEO_SAA711X=m + +# +# Video and audio decoders +# +CONFIG_VIDEO_CX25840=m + +# +# Video encoders +# + +# +# Camera sensor devices +# + +# +# Flash devices +# + +# +# Video improvement chips +# + +# +# Audio/Video compression chips +# + +# +# Miscellaneous helper chips +# + +# +# Sensors used on soc_camera driver +# +CONFIG_MEDIA_TUNER=y +CONFIG_MEDIA_TUNER_SIMPLE=y +CONFIG_MEDIA_TUNER_TDA8290=y +CONFIG_MEDIA_TUNER_TDA827X=y +CONFIG_MEDIA_TUNER_TDA18271=y +CONFIG_MEDIA_TUNER_TDA9887=y +CONFIG_MEDIA_TUNER_TEA5761=y +CONFIG_MEDIA_TUNER_TEA5767=y +CONFIG_MEDIA_TUNER_MT20XX=y +CONFIG_MEDIA_TUNER_MT2060=m +CONFIG_MEDIA_TUNER_MT2063=m +CONFIG_MEDIA_TUNER_MT2266=m +CONFIG_MEDIA_TUNER_QT1010=m +CONFIG_MEDIA_TUNER_XC2028=y +CONFIG_MEDIA_TUNER_XC5000=y +CONFIG_MEDIA_TUNER_XC4000=y +CONFIG_MEDIA_TUNER_MXL5005S=m +CONFIG_MEDIA_TUNER_MXL5007T=m +CONFIG_MEDIA_TUNER_MC44S803=y +CONFIG_MEDIA_TUNER_MAX2165=m +CONFIG_MEDIA_TUNER_TDA18218=m +CONFIG_MEDIA_TUNER_FC0011=m +CONFIG_MEDIA_TUNER_FC0012=m +CONFIG_MEDIA_TUNER_FC0013=m +CONFIG_MEDIA_TUNER_TDA18212=m +CONFIG_MEDIA_TUNER_E4000=m +CONFIG_MEDIA_TUNER_FC2580=m +CONFIG_MEDIA_TUNER_M88TS2022=m +CONFIG_MEDIA_TUNER_TUA9001=m +CONFIG_MEDIA_TUNER_IT913X=m +CONFIG_MEDIA_TUNER_R820T=m + +# +# Multistandard (satellite) frontends +# +CONFIG_DVB_STB0899=m +CONFIG_DVB_STB6100=m +CONFIG_DVB_STV090x=m +CONFIG_DVB_STV6110x=m +CONFIG_DVB_M88DS3103=m + +# +# Multistandard (cable + terrestrial) frontends +# +CONFIG_DVB_DRXK=m +CONFIG_DVB_TDA18271C2DD=m + +# +# DVB-S (satellite) frontends +# +CONFIG_DVB_CX24123=m +CONFIG_DVB_MT312=m +CONFIG_DVB_ZL10039=m +CONFIG_DVB_S5H1420=m +CONFIG_DVB_STV0288=m +CONFIG_DVB_STB6000=m +CONFIG_DVB_STV0299=m +CONFIG_DVB_STV6110=m +CONFIG_DVB_STV0900=m +CONFIG_DVB_TDA10086=m +CONFIG_DVB_TUNER_ITD1000=m +CONFIG_DVB_TUNER_CX24113=m +CONFIG_DVB_TDA826X=m +CONFIG_DVB_CX24116=m +CONFIG_DVB_SI21XX=m +CONFIG_DVB_TS2020=m +CONFIG_DVB_DS3000=m +CONFIG_DVB_TDA10071=m + +# +# DVB-T (terrestrial) frontends +# +CONFIG_DVB_CX22702=m +CONFIG_DVB_DRXD=m +CONFIG_DVB_MT352=m +CONFIG_DVB_ZL10353=m +CONFIG_DVB_DIB3000MB=m +CONFIG_DVB_DIB3000MC=m +CONFIG_DVB_DIB7000M=m +CONFIG_DVB_DIB7000P=m +CONFIG_DVB_TDA10048=m +CONFIG_DVB_AF9013=m +CONFIG_DVB_EC100=m +CONFIG_DVB_CXD2820R=m +CONFIG_DVB_RTL2830=m +CONFIG_DVB_RTL2832=m + +# +# DVB-C (cable) frontends +# +CONFIG_DVB_TDA10023=m +CONFIG_DVB_STV0297=m + +# +# ATSC (North American/Korean Terrestrial/Cable DTV) frontends +# +CONFIG_DVB_NXT200X=m +CONFIG_DVB_BCM3510=m +CONFIG_DVB_LGDT330X=m +CONFIG_DVB_LGDT3305=m +CONFIG_DVB_LG2160=m +CONFIG_DVB_S5H1409=m +CONFIG_DVB_AU8522=m +CONFIG_DVB_AU8522_DTV=m +CONFIG_DVB_AU8522_V4L=m +CONFIG_DVB_S5H1411=m + +# +# ISDB-T (terrestrial) frontends +# +CONFIG_DVB_S921=m +CONFIG_DVB_DIB8000=m +CONFIG_DVB_MB86A20S=m + +# +# Digital terrestrial only tuners/PLL +# +CONFIG_DVB_PLL=m +CONFIG_DVB_TUNER_DIB0070=m +CONFIG_DVB_TUNER_DIB0090=m + +# +# SEC control devices for DVB-S +# +CONFIG_DVB_LNBP21=m +CONFIG_DVB_LNBP22=m +CONFIG_DVB_ISL6421=m +CONFIG_DVB_ISL6423=m +CONFIG_DVB_A8293=m +CONFIG_DVB_LGS8GXX=m +CONFIG_DVB_ATBM8830=m +CONFIG_DVB_IX2505V=m +CONFIG_DVB_IT913X_FE=m +CONFIG_DVB_M88RS2000=m +CONFIG_DVB_AF9033=m + +# +# Tools to develop new frontends +# +# CONFIG_DVB_DUMMY_FE is not set + +# +# Graphics support +# +# CONFIG_DRM is not set +# CONFIG_VGASTATE is not set +# CONFIG_VIDEO_OUTPUT_CONTROL is not set +CONFIG_VEXPRESS_DVI_CONTROL=y +CONFIG_FB=y +# CONFIG_FIRMWARE_EDID is not set +# CONFIG_FB_DDC is not set +# CONFIG_FB_BOOT_VESA_SUPPORT is not set +CONFIG_FB_CFB_FILLRECT=y +CONFIG_FB_CFB_COPYAREA=y +CONFIG_FB_CFB_IMAGEBLIT=y +# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set +CONFIG_FB_SYS_FILLRECT=m +CONFIG_FB_SYS_COPYAREA=m +CONFIG_FB_SYS_IMAGEBLIT=m +# CONFIG_FB_FOREIGN_ENDIAN is not set +CONFIG_FB_SYS_FOPS=m +CONFIG_FB_DEFERRED_IO=y +# CONFIG_FB_SVGALIB is not set +# CONFIG_FB_MACMODES is not set +# CONFIG_FB_BACKLIGHT is not set +# CONFIG_FB_MODE_HELPERS is not set +# CONFIG_FB_TILEBLITTING is not set + +# +# Frame buffer hardware drivers +# +CONFIG_FB_ARMCLCD=y +# CONFIG_FB_UVESA is not set +# CONFIG_FB_OPENCORES is not set +# CONFIG_FB_S1D13XXX is not set +# CONFIG_FB_SMSCUFX is not set +# CONFIG_FB_UDL is not set +# CONFIG_FB_GOLDFISH is not set +# CONFIG_FB_VIRTUAL is not set +# CONFIG_FB_METRONOME is not set +# CONFIG_FB_BROADSHEET is not set +# CONFIG_FB_AUO_K190X is not set +# CONFIG_FB_SIMPLE is not set +# CONFIG_EXYNOS_VIDEO is not set +CONFIG_BACKLIGHT_LCD_SUPPORT=y +CONFIG_LCD_CLASS_DEVICE=m +# CONFIG_LCD_L4F00242T03 is not set +# CONFIG_LCD_LMS283GF05 is not set +# CONFIG_LCD_LTV350QV is not set +# CONFIG_LCD_ILI922X is not set +# CONFIG_LCD_ILI9320 is not set +# CONFIG_LCD_TDO24M is not set +# CONFIG_LCD_VGG2432A4 is not set +# CONFIG_LCD_PLATFORM is not set +# CONFIG_LCD_S6E63M0 is not set +# CONFIG_LCD_LD9040 is not set +# CONFIG_LCD_AMS369FG06 is not set +# CONFIG_LCD_LMS501KF03 is not set +# CONFIG_LCD_HX8357 is not set +CONFIG_BACKLIGHT_CLASS_DEVICE=y +CONFIG_BACKLIGHT_GENERIC=y +# CONFIG_BACKLIGHT_PWM is not set +# CONFIG_BACKLIGHT_ADP8860 is not set +# CONFIG_BACKLIGHT_ADP8870 is not set +# CONFIG_BACKLIGHT_LM3630A is not set +# CONFIG_BACKLIGHT_LM3639 is not set +# CONFIG_BACKLIGHT_LP855X is not set +# CONFIG_BACKLIGHT_GPIO is not set +# CONFIG_BACKLIGHT_LV5207LP is not set +# CONFIG_BACKLIGHT_BD6107 is not set +# CONFIG_ADF is not set + +# +# Console display driver support +# +CONFIG_DUMMY_CONSOLE=y +CONFIG_FRAMEBUFFER_CONSOLE=y +CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y +# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set +# CONFIG_LOGO is not set +# CONFIG_FB_SSD1307 is not set + +# +# Mali GPU OpenGL device driver +# +CONFIG_MALI400=y +# CONFIG_MALI400_DEBUG is not set +# CONFIG_MALI400_PROFILING is not set +# CONFIG_MALI400_UMP is not set +# CONFIG_MALI_DVFS is not set +CONFIG_MALI_DMA_BUF_MAP_ON_ATTACH=y +# CONFIG_MALI_SHARED_INTERRUPTS is not set +# CONFIG_MALI_PMU_PARALLEL_POWER_UP is not set +# CONFIG_MALI_DT is not set +# CONFIG_MALI_QUIET is not set +CONFIG_SOUND=y +# CONFIG_SOUND_OSS_CORE is not set +CONFIG_SND=y +CONFIG_SND_TIMER=y +CONFIG_SND_PCM=y +CONFIG_SND_HWDEP=y +CONFIG_SND_RAWMIDI=y +CONFIG_SND_COMPRESS_OFFLOAD=y +CONFIG_SND_JACK=y +# CONFIG_SND_SEQUENCER is not set +# CONFIG_SND_MIXER_OSS is not set +# CONFIG_SND_PCM_OSS is not set +# CONFIG_SND_HRTIMER is not set +# CONFIG_SND_DYNAMIC_MINORS is not set +CONFIG_SND_SUPPORT_OLD_API=y +CONFIG_SND_VERBOSE_PROCFS=y +# CONFIG_SND_VERBOSE_PRINTK is not set +# CONFIG_SND_DEBUG is not set +CONFIG_SND_VMASTER=y +# CONFIG_SND_RAWMIDI_SEQ is not set +# CONFIG_SND_OPL3_LIB_SEQ is not set +# CONFIG_SND_OPL4_LIB_SEQ is not set +# CONFIG_SND_SBAWE_SEQ is not set +# CONFIG_SND_EMU10K1_SEQ is not set +CONFIG_SND_DRIVERS=y +# CONFIG_SND_DUMMY is not set +# CONFIG_SND_ALOOP is not set +# CONFIG_SND_MTPAV is not set +# CONFIG_SND_SERIAL_U16550 is not set +# CONFIG_SND_MPU401 is not set +CONFIG_SND_SPI=y +CONFIG_SND_USB=y +CONFIG_SND_USB_AUDIO=y +CONFIG_SND_USB_UA101=m +CONFIG_SND_USB_CAIAQ=m +CONFIG_SND_USB_CAIAQ_INPUT=y +CONFIG_SND_USB_6FIRE=m +CONFIG_SND_USB_HIFACE=m +CONFIG_SND_SOC=y +# CONFIG_SND_ATMEL_SOC is not set +# CONFIG_SND_DESIGNWARE_I2S is not set +CONFIG_SND_AML_M8_SOC=y +CONFIG_SND_AML_M8=y +CONFIG_SND_ODROID_HDMI=y +CONFIG_SND_ODROID_DAC=y +# CONFIG_SND_AML_G9TV is not set +CONFIG_SND_SOC_I2C_AND_SPI=y +CONFIG_SND_SOC_DUMMY_CODEC=y +CONFIG_SND_SOC_PCM2BT=y +CONFIG_SND_SOC_PCM5102=y +# CONFIG_SND_SIMPLE_CARD is not set +# CONFIG_SOUND_PRIME is not set + +# +# HID support +# +CONFIG_HID=y +# CONFIG_HID_BATTERY_STRENGTH is not set +CONFIG_HIDRAW=y +# CONFIG_UHID is not set +CONFIG_HID_GENERIC=y + +# +# Special HID drivers +# +CONFIG_HID_A4TECH=y +# CONFIG_HID_ACRUX is not set +CONFIG_HID_APPLE=y +# CONFIG_HID_APPLEIR is not set +CONFIG_HID_AUREAL=y +CONFIG_HID_BELKIN=y +CONFIG_HID_CHERRY=y +CONFIG_HID_CHICONY=y +# CONFIG_HID_PRODIKEYS is not set +CONFIG_HID_CYPRESS=y +CONFIG_HID_DRAGONRISE=m +CONFIG_DRAGONRISE_FF=y +# CONFIG_HID_EMS_FF is not set +# CONFIG_HID_ELECOM is not set +# CONFIG_HID_ELO is not set +CONFIG_HID_EZKEY=y +# CONFIG_HID_HOLTEK is not set +# CONFIG_HID_HUION is not set +# CONFIG_HID_KEYTOUCH is not set +CONFIG_HID_KYE=y +# CONFIG_HID_UCLOGIC is not set +# CONFIG_HID_WALTOP is not set +CONFIG_HID_GYRATION=y +# CONFIG_HID_ICADE is not set +CONFIG_HID_TWINHAN=y +CONFIG_HID_KENSINGTON=y +CONFIG_HID_LCPOWER=y +CONFIG_HID_LENOVO_TPKBD=m +CONFIG_HID_LOGITECH=y +CONFIG_HID_LOGITECH_DJ=y +CONFIG_LOGITECH_FF=y +CONFIG_LOGIRUMBLEPAD2_FF=y +CONFIG_LOGIG940_FF=y +CONFIG_LOGIWHEELS_FF=y +# CONFIG_HID_MAGICMOUSE is not set +CONFIG_HID_MICROSOFT=y +CONFIG_HID_MONTEREY=y +# CONFIG_HID_MULTITOUCH is not set +# CONFIG_HID_NTRIG is not set +CONFIG_HID_ORTEK=y +CONFIG_HID_PANTHERLORD=y +CONFIG_PANTHERLORD_FF=y +CONFIG_HID_PETALYNX=y +CONFIG_HID_PICOLCD=m +CONFIG_HID_PICOLCD_FB=y +CONFIG_HID_PICOLCD_BACKLIGHT=y +CONFIG_HID_PICOLCD_LCD=y +CONFIG_HID_PICOLCD_LEDS=y +# CONFIG_HID_PICOLCD_CIR is not set +# CONFIG_HID_PRIMAX is not set +# CONFIG_HID_ROCCAT is not set +# CONFIG_HID_SAITEK is not set +CONFIG_HID_SAMSUNG=y +CONFIG_HID_SONY=y +# CONFIG_SONY_FF is not set +# CONFIG_HID_SPEEDLINK is not set +# CONFIG_HID_STEELSERIES is not set +CONFIG_HID_SUNPLUS=y +# CONFIG_HID_GREENASIA is not set +# CONFIG_HID_SMARTJOYPLUS is not set +CONFIG_HID_TIVO=y +CONFIG_HID_TOPSEED=y +# CONFIG_HID_THINGM is not set +# CONFIG_HID_THRUSTMASTER is not set +# CONFIG_HID_WACOM is not set +CONFIG_HID_WIIMOTE=m +# CONFIG_HID_XINMO is not set +# CONFIG_HID_ZEROPLUS is not set +CONFIG_HID_ZYDACRON=y +# CONFIG_HID_SENSOR_HUB is not set + +# +# USB HID support +# +CONFIG_USB_HID=y +# CONFIG_HID_PID is not set +CONFIG_USB_HIDDEV=y + +# +# I2C HID support +# +# CONFIG_I2C_HID is not set +CONFIG_USB_OHCI_LITTLE_ENDIAN=y +CONFIG_USB_SUPPORT=y +CONFIG_USB_COMMON=y +CONFIG_USB_ARCH_HAS_HCD=y +CONFIG_USB=y +# CONFIG_USB_DEBUG is not set +CONFIG_USB_ANNOUNCE_NEW_DEVICES=y + +# +# Miscellaneous USB options +# +CONFIG_USB_DEFAULT_PERSIST=y +# CONFIG_USB_DYNAMIC_MINORS is not set +# CONFIG_USB_OTG_WHITELIST is not set +# CONFIG_USB_OTG_BLACKLIST_HUB is not set +# CONFIG_USB_MON is not set +# CONFIG_USB_WUSB_CBAF is not set + +# +# USB Host Controller Drivers +# +# CONFIG_USB_C67X00_HCD is not set +# CONFIG_USB_XHCI_HCD is not set +CONFIG_USB_EHCI_HCD=y +# CONFIG_USB_EHCI_ROOT_HUB_TT is not set +CONFIG_USB_EHCI_TT_NEWSCHED=y +CONFIG_USB_EHCI_HCD_SYNOPSYS=y +# CONFIG_USB_EHCI_HCD_PLATFORM is not set +# CONFIG_USB_OXU210HP_HCD is not set +# CONFIG_USB_ISP116X_HCD is not set +# CONFIG_USB_ISP1760_HCD is not set +# CONFIG_USB_ISP1362_HCD is not set +# CONFIG_USB_FUSBH200_HCD is not set +# CONFIG_USB_FOTG210_HCD is not set +CONFIG_USB_OHCI_HCD=y +# CONFIG_USB_OHCI_HCD_PLATFORM is not set +# CONFIG_USB_SL811_HCD is not set +# CONFIG_USB_R8A66597_HCD is not set +# CONFIG_USB_HCD_SSB is not set +# CONFIG_USB_HCD_TEST_MODE is not set +# CONFIG_USB_RENESAS_USBHS is not set + +# +# USB Device Class drivers +# +CONFIG_USB_ACM=y +# CONFIG_USB_PRINTER is not set +CONFIG_USB_WDM=m +# CONFIG_USB_TMC is not set + +# +# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may +# + +# +# also be needed; see USB_STORAGE Help for more info +# +CONFIG_USB_STORAGE=y +# CONFIG_USB_STORAGE_DEBUG is not set +# CONFIG_USB_STORAGE_REALTEK is not set +# CONFIG_USB_STORAGE_DATAFAB is not set +# CONFIG_USB_STORAGE_FREECOM is not set +# CONFIG_USB_STORAGE_ISD200 is not set +# CONFIG_USB_STORAGE_USBAT is not set +# CONFIG_USB_STORAGE_SDDR09 is not set +# CONFIG_USB_STORAGE_SDDR55 is not set +# CONFIG_USB_STORAGE_JUMPSHOT is not set +# CONFIG_USB_STORAGE_ALAUDA is not set +# CONFIG_USB_STORAGE_ONETOUCH is not set +# CONFIG_USB_STORAGE_KARMA is not set +# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set +# CONFIG_USB_STORAGE_ENE_UB6250 is not set + +# +# USB Imaging devices +# +# CONFIG_USB_MDC800 is not set +# CONFIG_USB_MICROTEK is not set +# CONFIG_USB_MUSB_HDRC is not set +# CONFIG_USB_DWC3 is not set +# CONFIG_USB_DWC2 is not set +# CONFIG_USB_CHIPIDEA is not set + +# +# USB port drivers +# +CONFIG_USB_SERIAL=y +CONFIG_USB_SERIAL_CONSOLE=y +CONFIG_USB_SERIAL_GENERIC=y +# CONFIG_USB_SERIAL_SIMPLE is not set +# CONFIG_USB_SERIAL_AIRCABLE is not set +# CONFIG_USB_SERIAL_ARK3116 is not set +# CONFIG_USB_SERIAL_BELKIN is not set +# CONFIG_USB_SERIAL_CH341 is not set +# CONFIG_USB_SERIAL_WHITEHEAT is not set +# CONFIG_USB_SERIAL_DIGI_ACCELEPORT is not set +# CONFIG_USB_SERIAL_CP210X is not set +# CONFIG_USB_SERIAL_CYPRESS_M8 is not set +# CONFIG_USB_SERIAL_EMPEG is not set +# CONFIG_USB_SERIAL_FTDI_SIO is not set +# CONFIG_USB_SERIAL_VISOR is not set +# CONFIG_USB_SERIAL_IPAQ is not set +# CONFIG_USB_SERIAL_IR is not set +# CONFIG_USB_SERIAL_EDGEPORT is not set +# CONFIG_USB_SERIAL_EDGEPORT_TI is not set +# CONFIG_USB_SERIAL_F81232 is not set +# CONFIG_USB_SERIAL_GARMIN is not set +# CONFIG_USB_SERIAL_IPW is not set +# CONFIG_USB_SERIAL_IUU is not set +# CONFIG_USB_SERIAL_KEYSPAN_PDA is not set +# CONFIG_USB_SERIAL_KEYSPAN is not set +# CONFIG_USB_SERIAL_KLSI is not set +# CONFIG_USB_SERIAL_KOBIL_SCT is not set +# CONFIG_USB_SERIAL_MCT_U232 is not set +# CONFIG_USB_SERIAL_METRO is not set +# CONFIG_USB_SERIAL_MOS7720 is not set +# CONFIG_USB_SERIAL_MOS7840 is not set +# CONFIG_USB_SERIAL_MXUPORT is not set +# CONFIG_USB_SERIAL_NAVMAN is not set +# CONFIG_USB_SERIAL_PL2303 is not set +# CONFIG_USB_SERIAL_OTI6858 is not set +# CONFIG_USB_SERIAL_QCAUX is not set +# CONFIG_USB_SERIAL_QUALCOMM is not set +# CONFIG_USB_SERIAL_SPCP8X5 is not set +# CONFIG_USB_SERIAL_SAFE is not set +# CONFIG_USB_SERIAL_SIERRAWIRELESS is not set +# CONFIG_USB_SERIAL_SYMBOL is not set +# CONFIG_USB_SERIAL_TI is not set +# CONFIG_USB_SERIAL_CYBERJACK is not set +# CONFIG_USB_SERIAL_XIRCOM is not set +# CONFIG_USB_SERIAL_OPTION is not set +# CONFIG_USB_SERIAL_OMNINET is not set +# CONFIG_USB_SERIAL_OPTICON is not set +# CONFIG_USB_SERIAL_XSENS_MT is not set +# CONFIG_USB_SERIAL_WISHBONE is not set +# CONFIG_USB_SERIAL_ZTE is not set +# CONFIG_USB_SERIAL_SSU100 is not set +# CONFIG_USB_SERIAL_QT2 is not set +# CONFIG_USB_SERIAL_DEBUG is not set + +# +# USB Miscellaneous drivers +# +CONFIG_USB_EMI62=m +CONFIG_USB_EMI26=m +# CONFIG_USB_ADUTUX is not set +CONFIG_USB_SEVSEG=m +CONFIG_USB_RIO500=m +CONFIG_USB_LEGOTOWER=m +CONFIG_USB_LCD=m +CONFIG_USB_LED=m +# CONFIG_USB_CYPRESS_CY7C63 is not set +CONFIG_USB_CYTHERM=m +# CONFIG_USB_IDMOUSE is not set +# CONFIG_USB_FTDI_ELAN is not set +CONFIG_USB_APPLEDISPLAY=m +CONFIG_USB_SISUSBVGA=m +CONFIG_USB_SISUSBVGA_CON=y +CONFIG_USB_LD=m +CONFIG_USB_TRANCEVIBRATOR=m +CONFIG_USB_IOWARRIOR=m +# CONFIG_USB_TEST is not set +# CONFIG_USB_EHSET_TEST_FIXTURE is not set +CONFIG_USB_ISIGHTFW=m +CONFIG_USB_YUREX=m +CONFIG_USB_EZUSB_FX2=m +# CONFIG_USB_HSIC_USB3503 is not set + +# +# USB Physical Layer drivers +# +CONFIG_USB_PHY=y +# CONFIG_USB_OTG_FSM is not set +# CONFIG_USB_OTG_WAKELOCK is not set +# CONFIG_NOP_USB_XCEIV is not set +# CONFIG_SAMSUNG_USB2PHY is not set +# CONFIG_SAMSUNG_USB3PHY is not set +# CONFIG_USB_GPIO_VBUS is not set +CONFIG_USB_ISP1301=y +# CONFIG_USB_RCAR_PHY is not set +CONFIG_USB_ULPI=y +CONFIG_USB_GADGET=y +# CONFIG_USB_GADGET_DEBUG is not set +# CONFIG_USB_GADGET_DEBUG_FILES is not set +# CONFIG_USB_GADGET_DEBUG_FS is not set +CONFIG_USB_GADGET_VBUS_DRAW=2 +CONFIG_USB_GADGET_STORAGE_NUM_BUFFERS=2 + +# +# USB Peripheral Controller +# +# CONFIG_USB_FOTG210_UDC is not set +# CONFIG_USB_GR_UDC is not set +# CONFIG_USB_R8A66597 is not set +# CONFIG_USB_PXA27X is not set +# CONFIG_USB_MV_UDC is not set +# CONFIG_USB_MV_U3D is not set +# CONFIG_USB_M66592 is not set +# CONFIG_USB_NET2272 is not set +# CONFIG_USB_DUMMY_HCD is not set +# CONFIG_USB_CONFIGFS is not set +# CONFIG_USB_ZERO is not set +# CONFIG_USB_AUDIO is not set +# CONFIG_USB_ETH is not set +# CONFIG_USB_G_NCM is not set +# CONFIG_USB_GADGETFS is not set +# CONFIG_USB_FUNCTIONFS is not set +# CONFIG_USB_MASS_STORAGE is not set +# CONFIG_USB_G_SERIAL is not set +# CONFIG_USB_MIDI_GADGET is not set +# CONFIG_USB_G_PRINTER is not set +# CONFIG_USB_CDC_COMPOSITE is not set +# CONFIG_USB_G_ACM_MS is not set +# CONFIG_USB_G_MULTI is not set +# CONFIG_USB_G_HID is not set +# CONFIG_USB_G_DBGP is not set +# CONFIG_USB_G_WEBCAM is not set +CONFIG_MMC=y +# CONFIG_MMC_DEBUG is not set +CONFIG_PXP_MMC=y +CONFIG_MMC_UNSAFE_RESUME=y +# CONFIG_MMC_CLKGATE is not set +# CONFIG_MMC_EMBEDDED_SDIO is not set +# CONFIG_MMC_PARANOID_SD_INIT is not set + +# +# MMC/SD/SDIO Card Drivers +# +CONFIG_MMC_BLOCK=y +CONFIG_MMC_BLOCK_MINORS=32 +CONFIG_MMC_BLOCK_BOUNCE=y +# CONFIG_MMC_BLOCK_DEFERRED_RESUME is not set +# CONFIG_SDIO_UART is not set +# CONFIG_MMC_TEST is not set + +# +# MMC/SD/SDIO Host Controller Drivers +# +CONFIG_MMC_ARMMMCI=y +# CONFIG_MMC_SDHCI is not set +# CONFIG_MMC_SDHCI_PXAV3 is not set +# CONFIG_MMC_SDHCI_PXAV2 is not set +# CONFIG_MMC_SPI is not set +# CONFIG_MMC_VUB300 is not set +# CONFIG_MMC_USHC is not set +# CONFIG_MEMSTICK is not set +CONFIG_NEW_LEDS=y +CONFIG_LEDS_CLASS=y + +# +# LED drivers +# +# CONFIG_LEDS_LM3530 is not set +# CONFIG_LEDS_LM3642 is not set +# CONFIG_LEDS_PCA9532 is not set +CONFIG_LEDS_GPIO=y +# CONFIG_LEDS_LP3944 is not set +# CONFIG_LEDS_LP5521 is not set +# CONFIG_LEDS_LP5523 is not set +# CONFIG_LEDS_LP5562 is not set +# CONFIG_LEDS_LP8501 is not set +# CONFIG_LEDS_PCA955X is not set +# CONFIG_LEDS_PCA963X is not set +# CONFIG_LEDS_PCA9685 is not set +# CONFIG_LEDS_DAC124S085 is not set +# CONFIG_LEDS_PWM is not set +# CONFIG_LEDS_REGULATOR is not set +# CONFIG_LEDS_BD2802 is not set +# CONFIG_LEDS_LT3593 is not set +# CONFIG_LEDS_TCA6507 is not set +# CONFIG_LEDS_LM355x is not set +# CONFIG_LEDS_OT200 is not set +# CONFIG_LEDS_BLINKM is not set + +# +# LED Triggers +# +CONFIG_LEDS_TRIGGERS=y +CONFIG_LEDS_TRIGGER_TIMER=y +CONFIG_LEDS_TRIGGER_ONESHOT=y +CONFIG_LEDS_TRIGGER_HEARTBEAT=y +CONFIG_LEDS_TRIGGER_BACKLIGHT=y +CONFIG_LEDS_TRIGGER_CPU=y +CONFIG_LEDS_TRIGGER_GPIO=y +CONFIG_LEDS_TRIGGER_DEFAULT_ON=y + +# +# iptables trigger is under Netfilter config (LED target) +# +CONFIG_LEDS_TRIGGER_TRANSIENT=y +CONFIG_LEDS_TRIGGER_CAMERA=y +CONFIG_SWITCH=y +# CONFIG_SWITCH_GPIO is not set +# CONFIG_ACCESSIBILITY is not set +CONFIG_RTC_LIB=y +CONFIG_RTC_CLASS=y +CONFIG_RTC_HCTOSYS=y +CONFIG_RTC_SYSTOHC=y +CONFIG_RTC_HCTOSYS_DEVICE="rtc0" +# CONFIG_RTC_DEBUG is not set + +# +# RTC interfaces +# +CONFIG_RTC_INTF_SYSFS=y +CONFIG_RTC_INTF_PROC=y +CONFIG_RTC_INTF_DEV=y +# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set +# CONFIG_RTC_DRV_TEST is not set + +# +# I2C RTC drivers +# +# CONFIG_RTC_DRV_DS1307 is not set +# CONFIG_RTC_DRV_DS1374 is not set +# CONFIG_RTC_DRV_DS1672 is not set +# CONFIG_RTC_DRV_DS3232 is not set +# CONFIG_RTC_DRV_HYM8563 is not set +# CONFIG_RTC_DRV_MAX6900 is not set +# CONFIG_RTC_DRV_RS5C372 is not set +# CONFIG_RTC_DRV_ISL1208 is not set +# CONFIG_RTC_DRV_ISL12022 is not set +# CONFIG_RTC_DRV_ISL12057 is not set +# CONFIG_RTC_DRV_X1205 is not set +# CONFIG_RTC_DRV_PCF2127 is not set +# CONFIG_RTC_DRV_PCF8523 is not set +# CONFIG_RTC_DRV_PCF8563 is not set +# CONFIG_RTC_DRV_PCF8583 is not set +# CONFIG_RTC_DRV_M41T80 is not set +# CONFIG_RTC_DRV_BQ32K is not set +# CONFIG_RTC_DRV_S35390A is not set +# CONFIG_RTC_DRV_FM3130 is not set +# CONFIG_RTC_DRV_RX8581 is not set +# CONFIG_RTC_DRV_RX8025 is not set +# CONFIG_RTC_DRV_EM3027 is not set +# CONFIG_RTC_DRV_RV3029C2 is not set + +# +# SPI RTC drivers +# +# CONFIG_RTC_DRV_M41T93 is not set +# CONFIG_RTC_DRV_M41T94 is not set +# CONFIG_RTC_DRV_DS1305 is not set +# CONFIG_RTC_DRV_DS1390 is not set +# CONFIG_RTC_DRV_MAX6902 is not set +# CONFIG_RTC_DRV_R9701 is not set +# CONFIG_RTC_DRV_RS5C348 is not set +# CONFIG_RTC_DRV_DS3234 is not set +# CONFIG_RTC_DRV_PCF2123 is not set +# CONFIG_RTC_DRV_RX4581 is not set + +# +# Platform RTC drivers +# +# CONFIG_RTC_DRV_DS1286 is not set +# CONFIG_RTC_DRV_DS1511 is not set +# CONFIG_RTC_DRV_DS1553 is not set +# CONFIG_RTC_DRV_DS1742 is not set +# CONFIG_RTC_DRV_STK17TA8 is not set +# CONFIG_RTC_DRV_M48T86 is not set +# CONFIG_RTC_DRV_M48T35 is not set +# CONFIG_RTC_DRV_M48T59 is not set +# CONFIG_RTC_DRV_MSM6242 is not set +# CONFIG_RTC_DRV_BQ4802 is not set +# CONFIG_RTC_DRV_RP5C01 is not set +# CONFIG_RTC_DRV_V3020 is not set +# CONFIG_RTC_DRV_DS2404 is not set + +# +# on-CPU RTC drivers +# +# CONFIG_RTC_DRV_PL030 is not set +CONFIG_RTC_DRV_PL031=y +# CONFIG_RTC_DRV_SNVS is not set +# CONFIG_RTC_DRV_MOXART is not set + +# +# HID Sensor RTC drivers +# +# CONFIG_RTC_DRV_HID_SENSOR_TIME is not set +# CONFIG_DMADEVICES is not set +# CONFIG_AUXDISPLAY is not set +CONFIG_UIO=y +# CONFIG_UIO_PDRV_GENIRQ is not set +# CONFIG_UIO_DMEM_GENIRQ is not set +# CONFIG_VIRT_DRIVERS is not set + +# +# Virtio drivers +# +# CONFIG_VIRTIO_MMIO is not set + +# +# Microsoft Hyper-V guest support +# +CONFIG_STAGING=y +# CONFIG_USBIP_CORE is not set +# CONFIG_W35UND is not set +# CONFIG_PRISM2_USB is not set +# CONFIG_ECHO is not set +# CONFIG_COMEDI is not set +# CONFIG_RTLLIB is not set +CONFIG_R8712U=m +# CONFIG_R8188EU is not set +# CONFIG_RTS5139 is not set +# CONFIG_TRANZPORT is not set +# CONFIG_LINE6_USB is not set +# CONFIG_USB_SERIAL_QUATECH2 is not set +CONFIG_VT6656=m +# CONFIG_USB_ENESTORAGE is not set +# CONFIG_BCM_WIMAX is not set +# CONFIG_FT1000 is not set + +# +# Speakup console speech +# +# CONFIG_SPEAKUP is not set +# CONFIG_TOUCHSCREEN_CLEARPAD_TM1217 is not set +# CONFIG_TOUCHSCREEN_SYNAPTICS_I2C_RMI4 is not set +CONFIG_STAGING_MEDIA=y +CONFIG_DVB_AS102=m +# CONFIG_VIDEO_GO7007 is not set +# CONFIG_USB_MSI3101 is not set +# CONFIG_VIDEO_TCM825X is not set +# CONFIG_USB_SN9C102 is not set +# CONFIG_LIRC_STAGING is not set + +# +# Android +# +CONFIG_ANDROID=y +CONFIG_ANDROID_BINDER_IPC=y +# CONFIG_ANDROID_BINDER_IPC_32BIT is not set +CONFIG_ASHMEM=y +CONFIG_ANDROID_LOGGER=y +CONFIG_ANDROID_TIMED_OUTPUT=y +# CONFIG_ANDROID_TIMED_GPIO is not set +CONFIG_ANDROID_LOW_MEMORY_KILLER=y +CONFIG_ANDROID_LOW_MEMORY_KILLER_AUTODETECT_OOM_ADJ_VALUES=y +# CONFIG_ANDROID_INTF_ALARM_DEV is not set +CONFIG_SYNC=y +CONFIG_SW_SYNC=y +# CONFIG_SW_SYNC_USER is not set +CONFIG_ION=y +# CONFIG_ION_TEST is not set +# CONFIG_ION_DUMMY is not set +# CONFIG_FIQ_DEBUGGER is not set +# CONFIG_FIQ_WATCHDOG is not set +# CONFIG_USB_WPAN_HCD is not set +# CONFIG_WIMAX_GDM72XX is not set +# CONFIG_LTE_GDM724X is not set +# CONFIG_CED1401 is not set +# CONFIG_DGRP is not set +# CONFIG_MTD_SPINAND_MT29F is not set +# CONFIG_LUSTRE_FS is not set +# CONFIG_XILLYBUS is not set +# CONFIG_DGAP is not set +CONFIG_CLKDEV_LOOKUP=y +CONFIG_HAVE_CLK_PREPARE=y +CONFIG_COMMON_CLK=y + +# +# Common Clock Framework +# +CONFIG_COMMON_CLK_VERSATILE=y +# CONFIG_COMMON_CLK_SI5351 is not set +# CONFIG_COMMON_CLK_SI570 is not set +CONFIG_COMMON_CLK_XGENE=y +CONFIG_COMMON_CLK_SCPI=y +# CONFIG_COMMON_CLK_QCOM is not set + +# +# Hardware Spinlock drivers +# +CONFIG_CLKSRC_OF=y +CONFIG_ARM_ARCH_TIMER=y +CONFIG_ARM_ARCH_TIMER_EVTSTREAM=y +CONFIG_MAILBOX=y +# CONFIG_PL320_MBOX is not set +CONFIG_IOMMU_SUPPORT=y +CONFIG_OF_IOMMU=y +# CONFIG_ARM_SMMU is not set + +# +# Remoteproc drivers +# +# CONFIG_STE_MODEM_RPROC is not set + +# +# Rpmsg drivers +# +# CONFIG_PM_DEVFREQ is not set +# CONFIG_EXTCON is not set +# CONFIG_MEMORY is not set +# CONFIG_IIO is not set +CONFIG_PWM=y +CONFIG_PWM_SYSFS=y +# CONFIG_PWM_PCA9685 is not set +CONFIG_IRQCHIP=y +CONFIG_ARM_GIC=y +CONFIG_ARM_GIC_V3=y +# CONFIG_IPACK_BUS is not set +CONFIG_RESET_CONTROLLER=y +# CONFIG_FMC is not set + +# +# PHY Subsystem +# +# CONFIG_GENERIC_PHY is not set +# CONFIG_PHY_EXYNOS_MIPI_VIDEO is not set +# CONFIG_PHY_EXYNOS_DP_VIDEO is not set +# CONFIG_POWERCAP is not set + +# +# File systems +# +CONFIG_DCACHE_WORD_ACCESS=y +# CONFIG_EXT2_FS is not set +# CONFIG_EXT3_FS is not set +CONFIG_EXT4_FS=y +CONFIG_EXT4_USE_FOR_EXT23=y +# CONFIG_EXT4_FS_POSIX_ACL is not set +# CONFIG_EXT4_FS_SECURITY is not set +# CONFIG_EXT4_DEBUG is not set +CONFIG_JBD2=y +# CONFIG_JBD2_DEBUG is not set +CONFIG_FS_MBCACHE=y +# CONFIG_REISERFS_FS is not set +# CONFIG_JFS_FS is not set +# CONFIG_XFS_FS is not set +# CONFIG_GFS2_FS is not set +CONFIG_BTRFS_FS=y +CONFIG_BTRFS_FS_POSIX_ACL=y +# CONFIG_BTRFS_FS_CHECK_INTEGRITY is not set +CONFIG_BTRFS_FS_RUN_SANITY_TESTS=y +# CONFIG_BTRFS_DEBUG is not set +# CONFIG_BTRFS_ASSERT is not set +# CONFIG_NILFS2_FS is not set +CONFIG_FS_POSIX_ACL=y +CONFIG_EXPORTFS=y +CONFIG_FILE_LOCKING=y +CONFIG_FSNOTIFY=y +CONFIG_DNOTIFY=y +CONFIG_INOTIFY_USER=y +# CONFIG_FANOTIFY is not set +CONFIG_QUOTA=y +# CONFIG_QUOTA_NETLINK_INTERFACE is not set +CONFIG_PRINT_QUOTA_WARNING=y +# CONFIG_QUOTA_DEBUG is not set +CONFIG_QUOTA_TREE=y +# CONFIG_QFMT_V1 is not set +CONFIG_QFMT_V2=y +CONFIG_QUOTACTL=y +CONFIG_AUTOFS4_FS=m +CONFIG_FUSE_FS=m +# CONFIG_CUSE is not set +CONFIG_OVERLAYFS_FS=y + +# +# Caches +# +# CONFIG_FSCACHE is not set + +# +# CD-ROM/DVD Filesystems +# +CONFIG_ISO9660_FS=y +CONFIG_JOLIET=y +CONFIG_ZISOFS=y +CONFIG_UDF_FS=y +CONFIG_UDF_NLS=y + +# +# DOS/FAT/NT Filesystems +# +CONFIG_FAT_FS=y +# CONFIG_MSDOS_FS is not set +CONFIG_VFAT_FS=y +CONFIG_FAT_DEFAULT_CODEPAGE=437 +CONFIG_FAT_DEFAULT_IOCHARSET="ascii" +# CONFIG_NTFS_FS is not set + +# +# Pseudo filesystems +# +CONFIG_PROC_FS=y +CONFIG_PROC_KCORE=y +CONFIG_PROC_SYSCTL=y +CONFIG_PROC_PAGE_MONITOR=y +CONFIG_SYSFS=y +CONFIG_TMPFS=y +CONFIG_TMPFS_POSIX_ACL=y +CONFIG_TMPFS_XATTR=y +# CONFIG_HUGETLBFS is not set +# CONFIG_HUGETLB_PAGE is not set +# CONFIG_CONFIGFS_FS is not set +CONFIG_MISC_FILESYSTEMS=y +# CONFIG_ADFS_FS is not set +# CONFIG_AFFS_FS is not set +# CONFIG_ECRYPT_FS is not set +CONFIG_HFS_FS=y +CONFIG_HFSPLUS_FS=y +# CONFIG_HFSPLUS_FS_POSIX_ACL is not set +# CONFIG_BEFS_FS is not set +# CONFIG_BFS_FS is not set +# CONFIG_EFS_FS is not set +# CONFIG_JFFS2_FS is not set +# CONFIG_LOGFS is not set +# CONFIG_CRAMFS is not set +CONFIG_SQUASHFS=y +CONFIG_SQUASHFS_FILE_CACHE=y +# CONFIG_SQUASHFS_FILE_DIRECT is not set +CONFIG_SQUASHFS_DECOMP_SINGLE=y +# CONFIG_SQUASHFS_DECOMP_MULTI is not set +# CONFIG_SQUASHFS_DECOMP_MULTI_PERCPU is not set +CONFIG_SQUASHFS_XATTR=y +CONFIG_SQUASHFS_ZLIB=y +CONFIG_SQUASHFS_LZO=y +CONFIG_SQUASHFS_XZ=y +# CONFIG_SQUASHFS_4K_DEVBLK_SIZE is not set +# CONFIG_SQUASHFS_EMBEDDED is not set +CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE=3 +# CONFIG_VXFS_FS is not set +# CONFIG_MINIX_FS is not set +# CONFIG_OMFS_FS is not set +# CONFIG_HPFS_FS is not set +# CONFIG_QNX4FS_FS is not set +# CONFIG_QNX6FS_FS is not set +# CONFIG_ROMFS_FS is not set +# CONFIG_PSTORE is not set +# CONFIG_SYSV_FS is not set +# CONFIG_UFS_FS is not set +CONFIG_F2FS_FS=y +CONFIG_F2FS_STAT_FS=y +# CONFIG_F2FS_FS_XATTR is not set +# CONFIG_F2FS_CHECK_FS is not set +# CONFIG_AUFS_FS is not set +CONFIG_NETWORK_FILESYSTEMS=y +CONFIG_NFS_FS=y +CONFIG_NFS_V2=y +CONFIG_NFS_V3=y +# CONFIG_NFS_V3_ACL is not set +CONFIG_NFS_V4=y +CONFIG_NFS_SWAP=y +CONFIG_NFS_V4_1=y +# CONFIG_NFS_V4_2 is not set +CONFIG_PNFS_FILE_LAYOUT=y +CONFIG_NFS_V4_1_IMPLEMENTATION_ID_DOMAIN="kernel.org" +# CONFIG_NFS_V4_1_MIGRATION is not set +CONFIG_ROOT_NFS=y +# CONFIG_NFS_USE_LEGACY_DNS is not set +CONFIG_NFS_USE_KERNEL_DNS=y +# CONFIG_NFSD is not set +CONFIG_LOCKD=y +CONFIG_LOCKD_V4=y +CONFIG_NFS_COMMON=y +CONFIG_SUNRPC=y +CONFIG_SUNRPC_GSS=y +CONFIG_SUNRPC_BACKCHANNEL=y +CONFIG_SUNRPC_SWAP=y +# CONFIG_SUNRPC_DEBUG is not set +# CONFIG_CEPH_FS is not set +CONFIG_CIFS=y +CONFIG_CIFS_STATS=y +CONFIG_CIFS_STATS2=y +# CONFIG_CIFS_WEAK_PW_HASH is not set +# CONFIG_CIFS_UPCALL is not set +# CONFIG_CIFS_XATTR is not set +# CONFIG_CIFS_DEBUG is not set +# CONFIG_CIFS_DFS_UPCALL is not set +# CONFIG_CIFS_SMB2 is not set +# CONFIG_NCP_FS is not set +# CONFIG_CODA_FS is not set +# CONFIG_AFS_FS is not set +CONFIG_NLS=y +CONFIG_NLS_DEFAULT="utf8" +CONFIG_NLS_CODEPAGE_437=y +# CONFIG_NLS_CODEPAGE_737 is not set +# CONFIG_NLS_CODEPAGE_775 is not set +# CONFIG_NLS_CODEPAGE_850 is not set +# CONFIG_NLS_CODEPAGE_852 is not set +# CONFIG_NLS_CODEPAGE_855 is not set +# CONFIG_NLS_CODEPAGE_857 is not set +# CONFIG_NLS_CODEPAGE_860 is not set +# CONFIG_NLS_CODEPAGE_861 is not set +# CONFIG_NLS_CODEPAGE_862 is not set +# CONFIG_NLS_CODEPAGE_863 is not set +# CONFIG_NLS_CODEPAGE_864 is not set +# CONFIG_NLS_CODEPAGE_865 is not set +# CONFIG_NLS_CODEPAGE_866 is not set +# CONFIG_NLS_CODEPAGE_869 is not set +# CONFIG_NLS_CODEPAGE_936 is not set +# CONFIG_NLS_CODEPAGE_950 is not set +# CONFIG_NLS_CODEPAGE_932 is not set +# CONFIG_NLS_CODEPAGE_949 is not set +# CONFIG_NLS_CODEPAGE_874 is not set +# CONFIG_NLS_ISO8859_8 is not set +# CONFIG_NLS_CODEPAGE_1250 is not set +# CONFIG_NLS_CODEPAGE_1251 is not set +CONFIG_NLS_ASCII=y +CONFIG_NLS_ISO8859_1=y +# CONFIG_NLS_ISO8859_2 is not set +# CONFIG_NLS_ISO8859_3 is not set +# CONFIG_NLS_ISO8859_4 is not set +# CONFIG_NLS_ISO8859_5 is not set +# CONFIG_NLS_ISO8859_6 is not set +# CONFIG_NLS_ISO8859_7 is not set +# CONFIG_NLS_ISO8859_9 is not set +# CONFIG_NLS_ISO8859_13 is not set +# CONFIG_NLS_ISO8859_14 is not set +# CONFIG_NLS_ISO8859_15 is not set +# CONFIG_NLS_KOI8_R is not set +# CONFIG_NLS_KOI8_U is not set +# CONFIG_NLS_MAC_ROMAN is not set +# CONFIG_NLS_MAC_CELTIC is not set +# CONFIG_NLS_MAC_CENTEURO is not set +# CONFIG_NLS_MAC_CROATIAN is not set +# CONFIG_NLS_MAC_CYRILLIC is not set +# CONFIG_NLS_MAC_GAELIC is not set +# CONFIG_NLS_MAC_GREEK is not set +# CONFIG_NLS_MAC_ICELAND is not set +# CONFIG_NLS_MAC_INUIT is not set +# CONFIG_NLS_MAC_ROMANIAN is not set +# CONFIG_NLS_MAC_TURKISH is not set +CONFIG_NLS_UTF8=y +# CONFIG_VIRTUALIZATION is not set + +# +# Kernel hacking +# + +# +# printk and dmesg options +# +CONFIG_PRINTK_TIME=y +CONFIG_DEFAULT_MESSAGE_LOGLEVEL=4 +# CONFIG_BOOT_PRINTK_DELAY is not set +# CONFIG_DYNAMIC_DEBUG is not set + +# +# Compile-time checks and compiler options +# +CONFIG_DEBUG_INFO=y +# CONFIG_DEBUG_INFO_REDUCED is not set +CONFIG_ENABLE_WARN_DEPRECATED=y +CONFIG_ENABLE_MUST_CHECK=y +CONFIG_FRAME_WARN=1024 +# CONFIG_STRIP_ASM_SYMS is not set +# CONFIG_READABLE_ASM is not set +# CONFIG_UNUSED_SYMBOLS is not set +CONFIG_DEBUG_FS=y +# CONFIG_HEADERS_CHECK is not set +# CONFIG_DEBUG_SECTION_MISMATCH is not set +CONFIG_ARCH_WANT_FRAME_POINTERS=y +CONFIG_FRAME_POINTER=y +# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set +CONFIG_MAGIC_SYSRQ=y +CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE=0x1 +CONFIG_DEBUG_KERNEL=y + +# +# Memory Debugging +# +# CONFIG_DEBUG_PAGEALLOC is not set +# CONFIG_DEBUG_OBJECTS is not set +# CONFIG_SLUB_DEBUG_ON is not set +# CONFIG_SLUB_STATS is not set +CONFIG_HAVE_DEBUG_KMEMLEAK=y +# CONFIG_DEBUG_KMEMLEAK is not set +# CONFIG_DEBUG_STACK_USAGE is not set +# CONFIG_DEBUG_VM is not set +# CONFIG_DEBUG_MEMORY_INIT is not set +# CONFIG_DEBUG_PER_CPU_MAPS is not set +# CONFIG_DEBUG_SHIRQ is not set + +# +# Debug Lockups and Hangs +# +# CONFIG_LOCKUP_DETECTOR is not set +# CONFIG_DETECT_HUNG_TASK is not set +# CONFIG_PANIC_ON_OOPS is not set +CONFIG_PANIC_ON_OOPS_VALUE=0 +CONFIG_PANIC_TIMEOUT=0 +CONFIG_SCHED_DEBUG=y +CONFIG_SCHEDSTATS=y +CONFIG_TIMER_STATS=y +CONFIG_DEBUG_PREEMPT=y + +# +# Lock Debugging (spinlocks, mutexes, etc...) +# +# CONFIG_DEBUG_RT_MUTEXES is not set +# CONFIG_RT_MUTEX_TESTER is not set +# CONFIG_DEBUG_SPINLOCK is not set +# CONFIG_DEBUG_MUTEXES is not set +# CONFIG_DEBUG_WW_MUTEX_SLOWPATH is not set +# CONFIG_DEBUG_LOCK_ALLOC is not set +# CONFIG_PROVE_LOCKING is not set +# CONFIG_LOCK_STAT is not set +# CONFIG_DEBUG_ATOMIC_SLEEP is not set +# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set +CONFIG_STACKTRACE=y +# CONFIG_DEBUG_KOBJECT is not set +CONFIG_HAVE_DEBUG_BUGVERBOSE=y +CONFIG_DEBUG_BUGVERBOSE=y +# CONFIG_DEBUG_WRITECOUNT is not set +# CONFIG_DEBUG_LIST is not set +# CONFIG_DEBUG_SG is not set +# CONFIG_DEBUG_NOTIFIERS is not set +# CONFIG_DEBUG_CREDENTIALS is not set + +# +# RCU Debugging +# +# CONFIG_PROVE_RCU_DELAY is not set +# CONFIG_SPARSE_RCU_POINTER is not set +# CONFIG_RCU_TORTURE_TEST is not set +CONFIG_RCU_CPU_STALL_TIMEOUT=60 +CONFIG_RCU_CPU_STALL_VERBOSE=y +# CONFIG_RCU_CPU_STALL_INFO is not set +CONFIG_RCU_TRACE=y +# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set +# CONFIG_NOTIFIER_ERROR_INJECTION is not set +# CONFIG_FAULT_INJECTION is not set +CONFIG_NOP_TRACER=y +CONFIG_HAVE_FUNCTION_TRACER=y +CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y +CONFIG_HAVE_DYNAMIC_FTRACE=y +CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y +CONFIG_HAVE_SYSCALL_TRACEPOINTS=y +CONFIG_HAVE_C_RECORDMCOUNT=y +CONFIG_TRACE_CLOCK=y +CONFIG_RING_BUFFER=y +CONFIG_EVENT_TRACING=y +CONFIG_CONTEXT_SWITCH_TRACER=y +CONFIG_TRACING=y +CONFIG_GENERIC_TRACER=y +CONFIG_TRACING_SUPPORT=y +CONFIG_FTRACE=y +CONFIG_FUNCTION_TRACER=y +CONFIG_FUNCTION_GRAPH_TRACER=y +# CONFIG_IRQSOFF_TRACER is not set +# CONFIG_PREEMPT_TRACER is not set +# CONFIG_SCHED_TRACER is not set +CONFIG_FTRACE_SYSCALLS=y +# CONFIG_TRACER_SNAPSHOT is not set +CONFIG_BRANCH_PROFILE_NONE=y +# CONFIG_PROFILE_ANNOTATED_BRANCHES is not set +# CONFIG_PROFILE_ALL_BRANCHES is not set +CONFIG_STACK_TRACER=y +# CONFIG_BLK_DEV_IO_TRACE is not set +# CONFIG_PROBE_EVENTS is not set +CONFIG_DYNAMIC_FTRACE=y +CONFIG_FUNCTION_PROFILER=y +CONFIG_FTRACE_MCOUNT_RECORD=y +# CONFIG_FTRACE_STARTUP_TEST is not set +# CONFIG_RING_BUFFER_BENCHMARK is not set +# CONFIG_RING_BUFFER_STARTUP_TEST is not set + +# +# Runtime Testing +# +# CONFIG_LKDTM is not set +# CONFIG_TEST_LIST_SORT is not set +# CONFIG_BACKTRACE_SELF_TEST is not set +# CONFIG_RBTREE_TEST is not set +# CONFIG_INTERVAL_TREE_TEST is not set +# CONFIG_PERCPU_TEST is not set +# CONFIG_ATOMIC64_SELFTEST is not set +# CONFIG_TEST_STRING_HELPERS is not set +# CONFIG_TEST_KSTRTOX is not set +# CONFIG_DMA_API_DEBUG is not set +# CONFIG_TEST_MODULE is not set +# CONFIG_TEST_USER_COPY is not set +# CONFIG_SAMPLES is not set +CONFIG_HAVE_ARCH_KGDB=y +# CONFIG_KGDB is not set +CONFIG_EARLY_PRINTK=y +# CONFIG_PID_IN_CONTEXTIDR is not set + +# +# Security options +# +CONFIG_KEYS=y +# CONFIG_PERSISTENT_KEYRINGS is not set +# CONFIG_BIG_KEYS is not set +# CONFIG_ENCRYPTED_KEYS is not set +# CONFIG_KEYS_DEBUG_PROC_KEYS is not set +# CONFIG_SECURITY_DMESG_RESTRICT is not set +# CONFIG_SECURITY is not set +CONFIG_SECURITYFS=y +CONFIG_DEFAULT_SECURITY_DAC=y +CONFIG_DEFAULT_SECURITY="" +CONFIG_XOR_BLOCKS=y +CONFIG_CRYPTO=y + +# +# Crypto core or helper +# +CONFIG_CRYPTO_ALGAPI=y +CONFIG_CRYPTO_ALGAPI2=y +CONFIG_CRYPTO_AEAD=y +CONFIG_CRYPTO_AEAD2=y +CONFIG_CRYPTO_BLKCIPHER=y +CONFIG_CRYPTO_BLKCIPHER2=y +CONFIG_CRYPTO_HASH=y +CONFIG_CRYPTO_HASH2=y +CONFIG_CRYPTO_RNG=y +CONFIG_CRYPTO_RNG2=y +CONFIG_CRYPTO_PCOMP2=y +CONFIG_CRYPTO_MANAGER=y +CONFIG_CRYPTO_MANAGER2=y +# CONFIG_CRYPTO_USER is not set +CONFIG_CRYPTO_MANAGER_DISABLE_TESTS=y +CONFIG_CRYPTO_GF128MUL=m +# CONFIG_CRYPTO_NULL is not set +# CONFIG_CRYPTO_PCRYPT is not set +CONFIG_CRYPTO_WORKQUEUE=y +# CONFIG_CRYPTO_CRYPTD is not set +CONFIG_CRYPTO_AUTHENC=y +# CONFIG_CRYPTO_TEST is not set + +# +# Authenticated Encryption with Associated Data +# +CONFIG_CRYPTO_CCM=y +# CONFIG_CRYPTO_GCM is not set +CONFIG_CRYPTO_SEQIV=y + +# +# Block modes +# +CONFIG_CRYPTO_CBC=y +CONFIG_CRYPTO_CTR=y +# CONFIG_CRYPTO_CTS is not set +CONFIG_CRYPTO_ECB=y +CONFIG_CRYPTO_LRW=m +CONFIG_CRYPTO_PCBC=y +CONFIG_CRYPTO_XTS=m + +# +# Hash modes +# +CONFIG_CRYPTO_CMAC=y +CONFIG_CRYPTO_HMAC=y +# CONFIG_CRYPTO_XCBC is not set +# CONFIG_CRYPTO_VMAC is not set + +# +# Digest +# +CONFIG_CRYPTO_CRC32C=y +# CONFIG_CRYPTO_CRC32 is not set +CONFIG_CRYPTO_CRCT10DIF=y +# CONFIG_CRYPTO_GHASH is not set +CONFIG_CRYPTO_MD4=y +CONFIG_CRYPTO_MD5=y +# CONFIG_CRYPTO_MICHAEL_MIC is not set +# CONFIG_CRYPTO_RMD128 is not set +# CONFIG_CRYPTO_RMD160 is not set +# CONFIG_CRYPTO_RMD256 is not set +# CONFIG_CRYPTO_RMD320 is not set +CONFIG_CRYPTO_SHA1=m +CONFIG_CRYPTO_SHA256=y +# CONFIG_CRYPTO_SHA512 is not set +# CONFIG_CRYPTO_TGR192 is not set +# CONFIG_CRYPTO_WP512 is not set + +# +# Ciphers +# +CONFIG_CRYPTO_AES=y +# CONFIG_CRYPTO_ANUBIS is not set +CONFIG_CRYPTO_ARC4=y +# CONFIG_CRYPTO_BLOWFISH is not set +# CONFIG_CRYPTO_CAMELLIA is not set +# CONFIG_CRYPTO_CAST5 is not set +# CONFIG_CRYPTO_CAST6 is not set +CONFIG_CRYPTO_DES=y +# CONFIG_CRYPTO_FCRYPT is not set +# CONFIG_CRYPTO_KHAZAD is not set +# CONFIG_CRYPTO_SALSA20 is not set +# CONFIG_CRYPTO_SEED is not set +# CONFIG_CRYPTO_SERPENT is not set +# CONFIG_CRYPTO_TEA is not set +# CONFIG_CRYPTO_TWOFISH is not set + +# +# Compression +# +CONFIG_CRYPTO_DEFLATE=y +# CONFIG_CRYPTO_ZLIB is not set +CONFIG_CRYPTO_LZO=y +# CONFIG_CRYPTO_LZ4 is not set +# CONFIG_CRYPTO_LZ4HC is not set + +# +# Random Number Generation +# +CONFIG_CRYPTO_ANSI_CPRNG=m +# CONFIG_CRYPTO_USER_API_HASH is not set +# CONFIG_CRYPTO_USER_API_SKCIPHER is not set +CONFIG_CRYPTO_HW=y +# CONFIG_ASYMMETRIC_KEY_TYPE is not set +# CONFIG_ARM64_CRYPTO is not set +CONFIG_BINARY_PRINTF=y + +# +# Library routines +# +CONFIG_RAID6_PQ=y +CONFIG_BITREVERSE=y +CONFIG_GENERIC_STRNCPY_FROM_USER=y +CONFIG_GENERIC_STRNLEN_USER=y +CONFIG_GENERIC_NET_UTILS=y +CONFIG_GENERIC_PCI_IOMAP=y +CONFIG_GENERIC_IOMAP=y +CONFIG_GENERIC_IO=y +CONFIG_ARCH_USE_CMPXCHG_LOCKREF=y +CONFIG_CRC_CCITT=y +CONFIG_CRC16=y +CONFIG_CRC_T10DIF=y +CONFIG_CRC_ITU_T=y +CONFIG_CRC32=y +# CONFIG_CRC32_SELFTEST is not set +CONFIG_CRC32_SLICEBY8=y +# CONFIG_CRC32_SLICEBY4 is not set +# CONFIG_CRC32_SARWATE is not set +# CONFIG_CRC32_BIT is not set +# CONFIG_CRC7 is not set +CONFIG_LIBCRC32C=y +# CONFIG_CRC8 is not set +CONFIG_AUDIT_GENERIC=y +# CONFIG_RANDOM32_SELFTEST is not set +CONFIG_ZLIB_INFLATE=y +CONFIG_ZLIB_DEFLATE=y +CONFIG_LZO_COMPRESS=y +CONFIG_LZO_DECOMPRESS=y +CONFIG_XZ_DEC=y +# CONFIG_XZ_DEC_X86 is not set +# CONFIG_XZ_DEC_POWERPC is not set +# CONFIG_XZ_DEC_IA64 is not set +# CONFIG_XZ_DEC_ARM is not set +# CONFIG_XZ_DEC_ARMTHUMB is not set +# CONFIG_XZ_DEC_SPARC is not set +# CONFIG_XZ_DEC_BCJ is not set +# CONFIG_XZ_DEC_TEST is not set +CONFIG_DECOMPRESS_GZIP=y +CONFIG_DECOMPRESS_BZIP2=y +CONFIG_DECOMPRESS_LZMA=y +CONFIG_DECOMPRESS_XZ=y +CONFIG_DECOMPRESS_LZO=y +CONFIG_GENERIC_ALLOCATOR=y +CONFIG_ASSOCIATIVE_ARRAY=y +CONFIG_HAS_IOMEM=y +CONFIG_HAS_DMA=y +CONFIG_CPU_RMAP=y +CONFIG_DQL=y +CONFIG_NLATTR=y +CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE=y +CONFIG_AVERAGE=y +# CONFIG_CORDIC is not set +# CONFIG_DDR is not set +CONFIG_LIBFDT=y +CONFIG_OID_REGISTRY=y +CONFIG_FONT_SUPPORT=y +# CONFIG_FONTS is not set +CONFIG_FONT_8x8=y +CONFIG_FONT_8x16=y diff --git a/projects/Odroid_C2/options b/projects/Odroid_C2/options new file mode 100644 index 00000000000..510a72c3799 --- /dev/null +++ b/projects/Odroid_C2/options @@ -0,0 +1,144 @@ +################################################################################ +# setup system defaults +################################################################################ + + # The TARGET_CPU variable controls which processor should be targeted for + # generated code. + case $TARGET_ARCH in + arm64) + # TARGET_CPU: + # arm2 arm250 arm3 arm6 arm60 arm600 arm610 arm620 arm7 arm7m arm7d + # arm7dm arm7di arm7dmi arm70 arm700 arm700i arm710 arm710c + # arm7100 arm720 arm7500 arm7500fe arm7tdmi arm7tdmi-s arm710t + # arm720t arm740t strongarm strongarm110 strongarm1100 + # strongarm1110 arm8 arm810 arm9 arm9e arm920 arm920t arm922t + # arm946e-s arm966e-s arm968e-s arm926ej-s arm940t arm9tdmi + # arm10tdmi arm1020t arm1026ej-s arm10e arm1020e arm1022e + # arm1136j-s arm1136jf-s mpcore mpcorenovfp arm1156t2-s + # arm1176jz-s arm1176jzf-s cortex-a8 cortex-a9 cortex-r4 + # cortex-r4f cortex-m3 cortex-m1 xscale iwmmxt iwmmxt2 ep9312. + TARGET_CPU="cortex-a53" + ;; + esac + + # Bootloader to use (syslinux / u-boot / bcm2835-bootloader) + BOOTLOADER="u-boot" + + # u-boot version to use (default) + UBOOT_VERSION="hardkernel" + + # Configuration for u-boot + UBOOT_CONFIG="odroidc2_defconfig" + + # Target Configfile for u-boot + UBOOT_CONFIGFILE="boot.ini" + + # Kernel target for u-boot (default 'uImage' if BOOTLOADER=u-boot) (uImage / zImage) + KERNEL_TARGET="Image" + + # Kernel extra targets to build + KERNEL_UBOOT_EXTRA_TARGET="" + + # Additional kernel make parameters (for example to specify the u-boot loadaddress) + KERNEL_MAKE_EXTRACMD="dtbs" + + # Kernel to use. values can be: + # default: default mainline kernel + LINUX="hardkernel" + +################################################################################ +# setup build defaults +################################################################################ + + # Build optimizations (size/normal) + OPTIMIZATIONS="size" + + # Project CFLAGS + PROJECT_CFLAGS="" + + # LTO (Link Time Optimization) support + LTO_SUPPORT="yes" + + # GOLD (Google Linker) support + GOLD_SUPPORT="yes" + + # SquashFS compression method (gzip / lzo / xz) + SQUASHFS_COMPRESSION="lzo" + +################################################################################ +# setup project defaults +################################################################################ + + # build and install ALSA Audio support (yes / no) + ALSA_SUPPORT="yes" + + # OpenGL(X) implementation to use (no / Mesa) + OPENGL="no" + + # OpenGL-ES implementation to use (no / bcm2835-driver / gpu-viv-bin-mx6q / opengl-meson) + OPENGLES="opengl-meson" + + # Amlogic Meson SOC family (8 / 6 / gxbb) + MESON_FAMILY="gxbb" + + # include uvesafb support (yes / no) + UVESAFB_SUPPORT="no" + + # Displayserver to use (x11 / no) + DISPLAYSERVER="no" + + # Windowmanager to use (ratpoison / fluxbox / none) + WINDOWMANAGER="none" + + # Xorg Graphic drivers to use (all / i915,i965,r200,r300,r600,nvidia,nouveau) + # Space separated list is supported, + # e.g. GRAPHIC_DRIVERS="i915 i965 r300 r600 radeonsi nvidia nouveau" + GRAPHIC_DRIVERS="" + + # KODI Player implementation to use (default / bcm2835-driver / libfslvpuwrap / libamcodec) + KODIPLAYER_DRIVER="libamcodec" + + # Modules to install in initramfs for early boot + INITRAMFS_MODULES="" + + # additional drivers to install: + # for a list of additinoal drivers see packages/linux-drivers + # Space separated list is supported, + # e.g. ADDITIONAL_DRIVERS="DRIVER1 DRIVER2" + ADDITIONAL_DRIVERS="RTL8192CU RTL8192DU RTL8188EU RTL8192EU RTL8812AU" + + # additional Firmware to use (dvb-firmware, misc-firmware, wlan-firmware) + # Space separated list is supported, + # e.g. FIRMWARE="dvb-firmware misc-firmware wlan-firmware" + FIRMWARE="misc-firmware wlan-firmware dvb-firmware" + + # build and install ATV IR remote support (yes / no) + ATVCLIENT_SUPPORT="no" + + # build and install IRServer IR/LCD support (yes / no) + IRSERVER_SUPPORT="no" + + # Amlogic IR remote support (yes / no) + AMREMOTE_SUPPORT="no" + + # Odroid IR remote support (yes / no) + ODROIDREMOTE_SUPPORT="yes" + + # build with swap support (yes / no) + SWAP_SUPPORT="no" + + # swap support enabled per default (yes / no) + SWAP_ENABLED_DEFAULT="no" + + # swapfile size if SWAP_SUPPORT=yes in MB + SWAPFILESIZE="128" + + # build with installer (yes / no) + INSTALLER_SUPPORT="no" + + # kernel image name + KERNEL_NAME="KERNEL" + + # set the addon dirs + ADDON_PATH="$ADDON_VERSION/$PROJECT/$TARGET_ARCH" + ADDON_URL="$ADDON_SERVER_URL/$ADDON_PATH" diff --git a/projects/Odroid_C2/patches/RTL8192CU/RTL8192CU-0001_fix-build-with-linux-hardkernel.patch b/projects/Odroid_C2/patches/RTL8192CU/RTL8192CU-0001_fix-build-with-linux-hardkernel.patch new file mode 100644 index 00000000000..99bbcb1ba92 --- /dev/null +++ b/projects/Odroid_C2/patches/RTL8192CU/RTL8192CU-0001_fix-build-with-linux-hardkernel.patch @@ -0,0 +1,11 @@ +diff -Naur a/core/rtw_br_ext.c b/core/rtw_br_ext.c +--- a/core/rtw_br_ext.c 2013-09-11 05:56:55.000000000 +0200 ++++ b/core/rtw_br_ext.c 2016-02-10 08:06:48.999417391 +0100 +@@ -51,6 +51,7 @@ + #include <linux/icmpv6.h> + #include <net/ndisc.h> + #include <net/checksum.h> ++#include <net/ip6_checksum.h> + #endif + #endif + diff --git a/projects/Odroid_C2/patches/RTL8192EU/RTL8192EU-0001-fix-build-with-linux-hardkernel.patch b/projects/Odroid_C2/patches/RTL8192EU/RTL8192EU-0001-fix-build-with-linux-hardkernel.patch new file mode 100644 index 00000000000..e94ddaa65ea --- /dev/null +++ b/projects/Odroid_C2/patches/RTL8192EU/RTL8192EU-0001-fix-build-with-linux-hardkernel.patch @@ -0,0 +1,11 @@ +diff -Naur a/core/rtw_br_ext.c b/core/rtw_br_ext.c +--- a/core/rtw_br_ext.c 2016-01-18 10:56:14.000000000 -0800 ++++ b/core/rtw_br_ext.c 2016-04-08 00:55:50.276738518 -0700 +@@ -49,6 +49,7 @@ + #include <linux/icmpv6.h> + #include <net/ndisc.h> + #include <net/checksum.h> ++#include <net/ip6_checksum.h> + #endif + #endif + diff --git a/projects/Odroid_C2/patches/RTL8812AU/RTL8812AU-0001-fix-build-with-linux-hardkernel.patch b/projects/Odroid_C2/patches/RTL8812AU/RTL8812AU-0001-fix-build-with-linux-hardkernel.patch new file mode 100644 index 00000000000..51620cfe0c8 --- /dev/null +++ b/projects/Odroid_C2/patches/RTL8812AU/RTL8812AU-0001-fix-build-with-linux-hardkernel.patch @@ -0,0 +1,11 @@ +diff -Naur a/core/rtw_br_ext.c b/core/rtw_br_ext.c +--- a/core/rtw_br_ext.c 2015-11-09 10:47:51.000000000 -0800 ++++ b/core/rtw_br_ext.c 2016-04-08 00:58:47.861273878 -0700 +@@ -49,6 +49,7 @@ + #include <linux/icmpv6.h> + #include <net/ndisc.h> + #include <net/checksum.h> ++#include <net/ip6_checksum.h> + #endif + #endif + diff --git a/projects/Odroid_C2/patches/eventlircd/eventlircd-0001-without-werror.patch b/projects/Odroid_C2/patches/eventlircd/eventlircd-0001-without-werror.patch new file mode 100644 index 00000000000..a3443c2e106 --- /dev/null +++ b/projects/Odroid_C2/patches/eventlircd/eventlircd-0001-without-werror.patch @@ -0,0 +1,11 @@ +diff -Naur a/configure.ac b/configure.ac +--- a/configure.ac 2016-02-10 07:28:43.854521022 +0100 ++++ b/configure.ac 2016-02-10 07:42:40.195015151 +0100 +@@ -126,7 +126,6 @@ + AX_C_CHECK_FLAG([-pedantic],[],[],[CFLAGS="$CFLAGS -pedantic"],[]) + AX_C_CHECK_FLAG([-flto],[],[],[CFLAGS="$CFLAGS -flto"],[]) + AX_C_CHECK_FLAG([-fvisibility=hidden],[],[],[CFLAGS="$CFLAGS -fvisibility=hidden"],[]) +-AX_C_CHECK_FLAG([-Werror],[],[],[CFLAGS="$CFLAGS -Werror"],[]) + AX_C_CHECK_FLAG([-Wall],[],[],[CFLAGS="$CFLAGS -Wall"],[]) + AX_C_CHECK_FLAG([-Wextra],[],[],[CFLAGS="$CFLAGS -Wextra"],[]) + AX_C_CHECK_FLAG([-Wcast-qual],[],[],[CFLAGS="$CFLAGS -Wcast-qual"],[]) diff --git a/projects/Odroid_C2/patches/kodi/kodi-0001-owersun-odroid.patch b/projects/Odroid_C2/patches/kodi/kodi-0001-owersun-odroid.patch new file mode 100644 index 00000000000..c770793cb58 --- /dev/null +++ b/projects/Odroid_C2/patches/kodi/kodi-0001-owersun-odroid.patch @@ -0,0 +1,2704 @@ +From 7433b6824809ece337a4e8060db409558edd3074 Mon Sep 17 00:00:00 2001 +From: Owersun <owersun@gmail.com> +Date: Sat, 23 Apr 2016 22:34:30 +0200 +Subject: [PATCH] Odroids: All the codecs and display drivers + +--- + configure.ac | 49 +- + m4/xbmc_arch.m4 | 6 + + xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp | 39 +- + .../VideoPlayer/DVDCodecs/DVDFactoryCodec.cpp | 5 + + .../cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp | 18 +- + .../DVDCodecs/Video/DVDVideoCodecMFC.cpp | 585 +++++++++++++++++++++ + .../VideoPlayer/DVDCodecs/Video/DVDVideoCodecMFC.h | 64 +++ + xbmc/cores/VideoPlayer/DVDCodecs/Video/Makefile.in | 5 +- + xbmc/linux/LinuxV4l2Sink.cpp | 311 +++++++++++ + xbmc/linux/LinuxV4l2Sink.h | 71 +++ + xbmc/linux/Makefile.in | 1 + + xbmc/utils/AMLUtils.cpp | 93 +++- + xbmc/utils/CPUInfo.cpp | 25 +- + xbmc/windowing/X11/WinSystemX11.cpp | 2 +- + xbmc/windowing/egl/EGLNativeTypeAmlogic.cpp | 97 +++- + xbmc/windowing/egl/EGLNativeTypeAmlogic.h | 19 +- + xbmc/windowing/egl/EGLNativeTypeFbdev.cpp | 183 +++++++ + xbmc/windowing/egl/EGLNativeTypeFbdev.h | 68 +++ + xbmc/windowing/egl/EGLNativeTypeHybris.cpp | 279 ++++++++++ + xbmc/windowing/egl/EGLNativeTypeHybris.h | 77 +++ + xbmc/windowing/egl/EGLWrapper.cpp | 14 +- + xbmc/windowing/egl/Makefile.in | 4 + + 22 files changed, 1940 insertions(+), 75 deletions(-) + create mode 100644 xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecMFC.cpp + create mode 100644 xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecMFC.h + create mode 100644 xbmc/linux/LinuxV4l2Sink.cpp + create mode 100644 xbmc/linux/LinuxV4l2Sink.h + create mode 100644 xbmc/windowing/egl/EGLNativeTypeFbdev.cpp + create mode 100644 xbmc/windowing/egl/EGLNativeTypeFbdev.h + create mode 100644 xbmc/windowing/egl/EGLNativeTypeHybris.cpp + create mode 100644 xbmc/windowing/egl/EGLNativeTypeHybris.h + +diff --git a/configure.ac b/configure.ac +index 75cfc57..b3f2097 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -215,6 +215,10 @@ libbluetooth_enabled="== libbluetooth enabled. ==" + libbluetooth_disabled="== libbluetooth disabled. Bluetooth support will not be available. ==" + + ++# Odroid stuff ++hybris_enabled="== Libhybris enabled. ==" ++hybris_disabled="== Libhybris disabled. ==" ++ + AC_ARG_WITH([ffmpeg], + [AS_HELP_STRING([--with-ffmpeg], + [ffmpeg options: auto (search pkg-config or auto build), force (always build ffmpeg), shared (link dynamically), path_to_ffmpeg [default=force]])], +@@ -476,7 +480,7 @@ AC_ARG_ENABLE([breakpad], + + AC_ARG_ENABLE([codec], + [AS_HELP_STRING([--enable-codec], +- [enable additional codecs from a list of comma separated names, (default is none, choices are amcodec and imxvpu)])], ++ [enable additional codecs from a list of comma separated names, (default is none, choices are mfc, amcodec and imxvpu)])], + [add_codecs=$enableval], + [add_codecs=no]) + +@@ -487,6 +491,13 @@ AC_ARG_ENABLE([libav-compat], + [use_libav_hacks=$enableval], + [use_libav_hacks=no]) + ++# Odroid stuff ++AC_ARG_ENABLE([hybris], ++ [AS_HELP_STRING([--enable-hybris], ++ [enable use of Libhybris (default is no) 'Linux only'])], ++ [use_hybris=$enableval], ++ [use_hybris=no]) ++ + ### End of external library options + + if test "x$host_vendor" != "xapple"; then +@@ -622,6 +633,14 @@ case $host in + use_gl=no + USE_STATIC_FFMPEG=1 + ;; ++ aarch64-*-linux-gnu*) ++ target_platform=target_linux ++ ARCH="arm64" ++ use_arch="aarch64" ++ use_joystick=no ++ use_gles=yes ++ use_gl=no ++ ;; + arm*-*linux-android*) + target_platform=target_android + CORE_SYSTEM_NAME=android +@@ -1485,6 +1504,23 @@ else + AC_MSG_NOTICE($libcap_disabled) + fi + ++# Odroid stuff ++if test "x$use_hybris" != "xno"; then ++ AC_SUBST(ARCH_DEFINES, "-DTARGET_POSIX -DTARGET_LINUX -D_LINUX -DTARGET_HYBRIS") ++ USE_HYBRIS=1; ++ AC_DEFINE(HAS_EGLGLES, [1], [Define if supporting EGL based GLES Framebuffer]) ++ AC_DEFINE(HAS_HYBRIS, [1], [Define if supporting Hybris based systems]) ++ PKG_CHECK_MODULES([HWCOMPOSEREGL], [hwcomposer-egl >= 0.1], ++ [INCLUDES="$INCLUDES -I/usr/include/hybris $HWCOMPOSEREGL_CFLAGS"; LIBS="$LIBS $HWCOMPOSEREGL_LIBS"], ++ AC_MSG_ERROR($missing_library)) ++ PKG_CHECK_MODULES([HYBRISEGL], [hybris-egl-platform >= 0.1], ++ [INCLUDES="$INCLUDES $HYBRISEGL_CFLAGS"; LIBS="$LIBS $HYBRISEGL_LIBS"], ++ AC_MSG_ERROR($missing_library)) ++ PKG_CHECK_MODULES([LIBHARDWARE], [libhardware >= 0.1], ++ [INCLUDES="$INCLUDES $LIBHARDWARE_CFLAGS"; LIBS="$LIBS $LIBHARDWARE_LIBS -lsync -lmedia"], ++ AC_MSG_ERROR($missing_library)) ++fi ++ + # FFmpeg + FFMPEG_LIBNAMES="libavcodec >= 56.26.100 + libavfilter >= 5.11.102 +@@ -1707,6 +1743,9 @@ esac + # remember to convert commas to spaces + for codecs in `echo $add_codecs | sed 's/,/ /g'`; do + case $codecs in ++ *mfc*) ++ XB_ADD_CODEC([MFC], [mfc], [$codecs]) ++ ;; + *amcodec*) + AC_CHECK_HEADER([amcodec/codec_error.h],, AC_MSG_ERROR($missing_headers)) + XB_ADD_CODEC([LIBAMCODEC], [amcodec], [$codecs]) +@@ -2104,6 +2143,13 @@ else + final_message="$final_message\n additional codecs:\tNo" + fi + ++# Odroid stuff ++if test "x$use_hybris" != "xno"; then ++ final_message="$final_message\n Odroid Hybris support:\tYes" ++else ++ final_message="$final_message\n Odroid Hybris support:\tNo" ++fi ++ + ### External libraries messages + + if test "$host_vendor" = "apple" ; then +@@ -2298,6 +2344,7 @@ AC_SUBST(USE_MMAL) + AC_SUBST(USE_X11) + AC_SUBST(USE_OPTICAL_DRIVE) + AC_SUBST(USE_BREAKPAD) ++AC_SUBST(USE_HYBRIS) + AC_SUBST(CROSS_COMPILING) + + # pushd and popd are not available in other shells besides bash, so implement +diff --git a/m4/xbmc_arch.m4 b/m4/xbmc_arch.m4 +index fddae99..9456f9d 100644 +--- a/m4/xbmc_arch.m4 ++++ b/m4/xbmc_arch.m4 +@@ -26,6 +26,9 @@ case $build in + arm*-*-linux-gnu*|arm*-*-linux-uclibc*) + AC_SUBST(NATIVE_ARCH_DEFINES, "-DTARGET_POSIX -DTARGET_LINUX -D_LINUX") + ;; ++ aarch64-*-linux-gnu*) ++ AC_SUBST(NATIVE_ARCH_DEFINES, "-DTARGET_POSIX -DTARGET_LINUX -D_LINUX") ++ ;; + *) + AC_MSG_ERROR(unsupported native build platform: $build) + esac +@@ -63,6 +66,9 @@ case $host in + arm*-*-linux-gnu*|arm*-*-linux-uclibc*) + AC_SUBST(ARCH_DEFINES, "-DTARGET_POSIX -DTARGET_LINUX -D_LINUX") + ;; ++ aarch64-*-linux-gnu*) ++ AC_SUBST(ARCH_DEFINES, "-DTARGET_POSIX -DTARGET_LINUX -D_LINUX") ++ ;; + mips*-*-linux-gnu*|mips*-*-linux-uclibc*) + AC_SUBST(ARCH_DEFINES, "-DTARGET_POSIX -DTARGET_LINUX -D_LINUX") + ;; +diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp b/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp +index 95db8cf..420a6d3 100644 +--- a/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp ++++ b/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp +@@ -490,6 +490,7 @@ snd_pcm_chmap_t* CAESinkALSA::SelectALSAChannelMap(const CAEChannelInfo& info) + + void CAESinkALSA::GetAESParams(const AEAudioFormat& format, std::string& params) + { ++#if !defined(HAS_LIBAMCODEC) + if (m_passthrough) + params = "AES0=0x06"; + else +@@ -506,6 +507,7 @@ void CAESinkALSA::GetAESParams(const AEAudioFormat& format, std::string& params) + else if (format.m_sampleRate == 44100) params += ",AES3=0x00"; + else if (format.m_sampleRate == 32000) params += ",AES3=0x03"; + else params += ",AES3=0x01"; ++#endif + } + + bool CAESinkALSA::Initialize(AEAudioFormat &format, std::string &device) +@@ -744,16 +746,16 @@ bool CAESinkALSA::InitializeHW(const ALSAConfig &inconfig, ALSAConfig &outconfig + snd_pcm_hw_params_get_buffer_size_max(hw_params, &bufferSize); + snd_pcm_hw_params_get_period_size_max(hw_params, &periodSize, NULL); + +- /* +- We want to make sure, that we have max 200 ms Buffer with ++ /* ++ We want to make sure, that we have max 200 ms Buffer with + a periodSize of approx 50 ms. Choosing a higher bufferSize + will cause problems with menu sounds. Buffer will be increased + after those are fixed. + */ + periodSize = std::min(periodSize, (snd_pcm_uframes_t) sampleRate / 20); + bufferSize = std::min(bufferSize, (snd_pcm_uframes_t) sampleRate / 5); +- +- /* ++ ++ /* + According to upstream we should set buffer size first - so make sure it is always at least + 4x period size to not get underruns (some systems seem to have issues with only 2 periods) + */ +@@ -772,7 +774,7 @@ bool CAESinkALSA::InitializeHW(const ALSAConfig &inconfig, ALSAConfig &outconfig + snd_pcm_hw_params_copy(hw_params_copy, hw_params); // restore working copy + CLog::Log(LOGDEBUG, "CAESinkALSA::InitializeHW - Request: Failed to limit periodSize to %lu", periodSizeMax); + } +- ++ + // first trying bufferSize, PeriodSize + // for more info see here: + // http://mailman.alsa-project.org/pipermail/alsa-devel/2009-September/021069.html +@@ -782,22 +784,24 @@ bool CAESinkALSA::InitializeHW(const ALSAConfig &inconfig, ALSAConfig &outconfig + snd_pcm_uframes_t periodSizeTemp, bufferSizeTemp; + periodSizeTemp = periodSize; + bufferSizeTemp = bufferSize; +- if (snd_pcm_hw_params_set_buffer_size_near(m_pcm, hw_params_copy, &bufferSize) != 0 +- || snd_pcm_hw_params_set_period_size_near(m_pcm, hw_params_copy, &periodSize, NULL) != 0 ++ int dir = 0; ++ ++ if (snd_pcm_hw_params_set_period_size_near(m_pcm, hw_params_copy, &periodSize, &dir) != 0 ++ || snd_pcm_hw_params_set_buffer_size_near(m_pcm, hw_params_copy, &bufferSize) != 0 + || snd_pcm_hw_params(m_pcm, hw_params_copy) != 0) + { + bufferSize = bufferSizeTemp; + periodSize = periodSizeTemp; + // retry with PeriodSize, bufferSize + snd_pcm_hw_params_copy(hw_params_copy, hw_params); // restore working copy +- if (snd_pcm_hw_params_set_period_size_near(m_pcm, hw_params_copy, &periodSize, NULL) != 0 ++ if (snd_pcm_hw_params_set_period_size_near(m_pcm, hw_params_copy, &periodSize, &dir) != 0 + || snd_pcm_hw_params_set_buffer_size_near(m_pcm, hw_params_copy, &bufferSize) != 0 + || snd_pcm_hw_params(m_pcm, hw_params_copy) != 0) + { + // try only periodSize + periodSize = periodSizeTemp; + snd_pcm_hw_params_copy(hw_params_copy, hw_params); // restore working copy +- if(snd_pcm_hw_params_set_period_size_near(m_pcm, hw_params_copy, &periodSize, NULL) != 0 ++ if(snd_pcm_hw_params_set_period_size_near(m_pcm, hw_params_copy, &periodSize, &dir) != 0 + || snd_pcm_hw_params(m_pcm, hw_params_copy) != 0) + { + // try only BufferSize +@@ -819,7 +823,7 @@ bool CAESinkALSA::InitializeHW(const ALSAConfig &inconfig, ALSAConfig &outconfig + snd_pcm_get_params(m_pcm, &bufferSize, &periodSize); + } + } +- ++ + CLog::Log(LOGDEBUG, "CAESinkALSA::InitializeHW - Got: periodSize %lu, bufferSize %lu", periodSize, bufferSize); + + /* set the format parameters */ +@@ -1301,6 +1305,15 @@ void CAESinkALSA::EnumerateDevicesEx(AEDeviceInfoList &list, bool force) + + AEDeviceType CAESinkALSA::AEDeviceTypeFromName(const std::string &name) + { ++ ++#if defined(HAS_LIBAMCODEC) ++ // ugly workaround to show DTS / AC3 caps ++ // but don't run into multi channel issues ++ // as we can only open 2 pcm channels ++ // God, forgive me I wrote this ++ return AE_DEVTYPE_IEC958; ++#endif ++ + if (name.substr(0, 4) == "hdmi") + return AE_DEVTYPE_HDMI; + else if (name.substr(0, 6) == "iec958" || name.substr(0, 5) == "spdif") +@@ -1405,9 +1418,9 @@ void CAESinkALSA::EnumerateDevice(AEDeviceInfoList &list, const std::string &dev + + if (badHDMI) + { +- /* +- * Warn about disconnected devices, but keep them enabled +- * Detection can go wrong on Intel, Nvidia and on all ++ /* ++ * Warn about disconnected devices, but keep them enabled ++ * Detection can go wrong on Intel, Nvidia and on all + * AMD (fglrx) hardware, so it is not safe to close those + * handles + */ +diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/DVDFactoryCodec.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/DVDFactoryCodec.cpp +index 5206cfa..c73457b 100644 +--- a/xbmc/cores/VideoPlayer/DVDCodecs/DVDFactoryCodec.cpp ++++ b/xbmc/cores/VideoPlayer/DVDCodecs/DVDFactoryCodec.cpp +@@ -41,6 +41,9 @@ + #include "Video/DVDVideoCodecAndroidMediaCodec.h" + #include "platform/android/activity/AndroidFeatures.h" + #endif ++#if defined(HAS_MFC) ++#include "Video/DVDVideoCodecMFC.h" ++#endif + #include "Audio/DVDAudioCodecFFmpeg.h" + #include "Audio/DVDAudioCodecPassthrough.h" + #include "Overlay/DVDOverlayCodecSSA.h" +@@ -152,6 +155,8 @@ CDVDVideoCodec* CDVDFactoryCodec::CreateVideoCodec(CDVDStreamInfo &hint, CProces + pCodec = OpenCodec(new CDVDVideoCodecOpenMax(processInfo), hint, options); + #elif defined(HAS_MMAL) + pCodec = OpenCodec(new CMMALVideo(processInfo), hint, options); ++#elif defined(HAS_MFC) ++ pCodec = OpenCodec(new CDVDVideoCodecMFC(processInfo), hint, options); + #endif + if (pCodec) + return pCodec; +diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp +index 0a97893..f4c4bc5 100644 +--- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp ++++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp +@@ -361,7 +361,7 @@ void dumpfile_write(am_private_t *para, void* buf, int bufsiz) + } + + if (para->dumpdemux && para->dumpfile != -1) +- write(para->dumpfile, buf, bufsiz); ++ int ret = write(para->dumpfile, buf, bufsiz); + } + + /*************************************************************************/ +@@ -387,13 +387,14 @@ static int64_t get_pts_video() + + static int set_pts_pcrscr(int64_t value) + { ++ int ret; + int fd = open("/sys/class/tsync/pts_pcrscr", O_WRONLY); + if (fd >= 0) + { + char pts_str[64]; + unsigned long pts = (unsigned long)value; + sprintf(pts_str, "0x%lx", pts); +- write(fd, pts_str, strlen(pts_str)); ++ ret = write(fd, pts_str, strlen(pts_str)); + close(fd); + return 0; + } +@@ -714,7 +715,7 @@ int write_av_packet(am_private_t *para, am_packet_t *pkt) + } + pkt->newflag = 0; + } +- ++ + buf = pkt->data; + size = pkt->data_size ; + if (size == 0 && pkt->isvalid) { +@@ -1566,7 +1567,7 @@ bool CAMLCodec::OpenDecoder(CDVDStreamInfo &hints) + // h264 in an avi file + if (m_hints.ptsinvalid) + am_private->gcodec.param = (void*)(EXTERNAL_PTS | SYNC_OUTSIDE); +- break; ++ break; + case VFORMAT_REAL: + am_private->stream_type = AM_STREAM_RM; + am_private->vcodec.noblock = 1; +@@ -1631,7 +1632,7 @@ bool CAMLCodec::OpenDecoder(CDVDStreamInfo &hints) + + Create(); + +- m_display_rect = CRect(0, 0, CDisplaySettings::GetInstance().GetCurrentResolutionInfo().iWidth, CDisplaySettings::GetInstance().GetCurrentResolutionInfo().iHeight); ++ m_display_rect = CRect(0, 0, CDisplaySettings::GetInstance().GetCurrentResolutionInfo().iScreenWidth, CDisplaySettings::GetInstance().GetCurrentResolutionInfo().iScreenHeight); + + std::string strScaler; + SysfsUtils::GetString("/sys/class/ppmgr/ppscaler", strScaler); +@@ -2112,7 +2113,6 @@ void CAMLCodec::SetVideoRect(const CRect &SrcRect, const CRect &DestRect) + int diff = (int) ((dst_rect.Height() - dst_rect.Width()) / 2); + dst_rect = CRect(DestRect.x1 - diff, DestRect.y1, DestRect.x2 + diff, DestRect.y2); + } +- + } + + if (m_dst_rect != dst_rect) +@@ -2134,7 +2134,7 @@ void CAMLCodec::SetVideoRect(const CRect &SrcRect, const CRect &DestRect) + #ifdef TARGET_ANDROID + display = m_display_rect; + #else +- display = gui; ++ display = CRect(0, 0, CDisplaySettings::GetInstance().GetCurrentResolutionInfo().iScreenWidth, CDisplaySettings::GetInstance().GetCurrentResolutionInfo().iScreenHeight);; + #endif + if (gui != display) + { +@@ -2206,6 +2206,8 @@ void CAMLCodec::SetVideoRect(const CRect &SrcRect, const CRect &DestRect) + std::string s_gui = StringUtils::Format("%i,%i,%i,%i", + (int)gui.x1, (int)gui.y1, + (int)gui.Width(), (int)gui.Height()); ++ CLog::Log(LOGDEBUG, "CAMLCodec::SetVideoRect:SrcRect(%i,%i,%i,%i)", (int)SrcRect.x1, (int)SrcRect.y1, (int)SrcRect.Width(), (int)SrcRect.Height()); ++ CLog::Log(LOGDEBUG, "CAMLCodec::SetVideoRect:DestRect(%i,%i,%i,%i)", (int)DestRect.x1, (int)DestRect.y1, (int)DestRect.Width(), (int)DestRect.Height()); + CLog::Log(LOGDEBUG, "CAMLCodec::SetVideoRect:display(%s)", s_display.c_str()); + CLog::Log(LOGDEBUG, "CAMLCodec::SetVideoRect:gui(%s)", s_gui.c_str()); + CLog::Log(LOGDEBUG, "CAMLCodec::SetVideoRect:m_dst_rect(%s)", s_m_dst_rect.c_str()); +diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecMFC.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecMFC.cpp +new file mode 100644 +index 0000000..900c5d8 +--- /dev/null ++++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecMFC.cpp +@@ -0,0 +1,585 @@ ++#include "system.h" ++ ++#ifndef THIS_IS_NOT_XBMC ++ #if (defined HAVE_CONFIG_H) && (!defined WIN32) ++ #include "config.h" ++ #endif ++ #include "DVDDemuxers/DVDDemux.h" ++ #include "DVDStreamInfo.h" ++ #include "DVDClock.h" ++ #include "guilib/GraphicContext.h" ++ #include "DVDCodecs/DVDCodecs.h" ++ #include "DVDCodecs/DVDCodecUtils.h" ++ #include "settings/Settings.h" ++ #include "settings/DisplaySettings.h" ++ #include "settings/AdvancedSettings.h" ++ #include "utils/log.h" ++#endif ++ ++#include "DVDVideoCodecMFC.h" ++ ++#include <sys/mman.h> ++#include <sys/ioctl.h> ++#include <unistd.h> ++#include <sys/stat.h> ++#include <fcntl.h> ++#include <poll.h> ++#include <sys/mman.h> ++#include <dirent.h> ++ ++#ifdef CLASSNAME ++#undef CLASSNAME ++#endif ++#define CLASSNAME "CDVDVideoCodecMFC" ++ ++CDVDVideoCodecMFC::CDVDVideoCodecMFC(CProcessInfo &processInfo) : CDVDVideoCodec(processInfo) { ++ ++ m_iDecoderHandle = NULL; ++ m_iConverterHandle = NULL; ++ m_MFCOutput = NULL; ++ m_MFCCapture = NULL; ++ m_FIMCOutput = NULL; ++ m_FIMCCapture = NULL; ++ ++ m_Buffer = NULL; ++ m_BufferNowOnScreen = NULL; ++ ++ memzero(m_videoBuffer); ++ ++} ++ ++CDVDVideoCodecMFC::~CDVDVideoCodecMFC() { ++ ++ Dispose(); ++ ++} ++ ++bool CDVDVideoCodecMFC::OpenDevices() { ++ DIR *dir; ++ ++ if ((dir = opendir ("/sys/class/video4linux/")) != NULL) { ++ struct dirent *ent; ++ while ((ent = readdir (dir)) != NULL) { ++ if (strncmp(ent->d_name, "video", 5) == 0) { ++ char *p; ++ char name[64]; ++ char devname[64]; ++ char sysname[64]; ++ char drivername[32]; ++ char target[1024]; ++ int ret; ++ ++ snprintf(sysname, 64, "/sys/class/video4linux/%s", ent->d_name); ++ snprintf(name, 64, "/sys/class/video4linux/%s/name", ent->d_name); ++ ++ FILE* fp = fopen(name, "r"); ++ if (fgets(drivername, 32, fp) != NULL) { ++ p = strchr(drivername, '\n'); ++ if (p != NULL) ++ *p = '\0'; ++ } else { ++ fclose(fp); ++ continue; ++ } ++ fclose(fp); ++ ++ ret = readlink(sysname, target, sizeof(target)); ++ if (ret < 0) ++ continue; ++ target[ret] = '\0'; ++ p = strrchr(target, '/'); ++ if (p == NULL) ++ continue; ++ ++ sprintf(devname, "/dev/%s", ++p); ++ ++ if (!m_iDecoderHandle && strstr(drivername, "mfc") != NULL && strstr(drivername, "dec") != NULL) { ++ int fd = open(devname, O_RDWR | O_NONBLOCK, 0); ++ if (fd > -1) { ++ struct v4l2_capability cap; ++ memzero(cap); ++ if (ioctl(fd, VIDIOC_QUERYCAP, &cap) == 0) ++ if (cap.capabilities & V4L2_CAP_STREAMING && ++ (cap.capabilities & V4L2_CAP_VIDEO_M2M_MPLANE || ++ (cap.capabilities & (V4L2_CAP_VIDEO_CAPTURE_MPLANE | V4L2_CAP_VIDEO_OUTPUT_MPLANE)))) { ++ m_iDecoderHandle = new V4l2Device; ++ m_iDecoderHandle->device = fd; ++ strcpy(m_iDecoderHandle->name, drivername); ++ CLog::Log(LOGDEBUG, "%s::%s - MFC Found %s %s", CLASSNAME, __func__, drivername, devname); ++ struct v4l2_format fmt; ++ memzero(fmt); ++ fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; ++ fmt.fmt.pix_mp.pixelformat = V4L2_PIX_FMT_NV12M; ++ if (ioctl(fd, VIDIOC_TRY_FMT, &fmt) == 0) { ++ CLog::Log(LOGDEBUG, "%s::%s - Direct decoding to untiled picture on device %s is supported, no conversion needed", CLASSNAME, __func__, m_iDecoderHandle->name); ++ delete m_iConverterHandle; ++ m_iConverterHandle = NULL; ++ return true; ++ } ++ } ++ } ++ if (!m_iDecoderHandle) ++ close(fd); ++ } ++ if (!m_iConverterHandle && strstr(drivername, "fimc") != NULL && strstr(drivername, "m2m") != NULL) { ++ int fd = open(devname, O_RDWR | O_NONBLOCK, 0); ++ if (fd > -1) { ++ struct v4l2_capability cap; ++ memzero(cap); ++ if (ioctl(fd, VIDIOC_QUERYCAP, &cap) == 0) ++ if (cap.capabilities & V4L2_CAP_STREAMING && ++ (cap.capabilities & V4L2_CAP_VIDEO_M2M_MPLANE || ++ (cap.capabilities & (V4L2_CAP_VIDEO_CAPTURE_MPLANE | V4L2_CAP_VIDEO_OUTPUT_MPLANE)))) { ++ m_iConverterHandle = new V4l2Device; ++ m_iConverterHandle->device = fd; ++ strcpy(m_iConverterHandle->name, drivername); ++ CLog::Log(LOGDEBUG, "%s::%s - FIMC Found %s %s", CLASSNAME, __func__, drivername, devname); ++ } ++ } ++ if (!m_iConverterHandle) ++ close(fd); ++ } ++ if (m_iDecoderHandle && m_iConverterHandle) { ++ closedir (dir); ++ return true; ++ } ++ } ++ } ++ closedir (dir); ++ } ++ ++ return false; ++ ++} ++ ++void CDVDVideoCodecMFC::Dispose() { ++ ++ CLog::Log(LOGDEBUG, "%s::%s - Starting cleanup", CLASSNAME, __func__); ++ ++ delete m_BufferNowOnScreen; ++ delete m_Buffer; ++ ++ m_Buffer = NULL; ++ m_BufferNowOnScreen = NULL; ++ ++ delete m_FIMCCapture; ++ delete m_FIMCOutput; ++ delete m_MFCCapture; ++ delete m_MFCOutput; ++ ++ m_MFCOutput = NULL; ++ m_MFCCapture = NULL; ++ m_FIMCOutput = NULL; ++ m_FIMCCapture = NULL; ++ ++ if (m_iConverterHandle) { ++ close(m_iConverterHandle->device); ++ delete m_iConverterHandle; ++ m_iConverterHandle = NULL; ++ } ++ ++ if (m_iDecoderHandle) { ++ close(m_iDecoderHandle->device); ++ delete m_iDecoderHandle; ++ m_iDecoderHandle = NULL; ++ } ++ ++} ++ ++bool CDVDVideoCodecMFC::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options) { ++ struct v4l2_format fmt; ++ struct v4l2_crop crop; ++ struct V4l2SinkBuffer sinkBuffer; ++ V4l2Device *finalSink = NULL; ++ int finalFormat = -1; ++ int resultVideoWidth; ++ int resultVideoHeight; ++ int resultLineSize; ++ unsigned int extraSize = 0; ++ uint8_t *extraData = NULL; ++ ++ m_hints = hints; ++ if (m_hints.software) ++ return false; ++ ++ Dispose(); ++ ++ m_Buffer = new V4l2SinkBuffer(); ++ m_BufferNowOnScreen = new V4l2SinkBuffer(); ++ m_BufferNowOnScreen->iIndex = -1; ++ m_bVideoConvert = false; ++ m_bDropPictures = false; ++ memzero(m_videoBuffer); ++ ++ if (!OpenDevices()) { ++ CLog::Log(LOGERROR, "%s::%s - No Exynos MFC Decoder/Converter found", CLASSNAME, __func__); ++ return false; ++ } ++ ++ m_bVideoConvert = m_converter.Open(m_hints.codec, (uint8_t *)m_hints.extradata, m_hints.extrasize, true); ++ ++ if(m_bVideoConvert) { ++ if(m_converter.GetExtraData() != NULL && m_converter.GetExtraSize() > 0) { ++ extraSize = m_converter.GetExtraSize(); ++ extraData = m_converter.GetExtraData(); ++ } ++ } else { ++ if(m_hints.extrasize > 0 && m_hints.extradata != NULL) { ++ extraSize = m_hints.extrasize; ++ extraData = (uint8_t*)m_hints.extradata; ++ } ++ } ++ ++ // Test what formats we can get finally ++ // If converter is present, it is our final sink ++ (m_iConverterHandle) ? finalSink = m_iConverterHandle : finalSink = m_iDecoderHandle; ++ // Test NV12 2 Planes Y/CbCr ++ memzero(fmt); ++ fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; ++ fmt.fmt.pix_mp.pixelformat = V4L2_PIX_FMT_NV12M; ++ if (ioctl(finalSink->device, VIDIOC_TRY_FMT, &fmt) == 0) ++ finalFormat = V4L2_PIX_FMT_NV12M; ++ memzero(fmt); ++/* ++ // Test YUV420 3 Planes Y/Cb/Cr ++ fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; ++ fmt.fmt.pix_mp.pixelformat = V4L2_PIX_FMT_YUV420M; ++ if (ioctl(finalSink->device, VIDIOC_TRY_FMT, &fmt) == 0) ++ finalFormat = V4L2_PIX_FMT_YUV420M; ++*/ ++ ++ // No suitable output formats available ++ if (finalFormat < 0) { ++ CLog::Log(LOGERROR, "%s::%s - No suitable format on %s to convert to found", CLASSNAME, __func__, finalSink->name); ++ return false; ++ } ++ ++ // Create MFC Output sink (the one where encoded frames are feed) ++ m_MFCOutput = new CLinuxV4l2Sink(m_iDecoderHandle, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE); ++ memzero(fmt); ++ switch(m_hints.codec) ++ { ++ case AV_CODEC_ID_VC1: ++ fmt.fmt.pix_mp.pixelformat = V4L2_PIX_FMT_VC1_ANNEX_G; ++ m_name = "mfc-vc1"; ++ break; ++ case AV_CODEC_ID_MPEG1VIDEO: ++ fmt.fmt.pix_mp.pixelformat = V4L2_PIX_FMT_MPEG1; ++ m_name = "mfc-mpeg1"; ++ break; ++ case AV_CODEC_ID_MPEG2VIDEO: ++ fmt.fmt.pix_mp.pixelformat = V4L2_PIX_FMT_MPEG2; ++ m_name = "mfc-mpeg2"; ++ break; ++ case AV_CODEC_ID_MPEG4: ++ fmt.fmt.pix_mp.pixelformat = V4L2_PIX_FMT_MPEG4; ++ m_name = "mfc-mpeg4"; ++ break; ++ case AV_CODEC_ID_H263: ++ fmt.fmt.pix_mp.pixelformat = V4L2_PIX_FMT_H263; ++ m_name = "mfc-h263"; ++ break; ++ case AV_CODEC_ID_H264: ++ fmt.fmt.pix_mp.pixelformat = V4L2_PIX_FMT_H264; ++ m_name = "mfc-h264"; ++ break; ++ default: ++ return false; ++ break; ++ } ++ fmt.fmt.pix_mp.plane_fmt[0].sizeimage = BUFFER_SIZE; ++ // Set encoded format ++ if (!m_MFCOutput->SetFormat(&fmt)) ++ return false; ++ // Init with number of input buffers predefined ++ if (!m_MFCOutput->Init(INPUT_BUFFERS)) ++ return false; ++ ++ // Get empty buffer to fill ++ if (!m_MFCOutput->GetBuffer(&sinkBuffer)) ++ return false; ++ // Fill it with the header ++ sinkBuffer.iBytesUsed[0] = extraSize; ++ memcpy(sinkBuffer.cPlane[0], extraData, extraSize); ++ // Enqueue buffer ++ if (!m_MFCOutput->PushBuffer(&sinkBuffer)) ++ return false; ++ ++ // Create MFC Capture sink (the one from which decoded frames are read) ++ m_MFCCapture = new CLinuxV4l2Sink(m_iDecoderHandle, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE); ++ memzero(fmt); ++ // If there is no converter set output format on the MFC Capture sink ++ if (!m_iConverterHandle) { ++ fmt.fmt.pix_mp.pixelformat = finalFormat; ++ if (!m_MFCCapture->SetFormat(&fmt)) ++ return false; ++ } ++ ++ // Turn on MFC Output with header in it to initialize MFC with all we just setup ++ m_MFCOutput->StreamOn(VIDIOC_STREAMON); ++ ++ // Initialize MFC Capture ++ if (!m_MFCCapture->Init(0)) ++ return false; ++ // Queue all buffers (empty) to MFC Capture ++ m_MFCCapture->QueueAll(); ++ ++ // Read the format of MFC Capture ++ if (!m_MFCCapture->GetFormat(&fmt)) ++ return false; ++ // Size of resulting picture coming out of MFC ++ // It will be aligned by 16 since the picture is tiled ++ // We need this to know where to split buffer line by line ++ resultLineSize = fmt.fmt.pix_mp.width; ++ // Get MFC capture crop settings ++ if (!m_MFCCapture->GetCrop(&crop)) ++ return false; ++ // This is the picture boundaries we are interested in, everything outside is alignement because of tiled MFC output ++ resultVideoWidth = crop.c.width; ++ resultVideoHeight = crop.c.height; ++ ++ // Turn on MFC Capture ++ m_MFCCapture->StreamOn(VIDIOC_STREAMON); ++ ++ // If converter is needed (we need to untile the picture from format MFC produces it) ++ if (m_iConverterHandle) { ++ // Create FIMC Output sink ++ m_FIMCOutput = new CLinuxV4l2Sink(m_iConverterHandle, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE); ++ // Set the FIMC Output format to the one read from MFC ++ if (!m_FIMCOutput->SetFormat(&fmt)) ++ return false; ++ // Set the FIMC Output crop to the one read from MFC ++ if (!m_FIMCOutput->SetCrop(&crop)) ++ return false; ++ // Init FIMC Output and link it to buffers of MFC Capture ++ if (!m_FIMCOutput->Init(m_MFCCapture)) ++ return false; ++ // Get FIMC Output crop settings ++ if (!m_FIMCOutput->GetCrop(&crop)) ++ return false; ++ ++ // Create FIMC Capture sink ++ m_FIMCCapture = new CLinuxV4l2Sink(m_iConverterHandle, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE); ++ // Set the final picture format and the same picture dimension settings to FIMC Capture ++ // as picture crop coming from MFC (original picture dimensions) ++ memzero(fmt); ++ fmt.fmt.pix_mp.pixelformat = finalFormat; ++ fmt.fmt.pix_mp.width = crop.c.width; ++ fmt.fmt.pix_mp.height = crop.c.height; ++ fmt.fmt.pix_mp.field = V4L2_FIELD_ANY; ++ if (!m_FIMCCapture->SetFormat(&fmt)) ++ return false; ++ // Init FIMC capture with number of buffers predefined ++ if (!m_FIMCCapture->Init(OUTPUT_BUFFERS)) ++ return false; ++ ++ // Queue all buffers (empty) to FIMC Capture ++ m_FIMCCapture->QueueAll(); ++ ++ // Read FIMC capture format settings ++ if (!m_FIMCCapture->GetFormat(&fmt)) ++ return false; ++ resultLineSize = fmt.fmt.pix_mp.width; ++ // Read FIMC capture crop settings ++ if (!m_FIMCCapture->GetCrop(&crop)) ++ return false; ++ resultVideoWidth = crop.c.width; ++ resultVideoHeight = crop.c.height; ++ ++ // Turn on FIMC Output and Capture enabling the converter ++ m_FIMCOutput->StreamOn(VIDIOC_STREAMON); ++ m_FIMCCapture->StreamOn(VIDIOC_STREAMON); ++ } ++ ++ m_videoBuffer.iFlags = DVP_FLAG_ALLOCATED; ++ ++ m_videoBuffer.color_range = 0; ++ m_videoBuffer.color_matrix = 4; ++ ++ m_videoBuffer.iDisplayWidth = resultVideoWidth; ++ m_videoBuffer.iDisplayHeight = resultVideoHeight; ++ m_videoBuffer.iWidth = resultVideoWidth; ++ m_videoBuffer.iHeight = resultVideoHeight; ++ ++ m_videoBuffer.data[0] = NULL; ++ m_videoBuffer.data[1] = NULL; ++ m_videoBuffer.data[2] = NULL; ++ m_videoBuffer.data[3] = NULL; ++ ++ m_videoBuffer.pts = DVD_NOPTS_VALUE; ++ m_videoBuffer.dts = DVD_NOPTS_VALUE; ++ ++ m_videoBuffer.iLineSize[0] = resultLineSize; ++ m_videoBuffer.iLineSize[3] = 0; ++ ++ if (finalFormat == V4L2_PIX_FMT_NV12M) { ++ m_videoBuffer.format = RENDER_FMT_NV12; ++ m_videoBuffer.iLineSize[1] = resultLineSize; ++ m_videoBuffer.iLineSize[2] = 0; ++ } else if (finalFormat == V4L2_PIX_FMT_YUV420M) { ++ /* ++ Due to BUG in MFC v8 (-XU3) firmware the Y plane of the picture has the right line size, ++ but the U and V planes line sizes are actually halves of Y plane line size padded to 32 ++ This is pure workaround for -XU3 MFCv8 firmware "MFC v8.0, F/W: 14yy, 01mm, 13dd (D) ++ Seems that only MPEG2 is affected ++ */ ++ // Only on -XU3 there are no converter, but the output format can be YUV420 ++ // So this is the easiest way to distinguish -XU3 from -U3 with FIMC ++ if (!m_iConverterHandle && m_hints.codec == AV_CODEC_ID_MPEG2VIDEO) ++ resultLineSize = resultLineSize + (32 - resultLineSize%32); ++ ++ m_videoBuffer.format = RENDER_FMT_YUV420P; ++ m_videoBuffer.iLineSize[1] = resultLineSize >> 1; ++ m_videoBuffer.iLineSize[2] = resultLineSize >> 1; ++ } ++ ++ m_BufferNowOnScreen->iIndex = -1; ++ m_bCodecHealthy = true; ++ ++ CLog::Log(LOGNOTICE, "%s::%s - MFC Setup succesfull (%dx%d, linesize %d, format 0x%x), start streaming", CLASSNAME, __func__, resultVideoWidth, resultVideoHeight, resultLineSize, finalFormat); ++ ++ return true; ++ ++} ++ ++void CDVDVideoCodecMFC::SetDropState(bool bDrop) { ++ ++ m_bDropPictures = bDrop; ++ if (m_bDropPictures) ++ m_videoBuffer.iFlags |= DVP_FLAG_DROPPED; ++ else ++ m_videoBuffer.iFlags &= ~DVP_FLAG_DROPPED; ++ ++} ++ ++int CDVDVideoCodecMFC::Decode(BYTE* pData, int iSize, double dts, double pts) { ++ ++ if (m_hints.ptsinvalid) ++ pts = DVD_NOPTS_VALUE; ++ ++ //unsigned int dtime = XbmcThreads::SystemClockMillis(); ++ debug_log(LOGDEBUG, "%s::%s - input frame iSize %d, pts %lf, dts %lf", CLASSNAME, __func__, iSize, pts, dts); ++ ++ if(pData) { ++ int demuxer_bytes = iSize; ++ uint8_t *demuxer_content = pData; ++ ++ if(m_bVideoConvert) { ++ m_converter.Convert(demuxer_content, demuxer_bytes); ++ demuxer_bytes = m_converter.GetConvertSize(); ++ demuxer_content = m_converter.GetConvertBuffer(); ++ } ++ ++ m_MFCOutput->Poll(1000/3); // Wait up to 0.3 of a second for buffer availability ++ if (m_MFCOutput->GetBuffer(m_Buffer)) { ++ debug_log(LOGDEBUG, "%s::%s - Got empty buffer %d from MFC Output, filling", CLASSNAME, __func__, m_Buffer->iIndex); ++ m_Buffer->iBytesUsed[0] = demuxer_bytes; ++ memcpy((uint8_t *)m_Buffer->cPlane[0], demuxer_content, m_Buffer->iBytesUsed[0]); ++ long* longPts = (long*)&pts; ++ m_Buffer->timeStamp.tv_sec = longPts[0]; ++ m_Buffer->timeStamp.tv_usec = longPts[1]; ++ ++ if (!m_MFCOutput->PushBuffer(m_Buffer)) { ++ m_bCodecHealthy = false; ++ return VC_FLUSHED; // MFC unrecoverable error, reset needed ++ } ++ } else { ++ if (errno == EAGAIN) ++ CLog::Log(LOGERROR, "%s::%s - MFC OUTPUT All buffers are queued and busy, no space for new frame to decode. Very broken situation. Current encoded frame will be lost", CLASSNAME, __func__); ++ else { ++ m_bCodecHealthy = false; ++ return VC_FLUSHED; // MFC unrecoverable error, reset needed ++ } ++ } ++ } ++ ++ // Get a buffer from MFC Capture ++ if (!m_MFCCapture->DequeueBuffer(m_Buffer)) { ++ if (errno == EAGAIN) ++ return VC_BUFFER; ++ else ++ return VC_ERROR; ++ } ++ ++ if (m_bDropPictures) { ++ ++ CLog::Log(LOGWARNING, "%s::%s - Dropping frame with index %d", CLASSNAME, __func__, m_Buffer->iIndex); ++ // Queue it back to MFC CAPTURE since the picture is dropped anyway ++ m_MFCCapture->PushBuffer(m_Buffer); ++ return VC_DROPPED | VC_BUFFER; ++ ++ } ++ ++ if (m_iConverterHandle) { ++ // Push the buffer got from MFC Capture to FIMC Output (decoded from decoder to converter) ++ if (!m_FIMCOutput->PushBuffer(m_Buffer)) { ++ m_bCodecHealthy = false; ++ return VC_FLUSHED; // FIMC unrecoverable error, reset needed ++ } ++ // Get a buffer from FIMC Capture ++ if (!m_FIMCCapture->DequeueBuffer(m_Buffer)) { ++ if (errno == EAGAIN) ++ return VC_BUFFER; ++ else ++ return VC_ERROR; ++ } ++ } ++ ++ // We got a new buffer to show, so we can enqeue back the buffer wich was on screen ++ if (m_BufferNowOnScreen->iIndex > -1) { ++ if (m_iConverterHandle) ++ m_FIMCCapture->PushBuffer(m_BufferNowOnScreen); ++ else ++ m_MFCCapture->PushBuffer(m_BufferNowOnScreen); ++ m_BufferNowOnScreen->iIndex = -1; ++ } ++ ++ long longPts[2] = { m_Buffer->timeStamp.tv_sec, m_Buffer->timeStamp.tv_usec }; ++ m_videoBuffer.data[0] = (BYTE*)m_Buffer->cPlane[0]; ++ m_videoBuffer.data[1] = (BYTE*)m_Buffer->cPlane[1]; ++ m_videoBuffer.data[2] = (BYTE*)m_Buffer->cPlane[2]; ++ m_videoBuffer.pts = *((double*)&longPts[0]); ++ ++ std::swap(m_Buffer, m_BufferNowOnScreen); ++ ++ if (m_iConverterHandle && m_FIMCOutput->DequeueBuffer(m_Buffer)) ++ m_MFCCapture->PushBuffer(m_Buffer); ++ ++ //debug_log("Decode time: %d", XbmcThreads::SystemClockMillis() - dtime); ++ // Picture is finally ready to be processed further and more info can be enqueued ++ return VC_PICTURE | VC_BUFFER; ++ ++} ++ ++void CDVDVideoCodecMFC::Reset() { ++ ++ if (m_bCodecHealthy) { ++ CLog::Log(LOGDEBUG, "%s::%s - Codec Reset requested, but codec is healthy, doing soft-flush", CLASSNAME, __func__); ++ m_MFCOutput->SoftRestart(); ++ m_MFCCapture->SoftRestart(); ++ if (!m_iConverterHandle) ++ m_BufferNowOnScreen->iIndex = -1; ++ } else { ++ CLog::Log(LOGERROR, "%s::%s - Codec Reset. Reinitializing", CLASSNAME, __func__); ++ CDVDCodecOptions options; ++ // We need full MFC/FIMC reset with device reopening. ++ // I wasn't able to reinitialize both IP's without fully closing and reopening them. ++ // There are always some clips that cause MFC or FIMC go into state which cannot be reset without close/open ++ Open(m_hints, options); ++ } ++ ++} ++ ++bool CDVDVideoCodecMFC::GetPicture(DVDVideoPicture* pDvdVideoPicture) { ++ ++ *pDvdVideoPicture = m_videoBuffer; ++ debug_log(LOGDEBUG, "%s::%s - output frame pts %lf", CLASSNAME, __func__, m_videoBuffer.pts); ++ return true; ++ ++} ++ ++bool CDVDVideoCodecMFC::ClearPicture(DVDVideoPicture* pDvdVideoPicture) { ++ ++ return CDVDVideoCodec::ClearPicture(pDvdVideoPicture); ++ ++} +diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecMFC.h b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecMFC.h +new file mode 100644 +index 0000000..679cf8c +--- /dev/null ++++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecMFC.h +@@ -0,0 +1,64 @@ ++#pragma once ++ ++#ifndef THIS_IS_NOT_XBMC ++ #include "DVDVideoCodec.h" ++ #include "DVDStreamInfo.h" ++ #include "utils/BitstreamConverter.h" ++ #include "xbmc/linux/LinuxV4l2Sink.h" ++#else ++ #include "xbmcstubs.h" ++ #include "LinuxV4l2Sink.h" ++#endif ++ ++#ifndef V4L2_CAP_VIDEO_M2M_MPLANE ++ #define V4L2_CAP_VIDEO_M2M_MPLANE 0x00004000 ++#endif ++ ++#define BUFFER_SIZE 1048576 // Compressed frame size. 1080p mpeg4 10Mb/s can be >256k in size, so this is to make sure frame fits into the buffer ++ // For very unknown reason lesser than 1Mb buffer causes MFC to corrupt its own setup, setting inapropriate values ++#define INPUT_BUFFERS 3 // 3 input buffers. 2 is enough almost for everything, but on some heavy videos 3 makes a difference ++#define OUTPUT_BUFFERS 3 // Triple buffering for smooth output ++ ++#define memzero(x) memset(&(x), 0, sizeof (x)) ++ ++class CDVDVideoCodecMFC : public CDVDVideoCodec ++{ ++public: ++ CDVDVideoCodecMFC(CProcessInfo &processInfo); ++ virtual ~CDVDVideoCodecMFC(); ++ virtual bool Open(CDVDStreamInfo &hints, CDVDCodecOptions &options); ++ virtual void Dispose(); ++ virtual int Decode(BYTE* pData, int iSize, double dts, double pts); ++ virtual void Reset(); ++ bool GetPictureCommon(DVDVideoPicture* pDvdVideoPicture); ++ virtual bool GetPicture(DVDVideoPicture* pDvdVideoPicture); ++ virtual bool ClearPicture(DVDVideoPicture* pDvdVideoPicture); ++ virtual void SetDropState(bool bDrop); ++ virtual const char* GetName() { return m_name.c_str(); }; // m_name is never changed after open ++ ++protected: ++ std::string m_name; ++ ++ bool m_bCodecHealthy; ++ ++ V4l2Device *m_iDecoderHandle; ++ V4l2Device *m_iConverterHandle; ++ ++ CLinuxV4l2Sink *m_MFCCapture; ++ CLinuxV4l2Sink *m_MFCOutput; ++ CLinuxV4l2Sink *m_FIMCCapture; ++ CLinuxV4l2Sink *m_FIMCOutput; ++ ++ V4l2SinkBuffer *m_Buffer; ++ V4l2SinkBuffer *m_BufferNowOnScreen; ++ ++ bool m_bVideoConvert; ++ CDVDStreamInfo m_hints; ++ ++ CBitstreamConverter m_converter; ++ bool m_bDropPictures; ++ ++ DVDVideoPicture m_videoBuffer; ++ ++ bool OpenDevices(); ++}; +diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/Makefile.in b/xbmc/cores/VideoPlayer/DVDCodecs/Video/Makefile.in +index 1bf5a89..46f7cc9 100644 +--- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/Makefile.in ++++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/Makefile.in +@@ -34,8 +34,11 @@ ifeq (@USE_MMAL@,1) + SRCS += MMALCodec.cpp MMALFFmpeg.cpp + endif + ++ifeq (@USE_MFC@,1) ++SRCS += DVDVideoCodecMFC.cpp ++endif ++ + LIB=Video.a + + include @abs_top_srcdir@/Makefile.include + -include $(patsubst %.cpp,%.P,$(patsubst %.c,%.P,$(SRCS))) +- +diff --git a/xbmc/linux/LinuxV4l2Sink.cpp b/xbmc/linux/LinuxV4l2Sink.cpp +new file mode 100644 +index 0000000..bd5201e +--- /dev/null ++++ b/xbmc/linux/LinuxV4l2Sink.cpp +@@ -0,0 +1,311 @@ ++#include "system.h" ++ ++#ifndef THIS_IS_NOT_XBMC ++ #if (defined HAVE_CONFIG_H) && (!defined WIN32) ++ #include "config.h" ++ #endif ++ ++ #include "utils/log.h" ++#endif ++ ++#include <sys/mman.h> ++#include <sys/ioctl.h> ++#include <unistd.h> ++#include <sys/stat.h> ++#include <fcntl.h> ++#include <poll.h> ++#include <sys/mman.h> ++#include <linux/media.h> ++ ++#include "LinuxV4l2Sink.h" ++ ++#ifdef CLASSNAME ++#undef CLASSNAME ++#endif ++#define CLASSNAME "CLinuxV4l2Sink" ++ ++CLinuxV4l2Sink::CLinuxV4l2Sink(V4l2Device *device, enum v4l2_buf_type type) { ++ CLog::Log(LOGDEBUG, "%s::%s - Creating Sink, Device %s, Type %d", CLASSNAME, __func__, device->name, type); ++ m_Device = device; ++ m_Type = type; ++ m_NumBuffers = 0; ++ m_NumPlanes = 0; ++ m_Addresses = NULL; ++ m_Buffers = NULL; ++ m_Planes = NULL; ++} ++ ++CLinuxV4l2Sink::~CLinuxV4l2Sink() { ++ CLog::Log(LOGDEBUG, "%s::%s - Destroying Sink, Device %s, Type %d", CLASSNAME, __func__, m_Device->name, m_Type); ++ ++ StreamOn(VIDIOC_STREAMOFF); ++ ++ if (m_Memory == V4L2_MEMORY_MMAP) ++ for (int i = 0; i < m_NumBuffers*m_NumPlanes; i++) ++ if(m_Addresses[i] != (unsigned long)MAP_FAILED) ++ if (munmap((void *)m_Addresses[i], m_Planes[i].length) == 0) ++ CLog::Log(LOGDEBUG, "%s::%s - Device %s, Munmapped Plane %d size %u at 0x%lx", CLASSNAME, __func__, m_Device->name, i, m_Planes[i].length, m_Addresses[i]); ++ if (m_Planes) ++ delete[] m_Planes; ++ if (m_Buffers) ++ delete[] m_Buffers; ++ if (m_Addresses) ++ delete[] m_Addresses; ++} ++ ++// Init for MMAP buffers ++bool CLinuxV4l2Sink::Init(int buffersCount = 0) { ++ CLog::Log(LOGDEBUG, "%s::%s - Device %s, Type %d, Init MMAP %d buffers", CLASSNAME, __func__, m_Device->name, m_Type, buffersCount); ++ m_Memory = V4L2_MEMORY_MMAP; ++ ++ struct v4l2_format format; ++ if (!GetFormat(&format)) ++ return false; ++ ++ if (buffersCount == 0 && m_Type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) { ++ struct v4l2_control ctrl; ++ ctrl.id = V4L2_CID_MIN_BUFFERS_FOR_CAPTURE; ++ if (ioctl(m_Device->device, VIDIOC_G_CTRL, &ctrl)) { ++ CLog::Log(LOGERROR, "%s::%s - Device %s, Type %d, Error getting number of buffers for capture (V4L2_CID_MIN_BUFFERS_FOR_CAPTURE VIDIOC_G_CTRL)", CLASSNAME, __func__, m_Device->name, m_Type); ++ return false; ++ } ++ buffersCount = (int)(ctrl.value * 1.5); //Most of the time we need 50% more extra capture buffers than device reported would be enough ++ } ++ ++ m_NumBuffers = RequestBuffers(buffersCount); ++ if (m_NumBuffers < 1) ++ return false; ++ m_Buffers = new v4l2_buffer[m_NumBuffers]; ++ m_Planes = new v4l2_plane[m_NumPlanes * m_NumBuffers]; ++ m_Addresses = new unsigned long[m_NumPlanes * m_NumBuffers]; ++ if (!QueryBuffers()) ++ return false; ++ if (!MmapBuffers()) ++ return false; ++ return true; ++} ++// Init for USERPTR buffers ++bool CLinuxV4l2Sink::Init(CLinuxV4l2Sink *sink) { ++ CLog::Log(LOGDEBUG, "%s::%s - Device %s, Type %d, Init UserPTR", CLASSNAME, __func__, m_Device->name, m_Type); ++ m_Memory = V4L2_MEMORY_USERPTR; ++ ++ struct v4l2_format format; ++ if (!GetFormat(&format)) ++ return false; ++ ++ m_NumBuffers = sink->m_NumBuffers; ++ m_NumBuffers = RequestBuffers(m_NumBuffers); ++ if (m_NumBuffers < 1) ++ return false; ++ m_Buffers = new v4l2_buffer[m_NumBuffers]; ++ m_Planes = new v4l2_plane[m_NumPlanes * m_NumBuffers]; ++ m_Addresses = new unsigned long[m_NumPlanes * m_NumBuffers]; ++ if (!QueryBuffers()) ++ return false; ++ for (int i = 0; i < m_NumPlanes * m_NumBuffers; i++) { ++ m_Addresses[i] = sink->m_Addresses[i]; ++ m_Planes[i].m.userptr = m_Addresses[i]; ++ } ++ return true; ++} ++ ++void CLinuxV4l2Sink::SoftRestart() { ++ StreamOn(VIDIOC_STREAMOFF); ++ ++ while (!iFreeBuffers.empty()) ++ iFreeBuffers.pop(); ++ for (int i = 0; i < m_NumBuffers; i++) ++ iFreeBuffers.push(m_Buffers[i].index); ++ ++ if (m_Type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) ++ QueueAll(); ++ ++ StreamOn(VIDIOC_STREAMON); ++} ++ ++bool CLinuxV4l2Sink::GetFormat(v4l2_format *format) { ++ memset(format, 0, sizeof(struct v4l2_format)); ++ format->type = m_Type; ++ if (ioctl(m_Device->device, VIDIOC_G_FMT, format)) { ++ CLog::Log(LOGERROR, "%s::%s - Error getting sink format. Device %s, Type %d. (VIDIOC_G_FMT)", CLASSNAME, __func__, m_Device->name, m_Type); ++ return false; ++ } ++ m_NumPlanes = format->fmt.pix_mp.num_planes; ++ CLog::Log(LOGDEBUG, "%s::%s - G_FMT Device %s, Type %d format 0x%x (%dx%d), planes=%d, plane[0]=%d plane[1]=%d, plane[2]=%d", CLASSNAME, __func__, m_Device->name, format->type, format->fmt.pix_mp.pixelformat, format->fmt.pix_mp.width, format->fmt.pix_mp.height, format->fmt.pix_mp.num_planes, format->fmt.pix_mp.plane_fmt[0].sizeimage, format->fmt.pix_mp.plane_fmt[1].sizeimage, format->fmt.pix_mp.plane_fmt[2].sizeimage); ++ return true; ++} ++ ++bool CLinuxV4l2Sink::SetFormat(v4l2_format *format) { ++ format->type = m_Type; ++ CLog::Log(LOGDEBUG, "%s::%s - S_FMT Device %s, Type %d format 0x%x (%dx%d), planes=%d, plane[0]=%d plane[1]=%d, plane[2]=%d", CLASSNAME, __func__, m_Device->name, format->type, format->fmt.pix_mp.pixelformat, format->fmt.pix_mp.width, format->fmt.pix_mp.height, format->fmt.pix_mp.num_planes, format->fmt.pix_mp.plane_fmt[0].sizeimage, format->fmt.pix_mp.plane_fmt[1].sizeimage, format->fmt.pix_mp.plane_fmt[2].sizeimage); ++ if (ioctl(m_Device->device, VIDIOC_S_FMT, format)) { ++ CLog::Log(LOGERROR, "%s::%s - Error setting sink format. Device %s, Type %d. (VIDIOC_G_FMT)", CLASSNAME, __func__, m_Device->name, m_Type); ++ return false; ++ } ++ return true; ++} ++ ++bool CLinuxV4l2Sink::GetCrop(v4l2_crop *crop) { ++ memset(crop, 0, sizeof(struct v4l2_crop)); ++ crop->type = m_Type; ++ if (ioctl(m_Device->device, VIDIOC_G_CROP, crop)) { ++ CLog::Log(LOGERROR, "%s::%s - Error getting sink crop. Device %s, Type %d. (VIDIOC_G_CROP)", CLASSNAME, __func__, m_Device->name, m_Type); ++ return false; ++ } ++ CLog::Log(LOGDEBUG, "%s::%s - G_CROP Device %s, Type %d, crop (%dx%d)", CLASSNAME, __func__, m_Device->name, crop->type, crop->c.width, crop->c.height); ++ return true; ++} ++ ++bool CLinuxV4l2Sink::SetCrop(v4l2_crop *crop) { ++ crop->type = m_Type; ++ CLog::Log(LOGDEBUG, "%s::%s - S_CROP Device %s, Type %d, crop (%dx%d)", CLASSNAME, __func__, m_Device->name, crop->type, crop->c.width, crop->c.height); ++ if (ioctl(m_Device->device, VIDIOC_S_CROP, crop)) { ++ CLog::Log(LOGERROR, "%s::%s - Error setting sink crop. Device %s, Type %d. (VIDIOC_G_CROP)", CLASSNAME, __func__, m_Device->name, m_Type); ++ return false; ++ } ++ return true; ++} ++ ++int CLinuxV4l2Sink::RequestBuffers(int buffersCount) { ++ CLog::Log(LOGDEBUG, "%s::%s - Device %s, Type %d, Memory %d, RequestBuffers %d", CLASSNAME, __func__, m_Device->name, m_Type, m_Memory, buffersCount); ++ struct v4l2_requestbuffers reqbuf; ++ memset(&reqbuf, 0, sizeof(struct v4l2_requestbuffers)); ++ reqbuf.type = m_Type; ++ reqbuf.memory = m_Memory; ++ reqbuf.count = buffersCount; ++ ++ if (ioctl(m_Device->device, VIDIOC_REQBUFS, &reqbuf)) { ++ CLog::Log(LOGERROR, "%s::%s - Error requesting buffers. Device %s, Type %d, Memory %d. (VIDIOC_REQBUFS)", CLASSNAME, __func__, m_Device->name, m_Type, m_Memory); ++ return V4L2_ERROR; ++ } ++ ++ CLog::Log(LOGDEBUG, "%s::%s - Device %s, Type %d, Memory %d, Buffers allowed %d", CLASSNAME, __func__, m_Device->name, m_Type, m_Memory, reqbuf.count); ++ return reqbuf.count; ++} ++ ++bool CLinuxV4l2Sink::QueryBuffers() { ++ memset(m_Buffers, 0, m_NumBuffers * sizeof(struct v4l2_buffer)); ++ memset(m_Planes, 0, m_NumBuffers * m_NumPlanes * sizeof(struct v4l2_plane)); ++ ++ for(int i = 0; i < m_NumBuffers; i++) { ++ m_Buffers[i].type = m_Type; ++ m_Buffers[i].memory = m_Memory; ++ m_Buffers[i].index = i; ++ m_Buffers[i].m.planes = &m_Planes[i*m_NumPlanes]; ++ m_Buffers[i].length = m_NumPlanes; ++ ++ if (ioctl(m_Device->device, VIDIOC_QUERYBUF, &m_Buffers[i])) { ++ CLog::Log(LOGERROR, "%s::%s - Error querying buffers. Device %s, Type %d, Memory %d. (VIDIOC_QUERYBUF)", CLASSNAME, __func__, m_Device->name, m_Type, m_Memory); ++ return false; ++ } ++ ++ iFreeBuffers.push(m_Buffers[i].index); ++ } ++ return true; ++} ++ ++bool CLinuxV4l2Sink::MmapBuffers() { ++ for(int i = 0; i < m_NumBuffers * m_NumPlanes; i++) { ++ if(m_Planes[i].length) { ++ m_Addresses[i] = (unsigned long)mmap(NULL, m_Planes[i].length, PROT_READ | PROT_WRITE, MAP_SHARED, m_Device->device, m_Planes[i].m.mem_offset); ++ if (m_Addresses[i] == (unsigned long)MAP_FAILED) ++ return false; ++ CLog::Log(LOGDEBUG, "%s::%s - Device %s, Type %d, MMapped Plane %d at 0x%x to address 0x%lx", CLASSNAME, __func__, m_Device->name, m_Type, i, m_Planes[i].m.mem_offset, m_Addresses[i]); ++ } ++ } ++ return true; ++} ++ ++bool CLinuxV4l2Sink::StreamOn(int state) { ++ if(ioctl(m_Device->device, state, &m_Type)) { ++ CLog::Log(LOGERROR, "%s::%s - Error setting device state to %d, Device %s, Type %d.", CLASSNAME, __func__, state, m_Device->name, m_Type); ++ return false; ++ } ++ CLog::Log(LOGDEBUG, "%s::%s - Device %s, Type %d, %d", CLASSNAME, __func__, m_Device->name, m_Type, state); ++ return true; ++} ++ ++bool CLinuxV4l2Sink::QueueBuffer(v4l2_buffer *buffer) { ++ debug_log(LOGDEBUG, "%s::%s - Device %s, Type %d, Memory %d <- %d", CLASSNAME, __func__, m_Device->name, buffer->type, buffer->memory, buffer->index); ++ if (ioctl(m_Device->device, VIDIOC_QBUF, buffer)) { ++ CLog::Log(LOGERROR, "%s::%s - Error queueing buffer. Device %s, Type %d, Memory %d. Buffer %d, errno %d", CLASSNAME, __func__, m_Device->name, buffer->type, buffer->memory, buffer->index, errno); ++ return false; ++ } ++ return true; ++} ++bool CLinuxV4l2Sink::DequeueBuffer(v4l2_buffer *buffer) { ++ if (ioctl(m_Device->device, VIDIOC_DQBUF, buffer)) { ++ if (errno != EAGAIN) CLog::Log(LOGERROR, "%s::%s - Error dequeueing buffer. Device %s, Type %d, Memory %d. Buffer %d, errno %d", CLASSNAME, __func__, m_Device->name, buffer->type, buffer->memory, buffer->index, errno); ++ return false; ++ } ++ debug_log(LOGDEBUG, "%s::%s - Device %s, Type %d, Memory %d -> %d", CLASSNAME, __func__, m_Device->name, buffer->type, buffer->memory, buffer->index); ++ return true; ++} ++ ++bool CLinuxV4l2Sink::DequeueBuffer(V4l2SinkBuffer *buffer) { ++ struct v4l2_buffer buf; ++ struct v4l2_plane planes[m_NumPlanes]; ++ memset(&planes, 0, sizeof(struct v4l2_plane) * m_NumPlanes); ++ memset(&buf, 0, sizeof(struct v4l2_buffer)); ++ buf.type = m_Type; ++ buf.memory = m_Memory; ++ buf.m.planes = planes; ++ buf.length = m_NumPlanes; ++ if (!DequeueBuffer(&buf)) ++ return false; ++ ++ buffer->iIndex = buf.index; ++ buffer->timeStamp = buf.timestamp; ++ for (int i = 0; i < m_NumPlanes; i++) ++ buffer->cPlane[i] = (void *)m_Addresses[buffer->iIndex * m_NumPlanes + i]; ++ return true; ++} ++ ++bool CLinuxV4l2Sink::GetBuffer(V4l2SinkBuffer *buffer) { ++ if (iFreeBuffers.empty()) { ++ if (!DequeueBuffer(buffer)) ++ return false; ++ } else { ++ buffer->iIndex = iFreeBuffers.front(); ++ buffer->timeStamp = m_Buffers[buffer->iIndex].timestamp; ++ iFreeBuffers.pop(); ++ for (int i = 0; i < m_NumPlanes; i++) ++ buffer->cPlane[i] = (void *)m_Addresses[buffer->iIndex * m_NumPlanes + i]; ++ } ++ return true; ++} ++ ++bool CLinuxV4l2Sink::PushBuffer(V4l2SinkBuffer *buffer) { ++ if (m_Memory == V4L2_MEMORY_USERPTR) ++ for (int i = 0; i < m_NumPlanes; i++) ++ m_Buffers[buffer->iIndex].m.planes[i].m.userptr = (long unsigned int)buffer->cPlane[i]; ++ ++ if (m_Type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) { ++ m_Buffers[buffer->iIndex].timestamp = buffer->timeStamp; ++ m_Buffers[buffer->iIndex].flags |= V4L2_BUF_FLAG_TIMESTAMP_COPY; ++ for (int i = 0; i < m_NumPlanes; i++) ++ m_Buffers[buffer->iIndex].m.planes[i].bytesused = buffer->iBytesUsed[i]; ++ } ++ ++ if (!QueueBuffer(&m_Buffers[buffer->iIndex])) ++ return false; ++ return true; ++} ++ ++int CLinuxV4l2Sink::Poll(int timeout) { ++ struct pollfd p; ++ p.fd = m_Device->device; ++ p.events = POLLERR; ++ (m_Type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) ? p.events |= POLLOUT : p.events |= POLLIN; ++ ++ return poll(&p, 1, timeout); ++} ++ ++bool CLinuxV4l2Sink::QueueAll() { ++ while (!iFreeBuffers.empty()) { ++ if (!QueueBuffer(&m_Buffers[iFreeBuffers.front()])) ++ return false; ++ iFreeBuffers.pop(); ++ } ++ return true; ++} +diff --git a/xbmc/linux/LinuxV4l2Sink.h b/xbmc/linux/LinuxV4l2Sink.h +new file mode 100644 +index 0000000..d04d52d +--- /dev/null ++++ b/xbmc/linux/LinuxV4l2Sink.h +@@ -0,0 +1,71 @@ ++#pragma once ++ ++#include <queue> ++#include <string> ++#include <poll.h> ++#include <linux/videodev2.h> ++ ++#ifndef V4L2_BUF_FLAG_TIMESTAMP_COPY ++ #define V4L2_BUF_FLAG_TIMESTAMP_COPY 0x4000 ++#endif ++ ++#define V4L2_ERROR -1 ++#define V4L2_BUSY 1 ++#define V4L2_READY 2 ++#define V4L2_OK 3 ++ ++#ifdef _DEBUG ++ #define debug_log(...) CLog::Log(__VA_ARGS__) ++#else ++ #define debug_log(...) ++#endif ++ ++typedef struct V4l2Device ++{ ++ int device; ++ char name[32]; ++} V4l2Device; ++ ++typedef struct V4l2SinkBuffer ++{ ++ int iIndex; ++ int iBytesUsed[4]; ++ void *cPlane[4]; ++ struct timeval timeStamp; ++} V4l2SinkBuffer; ++ ++class CLinuxV4l2Sink ++{ ++public: ++ CLinuxV4l2Sink(V4l2Device *device, enum v4l2_buf_type type); ++ ~CLinuxV4l2Sink(); ++ ++ bool Init(int buffersCount); ++ bool Init(CLinuxV4l2Sink *sink); ++ void SoftRestart(); ++ bool GetFormat(v4l2_format *format); ++ bool SetFormat(v4l2_format *format); ++ bool GetCrop(v4l2_crop *crop); ++ bool SetCrop(v4l2_crop *crop); ++ bool GetBuffer(V4l2SinkBuffer* buffer); ++ bool DequeueBuffer(V4l2SinkBuffer* buffer); ++ bool PushBuffer(V4l2SinkBuffer* buffer); ++ bool StreamOn(int state); ++ bool QueueAll(); ++ int Poll(int timeout); ++private: ++ V4l2Device *m_Device; ++ int m_NumPlanes; ++ int m_NumBuffers; ++ std::queue<int> iFreeBuffers; ++ enum v4l2_memory m_Memory; ++ enum v4l2_buf_type m_Type; ++ v4l2_buffer *m_Buffers; ++ v4l2_plane *m_Planes; ++ unsigned long *m_Addresses; ++ int RequestBuffers(int buffersCount); ++ bool QueryBuffers(); ++ bool MmapBuffers(); ++ bool QueueBuffer(v4l2_buffer *buffer); ++ bool DequeueBuffer(v4l2_buffer *buffer); ++}; +diff --git a/xbmc/linux/Makefile.in b/xbmc/linux/Makefile.in +index 0cf90d1..ff2c2dc 100644 +--- a/xbmc/linux/Makefile.in ++++ b/xbmc/linux/Makefile.in +@@ -12,6 +12,7 @@ SRCS += XFileUtils.cpp + SRCS += XHandle.cpp + SRCS += XMemUtils.cpp + SRCS += XTimeUtils.cpp ++SRCS += LinuxV4l2Sink.cpp + + SRCS += RBP.cpp + +diff --git a/xbmc/utils/AMLUtils.cpp b/xbmc/utils/AMLUtils.cpp +index 5915e61..5392658 100644 +--- a/xbmc/utils/AMLUtils.cpp ++++ b/xbmc/utils/AMLUtils.cpp +@@ -79,7 +79,7 @@ bool aml_wired_present() + } + + bool aml_permissions() +-{ ++{ + if (!aml_present()) + return false; + +@@ -195,7 +195,8 @@ bool aml_support_h264_4k2k() + + void aml_set_audio_passthrough(bool passthrough) + { +- SysfsUtils::SetInt("/sys/class/audiodsp/digital_raw", passthrough ? 2:0); ++ CLog::Log(LOGDEBUG, "AML: Setting passthrough %d", passthrough); ++ SysfsUtils::SetString("/sys/class/audiodsp/digital_raw", passthrough ? "2":"0"); + } + + void aml_probe_hdmi_audio() +@@ -213,7 +214,7 @@ void aml_probe_hdmi_audio() + { + char valstr[1024] = {0}; + +- read(fd, valstr, sizeof(valstr) - 1); ++ int tmp = read(fd, valstr, sizeof(valstr) - 1); + valstr[strlen(valstr)] = '\0'; + close(fd); + +@@ -348,6 +349,60 @@ bool aml_mode_to_resolution(const char *mode, RESOLUTION_INFO *res) + res->fRefreshRate = 50; + res->dwFlags = D3DPRESENTFLAG_PROGRESSIVE; + } ++ else if (StringUtils::EqualsNoCase(fromMode, "720p23hz")) // fake ++ { ++ res->iWidth = 1280; ++ res->iHeight= 720; ++ res->iScreenWidth = 1280; ++ res->iScreenHeight= 720; ++ res->fRefreshRate = 23.98; ++ res->dwFlags = D3DPRESENTFLAG_PROGRESSIVE; ++ } ++ else if (StringUtils::EqualsNoCase(fromMode, "720p24hz")) // fake ++ { ++ res->iWidth = 1280; ++ res->iHeight= 720; ++ res->iScreenWidth = 1280; ++ res->iScreenHeight= 720; ++ res->fRefreshRate = 24; ++ res->dwFlags = D3DPRESENTFLAG_PROGRESSIVE; ++ } ++ else if (StringUtils::EqualsNoCase(fromMode, "720p25hz")) // fake ++ { ++ res->iWidth = 1280; ++ res->iHeight= 720; ++ res->iScreenWidth = 1280; ++ res->iScreenHeight= 720; ++ res->fRefreshRate = 25; ++ res->dwFlags = D3DPRESENTFLAG_PROGRESSIVE; ++ } ++ else if (StringUtils::EqualsNoCase(fromMode, "720p29hz")) // fake ++ { ++ res->iWidth = 1280; ++ res->iHeight= 720; ++ res->iScreenWidth = 1280; ++ res->iScreenHeight= 720; ++ res->fRefreshRate = 29.97; ++ res->dwFlags = D3DPRESENTFLAG_PROGRESSIVE; ++ } ++ else if (StringUtils::EqualsNoCase(fromMode, "720p30hz")) // fake ++ { ++ res->iWidth = 1280; ++ res->iHeight= 720; ++ res->iScreenWidth = 1280; ++ res->iScreenHeight= 720; ++ res->fRefreshRate = 30; ++ res->dwFlags = D3DPRESENTFLAG_PROGRESSIVE; ++ } ++ else if (StringUtils::EqualsNoCase(fromMode, "720p59hz")) // real ++ { ++ res->iWidth = 1280; ++ res->iHeight= 720; ++ res->iScreenWidth = 1280; ++ res->iScreenHeight= 720; ++ res->fRefreshRate = 59.94; ++ res->dwFlags = D3DPRESENTFLAG_PROGRESSIVE; ++ } + else if (StringUtils::EqualsNoCase(fromMode, "720p") || StringUtils::EqualsNoCase(fromMode, "720p60hz")) + { + res->iWidth = 1280; +@@ -393,6 +448,24 @@ bool aml_mode_to_resolution(const char *mode, RESOLUTION_INFO *res) + res->fRefreshRate = 24; + res->dwFlags = D3DPRESENTFLAG_PROGRESSIVE; + } ++ else if (StringUtils::EqualsNoCase(fromMode, "1080p25hz")) ++ { ++ res->iWidth = 1920; ++ res->iHeight= 1080; ++ res->iScreenWidth = 1920; ++ res->iScreenHeight= 1080; ++ res->fRefreshRate = 25; ++ res->dwFlags = D3DPRESENTFLAG_PROGRESSIVE; ++ } ++ else if (StringUtils::EqualsNoCase(fromMode, "1080p29hz")) // fake ++ { ++ res->iWidth = 1920; ++ res->iHeight= 1080; ++ res->iScreenWidth = 1920; ++ res->iScreenHeight= 1080; ++ res->fRefreshRate = 29.97; ++ res->dwFlags = D3DPRESENTFLAG_PROGRESSIVE; ++ } + else if (StringUtils::EqualsNoCase(fromMode, "1080p30hz")) + { + res->iWidth = 1920; +@@ -501,7 +574,7 @@ bool aml_mode_to_resolution(const char *mode, RESOLUTION_INFO *res) + res->fRefreshRate = 30; + res->dwFlags = D3DPRESENTFLAG_PROGRESSIVE; + } +- else if (StringUtils::EqualsNoCase(fromMode, "2160p50hz420")) ++ else if (StringUtils::EqualsNoCase(fromMode, "2160p50hz")) + { + res->iWidth = 1920; + res->iHeight= 1080; +@@ -510,7 +583,16 @@ bool aml_mode_to_resolution(const char *mode, RESOLUTION_INFO *res) + res->fRefreshRate = 50; + res->dwFlags = D3DPRESENTFLAG_PROGRESSIVE; + } +- else if (StringUtils::EqualsNoCase(fromMode, "2160p60hz420")) ++ else if (StringUtils::EqualsNoCase(fromMode, "4k2k59hz") || StringUtils::EqualsNoCase(fromMode, "2160p59hz")) ++ { ++ res->iWidth = 1920; ++ res->iHeight= 1080; ++ res->iScreenWidth = 3840; ++ res->iScreenHeight= 2160; ++ res->fRefreshRate = 59.940; ++ res->dwFlags = D3DPRESENTFLAG_PROGRESSIVE; ++ } ++ else if (StringUtils::EqualsNoCase(fromMode, "2160p60hz")) + { + res->iWidth = 1920; + res->iHeight= 1080; +@@ -535,4 +617,3 @@ bool aml_mode_to_resolution(const char *mode, RESOLUTION_INFO *res) + + return res->iWidth > 0 && res->iHeight> 0; + } +- +diff --git a/xbmc/utils/CPUInfo.cpp b/xbmc/utils/CPUInfo.cpp +index a2a775f..f1f9751 100644 +--- a/xbmc/utils/CPUInfo.cpp ++++ b/xbmc/utils/CPUInfo.cpp +@@ -117,7 +117,7 @@ CCPUInfo::CCPUInfo(void) + #if defined(TARGET_DARWIN) + size_t len = 4; + std::string cpuVendor; +- ++ + // The number of cores. + if (sysctlbyname("hw.activecpu", &m_cpuCount, &len, NULL, 0) == -1) + m_cpuCount = 1; +@@ -138,7 +138,7 @@ CCPUInfo::CCPUInfo(void) + len = 512; + if (sysctlbyname("machdep.cpu.vendor", &buffer, &len, NULL, 0) == 0) + cpuVendor = buffer; +- ++ + #endif + // Go through each core. + for (int i=0; i<m_cpuCount; i++) +@@ -263,9 +263,9 @@ CCPUInfo::CCPUInfo(void) + if (m_fProcTemperature == NULL) + m_fProcTemperature = fopen("/proc/acpi/thermal_zone/TZ0/temperature", "r"); + // read from the new location of the temperature data on new kernels, 2.6.39, 3.0 etc +- if (m_fProcTemperature == NULL) ++ if (m_fProcTemperature == NULL) + m_fProcTemperature = fopen("/sys/class/hwmon/hwmon0/temp1_input", "r"); +- if (m_fProcTemperature == NULL) ++ if (m_fProcTemperature == NULL) + m_fProcTemperature = fopen("/sys/class/thermal/thermal_zone0/temp", "r"); // On Raspberry PIs + + m_fCPUFreq = fopen ("/sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq", "r"); +@@ -541,7 +541,7 @@ float CCPUInfo::getCPUFrequency() + return float(cnt.FirstValue); + } + } +- ++ + if (!m_cores.empty()) + return float(m_cores.begin()->second.m_fSpeed); + else +@@ -587,7 +587,7 @@ bool CCPUInfo::getTemperature(CTemperature& temperature) + { + int value = 0; + char scale = 0; +- ++ + #ifdef TARGET_POSIX + #if defined(TARGET_DARWIN_OSX) + value = SMCGetTemperature(SMC_KEY_CPU_TEMP); +@@ -616,23 +616,24 @@ bool CCPUInfo::getTemperature(CTemperature& temperature) + // procfs is deprecated in the linux kernel, we should move away from + // using it for temperature data. It doesn't seem that sysfs has a + // general enough interface to bother implementing ATM. +- ++ + rewind(m_fProcTemperature); + fflush(m_fProcTemperature); + ret = fscanf(m_fProcTemperature, "temperature: %d %c", &value, &scale); +- ++ + // read from the temperature file of the new kernels + if (!ret) + { + ret = fscanf(m_fProcTemperature, "%d", &value); +- value = value / 1000; ++ if ((int)value > 1000) ++ value = value / 1000; + scale = 'c'; + ret++; + } + } + + if (ret != 2) +- return false; ++ return false; + #endif + #endif // TARGET_POSIX + +@@ -642,7 +643,7 @@ bool CCPUInfo::getTemperature(CTemperature& temperature) + temperature = CTemperature::CreateFromFahrenheit(value); + else + return false; +- ++ + return true; + } + +@@ -697,7 +698,7 @@ bool CCPUInfo::readProcStat(unsigned long long& user, unsigned long long& nice, + const LONGLONG deltaTotal = coreTotal - curCore.m_total, + deltaIdle = coreIdle - curCore.m_idle; + const double load = (double(deltaTotal - deltaIdle) * 100.0) / double(deltaTotal); +- ++ + // win32 has some problems with calculation of load if load close to zero + curCore.m_fPct = (load < 0) ? 0 : load; + if (load >= 0 || deltaTotal > 5 * 10 * 1000 * 1000) // do not update (smooth) values for 5 seconds on negative loads +diff --git a/xbmc/windowing/X11/WinSystemX11.cpp b/xbmc/windowing/X11/WinSystemX11.cpp +index ee85585..7261f78 100644 +--- a/xbmc/windowing/X11/WinSystemX11.cpp ++++ b/xbmc/windowing/X11/WinSystemX11.cpp +@@ -203,7 +203,7 @@ bool CWinSystemX11::SetFullScreen(bool fullScreen, RESOLUTION_INFO& res, bool bl + mode.hz = CDisplaySettings::GetInstance().GetResolutionInfo(RES_DESKTOP).fRefreshRate; + mode.id = CDisplaySettings::GetInstance().GetResolutionInfo(RES_DESKTOP).strId; + } +- ++ + XMode currmode = g_xrandr.GetCurrentMode(out.name); + if (!currmode.name.empty()) + { +diff --git a/xbmc/windowing/egl/EGLNativeTypeAmlogic.cpp b/xbmc/windowing/egl/EGLNativeTypeAmlogic.cpp +index 3d6598a..cc62734 100644 +--- a/xbmc/windowing/egl/EGLNativeTypeAmlogic.cpp ++++ b/xbmc/windowing/egl/EGLNativeTypeAmlogic.cpp +@@ -23,13 +23,18 @@ + #include "utils/AMLUtils.h" + #include "utils/StringUtils.h" + #include "utils/SysfsUtils.h" ++#include "utils/log.h" + +-#include <stdio.h> + #include <stdlib.h> + #include <linux/fb.h> + #include <sys/ioctl.h> + #include <EGL/egl.h> + ++#ifdef CLASSNAME ++#undef CLASSNAME ++#endif ++#define CLASSNAME "CEGLNativeTypeAmlogic" ++ + CEGLNativeTypeAmlogic::CEGLNativeTypeAmlogic() + { + const char *env_framebuffer = getenv("FRAMEBUFFER"); +@@ -53,10 +58,12 @@ bool CEGLNativeTypeAmlogic::CheckCompatibility() + { + std::string name; + std::string modalias = "/sys/class/graphics/" + m_framebuffer_name + "/device/modalias"; ++ std::string meson = "meson"; ++ std::string fb = "fb"; + + SysfsUtils::GetString(modalias, name); + StringUtils::Trim(name); +- if (name == "platform:mesonfb") ++ if (name.find(meson) != std::string::npos && name.find(fb) != std::string::npos) + return true; + return false; + } +@@ -64,28 +71,37 @@ bool CEGLNativeTypeAmlogic::CheckCompatibility() + void CEGLNativeTypeAmlogic::Initialize() + { + aml_permissions(); +- DisableFreeScale(); ++ FreeScale(false); + } ++ + void CEGLNativeTypeAmlogic::Destroy() + { ++ SetScreenScale(1, 1, false); + return; + } + + bool CEGLNativeTypeAmlogic::CreateNativeDisplay() + { ++ CLog::Log(LOGDEBUG, "%s::%s", CLASSNAME, __func__); ++ + m_nativeDisplay = EGL_DEFAULT_DISPLAY; + return true; + } + + bool CEGLNativeTypeAmlogic::CreateNativeWindow() + { ++ CLog::Log(LOGDEBUG, "%s::%s", CLASSNAME, __func__); ++ + #if defined(_FBDEV_WINDOW_H_) + fbdev_window *nativeWindow = new fbdev_window; + if (!nativeWindow) + return false; + +- nativeWindow->width = 1920; +- nativeWindow->height = 1080; ++ RESOLUTION_INFO res; ++ GetPreferredResolution(&res); ++ ++ nativeWindow->width = res.iWidth; ++ nativeWindow->height = res.iHeight; + m_nativeWindow = nativeWindow; + + SetFramebufferResolution(nativeWindow->width, nativeWindow->height); +@@ -98,6 +114,8 @@ bool CEGLNativeTypeAmlogic::CreateNativeWindow() + + bool CEGLNativeTypeAmlogic::GetNativeDisplay(XBNativeDisplayType **nativeDisplay) const + { ++ CLog::Log(LOGDEBUG, "%s::%s", CLASSNAME, __func__); ++ + if (!nativeDisplay) + return false; + *nativeDisplay = (XBNativeDisplayType*) &m_nativeDisplay; +@@ -106,6 +124,8 @@ bool CEGLNativeTypeAmlogic::GetNativeDisplay(XBNativeDisplayType **nativeDisplay + + bool CEGLNativeTypeAmlogic::GetNativeWindow(XBNativeWindowType **nativeWindow) const + { ++ CLog::Log(LOGDEBUG, "%s::%s", CLASSNAME, __func__); ++ + if (!nativeWindow) + return false; + *nativeWindow = (XBNativeWindowType*) &m_nativeWindow; +@@ -114,11 +134,15 @@ bool CEGLNativeTypeAmlogic::GetNativeWindow(XBNativeWindowType **nativeWindow) c + + bool CEGLNativeTypeAmlogic::DestroyNativeDisplay() + { ++ CLog::Log(LOGDEBUG, "%s::%s", CLASSNAME, __func__); ++ + return true; + } + + bool CEGLNativeTypeAmlogic::DestroyNativeWindow() + { ++ CLog::Log(LOGDEBUG, "%s::%s", CLASSNAME, __func__); ++ + #if defined(_FBDEV_WINDOW_H_) + delete (fbdev_window*)m_nativeWindow, m_nativeWindow = NULL; + #endif +@@ -134,6 +158,8 @@ bool CEGLNativeTypeAmlogic::GetNativeResolution(RESOLUTION_INFO *res) const + + bool CEGLNativeTypeAmlogic::SetNativeResolution(const RESOLUTION_INFO &res) + { ++ CLog::Log(LOGNOTICE, "%s::%s to %dx%d@%f", CLASSNAME, __func__, res.iScreenWidth, res.iScreenHeight, res.fRefreshRate); ++ + #if defined(_FBDEV_WINDOW_H_) + if (m_nativeWindow) + { +@@ -153,6 +179,8 @@ bool CEGLNativeTypeAmlogic::SetNativeResolution(const RESOLUTION_INFO &res) + + bool CEGLNativeTypeAmlogic::ProbeResolutions(std::vector<RESOLUTION_INFO> &resolutions) + { ++ CLog::Log(LOGDEBUG, "%s::%s", CLASSNAME, __func__); ++ + std::string valstr; + SysfsUtils::GetString("/sys/class/amhdmitx/amhdmitx0/disp_cap", valstr); + std::vector<std::string> probe_str = StringUtils::Split(valstr, "\n"); +@@ -165,11 +193,12 @@ bool CEGLNativeTypeAmlogic::ProbeResolutions(std::vector<RESOLUTION_INFO> &resol + resolutions.push_back(res); + } + return resolutions.size() > 0; +- + } + + bool CEGLNativeTypeAmlogic::GetPreferredResolution(RESOLUTION_INFO *res) const + { ++ CLog::Log(LOGDEBUG, "%s::%s", CLASSNAME, __func__); ++ + // check display/mode, it gets defaulted at boot + if (!GetNativeResolution(res)) + { +@@ -182,6 +211,8 @@ bool CEGLNativeTypeAmlogic::GetPreferredResolution(RESOLUTION_INFO *res) const + + bool CEGLNativeTypeAmlogic::ShowWindow(bool show) + { ++ CLog::Log(LOGDEBUG, "%s::%s", CLASSNAME, __func__); ++ + std::string blank_framebuffer = "/sys/class/graphics/" + m_framebuffer_name + "/blank"; + SysfsUtils::SetInt(blank_framebuffer.c_str(), show ? 0 : 1); + return true; +@@ -189,6 +220,8 @@ bool CEGLNativeTypeAmlogic::ShowWindow(bool show) + + bool CEGLNativeTypeAmlogic::SetDisplayResolution(const char *resolution) + { ++ CLog::Log(LOGNOTICE, "%s::%s to %s", CLASSNAME, __func__, resolution); ++ + std::string mode = resolution; + // switch display resolution + SysfsUtils::SetString("/sys/class/display/mode", mode.c_str()); +@@ -196,36 +229,46 @@ bool CEGLNativeTypeAmlogic::SetDisplayResolution(const char *resolution) + RESOLUTION_INFO res; + aml_mode_to_resolution(mode.c_str(), &res); + SetFramebufferResolution(res); ++ DealWithScale(res); + + return true; + } + +-void CEGLNativeTypeAmlogic::SetupVideoScaling(const char *mode) ++void CEGLNativeTypeAmlogic::FreeScale(bool state) + { +- SysfsUtils::SetInt("/sys/class/graphics/fb0/blank", 1); +- SysfsUtils::SetInt("/sys/class/graphics/fb0/free_scale", 0); +- SysfsUtils::SetInt("/sys/class/graphics/fb1/free_scale", 0); +- SysfsUtils::SetInt("/sys/class/ppmgr/ppscaler", 0); ++ CLog::Log(LOGDEBUG, "%s::%s", CLASSNAME, __func__); + +- if (strstr(mode, "1080")) +- { +- SysfsUtils::SetString("/sys/class/graphics/fb0/request2XScale", "8"); +- SysfsUtils::SetString("/sys/class/graphics/fb1/scale_axis", "1280 720 1920 1080"); +- SysfsUtils::SetString("/sys/class/graphics/fb1/scale", "0x10001"); +- } +- else +- { +- SysfsUtils::SetString("/sys/class/graphics/fb0/request2XScale", "16 1280 720"); ++ std::string freescale_framebuffer = "/sys/class/graphics/" + m_framebuffer_name + "/free_scale"; ++ SysfsUtils::SetInt(freescale_framebuffer.c_str(), state ? 1 : 0); ++} ++ ++void CEGLNativeTypeAmlogic::DealWithScale(const RESOLUTION_INFO &res) ++{ ++ CLog::Log(LOGDEBUG, "%s::%s Interface is %dx%d, screen size is %dx%d", CLASSNAME, __func__, res.iWidth, res.iHeight, res.iScreenWidth, res.iScreenHeight); ++ ++ if (res.iScreenWidth > res.iWidth && res.iScreenHeight > res.iHeight) { ++ CLog::Log(LOGNOTICE, "%s::%s Scaling interfaces of size %dx%d to full screen", CLASSNAME, __func__, res.iWidth, res.iHeight); ++ SetScreenScale(res.iWidth, res.iHeight, true); + } ++} + +- SysfsUtils::SetInt("/sys/class/graphics/fb0/blank", 0); ++void CEGLNativeTypeAmlogic::SetScreenScale(int width, int height, bool state) ++{ ++ char setting[256] = {}; ++ sprintf(setting, "0 0 %d %d", width - 1 , height - 1); ++ std::string framebuffer = "/sys/class/graphics/" + m_framebuffer_name; ++ SysfsUtils::SetString(framebuffer + "/scale_axis", setting); ++ SysfsUtils::SetString(framebuffer + "/scale", state ? "0x10001" : "0x0"); + } + +-void CEGLNativeTypeAmlogic::DisableFreeScale() ++bool CEGLNativeTypeAmlogic::IsHdmiConnected() const + { +- // turn off frame buffer freescale +- SysfsUtils::SetInt("/sys/class/graphics/fb0/free_scale", 0); +- SysfsUtils::SetInt("/sys/class/graphics/fb1/free_scale", 0); ++ CLog::Log(LOGDEBUG, "%s::%s", CLASSNAME, __func__); ++ ++ std::string hpd_state; ++ SysfsUtils::GetString("/sys/class/amhdmitx/amhdmitx0/disp_cap", hpd_state); ++ StringUtils::Trim(hpd_state); ++ return hpd_state == "1"; + } + + void CEGLNativeTypeAmlogic::SetFramebufferResolution(const RESOLUTION_INFO &res) const +@@ -245,8 +288,8 @@ void CEGLNativeTypeAmlogic::SetFramebufferResolution(int width, int height) cons + { + vinfo.xres = width; + vinfo.yres = height; +- vinfo.xres_virtual = 1920; +- vinfo.yres_virtual = 2160; ++ vinfo.xres_virtual = width; ++ vinfo.yres_virtual = height * 2; + vinfo.bits_per_pixel = 32; + vinfo.activate = FB_ACTIVATE_ALL; + ioctl(fd0, FBIOPUT_VSCREENINFO, &vinfo); +diff --git a/xbmc/windowing/egl/EGLNativeTypeAmlogic.h b/xbmc/windowing/egl/EGLNativeTypeAmlogic.h +index 6867c38..ca39273 100644 +--- a/xbmc/windowing/egl/EGLNativeTypeAmlogic.h ++++ b/xbmc/windowing/egl/EGLNativeTypeAmlogic.h +@@ -21,6 +21,19 @@ + */ + + #include "EGLNativeType.h" ++#include <linux/fb.h> ++ ++#ifndef _FBDEV_WINDOW_H_ ++// Define it right here, since some platforms doesn't has fbdev_window.h at all. ++// This will not make it fail on these platforms badly, since it will fail softly anyway on some other init steps. ++#define _FBDEV_WINDOW_H_ ++typedef struct fbdev_window ++{ ++ unsigned short width; ++ unsigned short height; ++} fbdev_window; ++#endif ++ + class CEGLNativeTypeAmlogic : public CEGLNativeType + { + public: +@@ -49,12 +62,14 @@ public: + + protected: + bool SetDisplayResolution(const char *resolution); +- void SetupVideoScaling(const char *mode); +- void DisableFreeScale(); + + private: + void SetFramebufferResolution(const RESOLUTION_INFO &res) const; + void SetFramebufferResolution(int width, int height) const; ++ void FreeScale(bool state); ++ void DealWithScale(const RESOLUTION_INFO &res); ++ void SetScreenScale(int width, int height, bool state); ++ bool IsHdmiConnected() const; + + std::string m_framebuffer_name; + }; +diff --git a/xbmc/windowing/egl/EGLNativeTypeFbdev.cpp b/xbmc/windowing/egl/EGLNativeTypeFbdev.cpp +new file mode 100644 +index 0000000..5c25eb6 +--- /dev/null ++++ b/xbmc/windowing/egl/EGLNativeTypeFbdev.cpp +@@ -0,0 +1,183 @@ ++/* ++ * Copyright (C) 2011-2012 Team XBMC ++ * http://www.xbmc.org ++ * ++ * This Program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2, or (at your option) ++ * any later version. ++ * ++ * This Program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with XBMC; see the file COPYING. If not, see ++ * <http://www.gnu.org/licenses/>. ++ * ++ */ ++#include <EGL/egl.h> ++#include "EGLNativeTypeFbdev.h" ++#include "utils/log.h" ++#include <stdlib.h> ++#include <linux/fb.h> ++#include <sys/ioctl.h> ++#include "utils/StringUtils.h" ++#include "guilib/gui3d.h" ++#include <linux/media.h> ++ ++#include <unistd.h> ++ ++#include "utils/StringUtils.h" ++ ++#ifdef CLASSNAME ++#undef CLASSNAME ++#endif ++#define CLASSNAME "CEGLNativeTypeFbdev" ++ ++CEGLNativeTypeFbdev::CEGLNativeTypeFbdev() ++{ ++ m_iFBHandle = -1; ++ m_nativeWindow = NULL; ++ m_nativeDisplay = NULL; ++} ++ ++CEGLNativeTypeFbdev::~CEGLNativeTypeFbdev() ++{ ++} ++ ++bool CEGLNativeTypeFbdev::CheckCompatibility() ++{ ++ m_iFBHandle = open("/dev/fb0", O_RDWR, 0); ++ if(m_iFBHandle < 0) ++ return false; ++ ++ vinfo = new fb_var_screeninfo(); ++ if(ioctl(m_iFBHandle, FBIOGET_VSCREENINFO, vinfo) == -1) ++ return false; ++ ++ CLog::Log(LOGNOTICE, "%s::%s FBDev device: %d, info.xres %d info.yres %d info.upper_margin %d info.lower_margin %d info.pixclock %d", ++ CLASSNAME, __func__, m_iFBHandle, vinfo->xres, vinfo->yres, vinfo->upper_margin, vinfo->lower_margin, vinfo->pixclock); ++ ++ finfo = new fb_fix_screeninfo(); ++ if(ioctl(m_iFBHandle, FBIOGET_FSCREENINFO, finfo) == -1) ++ return false; ++ ++ return true; ++} ++ ++void CEGLNativeTypeFbdev::Initialize() ++{ ++ return; ++} ++void CEGLNativeTypeFbdev::Destroy() ++{ ++ return; ++} ++ ++bool CEGLNativeTypeFbdev::CreateNativeDisplay() ++{ ++ m_nativeDisplay = EGL_DEFAULT_DISPLAY; ++ return true; ++} ++ ++bool CEGLNativeTypeFbdev::CreateNativeWindow() ++{ ++ fbdev_window *nativeWindow = new fbdev_window; ++ if (!nativeWindow) ++ return false; ++ ++ nativeWindow->width = vinfo->xres; ++ nativeWindow->height = vinfo->yres; ++ m_nativeWindow = nativeWindow; ++ return true; ++} ++ ++bool CEGLNativeTypeFbdev::GetNativeDisplay(XBNativeDisplayType **nativeDisplay) const ++{ ++ if (!nativeDisplay) ++ return false; ++ *nativeDisplay = (XBNativeDisplayType*) &m_nativeDisplay; ++ return true; ++} ++ ++bool CEGLNativeTypeFbdev::GetNativeWindow(XBNativeWindowType **nativeWindow) const ++{ ++ if (!nativeWindow) ++ return false; ++ *nativeWindow = (XBNativeWindowType*) &m_nativeWindow; ++ return true; ++} ++ ++bool CEGLNativeTypeFbdev::DestroyNativeDisplay() ++{ ++ return true; ++} ++ ++bool CEGLNativeTypeFbdev::DestroyNativeWindow() ++{ ++ free(m_nativeWindow); ++ return true; ++} ++ ++bool CEGLNativeTypeFbdev::GetNativeResolution(RESOLUTION_INFO *res) const ++{ ++ res->iWidth = vinfo->xres; ++ res->iHeight = vinfo->yres; ++ res->fRefreshRate = 60; ++ res->dwFlags = D3DPRESENTFLAG_PROGRESSIVE; ++ res->iScreen = 0; ++ res->bFullScreen = true; ++ res->iSubtitles = (int)(0.965 * res->iHeight); ++ res->fPixelRatio = 1.0f; ++ res->iScreenWidth = res->iWidth; ++ res->iScreenHeight = res->iHeight; ++ res->strMode = StringUtils::Format("%dx%d @ %.2f%s - Full Screen", res->iScreenWidth, res->iScreenHeight, res->fRefreshRate, res->dwFlags & D3DPRESENTFLAG_INTERLACED ? "i" : ""); ++ ++ CLog::Log(LOGNOTICE, "Current resolution: %s", res->strMode.c_str()); ++ return true; ++} ++ ++bool CEGLNativeTypeFbdev::SetNativeResolution(const RESOLUTION_INFO &res) ++{ ++ ++ vinfo->activate = FB_ACTIVATE_NOW; ++ ++ if (ioctl(m_iFBHandle, FBIOPUT_VSCREENINFO, vinfo) == -1) ++ { ++ CLog::Log(LOGERROR, "%s::%s - FBIOPUT_VSCREENINFO error", CLASSNAME, __func__); ++ return false; ++ } ++ if (ioctl(m_iFBHandle, FBIOPAN_DISPLAY, vinfo) == -1) ++ { ++ CLog::Log(LOGERROR, "%s::%s - FBIOPAN_DISPLAY error", CLASSNAME, __func__); ++ return false; ++ } ++ ++ CLog::Log(LOGNOTICE, "%s::%s width %d height %d refresh %f", CLASSNAME, __func__, res.iScreenWidth, res.iScreenHeight, res.fRefreshRate); ++ ++ return true; ++} ++ ++bool CEGLNativeTypeFbdev::ProbeResolutions(std::vector<RESOLUTION_INFO> &resolutions) ++{ ++ RESOLUTION_INFO res; ++ if (GetNativeResolution(&res) && res.iWidth > 1 && res.iHeight > 1) ++ { ++ resolutions.push_back(res); ++ return true; ++ } ++ return false; ++} ++ ++bool CEGLNativeTypeFbdev::GetPreferredResolution(RESOLUTION_INFO *res) const ++{ ++ GetNativeResolution(res); ++ return true; ++} ++ ++bool CEGLNativeTypeFbdev::ShowWindow(bool show) ++{ ++ return false; ++} +diff --git a/xbmc/windowing/egl/EGLNativeTypeFbdev.h b/xbmc/windowing/egl/EGLNativeTypeFbdev.h +new file mode 100644 +index 0000000..04e7023 +--- /dev/null ++++ b/xbmc/windowing/egl/EGLNativeTypeFbdev.h +@@ -0,0 +1,68 @@ ++#pragma once ++ ++/* ++ * Copyright (C) 2011-2012 Team XBMC ++ * http://www.xbmc.org ++ * ++ * This Program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2, or (at your option) ++ * any later version. ++ * ++ * This Program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with XBMC; see the file COPYING. If not, see ++ * <http://www.gnu.org/licenses/>. ++ * ++ */ ++ ++#include "EGLNativeType.h" ++#include <linux/fb.h> ++#include <list> ++ ++#ifndef _FBDEV_WINDOW_H_ ++// Define it right here, since some platforms doesn't has fbdev_window.h at all. ++// This will not make it fail on these platforms badly, since it will fail softly anyway on some other init steps. ++#define _FBDEV_WINDOW_H_ ++typedef struct fbdev_window ++{ ++ unsigned short width; ++ unsigned short height; ++} fbdev_window; ++#endif ++ ++class CEGLNativeTypeFbdev : public CEGLNativeType ++{ ++public: ++ CEGLNativeTypeFbdev(); ++ virtual ~CEGLNativeTypeFbdev(); ++ virtual std::string GetNativeName() const { return "FBDev"; }; ++ virtual bool CheckCompatibility(); ++ virtual void Initialize(); ++ virtual void Destroy(); ++ virtual int GetQuirks() { return EGL_QUIRK_NONE; }; ++ ++ virtual bool CreateNativeDisplay(); ++ virtual bool CreateNativeWindow(); ++ virtual bool GetNativeDisplay(XBNativeDisplayType **nativeDisplay) const; ++ virtual bool GetNativeWindow(XBNativeWindowType **nativeWindow) const; ++ ++ virtual bool DestroyNativeWindow(); ++ virtual bool DestroyNativeDisplay(); ++ ++ virtual bool GetNativeResolution(RESOLUTION_INFO *res) const; ++ virtual bool SetNativeResolution(const RESOLUTION_INFO &res); ++ virtual bool ProbeResolutions(std::vector<RESOLUTION_INFO> &resolutions); ++ virtual bool GetPreferredResolution(RESOLUTION_INFO *res) const; ++ ++ virtual bool ShowWindow(bool show); ++ ++protected: ++ int m_iFBHandle; ++ fb_var_screeninfo *vinfo; ++ fb_fix_screeninfo *finfo; ++}; +diff --git a/xbmc/windowing/egl/EGLNativeTypeHybris.cpp b/xbmc/windowing/egl/EGLNativeTypeHybris.cpp +new file mode 100644 +index 0000000..767946e +--- /dev/null ++++ b/xbmc/windowing/egl/EGLNativeTypeHybris.cpp +@@ -0,0 +1,279 @@ ++/* ++ * Copyright (C) 2011-2012 Team XBMC ++ * http://www.xbmc.org ++ * ++ * This Program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2, or (at your option) ++ * any later version. ++ * ++ * This Program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with XBMC; see the file COPYING. If not, see ++ * <http://www.gnu.org/licenses/>. ++ * ++ */ ++#if defined(TARGET_HYBRIS) ++#include <hwcomposerwindow/hwcomposer_window.h> ++#include <hardware/hardware.h> ++#include <hardware/hwcomposer.h> ++#endif ++ ++#include "system.h" ++#include <EGL/egl.h> ++#include "EGLNativeTypeHybris.h" ++#include "utils/log.h" ++#include "guilib/gui3d.h" ++ ++#include "utils/StringUtils.h" ++ ++HWComposer::HWComposer(unsigned int width, ++ unsigned int height, ++ unsigned int format, ++ hwc_composer_device_1_t *device, ++ hwc_display_contents_1_t **mList, ++ hwc_layer_1_t *layer) ++ : HWComposerNativeWindow(width, height, format) ++{ ++ fblayer = layer; ++ hwcdevice = device; ++ mlist = mList; ++} ++ ++void HWComposer::present(HWComposerNativeWindowBuffer *buffer) ++{ ++ int oldretire = mlist[0]->retireFenceFd; ++ mlist[0]->retireFenceFd = -1; ++ fblayer->handle = buffer->handle; ++ fblayer->acquireFenceFd = getFenceBufferFd(buffer); ++ fblayer->releaseFenceFd = -1; ++ int err = hwcdevice->prepare(hwcdevice, HWC_NUM_DISPLAY_TYPES, mlist); ++ assert(err == 0); ++ ++ err = hwcdevice->set(hwcdevice, HWC_NUM_DISPLAY_TYPES, mlist); ++ assert(err == 0); ++ setFenceBufferFd(buffer, fblayer->releaseFenceFd); ++ ++ if (oldretire != -1) ++ { ++ sync_wait(oldretire, -1); ++ close(oldretire); ++ } ++} ++ ++CEGLNativeTypeHybris::CEGLNativeTypeHybris() ++#if defined(TARGET_HYBRIS) ++ : m_hwcModule(NULL), m_bufferList(NULL), m_hwcDevicePtr(NULL) ++{ ++ m_nativeWindow = NULL; ++ m_hwNativeWindow = NULL; ++ m_swNativeWindow = NULL; ++} ++#else ++{ ++} ++#endif ++ ++CEGLNativeTypeHybris::~CEGLNativeTypeHybris() ++{ ++} ++ ++bool CEGLNativeTypeHybris::CheckCompatibility() ++{ ++#if defined(TARGET_HYBRIS) ++ if(hw_get_module(HWC_HARDWARE_MODULE_ID, (const hw_module_t **) &m_hwcModule)) ++ { ++ return false; ++ } ++ ++ if(hwc_open_1(m_hwcModule, &m_hwcDevicePtr)) ++ { ++ return false; ++ } ++ ++ m_hwcDevicePtr->blank(m_hwcDevicePtr, 0, 0); ++ return true; ++#else ++ return false; ++#endif ++} ++ ++void CEGLNativeTypeHybris::Initialize() ++{ ++} ++ ++void CEGLNativeTypeHybris::Destroy() ++{ ++ return; ++} ++ ++bool CEGLNativeTypeHybris::CreateNativeDisplay() ++{ ++ m_nativeDisplay = EGL_DEFAULT_DISPLAY; ++ return true; ++} ++ ++bool CEGLNativeTypeHybris::CreateNativeWindow() ++{ ++#if defined(TARGET_HYBRIS) ++ RESOLUTION_INFO res; ++ if (!GetNativeResolution(&res)) ++ return false; ++ ++ size_t size = sizeof(hwc_display_contents_1_t) + 2 * sizeof(hwc_layer_1_t); ++ hwc_display_contents_1_t *list = (hwc_display_contents_1_t *) malloc(size); ++ m_bufferList = (hwc_display_contents_1_t **) malloc(HWC_NUM_DISPLAY_TYPES * sizeof(hwc_display_contents_1_t *)); ++ const hwc_rect_t r = { 0, 0, res.iWidth, res.iHeight }; ++ ++ for (int counter = 0; counter < HWC_NUM_DISPLAY_TYPES; counter++) ++ m_bufferList[counter] = list; ++ ++ hwc_layer_1_t *layer; ++ ++ layer = &list->hwLayers[0]; ++ memset(layer, 0, sizeof(hwc_layer_1_t)); ++ layer->compositionType = HWC_FRAMEBUFFER; ++ layer->hints = 0; ++ layer->flags = 0; ++ layer->handle = 0; ++ layer->transform = 0; ++ layer->blending = HWC_BLENDING_NONE; ++ layer->sourceCrop = r; ++ layer->displayFrame = r; ++ layer->visibleRegionScreen.numRects = 1; ++ layer->visibleRegionScreen.rects = &layer->displayFrame; ++ layer->acquireFenceFd = -1; ++ layer->releaseFenceFd = -1; ++ ++ layer = &list->hwLayers[1]; ++ memset(layer, 0, sizeof(hwc_layer_1_t)); ++ layer->compositionType = HWC_FRAMEBUFFER_TARGET; ++ layer->hints = 0; ++ layer->flags = 0; ++ layer->handle = 0; ++ layer->transform = 0; ++ layer->blending = HWC_BLENDING_NONE; ++ layer->sourceCrop = r; ++ layer->displayFrame = r; ++ layer->visibleRegionScreen.numRects = 1; ++ layer->visibleRegionScreen.rects = &layer->displayFrame; ++ layer->acquireFenceFd = -1; ++ layer->releaseFenceFd = -1; ++ ++ list->retireFenceFd = -1; ++ list->flags = HWC_GEOMETRY_CHANGED; ++ list->numHwLayers = 2; ++ ++ m_hwNativeWindow = new HWComposer(res.iWidth, res.iHeight, HAL_PIXEL_FORMAT_RGBA_8888, m_hwcDevicePtr, m_bufferList, &list->hwLayers[1]); ++ if (m_hwNativeWindow == NULL) ++ { ++ CLog::Log(LOGERROR, "HWComposer native window failed!"); ++ return false; ++ } ++ m_swNativeWindow = (static_cast<ANativeWindow *> (m_hwNativeWindow)); ++ ++ return true; ++#else ++ return false; ++#endif ++} ++ ++bool CEGLNativeTypeHybris::GetNativeDisplay(XBNativeDisplayType **nativeDisplay) const ++{ ++ if (!nativeDisplay) ++ return false; ++ ++ *nativeDisplay = (XBNativeDisplayType*) &m_nativeDisplay; ++ ++ return true; ++} ++ ++bool CEGLNativeTypeHybris::GetNativeWindow(XBNativeWindowType **nativeWindow) const ++{ ++ if (!nativeWindow) ++ return false; ++ ++#if defined(TARGET_HYBRIS) ++ *nativeWindow = (XBNativeWindowType*) &m_swNativeWindow; ++ return (m_swNativeWindow != NULL); ++#else ++ return false; ++#endif ++} ++ ++bool CEGLNativeTypeHybris::DestroyNativeDisplay() ++{ ++ return true; ++} ++ ++bool CEGLNativeTypeHybris::DestroyNativeWindow() ++{ ++ m_nativeWindow = NULL; ++ return true; ++} ++ ++bool CEGLNativeTypeHybris::GetNativeResolution(RESOLUTION_INFO *res) const ++{ ++#if defined(TARGET_HYBRIS) ++ uint32_t configs[5]; ++ size_t numConfigs = 5; ++ ++ int err = m_hwcDevicePtr->getDisplayConfigs(m_hwcDevicePtr, 0, configs, &numConfigs); ++ if (err) { ++ CLog::Log(LOGERROR, "getDisplayConfigs failed!"); ++ return false; ++ } ++ int32_t attr_values[3]; ++ uint32_t attributes[] = { HWC_DISPLAY_WIDTH, HWC_DISPLAY_HEIGHT, HWC_DISPLAY_VSYNC_PERIOD, HWC_DISPLAY_NO_ATTRIBUTE }; ++ ++ m_hwcDevicePtr->getDisplayAttributes(m_hwcDevicePtr, 0, configs[0], attributes, attr_values); ++ ++ res->iWidth = attr_values[0]; ++ res->iHeight = attr_values[1]; ++ res->fRefreshRate = 1000000000 / attr_values[2]; ++ ++ res->dwFlags = D3DPRESENTFLAG_PROGRESSIVE; ++ res->iScreen = 0; ++ res->bFullScreen = true; ++ res->iSubtitles = (int)(0.965 * res->iHeight); ++ res->fPixelRatio = 1.0f; ++ res->iScreenWidth = res->iWidth; ++ res->iScreenHeight = res->iHeight; ++ res->strMode = StringUtils::Format("%dx%d @ %.2f%s - Full Screen", res->iScreenWidth, res->iScreenHeight, res->fRefreshRate, ++ res->dwFlags & D3DPRESENTFLAG_INTERLACED ? "i" : ""); ++ CLog::Log(LOGNOTICE,"Current resolution: %s\n",res->strMode.c_str()); ++ return true; ++#endif ++} ++ ++bool CEGLNativeTypeHybris::SetNativeResolution(const RESOLUTION_INFO &res) ++{ ++ return false; ++} ++ ++bool CEGLNativeTypeHybris::ProbeResolutions(std::vector<RESOLUTION_INFO> &resolutions) ++{ ++ RESOLUTION_INFO res; ++ if (GetNativeResolution(&res) && res.iWidth > 1 && res.iHeight > 1) ++ { ++ resolutions.push_back(res); ++ return true; ++ } ++ return false; ++} ++ ++bool CEGLNativeTypeHybris::GetPreferredResolution(RESOLUTION_INFO *res) const ++{ ++ if (GetNativeResolution(res)) ++ return true; ++ return false; ++} ++ ++bool CEGLNativeTypeHybris::ShowWindow(bool show) ++{ ++ return true; ++} +diff --git a/xbmc/windowing/egl/EGLNativeTypeHybris.h b/xbmc/windowing/egl/EGLNativeTypeHybris.h +new file mode 100644 +index 0000000..73aa14d +--- /dev/null ++++ b/xbmc/windowing/egl/EGLNativeTypeHybris.h +@@ -0,0 +1,77 @@ ++#pragma once ++ ++/* ++ * Copyright (C) 2011-2012 Team XBMC ++ * http://www.xbmc.org ++ * ++ * This Program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2, or (at your option) ++ * any later version. ++ * ++ * This Program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with XBMC; see the file COPYING. If not, see ++ * <http://www.gnu.org/licenses/>. ++ * ++ */ ++ ++#if defined(TARGET_HYBRIS) ++#include <hwcomposerwindow/hwcomposer_window.h> ++#include <hardware/hardware.h> ++#include <hardware/hwcomposer.h> ++#endif ++ ++#include "EGLNativeType.h" ++#include "threads/Thread.h" ++ ++class HWComposer : public HWComposerNativeWindow ++{ ++ private: ++ hwc_layer_1_t *fblayer; ++ hwc_composer_device_1_t *hwcdevice; ++ hwc_display_contents_1_t **mlist; ++ protected: ++ void present(HWComposerNativeWindowBuffer *buffer); ++ public: ++ HWComposer(unsigned int width, unsigned int height, unsigned int format, hwc_composer_device_1_t *device, hwc_display_contents_1_t **mList, hwc_layer_1_t *layer); ++}; ++ ++class CEGLNativeTypeHybris : public CEGLNativeType ++{ ++public: ++ CEGLNativeTypeHybris(); ++ virtual ~CEGLNativeTypeHybris(); ++ virtual std::string GetNativeName() const { return "hybris"; }; ++ virtual bool CheckCompatibility(); ++ virtual void Initialize(); ++ virtual void Destroy(); ++ virtual int GetQuirks() { return 0; }; ++ ++ virtual bool CreateNativeDisplay(); ++ virtual bool CreateNativeWindow(); ++ virtual bool GetNativeDisplay(XBNativeDisplayType **nativeDisplay) const; ++ virtual bool GetNativeWindow(XBNativeWindowType **nativeWindow) const; ++ ++ virtual bool DestroyNativeWindow(); ++ virtual bool DestroyNativeDisplay(); ++ ++ virtual bool GetNativeResolution(RESOLUTION_INFO *res) const; ++ virtual bool SetNativeResolution(const RESOLUTION_INFO &res); ++ virtual bool ProbeResolutions(std::vector<RESOLUTION_INFO> &resolutions); ++ virtual bool GetPreferredResolution(RESOLUTION_INFO *res) const; ++ ++ virtual bool ShowWindow(bool show); ++#if defined(TARGET_HYBRIS) ++private: ++ hw_module_t *m_hwcModule; ++ hwc_display_contents_1_t **m_bufferList; ++ hwc_composer_device_1_t *m_hwcDevicePtr; ++ HWComposerNativeWindow *m_hwNativeWindow; ++ ANativeWindow *m_swNativeWindow; ++#endif ++}; +diff --git a/xbmc/windowing/egl/EGLWrapper.cpp b/xbmc/windowing/egl/EGLWrapper.cpp +index 0074027..526a9fe 100644 +--- a/xbmc/windowing/egl/EGLWrapper.cpp ++++ b/xbmc/windowing/egl/EGLWrapper.cpp +@@ -34,6 +34,10 @@ + #include "EGLNativeTypeIMX.h" + #endif + #include "EGLNativeTypeAmlogic.h" ++#ifdef HAS_HYBRIS ++#include "EGLNativeTypeHybris.h" ++#endif ++#include "EGLNativeTypeFbdev.h" + #include "EGLWrapper.h" + + #define CheckError() m_result = eglGetError(); if(m_result != EGL_SUCCESS) CLog::Log(LOGERROR, "EGL error in %s: %x",__FUNCTION__, m_result); +@@ -94,11 +98,14 @@ bool CEGLWrapper::Initialize(const std::string &implementation) + (nativeGuess = CreateEGLNativeType<CEGLNativeTypeAndroid>(implementation)) || + #endif + #if defined(TARGET_RASPBERRY_PI) +- (nativeGuess = CreateEGLNativeType<CEGLNativeTypeRaspberryPI>(implementation)) ++ (nativeGuess = CreateEGLNativeType<CEGLNativeTypeRaspberryPI>(implementation)) || + #elif defined(HAS_IMXVPU) +- (nativeGuess = CreateEGLNativeType<CEGLNativeTypeIMX>(implementation)) ++ (nativeGuess = CreateEGLNativeType<CEGLNativeTypeIMX>(implementation)) || ++#elif defined(HAS_HYBRIS) ++ (nativeGuess = CreateEGLNativeType<CEGLNativeTypeHybris>(implementation)) || + #else +- (nativeGuess = CreateEGLNativeType<CEGLNativeTypeAmlogic>(implementation)) ++ (nativeGuess = CreateEGLNativeType<CEGLNativeTypeAmlogic>(implementation)) || ++ (nativeGuess = CreateEGLNativeType<CEGLNativeTypeFbdev>(implementation)) + #endif + ) + { +@@ -420,4 +427,3 @@ bool CEGLWrapper::SurfaceAttrib(EGLDisplay display, EGLSurface surface, EGLint a + return eglSurfaceAttrib(display, surface, attribute, value); + } + #endif +- +diff --git a/xbmc/windowing/egl/Makefile.in b/xbmc/windowing/egl/Makefile.in +index 3754233..c863504 100644 +--- a/xbmc/windowing/egl/Makefile.in ++++ b/xbmc/windowing/egl/Makefile.in +@@ -13,6 +13,10 @@ endif + ifeq (@USE_IMXVPU@,1) + SRCS+= EGLNativeTypeIMX.cpp + endif ++ifeq (@USE_HYBRIS@,1) ++SRCS+= EGLNativeTypeHybris.cpp ++endif ++SRCS+= EGLNativeTypeFbdev.cpp + SRCS+= EGLWrapper.cpp + + LIB = windowing_egl.a diff --git a/projects/Odroid_C2/patches/libcec/libcec-00-aocec-support.patch b/projects/Odroid_C2/patches/libcec/libcec-00-aocec-support.patch new file mode 100644 index 00000000000..00f67c51336 --- /dev/null +++ b/projects/Odroid_C2/patches/libcec/libcec-00-aocec-support.patch @@ -0,0 +1,803 @@ +diff --git a/README.md b/README.md +index dfaf4d6..87491ef 100644 +--- a/README.md ++++ b/README.md +@@ -93,6 +93,12 @@ To compile in support for Exynos devices, you have to pass the argument -DHAVE_E + cmake -DHAVE_EXYNOS_API=1 .. + ``` + ++### AOCEC ++To compile in support for AOCEC devices, you have to pass the argument -DHAVE_AOCEC_API=1 to cmake: ++``` ++cmake -DHAVE_AOCEC_API=1 .. ++``` ++ + ### TDA995x + To compile in support for TDA995x devices, you have to pass the argument -DHAVE_TDA995X_API=1 to cmake: + ``` +diff --git a/include/cectypes.h b/include/cectypes.h +index 0fdd48e..881a805 100644 +--- a/include/cectypes.h ++++ b/include/cectypes.h +@@ -309,6 +309,16 @@ namespace CEC { + #define CEC_EXYNOS_VIRTUAL_COM "Exynos" + + /*! ++ * the path to use for the AOCEC HDMI CEC device ++ */ ++#define CEC_AOCEC_PATH "/dev/cec" ++ ++/*! ++ * the name of the virtual COM port to use for the AOCEC' CEC wire ++ */ ++#define CEC_AOCEC_VIRTUAL_COM "AOCEC" ++ ++/*! + * Mimimum client version + */ + #define CEC_MIN_LIB_VERSION 3 +@@ -877,7 +887,8 @@ typedef enum cec_adapter_type + ADAPTERTYPE_P8_DAUGHTERBOARD = 0x2, + ADAPTERTYPE_RPI = 0x100, + ADAPTERTYPE_TDA995x = 0x200, +- ADAPTERTYPE_EXYNOS = 0x300 ++ ADAPTERTYPE_EXYNOS = 0x300, ++ ADAPTERTYPE_AOCEC = 0x500 + } cec_adapter_type; + + /** force exporting through swig */ +diff --git a/src/libcec/CMakeLists.txt b/src/libcec/CMakeLists.txt +index a494533..d3eefa3 100644 +--- a/src/libcec/CMakeLists.txt ++++ b/src/libcec/CMakeLists.txt +@@ -87,6 +87,9 @@ set(CEC_HEADERS devices/CECRecordingDevice.h + adapter/Exynos/ExynosCEC.h + adapter/Exynos/ExynosCECAdapterDetection.h + adapter/Exynos/ExynosCECAdapterCommunication.h ++ adapter/AOCEC/AOCEC.h ++ adapter/AOCEC/AOCECAdapterDetection.h ++ adapter/AOCEC/AOCECAdapterCommunication.h + adapter/Pulse-Eight/USBCECAdapterMessageQueue.h + adapter/Pulse-Eight/USBCECAdapterCommunication.h + adapter/Pulse-Eight/USBCECAdapterCommands.h +diff --git a/src/libcec/adapter/AOCEC/AOCEC.h b/src/libcec/adapter/AOCEC/AOCEC.h +new file mode 100644 +index 0000000..560fbdd +--- /dev/null ++++ b/src/libcec/adapter/AOCEC/AOCEC.h +@@ -0,0 +1,55 @@ ++#pragma once ++/* ++ * This file is part of the libCEC(R) library. ++ * ++ * libCEC AOCEC Code Copyright (C) 2016 Gerald Dachs ++ * based heavily on: ++ * libCEC Exynos Code Copyright (C) 2014 Valentin Manea ++ * libCEC(R) is Copyright (C) 2011-2015 Pulse-Eight Limited. All rights reserved. ++ * libCEC(R) is an original work, containing original code. ++ * ++ * libCEC(R) is a trademark of Pulse-Eight Limited. ++ * ++ * This program is dual-licensed; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ++ * ++ * ++ * Alternatively, you can license this library under a commercial license, ++ * please contact Pulse-Eight Licensing for more information. ++ * ++ * For more information contact: ++ * Pulse-Eight Licensing <license@pulse-eight.com> ++ * http://www.pulse-eight.com/ ++ * http://www.pulse-eight.net/ ++ */ ++ ++ ++#define CEC_DEFAULT_PADDR 0x1000 ++ ++#define CEC_IOC_MAGIC 'C' ++#define CEC_IOC_GET_PHYSICAL_ADDR _IOR(CEC_IOC_MAGIC, 0x00, uint16_t) ++#define CEC_IOC_GET_VERSION _IOR(CEC_IOC_MAGIC, 0x01, int) ++#define CEC_IOC_GET_VENDOR_ID _IOR(CEC_IOC_MAGIC, 0x02, uint32_t) ++#define CEC_IOC_GET_PORT_INFO _IOR(CEC_IOC_MAGIC, 0x03, int) ++#define CEC_IOC_GET_PORT_NUM _IOR(CEC_IOC_MAGIC, 0x04, int) ++#define CEC_IOC_GET_SEND_FAIL_REASON _IOR(CEC_IOC_MAGIC, 0x05, uint32_t) ++#define CEC_IOC_SET_OPTION_WAKEUP _IOW(CEC_IOC_MAGIC, 0x06, uint32_t) ++#define CEC_IOC_SET_OPTION_ENALBE_CEC _IOW(CEC_IOC_MAGIC, 0x07, uint32_t) ++#define CEC_IOC_SET_OPTION_SYS_CTRL _IOW(CEC_IOC_MAGIC, 0x08, uint32_t) ++#define CEC_IOC_SET_OPTION_SET_LANG _IOW(CEC_IOC_MAGIC, 0x09, uint32_t) ++#define CEC_IOC_GET_CONNECT_STATUS _IOR(CEC_IOC_MAGIC, 0x0A, uint32_t) ++#define CEC_IOC_ADD_LOGICAL_ADDR _IOW(CEC_IOC_MAGIC, 0x0B, uint32_t) ++#define CEC_IOC_CLR_LOGICAL_ADDR _IOW(CEC_IOC_MAGIC, 0x0C, uint32_t) ++ ++#define CEC_MAX_FRAME_SIZE 16 +diff --git a/src/libcec/adapter/AOCEC/AOCECAdapterCommunication.cpp b/src/libcec/adapter/AOCEC/AOCECAdapterCommunication.cpp +new file mode 100644 +index 0000000..8edf981 +--- /dev/null ++++ b/src/libcec/adapter/AOCEC/AOCECAdapterCommunication.cpp +@@ -0,0 +1,343 @@ ++/* ++ * This file is part of the libCEC(R) library. ++ * ++ * libCEC AOCEC Code Copyright (C) 2016 Gerald Dachs ++ * based heavily on: ++ * libCEC Exynos Code Copyright (C) 2014 Valentin Manea ++ * libCEC(R) is Copyright (C) 2011-2015 Pulse-Eight Limited. All rights reserved. ++ * libCEC(R) is an original work, containing original code. ++ * ++ * libCEC(R) is a trademark of Pulse-Eight Limited. ++ * ++ * This program is dual-licensed; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ++ * ++ * ++ * Alternatively, you can license this library under a commercial license, ++ * please contact Pulse-Eight Licensing for more information. ++ * ++ * For more information contact: ++ * Pulse-Eight Licensing <license@pulse-eight.com> ++ * http://www.pulse-eight.com/ ++ * http://www.pulse-eight.net/ ++ */ ++ ++#include "env.h" ++#include <fcntl.h> ++#include <sys/ioctl.h> ++ ++ ++#if defined(HAVE_AOCEC_API) ++#include "AOCEC.h" ++#include "AOCECAdapterCommunication.h" ++ ++#include "CECTypeUtils.h" ++#include "LibCEC.h" ++#include <p8-platform/util/buffer.h> ++ ++using namespace CEC; ++using namespace P8PLATFORM; ++ ++#define LIB_CEC m_callback->GetLib() ++ ++ ++CAOCECAdapterCommunication::CAOCECAdapterCommunication(IAdapterCommunicationCallback *callback) : ++ IAdapterCommunication(callback), ++ m_bLogicalAddressChanged(false) ++{ ++ CLockObject lock(m_mutex); ++ ++ m_logicalAddresses.Clear(); ++ m_fd = INVALID_SOCKET_VALUE; ++} ++ ++ ++CAOCECAdapterCommunication::~CAOCECAdapterCommunication(void) ++{ ++ Close(); ++} ++ ++ ++bool CAOCECAdapterCommunication::IsOpen(void) ++{ ++ CLockObject lock(m_mutex); ++ return IsInitialised() && m_fd != INVALID_SOCKET_VALUE; ++} ++ ++ ++bool CAOCECAdapterCommunication::Open(uint32_t UNUSED(iTimeoutMs), bool UNUSED(bSkipChecks), bool bStartListening) ++{ ++ if (IsOpen()) ++ Close(); ++ ++ CLockObject lock(m_mutex); ++ ++ if ((m_fd = open(CEC_AOCEC_PATH, O_RDWR)) > 0) ++ { ++ uint32_t enable = true; ++ ++ if (ioctl(m_fd, CEC_IOC_SET_OPTION_SYS_CTRL, enable)) ++ { ++ LIB_CEC->AddLog(CEC_LOG_ERROR, "%s: IOCTL IOCTL CEC_IOC_SET_OPTION_SYS_CTRL failed !", __func__); ++ return false; ++ } ++ ++ if (!bStartListening || CreateThread()) { ++ return true; ++ } ++ close(m_fd); ++ m_fd = INVALID_SOCKET_VALUE; ++ } ++ return false; ++} ++ ++ ++void CAOCECAdapterCommunication::Close(void) ++{ ++ StopThread(0); ++ ++ CLockObject lock(m_mutex); ++ ++ uint32_t enable = false; ++ ++ if (ioctl(m_fd, CEC_IOC_SET_OPTION_SYS_CTRL, enable)) ++ { ++ LIB_CEC->AddLog(CEC_LOG_ERROR, "%s: IOCTL CEC_IOC_SET_OPTION_SYS_CTRL failed !", __func__); ++ } ++ ++ close(m_fd); ++ m_fd = INVALID_SOCKET_VALUE; ++} ++ ++ ++std::string CAOCECAdapterCommunication::GetError(void) const ++{ ++ std::string strError(m_strError); ++ return strError; ++} ++ ++int CAOCECAdapterCommunication::getFileDescriptor(void) ++{ ++ CLockObject lock(m_mutex); ++ ++ return m_fd; ++} ++ ++ ++ ++cec_adapter_message_state CAOCECAdapterCommunication::Write( ++ const cec_command &data, bool &UNUSED(bRetry), uint8_t UNUSED(iLineTimeout), bool UNUSED(bIsReply)) ++{ ++ uint8_t buffer[CEC_MAX_FRAME_SIZE]; ++ int32_t size = 1; ++ cec_adapter_message_state rc = ADAPTER_MESSAGE_STATE_ERROR; ++ ++ if (!IsOpen()) ++ return rc; ++ ++ CLockObject lock(m_mutex); ++ ++ if ((size_t)data.parameters.size + data.opcode_set > sizeof(buffer)) ++ { ++ LIB_CEC->AddLog(CEC_LOG_ERROR, "%s: data size too large !", __func__); ++ return ADAPTER_MESSAGE_STATE_ERROR; ++ } ++ ++ buffer[0] = (data.initiator << 4) | (data.destination & 0x0f); ++ ++ if (data.opcode_set) ++ { ++ buffer[1] = data.opcode; ++ size++; ++ ++ memcpy(&buffer[size], data.parameters.data, data.parameters.size); ++ size += data.parameters.size; ++ } ++ ++ if (write(m_fd, (void *)buffer, size) == size) ++ { ++ rc = ADAPTER_MESSAGE_STATE_SENT_ACKED; ++ } ++ else ++ { ++ LIB_CEC->AddLog(CEC_LOG_ERROR, "%s: write failed !", __func__); ++ } ++ ++ return rc; ++} ++ ++ ++uint16_t CAOCECAdapterCommunication::GetFirmwareVersion(void) ++{ ++ int version = 0; ++ ++ if (!IsOpen()) ++ return version; ++ ++ CLockObject lock(m_mutex); ++ ++ if (ioctl(m_fd, CEC_IOC_GET_VERSION, &version) < 0) ++ { ++ LIB_CEC->AddLog(CEC_LOG_ERROR, "%s: IOCTL CEC_IOC_GET_VERSION failed !", __func__); ++ } ++ return (uint16_t)version; ++} ++ ++ ++cec_vendor_id CAOCECAdapterCommunication::GetVendorId(void) ++{ ++ int vendor_id = CEC_VENDOR_UNKNOWN; ++ ++ if (!IsOpen()) ++ return cec_vendor_id(vendor_id); ++ ++ CLockObject lock(m_mutex); ++ ++ if (ioctl(m_fd, CEC_IOC_GET_VENDOR_ID, &vendor_id) < 0) ++ { ++ LIB_CEC->AddLog(CEC_LOG_ERROR, "%s: IOCTL CEC_IOC_GET_VENDOR_ID failed !", __func__); ++ } ++ return cec_vendor_id(vendor_id); ++} ++ ++ ++uint16_t CAOCECAdapterCommunication::GetPhysicalAddress(void) ++{ ++ int phys_addr = CEC_DEFAULT_PADDR; ++ ++ if (!IsOpen()) ++ return (uint16_t)phys_addr; ++ ++ CLockObject lock(m_mutex); ++ ++ if (ioctl(m_fd, CEC_IOC_GET_PHYSICAL_ADDR, &phys_addr) < 0) ++ { ++ LIB_CEC->AddLog(CEC_LOG_ERROR, "%s: IOCTL CEC_IOC_GET_PHYSICAL_ADDR failed !", __func__); ++ phys_addr = CEC_DEFAULT_PADDR; ++ } ++ return (uint16_t)phys_addr; ++} ++ ++ ++cec_logical_addresses CAOCECAdapterCommunication::GetLogicalAddresses(void) ++{ ++ return m_logicalAddresses; ++} ++ ++ ++bool CAOCECAdapterCommunication::SetLogicalAddresses(const cec_logical_addresses &addresses) ++{ ++ unsigned int log_addr = addresses.primary; ++ if (!IsOpen()) ++ return false; ++ ++ CLockObject lock(m_mutex); ++ ++ if (ioctl(m_fd, CEC_IOC_ADD_LOGICAL_ADDR, log_addr)) ++ { ++ LIB_CEC->AddLog(CEC_LOG_ERROR, "%s: IOCTL CEC_IOC_ADD_LOGICAL_ADDR failed !", __func__); ++ return false; ++ } ++ m_logicalAddresses = addresses; ++ m_bLogicalAddressChanged = true; ++ ++ return true; ++} ++ ++ ++void CAOCECAdapterCommunication::HandleLogicalAddressLost(cec_logical_address UNUSED(oldAddress)) ++{ ++ unsigned int log_addr = CECDEVICE_BROADCAST; ++ ++ if (!IsOpen()) ++ return; ++ ++ CLockObject lock(m_mutex); ++ ++ if (ioctl(m_fd, CEC_IOC_ADD_LOGICAL_ADDR, log_addr)) ++ { ++ LIB_CEC->AddLog(CEC_LOG_ERROR, "%s: IOCTL CEC_IOC_ADD_LOGICAL_ADDR failed !", __func__); ++ } ++} ++ ++ ++void *CAOCECAdapterCommunication::Process(void) ++{ ++ uint8_t buffer[CEC_MAX_FRAME_SIZE]; ++ uint32_t size; ++ fd_set rfds; ++ cec_logical_address initiator, destination; ++ struct timeval tv; ++ ++ if (!IsOpen()) ++ return 0; ++ ++ while (!IsStopped()) ++ { ++ int fd = getFileDescriptor(); ++ ++ if (fd == INVALID_SOCKET_VALUE) ++ { ++ break; ++ } ++ ++ FD_ZERO(&rfds); ++ FD_SET(fd, &rfds); ++ ++ tv.tv_sec = 1; ++ tv.tv_usec = 0; ++ ++ if (select(fd + 1, &rfds, NULL, NULL, &tv) >= 0 ) ++ { ++ ++ if (!FD_ISSET(fd, &rfds)) ++ continue; ++ ++ size = read(fd, buffer, CEC_MAX_FRAME_SIZE); ++ ++ if (size > 0) ++ { ++#if 0 // currently unused ++ if (buffer[0] == 0xff) // driver wants us to reread the physical address ++ { ++ if (!IsStopped()) ++ { ++ uint16_t iNewAddress = GetPhysicalAddress(); ++ m_callback->HandlePhysicalAddressChanged(iNewAddress); ++ } ++ continue; ++ } ++#endif ++ initiator = cec_logical_address(buffer[0] >> 4); ++ destination = cec_logical_address(buffer[0] & 0x0f); ++ ++ cec_command cmd; ++ ++ cec_command::Format( ++ cmd, initiator, destination, ++ ( size > 1 ) ? cec_opcode(buffer[1]) : CEC_OPCODE_NONE); ++ ++ for( uint8_t i = 2; i < size; i++ ) ++ cmd.parameters.PushBack(buffer[i]); ++ ++ if (!IsStopped()) ++ m_callback->OnCommandReceived(cmd); ++ } ++ } ++ } ++ ++ return 0; ++} ++ ++#endif // HAVE_AOCEC_API +diff --git a/src/libcec/adapter/AOCEC/AOCECAdapterCommunication.h b/src/libcec/adapter/AOCEC/AOCECAdapterCommunication.h +new file mode 100644 +index 0000000..f6a8a4a +--- /dev/null ++++ b/src/libcec/adapter/AOCEC/AOCECAdapterCommunication.h +@@ -0,0 +1,105 @@ ++#pragma once ++/* ++ * This file is part of the libCEC(R) library. ++ * ++ * libCEC AOCEC Code Copyright (C) 2016 Gerald Dachs ++ * based heavily on: ++ * libCEC Exynos Code Copyright (C) 2014 Valentin Manea ++ * libCEC(R) is Copyright (C) 2011-2015 Pulse-Eight Limited. All rights reserved. ++ * libCEC(R) is an original work, containing original code. ++ * ++ * libCEC(R) is a trademark of Pulse-Eight Limited. ++ * ++ * This program is dual-licensed; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ++ * ++ * ++ * Alternatively, you can license this library under a commercial license, ++ * please contact Pulse-Eight Licensing for more information. ++ * ++ * For more information contact: ++ * Pulse-Eight Licensing <license@pulse-eight.com> ++ * http://www.pulse-eight.com/ ++ * http://www.pulse-eight.net/ ++ */ ++ ++#include "env.h" ++ ++#if defined(HAVE_AOCEC_API) ++ ++#include <p8-platform/threads/mutex.h> ++#include <p8-platform/threads/threads.h> ++#include "../AdapterCommunication.h" ++#include <map> ++ ++namespace CEC ++{ ++ class CAOCECAdapterCommunication : public IAdapterCommunication, public P8PLATFORM::CThread ++ { ++ public: ++ /*! ++ * @brief Create a new Exynos HDMI CEC communication handler. ++ * @param callback The callback to use for incoming CEC commands. ++ */ ++ CAOCECAdapterCommunication(IAdapterCommunicationCallback *callback); ++ virtual ~CAOCECAdapterCommunication(void); ++ ++ /** @name IAdapterCommunication implementation */ ++ ///{ ++ bool Open(uint32_t iTimeoutMs = CEC_DEFAULT_CONNECT_TIMEOUT, bool bSkipChecks = false, bool bStartListening = true); ++ void Close(void); ++ bool IsOpen(void); ++ std::string GetError(void) const; ++ cec_adapter_message_state Write(const cec_command &data, bool &bRetry, uint8_t iLineTimeout, bool bIsReply); ++ ++ bool SetLineTimeout(uint8_t UNUSED(iTimeout)) { return true; } ++ bool StartBootloader(void) { return false; } ++ bool SetLogicalAddresses(const cec_logical_addresses &addresses); ++ cec_logical_addresses GetLogicalAddresses(void); ++ bool PingAdapter(void) { return IsInitialised(); } ++ uint16_t GetFirmwareVersion(void); ++ uint32_t GetFirmwareBuildDate(void) { return 0; } ++ bool IsRunningLatestFirmware(void) { return true; } ++ bool PersistConfiguration(const libcec_configuration & UNUSED(configuration)) { return false; } ++ bool GetConfiguration(libcec_configuration & UNUSED(configuration)) { return false; } ++ std::string GetPortName(void) { return std::string("AOCEC"); } ++ uint16_t GetPhysicalAddress(void); ++ bool SetControlledMode(bool UNUSED(controlled)) { return true; } ++ cec_vendor_id GetVendorId(void); ++ bool SupportsSourceLogicalAddress(const cec_logical_address address) { return address > CECDEVICE_TV && address <= CECDEVICE_BROADCAST; } ++ cec_adapter_type GetAdapterType(void) { return ADAPTERTYPE_AOCEC; } ++ uint16_t GetAdapterVendorId(void) const { return 1; } ++ uint16_t GetAdapterProductId(void) const { return 1; } ++ void HandleLogicalAddressLost(cec_logical_address oldAddress); ++ void SetActiveSource(bool UNUSED(bSetTo), bool UNUSED(bClientUnregistered)) {} ++ ///} ++ ++ /** @name P8PLATFORM::CThread implementation */ ++ ///{ ++ void *Process(void); ++ ///} ++ ++ private: ++ bool IsInitialised(void) const { return 1; }; ++ int getFileDescriptor(void); ++ ++ std::string m_strError; /**< current error message */ ++ ++ bool m_bLogicalAddressChanged; ++ cec_logical_addresses m_logicalAddresses; ++ P8PLATFORM::CMutex m_mutex; ++ int m_fd; ++ }; ++}; ++#endif +diff --git a/src/libcec/adapter/AOCEC/AOCECAdapterDetection.cpp b/src/libcec/adapter/AOCEC/AOCECAdapterDetection.cpp +new file mode 100644 +index 0000000..55f3ee0 +--- /dev/null ++++ b/src/libcec/adapter/AOCEC/AOCECAdapterDetection.cpp +@@ -0,0 +1,50 @@ ++/* ++ * This file is part of the libCEC(R) library. ++ * ++ * libCEC AOCEC Code Copyright (C) 2016 Gerald Dachs ++ * based heavily on: ++ * libCEC Exynos Code Copyright (C) 2014 Valentin Manea ++ * libCEC(R) is Copyright (C) 2011-2015 Pulse-Eight Limited. All rights reserved. ++ * libCEC(R) is an original work, containing original code. ++ * ++ * libCEC(R) is a trademark of Pulse-Eight Limited. ++ * ++ * This program is dual-licensed; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ++ * ++ * ++ * Alternatively, you can license this library under a commercial license, ++ * please contact Pulse-Eight Licensing for more information. ++ * ++ * For more information contact: ++ * Pulse-Eight Licensing <license@pulse-eight.com> ++ * http://www.pulse-eight.com/ ++ * http://www.pulse-eight.net/ ++ */ ++ ++#include "env.h" ++#include <stdio.h> ++ ++#if defined(HAVE_AOCEC_API) ++#include "AOCECAdapterDetection.h" ++#include "AOCEC.h" ++ ++using namespace CEC; ++ ++bool CAOCECAdapterDetection::FindAdapter(void) ++{ ++ return access(CEC_AOCEC_PATH, 0) == 0; ++} ++ ++#endif +diff --git a/src/libcec/adapter/AOCEC/AOCECAdapterDetection.h b/src/libcec/adapter/AOCEC/AOCECAdapterDetection.h +new file mode 100644 +index 0000000..cacaa19 +--- /dev/null ++++ b/src/libcec/adapter/AOCEC/AOCECAdapterDetection.h +@@ -0,0 +1,46 @@ ++#pragma once ++/* ++ * This file is part of the libCEC(R) library. ++ * ++ * libCEC AOCEC Code Copyright (C) 2016 Gerald Dachs ++ * based heavily on: ++ * libCEC Exynos Code Copyright (C) 2014 Valentin Manea ++ * libCEC(R) is Copyright (C) 2011-2015 Pulse-Eight Limited. All rights reserved. ++ * libCEC(R) is an original work, containing original code. ++ * ++ * libCEC(R) is a trademark of Pulse-Eight Limited. ++ * ++ * This program is dual-licensed; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ++ * ++ * ++ * Alternatively, you can license this library under a commercial license, ++ * please contact Pulse-Eight Licensing for more information. ++ * ++ * For more information contact: ++ * Pulse-Eight Licensing <license@pulse-eight.com> ++ * http://www.pulse-eight.com/ ++ * http://www.pulse-eight.net/ ++ */ ++ ++#include "env.h" ++ ++namespace CEC ++{ ++ class CAOCECAdapterDetection ++ { ++ public: ++ static bool FindAdapter(void); ++ }; ++} +diff --git a/src/libcec/adapter/AdapterFactory.cpp b/src/libcec/adapter/AdapterFactory.cpp +index da05725..1e946e6 100644 +--- a/src/libcec/adapter/AdapterFactory.cpp ++++ b/src/libcec/adapter/AdapterFactory.cpp +@@ -58,6 +58,11 @@ + #include "Exynos/ExynosCECAdapterCommunication.h" + #endif + ++#if defined(HAVE_AOCEC_API) ++#include "AOCEC/AOCECAdapterDetection.h" ++#include "AOCEC/AOCECAdapterCommunication.h" ++#endif ++ + using namespace CEC; + + int8_t CAdapterFactory::FindAdapters(cec_adapter *deviceList, uint8_t iBufSize, const char *strDevicePath /* = NULL */) +@@ -126,8 +131,20 @@ int8_t CAdapterFactory::DetectAdapters(cec_adapter_descriptor *deviceList, uint8 + } + #endif + ++#if defined(HAVE_AOCEC_API) ++ if (iAdaptersFound < iBufSize && CAOCECAdapterDetection::FindAdapter()) ++ { ++ snprintf(deviceList[iAdaptersFound].strComPath, sizeof(deviceList[iAdaptersFound].strComPath), CEC_AOCEC_PATH); ++ snprintf(deviceList[iAdaptersFound].strComName, sizeof(deviceList[iAdaptersFound].strComName), CEC_AOCEC_VIRTUAL_COM); ++ deviceList[iAdaptersFound].iVendorId = 0; ++ deviceList[iAdaptersFound].iProductId = 0; ++ deviceList[iAdaptersFound].adapterType = ADAPTERTYPE_AOCEC; ++ iAdaptersFound++; ++ } ++#endif ++ + +-#if !defined(HAVE_RPI_API) && !defined(HAVE_P8_USB) && !defined(HAVE_TDA995X_API) ++#if !defined(HAVE_RPI_API) && !defined(HAVE_P8_USB) && !defined(HAVE_TDA995X_API) && !defined(HAVE_AOCEC_API) + #error "libCEC doesn't have support for any type of adapter. please check your build system or configuration" + #endif + +@@ -146,6 +163,11 @@ IAdapterCommunication *CAdapterFactory::GetInstance(const char *strPort, uint16_ + return new CExynosCECAdapterCommunication(m_lib->m_cec); + #endif + ++#if defined(HAVE_AOCEC_API) ++ if (!strcmp(strPort, CEC_AOCEC_VIRTUAL_COM)) ++ return new CAOCECAdapterCommunication(m_lib->m_cec); ++#endif ++ + #if defined(HAVE_RPI_API) + if (!strcmp(strPort, CEC_RPI_VIRTUAL_COM)) + return new CRPiCECAdapterCommunication(m_lib->m_cec); +diff --git a/src/libcec/cmake/CheckPlatformSupport.cmake b/src/libcec/cmake/CheckPlatformSupport.cmake +index b8a16c8..93a97e6 100644 +--- a/src/libcec/cmake/CheckPlatformSupport.cmake ++++ b/src/libcec/cmake/CheckPlatformSupport.cmake +@@ -9,6 +9,7 @@ + # HAVE_RPI_API 1 if Raspberry Pi is supported + # HAVE_TDA995X_API 1 if TDA995X is supported + # HAVE_EXYNOS_API 1 if Exynos is supported ++# HAVE_AOCEC_API 1 if AOCEC is supported + # HAVE_P8_USB 1 if Pulse-Eight devices are supported + # HAVE_P8_USB_DETECT 1 if Pulse-Eight devices can be auto-detected + # HAVE_DRM_EDID_PARSER 1 if DRM EDID parsing is supported +@@ -132,6 +133,18 @@ else() + else() + set(HAVE_EXYNOS_API 0) + endif() ++ ++ # AOCEC ++ if (${HAVE_AOCEC_API}) ++ set(LIB_INFO "${LIB_INFO}, AOCEC") ++ set(HAVE_AOCEC_API 1) ++ set(CEC_SOURCES_ADAPTER_AOCEC adapter/AOCEC/AOCECAdapterDetection.cpp ++ adapter/AOCEC/AOCECAdapterCommunication.cpp) ++ source_group("Source Files\\adapter\\AOCEC" FILES ${CEC_SOURCES_ADAPTER_AOCEC}) ++ list(APPEND CEC_SOURCES ${CEC_SOURCES_ADAPTER_AOCEC}) ++ else() ++ set(HAVE_AOCEC_API 0) ++ endif() + endif() + + # rt +diff --git a/src/libcec/cmake/DisplayPlatformSupport.cmake b/src/libcec/cmake/DisplayPlatformSupport.cmake +index 9dcaacf..7ec10f5 100644 +--- a/src/libcec/cmake/DisplayPlatformSupport.cmake ++++ b/src/libcec/cmake/DisplayPlatformSupport.cmake +@@ -44,6 +44,12 @@ else() + message(STATUS "DRM support: no") + endif() + ++if (HAVE_AOCEC_API) ++ message(STATUS "AOCEC support: yes") ++else() ++ message(STATUS "AOCEC support: no") ++endif() ++ + if (HAVE_PYTHON) + message(STATUS "Python support: version ${PYTHONLIBS_VERSION_STRING} (${PYTHON_VERSION})") + else() +diff --git a/src/libcec/env.h.in b/src/libcec/env.h.in +index 0496aa0..fe6c83d 100644 +--- a/src/libcec/env.h.in ++++ b/src/libcec/env.h.in +@@ -72,6 +72,9 @@ + /* Define to 1 for Exynos support */ + #cmakedefine HAVE_EXYNOS_API @HAVE_EXYNOS_API@ + ++/* Define to 1 for AOCEC support */ ++#cmakedefine HAVE_AOCEC_API @HAVE_AOCEC_API@ ++ + /* Define to 1 for nVidia EDID parsing support (on selected models) */ + #cmakedefine HAVE_NVIDIA_EDID_PARSER @HAVE_NVIDIA_EDID_PARSER@ + diff --git a/projects/Odroid_C2/patches/linux/linux-002-gcc5-use_gcc_inline_version_instead_c99.patch b/projects/Odroid_C2/patches/linux/linux-002-gcc5-use_gcc_inline_version_instead_c99.patch new file mode 100644 index 00000000000..5d5be45d5fe --- /dev/null +++ b/projects/Odroid_C2/patches/linux/linux-002-gcc5-use_gcc_inline_version_instead_c99.patch @@ -0,0 +1,17 @@ +diff -Naur a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h +--- a/include/linux/compiler-gcc.h 2016-02-09 12:52:30.000000000 +0100 ++++ b/include/linux/compiler-gcc.h 2016-02-09 21:43:41.133285186 +0100 +@@ -53,9 +53,10 @@ + */ + #if !defined(CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING) || \ + !defined(CONFIG_OPTIMIZE_INLINING) || (__GNUC__ < 4) +-# define inline inline __attribute__((always_inline)) notrace +-# define __inline__ __inline__ __attribute__((always_inline)) notrace +-# define __inline __inline __attribute__((always_inline)) notrace ++/* XXX: check __GNUC_STDC_INLINE__, fix line length */ ++# define inline inline __attribute__((always_inline)) __attribute__((__gnu_inline__)) ++# define __inline__ __inline__ __attribute__((always_inline)) __attribute__((__gnu_inline__)) ++# define __inline __inline __attribute__((always_inline)) __attribute__((__gnu_inline__)) + #else + /* A lot of inline functions can cause havoc with function tracing */ + # define inline inline notrace diff --git a/projects/imx6/patches/linux/linux-003-no_dev_console.patch b/projects/Odroid_C2/patches/linux/linux-003-no_dev_console.patch similarity index 100% rename from projects/imx6/patches/linux/linux-003-no_dev_console.patch rename to projects/Odroid_C2/patches/linux/linux-003-no_dev_console.patch diff --git a/projects/Odroid_C2/patches/linux/linux-005-set-default-refresh-rate-switching-policy.patch b/projects/Odroid_C2/patches/linux/linux-005-set-default-refresh-rate-switching-policy.patch new file mode 100644 index 00000000000..ed4aa2d6311 --- /dev/null +++ b/projects/Odroid_C2/patches/linux/linux-005-set-default-refresh-rate-switching-policy.patch @@ -0,0 +1,25 @@ +diff -Naur a/drivers/amlogic/display/vout/tv_vout.c b/drivers/amlogic/display/vout/tv_vout.c +--- a/drivers/amlogic/display/vout/tv_vout.c 2016-04-06 23:18:37.000000000 -0700 ++++ b/drivers/amlogic/display/vout/tv_vout.c 2016-04-14 02:05:33.041542772 -0700 +@@ -70,8 +70,8 @@ + #ifdef CONFIG_AML_VOUT_FRAMERATE_AUTOMATION + #define DEFAULT_POLICY_FR_AUTO 1 + static enum vmode_e mode_by_user = VMODE_INIT_NULL; +-static int fr_auto_policy = DEFAULT_POLICY_FR_AUTO; +-static int fr_auto_policy_hold = DEFAULT_POLICY_FR_AUTO; ++static int fr_auto_policy = 0; ++static int fr_auto_policy_hold = 2; + static int fps_playing_flag; + static enum vmode_e fps_target_mode = VMODE_INIT_NULL; + static void policy_framerate_automation_switch_store(char *para); +@@ -1532,8 +1532,8 @@ + } + + #ifdef CONFIG_AML_VOUT_FRAMERATE_AUTOMATION +- sprintf(policy_fr_auto, "%d", DEFAULT_POLICY_FR_AUTO); +- sprintf(policy_fr_auto_switch, "%d", DEFAULT_POLICY_FR_AUTO); ++ sprintf(policy_fr_auto, "%d", 0); ++ sprintf(policy_fr_auto_switch, "%d", 2); + #endif + return 0; + } diff --git a/projects/Odroid_C2/patches/linux/linux-999.13-fix-u64-unknown-type.patch b/projects/Odroid_C2/patches/linux/linux-999.13-fix-u64-unknown-type.patch new file mode 100644 index 00000000000..e3c636281ab --- /dev/null +++ b/projects/Odroid_C2/patches/linux/linux-999.13-fix-u64-unknown-type.patch @@ -0,0 +1,12 @@ +diff -Naur a/arch/arm64/include/uapi/asm/sigcontext.h b/arch/arm64/include/uapi/asm/sigcontext.h +--- a/arch/arm64/include/uapi/asm/sigcontext.h 2016-04-06 23:18:37.000000000 -0700 ++++ b/arch/arm64/include/uapi/asm/sigcontext.h 2016-04-07 16:00:47.870241223 -0700 +@@ -58,7 +58,7 @@ + + struct esr_context { + struct _aarch64_ctx head; +- u64 esr; ++ __u64 esr; + }; + + #endif /* _UAPI__ASM_SIGCONTEXT_H */ diff --git a/projects/Odroid_C2/patches/linux/linux-999.20-New-amlogic-cec-hybrid-driver.patch b/projects/Odroid_C2/patches/linux/linux-999.20-New-amlogic-cec-hybrid-driver.patch new file mode 100644 index 00000000000..84658b7cc45 --- /dev/null +++ b/projects/Odroid_C2/patches/linux/linux-999.20-New-amlogic-cec-hybrid-driver.patch @@ -0,0 +1,2758 @@ +From f620a493a8506e79fa5adb7b867b6ba4bf95dd2c Mon Sep 17 00:00:00 2001 +From: Radostan Riedel <raybuntu@googlemail.com> +Date: Thu, 5 May 2016 18:00:34 +0200 +Subject: [PATCH 1/1] New amlogic cec hybrid driver + +--- + arch/arm64/boot/dts/meson64_odroidc2.dts | 19 + + drivers/amlogic/Kconfig | 2 + + drivers/amlogic/Makefile | 2 + + drivers/amlogic/cec/Kconfig | 9 + + drivers/amlogic/cec/Makefile | 1 + + drivers/amlogic/cec/hdmi_ao_cec.c | 2009 ++++++++++++++++++++++++ + drivers/amlogic/cec/hdmi_ao_cec.h | 179 +++ + drivers/amlogic/hdmi/Kconfig | 2 + + drivers/amlogic/hdmi/hdmi_tx_20/Makefile | 3 + + drivers/amlogic/hdmi/hdmi_tx_20/hdmi_tx_main.c | 3 +- + drivers/amlogic/hdmi/hdmi_tx_20/hw/Makefile | 5 +- + drivers/amlogic/hdmi/hdmi_tx_20/hw/reg_ops.c | 4 + + include/linux/amlogic/hdmi_tx/hdmi_tx_cec_20.h | 356 +++++ + 13 files changed, 2592 insertions(+), 2 deletions(-) + create mode 100644 drivers/amlogic/cec/Kconfig + create mode 100644 drivers/amlogic/cec/Makefile + create mode 100644 drivers/amlogic/cec/hdmi_ao_cec.c + create mode 100644 drivers/amlogic/cec/hdmi_ao_cec.h + create mode 100644 include/linux/amlogic/hdmi_tx/hdmi_tx_cec_20.h + +diff --git a/arch/arm64/boot/dts/meson64_odroidc2.dts b/arch/arm64/boot/dts/meson64_odroidc2.dts +index b47490b..7d9b4cf 100644 +--- a/arch/arm64/boot/dts/meson64_odroidc2.dts ++++ b/arch/arm64/boot/dts/meson64_odroidc2.dts +@@ -410,6 +410,25 @@ + }; + }; + ++ aocec: aocec{ ++ compatible = "amlogic, amlogic-aocec"; ++ device_name = "aocec"; ++ status = "okay"; ++ vendor_name = "Hardkernel"; /* Max Chars: 8 */ ++ vendor_id = <0x000000>; /* Refer to http://standards.ieee.org/develop/regauth/oui/oui.txt */ ++ product_desc = "ODROID-C2"; /* Max Chars: 16 */ ++ cec_osd_string = "ODROID-C2"; /* Max Chars: 14 */ ++ port_num = <3>; ++ arc_port_mask = <0x0>; ++ interrupts = <0 199 1>; ++ interrupt-names = "hdmi_aocec"; ++ pinctrl-names = "hdmitx_aocec"; ++ pinctrl-0=<&hdmitx_aocec>; ++ reg = <0x0 0xc810023c 0x0 0x4 ++ 0x0 0xc8100000 0x0 0x200 ++ 0x0 0xda83e000 0x0 0x10>; ++ }; ++ + uart_AO: serial@c81004c0 { + compatible = "amlogic, meson-uart"; + reg = <0x0 0xc81004c0 0x0 0x14>; +diff --git a/drivers/amlogic/Kconfig b/drivers/amlogic/Kconfig +index 5a2b9d4..c9543f0 100644 +--- a/drivers/amlogic/Kconfig ++++ b/drivers/amlogic/Kconfig +@@ -3,6 +3,8 @@ + # + menu "Amlogic Device Drivers" + ++source "drivers/amlogic/cec/Kconfig" ++ + source "drivers/amlogic/clocksource/Kconfig" + + source "drivers/amlogic/uart/Kconfig" +diff --git a/drivers/amlogic/Makefile b/drivers/amlogic/Makefile +index 5f1ce80..92ce12b 100644 +--- a/drivers/amlogic/Makefile ++++ b/drivers/amlogic/Makefile +@@ -117,3 +117,5 @@ obj-$(CONFIG_AML_WDT) += watchdog/ + obj-$(CONFIG_INSTABOOT) += instaboot/ + + obj-$(CONFIG_MESON_PWM) += pwm/ ++ ++obj-$(CONFIG_AML_AO_CEC) += cec/ +diff --git a/drivers/amlogic/cec/Kconfig b/drivers/amlogic/cec/Kconfig +new file mode 100644 +index 0000000..ff4d159 +--- /dev/null ++++ b/drivers/amlogic/cec/Kconfig +@@ -0,0 +1,9 @@ ++menu "AO CEC Support" ++ ++config AML_AO_CEC ++ boolean "HDMI AO cec driver support" ++ help ++ HDMI AO cec driver provide cec support on Amlogic SOC chips, you can ++ use this driver to implement cec features on TV/MBOX ++ ++endmenu +diff --git a/drivers/amlogic/cec/Makefile b/drivers/amlogic/cec/Makefile +new file mode 100644 +index 0000000..1c16a4b +--- /dev/null ++++ b/drivers/amlogic/cec/Makefile +@@ -0,0 +1 @@ ++obj-$(CONFIG_AML_AO_CEC) += hdmi_ao_cec.o +diff --git a/drivers/amlogic/cec/hdmi_ao_cec.c b/drivers/amlogic/cec/hdmi_ao_cec.c +new file mode 100644 +index 0000000..6c9b2fd +--- /dev/null ++++ b/drivers/amlogic/cec/hdmi_ao_cec.c +@@ -0,0 +1,2009 @@ ++/* ++ * drivers/amlogic/cec/hdmi_ao_cec.c ++ * ++ * Copyright (C) 2015 Amlogic, Inc. All rights reserved. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, but WITHOUT ++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for ++ * more details. ++ * ++*/ ++#include <linux/version.h> ++#include <linux/module.h> ++#include <linux/irq.h> ++#include <linux/types.h> ++#include <linux/input.h> ++#include <linux/kernel.h> ++#include <linux/kthread.h> ++#include <linux/delay.h> ++#include <linux/interrupt.h> ++#include <linux/fs.h> ++#include <linux/init.h> ++#include <linux/device.h> ++#include <linux/mm.h> ++#include <linux/major.h> ++#include <linux/platform_device.h> ++#include <linux/mutex.h> ++#include <linux/cdev.h> ++#include <asm/irq.h> ++#include <linux/io.h> ++#include <linux/module.h> ++#include <linux/kernel.h> ++#include <linux/slab.h> ++#include <linux/list.h> ++#include <linux/spinlock.h> ++#include <linux/spinlock_types.h> ++#include <linux/switch.h> ++#include <linux/workqueue.h> ++#include <linux/timer.h> ++ ++#include <linux/uaccess.h> ++#include <linux/delay.h> ++#include <linux/amlogic/tvin/tvin.h> ++#include <linux/wakelock_android.h> ++ ++#include <linux/amlogic/hdmi_tx/hdmi_tx_cec_20.h> ++//#include <linux/amlogic/hdmi_tx/hdmi_tx_cec.h> ++#include <linux/amlogic/hdmi_tx/hdmi_tx_module.h> ++#include <linux/of.h> ++#include <linux/pinctrl/consumer.h> ++#include <linux/of_irq.h> ++#include "hdmi_ao_cec.h" ++#include <linux/notifier.h> ++#include <linux/reboot.h> ++#include <linux/amlogic/pm.h> ++#include <linux/of_address.h> ++#ifdef CONFIG_HAS_EARLYSUSPEND ++#include <linux/earlysuspend.h> ++static struct early_suspend aocec_suspend_handler; ++#endif ++ ++ ++#define CEC_FRAME_DELAY msecs_to_jiffies(400) ++#define CEC_DEV_NAME "cec" ++ ++#define DEV_TYPE_TX 4 ++#define DEV_TYPE_RX 0 ++ ++#define CEC_EARLY_SUSPEND (1 << 0) ++#define CEC_DEEP_SUSPEND (1 << 1) ++ ++/* global struct for tx and rx */ ++struct ao_cec_dev { ++ unsigned long dev_type; ++ unsigned int port_num; ++ unsigned int arc_port; ++ unsigned int hal_flag; ++ unsigned int phy_addr; ++ unsigned int port_seq; ++ unsigned long irq_cec; ++ void __iomem *exit_reg; ++ void __iomem *cec_reg; ++ void __iomem *hdmi_rxreg; ++ struct hdmitx_dev *tx_dev; ++ struct workqueue_struct *cec_thread; ++ struct device *dbg_dev; ++ struct delayed_work cec_work; ++ struct completion rx_ok; ++ struct completion tx_ok; ++ spinlock_t cec_reg_lock; ++ struct mutex cec_mutex; ++#ifdef CONFIG_PM ++ int cec_suspend; ++#endif ++ struct vendor_info_data v_data; ++ struct cec_global_info_t cec_info; ++}; ++ ++static int phy_addr_test; ++ ++/* from android cec hal */ ++enum { ++ HDMI_OPTION_WAKEUP = 1, ++ HDMI_OPTION_ENABLE_CEC = 2, ++ HDMI_OPTION_SYSTEM_CEC_CONTROL = 3, ++ HDMI_OPTION_SET_LANG = 5, ++}; ++ ++static struct ao_cec_dev *cec_dev; ++static int cec_tx_result; ++ ++static unsigned char rx_msg[MAX_MSG]; ++static unsigned char rx_len; ++static unsigned int new_msg; ++bool cec_msg_dbg_en = 1; ++ ++#define CEC_ERR(format, args...) \ ++ {if (cec_dev->dbg_dev) \ ++ dev_err(cec_dev->dbg_dev, format, ##args); \ ++ } ++ ++#define CEC_INFO(format, args...) \ ++ {if (cec_msg_dbg_en && cec_dev->dbg_dev) \ ++ dev_info(cec_dev->dbg_dev, format, ##args); \ ++ } ++ ++static unsigned char msg_log_buf[128] = { 0 }; ++ ++#define waiting_aocec_free() \ ++ do {\ ++ unsigned long cnt = 0;\ ++ while (readl(cec_dev->cec_reg + AO_CEC_RW_REG) & (1<<23)) {\ ++ if (3500 == cnt++) { \ ++ pr_info("waiting aocec free time out.\n");\ ++ break;\ ++ } \ ++ } \ ++ } while (0) ++ ++#define HR_DELAY(n) (ktime_set(0, n * 1000 * 1000)) ++__u16 cec_key_map[160] = { ++ KEY_ENTER, KEY_UP, KEY_DOWN, KEY_LEFT, KEY_RIGHT, 0 , 0 , 0 ,//0x00 ++ 0 , KEY_HOMEPAGE , KEY_MENU, 0, 0, KEY_BACK, 0, 0, ++ 0 , 0, 0, 0, 0, 0, 0, 0,//0x10 ++ 0 , 0, 0, 0, 0, 0, 0, 0, ++ KEY_0 , KEY_1, KEY_2, KEY_3,KEY_4, KEY_5, KEY_6, KEY_7,//0x20 ++ KEY_8 , KEY_9, KEY_DOT, 0, 0, 0, 0, 0, ++ KEY_CHANNELUP , KEY_CHANNELDOWN, KEY_CHANNEL, 0, 0, 0, 0, 0,//0x30 ++ 0 , 0, 0, 0, 0, 0, 0, 0, ++ ++ KEY_POWER , KEY_VOLUMEUP, KEY_VOLUMEDOWN, KEY_MUTE, KEY_PLAYPAUSE, KEY_STOP, KEY_PLAYPAUSE, KEY_RECORD,//0x40 ++ KEY_REWIND, KEY_FASTFORWARD, KEY_EJECTCD, KEY_NEXTSONG, KEY_PREVIOUSSONG, 0, 0, 0, ++ 0 , 0, 0, KEY_PROGRAM, 0, 0, 0, 0,//0x50 ++ 0 , 0, 0, 0, 0, 0, 0, 0, ++ KEY_PLAYCD, KEY_PLAYPAUSE, KEY_RECORD, KEY_PAUSECD, KEY_STOPCD, KEY_MUTE, 0, KEY_TUNER,//0x60 ++ 0 , KEY_MEDIA, 0, 0, KEY_POWER, 0, 0, 0, ++ 0 , KEY_BLUE, KEY_RED, KEY_GREEN, KEY_YELLOW, 0, 0, 0,//0x70 ++ 0 , 0, 0, 0, 0, 0, 0, 0x2fd, ++ 0 , 0, 0, 0, 0, 0, 0, 0,//0x80 ++ 0 , 0, 0, 0, 0, 0, 0, 0, ++ 0 , KEY_EXIT, 0, 0, 0, 0, KEY_PVR, 0,//0x90 //samsung vendor buttons return and channel_list ++ 0 , 0, 0, 0, 0, 0, 0, 0, ++}; ++ ++struct hrtimer cec_key_timer; ++static int last_key_irq = -1; ++enum hrtimer_restart cec_key_up(struct hrtimer *timer) ++{ ++ input_event(cec_dev->cec_info.remote_cec_dev, ++ EV_KEY, cec_key_map[last_key_irq], 0); ++ input_sync(cec_dev->cec_info.remote_cec_dev); ++ CEC_INFO("last:%d up\n", cec_key_map[last_key_irq]); ++ ++ return HRTIMER_NORESTART; ++} ++ ++void cec_user_control_pressed_irq(unsigned char message_irq) ++{ ++ if (message_irq < 160) { ++ CEC_INFO("Key pressed: %d\n", message_irq); ++ input_event(cec_dev->cec_info.remote_cec_dev, EV_KEY, ++ cec_key_map[message_irq], 1); ++ input_sync(cec_dev->cec_info.remote_cec_dev); ++ last_key_irq = message_irq; ++ hrtimer_start(&cec_key_timer, HR_DELAY(200), HRTIMER_MODE_REL); ++ CEC_INFO(":key map:%d\n", cec_key_map[message_irq]); ++ } ++} ++ ++void cec_user_control_released_irq(void) ++{ ++ /* ++ * key must be valid ++ */ ++ if (last_key_irq != -1) { ++ CEC_INFO("Key released: %d\n",last_key_irq); ++ hrtimer_cancel(&cec_key_timer); ++ input_event(cec_dev->cec_info.remote_cec_dev, ++ EV_KEY, cec_key_map[last_key_irq], 0); ++ input_sync(cec_dev->cec_info.remote_cec_dev); ++ } ++} ++ ++void cec_set_reg_bits(unsigned int addr, unsigned int value, ++ unsigned int offset, unsigned int len) ++{ ++ unsigned int data32 = 0; ++ ++ data32 = readl(cec_dev->cec_reg + addr); ++ data32 &= ~(((1 << len) - 1) << offset); ++ data32 |= (value & ((1 << len) - 1)) << offset; ++ writel(data32, cec_dev->cec_reg + addr); ++} ++ ++unsigned int aocec_rd_reg(unsigned long addr) ++{ ++ unsigned int data32; ++ unsigned long flags; ++ waiting_aocec_free(); ++ spin_lock_irqsave(&cec_dev->cec_reg_lock, flags); ++ data32 = 0; ++ data32 |= 0 << 16; /* [16] cec_reg_wr */ ++ data32 |= 0 << 8; /* [15:8] cec_reg_wrdata */ ++ data32 |= addr << 0; /* [7:0] cec_reg_addr */ ++ writel(data32, cec_dev->cec_reg + AO_CEC_RW_REG); ++ ++ waiting_aocec_free(); ++ data32 = ((readl(cec_dev->cec_reg + AO_CEC_RW_REG)) >> 24) & 0xff; ++ spin_unlock_irqrestore(&cec_dev->cec_reg_lock, flags); ++ return data32; ++} /* aocec_rd_reg */ ++ ++void aocec_wr_reg(unsigned long addr, unsigned long data) ++{ ++ unsigned long data32; ++ unsigned long flags; ++ waiting_aocec_free(); ++ spin_lock_irqsave(&cec_dev->cec_reg_lock, flags); ++ data32 = 0; ++ data32 |= 1 << 16; /* [16] cec_reg_wr */ ++ data32 |= data << 8; /* [15:8] cec_reg_wrdata */ ++ data32 |= addr << 0; /* [7:0] cec_reg_addr */ ++ writel(data32, cec_dev->cec_reg + AO_CEC_RW_REG); ++ spin_unlock_irqrestore(&cec_dev->cec_reg_lock, flags); ++} /* aocec_wr_only_reg */ ++ ++static void cec_enable_irq(void) ++{ ++ cec_set_reg_bits(AO_CEC_INTR_MASKN, 0x6, 0, 3); ++ CEC_INFO("enable:int mask:0x%x\n", ++ readl(cec_dev->cec_reg + AO_CEC_INTR_MASKN)); ++} ++ ++static void cec_hw_buf_clear(void) ++{ ++ aocec_wr_reg(CEC_RX_MSG_CMD, RX_DISABLE); ++ aocec_wr_reg(CEC_TX_MSG_CMD, TX_ABORT); ++ aocec_wr_reg(CEC_RX_CLEAR_BUF, 1); ++ aocec_wr_reg(CEC_TX_CLEAR_BUF, 1); ++ udelay(100); ++ aocec_wr_reg(CEC_RX_CLEAR_BUF, 0); ++ aocec_wr_reg(CEC_TX_CLEAR_BUF, 0); ++ udelay(100); ++ aocec_wr_reg(CEC_RX_MSG_CMD, RX_NO_OP); ++ aocec_wr_reg(CEC_TX_MSG_CMD, TX_NO_OP); ++} ++ ++void cec_logicaddr_clear(void) ++{ ++ int i; ++ for (i = 0; i < 5; i++) { ++ aocec_wr_reg((CEC_LOGICAL_ADDR0 + i), 0); ++ cec_dev->cec_info.log_addr[i] = 0; ++ udelay(100); ++ } ++ cec_hw_buf_clear(); ++} ++ ++void cec_logicaddr_setByMask(unsigned int mask) ++{ ++ int i, j; ++ int reg = 0; ++ int primary = -1; ++ // ignore reserved device type ++ const int device_types[5] = {CEC_RECORDING_DEVICE, ++ CEC_PLAYBACK_DEVICE, ++ CEC_TUNER_DEVICE, ++ CEC_AUDIO_SYSTEM_DEVICE, ++ CEC_DISPLAY_DEVICE|CEC_UNREGISTERED ++ }; ++ mask &= 0xffff; ++ ++ if (mask == 0) { ++ cec_logicaddr_clear(); ++ return; ++ } ++ ++ for (i = CEC_TV_ADDR; i <= CEC_UNREGISTERED_ADDR; i++) { ++ if (reg > 4) { ++ break; ++ } ++ if ((mask & 1<<i) == 1<<i) { ++ for (j = 0; j <= sizeof(device_types); j++) { ++ // Max. one of each type ++ if (1<<i & device_types[j]) { ++ CEC_INFO("ADDING LA:0x%d reg:0x%d\n", i, ++ (CEC_LOGICAL_ADDR0 + reg)); ++ mask &= ~(mask & device_types[j]); ++ cec_dev->cec_info.log_addr[reg] = i; ++ cec_logicaddr_set(i, (CEC_LOGICAL_ADDR0 + reg)); ++ if (primary == -1); ++ primary = i; ++ cec_logicaddr_config(primary, 1); ++ reg++; ++ break; ++ } ++ } ++ } ++ } ++} ++ ++void cec_logicaddr_set(int logicaddr, int logreg) ++{ ++ aocec_wr_reg(logreg, 0); ++ cec_hw_buf_clear(); ++ aocec_wr_reg(logreg, (logicaddr & 0xf)); ++ udelay(100); ++ aocec_wr_reg(logreg, (0x1 << 4) | (logicaddr & 0xf)); ++ if (cec_msg_dbg_en) ++ CEC_INFO("set logical addr:0x%x\n", ++ aocec_rd_reg(logreg)); ++} ++ ++static void cec_hw_reset(void) ++{ ++ writel(0x1, cec_dev->cec_reg + AO_CEC_GEN_CNTL); ++ /* Enable gated clock (Normal mode). */ ++ cec_set_reg_bits(AO_CEC_GEN_CNTL, 1, 1, 1); ++ /* Release SW reset */ ++ udelay(100); ++ cec_set_reg_bits(AO_CEC_GEN_CNTL, 0, 0, 1); ++ ++ /* Enable all AO_CEC interrupt sources */ ++ cec_set_reg_bits(AO_CEC_INTR_MASKN, 0x6, 0, 3); ++ ++ cec_logicaddr_set(cec_dev->cec_info.log_addr[0], CEC_LOGICAL_ADDR0); ++ ++ /* Cec arbitration 3/5/7 bit time set. */ ++ cec_arbit_bit_time_set(3, 0x118, 0); ++ cec_arbit_bit_time_set(5, 0x000, 0); ++ cec_arbit_bit_time_set(7, 0x2aa, 0); ++ ++ CEC_INFO("hw reset :logical addr:0x%x\n", ++ aocec_rd_reg(CEC_LOGICAL_ADDR0)); ++} ++ ++void cec_rx_buf_clear(void) ++{ ++ aocec_wr_reg(CEC_RX_CLEAR_BUF, 0x1); ++ aocec_wr_reg(CEC_RX_CLEAR_BUF, 0x0); ++ CEC_INFO("rx buf clean\n"); ++} ++ ++int cec_rx_buf_check(void) ++{ ++ unsigned int rx_num_msg = aocec_rd_reg(CEC_RX_NUM_MSG); ++ if (rx_num_msg) ++ CEC_INFO("rx msg num:0x%02x\n", rx_num_msg); ++ ++ return rx_num_msg; ++} ++ ++int cec_ll_rx(unsigned char *msg, unsigned char *len) ++{ ++ int i; ++ int ret = -1; ++ int pos; ++ int rx_stat; ++ ++ rx_stat = aocec_rd_reg(CEC_RX_MSG_STATUS); ++ if ((RX_DONE != rx_stat) || (1 != aocec_rd_reg(CEC_RX_NUM_MSG))) { ++ CEC_INFO("rx status:%x\n", rx_stat); ++ writel((1 << 2), cec_dev->cec_reg + AO_CEC_INTR_CLR); ++ aocec_wr_reg(CEC_RX_MSG_CMD, RX_ACK_CURRENT); ++ aocec_wr_reg(CEC_RX_MSG_CMD, RX_NO_OP); ++ return ret; ++ } ++ ++ *len = aocec_rd_reg(CEC_RX_MSG_LENGTH) + 1; ++ ++ for (i = 0; i < (*len) && i < MAX_MSG; i++) ++ msg[i] = aocec_rd_reg(CEC_RX_MSG_0_HEADER + i); ++ ++ ret = rx_stat; ++ ++ /* ignore ping message */ ++ if (cec_msg_dbg_en == 1 && *len > 1) { ++ pos = 0; ++ pos += sprintf(msg_log_buf + pos, ++ "CEC: rx msg len: %d dat: ", *len); ++ for (i = 0; i < (*len); i++) ++ pos += sprintf(msg_log_buf + pos, "%02x ", msg[i]); ++ pos += sprintf(msg_log_buf + pos, "\n"); ++ msg_log_buf[pos] = '\0'; ++ CEC_INFO("%s", msg_log_buf); ++ } ++ writel((1 << 2), cec_dev->cec_reg + AO_CEC_INTR_CLR); ++ aocec_wr_reg(CEC_RX_MSG_CMD, RX_ACK_NEXT); ++ aocec_wr_reg(CEC_RX_MSG_CMD, RX_NO_OP); ++ return ret; ++} ++ ++void cec_polling_online_dev(int log_addr, int *bool) ++{ ++ unsigned int r; ++ unsigned char msg[1]; ++ int retry = 5; ++ ++ msg[0] = (log_addr<<4) | log_addr; ++ /* set broadcast address first */ ++ cec_logicaddr_set(0xf, CEC_LOGICAL_ADDR0); ++ if (cec_msg_dbg_en == 1) ++ CEC_INFO("CEC_LOGICAL_ADDR0:0x%i\n", ++ aocec_rd_reg(CEC_LOGICAL_ADDR0)); ++ while (retry) { ++ r = cec_ll_tx(msg, 1); ++ if (r == CEC_FAIL_BUSY) { ++ retry--; ++ CEC_INFO("try log addr %x busy, retry:%d\n", ++ log_addr, retry); ++ /* ++ * try to reset CEC if tx busy is found ++ */ ++ cec_hw_reset(); ++ } else ++ break; ++ } ++ ++ if (r == CEC_FAIL_NACK) { ++ *bool = 0; ++ } else if (r == CEC_FAIL_NONE) { ++ *bool = 1; ++ } ++ CEC_INFO("CEC: poll online logic device: 0x%x BOOL: %d\n", ++ log_addr, *bool); ++} ++ ++/************************ cec arbitration cts code **************************/ ++/* using the cec pin as fiq gpi to assist the bus arbitration */ ++ ++/* return value: 1: successful 0: error */ ++static int cec_ll_trigle_tx(const unsigned char *msg, int len) ++{ ++ int i; ++ unsigned int n; ++ int pos; ++ int reg; ++ unsigned int j = 20; ++ unsigned tx_stat; ++ static int cec_timeout_cnt = 1; ++ ++ while (1) { ++ tx_stat = aocec_rd_reg(CEC_TX_MSG_STATUS); ++ if (tx_stat != TX_BUSY) ++ break; ++ ++ if (!(j--)) { ++ CEC_INFO("wating busy timeout\n"); ++ aocec_wr_reg(CEC_TX_MSG_CMD, TX_ABORT); ++ cec_timeout_cnt++; ++ if (cec_timeout_cnt > 0x08) ++ cec_hw_reset(); ++ break; ++ } ++ msleep(20); ++ } ++ ++ reg = aocec_rd_reg(CEC_TX_MSG_STATUS); ++ if (reg == TX_IDLE || reg == TX_DONE) { ++ for (i = 0; i < len; i++) ++ aocec_wr_reg(CEC_TX_MSG_0_HEADER + i, msg[i]); ++ ++ aocec_wr_reg(CEC_TX_MSG_LENGTH, len-1); ++ aocec_wr_reg(CEC_TX_MSG_CMD, TX_REQ_CURRENT); ++ ++ if (cec_msg_dbg_en == 1) { ++ pos = 0; ++ pos += sprintf(msg_log_buf + pos, ++ "CEC: tx msg len: %d dat: ", len); ++ for (n = 0; n < len; n++) { ++ pos += sprintf(msg_log_buf + pos, ++ "%02x ", msg[n]); ++ } ++ ++ pos += sprintf(msg_log_buf + pos, "\n"); ++ ++ msg_log_buf[pos] = '\0'; ++ pr_info("%s", msg_log_buf); ++ } ++ cec_timeout_cnt = 0; ++ return 0; ++ } ++ return -1; ++} ++ ++void tx_irq_handle(void) ++{ ++ unsigned tx_status = aocec_rd_reg(CEC_TX_MSG_STATUS); ++ switch (tx_status) { ++ case TX_DONE: ++ aocec_wr_reg(CEC_TX_MSG_CMD, TX_NO_OP); ++ cec_tx_result = 0; ++ complete(&cec_dev->tx_ok); ++ break; ++ ++ case TX_BUSY: ++ CEC_ERR("TX_BUSY\n"); ++ break; ++ ++ case TX_ERROR: ++ if (cec_msg_dbg_en == 1) ++ CEC_ERR("TX ERROR!!!\n"); ++ if (RX_ERROR == aocec_rd_reg(CEC_RX_MSG_STATUS)) { ++ cec_hw_reset(); ++ } else { ++ aocec_wr_reg(CEC_TX_MSG_CMD, TX_NO_OP); ++ } ++ cec_tx_result = 1; ++ complete(&cec_dev->tx_ok); ++ break; ++ ++ case TX_IDLE: ++ break; ++ default: ++ break; ++ } ++ writel((1 << 1), cec_dev->cec_reg + AO_CEC_INTR_CLR); ++} ++ ++/* Return value: < 0: fail, > 0: success */ ++int cec_ll_tx(const unsigned char *msg, unsigned char len) ++{ ++ int ret = 0; ++ int timeout = msecs_to_jiffies(1000); ++ ++ if (len == 0) ++ return CEC_FAIL_NONE; ++ ++ mutex_lock(&cec_dev->cec_mutex); ++ /* ++ * do not send messanges if tv is not support CEC ++ */ ++ ret = cec_ll_trigle_tx(msg, len); ++ if (ret < 0) { ++ /* we should increase send idx if busy */ ++ CEC_INFO("tx busy\n"); ++ mutex_unlock(&cec_dev->cec_mutex); ++ return CEC_FAIL_BUSY; ++ } ++ cec_tx_result = 0; ++ ret = wait_for_completion_timeout(&cec_dev->tx_ok, timeout); ++ if (ret <= 0) { ++ /* timeout or interrupt */ ++ ret = CEC_FAIL_OTHER; ++ CEC_INFO("tx timeout\n"); ++ } else { ++ if (cec_tx_result) ++ ret = CEC_FAIL_NACK; ++ else ++ ret = CEC_FAIL_NONE; ++ } ++ mutex_unlock(&cec_dev->cec_mutex); ++ ++ return ret; ++} ++ ++/* -------------------------------------------------------------------------- */ ++/* AO CEC0 config */ ++/* -------------------------------------------------------------------------- */ ++void ao_cec_init(void) ++{ ++ unsigned long data32; ++ unsigned int reg; ++ /* Assert SW reset AO_CEC */ ++ reg = readl(cec_dev->cec_reg + AO_CRT_CLK_CNTL1); ++ /* 24MHz/ (731 + 1) = 32786.885Hz */ ++ reg &= ~(0x7ff << 16); ++ reg |= (731 << 16); /* divider from 24MHz */ ++ reg |= (0x1 << 26); ++ reg &= ~(0x800 << 16); /* select divider */ ++ writel(reg, cec_dev->cec_reg + AO_CRT_CLK_CNTL1); ++ data32 = 0; ++ data32 |= 0 << 1; /* [2:1] cntl_clk: */ ++ /* 0=Disable clk (Power-off mode); */ ++ /* 1=Enable gated clock (Normal mode); */ ++ /* 2=Enable free-run clk (Debug mode). */ ++ data32 |= 1 << 0; /* [0] sw_reset: 1=Reset */ ++ writel(data32, cec_dev->cec_reg + AO_CEC_GEN_CNTL); ++ /* Enable gated clock (Normal mode). */ ++ cec_set_reg_bits(AO_CEC_GEN_CNTL, 1, 1, 1); ++ /* Release SW reset */ ++ cec_set_reg_bits(AO_CEC_GEN_CNTL, 0, 0, 1); ++ ++ /* Enable all AO_CEC interrupt sources */ ++ cec_enable_irq(); ++} ++ ++void cec_arbit_bit_time_set(unsigned bit_set, unsigned time_set, unsigned flag) ++{ /* 11bit:bit[10:0] */ ++ if (flag) { ++ CEC_INFO("bit_set:0x%x;time_set:0x%x\n", ++ bit_set, time_set); ++ } ++ ++ switch (bit_set) { ++ case 3: ++ /* 3 bit */ ++ if (flag) { ++ CEC_INFO("read 3 bit:0x%x%x\n", ++ aocec_rd_reg(AO_CEC_TXTIME_4BIT_BIT10_8), ++ aocec_rd_reg(AO_CEC_TXTIME_4BIT_BIT7_0)); ++ } ++ aocec_wr_reg(AO_CEC_TXTIME_4BIT_BIT7_0, time_set & 0xff); ++ aocec_wr_reg(AO_CEC_TXTIME_4BIT_BIT10_8, (time_set >> 8) & 0x7); ++ if (flag) { ++ CEC_INFO("write 3 bit:0x%x%x\n", ++ aocec_rd_reg(AO_CEC_TXTIME_4BIT_BIT10_8), ++ aocec_rd_reg(AO_CEC_TXTIME_4BIT_BIT7_0)); ++ } ++ break; ++ /* 5 bit */ ++ case 5: ++ if (flag) { ++ CEC_INFO("read 5 bit:0x%x%x\n", ++ aocec_rd_reg(AO_CEC_TXTIME_2BIT_BIT10_8), ++ aocec_rd_reg(AO_CEC_TXTIME_2BIT_BIT7_0)); ++ } ++ aocec_wr_reg(AO_CEC_TXTIME_2BIT_BIT7_0, time_set & 0xff); ++ aocec_wr_reg(AO_CEC_TXTIME_2BIT_BIT10_8, (time_set >> 8) & 0x7); ++ if (flag) { ++ CEC_INFO("write 5 bit:0x%x%x\n", ++ aocec_rd_reg(AO_CEC_TXTIME_2BIT_BIT10_8), ++ aocec_rd_reg(AO_CEC_TXTIME_2BIT_BIT7_0)); ++ } ++ break; ++ /* 7 bit */ ++ case 7: ++ if (flag) { ++ CEC_INFO("read 7 bit:0x%x%x\n", ++ aocec_rd_reg(AO_CEC_TXTIME_17MS_BIT10_8), ++ aocec_rd_reg(AO_CEC_TXTIME_17MS_BIT7_0)); ++ } ++ aocec_wr_reg(AO_CEC_TXTIME_17MS_BIT7_0, time_set & 0xff); ++ aocec_wr_reg(AO_CEC_TXTIME_17MS_BIT10_8, (time_set >> 8) & 0x7); ++ if (flag) { ++ CEC_INFO("write 7 bit:0x%x%x\n", ++ aocec_rd_reg(AO_CEC_TXTIME_17MS_BIT10_8), ++ aocec_rd_reg(AO_CEC_TXTIME_17MS_BIT7_0)); ++ } ++ break; ++ default: ++ break; ++ } ++} ++ ++static unsigned int ao_cec_intr_stat(void) ++{ ++ return readl(cec_dev->cec_reg + AO_CEC_INTR_STAT); ++} ++ ++unsigned int cec_intr_stat(void) ++{ ++ return ao_cec_intr_stat(); ++} ++ ++/* ++ *wr_flag: 1 write; value valid ++ * 0 read; value invalid ++ */ ++unsigned int cec_config(unsigned int value, bool wr_flag) ++{ ++ if (wr_flag) ++ cec_set_reg_bits(AO_DEBUG_REG0, value, 0, 8); ++ ++ return readl(cec_dev->cec_reg + AO_DEBUG_REG0); ++} ++ ++/* ++ *wr_flag:1 write; value valid ++ * 0 read; value invalid ++ */ ++unsigned int cec_phyaddr_config(unsigned int value, bool wr_flag) ++{ ++ if (wr_flag) ++ cec_set_reg_bits(AO_DEBUG_REG1, value, 0, 16); ++ ++ return readl(cec_dev->cec_reg + AO_DEBUG_REG1); ++} ++ ++/* ++ *wr_flag:1 write; value valid ++ * 0 read; value invalid ++ */ ++unsigned int cec_logicaddr_config(unsigned int value, bool wr_flag) ++{ ++ if (wr_flag) ++ cec_set_reg_bits(AO_DEBUG_REG3, value, 0, 8); ++ ++ return readl(cec_dev->cec_reg + AO_DEBUG_REG3); ++} ++ ++void cec_keep_reset(void) ++{ ++ writel(0x1, cec_dev->cec_reg + AO_CEC_GEN_CNTL); ++} ++/* ++ * cec hw module init befor allocate logical address ++ */ ++static void cec_pre_init(void) ++{ ++ ao_cec_init(); ++ ++ cec_arbit_bit_time_set(3, 0x118, 0); ++ cec_arbit_bit_time_set(5, 0x000, 0); ++ cec_arbit_bit_time_set(7, 0x2aa, 0); ++} ++ ++static int cec_late_check_rx_buffer(void) ++{ ++ int ret; ++ struct delayed_work *dwork = &cec_dev->cec_work; ++ ++ ret = cec_rx_buf_check(); ++ if (!ret) ++ return 0; ++ /* ++ * start another check if rx buffer is full ++ */ ++ if ((-1) == cec_ll_rx(rx_msg, &rx_len)) { ++ CEC_INFO("buffer got unrecorgnized msg\n"); ++ cec_rx_buf_clear(); ++ return 0; ++ } else { ++ mod_delayed_work(cec_dev->cec_thread, dwork, 0); ++ return 1; ++ } ++} ++ ++void cec_key_report(int suspend) ++{ ++ input_event(cec_dev->cec_info.remote_cec_dev, EV_KEY, KEY_POWER, 1); ++ input_sync(cec_dev->cec_info.remote_cec_dev); ++ input_event(cec_dev->cec_info.remote_cec_dev, EV_KEY, KEY_POWER, 0); ++ input_sync(cec_dev->cec_info.remote_cec_dev); ++ if (!suspend) ++ CEC_INFO("== WAKE UP BY CEC ==\n") ++ else ++ CEC_INFO("== SLEEP by CEC==\n") ++} ++ ++void cec_give_version(unsigned int dest) ++{ ++ unsigned char index = cec_dev->cec_info.log_addr[0]; ++ unsigned char msg[3]; ++ ++ if (0xf != dest) { ++ msg[0] = ((index & 0xf) << 4) | dest; ++ msg[1] = CEC_OC_CEC_VERSION; ++ msg[2] = CEC_VERSION_14A; ++ cec_ll_tx(msg, 3); ++ } ++} ++ ++void cec_report_physical_address_smp(void) ++{ ++ unsigned char msg[5]; ++ unsigned char index = cec_dev->cec_info.log_addr[0]; ++ unsigned char phy_addr_ab, phy_addr_cd; ++ ++ phy_addr_ab = (cec_dev->phy_addr >> 8) & 0xff; ++ phy_addr_cd = (cec_dev->phy_addr >> 0) & 0xff; ++ msg[0] = ((index & 0xf) << 4) | CEC_BROADCAST_ADDR; ++ msg[1] = CEC_OC_REPORT_PHYSICAL_ADDRESS; ++ msg[2] = phy_addr_ab; ++ msg[3] = phy_addr_cd; ++ msg[4] = cec_dev->dev_type; ++ ++ cec_ll_tx(msg, 5); ++} ++ ++void cec_device_vendor_id(void) ++{ ++ unsigned char index = cec_dev->cec_info.log_addr[0]; ++ unsigned char msg[5]; ++ unsigned int vendor_id; ++ ++ vendor_id = cec_dev->v_data.vendor_id; ++ msg[0] = ((index & 0xf) << 4) | CEC_BROADCAST_ADDR; ++ msg[1] = CEC_OC_DEVICE_VENDOR_ID; ++ msg[2] = (vendor_id >> 16) & 0xff; ++ msg[3] = (vendor_id >> 8) & 0xff; ++ msg[4] = (vendor_id >> 0) & 0xff; ++ ++ cec_ll_tx(msg, 5); ++} ++ ++void cec_give_deck_status(unsigned int dest) ++{ ++ unsigned char index = cec_dev->cec_info.log_addr[0]; ++ unsigned char msg[3]; ++ ++ msg[0] = ((index & 0xf) << 4) | dest; ++ msg[1] = CEC_OC_DECK_STATUS; ++ msg[2] = 0x1a; ++ cec_ll_tx(msg, 3); ++} ++ ++void cec_menu_status_smp(int dest, int status) ++{ ++ unsigned char msg[3]; ++ unsigned char index = cec_dev->cec_info.log_addr[0]; ++ ++ msg[0] = ((index & 0xf) << 4) | dest; ++ msg[1] = CEC_OC_MENU_STATUS; ++ if (status == DEVICE_MENU_ACTIVE) ++ msg[2] = DEVICE_MENU_ACTIVE; ++ else ++ msg[2] = DEVICE_MENU_INACTIVE; ++ cec_ll_tx(msg, 3); ++} ++ ++void cec_inactive_source(int dest) ++{ ++ unsigned char index = cec_dev->cec_info.log_addr[0]; ++ unsigned char msg[4]; ++ unsigned char phy_addr_ab, phy_addr_cd; ++ ++ phy_addr_ab = (cec_dev->phy_addr >> 8) & 0xff; ++ phy_addr_cd = (cec_dev->phy_addr >> 0) & 0xff; ++ msg[0] = ((index & 0xf) << 4) | dest; ++ msg[1] = CEC_OC_INACTIVE_SOURCE; ++ msg[2] = phy_addr_ab; ++ msg[3] = phy_addr_cd; ++ ++ cec_ll_tx(msg, 4); ++} ++ ++void cec_set_osd_name(int dest) ++{ ++ unsigned char index = cec_dev->cec_info.log_addr[0]; ++ unsigned char osd_len = strlen(cec_dev->cec_info.osd_name); ++ unsigned char msg[16]; ++ ++ if (0xf != dest) { ++ msg[0] = ((index & 0xf) << 4) | dest; ++ msg[1] = CEC_OC_SET_OSD_NAME; ++ memcpy(&msg[2], cec_dev->cec_info.osd_name, osd_len); ++ ++ cec_ll_tx(msg, 2 + osd_len); ++ } ++} ++ ++void cec_active_source_smp(void) ++{ ++ unsigned char msg[4]; ++ unsigned char index = cec_dev->cec_info.log_addr[0]; ++ unsigned char phy_addr_ab; ++ unsigned char phy_addr_cd; ++ ++ phy_addr_ab = (cec_dev->phy_addr >> 8) & 0xff; ++ phy_addr_cd = (cec_dev->phy_addr >> 0) & 0xff; ++ msg[0] = ((index & 0xf) << 4) | CEC_BROADCAST_ADDR; ++ msg[1] = CEC_OC_ACTIVE_SOURCE; ++ msg[2] = phy_addr_ab; ++ msg[3] = phy_addr_cd; ++ cec_ll_tx(msg, 4); ++} ++ ++void cec_set_stream_path(unsigned char *msg) ++{ ++ unsigned int phy_addr_active; ++ ++ phy_addr_active = (unsigned int)(msg[2] << 8 | msg[3]); ++ if (phy_addr_active == cec_dev->phy_addr) { ++ cec_active_source_smp(); ++ /* ++ * some types of TV such as panasonic need to send menu status, ++ * otherwise it will not send remote key event to control ++ * device's menu ++ */ ++ cec_menu_status_smp(msg[0] >> 4, DEVICE_MENU_ACTIVE); ++ } ++} ++ ++void cec_report_power_status(int dest, int status) ++{ ++ unsigned char index = cec_dev->cec_info.log_addr[0]; ++ unsigned char msg[3]; ++ ++ msg[0] = ((index & 0xf) << 4) | dest; ++ msg[1] = CEC_OC_REPORT_POWER_STATUS; ++ msg[2] = status; ++ cec_ll_tx(msg, 3); ++} ++ ++void cec_send_simplink_alive(void) ++{ ++ unsigned char index = cec_dev->cec_info.log_addr[0]; ++ unsigned char msg[4]; ++ ++ msg[0] = ((index & 0xf) << 4) | CEC_TV_ADDR; ++ msg[1] = CEC_OC_VENDOR_COMMAND; ++ msg[2] = 0x2; ++ msg[3] = 0x5; ++ ++ cec_ll_tx(msg, 4); ++} ++ ++void cec_send_simplink_ack(void) ++{ ++ unsigned char index = cec_dev->cec_info.log_addr[0]; ++ unsigned char msg[4]; ++ ++ msg[0] = ((index & 0xf) << 4) | CEC_TV_ADDR; ++ msg[1] = CEC_OC_VENDOR_COMMAND; ++ msg[2] = 0x5; ++ msg[3] = 0x1; ++ ++ cec_ll_tx(msg, 4); ++} ++ ++int cec_node_init(struct hdmitx_dev *hdmitx_device) ++{ ++ unsigned char a, b, c, d; ++ ++ int i, bool = 0; ++ int phy_addr_ok = 1; ++ const enum _cec_log_dev_addr_e player_dev[3] = { ++ CEC_RECORDING_DEVICE_1_ADDR, ++ CEC_RECORDING_DEVICE_2_ADDR, ++ CEC_RECORDING_DEVICE_3_ADDR, ++ }; ++ ++ unsigned long cec_phy_addr; ++ ++ /* If no connect, return directly */ ++ if ((hdmitx_device->cec_init_ready == 0) || ++ (hdmitx_device->hpd_state == 0)) { ++ return -1; ++ } ++ a = hdmitx_device->hdmi_info.vsdb_phy_addr.a; ++ b = hdmitx_device->hdmi_info.vsdb_phy_addr.b; ++ c = hdmitx_device->hdmi_info.vsdb_phy_addr.c; ++ d = hdmitx_device->hdmi_info.vsdb_phy_addr.d; ++ CEC_INFO("cec_node_init started\n"); ++ ++ cec_phy_addr = ((a << 12) | (b << 8) | (c << 4) | (d << 0)); ++ ++ for (i = 0; i < 3; i++) { ++ CEC_INFO("CEC: start poll dev\n"); ++ cec_polling_online_dev(player_dev[i], &bool); ++ CEC_INFO("player_dev[%d]:0x%x\n", i, player_dev[i]); ++ if (bool == 0) { /* 0 means that no any respond */ ++ /* If VSDB is not valid, use last or default physical address. */ ++ cec_logicaddr_set(player_dev[i], CEC_LOGICAL_ADDR0); ++ if (hdmitx_device->hdmi_info.vsdb_phy_addr.valid == 0) { ++ phy_addr_ok = 0; ++ CEC_INFO("invalid cec PhyAddr\n"); ++ if (cec_phyaddr_config(0, 0)) { ++ CEC_INFO("use last physical address\n"); ++ } else { ++ cec_phyaddr_config(0x2000, 1); ++ CEC_INFO("use Def Phy address\n"); ++ } ++ } else ++ cec_phyaddr_config(cec_phy_addr, 1); ++ ++ CEC_INFO("physical address:0x%x\n", ++ cec_phyaddr_config(0, 0)); ++ ++ cec_dev->cec_info.power_status = TRANS_STANDBY_TO_ON; ++ cec_logicaddr_config(player_dev[i], 1); ++ cec_dev->cec_info.log_addr[0] = player_dev[i]; ++ /* Set Physical address */ ++ cec_dev->phy_addr = cec_phy_addr; ++ ++ cec_dev->cec_info.cec_version = CEC_VERSION_14A; ++ cec_dev->cec_info.vendor_id = cec_dev->v_data.vendor_id; ++ strcpy(cec_dev->cec_info.osd_name, ++ cec_dev->v_data.cec_osd_string); ++ cec_logicaddr_set(player_dev[i], CEC_LOGICAL_ADDR0); ++ ++ CEC_INFO("Set logical address: %d\n", ++ player_dev[i]); ++ ++ cec_dev->cec_info.power_status = POWER_ON; ++ if (cec_dev->cec_info.menu_status == DEVICE_MENU_INACTIVE) ++ break; ++ msleep(100); ++ if (phy_addr_ok) { ++ cec_report_physical_address_smp(); ++ msleep(150); ++ } ++ cec_device_vendor_id(); ++ cec_set_osd_name(0); ++ cec_active_source_smp(); ++ ++ cec_menu_status_smp(player_dev[i], DEVICE_MENU_ACTIVE); ++ ++ msleep(100); ++ cec_dev->cec_info.menu_status = DEVICE_MENU_ACTIVE; ++ break; ++ } ++ } ++ if (bool == 1) { ++ CEC_INFO("Can't get a valid logical address\n"); ++ return -1; ++ } else { ++ CEC_INFO("cec node init: cec features ok !\n"); ++ return 0; ++ } ++} ++ ++static void cec_rx_process(void) ++{ ++ int len = rx_len; ++ int initiator, follower; ++ int opcode; ++ unsigned char msg[MAX_MSG] = {}; ++ ++ if (len < 2 || !new_msg) /* ignore ping message */ ++ return; ++ ++ memcpy(msg, rx_msg, len); ++ initiator = ((msg[0] >> 4) & 0xf); ++ follower = msg[0] & 0xf; ++ if (follower != 0xf && follower != cec_dev->cec_info.log_addr[0]) { ++ CEC_ERR("wrong rx message of bad follower:%x", follower); ++ return; ++ } ++ opcode = msg[1]; ++ switch (opcode) { ++ case CEC_OC_GET_CEC_VERSION: ++ cec_give_version(initiator); ++ break; ++ ++ case CEC_OC_GIVE_DECK_STATUS: ++ cec_give_deck_status(initiator); ++ break; ++ ++ case CEC_OC_GIVE_PHYSICAL_ADDRESS: ++ cec_report_physical_address_smp(); ++ break; ++ ++ case CEC_OC_GIVE_DEVICE_VENDOR_ID: ++ cec_device_vendor_id(); ++ break; ++ ++ case CEC_OC_GIVE_OSD_NAME: ++ cec_set_osd_name(initiator); ++ break; ++ ++ case CEC_OC_STANDBY: ++ cec_inactive_source(initiator); ++ cec_menu_status_smp(initiator, DEVICE_MENU_INACTIVE); ++ break; ++ ++ case CEC_OC_SET_STREAM_PATH: ++ cec_set_stream_path(msg); ++ /* wake up if in early suspend */ ++ if (cec_dev->cec_suspend == CEC_EARLY_SUSPEND) ++ cec_key_report(0); ++ break; ++ ++ case CEC_OC_REQUEST_ACTIVE_SOURCE: ++ if (!cec_dev->cec_suspend) ++ cec_active_source_smp(); ++ break; ++ ++ case CEC_OC_GIVE_DEVICE_POWER_STATUS: ++ if (cec_dev->cec_suspend) ++ cec_report_power_status(initiator, POWER_STANDBY); ++ else ++ cec_report_power_status(initiator, POWER_ON); ++ break; ++ ++ ++ case CEC_OC_USER_CONTROL_RELEASED: ++ cec_user_control_released_irq(); ++ break; ++ ++ case CEC_OC_USER_CONTROL_PRESSED: ++ if (len < 3) ++ break; ++ cec_user_control_pressed_irq(msg[2]); ++ /* wake up by key function */ ++ if (cec_dev->cec_suspend == CEC_EARLY_SUSPEND) { ++ if (msg[2] == 0x40 || msg[2] == 0x6d) ++ cec_key_report(0); ++ } ++ break; ++ ++ case CEC_OC_PLAY: ++ if (len < 3) ++ break; ++ switch (msg[2]) { ++ case 0x24: ++ input_event(cec_dev->cec_info.remote_cec_dev, ++ EV_KEY, KEY_PLAYPAUSE, 1); ++ input_sync(cec_dev->cec_info.remote_cec_dev); ++ input_event(cec_dev->cec_info.remote_cec_dev, ++ EV_KEY, KEY_PLAYPAUSE, 0); ++ input_sync(cec_dev->cec_info.remote_cec_dev); ++ break; ++ case 0x25: ++ input_event(cec_dev->cec_info.remote_cec_dev, ++ EV_KEY, KEY_PLAYPAUSE, 1); ++ input_sync(cec_dev->cec_info.remote_cec_dev); ++ input_event(cec_dev->cec_info.remote_cec_dev, ++ EV_KEY, KEY_PLAYPAUSE, 0); ++ input_sync(cec_dev->cec_info.remote_cec_dev); ++ break; ++ default: ++ break; ++ } ++ break; ++ ++ case CEC_OC_DECK_CONTROL: ++ if (len < 3) ++ break; ++ switch (msg[2]) { ++ case 0x3: ++ input_event(cec_dev->cec_info.remote_cec_dev, ++ EV_KEY, KEY_STOP, 1); ++ input_sync(cec_dev->cec_info.remote_cec_dev); ++ input_event(cec_dev->cec_info.remote_cec_dev, ++ EV_KEY, KEY_STOP, 0); ++ input_sync(cec_dev->cec_info.remote_cec_dev); ++ break; ++ default: ++ break; ++ } ++ break; ++ ++ case CEC_OC_VENDOR_REMOTE_BUTTON_DOWN: ++ if (len < 3) ++ break; ++ switch(msg[2]){ ++ //samsung vendor keys ++ case 0x91: ++ input_event(cec_dev->cec_info.remote_cec_dev, EV_KEY, KEY_EXIT, 1); ++ input_sync(cec_dev->cec_info.remote_cec_dev); ++ input_event(cec_dev->cec_info.remote_cec_dev, EV_KEY, KEY_EXIT, 0); ++ input_sync(cec_dev->cec_info.remote_cec_dev); ++ break; ++ case 0x96: ++ input_event(cec_dev->cec_info.remote_cec_dev, EV_KEY, KEY_LIST, 1); ++ input_sync(cec_dev->cec_info.remote_cec_dev); ++ input_event(cec_dev->cec_info.remote_cec_dev, EV_KEY, KEY_LIST, 0); ++ input_sync(cec_dev->cec_info.remote_cec_dev); ++ break; ++ default: ++ break; ++ } ++ break; ++ case CEC_OC_MENU_REQUEST: ++ if (cec_dev->cec_suspend) ++ cec_menu_status_smp(initiator, DEVICE_MENU_INACTIVE); ++ else ++ cec_menu_status_smp(initiator, DEVICE_MENU_ACTIVE); ++ break; ++ case CEC_OC_VENDOR_COMMAND: ++ if (len < 3) ++ break; ++ if (msg[2] == 0x1) { ++ cec_report_power_status(initiator, cec_dev->cec_info.power_status); ++ cec_send_simplink_alive(); ++ } else if (msg[2] == 0x4) { ++ cec_send_simplink_ack(); ++ } ++ break; ++ ++ default: ++ CEC_ERR("unsupported command:%x\n", opcode); ++ break; ++ } ++ new_msg = 0; ++} ++ ++static void cec_task(struct work_struct *work) ++{ ++ struct delayed_work *dwork; ++ int ret; ++ ++ dwork = &cec_dev->cec_work; ++ if (cec_dev && ++ !(cec_dev->hal_flag & (1 << HDMI_OPTION_SYSTEM_CEC_CONTROL))) { ++ if (1 << cec_dev->cec_info.log_addr[0] & (1 << 0x0 | 1 << 0xF)) { ++ ret = cec_node_init(cec_dev->tx_dev); ++ if (ret < 0) { ++ return; ++ } ++ } ++ cec_rx_process(); ++ } ++ if (!cec_late_check_rx_buffer()) ++ queue_delayed_work(cec_dev->cec_thread, dwork, CEC_FRAME_DELAY); ++} ++ ++irqreturn_t cec_isr_handler(int irq, void *dev_instance) ++{ ++ unsigned int intr_stat = 0; ++ struct delayed_work *dwork; ++ ++ dwork = &cec_dev->cec_work; ++ intr_stat = cec_intr_stat(); ++ if (intr_stat & (1<<1)) { /* aocec tx intr */ ++ tx_irq_handle(); ++ return IRQ_HANDLED; ++ } ++ if ((-1) == cec_ll_rx(rx_msg, &rx_len)) ++ return IRQ_HANDLED; ++ ++ complete(&cec_dev->rx_ok); ++ /* check rx buffer is full */ ++ new_msg = 1; ++ mod_delayed_work(cec_dev->cec_thread, dwork, 0); ++ return IRQ_HANDLED; ++} ++ ++/******************** cec class interface *************************/ ++static ssize_t device_type_show(struct class *cla, ++ struct class_attribute *attr, char *buf) ++{ ++ return sprintf(buf, "%ld\n", cec_dev->dev_type); ++} ++ ++static ssize_t device_type_store(struct class *cla, ++ struct class_attribute *attr, const char *buf, size_t count) ++{ ++ unsigned long type; ++ ++ if (sscanf(buf, "%ld", &type) != 1) ++ return -EINVAL; ++ ++ cec_dev->dev_type = type; ++ CEC_ERR("set dev_type to %ld\n", type); ++ return count; ++} ++ ++static ssize_t menu_language_show(struct class *cla, ++ struct class_attribute *attr, char *buf) ++{ ++ char a, b, c; ++ a = ((cec_dev->cec_info.menu_lang >> 16) & 0xff); ++ b = ((cec_dev->cec_info.menu_lang >> 8) & 0xff); ++ c = ((cec_dev->cec_info.menu_lang >> 0) & 0xff); ++ return sprintf(buf, "%c%c%c\n", a, b, c); ++} ++ ++static ssize_t menu_language_store(struct class *cla, ++ struct class_attribute *attr, const char *buf, size_t count) ++{ ++ char a, b, c; ++ ++ if (sscanf(buf, "%c%c%c", &a, &b, &c) != 3) ++ return -EINVAL; ++ ++ cec_dev->cec_info.menu_lang = (a << 16) | (b << 8) | c; ++ CEC_ERR("set menu_language to %s\n", buf); ++ return count; ++} ++ ++static ssize_t vendor_id_show(struct class *cla, ++ struct class_attribute *attr, char *buf) ++{ ++ return sprintf(buf, "%x\n", cec_dev->cec_info.vendor_id); ++} ++ ++static ssize_t vendor_id_store(struct class *cla, struct class_attribute *attr, ++ const char *buf, size_t count) ++{ ++ int id; ++ ++ if (sscanf(buf, "%x", &id) != 1) ++ return -EINVAL; ++ cec_dev->cec_info.vendor_id = id; ++ return count; ++} ++ ++static ssize_t port_num_show(struct class *cla, ++ struct class_attribute *attr, char *buf) ++{ ++ return sprintf(buf, "%d\n", cec_dev->port_num); ++} ++ ++static ssize_t arc_port_show(struct class *cla, ++ struct class_attribute *attr, char *buf) ++{ ++ return sprintf(buf, "%x\n", cec_dev->arc_port); ++} ++ ++static ssize_t osd_name_show(struct class *cla, ++ struct class_attribute *attr, char *buf) ++{ ++ return sprintf(buf, "%s\n", cec_dev->cec_info.osd_name); ++} ++ ++static ssize_t port_seq_show(struct class *cla, ++ struct class_attribute *attr, char *buf) ++{ ++ return sprintf(buf, "%x\n", cec_dev->port_seq); ++} ++ ++static ssize_t port_status_show(struct class *cla, ++ struct class_attribute *attr, char *buf) ++{ ++ unsigned int tmp = 0; ++ ++ if (cec_dev->dev_type == DEV_TYPE_TX) { ++ tmp = cec_dev->tx_dev->hpd_state; ++ return sprintf(buf, "%x\n", tmp); ++ } ++ else { ++#ifdef CONFIG_TVIN_HDMI ++ tmp = hdmirx_rd_top(TOP_HPD_PWR5V); ++ CEC_INFO("TOP_HPD_PWR5V:%x\n", tmp); ++ tmp >>= 20; ++ tmp &= 0xf; ++#endif ++ return sprintf(buf, "%x\n", tmp); ++ } ++} ++ ++static ssize_t physical_addr_show(struct class *cla, ++ struct class_attribute *attr, char *buf) ++{ ++ unsigned int tmp = cec_dev->phy_addr; ++ ++ return sprintf(buf, "%04x\n", tmp); ++} ++ ++static ssize_t physical_addr_store(struct class *cla, ++ struct class_attribute *attr, ++ const char *buf, size_t count) ++{ ++ int addr; ++ ++ if (sscanf(buf, "%x", &addr) != 1) ++ return -EINVAL; ++ ++ if (addr > 0xffff || addr < 0) { ++ CEC_ERR("invalid input:%s\n", buf); ++ phy_addr_test = 0; ++ return -EINVAL; ++ } ++ cec_dev->phy_addr = addr; ++ phy_addr_test = 1; ++ return count; ++} ++ ++static ssize_t dbg_en_show(struct class *cla, ++ struct class_attribute *attr, char *buf) ++{ ++ return sprintf(buf, "%x\n", cec_msg_dbg_en); ++} ++ ++static ssize_t dbg_en_store(struct class *cla, struct class_attribute *attr, ++ const char *buf, size_t count) ++{ ++ int en; ++ ++ if (sscanf(buf, "%d", &en) != 1) ++ return -EINVAL; ++ ++ cec_msg_dbg_en = en ? 1 : 0; ++ return count; ++} ++ ++static struct class_attribute aocec_class_attr[] = { ++ __ATTR_RO(port_num), ++ __ATTR_RO(port_seq), ++ __ATTR_RO(osd_name), ++ __ATTR_RO(port_status), ++ __ATTR_RO(arc_port), ++ __ATTR(physical_addr, 0664, physical_addr_show, physical_addr_store), ++ __ATTR(vendor_id, 0664, vendor_id_show, vendor_id_store), ++ __ATTR(menu_language, 0664, menu_language_show, menu_language_store), ++ __ATTR(device_type, 0664, device_type_show, device_type_store), ++ __ATTR(dbg_en, 0664, dbg_en_show, dbg_en_store), ++ __ATTR_NULL ++}; ++ ++/******************** cec hal interface ***************************/ ++static int hdmitx_cec_open(struct inode *inode, struct file *file) ++{ ++ cec_dev->cec_info.open_count++; ++ if (cec_dev->cec_info.open_count) { ++ cec_dev->cec_info.hal_ctl = 1; ++ /* enable all cec features */ ++ cec_config(0x2f, 1); ++ } ++ return 0; ++} ++ ++static int hdmitx_cec_release(struct inode *inode, struct file *file) ++{ ++ cec_dev->cec_info.open_count--; ++ if (!cec_dev->cec_info.open_count) { ++ cec_dev->cec_info.hal_ctl = 0; ++ /* disable all cec features */ ++ cec_config(0x0, 1); ++ } ++ return 0; ++} ++ ++static ssize_t hdmitx_cec_read(struct file *f, char __user *buf, ++ size_t size, loff_t *p) ++{ ++ int ret; ++ ++ if ((cec_dev->hal_flag & (1 << HDMI_OPTION_SYSTEM_CEC_CONTROL))) ++ rx_len = 0; ++ ret = wait_for_completion_timeout(&cec_dev->rx_ok, CEC_FRAME_DELAY); ++ if (ret <= 0) ++ return ret; ++ if (rx_len == 0) ++ return 0; ++ ++ if (copy_to_user(buf, rx_msg, rx_len)) ++ return -EINVAL; ++ return rx_len; ++} ++ ++static ssize_t hdmitx_cec_write(struct file *f, const char __user *buf, ++ size_t size, loff_t *p) ++{ ++ unsigned char tempbuf[16] = {}; ++ int ret; ++ ++ if (size > 16) ++ size = 16; ++ if (size <= 0) ++ return 0; ++ ++ if (copy_from_user(tempbuf, buf, size)) ++ return -EINVAL; ++ ++ ret = cec_ll_tx(tempbuf, size); ++ /* delay a byte for continue message send */ ++ msleep(25); ++ if (ret == CEC_FAIL_NACK) { ++ return -1; ++ } ++ else { ++ return size; ++ } ++} ++ ++static void init_cec_port_info(struct hdmi_port_info *port, ++ struct ao_cec_dev *cec_dev) ++{ ++ unsigned int a, b, c; ++ ++ b = cec_dev->port_num; ++ for (a = 0; a < b; a++) { ++ port[a].type = HDMI_INPUT; ++ port[a].port_id = a + 1; ++ port[a].cec_supported = 1; ++ /* set ARC feature according mask */ ++ if (cec_dev->arc_port & (1 << a)) ++ port[a].arc_supported = 1; ++ else ++ port[a].arc_supported = 0; ++ ++ /* set port physical address according port sequence */ ++ if (cec_dev->port_seq) { ++ c = (cec_dev->port_seq >> (4 * a)) & 0xf; ++ port[a].physical_address = (c + 1) * 0x1000; ++ } else { ++ /* asending order if port_seq is not set */ ++ port[a].physical_address = (a + 1) * 0x1000; ++ } ++ } ++} ++ ++static long hdmitx_cec_ioctl(struct file *f, ++ unsigned int cmd, unsigned long arg) ++{ ++ void __user *argp = (void __user *)arg; ++ unsigned long tmp; ++ struct hdmi_port_info *port; ++ int a, b, c, d; ++ ++ switch (cmd) { ++ case CEC_IOC_GET_PHYSICAL_ADDR: ++ if (cec_dev->dev_type == DEV_TYPE_TX && !phy_addr_test) { ++ /* physical address for mbox */ ++ if (cec_dev->tx_dev->hdmi_info.vsdb_phy_addr.valid == 0) ++ return -EINVAL; ++ a = cec_dev->tx_dev->hdmi_info.vsdb_phy_addr.a; ++ b = cec_dev->tx_dev->hdmi_info.vsdb_phy_addr.b; ++ c = cec_dev->tx_dev->hdmi_info.vsdb_phy_addr.c; ++ d = cec_dev->tx_dev->hdmi_info.vsdb_phy_addr.d; ++ tmp = ((a << 12) | (b << 8) | (c << 4) | (d << 0)); ++ } else { ++ /* physical address for TV */ ++ tmp = 0; ++ } ++ if (!phy_addr_test) { ++ cec_dev->phy_addr = tmp; ++ cec_phyaddr_config(tmp, 1); ++ } else ++ tmp = cec_dev->phy_addr; ++ ++ if (copy_to_user(argp, &tmp, _IOC_SIZE(cmd))) ++ return -EINVAL; ++ break; ++ ++ case CEC_IOC_GET_VERSION: ++ tmp = CEC_VERSION_14A; ++ if (copy_to_user(argp, &tmp, _IOC_SIZE(cmd))) ++ return -EINVAL; ++ break; ++ ++ case CEC_IOC_GET_VENDOR_ID: ++ tmp = cec_dev->v_data.vendor_id; ++ if (copy_to_user(argp, &tmp, _IOC_SIZE(cmd))) ++ return -EINVAL; ++ break; ++ ++ case CEC_IOC_GET_PORT_NUM: ++ tmp = cec_dev->port_num; ++ if (copy_to_user(argp, &tmp, _IOC_SIZE(cmd))) ++ return -EINVAL; ++ break; ++ ++ case CEC_IOC_GET_PORT_INFO: ++ port = kzalloc(sizeof(*port) * cec_dev->port_num, GFP_KERNEL); ++ if (!port) { ++ CEC_ERR("no memory\n"); ++ return -EINVAL; ++ } ++ if (cec_dev->dev_type == DEV_TYPE_TX) { ++ /* for tx only 1 port */ ++ a = cec_dev->tx_dev->hdmi_info.vsdb_phy_addr.a; ++ b = cec_dev->tx_dev->hdmi_info.vsdb_phy_addr.b; ++ c = cec_dev->tx_dev->hdmi_info.vsdb_phy_addr.c; ++ d = cec_dev->tx_dev->hdmi_info.vsdb_phy_addr.d; ++ tmp = ((a << 12) | (b << 8) | (c << 4) | (d << 0)); ++ if (cec_dev->tx_dev->hdmi_info.vsdb_phy_addr.valid == 0) ++ tmp = 0xffff; ++ port->type = HDMI_OUTPUT; ++ port->port_id = 1; ++ port->cec_supported = 1; ++ /* not support arc for tx */ ++ port->arc_supported = 0; ++ port->physical_address = tmp & 0xffff; ++ if (copy_to_user(argp, port, sizeof(*port))) { ++ kfree(port); ++ return -EINVAL; ++ } ++ } else { ++ b = cec_dev->port_num; ++ init_cec_port_info(port, cec_dev); ++ if (copy_to_user(argp, port, sizeof(*port) * b)) { ++ kfree(port); ++ return -EINVAL; ++ } ++ } ++ kfree(port); ++ break; ++ ++ case CEC_IOC_SET_OPTION_WAKEUP: ++ /* TODO: */ ++ break; ++ ++ case CEC_IOC_SET_OPTION_ENALBE_CEC: ++ tmp = (1 << HDMI_OPTION_ENABLE_CEC); ++ if (arg) { ++ cec_dev->hal_flag |= tmp; ++ cec_pre_init(); ++ } else { ++ cec_dev->hal_flag &= ~(tmp); ++ CEC_INFO("disable CEC\n"); ++ cec_keep_reset(); ++ } ++ break; ++ ++ case CEC_IOC_SET_OPTION_SYS_CTRL: ++ tmp = (1 << HDMI_OPTION_SYSTEM_CEC_CONTROL); ++ if (arg) ++ cec_dev->hal_flag |= tmp; ++ else ++ cec_dev->hal_flag &= ~(tmp); ++ break; ++ ++ case CEC_IOC_SET_OPTION_SET_LANG: ++ cec_dev->cec_info.menu_lang = arg; ++ break; ++ ++ case CEC_IOC_GET_CONNECT_STATUS: ++ if (cec_dev->dev_type == DEV_TYPE_TX) ++ tmp = cec_dev->tx_dev->hpd_state; ++ #ifdef CONFIG_TVIN_HDMI ++ else { ++ if (copy_from_user(&a, argp, _IOC_SIZE(cmd))) ++ return -EINVAL; ++ tmp = (hdmirx_rd_top(TOP_HPD_PWR5V) >> 20); ++ if (tmp & (1 << (a - 1))) ++ tmp = 1; ++ else ++ tmp = 0; ++ } ++ #endif ++ if (copy_to_user(argp, &tmp, _IOC_SIZE(cmd))) ++ return -EINVAL; ++ break; ++ ++ case CEC_IOC_ADD_LOGICAL_ADDR: ++ tmp = arg & 0xf; ++ CEC_INFO("CEC LA ARG:%ld", arg); ++ cec_logicaddr_set(tmp, CEC_LOGICAL_ADDR0); ++ cec_dev->cec_info.log_addr[0] = tmp; ++ //cec_logicaddr_setByMask(tmp); ++ /* add by hal, to init some data structure */ ++ cec_dev->cec_info.power_status = POWER_ON; ++ cec_logicaddr_config(tmp, 1); ++ ++ cec_dev->cec_info.cec_version = CEC_VERSION_14A; ++ cec_dev->cec_info.vendor_id = cec_dev->v_data.vendor_id; ++ strcpy(cec_dev->cec_info.osd_name, ++ cec_dev->v_data.cec_osd_string); ++ ++ if (cec_dev->dev_type == DEV_TYPE_TX) ++ cec_dev->cec_info.menu_status = DEVICE_MENU_ACTIVE; ++ break; ++ ++ case CEC_IOC_CLR_LOGICAL_ADDR: ++ /* TODO: clear global info */ ++ cec_logicaddr_clear(); ++ break; ++ ++ case CEC_IOC_SET_DEV_TYPE: ++ if (arg != DEV_TYPE_TX && arg != DEV_TYPE_RX) ++ return -EINVAL; ++ cec_dev->dev_type = arg; ++ break; ++ ++ case CEC_IOC_SET_ARC_ENABLE: ++ #ifdef CONFIG_TVIN_HDMI ++ /* select arc according arg */ ++ if (arg) ++ hdmirx_wr_top(TOP_ARCTX_CNTL, 0x03); ++ else ++ hdmirx_wr_top(TOP_ARCTX_CNTL, 0x00); ++ CEC_INFO("set arc en:%ld, reg:%lx\n", ++ arg, hdmirx_rd_top(TOP_ARCTX_CNTL)); ++ #endif ++ break; ++ ++ default: ++ break; ++ } ++ return 0; ++} ++ ++#ifdef CONFIG_COMPAT ++static long hdmitx_cec_compat_ioctl(struct file *f, ++ unsigned int cmd, unsigned long arg) ++{ ++ arg = (unsigned long)compat_ptr(arg); ++ return hdmitx_cec_ioctl(f, cmd, arg); ++} ++#endif ++ ++/* for improve rw permission */ ++static char *aml_cec_class_devnode(struct device *dev, umode_t *mode) ++{ ++ if (mode) ++ *mode = 0666; ++ CEC_INFO("mode is %x\n", *mode); ++ return NULL; ++} ++ ++static struct class aocec_class = { ++ .name = CEC_DEV_NAME, ++ .class_attrs = aocec_class_attr, ++ .devnode = aml_cec_class_devnode, ++}; ++ ++ ++static const struct file_operations hdmitx_cec_fops = { ++ .owner = THIS_MODULE, ++ .open = hdmitx_cec_open, ++ .read = hdmitx_cec_read, ++ .write = hdmitx_cec_write, ++ .release = hdmitx_cec_release, ++ .unlocked_ioctl = hdmitx_cec_ioctl, ++#ifdef CONFIG_COMPAT ++ .compat_ioctl = hdmitx_cec_compat_ioctl, ++#endif ++}; ++ ++/************************ cec high level code *****************************/ ++#ifdef CONFIG_HAS_EARLYSUSPEND ++static void aocec_early_suspend(struct early_suspend *h) ++{ ++ cec_dev->cec_suspend = CEC_EARLY_SUSPEND; ++ CEC_INFO("%s, suspend:%d\n", __func__, cec_dev->cec_suspend); ++} ++ ++static void aocec_late_resume(struct early_suspend *h) ++{ ++ cec_dev->cec_suspend = 0; ++ CEC_INFO("%s, suspend:%d\n", __func__, cec_dev->cec_suspend); ++ ++} ++#endif ++ ++static int aml_cec_probe(struct platform_device *pdev) ++{ ++ int i; ++ struct device *cdev; ++#ifdef CONFIG_OF ++ struct device_node *node = pdev->dev.of_node; ++ int irq_idx = 0, r; ++ const char *pin_name = NULL, *irq_name = NULL; ++ struct pinctrl *p; ++ struct vendor_info_data *vend; ++ struct resource *res; ++ resource_size_t *base; ++#endif ++ ++ cec_dev = kzalloc(sizeof(struct ao_cec_dev), GFP_KERNEL); ++ if (!cec_dev) { ++ CEC_ERR("alloc memory failed\n"); ++ return -ENOMEM; ++ } ++ cec_dev->dev_type = DEV_TYPE_TX; ++ cec_dev->dbg_dev = &pdev->dev; ++ cec_dev->tx_dev = get_hdmitx_device(); ++ phy_addr_test = 0; ++ ++ /* cdev registe */ ++ r = class_register(&aocec_class); ++ if (r) { ++ CEC_ERR("regist class failed\n"); ++ return -EINVAL; ++ } ++ pdev->dev.class = &aocec_class; ++ cec_dev->cec_info.dev_no = register_chrdev(0, CEC_DEV_NAME, ++ &hdmitx_cec_fops); ++ if (cec_dev->cec_info.dev_no < 0) { ++ CEC_ERR("alloc chrdev failed\n"); ++ return -EINVAL; ++ } ++ CEC_INFO("alloc chrdev %x\n", cec_dev->cec_info.dev_no); ++ cdev = device_create(&aocec_class, &pdev->dev, ++ MKDEV(cec_dev->cec_info.dev_no, 0), ++ NULL, CEC_DEV_NAME); ++ if (IS_ERR(cdev)) { ++ CEC_ERR("create chrdev failed, dev:%p\n", cdev); ++ unregister_chrdev(cec_dev->cec_info.dev_no, ++ CEC_DEV_NAME); ++ return -EINVAL; ++ } ++ ++ init_completion(&cec_dev->rx_ok); ++ init_completion(&cec_dev->tx_ok); ++ mutex_init(&cec_dev->cec_mutex); ++ spin_lock_init(&cec_dev->cec_reg_lock); ++ cec_dev->cec_thread = create_workqueue("cec_work"); ++ if (cec_dev->cec_thread == NULL) { ++ CEC_INFO("create work queue failed\n"); ++ return -EFAULT; ++ } ++ INIT_DELAYED_WORK(&cec_dev->cec_work, cec_task); ++ hrtimer_init(&cec_key_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); ++ cec_key_timer.function = cec_key_up; ++ cec_dev->cec_info.remote_cec_dev = input_allocate_device(); ++ if (!cec_dev->cec_info.remote_cec_dev) ++ CEC_INFO("No enough memory\n"); ++ ++ cec_dev->cec_info.remote_cec_dev->name = "cec_input"; ++ ++ cec_dev->cec_info.remote_cec_dev->evbit[0] = BIT_MASK(EV_KEY); ++ cec_dev->cec_info.remote_cec_dev->keybit[BIT_WORD(BTN_0)] = ++ BIT_MASK(BTN_0); ++ cec_dev->cec_info.remote_cec_dev->id.bustype = BUS_ISA; ++ cec_dev->cec_info.remote_cec_dev->id.vendor = 0x1b8e; ++ cec_dev->cec_info.remote_cec_dev->id.product = 0x0cec; ++ cec_dev->cec_info.remote_cec_dev->id.version = 0x0001; ++ ++ for (i = 0; i < 160; i++) ++ set_bit(cec_key_map[i], cec_dev->cec_info.remote_cec_dev->keybit); ++ if (input_register_device(cec_dev->cec_info.remote_cec_dev)) { ++ CEC_INFO("Failed to register device\n"); ++ input_free_device(cec_dev->cec_info.remote_cec_dev); ++ } ++ ++#ifdef CONFIG_OF ++ /* pinmux set */ ++ if (of_get_property(node, "pinctrl-names", NULL)) { ++ r = of_property_read_string(node, ++ "pinctrl-names", ++ &pin_name); ++ if (!r) ++ p = devm_pinctrl_get_select(&pdev->dev, pin_name); ++ } ++ ++ /* irq set */ ++ irq_idx = of_irq_get(node, 0); ++ cec_dev->irq_cec = irq_idx; ++ if (of_get_property(node, "interrupt-names", NULL)) { ++ r = of_property_read_string(node, "interrupt-names", &irq_name); ++ if (!r) { ++ r = request_irq(irq_idx, &cec_isr_handler, IRQF_SHARED, ++ irq_name, (void *)cec_dev); ++ } ++ } ++ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); ++ if (res) { ++ base = ioremap(res->start, res->end - res->start); ++ cec_dev->exit_reg = (void *)base; ++ } else { ++ CEC_INFO("no memory resource\n"); ++ cec_dev->exit_reg = NULL; ++ } ++ res = platform_get_resource(pdev, IORESOURCE_MEM, 1); ++ if (res) { ++ base = ioremap(res->start, res->end - res->start); ++ cec_dev->cec_reg = (void *)base; ++ } else { ++ CEC_ERR("no CEC reg resource\n"); ++ cec_dev->cec_reg = NULL; ++ } ++ res = platform_get_resource(pdev, IORESOURCE_MEM, 2); ++ if (res) { ++ base = ioremap(res->start, res->end - res->start); ++ cec_dev->hdmi_rxreg = (void *)base; ++ } else { ++ CEC_ERR("no hdmirx reg resource\n"); ++ cec_dev->hdmi_rxreg = NULL; ++ } ++ ++ r = of_property_read_u32(node, "port_num", &(cec_dev->port_num)); ++ if (r) { ++ CEC_ERR("not find 'port_num'\n"); ++ cec_dev->port_num = 1; ++ } ++ r = of_property_read_u32(node, "arc_port_mask", &(cec_dev->arc_port)); ++ if (r) { ++ CEC_ERR("not find 'arc_port_mask'\n"); ++ cec_dev->arc_port = 0; ++ } ++ ++ vend = &cec_dev->v_data; ++ r = of_property_read_string(node, "vendor_name", ++ (const char **)&(vend->vendor_name)); ++ if (r) ++ CEC_INFO("not find vendor name\n"); ++ ++ r = of_property_read_u32(node, "vendor_id", &(vend->vendor_id)); ++ if (r) ++ CEC_INFO("not find vendor id\n"); ++ ++ r = of_property_read_string(node, "product_desc", ++ (const char **)&(vend->product_desc)); ++ if (r) ++ CEC_INFO("not find product desc\n"); ++ ++ r = of_property_read_string(node, "cec_osd_string", ++ (const char **)&(vend->cec_osd_string)); ++ if (r) { ++ CEC_INFO("not find cec osd string\n"); ++ strcpy(vend->cec_osd_string, "AML TV/BOX"); ++ } ++ ++ /* get port sequence */ ++ node = of_find_node_by_path("/hdmirx"); ++ if (node == NULL) { ++ CEC_ERR("can't find hdmirx\n"); ++ cec_dev->port_seq = 0; ++ } else { ++ r = of_property_read_u32(node, "rx_port_maps", ++ &(cec_dev->port_seq)); ++ if (r) ++ CEC_INFO("not find rx_port_maps\n"); ++ } ++#endif ++#ifdef CONFIG_HAS_EARLYSUSPEND ++ aocec_suspend_handler.level = EARLY_SUSPEND_LEVEL_BLANK_SCREEN - 20; ++ aocec_suspend_handler.suspend = aocec_early_suspend; ++ aocec_suspend_handler.resume = aocec_late_resume; ++ aocec_suspend_handler.param = cec_dev; ++ register_early_suspend(&aocec_suspend_handler); ++#endif ++ /* for init */ ++ cec_pre_init(); ++ CEC_INFO("CEC_LOGICAL_ADDR0: 0x%x\n",aocec_rd_reg(CEC_LOGICAL_ADDR0)); ++ CEC_INFO("CEC_LOGICAL_ADDR1: 0x%x\n",aocec_rd_reg(CEC_LOGICAL_ADDR1)); ++ CEC_INFO("CEC_LOGICAL_ADDR2: 0x%x\n",aocec_rd_reg(CEC_LOGICAL_ADDR2)); ++ CEC_INFO("CEC_LOGICAL_ADDR3: 0x%x\n",aocec_rd_reg(CEC_LOGICAL_ADDR3)); ++ CEC_INFO("CEC_LOGICAL_ADDR4: 0x%x\n",aocec_rd_reg(CEC_LOGICAL_ADDR4)); ++ CEC_INFO("CEC log_addr: %d\n", cec_dev->cec_info.log_addr[0]) ++ queue_delayed_work(cec_dev->cec_thread, &cec_dev->cec_work, 0); ++ cec_dev->tx_dev->cec_init_ready = 1; ++ return 0; ++} ++ ++static int aml_cec_remove(struct platform_device *pdev) ++{ ++ CEC_INFO("cec uninit!\n"); ++ free_irq(cec_dev->irq_cec, (void *)cec_dev); ++ cec_dev->tx_dev->cec_init_ready = 0; ++ ++ if (cec_dev->cec_thread) { ++ cancel_delayed_work_sync(&cec_dev->cec_work); ++ destroy_workqueue(cec_dev->cec_thread); ++ } ++ input_unregister_device(cec_dev->cec_info.remote_cec_dev); ++ unregister_chrdev(cec_dev->cec_info.dev_no, CEC_DEV_NAME); ++ class_unregister(&aocec_class); ++ kfree(cec_dev); ++ return 0; ++} ++ ++#ifdef CONFIG_PM ++static int aml_cec_pm_prepare(struct device *dev) ++{ ++ cec_dev->cec_suspend = CEC_DEEP_SUSPEND; ++ CEC_INFO("%s, cec_suspend:%d\n", __func__, cec_dev->cec_suspend); ++ return 0; ++} ++ ++static void aml_cec_pm_complete(struct device *dev) ++{ ++ int exit = 0; ++ ++ if (cec_dev->exit_reg) { ++ exit = readl(cec_dev->exit_reg); ++ CEC_INFO("wake up flag:%x\n", exit); ++ } ++ if (((exit >> 28) & 0xf) == CEC_WAKEUP) { ++ cec_key_report(0); ++ } ++} ++ ++static int aml_cec_resume_noirq(struct device *dev) ++{ ++ CEC_INFO("cec resume noirq!\n"); ++ cec_dev->cec_info.power_status = TRANS_STANDBY_TO_ON; ++ return 0; ++} ++ ++static const struct dev_pm_ops aml_cec_pm = { ++ .prepare = aml_cec_pm_prepare, ++ .complete = aml_cec_pm_complete, ++ .resume_noirq = aml_cec_resume_noirq, ++}; ++#endif ++ ++#ifdef CONFIG_OF ++static const struct of_device_id aml_cec_dt_match[] = { ++ { ++ .compatible = "amlogic, amlogic-aocec", ++ }, ++ {}, ++}; ++#endif ++ ++static struct platform_driver aml_cec_driver = { ++ .driver = { ++ .name = "cectx", ++ .owner = THIS_MODULE, ++ #ifdef CONFIG_PM ++ .pm = &aml_cec_pm, ++ #endif ++ #ifdef CONFIG_OF ++ .of_match_table = aml_cec_dt_match, ++ #endif ++ }, ++ .probe = aml_cec_probe, ++ .remove = aml_cec_remove, ++}; ++ ++static int __init cec_init(void) ++{ ++ int ret; ++ ret = platform_driver_register(&aml_cec_driver); ++ return ret; ++} ++ ++static void __exit cec_uninit(void) ++{ ++ platform_driver_unregister(&aml_cec_driver); ++} ++ ++ ++module_init(cec_init); ++module_exit(cec_uninit); ++MODULE_DESCRIPTION("AMLOGIC HDMI TX CEC driver"); ++MODULE_LICENSE("GPL"); +diff --git a/drivers/amlogic/cec/hdmi_ao_cec.h b/drivers/amlogic/cec/hdmi_ao_cec.h +new file mode 100644 +index 0000000..965c2f9 +--- /dev/null ++++ b/drivers/amlogic/cec/hdmi_ao_cec.h +@@ -0,0 +1,179 @@ ++#ifndef __AO_CEC_H__ ++#define __AO_CEC_H__ ++ ++#define AO_BASE 0xc8100000 ++ ++#define AO_CEC_GEN_CNTL ((0x40 << 2)) ++#define AO_CEC_RW_REG ((0x41 << 2)) ++#define AO_CEC_INTR_MASKN ((0x42 << 2)) ++#define AO_CEC_INTR_CLR ((0x43 << 2)) ++#define AO_CEC_INTR_STAT ((0x44 << 2)) ++ ++#define AO_CRT_CLK_CNTL1 ((0x1a << 2)) ++ ++#define AO_DEBUG_REG0 ((0x28 << 2)) ++#define AO_DEBUG_REG1 ((0x29 << 2)) ++#define AO_DEBUG_REG2 ((0x2a << 2)) ++#define AO_DEBUG_REG3 ((0x2b << 2)) ++ ++/* read/write */ ++#define CEC_TX_MSG_0_HEADER 0x00 ++#define CEC_TX_MSG_1_OPCODE 0x01 ++#define CEC_TX_MSG_2_OP1 0x02 ++#define CEC_TX_MSG_3_OP2 0x03 ++#define CEC_TX_MSG_4_OP3 0x04 ++#define CEC_TX_MSG_5_OP4 0x05 ++#define CEC_TX_MSG_6_OP5 0x06 ++#define CEC_TX_MSG_7_OP6 0x07 ++#define CEC_TX_MSG_8_OP7 0x08 ++#define CEC_TX_MSG_9_OP8 0x09 ++#define CEC_TX_MSG_A_OP9 0x0A ++#define CEC_TX_MSG_B_OP10 0x0B ++#define CEC_TX_MSG_C_OP11 0x0C ++#define CEC_TX_MSG_D_OP12 0x0D ++#define CEC_TX_MSG_E_OP13 0x0E ++#define CEC_TX_MSG_F_OP14 0x0F ++ ++/* read/write */ ++#define CEC_TX_MSG_LENGTH 0x10 ++#define CEC_TX_MSG_CMD 0x11 ++#define CEC_TX_WRITE_BUF 0x12 ++#define CEC_TX_CLEAR_BUF 0x13 ++#define CEC_RX_MSG_CMD 0x14 ++#define CEC_RX_CLEAR_BUF 0x15 ++#define CEC_LOGICAL_ADDR0 0x16 ++#define CEC_LOGICAL_ADDR1 0x17 ++#define CEC_LOGICAL_ADDR2 0x18 ++#define CEC_LOGICAL_ADDR3 0x19 ++#define CEC_LOGICAL_ADDR4 0x1A ++#define CEC_CLOCK_DIV_H 0x1B ++#define CEC_CLOCK_DIV_L 0x1C ++ ++/* The following registers are for fine tuning CEC bit timing parameters. ++ * They are only valid in AO CEC, NOT valid in HDMITX CEC. ++ * The AO CEC's timing parameters are already set default to work with ++ * 32768Hz clock, so hopefully SW never need to program these registers. ++ * The timing registers are made programmable just in case. */ ++#define AO_CEC_QUIESCENT_25MS_BIT7_0 0x20 ++#define AO_CEC_QUIESCENT_25MS_BIT11_8 0x21 ++#define AO_CEC_STARTBITMINL2H_3MS5_BIT7_0 0x22 ++#define AO_CEC_STARTBITMINL2H_3MS5_BIT8 0x23 ++#define AO_CEC_STARTBITMAXL2H_3MS9_BIT7_0 0x24 ++#define AO_CEC_STARTBITMAXL2H_3MS9_BIT8 0x25 ++#define AO_CEC_STARTBITMINH_0MS6_BIT7_0 0x26 ++#define AO_CEC_STARTBITMINH_0MS6_BIT8 0x27 ++#define AO_CEC_STARTBITMAXH_1MS0_BIT7_0 0x28 ++#define AO_CEC_STARTBITMAXH_1MS0_BIT8 0x29 ++#define AO_CEC_STARTBITMINTOTAL_4MS3_BIT7_0 0x2A ++#define AO_CEC_STARTBITMINTOTAL_4MS3_BIT9_8 0x2B ++#define AO_CEC_STARTBITMAXTOTAL_4MS7_BIT7_0 0x2C ++#define AO_CEC_STARTBITMAXTOTAL_4MS7_BIT9_8 0x2D ++#define AO_CEC_LOGIC1MINL2H_0MS4_BIT7_0 0x2E ++#define AO_CEC_LOGIC1MINL2H_0MS4_BIT8 0x2F ++#define AO_CEC_LOGIC1MAXL2H_0MS8_BIT7_0 0x30 ++#define AO_CEC_LOGIC1MAXL2H_0MS8_BIT8 0x31 ++#define AO_CEC_LOGIC0MINL2H_1MS3_BIT7_0 0x32 ++#define AO_CEC_LOGIC0MINL2H_1MS3_BIT8 0x33 ++#define AO_CEC_LOGIC0MAXL2H_1MS7_BIT7_0 0x34 ++#define AO_CEC_LOGIC0MAXL2H_1MS7_BIT8 0x35 ++#define AO_CEC_LOGICMINTOTAL_2MS05_BIT7_0 0x36 ++#define AO_CEC_LOGICMINTOTAL_2MS05_BIT9_8 0x37 ++#define AO_CEC_LOGICMAXHIGH_2MS8_BIT7_0 0x38 ++#define AO_CEC_LOGICMAXHIGH_2MS8_BIT8 0x39 ++#define AO_CEC_LOGICERRLOW_3MS4_BIT7_0 0x3A ++#define AO_CEC_LOGICERRLOW_3MS4_BIT8 0x3B ++#define AO_CEC_NOMSMPPOINT_1MS05 0x3C ++#define AO_CEC_DELCNTR_LOGICERR 0x3E ++#define AO_CEC_TXTIME_17MS_BIT7_0 0x40 ++#define AO_CEC_TXTIME_17MS_BIT10_8 0x41 ++#define AO_CEC_TXTIME_2BIT_BIT7_0 0x42 ++#define AO_CEC_TXTIME_2BIT_BIT10_8 0x43 ++#define AO_CEC_TXTIME_4BIT_BIT7_0 0x44 ++#define AO_CEC_TXTIME_4BIT_BIT10_8 0x45 ++#define AO_CEC_STARTBITNOML2H_3MS7_BIT7_0 0x46 ++#define AO_CEC_STARTBITNOML2H_3MS7_BIT8 0x47 ++#define AO_CEC_STARTBITNOMH_0MS8_BIT7_0 0x48 ++#define AO_CEC_STARTBITNOMH_0MS8_BIT8 0x49 ++#define AO_CEC_LOGIC1NOML2H_0MS6_BIT7_0 0x4A ++#define AO_CEC_LOGIC1NOML2H_0MS6_BIT8 0x4B ++#define AO_CEC_LOGIC0NOML2H_1MS5_BIT7_0 0x4C ++#define AO_CEC_LOGIC0NOML2H_1MS5_BIT8 0x4D ++#define AO_CEC_LOGIC1NOMH_1MS8_BIT7_0 0x4E ++#define AO_CEC_LOGIC1NOMH_1MS8_BIT8 0x4F ++#define AO_CEC_LOGIC0NOMH_0MS9_BIT7_0 0x50 ++#define AO_CEC_LOGIC0NOMH_0MS9_BIT8 0x51 ++#define AO_CEC_LOGICERRLOW_3MS6_BIT7_0 0x52 ++#define AO_CEC_LOGICERRLOW_3MS6_BIT8 0x53 ++#define AO_CEC_CHKCONTENTION_0MS1 0x54 ++#define AO_CEC_PREPARENXTBIT_0MS05_BIT7_0 0x56 ++#define AO_CEC_PREPARENXTBIT_0MS05_BIT8 0x57 ++#define AO_CEC_NOMSMPACKPOINT_0MS45 0x58 ++#define AO_CEC_ACK0NOML2H_1MS5_BIT7_0 0x5A ++#define AO_CEC_ACK0NOML2H_1MS5_BIT8 0x5B ++ ++#define AO_CEC_BUGFIX_DISABLE_0 0x60 ++#define AO_CEC_BUGFIX_DISABLE_1 0x61 ++ ++/* read only */ ++#define CEC_RX_MSG_0_HEADER 0x80 ++#define CEC_RX_MSG_1_OPCODE 0x81 ++#define CEC_RX_MSG_2_OP1 0x82 ++#define CEC_RX_MSG_3_OP2 0x83 ++#define CEC_RX_MSG_4_OP3 0x84 ++#define CEC_RX_MSG_5_OP4 0x85 ++#define CEC_RX_MSG_6_OP5 0x86 ++#define CEC_RX_MSG_7_OP6 0x87 ++#define CEC_RX_MSG_8_OP7 0x88 ++#define CEC_RX_MSG_9_OP8 0x89 ++#define CEC_RX_MSG_A_OP9 0x8A ++#define CEC_RX_MSG_B_OP10 0x8B ++#define CEC_RX_MSG_C_OP11 0x8C ++#define CEC_RX_MSG_D_OP12 0x8D ++#define CEC_RX_MSG_E_OP13 0x8E ++#define CEC_RX_MSG_F_OP14 0x8F ++ ++/* read only */ ++#define CEC_RX_MSG_LENGTH 0x90 ++#define CEC_RX_MSG_STATUS 0x91 ++#define CEC_RX_NUM_MSG 0x92 ++#define CEC_TX_MSG_STATUS 0x93 ++#define CEC_TX_NUM_MSG 0x94 ++ ++/* tx_msg_cmd definition */ ++#define TX_NO_OP 0 /* No transaction */ ++#define TX_REQ_CURRENT 1 /* Transmit earliest message in buffer */ ++#define TX_ABORT 2 /* Abort transmitting earliest message */ ++/* Overwrite earliest message in buffer and transmit next message */ ++#define TX_REQ_NEXT 3 ++ ++/* tx_msg_status definition */ ++#define TX_IDLE 0 /* No transaction */ ++#define TX_BUSY 1 /* Transmitter is busy */ ++/* Message has been successfully transmitted */ ++#define TX_DONE 2 ++#define TX_ERROR 3 /* Message has been transmitted with error */ ++ ++/* rx_msg_cmd */ ++#define RX_NO_OP 0 /* No transaction */ ++#define RX_ACK_CURRENT 1 /* Read earliest message in buffer */ ++#define RX_DISABLE 2 /* Disable receiving latest message */ ++/* Clear earliest message from buffer and read next message */ ++#define RX_ACK_NEXT 3 ++ ++/* rx_msg_status */ ++#define RX_IDLE 0 /* No transaction */ ++#define RX_BUSY 1 /* Receiver is busy */ ++#define RX_DONE 2 /* Message has been received successfully */ ++#define RX_ERROR 3 /* Message has been received with error */ ++ ++#ifdef CONFIG_TVIN_HDMI ++extern unsigned long hdmirx_rd_top(unsigned long addr); ++extern void hdmirx_wr_top(unsigned long addr, unsigned long data); ++#define TOP_HPD_PWR5V 0x002 ++#define TOP_ARCTX_CNTL 0x010 ++#endif ++ ++unsigned int aocec_rd_reg(unsigned long addr); ++void aocec_wr_reg(unsigned long addr, unsigned long data); ++ ++#endif /* __AO_CEC_H__ */ +diff --git a/drivers/amlogic/hdmi/Kconfig b/drivers/amlogic/hdmi/Kconfig +index 28ec6ba..1edf20a 100644 +--- a/drivers/amlogic/hdmi/Kconfig ++++ b/drivers/amlogic/hdmi/Kconfig +@@ -35,11 +35,13 @@ config AML_HDMI_TX_HDCP + endif + + if AML_HDMI_TX_20 ++if !AML_AO_CEC + config AML_HDMI_TX_NEW_CEC_DRIVER + bool "HDMI new CEC driver" + default n + help + hdmitx uses new CEC driver + endif ++endif + + endmenu +diff --git a/drivers/amlogic/hdmi/hdmi_tx_20/Makefile b/drivers/amlogic/hdmi/hdmi_tx_20/Makefile +index 6ecaf55..64132b8 100644 +--- a/drivers/amlogic/hdmi/hdmi_tx_20/Makefile ++++ b/drivers/amlogic/hdmi/hdmi_tx_20/Makefile +@@ -3,11 +3,14 @@ obj-$(CONFIG_AML_HDMI_TX_20) += hdmitx20.o + hdmitx20-objs := hdmi_tx_main.o hdmi_tx_video.o hdmi_tx_audio.o hdmi_tx_edid.o \ + hdmi_tx_audio.o hdmi_tx_hdcp.o hdmi_tx_scdc.o + ++ifndef CONFIG_AML_AO_CEC + ifdef CONFIG_AML_HDMI_TX_NEW_CEC_DRIVER + hdmitx20-objs += amlogic_cec.o + else + hdmitx20-objs += hdmi_cec_key.o hdmi_tx_cec.o + endif ++endif ++ + obj-$(CONFIG_AML_HDMI_TX_20) += hw/ + + #EXTRA_CFLAGS += -O2 +diff --git a/drivers/amlogic/hdmi/hdmi_tx_20/hdmi_tx_main.c b/drivers/amlogic/hdmi/hdmi_tx_20/hdmi_tx_main.c +index 2b3f896..f05fe8f 100644 +--- a/drivers/amlogic/hdmi/hdmi_tx_20/hdmi_tx_main.c ++++ b/drivers/amlogic/hdmi/hdmi_tx_20/hdmi_tx_main.c +@@ -1551,8 +1551,9 @@ void hdmitx_hpd_plugin_handler(struct work_struct *work) + set_disp_mode_auto(); + hdmitx_set_audio(hdev, &(hdev->cur_audio_param), hdmi_ch); + switch_set_state(&sdev, 1); ++#ifndef CONFIG_AML_AO_CEC + cec_node_init(hdev); +- ++#endif + hdev->hdmitx_event &= ~HDMI_TX_HPD_PLUGIN; + mutex_unlock(&setclk_mutex); + } +diff --git a/drivers/amlogic/hdmi/hdmi_tx_20/hw/Makefile b/drivers/amlogic/hdmi/hdmi_tx_20/hw/Makefile +index d4cd9d4..fb22a69 100644 +--- a/drivers/amlogic/hdmi/hdmi_tx_20/hw/Makefile ++++ b/drivers/amlogic/hdmi/hdmi_tx_20/hw/Makefile +@@ -1 +1,4 @@ +-obj-y += hdmi_tx_hw.o reg_ops.o enc_cfg_hw.o hdmi_tx_cec_hw.o hdmi_tx_ddc.o ++obj-y += hdmi_tx_hw.o reg_ops.o enc_cfg_hw.o hdmi_tx_ddc.o ++ifndef CONFIG_AML_AO_CEC ++obj-y += hdmi_tx_cec_hw.o ++endif +diff --git a/drivers/amlogic/hdmi/hdmi_tx_20/hw/reg_ops.c b/drivers/amlogic/hdmi/hdmi_tx_20/hw/reg_ops.c +index 33ec391..4132cd4 100644 +--- a/drivers/amlogic/hdmi/hdmi_tx_20/hw/reg_ops.c ++++ b/drivers/amlogic/hdmi/hdmi_tx_20/hw/reg_ops.c +@@ -33,7 +33,9 @@ + #include "hdmi_tx_reg.h" + + static int dbg_en; ++#ifndef CONFIG_AML_AO_CEC + static DEFINE_SPINLOCK(reg_lock2); ++#endif + + /* + * RePacket HDMI related registers rd/wr +@@ -286,6 +288,7 @@ void hdmitx_rd_check_reg(unsigned int addr, unsigned int exp_data, + } \ + } while (0) + ++#ifndef CONFIG_AML_AO_CEC + unsigned long aocec_rd_reg(unsigned long addr) + { + unsigned long data32; +@@ -317,6 +320,7 @@ void aocec_wr_reg(unsigned long addr, unsigned long data) + hd_write_reg(P_AO_CEC_RW_REG, data32); + spin_unlock_irqrestore(&reg_lock2, flags); + } /* aocec_wr_only_reg */ ++#endif + + + MODULE_PARM_DESC(dbg_en, "\n debug_level\n"); +diff --git a/include/linux/amlogic/hdmi_tx/hdmi_tx_cec_20.h b/include/linux/amlogic/hdmi_tx/hdmi_tx_cec_20.h +new file mode 100644 +index 0000000..4fdb10e +--- /dev/null ++++ b/include/linux/amlogic/hdmi_tx/hdmi_tx_cec_20.h +@@ -0,0 +1,356 @@ ++/* ++ * include/linux/amlogic/hdmi_tx/hdmi_tx_cec.h ++ * ++ * Copyright (C) 2015 Amlogic, Inc. All rights reserved. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, but WITHOUT ++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for ++ * more details. ++ * ++*/ ++ ++ ++#ifndef _TX_CEC_H_ ++#define _TX_CEC_H_ ++ ++#include <linux/irq.h> ++#include <linux/amlogic/cpu_version.h> ++#include <linux/amlogic/hdmi_tx/hdmi_info_global.h> ++#include <linux/amlogic/hdmi_tx/hdmi_tx_module.h> ++ ++#define CEC0_LOG_ADDR 4 /* MBX logical address */ ++#define TV_CEC_INTERVAL (HZ*3) ++ ++#define CEC_VERSION "v1.3" ++#define _RX_DATA_BUF_SIZE_ 16 ++ ++#define AO_CEC /* for switch between aocec and hdmi cec2.0 */ ++ ++#define MAX_MSG 16 ++#define MAX_NUM_OF_DEV 16 ++ ++enum _cec_log_dev_addr_e { ++ CEC_TV_ADDR = 0x00, ++ CEC_RECORDING_DEVICE_1_ADDR, ++ CEC_RECORDING_DEVICE_2_ADDR, ++ CEC_TUNER_1_ADDR, ++ CEC_PLAYBACK_DEVICE_1_ADDR, ++ CEC_AUDIO_SYSTEM_ADDR, ++ CEC_TUNER_2_ADDR, ++ CEC_TUNER_3_ADDR, ++ CEC_PLAYBACK_DEVICE_2_ADDR, ++ CEC_RECORDING_DEVICE_3_ADDR, ++ CEC_TUNER_4_ADDR, ++ CEC_PLAYBACK_DEVICE_3_ADDR, ++ CEC_RESERVED_1_ADDR, ++ CEC_RESERVED_2_ADDR, ++ CEC_FREE_USE_ADDR, ++ CEC_UNREGISTERED_ADDR ++}; ++ ++#define CEC_BROADCAST_ADDR CEC_UNREGISTERED_ADDR ++ ++#define CEC_TV (1 << CEC_TV_ADDR) ++#define CEC_RECORDING_DEVICE_1 (1 << CEC_RECORDING_DEVICE_1_ADDR) ++#define CEC_RECORDING_DEVICE_2 (1 << CEC_RECORDING_DEVICE_2_ADDR) ++#define CEC_TUNER_1 (1 << CEC_TUNER_1_ADDR) ++#define CEC_PLAYBACK_DEVICE_1 (1 << CEC_PLAYBACK_DEVICE_1_ADDR) ++#define CEC_AUDIO_SYSTEM (1 << CEC_AUDIO_SYSTEM_ADDR) ++#define CEC_TUNER_2 (1 << CEC_TUNER_2_ADDR) ++#define CEC_TUNER_3 (1 << CEC_TUNER_3_ADDR) ++#define CEC_PLAYBACK_DEVICE_2 (1 << CEC_PLAYBACK_DEVICE_2_ADDR) ++#define CEC_RECORDING_DEVICE_3 (1 << CEC_RECORDING_DEVICE_3_ADDR) ++#define CEC_TUNER_4 (1 << CEC_TUNER_4_ADDR) ++#define CEC_PLAYBACK_DEVICE_3 (1 << CEC_PLAYBACK_DEVICE_3_ADDR) ++#define CEC_RESERVED_1 (1 << CEC_RESERVED_1_ADDR) ++#define CEC_RESERVED_2 (1 << CEC_RESERVED_2_ADDR) ++#define CEC_FREE_USE (1 << CEC_FREE_USE_ADDR) ++#define CEC_UNREGISTERED (1 << CEC_UNREGISTERED_ADDR) ++ ++#define CEC_DISPLAY_DEVICE (CEC_TV | CEC_FREE_USE) ++#define CEC_RECORDING_DEVICE (CEC_RECORDING_DEVICE_1 \ ++ | CEC_RECORDING_DEVICE_2 | CEC_RECORDING_DEVICE_3) ++#define CEC_PLAYBACK_DEVICE (CEC_PLAYBACK_DEVICE_1 \ ++ | CEC_PLAYBACK_DEVICE_2 | CEC_PLAYBACK_DEVICE_3) ++#define CEC_TUNER_DEVICE (CEC_TUNER_1 | CEC_TUNER_2 \ ++ | CEC_TUNER_3 | CEC_TUNER_4) ++#define CEC_AUDIO_SYSTEM_DEVICE (CEC_AUDIO_SYSTEM) ++ ++#define CEC_IOC_MAGIC 'C' ++#define CEC_IOC_GET_PHYSICAL_ADDR _IOR(CEC_IOC_MAGIC, 0x00, uint16_t) ++#define CEC_IOC_GET_VERSION _IOR(CEC_IOC_MAGIC, 0x01, int) ++#define CEC_IOC_GET_VENDOR_ID _IOR(CEC_IOC_MAGIC, 0x02, uint32_t) ++#define CEC_IOC_GET_PORT_INFO _IOR(CEC_IOC_MAGIC, 0x03, int) ++#define CEC_IOC_GET_PORT_NUM _IOR(CEC_IOC_MAGIC, 0x04, int) ++#define CEC_IOC_GET_SEND_FAIL_REASON _IOR(CEC_IOC_MAGIC, 0x05, uint32_t) ++#define CEC_IOC_SET_OPTION_WAKEUP _IOW(CEC_IOC_MAGIC, 0x06, uint32_t) ++#define CEC_IOC_SET_OPTION_ENALBE_CEC _IOW(CEC_IOC_MAGIC, 0x07, uint32_t) ++#define CEC_IOC_SET_OPTION_SYS_CTRL _IOW(CEC_IOC_MAGIC, 0x08, uint32_t) ++#define CEC_IOC_SET_OPTION_SET_LANG _IOW(CEC_IOC_MAGIC, 0x09, uint32_t) ++#define CEC_IOC_GET_CONNECT_STATUS _IOR(CEC_IOC_MAGIC, 0x0A, uint32_t) ++#define CEC_IOC_ADD_LOGICAL_ADDR _IOW(CEC_IOC_MAGIC, 0x0B, uint32_t) ++#define CEC_IOC_CLR_LOGICAL_ADDR _IOW(CEC_IOC_MAGIC, 0x0C, uint32_t) ++#define CEC_IOC_SET_DEV_TYPE _IOW(CEC_IOC_MAGIC, 0x0D, uint32_t) ++#define CEC_IOC_SET_ARC_ENABLE _IOW(CEC_IOC_MAGIC, 0x0E, uint32_t) ++ ++#define CEC_FAIL_NONE 0 ++#define CEC_FAIL_NACK 1 ++#define CEC_FAIL_BUSY 2 ++#define CEC_FAIL_OTHER 3 ++ ++enum hdmi_port_type { ++ HDMI_INPUT = 0, ++ HDMI_OUTPUT = 1 ++}; ++ ++struct hdmi_port_info { ++ int type; ++ /* Port ID should start from 1 which corresponds to HDMI "port 1". */ ++ int port_id; ++ int cec_supported; ++ int arc_supported; ++ uint16_t physical_address; ++}; ++ ++enum cec_dev_type_addr { ++ CEC_DISPLAY_DEVICE_TYPE = 0x0, ++ CEC_RECORDING_DEVICE_TYPE, ++ CEC_RESERVED_DEVICE_TYPE, ++ CEC_TUNER_DEVICE_TYPE, ++ CEC_PLAYBACK_DEVICE_TYPE, ++ CEC_AUDIO_SYSTEM_DEVICE_TYPE, ++ CEC_UNREGISTERED_DEVICE_TYPE, ++}; ++ ++enum cec_feature_abort_e { ++ CEC_UNRECONIZED_OPCODE = 0x0, ++ CEC_NOT_CORRECT_MODE_TO_RESPOND, ++ CEC_CANNOT_PROVIDE_SOURCE, ++ CEC_INVALID_OPERAND, ++ CEC_REFUSED, ++ CEC_UNABLE_TO_DETERMINE, ++}; ++ ++/* ++ * CEC OPCODES ++ */ ++#define CEC_OC_ABORT_MESSAGE 0xFF ++#define CEC_OC_ACTIVE_SOURCE 0x82 ++#define CEC_OC_CEC_VERSION 0x9E ++#define CEC_OC_CLEAR_ANALOGUE_TIMER 0x33 ++#define CEC_OC_CLEAR_DIGITAL_TIMER 0x99 ++#define CEC_OC_CLEAR_EXTERNAL_TIMER 0xA1 ++#define CEC_OC_DECK_CONTROL 0x42 ++#define CEC_OC_DECK_STATUS 0x1B ++#define CEC_OC_DEVICE_VENDOR_ID 0x87 ++#define CEC_OC_FEATURE_ABORT 0x00 ++#define CEC_OC_GET_CEC_VERSION 0x9F ++#define CEC_OC_GET_MENU_LANGUAGE 0x91 ++#define CEC_OC_GIVE_AUDIO_STATUS 0x71 ++#define CEC_OC_GIVE_DECK_STATUS 0x1A ++#define CEC_OC_GIVE_DEVICE_POWER_STATUS 0x8F ++#define CEC_OC_GIVE_DEVICE_VENDOR_ID 0x8C ++#define CEC_OC_GIVE_OSD_NAME 0x46 ++#define CEC_OC_GIVE_PHYSICAL_ADDRESS 0x83 ++#define CEC_OC_GIVE_SYSTEM_AUDIO_MODE_STATUS 0x7D ++#define CEC_OC_GIVE_TUNER_DEVICE_STATUS 0x08 ++#define CEC_OC_IMAGE_VIEW_ON 0x04 ++#define CEC_OC_INACTIVE_SOURCE 0x9D ++#define CEC_OC_MENU_REQUEST 0x8D ++#define CEC_OC_MENU_STATUS 0x8E ++#define CEC_OC_PLAY 0x41 ++#define CEC_OC_POLLING_MESSAGE 0xFC ++#define CEC_OC_RECORD_OFF 0x0B ++#define CEC_OC_RECORD_ON 0x09 ++#define CEC_OC_RECORD_STATUS 0x0A ++#define CEC_OC_RECORD_TV_SCREEN 0x0F ++#define CEC_OC_REPORT_AUDIO_STATUS 0x7A ++#define CEC_OC_REPORT_PHYSICAL_ADDRESS 0x84 ++#define CEC_OC_REPORT_POWER_STATUS 0x90 ++#define CEC_OC_REQUEST_ACTIVE_SOURCE 0x85 ++#define CEC_OC_ROUTING_CHANGE 0x80 ++#define CEC_OC_ROUTING_INFORMATION 0x81 ++#define CEC_OC_SELECT_ANALOGUE_SERVICE 0x92 ++#define CEC_OC_SELECT_DIGITAL_SERVICE 0x93 ++#define CEC_OC_SET_ANALOGUE_TIMER 0x34 ++#define CEC_OC_SET_AUDIO_RATE 0x9A ++#define CEC_OC_SET_DIGITAL_TIMER 0x97 ++#define CEC_OC_SET_EXTERNAL_TIMER 0xA2 ++#define CEC_OC_SET_MENU_LANGUAGE 0x32 ++#define CEC_OC_SET_OSD_NAME 0x47 ++#define CEC_OC_SET_OSD_STRING 0x64 ++#define CEC_OC_SET_STREAM_PATH 0x86 ++#define CEC_OC_SET_SYSTEM_AUDIO_MODE 0x72 ++#define CEC_OC_SET_TIMER_PROGRAM_TITLE 0x67 ++#define CEC_OC_STANDBY 0x36 ++#define CEC_OC_SYSTEM_AUDIO_MODE_REQUEST 0x70 ++#define CEC_OC_SYSTEM_AUDIO_MODE_STATUS 0x7E ++#define CEC_OC_TEXT_VIEW_ON 0x0D ++#define CEC_OC_TIMER_CLEARED_STATUS 0x43 ++#define CEC_OC_TIMER_STATUS 0x35 ++#define CEC_OC_TUNER_DEVICE_STATUS 0x07 ++#define CEC_OC_TUNER_STEP_DECREMENT 0x06 ++#define CEC_OC_TUNER_STEP_INCREMENT 0x05 ++#define CEC_OC_USER_CONTROL_PRESSED 0x44 ++#define CEC_OC_USER_CONTROL_RELEASED 0x45 ++#define CEC_OC_VENDOR_COMMAND 0x89 ++#define CEC_OC_VENDOR_COMMAND_WITH_ID 0xA0 ++#define CEC_OC_VENDOR_REMOTE_BUTTON_DOWN 0x8A ++#define CEC_OC_VENDOR_REMOTE_BUTTON_UP 0x8B ++ ++/* cec global struct */ ++ ++enum cec_node_status_e { ++ STATE_UNKNOWN = 0x00, ++ STATE_START, ++ STATE_STOP ++}; ++ ++enum cec_power_status_e { ++ POWER_ON = 0x00, ++ POWER_STANDBY, ++ TRANS_STANDBY_TO_ON, ++ TRANS_ON_TO_STANDBY, ++}; ++ ++enum status_req_mode_e { ++ STATUS_REQ_ON = 1, ++ STATUS_REQ_OFF, ++ STATUS_REQ_ONCE, ++}; ++ ++enum deck_info_e { ++ DECK_UNKNOWN_STATUS = 0, ++ DECK_PLAY = 0X11, ++ DECK_RECORD, ++ DECK_PLAY_REVERSE, ++ DECK_STILL, ++ DECK_SLOW, ++ DECK_SLOW_REVERSE, ++ DECK_FAST_FORWARD, ++ DECK_FAST_REVERSE, ++ DECK_NO_MEDIA, ++ DECK_STOP, ++ DECK_SKIP_FORWARD_WIND, ++ DECK_SKIP_REVERSE_REWIND, ++ DECK_INDEX_SEARCH_FORWARD, ++ DECK_INDEX_SEARCH_REVERSE, ++ DECK_OTHER_STATUS, ++}; ++ ++enum deck_cnt_mode_e { ++ DECK_CNT_SKIP_FORWARD_WIND = 1, ++ DECK_CNT_SKIP_REVERSE_REWIND, ++ DECK_CNT_STOP, ++ DECK_CNT_EJECT, ++}; ++ ++enum play_mode_e { ++ PLAY_FORWARD = 0X24, ++ PLAY_REVERSE = 0X20, ++ PLAY_STILL = 0X25, ++ FAST_FORWARD_MIN_SPEED = 0X05, ++ FAST_FORWARD_MEDIUM_SPEED = 0X06, ++ FAST_FORWARD_MAX_SPEED = 0X07, ++ FAST_REVERSE_MIN_SPEED = 0X09, ++ FAST_REVERSE_MEDIUM_SPEED = 0X0A, ++ FAST_REVERSE_MAX_SPEED = 0X0B, ++ SLOW_FORWARD_MIN_SPEED = 0X15, ++ SLOW_FORWARD_MEDIUM_SPEED = 0X16, ++ SLOW_FORWARD_MAX_SPEED = 0X17, ++ SLOW_REVERSE_MIN_SPEED = 0X19, ++ SLOW_REVERSE_MEDIUM_SPEED = 0X1A, ++ SLOW_REVERSE_MAX_SPEED = 0X1B, ++}; ++ ++enum cec_version_e { ++ CEC_VERSION_11 = 0, ++ CEC_VERSION_12, ++ CEC_VERSION_12A, ++ CEC_VERSION_13, ++ CEC_VERSION_13A, ++ CEC_VERSION_14A, ++}; ++ ++#define INFO_MASK_CEC_VERSION (1<<0) ++#define INFO_MASK_VENDOR_ID (1<<1) ++#define INFO_MASK_DEVICE_TYPE (1<<2) ++#define INFO_MASK_POWER_STATUS (1<<3) ++#define INFO_MASK_PHYSICAL_ADDRESS (1<<4) ++#define INFO_MASK_LOGIC_ADDRESS (1<<5) ++#define INFO_MASK_OSD_NAME (1<<6) ++#define INFO_MASK_MENU_STATE (1<<7) ++#define INFO_MASK_MENU_LANGUAGE (1<<8) ++#define INFO_MASK_DECK_INfO (1<<9) ++#define INFO_MASK_PLAY_MODE (1<<10) ++ ++/*CEC UI MASK*/ ++#define CEC_FUNC_MSAK 0 ++#define ONE_TOUCH_PLAY_MASK 1 ++#define ONE_TOUCH_STANDBY_MASK 2 ++#define AUTO_POWER_ON_MASK 3 ++ ++ ++struct cec_node_info_t { ++}; ++ ++/* ++ * only for 1 tx device ++ */ ++struct cec_global_info_t { ++ dev_t dev_no; ++ unsigned int open_count; ++ unsigned int hal_ctl; /* message controled by hal */ ++ unsigned int vendor_id:24; ++ unsigned int power_status; ++ unsigned int menu_lang; ++ unsigned int cec_version; ++ unsigned int log_addr[5]; ++ unsigned int menu_status; ++ unsigned char osd_name[16]; ++ struct input_dev *remote_cec_dev; /* cec input device */ ++ struct hdmitx_dev *hdmitx_device; ++}; ++ ++enum cec_device_menu_state_e { ++ DEVICE_MENU_ACTIVE = 0, ++ DEVICE_MENU_INACTIVE, ++}; ++ ++int cec_ll_tx(const unsigned char *msg, unsigned char len); ++int cec_ll_rx(unsigned char *msg, unsigned char *len); ++int cec_rx_buf_check(void); ++ ++void cec_pinmux_set(void); ++void cec_arbit_bit_time_set(unsigned , unsigned , unsigned); ++void cec_clear_buf(unsigned int flag); ++void cec_keep_reset(void); ++void cec_logicaddr_set(int logicaddr, int logreg); ++void cec_logicaddr_clear(void); ++void cec_logicaddr_setByMask(unsigned int mask); ++void ao_cec_init(void); ++void tx_irq_handle(void); ++ ++unsigned int cec_config(unsigned int value, bool wr_flag); ++unsigned int cec_intr_stat(void); ++unsigned int cec_phyaddr_config(unsigned int value, bool wr_flag); ++unsigned int cec_logicaddr_config(unsigned int value, bool wr_flag); ++ ++void cec_user_control_pressed_irq(unsigned char message_irq); ++void cec_user_control_released_irq(void); ++extern __u16 cec_key_map[160]; ++void cec_send_simplink_alive(void); ++void cec_send_simplink_ack(void); ++ ++extern bool cec_msg_dbg_en; ++extern struct cec_global_info_t cec_info; ++extern void cec_rx_buf_clear(void); ++extern int get_cec_tx_fail(void); ++#endif ++ +-- +2.1.4 + diff --git a/projects/Odroid_C2/patches/u-boot/u-boot-0001-set-default-boot-options.patch b/projects/Odroid_C2/patches/u-boot/u-boot-0001-set-default-boot-options.patch new file mode 100644 index 00000000000..bd0f0866929 --- /dev/null +++ b/projects/Odroid_C2/patches/u-boot/u-boot-0001-set-default-boot-options.patch @@ -0,0 +1,37 @@ +diff -Naur a/include/configs/odroidc2.h b/include/configs/odroidc2.h +--- a/include/configs/odroidc2.h 2016-03-30 00:48:47.000000000 -0700 ++++ b/include/configs/odroidc2.h 2016-05-05 23:41:45.354660099 -0700 +@@ -83,20 +83,12 @@ + "loadaddr=0x20000000\0" \ + "dtbaddr=0x1000000\0" \ + "fdt_high=0x20000000\0" \ +- "hdmimode=720p60hz\0" \ +- "cecconfig=cec0xf\0" \ +- "bootargs=root=/dev/mmcblk0p2 rw init=/init rootwait " \ +- "console=ttyS0,115200 " \ +- "hdmimode=720p60hz hdmitx=cecf " \ +- "logo=osd1,loaded,0x3f800000,720p60hz " \ +- "androidboot.hardware=odroidc2 androidboot.serialno=${fbt_id#} " \ +- "androidboot.selinux=disabled \0" \ +- "bootcmd=cfgload; showlogo ${hdmimode}; movi read dtb 0 ${dtbaddr}; movi read boot 0 ${loadaddr}; booti ${loadaddr} - ${dtbaddr}\0" ++ "bootcmd=cfgload\0" + + #define CONFIG_PREBOOT + #define CONFIG_BOOTCOMMAND + +-//#define CONFIG_ENV_IS_NOWHERE 1 ++#define CONFIG_ENV_IS_NOWHERE 1 + #define CONFIG_ENV_SIZE (32 * SZ_1K) /* 32kB */ + #define CONFIG_ENV_OFFSET (720 * SZ_1K) /* FIXME: should be + close to U-boot image +@@ -176,8 +168,8 @@ + #define CONFIG_LZO 1 + + /* storage: emmc/nand/sd */ +-#define CONFIG_ENV_OVERWRITE +-#define CONFIG_ENV_IS_IN_MMC 1 ++//#define CONFIG_ENV_OVERWRITE ++#define CONFIG_ENV_IS_IN_MMC 0 + #define CONFIG_SYS_MMC_ENV_DEV 0 + #define CONFIG_AML_SD_EMMC 1 + diff --git a/projects/RPi/filesystem/usr/lib/systemd/system/serial-console.service b/projects/RPi/filesystem/usr/lib/systemd/system/serial-console.service index 5dffa1a8431..196e8c4a97a 100644 --- a/projects/RPi/filesystem/usr/lib/systemd/system/serial-console.service +++ b/projects/RPi/filesystem/usr/lib/systemd/system/serial-console.service @@ -6,6 +6,7 @@ ConditionKernelCommandLine=console [Service] WorkingDirectory=/storage Environment="ENV=/etc/profile" +ExecStartPre=/bin/sh -c 'echo -en "\033[?25h"' ExecStart=/bin/sh Restart=always RestartSec=0 diff --git a/projects/RPi/kodi/advancedsettings.xml b/projects/RPi/kodi/advancedsettings.xml index e1a7c0dc9bc..45b34cb598e 100644 --- a/projects/RPi/kodi/advancedsettings.xml +++ b/projects/RPi/kodi/advancedsettings.xml @@ -12,9 +12,4 @@ <samba> <clienttimeout>30</clienttimeout> </samba> - - <network> - <readbufferfactor>4.0</readbufferfactor> - </network> - </advancedsettings> diff --git a/projects/RPi/linux/linux.arm.conf b/projects/RPi/linux/linux.arm.conf index 825a3092a73..c6f62b9cb6b 100644 --- a/projects/RPi/linux/linux.arm.conf +++ b/projects/RPi/linux/linux.arm.conf @@ -1,12 +1,11 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/arm 4.4.2 Kernel Configuration +# Linux/arm 4.6.0-rc5 Kernel Configuration # CONFIG_ARM=y CONFIG_SYS_SUPPORTS_APM_EMULATION=y CONFIG_HAVE_PROC_CPU=y CONFIG_STACKTRACE_SUPPORT=y -CONFIG_HAVE_LATENCYTOP_SUPPORT=y CONFIG_LOCKDEP_SUPPORT=y CONFIG_TRACE_IRQFLAGS_SUPPORT=y CONFIG_RWSEM_XCHGADD_ALGORITHM=y @@ -107,23 +106,22 @@ CONFIG_IKCONFIG_PROC=y CONFIG_LOG_BUF_SHIFT=17 CONFIG_GENERIC_SCHED_CLOCK=y CONFIG_CGROUPS=y -# CONFIG_CGROUP_DEBUG is not set -CONFIG_CGROUP_FREEZER=y -# CONFIG_CGROUP_PIDS is not set -CONFIG_CGROUP_DEVICE=y -CONFIG_CPUSETS=y -CONFIG_PROC_PID_CPUSET=y -CONFIG_CGROUP_CPUACCT=y CONFIG_PAGE_COUNTER=y CONFIG_MEMCG=y # CONFIG_MEMCG_SWAP is not set -# CONFIG_MEMCG_KMEM is not set -CONFIG_CGROUP_SCHED=y -# CONFIG_FAIR_GROUP_SCHED is not set -# CONFIG_RT_GROUP_SCHED is not set CONFIG_BLK_CGROUP=y # CONFIG_DEBUG_BLK_CGROUP is not set CONFIG_CGROUP_WRITEBACK=y +CONFIG_CGROUP_SCHED=y +# CONFIG_FAIR_GROUP_SCHED is not set +# CONFIG_RT_GROUP_SCHED is not set +# CONFIG_CGROUP_PIDS is not set +CONFIG_CGROUP_FREEZER=y +CONFIG_CPUSETS=y +CONFIG_PROC_PID_CPUSET=y +CONFIG_CGROUP_DEVICE=y +CONFIG_CGROUP_CPUACCT=y +# CONFIG_CGROUP_DEBUG is not set # CONFIG_CHECKPOINT_RESTORE is not set CONFIG_NAMESPACES=y CONFIG_UTS_NS=y @@ -157,6 +155,8 @@ CONFIG_MULTIUSER=y CONFIG_SYSCTL_SYSCALL=y CONFIG_KALLSYMS=y # CONFIG_KALLSYMS_ALL is not set +# CONFIG_KALLSYMS_ABSOLUTE_PERCPU is not set +CONFIG_KALLSYMS_BASE_RELATIVE=y CONFIG_PRINTK=y CONFIG_BUG=y CONFIG_ELF_CORE=y @@ -200,7 +200,6 @@ CONFIG_HAVE_KPROBES=y CONFIG_HAVE_KRETPROBES=y CONFIG_HAVE_OPTPROBES=y CONFIG_HAVE_ARCH_TRACEHOOK=y -CONFIG_HAVE_DMA_ATTRS=y CONFIG_HAVE_DMA_CONTIGUOUS=y CONFIG_GENERIC_SMP_IDLE_THREAD=y CONFIG_GENERIC_IDLE_POLL_SETUP=y @@ -223,6 +222,10 @@ CONFIG_HAVE_IRQ_TIME_ACCOUNTING=y CONFIG_HAVE_MOD_ARCH_SPECIFIC=y CONFIG_MODULES_USE_ELF_REL=y CONFIG_ARCH_HAS_ELF_RANDOMIZE=y +CONFIG_HAVE_ARCH_MMAP_RND_BITS=y +CONFIG_ARCH_MMAP_RND_BITS_MIN=8 +CONFIG_ARCH_MMAP_RND_BITS_MAX=15 +CONFIG_ARCH_MMAP_RND_BITS=8 CONFIG_CLONE_BACKWARDS=y CONFIG_OLD_SIGSUSPEND3=y CONFIG_OLD_SIGACTION=y @@ -303,8 +306,6 @@ CONFIG_MMU=y CONFIG_ARCH_BCM2708=y # CONFIG_ARCH_BCM2709 is not set # CONFIG_ARCH_MULTIPLATFORM is not set -# CONFIG_ARCH_REALVIEW is not set -# CONFIG_ARCH_VERSATILE is not set # CONFIG_ARCH_CLPS711X is not set # CONFIG_ARCH_GEMINI is not set # CONFIG_ARCH_EBSA110 is not set @@ -316,9 +317,6 @@ CONFIG_ARCH_BCM2708=y # CONFIG_ARCH_IOP33X is not set # CONFIG_ARCH_IXP4XX is not set # CONFIG_ARCH_DOVE is not set -# CONFIG_ARCH_MV78XX0 is not set -# CONFIG_ARCH_ORION5X is not set -# CONFIG_ARCH_MMP is not set # CONFIG_ARCH_KS8695 is not set # CONFIG_ARCH_W90X900 is not set # CONFIG_ARCH_LPC32XX is not set @@ -326,7 +324,6 @@ CONFIG_ARCH_BCM2708=y # CONFIG_ARCH_RPC is not set # CONFIG_ARCH_SA1100 is not set # CONFIG_ARCH_S3C24XX is not set -# CONFIG_ARCH_S3C64XX is not set # CONFIG_ARCH_DAVINCI is not set # CONFIG_ARCH_OMAP1 is not set @@ -363,7 +360,7 @@ CONFIG_KUSER_HELPERS=y # CONFIG_CACHE_L2X0 is not set CONFIG_ARM_L1_CACHE_SHIFT=5 CONFIG_ARM_DMA_MEM_BUFFERABLE=y -# CONFIG_ARM_KERNMEM_PERMS is not set +# CONFIG_DEBUG_RODATA is not set CONFIG_MULTI_IRQ_HANDLER=y CONFIG_ARM_ERRATA_326103=y CONFIG_ARM_ERRATA_411920=y @@ -430,6 +427,7 @@ CONFIG_CMA_AREAS=7 # CONFIG_ZPOOL is not set # CONFIG_ZBUD is not set # CONFIG_ZSMALLOC is not set +CONFIG_GENERIC_EARLY_IOREMAP=y # CONFIG_IDLE_PAGE_TRACKING is not set CONFIG_FRAME_VECTOR=y CONFIG_FORCE_MAX_ZONEORDER=11 @@ -438,6 +436,8 @@ CONFIG_UACCESS_WITH_MEMCPY=y # CONFIG_SECCOMP is not set CONFIG_SWIOTLB=y CONFIG_IOMMU_HELPER=y +# CONFIG_PARAVIRT is not set +# CONFIG_PARAVIRT_TIME_ACCOUNTING is not set # # Boot options @@ -524,6 +524,7 @@ CONFIG_COREDUMP=y # CONFIG_SUSPEND is not set # CONFIG_HIBERNATION is not set # CONFIG_PM is not set +# CONFIG_APM_EMULATION is not set CONFIG_CPU_PM=y CONFIG_ARCH_SUSPEND_POSSIBLE=y # CONFIG_ARM_CPU_SUSPEND is not set @@ -564,7 +565,6 @@ CONFIG_INET_TUNNEL=m # CONFIG_INET_XFRM_MODE_TRANSPORT is not set # CONFIG_INET_XFRM_MODE_TUNNEL is not set # CONFIG_INET_XFRM_MODE_BEET is not set -CONFIG_INET_LRO=y # CONFIG_INET_DIAG is not set # CONFIG_TCP_CONG_ADVANCED is not set CONFIG_TCP_CONG_CUBIC=y @@ -813,12 +813,12 @@ CONFIG_DNS_RESOLVER=y # CONFIG_BATMAN_ADV is not set # CONFIG_OPENVSWITCH is not set # CONFIG_VSOCKETS is not set -# CONFIG_NETLINK_MMAP is not set # CONFIG_NETLINK_DIAG is not set # CONFIG_MPLS is not set # CONFIG_HSR is not set # CONFIG_NET_SWITCHDEV is not set # CONFIG_NET_L3_MASTER_DEV is not set +# CONFIG_SOCK_CGROUP_DATA is not set # CONFIG_CGROUP_NET_PRIO is not set # CONFIG_CGROUP_NET_CLASSID is not set CONFIG_NET_RX_BUSY_POLL=y @@ -840,6 +840,7 @@ CONFIG_BT_RFCOMM_TTY=y CONFIG_BT_HIDP=m CONFIG_BT_HS=y CONFIG_BT_LE=y +# CONFIG_BT_LEDS is not set # CONFIG_BT_SELFTEST is not set # CONFIG_BT_DEBUGFS is not set @@ -862,6 +863,7 @@ CONFIG_BT_HCIUART_3WIRE=y # CONFIG_BT_HCIUART_INTEL is not set CONFIG_BT_HCIUART_BCM=y # CONFIG_BT_HCIUART_QCA is not set +# CONFIG_BT_HCIUART_AG6XX is not set CONFIG_BT_HCIBCM203X=m # CONFIG_BT_HCIBPA10X is not set CONFIG_BT_HCIBFUSB=m @@ -869,6 +871,7 @@ CONFIG_BT_HCIBFUSB=m # CONFIG_BT_MRVL is not set CONFIG_BT_ATH3K=m # CONFIG_AF_RXRPC is not set +# CONFIG_AF_KCM is not set CONFIG_WIRELESS=y CONFIG_WIRELESS_EXT=y CONFIG_WEXT_CORE=y @@ -877,7 +880,6 @@ CONFIG_WEXT_PRIV=y CONFIG_CFG80211=m # CONFIG_NL80211_TESTMODE is not set # CONFIG_CFG80211_DEVELOPER_WARNINGS is not set -# CONFIG_CFG80211_REG_DEBUG is not set # CONFIG_CFG80211_CERTIFICATION_ONUS is not set CONFIG_CFG80211_DEFAULT_PS=y # CONFIG_CFG80211_DEBUGFS is not set @@ -905,13 +907,15 @@ CONFIG_MAC80211_STA_HASH_MAX_SIZE=0 # CONFIG_CEPH_LIB is not set # CONFIG_NFC is not set # CONFIG_LWTUNNEL is not set +CONFIG_DST_CACHE=y +# CONFIG_NET_DEVLINK is not set +CONFIG_MAY_USE_DEVLINK=y CONFIG_HAVE_BPF_JIT=y # # Device Drivers # CONFIG_ARM_AMBA=y -# CONFIG_TEGRA_AHB is not set # # Generic Driver Options @@ -931,8 +935,8 @@ CONFIG_EXTRA_FIRMWARE="" # CONFIG_SYS_HYPERVISOR is not set # CONFIG_GENERIC_CPU_DEVICES is not set CONFIG_REGMAP=y -CONFIG_REGMAP_I2C=m -CONFIG_REGMAP_SPI=m +CONFIG_REGMAP_I2C=y +CONFIG_REGMAP_SPI=y CONFIG_REGMAP_MMIO=m CONFIG_REGMAP_IRQ=y CONFIG_DMA_SHARED_BUFFER=y @@ -961,12 +965,15 @@ CONFIG_OF=y # CONFIG_OF_UNITTEST is not set CONFIG_OF_FLATTREE=y CONFIG_OF_EARLY_FLATTREE=y +CONFIG_OF_DYNAMIC=y CONFIG_OF_ADDRESS=y CONFIG_OF_IRQ=y CONFIG_OF_NET=y CONFIG_OF_MDIO=y CONFIG_OF_RESERVED_MEM=y -# CONFIG_OF_OVERLAY is not set +CONFIG_OF_RESOLVE=y +CONFIG_OF_OVERLAY=y +CONFIG_OF_CONFIGFS=y CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y # CONFIG_PARPORT is not set CONFIG_BLK_DEV=y @@ -1042,6 +1049,10 @@ CONFIG_BCM2708_VCHIQ=y # SCIF Bus Driver # +# +# VOP Bus Driver +# + # # Intel MIC Host Driver # @@ -1057,6 +1068,10 @@ CONFIG_BCM2708_VCHIQ=y # # Intel MIC Coprocessor State Management (COSM) Drivers # + +# +# VOP Driver +# # CONFIG_ECHO is not set # CONFIG_CXL_BASE is not set # CONFIG_CXL_KERNEL_API is not set @@ -1117,7 +1132,9 @@ CONFIG_MACVLAN=m # CONFIG_MACVTAP is not set # CONFIG_IPVLAN is not set # CONFIG_VXLAN is not set +# CONFIG_MACSEC is not set CONFIG_NETCONSOLE=y +# CONFIG_NETCONSOLE_DYNAMIC is not set CONFIG_NETPOLL=y CONFIG_NET_POLL_CONTROLLER=y CONFIG_TUN=y @@ -1216,15 +1233,9 @@ CONFIG_USB_IPHETH=m # CONFIG_USB_VL600 is not set # CONFIG_USB_NET_CH9200 is not set CONFIG_WLAN=y -# CONFIG_LIBERTAS_THINFIRM is not set -# CONFIG_AT76C50X_USB is not set -CONFIG_USB_ZD1201=m -CONFIG_USB_NET_RNDIS_WLAN=m -CONFIG_RTL8187=m -CONFIG_RTL8187_LEDS=y -# CONFIG_MAC80211_HWSIM is not set +CONFIG_WLAN_VENDOR_ADMTEK=y CONFIG_ATH_COMMON=m -CONFIG_ATH_CARDS=m +CONFIG_WLAN_VENDOR_ATH=y # CONFIG_ATH_DEBUG is not set CONFIG_ATH9K_HW=m CONFIG_ATH9K_COMMON=m @@ -1237,6 +1248,7 @@ CONFIG_ATH9K_AHB=y CONFIG_ATH9K_PCOEM=y CONFIG_ATH9K_HTC=m # CONFIG_ATH9K_HTC_DEBUGFS is not set +CONFIG_ATH9K_HWRNG=y CONFIG_CARL9170=m CONFIG_CARL9170_LEDS=y CONFIG_CARL9170_WPC=y @@ -1249,6 +1261,9 @@ CONFIG_AR5523=m # CONFIG_ATH10K is not set CONFIG_WCN36XX=m # CONFIG_WCN36XX_DEBUGFS is not set +CONFIG_WLAN_VENDOR_ATMEL=y +# CONFIG_AT76C50X_USB is not set +CONFIG_WLAN_VENDOR_BROADCOM=y CONFIG_B43=m CONFIG_B43_BCMA=y CONFIG_B43_SSB=y @@ -1274,12 +1289,21 @@ CONFIG_BRCMFMAC_SDIO=y CONFIG_BRCMFMAC_USB=y # CONFIG_BRCM_TRACING is not set # CONFIG_BRCMDBG is not set +CONFIG_WLAN_VENDOR_CISCO=y +CONFIG_WLAN_VENDOR_INTEL=y +CONFIG_WLAN_VENDOR_INTERSIL=y # CONFIG_HOSTAP is not set -# CONFIG_LIBERTAS is not set CONFIG_P54_COMMON=m CONFIG_P54_USB=m # CONFIG_P54_SPI is not set CONFIG_P54_LEDS=y +CONFIG_WLAN_VENDOR_MARVELL=y +# CONFIG_LIBERTAS is not set +# CONFIG_LIBERTAS_THINFIRM is not set +# CONFIG_MWIFIEX is not set +CONFIG_WLAN_VENDOR_MEDIATEK=y +CONFIG_MT7601U=m +CONFIG_WLAN_VENDOR_RALINK=y CONFIG_RT2X00=m CONFIG_RT2500USB=m CONFIG_RT73USB=m @@ -1297,18 +1321,28 @@ CONFIG_RT2X00_LIB_FIRMWARE=y CONFIG_RT2X00_LIB_CRYPTO=y CONFIG_RT2X00_LIB_LEDS=y # CONFIG_RT2X00_DEBUG is not set -CONFIG_WL_MEDIATEK=y -CONFIG_MT7601U=m +CONFIG_WLAN_VENDOR_REALTEK=y +CONFIG_RTL8187=m +CONFIG_RTL8187_LEDS=y CONFIG_RTL_CARDS=m # CONFIG_RTL8192CU is not set CONFIG_RTL8XXXU=m CONFIG_RTL8XXXU_UNTESTED=y -# CONFIG_WL_TI is not set +CONFIG_WLAN_VENDOR_RSI=y +# CONFIG_RSI_91X is not set +CONFIG_WLAN_VENDOR_ST=y +# CONFIG_CW1200 is not set +CONFIG_WLAN_VENDOR_TI=y +# CONFIG_WL1251 is not set +# CONFIG_WL12XX is not set +# CONFIG_WL18XX is not set +# CONFIG_WLCORE is not set +CONFIG_WLAN_VENDOR_ZYDAS=y +CONFIG_USB_ZD1201=m CONFIG_ZD1211RW=m # CONFIG_ZD1211RW_DEBUG is not set -# CONFIG_MWIFIEX is not set -# CONFIG_CW1200 is not set -# CONFIG_RSI_91X is not set +# CONFIG_MAC80211_HWSIM is not set +CONFIG_USB_NET_RNDIS_WLAN=m # # Enable WiMAX (Networking options) to see the WiMAX drivers @@ -1387,6 +1421,7 @@ CONFIG_TOUCHSCREEN_ADS7846=m # CONFIG_TOUCHSCREEN_HAMPSHIRE is not set # CONFIG_TOUCHSCREEN_EETI is not set CONFIG_TOUCHSCREEN_EGALAX=m +# CONFIG_TOUCHSCREEN_EGALAX_SERIAL is not set # CONFIG_TOUCHSCREEN_FT6236 is not set # CONFIG_TOUCHSCREEN_FUJITSU is not set # CONFIG_TOUCHSCREEN_GOODIX is not set @@ -1399,6 +1434,7 @@ CONFIG_TOUCHSCREEN_EGALAX=m # CONFIG_TOUCHSCREEN_MAX11801 is not set # CONFIG_TOUCHSCREEN_MCS5000 is not set # CONFIG_TOUCHSCREEN_MMS114 is not set +# CONFIG_TOUCHSCREEN_MELFAS_MIP4 is not set # CONFIG_TOUCHSCREEN_MTOUCH is not set # CONFIG_TOUCHSCREEN_IMX6UL_TSC is not set # CONFIG_TOUCHSCREEN_INEXIO is not set @@ -1466,6 +1502,7 @@ CONFIG_INPUT_UINPUT=y # CONFIG_INPUT_DRV260X_HAPTICS is not set # CONFIG_INPUT_DRV2665_HAPTICS is not set # CONFIG_INPUT_DRV2667_HAPTICS is not set +# CONFIG_RMI4_CORE is not set # # Hardware I/O ports @@ -1513,7 +1550,7 @@ CONFIG_SERIAL_8250_FSL=y # CONFIG_SERIAL_8250_DW is not set # CONFIG_SERIAL_8250_EM is not set # CONFIG_SERIAL_8250_RT288X is not set -# CONFIG_SERIAL_8250_INGENIC is not set +CONFIG_SERIAL_OF_PLATFORM=y # # Non-8250 serial port support @@ -1527,7 +1564,6 @@ CONFIG_SERIAL_AMBA_PL011_CONSOLE=y # CONFIG_SERIAL_UARTLITE is not set CONFIG_SERIAL_CORE=y CONFIG_SERIAL_CORE_CONSOLE=y -CONFIG_SERIAL_OF_PLATFORM=y # CONFIG_SERIAL_SCCNXP is not set # CONFIG_SERIAL_SC16IS7XX is not set # CONFIG_SERIAL_BCM63XX is not set @@ -1540,6 +1576,7 @@ CONFIG_SERIAL_OF_PLATFORM=y # CONFIG_SERIAL_CONEXANT_DIGICOLOR is not set # CONFIG_SERIAL_ST_ASC is not set # CONFIG_SERIAL_STM32 is not set +# CONFIG_SERIAL_MVEBU_UART is not set # CONFIG_TTY_PRINTK is not set # CONFIG_HVC_DCC is not set # CONFIG_IPMI_HANDLER is not set @@ -1569,6 +1606,7 @@ CONFIG_I2C_MUX=m # CONFIG_I2C_MUX_PCA954x is not set # CONFIG_I2C_MUX_PINCTRL is not set # CONFIG_I2C_MUX_REG is not set +# CONFIG_I2C_DEMUX_PINCTRL is not set CONFIG_I2C_HELPER_AUTO=y CONFIG_I2C_ALGOBIT=y @@ -1619,10 +1657,12 @@ CONFIG_SPI_MASTER=y # SPI Master Controller Drivers # # CONFIG_SPI_ALTERA is not set +# CONFIG_SPI_AXI_SPI_ENGINE is not set CONFIG_SPI_BCM2835=m CONFIG_SPI_BCM2835AUX=m # CONFIG_SPI_BITBANG is not set # CONFIG_SPI_CADENCE is not set +# CONFIG_SPI_DESIGNWARE is not set # CONFIG_SPI_GPIO is not set # CONFIG_SPI_FSL_SPI is not set # CONFIG_SPI_OC_TINY is not set @@ -1633,12 +1673,12 @@ CONFIG_SPI_BCM2835AUX=m # CONFIG_SPI_XCOMM is not set # CONFIG_SPI_XILINX is not set # CONFIG_SPI_ZYNQMP_GQSPI is not set -# CONFIG_SPI_DESIGNWARE is not set # # SPI Protocol Masters # CONFIG_SPI_SPIDEV=y +# CONFIG_SPI_LOOPBACK_TEST is not set # CONFIG_SPI_TLE62X0 is not set # CONFIG_SPMI is not set # CONFIG_HSI is not set @@ -1689,6 +1729,7 @@ CONFIG_GPIO_BCM_VIRT=y # CONFIG_GPIO_EM is not set # CONFIG_GPIO_GENERIC_PLATFORM is not set # CONFIG_GPIO_GRGPIO is not set +# CONFIG_GPIO_MPC8XXX is not set # CONFIG_GPIO_PL061 is not set # CONFIG_GPIO_XILINX is not set # CONFIG_GPIO_ZEVIO is not set @@ -1704,6 +1745,7 @@ CONFIG_GPIO_BCM_VIRT=y # CONFIG_GPIO_PCA953X is not set # CONFIG_GPIO_PCF857X is not set # CONFIG_GPIO_SX150X is not set +# CONFIG_GPIO_TPIC2810 is not set # # MFD GPIO expanders @@ -1716,6 +1758,7 @@ CONFIG_GPIO_ARIZONA=m # CONFIG_GPIO_74X164 is not set # CONFIG_GPIO_MAX7301 is not set # CONFIG_GPIO_MC33880 is not set +# CONFIG_GPIO_PISOSR is not set # # SPI or I2C GPIO expanders @@ -1773,7 +1816,13 @@ CONFIG_POWER_SUPPLY=y # CONFIG_CHARGER_SMB347 is not set # CONFIG_BATTERY_GAUGE_LTC2941 is not set # CONFIG_CHARGER_RT9455 is not set -# CONFIG_POWER_RESET is not set +CONFIG_POWER_RESET=y +CONFIG_POWER_RESET_GPIO=y +CONFIG_POWER_RESET_GPIO_RESTART=y +# CONFIG_POWER_RESET_LTC2952 is not set +CONFIG_POWER_RESET_RESTART=y +# CONFIG_POWER_RESET_SYSCON is not set +# CONFIG_POWER_RESET_SYSCON_POWEROFF is not set # CONFIG_POWER_AVS is not set CONFIG_HWMON=y # CONFIG_HWMON_VID is not set @@ -1815,6 +1864,7 @@ CONFIG_HWMON=y # CONFIG_SENSORS_POWR1220 is not set # CONFIG_SENSORS_LINEAGE is not set # CONFIG_SENSORS_LTC2945 is not set +# CONFIG_SENSORS_LTC2990 is not set # CONFIG_SENSORS_LTC4151 is not set # CONFIG_SENSORS_LTC4215 is not set # CONFIG_SENSORS_LTC4222 is not set @@ -1831,7 +1881,6 @@ CONFIG_HWMON=y # CONFIG_SENSORS_MAX6650 is not set # CONFIG_SENSORS_MAX6697 is not set # CONFIG_SENSORS_MAX31790 is not set -# CONFIG_SENSORS_HTU21 is not set # CONFIG_SENSORS_MCP3021 is not set # CONFIG_SENSORS_ADCXX is not set # CONFIG_SENSORS_LM63 is not set @@ -1915,6 +1964,7 @@ CONFIG_THERMAL_BCM2835=y CONFIG_WATCHDOG=y CONFIG_WATCHDOG_CORE=y # CONFIG_WATCHDOG_NOWAYOUT is not set +# CONFIG_WATCHDOG_SYSFS is not set # # Watchdog Device Drivers @@ -1922,12 +1972,12 @@ CONFIG_WATCHDOG_CORE=y # CONFIG_SOFT_WATCHDOG is not set # CONFIG_GPIO_WATCHDOG is not set # CONFIG_XILINX_WATCHDOG is not set +# CONFIG_ZIIRAVE_WATCHDOG is not set # CONFIG_ARM_SP805_WATCHDOG is not set # CONFIG_CADENCE_WATCHDOG is not set # CONFIG_DW_WATCHDOG is not set # CONFIG_MAX63XX_WATCHDOG is not set CONFIG_BCM2835_WDT=m -# CONFIG_BCM7038_WDT is not set # CONFIG_MEN_A21_WDT is not set # @@ -1943,7 +1993,6 @@ CONFIG_SSB=m CONFIG_SSB_BLOCKIO=y CONFIG_SSB_SDIOHOST_POSSIBLE=y # CONFIG_SSB_SDIOHOST is not set -# CONFIG_SSB_HOST_SOC is not set # CONFIG_SSB_SILENT is not set # CONFIG_SSB_DEBUG is not set # CONFIG_SSB_DRIVER_GPIO is not set @@ -1964,6 +2013,7 @@ CONFIG_BCMA_DRIVER_GMAC_CMN=y # CONFIG_MFD_CORE=y # CONFIG_MFD_RPISENSE_CORE is not set +# CONFIG_MFD_ACT8945A is not set # CONFIG_MFD_AS3711 is not set # CONFIG_MFD_AS3722 is not set # CONFIG_PMIC_ADP5520 is not set @@ -1971,7 +2021,7 @@ CONFIG_MFD_CORE=y # CONFIG_MFD_ATMEL_FLEXCOM is not set # CONFIG_MFD_ATMEL_HLCDC is not set # CONFIG_MFD_BCM590XX is not set -# CONFIG_MFD_AXP20X is not set +# CONFIG_MFD_AXP20X_I2C is not set # CONFIG_MFD_CROS_EC is not set # CONFIG_MFD_ASIC3 is not set # CONFIG_PMIC_DA903X is not set @@ -2029,12 +2079,12 @@ CONFIG_MFD_RTSX_USB=y # CONFIG_TPS6105X is not set # CONFIG_TPS65010 is not set # CONFIG_TPS6507X is not set +# CONFIG_MFD_TPS65086 is not set # CONFIG_MFD_TPS65090 is not set # CONFIG_MFD_TPS65217 is not set # CONFIG_MFD_TPS65218 is not set # CONFIG_MFD_TPS6586X is not set # CONFIG_MFD_TPS65910 is not set -# CONFIG_MFD_TPS65912 is not set # CONFIG_MFD_TPS65912_I2C is not set # CONFIG_MFD_TPS65912_SPI is not set # CONFIG_MFD_TPS80031 is not set @@ -2050,6 +2100,7 @@ CONFIG_MFD_RTSX_USB=y CONFIG_MFD_ARIZONA=y CONFIG_MFD_ARIZONA_I2C=m CONFIG_MFD_ARIZONA_SPI=m +# CONFIG_MFD_CS47L24 is not set CONFIG_MFD_WM5102=y # CONFIG_MFD_WM5110 is not set # CONFIG_MFD_WM8997 is not set @@ -2449,12 +2500,18 @@ CONFIG_DVB_AF9033=m # # CONFIG_DRM is not set +# +# ACP (Audio CoProcessor) Configuration +# +# CONFIG_DRM_AMD_ACP is not set + # # Frame buffer Devices # CONFIG_FB=y # CONFIG_FIRMWARE_EDID is not set CONFIG_FB_CMDLINE=y +CONFIG_FB_NOTIFY=y # CONFIG_FB_DDC is not set # CONFIG_FB_BOOT_VESA_SUPPORT is not set CONFIG_FB_CFB_FILLRECT=y @@ -2489,7 +2546,31 @@ CONFIG_FB_BCM2708=y # CONFIG_FB_SIMPLE is not set # CONFIG_FB_SSD1307 is not set # CONFIG_FB_RPISENSE is not set -# CONFIG_BACKLIGHT_LCD_SUPPORT is not set +CONFIG_BACKLIGHT_LCD_SUPPORT=y +CONFIG_LCD_CLASS_DEVICE=y +# CONFIG_LCD_L4F00242T03 is not set +# CONFIG_LCD_LMS283GF05 is not set +# CONFIG_LCD_LTV350QV is not set +# CONFIG_LCD_ILI922X is not set +# CONFIG_LCD_ILI9320 is not set +# CONFIG_LCD_TDO24M is not set +# CONFIG_LCD_VGG2432A4 is not set +# CONFIG_LCD_PLATFORM is not set +# CONFIG_LCD_S6E63M0 is not set +# CONFIG_LCD_LD9040 is not set +# CONFIG_LCD_AMS369FG06 is not set +# CONFIG_LCD_LMS501KF03 is not set +# CONFIG_LCD_HX8357 is not set +CONFIG_BACKLIGHT_CLASS_DEVICE=y +# CONFIG_BACKLIGHT_GENERIC is not set +CONFIG_BACKLIGHT_RPI=y +# CONFIG_BACKLIGHT_PM8941_WLED is not set +# CONFIG_BACKLIGHT_ADP8860 is not set +# CONFIG_BACKLIGHT_ADP8870 is not set +# CONFIG_BACKLIGHT_LM3639 is not set +CONFIG_BACKLIGHT_GPIO=y +# CONFIG_BACKLIGHT_LV5207LP is not set +# CONFIG_BACKLIGHT_BD6107 is not set # CONFIG_VGASTATE is not set # @@ -2509,6 +2590,7 @@ CONFIG_SND_DMAENGINE_PCM=m CONFIG_SND_HWDEP=m CONFIG_SND_RAWMIDI=m CONFIG_SND_JACK=y +CONFIG_SND_JACK_INPUT_DEV=y # CONFIG_SND_SEQUENCER is not set # CONFIG_SND_MIXER_OSS is not set # CONFIG_SND_PCM_OSS is not set @@ -2553,6 +2635,7 @@ CONFIG_SND_USB_TONEPORT=m CONFIG_SND_USB_VARIAX=m CONFIG_SND_SOC=m CONFIG_SND_SOC_GENERIC_DMAENGINE_PCM=y +# CONFIG_SND_SOC_AMD_ACP is not set # CONFIG_SND_ATMEL_SOC is not set CONFIG_SND_BCM2835_SOC_I2S=m CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC=m @@ -2561,6 +2644,8 @@ CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI=m CONFIG_SND_BCM2708_SOC_HIFIBERRY_AMP=m CONFIG_SND_BCM2708_SOC_RPI_DAC=m CONFIG_SND_BCM2708_SOC_RPI_PROTO=m +CONFIG_SND_BCM2708_SOC_BOOMBERRY_DAC=m +CONFIG_SND_BCM2708_SOC_BOOMBERRY_DIGI=m CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC=m CONFIG_SND_BCM2708_SOC_RASPIDAC3=m # CONFIG_SND_DESIGNWARE_I2S is not set @@ -2578,11 +2663,13 @@ CONFIG_SND_BCM2708_SOC_RASPIDAC3=m # CONFIG_SND_SOC_FSL_SPDIF is not set # CONFIG_SND_SOC_FSL_ESAI is not set # CONFIG_SND_SOC_IMX_AUDMUX is not set +# CONFIG_SND_SOC_IMG is not set # # Allwinner SoC Audio support # # CONFIG_SND_SUN4I_CODEC is not set +# CONFIG_SND_SUN4I_SPDIF is not set # CONFIG_SND_SOC_XTFPGA_I2S is not set CONFIG_SND_SOC_I2C_AND_SPI=m @@ -2610,11 +2697,16 @@ CONFIG_SND_SOC_I2C_AND_SPI=m # CONFIG_SND_SOC_CS4349 is not set # CONFIG_SND_SOC_ES8328 is not set # CONFIG_SND_SOC_GTM601 is not set +# CONFIG_SND_SOC_INNO_RK3036 is not set # CONFIG_SND_SOC_PCM1681 is not set -# CONFIG_SND_SOC_PCM1792A is not set +# CONFIG_SND_SOC_PCM179X_I2C is not set +# CONFIG_SND_SOC_PCM179X_SPI is not set +# CONFIG_SND_SOC_PCM3168A_I2C is not set +# CONFIG_SND_SOC_PCM3168A_SPI is not set CONFIG_SND_SOC_PCM512x=m CONFIG_SND_SOC_PCM512x_I2C=m # CONFIG_SND_SOC_PCM512x_SPI is not set +# CONFIG_SND_SOC_RT5616 is not set CONFIG_SND_SOC_PCM1794A=m CONFIG_SND_SOC_PCM5102A=m # CONFIG_SND_SOC_RT5631 is not set @@ -2655,6 +2747,7 @@ CONFIG_SND_SOC_WM8804_I2C=m # CONFIG_SND_SOC_WM8804_SPI is not set # CONFIG_SND_SOC_WM8903 is not set # CONFIG_SND_SOC_WM8962 is not set +# CONFIG_SND_SOC_WM8974 is not set # CONFIG_SND_SOC_WM8978 is not set CONFIG_SND_SOC_TPA6130A2=m # CONFIG_SND_SIMPLE_CARD is not set @@ -2684,6 +2777,7 @@ CONFIG_HID_CHERRY=y CONFIG_HID_CHICONY=y # CONFIG_HID_CORSAIR is not set # CONFIG_HID_PRODIKEYS is not set +# CONFIG_HID_CMEDIA is not set # CONFIG_HID_CP2112 is not set CONFIG_HID_CYPRESS=y CONFIG_HID_DRAGONRISE=m @@ -2999,6 +3093,7 @@ CONFIG_LEDS_GPIO=y # CONFIG_LEDS_TLC591XX is not set # CONFIG_LEDS_LM355x is not set # CONFIG_LEDS_KTD2692 is not set +# CONFIG_LEDS_IS31FL32XX is not set # # LED driver for blink(1) USB RGB LED is under Special HID drivers (HID_THINGM) @@ -3010,18 +3105,18 @@ CONFIG_LEDS_GPIO=y # CONFIG_LEDS_TRIGGERS=y CONFIG_LEDS_TRIGGER_TIMER=y -# CONFIG_LEDS_TRIGGER_ONESHOT is not set +CONFIG_LEDS_TRIGGER_ONESHOT=y CONFIG_LEDS_TRIGGER_HEARTBEAT=y -# CONFIG_LEDS_TRIGGER_BACKLIGHT is not set -# CONFIG_LEDS_TRIGGER_CPU is not set -# CONFIG_LEDS_TRIGGER_GPIO is not set +CONFIG_LEDS_TRIGGER_BACKLIGHT=y +CONFIG_LEDS_TRIGGER_CPU=y +CONFIG_LEDS_TRIGGER_GPIO=y CONFIG_LEDS_TRIGGER_DEFAULT_ON=y # # iptables trigger is under Netfilter config (LED target) # -# CONFIG_LEDS_TRIGGER_TRANSIENT is not set -# CONFIG_LEDS_TRIGGER_CAMERA is not set +CONFIG_LEDS_TRIGGER_TRANSIENT=y +CONFIG_LEDS_TRIGGER_CAMERA=y CONFIG_LEDS_TRIGGER_INPUT=y # CONFIG_ACCESSIBILITY is not set CONFIG_EDAC_ATOMIC_SCRUB=y @@ -3049,9 +3144,9 @@ CONFIG_RTC_INTF_DEV=y # CONFIG_RTC_DRV_ABB5ZES3 is not set # CONFIG_RTC_DRV_ABX80X is not set CONFIG_RTC_DRV_DS1307=m +CONFIG_RTC_DRV_DS1307_HWMON=y # CONFIG_RTC_DRV_DS1374 is not set # CONFIG_RTC_DRV_DS1672 is not set -# CONFIG_RTC_DRV_DS3232 is not set # CONFIG_RTC_DRV_HYM8563 is not set # CONFIG_RTC_DRV_MAX6900 is not set # CONFIG_RTC_DRV_RS5C372 is not set @@ -3059,15 +3154,15 @@ CONFIG_RTC_DRV_DS1307=m # CONFIG_RTC_DRV_ISL12022 is not set # CONFIG_RTC_DRV_ISL12057 is not set # CONFIG_RTC_DRV_X1205 is not set -CONFIG_RTC_DRV_PCF2127=m CONFIG_RTC_DRV_PCF8523=m -CONFIG_RTC_DRV_PCF8563=m # CONFIG_RTC_DRV_PCF85063 is not set +CONFIG_RTC_DRV_PCF8563=m # CONFIG_RTC_DRV_PCF8583 is not set # CONFIG_RTC_DRV_M41T80 is not set # CONFIG_RTC_DRV_BQ32K is not set # CONFIG_RTC_DRV_S35390A is not set # CONFIG_RTC_DRV_FM3130 is not set +# CONFIG_RTC_DRV_RX8010 is not set # CONFIG_RTC_DRV_RX8581 is not set # CONFIG_RTC_DRV_RX8025 is not set # CONFIG_RTC_DRV_EM3027 is not set @@ -3083,13 +3178,20 @@ CONFIG_RTC_DRV_PCF8563=m # CONFIG_RTC_DRV_DS1343 is not set # CONFIG_RTC_DRV_DS1347 is not set # CONFIG_RTC_DRV_DS1390 is not set -# CONFIG_RTC_DRV_MAX6902 is not set # CONFIG_RTC_DRV_R9701 is not set +# CONFIG_RTC_DRV_RX4581 is not set +# CONFIG_RTC_DRV_RX6110 is not set # CONFIG_RTC_DRV_RS5C348 is not set -# CONFIG_RTC_DRV_DS3234 is not set +# CONFIG_RTC_DRV_MAX6902 is not set # CONFIG_RTC_DRV_PCF2123 is not set -# CONFIG_RTC_DRV_RX4581 is not set # CONFIG_RTC_DRV_MCP795 is not set +CONFIG_RTC_I2C_AND_SPI=y + +# +# SPI and I2C RTC drivers +# +CONFIG_RTC_DRV_DS3232=m +CONFIG_RTC_DRV_PCF2127=m # # Platform RTC drivers @@ -3138,6 +3240,8 @@ CONFIG_DMA_BCM2835=y # CONFIG_NBPFAXI_DMA is not set # CONFIG_PL330_DMA is not set CONFIG_DMA_BCM2708=y +# CONFIG_QCOM_HIDMA_MGMT is not set +# CONFIG_QCOM_HIDMA is not set # CONFIG_DW_DMAC is not set # @@ -3169,32 +3273,30 @@ CONFIG_VT6656=m # Speakup console speech # # CONFIG_SPEAKUP is not set -# CONFIG_TOUCHSCREEN_SYNAPTICS_I2C_RMI4 is not set CONFIG_STAGING_MEDIA=y CONFIG_DVB_MN88472=m -CONFIG_DVB_MN88473=m CONFIG_LIRC_STAGING=y # CONFIG_LIRC_IMON is not set CONFIG_LIRC_RPI=m # CONFIG_LIRC_SASEM is not set # CONFIG_LIRC_SERIAL is not set # CONFIG_LIRC_SIR is not set -CONFIG_LIRC_XBOX=m +# CONFIG_LIRC_XBOX is not set # CONFIG_LIRC_ZILOG is not set # # Android # # CONFIG_STAGING_BOARD is not set -# CONFIG_WIMAX_GDM72XX is not set # CONFIG_LTE_GDM724X is not set -# CONFIG_LUSTRE_FS is not set -# CONFIG_DGAP is not set +# CONFIG_LNET is not set # CONFIG_GS_FPGABOOT is not set # CONFIG_COMMON_CLK_XLNX_CLKWZRD is not set # CONFIG_FB_TFT is not set -# CONFIG_WILC1000_DRIVER is not set +# CONFIG_WILC1000_SDIO is not set +# CONFIG_WILC1000_SPI is not set # CONFIG_MOST is not set +# CONFIG_GOLDFISH is not set # CONFIG_CHROME_PLATFORMS is not set CONFIG_CLKDEV_LOOKUP=y CONFIG_HAVE_CLK_PREPARE=y @@ -3206,10 +3308,12 @@ CONFIG_COMMON_CLK=y # CONFIG_COMMON_CLK_SI5351 is not set # CONFIG_COMMON_CLK_SI514 is not set # CONFIG_COMMON_CLK_SI570 is not set +# CONFIG_COMMON_CLK_CDCE706 is not set # CONFIG_COMMON_CLK_CDCE925 is not set +# CONFIG_COMMON_CLK_CS2000_CP is not set # CONFIG_CLK_QORIQ is not set +# CONFIG_COMMON_CLK_NXP is not set # CONFIG_COMMON_CLK_PXA is not set -# CONFIG_COMMON_CLK_CDCE706 is not set # # Hardware Spinlock drivers @@ -3258,6 +3362,7 @@ CONFIG_EXTCON=m # CONFIG_EXTCON_ARIZONA=m # CONFIG_EXTCON_GPIO is not set +# CONFIG_EXTCON_MAX3355 is not set # CONFIG_EXTCON_RT8973A is not set # CONFIG_EXTCON_SM5502 is not set # CONFIG_EXTCON_USB_GPIO is not set @@ -3265,6 +3370,7 @@ CONFIG_EXTCON_ARIZONA=m # CONFIG_IIO is not set # CONFIG_PWM is not set CONFIG_IRQCHIP=y +CONFIG_ARM_GIC_MAX_NR=1 # CONFIG_IPACK_BUS is not set # CONFIG_RESET_CONTROLLER is not set # CONFIG_FMC is not set @@ -3290,8 +3396,6 @@ CONFIG_IRQCHIP=y # CONFIG_ANDROID is not set # CONFIG_NVMEM is not set # CONFIG_STM is not set -# CONFIG_STM_DUMMY is not set -# CONFIG_STM_SOURCE_CONSOLE is not set # CONFIG_INTEL_TH is not set # @@ -3304,6 +3408,7 @@ CONFIG_IRQCHIP=y # # CONFIG_FIRMWARE_MEMMAP is not set CONFIG_RASPBERRYPI_FIRMWARE=y +# CONFIG_FW_CFG_SYSFS is not set # # File systems @@ -3336,6 +3441,7 @@ CONFIG_XFS_FS=m # CONFIG_XFS_WARN is not set # CONFIG_XFS_DEBUG is not set # CONFIG_GFS2_FS is not set +# CONFIG_OCFS2_FS is not set CONFIG_BTRFS_FS=m # CONFIG_BTRFS_FS_POSIX_ACL is not set # CONFIG_BTRFS_FS_CHECK_INTEGRITY is not set @@ -3350,6 +3456,8 @@ CONFIG_F2FS_CHECK_FS=y CONFIG_FS_POSIX_ACL=y CONFIG_EXPORTFS=y CONFIG_FILE_LOCKING=y +CONFIG_MANDATORY_FILE_LOCKING=y +# CONFIG_FS_ENCRYPTION is not set CONFIG_FSNOTIFY=y CONFIG_DNOTIFY=y CONFIG_INOTIFY_USER=y @@ -3383,6 +3491,7 @@ CONFIG_FAT_FS=y CONFIG_VFAT_FS=y CONFIG_FAT_DEFAULT_CODEPAGE=437 CONFIG_FAT_DEFAULT_IOCHARSET="ascii" +# CONFIG_FAT_DEFAULT_UTF8 is not set # CONFIG_NTFS_FS is not set # @@ -3398,8 +3507,9 @@ CONFIG_TMPFS=y CONFIG_TMPFS_POSIX_ACL=y CONFIG_TMPFS_XATTR=y # CONFIG_HUGETLB_PAGE is not set -# CONFIG_CONFIGFS_FS is not set +CONFIG_CONFIGFS_FS=y CONFIG_MISC_FILESYSTEMS=y +# CONFIG_ORANGEFS_FS is not set # CONFIG_ADFS_FS is not set # CONFIG_AFFS_FS is not set # CONFIG_ECRYPT_FS is not set @@ -3526,6 +3636,7 @@ CONFIG_NLS_ISO8859_1=y # CONFIG_NLS_MAC_ROMANIAN is not set # CONFIG_NLS_MAC_TURKISH is not set CONFIG_NLS_UTF8=y +# CONFIG_DLM is not set # # Kernel hacking @@ -3565,6 +3676,7 @@ CONFIG_DEBUG_KERNEL=y # # CONFIG_PAGE_EXTENSION is not set # CONFIG_DEBUG_PAGEALLOC is not set +# CONFIG_PAGE_POISONING is not set # CONFIG_DEBUG_OBJECTS is not set # CONFIG_SLUB_DEBUG_ON is not set # CONFIG_SLUB_STATS is not set @@ -3582,6 +3694,7 @@ CONFIG_LOCKUP_DETECTOR=y # CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0 # CONFIG_DETECT_HUNG_TASK is not set +# CONFIG_WQ_WATCHDOG is not set # CONFIG_PANIC_ON_OOPS is not set CONFIG_PANIC_ON_OOPS_VALUE=0 CONFIG_PANIC_TIMEOUT=0 @@ -3623,6 +3736,7 @@ CONFIG_PANIC_TIMEOUT=0 # CONFIG_RCU_TORTURE_TEST is not set # CONFIG_RCU_TRACE is not set # CONFIG_RCU_EQS_DEBUG is not set +# CONFIG_DEBUG_WQ_FORCE_RR_CPU is not set # CONFIG_DEBUG_BLOCK_EXT_DEVT is not set # CONFIG_NOTIFIER_ERROR_INJECTION is not set # CONFIG_FAULT_INJECTION is not set @@ -3650,6 +3764,7 @@ CONFIG_TRACING_SUPPORT=y # CONFIG_TEST_STRING_HELPERS is not set # CONFIG_TEST_KSTRTOX is not set # CONFIG_TEST_PRINTF is not set +# CONFIG_TEST_BITMAP is not set # CONFIG_TEST_RHASHTABLE is not set # CONFIG_DMA_API_DEBUG is not set # CONFIG_TEST_LKM is not set @@ -3662,14 +3777,15 @@ CONFIG_TRACING_SUPPORT=y # CONFIG_SAMPLES is not set CONFIG_HAVE_ARCH_KGDB=y # CONFIG_KGDB is not set -# CONFIG_ARM_PTDUMP is not set +# CONFIG_UBSAN is not set +CONFIG_ARCH_HAS_DEVMEM_IS_ALLOWED=y # CONFIG_STRICT_DEVMEM is not set +# CONFIG_ARM_PTDUMP is not set # CONFIG_ARM_UNWIND is not set # CONFIG_DEBUG_USER is not set # CONFIG_DEBUG_LL is not set CONFIG_DEBUG_LL_INCLUDE="mach/debug-macro.S" # CONFIG_DEBUG_UART_8250 is not set -# CONFIG_DEBUG_UART_BCM63XX is not set CONFIG_UNCOMPRESS_INCLUDE="mach/uncompress.h" # CONFIG_PID_IN_CONTEXTIDR is not set # CONFIG_DEBUG_SET_MODULE_RONX is not set @@ -3704,7 +3820,6 @@ CONFIG_CRYPTO_HASH2=y CONFIG_CRYPTO_RNG=m CONFIG_CRYPTO_RNG2=y CONFIG_CRYPTO_RNG_DEFAULT=m -CONFIG_CRYPTO_PCOMP2=y CONFIG_CRYPTO_AKCIPHER2=y # CONFIG_CRYPTO_RSA is not set CONFIG_CRYPTO_MANAGER=y @@ -3753,7 +3868,7 @@ CONFIG_CRYPTO_HMAC=y # Digest # CONFIG_CRYPTO_CRC32C=y -# CONFIG_CRYPTO_CRC32 is not set +CONFIG_CRYPTO_CRC32=y # CONFIG_CRYPTO_CRCT10DIF is not set CONFIG_CRYPTO_GHASH=m # CONFIG_CRYPTO_POLY1305 is not set @@ -3794,7 +3909,6 @@ CONFIG_CRYPTO_DES=y # Compression # # CONFIG_CRYPTO_DEFLATE is not set -# CONFIG_CRYPTO_ZLIB is not set CONFIG_CRYPTO_LZO=m # CONFIG_CRYPTO_842 is not set # CONFIG_CRYPTO_LZ4 is not set @@ -3882,6 +3996,7 @@ CONFIG_GENERIC_ATOMIC64=y CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE=y # CONFIG_CORDIC is not set # CONFIG_DDR is not set +# CONFIG_IRQ_POLL is not set CONFIG_LIBFDT=y CONFIG_OID_REGISTRY=y CONFIG_FONT_SUPPORT=y diff --git a/projects/RPi/options b/projects/RPi/options index 3e933ad5ff7..e45d32a7f9a 100644 --- a/projects/RPi/options +++ b/projects/RPi/options @@ -60,10 +60,10 @@ LINUX="default" # NOOBS supported hex versions (legacy) - NOOBS_HEX="2,3,4,5,6,7,8,9,d,e,f,10,11,12,14,19,0092" + NOOBS_HEX="2,3,4,5,6,7,8,9,d,e,f,10,11,12,14,19,0092,0093" # NOOBS supported model versions - NOOBS_SUPPORTED_MODELS="'Pi Model','Pi Compute Module','Pi Zero'" + NOOBS_SUPPORTED_MODELS='"Pi Model","Pi Compute Module","Pi Zero"' ################################################################################ # setup build defaults @@ -149,8 +149,3 @@ # Space separated list is supported, # e.g. ADDITIONAL_DRIVERS="DRIVER1 DRIVER2" ADDITIONAL_DRIVERS="$ADDITIONAL_DRIVERS" - - # set up serial console when building a development image - if [ "$DEVEL_VERSION" = "devel" ] ; then - EXTRA_CMDLINE="console=ttyAMA0,115200" - fi diff --git a/projects/RPi/patches/kodi/kodi-002-isengard-rpb-backports.patch b/projects/RPi/patches/kodi/kodi-002-isengard-rpb-backports.patch deleted file mode 100644 index 15013fd768a..00000000000 --- a/projects/RPi/patches/kodi/kodi-002-isengard-rpb-backports.patch +++ /dev/null @@ -1,29 +0,0 @@ -From a68c7ca33ce0a3aa20caf3eb235e11d489e1fd5b Mon Sep 17 00:00:00 2001 -From: popcornmix <popcornmix@gmail.com> -Date: Sun, 11 Oct 2015 20:55:35 +0100 -Subject: [PATCH] Revert "Revert "Disable extra logging by default"" - -This reverts commit a880554325be187b877cd8f0e2b338e7267da636. ---- - system/settings/settings.xml | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/system/settings/settings.xml b/system/settings/settings.xml -index f1cbefa..b1b2ced 100644 ---- a/system/settings/settings.xml -+++ b/system/settings/settings.xml -@@ -2917,12 +2917,12 @@ - </setting> - <setting id="debug.extralogging" type="boolean" label="666" help="36394"> - <level>1</level> -- <default>true</default> -+ <default>false</default> - <control type="toggle" /> - </setting> - <setting id="debug.setextraloglevel" type="list[integer]" parent="debug.extralogging" label="668" help="36534"> - <level>1</level> -- <default>32768</default> -+ <default></default> - <constraints> - <options>loggingcomponents</options> - <delimiter>,</delimiter> diff --git a/projects/RPi/patches/linux/linux-01-RPi_support.patch b/projects/RPi/patches/linux/linux-01-RPi_support.patch index 863e39ebcad..27eeea44d11 100644 --- a/projects/RPi/patches/linux/linux-01-RPi_support.patch +++ b/projects/RPi/patches/linux/linux-01-RPi_support.patch @@ -1,7 +1,104 @@ -From b6cc28abbbf710379772d3da9227ce66926c46a3 Mon Sep 17 00:00:00 2001 +From ca75e975f8f57caa637e9cc52b3ff6feb869b74a Mon Sep 17 00:00:00 2001 +From: popcornmix <popcornmix@gmail.com> +Date: Wed, 27 Apr 2016 17:43:28 +0100 +Subject: [PATCH 001/112] Revert "SUNRPC: Make NFS swap work with multipath" + +This reverts commit 15001e5a7e1e207b6bd258cd8f187814cd15b6dc. +--- + net/sunrpc/clnt.c | 66 +++++++++++++++++++++++++++++++++++-------------------- + 1 file changed, 42 insertions(+), 24 deletions(-) + +diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c +index 7e0c9bf..0693685 100644 +--- a/net/sunrpc/clnt.c ++++ b/net/sunrpc/clnt.c +@@ -2683,39 +2683,57 @@ void rpc_show_tasks(struct net *net) + #endif + + #if IS_ENABLED(CONFIG_SUNRPC_SWAP) +-static int +-rpc_clnt_swap_activate_callback(struct rpc_clnt *clnt, +- struct rpc_xprt *xprt, +- void *dummy) +-{ +- return xprt_enable_swap(xprt); +-} +- + int + rpc_clnt_swap_activate(struct rpc_clnt *clnt) + { +- if (atomic_inc_return(&clnt->cl_swapper) == 1) +- return rpc_clnt_iterate_for_each_xprt(clnt, +- rpc_clnt_swap_activate_callback, NULL); +- return 0; +-} +-EXPORT_SYMBOL_GPL(rpc_clnt_swap_activate); ++ int ret = 0; ++ struct rpc_xprt *xprt; + +-static int +-rpc_clnt_swap_deactivate_callback(struct rpc_clnt *clnt, +- struct rpc_xprt *xprt, +- void *dummy) +-{ +- xprt_disable_swap(xprt); +- return 0; ++ if (atomic_inc_return(&clnt->cl_swapper) == 1) { ++retry: ++ rcu_read_lock(); ++ xprt = xprt_get(rcu_dereference(clnt->cl_xprt)); ++ rcu_read_unlock(); ++ if (!xprt) { ++ /* ++ * If we didn't get a reference, then we likely are ++ * racing with a migration event. Wait for a grace ++ * period and try again. ++ */ ++ synchronize_rcu(); ++ goto retry; ++ } ++ ++ ret = xprt_enable_swap(xprt); ++ xprt_put(xprt); ++ } ++ return ret; + } ++EXPORT_SYMBOL_GPL(rpc_clnt_swap_activate); + + void + rpc_clnt_swap_deactivate(struct rpc_clnt *clnt) + { +- if (atomic_dec_if_positive(&clnt->cl_swapper) == 0) +- rpc_clnt_iterate_for_each_xprt(clnt, +- rpc_clnt_swap_deactivate_callback, NULL); ++ struct rpc_xprt *xprt; ++ ++ if (atomic_dec_if_positive(&clnt->cl_swapper) == 0) { ++retry: ++ rcu_read_lock(); ++ xprt = xprt_get(rcu_dereference(clnt->cl_xprt)); ++ rcu_read_unlock(); ++ if (!xprt) { ++ /* ++ * If we didn't get a reference, then we likely are ++ * racing with a migration event. Wait for a grace ++ * period and try again. ++ */ ++ synchronize_rcu(); ++ goto retry; ++ } ++ ++ xprt_disable_swap(xprt); ++ xprt_put(xprt); ++ } + } + EXPORT_SYMBOL_GPL(rpc_clnt_swap_deactivate); + #endif /* CONFIG_SUNRPC_SWAP */ + +From 7ff74cfdea35caefc11486c463819aa0a559d032 Mon Sep 17 00:00:00 2001 From: Steve Glendinning <steve.glendinning@smsc.com> Date: Thu, 19 Feb 2015 18:47:12 +0000 -Subject: [PATCH 001/170] smsx95xx: fix crimes against truesize +Subject: [PATCH 002/112] smsx95xx: fix crimes against truesize smsc95xx is adjusting truesize when it shouldn't, and following a recent patch from Eric this is now triggering warnings. @@ -9,47 +106,59 @@ This patch stops smsc95xx from changing truesize. Signed-off-by: Steve Glendinning <steve.glendinning@smsc.com> --- - drivers/net/usb/smsc95xx.c | 2 -- - 1 file changed, 2 deletions(-) - mode change 100644 => 100755 drivers/net/usb/smsc95xx.c + drivers/net/usb/smsc95xx.c | 10 ++++++++-- + 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c -old mode 100644 -new mode 100755 -index 66b3ab9..b544181 +index 2edc2bc..2ce8d2b 100644 --- a/drivers/net/usb/smsc95xx.c +++ b/drivers/net/usb/smsc95xx.c -@@ -1785,7 +1785,6 @@ static int smsc95xx_rx_fixup(struct usbnet *dev, struct sk_buff *skb) +@@ -75,6 +75,10 @@ static bool turbo_mode = true; + module_param(turbo_mode, bool, 0644); + MODULE_PARM_DESC(turbo_mode, "Enable multiple frames per Rx transaction"); + ++static bool truesize_mode = false; ++module_param(truesize_mode, bool, 0644); ++MODULE_PARM_DESC(truesize_mode, "Report larger truesize value"); ++ + static int __must_check __smsc95xx_read_reg(struct usbnet *dev, u32 index, + u32 *data, int in_pm) + { +@@ -1795,7 +1799,8 @@ static int smsc95xx_rx_fixup(struct usbnet *dev, struct sk_buff *skb) if (dev->net->features & NETIF_F_RXCSUM) smsc95xx_rx_csum_offload(skb); skb_trim(skb, skb->len - 4); /* remove fcs */ - skb->truesize = size + sizeof(struct sk_buff); ++ if (truesize_mode) ++ skb->truesize = size + sizeof(struct sk_buff); return 1; } -@@ -1803,7 +1802,6 @@ static int smsc95xx_rx_fixup(struct usbnet *dev, struct sk_buff *skb) +@@ -1813,7 +1818,8 @@ static int smsc95xx_rx_fixup(struct usbnet *dev, struct sk_buff *skb) if (dev->net->features & NETIF_F_RXCSUM) smsc95xx_rx_csum_offload(ax_skb); skb_trim(ax_skb, ax_skb->len - 4); /* remove fcs */ - ax_skb->truesize = size + sizeof(struct sk_buff); ++ if (truesize_mode) ++ ax_skb->truesize = size + sizeof(struct sk_buff); usbnet_skb_return(dev, ax_skb); } -From 37e24d2f0af32632a17692076dddcf176d1af1f7 Mon Sep 17 00:00:00 2001 +From 1772115b52b325a46fafc57611663584bc9aef41 Mon Sep 17 00:00:00 2001 From: popcornmix <popcornmix@gmail.com> Date: Fri, 17 Apr 2015 16:58:45 +0100 -Subject: [PATCH 002/170] smsc95xx: Disable turbo mode by default +Subject: [PATCH 003/112] smsc95xx: Disable turbo mode by default --- drivers/net/usb/smsc95xx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c -index b544181..9c0da18 100755 +index 2ce8d2b..35ebf75 100644 --- a/drivers/net/usb/smsc95xx.c +++ b/drivers/net/usb/smsc95xx.c -@@ -70,7 +70,7 @@ struct smsc95xx_priv { +@@ -71,7 +71,7 @@ struct smsc95xx_priv { u8 suspend_flags; }; @@ -59,10 +168,246 @@ index b544181..9c0da18 100755 MODULE_PARM_DESC(turbo_mode, "Enable multiple frames per Rx transaction"); -From d5cb475205138f9df1fdbb74d8810ab1928696ea Mon Sep 17 00:00:00 2001 +From 0174c345e5904dd88065c5512082f92e5bac390c Mon Sep 17 00:00:00 2001 +From: Sam Nazarko <email@samnazarko.co.uk> +Date: Fri, 1 Apr 2016 17:27:21 +0100 +Subject: [PATCH 004/112] add smsc95xx packetsize module_param + +Signed-off-by: Sam Nazarko <email@samnazarko.co.uk> +--- + drivers/net/usb/smsc95xx.c | 14 +++++++++----- + 1 file changed, 9 insertions(+), 5 deletions(-) + +diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c +index 35ebf75..3cac3c9 100644 +--- a/drivers/net/usb/smsc95xx.c ++++ b/drivers/net/usb/smsc95xx.c +@@ -79,6 +79,10 @@ static bool truesize_mode = false; + module_param(truesize_mode, bool, 0644); + MODULE_PARM_DESC(truesize_mode, "Report larger truesize value"); + ++static int packetsize = 0; ++module_param(packetsize, int, 0644); ++MODULE_PARM_DESC(packetsize, "Override the RX URB packet size"); ++ + static int __must_check __smsc95xx_read_reg(struct usbnet *dev, u32 index, + u32 *data, int in_pm) + { +@@ -960,13 +964,13 @@ static int smsc95xx_reset(struct usbnet *dev) + + if (!turbo_mode) { + burst_cap = 0; +- dev->rx_urb_size = MAX_SINGLE_PACKET_SIZE; ++ dev->rx_urb_size = packetsize ? packetsize : MAX_SINGLE_PACKET_SIZE; + } else if (dev->udev->speed == USB_SPEED_HIGH) { +- burst_cap = DEFAULT_HS_BURST_CAP_SIZE / HS_USB_PKT_SIZE; +- dev->rx_urb_size = DEFAULT_HS_BURST_CAP_SIZE; ++ dev->rx_urb_size = packetsize ? packetsize : DEFAULT_HS_BURST_CAP_SIZE; ++ burst_cap = dev->rx_urb_size / HS_USB_PKT_SIZE; + } else { +- burst_cap = DEFAULT_FS_BURST_CAP_SIZE / FS_USB_PKT_SIZE; +- dev->rx_urb_size = DEFAULT_FS_BURST_CAP_SIZE; ++ dev->rx_urb_size = packetsize ? packetsize : DEFAULT_FS_BURST_CAP_SIZE; ++ burst_cap = dev->rx_urb_size / FS_USB_PKT_SIZE; + } + + netif_dbg(dev, ifup, dev->net, "rx_urb_size=%ld\n", + +From be730bbaaddeb27448477933ffc1ddf37491c897 Mon Sep 17 00:00:00 2001 +From: popcornmix <popcornmix@gmail.com> +Date: Tue, 26 Mar 2013 17:26:38 +0000 +Subject: [PATCH 005/112] Allow mac address to be set in smsc95xx + +Signed-off-by: popcornmix <popcornmix@gmail.com> +--- + drivers/net/usb/smsc95xx.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 56 insertions(+) + +diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c +index 3cac3c9..d9bdc74 100644 +--- a/drivers/net/usb/smsc95xx.c ++++ b/drivers/net/usb/smsc95xx.c +@@ -60,6 +60,7 @@ + #define SUSPEND_SUSPEND3 (0x08) + #define SUSPEND_ALLMODES (SUSPEND_SUSPEND0 | SUSPEND_SUSPEND1 | \ + SUSPEND_SUSPEND2 | SUSPEND_SUSPEND3) ++#define MAC_ADDR_LEN (6) + + struct smsc95xx_priv { + u32 mac_cr; +@@ -83,6 +84,10 @@ static int packetsize = 0; + module_param(packetsize, int, 0644); + MODULE_PARM_DESC(packetsize, "Override the RX URB packet size"); + ++static char *macaddr = ":"; ++module_param(macaddr, charp, 0); ++MODULE_PARM_DESC(macaddr, "MAC address"); ++ + static int __must_check __smsc95xx_read_reg(struct usbnet *dev, u32 index, + u32 *data, int in_pm) + { +@@ -772,6 +777,53 @@ static int smsc95xx_ioctl(struct net_device *netdev, struct ifreq *rq, int cmd) + return generic_mii_ioctl(&dev->mii, if_mii(rq), cmd, NULL); + } + ++/* Check the macaddr module parameter for a MAC address */ ++static int smsc95xx_is_macaddr_param(struct usbnet *dev, u8 *dev_mac) ++{ ++ int i, j, got_num, num; ++ u8 mtbl[MAC_ADDR_LEN]; ++ ++ if (macaddr[0] == ':') ++ return 0; ++ ++ i = 0; ++ j = 0; ++ num = 0; ++ got_num = 0; ++ while (j < MAC_ADDR_LEN) { ++ if (macaddr[i] && macaddr[i] != ':') { ++ got_num++; ++ if ('0' <= macaddr[i] && macaddr[i] <= '9') ++ num = num * 16 + macaddr[i] - '0'; ++ else if ('A' <= macaddr[i] && macaddr[i] <= 'F') ++ num = num * 16 + 10 + macaddr[i] - 'A'; ++ else if ('a' <= macaddr[i] && macaddr[i] <= 'f') ++ num = num * 16 + 10 + macaddr[i] - 'a'; ++ else ++ break; ++ i++; ++ } else if (got_num == 2) { ++ mtbl[j++] = (u8) num; ++ num = 0; ++ got_num = 0; ++ i++; ++ } else { ++ break; ++ } ++ } ++ ++ if (j == MAC_ADDR_LEN) { ++ netif_dbg(dev, ifup, dev->net, "Overriding MAC address with: " ++ "%02x:%02x:%02x:%02x:%02x:%02x\n", mtbl[0], mtbl[1], mtbl[2], ++ mtbl[3], mtbl[4], mtbl[5]); ++ for (i = 0; i < MAC_ADDR_LEN; i++) ++ dev_mac[i] = mtbl[i]; ++ return 1; ++ } else { ++ return 0; ++ } ++} ++ + static void smsc95xx_init_mac_address(struct usbnet *dev) + { + const u8 *mac_addr; +@@ -793,6 +845,10 @@ static void smsc95xx_init_mac_address(struct usbnet *dev) + } + } + ++ /* Check module parameters */ ++ if (smsc95xx_is_macaddr_param(dev, dev->net->dev_addr)) ++ return; ++ + /* no useful static MAC address found. generate a random one */ + eth_hw_addr_random(dev->net); + netif_dbg(dev, ifup, dev->net, "MAC address set to eth_random_addr\n"); + +From 2f4a1d4938769ec3951b779bb607a841d6abdf7b Mon Sep 17 00:00:00 2001 +From: Nicolas Boullis <nboullis@debian.org> +Date: Sun, 10 Apr 2016 13:23:05 +0200 +Subject: [PATCH 006/112] rtc: ds1307: ensure that any pending alarm is cleared + before a new alarm is enabled +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +If a previously-set alarm was disabled and then triggered, it may still +be pending when a new alarm is configured. + +Then, if the alarm is enabled before the pending alarm is cleared, then +an interrupt is immediately raised. + +Unfortunately, when the alarm is cleared and enabled during the same I²C +block write, the chip (at least the DS1339 I have) considers that the +alarm is enabled before it is cleared, and raises an interrupt. + +This patch ensures that the pending alarm is cleared before the alarm is +enabled. + +Signed-off-by: Nicolas Boullis <nboullis@debian.org> +Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com> +--- + drivers/rtc/rtc-ds1307.c | 13 ++++++++----- + 1 file changed, 8 insertions(+), 5 deletions(-) + +diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c +index ecb7dba..e94eb09 100644 +--- a/drivers/rtc/rtc-ds1307.c ++++ b/drivers/rtc/rtc-ds1307.c +@@ -538,12 +538,8 @@ static int ds1337_set_alarm(struct device *dev, struct rtc_wkalrm *t) + buf[5] = 0; + buf[6] = 0; + +- /* optionally enable ALARM1 */ ++ /* disable alarms */ + buf[7] = control & ~(DS1337_BIT_A1IE | DS1337_BIT_A2IE); +- if (t->enabled) { +- dev_dbg(dev, "alarm IRQ armed\n"); +- buf[7] |= DS1337_BIT_A1IE; /* only ALARM1 is used */ +- } + buf[8] = status & ~(DS1337_BIT_A1I | DS1337_BIT_A2I); + + ret = ds1307->write_block_data(client, +@@ -553,6 +549,13 @@ static int ds1337_set_alarm(struct device *dev, struct rtc_wkalrm *t) + return ret; + } + ++ /* optionally enable ALARM1 */ ++ if (t->enabled) { ++ dev_dbg(dev, "alarm IRQ armed\n"); ++ buf[7] |= DS1337_BIT_A1IE; /* only ALARM1 is used */ ++ i2c_smbus_write_byte_data(client, DS1337_REG_CONTROL, buf[7]); ++ } ++ + return 0; + } + + +From c28f0cf7c000000c6af92915e49b11b3a0b5db55 Mon Sep 17 00:00:00 2001 +From: Phil Elwell <phil@raspberrypi.org> +Date: Wed, 9 Mar 2016 13:28:24 +0000 +Subject: [PATCH 007/112] serial: Take care starting a hung-up tty's port + +tty_port_hangup sets a port's tty field to NULL (holding the port lock), +but uart_tx_stopped, called from __uart_start (with the port lock), +uses the tty field without checking for NULL. + +Change uart_tx_stopped to treat a NULL tty field as another stopped +indication. + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> +--- + include/linux/serial_core.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h +index cbfcf38..96bc15a 100644 +--- a/include/linux/serial_core.h ++++ b/include/linux/serial_core.h +@@ -403,7 +403,7 @@ int uart_resume_port(struct uart_driver *reg, struct uart_port *port); + static inline int uart_tx_stopped(struct uart_port *port) + { + struct tty_struct *tty = port->state->port.tty; +- if (tty->stopped || port->hw_stopped) ++ if (!tty || tty->stopped || port->hw_stopped) + return 1; + return 0; + } + +From c6d7c03c674161544d9cb391acc3bbf18bc3ac95 Mon Sep 17 00:00:00 2001 From: popcornmix <popcornmix@gmail.com> Date: Wed, 18 Jun 2014 13:42:01 +0100 -Subject: [PATCH 003/170] vmstat: Workaround for issue where dirty page count +Subject: [PATCH 008/112] vmstat: Workaround for issue where dirty page count goes negative See: @@ -73,10 +418,10 @@ http://www.spinics.net/lists/linux-mm/msg72236.html 1 file changed, 4 insertions(+) diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h -index 3e5d907..2539068 100644 +index 73fae8c..5dd1278 100644 --- a/include/linux/vmstat.h +++ b/include/linux/vmstat.h -@@ -219,7 +219,11 @@ static inline void __inc_zone_state(struct zone *zone, enum zone_stat_item item) +@@ -220,7 +220,11 @@ static inline void __inc_zone_state(struct zone *zone, enum zone_stat_item item) static inline void __dec_zone_state(struct zone *zone, enum zone_stat_item item) { atomic_long_dec(&zone->vm_stat[item]); @@ -89,16 +434,74 @@ index 3e5d907..2539068 100644 static inline void __inc_zone_page_state(struct page *page, -From 249a499b1d4b6f8a57b3377d4f505841e99f60c8 Mon Sep 17 00:00:00 2001 +From 31b90174e46b5e1eb81aa8c29e7f42fdf6c74f2b Mon Sep 17 00:00:00 2001 +From: Phil Elwell <phil@raspberrypi.org> +Date: Fri, 13 Mar 2015 12:43:36 +0000 +Subject: [PATCH 009/112] Protect __release_resource against resources without + parents + +Without this patch, removing a device tree overlay can crash here. + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> +--- + kernel/resource.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/kernel/resource.c b/kernel/resource.c +index 9b5f044..f8a9af6 100644 +--- a/kernel/resource.c ++++ b/kernel/resource.c +@@ -246,6 +246,12 @@ static int __release_resource(struct resource *old, bool release_child) + { + struct resource *tmp, **p, *chd; + ++ if (!old->parent) { ++ WARN(old->sibling, "sibling but no parent"); ++ if (old->sibling) ++ return -EINVAL; ++ return 0; ++ } + p = &old->parent->child; + for (;;) { + tmp = *p; + +From 40f5929ab19a370adb498aa3249ca28942127d9b Mon Sep 17 00:00:00 2001 +From: Eric Anholt <eric@anholt.net> +Date: Thu, 18 Dec 2014 16:07:15 -0800 +Subject: [PATCH 010/112] mm: Remove the PFN busy warning + +See commit dae803e165a11bc88ca8dbc07a11077caf97bbcb -- the warning is +expected sometimes when using CMA. However, that commit still spams +my kernel log with these warnings. + +Signed-off-by: Eric Anholt <eric@anholt.net> +--- + mm/page_alloc.c | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/mm/page_alloc.c b/mm/page_alloc.c +index c1069ef..fe21be6 100644 +--- a/mm/page_alloc.c ++++ b/mm/page_alloc.c +@@ -7101,8 +7101,6 @@ int alloc_contig_range(unsigned long start, unsigned long end, + + /* Make sure the range is really isolated. */ + if (test_pages_isolated(outer_start, end, false)) { +- pr_info("%s: [%lx, %lx) PFNs busy\n", +- __func__, outer_start, end); + ret = -EBUSY; + goto done; + } + +From d7c3a06d1bace2ac531e73c63b5fa08117ed7826 Mon Sep 17 00:00:00 2001 From: Robert Tiemann <rtie@gmx.de> Date: Mon, 20 Jul 2015 11:01:25 +0200 -Subject: [PATCH 004/170] BCM2835_DT: Fix I2S register map +Subject: [PATCH 011/112] BCM2835_DT: Fix I2S register map --- Documentation/devicetree/bindings/dma/brcm,bcm2835-dma.txt | 4 ++-- Documentation/devicetree/bindings/sound/brcm,bcm2835-i2s.txt | 4 ++-- - arch/arm/boot/dts/bcm2835.dtsi | 4 ++-- - 3 files changed, 6 insertions(+), 6 deletions(-) + 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Documentation/devicetree/bindings/dma/brcm,bcm2835-dma.txt b/Documentation/devicetree/bindings/dma/brcm,bcm2835-dma.txt index 1396078..2db8294 100644 @@ -130,26 +533,11 @@ index 65783de..a89fe42 100644 dmas = <&dma 2>, <&dma 3>; -diff --git a/arch/arm/boot/dts/bcm2835.dtsi b/arch/arm/boot/dts/bcm2835.dtsi -index aef64de..864a3ef 100644 ---- a/arch/arm/boot/dts/bcm2835.dtsi -+++ b/arch/arm/boot/dts/bcm2835.dtsi -@@ -120,8 +120,8 @@ - - i2s: i2s@7e203000 { - compatible = "brcm,bcm2835-i2s"; -- reg = <0x7e203000 0x20>, -- <0x7e101098 0x02>; -+ reg = <0x7e203000 0x24>, -+ <0x7e101098 0x08>; - - dmas = <&dma 2>, - <&dma 3>; -From c24657505a2aac71d0409b0ef703fc21ecab4b2e Mon Sep 17 00:00:00 2001 +From 4c752b5cd3a5486b9fcba5d591175e5b742cfbef Mon Sep 17 00:00:00 2001 From: Phil Elwell <phil@raspberrypi.org> Date: Fri, 4 Dec 2015 17:41:50 +0000 -Subject: [PATCH 005/170] irq-bcm2836: Prevent spurious interrupts, and trap +Subject: [PATCH 012/112] irq-bcm2836: Prevent spurious interrupts, and trap them early The old arch-specific IRQ macros included a dsb to ensure the @@ -160,30 +548,26 @@ precaution to avoid spurious interrupts. Spurious interrupts are still possible for other reasons, though, so trap them early. --- - drivers/irqchip/irq-bcm2836.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) + drivers/irqchip/irq-bcm2836.c | 1 + + 1 file changed, 1 insertion(+) diff --git a/drivers/irqchip/irq-bcm2836.c b/drivers/irqchip/irq-bcm2836.c -index f687082..4cd8ebe 100644 +index b6e950d..bbb92c2 100644 --- a/drivers/irqchip/irq-bcm2836.c +++ b/drivers/irqchip/irq-bcm2836.c -@@ -170,9 +170,10 @@ __exception_irq_entry bcm2836_arm_irqchip_handle_irq(struct pt_regs *regs) +@@ -175,6 +175,7 @@ __exception_irq_entry bcm2836_arm_irqchip_handle_irq(struct pt_regs *regs) u32 ipi = ffs(mbox_val) - 1; writel(1 << ipi, mailbox0); + dsb(); handle_IPI(ipi, regs); #endif -- } else { -+ } else if (stat) { - u32 hwirq = ffs(stat) - 1; - - handle_IRQ(irq_linear_revmap(intc.domain, hwirq), regs); + } else if (stat) { -From 229bcf2e73ce37e8a18d68773471024c848d84bd Mon Sep 17 00:00:00 2001 +From 035dd0ae04e88afb2133082dce4c15527f5fb0ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= <noralf@tronnes.org> Date: Fri, 12 Jun 2015 19:01:05 +0200 -Subject: [PATCH 006/170] irqchip: bcm2835: Add FIQ support +Subject: [PATCH 013/112] irqchip: bcm2835: Add FIQ support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -201,12 +585,12 @@ Acked-by: Stephen Warren <swarren@wwwdotorg.org> 2 files changed, 47 insertions(+), 5 deletions(-) diff --git a/arch/arm/mach-bcm/Kconfig b/arch/arm/mach-bcm/Kconfig -index 8c53c55..c943747b 100644 +index 7ef1214..b1a5a7b 100644 --- a/arch/arm/mach-bcm/Kconfig +++ b/arch/arm/mach-bcm/Kconfig -@@ -128,6 +128,7 @@ config ARCH_BCM2835 - select ARM_ERRATA_411920 +@@ -143,6 +143,7 @@ config ARCH_BCM2835 select ARM_TIMER_SP804 + select HAVE_ARM_ARCH_TIMER if ARCH_MULTI_V7 select CLKSRC_OF + select FIQ select PINCTRL @@ -312,10 +696,10 @@ index bf9cc5f..3f601f9 100644 } -From 6780f0a5c6af19f2b9850e961a0f81fbfdfa48fe Mon Sep 17 00:00:00 2001 +From bfbf2463f40ebf7f80ce73ad7b15ea4ca2e446a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= <noralf@tronnes.org> Date: Fri, 23 Oct 2015 16:26:55 +0200 -Subject: [PATCH 007/170] irqchip: irq-bcm2835: Add 2836 FIQ support +Subject: [PATCH 014/112] irqchip: irq-bcm2835: Add 2836 FIQ support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -411,17 +795,41 @@ index 3f601f9..20deb28 100644 for (b = 0; b < NR_BANKS; b++) { for (i = 0; i < bank_irqs[b]; i++) { -From 4b9529b98c01569dff06f4e67ba28a47318e5ea5 Mon Sep 17 00:00:00 2001 +From 18707aacc4b3f082193c87f86edfaeaeed90f56a Mon Sep 17 00:00:00 2001 +From: Phil Elwell <phil@raspberrypi.org> +Date: Tue, 14 Jul 2015 10:26:09 +0100 +Subject: [PATCH 015/112] spidev: Add "spidev" compatible string to silence + warning + +See: https://github.com/raspberrypi/linux/issues/1054 +--- + drivers/spi/spidev.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c +index e3c19f3..f4963e3 100644 +--- a/drivers/spi/spidev.c ++++ b/drivers/spi/spidev.c +@@ -695,6 +695,7 @@ static struct class *spidev_class; + static const struct of_device_id spidev_dt_ids[] = { + { .compatible = "rohm,dh2228fv" }, + { .compatible = "lineartechnology,ltc2488" }, ++ { .compatible = "spidev" }, + {}, + }; + MODULE_DEVICE_TABLE(of, spidev_dt_ids); + +From 9a451703f2138a4c8543033879948e3e167a0c26 Mon Sep 17 00:00:00 2001 From: Phil Elwell <phil@raspberrypi.org> Date: Tue, 30 Jun 2015 14:12:42 +0100 -Subject: [PATCH 008/170] serial: 8250: Don't crash when nr_uarts is 0 +Subject: [PATCH 016/112] serial: 8250: Don't crash when nr_uarts is 0 --- drivers/tty/serial/8250/8250_core.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c -index 3912646..b51a59c 100644 +index 2f4f5ee..edc1355 100644 --- a/drivers/tty/serial/8250/8250_core.c +++ b/drivers/tty/serial/8250/8250_core.c @@ -509,6 +509,8 @@ static void __init serial8250_isa_init_ports(void) @@ -434,10 +842,10 @@ index 3912646..b51a59c 100644 for (i = 0; i < nr_uarts; i++) { struct uart_8250_port *up = &serial8250_ports[i]; -From 5fd6ab82b1027504faa66cf4fc8b999fafaacd12 Mon Sep 17 00:00:00 2001 +From 888e562b188603c0fd16585155bb5393bd1a5704 Mon Sep 17 00:00:00 2001 From: notro <notro@tronnes.org> Date: Thu, 10 Jul 2014 13:59:47 +0200 -Subject: [PATCH 009/170] pinctrl-bcm2835: Set base to 0 give expected gpio +Subject: [PATCH 017/112] pinctrl-bcm2835: Set base to 0 give expected gpio numbering Signed-off-by: Noralf Tronnes <notro@tronnes.org> @@ -446,7 +854,7 @@ Signed-off-by: Noralf Tronnes <notro@tronnes.org> 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pinctrl/bcm/pinctrl-bcm2835.c b/drivers/pinctrl/bcm/pinctrl-bcm2835.c -index 2e6ca69..62cc363 100644 +index 08b1d93..0a23c81 100644 --- a/drivers/pinctrl/bcm/pinctrl-bcm2835.c +++ b/drivers/pinctrl/bcm/pinctrl-bcm2835.c @@ -373,7 +373,7 @@ static struct gpio_chip bcm2835_gpio_chip = { @@ -459,10 +867,10 @@ index 2e6ca69..62cc363 100644 .can_sleep = false, }; -From 4254ef2647e89061427836443eac60351b3306a7 Mon Sep 17 00:00:00 2001 +From 44235a003f98fa50a4a03958bc6f224675dd1aea Mon Sep 17 00:00:00 2001 From: Phil Elwell <phil@raspberrypi.org> Date: Tue, 24 Feb 2015 13:40:50 +0000 -Subject: [PATCH 010/170] pinctrl-bcm2835: Fix interrupt handling for GPIOs +Subject: [PATCH 018/112] pinctrl-bcm2835: Fix interrupt handling for GPIOs 28-31 and 46-53 Contrary to the documentation, the BCM2835 GPIO controller actually has @@ -483,7 +891,7 @@ the pins are often used for I2S instead. 1 file changed, 39 insertions(+), 12 deletions(-) diff --git a/drivers/pinctrl/bcm/pinctrl-bcm2835.c b/drivers/pinctrl/bcm/pinctrl-bcm2835.c -index 62cc363..ab345f4 100644 +index 0a23c81..b793bbd 100644 --- a/drivers/pinctrl/bcm/pinctrl-bcm2835.c +++ b/drivers/pinctrl/bcm/pinctrl-bcm2835.c @@ -47,6 +47,7 @@ @@ -608,10 +1016,10 @@ index 62cc363..ab345f4 100644 }, }; -From 93b12e64d0e2a8a65189dedd667e00b0a0fab60a Mon Sep 17 00:00:00 2001 +From 338386be825f60aefee3d3613778b6233d3759b3 Mon Sep 17 00:00:00 2001 From: Phil Elwell <phil@raspberrypi.org> Date: Thu, 26 Feb 2015 09:58:22 +0000 -Subject: [PATCH 011/170] pinctrl-bcm2835: Only request the interrupts listed +Subject: [PATCH 019/112] pinctrl-bcm2835: Only request the interrupts listed in the DTB Although the GPIO controller can generate three interrupts (four counting @@ -625,7 +1033,7 @@ interface, is unlikely to be a problem. 1 file changed, 2 insertions(+) diff --git a/drivers/pinctrl/bcm/pinctrl-bcm2835.c b/drivers/pinctrl/bcm/pinctrl-bcm2835.c -index ab345f4..640e3b0 100644 +index b793bbd..8683a1b 100644 --- a/drivers/pinctrl/bcm/pinctrl-bcm2835.c +++ b/drivers/pinctrl/bcm/pinctrl-bcm2835.c @@ -1029,6 +1029,8 @@ static int bcm2835_pinctrl_probe(struct platform_device *pdev) @@ -638,10 +1046,54 @@ index ab345f4..640e3b0 100644 pc->irq_data[i].irqgroup = i; -From bb8ff388ad26721eebb7249afb6f6f57bc196de4 Mon Sep 17 00:00:00 2001 +From 74dbec2e38b6b8b6fb046a161cc86b835eadbde4 Mon Sep 17 00:00:00 2001 +From: Phil Elwell <phil@raspberrypi.org> +Date: Fri, 6 May 2016 12:32:47 +0100 +Subject: [PATCH 020/112] pinctrl-bcm2835: Return pins to inputs when freed + +When dynamically unloading overlays, it is important that freed pins are +restored to being inputs to prevent functions from being enabled in +multiple places at once. + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> +--- + drivers/pinctrl/bcm/pinctrl-bcm2835.c | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/drivers/pinctrl/bcm/pinctrl-bcm2835.c b/drivers/pinctrl/bcm/pinctrl-bcm2835.c +index 8683a1b..6327122 100644 +--- a/drivers/pinctrl/bcm/pinctrl-bcm2835.c ++++ b/drivers/pinctrl/bcm/pinctrl-bcm2835.c +@@ -831,6 +831,16 @@ static const struct pinctrl_ops bcm2835_pctl_ops = { + .dt_free_map = bcm2835_pctl_dt_free_map, + }; + ++static int bcm2835_pmx_free(struct pinctrl_dev *pctldev, ++ unsigned offset) ++{ ++ struct bcm2835_pinctrl *pc = pinctrl_dev_get_drvdata(pctldev); ++ ++ /* disable by setting to GPIO_IN */ ++ bcm2835_pinctrl_fsel_set(pc, offset, BCM2835_FSEL_GPIO_IN); ++ return 0; ++} ++ + static int bcm2835_pmx_get_functions_count(struct pinctrl_dev *pctldev) + { + return BCM2835_FSEL_COUNT; +@@ -890,6 +900,7 @@ static int bcm2835_pmx_gpio_set_direction(struct pinctrl_dev *pctldev, + } + + static const struct pinmux_ops bcm2835_pmx_ops = { ++ .free = bcm2835_pmx_free, + .get_functions_count = bcm2835_pmx_get_functions_count, + .get_function_name = bcm2835_pmx_get_function_name, + .get_function_groups = bcm2835_pmx_get_function_groups, + +From 1dc43cf973493169b270cba5302c4cbbdf940a3f Mon Sep 17 00:00:00 2001 From: Phil Elwell <phil@raspberrypi.org> Date: Wed, 24 Jun 2015 14:10:44 +0100 -Subject: [PATCH 012/170] spi-bcm2835: Support pin groups other than 7-11 +Subject: [PATCH 021/112] spi-bcm2835: Support pin groups other than 7-11 The spi-bcm2835 driver automatically uses GPIO chip-selects due to some unreliability of the native ones. In doing so it chooses the @@ -658,7 +1110,7 @@ Signed-off-by: Phil Elwell <phil@raspberrypi.org> 1 file changed, 37 insertions(+), 8 deletions(-) diff --git a/drivers/spi/spi-bcm2835.c b/drivers/spi/spi-bcm2835.c -index cf04960..a2b1f45 100644 +index f35cc10..5dfe20f 100644 --- a/drivers/spi/spi-bcm2835.c +++ b/drivers/spi/spi-bcm2835.c @@ -688,6 +688,8 @@ static int bcm2835_spi_setup(struct spi_device *spi) @@ -722,10 +1174,10 @@ index cf04960..a2b1f45 100644 /* and set up the "mode" and level */ dev_info(&spi->dev, "setting up native-CS%i as GPIO %i\n", -From bfcfed788d152e828747ea889a88f8b179217ddb Mon Sep 17 00:00:00 2001 +From fa44a350bfe28a2ee33e460c4710036241db1054 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= <noralf@tronnes.org> Date: Wed, 3 Jun 2015 12:26:13 +0200 -Subject: [PATCH 013/170] ARM: bcm2835: Set Serial number and Revision +Subject: [PATCH 022/112] ARM: bcm2835: Set Serial number and Revision MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -750,7 +1202,7 @@ Signed-off-by: Noralf Trønnes <noralf@tronnes.org> 1 file changed, 9 insertions(+) diff --git a/arch/arm/mach-bcm/board_bcm2835.c b/arch/arm/mach-bcm/board_bcm2835.c -index 0f7b9ea..1e6f1cf9 100644 +index 834d676..3b68a8d 100644 --- a/arch/arm/mach-bcm/board_bcm2835.c +++ b/arch/arm/mach-bcm/board_bcm2835.c @@ -17,12 +17,16 @@ @@ -783,370 +1235,10 @@ index 0f7b9ea..1e6f1cf9 100644 static const char * const bcm2835_compat[] = { -From fb968a02c00e2722df2dcfec6f54b7524ff5a155 Mon Sep 17 00:00:00 2001 -From: Matthias Reichl <hias@horus.com> -Date: Sun, 11 Oct 2015 16:44:05 +0200 -Subject: [PATCH 014/170] bcm2835-i2s: get base address for DMA from devicetree - -Code copied from spi-bcm2835. Get physical address from devicetree -instead of using hardcoded constant. - -Signed-off-by: Matthias Reichl <hias@horus.com> ---- - sound/soc/bcm/bcm2835-i2s.c | 20 ++++++++++++-------- - 1 file changed, 12 insertions(+), 8 deletions(-) - -diff --git a/sound/soc/bcm/bcm2835-i2s.c b/sound/soc/bcm/bcm2835-i2s.c -index 8c435be..0bc4f47 100644 ---- a/sound/soc/bcm/bcm2835-i2s.c -+++ b/sound/soc/bcm/bcm2835-i2s.c -@@ -38,6 +38,7 @@ - #include <linux/delay.h> - #include <linux/io.h> - #include <linux/clk.h> -+#include <linux/of_address.h> - - #include <sound/core.h> - #include <sound/pcm.h> -@@ -158,10 +159,6 @@ static const unsigned int bcm2835_clk_freq[BCM2835_CLK_SRC_HDMI+1] = { - #define BCM2835_I2S_INT_RXR BIT(1) - #define BCM2835_I2S_INT_TXW BIT(0) - --/* I2S DMA interface */ --/* FIXME: Needs IOMMU support */ --#define BCM2835_VCMMU_SHIFT (0x7E000000 - 0x20000000) -- - /* General device struct */ - struct bcm2835_i2s_dev { - struct device *dev; -@@ -791,6 +788,15 @@ static int bcm2835_i2s_probe(struct platform_device *pdev) - int ret; - struct regmap *regmap[2]; - struct resource *mem[2]; -+ const __be32 *addr; -+ dma_addr_t dma_reg_base; -+ -+ addr = of_get_address(pdev->dev.of_node, 0, NULL, NULL); -+ if (!addr) { -+ dev_err(&pdev->dev, "could not get DMA-register address\n"); -+ return -ENODEV; -+ } -+ dma_reg_base = be32_to_cpup(addr); - - /* Request both ioareas */ - for (i = 0; i <= 1; i++) { -@@ -817,12 +823,10 @@ static int bcm2835_i2s_probe(struct platform_device *pdev) - - /* Set the DMA address */ - dev->dma_data[SNDRV_PCM_STREAM_PLAYBACK].addr = -- (dma_addr_t)mem[0]->start + BCM2835_I2S_FIFO_A_REG -- + BCM2835_VCMMU_SHIFT; -+ dma_reg_base + BCM2835_I2S_FIFO_A_REG; - - dev->dma_data[SNDRV_PCM_STREAM_CAPTURE].addr = -- (dma_addr_t)mem[0]->start + BCM2835_I2S_FIFO_A_REG -- + BCM2835_VCMMU_SHIFT; -+ dma_reg_base + BCM2835_I2S_FIFO_A_REG; - - /* Set the bus width */ - dev->dma_data[SNDRV_PCM_STREAM_PLAYBACK].addr_width = - -From abbe565abfe075b76e01b9671c6fc4cf42cc0328 Mon Sep 17 00:00:00 2001 -From: Matthias Reichl <hias@horus.com> -Date: Sun, 11 Oct 2015 15:21:16 +0200 -Subject: [PATCH 015/170] bcm2835-i2s: add 24bit support, update bclk_ratio to - more correct values - -Code ported from bcm2708-i2s driver in Raspberry Pi tree. - -RPi commit 62c05a0b5328d9376d39c9e74da10b8a2465c234 ("ASoC: BCM2708: -Add 24 bit support") - -This adds 24 bit support to the I2S driver of the BCM2708. -Besides enabling the 24 bit flags, it includes two bug fixes: - -MMAP is not supported. Claiming this leads to strange issues -when the format of driver and file do not match. - -The datasheet states that the width extension bit should be set -for widths greater than 24, but greater or equal would be correct. -This follows from the definition of the width field. - -Signed-off-by: Florian Meier <florian.meier@koalo.de> - -RPi commit 3e8c672bc4e92d457aa4654bbb4cfd79a18a2327 ("bcm2708-i2s: -Update bclk_ratio to more correct values") - -Discussion about blck_ratio affecting sound quality: -https://github.com/raspberrypi/linux/issues/681 - -Signed-off-by: Matthias Reichl <hias@horus.com> ---- - sound/soc/bcm/bcm2835-i2s.c | 12 +++++++++--- - 1 file changed, 9 insertions(+), 3 deletions(-) - -diff --git a/sound/soc/bcm/bcm2835-i2s.c b/sound/soc/bcm/bcm2835-i2s.c -index 0bc4f47..cf60390 100644 ---- a/sound/soc/bcm/bcm2835-i2s.c -+++ b/sound/soc/bcm/bcm2835-i2s.c -@@ -340,11 +340,15 @@ static int bcm2835_i2s_hw_params(struct snd_pcm_substream *substream, - switch (params_format(params)) { - case SNDRV_PCM_FORMAT_S16_LE: - data_length = 16; -- bclk_ratio = 40; -+ bclk_ratio = 50; -+ break; -+ case SNDRV_PCM_FORMAT_S24_LE: -+ data_length = 24; -+ bclk_ratio = 50; - break; - case SNDRV_PCM_FORMAT_S32_LE: - data_length = 32; -- bclk_ratio = 80; -+ bclk_ratio = 100; - break; - default: - return -EINVAL; -@@ -420,7 +424,7 @@ static int bcm2835_i2s_hw_params(struct snd_pcm_substream *substream, - /* Setup the frame format */ - format = BCM2835_I2S_CHEN; - -- if (data_length > 24) -+ if (data_length >= 24) - format |= BCM2835_I2S_CHWEX; - - format |= BCM2835_I2S_CHWID((data_length-8)&0xf); -@@ -711,6 +715,7 @@ static struct snd_soc_dai_driver bcm2835_i2s_dai = { - .channels_max = 2, - .rates = SNDRV_PCM_RATE_8000_192000, - .formats = SNDRV_PCM_FMTBIT_S16_LE -+ | SNDRV_PCM_FMTBIT_S24_LE - | SNDRV_PCM_FMTBIT_S32_LE - }, - .capture = { -@@ -718,6 +723,7 @@ static struct snd_soc_dai_driver bcm2835_i2s_dai = { - .channels_max = 2, - .rates = SNDRV_PCM_RATE_8000_192000, - .formats = SNDRV_PCM_FMTBIT_S16_LE -+ | SNDRV_PCM_FMTBIT_S24_LE - | SNDRV_PCM_FMTBIT_S32_LE - }, - .ops = &bcm2835_i2s_dai_ops, - -From b2cc62cd13099d6d2f21b9927df248aa3bdd8d5b Mon Sep 17 00:00:00 2001 -From: Matthias Reichl <hias@horus.com> -Date: Sun, 11 Oct 2015 15:25:51 +0200 -Subject: [PATCH 016/170] bcm2835-i2s: setup clock only if CPU is clock master - -Code ported from bcm2708-i2s driver in Raspberry Pi tree. - -RPi commit c14827ecdaa36607f6110f9ce8df96e698672191 ("bcm2708: Allow -option card devices to be configured via DT") - -Original work by Zoltan Szenczi, committed to RPi tree by -Phil Elwell. - -Signed-off-by: Matthias Reichl <hias@horus.com> ---- - sound/soc/bcm/bcm2835-i2s.c | 28 +++++++++++++++++++--------- - 1 file changed, 19 insertions(+), 9 deletions(-) - -diff --git a/sound/soc/bcm/bcm2835-i2s.c b/sound/soc/bcm/bcm2835-i2s.c -index cf60390..4ac4e92 100644 ---- a/sound/soc/bcm/bcm2835-i2s.c -+++ b/sound/soc/bcm/bcm2835-i2s.c -@@ -411,15 +411,25 @@ static int bcm2835_i2s_hw_params(struct snd_pcm_substream *substream, - divf = dividend & BCM2835_CLK_DIVF_MASK; - } - -- /* Set clock divider */ -- regmap_write(dev->clk_regmap, BCM2835_CLK_PCMDIV_REG, BCM2835_CLK_PASSWD -- | BCM2835_CLK_DIVI(divi) -- | BCM2835_CLK_DIVF(divf)); -- -- /* Setup clock, but don't start it yet */ -- regmap_write(dev->clk_regmap, BCM2835_CLK_PCMCTL_REG, BCM2835_CLK_PASSWD -- | BCM2835_CLK_MASH(mash) -- | BCM2835_CLK_SRC(clk_src)); -+ /* Clock should only be set up here if CPU is clock master */ -+ switch (dev->fmt & SND_SOC_DAIFMT_MASTER_MASK) { -+ case SND_SOC_DAIFMT_CBS_CFS: -+ case SND_SOC_DAIFMT_CBS_CFM: -+ /* Set clock divider */ -+ regmap_write(dev->clk_regmap, BCM2835_CLK_PCMDIV_REG, -+ BCM2835_CLK_PASSWD -+ | BCM2835_CLK_DIVI(divi) -+ | BCM2835_CLK_DIVF(divf)); -+ -+ /* Setup clock, but don't start it yet */ -+ regmap_write(dev->clk_regmap, BCM2835_CLK_PCMCTL_REG, -+ BCM2835_CLK_PASSWD -+ | BCM2835_CLK_MASH(mash) -+ | BCM2835_CLK_SRC(clk_src)); -+ break; -+ default: -+ break; -+ } - - /* Setup the frame format */ - format = BCM2835_I2S_CHEN; - -From 71b2c93cd332be280b9ca7f293e463f30d5fb108 Mon Sep 17 00:00:00 2001 -From: Matthias Reichl <hias@horus.com> -Date: Sun, 11 Oct 2015 15:49:51 +0200 -Subject: [PATCH 017/170] bcm2835-i2s: Eliminate debugfs directory error - -Code ported from bcm2708-i2s driver in Raspberry Pi tree. - -RPi commit fd7d7a3dbe9262d16971ef81c234ed28c6499dd7 ("bcm2708: -Eliminate i2s debugfs directory error") - -Qualify the two regmap ranges uses by bcm2708-i2s ('-i2s' and '-clk') -to avoid the name clash when registering debugfs entries. - -Signed-off-by: Matthias Reichl <hias@horus.com> ---- - sound/soc/bcm/bcm2835-i2s.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/sound/soc/bcm/bcm2835-i2s.c b/sound/soc/bcm/bcm2835-i2s.c -index 4ac4e92..aab3df9 100644 ---- a/sound/soc/bcm/bcm2835-i2s.c -+++ b/sound/soc/bcm/bcm2835-i2s.c -@@ -782,6 +782,7 @@ static const struct regmap_config bcm2835_regmap_config[] = { - .precious_reg = bcm2835_i2s_precious_reg, - .volatile_reg = bcm2835_i2s_volatile_reg, - .cache_type = REGCACHE_RBTREE, -+ .name = "i2s", - }, - { - .reg_bits = 32, -@@ -790,6 +791,7 @@ static const struct regmap_config bcm2835_regmap_config[] = { - .max_register = BCM2835_CLK_PCMDIV_REG, - .volatile_reg = bcm2835_clk_volatile_reg, - .cache_type = REGCACHE_RBTREE, -+ .name = "clk", - }, - }; - - -From fae43fcaa20df1d39c09c98372100bb1dedd6090 Mon Sep 17 00:00:00 2001 -From: Matthias Reichl <hias@horus.com> -Date: Sun, 11 Oct 2015 15:35:20 +0200 -Subject: [PATCH 018/170] bcm2835-i2s: Register PCM device - -Code ported from bcm2708-i2s driver in Raspberry Pi tree. - -RPi commit ba46b4935a23aa2caac1855ead52a035d4776680 ("ASoC: Add -support for BCM2708") - -This driver adds support for digital audio (I2S) -for the BCM2708 SoC that is used by the -Raspberry Pi. External audio codecs can be -connected to the Raspberry Pi via P5 header. - -It relies on cyclic DMA engine support for BCM2708. - -Signed-off-by: Florian Meier <florian.meier@koalo.de> - -Signed-off-by: Matthias Reichl <hias@horus.com> ---- - sound/soc/bcm/bcm2835-i2s.c | 23 ++++++++++++++++++++++- - 1 file changed, 22 insertions(+), 1 deletion(-) - -diff --git a/sound/soc/bcm/bcm2835-i2s.c b/sound/soc/bcm/bcm2835-i2s.c -index aab3df9..0e5c787 100644 ---- a/sound/soc/bcm/bcm2835-i2s.c -+++ b/sound/soc/bcm/bcm2835-i2s.c -@@ -799,6 +799,25 @@ static const struct snd_soc_component_driver bcm2835_i2s_component = { - .name = "bcm2835-i2s-comp", - }; - -+static const struct snd_pcm_hardware bcm2835_pcm_hardware = { -+ .info = SNDRV_PCM_INFO_INTERLEAVED | -+ SNDRV_PCM_INFO_JOINT_DUPLEX, -+ .formats = SNDRV_PCM_FMTBIT_S16_LE | -+ SNDRV_PCM_FMTBIT_S24_LE | -+ SNDRV_PCM_FMTBIT_S32_LE, -+ .period_bytes_min = 32, -+ .period_bytes_max = 64 * PAGE_SIZE, -+ .periods_min = 2, -+ .periods_max = 255, -+ .buffer_bytes_max = 128 * PAGE_SIZE, -+}; -+ -+static const struct snd_dmaengine_pcm_config bcm2835_dmaengine_pcm_config = { -+ .prepare_slave_config = snd_dmaengine_pcm_prepare_slave_config, -+ .pcm_hardware = &bcm2835_pcm_hardware, -+ .prealloc_buffer_size = 256 * PAGE_SIZE, -+}; -+ - static int bcm2835_i2s_probe(struct platform_device *pdev) - { - struct bcm2835_i2s_dev *dev; -@@ -870,7 +889,9 @@ static int bcm2835_i2s_probe(struct platform_device *pdev) - return ret; - } - -- ret = devm_snd_dmaengine_pcm_register(&pdev->dev, NULL, 0); -+ ret = devm_snd_dmaengine_pcm_register(&pdev->dev, -+ &bcm2835_dmaengine_pcm_config, -+ SND_DMAENGINE_PCM_FLAG_COMPAT); - if (ret) { - dev_err(&pdev->dev, "Could not register PCM: %d\n", ret); - return ret; - -From c9e2eeee4889f965a29744718bbff2de409ac649 Mon Sep 17 00:00:00 2001 -From: Matthias Reichl <hias@horus.com> -Date: Sun, 11 Oct 2015 15:55:21 +0200 -Subject: [PATCH 019/170] bcm2835-i2s: Enable MMAP support via a DT property - -Code ported from bcm2708-i2s driver in Raspberry Pi tree. - -RPi commit 7ee829fd77a30127db5d0b3c7d79b8718166e568 ("bcm2708-i2s: -Enable MMAP support via a DT property and overlay") - -The i2s driver used to claim to support MMAP, but that feature was disabled -when some problems were found. Add the ability to enable this feature -through Device Tree, using the i2s-mmap overlay. - -See: #1004 - -Signed-off-by: Matthias Reichl <hias@horus.com> ---- - sound/soc/bcm/bcm2835-i2s.c | 7 ++++++- - 1 file changed, 6 insertions(+), 1 deletion(-) - -diff --git a/sound/soc/bcm/bcm2835-i2s.c b/sound/soc/bcm/bcm2835-i2s.c -index 0e5c787..04c1d13 100644 ---- a/sound/soc/bcm/bcm2835-i2s.c -+++ b/sound/soc/bcm/bcm2835-i2s.c -@@ -799,7 +799,7 @@ static const struct snd_soc_component_driver bcm2835_i2s_component = { - .name = "bcm2835-i2s-comp", - }; - --static const struct snd_pcm_hardware bcm2835_pcm_hardware = { -+static struct snd_pcm_hardware bcm2835_pcm_hardware = { - .info = SNDRV_PCM_INFO_INTERLEAVED | - SNDRV_PCM_INFO_JOINT_DUPLEX, - .formats = SNDRV_PCM_FMTBIT_S16_LE | -@@ -835,6 +835,11 @@ static int bcm2835_i2s_probe(struct platform_device *pdev) - } - dma_reg_base = be32_to_cpup(addr); - -+ if (of_property_read_bool(pdev->dev.of_node, "brcm,enable-mmap")) -+ bcm2835_pcm_hardware.info |= -+ SNDRV_PCM_INFO_MMAP | -+ SNDRV_PCM_INFO_MMAP_VALID; -+ - /* Request both ioareas */ - for (i = 0; i <= 1; i++) { - void __iomem *base; - -From dc5b926436bccc4efbb1695ec3696b5db6746d3b Mon Sep 17 00:00:00 2001 +From 52ab2f4e1b211feaf4f5be19022bc08e5cea6ec9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= <noralf@tronnes.org> Date: Thu, 9 Apr 2015 12:34:11 +0200 -Subject: [PATCH 020/170] dmaengine: bcm2835: Add slave dma support +Subject: [PATCH 023/112] dmaengine: bcm2835: Add slave dma support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -1466,10 +1558,10 @@ index 996c4b0..b278c66 100644 +MODULE_AUTHOR("Gellert Weisz <gellert@raspberrypi.org>"); MODULE_LICENSE("GPL v2"); -From 9c6955f3fbfbb46242c63b4640886b9a0d87910a Mon Sep 17 00:00:00 2001 +From 160840d9d207155501ca02d2bc97eba91747839c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= <noralf@tronnes.org> Date: Sat, 3 Oct 2015 15:58:59 +0200 -Subject: [PATCH 021/170] dmaengine: bcm2835: set residue_granularity field +Subject: [PATCH 024/112] dmaengine: bcm2835: set residue_granularity field MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -1498,10 +1590,10 @@ index b278c66..696fb30 100644 INIT_LIST_HEAD(&od->ddev.channels); spin_lock_init(&od->lock); -From 8da7ee8d9b714dbbac842fb5ae0471b52e0393ec Mon Sep 17 00:00:00 2001 +From 84ae1b4ea9964f0152d06115b8ed12c30dbb2366 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= <noralf@tronnes.org> Date: Sat, 3 Oct 2015 22:22:55 +0200 -Subject: [PATCH 022/170] dmaengine: bcm2835: Load driver early and support +Subject: [PATCH 025/112] dmaengine: bcm2835: Load driver early and support legacy API MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -1519,7 +1611,7 @@ Signed-off-by: Noralf Trønnes <noralf@tronnes.org> 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig -index e6cd1a3..060306e 100644 +index d96d87c..4d0425c 100644 --- a/drivers/dma/Kconfig +++ b/drivers/dma/Kconfig @@ -108,7 +108,7 @@ config COH901318 @@ -1601,34 +1693,10 @@ index 696fb30..5db0a95 100644 MODULE_ALIAS("platform:bcm2835-dma"); MODULE_DESCRIPTION("BCM2835 DMA engine driver"); -From 0f3a30eb7ad7e709fdc6447c70bc3f1d5704eb63 Mon Sep 17 00:00:00 2001 -From: Matthias Reichl <hias@horus.com> -Date: Sat, 10 Oct 2015 12:29:18 +0200 -Subject: [PATCH 023/170] bcm2835-dma: Fix dreq not set for slave transfers - -Set dreq to slave_id if it is not set like in bcm2708-dmaengine. ---- - drivers/dma/bcm2835-dma.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/drivers/dma/bcm2835-dma.c b/drivers/dma/bcm2835-dma.c -index 5db0a95..fe1fd60 100644 ---- a/drivers/dma/bcm2835-dma.c -+++ b/drivers/dma/bcm2835-dma.c -@@ -657,6 +657,8 @@ static int bcm2835_dma_slave_config(struct dma_chan *chan, - } - - c->cfg = *cfg; -+ if (!c->dreq) -+ c->dreq = cfg->slave_id; - - return 0; - } - -From 305370f7caaecafbabb77b630380dbc0c436bb4c Mon Sep 17 00:00:00 2001 +From ccc5b14a95ee999444d995c565a7e631cae946dd Mon Sep 17 00:00:00 2001 From: Matthias Reichl <hias@horus.com> Date: Sun, 11 Oct 2015 12:28:30 +0200 -Subject: [PATCH 024/170] bcm2835-dma: Limit cyclic transfers on lite channels +Subject: [PATCH 026/112] bcm2835-dma: Limit cyclic transfers on lite channels to 32k Transfers larger than 32k cause repeated clicking with I2S soundcards. @@ -1639,7 +1707,7 @@ did as an intermediate fix. 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/dma/bcm2835-dma.c b/drivers/dma/bcm2835-dma.c -index fe1fd60..0adc347 100644 +index 5db0a95..6b87ce2 100644 --- a/drivers/dma/bcm2835-dma.c +++ b/drivers/dma/bcm2835-dma.c @@ -144,6 +144,12 @@ struct bcm2835_desc { @@ -1665,10 +1733,98 @@ index fe1fd60..0adc347 100644 max_size = MAX_NORMAL_TRANSFER; period_len = min(period_len, max_size); -From d801c33b7e2fb0d02ac11b95ea92b7d692286ffc Mon Sep 17 00:00:00 2001 +From 7ecbf96abab7daa1e09881d457ea72d4756037ba Mon Sep 17 00:00:00 2001 +From: Matthias Reichl <hias@horus.com> +Date: Mon, 16 Nov 2015 14:05:35 +0000 +Subject: [PATCH 027/112] bcm2835-dma: Fix up convert to DMA pool + +--- + drivers/dma/bcm2835-dma.c | 36 ++++++++++++++++++++++++++---------- + 1 file changed, 26 insertions(+), 10 deletions(-) + +diff --git a/drivers/dma/bcm2835-dma.c b/drivers/dma/bcm2835-dma.c +index 6b87ce2..d26b6bd 100644 +--- a/drivers/dma/bcm2835-dma.c ++++ b/drivers/dma/bcm2835-dma.c +@@ -488,6 +488,17 @@ static struct dma_async_tx_descriptor *bcm2835_dma_prep_dma_cyclic( + c->cyclic = true; + + return vchan_tx_prep(&c->vc, &d->vd, flags); ++error_cb: ++ i--; ++ for (; i >= 0; i--) { ++ struct bcm2835_cb_entry *cb_entry = &d->cb_list[i]; ++ ++ dma_pool_free(c->cb_pool, cb_entry->cb, cb_entry->paddr); ++ } ++ ++ kfree(d->cb_list); ++ kfree(d); ++ return NULL; + } + + static struct dma_async_tx_descriptor * +@@ -534,6 +545,7 @@ bcm2835_dma_prep_slave_sg(struct dma_chan *chan, + if (!d) + return NULL; + ++ d->c = c; + d->dir = direction; + + if (c->ch >= 8) /* LITE channel */ +@@ -553,15 +565,21 @@ bcm2835_dma_prep_slave_sg(struct dma_chan *chan, + d->frames += len / max_size + 1; + } + +- /* Allocate memory for control blocks */ +- d->control_block_size = d->frames * sizeof(struct bcm2835_dma_cb); +- d->control_block_base = dma_zalloc_coherent(chan->device->dev, +- d->control_block_size, &d->control_block_base_phys, +- GFP_NOWAIT); +- if (!d->control_block_base) { ++ d->cb_list = kcalloc(d->frames, sizeof(*d->cb_list), GFP_KERNEL); ++ if (!d->cb_list) { + kfree(d); + return NULL; + } ++ /* Allocate memory for control blocks */ ++ for (i = 0; i < d->frames; i++) { ++ struct bcm2835_cb_entry *cb_entry = &d->cb_list[i]; ++ ++ cb_entry->cb = dma_pool_zalloc(c->cb_pool, GFP_ATOMIC, ++ &cb_entry->paddr); ++ ++ if (!cb_entry->cb) ++ goto error_cb; ++ } + + /* + * Iterate over all SG entries, create a control block +@@ -578,7 +596,7 @@ bcm2835_dma_prep_slave_sg(struct dma_chan *chan, + + for (j = 0; j < len; j += max_size) { + struct bcm2835_dma_cb *control_block = +- &d->control_block_base[i + split_cnt]; ++ d->cb_list[i + split_cnt].cb; + + /* Setup addresses */ + if (d->dir == DMA_DEV_TO_MEM) { +@@ -620,9 +638,7 @@ bcm2835_dma_prep_slave_sg(struct dma_chan *chan, + if (i < sg_len - 1 || len - j > max_size) { + /* Next block is the next frame. */ + control_block->next = +- d->control_block_base_phys + +- sizeof(struct bcm2835_dma_cb) * +- (i + split_cnt + 1); ++ d->cb_list[i + split_cnt + 1].paddr; + } else { + /* Next block is empty. */ + control_block->next = 0; + +From 16a0a53f8ce5f32ac79b204ff05efd91bf770be9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= <noralf@tronnes.org> Date: Sat, 15 Aug 2015 20:50:02 +0200 -Subject: [PATCH 025/170] bcm2835: Add support for uart1 +Subject: [PATCH 028/112] bcm2835: Add support for uart1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -1682,7 +1838,7 @@ Signed-off-by: Noralf Trønnes <noralf@tronnes.org> 1 file changed, 25 insertions(+) diff --git a/arch/arm/mach-bcm/board_bcm2835.c b/arch/arm/mach-bcm/board_bcm2835.c -index 1e6f1cf9..ea36eec 100644 +index 3b68a8d..e72e522 100644 --- a/arch/arm/mach-bcm/board_bcm2835.c +++ b/arch/arm/mach-bcm/board_bcm2835.c @@ -22,6 +22,29 @@ @@ -1725,21 +1881,17 @@ index 1e6f1cf9..ea36eec 100644 static const char * const bcm2835_compat[] = { -From 5e90e32b539720ad8c6c8d7ec462378685924f22 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= <noralf@tronnes.org> -Date: Fri, 26 Jun 2015 14:21:20 +0200 -Subject: [PATCH 026/170] firmware: bcm2835: Add missing property tags -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit +From 6d0faf9fef879b1ba6ee3796d07a63fac5984151 Mon Sep 17 00:00:00 2001 +From: popcornmix <popcornmix@gmail.com> +Date: Mon, 25 Jan 2016 17:25:12 +0000 +Subject: [PATCH 029/112] firmware: Updated mailbox header -Signed-off-by: Noralf Trønnes <noralf@tronnes.org> --- - include/soc/bcm2835/raspberrypi-firmware.h | 8 ++++++++ - 1 file changed, 8 insertions(+) + include/soc/bcm2835/raspberrypi-firmware.h | 11 +++++++++++ + 1 file changed, 11 insertions(+) diff --git a/include/soc/bcm2835/raspberrypi-firmware.h b/include/soc/bcm2835/raspberrypi-firmware.h -index c07d74a..525816d 100644 +index 3fb3571..227a107 100644 --- a/include/soc/bcm2835/raspberrypi-firmware.h +++ b/include/soc/bcm2835/raspberrypi-firmware.h @@ -63,6 +63,7 @@ enum rpi_firmware_property_tag { @@ -1750,28 +1902,32 @@ index c07d74a..525816d 100644 RPI_FIRMWARE_ALLOCATE_MEMORY = 0x0003000c, RPI_FIRMWARE_LOCK_MEMORY = 0x0003000d, RPI_FIRMWARE_UNLOCK_MEMORY = 0x0003000e, -@@ -72,10 +73,12 @@ enum rpi_firmware_property_tag { +@@ -72,12 +73,15 @@ enum rpi_firmware_property_tag { RPI_FIRMWARE_SET_ENABLE_QPU = 0x00030012, RPI_FIRMWARE_GET_DISPMANX_RESOURCE_MEM_HANDLE = 0x00030014, RPI_FIRMWARE_GET_EDID_BLOCK = 0x00030020, + RPI_FIRMWARE_GET_CUSTOMER_OTP = 0x00030021, + RPI_FIRMWARE_GET_DOMAIN_STATE = 0x00030030, RPI_FIRMWARE_SET_CLOCK_STATE = 0x00038001, RPI_FIRMWARE_SET_CLOCK_RATE = 0x00038002, RPI_FIRMWARE_SET_VOLTAGE = 0x00038003, RPI_FIRMWARE_SET_TURBO = 0x00038009, + RPI_FIRMWARE_SET_CUSTOMER_OTP = 0x00038021, + RPI_FIRMWARE_SET_DOMAIN_STATE = 0x00038030, ++ RPI_FIRMWARE_SET_SDHOST_CLOCK = 0x00038042, /* Dispmanx TAGS */ RPI_FIRMWARE_FRAMEBUFFER_ALLOCATE = 0x00040001, -@@ -89,6 +92,7 @@ enum rpi_firmware_property_tag { +@@ -91,6 +95,8 @@ enum rpi_firmware_property_tag { RPI_FIRMWARE_FRAMEBUFFER_GET_VIRTUAL_OFFSET = 0x00040009, RPI_FIRMWARE_FRAMEBUFFER_GET_OVERSCAN = 0x0004000a, RPI_FIRMWARE_FRAMEBUFFER_GET_PALETTE = 0x0004000b, + RPI_FIRMWARE_FRAMEBUFFER_GET_TOUCHBUF = 0x0004000f, ++ RPI_FIRMWARE_FRAMEBUFFER_GET_GPIOVIRTBUF = 0x00040010, RPI_FIRMWARE_FRAMEBUFFER_RELEASE = 0x00048001, RPI_FIRMWARE_FRAMEBUFFER_TEST_PHYSICAL_WIDTH_HEIGHT = 0x00044003, RPI_FIRMWARE_FRAMEBUFFER_TEST_VIRTUAL_WIDTH_HEIGHT = 0x00044004, -@@ -98,6 +102,7 @@ enum rpi_firmware_property_tag { +@@ -100,6 +106,7 @@ enum rpi_firmware_property_tag { RPI_FIRMWARE_FRAMEBUFFER_TEST_VIRTUAL_OFFSET = 0x00044009, RPI_FIRMWARE_FRAMEBUFFER_TEST_OVERSCAN = 0x0004400a, RPI_FIRMWARE_FRAMEBUFFER_TEST_PALETTE = 0x0004400b, @@ -1779,21 +1935,22 @@ index c07d74a..525816d 100644 RPI_FIRMWARE_FRAMEBUFFER_SET_PHYSICAL_WIDTH_HEIGHT = 0x00048003, RPI_FIRMWARE_FRAMEBUFFER_SET_VIRTUAL_WIDTH_HEIGHT = 0x00048004, RPI_FIRMWARE_FRAMEBUFFER_SET_DEPTH = 0x00048005, -@@ -106,6 +111,9 @@ enum rpi_firmware_property_tag { +@@ -108,6 +115,10 @@ enum rpi_firmware_property_tag { RPI_FIRMWARE_FRAMEBUFFER_SET_VIRTUAL_OFFSET = 0x00048009, RPI_FIRMWARE_FRAMEBUFFER_SET_OVERSCAN = 0x0004800a, RPI_FIRMWARE_FRAMEBUFFER_SET_PALETTE = 0x0004800b, + RPI_FIRMWARE_FRAMEBUFFER_SET_VSYNC = 0x0004800e, ++ RPI_FIRMWARE_FRAMEBUFFER_SET_BACKLIGHT = 0x0004800f, + + RPI_FIRMWARE_VCHIQ_INIT = 0x00048010, RPI_FIRMWARE_GET_COMMAND_LINE = 0x00050001, RPI_FIRMWARE_GET_DMA_CHANNELS = 0x00060001, -From 894f124497e95c9af506af2ed7335857f2e71358 Mon Sep 17 00:00:00 2001 +From a29233f17de884f942e0d232deb042796dcb5788 Mon Sep 17 00:00:00 2001 From: popcornmix <popcornmix@gmail.com> Date: Sun, 12 May 2013 12:24:19 +0100 -Subject: [PATCH 027/170] Main bcm2708/bcm2709 linux port +Subject: [PATCH 030/112] Main bcm2708/bcm2709 linux port MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -1831,14 +1988,13 @@ Signed-off-by: Noralf Trønnes <noralf@tronnes.org> arch/arm/mach-bcm2709/include/mach/vc_mem.h | 35 ++ arch/arm/mach-bcm2709/include/mach/vmalloc.h | 20 ++ arch/arm/mach-bcm2709/vc_mem.c | 431 +++++++++++++++++++++++ - arch/arm/mm/Kconfig | 2 +- arch/arm/mm/proc-v6.S | 15 +- - arch/arm/mm/proc-v7.S | 1 + arch/arm/tools/mach-types | 2 + drivers/clocksource/Makefile | 2 +- drivers/irqchip/Makefile | 3 + + drivers/irqchip/irq-bcm2835.c | 3 +- include/linux/mmc/host.h | 1 + - 37 files changed, 2147 insertions(+), 5 deletions(-) + 36 files changed, 2147 insertions(+), 5 deletions(-) create mode 100644 arch/arm/mach-bcm2708/Kconfig create mode 100644 arch/arm/mach-bcm2708/Makefile create mode 100644 arch/arm/mach-bcm2708/Makefile.boot @@ -1866,11 +2022,11 @@ Signed-off-by: Noralf Trønnes <noralf@tronnes.org> create mode 100644 arch/arm/mach-bcm2709/vc_mem.c diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig -index 34e1569..8f06ea8 100644 +index cdfa6c2..aad7157 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig -@@ -317,6 +317,52 @@ choice - default ARCH_VERSATILE if !MMU +@@ -322,6 +322,52 @@ choice + default ARM_SINGLE_ARMV7M if !MMU default ARCH_MULTIPLATFORM if MMU +config ARCH_BCM2708 @@ -1922,7 +2078,7 @@ index 34e1569..8f06ea8 100644 config ARCH_MULTIPLATFORM bool "Allow multiple platforms to be selected" depends on MMU -@@ -808,6 +854,9 @@ config ARCH_VIRT +@@ -721,6 +767,9 @@ config ARCH_VIRT # Kconfigs may be included either alphabetically (according to the # plat- suffix) or along side the corresponding mach-* source. # @@ -1933,10 +2089,10 @@ index 34e1569..8f06ea8 100644 source "arch/arm/mach-alpine/Kconfig" diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug -index ddbb361..340b759 100644 +index 1098e91..e119675 100644 --- a/arch/arm/Kconfig.debug +++ b/arch/arm/Kconfig.debug -@@ -1240,6 +1240,14 @@ choice +@@ -1302,6 +1302,14 @@ choice options; the platform specific options are deprecated and will be soon removed. @@ -1952,18 +2108,18 @@ index ddbb361..340b759 100644 config DEBUG_EXYNOS_UART diff --git a/arch/arm/Makefile b/arch/arm/Makefile -index 2c2b28e..a2e7cf7 100644 +index 8c3ce2a..c4d7d10 100644 --- a/arch/arm/Makefile +++ b/arch/arm/Makefile -@@ -154,6 +154,8 @@ textofs-$(CONFIG_ARCH_AXXIA) := 0x00308000 +@@ -153,6 +153,8 @@ textofs-$(CONFIG_ARCH_AXXIA) := 0x00308000 # Machine directory name. This list is sorted alphanumerically # by CONFIG_* macro name. +machine-$(CONFIG_ARCH_BCM2708) += bcm2708 +machine-$(CONFIG_ARCH_BCM2709) += bcm2709 machine-$(CONFIG_ARCH_ALPINE) += alpine + machine-$(CONFIG_ARCH_ARTPEC) += artpec machine-$(CONFIG_ARCH_AT91) += at91 - machine-$(CONFIG_ARCH_AXXIA) += axxia diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S index 04286fd..ed82628 100644 --- a/arch/arm/kernel/head.S @@ -2693,7 +2849,7 @@ index 0000000..502c617 +#define VMALLOC_END (0xe8000000) diff --git a/arch/arm/mach-bcm2709/Kconfig b/arch/arm/mach-bcm2709/Kconfig new file mode 100644 -index 0000000..643b4b98 +index 0000000..643b4b9 --- /dev/null +++ b/arch/arm/mach-bcm2709/Kconfig @@ -0,0 +1,16 @@ @@ -4203,19 +4359,6 @@ index 0000000..d2adfd1 +module_param(phys_addr, uint, 0644); +module_param(mem_size, uint, 0644); +module_param(mem_base, uint, 0644); -diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig -index 4121886..253bed8 100644 ---- a/arch/arm/mm/Kconfig -+++ b/arch/arm/mm/Kconfig -@@ -358,7 +358,7 @@ config CPU_PJ4B - - # ARMv6 - config CPU_V6 -- bool "Support ARM V6 processor" if (!ARCH_MULTIPLATFORM || ARCH_MULTI_V6) && (ARCH_INTEGRATOR || MACH_REALVIEW_EB || MACH_REALVIEW_PBX) -+ bool "Support ARM V6 processor" if (!ARCH_MULTIPLATFORM || ARCH_MULTI_V6) && (ARCH_INTEGRATOR || MACH_REALVIEW_EB || MACH_REALVIEW_PBX || MACH_BCM2708) - select CPU_32v6 - select CPU_ABRT_EV6 - select CPU_CACHE_V6 diff --git a/arch/arm/mm/proc-v6.S b/arch/arm/mm/proc-v6.S index 06d890a..30d96e8 100644 --- a/arch/arm/mm/proc-v6.S @@ -4243,18 +4386,6 @@ index 06d890a..30d96e8 100644 ret lr ENTRY(cpu_v6_dcache_clean_area) -diff --git a/arch/arm/mm/proc-v7.S b/arch/arm/mm/proc-v7.S -index 8e1ea43..be40ccb 100644 ---- a/arch/arm/mm/proc-v7.S -+++ b/arch/arm/mm/proc-v7.S -@@ -480,6 +480,7 @@ __errata_finish: - orr r0, r0, r6 @ set them - THUMB( orr r0, r0, #1 << 30 ) @ Thumb exceptions - ret lr @ return to head.S:__ret -+ .space 256 - ENDPROC(__v7_setup) - - .align 2 diff --git a/arch/arm/tools/mach-types b/arch/arm/tools/mach-types index 2ed1b8a..b52d949 100644 --- a/arch/arm/tools/mach-types @@ -4269,7 +4400,7 @@ index 2ed1b8a..b52d949 100644 ics_if_voip MACH_ICS_IF_VOIP ICS_IF_VOIP 3206 wlf_cragg_6410 MACH_WLF_CRAGG_6410 WLF_CRAGG_6410 3207 diff --git a/drivers/clocksource/Makefile b/drivers/clocksource/Makefile -index 56bd16e..c2ac46d 100644 +index dc2b899..c38fb1a 100644 --- a/drivers/clocksource/Makefile +++ b/drivers/clocksource/Makefile @@ -19,7 +19,7 @@ obj-$(CONFIG_CLKSRC_NOMADIK_MTU) += nomadik-mtu.o @@ -4282,11 +4413,11 @@ index 56bd16e..c2ac46d 100644 obj-$(CONFIG_ARCH_ATLAS7) += timer-atlas7.o obj-$(CONFIG_ARCH_MOXART) += moxart_timer.o diff --git a/drivers/irqchip/Makefile b/drivers/irqchip/Makefile -index 177f78f..6a9e2d0 100644 +index b03cfcb..70cad6b 100644 --- a/drivers/irqchip/Makefile +++ b/drivers/irqchip/Makefile -@@ -2,6 +2,9 @@ obj-$(CONFIG_IRQCHIP) += irqchip.o - +@@ -5,6 +5,9 @@ obj-$(CONFIG_ATH79) += irq-ath79-cpu.o + obj-$(CONFIG_ATH79) += irq-ath79-misc.o obj-$(CONFIG_ARCH_BCM2835) += irq-bcm2835.o obj-$(CONFIG_ARCH_BCM2835) += irq-bcm2836.o +obj-$(CONFIG_ARCH_BCM2708) += irq-bcm2835.o @@ -4295,37 +4426,87 @@ index 177f78f..6a9e2d0 100644 obj-$(CONFIG_ARCH_EXYNOS) += exynos-combiner.o obj-$(CONFIG_ARCH_HIP04) += irq-hip04.o obj-$(CONFIG_ARCH_MMP) += irq-mmp.o +diff --git a/drivers/irqchip/irq-bcm2835.c b/drivers/irqchip/irq-bcm2835.c +index 20deb28..c02bf8a 100644 +--- a/drivers/irqchip/irq-bcm2835.c ++++ b/drivers/irqchip/irq-bcm2835.c +@@ -82,6 +82,7 @@ + #define NR_BANKS 3 + #define IRQS_PER_BANK 32 + #define NUMBER_IRQS MAKE_HWIRQ(NR_BANKS, 0) ++#undef FIQ_START + #define FIQ_START (NR_IRQS_BANK0 + MAKE_HWIRQ(NR_BANKS - 1, 0)) + + static const int reg_pending[] __initconst = { 0x00, 0x04, 0x08 }; +@@ -256,7 +257,7 @@ static int __init armctrl_of_init(struct device_node *node, + MAKE_HWIRQ(b, i) + NUMBER_IRQS); + BUG_ON(irq <= 0); + irq_set_chip(irq, &armctrl_chip); +- set_irq_flags(irq, IRQF_VALID | IRQF_PROBE); ++ irq_set_probe(irq); + } + } + init_FIQ(FIQ_START); diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h -index 8673ffe..ad22ebb 100644 +index 8dd4d29..f7fe8bd 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h -@@ -289,6 +289,7 @@ struct mmc_host { - #define MMC_CAP2_HSX00_1_2V (MMC_CAP2_HS200_1_2V_SDR | MMC_CAP2_HS400_1_2V) +@@ -291,6 +291,7 @@ struct mmc_host { #define MMC_CAP2_SDIO_IRQ_NOTHREAD (1 << 17) #define MMC_CAP2_NO_WRITE_PROTECT (1 << 18) /* No physical write protect pin, assume that card is always read-write */ + #define MMC_CAP2_NO_SDIO (1 << 19) /* Do not send SDIO commands during initialization */ +#define MMC_CAP2_FORCE_MULTIBLOCK (1 << 31) /* Always use multiblock transfers */ mmc_pm_flag_t pm_caps; /* supported pm features */ -From 74b2c26348d94949561979a9a3ad61adcac74398 Mon Sep 17 00:00:00 2001 +From 3d28cd3bfb43f8c4a9b722532c63f54823ae6136 Mon Sep 17 00:00:00 2001 +From: popcornmix <popcornmix@gmail.com> +Date: Tue, 5 Apr 2016 19:40:12 +0100 +Subject: [PATCH 031/112] reboot: Use power off rather than busy spinning when + halt is requested + +--- + arch/arm/kernel/reboot.c | 6 +----- + 1 file changed, 1 insertion(+), 5 deletions(-) + +diff --git a/arch/arm/kernel/reboot.c b/arch/arm/kernel/reboot.c +index 71a2ff9..812c15e 100644 +--- a/arch/arm/kernel/reboot.c ++++ b/arch/arm/kernel/reboot.c +@@ -102,11 +102,7 @@ void machine_shutdown(void) + */ + void machine_halt(void) + { +- local_irq_disable(); +- smp_send_stop(); +- +- local_irq_disable(); +- while (1); ++ machine_power_off(); + } + + /* + +From 9a84e16b5bda0ca0a5c55ea67e923f13fa63a172 Mon Sep 17 00:00:00 2001 From: popcornmix <popcornmix@gmail.com> Date: Wed, 11 Nov 2015 21:01:15 +0000 -Subject: [PATCH 028/170] squash: include ARCH_BCM2708 / ARCH_BCM2709 +Subject: [PATCH 032/112] squash: include ARCH_BCM2708 / ARCH_BCM2709 --- drivers/char/hw_random/Kconfig | 2 +- + drivers/clk/bcm/Makefile | 4 ++-- drivers/mailbox/Kconfig | 2 +- drivers/mailbox/bcm2835-mailbox.c | 18 ++++++++++++++++-- drivers/pinctrl/Makefile | 1 + drivers/pwm/Kconfig | 2 +- - drivers/spi/Kconfig | 2 +- + drivers/spi/Kconfig | 4 ++-- drivers/watchdog/Kconfig | 2 +- sound/soc/bcm/Kconfig | 2 +- - 8 files changed, 23 insertions(+), 8 deletions(-) + 9 files changed, 26 insertions(+), 11 deletions(-) diff --git a/drivers/char/hw_random/Kconfig b/drivers/char/hw_random/Kconfig -index dbf2271..e11e3f2 100644 +index 67ee8b0..b3ca2ee 100644 --- a/drivers/char/hw_random/Kconfig +++ b/drivers/char/hw_random/Kconfig @@ -90,7 +90,7 @@ config HW_RANDOM_BCM63XX @@ -4337,11 +4518,26 @@ index dbf2271..e11e3f2 100644 default HW_RANDOM ---help--- This driver provides kernel-side support for the Random Number +diff --git a/drivers/clk/bcm/Makefile b/drivers/clk/bcm/Makefile +index 1d79bd2..fcf1bb5 100644 +--- a/drivers/clk/bcm/Makefile ++++ b/drivers/clk/bcm/Makefile +@@ -4,8 +4,8 @@ obj-$(CONFIG_CLK_BCM_KONA) += clk-kona-setup.o + obj-$(CONFIG_CLK_BCM_KONA) += clk-bcm281xx.o + obj-$(CONFIG_CLK_BCM_KONA) += clk-bcm21664.o + obj-$(CONFIG_COMMON_CLK_IPROC) += clk-iproc-armpll.o clk-iproc-pll.o clk-iproc-asiu.o +-obj-$(CONFIG_ARCH_BCM2835) += clk-bcm2835.o +-obj-$(CONFIG_ARCH_BCM2835) += clk-bcm2835-aux.o ++obj-$(CONFIG_ARCH_BCM2835)$(CONFIG_ARCH_BCM2708)$(CONFIG_ARCH_BCM2709) += clk-bcm2835.o ++obj-$(CONFIG_ARCH_BCM2835)$(CONFIG_ARCH_BCM2708)$(CONFIG_ARCH_BCM2709) += clk-bcm2835-aux.o + obj-$(CONFIG_COMMON_CLK_IPROC) += clk-ns2.o + obj-$(CONFIG_ARCH_BCM_CYGNUS) += clk-cygnus.o + obj-$(CONFIG_ARCH_BCM_NSP) += clk-nsp.o diff --git a/drivers/mailbox/Kconfig b/drivers/mailbox/Kconfig -index 546d05f..5a045c9 100644 +index 5305923..3de0dcb 100644 --- a/drivers/mailbox/Kconfig +++ b/drivers/mailbox/Kconfig -@@ -65,7 +65,7 @@ config ALTERA_MBOX +@@ -74,7 +74,7 @@ config ALTERA_MBOX config BCM2835_MBOX tristate "BCM2835 Mailbox" @@ -4400,19 +4596,19 @@ index cfb4b44..d9c6c21 100644 MODULE_AUTHOR("Lubomir Rintel <lkundrak@v3.sk>"); MODULE_DESCRIPTION("BCM2835 mailbox IPC driver"); diff --git a/drivers/pinctrl/Makefile b/drivers/pinctrl/Makefile -index 738cb492..4fd086f 100644 +index e4bc115..d996fe7 100644 --- a/drivers/pinctrl/Makefile +++ b/drivers/pinctrl/Makefile -@@ -40,6 +40,7 @@ obj-$(CONFIG_PINCTRL_TB10X) += pinctrl-tb10x.o +@@ -35,6 +35,7 @@ obj-$(CONFIG_PINCTRL_TB10X) += pinctrl-tb10x.o obj-$(CONFIG_PINCTRL_ST) += pinctrl-st.o obj-$(CONFIG_PINCTRL_ZYNQ) += pinctrl-zynq.o +obj-$(CONFIG_ARCH_BCM2708)$(CONFIG_ARCH_BCM2709) += bcm/ obj-$(CONFIG_ARCH_BCM) += bcm/ - obj-$(CONFIG_ARCH_BERLIN) += berlin/ + obj-$(CONFIG_PINCTRL_BERLIN) += berlin/ obj-y += freescale/ diff --git a/drivers/pwm/Kconfig b/drivers/pwm/Kconfig -index 2f4641a..d5c1a5d 100644 +index c182efc..fe0f845 100644 --- a/drivers/pwm/Kconfig +++ b/drivers/pwm/Kconfig @@ -85,7 +85,7 @@ config PWM_BCM_KONA @@ -4425,23 +4621,32 @@ index 2f4641a..d5c1a5d 100644 PWM framework driver for BCM2835 controller (Raspberry Pi) diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig -index 8b9c2a3..e842e86 100644 +index 9d8c84b..2a27a37 100644 --- a/drivers/spi/Kconfig +++ b/drivers/spi/Kconfig -@@ -78,7 +78,7 @@ config SPI_ATMEL +@@ -94,7 +94,7 @@ config SPI_AXI_SPI_ENGINE config SPI_BCM2835 tristate "BCM2835 SPI controller" depends on GPIOLIB - depends on ARCH_BCM2835 || COMPILE_TEST + depends on ARCH_BCM2835 || ARCH_BCM2708 || ARCH_BCM2709 || COMPILE_TEST - depends on GPIOLIB help This selects a driver for the Broadcom BCM2835 SPI master. + +@@ -105,7 +105,7 @@ config SPI_BCM2835 + + config SPI_BCM2835AUX + tristate "BCM2835 SPI auxiliary controller" +- depends on (ARCH_BCM2835 && GPIOLIB) || COMPILE_TEST ++ depends on ((ARCH_BCM2835 || ARCH_BCM2708 || ARCH_BCM2709) && GPIOLIB) || COMPILE_TEST + help + This selects a driver for the Broadcom BCM2835 SPI aux master. + diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig -index 1c427be..3c03d17 100644 +index fb94765..8b2de7f 100644 --- a/drivers/watchdog/Kconfig +++ b/drivers/watchdog/Kconfig -@@ -1282,7 +1282,7 @@ config BCM63XX_WDT +@@ -1401,7 +1401,7 @@ config BCM63XX_WDT config BCM2835_WDT tristate "Broadcom BCM2835 hardware watchdog" @@ -4463,10 +4668,10 @@ index 6a834e1..c5070ae 100644 select REGMAP_MMIO help -From a03df8d0f93365689c718f3d1fb62695e9fffe31 Mon Sep 17 00:00:00 2001 +From 153b5f0f1f31e246cfc43ff80c07df63ca16cd31 Mon Sep 17 00:00:00 2001 From: popcornmix <popcornmix@gmail.com> Date: Wed, 1 May 2013 19:46:17 +0100 -Subject: [PATCH 029/170] Add dwc_otg driver +Subject: [PATCH 033/112] Add dwc_otg driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -4929,6 +5134,35 @@ Also add error checking on the returned irq number. Signed-off-by: Noralf Trønnes <noralf@tronnes.org> dwc_otg: Remove duplicate gadget probe/unregister function + +dwc_otg: Properly set the HFIR + +Douglas Anderson reported: + +According to the most up to date version of the dwc2 databook, the FRINT +field of the HFIR register should be programmed to: +* 125 us * (PHY clock freq for HS) - 1 +* 1000 us * (PHY clock freq for FS/LS) - 1 + +This is opposed to older versions of the doc that claimed it should be: +* 125 us * (PHY clock freq for HS) +* 1000 us * (PHY clock freq for FS/LS) + +and reported lower timing jitter on a USB analyser + +dcw_otg: trim xfer length when buffer larger than allocated size is received + +dwc_otg: Don't free qh align buffers in atomic context + +dwc_otg: Enable the hack for Split Interrupt transactions by default + +dwc_otg.fiq_fsm_mask=0xF has long been a suggestion for users with audio stutters or other USB bandwidth issues. +So far we are aware of many success stories but no failure caused by this setting. +Make it a default to learn more. + +See: https://www.raspberrypi.org/forums/viewtopic.php?f=28&t=70437 + +Signed-off-by: popcornmix <popcornmix@gmail.com> --- arch/arm/include/asm/irqflags.h | 16 +- arch/arm/kernel/fiqasm.S | 4 + @@ -4986,9 +5220,9 @@ dwc_otg: Remove duplicate gadget probe/unregister function drivers/usb/host/dwc_otg/dwc_otg_hcd.h | 862 +++ drivers/usb/host/dwc_otg/dwc_otg_hcd_ddma.c | 1132 ++++ drivers/usb/host/dwc_otg/dwc_otg_hcd_if.h | 417 ++ - drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c | 2714 ++++++++ + drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c | 2727 ++++++++ drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c | 1005 +++ - drivers/usb/host/dwc_otg/dwc_otg_hcd_queue.c | 957 +++ + drivers/usb/host/dwc_otg/dwc_otg_hcd_queue.c | 962 +++ drivers/usb/host/dwc_otg/dwc_otg_os_dep.h | 188 + drivers/usb/host/dwc_otg/dwc_otg_pcd.c | 2712 ++++++++ drivers/usb/host/dwc_otg/dwc_otg_pcd.h | 266 + @@ -5000,7 +5234,7 @@ dwc_otg: Remove duplicate gadget probe/unregister function drivers/usb/host/dwc_otg/test/dwc_otg_test.pm | 337 + drivers/usb/host/dwc_otg/test/test_mod_param.pl | 133 + drivers/usb/host/dwc_otg/test/test_sysfs.pl | 193 + - 70 files changed, 59867 insertions(+), 16 deletions(-) + 70 files changed, 59885 insertions(+), 16 deletions(-) create mode 100644 drivers/usb/gadget/file_storage.c create mode 100644 drivers/usb/host/dwc_common_port/Makefile create mode 100644 drivers/usb/host/dwc_common_port/Makefile.fbsd @@ -5107,7 +5341,7 @@ index 8dd26e1..eef4847 100644 + mov pc, r8 +ENDPROC(__FIQ_Branch) diff --git a/drivers/usb/Makefile b/drivers/usb/Makefile -index d5c57f1e..0e15a22 100644 +index dca7856..5c467de 100644 --- a/drivers/usb/Makefile +++ b/drivers/usb/Makefile @@ -7,6 +7,7 @@ @@ -5131,10 +5365,10 @@ index 358ca8d..abaac7c 100644 return i; } diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c -index 1560f3f..dd4dd69 100644 +index 1ab42bf..292a26c 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c -@@ -4967,7 +4967,7 @@ static void port_event(struct usb_hub *hub, int port1) +@@ -5044,7 +5044,7 @@ static void port_event(struct usb_hub *hub, int port1) if (portchange & USB_PORT_STAT_C_OVERCURRENT) { u16 status = 0, unused; @@ -5147,7 +5381,7 @@ diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c index 8e641b5..de3ed7d 100644 --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c -@@ -1909,6 +1909,85 @@ int usb_set_configuration(struct usb_device *dev, int configuration) +@@ -1909,6 +1909,85 @@ free_interfaces: if (cp->string == NULL && !(dev->quirks & USB_QUIRK_CONFIG_INTF_STRINGS)) cp->string = usb_cache_string(dev, cp->desc.iConfiguration); @@ -5392,7 +5626,7 @@ index a95b0c9..17b605f 100644 diff --git a/drivers/usb/gadget/file_storage.c b/drivers/usb/gadget/file_storage.c new file mode 100644 -index 0000000..a896d73f +index 0000000..a896d73 --- /dev/null +++ b/drivers/usb/gadget/file_storage.c @@ -0,0 +1,3676 @@ @@ -9073,10 +9307,10 @@ index 0000000..a896d73f +} +module_exit(fsg_cleanup); diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig -index 3bb0887..0905a86 100644 +index e9d4dde..867dc98 100644 --- a/drivers/usb/host/Kconfig +++ b/drivers/usb/host/Kconfig -@@ -735,6 +735,19 @@ config USB_HWA_HCD +@@ -753,6 +753,19 @@ config USB_HWA_HCD To compile this driver a module, choose M here: the module will be called "hwa-hc". @@ -9097,18 +9331,18 @@ index 3bb0887..0905a86 100644 tristate "i.MX21 HCD support" depends on ARM && ARCH_MXC diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile -index e7558ab..0bb50e6 100644 +index a9ddd3c..11d7761 100644 --- a/drivers/usb/host/Makefile +++ b/drivers/usb/host/Makefile -@@ -69,6 +69,8 @@ obj-$(CONFIG_USB_SL811_CS) += sl811_cs.o +@@ -73,6 +73,8 @@ obj-$(CONFIG_USB_SL811_CS) += sl811_cs.o obj-$(CONFIG_USB_U132_HCD) += u132-hcd.o obj-$(CONFIG_USB_R8A66597_HCD) += r8a66597-hcd.o obj-$(CONFIG_USB_HWA_HCD) += hwa-hc.o + +obj-$(CONFIG_USB_DWCOTG) += dwc_otg/ dwc_common_port/ obj-$(CONFIG_USB_IMX21_HCD) += imx21-hcd.o - obj-$(CONFIG_USB_FSL_MPH_DR_OF) += fsl-mph-dr-of.o - obj-$(CONFIG_USB_EHCI_FSL) += ehci-fsl.o + obj-$(CONFIG_USB_FSL_USB2) += fsl-mph-dr-of.o + obj-$(CONFIG_USB_EHCI_FSL) += fsl-mph-dr-of.o diff --git a/drivers/usb/host/dwc_common_port/Makefile b/drivers/usb/host/dwc_common_port/Makefile new file mode 100644 index 0000000..f10d466 @@ -13230,7 +13464,7 @@ index 0000000..4664684 +#endif /* DWC_LIBMODULE */ diff --git a/drivers/usb/host/dwc_common_port/dwc_common_nbsd.c b/drivers/usb/host/dwc_common_port/dwc_common_nbsd.c new file mode 100644 -index 0000000..49b07e17 +index 0000000..49b07e1 --- /dev/null +++ b/drivers/usb/host/dwc_common_port/dwc_common_nbsd.c @@ -0,0 +1,1275 @@ @@ -25757,7 +25991,7 @@ index 0000000..bbb3d32 +#endif //DWC_UTE_CFI diff --git a/drivers/usb/host/dwc_otg/dwc_otg_cfi.h b/drivers/usb/host/dwc_otg/dwc_otg_cfi.h new file mode 100644 -index 0000000..55fd337a +index 0000000..55fd337 --- /dev/null +++ b/drivers/usb/host/dwc_otg/dwc_otg_cfi.h @@ -0,0 +1,320 @@ @@ -26083,7 +26317,7 @@ index 0000000..55fd337a +#endif /* (__DWC_OTG_CFI_H__) */ diff --git a/drivers/usb/host/dwc_otg/dwc_otg_cil.c b/drivers/usb/host/dwc_otg/dwc_otg_cil.c new file mode 100644 -index 0000000..beaa8b3 +index 0000000..38abd0b --- /dev/null +++ b/drivers/usb/host/dwc_otg/dwc_otg_cil.c @@ -0,0 +1,7141 @@ @@ -29247,10 +29481,10 @@ index 0000000..beaa8b3 + clock = 48; + if (hprt0.b.prtspd == 0) + /* High speed case */ -+ return 125 * clock; ++ return 125 * clock - 1; + else + /* FS/LS case */ -+ return 1000 * clock; ++ return 1000 * clock - 1; +} + +/** @@ -37134,7 +37368,7 @@ index 0000000..ccc24e0 +#endif diff --git a/drivers/usb/host/dwc_otg/dwc_otg_driver.c b/drivers/usb/host/dwc_otg/dwc_otg_driver.c new file mode 100644 -index 0000000..95edadf +index 0000000..cb060a7 --- /dev/null +++ b/drivers/usb/host/dwc_otg/dwc_otg_driver.c @@ -0,0 +1,1757 @@ @@ -37387,7 +37621,7 @@ index 0000000..95edadf +//Bulk split-transaction NAK holdoff in microframes +uint16_t nak_holdoff = 8; + -+unsigned short fiq_fsm_mask = 0x07; ++unsigned short fiq_fsm_mask = 0x0F; + +/** + * This function shows the Driver Version. @@ -47504,10 +47738,10 @@ index 0000000..fb57db0 +#endif /* DWC_DEVICE_ONLY */ diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c b/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c new file mode 100644 -index 0000000..8db3dfc +index 0000000..e6b38ac --- /dev/null +++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c -@@ -0,0 +1,2714 @@ +@@ -0,0 +1,2727 @@ +/* ========================================================================== + * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_hcd_intr.c $ + * $Revision: #89 $ @@ -48247,6 +48481,12 @@ index 0000000..8db3dfc + DWC_OTG_HC_XFER_COMPLETE, + &short_read); + ++ if (urb->actual_length + xfer_length > urb->length) { ++ printk_once(KERN_DEBUG "dwc_otg: DEVICE:%03d : %s:%d:trimming xfer length\n", ++ hc->dev_addr, __func__, __LINE__); ++ xfer_length = urb->length - urb->actual_length; ++ } ++ + /* non DWORD-aligned buffer case handling. */ + if (hc->align_buff && xfer_length && hc->ep_is_in) { + dwc_memcpy(urb->buf + urb->actual_length, hc->qh->dw_align_buf, @@ -48933,6 +49173,13 @@ index 0000000..8db3dfc +{ + uint32_t bytes_transferred = get_actual_xfer_length(hc, hc_regs, qtd, + halt_status, NULL); ++ ++ if (urb->actual_length + bytes_transferred > urb->length) { ++ printk_once(KERN_DEBUG "dwc_otg: DEVICE:%03d : %s:%d:trimming xfer length\n", ++ hc->dev_addr, __func__, __LINE__); ++ bytes_transferred = urb->length - urb->actual_length; ++ } ++ + /* non DWORD-aligned buffer case handling. */ + if (hc->align_buff && bytes_transferred && hc->ep_is_in) { + dwc_memcpy(urb->buf + urb->actual_length, hc->qh->dw_align_buf, @@ -51235,10 +51482,10 @@ index 0000000..2ceed42 +#endif /* DWC_DEVICE_ONLY */ diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd_queue.c b/drivers/usb/host/dwc_otg/dwc_otg_hcd_queue.c new file mode 100644 -index 0000000..acd0dd7 +index 0000000..3b2a607 --- /dev/null +++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd_queue.c -@@ -0,0 +1,957 @@ +@@ -0,0 +1,962 @@ +/* ========================================================================== + * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_hcd_queue.c $ + * $Revision: #44 $ @@ -51297,6 +51544,9 @@ index 0000000..acd0dd7 +{ + dwc_otg_qtd_t *qtd, *qtd_tmp; + dwc_irqflags_t flags; ++ uint32_t buf_size = 0; ++ uint8_t *align_buf_virt = NULL; ++ dwc_dma_t align_buf_dma; + + /* Free each QTD in the QTD list */ + DWC_SPINLOCK_IRQSAVE(hcd->lock, &flags); @@ -51308,17 +51558,19 @@ index 0000000..acd0dd7 + if (hcd->core_if->dma_desc_enable) { + dwc_otg_hcd_qh_free_ddma(hcd, qh); + } else if (qh->dw_align_buf) { -+ uint32_t buf_size; + if (qh->ep_type == UE_ISOCHRONOUS) { + buf_size = 4096; + } else { + buf_size = hcd->core_if->core_params->max_transfer_size; + } -+ DWC_DMA_FREE(buf_size, qh->dw_align_buf, qh->dw_align_buf_dma); ++ align_buf_virt = qh->dw_align_buf; ++ align_buf_dma = qh->dw_align_buf_dma; + } + + DWC_FREE(qh); + DWC_SPINUNLOCK_IRQRESTORE(hcd->lock, flags); ++ if (align_buf_virt) ++ DWC_DMA_FREE(buf_size, align_buf_virt, align_buf_dma); + return; +} + @@ -55748,7 +56000,7 @@ index 0000000..c8d2e0e +#endif /* DWC_HOST_ONLY */ diff --git a/drivers/usb/host/dwc_otg/dwc_otg_pcd_intr.c b/drivers/usb/host/dwc_otg/dwc_otg_pcd_intr.c new file mode 100644 -index 0000000..c8590b52 +index 0000000..c8590b5 --- /dev/null +++ b/drivers/usb/host/dwc_otg/dwc_otg_pcd_intr.c @@ -0,0 +1,5147 @@ @@ -65445,10 +65697,10 @@ index 0000000..cdc9963 +test_main(); +0; -From 845f985818d3d9ba162ab1102da78b0e39eaedba Mon Sep 17 00:00:00 2001 +From 5eb9e2e749d68100ad84ad874d095e96f7583860 Mon Sep 17 00:00:00 2001 From: popcornmix <popcornmix@gmail.com> Date: Wed, 17 Jun 2015 17:06:34 +0100 -Subject: [PATCH 030/170] bcm2708 framebuffer driver +Subject: [PATCH 034/112] bcm2708 framebuffer driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -65524,16 +65776,16 @@ Signed-off-by: Noralf Trønnes <noralf@tronnes.org> --- drivers/video/fbdev/Kconfig | 14 + drivers/video/fbdev/Makefile | 1 + - drivers/video/fbdev/bcm2708_fb.c | 847 ++++++++++ + drivers/video/fbdev/bcm2708_fb.c | 844 ++++++++++ drivers/video/logo/logo_linux_clut224.ppm | 2483 ++++++++++------------------- - 4 files changed, 1743 insertions(+), 1602 deletions(-) + 4 files changed, 1740 insertions(+), 1602 deletions(-) create mode 100644 drivers/video/fbdev/bcm2708_fb.c diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig -index e6d16d6..0f33a78 100644 +index 983280e..ee72c3a 100644 --- a/drivers/video/fbdev/Kconfig +++ b/drivers/video/fbdev/Kconfig -@@ -224,6 +224,20 @@ config FB_TILEBLITTING +@@ -228,6 +228,20 @@ config FB_TILEBLITTING comment "Frame buffer hardware drivers" depends on FB @@ -65555,7 +65807,7 @@ index e6d16d6..0f33a78 100644 tristate "Aeroflex Gaisler framebuffer support" depends on FB && SPARC diff --git a/drivers/video/fbdev/Makefile b/drivers/video/fbdev/Makefile -index 50ed1b4..9b086ac 100644 +index 65fb150..df473d8 100644 --- a/drivers/video/fbdev/Makefile +++ b/drivers/video/fbdev/Makefile @@ -12,6 +12,7 @@ obj-$(CONFIG_FB_MACMODES) += macmodes.o @@ -65568,10 +65820,10 @@ index 50ed1b4..9b086ac 100644 obj-$(CONFIG_FB_CLPS711X) += clps711x-fb.o diff --git a/drivers/video/fbdev/bcm2708_fb.c b/drivers/video/fbdev/bcm2708_fb.c new file mode 100644 -index 0000000..a20539a +index 0000000..cae5aab --- /dev/null +++ b/drivers/video/fbdev/bcm2708_fb.c -@@ -0,0 +1,847 @@ +@@ -0,0 +1,844 @@ +/* + * linux/drivers/video/bcm2708_fb.c + * @@ -65792,9 +66044,6 @@ index 0000000..a20539a + struct fb_info *info) +{ + /* info input, var output */ -+ int yres; -+ -+ /* info input, var output */ + print_debug("bcm2708_fb_check_var info(%p) %dx%d (%dx%d), %d, %d\n", info, + info->var.xres, info->var.yres, info->var.xres_virtual, + info->var.yres_virtual, (int)info->screen_size, @@ -66420,7 +66669,7 @@ index 0000000..a20539a +MODULE_PARM_DESC(fbdepth, "Bit depth of ARM Framebuffer"); +MODULE_PARM_DESC(fbswap, "Swap order of red and blue in 24 and 32 bit modes"); diff --git a/drivers/video/logo/logo_linux_clut224.ppm b/drivers/video/logo/logo_linux_clut224.ppm -index 3c14e43..7626beb6a 100644 +index 3c14e43..7626beb 100644 --- a/drivers/video/logo/logo_linux_clut224.ppm +++ b/drivers/video/logo/logo_linux_clut224.ppm @@ -1,1604 +1,883 @@ @@ -68910,10 +69159,10 @@ index 3c14e43..7626beb6a 100644 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 -From a35139d316b78606bfdeb0f10656ba6f1729c83f Mon Sep 17 00:00:00 2001 +From e25ec90f213f3d1c6437f42059f442c84a997114 Mon Sep 17 00:00:00 2001 From: Florian Meier <florian.meier@koalo.de> Date: Fri, 22 Nov 2013 14:22:53 +0100 -Subject: [PATCH 031/170] dmaengine: Add support for BCM2708 +Subject: [PATCH 035/112] dmaengine: Add support for BCM2708 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -69070,10 +69319,10 @@ Signed-off-by: Noralf Trønnes <noralf@tronnes.org> create mode 100644 include/linux/platform_data/dma-bcm2708.h diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig -index 060306e..33e36b9 100644 +index 4d0425c..b7863f0 100644 --- a/drivers/dma/Kconfig +++ b/drivers/dma/Kconfig -@@ -470,6 +470,10 @@ config TIMB_DMA +@@ -474,6 +474,10 @@ config TIMB_DMA help Enable support for the Timberdale FPGA DMA engine. @@ -69085,7 +69334,7 @@ index 060306e..33e36b9 100644 tristate "AM33xx CPPI41 DMA support" depends on ARCH_OMAP diff --git a/drivers/dma/Makefile b/drivers/dma/Makefile -index ef9c099..e0cf5e61 100644 +index 6084127..8188c36 100644 --- a/drivers/dma/Makefile +++ b/drivers/dma/Makefile @@ -18,6 +18,7 @@ obj-$(CONFIG_AT_HDMAC) += at_hdmac.o @@ -69533,96 +69782,10 @@ index 0000000..99cc7fd + +#endif /* _PLAT_BCM2708_DMA_H */ -From 462591cf98f15614620667e93b7f8bc0da6e86da Mon Sep 17 00:00:00 2001 -From: Phil Elwell <phil@raspberrypi.org> -Date: Fri, 17 Apr 2015 19:30:22 +0100 -Subject: [PATCH 032/170] Add blk_pos parameter to mmc multi_io_quirk callback - ---- - drivers/mmc/card/block.c | 1 + - drivers/mmc/host/omap_hsmmc.c | 4 +++- - drivers/mmc/host/sh_mobile_sdhi.c | 4 +++- - drivers/mmc/host/tmio_mmc_pio.c | 4 +++- - include/linux/mmc/host.h | 4 +++- - 5 files changed, 13 insertions(+), 4 deletions(-) - -diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c -index d848616..b35f0c4 100644 ---- a/drivers/mmc/card/block.c -+++ b/drivers/mmc/card/block.c -@@ -1510,6 +1510,7 @@ static void mmc_blk_rw_rq_prep(struct mmc_queue_req *mqrq, - brq->data.blocks = card->host->ops->multi_io_quirk(card, - (rq_data_dir(req) == READ) ? - MMC_DATA_READ : MMC_DATA_WRITE, -+ blk_rq_pos(req), - brq->data.blocks); - } - -diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c -index 7fb0753..708d0fa 100644 ---- a/drivers/mmc/host/omap_hsmmc.c -+++ b/drivers/mmc/host/omap_hsmmc.c -@@ -1832,7 +1832,9 @@ static void omap_hsmmc_conf_bus_power(struct omap_hsmmc_host *host) - } - - static int omap_hsmmc_multi_io_quirk(struct mmc_card *card, -- unsigned int direction, int blk_size) -+ unsigned int direction, -+ u32 blk_pos, -+ int blk_size) - { - /* This controller can't do multiblock reads due to hw bugs */ - if (direction == MMC_DATA_READ) -diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c -index 354f4f3..4f1ccf3 100644 ---- a/drivers/mmc/host/sh_mobile_sdhi.c -+++ b/drivers/mmc/host/sh_mobile_sdhi.c -@@ -170,7 +170,9 @@ static int sh_mobile_sdhi_write16_hook(struct tmio_mmc_host *host, int addr) - } - - static int sh_mobile_sdhi_multi_io_quirk(struct mmc_card *card, -- unsigned int direction, int blk_size) -+ unsigned int direction, -+ u32 blk_pos, -+ int blk_size) - { - /* - * In Renesas controllers, when performing a -diff --git a/drivers/mmc/host/tmio_mmc_pio.c b/drivers/mmc/host/tmio_mmc_pio.c -index a10fde4..7b730d8 100644 ---- a/drivers/mmc/host/tmio_mmc_pio.c -+++ b/drivers/mmc/host/tmio_mmc_pio.c -@@ -1003,7 +1003,9 @@ static int tmio_mmc_get_ro(struct mmc_host *mmc) - } - - static int tmio_multi_io_quirk(struct mmc_card *card, -- unsigned int direction, int blk_size) -+ unsigned int direction, -+ u32 blk_pos, -+ int blk_size) - { - struct tmio_mmc_host *host = mmc_priv(card->host); - -diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h -index ad22ebb..105b3e6 100644 ---- a/include/linux/mmc/host.h -+++ b/include/linux/mmc/host.h -@@ -143,7 +143,9 @@ struct mmc_host_ops { - * I/O. Returns the number of supported blocks for the request. - */ - int (*multi_io_quirk)(struct mmc_card *card, -- unsigned int direction, int blk_size); -+ unsigned int direction, -+ u32 blk_pos, -+ int blk_size); - }; - - struct mmc_card; - -From 3d0ca77d187abbbde572f4a73b1f864ffb8b5d8a Mon Sep 17 00:00:00 2001 +From 786f8c7793b58831efa8e1ffe5a02723842d3728 Mon Sep 17 00:00:00 2001 From: gellert <gellert@raspberrypi.org> Date: Fri, 15 Aug 2014 16:35:06 +0100 -Subject: [PATCH 033/170] MMC: added alternative MMC driver +Subject: [PATCH 036/112] MMC: added alternative MMC driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -69688,39 +69851,59 @@ In non-DT mode, don't add the device in the board file. Signed-off-by: Noralf Trønnes <noralf@tronnes.org> bcm2835-mmc: Don't overwrite MMC capabilities from DT + +bcm2835-mmc: Don't override bus width capabilities from devicetree + +Take out the force setting of the MMC_CAP_4_BIT_DATA host capability +so that the result read from devicetree via mmc_of_parse() is +preserved. + +bcm2835-mmc: Only claim one DMA channel + +With both MMC controllers enabled there are few DMA channels left. The +bcm2835-mmc driver only uses DMA in one direction at a time, so it +doesn't need to claim two channels. + +See: https://github.com/raspberrypi/linux/issues/1327 + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> --- - drivers/mmc/core/quirks.c | 6 + + drivers/mmc/core/quirks.c | 10 + drivers/mmc/host/Kconfig | 29 + drivers/mmc/host/Makefile | 1 + - drivers/mmc/host/bcm2835-mmc.c | 1542 ++++++++++++++++++++++++++++++++++++++++ - 4 files changed, 1578 insertions(+) + drivers/mmc/host/bcm2835-mmc.c | 1571 ++++++++++++++++++++++++++++++++++++++++ + 4 files changed, 1611 insertions(+) create mode 100644 drivers/mmc/host/bcm2835-mmc.c diff --git a/drivers/mmc/core/quirks.c b/drivers/mmc/core/quirks.c -index fad660b..87ae2e9 100644 +index fad660b..b79fe14 100644 --- a/drivers/mmc/core/quirks.c +++ b/drivers/mmc/core/quirks.c -@@ -53,6 +53,7 @@ static const struct mmc_fixup mmc_fixup_methods[] = { +@@ -53,6 +53,9 @@ static const struct mmc_fixup mmc_fixup_methods[] = { void mmc_fixup_device(struct mmc_card *card, const struct mmc_fixup *table) { ++#ifdef CONFIG_MMC_BCM2835 + extern unsigned mmc_debug; ++#endif const struct mmc_fixup *f; u64 rev = cid_rev_card(card); -@@ -77,5 +78,10 @@ void mmc_fixup_device(struct mmc_card *card, const struct mmc_fixup *table) +@@ -77,5 +80,12 @@ void mmc_fixup_device(struct mmc_card *card, const struct mmc_fixup *table) f->vendor_fixup(card, f->data); } } + /* SDHCI on BCM2708 - bug causes a certain sequence of CMD23 operations to fail. + * Disable this flag for all cards (fall-back to CMD25/CMD18 multi-block transfers). + */ ++#ifdef CONFIG_MMC_BCM2835 + if (mmc_debug & (1<<13)) + card->quirks |= MMC_QUIRK_BLK_NO_CMD23; ++#endif } EXPORT_SYMBOL(mmc_fixup_device); diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig -index 1dee533..9b72d2c 100644 +index e657af0..0476061 100644 --- a/drivers/mmc/host/Kconfig +++ b/drivers/mmc/host/Kconfig @@ -4,6 +4,35 @@ @@ -69760,7 +69943,7 @@ index 1dee533..9b72d2c 100644 tristate "ARM AMBA Multimedia Card Interface support" depends on ARM_AMBA diff --git a/drivers/mmc/host/Makefile b/drivers/mmc/host/Makefile -index 3595f83..6cf6457 100644 +index af918d2..3ba94f0 100644 --- a/drivers/mmc/host/Makefile +++ b/drivers/mmc/host/Makefile @@ -18,6 +18,7 @@ obj-$(CONFIG_MMC_SDHCI_S3C) += sdhci-s3c.o @@ -69773,10 +69956,10 @@ index 3595f83..6cf6457 100644 obj-$(CONFIG_MMC_MTK) += mtk-sd.o diff --git a/drivers/mmc/host/bcm2835-mmc.c b/drivers/mmc/host/bcm2835-mmc.c new file mode 100644 -index 0000000..43aed6e +index 0000000..ceb3793 --- /dev/null +++ b/drivers/mmc/host/bcm2835-mmc.c -@@ -0,0 +1,1542 @@ +@@ -0,0 +1,1571 @@ +/* + * BCM2835 MMC host driver. + * @@ -69887,8 +70070,9 @@ index 0000000..43aed6e + u32 shadow; + + /*DMA part*/ -+ struct dma_chan *dma_chan_rx; /* DMA channel for reads */ -+ struct dma_chan *dma_chan_tx; /* DMA channel for writes */ ++ struct dma_chan *dma_chan_rxtx; /* DMA channel for reads and writes */ ++ struct dma_slave_config dma_cfg_rx; ++ struct dma_slave_config dma_cfg_tx; + struct dma_async_tx_descriptor *tx_desc; /* descriptor */ + + bool have_dma; @@ -70121,7 +70305,7 @@ index 0000000..43aed6e + + if (host->data && !(host->data->flags & MMC_DATA_WRITE)) { + /* otherwise handled in SDHCI IRQ */ -+ dma_chan = host->dma_chan_rx; ++ dma_chan = host->dma_chan_rxtx; + dir_data = DMA_FROM_DEVICE; + + dma_unmap_sg(dma_chan->device->dev, @@ -70272,16 +70456,21 @@ index 0000000..43aed6e + if (host->blocks == 0) + return; + ++ dma_chan = host->dma_chan_rxtx; + if (host->data->flags & MMC_DATA_READ) { -+ dma_chan = host->dma_chan_rx; + dir_data = DMA_FROM_DEVICE; + dir_slave = DMA_DEV_TO_MEM; + } else { -+ dma_chan = host->dma_chan_tx; + dir_data = DMA_TO_DEVICE; + dir_slave = DMA_MEM_TO_DEV; + } + ++ /* The parameters have already been validated, so this will not fail */ ++ (void)dmaengine_slave_config(dma_chan, ++ (dir_data == DMA_FROM_DEVICE) ? ++ &host->dma_cfg_rx : ++ &host->dma_cfg_tx); ++ + BUG_ON(!dma_chan->device); + BUG_ON(!dma_chan->device->dev); + BUG_ON(!host->data->sg); @@ -70715,7 +70904,7 @@ index 0000000..43aed6e + if (host->data->flags & MMC_DATA_WRITE) { + /* IRQ handled here */ + -+ dma_chan = host->dma_chan_tx; ++ dma_chan = host->dma_chan_rxtx; + dir_data = DMA_TO_DEVICE; + dma_unmap_sg(dma_chan->device->dev, + host->data->sg, host->data->sg_len, @@ -71084,7 +71273,7 @@ index 0000000..43aed6e + /* host controller capabilities */ + mmc->caps |= MMC_CAP_CMD23 | MMC_CAP_ERASE | MMC_CAP_NEEDS_POLL | + MMC_CAP_SDIO_IRQ | MMC_CAP_SD_HIGHSPEED | -+ MMC_CAP_MMC_HIGHSPEED | MMC_CAP_4_BIT_DATA; ++ MMC_CAP_MMC_HIGHSPEED; + + mmc->caps2 |= MMC_CAP2_SDIO_IRQ_NOTHREAD; + @@ -71095,28 +71284,47 @@ index 0000000..43aed6e + dev_info(dev, "Forcing PIO mode\n"); + host->have_dma = false; +#else -+ if (IS_ERR_OR_NULL(host->dma_chan_tx) || -+ IS_ERR_OR_NULL(host->dma_chan_rx)) { -+ dev_err(dev, "%s: Unable to initialise DMA channels. Falling back to PIO\n", ++ if (IS_ERR_OR_NULL(host->dma_chan_rxtx)) { ++ dev_err(dev, "%s: Unable to initialise DMA channel. Falling back to PIO\n", + DRIVER_NAME); + host->have_dma = false; + } else { -+ dev_info(dev, "DMA channels allocated"); -+ host->have_dma = true; ++ dev_info(dev, "DMA channel allocated"); + + cfg.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; + cfg.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; + cfg.slave_id = 11; /* DREQ channel */ + ++ /* Validate the slave configurations */ ++ + cfg.direction = DMA_MEM_TO_DEV; + cfg.src_addr = 0; + cfg.dst_addr = host->bus_addr + SDHCI_BUFFER; -+ ret = dmaengine_slave_config(host->dma_chan_tx, &cfg); + -+ cfg.direction = DMA_DEV_TO_MEM; -+ cfg.src_addr = host->bus_addr + SDHCI_BUFFER; -+ cfg.dst_addr = 0; -+ ret = dmaengine_slave_config(host->dma_chan_rx, &cfg); ++ ret = dmaengine_slave_config(host->dma_chan_rxtx, &cfg); ++ ++ if (ret == 0) { ++ host->dma_cfg_tx = cfg; ++ ++ cfg.direction = DMA_DEV_TO_MEM; ++ cfg.src_addr = host->bus_addr + SDHCI_BUFFER; ++ cfg.dst_addr = 0; ++ ++ ret = dmaengine_slave_config(host->dma_chan_rxtx, &cfg); ++ } ++ ++ if (ret == 0) { ++ host->dma_cfg_rx = cfg; ++ ++ host->use_dma = true; ++ } else { ++ pr_err("%s: unable to configure DMA channel. " ++ "Faling back to PIO\n", ++ mmc_hostname(mmc)); ++ dma_release_channel(host->dma_chan_rxtx); ++ host->dma_chan_rxtx = NULL; ++ host->use_dma = false; ++ } + } +#endif + mmc->max_segs = 128; @@ -71195,16 +71403,20 @@ index 0000000..43aed6e + +#ifndef FORCE_PIO + if (node) { -+ host->dma_chan_tx = dma_request_slave_channel(dev, "tx"); -+ host->dma_chan_rx = dma_request_slave_channel(dev, "rx"); ++ host->dma_chan_rxtx = dma_request_slave_channel(dev, "rx-tx"); ++ if (!host->dma_chan_rxtx) ++ host->dma_chan_rxtx = ++ dma_request_slave_channel(dev, "tx"); ++ if (!host->dma_chan_rxtx) ++ host->dma_chan_rxtx = ++ dma_request_slave_channel(dev, "rx"); + } else { + dma_cap_mask_t mask; + + dma_cap_zero(mask); + /* we don't care about the channel, any would work */ + dma_cap_set(DMA_SLAVE, mask); -+ host->dma_chan_tx = dma_request_channel(mask, NULL, NULL); -+ host->dma_chan_rx = dma_request_channel(mask, NULL, NULL); ++ host->dma_chan_rxtx = dma_request_channel(mask, NULL, NULL); + } +#endif + clk = devm_clk_get(dev, NULL); @@ -71320,10 +71532,10 @@ index 0000000..43aed6e +MODULE_LICENSE("GPL v2"); +MODULE_AUTHOR("Gellert Weisz"); -From 756bf8b8f081be45e16d4d58d3fbe2ca073df298 Mon Sep 17 00:00:00 2001 +From 56c375164a7120be703d11e3614f78b3e5cb784d Mon Sep 17 00:00:00 2001 From: Phil Elwell <phil@raspberrypi.org> Date: Wed, 25 Mar 2015 17:49:47 +0000 -Subject: [PATCH 034/170] Adding bcm2835-sdhost driver, and an overlay to +Subject: [PATCH 037/112] Adding bcm2835-sdhost driver, and an overlay to enable it BCM2835 has two SD card interfaces. This driver uses the other one. @@ -71396,15 +71608,86 @@ The MMC card-discovery process generates timeouts. This is expected behaviour, so reporting it to the user serves no purpose. Suppress the reporting of timeout errors unless the debug flag is on. + +bcm2835-sdhost: Add workaround for odd behaviour on some cards + +For reasons not understood, the sdhost driver fails when reading +sectors very near the end of some SD cards. The problem could +be related to the similar issue that reading the final sector +of any card as part of a multiple read never completes, and the +workaround is an extension of the mechanism introduced to solve +that problem which ensures those sectors are always read singly. + +bcm2835-sdhost: Major revision + +This is a significant revision of the bcm2835-sdhost driver. It +improves on the original in a number of ways: + +1) Through the use of CMD23 for reads it appears to avoid problems + reading some sectors on certain high speed cards. +2) Better atomicity to prevent crashes. +3) Higher performance. +4) Activity logging included, for easier diagnosis in the event + of a problem. + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> + +bcm2835-sdhost: Restore ATOMIC flag to PIO sg mapping + +Allocation problems have been seen in a wireless driver, and +this is the only change which might have been responsible. + +SQUASH: bcm2835-sdhost: Only claim one DMA channel + +With both MMC controllers enabled there are few DMA channels left. The +bcm2835-sdhost driver only uses DMA in one direction at a time, so it +doesn't need to claim two channels. + +See: https://github.com/raspberrypi/linux/issues/1327 + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> + +bcm2835-sdhost: Workaround for "slow" sectors + +Some cards have been seen to cause timeouts after certain sectors are +read. This workaround enforces a minimum delay between the stop after +reading one of those sectors and a subsequent data command. + +Using CMD23 (SET_BLOCK_COUNT) avoids this problem, so good cards will +not be penalised by this workaround. + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> + +bcm2835-sdhost: Firmware manages the clock divisor + +The bcm2835-sdhost driver hands control of the CDIV clock divisor +register to matching firmware, allowing it to adjust to a changing +core clock. This removes the need to use the performance governor or +to enable io_is_busy on the on-demand governor in order to get the +best SD performance. + +N.B. As SD clocks must be an integer divisor of the core clock, it is +possible that the SD clock for "turbo" mode can be different (even +lower) than "normal" mode. + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> + +bcm2835-sdhost: Reset the clock in task context + +Since reprogramming the clock can now involve a round-trip to the +firmware it must not be done at atomic context, and a tasklet +is not a task. + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> --- drivers/mmc/host/Kconfig | 10 + drivers/mmc/host/Makefile | 1 + - drivers/mmc/host/bcm2835-sdhost.c | 1907 +++++++++++++++++++++++++++++++++++++ - 3 files changed, 1918 insertions(+) + drivers/mmc/host/bcm2835-sdhost.c | 2158 +++++++++++++++++++++++++++++++++++++ + 3 files changed, 2169 insertions(+) create mode 100644 drivers/mmc/host/bcm2835-sdhost.c diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig -index 9b72d2c..d509d10 100644 +index 0476061..2595474 100644 --- a/drivers/mmc/host/Kconfig +++ b/drivers/mmc/host/Kconfig @@ -33,6 +33,16 @@ config MMC_BCM2835_PIO_DMA_BARRIER @@ -71425,7 +71708,7 @@ index 9b72d2c..d509d10 100644 tristate "ARM AMBA Multimedia Card Interface support" depends on ARM_AMBA diff --git a/drivers/mmc/host/Makefile b/drivers/mmc/host/Makefile -index 6cf6457..df27ae9 100644 +index 3ba94f0..8daaa94 100644 --- a/drivers/mmc/host/Makefile +++ b/drivers/mmc/host/Makefile @@ -18,6 +18,7 @@ obj-$(CONFIG_MMC_SDHCI_S3C) += sdhci-s3c.o @@ -71438,15 +71721,15 @@ index 6cf6457..df27ae9 100644 obj-$(CONFIG_MMC_AU1X) += au1xmmc.o diff --git a/drivers/mmc/host/bcm2835-sdhost.c b/drivers/mmc/host/bcm2835-sdhost.c new file mode 100644 -index 0000000..da089985 +index 0000000..a57faed --- /dev/null +++ b/drivers/mmc/host/bcm2835-sdhost.c -@@ -0,0 +1,1907 @@ +@@ -0,0 +1,2158 @@ +/* + * BCM2835 SD host driver. + * + * Author: Phil Elwell <phil@raspberrypi.org> -+ * Copyright 2015 ++ * Copyright (C) 2015-2016 Raspberry Pi (Trading) Ltd. + * + * Based on + * mmc-bcm2835.c by Gellert Weisz @@ -71468,12 +71751,13 @@ index 0000000..da089985 + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + -+#define SAFE_READ_THRESHOLD 4 -+#define SAFE_WRITE_THRESHOLD 4 -+#define ALLOW_DMA 1 -+#define ALLOW_CMD23 0 -+#define ALLOW_FAST 1 -+#define USE_BLOCK_IRQ 1 ++#define FIFO_READ_THRESHOLD 4 ++#define FIFO_WRITE_THRESHOLD 4 ++#define ALLOW_CMD23_READ 1 ++#define ALLOW_CMD23_WRITE 0 ++#define ENABLE_LOG 1 ++#define SDDATA_FIFO_PIO_BURST 8 ++#define CMD_DALLY_US 1 + +#include <linux/delay.h> +#include <linux/module.h> @@ -71492,6 +71776,8 @@ index 0000000..da089985 +#include <linux/dma-mapping.h> +#include <linux/of_dma.h> +#include <linux/time.h> ++#include <linux/workqueue.h> ++#include <soc/bcm2835/raspberrypi-firmware.h> + +#define DRIVER_NAME "sdhost-bcm2835" + @@ -71554,6 +71840,28 @@ index 0000000..da089985 +#define SDEDM_READ_THRESHOLD_SHIFT 14 +#define SDEDM_THRESHOLD_MASK 0x1f + ++#define SDEDM_FSM_MASK 0xf ++#define SDEDM_FSM_IDENTMODE 0x0 ++#define SDEDM_FSM_DATAMODE 0x1 ++#define SDEDM_FSM_READDATA 0x2 ++#define SDEDM_FSM_WRITEDATA 0x3 ++#define SDEDM_FSM_READWAIT 0x4 ++#define SDEDM_FSM_READCRC 0x5 ++#define SDEDM_FSM_WRITECRC 0x6 ++#define SDEDM_FSM_WRITEWAIT1 0x7 ++#define SDEDM_FSM_POWERDOWN 0x8 ++#define SDEDM_FSM_POWERUP 0x9 ++#define SDEDM_FSM_WRITESTART1 0xa ++#define SDEDM_FSM_WRITESTART2 0xb ++#define SDEDM_FSM_GENPULSES 0xc ++#define SDEDM_FSM_WRITEWAIT2 0xd ++#define SDEDM_FSM_STARTPOWDOWN 0xf ++ ++#define SDDATA_FIFO_WORDS 16 ++ ++#define USE_CMD23_FLAGS ((ALLOW_CMD23_READ * MMC_DATA_READ) | \ ++ (ALLOW_CMD23_WRITE * MMC_DATA_WRITE)) ++ +#define MHZ 1000000 + + @@ -71575,15 +71883,17 @@ index 0000000..da089985 + + struct tasklet_struct finish_tasklet; /* Tasklet structures */ + -+ struct timer_list timer; /* Timer for timeouts */ ++ struct work_struct cmd_wait_wq; /* Workqueue function */ + -+ struct timer_list pio_timer; /* PIO error detection timer */ ++ struct timer_list timer; /* Timer for timeouts */ + + struct sg_mapping_iter sg_miter; /* SG state for PIO */ + unsigned int blocks; /* remaining PIO blocks */ + + int irq; /* Device IRQ */ + ++ u32 cmd_quick_poll_retries; ++ u32 ns_per_fifo_word; + + /* cached registers */ + u32 hcfg; @@ -71598,27 +71908,128 @@ index 0000000..da089985 + + unsigned int use_busy:1; /* Wait for busy interrupt */ + -+ unsigned int debug:1; /* Enable debug output */ ++ unsigned int use_sbc:1; /* Send CMD23 */ + -+ u32 thread_isr; ++ unsigned int debug:1; /* Enable debug output */ ++ unsigned int firmware_sets_cdiv:1; /* Let the firmware manage the clock */ ++ unsigned int reset_clock:1; /* Reset the clock fore the next request */ + + /*DMA part*/ -+ struct dma_chan *dma_chan_rx; /* DMA channel for reads */ -+ struct dma_chan *dma_chan_tx; /* DMA channel for writes */ ++ struct dma_chan *dma_chan_rxtx; /* DMA channel for reads and writes */ ++ struct dma_chan *dma_chan; /* Channel in use */ ++ struct dma_slave_config dma_cfg_rx; ++ struct dma_slave_config dma_cfg_tx; ++ struct dma_async_tx_descriptor *dma_desc; ++ u32 dma_dir; ++ u32 drain_words; ++ struct page *drain_page; ++ u32 drain_offset; + + bool allow_dma; -+ bool have_dma; + bool use_dma; + /*end of DMA part*/ + + int max_delay; /* maximum length of time spent waiting */ + struct timeval stop_time; /* when the last stop was issued */ + u32 delay_after_stop; /* minimum time between stop and subsequent data transfer */ ++ u32 delay_after_this_stop; /* minimum time between this stop and subsequent data transfer */ + u32 overclock_50; /* frequency to use when 50MHz is requested (in MHz) */ + u32 overclock; /* Current frequency if overclocked, else zero */ + u32 pio_limit; /* Maximum block count for PIO (0 = always DMA) */ ++ ++ u32 sectors; /* Cached card size in sectors */ +}; + ++#if ENABLE_LOG ++ ++struct log_entry_struct { ++ char event[4]; ++ u32 timestamp; ++ u32 param1; ++ u32 param2; ++}; ++ ++typedef struct log_entry_struct LOG_ENTRY_T; ++ ++LOG_ENTRY_T *sdhost_log_buf; ++dma_addr_t sdhost_log_addr; ++static u32 sdhost_log_idx; ++static spinlock_t log_lock; ++static void __iomem *timer_base; ++ ++#define LOG_ENTRIES (256*1) ++#define LOG_SIZE (sizeof(LOG_ENTRY_T)*LOG_ENTRIES) ++ ++static void log_init(u32 bus_to_phys) ++{ ++ spin_lock_init(&log_lock); ++ sdhost_log_buf = dma_zalloc_coherent(NULL, LOG_SIZE, &sdhost_log_addr, ++ GFP_KERNEL); ++ if (sdhost_log_buf) { ++ pr_info("sdhost: log_buf @ %p (%x)\n", ++ sdhost_log_buf, sdhost_log_addr); ++ timer_base = ioremap_nocache(bus_to_phys + 0x7e003000, SZ_4K); ++ if (!timer_base) ++ pr_err("sdhost: failed to remap timer\n"); ++ } ++ else ++ pr_err("sdhost: failed to allocate log buf\n"); ++} ++ ++static void log_event_impl(const char *event, u32 param1, u32 param2) ++{ ++ if (sdhost_log_buf) { ++ LOG_ENTRY_T *entry; ++ unsigned long flags; ++ ++ spin_lock_irqsave(&log_lock, flags); ++ ++ entry = sdhost_log_buf + sdhost_log_idx; ++ memcpy(entry->event, event, 4); ++ entry->timestamp = (readl(timer_base + 4) & 0x3fffffff) + ++ (smp_processor_id()<<30); ++ entry->param1 = param1; ++ entry->param2 = param2; ++ sdhost_log_idx = (sdhost_log_idx + 1) % LOG_ENTRIES; ++ ++ spin_unlock_irqrestore(&log_lock, flags); ++ } ++} ++ ++static void log_dump(void) ++{ ++ if (sdhost_log_buf) { ++ LOG_ENTRY_T *entry; ++ unsigned long flags; ++ int idx; ++ ++ spin_lock_irqsave(&log_lock, flags); ++ ++ idx = sdhost_log_idx; ++ do { ++ entry = sdhost_log_buf + idx; ++ if (entry->event[0] != '\0') ++ pr_err("[%08x] %.4s %x %x\n", ++ entry->timestamp, ++ entry->event, ++ entry->param1, ++ entry->param2); ++ idx = (idx + 1) % LOG_ENTRIES; ++ } while (idx != sdhost_log_idx); ++ ++ spin_unlock_irqrestore(&log_lock, flags); ++ } ++} ++ ++#define log_event(event, param1, param2) log_event_impl(event, param1, param2) ++ ++#else ++ ++#define log_init(x) (void)0 ++#define log_event(event, param1, param2) (void)0 ++#define log_dump() (void)0 ++ ++#endif + +static inline void bcm2835_sdhost_write(struct bcm2835_host *host, u32 val, int reg) +{ @@ -71640,7 +72051,7 @@ index 0000000..da089985 + const char *label) +{ + if (cmd) -+ pr_info("%s:%c%s op %d arg 0x%x flags 0x%x - resp %08x %08x %08x %08x, err %d\n", ++ pr_err("%s:%c%s op %d arg 0x%x flags 0x%x - resp %08x %08x %08x %08x, err %d\n", + mmc_hostname(host->mmc), + (cmd == host->cmd) ? '>' : ' ', + label, cmd->opcode, cmd->arg, cmd->flags, @@ -71650,77 +72061,81 @@ index 0000000..da089985 + +static void bcm2835_sdhost_dumpregs(struct bcm2835_host *host) +{ -+ bcm2835_sdhost_dumpcmd(host, host->mrq->sbc, "sbc"); -+ bcm2835_sdhost_dumpcmd(host, host->mrq->cmd, "cmd"); -+ if (host->mrq->data) -+ pr_err("%s: data blocks %x blksz %x - err %d\n", -+ mmc_hostname(host->mmc), -+ host->mrq->data->blocks, -+ host->mrq->data->blksz, -+ host->mrq->data->error); -+ bcm2835_sdhost_dumpcmd(host, host->mrq->stop, "stop"); ++ if (host->mrq) ++ { ++ bcm2835_sdhost_dumpcmd(host, host->mrq->sbc, "sbc"); ++ bcm2835_sdhost_dumpcmd(host, host->mrq->cmd, "cmd"); ++ if (host->mrq->data) ++ pr_err("%s: data blocks %x blksz %x - err %d\n", ++ mmc_hostname(host->mmc), ++ host->mrq->data->blocks, ++ host->mrq->data->blksz, ++ host->mrq->data->error); ++ bcm2835_sdhost_dumpcmd(host, host->mrq->stop, "stop"); ++ } + -+ pr_info("%s: =========== REGISTER DUMP ===========\n", ++ pr_err("%s: =========== REGISTER DUMP ===========\n", + mmc_hostname(host->mmc)); + -+ pr_info("%s: SDCMD 0x%08x\n", ++ pr_err("%s: SDCMD 0x%08x\n", + mmc_hostname(host->mmc), + bcm2835_sdhost_read(host, SDCMD)); -+ pr_info("%s: SDARG 0x%08x\n", ++ pr_err("%s: SDARG 0x%08x\n", + mmc_hostname(host->mmc), + bcm2835_sdhost_read(host, SDARG)); -+ pr_info("%s: SDTOUT 0x%08x\n", ++ pr_err("%s: SDTOUT 0x%08x\n", + mmc_hostname(host->mmc), + bcm2835_sdhost_read(host, SDTOUT)); -+ pr_info("%s: SDCDIV 0x%08x\n", ++ pr_err("%s: SDCDIV 0x%08x\n", + mmc_hostname(host->mmc), + bcm2835_sdhost_read(host, SDCDIV)); -+ pr_info("%s: SDRSP0 0x%08x\n", ++ pr_err("%s: SDRSP0 0x%08x\n", + mmc_hostname(host->mmc), + bcm2835_sdhost_read(host, SDRSP0)); -+ pr_info("%s: SDRSP1 0x%08x\n", ++ pr_err("%s: SDRSP1 0x%08x\n", + mmc_hostname(host->mmc), + bcm2835_sdhost_read(host, SDRSP1)); -+ pr_info("%s: SDRSP2 0x%08x\n", ++ pr_err("%s: SDRSP2 0x%08x\n", + mmc_hostname(host->mmc), + bcm2835_sdhost_read(host, SDRSP2)); -+ pr_info("%s: SDRSP3 0x%08x\n", ++ pr_err("%s: SDRSP3 0x%08x\n", + mmc_hostname(host->mmc), + bcm2835_sdhost_read(host, SDRSP3)); -+ pr_info("%s: SDHSTS 0x%08x\n", ++ pr_err("%s: SDHSTS 0x%08x\n", + mmc_hostname(host->mmc), + bcm2835_sdhost_read(host, SDHSTS)); -+ pr_info("%s: SDVDD 0x%08x\n", ++ pr_err("%s: SDVDD 0x%08x\n", + mmc_hostname(host->mmc), + bcm2835_sdhost_read(host, SDVDD)); -+ pr_info("%s: SDEDM 0x%08x\n", ++ pr_err("%s: SDEDM 0x%08x\n", + mmc_hostname(host->mmc), + bcm2835_sdhost_read(host, SDEDM)); -+ pr_info("%s: SDHCFG 0x%08x\n", ++ pr_err("%s: SDHCFG 0x%08x\n", + mmc_hostname(host->mmc), + bcm2835_sdhost_read(host, SDHCFG)); -+ pr_info("%s: SDHBCT 0x%08x\n", ++ pr_err("%s: SDHBCT 0x%08x\n", + mmc_hostname(host->mmc), + bcm2835_sdhost_read(host, SDHBCT)); -+ pr_info("%s: SDHBLC 0x%08x\n", ++ pr_err("%s: SDHBLC 0x%08x\n", + mmc_hostname(host->mmc), + bcm2835_sdhost_read(host, SDHBLC)); + -+ pr_info("%s: ===========================================\n", ++ pr_err("%s: ===========================================\n", + mmc_hostname(host->mmc)); +} + -+ +static void bcm2835_sdhost_set_power(struct bcm2835_host *host, bool on) +{ + bcm2835_sdhost_write(host, on ? 1 : 0, SDVDD); +} + -+ +static void bcm2835_sdhost_reset_internal(struct bcm2835_host *host) +{ + u32 temp; + ++ if (host->debug) ++ pr_info("%s: reset\n", mmc_hostname(host->mmc)); ++ + bcm2835_sdhost_set_power(host, false); + + bcm2835_sdhost_write(host, 0, SDCMD); @@ -71736,26 +72151,25 @@ index 0000000..da089985 + temp = bcm2835_sdhost_read(host, SDEDM); + temp &= ~((SDEDM_THRESHOLD_MASK<<SDEDM_READ_THRESHOLD_SHIFT) | + (SDEDM_THRESHOLD_MASK<<SDEDM_WRITE_THRESHOLD_SHIFT)); -+ temp |= (SAFE_READ_THRESHOLD << SDEDM_READ_THRESHOLD_SHIFT) | -+ (SAFE_WRITE_THRESHOLD << SDEDM_WRITE_THRESHOLD_SHIFT); ++ temp |= (FIFO_READ_THRESHOLD << SDEDM_READ_THRESHOLD_SHIFT) | ++ (FIFO_WRITE_THRESHOLD << SDEDM_WRITE_THRESHOLD_SHIFT); + bcm2835_sdhost_write(host, temp, SDEDM); + mdelay(10); + bcm2835_sdhost_set_power(host, true); + mdelay(10); + host->clock = 0; ++ host->sectors = 0; + bcm2835_sdhost_write(host, host->hcfg, SDHCFG); -+ bcm2835_sdhost_write(host, host->cdiv, SDCDIV); ++ bcm2835_sdhost_write(host, SDCDIV_MAX_CDIV, SDCDIV); + mmiowb(); +} + -+ +static void bcm2835_sdhost_reset(struct mmc_host *mmc) +{ + struct bcm2835_host *host = mmc_priv(mmc); + unsigned long flags; -+ if (host->debug) -+ pr_info("%s: reset\n", mmc_hostname(mmc)); + spin_lock_irqsave(&host->lock, flags); ++ log_event("RST<", 0, 0); + + bcm2835_sdhost_reset_internal(host); + @@ -71780,82 +72194,48 @@ index 0000000..da089985 + } +} + -+static bool bcm2835_sdhost_is_write_complete(struct bcm2835_host *host) ++static void bcm2835_sdhost_wait_transfer_complete(struct bcm2835_host *host) +{ -+ bool write_complete = ((bcm2835_sdhost_read(host, SDEDM) & 0xf) == 1); -+ -+ if (!write_complete) { -+ /* Request an IRQ for the last block */ -+ host->hcfg |= SDHCFG_BLOCK_IRPT_EN; -+ bcm2835_sdhost_write(host, host->hcfg, SDHCFG); -+ if ((bcm2835_sdhost_read(host, SDEDM) & 0xf) == 1) { -+ /* The write has now completed. Disable the interrupt -+ and clear the status flag */ -+ host->hcfg &= ~SDHCFG_BLOCK_IRPT_EN; -+ bcm2835_sdhost_write(host, host->hcfg, SDHCFG); -+ bcm2835_sdhost_write(host, SDHSTS_BLOCK_IRPT, SDHSTS); -+ write_complete = true; -+ } -+ } ++ int timediff; ++ u32 alternate_idle; ++ u32 edm; + -+ return write_complete; -+} ++ alternate_idle = (host->mrq->data->flags & MMC_DATA_READ) ? ++ SDEDM_FSM_READWAIT : SDEDM_FSM_WRITESTART1; + -+static void bcm2835_sdhost_wait_write_complete(struct bcm2835_host *host) -+{ -+ int timediff; -+#ifdef DEBUG -+ static struct timeval start_time; -+ static int max_stall_time = 0; -+ static int total_stall_time = 0; -+ struct timeval before, after; ++ edm = bcm2835_sdhost_read(host, SDEDM); + -+ do_gettimeofday(&before); -+ if (max_stall_time == 0) -+ start_time = before; -+#endif ++ log_event("WTC<", edm, 0); + + timediff = 0; + + while (1) { -+ u32 edm = bcm2835_sdhost_read(host, SDEDM); -+ if ((edm & 0xf) == 1) ++ u32 fsm = edm & SDEDM_FSM_MASK; ++ if ((fsm == SDEDM_FSM_IDENTMODE) || ++ (fsm == SDEDM_FSM_DATAMODE)) + break; -+ timediff++; -+ if (timediff > 5000000) { -+#ifdef DEBUG -+ do_gettimeofday(&after); -+ timediff = (after.tv_sec - before.tv_sec)*1000000 + -+ (after.tv_usec - before.tv_usec); ++ if (fsm == alternate_idle) { ++ bcm2835_sdhost_write(host, ++ edm | SDEDM_FORCE_DATA_MODE, ++ SDEDM); ++ break; ++ } + -+ pr_err(" wait_write_complete - still waiting after %dus\n", -+ timediff); -+#else -+ pr_err(" wait_write_complete - still waiting after %d retries\n", ++ timediff++; ++ if (timediff == 100000) { ++ pr_err("%s: wait_transfer_complete - still waiting after %d retries\n", ++ mmc_hostname(host->mmc), + timediff); -+#endif ++ log_dump(); + bcm2835_sdhost_dumpregs(host); -+ host->data->error = -ETIMEDOUT; ++ host->mrq->data->error = -ETIMEDOUT; ++ log_event("WTC!", edm, 0); + return; + } ++ cpu_relax(); ++ edm = bcm2835_sdhost_read(host, SDEDM); + } -+ -+#ifdef DEBUG -+ do_gettimeofday(&after); -+ timediff = (after.tv_sec - before.tv_sec)*1000000 + (after.tv_usec - before.tv_usec); -+ -+ total_stall_time += timediff; -+ if (timediff > max_stall_time) -+ max_stall_time = timediff; -+ -+ if ((after.tv_sec - start_time.tv_sec) > 10) { -+ pr_debug(" wait_write_complete - max wait %dus, total %dus\n", -+ max_stall_time, total_stall_time); -+ start_time = after; -+ max_stall_time = 0; -+ total_stall_time = 0; -+ } -+#endif ++ log_event("WTC>", edm, 0); +} + +static void bcm2835_sdhost_finish_data(struct bcm2835_host *host); @@ -71863,65 +72243,44 @@ index 0000000..da089985 +static void bcm2835_sdhost_dma_complete(void *param) +{ + struct bcm2835_host *host = param; -+ struct dma_chan *dma_chan; ++ struct mmc_data *data = host->data; + unsigned long flags; -+ u32 dir_data; + + spin_lock_irqsave(&host->lock, flags); ++ log_event("DMA<", (u32)host->data, bcm2835_sdhost_read(host, SDHSTS)); ++ log_event("DMA ", bcm2835_sdhost_read(host, SDCMD), ++ bcm2835_sdhost_read(host, SDEDM)); + -+ if (host->data) { -+ bool write_complete; -+ if (USE_BLOCK_IRQ) -+ write_complete = bcm2835_sdhost_is_write_complete(host); -+ else { -+ bcm2835_sdhost_wait_write_complete(host); -+ write_complete = true; -+ } -+ pr_debug("dma_complete() - write_complete=%d\n", -+ write_complete); ++ if (host->dma_chan) { ++ dma_unmap_sg(host->dma_chan->device->dev, ++ data->sg, data->sg_len, ++ host->dma_dir); + -+ if (write_complete || (host->data->flags & MMC_DATA_READ)) -+ { -+ if (write_complete) { -+ dma_chan = host->dma_chan_tx; -+ dir_data = DMA_TO_DEVICE; -+ } else { -+ dma_chan = host->dma_chan_rx; -+ dir_data = DMA_FROM_DEVICE; -+ } ++ host->dma_chan = NULL; ++ } + -+ dma_unmap_sg(dma_chan->device->dev, -+ host->data->sg, host->data->sg_len, -+ dir_data); ++ if (host->drain_words) { ++ void *page; ++ u32 *buf; + -+ bcm2835_sdhost_finish_data(host); ++ page = kmap_atomic(host->drain_page); ++ buf = page + host->drain_offset; ++ ++ while (host->drain_words) { ++ u32 edm = bcm2835_sdhost_read(host, SDEDM); ++ if ((edm >> 4) & 0x1f) ++ *(buf++) = bcm2835_sdhost_read(host, ++ SDDATA); ++ host->drain_words--; + } ++ ++ kunmap_atomic(page); + } + -+ spin_unlock_irqrestore(&host->lock, flags); -+} ++ bcm2835_sdhost_finish_data(host); + -+static bool data_transfer_wait(struct bcm2835_host *host) -+{ -+ unsigned long timeout = 1000000; -+ while (timeout) -+ { -+ u32 sdhsts = bcm2835_sdhost_read(host, SDHSTS); -+ if (sdhsts & SDHSTS_DATA_FLAG) { -+ bcm2835_sdhost_write(host, SDHSTS_DATA_FLAG, SDHSTS); -+ break; -+ } -+ timeout--; -+ } -+ if (timeout == 0) { -+ pr_err("%s: Data %s timeout\n", -+ mmc_hostname(host->mmc), -+ (host->data->flags & MMC_DATA_READ) ? "read" : "write"); -+ bcm2835_sdhost_dumpregs(host); -+ host->data->error = -ETIMEDOUT; -+ return false; -+ } -+ return true; ++ log_event("DMA>", (u32)host->data, 0); ++ spin_unlock_irqrestore(&host->lock, flags); +} + +static void bcm2835_sdhost_read_block_pio(struct bcm2835_host *host) @@ -71929,32 +72288,83 @@ index 0000000..da089985 + unsigned long flags; + size_t blksize, len; + u32 *buf; ++ unsigned long wait_max; + + blksize = host->data->blksz; + ++ wait_max = jiffies + msecs_to_jiffies(host->pio_timeout); ++ + local_irq_save(flags); + + while (blksize) { -+ if (!sg_miter_next(&host->sg_miter)) -+ BUG(); ++ int copy_words; ++ u32 hsts = 0; ++ ++ if (!sg_miter_next(&host->sg_miter)) { ++ host->data->error = -EINVAL; ++ break; ++ } + + len = min(host->sg_miter.length, blksize); -+ BUG_ON(len % 4); ++ if (len % 4) { ++ host->data->error = -EINVAL; ++ break; ++ } + + blksize -= len; + host->sg_miter.consumed = len; + + buf = (u32 *)host->sg_miter.addr; + -+ while (len) { -+ if (!data_transfer_wait(host)) -+ break; ++ copy_words = len/4; ++ ++ while (copy_words) { ++ int burst_words, words; ++ u32 edm; ++ ++ burst_words = SDDATA_FIFO_PIO_BURST; ++ if (burst_words > copy_words) ++ burst_words = copy_words; ++ edm = bcm2835_sdhost_read(host, SDEDM); ++ words = ((edm >> 4) & 0x1f); ++ ++ if (words < burst_words) { ++ int fsm_state = (edm & SDEDM_FSM_MASK); ++ if ((fsm_state != SDEDM_FSM_READDATA) && ++ (fsm_state != SDEDM_FSM_READWAIT) && ++ (fsm_state != SDEDM_FSM_READCRC)) { ++ hsts = bcm2835_sdhost_read(host, ++ SDHSTS); ++ pr_err("%s: fsm %x, hsts %x\n", ++ mmc_hostname(host->mmc), ++ fsm_state, hsts); ++ if (hsts & SDHSTS_ERROR_MASK) ++ break; ++ } ++ ++ if (time_after(jiffies, wait_max)) { ++ pr_err("%s: PIO read timeout - EDM %x\n", ++ mmc_hostname(host->mmc), ++ edm); ++ hsts = SDHSTS_REW_TIME_OUT; ++ break; ++ } ++ ndelay((burst_words - words) * ++ host->ns_per_fifo_word); ++ continue; ++ } else if (words > copy_words) { ++ words = copy_words; ++ } ++ ++ copy_words -= words; + -+ *(buf++) = bcm2835_sdhost_read(host, SDDATA); -+ len -= 4; ++ while (words) { ++ *(buf++) = bcm2835_sdhost_read(host, SDDATA); ++ words--; ++ } + } + -+ if (host->data->error) ++ if (hsts & SDHSTS_ERROR_MASK) + break; + } + @@ -71968,32 +72378,83 @@ index 0000000..da089985 + unsigned long flags; + size_t blksize, len; + u32 *buf; ++ unsigned long wait_max; + + blksize = host->data->blksz; + ++ wait_max = jiffies + msecs_to_jiffies(host->pio_timeout); ++ + local_irq_save(flags); + + while (blksize) { -+ if (!sg_miter_next(&host->sg_miter)) -+ BUG(); ++ int copy_words; ++ u32 hsts = 0; ++ ++ if (!sg_miter_next(&host->sg_miter)) { ++ host->data->error = -EINVAL; ++ break; ++ } + + len = min(host->sg_miter.length, blksize); -+ BUG_ON(len % 4); ++ if (len % 4) { ++ host->data->error = -EINVAL; ++ break; ++ } + + blksize -= len; + host->sg_miter.consumed = len; + -+ buf = host->sg_miter.addr; ++ buf = (u32 *)host->sg_miter.addr; + -+ while (len) { -+ if (!data_transfer_wait(host)) -+ break; ++ copy_words = len/4; ++ ++ while (copy_words) { ++ int burst_words, words; ++ u32 edm; ++ ++ burst_words = SDDATA_FIFO_PIO_BURST; ++ if (burst_words > copy_words) ++ burst_words = copy_words; ++ edm = bcm2835_sdhost_read(host, SDEDM); ++ words = SDDATA_FIFO_WORDS - ((edm >> 4) & 0x1f); ++ ++ if (words < burst_words) { ++ int fsm_state = (edm & SDEDM_FSM_MASK); ++ if ((fsm_state != SDEDM_FSM_WRITEDATA) && ++ (fsm_state != SDEDM_FSM_WRITESTART1) && ++ (fsm_state != SDEDM_FSM_WRITESTART2)) { ++ hsts = bcm2835_sdhost_read(host, ++ SDHSTS); ++ pr_err("%s: fsm %x, hsts %x\n", ++ mmc_hostname(host->mmc), ++ fsm_state, hsts); ++ if (hsts & SDHSTS_ERROR_MASK) ++ break; ++ } ++ ++ if (time_after(jiffies, wait_max)) { ++ pr_err("%s: PIO write timeout - EDM %x\n", ++ mmc_hostname(host->mmc), ++ edm); ++ hsts = SDHSTS_REW_TIME_OUT; ++ break; ++ } ++ ndelay((burst_words - words) * ++ host->ns_per_fifo_word); ++ continue; ++ } else if (words > copy_words) { ++ words = copy_words; ++ } + -+ bcm2835_sdhost_write(host, *(buf++), SDDATA); -+ len -= 4; ++ copy_words -= words; ++ ++ while (words) { ++ bcm2835_sdhost_write(host, *(buf++), SDDATA); ++ words--; ++ } + } + -+ if (host->data->error) ++ if (hsts & SDHSTS_ERROR_MASK) + break; + } + @@ -72002,12 +72463,12 @@ index 0000000..da089985 + local_irq_restore(flags); +} + -+ +static void bcm2835_sdhost_transfer_pio(struct bcm2835_host *host) +{ + u32 sdhsts; + bool is_read; + BUG_ON(!host->data); ++ log_event("XFP<", (u32)host->data, host->blocks); + + is_read = (host->data->flags & MMC_DATA_READ) != 0; + if (is_read) @@ -72031,65 +72492,99 @@ index 0000000..da089985 + is_read ? "read" : "write", + sdhsts); + host->data->error = -ETIMEDOUT; -+ } else if (!is_read && !host->data->error) { -+ /* Start a timer in case a transfer error occurs because -+ there is no error interrupt */ -+ mod_timer(&host->pio_timer, jiffies + host->pio_timeout); + } ++ log_event("XFP>", (u32)host->data, host->blocks); +} + -+ -+static void bcm2835_sdhost_transfer_dma(struct bcm2835_host *host) ++static void bcm2835_sdhost_prepare_dma(struct bcm2835_host *host, ++ struct mmc_data *data) +{ -+ u32 len, dir_data, dir_slave; ++ int len, dir_data, dir_slave; + struct dma_async_tx_descriptor *desc = NULL; + struct dma_chan *dma_chan; + -+ pr_debug("bcm2835_sdhost_transfer_dma()\n"); -+ -+ WARN_ON(!host->data); -+ -+ if (!host->data) -+ return; ++ log_event("PRD<", (u32)data, 0); ++ pr_debug("bcm2835_sdhost_prepare_dma()\n"); + -+ if (host->data->flags & MMC_DATA_READ) { -+ dma_chan = host->dma_chan_rx; ++ dma_chan = host->dma_chan_rxtx; ++ if (data->flags & MMC_DATA_READ) { + dir_data = DMA_FROM_DEVICE; + dir_slave = DMA_DEV_TO_MEM; + } else { -+ dma_chan = host->dma_chan_tx; + dir_data = DMA_TO_DEVICE; + dir_slave = DMA_MEM_TO_DEV; + } ++ log_event("PRD1", (u32)dma_chan, 0); + + BUG_ON(!dma_chan->device); + BUG_ON(!dma_chan->device->dev); -+ BUG_ON(!host->data->sg); ++ BUG_ON(!data->sg); + -+ len = dma_map_sg(dma_chan->device->dev, host->data->sg, -+ host->data->sg_len, dir_data); -+ if (len > 0) { -+ desc = dmaengine_prep_slave_sg(dma_chan, host->data->sg, ++ /* The block doesn't manage the FIFO DREQs properly for multi-block ++ transfers, so don't attempt to DMA the final few words. ++ Unfortunately this requires the final sg entry to be trimmed. ++ N.B. This code demands that the overspill is contained in ++ a single sg entry. ++ */ ++ ++ host->drain_words = 0; ++ if ((data->blocks > 1) && (dir_data == DMA_FROM_DEVICE)) { ++ struct scatterlist *sg; ++ u32 len; ++ int i; ++ ++ len = min((u32)(FIFO_READ_THRESHOLD - 1) * 4, ++ (u32)data->blocks * data->blksz); ++ ++ for_each_sg(data->sg, sg, data->sg_len, i) { ++ if (sg_is_last(sg)) { ++ BUG_ON(sg->length < len); ++ sg->length -= len; ++ host->drain_page = (struct page *)sg->page_link; ++ host->drain_offset = sg->offset + sg->length; ++ } ++ } ++ host->drain_words = len/4; ++ } ++ ++ /* The parameters have already been validated, so this will not fail */ ++ (void)dmaengine_slave_config(dma_chan, ++ (dir_data == DMA_FROM_DEVICE) ? ++ &host->dma_cfg_rx : ++ &host->dma_cfg_tx); ++ ++ len = dma_map_sg(dma_chan->device->dev, data->sg, data->sg_len, ++ dir_data); ++ ++ log_event("PRD2", len, 0); ++ if (len > 0) ++ desc = dmaengine_prep_slave_sg(dma_chan, data->sg, + len, dir_slave, + DMA_PREP_INTERRUPT | DMA_CTRL_ACK); -+ } else { -+ dev_err(mmc_dev(host->mmc), "dma_map_sg returned zero length\n"); -+ } ++ log_event("PRD3", (u32)desc, 0); ++ + if (desc) { + desc->callback = bcm2835_sdhost_dma_complete; + desc->callback_param = host; -+ dmaengine_submit(desc); -+ dma_async_issue_pending(dma_chan); ++ host->dma_desc = desc; ++ host->dma_chan = dma_chan; ++ host->dma_dir = dir_data; + } -+ ++ log_event("PDM>", (u32)data, 0); +} + ++static void bcm2835_sdhost_start_dma(struct bcm2835_host *host) ++{ ++ log_event("SDMA", (u32)host->data, (u32)host->dma_chan); ++ dmaengine_submit(host->dma_desc); ++ dma_async_issue_pending(host->dma_chan); ++} + +static void bcm2835_sdhost_set_transfer_irqs(struct bcm2835_host *host) +{ + u32 all_irqs = SDHCFG_DATA_IRPT_EN | SDHCFG_BLOCK_IRPT_EN | + SDHCFG_BUSY_IRPT_EN; -+ if (host->use_dma) ++ if (host->dma_desc) + host->hcfg = (host->hcfg & ~all_irqs) | + SDHCFG_BUSY_IRPT_EN; + else @@ -72100,13 +72595,13 @@ index 0000000..da089985 + bcm2835_sdhost_write(host, host->hcfg, SDHCFG); +} + -+ +static void bcm2835_sdhost_prepare_data(struct bcm2835_host *host, struct mmc_command *cmd) +{ + struct mmc_data *data = cmd->data; + + WARN_ON(host->data); + ++ host->data = data; + if (!data) + return; + @@ -72115,16 +72610,32 @@ index 0000000..da089985 + BUG_ON(data->blksz > host->mmc->max_blk_size); + BUG_ON(data->blocks > 65535); + -+ host->data = data; + host->data_complete = 0; + host->flush_fifo = 0; + host->data->bytes_xfered = 0; + -+ host->use_dma = host->have_dma && (data->blocks > host->pio_limit); -+ if (!host->use_dma) { -+ int flags; ++ if (!host->sectors && host->mmc->card) { ++ struct mmc_card *card = host->mmc->card; ++ if (!mmc_card_sd(card) && mmc_card_blockaddr(card)) { ++ /* ++ * The EXT_CSD sector count is in number of 512 byte ++ * sectors. ++ */ ++ host->sectors = card->ext_csd.sectors; ++ } else { ++ /* ++ * The CSD capacity field is in units of read_blkbits. ++ * set_capacity takes units of 512 bytes. ++ */ ++ host->sectors = card->csd.capacity << ++ (card->csd.read_blkbits - 9); ++ } ++ } ++ ++ if (!host->dma_desc) { ++ /* Use PIO */ ++ int flags = SG_MITER_ATOMIC; + -+ flags = SG_MITER_ATOMIC; + if (data->flags & MMC_DATA_READ) + flags |= SG_MITER_TO_SG; + else @@ -72136,19 +72647,20 @@ index 0000000..da089985 + bcm2835_sdhost_set_transfer_irqs(host); + + bcm2835_sdhost_write(host, data->blksz, SDHBCT); -+ bcm2835_sdhost_write(host, host->use_dma ? data->blocks : 0, SDHBLC); ++ bcm2835_sdhost_write(host, data->blocks, SDHBLC); + + BUG_ON(!host->data); +} + -+ -+void bcm2835_sdhost_send_command(struct bcm2835_host *host, struct mmc_command *cmd) ++bool bcm2835_sdhost_send_command(struct bcm2835_host *host, ++ struct mmc_command *cmd) +{ + u32 sdcmd, sdhsts; + unsigned long timeout; + int delay; + + WARN_ON(host->cmd); ++ log_event("CMD<", cmd->opcode, cmd->arg); + + if (cmd->data) + pr_debug("%s: send_command %d 0x%x " @@ -72171,9 +72683,9 @@ index 0000000..da089985 + pr_err("%s: previous command never completed.\n", + mmc_hostname(host->mmc)); + bcm2835_sdhost_dumpregs(host); -+ cmd->error = -EIO; ++ cmd->error = -EILSEQ; + tasklet_schedule(&host->finish_tasklet); -+ return; ++ return false; + } + timeout--; + udelay(10); @@ -72201,23 +72713,24 @@ index 0000000..da089985 + if (sdhsts & SDHSTS_ERROR_MASK) + bcm2835_sdhost_write(host, sdhsts, SDHSTS); + -+ bcm2835_sdhost_prepare_data(host, cmd); -+ -+ bcm2835_sdhost_write(host, cmd->arg, SDARG); -+ + if ((cmd->flags & MMC_RSP_136) && (cmd->flags & MMC_RSP_BUSY)) { + pr_err("%s: unsupported response type!\n", + mmc_hostname(host->mmc)); + cmd->error = -EINVAL; + tasklet_schedule(&host->finish_tasklet); -+ return; ++ return false; + } + ++ bcm2835_sdhost_prepare_data(host, cmd); ++ ++ bcm2835_sdhost_write(host, cmd->arg, SDARG); ++ + sdcmd = cmd->opcode & SDCMD_CMD_MASK; + -+ if (!(cmd->flags & MMC_RSP_PRESENT)) ++ host->use_busy = 0; ++ if (!(cmd->flags & MMC_RSP_PRESENT)) { + sdcmd |= SDCMD_NO_RESPONSE; -+ else { ++ } else { + if (cmd->flags & MMC_RSP_136) + sdcmd |= SDCMD_LONG_RESPONSE; + if (cmd->flags & MMC_RSP_BUSY) { @@ -72227,7 +72740,8 @@ index 0000000..da089985 + } + + if (cmd->data) { -+ if (host->delay_after_stop) { ++ log_event("CMDD", cmd->data->blocks, cmd->data->blksz); ++ if (host->delay_after_this_stop) { + struct timeval now; + int time_since_stop; + do_gettimeofday(&now); @@ -72236,12 +72750,32 @@ index 0000000..da089985 + /* Possibly less than one second */ + time_since_stop = time_since_stop * 1000000 + + (now.tv_usec - host->stop_time.tv_usec); -+ if (time_since_stop < host->delay_after_stop) -+ udelay(host->delay_after_stop - ++ if (time_since_stop < ++ host->delay_after_this_stop) ++ udelay(host->delay_after_this_stop - + time_since_stop); + } + } + ++ host->delay_after_this_stop = host->delay_after_stop; ++ if ((cmd->data->flags & MMC_DATA_READ) && !host->use_sbc) { ++ /* See if read crosses one of the hazardous sectors */ ++ u32 first_blk, last_blk; ++ ++ /* Intentionally include the following sector because ++ without CMD23/SBC the read may run on. */ ++ first_blk = host->mrq->cmd->arg; ++ last_blk = first_blk + cmd->data->blocks; ++ ++ if (((last_blk >= (host->sectors - 64)) && ++ (first_blk <= (host->sectors - 64))) || ++ ((last_blk >= (host->sectors - 32)) && ++ (first_blk <= (host->sectors - 32)))) { ++ host->delay_after_this_stop = ++ max(250u, host->delay_after_stop); ++ } ++ } ++ + if (cmd->data->flags & MMC_DATA_WRITE) + sdcmd |= SDCMD_WRITE_CMD; + if (cmd->data->flags & MMC_DATA_READ) @@ -72249,10 +72783,12 @@ index 0000000..da089985 + } + + bcm2835_sdhost_write(host, sdcmd | SDCMD_NEW_FLAG, SDCMD); -+} + ++ return true; ++} + -+static void bcm2835_sdhost_finish_command(struct bcm2835_host *host); ++static void bcm2835_sdhost_finish_command(struct bcm2835_host *host, ++ unsigned long *irq_flags); +static void bcm2835_sdhost_transfer_complete(struct bcm2835_host *host); + +static void bcm2835_sdhost_finish_data(struct bcm2835_host *host) @@ -72262,6 +72798,7 @@ index 0000000..da089985 + data = host->data; + BUG_ON(!data); + ++ log_event("FDA<", (u32)host->mrq, (u32)host->cmd); + pr_debug("finish_data(error %d, stop %d, sbc %d)\n", + data->error, data->stop ? 1 : 0, + host->mrq->sbc ? 1 : 0); @@ -72269,10 +72806,7 @@ index 0000000..da089985 + host->hcfg &= ~(SDHCFG_DATA_IRPT_EN | SDHCFG_BLOCK_IRPT_EN); + bcm2835_sdhost_write(host, host->hcfg, SDHCFG); + -+ if (data->error) { -+ data->bytes_xfered = 0; -+ } else -+ data->bytes_xfered = data->blksz * data->blocks; ++ data->bytes_xfered = data->error ? 0 : (data->blksz * data->blocks); + + host->data_complete = 1; + @@ -72287,9 +72821,9 @@ index 0000000..da089985 + } + else + bcm2835_sdhost_transfer_complete(host); ++ log_event("FDA>", (u32)host->mrq, (u32)host->cmd); +} + -+ +static void bcm2835_sdhost_transfer_complete(struct bcm2835_host *host) +{ + struct mmc_data *data; @@ -72301,6 +72835,7 @@ index 0000000..da089985 + data = host->data; + host->data = NULL; + ++ log_event("TCM<", (u32)data, data->error); + pr_debug("transfer_complete(error %d, stop %d)\n", + data->error, data->stop ? 1 : 0); + @@ -72309,88 +72844,114 @@ index 0000000..da089985 + * a) open-ended multiblock transfer (no CMD23) + * b) error in multiblock transfer + */ -+ if (data->stop && -+ (data->error || -+ !host->mrq->sbc)) { -+ host->flush_fifo = 1; -+ bcm2835_sdhost_send_command(host, data->stop); -+ if (host->delay_after_stop) -+ do_gettimeofday(&host->stop_time); -+ if (!host->use_busy) -+ bcm2835_sdhost_finish_command(host); ++ if (host->mrq->stop && (data->error || !host->use_sbc)) { ++ if (bcm2835_sdhost_send_command(host, host->mrq->stop)) { ++ /* No busy, so poll for completion */ ++ if (!host->use_busy) ++ bcm2835_sdhost_finish_command(host, NULL); ++ ++ if (host->delay_after_this_stop) ++ do_gettimeofday(&host->stop_time); ++ } + } else { ++ bcm2835_sdhost_wait_transfer_complete(host); + tasklet_schedule(&host->finish_tasklet); + } ++ log_event("TCM>", (u32)data, 0); +} + -+static void bcm2835_sdhost_finish_command(struct bcm2835_host *host) ++/* If irq_flags is valid, the caller is in a thread context and is allowed ++ to sleep */ ++static void bcm2835_sdhost_finish_command(struct bcm2835_host *host, ++ unsigned long *irq_flags) +{ + u32 sdcmd; -+ unsigned long timeout; ++ u32 retries; +#ifdef DEBUG + struct timeval before, after; + int timediff = 0; +#endif + ++ log_event("FCM<", (u32)host->mrq, (u32)host->cmd); + pr_debug("finish_command(%x)\n", bcm2835_sdhost_read(host, SDCMD)); + + BUG_ON(!host->cmd || !host->mrq); + -+#ifdef DEBUG -+ do_gettimeofday(&before); -+#endif -+ /* Wait max 100 ms */ -+ timeout = 10000; ++ /* Poll quickly at first */ ++ ++ retries = host->cmd_quick_poll_retries; ++ if (!retries) { ++ /* Work out how many polls take 1us by timing 10us */ ++ struct timeval start, now; ++ int us_diff; ++ ++ retries = 1; ++ do { ++ int i; ++ ++ retries *= 2; ++ ++ do_gettimeofday(&start); ++ ++ for (i = 0; i < retries; i++) { ++ cpu_relax(); ++ sdcmd = bcm2835_sdhost_read(host, SDCMD); ++ } ++ ++ do_gettimeofday(&now); ++ us_diff = (now.tv_sec - start.tv_sec) * 1000000 + ++ (now.tv_usec - start.tv_usec); ++ } while (us_diff < 10); ++ ++ host->cmd_quick_poll_retries = ((retries * us_diff + 9)*CMD_DALLY_US)/10 + 1; ++ retries = 1; // We've already waited long enough this time ++ } ++ ++ retries = host->cmd_quick_poll_retries; + for (sdcmd = bcm2835_sdhost_read(host, SDCMD); -+ (sdcmd & SDCMD_NEW_FLAG) && timeout; -+ timeout--) { -+ if (host->flush_fifo) { -+ while (bcm2835_sdhost_read(host, SDHSTS) & -+ SDHSTS_DATA_FLAG) -+ (void)bcm2835_sdhost_read(host, SDDATA); -+ } -+ udelay(10); ++ (sdcmd & SDCMD_NEW_FLAG) && !(sdcmd & SDCMD_FAIL_FLAG) && retries; ++ retries--) { ++ cpu_relax(); + sdcmd = bcm2835_sdhost_read(host, SDCMD); + } -+#ifdef DEBUG -+ do_gettimeofday(&after); -+ timediff = (after.tv_sec - before.tv_sec)*1000000 + -+ (after.tv_usec - before.tv_usec); + -+ pr_debug(" finish_command - waited %dus\n", timediff); -+#endif ++ if (!retries) { ++ unsigned long wait_max; ++ ++ if (!irq_flags) { ++ /* Schedule the work */ ++ log_event("CWWQ", 0, 0); ++ schedule_work(&host->cmd_wait_wq); ++ return; ++ } + -+ if (timeout == 0) { ++ /* Wait max 100 ms */ ++ wait_max = jiffies + msecs_to_jiffies(100); ++ while (time_before(jiffies, wait_max)) { ++ spin_unlock_irqrestore(&host->lock, *irq_flags); ++ usleep_range(1, 10); ++ spin_lock_irqsave(&host->lock, *irq_flags); ++ sdcmd = bcm2835_sdhost_read(host, SDCMD); ++ if (!(sdcmd & SDCMD_NEW_FLAG) || ++ (sdcmd & SDCMD_FAIL_FLAG)) ++ break; ++ } ++ } ++ ++ /* Check for errors */ ++ if (sdcmd & SDCMD_NEW_FLAG) { + pr_err("%s: command never completed.\n", + mmc_hostname(host->mmc)); + bcm2835_sdhost_dumpregs(host); + host->cmd->error = -EIO; + tasklet_schedule(&host->finish_tasklet); + return; -+ } -+ -+ if (host->flush_fifo) { -+ for (timeout = 100; -+ (bcm2835_sdhost_read(host, SDHSTS) & SDHSTS_DATA_FLAG) && timeout; -+ timeout--) { -+ (void)bcm2835_sdhost_read(host, SDDATA); -+ } -+ host->flush_fifo = 0; -+ if (timeout == 0) { -+ pr_err("%s: FIFO never drained.\n", -+ mmc_hostname(host->mmc)); -+ bcm2835_sdhost_dumpregs(host); -+ host->cmd->error = -EIO; -+ tasklet_schedule(&host->finish_tasklet); -+ return; -+ } -+ } -+ -+ /* Check for errors */ -+ if (sdcmd & SDCMD_FAIL_FLAG) -+ { ++ } else if (sdcmd & SDCMD_FAIL_FLAG) { + u32 sdhsts = bcm2835_sdhost_read(host, SDHSTS); + ++ /* Clear the errors */ ++ bcm2835_sdhost_write(host, SDHSTS_ERROR_MASK, SDHSTS); ++ + if (host->debug) + pr_info("%s: error detected - CMD %x, HSTS %03x, EDM %x\n", + mmc_hostname(host->mmc), sdcmd, sdhsts, @@ -72413,7 +72974,7 @@ index 0000000..da089985 + mmc_hostname(host->mmc), + host->cmd->opcode); + bcm2835_sdhost_dumpregs(host); -+ host->cmd->error = -EIO; ++ host->cmd->error = -EILSEQ; + } + tasklet_schedule(&host->finish_tasklet); + return; @@ -72428,31 +72989,31 @@ index 0000000..da089985 + pr_debug("%s: finish_command %08x %08x %08x %08x\n", + mmc_hostname(host->mmc), + host->cmd->resp[0], host->cmd->resp[1], host->cmd->resp[2], host->cmd->resp[3]); ++ log_event("RSP ", host->cmd->resp[0], host->cmd->resp[1]); + } else { + host->cmd->resp[0] = bcm2835_sdhost_read(host, SDRSP0); + pr_debug("%s: finish_command %08x\n", + mmc_hostname(host->mmc), + host->cmd->resp[0]); ++ log_event("RSP ", host->cmd->resp[0], 0); + } + } + -+ host->cmd->error = 0; -+ + if (host->cmd == host->mrq->sbc) { + /* Finished CMD23, now send actual command. */ + host->cmd = NULL; -+ bcm2835_sdhost_send_command(host, host->mrq->cmd); -+ -+ if (host->cmd->data && host->use_dma) -+ /* DMA transfer starts now, PIO starts after irq */ -+ bcm2835_sdhost_transfer_dma(host); ++ if (bcm2835_sdhost_send_command(host, host->mrq->cmd)) { ++ if (host->data && host->dma_desc) ++ /* DMA transfer starts now, PIO starts after irq */ ++ bcm2835_sdhost_start_dma(host); + -+ if (!host->use_busy) -+ bcm2835_sdhost_finish_command(host); -+ } else if (host->cmd == host->mrq->stop) ++ if (!host->use_busy) ++ bcm2835_sdhost_finish_command(host, NULL); ++ } ++ } else if (host->cmd == host->mrq->stop) { + /* Finished CMD12 */ + tasklet_schedule(&host->finish_tasklet); -+ else { ++ } else { + /* Processed actual command. */ + host->cmd = NULL; + if (!host->data) @@ -72460,6 +73021,7 @@ index 0000000..da089985 + else if (host->data_complete) + bcm2835_sdhost_transfer_complete(host); + } ++ log_event("FCM>", (u32)host->mrq, (u32)host->cmd); +} + +static void bcm2835_sdhost_timeout(unsigned long data) @@ -72470,10 +73032,12 @@ index 0000000..da089985 + host = (struct bcm2835_host *)data; + + spin_lock_irqsave(&host->lock, flags); ++ log_event("TIM<", 0, 0); + + if (host->mrq) { + pr_err("%s: timeout waiting for hardware interrupt.\n", + mmc_hostname(host->mmc)); ++ log_dump(); + bcm2835_sdhost_dumpregs(host); + + if (host->data) { @@ -72494,74 +73058,15 @@ index 0000000..da089985 + spin_unlock_irqrestore(&host->lock, flags); +} + -+static void bcm2835_sdhost_pio_timeout(unsigned long data) -+{ -+ struct bcm2835_host *host; -+ unsigned long flags; -+ -+ host = (struct bcm2835_host *)data; -+ -+ spin_lock_irqsave(&host->lock, flags); -+ -+ if (host->data) { -+ u32 sdhsts = bcm2835_sdhost_read(host, SDHSTS); -+ -+ if (sdhsts & SDHSTS_REW_TIME_OUT) { -+ pr_err("%s: transfer timeout\n", -+ mmc_hostname(host->mmc)); -+ if (host->debug) -+ bcm2835_sdhost_dumpregs(host); -+ } else { -+ pr_err("%s: unexpected transfer timeout\n", -+ mmc_hostname(host->mmc)); -+ bcm2835_sdhost_dumpregs(host); -+ } -+ -+ bcm2835_sdhost_write(host, SDHSTS_TRANSFER_ERROR_MASK, -+ SDHSTS); -+ -+ host->data->error = -ETIMEDOUT; -+ -+ bcm2835_sdhost_finish_data(host); -+ } -+ -+ mmiowb(); -+ spin_unlock_irqrestore(&host->lock, flags); -+} -+ -+static void bcm2835_sdhost_enable_sdio_irq_nolock(struct bcm2835_host *host, int enable) -+{ -+ if (enable) -+ host->hcfg |= SDHCFG_SDIO_IRPT_EN; -+ else -+ host->hcfg &= ~SDHCFG_SDIO_IRPT_EN; -+ bcm2835_sdhost_write(host, host->hcfg, SDHCFG); -+ mmiowb(); -+} -+ -+static void bcm2835_sdhost_enable_sdio_irq(struct mmc_host *mmc, int enable) -+{ -+ struct bcm2835_host *host = mmc_priv(mmc); -+ unsigned long flags; -+ -+ pr_debug("%s: enable_sdio_irq(%d)\n", mmc_hostname(mmc), enable); -+ spin_lock_irqsave(&host->lock, flags); -+ bcm2835_sdhost_enable_sdio_irq_nolock(host, enable); -+ spin_unlock_irqrestore(&host->lock, flags); -+} -+ -+static u32 bcm2835_sdhost_busy_irq(struct bcm2835_host *host, u32 intmask) ++static void bcm2835_sdhost_busy_irq(struct bcm2835_host *host, u32 intmask) +{ -+ const u32 handled = (SDHSTS_REW_TIME_OUT | SDHSTS_CMD_TIME_OUT | -+ SDHSTS_CRC16_ERROR | SDHSTS_CRC7_ERROR | -+ SDHSTS_FIFO_ERROR); -+ ++ log_event("IRQB", (u32)host->cmd, intmask); + if (!host->cmd) { + pr_err("%s: got command busy interrupt 0x%08x even " + "though no command operation was in progress.\n", + mmc_hostname(host->mmc), (unsigned)intmask); + bcm2835_sdhost_dumpregs(host); -+ return 0; ++ return; + } + + if (!host->use_busy) { @@ -72569,7 +73074,7 @@ index 0000000..da089985 + "though not expecting one.\n", + mmc_hostname(host->mmc), (unsigned)intmask); + bcm2835_sdhost_dumpregs(host); -+ return 0; ++ return; + } + host->use_busy = 0; + @@ -72592,28 +73097,23 @@ index 0000000..da089985 + } else if (intmask & SDHSTS_CMD_TIME_OUT) + host->cmd->error = -ETIMEDOUT; + ++ log_dump(); + bcm2835_sdhost_dumpregs(host); -+ tasklet_schedule(&host->finish_tasklet); + } + else -+ bcm2835_sdhost_finish_command(host); -+ -+ return handled; ++ bcm2835_sdhost_finish_command(host, NULL); +} + -+static u32 bcm2835_sdhost_data_irq(struct bcm2835_host *host, u32 intmask) ++static void bcm2835_sdhost_data_irq(struct bcm2835_host *host, u32 intmask) +{ -+ const u32 handled = (SDHSTS_REW_TIME_OUT | -+ SDHSTS_CRC16_ERROR | -+ SDHSTS_FIFO_ERROR); -+ + /* There are no dedicated data/space available interrupt + status bits, so it is necessary to use the single shared + data/space available FIFO status bits. It is therefore not + an error to get here when there is no data transfer in + progress. */ ++ log_event("IRQD", (u32)host->data, intmask); + if (!host->data) -+ return 0; ++ return; + + if (intmask & (SDHSTS_CRC16_ERROR | + SDHSTS_FIFO_ERROR | @@ -72624,46 +73124,37 @@ index 0000000..da089985 + else + host->data->error = -ETIMEDOUT; + -+ bcm2835_sdhost_dumpregs(host); -+ tasklet_schedule(&host->finish_tasklet); -+ return handled; ++ if (host->debug) { ++ log_dump(); ++ bcm2835_sdhost_dumpregs(host); ++ } + } + -+ /* Use the block interrupt for writes after the first block */ -+ if (host->data->flags & MMC_DATA_WRITE) { ++ if (host->data->error) { ++ bcm2835_sdhost_finish_data(host); ++ } else if (host->data->flags & MMC_DATA_WRITE) { ++ /* Use the block interrupt for writes after the first block */ + host->hcfg &= ~(SDHCFG_DATA_IRPT_EN); + host->hcfg |= SDHCFG_BLOCK_IRPT_EN; + bcm2835_sdhost_write(host, host->hcfg, SDHCFG); -+ if (host->data->error) -+ bcm2835_sdhost_finish_data(host); -+ else -+ bcm2835_sdhost_transfer_pio(host); ++ bcm2835_sdhost_transfer_pio(host); + } else { -+ if (!host->data->error) { -+ bcm2835_sdhost_transfer_pio(host); -+ host->blocks--; -+ } ++ bcm2835_sdhost_transfer_pio(host); ++ host->blocks--; + if ((host->blocks == 0) || host->data->error) + bcm2835_sdhost_finish_data(host); + } -+ -+ return handled; +} + -+static u32 bcm2835_sdhost_block_irq(struct bcm2835_host *host, u32 intmask) ++static void bcm2835_sdhost_block_irq(struct bcm2835_host *host, u32 intmask) +{ -+ struct dma_chan *dma_chan; -+ u32 dir_data; -+ const u32 handled = (SDHSTS_REW_TIME_OUT | -+ SDHSTS_CRC16_ERROR | -+ SDHSTS_FIFO_ERROR); -+ ++ log_event("IRQK", (u32)host->data, intmask); + if (!host->data) { + pr_err("%s: got block interrupt 0x%08x even " + "though no data operation was in progress.\n", + mmc_hostname(host->mmc), (unsigned)intmask); + bcm2835_sdhost_dumpregs(host); -+ return handled; ++ return; + } + + if (intmask & (SDHSTS_CRC16_ERROR | @@ -72675,157 +73166,81 @@ index 0000000..da089985 + else + host->data->error = -ETIMEDOUT; + -+ if (host->debug) ++ if (host->debug) { ++ log_dump(); + bcm2835_sdhost_dumpregs(host); -+ tasklet_schedule(&host->finish_tasklet); -+ return handled; ++ } + } + -+ if (!host->use_dma) { ++ if (!host->dma_desc) { + BUG_ON(!host->blocks); -+ host->blocks--; -+ if ((host->blocks == 0) || host->data->error) { -+ /* Cancel the timer */ -+ del_timer(&host->pio_timer); -+ ++ if (host->data->error || (--host->blocks == 0)) { + bcm2835_sdhost_finish_data(host); + } else { + bcm2835_sdhost_transfer_pio(host); -+ -+ /* Reset the timer */ -+ mod_timer(&host->pio_timer, -+ jiffies + host->pio_timeout); + } + } else if (host->data->flags & MMC_DATA_WRITE) { -+ dma_chan = host->dma_chan_tx; -+ dir_data = DMA_TO_DEVICE; -+ dma_unmap_sg(dma_chan->device->dev, -+ host->data->sg, host->data->sg_len, -+ dir_data); -+ + bcm2835_sdhost_finish_data(host); + } -+ -+ return handled; +} + -+ +static irqreturn_t bcm2835_sdhost_irq(int irq, void *dev_id) +{ + irqreturn_t result = IRQ_NONE; + struct bcm2835_host *host = dev_id; -+ u32 unexpected = 0, early = 0; -+ int loops = 0; ++ u32 intmask; + + spin_lock(&host->lock); + -+ for (loops = 0; loops < 1; loops++) { -+ u32 intmask, handled; -+ -+ intmask = bcm2835_sdhost_read(host, SDHSTS); -+ handled = intmask & (SDHSTS_BUSY_IRPT | -+ SDHSTS_BLOCK_IRPT | -+ SDHSTS_SDIO_IRPT | -+ SDHSTS_DATA_FLAG); -+ if ((handled == SDHSTS_DATA_FLAG) && -+ (loops == 0) && !host->data) { -+ pr_err("%s: sdhost_irq data interrupt 0x%08x even " -+ "though no data operation was in progress.\n", -+ mmc_hostname(host->mmc), -+ (unsigned)intmask); -+ -+ bcm2835_sdhost_dumpregs(host); -+ } -+ -+ if (!handled) -+ break; ++ intmask = bcm2835_sdhost_read(host, SDHSTS); ++ log_event("IRQ<", intmask, 0); + -+ if (loops) -+ early |= handled; ++ bcm2835_sdhost_write(host, ++ SDHSTS_BUSY_IRPT | ++ SDHSTS_BLOCK_IRPT | ++ SDHSTS_SDIO_IRPT | ++ SDHSTS_DATA_FLAG, ++ SDHSTS); + ++ if (intmask & SDHSTS_BLOCK_IRPT) { ++ bcm2835_sdhost_block_irq(host, intmask); + result = IRQ_HANDLED; ++ } + -+ /* Clear all interrupts and notifications */ -+ bcm2835_sdhost_write(host, intmask, SDHSTS); -+ -+ if (intmask & SDHSTS_BUSY_IRPT) -+ handled |= bcm2835_sdhost_busy_irq(host, intmask); -+ -+ /* There is no true data interrupt status bit, so it is -+ necessary to qualify the data flag with the interrupt -+ enable bit */ -+ if ((intmask & SDHSTS_DATA_FLAG) && -+ (host->hcfg & SDHCFG_DATA_IRPT_EN)) -+ handled |= bcm2835_sdhost_data_irq(host, intmask); -+ -+ if (intmask & SDHSTS_BLOCK_IRPT) -+ handled |= bcm2835_sdhost_block_irq(host, intmask); -+ -+ if (intmask & SDHSTS_SDIO_IRPT) { -+ bcm2835_sdhost_enable_sdio_irq_nolock(host, false); -+ host->thread_isr |= SDHSTS_SDIO_IRPT; -+ result = IRQ_WAKE_THREAD; -+ } ++ if (intmask & SDHSTS_BUSY_IRPT) { ++ bcm2835_sdhost_busy_irq(host, intmask); ++ result = IRQ_HANDLED; ++ } + -+ unexpected |= (intmask & ~handled); ++ /* There is no true data interrupt status bit, so it is ++ necessary to qualify the data flag with the interrupt ++ enable bit */ ++ if ((intmask & SDHSTS_DATA_FLAG) && ++ (host->hcfg & SDHCFG_DATA_IRPT_EN)) { ++ bcm2835_sdhost_data_irq(host, intmask); ++ result = IRQ_HANDLED; + } + + mmiowb(); + ++ log_event("IRQ>", bcm2835_sdhost_read(host, SDHSTS), 0); + spin_unlock(&host->lock); + -+ if (early) -+ pr_debug("%s: early %x (loops %d)\n", -+ mmc_hostname(host->mmc), early, loops); -+ -+ if (unexpected) { -+ pr_err("%s: unexpected interrupt 0x%08x.\n", -+ mmc_hostname(host->mmc), unexpected); -+ bcm2835_sdhost_dumpregs(host); -+ } -+ + return result; +} + -+static irqreturn_t bcm2835_sdhost_thread_irq(int irq, void *dev_id) -+{ -+ struct bcm2835_host *host = dev_id; -+ unsigned long flags; -+ u32 isr; -+ -+ spin_lock_irqsave(&host->lock, flags); -+ isr = host->thread_isr; -+ host->thread_isr = 0; -+ spin_unlock_irqrestore(&host->lock, flags); -+ -+ if (isr & SDHSTS_SDIO_IRPT) { -+ sdio_run_irqs(host->mmc); -+ -+/* Is this necessary? Why re-enable an interrupt which is enabled? -+ spin_lock_irqsave(&host->lock, flags); -+ if (host->flags & SDHSTS_SDIO_IRPT_ENABLED) -+ bcm2835_sdhost_enable_sdio_irq_nolock(host, true); -+ spin_unlock_irqrestore(&host->lock, flags); -+*/ -+ } -+ -+ return isr ? IRQ_HANDLED : IRQ_NONE; -+} -+ -+ -+ +void bcm2835_sdhost_set_clock(struct bcm2835_host *host, unsigned int clock) +{ + int div = 0; /* Initialized for compiler warning */ + unsigned int input_clock = clock; ++ unsigned long flags; + + if (host->debug) + pr_info("%s: set_clock(%d)\n", mmc_hostname(host->mmc), clock); + + if ((host->overclock_50 > 50) && -+ (clock == 50*MHZ)) { ++ (clock == 50*MHZ)) + clock = host->overclock_50 * MHZ + (MHZ - 1); -+ } + + /* The SDCDIV register has 11 bits, and holds (div - 2). + But in data mode the max is 50MHz wihout a minimum, and only the @@ -72850,63 +73265,91 @@ index 0000000..da089985 + + host->mmc->actual_clock = 0; + -+ if (clock < 100000) { -+ /* Can't stop the clock, but make it as slow as possible -+ * to show willing -+ */ -+ host->cdiv = SDCDIV_MAX_CDIV; -+ bcm2835_sdhost_write(host, host->cdiv, SDCDIV); -+ return; -+ } ++ if (host->firmware_sets_cdiv) { ++ u32 msg[3] = { clock, 0, 0 }; ++ ++ rpi_firmware_property(rpi_firmware_get(NULL), ++ RPI_FIRMWARE_SET_SDHOST_CLOCK, ++ &msg, sizeof(msg)); ++ ++ clock = max(msg[1], msg[2]); ++ spin_lock_irqsave(&host->lock, flags); ++ } else { ++ spin_lock_irqsave(&host->lock, flags); ++ if (clock < 100000) { ++ /* Can't stop the clock, but make it as slow as ++ * possible to show willing ++ */ ++ host->cdiv = SDCDIV_MAX_CDIV; ++ bcm2835_sdhost_write(host, host->cdiv, SDCDIV); ++ mmiowb(); ++ spin_unlock_irqrestore(&host->lock, flags); ++ return; ++ } + -+ div = host->max_clk / clock; -+ if (div < 2) -+ div = 2; -+ if ((host->max_clk / div) > clock) -+ div++; -+ div -= 2; ++ div = host->max_clk / clock; ++ if (div < 2) ++ div = 2; ++ if ((host->max_clk / div) > clock) ++ div++; ++ div -= 2; + -+ if (div > SDCDIV_MAX_CDIV) -+ div = SDCDIV_MAX_CDIV; ++ if (div > SDCDIV_MAX_CDIV) ++ div = SDCDIV_MAX_CDIV; + -+ clock = host->max_clk / (div + 2); -+ host->mmc->actual_clock = clock; ++ clock = host->max_clk / (div + 2); + -+ if (clock > input_clock) { -+ /* Save the closest value, to make it easier -+ to reduce in the event of error */ -+ host->overclock_50 = (clock/MHZ); ++ host->cdiv = div; ++ bcm2835_sdhost_write(host, host->cdiv, SDCDIV); + -+ if (clock != host->overclock) { -+ pr_warn("%s: overclocking to %dHz\n", -+ mmc_hostname(host->mmc), clock); -+ host->overclock = clock; -+ } -+ } -+ else if (host->overclock) -+ { -+ host->overclock = 0; -+ if (clock == 50 * MHZ) -+ pr_warn("%s: cancelling overclock\n", -+ mmc_hostname(host->mmc)); ++ if (host->debug) ++ pr_info("%s: clock=%d -> max_clk=%d, cdiv=%x " ++ "(actual clock %d)\n", ++ mmc_hostname(host->mmc), input_clock, ++ host->max_clk, host->cdiv, ++ clock); + } + -+ host->cdiv = div; -+ bcm2835_sdhost_write(host, host->cdiv, SDCDIV); ++ /* Calibrate some delays */ ++ ++ host->ns_per_fifo_word = (1000000000/clock) * ++ ((host->mmc->caps & MMC_CAP_4_BIT_DATA) ? 8 : 32); ++ ++ if (input_clock == 50 * MHZ) { ++ if (clock > input_clock) { ++ /* Save the closest value, to make it easier ++ to reduce in the event of error */ ++ host->overclock_50 = (clock/MHZ); ++ ++ if (clock != host->overclock) { ++ pr_warn("%s: overclocking to %dHz\n", ++ mmc_hostname(host->mmc), clock); ++ host->overclock = clock; ++ } ++ } else if (host->overclock) { ++ host->overclock = 0; ++ if (clock == 50 * MHZ) ++ pr_warn("%s: cancelling overclock\n", ++ mmc_hostname(host->mmc)); ++ } ++ } + + /* Set the timeout to 500ms */ -+ bcm2835_sdhost_write(host, host->mmc->actual_clock/2, SDTOUT); ++ bcm2835_sdhost_write(host, clock/2, SDTOUT); + -+ if (host->debug) -+ pr_info("%s: clock=%d -> max_clk=%d, cdiv=%x (actual clock %d)\n", -+ mmc_hostname(host->mmc), input_clock, -+ host->max_clk, host->cdiv, host->mmc->actual_clock); ++ host->mmc->actual_clock = clock; ++ host->clock = input_clock; ++ host->reset_clock = 0; ++ ++ mmiowb(); ++ spin_unlock_irqrestore(&host->lock, flags); +} + +static void bcm2835_sdhost_request(struct mmc_host *mmc, struct mmc_request *mrq) +{ + struct bcm2835_host *host; + unsigned long flags; ++ u32 edm, fsm; + + host = mmc_priv(mmc); + @@ -72927,6 +73370,8 @@ index 0000000..da089985 + } + + /* Reset the error statuses in case this is a retry */ ++ if (mrq->sbc) ++ mrq->sbc->error = 0; + if (mrq->cmd) + mrq->cmd->error = 0; + if (mrq->data) @@ -72942,28 +73387,61 @@ index 0000000..da089985 + return; + } + ++ if (host->use_dma && mrq->data && ++ (mrq->data->blocks > host->pio_limit)) ++ bcm2835_sdhost_prepare_dma(host, mrq->data); ++ ++ if (host->reset_clock) ++ bcm2835_sdhost_set_clock(host, host->clock); ++ + spin_lock_irqsave(&host->lock, flags); + + WARN_ON(host->mrq != NULL); -+ + host->mrq = mrq; + -+ if (mrq->sbc) -+ bcm2835_sdhost_send_command(host, mrq->sbc); -+ else -+ bcm2835_sdhost_send_command(host, mrq->cmd); ++ edm = bcm2835_sdhost_read(host, SDEDM); ++ fsm = edm & SDEDM_FSM_MASK; + -+ mmiowb(); -+ spin_unlock_irqrestore(&host->lock, flags); ++ log_event("REQ<", (u32)mrq, edm); ++ if ((fsm != SDEDM_FSM_IDENTMODE) && ++ (fsm != SDEDM_FSM_DATAMODE)) { ++ pr_err("%s: previous command (%d) not complete (EDM %x)\n", ++ mmc_hostname(host->mmc), ++ bcm2835_sdhost_read(host, SDCMD) & SDCMD_CMD_MASK, ++ edm); ++ log_event("REQ!", (u32)mrq, edm); ++ log_dump(); ++ bcm2835_sdhost_dumpregs(host); ++ mrq->cmd->error = -EILSEQ; ++ tasklet_schedule(&host->finish_tasklet); ++ mmiowb(); ++ spin_unlock_irqrestore(&host->lock, flags); ++ return; ++ } ++ ++ host->use_sbc = !!mrq->sbc && ++ (host->mrq->data->flags & USE_CMD23_FLAGS); ++ if (host->use_sbc) { ++ if (bcm2835_sdhost_send_command(host, mrq->sbc)) { ++ if (!host->use_busy) ++ bcm2835_sdhost_finish_command(host, &flags); ++ } ++ } else if (bcm2835_sdhost_send_command(host, mrq->cmd)) { ++ if (host->data && host->dma_desc) ++ /* DMA transfer starts now, PIO starts after irq */ ++ bcm2835_sdhost_start_dma(host); + -+ if (!mrq->sbc && mrq->cmd->data && host->use_dma) -+ /* DMA transfer starts now, PIO starts after irq */ -+ bcm2835_sdhost_transfer_dma(host); ++ if (!host->use_busy) ++ bcm2835_sdhost_finish_command(host, &flags); ++ } + -+ if (!host->use_busy) -+ bcm2835_sdhost_finish_command(host); -+} ++ log_event("CMD ", (u32)mrq->cmd->opcode, ++ mrq->data ? (u32)mrq->data->blksz : 0); ++ mmiowb(); + ++ log_event("REQ>", (u32)mrq, 0); ++ spin_unlock_irqrestore(&host->lock, flags); ++} + +static void bcm2835_sdhost_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) +{ @@ -72980,10 +73458,7 @@ index 0000000..da089985 + + spin_lock_irqsave(&host->lock, flags); + -+ if (!ios->clock || ios->clock != host->clock) { -+ bcm2835_sdhost_set_clock(host, ios->clock); -+ host->clock = ios->clock; -+ } ++ log_event("IOS<", ios->clock, 0); + + /* set bus width */ + host->hcfg &= ~SDHCFG_WIDE_EXT_BUS; @@ -73000,46 +73475,58 @@ index 0000000..da089985 + mmiowb(); + + spin_unlock_irqrestore(&host->lock, flags); -+} -+ -+static int bcm2835_sdhost_multi_io_quirk(struct mmc_card *card, -+ unsigned int direction, -+ u32 blk_pos, int blk_size) -+{ -+ /* There is a bug in the host controller hardware that makes -+ reading the final sector of the card as part of a multiple read -+ problematic. Detect that case and shorten the read accordingly. -+ */ -+ /* csd.capacity is in weird units - convert to sectors */ -+ u32 card_sectors = (card->csd.capacity << (card->csd.read_blkbits - 9)); -+ -+ if ((direction == MMC_DATA_READ) && -+ ((blk_pos + blk_size) == card_sectors)) -+ blk_size--; + -+ return blk_size; ++ if (!ios->clock || ios->clock != host->clock) ++ bcm2835_sdhost_set_clock(host, ios->clock); +} + -+ +static struct mmc_host_ops bcm2835_sdhost_ops = { + .request = bcm2835_sdhost_request, + .set_ios = bcm2835_sdhost_set_ios, -+ .enable_sdio_irq = bcm2835_sdhost_enable_sdio_irq, + .hw_reset = bcm2835_sdhost_reset, -+ .multi_io_quirk = bcm2835_sdhost_multi_io_quirk, +}; + ++static void bcm2835_sdhost_cmd_wait_work(struct work_struct *work) ++{ ++ struct bcm2835_host *host; ++ unsigned long flags; ++ ++ host = container_of(work, struct bcm2835_host, cmd_wait_wq); ++ ++ spin_lock_irqsave(&host->lock, flags); ++ ++ log_event("CWK<", (u32)host->cmd, (u32)host->mrq); ++ ++ /* ++ * If this tasklet gets rescheduled while running, it will ++ * be run again afterwards but without any active request. ++ */ ++ if (!host->mrq) { ++ spin_unlock_irqrestore(&host->lock, flags); ++ return; ++ } ++ ++ bcm2835_sdhost_finish_command(host, &flags); ++ ++ mmiowb(); ++ ++ log_event("CWK>", (u32)host->cmd, 0); ++ ++ spin_unlock_irqrestore(&host->lock, flags); ++} + +static void bcm2835_sdhost_tasklet_finish(unsigned long param) +{ + struct bcm2835_host *host; + unsigned long flags; + struct mmc_request *mrq; ++ struct dma_chan *terminate_chan = NULL; + + host = (struct bcm2835_host *)param; + + spin_lock_irqsave(&host->lock, flags); + ++ log_event("TSK<", (u32)host->mrq, 0); + /* + * If this tasklet gets rescheduled while running, it will + * be run again afterwards but without any active request. @@ -73062,7 +73549,7 @@ index 0000000..da089985 + host->overclock_50--; + pr_warn("%s: reducing overclock due to errors\n", + mmc_hostname(host->mmc)); -+ bcm2835_sdhost_set_clock(host,50*MHZ); ++ host->reset_clock = 1; + mrq->cmd->error = -EILSEQ; + mrq->cmd->retries = 1; + } @@ -73074,11 +73561,23 @@ index 0000000..da089985 + + mmiowb(); + ++ host->dma_desc = NULL; ++ terminate_chan = host->dma_chan; ++ host->dma_chan = NULL; ++ + spin_unlock_irqrestore(&host->lock, flags); -+ mmc_request_done(host->mmc, mrq); -+} + ++ if (terminate_chan) ++ { ++ int err = dmaengine_terminate_all(terminate_chan); ++ if (err) ++ pr_err("%s: failed to terminate DMA (%d)\n", ++ mmc_hostname(host->mmc), err); ++ } + ++ mmc_request_done(host->mmc, mrq); ++ log_event("TSK>", (u32)mrq, 0); ++} + +int bcm2835_sdhost_add_host(struct bcm2835_host *host) +{ @@ -73100,39 +73599,57 @@ index 0000000..da089985 + mmc->f_max, mmc->f_min, mmc->max_busy_timeout); + + /* host controller capabilities */ -+ mmc->caps |= /* MMC_CAP_SDIO_IRQ |*/ MMC_CAP_4_BIT_DATA | ++ mmc->caps |= + MMC_CAP_SD_HIGHSPEED | MMC_CAP_MMC_HIGHSPEED | + MMC_CAP_NEEDS_POLL | MMC_CAP_HW_RESET | MMC_CAP_ERASE | -+ (ALLOW_CMD23 * MMC_CAP_CMD23); ++ ((ALLOW_CMD23_READ|ALLOW_CMD23_WRITE) * MMC_CAP_CMD23); + + spin_lock_init(&host->lock); + + if (host->allow_dma) { -+ if (IS_ERR_OR_NULL(host->dma_chan_tx) || -+ IS_ERR_OR_NULL(host->dma_chan_rx)) { -+ pr_err("%s: unable to initialise DMA channels. " ++ if (IS_ERR_OR_NULL(host->dma_chan_rxtx)) { ++ pr_err("%s: unable to initialise DMA channel. " + "Falling back to PIO\n", + mmc_hostname(mmc)); -+ host->have_dma = false; ++ host->use_dma = false; + } else { -+ host->have_dma = true; -+ + cfg.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; + cfg.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; + cfg.slave_id = 13; /* DREQ channel */ + ++ /* Validate the slave configurations */ ++ + cfg.direction = DMA_MEM_TO_DEV; + cfg.src_addr = 0; + cfg.dst_addr = host->bus_addr + SDDATA; -+ ret = dmaengine_slave_config(host->dma_chan_tx, &cfg); + -+ cfg.direction = DMA_DEV_TO_MEM; -+ cfg.src_addr = host->bus_addr + SDDATA; -+ cfg.dst_addr = 0; -+ ret = dmaengine_slave_config(host->dma_chan_rx, &cfg); ++ ret = dmaengine_slave_config(host->dma_chan_rxtx, &cfg); ++ ++ if (ret == 0) { ++ host->dma_cfg_tx = cfg; ++ ++ cfg.direction = DMA_DEV_TO_MEM; ++ cfg.src_addr = host->bus_addr + SDDATA; ++ cfg.dst_addr = 0; ++ ++ ret = dmaengine_slave_config(host->dma_chan_rxtx, &cfg); ++ } ++ ++ if (ret == 0) { ++ host->dma_cfg_rx = cfg; ++ ++ host->use_dma = true; ++ } else { ++ pr_err("%s: unable to configure DMA channel. " ++ "Falling back to PIO\n", ++ mmc_hostname(mmc)); ++ dma_release_channel(host->dma_chan_rxtx); ++ host->dma_chan_rxtx = NULL; ++ host->use_dma = false; ++ } + } + } else { -+ host->have_dma = false; ++ host->use_dma = false; + } + + mmc->max_segs = 128; @@ -73147,16 +73664,15 @@ index 0000000..da089985 + tasklet_init(&host->finish_tasklet, + bcm2835_sdhost_tasklet_finish, (unsigned long)host); + -+ setup_timer(&host->timer, bcm2835_sdhost_timeout, -+ (unsigned long)host); ++ INIT_WORK(&host->cmd_wait_wq, bcm2835_sdhost_cmd_wait_work); + -+ setup_timer(&host->pio_timer, bcm2835_sdhost_pio_timeout, ++ setup_timer(&host->timer, bcm2835_sdhost_timeout, + (unsigned long)host); + + bcm2835_sdhost_init(host, 0); -+ ret = request_threaded_irq(host->irq, bcm2835_sdhost_irq, -+ bcm2835_sdhost_thread_irq, -+ IRQF_SHARED, mmc_hostname(mmc), host); ++ ++ ret = request_irq(host->irq, bcm2835_sdhost_irq, 0 /*IRQF_SHARED*/, ++ mmc_hostname(mmc), host); + if (ret) { + pr_err("%s: failed to request IRQ %d: %d\n", + mmc_hostname(mmc), host->irq, ret); @@ -73167,11 +73683,11 @@ index 0000000..da089985 + mmc_add_host(mmc); + + pio_limit_string[0] = '\0'; -+ if (host->have_dma && (host->pio_limit > 0)) ++ if (host->use_dma && (host->pio_limit > 0)) + sprintf(pio_limit_string, " (>%d)", host->pio_limit); + pr_info("%s: %s loaded - DMA %s%s\n", + mmc_hostname(mmc), DRIVER_NAME, -+ host->have_dma ? "enabled" : "disabled", ++ host->use_dma ? "enabled" : "disabled", + pio_limit_string); + + return 0; @@ -73191,6 +73707,7 @@ index 0000000..da089985 + struct bcm2835_host *host; + struct mmc_host *mmc; + const __be32 *addr; ++ u32 msg[3]; + int ret; + + pr_debug("bcm2835_sdhost_probe\n"); @@ -73202,7 +73719,9 @@ index 0000000..da089985 + host = mmc_priv(mmc); + host->mmc = mmc; + host->pio_timeout = msecs_to_jiffies(500); ++ host->pio_limit = 1; + host->max_delay = 1; /* Warn if over 1ms */ ++ host->allow_dma = 1; + spin_lock_init(&host->lock); + + iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0); @@ -73218,13 +73737,12 @@ index 0000000..da089985 + return -ENODEV; + } + host->bus_addr = be32_to_cpup(addr); ++ log_init(iomem->start - host->bus_addr); + pr_debug(" - ioaddr %lx, iomem->start %lx, bus_addr %lx\n", + (unsigned long)host->ioaddr, + (unsigned long)iomem->start, + (unsigned long)host->bus_addr); + -+ host->allow_dma = ALLOW_DMA; -+ + if (node) { + /* Read any custom properties */ + of_property_read_u32(node, @@ -73236,26 +73754,35 @@ index 0000000..da089985 + of_property_read_u32(node, + "brcm,pio-limit", + &host->pio_limit); -+ host->allow_dma = ALLOW_DMA && ++ host->allow_dma = + !of_property_read_bool(node, "brcm,force-pio"); + host->debug = of_property_read_bool(node, "brcm,debug"); + } + ++ host->dma_chan = NULL; ++ host->dma_desc = NULL; ++ ++ /* Formally recognise the other way of disabling DMA */ ++ if (host->pio_limit == 0x7fffffff) ++ host->allow_dma = false; ++ + if (host->allow_dma) { + if (node) { -+ host->dma_chan_tx = -+ dma_request_slave_channel(dev, "tx"); -+ host->dma_chan_rx = -+ dma_request_slave_channel(dev, "rx"); ++ host->dma_chan_rxtx = ++ dma_request_slave_channel(dev, "rx-tx"); ++ if (!host->dma_chan_rxtx) ++ host->dma_chan_rxtx = ++ dma_request_slave_channel(dev, "tx"); ++ if (!host->dma_chan_rxtx) ++ host->dma_chan_rxtx = ++ dma_request_slave_channel(dev, "rx"); + } else { + dma_cap_mask_t mask; + + dma_cap_zero(mask); + /* we don't care about the channel, any would work */ + dma_cap_set(DMA_SLAVE, mask); -+ host->dma_chan_tx = -+ dma_request_channel(mask, NULL, NULL); -+ host->dma_chan_rx = ++ host->dma_chan_rxtx = + dma_request_channel(mask, NULL, NULL); + } + } @@ -73285,6 +73812,16 @@ index 0000000..da089985 + else + mmc->caps |= MMC_CAP_4_BIT_DATA; + ++ msg[0] = 0; ++ msg[1] = ~0; ++ msg[2] = ~0; ++ ++ rpi_firmware_property(rpi_firmware_get(NULL), ++ RPI_FIRMWARE_SET_SDHOST_CLOCK, ++ &msg, sizeof(msg)); ++ ++ host->firmware_sets_cdiv = (msg[1] != ~0); ++ + ret = bcm2835_sdhost_add_host(host); + if (ret) + goto err; @@ -73325,15 +73862,12 @@ index 0000000..da089985 + return 0; +} + -+ +static const struct of_device_id bcm2835_sdhost_match[] = { + { .compatible = "brcm,bcm2835-sdhost" }, + { } +}; +MODULE_DEVICE_TABLE(of, bcm2835_sdhost_match); + -+ -+ +static struct platform_driver bcm2835_sdhost_driver = { + .probe = bcm2835_sdhost_probe, + .remove = bcm2835_sdhost_remove, @@ -73350,10 +73884,149 @@ index 0000000..da089985 +MODULE_LICENSE("GPL v2"); +MODULE_AUTHOR("Phil Elwell"); -From 8dbb0430386b772f636f474ed45496076d135428 Mon Sep 17 00:00:00 2001 +From 6f2e23aee85a87ba940dd5649a290e4e0a1fd84e Mon Sep 17 00:00:00 2001 +From: Phil Elwell <phil@raspberrypi.org> +Date: Wed, 11 May 2016 12:50:33 +0100 +Subject: [PATCH 038/112] mmc: Add MMC_QUIRK_ERASE_BROKEN for some cards + +Some SD cards have been found that corrupt data when small blocks +are erased. Add a quirk to indicate that ERASE should not be used, +and set it for cards of that type. + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> + +mmc: Apply QUIRK_BROKEN_ERASE to other capacities + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> + +mmc: Add card_quirks module parameter, log quirks + +Use mmc_block.card_quirks to override the quirks for all SD or MMC +cards. The value is a bitfield using the bit positions defined in +include/linux/mmc/card.h. If the module parameter is placed in the +kernel command line (or bootargs) stored on the card then, assuming the +device only has one SD card interface, the override effectively becomes +card-specific. + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> +--- + drivers/mmc/card/block.c | 39 ++++++++++++++++++++++++++++++++++++--- + drivers/mmc/core/core.c | 3 ++- + include/linux/mmc/card.h | 3 +++ + 3 files changed, 41 insertions(+), 4 deletions(-) + +diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c +index b0a2741..9ce8676 100644 +--- a/drivers/mmc/card/block.c ++++ b/drivers/mmc/card/block.c +@@ -132,6 +132,13 @@ enum { + module_param(perdev_minors, int, 0444); + MODULE_PARM_DESC(perdev_minors, "Minors numbers to allocate per device"); + ++/* ++ * Allow quirks to be overridden for the current card ++ */ ++static char *card_quirks; ++module_param(card_quirks, charp, 0644); ++MODULE_PARM_DESC(card_quirks, "Force the use of the indicated quirks (a bitfield)"); ++ + static inline int mmc_blk_part_switch(struct mmc_card *card, + struct mmc_blk_data *md); + static int get_card_status(struct mmc_card *card, u32 *status, int retries); +@@ -2532,6 +2539,17 @@ static const struct mmc_fixup blk_fixups[] = + MMC_FIXUP("V10016", CID_MANFID_KINGSTON, CID_OEMID_ANY, add_quirk_mmc, + MMC_QUIRK_TRIM_BROKEN), + ++ /* ++ * On some Kingston SD cards, multiple erases of less than 64 ++ * sectors can cause corruption. ++ */ ++ MMC_FIXUP("SD16G", 0x41, 0x3432, add_quirk_mmc, ++ MMC_QUIRK_ERASE_BROKEN), ++ MMC_FIXUP("SD32G", 0x41, 0x3432, add_quirk_mmc, ++ MMC_QUIRK_ERASE_BROKEN), ++ MMC_FIXUP("SD64G", 0x41, 0x3432, add_quirk_mmc, ++ MMC_QUIRK_ERASE_BROKEN), ++ + END_FIXUP + }; + +@@ -2539,6 +2557,7 @@ static int mmc_blk_probe(struct mmc_card *card) + { + struct mmc_blk_data *md, *part_md; + char cap_str[10]; ++ char quirk_str[24]; + + /* + * Check that the card supports the command class(es) we need. +@@ -2546,7 +2565,16 @@ static int mmc_blk_probe(struct mmc_card *card) + if (!(card->csd.cmdclass & CCC_BLOCK_READ)) + return -ENODEV; + +- mmc_fixup_device(card, blk_fixups); ++ if (card_quirks) { ++ unsigned long quirks; ++ if (kstrtoul(card_quirks, 0, &quirks) == 0) ++ card->quirks = (unsigned int)quirks; ++ else ++ pr_err("mmc_block: Invalid card_quirks parameter '%s'\n", ++ card_quirks); ++ } ++ else ++ mmc_fixup_device(card, blk_fixups); + + md = mmc_blk_alloc(card); + if (IS_ERR(md)) +@@ -2554,9 +2582,14 @@ static int mmc_blk_probe(struct mmc_card *card) + + string_get_size((u64)get_capacity(md->disk), 512, STRING_UNITS_2, + cap_str, sizeof(cap_str)); +- pr_info("%s: %s %s %s %s\n", ++ if (card->quirks) ++ snprintf(quirk_str, sizeof(quirk_str), ++ " (quirks 0x%08x)", card->quirks); ++ else ++ quirk_str[0] = '\0'; ++ pr_info("%s: %s %s %s%s%s\n", + md->disk->disk_name, mmc_card_id(card), mmc_card_name(card), +- cap_str, md->read_only ? "(ro)" : ""); ++ cap_str, md->read_only ? " (ro)" : "", quirk_str); + + if (mmc_blk_alloc_parts(card, md)) + goto out; +diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c +index 9eba56c..4b1ff84 100644 +--- a/drivers/mmc/core/core.c ++++ b/drivers/mmc/core/core.c +@@ -2253,7 +2253,8 @@ EXPORT_SYMBOL(mmc_erase); + int mmc_can_erase(struct mmc_card *card) + { + if ((card->host->caps & MMC_CAP_ERASE) && +- (card->csd.cmdclass & CCC_ERASE) && card->erase_size) ++ (card->csd.cmdclass & CCC_ERASE) && card->erase_size && ++ !(card->quirks & MMC_QUIRK_ERASE_BROKEN)) + return 1; + return 0; + } +diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h +index eb0151b..fa4e645 100644 +--- a/include/linux/mmc/card.h ++++ b/include/linux/mmc/card.h +@@ -281,6 +281,9 @@ struct mmc_card { + #define MMC_QUIRK_TRIM_BROKEN (1<<12) /* Skip trim */ + + ++#define MMC_QUIRK_ERASE_BROKEN (1<<31) /* Skip erase */ ++ ++ + unsigned int erase_size; /* erase size in sectors */ + unsigned int erase_shift; /* if erase unit is power 2 */ + unsigned int pref_erase; /* in sectors */ + +From b3dfc4d3fd00b16fdde707b9974710ca1378b1b8 Mon Sep 17 00:00:00 2001 From: popcornmix <popcornmix@gmail.com> Date: Wed, 3 Jul 2013 00:31:47 +0100 -Subject: [PATCH 035/170] cma: Add vc_cma driver to enable use of CMA +Subject: [PATCH 039/112] cma: Add vc_cma driver to enable use of CMA MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -73385,7 +74058,7 @@ Signed-off-by: Noralf Trønnes <noralf@tronnes.org> create mode 100644 include/linux/broadcom/vc_cma.h diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig -index a043107..2ba2d82 100644 +index 3ec0766..aec9337 100644 --- a/drivers/char/Kconfig +++ b/drivers/char/Kconfig @@ -4,6 +4,8 @@ @@ -74696,10 +75369,10 @@ index 0000000..be2819d + +#endif /* VC_CMA_H */ -From 1e8eb30b259278ea7ab9d14c66d2fab5f580f73c Mon Sep 17 00:00:00 2001 +From b66d625fcacb21a8529ef74eeb6c33e550d841e6 Mon Sep 17 00:00:00 2001 From: popcornmix <popcornmix@gmail.com> Date: Mon, 26 Mar 2012 22:15:50 +0100 -Subject: [PATCH 036/170] bcm2708: alsa sound driver +Subject: [PATCH 040/112] bcm2708: alsa sound driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -74736,16 +75409,24 @@ Add device to Device Tree. Don't add platform devices when booting in DT mode. Signed-off-by: Noralf Trønnes <noralf@tronnes.org> + +bcm2835: access controls under the audio mutex + +I don't think the ALSA framework provides any kind of automatic +synchronization within the control callbacks. We most likely need +to ensure this manually, so add locking around all access to shared +mutable data. In particular, bcm2835_audio_set_ctls() should +probably always be called under our own audio lock. --- sound/arm/Kconfig | 8 + sound/arm/Makefile | 5 + - sound/arm/bcm2835-ctl.c | 323 +++++++++++++ - sound/arm/bcm2835-pcm.c | 557 +++++++++++++++++++++++ + sound/arm/bcm2835-ctl.c | 350 ++++++++++++++ + sound/arm/bcm2835-pcm.c | 561 +++++++++++++++++++++++ sound/arm/bcm2835-vchiq.c | 902 +++++++++++++++++++++++++++++++++++++ sound/arm/bcm2835.c | 511 +++++++++++++++++++++ sound/arm/bcm2835.h | 167 +++++++ sound/arm/vc_vchi_audioserv_defs.h | 116 +++++ - 8 files changed, 2589 insertions(+) + 8 files changed, 2620 insertions(+) create mode 100755 sound/arm/bcm2835-ctl.c create mode 100755 sound/arm/bcm2835-pcm.c create mode 100755 sound/arm/bcm2835-vchiq.c @@ -74786,10 +75467,10 @@ index 8c0c851..6796d7f 100644 +ccflags-y += -Idrivers/misc/vc04_services -Idrivers/misc/vc04_services/interface/vcos/linuxkernel -D__VCCOREVER__=0x04000000 diff --git a/sound/arm/bcm2835-ctl.c b/sound/arm/bcm2835-ctl.c new file mode 100755 -index 0000000..aad905f +index 0000000..75dc322 --- /dev/null +++ b/sound/arm/bcm2835-ctl.c -@@ -0,0 +1,323 @@ +@@ -0,0 +1,350 @@ +/***************************************************************************** +* Copyright 2011 Broadcom Corporation. All rights reserved. +* @@ -74886,6 +75567,9 @@ index 0000000..aad905f +{ + struct bcm2835_chip *chip = snd_kcontrol_chip(kcontrol); + ++ if (mutex_lock_interruptible(&chip->audio_mutex)) ++ return -EINTR; ++ + BUG_ON(!chip && !(chip->avail_substreams & AVAIL_SUBSTREAMS_MASK)); + + if (kcontrol->private_value == PCM_PLAYBACK_VOLUME) @@ -74895,6 +75579,7 @@ index 0000000..aad905f + else if (kcontrol->private_value == PCM_PLAYBACK_DEVICE) + ucontrol->value.integer.value[0] = chip->dest; + ++ mutex_unlock(&chip->audio_mutex); + return 0; +} + @@ -74904,11 +75589,15 @@ index 0000000..aad905f + struct bcm2835_chip *chip = snd_kcontrol_chip(kcontrol); + int changed = 0; + ++ if (mutex_lock_interruptible(&chip->audio_mutex)) ++ return -EINTR; ++ + if (kcontrol->private_value == PCM_PLAYBACK_VOLUME) { + audio_info("Volume change attempted.. volume = %d new_volume = %d\n", chip->volume, (int)ucontrol->value.integer.value[0]); + if (chip->mute == CTRL_VOL_MUTE) { + /* changed = toggle_mute(chip, CTRL_VOL_UNMUTE); */ -+ return 1; /* should return 0 to signify no change but the mixer takes this as the opposite sign (no idea why) */ ++ changed = 1; /* should return 0 to signify no change but the mixer takes this as the opposite sign (no idea why) */ ++ goto unlock; + } + if (changed + || (ucontrol->value.integer.value[0] != chip2alsa(chip->volume))) { @@ -74934,6 +75623,8 @@ index 0000000..aad905f + printk(KERN_ERR "Failed to set ALSA controls..\n"); + } + ++unlock: ++ mutex_unlock(&chip->audio_mutex); + return changed; +} + @@ -74990,10 +75681,14 @@ index 0000000..aad905f + struct bcm2835_chip *chip = snd_kcontrol_chip(kcontrol); + int i; + ++ if (mutex_lock_interruptible(&chip->audio_mutex)) ++ return -EINTR; ++ + for (i = 0; i < 4; i++) + ucontrol->value.iec958.status[i] = + (chip->spdif_status >> (i * 8)) && 0xff; + ++ mutex_unlock(&chip->audio_mutex); + return 0; +} + @@ -75004,12 +75699,16 @@ index 0000000..aad905f + unsigned int val = 0; + int i, change; + ++ if (mutex_lock_interruptible(&chip->audio_mutex)) ++ return -EINTR; ++ + for (i = 0; i < 4; i++) + val |= (unsigned int)ucontrol->value.iec958.status[i] << (i * 8); + + change = val != chip->spdif_status; + chip->spdif_status = val; + ++ mutex_unlock(&chip->audio_mutex); + return change; +} + @@ -75045,9 +75744,14 @@ index 0000000..aad905f + struct bcm2835_chip *chip = snd_kcontrol_chip(kcontrol); + int i; + ++ if (mutex_lock_interruptible(&chip->audio_mutex)) ++ return -EINTR; ++ + for (i = 0; i < 4; i++) + ucontrol->value.iec958.status[i] = + (chip->spdif_status >> (i * 8)) & 0xff; ++ ++ mutex_unlock(&chip->audio_mutex); + return 0; +} + @@ -75058,11 +75762,15 @@ index 0000000..aad905f + unsigned int val = 0; + int i, change; + ++ if (mutex_lock_interruptible(&chip->audio_mutex)) ++ return -EINTR; ++ + for (i = 0; i < 4; i++) + val |= (unsigned int)ucontrol->value.iec958.status[i] << (i * 8); + change = val != chip->spdif_status; + chip->spdif_status = val; + ++ mutex_unlock(&chip->audio_mutex); + return change; +} + @@ -75115,10 +75823,10 @@ index 0000000..aad905f +} diff --git a/sound/arm/bcm2835-pcm.c b/sound/arm/bcm2835-pcm.c new file mode 100755 -index 0000000..8c86375 +index 0000000..d2de13c --- /dev/null +++ b/sound/arm/bcm2835-pcm.c -@@ -0,0 +1,557 @@ +@@ -0,0 +1,561 @@ +/***************************************************************************** +* Copyright 2011 Broadcom Corporation. All rights reserved. +* @@ -75432,6 +76140,9 @@ index 0000000..8c86375 + + audio_info(" .. IN\n"); + ++ if (mutex_lock_interruptible(&chip->audio_mutex)) ++ return -EINTR; ++ + /* notify the vchiq that it should enter spdif passthrough mode by + * setting channels=0 (see + * https://github.com/raspberrypi/linux/issues/528) */ @@ -75467,6 +76178,7 @@ index 0000000..8c86375 + alsa_stream->buffer_size, alsa_stream->period_size, + alsa_stream->pos, runtime->frame_bits); + ++ mutex_unlock(&chip->audio_mutex); + audio_info(" .. OUT\n"); + return 0; +} @@ -76586,7 +77298,7 @@ index 0000000..3de3094 +MODULE_PARM_DESC(force_bulk, "Force use of vchiq bulk for audio"); diff --git a/sound/arm/bcm2835.c b/sound/arm/bcm2835.c new file mode 100644 -index 0000000..6b545e7 +index 0000000..7a2ed78 --- /dev/null +++ b/sound/arm/bcm2835.c @@ -0,0 +1,511 @@ @@ -76695,7 +77407,7 @@ index 0000000..6b545e7 + numchans); + } + -+ err = snd_card_new(NULL, -1, NULL, THIS_MODULE, 0, &card); ++ err = snd_card_new(&pdev->dev, -1, NULL, THIS_MODULE, 0, &card); + if (err) { + dev_err(dev, "Failed to create soundcard structure\n"); + return err; @@ -76775,7 +77487,7 @@ index 0000000..6b545e7 + if (dev > 0) + goto add_register_map; + -+ err = snd_card_new(NULL, index[dev], id[dev], THIS_MODULE, 0, &g_card); ++ err = snd_card_new(&pdev->dev, index[dev], id[dev], THIS_MODULE, 0, &g_card); + if (err < 0) + goto out; + @@ -77397,10 +78109,10 @@ index 0000000..af3e6eb + +#endif // _VC_AUDIO_DEFS_H_ -From 20c0f57db9cca65943519bd404b3e346958f4544 Mon Sep 17 00:00:00 2001 +From cd1caba5928a0a0e6c8901da2151c83428f03b4f Mon Sep 17 00:00:00 2001 From: popcornmix <popcornmix@gmail.com> Date: Tue, 2 Jul 2013 23:42:01 +0100 -Subject: [PATCH 037/170] bcm2708 vchiq driver +Subject: [PATCH 041/112] bcm2708 vchiq driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -77570,6 +78282,49 @@ vchiq_arm: Sort out the vmalloc case See: https://github.com/raspberrypi/linux/issues/1055 vchiq: hack: Add include depecated dma include file + +vchiq_arm: Tweak the logging output + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> + +vchiq_arm: Access the dequeue_pending flag locked + +Reading through this code looking for another problem (now found in userland) +the use of dequeue_pending outside a lock didn't seem safe. + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> + +vchiq_arm: Service callbacks must not fail + +Service callbacks are not allowed to return an error. The internal callback +that delivers events and messages to user tasks does not enqueue them if +the service is closing, but this is not an error and should not be +reported as such. + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> + +vchiq_arm: do not use page_cache_release(page) macro (#1403) + +This macro is gone since 1fa64f198b9f8d6ec0f7aec7c18dc94684391140. + +Signed-off-by: Slawomir Stepien <sst@poczta.fm> + +vchiq: Upate to match get_user_pages prototype + +vchiq_arm: Add completion records under the mutex + +An issue was observed when flushing openmax components +which generate a large number of messages returning +buffers to host. + +We occasionally found a duplicate message from 16 +messages prior, resulting in a buffer returned twice. + +While only one thread adds completions, without the +mutex you don't get the protection of the automatic +memory barrier you get with synchronisation objects. + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> --- arch/arm/mach-bcm2708/include/mach/platform.h | 2 + arch/arm/mach-bcm2709/include/mach/platform.h | 2 + @@ -77587,13 +78342,13 @@ vchiq: hack: Add include depecated dma include file .../misc/vc04_services/interface/vchiq_arm/vchiq.h | 40 + .../vc04_services/interface/vchiq_arm/vchiq_2835.h | 42 + .../interface/vchiq_arm/vchiq_2835_arm.c | 586 +++ - .../vc04_services/interface/vchiq_arm/vchiq_arm.c | 2903 +++++++++++++++ + .../vc04_services/interface/vchiq_arm/vchiq_arm.c | 2920 +++++++++++++++ .../vc04_services/interface/vchiq_arm/vchiq_arm.h | 220 ++ .../interface/vchiq_arm/vchiq_build_info.h | 37 + .../vc04_services/interface/vchiq_arm/vchiq_cfg.h | 69 + .../interface/vchiq_arm/vchiq_connected.c | 120 + .../interface/vchiq_arm/vchiq_connected.h | 50 + - .../vc04_services/interface/vchiq_arm/vchiq_core.c | 3934 ++++++++++++++++++++ + .../vc04_services/interface/vchiq_arm/vchiq_core.c | 3929 ++++++++++++++++++++ .../vc04_services/interface/vchiq_arm/vchiq_core.h | 712 ++++ .../interface/vchiq_arm/vchiq_debugfs.c | 383 ++ .../interface/vchiq_arm/vchiq_debugfs.h | 52 + @@ -77608,7 +78363,7 @@ vchiq: hack: Add include depecated dma include file .../vc04_services/interface/vchiq_arm/vchiq_util.c | 156 + .../vc04_services/interface/vchiq_arm/vchiq_util.h | 82 + .../interface/vchiq_arm/vchiq_version.c | 59 + - 37 files changed, 12819 insertions(+) + 37 files changed, 12831 insertions(+) create mode 100644 drivers/misc/vc04_services/Kconfig create mode 100644 drivers/misc/vc04_services/Makefile create mode 100644 drivers/misc/vc04_services/interface/vchi/connections/connection.h @@ -77670,10 +78425,10 @@ index 311b9f2..9a638f5 100644 /* * Watchdog diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig -index 22892c7..b859ce0 100644 +index a216b46..90af750 100644 --- a/drivers/misc/Kconfig +++ b/drivers/misc/Kconfig -@@ -533,6 +533,7 @@ source "drivers/misc/lis3lv02d/Kconfig" +@@ -812,6 +812,7 @@ source "drivers/misc/lis3lv02d/Kconfig" source "drivers/misc/altera-stapl/Kconfig" source "drivers/misc/mei/Kconfig" source "drivers/misc/vmw_vmci/Kconfig" @@ -77682,7 +78437,7 @@ index 22892c7..b859ce0 100644 source "drivers/misc/genwqe/Kconfig" source "drivers/misc/echo/Kconfig" diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile -index 537d7f3..ac24d77 100644 +index b2fb6dbf..1a58cf7 100644 --- a/drivers/misc/Makefile +++ b/drivers/misc/Makefile @@ -51,6 +51,7 @@ obj-$(CONFIG_INTEL_MEI) += mei/ @@ -78658,7 +79413,7 @@ index 0000000..1b17e98 +/****************************** End of file **********************************/ diff --git a/drivers/misc/vc04_services/interface/vchi/vchi_cfg.h b/drivers/misc/vc04_services/interface/vchi/vchi_cfg.h new file mode 100644 -index 0000000..26bc2d38 +index 0000000..26bc2d3 --- /dev/null +++ b/drivers/misc/vc04_services/interface/vchi/vchi_cfg.h @@ -0,0 +1,224 @@ @@ -79288,7 +80043,7 @@ index 0000000..7ea5c64 +#endif /* VCHIQ_2835_H */ diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c new file mode 100644 -index 0000000..c29040f +index 0000000..4cb5bff --- /dev/null +++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c @@ -0,0 +1,586 @@ @@ -79714,7 +80469,7 @@ index 0000000..c29040f + *need_release = 0; /* do not try and release vmalloc pages */ + } else { + down_read(&task->mm->mmap_sem); -+ actual_pages = get_user_pages(task, task->mm, ++ actual_pages = get_user_pages( + (unsigned long)buf & ~(PAGE_SIZE - 1), + num_pages, + (type == PAGELIST_READ) /*Write */ , @@ -79733,7 +80488,7 @@ index 0000000..c29040f + while (actual_pages > 0) + { + actual_pages--; -+ page_cache_release(pages[actual_pages]); ++ put_page(pages[actual_pages]); + } + kfree(pagelist); + if (actual_pages == 0) @@ -79872,7 +80627,7 @@ index 0000000..c29040f + offset = 0; + set_page_dirty(pg); + } -+ page_cache_release(pg); ++ put_page(pg); + } + } + @@ -79880,10 +80635,10 @@ index 0000000..c29040f +} diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm.c new file mode 100644 -index 0000000..e11c0e0 +index 0000000..51e6018 --- /dev/null +++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm.c -@@ -0,0 +1,2903 @@ +@@ -0,0 +1,2920 @@ +/** + * Copyright (c) 2014 Raspberry Pi (Trading) Ltd. All rights reserved. + * Copyright (c) 2010-2012 Broadcom. All rights reserved. @@ -80096,6 +80851,8 @@ index 0000000..e11c0e0 + VCHIQ_COMPLETION_DATA_T *completion; + DEBUG_INITIALISE(g_state.local) + ++ mutex_lock(&instance->completion_mutex); ++ + while (instance->completion_insert == + (instance->completion_remove + MAX_COMPLETIONS)) { + /* Out of space - wait for the client */ @@ -80103,14 +80860,20 @@ index 0000000..e11c0e0 + vchiq_log_trace(vchiq_arm_log_level, + "add_completion - completion queue full"); + DEBUG_COUNT(COMPLETION_QUEUE_FULL_COUNT); ++ ++ mutex_unlock(&instance->completion_mutex); + if (down_interruptible(&instance->remove_event) != 0) { + vchiq_log_info(vchiq_arm_log_level, + "service_callback interrupted"); + return VCHIQ_RETRY; -+ } else if (instance->closing) { ++ } ++ ++ mutex_lock(&instance->completion_mutex); ++ if (instance->closing) { ++ mutex_unlock(&instance->completion_mutex); + vchiq_log_info(vchiq_arm_log_level, + "service_callback closing"); -+ return VCHIQ_ERROR; ++ return VCHIQ_SUCCESS; + } + DEBUG_TRACE(SERVICE_CALLBACK_LINE); + } @@ -80140,8 +80903,11 @@ index 0000000..e11c0e0 + if (reason == VCHIQ_MESSAGE_AVAILABLE) + user_service->message_available_pos = + instance->completion_insert; ++ + instance->completion_insert++; + ++ mutex_unlock(&instance->completion_mutex); ++ + up(&instance->insert_event); + + return VCHIQ_SUCCESS; @@ -80165,6 +80931,7 @@ index 0000000..e11c0e0 + USER_SERVICE_T *user_service; + VCHIQ_SERVICE_T *service; + VCHIQ_INSTANCE_T instance; ++ int skip_completion = 0; + DEBUG_INITIALISE(g_state.local) + + DEBUG_TRACE(SERVICE_CALLBACK_LINE); @@ -80231,9 +80998,6 @@ index 0000000..e11c0e0 + user_service->msg_queue[user_service->msg_insert & + (MSG_QUEUE_SIZE - 1)] = header; + user_service->msg_insert++; -+ spin_unlock(&msg_queue_spinlock); -+ -+ up(&user_service->insert_event); + + /* If there is a thread waiting in DEQUEUE_MESSAGE, or if + ** there is a MESSAGE_AVAILABLE in the completion queue then @@ -80242,13 +81006,22 @@ index 0000000..e11c0e0 + if (((user_service->message_available_pos - + instance->completion_remove) >= 0) || + user_service->dequeue_pending) { -+ DEBUG_TRACE(SERVICE_CALLBACK_LINE); + user_service->dequeue_pending = 0; -+ return VCHIQ_SUCCESS; ++ skip_completion = 1; + } + ++ spin_unlock(&msg_queue_spinlock); ++ ++ up(&user_service->insert_event); ++ + header = NULL; + } ++ ++ if (skip_completion) { ++ DEBUG_TRACE(SERVICE_CALLBACK_LINE); ++ return VCHIQ_SUCCESS; ++ } ++ + DEBUG_TRACE(SERVICE_CALLBACK_LINE); + + return add_completion(instance, reason, header, user_service, @@ -81359,8 +82132,7 @@ index 0000000..e11c0e0 + } + + down_read(&current->mm->mmap_sem); -+ rc = get_user_pages(current, /* task */ -+ current->mm, /* mm */ ++ rc = get_user_pages( + (unsigned long)virt_addr, /* start */ + num_pages, /* len */ + 0, /* write */ @@ -81399,7 +82171,7 @@ index 0000000..e11c0e0 + kunmap(page); + + for (page_idx = 0; page_idx < num_pages; page_idx++) -+ page_cache_release(pages[page_idx]); ++ put_page(pages[page_idx]); + + kfree(pages); +} @@ -83315,10 +84087,10 @@ index 0000000..863b3e3 +#endif /* VCHIQ_CONNECTED_H */ diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_core.c b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_core.c new file mode 100644 -index 0000000..2c98da4 +index 0000000..160db24 --- /dev/null +++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_core.c -@@ -0,0 +1,3934 @@ +@@ -0,0 +1,3929 @@ +/** + * Copyright (c) 2010-2012 Broadcom. All rights reserved. + * @@ -84212,16 +84984,14 @@ index 0000000..2c98da4 + error_count); + return VCHIQ_ERROR; + } -+ if (i == 0) { -+ if (SRVTRACE_ENABLED(service, -+ VCHIQ_LOG_INFO)) -+ vchiq_log_dump_mem("Sent", 0, -+ header->data + pos, -+ min(64u, -+ elements[0].size)); -+ } + } + ++ if (SRVTRACE_ENABLED(service, ++ VCHIQ_LOG_INFO)) ++ vchiq_log_dump_mem("Sent", 0, ++ header->data, ++ min(16, pos)); ++ + spin_lock(&quota_spinlock); + service_quota->message_use_count++; + @@ -84360,16 +85130,13 @@ index 0000000..2c98da4 + error_count); + return VCHIQ_ERROR; + } -+ if (i == 0) { -+ if (vchiq_sync_log_level >= -+ VCHIQ_LOG_TRACE) -+ vchiq_log_dump_mem("Sent Sync", -+ 0, header->data + pos, -+ min(64u, -+ elements[0].size)); -+ } + } + ++ if (vchiq_sync_log_level >= VCHIQ_LOG_TRACE) ++ vchiq_log_dump_mem("Sent Sync", ++ 0, header->data, ++ min(16, pos)); ++ + VCHIQ_SERVICE_STATS_INC(service, ctrl_tx_count); + VCHIQ_SERVICE_STATS_ADD(service, ctrl_tx_bytes, size); + } else { @@ -85041,7 +85808,7 @@ index 0000000..2c98da4 + remoteport, localport, size); + if (size > 0) + vchiq_log_dump_mem("Rcvd", 0, header->data, -+ min(64, size)); ++ min(16, size)); + } + + if (((unsigned int)header & VCHIQ_SLOT_MASK) + calc_stride(size) @@ -85508,7 +86275,7 @@ index 0000000..2c98da4 + remoteport, localport, size); + if (size > 0) + vchiq_log_dump_mem("Rcvd", 0, header->data, -+ min(64, size)); ++ min(16, size)); + } + + switch (type) { @@ -90705,10 +91472,10 @@ index 0000000..b6bfa21 + return vchiq_build_time; +} -From 2cabfc660c80dd79f24a8323b3913b5060ebf750 Mon Sep 17 00:00:00 2001 +From 5e58581648c99f1696b84c9e4b8b89eb3c659407 Mon Sep 17 00:00:00 2001 From: popcornmix <popcornmix@gmail.com> Date: Wed, 17 Jun 2015 16:07:06 +0100 -Subject: [PATCH 038/170] vc_mem: Add vc_mem driver +Subject: [PATCH 042/112] vc_mem: Add vc_mem driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -91713,10 +92480,10 @@ index 0000000..20a4753 + +#endif /* _VC_MEM_H */ -From 01574b9e0f1086399e7f796cc1dc8fcadabf4a46 Mon Sep 17 00:00:00 2001 +From 9e8a9f6739d247779cfed83ca57c70c963eaa14e Mon Sep 17 00:00:00 2001 From: Tim Gover <tgover@broadcom.com> Date: Tue, 22 Jul 2014 15:41:04 +0100 -Subject: [PATCH 039/170] vcsm: VideoCore shared memory service for BCM2835 +Subject: [PATCH 043/112] vcsm: VideoCore shared memory service for BCM2835 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -91764,9 +92531,9 @@ Signed-off-by: Noralf Trønnes <noralf@tronnes.org> drivers/char/broadcom/vc_sm/vc_sm_knl.h | 55 + drivers/char/broadcom/vc_sm/vc_vchi_sm.c | 492 +++++ drivers/char/broadcom/vc_sm/vc_vchi_sm.h | 82 + - drivers/char/broadcom/vc_sm/vmcs_sm.c | 3211 ++++++++++++++++++++++++++++++ + drivers/char/broadcom/vc_sm/vmcs_sm.c | 3213 ++++++++++++++++++++++++++++++ include/linux/broadcom/vmcs_sm_ioctl.h | 248 +++ - 9 files changed, 4299 insertions(+) + 9 files changed, 4301 insertions(+) create mode 100644 drivers/char/broadcom/vc_sm/Makefile create mode 100644 drivers/char/broadcom/vc_sm/vc_sm_defs.h create mode 100644 drivers/char/broadcom/vc_sm/vc_sm_knl.h @@ -92662,10 +93429,10 @@ index 0000000..5e279f5 +#endif /* __VC_VCHI_SM_H__INCLUDED__ */ diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c new file mode 100644 -index 0000000..5d16e35 +index 0000000..1db6716 --- /dev/null +++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c -@@ -0,0 +1,3211 @@ +@@ -0,0 +1,3213 @@ +/***************************************************************************** +* Copyright 2011-2012 Broadcom Corporation. All rights reserved. +* @@ -92865,12 +93632,14 @@ index 0000000..5d16e35 +static struct SM_STATE_T *sm_state; +static int sm_inited; + ++#if 0 +static const char *const sm_cache_map_vector[] = { + "(null)", + "host", + "videocore", + "host+videocore", +}; ++#endif + +/* ---- Private Function Prototypes -------------------------------------- */ + @@ -96132,10 +96901,10 @@ index 0000000..334f36d + +#endif /* __VMCS_SM_IOCTL_H__INCLUDED__ */ -From 832077a0f61e44a9259b153f60eb233fa723c2a9 Mon Sep 17 00:00:00 2001 +From a8149b98a7e18684c916b50e54b5b4c365bbe530 Mon Sep 17 00:00:00 2001 From: Luke Wren <luke@raspberrypi.org> Date: Fri, 21 Aug 2015 23:14:48 +0100 -Subject: [PATCH 040/170] Add /dev/gpiomem device for rootless user GPIO access +Subject: [PATCH 044/112] Add /dev/gpiomem device for rootless user GPIO access Signed-off-by: Luke Wren <luke@raspberrypi.org> @@ -96446,10 +97215,10 @@ index 0000000..911f5b7 +MODULE_DESCRIPTION("gpiomem driver for accessing GPIO from userspace"); +MODULE_AUTHOR("Luke Wren <luke@raspberrypi.org>"); -From 6609b15c34f26f34b4b49e7726693a1de321078c Mon Sep 17 00:00:00 2001 +From e4a7770dc5ecfcd28d0caef360659afd54bb95e5 Mon Sep 17 00:00:00 2001 From: Luke Wren <wren6991@gmail.com> Date: Sat, 5 Sep 2015 01:14:45 +0100 -Subject: [PATCH 041/170] Add SMI driver +Subject: [PATCH 045/112] Add SMI driver Signed-off-by: Luke Wren <wren6991@gmail.com> --- @@ -96981,7 +97750,7 @@ index 0000000..d6efd92 + "Character device driver for BCM2835's secondary memory interface"); +MODULE_AUTHOR("Luke Wren <luke@raspberrypi.org>"); diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig -index b859ce0..b978ba9 100644 +index 90af750..7011b2d 100644 --- a/drivers/misc/Kconfig +++ b/drivers/misc/Kconfig @@ -10,6 +10,14 @@ config SENSORS_LIS3LV02D @@ -97000,7 +97769,7 @@ index b859ce0..b978ba9 100644 tristate "Analog Devices Digital Potentiometers" depends on (I2C || SPI) && SYSFS diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile -index ac24d77..1acff5b 100644 +index 1a58cf7..28989fa 100644 --- a/drivers/misc/Makefile +++ b/drivers/misc/Makefile @@ -9,6 +9,7 @@ obj-$(CONFIG_AD525X_DPOT_SPI) += ad525x_dpot-spi.o @@ -98400,18 +99169,18 @@ index 0000000..ee3a75e + +#endif /* BCM2835_SMI_H */ -From f4d44b2c447c401791645627e88d0ef9830c1239 Mon Sep 17 00:00:00 2001 +From 6da5091e686e4c92424fe6d70a96baf54fbcc2fd Mon Sep 17 00:00:00 2001 From: Luke Wren <wren6991@gmail.com> Date: Sat, 5 Sep 2015 01:16:10 +0100 -Subject: [PATCH 042/170] Add SMI NAND driver +Subject: [PATCH 046/112] Add SMI NAND driver Signed-off-by: Luke Wren <wren6991@gmail.com> --- .../bindings/mtd/brcm,bcm2835-smi-nand.txt | 42 ++++ drivers/mtd/nand/Kconfig | 7 + drivers/mtd/nand/Makefile | 1 + - drivers/mtd/nand/bcm2835_smi_nand.c | 268 +++++++++++++++++++++ - 4 files changed, 318 insertions(+) + drivers/mtd/nand/bcm2835_smi_nand.c | 267 +++++++++++++++++++++ + 4 files changed, 317 insertions(+) create mode 100644 Documentation/devicetree/bindings/mtd/brcm,bcm2835-smi-nand.txt create mode 100644 drivers/mtd/nand/bcm2835_smi_nand.c @@ -98465,7 +99234,7 @@ index 0000000..159544d +}; \ No newline at end of file diff --git a/drivers/mtd/nand/Kconfig b/drivers/mtd/nand/Kconfig -index 2896640..56ff00b 100644 +index f05e0e9..8c69541 100644 --- a/drivers/mtd/nand/Kconfig +++ b/drivers/mtd/nand/Kconfig @@ -41,6 +41,13 @@ config MTD_SM_COMMON @@ -98483,7 +99252,7 @@ index 2896640..56ff00b 100644 tristate diff --git a/drivers/mtd/nand/Makefile b/drivers/mtd/nand/Makefile -index 2c7f014b..30e22f0 100644 +index f553353..ea8d647 100644 --- a/drivers/mtd/nand/Makefile +++ b/drivers/mtd/nand/Makefile @@ -14,6 +14,7 @@ obj-$(CONFIG_MTD_NAND_DENALI) += denali.o @@ -98496,10 +99265,10 @@ index 2c7f014b..30e22f0 100644 obj-$(CONFIG_MTD_NAND_DAVINCI) += davinci_nand.o diff --git a/drivers/mtd/nand/bcm2835_smi_nand.c b/drivers/mtd/nand/bcm2835_smi_nand.c new file mode 100644 -index 0000000..b747326 +index 0000000..02adda6 --- /dev/null +++ b/drivers/mtd/nand/bcm2835_smi_nand.c -@@ -0,0 +1,268 @@ +@@ -0,0 +1,267 @@ +/** + * NAND flash driver for Broadcom Secondary Memory Interface + * @@ -98692,7 +99461,6 @@ index 0000000..b747326 + mtd->owner = THIS_MODULE; + mtd->dev.parent = dev; + mtd->name = DRIVER_NAME; -+ ppdata.of_node = node; + + /* 20 us command delay time... */ + this->chip_delay = 20; @@ -98769,10 +99537,10 @@ index 0000000..b747326 + ("Driver for NAND chips using Broadcom Secondary Memory Interface"); +MODULE_AUTHOR("Luke Wren <luke@raspberrypi.org>"); -From 2faad8f6644fa53418c5a7b80da8d5400b72df3f Mon Sep 17 00:00:00 2001 +From d294fc10d2c2d93dd5280e2ef30f4b6dfa7ad3bf Mon Sep 17 00:00:00 2001 From: Aron Szabo <aron@aron.ws> Date: Sat, 16 Jun 2012 12:15:55 +0200 -Subject: [PATCH 043/170] lirc: added support for RaspberryPi GPIO +Subject: [PATCH 047/112] lirc: added support for RaspberryPi GPIO lirc_rpi: Use read_current_timer to determine transmitter delay. Thanks to jjmz and others See: https://github.com/raspberrypi/linux/issues/525 @@ -98857,7 +99625,7 @@ index 5430adf..9e53cd0 100644 obj-$(CONFIG_LIRC_SIR) += lirc_sir.o diff --git a/drivers/staging/media/lirc/lirc_rpi.c b/drivers/staging/media/lirc/lirc_rpi.c new file mode 100644 -index 0000000..cd09c99 +index 0000000..0624439 --- /dev/null +++ b/drivers/staging/media/lirc/lirc_rpi.c @@ -0,0 +1,730 @@ @@ -99134,7 +99902,7 @@ index 0000000..cd09c99 + data = PULSE_MASK; /* really long time */ + if (!(signal^sense)) { + /* sanity check */ -+ printk(KERN_WARNING LIRC_DRIVER_NAME ++ printk(KERN_DEBUG LIRC_DRIVER_NAME + ": AIEEEE: %d %d %lx %lx %lx %lx\n", + signal, sense, tv.tv_sec, lasttv.tv_sec, + tv.tv_usec, lasttv.tv_usec); @@ -99621,10 +100389,10 @@ index 0000000..fb69624 + +#endif -From 3c7ea37319a4974cbf6b89a84c109a53f4d6b408 Mon Sep 17 00:00:00 2001 +From 2fd607ce8d6e45776c6f6d750dc5e167d8865f54 Mon Sep 17 00:00:00 2001 From: popcornmix <popcornmix@gmail.com> Date: Wed, 3 Jul 2013 00:49:20 +0100 -Subject: [PATCH 044/170] Add cpufreq driver +Subject: [PATCH 048/112] Add cpufreq driver Signed-off-by: popcornmix <popcornmix@gmail.com> --- @@ -99635,12 +100403,12 @@ Signed-off-by: popcornmix <popcornmix@gmail.com> create mode 100644 drivers/cpufreq/bcm2835-cpufreq.c diff --git a/drivers/cpufreq/Kconfig.arm b/drivers/cpufreq/Kconfig.arm -index b1f8a73..930b3ef 100644 +index 14b1f93..c6e8bd5 100644 --- a/drivers/cpufreq/Kconfig.arm +++ b/drivers/cpufreq/Kconfig.arm -@@ -217,6 +217,15 @@ config ARM_SPEAR_CPUFREQ - help - This adds the CPUFreq driver support for SPEAr SOCs. +@@ -229,6 +229,15 @@ config ARM_STI_CPUFREQ + this config option if you wish to add CPUFreq support for STi based + SoCs. +config ARM_BCM2835_CPUFREQ + depends on RASPBERRYPI_FIRMWARE @@ -99655,13 +100423,13 @@ index b1f8a73..930b3ef 100644 bool "Tegra20 CPUFreq support" depends on ARCH_TEGRA diff --git a/drivers/cpufreq/Makefile b/drivers/cpufreq/Makefile -index c0af1a1..f6a753a 100644 +index 9e63fb1..9e55083 100644 --- a/drivers/cpufreq/Makefile +++ b/drivers/cpufreq/Makefile -@@ -73,6 +73,7 @@ obj-$(CONFIG_ARM_SA1100_CPUFREQ) += sa1100-cpufreq.o - obj-$(CONFIG_ARM_SA1110_CPUFREQ) += sa1110-cpufreq.o +@@ -74,6 +74,7 @@ obj-$(CONFIG_ARM_SA1110_CPUFREQ) += sa1110-cpufreq.o obj-$(CONFIG_ARM_SCPI_CPUFREQ) += scpi-cpufreq.o obj-$(CONFIG_ARM_SPEAR_CPUFREQ) += spear-cpufreq.o + obj-$(CONFIG_ARM_STI_CPUFREQ) += sti-cpufreq.o +obj-$(CONFIG_ARM_BCM2835_CPUFREQ) += bcm2835-cpufreq.o obj-$(CONFIG_ARM_TEGRA20_CPUFREQ) += tegra20-cpufreq.o obj-$(CONFIG_ARM_TEGRA124_CPUFREQ) += tegra124-cpufreq.o @@ -99886,10 +100654,10 @@ index 0000000..3eb9e93 +module_init(bcm2835_cpufreq_module_init); +module_exit(bcm2835_cpufreq_module_exit); -From 776e87ffc8b137ea465e7b0076e56cd71d9c56d1 Mon Sep 17 00:00:00 2001 +From aed691d5d3e8bd608d947a963c71413b068f4575 Mon Sep 17 00:00:00 2001 From: popcornmix <popcornmix@gmail.com> Date: Tue, 26 Mar 2013 19:24:24 +0000 -Subject: [PATCH 045/170] Added hwmon/thermal driver for reporting core +Subject: [PATCH 049/112] Added hwmon/thermal driver for reporting core temperature. Thanks Dorian MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -99903,17 +100671,17 @@ Don't add platform device when booting in DT mode. Signed-off-by: Noralf Trønnes <noralf@tronnes.org> --- - drivers/thermal/Kconfig | 7 ++ + drivers/thermal/Kconfig | 7 +++ drivers/thermal/Makefile | 1 + - drivers/thermal/bcm2835-thermal.c | 141 ++++++++++++++++++++++++++++++++++++++ - 3 files changed, 149 insertions(+) + drivers/thermal/bcm2835-thermal.c | 109 ++++++++++++++++++++++++++++++++++++++ + 3 files changed, 117 insertions(+) create mode 100644 drivers/thermal/bcm2835-thermal.c diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig -index 8cc4ac6..b273311 100644 +index 3c3dc4a..6789340 100644 --- a/drivers/thermal/Kconfig +++ b/drivers/thermal/Kconfig -@@ -285,6 +285,13 @@ config INTEL_POWERCLAMP +@@ -292,6 +292,13 @@ config INTEL_POWERCLAMP enforce idle time which results in more package C-state residency. The user interface is exposed via generic thermal framework. @@ -99928,7 +100696,7 @@ index 8cc4ac6..b273311 100644 tristate "X86 package temperature thermal driver" depends on X86_THERMAL_VECTOR diff --git a/drivers/thermal/Makefile b/drivers/thermal/Makefile -index cfae6a6..b0e336f 100644 +index 8e9cbc3..497014c 100644 --- a/drivers/thermal/Makefile +++ b/drivers/thermal/Makefile @@ -38,6 +38,7 @@ obj-$(CONFIG_ARMADA_THERMAL) += armada_thermal.o @@ -99941,10 +100709,10 @@ index cfae6a6..b0e336f 100644 obj-$(CONFIG_INTEL_SOC_DTS_THERMAL) += intel_soc_dts_thermal.o diff --git a/drivers/thermal/bcm2835-thermal.c b/drivers/thermal/bcm2835-thermal.c new file mode 100644 -index 0000000..08d8dc7 +index 0000000..c63fb9f --- /dev/null +++ b/drivers/thermal/bcm2835-thermal.c -@@ -0,0 +1,141 @@ +@@ -0,0 +1,109 @@ +/***************************************************************************** +* Copyright 2011 Broadcom Corporation. All rights reserved. +* @@ -99996,38 +100764,8 @@ index 0000000..08d8dc7 + RPI_FIRMWARE_GET_TEMPERATURE); +} + -+static int bcm2835_thermal_get_max_temp(struct thermal_zone_device *tz, -+ int trip, int *temp) -+{ -+ /* -+ * The maximum safe temperature of the SoC. -+ * Overclock may be disabled above this temperature. -+ */ -+ return bcm2835_thermal_get_property(tz, temp, -+ RPI_FIRMWARE_GET_MAX_TEMPERATURE); -+} -+ -+static int bcm2835_thermal_get_trip_type(struct thermal_zone_device *tz, -+ int trip, enum thermal_trip_type *type) -+{ -+ *type = THERMAL_TRIP_HOT; -+ -+ return 0; -+} -+ -+static int bcm2835_thermal_get_mode(struct thermal_zone_device *tz, -+ enum thermal_device_mode *mode) -+{ -+ *mode = THERMAL_DEVICE_ENABLED; -+ -+ return 0; -+} -+ +static struct thermal_zone_device_ops ops = { + .get_temp = bcm2835_thermal_get_temp, -+ .get_trip_temp = bcm2835_thermal_get_max_temp, -+ .get_trip_type = bcm2835_thermal_get_trip_type, -+ .get_mode = bcm2835_thermal_get_mode, +}; + +static int bcm2835_thermal_probe(struct platform_device *pdev) @@ -100037,17 +100775,15 @@ index 0000000..08d8dc7 + struct thermal_zone_device *tz; + + fw_np = of_parse_phandle(pdev->dev.of_node, "firmware", 0); -+/* Remove comment when booting without Device Tree is no longer supported + if (!fw_np) { + dev_err(&pdev->dev, "Missing firmware node\n"); + return -ENOENT; + } -+*/ + fw = rpi_firmware_get(fw_np); + if (!fw) + return -EPROBE_DEFER; + -+ tz = thermal_zone_device_register("bcm2835_thermal", 1, 0, fw, &ops, ++ tz = thermal_zone_device_register("bcm2835_thermal", 0, 0, fw, &ops, + NULL, 0, 0); + if (IS_ERR(tz)) { + dev_err(&pdev->dev, "Failed to register the thermal device\n"); @@ -100087,10 +100823,10 @@ index 0000000..08d8dc7 +MODULE_DESCRIPTION("Thermal driver for bcm2835 chip"); +MODULE_LICENSE("GPL"); -From 72181304010d3aa74cd2b98db592554a541ce4c2 Mon Sep 17 00:00:00 2001 +From 61031ab34cccd4b7be3198a2b91bd585caceed78 Mon Sep 17 00:00:00 2001 From: popcornmix <popcornmix@gmail.com> Date: Wed, 17 Jun 2015 15:44:08 +0100 -Subject: [PATCH 046/170] Add Chris Boot's i2c driver +Subject: [PATCH 050/112] Add Chris Boot's i2c driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -100171,15 +100907,17 @@ validity of the chip_select value. i2c-bcm2708: Remove non-DT support Signed-off-by: Noralf Trønnes <noralf@tronnes.org> + +Set the BSC_CLKT clock streching timeout to 35ms as per SMBus specs. --- drivers/i2c/busses/Kconfig | 21 +- drivers/i2c/busses/Makefile | 2 + - drivers/i2c/busses/i2c-bcm2708.c | 493 +++++++++++++++++++++++++++++++++++++++ - 3 files changed, 515 insertions(+), 1 deletion(-) + drivers/i2c/busses/i2c-bcm2708.c | 508 +++++++++++++++++++++++++++++++++++++++ + 3 files changed, 530 insertions(+), 1 deletion(-) create mode 100644 drivers/i2c/busses/i2c-bcm2708.c diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig -index 7b0aa82..effadb0 100644 +index 0967e1a..c11fce1 100644 --- a/drivers/i2c/busses/Kconfig +++ b/drivers/i2c/busses/Kconfig @@ -8,6 +8,25 @@ menu "I2C Hardware Bus support" @@ -100232,10 +100970,10 @@ index 37f2819..e309579 100644 diff --git a/drivers/i2c/busses/i2c-bcm2708.c b/drivers/i2c/busses/i2c-bcm2708.c new file mode 100644 -index 0000000..85f411c +index 0000000..c9b8e5c --- /dev/null +++ b/drivers/i2c/busses/i2c-bcm2708.c -@@ -0,0 +1,493 @@ +@@ -0,0 +1,508 @@ +/* + * Driver for Broadcom BCM2708 BSC Controllers + * @@ -100309,7 +101047,7 @@ index 0000000..85f411c + +#define DRV_NAME "bcm2708_i2c" + -+static unsigned int baudrate = CONFIG_I2C_BCM2708_BAUDRATE; ++static unsigned int baudrate; +module_param(baudrate, uint, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP); +MODULE_PARM_DESC(baudrate, "The I2C baudrate"); + @@ -100325,6 +101063,7 @@ index 0000000..85f411c + int irq; + struct clk *clk; + u32 cdiv; ++ u32 clk_tout; + + struct completion done; + @@ -100364,7 +101103,7 @@ index 0000000..85f411c + +static inline int bcm2708_bsc_setup(struct bcm2708_i2c *bi) +{ -+ u32 cdiv, s; ++ u32 cdiv, s, clk_tout; + u32 c = BSC_C_I2CEN | BSC_C_INTD | BSC_C_ST | BSC_C_CLEAR_1; + int wait_loops = I2C_WAIT_LOOP_COUNT; + @@ -100372,12 +101111,14 @@ index 0000000..85f411c + * Use the value that we cached in the probe. + */ + cdiv = bi->cdiv; ++ clk_tout = bi->clk_tout; + + if (bi->msg->flags & I2C_M_RD) + c |= BSC_C_INTR | BSC_C_READ; + else + c |= BSC_C_INTT; + ++ bcm2708_wr(bi, BSC_CLKT, clk_tout); + bcm2708_wr(bi, BSC_DIV, cdiv); + bcm2708_wr(bi, BSC_A, bi->msg->addr); + bcm2708_wr(bi, BSC_DLEN, bi->msg->len); @@ -100550,7 +101291,10 @@ index 0000000..85f411c + struct bcm2708_i2c *bi; + struct i2c_adapter *adap; + unsigned long bus_hz; -+ u32 cdiv; ++ u32 cdiv, clk_tout; ++ u32 baud; ++ ++ baud = CONFIG_I2C_BCM2708_BAUDRATE; + + if (pdev->dev.of_node) { + u32 bus_clk_rate; @@ -100561,12 +101305,15 @@ index 0000000..85f411c + } + if (!of_property_read_u32(pdev->dev.of_node, + "clock-frequency", &bus_clk_rate)) -+ baudrate = bus_clk_rate; ++ baud = bus_clk_rate; + else + dev_warn(&pdev->dev, + "Could not read clock-frequency property\n"); + } + ++ if (baudrate) ++ baud = baudrate; ++ + regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!regs) { + dev_err(&pdev->dev, "could not get IO memory\n"); @@ -100650,15 +101397,21 @@ index 0000000..85f411c + } + + bus_hz = clk_get_rate(bi->clk); -+ cdiv = bus_hz / baudrate; ++ cdiv = bus_hz / baud; + if (cdiv > 0xffff) { + cdiv = 0xffff; -+ baudrate = bus_hz / cdiv; ++ baud = bus_hz / cdiv; + } ++ ++ clk_tout = 35/1000*baud; //35ms timeout as per SMBus specs. ++ if (clk_tout > 0xffff) ++ clk_tout = 0xffff; ++ + bi->cdiv = cdiv; ++ bi->clk_tout = clk_tout; + + dev_info(&pdev->dev, "BSC%d Controller at 0x%08lx (irq %d) (baudrate %d)\n", -+ pdev->id, (unsigned long)regs->start, irq, baudrate); ++ pdev->id, (unsigned long)regs->start, irq, baud); + + return 0; + @@ -100730,10 +101483,10 @@ index 0000000..85f411c +MODULE_LICENSE("GPL v2"); +MODULE_ALIAS("platform:" DRV_NAME); -From abcf04d54ccb3d0897b1f7a95ddf9d9ccf63dc76 Mon Sep 17 00:00:00 2001 +From 299b995c56f17d7b8b67cb128f170f7f552e7b54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= <noralf@tronnes.org> Date: Fri, 26 Jun 2015 14:27:06 +0200 -Subject: [PATCH 047/170] char: broadcom: Add vcio module +Subject: [PATCH 051/112] char: broadcom: Add vcio module MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -100959,10 +101712,10 @@ index 0000000..c19bc20 +MODULE_DESCRIPTION("Mailbox userspace access"); +MODULE_LICENSE("GPL"); -From a205e934b63b6bf3f5f74bc39974ec6ff09df596 Mon Sep 17 00:00:00 2001 +From ae4644ff503855f8f68767d92b9abbf9ffa7c5bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= <noralf@tronnes.org> Date: Fri, 26 Jun 2015 14:25:01 +0200 -Subject: [PATCH 048/170] firmware: bcm2835: Support ARCH_BCM270x +Subject: [PATCH 052/112] firmware: bcm2835: Support ARCH_BCM270x MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -101068,10 +101821,10 @@ index dd506cd3..b980d53 100644 MODULE_AUTHOR("Eric Anholt <eric@anholt.net>"); MODULE_DESCRIPTION("Raspberry Pi firmware driver"); -From 4d74ee3d433df319ae3fc36bd16fd96b4bbff865 Mon Sep 17 00:00:00 2001 +From fcaa83d6edd872b393cad689acf8b1975af74867 Mon Sep 17 00:00:00 2001 From: Vincent Sanders <vincent.sanders@collabora.co.uk> Date: Wed, 30 Jan 2013 12:45:18 +0000 -Subject: [PATCH 049/170] bcm2835: add v4l2 camera device +Subject: [PATCH 053/112] bcm2835: add v4l2 camera device - Supports raw YUV capture, preview, JPEG and H264. - Uses videobuf2 for data transfer, using dma_buf. @@ -101348,25 +102101,120 @@ are now returned as they are being flushed on stop_streaming. squash: Fixup bcm2835-camera for changes in kernel 4.4 api + +v4l2: Fix up driver to upstream timestamp changes + +bcm2835-camera: fix a bug in computation of frame timestamp + +Fixes #1318 + +V4L2 driver updates (#1393) + +* BCM2835-V4L2: Correct ISO control and add V4L2_CID_ISO_SENSITIVITY_AUTO + +https://github.com/raspberrypi/linux/issues/1251 + +V4L2_CID_ISO_SENSITIVITY was not advertising ISO*1000 as it should. +V4L2_CID_ISO_SENSITIVITY_AUTO was not implemented, so was taking +V4L2_CID_ISO_SENSITIVITY as 0 for auto mode. +Still accepts 0 for auto, but also abides by the new parameter. + +Signed-off-by: Dave Stevenson <6by9@users.noreply.github.com> + +* BCM2835-V4L2: Add a video_nr parameter. + +Adds a kernel parameter "video_nr" to specify the preferred +/dev/videoX device node. +https://www.raspberrypi.org/forums/viewtopic.php?f=38&t=136120&p=905545 + +Signed-off-by: Dave Stevenson <6by9@users.noreply.github.com> + +* BCM2835-V4L2: Add support for multiple cameras + +Ask GPU on load how many cameras have been detected, and +enumerate that number of devices. +Only applicable on the Compute Module as no other device +exposes multiple CSI2 interfaces. + +Signed-off-by: Dave Stevenson <6by9@users.noreply.github.com> + +* BCM2835-V4L2: Add control of the overlay location and alpha. + +Actually do something useful in vidioc_s_fmt_vid_overlay and +vidioc_try_fmt_vid_overlay, rather than effectively having +read-only fields. + +Signed-off-by: Dave Stevenson <6by9@users.noreply.github.com> + +* BCM2835-V4L2: V4L2-Compliance failure fix + +VIDIOC_TRY_FMT was failing due to bytesperline not +being set correctly by default. + +Signed-off-by: Dave Stevenson <6by9@users.noreply.github.com> + +* BCM2835-V4L2: Make all module parameters static + +Clean up to correct variable scope + +Signed-off-by: Dave Stevenson <6by9@users.noreply.github.com> + +V4L2: Request maximum resolution from GPU + +Get resolution information about the sensors from the GPU +and advertise it correctly. + +Signed-off-by: Dave Stevenson <6by9@users.noreply.github.com> + +BCM2835-V4L2: Increase minimum resolution to 32x32 + +https://github.com/raspberrypi/linux/issues/1498 showed +up that 16x16 is failing to work on the GPU for some reason. + +GPU bug being tracked on +https://github.com/raspberrypi/firmware/issues/607 +Workaround here by increasing minimum resolution via V4L2 +to 32x32. + +Signed-off-by: Dave Stevenson <6by9@users.noreply.github.com> + +[media]: bcm2835-camera: fix compilation error + +There is an error when compiling rpi-4.6.y branch: + CC [M] drivers/media/platform/bcm2835/bcm2835-camera.o +drivers/media/platform/bcm2835/bcm2835-camera.c:639:17: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types] + .queue_setup = queue_setup, + ^ +drivers/media/platform/bcm2835/bcm2835-camera.c:639:17: note: (near initialization for 'bm2835_mmal_video_qops.queue_setup') + +The const void *parg in setup_queue callback is not needed since commit: +df9ecb0cad14b952a2865f8b3af86b2bbadfab45. +This commit removes it. + +Signed-off-by: Slawomir Stepien <sst@poczta.fm> + +bcm2835-camera: Fix max/min error when looping over cameras/resolutions + +See: https://github.com/raspberrypi/linux/issues/1447#issuecomment-221303506 --- Documentation/video4linux/bcm2835-v4l2.txt | 60 + drivers/media/platform/Kconfig | 2 + drivers/media/platform/Makefile | 2 + drivers/media/platform/bcm2835/Kconfig | 25 + drivers/media/platform/bcm2835/Makefile | 5 + - drivers/media/platform/bcm2835/bcm2835-camera.c | 1844 +++++++++++++++++++++ - drivers/media/platform/bcm2835/bcm2835-camera.h | 126 ++ - drivers/media/platform/bcm2835/controls.c | 1324 +++++++++++++++ + drivers/media/platform/bcm2835/bcm2835-camera.c | 1982 ++++++++++++++++++++++ + drivers/media/platform/bcm2835/bcm2835-camera.h | 144 ++ + drivers/media/platform/bcm2835/controls.c | 1345 +++++++++++++++ drivers/media/platform/bcm2835/mmal-common.h | 53 + drivers/media/platform/bcm2835/mmal-encodings.h | 127 ++ drivers/media/platform/bcm2835/mmal-msg-common.h | 50 + drivers/media/platform/bcm2835/mmal-msg-format.h | 81 + drivers/media/platform/bcm2835/mmal-msg-port.h | 107 ++ drivers/media/platform/bcm2835/mmal-msg.h | 404 +++++ - drivers/media/platform/bcm2835/mmal-parameters.h | 656 ++++++++ - drivers/media/platform/bcm2835/mmal-vchiq.c | 1916 ++++++++++++++++++++++ + drivers/media/platform/bcm2835/mmal-parameters.h | 689 ++++++++ + drivers/media/platform/bcm2835/mmal-vchiq.c | 1916 +++++++++++++++++++++ drivers/media/platform/bcm2835/mmal-vchiq.h | 178 ++ - 17 files changed, 6960 insertions(+) + 17 files changed, 7170 insertions(+) create mode 100644 Documentation/video4linux/bcm2835-v4l2.txt create mode 100644 drivers/media/platform/bcm2835/Kconfig create mode 100644 drivers/media/platform/bcm2835/Makefile @@ -101450,7 +102298,7 @@ index 0000000..c585a8f + +$ v4l2-ctl --list-formats diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig -index ccbc974..63c9715 100644 +index 201f5c2..b798ab8 100644 --- a/drivers/media/platform/Kconfig +++ b/drivers/media/platform/Kconfig @@ -11,6 +11,8 @@ menuconfig V4L_PLATFORM_DRIVERS @@ -101463,7 +102311,7 @@ index ccbc974..63c9715 100644 config VIDEO_VIA_CAMERA diff --git a/drivers/media/platform/Makefile b/drivers/media/platform/Makefile -index efa0295..8c0b3b5 100644 +index bbb7bd1..6fe5b3f 100644 --- a/drivers/media/platform/Makefile +++ b/drivers/media/platform/Makefile @@ -2,6 +2,8 @@ @@ -101472,9 +102320,9 @@ index efa0295..8c0b3b5 100644 +obj-$(CONFIG_VIDEO_BCM2835) += bcm2835/ + - obj-$(CONFIG_VIDEO_TIMBERDALE) += timblogiw.o obj-$(CONFIG_VIDEO_M32R_AR_M64278) += arv.o + obj-$(CONFIG_VIDEO_VIA_CAMERA) += via-camera.o diff --git a/drivers/media/platform/bcm2835/Kconfig b/drivers/media/platform/bcm2835/Kconfig new file mode 100644 index 0000000..99a5cbc @@ -101519,10 +102367,10 @@ index 0000000..f17c79c +ccflags-$(CONFIG_VIDEO_BCM2835) += -Idrivers/misc/vc04_services -Idrivers/misc/vc04_services/interface/vcos/linuxkernel -D__VCCOREVER__=0x04000000 diff --git a/drivers/media/platform/bcm2835/bcm2835-camera.c b/drivers/media/platform/bcm2835/bcm2835-camera.c new file mode 100644 -index 0000000..e83334c +index 0000000..1b16c63 --- /dev/null +++ b/drivers/media/platform/bcm2835/bcm2835-camera.c -@@ -0,0 +1,1844 @@ +@@ -0,0 +1,1982 @@ +/* + * Broadcom BM2835 V4L2 driver + * @@ -101561,15 +102409,15 @@ index 0000000..e83334c + +#define BM2835_MMAL_VERSION "0.0.2" +#define BM2835_MMAL_MODULE_NAME "bcm2835-v4l2" -+#define MIN_WIDTH 16 -+#define MIN_HEIGHT 16 -+#define MAX_WIDTH 2592 -+#define MAX_HEIGHT 1944 ++#define MIN_WIDTH 32 ++#define MIN_HEIGHT 32 +#define MIN_BUFFER_SIZE (80*1024) + +#define MAX_VIDEO_MODE_WIDTH 1280 +#define MAX_VIDEO_MODE_HEIGHT 720 + ++#define MAX_BCM2835_CAMERAS 2 ++ +MODULE_DESCRIPTION("Broadcom 2835 MMAL video capture"); +MODULE_AUTHOR("Vincent Sanders"); +MODULE_LICENSE("GPL"); @@ -101579,8 +102427,13 @@ index 0000000..e83334c +module_param_named(debug, bcm2835_v4l2_debug, int, 0644); +MODULE_PARM_DESC(bcm2835_v4l2_debug, "Debug level 0-2"); + -+int max_video_width = MAX_VIDEO_MODE_WIDTH; -+int max_video_height = MAX_VIDEO_MODE_HEIGHT; ++#define UNSET (-1) ++static int video_nr[] = {[0 ... (MAX_BCM2835_CAMERAS - 1)] = UNSET }; ++module_param_array(video_nr, int, NULL, 0644); ++MODULE_PARM_DESC(video_nr, "videoX start numbers, -1 is autodetect"); ++ ++static int max_video_width = MAX_VIDEO_MODE_WIDTH; ++static int max_video_height = MAX_VIDEO_MODE_HEIGHT; +module_param(max_video_width, int, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); +MODULE_PARM_DESC(max_video_width, "Threshold for video mode"); +module_param(max_video_height, int, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); @@ -101595,11 +102448,12 @@ index 0000000..e83334c + * our function table list (actually switch to an alternate set, but same + * result). + */ -+int gst_v4l2src_is_broken = 0; ++static int gst_v4l2src_is_broken; +module_param(gst_v4l2src_is_broken, int, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); +MODULE_PARM_DESC(gst_v4l2src_is_broken, "If non-zero, enable workaround for Gstreamer"); + -+static struct bm2835_mmal_dev *gdev; /* global device data */ ++/* global device data array */ ++static struct bm2835_mmal_dev *gdev[MAX_BCM2835_CAMERAS]; + +#define FPS_MIN 1 +#define FPS_MAX 90 @@ -101761,7 +102615,7 @@ index 0000000..e83334c + Videobuf queue operations + ------------------------------------------------------------------*/ + -+static int queue_setup(struct vb2_queue *vq, const void *parg, ++static int queue_setup(struct vb2_queue *vq, + unsigned int *nbuffers, unsigned int *nplanes, + unsigned int sizes[], void *alloc_ctxs[]) +{ @@ -101877,6 +102731,7 @@ index 0000000..e83334c + if (dev->capture.frame_count) { + if (dev->capture.vc_start_timestamp != -1 && + pts != 0) { ++ struct timeval timestamp; + s64 runtime_us = pts - + dev->capture.vc_start_timestamp; + u32 div = 0; @@ -101884,16 +102739,15 @@ index 0000000..e83334c + + div = + div_u64_rem(runtime_us, USEC_PER_SEC, &rem); -+ buf->vb.timestamp.tv_sec = -+ dev->capture.kernel_start_ts.tv_sec - 1 + -+ div; -+ buf->vb.timestamp.tv_usec = ++ timestamp.tv_sec = ++ dev->capture.kernel_start_ts.tv_sec + div; ++ timestamp.tv_usec = + dev->capture.kernel_start_ts.tv_usec + rem; + -+ if (buf->vb.timestamp.tv_usec >= ++ if (timestamp.tv_usec >= + USEC_PER_SEC) { -+ buf->vb.timestamp.tv_sec++; -+ buf->vb.timestamp.tv_usec -= ++ timestamp.tv_sec++; ++ timestamp.tv_usec -= + USEC_PER_SEC; + } + v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, @@ -101904,11 +102758,12 @@ index 0000000..e83334c + (int)dev->capture.kernel_start_ts. + tv_usec, + dev->capture.vc_start_timestamp, pts, -+ (int)buf->vb.timestamp.tv_sec, -+ (int)buf->vb.timestamp. -+ tv_usec); ++ (int)timestamp.tv_sec, ++ (int)timestamp.tv_usec); ++ buf->vb.vb2_buf.timestamp = timestamp.tv_sec * 1000000000ULL + ++ timestamp.tv_usec * 1000ULL; + } else { -+ v4l2_get_timestamp(&buf->vb.timestamp); ++ buf->vb.vb2_buf.timestamp = ktime_get_ns(); + } + + vb2_set_plane_payload(&buf->vb.vb2_buf, 0, length); @@ -101939,6 +102794,17 @@ index 0000000..e83334c +{ + int ret; + if (!dev->camera_use_count) { ++ ret = vchiq_mmal_port_parameter_set( ++ dev->instance, ++ &dev->component[MMAL_COMPONENT_CAMERA]->control, ++ MMAL_PARAMETER_CAMERA_NUM, &dev->camera_num, ++ sizeof(dev->camera_num)); ++ if (ret < 0) { ++ v4l2_err(&dev->v4l2_dev, ++ "Failed setting camera num, ret %d\n", ret); ++ return -EINVAL; ++ } ++ + ret = vchiq_mmal_component_enable( + dev->instance, + dev->component[MMAL_COMPONENT_CAMERA]); @@ -102173,6 +103039,30 @@ index 0000000..e83334c + IOCTL operations + ------------------------------------------------------------------*/ + ++static int set_overlay_params(struct bm2835_mmal_dev *dev, ++ struct vchiq_mmal_port *port) ++{ ++ int ret; ++ struct mmal_parameter_displayregion prev_config = { ++ .set = MMAL_DISPLAY_SET_LAYER | MMAL_DISPLAY_SET_ALPHA | ++ MMAL_DISPLAY_SET_DEST_RECT | MMAL_DISPLAY_SET_FULLSCREEN, ++ .layer = PREVIEW_LAYER, ++ .alpha = dev->overlay.global_alpha, ++ .fullscreen = 0, ++ .dest_rect = { ++ .x = dev->overlay.w.left, ++ .y = dev->overlay.w.top, ++ .width = dev->overlay.w.width, ++ .height = dev->overlay.w.height, ++ }, ++ }; ++ ret = vchiq_mmal_port_parameter_set(dev->instance, port, ++ MMAL_PARAMETER_DISPLAYREGION, ++ &prev_config, sizeof(prev_config)); ++ ++ return ret; ++} ++ +/* overlay ioctl */ +static int vidioc_enum_fmt_vid_overlay(struct file *file, void *priv, + struct v4l2_fmtdesc *f) @@ -102204,10 +103094,31 @@ index 0000000..e83334c +static int vidioc_try_fmt_vid_overlay(struct file *file, void *priv, + struct v4l2_format *f) +{ -+ /* Only support one format so get the current one. */ -+ vidioc_g_fmt_vid_overlay(file, priv, f); ++ struct bm2835_mmal_dev *dev = video_drvdata(file); + -+ /* todo: allow the size and/or offset to be changed. */ ++ f->fmt.win.field = V4L2_FIELD_NONE; ++ f->fmt.win.chromakey = 0; ++ f->fmt.win.clips = NULL; ++ f->fmt.win.clipcount = 0; ++ f->fmt.win.bitmap = NULL; ++ ++ v4l_bound_align_image(&f->fmt.win.w.width, MIN_WIDTH, dev->max_width, 1, ++ &f->fmt.win.w.height, MIN_HEIGHT, dev->max_height, ++ 1, 0); ++ v4l_bound_align_image(&f->fmt.win.w.left, MIN_WIDTH, dev->max_width, 1, ++ &f->fmt.win.w.top, MIN_HEIGHT, dev->max_height, ++ 1, 0); ++ ++ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, ++ "Overlay: Now w/h %dx%d l/t %dx%d\n", ++ f->fmt.win.w.width, f->fmt.win.w.height, ++ f->fmt.win.w.left, f->fmt.win.w.top); ++ ++ v4l2_dump_win_format(1, ++ bcm2835_v4l2_debug, ++ &dev->v4l2_dev, ++ &f->fmt.win, ++ __func__); + return 0; +} + @@ -102219,8 +103130,11 @@ index 0000000..e83334c + vidioc_try_fmt_vid_overlay(file, priv, f); + + dev->overlay = f->fmt.win; ++ if (dev->component[MMAL_COMPONENT_PREVIEW]->enabled) { ++ set_overlay_params(dev, ++ &dev->component[MMAL_COMPONENT_PREVIEW]->input[0]); ++ } + -+ /* todo: program the preview port parameters */ + return 0; +} + @@ -102230,20 +103144,6 @@ index 0000000..e83334c + struct bm2835_mmal_dev *dev = video_drvdata(file); + struct vchiq_mmal_port *src; + struct vchiq_mmal_port *dst; -+ struct mmal_parameter_displayregion prev_config = { -+ .set = MMAL_DISPLAY_SET_LAYER | MMAL_DISPLAY_SET_ALPHA | -+ MMAL_DISPLAY_SET_DEST_RECT | MMAL_DISPLAY_SET_FULLSCREEN, -+ .layer = PREVIEW_LAYER, -+ .alpha = 255, -+ .fullscreen = 0, -+ .dest_rect = { -+ .x = dev->overlay.w.left, -+ .y = dev->overlay.w.top, -+ .width = dev->overlay.w.width, -+ .height = dev->overlay.w.height, -+ }, -+ }; -+ + if ((on && dev->component[MMAL_COMPONENT_PREVIEW]->enabled) || + (!on && !dev->component[MMAL_COMPONENT_PREVIEW]->enabled)) + return 0; /* already in requested state */ @@ -102275,9 +103175,7 @@ index 0000000..e83334c + if (ret < 0) + goto error; + -+ ret = vchiq_mmal_port_parameter_set(dev->instance, dst, -+ MMAL_PARAMETER_DISPLAYREGION, -+ &prev_config, sizeof(prev_config)); ++ ret = set_overlay_params(dev, dst); + if (ret < 0) + goto error; + @@ -102308,6 +103206,9 @@ index 0000000..e83334c + struct vchiq_mmal_port *preview_port = + &dev->component[MMAL_COMPONENT_CAMERA]-> + output[MMAL_CAMERA_PORT_PREVIEW]; ++ ++ a->capability = V4L2_FBUF_CAP_EXTERNOVERLAY | ++ V4L2_FBUF_CAP_GLOBAL_ALPHA; + a->flags = V4L2_FBUF_FLAG_OVERLAY; + a->fmt.width = preview_port->es.video.width; + a->fmt.height = preview_port->es.video.height; @@ -102433,8 +103334,9 @@ index 0000000..e83334c + "Clipping/aligning %dx%d format %08X\n", + f->fmt.pix.width, f->fmt.pix.height, f->fmt.pix.pixelformat); + -+ v4l_bound_align_image(&f->fmt.pix.width, MIN_WIDTH, MAX_WIDTH, 1, -+ &f->fmt.pix.height, MIN_HEIGHT, MAX_HEIGHT, 1, 0); ++ v4l_bound_align_image(&f->fmt.pix.width, MIN_WIDTH, dev->max_width, 1, ++ &f->fmt.pix.height, MIN_HEIGHT, dev->max_height, ++ 1, 0); + f->fmt.pix.bytesperline = f->fmt.pix.width * mfmt->ybbp; + + /* Image buffer has to be padded to allow for alignment, even though @@ -102773,9 +103675,10 @@ index 0000000..e83334c +int vidioc_enum_framesizes(struct file *file, void *fh, + struct v4l2_frmsizeenum *fsize) +{ ++ struct bm2835_mmal_dev *dev = video_drvdata(file); + static const struct v4l2_frmsize_stepwise sizes = { -+ MIN_WIDTH, MAX_WIDTH, 2, -+ MIN_HEIGHT, MAX_HEIGHT, 2 ++ MIN_WIDTH, 0, 2, ++ MIN_HEIGHT, 0, 2 + }; + int i; + @@ -102788,6 +103691,8 @@ index 0000000..e83334c + return -EINVAL; + fsize->type = V4L2_FRMSIZE_TYPE_STEPWISE; + fsize->stepwise = sizes; ++ fsize->stepwise.max_width = dev->max_width; ++ fsize->stepwise.max_height = dev->max_height; + return 0; +} + @@ -102795,6 +103700,7 @@ index 0000000..e83334c +static int vidioc_enum_frameintervals(struct file *file, void *priv, + struct v4l2_frmivalenum *fival) +{ ++ struct bm2835_mmal_dev *dev = video_drvdata(file); + int i; + + if (fival->index) @@ -102807,8 +103713,8 @@ index 0000000..e83334c + return -EINVAL; + + /* regarding width & height - we support any within range */ -+ if (fival->width < MIN_WIDTH || fival->width > MAX_WIDTH || -+ fival->height < MIN_HEIGHT || fival->height > MAX_HEIGHT) ++ if (fival->width < MIN_WIDTH || fival->width > dev->max_width || ++ fival->height < MIN_HEIGHT || fival->height > dev->max_height) + return -EINVAL; + + fival->type = V4L2_FRMIVAL_TYPE_CONTINUOUS; @@ -102971,13 +103877,55 @@ index 0000000..e83334c + .release = video_device_release_empty, +}; + ++/* Returns the number of cameras, and also the max resolution supported ++ * by those cameras. ++ */ ++static int get_num_cameras(struct vchiq_mmal_instance *instance, ++ unsigned int resolutions[][2], int num_resolutions) ++{ ++ int ret; ++ struct vchiq_mmal_component *cam_info_component; ++ struct mmal_parameter_camera_info_t cam_info = {0}; ++ int param_size = sizeof(cam_info); ++ int i; ++ ++ /* create a camera_info component */ ++ ret = vchiq_mmal_component_init(instance, "camera_info", ++ &cam_info_component); ++ if (ret < 0) ++ /* Unusual failure - let's guess one camera. */ ++ return 1; ++ ++ if (vchiq_mmal_port_parameter_get(instance, ++ &cam_info_component->control, ++ MMAL_PARAMETER_CAMERA_INFO, ++ &cam_info, ++ &param_size)) { ++ pr_info("Failed to get camera info\n"); ++ } ++ for (i = 0; ++ i < (cam_info.num_cameras > num_resolutions ? ++ num_resolutions : ++ cam_info.num_cameras); ++ i++) { ++ resolutions[i][0] = cam_info.cameras[i].max_width; ++ resolutions[i][1] = cam_info.cameras[i].max_height; ++ } ++ ++ vchiq_mmal_component_finalise(instance, ++ cam_info_component); ++ ++ return cam_info.num_cameras; ++} ++ +static int set_camera_parameters(struct vchiq_mmal_instance *instance, -+ struct vchiq_mmal_component *camera) ++ struct vchiq_mmal_component *camera, ++ struct bm2835_mmal_dev *dev) +{ + int ret; + struct mmal_parameter_camera_config cam_config = { -+ .max_stills_w = MAX_WIDTH, -+ .max_stills_h = MAX_HEIGHT, ++ .max_stills_w = dev->max_width, ++ .max_stills_h = dev->max_height, + .stills_yuv422 = 1, + .one_shot_stills = 1, + .max_preview_video_w = (max_video_width > 1920) ? @@ -103020,7 +103968,8 @@ index 0000000..e83334c + } + + ret = set_camera_parameters(dev->instance, -+ dev->component[MMAL_COMPONENT_CAMERA]); ++ dev->component[MMAL_COMPONENT_CAMERA], ++ dev); + if (ret < 0) + goto unreg_camera; + @@ -103211,7 +104160,9 @@ index 0000000..e83334c + /* video device needs to be able to access instance data */ + video_set_drvdata(vfd, dev); + -+ ret = video_register_device(vfd, VFL_TYPE_GRABBER, -1); ++ ret = video_register_device(vfd, ++ VFL_TYPE_GRABBER, ++ video_nr[dev->camera_num]); + if (ret < 0) + return ret; + @@ -103222,10 +104173,52 @@ index 0000000..e83334c + return 0; +} + ++void bcm2835_cleanup_instance(struct bm2835_mmal_dev *dev) ++{ ++ if (!dev) ++ return; ++ ++ v4l2_info(&dev->v4l2_dev, "unregistering %s\n", ++ video_device_node_name(&dev->vdev)); ++ ++ video_unregister_device(&dev->vdev); ++ ++ if (dev->capture.encode_component) { ++ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, ++ "mmal_exit - disconnect tunnel\n"); ++ vchiq_mmal_port_connect_tunnel(dev->instance, ++ dev->capture.camera_port, NULL); ++ vchiq_mmal_component_disable(dev->instance, ++ dev->capture.encode_component); ++ } ++ vchiq_mmal_component_disable(dev->instance, ++ dev->component[MMAL_COMPONENT_CAMERA]); ++ ++ vchiq_mmal_component_finalise(dev->instance, ++ dev-> ++ component[MMAL_COMPONENT_VIDEO_ENCODE]); ++ ++ vchiq_mmal_component_finalise(dev->instance, ++ dev-> ++ component[MMAL_COMPONENT_IMAGE_ENCODE]); ++ ++ vchiq_mmal_component_finalise(dev->instance, ++ dev->component[MMAL_COMPONENT_PREVIEW]); ++ ++ vchiq_mmal_component_finalise(dev->instance, ++ dev->component[MMAL_COMPONENT_CAMERA]); ++ ++ v4l2_ctrl_handler_free(&dev->ctrl_handler); ++ ++ v4l2_device_unregister(&dev->v4l2_dev); ++ ++ kfree(dev); ++} ++ +static struct v4l2_format default_v4l2_format = { + .fmt.pix.pixelformat = V4L2_PIX_FMT_JPEG, + .fmt.pix.width = 1024, -+ .fmt.pix.bytesperline = 1024, ++ .fmt.pix.bytesperline = 0, + .fmt.pix.height = 768, + .fmt.pix.sizeimage = 1024*768, +}; @@ -103235,76 +104228,98 @@ index 0000000..e83334c + int ret; + struct bm2835_mmal_dev *dev; + struct vb2_queue *q; ++ int camera; ++ unsigned int num_cameras; ++ struct vchiq_mmal_instance *instance; ++ unsigned int resolutions[MAX_BCM2835_CAMERAS][2]; + -+ dev = kzalloc(sizeof(*gdev), GFP_KERNEL); -+ if (!dev) -+ return -ENOMEM; ++ ret = vchiq_mmal_init(&instance); ++ if (ret < 0) ++ return ret; + -+ /* setup device defaults */ -+ dev->overlay.w.left = 150; -+ dev->overlay.w.top = 50; -+ dev->overlay.w.width = 1024; -+ dev->overlay.w.height = 768; -+ dev->overlay.clipcount = 0; -+ dev->overlay.field = V4L2_FIELD_NONE; ++ num_cameras = get_num_cameras(instance, ++ resolutions, ++ MAX_BCM2835_CAMERAS); ++ if (num_cameras > MAX_BCM2835_CAMERAS) ++ num_cameras = MAX_BCM2835_CAMERAS; + -+ dev->capture.fmt = &formats[3]; /* JPEG */ ++ for (camera = 0; camera < num_cameras; camera++) { ++ dev = kzalloc(sizeof(struct bm2835_mmal_dev), GFP_KERNEL); ++ if (!dev) ++ return -ENOMEM; + -+ /* v4l device registration */ -+ snprintf(dev->v4l2_dev.name, sizeof(dev->v4l2_dev.name), -+ "%s", BM2835_MMAL_MODULE_NAME); -+ ret = v4l2_device_register(NULL, &dev->v4l2_dev); -+ if (ret) -+ goto free_dev; ++ dev->camera_num = camera; ++ dev->max_width = resolutions[camera][0]; ++ dev->max_height = resolutions[camera][1]; ++ ++ /* setup device defaults */ ++ dev->overlay.w.left = 150; ++ dev->overlay.w.top = 50; ++ dev->overlay.w.width = 1024; ++ dev->overlay.w.height = 768; ++ dev->overlay.clipcount = 0; ++ dev->overlay.field = V4L2_FIELD_NONE; ++ dev->overlay.global_alpha = 255; ++ ++ dev->capture.fmt = &formats[3]; /* JPEG */ ++ ++ /* v4l device registration */ ++ snprintf(dev->v4l2_dev.name, sizeof(dev->v4l2_dev.name), ++ "%s", BM2835_MMAL_MODULE_NAME); ++ ret = v4l2_device_register(NULL, &dev->v4l2_dev); ++ if (ret) ++ goto free_dev; + -+ /* setup v4l controls */ -+ ret = bm2835_mmal_init_controls(dev, &dev->ctrl_handler); -+ if (ret < 0) -+ goto unreg_dev; -+ dev->v4l2_dev.ctrl_handler = &dev->ctrl_handler; ++ /* setup v4l controls */ ++ ret = bm2835_mmal_init_controls(dev, &dev->ctrl_handler); ++ if (ret < 0) ++ goto unreg_dev; ++ dev->v4l2_dev.ctrl_handler = &dev->ctrl_handler; + -+ /* mmal init */ -+ ret = mmal_init(dev); -+ if (ret < 0) -+ goto unreg_dev; -+ -+ /* initialize queue */ -+ q = &dev->capture.vb_vidq; -+ memset(q, 0, sizeof(*q)); -+ q->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; -+ q->io_modes = VB2_MMAP | VB2_USERPTR | VB2_READ; -+ q->drv_priv = dev; -+ q->buf_struct_size = sizeof(struct mmal_buffer); -+ q->ops = &bm2835_mmal_video_qops; -+ q->mem_ops = &vb2_vmalloc_memops; -+ q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; -+ ret = vb2_queue_init(q); -+ if (ret < 0) -+ goto unreg_dev; ++ /* mmal init */ ++ dev->instance = instance; ++ ret = mmal_init(dev); ++ if (ret < 0) ++ goto unreg_dev; ++ ++ /* initialize queue */ ++ q = &dev->capture.vb_vidq; ++ memset(q, 0, sizeof(*q)); ++ q->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; ++ q->io_modes = VB2_MMAP | VB2_USERPTR | VB2_READ; ++ q->drv_priv = dev; ++ q->buf_struct_size = sizeof(struct mmal_buffer); ++ q->ops = &bm2835_mmal_video_qops; ++ q->mem_ops = &vb2_vmalloc_memops; ++ q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; ++ ret = vb2_queue_init(q); ++ if (ret < 0) ++ goto unreg_dev; + -+ /* v4l2 core mutex used to protect all fops and v4l2 ioctls. */ -+ mutex_init(&dev->mutex); ++ /* v4l2 core mutex used to protect all fops and v4l2 ioctls. */ ++ mutex_init(&dev->mutex); + -+ /* initialise video devices */ -+ ret = bm2835_mmal_init_device(dev, &dev->vdev); -+ if (ret < 0) -+ goto unreg_dev; ++ /* initialise video devices */ ++ ret = bm2835_mmal_init_device(dev, &dev->vdev); ++ if (ret < 0) ++ goto unreg_dev; + -+ /* Really want to call vidioc_s_fmt_vid_cap with the default -+ * format, but currently the APIs don't join up. -+ */ -+ ret = mmal_setup_components(dev, &default_v4l2_format); -+ if (ret < 0) { -+ v4l2_err(&dev->v4l2_dev, -+ "%s: could not setup components\n", __func__); -+ goto unreg_dev; -+ } ++ /* Really want to call vidioc_s_fmt_vid_cap with the default ++ * format, but currently the APIs don't join up. ++ */ ++ ret = mmal_setup_components(dev, &default_v4l2_format); ++ if (ret < 0) { ++ v4l2_err(&dev->v4l2_dev, ++ "%s: could not setup components\n", __func__); ++ goto unreg_dev; ++ } + -+ v4l2_info(&dev->v4l2_dev, -+ "Broadcom 2835 MMAL video capture ver %s loaded.\n", -+ BM2835_MMAL_VERSION); ++ v4l2_info(&dev->v4l2_dev, ++ "Broadcom 2835 MMAL video capture ver %s loaded.\n", ++ BM2835_MMAL_VERSION); + -+ gdev = dev; ++ gdev[camera] = dev; ++ } + return 0; + +unreg_dev: @@ -103314,8 +104329,11 @@ index 0000000..e83334c +free_dev: + kfree(dev); + -+ v4l2_err(&dev->v4l2_dev, -+ "%s: error %d while loading driver\n", ++ for ( ; camera > 0; camera--) { ++ bcm2835_cleanup_instance(gdev[camera]); ++ gdev[camera] = NULL; ++ } ++ pr_info("%s: error %d while loading driver\n", + BM2835_MMAL_MODULE_NAME, ret); + + return ret; @@ -103323,56 +104341,24 @@ index 0000000..e83334c + +static void __exit bm2835_mmal_exit(void) +{ -+ if (!gdev) -+ return; ++ int camera; ++ struct vchiq_mmal_instance *instance = gdev[0]->instance; + -+ v4l2_info(&gdev->v4l2_dev, "unregistering %s\n", -+ video_device_node_name(&gdev->vdev)); -+ -+ video_unregister_device(&gdev->vdev); -+ -+ if (gdev->capture.encode_component) { -+ v4l2_dbg(1, bcm2835_v4l2_debug, &gdev->v4l2_dev, -+ "mmal_exit - disconnect tunnel\n"); -+ vchiq_mmal_port_connect_tunnel(gdev->instance, -+ gdev->capture.camera_port, NULL); -+ vchiq_mmal_component_disable(gdev->instance, -+ gdev->capture.encode_component); ++ for (camera = 0; camera < MAX_BCM2835_CAMERAS; camera++) { ++ bcm2835_cleanup_instance(gdev[camera]); ++ gdev[camera] = NULL; + } -+ vchiq_mmal_component_disable(gdev->instance, -+ gdev->component[MMAL_COMPONENT_CAMERA]); -+ -+ vchiq_mmal_component_finalise(gdev->instance, -+ gdev-> -+ component[MMAL_COMPONENT_VIDEO_ENCODE]); -+ -+ vchiq_mmal_component_finalise(gdev->instance, -+ gdev-> -+ component[MMAL_COMPONENT_IMAGE_ENCODE]); -+ -+ vchiq_mmal_component_finalise(gdev->instance, -+ gdev->component[MMAL_COMPONENT_PREVIEW]); -+ -+ vchiq_mmal_component_finalise(gdev->instance, -+ gdev->component[MMAL_COMPONENT_CAMERA]); -+ -+ vchiq_mmal_finalise(gdev->instance); -+ -+ v4l2_ctrl_handler_free(&gdev->ctrl_handler); -+ -+ v4l2_device_unregister(&gdev->v4l2_dev); -+ -+ kfree(gdev); ++ vchiq_mmal_finalise(instance); +} + +module_init(bm2835_mmal_init); +module_exit(bm2835_mmal_exit); diff --git a/drivers/media/platform/bcm2835/bcm2835-camera.h b/drivers/media/platform/bcm2835/bcm2835-camera.h new file mode 100644 -index 0000000..7fe9f65 +index 0000000..13f426f --- /dev/null +++ b/drivers/media/platform/bcm2835/bcm2835-camera.h -@@ -0,0 +1,126 @@ +@@ -0,0 +1,144 @@ +/* + * Broadcom BM2835 V4L2 driver + * @@ -103390,7 +104376,7 @@ index 0000000..7fe9f65 + * core driver device + */ + -+#define V4L2_CTRL_COUNT 28 /* number of v4l controls */ ++#define V4L2_CTRL_COUNT 29 /* number of v4l controls */ + +enum { + MMAL_COMPONENT_CAMERA = 0, @@ -103433,6 +104419,8 @@ index 0000000..7fe9f65 + enum mmal_parameter_exposuremeteringmode metering_mode; + unsigned int manual_shutter_speed; + bool exp_auto_priority; ++ bool manual_iso_enabled; ++ uint32_t iso; + + /* allocated mmal instance and components */ + struct vchiq_mmal_instance *instance; @@ -103479,6 +104467,9 @@ index 0000000..7fe9f65 + + } capture; + ++ unsigned int camera_num; ++ unsigned int max_width; ++ unsigned int max_height; +}; + +int bm2835_mmal_init_controls( @@ -103499,12 +104490,25 @@ index 0000000..7fe9f65 + (pix_fmt)->pixelformat, (pix_fmt)->bytesperline, \ + (pix_fmt)->sizeimage, (pix_fmt)->colorspace, (pix_fmt)->priv); \ +} ++#define v4l2_dump_win_format(level, debug, dev, win_fmt, desc) \ ++{ \ ++ v4l2_dbg(level, debug, dev, \ ++"%s: w %u h %u l %u t %u field %u chromakey %06X clip %p " \ ++"clipcount %u bitmap %p\n", \ ++ desc == NULL ? "" : desc, \ ++ (win_fmt)->w.width, (win_fmt)->w.height, \ ++ (win_fmt)->w.left, (win_fmt)->w.top, \ ++ (win_fmt)->field, \ ++ (win_fmt)->chromakey, \ ++ (win_fmt)->clips, (win_fmt)->clipcount, \ ++ (win_fmt)->bitmap); \ ++} diff --git a/drivers/media/platform/bcm2835/controls.c b/drivers/media/platform/bcm2835/controls.c new file mode 100644 -index 0000000..f9f903f +index 0000000..fe61330 --- /dev/null +++ b/drivers/media/platform/bcm2835/controls.c -@@ -0,0 +1,1324 @@ +@@ -0,0 +1,1345 @@ +/* + * Broadcom BM2835 V4L2 driver + * @@ -103556,10 +104560,13 @@ index 0000000..f9f903f + 4000 +}; + -+/* Supported ISO values ++/* Supported ISO values (*1000) + * ISOO = auto ISO + */ +static const s64 iso_qmenu[] = { ++ 0, 100000, 200000, 400000, 800000, ++}; ++static const uint32_t iso_values[] = { + 0, 100, 200, 400, 800, +}; + @@ -103708,7 +104715,7 @@ index 0000000..f9f903f + &u32_value, sizeof(u32_value)); +} + -+static int ctrl_set_value_menu(struct bm2835_mmal_dev *dev, ++static int ctrl_set_iso(struct bm2835_mmal_dev *dev, + struct v4l2_ctrl *ctrl, + const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl) +{ @@ -103718,12 +104725,23 @@ index 0000000..f9f903f + if (ctrl->val > mmal_ctrl->max || ctrl->val < mmal_ctrl->min) + return 1; + ++ if (ctrl->id == V4L2_CID_ISO_SENSITIVITY) ++ dev->iso = iso_values[ctrl->val]; ++ else if (ctrl->id == V4L2_CID_ISO_SENSITIVITY_AUTO) ++ dev->manual_iso_enabled = ++ (ctrl->val == V4L2_ISO_SENSITIVITY_MANUAL ? ++ true : ++ false); ++ + control = &dev->component[MMAL_COMPONENT_CAMERA]->control; + -+ u32_value = mmal_ctrl->imenu[ctrl->val]; ++ if (dev->manual_iso_enabled) ++ u32_value = dev->iso; ++ else ++ u32_value = 0; + + return vchiq_mmal_port_parameter_set(dev->instance, control, -+ mmal_ctrl->mmal_id, ++ MMAL_PARAMETER_ISO, + &u32_value, sizeof(u32_value)); +} + @@ -104463,7 +105481,14 @@ index 0000000..f9f903f + V4L2_CID_ISO_SENSITIVITY, MMAL_CONTROL_TYPE_INT_MENU, + 0, ARRAY_SIZE(iso_qmenu) - 1, 0, 1, iso_qmenu, + MMAL_PARAMETER_ISO, -+ &ctrl_set_value_menu, ++ &ctrl_set_iso, ++ false ++ }, ++ { ++ V4L2_CID_ISO_SENSITIVITY_AUTO, MMAL_CONTROL_TYPE_STD_MENU, ++ 0, 1, V4L2_ISO_SENSITIVITY_AUTO, 1, NULL, ++ MMAL_PARAMETER_ISO, ++ &ctrl_set_iso, + false + }, + { @@ -104831,7 +105856,7 @@ index 0000000..f9f903f +} diff --git a/drivers/media/platform/bcm2835/mmal-common.h b/drivers/media/platform/bcm2835/mmal-common.h new file mode 100644 -index 0000000..840fd139 +index 0000000..840fd13 --- /dev/null +++ b/drivers/media/platform/bcm2835/mmal-common.h @@ -0,0 +1,53 @@ @@ -105689,10 +106714,10 @@ index 0000000..67b1076 +}; diff --git a/drivers/media/platform/bcm2835/mmal-parameters.h b/drivers/media/platform/bcm2835/mmal-parameters.h new file mode 100644 -index 0000000..aa0fd18 +index 0000000..f6abb5c --- /dev/null +++ b/drivers/media/platform/bcm2835/mmal-parameters.h -@@ -0,0 +1,656 @@ +@@ -0,0 +1,689 @@ +/* + * Broadcom BM2835 V4L2 driver + * @@ -106349,6 +107374,39 @@ index 0000000..aa0fd18 + u32 num_effect_params; + u32 effect_parameter[MMAL_MAX_IMAGEFX_PARAMETERS]; +}; ++ ++#define MMAL_PARAMETER_CAMERA_INFO_MAX_CAMERAS 4 ++#define MMAL_PARAMETER_CAMERA_INFO_MAX_FLASHES 2 ++#define MMAL_PARAMETER_CAMERA_INFO_MAX_STR_LEN 16 ++ ++struct mmal_parameter_camera_info_camera_t { ++ u32 port_id; ++ u32 max_width; ++ u32 max_height; ++ u32 lens_present; ++ u8 camera_name[MMAL_PARAMETER_CAMERA_INFO_MAX_STR_LEN]; ++}; ++ ++enum mmal_parameter_camera_info_flash_type_t { ++ /* Make values explicit to ensure they match values in config ini */ ++ MMAL_PARAMETER_CAMERA_INFO_FLASH_TYPE_XENON = 0, ++ MMAL_PARAMETER_CAMERA_INFO_FLASH_TYPE_LED = 1, ++ MMAL_PARAMETER_CAMERA_INFO_FLASH_TYPE_OTHER = 2, ++ MMAL_PARAMETER_CAMERA_INFO_FLASH_TYPE_MAX = 0x7FFFFFFF ++}; ++ ++struct mmal_parameter_camera_info_flash_t { ++ enum mmal_parameter_camera_info_flash_type_t flash_type; ++}; ++ ++struct mmal_parameter_camera_info_t { ++ u32 num_cameras; ++ u32 num_flashes; ++ struct mmal_parameter_camera_info_camera_t ++ cameras[MMAL_PARAMETER_CAMERA_INFO_MAX_CAMERAS]; ++ struct mmal_parameter_camera_info_flash_t ++ flashes[MMAL_PARAMETER_CAMERA_INFO_MAX_FLASHES]; ++}; diff --git a/drivers/media/platform/bcm2835/mmal-vchiq.c b/drivers/media/platform/bcm2835/mmal-vchiq.c new file mode 100644 index 0000000..78132254 @@ -108456,10 +109514,10 @@ index 0000000..9d1d11e + +#endif /* MMAL_VCHIQ_H */ -From 03435989bbadbd333a810644c8246dd7eb0bad07 Mon Sep 17 00:00:00 2001 +From f91fde0e119041b5a8c762748fc51c2637eb38a4 Mon Sep 17 00:00:00 2001 From: Phil Elwell <phil@raspberrypi.org> Date: Mon, 11 May 2015 09:00:42 +0100 -Subject: [PATCH 050/170] scripts: Add mkknlimg and knlinfo scripts from tools +Subject: [PATCH 054/112] scripts: Add mkknlimg and knlinfo scripts from tools repo The Raspberry Pi firmware looks for a trailer on the kernel image to @@ -108492,19 +109550,44 @@ Also, since the canned configuration is no longer built in (it's a module), remove the config string checking. See: https://github.com/raspberrypi/linux/issues/1157 + +scripts: Multi-platform support for mkknlimg and knlinfo + +The firmware uses tags in the kernel trailer to choose which dtb file +to load. Current firmware loads bcm2835-*.dtb if the '283x' tag is true, +otherwise it loads bcm270*.dtb. This scheme breaks if an image supports +multiple platforms. + +This patch adds '270X' and '283X' tags to indicate support for RPi and +upstream platforms, respectively. '283x' (note lower case 'x') is left +for old firmware, and is only set if the image only supports upstream +builds. + +scripts/mkknlimg: Append a trailer for all input + +Now that the firmware assumes an unsigned kernel is DT-capable, it is +helpful to be able to mark a kernel as being non-DT-capable. + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> + +scripts/knlinfo: Decode DDTK atom + +Show the DDTK atom as being a boolean. + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> --- - scripts/knlinfo | 168 ++++++++++++++++++++++++++++++++++++++ - scripts/mkknlimg | 244 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ - 2 files changed, 412 insertions(+) + scripts/knlinfo | 171 ++++++++++++++++++++++++++++++++++++ + scripts/mkknlimg | 263 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 434 insertions(+) create mode 100755 scripts/knlinfo create mode 100755 scripts/mkknlimg diff --git a/scripts/knlinfo b/scripts/knlinfo new file mode 100755 -index 0000000..a0e8663 +index 0000000..263ec93 --- /dev/null +++ b/scripts/knlinfo -@@ -0,0 +1,168 @@ +@@ -0,0 +1,171 @@ +#!/usr/bin/env perl +# ---------------------------------------------------------------------- +# knlinfo by Phil Elwell for Raspberry Pi @@ -108523,8 +109606,11 @@ index 0000000..a0e8663 + +my %atom_formats = +( ++ 'DDTK' => \&format_bool, + 'DTOK' => \&format_bool, + 'KVer' => \&format_string, ++ '270X' => \&format_bool, ++ '283X' => \&format_bool, + '283x' => \&format_bool, +); + @@ -108653,7 +109739,7 @@ index 0000000..a0e8663 +sub format_bool +{ + my ($data) = @_; -+ return unpack('V', $data) ? 'true' : 'false'; ++ return unpack('V', $data) ? 'y' : 'n'; +} + +sub format_int @@ -108675,10 +109761,10 @@ index 0000000..a0e8663 +} diff --git a/scripts/mkknlimg b/scripts/mkknlimg new file mode 100755 -index 0000000..3998d43 +index 0000000..78c5845 --- /dev/null +++ b/scripts/mkknlimg -@@ -0,0 +1,244 @@ +@@ -0,0 +1,263 @@ +#!/usr/bin/env perl +# ---------------------------------------------------------------------- +# mkknlimg by Phil Elwell for Raspberry Pi @@ -108694,12 +109780,20 @@ index 0000000..3998d43 +use warnings; +use integer; + ++use constant FLAG_PI => 0x01; ++use constant FLAG_DTOK => 0x02; ++use constant FLAG_DDTK => 0x04; ++use constant FLAG_270X => 0x08; ++use constant FLAG_283X => 0x10; ++ +my $trailer_magic = 'RPTL'; + +my $tmpfile1 = "/tmp/mkknlimg_$$.1"; +my $tmpfile2 = "/tmp/mkknlimg_$$.2"; + +my $dtok = 0; ++my $ddtk = 0; ++my $is_270x = 0; +my $is_283x = 0; + +while (@ARGV && ($ARGV[0] =~ /^-/)) @@ -108709,6 +109803,14 @@ index 0000000..3998d43 + { + $dtok = 1; + } ++ elsif ($arg eq '--ddtk') ++ { ++ $ddtk = 1; ++ } ++ elsif ($arg eq '--270x') ++ { ++ $is_270x = 1; ++ } + elsif ($arg eq '--283x') + { + $is_283x = 1; @@ -108731,70 +109833,68 @@ index 0000000..3998d43 + usage(); +} + -+my @wanted_strings = -+( -+ 'bcm2708_fb', -+ 'brcm,bcm2835-mmc', -+ 'brcm,bcm2835-sdhost', -+ 'brcm,bcm2708-pinctrl', -+ 'brcm,bcm2835-gpio', -+ 'brcm,bcm2835', -+ 'brcm,bcm2836' -+); ++my $wanted_strings = ++{ ++ 'bcm2708_fb' => FLAG_PI, ++ 'brcm,bcm2835-mmc' => FLAG_PI, ++ 'brcm,bcm2835-sdhost' => FLAG_PI, ++ 'brcm,bcm2708-pinctrl' => FLAG_PI | FLAG_DTOK, ++ 'brcm,bcm2835-gpio' => FLAG_PI | FLAG_DTOK, ++ 'brcm,bcm2708' => FLAG_PI | FLAG_DTOK | FLAG_270X, ++ 'brcm,bcm2709' => FLAG_PI | FLAG_DTOK | FLAG_270X, ++ 'brcm,bcm2835' => FLAG_PI | FLAG_DTOK | FLAG_283X, ++ 'brcm,bcm2836' => FLAG_PI | FLAG_DTOK | FLAG_283X, ++ 'of_overlay_apply' => FLAG_DTOK | FLAG_DDTK, ++}; + +my $res = try_extract($kernel_file, $tmpfile1); -+$res = try_decompress('\037\213\010', 'xy', 'gunzip', 0, -+ $kernel_file, $tmpfile1, $tmpfile2) if (!$res); -+$res = try_decompress('\3757zXZ\000', 'abcde', 'unxz --single-stream', -1, -+ $kernel_file, $tmpfile1, $tmpfile2) if (!$res); -+$res = try_decompress('BZh', 'xy', 'bunzip2', 0, -+ $kernel_file, $tmpfile1, $tmpfile2) if (!$res); -+$res = try_decompress('\135\0\0\0', 'xxx', 'unlzma', 0, -+ $kernel_file, $tmpfile1, $tmpfile2) if (!$res); -+$res = try_decompress('\211\114\132', 'xy', 'lzop -d', 0, -+ $kernel_file, $tmpfile1, $tmpfile2) if (!$res); -+$res = try_decompress('\002\041\114\030', 'xy', 'lz4 -d', 1, -+ $kernel_file, $tmpfile1, $tmpfile2) if (!$res); ++$res ||= try_decompress('\037\213\010', 'xy', 'gunzip', 0, ++ $kernel_file, $tmpfile1, $tmpfile2); ++$res ||= try_decompress('\3757zXZ\000', 'abcde', 'unxz --single-stream', -1, ++ $kernel_file, $tmpfile1, $tmpfile2); ++$res ||= try_decompress('BZh', 'xy', 'bunzip2', 0, ++ $kernel_file, $tmpfile1, $tmpfile2); ++$res ||= try_decompress('\135\0\0\0', 'xxx', 'unlzma', 0, ++ $kernel_file, $tmpfile1, $tmpfile2); ++$res ||= try_decompress('\211\114\132', 'xy', 'lzop -d', 0, ++ $kernel_file, $tmpfile1, $tmpfile2); ++$res ||= try_decompress('\002\041\114\030', 'xy', 'lz4 -d', 1, ++ $kernel_file, $tmpfile1, $tmpfile2); + +my $append_trailer; +my $trailer; +my $kver = '?'; + -+$append_trailer = $dtok; ++$append_trailer = 1; + +if ($res) +{ -+ $kver = $res->{''} || '?'; ++ $kver = $res->{'kver'} || '?'; ++ my $flags = $res->{'flags'}; + print("Version: $kver\n"); + -+ $append_trailer = $dtok; -+ if (!$dtok) ++ if ($flags & FLAG_PI) + { -+ if (config_bool($res, 'bcm2708_fb') || -+ config_bool($res, 'brcm,bcm2835-mmc') || -+ config_bool($res, 'brcm,bcm2835-sdhost')) -+ { -+ $dtok ||= config_bool($res, 'brcm,bcm2708-pinctrl'); -+ $dtok ||= config_bool($res, 'brcm,bcm2835-gpio'); -+ $is_283x ||= config_bool($res, 'brcm,bcm2835'); -+ $is_283x ||= config_bool($res, 'brcm,bcm2836'); -+ $dtok ||= $is_283x; -+ $append_trailer = 1; -+ } -+ else -+ { -+ print ("* This doesn't look like a Raspberry Pi kernel. In pass-through mode.\n"); -+ } ++ $dtok ||= ($flags & FLAG_DTOK) != 0; ++ $is_270x ||= ($flags & FLAG_270X) != 0; ++ $is_283x ||= ($flags & FLAG_283X) != 0; ++ $ddtk ||= ($flags & FLAG_DDTK) != 0; ++ } ++ else ++ { ++ print ("* This doesn't look like a Raspberry Pi kernel.\n"); + } +} +elsif (!$dtok) +{ -+ print ("* Is this a valid kernel? In pass-through mode.\n"); ++ print ("* Is this a valid kernel?\n"); +} + +if ($append_trailer) +{ + printf("DT: %s\n", $dtok ? "y" : "n"); ++ printf("DDT: %s\n", $ddtk ? "y" : "n"); ++ printf("270x: %s\n", $is_270x ? "y" : "n"); + printf("283x: %s\n", $is_283x ? "y" : "n"); + + my @atoms; @@ -108802,7 +109902,10 @@ index 0000000..3998d43 + push @atoms, [ $trailer_magic, pack('V', 0) ]; + push @atoms, [ 'KVer', $kver ]; + push @atoms, [ 'DTOK', pack('V', $dtok) ]; -+ push @atoms, [ '283x', pack('V', $is_283x) ]; ++ push @atoms, [ 'DDTK', pack('V', $ddtk) ]; ++ push @atoms, [ '270X', pack('V', $is_270x) ]; ++ push @atoms, [ '283X', pack('V', $is_283x) ]; ++ push @atoms, [ '283x', pack('V', $is_283x && !$is_270x) ]; + + $trailer = pack_trailer(\@atoms); + $atoms[0]->[1] = pack('V', length($trailer)); @@ -108856,7 +109959,7 @@ index 0000000..3998d43 + +sub usage +{ -+ print ("Usage: mkknlimg [--dtok] [--283x] <vmlinux|zImage|bzImage> <outfile>\n"); ++ print ("Usage: mkknlimg [--dtok] [--270x] [--283x] <vmlinux|zImage|bzImage> <outfile>\n"); + exit(1); +} + @@ -108870,15 +109973,8 @@ index 0000000..3998d43 + + chomp($ver); + -+ my $res = { ''=>$ver }; -+ my $string_pattern = '^('.join('|', @wanted_strings).')$'; -+ -+ my @matches = `strings \"$knl\" | grep -E \"$string_pattern\"`; -+ foreach my $match (@matches) -+ { -+ chomp($match); -+ $res->{$match} = 1; -+ } ++ my $res = { 'kver'=>$ver }; ++ $res->{'flags'} = strings_to_flags($knl, $wanted_strings); + + return $res; +} @@ -108905,6 +110001,22 @@ index 0000000..3998d43 + return undef; +} + ++sub strings_to_flags ++{ ++ my ($knl, $strings) = @_; ++ my $string_pattern = '^('.join('|', keys(%$strings)).')$'; ++ my $flags = 0; ++ ++ my @matches = `strings \"$knl\" | grep -E \"$string_pattern\"`; ++ foreach my $match (@matches) ++ { ++ chomp($match); ++ $flags |= $strings->{$match}; ++ } ++ ++ return $flags; ++} ++ +sub pack_trailer +{ + my ($atoms) = @_; @@ -108916,1161 +110028,3240 @@ index 0000000..3998d43 + } + return $trailer; +} -+ -+sub config_bool -+{ -+ my ($configs, $wanted) = @_; -+ my $val = $configs->{$wanted} || 'n'; -+ return (($val eq 'y') || ($val eq '1')); -+} -From a251bf4a37d8fd468bc3ff853bcebe8ee452a31e Mon Sep 17 00:00:00 2001 +From bcf6cc7b91fb794994940d91f41159cd16d1cb18 Mon Sep 17 00:00:00 2001 From: Phil Elwell <phil@raspberrypi.org> -Date: Fri, 5 Dec 2014 17:26:26 +0000 -Subject: [PATCH 051/170] fdt: Add support for the CONFIG_CMDLINE_EXTEND option - ---- - drivers/of/fdt.c | 29 ++++++++++++++++++++++++----- - 1 file changed, 24 insertions(+), 5 deletions(-) - -diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c -index 655f79d..fdc4501 100644 ---- a/drivers/of/fdt.c -+++ b/drivers/of/fdt.c -@@ -954,19 +954,38 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname, - - /* Retrieve command line */ - p = of_get_flat_dt_prop(node, "bootargs", &l); -- if (p != NULL && l > 0) -- strlcpy(data, p, min((int)l, COMMAND_LINE_SIZE)); - - /* - * CONFIG_CMDLINE is meant to be a default in case nothing else - * managed to set the command line, unless CONFIG_CMDLINE_FORCE - * is set in which case we override whatever was found earlier. -+ * -+ * However, it can be useful to be able to treat the default as -+ * a starting point to be extended using CONFIG_CMDLINE_EXTEND. - */ -+ ((char *)data)[0] = '\0'; -+ - #ifdef CONFIG_CMDLINE --#ifndef CONFIG_CMDLINE_FORCE -- if (!((char *)data)[0]) -+ strlcpy(data, CONFIG_CMDLINE, COMMAND_LINE_SIZE); -+ -+ if (p != NULL && l > 0) { -+#if defined(CONFIG_CMDLINE_EXTEND) -+ int len = strlen(data); -+ if (len > 0) { -+ strlcat(data, " ", COMMAND_LINE_SIZE); -+ len++; -+ } -+ strlcpy((char *)data + len, p, min((int)l, COMMAND_LINE_SIZE - len)); -+#elif defined(CONFIG_CMDLINE_FORCE) -+ pr_warning("Ignoring bootargs property (using the default kernel command line)\n"); -+#else -+ /* Neither extend nor force - just override */ -+ strlcpy(data, p, min((int)l, COMMAND_LINE_SIZE)); - #endif -- strlcpy(data, CONFIG_CMDLINE, COMMAND_LINE_SIZE); -+ } -+#else /* CONFIG_CMDLINE */ -+ if (p != NULL && l > 0) -+ strlcpy(data, p, min((int)l, COMMAND_LINE_SIZE)); - #endif /* CONFIG_CMDLINE */ - - pr_debug("Command line is: %s\n", (char*)data); - -From 0112c4ce9db6cdc53af67dc7634966c3594de7ff Mon Sep 17 00:00:00 2001 -From: notro <notro@tronnes.org> -Date: Wed, 9 Jul 2014 14:46:08 +0200 -Subject: [PATCH 052/170] BCM2708: Add core Device Tree support - -Add the bare minimum needed to boot BCM2708 from a Device Tree. - -Signed-off-by: Noralf Tronnes <notro@tronnes.org> - -BCM2708: DT: change 'axi' nodename to 'soc' - -Change DT node named 'axi' to 'soc' so it matches ARCH_BCM2835. -The VC4 bootloader fills in certain properties in the 'axi' subtree, -but since this is part of an upstreaming effort, the name is changed. - -Signed-off-by: Noralf Tronnes notro@tronnes.org - -BCM2708_DT: Correct length of the peripheral space - -Use dts-dirs feature for overlays. - -The kernel makefiles have a dts-dirs target that is for vendor subdirectories. - -Using this fixes the install_dtbs target, which previously did not install the overlays. +Date: Mon, 10 Aug 2015 09:49:15 +0100 +Subject: [PATCH 055/112] scripts/dtc: Update to upstream version 1.4.1 -BCM270X_DT: configure I2S DMA channels +Includes the new localfixups format. -Signed-off-by: Matthias Reichl <hias@horus.com> +Signed-off-by: Phil Elwell <phil@raspberrypi.org> -BCM270X_DT: switch to bcm2835-i2s +scripts/dtc: Fix UMR causing corrupt dtbo overlay files -I2S soundcard drivers with proper devicetree support (i.e. not linking -to the cpu_dai/platform via name but to cpu/platform via of_node) -will work out of the box without any modifications. +struct fixup_entry is allocated from the heap but it's member +local_fixup_generated was never initialized. This lead to +corrupted dtbo files. -When the kernel is compiled without devicetree support the platform -code will instantiate the bcm2708-i2s driver and I2S soundcard drivers -will link to it via name, as before. +Fix this by initializing local_fixup_generated to false. Signed-off-by: Matthias Reichl <hias@horus.com> -SDIO-overlay: add poll_once-boolean parameter - -Add paramter to toggle sdio-device-polling -done every second or once at boot-time. - -Signed-off-by: Patrick Boettcher <patrick.boettcher@posteo.de> - -BCM270X_DT: Make mmc overlay compatible with current firmware - -The original DT overlay logic followed a merge-then-patch procedure, -i.e. parameters are applied to the loaded overlay before the overlay -is merged into the base DTB. This sequence has been changed to -patch-then-merge, in order to support parameterised node names, and -to protect against bad overlays. As a result, overrides (parameters) -must only target labels in the overlay, but the overlay can obviously target nodes in the base DTB. - -mmc-overlay.dts (that switches back to the original mmc sdcard -driver) is the only overlay violating that rule, and this patch -fixes it. - -bcm270x_dt: Use the sdhost MMC controller by default - -The "mmc" overlay reverts to using the other controller. +scripts/dtc: Only emit local fixups for overlays -squash: Add cprman to dt - -BCM270X_DT: Use clk_core for I2C interfaces +Signed-off-by: Phil Elwell <phil@raspberrypi.org> --- - arch/arm/boot/dts/Makefile | 30 + - arch/arm/boot/dts/bcm2708-rpi-b-plus.dts | 145 +++++ - arch/arm/boot/dts/bcm2708-rpi-b.dts | 135 +++++ - arch/arm/boot/dts/bcm2708-rpi-cm.dts | 102 ++++ - arch/arm/boot/dts/bcm2708-rpi-cm.dtsi | 40 ++ - arch/arm/boot/dts/bcm2708.dtsi | 40 ++ - arch/arm/boot/dts/bcm2708_common.dtsi | 347 +++++++++++ - arch/arm/boot/dts/bcm2709-rpi-2-b.dts | 145 +++++ - arch/arm/boot/dts/bcm2709.dtsi | 102 ++++ - arch/arm/boot/dts/bcm2835-rpi-cm.dts | 93 +++ - arch/arm/boot/dts/bcm2835-rpi-cm.dtsi | 30 + - arch/arm/boot/dts/overlays/Makefile | 69 +++ - arch/arm/boot/dts/overlays/README | 648 +++++++++++++++++++++ - arch/arm/boot/dts/overlays/ads7846-overlay.dts | 83 +++ - .../dts/overlays/bmp085_i2c-sensor-overlay.dts | 23 + - arch/arm/boot/dts/overlays/dht11-overlay.dts | 39 ++ - arch/arm/boot/dts/overlays/enc28j60-overlay.dts | 50 ++ - .../boot/dts/overlays/gpio-poweroff-overlay.dts | 34 ++ - .../boot/dts/overlays/hifiberry-amp-overlay.dts | 39 ++ - .../boot/dts/overlays/hifiberry-dac-overlay.dts | 34 ++ - .../dts/overlays/hifiberry-dacplus-overlay.dts | 39 ++ - .../boot/dts/overlays/hifiberry-digi-overlay.dts | 39 ++ - arch/arm/boot/dts/overlays/hy28a-overlay.dts | 87 +++ - arch/arm/boot/dts/overlays/hy28b-overlay.dts | 142 +++++ - arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts | 55 ++ - arch/arm/boot/dts/overlays/i2s-mmap-overlay.dts | 13 + - arch/arm/boot/dts/overlays/iqaudio-dac-overlay.dts | 39 ++ - .../boot/dts/overlays/iqaudio-dacplus-overlay.dts | 39 ++ - arch/arm/boot/dts/overlays/lirc-rpi-overlay.dts | 57 ++ - .../arm/boot/dts/overlays/mcp2515-can0-overlay.dts | 69 +++ - .../arm/boot/dts/overlays/mcp2515-can1-overlay.dts | 69 +++ - arch/arm/boot/dts/overlays/mmc-overlay.dts | 39 ++ - arch/arm/boot/dts/overlays/mz61581-overlay.dts | 111 ++++ - arch/arm/boot/dts/overlays/piscreen-overlay.dts | 96 +++ - .../dts/overlays/pitft28-resistive-overlay.dts | 115 ++++ - arch/arm/boot/dts/overlays/pps-gpio-overlay.dts | 34 ++ - arch/arm/boot/dts/overlays/pwm-2chan-overlay.dts | 46 ++ - arch/arm/boot/dts/overlays/pwm-overlay.dts | 42 ++ - arch/arm/boot/dts/overlays/raspidac3-overlay.dts | 45 ++ - arch/arm/boot/dts/overlays/rpi-dac-overlay.dts | 34 ++ - arch/arm/boot/dts/overlays/rpi-display-overlay.dts | 82 +++ - arch/arm/boot/dts/overlays/rpi-ft5406-overlay.dts | 17 + - arch/arm/boot/dts/overlays/rpi-proto-overlay.dts | 39 ++ - arch/arm/boot/dts/overlays/rpi-sense-overlay.dts | 47 ++ - arch/arm/boot/dts/overlays/sdhost-overlay.dts | 29 + - arch/arm/boot/dts/overlays/sdio-overlay.dts | 32 + - arch/arm/boot/dts/overlays/smi-dev-overlay.dts | 18 + - arch/arm/boot/dts/overlays/smi-nand-overlay.dts | 69 +++ - arch/arm/boot/dts/overlays/smi-overlay.dts | 37 ++ - .../boot/dts/overlays/spi-gpio35-39-overlay.dts | 31 + - arch/arm/boot/dts/overlays/tinylcd35-overlay.dts | 216 +++++++ - arch/arm/boot/dts/overlays/uart1-overlay.dts | 38 ++ - arch/arm/boot/dts/overlays/vga666-overlay.dts | 30 + - arch/arm/boot/dts/overlays/w1-gpio-overlay.dts | 39 ++ - .../boot/dts/overlays/w1-gpio-pullup-overlay.dts | 41 ++ - 55 files changed, 4203 insertions(+) - create mode 100644 arch/arm/boot/dts/bcm2708-rpi-b-plus.dts - create mode 100644 arch/arm/boot/dts/bcm2708-rpi-b.dts - create mode 100755 arch/arm/boot/dts/bcm2708-rpi-cm.dts - create mode 100644 arch/arm/boot/dts/bcm2708-rpi-cm.dtsi - create mode 100644 arch/arm/boot/dts/bcm2708.dtsi - create mode 100644 arch/arm/boot/dts/bcm2708_common.dtsi - create mode 100644 arch/arm/boot/dts/bcm2709-rpi-2-b.dts - create mode 100644 arch/arm/boot/dts/bcm2709.dtsi - create mode 100644 arch/arm/boot/dts/bcm2835-rpi-cm.dts - create mode 100644 arch/arm/boot/dts/bcm2835-rpi-cm.dtsi - create mode 100644 arch/arm/boot/dts/overlays/Makefile - create mode 100644 arch/arm/boot/dts/overlays/README - create mode 100644 arch/arm/boot/dts/overlays/ads7846-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/bmp085_i2c-sensor-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/dht11-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/enc28j60-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/gpio-poweroff-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/hifiberry-amp-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/hifiberry-dac-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/hifiberry-digi-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/hy28a-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/hy28b-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/i2s-mmap-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/iqaudio-dac-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/iqaudio-dacplus-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/lirc-rpi-overlay.dts - create mode 100755 arch/arm/boot/dts/overlays/mcp2515-can0-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/mcp2515-can1-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/mmc-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/mz61581-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/piscreen-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/pitft28-resistive-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/pps-gpio-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/pwm-2chan-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/pwm-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/raspidac3-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/rpi-dac-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/rpi-display-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/rpi-ft5406-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/rpi-proto-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/rpi-sense-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/sdhost-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/sdio-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/smi-dev-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/smi-nand-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/smi-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/spi-gpio35-39-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/tinylcd35-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/uart1-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/vga666-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/w1-gpio-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/w1-gpio-pullup-overlay.dts + scripts/dtc/checks.c | 106 +++++- + scripts/dtc/dtc-lexer.l | 5 + + scripts/dtc/dtc-lexer.lex.c_shipped | 537 +++++++++++++------------- + scripts/dtc/dtc-parser.tab.c_shipped | 714 ++++++++++++++++++----------------- + scripts/dtc/dtc-parser.tab.h_shipped | 46 +-- + scripts/dtc/dtc-parser.y | 22 +- + scripts/dtc/dtc.c | 9 +- + scripts/dtc/dtc.h | 40 ++ + scripts/dtc/flattree.c | 202 ++++++++++ + scripts/dtc/version_gen.h | 2 +- + 10 files changed, 1029 insertions(+), 654 deletions(-) -diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile -index 30bbc37..d583e67 100644 ---- a/arch/arm/boot/dts/Makefile -+++ b/arch/arm/boot/dts/Makefile -@@ -1,5 +1,25 @@ - ifeq ($(CONFIG_OF),y) - -+dtb-$(CONFIG_ARCH_BCM2708) += bcm2708-rpi-b.dtb -+dtb-$(CONFIG_ARCH_BCM2708) += bcm2708-rpi-b-plus.dtb -+dtb-$(CONFIG_ARCH_BCM2708) += bcm2708-rpi-cm.dtb -+dtb-$(CONFIG_ARCH_BCM2835) += bcm2835-rpi-cm.dtb -+dtb-$(CONFIG_ARCH_BCM2709) += bcm2709-rpi-2-b.dtb -+ -+# Raspberry Pi -+ifeq ($(CONFIG_ARCH_BCM2708),y) -+ RPI_DT_OVERLAYS=y -+endif -+ifeq ($(CONFIG_ARCH_BCM2709),y) -+ RPI_DT_OVERLAYS=y -+endif -+ifeq ($(CONFIG_ARCH_BCM2835),y) -+ RPI_DT_OVERLAYS=y -+endif -+ifeq ($(RPI_DT_OVERLAYS),y) -+ dts-dirs += overlays -+endif -+ - dtb-$(CONFIG_ARCH_ALPINE) += \ - alpine-db.dtb - dtb-$(CONFIG_MACH_ASM9260) += \ -@@ -777,10 +797,20 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \ - mt8127-moose.dtb \ - mt8135-evbp1.dtb - dtb-$(CONFIG_ARCH_ZX) += zx296702-ad1.dtb -+ -+targets += dtbs dtbs_install -+targets += $(dtb-y) -+ - endif +diff --git a/scripts/dtc/checks.c b/scripts/dtc/checks.c +index 0c03ac9..88550b4 100644 +--- a/scripts/dtc/checks.c ++++ b/scripts/dtc/checks.c +@@ -458,6 +458,8 @@ static void fixup_phandle_references(struct check *c, struct node *dt, + struct node *node, struct property *prop) + { + struct marker *m = prop->val.markers; ++ struct fixup *f, **fp; ++ struct fixup_entry *fe, **fep; + struct node *refnode; + cell_t phandle; - dtstree := $(srctree)/$(src) - dtb-$(CONFIG_OF_ALL_DTBS) := $(patsubst $(dtstree)/%.dts,%.dtb, $(wildcard $(dtstree)/*.dts)) +@@ -466,11 +468,70 @@ static void fixup_phandle_references(struct check *c, struct node *dt, - always := $(dtb-y) -+subdir-y := $(dts-dirs) - clean-files := *.dtb -+ -+# Enable fixups to support overlays on BCM2708 platforms -+ifeq ($(RPI_DT_OVERLAYS),y) -+ DTC_FLAGS ?= -@ -+endif -diff --git a/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts b/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts -new file mode 100644 -index 0000000..2e4df17 ---- /dev/null -+++ b/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts -@@ -0,0 +1,145 @@ -+/dts-v1/; -+ -+#include "bcm2708.dtsi" -+ -+/ { -+ compatible = "brcm,bcm2708"; -+ model = "Raspberry Pi Model B+"; -+}; + refnode = get_node_by_ref(dt, m->ref); + if (! refnode) { +- FAIL(c, "Reference to non-existent node or label \"%s\"\n", +- m->ref); ++ if (!dt->is_plugin) { ++ FAIL(c, "Reference to non-existent node or label \"%s\"\n", ++ m->ref); ++ continue; ++ } + -+&gpio { -+ sdhost_pins: sdhost_pins { -+ brcm,pins = <48 49 50 51 52 53>; -+ brcm,function = <4>; /* alt0 */ -+ }; ++ /* allocate fixup entry */ ++ fe = xmalloc(sizeof(*fe)); + -+ spi0_pins: spi0_pins { -+ brcm,pins = <9 10 11>; -+ brcm,function = <4>; /* alt0 */ -+ }; ++ fe->node = node; ++ fe->prop = prop; ++ fe->offset = m->offset; ++ fe->next = NULL; + -+ spi0_cs_pins: spi0_cs_pins { -+ brcm,pins = <8 7>; -+ brcm,function = <1>; /* output */ -+ }; ++ /* search for an already existing fixup */ ++ for_each_fixup(dt, f) ++ if (strcmp(f->ref, m->ref) == 0) ++ break; + -+ i2c0_pins: i2c0 { -+ brcm,pins = <0 1>; -+ brcm,function = <4>; -+ }; ++ /* no fixup found, add new */ ++ if (f == NULL) { ++ f = xmalloc(sizeof(*f)); ++ f->ref = m->ref; ++ f->entries = NULL; ++ f->next = NULL; + -+ i2c1_pins: i2c1 { -+ brcm,pins = <2 3>; -+ brcm,function = <4>; -+ }; ++ /* add it to the tree */ ++ fp = &dt->fixups; ++ while (*fp) ++ fp = &(*fp)->next; ++ *fp = f; ++ } + -+ i2s_pins: i2s { -+ brcm,pins = <18 19 20 21>; -+ brcm,function = <4>; /* alt0 */ -+ }; -+}; ++ /* and now append fixup entry */ ++ fep = &f->entries; ++ while (*fep) ++ fep = &(*fep)->next; ++ *fep = fe; + -+&sdhost { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&sdhost_pins>; -+ bus-width = <4>; -+ status = "okay"; -+}; ++ /* mark the entry as unresolved */ ++ *((cell_t *)(prop->val.val + m->offset)) = ++ cpu_to_fdt32(0xdeadbeef); + continue; + } + ++ /* if it's a local reference, we need to record it */ ++ if (symbol_fixup_support && dt->is_plugin) { + -+&fb { -+ status = "okay"; -+}; ++ /* allocate a new local fixup entry */ ++ fe = xmalloc(sizeof(*fe)); + -+&uart0 { -+ status = "okay"; -+}; ++ fe->node = node; ++ fe->prop = prop; ++ fe->offset = m->offset; ++ fe->next = NULL; ++ fe->local_fixup_generated = false; + -+&spi0 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&spi0_pins &spi0_cs_pins>; -+ cs-gpios = <&gpio 8 1>, <&gpio 7 1>; ++ /* append it to the local fixups */ ++ fep = &dt->local_fixups; ++ while (*fep) ++ fep = &(*fep)->next; ++ *fep = fe; ++ } + -+ spidev@0{ -+ compatible = "spidev"; -+ reg = <0>; /* CE0 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; -+ }; + phandle = get_node_phandle(dt, refnode); + *((cell_t *)(prop->val.val + m->offset)) = cpu_to_fdt32(phandle); + } +@@ -652,6 +713,45 @@ static void check_obsolete_chosen_interrupt_controller(struct check *c, + } + TREE_WARNING(obsolete_chosen_interrupt_controller, NULL); + ++static void check_auto_label_phandles(struct check *c, struct node *dt, ++ struct node *node) ++{ ++ struct label *l; ++ struct symbol *s, **sp; ++ int has_label; + -+ spidev@1{ -+ compatible = "spidev"; -+ reg = <1>; /* CE1 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; -+ }; -+}; ++ if (!symbol_fixup_support) ++ return; + -+&i2c0 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&i2c0_pins>; -+ clock-frequency = <100000>; -+}; ++ has_label = 0; ++ for_each_label(node->labels, l) { ++ has_label = 1; ++ break; ++ } + -+&i2c1 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&i2c1_pins>; -+ clock-frequency = <100000>; -+}; ++ if (!has_label) ++ return; + -+&i2c2 { -+ clock-frequency = <100000>; -+}; ++ /* force allocation of a phandle for this node */ ++ (void)get_node_phandle(dt, node); + -+&i2s { -+ #sound-dai-cells = <0>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&i2s_pins>; -+}; ++ /* add the symbol */ ++ for_each_label(node->labels, l) { + -+&random { -+ status = "okay"; -+}; ++ s = xmalloc(sizeof(*s)); ++ s->label = l; ++ s->node = node; ++ s->next = NULL; + -+&leds { -+ act_led: act { -+ label = "led0"; -+ linux,default-trigger = "mmc0"; -+ gpios = <&gpio 47 0>; -+ }; ++ /* add it to the symbols list */ ++ sp = &dt->symbols; ++ while (*sp) ++ sp = &((*sp)->next); ++ *sp = s; ++ } ++} ++NODE_WARNING(auto_label_phandles, NULL); + -+ pwr_led: pwr { -+ label = "led1"; -+ linux,default-trigger = "input"; -+ gpios = <&gpio 35 0>; -+ }; -+}; + static struct check *check_table[] = { + &duplicate_node_names, &duplicate_property_names, + &node_name_chars, &node_name_format, &property_name_chars, +@@ -670,6 +770,8 @@ static struct check *check_table[] = { + &avoid_default_addr_size, + &obsolete_chosen_interrupt_controller, + ++ &auto_label_phandles, + -+/ { -+ __overrides__ { -+ uart0 = <&uart0>,"status"; -+ uart0_clkrate = <&clk_uart0>,"clock-frequency:0"; -+ i2s = <&i2s>,"status"; -+ spi = <&spi0>,"status"; -+ i2c0 = <&i2c0>,"status"; -+ i2c1 = <&i2c1>,"status"; -+ i2c2_iknowwhatimdoing = <&i2c2>,"status"; -+ i2c0_baudrate = <&i2c0>,"clock-frequency:0"; -+ i2c1_baudrate = <&i2c1>,"clock-frequency:0"; -+ i2c2_baudrate = <&i2c2>,"clock-frequency:0"; -+ core_freq = <&clk_core>,"clock-frequency:0"; + &always_fail, + }; + +diff --git a/scripts/dtc/dtc-lexer.l b/scripts/dtc/dtc-lexer.l +index 790fbf6..40bbc87 100644 +--- a/scripts/dtc/dtc-lexer.l ++++ b/scripts/dtc/dtc-lexer.l +@@ -121,6 +121,11 @@ static void lexical_error(const char *fmt, ...); + return DT_V1; + } + ++<*>"/plugin/" { ++ DPRINT("Keyword: /plugin/\n"); ++ return DT_PLUGIN; ++ } + -+ act_led_gpio = <&act_led>,"gpios:4"; -+ act_led_activelow = <&act_led>,"gpios:8"; -+ act_led_trigger = <&act_led>,"linux,default-trigger"; + <*>"/memreserve/" { + DPRINT("Keyword: /memreserve/\n"); + BEGIN_DEFAULT(); +diff --git a/scripts/dtc/dtc-lexer.lex.c_shipped b/scripts/dtc/dtc-lexer.lex.c_shipped +index ba525c2..1518525 100644 +--- a/scripts/dtc/dtc-lexer.lex.c_shipped ++++ b/scripts/dtc/dtc-lexer.lex.c_shipped +@@ -9,7 +9,7 @@ + #define FLEX_SCANNER + #define YY_FLEX_MAJOR_VERSION 2 + #define YY_FLEX_MINOR_VERSION 5 +-#define YY_FLEX_SUBMINOR_VERSION 39 ++#define YY_FLEX_SUBMINOR_VERSION 35 + #if YY_FLEX_SUBMINOR_VERSION > 0 + #define FLEX_BETA + #endif +@@ -162,12 +162,7 @@ typedef unsigned int flex_uint32_t; + typedef struct yy_buffer_state *YY_BUFFER_STATE; + #endif + +-#ifndef YY_TYPEDEF_YY_SIZE_T +-#define YY_TYPEDEF_YY_SIZE_T +-typedef size_t yy_size_t; +-#endif +- +-extern yy_size_t yyleng; ++extern int yyleng; + + extern FILE *yyin, *yyout; + +@@ -176,7 +171,6 @@ extern FILE *yyin, *yyout; + #define EOB_ACT_LAST_MATCH 2 + + #define YY_LESS_LINENO(n) +- #define YY_LINENO_REWIND_TO(ptr) + + /* Return all but the first "n" matched characters back to the input stream. */ + #define yyless(n) \ +@@ -194,6 +188,11 @@ extern FILE *yyin, *yyout; + + #define unput(c) yyunput( c, (yytext_ptr) ) + ++#ifndef YY_TYPEDEF_YY_SIZE_T ++#define YY_TYPEDEF_YY_SIZE_T ++typedef size_t yy_size_t; ++#endif + -+ pwr_led_gpio = <&pwr_led>,"gpios:4"; -+ pwr_led_activelow = <&pwr_led>,"gpios:8"; -+ pwr_led_trigger = <&pwr_led>,"linux,default-trigger"; + #ifndef YY_STRUCT_YY_BUFFER_STATE + #define YY_STRUCT_YY_BUFFER_STATE + struct yy_buffer_state +@@ -211,7 +210,7 @@ struct yy_buffer_state + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ +- yy_size_t yy_n_chars; ++ int yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to +@@ -281,8 +280,8 @@ static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ + + /* yy_hold_char holds the character lost when yytext is formed. */ + static char yy_hold_char; +-static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */ +-yy_size_t yyleng; ++static int yy_n_chars; /* number of characters read into yy_ch_buf */ ++int yyleng; + + /* Points to current character in buffer. */ + static char *yy_c_buf_p = (char *) 0; +@@ -310,7 +309,7 @@ static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ); + + YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ); + YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ); +-YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,yy_size_t len ); ++YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len ); + + void *yyalloc (yy_size_t ); + void *yyrealloc (void *,yy_size_t ); +@@ -342,7 +341,7 @@ void yyfree (void * ); + + /* Begin user sect3 */ + +-#define yywrap() 1 ++#define yywrap(n) 1 + #define YY_SKIP_YYWRAP + + typedef unsigned char YY_CHAR; +@@ -373,8 +372,8 @@ static void yy_fatal_error (yyconst char msg[] ); + *yy_cp = '\0'; \ + (yy_c_buf_p) = yy_cp; + +-#define YY_NUM_RULES 30 +-#define YY_END_OF_BUFFER 31 ++#define YY_NUM_RULES 31 ++#define YY_END_OF_BUFFER 32 + /* This struct is not used in this scanner, + but its presence is necessary. */ + struct yy_trans_info +@@ -382,25 +381,26 @@ struct yy_trans_info + flex_int32_t yy_verify; + flex_int32_t yy_nxt; + }; +-static yyconst flex_int16_t yy_accept[159] = ++static yyconst flex_int16_t yy_accept[166] = + { 0, +- 0, 0, 0, 0, 0, 0, 0, 0, 31, 29, +- 18, 18, 29, 29, 29, 29, 29, 29, 29, 29, +- 29, 29, 29, 29, 29, 29, 15, 16, 16, 29, +- 16, 10, 10, 18, 26, 0, 3, 0, 27, 12, +- 0, 0, 11, 0, 0, 0, 0, 0, 0, 0, +- 21, 23, 25, 24, 22, 0, 9, 28, 0, 0, +- 0, 14, 14, 16, 16, 16, 10, 10, 10, 0, +- 12, 0, 11, 0, 0, 0, 20, 0, 0, 0, +- 0, 0, 0, 0, 0, 16, 10, 10, 10, 0, +- 13, 19, 0, 0, 0, 0, 0, 0, 0, 0, +- +- 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, +- 0, 16, 6, 0, 0, 0, 0, 0, 0, 2, +- 0, 0, 0, 0, 0, 0, 0, 0, 4, 17, +- 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, +- 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, +- 5, 8, 0, 0, 0, 0, 7, 0 ++ 0, 0, 0, 0, 0, 0, 0, 0, 32, 30, ++ 19, 19, 30, 30, 30, 30, 30, 30, 30, 30, ++ 30, 30, 30, 30, 30, 30, 16, 17, 17, 30, ++ 17, 11, 11, 19, 27, 0, 3, 0, 28, 13, ++ 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, ++ 0, 22, 24, 26, 25, 23, 0, 10, 29, 0, ++ 0, 0, 15, 15, 17, 17, 17, 11, 11, 11, ++ 0, 13, 0, 12, 0, 0, 0, 21, 0, 0, ++ 0, 0, 0, 0, 0, 0, 0, 17, 11, 11, ++ 11, 0, 14, 20, 0, 0, 0, 0, 0, 0, + -+ audio = <&audio>,"status"; -+ watchdog = <&watchdog>,"status"; -+ random = <&random>,"status"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/bcm2708-rpi-b.dts b/arch/arm/boot/dts/bcm2708-rpi-b.dts -new file mode 100644 -index 0000000..0445b46 ---- /dev/null -+++ b/arch/arm/boot/dts/bcm2708-rpi-b.dts -@@ -0,0 +1,135 @@ -+/dts-v1/; ++ 0, 0, 0, 0, 17, 0, 0, 0, 0, 0, ++ 0, 0, 0, 0, 0, 17, 7, 0, 0, 0, ++ 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, ++ 0, 0, 0, 0, 4, 18, 0, 0, 5, 2, ++ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ++ 0, 0, 1, 0, 0, 0, 0, 6, 9, 0, ++ 0, 0, 0, 8, 0 + } ; + + static yyconst flex_int32_t yy_ec[256] = +@@ -416,9 +416,9 @@ static yyconst flex_int32_t yy_ec[256] = + 22, 22, 22, 22, 24, 22, 22, 25, 22, 22, + 1, 26, 27, 1, 22, 1, 21, 28, 29, 30, + +- 31, 21, 22, 22, 32, 22, 22, 33, 34, 35, +- 36, 37, 22, 38, 39, 40, 41, 42, 22, 25, +- 43, 22, 44, 45, 46, 1, 1, 1, 1, 1, ++ 31, 21, 32, 22, 33, 22, 22, 34, 35, 36, ++ 37, 38, 22, 39, 40, 41, 42, 43, 22, 25, ++ 44, 22, 45, 46, 47, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +@@ -435,163 +435,165 @@ static yyconst flex_int32_t yy_ec[256] = + 1, 1, 1, 1, 1 + } ; + +-static yyconst flex_int32_t yy_meta[47] = ++static yyconst flex_int32_t yy_meta[48] = + { 0, + 1, 1, 1, 1, 1, 1, 2, 3, 1, 2, + 2, 2, 4, 5, 5, 5, 6, 1, 1, 1, + 7, 8, 8, 8, 8, 1, 1, 7, 7, 7, + 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, +- 8, 8, 8, 3, 1, 4 ++ 8, 8, 8, 8, 3, 1, 4 + } ; + +-static yyconst flex_int16_t yy_base[173] = ++static yyconst flex_int16_t yy_base[180] = + { 0, +- 0, 383, 34, 382, 65, 381, 37, 105, 387, 391, +- 54, 111, 367, 110, 109, 109, 112, 41, 366, 104, +- 367, 338, 124, 117, 0, 144, 391, 0, 121, 0, +- 135, 155, 140, 179, 391, 160, 391, 379, 391, 0, +- 368, 141, 391, 167, 370, 376, 346, 103, 342, 345, +- 391, 391, 391, 391, 391, 358, 391, 391, 175, 342, +- 338, 391, 355, 0, 185, 339, 184, 347, 346, 0, +- 0, 322, 175, 357, 175, 363, 352, 324, 330, 323, +- 332, 326, 201, 324, 329, 322, 391, 333, 181, 309, +- 391, 341, 340, 313, 320, 338, 178, 311, 146, 317, +- +- 314, 315, 335, 331, 303, 300, 309, 299, 308, 188, +- 336, 335, 391, 305, 320, 281, 283, 271, 203, 288, +- 281, 271, 266, 264, 245, 242, 208, 104, 391, 391, +- 244, 218, 204, 219, 206, 224, 201, 212, 204, 229, +- 215, 208, 207, 200, 219, 391, 233, 221, 200, 181, +- 391, 391, 149, 122, 86, 41, 391, 391, 245, 251, +- 259, 263, 267, 273, 280, 284, 292, 300, 304, 310, +- 318, 326 ++ 0, 393, 35, 392, 66, 391, 38, 107, 397, 401, ++ 55, 113, 377, 112, 111, 111, 114, 42, 376, 106, ++ 377, 347, 126, 120, 0, 147, 401, 0, 124, 0, ++ 137, 158, 170, 163, 401, 153, 401, 389, 401, 0, ++ 378, 120, 401, 131, 380, 386, 355, 139, 351, 355, ++ 351, 401, 401, 401, 401, 401, 367, 401, 401, 185, ++ 350, 346, 401, 364, 0, 185, 347, 189, 356, 355, ++ 0, 0, 330, 180, 366, 141, 372, 361, 332, 338, ++ 331, 341, 334, 326, 205, 331, 337, 329, 401, 341, ++ 167, 316, 401, 349, 348, 320, 328, 346, 180, 318, + -+#include "bcm2708.dtsi" ++ 324, 209, 324, 320, 322, 342, 338, 309, 306, 315, ++ 305, 315, 312, 192, 342, 341, 401, 293, 306, 282, ++ 268, 252, 255, 203, 285, 282, 272, 268, 252, 233, ++ 232, 239, 208, 107, 401, 401, 238, 211, 401, 211, ++ 212, 208, 228, 203, 215, 207, 233, 222, 212, 211, ++ 203, 227, 401, 237, 225, 204, 185, 401, 401, 149, ++ 128, 88, 42, 401, 401, 253, 259, 267, 271, 275, ++ 281, 288, 292, 300, 308, 312, 318, 326, 334 + } ; + +-static yyconst flex_int16_t yy_def[173] = ++static yyconst flex_int16_t yy_def[180] = + { 0, +- 158, 1, 1, 3, 158, 5, 1, 1, 158, 158, +- 158, 158, 158, 159, 160, 161, 158, 158, 158, 158, +- 162, 158, 158, 158, 163, 162, 158, 164, 165, 164, +- 164, 158, 158, 158, 158, 159, 158, 159, 158, 166, +- 158, 161, 158, 161, 167, 168, 158, 158, 158, 158, +- 158, 158, 158, 158, 158, 162, 158, 158, 158, 158, +- 158, 158, 162, 164, 165, 164, 158, 158, 158, 169, +- 166, 170, 161, 167, 167, 168, 158, 158, 158, 158, +- 158, 158, 158, 158, 158, 164, 158, 158, 169, 170, +- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, +- +- 158, 164, 158, 158, 158, 158, 158, 158, 158, 171, +- 158, 164, 158, 158, 158, 158, 158, 158, 171, 158, +- 171, 158, 158, 158, 158, 158, 158, 158, 158, 158, +- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, +- 172, 158, 158, 158, 172, 158, 172, 158, 158, 158, +- 158, 158, 158, 158, 158, 158, 158, 0, 158, 158, +- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, +- 158, 158 ++ 165, 1, 1, 3, 165, 5, 1, 1, 165, 165, ++ 165, 165, 165, 166, 167, 168, 165, 165, 165, 165, ++ 169, 165, 165, 165, 170, 169, 165, 171, 172, 171, ++ 171, 165, 165, 165, 165, 166, 165, 166, 165, 173, ++ 165, 168, 165, 168, 174, 175, 165, 165, 165, 165, ++ 165, 165, 165, 165, 165, 165, 169, 165, 165, 165, ++ 165, 165, 165, 169, 171, 172, 171, 165, 165, 165, ++ 176, 173, 177, 168, 174, 174, 175, 165, 165, 165, ++ 165, 165, 165, 165, 165, 165, 165, 171, 165, 165, ++ 176, 177, 165, 165, 165, 165, 165, 165, 165, 165, + -+/ { -+ compatible = "brcm,bcm2708"; -+ model = "Raspberry Pi Model B"; -+}; ++ 165, 165, 165, 165, 171, 165, 165, 165, 165, 165, ++ 165, 165, 165, 178, 165, 171, 165, 165, 165, 165, ++ 165, 165, 165, 178, 165, 178, 165, 165, 165, 165, ++ 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, ++ 165, 165, 165, 165, 165, 165, 165, 179, 165, 165, ++ 165, 179, 165, 179, 165, 165, 165, 165, 165, 165, ++ 165, 165, 165, 165, 0, 165, 165, 165, 165, 165, ++ 165, 165, 165, 165, 165, 165, 165, 165, 165 + } ; + +-static yyconst flex_int16_t yy_nxt[438] = ++static yyconst flex_int16_t yy_nxt[449] = + { 0, + 10, 11, 12, 11, 13, 14, 10, 15, 16, 10, + 10, 10, 17, 10, 10, 10, 10, 18, 19, 20, + 21, 21, 21, 21, 21, 10, 10, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, +- 21, 21, 21, 10, 22, 10, 24, 25, 25, 25, +- 32, 33, 33, 157, 26, 34, 34, 34, 51, 52, +- 27, 26, 26, 26, 26, 10, 11, 12, 11, 13, +- 14, 28, 15, 16, 28, 28, 28, 24, 28, 28, +- 28, 10, 18, 19, 20, 29, 29, 29, 29, 29, +- 30, 10, 29, 29, 29, 29, 29, 29, 29, 29, +- +- 29, 29, 29, 29, 29, 29, 29, 29, 10, 22, +- 10, 23, 34, 34, 34, 37, 39, 43, 32, 33, +- 33, 45, 54, 55, 46, 59, 45, 64, 156, 46, +- 64, 64, 64, 79, 44, 38, 59, 57, 134, 47, +- 135, 48, 80, 49, 47, 50, 48, 99, 61, 43, +- 50, 110, 41, 67, 67, 67, 60, 63, 63, 63, +- 57, 155, 68, 69, 63, 37, 44, 66, 67, 67, +- 67, 63, 63, 63, 63, 73, 59, 68, 69, 70, +- 34, 34, 34, 43, 75, 38, 154, 92, 83, 83, +- 83, 64, 44, 120, 64, 64, 64, 67, 67, 67, +- +- 44, 57, 99, 68, 69, 107, 68, 69, 120, 127, +- 108, 153, 152, 121, 83, 83, 83, 133, 133, 133, +- 146, 133, 133, 133, 146, 140, 140, 140, 121, 141, +- 140, 140, 140, 151, 141, 158, 150, 149, 148, 144, +- 147, 143, 142, 139, 147, 36, 36, 36, 36, 36, +- 36, 36, 36, 40, 138, 137, 136, 40, 40, 42, +- 42, 42, 42, 42, 42, 42, 42, 56, 56, 56, +- 56, 62, 132, 62, 64, 131, 130, 64, 129, 64, +- 64, 65, 128, 158, 65, 65, 65, 65, 71, 127, +- 71, 71, 74, 74, 74, 74, 74, 74, 74, 74, +- +- 76, 76, 76, 76, 76, 76, 76, 76, 89, 126, +- 89, 90, 125, 90, 90, 124, 90, 90, 119, 119, +- 119, 119, 119, 119, 119, 119, 145, 145, 145, 145, +- 145, 145, 145, 145, 123, 122, 59, 59, 118, 117, +- 116, 115, 114, 113, 45, 112, 108, 111, 109, 106, +- 105, 104, 46, 103, 91, 87, 102, 101, 100, 98, +- 97, 96, 95, 94, 93, 77, 75, 91, 88, 87, +- 86, 57, 85, 84, 57, 82, 81, 78, 77, 75, +- 72, 158, 58, 57, 53, 35, 158, 31, 23, 23, +- 9, 158, 158, 158, 158, 158, 158, 158, 158, 158, +- +- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, +- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, +- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, +- 158, 158, 158, 158, 158, 158, 158 ++ 21, 21, 21, 21, 10, 22, 10, 24, 25, 25, ++ 25, 32, 33, 33, 164, 26, 34, 34, 34, 52, ++ 53, 27, 26, 26, 26, 26, 10, 11, 12, 11, ++ 13, 14, 28, 15, 16, 28, 28, 28, 24, 28, ++ 28, 28, 10, 18, 19, 20, 29, 29, 29, 29, ++ 29, 30, 10, 29, 29, 29, 29, 29, 29, 29, + -+&gpio { -+ sdhost_pins: sdhost_pins { -+ brcm,pins = <48 49 50 51 52 53>; -+ brcm,function = <4>; /* alt0 */ -+ }; ++ 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, ++ 10, 22, 10, 23, 34, 34, 34, 37, 39, 43, ++ 32, 33, 33, 45, 55, 56, 46, 60, 43, 45, ++ 65, 163, 46, 65, 65, 65, 44, 38, 60, 74, ++ 58, 47, 141, 48, 142, 44, 49, 47, 50, 48, ++ 76, 51, 62, 94, 50, 41, 44, 51, 37, 61, ++ 64, 64, 64, 58, 34, 34, 34, 64, 162, 80, ++ 67, 68, 68, 68, 64, 64, 64, 64, 38, 81, ++ 69, 70, 71, 68, 68, 68, 60, 161, 43, 69, ++ 70, 65, 69, 70, 65, 65, 65, 125, 85, 85, + -+ spi0_pins: spi0_pins { -+ brcm,pins = <9 10 11>; -+ brcm,function = <4>; /* alt0 */ -+ }; ++ 85, 58, 68, 68, 68, 44, 102, 110, 125, 133, ++ 102, 69, 70, 111, 114, 160, 159, 126, 85, 85, ++ 85, 140, 140, 140, 140, 140, 140, 153, 126, 147, ++ 147, 147, 153, 148, 147, 147, 147, 158, 148, 165, ++ 157, 156, 155, 151, 150, 149, 146, 154, 145, 144, ++ 143, 139, 154, 36, 36, 36, 36, 36, 36, 36, ++ 36, 40, 138, 137, 136, 40, 40, 42, 42, 42, ++ 42, 42, 42, 42, 42, 57, 57, 57, 57, 63, ++ 135, 63, 65, 134, 165, 65, 133, 65, 65, 66, ++ 132, 131, 66, 66, 66, 66, 72, 130, 72, 72, + -+ spi0_cs_pins: spi0_cs_pins { -+ brcm,pins = <8 7>; -+ brcm,function = <1>; /* output */ -+ }; ++ 75, 75, 75, 75, 75, 75, 75, 75, 77, 77, ++ 77, 77, 77, 77, 77, 77, 91, 129, 91, 92, ++ 128, 92, 92, 127, 92, 92, 124, 124, 124, 124, ++ 124, 124, 124, 124, 152, 152, 152, 152, 152, 152, ++ 152, 152, 60, 60, 123, 122, 121, 120, 119, 118, ++ 117, 45, 116, 111, 115, 113, 112, 109, 108, 107, ++ 46, 106, 93, 89, 105, 104, 103, 101, 100, 99, ++ 98, 97, 96, 95, 78, 76, 93, 90, 89, 88, ++ 58, 87, 86, 58, 84, 83, 82, 79, 78, 76, ++ 73, 165, 59, 58, 54, 35, 165, 31, 23, 23, + -+ i2c0_pins: i2c0 { -+ brcm,pins = <0 1>; -+ brcm,function = <4>; -+ }; ++ 9, 165, 165, 165, 165, 165, 165, 165, 165, 165, ++ 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, ++ 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, ++ 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, ++ 165, 165, 165, 165, 165, 165, 165, 165 + } ; + +-static yyconst flex_int16_t yy_chk[438] = ++static yyconst flex_int16_t yy_chk[449] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +- 1, 1, 1, 1, 1, 1, 3, 3, 3, 3, +- 7, 7, 7, 156, 3, 11, 11, 11, 18, 18, +- 3, 3, 3, 3, 3, 5, 5, 5, 5, 5, ++ 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, ++ 3, 7, 7, 7, 163, 3, 11, 11, 11, 18, ++ 18, 3, 3, 3, 3, 3, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, +- 5, 8, 12, 12, 12, 14, 15, 16, 8, 8, +- 8, 17, 20, 20, 17, 23, 24, 29, 155, 24, +- 29, 29, 29, 48, 16, 14, 31, 29, 128, 17, +- 128, 17, 48, 17, 24, 17, 24, 99, 24, 42, +- 24, 99, 15, 33, 33, 33, 23, 26, 26, 26, +- 26, 154, 33, 33, 26, 36, 42, 31, 32, 32, +- 32, 26, 26, 26, 26, 44, 59, 32, 32, 32, +- 34, 34, 34, 73, 75, 36, 153, 75, 59, 59, +- 59, 65, 44, 110, 65, 65, 65, 67, 67, 67, +- +- 73, 65, 83, 89, 89, 97, 67, 67, 119, 127, +- 97, 150, 149, 110, 83, 83, 83, 133, 133, 133, +- 141, 127, 127, 127, 145, 136, 136, 136, 119, 136, +- 140, 140, 140, 148, 140, 147, 144, 143, 142, 139, +- 141, 138, 137, 135, 145, 159, 159, 159, 159, 159, +- 159, 159, 159, 160, 134, 132, 131, 160, 160, 161, +- 161, 161, 161, 161, 161, 161, 161, 162, 162, 162, +- 162, 163, 126, 163, 164, 125, 124, 164, 123, 164, +- 164, 165, 122, 121, 165, 165, 165, 165, 166, 120, +- 166, 166, 167, 167, 167, 167, 167, 167, 167, 167, +- +- 168, 168, 168, 168, 168, 168, 168, 168, 169, 118, +- 169, 170, 117, 170, 170, 116, 170, 170, 171, 171, +- 171, 171, 171, 171, 171, 171, 172, 172, 172, 172, +- 172, 172, 172, 172, 115, 114, 112, 111, 109, 108, +- 107, 106, 105, 104, 103, 102, 101, 100, 98, 96, +- 95, 94, 93, 92, 90, 88, 86, 85, 84, 82, +- 81, 80, 79, 78, 77, 76, 74, 72, 69, 68, +- 66, 63, 61, 60, 56, 50, 49, 47, 46, 45, ++ 5, 5, 5, 8, 12, 12, 12, 14, 15, 16, ++ 8, 8, 8, 17, 20, 20, 17, 23, 42, 24, ++ 29, 162, 24, 29, 29, 29, 16, 14, 31, 44, ++ 29, 17, 134, 17, 134, 42, 17, 24, 17, 24, ++ 76, 17, 24, 76, 24, 15, 44, 24, 36, 23, ++ 26, 26, 26, 26, 34, 34, 34, 26, 161, 48, ++ 31, 32, 32, 32, 26, 26, 26, 26, 36, 48, ++ 32, 32, 32, 33, 33, 33, 60, 160, 74, 91, ++ 91, 66, 33, 33, 66, 66, 66, 114, 60, 60, + -+ i2c1_pins: i2c1 { -+ brcm,pins = <2 3>; -+ brcm,function = <4>; -+ }; ++ 60, 66, 68, 68, 68, 74, 85, 99, 124, 133, ++ 102, 68, 68, 99, 102, 157, 156, 114, 85, 85, ++ 85, 133, 133, 133, 140, 140, 140, 148, 124, 143, ++ 143, 143, 152, 143, 147, 147, 147, 155, 147, 154, ++ 151, 150, 149, 146, 145, 144, 142, 148, 141, 138, ++ 137, 132, 152, 166, 166, 166, 166, 166, 166, 166, ++ 166, 167, 131, 130, 129, 167, 167, 168, 168, 168, ++ 168, 168, 168, 168, 168, 169, 169, 169, 169, 170, ++ 128, 170, 171, 127, 126, 171, 125, 171, 171, 172, ++ 123, 122, 172, 172, 172, 172, 173, 121, 173, 173, + -+ i2s_pins: i2s { -+ brcm,pins = <28 29 30 31>; -+ brcm,function = <6>; /* alt2 */ -+ }; -+}; -+ -+&sdhost { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&sdhost_pins>; -+ bus-width = <4>; -+ status = "okay"; -+}; -+ -+&fb { -+ status = "okay"; -+}; -+ -+&uart0 { -+ status = "okay"; -+}; -+ -+&spi0 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&spi0_pins &spi0_cs_pins>; -+ cs-gpios = <&gpio 8 1>, <&gpio 7 1>; -+ -+ spidev@0{ -+ compatible = "spidev"; -+ reg = <0>; /* CE0 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; -+ }; -+ -+ spidev@1{ -+ compatible = "spidev"; -+ reg = <1>; /* CE1 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; -+ }; -+}; -+ -+&i2c0 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&i2c0_pins>; -+ clock-frequency = <100000>; -+}; -+ -+&i2c1 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&i2c1_pins>; -+ clock-frequency = <100000>; -+}; -+ -+&i2c2 { -+ clock-frequency = <100000>; -+}; -+ -+&i2s { -+ #sound-dai-cells = <0>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&i2s_pins>; -+}; -+ -+&random { -+ status = "okay"; -+}; -+ -+&leds { -+ act_led: act { -+ label = "led0"; -+ linux,default-trigger = "mmc0"; -+ gpios = <&gpio 16 1>; -+ }; -+}; -+ -+/ { -+ __overrides__ { -+ uart0 = <&uart0>,"status"; -+ uart0_clkrate = <&clk_uart0>,"clock-frequency:0"; -+ i2s = <&i2s>,"status"; -+ spi = <&spi0>,"status"; -+ i2c0 = <&i2c0>,"status"; -+ i2c1 = <&i2c1>,"status"; -+ i2c2_iknowwhatimdoing = <&i2c2>,"status"; -+ i2c0_baudrate = <&i2c0>,"clock-frequency:0"; -+ i2c1_baudrate = <&i2c1>,"clock-frequency:0"; -+ i2c2_baudrate = <&i2c2>,"clock-frequency:0"; -+ core_freq = <&clk_core>,"clock-frequency:0"; -+ -+ act_led_gpio = <&act_led>,"gpios:4"; -+ act_led_activelow = <&act_led>,"gpios:8"; -+ act_led_trigger = <&act_led>,"linux,default-trigger"; -+ -+ audio = <&audio>,"status"; -+ watchdog = <&watchdog>,"status"; -+ random = <&random>,"status"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/bcm2708-rpi-cm.dts b/arch/arm/boot/dts/bcm2708-rpi-cm.dts -new file mode 100755 -index 0000000..87c1a54 ---- /dev/null -+++ b/arch/arm/boot/dts/bcm2708-rpi-cm.dts -@@ -0,0 +1,102 @@ -+/dts-v1/; -+ -+#include "bcm2708-rpi-cm.dtsi" -+ -+/ { -+ model = "Raspberry Pi Compute Module"; -+}; -+ -+&uart0 { -+ status = "okay"; -+}; -+ -+&gpio { -+ spi0_pins: spi0_pins { -+ brcm,pins = <9 10 11>; -+ brcm,function = <4>; /* alt0 */ -+ }; -+ -+ spi0_cs_pins: spi0_cs_pins { -+ brcm,pins = <8 7>; -+ brcm,function = <1>; /* output */ -+ }; -+ -+ i2c0_pins: i2c0 { -+ brcm,pins = <0 1>; -+ brcm,function = <4>; -+ }; -+ -+ i2c1_pins: i2c1 { -+ brcm,pins = <2 3>; -+ brcm,function = <4>; -+ }; ++ 174, 174, 174, 174, 174, 174, 174, 174, 175, 175, ++ 175, 175, 175, 175, 175, 175, 176, 120, 176, 177, ++ 119, 177, 177, 118, 177, 177, 178, 178, 178, 178, ++ 178, 178, 178, 178, 179, 179, 179, 179, 179, 179, ++ 179, 179, 116, 115, 113, 112, 111, 110, 109, 108, ++ 107, 106, 105, 104, 103, 101, 100, 98, 97, 96, ++ 95, 94, 92, 90, 88, 87, 86, 84, 83, 82, ++ 81, 80, 79, 78, 77, 75, 73, 70, 69, 67, ++ 64, 62, 61, 57, 51, 50, 49, 47, 46, 45, + 41, 38, 22, 21, 19, 13, 9, 6, 4, 2, +- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, + +- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, +- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, +- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, +- 158, 158, 158, 158, 158, 158, 158 ++ 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, ++ 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, ++ 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, ++ 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, ++ 165, 165, 165, 165, 165, 165, 165, 165 + } ; + + static yy_state_type yy_last_accepting_state; +@@ -662,7 +664,7 @@ static int dts_version = 1; + static void push_input_file(const char *filename); + static bool pop_input_file(void); + static void lexical_error(const char *fmt, ...); +-#line 666 "dtc-lexer.lex.c" ++#line 668 "dtc-lexer.lex.c" + + #define INITIAL 0 + #define BYTESTRING 1 +@@ -704,7 +706,7 @@ FILE *yyget_out (void ); + + void yyset_out (FILE * out_str ); + +-yy_size_t yyget_leng (void ); ++int yyget_leng (void ); + + char *yyget_text (void ); + +@@ -853,6 +855,10 @@ YY_DECL + register char *yy_cp, *yy_bp; + register int yy_act; + ++#line 68 "dtc-lexer.l" + -+ i2s_pins: i2s { -+ brcm,pins = <18 19 20 21>; -+ brcm,function = <4>; /* alt0 */ -+ }; -+}; ++#line 861 "dtc-lexer.lex.c" + -+&spi0 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&spi0_pins &spi0_cs_pins>; -+ cs-gpios = <&gpio 8 1>, <&gpio 7 1>; + if ( !(yy_init) ) + { + (yy_init) = 1; +@@ -879,11 +885,6 @@ YY_DECL + yy_load_buffer_state( ); + } + +- { +-#line 68 "dtc-lexer.l" +- +-#line 886 "dtc-lexer.lex.c" +- + while ( 1 ) /* loops until end-of-file is reached */ + { + yy_cp = (yy_c_buf_p); +@@ -901,7 +902,7 @@ YY_DECL + yy_match: + do + { +- register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ; ++ register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; +@@ -910,13 +911,13 @@ yy_match: + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; +- if ( yy_current_state >= 159 ) ++ if ( yy_current_state >= 166 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + ++yy_cp; + } +- while ( yy_current_state != 158 ); ++ while ( yy_current_state != 165 ); + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + +@@ -951,39 +952,31 @@ case 2: + YY_RULE_SETUP + #line 75 "dtc-lexer.l" + { +- char *line, *fnstart, *fnend; +- struct data fn; ++ char *line, *tmp, *fn; + /* skip text before line # */ + line = yytext; + while (!isdigit((unsigned char)*line)) + line++; +- +- /* regexp ensures that first and list " +- * in the whole yytext are those at +- * beginning and end of the filename string */ +- fnstart = memchr(yytext, '"', yyleng); +- for (fnend = yytext + yyleng - 1; +- *fnend != '"'; fnend--) +- ; +- assert(fnstart && fnend && (fnend > fnstart)); +- +- fn = data_copy_escape_string(fnstart + 1, +- fnend - fnstart - 1); +- +- /* Don't allow nuls in filenames */ +- if (memchr(fn.val, '\0', fn.len - 1)) +- lexical_error("nul in line number directive"); +- ++ /* skip digits in line # */ ++ tmp = line; ++ while (!isspace((unsigned char)*tmp)) ++ tmp++; ++ /* "NULL"-terminate line # */ ++ *tmp = '\0'; ++ /* start of filename */ ++ fn = strchr(tmp + 1, '"') + 1; ++ /* strip trailing " from filename */ ++ tmp = strchr(fn, '"'); ++ *tmp = 0; + /* -1 since #line is the number of the next line */ +- srcpos_set_line(xstrdup(fn.val), atoi(line) - 1); +- data_free(fn); ++ srcpos_set_line(xstrdup(fn), atoi(line) - 1); + } + YY_BREAK + case YY_STATE_EOF(INITIAL): + case YY_STATE_EOF(BYTESTRING): + case YY_STATE_EOF(PROPNODENAME): + case YY_STATE_EOF(V1): +-#line 104 "dtc-lexer.l" ++#line 96 "dtc-lexer.l" + { + if (!pop_input_file()) { + yyterminate(); +@@ -993,7 +986,7 @@ case YY_STATE_EOF(V1): + case 3: + /* rule 3 can match eol */ + YY_RULE_SETUP +-#line 110 "dtc-lexer.l" ++#line 102 "dtc-lexer.l" + { + DPRINT("String: %s\n", yytext); + yylval.data = data_copy_escape_string(yytext+1, +@@ -1003,7 +996,7 @@ YY_RULE_SETUP + YY_BREAK + case 4: + YY_RULE_SETUP +-#line 117 "dtc-lexer.l" ++#line 109 "dtc-lexer.l" + { + DPRINT("Keyword: /dts-v1/\n"); + dts_version = 1; +@@ -1013,25 +1006,33 @@ YY_RULE_SETUP + YY_BREAK + case 5: + YY_RULE_SETUP +-#line 124 "dtc-lexer.l" ++#line 116 "dtc-lexer.l" ++{ ++ DPRINT("Keyword: /plugin/\n"); ++ return DT_PLUGIN; ++ } ++ YY_BREAK ++case 6: ++YY_RULE_SETUP ++#line 121 "dtc-lexer.l" + { + DPRINT("Keyword: /memreserve/\n"); + BEGIN_DEFAULT(); + return DT_MEMRESERVE; + } + YY_BREAK +-case 6: ++case 7: + YY_RULE_SETUP +-#line 130 "dtc-lexer.l" ++#line 127 "dtc-lexer.l" + { + DPRINT("Keyword: /bits/\n"); + BEGIN_DEFAULT(); + return DT_BITS; + } + YY_BREAK +-case 7: ++case 8: + YY_RULE_SETUP +-#line 136 "dtc-lexer.l" ++#line 133 "dtc-lexer.l" + { + DPRINT("Keyword: /delete-property/\n"); + DPRINT("<PROPNODENAME>\n"); +@@ -1039,9 +1040,9 @@ YY_RULE_SETUP + return DT_DEL_PROP; + } + YY_BREAK +-case 8: ++case 9: + YY_RULE_SETUP +-#line 143 "dtc-lexer.l" ++#line 140 "dtc-lexer.l" + { + DPRINT("Keyword: /delete-node/\n"); + DPRINT("<PROPNODENAME>\n"); +@@ -1049,9 +1050,9 @@ YY_RULE_SETUP + return DT_DEL_NODE; + } + YY_BREAK +-case 9: ++case 10: + YY_RULE_SETUP +-#line 150 "dtc-lexer.l" ++#line 147 "dtc-lexer.l" + { + DPRINT("Label: %s\n", yytext); + yylval.labelref = xstrdup(yytext); +@@ -1059,9 +1060,9 @@ YY_RULE_SETUP + return DT_LABEL; + } + YY_BREAK +-case 10: ++case 11: + YY_RULE_SETUP +-#line 157 "dtc-lexer.l" ++#line 154 "dtc-lexer.l" + { + char *e; + DPRINT("Integer Literal: '%s'\n", yytext); +@@ -1069,10 +1070,7 @@ YY_RULE_SETUP + errno = 0; + yylval.integer = strtoull(yytext, &e, 0); + +- if (*e && e[strspn(e, "UL")]) { +- lexical_error("Bad integer literal '%s'", +- yytext); +- } ++ assert(!(*e) || !e[strspn(e, "UL")]); + + if (errno == ERANGE) + lexical_error("Integer literal '%s' out of range", +@@ -1084,10 +1082,10 @@ YY_RULE_SETUP + return DT_LITERAL; + } + YY_BREAK +-case 11: +-/* rule 11 can match eol */ ++case 12: ++/* rule 12 can match eol */ + YY_RULE_SETUP +-#line 179 "dtc-lexer.l" ++#line 173 "dtc-lexer.l" + { + struct data d; + DPRINT("Character literal: %s\n", yytext); +@@ -1109,18 +1107,18 @@ YY_RULE_SETUP + return DT_CHAR_LITERAL; + } + YY_BREAK +-case 12: ++case 13: + YY_RULE_SETUP +-#line 200 "dtc-lexer.l" ++#line 194 "dtc-lexer.l" + { /* label reference */ + DPRINT("Ref: %s\n", yytext+1); + yylval.labelref = xstrdup(yytext+1); + return DT_REF; + } + YY_BREAK +-case 13: ++case 14: + YY_RULE_SETUP +-#line 206 "dtc-lexer.l" ++#line 200 "dtc-lexer.l" + { /* new-style path reference */ + yytext[yyleng-1] = '\0'; + DPRINT("Ref: %s\n", yytext+2); +@@ -1128,27 +1126,27 @@ YY_RULE_SETUP + return DT_REF; + } + YY_BREAK +-case 14: ++case 15: + YY_RULE_SETUP +-#line 213 "dtc-lexer.l" ++#line 207 "dtc-lexer.l" + { + yylval.byte = strtol(yytext, NULL, 16); + DPRINT("Byte: %02x\n", (int)yylval.byte); + return DT_BYTE; + } + YY_BREAK +-case 15: ++case 16: + YY_RULE_SETUP +-#line 219 "dtc-lexer.l" ++#line 213 "dtc-lexer.l" + { + DPRINT("/BYTESTRING\n"); + BEGIN_DEFAULT(); + return ']'; + } + YY_BREAK +-case 16: ++case 17: + YY_RULE_SETUP +-#line 225 "dtc-lexer.l" ++#line 219 "dtc-lexer.l" + { + DPRINT("PropNodeName: %s\n", yytext); + yylval.propnodename = xstrdup((yytext[0] == '\\') ? +@@ -1157,75 +1155,75 @@ YY_RULE_SETUP + return DT_PROPNODENAME; + } + YY_BREAK +-case 17: ++case 18: + YY_RULE_SETUP +-#line 233 "dtc-lexer.l" ++#line 227 "dtc-lexer.l" + { + DPRINT("Binary Include\n"); + return DT_INCBIN; + } + YY_BREAK +-case 18: +-/* rule 18 can match eol */ +-YY_RULE_SETUP +-#line 238 "dtc-lexer.l" +-/* eat whitespace */ +- YY_BREAK + case 19: + /* rule 19 can match eol */ + YY_RULE_SETUP +-#line 239 "dtc-lexer.l" +-/* eat C-style comments */ ++#line 232 "dtc-lexer.l" ++/* eat whitespace */ + YY_BREAK + case 20: + /* rule 20 can match eol */ + YY_RULE_SETUP +-#line 240 "dtc-lexer.l" +-/* eat C++-style comments */ ++#line 233 "dtc-lexer.l" ++/* eat C-style comments */ + YY_BREAK + case 21: ++/* rule 21 can match eol */ + YY_RULE_SETUP +-#line 242 "dtc-lexer.l" +-{ return DT_LSHIFT; }; ++#line 234 "dtc-lexer.l" ++/* eat C++-style comments */ + YY_BREAK + case 22: + YY_RULE_SETUP +-#line 243 "dtc-lexer.l" +-{ return DT_RSHIFT; }; ++#line 236 "dtc-lexer.l" ++{ return DT_LSHIFT; }; + YY_BREAK + case 23: + YY_RULE_SETUP +-#line 244 "dtc-lexer.l" +-{ return DT_LE; }; ++#line 237 "dtc-lexer.l" ++{ return DT_RSHIFT; }; + YY_BREAK + case 24: + YY_RULE_SETUP +-#line 245 "dtc-lexer.l" +-{ return DT_GE; }; ++#line 238 "dtc-lexer.l" ++{ return DT_LE; }; + YY_BREAK + case 25: + YY_RULE_SETUP +-#line 246 "dtc-lexer.l" +-{ return DT_EQ; }; ++#line 239 "dtc-lexer.l" ++{ return DT_GE; }; + YY_BREAK + case 26: + YY_RULE_SETUP +-#line 247 "dtc-lexer.l" +-{ return DT_NE; }; ++#line 240 "dtc-lexer.l" ++{ return DT_EQ; }; + YY_BREAK + case 27: + YY_RULE_SETUP +-#line 248 "dtc-lexer.l" +-{ return DT_AND; }; ++#line 241 "dtc-lexer.l" ++{ return DT_NE; }; + YY_BREAK + case 28: + YY_RULE_SETUP +-#line 249 "dtc-lexer.l" +-{ return DT_OR; }; ++#line 242 "dtc-lexer.l" ++{ return DT_AND; }; + YY_BREAK + case 29: + YY_RULE_SETUP +-#line 251 "dtc-lexer.l" ++#line 243 "dtc-lexer.l" ++{ return DT_OR; }; ++ YY_BREAK ++case 30: ++YY_RULE_SETUP ++#line 245 "dtc-lexer.l" + { + DPRINT("Char: %c (\\x%02x)\n", yytext[0], + (unsigned)yytext[0]); +@@ -1241,12 +1239,12 @@ YY_RULE_SETUP + return yytext[0]; + } + YY_BREAK +-case 30: ++case 31: + YY_RULE_SETUP +-#line 266 "dtc-lexer.l" ++#line 260 "dtc-lexer.l" + ECHO; + YY_BREAK +-#line 1250 "dtc-lexer.lex.c" ++#line 1248 "dtc-lexer.lex.c" + + case YY_END_OF_BUFFER: + { +@@ -1376,7 +1374,6 @@ ECHO; + "fatal flex scanner internal error--no action found" ); + } /* end of action switch */ + } /* end of scanning one token */ +- } /* end of user's declarations */ + } /* end of yylex */ + + /* yy_get_next_buffer - try to read in a new buffer +@@ -1432,21 +1429,21 @@ static int yy_get_next_buffer (void) + + else + { +- yy_size_t num_to_read = ++ int num_to_read = + YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; + + while ( num_to_read <= 0 ) + { /* Not enough room in the buffer - grow it. */ + + /* just a shorter name for the current buffer */ +- YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE; ++ YY_BUFFER_STATE b = YY_CURRENT_BUFFER; + + int yy_c_buf_p_offset = + (int) ((yy_c_buf_p) - b->yy_ch_buf); + + if ( b->yy_is_our_buffer ) + { +- yy_size_t new_size = b->yy_buf_size * 2; ++ int new_size = b->yy_buf_size * 2; + + if ( new_size <= 0 ) + b->yy_buf_size += b->yy_buf_size / 8; +@@ -1477,7 +1474,7 @@ static int yy_get_next_buffer (void) + + /* Read in more data. */ + YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), +- (yy_n_chars), num_to_read ); ++ (yy_n_chars), (size_t) num_to_read ); + + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } +@@ -1539,7 +1536,7 @@ static int yy_get_next_buffer (void) + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; +- if ( yy_current_state >= 159 ) ++ if ( yy_current_state >= 166 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; +@@ -1567,13 +1564,13 @@ static int yy_get_next_buffer (void) + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; +- if ( yy_current_state >= 159 ) ++ if ( yy_current_state >= 166 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; +- yy_is_jam = (yy_current_state == 158); ++ yy_is_jam = (yy_current_state == 165); + +- return yy_is_jam ? 0 : yy_current_state; ++ return yy_is_jam ? 0 : yy_current_state; + } + + #ifndef YY_NO_INPUT +@@ -1600,7 +1597,7 @@ static int yy_get_next_buffer (void) + + else + { /* need more input */ +- yy_size_t offset = (yy_c_buf_p) - (yytext_ptr); ++ int offset = (yy_c_buf_p) - (yytext_ptr); + ++(yy_c_buf_p); + + switch ( yy_get_next_buffer( ) ) +@@ -1874,7 +1871,7 @@ void yypop_buffer_state (void) + */ + static void yyensure_buffer_stack (void) + { +- yy_size_t num_to_alloc; ++ int num_to_alloc; + + if (!(yy_buffer_stack)) { + +@@ -1971,12 +1968,12 @@ YY_BUFFER_STATE yy_scan_string (yyconst char * yystr ) + * + * @return the newly allocated buffer state object. + */ +-YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len ) ++YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, int _yybytes_len ) + { + YY_BUFFER_STATE b; + char *buf; + yy_size_t n; +- yy_size_t i; ++ int i; + + /* Get memory for full buffer, including space for trailing EOB's. */ + n = _yybytes_len + 2; +@@ -2058,7 +2055,7 @@ FILE *yyget_out (void) + /** Get the length of the current token. + * + */ +-yy_size_t yyget_leng (void) ++int yyget_leng (void) + { + return yyleng; + } +@@ -2206,7 +2203,7 @@ void yyfree (void * ptr ) + + #define YYTABLES_NAME "yytables" + +-#line 265 "dtc-lexer.l" ++#line 260 "dtc-lexer.l" + + + +diff --git a/scripts/dtc/dtc-parser.tab.c_shipped b/scripts/dtc/dtc-parser.tab.c_shipped +index 31cec50..844c462 100644 +--- a/scripts/dtc/dtc-parser.tab.c_shipped ++++ b/scripts/dtc/dtc-parser.tab.c_shipped +@@ -65,6 +65,7 @@ + #line 20 "dtc-parser.y" /* yacc.c:339 */ + + #include <stdio.h> ++#include <inttypes.h> + + #include "dtc.h" + #include "srcpos.h" +@@ -80,7 +81,7 @@ extern void yyerror(char const *s); + extern struct boot_info *the_boot_info; + extern bool treesource_error; + +-#line 84 "dtc-parser.tab.c" /* yacc.c:339 */ ++#line 85 "dtc-parser.tab.c" /* yacc.c:339 */ + + # ifndef YY_NULLPTR + # if defined __cplusplus && 201103L <= __cplusplus +@@ -116,26 +117,27 @@ extern int yydebug; + enum yytokentype + { + DT_V1 = 258, +- DT_MEMRESERVE = 259, +- DT_LSHIFT = 260, +- DT_RSHIFT = 261, +- DT_LE = 262, +- DT_GE = 263, +- DT_EQ = 264, +- DT_NE = 265, +- DT_AND = 266, +- DT_OR = 267, +- DT_BITS = 268, +- DT_DEL_PROP = 269, +- DT_DEL_NODE = 270, +- DT_PROPNODENAME = 271, +- DT_LITERAL = 272, +- DT_CHAR_LITERAL = 273, +- DT_BYTE = 274, +- DT_STRING = 275, +- DT_LABEL = 276, +- DT_REF = 277, +- DT_INCBIN = 278 ++ DT_PLUGIN = 259, ++ DT_MEMRESERVE = 260, ++ DT_LSHIFT = 261, ++ DT_RSHIFT = 262, ++ DT_LE = 263, ++ DT_GE = 264, ++ DT_EQ = 265, ++ DT_NE = 266, ++ DT_AND = 267, ++ DT_OR = 268, ++ DT_BITS = 269, ++ DT_DEL_PROP = 270, ++ DT_DEL_NODE = 271, ++ DT_PROPNODENAME = 272, ++ DT_LITERAL = 273, ++ DT_CHAR_LITERAL = 274, ++ DT_BYTE = 275, ++ DT_STRING = 276, ++ DT_LABEL = 277, ++ DT_REF = 278, ++ DT_INCBIN = 279 + }; + #endif + +@@ -144,7 +146,7 @@ extern int yydebug; + typedef union YYSTYPE YYSTYPE; + union YYSTYPE + { +-#line 38 "dtc-parser.y" /* yacc.c:355 */ ++#line 39 "dtc-parser.y" /* yacc.c:355 */ + + char *propnodename; + char *labelref; +@@ -162,8 +164,9 @@ union YYSTYPE + struct node *nodelist; + struct reserve_info *re; + uint64_t integer; ++ bool is_plugin; + +-#line 167 "dtc-parser.tab.c" /* yacc.c:355 */ ++#line 170 "dtc-parser.tab.c" /* yacc.c:355 */ + }; + # define YYSTYPE_IS_TRIVIAL 1 + # define YYSTYPE_IS_DECLARED 1 +@@ -192,7 +195,7 @@ int yyparse (void); + + /* Copy the second part of user declarations. */ + +-#line 196 "dtc-parser.tab.c" /* yacc.c:358 */ ++#line 199 "dtc-parser.tab.c" /* yacc.c:358 */ + + #ifdef short + # undef short +@@ -439,18 +442,18 @@ union yyalloc + #define YYLAST 136 + + /* YYNTOKENS -- Number of terminals. */ +-#define YYNTOKENS 47 ++#define YYNTOKENS 48 + /* YYNNTS -- Number of nonterminals. */ +-#define YYNNTS 28 ++#define YYNNTS 29 + /* YYNRULES -- Number of rules. */ +-#define YYNRULES 80 ++#define YYNRULES 82 + /* YYNSTATES -- Number of states. */ +-#define YYNSTATES 144 ++#define YYNSTATES 147 + + /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned + by yylex, with out-of-bounds checking. */ + #define YYUNDEFTOK 2 +-#define YYMAXUTOK 278 ++#define YYMAXUTOK 279 + + #define YYTRANSLATE(YYX) \ + ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) +@@ -462,16 +465,16 @@ static const yytype_uint8 yytranslate[] = + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +- 2, 2, 2, 46, 2, 2, 2, 44, 40, 2, +- 32, 34, 43, 41, 33, 42, 2, 25, 2, 2, +- 2, 2, 2, 2, 2, 2, 2, 2, 37, 24, +- 35, 28, 29, 36, 2, 2, 2, 2, 2, 2, ++ 2, 2, 2, 47, 2, 2, 2, 45, 41, 2, ++ 33, 35, 44, 42, 34, 43, 2, 26, 2, 2, ++ 2, 2, 2, 2, 2, 2, 2, 2, 38, 25, ++ 36, 29, 30, 37, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +- 2, 30, 2, 31, 39, 2, 2, 2, 2, 2, ++ 2, 31, 2, 32, 40, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +- 2, 2, 2, 26, 38, 27, 45, 2, 2, 2, ++ 2, 2, 2, 27, 39, 28, 46, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +@@ -486,22 +489,22 @@ static const yytype_uint8 yytranslate[] = + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, + 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, +- 15, 16, 17, 18, 19, 20, 21, 22, 23 ++ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24 + }; + + #if YYDEBUG + /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ + static const yytype_uint16 yyrline[] = + { +- 0, 104, 104, 113, 116, 123, 127, 135, 139, 144, +- 155, 165, 180, 188, 191, 198, 202, 206, 210, 218, +- 222, 226, 230, 234, 250, 260, 268, 271, 275, 282, +- 298, 303, 322, 336, 343, 344, 345, 352, 356, 357, +- 361, 362, 366, 367, 371, 372, 376, 377, 381, 382, +- 386, 387, 388, 392, 393, 394, 395, 396, 400, 401, +- 402, 406, 407, 408, 412, 413, 422, 431, 435, 436, +- 437, 438, 443, 446, 450, 458, 461, 465, 473, 477, +- 481 ++ 0, 108, 108, 118, 121, 129, 132, 139, 143, 151, ++ 155, 160, 171, 181, 196, 204, 207, 214, 218, 222, ++ 226, 234, 238, 242, 246, 250, 266, 276, 284, 287, ++ 291, 298, 314, 319, 338, 352, 359, 360, 361, 368, ++ 372, 373, 377, 378, 382, 383, 387, 388, 392, 393, ++ 397, 398, 402, 403, 404, 408, 409, 410, 411, 412, ++ 416, 417, 418, 422, 423, 424, 428, 429, 430, 431, ++ 435, 436, 437, 438, 443, 446, 450, 458, 461, 465, ++ 473, 477, 481 + }; + #endif + +@@ -510,19 +513,19 @@ static const yytype_uint16 yyrline[] = + First, the terminals, then, starting at YYNTOKENS, nonterminals. */ + static const char *const yytname[] = + { +- "$end", "error", "$undefined", "DT_V1", "DT_MEMRESERVE", "DT_LSHIFT", +- "DT_RSHIFT", "DT_LE", "DT_GE", "DT_EQ", "DT_NE", "DT_AND", "DT_OR", +- "DT_BITS", "DT_DEL_PROP", "DT_DEL_NODE", "DT_PROPNODENAME", "DT_LITERAL", +- "DT_CHAR_LITERAL", "DT_BYTE", "DT_STRING", "DT_LABEL", "DT_REF", +- "DT_INCBIN", "';'", "'/'", "'{'", "'}'", "'='", "'>'", "'['", "']'", +- "'('", "','", "')'", "'<'", "'?'", "':'", "'|'", "'^'", "'&'", "'+'", +- "'-'", "'*'", "'%'", "'~'", "'!'", "$accept", "sourcefile", +- "memreserves", "memreserve", "devicetree", "nodedef", "proplist", +- "propdef", "propdata", "propdataprefix", "arrayprefix", "integer_prim", +- "integer_expr", "integer_trinary", "integer_or", "integer_and", +- "integer_bitor", "integer_bitxor", "integer_bitand", "integer_eq", +- "integer_rela", "integer_shift", "integer_add", "integer_mul", +- "integer_unary", "bytestring", "subnodes", "subnode", YY_NULLPTR ++ "$end", "error", "$undefined", "DT_V1", "DT_PLUGIN", "DT_MEMRESERVE", ++ "DT_LSHIFT", "DT_RSHIFT", "DT_LE", "DT_GE", "DT_EQ", "DT_NE", "DT_AND", ++ "DT_OR", "DT_BITS", "DT_DEL_PROP", "DT_DEL_NODE", "DT_PROPNODENAME", ++ "DT_LITERAL", "DT_CHAR_LITERAL", "DT_BYTE", "DT_STRING", "DT_LABEL", ++ "DT_REF", "DT_INCBIN", "';'", "'/'", "'{'", "'}'", "'='", "'>'", "'['", ++ "']'", "'('", "','", "')'", "'<'", "'?'", "':'", "'|'", "'^'", "'&'", ++ "'+'", "'-'", "'*'", "'%'", "'~'", "'!'", "$accept", "sourcefile", ++ "plugindecl", "memreserves", "memreserve", "devicetree", "nodedef", ++ "proplist", "propdef", "propdata", "propdataprefix", "arrayprefix", ++ "integer_prim", "integer_expr", "integer_trinary", "integer_or", ++ "integer_and", "integer_bitor", "integer_bitxor", "integer_bitand", ++ "integer_eq", "integer_rela", "integer_shift", "integer_add", ++ "integer_mul", "integer_unary", "bytestring", "subnodes", "subnode", YY_NULLPTR + }; + #endif + +@@ -533,16 +536,16 @@ static const yytype_uint16 yytoknum[] = + { + 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, + 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, +- 275, 276, 277, 278, 59, 47, 123, 125, 61, 62, +- 91, 93, 40, 44, 41, 60, 63, 58, 124, 94, +- 38, 43, 45, 42, 37, 126, 33 ++ 275, 276, 277, 278, 279, 59, 47, 123, 125, 61, ++ 62, 91, 93, 40, 44, 41, 60, 63, 58, 124, ++ 94, 38, 43, 45, 42, 37, 126, 33 + }; + # endif + +-#define YYPACT_NINF -81 ++#define YYPACT_NINF -84 + + #define yypact_value_is_default(Yystate) \ +- (!!((Yystate) == (-81))) ++ (!!((Yystate) == (-84))) + + #define YYTABLE_NINF -1 + +@@ -553,21 +556,21 @@ static const yytype_uint16 yytoknum[] = + STATE-NUM. */ + static const yytype_int8 yypact[] = + { +- 16, -11, 21, 10, -81, 25, 10, 19, 10, -81, +- -81, -9, 25, -81, 2, 51, -81, -9, -9, -9, +- -81, 1, -81, -6, 50, 14, 28, 29, 36, 3, +- 58, 44, -3, -81, 47, -81, -81, 65, 68, 2, +- 2, -81, -81, -81, -81, -9, -9, -9, -9, -9, +- -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, +- -9, -9, -9, -9, -81, 63, 69, 2, -81, -81, +- 50, 57, 14, 28, 29, 36, 3, 3, 58, 58, +- 58, 58, 44, 44, -3, -3, -81, -81, -81, 79, +- 80, -8, 63, -81, 72, 63, -81, -81, -9, 76, +- 77, -81, -81, -81, -81, -81, 78, -81, -81, -81, +- -81, -81, 35, 4, -81, -81, -81, -81, 86, -81, +- -81, -81, 73, -81, -81, 33, 71, 84, 39, -81, +- -81, -81, -81, -81, 41, -81, -81, -81, 25, -81, +- 74, 25, 75, -81 ++ 15, -12, 35, 42, -84, 27, 9, -84, 24, 9, ++ 43, 9, -84, -84, -10, 24, -84, 60, 44, -84, ++ -10, -10, -10, -84, 55, -84, -7, 52, 53, 51, ++ 54, 10, 2, 38, 37, -4, -84, 68, -84, -84, ++ 71, 73, 60, 60, -84, -84, -84, -84, -10, -10, ++ -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, ++ -10, -10, -10, -10, -10, -10, -10, -84, 56, 72, ++ 60, -84, -84, 52, 61, 53, 51, 54, 10, 2, ++ 2, 38, 38, 38, 38, 37, 37, -4, -4, -84, ++ -84, -84, 81, 83, 34, 56, -84, 74, 56, -84, ++ -84, -10, 76, 78, -84, -84, -84, -84, -84, 79, ++ -84, -84, -84, -84, -84, -6, 3, -84, -84, -84, ++ -84, 87, -84, -84, -84, 75, -84, -84, 32, 70, ++ 86, 36, -84, -84, -84, -84, -84, 47, -84, -84, ++ -84, 24, -84, 77, 24, 80, -84 + }; + + /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. +@@ -575,37 +578,37 @@ static const yytype_int8 yypact[] = + means the default is an error. */ + static const yytype_uint8 yydefact[] = + { +- 0, 0, 0, 3, 1, 0, 0, 0, 3, 34, +- 35, 0, 0, 6, 0, 2, 4, 0, 0, 0, +- 68, 0, 37, 38, 40, 42, 44, 46, 48, 50, +- 53, 60, 63, 67, 0, 13, 7, 0, 0, 0, +- 0, 69, 70, 71, 36, 0, 0, 0, 0, 0, ++ 0, 0, 0, 3, 1, 0, 5, 4, 0, 0, ++ 0, 5, 36, 37, 0, 0, 8, 0, 2, 6, ++ 0, 0, 0, 70, 0, 39, 40, 42, 44, 46, ++ 48, 50, 52, 55, 62, 65, 69, 0, 15, 9, ++ 0, 0, 0, 0, 71, 72, 73, 38, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +- 0, 0, 0, 0, 5, 75, 0, 0, 10, 8, +- 41, 0, 43, 45, 47, 49, 51, 52, 56, 57, +- 55, 54, 58, 59, 61, 62, 65, 64, 66, 0, +- 0, 0, 0, 14, 0, 75, 11, 9, 0, 0, +- 0, 16, 26, 78, 18, 80, 0, 77, 76, 39, +- 17, 79, 0, 0, 12, 25, 15, 27, 0, 19, +- 28, 22, 0, 72, 30, 0, 0, 0, 0, 33, +- 32, 20, 31, 29, 0, 73, 74, 21, 0, 24, +- 0, 0, 0, 23 ++ 0, 0, 0, 0, 0, 0, 0, 7, 77, 0, ++ 0, 12, 10, 43, 0, 45, 47, 49, 51, 53, ++ 54, 58, 59, 57, 56, 60, 61, 63, 64, 67, ++ 66, 68, 0, 0, 0, 0, 16, 0, 77, 13, ++ 11, 0, 0, 0, 18, 28, 80, 20, 82, 0, ++ 79, 78, 41, 19, 81, 0, 0, 14, 27, 17, ++ 29, 0, 21, 30, 24, 0, 74, 32, 0, 0, ++ 0, 0, 35, 34, 22, 33, 31, 0, 75, 76, ++ 23, 0, 26, 0, 0, 0, 25 + }; + + /* YYPGOTO[NTERM-NUM]. */ + static const yytype_int8 yypgoto[] = + { +- -81, -81, 100, 104, -81, -38, -81, -80, -81, -81, +- -81, -5, 66, 13, -81, 70, 67, 81, 64, 82, +- 37, 27, 34, 38, -14, -81, 22, 24 ++ -84, -84, -84, 98, 101, -84, -41, -84, -83, -84, ++ -84, -84, -8, 63, 12, -84, 66, 67, 65, 69, ++ 82, 29, 18, 25, 26, -17, -84, 20, 28 + }; + + /* YYDEFGOTO[NTERM-NUM]. */ + static const yytype_int16 yydefgoto[] = + { +- -1, 2, 7, 8, 15, 36, 65, 93, 112, 113, +- 125, 20, 21, 22, 23, 24, 25, 26, 27, 28, +- 29, 30, 31, 32, 33, 128, 94, 95 ++ -1, 2, 6, 10, 11, 18, 39, 68, 96, 115, ++ 116, 128, 23, 24, 25, 26, 27, 28, 29, 30, ++ 31, 32, 33, 34, 35, 36, 131, 97, 98 + }; + + /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If +@@ -613,87 +616,87 @@ static const yytype_int16 yydefgoto[] = + number is the opposite. If YYTABLE_NINF, syntax error. */ + static const yytype_uint8 yytable[] = + { +- 12, 68, 69, 41, 42, 43, 45, 34, 9, 10, +- 53, 54, 104, 3, 5, 107, 101, 118, 35, 1, +- 102, 4, 61, 11, 119, 120, 121, 122, 35, 97, +- 46, 6, 55, 17, 123, 44, 18, 19, 56, 124, +- 62, 63, 9, 10, 14, 51, 52, 86, 87, 88, +- 9, 10, 48, 103, 129, 130, 115, 11, 135, 116, +- 136, 47, 131, 57, 58, 11, 37, 49, 117, 50, +- 137, 64, 38, 39, 138, 139, 40, 89, 90, 91, +- 78, 79, 80, 81, 92, 59, 60, 66, 76, 77, +- 67, 82, 83, 96, 98, 99, 100, 84, 85, 106, +- 110, 111, 114, 126, 134, 127, 133, 141, 16, 143, +- 13, 109, 71, 74, 72, 70, 105, 108, 0, 0, +- 132, 0, 0, 0, 0, 0, 0, 0, 0, 73, +- 0, 0, 75, 140, 0, 0, 142 ++ 15, 71, 72, 44, 45, 46, 48, 37, 12, 13, ++ 56, 57, 107, 3, 8, 110, 118, 121, 1, 119, ++ 54, 55, 64, 14, 122, 123, 124, 125, 120, 100, ++ 49, 9, 58, 20, 126, 4, 21, 22, 59, 127, ++ 65, 66, 12, 13, 60, 61, 5, 89, 90, 91, ++ 12, 13, 7, 106, 132, 133, 138, 14, 139, 104, ++ 40, 38, 134, 105, 50, 14, 41, 42, 140, 17, ++ 43, 92, 93, 94, 81, 82, 83, 84, 95, 62, ++ 63, 141, 142, 79, 80, 85, 86, 38, 87, 88, ++ 47, 52, 51, 67, 69, 53, 70, 99, 102, 101, ++ 103, 113, 109, 114, 117, 129, 136, 137, 130, 19, ++ 16, 144, 74, 112, 73, 146, 76, 75, 111, 0, ++ 135, 77, 0, 108, 0, 0, 0, 0, 0, 0, ++ 0, 0, 0, 143, 0, 78, 145 + }; + + static const yytype_int16 yycheck[] = + { +- 5, 39, 40, 17, 18, 19, 12, 12, 17, 18, +- 7, 8, 92, 24, 4, 95, 24, 13, 26, 3, +- 28, 0, 25, 32, 20, 21, 22, 23, 26, 67, +- 36, 21, 29, 42, 30, 34, 45, 46, 35, 35, +- 43, 44, 17, 18, 25, 9, 10, 61, 62, 63, +- 17, 18, 38, 91, 21, 22, 21, 32, 19, 24, +- 21, 11, 29, 5, 6, 32, 15, 39, 33, 40, +- 31, 24, 21, 22, 33, 34, 25, 14, 15, 16, +- 53, 54, 55, 56, 21, 41, 42, 22, 51, 52, +- 22, 57, 58, 24, 37, 16, 16, 59, 60, 27, +- 24, 24, 24, 17, 20, 32, 35, 33, 8, 34, +- 6, 98, 46, 49, 47, 45, 92, 95, -1, -1, +- 125, -1, -1, -1, -1, -1, -1, -1, -1, 48, +- -1, -1, 50, 138, -1, -1, 141 ++ 8, 42, 43, 20, 21, 22, 13, 15, 18, 19, ++ 8, 9, 95, 25, 5, 98, 22, 14, 3, 25, ++ 10, 11, 26, 33, 21, 22, 23, 24, 34, 70, ++ 37, 22, 30, 43, 31, 0, 46, 47, 36, 36, ++ 44, 45, 18, 19, 6, 7, 4, 64, 65, 66, ++ 18, 19, 25, 94, 22, 23, 20, 33, 22, 25, ++ 16, 27, 30, 29, 12, 33, 22, 23, 32, 26, ++ 26, 15, 16, 17, 56, 57, 58, 59, 22, 42, ++ 43, 34, 35, 54, 55, 60, 61, 27, 62, 63, ++ 35, 40, 39, 25, 23, 41, 23, 25, 17, 38, ++ 17, 25, 28, 25, 25, 18, 36, 21, 33, 11, ++ 9, 34, 49, 101, 48, 35, 51, 50, 98, -1, ++ 128, 52, -1, 95, -1, -1, -1, -1, -1, -1, ++ -1, -1, -1, 141, -1, 53, 144 + }; + + /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ + static const yytype_uint8 yystos[] = + { +- 0, 3, 48, 24, 0, 4, 21, 49, 50, 17, +- 18, 32, 58, 50, 25, 51, 49, 42, 45, 46, +- 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, +- 68, 69, 70, 71, 58, 26, 52, 15, 21, 22, +- 25, 71, 71, 71, 34, 12, 36, 11, 38, 39, +- 40, 9, 10, 7, 8, 29, 35, 5, 6, 41, +- 42, 25, 43, 44, 24, 53, 22, 22, 52, 52, +- 62, 59, 63, 64, 65, 66, 67, 67, 68, 68, +- 68, 68, 69, 69, 70, 70, 71, 71, 71, 14, +- 15, 16, 21, 54, 73, 74, 24, 52, 37, 16, +- 16, 24, 28, 52, 54, 74, 27, 54, 73, 60, +- 24, 24, 55, 56, 24, 21, 24, 33, 13, 20, +- 21, 22, 23, 30, 35, 57, 17, 32, 72, 21, +- 22, 29, 58, 35, 20, 19, 21, 31, 33, 34, +- 58, 33, 58, 34 ++ 0, 3, 49, 25, 0, 4, 50, 25, 5, 22, ++ 51, 52, 18, 19, 33, 60, 52, 26, 53, 51, ++ 43, 46, 47, 60, 61, 62, 63, 64, 65, 66, ++ 67, 68, 69, 70, 71, 72, 73, 60, 27, 54, ++ 16, 22, 23, 26, 73, 73, 73, 35, 13, 37, ++ 12, 39, 40, 41, 10, 11, 8, 9, 30, 36, ++ 6, 7, 42, 43, 26, 44, 45, 25, 55, 23, ++ 23, 54, 54, 64, 61, 65, 66, 67, 68, 69, ++ 69, 70, 70, 70, 70, 71, 71, 72, 72, 73, ++ 73, 73, 15, 16, 17, 22, 56, 75, 76, 25, ++ 54, 38, 17, 17, 25, 29, 54, 56, 76, 28, ++ 56, 75, 62, 25, 25, 57, 58, 25, 22, 25, ++ 34, 14, 21, 22, 23, 24, 31, 36, 59, 18, ++ 33, 74, 22, 23, 30, 60, 36, 21, 20, 22, ++ 32, 34, 35, 60, 34, 60, 35 + }; + + /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ + static const yytype_uint8 yyr1[] = + { +- 0, 47, 48, 49, 49, 50, 50, 51, 51, 51, +- 51, 51, 52, 53, 53, 54, 54, 54, 54, 55, +- 55, 55, 55, 55, 55, 55, 56, 56, 56, 57, +- 57, 57, 57, 57, 58, 58, 58, 59, 60, 60, +- 61, 61, 62, 62, 63, 63, 64, 64, 65, 65, +- 66, 66, 66, 67, 67, 67, 67, 67, 68, 68, +- 68, 69, 69, 69, 70, 70, 70, 70, 71, 71, +- 71, 71, 72, 72, 72, 73, 73, 73, 74, 74, +- 74 ++ 0, 48, 49, 50, 50, 51, 51, 52, 52, 53, ++ 53, 53, 53, 53, 54, 55, 55, 56, 56, 56, ++ 56, 57, 57, 57, 57, 57, 57, 57, 58, 58, ++ 58, 59, 59, 59, 59, 59, 60, 60, 60, 61, ++ 62, 62, 63, 63, 64, 64, 65, 65, 66, 66, ++ 67, 67, 68, 68, 68, 69, 69, 69, 69, 69, ++ 70, 70, 70, 71, 71, 71, 72, 72, 72, 72, ++ 73, 73, 73, 73, 74, 74, 74, 75, 75, 75, ++ 76, 76, 76 + }; + + /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ + static const yytype_uint8 yyr2[] = + { +- 0, 2, 4, 0, 2, 4, 2, 2, 3, 4, +- 3, 4, 5, 0, 2, 4, 2, 3, 2, 2, +- 3, 4, 2, 9, 5, 2, 0, 2, 2, 3, +- 1, 2, 2, 2, 1, 1, 3, 1, 1, 5, +- 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, +- 1, 3, 3, 1, 3, 3, 3, 3, 3, 3, +- 1, 3, 3, 1, 3, 3, 3, 1, 1, 2, +- 2, 2, 0, 2, 2, 0, 2, 2, 2, 3, +- 2 ++ 0, 2, 5, 0, 2, 0, 2, 4, 2, 2, ++ 3, 4, 3, 4, 5, 0, 2, 4, 2, 3, ++ 2, 2, 3, 4, 2, 9, 5, 2, 0, 2, ++ 2, 3, 1, 2, 2, 2, 1, 1, 3, 1, ++ 1, 5, 1, 3, 1, 3, 1, 3, 1, 3, ++ 1, 3, 1, 3, 3, 1, 3, 3, 3, 3, ++ 3, 3, 1, 3, 3, 1, 3, 3, 3, 1, ++ 1, 2, 2, 2, 0, 2, 2, 0, 2, 2, ++ 2, 3, 2 + }; + + +@@ -1463,65 +1466,82 @@ yyreduce: + switch (yyn) + { + case 2: +-#line 105 "dtc-parser.y" /* yacc.c:1646 */ ++#line 109 "dtc-parser.y" /* yacc.c:1646 */ + { ++ (yyvsp[0].node)->is_plugin = (yyvsp[-2].is_plugin); + the_boot_info = build_boot_info((yyvsp[-1].re), (yyvsp[0].node), + guess_boot_cpuid((yyvsp[0].node))); + } +-#line 1472 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1476 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + + case 3: +-#line 113 "dtc-parser.y" /* yacc.c:1646 */ ++#line 118 "dtc-parser.y" /* yacc.c:1646 */ + { +- (yyval.re) = NULL; ++ (yyval.is_plugin) = false; + } +-#line 1480 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1484 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + + case 4: +-#line 117 "dtc-parser.y" /* yacc.c:1646 */ ++#line 122 "dtc-parser.y" /* yacc.c:1646 */ + { +- (yyval.re) = chain_reserve_entry((yyvsp[-1].re), (yyvsp[0].re)); ++ (yyval.is_plugin) = true; + } +-#line 1488 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1492 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + + case 5: +-#line 124 "dtc-parser.y" /* yacc.c:1646 */ ++#line 129 "dtc-parser.y" /* yacc.c:1646 */ + { +- (yyval.re) = build_reserve_entry((yyvsp[-2].integer), (yyvsp[-1].integer)); ++ (yyval.re) = NULL; + } +-#line 1496 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1500 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + + case 6: +-#line 128 "dtc-parser.y" /* yacc.c:1646 */ ++#line 133 "dtc-parser.y" /* yacc.c:1646 */ ++ { ++ (yyval.re) = chain_reserve_entry((yyvsp[-1].re), (yyvsp[0].re)); ++ } ++#line 1508 "dtc-parser.tab.c" /* yacc.c:1646 */ ++ break; + -+ spidev@0{ -+ compatible = "spidev"; -+ reg = <0>; /* CE0 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; -+ }; ++ case 7: ++#line 140 "dtc-parser.y" /* yacc.c:1646 */ ++ { ++ (yyval.re) = build_reserve_entry((yyvsp[-2].integer), (yyvsp[-1].integer)); ++ } ++#line 1516 "dtc-parser.tab.c" /* yacc.c:1646 */ ++ break; + -+ spidev@1{ -+ compatible = "spidev"; -+ reg = <1>; /* CE1 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; -+ }; -+}; -+ -+&i2c0 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&i2c0_pins>; -+ clock-frequency = <100000>; -+}; -+ -+&i2c1 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&i2c1_pins>; -+ clock-frequency = <100000>; -+}; ++ case 8: ++#line 144 "dtc-parser.y" /* yacc.c:1646 */ + { + add_label(&(yyvsp[0].re)->labels, (yyvsp[-1].labelref)); + (yyval.re) = (yyvsp[0].re); + } +-#line 1505 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1525 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 7: +-#line 136 "dtc-parser.y" /* yacc.c:1646 */ ++ case 9: ++#line 152 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = name_node((yyvsp[0].node), ""); + } +-#line 1513 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1533 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 8: +-#line 140 "dtc-parser.y" /* yacc.c:1646 */ ++ case 10: ++#line 156 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = merge_nodes((yyvsp[-2].node), (yyvsp[0].node)); + } +-#line 1521 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1541 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 9: +-#line 145 "dtc-parser.y" /* yacc.c:1646 */ ++ case 11: ++#line 161 "dtc-parser.y" /* yacc.c:1646 */ + { + struct node *target = get_node_by_ref((yyvsp[-3].node), (yyvsp[-1].labelref)); + +@@ -1532,11 +1552,11 @@ yyreduce: + ERROR(&(yylsp[-1]), "Label or path %s not found", (yyvsp[-1].labelref)); + (yyval.node) = (yyvsp[-3].node); + } +-#line 1536 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1556 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 10: +-#line 156 "dtc-parser.y" /* yacc.c:1646 */ ++ case 12: ++#line 172 "dtc-parser.y" /* yacc.c:1646 */ + { + struct node *target = get_node_by_ref((yyvsp[-2].node), (yyvsp[-1].labelref)); + +@@ -1546,11 +1566,11 @@ yyreduce: + ERROR(&(yylsp[-1]), "Label or path %s not found", (yyvsp[-1].labelref)); + (yyval.node) = (yyvsp[-2].node); + } +-#line 1550 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1570 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 11: +-#line 166 "dtc-parser.y" /* yacc.c:1646 */ ++ case 13: ++#line 182 "dtc-parser.y" /* yacc.c:1646 */ + { + struct node *target = get_node_by_ref((yyvsp[-3].node), (yyvsp[-1].labelref)); + +@@ -1562,100 +1582,100 @@ yyreduce: + + (yyval.node) = (yyvsp[-3].node); + } +-#line 1566 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1586 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 12: +-#line 181 "dtc-parser.y" /* yacc.c:1646 */ ++ case 14: ++#line 197 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = build_node((yyvsp[-3].proplist), (yyvsp[-2].nodelist)); + } +-#line 1574 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1594 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 13: +-#line 188 "dtc-parser.y" /* yacc.c:1646 */ ++ case 15: ++#line 204 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.proplist) = NULL; + } +-#line 1582 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1602 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 14: +-#line 192 "dtc-parser.y" /* yacc.c:1646 */ ++ case 16: ++#line 208 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.proplist) = chain_property((yyvsp[0].prop), (yyvsp[-1].proplist)); + } +-#line 1590 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1610 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 15: +-#line 199 "dtc-parser.y" /* yacc.c:1646 */ ++ case 17: ++#line 215 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.prop) = build_property((yyvsp[-3].propnodename), (yyvsp[-1].data)); + } +-#line 1598 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1618 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 16: +-#line 203 "dtc-parser.y" /* yacc.c:1646 */ ++ case 18: ++#line 219 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.prop) = build_property((yyvsp[-1].propnodename), empty_data); + } +-#line 1606 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1626 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 17: +-#line 207 "dtc-parser.y" /* yacc.c:1646 */ ++ case 19: ++#line 223 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.prop) = build_property_delete((yyvsp[-1].propnodename)); + } +-#line 1614 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1634 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 18: +-#line 211 "dtc-parser.y" /* yacc.c:1646 */ ++ case 20: ++#line 227 "dtc-parser.y" /* yacc.c:1646 */ + { + add_label(&(yyvsp[0].prop)->labels, (yyvsp[-1].labelref)); + (yyval.prop) = (yyvsp[0].prop); + } +-#line 1623 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1643 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 19: +-#line 219 "dtc-parser.y" /* yacc.c:1646 */ ++ case 21: ++#line 235 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.data) = data_merge((yyvsp[-1].data), (yyvsp[0].data)); + } +-#line 1631 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1651 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 20: +-#line 223 "dtc-parser.y" /* yacc.c:1646 */ ++ case 22: ++#line 239 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.data) = data_merge((yyvsp[-2].data), (yyvsp[-1].array).data); + } +-#line 1639 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1659 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 21: +-#line 227 "dtc-parser.y" /* yacc.c:1646 */ ++ case 23: ++#line 243 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.data) = data_merge((yyvsp[-3].data), (yyvsp[-1].data)); + } +-#line 1647 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1667 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 22: +-#line 231 "dtc-parser.y" /* yacc.c:1646 */ ++ case 24: ++#line 247 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.data) = data_add_marker((yyvsp[-1].data), REF_PATH, (yyvsp[0].labelref)); + } +-#line 1655 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1675 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 23: +-#line 235 "dtc-parser.y" /* yacc.c:1646 */ ++ case 25: ++#line 251 "dtc-parser.y" /* yacc.c:1646 */ + { + FILE *f = srcfile_relative_open((yyvsp[-5].data).val, NULL); + struct data d; +@@ -1671,11 +1691,11 @@ yyreduce: + (yyval.data) = data_merge((yyvsp[-8].data), d); + fclose(f); + } +-#line 1675 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1695 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 24: +-#line 251 "dtc-parser.y" /* yacc.c:1646 */ ++ case 26: ++#line 267 "dtc-parser.y" /* yacc.c:1646 */ + { + FILE *f = srcfile_relative_open((yyvsp[-1].data).val, NULL); + struct data d = empty_data; +@@ -1685,43 +1705,43 @@ yyreduce: + (yyval.data) = data_merge((yyvsp[-4].data), d); + fclose(f); + } +-#line 1689 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1709 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 25: +-#line 261 "dtc-parser.y" /* yacc.c:1646 */ ++ case 27: ++#line 277 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.data) = data_add_marker((yyvsp[-1].data), LABEL, (yyvsp[0].labelref)); + } +-#line 1697 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1717 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 26: +-#line 268 "dtc-parser.y" /* yacc.c:1646 */ ++ case 28: ++#line 284 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.data) = empty_data; + } +-#line 1705 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1725 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 27: +-#line 272 "dtc-parser.y" /* yacc.c:1646 */ ++ case 29: ++#line 288 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.data) = (yyvsp[-1].data); + } +-#line 1713 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1733 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 28: +-#line 276 "dtc-parser.y" /* yacc.c:1646 */ ++ case 30: ++#line 292 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.data) = data_add_marker((yyvsp[-1].data), LABEL, (yyvsp[0].labelref)); + } +-#line 1721 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1741 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 29: +-#line 283 "dtc-parser.y" /* yacc.c:1646 */ ++ case 31: ++#line 299 "dtc-parser.y" /* yacc.c:1646 */ + { + unsigned long long bits; + +@@ -1737,20 +1757,20 @@ yyreduce: + (yyval.array).data = empty_data; + (yyval.array).bits = bits; + } +-#line 1741 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1761 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 30: +-#line 299 "dtc-parser.y" /* yacc.c:1646 */ ++ case 32: ++#line 315 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.array).data = empty_data; + (yyval.array).bits = 32; + } +-#line 1750 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1770 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 31: +-#line 304 "dtc-parser.y" /* yacc.c:1646 */ ++ case 33: ++#line 320 "dtc-parser.y" /* yacc.c:1646 */ + { + if ((yyvsp[-1].array).bits < 64) { + uint64_t mask = (1ULL << (yyvsp[-1].array).bits) - 1; +@@ -1769,11 +1789,11 @@ yyreduce: + + (yyval.array).data = data_append_integer((yyvsp[-1].array).data, (yyvsp[0].integer), (yyvsp[-1].array).bits); + } +-#line 1773 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1793 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 32: +-#line 323 "dtc-parser.y" /* yacc.c:1646 */ ++ case 34: ++#line 339 "dtc-parser.y" /* yacc.c:1646 */ + { + uint64_t val = ~0ULL >> (64 - (yyvsp[-1].array).bits); + +@@ -1787,247 +1807,233 @@ yyreduce: + + (yyval.array).data = data_append_integer((yyvsp[-1].array).data, val, (yyvsp[-1].array).bits); + } +-#line 1791 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1811 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 33: +-#line 337 "dtc-parser.y" /* yacc.c:1646 */ ++ case 35: ++#line 353 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.array).data = data_add_marker((yyvsp[-1].array).data, LABEL, (yyvsp[0].labelref)); + } +-#line 1799 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1819 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 36: +-#line 346 "dtc-parser.y" /* yacc.c:1646 */ ++ case 38: ++#line 362 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.integer) = (yyvsp[-1].integer); + } +-#line 1807 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1827 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 39: +-#line 357 "dtc-parser.y" /* yacc.c:1646 */ ++ case 41: ++#line 373 "dtc-parser.y" /* yacc.c:1646 */ + { (yyval.integer) = (yyvsp[-4].integer) ? (yyvsp[-2].integer) : (yyvsp[0].integer); } +-#line 1813 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1833 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 41: +-#line 362 "dtc-parser.y" /* yacc.c:1646 */ ++ case 43: ++#line 378 "dtc-parser.y" /* yacc.c:1646 */ + { (yyval.integer) = (yyvsp[-2].integer) || (yyvsp[0].integer); } +-#line 1819 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1839 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 43: +-#line 367 "dtc-parser.y" /* yacc.c:1646 */ ++ case 45: ++#line 383 "dtc-parser.y" /* yacc.c:1646 */ + { (yyval.integer) = (yyvsp[-2].integer) && (yyvsp[0].integer); } +-#line 1825 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1845 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 45: +-#line 372 "dtc-parser.y" /* yacc.c:1646 */ ++ case 47: ++#line 388 "dtc-parser.y" /* yacc.c:1646 */ + { (yyval.integer) = (yyvsp[-2].integer) | (yyvsp[0].integer); } +-#line 1831 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1851 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 47: +-#line 377 "dtc-parser.y" /* yacc.c:1646 */ ++ case 49: ++#line 393 "dtc-parser.y" /* yacc.c:1646 */ + { (yyval.integer) = (yyvsp[-2].integer) ^ (yyvsp[0].integer); } +-#line 1837 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1857 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 49: +-#line 382 "dtc-parser.y" /* yacc.c:1646 */ ++ case 51: ++#line 398 "dtc-parser.y" /* yacc.c:1646 */ + { (yyval.integer) = (yyvsp[-2].integer) & (yyvsp[0].integer); } +-#line 1843 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1863 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 51: +-#line 387 "dtc-parser.y" /* yacc.c:1646 */ ++ case 53: ++#line 403 "dtc-parser.y" /* yacc.c:1646 */ + { (yyval.integer) = (yyvsp[-2].integer) == (yyvsp[0].integer); } +-#line 1849 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1869 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 52: +-#line 388 "dtc-parser.y" /* yacc.c:1646 */ ++ case 54: ++#line 404 "dtc-parser.y" /* yacc.c:1646 */ + { (yyval.integer) = (yyvsp[-2].integer) != (yyvsp[0].integer); } +-#line 1855 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1875 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 54: +-#line 393 "dtc-parser.y" /* yacc.c:1646 */ ++ case 56: ++#line 409 "dtc-parser.y" /* yacc.c:1646 */ + { (yyval.integer) = (yyvsp[-2].integer) < (yyvsp[0].integer); } +-#line 1861 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1881 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 55: +-#line 394 "dtc-parser.y" /* yacc.c:1646 */ ++ case 57: ++#line 410 "dtc-parser.y" /* yacc.c:1646 */ + { (yyval.integer) = (yyvsp[-2].integer) > (yyvsp[0].integer); } +-#line 1867 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1887 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 56: +-#line 395 "dtc-parser.y" /* yacc.c:1646 */ ++ case 58: ++#line 411 "dtc-parser.y" /* yacc.c:1646 */ + { (yyval.integer) = (yyvsp[-2].integer) <= (yyvsp[0].integer); } +-#line 1873 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1893 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 57: +-#line 396 "dtc-parser.y" /* yacc.c:1646 */ ++ case 59: ++#line 412 "dtc-parser.y" /* yacc.c:1646 */ + { (yyval.integer) = (yyvsp[-2].integer) >= (yyvsp[0].integer); } +-#line 1879 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1899 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 58: +-#line 400 "dtc-parser.y" /* yacc.c:1646 */ ++ case 60: ++#line 416 "dtc-parser.y" /* yacc.c:1646 */ + { (yyval.integer) = (yyvsp[-2].integer) << (yyvsp[0].integer); } +-#line 1885 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1905 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 59: +-#line 401 "dtc-parser.y" /* yacc.c:1646 */ ++ case 61: ++#line 417 "dtc-parser.y" /* yacc.c:1646 */ + { (yyval.integer) = (yyvsp[-2].integer) >> (yyvsp[0].integer); } +-#line 1891 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1911 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 61: +-#line 406 "dtc-parser.y" /* yacc.c:1646 */ ++ case 63: ++#line 422 "dtc-parser.y" /* yacc.c:1646 */ + { (yyval.integer) = (yyvsp[-2].integer) + (yyvsp[0].integer); } +-#line 1897 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1917 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 62: +-#line 407 "dtc-parser.y" /* yacc.c:1646 */ ++ case 64: ++#line 423 "dtc-parser.y" /* yacc.c:1646 */ + { (yyval.integer) = (yyvsp[-2].integer) - (yyvsp[0].integer); } +-#line 1903 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1923 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 64: +-#line 412 "dtc-parser.y" /* yacc.c:1646 */ ++ case 66: ++#line 428 "dtc-parser.y" /* yacc.c:1646 */ + { (yyval.integer) = (yyvsp[-2].integer) * (yyvsp[0].integer); } +-#line 1909 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1929 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 65: +-#line 414 "dtc-parser.y" /* yacc.c:1646 */ +- { +- if ((yyvsp[0].integer) != 0) { +- (yyval.integer) = (yyvsp[-2].integer) / (yyvsp[0].integer); +- } else { +- ERROR(&(yyloc), "Division by zero"); +- (yyval.integer) = 0; +- } +- } +-#line 1922 "dtc-parser.tab.c" /* yacc.c:1646 */ ++ case 67: ++#line 429 "dtc-parser.y" /* yacc.c:1646 */ ++ { (yyval.integer) = (yyvsp[-2].integer) / (yyvsp[0].integer); } ++#line 1935 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 66: +-#line 423 "dtc-parser.y" /* yacc.c:1646 */ +- { +- if ((yyvsp[0].integer) != 0) { +- (yyval.integer) = (yyvsp[-2].integer) % (yyvsp[0].integer); +- } else { +- ERROR(&(yyloc), "Division by zero"); +- (yyval.integer) = 0; +- } +- } +-#line 1935 "dtc-parser.tab.c" /* yacc.c:1646 */ ++ case 68: ++#line 430 "dtc-parser.y" /* yacc.c:1646 */ ++ { (yyval.integer) = (yyvsp[-2].integer) % (yyvsp[0].integer); } ++#line 1941 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 69: ++ case 71: + #line 436 "dtc-parser.y" /* yacc.c:1646 */ + { (yyval.integer) = -(yyvsp[0].integer); } +-#line 1941 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1947 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 70: ++ case 72: + #line 437 "dtc-parser.y" /* yacc.c:1646 */ + { (yyval.integer) = ~(yyvsp[0].integer); } +-#line 1947 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1953 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 71: ++ case 73: + #line 438 "dtc-parser.y" /* yacc.c:1646 */ + { (yyval.integer) = !(yyvsp[0].integer); } +-#line 1953 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1959 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 72: ++ case 74: + #line 443 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.data) = empty_data; + } +-#line 1961 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1967 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 73: ++ case 75: + #line 447 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.data) = data_append_byte((yyvsp[-1].data), (yyvsp[0].byte)); + } +-#line 1969 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1975 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 74: ++ case 76: + #line 451 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.data) = data_add_marker((yyvsp[-1].data), LABEL, (yyvsp[0].labelref)); + } +-#line 1977 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1983 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 75: ++ case 77: + #line 458 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.nodelist) = NULL; + } +-#line 1985 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1991 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 76: ++ case 78: + #line 462 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.nodelist) = chain_node((yyvsp[-1].node), (yyvsp[0].nodelist)); + } +-#line 1993 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1999 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 77: ++ case 79: + #line 466 "dtc-parser.y" /* yacc.c:1646 */ + { + ERROR(&(yylsp[0]), "Properties must precede subnodes"); + YYERROR; + } +-#line 2002 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 2008 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 78: ++ case 80: + #line 474 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = name_node((yyvsp[0].node), (yyvsp[-1].propnodename)); + } +-#line 2010 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 2016 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 79: ++ case 81: + #line 478 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = name_node(build_node_delete(), (yyvsp[-1].propnodename)); + } +-#line 2018 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 2024 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 80: ++ case 82: + #line 482 "dtc-parser.y" /* yacc.c:1646 */ + { + add_label(&(yyvsp[0].node)->labels, (yyvsp[-1].labelref)); + (yyval.node) = (yyvsp[0].node); + } +-#line 2027 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 2033 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + + +-#line 2031 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 2037 "dtc-parser.tab.c" /* yacc.c:1646 */ + default: break; + } + /* User semantic actions sometimes alter yychar, and that requires +diff --git a/scripts/dtc/dtc-parser.tab.h_shipped b/scripts/dtc/dtc-parser.tab.h_shipped +index 30867c6..276d078 100644 +--- a/scripts/dtc/dtc-parser.tab.h_shipped ++++ b/scripts/dtc/dtc-parser.tab.h_shipped +@@ -46,26 +46,27 @@ extern int yydebug; + enum yytokentype + { + DT_V1 = 258, +- DT_MEMRESERVE = 259, +- DT_LSHIFT = 260, +- DT_RSHIFT = 261, +- DT_LE = 262, +- DT_GE = 263, +- DT_EQ = 264, +- DT_NE = 265, +- DT_AND = 266, +- DT_OR = 267, +- DT_BITS = 268, +- DT_DEL_PROP = 269, +- DT_DEL_NODE = 270, +- DT_PROPNODENAME = 271, +- DT_LITERAL = 272, +- DT_CHAR_LITERAL = 273, +- DT_BYTE = 274, +- DT_STRING = 275, +- DT_LABEL = 276, +- DT_REF = 277, +- DT_INCBIN = 278 ++ DT_PLUGIN = 259, ++ DT_MEMRESERVE = 260, ++ DT_LSHIFT = 261, ++ DT_RSHIFT = 262, ++ DT_LE = 263, ++ DT_GE = 264, ++ DT_EQ = 265, ++ DT_NE = 266, ++ DT_AND = 267, ++ DT_OR = 268, ++ DT_BITS = 269, ++ DT_DEL_PROP = 270, ++ DT_DEL_NODE = 271, ++ DT_PROPNODENAME = 272, ++ DT_LITERAL = 273, ++ DT_CHAR_LITERAL = 274, ++ DT_BYTE = 275, ++ DT_STRING = 276, ++ DT_LABEL = 277, ++ DT_REF = 278, ++ DT_INCBIN = 279 + }; + #endif + +@@ -74,7 +75,7 @@ extern int yydebug; + typedef union YYSTYPE YYSTYPE; + union YYSTYPE + { +-#line 38 "dtc-parser.y" /* yacc.c:1909 */ ++#line 39 "dtc-parser.y" /* yacc.c:1909 */ + + char *propnodename; + char *labelref; +@@ -92,8 +93,9 @@ union YYSTYPE + struct node *nodelist; + struct reserve_info *re; + uint64_t integer; ++ bool is_plugin; + +-#line 97 "dtc-parser.tab.h" /* yacc.c:1909 */ ++#line 99 "dtc-parser.tab.h" /* yacc.c:1909 */ + }; + # define YYSTYPE_IS_TRIVIAL 1 + # define YYSTYPE_IS_DECLARED 1 +diff --git a/scripts/dtc/dtc-parser.y b/scripts/dtc/dtc-parser.y +index 000873f..bd67bac 100644 +--- a/scripts/dtc/dtc-parser.y ++++ b/scripts/dtc/dtc-parser.y +@@ -19,6 +19,7 @@ + */ + %{ + #include <stdio.h> ++#include <inttypes.h> + + #include "dtc.h" + #include "srcpos.h" +@@ -52,9 +53,11 @@ extern bool treesource_error; + struct node *nodelist; + struct reserve_info *re; + uint64_t integer; ++ bool is_plugin; + } + + %token DT_V1 ++%token DT_PLUGIN + %token DT_MEMRESERVE + %token DT_LSHIFT DT_RSHIFT DT_LE DT_GE DT_EQ DT_NE DT_AND DT_OR + %token DT_BITS +@@ -71,6 +74,7 @@ extern bool treesource_error; + + %type <data> propdata + %type <data> propdataprefix ++%type <is_plugin> plugindecl + %type <re> memreserve + %type <re> memreserves + %type <array> arrayprefix +@@ -101,10 +105,22 @@ extern bool treesource_error; + %% + + sourcefile: +- DT_V1 ';' memreserves devicetree ++ DT_V1 ';' plugindecl memreserves devicetree + { +- the_boot_info = build_boot_info($3, $4, +- guess_boot_cpuid($4)); ++ $5->is_plugin = $3; ++ the_boot_info = build_boot_info($4, $5, ++ guess_boot_cpuid($5)); ++ } ++ ; + -+&i2c2 { -+ clock-frequency = <100000>; ++plugindecl: ++ /* empty */ ++ { ++ $$ = false; ++ } ++ | DT_PLUGIN ';' ++ { ++ $$ = true; + } + ; + +diff --git a/scripts/dtc/dtc.c b/scripts/dtc/dtc.c +index 5fa23c4..1f8c285 100644 +--- a/scripts/dtc/dtc.c ++++ b/scripts/dtc/dtc.c +@@ -31,6 +31,7 @@ int reservenum; /* Number of memory reservation slots */ + int minsize; /* Minimum blob size */ + int padsize; /* Additional padding to blob */ + int phandle_format = PHANDLE_BOTH; /* Use linux,phandle or phandle properties */ ++int symbol_fixup_support = 0; + + static void fill_fullpaths(struct node *tree, const char *prefix) + { +@@ -53,7 +54,7 @@ static void fill_fullpaths(struct node *tree, const char *prefix) + #define FDT_VERSION(version) _FDT_VERSION(version) + #define _FDT_VERSION(version) #version + static const char usage_synopsis[] = "dtc [options] <input file>"; +-static const char usage_short_opts[] = "qI:O:o:V:d:R:S:p:fb:i:H:sW:E:hv"; ++static const char usage_short_opts[] = "qI:O:o:V:d:R:S:p:fb:i:H:sW:E:@hv"; + static struct option const usage_long_opts[] = { + {"quiet", no_argument, NULL, 'q'}, + {"in-format", a_argument, NULL, 'I'}, +@@ -71,6 +72,7 @@ static struct option const usage_long_opts[] = { + {"phandle", a_argument, NULL, 'H'}, + {"warning", a_argument, NULL, 'W'}, + {"error", a_argument, NULL, 'E'}, ++ {"symbols", no_argument, NULL, '@'}, + {"help", no_argument, NULL, 'h'}, + {"version", no_argument, NULL, 'v'}, + {NULL, no_argument, NULL, 0x0}, +@@ -101,6 +103,7 @@ static const char * const usage_opts_help[] = { + "\t\tboth - Both \"linux,phandle\" and \"phandle\" properties", + "\n\tEnable/disable warnings (prefix with \"no-\")", + "\n\tEnable/disable errors (prefix with \"no-\")", ++ "\n\tEnable symbols/fixup support", + "\n\tPrint this help and exit", + "\n\tPrint version and exit", + NULL, +@@ -233,7 +236,9 @@ int main(int argc, char *argv[]) + case 'E': + parse_checks_option(false, true, optarg); + break; +- ++ case '@': ++ symbol_fixup_support = 1; ++ break; + case 'h': + usage(NULL); + default: +diff --git a/scripts/dtc/dtc.h b/scripts/dtc/dtc.h +index 56212c8..f163b22 100644 +--- a/scripts/dtc/dtc.h ++++ b/scripts/dtc/dtc.h +@@ -54,6 +54,7 @@ extern int reservenum; /* Number of memory reservation slots */ + extern int minsize; /* Minimum blob size */ + extern int padsize; /* Additional padding to blob */ + extern int phandle_format; /* Use linux,phandle or phandle properties */ ++extern int symbol_fixup_support;/* enable symbols & fixup support */ + + #define PHANDLE_LEGACY 0x1 + #define PHANDLE_EPAPR 0x2 +@@ -132,6 +133,26 @@ struct label { + struct label *next; + }; + ++struct fixup_entry { ++ int offset; ++ struct node *node; ++ struct property *prop; ++ struct fixup_entry *next; ++ bool local_fixup_generated; +}; + -+&i2s { -+ #sound-dai-cells = <0>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&i2s_pins>; ++struct fixup { ++ char *ref; ++ struct fixup_entry *entries; ++ struct fixup *next; +}; + -+&random { -+ status = "okay"; ++struct symbol { ++ struct label *label; ++ struct node *node; ++ struct symbol *next; +}; + -+/ { -+ __overrides__ { -+ uart0 = <&uart0>,"status"; -+ uart0_clkrate = <&clk_uart0>,"clock-frequency:0"; -+ i2s = <&i2s>,"status"; -+ spi = <&spi0>,"status"; -+ i2c0 = <&i2c0>,"status"; -+ i2c1 = <&i2c1>,"status"; -+ i2c2_iknowwhatimdoing = <&i2c2>,"status"; -+ i2c0_baudrate = <&i2c0>,"clock-frequency:0"; -+ i2c1_baudrate = <&i2c1>,"clock-frequency:0"; -+ i2c2_baudrate = <&i2c2>,"clock-frequency:0"; -+ core_freq = <&clk_core>,"clock-frequency:0"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi b/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi -new file mode 100644 -index 0000000..3c8bdde ---- /dev/null -+++ b/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi -@@ -0,0 +1,40 @@ -+#include "bcm2708.dtsi" + struct property { + bool deleted; + char *name; +@@ -158,6 +179,13 @@ struct node { + int addr_cells, size_cells; + + struct label *labels; + -+&gpio { -+ sdhost_pins: sdhost_pins { -+ brcm,pins = <48 49 50 51 52 53>; -+ brcm,function = <4>; /* alt0 */ -+ }; -+}; ++ struct symbol *symbols; ++ struct fixup_entry *local_fixups; ++ bool emit_local_fixup_node; + -+&leds { -+ act_led: act { -+ label = "led0"; -+ linux,default-trigger = "mmc0"; -+ gpios = <&gpio 47 0>; -+ }; -+}; ++ bool is_plugin; ++ struct fixup *fixups; + }; + + #define for_each_label_withdel(l0, l) \ +@@ -181,6 +209,18 @@ struct node { + for_each_child_withdel(n, c) \ + if (!(c)->deleted) + ++#define for_each_fixup(n, f) \ ++ for ((f) = (n)->fixups; (f); (f) = (f)->next) + -+&sdhost { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&sdhost_pins>; -+ bus-width = <4>; -+ non-removable; -+ status = "okay"; -+}; ++#define for_each_fixup_entry(f, fe) \ ++ for ((fe) = (f)->entries; (fe); (fe) = (fe)->next) + -+&fb { -+ status = "okay"; -+}; ++#define for_each_symbol(n, s) \ ++ for ((s) = (n)->symbols; (s); (s) = (s)->next) + -+/ { -+ __overrides__ { -+ act_led_gpio = <&act_led>,"gpios:4"; -+ act_led_activelow = <&act_led>,"gpios:8"; -+ act_led_trigger = <&act_led>,"linux,default-trigger"; ++#define for_each_local_fixup_entry(n, fe) \ ++ for ((fe) = (n)->local_fixups; (fe); (fe) = (fe)->next) + -+ audio = <&audio>,"status"; -+ watchdog = <&watchdog>,"status"; -+ random = <&random>,"status"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/bcm2708.dtsi b/arch/arm/boot/dts/bcm2708.dtsi -new file mode 100644 -index 0000000..f5a44cd ---- /dev/null -+++ b/arch/arm/boot/dts/bcm2708.dtsi -@@ -0,0 +1,40 @@ -+#include "bcm2708_common.dtsi" + void add_label(struct label **labels, char *label); + void delete_labels(struct label **labels); + +diff --git a/scripts/dtc/flattree.c b/scripts/dtc/flattree.c +index bd99fa2..2385137 100644 +--- a/scripts/dtc/flattree.c ++++ b/scripts/dtc/flattree.c +@@ -255,6 +255,204 @@ static int stringtable_insert(struct data *d, const char *str) + return i; + } + ++static void emit_local_fixups(struct node *tree, struct emitter *emit, ++ void *etarget, struct data *strbuf, struct version_info *vi, ++ struct node *node) ++{ ++ struct fixup_entry *fe, *fen; ++ struct node *child; ++ int nameoff, count; ++ cell_t *buf; ++ struct data d; + -+/ { -+ compatible = "brcm,bcm2708"; -+ model = "BCM2708"; ++ if (node->emit_local_fixup_node) { + -+ chosen { -+ /* No padding required - the boot loader can do that. */ -+ bootargs = ""; -+ }; ++ /* emit the external fixups (do not emit /) */ ++ if (node != tree) { ++ emit->beginnode(etarget, NULL); ++ emit->string(etarget, node->name, 0); ++ emit->align(etarget, sizeof(cell_t)); ++ } + -+ soc { -+ ranges = <0x7e000000 0x20000000 0x01000000>; ++ for_each_local_fixup_entry(tree, fe) { ++ if (fe->node != node || fe->local_fixup_generated) ++ continue; + -+ timer@7e003000 { -+ compatible = "brcm,bcm2835-system-timer"; -+ reg = <0x7e003000 0x1000>; -+ interrupts = <1 0>, <1 1>, <1 2>, <1 3>; -+ clock-frequency = <1000000>; -+ }; ++ /* count the number of fixup entries */ ++ count = 0; ++ for_each_local_fixup_entry(tree, fen) { ++ if (fen->prop != fe->prop) ++ continue; ++ fen->local_fixup_generated = true; ++ count++; ++ } + -+ arm-pmu { -+ compatible = "arm,arm1176-pmu"; -+ }; ++ /* allocate buffer */ ++ buf = xmalloc(count * sizeof(cell_t)); + -+ gpiomem { -+ compatible = "brcm,bcm2835-gpiomem"; -+ reg = <0x7e200000 0x1000>; -+ status = "okay"; -+ }; -+ }; -+}; ++ /* collect all the offsets in buffer */ ++ count = 0; ++ for_each_local_fixup_entry(tree, fen) { ++ if (fen->prop != fe->prop) ++ continue; ++ fen->local_fixup_generated = true; ++ buf[count++] = cpu_to_fdt32(fen->offset); ++ } ++ d = empty_data; ++ d.len = count * sizeof(cell_t); ++ d.val = (char *)buf; + -+&intc { -+ compatible = "brcm,bcm2835-armctrl-ic"; -+}; ++ nameoff = stringtable_insert(strbuf, fe->prop->name); ++ emit->property(etarget, fe->prop->labels); ++ emit->cell(etarget, count * sizeof(cell_t)); ++ emit->cell(etarget, nameoff); + -+&watchdog { -+ status = "okay"; -+}; -diff --git a/arch/arm/boot/dts/bcm2708_common.dtsi b/arch/arm/boot/dts/bcm2708_common.dtsi -new file mode 100644 -index 0000000..75fb4ce ---- /dev/null -+++ b/arch/arm/boot/dts/bcm2708_common.dtsi -@@ -0,0 +1,347 @@ -+#include "skeleton.dtsi" ++ if ((vi->flags & FTF_VARALIGN) && ++ (count * sizeof(cell_t)) >= 8) ++ emit->align(etarget, 8); + -+/ { -+ interrupt-parent = <&intc>; ++ emit->data(etarget, d); ++ emit->align(etarget, sizeof(cell_t)); + -+ aliases { -+ audio = &audio; -+ sound = &sound; -+ soc = &soc; -+ dma = &dma; -+ intc = &intc; -+ watchdog = &watchdog; -+ random = &random; -+ mailbox = &mailbox; -+ gpio = &gpio; -+ uart0 = &uart0; -+ sdhost = &sdhost; -+ i2s = &i2s; -+ spi0 = &spi0; -+ i2c0 = &i2c0; -+ uart1 = &uart1; -+ mmc = &mmc; -+ i2c1 = &i2c1; -+ i2c2 = &i2c2; -+ usb = &usb; -+ leds = &leds; -+ fb = &fb; -+ vchiq = &vchiq; -+ thermal = &thermal; -+ clocks = &clocks; -+ }; ++ free(buf); ++ } ++ } + -+ /* Onboard audio */ -+ audio: audio { -+ compatible = "brcm,bcm2835-audio"; -+ brcm,pwm-channels = <8>; -+ status = "disabled"; -+ }; ++ for_each_child(node, child) ++ emit_local_fixups(tree, emit, etarget, strbuf, vi, child); + -+ /* External sound card */ -+ sound: sound { -+ }; ++ if (node->emit_local_fixup_node && node != tree) ++ emit->endnode(etarget, tree->labels); ++} + -+ soc: soc { -+ compatible = "simple-bus"; -+ #address-cells = <1>; -+ #size-cells = <1>; ++static void emit_symbols_node(struct node *tree, struct emitter *emit, ++ void *etarget, struct data *strbuf, ++ struct version_info *vi) ++{ ++ struct symbol *sym; ++ int nameoff, vallen; + -+ dma: dma@7e007000 { -+ compatible = "brcm,bcm2835-dma"; -+ reg = <0x7e007000 0xf00>; -+ interrupts = <1 16>, -+ <1 17>, -+ <1 18>, -+ <1 19>, -+ <1 20>, -+ <1 21>, -+ <1 22>, -+ <1 23>, -+ <1 24>, -+ <1 25>, -+ <1 26>, -+ <1 27>; ++ /* do nothing if no symbols */ ++ if (!tree->symbols) ++ return; + -+ #dma-cells = <1>; -+ brcm,dma-channel-mask = <0x0f35>; -+ }; ++ emit->beginnode(etarget, NULL); ++ emit->string(etarget, "__symbols__", 0); ++ emit->align(etarget, sizeof(cell_t)); + -+ intc: interrupt-controller@7e00b200 { -+ compatible = "brcm,bcm2708-armctrl-ic"; -+ reg = <0x7e00b200 0x200>; -+ interrupt-controller; -+ #interrupt-cells = <2>; -+ }; ++ for_each_symbol(tree, sym) { + -+ mailbox: mailbox@7e00b800 { -+ compatible = "brcm,bcm2835-mbox"; -+ reg = <0x7e00b880 0x40>; -+ interrupts = <0 1>; -+ #mbox-cells = <0>; -+ }; ++ vallen = strlen(sym->node->fullpath); + -+ watchdog: watchdog@7e100000 { -+ compatible = "brcm,bcm2835-pm-wdt"; -+ reg = <0x7e100000 0x28>; -+ status = "disabled"; -+ }; ++ nameoff = stringtable_insert(strbuf, sym->label->label); + -+ cprman: cprman@7e101000 { -+ compatible = "brcm,bcm2835-cprman"; -+ #clock-cells = <1>; -+ reg = <0x7e101000 0x2000>; ++ emit->property(etarget, NULL); ++ emit->cell(etarget, vallen + 1); ++ emit->cell(etarget, nameoff); + -+ /* CPRMAN derives everything from the platform's -+ * oscillator. -+ */ -+ clocks = <&clk_osc>; -+ status = "disabled"; -+ }; ++ if ((vi->flags & FTF_VARALIGN) && vallen >= 8) ++ emit->align(etarget, 8); + -+ random: rng@7e104000 { -+ compatible = "brcm,bcm2835-rng"; -+ reg = <0x7e104000 0x10>; -+ status = "disabled"; -+ }; ++ emit->string(etarget, sym->node->fullpath, ++ strlen(sym->node->fullpath)); ++ emit->align(etarget, sizeof(cell_t)); ++ } + -+ gpio: gpio@7e200000 { -+ compatible = "brcm,bcm2835-gpio"; -+ reg = <0x7e200000 0xb4>; -+ interrupts = <2 17>, <2 18>; ++ emit->endnode(etarget, NULL); ++} + -+ gpio-controller; -+ #gpio-cells = <2>; ++static void emit_local_fixups_node(struct node *tree, struct emitter *emit, ++ void *etarget, struct data *strbuf, ++ struct version_info *vi) ++{ ++ struct fixup_entry *fe; ++ struct node *node; + -+ interrupt-controller; -+ #interrupt-cells = <2>; -+ }; ++ /* do nothing if no local fixups */ ++ if (!tree->local_fixups) ++ return; + -+ uart0: uart@7e201000 { -+ compatible = "arm,pl011", "arm,primecell"; -+ reg = <0x7e201000 0x1000>; -+ interrupts = <2 25>; -+ clocks = <&clk_uart0 &clk_apb_p>; -+ clock-names = "uartclk","apb_pclk"; -+ arm,primecell-periphid = <0x00241011>; // For an explanation, see -+ // https://github.com/raspberrypi/linux/commit/13731d862cf5219216533a3b0de052cee4cc5038 -+ status = "disabled"; -+ }; ++ /* mark all nodes that need a local fixup generated (and parents) */ ++ for_each_local_fixup_entry(tree, fe) { ++ node = fe->node; ++ while (node != NULL && !node->emit_local_fixup_node) { ++ node->emit_local_fixup_node = true; ++ node = node->parent; ++ } ++ } + -+ sdhost: sdhost@7e202000 { -+ compatible = "brcm,bcm2835-sdhost"; -+ reg = <0x7e202000 0x100>; -+ interrupts = <2 24>; -+ clocks = <&clk_core>; -+ dmas = <&dma 13>, -+ <&dma 13>; -+ dma-names = "tx", "rx"; -+ brcm,pio-limit = <1>; -+ status = "disabled"; -+ }; ++ /* emit the local fixups node now */ ++ emit->beginnode(etarget, NULL); ++ emit->string(etarget, "__local_fixups__", 0); ++ emit->align(etarget, sizeof(cell_t)); + -+ i2s: i2s@7e203000 { -+ compatible = "brcm,bcm2835-i2s"; -+ reg = <0x7e203000 0x24>, -+ <0x7e101098 0x08>; ++ emit_local_fixups(tree, emit, etarget, strbuf, vi, tree); + -+ dmas = <&dma 2>, <&dma 3>; -+ dma-names = "tx", "rx"; -+ status = "disabled"; -+ }; ++ emit->endnode(etarget, tree->labels); ++} + -+ spi0: spi@7e204000 { -+ compatible = "brcm,bcm2835-spi"; -+ reg = <0x7e204000 0x1000>; -+ interrupts = <2 22>; -+ clocks = <&clk_core>; -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "disabled"; -+ /* the dma channels */ -+ dmas = <&dma 6>, <&dma 7>; -+ dma-names = "tx", "rx"; -+ /* the chipselects used - <0> means native GPIO -+ * add more gpios if necessary as <&gpio 6 1> -+ * (but do not forget to make them output!) -+ */ -+ cs-gpios = <0>, <0>; -+ }; ++static void emit_fixups_node(struct node *tree, struct emitter *emit, ++ void *etarget, struct data *strbuf, ++ struct version_info *vi) ++{ ++ struct fixup *f; ++ struct fixup_entry *fe; ++ char *name, *s; ++ const char *fullpath; ++ int namesz, nameoff, vallen; + -+ i2c0: i2c@7e205000 { -+ compatible = "brcm,bcm2708-i2c"; -+ reg = <0x7e205000 0x1000>; -+ interrupts = <2 21>; -+ clocks = <&clk_core>; -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "disabled"; -+ }; ++ /* do nothing if no fixups */ ++ if (!tree->fixups) ++ return; + -+ pwm: pwm@7e20c000 { -+ compatible = "brcm,bcm2835-pwm"; -+ reg = <0x7e20c000 0x28>; -+ clocks = <&clk_pwm>; -+ #pwm-cells = <2>; -+ status = "disabled"; -+ }; ++ /* emit the external fixups */ ++ emit->beginnode(etarget, NULL); ++ emit->string(etarget, "__fixups__", 0); ++ emit->align(etarget, sizeof(cell_t)); + -+ uart1: uart@7e215040 { -+ compatible = "brcm,bcm2835-aux-uart", "ns16550"; -+ reg = <0x7e215040 0x40>; -+ interrupts = <1 29>; -+ clocks = <&clk_uart1>; -+ reg-shift = <2>; -+ no-loopback-test; -+ status = "disabled"; -+ }; ++ for_each_fixup(tree, f) { + -+ mmc: mmc@7e300000 { -+ compatible = "brcm,bcm2835-mmc"; -+ reg = <0x7e300000 0x100>; -+ interrupts = <2 30>; -+ clocks = <&clk_mmc>; -+ dmas = <&dma 11>, -+ <&dma 11>; -+ dma-names = "tx", "rx"; -+ status = "disabled"; -+ }; ++ namesz = 0; ++ for_each_fixup_entry(f, fe) { ++ fullpath = fe->node->fullpath; ++ if (fullpath[0] == '\0') ++ fullpath = "/"; ++ namesz += strlen(fullpath) + 1; ++ namesz += strlen(fe->prop->name) + 1; ++ namesz += 32; /* space for :<number> + '\0' */ ++ } + -+ i2c1: i2c@7e804000 { -+ compatible = "brcm,bcm2708-i2c"; -+ reg = <0x7e804000 0x1000>; -+ interrupts = <2 21>; -+ clocks = <&clk_core>; -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "disabled"; -+ }; ++ name = xmalloc(namesz); + -+ i2c2: i2c@7e805000 { -+ // Beware - this is shared with the HDMI module. -+ // Careless use may break (really) your display. -+ // Caveat emptor. -+ compatible = "brcm,bcm2708-i2c"; -+ reg = <0x7e805000 0x1000>; -+ interrupts = <2 21>; -+ clocks = <&clk_core>; -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "disabled"; -+ }; ++ s = name; ++ for_each_fixup_entry(f, fe) { ++ fullpath = fe->node->fullpath; ++ if (fullpath[0] == '\0') ++ fullpath = "/"; ++ snprintf(s, name + namesz - s, "%s:%s:%d", fullpath, ++ fe->prop->name, fe->offset); ++ s += strlen(s) + 1; ++ } + -+ smi: smi@7e600000 { -+ compatible = "brcm,bcm2835-smi"; -+ reg = <0x7e600000 0x44>, <0x7e1010b0 0x8>; -+ interrupts = <2 16>; -+ brcm,smi-clock-source = <6>; -+ brcm,smi-clock-divisor = <4>; -+ dmas = <&dma 4>; -+ dma-names = "rx-tx"; -+ status = "disabled"; -+ }; ++ nameoff = stringtable_insert(strbuf, f->ref); ++ vallen = s - name - 1; + -+ usb: usb@7e980000 { -+ compatible = "brcm,bcm2708-usb"; -+ reg = <0x7e980000 0x10000>, -+ <0x7e006000 0x1000>; -+ interrupts = <2 0>, -+ <1 9>; -+ }; ++ emit->property(etarget, NULL); ++ emit->cell(etarget, vallen + 1); ++ emit->cell(etarget, nameoff); + -+ firmware: firmware { -+ compatible = "raspberrypi,bcm2835-firmware"; -+ mboxes = <&mailbox>; -+ }; ++ if ((vi->flags & FTF_VARALIGN) && vallen >= 8) ++ emit->align(etarget, 8); + -+ leds: leds { -+ compatible = "gpio-leds"; -+ }; ++ emit->string(etarget, name, vallen); ++ emit->align(etarget, sizeof(cell_t)); + -+ fb: fb { -+ compatible = "brcm,bcm2708-fb"; -+ firmware = <&firmware>; -+ status = "disabled"; -+ }; ++ free(name); ++ } + -+ vchiq: vchiq { -+ compatible = "brcm,bcm2835-vchiq"; -+ reg = <0x7e00b840 0xf>; -+ interrupts = <0 2>; -+ cache-line-size = <32>; -+ firmware = <&firmware>; -+ }; ++ emit->endnode(etarget, tree->labels); ++} + -+ thermal: thermal { -+ compatible = "brcm,bcm2835-thermal"; -+ firmware = <&firmware>; -+ }; -+ }; + static void flatten_tree(struct node *tree, struct emitter *emit, + void *etarget, struct data *strbuf, + struct version_info *vi) +@@ -310,6 +508,10 @@ static void flatten_tree(struct node *tree, struct emitter *emit, + flatten_tree(child, emit, etarget, strbuf, vi); + } + ++ emit_symbols_node(tree, emit, etarget, strbuf, vi); ++ emit_local_fixups_node(tree, emit, etarget, strbuf, vi); ++ emit_fixups_node(tree, emit, etarget, strbuf, vi); + -+ clocks: clocks { -+ compatible = "simple-bus"; -+ #address-cells = <1>; -+ #size-cells = <0>; + emit->endnode(etarget, tree->labels); + } + +diff --git a/scripts/dtc/version_gen.h b/scripts/dtc/version_gen.h +index 11d93e6..2595dfd 100644 +--- a/scripts/dtc/version_gen.h ++++ b/scripts/dtc/version_gen.h +@@ -1 +1 @@ +-#define DTC_VERSION "DTC 1.4.1-gb06e55c8" ++#define DTC_VERSION "DTC 1.4.1-g25efc119" + +From 43f338fd4cb0e7a0813f527883930806c712369e Mon Sep 17 00:00:00 2001 +From: Phil Elwell <phil@raspberrypi.org> +Date: Fri, 5 Dec 2014 17:26:26 +0000 +Subject: [PATCH 056/112] fdt: Add support for the CONFIG_CMDLINE_EXTEND option + +--- + drivers/of/fdt.c | 29 ++++++++++++++++++++++++----- + 1 file changed, 24 insertions(+), 5 deletions(-) + +diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c +index 3349d2a..1e26605 100644 +--- a/drivers/of/fdt.c ++++ b/drivers/of/fdt.c +@@ -960,19 +960,38 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname, + + /* Retrieve command line */ + p = of_get_flat_dt_prop(node, "bootargs", &l); +- if (p != NULL && l > 0) +- strlcpy(data, p, min((int)l, COMMAND_LINE_SIZE)); + + /* + * CONFIG_CMDLINE is meant to be a default in case nothing else + * managed to set the command line, unless CONFIG_CMDLINE_FORCE + * is set in which case we override whatever was found earlier. ++ * ++ * However, it can be useful to be able to treat the default as ++ * a starting point to be extended using CONFIG_CMDLINE_EXTEND. + */ ++ ((char *)data)[0] = '\0'; + -+ clk_core: clock@0 { -+ compatible = "fixed-clock"; -+ reg = <0>; -+ #clock-cells = <0>; -+ clock-output-names = "core"; -+ clock-frequency = <250000000>; -+ }; + #ifdef CONFIG_CMDLINE +-#ifndef CONFIG_CMDLINE_FORCE +- if (!((char *)data)[0]) ++ strlcpy(data, CONFIG_CMDLINE, COMMAND_LINE_SIZE); + -+ clk_mmc: clock@1 { -+ compatible = "fixed-clock"; -+ reg = <1>; -+ #clock-cells = <0>; -+ clock-output-names = "mmc"; -+ clock-frequency = <250000000>; -+ }; -+ -+ clk_uart0: clock@2 { -+ compatible = "fixed-clock"; -+ reg = <2>; -+ #clock-cells = <0>; -+ clock-output-names = "uart0_pclk"; -+ clock-frequency = <3000000>; -+ }; ++ if (p != NULL && l > 0) { ++#if defined(CONFIG_CMDLINE_EXTEND) ++ int len = strlen(data); ++ if (len > 0) { ++ strlcat(data, " ", COMMAND_LINE_SIZE); ++ len++; ++ } ++ strlcpy((char *)data + len, p, min((int)l, COMMAND_LINE_SIZE - len)); ++#elif defined(CONFIG_CMDLINE_FORCE) ++ pr_warning("Ignoring bootargs property (using the default kernel command line)\n"); ++#else ++ /* Neither extend nor force - just override */ ++ strlcpy(data, p, min((int)l, COMMAND_LINE_SIZE)); + #endif +- strlcpy(data, CONFIG_CMDLINE, COMMAND_LINE_SIZE); ++ } ++#else /* CONFIG_CMDLINE */ ++ if (p != NULL && l > 0) ++ strlcpy(data, p, min((int)l, COMMAND_LINE_SIZE)); + #endif /* CONFIG_CMDLINE */ + + pr_debug("Command line is: %s\n", (char*)data); + +From d0653a1baeb2b6a9507051fb026b01a1621cb321 Mon Sep 17 00:00:00 2001 +From: notro <notro@tronnes.org> +Date: Wed, 9 Jul 2014 14:46:08 +0200 +Subject: [PATCH 057/112] BCM2708: Add core Device Tree support + +Add the bare minimum needed to boot BCM2708 from a Device Tree. + +Signed-off-by: Noralf Tronnes <notro@tronnes.org> + +BCM2708: DT: change 'axi' nodename to 'soc' + +Change DT node named 'axi' to 'soc' so it matches ARCH_BCM2835. +The VC4 bootloader fills in certain properties in the 'axi' subtree, +but since this is part of an upstreaming effort, the name is changed. + +Signed-off-by: Noralf Tronnes notro@tronnes.org + +BCM2708_DT: Correct length of the peripheral space + +Use dts-dirs feature for overlays. + +The kernel makefiles have a dts-dirs target that is for vendor subdirectories. + +Using this fixes the install_dtbs target, which previously did not install the overlays. + +BCM270X_DT: configure I2S DMA channels + +Signed-off-by: Matthias Reichl <hias@horus.com> + +BCM270X_DT: switch to bcm2835-i2s + +I2S soundcard drivers with proper devicetree support (i.e. not linking +to the cpu_dai/platform via name but to cpu/platform via of_node) +will work out of the box without any modifications. + +When the kernel is compiled without devicetree support the platform +code will instantiate the bcm2708-i2s driver and I2S soundcard drivers +will link to it via name, as before. + +Signed-off-by: Matthias Reichl <hias@horus.com> + +SDIO-overlay: add poll_once-boolean parameter + +Add paramter to toggle sdio-device-polling +done every second or once at boot-time. + +Signed-off-by: Patrick Boettcher <patrick.boettcher@posteo.de> + +BCM270X_DT: Make mmc overlay compatible with current firmware + +The original DT overlay logic followed a merge-then-patch procedure, +i.e. parameters are applied to the loaded overlay before the overlay +is merged into the base DTB. This sequence has been changed to +patch-then-merge, in order to support parameterised node names, and +to protect against bad overlays. As a result, overrides (parameters) +must only target labels in the overlay, but the overlay can obviously target nodes in the base DTB. + +mmc-overlay.dts (that switches back to the original mmc sdcard +driver) is the only overlay violating that rule, and this patch +fixes it. + +bcm270x_dt: Use the sdhost MMC controller by default + +The "mmc" overlay reverts to using the other controller. + +squash: Add cprman to dt + +BCM270X_DT: Use clk_core for I2C interfaces +--- + arch/arm/boot/dts/Makefile | 31 + + arch/arm/boot/dts/bcm2708-rpi-b-plus.dts | 154 +++ + arch/arm/boot/dts/bcm2708-rpi-b.dts | 144 +++ + arch/arm/boot/dts/bcm2708-rpi-cm.dts | 102 ++ + arch/arm/boot/dts/bcm2708-rpi-cm.dtsi | 52 + + arch/arm/boot/dts/bcm2708.dtsi | 40 + + arch/arm/boot/dts/bcm2708_common.dtsi | 438 ++++++++ + arch/arm/boot/dts/bcm2709-rpi-2-b.dts | 154 +++ + arch/arm/boot/dts/bcm2709.dtsi | 102 ++ + arch/arm/boot/dts/bcm2710-rpi-3-b.dts | 201 ++++ + arch/arm/boot/dts/bcm2710.dtsi | 102 ++ + arch/arm/boot/dts/bcm2835-rpi-cm.dts | 93 ++ + arch/arm/boot/dts/bcm2835-rpi-cm.dtsi | 30 + + arch/arm/boot/dts/overlays/Makefile | 99 ++ + arch/arm/boot/dts/overlays/README | 1161 ++++++++++++++++++++ + .../arm/boot/dts/overlays/adau1977-adc-overlay.dts | 53 + + arch/arm/boot/dts/overlays/ads7846-overlay.dts | 89 ++ + .../dts/overlays/akkordion-iqdacplus-overlay.dts | 46 + + arch/arm/boot/dts/overlays/at86rf233-overlay.dts | 57 + + .../audioinjector-wm8731-audio-overlay.dts | 39 + + .../dts/overlays/bmp085_i2c-sensor-overlay.dts | 23 + + arch/arm/boot/dts/overlays/dht11-overlay.dts | 39 + + arch/arm/boot/dts/overlays/dpi24-overlay.dts | 31 + + arch/arm/boot/dts/overlays/dwc-otg-overlay.dts | 20 + + arch/arm/boot/dts/overlays/dwc2-overlay.dts | 29 + + arch/arm/boot/dts/overlays/enc28j60-overlay.dts | 53 + + arch/arm/boot/dts/overlays/gpio-ir-overlay.dts | 45 + + .../boot/dts/overlays/gpio-poweroff-overlay.dts | 34 + + .../boot/dts/overlays/hifiberry-amp-overlay.dts | 39 + + .../boot/dts/overlays/hifiberry-dac-overlay.dts | 34 + + .../dts/overlays/hifiberry-dacplus-overlay.dts | 56 + + .../boot/dts/overlays/hifiberry-digi-overlay.dts | 39 + + arch/arm/boot/dts/overlays/hy28a-overlay.dts | 93 ++ + arch/arm/boot/dts/overlays/hy28b-overlay.dts | 148 +++ + arch/arm/boot/dts/overlays/i2c-gpio-overlay.dts | 28 + + arch/arm/boot/dts/overlays/i2c-mux-overlay.dts | 139 +++ + .../boot/dts/overlays/i2c-pwm-pca9685a-overlay.dts | 26 + + arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts | 69 ++ + .../arm/boot/dts/overlays/i2c0-bcm2708-overlay.dts | 61 + + .../arm/boot/dts/overlays/i2c1-bcm2708-overlay.dts | 37 + + .../boot/dts/overlays/i2s-gpio28-31-overlay.dts | 18 + + arch/arm/boot/dts/overlays/i2s-mmap-overlay.dts | 13 + + arch/arm/boot/dts/overlays/iqaudio-dac-overlay.dts | 43 + + .../boot/dts/overlays/iqaudio-dacplus-overlay.dts | 43 + + .../arm/boot/dts/overlays/justboom-dac-overlay.dts | 43 + + .../boot/dts/overlays/justboom-digi-overlay.dts | 39 + + arch/arm/boot/dts/overlays/lirc-rpi-overlay.dts | 57 + + arch/arm/boot/dts/overlays/mcp23017-overlay.dts | 54 + + .../arm/boot/dts/overlays/mcp2515-can0-overlay.dts | 73 ++ + .../arm/boot/dts/overlays/mcp2515-can1-overlay.dts | 73 ++ + arch/arm/boot/dts/overlays/mmc-overlay.dts | 38 + + arch/arm/boot/dts/overlays/mz61581-overlay.dts | 117 ++ + arch/arm/boot/dts/overlays/pi3-act-led-overlay.dts | 27 + + .../boot/dts/overlays/pi3-disable-bt-overlay.dts | 46 + + .../boot/dts/overlays/pi3-miniuart-bt-overlay.dts | 64 ++ + arch/arm/boot/dts/overlays/piscreen-overlay.dts | 102 ++ + arch/arm/boot/dts/overlays/piscreen2r-overlay.dts | 106 ++ + arch/arm/boot/dts/overlays/pitft22-overlay.dts | 69 ++ + .../dts/overlays/pitft28-capacitive-overlay.dts | 91 ++ + .../dts/overlays/pitft28-resistive-overlay.dts | 121 ++ + arch/arm/boot/dts/overlays/pps-gpio-overlay.dts | 34 + + arch/arm/boot/dts/overlays/pwm-2chan-overlay.dts | 53 + + arch/arm/boot/dts/overlays/pwm-overlay.dts | 49 + + arch/arm/boot/dts/overlays/qca7000-overlay.dts | 52 + + arch/arm/boot/dts/overlays/raspidac3-overlay.dts | 45 + + .../boot/dts/overlays/rpi-backlight-overlay.dts | 21 + + arch/arm/boot/dts/overlays/rpi-dac-overlay.dts | 34 + + arch/arm/boot/dts/overlays/rpi-display-overlay.dts | 89 ++ + arch/arm/boot/dts/overlays/rpi-ft5406-overlay.dts | 17 + + arch/arm/boot/dts/overlays/rpi-proto-overlay.dts | 39 + + arch/arm/boot/dts/overlays/rpi-sense-overlay.dts | 47 + + .../overlays/rra-digidac1-wm8741-audio-overlay.dts | 81 ++ + arch/arm/boot/dts/overlays/sdhost-overlay.dts | 32 + + arch/arm/boot/dts/overlays/sdio-1bit-overlay.dts | 36 + + arch/arm/boot/dts/overlays/sdio-overlay.dts | 36 + + arch/arm/boot/dts/overlays/sdtweak-overlay.dts | 23 + + arch/arm/boot/dts/overlays/smi-dev-overlay.dts | 18 + + arch/arm/boot/dts/overlays/smi-nand-overlay.dts | 69 ++ + arch/arm/boot/dts/overlays/smi-overlay.dts | 37 + + .../boot/dts/overlays/spi-gpio35-39-overlay.dts | 31 + + arch/arm/boot/dts/overlays/spi1-1cs-overlay.dts | 57 + + arch/arm/boot/dts/overlays/spi1-2cs-overlay.dts | 69 ++ + arch/arm/boot/dts/overlays/spi1-3cs-overlay.dts | 81 ++ + arch/arm/boot/dts/overlays/spi2-1cs-overlay.dts | 57 + + arch/arm/boot/dts/overlays/spi2-2cs-overlay.dts | 69 ++ + arch/arm/boot/dts/overlays/spi2-3cs-overlay.dts | 81 ++ + arch/arm/boot/dts/overlays/tinylcd35-overlay.dts | 224 ++++ + arch/arm/boot/dts/overlays/uart1-overlay.dts | 38 + + arch/arm/boot/dts/overlays/vc4-kms-v3d-overlay.dts | 129 +++ + arch/arm/boot/dts/overlays/vga666-overlay.dts | 30 + + arch/arm/boot/dts/overlays/w1-gpio-overlay.dts | 39 + + .../boot/dts/overlays/w1-gpio-pullup-overlay.dts | 41 + + arch/arm/boot/dts/overlays/wittypi-overlay.dts | 44 + + 93 files changed, 7269 insertions(+) + create mode 100644 arch/arm/boot/dts/bcm2708-rpi-b-plus.dts + create mode 100644 arch/arm/boot/dts/bcm2708-rpi-b.dts + create mode 100755 arch/arm/boot/dts/bcm2708-rpi-cm.dts + create mode 100644 arch/arm/boot/dts/bcm2708-rpi-cm.dtsi + create mode 100644 arch/arm/boot/dts/bcm2708.dtsi + create mode 100644 arch/arm/boot/dts/bcm2708_common.dtsi + create mode 100644 arch/arm/boot/dts/bcm2709-rpi-2-b.dts + create mode 100644 arch/arm/boot/dts/bcm2709.dtsi + create mode 100644 arch/arm/boot/dts/bcm2710-rpi-3-b.dts + create mode 100644 arch/arm/boot/dts/bcm2710.dtsi + create mode 100644 arch/arm/boot/dts/bcm2835-rpi-cm.dts + create mode 100644 arch/arm/boot/dts/bcm2835-rpi-cm.dtsi + create mode 100644 arch/arm/boot/dts/overlays/Makefile + create mode 100644 arch/arm/boot/dts/overlays/README + create mode 100644 arch/arm/boot/dts/overlays/adau1977-adc-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/ads7846-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/akkordion-iqdacplus-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/at86rf233-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/audioinjector-wm8731-audio-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/bmp085_i2c-sensor-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/dht11-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/dpi24-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/dwc-otg-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/dwc2-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/enc28j60-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/gpio-ir-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/gpio-poweroff-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/hifiberry-amp-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/hifiberry-dac-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/hifiberry-digi-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/hy28a-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/hy28b-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/i2c-gpio-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/i2c-mux-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/i2c-pwm-pca9685a-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/i2c0-bcm2708-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/i2c1-bcm2708-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/i2s-gpio28-31-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/i2s-mmap-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/iqaudio-dac-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/iqaudio-dacplus-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/justboom-dac-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/justboom-digi-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/lirc-rpi-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/mcp23017-overlay.dts + create mode 100755 arch/arm/boot/dts/overlays/mcp2515-can0-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/mcp2515-can1-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/mmc-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/mz61581-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/pi3-act-led-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/pi3-disable-bt-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/pi3-miniuart-bt-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/piscreen-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/piscreen2r-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/pitft22-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/pitft28-capacitive-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/pitft28-resistive-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/pps-gpio-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/pwm-2chan-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/pwm-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/qca7000-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/raspidac3-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/rpi-backlight-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/rpi-dac-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/rpi-display-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/rpi-ft5406-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/rpi-proto-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/rpi-sense-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/rra-digidac1-wm8741-audio-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/sdhost-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/sdio-1bit-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/sdio-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/sdtweak-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/smi-dev-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/smi-nand-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/smi-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/spi-gpio35-39-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/spi1-1cs-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/spi1-2cs-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/spi1-3cs-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/spi2-1cs-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/spi2-2cs-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/spi2-3cs-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/tinylcd35-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/uart1-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/vc4-kms-v3d-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/vga666-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/w1-gpio-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/w1-gpio-pullup-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/wittypi-overlay.dts + +diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile +index 95c1923..1af92d7 100644 +--- a/arch/arm/boot/dts/Makefile ++++ b/arch/arm/boot/dts/Makefile +@@ -1,5 +1,26 @@ + ifeq ($(CONFIG_OF),y) + ++dtb-$(CONFIG_ARCH_BCM2708) += bcm2708-rpi-b.dtb ++dtb-$(CONFIG_ARCH_BCM2708) += bcm2708-rpi-b-plus.dtb ++dtb-$(CONFIG_ARCH_BCM2708) += bcm2708-rpi-cm.dtb ++dtb-$(CONFIG_ARCH_BCM2835) += bcm2835-rpi-cm.dtb ++dtb-$(CONFIG_ARCH_BCM2709) += bcm2709-rpi-2-b.dtb ++dtb-$(CONFIG_ARCH_BCM2709) += bcm2710-rpi-3-b.dtb + -+ clk_apb_p: clock@3 { -+ compatible = "fixed-clock"; -+ reg = <3>; -+ #clock-cells = <0>; -+ clock-output-names = "apb_pclk"; -+ clock-frequency = <126000000>; -+ }; ++# Raspberry Pi ++ifeq ($(CONFIG_ARCH_BCM2708),y) ++ RPI_DT_OVERLAYS=y ++endif ++ifeq ($(CONFIG_ARCH_BCM2709),y) ++ RPI_DT_OVERLAYS=y ++endif ++ifeq ($(CONFIG_ARCH_BCM2835),y) ++ RPI_DT_OVERLAYS=y ++endif ++ifeq ($(RPI_DT_OVERLAYS),y) ++ dts-dirs += overlays ++endif + -+ clk_pwm: clock@4 { -+ compatible = "fixed-clock"; -+ reg = <4>; -+ #clock-cells = <0>; -+ clock-output-names = "pwm"; -+ clock-frequency = <100000000>; -+ }; + dtb-$(CONFIG_ARCH_ALPINE) += \ + alpine-db.dtb + dtb-$(CONFIG_MACH_ARTPEC6) += \ +@@ -839,10 +860,20 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \ + mt8127-moose.dtb \ + mt8135-evbp1.dtb + dtb-$(CONFIG_ARCH_ZX) += zx296702-ad1.dtb + -+ clk_uart1: clock@5 { -+ compatible = "fixed-factor-clock"; -+ reg = <5>; -+ clocks = <&clk_core>; -+ #clock-cells = <0>; -+ clock-div = <1>; -+ clock-mult = <2>; -+ }; ++targets += dtbs dtbs_install ++targets += $(dtb-y) + -+ /* The oscillator is the root of the clock tree. */ -+ clk_osc: clock@6 { -+ compatible = "fixed-clock"; -+ reg = <6>; -+ #clock-cells = <0>; -+ clock-output-names = "osc"; -+ clock-frequency = <19200000>; -+ }; -+ }; + endif + + dtstree := $(srctree)/$(src) + dtb-$(CONFIG_OF_ALL_DTBS) := $(patsubst $(dtstree)/%.dts,%.dtb, $(wildcard $(dtstree)/*.dts)) + + always := $(dtb-y) ++subdir-y := $(dts-dirs) + clean-files := *.dtb + -+ __overrides__ { -+ cache_line_size = <&vchiq>, "cache-line-size:0"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/bcm2709-rpi-2-b.dts b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts ++# Enable fixups to support overlays on BCM2708 platforms ++ifeq ($(RPI_DT_OVERLAYS),y) ++ DTC_FLAGS ?= -@ -H epapr ++endif +diff --git a/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts b/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts new file mode 100644 -index 0000000..5206ba2 +index 0000000..0ac7725 --- /dev/null -+++ b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts -@@ -0,0 +1,145 @@ ++++ b/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts +@@ -0,0 +1,154 @@ +/dts-v1/; + -+#include "bcm2709.dtsi" ++#include "bcm2708.dtsi" + +/ { -+ compatible = "brcm,bcm2709"; -+ model = "Raspberry Pi 2 Model B"; ++ compatible = "brcm,bcm2708"; ++ model = "Raspberry Pi Model B+"; +}; + +&gpio { @@ -110125,7 +113316,7 @@ index 0000000..5206ba2 + pinctrl-0 = <&spi0_pins &spi0_cs_pins>; + cs-gpios = <&gpio 8 1>, <&gpio 7 1>; + -+ spidev@0{ ++ spidev0: spidev@0{ + compatible = "spidev"; + reg = <0>; /* CE0 */ + #address-cells = <1>; @@ -110133,7 +113324,7 @@ index 0000000..5206ba2 + spi-max-frequency = <500000>; + }; + -+ spidev@1{ ++ spidev1: spidev@1{ + compatible = "spidev"; + reg = <1>; /* CE1 */ + #address-cells = <1>; @@ -110182,10 +113373,15 @@ index 0000000..5206ba2 + }; +}; + ++&hdmi { ++ hpd-gpios = <&gpio 46 GPIO_ACTIVE_LOW>; ++}; ++ +/ { + __overrides__ { + uart0 = <&uart0>,"status"; + uart0_clkrate = <&clk_uart0>,"clock-frequency:0"; ++ uart1 = <&uart1>,"status"; + i2s = <&i2s>,"status"; + spi = <&spi0>,"status"; + i2c0 = <&i2c0>,"status"; @@ -110207,125 +113403,171 @@ index 0000000..5206ba2 + audio = <&audio>,"status"; + watchdog = <&watchdog>,"status"; + random = <&random>,"status"; ++ sd_overclock = <&sdhost>,"brcm,overclock-50:0"; ++ sd_force_pio = <&sdhost>,"brcm,force-pio?"; ++ sd_pio_limit = <&sdhost>,"brcm,pio-limit:0"; ++ sd_debug = <&sdhost>,"brcm,debug"; + }; +}; -diff --git a/arch/arm/boot/dts/bcm2709.dtsi b/arch/arm/boot/dts/bcm2709.dtsi +diff --git a/arch/arm/boot/dts/bcm2708-rpi-b.dts b/arch/arm/boot/dts/bcm2708-rpi-b.dts new file mode 100644 -index 0000000..a8cfd7c +index 0000000..8474834 --- /dev/null -+++ b/arch/arm/boot/dts/bcm2709.dtsi -@@ -0,0 +1,102 @@ -+#include "bcm2708_common.dtsi" ++++ b/arch/arm/boot/dts/bcm2708-rpi-b.dts +@@ -0,0 +1,144 @@ ++/dts-v1/; ++ ++#include "bcm2708.dtsi" + +/ { -+ compatible = "brcm,bcm2709"; -+ model = "BCM2709"; ++ compatible = "brcm,bcm2708"; ++ model = "Raspberry Pi Model B"; ++}; + -+ chosen { -+ /* No padding required - the boot loader can do that. */ -+ bootargs = ""; ++&gpio { ++ sdhost_pins: sdhost_pins { ++ brcm,pins = <48 49 50 51 52 53>; ++ brcm,function = <4>; /* alt0 */ + }; + -+ soc { -+ ranges = <0x7e000000 0x3f000000 0x01000000>, -+ <0x40000000 0x40000000 0x00040000>; ++ spi0_pins: spi0_pins { ++ brcm,pins = <9 10 11>; ++ brcm,function = <4>; /* alt0 */ ++ }; + -+ local_intc: local_intc { -+ compatible = "brcm,bcm2836-l1-intc"; -+ reg = <0x40000000 0x100>; -+ interrupt-controller; -+ #interrupt-cells = <1>; -+ interrupt-parent = <&local_intc>; -+ }; ++ spi0_cs_pins: spi0_cs_pins { ++ brcm,pins = <8 7>; ++ brcm,function = <1>; /* output */ ++ }; + -+ arm-pmu { -+ compatible = "arm,cortex-a7-pmu"; -+ interrupt-parent = <&local_intc>; -+ interrupts = <9>; -+ }; ++ i2c0_pins: i2c0 { ++ brcm,pins = <0 1>; ++ brcm,function = <4>; ++ }; + -+ gpiomem { -+ compatible = "brcm,bcm2835-gpiomem"; -+ reg = <0x7e200000 0x1000>; -+ status = "okay"; -+ }; ++ i2c1_pins: i2c1 { ++ brcm,pins = <2 3>; ++ brcm,function = <4>; ++ }; + -+ timer { -+ compatible = "arm,armv7-timer"; -+ clock-frequency = <19200000>; -+ interrupt-parent = <&local_intc>; -+ interrupts = <0>, // PHYS_SECURE_PPI -+ <1>, // PHYS_NONSECURE_PPI -+ <3>, // VIRT_PPI -+ <2>; // HYP_PPI -+ always-on; -+ }; ++ i2s_pins: i2s { ++ brcm,pins = <28 29 30 31>; ++ brcm,function = <6>; /* alt2 */ ++ }; ++}; + -+ syscon@40000000 { -+ compatible = "brcm,bcm2836-arm-local", "syscon"; -+ reg = <0x40000000 0x100>; -+ }; ++&sdhost { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&sdhost_pins>; ++ bus-width = <4>; ++ status = "okay"; ++}; ++ ++&fb { ++ status = "okay"; ++}; ++ ++&uart0 { ++ status = "okay"; ++}; ++ ++&spi0 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&spi0_pins &spi0_cs_pins>; ++ cs-gpios = <&gpio 8 1>, <&gpio 7 1>; ++ ++ spidev0: spidev@0{ ++ compatible = "spidev"; ++ reg = <0>; /* CE0 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; + }; + -+ cpus: cpus { ++ spidev1: spidev@1{ ++ compatible = "spidev"; ++ reg = <1>; /* CE1 */ + #address-cells = <1>; + #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ }; ++}; + -+ v7_cpu0: cpu@0 { -+ device_type = "cpu"; -+ compatible = "arm,cortex-a7"; -+ reg = <0xf00>; -+ clock-frequency = <800000000>; -+ }; ++&i2c0 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2c0_pins>; ++ clock-frequency = <100000>; ++}; + -+ v7_cpu1: cpu@1 { -+ device_type = "cpu"; -+ compatible = "arm,cortex-a7"; -+ reg = <0xf01>; -+ clock-frequency = <800000000>; -+ }; ++&i2c1 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2c1_pins>; ++ clock-frequency = <100000>; ++}; + -+ v7_cpu2: cpu@2 { -+ device_type = "cpu"; -+ compatible = "arm,cortex-a7"; -+ reg = <0xf02>; -+ clock-frequency = <800000000>; -+ }; ++&i2c2 { ++ clock-frequency = <100000>; ++}; + -+ v7_cpu3: cpu@3 { -+ device_type = "cpu"; -+ compatible = "arm,cortex-a7"; -+ reg = <0xf03>; -+ clock-frequency = <800000000>; -+ }; -+ }; ++&i2s { ++ #sound-dai-cells = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2s_pins>; ++}; + -+ __overrides__ { -+ arm_freq = <&v7_cpu0>, "clock-frequency:0", -+ <&v7_cpu1>, "clock-frequency:0", -+ <&v7_cpu2>, "clock-frequency:0", -+ <&v7_cpu3>, "clock-frequency:0"; ++&random { ++ status = "okay"; ++}; ++ ++&leds { ++ act_led: act { ++ label = "led0"; ++ linux,default-trigger = "mmc0"; ++ gpios = <&gpio 16 1>; + }; +}; + -+&watchdog { -+ status = "okay"; ++&hdmi { ++ hpd-gpios = <&gpio 46 GPIO_ACTIVE_HIGH>; +}; + -+&intc { -+ compatible = "brcm,bcm2836-armctrl-ic"; -+ interrupt-parent = <&local_intc>; -+ interrupts = <8>; ++/ { ++ __overrides__ { ++ uart0 = <&uart0>,"status"; ++ uart0_clkrate = <&clk_uart0>,"clock-frequency:0"; ++ uart1 = <&uart1>,"status"; ++ i2s = <&i2s>,"status"; ++ spi = <&spi0>,"status"; ++ i2c0 = <&i2c0>,"status"; ++ i2c1 = <&i2c1>,"status"; ++ i2c2_iknowwhatimdoing = <&i2c2>,"status"; ++ i2c0_baudrate = <&i2c0>,"clock-frequency:0"; ++ i2c1_baudrate = <&i2c1>,"clock-frequency:0"; ++ i2c2_baudrate = <&i2c2>,"clock-frequency:0"; ++ core_freq = <&clk_core>,"clock-frequency:0"; ++ ++ act_led_gpio = <&act_led>,"gpios:4"; ++ act_led_activelow = <&act_led>,"gpios:8"; ++ act_led_trigger = <&act_led>,"linux,default-trigger"; ++ ++ audio = <&audio>,"status"; ++ watchdog = <&watchdog>,"status"; ++ random = <&random>,"status"; ++ sd_overclock = <&sdhost>,"brcm,overclock-50:0"; ++ sd_force_pio = <&sdhost>,"brcm,force-pio?"; ++ sd_pio_limit = <&sdhost>,"brcm,pio-limit:0"; ++ sd_debug = <&sdhost>,"brcm,debug"; ++ }; +}; -diff --git a/arch/arm/boot/dts/bcm2835-rpi-cm.dts b/arch/arm/boot/dts/bcm2835-rpi-cm.dts -new file mode 100644 -index 0000000..c6e6860a +diff --git a/arch/arm/boot/dts/bcm2708-rpi-cm.dts b/arch/arm/boot/dts/bcm2708-rpi-cm.dts +new file mode 100755 +index 0000000..cd0e1ac --- /dev/null -+++ b/arch/arm/boot/dts/bcm2835-rpi-cm.dts -@@ -0,0 +1,93 @@ ++++ b/arch/arm/boot/dts/bcm2708-rpi-cm.dts +@@ -0,0 +1,102 @@ +/dts-v1/; + -+#include "bcm2835-rpi-cm.dtsi" ++#include "bcm2708-rpi-cm.dtsi" + +/ { + model = "Raspberry Pi Compute Module"; @@ -110337,10 +113579,15 @@ index 0000000..c6e6860a + +&gpio { + spi0_pins: spi0_pins { -+ brcm,pins = <7 8 9 10 11>; ++ brcm,pins = <9 10 11>; + brcm,function = <4>; /* alt0 */ + }; + ++ spi0_cs_pins: spi0_cs_pins { ++ brcm,pins = <8 7>; ++ brcm,function = <1>; /* output */ ++ }; ++ + i2c0_pins: i2c0 { + brcm,pins = <0 1>; + brcm,function = <4>; @@ -110359,9 +113606,10 @@ index 0000000..c6e6860a + +&spi0 { + pinctrl-names = "default"; -+ pinctrl-0 = <&spi0_pins>; ++ pinctrl-0 = <&spi0_pins &spi0_cs_pins>; ++ cs-gpios = <&gpio 8 1>, <&gpio 7 1>; + -+ spidev@0{ ++ spidev0: spidev@0{ + compatible = "spidev"; + reg = <0>; /* CE0 */ + #address-cells = <1>; @@ -110369,7 +113617,7 @@ index 0000000..c6e6860a + spi-max-frequency = <500000>; + }; + -+ spidev@1{ ++ spidev1: spidev@1{ + compatible = "spidev"; + reg = <1>; /* CE1 */ + #address-cells = <1>; @@ -110400,11 +113648,15 @@ index 0000000..c6e6860a + pinctrl-0 = <&i2s_pins>; +}; + ++&random { ++ status = "okay"; ++}; ++ +/ { + __overrides__ { + uart0 = <&uart0>,"status"; + uart0_clkrate = <&clk_uart0>,"clock-frequency:0"; -+ uart1_clkrate = <&uart1>,"clock-frequency:0"; ++ uart1 = <&uart1>,"status"; + i2s = <&i2s>,"status"; + spi = <&spi0>,"status"; + i2c0 = <&i2c0>,"status"; @@ -110413,16 +113665,29 @@ index 0000000..c6e6860a + i2c0_baudrate = <&i2c0>,"clock-frequency:0"; + i2c1_baudrate = <&i2c1>,"clock-frequency:0"; + i2c2_baudrate = <&i2c2>,"clock-frequency:0"; -+ core_freq = <&clk_core>,"clock-frequency:0"; + }; +}; -diff --git a/arch/arm/boot/dts/bcm2835-rpi-cm.dtsi b/arch/arm/boot/dts/bcm2835-rpi-cm.dtsi +diff --git a/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi b/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi new file mode 100644 -index 0000000..9c4000f +index 0000000..90e330d --- /dev/null -+++ b/arch/arm/boot/dts/bcm2835-rpi-cm.dtsi -@@ -0,0 +1,30 @@ -+#include "bcm2835.dtsi" ++++ b/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi +@@ -0,0 +1,52 @@ ++#include "bcm2708.dtsi" ++ ++&gpio { ++ sdhost_pins: sdhost_pins { ++ brcm,pins = <48 49 50 51 52 53>; ++ brcm,function = <4>; /* alt0 */ ++ }; ++}; ++ ++&gpio { ++ mmc_pins: mmc_pins { ++ brcm,pins = <48 49 50 51 52 53>; ++ brcm,function = <7>; /* alt3 */ ++ }; ++}; + +&leds { + act_led: act { @@ -110432,9 +113697,14 @@ index 0000000..9c4000f + }; +}; + ++ +&mmc { -+ status = "okay"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&mmc_pins>; ++ non-removable; + bus-width = <4>; ++ status = "okay"; ++ brcm,overclock-50 = <0>; +}; + +&fb { @@ -110443,6 +113713,8 @@ index 0000000..9c4000f + +/ { + __overrides__ { ++ core_freq = <&clk_core>,"clock-frequency:0"; ++ + act_led_gpio = <&act_led>,"gpios:4"; + act_led_activelow = <&act_led>,"gpios:8"; + act_led_trigger = <&act_led>,"linux,default-trigger"; @@ -110450,1848 +113722,2556 @@ index 0000000..9c4000f + audio = <&audio>,"status"; + watchdog = <&watchdog>,"status"; + random = <&random>,"status"; ++ sd_overclock = <&mmc>,"brcm,overclock-50:0"; + }; +}; -diff --git a/arch/arm/boot/dts/overlays/Makefile b/arch/arm/boot/dts/overlays/Makefile +diff --git a/arch/arm/boot/dts/bcm2708.dtsi b/arch/arm/boot/dts/bcm2708.dtsi new file mode 100644 -index 0000000..d8c2771 +index 0000000..f5a44cd --- /dev/null -+++ b/arch/arm/boot/dts/overlays/Makefile -@@ -0,0 +1,69 @@ -+ifeq ($(CONFIG_OF),y) ++++ b/arch/arm/boot/dts/bcm2708.dtsi +@@ -0,0 +1,40 @@ ++#include "bcm2708_common.dtsi" + -+# Overlays for the Raspberry Pi platform ++/ { ++ compatible = "brcm,bcm2708"; ++ model = "BCM2708"; + -+ifeq ($(CONFIG_ARCH_BCM2708),y) -+ RPI_DT_OVERLAYS=y -+endif -+ifeq ($(CONFIG_ARCH_BCM2709),y) -+ RPI_DT_OVERLAYS=y -+endif -+ifeq ($(CONFIG_ARCH_BCM2835),y) -+ RPI_DT_OVERLAYS=y -+endif ++ chosen { ++ /* No padding required - the boot loader can do that. */ ++ bootargs = ""; ++ }; + -+dtb-$(RPI_DT_OVERLAYS) += ads7846-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += bmp085_i2c-sensor-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += dht11-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += enc28j60-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += gpio-poweroff-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += hifiberry-amp-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += hifiberry-dac-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += hifiberry-dacplus-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += hifiberry-digi-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += hy28a-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += hy28b-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += i2c-rtc-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += i2s-mmap-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += iqaudio-dac-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += iqaudio-dacplus-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += lirc-rpi-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += mcp2515-can0-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += mcp2515-can1-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += mmc-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += mz61581-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += piscreen-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += pitft28-resistive-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += pps-gpio-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += pwm-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += pwm-2chan-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += raspidac3-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += rpi-dac-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += rpi-display-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += rpi-ft5406-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += rpi-proto-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += rpi-sense-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += sdhost-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += sdio-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += smi-dev-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += smi-nand-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += smi-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += spi-gpio35-39-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += tinylcd35-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += uart1-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += vga666-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += w1-gpio-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += w1-gpio-pullup-overlay.dtb ++ soc { ++ ranges = <0x7e000000 0x20000000 0x01000000>; + -+targets += dtbs dtbs_install -+targets += $(dtb-y) ++ timer@7e003000 { ++ compatible = "brcm,bcm2835-system-timer"; ++ reg = <0x7e003000 0x1000>; ++ interrupts = <1 0>, <1 1>, <1 2>, <1 3>; ++ clock-frequency = <1000000>; ++ }; + -+endif ++ arm-pmu { ++ compatible = "arm,arm1176-pmu"; ++ }; + -+always := $(dtb-y) -+clean-files := *.dtb ++ gpiomem { ++ compatible = "brcm,bcm2835-gpiomem"; ++ reg = <0x7e200000 0x1000>; ++ status = "okay"; ++ }; ++ }; ++}; + -+# Enable fixups to support overlays on BCM2708 platforms -+ifeq ($(RPI_DT_OVERLAYS),y) -+ DTC_FLAGS ?= -@ -+endif -diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README ++&intc { ++ compatible = "brcm,bcm2835-armctrl-ic"; ++}; ++ ++&watchdog { ++ status = "okay"; ++}; +diff --git a/arch/arm/boot/dts/bcm2708_common.dtsi b/arch/arm/boot/dts/bcm2708_common.dtsi new file mode 100644 -index 0000000..44e33a4 +index 0000000..6ea37c5 --- /dev/null -+++ b/arch/arm/boot/dts/overlays/README -@@ -0,0 +1,648 @@ -+Introduction -+============ -+ -+This directory contains Device Tree overlays. Device Tree makes it possible -+to support many hardware configurations with a single kernel and without the -+need to explicitly load or blacklist kernel modules. Note that this isn't a -+"pure" Device Tree configuration (c.f. MACH_BCM2835) - some on-board devices -+are still configured by the board support code, but the intention is to -+eventually reach that goal. ++++ b/arch/arm/boot/dts/bcm2708_common.dtsi +@@ -0,0 +1,438 @@ ++#include "dt-bindings/clock/bcm2835.h" ++#include <dt-bindings/clock/bcm2835-aux.h> ++#include "dt-bindings/power/raspberrypi-power.h" ++#include "dt-bindings/gpio/gpio.h" ++#include "skeleton.dtsi" + -+On Raspberry Pi, Device Tree usage is controlled from /boot/config.txt. By -+default, the Raspberry Pi kernel boots with device tree enabled. You can -+completely disable DT usage (for now) by adding: ++/ { ++ interrupt-parent = <&intc>; + -+ device_tree= ++ aliases { ++ audio = &audio; ++ aux = &aux; ++ sound = &sound; ++ soc = &soc; ++ dma = &dma; ++ intc = &intc; ++ watchdog = &watchdog; ++ random = &random; ++ mailbox = &mailbox; ++ gpio = &gpio; ++ uart0 = &uart0; ++ sdhost = &sdhost; ++ i2s = &i2s; ++ spi0 = &spi0; ++ i2c0 = &i2c0; ++ uart1 = &uart1; ++ spi1 = &spi1; ++ spi2 = &spi2; ++ mmc = &mmc; ++ i2c1 = &i2c1; ++ i2c2 = &i2c2; ++ usb = &usb; ++ leds = &leds; ++ fb = &fb; ++ vchiq = &vchiq; ++ thermal = &thermal; ++ clocks = &clocks; ++ }; + -+to your config.txt, which should cause your Pi to revert to the old way of -+doing things after a reboot. ++ soc: soc { ++ compatible = "simple-bus"; ++ #address-cells = <1>; ++ #size-cells = <1>; + -+In /boot you will find a .dtb for each base platform. This describes the -+hardware that is part of the Raspberry Pi board. The loader (start.elf and its -+siblings) selects the .dtb file appropriate for the platform by name, and reads -+it into memory. At this point, all of the optional interfaces (i2c, i2s, spi) -+are disabled, but they can be enabled using Device Tree parameters: ++ dma: dma@7e007000 { ++ compatible = "brcm,bcm2835-dma"; ++ reg = <0x7e007000 0xf00>; ++ interrupts = <1 16>, ++ <1 17>, ++ <1 18>, ++ <1 19>, ++ <1 20>, ++ <1 21>, ++ <1 22>, ++ <1 23>, ++ <1 24>, ++ <1 25>, ++ <1 26>, ++ <1 27>; + -+ dtparam=i2c=on,i2s=on,spi=on ++ #dma-cells = <1>; ++ brcm,dma-channel-mask = <0x0f35>; ++ }; + -+However, this shouldn't be necessary in many use cases because loading an -+overlay that requires one of those interfaces will cause it to be enabled -+automatically, and it is advisable to only enable interfaces if they are -+needed. ++ intc: interrupt-controller@7e00b200 { ++ compatible = "brcm,bcm2708-armctrl-ic"; ++ reg = <0x7e00b200 0x200>; ++ interrupt-controller; ++ #interrupt-cells = <2>; ++ }; + -+Configuring additional, optional hardware is done using Device Tree overlays -+(see below). ++ mailbox: mailbox@7e00b800 { ++ compatible = "brcm,bcm2835-mbox"; ++ reg = <0x7e00b880 0x40>; ++ interrupts = <0 1>; ++ #mbox-cells = <0>; ++ }; + -+raspi-config -+============ ++ watchdog: watchdog@7e100000 { ++ compatible = "brcm,bcm2835-pm-wdt"; ++ reg = <0x7e100000 0x28>; ++ status = "disabled"; ++ }; + -+The Advanced Options section of the raspi-config utility can enable and disable -+Device Tree use, as well as toggling the I2C and SPI interfaces. Note that it -+is possible to both enable an interface and blacklist the driver, if for some -+reason you should want to defer the loading. ++ cprman: cprman@7e101000 { ++ compatible = "brcm,bcm2835-cprman"; ++ #clock-cells = <1>; ++ reg = <0x7e101000 0x2000>; + -+Modules -+======= ++ /* CPRMAN derives everything from the platform's ++ * oscillator. ++ */ ++ clocks = <&clk_osc>; ++ status = "disabled"; ++ }; + -+As well as describing the hardware, Device Tree also gives enough information -+to allow suitable driver modules to be located and loaded, with the corollary -+that unneeded modules are not loaded. As a result it should be possible to -+remove lines from /etc/modules, and /etc/modprobe.d/raspi-blacklist.conf can -+have its contents deleted (or commented out). ++ random: rng@7e104000 { ++ compatible = "brcm,bcm2835-rng"; ++ reg = <0x7e104000 0x10>; ++ status = "disabled"; ++ }; + -+Using Overlays -+============== ++ gpio: gpio@7e200000 { ++ compatible = "brcm,bcm2835-gpio"; ++ reg = <0x7e200000 0xb4>; ++ interrupts = <2 17>, <2 18>; + -+Overlays are loaded using the "dtoverlay" directive. As an example, consider the -+popular lirc-rpi module, the Linux Infrared Remote Control driver. In the -+pre-DT world this would be loaded from /etc/modules, with an explicit -+"modprobe lirc-rpi" command, or programmatically by lircd. With DT enabled, -+this becomes a line in config.txt: ++ gpio-controller; ++ #gpio-cells = <2>; + -+ dtoverlay=lirc-rpi ++ interrupt-controller; ++ #interrupt-cells = <2>; ++ }; + -+This causes the file /boot/overlays/lirc-rpi-overlay.dtb to be loaded. By -+default it will use GPIOs 17 (out) and 18 (in), but this can be modified using -+DT parameters: ++ uart0: uart@7e201000 { ++ compatible = "arm,pl011", "arm,primecell"; ++ reg = <0x7e201000 0x1000>; ++ interrupts = <2 25>; ++ clocks = <&clk_uart0 &clk_apb_p>; ++ clock-names = "uartclk","apb_pclk"; ++ arm,primecell-periphid = <0x00241011>; // For an explanation, see ++ // https://github.com/raspberrypi/linux/commit/13731d862cf5219216533a3b0de052cee4cc5038 ++ status = "disabled"; ++ }; + -+ dtoverlay=lirc-rpi,gpio_out_pin=17,gpio_in_pin=13 ++ sdhost: sdhost@7e202000 { ++ compatible = "brcm,bcm2835-sdhost"; ++ reg = <0x7e202000 0x100>; ++ interrupts = <2 24>; ++ clocks = <&clk_core>; ++ dmas = <&dma 13>; ++ dma-names = "rx-tx"; ++ brcm,overclock-50 = <0>; ++ brcm,pio-limit = <1>; ++ status = "disabled"; ++ }; + -+Parameters always have default values, although in some cases (e.g. "w1-gpio") -+it is necessary to provided multiple overlays in order to get the desired -+behaviour. See the list of overlays below for a description of the parameters and their defaults. ++ i2s: i2s@7e203000 { ++ compatible = "brcm,bcm2835-i2s"; ++ #sound-dai-cells = <0>; ++ reg = <0x7e203000 0x24>, ++ <0x7e101098 0x08>; + -+The Overlay and Parameter Reference -+=================================== ++ dmas = <&dma 2>, <&dma 3>; ++ dma-names = "tx", "rx"; ++ status = "disabled"; ++ }; + -+N.B. When editing this file, please preserve the indentation levels to make it simple to parse -+programmatically. NO HARD TABS. ++ spi0: spi@7e204000 { ++ compatible = "brcm,bcm2835-spi"; ++ reg = <0x7e204000 0x1000>; ++ interrupts = <2 22>; ++ clocks = <&clk_core>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "disabled"; ++ /* the dma channels */ ++ dmas = <&dma 6>, <&dma 7>; ++ dma-names = "tx", "rx"; ++ /* the chipselects used - <0> means native GPIO ++ * add more gpios if necessary as <&gpio 6 1> ++ * (but do not forget to make them output!) ++ */ ++ cs-gpios = <0>, <0>; ++ }; + ++ i2c0: i2c@7e205000 { ++ compatible = "brcm,bcm2708-i2c"; ++ reg = <0x7e205000 0x1000>; ++ interrupts = <2 21>; ++ clocks = <&clk_core>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "disabled"; ++ }; + -+Name: <The base DTB> -+Info: Configures the base Raspberry Pi hardware -+Load: <loaded automatically> -+Params: -+ audio Set to "on" to enable the onboard ALSA audio -+ interface (default "off") ++ pixelvalve0: pixelvalve@7e206000 { ++ compatible = "brcm,bcm2835-pixelvalve0"; ++ reg = <0x7e206000 0x100>; ++ status = "disabled"; ++ }; + -+ i2c_arm Set to "on" to enable the ARM's i2c interface -+ (default "off") ++ pixelvalve1: pixelvalve@7e207000 { ++ compatible = "brcm,bcm2835-pixelvalve1"; ++ reg = <0x7e207000 0x100>; ++ status = "disabled"; ++ }; + -+ i2c_vc Set to "on" to enable the i2c interface -+ usually reserved for the VideoCore processor -+ (default "off") ++ pwm: pwm@7e20c000 { ++ compatible = "brcm,bcm2835-pwm"; ++ reg = <0x7e20c000 0x28>; ++ clocks = <&clk_pwm>; ++ #pwm-cells = <2>; ++ status = "disabled"; ++ }; + -+ i2c An alias for i2c_arm ++ aux: aux@0x7e215004 { ++ compatible = "brcm,bcm2835-aux"; ++ #clock-cells = <1>; ++ reg = <0x7e215000 0x8>; ++ clocks = <&clk_core>; ++ status = "disabled"; ++ }; + -+ i2c_arm_baudrate Set the baudrate of the ARM's i2c interface -+ (default "100000") ++ uart1: uart@7e215040 { ++ compatible = "brcm,bcm2835-aux-uart", "ns16550"; ++ reg = <0x7e215040 0x40>; ++ interrupts = <1 29>; ++ clocks = <&clk_uart1>; ++ reg-shift = <2>; ++ no-loopback-test; ++ status = "disabled"; ++ }; + -+ i2c_vc_baudrate Set the baudrate of the VideoCore i2c interface -+ (default "100000") ++ spi1: spi@7e215080 { ++ compatible = "brcm,bcm2835-aux-spi"; ++ reg = <0x7e215080 0x40>, <0x7e215000 0x8>; ++ interrupts = <1 29>; ++ clocks = <&aux BCM2835_AUX_CLOCK_SPI1>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "disabled"; ++ }; + -+ i2c_baudrate An alias for i2c_arm_baudrate ++ spi2: spi@7e2150C0 { ++ compatible = "brcm,bcm2835-aux-spi"; ++ reg = <0x7e2150C0 0x40>, <0x7e215000 0x8>; ++ interrupts = <1 29>; ++ clocks = <&aux BCM2835_AUX_CLOCK_SPI2>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "disabled"; ++ }; + -+ i2s Set to "on" to enable the i2s interface -+ (default "off") ++ mmc: mmc@7e300000 { ++ compatible = "brcm,bcm2835-mmc"; ++ reg = <0x7e300000 0x100>; ++ interrupts = <2 30>; ++ clocks = <&clk_mmc>; ++ dmas = <&dma 11>; ++ dma-names = "rx-tx"; ++ brcm,overclock-50 = <0>; ++ status = "disabled"; ++ }; + -+ spi Set to "on" to enable the spi interfaces -+ (default "off") ++ hvs: hvs@7e400000 { ++ compatible = "brcm,bcm2835-hvs"; ++ reg = <0x7e400000 0x6000>; ++ status = "disabled"; ++ }; + -+ random Set to "on" to enable the hardware random -+ number generator (default "off") ++ i2c1: i2c@7e804000 { ++ compatible = "brcm,bcm2708-i2c"; ++ reg = <0x7e804000 0x1000>; ++ interrupts = <2 21>; ++ clocks = <&clk_core>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "disabled"; ++ }; + -+ uart0 Set to "off" to disable uart0 (default "on") ++ i2c2: i2c@7e805000 { ++ // Beware - this is shared with the HDMI module. ++ // Careless use may break (really) your display. ++ // Caveat emptor. ++ compatible = "brcm,bcm2708-i2c"; ++ reg = <0x7e805000 0x1000>; ++ interrupts = <2 21>; ++ clocks = <&clk_core>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "disabled"; ++ }; + -+ watchdog Set to "on" to enable the hardware watchdog -+ (default "off") ++ smi: smi@7e600000 { ++ compatible = "brcm,bcm2835-smi"; ++ reg = <0x7e600000 0x44>, <0x7e1010b0 0x8>; ++ interrupts = <2 16>; ++ brcm,smi-clock-source = <6>; ++ brcm,smi-clock-divisor = <4>; ++ dmas = <&dma 4>; ++ dma-names = "rx-tx"; ++ status = "disabled"; ++ }; + -+ act_led_trigger Choose which activity the LED tracks. -+ Use "heartbeat" for a nice load indicator. -+ (default "mmc") ++ pixelvalve2: pixelvalve@7e807000 { ++ compatible = "brcm,bcm2835-pixelvalve2"; ++ reg = <0x7e807000 0x100>; ++ status = "disabled"; ++ }; + -+ act_led_activelow Set to "on" to invert the sense of the LED -+ (default "off") ++ hdmi: hdmi@7e902000 { ++ compatible = "brcm,bcm2835-hdmi"; ++ reg = <0x7e902000 0x600>, ++ <0x7e808000 0x100>; ++ ddc = <&i2c2>; ++ hpd-gpios = <&gpio 46 GPIO_ACTIVE_HIGH>; ++ clocks = <&cprman BCM2835_PLLH_PIX>, ++ <&cprman BCM2835_CLOCK_HSM>; ++ clock-names = "pixel", "hdmi"; ++ power-domains = <&power RPI_POWER_DOMAIN_HDMI>; ++ status = "disabled"; ++ }; + -+ act_led_gpio Set which GPIO to use for the activity LED -+ (in case you want to connect it to an external -+ device) -+ (default "16" on a non-Plus board, "47" on a -+ Plus or Pi 2) ++ usb: usb@7e980000 { ++ compatible = "brcm,bcm2708-usb"; ++ reg = <0x7e980000 0x10000>, ++ <0x7e006000 0x1000>; ++ interrupts = <2 0>, ++ <1 9>; ++ }; + -+ pwr_led_trigger -+ pwr_led_activelow -+ pwr_led_gpio -+ As for act_led_*, but using the PWR LED. -+ Not available on Model A/B boards. ++ v3d: v3d@7ec00000 { ++ compatible = "brcm,vc4-v3d"; ++ reg = <0x7ec00000 0x1000>; ++ status = "disabled"; ++ }; + -+ N.B. It is recommended to only enable those interfaces that are needed. -+ Leaving all interfaces enabled can lead to unwanted behaviour (i2c_vc -+ interfering with Pi Camera, I2S and SPI hogging GPIO pins, etc.) -+ Note also that i2c, i2c_arm and i2c_vc are aliases for the physical -+ interfaces i2c0 and i2c1. Use of the numeric variants is still possible -+ but deprecated because the ARM/VC assignments differ between board -+ revisions. The same board-specific mapping applies to i2c_baudrate, -+ and the other i2c baudrate parameters. ++ firmware: firmware { ++ compatible = "raspberrypi,bcm2835-firmware"; ++ mboxes = <&mailbox>; ++ }; + ++ power: power { ++ compatible = "raspberrypi,bcm2835-power"; ++ firmware = <&firmware>; ++ #power-domain-cells = <1>; ++ }; + -+Name: ads7846 -+Info: ADS7846 Touch controller -+Load: dtoverlay=ads7846,<param>=<val> -+Params: cs SPI bus Chip Select (default 1) -+ speed SPI bus speed (default 2Mhz, max 3.25MHz) -+ penirq GPIO used for PENIRQ. REQUIRED -+ penirq_pull Set GPIO pull (default 0=none, 2=pullup) -+ swapxy Swap x and y axis -+ xmin Minimum value on the X axis (default 0) -+ ymin Minimum value on the Y axis (default 0) -+ xmax Maximum value on the X axis (default 4095) -+ ymax Maximum value on the Y axis (default 4095) -+ pmin Minimum reported pressure value (default 0) -+ pmax Maximum reported pressure value (default 65535) -+ xohms Touchpanel sensitivity (X-plate resistance) -+ (default 400) ++ leds: leds { ++ compatible = "gpio-leds"; ++ }; + -+ penirq is required and usually xohms (60-100) has to be set as well. -+ Apart from that, pmax (255) and swapxy are also common. -+ The rest of the calibration can be done with xinput-calibrator. -+ See: github.com/notro/fbtft/wiki/FBTFT-on-Raspian -+ Device Tree binding document: -+ www.kernel.org/doc/Documentation/devicetree/bindings/input/ads7846.txt ++ fb: fb { ++ compatible = "brcm,bcm2708-fb"; ++ firmware = <&firmware>; ++ status = "disabled"; ++ }; + ++ vchiq: vchiq { ++ compatible = "brcm,bcm2835-vchiq"; ++ reg = <0x7e00b840 0xf>; ++ interrupts = <0 2>; ++ cache-line-size = <32>; ++ firmware = <&firmware>; ++ }; + -+Name: bmp085_i2c-sensor -+Info: Configures the BMP085/BMP180 digital barometric pressure and temperature -+ sensors from Bosch Sensortec -+Load: dtoverlay=bmp085_i2c-sensor -+Params: <None> ++ thermal: thermal { ++ compatible = "brcm,bcm2835-thermal"; ++ firmware = <&firmware>; ++ }; + ++ gpu: gpu { ++ compatible = "brcm,bcm2835-vc4"; ++ status = "disabled"; ++ }; + -+Name: dht11 -+Info: Overlay for the DHT11/DHT21/DHT22 humidity/temperature sensors -+ Also sometimes found with the part number(s) AM230x. -+Load: dtoverlay=dht11,<param>=<val> -+Params: gpiopin GPIO connected to the sensor's DATA output. -+ (default 4) ++ /* Onboard audio */ ++ audio: audio { ++ compatible = "brcm,bcm2835-audio"; ++ brcm,pwm-channels = <8>; ++ status = "disabled"; ++ }; + ++ /* External sound card */ ++ sound: sound { ++ status = "disabled"; ++ }; ++ }; + -+[ The ds1307-rtc overlay has been deleted. See i2c-rtc. ] ++ clocks: clocks { ++ compatible = "simple-bus"; ++ #address-cells = <1>; ++ #size-cells = <0>; + ++ clk_core: clock@0 { ++ compatible = "fixed-clock"; ++ reg = <0>; ++ #clock-cells = <0>; ++ clock-output-names = "core"; ++ clock-frequency = <250000000>; ++ }; + -+Name: enc28j60 -+Info: Overlay for the Microchip ENC28J60 Ethernet Controller (SPI) -+Load: dtoverlay=enc28j60,<param>=<val> -+Params: int_pin GPIO used for INT (default 25) ++ clk_mmc: clock@1 { ++ compatible = "fixed-clock"; ++ reg = <1>; ++ #clock-cells = <0>; ++ clock-output-names = "mmc"; ++ clock-frequency = <250000000>; ++ }; + -+ speed SPI bus speed (default 12000000) ++ clk_uart0: clock@2 { ++ compatible = "fixed-clock"; ++ reg = <2>; ++ #clock-cells = <0>; ++ clock-output-names = "uart0_pclk"; ++ clock-frequency = <3000000>; ++ }; + ++ clk_apb_p: clock@3 { ++ compatible = "fixed-clock"; ++ reg = <3>; ++ #clock-cells = <0>; ++ clock-output-names = "apb_pclk"; ++ clock-frequency = <126000000>; ++ }; + -+Name: gpio-poweroff -+Info: Drives a GPIO high or low on reboot -+Load: dtoverlay=gpio-poweroff,<param>=<val> -+Params: gpiopin GPIO for signalling (default 26) ++ clk_pwm: clock@4 { ++ compatible = "fixed-clock"; ++ reg = <4>; ++ #clock-cells = <0>; ++ clock-output-names = "pwm"; ++ clock-frequency = <100000000>; ++ }; + -+ active_low Set if the power control device requires a -+ high->low transition to trigger a power-down. -+ Note that this will require the support of a -+ custom dt-blob.bin to prevent a power-down -+ during the boot process, and that a reboot -+ will also cause the pin to go low. ++ clk_uart1: clock@5 { ++ compatible = "fixed-factor-clock"; ++ reg = <5>; ++ clocks = <&clk_core>; ++ #clock-cells = <0>; ++ clock-div = <1>; ++ clock-mult = <2>; ++ }; + ++ /* The oscillator is the root of the clock tree. */ ++ clk_osc: clock@6 { ++ compatible = "fixed-clock"; ++ reg = <6>; ++ #clock-cells = <0>; ++ clock-output-names = "osc"; ++ clock-frequency = <19200000>; ++ }; ++ }; + -+Name: hifiberry-amp -+Info: Configures the HifiBerry Amp and Amp+ audio cards -+Load: dtoverlay=hifiberry-amp -+Params: <None> ++ __overrides__ { ++ cache_line_size = <&vchiq>, "cache-line-size:0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/bcm2709-rpi-2-b.dts b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts +new file mode 100644 +index 0000000..5e23c04 +--- /dev/null ++++ b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts +@@ -0,0 +1,154 @@ ++/dts-v1/; + ++#include "bcm2709.dtsi" + -+Name: hifiberry-dac -+Info: Configures the HifiBerry DAC audio card -+Load: dtoverlay=hifiberry-dac -+Params: <None> ++/ { ++ compatible = "brcm,bcm2709"; ++ model = "Raspberry Pi 2 Model B"; ++}; + ++&gpio { ++ sdhost_pins: sdhost_pins { ++ brcm,pins = <48 49 50 51 52 53>; ++ brcm,function = <4>; /* alt0 */ ++ }; + -+Name: hifiberry-dacplus -+Info: Configures the HifiBerry DAC+ audio card -+Load: dtoverlay=hifiberry-dacplus -+Params: <None> ++ spi0_pins: spi0_pins { ++ brcm,pins = <9 10 11>; ++ brcm,function = <4>; /* alt0 */ ++ }; + ++ spi0_cs_pins: spi0_cs_pins { ++ brcm,pins = <8 7>; ++ brcm,function = <1>; /* output */ ++ }; + -+Name: hifiberry-digi -+Info: Configures the HifiBerry Digi audio card -+Load: dtoverlay=hifiberry-digi -+Params: <None> ++ i2c0_pins: i2c0 { ++ brcm,pins = <0 1>; ++ brcm,function = <4>; ++ }; + ++ i2c1_pins: i2c1 { ++ brcm,pins = <2 3>; ++ brcm,function = <4>; ++ }; + -+Name: hy28a -+Info: HY28A - 2.8" TFT LCD Display Module by HAOYU Electronics -+ Default values match Texy's display shield -+Load: dtoverlay=hy28a,<param>=<val> -+Params: speed Display SPI bus speed ++ i2s_pins: i2s { ++ brcm,pins = <18 19 20 21>; ++ brcm,function = <4>; /* alt0 */ ++ }; ++}; + -+ rotate Display rotation {0,90,180,270} ++&sdhost { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&sdhost_pins>; ++ bus-width = <4>; ++ status = "okay"; ++}; + -+ fps Delay between frame updates ++&fb { ++ status = "okay"; ++}; + -+ debug Debug output level {0-7} ++&uart0 { ++ status = "okay"; ++}; + -+ xohms Touchpanel sensitivity (X-plate resistance) ++&spi0 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&spi0_pins &spi0_cs_pins>; ++ cs-gpios = <&gpio 8 1>, <&gpio 7 1>; + -+ resetgpio GPIO used to reset controller ++ spidev0: spidev@0{ ++ compatible = "spidev"; ++ reg = <0>; /* CE0 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ }; + -+ ledgpio GPIO used to control backlight ++ spidev1: spidev@1{ ++ compatible = "spidev"; ++ reg = <1>; /* CE1 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ }; ++}; + ++&i2c0 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2c0_pins>; ++ clock-frequency = <100000>; ++}; + -+Name: hy28b -+Info: HY28B - 2.8" TFT LCD Display Module by HAOYU Electronics -+ Default values match Texy's display shield -+Load: dtoverlay=hy28b,<param>=<val> -+Params: speed Display SPI bus speed ++&i2c1 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2c1_pins>; ++ clock-frequency = <100000>; ++}; + -+ rotate Display rotation {0,90,180,270} ++&i2c2 { ++ clock-frequency = <100000>; ++}; + -+ fps Delay between frame updates ++&i2s { ++ #sound-dai-cells = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2s_pins>; ++}; + -+ debug Debug output level {0-7} ++&random { ++ status = "okay"; ++}; + -+ xohms Touchpanel sensitivity (X-plate resistance) ++&leds { ++ act_led: act { ++ label = "led0"; ++ linux,default-trigger = "mmc0"; ++ gpios = <&gpio 47 0>; ++ }; + -+ resetgpio GPIO used to reset controller ++ pwr_led: pwr { ++ label = "led1"; ++ linux,default-trigger = "input"; ++ gpios = <&gpio 35 0>; ++ }; ++}; + -+ ledgpio GPIO used to control backlight ++&hdmi { ++ hpd-gpios = <&gpio 46 GPIO_ACTIVE_LOW>; ++}; + ++/ { ++ __overrides__ { ++ uart0 = <&uart0>,"status"; ++ uart0_clkrate = <&clk_uart0>,"clock-frequency:0"; ++ uart1 = <&uart1>,"status"; ++ i2s = <&i2s>,"status"; ++ spi = <&spi0>,"status"; ++ i2c0 = <&i2c0>,"status"; ++ i2c1 = <&i2c1>,"status"; ++ i2c2_iknowwhatimdoing = <&i2c2>,"status"; ++ i2c0_baudrate = <&i2c0>,"clock-frequency:0"; ++ i2c1_baudrate = <&i2c1>,"clock-frequency:0"; ++ i2c2_baudrate = <&i2c2>,"clock-frequency:0"; ++ core_freq = <&clk_core>,"clock-frequency:0"; + -+Name: i2c-rtc -+Info: Adds support for a number of I2C Real Time Clock devices -+Load: dtoverlay=i2c-rtc,<param> -+Params: ds1307 Select the DS1307 device ++ act_led_gpio = <&act_led>,"gpios:4"; ++ act_led_activelow = <&act_led>,"gpios:8"; ++ act_led_trigger = <&act_led>,"linux,default-trigger"; + -+ ds3231 Select the DS3231 device ++ pwr_led_gpio = <&pwr_led>,"gpios:4"; ++ pwr_led_activelow = <&pwr_led>,"gpios:8"; ++ pwr_led_trigger = <&pwr_led>,"linux,default-trigger"; + -+ mcp7941x Select the MCP7941x device ++ audio = <&audio>,"status"; ++ watchdog = <&watchdog>,"status"; ++ random = <&random>,"status"; ++ sd_overclock = <&sdhost>,"brcm,overclock-50:0"; ++ sd_force_pio = <&sdhost>,"brcm,force-pio?"; ++ sd_pio_limit = <&sdhost>,"brcm,pio-limit:0"; ++ sd_debug = <&sdhost>,"brcm,debug"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/bcm2709.dtsi b/arch/arm/boot/dts/bcm2709.dtsi +new file mode 100644 +index 0000000..a8cfd7c +--- /dev/null ++++ b/arch/arm/boot/dts/bcm2709.dtsi +@@ -0,0 +1,102 @@ ++#include "bcm2708_common.dtsi" + -+ pcf2127 Select the PCF2127 device ++/ { ++ compatible = "brcm,bcm2709"; ++ model = "BCM2709"; + -+ pcf8523 Select the PCF8523 device ++ chosen { ++ /* No padding required - the boot loader can do that. */ ++ bootargs = ""; ++ }; + -+ pcf8563 Select the PCF8563 device ++ soc { ++ ranges = <0x7e000000 0x3f000000 0x01000000>, ++ <0x40000000 0x40000000 0x00040000>; + ++ local_intc: local_intc { ++ compatible = "brcm,bcm2836-l1-intc"; ++ reg = <0x40000000 0x100>; ++ interrupt-controller; ++ #interrupt-cells = <1>; ++ interrupt-parent = <&local_intc>; ++ }; + -+Name: i2s-mmap -+Info: Enables mmap support in the bcm2708-i2s driver -+Load: dtoverlay=i2s-mmap -+Params: <None> ++ arm-pmu { ++ compatible = "arm,cortex-a7-pmu"; ++ interrupt-parent = <&local_intc>; ++ interrupts = <9>; ++ }; + ++ gpiomem { ++ compatible = "brcm,bcm2835-gpiomem"; ++ reg = <0x7e200000 0x1000>; ++ status = "okay"; ++ }; + -+Name: iqaudio-dac -+Info: Configures the IQaudio DAC audio card -+Load: dtoverlay=iqaudio-dac -+Params: <None> ++ timer { ++ compatible = "arm,armv7-timer"; ++ clock-frequency = <19200000>; ++ interrupt-parent = <&local_intc>; ++ interrupts = <0>, // PHYS_SECURE_PPI ++ <1>, // PHYS_NONSECURE_PPI ++ <3>, // VIRT_PPI ++ <2>; // HYP_PPI ++ always-on; ++ }; + ++ syscon@40000000 { ++ compatible = "brcm,bcm2836-arm-local", "syscon"; ++ reg = <0x40000000 0x100>; ++ }; ++ }; + -+Name: iqaudio-dacplus -+Info: Configures the IQaudio DAC+ audio card -+Load: dtoverlay=iqaudio-dacplus -+Params: <None> ++ cpus: cpus { ++ #address-cells = <1>; ++ #size-cells = <0>; + ++ v7_cpu0: cpu@0 { ++ device_type = "cpu"; ++ compatible = "arm,cortex-a7"; ++ reg = <0xf00>; ++ clock-frequency = <800000000>; ++ }; + -+Name: lirc-rpi -+Info: Configures lirc-rpi (Linux Infrared Remote Control for Raspberry Pi) -+ Consult the module documentation for more details. -+Load: dtoverlay=lirc-rpi,<param>=<val>,... -+Params: gpio_out_pin GPIO for output (default "17") ++ v7_cpu1: cpu@1 { ++ device_type = "cpu"; ++ compatible = "arm,cortex-a7"; ++ reg = <0xf01>; ++ clock-frequency = <800000000>; ++ }; + -+ gpio_in_pin GPIO for input (default "18") ++ v7_cpu2: cpu@2 { ++ device_type = "cpu"; ++ compatible = "arm,cortex-a7"; ++ reg = <0xf02>; ++ clock-frequency = <800000000>; ++ }; + -+ gpio_in_pull Pull up/down/off on the input pin -+ (default "down") ++ v7_cpu3: cpu@3 { ++ device_type = "cpu"; ++ compatible = "arm,cortex-a7"; ++ reg = <0xf03>; ++ clock-frequency = <800000000>; ++ }; ++ }; + -+ sense Override the IR receive auto-detection logic: -+ "0" = force active-high -+ "1" = force active-low -+ "-1" = use auto-detection -+ (default "-1") ++ __overrides__ { ++ arm_freq = <&v7_cpu0>, "clock-frequency:0", ++ <&v7_cpu1>, "clock-frequency:0", ++ <&v7_cpu2>, "clock-frequency:0", ++ <&v7_cpu3>, "clock-frequency:0"; ++ }; ++}; + -+ softcarrier Turn the software carrier "on" or "off" -+ (default "on") ++&watchdog { ++ status = "okay"; ++}; + -+ invert "on" = invert the output pin (default "off") ++&intc { ++ compatible = "brcm,bcm2836-armctrl-ic"; ++ interrupt-parent = <&local_intc>; ++ interrupts = <8>; ++}; +diff --git a/arch/arm/boot/dts/bcm2710-rpi-3-b.dts b/arch/arm/boot/dts/bcm2710-rpi-3-b.dts +new file mode 100644 +index 0000000..0979a27 +--- /dev/null ++++ b/arch/arm/boot/dts/bcm2710-rpi-3-b.dts +@@ -0,0 +1,201 @@ ++/dts-v1/; + -+ debug "on" = enable additional debug messages -+ (default "off") ++#include "bcm2710.dtsi" + ++/ { ++ compatible = "brcm,bcm2710","brcm,bcm2709"; ++ model = "Raspberry Pi 3 Model B"; ++}; + -+Name: mcp2515-can0 -+Info: Configures the MCP2515 CAN controller on spi0.0 -+Load: dtoverlay=mcp2515-can0,<param>=<val> -+Params: oscillator Clock frequency for the CAN controller (Hz) ++&gpio { ++ sdhost_pins: sdhost_pins { ++ brcm,pins = <48 49 50 51 52 53>; ++ brcm,function = <4>; /* alt0 */ ++ }; + -+ spimaxfrequency Maximum SPI frequence (Hz) ++ spi0_pins: spi0_pins { ++ brcm,pins = <9 10 11>; ++ brcm,function = <4>; /* alt0 */ ++ }; + -+ interrupt GPIO for interrupt signal ++ spi0_cs_pins: spi0_cs_pins { ++ brcm,pins = <8 7>; ++ brcm,function = <1>; /* output */ ++ }; + ++ i2c0_pins: i2c0 { ++ brcm,pins = <0 1>; ++ brcm,function = <4>; ++ }; + -+Name: mcp2515-can1 -+Info: Configures the MCP2515 CAN controller on spi0.1 -+Load: dtoverlay=mcp2515-can1,<param>=<val> -+Params: oscillator Clock frequency for the CAN controller (Hz) ++ i2c1_pins: i2c1 { ++ brcm,pins = <2 3>; ++ brcm,function = <4>; ++ }; + -+ spimaxfrequency Maximum SPI frequence (Hz) ++ i2s_pins: i2s { ++ brcm,pins = <18 19 20 21>; ++ brcm,function = <4>; /* alt0 */ ++ }; + -+ interrupt GPIO for interrupt signal ++ sdio_pins: sdio_pins { ++ brcm,pins = <34 35 36 37 38 39>; ++ brcm,function = <7>; // alt3 = SD1 ++ brcm,pull = <0 2 2 2 2 2>; ++ }; + ++ bt_pins: bt_pins { ++ brcm,pins = <43>; ++ brcm,function = <4>; /* alt0:GPCLK2 */ ++ brcm,pull = <0>; ++ }; + -+Name: mmc -+Info: Selects the bcm2835-mmc SD/MMC driver, optionally with overclock -+Load: dtoverlay=mmc,<param>=<val> -+Params: overclock_50 Clock (in MHz) to use when the MMC framework -+ requests 50MHz -+ force_pio Disable DMA support ++ uart0_pins: uart0_pins { ++ brcm,pins = <32 33>; ++ brcm,function = <7>; /* alt3=UART0 */ ++ brcm,pull = <0 2>; ++ }; + ++ uart1_pins: uart1_pins { ++ brcm,pins; ++ brcm,function; ++ brcm,pull; ++ }; ++}; + -+Name: mz61581 -+Info: MZ61581 display by Tontec -+Load: dtoverlay=mz61581,<param>=<val> -+Params: speed Display SPI bus speed ++&sdhost { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&sdhost_pins>; ++ bus-width = <4>; ++ status = "okay"; ++}; + -+ rotate Display rotation {0,90,180,270} ++&mmc { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&sdio_pins>; ++ non-removable; ++ bus-width = <4>; ++ status = "okay"; ++ brcm,overclock-50 = <0>; ++}; + -+ fps Delay between frame updates ++&soc { ++ virtgpio: virtgpio { ++ compatible = "brcm,bcm2835-virtgpio"; ++ gpio-controller; ++ #gpio-cells = <2>; ++ firmware = <&firmware>; ++ status = "okay"; ++ }; ++}; + -+ txbuflen Transmit buffer length (default 32768) ++&fb { ++ status = "okay"; ++}; + -+ debug Debug output level {0-7} ++&uart0 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&uart0_pins &bt_pins>; ++ status = "okay"; ++}; + -+ xohms Touchpanel sensitivity (X-plate resistance) ++&uart1 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&uart1_pins>; ++ status = "okay"; ++}; + ++&spi0 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&spi0_pins &spi0_cs_pins>; ++ cs-gpios = <&gpio 8 1>, <&gpio 7 1>; + -+[ The pcf2127-rtc overlay has been deleted. See i2c-rtc. ] ++ spidev0: spidev@0{ ++ compatible = "spidev"; ++ reg = <0>; /* CE0 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ }; + ++ spidev1: spidev@1{ ++ compatible = "spidev"; ++ reg = <1>; /* CE1 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ }; ++}; + -+[ The pcf8523-rtc overlay has been deleted. See i2c-rtc. ] ++&i2c0 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2c0_pins>; ++ clock-frequency = <100000>; ++}; + ++&i2c1 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2c1_pins>; ++ clock-frequency = <100000>; ++}; + -+[ The pcf8563-rtc overlay has been deleted. See i2c-rtc. ] ++&i2c2 { ++ clock-frequency = <100000>; ++}; + ++&i2s { ++ #sound-dai-cells = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2s_pins>; ++}; + -+Name: piscreen -+Info: PiScreen display by OzzMaker.com -+Load: dtoverlay=piscreen,<param>=<val> -+Params: speed Display SPI bus speed ++&random { ++ status = "okay"; ++}; + -+ rotate Display rotation {0,90,180,270} ++&leds { ++ act_led: act { ++ label = "led0"; ++ linux,default-trigger = "mmc0"; ++ gpios = <&virtgpio 0 0>; ++ }; ++}; + -+ fps Delay between frame updates ++&hdmi { ++ hpd-gpios = <&gpio 46 GPIO_ACTIVE_LOW>; ++}; + -+ debug Debug output level {0-7} ++/ { ++ chosen { ++ bootargs = "8250.nr_uarts=1"; ++ }; ++}; + -+ xohms Touchpanel sensitivity (X-plate resistance) ++/ { ++ __overrides__ { ++ uart0 = <&uart0>,"status"; ++ uart0_clkrate = <&clk_uart0>,"clock-frequency:0"; ++ uart1 = <&uart1>,"status"; ++ i2s = <&i2s>,"status"; ++ spi = <&spi0>,"status"; ++ i2c0 = <&i2c0>,"status"; ++ i2c1 = <&i2c1>,"status"; ++ i2c2_iknowwhatimdoing = <&i2c2>,"status"; ++ i2c0_baudrate = <&i2c0>,"clock-frequency:0"; ++ i2c1_baudrate = <&i2c1>,"clock-frequency:0"; ++ i2c2_baudrate = <&i2c2>,"clock-frequency:0"; ++ core_freq = <&clk_core>,"clock-frequency:0"; + ++ act_led_gpio = <&act_led>,"gpios:4"; ++ act_led_activelow = <&act_led>,"gpios:8"; ++ act_led_trigger = <&act_led>,"linux,default-trigger"; + -+Name: pitft28-resistive -+Info: Adafruit PiTFT 2.8" resistive touch screen -+Load: dtoverlay=pitft28-resistive,<param>=<val> -+Params: speed Display SPI bus speed ++ audio = <&audio>,"status"; ++ watchdog = <&watchdog>,"status"; ++ random = <&random>,"status"; ++ sd_overclock = <&sdhost>,"brcm,overclock-50:0"; ++ sd_force_pio = <&sdhost>,"brcm,force-pio?"; ++ sd_pio_limit = <&sdhost>,"brcm,pio-limit:0"; ++ sd_debug = <&sdhost>,"brcm,debug"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/bcm2710.dtsi b/arch/arm/boot/dts/bcm2710.dtsi +new file mode 100644 +index 0000000..1a48686 +--- /dev/null ++++ b/arch/arm/boot/dts/bcm2710.dtsi +@@ -0,0 +1,102 @@ ++#include "bcm2708_common.dtsi" + -+ rotate Display rotation {0,90,180,270} ++/ { ++ compatible = "brcm,bcm2710","brcm,bcm2709"; ++ model = "BCM2710"; + -+ fps Delay between frame updates ++ chosen { ++ /* No padding required - the boot loader can do that. */ ++ bootargs = ""; ++ }; + -+ debug Debug output level {0-7} ++ soc { ++ ranges = <0x7e000000 0x3f000000 0x01000000>, ++ <0x40000000 0x40000000 0x00040000>; + ++ local_intc: local_intc { ++ compatible = "brcm,bcm2836-l1-intc"; ++ reg = <0x40000000 0x100>; ++ interrupt-controller; ++ #interrupt-cells = <1>; ++ interrupt-parent = <&local_intc>; ++ }; + -+Name: pps-gpio -+Info: Configures the pps-gpio (pulse-per-second time signal via GPIO). -+Load: dtoverlay=pps-gpio,<param>=<val> -+Params: gpiopin Input GPIO (default "18") ++ arm-pmu { ++ compatible = "arm,cortex-a7-pmu"; ++ interrupt-parent = <&local_intc>; ++ interrupts = <9>; ++ }; + ++ gpiomem { ++ compatible = "brcm,bcm2835-gpiomem"; ++ reg = <0x7e200000 0x1000>; ++ status = "okay"; ++ }; + -+Name: pwm -+Info: Configures a single PWM channel -+ Legal pin,function combinations for each channel: -+ PWM0: 12,4(Alt0) 18,2(Alt5) 40,4(Alt0) 52,5(Alt1) -+ PWM1: 13,4(Alt0) 19,2(Alt5) 41,4(Alt0) 45,4(Alt0) 53,5(Alt1) -+ N.B.: -+ 1) Pin 18 is the only one available on all platforms, and -+ it is the one used by the I2S audio interface. -+ Pins 12 and 13 might be better choices on an A+, B+ or Pi2. -+ 2) The onboard analogue audio output uses both PWM channels. -+ 3) So be careful mixing audio and PWM. -+ 4) Currently the clock must have been enabled and configured -+ by other means. -+Load: dtoverlay=pwm,<param>=<val> -+Params: pin Output pin (default 18) - see table -+ func Pin function (default 2 = Alt5) - see above -+ clock PWM clock frequency (informational) ++ timer { ++ compatible = "arm,armv7-timer"; ++ clock-frequency = <19200000>; ++ interrupt-parent = <&local_intc>; ++ interrupts = <0>, // PHYS_SECURE_PPI ++ <1>, // PHYS_NONSECURE_PPI ++ <3>, // VIRT_PPI ++ <2>; // HYP_PPI ++ always-on; ++ }; + ++ syscon@40000000 { ++ compatible = "brcm,bcm2836-arm-local", "syscon"; ++ reg = <0x40000000 0x100>; ++ }; ++ }; + -+Name: pwm-2chan -+Info: Configures both PWM channels -+ Legal pin,function combinations for each channel: -+ PWM0: 12,4(Alt0) 18,2(Alt5) 40,4(Alt0) 52,5(Alt1) -+ PWM1: 13,4(Alt0) 19,2(Alt5) 41,4(Alt0) 45,4(Alt0) 53,5(Alt1) -+ N.B.: -+ 1) Pin 18 is the only one available on all platforms, and -+ it is the one used by the I2S audio interface. -+ Pins 12 and 13 might be better choices on an A+, B+ or Pi2. -+ 2) The onboard analogue audio output uses both PWM channels. -+ 3) So be careful mixing audio and PWM. -+ 4) Currently the clock must have been enabled and configured -+ by other means. -+Load: dtoverlay=pwm-2chan,<param>=<val> -+Params: pin Output pin (default 18) - see table -+ pin2 Output pin for other channel (default 19) -+ func Pin function (default 2 = Alt5) - see above -+ func2 Function for pin2 (default 2 = Alt5) -+ clock PWM clock frequency (informational) ++ cpus: cpus { ++ #address-cells = <1>; ++ #size-cells = <0>; + ++ v7_cpu0: cpu@0 { ++ device_type = "cpu"; ++ compatible = "arm,cortex-a7"; ++ reg = <0x000>; ++ clock-frequency = <800000000>; ++ }; + -+Name: raspidac3 -+Info: Configures the RaspiDAV Rev.3x audio card -+Load: dtoverlay=raspidac3 -+Params: <None> ++ v7_cpu1: cpu@1 { ++ device_type = "cpu"; ++ compatible = "arm,cortex-a7"; ++ reg = <0x001>; ++ clock-frequency = <800000000>; ++ }; + ++ v7_cpu2: cpu@2 { ++ device_type = "cpu"; ++ compatible = "arm,cortex-a7"; ++ reg = <0x002>; ++ clock-frequency = <800000000>; ++ }; + -+Name: rpi-dac -+Info: Configures the RPi DAC audio card -+Load: dtoverlay=rpi-dac -+Params: <None> ++ v7_cpu3: cpu@3 { ++ device_type = "cpu"; ++ compatible = "arm,cortex-a7"; ++ reg = <0x003>; ++ clock-frequency = <800000000>; ++ }; ++ }; + ++ __overrides__ { ++ arm_freq = <&v7_cpu0>, "clock-frequency:0", ++ <&v7_cpu1>, "clock-frequency:0", ++ <&v7_cpu2>, "clock-frequency:0", ++ <&v7_cpu3>, "clock-frequency:0"; ++ }; ++}; + -+Name: rpi-display -+Info: RPi-Display - 2.8" Touch Display by Watterott -+Load: dtoverlay=rpi-display,<param>=<val> -+Params: speed Display SPI bus speed ++&watchdog { ++ status = "okay"; ++}; + -+ rotate Display rotation {0,90,180,270} ++&intc { ++ compatible = "brcm,bcm2836-armctrl-ic"; ++ interrupt-parent = <&local_intc>; ++ interrupts = <8>; ++}; +diff --git a/arch/arm/boot/dts/bcm2835-rpi-cm.dts b/arch/arm/boot/dts/bcm2835-rpi-cm.dts +new file mode 100644 +index 0000000..c6e6860 +--- /dev/null ++++ b/arch/arm/boot/dts/bcm2835-rpi-cm.dts +@@ -0,0 +1,93 @@ ++/dts-v1/; + -+ fps Delay between frame updates ++#include "bcm2835-rpi-cm.dtsi" + -+ debug Debug output level {0-7} ++/ { ++ model = "Raspberry Pi Compute Module"; ++}; + -+ xohms Touchpanel sensitivity (X-plate resistance) ++&uart0 { ++ status = "okay"; ++}; + ++&gpio { ++ spi0_pins: spi0_pins { ++ brcm,pins = <7 8 9 10 11>; ++ brcm,function = <4>; /* alt0 */ ++ }; + -+Name: rpi-ft5406 -+Info: Official Raspberry Pi display touchscreen -+Load: dtoverlay=rpi-ft5406 -+Params: <None> ++ i2c0_pins: i2c0 { ++ brcm,pins = <0 1>; ++ brcm,function = <4>; ++ }; + ++ i2c1_pins: i2c1 { ++ brcm,pins = <2 3>; ++ brcm,function = <4>; ++ }; + -+Name: rpi-proto -+Info: Configures the RPi Proto audio card -+Load: dtoverlay=rpi-proto -+Params: <None> ++ i2s_pins: i2s { ++ brcm,pins = <18 19 20 21>; ++ brcm,function = <4>; /* alt0 */ ++ }; ++}; + ++&spi0 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&spi0_pins>; + -+Name: rpi-sense -+Info: Raspberry Pi Sense HAT -+Load: dtoverlay=rpi-sense -+Params: <None> ++ spidev@0{ ++ compatible = "spidev"; ++ reg = <0>; /* CE0 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ }; + ++ spidev@1{ ++ compatible = "spidev"; ++ reg = <1>; /* CE1 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ }; ++}; + -+Name: sdhost -+Info: Selects the bcm2835-sdhost SD/MMC driver, optionally with overclock -+Load: dtoverlay=sdhost,<param>=<val> -+Params: overclock_50 Clock (in MHz) to use when the MMC framework -+ requests 50MHz ++&i2c0 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2c0_pins>; ++ clock-frequency = <100000>; ++}; + -+ force_pio Disable DMA support (default off) ++&i2c1 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2c1_pins>; ++ clock-frequency = <100000>; ++}; + -+ pio_limit Number of blocks above which to use DMA -+ (default 1) ++&i2c2 { ++ clock-frequency = <100000>; ++}; + -+ debug Enable debug output (default off) ++&i2s { ++ #sound-dai-cells = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2s_pins>; ++}; + ++/ { ++ __overrides__ { ++ uart0 = <&uart0>,"status"; ++ uart0_clkrate = <&clk_uart0>,"clock-frequency:0"; ++ uart1_clkrate = <&uart1>,"clock-frequency:0"; ++ i2s = <&i2s>,"status"; ++ spi = <&spi0>,"status"; ++ i2c0 = <&i2c0>,"status"; ++ i2c1 = <&i2c1>,"status"; ++ i2c2_iknowwhatimdoing = <&i2c2>,"status"; ++ i2c0_baudrate = <&i2c0>,"clock-frequency:0"; ++ i2c1_baudrate = <&i2c1>,"clock-frequency:0"; ++ i2c2_baudrate = <&i2c2>,"clock-frequency:0"; ++ core_freq = <&clk_core>,"clock-frequency:0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/bcm2835-rpi-cm.dtsi b/arch/arm/boot/dts/bcm2835-rpi-cm.dtsi +new file mode 100644 +index 0000000..9c4000f +--- /dev/null ++++ b/arch/arm/boot/dts/bcm2835-rpi-cm.dtsi +@@ -0,0 +1,30 @@ ++#include "bcm2835.dtsi" + -+Name: sdio -+Info: Selects the bcm2835-sdhost SD/MMC driver, optionally with overclock, -+ and enables SDIO via GPIOs 22-27. -+Load: dtoverlay=sdio,<param>=<val> -+Params: overclock_50 Clock (in MHz) to use when the MMC framework -+ requests 50MHz ++&leds { ++ act_led: act { ++ label = "led0"; ++ linux,default-trigger = "mmc0"; ++ gpios = <&gpio 47 0>; ++ }; ++}; + -+ force_pio Disable DMA support (default off) ++&mmc { ++ status = "okay"; ++ bus-width = <4>; ++}; + -+ pio_limit Number of blocks above which to use DMA -+ (default 1) ++&fb { ++ status = "okay"; ++}; + -+ debug Enable debug output (default off) ++/ { ++ __overrides__ { ++ act_led_gpio = <&act_led>,"gpios:4"; ++ act_led_activelow = <&act_led>,"gpios:8"; ++ act_led_trigger = <&act_led>,"linux,default-trigger"; + -+ poll_once Disable SDIO-device polling every second -+ (default on: polling once at boot-time) ++ audio = <&audio>,"status"; ++ watchdog = <&watchdog>,"status"; ++ random = <&random>,"status"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/Makefile b/arch/arm/boot/dts/overlays/Makefile +new file mode 100644 +index 0000000..0adb5b9 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/Makefile +@@ -0,0 +1,99 @@ ++ifeq ($(CONFIG_OF),y) + ++# Overlays for the Raspberry Pi platform + -+Name: smi -+Info: Enables the Secondary Memory Interface peripheral. Uses GPIOs 2-25! -+Load: dtoverlay=smi -+Params: <None> ++ifeq ($(CONFIG_ARCH_BCM2708),y) ++ RPI_DT_OVERLAYS=y ++endif ++ifeq ($(CONFIG_ARCH_BCM2709),y) ++ RPI_DT_OVERLAYS=y ++endif ++ifeq ($(CONFIG_ARCH_BCM2835),y) ++ RPI_DT_OVERLAYS=y ++endif + ++dtbo-$(RPI_DT_OVERLAYS) += adau1977-adc.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += ads7846.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += akkordion-iqdacplus.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += at86rf233.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += audioinjector-wm8731-audio.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += bmp085_i2c-sensor.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += dpi24.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += dwc2.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += dwc-otg.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += dht11.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += enc28j60.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += gpio-ir.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += gpio-poweroff.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += hifiberry-amp.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += hifiberry-dac.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += hifiberry-dacplus.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += hifiberry-digi.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += hy28a.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += hy28b.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += i2c-rtc.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += i2c-gpio.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += i2c-mux.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += i2c-pwm-pca9685a.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += i2c0-bcm2708.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += i2c1-bcm2708.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += i2s-gpio28-31.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += i2s-mmap.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += iqaudio-dac.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += iqaudio-dacplus.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += justboom-dac.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += justboom-digi.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += lirc-rpi.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += mcp2515-can0.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += mcp2515-can1.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += mmc.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += mz61581.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += pi3-act-led.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += pi3-disable-bt.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += pi3-miniuart-bt.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += piscreen.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += piscreen2r.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += pitft22.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += pitft28-capacitive.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += pitft28-resistive.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += pps-gpio.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += pwm.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += pwm-2chan.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += qca7000.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += raspidac3.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += rpi-backlight.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += rpi-dac.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += rpi-display.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += rpi-ft5406.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += rpi-proto.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += rpi-sense.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += rra-digidac1-wm8741-audio.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += sdhost.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += sdio.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += sdio-1bit.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += sdtweak.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += smi-dev.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += smi-nand.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += smi.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += spi1-1cs.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += spi1-2cs.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += spi1-3cs.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += spi2-1cs.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += spi2-2cs.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += spi2-3cs.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += spi-gpio35-39.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += tinylcd35.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += uart1.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += vc4-kms-v3d.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += vga666.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += w1-gpio.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += w1-gpio-pullup.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += wittypi.dtbo + -+Name: smi-dev -+Info: Enables the userspace interface for the SMI driver -+Load: dtoverlay=smi-dev -+Params: <None> ++targets += dtbs dtbs_install ++targets += $(dtbo-y) + ++endif + -+Name: smi-nand -+Info: Enables access to NAND flash via the SMI interface -+Load: dtoverlay=smi-nand -+Params: <None> ++always := $(dtbo-y) ++clean-files := *.dtbo +diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README +new file mode 100644 +index 0000000..1516cc2 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/README +@@ -0,0 +1,1161 @@ ++Introduction ++============ + ++This directory contains Device Tree overlays. Device Tree makes it possible ++to support many hardware configurations with a single kernel and without the ++need to explicitly load or blacklist kernel modules. Note that this isn't a ++"pure" Device Tree configuration (c.f. MACH_BCM2835) - some on-board devices ++are still configured by the board support code, but the intention is to ++eventually reach that goal. + -+Name: spi-gpio35-39 -+Info: move SPI function block to GPIO 35 to 39 -+Load: dtoverlay=spi-gpio35-39 -+Params: <None> ++On Raspberry Pi, Device Tree usage is controlled from /boot/config.txt. By ++default, the Raspberry Pi kernel boots with device tree enabled. You can ++completely disable DT usage (for now) by adding: + ++ device_tree= + -+Name: tinylcd35 -+Info: 3.5" Color TFT Display by www.tinylcd.com -+ Options: Touch, RTC, keypad -+Load: dtoverlay=tinylcd35,<param>=<val> -+Params: speed Display SPI bus speed ++to your config.txt, which should cause your Pi to revert to the old way of ++doing things after a reboot. + -+ rotate Display rotation {0,90,180,270} ++In /boot you will find a .dtb for each base platform. This describes the ++hardware that is part of the Raspberry Pi board. The loader (start.elf and its ++siblings) selects the .dtb file appropriate for the platform by name, and reads ++it into memory. At this point, all of the optional interfaces (i2c, i2s, spi) ++are disabled, but they can be enabled using Device Tree parameters: + -+ fps Delay between frame updates ++ dtparam=i2c=on,i2s=on,spi=on + -+ debug Debug output level {0-7} ++However, this shouldn't be necessary in many use cases because loading an ++overlay that requires one of those interfaces will cause it to be enabled ++automatically, and it is advisable to only enable interfaces if they are ++needed. + -+ touch Enable touch panel ++Configuring additional, optional hardware is done using Device Tree overlays ++(see below). + -+ touchgpio Touch controller IRQ GPIO ++raspi-config ++============ + -+ xohms Touchpanel: Resistance of X-plate in ohms ++The Advanced Options section of the raspi-config utility can enable and disable ++Device Tree use, as well as toggling the I2C and SPI interfaces. Note that it ++is possible to both enable an interface and blacklist the driver, if for some ++reason you should want to defer the loading. + -+ rtc-pcf PCF8563 Real Time Clock ++Modules ++======= + -+ rtc-ds DS1307 Real Time Clock ++As well as describing the hardware, Device Tree also gives enough information ++to allow suitable driver modules to be located and loaded, with the corollary ++that unneeded modules are not loaded. As a result it should be possible to ++remove lines from /etc/modules, and /etc/modprobe.d/raspi-blacklist.conf can ++have its contents deleted (or commented out). + -+ keypad Enable keypad ++Using Overlays ++============== + -+ Examples: -+ Display with touchpanel, PCF8563 RTC and keypad: -+ dtoverlay=tinylcd35,touch,rtc-pcf,keypad -+ Old touch display: -+ dtoverlay=tinylcd35,touch,touchgpio=3 ++Overlays are loaded using the "dtoverlay" directive. As an example, consider ++the popular lirc-rpi module, the Linux Infrared Remote Control driver. In the ++pre-DT world this would be loaded from /etc/modules, with an explicit ++"modprobe lirc-rpi" command, or programmatically by lircd. With DT enabled, ++this becomes a line in config.txt: + ++ dtoverlay=lirc-rpi + -+Name: uart1 -+Info: Enable uart1 in place of uart0 -+Load: dtoverlay=uart1,<param>=<val> -+Params: txd1_pin GPIO pin for TXD1 (14, 32 or 40 - default 14) ++This causes the file /boot/overlays/lirc-rpi-overlay.dtb to be loaded. By ++default it will use GPIOs 17 (out) and 18 (in), but this can be modified using ++DT parameters: + -+ rxd1_pin GPIO pin for RXD1 (15, 33 or 41 - default 15) ++ dtoverlay=lirc-rpi,gpio_out_pin=17,gpio_in_pin=13 + ++Parameters always have default values, although in some cases (e.g. "w1-gpio") ++it is necessary to provided multiple overlays in order to get the desired ++behaviour. See the list of overlays below for a description of the parameters ++and their defaults. + -+Name: vga666 -+Info: Overlay for the Fen Logic VGA666 board -+ This uses GPIOs 2-21 (so no I2C), and activates the output 2-3 seconds -+ after the kernel has started. -+Load: dtoverlay=vga666 -+Params: <None> ++The Overlay and Parameter Reference ++=================================== + ++N.B. When editing this file, please preserve the indentation levels to make it ++simple to parse programmatically. NO HARD TABS. + -+Name: w1-gpio -+Info: Configures the w1-gpio Onewire interface module. -+ Use this overlay if you *don't* need a GPIO to drive an external pullup. -+Load: dtoverlay=w1-gpio,<param>=<val> -+Params: gpiopin GPIO for I/O (default "4") + -+ pullup Non-zero, "on", or "y" to enable the parasitic -+ power (2-wire, power-on-data) feature ++Name: <The base DTB> ++Info: Configures the base Raspberry Pi hardware ++Load: <loaded automatically> ++Params: ++ audio Set to "on" to enable the onboard ALSA audio ++ interface (default "off") + ++ i2c_arm Set to "on" to enable the ARM's i2c interface ++ (default "off") + -+Name: w1-gpio-pullup -+Info: Configures the w1-gpio Onewire interface module. -+ Use this overlay if you *do* need a GPIO to drive an external pullup. -+Load: dtoverlay=w1-gpio-pullup,<param>=<val> -+Params: gpiopin GPIO for I/O (default "4") ++ i2c_vc Set to "on" to enable the i2c interface ++ usually reserved for the VideoCore processor ++ (default "off") + -+ pullup Non-zero, "on", or "y" to enable the parasitic -+ power (2-wire, power-on-data) feature ++ i2c An alias for i2c_arm + -+ extpullup GPIO for external pullup (default "5") ++ i2c_arm_baudrate Set the baudrate of the ARM's i2c interface ++ (default "100000") + ++ i2c_vc_baudrate Set the baudrate of the VideoCore i2c interface ++ (default "100000") + -+Troubleshooting -+=============== ++ i2c_baudrate An alias for i2c_arm_baudrate + -+If you are experiencing problems that you think are DT-related, enable DT -+diagnostic output by adding this to /boot/config.txt: ++ i2s Set to "on" to enable the i2s interface ++ (default "off") + -+ dtdebug=on ++ spi Set to "on" to enable the spi interfaces ++ (default "off") + -+and rebooting. Then run: ++ random Set to "on" to enable the hardware random ++ number generator (default "on") + -+ sudo vcdbg log msg ++ sd_overclock Clock (in MHz) to use when the MMC framework ++ requests 50MHz + -+and look for relevant messages. ++ sd_force_pio Disable DMA support for SD driver (default off) + -+Further reading -+=============== ++ sd_pio_limit Number of blocks above which to use DMA for ++ SD card (default 1) + -+This is only meant to be a quick introduction to the subject of Device Tree on -+Raspberry Pi. There is a more complete explanation here: ++ sd_debug Enable debug output from SD driver (default off) + -+http://www.raspberrypi.org/documentation/configuration/device-tree.md -diff --git a/arch/arm/boot/dts/overlays/ads7846-overlay.dts b/arch/arm/boot/dts/overlays/ads7846-overlay.dts -new file mode 100644 -index 0000000..6a92cd1 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/ads7846-overlay.dts -@@ -0,0 +1,83 @@ -+/* -+ * Generic Device Tree overlay for the ADS7846 touch controller -+ * -+ */ ++ uart0 Set to "off" to disable uart0 (default "on") + -+/dts-v1/; -+/plugin/; ++ uart1 Set to "on" or "off" to enable or disable uart1 ++ (default varies) + -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; ++ watchdog Set to "on" to enable the hardware watchdog ++ (default "off") + -+ fragment@0 { -+ target = <&spi0>; -+ __overlay__ { -+ status = "okay"; ++ act_led_trigger Choose which activity the LED tracks. ++ Use "heartbeat" for a nice load indicator. ++ (default "mmc") + -+ spidev@0{ -+ status = "disabled"; -+ }; ++ act_led_activelow Set to "on" to invert the sense of the LED ++ (default "off") ++ N.B. For Pi3 see pi3-act-led overlay. + -+ spidev@1{ -+ status = "disabled"; -+ }; -+ }; -+ }; ++ act_led_gpio Set which GPIO to use for the activity LED ++ (in case you want to connect it to an external ++ device) ++ (default "16" on a non-Plus board, "47" on a ++ Plus or Pi 2) ++ N.B. For Pi3 see pi3-act-led overlay. + -+ fragment@1 { -+ target = <&gpio>; -+ __overlay__ { -+ ads7846_pins: ads7846_pins { -+ brcm,pins = <255>; /* illegal default value */ -+ brcm,function = <0>; /* in */ -+ brcm,pull = <0>; /* none */ -+ }; -+ }; -+ }; ++ pwr_led_trigger ++ pwr_led_activelow ++ pwr_led_gpio ++ As for act_led_*, but using the PWR LED. ++ Not available on Model A/B boards. + -+ fragment@2 { -+ target = <&spi0>; -+ __overlay__ { -+ /* needed to avoid dtc warning */ -+ #address-cells = <1>; -+ #size-cells = <0>; ++ N.B. It is recommended to only enable those interfaces that are needed. ++ Leaving all interfaces enabled can lead to unwanted behaviour (i2c_vc ++ interfering with Pi Camera, I2S and SPI hogging GPIO pins, etc.) ++ Note also that i2c, i2c_arm and i2c_vc are aliases for the physical ++ interfaces i2c0 and i2c1. Use of the numeric variants is still possible ++ but deprecated because the ARM/VC assignments differ between board ++ revisions. The same board-specific mapping applies to i2c_baudrate, ++ and the other i2c baudrate parameters. + -+ ads7846: ads7846@1 { -+ compatible = "ti,ads7846"; -+ reg = <1>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&ads7846_pins>; + -+ spi-max-frequency = <2000000>; -+ interrupts = <255 2>; /* high-to-low edge triggered */ -+ interrupt-parent = <&gpio>; -+ pendown-gpio = <&gpio 255 0>; ++Name: adau1977-adc ++Info: Overlay for activation of ADAU1977 ADC codec over I2C for control ++ and I2S for data. ++Load: dtoverlay=adau1977-adc ++Params: <None> + -+ /* driver defaults */ -+ ti,x-min = /bits/ 16 <0>; -+ ti,y-min = /bits/ 16 <0>; -+ ti,x-max = /bits/ 16 <0x0FFF>; -+ ti,y-max = /bits/ 16 <0x0FFF>; -+ ti,pressure-min = /bits/ 16 <0>; -+ ti,pressure-max = /bits/ 16 <0xFFFF>; -+ ti,x-plate-ohms = /bits/ 16 <400>; -+ }; -+ }; -+ }; -+ __overrides__ { -+ cs = <&ads7846>,"reg:0"; -+ speed = <&ads7846>,"spi-max-frequency:0"; -+ penirq = <&ads7846_pins>,"brcm,pins:0", /* REQUIRED */ -+ <&ads7846>,"interrupts:0", -+ <&ads7846>,"pendown-gpio:4"; -+ penirq_pull = <&ads7846_pins>,"brcm,pull:0"; -+ swapxy = <&ads7846>,"ti,swap-xy?"; -+ xmin = <&ads7846>,"ti,x-min;0"; -+ ymin = <&ads7846>,"ti,y-min;0"; -+ xmax = <&ads7846>,"ti,x-max;0"; -+ ymax = <&ads7846>,"ti,y-max;0"; -+ pmin = <&ads7846>,"ti,pressure-min;0"; -+ pmax = <&ads7846>,"ti,pressure-max;0"; -+ xohms = <&ads7846>,"ti,x-plate-ohms;0"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/bmp085_i2c-sensor-overlay.dts b/arch/arm/boot/dts/overlays/bmp085_i2c-sensor-overlay.dts -new file mode 100644 -index 0000000..782b171 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/bmp085_i2c-sensor-overlay.dts -@@ -0,0 +1,23 @@ -+// Definitions for BMP085/BMP180 digital barometric pressure and temperature sensors from Bosch Sensortec -+/dts-v1/; -+/plugin/; + -+/ { -+ compatible = "brcm,bcm2708"; ++Name: ads7846 ++Info: ADS7846 Touch controller ++Load: dtoverlay=ads7846,<param>=<val> ++Params: cs SPI bus Chip Select (default 1) ++ speed SPI bus speed (default 2MHz, max 3.25MHz) ++ penirq GPIO used for PENIRQ. REQUIRED ++ penirq_pull Set GPIO pull (default 0=none, 2=pullup) ++ swapxy Swap x and y axis ++ xmin Minimum value on the X axis (default 0) ++ ymin Minimum value on the Y axis (default 0) ++ xmax Maximum value on the X axis (default 4095) ++ ymax Maximum value on the Y axis (default 4095) ++ pmin Minimum reported pressure value (default 0) ++ pmax Maximum reported pressure value (default 65535) ++ xohms Touchpanel sensitivity (X-plate resistance) ++ (default 400) + -+ fragment@0 { -+ target = <&i2c_arm>; -+ __overlay__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; ++ penirq is required and usually xohms (60-100) has to be set as well. ++ Apart from that, pmax (255) and swapxy are also common. ++ The rest of the calibration can be done with xinput-calibrator. ++ See: github.com/notro/fbtft/wiki/FBTFT-on-Raspian ++ Device Tree binding document: ++ www.kernel.org/doc/Documentation/devicetree/bindings/input/ads7846.txt + -+ bmp085@77 { -+ compatible = "bosch,bmp085"; -+ reg = <0x77>; -+ default-oversampling = <3>; -+ status = "okay"; -+ }; -+ }; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/dht11-overlay.dts b/arch/arm/boot/dts/overlays/dht11-overlay.dts -new file mode 100644 -index 0000000..9bf67fd ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/dht11-overlay.dts -@@ -0,0 +1,39 @@ -+/* -+ * Overlay for the DHT11/21/22 humidity/temperature sensor modules. -+ */ -+/dts-v1/; -+/plugin/; + -+/ { -+ compatible = "brcm,bcm2708"; ++Name: akkordion-iqdacplus ++Info: Configures the Digital Dreamtime Akkordion Music Player (based on the ++ OEM IQAudIO DAC+ or DAC Zero module). ++Load: dtoverlay=akkordion-iqdacplus,<param>=<val> ++Params: 24db_digital_gain Allow gain to be applied via the PCM512x codec ++ Digital volume control. Enable with ++ dtoverlay=akkordion-iqdacplus,24db_digital_gain ++ (The default behaviour is that the Digital ++ volume control is limited to a maximum of ++ 0dB. ie. it can attenuate but not provide ++ gain. For most users, this will be desired ++ as it will prevent clipping. By appending ++ the 24db_digital_gain parameter, the Digital ++ volume control will allow up to 24dB of ++ gain. If this parameter is enabled, it is the ++ responsibility of the user to ensure that ++ the Digital volume control is set to a value ++ that does not result in clipping/distortion!) + -+ fragment@0 { -+ target-path = "/"; -+ __overlay__ { + -+ dht11: dht11@0 { -+ compatible = "dht11"; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&dht11_pins>; -+ gpios = <&gpio 4 0>; -+ status = "okay"; -+ }; -+ }; -+ }; ++Name: at86rf233 ++Info: Configures the Atmel AT86RF233 802.15.4 low-power WPAN transceiver, ++ connected to spi0.0 ++Load: dtoverlay=at86rf233,<param>=<val> ++Params: interrupt GPIO used for INT (default 23) ++ reset GPIO used for Reset (default 24) ++ sleep GPIO used for Sleep (default 25) ++ speed SPI bus speed in Hz (default 3000000) ++ trim Fine tuning of the internal capacitance ++ arrays (0=+0pF, 15=+4.5pF, default 15) + -+ fragment@1 { -+ target = <&gpio>; -+ __overlay__ { -+ dht11_pins: dht11_pins { -+ brcm,pins = <4>; -+ brcm,function = <0>; // in -+ brcm,pull = <0>; // off -+ }; -+ }; -+ }; + -+ __overrides__ { -+ gpiopin = <&dht11_pins>,"brcm,pins:0", -+ <&dht11>,"gpios:4"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/enc28j60-overlay.dts b/arch/arm/boot/dts/overlays/enc28j60-overlay.dts -new file mode 100644 -index 0000000..8fae869 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/enc28j60-overlay.dts -@@ -0,0 +1,50 @@ -+// Overlay for the Microchip ENC28J60 Ethernet Controller -+/dts-v1/; -+/plugin/; ++Name: audioinjector-wm8731-audio ++Info: Configures the audioinjector.net audio add on soundcard ++Load: dtoverlay=audioinjector-wm8731-audio ++Params: <None> + -+/ { -+ compatible = "brcm,bcm2708"; + -+ fragment@0 { -+ target = <&spi0>; -+ __overlay__ { -+ /* needed to avoid dtc warning */ -+ #address-cells = <1>; -+ #size-cells = <0>; ++Name: bmp085_i2c-sensor ++Info: Configures the BMP085/BMP180 digital barometric pressure and temperature ++ sensors from Bosch Sensortec ++Load: dtoverlay=bmp085_i2c-sensor ++Params: <None> + -+ status = "okay"; + -+ spidev@0{ -+ status = "disabled"; -+ }; ++Name: dht11 ++Info: Overlay for the DHT11/DHT21/DHT22 humidity/temperature sensors ++ Also sometimes found with the part number(s) AM230x. ++Load: dtoverlay=dht11,<param>=<val> ++Params: gpiopin GPIO connected to the sensor's DATA output. ++ (default 4) + -+ eth1: enc28j60@0{ -+ compatible = "microchip,enc28j60"; -+ reg = <0>; /* CE0 */ -+ pinctrl-names = "default"; -+ pinctrl-0 = <&eth1_pins>; -+ interrupt-parent = <&gpio>; -+ interrupts = <25 0x2>; /* falling edge */ -+ spi-max-frequency = <12000000>; -+ status = "okay"; -+ }; -+ }; -+ }; + -+ fragment@1 { -+ target = <&gpio>; -+ __overlay__ { -+ eth1_pins: eth1_pins { -+ brcm,pins = <25>; -+ brcm,function = <0>; /* in */ -+ brcm,pull = <0>; /* none */ -+ }; -+ }; -+ }; ++Name: dpi24 ++Info: Overlay for a generic 24-bit DPI display ++ This uses GPIOs 0-27 (so no I2C, uart etc.), and activates the output ++ 2-3 seconds after the kernel has started. ++Load: dtoverlay=dpi24 ++Params: <None> + -+ __overrides__ { -+ int_pin = <&eth1>, "interrupts:0", -+ <&eth1_pins>, "brcm,pins:0"; -+ speed = <&eth1>, "spi-max-frequency:0"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/gpio-poweroff-overlay.dts b/arch/arm/boot/dts/overlays/gpio-poweroff-overlay.dts -new file mode 100644 -index 0000000..ff8cb36 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/gpio-poweroff-overlay.dts -@@ -0,0 +1,34 @@ -+// Definitions for gpio-poweroff module -+/dts-v1/; -+/plugin/; + -+/ { -+ compatible = "brcm,bcm2708"; ++Name: dwc-otg ++Info: Selects the dwc_otg USB controller driver which has fiq support. This ++ is the default on all except the Pi Zero which defaults to dwc2. ++Load: dtoverlay=dwc-otg ++Params: <None> + -+ fragment@0 { -+ target-path = "/"; -+ __overlay__ { -+ power_ctrl: power_ctrl { -+ compatible = "gpio-poweroff"; -+ gpios = <&gpio 26 0>; -+ force; -+ }; -+ }; -+ }; + -+ fragment@1 { -+ target = <&gpio>; -+ __overlay__ { -+ power_ctrl_pins: power_ctrl_pins { -+ brcm,pins = <26>; -+ brcm,function = <1>; // out -+ }; -+ }; -+ }; ++Name: dwc2 ++Info: Selects the dwc2 USB controller driver ++Load: dtoverlay=dwc2,<param>=<val> ++Params: dr_mode Dual role mode: "host", "peripheral" or "otg" + -+ __overrides__ { -+ gpiopin = <&power_ctrl>,"gpios:4", -+ <&power_ctrl_pins>,"brcm,pins:0"; -+ active_low = <&power_ctrl>,"gpios:8"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/hifiberry-amp-overlay.dts b/arch/arm/boot/dts/overlays/hifiberry-amp-overlay.dts -new file mode 100644 -index 0000000..2c81448 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/hifiberry-amp-overlay.dts -@@ -0,0 +1,39 @@ -+// Definitions for HiFiBerry Amp/Amp+ -+/dts-v1/; -+/plugin/; ++ g-rx-fifo-size Size of rx fifo size in gadget mode + -+/ { -+ compatible = "brcm,bcm2708"; ++ g-np-tx-fifo-size Size of non-periodic tx fifo size in gadget ++ mode + -+ fragment@0 { -+ target = <&sound>; -+ __overlay__ { -+ compatible = "hifiberry,hifiberry-amp"; -+ i2s-controller = <&i2s>; -+ status = "okay"; -+ }; -+ }; ++ g-tx-fifo-size Size of periodic tx fifo per endpoint ++ (except ep0) in gadget mode + -+ fragment@1 { -+ target = <&i2s>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; + -+ fragment@2 { -+ target = <&i2c1>; -+ __overlay__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; ++[ The ds1307-rtc overlay has been deleted. See i2c-rtc. ] + -+ tas5713@1b { -+ #sound-dai-cells = <0>; -+ compatible = "ti,tas5713"; -+ reg = <0x1b>; -+ status = "okay"; -+ }; -+ }; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/hifiberry-dac-overlay.dts b/arch/arm/boot/dts/overlays/hifiberry-dac-overlay.dts -new file mode 100644 -index 0000000..5e7633ae ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/hifiberry-dac-overlay.dts -@@ -0,0 +1,34 @@ -+// Definitions for HiFiBerry DAC -+/dts-v1/; -+/plugin/; + -+/ { -+ compatible = "brcm,bcm2708"; ++Name: enc28j60 ++Info: Overlay for the Microchip ENC28J60 Ethernet Controller (SPI) ++Load: dtoverlay=enc28j60,<param>=<val> ++Params: int_pin GPIO used for INT (default 25) + -+ fragment@0 { -+ target = <&sound>; -+ __overlay__ { -+ compatible = "hifiberry,hifiberry-dac"; -+ i2s-controller = <&i2s>; -+ status = "okay"; -+ }; -+ }; ++ speed SPI bus speed (default 12000000) + -+ fragment@1 { -+ target = <&i2s>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; + -+ fragment@2 { -+ target-path = "/"; -+ __overlay__ { -+ pcm5102a-codec { -+ #sound-dai-cells = <0>; -+ compatible = "ti,pcm5102a"; -+ status = "okay"; -+ }; -+ }; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts b/arch/arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts -new file mode 100644 -index 0000000..deb9c625 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts -@@ -0,0 +1,39 @@ -+// Definitions for HiFiBerry DAC+ -+/dts-v1/; -+/plugin/; ++Name: gpio-ir ++Info: Use GPIO pin as rc-core style infrared receiver input. The rc-core- ++ based gpio_ir_recv driver maps received keys directly to a ++ /dev/input/event* device, all decoding is done by the kernel - LIRC is ++ not required! The key mapping and other decoding parameters can be ++ configured by "ir-keytable" tool. ++Load: dtoverlay=gpio-ir,<param>=<val> ++Params: gpio_pin Input pin number. Default is 18. + -+/ { -+ compatible = "brcm,bcm2708"; ++ gpio_pull Desired pull-up/down state (off, down, up) ++ Default is "down". + -+ fragment@0 { -+ target = <&sound>; -+ __overlay__ { -+ compatible = "hifiberry,hifiberry-dacplus"; -+ i2s-controller = <&i2s>; -+ status = "okay"; -+ }; -+ }; ++ rc-map-name Default rc keymap (can also be changed by ++ ir-keytable), defaults to "rc-rc6-mce" + -+ fragment@1 { -+ target = <&i2s>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; + -+ fragment@2 { -+ target = <&i2c1>; -+ __overlay__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; ++Name: gpio-poweroff ++Info: Drives a GPIO high or low on reboot ++Load: dtoverlay=gpio-poweroff,<param>=<val> ++Params: gpiopin GPIO for signalling (default 26) + -+ pcm5122@4d { -+ #sound-dai-cells = <0>; -+ compatible = "ti,pcm5122"; -+ reg = <0x4d>; -+ status = "okay"; -+ }; -+ }; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/hifiberry-digi-overlay.dts b/arch/arm/boot/dts/overlays/hifiberry-digi-overlay.dts -new file mode 100644 -index 0000000..d0e0d8a ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/hifiberry-digi-overlay.dts -@@ -0,0 +1,39 @@ -+// Definitions for HiFiBerry Digi -+/dts-v1/; -+/plugin/; ++ active_low Set if the power control device requires a ++ high->low transition to trigger a power-down. ++ Note that this will require the support of a ++ custom dt-blob.bin to prevent a power-down ++ during the boot process, and that a reboot ++ will also cause the pin to go low. + -+/ { -+ compatible = "brcm,bcm2708"; + -+ fragment@0 { -+ target = <&sound>; -+ __overlay__ { -+ compatible = "hifiberry,hifiberry-digi"; -+ i2s-controller = <&i2s>; -+ status = "okay"; -+ }; -+ }; ++Name: hifiberry-amp ++Info: Configures the HifiBerry Amp and Amp+ audio cards ++Load: dtoverlay=hifiberry-amp ++Params: <None> + -+ fragment@1 { -+ target = <&i2s>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; + -+ fragment@2 { -+ target = <&i2c1>; -+ __overlay__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; ++Name: hifiberry-dac ++Info: Configures the HifiBerry DAC audio card ++Load: dtoverlay=hifiberry-dac ++Params: <None> + -+ wm8804@3b { -+ #sound-dai-cells = <0>; -+ compatible = "wlf,wm8804"; -+ reg = <0x3b>; -+ status = "okay"; -+ }; -+ }; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/hy28a-overlay.dts b/arch/arm/boot/dts/overlays/hy28a-overlay.dts -new file mode 100644 -index 0000000..3cd3083 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/hy28a-overlay.dts -@@ -0,0 +1,87 @@ -+/* -+ * Device Tree overlay for HY28A display -+ * -+ */ + -+/dts-v1/; -+/plugin/; ++Name: hifiberry-dacplus ++Info: Configures the HifiBerry DAC+ audio card ++Load: dtoverlay=hifiberry-dacplus,<param>=<val> ++Params: 24db_digital_gain Allow gain to be applied via the PCM512x codec ++ Digital volume control. Enable with ++ "dtoverlay=hifiberry-dacplus,24db_digital_gain" ++ (The default behaviour is that the Digital ++ volume control is limited to a maximum of ++ 0dB. ie. it can attenuate but not provide ++ gain. For most users, this will be desired ++ as it will prevent clipping. By appending ++ the 24dB_digital_gain parameter, the Digital ++ volume control will allow up to 24dB of ++ gain. If this parameter is enabled, it is the ++ responsibility of the user to ensure that ++ the Digital volume control is set to a value ++ that does not result in clipping/distortion!) ++ slave Force DAC+ Pro into slave mode, using Pi as ++ master for bit clock and frame clock. + -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; + -+ fragment@0 { -+ target = <&spi0>; -+ __overlay__ { -+ status = "okay"; ++Name: hifiberry-digi ++Info: Configures the HifiBerry Digi audio card ++Load: dtoverlay=hifiberry-digi ++Params: <None> + -+ spidev@0{ -+ status = "disabled"; -+ }; + -+ spidev@1{ -+ status = "disabled"; -+ }; -+ }; -+ }; ++Name: hy28a ++Info: HY28A - 2.8" TFT LCD Display Module by HAOYU Electronics ++ Default values match Texy's display shield ++Load: dtoverlay=hy28a,<param>=<val> ++Params: speed Display SPI bus speed + -+ fragment@1 { -+ target = <&gpio>; -+ __overlay__ { -+ hy28a_pins: hy28a_pins { -+ brcm,pins = <17 25 18>; -+ brcm,function = <0 1 1>; /* in out out */ -+ }; -+ }; -+ }; ++ rotate Display rotation {0,90,180,270} + -+ fragment@2 { -+ target = <&spi0>; -+ __overlay__ { -+ /* needed to avoid dtc warning */ -+ #address-cells = <1>; -+ #size-cells = <0>; ++ fps Delay between frame updates + -+ hy28a: hy28a@0{ -+ compatible = "ilitek,ili9320"; -+ reg = <0>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&hy28a_pins>; ++ debug Debug output level {0-7} + -+ spi-max-frequency = <32000000>; -+ spi-cpol; -+ spi-cpha; -+ rotate = <270>; -+ bgr; -+ fps = <50>; -+ buswidth = <8>; -+ startbyte = <0x70>; -+ reset-gpios = <&gpio 25 0>; -+ led-gpios = <&gpio 18 1>; -+ debug = <0>; -+ }; ++ xohms Touchpanel sensitivity (X-plate resistance) + -+ hy28a_ts: hy28a-ts@1 { -+ compatible = "ti,ads7846"; -+ reg = <1>; ++ resetgpio GPIO used to reset controller + -+ spi-max-frequency = <2000000>; -+ interrupts = <17 2>; /* high-to-low edge triggered */ -+ interrupt-parent = <&gpio>; -+ pendown-gpio = <&gpio 17 0>; -+ ti,x-plate-ohms = /bits/ 16 <100>; -+ ti,pressure-max = /bits/ 16 <255>; -+ }; -+ }; -+ }; -+ __overrides__ { -+ speed = <&hy28a>,"spi-max-frequency:0"; -+ rotate = <&hy28a>,"rotate:0"; -+ fps = <&hy28a>,"fps:0"; -+ debug = <&hy28a>,"debug:0"; -+ xohms = <&hy28a_ts>,"ti,x-plate-ohms;0"; -+ resetgpio = <&hy28a>,"reset-gpios:4", -+ <&hy28a_pins>, "brcm,pins:1"; -+ ledgpio = <&hy28a>,"led-gpios:4", -+ <&hy28a_pins>, "brcm,pins:2"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/hy28b-overlay.dts b/arch/arm/boot/dts/overlays/hy28b-overlay.dts -new file mode 100644 -index 0000000..f774c4a ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/hy28b-overlay.dts -@@ -0,0 +1,142 @@ -+/* -+ * Device Tree overlay for HY28b display shield by Texy -+ * -+ */ ++ ledgpio GPIO used to control backlight + -+/dts-v1/; -+/plugin/; + -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; ++Name: hy28b ++Info: HY28B - 2.8" TFT LCD Display Module by HAOYU Electronics ++ Default values match Texy's display shield ++Load: dtoverlay=hy28b,<param>=<val> ++Params: speed Display SPI bus speed + -+ fragment@0 { -+ target = <&spi0>; -+ __overlay__ { -+ status = "okay"; ++ rotate Display rotation {0,90,180,270} + -+ spidev@0{ -+ status = "disabled"; -+ }; ++ fps Delay between frame updates + -+ spidev@1{ -+ status = "disabled"; -+ }; -+ }; -+ }; ++ debug Debug output level {0-7} + -+ fragment@1 { -+ target = <&gpio>; -+ __overlay__ { -+ hy28b_pins: hy28b_pins { -+ brcm,pins = <17 25 18>; -+ brcm,function = <0 1 1>; /* in out out */ -+ }; -+ }; -+ }; ++ xohms Touchpanel sensitivity (X-plate resistance) + -+ fragment@2 { -+ target = <&spi0>; -+ __overlay__ { -+ /* needed to avoid dtc warning */ -+ #address-cells = <1>; -+ #size-cells = <0>; ++ resetgpio GPIO used to reset controller + -+ hy28b: hy28b@0{ -+ compatible = "ilitek,ili9325"; -+ reg = <0>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&hy28b_pins>; ++ ledgpio GPIO used to control backlight + -+ spi-max-frequency = <48000000>; -+ spi-cpol; -+ spi-cpha; -+ rotate = <270>; -+ bgr; -+ fps = <50>; -+ buswidth = <8>; -+ startbyte = <0x70>; -+ reset-gpios = <&gpio 25 0>; -+ led-gpios = <&gpio 18 1>; + -+ gamma = "04 1F 4 7 7 0 7 7 6 0\n0F 00 1 7 4 0 0 0 6 7"; ++Name: i2c-gpio ++Info: Adds support for software i2c controller on gpio pins ++Load: dtoverlay=i2c-gpio,<param>=<val> ++Params: i2c_gpio_sda GPIO used for I2C data (default "23") + -+ init = <0x10000e7 0x0010 -+ 0x1000000 0x0001 -+ 0x1000001 0x0100 -+ 0x1000002 0x0700 -+ 0x1000003 0x1030 -+ 0x1000004 0x0000 -+ 0x1000008 0x0207 -+ 0x1000009 0x0000 -+ 0x100000a 0x0000 -+ 0x100000c 0x0001 -+ 0x100000d 0x0000 -+ 0x100000f 0x0000 -+ 0x1000010 0x0000 -+ 0x1000011 0x0007 -+ 0x1000012 0x0000 -+ 0x1000013 0x0000 -+ 0x2000032 -+ 0x1000010 0x1590 -+ 0x1000011 0x0227 -+ 0x2000032 -+ 0x1000012 0x009c -+ 0x2000032 -+ 0x1000013 0x1900 -+ 0x1000029 0x0023 -+ 0x100002b 0x000e -+ 0x2000032 -+ 0x1000020 0x0000 -+ 0x1000021 0x0000 -+ 0x2000032 -+ 0x1000050 0x0000 -+ 0x1000051 0x00ef -+ 0x1000052 0x0000 -+ 0x1000053 0x013f -+ 0x1000060 0xa700 -+ 0x1000061 0x0001 -+ 0x100006a 0x0000 -+ 0x1000080 0x0000 -+ 0x1000081 0x0000 -+ 0x1000082 0x0000 -+ 0x1000083 0x0000 -+ 0x1000084 0x0000 -+ 0x1000085 0x0000 -+ 0x1000090 0x0010 -+ 0x1000092 0x0000 -+ 0x1000093 0x0003 -+ 0x1000095 0x0110 -+ 0x1000097 0x0000 -+ 0x1000098 0x0000 -+ 0x1000007 0x0133 -+ 0x1000020 0x0000 -+ 0x1000021 0x0000 -+ 0x2000064>; -+ debug = <0>; -+ }; ++ i2c_gpio_scl GPIO used for I2C clock (default "24") + -+ hy28b_ts: hy28b-ts@1 { -+ compatible = "ti,ads7846"; -+ reg = <1>; ++ i2c_gpio_delay_us Clock delay in microseconds ++ (default "2" = ~100kHz) + -+ spi-max-frequency = <2000000>; -+ interrupts = <17 2>; /* high-to-low edge triggered */ -+ interrupt-parent = <&gpio>; -+ pendown-gpio = <&gpio 17 0>; -+ ti,x-plate-ohms = /bits/ 16 <100>; -+ ti,pressure-max = /bits/ 16 <255>; -+ }; -+ }; -+ }; -+ __overrides__ { -+ speed = <&hy28b>,"spi-max-frequency:0"; -+ rotate = <&hy28b>,"rotate:0"; -+ fps = <&hy28b>,"fps:0"; -+ debug = <&hy28b>,"debug:0"; -+ xohms = <&hy28b_ts>,"ti,x-plate-ohms;0"; -+ resetgpio = <&hy28b>,"reset-gpios:4", -+ <&hy28b_pins>, "brcm,pins:1"; -+ ledgpio = <&hy28b>,"led-gpios:4", -+ <&hy28b_pins>, "brcm,pins:2"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts b/arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts -new file mode 100644 -index 0000000..fed4bd8 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts -@@ -0,0 +1,55 @@ -+// Definitions for several I2C based Real Time Clocks -+/dts-v1/; -+/plugin/; + -+/ { -+ compatible = "brcm,bcm2708"; ++Name: i2c-mux ++Info: Adds support for a number of I2C bus multiplexers on i2c_arm ++Load: dtoverlay=i2c-mux,<param>=<val> ++Params: pca9542 Select the NXP PCA9542 device + -+ fragment@0 { -+ target = <&i2c_arm>; -+ __overlay__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; ++ pca9545 Select the NXP PCA9545 device + -+ ds1307: ds1307@68 { -+ compatible = "maxim,ds1307"; -+ reg = <0x68>; -+ status = "disable"; -+ }; -+ mcp7941x: mcp7941x@6f { -+ compatible = "microchip,mcp7941x"; -+ reg = <0x6f>; -+ status = "disable"; -+ }; -+ ds3231: ds3231@68 { -+ compatible = "maxim,ds3231"; -+ reg = <0x68>; -+ status = "disable"; -+ }; -+ pcf2127: pcf2127@51 { -+ compatible = "nxp,pcf2127"; -+ reg = <0x51>; -+ status = "disable"; -+ }; -+ pcf8523: pcf8523@68 { -+ compatible = "nxp,pcf8523"; -+ reg = <0x68>; -+ status = "disable"; -+ }; -+ pcf8563: pcf8563@51 { -+ compatible = "nxp,pcf8563"; -+ reg = <0x51>; -+ status = "disable"; -+ }; -+ }; -+ }; -+ __overrides__ { -+ ds1307 = <&ds1307>,"status"; -+ ds3231 = <&ds3231>,"status"; -+ mcp7941x = <&mcp7941x>,"status"; -+ pcf2127 = <&pcf2127>,"status"; -+ pcf8523 = <&pcf8523>,"status"; -+ pcf8563 = <&pcf8563>,"status"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/i2s-mmap-overlay.dts b/arch/arm/boot/dts/overlays/i2s-mmap-overlay.dts -new file mode 100644 -index 0000000..a11160a ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/i2s-mmap-overlay.dts -@@ -0,0 +1,13 @@ -+/dts-v1/; -+/plugin/; ++ pca9548 Select the NXP PCA9548 device + -+/{ -+ compatible = "brcm,bcm2708"; ++ addr Change I2C address of the device (default 0x70) + -+ fragment@0 { -+ target = <&i2s>; -+ __overlay__ { -+ brcm,enable-mmap; -+ }; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/iqaudio-dac-overlay.dts b/arch/arm/boot/dts/overlays/iqaudio-dac-overlay.dts -new file mode 100644 -index 0000000..ea8173e ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/iqaudio-dac-overlay.dts -@@ -0,0 +1,39 @@ -+// Definitions for IQaudIO DAC -+/dts-v1/; -+/plugin/; + -+/ { -+ compatible = "brcm,bcm2708"; ++[ The i2c-mux-pca9548a overlay has been deleted. See i2c-mux. ] + -+ fragment@0 { -+ target = <&sound>; -+ __overlay__ { -+ compatible = "iqaudio,iqaudio-dac"; -+ i2s-controller = <&i2s>; -+ status = "okay"; -+ }; -+ }; + -+ fragment@1 { -+ target = <&i2s>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; ++Name: i2c-pwm-pca9685a ++Info: Adds support for an NXP PCA9685A I2C PWM controller on i2c_arm ++Load: dtoverlay=i2c-pwm-pca9685a,<param>=<val> ++Params: addr I2C address of PCA9685A (default 0x40) + -+ fragment@2 { -+ target = <&i2c1>; -+ __overlay__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; + -+ pcm5122@4c { -+ #sound-dai-cells = <0>; -+ compatible = "ti,pcm5122"; -+ reg = <0x4c>; -+ status = "okay"; -+ }; -+ }; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/iqaudio-dacplus-overlay.dts b/arch/arm/boot/dts/overlays/iqaudio-dacplus-overlay.dts -new file mode 100644 -index 0000000..735d8ab ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/iqaudio-dacplus-overlay.dts -@@ -0,0 +1,39 @@ -+// Definitions for IQaudIO DAC+ -+/dts-v1/; -+/plugin/; ++Name: i2c-rtc ++Info: Adds support for a number of I2C Real Time Clock devices ++Load: dtoverlay=i2c-rtc,<param>=<val> ++Params: ds1307 Select the DS1307 device + -+/ { -+ compatible = "brcm,bcm2708"; ++ ds1339 Select the DS1339 device + -+ fragment@0 { -+ target = <&sound>; -+ __overlay__ { -+ compatible = "iqaudio,iqaudio-dac"; -+ i2s-controller = <&i2s>; -+ status = "okay"; -+ }; -+ }; ++ ds3231 Select the DS3231 device + -+ fragment@1 { -+ target = <&i2s>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; ++ mcp7940x Select the MCP7940x device + -+ fragment@2 { -+ target = <&i2c1>; -+ __overlay__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; ++ mcp7941x Select the MCP7941x device + -+ pcm5122@4c { -+ #sound-dai-cells = <0>; -+ compatible = "ti,pcm5122"; -+ reg = <0x4c>; -+ status = "okay"; -+ }; -+ }; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/lirc-rpi-overlay.dts b/arch/arm/boot/dts/overlays/lirc-rpi-overlay.dts -new file mode 100644 -index 0000000..7d5d82b ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/lirc-rpi-overlay.dts -@@ -0,0 +1,57 @@ -+// Definitions for lirc-rpi module -+/dts-v1/; -+/plugin/; ++ pcf2127 Select the PCF2127 device + -+/ { -+ compatible = "brcm,bcm2708"; ++ pcf8523 Select the PCF8523 device + -+ fragment@0 { -+ target-path = "/"; -+ __overlay__ { -+ lirc_rpi: lirc_rpi { -+ compatible = "rpi,lirc-rpi"; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&lirc_pins>; -+ status = "okay"; ++ pcf8563 Select the PCF8563 device + -+ // Override autodetection of IR receiver circuit -+ // (0 = active high, 1 = active low, -1 = no override ) -+ rpi,sense = <0xffffffff>; ++ trickle-resistor-ohms Resistor value for trickle charge (DS1339-only) + -+ // Software carrier -+ // (0 = off, 1 = on) -+ rpi,softcarrier = <1>; + -+ // Invert output -+ // (0 = off, 1 = on) -+ rpi,invert = <0>; ++Name: i2c0-bcm2708 ++Info: Enable the i2c_bcm2708 driver for the i2c0 bus. Not all pin combinations ++ are usable on all platforms. ++Load: dtoverlay=i2c0-bcm2708,<param>=<val> ++Params: sda0_pin GPIO pin for SDA0 (deprecated - use pins_*) ++ scl0_pin GPIO pin for SCL0 (deprecated - use pins_*) ++ pins_0_1 Use pins 0 and 1 (default) ++ pins_28_29 Use pins 28 and 29 ++ pins_44_45 Use pins 44 and 45 ++ pins_46_47 Use pins 46 and 47 + -+ // Enable debugging messages -+ // (0 = off, 1 = on) -+ rpi,debug = <0>; -+ }; -+ }; -+ }; + -+ fragment@1 { -+ target = <&gpio>; -+ __overlay__ { -+ lirc_pins: lirc_pins { -+ brcm,pins = <17 18>; -+ brcm,function = <1 0>; // out in -+ brcm,pull = <0 1>; // off down -+ }; -+ }; -+ }; ++Name: i2c1-bcm2708 ++Info: Enable the i2c_bcm2708 driver for the i2c1 bus ++Load: dtoverlay=i2c1-bcm2708,<param>=<val> ++Params: sda1_pin GPIO pin for SDA1 (2 or 44 - default 2) ++ scl1_pin GPIO pin for SCL1 (3 or 45 - default 3) ++ pin_func Alternative pin function (4 (alt0), 6 (alt2) - ++ default 4) + -+ __overrides__ { -+ gpio_out_pin = <&lirc_pins>,"brcm,pins:0"; -+ gpio_in_pin = <&lirc_pins>,"brcm,pins:4"; -+ gpio_in_pull = <&lirc_pins>,"brcm,pull:4"; + -+ sense = <&lirc_rpi>,"rpi,sense:0"; -+ softcarrier = <&lirc_rpi>,"rpi,softcarrier:0"; -+ invert = <&lirc_rpi>,"rpi,invert:0"; -+ debug = <&lirc_rpi>,"rpi,debug:0"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/mcp2515-can0-overlay.dts b/arch/arm/boot/dts/overlays/mcp2515-can0-overlay.dts -new file mode 100755 -index 0000000..398d59c ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/mcp2515-can0-overlay.dts -@@ -0,0 +1,69 @@ -+/* -+ * Device tree overlay for mcp251x/can0 on spi0.0 -+ */ ++Name: i2s-gpio28-31 ++Info: move I2S function block to GPIO 28 to 31 ++Load: dtoverlay=i2s-gpio28-31 ++Params: <None> + -+/dts-v1/; -+/plugin/; + -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2836", "brcm,bcm2708", "brcm,bcm2709"; -+ /* disable spi-dev for spi0.0 */ -+ fragment@0 { -+ target = <&spi0>; -+ __overlay__ { -+ status = "okay"; -+ spidev@0{ -+ status = "disabled"; -+ }; -+ }; -+ }; ++Name: i2s-mmap ++Info: Enables mmap support in the bcm2708-i2s driver ++Load: dtoverlay=i2s-mmap ++Params: <None> + -+ /* the interrupt pin of the can-controller */ -+ fragment@1 { -+ target = <&gpio>; -+ __overlay__ { -+ can0_pins: can0_pins { -+ brcm,pins = <25>; -+ brcm,function = <0>; /* input */ -+ }; -+ }; -+ }; + -+ /* the clock/oscillator of the can-controller */ -+ fragment@2 { -+ target-path = "/clocks"; -+ __overlay__ { -+ /* external oscillator of mcp2515 on SPI0.0 */ -+ can0_osc: can0_osc { -+ compatible = "fixed-clock"; -+ #clock-cells = <0>; -+ clock-frequency = <16000000>; -+ }; -+ }; -+ }; ++Name: iqaudio-dac ++Info: Configures the IQaudio DAC audio card ++Load: dtoverlay=iqaudio-dac,<param> ++Params: 24db_digital_gain Allow gain to be applied via the PCM512x codec ++ Digital volume control. Enable with ++ "dtoverlay=iqaudio-dac,24db_digital_gain" ++ (The default behaviour is that the Digital ++ volume control is limited to a maximum of ++ 0dB. ie. it can attenuate but not provide ++ gain. For most users, this will be desired ++ as it will prevent clipping. By appending ++ the 24db_digital_gain parameter, the Digital ++ volume control will allow up to 24dB of ++ gain. If this parameter is enabled, it is the ++ responsibility of the user to ensure that ++ the Digital volume control is set to a value ++ that does not result in clipping/distortion!) + -+ /* the spi config of the can-controller itself binding everything together */ -+ fragment@3 { -+ target = <&spi0>; -+ __overlay__ { -+ /* needed to avoid dtc warning */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ can0: mcp2515@0 { -+ reg = <0>; -+ compatible = "microchip,mcp2515"; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&can0_pins>; -+ spi-max-frequency = <10000000>; -+ interrupt-parent = <&gpio>; -+ interrupts = <25 0x2>; -+ clocks = <&can0_osc>; -+ }; -+ }; -+ }; -+ __overrides__ { -+ oscillator = <&can0_osc>,"clock-frequency:0"; -+ spimaxfrequency = <&can0>,"spi-max-frequency:0"; -+ interrupt = <&can0_pins>,"brcm,pins:0",<&can0>,"interrupts:0"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/mcp2515-can1-overlay.dts b/arch/arm/boot/dts/overlays/mcp2515-can1-overlay.dts -new file mode 100644 -index 0000000..6bef9ae ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/mcp2515-can1-overlay.dts -@@ -0,0 +1,69 @@ -+/* -+ * Device tree overlay for mcp251x/can1 on spi0.1 edited by petit_miner -+ */ + -+/dts-v1/; -+/plugin/; ++Name: iqaudio-dacplus ++Info: Configures the IQaudio DAC+ audio card ++Load: dtoverlay=iqaudio-dacplus,<param>=<val> ++Params: 24db_digital_gain Allow gain to be applied via the PCM512x codec ++ Digital volume control. Enable with ++ "dtoverlay=iqaudio-dacplus,24db_digital_gain" ++ (The default behaviour is that the Digital ++ volume control is limited to a maximum of ++ 0dB. ie. it can attenuate but not provide ++ gain. For most users, this will be desired ++ as it will prevent clipping. By appending ++ the 24db_digital_gain parameter, the Digital ++ volume control will allow up to 24dB of ++ gain. If this parameter is enabled, it is the ++ responsibility of the user to ensure that ++ the Digital volume control is set to a value ++ that does not result in clipping/distortion!) + -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2836", "brcm,bcm2708", "brcm,bcm2709"; -+ /* disable spi-dev for spi0.1 */ -+ fragment@0 { -+ target = <&spi0>; -+ __overlay__ { -+ status = "okay"; -+ spidev@1{ -+ status = "disabled"; -+ }; -+ }; -+ }; + -+ /* the interrupt pin of the can-controller */ -+ fragment@1 { -+ target = <&gpio>; -+ __overlay__ { -+ can1_pins: can1_pins { -+ brcm,pins = <25>; -+ brcm,function = <0>; /* input */ -+ }; -+ }; -+ }; ++Name: justboom-dac ++Info: Configures the JustBoom DAC HAT, Amp HAT, DAC Zero and Amp Zero audio ++ cards ++Load: dtoverlay=justboom-dac,<param>=<val> ++Params: 24db_digital_gain Allow gain to be applied via the PCM512x codec ++ Digital volume control. Enable with ++ "dtoverlay=justboom-dac,24db_digital_gain" ++ (The default behaviour is that the Digital ++ volume control is limited to a maximum of ++ 0dB. ie. it can attenuate but not provide ++ gain. For most users, this will be desired ++ as it will prevent clipping. By appending ++ the 24dB_digital_gain parameter, the Digital ++ volume control will allow up to 24dB of ++ gain. If this parameter is enabled, it is the ++ responsibility of the user to ensure that ++ the Digital volume control is set to a value ++ that does not result in clipping/distortion!) + -+ /* the clock/oscillator of the can-controller */ -+ fragment@2 { -+ target-path = "/clocks"; -+ __overlay__ { -+ /* external oscillator of mcp2515 on spi0.1 */ -+ can1_osc: can1_osc { -+ compatible = "fixed-clock"; -+ #clock-cells = <0>; -+ clock-frequency = <16000000>; -+ }; -+ }; -+ }; + -+ /* the spi config of the can-controller itself binding everything together */ -+ fragment@3 { -+ target = <&spi0>; -+ __overlay__ { -+ /* needed to avoid dtc warning */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ can1: mcp2515@1 { -+ reg = <1>; -+ compatible = "microchip,mcp2515"; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&can1_pins>; -+ spi-max-frequency = <10000000>; -+ interrupt-parent = <&gpio>; -+ interrupts = <25 0x2>; -+ clocks = <&can1_osc>; -+ }; -+ }; -+ }; -+ __overrides__ { -+ oscillator = <&can1_osc>,"clock-frequency:0"; -+ spimaxfrequency = <&can1>,"spi-max-frequency:0"; -+ interrupt = <&can1_pins>,"brcm,pins:0",<&can1>,"interrupts:0"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/mmc-overlay.dts b/arch/arm/boot/dts/overlays/mmc-overlay.dts ++Name: justboom-digi ++Info: Configures the JustBoom Digi HAT and Digi Zero audio cards ++Load: dtoverlay=justboom-digi ++Params: <None> ++ ++ ++Name: lirc-rpi ++Info: Configures lirc-rpi (Linux Infrared Remote Control for Raspberry Pi) ++ Consult the module documentation for more details. ++Load: dtoverlay=lirc-rpi,<param>=<val> ++Params: gpio_out_pin GPIO for output (default "17") ++ ++ gpio_in_pin GPIO for input (default "18") ++ ++ gpio_in_pull Pull up/down/off on the input pin ++ (default "down") ++ ++ sense Override the IR receive auto-detection logic: ++ "0" = force active-high ++ "1" = force active-low ++ "-1" = use auto-detection ++ (default "-1") ++ ++ softcarrier Turn the software carrier "on" or "off" ++ (default "on") ++ ++ invert "on" = invert the output pin (default "off") ++ ++ debug "on" = enable additional debug messages ++ (default "off") ++ ++ ++Name: mcp23017 ++Info: Configures the MCP23017 I2C port expander ++Load: dtoverlay=mcp23017,<param>=<val> ++Params: gpiopin Gpio pin connected to the INTA output of the ++ MCP23017 (default: 4) ++ ++ addr I2C address of the MCP23017 (default: 0x20) ++ ++ ++Name: mcp2515-can0 ++Info: Configures the MCP2515 CAN controller on spi0.0 ++Load: dtoverlay=mcp2515-can0,<param>=<val> ++Params: oscillator Clock frequency for the CAN controller (Hz) ++ ++ spimaxfrequency Maximum SPI frequence (Hz) ++ ++ interrupt GPIO for interrupt signal ++ ++ ++Name: mcp2515-can1 ++Info: Configures the MCP2515 CAN controller on spi0.1 ++Load: dtoverlay=mcp2515-can1,<param>=<val> ++Params: oscillator Clock frequency for the CAN controller (Hz) ++ ++ spimaxfrequency Maximum SPI frequence (Hz) ++ ++ interrupt GPIO for interrupt signal ++ ++ ++Name: mmc ++Info: Selects the bcm2835-mmc SD/MMC driver, optionally with overclock ++Load: dtoverlay=mmc,<param>=<val> ++Params: overclock_50 Clock (in MHz) to use when the MMC framework ++ requests 50MHz ++ ++ ++Name: mz61581 ++Info: MZ61581 display by Tontec ++Load: dtoverlay=mz61581,<param>=<val> ++Params: speed Display SPI bus speed ++ ++ rotate Display rotation {0,90,180,270} ++ ++ fps Delay between frame updates ++ ++ txbuflen Transmit buffer length (default 32768) ++ ++ debug Debug output level {0-7} ++ ++ xohms Touchpanel sensitivity (X-plate resistance) ++ ++ ++[ The pcf2127-rtc overlay has been deleted. See i2c-rtc. ] ++ ++ ++[ The pcf8523-rtc overlay has been deleted. See i2c-rtc. ] ++ ++ ++[ The pcf8563-rtc overlay has been deleted. See i2c-rtc. ] ++ ++ ++Name: pi3-act-led ++Info: Pi3 uses a GPIO expander to drive the LEDs which can only be accessed ++ from the VPU. There is a special driver for this with a separate DT ++ node, which has the unfortunate consequence of breaking the ++ act_led_gpio and act_led_activelow dtparams. ++ This overlay changes the GPIO controller back to the standard one and ++ restores the dtparams. ++Load: dtoverlay=pi3-act-led,<param>=<val> ++Params: activelow Set to "on" to invert the sense of the LED ++ (default "off") ++ ++ gpio Set which GPIO to use for the activity LED ++ (in case you want to connect it to an external ++ device) ++ REQUIRED ++ ++ ++Name: pi3-disable-bt ++Info: Disable Pi3 Bluetooth and restore UART0/ttyAMA0 over GPIOs 14 & 15 ++ N.B. To disable the systemd service that initialises the modem so it ++ doesn't use the UART, use 'sudo systemctl disable hciuart'. ++Load: dtoverlay=pi3-disable-bt ++Params: <None> ++ ++ ++Name: pi3-miniuart-bt ++Info: Switch Pi3 Bluetooth function to use the mini-UART (ttyS0) and restore ++ UART0/ttyAMA0 over GPIOs 14 & 15. Note that this may reduce the maximum ++ usable baudrate. ++ N.B. It is also necessary to edit /lib/systemd/system/hciuart.service ++ and replace ttyAMA0 with ttyS0, unless you have a system with udev rules ++ that create /dev/serial0 and /dev/serial1, in which case use ++ /dev/serial1 instead because it will always be correct. ++Load: dtoverlay=pi3-miniuart-bt ++Params: <None> ++ ++ ++Name: piscreen ++Info: PiScreen display by OzzMaker.com ++Load: dtoverlay=piscreen,<param>=<val> ++Params: speed Display SPI bus speed ++ ++ rotate Display rotation {0,90,180,270} ++ ++ fps Delay between frame updates ++ ++ debug Debug output level {0-7} ++ ++ xohms Touchpanel sensitivity (X-plate resistance) ++ ++ ++Name: piscreen2r ++Info: PiScreen 2 with resistive TP display by OzzMaker.com ++Load: dtoverlay=piscreen2r,<param>=<val> ++Params: speed Display SPI bus speed ++ ++ rotate Display rotation {0,90,180,270} ++ ++ fps Delay between frame updates ++ ++ debug Debug output level {0-7} ++ ++ xohms Touchpanel sensitivity (X-plate resistance) ++ ++ ++Name: pitft22 ++Info: Adafruit PiTFT 2.2" screen ++Load: dtoverlay=pitft22,<param>=<val> ++Params: speed Display SPI bus speed ++ ++ rotate Display rotation {0,90,180,270} ++ ++ fps Delay between frame updates ++ ++ debug Debug output level {0-7} ++ ++ ++Name: pitft28-capacitive ++Info: Adafruit PiTFT 2.8" capacitive touch screen ++Load: dtoverlay=pitft28-capacitive,<param>=<val> ++Params: speed Display SPI bus speed ++ ++ rotate Display rotation {0,90,180,270} ++ ++ fps Delay between frame updates ++ ++ debug Debug output level {0-7} ++ ++ touch-sizex Touchscreen size x (default 240) ++ ++ touch-sizey Touchscreen size y (default 320) ++ ++ touch-invx Touchscreen inverted x axis ++ ++ touch-invy Touchscreen inverted y axis ++ ++ touch-swapxy Touchscreen swapped x y axis ++ ++ ++Name: pitft28-resistive ++Info: Adafruit PiTFT 2.8" resistive touch screen ++Load: dtoverlay=pitft28-resistive,<param>=<val> ++Params: speed Display SPI bus speed ++ ++ rotate Display rotation {0,90,180,270} ++ ++ fps Delay between frame updates ++ ++ debug Debug output level {0-7} ++ ++ ++Name: pps-gpio ++Info: Configures the pps-gpio (pulse-per-second time signal via GPIO). ++Load: dtoverlay=pps-gpio,<param>=<val> ++Params: gpiopin Input GPIO (default "18") ++ ++ ++Name: pwm ++Info: Configures a single PWM channel ++ Legal pin,function combinations for each channel: ++ PWM0: 12,4(Alt0) 18,2(Alt5) 40,4(Alt0) 52,5(Alt1) ++ PWM1: 13,4(Alt0) 19,2(Alt5) 41,4(Alt0) 45,4(Alt0) 53,5(Alt1) ++ N.B.: ++ 1) Pin 18 is the only one available on all platforms, and ++ it is the one used by the I2S audio interface. ++ Pins 12 and 13 might be better choices on an A+, B+ or Pi2. ++ 2) The onboard analogue audio output uses both PWM channels. ++ 3) So be careful mixing audio and PWM. ++ 4) Currently the clock must have been enabled and configured ++ by other means. ++Load: dtoverlay=pwm,<param>=<val> ++Params: pin Output pin (default 18) - see table ++ func Pin function (default 2 = Alt5) - see above ++ clock PWM clock frequency (informational) ++ ++ ++Name: pwm-2chan ++Info: Configures both PWM channels ++ Legal pin,function combinations for each channel: ++ PWM0: 12,4(Alt0) 18,2(Alt5) 40,4(Alt0) 52,5(Alt1) ++ PWM1: 13,4(Alt0) 19,2(Alt5) 41,4(Alt0) 45,4(Alt0) 53,5(Alt1) ++ N.B.: ++ 1) Pin 18 is the only one available on all platforms, and ++ it is the one used by the I2S audio interface. ++ Pins 12 and 13 might be better choices on an A+, B+ or Pi2. ++ 2) The onboard analogue audio output uses both PWM channels. ++ 3) So be careful mixing audio and PWM. ++ 4) Currently the clock must have been enabled and configured ++ by other means. ++Load: dtoverlay=pwm-2chan,<param>=<val> ++Params: pin Output pin (default 18) - see table ++ pin2 Output pin for other channel (default 19) ++ func Pin function (default 2 = Alt5) - see above ++ func2 Function for pin2 (default 2 = Alt5) ++ clock PWM clock frequency (informational) ++ ++ ++Name: qca7000 ++Info: I2SE's Evaluation Board for PLC Stamp micro ++Load: dtoverlay=qca7000,<param>=<val> ++Params: int_pin GPIO pin for interrupt signal (default 23) ++ ++ speed SPI bus speed (default 12 MHz) ++ ++ ++Name: raspidac3 ++Info: Configures the RaspiDAV Rev.3x audio card ++Load: dtoverlay=raspidac3 ++Params: <None> ++ ++ ++Name: rpi-backlight ++Info: Raspberry Pi official display backlight driver ++Load: dtoverlay=rpi-backlight ++Params: <None> ++ ++ ++Name: rpi-dac ++Info: Configures the RPi DAC audio card ++Load: dtoverlay=rpi-dac ++Params: <None> ++ ++ ++Name: rpi-display ++Info: RPi-Display - 2.8" Touch Display by Watterott ++Load: dtoverlay=rpi-display,<param>=<val> ++Params: speed Display SPI bus speed ++ rotate Display rotation {0,90,180,270} ++ fps Delay between frame updates ++ debug Debug output level {0-7} ++ xohms Touchpanel sensitivity (X-plate resistance) ++ swapxy Swap x and y axis ++ ++ ++Name: rpi-ft5406 ++Info: Official Raspberry Pi display touchscreen ++Load: dtoverlay=rpi-ft5406 ++Params: <None> ++ ++ ++Name: rpi-proto ++Info: Configures the RPi Proto audio card ++Load: dtoverlay=rpi-proto ++Params: <None> ++ ++ ++Name: rpi-sense ++Info: Raspberry Pi Sense HAT ++Load: dtoverlay=rpi-sense ++Params: <None> ++ ++ ++Name: rra-digidac1-wm8741-audio ++Info: Configures the Red Rocks Audio DigiDAC1 soundcard ++Load: dtoverlay=rra-digidac1-wm8741-audio ++Params: <None> ++ ++ ++Name: sdhost ++Info: Selects the bcm2835-sdhost SD/MMC driver, optionally with overclock. ++ N.B. This overlay is designed for situations where the mmc driver is ++ the default, so it disables the other (mmc) interface - this will kill ++ WiFi on a Pi3. If this isn't what you want, either use the sdtweak ++ overlay or the new sd_* dtparams of the base DTBs. ++Load: dtoverlay=sdhost,<param>=<val> ++Params: overclock_50 Clock (in MHz) to use when the MMC framework ++ requests 50MHz ++ ++ force_pio Disable DMA support (default off) ++ ++ pio_limit Number of blocks above which to use DMA ++ (default 1) ++ ++ debug Enable debug output (default off) ++ ++ ++Name: sdio ++Info: Selects the bcm2835-sdhost SD/MMC driver, optionally with overclock, ++ and enables SDIO via GPIOs 22-27. ++Load: dtoverlay=sdio,<param>=<val> ++Params: overclock_50 SD Clock (in MHz) to use when the MMC framework ++ requests 50MHz ++ ++ sdio_overclock SDIO Clock (in MHz) to use when the MMC ++ framework requests 50MHz ++ ++ force_pio Disable DMA support (default off) ++ ++ pio_limit Number of blocks above which to use DMA ++ (default 1) ++ ++ debug Enable debug output (default off) ++ ++ poll_once Disable SDIO-device polling every second ++ (default on: polling once at boot-time) ++ ++ bus_width Set the SDIO host bus width (default 4 bits) ++ ++ ++Name: sdio-1bit ++Info: Selects the bcm2835-sdhost SD/MMC driver, optionally with overclock, ++ and enables 1-bit SDIO via GPIOs 22-25. ++Load: dtoverlay=sdio-1bit,<param>=<val> ++Params: overclock_50 SD Clock (in MHz) to use when the MMC framework ++ requests 50MHz ++ ++ sdio_overclock SDIO Clock (in MHz) to use when the MMC ++ framework requests 50MHz ++ ++ force_pio Disable DMA support (default off) ++ ++ pio_limit Number of blocks above which to use DMA ++ (default 1) ++ ++ debug Enable debug output (default off) ++ ++ poll_once Disable SDIO-device polling every second ++ (default on: polling once at boot-time) ++ ++ ++Name: sdtweak ++Info: Tunes the bcm2835-sdhost SD/MMC driver ++ N.B. This functionality is now available via the sd_* dtparams in the ++ base DTB. ++Load: dtoverlay=sdtweak,<param>=<val> ++Params: overclock_50 Clock (in MHz) to use when the MMC framework ++ requests 50MHz ++ ++ force_pio Disable DMA support (default off) ++ ++ pio_limit Number of blocks above which to use DMA ++ (default 1) ++ ++ debug Enable debug output (default off) ++ ++ ++Name: smi ++Info: Enables the Secondary Memory Interface peripheral. Uses GPIOs 2-25! ++Load: dtoverlay=smi ++Params: <None> ++ ++ ++Name: smi-dev ++Info: Enables the userspace interface for the SMI driver ++Load: dtoverlay=smi-dev ++Params: <None> ++ ++ ++Name: smi-nand ++Info: Enables access to NAND flash via the SMI interface ++Load: dtoverlay=smi-nand ++Params: <None> ++ ++ ++Name: spi-gpio35-39 ++Info: move SPI function block to GPIO 35 to 39 ++Load: dtoverlay=spi-gpio35-39 ++Params: <None> ++ ++ ++Name: spi1-1cs ++Info: Enables spi1 with a single chip select (CS) line and associated spidev ++ dev node. The gpio pin number for the CS line and spidev device node ++ creation are configurable. ++ N.B.: spi1 is only accessible on devices with a 40pin header, eg: ++ A+, B+, Zero and PI2 B; as well as the Compute Module. ++Load: dtoverlay=spi1-1cs,<param>=<val> ++Params: cs0_pin GPIO pin for CS0 (default 18 - BCM SPI1_CE0). ++ cs0_spidev Set to 'disabled' to stop the creation of a ++ userspace device node /dev/spidev1.0 (default ++ is 'okay' or enabled). ++ ++ ++Name: spi1-2cs ++Info: Enables spi1 with two chip select (CS) lines and associated spidev ++ dev nodes. The gpio pin numbers for the CS lines and spidev device node ++ creation are configurable. ++ N.B.: spi1 is only accessible on devices with a 40pin header, eg: ++ A+, B+, Zero and PI2 B; as well as the Compute Module. ++Load: dtoverlay=spi1-2cs,<param>=<val> ++Params: cs0_pin GPIO pin for CS0 (default 18 - BCM SPI1_CE0). ++ cs1_pin GPIO pin for CS1 (default 17 - BCM SPI1_CE1). ++ cs0_spidev Set to 'disabled' to stop the creation of a ++ userspace device node /dev/spidev1.0 (default ++ is 'okay' or enabled). ++ cs1_spidev Set to 'disabled' to stop the creation of a ++ userspace device node /dev/spidev1.1 (default ++ is 'okay' or enabled). ++ ++ ++Name: spi1-3cs ++Info: Enables spi1 with three chip select (CS) lines and associated spidev ++ dev nodes. The gpio pin numbers for the CS lines and spidev device node ++ creation are configurable. ++ N.B.: spi1 is only accessible on devices with a 40pin header, eg: ++ A+, B+, Zero and PI2 B; as well as the Compute Module. ++Load: dtoverlay=spi1-3cs,<param>=<val> ++Params: cs0_pin GPIO pin for CS0 (default 18 - BCM SPI1_CE0). ++ cs1_pin GPIO pin for CS1 (default 17 - BCM SPI1_CE1). ++ cs2_pin GPIO pin for CS2 (default 16 - BCM SPI1_CE2). ++ cs0_spidev Set to 'disabled' to stop the creation of a ++ userspace device node /dev/spidev1.0 (default ++ is 'okay' or enabled). ++ cs1_spidev Set to 'disabled' to stop the creation of a ++ userspace device node /dev/spidev1.1 (default ++ is 'okay' or enabled). ++ cs2_spidev Set to 'disabled' to stop the creation of a ++ userspace device node /dev/spidev1.2 (default ++ is 'okay' or enabled). ++ ++ ++Name: spi2-1cs ++Info: Enables spi2 with a single chip select (CS) line and associated spidev ++ dev node. The gpio pin number for the CS line and spidev device node ++ creation are configurable. ++ N.B.: spi2 is only accessible with the Compute Module. ++Load: dtoverlay=spi2-1cs,<param>=<val> ++Params: cs0_pin GPIO pin for CS0 (default 43 - BCM SPI2_CE0). ++ cs0_spidev Set to 'disabled' to stop the creation of a ++ userspace device node /dev/spidev2.0 (default ++ is 'okay' or enabled). ++ ++ ++Name: spi2-2cs ++Info: Enables spi2 with two chip select (CS) lines and associated spidev ++ dev nodes. The gpio pin numbers for the CS lines and spidev device node ++ creation are configurable. ++ N.B.: spi2 is only accessible with the Compute Module. ++Load: dtoverlay=spi2-2cs,<param>=<val> ++Params: cs0_pin GPIO pin for CS0 (default 43 - BCM SPI2_CE0). ++ cs1_pin GPIO pin for CS1 (default 44 - BCM SPI2_CE1). ++ cs0_spidev Set to 'disabled' to stop the creation of a ++ userspace device node /dev/spidev2.0 (default ++ is 'okay' or enabled). ++ cs1_spidev Set to 'disabled' to stop the creation of a ++ userspace device node /dev/spidev2.1 (default ++ is 'okay' or enabled). ++ ++ ++Name: spi2-3cs ++Info: Enables spi2 with three chip select (CS) lines and associated spidev ++ dev nodes. The gpio pin numbers for the CS lines and spidev device node ++ creation are configurable. ++ N.B.: spi2 is only accessible with the Compute Module. ++Load: dtoverlay=spi2-3cs,<param>=<val> ++Params: cs0_pin GPIO pin for CS0 (default 43 - BCM SPI2_CE0). ++ cs1_pin GPIO pin for CS1 (default 44 - BCM SPI2_CE1). ++ cs2_pin GPIO pin for CS2 (default 45 - BCM SPI2_CE2). ++ cs0_spidev Set to 'disabled' to stop the creation of a ++ userspace device node /dev/spidev2.0 (default ++ is 'okay' or enabled). ++ cs1_spidev Set to 'disabled' to stop the creation of a ++ userspace device node /dev/spidev2.1 (default ++ is 'okay' or enabled). ++ cs2_spidev Set to 'disabled' to stop the creation of a ++ userspace device node /dev/spidev2.2 (default ++ is 'okay' or enabled). ++ ++ ++Name: tinylcd35 ++Info: 3.5" Color TFT Display by www.tinylcd.com ++ Options: Touch, RTC, keypad ++Load: dtoverlay=tinylcd35,<param>=<val> ++Params: speed Display SPI bus speed ++ ++ rotate Display rotation {0,90,180,270} ++ ++ fps Delay between frame updates ++ ++ debug Debug output level {0-7} ++ ++ touch Enable touch panel ++ ++ touchgpio Touch controller IRQ GPIO ++ ++ xohms Touchpanel: Resistance of X-plate in ohms ++ ++ rtc-pcf PCF8563 Real Time Clock ++ ++ rtc-ds DS1307 Real Time Clock ++ ++ keypad Enable keypad ++ ++ Examples: ++ Display with touchpanel, PCF8563 RTC and keypad: ++ dtoverlay=tinylcd35,touch,rtc-pcf,keypad ++ Old touch display: ++ dtoverlay=tinylcd35,touch,touchgpio=3 ++ ++ ++Name: uart1 ++Info: Enable uart1 in place of uart0 ++Load: dtoverlay=uart1,<param>=<val> ++Params: txd1_pin GPIO pin for TXD1 (14, 32 or 40 - default 14) ++ ++ rxd1_pin GPIO pin for RXD1 (15, 33 or 41 - default 15) ++ ++ ++Name: vc4-kms-v3d ++Info: Enable Eric Anholt's DRM VC4 HDMI/HVS/V3D driver. Running startx or ++ booting to GUI while this overlay is in use will cause interesting ++ lockups. ++Load: dtoverlay=vc4-kms-v3d,<param> ++Params: cma-256 CMA is 256MB, 256MB-aligned (needs 1GB) ++ cma-192 CMA is 192MB, 256MB-aligned (needs 1GB) ++ cma-128 CMA is 128MB, 128MB-aligned ++ cma-96 CMA is 96MB, 128MB-aligned ++ cma-64 CMA is 64MB, 64MB-aligned ++ ++ ++Name: vga666 ++Info: Overlay for the Fen Logic VGA666 board ++ This uses GPIOs 2-21 (so no I2C), and activates the output 2-3 seconds ++ after the kernel has started. ++Load: dtoverlay=vga666 ++Params: <None> ++ ++ ++Name: w1-gpio ++Info: Configures the w1-gpio Onewire interface module. ++ Use this overlay if you *don't* need a GPIO to drive an external pullup. ++Load: dtoverlay=w1-gpio,<param>=<val> ++Params: gpiopin GPIO for I/O (default "4") ++ ++ pullup Non-zero, "on", or "y" to enable the parasitic ++ power (2-wire, power-on-data) feature ++ ++ ++Name: w1-gpio-pullup ++Info: Configures the w1-gpio Onewire interface module. ++ Use this overlay if you *do* need a GPIO to drive an external pullup. ++Load: dtoverlay=w1-gpio-pullup,<param>=<val> ++Params: gpiopin GPIO for I/O (default "4") ++ ++ pullup Non-zero, "on", or "y" to enable the parasitic ++ power (2-wire, power-on-data) feature ++ ++ extpullup GPIO for external pullup (default "5") ++ ++ ++Name: wittypi ++Info: Configures the wittypi RTC module. ++Load: dtoverlay=wittypi,<param>=<val> ++Params: led_gpio GPIO for LED (default "17") ++ led_trigger Choose which activity the LED tracks (default ++ "default-on") ++ ++ ++Troubleshooting ++=============== ++ ++If you are experiencing problems that you think are DT-related, enable DT ++diagnostic output by adding this to /boot/config.txt: ++ ++ dtdebug=on ++ ++and rebooting. Then run: ++ ++ sudo vcdbg log msg ++ ++and look for relevant messages. ++ ++Further reading ++=============== ++ ++This is only meant to be a quick introduction to the subject of Device Tree on ++Raspberry Pi. There is a more complete explanation here: ++ ++http://www.raspberrypi.org/documentation/configuration/device-tree.md +diff --git a/arch/arm/boot/dts/overlays/adau1977-adc-overlay.dts b/arch/arm/boot/dts/overlays/adau1977-adc-overlay.dts new file mode 100644 -index 0000000..00a22be +index 0000000..24fcd58 --- /dev/null -+++ b/arch/arm/boot/dts/overlays/mmc-overlay.dts -@@ -0,0 +1,39 @@ ++++ b/arch/arm/boot/dts/overlays/adau1977-adc-overlay.dts +@@ -0,0 +1,53 @@ ++// Definitions for ADAU1977 ADC +/dts-v1/; +/plugin/; + -+/{ ++/ { + compatible = "brcm,bcm2708"; -+ ++ + fragment@0 { -+ target = <&mmc>; -+ frag0: __overlay__ { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&mmc_pins>; -+ bus-width = <4>; -+ brcm,overclock-50 = <0>; -+ status = "okay"; ++ target = <&soc>; ++ ++ __overlay__ { ++ codec_supply: fixedregulator@0 { ++ compatible = "regulator-fixed"; ++ regulator-name = "AVDD"; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ }; + }; + }; -+ ++ + fragment@1 { -+ target = <&gpio>; ++ target = <&i2c>; ++ + __overlay__ { -+ mmc_pins: mmc_pins { -+ brcm,pins = <48 49 50 51 52 53>; -+ brcm,function = <7>; /* alt3 */ -+ }; -+ }; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ adau1977: codec@11 { ++ compatible = "adi,adau1977"; ++ reg = <0x11>; ++ reset-gpios = <&gpio 5 0>; ++ AVDD-supply = <&codec_supply>; ++ }; ++ }; + }; + + fragment@2 { -+ target = <&sdhost>; ++ target = <&i2s>; + __overlay__ { -+ status = "disabled"; ++ status = "okay"; + }; + }; + -+ __overrides__ { -+ overclock_50 = <&frag0>,"brcm,overclock-50:0"; -+ force_pio = <&frag0>,"brcm,force-pio?"; ++ fragment@3 { ++ target = <&sound>; ++ __overlay__ { ++ compatible = "adi,adau1977-adc"; ++ i2s-controller = <&i2s>; ++ status = "okay"; ++ }; + }; +}; -diff --git a/arch/arm/boot/dts/overlays/mz61581-overlay.dts b/arch/arm/boot/dts/overlays/mz61581-overlay.dts +diff --git a/arch/arm/boot/dts/overlays/ads7846-overlay.dts b/arch/arm/boot/dts/overlays/ads7846-overlay.dts new file mode 100644 -index 0000000..9242a6e +index 0000000..edf2dc9 --- /dev/null -+++ b/arch/arm/boot/dts/overlays/mz61581-overlay.dts -@@ -0,0 +1,111 @@ ++++ b/arch/arm/boot/dts/overlays/ads7846-overlay.dts +@@ -0,0 +1,89 @@ +/* -+ * Device Tree overlay for MZ61581-PI-EXT 2014.12.28 by Tontec ++ * Generic Device Tree overlay for the ADS7846 touch controller + * + */ + @@ -112305,344 +116285,293 @@ index 0000000..9242a6e + target = <&spi0>; + __overlay__ { + status = "okay"; ++ }; ++ }; + -+ spidev@0{ -+ status = "disabled"; -+ }; ++ fragment@1 { ++ target = <&spidev0>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; + -+ spidev@1{ -+ status = "disabled"; -+ }; ++ fragment@2 { ++ target = <&spidev1>; ++ __overlay__ { ++ status = "disabled"; + }; + }; + -+ fragment@1 { ++ fragment@3 { + target = <&gpio>; + __overlay__ { -+ mz61581_pins: mz61581_pins { -+ brcm,pins = <4 15 18 25>; -+ brcm,function = <0 1 1 1>; /* in out out out */ ++ ads7846_pins: ads7846_pins { ++ brcm,pins = <255>; /* illegal default value */ ++ brcm,function = <0>; /* in */ ++ brcm,pull = <0>; /* none */ + }; + }; + }; + -+ fragment@2 { ++ fragment@4 { + target = <&spi0>; + __overlay__ { + /* needed to avoid dtc warning */ + #address-cells = <1>; + #size-cells = <0>; + -+ mz61581: mz61581@0{ -+ compatible = "samsung,s6d02a1"; -+ reg = <0>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&mz61581_pins>; -+ -+ spi-max-frequency = <128000000>; -+ spi-cpol; -+ spi-cpha; -+ -+ width = <320>; -+ height = <480>; -+ rotate = <270>; -+ bgr; -+ fps = <30>; -+ buswidth = <8>; -+ txbuflen = <32768>; -+ -+ reset-gpios = <&gpio 15 0>; -+ dc-gpios = <&gpio 25 0>; -+ led-gpios = <&gpio 18 0>; -+ -+ init = <0x10000b0 00 -+ 0x1000011 -+ 0x20000ff -+ 0x10000b3 0x02 0x00 0x00 0x00 -+ 0x10000c0 0x13 0x3b 0x00 0x02 0x00 0x01 0x00 0x43 -+ 0x10000c1 0x08 0x16 0x08 0x08 -+ 0x10000c4 0x11 0x07 0x03 0x03 -+ 0x10000c6 0x00 -+ 0x10000c8 0x03 0x03 0x13 0x5c 0x03 0x07 0x14 0x08 0x00 0x21 0x08 0x14 0x07 0x53 0x0c 0x13 0x03 0x03 0x21 0x00 -+ 0x1000035 0x00 -+ 0x1000036 0xa0 -+ 0x100003a 0x55 -+ 0x1000044 0x00 0x01 -+ 0x10000d0 0x07 0x07 0x1d 0x03 -+ 0x10000d1 0x03 0x30 0x10 -+ 0x10000d2 0x03 0x14 0x04 -+ 0x1000029 -+ 0x100002c>; -+ -+ /* This is a workaround to make sure the init sequence slows down and doesn't fail */ -+ debug = <3>; -+ }; -+ -+ mz61581_ts: mz61581_ts@1 { ++ ads7846: ads7846@1 { + compatible = "ti,ads7846"; + reg = <1>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&ads7846_pins>; + + spi-max-frequency = <2000000>; -+ interrupts = <4 2>; /* high-to-low edge triggered */ ++ interrupts = <255 2>; /* high-to-low edge triggered */ + interrupt-parent = <&gpio>; -+ pendown-gpio = <&gpio 4 0>; ++ pendown-gpio = <&gpio 255 0>; + -+ ti,x-plate-ohms = /bits/ 16 <60>; -+ ti,pressure-max = /bits/ 16 <255>; ++ /* driver defaults */ ++ ti,x-min = /bits/ 16 <0>; ++ ti,y-min = /bits/ 16 <0>; ++ ti,x-max = /bits/ 16 <0x0FFF>; ++ ti,y-max = /bits/ 16 <0x0FFF>; ++ ti,pressure-min = /bits/ 16 <0>; ++ ti,pressure-max = /bits/ 16 <0xFFFF>; ++ ti,x-plate-ohms = /bits/ 16 <400>; + }; + }; + }; + __overrides__ { -+ speed = <&mz61581>, "spi-max-frequency:0"; -+ rotate = <&mz61581>, "rotate:0"; -+ fps = <&mz61581>, "fps:0"; -+ txbuflen = <&mz61581>, "txbuflen:0"; -+ debug = <&mz61581>, "debug:0"; -+ xohms = <&mz61581_ts>,"ti,x-plate-ohms;0"; ++ cs = <&ads7846>,"reg:0"; ++ speed = <&ads7846>,"spi-max-frequency:0"; ++ penirq = <&ads7846_pins>,"brcm,pins:0", /* REQUIRED */ ++ <&ads7846>,"interrupts:0", ++ <&ads7846>,"pendown-gpio:4"; ++ penirq_pull = <&ads7846_pins>,"brcm,pull:0"; ++ swapxy = <&ads7846>,"ti,swap-xy?"; ++ xmin = <&ads7846>,"ti,x-min;0"; ++ ymin = <&ads7846>,"ti,y-min;0"; ++ xmax = <&ads7846>,"ti,x-max;0"; ++ ymax = <&ads7846>,"ti,y-max;0"; ++ pmin = <&ads7846>,"ti,pressure-min;0"; ++ pmax = <&ads7846>,"ti,pressure-max;0"; ++ xohms = <&ads7846>,"ti,x-plate-ohms;0"; + }; +}; -diff --git a/arch/arm/boot/dts/overlays/piscreen-overlay.dts b/arch/arm/boot/dts/overlays/piscreen-overlay.dts +diff --git a/arch/arm/boot/dts/overlays/akkordion-iqdacplus-overlay.dts b/arch/arm/boot/dts/overlays/akkordion-iqdacplus-overlay.dts new file mode 100644 -index 0000000..ba4ad33 +index 0000000..208849d --- /dev/null -+++ b/arch/arm/boot/dts/overlays/piscreen-overlay.dts -@@ -0,0 +1,96 @@ -+/* -+ * Device Tree overlay for PiScreen 3.5" display shield by Ozzmaker -+ * -+ */ -+ ++++ b/arch/arm/boot/dts/overlays/akkordion-iqdacplus-overlay.dts +@@ -0,0 +1,46 @@ ++// Definitions for Digital Dreamtime Akkordion using IQaudIO DAC+ or DACZero +/dts-v1/; +/plugin/; + +/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; ++ compatible = "brcm,bcm2708"; + + fragment@0 { -+ target = <&spi0>; ++ target = <&i2s>; + __overlay__ { + status = "okay"; -+ -+ spidev@0{ -+ status = "disabled"; -+ }; -+ -+ spidev@1{ -+ status = "disabled"; -+ }; + }; + }; + + fragment@1 { -+ target = <&gpio>; -+ __overlay__ { -+ piscreen_pins: piscreen_pins { -+ brcm,pins = <17 25 24 22>; -+ brcm,function = <0 1 1 1>; /* in out out out */ -+ }; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&spi0>; ++ target = <&i2c1>; + __overlay__ { -+ /* needed to avoid dtc warning */ + #address-cells = <1>; + #size-cells = <0>; ++ status = "okay"; + -+ piscreen: piscreen@0{ -+ compatible = "ilitek,ili9486"; -+ reg = <0>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&piscreen_pins>; -+ -+ spi-max-frequency = <24000000>; -+ rotate = <270>; -+ bgr; -+ fps = <30>; -+ buswidth = <8>; -+ regwidth = <16>; -+ reset-gpios = <&gpio 25 0>; -+ dc-gpios = <&gpio 24 0>; -+ led-gpios = <&gpio 22 1>; -+ debug = <0>; -+ -+ init = <0x10000b0 0x00 -+ 0x1000011 -+ 0x20000ff -+ 0x100003a 0x55 -+ 0x1000036 0x28 -+ 0x10000c2 0x44 -+ 0x10000c5 0x00 0x00 0x00 0x00 -+ 0x10000e0 0x0f 0x1f 0x1c 0x0c 0x0f 0x08 0x48 0x98 0x37 0x0a 0x13 0x04 0x11 0x0d 0x00 -+ 0x10000e1 0x0f 0x32 0x2e 0x0b 0x0d 0x05 0x47 0x75 0x37 0x06 0x10 0x03 0x24 0x20 0x00 -+ 0x10000e2 0x0f 0x32 0x2e 0x0b 0x0d 0x05 0x47 0x75 0x37 0x06 0x10 0x03 0x24 0x20 0x00 -+ 0x1000011 -+ 0x1000029>; ++ pcm5122@4c { ++ #sound-dai-cells = <0>; ++ compatible = "ti,pcm5122"; ++ reg = <0x4c>; ++ status = "okay"; + }; ++ }; ++ }; + -+ piscreen_ts: piscreen-ts@1 { -+ compatible = "ti,ads7846"; -+ reg = <1>; -+ -+ spi-max-frequency = <2000000>; -+ interrupts = <17 2>; /* high-to-low edge triggered */ -+ interrupt-parent = <&gpio>; -+ pendown-gpio = <&gpio 17 0>; -+ ti,swap-xy; -+ ti,x-plate-ohms = /bits/ 16 <100>; -+ ti,pressure-max = /bits/ 16 <255>; -+ }; ++ fragment@2 { ++ target = <&sound>; ++ frag2: __overlay__ { ++ compatible = "iqaudio,iqaudio-dac"; ++ card_name = "Akkordion"; ++ dai_name = "IQaudIO DAC"; ++ dai_stream_name = "IQaudIO DAC HiFi"; ++ i2s-controller = <&i2s>; ++ status = "okay"; + }; + }; ++ + __overrides__ { -+ speed = <&piscreen>,"spi-max-frequency:0"; -+ rotate = <&piscreen>,"rotate:0"; -+ fps = <&piscreen>,"fps:0"; -+ debug = <&piscreen>,"debug:0"; -+ xohms = <&piscreen_ts>,"ti,x-plate-ohms;0"; ++ 24db_digital_gain = <&frag2>,"iqaudio,24db_digital_gain?"; + }; +}; -diff --git a/arch/arm/boot/dts/overlays/pitft28-resistive-overlay.dts b/arch/arm/boot/dts/overlays/pitft28-resistive-overlay.dts +diff --git a/arch/arm/boot/dts/overlays/at86rf233-overlay.dts b/arch/arm/boot/dts/overlays/at86rf233-overlay.dts new file mode 100644 -index 0000000..d506eae +index 0000000..880c753 --- /dev/null -+++ b/arch/arm/boot/dts/overlays/pitft28-resistive-overlay.dts -@@ -0,0 +1,115 @@ -+/* -+ * Device Tree overlay for Adafruit PiTFT 2.8" resistive touch screen -+ * -+ */ -+ ++++ b/arch/arm/boot/dts/overlays/at86rf233-overlay.dts +@@ -0,0 +1,57 @@ +/dts-v1/; +/plugin/; + ++/* Overlay for Atmel AT86RF233 IEEE 802.15.4 WPAN transceiver on spi0.0 */ ++ +/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; ++ compatible = "brcm,bcm2835", "brcm,bcm2836", "brcm,bcm2708", "brcm,bcm2709"; + + fragment@0 { + target = <&spi0>; + __overlay__ { -+ status = "okay"; ++ #address-cells = <1>; ++ #size-cells = <0>; + -+ spidev@0{ -+ status = "disabled"; -+ }; ++ status = "okay"; + -+ spidev@1{ -+ status = "disabled"; ++ lowpan0: at86rf233@0 { ++ compatible = "atmel,at86rf233"; ++ reg = <0>; ++ interrupt-parent = <&gpio>; ++ interrupts = <23 4>; /* active high */ ++ reset-gpio = <&gpio 24 1>; ++ sleep-gpio = <&gpio 25 1>; ++ spi-max-frequency = <3000000>; ++ xtal-trim = /bits/ 8 <0xf>; + }; + }; + }; + + fragment@1 { -+ target = <&gpio>; ++ target = <&spidev0>; + __overlay__ { -+ pitft_pins: pitft_pins { -+ brcm,pins = <24 25>; -+ brcm,function = <0 1>; /* in out */ -+ brcm,pull = <2 0>; /* pullup none */ -+ }; ++ status = "disabled"; + }; + }; + + fragment@2 { -+ target = <&spi0>; ++ target = <&gpio>; + __overlay__ { -+ /* needed to avoid dtc warning */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ pitft: pitft@0{ -+ compatible = "ilitek,ili9340"; -+ reg = <0>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pitft_pins>; -+ -+ spi-max-frequency = <32000000>; -+ rotate = <90>; -+ fps = <25>; -+ bgr; -+ buswidth = <8>; -+ dc-gpios = <&gpio 25 0>; -+ debug = <0>; ++ lowpan0_pins: lowpan0_pins { ++ brcm,pins = <23 24 25>; ++ brcm,function = <0 1 1>; /* in out out */ + }; ++ }; ++ }; + -+ pitft_ts@1 { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ compatible = "st,stmpe610"; -+ reg = <1>; -+ -+ spi-max-frequency = <500000>; -+ irq-gpio = <&gpio 24 0x2>; /* IRQF_TRIGGER_FALLING */ -+ interrupts = <24 2>; /* high-to-low edge triggered */ -+ interrupt-parent = <&gpio>; -+ interrupt-controller; ++ __overrides__ { ++ interrupt = <&lowpan0>, "interrupts:0", ++ <&lowpan0_pins>, "brcm,pins:0"; ++ reset = <&lowpan0>, "reset-gpio:4", ++ <&lowpan0_pins>, "brcm,pins:4"; ++ sleep = <&lowpan0>, "sleep-gpio:4", ++ <&lowpan0_pins>, "brcm,pins:8"; ++ speed = <&lowpan0>, "spi-max-frequency:0"; ++ trim = <&lowpan0>, "xtal-trim.0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/audioinjector-wm8731-audio-overlay.dts b/arch/arm/boot/dts/overlays/audioinjector-wm8731-audio-overlay.dts +new file mode 100644 +index 0000000..4ed66577 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/audioinjector-wm8731-audio-overlay.dts +@@ -0,0 +1,39 @@ ++// Definitions for audioinjector.net audio add on soundcard ++/dts-v1/; ++/plugin/; + -+ stmpe_touchscreen { -+ compatible = "st,stmpe-ts"; -+ st,sample-time = <4>; -+ st,mod-12b = <1>; -+ st,ref-sel = <0>; -+ st,adc-freq = <2>; -+ st,ave-ctrl = <3>; -+ st,touch-det-delay = <4>; -+ st,settling = <2>; -+ st,fraction-z = <7>; -+ st,i-drive = <0>; -+ }; ++/ { ++ compatible = "brcm,bcm2708"; + -+ stmpe_gpio: stmpe_gpio { -+ #gpio-cells = <2>; -+ compatible = "st,stmpe-gpio"; -+ /* -+ * only GPIO2 is wired/available -+ * and it is wired to the backlight -+ */ -+ st,norequest-mask = <0x7b>; -+ }; -+ }; ++ fragment@0 { ++ target = <&i2s>; ++ __overlay__ { ++ status = "okay"; + }; + }; + -+ fragment@3 { -+ target-path = "/soc"; ++ fragment@1 { ++ target = <&i2c1>; + __overlay__ { -+ backlight { -+ compatible = "gpio-backlight"; -+ gpios = <&stmpe_gpio 2 0>; -+ default-on; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ wm8731@1a { ++ #sound-dai-cells = <0>; ++ compatible = "wlf,wm8731"; ++ reg = <0x1a>; ++ status = "okay"; + }; + }; + }; + -+ __overrides__ { -+ speed = <&pitft>,"spi-max-frequency:0"; -+ rotate = <&pitft>,"rotate:0"; -+ fps = <&pitft>,"fps:0"; -+ debug = <&pitft>,"debug:0"; ++ fragment@2 { ++ target = <&sound>; ++ __overlay__ { ++ compatible = "ai,audioinjector-pi-soundcard"; ++ i2s-controller = <&i2s>; ++ status = "okay"; ++ }; + }; +}; -diff --git a/arch/arm/boot/dts/overlays/pps-gpio-overlay.dts b/arch/arm/boot/dts/overlays/pps-gpio-overlay.dts +diff --git a/arch/arm/boot/dts/overlays/bmp085_i2c-sensor-overlay.dts b/arch/arm/boot/dts/overlays/bmp085_i2c-sensor-overlay.dts new file mode 100644 -index 0000000..40bf0e1 +index 0000000..782b171 --- /dev/null -+++ b/arch/arm/boot/dts/overlays/pps-gpio-overlay.dts -@@ -0,0 +1,34 @@ ++++ b/arch/arm/boot/dts/overlays/bmp085_i2c-sensor-overlay.dts +@@ -0,0 +1,23 @@ ++// Definitions for BMP085/BMP180 digital barometric pressure and temperature sensors from Bosch Sensortec ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&i2c_arm>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ bmp085@77 { ++ compatible = "bosch,bmp085"; ++ reg = <0x77>; ++ default-oversampling = <3>; ++ status = "okay"; ++ }; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/dht11-overlay.dts b/arch/arm/boot/dts/overlays/dht11-overlay.dts +new file mode 100644 +index 0000000..9bf67fd +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/dht11-overlay.dts +@@ -0,0 +1,39 @@ ++/* ++ * Overlay for the DHT11/21/22 humidity/temperature sensor modules. ++ */ +/dts-v1/; +/plugin/; + +/ { + compatible = "brcm,bcm2708"; ++ + fragment@0 { + target-path = "/"; + __overlay__ { -+ pps: pps { -+ compatible = "pps-gpio"; ++ ++ dht11: dht11@0 { ++ compatible = "dht11"; + pinctrl-names = "default"; -+ pinctrl-0 = <&pps_pins>; -+ gpios = <&gpio 18 0>; ++ pinctrl-0 = <&dht11_pins>; ++ gpios = <&gpio 4 0>; + status = "okay"; + }; + }; @@ -112651,177 +116580,124 @@ index 0000000..40bf0e1 + fragment@1 { + target = <&gpio>; + __overlay__ { -+ pps_pins: pps_pins { -+ brcm,pins = <18>; -+ brcm,function = <0>; // in -+ brcm,pull = <0>; // off ++ dht11_pins: dht11_pins { ++ brcm,pins = <4>; ++ brcm,function = <0>; // in ++ brcm,pull = <0>; // off + }; + }; + }; + + __overrides__ { -+ gpiopin = <&pps>,"gpios:4", -+ <&pps_pins>,"brcm,pins:0"; ++ gpiopin = <&dht11_pins>,"brcm,pins:0", ++ <&dht11>,"gpios:4"; + }; +}; -diff --git a/arch/arm/boot/dts/overlays/pwm-2chan-overlay.dts b/arch/arm/boot/dts/overlays/pwm-2chan-overlay.dts +diff --git a/arch/arm/boot/dts/overlays/dpi24-overlay.dts b/arch/arm/boot/dts/overlays/dpi24-overlay.dts new file mode 100644 -index 0000000..957e1a4 +index 0000000..e4dbe40 --- /dev/null -+++ b/arch/arm/boot/dts/overlays/pwm-2chan-overlay.dts -@@ -0,0 +1,46 @@ ++++ b/arch/arm/boot/dts/overlays/dpi24-overlay.dts +@@ -0,0 +1,31 @@ +/dts-v1/; +/plugin/; + -+/* -+This is the 2-channel overlay - only use it if you need both channels. ++/{ ++ compatible = "brcm,bcm2708"; + -+Legal pin,function combinations for each channel: -+ PWM0: 12,4(Alt0) 18,2(Alt5) 40,4(Alt0) 52,5(Alt1) -+ PWM1: 13,4(Alt0) 19,2(Alt5) 41,4(Alt0) 45,4(Alt0) 53,5(Alt1) -+ -+N.B.: -+ 1) Pin 18 is the only one available on all platforms, and -+ it is the one used by the I2S audio interface. -+ Pins 12 and 13 might be better choices on an A+, B+ or Pi2. -+ 2) The onboard analogue audio output uses both PWM channels. -+ 3) So be careful mixing audio and PWM. -+*/ ++ // There is no DPI driver module, but we need a platform device ++ // node (that doesn't already use pinctrl) to hang the pinctrl ++ // reference on - leds will do + -+/ { + fragment@0 { -+ target = <&gpio>; ++ target = <&leds>; + __overlay__ { -+ pwm_pins: pwm_pins { -+ brcm,pins = <18 19>; -+ brcm,function = <2 2>; /* Alt5 */ -+ }; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&dpi24_pins>; + }; + }; + + fragment@1 { -+ target = <&pwm>; ++ target = <&gpio>; + __overlay__ { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pwm_pins>; -+ status = "okay"; ++ dpi24_pins: dpi24_pins { ++ brcm,pins = <0 1 2 3 4 5 6 7 8 9 10 11 ++ 12 13 14 15 16 17 18 19 20 ++ 21 22 23 24 25 26 27>; ++ brcm,function = <6>; /* alt2 */ ++ brcm,pull = <0>; /* no pull */ ++ }; + }; + }; -+ -+ __overrides__ { -+ pin = <&pwm_pins>,"brcm,pins:0"; -+ pin2 = <&pwm_pins>,"brcm,pins:4"; -+ func = <&pwm_pins>,"brcm,function:0"; -+ func2 = <&pwm_pins>,"brcm,function:4"; -+ clock = <&clk_pwm>,"clock-frequency:0"; -+ }; +}; -diff --git a/arch/arm/boot/dts/overlays/pwm-overlay.dts b/arch/arm/boot/dts/overlays/pwm-overlay.dts +diff --git a/arch/arm/boot/dts/overlays/dwc-otg-overlay.dts b/arch/arm/boot/dts/overlays/dwc-otg-overlay.dts new file mode 100644 -index 0000000..ddd67ff +index 0000000..fc48bd1 --- /dev/null -+++ b/arch/arm/boot/dts/overlays/pwm-overlay.dts -@@ -0,0 +1,42 @@ ++++ b/arch/arm/boot/dts/overlays/dwc-otg-overlay.dts +@@ -0,0 +1,20 @@ +/dts-v1/; +/plugin/; + -+/* -+Legal pin,function combinations for each channel: -+ PWM0: 12,4(Alt0) 18,2(Alt5) 40,4(Alt0) 52,5(Alt1) -+ PWM1: 13,4(Alt0) 19,2(Alt5) 41,4(Alt0) 45,4(Alt0) 53,5(Alt1) -+ -+N.B.: -+ 1) Pin 18 is the only one available on all platforms, and -+ it is the one used by the I2S audio interface. -+ Pins 12 and 13 might be better choices on an A+, B+ or Pi2. -+ 2) The onboard analogue audio output uses both PWM channels. -+ 3) So be careful mixing audio and PWM. -+*/ ++/{ ++ compatible = "brcm,bcm2708"; + -+/ { + fragment@0 { -+ target = <&gpio>; -+ __overlay__ { -+ pwm_pins: pwm_pins { -+ brcm,pins = <18>; -+ brcm,function = <2>; /* Alt5 */ -+ }; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&pwm>; ++ target = <&usb>; ++ #address-cells = <1>; ++ #size-cells = <1>; + __overlay__ { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pwm_pins>; ++ compatible = "brcm,bcm2708-usb"; ++ reg = <0x7e980000 0x10000>, ++ <0x7e006000 0x1000>; ++ interrupts = <2 0>, ++ <1 9>; + status = "okay"; + }; + }; -+ -+ __overrides__ { -+ pin = <&pwm_pins>,"brcm,pins:0"; -+ func = <&pwm_pins>,"brcm,function:0"; -+ clock = <&clk_pwm>,"clock-frequency:0"; -+ }; +}; -diff --git a/arch/arm/boot/dts/overlays/raspidac3-overlay.dts b/arch/arm/boot/dts/overlays/raspidac3-overlay.dts +diff --git a/arch/arm/boot/dts/overlays/dwc2-overlay.dts b/arch/arm/boot/dts/overlays/dwc2-overlay.dts new file mode 100644 -index 0000000..1bd8054 +index 0000000..527abc9 --- /dev/null -+++ b/arch/arm/boot/dts/overlays/raspidac3-overlay.dts -@@ -0,0 +1,45 @@ -+// Definitions for RaspiDACv3 ++++ b/arch/arm/boot/dts/overlays/dwc2-overlay.dts +@@ -0,0 +1,29 @@ +/dts-v1/; +/plugin/; + -+/ { ++/{ + compatible = "brcm,bcm2708"; + + fragment@0 { -+ target = <&sound>; -+ __overlay__ { -+ compatible = "jg,raspidacv3"; -+ i2s-controller = <&i2s>; -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&i2s>; -+ __overlay__ { ++ target = <&usb>; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ dwc2_usb: __overlay__ { ++ compatible = "brcm,bcm2835-usb"; ++ reg = <0x7e980000 0x10000>; ++ interrupts = <1 9>; ++ dr_mode = "otg"; ++ g-np-tx-fifo-size = <32>; ++ g-rx-fifo-size = <256>; ++ g-tx-fifo-size = <256 128 128 64 64 64 32>; + status = "okay"; + }; + }; + -+ fragment@2 { -+ target = <&i2c1>; -+ __overlay__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; -+ -+ pcm5122@4c { -+ #sound-dai-cells = <0>; -+ compatible = "ti,pcm5122"; -+ reg = <0x4c>; -+ status = "okay"; -+ }; -+ -+ tpa6130a2: tpa6130a2@60 { -+ compatible = "ti,tpa6130a2"; -+ reg = <0x60>; -+ status = "okay"; -+ }; -+ }; ++ __overrides__ { ++ dr_mode = <&dwc2_usb>, "dr_mode"; ++ g-np-tx-fifo-size = <&dwc2_usb>,"g-np-tx-fifo-size:0"; ++ g-rx-fifo-size = <&dwc2_usb>,"g-rx-fifo-size:0"; ++ g-tx-fifo-size = <&dwc2_usb>,"g-tx-fifo-size:0"; + }; +}; -diff --git a/arch/arm/boot/dts/overlays/rpi-dac-overlay.dts b/arch/arm/boot/dts/overlays/rpi-dac-overlay.dts +diff --git a/arch/arm/boot/dts/overlays/enc28j60-overlay.dts b/arch/arm/boot/dts/overlays/enc28j60-overlay.dts new file mode 100644 -index 0000000..7fc6ac99 +index 0000000..db8a8fe --- /dev/null -+++ b/arch/arm/boot/dts/overlays/rpi-dac-overlay.dts -@@ -0,0 +1,34 @@ -+// Definitions for RPi DAC ++++ b/arch/arm/boot/dts/overlays/enc28j60-overlay.dts +@@ -0,0 +1,53 @@ ++// Overlay for the Microchip ENC28J60 Ethernet Controller +/dts-v1/; +/plugin/; + @@ -112829,126 +116705,109 @@ index 0000000..7fc6ac99 + compatible = "brcm,bcm2708"; + + fragment@0 { -+ target = <&sound>; ++ target = <&spi0>; + __overlay__ { -+ compatible = "rpi,rpi-dac"; -+ i2s-controller = <&i2s>; ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ + status = "okay"; ++ ++ eth1: enc28j60@0{ ++ compatible = "microchip,enc28j60"; ++ reg = <0>; /* CE0 */ ++ pinctrl-names = "default"; ++ pinctrl-0 = <&eth1_pins>; ++ interrupt-parent = <&gpio>; ++ interrupts = <25 0x2>; /* falling edge */ ++ spi-max-frequency = <12000000>; ++ status = "okay"; ++ }; + }; + }; + + fragment@1 { -+ target = <&i2s>; ++ target = <&spidev0>; + __overlay__ { -+ status = "okay"; ++ status = "disabled"; + }; + }; + + fragment@2 { -+ target-path = "/"; ++ target = <&gpio>; + __overlay__ { -+ pcm1794a-codec { -+ #sound-dai-cells = <0>; -+ compatible = "ti,pcm1794a"; -+ status = "okay"; ++ eth1_pins: eth1_pins { ++ brcm,pins = <25>; ++ brcm,function = <0>; /* in */ ++ brcm,pull = <0>; /* none */ + }; + }; + }; ++ ++ __overrides__ { ++ int_pin = <&eth1>, "interrupts:0", ++ <&eth1_pins>, "brcm,pins:0"; ++ speed = <&eth1>, "spi-max-frequency:0"; ++ }; +}; -diff --git a/arch/arm/boot/dts/overlays/rpi-display-overlay.dts b/arch/arm/boot/dts/overlays/rpi-display-overlay.dts +diff --git a/arch/arm/boot/dts/overlays/gpio-ir-overlay.dts b/arch/arm/boot/dts/overlays/gpio-ir-overlay.dts new file mode 100644 -index 0000000..a8fa974 +index 0000000..a2d6bc7 --- /dev/null -+++ b/arch/arm/boot/dts/overlays/rpi-display-overlay.dts -@@ -0,0 +1,82 @@ -+/* -+ * Device Tree overlay for rpi-display by Watterott -+ * -+ */ -+ ++++ b/arch/arm/boot/dts/overlays/gpio-ir-overlay.dts +@@ -0,0 +1,45 @@ ++// Definitions for ir-gpio module +/dts-v1/; +/plugin/; + +/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; -+ -+ fragment@0 { -+ target = <&spi0>; -+ __overlay__ { -+ status = "okay"; -+ -+ spidev@0{ -+ status = "disabled"; -+ }; ++ compatible = "brcm,bcm2708"; + -+ spidev@1{ -+ status = "disabled"; -+ }; -+ }; -+ }; ++ fragment@0 { ++ target-path = "/"; ++ __overlay__ { ++ gpio_ir: ir-receiver { ++ compatible = "gpio-ir-receiver"; + -+ fragment@1 { -+ target = <&gpio>; -+ __overlay__ { -+ rpi_display_pins: rpi_display_pins { -+ brcm,pins = <18 23 24 25>; -+ brcm,function = <1 1 1 0>; /* out out out in */ -+ brcm,pull = <0 0 0 2>; /* - - - up */ -+ }; -+ }; -+ }; ++ // pin number, high or low ++ gpios = <&gpio 18 1>; + -+ fragment@2 { -+ target = <&spi0>; -+ __overlay__ { -+ /* needed to avoid dtc warning */ -+ #address-cells = <1>; -+ #size-cells = <0>; ++ // parameter for keymap name ++ linux,rc-map-name = "rc-rc6-mce"; + -+ rpidisplay: rpi-display@0{ -+ compatible = "ilitek,ili9341"; -+ reg = <0>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&rpi_display_pins>; ++ status = "okay"; ++ }; ++ }; ++ }; + -+ spi-max-frequency = <32000000>; -+ rotate = <270>; -+ bgr; -+ fps = <30>; -+ buswidth = <8>; -+ reset-gpios = <&gpio 23 0>; -+ dc-gpios = <&gpio 24 0>; -+ led-gpios = <&gpio 18 1>; -+ debug = <0>; -+ }; ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ gpio_ir_pins: gpio_ir_pins { ++ brcm,pins = <18>; // pin 18 ++ brcm,function = <0>; // in ++ brcm,pull = <1>; // down ++ }; ++ }; ++ }; + -+ rpidisplay_ts: rpi-display-ts@1 { -+ compatible = "ti,ads7846"; -+ reg = <1>; ++ __overrides__ { ++ // parameters ++ gpio_pin = <&gpio_ir>,"gpios:4", ++ <&gpio_ir_pins>,"brcm,pins:0", ++ <&gpio_ir_pins>,"brcm,pull:0"; // pin number ++ gpio_pull = <&gpio_ir_pins>,"brcm,pull:0"; // pull-up/down state + -+ spi-max-frequency = <2000000>; -+ interrupts = <25 2>; /* high-to-low edge triggered */ -+ interrupt-parent = <&gpio>; -+ pendown-gpio = <&gpio 25 0>; -+ ti,x-plate-ohms = /bits/ 16 <60>; -+ ti,pressure-max = /bits/ 16 <255>; -+ }; -+ }; -+ }; -+ __overrides__ { -+ speed = <&rpidisplay>,"spi-max-frequency:0"; -+ rotate = <&rpidisplay>,"rotate:0"; -+ fps = <&rpidisplay>,"fps:0"; -+ debug = <&rpidisplay>,"debug:0"; -+ xohms = <&rpidisplay_ts>,"ti,x-plate-ohms;0"; -+ }; ++ rc-map-name = <&gpio_ir>,"linux,rc-map-name"; // default rc map ++ }; +}; -diff --git a/arch/arm/boot/dts/overlays/rpi-ft5406-overlay.dts b/arch/arm/boot/dts/overlays/rpi-ft5406-overlay.dts +diff --git a/arch/arm/boot/dts/overlays/gpio-poweroff-overlay.dts b/arch/arm/boot/dts/overlays/gpio-poweroff-overlay.dts new file mode 100644 -index 0000000..2e53a17 +index 0000000..ff8cb36 --- /dev/null -+++ b/arch/arm/boot/dts/overlays/rpi-ft5406-overlay.dts -@@ -0,0 +1,17 @@ ++++ b/arch/arm/boot/dts/overlays/gpio-poweroff-overlay.dts +@@ -0,0 +1,34 @@ ++// Definitions for gpio-poweroff module +/dts-v1/; +/plugin/; + @@ -112958,21 +116817,37 @@ index 0000000..2e53a17 + fragment@0 { + target-path = "/"; + __overlay__ { -+ rpi_ft5406: rpi_ft5406 { -+ compatible = "rpi,rpi-ft5406"; -+ firmware = <&firmware>; -+ status = "okay"; ++ power_ctrl: power_ctrl { ++ compatible = "gpio-poweroff"; ++ gpios = <&gpio 26 0>; ++ force; + }; + }; + }; ++ ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ power_ctrl_pins: power_ctrl_pins { ++ brcm,pins = <26>; ++ brcm,function = <1>; // out ++ }; ++ }; ++ }; ++ ++ __overrides__ { ++ gpiopin = <&power_ctrl>,"gpios:4", ++ <&power_ctrl_pins>,"brcm,pins:0"; ++ active_low = <&power_ctrl>,"gpios:8"; ++ }; +}; -diff --git a/arch/arm/boot/dts/overlays/rpi-proto-overlay.dts b/arch/arm/boot/dts/overlays/rpi-proto-overlay.dts +diff --git a/arch/arm/boot/dts/overlays/hifiberry-amp-overlay.dts b/arch/arm/boot/dts/overlays/hifiberry-amp-overlay.dts new file mode 100644 -index 0000000..2029930 +index 0000000..5f57855 --- /dev/null -+++ b/arch/arm/boot/dts/overlays/rpi-proto-overlay.dts ++++ b/arch/arm/boot/dts/overlays/hifiberry-amp-overlay.dts @@ -0,0 +1,39 @@ -+// Definitions for Rpi-Proto ++// Definitions for HiFiBerry Amp/Amp+ +/dts-v1/; +/plugin/; + @@ -112980,367 +116855,291 @@ index 0000000..2029930 + compatible = "brcm,bcm2708"; + + fragment@0 { -+ target = <&sound>; -+ __overlay__ { -+ compatible = "rpi,rpi-proto"; -+ i2s-controller = <&i2s>; -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@1 { + target = <&i2s>; + __overlay__ { + status = "okay"; + }; + }; + -+ fragment@2 { ++ fragment@1 { + target = <&i2c1>; + __overlay__ { + #address-cells = <1>; + #size-cells = <0>; + status = "okay"; + -+ wm8731@1a { ++ tas5713@1b { + #sound-dai-cells = <0>; -+ compatible = "wlf,wm8731"; -+ reg = <0x1a>; ++ compatible = "ti,tas5713"; ++ reg = <0x1b>; + status = "okay"; + }; + }; + }; ++ ++ fragment@2 { ++ target = <&sound>; ++ __overlay__ { ++ compatible = "hifiberry,hifiberry-amp"; ++ i2s-controller = <&i2s>; ++ status = "okay"; ++ }; ++ }; +}; -diff --git a/arch/arm/boot/dts/overlays/rpi-sense-overlay.dts b/arch/arm/boot/dts/overlays/rpi-sense-overlay.dts +diff --git a/arch/arm/boot/dts/overlays/hifiberry-dac-overlay.dts b/arch/arm/boot/dts/overlays/hifiberry-dac-overlay.dts new file mode 100644 -index 0000000..2715324 +index 0000000..0b74fdc --- /dev/null -+++ b/arch/arm/boot/dts/overlays/rpi-sense-overlay.dts -@@ -0,0 +1,47 @@ -+// rpi-sense HAT ++++ b/arch/arm/boot/dts/overlays/hifiberry-dac-overlay.dts +@@ -0,0 +1,34 @@ ++// Definitions for HiFiBerry DAC +/dts-v1/; +/plugin/; + +/ { -+ compatible = "brcm,bcm2708", "brcm,bcm2709"; ++ compatible = "brcm,bcm2708"; + + fragment@0 { -+ target = <&i2c1>; ++ target = <&i2s>; + __overlay__ { -+ #address-cells = <1>; -+ #size-cells = <0>; + status = "okay"; ++ }; ++ }; + -+ rpi-sense@46 { -+ compatible = "rpi,rpi-sense"; -+ reg = <0x46>; -+ keys-int-gpios = <&gpio 23 1>; -+ status = "okay"; -+ }; -+ -+ lsm9ds1-magn@1c { -+ compatible = "st,lsm9ds1-magn"; -+ reg = <0x1c>; -+ status = "okay"; -+ }; -+ -+ lsm9ds1-accel6a { -+ compatible = "st,lsm9ds1-accel"; -+ reg = <0x6a>; -+ status = "okay"; -+ }; -+ -+ lps25h-press@5c { -+ compatible = "st,lps25h-press"; -+ reg = <0x5c>; ++ fragment@1 { ++ target-path = "/"; ++ __overlay__ { ++ pcm5102a-codec { ++ #sound-dai-cells = <0>; ++ compatible = "ti,pcm5102a"; + status = "okay"; + }; ++ }; ++ }; + -+ hts221-humid@5f { -+ compatible = "st,hts221-humid"; -+ reg = <0x5f>; -+ status = "okay"; -+ }; ++ fragment@2 { ++ target = <&sound>; ++ __overlay__ { ++ compatible = "hifiberry,hifiberry-dac"; ++ i2s-controller = <&i2s>; ++ status = "okay"; + }; + }; +}; -diff --git a/arch/arm/boot/dts/overlays/sdhost-overlay.dts b/arch/arm/boot/dts/overlays/sdhost-overlay.dts +diff --git a/arch/arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts b/arch/arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts new file mode 100644 -index 0000000..85f0725 +index 0000000..2f078d4 --- /dev/null -+++ b/arch/arm/boot/dts/overlays/sdhost-overlay.dts -@@ -0,0 +1,29 @@ ++++ b/arch/arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts +@@ -0,0 +1,56 @@ ++// Definitions for HiFiBerry DAC+ +/dts-v1/; +/plugin/; + -+/{ ++/ { + compatible = "brcm,bcm2708"; + + fragment@0 { -+ target = <&mmc>; ++ target-path = "/clocks"; + __overlay__ { -+ status = "disabled"; ++ dacpro_osc: dacpro_osc { ++ compatible = "hifiberry,dacpro-clk"; ++ #clock-cells = <0>; ++ }; + }; + }; + + fragment@1 { -+ target = <&sdhost>; -+ frag1: __overlay__ { -+ brcm,overclock-50 = <0>; -+ brcm,pio-limit = <1>; ++ target = <&i2s>; ++ __overlay__ { + status = "okay"; + }; + }; + -+ __overrides__ { -+ overclock_50 = <&frag1>,"brcm,overclock-50:0"; -+ force_pio = <&frag1>,"brcm,force-pio?"; -+ pio_limit = <&frag1>,"brcm,pio-limit:0"; -+ debug = <&frag1>,"brcm,debug?"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/sdio-overlay.dts b/arch/arm/boot/dts/overlays/sdio-overlay.dts -new file mode 100644 -index 0000000..afc8742 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/sdio-overlay.dts -@@ -0,0 +1,32 @@ -+/* Enable SDIO from MMC interface via GPIOs 22-27. Includes sdhost overlay. */ -+ -+/include/ "sdhost-overlay.dts" -+ -+/{ -+ compatible = "brcm,bcm2708"; -+ -+ fragment@3 { -+ target = <&mmc>; -+ sdio_mmc: __overlay__ { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&sdio_pins>; -+ non-removable; ++ fragment@2 { ++ target = <&i2c1>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; + status = "okay"; -+ }; -+ }; + -+ fragment@4 { -+ target = <&gpio>; -+ __overlay__ { -+ sdio_pins: sdio_pins { -+ brcm,pins = <22 23 24 25 26 27>; -+ brcm,function = <7 7 7 7 7 7>; /* ALT3 = SD1 */ -+ brcm,pull = <0 2 2 2 2 2>; ++ pcm5122@4d { ++ #sound-dai-cells = <0>; ++ compatible = "ti,pcm5122"; ++ reg = <0x4d>; ++ clocks = <&dacpro_osc>; ++ status = "okay"; + }; + }; + }; + -+ __overrides__ { -+ poll_once = <&sdio_mmc>,"non-removable?"; ++ fragment@3 { ++ target = <&sound>; ++ hifiberry_dacplus: __overlay__ { ++ compatible = "hifiberry,hifiberry-dacplus"; ++ i2s-controller = <&i2s>; ++ status = "okay"; ++ }; + }; -+}; -diff --git a/arch/arm/boot/dts/overlays/smi-dev-overlay.dts b/arch/arm/boot/dts/overlays/smi-dev-overlay.dts -new file mode 100644 -index 0000000..b610d82 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/smi-dev-overlay.dts -@@ -0,0 +1,18 @@ -+// Description: Overlay to enable character device interface for SMI. -+// Author: Luke Wren <luke@raspberrypi.org> -+ -+/dts-v1/; -+/plugin/; + -+/{ -+ fragment@0 { -+ target = <&soc>; -+ __overlay__ { -+ smi_dev { -+ compatible = "brcm,bcm2835-smi-dev"; -+ smi_handle = <&smi>; -+ status = "okay"; -+ }; -+ }; ++ __overrides__ { ++ 24db_digital_gain = ++ <&hifiberry_dacplus>,"hifiberry,24db_digital_gain?"; ++ slave = <&hifiberry_dacplus>,"hifiberry-dacplus,slave?"; + }; +}; -diff --git a/arch/arm/boot/dts/overlays/smi-nand-overlay.dts b/arch/arm/boot/dts/overlays/smi-nand-overlay.dts +diff --git a/arch/arm/boot/dts/overlays/hifiberry-digi-overlay.dts b/arch/arm/boot/dts/overlays/hifiberry-digi-overlay.dts new file mode 100644 -index 0000000..13ce0b7 +index 0000000..f5e41f4 --- /dev/null -+++ b/arch/arm/boot/dts/overlays/smi-nand-overlay.dts -@@ -0,0 +1,69 @@ -+// Description: Overlay to enable NAND flash through -+// the secondary memory interface -+// Author: Luke Wren -+ ++++ b/arch/arm/boot/dts/overlays/hifiberry-digi-overlay.dts +@@ -0,0 +1,39 @@ ++// Definitions for HiFiBerry Digi +/dts-v1/; +/plugin/; + -+/{ ++/ { + compatible = "brcm,bcm2708"; + + fragment@0 { -+ target = <&smi>; ++ target = <&i2s>; + __overlay__ { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&smi_pins>; + status = "okay"; + }; + }; + + fragment@1 { -+ target = <&soc>; ++ target = <&i2c1>; + __overlay__ { + #address-cells = <1>; -+ #size-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; + -+ nand: flash@0 { -+ compatible = "brcm,bcm2835-smi-nand"; -+ smi_handle = <&smi>; -+ #address-cells = <1>; -+ #size-cells = <1>; ++ wm8804@3b { ++ #sound-dai-cells = <0>; ++ compatible = "wlf,wm8804"; ++ reg = <0x3b>; + status = "okay"; -+ -+ partition@0 { -+ label = "stage2"; -+ // 128k -+ reg = <0 0x20000>; -+ read-only; -+ }; -+ partition@1 { -+ label = "firmware"; -+ // 16M -+ reg = <0x20000 0x1000000>; -+ read-only; -+ }; -+ partition@2 { -+ label = "root"; -+ // 2G (will need to use 64 bit for >=4G) -+ reg = <0x1020000 0x80000000>; -+ }; + }; + }; + }; + + fragment@2 { -+ target = <&gpio>; ++ target = <&sound>; + __overlay__ { -+ smi_pins: smi_pins { -+ brcm,pins = <0 1 2 3 4 5 6 7 8 9 10 11 -+ 12 13 14 15>; -+ /* Alt 1: SMI */ -+ brcm,function = <5 5 5 5 5 5 5 5 5 5 5 -+ 5 5 5 5 5>; -+ /* /CS, /WE and /OE are pulled high, as they are -+ generally active low signals */ -+ brcm,pull = <2 2 2 2 2 2 2 2 0 0 0 0 0 0 0 0>; -+ }; ++ compatible = "hifiberry,hifiberry-digi"; ++ i2s-controller = <&i2s>; ++ status = "okay"; + }; + }; +}; -diff --git a/arch/arm/boot/dts/overlays/smi-overlay.dts b/arch/arm/boot/dts/overlays/smi-overlay.dts +diff --git a/arch/arm/boot/dts/overlays/hy28a-overlay.dts b/arch/arm/boot/dts/overlays/hy28a-overlay.dts new file mode 100644 -index 0000000..095f52c +index 0000000..ac0f3c2 --- /dev/null -+++ b/arch/arm/boot/dts/overlays/smi-overlay.dts -@@ -0,0 +1,37 @@ -+// Description: Overlay to enable the secondary memory interface peripheral -+// Author: Luke Wren ++++ b/arch/arm/boot/dts/overlays/hy28a-overlay.dts +@@ -0,0 +1,93 @@ ++/* ++ * Device Tree overlay for HY28A display ++ * ++ */ + +/dts-v1/; +/plugin/; + -+/{ -+ compatible = "brcm,bcm2708"; ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; + + fragment@0 { -+ target = <&smi>; ++ target = <&spi0>; + __overlay__ { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&smi_pins>; + status = "okay"; + }; + }; + + fragment@1 { -+ target = <&gpio>; ++ target = <&spidev0>; + __overlay__ { -+ smi_pins: smi_pins { -+ /* Don't configure the top two address bits, as -+ these are already used as ID_SD and ID_SC */ -+ brcm,pins = <2 3 4 5 6 7 8 9 10 11 12 13 14 15 -+ 16 17 18 19 20 21 22 23 24 25>; -+ /* Alt 0: SMI */ -+ brcm,function = <5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 -+ 5 5 5 5 5 5 5 5 5>; -+ /* /CS, /WE and /OE are pulled high, as they are -+ generally active low signals */ -+ brcm,pull = <2 2 2 2 2 2 0 0 0 0 0 0 0 0 0 0 0 -+ 0 0 0 0 0 0 0>; -+ }; ++ status = "disabled"; + }; + }; -+}; -diff --git a/arch/arm/boot/dts/overlays/spi-gpio35-39-overlay.dts b/arch/arm/boot/dts/overlays/spi-gpio35-39-overlay.dts -new file mode 100644 -index 0000000..9648063 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/spi-gpio35-39-overlay.dts -@@ -0,0 +1,31 @@ -+/* -+ * Device tree overlay to move spi0 to gpio 35 to 39 on CM -+ */ -+ -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2836", "brcm,bcm2708", "brcm,bcm2709"; + -+ fragment@0 { -+ target = <&spi0>; ++ fragment@2 { ++ target = <&spidev1>; + __overlay__ { -+ cs-gpios = <&gpio 36 1>, <&gpio 35 1>; ++ status = "disabled"; + }; + }; + -+ fragment@1 { -+ target = <&spi0_cs_pins>; ++ fragment@3 { ++ target = <&gpio>; + __overlay__ { -+ bcrm,pins = <36 35>; ++ hy28a_pins: hy28a_pins { ++ brcm,pins = <17 25 18>; ++ brcm,function = <0 1 1>; /* in out out */ ++ }; + }; + }; + -+ fragment@2 { -+ target = <&spi0_pins>; ++ fragment@4 { ++ target = <&spi0>; + __overlay__ { -+ bcrm,pins = <37 38 39>; ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ hy28a: hy28a@0{ ++ compatible = "ilitek,ili9320"; ++ reg = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&hy28a_pins>; ++ ++ spi-max-frequency = <32000000>; ++ spi-cpol; ++ spi-cpha; ++ rotate = <270>; ++ bgr; ++ fps = <50>; ++ buswidth = <8>; ++ startbyte = <0x70>; ++ reset-gpios = <&gpio 25 0>; ++ led-gpios = <&gpio 18 1>; ++ debug = <0>; ++ }; ++ ++ hy28a_ts: hy28a-ts@1 { ++ compatible = "ti,ads7846"; ++ reg = <1>; ++ ++ spi-max-frequency = <2000000>; ++ interrupts = <17 2>; /* high-to-low edge triggered */ ++ interrupt-parent = <&gpio>; ++ pendown-gpio = <&gpio 17 0>; ++ ti,x-plate-ohms = /bits/ 16 <100>; ++ ti,pressure-max = /bits/ 16 <255>; ++ }; + }; + }; ++ __overrides__ { ++ speed = <&hy28a>,"spi-max-frequency:0"; ++ rotate = <&hy28a>,"rotate:0"; ++ fps = <&hy28a>,"fps:0"; ++ debug = <&hy28a>,"debug:0"; ++ xohms = <&hy28a_ts>,"ti,x-plate-ohms;0"; ++ resetgpio = <&hy28a>,"reset-gpios:4", ++ <&hy28a_pins>, "brcm,pins:1"; ++ ledgpio = <&hy28a>,"led-gpios:4", ++ <&hy28a_pins>, "brcm,pins:2"; ++ }; +}; -diff --git a/arch/arm/boot/dts/overlays/tinylcd35-overlay.dts b/arch/arm/boot/dts/overlays/tinylcd35-overlay.dts +diff --git a/arch/arm/boot/dts/overlays/hy28b-overlay.dts b/arch/arm/boot/dts/overlays/hy28b-overlay.dts new file mode 100644 -index 0000000..f7102c8 +index 0000000..8018aeb --- /dev/null -+++ b/arch/arm/boot/dts/overlays/tinylcd35-overlay.dts -@@ -0,0 +1,216 @@ ++++ b/arch/arm/boot/dts/overlays/hy28b-overlay.dts +@@ -0,0 +1,148 @@ +/* -+ * tinylcd35-overlay.dts -+ * -+ * ------------------------------------------------- -+ * www.tinlylcd.com -+ * ------------------------------------------------- -+ * Device---Driver-----BUS GPIO's -+ * display tinylcd35 spi0.0 25 24 18 -+ * touch ads7846 spi0.1 5 -+ * rtc ds1307 i2c1-0068 -+ * rtc pcf8563 i2c1-0051 -+ * keypad gpio-keys --------- 17 22 27 23 28 -+ * -+ * -+ * TinyLCD.com 3.5 inch TFT -+ * -+ * Version 001 -+ * 5/3/2015 -- Noralf Trønnes Initial Device tree framework -+ * 10/3/2015 -- tinylcd@gmail.com added ds1307 support. ++ * Device Tree overlay for HY28b display shield by Texy + * + */ + @@ -113354,196 +117153,325 @@ index 0000000..f7102c8 + target = <&spi0>; + __overlay__ { + status = "okay"; ++ }; ++ }; + -+ spidev@0{ -+ status = "disabled"; -+ }; ++ fragment@1 { ++ target = <&spidev0>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; + -+ spidev@1{ -+ status = "disabled"; -+ }; ++ fragment@2 { ++ target = <&spidev1>; ++ __overlay__ { ++ status = "disabled"; + }; + }; + -+ fragment@1 { ++ fragment@3 { + target = <&gpio>; + __overlay__ { -+ tinylcd35_pins: tinylcd35_pins { -+ brcm,pins = <25 24 18>; -+ brcm,function = <1>; /* out */ -+ }; -+ tinylcd35_ts_pins: tinylcd35_ts_pins { -+ brcm,pins = <5>; -+ brcm,function = <0>; /* in */ -+ }; -+ keypad_pins: keypad_pins { -+ brcm,pins = <4 17 22 23 27>; -+ brcm,function = <0>; /* in */ -+ brcm,pull = <1>; /* down */ ++ hy28b_pins: hy28b_pins { ++ brcm,pins = <17 25 18>; ++ brcm,function = <0 1 1>; /* in out out */ + }; + }; + }; + -+ fragment@2 { ++ fragment@4 { + target = <&spi0>; + __overlay__ { + /* needed to avoid dtc warning */ + #address-cells = <1>; + #size-cells = <0>; + -+ tinylcd35: tinylcd35@0{ -+ compatible = "neosec,tinylcd"; ++ hy28b: hy28b@0{ ++ compatible = "ilitek,ili9325"; + reg = <0>; + pinctrl-names = "default"; -+ pinctrl-0 = <&tinylcd35_pins>, -+ <&tinylcd35_ts_pins>; ++ pinctrl-0 = <&hy28b_pins>; + + spi-max-frequency = <48000000>; ++ spi-cpol; ++ spi-cpha; + rotate = <270>; -+ fps = <20>; + bgr; ++ fps = <50>; + buswidth = <8>; ++ startbyte = <0x70>; + reset-gpios = <&gpio 25 0>; -+ dc-gpios = <&gpio 24 0>; + led-gpios = <&gpio 18 1>; -+ debug = <0>; + -+ init = <0x10000B0 0x80 -+ 0x10000C0 0x0A 0x0A -+ 0x10000C1 0x01 0x01 -+ 0x10000C2 0x33 -+ 0x10000C5 0x00 0x42 0x80 -+ 0x10000B1 0xD0 0x11 -+ 0x10000B4 0x02 -+ 0x10000B6 0x00 0x22 0x3B -+ 0x10000B7 0x07 -+ 0x1000036 0x58 -+ 0x10000F0 0x36 0xA5 0xD3 -+ 0x10000E5 0x80 -+ 0x10000E5 0x01 -+ 0x10000B3 0x00 -+ 0x10000E5 0x00 -+ 0x10000F0 0x36 0xA5 0x53 -+ 0x10000E0 0x00 0x35 0x33 0x00 0x00 0x00 0x00 0x35 0x33 0x00 0x00 0x00 -+ 0x100003A 0x55 -+ 0x1000011 -+ 0x2000001 -+ 0x1000029>; ++ gamma = "04 1F 4 7 7 0 7 7 6 0\n0F 00 1 7 4 0 0 0 6 7"; ++ ++ init = <0x10000e7 0x0010 ++ 0x1000000 0x0001 ++ 0x1000001 0x0100 ++ 0x1000002 0x0700 ++ 0x1000003 0x1030 ++ 0x1000004 0x0000 ++ 0x1000008 0x0207 ++ 0x1000009 0x0000 ++ 0x100000a 0x0000 ++ 0x100000c 0x0001 ++ 0x100000d 0x0000 ++ 0x100000f 0x0000 ++ 0x1000010 0x0000 ++ 0x1000011 0x0007 ++ 0x1000012 0x0000 ++ 0x1000013 0x0000 ++ 0x2000032 ++ 0x1000010 0x1590 ++ 0x1000011 0x0227 ++ 0x2000032 ++ 0x1000012 0x009c ++ 0x2000032 ++ 0x1000013 0x1900 ++ 0x1000029 0x0023 ++ 0x100002b 0x000e ++ 0x2000032 ++ 0x1000020 0x0000 ++ 0x1000021 0x0000 ++ 0x2000032 ++ 0x1000050 0x0000 ++ 0x1000051 0x00ef ++ 0x1000052 0x0000 ++ 0x1000053 0x013f ++ 0x1000060 0xa700 ++ 0x1000061 0x0001 ++ 0x100006a 0x0000 ++ 0x1000080 0x0000 ++ 0x1000081 0x0000 ++ 0x1000082 0x0000 ++ 0x1000083 0x0000 ++ 0x1000084 0x0000 ++ 0x1000085 0x0000 ++ 0x1000090 0x0010 ++ 0x1000092 0x0000 ++ 0x1000093 0x0003 ++ 0x1000095 0x0110 ++ 0x1000097 0x0000 ++ 0x1000098 0x0000 ++ 0x1000007 0x0133 ++ 0x1000020 0x0000 ++ 0x1000021 0x0000 ++ 0x2000064>; ++ debug = <0>; + }; + -+ tinylcd35_ts: tinylcd35_ts@1 { ++ hy28b_ts: hy28b-ts@1 { + compatible = "ti,ads7846"; + reg = <1>; -+ status = "disabled"; + + spi-max-frequency = <2000000>; -+ interrupts = <5 2>; /* high-to-low edge triggered */ ++ interrupts = <17 2>; /* high-to-low edge triggered */ + interrupt-parent = <&gpio>; -+ pendown-gpio = <&gpio 5 0>; ++ pendown-gpio = <&gpio 17 0>; + ti,x-plate-ohms = /bits/ 16 <100>; + ti,pressure-max = /bits/ 16 <255>; + }; + }; + }; ++ __overrides__ { ++ speed = <&hy28b>,"spi-max-frequency:0"; ++ rotate = <&hy28b>,"rotate:0"; ++ fps = <&hy28b>,"fps:0"; ++ debug = <&hy28b>,"debug:0"; ++ xohms = <&hy28b_ts>,"ti,x-plate-ohms;0"; ++ resetgpio = <&hy28b>,"reset-gpios:4", ++ <&hy28b_pins>, "brcm,pins:1"; ++ ledgpio = <&hy28b>,"led-gpios:4", ++ <&hy28b_pins>, "brcm,pins:2"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/i2c-gpio-overlay.dts b/arch/arm/boot/dts/overlays/i2c-gpio-overlay.dts +new file mode 100644 +index 0000000..2a2dc98 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/i2c-gpio-overlay.dts +@@ -0,0 +1,28 @@ ++// Overlay for i2c_gpio bitbanging host bus. ++/dts-v1/; ++/plugin/; + -+ /* RTC */ ++/ { ++ compatible = "brcm,bcm2708"; + -+ fragment@3 { -+ target = <&i2c1>; ++ fragment@0 { ++ target-path = "/"; + __overlay__ { ++ i2c_gpio: i2c@0 { ++ compatible = "i2c-gpio"; ++ gpios = <&gpio 23 0 /* sda */ ++ &gpio 24 0 /* scl */ ++ >; ++ i2c-gpio,delay-us = <2>; /* ~100 kHz */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ }; ++ }; ++ }; ++ __overrides__ { ++ i2c_gpio_sda = <&i2c_gpio>,"gpios:4"; ++ i2c_gpio_scl = <&i2c_gpio>,"gpios:16"; ++ i2c_gpio_delay_us = <&i2c_gpio>,"i2c-gpio,delay-us:0"; ++ }; ++}; ++ +diff --git a/arch/arm/boot/dts/overlays/i2c-mux-overlay.dts b/arch/arm/boot/dts/overlays/i2c-mux-overlay.dts +new file mode 100644 +index 0000000..976d38e +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/i2c-mux-overlay.dts +@@ -0,0 +1,139 @@ ++// Umbrella I2C Mux overlay ++ ++/dts-v1/; ++/plugin/; ++ ++/{ ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&i2c_arm>; ++ __dormant__ { + #address-cells = <1>; + #size-cells = <0>; ++ status = "okay"; + -+ pcf8563: pcf8563@51 { -+ compatible = "nxp,pcf8563"; -+ reg = <0x51>; -+ status = "disabled"; ++ pca9542: mux@70 { ++ compatible = "nxp,pca9542"; ++ reg = <0x70>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ i2c@0 { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ reg = <0>; ++ }; ++ i2c@1 { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ reg = <1>; ++ }; + }; + }; + }; + -+ fragment@4 { -+ target = <&i2c1>; -+ __overlay__ { ++ fragment@1 { ++ target = <&i2c_arm>; ++ __dormant__ { + #address-cells = <1>; + #size-cells = <0>; ++ status = "okay"; + -+ ds1307: ds1307@68 { -+ compatible = "maxim,ds1307"; -+ reg = <0x68>; -+ status = "disabled"; ++ pca9545: mux@70 { ++ compatible = "nxp,pca9545"; ++ reg = <0x70>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ i2c@0 { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ reg = <0>; ++ }; ++ i2c@1 { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ reg = <1>; ++ }; ++ i2c@2 { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ reg = <2>; ++ }; ++ i2c@3 { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ reg = <3>; ++ }; + }; + }; + }; + -+ /* -+ * Values for input event code is found under the -+ * 'Keys and buttons' heading in include/uapi/linux/input.h -+ */ -+ fragment@5 { -+ target-path = "/soc"; -+ __overlay__ { -+ keypad: keypad { -+ compatible = "gpio-keys"; ++ fragment@2 { ++ target = <&i2c_arm>; ++ __dormant__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ pca9548: mux@70 { ++ compatible = "nxp,pca9548"; ++ reg = <0x70>; + #address-cells = <1>; + #size-cells = <0>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&keypad_pins>; -+ status = "disabled"; -+ autorepeat; + -+ button@17 { -+ label = "GPIO KEY_UP"; -+ linux,code = <103>; -+ gpios = <&gpio 17 0>; ++ i2c@0 { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ reg = <0>; + }; -+ button@22 { -+ label = "GPIO KEY_DOWN"; -+ linux,code = <108>; -+ gpios = <&gpio 22 0>; ++ i2c@1 { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ reg = <1>; + }; -+ button@27 { -+ label = "GPIO KEY_LEFT"; -+ linux,code = <105>; -+ gpios = <&gpio 27 0>; ++ i2c@2 { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ reg = <2>; + }; -+ button@23 { -+ label = "GPIO KEY_RIGHT"; -+ linux,code = <106>; -+ gpios = <&gpio 23 0>; ++ i2c@3 { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ reg = <3>; + }; -+ button@4 { -+ label = "GPIO KEY_ENTER"; -+ linux,code = <28>; -+ gpios = <&gpio 4 0>; ++ i2c@4 { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ reg = <4>; ++ }; ++ i2c@5 { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ reg = <5>; ++ }; ++ i2c@6 { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ reg = <6>; ++ }; ++ i2c@7 { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ reg = <7>; + }; + }; + }; + }; + + __overrides__ { -+ speed = <&tinylcd35>,"spi-max-frequency:0"; -+ rotate = <&tinylcd35>,"rotate:0"; -+ fps = <&tinylcd35>,"fps:0"; -+ debug = <&tinylcd35>,"debug:0"; -+ touch = <&tinylcd35_ts>,"status"; -+ touchgpio = <&tinylcd35_ts_pins>,"brcm,pins:0", -+ <&tinylcd35_ts>,"interrupts:0", -+ <&tinylcd35_ts>,"pendown-gpio:4"; -+ xohms = <&tinylcd35_ts>,"ti,x-plate-ohms;0"; -+ rtc-pcf = <&i2c1>,"status", -+ <&pcf8563>,"status"; -+ rtc-ds = <&i2c1>,"status", -+ <&ds1307>,"status"; -+ keypad = <&keypad>,"status"; ++ pca9542 = <0>, "+0"; ++ pca9545 = <0>, "+1"; ++ pca9548 = <0>, "+2"; ++ ++ addr = <&pca9542>,"reg:0", ++ <&pca9545>,"reg:0", ++ <&pca9548>,"reg:0"; + }; +}; -diff --git a/arch/arm/boot/dts/overlays/uart1-overlay.dts b/arch/arm/boot/dts/overlays/uart1-overlay.dts +diff --git a/arch/arm/boot/dts/overlays/i2c-pwm-pca9685a-overlay.dts b/arch/arm/boot/dts/overlays/i2c-pwm-pca9685a-overlay.dts new file mode 100644 -index 0000000..fa73e1f +index 0000000..d1ffd23 --- /dev/null -+++ b/arch/arm/boot/dts/overlays/uart1-overlay.dts -@@ -0,0 +1,38 @@ ++++ b/arch/arm/boot/dts/overlays/i2c-pwm-pca9685a-overlay.dts +@@ -0,0 +1,26 @@ ++// Definitions for NXP PCA9685A I2C PWM controller on ARM I2C bus. +/dts-v1/; +/plugin/; + @@ -113551,80 +117479,308 @@ index 0000000..fa73e1f + compatible = "brcm,bcm2708"; + + fragment@0 { -+ target = <&uart1>; ++ target = <&i2c_arm>; + __overlay__ { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&uart1_pins>; ++ #address-cells = <1>; ++ #size-cells = <0>; + status = "okay"; -+ }; -+ }; + -+ fragment@1 { -+ target = <&gpio>; -+ __overlay__ { -+ uart1_pins: uart1_pins { -+ brcm,pins = <14 15>; -+ brcm,function = <2>; /* alt5 */ -+ brcm,pull = <0 2>; ++ pca: pca@40 { ++ compatible = "nxp,pca9685"; ++ #pwm-cells = <2>; ++ reg = <0x40>; ++ status = "okay"; + }; + }; + }; -+ -+ fragment@2 { -+ target-path = "/chosen"; -+ __overlay__ { -+ bootargs = "8250.nr_uarts=1"; -+ }; -+ }; -+ + __overrides__ { -+ txd1_pin = <&uart1_pins>,"brcm,pins:0"; -+ rxd1_pin = <&uart1_pins>,"brcm,pins:4"; ++ addr = <&pca>,"reg:0"; + }; +}; -diff --git a/arch/arm/boot/dts/overlays/vga666-overlay.dts b/arch/arm/boot/dts/overlays/vga666-overlay.dts +diff --git a/arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts b/arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts new file mode 100644 -index 0000000..7fcab96 +index 0000000..4065647 --- /dev/null -+++ b/arch/arm/boot/dts/overlays/vga666-overlay.dts -@@ -0,0 +1,30 @@ ++++ b/arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts +@@ -0,0 +1,69 @@ ++// Definitions for several I2C based Real Time Clocks +/dts-v1/; +/plugin/; + -+/{ ++/ { + compatible = "brcm,bcm2708"; + -+ // There is no VGA driver module, but we need a platform device -+ // node (that doesn't already use pinctrl) to hang the pinctrl -+ // reference on - leds will do -+ + fragment@0 { -+ target = <&leds>; ++ target = <&i2c_arm>; + __overlay__ { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&vga666_pins>; -+ }; -+ }; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ ds1307: ds1307@68 { ++ compatible = "maxim,ds1307"; ++ reg = <0x68>; ++ status = "disable"; ++ }; ++ ds1339: ds1339@68 { ++ compatible = "dallas,ds1339"; ++ trickle-resistor-ohms = <0>; ++ reg = <0x68>; ++ status = "disable"; ++ }; ++ mcp7940x: mcp7940x@6f { ++ compatible = "microchip,mcp7940x"; ++ reg = <0x6f>; ++ status = "disable"; ++ }; ++ mcp7941x: mcp7941x@6f { ++ compatible = "microchip,mcp7941x"; ++ reg = <0x6f>; ++ status = "disable"; ++ }; ++ ds3231: ds3231@68 { ++ compatible = "maxim,ds3231"; ++ reg = <0x68>; ++ status = "disable"; ++ }; ++ pcf2127: pcf2127@51 { ++ compatible = "nxp,pcf2127"; ++ reg = <0x51>; ++ status = "disable"; ++ }; ++ pcf8523: pcf8523@68 { ++ compatible = "nxp,pcf8523"; ++ reg = <0x68>; ++ status = "disable"; ++ }; ++ pcf8563: pcf8563@51 { ++ compatible = "nxp,pcf8563"; ++ reg = <0x51>; ++ status = "disable"; ++ }; ++ }; ++ }; ++ __overrides__ { ++ ds1307 = <&ds1307>,"status"; ++ ds1339 = <&ds1339>,"status"; ++ ds3231 = <&ds3231>,"status"; ++ mcp7940x = <&mcp7940x>,"status"; ++ mcp7941x = <&mcp7941x>,"status"; ++ pcf2127 = <&pcf2127>,"status"; ++ pcf8523 = <&pcf8523>,"status"; ++ pcf8563 = <&pcf8563>,"status"; ++ trickle-resistor-ohms = <&ds1339>,"trickle-resistor-ohms:0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/i2c0-bcm2708-overlay.dts b/arch/arm/boot/dts/overlays/i2c0-bcm2708-overlay.dts +new file mode 100644 +index 0000000..1f4fc7b +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/i2c0-bcm2708-overlay.dts +@@ -0,0 +1,61 @@ ++/* ++ * Device tree overlay for i2c_bcm2708, i2c0 bus ++ * ++ * Compile: ++ * dtc -@ -I dts -O dtb -o i2c0-bcm2708-overlay.dtb i2c0-bcm2708-overlay.dts ++ */ ++ ++/dts-v1/; ++/plugin/; ++ ++/{ ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&i2c0>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&i2c0_pins>; ++ frag1: __overlay__ { ++ brcm,pins = <0 1>; ++ brcm,function = <4>; /* alt0 */ ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&i2c0_pins>; ++ __dormant__ { ++ brcm,pins = <28 29>; ++ brcm,function = <4>; /* alt0 */ ++ }; ++ }; ++ ++ fragment@3 { ++ target = <&i2c0_pins>; ++ __dormant__ { ++ brcm,pins = <44 45>; ++ brcm,function = <5>; /* alt1 */ ++ }; ++ }; ++ ++ fragment@4 { ++ target = <&i2c0_pins>; ++ __dormant__ { ++ brcm,pins = <46 47>; ++ brcm,function = <4>; /* alt0 */ ++ }; ++ }; ++ ++ __overrides__ { ++ sda0_pin = <&frag1>,"brcm,pins:0"; ++ scl0_pin = <&frag1>,"brcm,pins:4"; ++ pins_0_1 = <0>,"+1-2-3-4"; ++ pins_28_29 = <0>,"-1+2-3-4"; ++ pins_44_45 = <0>,"-1-2+3-4"; ++ pins_46_47 = <0>,"-1-2-3+4"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/i2c1-bcm2708-overlay.dts b/arch/arm/boot/dts/overlays/i2c1-bcm2708-overlay.dts +new file mode 100644 +index 0000000..e303b9c +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/i2c1-bcm2708-overlay.dts +@@ -0,0 +1,37 @@ ++/* ++ * Device tree overlay for i2c_bcm2708, i2c1 bus ++ * ++ * Compile: ++ * dtc -@ -I dts -O dtb -o i2c1-bcm2708-overlay.dtb i2c1-bcm2708-overlay.dts ++ */ ++ ++/dts-v1/; ++/plugin/; ++ ++/{ ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&i2c1>; ++ __overlay__ { ++ pinctrl-0 = <&i2c1_pins>; ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ i2c1_pins: i2c1 { ++ brcm,pins = <2 3>; ++ brcm,function = <4>; /* alt0 */ ++ }; ++ }; ++ }; ++ ++ __overrides__ { ++ sda1_pin = <&i2c1_pins>,"brcm,pins:0"; ++ scl1_pin = <&i2c1_pins>,"brcm,pins:4"; ++ pin_func = <&i2c1_pins>,"brcm,function:0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/i2s-gpio28-31-overlay.dts b/arch/arm/boot/dts/overlays/i2s-gpio28-31-overlay.dts +new file mode 100644 +index 0000000..30c356d6 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/i2s-gpio28-31-overlay.dts +@@ -0,0 +1,18 @@ ++/* ++ * Device tree overlay to move i2s to gpio 28 to 31 on CM ++ */ ++ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2836", "brcm,bcm2708", "brcm,bcm2709"; ++ ++ fragment@0 { ++ target = <&i2s_pins>; ++ __overlay__ { ++ brcm,pins = <28 29 30 31>; ++ brcm,function = <6>; /* alt2 */ ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/i2s-mmap-overlay.dts b/arch/arm/boot/dts/overlays/i2s-mmap-overlay.dts +new file mode 100644 +index 0000000..a11160a +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/i2s-mmap-overlay.dts +@@ -0,0 +1,13 @@ ++/dts-v1/; ++/plugin/; ++ ++/{ ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&i2s>; ++ __overlay__ { ++ brcm,enable-mmap; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/iqaudio-dac-overlay.dts b/arch/arm/boot/dts/overlays/iqaudio-dac-overlay.dts +new file mode 100644 +index 0000000..0d35c85 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/iqaudio-dac-overlay.dts +@@ -0,0 +1,43 @@ ++// Definitions for IQaudIO DAC ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&i2s>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; + + fragment@1 { -+ target = <&gpio>; ++ target = <&i2c1>; + __overlay__ { -+ vga666_pins: vga666_pins { -+ brcm,pins = <2 3 4 5 6 7 8 9 10 11 12 -+ 13 14 15 16 17 18 19 20 21>; -+ brcm,function = <6>; /* alt2 */ -+ brcm,pull = <0>; /* no pull */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ pcm5122@4c { ++ #sound-dai-cells = <0>; ++ compatible = "ti,pcm5122"; ++ reg = <0x4c>; ++ status = "okay"; + }; + }; + }; ++ ++ fragment@2 { ++ target = <&sound>; ++ frag2: __overlay__ { ++ compatible = "iqaudio,iqaudio-dac"; ++ i2s-controller = <&i2s>; ++ status = "okay"; ++ }; ++ }; ++ ++ __overrides__ { ++ 24db_digital_gain = <&frag2>,"iqaudio,24db_digital_gain?"; ++ }; +}; -diff --git a/arch/arm/boot/dts/overlays/w1-gpio-overlay.dts b/arch/arm/boot/dts/overlays/w1-gpio-overlay.dts +diff --git a/arch/arm/boot/dts/overlays/iqaudio-dacplus-overlay.dts b/arch/arm/boot/dts/overlays/iqaudio-dacplus-overlay.dts new file mode 100644 -index 0000000..29a3b48 +index 0000000..1d0663e --- /dev/null -+++ b/arch/arm/boot/dts/overlays/w1-gpio-overlay.dts -@@ -0,0 +1,39 @@ -+// Definitions for w1-gpio module (without external pullup) ++++ b/arch/arm/boot/dts/overlays/iqaudio-dacplus-overlay.dts +@@ -0,0 +1,43 @@ ++// Definitions for IQaudIO DAC+ +/dts-v1/; +/plugin/; + @@ -113632,44 +117788,97 @@ index 0000000..29a3b48 + compatible = "brcm,bcm2708"; + + fragment@0 { -+ target-path = "/"; ++ target = <&i2s>; + __overlay__ { ++ status = "okay"; ++ }; ++ }; + -+ w1: onewire@0 { -+ compatible = "w1-gpio"; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&w1_pins>; -+ gpios = <&gpio 4 0>; -+ rpi,parasitic-power = <0>; ++ fragment@1 { ++ target = <&i2c1>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ pcm5122@4c { ++ #sound-dai-cells = <0>; ++ compatible = "ti,pcm5122"; ++ reg = <0x4c>; + status = "okay"; + }; + }; + }; + ++ fragment@2 { ++ target = <&sound>; ++ frag2: __overlay__ { ++ compatible = "iqaudio,iqaudio-dac"; ++ i2s-controller = <&i2s>; ++ status = "okay"; ++ }; ++ }; ++ ++ __overrides__ { ++ 24db_digital_gain = <&frag2>,"iqaudio,24db_digital_gain?"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/justboom-dac-overlay.dts b/arch/arm/boot/dts/overlays/justboom-dac-overlay.dts +new file mode 100644 +index 0000000..312632a +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/justboom-dac-overlay.dts +@@ -0,0 +1,43 @@ ++// Definitions for JustBoom DAC ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&i2s>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ + fragment@1 { -+ target = <&gpio>; ++ target = <&i2c1>; + __overlay__ { -+ w1_pins: w1_pins { -+ brcm,pins = <4>; -+ brcm,function = <0>; // in (initially) -+ brcm,pull = <0>; // off ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ pcm5122@4d { ++ #sound-dai-cells = <0>; ++ compatible = "ti,pcm5122"; ++ reg = <0x4d>; ++ status = "okay"; + }; + }; + }; + ++ fragment@2 { ++ target = <&sound>; ++ frag2: __overlay__ { ++ compatible = "justboom,justboom-dac"; ++ i2s-controller = <&i2s>; ++ status = "okay"; ++ }; ++ }; ++ + __overrides__ { -+ gpiopin = <&w1>,"gpios:4", -+ <&w1_pins>,"brcm,pins:0"; -+ pullup = <&w1>,"rpi,parasitic-power:0"; ++ 24db_digital_gain = <&frag2>,"justboom,24db_digital_gain?"; + }; +}; -diff --git a/arch/arm/boot/dts/overlays/w1-gpio-pullup-overlay.dts b/arch/arm/boot/dts/overlays/w1-gpio-pullup-overlay.dts +diff --git a/arch/arm/boot/dts/overlays/justboom-digi-overlay.dts b/arch/arm/boot/dts/overlays/justboom-digi-overlay.dts new file mode 100644 -index 0000000..66a98f6 +index 0000000..cbbede9 --- /dev/null -+++ b/arch/arm/boot/dts/overlays/w1-gpio-pullup-overlay.dts -@@ -0,0 +1,41 @@ -+// Definitions for w1-gpio module (with external pullup) ++++ b/arch/arm/boot/dts/overlays/justboom-digi-overlay.dts +@@ -0,0 +1,39 @@ ++// Definitions for JustBoom Digi +/dts-v1/; +/plugin/; + @@ -113677,16 +117886,74 @@ index 0000000..66a98f6 + compatible = "brcm,bcm2708"; + + fragment@0 { -+ target-path = "/"; ++ target = <&i2s>; + __overlay__ { ++ status = "okay"; ++ }; ++ }; + -+ w1: onewire@0 { -+ compatible = "w1-gpio"; ++ fragment@1 { ++ target = <&i2c1>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ wm8804@3b { ++ #sound-dai-cells = <0>; ++ compatible = "wlf,wm8804"; ++ reg = <0x3b>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&sound>; ++ __overlay__ { ++ compatible = "justboom,justboom-digi"; ++ i2s-controller = <&i2s>; ++ status = "okay"; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/lirc-rpi-overlay.dts b/arch/arm/boot/dts/overlays/lirc-rpi-overlay.dts +new file mode 100644 +index 0000000..7d5d82b +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/lirc-rpi-overlay.dts +@@ -0,0 +1,57 @@ ++// Definitions for lirc-rpi module ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target-path = "/"; ++ __overlay__ { ++ lirc_rpi: lirc_rpi { ++ compatible = "rpi,lirc-rpi"; + pinctrl-names = "default"; -+ pinctrl-0 = <&w1_pins>; -+ gpios = <&gpio 4 0>, <&gpio 5 1>; -+ rpi,parasitic-power = <0>; ++ pinctrl-0 = <&lirc_pins>; + status = "okay"; ++ ++ // Override autodetection of IR receiver circuit ++ // (0 = active high, 1 = active low, -1 = no override ) ++ rpi,sense = <0xffffffff>; ++ ++ // Software carrier ++ // (0 = off, 1 = on) ++ rpi,softcarrier = <1>; ++ ++ // Invert output ++ // (0 = off, 1 = on) ++ rpi,invert = <0>; ++ ++ // Enable debugging messages ++ // (0 = off, 1 = on) ++ rpi,debug = <0>; + }; + }; + }; @@ -113694,3499 +117961,3204 @@ index 0000000..66a98f6 + fragment@1 { + target = <&gpio>; + __overlay__ { -+ w1_pins: w1_pins { -+ brcm,pins = <4 5>; -+ brcm,function = <0 1>; // in out -+ brcm,pull = <0 0>; // off off ++ lirc_pins: lirc_pins { ++ brcm,pins = <17 18>; ++ brcm,function = <1 0>; // out in ++ brcm,pull = <0 1>; // off down + }; + }; + }; + + __overrides__ { -+ gpiopin = <&w1>,"gpios:4", -+ <&w1_pins>,"brcm,pins:0"; -+ extpullup = <&w1>,"gpios:16", -+ <&w1_pins>,"brcm,pins:4"; -+ pullup = <&w1>,"rpi,parasitic-power:0"; ++ gpio_out_pin = <&lirc_pins>,"brcm,pins:0"; ++ gpio_in_pin = <&lirc_pins>,"brcm,pins:4"; ++ gpio_in_pull = <&lirc_pins>,"brcm,pull:4"; ++ ++ sense = <&lirc_rpi>,"rpi,sense:0"; ++ softcarrier = <&lirc_rpi>,"rpi,softcarrier:0"; ++ invert = <&lirc_rpi>,"rpi,invert:0"; ++ debug = <&lirc_rpi>,"rpi,debug:0"; + }; +}; - -From 23eabf2220f0f748df3e88a35e55a82c53242b4a Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= <noralf@tronnes.org> -Date: Sat, 15 Aug 2015 20:47:07 +0200 -Subject: [PATCH 053/170] bcm2835: Match with BCM2708 Device Trees -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Signed-off-by: Noralf Trønnes <noralf@tronnes.org> ---- - arch/arm/boot/dts/bcm2835-rpi-b-plus.dts | 132 ++++++++++++++++++--- - arch/arm/boot/dts/bcm2835-rpi-b.dts | 115 ++++++++++++++++-- - arch/arm/boot/dts/bcm2835.dtsi | 195 +++---------------------------- - 3 files changed, 237 insertions(+), 205 deletions(-) - -diff --git a/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts b/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts -index 668442b..17e2443 100644 ---- a/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts -+++ b/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts -@@ -1,30 +1,128 @@ - /dts-v1/; --#include "bcm2835-rpi.dtsi" -+#include "bcm2835.dtsi" - - / { - compatible = "raspberrypi,model-b-plus", "brcm,bcm2835"; - model = "Raspberry Pi Model B+"; -+}; - -- leds { -- act { -- gpios = <&gpio 47 0>; -- }; -+&gpio { -+ spi0_pins: spi0_pins { -+ brcm,pins = <7 8 9 10 11>; -+ brcm,function = <4>; /* alt0 */ +diff --git a/arch/arm/boot/dts/overlays/mcp23017-overlay.dts b/arch/arm/boot/dts/overlays/mcp23017-overlay.dts +new file mode 100644 +index 0000000..412f966 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/mcp23017-overlay.dts +@@ -0,0 +1,54 @@ ++// Definitions for MCP23017 Gpio Extender from Microchip Semiconductor ++ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; ++ ++ fragment@0 { ++ target = <&i2c1>; ++ __overlay__ { ++ status = "okay"; ++ }; + }; - -- pwr { -- label = "PWR"; -- gpios = <&gpio 35 0>; -- default-state = "keep"; -- linux,default-trigger = "default-on"; -- }; -+ i2c0_pins: i2c0 { -+ brcm,pins = <0 1>; -+ brcm,function = <4>; - }; --}; - --&gpio { -- pinctrl-0 = <&gpioout &alt0 &i2s_alt0 &alt3>; -+ i2c1_pins: i2c1 { -+ brcm,pins = <2 3>; -+ brcm,function = <4>; ++ ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ mcp23017_pins: mcp23017_pins { ++ brcm,pins = <4>; ++ brcm,function = <0>; ++ }; ++ }; + }; - -- /* I2S interface */ -- i2s_alt0: i2s_alt0 { -+ i2s_pins: i2s { - brcm,pins = <18 19 20 21>; -- brcm,function = <BCM2835_FSEL_ALT0>; -+ brcm,function = <4>; /* alt0 */ ++ ++ fragment@2 { ++ target = <&i2c1>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ mcp23017: mcp@20 { ++ compatible = "microchip,mcp23017"; ++ reg = <0x20>; ++ gpio-controller; ++ #gpio-cells = <2>; ++ #interrupt-cells=<2>; ++ interrupt-parent = <&gpio>; ++ interrupts = <4 2>; ++ interrupt-controller; ++ microchip,irq-mirror; ++ ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ __overrides__ { ++ gpiopin = <&mcp23017_pins>,"brcm,pins:0", ++ <&mcp23017>,"interrupts:0"; ++ addr = <&mcp23017>,"reg:0"; + }; +}; + -+&mmc { -+ status = "okay"; -+ bus-width = <4>; -+}; +diff --git a/arch/arm/boot/dts/overlays/mcp2515-can0-overlay.dts b/arch/arm/boot/dts/overlays/mcp2515-can0-overlay.dts +new file mode 100755 +index 0000000..c96cdae +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/mcp2515-can0-overlay.dts +@@ -0,0 +1,73 @@ ++/* ++ * Device tree overlay for mcp251x/can0 on spi0.0 ++ */ + -+&fb { -+ status = "okay"; -+}; ++/dts-v1/; ++/plugin/; + -+&uart0 { -+ status = "okay"; ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2836", "brcm,bcm2708", "brcm,bcm2709"; ++ /* disable spi-dev for spi0.0 */ ++ fragment@0 { ++ target = <&spi0>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&spidev0>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; ++ ++ /* the interrupt pin of the can-controller */ ++ fragment@2 { ++ target = <&gpio>; ++ __overlay__ { ++ can0_pins: can0_pins { ++ brcm,pins = <25>; ++ brcm,function = <0>; /* input */ ++ }; ++ }; ++ }; ++ ++ /* the clock/oscillator of the can-controller */ ++ fragment@3 { ++ target-path = "/clocks"; ++ __overlay__ { ++ /* external oscillator of mcp2515 on SPI0.0 */ ++ can0_osc: can0_osc { ++ compatible = "fixed-clock"; ++ #clock-cells = <0>; ++ clock-frequency = <16000000>; ++ }; ++ }; ++ }; ++ ++ /* the spi config of the can-controller itself binding everything together */ ++ fragment@4 { ++ target = <&spi0>; ++ __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ can0: mcp2515@0 { ++ reg = <0>; ++ compatible = "microchip,mcp2515"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&can0_pins>; ++ spi-max-frequency = <10000000>; ++ interrupt-parent = <&gpio>; ++ interrupts = <25 0x2>; ++ clocks = <&can0_osc>; ++ }; ++ }; ++ }; ++ __overrides__ { ++ oscillator = <&can0_osc>,"clock-frequency:0"; ++ spimaxfrequency = <&can0>,"spi-max-frequency:0"; ++ interrupt = <&can0_pins>,"brcm,pins:0",<&can0>,"interrupts:0"; ++ }; +}; +diff --git a/arch/arm/boot/dts/overlays/mcp2515-can1-overlay.dts b/arch/arm/boot/dts/overlays/mcp2515-can1-overlay.dts +new file mode 100644 +index 0000000..67bd0d9 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/mcp2515-can1-overlay.dts +@@ -0,0 +1,73 @@ ++/* ++ * Device tree overlay for mcp251x/can1 on spi0.1 edited by petit_miner ++ */ + -+&spi0 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&spi0_pins>; ++/dts-v1/; ++/plugin/; + -+ spidev@0{ -+ compatible = "spidev"; -+ reg = <0>; /* CE0 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; -+ }; ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2836", "brcm,bcm2708", "brcm,bcm2709"; ++ /* disable spi-dev for spi0.1 */ ++ fragment@0 { ++ target = <&spi0>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; + -+ spidev@1{ -+ compatible = "spidev"; -+ reg = <1>; /* CE1 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; ++ fragment@1 { ++ target = <&spidev1>; ++ __overlay__ { ++ status = "disabled"; + }; -+}; ++ }; + -+&i2c0 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&i2c0_pins>; -+ clock-frequency = <100000>; -+}; ++ /* the interrupt pin of the can-controller */ ++ fragment@2 { ++ target = <&gpio>; ++ __overlay__ { ++ can1_pins: can1_pins { ++ brcm,pins = <25>; ++ brcm,function = <0>; /* input */ ++ }; ++ }; ++ }; + -+&i2c1 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&i2c1_pins>; -+ clock-frequency = <100000>; -+}; ++ /* the clock/oscillator of the can-controller */ ++ fragment@3 { ++ target-path = "/clocks"; ++ __overlay__ { ++ /* external oscillator of mcp2515 on spi0.1 */ ++ can1_osc: can1_osc { ++ compatible = "fixed-clock"; ++ #clock-cells = <0>; ++ clock-frequency = <16000000>; ++ }; ++ }; ++ }; + -+&i2c2 { -+ clock-frequency = <100000>; ++ /* the spi config of the can-controller itself binding everything together */ ++ fragment@4 { ++ target = <&spi0>; ++ __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ can1: mcp2515@1 { ++ reg = <1>; ++ compatible = "microchip,mcp2515"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&can1_pins>; ++ spi-max-frequency = <10000000>; ++ interrupt-parent = <&gpio>; ++ interrupts = <25 0x2>; ++ clocks = <&can1_osc>; ++ }; ++ }; ++ }; ++ __overrides__ { ++ oscillator = <&can1_osc>,"clock-frequency:0"; ++ spimaxfrequency = <&can1>,"spi-max-frequency:0"; ++ interrupt = <&can1_pins>,"brcm,pins:0",<&can1>,"interrupts:0"; ++ }; +}; +diff --git a/arch/arm/boot/dts/overlays/mmc-overlay.dts b/arch/arm/boot/dts/overlays/mmc-overlay.dts +new file mode 100644 +index 0000000..d32b02c +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/mmc-overlay.dts +@@ -0,0 +1,38 @@ ++/dts-v1/; ++/plugin/; + -+&i2s { -+ #sound-dai-cells = <0>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&i2s_pins>; -+}; ++/{ ++ compatible = "brcm,bcm2708"; + -+&leds { -+ act_led: act { -+ label = "led0"; -+ linux,default-trigger = "mmc0"; -+ gpios = <&gpio 47 0>; ++ fragment@0 { ++ target = <&mmc>; ++ frag0: __overlay__ { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&mmc_pins>; ++ bus-width = <4>; ++ brcm,overclock-50 = <0>; ++ status = "okay"; ++ }; + }; + -+ pwr_led: pwr { -+ label = "led1"; -+ linux,default-trigger = "input"; -+ gpios = <&gpio 35 0>; ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ mmc_pins: mmc_pins { ++ brcm,pins = <48 49 50 51 52 53>; ++ brcm,function = <7>; /* alt3 */ ++ }; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&sdhost>; ++ __overlay__ { ++ status = "disabled"; ++ }; + }; -+}; + -+/ { + __overrides__ { -+ uart0 = <&uart0>,"status"; -+ uart0_clkrate = <&clk_uart0>,"clock-frequency:0"; -+ uart1_clkrate = <&uart1>,"clock-frequency:0"; -+ i2s = <&i2s>,"status"; -+ spi = <&spi0>,"status"; -+ i2c0 = <&i2c0>,"status"; -+ i2c1 = <&i2c1>,"status"; -+ i2c2_iknowwhatimdoing = <&i2c2>,"status"; -+ i2c0_baudrate = <&i2c0>,"clock-frequency:0"; -+ i2c1_baudrate = <&i2c1>,"clock-frequency:0"; -+ i2c2_baudrate = <&i2c2>,"clock-frequency:0"; -+ core_freq = <&clk_core>,"clock-frequency:0"; ++ overclock_50 = <&frag0>,"brcm,overclock-50:0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/mz61581-overlay.dts b/arch/arm/boot/dts/overlays/mz61581-overlay.dts +new file mode 100644 +index 0000000..2c29aae +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/mz61581-overlay.dts +@@ -0,0 +1,117 @@ ++/* ++ * Device Tree overlay for MZ61581-PI-EXT 2014.12.28 by Tontec ++ * ++ */ + -+ act_led_gpio = <&act_led>,"gpios:4"; -+ act_led_activelow = <&act_led>,"gpios:8"; -+ act_led_trigger = <&act_led>,"linux,default-trigger"; ++/dts-v1/; ++/plugin/; + -+ pwr_led_gpio = <&pwr_led>,"gpios:4"; -+ pwr_led_activelow = <&pwr_led>,"gpios:8"; -+ pwr_led_trigger = <&pwr_led>,"linux,default-trigger"; ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; + -+ audio = <&audio>,"status"; -+ watchdog = <&watchdog>,"status"; -+ random = <&random>,"status"; - }; - }; -diff --git a/arch/arm/boot/dts/bcm2835-rpi-b.dts b/arch/arm/boot/dts/bcm2835-rpi-b.dts -index ff6b2d1..221d252 100644 ---- a/arch/arm/boot/dts/bcm2835-rpi-b.dts -+++ b/arch/arm/boot/dts/bcm2835-rpi-b.dts -@@ -1,17 +1,118 @@ - /dts-v1/; --#include "bcm2835-rpi.dtsi" -+#include "bcm2835.dtsi" - - / { - compatible = "raspberrypi,model-b", "brcm,bcm2835"; - model = "Raspberry Pi Model B"; -+}; - -- leds { -- act { -- gpios = <&gpio 16 1>; -- }; -+&gpio { -+ spi0_pins: spi0_pins { -+ brcm,pins = <7 8 9 10 11>; -+ brcm,function = <4>; /* alt0 */ ++ fragment@0 { ++ target = <&spi0>; ++ __overlay__ { ++ status = "okay"; ++ }; + }; + -+ i2c0_pins: i2c0 { -+ brcm,pins = <0 1>; -+ brcm,function = <4>; ++ fragment@1 { ++ target = <&spidev0>; ++ __overlay__ { ++ status = "disabled"; ++ }; + }; + -+ i2c1_pins: i2c1 { -+ brcm,pins = <2 3>; -+ brcm,function = <4>; ++ fragment@2 { ++ target = <&spidev1>; ++ __overlay__ { ++ status = "disabled"; ++ }; + }; + -+ i2s_pins: i2s { -+ brcm,pins = <28 29 30 31>; -+ brcm,function = <6>; /* alt2 */ - }; - }; - --&gpio { -- pinctrl-0 = <&gpioout &alt0 &alt3>; -+&mmc { -+ status = "okay"; -+ bus-width = <4>; -+}; ++ fragment@3 { ++ target = <&gpio>; ++ __overlay__ { ++ mz61581_pins: mz61581_pins { ++ brcm,pins = <4 15 18 25>; ++ brcm,function = <0 1 1 1>; /* in out out out */ ++ }; ++ }; ++ }; + -+&fb { -+ status = "okay"; -+}; ++ fragment@4 { ++ target = <&spi0>; ++ __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; + -+&uart0 { -+ status = "okay"; ++ mz61581: mz61581@0{ ++ compatible = "samsung,s6d02a1"; ++ reg = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&mz61581_pins>; ++ ++ spi-max-frequency = <128000000>; ++ spi-cpol; ++ spi-cpha; ++ ++ width = <320>; ++ height = <480>; ++ rotate = <270>; ++ bgr; ++ fps = <30>; ++ buswidth = <8>; ++ txbuflen = <32768>; ++ ++ reset-gpios = <&gpio 15 0>; ++ dc-gpios = <&gpio 25 0>; ++ led-gpios = <&gpio 18 0>; ++ ++ init = <0x10000b0 00 ++ 0x1000011 ++ 0x20000ff ++ 0x10000b3 0x02 0x00 0x00 0x00 ++ 0x10000c0 0x13 0x3b 0x00 0x02 0x00 0x01 0x00 0x43 ++ 0x10000c1 0x08 0x16 0x08 0x08 ++ 0x10000c4 0x11 0x07 0x03 0x03 ++ 0x10000c6 0x00 ++ 0x10000c8 0x03 0x03 0x13 0x5c 0x03 0x07 0x14 0x08 0x00 0x21 0x08 0x14 0x07 0x53 0x0c 0x13 0x03 0x03 0x21 0x00 ++ 0x1000035 0x00 ++ 0x1000036 0xa0 ++ 0x100003a 0x55 ++ 0x1000044 0x00 0x01 ++ 0x10000d0 0x07 0x07 0x1d 0x03 ++ 0x10000d1 0x03 0x30 0x10 ++ 0x10000d2 0x03 0x14 0x04 ++ 0x1000029 ++ 0x100002c>; ++ ++ /* This is a workaround to make sure the init sequence slows down and doesn't fail */ ++ debug = <3>; ++ }; ++ ++ mz61581_ts: mz61581_ts@1 { ++ compatible = "ti,ads7846"; ++ reg = <1>; ++ ++ spi-max-frequency = <2000000>; ++ interrupts = <4 2>; /* high-to-low edge triggered */ ++ interrupt-parent = <&gpio>; ++ pendown-gpio = <&gpio 4 0>; ++ ++ ti,x-plate-ohms = /bits/ 16 <60>; ++ ti,pressure-max = /bits/ 16 <255>; ++ }; ++ }; ++ }; ++ __overrides__ { ++ speed = <&mz61581>, "spi-max-frequency:0"; ++ rotate = <&mz61581>, "rotate:0"; ++ fps = <&mz61581>, "fps:0"; ++ txbuflen = <&mz61581>, "txbuflen:0"; ++ debug = <&mz61581>, "debug:0"; ++ xohms = <&mz61581_ts>,"ti,x-plate-ohms;0"; ++ }; +}; +diff --git a/arch/arm/boot/dts/overlays/pi3-act-led-overlay.dts b/arch/arm/boot/dts/overlays/pi3-act-led-overlay.dts +new file mode 100644 +index 0000000..14a59dc +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/pi3-act-led-overlay.dts +@@ -0,0 +1,27 @@ ++/dts-v1/; ++/plugin/; + -+&spi0 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&spi0_pins>; ++/* Pi3 uses a GPIO expander to drive the LEDs which can only be accessed ++ from the VPU. There is a special driver for this with a separate DT node, ++ which has the unfortunate consequence of breaking the act_led_gpio and ++ act_led_activelow dtparams. + -+ spidev@0{ -+ compatible = "spidev"; -+ reg = <0>; /* CE0 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; ++ This overlay changes the GPIO controller back to the standard one and ++ restores the dtparams. ++*/ ++ ++/{ ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&act_led>; ++ frag0: __overlay__ { ++ gpios = <&gpio 0 0>; ++ }; + }; + -+ spidev@1{ -+ compatible = "spidev"; -+ reg = <1>; /* CE1 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; ++ __overrides__ { ++ gpio = <&frag0>,"gpios:4"; ++ activelow = <&frag0>,"gpios:8"; + }; +}; +diff --git a/arch/arm/boot/dts/overlays/pi3-disable-bt-overlay.dts b/arch/arm/boot/dts/overlays/pi3-disable-bt-overlay.dts +new file mode 100644 +index 0000000..68f6069 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/pi3-disable-bt-overlay.dts +@@ -0,0 +1,46 @@ ++/dts-v1/; ++/plugin/; + -+&i2c0 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&i2c0_pins>; -+ clock-frequency = <100000>; -+}; ++/* Disable Bluetooth and restore UART0/ttyAMA0 over GPIOs 14 & 15. ++ To disable the systemd service that initialises the modem so it doesn't use ++ the UART: + -+&i2c1 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&i2c1_pins>; -+ clock-frequency = <100000>; -+}; ++ sudo systemctl disable hciuart ++*/ + -+&i2c2 { -+ clock-frequency = <100000>; -+}; ++/{ ++ compatible = "brcm,bcm2708"; + -+&i2s { -+ #sound-dai-cells = <0>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&i2s_pins>; -+}; ++ fragment@0 { ++ target = <&uart1>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; + -+&leds { -+ act_led: act { -+ label = "led0"; -+ linux,default-trigger = "mmc0"; -+ gpios = <&gpio 16 1>; ++ fragment@1 { ++ target = <&uart0>; ++ __overlay__ { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&uart0_pins>; ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&uart0_pins>; ++ __overlay__ { ++ brcm,pins; ++ brcm,function; ++ brcm,pull; ++ }; ++ }; ++ ++ fragment@3 { ++ target-path = "/aliases"; ++ __overlay__ { ++ serial0 = "/soc/uart@7e201000"; ++ serial1 = "/soc/uart@7e215040"; ++ }; + }; +}; +diff --git a/arch/arm/boot/dts/overlays/pi3-miniuart-bt-overlay.dts b/arch/arm/boot/dts/overlays/pi3-miniuart-bt-overlay.dts +new file mode 100644 +index 0000000..17d04cf +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/pi3-miniuart-bt-overlay.dts +@@ -0,0 +1,64 @@ ++/dts-v1/; ++/plugin/; + -+/ { -+ __overrides__ { -+ uart0 = <&uart0>,"status"; -+ uart0_clkrate = <&clk_uart0>,"clock-frequency:0"; -+ uart1_clkrate = <&uart1>,"clock-frequency:0"; -+ i2s = <&i2s>,"status"; -+ spi = <&spi0>,"status"; -+ i2c0 = <&i2c0>,"status"; -+ i2c1 = <&i2c1>,"status"; -+ i2c2_iknowwhatimdoing = <&i2c2>,"status"; -+ i2c0_baudrate = <&i2c0>,"clock-frequency:0"; -+ i2c1_baudrate = <&i2c1>,"clock-frequency:0"; -+ i2c2_baudrate = <&i2c2>,"clock-frequency:0"; -+ core_freq = <&clk_core>,"clock-frequency:0"; ++/* Switch Pi3 Bluetooth function to use the mini-UART (ttyS0) and restore ++ UART0/ttyAMA0 over GPIOs 14 & 15. Note that this may reduce the maximum ++ usable baudrate. + -+ act_led_gpio = <&act_led>,"gpios:4"; -+ act_led_activelow = <&act_led>,"gpios:8"; -+ act_led_trigger = <&act_led>,"linux,default-trigger"; ++ It is also necessary to edit /lib/systemd/system/hciuart.service and ++ replace ttyAMA0 with ttyS0, unless you have a system with udev rules ++ that create /dev/serial0 and /dev/serial1, in which case use /dev/serial1 ++ instead because it will always be correct. + -+ audio = <&audio>,"status"; -+ watchdog = <&watchdog>,"status"; -+ random = <&random>,"status"; ++ If cmdline.txt uses the alias serial0 to refer to the user-accessable port ++ then the firmware will replace with the appropriate port whether or not ++ this overlay is used. ++*/ ++ ++/{ ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&uart0>; ++ __overlay__ { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&uart0_pins>; ++ status = "okay"; ++ }; + }; - }; -diff --git a/arch/arm/boot/dts/bcm2835.dtsi b/arch/arm/boot/dts/bcm2835.dtsi -index 864a3ef..3256bff 100644 ---- a/arch/arm/boot/dts/bcm2835.dtsi -+++ b/arch/arm/boot/dts/bcm2835.dtsi -@@ -1,206 +1,39 @@ --#include <dt-bindings/pinctrl/bcm2835.h> --#include <dt-bindings/clock/bcm2835.h> --#include "skeleton.dtsi" -+#include "bcm2708_common.dtsi" - - / { - compatible = "brcm,bcm2835"; - model = "BCM2835"; -- interrupt-parent = <&intc>; - - chosen { -- bootargs = "earlyprintk console=ttyAMA0"; -+ bootargs = ""; - }; - - soc { -- compatible = "simple-bus"; -- #address-cells = <1>; -- #size-cells = <1>; -- ranges = <0x7e000000 0x20000000 0x02000000>; -+ ranges = <0x7e000000 0x20000000 0x01000000>; - dma-ranges = <0x40000000 0x00000000 0x20000000>; - - timer@7e003000 { - compatible = "brcm,bcm2835-system-timer"; - reg = <0x7e003000 0x1000>; - interrupts = <1 0>, <1 1>, <1 2>, <1 3>; -- /* This could be a reference to BCM2835_CLOCK_TIMER, -- * but we don't have the driver using the common clock -- * support yet. -- */ - clock-frequency = <1000000>; - }; - -- dma: dma@7e007000 { -- compatible = "brcm,bcm2835-dma"; -- reg = <0x7e007000 0xf00>; -- interrupts = <1 16>, -- <1 17>, -- <1 18>, -- <1 19>, -- <1 20>, -- <1 21>, -- <1 22>, -- <1 23>, -- <1 24>, -- <1 25>, -- <1 26>, -- <1 27>, -- <1 28>; -- -- #dma-cells = <1>; -- brcm,dma-channel-mask = <0x7f35>; -- }; -- -- intc: interrupt-controller@7e00b200 { -- compatible = "brcm,bcm2835-armctrl-ic"; -- reg = <0x7e00b200 0x200>; -- interrupt-controller; -- #interrupt-cells = <2>; -- }; -- -- watchdog@7e100000 { -- compatible = "brcm,bcm2835-pm-wdt"; -- reg = <0x7e100000 0x28>; -- }; -- -- clocks: cprman@7e101000 { -- compatible = "brcm,bcm2835-cprman"; -- #clock-cells = <1>; -- reg = <0x7e101000 0x2000>; -- -- /* CPRMAN derives everything from the platform's -- * oscillator. -- */ -- clocks = <&clk_osc>; -- }; -- -- rng@7e104000 { -- compatible = "brcm,bcm2835-rng"; -- reg = <0x7e104000 0x10>; -- }; -- -- mailbox: mailbox@7e00b800 { -- compatible = "brcm,bcm2835-mbox"; -- reg = <0x7e00b880 0x40>; -- interrupts = <0 1>; -- #mbox-cells = <0>; -- }; -- -- gpio: gpio@7e200000 { -- compatible = "brcm,bcm2835-gpio"; -- reg = <0x7e200000 0xb4>; -- /* -- * The GPIO IP block is designed for 3 banks of GPIOs. -- * Each bank has a GPIO interrupt for itself. -- * There is an overall "any bank" interrupt. -- * In order, these are GIC interrupts 17, 18, 19, 20. -- * Since the BCM2835 only has 2 banks, the 2nd bank -- * interrupt output appears to be mirrored onto the -- * 3rd bank's interrupt signal. -- * So, a bank0 interrupt shows up on 17, 20, and -- * a bank1 interrupt shows up on 18, 19, 20! -- */ -- interrupts = <2 17>, <2 18>, <2 19>, <2 20>; -- -- gpio-controller; -- #gpio-cells = <2>; -- -- interrupt-controller; -- #interrupt-cells = <2>; -- }; -- -- uart0: uart@7e201000 { -- compatible = "brcm,bcm2835-pl011", "arm,pl011", "arm,primecell"; -- reg = <0x7e201000 0x1000>; -- interrupts = <2 25>; -- clocks = <&clocks BCM2835_CLOCK_UART>, -- <&clocks BCM2835_CLOCK_VPU>; -- clock-names = "uartclk", "apb_pclk"; -- arm,primecell-periphid = <0x00241011>; -- }; -- -- i2s: i2s@7e203000 { -- compatible = "brcm,bcm2835-i2s"; -- reg = <0x7e203000 0x24>, -- <0x7e101098 0x08>; -- -- dmas = <&dma 2>, -- <&dma 3>; -- dma-names = "tx", "rx"; -- status = "disabled"; -- }; -- -- spi: spi@7e204000 { -- compatible = "brcm,bcm2835-spi"; -- reg = <0x7e204000 0x1000>; -- interrupts = <2 22>; -- clocks = <&clocks BCM2835_CLOCK_VPU>; -- #address-cells = <1>; -- #size-cells = <0>; -- status = "disabled"; -- }; -- -- i2c0: i2c@7e205000 { -- compatible = "brcm,bcm2835-i2c"; -- reg = <0x7e205000 0x1000>; -- interrupts = <2 21>; -- clocks = <&clocks BCM2835_CLOCK_VPU>; -- #address-cells = <1>; -- #size-cells = <0>; -- status = "disabled"; -- }; -- -- sdhci: sdhci@7e300000 { -- compatible = "brcm,bcm2835-sdhci"; -- reg = <0x7e300000 0x100>; -- interrupts = <2 30>; -- clocks = <&clocks BCM2835_CLOCK_EMMC>; -- status = "disabled"; -- }; -- -- i2c1: i2c@7e804000 { -- compatible = "brcm,bcm2835-i2c"; -- reg = <0x7e804000 0x1000>; -- interrupts = <2 21>; -- clocks = <&clocks BCM2835_CLOCK_VPU>; -- #address-cells = <1>; -- #size-cells = <0>; -- status = "disabled"; -- }; -- -- i2c2: i2c@7e805000 { -- compatible = "brcm,bcm2835-i2c"; -- reg = <0x7e805000 0x1000>; -- interrupts = <2 21>; -- clocks = <&clocks BCM2835_CLOCK_VPU>; -- #address-cells = <1>; -- #size-cells = <0>; -- status = "disabled"; -- }; -- -- usb@7e980000 { -- compatible = "brcm,bcm2835-usb"; -- reg = <0x7e980000 0x10000>; -- interrupts = <1 9>; -- }; -- - arm-pmu { - compatible = "arm,arm1176-pmu"; - }; -- }; -- -- clocks { -- compatible = "simple-bus"; -- #address-cells = <1>; -- #size-cells = <0>; - -- /* The oscillator is the root of the clock tree. */ -- clk_osc: clock@3 { -- compatible = "fixed-clock"; -- reg = <3>; -- #clock-cells = <0>; -- clock-output-names = "osc"; -- clock-frequency = <19200000>; -+ aux_enable: aux_enable@0x7e215004 { -+ compatible = "bcrm,bcm2835-aux-enable"; -+ reg = <0x7e215004 0x04>; - }; -- - }; - }; + -+&intc { -+ compatible = "brcm,bcm2835-armctrl-ic"; -+}; ++ fragment@1 { ++ target = <&uart1>; ++ __overlay__ { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&uart1_pins &bt_pins>; ++ status = "okay"; ++ }; ++ }; + -+&watchdog { -+ status = "okay"; ++ fragment@2 { ++ target = <&uart0_pins>; ++ __overlay__ { ++ brcm,pins; ++ brcm,function; ++ brcm,pull; ++ }; ++ }; ++ ++ fragment@3 { ++ target = <&uart1_pins>; ++ __overlay__ { ++ brcm,pins = <32 33>; ++ brcm,function = <2>; /* alt5=UART1 */ ++ brcm,pull = <0 2>; ++ }; ++ }; ++ ++ fragment@4 { ++ target-path = "/aliases"; ++ __overlay__ { ++ serial0 = "/soc/uart@7e201000"; ++ serial1 = "/soc/uart@7e215040"; ++ }; ++ }; +}; - -From f978fb3b816681159b6cc97104954dea31488add Mon Sep 17 00:00:00 2001 -From: Siarhei Siamashka <siarhei.siamashka@gmail.com> -Date: Mon, 17 Jun 2013 13:32:11 +0300 -Subject: [PATCH 054/170] fbdev: add FBIOCOPYAREA ioctl - -Based on the patch authored by Ali Gholami Rudi at - https://lkml.org/lkml/2009/7/13/153 - -Provide an ioctl for userspace applications, but only if this operation -is hardware accelerated (otherwide it does not make any sense). - -Signed-off-by: Siarhei Siamashka <siarhei.siamashka@gmail.com> ---- - drivers/video/fbdev/core/fbmem.c | 30 ++++++++++++++++++++++++++++++ - include/uapi/linux/fb.h | 5 +++++ - 2 files changed, 35 insertions(+) - -diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c -index 0705d88..771992a 100644 ---- a/drivers/video/fbdev/core/fbmem.c -+++ b/drivers/video/fbdev/core/fbmem.c -@@ -1084,6 +1084,25 @@ fb_blank(struct fb_info *info, int blank) - } - EXPORT_SYMBOL(fb_blank); - -+static int fb_copyarea_user(struct fb_info *info, -+ struct fb_copyarea *copy) -+{ -+ int ret = 0; -+ if (!lock_fb_info(info)) -+ return -ENODEV; -+ if (copy->dx + copy->width > info->var.xres || -+ copy->sx + copy->width > info->var.xres || -+ copy->dy + copy->height > info->var.yres || -+ copy->sy + copy->height > info->var.yres) { -+ ret = -EINVAL; -+ goto out; -+ } -+ info->fbops->fb_copyarea(info, copy); -+out: -+ unlock_fb_info(info); -+ return ret; -+} -+ - static long do_fb_ioctl(struct fb_info *info, unsigned int cmd, - unsigned long arg) - { -@@ -1094,6 +1113,7 @@ static long do_fb_ioctl(struct fb_info *info, unsigned int cmd, - struct fb_cmap cmap_from; - struct fb_cmap_user cmap; - struct fb_event event; -+ struct fb_copyarea copy; - void __user *argp = (void __user *)arg; - long ret = 0; - -@@ -1211,6 +1231,15 @@ static long do_fb_ioctl(struct fb_info *info, unsigned int cmd, - unlock_fb_info(info); - console_unlock(); - break; -+ case FBIOCOPYAREA: -+ if (info->flags & FBINFO_HWACCEL_COPYAREA) { -+ /* only provide this ioctl if it is accelerated */ -+ if (copy_from_user(&copy, argp, sizeof(copy))) -+ return -EFAULT; -+ ret = fb_copyarea_user(info, &copy); -+ break; -+ } -+ /* fall through */ - default: - if (!lock_fb_info(info)) - return -ENODEV; -@@ -1365,6 +1394,7 @@ static long fb_compat_ioctl(struct file *file, unsigned int cmd, - case FBIOPAN_DISPLAY: - case FBIOGET_CON2FBMAP: - case FBIOPUT_CON2FBMAP: -+ case FBIOCOPYAREA: - arg = (unsigned long) compat_ptr(arg); - case FBIOBLANK: - ret = do_fb_ioctl(info, cmd, arg); -diff --git a/include/uapi/linux/fb.h b/include/uapi/linux/fb.h -index fb795c3..fa72af0c 100644 ---- a/include/uapi/linux/fb.h -+++ b/include/uapi/linux/fb.h -@@ -34,6 +34,11 @@ - #define FBIOPUT_MODEINFO 0x4617 - #define FBIOGET_DISPINFO 0x4618 - #define FBIO_WAITFORVSYNC _IOW('F', 0x20, __u32) -+/* -+ * HACK: use 'z' in order not to clash with any other ioctl numbers which might -+ * be concurrently added to the mainline kernel -+ */ -+#define FBIOCOPYAREA _IOW('z', 0x21, struct fb_copyarea) - - #define FB_TYPE_PACKED_PIXELS 0 /* Packed Pixels */ - #define FB_TYPE_PLANES 1 /* Non interleaved planes */ - -From 53bcd6e5a43a353508c7aff48abcdcaae1b35ca8 Mon Sep 17 00:00:00 2001 -From: Harm Hanemaaijer <fgenfb@yahoo.com> -Date: Thu, 20 Jun 2013 20:21:39 +0200 -Subject: [PATCH 058/170] Speed up console framebuffer imageblit function - -Especially on platforms with a slower CPU but a relatively high -framebuffer fill bandwidth, like current ARM devices, the existing -console monochrome imageblit function used to draw console text is -suboptimal for common pixel depths such as 16bpp and 32bpp. The existing -code is quite general and can deal with several pixel depths. By creating -special case functions for 16bpp and 32bpp, by far the most common pixel -formats used on modern systems, a significant speed-up is attained -which can be readily felt on ARM-based devices like the Raspberry Pi -and the Allwinner platform, but should help any platform using the -fb layer. - -The special case functions allow constant folding, eliminating a number -of instructions including divide operations, and allow the use of an -unrolled loop, eliminating instructions with a variable shift size, -reducing source memory access instructions, and eliminating excessive -branching. These unrolled loops also allow much better code optimization -by the C compiler. The code that selects which optimized variant is used -is also simplified, eliminating integer divide instructions. - -The speed-up, measured by timing 'cat file.txt' in the console, varies -between 40% and 70%, when testing on the Raspberry Pi and Allwinner -ARM-based platforms, depending on font size and the pixel depth, with -the greater benefit for 32bpp. - -Signed-off-by: Harm Hanemaaijer <fgenfb@yahoo.com> ---- - drivers/video/fbdev/core/cfbimgblt.c | 152 +++++++++++++++++++++++++++++++++-- - 1 file changed, 147 insertions(+), 5 deletions(-) - -diff --git a/drivers/video/fbdev/core/cfbimgblt.c b/drivers/video/fbdev/core/cfbimgblt.c -index a2bb276..436494f 100644 ---- a/drivers/video/fbdev/core/cfbimgblt.c -+++ b/drivers/video/fbdev/core/cfbimgblt.c -@@ -28,6 +28,11 @@ - * - * Also need to add code to deal with cards endians that are different than - * the native cpu endians. I also need to deal with MSB position in the word. -+ * Modified by Harm Hanemaaijer (fgenfb@yahoo.com) 2013: -+ * - Provide optimized versions of fast_imageblit for 16 and 32bpp that are -+ * significantly faster than the previous implementation. -+ * - Simplify the fast/slow_imageblit selection code, avoiding integer -+ * divides. - */ - #include <linux/module.h> - #include <linux/string.h> -@@ -262,6 +267,133 @@ static inline void fast_imageblit(const struct fb_image *image, struct fb_info * - } - } - +diff --git a/arch/arm/boot/dts/overlays/piscreen-overlay.dts b/arch/arm/boot/dts/overlays/piscreen-overlay.dts +new file mode 100644 +index 0000000..40a1f29 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/piscreen-overlay.dts +@@ -0,0 +1,102 @@ +/* -+ * Optimized fast_imageblit for bpp == 16. ppw = 2, bit_mask = 3 folded -+ * into the code, main loop unrolled. ++ * Device Tree overlay for PiScreen 3.5" display shield by Ozzmaker ++ * + */ + -+static inline void fast_imageblit16(const struct fb_image *image, -+ struct fb_info *p, u8 __iomem * dst1, -+ u32 fgcolor, u32 bgcolor) -+{ -+ u32 fgx = fgcolor, bgx = bgcolor; -+ u32 spitch = (image->width + 7) / 8; -+ u32 end_mask, eorx; -+ const char *s = image->data, *src; -+ u32 __iomem *dst; -+ const u32 *tab = NULL; -+ int i, j, k; ++/dts-v1/; ++/plugin/; + -+ tab = fb_be_math(p) ? cfb_tab16_be : cfb_tab16_le; ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; + -+ fgx <<= 16; -+ bgx <<= 16; -+ fgx |= fgcolor; -+ bgx |= bgcolor; ++ fragment@0 { ++ target = <&spi0>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; + -+ eorx = fgx ^ bgx; -+ k = image->width / 2; ++ fragment@1 { ++ target = <&spidev0>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; + -+ for (i = image->height; i--;) { -+ dst = (u32 __iomem *) dst1; -+ src = s; ++ fragment@2 { ++ target = <&spidev1>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; + -+ j = k; -+ while (j >= 4) { -+ u8 bits = *src; -+ end_mask = tab[(bits >> 6) & 3]; -+ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); -+ end_mask = tab[(bits >> 4) & 3]; -+ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); -+ end_mask = tab[(bits >> 2) & 3]; -+ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); -+ end_mask = tab[bits & 3]; -+ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); -+ src++; -+ j -= 4; -+ } -+ if (j != 0) { -+ u8 bits = *src; -+ end_mask = tab[(bits >> 6) & 3]; -+ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); -+ if (j >= 2) { -+ end_mask = tab[(bits >> 4) & 3]; -+ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); -+ if (j == 3) { -+ end_mask = tab[(bits >> 2) & 3]; -+ FB_WRITEL((end_mask & eorx) ^ bgx, dst); -+ } -+ } -+ } -+ dst1 += p->fix.line_length; -+ s += spitch; -+ } -+} ++ fragment@3 { ++ target = <&gpio>; ++ __overlay__ { ++ piscreen_pins: piscreen_pins { ++ brcm,pins = <17 25 24 22>; ++ brcm,function = <0 1 1 1>; /* in out out out */ ++ }; ++ }; ++ }; + -+/* -+ * Optimized fast_imageblit for bpp == 32. ppw = 1, bit_mask = 1 folded -+ * into the code, main loop unrolled. -+ */ ++ fragment@4 { ++ target = <&spi0>; ++ __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; + -+static inline void fast_imageblit32(const struct fb_image *image, -+ struct fb_info *p, u8 __iomem * dst1, -+ u32 fgcolor, u32 bgcolor) -+{ -+ u32 fgx = fgcolor, bgx = bgcolor; -+ u32 spitch = (image->width + 7) / 8; -+ u32 end_mask, eorx; -+ const char *s = image->data, *src; -+ u32 __iomem *dst; -+ const u32 *tab = NULL; -+ int i, j, k; ++ piscreen: piscreen@0{ ++ compatible = "ilitek,ili9486"; ++ reg = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&piscreen_pins>; + -+ tab = cfb_tab32; ++ spi-max-frequency = <24000000>; ++ rotate = <270>; ++ bgr; ++ fps = <30>; ++ buswidth = <8>; ++ regwidth = <16>; ++ reset-gpios = <&gpio 25 0>; ++ dc-gpios = <&gpio 24 0>; ++ led-gpios = <&gpio 22 1>; ++ debug = <0>; + -+ eorx = fgx ^ bgx; -+ k = image->width; ++ init = <0x10000b0 0x00 ++ 0x1000011 ++ 0x20000ff ++ 0x100003a 0x55 ++ 0x1000036 0x28 ++ 0x10000c2 0x44 ++ 0x10000c5 0x00 0x00 0x00 0x00 ++ 0x10000e0 0x0f 0x1f 0x1c 0x0c 0x0f 0x08 0x48 0x98 0x37 0x0a 0x13 0x04 0x11 0x0d 0x00 ++ 0x10000e1 0x0f 0x32 0x2e 0x0b 0x0d 0x05 0x47 0x75 0x37 0x06 0x10 0x03 0x24 0x20 0x00 ++ 0x10000e2 0x0f 0x32 0x2e 0x0b 0x0d 0x05 0x47 0x75 0x37 0x06 0x10 0x03 0x24 0x20 0x00 ++ 0x1000011 ++ 0x1000029>; ++ }; + -+ for (i = image->height; i--;) { -+ dst = (u32 __iomem *) dst1; -+ src = s; ++ piscreen_ts: piscreen-ts@1 { ++ compatible = "ti,ads7846"; ++ reg = <1>; + -+ j = k; -+ while (j >= 8) { -+ u8 bits = *src; -+ end_mask = tab[(bits >> 7) & 1]; -+ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); -+ end_mask = tab[(bits >> 6) & 1]; -+ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); -+ end_mask = tab[(bits >> 5) & 1]; -+ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); -+ end_mask = tab[(bits >> 4) & 1]; -+ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); -+ end_mask = tab[(bits >> 3) & 1]; -+ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); -+ end_mask = tab[(bits >> 2) & 1]; -+ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); -+ end_mask = tab[(bits >> 1) & 1]; -+ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); -+ end_mask = tab[bits & 1]; -+ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); -+ src++; -+ j -= 8; -+ } -+ if (j != 0) { -+ u32 bits = (u32) * src; -+ while (j > 1) { -+ end_mask = tab[(bits >> 7) & 1]; -+ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); -+ bits <<= 1; -+ j--; -+ } -+ end_mask = tab[(bits >> 7) & 1]; -+ FB_WRITEL((end_mask & eorx) ^ bgx, dst); -+ } -+ dst1 += p->fix.line_length; -+ s += spitch; -+ } -+} ++ spi-max-frequency = <2000000>; ++ interrupts = <17 2>; /* high-to-low edge triggered */ ++ interrupt-parent = <&gpio>; ++ pendown-gpio = <&gpio 17 0>; ++ ti,swap-xy; ++ ti,x-plate-ohms = /bits/ 16 <100>; ++ ti,pressure-max = /bits/ 16 <255>; ++ }; ++ }; ++ }; ++ __overrides__ { ++ speed = <&piscreen>,"spi-max-frequency:0"; ++ rotate = <&piscreen>,"rotate:0"; ++ fps = <&piscreen>,"fps:0"; ++ debug = <&piscreen>,"debug:0"; ++ xohms = <&piscreen_ts>,"ti,x-plate-ohms;0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/piscreen2r-overlay.dts b/arch/arm/boot/dts/overlays/piscreen2r-overlay.dts +new file mode 100644 +index 0000000..9c0bed8 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/piscreen2r-overlay.dts +@@ -0,0 +1,106 @@ ++ /* ++ * Device Tree overlay for PiScreen2 3.5" TFT with resistive touch by Ozzmaker.com ++ * ++ */ + - void cfb_imageblit(struct fb_info *p, const struct fb_image *image) - { - u32 fgcolor, bgcolor, start_index, bitstart, pitch_index = 0; -@@ -294,11 +426,21 @@ void cfb_imageblit(struct fb_info *p, const struct fb_image *image) - bgcolor = image->bg_color; - } - -- if (32 % bpp == 0 && !start_index && !pitch_index && -- ((width & (32/bpp-1)) == 0) && -- bpp >= 8 && bpp <= 32) -- fast_imageblit(image, p, dst1, fgcolor, bgcolor); -- else -+ if (!start_index && !pitch_index) { -+ if (bpp == 32) -+ fast_imageblit32(image, p, dst1, fgcolor, -+ bgcolor); -+ else if (bpp == 16 && (width & 1) == 0) -+ fast_imageblit16(image, p, dst1, fgcolor, -+ bgcolor); -+ else if (bpp == 8 && (width & 3) == 0) -+ fast_imageblit(image, p, dst1, fgcolor, -+ bgcolor); -+ else -+ slow_imageblit(image, p, dst1, fgcolor, -+ bgcolor, -+ start_index, pitch_index); -+ } else - slow_imageblit(image, p, dst1, fgcolor, bgcolor, - start_index, pitch_index); - } else - -From 6c0a9150827dc58fac38c8e787c050626325842e Mon Sep 17 00:00:00 2001 -From: popcornmix <popcornmix@gmail.com> -Date: Tue, 26 Mar 2013 17:26:38 +0000 -Subject: [PATCH 059/170] Allow mac address to be set in smsc95xx - -Signed-off-by: popcornmix <popcornmix@gmail.com> ---- - drivers/net/usb/smsc95xx.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 56 insertions(+) - -diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c -index 9c0da18..3244a90 100755 ---- a/drivers/net/usb/smsc95xx.c -+++ b/drivers/net/usb/smsc95xx.c -@@ -59,6 +59,7 @@ - #define SUSPEND_SUSPEND3 (0x08) - #define SUSPEND_ALLMODES (SUSPEND_SUSPEND0 | SUSPEND_SUSPEND1 | \ - SUSPEND_SUSPEND2 | SUSPEND_SUSPEND3) -+#define MAC_ADDR_LEN (6) - - struct smsc95xx_priv { - u32 mac_cr; -@@ -74,6 +75,10 @@ static bool turbo_mode = false; - module_param(turbo_mode, bool, 0644); - MODULE_PARM_DESC(turbo_mode, "Enable multiple frames per Rx transaction"); - -+static char *macaddr = ":"; -+module_param(macaddr, charp, 0); -+MODULE_PARM_DESC(macaddr, "MAC address"); ++/dts-v1/; ++/plugin/; + - static int __must_check __smsc95xx_read_reg(struct usbnet *dev, u32 index, - u32 *data, int in_pm) - { -@@ -763,8 +768,59 @@ static int smsc95xx_ioctl(struct net_device *netdev, struct ifreq *rq, int cmd) - return generic_mii_ioctl(&dev->mii, if_mii(rq), cmd, NULL); - } - -+/* Check the macaddr module parameter for a MAC address */ -+static int smsc95xx_is_macaddr_param(struct usbnet *dev, u8 *dev_mac) -+{ -+ int i, j, got_num, num; -+ u8 mtbl[MAC_ADDR_LEN]; ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; + -+ if (macaddr[0] == ':') -+ return 0; ++ fragment@0 { ++ target = <&spi0>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; + -+ i = 0; -+ j = 0; -+ num = 0; -+ got_num = 0; -+ while (j < MAC_ADDR_LEN) { -+ if (macaddr[i] && macaddr[i] != ':') { -+ got_num++; -+ if ('0' <= macaddr[i] && macaddr[i] <= '9') -+ num = num * 16 + macaddr[i] - '0'; -+ else if ('A' <= macaddr[i] && macaddr[i] <= 'F') -+ num = num * 16 + 10 + macaddr[i] - 'A'; -+ else if ('a' <= macaddr[i] && macaddr[i] <= 'f') -+ num = num * 16 + 10 + macaddr[i] - 'a'; -+ else -+ break; -+ i++; -+ } else if (got_num == 2) { -+ mtbl[j++] = (u8) num; -+ num = 0; -+ got_num = 0; -+ i++; -+ } else { -+ break; -+ } -+ } ++ fragment@1 { ++ target = <&spidev0>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; + -+ if (j == MAC_ADDR_LEN) { -+ netif_dbg(dev, ifup, dev->net, "Overriding MAC address with: " -+ "%02x:%02x:%02x:%02x:%02x:%02x\n", mtbl[0], mtbl[1], mtbl[2], -+ mtbl[3], mtbl[4], mtbl[5]); -+ for (i = 0; i < MAC_ADDR_LEN; i++) -+ dev_mac[i] = mtbl[i]; -+ return 1; -+ } else { -+ return 0; -+ } -+} ++ fragment@2 { ++ target = <&spidev1>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; + - static void smsc95xx_init_mac_address(struct usbnet *dev) - { -+ /* Check module parameters */ -+ if (smsc95xx_is_macaddr_param(dev, dev->net->dev_addr)) -+ return; ++ fragment@3 { ++ target = <&gpio>; ++ __overlay__ { ++ piscreen2_pins: piscreen2_pins { ++ brcm,pins = <17 25 24 22>; ++ brcm,function = <0 1 1 1>; /* in out out out */ ++ }; ++ }; ++ }; + - /* try reading mac address from EEPROM */ - if (smsc95xx_read_eeprom(dev, EEPROM_MAC_OFFSET, ETH_ALEN, - dev->net->dev_addr) == 0) { - -From e172d31b8402f13aed5679cd7023f0c0935aab05 Mon Sep 17 00:00:00 2001 -From: popcornmix <popcornmix@gmail.com> -Date: Wed, 8 May 2013 11:46:50 +0100 -Subject: [PATCH 060/170] enabling the realtime clock 1-wire chip DS1307 and - 1-wire on GPIO4 (as a module) - -1-wire: Add support for configuring pin for w1-gpio kernel module -See: https://github.com/raspberrypi/linux/pull/457 - -Add bitbanging pullups, use them for w1-gpio - -Allows parasite power to work, uses module option pullup=1 - -bcm2708: Ensure 1-wire pullup is disabled by default, and expose as module parameter - -Signed-off-by: Alex J Lennon <ajlennon@dynamicdevices.co.uk> - -w1-gpio: Add gpiopin module parameter and correctly free up gpio pull-up pin, if set - -Signed-off-by: Alex J Lennon <ajlennon@dynamicdevices.co.uk> - -w1-gpio: Sort out the pullup/parasitic power tangle ---- - drivers/w1/masters/w1-gpio.c | 69 ++++++++++++++++++++++++++++++++++++++++---- - drivers/w1/w1.h | 6 ++++ - drivers/w1/w1_int.c | 14 +++++++++ - drivers/w1/w1_io.c | 18 ++++++++++-- - include/linux/w1-gpio.h | 1 + - 5 files changed, 99 insertions(+), 9 deletions(-) - -diff --git a/drivers/w1/masters/w1-gpio.c b/drivers/w1/masters/w1-gpio.c -index a373ae6..080e597 100644 ---- a/drivers/w1/masters/w1-gpio.c -+++ b/drivers/w1/masters/w1-gpio.c -@@ -23,6 +23,19 @@ - #include "../w1.h" - #include "../w1_int.h" - -+static int w1_gpio_pullup = 0; -+static int w1_gpio_pullup_orig = 0; -+module_param_named(pullup, w1_gpio_pullup, int, 0); -+MODULE_PARM_DESC(pullup, "Enable parasitic power (power on data) mode"); -+static int w1_gpio_pullup_pin = -1; -+static int w1_gpio_pullup_pin_orig = -1; -+module_param_named(extpullup, w1_gpio_pullup_pin, int, 0); -+MODULE_PARM_DESC(extpullup, "GPIO external pullup pin number"); -+static int w1_gpio_pin = -1; -+static int w1_gpio_pin_orig = -1; -+module_param_named(gpiopin, w1_gpio_pin, int, 0); -+MODULE_PARM_DESC(gpiopin, "GPIO pin number"); ++ fragment@4 { ++ target = <&spi0>; ++ __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; + - static u8 w1_gpio_set_pullup(void *data, int delay) - { - struct w1_gpio_platform_data *pdata = data; -@@ -67,6 +80,16 @@ static u8 w1_gpio_read_bit(void *data) - return gpio_get_value(pdata->pin) ? 1 : 0; - } - -+static void w1_gpio_bitbang_pullup(void *data, u8 on) -+{ -+ struct w1_gpio_platform_data *pdata = data; ++ piscreen2: piscreen2@0{ ++ compatible = "ilitek,ili9486"; ++ reg = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&piscreen2_pins>; ++ bgr; ++ spi-max-frequency = <64000000>; ++ rotate = <90>; ++ fps = <30>; ++ buswidth = <8>; ++ regwidth = <16>; ++ txbuflen = <32768>; ++ reset-gpios = <&gpio 25 0>; ++ dc-gpios = <&gpio 24 0>; ++ led-gpios = <&gpio 22 1>; ++ debug = <0>; + -+ if (on) -+ gpio_direction_output(pdata->pin, 1); -+ else -+ gpio_direction_input(pdata->pin); -+} ++ init = <0x10000b0 0x00 ++ 0x1000011 ++ 0x20000ff ++ 0x100003a 0x55 ++ 0x1000036 0x28 ++ 0x10000c0 0x11 0x09 ++ 0x10000c1 0x41 ++ 0x10000c5 0x00 0x00 0x00 0x00 ++ 0x10000b6 0x00 0x02 ++ 0x10000f7 0xa9 0x51 0x2c 0x2 ++ 0x10000be 0x00 0x04 ++ 0x10000e9 0x00 ++ 0x1000011 ++ 0x1000029>; + - #if defined(CONFIG_OF) - static const struct of_device_id w1_gpio_dt_ids[] = { - { .compatible = "w1-gpio" }, -@@ -80,6 +103,7 @@ static int w1_gpio_probe_dt(struct platform_device *pdev) - struct w1_gpio_platform_data *pdata = dev_get_platdata(&pdev->dev); - struct device_node *np = pdev->dev.of_node; - int gpio; -+ u32 value; - - pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); - if (!pdata) -@@ -88,6 +112,9 @@ static int w1_gpio_probe_dt(struct platform_device *pdev) - if (of_get_property(np, "linux,open-drain", NULL)) - pdata->is_open_drain = 1; - -+ if (of_property_read_u32(np, "rpi,parasitic-power", &value) == 0) -+ pdata->parasitic_power = (value != 0); ++ }; + - gpio = of_get_gpio(np, 0); - if (gpio < 0) { - if (gpio != -EPROBE_DEFER) -@@ -103,7 +130,7 @@ static int w1_gpio_probe_dt(struct platform_device *pdev) - if (gpio == -EPROBE_DEFER) - return gpio; - /* ignore other errors as the pullup gpio is optional */ -- pdata->ext_pullup_enable_pin = gpio; -+ pdata->ext_pullup_enable_pin = (gpio >= 0) ? gpio : -1; - - pdev->dev.platform_data = pdata; - -@@ -113,13 +140,15 @@ static int w1_gpio_probe_dt(struct platform_device *pdev) - static int w1_gpio_probe(struct platform_device *pdev) - { - struct w1_bus_master *master; -- struct w1_gpio_platform_data *pdata; -+ struct w1_gpio_platform_data *pdata = pdev->dev.platform_data; - int err; - -- if (of_have_populated_dt()) { -- err = w1_gpio_probe_dt(pdev); -- if (err < 0) -- return err; -+ if(pdata == NULL) { -+ if (of_have_populated_dt()) { -+ err = w1_gpio_probe_dt(pdev); -+ if (err < 0) -+ return err; -+ } - } - - pdata = dev_get_platdata(&pdev->dev); -@@ -136,6 +165,22 @@ static int w1_gpio_probe(struct platform_device *pdev) - return -ENOMEM; - } - -+ w1_gpio_pin_orig = pdata->pin; -+ w1_gpio_pullup_pin_orig = pdata->ext_pullup_enable_pin; -+ w1_gpio_pullup_orig = pdata->parasitic_power; ++ piscreen2_ts: piscreen2-ts@1 { ++ compatible = "ti,ads7846"; ++ reg = <1>; + -+ if(gpio_is_valid(w1_gpio_pin)) { -+ pdata->pin = w1_gpio_pin; -+ pdata->ext_pullup_enable_pin = -1; -+ pdata->parasitic_power = -1; -+ } -+ pdata->parasitic_power |= w1_gpio_pullup; -+ if(gpio_is_valid(w1_gpio_pullup_pin)) { -+ pdata->ext_pullup_enable_pin = w1_gpio_pullup_pin; -+ } ++ spi-max-frequency = <2000000>; ++ interrupts = <17 2>; /* high-to-low edge triggered */ ++ interrupt-parent = <&gpio>; ++ pendown-gpio = <&gpio 17 0>; ++ ti,swap-xy; ++ ti,x-plate-ohms = /bits/ 16 <100>; ++ ti,pressure-max = /bits/ 16 <255>; ++ }; ++ }; ++ }; ++ __overrides__ { ++ speed = <&piscreen2>,"spi-max-frequency:0"; ++ rotate = <&piscreen2>,"rotate:0"; ++ fps = <&piscreen2>,"fps:0"; ++ debug = <&piscreen2>,"debug:0"; ++ xohms = <&piscreen2_ts>,"ti,x-plate-ohms;0"; ++ }; ++}; + -+ dev_info(&pdev->dev, "gpio pin %d, external pullup pin %d, parasitic power %d\n", pdata->pin, pdata->ext_pullup_enable_pin, pdata->parasitic_power); +diff --git a/arch/arm/boot/dts/overlays/pitft22-overlay.dts b/arch/arm/boot/dts/overlays/pitft22-overlay.dts +new file mode 100644 +index 0000000..894ba22 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/pitft22-overlay.dts +@@ -0,0 +1,69 @@ ++/* ++ * Device Tree overlay for pitft by Adafruit ++ * ++ */ + - err = devm_gpio_request(&pdev->dev, pdata->pin, "w1"); - if (err) { - dev_err(&pdev->dev, "gpio_request (pin) failed\n"); -@@ -165,6 +210,14 @@ static int w1_gpio_probe(struct platform_device *pdev) - master->set_pullup = w1_gpio_set_pullup; - } - -+ if (pdata->parasitic_power) { -+ if (pdata->is_open_drain) -+ printk(KERN_ERR "w1-gpio 'pullup'(parasitic power) " -+ "option doesn't work with open drain GPIO\n"); -+ else -+ master->bitbang_pullup = w1_gpio_bitbang_pullup; -+ } ++/dts-v1/; ++/plugin/; + - err = w1_add_master_device(master); - if (err) { - dev_err(&pdev->dev, "w1_add_master device failed\n"); -@@ -195,6 +248,10 @@ static int w1_gpio_remove(struct platform_device *pdev) - - w1_remove_master_device(master); - -+ pdata->pin = w1_gpio_pin_orig; -+ pdata->ext_pullup_enable_pin = w1_gpio_pullup_pin_orig; -+ pdata->parasitic_power = w1_gpio_pullup_orig; ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; + - return 0; - } - -diff --git a/drivers/w1/w1.h b/drivers/w1/w1.h -index 56a49ba..881d728 100644 ---- a/drivers/w1/w1.h -+++ b/drivers/w1/w1.h -@@ -171,6 +171,12 @@ struct w1_bus_master - - u8 (*set_pullup)(void *, int); - -+ /** -+ * Turns the pullup on/off in bitbanging mode, takes an on/off argument. -+ * @return -1=Error, 0=completed -+ */ -+ void (*bitbang_pullup) (void *, u8); ++ fragment@0 { ++ target = <&spi0>; ++ __overlay__ { ++ status = "okay"; + - void (*search)(void *, struct w1_master *, - u8, w1_slave_found_callback); - }; -diff --git a/drivers/w1/w1_int.c b/drivers/w1/w1_int.c -index 20f766a..c4fbdb1 100644 ---- a/drivers/w1/w1_int.c -+++ b/drivers/w1/w1_int.c -@@ -122,6 +122,20 @@ int w1_add_master_device(struct w1_bus_master *master) - return(-EINVAL); - } - -+ /* bitbanging hardware uses bitbang_pullup, other hardware uses set_pullup -+ * and takes care of timing itself */ -+ if (!master->write_byte && !master->touch_bit && master->set_pullup) { -+ printk(KERN_ERR "w1_add_master_device: set_pullup requires " -+ "write_byte or touch_bit, disabling\n"); -+ master->set_pullup = NULL; -+ } ++ spidev@0{ ++ status = "disabled"; ++ }; + -+ if (master->set_pullup && master->bitbang_pullup) { -+ printk(KERN_ERR "w1_add_master_device: set_pullup should not " -+ "be set when bitbang_pullup is used, disabling\n"); -+ master->set_pullup = NULL; -+ } ++ spidev@1{ ++ status = "disabled"; ++ }; ++ }; ++ }; + - /* Lock until the device is added (or not) to w1_masters. */ - mutex_lock(&w1_mlock); - /* Search for the first available id (starting at 1). */ -diff --git a/drivers/w1/w1_io.c b/drivers/w1/w1_io.c -index 2820924..fd0550f 100644 ---- a/drivers/w1/w1_io.c -+++ b/drivers/w1/w1_io.c -@@ -134,10 +134,22 @@ static void w1_pre_write(struct w1_master *dev) - static void w1_post_write(struct w1_master *dev) - { - if (dev->pullup_duration) { -- if (dev->enable_pullup && dev->bus_master->set_pullup) -- dev->bus_master->set_pullup(dev->bus_master->data, 0); -- else -+ if (dev->enable_pullup) { -+ if (dev->bus_master->set_pullup) { -+ dev->bus_master->set_pullup(dev-> -+ bus_master->data, -+ 0); -+ } else if (dev->bus_master->bitbang_pullup) { -+ dev->bus_master-> -+ bitbang_pullup(dev->bus_master->data, 1); -+ msleep(dev->pullup_duration); -+ dev->bus_master-> -+ bitbang_pullup(dev->bus_master->data, 0); -+ } -+ } else { - msleep(dev->pullup_duration); -+ } ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ pitft_pins: pitft_pins { ++ brcm,pins = <25>; ++ brcm,function = <1>; /* out */ ++ brcm,pull = <0>; /* none */ ++ }; ++ }; ++ }; + - dev->pullup_duration = 0; - } - } -diff --git a/include/linux/w1-gpio.h b/include/linux/w1-gpio.h -index d58594a..feae942 100644 ---- a/include/linux/w1-gpio.h -+++ b/include/linux/w1-gpio.h -@@ -18,6 +18,7 @@ - struct w1_gpio_platform_data { - unsigned int pin; - unsigned int is_open_drain:1; -+ unsigned int parasitic_power:1; - void (*enable_external_pullup)(int enable); - unsigned int ext_pullup_enable_pin; - unsigned int pullup_duration; - -From d0f48fe7aab3e4036fd55b491a9be94ea24f377d Mon Sep 17 00:00:00 2001 -From: popcornmix <popcornmix@gmail.com> -Date: Wed, 18 Dec 2013 22:16:19 +0000 -Subject: [PATCH 062/170] config: Enable CONFIG_MEMCG, but leave it disabled - (due to memory cost). Enable with cgroup_enable=memory. - ---- - kernel/cgroup.c | 23 ++++++++++++++++++++++- - 1 file changed, 22 insertions(+), 1 deletion(-) - -diff --git a/kernel/cgroup.c b/kernel/cgroup.c -index fb1ecfd..888d308 100644 ---- a/kernel/cgroup.c -+++ b/kernel/cgroup.c -@@ -5286,7 +5286,7 @@ int __init cgroup_init_early(void) - return 0; - } - --static unsigned long cgroup_disable_mask __initdata; -+static unsigned long cgroup_disable_mask __initdata = 1<<0; - - /** - * cgroup_init - cgroup initialization -@@ -5782,6 +5782,27 @@ static int __init cgroup_disable(char *str) - } - __setup("cgroup_disable=", cgroup_disable); - -+static int __init cgroup_enable(char *str) -+{ -+ struct cgroup_subsys *ss; -+ char *token; -+ int i; ++ fragment@2 { ++ target = <&spi0>; ++ __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; + -+ while ((token = strsep(&str, ",")) != NULL) { -+ if (!*token) -+ continue; ++ pitft: pitft@0{ ++ compatible = "ilitek,ili9340"; ++ reg = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pitft_pins>; + -+ for_each_subsys(ss, i) { -+ if (strcmp(token, ss->name) && -+ strcmp(token, ss->legacy_name)) -+ continue; -+ cgroup_disable_mask &= ~(1 << i); -+ } -+ } -+ return 1; -+} -+__setup("cgroup_enable=", cgroup_enable); ++ spi-max-frequency = <32000000>; ++ rotate = <90>; ++ fps = <25>; ++ bgr; ++ buswidth = <8>; ++ dc-gpios = <&gpio 25 0>; ++ debug = <0>; ++ }; + - /** - * css_tryget_online_from_dir - get corresponding css from a cgroup dentry - * @dentry: directory dentry of interest - -From 8d35b3a72d3580ad6f5bc5835bfe13b00cce6086 Mon Sep 17 00:00:00 2001 -From: Florian Meier <florian.meier@koalo.de> -Date: Fri, 22 Nov 2013 14:59:51 +0100 -Subject: [PATCH 063/170] ASoC: Add support for PCM5102A codec - -Some definitions to support the PCM5102A codec -by Texas Instruments. - -Signed-off-by: Florian Meier <florian.meier@koalo.de> ---- - sound/soc/codecs/Kconfig | 5 ++++ - sound/soc/codecs/Makefile | 2 ++ - sound/soc/codecs/pcm5102a.c | 70 +++++++++++++++++++++++++++++++++++++++++++++ - 3 files changed, 77 insertions(+) - create mode 100644 sound/soc/codecs/pcm5102a.c - -diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig -index cfdafc4..bd38590 100644 ---- a/sound/soc/codecs/Kconfig -+++ b/sound/soc/codecs/Kconfig -@@ -89,6 +89,7 @@ config SND_SOC_ALL_CODECS - select SND_SOC_PCM512x_SPI if SPI_MASTER - select SND_SOC_RT286 if I2C - select SND_SOC_RT298 if I2C -+ select SND_SOC_PCM5102A if I2C - select SND_SOC_RT5631 if I2C - select SND_SOC_RT5640 if I2C - select SND_SOC_RT5645 if I2C -@@ -549,6 +550,10 @@ config SND_SOC_RT298 - tristate - depends on I2C - -+config SND_SOC_PCM5102A -+ tristate -+ depends on I2C ++ }; ++ }; + - config SND_SOC_RT5631 - tristate "Realtek ALC5631/RT5631 CODEC" - depends on I2C -diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile -index f632fc4..7ba76ba 100644 ---- a/sound/soc/codecs/Makefile -+++ b/sound/soc/codecs/Makefile -@@ -85,6 +85,7 @@ snd-soc-rl6231-objs := rl6231.o - snd-soc-rl6347a-objs := rl6347a.o - snd-soc-rt286-objs := rt286.o - snd-soc-rt298-objs := rt298.o -+snd-soc-pcm5102a-objs := pcm5102a.o - snd-soc-rt5631-objs := rt5631.o - snd-soc-rt5640-objs := rt5640.o - snd-soc-rt5645-objs := rt5645.o -@@ -280,6 +281,7 @@ obj-$(CONFIG_SND_SOC_RL6231) += snd-soc-rl6231.o - obj-$(CONFIG_SND_SOC_RL6347A) += snd-soc-rl6347a.o - obj-$(CONFIG_SND_SOC_RT286) += snd-soc-rt286.o - obj-$(CONFIG_SND_SOC_RT298) += snd-soc-rt298.o -+obj-$(CONFIG_SND_SOC_PCM5102A) += snd-soc-pcm5102a.o - obj-$(CONFIG_SND_SOC_RT5631) += snd-soc-rt5631.o - obj-$(CONFIG_SND_SOC_RT5640) += snd-soc-rt5640.o - obj-$(CONFIG_SND_SOC_RT5645) += snd-soc-rt5645.o -diff --git a/sound/soc/codecs/pcm5102a.c b/sound/soc/codecs/pcm5102a.c ++ __overrides__ { ++ speed = <&pitft>,"spi-max-frequency:0"; ++ rotate = <&pitft>,"rotate:0"; ++ fps = <&pitft>,"fps:0"; ++ debug = <&pitft>,"debug:0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/pitft28-capacitive-overlay.dts b/arch/arm/boot/dts/overlays/pitft28-capacitive-overlay.dts new file mode 100644 -index 0000000..7c6598e +index 0000000..5c07526 --- /dev/null -+++ b/sound/soc/codecs/pcm5102a.c -@@ -0,0 +1,70 @@ ++++ b/arch/arm/boot/dts/overlays/pitft28-capacitive-overlay.dts +@@ -0,0 +1,91 @@ +/* -+ * Driver for the PCM5102A codec -+ * -+ * Author: Florian Meier <florian.meier@koalo.de> -+ * Copyright 2013 -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License -+ * version 2 as published by the Free Software Foundation. ++ * Device Tree overlay for Adafruit PiTFT 2.8" capacitive touch screen + * -+ * This program is distributed in the hope that it will be useful, but -+ * WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * General Public License for more details. + */ + ++/dts-v1/; ++/plugin/; + -+#include <linux/init.h> -+#include <linux/module.h> -+#include <linux/platform_device.h> ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; + -+#include <sound/soc.h> ++ fragment@0 { ++ target = <&spi0>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; + -+static struct snd_soc_dai_driver pcm5102a_dai = { -+ .name = "pcm5102a-hifi", -+ .playback = { -+ .channels_min = 2, -+ .channels_max = 2, -+ .rates = SNDRV_PCM_RATE_8000_192000, -+ .formats = SNDRV_PCM_FMTBIT_S16_LE | -+ SNDRV_PCM_FMTBIT_S24_LE | -+ SNDRV_PCM_FMTBIT_S32_LE -+ }, -+}; ++ fragment@1 { ++ target = <&spidev0>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; + -+static struct snd_soc_codec_driver soc_codec_dev_pcm5102a; ++ fragment@2 { ++ target = <&gpio>; ++ __overlay__ { ++ pitft_pins: pitft_pins { ++ brcm,pins = <24 25>; ++ brcm,function = <0 1>; /* in out */ ++ brcm,pull = <2 0>; /* pullup none */ ++ }; ++ }; ++ }; + -+static int pcm5102a_probe(struct platform_device *pdev) -+{ -+ return snd_soc_register_codec(&pdev->dev, &soc_codec_dev_pcm5102a, -+ &pcm5102a_dai, 1); -+} ++ fragment@3 { ++ target = <&spi0>; ++ __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; + -+static int pcm5102a_remove(struct platform_device *pdev) -+{ -+ snd_soc_unregister_codec(&pdev->dev); -+ return 0; -+} ++ pitft: pitft@0{ ++ compatible = "ilitek,ili9340"; ++ reg = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pitft_pins>; + -+static const struct of_device_id pcm5102a_of_match[] = { -+ { .compatible = "ti,pcm5102a", }, -+ { } -+}; -+MODULE_DEVICE_TABLE(of, pcm5102a_of_match); ++ spi-max-frequency = <32000000>; ++ rotate = <90>; ++ fps = <25>; ++ bgr; ++ buswidth = <8>; ++ dc-gpios = <&gpio 25 0>; ++ debug = <0>; ++ }; ++ }; ++ }; + -+static struct platform_driver pcm5102a_codec_driver = { -+ .probe = pcm5102a_probe, -+ .remove = pcm5102a_remove, -+ .driver = { -+ .name = "pcm5102a-codec", -+ .owner = THIS_MODULE, -+ .of_match_table = pcm5102a_of_match, -+ }, -+}; -+ -+module_platform_driver(pcm5102a_codec_driver); ++ fragment@4 { ++ target = <&i2c1>; ++ __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; + -+MODULE_DESCRIPTION("ASoC PCM5102A codec driver"); -+MODULE_AUTHOR("Florian Meier <florian.meier@koalo.de>"); -+MODULE_LICENSE("GPL v2"); - -From 9ced0e86593de2214ff8a81f71c802d7e7301b05 Mon Sep 17 00:00:00 2001 -From: Florian Meier <florian.meier@koalo.de> -Date: Fri, 22 Nov 2013 19:19:08 +0100 -Subject: [PATCH 064/170] ASoC: Add support for HifiBerry DAC - -This adds a machine driver for the HifiBerry DAC. -It is a sound card that can -be stacked onto the Raspberry Pi. - -Signed-off-by: Florian Meier <florian.meier@koalo.de> ---- - sound/soc/bcm/Kconfig | 7 +++ - sound/soc/bcm/Makefile | 4 ++ - sound/soc/bcm/hifiberry_dac.c | 122 ++++++++++++++++++++++++++++++++++++++++++ - 3 files changed, 133 insertions(+) - create mode 100644 sound/soc/bcm/hifiberry_dac.c - -diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig -index c5070ae..ce81f14 100644 ---- a/sound/soc/bcm/Kconfig -+++ b/sound/soc/bcm/Kconfig -@@ -7,3 +7,10 @@ config SND_BCM2835_SOC_I2S - Say Y or M if you want to add support for codecs attached to - the BCM2835 I2S interface. You will also need - to select the audio interfaces to support below. ++ ft6236: ft6236@38 { ++ compatible = "focaltech,ft6236"; ++ reg = <0x38>; + -+config SND_BCM2708_SOC_HIFIBERRY_DAC -+ tristate "Support for HifiBerry DAC" -+ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S -+ select SND_SOC_PCM5102A -+ help -+ Say Y or M if you want to add support for HifiBerry DAC. -diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile -index bc816b7..b877d38 100644 ---- a/sound/soc/bcm/Makefile -+++ b/sound/soc/bcm/Makefile -@@ -3,3 +3,7 @@ snd-soc-bcm2835-i2s-objs := bcm2835-i2s.o - - obj-$(CONFIG_SND_BCM2835_SOC_I2S) += snd-soc-bcm2835-i2s.o - -+# BCM2708 Machine Support -+snd-soc-hifiberry-dac-objs := hifiberry_dac.o ++ interrupt-parent = <&gpio>; ++ interrupts = <24 2>; ++ touchscreen-size-x = <240>; ++ touchscreen-size-y = <320>; ++ }; ++ }; ++ }; + -+obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o -diff --git a/sound/soc/bcm/hifiberry_dac.c b/sound/soc/bcm/hifiberry_dac.c ++ __overrides__ { ++ speed = <&pitft>,"spi-max-frequency:0"; ++ rotate = <&pitft>,"rotate:0"; ++ fps = <&pitft>,"fps:0"; ++ debug = <&pitft>,"debug:0"; ++ touch-sizex = <&ft6236>,"touchscreen-size-x?"; ++ touch-sizey = <&ft6236>,"touchscreen-size-y?"; ++ touch-invx = <&ft6236>,"touchscreen-inverted-x?"; ++ touch-invy = <&ft6236>,"touchscreen-inverted-y?"; ++ touch-swapxy = <&ft6236>,"touchscreen-swapped-x-y?"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/pitft28-resistive-overlay.dts b/arch/arm/boot/dts/overlays/pitft28-resistive-overlay.dts new file mode 100644 -index 0000000..3ab0f47 +index 0000000..ed2afc2 --- /dev/null -+++ b/sound/soc/bcm/hifiberry_dac.c -@@ -0,0 +1,122 @@ ++++ b/arch/arm/boot/dts/overlays/pitft28-resistive-overlay.dts +@@ -0,0 +1,121 @@ +/* -+ * ASoC Driver for HifiBerry DAC -+ * -+ * Author: Florian Meier <florian.meier@koalo.de> -+ * Copyright 2013 -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License -+ * version 2 as published by the Free Software Foundation. ++ * Device Tree overlay for Adafruit PiTFT 2.8" resistive touch screen + * -+ * This program is distributed in the hope that it will be useful, but -+ * WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * General Public License for more details. + */ + -+#include <linux/module.h> -+#include <linux/platform_device.h> -+ -+#include <sound/core.h> -+#include <sound/pcm.h> -+#include <sound/pcm_params.h> -+#include <sound/soc.h> -+#include <sound/jack.h> -+ -+static int snd_rpi_hifiberry_dac_init(struct snd_soc_pcm_runtime *rtd) -+{ -+ return 0; -+} -+ -+static int snd_rpi_hifiberry_dac_hw_params(struct snd_pcm_substream *substream, -+ struct snd_pcm_hw_params *params) -+{ -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; ++/dts-v1/; ++/plugin/; + -+ unsigned int sample_bits = -+ snd_pcm_format_physical_width(params_format(params)); ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; + -+ return snd_soc_dai_set_bclk_ratio(cpu_dai, sample_bits * 2); -+} ++ fragment@0 { ++ target = <&spi0>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; + -+/* machine stream operations */ -+static struct snd_soc_ops snd_rpi_hifiberry_dac_ops = { -+ .hw_params = snd_rpi_hifiberry_dac_hw_params, -+}; ++ fragment@1 { ++ target = <&spidev0>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; + -+static struct snd_soc_dai_link snd_rpi_hifiberry_dac_dai[] = { -+{ -+ .name = "HifiBerry DAC", -+ .stream_name = "HifiBerry DAC HiFi", -+ .cpu_dai_name = "bcm2708-i2s.0", -+ .codec_dai_name = "pcm5102a-hifi", -+ .platform_name = "bcm2708-i2s.0", -+ .codec_name = "pcm5102a-codec", -+ .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | -+ SND_SOC_DAIFMT_CBS_CFS, -+ .ops = &snd_rpi_hifiberry_dac_ops, -+ .init = snd_rpi_hifiberry_dac_init, -+}, -+}; ++ fragment@2 { ++ target = <&spidev1>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; + -+/* audio machine driver */ -+static struct snd_soc_card snd_rpi_hifiberry_dac = { -+ .name = "snd_rpi_hifiberry_dac", -+ .dai_link = snd_rpi_hifiberry_dac_dai, -+ .num_links = ARRAY_SIZE(snd_rpi_hifiberry_dac_dai), -+}; ++ fragment@3 { ++ target = <&gpio>; ++ __overlay__ { ++ pitft_pins: pitft_pins { ++ brcm,pins = <24 25>; ++ brcm,function = <0 1>; /* in out */ ++ brcm,pull = <2 0>; /* pullup none */ ++ }; ++ }; ++ }; + -+static int snd_rpi_hifiberry_dac_probe(struct platform_device *pdev) -+{ -+ int ret = 0; ++ fragment@4 { ++ target = <&spi0>; ++ __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; + -+ snd_rpi_hifiberry_dac.dev = &pdev->dev; ++ pitft: pitft@0{ ++ compatible = "ilitek,ili9340"; ++ reg = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pitft_pins>; + -+ if (pdev->dev.of_node) { -+ struct device_node *i2s_node; -+ struct snd_soc_dai_link *dai = &snd_rpi_hifiberry_dac_dai[0]; -+ i2s_node = of_parse_phandle(pdev->dev.of_node, -+ "i2s-controller", 0); ++ spi-max-frequency = <32000000>; ++ rotate = <90>; ++ fps = <25>; ++ bgr; ++ buswidth = <8>; ++ dc-gpios = <&gpio 25 0>; ++ debug = <0>; ++ }; + -+ if (i2s_node) { -+ dai->cpu_dai_name = NULL; -+ dai->cpu_of_node = i2s_node; -+ dai->platform_name = NULL; -+ dai->platform_of_node = i2s_node; -+ } -+ } ++ pitft_ts@1 { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ compatible = "st,stmpe610"; ++ reg = <1>; + -+ ret = snd_soc_register_card(&snd_rpi_hifiberry_dac); -+ if (ret) -+ dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", ret); ++ spi-max-frequency = <500000>; ++ irq-gpio = <&gpio 24 0x2>; /* IRQF_TRIGGER_FALLING */ ++ interrupts = <24 2>; /* high-to-low edge triggered */ ++ interrupt-parent = <&gpio>; ++ interrupt-controller; + -+ return ret; -+} ++ stmpe_touchscreen { ++ compatible = "st,stmpe-ts"; ++ st,sample-time = <4>; ++ st,mod-12b = <1>; ++ st,ref-sel = <0>; ++ st,adc-freq = <2>; ++ st,ave-ctrl = <3>; ++ st,touch-det-delay = <4>; ++ st,settling = <2>; ++ st,fraction-z = <7>; ++ st,i-drive = <0>; ++ }; + -+static int snd_rpi_hifiberry_dac_remove(struct platform_device *pdev) -+{ -+ return snd_soc_unregister_card(&snd_rpi_hifiberry_dac); -+} ++ stmpe_gpio: stmpe_gpio { ++ #gpio-cells = <2>; ++ compatible = "st,stmpe-gpio"; ++ /* ++ * only GPIO2 is wired/available ++ * and it is wired to the backlight ++ */ ++ st,norequest-mask = <0x7b>; ++ }; ++ }; ++ }; ++ }; + -+static const struct of_device_id snd_rpi_hifiberry_dac_of_match[] = { -+ { .compatible = "hifiberry,hifiberry-dac", }, -+ {}, -+}; -+MODULE_DEVICE_TABLE(of, snd_rpi_hifiberry_dac_of_match); ++ fragment@5 { ++ target-path = "/soc"; ++ __overlay__ { ++ backlight { ++ compatible = "gpio-backlight"; ++ gpios = <&stmpe_gpio 2 0>; ++ default-on; ++ }; ++ }; ++ }; + -+static struct platform_driver snd_rpi_hifiberry_dac_driver = { -+ .driver = { -+ .name = "snd-hifiberry-dac", -+ .owner = THIS_MODULE, -+ .of_match_table = snd_rpi_hifiberry_dac_of_match, -+ }, -+ .probe = snd_rpi_hifiberry_dac_probe, -+ .remove = snd_rpi_hifiberry_dac_remove, ++ __overrides__ { ++ speed = <&pitft>,"spi-max-frequency:0"; ++ rotate = <&pitft>,"rotate:0"; ++ fps = <&pitft>,"fps:0"; ++ debug = <&pitft>,"debug:0"; ++ }; +}; +diff --git a/arch/arm/boot/dts/overlays/pps-gpio-overlay.dts b/arch/arm/boot/dts/overlays/pps-gpio-overlay.dts +new file mode 100644 +index 0000000..40bf0e1 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/pps-gpio-overlay.dts +@@ -0,0 +1,34 @@ ++/dts-v1/; ++/plugin/; + -+module_platform_driver(snd_rpi_hifiberry_dac_driver); ++/ { ++ compatible = "brcm,bcm2708"; ++ fragment@0 { ++ target-path = "/"; ++ __overlay__ { ++ pps: pps { ++ compatible = "pps-gpio"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pps_pins>; ++ gpios = <&gpio 18 0>; ++ status = "okay"; ++ }; ++ }; ++ }; + -+MODULE_AUTHOR("Florian Meier <florian.meier@koalo.de>"); -+MODULE_DESCRIPTION("ASoC Driver for HifiBerry DAC"); -+MODULE_LICENSE("GPL v2"); - -From f16a654f57b024d44fe58d62b660e01de6a7811a Mon Sep 17 00:00:00 2001 -From: Florian Meier <florian.meier@koalo.de> -Date: Fri, 22 Nov 2013 19:21:34 +0100 -Subject: [PATCH 065/170] ASoC: Add support for Rpi-DAC - ---- - sound/soc/bcm/Kconfig | 7 +++ - sound/soc/bcm/Makefile | 2 + - sound/soc/bcm/rpi-dac.c | 118 ++++++++++++++++++++++++++++++++++++++++++++ - sound/soc/codecs/Kconfig | 9 ++++ - sound/soc/codecs/Makefile | 2 + - sound/soc/codecs/pcm1794a.c | 69 ++++++++++++++++++++++++++ - 6 files changed, 207 insertions(+) - create mode 100644 sound/soc/bcm/rpi-dac.c - create mode 100644 sound/soc/codecs/pcm1794a.c - -diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig -index ce81f14..900de22 100644 ---- a/sound/soc/bcm/Kconfig -+++ b/sound/soc/bcm/Kconfig -@@ -14,3 +14,10 @@ config SND_BCM2708_SOC_HIFIBERRY_DAC - select SND_SOC_PCM5102A - help - Say Y or M if you want to add support for HifiBerry DAC. ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ pps_pins: pps_pins { ++ brcm,pins = <18>; ++ brcm,function = <0>; // in ++ brcm,pull = <0>; // off ++ }; ++ }; ++ }; + -+config SND_BCM2708_SOC_RPI_DAC -+ tristate "Support for RPi-DAC" -+ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S -+ select SND_SOC_PCM1794A -+ help -+ Say Y or M if you want to add support for RPi-DAC. -diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile -index b877d38..99c96b4 100644 ---- a/sound/soc/bcm/Makefile -+++ b/sound/soc/bcm/Makefile -@@ -5,5 +5,7 @@ obj-$(CONFIG_SND_BCM2835_SOC_I2S) += snd-soc-bcm2835-i2s.o - - # BCM2708 Machine Support - snd-soc-hifiberry-dac-objs := hifiberry_dac.o -+snd-soc-rpi-dac-objs := rpi-dac.o - - obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o -+obj-$(CONFIG_SND_BCM2708_SOC_RPI_DAC) += snd-soc-rpi-dac.o -diff --git a/sound/soc/bcm/rpi-dac.c b/sound/soc/bcm/rpi-dac.c ++ __overrides__ { ++ gpiopin = <&pps>,"gpios:4", ++ <&pps_pins>,"brcm,pins:0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/pwm-2chan-overlay.dts b/arch/arm/boot/dts/overlays/pwm-2chan-overlay.dts new file mode 100644 -index 0000000..d5fac1b +index 0000000..18e4e4f --- /dev/null -+++ b/sound/soc/bcm/rpi-dac.c -@@ -0,0 +1,118 @@ ++++ b/arch/arm/boot/dts/overlays/pwm-2chan-overlay.dts +@@ -0,0 +1,53 @@ ++/dts-v1/; ++/plugin/; ++ +/* -+ * ASoC Driver for RPi-DAC. -+ * -+ * Author: Florian Meier <florian.meier@koalo.de> -+ * Copyright 2013 -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License -+ * version 2 as published by the Free Software Foundation. -+ * -+ * This program is distributed in the hope that it will be useful, but -+ * WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * General Public License for more details. -+ */ ++This is the 2-channel overlay - only use it if you need both channels. + -+#include <linux/module.h> -+#include <linux/platform_device.h> ++Legal pin,function combinations for each channel: ++ PWM0: 12,4(Alt0) 18,2(Alt5) 40,4(Alt0) 52,5(Alt1) ++ PWM1: 13,4(Alt0) 19,2(Alt5) 41,4(Alt0) 45,4(Alt0) 53,5(Alt1) + -+#include <sound/core.h> -+#include <sound/pcm.h> -+#include <sound/pcm_params.h> -+#include <sound/soc.h> -+#include <sound/jack.h> ++N.B.: ++ 1) Pin 18 is the only one available on all platforms, and ++ it is the one used by the I2S audio interface. ++ Pins 12 and 13 might be better choices on an A+, B+ or Pi2. ++ 2) The onboard analogue audio output uses both PWM channels. ++ 3) So be careful mixing audio and PWM. ++*/ + -+static int snd_rpi_rpi_dac_init(struct snd_soc_pcm_runtime *rtd) -+{ -+ return 0; -+} ++/ { ++ fragment@0 { ++ target = <&gpio>; ++ __overlay__ { ++ pwm_pins: pwm_pins { ++ brcm,pins = <18 19>; ++ brcm,function = <2 2>; /* Alt5 */ ++ }; ++ }; ++ }; + -+static int snd_rpi_rpi_dac_hw_params(struct snd_pcm_substream *substream, -+ struct snd_pcm_hw_params *params) -+{ -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; ++ fragment@1 { ++ target = <&pwm>; ++ __overlay__ { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pwm_pins>; ++ status = "okay"; ++ }; ++ }; + -+ return snd_soc_dai_set_bclk_ratio(cpu_dai, 32*2); -+} ++ fragment@2 { ++ target = <&clk_pwm>; ++ frag2: __overlay__ { ++ clock-frequency = <100000000>; ++ }; ++ }; + -+/* machine stream operations */ -+static struct snd_soc_ops snd_rpi_rpi_dac_ops = { -+ .hw_params = snd_rpi_rpi_dac_hw_params, ++ __overrides__ { ++ pin = <&pwm_pins>,"brcm,pins:0"; ++ pin2 = <&pwm_pins>,"brcm,pins:4"; ++ func = <&pwm_pins>,"brcm,function:0"; ++ func2 = <&pwm_pins>,"brcm,function:4"; ++ clock = <&frag2>,"clock-frequency:0"; ++ }; +}; +diff --git a/arch/arm/boot/dts/overlays/pwm-overlay.dts b/arch/arm/boot/dts/overlays/pwm-overlay.dts +new file mode 100644 +index 0000000..bf030a6 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/pwm-overlay.dts +@@ -0,0 +1,49 @@ ++/dts-v1/; ++/plugin/; + -+static struct snd_soc_dai_link snd_rpi_rpi_dac_dai[] = { -+{ -+ .name = "RPi-DAC", -+ .stream_name = "RPi-DAC HiFi", -+ .cpu_dai_name = "bcm2708-i2s.0", -+ .codec_dai_name = "pcm1794a-hifi", -+ .platform_name = "bcm2708-i2s.0", -+ .codec_name = "pcm1794a-codec", -+ .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | -+ SND_SOC_DAIFMT_CBS_CFS, -+ .ops = &snd_rpi_rpi_dac_ops, -+ .init = snd_rpi_rpi_dac_init, -+}, -+}; ++/* ++Legal pin,function combinations for each channel: ++ PWM0: 12,4(Alt0) 18,2(Alt5) 40,4(Alt0) 52,5(Alt1) ++ PWM1: 13,4(Alt0) 19,2(Alt5) 41,4(Alt0) 45,4(Alt0) 53,5(Alt1) + -+/* audio machine driver */ -+static struct snd_soc_card snd_rpi_rpi_dac = { -+ .name = "snd_rpi_rpi_dac", -+ .dai_link = snd_rpi_rpi_dac_dai, -+ .num_links = ARRAY_SIZE(snd_rpi_rpi_dac_dai), -+}; ++N.B.: ++ 1) Pin 18 is the only one available on all platforms, and ++ it is the one used by the I2S audio interface. ++ Pins 12 and 13 might be better choices on an A+, B+ or Pi2. ++ 2) The onboard analogue audio output uses both PWM channels. ++ 3) So be careful mixing audio and PWM. ++*/ + -+static int snd_rpi_rpi_dac_probe(struct platform_device *pdev) -+{ -+ int ret = 0; ++/ { ++ fragment@0 { ++ target = <&gpio>; ++ __overlay__ { ++ pwm_pins: pwm_pins { ++ brcm,pins = <18>; ++ brcm,function = <2>; /* Alt5 */ ++ }; ++ }; ++ }; + -+ snd_rpi_rpi_dac.dev = &pdev->dev; -+ -+ if (pdev->dev.of_node) { -+ struct device_node *i2s_node; -+ struct snd_soc_dai_link *dai = &snd_rpi_rpi_dac_dai[0]; -+ i2s_node = of_parse_phandle(pdev->dev.of_node, "i2s-controller", 0); ++ fragment@1 { ++ target = <&pwm>; ++ __overlay__ { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pwm_pins>; ++ status = "okay"; ++ }; ++ }; + -+ if (i2s_node) { -+ dai->cpu_dai_name = NULL; -+ dai->cpu_of_node = i2s_node; -+ dai->platform_name = NULL; -+ dai->platform_of_node = i2s_node; -+ } -+ } -+ -+ ret = snd_soc_register_card(&snd_rpi_rpi_dac); -+ if (ret) -+ dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", ret); ++ fragment@2 { ++ target = <&clk_pwm>; ++ frag2: __overlay__ { ++ clock-frequency = <100000000>; ++ }; ++ }; + -+ return ret; -+} ++ __overrides__ { ++ pin = <&pwm_pins>,"brcm,pins:0"; ++ func = <&pwm_pins>,"brcm,function:0"; ++ clock = <&frag2>,"clock-frequency:0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/qca7000-overlay.dts b/arch/arm/boot/dts/overlays/qca7000-overlay.dts +new file mode 100644 +index 0000000..b4e6013 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/qca7000-overlay.dts +@@ -0,0 +1,52 @@ ++// Overlay for the Qualcomm Atheros QCA7000 on I2SE's PLC Stamp micro EVK ++// Visit: https://www.i2se.com/product/plc-stamp-micro-evk for details + -+static int snd_rpi_rpi_dac_remove(struct platform_device *pdev) -+{ -+ return snd_soc_unregister_card(&snd_rpi_rpi_dac); -+} ++/dts-v1/; ++/plugin/; + -+static const struct of_device_id snd_rpi_rpi_dac_of_match[] = { -+ { .compatible = "rpi,rpi-dac", }, -+ {}, -+}; -+MODULE_DEVICE_TABLE(of, snd_rpi_rpi_dac_of_match); ++/ { ++ compatible = "brcm,bcm2708"; + -+static struct platform_driver snd_rpi_rpi_dac_driver = { -+ .driver = { -+ .name = "snd-rpi-dac", -+ .owner = THIS_MODULE, -+ .of_match_table = snd_rpi_rpi_dac_of_match, -+ }, -+ .probe = snd_rpi_rpi_dac_probe, -+ .remove = snd_rpi_rpi_dac_remove, -+}; ++ fragment@0 { ++ target = <&spi0>; ++ __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; + -+module_platform_driver(snd_rpi_rpi_dac_driver); ++ status = "okay"; + -+MODULE_AUTHOR("Florian Meier <florian.meier@koalo.de>"); -+MODULE_DESCRIPTION("ASoC Driver for RPi-DAC"); -+MODULE_LICENSE("GPL v2"); -diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig -index bd38590..b63f2fb 100644 ---- a/sound/soc/codecs/Kconfig -+++ b/sound/soc/codecs/Kconfig -@@ -90,6 +90,7 @@ config SND_SOC_ALL_CODECS - select SND_SOC_RT286 if I2C - select SND_SOC_RT298 if I2C - select SND_SOC_PCM5102A if I2C -+ select SND_SOC_PCM1794A if I2C - select SND_SOC_RT5631 if I2C - select SND_SOC_RT5640 if I2C - select SND_SOC_RT5645 if I2C -@@ -550,6 +551,14 @@ config SND_SOC_RT298 - tristate - depends on I2C - -+config SND_SOC_RT298 -+ tristate -+ depends on I2C ++ spidev@0 { ++ status = "disabled"; ++ }; + -+config SND_SOC_PCM1794A -+ tristate -+ depends on I2C ++ eth1: qca7000@0 { ++ compatible = "qca,qca7000"; ++ reg = <0>; /* CE0 */ ++ pinctrl-names = "default"; ++ pinctrl-0 = <&eth1_pins>; ++ interrupt-parent = <&gpio>; ++ interrupts = <23 0x1>; /* rising edge */ ++ spi-max-frequency = <12000000>; ++ status = "okay"; ++ }; ++ }; ++ }; + - config SND_SOC_PCM5102A - tristate - depends on I2C -diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile -index 7ba76ba..2147436 100644 ---- a/sound/soc/codecs/Makefile -+++ b/sound/soc/codecs/Makefile -@@ -85,6 +85,7 @@ snd-soc-rl6231-objs := rl6231.o - snd-soc-rl6347a-objs := rl6347a.o - snd-soc-rt286-objs := rt286.o - snd-soc-rt298-objs := rt298.o -+snd-soc-pcm1794a-objs := pcm1794a.o - snd-soc-pcm5102a-objs := pcm5102a.o - snd-soc-rt5631-objs := rt5631.o - snd-soc-rt5640-objs := rt5640.o -@@ -281,6 +282,7 @@ obj-$(CONFIG_SND_SOC_RL6231) += snd-soc-rl6231.o - obj-$(CONFIG_SND_SOC_RL6347A) += snd-soc-rl6347a.o - obj-$(CONFIG_SND_SOC_RT286) += snd-soc-rt286.o - obj-$(CONFIG_SND_SOC_RT298) += snd-soc-rt298.o -+obj-$(CONFIG_SND_SOC_PCM1794A) += snd-soc-pcm1794a.o - obj-$(CONFIG_SND_SOC_PCM5102A) += snd-soc-pcm5102a.o - obj-$(CONFIG_SND_SOC_RT5631) += snd-soc-rt5631.o - obj-$(CONFIG_SND_SOC_RT5640) += snd-soc-rt5640.o -diff --git a/sound/soc/codecs/pcm1794a.c b/sound/soc/codecs/pcm1794a.c ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ eth1_pins: eth1_pins { ++ brcm,pins = <23>; ++ brcm,function = <0>; /* in */ ++ brcm,pull = <0>; /* none */ ++ }; ++ }; ++ }; ++ ++ __overrides__ { ++ int_pin = <&eth1>, "interrupts:0", ++ <&eth1_pins>, "brcm,pins:0"; ++ speed = <&eth1>, "spi-max-frequency:0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/raspidac3-overlay.dts b/arch/arm/boot/dts/overlays/raspidac3-overlay.dts new file mode 100644 -index 0000000..afe1b41 +index 0000000..2fac57c --- /dev/null -+++ b/sound/soc/codecs/pcm1794a.c -@@ -0,0 +1,69 @@ -+/* -+ * Driver for the PCM1794A codec -+ * -+ * Author: Florian Meier <florian.meier@koalo.de> -+ * Copyright 2013 -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License -+ * version 2 as published by the Free Software Foundation. -+ * -+ * This program is distributed in the hope that it will be useful, but -+ * WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * General Public License for more details. -+ */ ++++ b/arch/arm/boot/dts/overlays/raspidac3-overlay.dts +@@ -0,0 +1,45 @@ ++// Definitions for RaspiDACv3 ++/dts-v1/; ++/plugin/; + ++/ { ++ compatible = "brcm,bcm2708"; + -+#include <linux/init.h> -+#include <linux/module.h> -+#include <linux/platform_device.h> ++ fragment@0 { ++ target = <&i2s>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; + -+#include <sound/soc.h> ++ fragment@1 { ++ target = <&i2c1>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; + -+static struct snd_soc_dai_driver pcm1794a_dai = { -+ .name = "pcm1794a-hifi", -+ .playback = { -+ .channels_min = 2, -+ .channels_max = 2, -+ .rates = SNDRV_PCM_RATE_8000_192000, -+ .formats = SNDRV_PCM_FMTBIT_S16_LE | -+ SNDRV_PCM_FMTBIT_S24_LE -+ }, -+}; ++ pcm5122@4c { ++ #sound-dai-cells = <0>; ++ compatible = "ti,pcm5122"; ++ reg = <0x4c>; ++ status = "okay"; ++ }; + -+static struct snd_soc_codec_driver soc_codec_dev_pcm1794a; ++ tpa6130a2: tpa6130a2@60 { ++ compatible = "ti,tpa6130a2"; ++ reg = <0x60>; ++ status = "okay"; ++ }; ++ }; ++ }; + -+static int pcm1794a_probe(struct platform_device *pdev) -+{ -+ return snd_soc_register_codec(&pdev->dev, &soc_codec_dev_pcm1794a, -+ &pcm1794a_dai, 1); -+} ++ fragment@2 { ++ target = <&sound>; ++ __overlay__ { ++ compatible = "jg,raspidacv3"; ++ i2s-controller = <&i2s>; ++ status = "okay"; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/rpi-backlight-overlay.dts b/arch/arm/boot/dts/overlays/rpi-backlight-overlay.dts +new file mode 100644 +index 0000000..c021d02 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/rpi-backlight-overlay.dts +@@ -0,0 +1,21 @@ ++/* ++ * Devicetree overlay for mailbox-driven Raspberry Pi DSI Display ++ * backlight controller ++ */ ++/dts-v1/; ++/plugin/; + -+static int pcm1794a_remove(struct platform_device *pdev) -+{ -+ snd_soc_unregister_codec(&pdev->dev); -+ return 0; -+} ++/ { ++ compatible = "brcm,bcm2708"; + -+static const struct of_device_id pcm1794a_of_match[] = { -+ { .compatible = "ti,pcm1794a", }, -+ { } ++ fragment@0 { ++ target-path = "/"; ++ __overlay__ { ++ rpi_backlight: rpi_backlight { ++ compatible = "raspberrypi,rpi-backlight"; ++ firmware = <&firmware>; ++ status = "okay"; ++ }; ++ }; ++ }; +}; -+MODULE_DEVICE_TABLE(of, pcm1794a_of_match); +diff --git a/arch/arm/boot/dts/overlays/rpi-dac-overlay.dts b/arch/arm/boot/dts/overlays/rpi-dac-overlay.dts +new file mode 100644 +index 0000000..1523eae +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/rpi-dac-overlay.dts +@@ -0,0 +1,34 @@ ++// Definitions for RPi DAC ++/dts-v1/; ++/plugin/; + -+static struct platform_driver pcm1794a_codec_driver = { -+ .probe = pcm1794a_probe, -+ .remove = pcm1794a_remove, -+ .driver = { -+ .name = "pcm1794a-codec", -+ .owner = THIS_MODULE, -+ .of_match_table = of_match_ptr(pcm1794a_of_match), -+ }, -+}; ++/ { ++ compatible = "brcm,bcm2708"; + -+module_platform_driver(pcm1794a_codec_driver); ++ fragment@0 { ++ target = <&i2s>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; + -+MODULE_DESCRIPTION("ASoC PCM1794A codec driver"); -+MODULE_AUTHOR("Florian Meier <florian.meier@koalo.de>"); -+MODULE_LICENSE("GPL v2"); - -From dbdeca565b0850da182d3bd0b3ed41f667ca8a45 Mon Sep 17 00:00:00 2001 -From: Daniel Matuschek <info@crazy-audio.com> -Date: Wed, 15 Jan 2014 21:41:23 +0100 -Subject: [PATCH 066/170] ASoC: wm8804: Implement MCLK configuration options, - add 32bit support WM8804 can run with PLL frequencies of 256xfs and 128xfs - for most sample rates. At 192kHz only 128xfs is supported. The existing - driver selects 128xfs automatically for some lower samples rates. By using an - additional mclk_div divider, it is now possible to control the behaviour. - This allows using 256xfs PLL frequency on all sample rates up to 96kHz. It - should allow lower jitter and better signal quality. The behavior has to be - controlled by the sound card driver, because some sample frequency share the - same setting. e.g. 192kHz and 96kHz use 24.576MHz master clock. The only - difference is the MCLK divider. - -This also added support for 32bit data. - -Signed-off-by: Daniel Matuschek <daniel@matuschek.net> ---- - sound/soc/codecs/wm8804.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/sound/soc/codecs/wm8804.c b/sound/soc/codecs/wm8804.c -index 8d91470..5795fb1 100644 ---- a/sound/soc/codecs/wm8804.c -+++ b/sound/soc/codecs/wm8804.c -@@ -304,6 +304,7 @@ static int wm8804_hw_params(struct snd_pcm_substream *substream, - blen = 0x1; - break; - case 24: -+ case 32: - blen = 0x2; - break; - default: -@@ -515,7 +516,7 @@ static const struct snd_soc_dai_ops wm8804_dai_ops = { - }; - - #define WM8804_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE | \ -- SNDRV_PCM_FMTBIT_S24_LE) -+ SNDRV_PCM_FMTBIT_S24_3LE | SNDRV_PCM_FMTBIT_S32_LE) - - #define WM8804_RATES (SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 | \ - SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_64000 | \ - -From 0c2e64d3eda229c2f52ce6ed9d0b1c1572dd9b19 Mon Sep 17 00:00:00 2001 -From: Daniel Matuschek <info@crazy-audio.com> -Date: Wed, 15 Jan 2014 21:42:08 +0100 -Subject: [PATCH 067/170] ASoC: BCM:Add support for HiFiBerry Digi. Driver is - based on the patched WM8804 driver. - -Signed-off-by: Daniel Matuschek <daniel@matuschek.net> - -Add a parameter to turn off SPDIF output if no audio is playing - -This patch adds the paramater auto_shutdown_output to the kernel module. -Default behaviour of the module is the same, but when auto_shutdown_output -is set to 1, the SPDIF oputput will shutdown if no stream is playing. - -bugfix for 32kHz sample rate, was missing - -HiFiBerry Digi: set SPDIF status bits for sample rate - -The HiFiBerry Digi driver did not signal the sample rate in the SPDIF status bits. -While this is optional, some DACs and receivers do not accept this signal. This patch -adds the sample rate bits in the SPDIF status block. ---- - sound/soc/bcm/Kconfig | 7 ++ - sound/soc/bcm/Makefile | 2 + - sound/soc/bcm/hifiberry_digi.c | 223 +++++++++++++++++++++++++++++++++++++++++ - 3 files changed, 232 insertions(+) - create mode 100644 sound/soc/bcm/hifiberry_digi.c - -diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig -index 900de22..a34aff2 100644 ---- a/sound/soc/bcm/Kconfig -+++ b/sound/soc/bcm/Kconfig -@@ -15,6 +15,13 @@ config SND_BCM2708_SOC_HIFIBERRY_DAC - help - Say Y or M if you want to add support for HifiBerry DAC. - -+config SND_BCM2708_SOC_HIFIBERRY_DIGI -+ tristate "Support for HifiBerry Digi" -+ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S -+ select SND_SOC_WM8804 -+ help -+ Say Y or M if you want to add support for HifiBerry Digi S/PDIF output board. ++ fragment@1 { ++ target = <&soc>; ++ __overlay__ { ++ pcm1794a-codec { ++ #sound-dai-cells = <0>; ++ compatible = "ti,pcm1794a"; ++ status = "okay"; ++ }; ++ }; ++ }; + - config SND_BCM2708_SOC_RPI_DAC - tristate "Support for RPi-DAC" - depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S -diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile -index 99c96b4..4d53c58 100644 ---- a/sound/soc/bcm/Makefile -+++ b/sound/soc/bcm/Makefile -@@ -5,7 +5,9 @@ obj-$(CONFIG_SND_BCM2835_SOC_I2S) += snd-soc-bcm2835-i2s.o - - # BCM2708 Machine Support - snd-soc-hifiberry-dac-objs := hifiberry_dac.o -+snd-soc-hifiberry-digi-objs := hifiberry_digi.o - snd-soc-rpi-dac-objs := rpi-dac.o - - obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o -+obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI) += snd-soc-hifiberry-digi.o - obj-$(CONFIG_SND_BCM2708_SOC_RPI_DAC) += snd-soc-rpi-dac.o -diff --git a/sound/soc/bcm/hifiberry_digi.c b/sound/soc/bcm/hifiberry_digi.c ++ fragment@2 { ++ target = <&sound>; ++ __overlay__ { ++ compatible = "rpi,rpi-dac"; ++ i2s-controller = <&i2s>; ++ status = "okay"; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/rpi-display-overlay.dts b/arch/arm/boot/dts/overlays/rpi-display-overlay.dts new file mode 100644 -index 0000000..80732b8 +index 0000000..d7e72ee --- /dev/null -+++ b/sound/soc/bcm/hifiberry_digi.c -@@ -0,0 +1,223 @@ ++++ b/arch/arm/boot/dts/overlays/rpi-display-overlay.dts +@@ -0,0 +1,89 @@ +/* -+ * ASoC Driver for HifiBerry Digi -+ * -+ * Author: Daniel Matuschek <info@crazy-audio.com> -+ * based on the HifiBerry DAC driver by Florian Meier <florian.meier@koalo.de> -+ * Copyright 2013 -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License -+ * version 2 as published by the Free Software Foundation. ++ * Device Tree overlay for rpi-display by Watterott + * -+ * This program is distributed in the hope that it will be useful, but -+ * WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * General Public License for more details. + */ + -+#include <linux/module.h> -+#include <linux/platform_device.h> -+ -+#include <sound/core.h> -+#include <sound/pcm.h> -+#include <sound/pcm_params.h> -+#include <sound/soc.h> -+#include <sound/jack.h> -+ -+#include "../codecs/wm8804.h" ++/dts-v1/; ++/plugin/; + -+static short int auto_shutdown_output = 0; -+module_param(auto_shutdown_output, short, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP); -+MODULE_PARM_DESC(auto_shutdown_output, "Shutdown SP/DIF output if playback is stopped"); ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; + ++ fragment@0 { ++ target = <&spi0>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; + -+static int samplerate=44100; ++ fragment@1 { ++ target = <&spidev0>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; + -+static int snd_rpi_hifiberry_digi_init(struct snd_soc_pcm_runtime *rtd) -+{ -+ struct snd_soc_codec *codec = rtd->codec; ++ fragment@2 { ++ target = <&spidev1>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; + -+ /* enable TX output */ -+ snd_soc_update_bits(codec, WM8804_PWRDN, 0x4, 0x0); ++ fragment@3 { ++ target = <&gpio>; ++ __overlay__ { ++ rpi_display_pins: rpi_display_pins { ++ brcm,pins = <18 23 24 25>; ++ brcm,function = <1 1 1 0>; /* out out out in */ ++ brcm,pull = <0 0 0 2>; /* - - - up */ ++ }; ++ }; ++ }; + -+ return 0; -+} ++ fragment@4 { ++ target = <&spi0>; ++ __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; + -+static int snd_rpi_hifiberry_digi_startup(struct snd_pcm_substream *substream) { -+ /* turn on digital output */ -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_codec *codec = rtd->codec; -+ snd_soc_update_bits(codec, WM8804_PWRDN, 0x3c, 0x00); -+ return 0; -+} ++ rpidisplay: rpi-display@0{ ++ compatible = "ilitek,ili9341"; ++ reg = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&rpi_display_pins>; + -+static void snd_rpi_hifiberry_digi_shutdown(struct snd_pcm_substream *substream) { -+ /* turn off output */ -+ if (auto_shutdown_output) { -+ /* turn off output */ -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_codec *codec = rtd->codec; -+ snd_soc_update_bits(codec, WM8804_PWRDN, 0x3c, 0x3c); -+ } -+} ++ spi-max-frequency = <32000000>; ++ rotate = <270>; ++ bgr; ++ fps = <30>; ++ buswidth = <8>; ++ reset-gpios = <&gpio 23 0>; ++ dc-gpios = <&gpio 24 0>; ++ led-gpios = <&gpio 18 1>; ++ debug = <0>; ++ }; + ++ rpidisplay_ts: rpi-display-ts@1 { ++ compatible = "ti,ads7846"; ++ reg = <1>; + -+static int snd_rpi_hifiberry_digi_hw_params(struct snd_pcm_substream *substream, -+ struct snd_pcm_hw_params *params) -+{ -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_dai *codec_dai = rtd->codec_dai; -+ struct snd_soc_codec *codec = rtd->codec; -+ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; ++ spi-max-frequency = <2000000>; ++ interrupts = <25 2>; /* high-to-low edge triggered */ ++ interrupt-parent = <&gpio>; ++ pendown-gpio = <&gpio 25 0>; ++ ti,x-plate-ohms = /bits/ 16 <60>; ++ ti,pressure-max = /bits/ 16 <255>; ++ }; ++ }; ++ }; ++ __overrides__ { ++ speed = <&rpidisplay>,"spi-max-frequency:0"; ++ rotate = <&rpidisplay>,"rotate:0"; ++ fps = <&rpidisplay>,"fps:0"; ++ debug = <&rpidisplay>,"debug:0"; ++ xohms = <&rpidisplay_ts>,"ti,x-plate-ohms;0"; ++ swapxy = <&rpidisplay_ts>,"ti,swap-xy?"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/rpi-ft5406-overlay.dts b/arch/arm/boot/dts/overlays/rpi-ft5406-overlay.dts +new file mode 100644 +index 0000000..2e53a17 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/rpi-ft5406-overlay.dts +@@ -0,0 +1,17 @@ ++/dts-v1/; ++/plugin/; + -+ int sysclk = 27000000; /* This is fixed on this board */ ++/ { ++ compatible = "brcm,bcm2708"; + -+ long mclk_freq=0; -+ int mclk_div=1; -+ int sampling_freq=1; ++ fragment@0 { ++ target-path = "/"; ++ __overlay__ { ++ rpi_ft5406: rpi_ft5406 { ++ compatible = "rpi,rpi-ft5406"; ++ firmware = <&firmware>; ++ status = "okay"; ++ }; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/rpi-proto-overlay.dts b/arch/arm/boot/dts/overlays/rpi-proto-overlay.dts +new file mode 100644 +index 0000000..8332d01 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/rpi-proto-overlay.dts +@@ -0,0 +1,39 @@ ++// Definitions for Rpi-Proto ++/dts-v1/; ++/plugin/; + -+ int ret; ++/ { ++ compatible = "brcm,bcm2708"; + -+ samplerate = params_rate(params); ++ fragment@0 { ++ target = <&i2s>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; + -+ if (samplerate<=96000) { -+ mclk_freq=samplerate*256; -+ mclk_div=WM8804_MCLKDIV_256FS; -+ } else { -+ mclk_freq=samplerate*128; -+ mclk_div=WM8804_MCLKDIV_128FS; -+ } -+ -+ switch (samplerate) { -+ case 32000: -+ sampling_freq=0x03; -+ break; -+ case 44100: -+ sampling_freq=0x00; -+ break; -+ case 48000: -+ sampling_freq=0x02; -+ break; -+ case 88200: -+ sampling_freq=0x08; -+ break; -+ case 96000: -+ sampling_freq=0x0a; -+ break; -+ case 176400: -+ sampling_freq=0x0c; -+ break; -+ case 192000: -+ sampling_freq=0x0e; -+ break; -+ default: -+ dev_err(codec->dev, -+ "Failed to set WM8804 SYSCLK, unsupported samplerate %d\n", -+ samplerate); -+ } ++ fragment@1 { ++ target = <&i2c1>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; + -+ snd_soc_dai_set_clkdiv(codec_dai, WM8804_MCLK_DIV, mclk_div); -+ snd_soc_dai_set_pll(codec_dai, 0, 0, sysclk, mclk_freq); ++ wm8731@1a { ++ #sound-dai-cells = <0>; ++ compatible = "wlf,wm8731"; ++ reg = <0x1a>; ++ status = "okay"; ++ }; ++ }; ++ }; + -+ ret = snd_soc_dai_set_sysclk(codec_dai, WM8804_TX_CLKSRC_PLL, -+ sysclk, SND_SOC_CLOCK_OUT); -+ if (ret < 0) { -+ dev_err(codec->dev, -+ "Failed to set WM8804 SYSCLK: %d\n", ret); -+ return ret; -+ } ++ fragment@2 { ++ target = <&sound>; ++ __overlay__ { ++ compatible = "rpi,rpi-proto"; ++ i2s-controller = <&i2s>; ++ status = "okay"; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/rpi-sense-overlay.dts b/arch/arm/boot/dts/overlays/rpi-sense-overlay.dts +new file mode 100644 +index 0000000..2715324 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/rpi-sense-overlay.dts +@@ -0,0 +1,47 @@ ++// rpi-sense HAT ++/dts-v1/; ++/plugin/; + -+ /* Enable TX output */ -+ snd_soc_update_bits(codec, WM8804_PWRDN, 0x4, 0x0); ++/ { ++ compatible = "brcm,bcm2708", "brcm,bcm2709"; + -+ /* Power on */ -+ snd_soc_update_bits(codec, WM8804_PWRDN, 0x9, 0); ++ fragment@0 { ++ target = <&i2c1>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; + -+ /* set sampling frequency status bits */ -+ snd_soc_update_bits(codec, WM8804_SPDTX4, 0x0f, sampling_freq); ++ rpi-sense@46 { ++ compatible = "rpi,rpi-sense"; ++ reg = <0x46>; ++ keys-int-gpios = <&gpio 23 1>; ++ status = "okay"; ++ }; + -+ return snd_soc_dai_set_bclk_ratio(cpu_dai,64); -+} ++ lsm9ds1-magn@1c { ++ compatible = "st,lsm9ds1-magn"; ++ reg = <0x1c>; ++ status = "okay"; ++ }; + -+/* machine stream operations */ -+static struct snd_soc_ops snd_rpi_hifiberry_digi_ops = { -+ .hw_params = snd_rpi_hifiberry_digi_hw_params, -+ .startup = snd_rpi_hifiberry_digi_startup, -+ .shutdown = snd_rpi_hifiberry_digi_shutdown, -+}; ++ lsm9ds1-accel6a { ++ compatible = "st,lsm9ds1-accel"; ++ reg = <0x6a>; ++ status = "okay"; ++ }; + -+static struct snd_soc_dai_link snd_rpi_hifiberry_digi_dai[] = { -+{ -+ .name = "HifiBerry Digi", -+ .stream_name = "HifiBerry Digi HiFi", -+ .cpu_dai_name = "bcm2708-i2s.0", -+ .codec_dai_name = "wm8804-spdif", -+ .platform_name = "bcm2708-i2s.0", -+ .codec_name = "wm8804.1-003b", -+ .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | -+ SND_SOC_DAIFMT_CBM_CFM, -+ .ops = &snd_rpi_hifiberry_digi_ops, -+ .init = snd_rpi_hifiberry_digi_init, -+}, -+}; ++ lps25h-press@5c { ++ compatible = "st,lps25h-press"; ++ reg = <0x5c>; ++ status = "okay"; ++ }; + -+/* audio machine driver */ -+static struct snd_soc_card snd_rpi_hifiberry_digi = { -+ .name = "snd_rpi_hifiberry_digi", -+ .dai_link = snd_rpi_hifiberry_digi_dai, -+ .num_links = ARRAY_SIZE(snd_rpi_hifiberry_digi_dai), ++ hts221-humid@5f { ++ compatible = "st,hts221-humid"; ++ reg = <0x5f>; ++ status = "okay"; ++ }; ++ }; ++ }; +}; +diff --git a/arch/arm/boot/dts/overlays/rra-digidac1-wm8741-audio-overlay.dts b/arch/arm/boot/dts/overlays/rra-digidac1-wm8741-audio-overlay.dts +new file mode 100644 +index 0000000..16b1247 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/rra-digidac1-wm8741-audio-overlay.dts +@@ -0,0 +1,81 @@ ++// Definitions for RRA DigiDAC1 Audio card ++/dts-v1/; ++/plugin/; + -+static int snd_rpi_hifiberry_digi_probe(struct platform_device *pdev) -+{ -+ int ret = 0; ++/ { ++ compatible = "brcm,bcm2708"; + -+ snd_rpi_hifiberry_digi.dev = &pdev->dev; ++ fragment@0 { ++ target-path = "/"; ++ __overlay__ { ++ aliases { ++ ldo0 = &ldo0; ++ ldo1 = &ldo1; ++ }; ++ }; ++ }; + -+ if (pdev->dev.of_node) { -+ struct device_node *i2s_node; -+ struct snd_soc_dai_link *dai = &snd_rpi_hifiberry_digi_dai[0]; -+ i2s_node = of_parse_phandle(pdev->dev.of_node, -+ "i2s-controller", 0); ++ fragment@1 { ++ target-path = "/soc"; ++ __overlay__ { + -+ if (i2s_node) { -+ dai->cpu_dai_name = NULL; -+ dai->cpu_of_node = i2s_node; -+ dai->platform_name = NULL; -+ dai->platform_of_node = i2s_node; -+ } -+ } ++ ldo1: ldo1 { ++ compatible = "regulator-fixed"; ++ regulator-name = "DC_5V"; ++ regulator-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; ++ regulator-always-on; ++ }; + -+ ret = snd_soc_register_card(&snd_rpi_hifiberry_digi); -+ if (ret) -+ dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", ret); ++ ldo0: ldo0 { ++ compatible = "regulator-fixed"; ++ regulator-name = "DC_3V3"; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ regulator-always-on; ++ }; ++ }; ++ }; + -+ return ret; -+} ++ fragment@2 { ++ target = <&i2s>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; + -+static int snd_rpi_hifiberry_digi_remove(struct platform_device *pdev) -+{ -+ return snd_soc_unregister_card(&snd_rpi_hifiberry_digi); -+} ++ fragment@3 { ++ target = <&i2c1>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; + -+static const struct of_device_id snd_rpi_hifiberry_digi_of_match[] = { -+ { .compatible = "hifiberry,hifiberry-digi", }, -+ {}, -+}; -+MODULE_DEVICE_TABLE(of, snd_rpi_hifiberry_digi_of_match); ++ wm8804@3b { ++ #sound-dai-cells = <0>; ++ compatible = "wlf,wm8804"; ++ reg = <0x3b>; ++ status = "okay"; ++ PVDD-supply = <&ldo0>; ++ DVDD-supply = <&ldo0>; ++ }; + -+static struct platform_driver snd_rpi_hifiberry_digi_driver = { -+ .driver = { -+ .name = "snd-hifiberry-digi", -+ .owner = THIS_MODULE, -+ .of_match_table = snd_rpi_hifiberry_digi_of_match, -+ }, -+ .probe = snd_rpi_hifiberry_digi_probe, -+ .remove = snd_rpi_hifiberry_digi_remove, ++ wm8742: wm8741@1a { ++ compatible = "wlf,wm8741"; ++ reg = <0x1a>; ++ status = "okay"; ++ AVDD-supply = <&ldo1>; ++ DVDD-supply = <&ldo0>; ++ }; ++ }; ++ }; ++ ++ fragment@4 { ++ target = <&sound>; ++ __overlay__ { ++ compatible = "rra,digidac1-soundcard"; ++ i2s-controller = <&i2s>; ++ status = "okay"; ++ }; ++ }; +}; +diff --git a/arch/arm/boot/dts/overlays/sdhost-overlay.dts b/arch/arm/boot/dts/overlays/sdhost-overlay.dts +new file mode 100644 +index 0000000..a431177 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/sdhost-overlay.dts +@@ -0,0 +1,32 @@ ++/dts-v1/; ++/plugin/; + -+module_platform_driver(snd_rpi_hifiberry_digi_driver); ++/* Provide backwards compatible aliases for the old sdhost dtparams. */ + -+MODULE_AUTHOR("Daniel Matuschek <info@crazy-audio.com>"); -+MODULE_DESCRIPTION("ASoC Driver for HifiBerry Digi"); -+MODULE_LICENSE("GPL v2"); - -From f2789622ff7c1297e28f38bb198f5fd24b4602ef Mon Sep 17 00:00:00 2001 -From: Daniel Matuschek <info@crazy-audio.com> -Date: Thu, 16 Jan 2014 07:36:35 +0100 -Subject: [PATCH 068/170] ASoC: wm8804: Set idle_bias_off to false Idle bias - has been change to remove warning on driver startup - -Signed-off-by: Daniel Matuschek <daniel@matuschek.net> ---- - sound/soc/codecs/wm8804.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/sound/soc/codecs/wm8804.c b/sound/soc/codecs/wm8804.c -index 5795fb1..c846716 100644 ---- a/sound/soc/codecs/wm8804.c -+++ b/sound/soc/codecs/wm8804.c -@@ -544,7 +544,7 @@ static struct snd_soc_dai_driver wm8804_dai = { - }; - - static const struct snd_soc_codec_driver soc_codec_dev_wm8804 = { -- .idle_bias_off = true, -+ .idle_bias_off = false, - - .dapm_widgets = wm8804_dapm_widgets, - .num_dapm_widgets = ARRAY_SIZE(wm8804_dapm_widgets), - -From 80fa31f923b4967bc86be20c5af780ef284fc972 Mon Sep 17 00:00:00 2001 -From: Gordon Garrity <gordon@iqaudio.com> -Date: Sat, 8 Mar 2014 16:56:57 +0000 -Subject: [PATCH 069/170] Add IQaudIO Sound Card support for Raspberry Pi - -Set a limit of 0dB on Digital Volume Control - -The main volume control in the PCM512x DAC has a range up to -+24dB. This is dangerously loud and can potentially cause massive -clipping in the output stages. Therefore this sets a sensible -limit of 0dB for this control. ---- - sound/soc/bcm/Kconfig | 7 +++ - sound/soc/bcm/Makefile | 2 + - sound/soc/bcm/iqaudio-dac.c | 132 ++++++++++++++++++++++++++++++++++++++++++++ - 3 files changed, 141 insertions(+) - create mode 100644 sound/soc/bcm/iqaudio-dac.c - -diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig -index a34aff2..38dcdd9 100644 ---- a/sound/soc/bcm/Kconfig -+++ b/sound/soc/bcm/Kconfig -@@ -28,3 +28,10 @@ config SND_BCM2708_SOC_RPI_DAC - select SND_SOC_PCM1794A - help - Say Y or M if you want to add support for RPi-DAC. ++/{ ++ compatible = "brcm,bcm2708"; + -+config SND_BCM2708_SOC_IQAUDIO_DAC -+ tristate "Support for IQaudIO-DAC" -+ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S -+ select SND_SOC_PCM512x_I2C -+ help -+ Say Y or M if you want to add support for IQaudIO-DAC. -diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile -index 4d53c58..08e4dc5 100644 ---- a/sound/soc/bcm/Makefile -+++ b/sound/soc/bcm/Makefile -@@ -7,7 +7,9 @@ obj-$(CONFIG_SND_BCM2835_SOC_I2S) += snd-soc-bcm2835-i2s.o - snd-soc-hifiberry-dac-objs := hifiberry_dac.o - snd-soc-hifiberry-digi-objs := hifiberry_digi.o - snd-soc-rpi-dac-objs := rpi-dac.o -+snd-soc-iqaudio-dac-objs := iqaudio-dac.o - - obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o - obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI) += snd-soc-hifiberry-digi.o - obj-$(CONFIG_SND_BCM2708_SOC_RPI_DAC) += snd-soc-rpi-dac.o -+obj-$(CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC) += snd-soc-iqaudio-dac.o -diff --git a/sound/soc/bcm/iqaudio-dac.c b/sound/soc/bcm/iqaudio-dac.c ++ fragment@0 { ++ target = <&sdhost>; ++ frag0: __overlay__ { ++ brcm,overclock-50 = <0>; ++ brcm,pio-limit = <1>; ++ brcm,debug-flags = <0>; ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&mmc>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; ++ ++ __overrides__ { ++ overclock_50 = <&frag0>,"brcm,overclock-50:0"; ++ force_pio = <&frag0>,"brcm,force-pio?"; ++ pio_limit = <&frag0>,"brcm,pio-limit:0"; ++ debug = <&frag0>,"brcm,debug?"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/sdio-1bit-overlay.dts b/arch/arm/boot/dts/overlays/sdio-1bit-overlay.dts new file mode 100644 -index 0000000..37038d4 +index 0000000..46d4538 --- /dev/null -+++ b/sound/soc/bcm/iqaudio-dac.c -@@ -0,0 +1,132 @@ -+/* -+ * ASoC Driver for IQaudIO DAC -+ * -+ * Author: Florian Meier <florian.meier@koalo.de> -+ * Copyright 2013 -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License -+ * version 2 as published by the Free Software Foundation. -+ * -+ * This program is distributed in the hope that it will be useful, but -+ * WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * General Public License for more details. -+ */ ++++ b/arch/arm/boot/dts/overlays/sdio-1bit-overlay.dts +@@ -0,0 +1,36 @@ ++/* Enable 1-bit SDIO from MMC interface via GPIOs 22-25. Includes sdhost overlay. */ + -+#include <linux/module.h> -+#include <linux/platform_device.h> ++/include/ "sdhost-overlay.dts" + -+#include <sound/core.h> -+#include <sound/pcm.h> -+#include <sound/pcm_params.h> -+#include <sound/soc.h> -+#include <sound/jack.h> ++/{ ++ compatible = "brcm,bcm2708"; + -+static int snd_rpi_iqaudio_dac_init(struct snd_soc_pcm_runtime *rtd) -+{ -+ int ret; -+ struct snd_soc_card *card = rtd->card; ++ fragment@3 { ++ target = <&mmc>; ++ sdio_mmc: __overlay__ { ++ compatible = "brcm,bcm2835-mmc"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&sdio_pins>; ++ non-removable; ++ bus-width = <1>; ++ brcm,overclock-50 = <0>; ++ status = "okay"; ++ }; ++ }; + -+ ret = snd_soc_limit_volume(card, "Digital Playback Volume", 207); -+ if (ret < 0) -+ dev_warn(card->dev, "Failed to set volume limit: %d\n", ret); ++ fragment@4 { ++ target = <&gpio>; ++ __overlay__ { ++ sdio_pins: sdio_pins { ++ brcm,pins = <22 23 24 25>; ++ brcm,function = <7 7 7 7>; /* ALT3 = SD1 */ ++ brcm,pull = <0 2 2 2>; ++ }; ++ }; ++ }; + -+ return 0; -+} ++ __overrides__ { ++ poll_once = <&sdio_mmc>,"non-removable?"; ++ sdio_overclock = <&sdio_mmc>,"brcm,overclock-50:0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/sdio-overlay.dts b/arch/arm/boot/dts/overlays/sdio-overlay.dts +new file mode 100644 +index 0000000..398bd81 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/sdio-overlay.dts +@@ -0,0 +1,36 @@ ++/* Enable SDIO from MMC interface via GPIOs 22-27. Includes sdhost overlay. */ + -+static int snd_rpi_iqaudio_dac_hw_params(struct snd_pcm_substream *substream, -+ struct snd_pcm_hw_params *params) -+{ -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+// NOT USED struct snd_soc_dai *codec_dai = rtd->codec_dai; -+// NOT USED struct snd_soc_codec *codec = rtd->codec; -+ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; ++/include/ "sdhost-overlay.dts" + -+ unsigned int sample_bits = -+ snd_pcm_format_physical_width(params_format(params)); ++/{ ++ compatible = "brcm,bcm2708"; + -+ return snd_soc_dai_set_bclk_ratio(cpu_dai, sample_bits * 2); -+} ++ fragment@3 { ++ target = <&mmc>; ++ sdio_mmc: __overlay__ { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&sdio_pins>; ++ non-removable; ++ bus-width = <4>; ++ brcm,overclock-50 = <0>; ++ status = "okay"; ++ }; ++ }; + -+/* machine stream operations */ -+static struct snd_soc_ops snd_rpi_iqaudio_dac_ops = { -+ .hw_params = snd_rpi_iqaudio_dac_hw_params, -+}; ++ fragment@4 { ++ target = <&gpio>; ++ __overlay__ { ++ sdio_pins: sdio_pins { ++ brcm,pins = <22 23 24 25 26 27>; ++ brcm,function = <7 7 7 7 7 7>; /* ALT3 = SD1 */ ++ brcm,pull = <0 2 2 2 2 2>; ++ }; ++ }; ++ }; + -+static struct snd_soc_dai_link snd_rpi_iqaudio_dac_dai[] = { -+{ -+ .name = "IQaudIO DAC", -+ .stream_name = "IQaudIO DAC HiFi", -+ .cpu_dai_name = "bcm2708-i2s.0", -+ .codec_dai_name = "pcm512x-hifi", -+ .platform_name = "bcm2708-i2s.0", -+ .codec_name = "pcm512x.1-004c", -+ .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | -+ SND_SOC_DAIFMT_CBS_CFS, -+ .ops = &snd_rpi_iqaudio_dac_ops, -+ .init = snd_rpi_iqaudio_dac_init, -+}, ++ __overrides__ { ++ poll_once = <&sdio_mmc>,"non-removable?"; ++ bus_width = <&sdio_mmc>,"bus-width:0"; ++ sdio_overclock = <&sdio_mmc>,"brcm,overclock-50:0"; ++ }; +}; +diff --git a/arch/arm/boot/dts/overlays/sdtweak-overlay.dts b/arch/arm/boot/dts/overlays/sdtweak-overlay.dts +new file mode 100644 +index 0000000..e4a4677 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/sdtweak-overlay.dts +@@ -0,0 +1,23 @@ ++/dts-v1/; ++/plugin/; + -+/* audio machine driver */ -+static struct snd_soc_card snd_rpi_iqaudio_dac = { -+ .name = "IQaudIODAC", -+ .dai_link = snd_rpi_iqaudio_dac_dai, -+ .num_links = ARRAY_SIZE(snd_rpi_iqaudio_dac_dai), ++/* Provide backwards compatible aliases for the old sdhost dtparams. */ ++ ++/{ ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&sdhost>; ++ frag0: __overlay__ { ++ brcm,overclock-50 = <0>; ++ brcm,pio-limit = <1>; ++ }; ++ }; ++ ++ __overrides__ { ++ overclock_50 = <&frag0>,"brcm,overclock-50:0"; ++ force_pio = <&frag0>,"brcm,force-pio?"; ++ pio_limit = <&frag0>,"brcm,pio-limit:0"; ++ debug = <&frag0>,"brcm,debug?"; ++ }; +}; +diff --git a/arch/arm/boot/dts/overlays/smi-dev-overlay.dts b/arch/arm/boot/dts/overlays/smi-dev-overlay.dts +new file mode 100644 +index 0000000..b610d82 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/smi-dev-overlay.dts +@@ -0,0 +1,18 @@ ++// Description: Overlay to enable character device interface for SMI. ++// Author: Luke Wren <luke@raspberrypi.org> + -+static int snd_rpi_iqaudio_dac_probe(struct platform_device *pdev) -+{ -+ int ret = 0; ++/dts-v1/; ++/plugin/; + -+ snd_rpi_iqaudio_dac.dev = &pdev->dev; ++/{ ++ fragment@0 { ++ target = <&soc>; ++ __overlay__ { ++ smi_dev { ++ compatible = "brcm,bcm2835-smi-dev"; ++ smi_handle = <&smi>; ++ status = "okay"; ++ }; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/smi-nand-overlay.dts b/arch/arm/boot/dts/overlays/smi-nand-overlay.dts +new file mode 100644 +index 0000000..13ce0b7 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/smi-nand-overlay.dts +@@ -0,0 +1,69 @@ ++// Description: Overlay to enable NAND flash through ++// the secondary memory interface ++// Author: Luke Wren + -+ if (pdev->dev.of_node) { -+ struct device_node *i2s_node; -+ struct snd_soc_dai_link *dai = &snd_rpi_iqaudio_dac_dai[0]; -+ i2s_node = of_parse_phandle(pdev->dev.of_node, -+ "i2s-controller", 0); ++/dts-v1/; ++/plugin/; + -+ if (i2s_node) { -+ dai->cpu_dai_name = NULL; -+ dai->cpu_of_node = i2s_node; -+ dai->platform_name = NULL; -+ dai->platform_of_node = i2s_node; -+ } -+ } ++/{ ++ compatible = "brcm,bcm2708"; + -+ ret = snd_soc_register_card(&snd_rpi_iqaudio_dac); -+ if (ret) -+ dev_err(&pdev->dev, -+ "snd_soc_register_card() failed: %d\n", ret); ++ fragment@0 { ++ target = <&smi>; ++ __overlay__ { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&smi_pins>; ++ status = "okay"; ++ }; ++ }; + -+ return ret; -+} ++ fragment@1 { ++ target = <&soc>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <1>; + -+static int snd_rpi_iqaudio_dac_remove(struct platform_device *pdev) -+{ -+ return snd_soc_unregister_card(&snd_rpi_iqaudio_dac); -+} ++ nand: flash@0 { ++ compatible = "brcm,bcm2835-smi-nand"; ++ smi_handle = <&smi>; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ status = "okay"; + -+static const struct of_device_id iqaudio_of_match[] = { -+ { .compatible = "iqaudio,iqaudio-dac", }, -+ {}, -+}; -+MODULE_DEVICE_TABLE(of, iqaudio_of_match); ++ partition@0 { ++ label = "stage2"; ++ // 128k ++ reg = <0 0x20000>; ++ read-only; ++ }; ++ partition@1 { ++ label = "firmware"; ++ // 16M ++ reg = <0x20000 0x1000000>; ++ read-only; ++ }; ++ partition@2 { ++ label = "root"; ++ // 2G (will need to use 64 bit for >=4G) ++ reg = <0x1020000 0x80000000>; ++ }; ++ }; ++ }; ++ }; + -+static struct platform_driver snd_rpi_iqaudio_dac_driver = { -+ .driver = { -+ .name = "snd-rpi-iqaudio-dac", -+ .owner = THIS_MODULE, -+ .of_match_table = iqaudio_of_match, -+ }, -+ .probe = snd_rpi_iqaudio_dac_probe, -+ .remove = snd_rpi_iqaudio_dac_remove, ++ fragment@2 { ++ target = <&gpio>; ++ __overlay__ { ++ smi_pins: smi_pins { ++ brcm,pins = <0 1 2 3 4 5 6 7 8 9 10 11 ++ 12 13 14 15>; ++ /* Alt 1: SMI */ ++ brcm,function = <5 5 5 5 5 5 5 5 5 5 5 ++ 5 5 5 5 5>; ++ /* /CS, /WE and /OE are pulled high, as they are ++ generally active low signals */ ++ brcm,pull = <2 2 2 2 2 2 2 2 0 0 0 0 0 0 0 0>; ++ }; ++ }; ++ }; +}; +diff --git a/arch/arm/boot/dts/overlays/smi-overlay.dts b/arch/arm/boot/dts/overlays/smi-overlay.dts +new file mode 100644 +index 0000000..095f52c +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/smi-overlay.dts +@@ -0,0 +1,37 @@ ++// Description: Overlay to enable the secondary memory interface peripheral ++// Author: Luke Wren + -+module_platform_driver(snd_rpi_iqaudio_dac_driver); ++/dts-v1/; ++/plugin/; + -+MODULE_AUTHOR("Florian Meier <florian.meier@koalo.de>"); -+MODULE_DESCRIPTION("ASoC Driver for IQAudio DAC"); -+MODULE_LICENSE("GPL v2"); - -From b15f112ddaf2cd20a8f999ac823ddb51d7d513b9 Mon Sep 17 00:00:00 2001 -From: popcornmix <popcornmix@gmail.com> -Date: Mon, 14 Jul 2014 22:02:09 +0100 -Subject: [PATCH 070/170] hid: Reduce default mouse polling interval to 60Hz - -Reduces overhead when using X ---- - drivers/hid/usbhid/hid-core.c | 10 +++++++--- - 1 file changed, 7 insertions(+), 3 deletions(-) - -diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c -index 5dd426f..9ae0cd5 100644 ---- a/drivers/hid/usbhid/hid-core.c -+++ b/drivers/hid/usbhid/hid-core.c -@@ -49,7 +49,7 @@ - * Module parameters. - */ - --static unsigned int hid_mousepoll_interval; -+static unsigned int hid_mousepoll_interval = ~0; - module_param_named(mousepoll, hid_mousepoll_interval, uint, 0644); - MODULE_PARM_DESC(mousepoll, "Polling interval of mice"); - -@@ -1091,8 +1091,12 @@ static int usbhid_start(struct hid_device *hid) - } - - /* Change the polling interval of mice. */ -- if (hid->collection->usage == HID_GD_MOUSE && hid_mousepoll_interval > 0) -- interval = hid_mousepoll_interval; -+ if (hid->collection->usage == HID_GD_MOUSE) { -+ if (hid_mousepoll_interval == ~0 && interval < 16) -+ interval = 16; -+ else if (hid_mousepoll_interval != ~0 && hid_mousepoll_interval != 0) -+ interval = hid_mousepoll_interval; -+ } - - ret = -ENOMEM; - if (usb_endpoint_dir_in(endpoint)) { - -From debd3d30b1127328b5a1e444bd1550cb45c50362 Mon Sep 17 00:00:00 2001 -From: Daniel Matuschek <info@crazy-audio.com> -Date: Mon, 4 Aug 2014 10:06:56 +0200 -Subject: [PATCH 071/170] Added support for HiFiBerry DAC+ - -The driver is based on the HiFiBerry DAC driver. However HiFiBerry DAC+ uses -a different codec chip (PCM5122), therefore a new driver is necessary. ---- - sound/soc/bcm/Kconfig | 7 ++ - sound/soc/bcm/Makefile | 2 + - sound/soc/bcm/hifiberry_dacplus.c | 141 ++++++++++++++++++++++++++++++++++++++ - 3 files changed, 150 insertions(+) - create mode 100644 sound/soc/bcm/hifiberry_dacplus.c - -diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig -index 38dcdd9..8c338b5 100644 ---- a/sound/soc/bcm/Kconfig -+++ b/sound/soc/bcm/Kconfig -@@ -15,6 +15,13 @@ config SND_BCM2708_SOC_HIFIBERRY_DAC - help - Say Y or M if you want to add support for HifiBerry DAC. - -+config SND_BCM2708_SOC_HIFIBERRY_DACPLUS -+ tristate "Support for HifiBerry DAC+" -+ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S -+ select SND_SOC_PCM512x -+ help -+ Say Y or M if you want to add support for HifiBerry DAC+. ++/{ ++ compatible = "brcm,bcm2708"; + - config SND_BCM2708_SOC_HIFIBERRY_DIGI - tristate "Support for HifiBerry Digi" - depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S -diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile -index 08e4dc5..a29538e 100644 ---- a/sound/soc/bcm/Makefile -+++ b/sound/soc/bcm/Makefile -@@ -5,11 +5,13 @@ obj-$(CONFIG_SND_BCM2835_SOC_I2S) += snd-soc-bcm2835-i2s.o - - # BCM2708 Machine Support - snd-soc-hifiberry-dac-objs := hifiberry_dac.o -+snd-soc-hifiberry-dacplus-objs := hifiberry_dacplus.o - snd-soc-hifiberry-digi-objs := hifiberry_digi.o - snd-soc-rpi-dac-objs := rpi-dac.o - snd-soc-iqaudio-dac-objs := iqaudio-dac.o - - obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o -+obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS) += snd-soc-hifiberry-dacplus.o - obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI) += snd-soc-hifiberry-digi.o - obj-$(CONFIG_SND_BCM2708_SOC_RPI_DAC) += snd-soc-rpi-dac.o - obj-$(CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC) += snd-soc-iqaudio-dac.o -diff --git a/sound/soc/bcm/hifiberry_dacplus.c b/sound/soc/bcm/hifiberry_dacplus.c ++ fragment@0 { ++ target = <&smi>; ++ __overlay__ { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&smi_pins>; ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ smi_pins: smi_pins { ++ /* Don't configure the top two address bits, as ++ these are already used as ID_SD and ID_SC */ ++ brcm,pins = <2 3 4 5 6 7 8 9 10 11 12 13 14 15 ++ 16 17 18 19 20 21 22 23 24 25>; ++ /* Alt 0: SMI */ ++ brcm,function = <5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 ++ 5 5 5 5 5 5 5 5 5>; ++ /* /CS, /WE and /OE are pulled high, as they are ++ generally active low signals */ ++ brcm,pull = <2 2 2 2 2 2 0 0 0 0 0 0 0 0 0 0 0 ++ 0 0 0 0 0 0 0>; ++ }; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/spi-gpio35-39-overlay.dts b/arch/arm/boot/dts/overlays/spi-gpio35-39-overlay.dts new file mode 100644 -index 0000000..11e4f39 +index 0000000..9648063 --- /dev/null -+++ b/sound/soc/bcm/hifiberry_dacplus.c -@@ -0,0 +1,141 @@ ++++ b/arch/arm/boot/dts/overlays/spi-gpio35-39-overlay.dts +@@ -0,0 +1,31 @@ +/* -+ * ASoC Driver for HiFiBerry DAC+ -+ * -+ * Author: Daniel Matuschek -+ * Copyright 2014 -+ * based on code by Florian Meier <florian.meier@koalo.de> -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License -+ * version 2 as published by the Free Software Foundation. -+ * -+ * This program is distributed in the hope that it will be useful, but -+ * WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * General Public License for more details. ++ * Device tree overlay to move spi0 to gpio 35 to 39 on CM + */ + -+#include <linux/module.h> -+#include <linux/platform_device.h> ++/dts-v1/; ++/plugin/; + -+#include <sound/core.h> -+#include <sound/pcm.h> -+#include <sound/pcm_params.h> -+#include <sound/soc.h> -+#include <sound/jack.h> ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2836", "brcm,bcm2708", "brcm,bcm2709"; + -+#include "../codecs/pcm512x.h" ++ fragment@0 { ++ target = <&spi0>; ++ __overlay__ { ++ cs-gpios = <&gpio 36 1>, <&gpio 35 1>; ++ }; ++ }; + -+static int snd_rpi_hifiberry_dacplus_init(struct snd_soc_pcm_runtime *rtd) -+{ -+ struct snd_soc_codec *codec = rtd->codec; -+ snd_soc_update_bits(codec, PCM512x_GPIO_EN, 0x08, 0x08); -+ snd_soc_update_bits(codec, PCM512x_GPIO_OUTPUT_4, 0xf, 0x02); -+ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x08,0x08); -+ return 0; -+} ++ fragment@1 { ++ target = <&spi0_cs_pins>; ++ __overlay__ { ++ bcrm,pins = <36 35>; ++ }; ++ }; + -+static int snd_rpi_hifiberry_dacplus_hw_params(struct snd_pcm_substream *substream, -+ struct snd_pcm_hw_params *params) -+{ -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; -+ return snd_soc_dai_set_bclk_ratio(cpu_dai, 64); -+} ++ fragment@2 { ++ target = <&spi0_pins>; ++ __overlay__ { ++ bcrm,pins = <37 38 39>; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/spi1-1cs-overlay.dts b/arch/arm/boot/dts/overlays/spi1-1cs-overlay.dts +new file mode 100644 +index 0000000..71c2439 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/spi1-1cs-overlay.dts +@@ -0,0 +1,57 @@ ++/dts-v1/; ++/plugin/; + -+static int snd_rpi_hifiberry_dacplus_startup(struct snd_pcm_substream *substream) { -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_codec *codec = rtd->codec; -+ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x08,0x08); -+ return 0; -+} + -+static void snd_rpi_hifiberry_dacplus_shutdown(struct snd_pcm_substream *substream) { -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_codec *codec = rtd->codec; -+ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x08,0x00); -+} ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; + -+/* machine stream operations */ -+static struct snd_soc_ops snd_rpi_hifiberry_dacplus_ops = { -+ .hw_params = snd_rpi_hifiberry_dacplus_hw_params, -+ .startup = snd_rpi_hifiberry_dacplus_startup, -+ .shutdown = snd_rpi_hifiberry_dacplus_shutdown, -+}; ++ fragment@0 { ++ target = <&gpio>; ++ __overlay__ { ++ spi1_pins: spi1_pins { ++ brcm,pins = <19 20 21>; ++ brcm,function = <3>; /* alt4 */ ++ }; + -+static struct snd_soc_dai_link snd_rpi_hifiberry_dacplus_dai[] = { -+{ -+ .name = "HiFiBerry DAC+", -+ .stream_name = "HiFiBerry DAC+ HiFi", -+ .cpu_dai_name = "bcm2708-i2s.0", -+ .codec_dai_name = "pcm512x-hifi", -+ .platform_name = "bcm2708-i2s.0", -+ .codec_name = "pcm512x.1-004d", -+ .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | -+ SND_SOC_DAIFMT_CBS_CFS, -+ .ops = &snd_rpi_hifiberry_dacplus_ops, -+ .init = snd_rpi_hifiberry_dacplus_init, -+}, -+}; ++ spi1_cs_pins: spi1_cs_pins { ++ brcm,pins = <18>; ++ brcm,function = <1>; /* output */ ++ }; ++ }; ++ }; + -+/* audio machine driver */ -+static struct snd_soc_card snd_rpi_hifiberry_dacplus = { -+ .name = "snd_rpi_hifiberry_dacplus", -+ .dai_link = snd_rpi_hifiberry_dacplus_dai, -+ .num_links = ARRAY_SIZE(snd_rpi_hifiberry_dacplus_dai), -+}; ++ fragment@1 { ++ target = <&spi1>; ++ frag1: __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&spi1_pins &spi1_cs_pins>; ++ cs-gpios = <&gpio 18 1>; ++ status = "okay"; + -+static int snd_rpi_hifiberry_dacplus_probe(struct platform_device *pdev) -+{ -+ int ret = 0; ++ spidev1_0: spidev@0 { ++ compatible = "spidev"; ++ reg = <0>; /* CE0 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ status = "okay"; ++ }; ++ }; ++ }; + -+ snd_rpi_hifiberry_dacplus.dev = &pdev->dev; ++ fragment@2 { ++ target = <&aux>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; + -+ if (pdev->dev.of_node) { -+ struct device_node *i2s_node; -+ struct snd_soc_dai_link *dai = &snd_rpi_hifiberry_dacplus_dai[0]; -+ i2s_node = of_parse_phandle(pdev->dev.of_node, -+ "i2s-controller", 0); ++ __overrides__ { ++ cs0_pin = <&spi1_cs_pins>,"brcm,pins:0", ++ <&frag1>,"cs-gpios:4"; ++ cs0_spidev = <&spidev1_0>,"status"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/spi1-2cs-overlay.dts b/arch/arm/boot/dts/overlays/spi1-2cs-overlay.dts +new file mode 100644 +index 0000000..2ae0885 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/spi1-2cs-overlay.dts +@@ -0,0 +1,69 @@ ++/dts-v1/; ++/plugin/; + -+ if (i2s_node) { -+ dai->cpu_dai_name = NULL; -+ dai->cpu_of_node = i2s_node; -+ dai->platform_name = NULL; -+ dai->platform_of_node = i2s_node; -+ } -+ } + -+ ret = snd_soc_register_card(&snd_rpi_hifiberry_dacplus); -+ if (ret) -+ dev_err(&pdev->dev, -+ "snd_soc_register_card() failed: %d\n", ret); ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; + -+ return ret; -+} ++ fragment@0 { ++ target = <&gpio>; ++ __overlay__ { ++ spi1_pins: spi1_pins { ++ brcm,pins = <19 20 21>; ++ brcm,function = <3>; /* alt4 */ ++ }; + -+static int snd_rpi_hifiberry_dacplus_remove(struct platform_device *pdev) -+{ -+ return snd_soc_unregister_card(&snd_rpi_hifiberry_dacplus); -+} ++ spi1_cs_pins: spi1_cs_pins { ++ brcm,pins = <18 17>; ++ brcm,function = <1>; /* output */ ++ }; ++ }; ++ }; + -+static const struct of_device_id snd_rpi_hifiberry_dacplus_of_match[] = { -+ { .compatible = "hifiberry,hifiberry-dacplus", }, -+ {}, -+}; -+MODULE_DEVICE_TABLE(of, snd_rpi_hifiberry_dacplus_of_match); ++ fragment@1 { ++ target = <&spi1>; ++ frag1: __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&spi1_pins &spi1_cs_pins>; ++ cs-gpios = <&gpio 18 1>, <&gpio 17 1>; ++ status = "okay"; + -+static struct platform_driver snd_rpi_hifiberry_dacplus_driver = { -+ .driver = { -+ .name = "snd-rpi-hifiberry-dacplus", -+ .owner = THIS_MODULE, -+ .of_match_table = snd_rpi_hifiberry_dacplus_of_match, -+ }, -+ .probe = snd_rpi_hifiberry_dacplus_probe, -+ .remove = snd_rpi_hifiberry_dacplus_remove, -+}; ++ spidev1_0: spidev@0 { ++ compatible = "spidev"; ++ reg = <0>; /* CE0 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ status = "okay"; ++ }; + -+module_platform_driver(snd_rpi_hifiberry_dacplus_driver); ++ spidev1_1: spidev@1 { ++ compatible = "spidev"; ++ reg = <1>; /* CE1 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ status = "okay"; ++ }; ++ }; ++ }; + -+MODULE_AUTHOR("Daniel Matuschek <daniel@hifiberry.com>"); -+MODULE_DESCRIPTION("ASoC Driver for HiFiBerry DAC+"); -+MODULE_LICENSE("GPL v2"); - -From 9c6f0b1812313d39afeefd700b7f9df9a82a47cd Mon Sep 17 00:00:00 2001 -From: Daniel Matuschek <info@crazy-audio.com> -Date: Mon, 4 Aug 2014 11:09:58 +0200 -Subject: [PATCH 072/170] Added driver for HiFiBerry Amp amplifier add-on board - -The driver contains a low-level hardware driver for the TAS5713 and the -drivers for the Raspberry Pi I2S subsystem. - -TAS5713: return error if initialisation fails - -Existing TAS5713 driver logs errors during initialisation, but does not return -an error code. Therefore even if initialisation fails, the driver will still be -loaded, but won't work. This patch fixes this. I2C communication error will now -reported correctly by a non-zero return code. - -HiFiBerry Amp: fix device-tree problems - -Some code to load the driver based on device-tree-overlays was missing. This is added by this patch. ---- - sound/soc/bcm/Kconfig | 7 + - sound/soc/bcm/Makefile | 2 + - sound/soc/bcm/hifiberry_amp.c | 127 +++++++++++++++ - sound/soc/codecs/Kconfig | 4 + - sound/soc/codecs/Makefile | 2 + - sound/soc/codecs/tas5713.c | 369 ++++++++++++++++++++++++++++++++++++++++++ - sound/soc/codecs/tas5713.h | 210 ++++++++++++++++++++++++ - 7 files changed, 721 insertions(+) - create mode 100644 sound/soc/bcm/hifiberry_amp.c - create mode 100644 sound/soc/codecs/tas5713.c - create mode 100644 sound/soc/codecs/tas5713.h - -diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig -index 8c338b5..7677c89 100644 ---- a/sound/soc/bcm/Kconfig -+++ b/sound/soc/bcm/Kconfig -@@ -29,6 +29,13 @@ config SND_BCM2708_SOC_HIFIBERRY_DIGI - help - Say Y or M if you want to add support for HifiBerry Digi S/PDIF output board. - -+config SND_BCM2708_SOC_HIFIBERRY_AMP -+ tristate "Support for the HifiBerry Amp" -+ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S -+ select SND_SOC_TAS5713 -+ help -+ Say Y or M if you want to add support for the HifiBerry Amp amplifier board. ++ fragment@2 { ++ target = <&aux>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; + - config SND_BCM2708_SOC_RPI_DAC - tristate "Support for RPi-DAC" - depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S -diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile -index a29538e..30db495 100644 ---- a/sound/soc/bcm/Makefile -+++ b/sound/soc/bcm/Makefile -@@ -7,11 +7,13 @@ obj-$(CONFIG_SND_BCM2835_SOC_I2S) += snd-soc-bcm2835-i2s.o - snd-soc-hifiberry-dac-objs := hifiberry_dac.o - snd-soc-hifiberry-dacplus-objs := hifiberry_dacplus.o - snd-soc-hifiberry-digi-objs := hifiberry_digi.o -+snd-soc-hifiberry-amp-objs := hifiberry_amp.o - snd-soc-rpi-dac-objs := rpi-dac.o - snd-soc-iqaudio-dac-objs := iqaudio-dac.o - - obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o - obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS) += snd-soc-hifiberry-dacplus.o - obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI) += snd-soc-hifiberry-digi.o -+obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_AMP) += snd-soc-hifiberry-amp.o - obj-$(CONFIG_SND_BCM2708_SOC_RPI_DAC) += snd-soc-rpi-dac.o - obj-$(CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC) += snd-soc-iqaudio-dac.o -diff --git a/sound/soc/bcm/hifiberry_amp.c b/sound/soc/bcm/hifiberry_amp.c ++ __overrides__ { ++ cs0_pin = <&spi1_cs_pins>,"brcm,pins:0", ++ <&frag1>,"cs-gpios:4"; ++ cs1_pin = <&spi1_cs_pins>,"brcm,pins:4", ++ <&frag1>,"cs-gpios:16"; ++ cs0_spidev = <&spidev1_0>,"status"; ++ cs1_spidev = <&spidev1_1>,"status"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/spi1-3cs-overlay.dts b/arch/arm/boot/dts/overlays/spi1-3cs-overlay.dts new file mode 100644 -index 0000000..5903915 +index 0000000..8f79044 --- /dev/null -+++ b/sound/soc/bcm/hifiberry_amp.c -@@ -0,0 +1,127 @@ -+/* -+ * ASoC Driver for HifiBerry AMP -+ * -+ * Author: Sebastian Eickhoff <basti.eickhoff@googlemail.com> -+ * Copyright 2014 -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License -+ * version 2 as published by the Free Software Foundation. -+ * -+ * This program is distributed in the hope that it will be useful, but -+ * WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * General Public License for more details. -+ */ ++++ b/arch/arm/boot/dts/overlays/spi1-3cs-overlay.dts +@@ -0,0 +1,81 @@ ++/dts-v1/; ++/plugin/; + -+#include <linux/module.h> -+#include <linux/platform_device.h> + -+#include <sound/core.h> -+#include <sound/pcm.h> -+#include <sound/pcm_params.h> -+#include <sound/soc.h> -+#include <sound/jack.h> ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; + -+static int snd_rpi_hifiberry_amp_init(struct snd_soc_pcm_runtime *rtd) -+{ -+ // ToDo: init of the dsp-registers. -+ return 0; -+} ++ fragment@0 { ++ target = <&gpio>; ++ __overlay__ { ++ spi1_pins: spi1_pins { ++ brcm,pins = <19 20 21>; ++ brcm,function = <3>; /* alt4 */ ++ }; + -+static int snd_rpi_hifiberry_amp_hw_params( struct snd_pcm_substream *substream, -+ struct snd_pcm_hw_params *params ) -+{ -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; ++ spi1_cs_pins: spi1_cs_pins { ++ brcm,pins = <18 17 16>; ++ brcm,function = <1>; /* output */ ++ }; ++ }; ++ }; + -+ return snd_soc_dai_set_bclk_ratio(cpu_dai, 64); -+} ++ fragment@1 { ++ target = <&spi1>; ++ frag1: __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&spi1_pins &spi1_cs_pins>; ++ cs-gpios = <&gpio 18 1>, <&gpio 17 1>, <&gpio 16 1>; ++ status = "okay"; + -+static struct snd_soc_ops snd_rpi_hifiberry_amp_ops = { -+ .hw_params = snd_rpi_hifiberry_amp_hw_params, -+}; ++ spidev1_0: spidev@0 { ++ compatible = "spidev"; ++ reg = <0>; /* CE0 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ status = "okay"; ++ }; + -+static struct snd_soc_dai_link snd_rpi_hifiberry_amp_dai[] = { -+ { -+ .name = "HifiBerry AMP", -+ .stream_name = "HifiBerry AMP HiFi", -+ .cpu_dai_name = "bcm2708-i2s.0", -+ .codec_dai_name = "tas5713-hifi", -+ .platform_name = "bcm2708-i2s.0", -+ .codec_name = "tas5713.1-001b", -+ .dai_fmt = SND_SOC_DAIFMT_I2S | -+ SND_SOC_DAIFMT_NB_NF | -+ SND_SOC_DAIFMT_CBS_CFS, -+ .ops = &snd_rpi_hifiberry_amp_ops, -+ .init = snd_rpi_hifiberry_amp_init, -+ }, -+}; ++ spidev1_1: spidev@1 { ++ compatible = "spidev"; ++ reg = <1>; /* CE1 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ status = "okay"; ++ }; + ++ spidev1_2: spidev@2 { ++ compatible = "spidev"; ++ reg = <2>; /* CE2 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ status = "okay"; ++ }; ++ }; ++ }; + -+static struct snd_soc_card snd_rpi_hifiberry_amp = { -+ .name = "snd_rpi_hifiberry_amp", -+ .dai_link = snd_rpi_hifiberry_amp_dai, -+ .num_links = ARRAY_SIZE(snd_rpi_hifiberry_amp_dai), -+}; ++ fragment@2 { ++ target = <&aux>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; + -+static const struct of_device_id snd_rpi_hifiberry_amp_of_match[] = { -+ { .compatible = "hifiberry,hifiberry-amp", }, -+ {}, ++ __overrides__ { ++ cs0_pin = <&spi1_cs_pins>,"brcm,pins:0", ++ <&frag1>,"cs-gpios:4"; ++ cs1_pin = <&spi1_cs_pins>,"brcm,pins:4", ++ <&frag1>,"cs-gpios:16"; ++ cs2_pin = <&spi1_cs_pins>,"brcm,pins:8", ++ <&frag1>,"cs-gpios:28"; ++ cs0_spidev = <&spidev1_0>,"status"; ++ cs1_spidev = <&spidev1_1>,"status"; ++ cs2_spidev = <&spidev1_2>,"status"; ++ }; +}; -+MODULE_DEVICE_TABLE(of, snd_rpi_hifiberry_amp_of_match); +diff --git a/arch/arm/boot/dts/overlays/spi2-1cs-overlay.dts b/arch/arm/boot/dts/overlays/spi2-1cs-overlay.dts +new file mode 100644 +index 0000000..6f57bc7 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/spi2-1cs-overlay.dts +@@ -0,0 +1,57 @@ ++/dts-v1/; ++/plugin/; + + -+static int snd_rpi_hifiberry_amp_probe(struct platform_device *pdev) -+{ -+ int ret = 0; ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; + -+ snd_rpi_hifiberry_amp.dev = &pdev->dev; ++ fragment@0 { ++ target = <&gpio>; ++ __overlay__ { ++ spi2_pins: spi2_pins { ++ brcm,pins = <40 41 42>; ++ brcm,function = <3>; /* alt4 */ ++ }; + -+ if (pdev->dev.of_node) { -+ struct device_node *i2s_node; -+ struct snd_soc_dai_link *dai = &snd_rpi_hifiberry_amp_dai[0]; -+ i2s_node = of_parse_phandle(pdev->dev.of_node, -+ "i2s-controller", 0); ++ spi2_cs_pins: spi2_cs_pins { ++ brcm,pins = <43>; ++ brcm,function = <1>; /* output */ ++ }; ++ }; ++ }; + -+ if (i2s_node) { -+ dai->cpu_dai_name = NULL; -+ dai->cpu_of_node = i2s_node; -+ dai->platform_name = NULL; -+ dai->platform_of_node = i2s_node; -+ } -+ } ++ fragment@1 { ++ target = <&spi2>; ++ frag1: __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&spi2_pins &spi2_cs_pins>; ++ cs-gpios = <&gpio 43 1>; ++ status = "okay"; + -+ ret = snd_soc_register_card(&snd_rpi_hifiberry_amp); ++ spidev2_0: spidev@0 { ++ compatible = "spidev"; ++ reg = <0>; /* CE0 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ status = "okay"; ++ }; ++ }; ++ }; + -+ if (ret != 0) { -+ dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", ret); -+ } ++ fragment@2 { ++ target = <&aux>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; + -+ return ret; -+} ++ __overrides__ { ++ cs0_pin = <&spi2_cs_pins>,"brcm,pins:0", ++ <&frag1>,"cs-gpios:4"; ++ cs0_spidev = <&spidev2_0>,"status"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/spi2-2cs-overlay.dts b/arch/arm/boot/dts/overlays/spi2-2cs-overlay.dts +new file mode 100644 +index 0000000..d090631 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/spi2-2cs-overlay.dts +@@ -0,0 +1,69 @@ ++/dts-v1/; ++/plugin/; + + -+static int snd_rpi_hifiberry_amp_remove(struct platform_device *pdev) -+{ -+ return snd_soc_unregister_card(&snd_rpi_hifiberry_amp); -+} ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; + ++ fragment@0 { ++ target = <&gpio>; ++ __overlay__ { ++ spi2_pins: spi2_pins { ++ brcm,pins = <40 41 42>; ++ brcm,function = <3>; /* alt4 */ ++ }; + -+static struct platform_driver snd_rpi_hifiberry_amp_driver = { -+ .driver = { -+ .name = "snd-hifiberry-amp", -+ .owner = THIS_MODULE, -+ .of_match_table = snd_rpi_hifiberry_amp_of_match, -+ }, -+ .probe = snd_rpi_hifiberry_amp_probe, -+ .remove = snd_rpi_hifiberry_amp_remove, -+}; ++ spi2_cs_pins: spi2_cs_pins { ++ brcm,pins = <43 44>; ++ brcm,function = <1>; /* output */ ++ }; ++ }; ++ }; + ++ fragment@1 { ++ target = <&spi2>; ++ frag1: __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&spi2_pins &spi2_cs_pins>; ++ cs-gpios = <&gpio 43 1>, <&gpio 44 1>; ++ status = "okay"; + -+module_platform_driver(snd_rpi_hifiberry_amp_driver); ++ spidev2_0: spidev@0 { ++ compatible = "spidev"; ++ reg = <0>; /* CE0 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ status = "okay"; ++ }; + ++ spidev2_1: spidev@1 { ++ compatible = "spidev"; ++ reg = <1>; /* CE1 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ status = "okay"; ++ }; ++ }; ++ }; + -+MODULE_AUTHOR("Sebastian Eickhoff <basti.eickhoff@googlemail.com>"); -+MODULE_DESCRIPTION("ASoC driver for HiFiBerry-AMP"); -+MODULE_LICENSE("GPL v2"); -diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig -index b63f2fb..fe32cca 100644 ---- a/sound/soc/codecs/Kconfig -+++ b/sound/soc/codecs/Kconfig -@@ -117,6 +117,7 @@ config SND_SOC_ALL_CODECS - select SND_SOC_TFA9879 if I2C - select SND_SOC_TLV320AIC23_I2C if I2C - select SND_SOC_TLV320AIC23_SPI if SPI_MASTER -+ select SND_SOC_TAS5713 if I2C - select SND_SOC_TLV320AIC26 if SPI_MASTER - select SND_SOC_TLV320AIC31XX if I2C - select SND_SOC_TLV320AIC32X4 if I2C -@@ -674,6 +675,9 @@ config SND_SOC_TFA9879 - tristate "NXP Semiconductors TFA9879 amplifier" - depends on I2C - -+config SND_SOC_TAS5713 -+ tristate ++ fragment@2 { ++ target = <&aux>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; + - config SND_SOC_TLV320AIC23 - tristate - -diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile -index 2147436..dbb213d 100644 ---- a/sound/soc/codecs/Makefile -+++ b/sound/soc/codecs/Makefile -@@ -118,6 +118,7 @@ snd-soc-sti-sas-objs := sti-sas.o - snd-soc-tas5086-objs := tas5086.o - snd-soc-tas571x-objs := tas571x.o - snd-soc-tfa9879-objs := tfa9879.o -+snd-soc-tas5713-objs := tas5713.o - snd-soc-tlv320aic23-objs := tlv320aic23.o - snd-soc-tlv320aic23-i2c-objs := tlv320aic23-i2c.o - snd-soc-tlv320aic23-spi-objs := tlv320aic23-spi.o -@@ -312,6 +313,7 @@ obj-$(CONFIG_SND_SOC_TAS2552) += snd-soc-tas2552.o - obj-$(CONFIG_SND_SOC_TAS5086) += snd-soc-tas5086.o - obj-$(CONFIG_SND_SOC_TAS571X) += snd-soc-tas571x.o - obj-$(CONFIG_SND_SOC_TFA9879) += snd-soc-tfa9879.o -+obj-$(CONFIG_SND_SOC_TAS5713) += snd-soc-tas5713.o - obj-$(CONFIG_SND_SOC_TLV320AIC23) += snd-soc-tlv320aic23.o - obj-$(CONFIG_SND_SOC_TLV320AIC23_I2C) += snd-soc-tlv320aic23-i2c.o - obj-$(CONFIG_SND_SOC_TLV320AIC23_SPI) += snd-soc-tlv320aic23-spi.o -diff --git a/sound/soc/codecs/tas5713.c b/sound/soc/codecs/tas5713.c ++ __overrides__ { ++ cs0_pin = <&spi2_cs_pins>,"brcm,pins:0", ++ <&frag1>,"cs-gpios:4"; ++ cs1_pin = <&spi2_cs_pins>,"brcm,pins:4", ++ <&frag1>,"cs-gpios:16"; ++ cs0_spidev = <&spidev2_0>,"status"; ++ cs1_spidev = <&spidev2_1>,"status"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/spi2-3cs-overlay.dts b/arch/arm/boot/dts/overlays/spi2-3cs-overlay.dts new file mode 100644 -index 0000000..9b27138 +index 0000000..e258672 --- /dev/null -+++ b/sound/soc/codecs/tas5713.c -@@ -0,0 +1,369 @@ -+/* -+ * ASoC Driver for TAS5713 -+ * -+ * Author: Sebastian Eickhoff <basti.eickhoff@googlemail.com> -+ * Copyright 2014 -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License -+ * version 2 as published by the Free Software Foundation. -+ * -+ * This program is distributed in the hope that it will be useful, but -+ * WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * General Public License for more details. -+ */ -+ -+#include <linux/module.h> -+#include <linux/moduleparam.h> -+#include <linux/init.h> -+#include <linux/delay.h> -+#include <linux/pm.h> -+#include <linux/i2c.h> -+#include <linux/of_device.h> -+#include <linux/spi/spi.h> -+#include <linux/regmap.h> -+#include <linux/regulator/consumer.h> -+#include <linux/slab.h> -+#include <sound/core.h> -+#include <sound/pcm.h> -+#include <sound/pcm_params.h> -+#include <sound/soc.h> -+#include <sound/initval.h> -+#include <sound/tlv.h> ++++ b/arch/arm/boot/dts/overlays/spi2-3cs-overlay.dts +@@ -0,0 +1,81 @@ ++/dts-v1/; ++/plugin/; + -+#include <linux/kernel.h> -+#include <linux/string.h> -+#include <linux/fs.h> -+#include <asm/uaccess.h> + -+#include "tas5713.h" ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; + ++ fragment@0 { ++ target = <&gpio>; ++ __overlay__ { ++ spi2_pins: spi2_pins { ++ brcm,pins = <40 41 42>; ++ brcm,function = <3>; /* alt4 */ ++ }; + -+static struct i2c_client *i2c; ++ spi2_cs_pins: spi2_cs_pins { ++ brcm,pins = <43 44 45>; ++ brcm,function = <1>; /* output */ ++ }; ++ }; ++ }; + -+struct tas5713_priv { -+ struct regmap *regmap; -+ int mclk_div; -+ struct snd_soc_codec *codec; -+}; ++ fragment@1 { ++ target = <&spi2>; ++ frag1: __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&spi2_pins &spi2_cs_pins>; ++ cs-gpios = <&gpio 43 1>, <&gpio 44 1>, <&gpio 45 1>; ++ status = "okay"; + -+static struct tas5713_priv *priv_data; ++ spidev2_0: spidev@0 { ++ compatible = "spidev"; ++ reg = <0>; /* CE0 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ status = "okay"; ++ }; + ++ spidev2_1: spidev@1 { ++ compatible = "spidev"; ++ reg = <1>; /* CE1 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ status = "okay"; ++ }; + ++ spidev2_2: spidev@2 { ++ compatible = "spidev"; ++ reg = <2>; /* CE2 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ status = "okay"; ++ }; ++ }; ++ }; + ++ fragment@2 { ++ target = <&aux>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; + ++ __overrides__ { ++ cs0_pin = <&spi2_cs_pins>,"brcm,pins:0", ++ <&frag1>,"cs-gpios:4"; ++ cs1_pin = <&spi2_cs_pins>,"brcm,pins:4", ++ <&frag1>,"cs-gpios:16"; ++ cs2_pin = <&spi2_cs_pins>,"brcm,pins:8", ++ <&frag1>,"cs-gpios:28"; ++ cs0_spidev = <&spidev2_0>,"status"; ++ cs1_spidev = <&spidev2_1>,"status"; ++ cs2_spidev = <&spidev2_2>,"status"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/tinylcd35-overlay.dts b/arch/arm/boot/dts/overlays/tinylcd35-overlay.dts +new file mode 100644 +index 0000000..ed2b053 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/tinylcd35-overlay.dts +@@ -0,0 +1,224 @@ +/* -+ * _ _ ___ _ ___ _ _ -+ * /_\ | | / __| /_\ / __|___ _ _| |_ _ _ ___| |___ -+ * / _ \| |__\__ \/ _ \ | (__/ _ \ ' \ _| '_/ _ \ (_-< -+ * /_/ \_\____|___/_/ \_\ \___\___/_||_\__|_| \___/_/__/ ++ * tinylcd35-overlay.dts ++ * ++ * ------------------------------------------------- ++ * www.tinlylcd.com ++ * ------------------------------------------------- ++ * Device---Driver-----BUS GPIO's ++ * display tinylcd35 spi0.0 25 24 18 ++ * touch ads7846 spi0.1 5 ++ * rtc ds1307 i2c1-0068 ++ * rtc pcf8563 i2c1-0051 ++ * keypad gpio-keys --------- 17 22 27 23 28 ++ * ++ * ++ * TinyLCD.com 3.5 inch TFT ++ * ++ * Version 001 ++ * 5/3/2015 -- Noralf Trønnes Initial Device tree framework ++ * 10/3/2015 -- tinylcd@gmail.com added ds1307 support. + * + */ + -+static const DECLARE_TLV_DB_SCALE(tas5713_vol_tlv, -10000, 50, 1); ++/dts-v1/; ++/plugin/; + ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; + -+static const struct snd_kcontrol_new tas5713_snd_controls[] = { -+ SOC_SINGLE_TLV ("Master" , TAS5713_VOL_MASTER, 0, 248, 1, tas5713_vol_tlv), -+ SOC_DOUBLE_R_TLV("Channels" , TAS5713_VOL_CH1, TAS5713_VOL_CH2, 0, 248, 1, tas5713_vol_tlv) -+}; ++ fragment@0 { ++ target = <&spi0>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; + ++ fragment@1 { ++ target = <&spidev0>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; + ++ fragment@2 { ++ target = <&spidev1>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; + ++ fragment@3 { ++ target = <&gpio>; ++ __overlay__ { ++ tinylcd35_pins: tinylcd35_pins { ++ brcm,pins = <25 24 18>; ++ brcm,function = <1>; /* out */ ++ }; ++ tinylcd35_ts_pins: tinylcd35_ts_pins { ++ brcm,pins = <5>; ++ brcm,function = <0>; /* in */ ++ }; ++ keypad_pins: keypad_pins { ++ brcm,pins = <4 17 22 23 27>; ++ brcm,function = <0>; /* in */ ++ brcm,pull = <1>; /* down */ ++ }; ++ }; ++ }; + -+/* -+ * __ __ _ _ ___ _ -+ * | \/ |__ _ __| |_ (_)_ _ ___ | \ _ _(_)_ _____ _ _ -+ * | |\/| / _` / _| ' \| | ' \/ -_) | |) | '_| \ V / -_) '_| -+ * |_| |_\__,_\__|_||_|_|_||_\___| |___/|_| |_|\_/\___|_| -+ * -+ */ ++ fragment@4 { ++ target = <&spi0>; ++ __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; + -+static int tas5713_hw_params(struct snd_pcm_substream *substream, -+ struct snd_pcm_hw_params *params, -+ struct snd_soc_dai *dai) -+{ -+ u16 blen = 0x00; ++ tinylcd35: tinylcd35@0{ ++ compatible = "neosec,tinylcd"; ++ reg = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&tinylcd35_pins>, ++ <&tinylcd35_ts_pins>; + -+ struct snd_soc_codec *codec; -+ codec = dai->codec; -+ priv_data->codec = dai->codec; ++ spi-max-frequency = <48000000>; ++ rotate = <270>; ++ fps = <20>; ++ bgr; ++ buswidth = <8>; ++ reset-gpios = <&gpio 25 0>; ++ dc-gpios = <&gpio 24 0>; ++ led-gpios = <&gpio 18 1>; ++ debug = <0>; + -+ switch (params_format(params)) { -+ case SNDRV_PCM_FORMAT_S16_LE: -+ blen = 0x03; -+ break; -+ case SNDRV_PCM_FORMAT_S20_3LE: -+ blen = 0x1; -+ break; -+ case SNDRV_PCM_FORMAT_S24_LE: -+ blen = 0x04; -+ break; -+ case SNDRV_PCM_FORMAT_S32_LE: -+ blen = 0x05; -+ break; -+ default: -+ dev_err(dai->dev, "Unsupported word length: %u\n", -+ params_format(params)); -+ return -EINVAL; -+ } ++ init = <0x10000B0 0x80 ++ 0x10000C0 0x0A 0x0A ++ 0x10000C1 0x01 0x01 ++ 0x10000C2 0x33 ++ 0x10000C5 0x00 0x42 0x80 ++ 0x10000B1 0xD0 0x11 ++ 0x10000B4 0x02 ++ 0x10000B6 0x00 0x22 0x3B ++ 0x10000B7 0x07 ++ 0x1000036 0x58 ++ 0x10000F0 0x36 0xA5 0xD3 ++ 0x10000E5 0x80 ++ 0x10000E5 0x01 ++ 0x10000B3 0x00 ++ 0x10000E5 0x00 ++ 0x10000F0 0x36 0xA5 0x53 ++ 0x10000E0 0x00 0x35 0x33 0x00 0x00 0x00 0x00 0x35 0x33 0x00 0x00 0x00 ++ 0x100003A 0x55 ++ 0x1000011 ++ 0x2000001 ++ 0x1000029>; ++ }; + -+ // set word length -+ snd_soc_update_bits(codec, TAS5713_SERIAL_DATA_INTERFACE, 0x7, blen); ++ tinylcd35_ts: tinylcd35_ts@1 { ++ compatible = "ti,ads7846"; ++ reg = <1>; ++ status = "disabled"; + -+ return 0; -+} ++ spi-max-frequency = <2000000>; ++ interrupts = <5 2>; /* high-to-low edge triggered */ ++ interrupt-parent = <&gpio>; ++ pendown-gpio = <&gpio 5 0>; ++ ti,x-plate-ohms = /bits/ 16 <100>; ++ ti,pressure-max = /bits/ 16 <255>; ++ }; ++ }; ++ }; + ++ /* RTC */ + -+static int tas5713_mute_stream(struct snd_soc_dai *dai, int mute, int stream) -+{ -+ unsigned int val = 0; ++ fragment@5 { ++ target = <&i2c1>; ++ __dormant__ { ++ #address-cells = <1>; ++ #size-cells = <0>; + -+ struct tas5713_priv *tas5713; -+ struct snd_soc_codec *codec = dai->codec; -+ tas5713 = snd_soc_codec_get_drvdata(codec); ++ status = "okay"; + -+ if (mute) { -+ val = TAS5713_SOFT_MUTE_ALL; -+ } ++ pcf8563: pcf8563@51 { ++ compatible = "nxp,pcf8563"; ++ reg = <0x51>; ++ status = "okay"; ++ }; ++ }; ++ }; + -+ return regmap_write(tas5713->regmap, TAS5713_SOFT_MUTE, val); -+} ++ fragment@6 { ++ target = <&i2c1>; ++ __dormant__ { ++ #address-cells = <1>; ++ #size-cells = <0>; + ++ status = "okay"; + -+static const struct snd_soc_dai_ops tas5713_dai_ops = { -+ .hw_params = tas5713_hw_params, -+ .mute_stream = tas5713_mute_stream, -+}; ++ ds1307: ds1307@68 { ++ compatible = "maxim,ds1307"; ++ reg = <0x68>; ++ status = "okay"; ++ }; ++ }; ++ }; + ++ /* ++ * Values for input event code is found under the ++ * 'Keys and buttons' heading in include/uapi/linux/input.h ++ */ ++ fragment@7 { ++ target-path = "/soc"; ++ __overlay__ { ++ keypad: keypad { ++ compatible = "gpio-keys"; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&keypad_pins>; ++ status = "disabled"; ++ autorepeat; + -+static struct snd_soc_dai_driver tas5713_dai = { -+ .name = "tas5713-hifi", -+ .playback = { -+ .stream_name = "Playback", -+ .channels_min = 2, -+ .channels_max = 2, -+ .rates = SNDRV_PCM_RATE_8000_48000, -+ .formats = (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE ), -+ }, -+ .ops = &tas5713_dai_ops, ++ button@17 { ++ label = "GPIO KEY_UP"; ++ linux,code = <103>; ++ gpios = <&gpio 17 0>; ++ }; ++ button@22 { ++ label = "GPIO KEY_DOWN"; ++ linux,code = <108>; ++ gpios = <&gpio 22 0>; ++ }; ++ button@27 { ++ label = "GPIO KEY_LEFT"; ++ linux,code = <105>; ++ gpios = <&gpio 27 0>; ++ }; ++ button@23 { ++ label = "GPIO KEY_RIGHT"; ++ linux,code = <106>; ++ gpios = <&gpio 23 0>; ++ }; ++ button@4 { ++ label = "GPIO KEY_ENTER"; ++ linux,code = <28>; ++ gpios = <&gpio 4 0>; ++ }; ++ }; ++ }; ++ }; ++ ++ __overrides__ { ++ speed = <&tinylcd35>,"spi-max-frequency:0"; ++ rotate = <&tinylcd35>,"rotate:0"; ++ fps = <&tinylcd35>,"fps:0"; ++ debug = <&tinylcd35>,"debug:0"; ++ touch = <&tinylcd35_ts>,"status"; ++ touchgpio = <&tinylcd35_ts_pins>,"brcm,pins:0", ++ <&tinylcd35_ts>,"interrupts:0", ++ <&tinylcd35_ts>,"pendown-gpio:4"; ++ xohms = <&tinylcd35_ts>,"ti,x-plate-ohms;0"; ++ rtc-pcf = <0>,"=5"; ++ rtc-ds = <0>,"=6"; ++ keypad = <&keypad>,"status"; ++ }; +}; +diff --git a/arch/arm/boot/dts/overlays/uart1-overlay.dts b/arch/arm/boot/dts/overlays/uart1-overlay.dts +new file mode 100644 +index 0000000..fa73e1f +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/uart1-overlay.dts +@@ -0,0 +1,38 @@ ++/dts-v1/; ++/plugin/; ++ ++/{ ++ compatible = "brcm,bcm2708"; + ++ fragment@0 { ++ target = <&uart1>; ++ __overlay__ { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&uart1_pins>; ++ status = "okay"; ++ }; ++ }; + ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ uart1_pins: uart1_pins { ++ brcm,pins = <14 15>; ++ brcm,function = <2>; /* alt5 */ ++ brcm,pull = <0 2>; ++ }; ++ }; ++ }; + ++ fragment@2 { ++ target-path = "/chosen"; ++ __overlay__ { ++ bootargs = "8250.nr_uarts=1"; ++ }; ++ }; + ++ __overrides__ { ++ txd1_pin = <&uart1_pins>,"brcm,pins:0"; ++ rxd1_pin = <&uart1_pins>,"brcm,pins:4"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/vc4-kms-v3d-overlay.dts b/arch/arm/boot/dts/overlays/vc4-kms-v3d-overlay.dts +new file mode 100644 +index 0000000..a4ca2ca +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/vc4-kms-v3d-overlay.dts +@@ -0,0 +1,129 @@ +/* -+ * ___ _ ___ _ -+ * / __|___ __| |___ __ | \ _ _(_)_ _____ _ _ -+ * | (__/ _ \/ _` / -_) _| | |) | '_| \ V / -_) '_| -+ * \___\___/\__,_\___\__| |___/|_| |_|\_/\___|_| -+ * ++ * vc4-kms-v3d-overlay.dts + */ + -+static int tas5713_remove(struct snd_soc_codec *codec) -+{ -+ struct tas5713_priv *tas5713; -+ -+ tas5713 = snd_soc_codec_get_drvdata(codec); ++/dts-v1/; ++/plugin/; + -+ return 0; -+} ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; + ++ fragment@0 { ++ target-path = "/chosen"; ++ __overlay__ { ++ bootargs = "cma=256M@256M"; ++ }; ++ }; + -+static int tas5713_probe(struct snd_soc_codec *codec) -+{ -+ struct tas5713_priv *tas5713; -+ int i, ret; ++ fragment@1 { ++ target-path = "/chosen"; ++ __dormant__ { ++ bootargs = "cma=192M@256M"; ++ }; ++ }; + -+ i2c = container_of(codec->dev, struct i2c_client, dev); ++ fragment@2 { ++ target-path = "/chosen"; ++ __dormant__ { ++ bootargs = "cma=128M@128M"; ++ }; ++ }; + -+ tas5713 = snd_soc_codec_get_drvdata(codec); ++ fragment@3 { ++ target-path = "/chosen"; ++ __dormant__ { ++ bootargs = "cma=96M@128M"; ++ }; ++ }; + -+ // Reset error -+ ret = snd_soc_write(codec, TAS5713_ERROR_STATUS, 0x00); -+ if (ret < 0) return ret; ++ fragment@4 { ++ target-path = "/chosen"; ++ __dormant__ { ++ bootargs = "cma=64M@64M"; ++ }; ++ }; + -+ // Trim oscillator -+ ret = snd_soc_write(codec, TAS5713_OSC_TRIM, 0x00); -+ if (ret < 0) return ret; -+ msleep(1000); ++ fragment@5 { ++ target = <&i2c2>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; + -+ // Reset error -+ ret = snd_soc_write(codec, TAS5713_ERROR_STATUS, 0x00); -+ if (ret < 0) return ret; ++ fragment@6 { ++ target = <&cprman>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; + -+ // Clock mode: 44/48kHz, MCLK=64xfs -+ ret = snd_soc_write(codec, TAS5713_CLOCK_CTRL, 0x60); -+ if (ret < 0) return ret; ++ fragment@7 { ++ target = <&fb>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; + -+ // I2S 24bit -+ ret = snd_soc_write(codec, TAS5713_SERIAL_DATA_INTERFACE, 0x05); -+ if (ret < 0) return ret; ++ fragment@8 { ++ target = <&pixelvalve0>; ++ __overlay__ { ++ interrupts = <2 13>; /* pwa0 */ ++ status = "okay"; ++ }; ++ }; + -+ // Unmute -+ ret = snd_soc_write(codec, TAS5713_SYSTEM_CTRL2, 0x00); -+ if (ret < 0) return ret; -+ ret = snd_soc_write(codec, TAS5713_SOFT_MUTE, 0x00); -+ if (ret < 0) return ret; ++ fragment@9 { ++ target = <&pixelvalve1>; ++ __overlay__ { ++ interrupts = <2 14>; /* pwa1 */ ++ status = "okay"; ++ }; ++ }; + -+ // Set volume to 0db -+ ret = snd_soc_write(codec, TAS5713_VOL_MASTER, 0x00); -+ if (ret < 0) return ret; ++ fragment@10 { ++ target = <&pixelvalve2>; ++ __overlay__ { ++ interrupts = <2 10>; /* pixelvalve */ ++ status = "okay"; ++ }; ++ }; + -+ // Now start programming the default initialization sequence -+ for (i = 0; i < ARRAY_SIZE(tas5713_init_sequence); ++i) { -+ ret = i2c_master_send(i2c, -+ tas5713_init_sequence[i].data, -+ tas5713_init_sequence[i].size); -+ if (ret < 0) { -+ printk(KERN_INFO "TAS5713 CODEC PROBE: InitSeq returns: %d\n", ret); -+ } -+ } ++ fragment@11 { ++ target = <&hvs>; ++ __overlay__ { ++ interrupts = <2 1>; ++ status = "okay"; ++ }; ++ }; + -+ // Unmute -+ ret = snd_soc_write(codec, TAS5713_SYSTEM_CTRL2, 0x00); -+ if (ret < 0) return ret; ++ fragment@12 { ++ target = <&hdmi>; ++ __overlay__ { ++ interrupts = <2 8>, <2 9>; ++ status = "okay"; ++ }; ++ }; + -+ return 0; -+} ++ fragment@13 { ++ target = <&v3d>; ++ __overlay__ { ++ interrupts = <1 10>; ++ status = "okay"; ++ }; ++ }; + ++ fragment@14 { ++ target = <&gpu>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; + -+static struct snd_soc_codec_driver soc_codec_dev_tas5713 = { -+ .probe = tas5713_probe, -+ .remove = tas5713_remove, -+ .controls = tas5713_snd_controls, -+ .num_controls = ARRAY_SIZE(tas5713_snd_controls), ++ __overrides__ { ++ cma-256 = <0>,"+0-1-2-3-4"; ++ cma-192 = <0>,"-0+1-2-3-4"; ++ cma-128 = <0>,"-0-1+2-3-4"; ++ cma-96 = <0>,"-0-1-2+3-4"; ++ cma-64 = <0>,"-0-1-2-3+4"; ++ }; +}; +diff --git a/arch/arm/boot/dts/overlays/vga666-overlay.dts b/arch/arm/boot/dts/overlays/vga666-overlay.dts +new file mode 100644 +index 0000000..7fcab96 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/vga666-overlay.dts +@@ -0,0 +1,30 @@ ++/dts-v1/; ++/plugin/; + ++/{ ++ compatible = "brcm,bcm2708"; + ++ // There is no VGA driver module, but we need a platform device ++ // node (that doesn't already use pinctrl) to hang the pinctrl ++ // reference on - leds will do + ++ fragment@0 { ++ target = <&leds>; ++ __overlay__ { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&vga666_pins>; ++ }; ++ }; + -+/* -+ * ___ ___ ___ ___ _ -+ * |_ _|_ ) __| | \ _ _(_)_ _____ _ _ -+ * | | / / (__ | |) | '_| \ V / -_) '_| -+ * |___/___\___| |___/|_| |_|\_/\___|_| -+ * -+ */ -+ -+static const struct reg_default tas5713_reg_defaults[] = { -+ { 0x07 ,0x80 }, // R7 - VOL_MASTER - -40dB -+ { 0x08 , 30 }, // R8 - VOL_CH1 - 0dB -+ { 0x09 , 30 }, // R9 - VOL_CH2 - 0dB -+ { 0x0A ,0x80 }, // R10 - VOL_HEADPHONE - -40dB ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ vga666_pins: vga666_pins { ++ brcm,pins = <2 3 4 5 6 7 8 9 10 11 12 ++ 13 14 15 16 17 18 19 20 21>; ++ brcm,function = <6>; /* alt2 */ ++ brcm,pull = <0>; /* no pull */ ++ }; ++ }; ++ }; +}; +diff --git a/arch/arm/boot/dts/overlays/w1-gpio-overlay.dts b/arch/arm/boot/dts/overlays/w1-gpio-overlay.dts +new file mode 100644 +index 0000000..29a3b48 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/w1-gpio-overlay.dts +@@ -0,0 +1,39 @@ ++// Definitions for w1-gpio module (without external pullup) ++/dts-v1/; ++/plugin/; + ++/ { ++ compatible = "brcm,bcm2708"; + -+static bool tas5713_reg_volatile(struct device *dev, unsigned int reg) -+{ -+ switch (reg) { -+ case TAS5713_DEVICE_ID: -+ case TAS5713_ERROR_STATUS: -+ return true; -+ default: -+ return false; -+ } -+} -+ -+ -+static const struct of_device_id tas5713_of_match[] = { -+ { .compatible = "ti,tas5713", }, -+ { } -+}; -+MODULE_DEVICE_TABLE(of, tas5713_of_match); -+ ++ fragment@0 { ++ target-path = "/"; ++ __overlay__ { + -+static struct regmap_config tas5713_regmap_config = { -+ .reg_bits = 8, -+ .val_bits = 8, ++ w1: onewire@0 { ++ compatible = "w1-gpio"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&w1_pins>; ++ gpios = <&gpio 4 0>; ++ rpi,parasitic-power = <0>; ++ status = "okay"; ++ }; ++ }; ++ }; + -+ .max_register = TAS5713_MAX_REGISTER, -+ .volatile_reg = tas5713_reg_volatile, ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ w1_pins: w1_pins { ++ brcm,pins = <4>; ++ brcm,function = <0>; // in (initially) ++ brcm,pull = <0>; // off ++ }; ++ }; ++ }; + -+ .cache_type = REGCACHE_RBTREE, -+ .reg_defaults = tas5713_reg_defaults, -+ .num_reg_defaults = ARRAY_SIZE(tas5713_reg_defaults), ++ __overrides__ { ++ gpiopin = <&w1>,"gpios:4", ++ <&w1_pins>,"brcm,pins:0"; ++ pullup = <&w1>,"rpi,parasitic-power:0"; ++ }; +}; +diff --git a/arch/arm/boot/dts/overlays/w1-gpio-pullup-overlay.dts b/arch/arm/boot/dts/overlays/w1-gpio-pullup-overlay.dts +new file mode 100644 +index 0000000..66a98f6 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/w1-gpio-pullup-overlay.dts +@@ -0,0 +1,41 @@ ++// Definitions for w1-gpio module (with external pullup) ++/dts-v1/; ++/plugin/; + ++/ { ++ compatible = "brcm,bcm2708"; + -+static int tas5713_i2c_probe(struct i2c_client *i2c, -+ const struct i2c_device_id *id) -+{ -+ int ret; -+ -+ priv_data = devm_kzalloc(&i2c->dev, sizeof *priv_data, GFP_KERNEL); -+ if (!priv_data) -+ return -ENOMEM; -+ -+ priv_data->regmap = devm_regmap_init_i2c(i2c, &tas5713_regmap_config); -+ if (IS_ERR(priv_data->regmap)) { -+ ret = PTR_ERR(priv_data->regmap); -+ return ret; -+ } -+ -+ i2c_set_clientdata(i2c, priv_data); -+ -+ ret = snd_soc_register_codec(&i2c->dev, -+ &soc_codec_dev_tas5713, &tas5713_dai, 1); -+ -+ return ret; -+} -+ -+ -+static int tas5713_i2c_remove(struct i2c_client *i2c) -+{ -+ snd_soc_unregister_codec(&i2c->dev); -+ i2c_set_clientdata(i2c, NULL); -+ -+ kfree(priv_data); -+ -+ return 0; -+} -+ -+ -+static const struct i2c_device_id tas5713_i2c_id[] = { -+ { "tas5713", 0 }, -+ { } -+}; ++ fragment@0 { ++ target-path = "/"; ++ __overlay__ { + -+MODULE_DEVICE_TABLE(i2c, tas5713_i2c_id); ++ w1: onewire@0 { ++ compatible = "w1-gpio"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&w1_pins>; ++ gpios = <&gpio 4 0>, <&gpio 5 1>; ++ rpi,parasitic-power = <0>; ++ status = "okay"; ++ }; ++ }; ++ }; + ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ w1_pins: w1_pins { ++ brcm,pins = <4 5>; ++ brcm,function = <0 1>; // in out ++ brcm,pull = <0 0>; // off off ++ }; ++ }; ++ }; + -+static struct i2c_driver tas5713_i2c_driver = { -+ .driver = { -+ .name = "tas5713", -+ .owner = THIS_MODULE, -+ .of_match_table = tas5713_of_match, -+ }, -+ .probe = tas5713_i2c_probe, -+ .remove = tas5713_i2c_remove, -+ .id_table = tas5713_i2c_id ++ __overrides__ { ++ gpiopin = <&w1>,"gpios:4", ++ <&w1_pins>,"brcm,pins:0"; ++ extpullup = <&w1>,"gpios:16", ++ <&w1_pins>,"brcm,pins:4"; ++ pullup = <&w1>,"rpi,parasitic-power:0"; ++ }; +}; -+ -+ -+static int __init tas5713_modinit(void) -+{ -+ int ret = 0; -+ -+ ret = i2c_add_driver(&tas5713_i2c_driver); -+ if (ret) { -+ printk(KERN_ERR "Failed to register tas5713 I2C driver: %d\n", -+ ret); -+ } -+ -+ return ret; -+} -+module_init(tas5713_modinit); -+ -+ -+static void __exit tas5713_exit(void) -+{ -+ i2c_del_driver(&tas5713_i2c_driver); -+} -+module_exit(tas5713_exit); -+ -+ -+MODULE_AUTHOR("Sebastian Eickhoff <basti.eickhoff@googlemail.com>"); -+MODULE_DESCRIPTION("ASoC driver for TAS5713"); -+MODULE_LICENSE("GPL v2"); -diff --git a/sound/soc/codecs/tas5713.h b/sound/soc/codecs/tas5713.h +diff --git a/arch/arm/boot/dts/overlays/wittypi-overlay.dts b/arch/arm/boot/dts/overlays/wittypi-overlay.dts new file mode 100644 -index 0000000..8f019e0 +index 0000000..8498134 --- /dev/null -+++ b/sound/soc/codecs/tas5713.h -@@ -0,0 +1,210 @@ ++++ b/arch/arm/boot/dts/overlays/wittypi-overlay.dts +@@ -0,0 +1,44 @@ +/* -+ * ASoC Driver for TAS5713 -+ * -+ * Author: Sebastian Eickhoff <basti.eickhoff@googlemail.com> -+ * Copyright 2014 -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License -+ * version 2 as published by the Free Software Foundation. ++ * Device Tree overlay for Witty Pi extension board by UUGear + * -+ * This program is distributed in the hope that it will be useful, but -+ * WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * General Public License for more details. + */ + -+#ifndef _TAS5713_H -+#define _TAS5713_H -+ -+ -+// TAS5713 I2C-bus register addresses -+ -+#define TAS5713_CLOCK_CTRL 0x00 -+#define TAS5713_DEVICE_ID 0x01 -+#define TAS5713_ERROR_STATUS 0x02 -+#define TAS5713_SYSTEM_CTRL1 0x03 -+#define TAS5713_SERIAL_DATA_INTERFACE 0x04 -+#define TAS5713_SYSTEM_CTRL2 0x05 -+#define TAS5713_SOFT_MUTE 0x06 -+#define TAS5713_VOL_MASTER 0x07 -+#define TAS5713_VOL_CH1 0x08 -+#define TAS5713_VOL_CH2 0x09 -+#define TAS5713_VOL_HEADPHONE 0x0A -+#define TAS5713_VOL_CONFIG 0x0E -+#define TAS5713_MODULATION_LIMIT 0x10 -+#define TAS5713_IC_DLY_CH1 0x11 -+#define TAS5713_IC_DLY_CH2 0x12 -+#define TAS5713_IC_DLY_CH3 0x13 -+#define TAS5713_IC_DLY_CH4 0x14 -+ -+#define TAS5713_START_STOP_PERIOD 0x1A -+#define TAS5713_OSC_TRIM 0x1B -+#define TAS5713_BKND_ERR 0x1C -+ -+#define TAS5713_INPUT_MUX 0x20 -+#define TAS5713_SRC_SELECT_CH4 0x21 -+#define TAS5713_PWM_MUX 0x25 -+ -+#define TAS5713_CH1_BQ0 0x29 -+#define TAS5713_CH1_BQ1 0x2A -+#define TAS5713_CH1_BQ2 0x2B -+#define TAS5713_CH1_BQ3 0x2C -+#define TAS5713_CH1_BQ4 0x2D -+#define TAS5713_CH1_BQ5 0x2E -+#define TAS5713_CH1_BQ6 0x2F -+#define TAS5713_CH1_BQ7 0x58 -+#define TAS5713_CH1_BQ8 0x59 -+ -+#define TAS5713_CH2_BQ0 0x30 -+#define TAS5713_CH2_BQ1 0x31 -+#define TAS5713_CH2_BQ2 0x32 -+#define TAS5713_CH2_BQ3 0x33 -+#define TAS5713_CH2_BQ4 0x34 -+#define TAS5713_CH2_BQ5 0x35 -+#define TAS5713_CH2_BQ6 0x36 -+#define TAS5713_CH2_BQ7 0x5C -+#define TAS5713_CH2_BQ8 0x5D -+ -+#define TAS5713_CH4_BQ0 0x5A -+#define TAS5713_CH4_BQ1 0x5B -+#define TAS5713_CH3_BQ0 0x5E -+#define TAS5713_CH3_BQ1 0x5F -+ -+#define TAS5713_DRC1_SOFTENING_FILTER_ALPHA_OMEGA 0x3B -+#define TAS5713_DRC1_ATTACK_RELEASE_RATE 0x3C -+#define TAS5713_DRC2_SOFTENING_FILTER_ALPHA_OMEGA 0x3E -+#define TAS5713_DRC2_ATTACK_RELEASE_RATE 0x3F -+#define TAS5713_DRC1_ATTACK_RELEASE_THRES 0x40 -+#define TAS5713_DRC2_ATTACK_RELEASE_THRES 0x43 -+#define TAS5713_DRC_CTRL 0x46 -+ -+#define TAS5713_BANK_SW_CTRL 0x50 -+#define TAS5713_CH1_OUTPUT_MIXER 0x51 -+#define TAS5713_CH2_OUTPUT_MIXER 0x52 -+#define TAS5713_CH1_INPUT_MIXER 0x53 -+#define TAS5713_CH2_INPUT_MIXER 0x54 -+#define TAS5713_OUTPUT_POST_SCALE 0x56 -+#define TAS5713_OUTPUT_PRESCALE 0x57 -+ -+#define TAS5713_IDF_POST_SCALE 0x62 -+ -+#define TAS5713_CH1_INLINE_MIXER 0x70 -+#define TAS5713_CH1_INLINE_DRC_EN_MIXER 0x71 -+#define TAS5713_CH1_R_CHANNEL_MIXER 0x72 -+#define TAS5713_CH1_L_CHANNEL_MIXER 0x73 -+#define TAS5713_CH2_INLINE_MIXER 0x74 -+#define TAS5713_CH2_INLINE_DRC_EN_MIXER 0x75 -+#define TAS5713_CH2_L_CHANNEL_MIXER 0x76 -+#define TAS5713_CH2_R_CHANNEL_MIXER 0x77 ++/dts-v1/; ++/plugin/; + -+#define TAS5713_UPDATE_DEV_ADDR_KEY 0xF8 -+#define TAS5713_UPDATE_DEV_ADDR_REG 0xF9 ++/ { + -+#define TAS5713_REGISTER_COUNT 0x46 -+#define TAS5713_MAX_REGISTER 0xF9 ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; + ++ fragment@0 { ++ target = <&leds>; ++ __overlay__ { ++ compatible = "gpio-leds"; ++ wittypi_led: wittypi_led { ++ label = "wittypi_led"; ++ linux,default-trigger = "default-on"; ++ gpios = <&gpio 17 0>; ++ }; ++ }; ++ }; + -+// Bitmasks for registers -+#define TAS5713_SOFT_MUTE_ALL 0x07 ++ fragment@1 { ++ target = <&i2c1>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; + ++ rtc: ds1337@68 { ++ compatible = "dallas,ds1337"; ++ reg = <0x68>; ++ wakeup-source; ++ }; ++ }; ++ }; + ++ __overrides__ { ++ led_gpio = <&wittypi_led>,"gpios:4"; ++ led_trigger = <&wittypi_led>,"linux,default-trigger"; ++ }; + -+struct tas5713_init_command { -+ const int size; -+ const char *const data; +}; + +From 548bca82b6fa7a057e5db331334a25c80810dfc7 Mon Sep 17 00:00:00 2001 +From: Phil Elwell <phil@raspberrypi.org> +Date: Fri, 13 Mar 2015 20:00:21 +0000 +Subject: [PATCH 058/112] BCM270X_DT: Add a .dtbo target, use for overlays + +Change the filenames and extensions to keep the pre-DDT style of +overlay (<name>-overlay.dtb) distinct from new ones that use a +different style of local fixups (<name>.dtbo), and to match other +platforms. + +The RPi firmware uses the DDTK trailer atom to choose which type of +overlay to use for each kernel. + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> +--- + arch/arm/boot/.gitignore | 2 +- + scripts/Makefile.dtbinst | 10 +++++++--- + scripts/Makefile.lib | 10 ++++++++++ + 3 files changed, 18 insertions(+), 4 deletions(-) + +diff --git a/arch/arm/boot/.gitignore b/arch/arm/boot/.gitignore +index 3c79f85..eaaeb17 100644 +--- a/arch/arm/boot/.gitignore ++++ b/arch/arm/boot/.gitignore +@@ -3,4 +3,4 @@ zImage + xipImage + bootpImage + uImage +-*.dtb ++*.dtb* +diff --git a/scripts/Makefile.dtbinst b/scripts/Makefile.dtbinst +index a1be75d..ad8dc1c 100644 +--- a/scripts/Makefile.dtbinst ++++ b/scripts/Makefile.dtbinst +@@ -27,6 +27,7 @@ ifeq ("$(dtbinst-root)", "$(obj)") + endif + + dtbinst-files := $(dtb-y) ++dtboinst-files := $(dtbo-y) + dtbinst-dirs := $(dts-dirs) + + # Helper targets for Installing DTBs into the boot directory +@@ -35,15 +36,18 @@ quiet_cmd_dtb_install = INSTALL $< + + install-dir = $(patsubst $(dtbinst-root)%,$(INSTALL_DTBS_PATH)%,$(obj)) + +-$(dtbinst-files) $(dtbinst-dirs): | __dtbs_install_prep ++$(dtbinst-files) $(dtboinst-files) $(dtbinst-dirs): | __dtbs_install_prep + + $(dtbinst-files): %.dtb: $(obj)/%.dtb + $(call cmd,dtb_install,$(install-dir)) + ++$(dtboinst-files): %.dtbo: $(obj)/%.dtbo ++ $(call cmd,dtb_install,$(install-dir)) + -+static const struct tas5713_init_command tas5713_init_sequence[] = { -+ -+ // Trim oscillator -+ { .size = 2, .data = "\x1B\x00" }, -+ // System control register 1 (0x03): block DC -+ { .size = 2, .data = "\x03\x80" }, -+ // Mute everything -+ { .size = 2, .data = "\x05\x40" }, -+ // Modulation limit register (0x10): 97.7% -+ { .size = 2, .data = "\x10\x02" }, -+ // Interchannel delay registers -+ // (0x11, 0x12, 0x13, and 0x14): BD mode -+ { .size = 2, .data = "\x11\xB8" }, -+ { .size = 2, .data = "\x12\x60" }, -+ { .size = 2, .data = "\x13\xA0" }, -+ { .size = 2, .data = "\x14\x48" }, -+ // PWM shutdown group register (0x19): no shutdown -+ { .size = 2, .data = "\x19\x00" }, -+ // Input multiplexer register (0x20): BD mode -+ { .size = 2, .data = "\x20\x00\x89\x77\x72" }, -+ // PWM output mux register (0x25) -+ // Channel 1 --> OUTA, channel 1 neg --> OUTB -+ // Channel 2 --> OUTC, channel 2 neg --> OUTD -+ { .size = 5, .data = "\x25\x01\x02\x13\x45" }, -+ // DRC control (0x46): DRC off -+ { .size = 5, .data = "\x46\x00\x00\x00\x00" }, -+ // BKND_ERR register (0x1C): 299ms reset period -+ { .size = 2, .data = "\x1C\x07" }, -+ // Mute channel 3 -+ { .size = 2, .data = "\x0A\xFF" }, -+ // Volume configuration register (0x0E): volume slew 512 steps -+ { .size = 2, .data = "\x0E\x90" }, -+ // Clock control register (0x00): 44/48kHz, MCLK=64xfs -+ { .size = 2, .data = "\x00\x60" }, -+ // Bank switch and eq control (0x50): no bank switching -+ { .size = 5, .data = "\x50\x00\x00\x00\x00" }, -+ // Volume registers (0x07, 0x08, 0x09, 0x0A) -+ { .size = 2, .data = "\x07\x20" }, -+ { .size = 2, .data = "\x08\x30" }, -+ { .size = 2, .data = "\x09\x30" }, -+ { .size = 2, .data = "\x0A\xFF" }, -+ // 0x72, 0x73, 0x76, 0x77 input mixer: -+ // no intermix between channels -+ { .size = 5, .data = "\x72\x00\x00\x00\x00" }, -+ { .size = 5, .data = "\x73\x00\x80\x00\x00" }, -+ { .size = 5, .data = "\x76\x00\x00\x00\x00" }, -+ { .size = 5, .data = "\x77\x00\x80\x00\x00" }, -+ // 0x70, 0x71, 0x74, 0x75 inline DRC mixer: -+ // no inline DRC inmix -+ { .size = 5, .data = "\x70\x00\x80\x00\x00" }, -+ { .size = 5, .data = "\x71\x00\x00\x00\x00" }, -+ { .size = 5, .data = "\x74\x00\x80\x00\x00" }, -+ { .size = 5, .data = "\x75\x00\x00\x00\x00" }, -+ // 0x56, 0x57 Output scale -+ { .size = 5, .data = "\x56\x00\x80\x00\x00" }, -+ { .size = 5, .data = "\x57\x00\x02\x00\x00" }, -+ // 0x3B, 0x3c -+ { .size = 9, .data = "\x3B\x00\x08\x00\x00\x00\x78\x00\x00" }, -+ { .size = 9, .data = "\x3C\x00\x00\x01\x00\xFF\xFF\xFF\x00" }, -+ { .size = 9, .data = "\x3E\x00\x08\x00\x00\x00\x78\x00\x00" }, -+ { .size = 9, .data = "\x3F\x00\x00\x01\x00\xFF\xFF\xFF\x00" }, -+ { .size = 9, .data = "\x40\x00\x00\x01\x00\xFF\xFF\xFF\x00" }, -+ { .size = 9, .data = "\x43\x00\x00\x01\x00\xFF\xFF\xFF\x00" }, -+ // 0x51, 0x52: output mixer -+ { .size = 9, .data = "\x51\x00\x80\x00\x00\x00\x00\x00\x00" }, -+ { .size = 9, .data = "\x52\x00\x80\x00\x00\x00\x00\x00\x00" }, -+ // PEQ defaults -+ { .size = 21, .data = "\x29\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x2A\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x2B\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x2C\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x2D\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x2E\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x2F\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x30\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x31\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x32\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x33\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x34\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x35\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x36\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x58\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x59\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x5C\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x5D\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x5E\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x5F\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x5A\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x5B\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+}; + $(dtbinst-dirs): + $(Q)$(MAKE) $(dtbinst)=$(obj)/$@ + +-PHONY += $(dtbinst-files) $(dtbinst-dirs) +-__dtbs_install: $(dtbinst-files) $(dtbinst-dirs) ++PHONY += $(dtbinst-files) $(dtboinst-files) $(dtbinst-dirs) ++__dtbs_install: $(dtbinst-files) $(dtboinst-files) $(dtbinst-dirs) + + .PHONY: $(PHONY) +diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib +index ddf83d0..c819ddc 100644 +--- a/scripts/Makefile.lib ++++ b/scripts/Makefile.lib +@@ -306,6 +306,16 @@ cmd_dtc = mkdir -p $(dir ${dtc-tmp}) ; \ + $(obj)/%.dtb: $(src)/%.dts FORCE + $(call if_changed_dep,dtc) + ++quiet_cmd_dtco = DTCO $@ ++cmd_dtco = $(CPP) $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $< ; \ ++ $(objtree)/scripts/dtc/dtc -@ -O dtb -o $@ -b 0 \ ++ -i $(dir $<) $(DTC_FLAGS) \ ++ -d $(depfile).dtc.tmp $(dtc-tmp) ; \ ++ cat $(depfile).pre.tmp $(depfile).dtc.tmp > $(depfile) + ++$(obj)/%.dtbo: $(src)/%-overlay.dts FORCE ++ $(call if_changed_dep,dtco) + -+#endif /* _TAS5713_H */ + dtc-tmp = $(subst $(comma),_,$(dot-target).dts.tmp) + + # Bzip2 -From 21d08f232ffc350b2930f761f3da26f9867b1d4d Mon Sep 17 00:00:00 2001 -From: Ryan Coe <bluemrp9@gmail.com> -Date: Sat, 31 Jan 2015 18:25:49 -0700 -Subject: [PATCH 073/170] Update ds1307 driver for device-tree support +From cea163c683858d514cbdeac63a351a160c1ff4e6 Mon Sep 17 00:00:00 2001 +From: Phil Elwell <phil@raspberrypi.org> +Date: Fri, 8 Apr 2016 17:43:27 +0100 +Subject: [PATCH 059/112] BCM270X_DT: Don't generate "linux,phandle" props -Signed-off-by: Ryan Coe <bluemrp9@gmail.com> ---- - drivers/rtc/rtc-ds1307.c | 8 ++++++++ - 1 file changed, 8 insertions(+) +The EPAPR standard says to use "phandle" properties to store phandles, +rather than the deprecated "linux,phandle" version. By default, dtc +generates both, but adding "-H epapr" causes it to only generate +"phandle"s, saving some space and clutter. -diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c -index aa705bb..1cb13fee 100644 ---- a/drivers/rtc/rtc-ds1307.c -+++ b/drivers/rtc/rtc-ds1307.c -@@ -1207,6 +1207,14 @@ static int ds1307_remove(struct i2c_client *client) - return 0; - } - -+#ifdef CONFIG_OF -+static const struct of_device_id ds1307_of_match[] = { -+ { .compatible = "maxim,ds1307" }, -+ { } -+}; -+MODULE_DEVICE_TABLE(of, ds1307_of_match); -+#endif -+ - static struct i2c_driver ds1307_driver = { - .driver = { - .name = "rtc-ds1307", +Signed-off-by: Phil Elwell <phil@raspberrypi.org> +--- + scripts/Makefile.lib | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) -From a2b52a3af1314e2b691d9518afb3051193758671 Mon Sep 17 00:00:00 2001 +diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib +index c819ddc..b36099a 100644 +--- a/scripts/Makefile.lib ++++ b/scripts/Makefile.lib +@@ -308,7 +308,7 @@ $(obj)/%.dtb: $(src)/%.dts FORCE + + quiet_cmd_dtco = DTCO $@ + cmd_dtco = $(CPP) $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $< ; \ +- $(objtree)/scripts/dtc/dtc -@ -O dtb -o $@ -b 0 \ ++ $(objtree)/scripts/dtc/dtc -@ -H epapr -O dtb -o $@ -b 0 \ + -i $(dir $<) $(DTC_FLAGS) \ + -d $(depfile).dtc.tmp $(dtc-tmp) ; \ + cat $(depfile).pre.tmp $(depfile).dtc.tmp > $(depfile) + +From 273e251cd1f6808847b4f04d87a04048f549fb9d Mon Sep 17 00:00:00 2001 From: Phil Elwell <phil@raspberrypi.org> Date: Fri, 6 Feb 2015 13:50:57 +0000 -Subject: [PATCH 074/170] BCM270x_DT: Add pwr_led, and the required "input" +Subject: [PATCH 060/112] BCM270x_DT: Add pwr_led, and the required "input" trigger The "input" trigger makes the associated GPIO an input. This is to support @@ -117216,35 +121188,28 @@ See: https://github.com/raspberrypi/linux/issues/1064 create mode 100644 drivers/leds/trigger/ledtrig-input.c diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c -index 5db4515..685a8b5 100644 +index 61143f5..e98df59 100644 --- a/drivers/leds/leds-gpio.c +++ b/drivers/leds/leds-gpio.c -@@ -42,6 +42,13 @@ static void gpio_led_work(struct work_struct *work) - led_dat->platform_gpio_blink_set(led_dat->gpiod, - led_dat->new_level, NULL, NULL); +@@ -46,8 +46,15 @@ static void gpio_led_set(struct led_classdev *led_cdev, + led_dat->platform_gpio_blink_set(led_dat->gpiod, level, + NULL, NULL); led_dat->blinking = 0; + } else if (led_dat->cdev.flags & SET_GPIO_INPUT) { + gpiod_direction_input(led_dat->gpiod); + led_dat->cdev.flags &= ~SET_GPIO_INPUT; -+ } -+ else if (led_dat->cdev.flags & SET_GPIO_OUTPUT) { -+ gpiod_direction_output(led_dat->gpiod, led_dat->new_level); ++ } else if (led_dat->cdev.flags & SET_GPIO_OUTPUT) { ++ gpiod_direction_output(led_dat->gpiod, level); + led_dat->cdev.flags &= ~SET_GPIO_OUTPUT; - } else - gpiod_set_value_cansleep(led_dat->gpiod, led_dat->new_level); - } -@@ -62,7 +69,8 @@ static void gpio_led_set(struct led_classdev *led_cdev, - * seem to have a reliable way to know if we're already in one; so - * let's just assume the worst. - */ -- if (led_dat->can_sleep) { -+ if (led_dat->can_sleep || -+ (led_dat->cdev.flags & (SET_GPIO_INPUT | SET_GPIO_OUTPUT) )) { - led_dat->new_level = level; - schedule_work(&led_dat->work); } else { -@@ -75,6 +83,13 @@ static void gpio_led_set(struct led_classdev *led_cdev, - } +- if (led_dat->can_sleep) ++ if (led_dat->can_sleep || ++ (led_dat->cdev.flags & (SET_GPIO_INPUT | SET_GPIO_OUTPUT) )) + gpiod_set_value_cansleep(led_dat->gpiod, level); + else + gpiod_set_value(led_dat->gpiod, level); +@@ -61,6 +68,13 @@ static int gpio_led_set_blocking(struct led_classdev *led_cdev, + return 0; } +static enum led_brightness gpio_led_get(struct led_classdev *led_cdev) @@ -117257,10 +121222,11 @@ index 5db4515..685a8b5 100644 static int gpio_blink_set(struct led_classdev *led_cdev, unsigned long *delay_on, unsigned long *delay_off) { -@@ -131,6 +146,7 @@ static int create_gpio_led(const struct gpio_led *template, +@@ -120,6 +134,8 @@ static int create_gpio_led(const struct gpio_led *template, + led_dat->platform_gpio_blink_set = blink_set; led_dat->cdev.blink_set = gpio_blink_set; } - led_dat->cdev.brightness_set = gpio_led_set; ++ led_dat->cdev.brightness_set = gpio_led_set; + led_dat->cdev.brightness_get = gpio_led_get; if (template->default_state == LEDS_GPIO_DEFSTATE_KEEP) state = !!gpiod_get_value_cansleep(led_dat->gpiod); @@ -117292,7 +121258,7 @@ index 1abf48d..c03afdc 100644 +obj-$(CONFIG_LEDS_TRIGGER_INPUT) += ledtrig-input.o diff --git a/drivers/leds/trigger/ledtrig-input.c b/drivers/leds/trigger/ledtrig-input.c new file mode 100644 -index 0000000..07d1219 +index 0000000..27f8ebe --- /dev/null +++ b/drivers/leds/trigger/ledtrig-input.c @@ -0,0 +1,54 @@ @@ -117319,13 +121285,13 @@ index 0000000..07d1219 +static void input_trig_activate(struct led_classdev *led_cdev) +{ + led_cdev->flags |= SET_GPIO_INPUT; -+ led_set_brightness_async(led_cdev, 0); ++ led_set_brightness(led_cdev, 0); +} + +static void input_trig_deactivate(struct led_classdev *led_cdev) +{ + led_cdev->flags |= SET_GPIO_OUTPUT; -+ led_set_brightness_async(led_cdev, 0); ++ led_set_brightness(led_cdev, 0); +} + +static struct led_trigger input_led_trigger = { @@ -117351,32005 +121317,12958 @@ index 0000000..07d1219 +MODULE_DESCRIPTION("Set LED GPIO to Input \"trigger\""); +MODULE_LICENSE("GPL"); diff --git a/include/linux/leds.h b/include/linux/leds.h -index fa359c7..4b25a1a 100644 +index f203a8f..555cf15 100644 --- a/include/linux/leds.h +++ b/include/linux/leds.h -@@ -48,6 +48,9 @@ struct led_classdev { - #define SET_BRIGHTNESS_ASYNC (1 << 21) - #define SET_BRIGHTNESS_SYNC (1 << 22) +@@ -50,6 +50,9 @@ struct led_classdev { + #define LED_SYSFS_DISABLE (1 << 22) #define LED_DEV_CAP_FLASH (1 << 23) + #define LED_HW_PLUGGABLE (1 << 24) + /* Additions for Raspberry Pi PWR LED */ +#define SET_GPIO_INPUT (1 << 30) +#define SET_GPIO_OUTPUT (1 << 31) - /* Set LED brightness level */ - /* Must not sleep, use a workqueue if needed */ + /* Set LED brightness level + * Must not sleep. Use brightness_set_blocking for drivers -From 12ad9b7c670220b1b8b80ebf507651d106cb28c0 Mon Sep 17 00:00:00 2001 -From: Phil Elwell <phil@raspberrypi.org> -Date: Fri, 27 Feb 2015 15:10:24 +0000 -Subject: [PATCH 075/170] enc28j60: Add device tree compatible string and an - overlay +From ea3dfa01346c7b37d14b3b01b82d05fff57903bd Mon Sep 17 00:00:00 2001 +From: Siarhei Siamashka <siarhei.siamashka@gmail.com> +Date: Mon, 17 Jun 2013 13:32:11 +0300 +Subject: [PATCH 061/112] fbdev: add FBIOCOPYAREA ioctl + +Based on the patch authored by Ali Gholami Rudi at + https://lkml.org/lkml/2009/7/13/153 + +Provide an ioctl for userspace applications, but only if this operation +is hardware accelerated (otherwide it does not make any sense). +Signed-off-by: Siarhei Siamashka <siarhei.siamashka@gmail.com> --- - drivers/net/ethernet/microchip/enc28j60.c | 7 +++++++ - 1 file changed, 7 insertions(+) + drivers/video/fbdev/core/fbmem.c | 30 ++++++++++++++++++++++++++++++ + include/uapi/linux/fb.h | 5 +++++ + 2 files changed, 35 insertions(+) -diff --git a/drivers/net/ethernet/microchip/enc28j60.c b/drivers/net/ethernet/microchip/enc28j60.c -index 86ea17e..a1b20c1 100644 ---- a/drivers/net/ethernet/microchip/enc28j60.c -+++ b/drivers/net/ethernet/microchip/enc28j60.c -@@ -1630,9 +1630,16 @@ static int enc28j60_remove(struct spi_device *spi) - return 0; +diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c +index 4e73b6f..d3a8cc3 100644 +--- a/drivers/video/fbdev/core/fbmem.c ++++ b/drivers/video/fbdev/core/fbmem.c +@@ -1084,6 +1084,25 @@ fb_blank(struct fb_info *info, int blank) } + EXPORT_SYMBOL(fb_blank); -+static const struct of_device_id enc28j60_of_match[] = { -+ { .compatible = "microchip,enc28j60", }, -+ { /* sentinel */ } -+}; -+MODULE_DEVICE_TABLE(of, enc28j60_of_match); ++static int fb_copyarea_user(struct fb_info *info, ++ struct fb_copyarea *copy) ++{ ++ int ret = 0; ++ if (!lock_fb_info(info)) ++ return -ENODEV; ++ if (copy->dx + copy->width > info->var.xres || ++ copy->sx + copy->width > info->var.xres || ++ copy->dy + copy->height > info->var.yres || ++ copy->sy + copy->height > info->var.yres) { ++ ret = -EINVAL; ++ goto out; ++ } ++ info->fbops->fb_copyarea(info, copy); ++out: ++ unlock_fb_info(info); ++ return ret; ++} + - static struct spi_driver enc28j60_driver = { - .driver = { - .name = DRV_NAME, -+ .of_match_table = enc28j60_of_match, - }, - .probe = enc28j60_probe, - .remove = enc28j60_remove, + static long do_fb_ioctl(struct fb_info *info, unsigned int cmd, + unsigned long arg) + { +@@ -1094,6 +1113,7 @@ static long do_fb_ioctl(struct fb_info *info, unsigned int cmd, + struct fb_cmap cmap_from; + struct fb_cmap_user cmap; + struct fb_event event; ++ struct fb_copyarea copy; + void __user *argp = (void __user *)arg; + long ret = 0; + +@@ -1211,6 +1231,15 @@ static long do_fb_ioctl(struct fb_info *info, unsigned int cmd, + unlock_fb_info(info); + console_unlock(); + break; ++ case FBIOCOPYAREA: ++ if (info->flags & FBINFO_HWACCEL_COPYAREA) { ++ /* only provide this ioctl if it is accelerated */ ++ if (copy_from_user(&copy, argp, sizeof(copy))) ++ return -EFAULT; ++ ret = fb_copyarea_user(info, &copy); ++ break; ++ } ++ /* fall through */ + default: + if (!lock_fb_info(info)) + return -ENODEV; +@@ -1365,6 +1394,7 @@ static long fb_compat_ioctl(struct file *file, unsigned int cmd, + case FBIOPAN_DISPLAY: + case FBIOGET_CON2FBMAP: + case FBIOPUT_CON2FBMAP: ++ case FBIOCOPYAREA: + arg = (unsigned long) compat_ptr(arg); + case FBIOBLANK: + ret = do_fb_ioctl(info, cmd, arg); +diff --git a/include/uapi/linux/fb.h b/include/uapi/linux/fb.h +index fb795c3..fa72af0 100644 +--- a/include/uapi/linux/fb.h ++++ b/include/uapi/linux/fb.h +@@ -34,6 +34,11 @@ + #define FBIOPUT_MODEINFO 0x4617 + #define FBIOGET_DISPINFO 0x4618 + #define FBIO_WAITFORVSYNC _IOW('F', 0x20, __u32) ++/* ++ * HACK: use 'z' in order not to clash with any other ioctl numbers which might ++ * be concurrently added to the mainline kernel ++ */ ++#define FBIOCOPYAREA _IOW('z', 0x21, struct fb_copyarea) + + #define FB_TYPE_PACKED_PIXELS 0 /* Packed Pixels */ + #define FB_TYPE_PLANES 1 /* Non interleaved planes */ -From 660d2fba0483aafc4a1ce678016620c0871bb759 Mon Sep 17 00:00:00 2001 -From: Waldemar Brodkorb <wbrodkorb@conet.de> -Date: Wed, 25 Mar 2015 09:26:17 +0100 -Subject: [PATCH 076/170] Add driver for rpi-proto +From 3de9d9af98b49cd140532eee17196742d1d875c7 Mon Sep 17 00:00:00 2001 +From: Harm Hanemaaijer <fgenfb@yahoo.com> +Date: Thu, 20 Jun 2013 20:21:39 +0200 +Subject: [PATCH 062/112] Speed up console framebuffer imageblit function -Forward port of 3.10.x driver from https://github.com/koalo -We are using a custom board and would like to use rpi 3.18.x -kernel. Patch works fine for our embedded system. +Especially on platforms with a slower CPU but a relatively high +framebuffer fill bandwidth, like current ARM devices, the existing +console monochrome imageblit function used to draw console text is +suboptimal for common pixel depths such as 16bpp and 32bpp. The existing +code is quite general and can deal with several pixel depths. By creating +special case functions for 16bpp and 32bpp, by far the most common pixel +formats used on modern systems, a significant speed-up is attained +which can be readily felt on ARM-based devices like the Raspberry Pi +and the Allwinner platform, but should help any platform using the +fb layer. -URL to the audio chip: -http://www.mikroe.com/add-on-boards/audio-voice/audio-codec-proto/ +The special case functions allow constant folding, eliminating a number +of instructions including divide operations, and allow the use of an +unrolled loop, eliminating instructions with a variable shift size, +reducing source memory access instructions, and eliminating excessive +branching. These unrolled loops also allow much better code optimization +by the C compiler. The code that selects which optimized variant is used +is also simplified, eliminating integer divide instructions. -Playback tested with devicetree enabled. +The speed-up, measured by timing 'cat file.txt' in the console, varies +between 40% and 70%, when testing on the Raspberry Pi and Allwinner +ARM-based platforms, depending on font size and the pixel depth, with +the greater benefit for 32bpp. -Signed-off-by: Waldemar Brodkorb <wbrodkorb@conet.de> +Signed-off-by: Harm Hanemaaijer <fgenfb@yahoo.com> --- - sound/soc/bcm/Kconfig | 7 +++ - sound/soc/bcm/Makefile | 2 + - sound/soc/bcm/rpi-proto.c | 153 ++++++++++++++++++++++++++++++++++++++++++++++ - 3 files changed, 162 insertions(+) - create mode 100644 sound/soc/bcm/rpi-proto.c + drivers/video/fbdev/core/cfbimgblt.c | 152 +++++++++++++++++++++++++++++++++-- + 1 file changed, 147 insertions(+), 5 deletions(-) -diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig -index 7677c89..8669a9a 100644 ---- a/sound/soc/bcm/Kconfig -+++ b/sound/soc/bcm/Kconfig -@@ -43,6 +43,13 @@ config SND_BCM2708_SOC_RPI_DAC - help - Say Y or M if you want to add support for RPi-DAC. - -+config SND_BCM2708_SOC_RPI_PROTO -+ tristate "Support for Rpi-PROTO" -+ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S -+ select SND_SOC_WM8731 -+ help -+ Say Y or M if you want to add support for Audio Codec Board PROTO (WM8731). -+ - config SND_BCM2708_SOC_IQAUDIO_DAC - tristate "Support for IQaudIO-DAC" - depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S -diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile -index 30db495..4f5ab1f 100644 ---- a/sound/soc/bcm/Makefile -+++ b/sound/soc/bcm/Makefile -@@ -9,6 +9,7 @@ snd-soc-hifiberry-dacplus-objs := hifiberry_dacplus.o - snd-soc-hifiberry-digi-objs := hifiberry_digi.o - snd-soc-hifiberry-amp-objs := hifiberry_amp.o - snd-soc-rpi-dac-objs := rpi-dac.o -+snd-soc-rpi-proto-objs := rpi-proto.o - snd-soc-iqaudio-dac-objs := iqaudio-dac.o - - obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o -@@ -16,4 +17,5 @@ obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS) += snd-soc-hifiberry-dacplus.o - obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI) += snd-soc-hifiberry-digi.o - obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_AMP) += snd-soc-hifiberry-amp.o - obj-$(CONFIG_SND_BCM2708_SOC_RPI_DAC) += snd-soc-rpi-dac.o -+obj-$(CONFIG_SND_BCM2708_SOC_RPI_PROTO) += snd-soc-rpi-proto.o - obj-$(CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC) += snd-soc-iqaudio-dac.o -diff --git a/sound/soc/bcm/rpi-proto.c b/sound/soc/bcm/rpi-proto.c -new file mode 100644 -index 0000000..c6e45a0 ---- /dev/null -+++ b/sound/soc/bcm/rpi-proto.c -@@ -0,0 +1,153 @@ +diff --git a/drivers/video/fbdev/core/cfbimgblt.c b/drivers/video/fbdev/core/cfbimgblt.c +index a2bb276..436494f 100644 +--- a/drivers/video/fbdev/core/cfbimgblt.c ++++ b/drivers/video/fbdev/core/cfbimgblt.c +@@ -28,6 +28,11 @@ + * + * Also need to add code to deal with cards endians that are different than + * the native cpu endians. I also need to deal with MSB position in the word. ++ * Modified by Harm Hanemaaijer (fgenfb@yahoo.com) 2013: ++ * - Provide optimized versions of fast_imageblit for 16 and 32bpp that are ++ * significantly faster than the previous implementation. ++ * - Simplify the fast/slow_imageblit selection code, avoiding integer ++ * divides. + */ + #include <linux/module.h> + #include <linux/string.h> +@@ -262,6 +267,133 @@ static inline void fast_imageblit(const struct fb_image *image, struct fb_info * + } + } + +/* -+ * ASoC driver for PROTO AudioCODEC (with a WM8731) -+ * connected to a Raspberry Pi -+ * -+ * Author: Florian Meier, <koalo@koalo.de> -+ * Copyright 2013 -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 as -+ * published by the Free Software Foundation. ++ * Optimized fast_imageblit for bpp == 16. ppw = 2, bit_mask = 3 folded ++ * into the code, main loop unrolled. + */ + -+#include <linux/module.h> -+#include <linux/platform_device.h> -+ -+#include <sound/core.h> -+#include <sound/pcm.h> -+#include <sound/soc.h> -+#include <sound/jack.h> -+ -+#include "../codecs/wm8731.h" -+ -+static const unsigned int wm8731_rates_12288000[] = { -+ 8000, 32000, 48000, 96000, -+}; ++static inline void fast_imageblit16(const struct fb_image *image, ++ struct fb_info *p, u8 __iomem * dst1, ++ u32 fgcolor, u32 bgcolor) ++{ ++ u32 fgx = fgcolor, bgx = bgcolor; ++ u32 spitch = (image->width + 7) / 8; ++ u32 end_mask, eorx; ++ const char *s = image->data, *src; ++ u32 __iomem *dst; ++ const u32 *tab = NULL; ++ int i, j, k; + -+static struct snd_pcm_hw_constraint_list wm8731_constraints_12288000 = { -+ .list = wm8731_rates_12288000, -+ .count = ARRAY_SIZE(wm8731_rates_12288000), -+}; ++ tab = fb_be_math(p) ? cfb_tab16_be : cfb_tab16_le; + -+static int snd_rpi_proto_startup(struct snd_pcm_substream *substream) -+{ -+ /* Setup constraints, because there is a 12.288 MHz XTAL on the board */ -+ snd_pcm_hw_constraint_list(substream->runtime, 0, -+ SNDRV_PCM_HW_PARAM_RATE, -+ &wm8731_constraints_12288000); -+ return 0; -+} ++ fgx <<= 16; ++ bgx <<= 16; ++ fgx |= fgcolor; ++ bgx |= bgcolor; + -+static int snd_rpi_proto_hw_params(struct snd_pcm_substream *substream, -+ struct snd_pcm_hw_params *params) -+{ -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_codec *codec = rtd->codec; -+ struct snd_soc_dai *codec_dai = rtd->codec_dai; -+ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; -+ int sysclk = 12288000; /* This is fixed on this board */ ++ eorx = fgx ^ bgx; ++ k = image->width / 2; + -+ /* Set proto bclk */ -+ int ret = snd_soc_dai_set_bclk_ratio(cpu_dai,32*2); -+ if (ret < 0){ -+ dev_err(codec->dev, -+ "Failed to set BCLK ratio %d\n", ret); -+ return ret; -+ } ++ for (i = image->height; i--;) { ++ dst = (u32 __iomem *) dst1; ++ src = s; + -+ /* Set proto sysclk */ -+ ret = snd_soc_dai_set_sysclk(codec_dai, WM8731_SYSCLK_XTAL, -+ sysclk, SND_SOC_CLOCK_IN); -+ if (ret < 0) { -+ dev_err(codec->dev, -+ "Failed to set WM8731 SYSCLK: %d\n", ret); -+ return ret; ++ j = k; ++ while (j >= 4) { ++ u8 bits = *src; ++ end_mask = tab[(bits >> 6) & 3]; ++ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); ++ end_mask = tab[(bits >> 4) & 3]; ++ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); ++ end_mask = tab[(bits >> 2) & 3]; ++ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); ++ end_mask = tab[bits & 3]; ++ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); ++ src++; ++ j -= 4; ++ } ++ if (j != 0) { ++ u8 bits = *src; ++ end_mask = tab[(bits >> 6) & 3]; ++ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); ++ if (j >= 2) { ++ end_mask = tab[(bits >> 4) & 3]; ++ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); ++ if (j == 3) { ++ end_mask = tab[(bits >> 2) & 3]; ++ FB_WRITEL((end_mask & eorx) ^ bgx, dst); ++ } ++ } ++ } ++ dst1 += p->fix.line_length; ++ s += spitch; + } -+ -+ return 0; +} + -+/* machine stream operations */ -+static struct snd_soc_ops snd_rpi_proto_ops = { -+ .startup = snd_rpi_proto_startup, -+ .hw_params = snd_rpi_proto_hw_params, -+}; ++/* ++ * Optimized fast_imageblit for bpp == 32. ppw = 1, bit_mask = 1 folded ++ * into the code, main loop unrolled. ++ */ + -+static struct snd_soc_dai_link snd_rpi_proto_dai[] = { ++static inline void fast_imageblit32(const struct fb_image *image, ++ struct fb_info *p, u8 __iomem * dst1, ++ u32 fgcolor, u32 bgcolor) +{ -+ .name = "WM8731", -+ .stream_name = "WM8731 HiFi", -+ .cpu_dai_name = "bcm2708-i2s.0", -+ .codec_dai_name = "wm8731-hifi", -+ .platform_name = "bcm2708-i2s.0", -+ .codec_name = "wm8731.1-001a", -+ .dai_fmt = SND_SOC_DAIFMT_I2S -+ | SND_SOC_DAIFMT_NB_NF -+ | SND_SOC_DAIFMT_CBM_CFM, -+ .ops = &snd_rpi_proto_ops, -+}, -+}; -+ -+/* audio machine driver */ -+static struct snd_soc_card snd_rpi_proto = { -+ .name = "snd_rpi_proto", -+ .dai_link = snd_rpi_proto_dai, -+ .num_links = ARRAY_SIZE(snd_rpi_proto_dai), -+}; ++ u32 fgx = fgcolor, bgx = bgcolor; ++ u32 spitch = (image->width + 7) / 8; ++ u32 end_mask, eorx; ++ const char *s = image->data, *src; ++ u32 __iomem *dst; ++ const u32 *tab = NULL; ++ int i, j, k; + -+static int snd_rpi_proto_probe(struct platform_device *pdev) -+{ -+ int ret = 0; ++ tab = cfb_tab32; + -+ snd_rpi_proto.dev = &pdev->dev; ++ eorx = fgx ^ bgx; ++ k = image->width; + -+ if (pdev->dev.of_node) { -+ struct device_node *i2s_node; -+ struct snd_soc_dai_link *dai = &snd_rpi_proto_dai[0]; -+ i2s_node = of_parse_phandle(pdev->dev.of_node, -+ "i2s-controller", 0); ++ for (i = image->height; i--;) { ++ dst = (u32 __iomem *) dst1; ++ src = s; + -+ if (i2s_node) { -+ dai->cpu_dai_name = NULL; -+ dai->cpu_of_node = i2s_node; -+ dai->platform_name = NULL; -+ dai->platform_of_node = i2s_node; ++ j = k; ++ while (j >= 8) { ++ u8 bits = *src; ++ end_mask = tab[(bits >> 7) & 1]; ++ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); ++ end_mask = tab[(bits >> 6) & 1]; ++ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); ++ end_mask = tab[(bits >> 5) & 1]; ++ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); ++ end_mask = tab[(bits >> 4) & 1]; ++ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); ++ end_mask = tab[(bits >> 3) & 1]; ++ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); ++ end_mask = tab[(bits >> 2) & 1]; ++ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); ++ end_mask = tab[(bits >> 1) & 1]; ++ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); ++ end_mask = tab[bits & 1]; ++ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); ++ src++; ++ j -= 8; + } ++ if (j != 0) { ++ u32 bits = (u32) * src; ++ while (j > 1) { ++ end_mask = tab[(bits >> 7) & 1]; ++ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); ++ bits <<= 1; ++ j--; ++ } ++ end_mask = tab[(bits >> 7) & 1]; ++ FB_WRITEL((end_mask & eorx) ^ bgx, dst); ++ } ++ dst1 += p->fix.line_length; ++ s += spitch; + } -+ -+ ret = snd_soc_register_card(&snd_rpi_proto); -+ if (ret) { -+ dev_err(&pdev->dev, -+ "snd_soc_register_card() failed: %d\n", ret); -+ } -+ -+ return ret; -+} -+ -+ -+static int snd_rpi_proto_remove(struct platform_device *pdev) -+{ -+ return snd_soc_unregister_card(&snd_rpi_proto); +} + -+static const struct of_device_id snd_rpi_proto_of_match[] = { -+ { .compatible = "rpi,rpi-proto", }, -+ {}, -+}; -+MODULE_DEVICE_TABLE(of, snd_rpi_proto_of_match); -+ -+static struct platform_driver snd_rpi_proto_driver = { -+ .driver = { -+ .name = "snd-rpi-proto", -+ .owner = THIS_MODULE, -+ .of_match_table = snd_rpi_proto_of_match, -+ }, -+ .probe = snd_rpi_proto_probe, -+ .remove = snd_rpi_proto_remove, -+}; -+ -+module_platform_driver(snd_rpi_proto_driver); -+ -+MODULE_AUTHOR("Florian Meier"); -+MODULE_DESCRIPTION("ASoC Driver for Raspberry Pi connected to PROTO board (WM8731)"); -+MODULE_LICENSE("GPL"); + void cfb_imageblit(struct fb_info *p, const struct fb_image *image) + { + u32 fgcolor, bgcolor, start_index, bitstart, pitch_index = 0; +@@ -294,11 +426,21 @@ void cfb_imageblit(struct fb_info *p, const struct fb_image *image) + bgcolor = image->bg_color; + } + +- if (32 % bpp == 0 && !start_index && !pitch_index && +- ((width & (32/bpp-1)) == 0) && +- bpp >= 8 && bpp <= 32) +- fast_imageblit(image, p, dst1, fgcolor, bgcolor); +- else ++ if (!start_index && !pitch_index) { ++ if (bpp == 32) ++ fast_imageblit32(image, p, dst1, fgcolor, ++ bgcolor); ++ else if (bpp == 16 && (width & 1) == 0) ++ fast_imageblit16(image, p, dst1, fgcolor, ++ bgcolor); ++ else if (bpp == 8 && (width & 3) == 0) ++ fast_imageblit(image, p, dst1, fgcolor, ++ bgcolor); ++ else ++ slow_imageblit(image, p, dst1, fgcolor, ++ bgcolor, ++ start_index, pitch_index); ++ } else + slow_imageblit(image, p, dst1, fgcolor, bgcolor, + start_index, pitch_index); + } else -From e2af169e60b4ebd710e733996d57ad86264bae27 Mon Sep 17 00:00:00 2001 +From fe2e696dfa4ad9e5a5f6c772efc6be7e8aba5a75 Mon Sep 17 00:00:00 2001 From: popcornmix <popcornmix@gmail.com> -Date: Mon, 13 Apr 2015 17:16:29 +0100 -Subject: [PATCH 077/170] config: Add default configs +Date: Wed, 8 May 2013 11:46:50 +0100 +Subject: [PATCH 063/112] enabling the realtime clock 1-wire chip DS1307 and + 1-wire on GPIO4 (as a module) + +1-wire: Add support for configuring pin for w1-gpio kernel module +See: https://github.com/raspberrypi/linux/pull/457 + +Add bitbanging pullups, use them for w1-gpio + +Allows parasite power to work, uses module option pullup=1 + +bcm2708: Ensure 1-wire pullup is disabled by default, and expose as module parameter + +Signed-off-by: Alex J Lennon <ajlennon@dynamicdevices.co.uk> +w1-gpio: Add gpiopin module parameter and correctly free up gpio pull-up pin, if set + +Signed-off-by: Alex J Lennon <ajlennon@dynamicdevices.co.uk> + +w1-gpio: Sort out the pullup/parasitic power tangle --- - arch/arm/configs/bcm2709_defconfig | 1254 +++++++++++++++++++++++++++++++++++ - arch/arm/configs/bcmrpi_defconfig | 1265 ++++++++++++++++++++++++++++++++++++ - 2 files changed, 2519 insertions(+) - create mode 100644 arch/arm/configs/bcm2709_defconfig - create mode 100644 arch/arm/configs/bcmrpi_defconfig + drivers/w1/masters/w1-gpio.c | 69 ++++++++++++++++++++++++++++++++++++++++---- + drivers/w1/w1.h | 6 ++++ + drivers/w1/w1_int.c | 14 +++++++++ + drivers/w1/w1_io.c | 18 ++++++++++-- + include/linux/w1-gpio.h | 1 + + 5 files changed, 99 insertions(+), 9 deletions(-) -diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig -new file mode 100644 -index 0000000..16062bf ---- /dev/null -+++ b/arch/arm/configs/bcm2709_defconfig -@@ -0,0 +1,1254 @@ -+# CONFIG_ARM_PATCH_PHYS_VIRT is not set -+CONFIG_PHYS_OFFSET=0 -+CONFIG_LOCALVERSION="-v7" -+# CONFIG_LOCALVERSION_AUTO is not set -+CONFIG_SYSVIPC=y -+CONFIG_POSIX_MQUEUE=y -+CONFIG_FHANDLE=y -+CONFIG_NO_HZ=y -+CONFIG_HIGH_RES_TIMERS=y -+CONFIG_BSD_PROCESS_ACCT=y -+CONFIG_BSD_PROCESS_ACCT_V3=y -+CONFIG_TASKSTATS=y -+CONFIG_TASK_DELAY_ACCT=y -+CONFIG_TASK_XACCT=y -+CONFIG_TASK_IO_ACCOUNTING=y -+CONFIG_IKCONFIG=m -+CONFIG_IKCONFIG_PROC=y -+CONFIG_CGROUP_FREEZER=y -+CONFIG_CGROUP_DEVICE=y -+CONFIG_CPUSETS=y -+CONFIG_CGROUP_CPUACCT=y -+CONFIG_MEMCG=y -+CONFIG_BLK_CGROUP=y -+CONFIG_NAMESPACES=y -+CONFIG_SCHED_AUTOGROUP=y -+CONFIG_BLK_DEV_INITRD=y -+CONFIG_EMBEDDED=y -+# CONFIG_COMPAT_BRK is not set -+CONFIG_PROFILING=y -+CONFIG_OPROFILE=m -+CONFIG_KPROBES=y -+CONFIG_JUMP_LABEL=y -+CONFIG_MODULES=y -+CONFIG_MODULE_UNLOAD=y -+CONFIG_MODVERSIONS=y -+CONFIG_MODULE_SRCVERSION_ALL=y -+CONFIG_BLK_DEV_THROTTLING=y -+CONFIG_PARTITION_ADVANCED=y -+CONFIG_MAC_PARTITION=y -+CONFIG_CFQ_GROUP_IOSCHED=y -+CONFIG_ARCH_BCM2709=y -+# CONFIG_CACHE_L2X0 is not set -+CONFIG_SMP=y -+CONFIG_HAVE_ARM_ARCH_TIMER=y -+CONFIG_VMSPLIT_2G=y -+CONFIG_PREEMPT_VOLUNTARY=y -+CONFIG_AEABI=y -+CONFIG_OABI_COMPAT=y -+# CONFIG_CPU_SW_DOMAIN_PAN is not set -+CONFIG_CLEANCACHE=y -+CONFIG_FRONTSWAP=y -+CONFIG_CMA=y -+CONFIG_ZSMALLOC=m -+CONFIG_PGTABLE_MAPPING=y -+CONFIG_UACCESS_WITH_MEMCPY=y -+CONFIG_SECCOMP=y -+# CONFIG_ATAGS is not set -+CONFIG_ZBOOT_ROM_TEXT=0x0 -+CONFIG_ZBOOT_ROM_BSS=0x0 -+CONFIG_CMDLINE="console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait" -+CONFIG_CPU_FREQ=y -+CONFIG_CPU_FREQ_STAT=m -+CONFIG_CPU_FREQ_STAT_DETAILS=y -+CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE=y -+CONFIG_CPU_FREQ_GOV_PERFORMANCE=y -+CONFIG_CPU_FREQ_GOV_USERSPACE=y -+CONFIG_CPU_FREQ_GOV_ONDEMAND=y -+CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y -+CONFIG_VFP=y -+CONFIG_NEON=y -+CONFIG_KERNEL_MODE_NEON=y -+CONFIG_BINFMT_MISC=m -+# CONFIG_SUSPEND is not set -+CONFIG_NET=y -+CONFIG_PACKET=y -+CONFIG_UNIX=y -+CONFIG_XFRM_USER=y -+CONFIG_NET_KEY=m -+CONFIG_INET=y -+CONFIG_IP_MULTICAST=y -+CONFIG_IP_ADVANCED_ROUTER=y -+CONFIG_IP_MULTIPLE_TABLES=y -+CONFIG_IP_ROUTE_MULTIPATH=y -+CONFIG_IP_ROUTE_VERBOSE=y -+CONFIG_IP_PNP=y -+CONFIG_IP_PNP_DHCP=y -+CONFIG_IP_PNP_RARP=y -+CONFIG_NET_IPIP=m -+CONFIG_NET_IPGRE_DEMUX=m -+CONFIG_NET_IPGRE=m -+CONFIG_IP_MROUTE=y -+CONFIG_IP_MROUTE_MULTIPLE_TABLES=y -+CONFIG_IP_PIMSM_V1=y -+CONFIG_IP_PIMSM_V2=y -+CONFIG_SYN_COOKIES=y -+CONFIG_INET_AH=m -+CONFIG_INET_ESP=m -+CONFIG_INET_IPCOMP=m -+CONFIG_INET_XFRM_MODE_TRANSPORT=m -+CONFIG_INET_XFRM_MODE_TUNNEL=m -+CONFIG_INET_XFRM_MODE_BEET=m -+CONFIG_INET_LRO=m -+CONFIG_INET_DIAG=m -+CONFIG_INET6_AH=m -+CONFIG_INET6_ESP=m -+CONFIG_INET6_IPCOMP=m -+CONFIG_IPV6_TUNNEL=m -+CONFIG_IPV6_MULTIPLE_TABLES=y -+CONFIG_IPV6_MROUTE=y -+CONFIG_IPV6_MROUTE_MULTIPLE_TABLES=y -+CONFIG_IPV6_PIMSM_V2=y -+CONFIG_NETFILTER=y -+CONFIG_NF_CONNTRACK=m -+CONFIG_NF_CONNTRACK_ZONES=y -+CONFIG_NF_CONNTRACK_EVENTS=y -+CONFIG_NF_CONNTRACK_TIMESTAMP=y -+CONFIG_NF_CT_PROTO_DCCP=m -+CONFIG_NF_CT_PROTO_UDPLITE=m -+CONFIG_NF_CONNTRACK_AMANDA=m -+CONFIG_NF_CONNTRACK_FTP=m -+CONFIG_NF_CONNTRACK_H323=m -+CONFIG_NF_CONNTRACK_IRC=m -+CONFIG_NF_CONNTRACK_NETBIOS_NS=m -+CONFIG_NF_CONNTRACK_SNMP=m -+CONFIG_NF_CONNTRACK_PPTP=m -+CONFIG_NF_CONNTRACK_SANE=m -+CONFIG_NF_CONNTRACK_SIP=m -+CONFIG_NF_CONNTRACK_TFTP=m -+CONFIG_NF_CT_NETLINK=m -+CONFIG_NETFILTER_XT_SET=m -+CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m -+CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m -+CONFIG_NETFILTER_XT_TARGET_CONNMARK=m -+CONFIG_NETFILTER_XT_TARGET_DSCP=m -+CONFIG_NETFILTER_XT_TARGET_HMARK=m -+CONFIG_NETFILTER_XT_TARGET_IDLETIMER=m -+CONFIG_NETFILTER_XT_TARGET_LED=m -+CONFIG_NETFILTER_XT_TARGET_LOG=m -+CONFIG_NETFILTER_XT_TARGET_MARK=m -+CONFIG_NETFILTER_XT_TARGET_NFLOG=m -+CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m -+CONFIG_NETFILTER_XT_TARGET_NOTRACK=m -+CONFIG_NETFILTER_XT_TARGET_TEE=m -+CONFIG_NETFILTER_XT_TARGET_TPROXY=m -+CONFIG_NETFILTER_XT_TARGET_TRACE=m -+CONFIG_NETFILTER_XT_TARGET_TCPMSS=m -+CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP=m -+CONFIG_NETFILTER_XT_MATCH_ADDRTYPE=m -+CONFIG_NETFILTER_XT_MATCH_BPF=m -+CONFIG_NETFILTER_XT_MATCH_CLUSTER=m -+CONFIG_NETFILTER_XT_MATCH_COMMENT=m -+CONFIG_NETFILTER_XT_MATCH_CONNBYTES=m -+CONFIG_NETFILTER_XT_MATCH_CONNLABEL=m -+CONFIG_NETFILTER_XT_MATCH_CONNLIMIT=m -+CONFIG_NETFILTER_XT_MATCH_CONNMARK=m -+CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m -+CONFIG_NETFILTER_XT_MATCH_CPU=m -+CONFIG_NETFILTER_XT_MATCH_DCCP=m -+CONFIG_NETFILTER_XT_MATCH_DEVGROUP=m -+CONFIG_NETFILTER_XT_MATCH_DSCP=m -+CONFIG_NETFILTER_XT_MATCH_ESP=m -+CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=m -+CONFIG_NETFILTER_XT_MATCH_HELPER=m -+CONFIG_NETFILTER_XT_MATCH_IPRANGE=m -+CONFIG_NETFILTER_XT_MATCH_IPVS=m -+CONFIG_NETFILTER_XT_MATCH_LENGTH=m -+CONFIG_NETFILTER_XT_MATCH_LIMIT=m -+CONFIG_NETFILTER_XT_MATCH_MAC=m -+CONFIG_NETFILTER_XT_MATCH_MARK=m -+CONFIG_NETFILTER_XT_MATCH_MULTIPORT=m -+CONFIG_NETFILTER_XT_MATCH_NFACCT=m -+CONFIG_NETFILTER_XT_MATCH_OSF=m -+CONFIG_NETFILTER_XT_MATCH_OWNER=m -+CONFIG_NETFILTER_XT_MATCH_POLICY=m -+CONFIG_NETFILTER_XT_MATCH_PHYSDEV=m -+CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m -+CONFIG_NETFILTER_XT_MATCH_QUOTA=m -+CONFIG_NETFILTER_XT_MATCH_RATEEST=m -+CONFIG_NETFILTER_XT_MATCH_REALM=m -+CONFIG_NETFILTER_XT_MATCH_RECENT=m -+CONFIG_NETFILTER_XT_MATCH_SOCKET=m -+CONFIG_NETFILTER_XT_MATCH_STATE=m -+CONFIG_NETFILTER_XT_MATCH_STATISTIC=m -+CONFIG_NETFILTER_XT_MATCH_STRING=m -+CONFIG_NETFILTER_XT_MATCH_TCPMSS=m -+CONFIG_NETFILTER_XT_MATCH_TIME=m -+CONFIG_NETFILTER_XT_MATCH_U32=m -+CONFIG_IP_SET=m -+CONFIG_IP_SET_BITMAP_IP=m -+CONFIG_IP_SET_BITMAP_IPMAC=m -+CONFIG_IP_SET_BITMAP_PORT=m -+CONFIG_IP_SET_HASH_IP=m -+CONFIG_IP_SET_HASH_IPPORT=m -+CONFIG_IP_SET_HASH_IPPORTIP=m -+CONFIG_IP_SET_HASH_IPPORTNET=m -+CONFIG_IP_SET_HASH_NET=m -+CONFIG_IP_SET_HASH_NETPORT=m -+CONFIG_IP_SET_HASH_NETIFACE=m -+CONFIG_IP_SET_LIST_SET=m -+CONFIG_IP_VS=m -+CONFIG_IP_VS_PROTO_TCP=y -+CONFIG_IP_VS_PROTO_UDP=y -+CONFIG_IP_VS_PROTO_ESP=y -+CONFIG_IP_VS_PROTO_AH=y -+CONFIG_IP_VS_PROTO_SCTP=y -+CONFIG_IP_VS_RR=m -+CONFIG_IP_VS_WRR=m -+CONFIG_IP_VS_LC=m -+CONFIG_IP_VS_WLC=m -+CONFIG_IP_VS_LBLC=m -+CONFIG_IP_VS_LBLCR=m -+CONFIG_IP_VS_DH=m -+CONFIG_IP_VS_SH=m -+CONFIG_IP_VS_SED=m -+CONFIG_IP_VS_NQ=m -+CONFIG_IP_VS_FTP=m -+CONFIG_IP_VS_PE_SIP=m -+CONFIG_NF_CONNTRACK_IPV4=m -+CONFIG_IP_NF_IPTABLES=m -+CONFIG_IP_NF_MATCH_AH=m -+CONFIG_IP_NF_MATCH_ECN=m -+CONFIG_IP_NF_MATCH_TTL=m -+CONFIG_IP_NF_FILTER=m -+CONFIG_IP_NF_TARGET_REJECT=m -+CONFIG_IP_NF_NAT=m -+CONFIG_IP_NF_TARGET_MASQUERADE=m -+CONFIG_IP_NF_TARGET_NETMAP=m -+CONFIG_IP_NF_TARGET_REDIRECT=m -+CONFIG_IP_NF_MANGLE=m -+CONFIG_IP_NF_TARGET_CLUSTERIP=m -+CONFIG_IP_NF_TARGET_ECN=m -+CONFIG_IP_NF_TARGET_TTL=m -+CONFIG_IP_NF_RAW=m -+CONFIG_IP_NF_ARPTABLES=m -+CONFIG_IP_NF_ARPFILTER=m -+CONFIG_IP_NF_ARP_MANGLE=m -+CONFIG_NF_CONNTRACK_IPV6=m -+CONFIG_IP6_NF_IPTABLES=m -+CONFIG_IP6_NF_MATCH_AH=m -+CONFIG_IP6_NF_MATCH_EUI64=m -+CONFIG_IP6_NF_MATCH_FRAG=m -+CONFIG_IP6_NF_MATCH_OPTS=m -+CONFIG_IP6_NF_MATCH_HL=m -+CONFIG_IP6_NF_MATCH_IPV6HEADER=m -+CONFIG_IP6_NF_MATCH_MH=m -+CONFIG_IP6_NF_MATCH_RT=m -+CONFIG_IP6_NF_TARGET_HL=m -+CONFIG_IP6_NF_FILTER=m -+CONFIG_IP6_NF_TARGET_REJECT=m -+CONFIG_IP6_NF_MANGLE=m -+CONFIG_IP6_NF_RAW=m -+CONFIG_IP6_NF_NAT=m -+CONFIG_IP6_NF_TARGET_MASQUERADE=m -+CONFIG_IP6_NF_TARGET_NPT=m -+CONFIG_BRIDGE_NF_EBTABLES=m -+CONFIG_BRIDGE_EBT_BROUTE=m -+CONFIG_BRIDGE_EBT_T_FILTER=m -+CONFIG_BRIDGE_EBT_T_NAT=m -+CONFIG_BRIDGE_EBT_802_3=m -+CONFIG_BRIDGE_EBT_AMONG=m -+CONFIG_BRIDGE_EBT_ARP=m -+CONFIG_BRIDGE_EBT_IP=m -+CONFIG_BRIDGE_EBT_IP6=m -+CONFIG_BRIDGE_EBT_LIMIT=m -+CONFIG_BRIDGE_EBT_MARK=m -+CONFIG_BRIDGE_EBT_PKTTYPE=m -+CONFIG_BRIDGE_EBT_STP=m -+CONFIG_BRIDGE_EBT_VLAN=m -+CONFIG_BRIDGE_EBT_ARPREPLY=m -+CONFIG_BRIDGE_EBT_DNAT=m -+CONFIG_BRIDGE_EBT_MARK_T=m -+CONFIG_BRIDGE_EBT_REDIRECT=m -+CONFIG_BRIDGE_EBT_SNAT=m -+CONFIG_BRIDGE_EBT_LOG=m -+CONFIG_BRIDGE_EBT_NFLOG=m -+CONFIG_SCTP_COOKIE_HMAC_SHA1=y -+CONFIG_ATM=m -+CONFIG_L2TP=m -+CONFIG_L2TP_V3=y -+CONFIG_L2TP_IP=m -+CONFIG_L2TP_ETH=m -+CONFIG_BRIDGE=m -+CONFIG_VLAN_8021Q=m -+CONFIG_VLAN_8021Q_GVRP=y -+CONFIG_ATALK=m -+CONFIG_6LOWPAN=m -+CONFIG_IEEE802154=m -+CONFIG_IEEE802154_6LOWPAN=m -+CONFIG_MAC802154=m -+CONFIG_NET_SCHED=y -+CONFIG_NET_SCH_CBQ=m -+CONFIG_NET_SCH_HTB=m -+CONFIG_NET_SCH_HFSC=m -+CONFIG_NET_SCH_PRIO=m -+CONFIG_NET_SCH_MULTIQ=m -+CONFIG_NET_SCH_RED=m -+CONFIG_NET_SCH_SFB=m -+CONFIG_NET_SCH_SFQ=m -+CONFIG_NET_SCH_TEQL=m -+CONFIG_NET_SCH_TBF=m -+CONFIG_NET_SCH_GRED=m -+CONFIG_NET_SCH_DSMARK=m -+CONFIG_NET_SCH_NETEM=m -+CONFIG_NET_SCH_DRR=m -+CONFIG_NET_SCH_MQPRIO=m -+CONFIG_NET_SCH_CHOKE=m -+CONFIG_NET_SCH_QFQ=m -+CONFIG_NET_SCH_CODEL=m -+CONFIG_NET_SCH_FQ_CODEL=m -+CONFIG_NET_SCH_INGRESS=m -+CONFIG_NET_SCH_PLUG=m -+CONFIG_NET_CLS_BASIC=m -+CONFIG_NET_CLS_TCINDEX=m -+CONFIG_NET_CLS_ROUTE4=m -+CONFIG_NET_CLS_FW=m -+CONFIG_NET_CLS_U32=m -+CONFIG_CLS_U32_MARK=y -+CONFIG_NET_CLS_RSVP=m -+CONFIG_NET_CLS_RSVP6=m -+CONFIG_NET_CLS_FLOW=m -+CONFIG_NET_CLS_CGROUP=m -+CONFIG_NET_EMATCH=y -+CONFIG_NET_EMATCH_CMP=m -+CONFIG_NET_EMATCH_NBYTE=m -+CONFIG_NET_EMATCH_U32=m -+CONFIG_NET_EMATCH_META=m -+CONFIG_NET_EMATCH_TEXT=m -+CONFIG_NET_EMATCH_IPSET=m -+CONFIG_NET_CLS_ACT=y -+CONFIG_NET_ACT_POLICE=m -+CONFIG_NET_ACT_GACT=m -+CONFIG_GACT_PROB=y -+CONFIG_NET_ACT_MIRRED=m -+CONFIG_NET_ACT_IPT=m -+CONFIG_NET_ACT_NAT=m -+CONFIG_NET_ACT_PEDIT=m -+CONFIG_NET_ACT_SIMP=m -+CONFIG_NET_ACT_SKBEDIT=m -+CONFIG_NET_ACT_CSUM=m -+CONFIG_BATMAN_ADV=m -+CONFIG_OPENVSWITCH=m -+CONFIG_NET_PKTGEN=m -+CONFIG_HAMRADIO=y -+CONFIG_AX25=m -+CONFIG_NETROM=m -+CONFIG_ROSE=m -+CONFIG_MKISS=m -+CONFIG_6PACK=m -+CONFIG_BPQETHER=m -+CONFIG_BAYCOM_SER_FDX=m -+CONFIG_BAYCOM_SER_HDX=m -+CONFIG_YAM=m -+CONFIG_CAN=m -+CONFIG_CAN_VCAN=m -+CONFIG_CAN_MCP251X=m -+CONFIG_IRDA=m -+CONFIG_IRLAN=m -+CONFIG_IRNET=m -+CONFIG_IRCOMM=m -+CONFIG_IRDA_ULTRA=y -+CONFIG_IRDA_CACHE_LAST_LSAP=y -+CONFIG_IRDA_FAST_RR=y -+CONFIG_IRTTY_SIR=m -+CONFIG_KINGSUN_DONGLE=m -+CONFIG_KSDAZZLE_DONGLE=m -+CONFIG_KS959_DONGLE=m -+CONFIG_USB_IRDA=m -+CONFIG_SIGMATEL_FIR=m -+CONFIG_MCS_FIR=m -+CONFIG_BT=m -+CONFIG_BT_RFCOMM=m -+CONFIG_BT_RFCOMM_TTY=y -+CONFIG_BT_BNEP=m -+CONFIG_BT_BNEP_MC_FILTER=y -+CONFIG_BT_BNEP_PROTO_FILTER=y -+CONFIG_BT_HIDP=m -+CONFIG_BT_6LOWPAN=m -+CONFIG_BT_HCIBTUSB=m -+CONFIG_BT_HCIBCM203X=m -+CONFIG_BT_HCIBPA10X=m -+CONFIG_BT_HCIBFUSB=m -+CONFIG_BT_HCIVHCI=m -+CONFIG_BT_MRVL=m -+CONFIG_BT_MRVL_SDIO=m -+CONFIG_BT_ATH3K=m -+CONFIG_BT_WILINK=m -+CONFIG_MAC80211=m -+CONFIG_MAC80211_MESH=y -+CONFIG_WIMAX=m -+CONFIG_RFKILL=m -+CONFIG_RFKILL_INPUT=y -+CONFIG_NET_9P=m -+CONFIG_NFC=m -+CONFIG_NFC_PN533=m -+CONFIG_DEVTMPFS=y -+CONFIG_DEVTMPFS_MOUNT=y -+CONFIG_DMA_CMA=y -+CONFIG_CMA_SIZE_MBYTES=5 -+CONFIG_MTD=m -+CONFIG_MTD_BLOCK=m -+CONFIG_MTD_NAND=m -+CONFIG_MTD_UBI=m -+CONFIG_ZRAM=m -+CONFIG_ZRAM_LZ4_COMPRESS=y -+CONFIG_BLK_DEV_LOOP=y -+CONFIG_BLK_DEV_CRYPTOLOOP=m -+CONFIG_BLK_DEV_DRBD=m -+CONFIG_BLK_DEV_NBD=m -+CONFIG_BLK_DEV_RAM=y -+CONFIG_CDROM_PKTCDVD=m -+CONFIG_ATA_OVER_ETH=m -+CONFIG_EEPROM_AT24=m -+CONFIG_TI_ST=m -+CONFIG_SCSI=y -+# CONFIG_SCSI_PROC_FS is not set -+CONFIG_BLK_DEV_SD=y -+CONFIG_CHR_DEV_ST=m -+CONFIG_CHR_DEV_OSST=m -+CONFIG_BLK_DEV_SR=m -+CONFIG_CHR_DEV_SG=m -+CONFIG_SCSI_ISCSI_ATTRS=y -+CONFIG_ISCSI_TCP=m -+CONFIG_ISCSI_BOOT_SYSFS=m -+CONFIG_MD=y -+CONFIG_MD_LINEAR=m -+CONFIG_MD_RAID0=m -+CONFIG_BLK_DEV_DM=m -+CONFIG_DM_CRYPT=m -+CONFIG_DM_SNAPSHOT=m -+CONFIG_DM_THIN_PROVISIONING=m -+CONFIG_DM_MIRROR=m -+CONFIG_DM_LOG_USERSPACE=m -+CONFIG_DM_RAID=m -+CONFIG_DM_ZERO=m -+CONFIG_DM_DELAY=m -+CONFIG_NETDEVICES=y -+CONFIG_BONDING=m -+CONFIG_DUMMY=m -+CONFIG_IFB=m -+CONFIG_MACVLAN=m -+CONFIG_NETCONSOLE=m -+CONFIG_TUN=m -+CONFIG_VETH=m -+CONFIG_ENC28J60=m -+CONFIG_MDIO_BITBANG=m -+CONFIG_PPP=m -+CONFIG_PPP_BSDCOMP=m -+CONFIG_PPP_DEFLATE=m -+CONFIG_PPP_FILTER=y -+CONFIG_PPP_MPPE=m -+CONFIG_PPP_MULTILINK=y -+CONFIG_PPPOATM=m -+CONFIG_PPPOE=m -+CONFIG_PPPOL2TP=m -+CONFIG_PPP_ASYNC=m -+CONFIG_PPP_SYNC_TTY=m -+CONFIG_SLIP=m -+CONFIG_SLIP_COMPRESSED=y -+CONFIG_SLIP_SMART=y -+CONFIG_USB_CATC=m -+CONFIG_USB_KAWETH=m -+CONFIG_USB_PEGASUS=m -+CONFIG_USB_RTL8150=m -+CONFIG_USB_RTL8152=m -+CONFIG_USB_USBNET=y -+CONFIG_USB_NET_AX8817X=m -+CONFIG_USB_NET_AX88179_178A=m -+CONFIG_USB_NET_CDCETHER=m -+CONFIG_USB_NET_CDC_EEM=m -+CONFIG_USB_NET_CDC_NCM=m -+CONFIG_USB_NET_HUAWEI_CDC_NCM=m -+CONFIG_USB_NET_CDC_MBIM=m -+CONFIG_USB_NET_DM9601=m -+CONFIG_USB_NET_SR9700=m -+CONFIG_USB_NET_SR9800=m -+CONFIG_USB_NET_SMSC75XX=m -+CONFIG_USB_NET_SMSC95XX=y -+CONFIG_USB_NET_GL620A=m -+CONFIG_USB_NET_NET1080=m -+CONFIG_USB_NET_PLUSB=m -+CONFIG_USB_NET_MCS7830=m -+CONFIG_USB_NET_CDC_SUBSET=m -+CONFIG_USB_ALI_M5632=y -+CONFIG_USB_AN2720=y -+CONFIG_USB_EPSON2888=y -+CONFIG_USB_KC2190=y -+CONFIG_USB_NET_ZAURUS=m -+CONFIG_USB_NET_CX82310_ETH=m -+CONFIG_USB_NET_KALMIA=m -+CONFIG_USB_NET_QMI_WWAN=m -+CONFIG_USB_HSO=m -+CONFIG_USB_NET_INT51X1=m -+CONFIG_USB_IPHETH=m -+CONFIG_USB_SIERRA_NET=m -+CONFIG_USB_VL600=m -+CONFIG_LIBERTAS_THINFIRM=m -+CONFIG_LIBERTAS_THINFIRM_USB=m -+CONFIG_AT76C50X_USB=m -+CONFIG_USB_ZD1201=m -+CONFIG_USB_NET_RNDIS_WLAN=m -+CONFIG_RTL8187=m -+CONFIG_MAC80211_HWSIM=m -+CONFIG_ATH_CARDS=m -+CONFIG_ATH9K=m -+CONFIG_ATH9K_HTC=m -+CONFIG_CARL9170=m -+CONFIG_ATH6KL=m -+CONFIG_ATH6KL_USB=m -+CONFIG_AR5523=m -+CONFIG_B43=m -+# CONFIG_B43_PHY_N is not set -+CONFIG_B43LEGACY=m -+CONFIG_BRCMFMAC=m -+CONFIG_BRCMFMAC_USB=y -+CONFIG_HOSTAP=m -+CONFIG_LIBERTAS=m -+CONFIG_LIBERTAS_USB=m -+CONFIG_LIBERTAS_SDIO=m -+CONFIG_P54_COMMON=m -+CONFIG_P54_USB=m -+CONFIG_RT2X00=m -+CONFIG_RT2500USB=m -+CONFIG_RT73USB=m -+CONFIG_RT2800USB=m -+CONFIG_RT2800USB_RT3573=y -+CONFIG_RT2800USB_RT53XX=y -+CONFIG_RT2800USB_RT55XX=y -+CONFIG_RT2800USB_UNKNOWN=y -+CONFIG_WL_MEDIATEK=y -+CONFIG_MT7601U=m -+CONFIG_RTL8192CU=m -+CONFIG_ZD1211RW=m -+CONFIG_MWIFIEX=m -+CONFIG_MWIFIEX_SDIO=m -+CONFIG_WIMAX_I2400M_USB=m -+CONFIG_IEEE802154_AT86RF230=m -+CONFIG_IEEE802154_MRF24J40=m -+CONFIG_IEEE802154_CC2520=m -+CONFIG_INPUT_POLLDEV=m -+# CONFIG_INPUT_MOUSEDEV_PSAUX is not set -+CONFIG_INPUT_JOYDEV=m -+CONFIG_INPUT_EVDEV=m -+# CONFIG_KEYBOARD_ATKBD is not set -+CONFIG_KEYBOARD_GPIO=m -+# CONFIG_INPUT_MOUSE is not set -+CONFIG_INPUT_JOYSTICK=y -+CONFIG_JOYSTICK_IFORCE=m -+CONFIG_JOYSTICK_IFORCE_USB=y -+CONFIG_JOYSTICK_XPAD=m -+CONFIG_JOYSTICK_XPAD_FF=y -+CONFIG_JOYSTICK_RPISENSE=m -+CONFIG_INPUT_TOUCHSCREEN=y -+CONFIG_TOUCHSCREEN_ADS7846=m -+CONFIG_TOUCHSCREEN_EGALAX=m -+CONFIG_TOUCHSCREEN_FT6236=m -+CONFIG_TOUCHSCREEN_RPI_FT5406=m -+CONFIG_TOUCHSCREEN_USB_COMPOSITE=m -+CONFIG_TOUCHSCREEN_STMPE=m -+CONFIG_INPUT_MISC=y -+CONFIG_INPUT_AD714X=m -+CONFIG_INPUT_ATI_REMOTE2=m -+CONFIG_INPUT_KEYSPAN_REMOTE=m -+CONFIG_INPUT_POWERMATE=m -+CONFIG_INPUT_YEALINK=m -+CONFIG_INPUT_CM109=m -+CONFIG_INPUT_UINPUT=m -+CONFIG_INPUT_GPIO_ROTARY_ENCODER=m -+CONFIG_INPUT_ADXL34X=m -+CONFIG_INPUT_CMA3000=m -+CONFIG_SERIO=m -+CONFIG_SERIO_RAW=m -+CONFIG_GAMEPORT=m -+CONFIG_GAMEPORT_NS558=m -+CONFIG_GAMEPORT_L4=m -+CONFIG_BRCM_CHAR_DRIVERS=y -+CONFIG_BCM_VC_CMA=y -+CONFIG_BCM_VCIO=y -+CONFIG_BCM_VC_SM=y -+CONFIG_DEVPTS_MULTIPLE_INSTANCES=y -+# CONFIG_LEGACY_PTYS is not set -+# CONFIG_DEVKMEM is not set -+CONFIG_SERIAL_8250=y -+# CONFIG_SERIAL_8250_DEPRECATED_OPTIONS is not set -+CONFIG_SERIAL_8250_CONSOLE=y -+# CONFIG_SERIAL_8250_DMA is not set -+CONFIG_SERIAL_8250_NR_UARTS=1 -+CONFIG_SERIAL_8250_RUNTIME_UARTS=0 -+CONFIG_SERIAL_AMBA_PL011=y -+CONFIG_SERIAL_AMBA_PL011_CONSOLE=y -+CONFIG_SERIAL_OF_PLATFORM=y -+CONFIG_TTY_PRINTK=y -+CONFIG_HW_RANDOM=y -+CONFIG_HW_RANDOM_BCM2835=y -+CONFIG_RAW_DRIVER=y -+CONFIG_I2C=y -+CONFIG_I2C_CHARDEV=m -+CONFIG_I2C_BCM2708=m -+CONFIG_SPI=y -+CONFIG_SPI_BCM2835=m -+CONFIG_SPI_SPIDEV=y -+CONFIG_PPS=m -+CONFIG_PPS_CLIENT_LDISC=m -+CONFIG_PPS_CLIENT_GPIO=m -+CONFIG_GPIO_SYSFS=y -+CONFIG_GPIO_ARIZONA=m -+CONFIG_GPIO_STMPE=y -+CONFIG_W1=m -+CONFIG_W1_MASTER_DS2490=m -+CONFIG_W1_MASTER_DS2482=m -+CONFIG_W1_MASTER_DS1WM=m -+CONFIG_W1_MASTER_GPIO=m -+CONFIG_W1_SLAVE_THERM=m -+CONFIG_W1_SLAVE_SMEM=m -+CONFIG_W1_SLAVE_DS2408=m -+CONFIG_W1_SLAVE_DS2413=m -+CONFIG_W1_SLAVE_DS2406=m -+CONFIG_W1_SLAVE_DS2423=m -+CONFIG_W1_SLAVE_DS2431=m -+CONFIG_W1_SLAVE_DS2433=m -+CONFIG_W1_SLAVE_DS2760=m -+CONFIG_W1_SLAVE_DS2780=m -+CONFIG_W1_SLAVE_DS2781=m -+CONFIG_W1_SLAVE_DS28E04=m -+CONFIG_W1_SLAVE_BQ27000=m -+CONFIG_BATTERY_DS2760=m -+CONFIG_POWER_RESET=y -+CONFIG_POWER_RESET_GPIO=y -+CONFIG_HWMON=m -+CONFIG_SENSORS_SHT21=m -+CONFIG_SENSORS_SHTC1=m -+CONFIG_THERMAL=y -+CONFIG_THERMAL_BCM2835=y -+CONFIG_WATCHDOG=y -+CONFIG_BCM2835_WDT=m -+CONFIG_UCB1400_CORE=m -+CONFIG_MFD_STMPE=y -+CONFIG_STMPE_SPI=y -+CONFIG_MFD_ARIZONA_I2C=m -+CONFIG_MFD_ARIZONA_SPI=m -+CONFIG_MFD_WM5102=y -+CONFIG_MEDIA_SUPPORT=m -+CONFIG_MEDIA_CAMERA_SUPPORT=y -+CONFIG_MEDIA_ANALOG_TV_SUPPORT=y -+CONFIG_MEDIA_DIGITAL_TV_SUPPORT=y -+CONFIG_MEDIA_RADIO_SUPPORT=y -+CONFIG_MEDIA_RC_SUPPORT=y -+CONFIG_MEDIA_CONTROLLER=y -+CONFIG_LIRC=m -+CONFIG_RC_DEVICES=y -+CONFIG_RC_ATI_REMOTE=m -+CONFIG_IR_IMON=m -+CONFIG_IR_MCEUSB=m -+CONFIG_IR_REDRAT3=m -+CONFIG_IR_STREAMZAP=m -+CONFIG_IR_IGUANA=m -+CONFIG_IR_TTUSBIR=m -+CONFIG_RC_LOOPBACK=m -+CONFIG_IR_GPIO_CIR=m -+CONFIG_MEDIA_USB_SUPPORT=y -+CONFIG_USB_VIDEO_CLASS=m -+CONFIG_USB_M5602=m -+CONFIG_USB_STV06XX=m -+CONFIG_USB_GL860=m -+CONFIG_USB_GSPCA_BENQ=m -+CONFIG_USB_GSPCA_CONEX=m -+CONFIG_USB_GSPCA_CPIA1=m -+CONFIG_USB_GSPCA_DTCS033=m -+CONFIG_USB_GSPCA_ETOMS=m -+CONFIG_USB_GSPCA_FINEPIX=m -+CONFIG_USB_GSPCA_JEILINJ=m -+CONFIG_USB_GSPCA_JL2005BCD=m -+CONFIG_USB_GSPCA_KINECT=m -+CONFIG_USB_GSPCA_KONICA=m -+CONFIG_USB_GSPCA_MARS=m -+CONFIG_USB_GSPCA_MR97310A=m -+CONFIG_USB_GSPCA_NW80X=m -+CONFIG_USB_GSPCA_OV519=m -+CONFIG_USB_GSPCA_OV534=m -+CONFIG_USB_GSPCA_OV534_9=m -+CONFIG_USB_GSPCA_PAC207=m -+CONFIG_USB_GSPCA_PAC7302=m -+CONFIG_USB_GSPCA_PAC7311=m -+CONFIG_USB_GSPCA_SE401=m -+CONFIG_USB_GSPCA_SN9C2028=m -+CONFIG_USB_GSPCA_SN9C20X=m -+CONFIG_USB_GSPCA_SONIXB=m -+CONFIG_USB_GSPCA_SONIXJ=m -+CONFIG_USB_GSPCA_SPCA500=m -+CONFIG_USB_GSPCA_SPCA501=m -+CONFIG_USB_GSPCA_SPCA505=m -+CONFIG_USB_GSPCA_SPCA506=m -+CONFIG_USB_GSPCA_SPCA508=m -+CONFIG_USB_GSPCA_SPCA561=m -+CONFIG_USB_GSPCA_SPCA1528=m -+CONFIG_USB_GSPCA_SQ905=m -+CONFIG_USB_GSPCA_SQ905C=m -+CONFIG_USB_GSPCA_SQ930X=m -+CONFIG_USB_GSPCA_STK014=m -+CONFIG_USB_GSPCA_STK1135=m -+CONFIG_USB_GSPCA_STV0680=m -+CONFIG_USB_GSPCA_SUNPLUS=m -+CONFIG_USB_GSPCA_T613=m -+CONFIG_USB_GSPCA_TOPRO=m -+CONFIG_USB_GSPCA_TV8532=m -+CONFIG_USB_GSPCA_VC032X=m -+CONFIG_USB_GSPCA_VICAM=m -+CONFIG_USB_GSPCA_XIRLINK_CIT=m -+CONFIG_USB_GSPCA_ZC3XX=m -+CONFIG_USB_PWC=m -+CONFIG_VIDEO_CPIA2=m -+CONFIG_USB_ZR364XX=m -+CONFIG_USB_STKWEBCAM=m -+CONFIG_USB_S2255=m -+CONFIG_VIDEO_USBTV=m -+CONFIG_VIDEO_PVRUSB2=m -+CONFIG_VIDEO_HDPVR=m -+CONFIG_VIDEO_USBVISION=m -+CONFIG_VIDEO_STK1160_COMMON=m -+CONFIG_VIDEO_STK1160_AC97=y -+CONFIG_VIDEO_GO7007=m -+CONFIG_VIDEO_GO7007_USB=m -+CONFIG_VIDEO_GO7007_USB_S2250_BOARD=m -+CONFIG_VIDEO_AU0828=m -+CONFIG_VIDEO_AU0828_RC=y -+CONFIG_VIDEO_CX231XX=m -+CONFIG_VIDEO_CX231XX_ALSA=m -+CONFIG_VIDEO_CX231XX_DVB=m -+CONFIG_VIDEO_TM6000=m -+CONFIG_VIDEO_TM6000_ALSA=m -+CONFIG_VIDEO_TM6000_DVB=m -+CONFIG_DVB_USB=m -+CONFIG_DVB_USB_A800=m -+CONFIG_DVB_USB_DIBUSB_MB=m -+CONFIG_DVB_USB_DIBUSB_MB_FAULTY=y -+CONFIG_DVB_USB_DIBUSB_MC=m -+CONFIG_DVB_USB_DIB0700=m -+CONFIG_DVB_USB_UMT_010=m -+CONFIG_DVB_USB_CXUSB=m -+CONFIG_DVB_USB_M920X=m -+CONFIG_DVB_USB_DIGITV=m -+CONFIG_DVB_USB_VP7045=m -+CONFIG_DVB_USB_VP702X=m -+CONFIG_DVB_USB_GP8PSK=m -+CONFIG_DVB_USB_NOVA_T_USB2=m -+CONFIG_DVB_USB_TTUSB2=m -+CONFIG_DVB_USB_DTT200U=m -+CONFIG_DVB_USB_OPERA1=m -+CONFIG_DVB_USB_AF9005=m -+CONFIG_DVB_USB_AF9005_REMOTE=m -+CONFIG_DVB_USB_PCTV452E=m -+CONFIG_DVB_USB_DW2102=m -+CONFIG_DVB_USB_CINERGY_T2=m -+CONFIG_DVB_USB_DTV5100=m -+CONFIG_DVB_USB_FRIIO=m -+CONFIG_DVB_USB_AZ6027=m -+CONFIG_DVB_USB_TECHNISAT_USB2=m -+CONFIG_DVB_USB_V2=m -+CONFIG_DVB_USB_AF9015=m -+CONFIG_DVB_USB_AF9035=m -+CONFIG_DVB_USB_ANYSEE=m -+CONFIG_DVB_USB_AU6610=m -+CONFIG_DVB_USB_AZ6007=m -+CONFIG_DVB_USB_CE6230=m -+CONFIG_DVB_USB_EC168=m -+CONFIG_DVB_USB_GL861=m -+CONFIG_DVB_USB_LME2510=m -+CONFIG_DVB_USB_MXL111SF=m -+CONFIG_DVB_USB_RTL28XXU=m -+CONFIG_DVB_USB_DVBSKY=m -+CONFIG_SMS_USB_DRV=m -+CONFIG_DVB_B2C2_FLEXCOP_USB=m -+CONFIG_DVB_AS102=m -+CONFIG_VIDEO_EM28XX=m -+CONFIG_VIDEO_EM28XX_V4L2=m -+CONFIG_VIDEO_EM28XX_ALSA=m -+CONFIG_VIDEO_EM28XX_DVB=m -+CONFIG_V4L_PLATFORM_DRIVERS=y -+CONFIG_VIDEO_BCM2835=y -+CONFIG_VIDEO_BCM2835_MMAL=m -+CONFIG_RADIO_SI470X=y -+CONFIG_USB_SI470X=m -+CONFIG_I2C_SI470X=m -+CONFIG_RADIO_SI4713=m -+CONFIG_I2C_SI4713=m -+CONFIG_USB_MR800=m -+CONFIG_USB_DSBR=m -+CONFIG_RADIO_SHARK=m -+CONFIG_RADIO_SHARK2=m -+CONFIG_USB_KEENE=m -+CONFIG_USB_MA901=m -+CONFIG_RADIO_TEA5764=m -+CONFIG_RADIO_SAA7706H=m -+CONFIG_RADIO_TEF6862=m -+CONFIG_RADIO_WL1273=m -+CONFIG_RADIO_WL128X=m -+# CONFIG_MEDIA_SUBDRV_AUTOSELECT is not set -+CONFIG_VIDEO_UDA1342=m -+CONFIG_VIDEO_SONY_BTF_MPX=m -+CONFIG_VIDEO_TVP5150=m -+CONFIG_VIDEO_TW2804=m -+CONFIG_VIDEO_TW9903=m -+CONFIG_VIDEO_TW9906=m -+CONFIG_VIDEO_OV7640=m -+CONFIG_VIDEO_MT9V011=m -+CONFIG_FB=y -+CONFIG_FB_BCM2708=y -+CONFIG_FB_UDL=m -+CONFIG_FB_SSD1307=m -+CONFIG_FB_RPISENSE=m -+# CONFIG_BACKLIGHT_GENERIC is not set -+CONFIG_BACKLIGHT_GPIO=m -+CONFIG_FRAMEBUFFER_CONSOLE=y -+CONFIG_LOGO=y -+# CONFIG_LOGO_LINUX_MONO is not set -+# CONFIG_LOGO_LINUX_VGA16 is not set -+CONFIG_SOUND=y -+CONFIG_SND=m -+CONFIG_SND_SEQUENCER=m -+CONFIG_SND_SEQ_DUMMY=m -+CONFIG_SND_MIXER_OSS=m -+CONFIG_SND_PCM_OSS=m -+CONFIG_SND_SEQUENCER_OSS=y -+CONFIG_SND_HRTIMER=m -+CONFIG_SND_DUMMY=m -+CONFIG_SND_ALOOP=m -+CONFIG_SND_VIRMIDI=m -+CONFIG_SND_MTPAV=m -+CONFIG_SND_SERIAL_U16550=m -+CONFIG_SND_MPU401=m -+CONFIG_SND_BCM2835=m -+CONFIG_SND_USB_AUDIO=m -+CONFIG_SND_USB_UA101=m -+CONFIG_SND_USB_CAIAQ=m -+CONFIG_SND_USB_CAIAQ_INPUT=y -+CONFIG_SND_USB_6FIRE=m -+CONFIG_SND_SOC=m -+CONFIG_SND_BCM2835_SOC_I2S=m -+CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC=m -+CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS=m -+CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI=m -+CONFIG_SND_BCM2708_SOC_HIFIBERRY_AMP=m -+CONFIG_SND_BCM2708_SOC_RPI_DAC=m -+CONFIG_SND_BCM2708_SOC_RPI_PROTO=m -+CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC=m -+CONFIG_SND_BCM2708_SOC_RASPIDAC3=m -+CONFIG_SND_SOC_ADAU1701=m -+CONFIG_SND_SOC_WM8804_I2C=m -+CONFIG_SND_SIMPLE_CARD=m -+CONFIG_SOUND_PRIME=m -+CONFIG_HIDRAW=y -+CONFIG_UHID=m -+CONFIG_HID_A4TECH=m -+CONFIG_HID_ACRUX=m -+CONFIG_HID_APPLE=m -+CONFIG_HID_BELKIN=m -+CONFIG_HID_CHERRY=m -+CONFIG_HID_CHICONY=m -+CONFIG_HID_CYPRESS=m -+CONFIG_HID_DRAGONRISE=m -+CONFIG_HID_EMS_FF=m -+CONFIG_HID_ELECOM=m -+CONFIG_HID_ELO=m -+CONFIG_HID_EZKEY=m -+CONFIG_HID_HOLTEK=m -+CONFIG_HID_KEYTOUCH=m -+CONFIG_HID_KYE=m -+CONFIG_HID_UCLOGIC=m -+CONFIG_HID_WALTOP=m -+CONFIG_HID_GYRATION=m -+CONFIG_HID_TWINHAN=m -+CONFIG_HID_KENSINGTON=m -+CONFIG_HID_LCPOWER=m -+CONFIG_HID_LOGITECH=m -+CONFIG_HID_MAGICMOUSE=m -+CONFIG_HID_MICROSOFT=m -+CONFIG_HID_MONTEREY=m -+CONFIG_HID_MULTITOUCH=m -+CONFIG_HID_NTRIG=m -+CONFIG_HID_ORTEK=m -+CONFIG_HID_PANTHERLORD=m -+CONFIG_HID_PETALYNX=m -+CONFIG_HID_PICOLCD=m -+CONFIG_HID_ROCCAT=m -+CONFIG_HID_SAMSUNG=m -+CONFIG_HID_SONY=m -+CONFIG_HID_SPEEDLINK=m -+CONFIG_HID_SUNPLUS=m -+CONFIG_HID_GREENASIA=m -+CONFIG_HID_SMARTJOYPLUS=m -+CONFIG_HID_TOPSEED=m -+CONFIG_HID_THINGM=m -+CONFIG_HID_THRUSTMASTER=m -+CONFIG_HID_WACOM=m -+CONFIG_HID_WIIMOTE=m -+CONFIG_HID_XINMO=m -+CONFIG_HID_ZEROPLUS=m -+CONFIG_HID_ZYDACRON=m -+CONFIG_HID_PID=y -+CONFIG_USB_HIDDEV=y -+CONFIG_USB=y -+CONFIG_USB_ANNOUNCE_NEW_DEVICES=y -+CONFIG_USB_MON=m -+CONFIG_USB_DWCOTG=y -+CONFIG_USB_PRINTER=m -+CONFIG_USB_STORAGE=y -+CONFIG_USB_STORAGE_REALTEK=m -+CONFIG_USB_STORAGE_DATAFAB=m -+CONFIG_USB_STORAGE_FREECOM=m -+CONFIG_USB_STORAGE_ISD200=m -+CONFIG_USB_STORAGE_USBAT=m -+CONFIG_USB_STORAGE_SDDR09=m -+CONFIG_USB_STORAGE_SDDR55=m -+CONFIG_USB_STORAGE_JUMPSHOT=m -+CONFIG_USB_STORAGE_ALAUDA=m -+CONFIG_USB_STORAGE_ONETOUCH=m -+CONFIG_USB_STORAGE_KARMA=m -+CONFIG_USB_STORAGE_CYPRESS_ATACB=m -+CONFIG_USB_STORAGE_ENE_UB6250=m -+CONFIG_USB_MDC800=m -+CONFIG_USB_MICROTEK=m -+CONFIG_USBIP_CORE=m -+CONFIG_USBIP_VHCI_HCD=m -+CONFIG_USBIP_HOST=m -+CONFIG_USB_SERIAL=m -+CONFIG_USB_SERIAL_GENERIC=y -+CONFIG_USB_SERIAL_AIRCABLE=m -+CONFIG_USB_SERIAL_ARK3116=m -+CONFIG_USB_SERIAL_BELKIN=m -+CONFIG_USB_SERIAL_CH341=m -+CONFIG_USB_SERIAL_WHITEHEAT=m -+CONFIG_USB_SERIAL_DIGI_ACCELEPORT=m -+CONFIG_USB_SERIAL_CP210X=m -+CONFIG_USB_SERIAL_CYPRESS_M8=m -+CONFIG_USB_SERIAL_EMPEG=m -+CONFIG_USB_SERIAL_FTDI_SIO=m -+CONFIG_USB_SERIAL_VISOR=m -+CONFIG_USB_SERIAL_IPAQ=m -+CONFIG_USB_SERIAL_IR=m -+CONFIG_USB_SERIAL_EDGEPORT=m -+CONFIG_USB_SERIAL_EDGEPORT_TI=m -+CONFIG_USB_SERIAL_F81232=m -+CONFIG_USB_SERIAL_GARMIN=m -+CONFIG_USB_SERIAL_IPW=m -+CONFIG_USB_SERIAL_IUU=m -+CONFIG_USB_SERIAL_KEYSPAN_PDA=m -+CONFIG_USB_SERIAL_KEYSPAN=m -+CONFIG_USB_SERIAL_KLSI=m -+CONFIG_USB_SERIAL_KOBIL_SCT=m -+CONFIG_USB_SERIAL_MCT_U232=m -+CONFIG_USB_SERIAL_METRO=m -+CONFIG_USB_SERIAL_MOS7720=m -+CONFIG_USB_SERIAL_MOS7840=m -+CONFIG_USB_SERIAL_NAVMAN=m -+CONFIG_USB_SERIAL_PL2303=m -+CONFIG_USB_SERIAL_OTI6858=m -+CONFIG_USB_SERIAL_QCAUX=m -+CONFIG_USB_SERIAL_QUALCOMM=m -+CONFIG_USB_SERIAL_SPCP8X5=m -+CONFIG_USB_SERIAL_SAFE=m -+CONFIG_USB_SERIAL_SIERRAWIRELESS=m -+CONFIG_USB_SERIAL_SYMBOL=m -+CONFIG_USB_SERIAL_TI=m -+CONFIG_USB_SERIAL_CYBERJACK=m -+CONFIG_USB_SERIAL_XIRCOM=m -+CONFIG_USB_SERIAL_OPTION=m -+CONFIG_USB_SERIAL_OMNINET=m -+CONFIG_USB_SERIAL_OPTICON=m -+CONFIG_USB_SERIAL_XSENS_MT=m -+CONFIG_USB_SERIAL_WISHBONE=m -+CONFIG_USB_SERIAL_SSU100=m -+CONFIG_USB_SERIAL_QT2=m -+CONFIG_USB_SERIAL_DEBUG=m -+CONFIG_USB_EMI62=m -+CONFIG_USB_EMI26=m -+CONFIG_USB_ADUTUX=m -+CONFIG_USB_SEVSEG=m -+CONFIG_USB_RIO500=m -+CONFIG_USB_LEGOTOWER=m -+CONFIG_USB_LCD=m -+CONFIG_USB_LED=m -+CONFIG_USB_CYPRESS_CY7C63=m -+CONFIG_USB_CYTHERM=m -+CONFIG_USB_IDMOUSE=m -+CONFIG_USB_FTDI_ELAN=m -+CONFIG_USB_APPLEDISPLAY=m -+CONFIG_USB_LD=m -+CONFIG_USB_TRANCEVIBRATOR=m -+CONFIG_USB_IOWARRIOR=m -+CONFIG_USB_TEST=m -+CONFIG_USB_ISIGHTFW=m -+CONFIG_USB_YUREX=m -+CONFIG_USB_ATM=m -+CONFIG_USB_SPEEDTOUCH=m -+CONFIG_USB_CXACRU=m -+CONFIG_USB_UEAGLEATM=m -+CONFIG_USB_XUSBATM=m -+CONFIG_MMC=y -+CONFIG_MMC_BLOCK_MINORS=32 -+CONFIG_MMC_BCM2835=y -+CONFIG_MMC_BCM2835_DMA=y -+CONFIG_MMC_BCM2835_SDHOST=y -+CONFIG_MMC_SDHCI=y -+CONFIG_MMC_SDHCI_PLTFM=y -+CONFIG_MMC_SPI=m -+CONFIG_LEDS_CLASS=y -+CONFIG_LEDS_GPIO=y -+CONFIG_LEDS_TRIGGER_TIMER=y -+CONFIG_LEDS_TRIGGER_ONESHOT=y -+CONFIG_LEDS_TRIGGER_HEARTBEAT=y -+CONFIG_LEDS_TRIGGER_BACKLIGHT=y -+CONFIG_LEDS_TRIGGER_CPU=y -+CONFIG_LEDS_TRIGGER_GPIO=y -+CONFIG_LEDS_TRIGGER_DEFAULT_ON=y -+CONFIG_LEDS_TRIGGER_TRANSIENT=m -+CONFIG_LEDS_TRIGGER_CAMERA=m -+CONFIG_LEDS_TRIGGER_INPUT=y -+CONFIG_RTC_CLASS=y -+# CONFIG_RTC_HCTOSYS is not set -+CONFIG_RTC_DRV_DS1307=m -+CONFIG_RTC_DRV_DS1374=m -+CONFIG_RTC_DRV_DS1672=m -+CONFIG_RTC_DRV_DS3232=m -+CONFIG_RTC_DRV_MAX6900=m -+CONFIG_RTC_DRV_RS5C372=m -+CONFIG_RTC_DRV_ISL1208=m -+CONFIG_RTC_DRV_ISL12022=m -+CONFIG_RTC_DRV_ISL12057=m -+CONFIG_RTC_DRV_X1205=m -+CONFIG_RTC_DRV_PCF2127=m -+CONFIG_RTC_DRV_PCF8523=m -+CONFIG_RTC_DRV_PCF8563=m -+CONFIG_RTC_DRV_PCF8583=m -+CONFIG_RTC_DRV_M41T80=m -+CONFIG_RTC_DRV_BQ32K=m -+CONFIG_RTC_DRV_S35390A=m -+CONFIG_RTC_DRV_FM3130=m -+CONFIG_RTC_DRV_RX8581=m -+CONFIG_RTC_DRV_RX8025=m -+CONFIG_RTC_DRV_EM3027=m -+CONFIG_RTC_DRV_RV3029C2=m -+CONFIG_RTC_DRV_M41T93=m -+CONFIG_RTC_DRV_M41T94=m -+CONFIG_RTC_DRV_DS1305=m -+CONFIG_RTC_DRV_DS1390=m -+CONFIG_RTC_DRV_MAX6902=m -+CONFIG_RTC_DRV_R9701=m -+CONFIG_RTC_DRV_RS5C348=m -+CONFIG_RTC_DRV_DS3234=m -+CONFIG_RTC_DRV_PCF2123=m -+CONFIG_RTC_DRV_RX4581=m -+CONFIG_DMADEVICES=y -+CONFIG_DMA_BCM2835=y -+CONFIG_DMA_BCM2708=y -+CONFIG_UIO=m -+CONFIG_UIO_PDRV_GENIRQ=m -+CONFIG_STAGING=y -+CONFIG_PRISM2_USB=m -+CONFIG_R8712U=m -+CONFIG_R8188EU=m -+CONFIG_R8723AU=m -+CONFIG_VT6656=m -+CONFIG_SPEAKUP=m -+CONFIG_SPEAKUP_SYNTH_SOFT=m -+CONFIG_STAGING_MEDIA=y -+CONFIG_LIRC_STAGING=y -+CONFIG_LIRC_IMON=m -+CONFIG_LIRC_RPI=m -+CONFIG_LIRC_SASEM=m -+CONFIG_LIRC_SERIAL=m -+CONFIG_FB_TFT=m -+CONFIG_FB_TFT_AGM1264K_FL=m -+CONFIG_FB_TFT_BD663474=m -+CONFIG_FB_TFT_HX8340BN=m -+CONFIG_FB_TFT_HX8347D=m -+CONFIG_FB_TFT_HX8353D=m -+CONFIG_FB_TFT_ILI9163=m -+CONFIG_FB_TFT_ILI9320=m -+CONFIG_FB_TFT_ILI9325=m -+CONFIG_FB_TFT_ILI9340=m -+CONFIG_FB_TFT_ILI9341=m -+CONFIG_FB_TFT_ILI9481=m -+CONFIG_FB_TFT_ILI9486=m -+CONFIG_FB_TFT_PCD8544=m -+CONFIG_FB_TFT_RA8875=m -+CONFIG_FB_TFT_S6D02A1=m -+CONFIG_FB_TFT_S6D1121=m -+CONFIG_FB_TFT_SSD1289=m -+CONFIG_FB_TFT_SSD1306=m -+CONFIG_FB_TFT_SSD1331=m -+CONFIG_FB_TFT_SSD1351=m -+CONFIG_FB_TFT_ST7735R=m -+CONFIG_FB_TFT_TINYLCD=m -+CONFIG_FB_TFT_TLS8204=m -+CONFIG_FB_TFT_UC1701=m -+CONFIG_FB_TFT_UPD161704=m -+CONFIG_FB_TFT_WATTEROTT=m -+CONFIG_FB_FLEX=m -+CONFIG_FB_TFT_FBTFT_DEVICE=m -+CONFIG_MAILBOX=y -+CONFIG_BCM2835_MBOX=y -+# CONFIG_IOMMU_SUPPORT is not set -+CONFIG_EXTCON=m -+CONFIG_EXTCON_ARIZONA=m -+CONFIG_IIO=m -+CONFIG_IIO_BUFFER=y -+CONFIG_IIO_BUFFER_CB=y -+CONFIG_IIO_KFIFO_BUF=m -+CONFIG_MCP320X=m -+CONFIG_DHT11=m -+CONFIG_PWM_BCM2835=m -+CONFIG_RASPBERRYPI_FIRMWARE=y -+CONFIG_EXT4_FS=y -+CONFIG_EXT4_FS_POSIX_ACL=y -+CONFIG_EXT4_FS_SECURITY=y -+CONFIG_REISERFS_FS=m -+CONFIG_REISERFS_FS_XATTR=y -+CONFIG_REISERFS_FS_POSIX_ACL=y -+CONFIG_REISERFS_FS_SECURITY=y -+CONFIG_JFS_FS=m -+CONFIG_JFS_POSIX_ACL=y -+CONFIG_JFS_SECURITY=y -+CONFIG_JFS_STATISTICS=y -+CONFIG_XFS_FS=m -+CONFIG_XFS_QUOTA=y -+CONFIG_XFS_POSIX_ACL=y -+CONFIG_XFS_RT=y -+CONFIG_GFS2_FS=m -+CONFIG_OCFS2_FS=m -+CONFIG_BTRFS_FS=m -+CONFIG_BTRFS_FS_POSIX_ACL=y -+CONFIG_NILFS2_FS=m -+CONFIG_F2FS_FS=y -+CONFIG_FANOTIFY=y -+CONFIG_QFMT_V1=m -+CONFIG_QFMT_V2=m -+CONFIG_AUTOFS4_FS=y -+CONFIG_FUSE_FS=m -+CONFIG_CUSE=m -+CONFIG_OVERLAY_FS=m -+CONFIG_FSCACHE=y -+CONFIG_FSCACHE_STATS=y -+CONFIG_FSCACHE_HISTOGRAM=y -+CONFIG_CACHEFILES=y -+CONFIG_ISO9660_FS=m -+CONFIG_JOLIET=y -+CONFIG_ZISOFS=y -+CONFIG_UDF_FS=m -+CONFIG_MSDOS_FS=y -+CONFIG_VFAT_FS=y -+CONFIG_FAT_DEFAULT_IOCHARSET="ascii" -+CONFIG_NTFS_FS=m -+CONFIG_NTFS_RW=y -+CONFIG_TMPFS=y -+CONFIG_TMPFS_POSIX_ACL=y -+CONFIG_CONFIGFS_FS=y -+CONFIG_ECRYPT_FS=m -+CONFIG_HFS_FS=m -+CONFIG_HFSPLUS_FS=m -+CONFIG_JFFS2_FS=m -+CONFIG_JFFS2_SUMMARY=y -+CONFIG_UBIFS_FS=m -+CONFIG_SQUASHFS=m -+CONFIG_SQUASHFS_XATTR=y -+CONFIG_SQUASHFS_LZO=y -+CONFIG_SQUASHFS_XZ=y -+CONFIG_NFS_FS=y -+CONFIG_NFS_V3_ACL=y -+CONFIG_NFS_V4=y -+CONFIG_NFS_SWAP=y -+CONFIG_ROOT_NFS=y -+CONFIG_NFS_FSCACHE=y -+CONFIG_NFSD=m -+CONFIG_NFSD_V3_ACL=y -+CONFIG_NFSD_V4=y -+CONFIG_CIFS=m -+CONFIG_CIFS_WEAK_PW_HASH=y -+CONFIG_CIFS_UPCALL=y -+CONFIG_CIFS_XATTR=y -+CONFIG_CIFS_POSIX=y -+CONFIG_CIFS_ACL=y -+CONFIG_CIFS_DFS_UPCALL=y -+CONFIG_CIFS_SMB2=y -+CONFIG_CIFS_FSCACHE=y -+CONFIG_9P_FS=m -+CONFIG_9P_FS_POSIX_ACL=y -+CONFIG_NLS_DEFAULT="utf8" -+CONFIG_NLS_CODEPAGE_437=y -+CONFIG_NLS_CODEPAGE_737=m -+CONFIG_NLS_CODEPAGE_775=m -+CONFIG_NLS_CODEPAGE_850=m -+CONFIG_NLS_CODEPAGE_852=m -+CONFIG_NLS_CODEPAGE_855=m -+CONFIG_NLS_CODEPAGE_857=m -+CONFIG_NLS_CODEPAGE_860=m -+CONFIG_NLS_CODEPAGE_861=m -+CONFIG_NLS_CODEPAGE_862=m -+CONFIG_NLS_CODEPAGE_863=m -+CONFIG_NLS_CODEPAGE_864=m -+CONFIG_NLS_CODEPAGE_865=m -+CONFIG_NLS_CODEPAGE_866=m -+CONFIG_NLS_CODEPAGE_869=m -+CONFIG_NLS_CODEPAGE_936=m -+CONFIG_NLS_CODEPAGE_950=m -+CONFIG_NLS_CODEPAGE_932=m -+CONFIG_NLS_CODEPAGE_949=m -+CONFIG_NLS_CODEPAGE_874=m -+CONFIG_NLS_ISO8859_8=m -+CONFIG_NLS_CODEPAGE_1250=m -+CONFIG_NLS_CODEPAGE_1251=m -+CONFIG_NLS_ASCII=y -+CONFIG_NLS_ISO8859_1=m -+CONFIG_NLS_ISO8859_2=m -+CONFIG_NLS_ISO8859_3=m -+CONFIG_NLS_ISO8859_4=m -+CONFIG_NLS_ISO8859_5=m -+CONFIG_NLS_ISO8859_6=m -+CONFIG_NLS_ISO8859_7=m -+CONFIG_NLS_ISO8859_9=m -+CONFIG_NLS_ISO8859_13=m -+CONFIG_NLS_ISO8859_14=m -+CONFIG_NLS_ISO8859_15=m -+CONFIG_NLS_KOI8_R=m -+CONFIG_NLS_KOI8_U=m -+CONFIG_DLM=m -+CONFIG_PRINTK_TIME=y -+CONFIG_BOOT_PRINTK_DELAY=y -+CONFIG_DEBUG_MEMORY_INIT=y -+CONFIG_DETECT_HUNG_TASK=y -+CONFIG_TIMER_STATS=y -+CONFIG_IRQSOFF_TRACER=y -+CONFIG_SCHED_TRACER=y -+CONFIG_STACK_TRACER=y -+CONFIG_BLK_DEV_IO_TRACE=y -+# CONFIG_KPROBE_EVENT is not set -+CONFIG_FUNCTION_PROFILER=y -+CONFIG_KGDB=y -+CONFIG_KGDB_KDB=y -+CONFIG_KDB_KEYBOARD=y -+CONFIG_CRYPTO_USER=m -+CONFIG_CRYPTO_CBC=y -+CONFIG_CRYPTO_CTS=m -+CONFIG_CRYPTO_XTS=m -+CONFIG_CRYPTO_XCBC=m -+CONFIG_CRYPTO_TGR192=m -+CONFIG_CRYPTO_WP512=m -+CONFIG_CRYPTO_CAST5=m -+CONFIG_CRYPTO_DES=y -+CONFIG_CRYPTO_USER_API_SKCIPHER=m -+# CONFIG_CRYPTO_HW is not set -+CONFIG_ARM_CRYPTO=y -+CONFIG_CRYPTO_SHA1_ARM_NEON=m -+CONFIG_CRYPTO_AES_ARM_BS=m -+CONFIG_CRC_ITU_T=y -+CONFIG_LIBCRC32C=y -diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig -new file mode 100644 -index 0000000..1d1b799 ---- /dev/null -+++ b/arch/arm/configs/bcmrpi_defconfig -@@ -0,0 +1,1265 @@ -+# CONFIG_ARM_PATCH_PHYS_VIRT is not set -+CONFIG_PHYS_OFFSET=0 -+# CONFIG_LOCALVERSION_AUTO is not set -+CONFIG_SYSVIPC=y -+CONFIG_POSIX_MQUEUE=y -+CONFIG_FHANDLE=y -+CONFIG_NO_HZ=y -+CONFIG_HIGH_RES_TIMERS=y -+CONFIG_BSD_PROCESS_ACCT=y -+CONFIG_BSD_PROCESS_ACCT_V3=y -+CONFIG_TASKSTATS=y -+CONFIG_TASK_DELAY_ACCT=y -+CONFIG_TASK_XACCT=y -+CONFIG_TASK_IO_ACCOUNTING=y -+CONFIG_IKCONFIG=m -+CONFIG_IKCONFIG_PROC=y -+CONFIG_CGROUP_FREEZER=y -+CONFIG_CGROUP_DEVICE=y -+CONFIG_CPUSETS=y -+CONFIG_CGROUP_CPUACCT=y -+CONFIG_MEMCG=y -+CONFIG_BLK_CGROUP=y -+CONFIG_NAMESPACES=y -+CONFIG_SCHED_AUTOGROUP=y -+CONFIG_BLK_DEV_INITRD=y -+CONFIG_EMBEDDED=y -+# CONFIG_COMPAT_BRK is not set -+CONFIG_PROFILING=y -+CONFIG_OPROFILE=m -+CONFIG_KPROBES=y -+CONFIG_JUMP_LABEL=y -+CONFIG_MODULES=y -+CONFIG_MODULE_UNLOAD=y -+CONFIG_MODVERSIONS=y -+CONFIG_MODULE_SRCVERSION_ALL=y -+CONFIG_BLK_DEV_THROTTLING=y -+CONFIG_PARTITION_ADVANCED=y -+CONFIG_MAC_PARTITION=y -+CONFIG_CFQ_GROUP_IOSCHED=y -+CONFIG_ARCH_BCM2708=y -+CONFIG_PREEMPT_VOLUNTARY=y -+CONFIG_AEABI=y -+CONFIG_OABI_COMPAT=y -+# CONFIG_CPU_SW_DOMAIN_PAN is not set -+CONFIG_CLEANCACHE=y -+CONFIG_FRONTSWAP=y -+CONFIG_CMA=y -+CONFIG_ZSMALLOC=m -+CONFIG_PGTABLE_MAPPING=y -+CONFIG_UACCESS_WITH_MEMCPY=y -+CONFIG_SECCOMP=y -+# CONFIG_ATAGS is not set -+CONFIG_ZBOOT_ROM_TEXT=0x0 -+CONFIG_ZBOOT_ROM_BSS=0x0 -+CONFIG_CMDLINE="console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait" -+CONFIG_CPU_FREQ=y -+CONFIG_CPU_FREQ_STAT=m -+CONFIG_CPU_FREQ_STAT_DETAILS=y -+CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE=y -+CONFIG_CPU_FREQ_GOV_PERFORMANCE=y -+CONFIG_CPU_FREQ_GOV_USERSPACE=y -+CONFIG_CPU_FREQ_GOV_ONDEMAND=y -+CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y -+CONFIG_VFP=y -+CONFIG_BINFMT_MISC=m -+# CONFIG_SUSPEND is not set -+CONFIG_NET=y -+CONFIG_PACKET=y -+CONFIG_UNIX=y -+CONFIG_XFRM_USER=y -+CONFIG_NET_KEY=m -+CONFIG_INET=y -+CONFIG_IP_MULTICAST=y -+CONFIG_IP_ADVANCED_ROUTER=y -+CONFIG_IP_MULTIPLE_TABLES=y -+CONFIG_IP_ROUTE_MULTIPATH=y -+CONFIG_IP_ROUTE_VERBOSE=y -+CONFIG_IP_PNP=y -+CONFIG_IP_PNP_DHCP=y -+CONFIG_IP_PNP_RARP=y -+CONFIG_NET_IPIP=m -+CONFIG_NET_IPGRE_DEMUX=m -+CONFIG_NET_IPGRE=m -+CONFIG_IP_MROUTE=y -+CONFIG_IP_MROUTE_MULTIPLE_TABLES=y -+CONFIG_IP_PIMSM_V1=y -+CONFIG_IP_PIMSM_V2=y -+CONFIG_SYN_COOKIES=y -+CONFIG_INET_AH=m -+CONFIG_INET_ESP=m -+CONFIG_INET_IPCOMP=m -+CONFIG_INET_XFRM_MODE_TRANSPORT=m -+CONFIG_INET_XFRM_MODE_TUNNEL=m -+CONFIG_INET_XFRM_MODE_BEET=m -+CONFIG_INET_LRO=m -+CONFIG_INET_DIAG=m -+CONFIG_INET6_AH=m -+CONFIG_INET6_ESP=m -+CONFIG_INET6_IPCOMP=m -+CONFIG_IPV6_TUNNEL=m -+CONFIG_IPV6_MULTIPLE_TABLES=y -+CONFIG_IPV6_MROUTE=y -+CONFIG_IPV6_MROUTE_MULTIPLE_TABLES=y -+CONFIG_IPV6_PIMSM_V2=y -+CONFIG_NETFILTER=y -+CONFIG_NF_CONNTRACK=m -+CONFIG_NF_CONNTRACK_ZONES=y -+CONFIG_NF_CONNTRACK_EVENTS=y -+CONFIG_NF_CONNTRACK_TIMESTAMP=y -+CONFIG_NF_CT_PROTO_DCCP=m -+CONFIG_NF_CT_PROTO_UDPLITE=m -+CONFIG_NF_CONNTRACK_AMANDA=m -+CONFIG_NF_CONNTRACK_FTP=m -+CONFIG_NF_CONNTRACK_H323=m -+CONFIG_NF_CONNTRACK_IRC=m -+CONFIG_NF_CONNTRACK_NETBIOS_NS=m -+CONFIG_NF_CONNTRACK_SNMP=m -+CONFIG_NF_CONNTRACK_PPTP=m -+CONFIG_NF_CONNTRACK_SANE=m -+CONFIG_NF_CONNTRACK_SIP=m -+CONFIG_NF_CONNTRACK_TFTP=m -+CONFIG_NF_CT_NETLINK=m -+CONFIG_NETFILTER_XT_SET=m -+CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m -+CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m -+CONFIG_NETFILTER_XT_TARGET_CONNMARK=m -+CONFIG_NETFILTER_XT_TARGET_DSCP=m -+CONFIG_NETFILTER_XT_TARGET_HMARK=m -+CONFIG_NETFILTER_XT_TARGET_IDLETIMER=m -+CONFIG_NETFILTER_XT_TARGET_LED=m -+CONFIG_NETFILTER_XT_TARGET_LOG=m -+CONFIG_NETFILTER_XT_TARGET_MARK=m -+CONFIG_NETFILTER_XT_TARGET_NFLOG=m -+CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m -+CONFIG_NETFILTER_XT_TARGET_NOTRACK=m -+CONFIG_NETFILTER_XT_TARGET_TEE=m -+CONFIG_NETFILTER_XT_TARGET_TPROXY=m -+CONFIG_NETFILTER_XT_TARGET_TRACE=m -+CONFIG_NETFILTER_XT_TARGET_TCPMSS=m -+CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP=m -+CONFIG_NETFILTER_XT_MATCH_ADDRTYPE=m -+CONFIG_NETFILTER_XT_MATCH_BPF=m -+CONFIG_NETFILTER_XT_MATCH_CLUSTER=m -+CONFIG_NETFILTER_XT_MATCH_COMMENT=m -+CONFIG_NETFILTER_XT_MATCH_CONNBYTES=m -+CONFIG_NETFILTER_XT_MATCH_CONNLABEL=m -+CONFIG_NETFILTER_XT_MATCH_CONNLIMIT=m -+CONFIG_NETFILTER_XT_MATCH_CONNMARK=m -+CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m -+CONFIG_NETFILTER_XT_MATCH_CPU=m -+CONFIG_NETFILTER_XT_MATCH_DCCP=m -+CONFIG_NETFILTER_XT_MATCH_DEVGROUP=m -+CONFIG_NETFILTER_XT_MATCH_DSCP=m -+CONFIG_NETFILTER_XT_MATCH_ESP=m -+CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=m -+CONFIG_NETFILTER_XT_MATCH_HELPER=m -+CONFIG_NETFILTER_XT_MATCH_IPRANGE=m -+CONFIG_NETFILTER_XT_MATCH_IPVS=m -+CONFIG_NETFILTER_XT_MATCH_LENGTH=m -+CONFIG_NETFILTER_XT_MATCH_LIMIT=m -+CONFIG_NETFILTER_XT_MATCH_MAC=m -+CONFIG_NETFILTER_XT_MATCH_MARK=m -+CONFIG_NETFILTER_XT_MATCH_MULTIPORT=m -+CONFIG_NETFILTER_XT_MATCH_NFACCT=m -+CONFIG_NETFILTER_XT_MATCH_OSF=m -+CONFIG_NETFILTER_XT_MATCH_OWNER=m -+CONFIG_NETFILTER_XT_MATCH_POLICY=m -+CONFIG_NETFILTER_XT_MATCH_PHYSDEV=m -+CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m -+CONFIG_NETFILTER_XT_MATCH_QUOTA=m -+CONFIG_NETFILTER_XT_MATCH_RATEEST=m -+CONFIG_NETFILTER_XT_MATCH_REALM=m -+CONFIG_NETFILTER_XT_MATCH_RECENT=m -+CONFIG_NETFILTER_XT_MATCH_SOCKET=m -+CONFIG_NETFILTER_XT_MATCH_STATE=m -+CONFIG_NETFILTER_XT_MATCH_STATISTIC=m -+CONFIG_NETFILTER_XT_MATCH_STRING=m -+CONFIG_NETFILTER_XT_MATCH_TCPMSS=m -+CONFIG_NETFILTER_XT_MATCH_TIME=m -+CONFIG_NETFILTER_XT_MATCH_U32=m -+CONFIG_IP_SET=m -+CONFIG_IP_SET_BITMAP_IP=m -+CONFIG_IP_SET_BITMAP_IPMAC=m -+CONFIG_IP_SET_BITMAP_PORT=m -+CONFIG_IP_SET_HASH_IP=m -+CONFIG_IP_SET_HASH_IPPORT=m -+CONFIG_IP_SET_HASH_IPPORTIP=m -+CONFIG_IP_SET_HASH_IPPORTNET=m -+CONFIG_IP_SET_HASH_NET=m -+CONFIG_IP_SET_HASH_NETPORT=m -+CONFIG_IP_SET_HASH_NETIFACE=m -+CONFIG_IP_SET_LIST_SET=m -+CONFIG_IP_VS=m -+CONFIG_IP_VS_PROTO_TCP=y -+CONFIG_IP_VS_PROTO_UDP=y -+CONFIG_IP_VS_PROTO_ESP=y -+CONFIG_IP_VS_PROTO_AH=y -+CONFIG_IP_VS_PROTO_SCTP=y -+CONFIG_IP_VS_RR=m -+CONFIG_IP_VS_WRR=m -+CONFIG_IP_VS_LC=m -+CONFIG_IP_VS_WLC=m -+CONFIG_IP_VS_LBLC=m -+CONFIG_IP_VS_LBLCR=m -+CONFIG_IP_VS_DH=m -+CONFIG_IP_VS_SH=m -+CONFIG_IP_VS_SED=m -+CONFIG_IP_VS_NQ=m -+CONFIG_IP_VS_FTP=m -+CONFIG_IP_VS_PE_SIP=m -+CONFIG_NF_CONNTRACK_IPV4=m -+CONFIG_IP_NF_IPTABLES=m -+CONFIG_IP_NF_MATCH_AH=m -+CONFIG_IP_NF_MATCH_ECN=m -+CONFIG_IP_NF_MATCH_TTL=m -+CONFIG_IP_NF_FILTER=m -+CONFIG_IP_NF_TARGET_REJECT=m -+CONFIG_IP_NF_NAT=m -+CONFIG_IP_NF_TARGET_MASQUERADE=m -+CONFIG_IP_NF_TARGET_NETMAP=m -+CONFIG_IP_NF_TARGET_REDIRECT=m -+CONFIG_IP_NF_MANGLE=m -+CONFIG_IP_NF_TARGET_CLUSTERIP=m -+CONFIG_IP_NF_TARGET_ECN=m -+CONFIG_IP_NF_TARGET_TTL=m -+CONFIG_IP_NF_RAW=m -+CONFIG_IP_NF_ARPTABLES=m -+CONFIG_IP_NF_ARPFILTER=m -+CONFIG_IP_NF_ARP_MANGLE=m -+CONFIG_NF_CONNTRACK_IPV6=m -+CONFIG_IP6_NF_IPTABLES=m -+CONFIG_IP6_NF_MATCH_AH=m -+CONFIG_IP6_NF_MATCH_EUI64=m -+CONFIG_IP6_NF_MATCH_FRAG=m -+CONFIG_IP6_NF_MATCH_OPTS=m -+CONFIG_IP6_NF_MATCH_HL=m -+CONFIG_IP6_NF_MATCH_IPV6HEADER=m -+CONFIG_IP6_NF_MATCH_MH=m -+CONFIG_IP6_NF_MATCH_RT=m -+CONFIG_IP6_NF_TARGET_HL=m -+CONFIG_IP6_NF_FILTER=m -+CONFIG_IP6_NF_TARGET_REJECT=m -+CONFIG_IP6_NF_MANGLE=m -+CONFIG_IP6_NF_RAW=m -+CONFIG_IP6_NF_NAT=m -+CONFIG_IP6_NF_TARGET_MASQUERADE=m -+CONFIG_IP6_NF_TARGET_NPT=m -+CONFIG_BRIDGE_NF_EBTABLES=m -+CONFIG_BRIDGE_EBT_BROUTE=m -+CONFIG_BRIDGE_EBT_T_FILTER=m -+CONFIG_BRIDGE_EBT_T_NAT=m -+CONFIG_BRIDGE_EBT_802_3=m -+CONFIG_BRIDGE_EBT_AMONG=m -+CONFIG_BRIDGE_EBT_ARP=m -+CONFIG_BRIDGE_EBT_IP=m -+CONFIG_BRIDGE_EBT_IP6=m -+CONFIG_BRIDGE_EBT_LIMIT=m -+CONFIG_BRIDGE_EBT_MARK=m -+CONFIG_BRIDGE_EBT_PKTTYPE=m -+CONFIG_BRIDGE_EBT_STP=m -+CONFIG_BRIDGE_EBT_VLAN=m -+CONFIG_BRIDGE_EBT_ARPREPLY=m -+CONFIG_BRIDGE_EBT_DNAT=m -+CONFIG_BRIDGE_EBT_MARK_T=m -+CONFIG_BRIDGE_EBT_REDIRECT=m -+CONFIG_BRIDGE_EBT_SNAT=m -+CONFIG_BRIDGE_EBT_LOG=m -+CONFIG_BRIDGE_EBT_NFLOG=m -+CONFIG_SCTP_COOKIE_HMAC_SHA1=y -+CONFIG_ATM=m -+CONFIG_L2TP=m -+CONFIG_L2TP_V3=y -+CONFIG_L2TP_IP=m -+CONFIG_L2TP_ETH=m -+CONFIG_BRIDGE=m -+CONFIG_VLAN_8021Q=m -+CONFIG_VLAN_8021Q_GVRP=y -+CONFIG_ATALK=m -+CONFIG_6LOWPAN=m -+CONFIG_IEEE802154=m -+CONFIG_IEEE802154_6LOWPAN=m -+CONFIG_MAC802154=m -+CONFIG_NET_SCHED=y -+CONFIG_NET_SCH_CBQ=m -+CONFIG_NET_SCH_HTB=m -+CONFIG_NET_SCH_HFSC=m -+CONFIG_NET_SCH_PRIO=m -+CONFIG_NET_SCH_MULTIQ=m -+CONFIG_NET_SCH_RED=m -+CONFIG_NET_SCH_SFB=m -+CONFIG_NET_SCH_SFQ=m -+CONFIG_NET_SCH_TEQL=m -+CONFIG_NET_SCH_TBF=m -+CONFIG_NET_SCH_GRED=m -+CONFIG_NET_SCH_DSMARK=m -+CONFIG_NET_SCH_NETEM=m -+CONFIG_NET_SCH_DRR=m -+CONFIG_NET_SCH_MQPRIO=m -+CONFIG_NET_SCH_CHOKE=m -+CONFIG_NET_SCH_QFQ=m -+CONFIG_NET_SCH_CODEL=m -+CONFIG_NET_SCH_FQ_CODEL=m -+CONFIG_NET_SCH_INGRESS=m -+CONFIG_NET_SCH_PLUG=m -+CONFIG_NET_CLS_BASIC=m -+CONFIG_NET_CLS_TCINDEX=m -+CONFIG_NET_CLS_ROUTE4=m -+CONFIG_NET_CLS_FW=m -+CONFIG_NET_CLS_U32=m -+CONFIG_CLS_U32_MARK=y -+CONFIG_NET_CLS_RSVP=m -+CONFIG_NET_CLS_RSVP6=m -+CONFIG_NET_CLS_FLOW=m -+CONFIG_NET_CLS_CGROUP=m -+CONFIG_NET_EMATCH=y -+CONFIG_NET_EMATCH_CMP=m -+CONFIG_NET_EMATCH_NBYTE=m -+CONFIG_NET_EMATCH_U32=m -+CONFIG_NET_EMATCH_META=m -+CONFIG_NET_EMATCH_TEXT=m -+CONFIG_NET_EMATCH_IPSET=m -+CONFIG_NET_CLS_ACT=y -+CONFIG_NET_ACT_POLICE=m -+CONFIG_NET_ACT_GACT=m -+CONFIG_GACT_PROB=y -+CONFIG_NET_ACT_MIRRED=m -+CONFIG_NET_ACT_IPT=m -+CONFIG_NET_ACT_NAT=m -+CONFIG_NET_ACT_PEDIT=m -+CONFIG_NET_ACT_SIMP=m -+CONFIG_NET_ACT_SKBEDIT=m -+CONFIG_NET_ACT_CSUM=m -+CONFIG_BATMAN_ADV=m -+CONFIG_OPENVSWITCH=m -+CONFIG_NET_PKTGEN=m -+CONFIG_HAMRADIO=y -+CONFIG_AX25=m -+CONFIG_NETROM=m -+CONFIG_ROSE=m -+CONFIG_MKISS=m -+CONFIG_6PACK=m -+CONFIG_BPQETHER=m -+CONFIG_BAYCOM_SER_FDX=m -+CONFIG_BAYCOM_SER_HDX=m -+CONFIG_YAM=m -+CONFIG_CAN=m -+CONFIG_CAN_VCAN=m -+CONFIG_CAN_MCP251X=m -+CONFIG_IRDA=m -+CONFIG_IRLAN=m -+CONFIG_IRNET=m -+CONFIG_IRCOMM=m -+CONFIG_IRDA_ULTRA=y -+CONFIG_IRDA_CACHE_LAST_LSAP=y -+CONFIG_IRDA_FAST_RR=y -+CONFIG_IRTTY_SIR=m -+CONFIG_KINGSUN_DONGLE=m -+CONFIG_KSDAZZLE_DONGLE=m -+CONFIG_KS959_DONGLE=m -+CONFIG_USB_IRDA=m -+CONFIG_SIGMATEL_FIR=m -+CONFIG_MCS_FIR=m -+CONFIG_BT=m -+CONFIG_BT_RFCOMM=m -+CONFIG_BT_RFCOMM_TTY=y -+CONFIG_BT_BNEP=m -+CONFIG_BT_BNEP_MC_FILTER=y -+CONFIG_BT_BNEP_PROTO_FILTER=y -+CONFIG_BT_HIDP=m -+CONFIG_BT_6LOWPAN=m -+CONFIG_BT_HCIBTUSB=m -+CONFIG_BT_HCIUART=m -+CONFIG_BT_HCIBCM203X=m -+CONFIG_BT_HCIBPA10X=m -+CONFIG_BT_HCIBFUSB=m -+CONFIG_BT_HCIVHCI=m -+CONFIG_BT_MRVL=m -+CONFIG_BT_MRVL_SDIO=m -+CONFIG_BT_ATH3K=m -+CONFIG_BT_WILINK=m -+CONFIG_MAC80211=m -+CONFIG_MAC80211_MESH=y -+CONFIG_WIMAX=m -+CONFIG_RFKILL=m -+CONFIG_RFKILL_INPUT=y -+CONFIG_NET_9P=m -+CONFIG_NFC=m -+CONFIG_NFC_PN533=m -+CONFIG_DEVTMPFS=y -+CONFIG_DEVTMPFS_MOUNT=y -+CONFIG_DMA_CMA=y -+CONFIG_CMA_SIZE_MBYTES=5 -+CONFIG_MTD=m -+CONFIG_MTD_BLOCK=m -+CONFIG_MTD_NAND=m -+CONFIG_MTD_UBI=m -+CONFIG_ZRAM=m -+CONFIG_ZRAM_LZ4_COMPRESS=y -+CONFIG_BLK_DEV_LOOP=y -+CONFIG_BLK_DEV_CRYPTOLOOP=m -+CONFIG_BLK_DEV_DRBD=m -+CONFIG_BLK_DEV_NBD=m -+CONFIG_BLK_DEV_RAM=y -+CONFIG_CDROM_PKTCDVD=m -+CONFIG_ATA_OVER_ETH=m -+CONFIG_EEPROM_AT24=m -+CONFIG_TI_ST=m -+CONFIG_SCSI=y -+# CONFIG_SCSI_PROC_FS is not set -+CONFIG_BLK_DEV_SD=y -+CONFIG_CHR_DEV_ST=m -+CONFIG_CHR_DEV_OSST=m -+CONFIG_BLK_DEV_SR=m -+CONFIG_CHR_DEV_SG=m -+CONFIG_SCSI_ISCSI_ATTRS=y -+CONFIG_ISCSI_TCP=m -+CONFIG_ISCSI_BOOT_SYSFS=m -+CONFIG_MD=y -+CONFIG_MD_LINEAR=m -+CONFIG_MD_RAID0=m -+CONFIG_BLK_DEV_DM=m -+CONFIG_DM_CRYPT=m -+CONFIG_DM_SNAPSHOT=m -+CONFIG_DM_THIN_PROVISIONING=m -+CONFIG_DM_MIRROR=m -+CONFIG_DM_LOG_USERSPACE=m -+CONFIG_DM_RAID=m -+CONFIG_DM_ZERO=m -+CONFIG_DM_DELAY=m -+CONFIG_NETDEVICES=y -+CONFIG_BONDING=m -+CONFIG_DUMMY=m -+CONFIG_IFB=m -+CONFIG_MACVLAN=m -+CONFIG_NETCONSOLE=m -+CONFIG_TUN=m -+CONFIG_VETH=m -+CONFIG_ENC28J60=m -+CONFIG_MDIO_BITBANG=m -+CONFIG_PPP=m -+CONFIG_PPP_BSDCOMP=m -+CONFIG_PPP_DEFLATE=m -+CONFIG_PPP_FILTER=y -+CONFIG_PPP_MPPE=m -+CONFIG_PPP_MULTILINK=y -+CONFIG_PPPOATM=m -+CONFIG_PPPOE=m -+CONFIG_PPPOL2TP=m -+CONFIG_PPP_ASYNC=m -+CONFIG_PPP_SYNC_TTY=m -+CONFIG_SLIP=m -+CONFIG_SLIP_COMPRESSED=y -+CONFIG_SLIP_SMART=y -+CONFIG_USB_CATC=m -+CONFIG_USB_KAWETH=m -+CONFIG_USB_PEGASUS=m -+CONFIG_USB_RTL8150=m -+CONFIG_USB_RTL8152=m -+CONFIG_USB_USBNET=y -+CONFIG_USB_NET_AX8817X=m -+CONFIG_USB_NET_AX88179_178A=m -+CONFIG_USB_NET_CDCETHER=m -+CONFIG_USB_NET_CDC_EEM=m -+CONFIG_USB_NET_CDC_NCM=m -+CONFIG_USB_NET_HUAWEI_CDC_NCM=m -+CONFIG_USB_NET_CDC_MBIM=m -+CONFIG_USB_NET_DM9601=m -+CONFIG_USB_NET_SR9700=m -+CONFIG_USB_NET_SR9800=m -+CONFIG_USB_NET_SMSC75XX=m -+CONFIG_USB_NET_SMSC95XX=y -+CONFIG_USB_NET_GL620A=m -+CONFIG_USB_NET_NET1080=m -+CONFIG_USB_NET_PLUSB=m -+CONFIG_USB_NET_MCS7830=m -+CONFIG_USB_NET_CDC_SUBSET=m -+CONFIG_USB_ALI_M5632=y -+CONFIG_USB_AN2720=y -+CONFIG_USB_EPSON2888=y -+CONFIG_USB_KC2190=y -+CONFIG_USB_NET_ZAURUS=m -+CONFIG_USB_NET_CX82310_ETH=m -+CONFIG_USB_NET_KALMIA=m -+CONFIG_USB_NET_QMI_WWAN=m -+CONFIG_USB_HSO=m -+CONFIG_USB_NET_INT51X1=m -+CONFIG_USB_IPHETH=m -+CONFIG_USB_SIERRA_NET=m -+CONFIG_USB_VL600=m -+CONFIG_LIBERTAS_THINFIRM=m -+CONFIG_LIBERTAS_THINFIRM_USB=m -+CONFIG_AT76C50X_USB=m -+CONFIG_USB_ZD1201=m -+CONFIG_USB_NET_RNDIS_WLAN=m -+CONFIG_RTL8187=m -+CONFIG_MAC80211_HWSIM=m -+CONFIG_ATH_CARDS=m -+CONFIG_ATH9K=m -+CONFIG_ATH9K_HTC=m -+CONFIG_CARL9170=m -+CONFIG_ATH6KL=m -+CONFIG_ATH6KL_USB=m -+CONFIG_AR5523=m -+CONFIG_B43=m -+# CONFIG_B43_PHY_N is not set -+CONFIG_B43LEGACY=m -+CONFIG_BRCMFMAC=m -+CONFIG_BRCMFMAC_USB=y -+CONFIG_HOSTAP=m -+CONFIG_LIBERTAS=m -+CONFIG_LIBERTAS_USB=m -+CONFIG_LIBERTAS_SDIO=m -+CONFIG_P54_COMMON=m -+CONFIG_P54_USB=m -+CONFIG_RT2X00=m -+CONFIG_RT2500USB=m -+CONFIG_RT73USB=m -+CONFIG_RT2800USB=m -+CONFIG_RT2800USB_RT3573=y -+CONFIG_RT2800USB_RT53XX=y -+CONFIG_RT2800USB_RT55XX=y -+CONFIG_RT2800USB_UNKNOWN=y -+CONFIG_WL_MEDIATEK=y -+CONFIG_MT7601U=m -+CONFIG_RTL8192CU=m -+CONFIG_ZD1211RW=m -+CONFIG_MWIFIEX=m -+CONFIG_MWIFIEX_SDIO=m -+CONFIG_WIMAX_I2400M_USB=m -+CONFIG_IEEE802154_AT86RF230=m -+CONFIG_IEEE802154_MRF24J40=m -+CONFIG_IEEE802154_CC2520=m -+CONFIG_INPUT_POLLDEV=m -+# CONFIG_INPUT_MOUSEDEV_PSAUX is not set -+CONFIG_INPUT_JOYDEV=m -+CONFIG_INPUT_EVDEV=m -+# CONFIG_KEYBOARD_ATKBD is not set -+CONFIG_KEYBOARD_GPIO=m -+# CONFIG_INPUT_MOUSE is not set -+CONFIG_INPUT_JOYSTICK=y -+CONFIG_JOYSTICK_IFORCE=m -+CONFIG_JOYSTICK_IFORCE_USB=y -+CONFIG_JOYSTICK_XPAD=m -+CONFIG_JOYSTICK_XPAD_FF=y -+CONFIG_JOYSTICK_RPISENSE=m -+CONFIG_INPUT_TOUCHSCREEN=y -+CONFIG_TOUCHSCREEN_ADS7846=m -+CONFIG_TOUCHSCREEN_EGALAX=m -+CONFIG_TOUCHSCREEN_FT6236=m -+CONFIG_TOUCHSCREEN_RPI_FT5406=m -+CONFIG_TOUCHSCREEN_USB_COMPOSITE=m -+CONFIG_TOUCHSCREEN_STMPE=m -+CONFIG_INPUT_MISC=y -+CONFIG_INPUT_AD714X=m -+CONFIG_INPUT_ATI_REMOTE2=m -+CONFIG_INPUT_KEYSPAN_REMOTE=m -+CONFIG_INPUT_POWERMATE=m -+CONFIG_INPUT_YEALINK=m -+CONFIG_INPUT_CM109=m -+CONFIG_INPUT_UINPUT=m -+CONFIG_INPUT_GPIO_ROTARY_ENCODER=m -+CONFIG_INPUT_ADXL34X=m -+CONFIG_INPUT_CMA3000=m -+CONFIG_SERIO=m -+CONFIG_SERIO_RAW=m -+CONFIG_GAMEPORT=m -+CONFIG_GAMEPORT_NS558=m -+CONFIG_GAMEPORT_L4=m -+CONFIG_BRCM_CHAR_DRIVERS=y -+CONFIG_BCM_VC_CMA=y -+CONFIG_BCM_VCIO=y -+CONFIG_BCM_VC_SM=y -+CONFIG_DEVPTS_MULTIPLE_INSTANCES=y -+# CONFIG_LEGACY_PTYS is not set -+# CONFIG_DEVKMEM is not set -+CONFIG_SERIAL_8250=y -+# CONFIG_SERIAL_8250_DEPRECATED_OPTIONS is not set -+CONFIG_SERIAL_8250_CONSOLE=y -+# CONFIG_SERIAL_8250_DMA is not set -+CONFIG_SERIAL_8250_NR_UARTS=1 -+CONFIG_SERIAL_8250_RUNTIME_UARTS=0 -+CONFIG_SERIAL_AMBA_PL011=y -+CONFIG_SERIAL_AMBA_PL011_CONSOLE=y -+CONFIG_SERIAL_OF_PLATFORM=y -+CONFIG_TTY_PRINTK=y -+CONFIG_HW_RANDOM=y -+CONFIG_RAW_DRIVER=y -+CONFIG_I2C=y -+CONFIG_I2C_CHARDEV=m -+CONFIG_I2C_BCM2708=m -+CONFIG_SPI=y -+CONFIG_SPI_BCM2835=m -+CONFIG_SPI_SPIDEV=y -+CONFIG_PPS=m -+CONFIG_PPS_CLIENT_LDISC=m -+CONFIG_PPS_CLIENT_GPIO=m -+CONFIG_GPIO_SYSFS=y -+CONFIG_GPIO_ARIZONA=m -+CONFIG_GPIO_STMPE=y -+CONFIG_W1=m -+CONFIG_W1_MASTER_DS2490=m -+CONFIG_W1_MASTER_DS2482=m -+CONFIG_W1_MASTER_DS1WM=m -+CONFIG_W1_MASTER_GPIO=m -+CONFIG_W1_SLAVE_THERM=m -+CONFIG_W1_SLAVE_SMEM=m -+CONFIG_W1_SLAVE_DS2408=m -+CONFIG_W1_SLAVE_DS2413=m -+CONFIG_W1_SLAVE_DS2406=m -+CONFIG_W1_SLAVE_DS2423=m -+CONFIG_W1_SLAVE_DS2431=m -+CONFIG_W1_SLAVE_DS2433=m -+CONFIG_W1_SLAVE_DS2760=m -+CONFIG_W1_SLAVE_DS2780=m -+CONFIG_W1_SLAVE_DS2781=m -+CONFIG_W1_SLAVE_DS28E04=m -+CONFIG_W1_SLAVE_BQ27000=m -+CONFIG_BATTERY_DS2760=m -+CONFIG_POWER_RESET=y -+CONFIG_POWER_RESET_GPIO=y -+CONFIG_HWMON=m -+CONFIG_SENSORS_SHT21=m -+CONFIG_SENSORS_SHTC1=m -+CONFIG_THERMAL=y -+CONFIG_THERMAL_BCM2835=y -+CONFIG_WATCHDOG=y -+CONFIG_BCM2835_WDT=m -+CONFIG_UCB1400_CORE=m -+CONFIG_MFD_STMPE=y -+CONFIG_STMPE_SPI=y -+CONFIG_MFD_ARIZONA_I2C=m -+CONFIG_MFD_ARIZONA_SPI=m -+CONFIG_MFD_WM5102=y -+CONFIG_MEDIA_SUPPORT=m -+CONFIG_MEDIA_CAMERA_SUPPORT=y -+CONFIG_MEDIA_ANALOG_TV_SUPPORT=y -+CONFIG_MEDIA_DIGITAL_TV_SUPPORT=y -+CONFIG_MEDIA_RADIO_SUPPORT=y -+CONFIG_MEDIA_RC_SUPPORT=y -+CONFIG_MEDIA_CONTROLLER=y -+CONFIG_LIRC=m -+CONFIG_RC_DEVICES=y -+CONFIG_RC_ATI_REMOTE=m -+CONFIG_IR_IMON=m -+CONFIG_IR_MCEUSB=m -+CONFIG_IR_REDRAT3=m -+CONFIG_IR_STREAMZAP=m -+CONFIG_IR_IGUANA=m -+CONFIG_IR_TTUSBIR=m -+CONFIG_RC_LOOPBACK=m -+CONFIG_IR_GPIO_CIR=m -+CONFIG_MEDIA_USB_SUPPORT=y -+CONFIG_USB_VIDEO_CLASS=m -+CONFIG_USB_M5602=m -+CONFIG_USB_STV06XX=m -+CONFIG_USB_GL860=m -+CONFIG_USB_GSPCA_BENQ=m -+CONFIG_USB_GSPCA_CONEX=m -+CONFIG_USB_GSPCA_CPIA1=m -+CONFIG_USB_GSPCA_DTCS033=m -+CONFIG_USB_GSPCA_ETOMS=m -+CONFIG_USB_GSPCA_FINEPIX=m -+CONFIG_USB_GSPCA_JEILINJ=m -+CONFIG_USB_GSPCA_JL2005BCD=m -+CONFIG_USB_GSPCA_KINECT=m -+CONFIG_USB_GSPCA_KONICA=m -+CONFIG_USB_GSPCA_MARS=m -+CONFIG_USB_GSPCA_MR97310A=m -+CONFIG_USB_GSPCA_NW80X=m -+CONFIG_USB_GSPCA_OV519=m -+CONFIG_USB_GSPCA_OV534=m -+CONFIG_USB_GSPCA_OV534_9=m -+CONFIG_USB_GSPCA_PAC207=m -+CONFIG_USB_GSPCA_PAC7302=m -+CONFIG_USB_GSPCA_PAC7311=m -+CONFIG_USB_GSPCA_SE401=m -+CONFIG_USB_GSPCA_SN9C2028=m -+CONFIG_USB_GSPCA_SN9C20X=m -+CONFIG_USB_GSPCA_SONIXB=m -+CONFIG_USB_GSPCA_SONIXJ=m -+CONFIG_USB_GSPCA_SPCA500=m -+CONFIG_USB_GSPCA_SPCA501=m -+CONFIG_USB_GSPCA_SPCA505=m -+CONFIG_USB_GSPCA_SPCA506=m -+CONFIG_USB_GSPCA_SPCA508=m -+CONFIG_USB_GSPCA_SPCA561=m -+CONFIG_USB_GSPCA_SPCA1528=m -+CONFIG_USB_GSPCA_SQ905=m -+CONFIG_USB_GSPCA_SQ905C=m -+CONFIG_USB_GSPCA_SQ930X=m -+CONFIG_USB_GSPCA_STK014=m -+CONFIG_USB_GSPCA_STK1135=m -+CONFIG_USB_GSPCA_STV0680=m -+CONFIG_USB_GSPCA_SUNPLUS=m -+CONFIG_USB_GSPCA_T613=m -+CONFIG_USB_GSPCA_TOPRO=m -+CONFIG_USB_GSPCA_TV8532=m -+CONFIG_USB_GSPCA_VC032X=m -+CONFIG_USB_GSPCA_VICAM=m -+CONFIG_USB_GSPCA_XIRLINK_CIT=m -+CONFIG_USB_GSPCA_ZC3XX=m -+CONFIG_USB_PWC=m -+CONFIG_VIDEO_CPIA2=m -+CONFIG_USB_ZR364XX=m -+CONFIG_USB_STKWEBCAM=m -+CONFIG_USB_S2255=m -+CONFIG_VIDEO_USBTV=m -+CONFIG_VIDEO_PVRUSB2=m -+CONFIG_VIDEO_HDPVR=m -+CONFIG_VIDEO_USBVISION=m -+CONFIG_VIDEO_STK1160_COMMON=m -+CONFIG_VIDEO_STK1160_AC97=y -+CONFIG_VIDEO_GO7007=m -+CONFIG_VIDEO_GO7007_USB=m -+CONFIG_VIDEO_GO7007_USB_S2250_BOARD=m -+CONFIG_VIDEO_AU0828=m -+CONFIG_VIDEO_AU0828_RC=y -+CONFIG_VIDEO_CX231XX=m -+CONFIG_VIDEO_CX231XX_ALSA=m -+CONFIG_VIDEO_CX231XX_DVB=m -+CONFIG_VIDEO_TM6000=m -+CONFIG_VIDEO_TM6000_ALSA=m -+CONFIG_VIDEO_TM6000_DVB=m -+CONFIG_DVB_USB=m -+CONFIG_DVB_USB_A800=m -+CONFIG_DVB_USB_DIBUSB_MB=m -+CONFIG_DVB_USB_DIBUSB_MB_FAULTY=y -+CONFIG_DVB_USB_DIBUSB_MC=m -+CONFIG_DVB_USB_DIB0700=m -+CONFIG_DVB_USB_UMT_010=m -+CONFIG_DVB_USB_CXUSB=m -+CONFIG_DVB_USB_M920X=m -+CONFIG_DVB_USB_DIGITV=m -+CONFIG_DVB_USB_VP7045=m -+CONFIG_DVB_USB_VP702X=m -+CONFIG_DVB_USB_GP8PSK=m -+CONFIG_DVB_USB_NOVA_T_USB2=m -+CONFIG_DVB_USB_TTUSB2=m -+CONFIG_DVB_USB_DTT200U=m -+CONFIG_DVB_USB_OPERA1=m -+CONFIG_DVB_USB_AF9005=m -+CONFIG_DVB_USB_AF9005_REMOTE=m -+CONFIG_DVB_USB_PCTV452E=m -+CONFIG_DVB_USB_DW2102=m -+CONFIG_DVB_USB_CINERGY_T2=m -+CONFIG_DVB_USB_DTV5100=m -+CONFIG_DVB_USB_FRIIO=m -+CONFIG_DVB_USB_AZ6027=m -+CONFIG_DVB_USB_TECHNISAT_USB2=m -+CONFIG_DVB_USB_V2=m -+CONFIG_DVB_USB_AF9015=m -+CONFIG_DVB_USB_AF9035=m -+CONFIG_DVB_USB_ANYSEE=m -+CONFIG_DVB_USB_AU6610=m -+CONFIG_DVB_USB_AZ6007=m -+CONFIG_DVB_USB_CE6230=m -+CONFIG_DVB_USB_EC168=m -+CONFIG_DVB_USB_GL861=m -+CONFIG_DVB_USB_LME2510=m -+CONFIG_DVB_USB_MXL111SF=m -+CONFIG_DVB_USB_RTL28XXU=m -+CONFIG_DVB_USB_DVBSKY=m -+CONFIG_SMS_USB_DRV=m -+CONFIG_DVB_B2C2_FLEXCOP_USB=m -+CONFIG_DVB_AS102=m -+CONFIG_VIDEO_EM28XX=m -+CONFIG_VIDEO_EM28XX_V4L2=m -+CONFIG_VIDEO_EM28XX_ALSA=m -+CONFIG_VIDEO_EM28XX_DVB=m -+CONFIG_V4L_PLATFORM_DRIVERS=y -+CONFIG_VIDEO_BCM2835=y -+CONFIG_VIDEO_BCM2835_MMAL=m -+CONFIG_RADIO_SI470X=y -+CONFIG_USB_SI470X=m -+CONFIG_I2C_SI470X=m -+CONFIG_RADIO_SI4713=m -+CONFIG_I2C_SI4713=m -+CONFIG_USB_MR800=m -+CONFIG_USB_DSBR=m -+CONFIG_RADIO_SHARK=m -+CONFIG_RADIO_SHARK2=m -+CONFIG_USB_KEENE=m -+CONFIG_USB_MA901=m -+CONFIG_RADIO_TEA5764=m -+CONFIG_RADIO_SAA7706H=m -+CONFIG_RADIO_TEF6862=m -+CONFIG_RADIO_WL1273=m -+CONFIG_RADIO_WL128X=m -+# CONFIG_MEDIA_SUBDRV_AUTOSELECT is not set -+CONFIG_VIDEO_UDA1342=m -+CONFIG_VIDEO_SONY_BTF_MPX=m -+CONFIG_VIDEO_TVP5150=m -+CONFIG_VIDEO_TW2804=m -+CONFIG_VIDEO_TW9903=m -+CONFIG_VIDEO_TW9906=m -+CONFIG_VIDEO_OV7640=m -+CONFIG_VIDEO_MT9V011=m -+CONFIG_FB=y -+CONFIG_FB_BCM2708=y -+CONFIG_FB_UDL=m -+CONFIG_FB_SSD1307=m -+CONFIG_FB_RPISENSE=m -+# CONFIG_BACKLIGHT_GENERIC is not set -+CONFIG_BACKLIGHT_GPIO=m -+CONFIG_FRAMEBUFFER_CONSOLE=y -+CONFIG_LOGO=y -+# CONFIG_LOGO_LINUX_MONO is not set -+# CONFIG_LOGO_LINUX_VGA16 is not set -+CONFIG_SOUND=y -+CONFIG_SND=m -+CONFIG_SND_SEQUENCER=m -+CONFIG_SND_SEQ_DUMMY=m -+CONFIG_SND_MIXER_OSS=m -+CONFIG_SND_PCM_OSS=m -+CONFIG_SND_SEQUENCER_OSS=y -+CONFIG_SND_HRTIMER=m -+CONFIG_SND_DUMMY=m -+CONFIG_SND_ALOOP=m -+CONFIG_SND_VIRMIDI=m -+CONFIG_SND_MTPAV=m -+CONFIG_SND_SERIAL_U16550=m -+CONFIG_SND_MPU401=m -+CONFIG_SND_BCM2835=m -+CONFIG_SND_USB_AUDIO=m -+CONFIG_SND_USB_UA101=m -+CONFIG_SND_USB_CAIAQ=m -+CONFIG_SND_USB_CAIAQ_INPUT=y -+CONFIG_SND_USB_6FIRE=m -+CONFIG_SND_SOC=m -+CONFIG_SND_BCM2835_SOC_I2S=m -+CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC=m -+CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS=m -+CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI=m -+CONFIG_SND_BCM2708_SOC_HIFIBERRY_AMP=m -+CONFIG_SND_BCM2708_SOC_RPI_DAC=m -+CONFIG_SND_BCM2708_SOC_RPI_PROTO=m -+CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC=m -+CONFIG_SND_BCM2708_SOC_RASPIDAC3=m -+CONFIG_SND_SOC_ADAU1701=m -+CONFIG_SND_SOC_WM8804_I2C=m -+CONFIG_SND_SIMPLE_CARD=m -+CONFIG_SOUND_PRIME=m -+CONFIG_HIDRAW=y -+CONFIG_UHID=m -+CONFIG_HID_A4TECH=m -+CONFIG_HID_ACRUX=m -+CONFIG_HID_APPLE=m -+CONFIG_HID_BELKIN=m -+CONFIG_HID_CHERRY=m -+CONFIG_HID_CHICONY=m -+CONFIG_HID_CYPRESS=m -+CONFIG_HID_DRAGONRISE=m -+CONFIG_HID_EMS_FF=m -+CONFIG_HID_ELECOM=m -+CONFIG_HID_ELO=m -+CONFIG_HID_EZKEY=m -+CONFIG_HID_HOLTEK=m -+CONFIG_HID_KEYTOUCH=m -+CONFIG_HID_KYE=m -+CONFIG_HID_UCLOGIC=m -+CONFIG_HID_WALTOP=m -+CONFIG_HID_GYRATION=m -+CONFIG_HID_TWINHAN=m -+CONFIG_HID_KENSINGTON=m -+CONFIG_HID_LCPOWER=m -+CONFIG_HID_LOGITECH=m -+CONFIG_HID_MAGICMOUSE=m -+CONFIG_HID_MICROSOFT=m -+CONFIG_HID_MONTEREY=m -+CONFIG_HID_MULTITOUCH=m -+CONFIG_HID_NTRIG=m -+CONFIG_HID_ORTEK=m -+CONFIG_HID_PANTHERLORD=m -+CONFIG_HID_PETALYNX=m -+CONFIG_HID_PICOLCD=m -+CONFIG_HID_ROCCAT=m -+CONFIG_HID_SAMSUNG=m -+CONFIG_HID_SONY=m -+CONFIG_HID_SPEEDLINK=m -+CONFIG_HID_SUNPLUS=m -+CONFIG_HID_GREENASIA=m -+CONFIG_HID_SMARTJOYPLUS=m -+CONFIG_HID_TOPSEED=m -+CONFIG_HID_THINGM=m -+CONFIG_HID_THRUSTMASTER=m -+CONFIG_HID_WACOM=m -+CONFIG_HID_WIIMOTE=m -+CONFIG_HID_XINMO=m -+CONFIG_HID_ZEROPLUS=m -+CONFIG_HID_ZYDACRON=m -+CONFIG_HID_PID=y -+CONFIG_USB_HIDDEV=y -+CONFIG_USB=y -+CONFIG_USB_ANNOUNCE_NEW_DEVICES=y -+CONFIG_USB_MON=m -+CONFIG_USB_DWCOTG=y -+CONFIG_USB_PRINTER=m -+CONFIG_USB_STORAGE=y -+CONFIG_USB_STORAGE_REALTEK=m -+CONFIG_USB_STORAGE_DATAFAB=m -+CONFIG_USB_STORAGE_FREECOM=m -+CONFIG_USB_STORAGE_ISD200=m -+CONFIG_USB_STORAGE_USBAT=m -+CONFIG_USB_STORAGE_SDDR09=m -+CONFIG_USB_STORAGE_SDDR55=m -+CONFIG_USB_STORAGE_JUMPSHOT=m -+CONFIG_USB_STORAGE_ALAUDA=m -+CONFIG_USB_STORAGE_ONETOUCH=m -+CONFIG_USB_STORAGE_KARMA=m -+CONFIG_USB_STORAGE_CYPRESS_ATACB=m -+CONFIG_USB_STORAGE_ENE_UB6250=m -+CONFIG_USB_MDC800=m -+CONFIG_USB_MICROTEK=m -+CONFIG_USBIP_CORE=m -+CONFIG_USBIP_VHCI_HCD=m -+CONFIG_USBIP_HOST=m -+CONFIG_USB_DWC2=m -+CONFIG_USB_SERIAL=m -+CONFIG_USB_SERIAL_GENERIC=y -+CONFIG_USB_SERIAL_AIRCABLE=m -+CONFIG_USB_SERIAL_ARK3116=m -+CONFIG_USB_SERIAL_BELKIN=m -+CONFIG_USB_SERIAL_CH341=m -+CONFIG_USB_SERIAL_WHITEHEAT=m -+CONFIG_USB_SERIAL_DIGI_ACCELEPORT=m -+CONFIG_USB_SERIAL_CP210X=m -+CONFIG_USB_SERIAL_CYPRESS_M8=m -+CONFIG_USB_SERIAL_EMPEG=m -+CONFIG_USB_SERIAL_FTDI_SIO=m -+CONFIG_USB_SERIAL_VISOR=m -+CONFIG_USB_SERIAL_IPAQ=m -+CONFIG_USB_SERIAL_IR=m -+CONFIG_USB_SERIAL_EDGEPORT=m -+CONFIG_USB_SERIAL_EDGEPORT_TI=m -+CONFIG_USB_SERIAL_F81232=m -+CONFIG_USB_SERIAL_GARMIN=m -+CONFIG_USB_SERIAL_IPW=m -+CONFIG_USB_SERIAL_IUU=m -+CONFIG_USB_SERIAL_KEYSPAN_PDA=m -+CONFIG_USB_SERIAL_KEYSPAN=m -+CONFIG_USB_SERIAL_KLSI=m -+CONFIG_USB_SERIAL_KOBIL_SCT=m -+CONFIG_USB_SERIAL_MCT_U232=m -+CONFIG_USB_SERIAL_METRO=m -+CONFIG_USB_SERIAL_MOS7720=m -+CONFIG_USB_SERIAL_MOS7840=m -+CONFIG_USB_SERIAL_NAVMAN=m -+CONFIG_USB_SERIAL_PL2303=m -+CONFIG_USB_SERIAL_OTI6858=m -+CONFIG_USB_SERIAL_QCAUX=m -+CONFIG_USB_SERIAL_QUALCOMM=m -+CONFIG_USB_SERIAL_SPCP8X5=m -+CONFIG_USB_SERIAL_SAFE=m -+CONFIG_USB_SERIAL_SIERRAWIRELESS=m -+CONFIG_USB_SERIAL_SYMBOL=m -+CONFIG_USB_SERIAL_TI=m -+CONFIG_USB_SERIAL_CYBERJACK=m -+CONFIG_USB_SERIAL_XIRCOM=m -+CONFIG_USB_SERIAL_OPTION=m -+CONFIG_USB_SERIAL_OMNINET=m -+CONFIG_USB_SERIAL_OPTICON=m -+CONFIG_USB_SERIAL_XSENS_MT=m -+CONFIG_USB_SERIAL_WISHBONE=m -+CONFIG_USB_SERIAL_SSU100=m -+CONFIG_USB_SERIAL_QT2=m -+CONFIG_USB_SERIAL_DEBUG=m -+CONFIG_USB_EMI62=m -+CONFIG_USB_EMI26=m -+CONFIG_USB_ADUTUX=m -+CONFIG_USB_SEVSEG=m -+CONFIG_USB_RIO500=m -+CONFIG_USB_LEGOTOWER=m -+CONFIG_USB_LCD=m -+CONFIG_USB_LED=m -+CONFIG_USB_CYPRESS_CY7C63=m -+CONFIG_USB_CYTHERM=m -+CONFIG_USB_IDMOUSE=m -+CONFIG_USB_FTDI_ELAN=m -+CONFIG_USB_APPLEDISPLAY=m -+CONFIG_USB_LD=m -+CONFIG_USB_TRANCEVIBRATOR=m -+CONFIG_USB_IOWARRIOR=m -+CONFIG_USB_TEST=m -+CONFIG_USB_ISIGHTFW=m -+CONFIG_USB_YUREX=m -+CONFIG_USB_ATM=m -+CONFIG_USB_SPEEDTOUCH=m -+CONFIG_USB_CXACRU=m -+CONFIG_USB_UEAGLEATM=m -+CONFIG_USB_XUSBATM=m -+CONFIG_USB_GADGET=m -+CONFIG_USB_ZERO=m -+CONFIG_USB_AUDIO=m -+CONFIG_USB_ETH=m -+CONFIG_USB_GADGETFS=m -+CONFIG_USB_MASS_STORAGE=m -+CONFIG_USB_G_SERIAL=m -+CONFIG_USB_MIDI_GADGET=m -+CONFIG_USB_G_PRINTER=m -+CONFIG_USB_CDC_COMPOSITE=m -+CONFIG_USB_G_ACM_MS=m -+CONFIG_USB_G_MULTI=m -+CONFIG_USB_G_HID=m -+CONFIG_USB_G_WEBCAM=m -+CONFIG_MMC=y -+CONFIG_MMC_BLOCK_MINORS=32 -+CONFIG_MMC_BCM2835=y -+CONFIG_MMC_BCM2835_DMA=y -+CONFIG_MMC_BCM2835_SDHOST=y -+CONFIG_MMC_SDHCI=y -+CONFIG_MMC_SDHCI_PLTFM=y -+CONFIG_MMC_SPI=m -+CONFIG_LEDS_CLASS=y -+CONFIG_LEDS_GPIO=y -+CONFIG_LEDS_TRIGGER_TIMER=y -+CONFIG_LEDS_TRIGGER_ONESHOT=y -+CONFIG_LEDS_TRIGGER_HEARTBEAT=y -+CONFIG_LEDS_TRIGGER_BACKLIGHT=y -+CONFIG_LEDS_TRIGGER_CPU=y -+CONFIG_LEDS_TRIGGER_GPIO=y -+CONFIG_LEDS_TRIGGER_DEFAULT_ON=y -+CONFIG_LEDS_TRIGGER_TRANSIENT=m -+CONFIG_LEDS_TRIGGER_CAMERA=m -+CONFIG_LEDS_TRIGGER_INPUT=y -+CONFIG_RTC_CLASS=y -+# CONFIG_RTC_HCTOSYS is not set -+CONFIG_RTC_DRV_DS1307=m -+CONFIG_RTC_DRV_DS1374=m -+CONFIG_RTC_DRV_DS1672=m -+CONFIG_RTC_DRV_DS3232=m -+CONFIG_RTC_DRV_MAX6900=m -+CONFIG_RTC_DRV_RS5C372=m -+CONFIG_RTC_DRV_ISL1208=m -+CONFIG_RTC_DRV_ISL12022=m -+CONFIG_RTC_DRV_ISL12057=m -+CONFIG_RTC_DRV_X1205=m -+CONFIG_RTC_DRV_PCF2127=m -+CONFIG_RTC_DRV_PCF8523=m -+CONFIG_RTC_DRV_PCF8563=m -+CONFIG_RTC_DRV_PCF8583=m -+CONFIG_RTC_DRV_M41T80=m -+CONFIG_RTC_DRV_BQ32K=m -+CONFIG_RTC_DRV_S35390A=m -+CONFIG_RTC_DRV_FM3130=m -+CONFIG_RTC_DRV_RX8581=m -+CONFIG_RTC_DRV_RX8025=m -+CONFIG_RTC_DRV_EM3027=m -+CONFIG_RTC_DRV_RV3029C2=m -+CONFIG_RTC_DRV_M41T93=m -+CONFIG_RTC_DRV_M41T94=m -+CONFIG_RTC_DRV_DS1305=m -+CONFIG_RTC_DRV_DS1390=m -+CONFIG_RTC_DRV_MAX6902=m -+CONFIG_RTC_DRV_R9701=m -+CONFIG_RTC_DRV_RS5C348=m -+CONFIG_RTC_DRV_DS3234=m -+CONFIG_RTC_DRV_PCF2123=m -+CONFIG_RTC_DRV_RX4581=m -+CONFIG_DMADEVICES=y -+CONFIG_DMA_BCM2835=y -+CONFIG_DMA_BCM2708=y -+CONFIG_UIO=m -+CONFIG_UIO_PDRV_GENIRQ=m -+CONFIG_STAGING=y -+CONFIG_PRISM2_USB=m -+CONFIG_R8712U=m -+CONFIG_R8188EU=m -+CONFIG_R8723AU=m -+CONFIG_VT6656=m -+CONFIG_SPEAKUP=m -+CONFIG_SPEAKUP_SYNTH_SOFT=m -+CONFIG_STAGING_MEDIA=y -+CONFIG_LIRC_STAGING=y -+CONFIG_LIRC_IMON=m -+CONFIG_LIRC_RPI=m -+CONFIG_LIRC_SASEM=m -+CONFIG_LIRC_SERIAL=m -+CONFIG_FB_TFT=m -+CONFIG_FB_TFT_AGM1264K_FL=m -+CONFIG_FB_TFT_BD663474=m -+CONFIG_FB_TFT_HX8340BN=m -+CONFIG_FB_TFT_HX8347D=m -+CONFIG_FB_TFT_HX8353D=m -+CONFIG_FB_TFT_ILI9163=m -+CONFIG_FB_TFT_ILI9320=m -+CONFIG_FB_TFT_ILI9325=m -+CONFIG_FB_TFT_ILI9340=m -+CONFIG_FB_TFT_ILI9341=m -+CONFIG_FB_TFT_ILI9481=m -+CONFIG_FB_TFT_ILI9486=m -+CONFIG_FB_TFT_PCD8544=m -+CONFIG_FB_TFT_RA8875=m -+CONFIG_FB_TFT_S6D02A1=m -+CONFIG_FB_TFT_S6D1121=m -+CONFIG_FB_TFT_SSD1289=m -+CONFIG_FB_TFT_SSD1306=m -+CONFIG_FB_TFT_SSD1331=m -+CONFIG_FB_TFT_SSD1351=m -+CONFIG_FB_TFT_ST7735R=m -+CONFIG_FB_TFT_TINYLCD=m -+CONFIG_FB_TFT_TLS8204=m -+CONFIG_FB_TFT_UC1701=m -+CONFIG_FB_TFT_UPD161704=m -+CONFIG_FB_TFT_WATTEROTT=m -+CONFIG_FB_FLEX=m -+CONFIG_FB_TFT_FBTFT_DEVICE=m -+CONFIG_MAILBOX=y -+CONFIG_BCM2835_MBOX=y -+# CONFIG_IOMMU_SUPPORT is not set -+CONFIG_EXTCON=m -+CONFIG_EXTCON_ARIZONA=m -+CONFIG_IIO=m -+CONFIG_IIO_BUFFER=y -+CONFIG_IIO_BUFFER_CB=m -+CONFIG_IIO_KFIFO_BUF=m -+CONFIG_MCP320X=m -+CONFIG_DHT11=m -+CONFIG_PWM_BCM2835=m -+CONFIG_RASPBERRYPI_FIRMWARE=y -+CONFIG_EXT4_FS=y -+CONFIG_EXT4_FS_POSIX_ACL=y -+CONFIG_EXT4_FS_SECURITY=y -+CONFIG_REISERFS_FS=m -+CONFIG_REISERFS_FS_XATTR=y -+CONFIG_REISERFS_FS_POSIX_ACL=y -+CONFIG_REISERFS_FS_SECURITY=y -+CONFIG_JFS_FS=m -+CONFIG_JFS_POSIX_ACL=y -+CONFIG_JFS_SECURITY=y -+CONFIG_JFS_STATISTICS=y -+CONFIG_XFS_FS=m -+CONFIG_XFS_QUOTA=y -+CONFIG_XFS_POSIX_ACL=y -+CONFIG_XFS_RT=y -+CONFIG_GFS2_FS=m -+CONFIG_OCFS2_FS=m -+CONFIG_BTRFS_FS=m -+CONFIG_BTRFS_FS_POSIX_ACL=y -+CONFIG_NILFS2_FS=m -+CONFIG_F2FS_FS=y -+CONFIG_FANOTIFY=y -+CONFIG_QFMT_V1=m -+CONFIG_QFMT_V2=m -+CONFIG_AUTOFS4_FS=y -+CONFIG_FUSE_FS=m -+CONFIG_CUSE=m -+CONFIG_OVERLAY_FS=m -+CONFIG_FSCACHE=y -+CONFIG_FSCACHE_STATS=y -+CONFIG_FSCACHE_HISTOGRAM=y -+CONFIG_CACHEFILES=y -+CONFIG_ISO9660_FS=m -+CONFIG_JOLIET=y -+CONFIG_ZISOFS=y -+CONFIG_UDF_FS=m -+CONFIG_MSDOS_FS=y -+CONFIG_VFAT_FS=y -+CONFIG_FAT_DEFAULT_IOCHARSET="ascii" -+CONFIG_NTFS_FS=m -+CONFIG_NTFS_RW=y -+CONFIG_TMPFS=y -+CONFIG_TMPFS_POSIX_ACL=y -+CONFIG_CONFIGFS_FS=y -+CONFIG_ECRYPT_FS=m -+CONFIG_HFS_FS=m -+CONFIG_HFSPLUS_FS=m -+CONFIG_JFFS2_FS=m -+CONFIG_JFFS2_SUMMARY=y -+CONFIG_UBIFS_FS=m -+CONFIG_SQUASHFS=m -+CONFIG_SQUASHFS_XATTR=y -+CONFIG_SQUASHFS_LZO=y -+CONFIG_SQUASHFS_XZ=y -+CONFIG_NFS_FS=y -+CONFIG_NFS_V3_ACL=y -+CONFIG_NFS_V4=y -+CONFIG_NFS_SWAP=y -+CONFIG_ROOT_NFS=y -+CONFIG_NFS_FSCACHE=y -+CONFIG_NFSD=m -+CONFIG_NFSD_V3_ACL=y -+CONFIG_NFSD_V4=y -+CONFIG_CIFS=m -+CONFIG_CIFS_WEAK_PW_HASH=y -+CONFIG_CIFS_UPCALL=y -+CONFIG_CIFS_XATTR=y -+CONFIG_CIFS_POSIX=y -+CONFIG_CIFS_ACL=y -+CONFIG_CIFS_DFS_UPCALL=y -+CONFIG_CIFS_SMB2=y -+CONFIG_CIFS_FSCACHE=y -+CONFIG_9P_FS=m -+CONFIG_9P_FS_POSIX_ACL=y -+CONFIG_NLS_DEFAULT="utf8" -+CONFIG_NLS_CODEPAGE_437=y -+CONFIG_NLS_CODEPAGE_737=m -+CONFIG_NLS_CODEPAGE_775=m -+CONFIG_NLS_CODEPAGE_850=m -+CONFIG_NLS_CODEPAGE_852=m -+CONFIG_NLS_CODEPAGE_855=m -+CONFIG_NLS_CODEPAGE_857=m -+CONFIG_NLS_CODEPAGE_860=m -+CONFIG_NLS_CODEPAGE_861=m -+CONFIG_NLS_CODEPAGE_862=m -+CONFIG_NLS_CODEPAGE_863=m -+CONFIG_NLS_CODEPAGE_864=m -+CONFIG_NLS_CODEPAGE_865=m -+CONFIG_NLS_CODEPAGE_866=m -+CONFIG_NLS_CODEPAGE_869=m -+CONFIG_NLS_CODEPAGE_936=m -+CONFIG_NLS_CODEPAGE_950=m -+CONFIG_NLS_CODEPAGE_932=m -+CONFIG_NLS_CODEPAGE_949=m -+CONFIG_NLS_CODEPAGE_874=m -+CONFIG_NLS_ISO8859_8=m -+CONFIG_NLS_CODEPAGE_1250=m -+CONFIG_NLS_CODEPAGE_1251=m -+CONFIG_NLS_ASCII=y -+CONFIG_NLS_ISO8859_1=m -+CONFIG_NLS_ISO8859_2=m -+CONFIG_NLS_ISO8859_3=m -+CONFIG_NLS_ISO8859_4=m -+CONFIG_NLS_ISO8859_5=m -+CONFIG_NLS_ISO8859_6=m -+CONFIG_NLS_ISO8859_7=m -+CONFIG_NLS_ISO8859_9=m -+CONFIG_NLS_ISO8859_13=m -+CONFIG_NLS_ISO8859_14=m -+CONFIG_NLS_ISO8859_15=m -+CONFIG_NLS_KOI8_R=m -+CONFIG_NLS_KOI8_U=m -+CONFIG_DLM=m -+CONFIG_PRINTK_TIME=y -+CONFIG_BOOT_PRINTK_DELAY=y -+CONFIG_DEBUG_MEMORY_INIT=y -+CONFIG_DETECT_HUNG_TASK=y -+CONFIG_TIMER_STATS=y -+CONFIG_LATENCYTOP=y -+CONFIG_IRQSOFF_TRACER=y -+CONFIG_SCHED_TRACER=y -+CONFIG_STACK_TRACER=y -+CONFIG_BLK_DEV_IO_TRACE=y -+# CONFIG_KPROBE_EVENT is not set -+CONFIG_FUNCTION_PROFILER=y -+CONFIG_KGDB=y -+CONFIG_KGDB_KDB=y -+CONFIG_KDB_KEYBOARD=y -+CONFIG_CRYPTO_USER=m -+CONFIG_CRYPTO_CRYPTD=m -+CONFIG_CRYPTO_CBC=y -+CONFIG_CRYPTO_CTS=m -+CONFIG_CRYPTO_XTS=m -+CONFIG_CRYPTO_XCBC=m -+CONFIG_CRYPTO_SHA512=m -+CONFIG_CRYPTO_TGR192=m -+CONFIG_CRYPTO_WP512=m -+CONFIG_CRYPTO_CAST5=m -+CONFIG_CRYPTO_DES=y -+CONFIG_CRYPTO_USER_API_SKCIPHER=m -+# CONFIG_CRYPTO_HW is not set -+CONFIG_ARM_CRYPTO=y -+CONFIG_CRYPTO_SHA1_ARM=m -+CONFIG_CRYPTO_AES_ARM=m -+CONFIG_CRC_ITU_T=y -+CONFIG_LIBCRC32C=y - -From e5292198fc83805a9f4751fddeb802f69c0270f0 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= <noralf@tronnes.org> -Date: Wed, 29 Apr 2015 17:24:02 +0200 -Subject: [PATCH 078/170] bcm2835: bcm2835_defconfig -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Some options in bcm2835_defconfig are now the default and -some have changed. Update to keep functionality. - -No longer available: SCSI_MULTI_LUN and RESOURCE_COUNTERS. - -Signed-off-by: Noralf Trønnes <noralf@tronnes.org> - -bcm2835: bcm2835_defconfig enable MMC_BCM2835 - -Enable the downstream bcm2835-mmc driver and DMA support. - -Signed-off-by: Noralf Trønnes <noralf@tronnes.org> - -bcm2835: bcm2835_defconfig enable BCM2708_MBOX - -Enable the mailbox driver. - -Signed-off-by: Noralf Trønnes <noralf@tronnes.org> - -bcm2835: bcm2835_defconfig use FB_BCM2708 - -Enable the bcm2708 framebuffer driver. -Disable the simple framebuffer driver, which matches the -device handed over by u-boot. - -Signed-off-by: Noralf Trønnes <noralf@tronnes.org> - -bcm2835: Merge bcm2835_defconfig with bcmrpi_defconfig - -These commands where used to make this commit: - -./scripts/diffconfig -m arch/arm/configs/bcm2835_defconfig arch/arm/configs/bcmrpi_defconfig > merge.cfg - -cat << EOF > filter -CONFIG_ARCH_BCM2708 -CONFIG_BCM2708_DT -CONFIG_ARM_PATCH_PHYS_VIRT -CONFIG_PHYS_OFFSET -CONFIG_CMDLINE -CONFIG_BCM2708_WDT -CONFIG_HW_RANDOM_BCM2708 -CONFIG_I2C_BCM2708 -CONFIG_SPI_BCM2708 -CONFIG_SND_BCM2708_SOC_I2S -CONFIG_USB_DWCOTG -CONFIG_LIRC_RPI -EOF - -grep -F -v -f filter merge.cfg > filtered.cfg - -cat << EOF > added.cfg -CONFIG_WATCHDOG=y -CONFIG_BCM2835_WDT=y -CONFIG_MISC_FILESYSTEMS=y -CONFIG_SND_BCM2835_SOC_I2S=m -EOF - -ARCH=arm scripts/kconfig/merge_config.sh arch/arm/configs/bcm2835_defconfig filtered.cfg added.cfg -ARCH=arm make oldconfig - -ARCH=arm make savedefconfig -cp defconfig arch/arm/configs/bcm2835_defconfig - -rm merge.cfg filter filtered.cfg added.cfg defconfig - -ARCH=arm make bcm2835_defconfig -ARCH=arm make oldconfig - -Signed-off-by: Noralf Trønnes <noralf@tronnes.org> - -configs: Incorporate v4.1 dependency changes - -Commit 78e9b7de78bb53e8bc7f4c4a60ebacb250c0c190 added a -dependency on TI_ST instead of selecting it, disabling: -CONFIG_BT_WILINK=m -CONFIG_RADIO_WL128X=m - -Commit 652ccae5cc4e1305fb0a4619947f9ee89d8c7f5a added a -depency on ARM_CRYPTO, disabling: -CONFIG_CRYPTO_SHA*_ARM*=m -CONFIG_CRYPTO_AES_ARM*=m - -Signed-off-by: Noralf Trønnes <noralf@tronnes.org> - -Conflicts: - arch/arm/configs/bcm2709_defconfig - -bcm2835: Sync bcm2835_defconfig with bcmrpi_defconfig - -These commands where used to make this commit: - -: Get changed and new config values from a merge -./scripts/diffconfig -m arch/arm/configs/bcm2835_defconfig arch/arm/configs/bcmrpi_defconfig > merge.cfg - -: Remove these options -cat << EOF > filter -CONFIG_ARCH_BCM2708 -CONFIG_BCM2708_DT -CONFIG_ARM_PATCH_PHYS_VIRT -CONFIG_PHYS_OFFSET -CONFIG_CMDLINE -CONFIG_BCM2708_WDT -CONFIG_HW_RANDOM_BCM2708 -CONFIG_SPI_BCM2708 -EOF - -: Apply filter -grep -F -v -f filter merge.cfg > filtered.cfg - -: Add these options -: watchdog contains the restart/poweroff code. -cat << EOF > added.cfg -CONFIG_WATCHDOG=y -CONFIG_BCM2835_WDT=y -CONFIG_MISC_FILESYSTEMS=y -CONFIG_I2C_BCM2835=m -CONFIG_SND_BCM2835_SOC_I2S=m -EOF - -: Create new config -ARCH=arm scripts/kconfig/merge_config.sh arch/arm/configs/bcm2835_defconfig filtered.cfg added.cfg -: Verify -ARCH=arm make oldconfig - -: Update bcm2835_defconfig -ARCH=arm make savedefconfig -cp defconfig arch/arm/configs/bcm2835_defconfig - -: Clean up -rm merge.cfg filter filtered.cfg added.cfg defconfig - -Signed-off-by: Noralf Trønnes <noralf@tronnes.org> ---- - arch/arm/configs/bcm2835_defconfig | 1166 +++++++++++++++++++++++++++++++++++- - 1 file changed, 1140 insertions(+), 26 deletions(-) - -diff --git a/arch/arm/configs/bcm2835_defconfig b/arch/arm/configs/bcm2835_defconfig -index 31cb073..fdb2e2a8 100644 ---- a/arch/arm/configs/bcm2835_defconfig -+++ b/arch/arm/configs/bcm2835_defconfig -@@ -1,105 +1,1103 @@ - # CONFIG_LOCALVERSION_AUTO is not set - CONFIG_SYSVIPC=y -+CONFIG_POSIX_MQUEUE=y - CONFIG_FHANDLE=y - CONFIG_NO_HZ=y - CONFIG_HIGH_RES_TIMERS=y - CONFIG_BSD_PROCESS_ACCT=y - CONFIG_BSD_PROCESS_ACCT_V3=y -+CONFIG_TASKSTATS=y -+CONFIG_TASK_DELAY_ACCT=y -+CONFIG_TASK_XACCT=y -+CONFIG_TASK_IO_ACCOUNTING=y -+CONFIG_IKCONFIG=m -+CONFIG_IKCONFIG_PROC=y - CONFIG_LOG_BUF_SHIFT=18 - CONFIG_CGROUP_FREEZER=y - CONFIG_CGROUP_DEVICE=y - CONFIG_CPUSETS=y - CONFIG_CGROUP_CPUACCT=y --CONFIG_RESOURCE_COUNTERS=y -+CONFIG_MEMCG=y - CONFIG_CGROUP_PERF=y - CONFIG_CFS_BANDWIDTH=y - CONFIG_RT_GROUP_SCHED=y -+CONFIG_BLK_CGROUP=y - CONFIG_NAMESPACES=y - CONFIG_SCHED_AUTOGROUP=y --CONFIG_RELAY=y - CONFIG_BLK_DEV_INITRD=y --CONFIG_RD_BZIP2=y --CONFIG_RD_LZMA=y --CONFIG_RD_XZ=y --CONFIG_RD_LZO=y - CONFIG_CC_OPTIMIZE_FOR_SIZE=y --CONFIG_KALLSYMS_ALL=y - CONFIG_EMBEDDED=y - # CONFIG_COMPAT_BRK is not set - CONFIG_PROFILING=y --CONFIG_OPROFILE=y -+CONFIG_OPROFILE=m -+CONFIG_KPROBES=y - CONFIG_JUMP_LABEL=y -+CONFIG_CC_STACKPROTECTOR_REGULAR=y -+CONFIG_MODULES=y -+CONFIG_MODULE_UNLOAD=y -+CONFIG_MODVERSIONS=y -+CONFIG_MODULE_SRCVERSION_ALL=y -+CONFIG_BLK_DEV_THROTTLING=y -+CONFIG_PARTITION_ADVANCED=y -+CONFIG_MAC_PARTITION=y -+CONFIG_CFQ_GROUP_IOSCHED=y - CONFIG_ARCH_MULTI_V6=y - # CONFIG_ARCH_MULTI_V7 is not set - CONFIG_ARCH_BCM=y - CONFIG_ARCH_BCM2835=y --CONFIG_PREEMPT_VOLUNTARY=y -+CONFIG_PREEMPT=y - CONFIG_AEABI=y -+CONFIG_OABI_COMPAT=y - CONFIG_KSM=y - CONFIG_CLEANCACHE=y -+CONFIG_FRONTSWAP=y -+CONFIG_CMA=y -+CONFIG_ZSMALLOC=m -+CONFIG_PGTABLE_MAPPING=y -+CONFIG_UACCESS_WITH_MEMCPY=y - CONFIG_SECCOMP=y --CONFIG_CC_STACKPROTECTOR=y -+CONFIG_ZBOOT_ROM_TEXT=0x0 -+CONFIG_ZBOOT_ROM_BSS=0x0 - CONFIG_KEXEC=y - CONFIG_CRASH_DUMP=y -+CONFIG_CPU_FREQ=y -+CONFIG_CPU_FREQ_STAT=m -+CONFIG_CPU_FREQ_STAT_DETAILS=y -+CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE=y -+CONFIG_CPU_FREQ_GOV_PERFORMANCE=y -+CONFIG_CPU_FREQ_GOV_USERSPACE=y -+CONFIG_CPU_FREQ_GOV_ONDEMAND=y -+CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y - CONFIG_VFP=y - # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set -+CONFIG_BINFMT_MISC=m - # CONFIG_SUSPEND is not set - CONFIG_NET=y - CONFIG_PACKET=y - CONFIG_UNIX=y -+CONFIG_XFRM_USER=y -+CONFIG_NET_KEY=m - CONFIG_INET=y -+CONFIG_IP_MULTICAST=y -+CONFIG_IP_ADVANCED_ROUTER=y -+CONFIG_IP_MULTIPLE_TABLES=y -+CONFIG_IP_ROUTE_MULTIPATH=y -+CONFIG_IP_ROUTE_VERBOSE=y -+CONFIG_IP_PNP=y -+CONFIG_IP_PNP_DHCP=y -+CONFIG_IP_PNP_RARP=y -+CONFIG_NET_IPIP=m -+CONFIG_NET_IPGRE_DEMUX=m -+CONFIG_NET_IPGRE=m -+CONFIG_IP_MROUTE=y -+CONFIG_IP_MROUTE_MULTIPLE_TABLES=y -+CONFIG_IP_PIMSM_V1=y -+CONFIG_IP_PIMSM_V2=y -+CONFIG_SYN_COOKIES=y -+CONFIG_INET_AH=m -+CONFIG_INET_ESP=m -+CONFIG_INET_IPCOMP=m -+CONFIG_INET_XFRM_MODE_TRANSPORT=m -+CONFIG_INET_XFRM_MODE_TUNNEL=m -+CONFIG_INET_XFRM_MODE_BEET=m -+CONFIG_INET_LRO=m -+CONFIG_INET_DIAG=m -+CONFIG_INET6_AH=m -+CONFIG_INET6_ESP=m -+CONFIG_INET6_IPCOMP=m -+CONFIG_IPV6_TUNNEL=m -+CONFIG_IPV6_MULTIPLE_TABLES=y -+CONFIG_IPV6_MROUTE=y -+CONFIG_IPV6_MROUTE_MULTIPLE_TABLES=y -+CONFIG_IPV6_PIMSM_V2=y - CONFIG_NETWORK_SECMARK=y - CONFIG_NETFILTER=y --CONFIG_CFG80211=y --CONFIG_MAC80211=y -+CONFIG_NF_CONNTRACK=m -+CONFIG_NF_CONNTRACK_ZONES=y -+CONFIG_NF_CONNTRACK_EVENTS=y -+CONFIG_NF_CONNTRACK_TIMESTAMP=y -+CONFIG_NF_CT_PROTO_DCCP=m -+CONFIG_NF_CT_PROTO_UDPLITE=m -+CONFIG_NF_CONNTRACK_AMANDA=m -+CONFIG_NF_CONNTRACK_FTP=m -+CONFIG_NF_CONNTRACK_H323=m -+CONFIG_NF_CONNTRACK_IRC=m -+CONFIG_NF_CONNTRACK_NETBIOS_NS=m -+CONFIG_NF_CONNTRACK_SNMP=m -+CONFIG_NF_CONNTRACK_PPTP=m -+CONFIG_NF_CONNTRACK_SANE=m -+CONFIG_NF_CONNTRACK_SIP=m -+CONFIG_NF_CONNTRACK_TFTP=m -+CONFIG_NF_CT_NETLINK=m -+CONFIG_NETFILTER_XT_SET=m -+CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m -+CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m -+CONFIG_NETFILTER_XT_TARGET_CONNMARK=m -+CONFIG_NETFILTER_XT_TARGET_DSCP=m -+CONFIG_NETFILTER_XT_TARGET_HMARK=m -+CONFIG_NETFILTER_XT_TARGET_IDLETIMER=m -+CONFIG_NETFILTER_XT_TARGET_LED=m -+CONFIG_NETFILTER_XT_TARGET_LOG=m -+CONFIG_NETFILTER_XT_TARGET_MARK=m -+CONFIG_NETFILTER_XT_TARGET_NFLOG=m -+CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m -+CONFIG_NETFILTER_XT_TARGET_NOTRACK=m -+CONFIG_NETFILTER_XT_TARGET_TEE=m -+CONFIG_NETFILTER_XT_TARGET_TPROXY=m -+CONFIG_NETFILTER_XT_TARGET_TRACE=m -+CONFIG_NETFILTER_XT_TARGET_TCPMSS=m -+CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP=m -+CONFIG_NETFILTER_XT_MATCH_ADDRTYPE=m -+CONFIG_NETFILTER_XT_MATCH_BPF=m -+CONFIG_NETFILTER_XT_MATCH_CLUSTER=m -+CONFIG_NETFILTER_XT_MATCH_COMMENT=m -+CONFIG_NETFILTER_XT_MATCH_CONNBYTES=m -+CONFIG_NETFILTER_XT_MATCH_CONNLABEL=m -+CONFIG_NETFILTER_XT_MATCH_CONNLIMIT=m -+CONFIG_NETFILTER_XT_MATCH_CONNMARK=m -+CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m -+CONFIG_NETFILTER_XT_MATCH_CPU=m -+CONFIG_NETFILTER_XT_MATCH_DCCP=m -+CONFIG_NETFILTER_XT_MATCH_DEVGROUP=m -+CONFIG_NETFILTER_XT_MATCH_DSCP=m -+CONFIG_NETFILTER_XT_MATCH_ESP=m -+CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=m -+CONFIG_NETFILTER_XT_MATCH_HELPER=m -+CONFIG_NETFILTER_XT_MATCH_IPRANGE=m -+CONFIG_NETFILTER_XT_MATCH_IPVS=m -+CONFIG_NETFILTER_XT_MATCH_LENGTH=m -+CONFIG_NETFILTER_XT_MATCH_LIMIT=m -+CONFIG_NETFILTER_XT_MATCH_MAC=m -+CONFIG_NETFILTER_XT_MATCH_MARK=m -+CONFIG_NETFILTER_XT_MATCH_MULTIPORT=m -+CONFIG_NETFILTER_XT_MATCH_NFACCT=m -+CONFIG_NETFILTER_XT_MATCH_OSF=m -+CONFIG_NETFILTER_XT_MATCH_OWNER=m -+CONFIG_NETFILTER_XT_MATCH_POLICY=m -+CONFIG_NETFILTER_XT_MATCH_PHYSDEV=m -+CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m -+CONFIG_NETFILTER_XT_MATCH_QUOTA=m -+CONFIG_NETFILTER_XT_MATCH_RATEEST=m -+CONFIG_NETFILTER_XT_MATCH_REALM=m -+CONFIG_NETFILTER_XT_MATCH_RECENT=m -+CONFIG_NETFILTER_XT_MATCH_SOCKET=m -+CONFIG_NETFILTER_XT_MATCH_STATE=m -+CONFIG_NETFILTER_XT_MATCH_STATISTIC=m -+CONFIG_NETFILTER_XT_MATCH_STRING=m -+CONFIG_NETFILTER_XT_MATCH_TCPMSS=m -+CONFIG_NETFILTER_XT_MATCH_TIME=m -+CONFIG_NETFILTER_XT_MATCH_U32=m -+CONFIG_IP_SET=m -+CONFIG_IP_SET_BITMAP_IP=m -+CONFIG_IP_SET_BITMAP_IPMAC=m -+CONFIG_IP_SET_BITMAP_PORT=m -+CONFIG_IP_SET_HASH_IP=m -+CONFIG_IP_SET_HASH_IPPORT=m -+CONFIG_IP_SET_HASH_IPPORTIP=m -+CONFIG_IP_SET_HASH_IPPORTNET=m -+CONFIG_IP_SET_HASH_NET=m -+CONFIG_IP_SET_HASH_NETPORT=m -+CONFIG_IP_SET_HASH_NETIFACE=m -+CONFIG_IP_SET_LIST_SET=m -+CONFIG_IP_VS=m -+CONFIG_IP_VS_PROTO_TCP=y -+CONFIG_IP_VS_PROTO_UDP=y -+CONFIG_IP_VS_PROTO_ESP=y -+CONFIG_IP_VS_PROTO_AH=y -+CONFIG_IP_VS_PROTO_SCTP=y -+CONFIG_IP_VS_RR=m -+CONFIG_IP_VS_WRR=m -+CONFIG_IP_VS_LC=m -+CONFIG_IP_VS_WLC=m -+CONFIG_IP_VS_LBLC=m -+CONFIG_IP_VS_LBLCR=m -+CONFIG_IP_VS_DH=m -+CONFIG_IP_VS_SH=m -+CONFIG_IP_VS_SED=m -+CONFIG_IP_VS_NQ=m -+CONFIG_IP_VS_FTP=m -+CONFIG_IP_VS_PE_SIP=m -+CONFIG_NF_CONNTRACK_IPV4=m -+CONFIG_IP_NF_IPTABLES=m -+CONFIG_IP_NF_MATCH_AH=m -+CONFIG_IP_NF_MATCH_ECN=m -+CONFIG_IP_NF_MATCH_TTL=m -+CONFIG_IP_NF_FILTER=m -+CONFIG_IP_NF_TARGET_REJECT=m -+CONFIG_IP_NF_NAT=m -+CONFIG_IP_NF_TARGET_MASQUERADE=m -+CONFIG_IP_NF_TARGET_NETMAP=m -+CONFIG_IP_NF_TARGET_REDIRECT=m -+CONFIG_IP_NF_MANGLE=m -+CONFIG_IP_NF_TARGET_CLUSTERIP=m -+CONFIG_IP_NF_TARGET_ECN=m -+CONFIG_IP_NF_TARGET_TTL=m -+CONFIG_IP_NF_RAW=m -+CONFIG_IP_NF_ARPTABLES=m -+CONFIG_IP_NF_ARPFILTER=m -+CONFIG_IP_NF_ARP_MANGLE=m -+CONFIG_NF_CONNTRACK_IPV6=m -+CONFIG_IP6_NF_IPTABLES=m -+CONFIG_IP6_NF_MATCH_AH=m -+CONFIG_IP6_NF_MATCH_EUI64=m -+CONFIG_IP6_NF_MATCH_FRAG=m -+CONFIG_IP6_NF_MATCH_OPTS=m -+CONFIG_IP6_NF_MATCH_HL=m -+CONFIG_IP6_NF_MATCH_IPV6HEADER=m -+CONFIG_IP6_NF_MATCH_MH=m -+CONFIG_IP6_NF_MATCH_RT=m -+CONFIG_IP6_NF_TARGET_HL=m -+CONFIG_IP6_NF_FILTER=m -+CONFIG_IP6_NF_TARGET_REJECT=m -+CONFIG_IP6_NF_MANGLE=m -+CONFIG_IP6_NF_RAW=m -+CONFIG_IP6_NF_NAT=m -+CONFIG_IP6_NF_TARGET_MASQUERADE=m -+CONFIG_IP6_NF_TARGET_NPT=m -+CONFIG_BRIDGE_NF_EBTABLES=m -+CONFIG_BRIDGE_EBT_BROUTE=m -+CONFIG_BRIDGE_EBT_T_FILTER=m -+CONFIG_BRIDGE_EBT_T_NAT=m -+CONFIG_BRIDGE_EBT_802_3=m -+CONFIG_BRIDGE_EBT_AMONG=m -+CONFIG_BRIDGE_EBT_ARP=m -+CONFIG_BRIDGE_EBT_IP=m -+CONFIG_BRIDGE_EBT_IP6=m -+CONFIG_BRIDGE_EBT_LIMIT=m -+CONFIG_BRIDGE_EBT_MARK=m -+CONFIG_BRIDGE_EBT_PKTTYPE=m -+CONFIG_BRIDGE_EBT_STP=m -+CONFIG_BRIDGE_EBT_VLAN=m -+CONFIG_BRIDGE_EBT_ARPREPLY=m -+CONFIG_BRIDGE_EBT_DNAT=m -+CONFIG_BRIDGE_EBT_MARK_T=m -+CONFIG_BRIDGE_EBT_REDIRECT=m -+CONFIG_BRIDGE_EBT_SNAT=m -+CONFIG_BRIDGE_EBT_LOG=m -+CONFIG_BRIDGE_EBT_NFLOG=m -+CONFIG_SCTP_COOKIE_HMAC_SHA1=y -+CONFIG_ATM=m -+CONFIG_L2TP=m -+CONFIG_L2TP_V3=y -+CONFIG_L2TP_IP=m -+CONFIG_L2TP_ETH=m -+CONFIG_BRIDGE=m -+CONFIG_VLAN_8021Q=m -+CONFIG_VLAN_8021Q_GVRP=y -+CONFIG_ATALK=m -+CONFIG_6LOWPAN=m -+CONFIG_NET_SCHED=y -+CONFIG_NET_SCH_CBQ=m -+CONFIG_NET_SCH_HTB=m -+CONFIG_NET_SCH_HFSC=m -+CONFIG_NET_SCH_PRIO=m -+CONFIG_NET_SCH_MULTIQ=m -+CONFIG_NET_SCH_RED=m -+CONFIG_NET_SCH_SFB=m -+CONFIG_NET_SCH_SFQ=m -+CONFIG_NET_SCH_TEQL=m -+CONFIG_NET_SCH_TBF=m -+CONFIG_NET_SCH_GRED=m -+CONFIG_NET_SCH_DSMARK=m -+CONFIG_NET_SCH_NETEM=m -+CONFIG_NET_SCH_DRR=m -+CONFIG_NET_SCH_MQPRIO=m -+CONFIG_NET_SCH_CHOKE=m -+CONFIG_NET_SCH_QFQ=m -+CONFIG_NET_SCH_CODEL=m -+CONFIG_NET_SCH_FQ_CODEL=m -+CONFIG_NET_SCH_INGRESS=m -+CONFIG_NET_SCH_PLUG=m -+CONFIG_NET_CLS_BASIC=m -+CONFIG_NET_CLS_TCINDEX=m -+CONFIG_NET_CLS_ROUTE4=m -+CONFIG_NET_CLS_FW=m -+CONFIG_NET_CLS_U32=m -+CONFIG_CLS_U32_MARK=y -+CONFIG_NET_CLS_RSVP=m -+CONFIG_NET_CLS_RSVP6=m -+CONFIG_NET_CLS_FLOW=m -+CONFIG_NET_CLS_CGROUP=m -+CONFIG_NET_EMATCH=y -+CONFIG_NET_EMATCH_CMP=m -+CONFIG_NET_EMATCH_NBYTE=m -+CONFIG_NET_EMATCH_U32=m -+CONFIG_NET_EMATCH_META=m -+CONFIG_NET_EMATCH_TEXT=m -+CONFIG_NET_EMATCH_IPSET=m -+CONFIG_NET_CLS_ACT=y -+CONFIG_NET_ACT_POLICE=m -+CONFIG_NET_ACT_GACT=m -+CONFIG_GACT_PROB=y -+CONFIG_NET_ACT_MIRRED=m -+CONFIG_NET_ACT_IPT=m -+CONFIG_NET_ACT_NAT=m -+CONFIG_NET_ACT_PEDIT=m -+CONFIG_NET_ACT_SIMP=m -+CONFIG_NET_ACT_SKBEDIT=m -+CONFIG_NET_ACT_CSUM=m -+CONFIG_BATMAN_ADV=m -+CONFIG_OPENVSWITCH=m -+CONFIG_NET_PKTGEN=m -+CONFIG_HAMRADIO=y -+CONFIG_AX25=m -+CONFIG_NETROM=m -+CONFIG_ROSE=m -+CONFIG_MKISS=m -+CONFIG_6PACK=m -+CONFIG_BPQETHER=m -+CONFIG_BAYCOM_SER_FDX=m -+CONFIG_BAYCOM_SER_HDX=m -+CONFIG_YAM=m -+CONFIG_CAN=m -+CONFIG_CAN_VCAN=m -+CONFIG_CAN_MCP251X=m -+CONFIG_IRDA=m -+CONFIG_IRLAN=m -+CONFIG_IRNET=m -+CONFIG_IRCOMM=m -+CONFIG_IRDA_ULTRA=y -+CONFIG_IRDA_CACHE_LAST_LSAP=y -+CONFIG_IRDA_FAST_RR=y -+CONFIG_IRTTY_SIR=m -+CONFIG_KINGSUN_DONGLE=m -+CONFIG_KSDAZZLE_DONGLE=m -+CONFIG_KS959_DONGLE=m -+CONFIG_USB_IRDA=m -+CONFIG_SIGMATEL_FIR=m -+CONFIG_MCS_FIR=m -+CONFIG_BT=m -+CONFIG_BT_RFCOMM=m -+CONFIG_BT_RFCOMM_TTY=y -+CONFIG_BT_BNEP=m -+CONFIG_BT_BNEP_MC_FILTER=y -+CONFIG_BT_BNEP_PROTO_FILTER=y -+CONFIG_BT_HIDP=m -+CONFIG_BT_6LOWPAN=m -+CONFIG_BT_HCIBTUSB=m -+CONFIG_BT_HCIBCM203X=m -+CONFIG_BT_HCIBPA10X=m -+CONFIG_BT_HCIBFUSB=m -+CONFIG_BT_HCIVHCI=m -+CONFIG_BT_MRVL=m -+CONFIG_BT_MRVL_SDIO=m -+CONFIG_BT_ATH3K=m -+CONFIG_BT_WILINK=m -+CONFIG_MAC80211=m -+CONFIG_MAC80211_MESH=y -+CONFIG_WIMAX=m -+CONFIG_RFKILL=m -+CONFIG_RFKILL_INPUT=y -+CONFIG_NET_9P=m -+CONFIG_NFC=m -+CONFIG_NFC_PN533=m - CONFIG_DEVTMPFS=y - CONFIG_DEVTMPFS_MOUNT=y - # CONFIG_STANDALONE is not set -+CONFIG_DMA_CMA=y -+CONFIG_CMA_SIZE_MBYTES=5 -+CONFIG_ZRAM=m -+CONFIG_ZRAM_LZ4_COMPRESS=y -+CONFIG_BLK_DEV_LOOP=y -+CONFIG_BLK_DEV_CRYPTOLOOP=m -+CONFIG_BLK_DEV_DRBD=m -+CONFIG_BLK_DEV_NBD=m -+CONFIG_BLK_DEV_RAM=y -+CONFIG_CDROM_PKTCDVD=m -+CONFIG_ATA_OVER_ETH=m -+CONFIG_EEPROM_AT24=m -+CONFIG_TI_ST=m - CONFIG_SCSI=y -+# CONFIG_SCSI_PROC_FS is not set - CONFIG_BLK_DEV_SD=y --CONFIG_SCSI_MULTI_LUN=y -+CONFIG_CHR_DEV_ST=m -+CONFIG_CHR_DEV_OSST=m -+CONFIG_BLK_DEV_SR=m -+CONFIG_CHR_DEV_SG=m - CONFIG_SCSI_CONSTANTS=y - CONFIG_SCSI_SCAN_ASYNC=y -+CONFIG_SCSI_ISCSI_ATTRS=y -+CONFIG_ISCSI_TCP=m -+CONFIG_ISCSI_BOOT_SYSFS=m -+CONFIG_MD=y -+CONFIG_MD_LINEAR=m -+CONFIG_MD_RAID0=m -+CONFIG_BLK_DEV_DM=m -+CONFIG_DM_CRYPT=m -+CONFIG_DM_SNAPSHOT=m -+CONFIG_DM_MIRROR=m -+CONFIG_DM_LOG_USERSPACE=m -+CONFIG_DM_RAID=m -+CONFIG_DM_ZERO=m -+CONFIG_DM_DELAY=m - CONFIG_NETDEVICES=y -+CONFIG_BONDING=m -+CONFIG_DUMMY=m -+CONFIG_IFB=m -+CONFIG_MACVLAN=m -+CONFIG_NETCONSOLE=m -+CONFIG_TUN=m -+CONFIG_VETH=m -+CONFIG_ENC28J60=m -+CONFIG_MDIO_BITBANG=m -+CONFIG_PPP=m -+CONFIG_PPP_BSDCOMP=m -+CONFIG_PPP_DEFLATE=m -+CONFIG_PPP_FILTER=y -+CONFIG_PPP_MPPE=m -+CONFIG_PPP_MULTILINK=y -+CONFIG_PPPOATM=m -+CONFIG_PPPOE=m -+CONFIG_PPPOL2TP=m -+CONFIG_PPP_ASYNC=m -+CONFIG_PPP_SYNC_TTY=m -+CONFIG_SLIP=m -+CONFIG_SLIP_COMPRESSED=y -+CONFIG_SLIP_SMART=y -+CONFIG_USB_CATC=m -+CONFIG_USB_KAWETH=m -+CONFIG_USB_PEGASUS=m -+CONFIG_USB_RTL8150=m -+CONFIG_USB_RTL8152=m - CONFIG_USB_USBNET=y -+CONFIG_USB_NET_AX8817X=m -+CONFIG_USB_NET_AX88179_178A=m -+CONFIG_USB_NET_CDCETHER=m -+CONFIG_USB_NET_CDC_EEM=m -+CONFIG_USB_NET_CDC_NCM=m -+CONFIG_USB_NET_HUAWEI_CDC_NCM=m -+CONFIG_USB_NET_CDC_MBIM=m -+CONFIG_USB_NET_DM9601=m -+CONFIG_USB_NET_SR9700=m -+CONFIG_USB_NET_SR9800=m -+CONFIG_USB_NET_SMSC75XX=m - CONFIG_USB_NET_SMSC95XX=y --CONFIG_ZD1211RW=y --CONFIG_INPUT_EVDEV=y -+CONFIG_USB_NET_GL620A=m -+CONFIG_USB_NET_NET1080=m -+CONFIG_USB_NET_PLUSB=m -+CONFIG_USB_NET_MCS7830=m -+CONFIG_USB_NET_CDC_SUBSET=m -+CONFIG_USB_ALI_M5632=y -+CONFIG_USB_AN2720=y -+CONFIG_USB_EPSON2888=y -+CONFIG_USB_KC2190=y -+CONFIG_USB_NET_ZAURUS=m -+CONFIG_USB_NET_CX82310_ETH=m -+CONFIG_USB_NET_KALMIA=m -+CONFIG_USB_NET_QMI_WWAN=m -+CONFIG_USB_HSO=m -+CONFIG_USB_NET_INT51X1=m -+CONFIG_USB_IPHETH=m -+CONFIG_USB_SIERRA_NET=m -+CONFIG_USB_VL600=m -+CONFIG_LIBERTAS_THINFIRM=m -+CONFIG_LIBERTAS_THINFIRM_USB=m -+CONFIG_AT76C50X_USB=m -+CONFIG_USB_ZD1201=m -+CONFIG_USB_NET_RNDIS_WLAN=m -+CONFIG_RTL8187=m -+CONFIG_MAC80211_HWSIM=m -+CONFIG_ATH_CARDS=m -+CONFIG_ATH9K=m -+CONFIG_ATH9K_HTC=m -+CONFIG_CARL9170=m -+CONFIG_ATH6KL=m -+CONFIG_ATH6KL_USB=m -+CONFIG_AR5523=m -+CONFIG_B43=m -+# CONFIG_B43_PHY_N is not set -+CONFIG_B43LEGACY=m -+CONFIG_BRCMFMAC=m -+CONFIG_BRCMFMAC_USB=y -+CONFIG_HOSTAP=m -+CONFIG_LIBERTAS=m -+CONFIG_LIBERTAS_USB=m -+CONFIG_LIBERTAS_SDIO=m -+CONFIG_P54_COMMON=m -+CONFIG_P54_USB=m -+CONFIG_RT2X00=m -+CONFIG_RT2500USB=m -+CONFIG_RT73USB=m -+CONFIG_RT2800USB=m -+CONFIG_RT2800USB_RT3573=y -+CONFIG_RT2800USB_RT53XX=y -+CONFIG_RT2800USB_RT55XX=y -+CONFIG_RT2800USB_UNKNOWN=y -+CONFIG_WL_MEDIATEK=y -+CONFIG_MT7601U=m -+CONFIG_RTL8192CU=m -+CONFIG_ZD1211RW=m -+CONFIG_MWIFIEX=m -+CONFIG_MWIFIEX_SDIO=m -+CONFIG_WIMAX_I2400M_USB=m -+CONFIG_INPUT_POLLDEV=m -+# CONFIG_INPUT_MOUSEDEV_PSAUX is not set -+CONFIG_INPUT_JOYDEV=m -+CONFIG_INPUT_EVDEV=m -+# CONFIG_KEYBOARD_ATKBD is not set -+CONFIG_KEYBOARD_GPIO=m -+# CONFIG_INPUT_MOUSE is not set -+CONFIG_INPUT_JOYSTICK=y -+CONFIG_JOYSTICK_IFORCE=m -+CONFIG_JOYSTICK_IFORCE_USB=y -+CONFIG_JOYSTICK_XPAD=m -+CONFIG_JOYSTICK_XPAD_FF=y -+CONFIG_JOYSTICK_RPISENSE=m -+CONFIG_INPUT_TOUCHSCREEN=y -+CONFIG_TOUCHSCREEN_ADS7846=m -+CONFIG_TOUCHSCREEN_EGALAX=m -+CONFIG_TOUCHSCREEN_RPI_FT5406=m -+CONFIG_TOUCHSCREEN_USB_COMPOSITE=m -+CONFIG_TOUCHSCREEN_STMPE=m -+CONFIG_INPUT_MISC=y -+CONFIG_INPUT_AD714X=m -+CONFIG_INPUT_ATI_REMOTE2=m -+CONFIG_INPUT_KEYSPAN_REMOTE=m -+CONFIG_INPUT_POWERMATE=m -+CONFIG_INPUT_YEALINK=m -+CONFIG_INPUT_CM109=m -+CONFIG_INPUT_UINPUT=m -+CONFIG_INPUT_GPIO_ROTARY_ENCODER=m -+CONFIG_INPUT_ADXL34X=m -+CONFIG_INPUT_CMA3000=m -+CONFIG_SERIO=m -+CONFIG_SERIO_RAW=m -+CONFIG_GAMEPORT=m -+CONFIG_GAMEPORT_NS558=m -+CONFIG_GAMEPORT_L4=m -+CONFIG_BRCM_CHAR_DRIVERS=y -+CONFIG_BCM_VC_CMA=y -+CONFIG_BCM_VCIO=y -+CONFIG_BCM_VC_SM=y -+CONFIG_DEVPTS_MULTIPLE_INSTANCES=y - # CONFIG_LEGACY_PTYS is not set - # CONFIG_DEVKMEM is not set -+CONFIG_SERIAL_8250=y -+# CONFIG_SERIAL_8250_DEPRECATED_OPTIONS is not set -+CONFIG_SERIAL_8250_CONSOLE=y -+# CONFIG_SERIAL_8250_DMA is not set -+CONFIG_SERIAL_8250_NR_UARTS=1 -+CONFIG_SERIAL_8250_RUNTIME_UARTS=0 - CONFIG_SERIAL_AMBA_PL011=y - CONFIG_SERIAL_AMBA_PL011_CONSOLE=y -+CONFIG_SERIAL_OF_PLATFORM=y - CONFIG_TTY_PRINTK=y -+CONFIG_HW_RANDOM=y -+CONFIG_HW_RANDOM_BCM2835=m -+CONFIG_RAW_DRIVER=y - CONFIG_I2C=y --CONFIG_I2C_CHARDEV=y --CONFIG_I2C_BCM2835=y -+CONFIG_I2C_CHARDEV=m -+CONFIG_I2C_BCM2708=m -+CONFIG_I2C_BCM2835=m - CONFIG_SPI=y --CONFIG_SPI_BCM2835=y -+CONFIG_SPI_BCM2835=m -+CONFIG_SPI_SPIDEV=y -+CONFIG_PPS=m -+CONFIG_PPS_CLIENT_LDISC=m -+CONFIG_PPS_CLIENT_GPIO=m - CONFIG_GPIO_SYSFS=y -+CONFIG_GPIO_ARIZONA=m -+CONFIG_GPIO_STMPE=y -+CONFIG_W1=m -+CONFIG_W1_MASTER_DS2490=m -+CONFIG_W1_MASTER_DS2482=m -+CONFIG_W1_MASTER_DS1WM=m -+CONFIG_W1_MASTER_GPIO=m -+CONFIG_W1_SLAVE_THERM=m -+CONFIG_W1_SLAVE_SMEM=m -+CONFIG_W1_SLAVE_DS2408=m -+CONFIG_W1_SLAVE_DS2413=m -+CONFIG_W1_SLAVE_DS2406=m -+CONFIG_W1_SLAVE_DS2423=m -+CONFIG_W1_SLAVE_DS2431=m -+CONFIG_W1_SLAVE_DS2433=m -+CONFIG_W1_SLAVE_DS2760=m -+CONFIG_W1_SLAVE_DS2780=m -+CONFIG_W1_SLAVE_DS2781=m -+CONFIG_W1_SLAVE_DS28E04=m -+CONFIG_W1_SLAVE_BQ27000=m -+CONFIG_BATTERY_DS2760=m -+CONFIG_POWER_RESET=y -+CONFIG_POWER_RESET_GPIO=y - # CONFIG_HWMON is not set -+CONFIG_THERMAL=y -+CONFIG_THERMAL_BCM2835=y -+CONFIG_WATCHDOG=y -+CONFIG_BCM2835_WDT=y -+CONFIG_UCB1400_CORE=m -+CONFIG_MFD_STMPE=y -+CONFIG_STMPE_SPI=y -+CONFIG_MFD_ARIZONA_I2C=m -+CONFIG_MFD_ARIZONA_SPI=m -+CONFIG_MFD_WM5102=y -+CONFIG_MEDIA_SUPPORT=m -+CONFIG_MEDIA_CAMERA_SUPPORT=y -+CONFIG_MEDIA_ANALOG_TV_SUPPORT=y -+CONFIG_MEDIA_DIGITAL_TV_SUPPORT=y -+CONFIG_MEDIA_RADIO_SUPPORT=y -+CONFIG_MEDIA_RC_SUPPORT=y -+CONFIG_MEDIA_CONTROLLER=y -+CONFIG_LIRC=m -+CONFIG_RC_DEVICES=y -+CONFIG_RC_ATI_REMOTE=m -+CONFIG_IR_IMON=m -+CONFIG_IR_MCEUSB=m -+CONFIG_IR_REDRAT3=m -+CONFIG_IR_STREAMZAP=m -+CONFIG_IR_IGUANA=m -+CONFIG_IR_TTUSBIR=m -+CONFIG_RC_LOOPBACK=m -+CONFIG_IR_GPIO_CIR=m -+CONFIG_MEDIA_USB_SUPPORT=y -+CONFIG_USB_VIDEO_CLASS=m -+CONFIG_USB_M5602=m -+CONFIG_USB_STV06XX=m -+CONFIG_USB_GL860=m -+CONFIG_USB_GSPCA_BENQ=m -+CONFIG_USB_GSPCA_CONEX=m -+CONFIG_USB_GSPCA_CPIA1=m -+CONFIG_USB_GSPCA_DTCS033=m -+CONFIG_USB_GSPCA_ETOMS=m -+CONFIG_USB_GSPCA_FINEPIX=m -+CONFIG_USB_GSPCA_JEILINJ=m -+CONFIG_USB_GSPCA_JL2005BCD=m -+CONFIG_USB_GSPCA_KINECT=m -+CONFIG_USB_GSPCA_KONICA=m -+CONFIG_USB_GSPCA_MARS=m -+CONFIG_USB_GSPCA_MR97310A=m -+CONFIG_USB_GSPCA_NW80X=m -+CONFIG_USB_GSPCA_OV519=m -+CONFIG_USB_GSPCA_OV534=m -+CONFIG_USB_GSPCA_OV534_9=m -+CONFIG_USB_GSPCA_PAC207=m -+CONFIG_USB_GSPCA_PAC7302=m -+CONFIG_USB_GSPCA_PAC7311=m -+CONFIG_USB_GSPCA_SE401=m -+CONFIG_USB_GSPCA_SN9C2028=m -+CONFIG_USB_GSPCA_SN9C20X=m -+CONFIG_USB_GSPCA_SONIXB=m -+CONFIG_USB_GSPCA_SONIXJ=m -+CONFIG_USB_GSPCA_SPCA500=m -+CONFIG_USB_GSPCA_SPCA501=m -+CONFIG_USB_GSPCA_SPCA505=m -+CONFIG_USB_GSPCA_SPCA506=m -+CONFIG_USB_GSPCA_SPCA508=m -+CONFIG_USB_GSPCA_SPCA561=m -+CONFIG_USB_GSPCA_SPCA1528=m -+CONFIG_USB_GSPCA_SQ905=m -+CONFIG_USB_GSPCA_SQ905C=m -+CONFIG_USB_GSPCA_SQ930X=m -+CONFIG_USB_GSPCA_STK014=m -+CONFIG_USB_GSPCA_STK1135=m -+CONFIG_USB_GSPCA_STV0680=m -+CONFIG_USB_GSPCA_SUNPLUS=m -+CONFIG_USB_GSPCA_T613=m -+CONFIG_USB_GSPCA_TOPRO=m -+CONFIG_USB_GSPCA_TV8532=m -+CONFIG_USB_GSPCA_VC032X=m -+CONFIG_USB_GSPCA_VICAM=m -+CONFIG_USB_GSPCA_XIRLINK_CIT=m -+CONFIG_USB_GSPCA_ZC3XX=m -+CONFIG_USB_PWC=m -+CONFIG_VIDEO_CPIA2=m -+CONFIG_USB_ZR364XX=m -+CONFIG_USB_STKWEBCAM=m -+CONFIG_USB_S2255=m -+CONFIG_VIDEO_USBTV=m -+CONFIG_VIDEO_PVRUSB2=m -+CONFIG_VIDEO_HDPVR=m -+CONFIG_VIDEO_USBVISION=m -+CONFIG_VIDEO_STK1160_COMMON=m -+CONFIG_VIDEO_STK1160_AC97=y -+CONFIG_VIDEO_GO7007=m -+CONFIG_VIDEO_GO7007_USB=m -+CONFIG_VIDEO_GO7007_USB_S2250_BOARD=m -+CONFIG_VIDEO_AU0828=m -+CONFIG_VIDEO_AU0828_RC=y -+CONFIG_VIDEO_CX231XX=m -+CONFIG_VIDEO_CX231XX_ALSA=m -+CONFIG_VIDEO_CX231XX_DVB=m -+CONFIG_VIDEO_TM6000=m -+CONFIG_VIDEO_TM6000_ALSA=m -+CONFIG_VIDEO_TM6000_DVB=m -+CONFIG_DVB_USB=m -+CONFIG_DVB_USB_A800=m -+CONFIG_DVB_USB_DIBUSB_MB=m -+CONFIG_DVB_USB_DIBUSB_MB_FAULTY=y -+CONFIG_DVB_USB_DIBUSB_MC=m -+CONFIG_DVB_USB_DIB0700=m -+CONFIG_DVB_USB_UMT_010=m -+CONFIG_DVB_USB_CXUSB=m -+CONFIG_DVB_USB_M920X=m -+CONFIG_DVB_USB_DIGITV=m -+CONFIG_DVB_USB_VP7045=m -+CONFIG_DVB_USB_VP702X=m -+CONFIG_DVB_USB_GP8PSK=m -+CONFIG_DVB_USB_NOVA_T_USB2=m -+CONFIG_DVB_USB_TTUSB2=m -+CONFIG_DVB_USB_DTT200U=m -+CONFIG_DVB_USB_OPERA1=m -+CONFIG_DVB_USB_AF9005=m -+CONFIG_DVB_USB_AF9005_REMOTE=m -+CONFIG_DVB_USB_PCTV452E=m -+CONFIG_DVB_USB_DW2102=m -+CONFIG_DVB_USB_CINERGY_T2=m -+CONFIG_DVB_USB_DTV5100=m -+CONFIG_DVB_USB_FRIIO=m -+CONFIG_DVB_USB_AZ6027=m -+CONFIG_DVB_USB_TECHNISAT_USB2=m -+CONFIG_DVB_USB_V2=m -+CONFIG_DVB_USB_AF9015=m -+CONFIG_DVB_USB_AF9035=m -+CONFIG_DVB_USB_ANYSEE=m -+CONFIG_DVB_USB_AU6610=m -+CONFIG_DVB_USB_AZ6007=m -+CONFIG_DVB_USB_CE6230=m -+CONFIG_DVB_USB_EC168=m -+CONFIG_DVB_USB_GL861=m -+CONFIG_DVB_USB_LME2510=m -+CONFIG_DVB_USB_MXL111SF=m -+CONFIG_DVB_USB_RTL28XXU=m -+CONFIG_DVB_USB_DVBSKY=m -+CONFIG_SMS_USB_DRV=m -+CONFIG_DVB_B2C2_FLEXCOP_USB=m -+CONFIG_DVB_AS102=m -+CONFIG_VIDEO_EM28XX=m -+CONFIG_VIDEO_EM28XX_V4L2=m -+CONFIG_VIDEO_EM28XX_ALSA=m -+CONFIG_VIDEO_EM28XX_DVB=m -+CONFIG_V4L_PLATFORM_DRIVERS=y -+CONFIG_VIDEO_BCM2835=y -+CONFIG_VIDEO_BCM2835_MMAL=m -+CONFIG_RADIO_SI470X=y -+CONFIG_USB_SI470X=m -+CONFIG_I2C_SI470X=m -+CONFIG_RADIO_SI4713=m -+CONFIG_I2C_SI4713=m -+CONFIG_USB_MR800=m -+CONFIG_USB_DSBR=m -+CONFIG_RADIO_SHARK=m -+CONFIG_RADIO_SHARK2=m -+CONFIG_USB_KEENE=m -+CONFIG_USB_MA901=m -+CONFIG_RADIO_TEA5764=m -+CONFIG_RADIO_SAA7706H=m -+CONFIG_RADIO_TEF6862=m -+CONFIG_RADIO_WL1273=m -+CONFIG_RADIO_WL128X=m -+# CONFIG_MEDIA_SUBDRV_AUTOSELECT is not set -+CONFIG_VIDEO_UDA1342=m -+CONFIG_VIDEO_SONY_BTF_MPX=m -+CONFIG_VIDEO_TVP5150=m -+CONFIG_VIDEO_TW2804=m -+CONFIG_VIDEO_TW9903=m -+CONFIG_VIDEO_TW9906=m -+CONFIG_VIDEO_OV7640=m -+CONFIG_VIDEO_MT9V011=m - CONFIG_FB=y --CONFIG_FB_SIMPLE=y -+CONFIG_FB_BCM2708=y -+CONFIG_FB_SSD1307=m -+CONFIG_FB_RPISENSE=m -+# CONFIG_BACKLIGHT_GENERIC is not set -+CONFIG_BACKLIGHT_GPIO=m - CONFIG_FRAMEBUFFER_CONSOLE=y - CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y -+CONFIG_LOGO=y -+# CONFIG_LOGO_LINUX_MONO is not set -+# CONFIG_LOGO_LINUX_VGA16 is not set -+CONFIG_SOUND=y -+CONFIG_SND=m -+CONFIG_SND_SEQUENCER=m -+CONFIG_SND_SEQ_DUMMY=m -+CONFIG_SND_MIXER_OSS=m -+CONFIG_SND_PCM_OSS=m -+CONFIG_SND_SEQUENCER_OSS=y -+CONFIG_SND_HRTIMER=m -+CONFIG_SND_DUMMY=m -+CONFIG_SND_ALOOP=m -+CONFIG_SND_VIRMIDI=m -+CONFIG_SND_MTPAV=m -+CONFIG_SND_SERIAL_U16550=m -+CONFIG_SND_MPU401=m -+CONFIG_SND_BCM2835=m -+CONFIG_SND_USB_AUDIO=m -+CONFIG_SND_USB_UA101=m -+CONFIG_SND_USB_CAIAQ=m -+CONFIG_SND_USB_CAIAQ_INPUT=y -+CONFIG_SND_USB_6FIRE=m -+CONFIG_SND_SOC=m -+CONFIG_SND_BCM2835_SOC_I2S=m -+CONFIG_SND_BCM2708_SOC_I2S=m -+CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC=m -+CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS=m -+CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI=m -+CONFIG_SND_BCM2708_SOC_HIFIBERRY_AMP=m -+CONFIG_SND_BCM2708_SOC_RPI_DAC=m -+CONFIG_SND_BCM2708_SOC_RPI_PROTO=m -+CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC=m -+CONFIG_SND_SOC_WM8804_I2C=m -+CONFIG_SND_SIMPLE_CARD=m -+CONFIG_SOUND_PRIME=m -+CONFIG_HIDRAW=y -+CONFIG_HID_A4TECH=m -+CONFIG_HID_ACRUX=m -+CONFIG_HID_APPLE=m -+CONFIG_HID_BELKIN=m -+CONFIG_HID_CHERRY=m -+CONFIG_HID_CHICONY=m -+CONFIG_HID_CYPRESS=m -+CONFIG_HID_DRAGONRISE=m -+CONFIG_HID_EMS_FF=m -+CONFIG_HID_ELECOM=m -+CONFIG_HID_ELO=m -+CONFIG_HID_EZKEY=m -+CONFIG_HID_HOLTEK=m -+CONFIG_HID_KEYTOUCH=m -+CONFIG_HID_KYE=m -+CONFIG_HID_UCLOGIC=m -+CONFIG_HID_WALTOP=m -+CONFIG_HID_GYRATION=m -+CONFIG_HID_TWINHAN=m -+CONFIG_HID_KENSINGTON=m -+CONFIG_HID_LCPOWER=m -+CONFIG_HID_LOGITECH=m -+CONFIG_HID_MAGICMOUSE=m -+CONFIG_HID_MICROSOFT=m -+CONFIG_HID_MONTEREY=m -+CONFIG_HID_MULTITOUCH=m -+CONFIG_HID_NTRIG=m -+CONFIG_HID_ORTEK=m -+CONFIG_HID_PANTHERLORD=m -+CONFIG_HID_PETALYNX=m -+CONFIG_HID_PICOLCD=m -+CONFIG_HID_ROCCAT=m -+CONFIG_HID_SAMSUNG=m -+CONFIG_HID_SONY=m -+CONFIG_HID_SPEEDLINK=m -+CONFIG_HID_SUNPLUS=m -+CONFIG_HID_GREENASIA=m -+CONFIG_HID_SMARTJOYPLUS=m -+CONFIG_HID_TOPSEED=m -+CONFIG_HID_THINGM=m -+CONFIG_HID_THRUSTMASTER=m -+CONFIG_HID_WACOM=m -+CONFIG_HID_WIIMOTE=m -+CONFIG_HID_XINMO=m -+CONFIG_HID_ZEROPLUS=m -+CONFIG_HID_ZYDACRON=m -+CONFIG_HID_PID=y -+CONFIG_USB_HIDDEV=y - CONFIG_USB=y -+CONFIG_USB_ANNOUNCE_NEW_DEVICES=y -+CONFIG_USB_MON=m -+CONFIG_USB_DWCOTG=y -+CONFIG_USB_PRINTER=m - CONFIG_USB_STORAGE=y -+CONFIG_USB_STORAGE_REALTEK=m -+CONFIG_USB_STORAGE_DATAFAB=m -+CONFIG_USB_STORAGE_FREECOM=m -+CONFIG_USB_STORAGE_ISD200=m -+CONFIG_USB_STORAGE_USBAT=m -+CONFIG_USB_STORAGE_SDDR09=m -+CONFIG_USB_STORAGE_SDDR55=m -+CONFIG_USB_STORAGE_JUMPSHOT=m -+CONFIG_USB_STORAGE_ALAUDA=m -+CONFIG_USB_STORAGE_ONETOUCH=m -+CONFIG_USB_STORAGE_KARMA=m -+CONFIG_USB_STORAGE_CYPRESS_ATACB=m -+CONFIG_USB_STORAGE_ENE_UB6250=m -+CONFIG_USB_MDC800=m -+CONFIG_USB_MICROTEK=m -+CONFIG_USBIP_CORE=m -+CONFIG_USBIP_VHCI_HCD=m -+CONFIG_USBIP_HOST=m -+CONFIG_USB_DWC2=y -+CONFIG_USB_SERIAL=m -+CONFIG_USB_SERIAL_GENERIC=y -+CONFIG_USB_SERIAL_AIRCABLE=m -+CONFIG_USB_SERIAL_ARK3116=m -+CONFIG_USB_SERIAL_BELKIN=m -+CONFIG_USB_SERIAL_CH341=m -+CONFIG_USB_SERIAL_WHITEHEAT=m -+CONFIG_USB_SERIAL_DIGI_ACCELEPORT=m -+CONFIG_USB_SERIAL_CP210X=m -+CONFIG_USB_SERIAL_CYPRESS_M8=m -+CONFIG_USB_SERIAL_EMPEG=m -+CONFIG_USB_SERIAL_FTDI_SIO=m -+CONFIG_USB_SERIAL_VISOR=m -+CONFIG_USB_SERIAL_IPAQ=m -+CONFIG_USB_SERIAL_IR=m -+CONFIG_USB_SERIAL_EDGEPORT=m -+CONFIG_USB_SERIAL_EDGEPORT_TI=m -+CONFIG_USB_SERIAL_F81232=m -+CONFIG_USB_SERIAL_GARMIN=m -+CONFIG_USB_SERIAL_IPW=m -+CONFIG_USB_SERIAL_IUU=m -+CONFIG_USB_SERIAL_KEYSPAN_PDA=m -+CONFIG_USB_SERIAL_KEYSPAN=m -+CONFIG_USB_SERIAL_KLSI=m -+CONFIG_USB_SERIAL_KOBIL_SCT=m -+CONFIG_USB_SERIAL_MCT_U232=m -+CONFIG_USB_SERIAL_METRO=m -+CONFIG_USB_SERIAL_MOS7720=m -+CONFIG_USB_SERIAL_MOS7840=m -+CONFIG_USB_SERIAL_NAVMAN=m -+CONFIG_USB_SERIAL_PL2303=m -+CONFIG_USB_SERIAL_OTI6858=m -+CONFIG_USB_SERIAL_QCAUX=m -+CONFIG_USB_SERIAL_QUALCOMM=m -+CONFIG_USB_SERIAL_SPCP8X5=m -+CONFIG_USB_SERIAL_SAFE=m -+CONFIG_USB_SERIAL_SIERRAWIRELESS=m -+CONFIG_USB_SERIAL_SYMBOL=m -+CONFIG_USB_SERIAL_TI=m -+CONFIG_USB_SERIAL_CYBERJACK=m -+CONFIG_USB_SERIAL_XIRCOM=m -+CONFIG_USB_SERIAL_OPTION=m -+CONFIG_USB_SERIAL_OMNINET=m -+CONFIG_USB_SERIAL_OPTICON=m -+CONFIG_USB_SERIAL_XSENS_MT=m -+CONFIG_USB_SERIAL_WISHBONE=m -+CONFIG_USB_SERIAL_SSU100=m -+CONFIG_USB_SERIAL_QT2=m -+CONFIG_USB_SERIAL_DEBUG=m -+CONFIG_USB_EMI62=m -+CONFIG_USB_EMI26=m -+CONFIG_USB_ADUTUX=m -+CONFIG_USB_SEVSEG=m -+CONFIG_USB_RIO500=m -+CONFIG_USB_LEGOTOWER=m -+CONFIG_USB_LCD=m -+CONFIG_USB_LED=m -+CONFIG_USB_CYPRESS_CY7C63=m -+CONFIG_USB_CYTHERM=m -+CONFIG_USB_IDMOUSE=m -+CONFIG_USB_FTDI_ELAN=m -+CONFIG_USB_APPLEDISPLAY=m -+CONFIG_USB_LD=m -+CONFIG_USB_TRANCEVIBRATOR=m -+CONFIG_USB_IOWARRIOR=m -+CONFIG_USB_TEST=m -+CONFIG_USB_ISIGHTFW=m -+CONFIG_USB_YUREX=m -+CONFIG_USB_ATM=m -+CONFIG_USB_SPEEDTOUCH=m -+CONFIG_USB_CXACRU=m -+CONFIG_USB_UEAGLEATM=m -+CONFIG_USB_XUSBATM=m - CONFIG_MMC=y -+CONFIG_MMC_BLOCK_MINORS=32 -+CONFIG_MMC_BCM2835=y -+CONFIG_MMC_BCM2835_DMA=y -+CONFIG_MMC_BCM2835_SDHOST=y - CONFIG_MMC_SDHCI=y - CONFIG_MMC_SDHCI_PLTFM=y - CONFIG_MMC_SDHCI_BCM2835=y -+CONFIG_MMC_SPI=m -+CONFIG_LEDS_CLASS=y - CONFIG_LEDS_GPIO=y - CONFIG_LEDS_TRIGGER_TIMER=y - CONFIG_LEDS_TRIGGER_ONESHOT=y - CONFIG_LEDS_TRIGGER_HEARTBEAT=y -+CONFIG_LEDS_TRIGGER_BACKLIGHT=y - CONFIG_LEDS_TRIGGER_CPU=y - CONFIG_LEDS_TRIGGER_GPIO=y - CONFIG_LEDS_TRIGGER_DEFAULT_ON=y --CONFIG_LEDS_TRIGGER_TRANSIENT=y --CONFIG_LEDS_TRIGGER_CAMERA=y -+CONFIG_LEDS_TRIGGER_TRANSIENT=m -+CONFIG_LEDS_TRIGGER_CAMERA=m -+CONFIG_LEDS_TRIGGER_INPUT=y -+CONFIG_RTC_CLASS=y -+# CONFIG_RTC_HCTOSYS is not set -+CONFIG_RTC_DRV_DS1307=m -+CONFIG_RTC_DRV_DS1374=m -+CONFIG_RTC_DRV_DS1672=m -+CONFIG_RTC_DRV_DS3232=m -+CONFIG_RTC_DRV_MAX6900=m -+CONFIG_RTC_DRV_RS5C372=m -+CONFIG_RTC_DRV_ISL1208=m -+CONFIG_RTC_DRV_ISL12022=m -+CONFIG_RTC_DRV_ISL12057=m -+CONFIG_RTC_DRV_X1205=m -+CONFIG_RTC_DRV_PCF2127=m -+CONFIG_RTC_DRV_PCF8523=m -+CONFIG_RTC_DRV_PCF8563=m -+CONFIG_RTC_DRV_PCF8583=m -+CONFIG_RTC_DRV_M41T80=m -+CONFIG_RTC_DRV_BQ32K=m -+CONFIG_RTC_DRV_S35390A=m -+CONFIG_RTC_DRV_FM3130=m -+CONFIG_RTC_DRV_RX8581=m -+CONFIG_RTC_DRV_RX8025=m -+CONFIG_RTC_DRV_EM3027=m -+CONFIG_RTC_DRV_RV3029C2=m -+CONFIG_RTC_DRV_M41T93=m -+CONFIG_RTC_DRV_M41T94=m -+CONFIG_RTC_DRV_DS1305=m -+CONFIG_RTC_DRV_DS1390=m -+CONFIG_RTC_DRV_MAX6902=m -+CONFIG_RTC_DRV_R9701=m -+CONFIG_RTC_DRV_RS5C348=m -+CONFIG_RTC_DRV_DS3234=m -+CONFIG_RTC_DRV_PCF2123=m -+CONFIG_RTC_DRV_RX4581=m -+CONFIG_DMADEVICES=y -+CONFIG_DMA_BCM2835=y -+CONFIG_DMA_BCM2708=y -+CONFIG_UIO=m -+CONFIG_UIO_PDRV_GENIRQ=m - CONFIG_STAGING=y --CONFIG_USB_DWC2=y --CONFIG_USB_DWC2_HOST=y -+CONFIG_PRISM2_USB=m -+CONFIG_R8712U=m -+CONFIG_R8188EU=m -+CONFIG_R8723AU=m -+CONFIG_VT6656=m -+CONFIG_SPEAKUP=m -+CONFIG_SPEAKUP_SYNTH_SOFT=m -+CONFIG_STAGING_MEDIA=y -+CONFIG_LIRC_STAGING=y -+CONFIG_LIRC_IMON=m -+CONFIG_LIRC_RPI=m -+CONFIG_LIRC_SASEM=m -+CONFIG_LIRC_SERIAL=m -+CONFIG_FB_TFT=m -+CONFIG_FB_TFT_AGM1264K_FL=m -+CONFIG_FB_TFT_BD663474=m -+CONFIG_FB_TFT_HX8340BN=m -+CONFIG_FB_TFT_HX8347D=m -+CONFIG_FB_TFT_HX8353D=m -+CONFIG_FB_TFT_ILI9320=m -+CONFIG_FB_TFT_ILI9325=m -+CONFIG_FB_TFT_ILI9340=m -+CONFIG_FB_TFT_ILI9341=m -+CONFIG_FB_TFT_ILI9481=m -+CONFIG_FB_TFT_ILI9486=m -+CONFIG_FB_TFT_PCD8544=m -+CONFIG_FB_TFT_RA8875=m -+CONFIG_FB_TFT_S6D02A1=m -+CONFIG_FB_TFT_S6D1121=m -+CONFIG_FB_TFT_SSD1289=m -+CONFIG_FB_TFT_SSD1306=m -+CONFIG_FB_TFT_SSD1331=m -+CONFIG_FB_TFT_SSD1351=m -+CONFIG_FB_TFT_ST7735R=m -+CONFIG_FB_TFT_TINYLCD=m -+CONFIG_FB_TFT_TLS8204=m -+CONFIG_FB_TFT_UC1701=m -+CONFIG_FB_TFT_UPD161704=m -+CONFIG_FB_TFT_WATTEROTT=m -+CONFIG_FB_FLEX=m -+CONFIG_FB_TFT_FBTFT_DEVICE=m -+CONFIG_MAILBOX=y -+CONFIG_BCM2835_MBOX=y - # CONFIG_IOMMU_SUPPORT is not set -+CONFIG_EXTCON=m -+CONFIG_EXTCON_ARIZONA=m -+CONFIG_IIO=m -+CONFIG_IIO_BUFFER=y -+CONFIG_IIO_BUFFER_CB=y -+CONFIG_IIO_KFIFO_BUF=m -+CONFIG_DHT11=m -+CONFIG_RASPBERRYPI_FIRMWARE=y - CONFIG_EXT2_FS=y - CONFIG_EXT2_FS_XATTR=y - CONFIG_EXT2_FS_POSIX_ACL=y -@@ -107,18 +1105,110 @@ CONFIG_EXT3_FS=y - CONFIG_EXT3_FS_POSIX_ACL=y - CONFIG_EXT4_FS=y - CONFIG_EXT4_FS_POSIX_ACL=y -+CONFIG_EXT4_FS_SECURITY=y -+CONFIG_REISERFS_FS=m -+CONFIG_REISERFS_FS_XATTR=y -+CONFIG_REISERFS_FS_POSIX_ACL=y -+CONFIG_REISERFS_FS_SECURITY=y -+CONFIG_JFS_FS=m -+CONFIG_JFS_POSIX_ACL=y -+CONFIG_JFS_SECURITY=y -+CONFIG_JFS_STATISTICS=y -+CONFIG_XFS_FS=m -+CONFIG_XFS_QUOTA=y -+CONFIG_XFS_POSIX_ACL=y -+CONFIG_XFS_RT=y -+CONFIG_GFS2_FS=m -+CONFIG_OCFS2_FS=m -+CONFIG_BTRFS_FS=m -+CONFIG_BTRFS_FS_POSIX_ACL=y -+CONFIG_NILFS2_FS=m -+CONFIG_F2FS_FS=y - CONFIG_FANOTIFY=y -+CONFIG_QFMT_V1=m -+CONFIG_QFMT_V2=m -+CONFIG_AUTOFS4_FS=y -+CONFIG_FUSE_FS=m -+CONFIG_CUSE=m -+CONFIG_FSCACHE=y -+CONFIG_FSCACHE_STATS=y -+CONFIG_FSCACHE_HISTOGRAM=y -+CONFIG_CACHEFILES=y -+CONFIG_ISO9660_FS=m -+CONFIG_JOLIET=y -+CONFIG_ZISOFS=y -+CONFIG_UDF_FS=m - CONFIG_MSDOS_FS=y - CONFIG_VFAT_FS=y -+CONFIG_FAT_DEFAULT_IOCHARSET="ascii" -+CONFIG_NTFS_FS=m -+CONFIG_NTFS_RW=y - CONFIG_TMPFS=y - CONFIG_TMPFS_POSIX_ACL=y --# CONFIG_MISC_FILESYSTEMS is not set -+CONFIG_CONFIGFS_FS=y -+CONFIG_ECRYPT_FS=m -+CONFIG_HFS_FS=m -+CONFIG_HFSPLUS_FS=m -+CONFIG_SQUASHFS=m -+CONFIG_SQUASHFS_XATTR=y -+CONFIG_SQUASHFS_LZO=y -+CONFIG_SQUASHFS_XZ=y - CONFIG_NFS_FS=y --CONFIG_NFSD=y -+CONFIG_NFS_V3_ACL=y -+CONFIG_NFS_V4=y -+CONFIG_NFS_SWAP=y -+CONFIG_ROOT_NFS=y -+CONFIG_NFS_FSCACHE=y -+CONFIG_NFSD=m -+CONFIG_NFSD_V3_ACL=y -+CONFIG_NFSD_V4=y -+CONFIG_CIFS=m -+CONFIG_CIFS_WEAK_PW_HASH=y -+CONFIG_CIFS_UPCALL=y -+CONFIG_CIFS_XATTR=y -+CONFIG_CIFS_POSIX=y -+CONFIG_9P_FS=m -+CONFIG_9P_FS_POSIX_ACL=y -+CONFIG_NLS_DEFAULT="utf8" - CONFIG_NLS_CODEPAGE_437=y -+CONFIG_NLS_CODEPAGE_737=m -+CONFIG_NLS_CODEPAGE_775=m -+CONFIG_NLS_CODEPAGE_850=m -+CONFIG_NLS_CODEPAGE_852=m -+CONFIG_NLS_CODEPAGE_855=m -+CONFIG_NLS_CODEPAGE_857=m -+CONFIG_NLS_CODEPAGE_860=m -+CONFIG_NLS_CODEPAGE_861=m -+CONFIG_NLS_CODEPAGE_862=m -+CONFIG_NLS_CODEPAGE_863=m -+CONFIG_NLS_CODEPAGE_864=m -+CONFIG_NLS_CODEPAGE_865=m -+CONFIG_NLS_CODEPAGE_866=m -+CONFIG_NLS_CODEPAGE_869=m -+CONFIG_NLS_CODEPAGE_936=m -+CONFIG_NLS_CODEPAGE_950=m -+CONFIG_NLS_CODEPAGE_932=m -+CONFIG_NLS_CODEPAGE_949=m -+CONFIG_NLS_CODEPAGE_874=m -+CONFIG_NLS_ISO8859_8=m -+CONFIG_NLS_CODEPAGE_1250=m -+CONFIG_NLS_CODEPAGE_1251=m - CONFIG_NLS_ASCII=y --CONFIG_NLS_ISO8859_1=y -+CONFIG_NLS_ISO8859_1=m -+CONFIG_NLS_ISO8859_2=m -+CONFIG_NLS_ISO8859_3=m -+CONFIG_NLS_ISO8859_4=m -+CONFIG_NLS_ISO8859_5=m -+CONFIG_NLS_ISO8859_6=m -+CONFIG_NLS_ISO8859_7=m -+CONFIG_NLS_ISO8859_9=m -+CONFIG_NLS_ISO8859_13=m -+CONFIG_NLS_ISO8859_14=m -+CONFIG_NLS_ISO8859_15=m -+CONFIG_NLS_KOI8_R=m -+CONFIG_NLS_KOI8_U=m - CONFIG_NLS_UTF8=y -+CONFIG_DLM=m - CONFIG_PRINTK_TIME=y - CONFIG_BOOT_PRINTK_DELAY=y - CONFIG_DYNAMIC_DEBUG=y -@@ -128,14 +1218,38 @@ CONFIG_DEBUG_INFO=y - CONFIG_UNUSED_SYMBOLS=y - CONFIG_DEBUG_MEMORY_INIT=y - CONFIG_LOCKUP_DETECTOR=y -+CONFIG_TIMER_STATS=y -+# CONFIG_DEBUG_PREEMPT is not set -+CONFIG_LATENCYTOP=y -+CONFIG_IRQSOFF_TRACER=y - CONFIG_SCHED_TRACER=y - CONFIG_STACK_TRACER=y -+CONFIG_BLK_DEV_IO_TRACE=y -+# CONFIG_KPROBE_EVENT is not set - CONFIG_FUNCTION_PROFILER=y - CONFIG_TEST_KSTRTOX=y - CONFIG_KGDB=y - CONFIG_KGDB_KDB=y -+CONFIG_KDB_KEYBOARD=y - CONFIG_STRICT_DEVMEM=y - CONFIG_DEBUG_LL=y - CONFIG_EARLY_PRINTK=y -+CONFIG_CRYPTO_USER=m -+CONFIG_CRYPTO_CRYPTD=m -+CONFIG_CRYPTO_CBC=y -+CONFIG_CRYPTO_CTS=m -+CONFIG_CRYPTO_XTS=m -+CONFIG_CRYPTO_XCBC=m -+CONFIG_CRYPTO_SHA512=m -+CONFIG_CRYPTO_TGR192=m -+CONFIG_CRYPTO_WP512=m -+CONFIG_CRYPTO_CAST5=m -+CONFIG_CRYPTO_DES=y -+# CONFIG_CRYPTO_HW is not set -+CONFIG_ARM_CRYPTO=y -+CONFIG_CRYPTO_SHA1_ARM=m -+CONFIG_CRYPTO_AES_ARM=m -+CONFIG_CRC_ITU_T=y -+CONFIG_LIBCRC32C=y - # CONFIG_XZ_DEC_ARM is not set - # CONFIG_XZ_DEC_ARMTHUMB is not set - -From 6fb12ee15eb9b0f5b6fea66c861a9db8ec6671ed Mon Sep 17 00:00:00 2001 -From: Gordon Hollingworth <gordon@raspberrypi.org> -Date: Tue, 12 May 2015 14:47:56 +0100 -Subject: [PATCH 079/170] rpi-ft5406: Add touchscreen driver for pi LCD display - -Fix driver detection failure Check that the buffer response is non-zero meaning the touchscreen was detected - -rpi-ft5406: Use firmware API ---- - drivers/input/touchscreen/Kconfig | 7 + - drivers/input/touchscreen/Makefile | 1 + - drivers/input/touchscreen/rpi-ft5406.c | 246 +++++++++++++++++++++++++++++++++ - 3 files changed, 254 insertions(+) - create mode 100644 drivers/input/touchscreen/rpi-ft5406.c - -diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig -index ae33da7..5935716 100644 ---- a/drivers/input/touchscreen/Kconfig -+++ b/drivers/input/touchscreen/Kconfig -@@ -608,6 +608,13 @@ config TOUCHSCREEN_EDT_FT5X06 - To compile this driver as a module, choose M here: the - module will be called edt-ft5x06. - -+config TOUCHSCREEN_RPI_FT5406 -+ tristate "Raspberry Pi FT5406 driver" -+ depends on RASPBERRYPI_FIRMWARE -+ help -+ Say Y here to enable the Raspberry Pi memory based FT5406 device -+ -+ - config TOUCHSCREEN_MIGOR - tristate "Renesas MIGO-R touchscreen" - depends on SH_MIGOR && I2C -diff --git a/drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile -index cbaa6ab..13ab8c0 100644 ---- a/drivers/input/touchscreen/Makefile -+++ b/drivers/input/touchscreen/Makefile -@@ -29,6 +29,7 @@ obj-$(CONFIG_TOUCHSCREEN_DA9034) += da9034-ts.o - obj-$(CONFIG_TOUCHSCREEN_DA9052) += da9052_tsi.o - obj-$(CONFIG_TOUCHSCREEN_DYNAPRO) += dynapro.o - obj-$(CONFIG_TOUCHSCREEN_EDT_FT5X06) += edt-ft5x06.o -+obj-$(CONFIG_TOUCHSCREEN_RPI_FT5406) += rpi-ft5406.o - obj-$(CONFIG_TOUCHSCREEN_HAMPSHIRE) += hampshire.o - obj-$(CONFIG_TOUCHSCREEN_GUNZE) += gunze.o - obj-$(CONFIG_TOUCHSCREEN_EETI) += eeti_ts.o -diff --git a/drivers/input/touchscreen/rpi-ft5406.c b/drivers/input/touchscreen/rpi-ft5406.c -new file mode 100644 -index 0000000..b27dbee ---- /dev/null -+++ b/drivers/input/touchscreen/rpi-ft5406.c -@@ -0,0 +1,246 @@ -+/* -+ * Driver for memory based ft5406 touchscreen -+ * -+ * Copyright (C) 2015 Raspberry Pi -+ * -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 as -+ * published by the Free Software Foundation. -+ */ -+ -+ -+#include <linux/module.h> -+#include <linux/interrupt.h> -+#include <linux/input.h> -+#include <linux/irq.h> -+#include <linux/delay.h> -+#include <linux/slab.h> -+#include <linux/bitops.h> -+#include <linux/input/mt.h> -+#include <linux/kthread.h> -+#include <linux/platform_device.h> -+#include <asm/io.h> -+#include <soc/bcm2835/raspberrypi-firmware.h> -+ -+#define MAXIMUM_SUPPORTED_POINTS 10 -+struct ft5406_regs { -+ uint8_t device_mode; -+ uint8_t gesture_id; -+ uint8_t num_points; -+ struct ft5406_touch { -+ uint8_t xh; -+ uint8_t xl; -+ uint8_t yh; -+ uint8_t yl; -+ uint8_t res1; -+ uint8_t res2; -+ } point[MAXIMUM_SUPPORTED_POINTS]; -+}; -+ -+#define SCREEN_WIDTH 800 -+#define SCREEN_HEIGHT 480 -+ -+struct ft5406 { -+ struct platform_device * pdev; -+ struct input_dev * input_dev; -+ void __iomem * ts_base; -+ struct ft5406_regs * regs; -+ struct task_struct * thread; -+}; -+ -+/* Thread to poll for touchscreen events -+ * -+ * This thread polls the memory based register copy of the ft5406 registers -+ * using the number of points register to know whether the copy has been -+ * updated (we write 99 to the memory copy, the GPU will write between -+ * 0 - 10 points) -+ */ -+static int ft5406_thread(void *arg) -+{ -+ struct ft5406 *ts = (struct ft5406 *) arg; -+ struct ft5406_regs regs; -+ int known_ids = 0; -+ -+ while(!kthread_should_stop()) -+ { -+ // 60fps polling -+ msleep_interruptible(17); -+ memcpy_fromio(&regs, ts->regs, sizeof(*ts->regs)); -+ writel(99, &ts->regs->num_points); -+ // Do not output if theres no new information (num_points is 99) -+ // or we have no touch points and don't need to release any -+ if(!(regs.num_points == 99 || (regs.num_points == 0 && known_ids == 0))) -+ { -+ int i; -+ int modified_ids = 0, released_ids; -+ for(i = 0; i < regs.num_points; i++) -+ { -+ int x = (((int) regs.point[i].xh & 0xf) << 8) + regs.point[i].xl; -+ int y = (((int) regs.point[i].yh & 0xf) << 8) + regs.point[i].yl; -+ int touchid = (regs.point[i].yh >> 4) & 0xf; -+ -+ modified_ids |= 1 << touchid; -+ -+ if(!((1 << touchid) & known_ids)) -+ dev_dbg(&ts->pdev->dev, "x = %d, y = %d, touchid = %d\n", x, y, touchid); -+ -+ input_mt_slot(ts->input_dev, touchid); -+ input_mt_report_slot_state(ts->input_dev, MT_TOOL_FINGER, 1); -+ -+ input_report_abs(ts->input_dev, ABS_MT_POSITION_X, x); -+ input_report_abs(ts->input_dev, ABS_MT_POSITION_Y, y); -+ -+ } -+ -+ released_ids = known_ids & ~modified_ids; -+ for(i = 0; released_ids && i < MAXIMUM_SUPPORTED_POINTS; i++) -+ { -+ if(released_ids & (1<<i)) -+ { -+ dev_dbg(&ts->pdev->dev, "Released %d, known = %x modified = %x\n", i, known_ids, modified_ids); -+ input_mt_slot(ts->input_dev, i); -+ input_mt_report_slot_state(ts->input_dev, MT_TOOL_FINGER, 0); -+ modified_ids &= ~(1 << i); -+ } -+ } -+ known_ids = modified_ids; -+ -+ input_mt_report_pointer_emulation(ts->input_dev, true); -+ input_sync(ts->input_dev); -+ } -+ -+ } -+ -+ return 0; -+} -+ -+static int ft5406_probe(struct platform_device *pdev) -+{ -+ int ret; -+ struct input_dev * input_dev = input_allocate_device(); -+ struct ft5406 * ts; -+ struct device_node *fw_node; -+ struct rpi_firmware *fw; -+ u32 touchbuf; -+ -+ dev_info(&pdev->dev, "Probing device\n"); -+ -+ fw_node = of_parse_phandle(pdev->dev.of_node, "firmware", 0); -+ if (!fw_node) { -+ dev_err(&pdev->dev, "Missing firmware node\n"); -+ return -ENOENT; -+ } -+ -+ fw = rpi_firmware_get(fw_node); -+ if (!fw) -+ return -EPROBE_DEFER; -+ -+ ret = rpi_firmware_property(fw, RPI_FIRMWARE_FRAMEBUFFER_GET_TOUCHBUF, -+ &touchbuf, sizeof(touchbuf)); -+ if (ret) { -+ dev_err(&pdev->dev, "Failed to get touch buffer\n"); -+ return ret; -+ } -+ -+ if (!touchbuf) { -+ dev_err(&pdev->dev, "Touchscreen not detected\n"); -+ return -ENODEV; -+ } -+ -+ dev_dbg(&pdev->dev, "Got TS buffer 0x%x\n", touchbuf); -+ -+ ts = kzalloc(sizeof(struct ft5406), GFP_KERNEL); -+ -+ if (!ts || !input_dev) { -+ ret = -ENOMEM; -+ dev_err(&pdev->dev, "Failed to allocate memory\n"); -+ return ret; -+ } -+ ts->input_dev = input_dev; -+ platform_set_drvdata(pdev, ts); -+ ts->pdev = pdev; -+ -+ input_dev->name = "FT5406 memory based driver"; -+ -+ __set_bit(EV_KEY, input_dev->evbit); -+ __set_bit(EV_SYN, input_dev->evbit); -+ __set_bit(EV_ABS, input_dev->evbit); -+ -+ input_set_abs_params(input_dev, ABS_MT_POSITION_X, 0, -+ SCREEN_WIDTH, 0, 0); -+ input_set_abs_params(input_dev, ABS_MT_POSITION_Y, 0, -+ SCREEN_HEIGHT, 0, 0); -+ -+ input_mt_init_slots(input_dev, MAXIMUM_SUPPORTED_POINTS, INPUT_MT_DIRECT); -+ -+ input_set_drvdata(input_dev, ts); -+ -+ ret = input_register_device(input_dev); -+ if (ret) { -+ dev_err(&pdev->dev, "could not register input device, %d\n", -+ ret); -+ return ret; -+ } -+ -+ // mmap the physical memory -+ touchbuf &= ~0xc0000000; -+ ts->ts_base = ioremap(touchbuf, sizeof(*ts->regs)); -+ if(ts->ts_base == NULL) -+ { -+ dev_err(&pdev->dev, "Failed to map physical address\n"); -+ input_unregister_device(input_dev); -+ kzfree(ts); -+ return -ENOMEM; -+ } -+ -+ ts->regs = (struct ft5406_regs *) ts->ts_base; -+ -+ // create thread to poll the touch events -+ ts->thread = kthread_run(ft5406_thread, ts, "ft5406"); -+ if(ts->thread == NULL) -+ { -+ dev_err(&pdev->dev, "Failed to create kernel thread"); -+ iounmap(ts->ts_base); -+ input_unregister_device(input_dev); -+ kzfree(ts); -+ } -+ -+ return 0; -+} -+ -+static int ft5406_remove(struct platform_device *pdev) -+{ -+ struct ft5406 *ts = (struct ft5406 *) platform_get_drvdata(pdev); -+ -+ dev_info(&pdev->dev, "Removing rpi-ft5406\n"); -+ -+ kthread_stop(ts->thread); -+ iounmap(ts->ts_base); -+ input_unregister_device(ts->input_dev); -+ kzfree(ts); -+ -+ return 0; -+} -+ -+static const struct of_device_id ft5406_match[] = { -+ { .compatible = "rpi,rpi-ft5406", }, -+ {}, -+}; -+MODULE_DEVICE_TABLE(of, ft5406_match); -+ -+static struct platform_driver ft5406_driver = { -+ .driver = { -+ .name = "rpi-ft5406", -+ .owner = THIS_MODULE, -+ .of_match_table = ft5406_match, -+ }, -+ .probe = ft5406_probe, -+ .remove = ft5406_remove, -+}; -+ -+module_platform_driver(ft5406_driver); -+ -+MODULE_AUTHOR("Gordon Hollingworth"); -+MODULE_DESCRIPTION("Touchscreen driver for memory based FT5406"); -+MODULE_LICENSE("GPL"); - -From b57a6269e03fe055f78ab50add6e2c68d43254e2 Mon Sep 17 00:00:00 2001 -From: Phil Elwell <phil@raspberrypi.org> -Date: Mon, 13 Oct 2014 11:47:53 +0100 -Subject: [PATCH 080/170] Improve __copy_to_user and __copy_from_user - performance - -Provide a __copy_from_user that uses memcpy. On BCM2708, use -optimised memcpy/memmove/memcmp/memset implementations. - -arch/arm: Add mmiocpy/set aliases for memcpy/set - -See: https://github.com/raspberrypi/linux/issues/1082 ---- - arch/arm/include/asm/string.h | 5 + - arch/arm/include/asm/uaccess.h | 3 + - arch/arm/lib/Makefile | 15 +- - arch/arm/lib/arm-mem.h | 159 ++++++++++++ - arch/arm/lib/copy_from_user.S | 4 +- - arch/arm/lib/exports_rpi.c | 37 +++ - arch/arm/lib/memcmp_rpi.S | 285 +++++++++++++++++++++ - arch/arm/lib/memcpy_rpi.S | 61 +++++ - arch/arm/lib/memcpymove.h | 506 +++++++++++++++++++++++++++++++++++++ - arch/arm/lib/memmove_rpi.S | 61 +++++ - arch/arm/lib/memset_rpi.S | 123 +++++++++ - arch/arm/lib/uaccess_with_memcpy.c | 112 +++++++- - 12 files changed, 1365 insertions(+), 6 deletions(-) - create mode 100644 arch/arm/lib/arm-mem.h - create mode 100644 arch/arm/lib/exports_rpi.c - create mode 100644 arch/arm/lib/memcmp_rpi.S - create mode 100644 arch/arm/lib/memcpy_rpi.S - create mode 100644 arch/arm/lib/memcpymove.h - create mode 100644 arch/arm/lib/memmove_rpi.S - create mode 100644 arch/arm/lib/memset_rpi.S - -diff --git a/arch/arm/include/asm/string.h b/arch/arm/include/asm/string.h -index cf4f3aa..9fe7780 100644 ---- a/arch/arm/include/asm/string.h -+++ b/arch/arm/include/asm/string.h -@@ -24,6 +24,11 @@ extern void * memchr(const void *, int, __kernel_size_t); - #define __HAVE_ARCH_MEMSET - extern void * memset(void *, int, __kernel_size_t); - -+#ifdef CONFIG_MACH_BCM2708 -+#define __HAVE_ARCH_MEMCMP -+extern int memcmp(const void *, const void *, size_t); -+#endif -+ - extern void __memzero(void *ptr, __kernel_size_t n); - - #define memset(p,v,n) \ -diff --git a/arch/arm/include/asm/uaccess.h b/arch/arm/include/asm/uaccess.h -index 35c9db8..52d3401 100644 ---- a/arch/arm/include/asm/uaccess.h -+++ b/arch/arm/include/asm/uaccess.h -@@ -493,6 +493,9 @@ do { \ - extern unsigned long __must_check - arm_copy_from_user(void *to, const void __user *from, unsigned long n); - -+extern unsigned long __must_check -+__copy_from_user_std(void *to, const void __user *from, unsigned long n); -+ - static inline unsigned long __must_check - __copy_from_user(void *to, const void __user *from, unsigned long n) - { -diff --git a/arch/arm/lib/Makefile b/arch/arm/lib/Makefile -index d8a7807..9c7dc5b 100644 ---- a/arch/arm/lib/Makefile -+++ b/arch/arm/lib/Makefile -@@ -6,9 +6,8 @@ - - lib-y := backtrace.o changebit.o csumipv6.o csumpartial.o \ - csumpartialcopy.o csumpartialcopyuser.o clearbit.o \ -- delay.o delay-loop.o findbit.o memchr.o memcpy.o \ -- memmove.o memset.o memzero.o setbit.o \ -- strchr.o strrchr.o \ -+ delay.o delay-loop.o findbit.o memchr.o memzero.o \ -+ setbit.o strchr.o strrchr.o \ - testchangebit.o testclearbit.o testsetbit.o \ - ashldi3.o ashrdi3.o lshrdi3.o muldi3.o \ - ucmpdi2.o lib1funcs.o div64.o \ -@@ -18,6 +17,16 @@ lib-y := backtrace.o changebit.o csumipv6.o csumpartial.o \ - mmu-y := clear_user.o copy_page.o getuser.o putuser.o \ - copy_from_user.o copy_to_user.o - -+# Choose optimised implementations for Raspberry Pi -+ifeq ($(CONFIG_MACH_BCM2708),y) -+ CFLAGS_uaccess_with_memcpy.o += -DCOPY_FROM_USER_THRESHOLD=1600 -+ CFLAGS_uaccess_with_memcpy.o += -DCOPY_TO_USER_THRESHOLD=672 -+ obj-$(CONFIG_MODULES) += exports_rpi.o -+ lib-y += memcpy_rpi.o memmove_rpi.o memset_rpi.o memcmp_rpi.o -+else -+ lib-y += memcpy.o memmove.o memset.o -+endif -+ - # using lib_ here won't override already available weak symbols - obj-$(CONFIG_UACCESS_WITH_MEMCPY) += uaccess_with_memcpy.o - -diff --git a/arch/arm/lib/arm-mem.h b/arch/arm/lib/arm-mem.h -new file mode 100644 -index 0000000..5d4bda1 ---- /dev/null -+++ b/arch/arm/lib/arm-mem.h -@@ -0,0 +1,159 @@ -+/* -+Copyright (c) 2013, Raspberry Pi Foundation -+Copyright (c) 2013, RISC OS Open Ltd -+All rights reserved. -+ -+Redistribution and use in source and binary forms, with or without -+modification, are permitted provided that the following conditions are met: -+ * Redistributions of source code must retain the above copyright -+ notice, this list of conditions and the following disclaimer. -+ * 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. -+ * Neither the name of the copyright holder nor the -+ names of its contributors may be used to endorse or promote products -+ derived from this software without specific prior written permission. -+ -+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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. -+*/ -+ -+.macro myfunc fname -+ .func fname -+ .global fname -+fname: -+.endm -+ -+.macro preload_leading_step1 backwards, ptr, base -+/* If the destination is already 16-byte aligned, then we need to preload -+ * between 0 and prefetch_distance (inclusive) cache lines ahead so there -+ * are no gaps when the inner loop starts. -+ */ -+ .if backwards -+ sub ptr, base, #1 -+ bic ptr, ptr, #31 -+ .else -+ bic ptr, base, #31 -+ .endif -+ .set OFFSET, 0 -+ .rept prefetch_distance+1 -+ pld [ptr, #OFFSET] -+ .if backwards -+ .set OFFSET, OFFSET-32 -+ .else -+ .set OFFSET, OFFSET+32 -+ .endif -+ .endr -+.endm -+ -+.macro preload_leading_step2 backwards, ptr, base, leading_bytes, tmp -+/* However, if the destination is not 16-byte aligned, we may need to -+ * preload one more cache line than that. The question we need to ask is: -+ * are the leading bytes more than the amount by which the source -+ * pointer will be rounded down for preloading, and if so, by how many -+ * cache lines? -+ */ -+ .if backwards -+/* Here we compare against how many bytes we are into the -+ * cache line, counting down from the highest such address. -+ * Effectively, we want to calculate -+ * leading_bytes = dst&15 -+ * cacheline_offset = 31-((src-leading_bytes-1)&31) -+ * extra_needed = leading_bytes - cacheline_offset -+ * and test if extra_needed is <= 0, or rearranging: -+ * leading_bytes + (src-leading_bytes-1)&31 <= 31 -+ */ -+ mov tmp, base, lsl #32-5 -+ sbc tmp, tmp, leading_bytes, lsl #32-5 -+ adds tmp, tmp, leading_bytes, lsl #32-5 -+ bcc 61f -+ pld [ptr, #-32*(prefetch_distance+1)] -+ .else -+/* Effectively, we want to calculate -+ * leading_bytes = (-dst)&15 -+ * cacheline_offset = (src+leading_bytes)&31 -+ * extra_needed = leading_bytes - cacheline_offset -+ * and test if extra_needed is <= 0. -+ */ -+ mov tmp, base, lsl #32-5 -+ add tmp, tmp, leading_bytes, lsl #32-5 -+ rsbs tmp, tmp, leading_bytes, lsl #32-5 -+ bls 61f -+ pld [ptr, #32*(prefetch_distance+1)] -+ .endif -+61: -+.endm -+ -+.macro preload_trailing backwards, base, remain, tmp -+ /* We need either 0, 1 or 2 extra preloads */ -+ .if backwards -+ rsb tmp, base, #0 -+ mov tmp, tmp, lsl #32-5 -+ .else -+ mov tmp, base, lsl #32-5 -+ .endif -+ adds tmp, tmp, remain, lsl #32-5 -+ adceqs tmp, tmp, #0 -+ /* The instruction above has two effects: ensures Z is only -+ * set if C was clear (so Z indicates that both shifted quantities -+ * were 0), and clears C if Z was set (so C indicates that the sum -+ * of the shifted quantities was greater and not equal to 32) */ -+ beq 82f -+ .if backwards -+ sub tmp, base, #1 -+ bic tmp, tmp, #31 -+ .else -+ bic tmp, base, #31 -+ .endif -+ bcc 81f -+ .if backwards -+ pld [tmp, #-32*(prefetch_distance+1)] -+81: -+ pld [tmp, #-32*prefetch_distance] -+ .else -+ pld [tmp, #32*(prefetch_distance+2)] -+81: -+ pld [tmp, #32*(prefetch_distance+1)] -+ .endif -+82: -+.endm -+ -+.macro preload_all backwards, narrow_case, shift, base, remain, tmp0, tmp1 -+ .if backwards -+ sub tmp0, base, #1 -+ bic tmp0, tmp0, #31 -+ pld [tmp0] -+ sub tmp1, base, remain, lsl #shift -+ .else -+ bic tmp0, base, #31 -+ pld [tmp0] -+ add tmp1, base, remain, lsl #shift -+ sub tmp1, tmp1, #1 -+ .endif -+ bic tmp1, tmp1, #31 -+ cmp tmp1, tmp0 -+ beq 92f -+ .if narrow_case -+ /* In this case, all the data fits in either 1 or 2 cache lines */ -+ pld [tmp1] -+ .else -+91: -+ .if backwards -+ sub tmp0, tmp0, #32 -+ .else -+ add tmp0, tmp0, #32 -+ .endif -+ cmp tmp0, tmp1 -+ pld [tmp0] -+ bne 91b -+ .endif -+92: -+.endm -diff --git a/arch/arm/lib/copy_from_user.S b/arch/arm/lib/copy_from_user.S -index 1512beb..3da60dd 100644 ---- a/arch/arm/lib/copy_from_user.S -+++ b/arch/arm/lib/copy_from_user.S -@@ -89,11 +89,13 @@ - - .text - --ENTRY(arm_copy_from_user) -+ENTRY(__copy_from_user_std) -+WEAK(arm_copy_from_user) - - #include "copy_template.S" - - ENDPROC(arm_copy_from_user) -+ENDPROC(__copy_from_user_std) - - .pushsection .fixup,"ax" - .align 0 -diff --git a/arch/arm/lib/exports_rpi.c b/arch/arm/lib/exports_rpi.c -new file mode 100644 -index 0000000..1f82604 ---- /dev/null -+++ b/arch/arm/lib/exports_rpi.c -@@ -0,0 +1,37 @@ -+/** -+ * Copyright (c) 2014, Raspberry Pi (Trading) Ltd. -+ * -+ * 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, -+ * without modification. -+ * 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. -+ * 3. The names of the above-listed copyright holders may not be used -+ * to endorse or promote products derived from this software without -+ * specific prior written permission. -+ * -+ * ALTERNATIVELY, this software may be distributed under the terms of the -+ * GNU General Public License ("GPL") version 2, as published by the Free -+ * Software Foundation. -+ * -+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER OR -+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+ */ -+ -+#include <linux/kernel.h> -+#include <linux/module.h> -+ -+EXPORT_SYMBOL(memcmp); -diff --git a/arch/arm/lib/memcmp_rpi.S b/arch/arm/lib/memcmp_rpi.S -new file mode 100644 -index 0000000..bf6e4ed ---- /dev/null -+++ b/arch/arm/lib/memcmp_rpi.S -@@ -0,0 +1,285 @@ -+/* -+Copyright (c) 2013, Raspberry Pi Foundation -+Copyright (c) 2013, RISC OS Open Ltd -+All rights reserved. -+ -+Redistribution and use in source and binary forms, with or without -+modification, are permitted provided that the following conditions are met: -+ * Redistributions of source code must retain the above copyright -+ notice, this list of conditions and the following disclaimer. -+ * 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. -+ * Neither the name of the copyright holder nor the -+ names of its contributors may be used to endorse or promote products -+ derived from this software without specific prior written permission. -+ -+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY -+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+*/ -+ -+#include <linux/linkage.h> -+#include "arm-mem.h" -+ -+/* Prevent the stack from becoming executable */ -+#if defined(__linux__) && defined(__ELF__) -+.section .note.GNU-stack,"",%progbits -+#endif -+ -+ .text -+ .arch armv6 -+ .object_arch armv4 -+ .arm -+ .altmacro -+ .p2align 2 -+ -+.macro memcmp_process_head unaligned -+ .if unaligned -+ ldr DAT0, [S_1], #4 -+ ldr DAT1, [S_1], #4 -+ ldr DAT2, [S_1], #4 -+ ldr DAT3, [S_1], #4 -+ .else -+ ldmia S_1!, {DAT0, DAT1, DAT2, DAT3} -+ .endif -+ ldmia S_2!, {DAT4, DAT5, DAT6, DAT7} -+.endm -+ -+.macro memcmp_process_tail -+ cmp DAT0, DAT4 -+ cmpeq DAT1, DAT5 -+ cmpeq DAT2, DAT6 -+ cmpeq DAT3, DAT7 -+ bne 200f -+.endm -+ -+.macro memcmp_leading_31bytes -+ movs DAT0, OFF, lsl #31 -+ ldrmib DAT0, [S_1], #1 -+ ldrcsh DAT1, [S_1], #2 -+ ldrmib DAT4, [S_2], #1 -+ ldrcsh DAT5, [S_2], #2 -+ movpl DAT0, #0 -+ movcc DAT1, #0 -+ movpl DAT4, #0 -+ movcc DAT5, #0 -+ submi N, N, #1 -+ subcs N, N, #2 -+ cmp DAT0, DAT4 -+ cmpeq DAT1, DAT5 -+ bne 200f -+ movs DAT0, OFF, lsl #29 -+ ldrmi DAT0, [S_1], #4 -+ ldrcs DAT1, [S_1], #4 -+ ldrcs DAT2, [S_1], #4 -+ ldrmi DAT4, [S_2], #4 -+ ldmcsia S_2!, {DAT5, DAT6} -+ movpl DAT0, #0 -+ movcc DAT1, #0 -+ movcc DAT2, #0 -+ movpl DAT4, #0 -+ movcc DAT5, #0 -+ movcc DAT6, #0 -+ submi N, N, #4 -+ subcs N, N, #8 -+ cmp DAT0, DAT4 -+ cmpeq DAT1, DAT5 -+ cmpeq DAT2, DAT6 -+ bne 200f -+ tst OFF, #16 -+ beq 105f -+ memcmp_process_head 1 -+ sub N, N, #16 -+ memcmp_process_tail -+105: -+.endm -+ -+.macro memcmp_trailing_15bytes unaligned -+ movs N, N, lsl #29 -+ .if unaligned -+ ldrcs DAT0, [S_1], #4 -+ ldrcs DAT1, [S_1], #4 -+ .else -+ ldmcsia S_1!, {DAT0, DAT1} -+ .endif -+ ldrmi DAT2, [S_1], #4 -+ ldmcsia S_2!, {DAT4, DAT5} -+ ldrmi DAT6, [S_2], #4 -+ movcc DAT0, #0 -+ movcc DAT1, #0 -+ movpl DAT2, #0 -+ movcc DAT4, #0 -+ movcc DAT5, #0 -+ movpl DAT6, #0 -+ cmp DAT0, DAT4 -+ cmpeq DAT1, DAT5 -+ cmpeq DAT2, DAT6 -+ bne 200f -+ movs N, N, lsl #2 -+ ldrcsh DAT0, [S_1], #2 -+ ldrmib DAT1, [S_1] -+ ldrcsh DAT4, [S_2], #2 -+ ldrmib DAT5, [S_2] -+ movcc DAT0, #0 -+ movpl DAT1, #0 -+ movcc DAT4, #0 -+ movpl DAT5, #0 -+ cmp DAT0, DAT4 -+ cmpeq DAT1, DAT5 -+ bne 200f -+.endm -+ -+.macro memcmp_long_inner_loop unaligned -+110: -+ memcmp_process_head unaligned -+ pld [S_2, #prefetch_distance*32 + 16] -+ memcmp_process_tail -+ memcmp_process_head unaligned -+ pld [S_1, OFF] -+ memcmp_process_tail -+ subs N, N, #32 -+ bhs 110b -+ /* Just before the final (prefetch_distance+1) 32-byte blocks, -+ * deal with final preloads */ -+ preload_trailing 0, S_1, N, DAT0 -+ preload_trailing 0, S_2, N, DAT0 -+ add N, N, #(prefetch_distance+2)*32 - 16 -+120: -+ memcmp_process_head unaligned -+ memcmp_process_tail -+ subs N, N, #16 -+ bhs 120b -+ /* Trailing words and bytes */ -+ tst N, #15 -+ beq 199f -+ memcmp_trailing_15bytes unaligned -+199: /* Reached end without detecting a difference */ -+ mov a1, #0 -+ setend le -+ pop {DAT1-DAT6, pc} -+.endm -+ -+.macro memcmp_short_inner_loop unaligned -+ subs N, N, #16 /* simplifies inner loop termination */ -+ blo 122f -+120: -+ memcmp_process_head unaligned -+ memcmp_process_tail -+ subs N, N, #16 -+ bhs 120b -+122: /* Trailing words and bytes */ -+ tst N, #15 -+ beq 199f -+ memcmp_trailing_15bytes unaligned -+199: /* Reached end without detecting a difference */ -+ mov a1, #0 -+ setend le -+ pop {DAT1-DAT6, pc} -+.endm -+ -+/* -+ * int memcmp(const void *s1, const void *s2, size_t n); -+ * On entry: -+ * a1 = pointer to buffer 1 -+ * a2 = pointer to buffer 2 -+ * a3 = number of bytes to compare (as unsigned chars) -+ * On exit: -+ * a1 = >0/=0/<0 if s1 >/=/< s2 -+ */ -+ -+.set prefetch_distance, 2 -+ -+ENTRY(memcmp) -+ S_1 .req a1 -+ S_2 .req a2 -+ N .req a3 -+ DAT0 .req a4 -+ DAT1 .req v1 -+ DAT2 .req v2 -+ DAT3 .req v3 -+ DAT4 .req v4 -+ DAT5 .req v5 -+ DAT6 .req v6 -+ DAT7 .req ip -+ OFF .req lr -+ -+ push {DAT1-DAT6, lr} -+ setend be /* lowest-addressed bytes are most significant */ -+ -+ /* To preload ahead as we go, we need at least (prefetch_distance+2) 32-byte blocks */ -+ cmp N, #(prefetch_distance+3)*32 - 1 -+ blo 170f -+ -+ /* Long case */ -+ /* Adjust N so that the decrement instruction can also test for -+ * inner loop termination. We want it to stop when there are -+ * (prefetch_distance+1) complete blocks to go. */ -+ sub N, N, #(prefetch_distance+2)*32 -+ preload_leading_step1 0, DAT0, S_1 -+ preload_leading_step1 0, DAT1, S_2 -+ tst S_2, #31 -+ beq 154f -+ rsb OFF, S_2, #0 /* no need to AND with 15 here */ -+ preload_leading_step2 0, DAT0, S_1, OFF, DAT2 -+ preload_leading_step2 0, DAT1, S_2, OFF, DAT2 -+ memcmp_leading_31bytes -+154: /* Second source now cacheline (32-byte) aligned; we have at -+ * least one prefetch to go. */ -+ /* Prefetch offset is best selected such that it lies in the -+ * first 8 of each 32 bytes - but it's just as easy to aim for -+ * the first one */ -+ and OFF, S_1, #31 -+ rsb OFF, OFF, #32*prefetch_distance -+ tst S_1, #3 -+ bne 140f -+ memcmp_long_inner_loop 0 -+140: memcmp_long_inner_loop 1 -+ -+170: /* Short case */ -+ teq N, #0 -+ beq 199f -+ preload_all 0, 0, 0, S_1, N, DAT0, DAT1 -+ preload_all 0, 0, 0, S_2, N, DAT0, DAT1 -+ tst S_2, #3 -+ beq 174f -+172: subs N, N, #1 -+ blo 199f -+ ldrb DAT0, [S_1], #1 -+ ldrb DAT4, [S_2], #1 -+ cmp DAT0, DAT4 -+ bne 200f -+ tst S_2, #3 -+ bne 172b -+174: /* Second source now 4-byte aligned; we have 0 or more bytes to go */ -+ tst S_1, #3 -+ bne 140f -+ memcmp_short_inner_loop 0 -+140: memcmp_short_inner_loop 1 -+ -+200: /* Difference found: determine sign. */ -+ movhi a1, #1 -+ movlo a1, #-1 -+ setend le -+ pop {DAT1-DAT6, pc} -+ -+ .unreq S_1 -+ .unreq S_2 -+ .unreq N -+ .unreq DAT0 -+ .unreq DAT1 -+ .unreq DAT2 -+ .unreq DAT3 -+ .unreq DAT4 -+ .unreq DAT5 -+ .unreq DAT6 -+ .unreq DAT7 -+ .unreq OFF -+ENDPROC(memcmp) -diff --git a/arch/arm/lib/memcpy_rpi.S b/arch/arm/lib/memcpy_rpi.S -new file mode 100644 -index 0000000..30f8a90 ---- /dev/null -+++ b/arch/arm/lib/memcpy_rpi.S -@@ -0,0 +1,61 @@ -+/* -+Copyright (c) 2013, Raspberry Pi Foundation -+Copyright (c) 2013, RISC OS Open Ltd -+All rights reserved. -+ -+Redistribution and use in source and binary forms, with or without -+modification, are permitted provided that the following conditions are met: -+ * Redistributions of source code must retain the above copyright -+ notice, this list of conditions and the following disclaimer. -+ * 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. -+ * Neither the name of the copyright holder nor the -+ names of its contributors may be used to endorse or promote products -+ derived from this software without specific prior written permission. -+ -+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY -+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+*/ -+ -+#include <linux/linkage.h> -+#include "arm-mem.h" -+#include "memcpymove.h" -+ -+/* Prevent the stack from becoming executable */ -+#if defined(__linux__) && defined(__ELF__) -+.section .note.GNU-stack,"",%progbits -+#endif -+ -+ .text -+ .arch armv6 -+ .object_arch armv4 -+ .arm -+ .altmacro -+ .p2align 2 -+ -+/* -+ * void *memcpy(void * restrict s1, const void * restrict s2, size_t n); -+ * On entry: -+ * a1 = pointer to destination -+ * a2 = pointer to source -+ * a3 = number of bytes to copy -+ * On exit: -+ * a1 preserved -+ */ -+ -+.set prefetch_distance, 3 -+ -+ENTRY(mmiocpy) -+ENTRY(memcpy) -+ memcpy 0 -+ENDPROC(memcpy) -+ENDPROC(mmiocpy) -diff --git a/arch/arm/lib/memcpymove.h b/arch/arm/lib/memcpymove.h -new file mode 100644 -index 0000000..d8be584 ---- /dev/null -+++ b/arch/arm/lib/memcpymove.h -@@ -0,0 +1,506 @@ -+/* -+Copyright (c) 2013, Raspberry Pi Foundation -+Copyright (c) 2013, RISC OS Open Ltd -+All rights reserved. -+ -+Redistribution and use in source and binary forms, with or without -+modification, are permitted provided that the following conditions are met: -+ * Redistributions of source code must retain the above copyright -+ notice, this list of conditions and the following disclaimer. -+ * 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. -+ * Neither the name of the copyright holder nor the -+ names of its contributors may be used to endorse or promote products -+ derived from this software without specific prior written permission. -+ -+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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. -+*/ -+ -+.macro unaligned_words backwards, align, use_pld, words, r0, r1, r2, r3, r4, r5, r6, r7, r8 -+ .if words == 1 -+ .if backwards -+ mov r1, r0, lsl #32-align*8 -+ ldr r0, [S, #-4]! -+ orr r1, r1, r0, lsr #align*8 -+ str r1, [D, #-4]! -+ .else -+ mov r0, r1, lsr #align*8 -+ ldr r1, [S, #4]! -+ orr r0, r0, r1, lsl #32-align*8 -+ str r0, [D], #4 -+ .endif -+ .elseif words == 2 -+ .if backwards -+ ldr r1, [S, #-4]! -+ mov r2, r0, lsl #32-align*8 -+ ldr r0, [S, #-4]! -+ orr r2, r2, r1, lsr #align*8 -+ mov r1, r1, lsl #32-align*8 -+ orr r1, r1, r0, lsr #align*8 -+ stmdb D!, {r1, r2} -+ .else -+ ldr r1, [S, #4]! -+ mov r0, r2, lsr #align*8 -+ ldr r2, [S, #4]! -+ orr r0, r0, r1, lsl #32-align*8 -+ mov r1, r1, lsr #align*8 -+ orr r1, r1, r2, lsl #32-align*8 -+ stmia D!, {r0, r1} -+ .endif -+ .elseif words == 4 -+ .if backwards -+ ldmdb S!, {r2, r3} -+ mov r4, r0, lsl #32-align*8 -+ ldmdb S!, {r0, r1} -+ orr r4, r4, r3, lsr #align*8 -+ mov r3, r3, lsl #32-align*8 -+ orr r3, r3, r2, lsr #align*8 -+ mov r2, r2, lsl #32-align*8 -+ orr r2, r2, r1, lsr #align*8 -+ mov r1, r1, lsl #32-align*8 -+ orr r1, r1, r0, lsr #align*8 -+ stmdb D!, {r1, r2, r3, r4} -+ .else -+ ldmib S!, {r1, r2} -+ mov r0, r4, lsr #align*8 -+ ldmib S!, {r3, r4} -+ orr r0, r0, r1, lsl #32-align*8 -+ mov r1, r1, lsr #align*8 -+ orr r1, r1, r2, lsl #32-align*8 -+ mov r2, r2, lsr #align*8 -+ orr r2, r2, r3, lsl #32-align*8 -+ mov r3, r3, lsr #align*8 -+ orr r3, r3, r4, lsl #32-align*8 -+ stmia D!, {r0, r1, r2, r3} -+ .endif -+ .elseif words == 8 -+ .if backwards -+ ldmdb S!, {r4, r5, r6, r7} -+ mov r8, r0, lsl #32-align*8 -+ ldmdb S!, {r0, r1, r2, r3} -+ .if use_pld -+ pld [S, OFF] -+ .endif -+ orr r8, r8, r7, lsr #align*8 -+ mov r7, r7, lsl #32-align*8 -+ orr r7, r7, r6, lsr #align*8 -+ mov r6, r6, lsl #32-align*8 -+ orr r6, r6, r5, lsr #align*8 -+ mov r5, r5, lsl #32-align*8 -+ orr r5, r5, r4, lsr #align*8 -+ mov r4, r4, lsl #32-align*8 -+ orr r4, r4, r3, lsr #align*8 -+ mov r3, r3, lsl #32-align*8 -+ orr r3, r3, r2, lsr #align*8 -+ mov r2, r2, lsl #32-align*8 -+ orr r2, r2, r1, lsr #align*8 -+ mov r1, r1, lsl #32-align*8 -+ orr r1, r1, r0, lsr #align*8 -+ stmdb D!, {r5, r6, r7, r8} -+ stmdb D!, {r1, r2, r3, r4} -+ .else -+ ldmib S!, {r1, r2, r3, r4} -+ mov r0, r8, lsr #align*8 -+ ldmib S!, {r5, r6, r7, r8} -+ .if use_pld -+ pld [S, OFF] -+ .endif -+ orr r0, r0, r1, lsl #32-align*8 -+ mov r1, r1, lsr #align*8 -+ orr r1, r1, r2, lsl #32-align*8 -+ mov r2, r2, lsr #align*8 -+ orr r2, r2, r3, lsl #32-align*8 -+ mov r3, r3, lsr #align*8 -+ orr r3, r3, r4, lsl #32-align*8 -+ mov r4, r4, lsr #align*8 -+ orr r4, r4, r5, lsl #32-align*8 -+ mov r5, r5, lsr #align*8 -+ orr r5, r5, r6, lsl #32-align*8 -+ mov r6, r6, lsr #align*8 -+ orr r6, r6, r7, lsl #32-align*8 -+ mov r7, r7, lsr #align*8 -+ orr r7, r7, r8, lsl #32-align*8 -+ stmia D!, {r0, r1, r2, r3} -+ stmia D!, {r4, r5, r6, r7} -+ .endif -+ .endif -+.endm -+ -+.macro memcpy_leading_15bytes backwards, align -+ movs DAT1, DAT2, lsl #31 -+ sub N, N, DAT2 -+ .if backwards -+ ldrmib DAT0, [S, #-1]! -+ ldrcsh DAT1, [S, #-2]! -+ strmib DAT0, [D, #-1]! -+ strcsh DAT1, [D, #-2]! -+ .else -+ ldrmib DAT0, [S], #1 -+ ldrcsh DAT1, [S], #2 -+ strmib DAT0, [D], #1 -+ strcsh DAT1, [D], #2 -+ .endif -+ movs DAT1, DAT2, lsl #29 -+ .if backwards -+ ldrmi DAT0, [S, #-4]! -+ .if align == 0 -+ ldmcsdb S!, {DAT1, DAT2} -+ .else -+ ldrcs DAT2, [S, #-4]! -+ ldrcs DAT1, [S, #-4]! -+ .endif -+ strmi DAT0, [D, #-4]! -+ stmcsdb D!, {DAT1, DAT2} -+ .else -+ ldrmi DAT0, [S], #4 -+ .if align == 0 -+ ldmcsia S!, {DAT1, DAT2} -+ .else -+ ldrcs DAT1, [S], #4 -+ ldrcs DAT2, [S], #4 -+ .endif -+ strmi DAT0, [D], #4 -+ stmcsia D!, {DAT1, DAT2} -+ .endif -+.endm -+ -+.macro memcpy_trailing_15bytes backwards, align -+ movs N, N, lsl #29 -+ .if backwards -+ .if align == 0 -+ ldmcsdb S!, {DAT0, DAT1} -+ .else -+ ldrcs DAT1, [S, #-4]! -+ ldrcs DAT0, [S, #-4]! -+ .endif -+ ldrmi DAT2, [S, #-4]! -+ stmcsdb D!, {DAT0, DAT1} -+ strmi DAT2, [D, #-4]! -+ .else -+ .if align == 0 -+ ldmcsia S!, {DAT0, DAT1} -+ .else -+ ldrcs DAT0, [S], #4 -+ ldrcs DAT1, [S], #4 -+ .endif -+ ldrmi DAT2, [S], #4 -+ stmcsia D!, {DAT0, DAT1} -+ strmi DAT2, [D], #4 -+ .endif -+ movs N, N, lsl #2 -+ .if backwards -+ ldrcsh DAT0, [S, #-2]! -+ ldrmib DAT1, [S, #-1] -+ strcsh DAT0, [D, #-2]! -+ strmib DAT1, [D, #-1] -+ .else -+ ldrcsh DAT0, [S], #2 -+ ldrmib DAT1, [S] -+ strcsh DAT0, [D], #2 -+ strmib DAT1, [D] -+ .endif -+.endm -+ -+.macro memcpy_long_inner_loop backwards, align -+ .if align != 0 -+ .if backwards -+ ldr DAT0, [S, #-align]! -+ .else -+ ldr LAST, [S, #-align]! -+ .endif -+ .endif -+110: -+ .if align == 0 -+ .if backwards -+ ldmdb S!, {DAT0, DAT1, DAT2, DAT3, DAT4, DAT5, DAT6, LAST} -+ pld [S, OFF] -+ stmdb D!, {DAT4, DAT5, DAT6, LAST} -+ stmdb D!, {DAT0, DAT1, DAT2, DAT3} -+ .else -+ ldmia S!, {DAT0, DAT1, DAT2, DAT3, DAT4, DAT5, DAT6, LAST} -+ pld [S, OFF] -+ stmia D!, {DAT0, DAT1, DAT2, DAT3} -+ stmia D!, {DAT4, DAT5, DAT6, LAST} -+ .endif -+ .else -+ unaligned_words backwards, align, 1, 8, DAT0, DAT1, DAT2, DAT3, DAT4, DAT5, DAT6, DAT7, LAST -+ .endif -+ subs N, N, #32 -+ bhs 110b -+ /* Just before the final (prefetch_distance+1) 32-byte blocks, deal with final preloads */ -+ preload_trailing backwards, S, N, OFF -+ add N, N, #(prefetch_distance+2)*32 - 32 -+120: -+ .if align == 0 -+ .if backwards -+ ldmdb S!, {DAT0, DAT1, DAT2, DAT3, DAT4, DAT5, DAT6, LAST} -+ stmdb D!, {DAT4, DAT5, DAT6, LAST} -+ stmdb D!, {DAT0, DAT1, DAT2, DAT3} -+ .else -+ ldmia S!, {DAT0, DAT1, DAT2, DAT3, DAT4, DAT5, DAT6, LAST} -+ stmia D!, {DAT0, DAT1, DAT2, DAT3} -+ stmia D!, {DAT4, DAT5, DAT6, LAST} -+ .endif -+ .else -+ unaligned_words backwards, align, 0, 8, DAT0, DAT1, DAT2, DAT3, DAT4, DAT5, DAT6, DAT7, LAST -+ .endif -+ subs N, N, #32 -+ bhs 120b -+ tst N, #16 -+ .if align == 0 -+ .if backwards -+ ldmnedb S!, {DAT0, DAT1, DAT2, LAST} -+ stmnedb D!, {DAT0, DAT1, DAT2, LAST} -+ .else -+ ldmneia S!, {DAT0, DAT1, DAT2, LAST} -+ stmneia D!, {DAT0, DAT1, DAT2, LAST} -+ .endif -+ .else -+ beq 130f -+ unaligned_words backwards, align, 0, 4, DAT0, DAT1, DAT2, DAT3, LAST -+130: -+ .endif -+ /* Trailing words and bytes */ -+ tst N, #15 -+ beq 199f -+ .if align != 0 -+ add S, S, #align -+ .endif -+ memcpy_trailing_15bytes backwards, align -+199: -+ pop {DAT3, DAT4, DAT5, DAT6, DAT7} -+ pop {D, DAT1, DAT2, pc} -+.endm -+ -+.macro memcpy_medium_inner_loop backwards, align -+120: -+ .if backwards -+ .if align == 0 -+ ldmdb S!, {DAT0, DAT1, DAT2, LAST} -+ .else -+ ldr LAST, [S, #-4]! -+ ldr DAT2, [S, #-4]! -+ ldr DAT1, [S, #-4]! -+ ldr DAT0, [S, #-4]! -+ .endif -+ stmdb D!, {DAT0, DAT1, DAT2, LAST} -+ .else -+ .if align == 0 -+ ldmia S!, {DAT0, DAT1, DAT2, LAST} -+ .else -+ ldr DAT0, [S], #4 -+ ldr DAT1, [S], #4 -+ ldr DAT2, [S], #4 -+ ldr LAST, [S], #4 -+ .endif -+ stmia D!, {DAT0, DAT1, DAT2, LAST} -+ .endif -+ subs N, N, #16 -+ bhs 120b -+ /* Trailing words and bytes */ -+ tst N, #15 -+ beq 199f -+ memcpy_trailing_15bytes backwards, align -+199: -+ pop {D, DAT1, DAT2, pc} -+.endm -+ -+.macro memcpy_short_inner_loop backwards, align -+ tst N, #16 -+ .if backwards -+ .if align == 0 -+ ldmnedb S!, {DAT0, DAT1, DAT2, LAST} -+ .else -+ ldrne LAST, [S, #-4]! -+ ldrne DAT2, [S, #-4]! -+ ldrne DAT1, [S, #-4]! -+ ldrne DAT0, [S, #-4]! -+ .endif -+ stmnedb D!, {DAT0, DAT1, DAT2, LAST} -+ .else -+ .if align == 0 -+ ldmneia S!, {DAT0, DAT1, DAT2, LAST} -+ .else -+ ldrne DAT0, [S], #4 -+ ldrne DAT1, [S], #4 -+ ldrne DAT2, [S], #4 -+ ldrne LAST, [S], #4 -+ .endif -+ stmneia D!, {DAT0, DAT1, DAT2, LAST} -+ .endif -+ memcpy_trailing_15bytes backwards, align -+199: -+ pop {D, DAT1, DAT2, pc} -+.endm -+ -+.macro memcpy backwards -+ D .req a1 -+ S .req a2 -+ N .req a3 -+ DAT0 .req a4 -+ DAT1 .req v1 -+ DAT2 .req v2 -+ DAT3 .req v3 -+ DAT4 .req v4 -+ DAT5 .req v5 -+ DAT6 .req v6 -+ DAT7 .req sl -+ LAST .req ip -+ OFF .req lr -+ -+ .cfi_startproc -+ -+ push {D, DAT1, DAT2, lr} -+ -+ .cfi_def_cfa_offset 16 -+ .cfi_rel_offset D, 0 -+ .cfi_undefined S -+ .cfi_undefined N -+ .cfi_undefined DAT0 -+ .cfi_rel_offset DAT1, 4 -+ .cfi_rel_offset DAT2, 8 -+ .cfi_undefined LAST -+ .cfi_rel_offset lr, 12 -+ -+ .if backwards -+ add D, D, N -+ add S, S, N -+ .endif -+ -+ /* See if we're guaranteed to have at least one 16-byte aligned 16-byte write */ -+ cmp N, #31 -+ blo 170f -+ /* To preload ahead as we go, we need at least (prefetch_distance+2) 32-byte blocks */ -+ cmp N, #(prefetch_distance+3)*32 - 1 -+ blo 160f -+ -+ /* Long case */ -+ push {DAT3, DAT4, DAT5, DAT6, DAT7} -+ -+ .cfi_def_cfa_offset 36 -+ .cfi_rel_offset D, 20 -+ .cfi_rel_offset DAT1, 24 -+ .cfi_rel_offset DAT2, 28 -+ .cfi_rel_offset DAT3, 0 -+ .cfi_rel_offset DAT4, 4 -+ .cfi_rel_offset DAT5, 8 -+ .cfi_rel_offset DAT6, 12 -+ .cfi_rel_offset DAT7, 16 -+ .cfi_rel_offset lr, 32 -+ -+ /* Adjust N so that the decrement instruction can also test for -+ * inner loop termination. We want it to stop when there are -+ * (prefetch_distance+1) complete blocks to go. */ -+ sub N, N, #(prefetch_distance+2)*32 -+ preload_leading_step1 backwards, DAT0, S -+ .if backwards -+ /* Bug in GAS: it accepts, but mis-assembles the instruction -+ * ands DAT2, D, #60, 2 -+ * which sets DAT2 to the number of leading bytes until destination is aligned and also clears C (sets borrow) -+ */ -+ .word 0xE210513C -+ beq 154f -+ .else -+ ands DAT2, D, #15 -+ beq 154f -+ rsb DAT2, DAT2, #16 /* number of leading bytes until destination aligned */ -+ .endif -+ preload_leading_step2 backwards, DAT0, S, DAT2, OFF -+ memcpy_leading_15bytes backwards, 1 -+154: /* Destination now 16-byte aligned; we have at least one prefetch as well as at least one 16-byte output block */ -+ /* Prefetch offset is best selected such that it lies in the first 8 of each 32 bytes - but it's just as easy to aim for the first one */ -+ .if backwards -+ rsb OFF, S, #3 -+ and OFF, OFF, #28 -+ sub OFF, OFF, #32*(prefetch_distance+1) -+ .else -+ and OFF, S, #28 -+ rsb OFF, OFF, #32*prefetch_distance -+ .endif -+ movs DAT0, S, lsl #31 -+ bhi 157f -+ bcs 156f -+ bmi 155f -+ memcpy_long_inner_loop backwards, 0 -+155: memcpy_long_inner_loop backwards, 1 -+156: memcpy_long_inner_loop backwards, 2 -+157: memcpy_long_inner_loop backwards, 3 -+ -+ .cfi_def_cfa_offset 16 -+ .cfi_rel_offset D, 0 -+ .cfi_rel_offset DAT1, 4 -+ .cfi_rel_offset DAT2, 8 -+ .cfi_same_value DAT3 -+ .cfi_same_value DAT4 -+ .cfi_same_value DAT5 -+ .cfi_same_value DAT6 -+ .cfi_same_value DAT7 -+ .cfi_rel_offset lr, 12 -+ -+160: /* Medium case */ -+ preload_all backwards, 0, 0, S, N, DAT2, OFF -+ sub N, N, #16 /* simplifies inner loop termination */ -+ .if backwards -+ ands DAT2, D, #15 -+ beq 164f -+ .else -+ ands DAT2, D, #15 -+ beq 164f -+ rsb DAT2, DAT2, #16 -+ .endif -+ memcpy_leading_15bytes backwards, align -+164: /* Destination now 16-byte aligned; we have at least one 16-byte output block */ -+ tst S, #3 -+ bne 140f -+ memcpy_medium_inner_loop backwards, 0 -+140: memcpy_medium_inner_loop backwards, 1 -+ -+170: /* Short case, less than 31 bytes, so no guarantee of at least one 16-byte block */ -+ teq N, #0 -+ beq 199f -+ preload_all backwards, 1, 0, S, N, DAT2, LAST -+ tst D, #3 -+ beq 174f -+172: subs N, N, #1 -+ blo 199f -+ .if backwards -+ ldrb DAT0, [S, #-1]! -+ strb DAT0, [D, #-1]! -+ .else -+ ldrb DAT0, [S], #1 -+ strb DAT0, [D], #1 -+ .endif -+ tst D, #3 -+ bne 172b -+174: /* Destination now 4-byte aligned; we have 0 or more output bytes to go */ -+ tst S, #3 -+ bne 140f -+ memcpy_short_inner_loop backwards, 0 -+140: memcpy_short_inner_loop backwards, 1 -+ -+ .cfi_endproc -+ -+ .unreq D -+ .unreq S -+ .unreq N -+ .unreq DAT0 -+ .unreq DAT1 -+ .unreq DAT2 -+ .unreq DAT3 -+ .unreq DAT4 -+ .unreq DAT5 -+ .unreq DAT6 -+ .unreq DAT7 -+ .unreq LAST -+ .unreq OFF -+.endm -diff --git a/arch/arm/lib/memmove_rpi.S b/arch/arm/lib/memmove_rpi.S -new file mode 100644 -index 0000000..8b0760c ---- /dev/null -+++ b/arch/arm/lib/memmove_rpi.S -@@ -0,0 +1,61 @@ -+/* -+Copyright (c) 2013, Raspberry Pi Foundation -+Copyright (c) 2013, RISC OS Open Ltd -+All rights reserved. -+ -+Redistribution and use in source and binary forms, with or without -+modification, are permitted provided that the following conditions are met: -+ * Redistributions of source code must retain the above copyright -+ notice, this list of conditions and the following disclaimer. -+ * 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. -+ * Neither the name of the copyright holder nor the -+ names of its contributors may be used to endorse or promote products -+ derived from this software without specific prior written permission. -+ -+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY -+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+*/ -+ -+#include <linux/linkage.h> -+#include "arm-mem.h" -+#include "memcpymove.h" -+ -+/* Prevent the stack from becoming executable */ -+#if defined(__linux__) && defined(__ELF__) -+.section .note.GNU-stack,"",%progbits -+#endif -+ -+ .text -+ .arch armv6 -+ .object_arch armv4 -+ .arm -+ .altmacro -+ .p2align 2 -+ -+/* -+ * void *memmove(void *s1, const void *s2, size_t n); -+ * On entry: -+ * a1 = pointer to destination -+ * a2 = pointer to source -+ * a3 = number of bytes to copy -+ * On exit: -+ * a1 preserved -+ */ -+ -+.set prefetch_distance, 3 -+ -+ENTRY(memmove) -+ cmp a2, a1 -+ bpl memcpy /* pl works even over -1 - 0 and 0x7fffffff - 0x80000000 boundaries */ -+ memcpy 1 -+ENDPROC(memmove) -diff --git a/arch/arm/lib/memset_rpi.S b/arch/arm/lib/memset_rpi.S -new file mode 100644 -index 0000000..7067415 ---- /dev/null -+++ b/arch/arm/lib/memset_rpi.S -@@ -0,0 +1,123 @@ -+/* -+Copyright (c) 2013, Raspberry Pi Foundation -+Copyright (c) 2013, RISC OS Open Ltd -+All rights reserved. -+ -+Redistribution and use in source and binary forms, with or without -+modification, are permitted provided that the following conditions are met: -+ * Redistributions of source code must retain the above copyright -+ notice, this list of conditions and the following disclaimer. -+ * 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. -+ * Neither the name of the copyright holder nor the -+ names of its contributors may be used to endorse or promote products -+ derived from this software without specific prior written permission. -+ -+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY -+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+*/ -+ -+#include <linux/linkage.h> -+#include "arm-mem.h" -+ -+/* Prevent the stack from becoming executable */ -+#if defined(__linux__) && defined(__ELF__) -+.section .note.GNU-stack,"",%progbits -+#endif -+ -+ .text -+ .arch armv6 -+ .object_arch armv4 -+ .arm -+ .altmacro -+ .p2align 2 -+ -+/* -+ * void *memset(void *s, int c, size_t n); -+ * On entry: -+ * a1 = pointer to buffer to fill -+ * a2 = byte pattern to fill with (caller-narrowed) -+ * a3 = number of bytes to fill -+ * On exit: -+ * a1 preserved -+ */ -+ENTRY(mmioset) -+ENTRY(memset) -+ S .req a1 -+ DAT0 .req a2 -+ N .req a3 -+ DAT1 .req a4 -+ DAT2 .req ip -+ DAT3 .req lr -+ -+ orr DAT0, DAT0, lsl #8 -+ push {S, lr} -+ orr DAT0, DAT0, lsl #16 -+ mov DAT1, DAT0 -+ -+ /* See if we're guaranteed to have at least one 16-byte aligned 16-byte write */ -+ cmp N, #31 -+ blo 170f -+ -+161: sub N, N, #16 /* simplifies inner loop termination */ -+ /* Leading words and bytes */ -+ tst S, #15 -+ beq 164f -+ rsb DAT3, S, #0 /* bits 0-3 = number of leading bytes until aligned */ -+ movs DAT2, DAT3, lsl #31 -+ submi N, N, #1 -+ strmib DAT0, [S], #1 -+ subcs N, N, #2 -+ strcsh DAT0, [S], #2 -+ movs DAT2, DAT3, lsl #29 -+ submi N, N, #4 -+ strmi DAT0, [S], #4 -+ subcs N, N, #8 -+ stmcsia S!, {DAT0, DAT1} -+164: /* Delayed set up of DAT2 and DAT3 so we could use them as scratch registers above */ -+ mov DAT2, DAT0 -+ mov DAT3, DAT0 -+ /* Now the inner loop of 16-byte stores */ -+165: stmia S!, {DAT0, DAT1, DAT2, DAT3} -+ subs N, N, #16 -+ bhs 165b -+166: /* Trailing words and bytes */ -+ movs N, N, lsl #29 -+ stmcsia S!, {DAT0, DAT1} -+ strmi DAT0, [S], #4 -+ movs N, N, lsl #2 -+ strcsh DAT0, [S], #2 -+ strmib DAT0, [S] -+199: pop {S, pc} -+ -+170: /* Short case */ -+ mov DAT2, DAT0 -+ mov DAT3, DAT0 -+ tst S, #3 -+ beq 174f -+172: subs N, N, #1 -+ blo 199b -+ strb DAT0, [S], #1 -+ tst S, #3 -+ bne 172b -+174: tst N, #16 -+ stmneia S!, {DAT0, DAT1, DAT2, DAT3} -+ b 166b -+ -+ .unreq S -+ .unreq DAT0 -+ .unreq N -+ .unreq DAT1 -+ .unreq DAT2 -+ .unreq DAT3 -+ENDPROC(memset) -+ENDPROC(mmioset) -diff --git a/arch/arm/lib/uaccess_with_memcpy.c b/arch/arm/lib/uaccess_with_memcpy.c -index 588bbc2..c29df92 100644 ---- a/arch/arm/lib/uaccess_with_memcpy.c -+++ b/arch/arm/lib/uaccess_with_memcpy.c -@@ -22,6 +22,14 @@ - #include <asm/current.h> - #include <asm/page.h> - -+#ifndef COPY_FROM_USER_THRESHOLD -+#define COPY_FROM_USER_THRESHOLD 64 -+#endif -+ -+#ifndef COPY_TO_USER_THRESHOLD -+#define COPY_TO_USER_THRESHOLD 64 -+#endif -+ - static int - pin_page_for_write(const void __user *_addr, pte_t **ptep, spinlock_t **ptlp) - { -@@ -85,7 +93,44 @@ pin_page_for_write(const void __user *_addr, pte_t **ptep, spinlock_t **ptlp) - return 1; - } - --static unsigned long noinline -+static int -+pin_page_for_read(const void __user *_addr, pte_t **ptep, spinlock_t **ptlp) -+{ -+ unsigned long addr = (unsigned long)_addr; -+ pgd_t *pgd; -+ pmd_t *pmd; -+ pte_t *pte; -+ pud_t *pud; -+ spinlock_t *ptl; -+ -+ pgd = pgd_offset(current->mm, addr); -+ if (unlikely(pgd_none(*pgd) || pgd_bad(*pgd))) -+ { -+ return 0; -+ } -+ pud = pud_offset(pgd, addr); -+ if (unlikely(pud_none(*pud) || pud_bad(*pud))) -+ { -+ return 0; -+ } -+ -+ pmd = pmd_offset(pud, addr); -+ if (unlikely(pmd_none(*pmd) || pmd_bad(*pmd))) -+ return 0; -+ -+ pte = pte_offset_map_lock(current->mm, pmd, addr, &ptl); -+ if (unlikely(!pte_present(*pte) || !pte_young(*pte))) { -+ pte_unmap_unlock(pte, ptl); -+ return 0; -+ } -+ -+ *ptep = pte; -+ *ptlp = ptl; -+ -+ return 1; -+} -+ -+unsigned long noinline - __copy_to_user_memcpy(void __user *to, const void *from, unsigned long n) - { - unsigned long ua_flags; -@@ -138,6 +183,54 @@ __copy_to_user_memcpy(void __user *to, const void *from, unsigned long n) - return n; - } - -+unsigned long noinline -+__copy_from_user_memcpy(void *to, const void __user *from, unsigned long n) -+{ -+ int atomic; -+ -+ if (unlikely(segment_eq(get_fs(), KERNEL_DS))) { -+ memcpy(to, (const void *)from, n); -+ return 0; -+ } -+ -+ /* the mmap semaphore is taken only if not in an atomic context */ -+ atomic = in_atomic(); -+ -+ if (!atomic) -+ down_read(&current->mm->mmap_sem); -+ while (n) { -+ pte_t *pte; -+ spinlock_t *ptl; -+ int tocopy; -+ -+ while (!pin_page_for_read(from, &pte, &ptl)) { -+ char temp; -+ if (!atomic) -+ up_read(&current->mm->mmap_sem); -+ if (__get_user(temp, (char __user *)from)) -+ goto out; -+ if (!atomic) -+ down_read(&current->mm->mmap_sem); -+ } -+ -+ tocopy = (~(unsigned long)from & ~PAGE_MASK) + 1; -+ if (tocopy > n) -+ tocopy = n; -+ -+ memcpy(to, (const void *)from, tocopy); -+ to += tocopy; -+ from += tocopy; -+ n -= tocopy; -+ -+ pte_unmap_unlock(pte, ptl); -+ } -+ if (!atomic) -+ up_read(&current->mm->mmap_sem); -+ -+out: -+ return n; -+} -+ - unsigned long - arm_copy_to_user(void __user *to, const void *from, unsigned long n) - { -@@ -148,7 +241,7 @@ arm_copy_to_user(void __user *to, const void *from, unsigned long n) - * With frame pointer disabled, tail call optimization kicks in - * as well making this test almost invisible. - */ -- if (n < 64) { -+ if (n < COPY_TO_USER_THRESHOLD) { - unsigned long ua_flags = uaccess_save_and_enable(); - n = __copy_to_user_std(to, from, n); - uaccess_restore(ua_flags); -@@ -157,6 +250,21 @@ arm_copy_to_user(void __user *to, const void *from, unsigned long n) - } - return n; - } -+ -+unsigned long __must_check -+arm_copy_from_user(void *to, const void __user *from, unsigned long n) -+{ -+ /* -+ * This test is stubbed out of the main function above to keep -+ * the overhead for small copies low by avoiding a large -+ * register dump on the stack just to reload them right away. -+ * With frame pointer disabled, tail call optimization kicks in -+ * as well making this test almost invisible. -+ */ -+ if (n < COPY_FROM_USER_THRESHOLD) -+ return __copy_from_user_std(to, from, n); -+ return __copy_from_user_memcpy(to, from, n); -+} - - static unsigned long noinline - __clear_user_memset(void __user *addr, unsigned long n) - -From 44d43099a94c8b2db818c80c67789ef5f9857b81 Mon Sep 17 00:00:00 2001 -From: Phil Elwell <phil@raspberrypi.org> -Date: Thu, 25 Jun 2015 12:16:11 +0100 -Subject: [PATCH 081/170] gpio-poweroff: Allow it to work on Raspberry Pi - -The Raspberry Pi firmware manages the power-down and reboot -process. To do this it installs a pm_power_off handler, causing -the gpio-poweroff module to abort the probe function. - -This patch introduces a "force" DT property that overrides that -behaviour, and also adds a DT overlay to enable and control it. - -Note that running in an active-low configuration (DT parameter -"active_low") requires a custom dt-blob.bin and probably won't -allow a reboot without switching off, so an external inversion -of the trigger signal may be preferable. ---- - drivers/power/reset/gpio-poweroff.c | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -diff --git a/drivers/power/reset/gpio-poweroff.c b/drivers/power/reset/gpio-poweroff.c -index be3d81f..a030ae9 100644 ---- a/drivers/power/reset/gpio-poweroff.c -+++ b/drivers/power/reset/gpio-poweroff.c -@@ -49,9 +49,11 @@ static int gpio_poweroff_probe(struct platform_device *pdev) - { - bool input = false; - enum gpiod_flags flags; -+ bool force = false; - - /* If a pm_power_off function has already been added, leave it alone */ -- if (pm_power_off != NULL) { -+ force = of_property_read_bool(pdev->dev.of_node, "force"); -+ if (!force && (pm_power_off != NULL)) { - dev_err(&pdev->dev, - "%s: pm_power_off function already registered", - __func__); - -From 5b2d8bca046bd6f1a426e9205f194ece5b95e300 Mon Sep 17 00:00:00 2001 -From: Phil Elwell <phil@raspberrypi.org> -Date: Tue, 14 Jul 2015 10:26:09 +0100 -Subject: [PATCH 082/170] spidev: Add "spidev" compatible string to silence - warning - -See: https://github.com/raspberrypi/linux/issues/1054 ---- - drivers/spi/spidev.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c -index d0e7dfc..57b0760 100644 ---- a/drivers/spi/spidev.c -+++ b/drivers/spi/spidev.c -@@ -695,6 +695,7 @@ static struct class *spidev_class; - static const struct of_device_id spidev_dt_ids[] = { - { .compatible = "rohm,dh2228fv" }, - { .compatible = "lineartechnology,ltc2488" }, -+ { .compatible = "spidev" }, - {}, - }; - MODULE_DEVICE_TABLE(of, spidev_dt_ids); - -From 534c337ea28bee34f886a1d1e00d281365c94efa Mon Sep 17 00:00:00 2001 -From: Phil Elwell <phil@raspberrypi.org> -Date: Tue, 14 Jul 2015 17:00:18 +0100 -Subject: [PATCH 083/170] scripts/dtc: Add overlay support - ---- - scripts/dtc/checks.c | 119 ++- - scripts/dtc/dtc-lexer.l | 5 + - scripts/dtc/dtc-lexer.lex.c_shipped | 490 ++++----- - scripts/dtc/dtc-parser.tab.c_shipped | 1896 +++++++++++++++++++--------------- - scripts/dtc/dtc-parser.tab.h_shipped | 107 +- - scripts/dtc/dtc-parser.y | 23 +- - scripts/dtc/dtc.c | 9 +- - scripts/dtc/dtc.h | 38 + - scripts/dtc/flattree.c | 141 ++- - scripts/dtc/version_gen.h | 2 +- - 10 files changed, 1685 insertions(+), 1145 deletions(-) - -diff --git a/scripts/dtc/checks.c b/scripts/dtc/checks.c -index e81a8c74..efd1bc6 100644 ---- a/scripts/dtc/checks.c -+++ b/scripts/dtc/checks.c -@@ -458,21 +458,91 @@ static void fixup_phandle_references(struct check *c, struct node *dt, - struct node *node, struct property *prop) - { - struct marker *m = prop->val.markers; -+ struct fixup *f, **fp; -+ struct fixup_entry *fe, **fep; - struct node *refnode; - cell_t phandle; -+ int has_phandle_refs; -+ -+ has_phandle_refs = 0; -+ for_each_marker_of_type(m, REF_PHANDLE) { -+ has_phandle_refs = 1; -+ break; -+ } -+ -+ if (!has_phandle_refs) -+ return; - - for_each_marker_of_type(m, REF_PHANDLE) { - assert(m->offset + sizeof(cell_t) <= prop->val.len); - - refnode = get_node_by_ref(dt, m->ref); -- if (! refnode) { -+ if (!refnode && !symbol_fixup_support) { - FAIL(c, "Reference to non-existent node or label \"%s\"\n", -- m->ref); -+ m->ref); - continue; - } - -- phandle = get_node_phandle(dt, refnode); -- *((cell_t *)(prop->val.val + m->offset)) = cpu_to_fdt32(phandle); -+ if (!refnode) { -+ /* allocate fixup entry */ -+ fe = xmalloc(sizeof(*fe)); -+ -+ fe->node = node; -+ fe->prop = prop; -+ fe->offset = m->offset; -+ fe->next = NULL; -+ -+ /* search for an already existing fixup */ -+ for_each_fixup(dt, f) -+ if (strcmp(f->ref, m->ref) == 0) -+ break; -+ -+ /* no fixup found, add new */ -+ if (f == NULL) { -+ f = xmalloc(sizeof(*f)); -+ f->ref = m->ref; -+ f->entries = NULL; -+ f->next = NULL; -+ -+ /* add it to the tree */ -+ fp = &dt->fixups; -+ while (*fp) -+ fp = &(*fp)->next; -+ *fp = f; -+ } -+ -+ /* and now append fixup entry */ -+ fep = &f->entries; -+ while (*fep) -+ fep = &(*fep)->next; -+ *fep = fe; -+ -+ /* mark the entry as unresolved */ -+ phandle = 0xdeadbeef; -+ } else { -+ phandle = get_node_phandle(dt, refnode); -+ -+ /* if it's a plugin, we need to record it */ -+ if (symbol_fixup_support && dt->is_plugin) { -+ -+ /* allocate a new local fixup entry */ -+ fe = xmalloc(sizeof(*fe)); -+ -+ fe->node = node; -+ fe->prop = prop; -+ fe->offset = m->offset; -+ fe->next = NULL; -+ -+ /* append it to the local fixups */ -+ fep = &dt->local_fixups; -+ while (*fep) -+ fep = &(*fep)->next; -+ *fep = fe; -+ } -+ } -+ -+ *((cell_t *)(prop->val.val + m->offset)) = -+ cpu_to_fdt32(phandle); - } - } - ERROR(phandle_references, NULL, NULL, fixup_phandle_references, NULL, -@@ -652,6 +722,45 @@ static void check_obsolete_chosen_interrupt_controller(struct check *c, - } - TREE_WARNING(obsolete_chosen_interrupt_controller, NULL); - -+static void check_auto_label_phandles(struct check *c, struct node *dt, -+ struct node *node) -+{ -+ struct label *l; -+ struct symbol *s, **sp; -+ int has_label; -+ -+ if (!symbol_fixup_support) -+ return; -+ -+ has_label = 0; -+ for_each_label(node->labels, l) { -+ has_label = 1; -+ break; -+ } -+ -+ if (!has_label) -+ return; -+ -+ /* force allocation of a phandle for this node */ -+ (void)get_node_phandle(dt, node); -+ -+ /* add the symbol */ -+ for_each_label(node->labels, l) { -+ -+ s = xmalloc(sizeof(*s)); -+ s->label = l; -+ s->node = node; -+ s->next = NULL; -+ -+ /* add it to the symbols list */ -+ sp = &dt->symbols; -+ while (*sp) -+ sp = &((*sp)->next); -+ *sp = s; -+ } -+} -+NODE_WARNING(auto_label_phandles, NULL); -+ - static struct check *check_table[] = { - &duplicate_node_names, &duplicate_property_names, - &node_name_chars, &node_name_format, &property_name_chars, -@@ -670,6 +779,8 @@ static struct check *check_table[] = { - &avoid_default_addr_size, - &obsolete_chosen_interrupt_controller, - -+ &auto_label_phandles, -+ - &always_fail, - }; - -diff --git a/scripts/dtc/dtc-lexer.l b/scripts/dtc/dtc-lexer.l -index 0ee1caf0..dd44ba2 100644 ---- a/scripts/dtc/dtc-lexer.l -+++ b/scripts/dtc/dtc-lexer.l -@@ -113,6 +113,11 @@ static void lexical_error(const char *fmt, ...); - return DT_V1; - } - -+<*>"/plugin/" { -+ DPRINT("Keyword: /plugin/\n"); -+ return DT_PLUGIN; -+ } -+ - <*>"/memreserve/" { - DPRINT("Keyword: /memreserve/\n"); - BEGIN_DEFAULT(); -diff --git a/scripts/dtc/dtc-lexer.lex.c_shipped b/scripts/dtc/dtc-lexer.lex.c_shipped -index 11cd78e..1518525 100644 ---- a/scripts/dtc/dtc-lexer.lex.c_shipped -+++ b/scripts/dtc/dtc-lexer.lex.c_shipped -@@ -9,7 +9,7 @@ - #define FLEX_SCANNER - #define YY_FLEX_MAJOR_VERSION 2 - #define YY_FLEX_MINOR_VERSION 5 --#define YY_FLEX_SUBMINOR_VERSION 39 -+#define YY_FLEX_SUBMINOR_VERSION 35 - #if YY_FLEX_SUBMINOR_VERSION > 0 - #define FLEX_BETA - #endif -@@ -162,12 +162,7 @@ typedef unsigned int flex_uint32_t; - typedef struct yy_buffer_state *YY_BUFFER_STATE; - #endif - --#ifndef YY_TYPEDEF_YY_SIZE_T --#define YY_TYPEDEF_YY_SIZE_T --typedef size_t yy_size_t; --#endif -- --extern yy_size_t yyleng; -+extern int yyleng; - - extern FILE *yyin, *yyout; - -@@ -176,7 +171,6 @@ extern FILE *yyin, *yyout; - #define EOB_ACT_LAST_MATCH 2 - - #define YY_LESS_LINENO(n) -- #define YY_LINENO_REWIND_TO(ptr) - - /* Return all but the first "n" matched characters back to the input stream. */ - #define yyless(n) \ -@@ -194,6 +188,11 @@ extern FILE *yyin, *yyout; - - #define unput(c) yyunput( c, (yytext_ptr) ) - -+#ifndef YY_TYPEDEF_YY_SIZE_T -+#define YY_TYPEDEF_YY_SIZE_T -+typedef size_t yy_size_t; -+#endif -+ - #ifndef YY_STRUCT_YY_BUFFER_STATE - #define YY_STRUCT_YY_BUFFER_STATE - struct yy_buffer_state -@@ -211,7 +210,7 @@ struct yy_buffer_state - /* Number of characters read into yy_ch_buf, not including EOB - * characters. - */ -- yy_size_t yy_n_chars; -+ int yy_n_chars; - - /* Whether we "own" the buffer - i.e., we know we created it, - * and can realloc() it to grow it, and should free() it to -@@ -281,8 +280,8 @@ static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ - - /* yy_hold_char holds the character lost when yytext is formed. */ - static char yy_hold_char; --static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */ --yy_size_t yyleng; -+static int yy_n_chars; /* number of characters read into yy_ch_buf */ -+int yyleng; - - /* Points to current character in buffer. */ - static char *yy_c_buf_p = (char *) 0; -@@ -310,7 +309,7 @@ static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ); - - YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ); - YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ); --YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,yy_size_t len ); -+YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len ); - - void *yyalloc (yy_size_t ); - void *yyrealloc (void *,yy_size_t ); -@@ -342,7 +341,7 @@ void yyfree (void * ); - - /* Begin user sect3 */ - --#define yywrap() 1 -+#define yywrap(n) 1 - #define YY_SKIP_YYWRAP - - typedef unsigned char YY_CHAR; -@@ -373,8 +372,8 @@ static void yy_fatal_error (yyconst char msg[] ); - *yy_cp = '\0'; \ - (yy_c_buf_p) = yy_cp; - --#define YY_NUM_RULES 30 --#define YY_END_OF_BUFFER 31 -+#define YY_NUM_RULES 31 -+#define YY_END_OF_BUFFER 32 - /* This struct is not used in this scanner, - but its presence is necessary. */ - struct yy_trans_info -@@ -382,25 +381,26 @@ struct yy_trans_info - flex_int32_t yy_verify; - flex_int32_t yy_nxt; - }; --static yyconst flex_int16_t yy_accept[159] = -+static yyconst flex_int16_t yy_accept[166] = - { 0, -- 0, 0, 0, 0, 0, 0, 0, 0, 31, 29, -- 18, 18, 29, 29, 29, 29, 29, 29, 29, 29, -- 29, 29, 29, 29, 29, 29, 15, 16, 16, 29, -- 16, 10, 10, 18, 26, 0, 3, 0, 27, 12, -- 0, 0, 11, 0, 0, 0, 0, 0, 0, 0, -- 21, 23, 25, 24, 22, 0, 9, 28, 0, 0, -- 0, 14, 14, 16, 16, 16, 10, 10, 10, 0, -- 12, 0, 11, 0, 0, 0, 20, 0, 0, 0, -- 0, 0, 0, 0, 0, 16, 10, 10, 10, 0, -- 13, 19, 0, 0, 0, 0, 0, 0, 0, 0, -- -- 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, -- 0, 16, 6, 0, 0, 0, 0, 0, 0, 2, -- 0, 0, 0, 0, 0, 0, 0, 0, 4, 17, -- 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, -- 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, -- 5, 8, 0, 0, 0, 0, 7, 0 -+ 0, 0, 0, 0, 0, 0, 0, 0, 32, 30, -+ 19, 19, 30, 30, 30, 30, 30, 30, 30, 30, -+ 30, 30, 30, 30, 30, 30, 16, 17, 17, 30, -+ 17, 11, 11, 19, 27, 0, 3, 0, 28, 13, -+ 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, -+ 0, 22, 24, 26, 25, 23, 0, 10, 29, 0, -+ 0, 0, 15, 15, 17, 17, 17, 11, 11, 11, -+ 0, 13, 0, 12, 0, 0, 0, 21, 0, 0, -+ 0, 0, 0, 0, 0, 0, 0, 17, 11, 11, -+ 11, 0, 14, 20, 0, 0, 0, 0, 0, 0, -+ -+ 0, 0, 0, 0, 17, 0, 0, 0, 0, 0, -+ 0, 0, 0, 0, 0, 17, 7, 0, 0, 0, -+ 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, -+ 0, 0, 0, 0, 4, 18, 0, 0, 5, 2, -+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -+ 0, 0, 1, 0, 0, 0, 0, 6, 9, 0, -+ 0, 0, 0, 8, 0 - } ; - - static yyconst flex_int32_t yy_ec[256] = -@@ -416,9 +416,9 @@ static yyconst flex_int32_t yy_ec[256] = - 22, 22, 22, 22, 24, 22, 22, 25, 22, 22, - 1, 26, 27, 1, 22, 1, 21, 28, 29, 30, - -- 31, 21, 22, 22, 32, 22, 22, 33, 34, 35, -- 36, 37, 22, 38, 39, 40, 41, 42, 22, 25, -- 43, 22, 44, 45, 46, 1, 1, 1, 1, 1, -+ 31, 21, 32, 22, 33, 22, 22, 34, 35, 36, -+ 37, 38, 22, 39, 40, 41, 42, 43, 22, 25, -+ 44, 22, 45, 46, 47, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -@@ -435,163 +435,165 @@ static yyconst flex_int32_t yy_ec[256] = - 1, 1, 1, 1, 1 - } ; - --static yyconst flex_int32_t yy_meta[47] = -+static yyconst flex_int32_t yy_meta[48] = - { 0, - 1, 1, 1, 1, 1, 1, 2, 3, 1, 2, - 2, 2, 4, 5, 5, 5, 6, 1, 1, 1, - 7, 8, 8, 8, 8, 1, 1, 7, 7, 7, - 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, -- 8, 8, 8, 3, 1, 4 -+ 8, 8, 8, 8, 3, 1, 4 - } ; - --static yyconst flex_int16_t yy_base[173] = -+static yyconst flex_int16_t yy_base[180] = - { 0, -- 0, 383, 34, 382, 65, 381, 37, 105, 387, 391, -- 54, 111, 367, 110, 109, 109, 112, 41, 366, 104, -- 367, 338, 124, 117, 0, 144, 391, 0, 121, 0, -- 135, 155, 140, 179, 391, 160, 391, 379, 391, 0, -- 368, 141, 391, 167, 370, 376, 346, 103, 342, 345, -- 391, 391, 391, 391, 391, 358, 391, 391, 175, 342, -- 338, 391, 355, 0, 185, 339, 184, 347, 346, 0, -- 0, 322, 175, 357, 175, 363, 352, 324, 330, 323, -- 332, 326, 201, 324, 329, 322, 391, 333, 181, 309, -- 391, 341, 340, 313, 320, 338, 178, 311, 146, 317, -- -- 314, 315, 335, 331, 303, 300, 309, 299, 308, 188, -- 336, 335, 391, 305, 320, 281, 283, 271, 203, 288, -- 281, 271, 266, 264, 245, 242, 208, 104, 391, 391, -- 244, 218, 204, 219, 206, 224, 201, 212, 204, 229, -- 215, 208, 207, 200, 219, 391, 233, 221, 200, 181, -- 391, 391, 149, 122, 86, 41, 391, 391, 245, 251, -- 259, 263, 267, 273, 280, 284, 292, 300, 304, 310, -- 318, 326 -+ 0, 393, 35, 392, 66, 391, 38, 107, 397, 401, -+ 55, 113, 377, 112, 111, 111, 114, 42, 376, 106, -+ 377, 347, 126, 120, 0, 147, 401, 0, 124, 0, -+ 137, 158, 170, 163, 401, 153, 401, 389, 401, 0, -+ 378, 120, 401, 131, 380, 386, 355, 139, 351, 355, -+ 351, 401, 401, 401, 401, 401, 367, 401, 401, 185, -+ 350, 346, 401, 364, 0, 185, 347, 189, 356, 355, -+ 0, 0, 330, 180, 366, 141, 372, 361, 332, 338, -+ 331, 341, 334, 326, 205, 331, 337, 329, 401, 341, -+ 167, 316, 401, 349, 348, 320, 328, 346, 180, 318, -+ -+ 324, 209, 324, 320, 322, 342, 338, 309, 306, 315, -+ 305, 315, 312, 192, 342, 341, 401, 293, 306, 282, -+ 268, 252, 255, 203, 285, 282, 272, 268, 252, 233, -+ 232, 239, 208, 107, 401, 401, 238, 211, 401, 211, -+ 212, 208, 228, 203, 215, 207, 233, 222, 212, 211, -+ 203, 227, 401, 237, 225, 204, 185, 401, 401, 149, -+ 128, 88, 42, 401, 401, 253, 259, 267, 271, 275, -+ 281, 288, 292, 300, 308, 312, 318, 326, 334 - } ; - --static yyconst flex_int16_t yy_def[173] = -+static yyconst flex_int16_t yy_def[180] = - { 0, -- 158, 1, 1, 3, 158, 5, 1, 1, 158, 158, -- 158, 158, 158, 159, 160, 161, 158, 158, 158, 158, -- 162, 158, 158, 158, 163, 162, 158, 164, 165, 164, -- 164, 158, 158, 158, 158, 159, 158, 159, 158, 166, -- 158, 161, 158, 161, 167, 168, 158, 158, 158, 158, -- 158, 158, 158, 158, 158, 162, 158, 158, 158, 158, -- 158, 158, 162, 164, 165, 164, 158, 158, 158, 169, -- 166, 170, 161, 167, 167, 168, 158, 158, 158, 158, -- 158, 158, 158, 158, 158, 164, 158, 158, 169, 170, -- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, -- -- 158, 164, 158, 158, 158, 158, 158, 158, 158, 171, -- 158, 164, 158, 158, 158, 158, 158, 158, 171, 158, -- 171, 158, 158, 158, 158, 158, 158, 158, 158, 158, -- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, -- 172, 158, 158, 158, 172, 158, 172, 158, 158, 158, -- 158, 158, 158, 158, 158, 158, 158, 0, 158, 158, -- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, -- 158, 158 -+ 165, 1, 1, 3, 165, 5, 1, 1, 165, 165, -+ 165, 165, 165, 166, 167, 168, 165, 165, 165, 165, -+ 169, 165, 165, 165, 170, 169, 165, 171, 172, 171, -+ 171, 165, 165, 165, 165, 166, 165, 166, 165, 173, -+ 165, 168, 165, 168, 174, 175, 165, 165, 165, 165, -+ 165, 165, 165, 165, 165, 165, 169, 165, 165, 165, -+ 165, 165, 165, 169, 171, 172, 171, 165, 165, 165, -+ 176, 173, 177, 168, 174, 174, 175, 165, 165, 165, -+ 165, 165, 165, 165, 165, 165, 165, 171, 165, 165, -+ 176, 177, 165, 165, 165, 165, 165, 165, 165, 165, -+ -+ 165, 165, 165, 165, 171, 165, 165, 165, 165, 165, -+ 165, 165, 165, 178, 165, 171, 165, 165, 165, 165, -+ 165, 165, 165, 178, 165, 178, 165, 165, 165, 165, -+ 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, -+ 165, 165, 165, 165, 165, 165, 165, 179, 165, 165, -+ 165, 179, 165, 179, 165, 165, 165, 165, 165, 165, -+ 165, 165, 165, 165, 0, 165, 165, 165, 165, 165, -+ 165, 165, 165, 165, 165, 165, 165, 165, 165 - } ; - --static yyconst flex_int16_t yy_nxt[438] = -+static yyconst flex_int16_t yy_nxt[449] = - { 0, - 10, 11, 12, 11, 13, 14, 10, 15, 16, 10, - 10, 10, 17, 10, 10, 10, 10, 18, 19, 20, - 21, 21, 21, 21, 21, 10, 10, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, -- 21, 21, 21, 10, 22, 10, 24, 25, 25, 25, -- 32, 33, 33, 157, 26, 34, 34, 34, 51, 52, -- 27, 26, 26, 26, 26, 10, 11, 12, 11, 13, -- 14, 28, 15, 16, 28, 28, 28, 24, 28, 28, -- 28, 10, 18, 19, 20, 29, 29, 29, 29, 29, -- 30, 10, 29, 29, 29, 29, 29, 29, 29, 29, -- -- 29, 29, 29, 29, 29, 29, 29, 29, 10, 22, -- 10, 23, 34, 34, 34, 37, 39, 43, 32, 33, -- 33, 45, 54, 55, 46, 59, 45, 64, 156, 46, -- 64, 64, 64, 79, 44, 38, 59, 57, 134, 47, -- 135, 48, 80, 49, 47, 50, 48, 99, 61, 43, -- 50, 110, 41, 67, 67, 67, 60, 63, 63, 63, -- 57, 155, 68, 69, 63, 37, 44, 66, 67, 67, -- 67, 63, 63, 63, 63, 73, 59, 68, 69, 70, -- 34, 34, 34, 43, 75, 38, 154, 92, 83, 83, -- 83, 64, 44, 120, 64, 64, 64, 67, 67, 67, -- -- 44, 57, 99, 68, 69, 107, 68, 69, 120, 127, -- 108, 153, 152, 121, 83, 83, 83, 133, 133, 133, -- 146, 133, 133, 133, 146, 140, 140, 140, 121, 141, -- 140, 140, 140, 151, 141, 158, 150, 149, 148, 144, -- 147, 143, 142, 139, 147, 36, 36, 36, 36, 36, -- 36, 36, 36, 40, 138, 137, 136, 40, 40, 42, -- 42, 42, 42, 42, 42, 42, 42, 56, 56, 56, -- 56, 62, 132, 62, 64, 131, 130, 64, 129, 64, -- 64, 65, 128, 158, 65, 65, 65, 65, 71, 127, -- 71, 71, 74, 74, 74, 74, 74, 74, 74, 74, -- -- 76, 76, 76, 76, 76, 76, 76, 76, 89, 126, -- 89, 90, 125, 90, 90, 124, 90, 90, 119, 119, -- 119, 119, 119, 119, 119, 119, 145, 145, 145, 145, -- 145, 145, 145, 145, 123, 122, 59, 59, 118, 117, -- 116, 115, 114, 113, 45, 112, 108, 111, 109, 106, -- 105, 104, 46, 103, 91, 87, 102, 101, 100, 98, -- 97, 96, 95, 94, 93, 77, 75, 91, 88, 87, -- 86, 57, 85, 84, 57, 82, 81, 78, 77, 75, -- 72, 158, 58, 57, 53, 35, 158, 31, 23, 23, -- 9, 158, 158, 158, 158, 158, 158, 158, 158, 158, -- -- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, -- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, -- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, -- 158, 158, 158, 158, 158, 158, 158 -+ 21, 21, 21, 21, 10, 22, 10, 24, 25, 25, -+ 25, 32, 33, 33, 164, 26, 34, 34, 34, 52, -+ 53, 27, 26, 26, 26, 26, 10, 11, 12, 11, -+ 13, 14, 28, 15, 16, 28, 28, 28, 24, 28, -+ 28, 28, 10, 18, 19, 20, 29, 29, 29, 29, -+ 29, 30, 10, 29, 29, 29, 29, 29, 29, 29, -+ -+ 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, -+ 10, 22, 10, 23, 34, 34, 34, 37, 39, 43, -+ 32, 33, 33, 45, 55, 56, 46, 60, 43, 45, -+ 65, 163, 46, 65, 65, 65, 44, 38, 60, 74, -+ 58, 47, 141, 48, 142, 44, 49, 47, 50, 48, -+ 76, 51, 62, 94, 50, 41, 44, 51, 37, 61, -+ 64, 64, 64, 58, 34, 34, 34, 64, 162, 80, -+ 67, 68, 68, 68, 64, 64, 64, 64, 38, 81, -+ 69, 70, 71, 68, 68, 68, 60, 161, 43, 69, -+ 70, 65, 69, 70, 65, 65, 65, 125, 85, 85, -+ -+ 85, 58, 68, 68, 68, 44, 102, 110, 125, 133, -+ 102, 69, 70, 111, 114, 160, 159, 126, 85, 85, -+ 85, 140, 140, 140, 140, 140, 140, 153, 126, 147, -+ 147, 147, 153, 148, 147, 147, 147, 158, 148, 165, -+ 157, 156, 155, 151, 150, 149, 146, 154, 145, 144, -+ 143, 139, 154, 36, 36, 36, 36, 36, 36, 36, -+ 36, 40, 138, 137, 136, 40, 40, 42, 42, 42, -+ 42, 42, 42, 42, 42, 57, 57, 57, 57, 63, -+ 135, 63, 65, 134, 165, 65, 133, 65, 65, 66, -+ 132, 131, 66, 66, 66, 66, 72, 130, 72, 72, -+ -+ 75, 75, 75, 75, 75, 75, 75, 75, 77, 77, -+ 77, 77, 77, 77, 77, 77, 91, 129, 91, 92, -+ 128, 92, 92, 127, 92, 92, 124, 124, 124, 124, -+ 124, 124, 124, 124, 152, 152, 152, 152, 152, 152, -+ 152, 152, 60, 60, 123, 122, 121, 120, 119, 118, -+ 117, 45, 116, 111, 115, 113, 112, 109, 108, 107, -+ 46, 106, 93, 89, 105, 104, 103, 101, 100, 99, -+ 98, 97, 96, 95, 78, 76, 93, 90, 89, 88, -+ 58, 87, 86, 58, 84, 83, 82, 79, 78, 76, -+ 73, 165, 59, 58, 54, 35, 165, 31, 23, 23, -+ -+ 9, 165, 165, 165, 165, 165, 165, 165, 165, 165, -+ 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, -+ 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, -+ 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, -+ 165, 165, 165, 165, 165, 165, 165, 165 - } ; - --static yyconst flex_int16_t yy_chk[438] = -+static yyconst flex_int16_t yy_chk[449] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -- 1, 1, 1, 1, 1, 1, 3, 3, 3, 3, -- 7, 7, 7, 156, 3, 11, 11, 11, 18, 18, -- 3, 3, 3, 3, 3, 5, 5, 5, 5, 5, -+ 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, -+ 3, 7, 7, 7, 163, 3, 11, 11, 11, 18, -+ 18, 3, 3, 3, 3, 3, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, -- 5, 8, 12, 12, 12, 14, 15, 16, 8, 8, -- 8, 17, 20, 20, 17, 23, 24, 29, 155, 24, -- 29, 29, 29, 48, 16, 14, 31, 29, 128, 17, -- 128, 17, 48, 17, 24, 17, 24, 99, 24, 42, -- 24, 99, 15, 33, 33, 33, 23, 26, 26, 26, -- 26, 154, 33, 33, 26, 36, 42, 31, 32, 32, -- 32, 26, 26, 26, 26, 44, 59, 32, 32, 32, -- 34, 34, 34, 73, 75, 36, 153, 75, 59, 59, -- 59, 65, 44, 110, 65, 65, 65, 67, 67, 67, -- -- 73, 65, 83, 89, 89, 97, 67, 67, 119, 127, -- 97, 150, 149, 110, 83, 83, 83, 133, 133, 133, -- 141, 127, 127, 127, 145, 136, 136, 136, 119, 136, -- 140, 140, 140, 148, 140, 147, 144, 143, 142, 139, -- 141, 138, 137, 135, 145, 159, 159, 159, 159, 159, -- 159, 159, 159, 160, 134, 132, 131, 160, 160, 161, -- 161, 161, 161, 161, 161, 161, 161, 162, 162, 162, -- 162, 163, 126, 163, 164, 125, 124, 164, 123, 164, -- 164, 165, 122, 121, 165, 165, 165, 165, 166, 120, -- 166, 166, 167, 167, 167, 167, 167, 167, 167, 167, -- -- 168, 168, 168, 168, 168, 168, 168, 168, 169, 118, -- 169, 170, 117, 170, 170, 116, 170, 170, 171, 171, -- 171, 171, 171, 171, 171, 171, 172, 172, 172, 172, -- 172, 172, 172, 172, 115, 114, 112, 111, 109, 108, -- 107, 106, 105, 104, 103, 102, 101, 100, 98, 96, -- 95, 94, 93, 92, 90, 88, 86, 85, 84, 82, -- 81, 80, 79, 78, 77, 76, 74, 72, 69, 68, -- 66, 63, 61, 60, 56, 50, 49, 47, 46, 45, -+ 5, 5, 5, 8, 12, 12, 12, 14, 15, 16, -+ 8, 8, 8, 17, 20, 20, 17, 23, 42, 24, -+ 29, 162, 24, 29, 29, 29, 16, 14, 31, 44, -+ 29, 17, 134, 17, 134, 42, 17, 24, 17, 24, -+ 76, 17, 24, 76, 24, 15, 44, 24, 36, 23, -+ 26, 26, 26, 26, 34, 34, 34, 26, 161, 48, -+ 31, 32, 32, 32, 26, 26, 26, 26, 36, 48, -+ 32, 32, 32, 33, 33, 33, 60, 160, 74, 91, -+ 91, 66, 33, 33, 66, 66, 66, 114, 60, 60, -+ -+ 60, 66, 68, 68, 68, 74, 85, 99, 124, 133, -+ 102, 68, 68, 99, 102, 157, 156, 114, 85, 85, -+ 85, 133, 133, 133, 140, 140, 140, 148, 124, 143, -+ 143, 143, 152, 143, 147, 147, 147, 155, 147, 154, -+ 151, 150, 149, 146, 145, 144, 142, 148, 141, 138, -+ 137, 132, 152, 166, 166, 166, 166, 166, 166, 166, -+ 166, 167, 131, 130, 129, 167, 167, 168, 168, 168, -+ 168, 168, 168, 168, 168, 169, 169, 169, 169, 170, -+ 128, 170, 171, 127, 126, 171, 125, 171, 171, 172, -+ 123, 122, 172, 172, 172, 172, 173, 121, 173, 173, -+ -+ 174, 174, 174, 174, 174, 174, 174, 174, 175, 175, -+ 175, 175, 175, 175, 175, 175, 176, 120, 176, 177, -+ 119, 177, 177, 118, 177, 177, 178, 178, 178, 178, -+ 178, 178, 178, 178, 179, 179, 179, 179, 179, 179, -+ 179, 179, 116, 115, 113, 112, 111, 110, 109, 108, -+ 107, 106, 105, 104, 103, 101, 100, 98, 97, 96, -+ 95, 94, 92, 90, 88, 87, 86, 84, 83, 82, -+ 81, 80, 79, 78, 77, 75, 73, 70, 69, 67, -+ 64, 62, 61, 57, 51, 50, 49, 47, 46, 45, - 41, 38, 22, 21, 19, 13, 9, 6, 4, 2, -- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, - -- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, -- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, -- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, -- 158, 158, 158, 158, 158, 158, 158 -+ 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, -+ 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, -+ 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, -+ 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, -+ 165, 165, 165, 165, 165, 165, 165, 165 - } ; - - static yy_state_type yy_last_accepting_state; -@@ -662,7 +664,7 @@ static int dts_version = 1; - static void push_input_file(const char *filename); - static bool pop_input_file(void); - static void lexical_error(const char *fmt, ...); --#line 666 "dtc-lexer.lex.c" -+#line 668 "dtc-lexer.lex.c" - - #define INITIAL 0 - #define BYTESTRING 1 -@@ -704,7 +706,7 @@ FILE *yyget_out (void ); - - void yyset_out (FILE * out_str ); - --yy_size_t yyget_leng (void ); -+int yyget_leng (void ); - - char *yyget_text (void ); - -@@ -853,6 +855,10 @@ YY_DECL - register char *yy_cp, *yy_bp; - register int yy_act; - -+#line 68 "dtc-lexer.l" -+ -+#line 861 "dtc-lexer.lex.c" -+ - if ( !(yy_init) ) - { - (yy_init) = 1; -@@ -879,11 +885,6 @@ YY_DECL - yy_load_buffer_state( ); - } - -- { --#line 68 "dtc-lexer.l" -- --#line 886 "dtc-lexer.lex.c" -- - while ( 1 ) /* loops until end-of-file is reached */ - { - yy_cp = (yy_c_buf_p); -@@ -901,7 +902,7 @@ YY_DECL - yy_match: - do - { -- register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ; -+ register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; - if ( yy_accept[yy_current_state] ) - { - (yy_last_accepting_state) = yy_current_state; -@@ -910,13 +911,13 @@ yy_match: - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; -- if ( yy_current_state >= 159 ) -+ if ( yy_current_state >= 166 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - ++yy_cp; - } -- while ( yy_current_state != 158 ); -+ while ( yy_current_state != 165 ); - yy_cp = (yy_last_accepting_cpos); - yy_current_state = (yy_last_accepting_state); - -@@ -1007,23 +1008,31 @@ case 5: - YY_RULE_SETUP - #line 116 "dtc-lexer.l" - { -+ DPRINT("Keyword: /plugin/\n"); -+ return DT_PLUGIN; -+ } -+ YY_BREAK -+case 6: -+YY_RULE_SETUP -+#line 121 "dtc-lexer.l" -+{ - DPRINT("Keyword: /memreserve/\n"); - BEGIN_DEFAULT(); - return DT_MEMRESERVE; - } - YY_BREAK --case 6: -+case 7: - YY_RULE_SETUP --#line 122 "dtc-lexer.l" -+#line 127 "dtc-lexer.l" - { - DPRINT("Keyword: /bits/\n"); - BEGIN_DEFAULT(); - return DT_BITS; - } - YY_BREAK --case 7: -+case 8: - YY_RULE_SETUP --#line 128 "dtc-lexer.l" -+#line 133 "dtc-lexer.l" - { - DPRINT("Keyword: /delete-property/\n"); - DPRINT("<PROPNODENAME>\n"); -@@ -1031,9 +1040,9 @@ YY_RULE_SETUP - return DT_DEL_PROP; - } - YY_BREAK --case 8: -+case 9: - YY_RULE_SETUP --#line 135 "dtc-lexer.l" -+#line 140 "dtc-lexer.l" - { - DPRINT("Keyword: /delete-node/\n"); - DPRINT("<PROPNODENAME>\n"); -@@ -1041,9 +1050,9 @@ YY_RULE_SETUP - return DT_DEL_NODE; - } - YY_BREAK --case 9: -+case 10: - YY_RULE_SETUP --#line 142 "dtc-lexer.l" -+#line 147 "dtc-lexer.l" - { - DPRINT("Label: %s\n", yytext); - yylval.labelref = xstrdup(yytext); -@@ -1051,9 +1060,9 @@ YY_RULE_SETUP - return DT_LABEL; - } - YY_BREAK --case 10: -+case 11: - YY_RULE_SETUP --#line 149 "dtc-lexer.l" -+#line 154 "dtc-lexer.l" - { - char *e; - DPRINT("Integer Literal: '%s'\n", yytext); -@@ -1073,10 +1082,10 @@ YY_RULE_SETUP - return DT_LITERAL; - } - YY_BREAK --case 11: --/* rule 11 can match eol */ -+case 12: -+/* rule 12 can match eol */ - YY_RULE_SETUP --#line 168 "dtc-lexer.l" -+#line 173 "dtc-lexer.l" - { - struct data d; - DPRINT("Character literal: %s\n", yytext); -@@ -1098,18 +1107,18 @@ YY_RULE_SETUP - return DT_CHAR_LITERAL; - } - YY_BREAK --case 12: -+case 13: - YY_RULE_SETUP --#line 189 "dtc-lexer.l" -+#line 194 "dtc-lexer.l" - { /* label reference */ - DPRINT("Ref: %s\n", yytext+1); - yylval.labelref = xstrdup(yytext+1); - return DT_REF; - } - YY_BREAK --case 13: -+case 14: - YY_RULE_SETUP --#line 195 "dtc-lexer.l" -+#line 200 "dtc-lexer.l" - { /* new-style path reference */ - yytext[yyleng-1] = '\0'; - DPRINT("Ref: %s\n", yytext+2); -@@ -1117,27 +1126,27 @@ YY_RULE_SETUP - return DT_REF; - } - YY_BREAK --case 14: -+case 15: - YY_RULE_SETUP --#line 202 "dtc-lexer.l" -+#line 207 "dtc-lexer.l" - { - yylval.byte = strtol(yytext, NULL, 16); - DPRINT("Byte: %02x\n", (int)yylval.byte); - return DT_BYTE; - } - YY_BREAK --case 15: -+case 16: - YY_RULE_SETUP --#line 208 "dtc-lexer.l" -+#line 213 "dtc-lexer.l" - { - DPRINT("/BYTESTRING\n"); - BEGIN_DEFAULT(); - return ']'; - } - YY_BREAK --case 16: -+case 17: - YY_RULE_SETUP --#line 214 "dtc-lexer.l" -+#line 219 "dtc-lexer.l" - { - DPRINT("PropNodeName: %s\n", yytext); - yylval.propnodename = xstrdup((yytext[0] == '\\') ? -@@ -1146,75 +1155,75 @@ YY_RULE_SETUP - return DT_PROPNODENAME; - } - YY_BREAK --case 17: -+case 18: - YY_RULE_SETUP --#line 222 "dtc-lexer.l" -+#line 227 "dtc-lexer.l" - { - DPRINT("Binary Include\n"); - return DT_INCBIN; - } - YY_BREAK --case 18: --/* rule 18 can match eol */ --YY_RULE_SETUP --#line 227 "dtc-lexer.l" --/* eat whitespace */ -- YY_BREAK - case 19: - /* rule 19 can match eol */ - YY_RULE_SETUP --#line 228 "dtc-lexer.l" --/* eat C-style comments */ -+#line 232 "dtc-lexer.l" -+/* eat whitespace */ - YY_BREAK - case 20: - /* rule 20 can match eol */ - YY_RULE_SETUP --#line 229 "dtc-lexer.l" --/* eat C++-style comments */ -+#line 233 "dtc-lexer.l" -+/* eat C-style comments */ - YY_BREAK - case 21: -+/* rule 21 can match eol */ - YY_RULE_SETUP --#line 231 "dtc-lexer.l" --{ return DT_LSHIFT; }; -+#line 234 "dtc-lexer.l" -+/* eat C++-style comments */ - YY_BREAK - case 22: - YY_RULE_SETUP --#line 232 "dtc-lexer.l" --{ return DT_RSHIFT; }; -+#line 236 "dtc-lexer.l" -+{ return DT_LSHIFT; }; - YY_BREAK - case 23: - YY_RULE_SETUP --#line 233 "dtc-lexer.l" --{ return DT_LE; }; -+#line 237 "dtc-lexer.l" -+{ return DT_RSHIFT; }; - YY_BREAK - case 24: - YY_RULE_SETUP --#line 234 "dtc-lexer.l" --{ return DT_GE; }; -+#line 238 "dtc-lexer.l" -+{ return DT_LE; }; - YY_BREAK - case 25: - YY_RULE_SETUP --#line 235 "dtc-lexer.l" --{ return DT_EQ; }; -+#line 239 "dtc-lexer.l" -+{ return DT_GE; }; - YY_BREAK - case 26: - YY_RULE_SETUP --#line 236 "dtc-lexer.l" --{ return DT_NE; }; -+#line 240 "dtc-lexer.l" -+{ return DT_EQ; }; - YY_BREAK - case 27: - YY_RULE_SETUP --#line 237 "dtc-lexer.l" --{ return DT_AND; }; -+#line 241 "dtc-lexer.l" -+{ return DT_NE; }; - YY_BREAK - case 28: - YY_RULE_SETUP --#line 238 "dtc-lexer.l" --{ return DT_OR; }; -+#line 242 "dtc-lexer.l" -+{ return DT_AND; }; - YY_BREAK - case 29: - YY_RULE_SETUP --#line 240 "dtc-lexer.l" -+#line 243 "dtc-lexer.l" -+{ return DT_OR; }; -+ YY_BREAK -+case 30: -+YY_RULE_SETUP -+#line 245 "dtc-lexer.l" - { - DPRINT("Char: %c (\\x%02x)\n", yytext[0], - (unsigned)yytext[0]); -@@ -1230,12 +1239,12 @@ YY_RULE_SETUP - return yytext[0]; - } - YY_BREAK --case 30: -+case 31: - YY_RULE_SETUP --#line 255 "dtc-lexer.l" -+#line 260 "dtc-lexer.l" - ECHO; - YY_BREAK --#line 1239 "dtc-lexer.lex.c" -+#line 1248 "dtc-lexer.lex.c" - - case YY_END_OF_BUFFER: - { -@@ -1365,7 +1374,6 @@ ECHO; - "fatal flex scanner internal error--no action found" ); - } /* end of action switch */ - } /* end of scanning one token */ -- } /* end of user's declarations */ - } /* end of yylex */ - - /* yy_get_next_buffer - try to read in a new buffer -@@ -1421,21 +1429,21 @@ static int yy_get_next_buffer (void) - - else - { -- yy_size_t num_to_read = -+ int num_to_read = - YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; - - while ( num_to_read <= 0 ) - { /* Not enough room in the buffer - grow it. */ - - /* just a shorter name for the current buffer */ -- YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE; -+ YY_BUFFER_STATE b = YY_CURRENT_BUFFER; - - int yy_c_buf_p_offset = - (int) ((yy_c_buf_p) - b->yy_ch_buf); - - if ( b->yy_is_our_buffer ) - { -- yy_size_t new_size = b->yy_buf_size * 2; -+ int new_size = b->yy_buf_size * 2; - - if ( new_size <= 0 ) - b->yy_buf_size += b->yy_buf_size / 8; -@@ -1466,7 +1474,7 @@ static int yy_get_next_buffer (void) - - /* Read in more data. */ - YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), -- (yy_n_chars), num_to_read ); -+ (yy_n_chars), (size_t) num_to_read ); - - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } -@@ -1528,7 +1536,7 @@ static int yy_get_next_buffer (void) - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; -- if ( yy_current_state >= 159 ) -+ if ( yy_current_state >= 166 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; -@@ -1556,13 +1564,13 @@ static int yy_get_next_buffer (void) - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; -- if ( yy_current_state >= 159 ) -+ if ( yy_current_state >= 166 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; -- yy_is_jam = (yy_current_state == 158); -+ yy_is_jam = (yy_current_state == 165); - -- return yy_is_jam ? 0 : yy_current_state; -+ return yy_is_jam ? 0 : yy_current_state; - } - - #ifndef YY_NO_INPUT -@@ -1589,7 +1597,7 @@ static int yy_get_next_buffer (void) - - else - { /* need more input */ -- yy_size_t offset = (yy_c_buf_p) - (yytext_ptr); -+ int offset = (yy_c_buf_p) - (yytext_ptr); - ++(yy_c_buf_p); - - switch ( yy_get_next_buffer( ) ) -@@ -1863,7 +1871,7 @@ void yypop_buffer_state (void) - */ - static void yyensure_buffer_stack (void) - { -- yy_size_t num_to_alloc; -+ int num_to_alloc; - - if (!(yy_buffer_stack)) { - -@@ -1960,12 +1968,12 @@ YY_BUFFER_STATE yy_scan_string (yyconst char * yystr ) - * - * @return the newly allocated buffer state object. - */ --YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len ) -+YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, int _yybytes_len ) - { - YY_BUFFER_STATE b; - char *buf; - yy_size_t n; -- yy_size_t i; -+ int i; - - /* Get memory for full buffer, including space for trailing EOB's. */ - n = _yybytes_len + 2; -@@ -2047,7 +2055,7 @@ FILE *yyget_out (void) - /** Get the length of the current token. - * - */ --yy_size_t yyget_leng (void) -+int yyget_leng (void) - { - return yyleng; - } -@@ -2195,7 +2203,7 @@ void yyfree (void * ptr ) - - #define YYTABLES_NAME "yytables" - --#line 254 "dtc-lexer.l" -+#line 260 "dtc-lexer.l" - - - -diff --git a/scripts/dtc/dtc-parser.tab.c_shipped b/scripts/dtc/dtc-parser.tab.c_shipped -index 116458c..2c1784e 100644 ---- a/scripts/dtc/dtc-parser.tab.c_shipped -+++ b/scripts/dtc/dtc-parser.tab.c_shipped -@@ -1,19 +1,19 @@ --/* A Bison parser, made by GNU Bison 3.0.2. */ -+/* A Bison parser, made by GNU Bison 2.5. */ - - /* Bison implementation for Yacc-like parsers in C -- -- Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. -- -+ -+ Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc. -+ - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. -- -+ - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. -- -+ - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -@@ -26,7 +26,7 @@ - special exception, which will cause the skeleton and the resulting - Bison output files to be licensed under the GNU General Public - License without this special exception. -- -+ - This special exception was added by the Free Software Foundation in - version 2.2 of Bison. */ - -@@ -44,7 +44,7 @@ - #define YYBISON 1 - - /* Bison version. */ --#define YYBISON_VERSION "3.0.2" -+#define YYBISON_VERSION "2.5" - - /* Skeleton name. */ - #define YYSKELETON_NAME "yacc.c" -@@ -58,13 +58,18 @@ - /* Pull parsers. */ - #define YYPULL 1 - -+/* Using locations. */ -+#define YYLSP_NEEDED 1 - - - - /* Copy the first part of user declarations. */ --#line 20 "dtc-parser.y" /* yacc.c:339 */ -+ -+/* Line 268 of yacc.c */ -+#line 20 "dtc-parser.y" - - #include <stdio.h> -+#include <inttypes.h> - - #include "dtc.h" - #include "srcpos.h" -@@ -80,15 +85,14 @@ extern void yyerror(char const *s); - extern struct boot_info *the_boot_info; - extern bool treesource_error; - --#line 84 "dtc-parser.tab.c" /* yacc.c:339 */ - --# ifndef YY_NULLPTR --# if defined __cplusplus && 201103L <= __cplusplus --# define YY_NULLPTR nullptr --# else --# define YY_NULLPTR 0 --# endif --# endif -+/* Line 268 of yacc.c */ -+#line 91 "dtc-parser.tab.c" -+ -+/* Enabling traces. */ -+#ifndef YYDEBUG -+# define YYDEBUG 0 -+#endif - - /* Enabling verbose error messages. */ - #ifdef YYERROR_VERBOSE -@@ -98,53 +102,51 @@ extern bool treesource_error; - # define YYERROR_VERBOSE 0 - #endif - --/* In a future release of Bison, this section will be replaced -- by #include "dtc-parser.tab.h". */ --#ifndef YY_YY_DTC_PARSER_TAB_H_INCLUDED --# define YY_YY_DTC_PARSER_TAB_H_INCLUDED --/* Debug traces. */ --#ifndef YYDEBUG --# define YYDEBUG 0 --#endif --#if YYDEBUG --extern int yydebug; -+/* Enabling the token table. */ -+#ifndef YYTOKEN_TABLE -+# define YYTOKEN_TABLE 0 - #endif - --/* Token type. */ -+ -+/* Tokens. */ - #ifndef YYTOKENTYPE - # define YYTOKENTYPE -- enum yytokentype -- { -- DT_V1 = 258, -- DT_MEMRESERVE = 259, -- DT_LSHIFT = 260, -- DT_RSHIFT = 261, -- DT_LE = 262, -- DT_GE = 263, -- DT_EQ = 264, -- DT_NE = 265, -- DT_AND = 266, -- DT_OR = 267, -- DT_BITS = 268, -- DT_DEL_PROP = 269, -- DT_DEL_NODE = 270, -- DT_PROPNODENAME = 271, -- DT_LITERAL = 272, -- DT_CHAR_LITERAL = 273, -- DT_BYTE = 274, -- DT_STRING = 275, -- DT_LABEL = 276, -- DT_REF = 277, -- DT_INCBIN = 278 -- }; -+ /* Put the tokens into the symbol table, so that GDB and other debuggers -+ know about them. */ -+ enum yytokentype { -+ DT_V1 = 258, -+ DT_PLUGIN = 259, -+ DT_MEMRESERVE = 260, -+ DT_LSHIFT = 261, -+ DT_RSHIFT = 262, -+ DT_LE = 263, -+ DT_GE = 264, -+ DT_EQ = 265, -+ DT_NE = 266, -+ DT_AND = 267, -+ DT_OR = 268, -+ DT_BITS = 269, -+ DT_DEL_PROP = 270, -+ DT_DEL_NODE = 271, -+ DT_PROPNODENAME = 272, -+ DT_LITERAL = 273, -+ DT_CHAR_LITERAL = 274, -+ DT_BYTE = 275, -+ DT_STRING = 276, -+ DT_LABEL = 277, -+ DT_REF = 278, -+ DT_INCBIN = 279 -+ }; - #endif - --/* Value type. */ -+ -+ - #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED --typedef union YYSTYPE YYSTYPE; --union YYSTYPE -+typedef union YYSTYPE - { --#line 38 "dtc-parser.y" /* yacc.c:355 */ -+ -+/* Line 293 of yacc.c */ -+#line 39 "dtc-parser.y" - - char *propnodename; - char *labelref; -@@ -162,37 +164,37 @@ union YYSTYPE - struct node *nodelist; - struct reserve_info *re; - uint64_t integer; -+ int is_plugin; - --#line 167 "dtc-parser.tab.c" /* yacc.c:355 */ --}; -+ -+ -+/* Line 293 of yacc.c */ -+#line 173 "dtc-parser.tab.c" -+} YYSTYPE; - # define YYSTYPE_IS_TRIVIAL 1 -+# define yystype YYSTYPE /* obsolescent; will be withdrawn */ - # define YYSTYPE_IS_DECLARED 1 - #endif - --/* Location type. */ - #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED --typedef struct YYLTYPE YYLTYPE; --struct YYLTYPE -+typedef struct YYLTYPE - { - int first_line; - int first_column; - int last_line; - int last_column; --}; -+} YYLTYPE; -+# define yyltype YYLTYPE /* obsolescent; will be withdrawn */ - # define YYLTYPE_IS_DECLARED 1 - # define YYLTYPE_IS_TRIVIAL 1 - #endif - - --extern YYSTYPE yylval; --extern YYLTYPE yylloc; --int yyparse (void); -- --#endif /* !YY_YY_DTC_PARSER_TAB_H_INCLUDED */ -- - /* Copy the second part of user declarations. */ - --#line 196 "dtc-parser.tab.c" /* yacc.c:358 */ -+ -+/* Line 343 of yacc.c */ -+#line 198 "dtc-parser.tab.c" - - #ifdef short - # undef short -@@ -206,8 +208,11 @@ typedef unsigned char yytype_uint8; - - #ifdef YYTYPE_INT8 - typedef YYTYPE_INT8 yytype_int8; --#else -+#elif (defined __STDC__ || defined __C99__FUNC__ \ -+ || defined __cplusplus || defined _MSC_VER) - typedef signed char yytype_int8; -+#else -+typedef short int yytype_int8; - #endif - - #ifdef YYTYPE_UINT16 -@@ -227,7 +232,8 @@ typedef short int yytype_int16; - # define YYSIZE_T __SIZE_TYPE__ - # elif defined size_t - # define YYSIZE_T size_t --# elif ! defined YYSIZE_T -+# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ -+ || defined __cplusplus || defined _MSC_VER) - # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ - # define YYSIZE_T size_t - # else -@@ -241,68 +247,39 @@ typedef short int yytype_int16; - # if defined YYENABLE_NLS && YYENABLE_NLS - # if ENABLE_NLS - # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ --# define YY_(Msgid) dgettext ("bison-runtime", Msgid) -+# define YY_(msgid) dgettext ("bison-runtime", msgid) - # endif - # endif - # ifndef YY_ --# define YY_(Msgid) Msgid --# endif --#endif -- --#ifndef YY_ATTRIBUTE --# if (defined __GNUC__ \ -- && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ -- || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C --# define YY_ATTRIBUTE(Spec) __attribute__(Spec) --# else --# define YY_ATTRIBUTE(Spec) /* empty */ --# endif --#endif -- --#ifndef YY_ATTRIBUTE_PURE --# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) --#endif -- --#ifndef YY_ATTRIBUTE_UNUSED --# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) --#endif -- --#if !defined _Noreturn \ -- && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112) --# if defined _MSC_VER && 1200 <= _MSC_VER --# define _Noreturn __declspec (noreturn) --# else --# define _Noreturn YY_ATTRIBUTE ((__noreturn__)) -+# define YY_(msgid) msgid - # endif - #endif - - /* Suppress unused-variable warnings by "using" E. */ - #if ! defined lint || defined __GNUC__ --# define YYUSE(E) ((void) (E)) -+# define YYUSE(e) ((void) (e)) - #else --# define YYUSE(E) /* empty */ -+# define YYUSE(e) /* empty */ - #endif - --#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ --/* Suppress an incorrect diagnostic about yylval being uninitialized. */ --# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ -- _Pragma ("GCC diagnostic push") \ -- _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ -- _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") --# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ -- _Pragma ("GCC diagnostic pop") -+/* Identity function, used to suppress warnings about constant conditions. */ -+#ifndef lint -+# define YYID(n) (n) - #else --# define YY_INITIAL_VALUE(Value) Value --#endif --#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN --# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN --# define YY_IGNORE_MAYBE_UNINITIALIZED_END -+#if (defined __STDC__ || defined __C99__FUNC__ \ -+ || defined __cplusplus || defined _MSC_VER) -+static int -+YYID (int yyi) -+#else -+static int -+YYID (yyi) -+ int yyi; - #endif --#ifndef YY_INITIAL_VALUE --# define YY_INITIAL_VALUE(Value) /* Nothing. */ -+{ -+ return yyi; -+} - #endif - -- - #if ! defined yyoverflow || YYERROR_VERBOSE - - /* The parser invokes alloca or malloc; define the necessary symbols. */ -@@ -320,9 +297,9 @@ typedef short int yytype_int16; - # define alloca _alloca - # else - # define YYSTACK_ALLOC alloca --# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS -+# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ -+ || defined __cplusplus || defined _MSC_VER) - # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ -- /* Use EXIT_SUCCESS as a witness for stdlib.h. */ - # ifndef EXIT_SUCCESS - # define EXIT_SUCCESS 0 - # endif -@@ -332,8 +309,8 @@ typedef short int yytype_int16; - # endif - - # ifdef YYSTACK_ALLOC -- /* Pacify GCC's 'empty if-body' warning. */ --# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) -+ /* Pacify GCC's `empty if-body' warning. */ -+# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) - # ifndef YYSTACK_ALLOC_MAXIMUM - /* The OS might guarantee only one guard page at the bottom of the stack, - and a page size can be as small as 4096 bytes. So we cannot safely -@@ -349,7 +326,7 @@ typedef short int yytype_int16; - # endif - # if (defined __cplusplus && ! defined EXIT_SUCCESS \ - && ! ((defined YYMALLOC || defined malloc) \ -- && (defined YYFREE || defined free))) -+ && (defined YYFREE || defined free))) - # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ - # ifndef EXIT_SUCCESS - # define EXIT_SUCCESS 0 -@@ -357,13 +334,15 @@ typedef short int yytype_int16; - # endif - # ifndef YYMALLOC - # define YYMALLOC malloc --# if ! defined malloc && ! defined EXIT_SUCCESS -+# if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ -+ || defined __cplusplus || defined _MSC_VER) - void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ - # endif - # endif - # ifndef YYFREE - # define YYFREE free --# if ! defined free && ! defined EXIT_SUCCESS -+# if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ -+ || defined __cplusplus || defined _MSC_VER) - void free (void *); /* INFRINGES ON USER NAME SPACE */ - # endif - # endif -@@ -373,8 +352,8 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */ - - #if (! defined yyoverflow \ - && (! defined __cplusplus \ -- || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \ -- && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) -+ || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \ -+ && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) - - /* A type that is properly aligned for any stack member. */ - union yyalloc -@@ -400,35 +379,35 @@ union yyalloc - elements in the stack, and YYPTR gives the new location of the - stack. Advance YYPTR to a properly aligned location for the next - stack. */ --# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ -- do \ -- { \ -- YYSIZE_T yynewbytes; \ -- YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ -- Stack = &yyptr->Stack_alloc; \ -- yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ -- yyptr += yynewbytes / sizeof (*yyptr); \ -- } \ -- while (0) -+# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ -+ do \ -+ { \ -+ YYSIZE_T yynewbytes; \ -+ YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ -+ Stack = &yyptr->Stack_alloc; \ -+ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ -+ yyptr += yynewbytes / sizeof (*yyptr); \ -+ } \ -+ while (YYID (0)) - - #endif - - #if defined YYCOPY_NEEDED && YYCOPY_NEEDED --/* Copy COUNT objects from SRC to DST. The source and destination do -+/* Copy COUNT objects from FROM to TO. The source and destination do - not overlap. */ - # ifndef YYCOPY - # if defined __GNUC__ && 1 < __GNUC__ --# define YYCOPY(Dst, Src, Count) \ -- __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) -+# define YYCOPY(To, From, Count) \ -+ __builtin_memcpy (To, From, (Count) * sizeof (*(From))) - # else --# define YYCOPY(Dst, Src, Count) \ -- do \ -- { \ -- YYSIZE_T yyi; \ -- for (yyi = 0; yyi < (Count); yyi++) \ -- (Dst)[yyi] = (Src)[yyi]; \ -- } \ -- while (0) -+# define YYCOPY(To, From, Count) \ -+ do \ -+ { \ -+ YYSIZE_T yyi; \ -+ for (yyi = 0; yyi < (Count); yyi++) \ -+ (To)[yyi] = (From)[yyi]; \ -+ } \ -+ while (YYID (0)) - # endif - # endif - #endif /* !YYCOPY_NEEDED */ -@@ -439,39 +418,37 @@ union yyalloc - #define YYLAST 136 - - /* YYNTOKENS -- Number of terminals. */ --#define YYNTOKENS 47 -+#define YYNTOKENS 48 - /* YYNNTS -- Number of nonterminals. */ --#define YYNNTS 28 -+#define YYNNTS 29 - /* YYNRULES -- Number of rules. */ --#define YYNRULES 80 --/* YYNSTATES -- Number of states. */ --#define YYNSTATES 144 -+#define YYNRULES 82 -+/* YYNRULES -- Number of states. */ -+#define YYNSTATES 147 - --/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned -- by yylex, with out-of-bounds checking. */ -+/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ - #define YYUNDEFTOK 2 --#define YYMAXUTOK 278 -+#define YYMAXUTOK 279 - --#define YYTRANSLATE(YYX) \ -+#define YYTRANSLATE(YYX) \ - ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) - --/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM -- as returned by yylex, without out-of-bounds checking. */ -+/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ - static const yytype_uint8 yytranslate[] = - { - 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, -- 2, 2, 2, 46, 2, 2, 2, 44, 40, 2, -- 32, 34, 43, 41, 33, 42, 2, 25, 2, 2, -- 2, 2, 2, 2, 2, 2, 2, 2, 37, 24, -- 35, 28, 29, 36, 2, 2, 2, 2, 2, 2, -+ 2, 2, 2, 47, 2, 2, 2, 45, 41, 2, -+ 33, 35, 44, 42, 34, 43, 2, 26, 2, 2, -+ 2, 2, 2, 2, 2, 2, 2, 2, 38, 25, -+ 36, 29, 30, 37, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, -- 2, 30, 2, 31, 39, 2, 2, 2, 2, 2, -+ 2, 31, 2, 32, 40, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, -- 2, 2, 2, 26, 38, 27, 45, 2, 2, 2, -+ 2, 2, 2, 27, 39, 28, 46, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, -@@ -486,292 +463,335 @@ static const yytype_uint8 yytranslate[] = - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, - 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, -- 15, 16, 17, 18, 19, 20, 21, 22, 23 -+ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24 - }; - - #if YYDEBUG -- /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ -+/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in -+ YYRHS. */ -+static const yytype_uint16 yyprhs[] = -+{ -+ 0, 0, 3, 9, 10, 13, 14, 17, 22, 25, -+ 28, 32, 37, 41, 46, 52, 53, 56, 61, 64, -+ 68, 71, 74, 78, 83, 86, 96, 102, 105, 106, -+ 109, 112, 116, 118, 121, 124, 127, 129, 131, 135, -+ 137, 139, 145, 147, 151, 153, 157, 159, 163, 165, -+ 169, 171, 175, 177, 181, 185, 187, 191, 195, 199, -+ 203, 207, 211, 213, 217, 221, 223, 227, 231, 235, -+ 237, 239, 242, 245, 248, 249, 252, 255, 256, 259, -+ 262, 265, 269 -+}; -+ -+/* YYRHS -- A `-1'-separated list of the rules' RHS. */ -+static const yytype_int8 yyrhs[] = -+{ -+ 49, 0, -1, 3, 25, 50, 51, 53, -1, -1, -+ 4, 25, -1, -1, 52, 51, -1, 5, 60, 60, -+ 25, -1, 22, 52, -1, 26, 54, -1, 53, 26, -+ 54, -1, 53, 22, 23, 54, -1, 53, 23, 54, -+ -1, 53, 16, 23, 25, -1, 27, 55, 75, 28, -+ 25, -1, -1, 55, 56, -1, 17, 29, 57, 25, -+ -1, 17, 25, -1, 15, 17, 25, -1, 22, 56, -+ -1, 58, 21, -1, 58, 59, 30, -1, 58, 31, -+ 74, 32, -1, 58, 23, -1, 58, 24, 33, 21, -+ 34, 60, 34, 60, 35, -1, 58, 24, 33, 21, -+ 35, -1, 57, 22, -1, -1, 57, 34, -1, 58, -+ 22, -1, 14, 18, 36, -1, 36, -1, 59, 60, -+ -1, 59, 23, -1, 59, 22, -1, 18, -1, 19, -+ -1, 33, 61, 35, -1, 62, -1, 63, -1, 63, -+ 37, 61, 38, 62, -1, 64, -1, 63, 13, 64, -+ -1, 65, -1, 64, 12, 65, -1, 66, -1, 65, -+ 39, 66, -1, 67, -1, 66, 40, 67, -1, 68, -+ -1, 67, 41, 68, -1, 69, -1, 68, 10, 69, -+ -1, 68, 11, 69, -1, 70, -1, 69, 36, 70, -+ -1, 69, 30, 70, -1, 69, 8, 70, -1, 69, -+ 9, 70, -1, 70, 6, 71, -1, 70, 7, 71, -+ -1, 71, -1, 71, 42, 72, -1, 71, 43, 72, -+ -1, 72, -1, 72, 44, 73, -1, 72, 26, 73, -+ -1, 72, 45, 73, -1, 73, -1, 60, -1, 43, -+ 73, -1, 46, 73, -1, 47, 73, -1, -1, 74, -+ 20, -1, 74, 22, -1, -1, 76, 75, -1, 76, -+ 56, -1, 17, 54, -1, 16, 17, 25, -1, 22, -+ 76, -1 -+}; -+ -+/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ - static const yytype_uint16 yyrline[] = - { -- 0, 104, 104, 113, 116, 123, 127, 135, 139, 144, -- 155, 165, 180, 188, 191, 198, 202, 206, 210, 218, -- 222, 226, 230, 234, 250, 260, 268, 271, 275, 282, -- 298, 303, 322, 336, 343, 344, 345, 352, 356, 357, -- 361, 362, 366, 367, 371, 372, 376, 377, 381, 382, -- 386, 387, 388, 392, 393, 394, 395, 396, 400, 401, -- 402, 406, 407, 408, 412, 413, 414, 415, 419, 420, -- 421, 422, 427, 430, 434, 442, 445, 449, 457, 461, -- 465 -+ 0, 108, 108, 119, 122, 130, 133, 140, 144, 152, -+ 156, 161, 172, 182, 197, 205, 208, 215, 219, 223, -+ 227, 235, 239, 243, 247, 251, 267, 277, 285, 288, -+ 292, 299, 315, 320, 339, 353, 360, 361, 362, 369, -+ 373, 374, 378, 379, 383, 384, 388, 389, 393, 394, -+ 398, 399, 403, 404, 405, 409, 410, 411, 412, 413, -+ 417, 418, 419, 423, 424, 425, 429, 430, 431, 432, -+ 436, 437, 438, 439, 444, 447, 451, 459, 462, 466, -+ 474, 478, 482 - }; - #endif - --#if YYDEBUG || YYERROR_VERBOSE || 0 -+#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE - /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. - First, the terminals, then, starting at YYNTOKENS, nonterminals. */ - static const char *const yytname[] = - { -- "$end", "error", "$undefined", "DT_V1", "DT_MEMRESERVE", "DT_LSHIFT", -- "DT_RSHIFT", "DT_LE", "DT_GE", "DT_EQ", "DT_NE", "DT_AND", "DT_OR", -- "DT_BITS", "DT_DEL_PROP", "DT_DEL_NODE", "DT_PROPNODENAME", "DT_LITERAL", -- "DT_CHAR_LITERAL", "DT_BYTE", "DT_STRING", "DT_LABEL", "DT_REF", -- "DT_INCBIN", "';'", "'/'", "'{'", "'}'", "'='", "'>'", "'['", "']'", -- "'('", "','", "')'", "'<'", "'?'", "':'", "'|'", "'^'", "'&'", "'+'", -- "'-'", "'*'", "'%'", "'~'", "'!'", "$accept", "sourcefile", -- "memreserves", "memreserve", "devicetree", "nodedef", "proplist", -- "propdef", "propdata", "propdataprefix", "arrayprefix", "integer_prim", -- "integer_expr", "integer_trinary", "integer_or", "integer_and", -- "integer_bitor", "integer_bitxor", "integer_bitand", "integer_eq", -- "integer_rela", "integer_shift", "integer_add", "integer_mul", -- "integer_unary", "bytestring", "subnodes", "subnode", YY_NULLPTR -+ "$end", "error", "$undefined", "DT_V1", "DT_PLUGIN", "DT_MEMRESERVE", -+ "DT_LSHIFT", "DT_RSHIFT", "DT_LE", "DT_GE", "DT_EQ", "DT_NE", "DT_AND", -+ "DT_OR", "DT_BITS", "DT_DEL_PROP", "DT_DEL_NODE", "DT_PROPNODENAME", -+ "DT_LITERAL", "DT_CHAR_LITERAL", "DT_BYTE", "DT_STRING", "DT_LABEL", -+ "DT_REF", "DT_INCBIN", "';'", "'/'", "'{'", "'}'", "'='", "'>'", "'['", -+ "']'", "'('", "','", "')'", "'<'", "'?'", "':'", "'|'", "'^'", "'&'", -+ "'+'", "'-'", "'*'", "'%'", "'~'", "'!'", "$accept", "sourcefile", -+ "plugindecl", "memreserves", "memreserve", "devicetree", "nodedef", -+ "proplist", "propdef", "propdata", "propdataprefix", "arrayprefix", -+ "integer_prim", "integer_expr", "integer_trinary", "integer_or", -+ "integer_and", "integer_bitor", "integer_bitxor", "integer_bitand", -+ "integer_eq", "integer_rela", "integer_shift", "integer_add", -+ "integer_mul", "integer_unary", "bytestring", "subnodes", "subnode", 0 - }; - #endif - - # ifdef YYPRINT --/* YYTOKNUM[NUM] -- (External) token number corresponding to the -- (internal) symbol number NUM (which must be that of a token). */ -+/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to -+ token YYLEX-NUM. */ - static const yytype_uint16 yytoknum[] = - { - 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, - 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, -- 275, 276, 277, 278, 59, 47, 123, 125, 61, 62, -- 91, 93, 40, 44, 41, 60, 63, 58, 124, 94, -- 38, 43, 45, 42, 37, 126, 33 -+ 275, 276, 277, 278, 279, 59, 47, 123, 125, 61, -+ 62, 91, 93, 40, 44, 41, 60, 63, 58, 124, -+ 94, 38, 43, 45, 42, 37, 126, 33 - }; - # endif - --#define YYPACT_NINF -81 -- --#define yypact_value_is_default(Yystate) \ -- (!!((Yystate) == (-81))) -- --#define YYTABLE_NINF -1 -- --#define yytable_value_is_error(Yytable_value) \ -- 0 -- -- /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing -- STATE-NUM. */ --static const yytype_int8 yypact[] = -+/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ -+static const yytype_uint8 yyr1[] = - { -- 16, -11, 21, 10, -81, 25, 10, 19, 10, -81, -- -81, -9, 25, -81, 2, 51, -81, -9, -9, -9, -- -81, 1, -81, -6, 50, 14, 28, 29, 36, 3, -- 58, 44, -3, -81, 47, -81, -81, 65, 68, 2, -- 2, -81, -81, -81, -81, -9, -9, -9, -9, -9, -- -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -- -9, -9, -9, -9, -81, 63, 69, 2, -81, -81, -- 50, 57, 14, 28, 29, 36, 3, 3, 58, 58, -- 58, 58, 44, 44, -3, -3, -81, -81, -81, 79, -- 80, -8, 63, -81, 72, 63, -81, -81, -9, 76, -- 77, -81, -81, -81, -81, -81, 78, -81, -81, -81, -- -81, -81, 35, 4, -81, -81, -81, -81, 86, -81, -- -81, -81, 73, -81, -81, 33, 71, 84, 39, -81, -- -81, -81, -81, -81, 41, -81, -81, -81, 25, -81, -- 74, 25, 75, -81 -+ 0, 48, 49, 50, 50, 51, 51, 52, 52, 53, -+ 53, 53, 53, 53, 54, 55, 55, 56, 56, 56, -+ 56, 57, 57, 57, 57, 57, 57, 57, 58, 58, -+ 58, 59, 59, 59, 59, 59, 60, 60, 60, 61, -+ 62, 62, 63, 63, 64, 64, 65, 65, 66, 66, -+ 67, 67, 68, 68, 68, 69, 69, 69, 69, 69, -+ 70, 70, 70, 71, 71, 71, 72, 72, 72, 72, -+ 73, 73, 73, 73, 74, 74, 74, 75, 75, 75, -+ 76, 76, 76 - }; - -- /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. -- Performed when YYTABLE does not specify something else to do. Zero -- means the default is an error. */ --static const yytype_uint8 yydefact[] = -+/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ -+static const yytype_uint8 yyr2[] = - { -- 0, 0, 0, 3, 1, 0, 0, 0, 3, 34, -- 35, 0, 0, 6, 0, 2, 4, 0, 0, 0, -- 68, 0, 37, 38, 40, 42, 44, 46, 48, 50, -- 53, 60, 63, 67, 0, 13, 7, 0, 0, 0, -- 0, 69, 70, 71, 36, 0, 0, 0, 0, 0, -- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- 0, 0, 0, 0, 5, 75, 0, 0, 10, 8, -- 41, 0, 43, 45, 47, 49, 51, 52, 56, 57, -- 55, 54, 58, 59, 61, 62, 65, 64, 66, 0, -- 0, 0, 0, 14, 0, 75, 11, 9, 0, 0, -- 0, 16, 26, 78, 18, 80, 0, 77, 76, 39, -- 17, 79, 0, 0, 12, 25, 15, 27, 0, 19, -- 28, 22, 0, 72, 30, 0, 0, 0, 0, 33, -- 32, 20, 31, 29, 0, 73, 74, 21, 0, 24, -- 0, 0, 0, 23 -+ 0, 2, 5, 0, 2, 0, 2, 4, 2, 2, -+ 3, 4, 3, 4, 5, 0, 2, 4, 2, 3, -+ 2, 2, 3, 4, 2, 9, 5, 2, 0, 2, -+ 2, 3, 1, 2, 2, 2, 1, 1, 3, 1, -+ 1, 5, 1, 3, 1, 3, 1, 3, 1, 3, -+ 1, 3, 1, 3, 3, 1, 3, 3, 3, 3, -+ 3, 3, 1, 3, 3, 1, 3, 3, 3, 1, -+ 1, 2, 2, 2, 0, 2, 2, 0, 2, 2, -+ 2, 3, 2 - }; - -- /* YYPGOTO[NTERM-NUM]. */ --static const yytype_int8 yypgoto[] = -+/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM. -+ Performed when YYTABLE doesn't specify something else to do. Zero -+ means the default is an error. */ -+static const yytype_uint8 yydefact[] = - { -- -81, -81, 100, 104, -81, -38, -81, -80, -81, -81, -- -81, -5, 66, 13, -81, 70, 67, 81, 64, 82, -- 37, 27, 34, 38, -14, -81, 22, 24 -+ 0, 0, 0, 3, 1, 0, 5, 4, 0, 0, -+ 0, 5, 36, 37, 0, 0, 8, 0, 2, 6, -+ 0, 0, 0, 70, 0, 39, 40, 42, 44, 46, -+ 48, 50, 52, 55, 62, 65, 69, 0, 15, 9, -+ 0, 0, 0, 0, 71, 72, 73, 38, 0, 0, -+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -+ 0, 0, 0, 0, 0, 0, 0, 7, 77, 0, -+ 0, 12, 10, 43, 0, 45, 47, 49, 51, 53, -+ 54, 58, 59, 57, 56, 60, 61, 63, 64, 67, -+ 66, 68, 0, 0, 0, 0, 16, 0, 77, 13, -+ 11, 0, 0, 0, 18, 28, 80, 20, 82, 0, -+ 79, 78, 41, 19, 81, 0, 0, 14, 27, 17, -+ 29, 0, 21, 30, 24, 0, 74, 32, 0, 0, -+ 0, 0, 35, 34, 22, 33, 31, 0, 75, 76, -+ 23, 0, 26, 0, 0, 0, 25 - }; - -- /* YYDEFGOTO[NTERM-NUM]. */ -+/* YYDEFGOTO[NTERM-NUM]. */ - static const yytype_int16 yydefgoto[] = - { -- -1, 2, 7, 8, 15, 36, 65, 93, 112, 113, -- 125, 20, 21, 22, 23, 24, 25, 26, 27, 28, -- 29, 30, 31, 32, 33, 128, 94, 95 -+ -1, 2, 6, 10, 11, 18, 39, 68, 96, 115, -+ 116, 128, 23, 24, 25, 26, 27, 28, 29, 30, -+ 31, 32, 33, 34, 35, 36, 131, 97, 98 - }; - -- /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If -- positive, shift that token. If negative, reduce the rule whose -- number is the opposite. If YYTABLE_NINF, syntax error. */ --static const yytype_uint8 yytable[] = -+/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing -+ STATE-NUM. */ -+#define YYPACT_NINF -84 -+static const yytype_int8 yypact[] = - { -- 12, 68, 69, 41, 42, 43, 45, 34, 9, 10, -- 53, 54, 104, 3, 5, 107, 101, 118, 35, 1, -- 102, 4, 61, 11, 119, 120, 121, 122, 35, 97, -- 46, 6, 55, 17, 123, 44, 18, 19, 56, 124, -- 62, 63, 9, 10, 14, 51, 52, 86, 87, 88, -- 9, 10, 48, 103, 129, 130, 115, 11, 135, 116, -- 136, 47, 131, 57, 58, 11, 37, 49, 117, 50, -- 137, 64, 38, 39, 138, 139, 40, 89, 90, 91, -- 78, 79, 80, 81, 92, 59, 60, 66, 76, 77, -- 67, 82, 83, 96, 98, 99, 100, 84, 85, 106, -- 110, 111, 114, 126, 134, 127, 133, 141, 16, 143, -- 13, 109, 71, 74, 72, 70, 105, 108, 0, 0, -- 132, 0, 0, 0, 0, 0, 0, 0, 0, 73, -- 0, 0, 75, 140, 0, 0, 142 -+ 15, -12, 35, 42, -84, 27, 9, -84, 24, 9, -+ 43, 9, -84, -84, -10, 24, -84, 60, 44, -84, -+ -10, -10, -10, -84, 55, -84, -7, 52, 53, 51, -+ 54, 10, 2, 38, 37, -4, -84, 68, -84, -84, -+ 71, 73, 60, 60, -84, -84, -84, -84, -10, -10, -+ -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -+ -10, -10, -10, -10, -10, -10, -10, -84, 56, 72, -+ 60, -84, -84, 52, 61, 53, 51, 54, 10, 2, -+ 2, 38, 38, 38, 38, 37, 37, -4, -4, -84, -+ -84, -84, 81, 83, 34, 56, -84, 74, 56, -84, -+ -84, -10, 76, 78, -84, -84, -84, -84, -84, 79, -+ -84, -84, -84, -84, -84, -6, 3, -84, -84, -84, -+ -84, 87, -84, -84, -84, 75, -84, -84, 32, 70, -+ 86, 36, -84, -84, -84, -84, -84, 47, -84, -84, -+ -84, 24, -84, 77, 24, 80, -84 - }; - --static const yytype_int16 yycheck[] = -+/* YYPGOTO[NTERM-NUM]. */ -+static const yytype_int8 yypgoto[] = - { -- 5, 39, 40, 17, 18, 19, 12, 12, 17, 18, -- 7, 8, 92, 24, 4, 95, 24, 13, 26, 3, -- 28, 0, 25, 32, 20, 21, 22, 23, 26, 67, -- 36, 21, 29, 42, 30, 34, 45, 46, 35, 35, -- 43, 44, 17, 18, 25, 9, 10, 61, 62, 63, -- 17, 18, 38, 91, 21, 22, 21, 32, 19, 24, -- 21, 11, 29, 5, 6, 32, 15, 39, 33, 40, -- 31, 24, 21, 22, 33, 34, 25, 14, 15, 16, -- 53, 54, 55, 56, 21, 41, 42, 22, 51, 52, -- 22, 57, 58, 24, 37, 16, 16, 59, 60, 27, -- 24, 24, 24, 17, 20, 32, 35, 33, 8, 34, -- 6, 98, 46, 49, 47, 45, 92, 95, -1, -1, -- 125, -1, -1, -1, -1, -1, -1, -1, -1, 48, -- -1, -1, 50, 138, -1, -1, 141 -+ -84, -84, -84, 98, 101, -84, -41, -84, -83, -84, -+ -84, -84, -8, 63, 12, -84, 66, 67, 65, 69, -+ 82, 29, 18, 25, 26, -17, -84, 20, 28 - }; - -- /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing -- symbol of state STATE-NUM. */ --static const yytype_uint8 yystos[] = -+/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If -+ positive, shift that token. If negative, reduce the rule which -+ number is the opposite. If YYTABLE_NINF, syntax error. */ -+#define YYTABLE_NINF -1 -+static const yytype_uint8 yytable[] = - { -- 0, 3, 48, 24, 0, 4, 21, 49, 50, 17, -- 18, 32, 58, 50, 25, 51, 49, 42, 45, 46, -- 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, -- 68, 69, 70, 71, 58, 26, 52, 15, 21, 22, -- 25, 71, 71, 71, 34, 12, 36, 11, 38, 39, -- 40, 9, 10, 7, 8, 29, 35, 5, 6, 41, -- 42, 25, 43, 44, 24, 53, 22, 22, 52, 52, -- 62, 59, 63, 64, 65, 66, 67, 67, 68, 68, -- 68, 68, 69, 69, 70, 70, 71, 71, 71, 14, -- 15, 16, 21, 54, 73, 74, 24, 52, 37, 16, -- 16, 24, 28, 52, 54, 74, 27, 54, 73, 60, -- 24, 24, 55, 56, 24, 21, 24, 33, 13, 20, -- 21, 22, 23, 30, 35, 57, 17, 32, 72, 21, -- 22, 29, 58, 35, 20, 19, 21, 31, 33, 34, -- 58, 33, 58, 34 -+ 15, 71, 72, 44, 45, 46, 48, 37, 12, 13, -+ 56, 57, 107, 3, 8, 110, 118, 121, 1, 119, -+ 54, 55, 64, 14, 122, 123, 124, 125, 120, 100, -+ 49, 9, 58, 20, 126, 4, 21, 22, 59, 127, -+ 65, 66, 12, 13, 60, 61, 5, 89, 90, 91, -+ 12, 13, 7, 106, 132, 133, 138, 14, 139, 104, -+ 40, 38, 134, 105, 50, 14, 41, 42, 140, 17, -+ 43, 92, 93, 94, 81, 82, 83, 84, 95, 62, -+ 63, 141, 142, 79, 80, 85, 86, 38, 87, 88, -+ 47, 52, 51, 67, 69, 53, 70, 99, 102, 101, -+ 103, 113, 109, 114, 117, 129, 136, 137, 130, 19, -+ 16, 144, 74, 112, 73, 146, 76, 75, 111, 0, -+ 135, 77, 0, 108, 0, 0, 0, 0, 0, 0, -+ 0, 0, 0, 143, 0, 78, 145 - }; - -- /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ --static const yytype_uint8 yyr1[] = -+#define yypact_value_is_default(yystate) \ -+ ((yystate) == (-84)) -+ -+#define yytable_value_is_error(yytable_value) \ -+ YYID (0) -+ -+static const yytype_int16 yycheck[] = - { -- 0, 47, 48, 49, 49, 50, 50, 51, 51, 51, -- 51, 51, 52, 53, 53, 54, 54, 54, 54, 55, -- 55, 55, 55, 55, 55, 55, 56, 56, 56, 57, -- 57, 57, 57, 57, 58, 58, 58, 59, 60, 60, -- 61, 61, 62, 62, 63, 63, 64, 64, 65, 65, -- 66, 66, 66, 67, 67, 67, 67, 67, 68, 68, -- 68, 69, 69, 69, 70, 70, 70, 70, 71, 71, -- 71, 71, 72, 72, 72, 73, 73, 73, 74, 74, -- 74 -+ 8, 42, 43, 20, 21, 22, 13, 15, 18, 19, -+ 8, 9, 95, 25, 5, 98, 22, 14, 3, 25, -+ 10, 11, 26, 33, 21, 22, 23, 24, 34, 70, -+ 37, 22, 30, 43, 31, 0, 46, 47, 36, 36, -+ 44, 45, 18, 19, 6, 7, 4, 64, 65, 66, -+ 18, 19, 25, 94, 22, 23, 20, 33, 22, 25, -+ 16, 27, 30, 29, 12, 33, 22, 23, 32, 26, -+ 26, 15, 16, 17, 56, 57, 58, 59, 22, 42, -+ 43, 34, 35, 54, 55, 60, 61, 27, 62, 63, -+ 35, 40, 39, 25, 23, 41, 23, 25, 17, 38, -+ 17, 25, 28, 25, 25, 18, 36, 21, 33, 11, -+ 9, 34, 49, 101, 48, 35, 51, 50, 98, -1, -+ 128, 52, -1, 95, -1, -1, -1, -1, -1, -1, -+ -1, -1, -1, 141, -1, 53, 144 - }; - -- /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ --static const yytype_uint8 yyr2[] = -+/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing -+ symbol of state STATE-NUM. */ -+static const yytype_uint8 yystos[] = - { -- 0, 2, 4, 0, 2, 4, 2, 2, 3, 4, -- 3, 4, 5, 0, 2, 4, 2, 3, 2, 2, -- 3, 4, 2, 9, 5, 2, 0, 2, 2, 3, -- 1, 2, 2, 2, 1, 1, 3, 1, 1, 5, -- 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, -- 1, 3, 3, 1, 3, 3, 3, 3, 3, 3, -- 1, 3, 3, 1, 3, 3, 3, 1, 1, 2, -- 2, 2, 0, 2, 2, 0, 2, 2, 2, 3, -- 2 -+ 0, 3, 49, 25, 0, 4, 50, 25, 5, 22, -+ 51, 52, 18, 19, 33, 60, 52, 26, 53, 51, -+ 43, 46, 47, 60, 61, 62, 63, 64, 65, 66, -+ 67, 68, 69, 70, 71, 72, 73, 60, 27, 54, -+ 16, 22, 23, 26, 73, 73, 73, 35, 13, 37, -+ 12, 39, 40, 41, 10, 11, 8, 9, 30, 36, -+ 6, 7, 42, 43, 26, 44, 45, 25, 55, 23, -+ 23, 54, 54, 64, 61, 65, 66, 67, 68, 69, -+ 69, 70, 70, 70, 70, 71, 71, 72, 72, 73, -+ 73, 73, 15, 16, 17, 22, 56, 75, 76, 25, -+ 54, 38, 17, 17, 25, 29, 54, 56, 76, 28, -+ 56, 75, 62, 25, 25, 57, 58, 25, 22, 25, -+ 34, 14, 21, 22, 23, 24, 31, 36, 59, 18, -+ 33, 74, 22, 23, 30, 60, 36, 21, 20, 22, -+ 32, 34, 35, 60, 34, 60, 35 - }; - -- --#define yyerrok (yyerrstatus = 0) --#define yyclearin (yychar = YYEMPTY) --#define YYEMPTY (-2) --#define YYEOF 0 -- --#define YYACCEPT goto yyacceptlab --#define YYABORT goto yyabortlab --#define YYERROR goto yyerrorlab -- -+#define yyerrok (yyerrstatus = 0) -+#define yyclearin (yychar = YYEMPTY) -+#define YYEMPTY (-2) -+#define YYEOF 0 -+ -+#define YYACCEPT goto yyacceptlab -+#define YYABORT goto yyabortlab -+#define YYERROR goto yyerrorlab -+ -+ -+/* Like YYERROR except do call yyerror. This remains here temporarily -+ to ease the transition to the new meaning of YYERROR, for GCC. -+ Once GCC version 2 has supplanted version 1, this can go. However, -+ YYFAIL appears to be in use. Nevertheless, it is formally deprecated -+ in Bison 2.4.2's NEWS entry, where a plan to phase it out is -+ discussed. */ -+ -+#define YYFAIL goto yyerrlab -+#if defined YYFAIL -+ /* This is here to suppress warnings from the GCC cpp's -+ -Wunused-macros. Normally we don't worry about that warning, but -+ some users do, and we want to make it easy for users to remove -+ YYFAIL uses, which will produce warnings from Bison 2.5. */ -+#endif - - #define YYRECOVERING() (!!yyerrstatus) - --#define YYBACKUP(Token, Value) \ --do \ -- if (yychar == YYEMPTY) \ -- { \ -- yychar = (Token); \ -- yylval = (Value); \ -- YYPOPSTACK (yylen); \ -- yystate = *yyssp; \ -- goto yybackup; \ -- } \ -- else \ -- { \ -+#define YYBACKUP(Token, Value) \ -+do \ -+ if (yychar == YYEMPTY && yylen == 1) \ -+ { \ -+ yychar = (Token); \ -+ yylval = (Value); \ -+ YYPOPSTACK (1); \ -+ goto yybackup; \ -+ } \ -+ else \ -+ { \ - yyerror (YY_("syntax error: cannot back up")); \ -- YYERROR; \ -- } \ --while (0) -+ YYERROR; \ -+ } \ -+while (YYID (0)) -+ - --/* Error token number */ --#define YYTERROR 1 --#define YYERRCODE 256 -+#define YYTERROR 1 -+#define YYERRCODE 256 - - - /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. - If N is 0, then set CURRENT to the empty location which ends - the previous symbol: RHS[0] (always defined). */ - -+#define YYRHSLOC(Rhs, K) ((Rhs)[K]) - #ifndef YYLLOC_DEFAULT --# define YYLLOC_DEFAULT(Current, Rhs, N) \ -- do \ -- if (N) \ -- { \ -- (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ -- (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ -- (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ -- (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ -- } \ -- else \ -- { \ -- (Current).first_line = (Current).last_line = \ -- YYRHSLOC (Rhs, 0).last_line; \ -- (Current).first_column = (Current).last_column = \ -- YYRHSLOC (Rhs, 0).last_column; \ -- } \ -- while (0) -+# define YYLLOC_DEFAULT(Current, Rhs, N) \ -+ do \ -+ if (YYID (N)) \ -+ { \ -+ (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ -+ (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ -+ (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ -+ (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ -+ } \ -+ else \ -+ { \ -+ (Current).first_line = (Current).last_line = \ -+ YYRHSLOC (Rhs, 0).last_line; \ -+ (Current).first_column = (Current).last_column = \ -+ YYRHSLOC (Rhs, 0).last_column; \ -+ } \ -+ while (YYID (0)) - #endif - --#define YYRHSLOC(Rhs, K) ((Rhs)[K]) -- -- --/* Enable debugging if requested. */ --#if YYDEBUG -- --# ifndef YYFPRINTF --# include <stdio.h> /* INFRINGES ON USER NAME SPACE */ --# define YYFPRINTF fprintf --# endif -- --# define YYDPRINTF(Args) \ --do { \ -- if (yydebug) \ -- YYFPRINTF Args; \ --} while (0) -- - - /* YY_LOCATION_PRINT -- Print the location on the stream. - This macro was not mandated originally: define only if we know -@@ -779,73 +799,82 @@ do { \ - - #ifndef YY_LOCATION_PRINT - # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL -+# define YY_LOCATION_PRINT(File, Loc) \ -+ fprintf (File, "%d.%d-%d.%d", \ -+ (Loc).first_line, (Loc).first_column, \ -+ (Loc).last_line, (Loc).last_column) -+# else -+# define YY_LOCATION_PRINT(File, Loc) ((void) 0) -+# endif -+#endif - --/* Print *YYLOCP on YYO. Private, do not rely on its existence. */ - --YY_ATTRIBUTE_UNUSED --static unsigned --yy_location_print_ (FILE *yyo, YYLTYPE const * const yylocp) --{ -- unsigned res = 0; -- int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; -- if (0 <= yylocp->first_line) -- { -- res += YYFPRINTF (yyo, "%d", yylocp->first_line); -- if (0 <= yylocp->first_column) -- res += YYFPRINTF (yyo, ".%d", yylocp->first_column); -- } -- if (0 <= yylocp->last_line) -- { -- if (yylocp->first_line < yylocp->last_line) -- { -- res += YYFPRINTF (yyo, "-%d", yylocp->last_line); -- if (0 <= end_col) -- res += YYFPRINTF (yyo, ".%d", end_col); -- } -- else if (0 <= end_col && yylocp->first_column < end_col) -- res += YYFPRINTF (yyo, "-%d", end_col); -- } -- return res; -- } -+/* YYLEX -- calling `yylex' with the right arguments. */ - --# define YY_LOCATION_PRINT(File, Loc) \ -- yy_location_print_ (File, &(Loc)) -+#ifdef YYLEX_PARAM -+# define YYLEX yylex (YYLEX_PARAM) -+#else -+# define YYLEX yylex () -+#endif - --# else --# define YY_LOCATION_PRINT(File, Loc) ((void) 0) -+/* Enable debugging if requested. */ -+#if YYDEBUG -+ -+# ifndef YYFPRINTF -+# include <stdio.h> /* INFRINGES ON USER NAME SPACE */ -+# define YYFPRINTF fprintf - # endif --#endif - -+# define YYDPRINTF(Args) \ -+do { \ -+ if (yydebug) \ -+ YYFPRINTF Args; \ -+} while (YYID (0)) - --# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ --do { \ -- if (yydebug) \ -- { \ -- YYFPRINTF (stderr, "%s ", Title); \ -- yy_symbol_print (stderr, \ -- Type, Value, Location); \ -- YYFPRINTF (stderr, "\n"); \ -- } \ --} while (0) -+# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ -+do { \ -+ if (yydebug) \ -+ { \ -+ YYFPRINTF (stderr, "%s ", Title); \ -+ yy_symbol_print (stderr, \ -+ Type, Value, Location); \ -+ YYFPRINTF (stderr, "\n"); \ -+ } \ -+} while (YYID (0)) - - --/*----------------------------------------. --| Print this symbol's value on YYOUTPUT. | --`----------------------------------------*/ -+/*--------------------------------. -+| Print this symbol on YYOUTPUT. | -+`--------------------------------*/ - -+/*ARGSUSED*/ -+#if (defined __STDC__ || defined __C99__FUNC__ \ -+ || defined __cplusplus || defined _MSC_VER) - static void - yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp) -+#else -+static void -+yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp) -+ FILE *yyoutput; -+ int yytype; -+ YYSTYPE const * const yyvaluep; -+ YYLTYPE const * const yylocationp; -+#endif - { -- FILE *yyo = yyoutput; -- YYUSE (yyo); -- YYUSE (yylocationp); - if (!yyvaluep) - return; -+ YYUSE (yylocationp); - # ifdef YYPRINT - if (yytype < YYNTOKENS) - YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); -+# else -+ YYUSE (yyoutput); - # endif -- YYUSE (yytype); -+ switch (yytype) -+ { -+ default: -+ break; -+ } - } - - -@@ -853,11 +882,23 @@ yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvalue - | Print this symbol on YYOUTPUT. | - `--------------------------------*/ - -+#if (defined __STDC__ || defined __C99__FUNC__ \ -+ || defined __cplusplus || defined _MSC_VER) - static void - yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp) -+#else -+static void -+yy_symbol_print (yyoutput, yytype, yyvaluep, yylocationp) -+ FILE *yyoutput; -+ int yytype; -+ YYSTYPE const * const yyvaluep; -+ YYLTYPE const * const yylocationp; -+#endif - { -- YYFPRINTF (yyoutput, "%s %s (", -- yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); -+ if (yytype < YYNTOKENS) -+ YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); -+ else -+ YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); - - YY_LOCATION_PRINT (yyoutput, *yylocationp); - YYFPRINTF (yyoutput, ": "); -@@ -870,8 +911,16 @@ yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYL - | TOP (included). | - `------------------------------------------------------------------*/ - -+#if (defined __STDC__ || defined __C99__FUNC__ \ -+ || defined __cplusplus || defined _MSC_VER) - static void - yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) -+#else -+static void -+yy_stack_print (yybottom, yytop) -+ yytype_int16 *yybottom; -+ yytype_int16 *yytop; -+#endif - { - YYFPRINTF (stderr, "Stack now"); - for (; yybottom <= yytop; yybottom++) -@@ -882,42 +931,50 @@ yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) - YYFPRINTF (stderr, "\n"); - } - --# define YY_STACK_PRINT(Bottom, Top) \ --do { \ -- if (yydebug) \ -- yy_stack_print ((Bottom), (Top)); \ --} while (0) -+# define YY_STACK_PRINT(Bottom, Top) \ -+do { \ -+ if (yydebug) \ -+ yy_stack_print ((Bottom), (Top)); \ -+} while (YYID (0)) - - - /*------------------------------------------------. - | Report that the YYRULE is going to be reduced. | - `------------------------------------------------*/ - -+#if (defined __STDC__ || defined __C99__FUNC__ \ -+ || defined __cplusplus || defined _MSC_VER) -+static void -+yy_reduce_print (YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule) -+#else - static void --yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule) -+yy_reduce_print (yyvsp, yylsp, yyrule) -+ YYSTYPE *yyvsp; -+ YYLTYPE *yylsp; -+ int yyrule; -+#endif - { -- unsigned long int yylno = yyrline[yyrule]; - int yynrhs = yyr2[yyrule]; - int yyi; -+ unsigned long int yylno = yyrline[yyrule]; - YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", -- yyrule - 1, yylno); -+ yyrule - 1, yylno); - /* The symbols being reduced. */ - for (yyi = 0; yyi < yynrhs; yyi++) - { - YYFPRINTF (stderr, " $%d = ", yyi + 1); -- yy_symbol_print (stderr, -- yystos[yyssp[yyi + 1 - yynrhs]], -- &(yyvsp[(yyi + 1) - (yynrhs)]) -- , &(yylsp[(yyi + 1) - (yynrhs)]) ); -+ yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], -+ &(yyvsp[(yyi + 1) - (yynrhs)]) -+ , &(yylsp[(yyi + 1) - (yynrhs)]) ); - YYFPRINTF (stderr, "\n"); - } - } - --# define YY_REDUCE_PRINT(Rule) \ --do { \ -- if (yydebug) \ -- yy_reduce_print (yyssp, yyvsp, yylsp, Rule); \ --} while (0) -+# define YY_REDUCE_PRINT(Rule) \ -+do { \ -+ if (yydebug) \ -+ yy_reduce_print (yyvsp, yylsp, Rule); \ -+} while (YYID (0)) - - /* Nonzero means print parse trace. It is left uninitialized so that - multiple parsers can coexist. */ -@@ -931,7 +988,7 @@ int yydebug; - - - /* YYINITDEPTH -- initial size of the parser's stacks. */ --#ifndef YYINITDEPTH -+#ifndef YYINITDEPTH - # define YYINITDEPTH 200 - #endif - -@@ -954,8 +1011,15 @@ int yydebug; - # define yystrlen strlen - # else - /* Return the length of YYSTR. */ -+#if (defined __STDC__ || defined __C99__FUNC__ \ -+ || defined __cplusplus || defined _MSC_VER) - static YYSIZE_T - yystrlen (const char *yystr) -+#else -+static YYSIZE_T -+yystrlen (yystr) -+ const char *yystr; -+#endif - { - YYSIZE_T yylen; - for (yylen = 0; yystr[yylen]; yylen++) -@@ -971,8 +1035,16 @@ yystrlen (const char *yystr) - # else - /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in - YYDEST. */ -+#if (defined __STDC__ || defined __C99__FUNC__ \ -+ || defined __cplusplus || defined _MSC_VER) - static char * - yystpcpy (char *yydest, const char *yysrc) -+#else -+static char * -+yystpcpy (yydest, yysrc) -+ char *yydest; -+ const char *yysrc; -+#endif - { - char *yyd = yydest; - const char *yys = yysrc; -@@ -1002,27 +1074,27 @@ yytnamerr (char *yyres, const char *yystr) - char const *yyp = yystr; - - for (;;) -- switch (*++yyp) -- { -- case '\'': -- case ',': -- goto do_not_strip_quotes; -- -- case '\\': -- if (*++yyp != '\\') -- goto do_not_strip_quotes; -- /* Fall through. */ -- default: -- if (yyres) -- yyres[yyn] = *yyp; -- yyn++; -- break; -- -- case '"': -- if (yyres) -- yyres[yyn] = '\0'; -- return yyn; -- } -+ switch (*++yyp) -+ { -+ case '\'': -+ case ',': -+ goto do_not_strip_quotes; -+ -+ case '\\': -+ if (*++yyp != '\\') -+ goto do_not_strip_quotes; -+ /* Fall through. */ -+ default: -+ if (yyres) -+ yyres[yyn] = *yyp; -+ yyn++; -+ break; -+ -+ case '"': -+ if (yyres) -+ yyres[yyn] = '\0'; -+ return yyn; -+ } - do_not_strip_quotes: ; - } - -@@ -1045,11 +1117,12 @@ static int - yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, - yytype_int16 *yyssp, int yytoken) - { -- YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); -+ YYSIZE_T yysize0 = yytnamerr (0, yytname[yytoken]); - YYSIZE_T yysize = yysize0; -+ YYSIZE_T yysize1; - enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; - /* Internationalized format string. */ -- const char *yyformat = YY_NULLPTR; -+ const char *yyformat = 0; - /* Arguments of yyformat. */ - char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; - /* Number of reported tokens (one for the "unexpected", one per -@@ -1057,6 +1130,10 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, - int yycount = 0; - - /* There are many possibilities here to consider: -+ - Assume YYFAIL is not used. It's too flawed to consider. See -+ <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html> -+ for details. YYERROR is fine as it does not invoke this -+ function. - - If this state is a consistent state with a default action, then - the only way this function was invoked is if the default action - is an error action. In that case, don't check for expected -@@ -1105,13 +1182,11 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, - break; - } - yyarg[yycount++] = yytname[yyx]; -- { -- YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); -- if (! (yysize <= yysize1 -- && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) -- return 2; -- yysize = yysize1; -- } -+ yysize1 = yysize + yytnamerr (0, yytname[yyx]); -+ if (! (yysize <= yysize1 -+ && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) -+ return 2; -+ yysize = yysize1; - } - } - } -@@ -1131,12 +1206,10 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, - # undef YYCASE_ - } - -- { -- YYSIZE_T yysize1 = yysize + yystrlen (yyformat); -- if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) -- return 2; -- yysize = yysize1; -- } -+ yysize1 = yysize + yystrlen (yyformat); -+ if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) -+ return 2; -+ yysize = yysize1; - - if (*yymsg_alloc < yysize) - { -@@ -1173,21 +1246,50 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, - | Release the memory associated to this symbol. | - `-----------------------------------------------*/ - -+/*ARGSUSED*/ -+#if (defined __STDC__ || defined __C99__FUNC__ \ -+ || defined __cplusplus || defined _MSC_VER) - static void - yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp) -+#else -+static void -+yydestruct (yymsg, yytype, yyvaluep, yylocationp) -+ const char *yymsg; -+ int yytype; -+ YYSTYPE *yyvaluep; -+ YYLTYPE *yylocationp; -+#endif - { - YYUSE (yyvaluep); - YYUSE (yylocationp); -+ - if (!yymsg) - yymsg = "Deleting"; - YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); - -- YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN -- YYUSE (yytype); -- YY_IGNORE_MAYBE_UNINITIALIZED_END -+ switch (yytype) -+ { -+ -+ default: -+ break; -+ } - } - - -+/* Prevent warnings from -Wmissing-prototypes. */ -+#ifdef YYPARSE_PARAM -+#if defined __STDC__ || defined __cplusplus -+int yyparse (void *YYPARSE_PARAM); -+#else -+int yyparse (); -+#endif -+#else /* ! YYPARSE_PARAM */ -+#if defined __STDC__ || defined __cplusplus -+int yyparse (void); -+#else -+int yyparse (); -+#endif -+#endif /* ! YYPARSE_PARAM */ - - - /* The lookahead symbol. */ -@@ -1195,12 +1297,10 @@ int yychar; - - /* The semantic value of the lookahead symbol. */ - YYSTYPE yylval; -+ - /* Location data for the lookahead symbol. */ --YYLTYPE yylloc --# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL -- = { 1, 1, 1, 1 } --# endif --; -+YYLTYPE yylloc; -+ - /* Number of syntax errors so far. */ - int yynerrs; - -@@ -1209,19 +1309,38 @@ int yynerrs; - | yyparse. | - `----------*/ - -+#ifdef YYPARSE_PARAM -+#if (defined __STDC__ || defined __C99__FUNC__ \ -+ || defined __cplusplus || defined _MSC_VER) -+int -+yyparse (void *YYPARSE_PARAM) -+#else -+int -+yyparse (YYPARSE_PARAM) -+ void *YYPARSE_PARAM; -+#endif -+#else /* ! YYPARSE_PARAM */ -+#if (defined __STDC__ || defined __C99__FUNC__ \ -+ || defined __cplusplus || defined _MSC_VER) - int - yyparse (void) -+#else -+int -+yyparse () -+ -+#endif -+#endif - { - int yystate; - /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus; - - /* The stacks and their tools: -- 'yyss': related to states. -- 'yyvs': related to semantic values. -- 'yyls': related to locations. -+ `yyss': related to states. -+ `yyvs': related to semantic values. -+ `yyls': related to locations. - -- Refer to the stacks through separate pointers, to allow yyoverflow -+ Refer to the stacks thru separate pointers, to allow yyoverflow - to reallocate them elsewhere. */ - - /* The state stack. */ -@@ -1247,7 +1366,7 @@ yyparse (void) - int yyn; - int yyresult; - /* Lookahead token as an internal (translated) token number. */ -- int yytoken = 0; -+ int yytoken; - /* The variables used to return semantic value and location from the - action routines. */ - YYSTYPE yyval; -@@ -1266,9 +1385,10 @@ yyparse (void) - Keep to zero when no symbol should be popped. */ - int yylen = 0; - -- yyssp = yyss = yyssa; -- yyvsp = yyvs = yyvsa; -- yylsp = yyls = yylsa; -+ yytoken = 0; -+ yyss = yyssa; -+ yyvs = yyvsa; -+ yyls = yylsa; - yystacksize = YYINITDEPTH; - - YYDPRINTF ((stderr, "Starting parse\n")); -@@ -1277,7 +1397,21 @@ yyparse (void) - yyerrstatus = 0; - yynerrs = 0; - yychar = YYEMPTY; /* Cause a token to be read. */ -- yylsp[0] = yylloc; -+ -+ /* Initialize stack pointers. -+ Waste one element of value and location stack -+ so that they stay on the same level as the state stack. -+ The wasted elements are never initialized. */ -+ yyssp = yyss; -+ yyvsp = yyvs; -+ yylsp = yyls; -+ -+#if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL -+ /* Initialize the default location before parsing starts. */ -+ yylloc.first_line = yylloc.last_line = 1; -+ yylloc.first_column = yylloc.last_column = 1; -+#endif -+ - goto yysetstate; - - /*------------------------------------------------------------. -@@ -1298,26 +1432,26 @@ yyparse (void) - - #ifdef yyoverflow - { -- /* Give user a chance to reallocate the stack. Use copies of -- these so that the &'s don't force the real ones into -- memory. */ -- YYSTYPE *yyvs1 = yyvs; -- yytype_int16 *yyss1 = yyss; -- YYLTYPE *yyls1 = yyls; -- -- /* Each stack pointer address is followed by the size of the -- data in use in that stack, in bytes. This used to be a -- conditional around just the two extra args, but that might -- be undefined if yyoverflow is a macro. */ -- yyoverflow (YY_("memory exhausted"), -- &yyss1, yysize * sizeof (*yyssp), -- &yyvs1, yysize * sizeof (*yyvsp), -- &yyls1, yysize * sizeof (*yylsp), -- &yystacksize); -- -- yyls = yyls1; -- yyss = yyss1; -- yyvs = yyvs1; -+ /* Give user a chance to reallocate the stack. Use copies of -+ these so that the &'s don't force the real ones into -+ memory. */ -+ YYSTYPE *yyvs1 = yyvs; -+ yytype_int16 *yyss1 = yyss; -+ YYLTYPE *yyls1 = yyls; -+ -+ /* Each stack pointer address is followed by the size of the -+ data in use in that stack, in bytes. This used to be a -+ conditional around just the two extra args, but that might -+ be undefined if yyoverflow is a macro. */ -+ yyoverflow (YY_("memory exhausted"), -+ &yyss1, yysize * sizeof (*yyssp), -+ &yyvs1, yysize * sizeof (*yyvsp), -+ &yyls1, yysize * sizeof (*yylsp), -+ &yystacksize); -+ -+ yyls = yyls1; -+ yyss = yyss1; -+ yyvs = yyvs1; - } - #else /* no yyoverflow */ - # ifndef YYSTACK_RELOCATE -@@ -1325,23 +1459,23 @@ yyparse (void) - # else - /* Extend the stack our own way. */ - if (YYMAXDEPTH <= yystacksize) -- goto yyexhaustedlab; -+ goto yyexhaustedlab; - yystacksize *= 2; - if (YYMAXDEPTH < yystacksize) -- yystacksize = YYMAXDEPTH; -+ yystacksize = YYMAXDEPTH; - - { -- yytype_int16 *yyss1 = yyss; -- union yyalloc *yyptr = -- (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); -- if (! yyptr) -- goto yyexhaustedlab; -- YYSTACK_RELOCATE (yyss_alloc, yyss); -- YYSTACK_RELOCATE (yyvs_alloc, yyvs); -- YYSTACK_RELOCATE (yyls_alloc, yyls); -+ yytype_int16 *yyss1 = yyss; -+ union yyalloc *yyptr = -+ (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); -+ if (! yyptr) -+ goto yyexhaustedlab; -+ YYSTACK_RELOCATE (yyss_alloc, yyss); -+ YYSTACK_RELOCATE (yyvs_alloc, yyvs); -+ YYSTACK_RELOCATE (yyls_alloc, yyls); - # undef YYSTACK_RELOCATE -- if (yyss1 != yyssa) -- YYSTACK_FREE (yyss1); -+ if (yyss1 != yyssa) -+ YYSTACK_FREE (yyss1); - } - # endif - #endif /* no yyoverflow */ -@@ -1351,10 +1485,10 @@ yyparse (void) - yylsp = yyls + yysize - 1; - - YYDPRINTF ((stderr, "Stack size increased to %lu\n", -- (unsigned long int) yystacksize)); -+ (unsigned long int) yystacksize)); - - if (yyss + yystacksize - 1 <= yyssp) -- YYABORT; -+ YYABORT; - } - - YYDPRINTF ((stderr, "Entering state %d\n", yystate)); -@@ -1383,7 +1517,7 @@ yybackup: - if (yychar == YYEMPTY) - { - YYDPRINTF ((stderr, "Reading a token: ")); -- yychar = yylex (); -+ yychar = YYLEX; - } - - if (yychar <= YYEOF) -@@ -1423,9 +1557,7 @@ yybackup: - yychar = YYEMPTY; - - yystate = yyn; -- YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN - *++yyvsp = yylval; -- YY_IGNORE_MAYBE_UNINITIALIZED_END - *++yylsp = yylloc; - goto yynewstate; - -@@ -1448,7 +1580,7 @@ yyreduce: - yylen = yyr2[yyn]; - - /* If YYLEN is nonzero, implement the default value of the action: -- '$$ = $1'. -+ `$$ = $1'. - - Otherwise, the following line sets YYVAL to garbage. - This behavior is undocumented and Bison -@@ -1463,273 +1595,322 @@ yyreduce: - switch (yyn) - { - case 2: --#line 105 "dtc-parser.y" /* yacc.c:1646 */ -+ -+/* Line 1806 of yacc.c */ -+#line 109 "dtc-parser.y" - { -- the_boot_info = build_boot_info((yyvsp[-1].re), (yyvsp[0].node), -- guess_boot_cpuid((yyvsp[0].node))); -+ (yyvsp[(5) - (5)].node)->is_plugin = (yyvsp[(3) - (5)].is_plugin); -+ (yyvsp[(5) - (5)].node)->is_root = 1; -+ the_boot_info = build_boot_info((yyvsp[(4) - (5)].re), (yyvsp[(5) - (5)].node), -+ guess_boot_cpuid((yyvsp[(5) - (5)].node))); - } --#line 1472 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - - case 3: --#line 113 "dtc-parser.y" /* yacc.c:1646 */ -+ -+/* Line 1806 of yacc.c */ -+#line 119 "dtc-parser.y" - { -- (yyval.re) = NULL; -+ (yyval.is_plugin) = 0; - } --#line 1480 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - - case 4: --#line 117 "dtc-parser.y" /* yacc.c:1646 */ -+ -+/* Line 1806 of yacc.c */ -+#line 123 "dtc-parser.y" - { -- (yyval.re) = chain_reserve_entry((yyvsp[-1].re), (yyvsp[0].re)); -+ (yyval.is_plugin) = 1; - } --#line 1488 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - - case 5: --#line 124 "dtc-parser.y" /* yacc.c:1646 */ -+ -+/* Line 1806 of yacc.c */ -+#line 130 "dtc-parser.y" - { -- (yyval.re) = build_reserve_entry((yyvsp[-2].integer), (yyvsp[-1].integer)); -+ (yyval.re) = NULL; - } --#line 1496 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - - case 6: --#line 128 "dtc-parser.y" /* yacc.c:1646 */ -+ -+/* Line 1806 of yacc.c */ -+#line 134 "dtc-parser.y" - { -- add_label(&(yyvsp[0].re)->labels, (yyvsp[-1].labelref)); -- (yyval.re) = (yyvsp[0].re); -+ (yyval.re) = chain_reserve_entry((yyvsp[(1) - (2)].re), (yyvsp[(2) - (2)].re)); - } --#line 1505 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - - case 7: --#line 136 "dtc-parser.y" /* yacc.c:1646 */ -+ -+/* Line 1806 of yacc.c */ -+#line 141 "dtc-parser.y" - { -- (yyval.node) = name_node((yyvsp[0].node), ""); -+ (yyval.re) = build_reserve_entry((yyvsp[(2) - (4)].integer), (yyvsp[(3) - (4)].integer)); - } --#line 1513 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - - case 8: --#line 140 "dtc-parser.y" /* yacc.c:1646 */ -+ -+/* Line 1806 of yacc.c */ -+#line 145 "dtc-parser.y" - { -- (yyval.node) = merge_nodes((yyvsp[-2].node), (yyvsp[0].node)); -+ add_label(&(yyvsp[(2) - (2)].re)->labels, (yyvsp[(1) - (2)].labelref)); -+ (yyval.re) = (yyvsp[(2) - (2)].re); - } --#line 1521 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - - case 9: --#line 145 "dtc-parser.y" /* yacc.c:1646 */ -- { -- struct node *target = get_node_by_ref((yyvsp[-3].node), (yyvsp[-1].labelref)); - -- add_label(&target->labels, (yyvsp[-2].labelref)); -- if (target) -- merge_nodes(target, (yyvsp[0].node)); -- else -- ERROR(&(yylsp[-1]), "Label or path %s not found", (yyvsp[-1].labelref)); -- (yyval.node) = (yyvsp[-3].node); -+/* Line 1806 of yacc.c */ -+#line 153 "dtc-parser.y" -+ { -+ (yyval.node) = name_node((yyvsp[(2) - (2)].node), ""); - } --#line 1536 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - - case 10: --#line 156 "dtc-parser.y" /* yacc.c:1646 */ -- { -- struct node *target = get_node_by_ref((yyvsp[-2].node), (yyvsp[-1].labelref)); - -- if (target) -- merge_nodes(target, (yyvsp[0].node)); -- else -- ERROR(&(yylsp[-1]), "Label or path %s not found", (yyvsp[-1].labelref)); -- (yyval.node) = (yyvsp[-2].node); -+/* Line 1806 of yacc.c */ -+#line 157 "dtc-parser.y" -+ { -+ (yyval.node) = merge_nodes((yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); - } --#line 1550 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - - case 11: --#line 166 "dtc-parser.y" /* yacc.c:1646 */ -+ -+/* Line 1806 of yacc.c */ -+#line 162 "dtc-parser.y" - { -- struct node *target = get_node_by_ref((yyvsp[-3].node), (yyvsp[-1].labelref)); -+ struct node *target = get_node_by_ref((yyvsp[(1) - (4)].node), (yyvsp[(3) - (4)].labelref)); - -+ add_label(&target->labels, (yyvsp[(2) - (4)].labelref)); - if (target) -- delete_node(target); -+ merge_nodes(target, (yyvsp[(4) - (4)].node)); - else -- ERROR(&(yylsp[-1]), "Label or path %s not found", (yyvsp[-1].labelref)); -- -- -- (yyval.node) = (yyvsp[-3].node); -+ ERROR(&(yylsp[(3) - (4)]), "Label or path %s not found", (yyvsp[(3) - (4)].labelref)); -+ (yyval.node) = (yyvsp[(1) - (4)].node); - } --#line 1566 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - - case 12: --#line 181 "dtc-parser.y" /* yacc.c:1646 */ -+ -+/* Line 1806 of yacc.c */ -+#line 173 "dtc-parser.y" - { -- (yyval.node) = build_node((yyvsp[-3].proplist), (yyvsp[-2].nodelist)); -+ struct node *target = get_node_by_ref((yyvsp[(1) - (3)].node), (yyvsp[(2) - (3)].labelref)); -+ -+ if (target) -+ merge_nodes(target, (yyvsp[(3) - (3)].node)); -+ else -+ ERROR(&(yylsp[(2) - (3)]), "Label or path %s not found", (yyvsp[(2) - (3)].labelref)); -+ (yyval.node) = (yyvsp[(1) - (3)].node); - } --#line 1574 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - - case 13: --#line 188 "dtc-parser.y" /* yacc.c:1646 */ -+ -+/* Line 1806 of yacc.c */ -+#line 183 "dtc-parser.y" - { -- (yyval.proplist) = NULL; -+ struct node *target = get_node_by_ref((yyvsp[(1) - (4)].node), (yyvsp[(3) - (4)].labelref)); -+ -+ if (target) -+ delete_node(target); -+ else -+ ERROR(&(yylsp[(3) - (4)]), "Label or path %s not found", (yyvsp[(3) - (4)].labelref)); -+ -+ -+ (yyval.node) = (yyvsp[(1) - (4)].node); - } --#line 1582 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - - case 14: --#line 192 "dtc-parser.y" /* yacc.c:1646 */ -+ -+/* Line 1806 of yacc.c */ -+#line 198 "dtc-parser.y" - { -- (yyval.proplist) = chain_property((yyvsp[0].prop), (yyvsp[-1].proplist)); -+ (yyval.node) = build_node((yyvsp[(2) - (5)].proplist), (yyvsp[(3) - (5)].nodelist)); - } --#line 1590 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - - case 15: --#line 199 "dtc-parser.y" /* yacc.c:1646 */ -+ -+/* Line 1806 of yacc.c */ -+#line 205 "dtc-parser.y" - { -- (yyval.prop) = build_property((yyvsp[-3].propnodename), (yyvsp[-1].data)); -+ (yyval.proplist) = NULL; - } --#line 1598 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - - case 16: --#line 203 "dtc-parser.y" /* yacc.c:1646 */ -+ -+/* Line 1806 of yacc.c */ -+#line 209 "dtc-parser.y" - { -- (yyval.prop) = build_property((yyvsp[-1].propnodename), empty_data); -+ (yyval.proplist) = chain_property((yyvsp[(2) - (2)].prop), (yyvsp[(1) - (2)].proplist)); - } --#line 1606 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - - case 17: --#line 207 "dtc-parser.y" /* yacc.c:1646 */ -+ -+/* Line 1806 of yacc.c */ -+#line 216 "dtc-parser.y" - { -- (yyval.prop) = build_property_delete((yyvsp[-1].propnodename)); -+ (yyval.prop) = build_property((yyvsp[(1) - (4)].propnodename), (yyvsp[(3) - (4)].data)); - } --#line 1614 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - - case 18: --#line 211 "dtc-parser.y" /* yacc.c:1646 */ -+ -+/* Line 1806 of yacc.c */ -+#line 220 "dtc-parser.y" - { -- add_label(&(yyvsp[0].prop)->labels, (yyvsp[-1].labelref)); -- (yyval.prop) = (yyvsp[0].prop); -+ (yyval.prop) = build_property((yyvsp[(1) - (2)].propnodename), empty_data); - } --#line 1623 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - - case 19: --#line 219 "dtc-parser.y" /* yacc.c:1646 */ -+ -+/* Line 1806 of yacc.c */ -+#line 224 "dtc-parser.y" - { -- (yyval.data) = data_merge((yyvsp[-1].data), (yyvsp[0].data)); -+ (yyval.prop) = build_property_delete((yyvsp[(2) - (3)].propnodename)); - } --#line 1631 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - - case 20: --#line 223 "dtc-parser.y" /* yacc.c:1646 */ -+ -+/* Line 1806 of yacc.c */ -+#line 228 "dtc-parser.y" - { -- (yyval.data) = data_merge((yyvsp[-2].data), (yyvsp[-1].array).data); -+ add_label(&(yyvsp[(2) - (2)].prop)->labels, (yyvsp[(1) - (2)].labelref)); -+ (yyval.prop) = (yyvsp[(2) - (2)].prop); - } --#line 1639 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - - case 21: --#line 227 "dtc-parser.y" /* yacc.c:1646 */ -+ -+/* Line 1806 of yacc.c */ -+#line 236 "dtc-parser.y" - { -- (yyval.data) = data_merge((yyvsp[-3].data), (yyvsp[-1].data)); -+ (yyval.data) = data_merge((yyvsp[(1) - (2)].data), (yyvsp[(2) - (2)].data)); - } --#line 1647 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - - case 22: --#line 231 "dtc-parser.y" /* yacc.c:1646 */ -+ -+/* Line 1806 of yacc.c */ -+#line 240 "dtc-parser.y" - { -- (yyval.data) = data_add_marker((yyvsp[-1].data), REF_PATH, (yyvsp[0].labelref)); -+ (yyval.data) = data_merge((yyvsp[(1) - (3)].data), (yyvsp[(2) - (3)].array).data); - } --#line 1655 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - - case 23: --#line 235 "dtc-parser.y" /* yacc.c:1646 */ -+ -+/* Line 1806 of yacc.c */ -+#line 244 "dtc-parser.y" - { -- FILE *f = srcfile_relative_open((yyvsp[-5].data).val, NULL); -+ (yyval.data) = data_merge((yyvsp[(1) - (4)].data), (yyvsp[(3) - (4)].data)); -+ } -+ break; -+ -+ case 24: -+ -+/* Line 1806 of yacc.c */ -+#line 248 "dtc-parser.y" -+ { -+ (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), REF_PATH, (yyvsp[(2) - (2)].labelref)); -+ } -+ break; -+ -+ case 25: -+ -+/* Line 1806 of yacc.c */ -+#line 252 "dtc-parser.y" -+ { -+ FILE *f = srcfile_relative_open((yyvsp[(4) - (9)].data).val, NULL); - struct data d; - -- if ((yyvsp[-3].integer) != 0) -- if (fseek(f, (yyvsp[-3].integer), SEEK_SET) != 0) -+ if ((yyvsp[(6) - (9)].integer) != 0) -+ if (fseek(f, (yyvsp[(6) - (9)].integer), SEEK_SET) != 0) - die("Couldn't seek to offset %llu in \"%s\": %s", -- (unsigned long long)(yyvsp[-3].integer), (yyvsp[-5].data).val, -+ (unsigned long long)(yyvsp[(6) - (9)].integer), (yyvsp[(4) - (9)].data).val, - strerror(errno)); - -- d = data_copy_file(f, (yyvsp[-1].integer)); -+ d = data_copy_file(f, (yyvsp[(8) - (9)].integer)); - -- (yyval.data) = data_merge((yyvsp[-8].data), d); -+ (yyval.data) = data_merge((yyvsp[(1) - (9)].data), d); - fclose(f); - } --#line 1675 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 24: --#line 251 "dtc-parser.y" /* yacc.c:1646 */ -+ case 26: -+ -+/* Line 1806 of yacc.c */ -+#line 268 "dtc-parser.y" - { -- FILE *f = srcfile_relative_open((yyvsp[-1].data).val, NULL); -+ FILE *f = srcfile_relative_open((yyvsp[(4) - (5)].data).val, NULL); - struct data d = empty_data; - - d = data_copy_file(f, -1); - -- (yyval.data) = data_merge((yyvsp[-4].data), d); -+ (yyval.data) = data_merge((yyvsp[(1) - (5)].data), d); - fclose(f); - } --#line 1689 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 25: --#line 261 "dtc-parser.y" /* yacc.c:1646 */ -+ case 27: -+ -+/* Line 1806 of yacc.c */ -+#line 278 "dtc-parser.y" - { -- (yyval.data) = data_add_marker((yyvsp[-1].data), LABEL, (yyvsp[0].labelref)); -+ (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref)); - } --#line 1697 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 26: --#line 268 "dtc-parser.y" /* yacc.c:1646 */ -+ case 28: -+ -+/* Line 1806 of yacc.c */ -+#line 285 "dtc-parser.y" - { - (yyval.data) = empty_data; - } --#line 1705 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 27: --#line 272 "dtc-parser.y" /* yacc.c:1646 */ -+ case 29: -+ -+/* Line 1806 of yacc.c */ -+#line 289 "dtc-parser.y" - { -- (yyval.data) = (yyvsp[-1].data); -+ (yyval.data) = (yyvsp[(1) - (2)].data); - } --#line 1713 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 28: --#line 276 "dtc-parser.y" /* yacc.c:1646 */ -+ case 30: -+ -+/* Line 1806 of yacc.c */ -+#line 293 "dtc-parser.y" - { -- (yyval.data) = data_add_marker((yyvsp[-1].data), LABEL, (yyvsp[0].labelref)); -+ (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref)); - } --#line 1721 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 29: --#line 283 "dtc-parser.y" /* yacc.c:1646 */ -+ case 31: -+ -+/* Line 1806 of yacc.c */ -+#line 300 "dtc-parser.y" - { - unsigned long long bits; - -- bits = (yyvsp[-1].integer); -+ bits = (yyvsp[(2) - (3)].integer); - - if ((bits != 8) && (bits != 16) && - (bits != 32) && (bits != 64)) { -- ERROR(&(yylsp[-1]), "Array elements must be" -+ ERROR(&(yylsp[(2) - (3)]), "Array elements must be" - " 8, 16, 32 or 64-bits"); - bits = 32; - } -@@ -1737,23 +1918,25 @@ yyreduce: - (yyval.array).data = empty_data; - (yyval.array).bits = bits; - } --#line 1741 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 30: --#line 299 "dtc-parser.y" /* yacc.c:1646 */ -+ case 32: -+ -+/* Line 1806 of yacc.c */ -+#line 316 "dtc-parser.y" - { - (yyval.array).data = empty_data; - (yyval.array).bits = 32; - } --#line 1750 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 31: --#line 304 "dtc-parser.y" /* yacc.c:1646 */ -+ case 33: -+ -+/* Line 1806 of yacc.c */ -+#line 321 "dtc-parser.y" - { -- if ((yyvsp[-1].array).bits < 64) { -- uint64_t mask = (1ULL << (yyvsp[-1].array).bits) - 1; -+ if ((yyvsp[(1) - (2)].array).bits < 64) { -+ uint64_t mask = (1ULL << (yyvsp[(1) - (2)].array).bits) - 1; - /* - * Bits above mask must either be all zero - * (positive within range of mask) or all one -@@ -1762,258 +1945,293 @@ yyreduce: - * within the mask to one (i.e. | in the - * mask), all bits are one. - */ -- if (((yyvsp[0].integer) > mask) && (((yyvsp[0].integer) | mask) != -1ULL)) -- ERROR(&(yylsp[0]), "Value out of range for" -- " %d-bit array element", (yyvsp[-1].array).bits); -+ if (((yyvsp[(2) - (2)].integer) > mask) && (((yyvsp[(2) - (2)].integer) | mask) != -1ULL)) -+ ERROR(&(yylsp[(2) - (2)]), "Value out of range for" -+ " %d-bit array element", (yyvsp[(1) - (2)].array).bits); - } - -- (yyval.array).data = data_append_integer((yyvsp[-1].array).data, (yyvsp[0].integer), (yyvsp[-1].array).bits); -+ (yyval.array).data = data_append_integer((yyvsp[(1) - (2)].array).data, (yyvsp[(2) - (2)].integer), (yyvsp[(1) - (2)].array).bits); - } --#line 1773 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 32: --#line 323 "dtc-parser.y" /* yacc.c:1646 */ -+ case 34: -+ -+/* Line 1806 of yacc.c */ -+#line 340 "dtc-parser.y" - { -- uint64_t val = ~0ULL >> (64 - (yyvsp[-1].array).bits); -+ uint64_t val = ~0ULL >> (64 - (yyvsp[(1) - (2)].array).bits); - -- if ((yyvsp[-1].array).bits == 32) -- (yyvsp[-1].array).data = data_add_marker((yyvsp[-1].array).data, -+ if ((yyvsp[(1) - (2)].array).bits == 32) -+ (yyvsp[(1) - (2)].array).data = data_add_marker((yyvsp[(1) - (2)].array).data, - REF_PHANDLE, -- (yyvsp[0].labelref)); -+ (yyvsp[(2) - (2)].labelref)); - else -- ERROR(&(yylsp[0]), "References are only allowed in " -+ ERROR(&(yylsp[(2) - (2)]), "References are only allowed in " - "arrays with 32-bit elements."); - -- (yyval.array).data = data_append_integer((yyvsp[-1].array).data, val, (yyvsp[-1].array).bits); -+ (yyval.array).data = data_append_integer((yyvsp[(1) - (2)].array).data, val, (yyvsp[(1) - (2)].array).bits); - } --#line 1791 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 33: --#line 337 "dtc-parser.y" /* yacc.c:1646 */ -+ case 35: -+ -+/* Line 1806 of yacc.c */ -+#line 354 "dtc-parser.y" - { -- (yyval.array).data = data_add_marker((yyvsp[-1].array).data, LABEL, (yyvsp[0].labelref)); -+ (yyval.array).data = data_add_marker((yyvsp[(1) - (2)].array).data, LABEL, (yyvsp[(2) - (2)].labelref)); - } --#line 1799 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 36: --#line 346 "dtc-parser.y" /* yacc.c:1646 */ -+ case 38: -+ -+/* Line 1806 of yacc.c */ -+#line 363 "dtc-parser.y" - { -- (yyval.integer) = (yyvsp[-1].integer); -+ (yyval.integer) = (yyvsp[(2) - (3)].integer); - } --#line 1807 "dtc-parser.tab.c" /* yacc.c:1646 */ -- break; -- -- case 39: --#line 357 "dtc-parser.y" /* yacc.c:1646 */ -- { (yyval.integer) = (yyvsp[-4].integer) ? (yyvsp[-2].integer) : (yyvsp[0].integer); } --#line 1813 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - - case 41: --#line 362 "dtc-parser.y" /* yacc.c:1646 */ -- { (yyval.integer) = (yyvsp[-2].integer) || (yyvsp[0].integer); } --#line 1819 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ -+/* Line 1806 of yacc.c */ -+#line 374 "dtc-parser.y" -+ { (yyval.integer) = (yyvsp[(1) - (5)].integer) ? (yyvsp[(3) - (5)].integer) : (yyvsp[(5) - (5)].integer); } - break; - - case 43: --#line 367 "dtc-parser.y" /* yacc.c:1646 */ -- { (yyval.integer) = (yyvsp[-2].integer) && (yyvsp[0].integer); } --#line 1825 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ -+/* Line 1806 of yacc.c */ -+#line 379 "dtc-parser.y" -+ { (yyval.integer) = (yyvsp[(1) - (3)].integer) || (yyvsp[(3) - (3)].integer); } - break; - - case 45: --#line 372 "dtc-parser.y" /* yacc.c:1646 */ -- { (yyval.integer) = (yyvsp[-2].integer) | (yyvsp[0].integer); } --#line 1831 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ -+/* Line 1806 of yacc.c */ -+#line 384 "dtc-parser.y" -+ { (yyval.integer) = (yyvsp[(1) - (3)].integer) && (yyvsp[(3) - (3)].integer); } - break; - - case 47: --#line 377 "dtc-parser.y" /* yacc.c:1646 */ -- { (yyval.integer) = (yyvsp[-2].integer) ^ (yyvsp[0].integer); } --#line 1837 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ -+/* Line 1806 of yacc.c */ -+#line 389 "dtc-parser.y" -+ { (yyval.integer) = (yyvsp[(1) - (3)].integer) | (yyvsp[(3) - (3)].integer); } - break; - - case 49: --#line 382 "dtc-parser.y" /* yacc.c:1646 */ -- { (yyval.integer) = (yyvsp[-2].integer) & (yyvsp[0].integer); } --#line 1843 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ -+/* Line 1806 of yacc.c */ -+#line 394 "dtc-parser.y" -+ { (yyval.integer) = (yyvsp[(1) - (3)].integer) ^ (yyvsp[(3) - (3)].integer); } - break; - - case 51: --#line 387 "dtc-parser.y" /* yacc.c:1646 */ -- { (yyval.integer) = (yyvsp[-2].integer) == (yyvsp[0].integer); } --#line 1849 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ -+/* Line 1806 of yacc.c */ -+#line 399 "dtc-parser.y" -+ { (yyval.integer) = (yyvsp[(1) - (3)].integer) & (yyvsp[(3) - (3)].integer); } - break; - -- case 52: --#line 388 "dtc-parser.y" /* yacc.c:1646 */ -- { (yyval.integer) = (yyvsp[-2].integer) != (yyvsp[0].integer); } --#line 1855 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ case 53: -+ -+/* Line 1806 of yacc.c */ -+#line 404 "dtc-parser.y" -+ { (yyval.integer) = (yyvsp[(1) - (3)].integer) == (yyvsp[(3) - (3)].integer); } - break; - - case 54: --#line 393 "dtc-parser.y" /* yacc.c:1646 */ -- { (yyval.integer) = (yyvsp[-2].integer) < (yyvsp[0].integer); } --#line 1861 "dtc-parser.tab.c" /* yacc.c:1646 */ -- break; - -- case 55: --#line 394 "dtc-parser.y" /* yacc.c:1646 */ -- { (yyval.integer) = (yyvsp[-2].integer) > (yyvsp[0].integer); } --#line 1867 "dtc-parser.tab.c" /* yacc.c:1646 */ -+/* Line 1806 of yacc.c */ -+#line 405 "dtc-parser.y" -+ { (yyval.integer) = (yyvsp[(1) - (3)].integer) != (yyvsp[(3) - (3)].integer); } - break; - - case 56: --#line 395 "dtc-parser.y" /* yacc.c:1646 */ -- { (yyval.integer) = (yyvsp[-2].integer) <= (yyvsp[0].integer); } --#line 1873 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ -+/* Line 1806 of yacc.c */ -+#line 410 "dtc-parser.y" -+ { (yyval.integer) = (yyvsp[(1) - (3)].integer) < (yyvsp[(3) - (3)].integer); } - break; - - case 57: --#line 396 "dtc-parser.y" /* yacc.c:1646 */ -- { (yyval.integer) = (yyvsp[-2].integer) >= (yyvsp[0].integer); } --#line 1879 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ -+/* Line 1806 of yacc.c */ -+#line 411 "dtc-parser.y" -+ { (yyval.integer) = (yyvsp[(1) - (3)].integer) > (yyvsp[(3) - (3)].integer); } - break; - - case 58: --#line 400 "dtc-parser.y" /* yacc.c:1646 */ -- { (yyval.integer) = (yyvsp[-2].integer) << (yyvsp[0].integer); } --#line 1885 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ -+/* Line 1806 of yacc.c */ -+#line 412 "dtc-parser.y" -+ { (yyval.integer) = (yyvsp[(1) - (3)].integer) <= (yyvsp[(3) - (3)].integer); } - break; - - case 59: --#line 401 "dtc-parser.y" /* yacc.c:1646 */ -- { (yyval.integer) = (yyvsp[-2].integer) >> (yyvsp[0].integer); } --#line 1891 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ -+/* Line 1806 of yacc.c */ -+#line 413 "dtc-parser.y" -+ { (yyval.integer) = (yyvsp[(1) - (3)].integer) >= (yyvsp[(3) - (3)].integer); } -+ break; -+ -+ case 60: -+ -+/* Line 1806 of yacc.c */ -+#line 417 "dtc-parser.y" -+ { (yyval.integer) = (yyvsp[(1) - (3)].integer) << (yyvsp[(3) - (3)].integer); } - break; - - case 61: --#line 406 "dtc-parser.y" /* yacc.c:1646 */ -- { (yyval.integer) = (yyvsp[-2].integer) + (yyvsp[0].integer); } --#line 1897 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ -+/* Line 1806 of yacc.c */ -+#line 418 "dtc-parser.y" -+ { (yyval.integer) = (yyvsp[(1) - (3)].integer) >> (yyvsp[(3) - (3)].integer); } - break; - -- case 62: --#line 407 "dtc-parser.y" /* yacc.c:1646 */ -- { (yyval.integer) = (yyvsp[-2].integer) - (yyvsp[0].integer); } --#line 1903 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ case 63: -+ -+/* Line 1806 of yacc.c */ -+#line 423 "dtc-parser.y" -+ { (yyval.integer) = (yyvsp[(1) - (3)].integer) + (yyvsp[(3) - (3)].integer); } - break; - - case 64: --#line 412 "dtc-parser.y" /* yacc.c:1646 */ -- { (yyval.integer) = (yyvsp[-2].integer) * (yyvsp[0].integer); } --#line 1909 "dtc-parser.tab.c" /* yacc.c:1646 */ -- break; - -- case 65: --#line 413 "dtc-parser.y" /* yacc.c:1646 */ -- { (yyval.integer) = (yyvsp[-2].integer) / (yyvsp[0].integer); } --#line 1915 "dtc-parser.tab.c" /* yacc.c:1646 */ -+/* Line 1806 of yacc.c */ -+#line 424 "dtc-parser.y" -+ { (yyval.integer) = (yyvsp[(1) - (3)].integer) - (yyvsp[(3) - (3)].integer); } - break; - - case 66: --#line 414 "dtc-parser.y" /* yacc.c:1646 */ -- { (yyval.integer) = (yyvsp[-2].integer) % (yyvsp[0].integer); } --#line 1921 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ -+/* Line 1806 of yacc.c */ -+#line 429 "dtc-parser.y" -+ { (yyval.integer) = (yyvsp[(1) - (3)].integer) * (yyvsp[(3) - (3)].integer); } - break; - -- case 69: --#line 420 "dtc-parser.y" /* yacc.c:1646 */ -- { (yyval.integer) = -(yyvsp[0].integer); } --#line 1927 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ case 67: -+ -+/* Line 1806 of yacc.c */ -+#line 430 "dtc-parser.y" -+ { (yyval.integer) = (yyvsp[(1) - (3)].integer) / (yyvsp[(3) - (3)].integer); } - break; - -- case 70: --#line 421 "dtc-parser.y" /* yacc.c:1646 */ -- { (yyval.integer) = ~(yyvsp[0].integer); } --#line 1933 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ case 68: -+ -+/* Line 1806 of yacc.c */ -+#line 431 "dtc-parser.y" -+ { (yyval.integer) = (yyvsp[(1) - (3)].integer) % (yyvsp[(3) - (3)].integer); } - break; - - case 71: --#line 422 "dtc-parser.y" /* yacc.c:1646 */ -- { (yyval.integer) = !(yyvsp[0].integer); } --#line 1939 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ -+/* Line 1806 of yacc.c */ -+#line 437 "dtc-parser.y" -+ { (yyval.integer) = -(yyvsp[(2) - (2)].integer); } - break; - - case 72: --#line 427 "dtc-parser.y" /* yacc.c:1646 */ -- { -- (yyval.data) = empty_data; -- } --#line 1947 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ -+/* Line 1806 of yacc.c */ -+#line 438 "dtc-parser.y" -+ { (yyval.integer) = ~(yyvsp[(2) - (2)].integer); } - break; - - case 73: --#line 431 "dtc-parser.y" /* yacc.c:1646 */ -- { -- (yyval.data) = data_append_byte((yyvsp[-1].data), (yyvsp[0].byte)); -- } --#line 1955 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ -+/* Line 1806 of yacc.c */ -+#line 439 "dtc-parser.y" -+ { (yyval.integer) = !(yyvsp[(2) - (2)].integer); } - break; - - case 74: --#line 435 "dtc-parser.y" /* yacc.c:1646 */ -+ -+/* Line 1806 of yacc.c */ -+#line 444 "dtc-parser.y" - { -- (yyval.data) = data_add_marker((yyvsp[-1].data), LABEL, (yyvsp[0].labelref)); -+ (yyval.data) = empty_data; - } --#line 1963 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - - case 75: --#line 442 "dtc-parser.y" /* yacc.c:1646 */ -+ -+/* Line 1806 of yacc.c */ -+#line 448 "dtc-parser.y" - { -- (yyval.nodelist) = NULL; -+ (yyval.data) = data_append_byte((yyvsp[(1) - (2)].data), (yyvsp[(2) - (2)].byte)); - } --#line 1971 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - - case 76: --#line 446 "dtc-parser.y" /* yacc.c:1646 */ -+ -+/* Line 1806 of yacc.c */ -+#line 452 "dtc-parser.y" - { -- (yyval.nodelist) = chain_node((yyvsp[-1].node), (yyvsp[0].nodelist)); -+ (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref)); - } --#line 1979 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - - case 77: --#line 450 "dtc-parser.y" /* yacc.c:1646 */ -+ -+/* Line 1806 of yacc.c */ -+#line 459 "dtc-parser.y" - { -- ERROR(&(yylsp[0]), "Properties must precede subnodes"); -- YYERROR; -+ (yyval.nodelist) = NULL; - } --#line 1988 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - - case 78: --#line 458 "dtc-parser.y" /* yacc.c:1646 */ -+ -+/* Line 1806 of yacc.c */ -+#line 463 "dtc-parser.y" - { -- (yyval.node) = name_node((yyvsp[0].node), (yyvsp[-1].propnodename)); -+ (yyval.nodelist) = chain_node((yyvsp[(1) - (2)].node), (yyvsp[(2) - (2)].nodelist)); - } --#line 1996 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - - case 79: --#line 462 "dtc-parser.y" /* yacc.c:1646 */ -+ -+/* Line 1806 of yacc.c */ -+#line 467 "dtc-parser.y" - { -- (yyval.node) = name_node(build_node_delete(), (yyvsp[-1].propnodename)); -+ ERROR(&(yylsp[(2) - (2)]), "Properties must precede subnodes"); -+ YYERROR; - } --#line 2004 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - - case 80: --#line 466 "dtc-parser.y" /* yacc.c:1646 */ -+ -+/* Line 1806 of yacc.c */ -+#line 475 "dtc-parser.y" - { -- add_label(&(yyvsp[0].node)->labels, (yyvsp[-1].labelref)); -- (yyval.node) = (yyvsp[0].node); -+ (yyval.node) = name_node((yyvsp[(2) - (2)].node), (yyvsp[(1) - (2)].propnodename)); - } --#line 2013 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -+ case 81: - --#line 2017 "dtc-parser.tab.c" /* yacc.c:1646 */ -+/* Line 1806 of yacc.c */ -+#line 479 "dtc-parser.y" -+ { -+ (yyval.node) = name_node(build_node_delete(), (yyvsp[(2) - (3)].propnodename)); -+ } -+ break; -+ -+ case 82: -+ -+/* Line 1806 of yacc.c */ -+#line 483 "dtc-parser.y" -+ { -+ add_label(&(yyvsp[(2) - (2)].node)->labels, (yyvsp[(1) - (2)].labelref)); -+ (yyval.node) = (yyvsp[(2) - (2)].node); -+ } -+ break; -+ -+ -+ -+/* Line 1806 of yacc.c */ -+#line 2235 "dtc-parser.tab.c" - default: break; - } - /* User semantic actions sometimes alter yychar, and that requires -@@ -2036,7 +2254,7 @@ yyreduce: - *++yyvsp = yyval; - *++yylsp = yyloc; - -- /* Now 'shift' the result of the reduction. Determine what state -+ /* Now `shift' the result of the reduction. Determine what state - that goes to, based on the state we popped back to and the rule - number reduced by. */ - -@@ -2051,9 +2269,9 @@ yyreduce: - goto yynewstate; - - --/*--------------------------------------. --| yyerrlab -- here on detecting error. | --`--------------------------------------*/ -+/*------------------------------------. -+| yyerrlab -- here on detecting error | -+`------------------------------------*/ - yyerrlab: - /* Make sure we have latest lookahead translation. See comments at - user semantic actions for why this is necessary. */ -@@ -2104,20 +2322,20 @@ yyerrlab: - if (yyerrstatus == 3) - { - /* If just tried and failed to reuse lookahead token after an -- error, discard it. */ -+ error, discard it. */ - - if (yychar <= YYEOF) -- { -- /* Return failure if at end of input. */ -- if (yychar == YYEOF) -- YYABORT; -- } -+ { -+ /* Return failure if at end of input. */ -+ if (yychar == YYEOF) -+ YYABORT; -+ } - else -- { -- yydestruct ("Error: discarding", -- yytoken, &yylval, &yylloc); -- yychar = YYEMPTY; -- } -+ { -+ yydestruct ("Error: discarding", -+ yytoken, &yylval, &yylloc); -+ yychar = YYEMPTY; -+ } - } - - /* Else will try to reuse lookahead token after shifting the error -@@ -2137,7 +2355,7 @@ yyerrorlab: - goto yyerrorlab; - - yyerror_range[1] = yylsp[1-yylen]; -- /* Do not reclaim the symbols of the rule whose action triggered -+ /* Do not reclaim the symbols of the rule which action triggered - this YYERROR. */ - YYPOPSTACK (yylen); - yylen = 0; -@@ -2150,37 +2368,35 @@ yyerrorlab: - | yyerrlab1 -- common code for both syntax error and YYERROR. | - `-------------------------------------------------------------*/ - yyerrlab1: -- yyerrstatus = 3; /* Each real token shifted decrements this. */ -+ yyerrstatus = 3; /* Each real token shifted decrements this. */ - - for (;;) - { - yyn = yypact[yystate]; - if (!yypact_value_is_default (yyn)) -- { -- yyn += YYTERROR; -- if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) -- { -- yyn = yytable[yyn]; -- if (0 < yyn) -- break; -- } -- } -+ { -+ yyn += YYTERROR; -+ if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) -+ { -+ yyn = yytable[yyn]; -+ if (0 < yyn) -+ break; -+ } -+ } - - /* Pop the current state because it cannot handle the error token. */ - if (yyssp == yyss) -- YYABORT; -+ YYABORT; - - yyerror_range[1] = *yylsp; - yydestruct ("Error: popping", -- yystos[yystate], yyvsp, yylsp); -+ yystos[yystate], yyvsp, yylsp); - YYPOPSTACK (1); - yystate = *yyssp; - YY_STACK_PRINT (yyss, yyssp); - } - -- YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN - *++yyvsp = yylval; -- YY_IGNORE_MAYBE_UNINITIALIZED_END - - yyerror_range[2] = yylloc; - /* Using YYLLOC is tempting, but would change the location of -@@ -2209,7 +2425,7 @@ yyabortlab: - yyresult = 1; - goto yyreturn; - --#if !defined yyoverflow || YYERROR_VERBOSE -+#if !defined(yyoverflow) || YYERROR_VERBOSE - /*-------------------------------------------------. - | yyexhaustedlab -- memory exhaustion comes here. | - `-------------------------------------------------*/ -@@ -2228,14 +2444,14 @@ yyreturn: - yydestruct ("Cleanup: discarding lookahead", - yytoken, &yylval, &yylloc); - } -- /* Do not reclaim the symbols of the rule whose action triggered -+ /* Do not reclaim the symbols of the rule which action triggered - this YYABORT or YYACCEPT. */ - YYPOPSTACK (yylen); - YY_STACK_PRINT (yyss, yyssp); - while (yyssp != yyss) - { - yydestruct ("Cleanup: popping", -- yystos[*yyssp], yyvsp, yylsp); -+ yystos[*yyssp], yyvsp, yylsp); - YYPOPSTACK (1); - } - #ifndef yyoverflow -@@ -2246,12 +2462,18 @@ yyreturn: - if (yymsg != yymsgbuf) - YYSTACK_FREE (yymsg); - #endif -- return yyresult; -+ /* Make sure YYID is used. */ -+ return YYID (yyresult); - } --#line 472 "dtc-parser.y" /* yacc.c:1906 */ -+ -+ -+ -+/* Line 2067 of yacc.c */ -+#line 489 "dtc-parser.y" - - - void yyerror(char const *s) - { - ERROR(&yylloc, "%s", s); - } -+ -diff --git a/scripts/dtc/dtc-parser.tab.h_shipped b/scripts/dtc/dtc-parser.tab.h_shipped -index 30867c6..0b22bbb 100644 ---- a/scripts/dtc/dtc-parser.tab.h_shipped -+++ b/scripts/dtc/dtc-parser.tab.h_shipped -@@ -1,19 +1,19 @@ --/* A Bison parser, made by GNU Bison 3.0.2. */ -+/* A Bison parser, made by GNU Bison 2.5. */ - - /* Bison interface for Yacc-like parsers in C -- -- Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. -- -+ -+ Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc. -+ - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. -- -+ - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. -- -+ - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -@@ -26,55 +26,50 @@ - special exception, which will cause the skeleton and the resulting - Bison output files to be licensed under the GNU General Public - License without this special exception. -- -+ - This special exception was added by the Free Software Foundation in - version 2.2 of Bison. */ - --#ifndef YY_YY_DTC_PARSER_TAB_H_INCLUDED --# define YY_YY_DTC_PARSER_TAB_H_INCLUDED --/* Debug traces. */ --#ifndef YYDEBUG --# define YYDEBUG 0 --#endif --#if YYDEBUG --extern int yydebug; --#endif - --/* Token type. */ -+/* Tokens. */ - #ifndef YYTOKENTYPE - # define YYTOKENTYPE -- enum yytokentype -- { -- DT_V1 = 258, -- DT_MEMRESERVE = 259, -- DT_LSHIFT = 260, -- DT_RSHIFT = 261, -- DT_LE = 262, -- DT_GE = 263, -- DT_EQ = 264, -- DT_NE = 265, -- DT_AND = 266, -- DT_OR = 267, -- DT_BITS = 268, -- DT_DEL_PROP = 269, -- DT_DEL_NODE = 270, -- DT_PROPNODENAME = 271, -- DT_LITERAL = 272, -- DT_CHAR_LITERAL = 273, -- DT_BYTE = 274, -- DT_STRING = 275, -- DT_LABEL = 276, -- DT_REF = 277, -- DT_INCBIN = 278 -- }; -+ /* Put the tokens into the symbol table, so that GDB and other debuggers -+ know about them. */ -+ enum yytokentype { -+ DT_V1 = 258, -+ DT_PLUGIN = 259, -+ DT_MEMRESERVE = 260, -+ DT_LSHIFT = 261, -+ DT_RSHIFT = 262, -+ DT_LE = 263, -+ DT_GE = 264, -+ DT_EQ = 265, -+ DT_NE = 266, -+ DT_AND = 267, -+ DT_OR = 268, -+ DT_BITS = 269, -+ DT_DEL_PROP = 270, -+ DT_DEL_NODE = 271, -+ DT_PROPNODENAME = 272, -+ DT_LITERAL = 273, -+ DT_CHAR_LITERAL = 274, -+ DT_BYTE = 275, -+ DT_STRING = 276, -+ DT_LABEL = 277, -+ DT_REF = 278, -+ DT_INCBIN = 279 -+ }; - #endif - --/* Value type. */ -+ -+ - #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED --typedef union YYSTYPE YYSTYPE; --union YYSTYPE -+typedef union YYSTYPE - { --#line 38 "dtc-parser.y" /* yacc.c:1909 */ -+ -+/* Line 2068 of yacc.c */ -+#line 39 "dtc-parser.y" - - char *propnodename; - char *labelref; -@@ -92,30 +87,32 @@ union YYSTYPE - struct node *nodelist; - struct reserve_info *re; - uint64_t integer; -+ int is_plugin; -+ -+ - --#line 97 "dtc-parser.tab.h" /* yacc.c:1909 */ --}; -+/* Line 2068 of yacc.c */ -+#line 96 "dtc-parser.tab.h" -+} YYSTYPE; - # define YYSTYPE_IS_TRIVIAL 1 -+# define yystype YYSTYPE /* obsolescent; will be withdrawn */ - # define YYSTYPE_IS_DECLARED 1 - #endif - --/* Location type. */ -+extern YYSTYPE yylval; -+ - #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED --typedef struct YYLTYPE YYLTYPE; --struct YYLTYPE -+typedef struct YYLTYPE - { - int first_line; - int first_column; - int last_line; - int last_column; --}; -+} YYLTYPE; -+# define yyltype YYLTYPE /* obsolescent; will be withdrawn */ - # define YYLTYPE_IS_DECLARED 1 - # define YYLTYPE_IS_TRIVIAL 1 - #endif - -- --extern YYSTYPE yylval; - extern YYLTYPE yylloc; --int yyparse (void); - --#endif /* !YY_YY_DTC_PARSER_TAB_H_INCLUDED */ -diff --git a/scripts/dtc/dtc-parser.y b/scripts/dtc/dtc-parser.y -index 5a897e3..56b9c15 100644 ---- a/scripts/dtc/dtc-parser.y -+++ b/scripts/dtc/dtc-parser.y -@@ -19,6 +19,7 @@ - */ - %{ - #include <stdio.h> -+#include <inttypes.h> - - #include "dtc.h" - #include "srcpos.h" -@@ -52,9 +53,11 @@ extern bool treesource_error; - struct node *nodelist; - struct reserve_info *re; - uint64_t integer; -+ int is_plugin; - } - - %token DT_V1 -+%token DT_PLUGIN - %token DT_MEMRESERVE - %token DT_LSHIFT DT_RSHIFT DT_LE DT_GE DT_EQ DT_NE DT_AND DT_OR - %token DT_BITS -@@ -71,6 +74,7 @@ extern bool treesource_error; - - %type <data> propdata - %type <data> propdataprefix -+%type <is_plugin> plugindecl - %type <re> memreserve - %type <re> memreserves - %type <array> arrayprefix -@@ -101,10 +105,23 @@ extern bool treesource_error; - %% - - sourcefile: -- DT_V1 ';' memreserves devicetree -+ DT_V1 ';' plugindecl memreserves devicetree - { -- the_boot_info = build_boot_info($3, $4, -- guess_boot_cpuid($4)); -+ $5->is_plugin = $3; -+ $5->is_root = 1; -+ the_boot_info = build_boot_info($4, $5, -+ guess_boot_cpuid($5)); -+ } -+ ; -+ -+plugindecl: -+ /* empty */ -+ { -+ $$ = 0; -+ } -+ | DT_PLUGIN ';' -+ { -+ $$ = 1; - } - ; - -diff --git a/scripts/dtc/dtc.c b/scripts/dtc/dtc.c -index 8c4add6..0cbb14c 100644 ---- a/scripts/dtc/dtc.c -+++ b/scripts/dtc/dtc.c -@@ -29,6 +29,7 @@ int reservenum; /* Number of memory reservation slots */ - int minsize; /* Minimum blob size */ - int padsize; /* Additional padding to blob */ - int phandle_format = PHANDLE_BOTH; /* Use linux,phandle or phandle properties */ -+int symbol_fixup_support = 0; - - static void fill_fullpaths(struct node *tree, const char *prefix) - { -@@ -51,7 +52,7 @@ static void fill_fullpaths(struct node *tree, const char *prefix) - #define FDT_VERSION(version) _FDT_VERSION(version) - #define _FDT_VERSION(version) #version - static const char usage_synopsis[] = "dtc [options] <input file>"; --static const char usage_short_opts[] = "qI:O:o:V:d:R:S:p:fb:i:H:sW:E:hv"; -+static const char usage_short_opts[] = "qI:O:o:V:d:R:S:p:fb:i:H:sW:E:hv@"; - static struct option const usage_long_opts[] = { - {"quiet", no_argument, NULL, 'q'}, - {"in-format", a_argument, NULL, 'I'}, -@@ -69,6 +70,7 @@ static struct option const usage_long_opts[] = { - {"phandle", a_argument, NULL, 'H'}, - {"warning", a_argument, NULL, 'W'}, - {"error", a_argument, NULL, 'E'}, -+ {"symbols", a_argument, NULL, '@'}, - {"help", no_argument, NULL, 'h'}, - {"version", no_argument, NULL, 'v'}, - {NULL, no_argument, NULL, 0x0}, -@@ -99,6 +101,7 @@ static const char * const usage_opts_help[] = { - "\t\tboth - Both \"linux,phandle\" and \"phandle\" properties", - "\n\tEnable/disable warnings (prefix with \"no-\")", - "\n\tEnable/disable errors (prefix with \"no-\")", -+ "\n\tSymbols and Fixups support", - "\n\tPrint this help and exit", - "\n\tPrint version and exit", - NULL, -@@ -186,7 +189,9 @@ int main(int argc, char *argv[]) - case 'E': - parse_checks_option(false, true, optarg); - break; -- -+ case '@': -+ symbol_fixup_support = 1; -+ break; - case 'h': - usage(NULL); - default: -diff --git a/scripts/dtc/dtc.h b/scripts/dtc/dtc.h -index 56212c8..fe45748 100644 ---- a/scripts/dtc/dtc.h -+++ b/scripts/dtc/dtc.h -@@ -54,6 +54,7 @@ extern int reservenum; /* Number of memory reservation slots */ - extern int minsize; /* Minimum blob size */ - extern int padsize; /* Additional padding to blob */ - extern int phandle_format; /* Use linux,phandle or phandle properties */ -+extern int symbol_fixup_support;/* enable symbols & fixup support */ - - #define PHANDLE_LEGACY 0x1 - #define PHANDLE_EPAPR 0x2 -@@ -132,6 +133,25 @@ struct label { - struct label *next; - }; - -+struct fixup_entry { -+ int offset; -+ struct node *node; -+ struct property *prop; -+ struct fixup_entry *next; -+}; -+ -+struct fixup { -+ char *ref; -+ struct fixup_entry *entries; -+ struct fixup *next; -+}; -+ -+struct symbol { -+ struct label *label; -+ struct node *node; -+ struct symbol *next; -+}; -+ - struct property { - bool deleted; - char *name; -@@ -158,6 +178,12 @@ struct node { - int addr_cells, size_cells; - - struct label *labels; -+ -+ int is_root; -+ int is_plugin; -+ struct fixup *fixups; -+ struct symbol *symbols; -+ struct fixup_entry *local_fixups; - }; - - #define for_each_label_withdel(l0, l) \ -@@ -181,6 +207,18 @@ struct node { - for_each_child_withdel(n, c) \ - if (!(c)->deleted) - -+#define for_each_fixup(n, f) \ -+ for ((f) = (n)->fixups; (f); (f) = (f)->next) -+ -+#define for_each_fixup_entry(f, fe) \ -+ for ((fe) = (f)->entries; (fe); (fe) = (fe)->next) -+ -+#define for_each_symbol(n, s) \ -+ for ((s) = (n)->symbols; (s); (s) = (s)->next) -+ -+#define for_each_local_fixup_entry(n, fe) \ -+ for ((fe) = (n)->local_fixups; (fe); (fe) = (fe)->next) -+ - void add_label(struct label **labels, char *label); - void delete_labels(struct label **labels); - -diff --git a/scripts/dtc/flattree.c b/scripts/dtc/flattree.c -index bd99fa2..f439b40 100644 ---- a/scripts/dtc/flattree.c -+++ b/scripts/dtc/flattree.c -@@ -262,6 +262,12 @@ static void flatten_tree(struct node *tree, struct emitter *emit, - struct property *prop; - struct node *child; - bool seen_name_prop = false; -+ struct symbol *sym; -+ struct fixup *f; -+ struct fixup_entry *fe; -+ char *name, *s; -+ const char *fullpath; -+ int namesz, nameoff, vallen; - - if (tree->deleted) - return; -@@ -276,8 +282,6 @@ static void flatten_tree(struct node *tree, struct emitter *emit, - emit->align(etarget, sizeof(cell_t)); - - for_each_property(tree, prop) { -- int nameoff; -- - if (streq(prop->name, "name")) - seen_name_prop = true; - -@@ -310,6 +314,139 @@ static void flatten_tree(struct node *tree, struct emitter *emit, - flatten_tree(child, emit, etarget, strbuf, vi); - } - -+ if (!symbol_fixup_support) -+ goto no_symbols; -+ -+ /* add the symbol nodes (if any) */ -+ if (tree->symbols) { -+ -+ emit->beginnode(etarget, NULL); -+ emit->string(etarget, "__symbols__", 0); -+ emit->align(etarget, sizeof(cell_t)); -+ -+ for_each_symbol(tree, sym) { -+ -+ vallen = strlen(sym->node->fullpath); -+ -+ nameoff = stringtable_insert(strbuf, sym->label->label); -+ -+ emit->property(etarget, NULL); -+ emit->cell(etarget, vallen + 1); -+ emit->cell(etarget, nameoff); -+ -+ if ((vi->flags & FTF_VARALIGN) && vallen >= 8) -+ emit->align(etarget, 8); -+ -+ emit->string(etarget, sym->node->fullpath, -+ strlen(sym->node->fullpath)); -+ emit->align(etarget, sizeof(cell_t)); -+ } -+ -+ emit->endnode(etarget, NULL); -+ } -+ -+ /* add the fixup nodes */ -+ if (tree->fixups) { -+ -+ /* emit the external fixups */ -+ emit->beginnode(etarget, NULL); -+ emit->string(etarget, "__fixups__", 0); -+ emit->align(etarget, sizeof(cell_t)); -+ -+ for_each_fixup(tree, f) { -+ -+ namesz = 0; -+ for_each_fixup_entry(f, fe) { -+ fullpath = fe->node->fullpath; -+ if (fullpath[0] == '\0') -+ fullpath = "/"; -+ namesz += strlen(fullpath) + 1; -+ namesz += strlen(fe->prop->name) + 1; -+ namesz += 32; /* space for :<number> + '\0' */ -+ } -+ -+ name = xmalloc(namesz); -+ -+ s = name; -+ for_each_fixup_entry(f, fe) { -+ fullpath = fe->node->fullpath; -+ if (fullpath[0] == '\0') -+ fullpath = "/"; -+ snprintf(s, name + namesz - s, "%s:%s:%d", -+ fullpath, -+ fe->prop->name, fe->offset); -+ s += strlen(s) + 1; -+ } -+ -+ nameoff = stringtable_insert(strbuf, f->ref); -+ vallen = s - name - 1; -+ -+ emit->property(etarget, NULL); -+ emit->cell(etarget, vallen + 1); -+ emit->cell(etarget, nameoff); -+ -+ if ((vi->flags & FTF_VARALIGN) && vallen >= 8) -+ emit->align(etarget, 8); -+ -+ emit->string(etarget, name, vallen); -+ emit->align(etarget, sizeof(cell_t)); -+ -+ free(name); -+ } -+ -+ emit->endnode(etarget, tree->labels); -+ } -+ -+ /* add the local fixup property */ -+ if (tree->local_fixups) { -+ -+ /* emit the external fixups */ -+ emit->beginnode(etarget, NULL); -+ emit->string(etarget, "__local_fixups__", 0); -+ emit->align(etarget, sizeof(cell_t)); -+ -+ namesz = 0; -+ for_each_local_fixup_entry(tree, fe) { -+ fullpath = fe->node->fullpath; -+ if (fullpath[0] == '\0') -+ fullpath = "/"; -+ namesz += strlen(fullpath) + 1; -+ namesz += strlen(fe->prop->name) + 1; -+ namesz += 32; /* space for :<number> + '\0' */ -+ } -+ -+ name = xmalloc(namesz); -+ -+ s = name; -+ for_each_local_fixup_entry(tree, fe) { -+ fullpath = fe->node->fullpath; -+ if (fullpath[0] == '\0') -+ fullpath = "/"; -+ snprintf(s, name + namesz - s, "%s:%s:%d", -+ fullpath, fe->prop->name, -+ fe->offset); -+ s += strlen(s) + 1; -+ } -+ -+ nameoff = stringtable_insert(strbuf, "fixup"); -+ vallen = s - name - 1; -+ -+ emit->property(etarget, NULL); -+ emit->cell(etarget, vallen + 1); -+ emit->cell(etarget, nameoff); -+ -+ if ((vi->flags & FTF_VARALIGN) && vallen >= 8) -+ emit->align(etarget, 8); -+ -+ emit->string(etarget, name, vallen); -+ emit->align(etarget, sizeof(cell_t)); -+ -+ free(name); -+ -+ emit->endnode(etarget, tree->labels); -+ } -+ -+no_symbols: - emit->endnode(etarget, tree->labels); - } - -diff --git a/scripts/dtc/version_gen.h b/scripts/dtc/version_gen.h -index 5b8c7d5..86b7338 100644 ---- a/scripts/dtc/version_gen.h -+++ b/scripts/dtc/version_gen.h -@@ -1 +1 @@ --#define DTC_VERSION "DTC 1.4.1-g9d3649bd" -+#define DTC_VERSION "DTC 1.4.1-g9d3649bd-dirty" - -From b065c580329ecb7c7e77bb7019c6059d7db83398 Mon Sep 17 00:00:00 2001 -From: Phil Elwell <pelwell@users.noreply.github.com> -Date: Tue, 14 Jul 2015 14:32:47 +0100 -Subject: [PATCH 084/170] mfd: Add Raspberry Pi Sense HAT core driver - ---- - drivers/input/joystick/Kconfig | 8 + - drivers/input/joystick/Makefile | 1 + - drivers/input/joystick/rpisense-js.c | 153 ++++++++++++++++ - drivers/mfd/Kconfig | 8 + - drivers/mfd/Makefile | 2 + - drivers/mfd/rpisense-core.c | 157 +++++++++++++++++ - drivers/video/fbdev/Kconfig | 13 ++ - drivers/video/fbdev/Makefile | 1 + - drivers/video/fbdev/rpisense-fb.c | 293 +++++++++++++++++++++++++++++++ - include/linux/mfd/rpisense/core.h | 47 +++++ - include/linux/mfd/rpisense/framebuffer.h | 32 ++++ - include/linux/mfd/rpisense/joystick.h | 35 ++++ - 12 files changed, 750 insertions(+) - create mode 100644 drivers/input/joystick/rpisense-js.c - create mode 100644 drivers/mfd/rpisense-core.c - create mode 100644 drivers/video/fbdev/rpisense-fb.c - create mode 100644 include/linux/mfd/rpisense/core.h - create mode 100644 include/linux/mfd/rpisense/framebuffer.h - create mode 100644 include/linux/mfd/rpisense/joystick.h - -diff --git a/drivers/input/joystick/Kconfig b/drivers/input/joystick/Kconfig -index 4215b53..4364d7c8 100644 ---- a/drivers/input/joystick/Kconfig -+++ b/drivers/input/joystick/Kconfig -@@ -330,4 +330,12 @@ config JOYSTICK_MAPLE - To compile this as a module choose M here: the module will be called - maplecontrol. - -+config JOYSTICK_RPISENSE -+ tristate "Raspberry Pi Sense HAT joystick" -+ depends on GPIOLIB && INPUT -+ select MFD_RPISENSE_CORE -+ -+ help -+ This is the joystick driver for the Raspberry Pi Sense HAT -+ - endif -diff --git a/drivers/input/joystick/Makefile b/drivers/input/joystick/Makefile -index 92dc0de..1758160 100644 ---- a/drivers/input/joystick/Makefile -+++ b/drivers/input/joystick/Makefile -@@ -32,4 +32,5 @@ obj-$(CONFIG_JOYSTICK_WARRIOR) += warrior.o - obj-$(CONFIG_JOYSTICK_XPAD) += xpad.o - obj-$(CONFIG_JOYSTICK_ZHENHUA) += zhenhua.o - obj-$(CONFIG_JOYSTICK_WALKERA0701) += walkera0701.o -+obj-$(CONFIG_JOYSTICK_RPISENSE) += rpisense-js.o - -diff --git a/drivers/input/joystick/rpisense-js.c b/drivers/input/joystick/rpisense-js.c -new file mode 100644 -index 0000000..6a41676 ---- /dev/null -+++ b/drivers/input/joystick/rpisense-js.c -@@ -0,0 +1,153 @@ -+/* -+ * Raspberry Pi Sense HAT joystick driver -+ * http://raspberrypi.org -+ * -+ * Copyright (C) 2015 Raspberry Pi -+ * -+ * Author: Serge Schneider -+ * -+ * This program is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License as published by the -+ * Free Software Foundation; either version 2 of the License, or (at your -+ * option) any later version. -+ * -+ */ -+ -+#include <linux/module.h> -+ -+#include <linux/mfd/rpisense/joystick.h> -+#include <linux/mfd/rpisense/core.h> -+ -+static struct rpisense *rpisense; -+static unsigned char keymap[5] = {KEY_DOWN, KEY_RIGHT, KEY_UP, KEY_ENTER, KEY_LEFT,}; -+ -+static void keys_work_fn(struct work_struct *work) -+{ -+ int i; -+ static s32 prev_keys; -+ struct rpisense_js *rpisense_js = &rpisense->joystick; -+ s32 keys = rpisense_reg_read(rpisense, RPISENSE_KEYS); -+ s32 changes = keys ^ prev_keys; -+ -+ prev_keys = keys; -+ for (i = 0; i < 5; i++) { -+ if (changes & 1) { -+ input_report_key(rpisense_js->keys_dev, -+ keymap[i], keys & 1); -+ } -+ changes >>= 1; -+ keys >>= 1; -+ } -+ input_sync(rpisense_js->keys_dev); -+} -+ -+static irqreturn_t keys_irq_handler(int irq, void *pdev) -+{ -+ struct rpisense_js *rpisense_js = &rpisense->joystick; -+ -+ schedule_work(&rpisense_js->keys_work_s); -+ return IRQ_HANDLED; -+} -+ -+static int rpisense_js_probe(struct platform_device *pdev) -+{ -+ int ret; -+ int i; -+ struct rpisense_js *rpisense_js; -+ -+ rpisense = rpisense_get_dev(); -+ rpisense_js = &rpisense->joystick; -+ -+ INIT_WORK(&rpisense_js->keys_work_s, keys_work_fn); -+ -+ rpisense_js->keys_dev = input_allocate_device(); -+ if (!rpisense_js->keys_dev) { -+ dev_err(&pdev->dev, "Could not allocate input device.\n"); -+ return -ENOMEM; -+ } -+ -+ rpisense_js->keys_dev->evbit[0] = BIT_MASK(EV_KEY); -+ for (i = 0; i < ARRAY_SIZE(keymap); i++) { -+ set_bit(keymap[i], -+ rpisense_js->keys_dev->keybit); -+ } -+ -+ rpisense_js->keys_dev->name = "Raspberry Pi Sense HAT Joystick"; -+ rpisense_js->keys_dev->phys = "rpi-sense-joy/input0"; -+ rpisense_js->keys_dev->id.bustype = BUS_I2C; -+ rpisense_js->keys_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP); -+ rpisense_js->keys_dev->keycode = keymap; -+ rpisense_js->keys_dev->keycodesize = sizeof(unsigned char); -+ rpisense_js->keys_dev->keycodemax = ARRAY_SIZE(keymap); -+ -+ ret = input_register_device(rpisense_js->keys_dev); -+ if (ret) { -+ dev_err(&pdev->dev, "Could not register input device.\n"); -+ goto err_keys_alloc; -+ } -+ -+ ret = gpiod_direction_input(rpisense_js->keys_desc); -+ if (ret) { -+ dev_err(&pdev->dev, "Could not set keys-int direction.\n"); -+ goto err_keys_reg; -+ } -+ -+ rpisense_js->keys_irq = gpiod_to_irq(rpisense_js->keys_desc); -+ if (rpisense_js->keys_irq < 0) { -+ dev_err(&pdev->dev, "Could not determine keys-int IRQ.\n"); -+ ret = rpisense_js->keys_irq; -+ goto err_keys_reg; -+ } -+ -+ ret = devm_request_irq(&pdev->dev, rpisense_js->keys_irq, -+ keys_irq_handler, IRQF_TRIGGER_RISING, -+ "keys", &pdev->dev); -+ if (ret) { -+ dev_err(&pdev->dev, "IRQ request failed.\n"); -+ goto err_keys_reg; -+ } -+ return 0; -+err_keys_reg: -+ input_unregister_device(rpisense_js->keys_dev); -+err_keys_alloc: -+ input_free_device(rpisense_js->keys_dev); -+ return ret; -+} -+ -+static int rpisense_js_remove(struct platform_device *pdev) -+{ -+ struct rpisense_js *rpisense_js = &rpisense->joystick; -+ -+ input_unregister_device(rpisense_js->keys_dev); -+ input_free_device(rpisense_js->keys_dev); -+ return 0; -+} -+ -+#ifdef CONFIG_OF -+static const struct of_device_id rpisense_js_id[] = { -+ { .compatible = "rpi,rpi-sense-js" }, -+ { }, -+}; -+MODULE_DEVICE_TABLE(of, rpisense_js_id); -+#endif -+ -+static struct platform_device_id rpisense_js_device_id[] = { -+ { .name = "rpi-sense-js" }, -+ { }, -+}; -+MODULE_DEVICE_TABLE(platform, rpisense_js_device_id); -+ -+static struct platform_driver rpisense_js_driver = { -+ .probe = rpisense_js_probe, -+ .remove = rpisense_js_remove, -+ .driver = { -+ .name = "rpi-sense-js", -+ .owner = THIS_MODULE, -+ }, -+}; -+ -+module_platform_driver(rpisense_js_driver); -+ -+MODULE_DESCRIPTION("Raspberry Pi Sense HAT joystick driver"); -+MODULE_AUTHOR("Serge Schneider <serge@raspberrypi.org>"); -+MODULE_LICENSE("GPL"); -diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig -index 4d92df6..c5730dc 100644 ---- a/drivers/mfd/Kconfig -+++ b/drivers/mfd/Kconfig -@@ -10,6 +10,14 @@ config MFD_CORE - select IRQ_DOMAIN - default n - -+config MFD_RPISENSE_CORE -+ tristate "Raspberry Pi Sense HAT core functions" -+ depends on I2C -+ select MFD_CORE -+ help -+ This is the core driver for the Raspberry Pi Sense HAT. This provides -+ the necessary functions to communicate with the hardware. -+ - config MFD_CS5535 - tristate "AMD CS5535 and CS5536 southbridge core functions" - select MFD_CORE -diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile -index a8b76b8..e6339d2 100644 ---- a/drivers/mfd/Makefile -+++ b/drivers/mfd/Makefile -@@ -194,3 +194,5 @@ intel-soc-pmic-objs := intel_soc_pmic_core.o intel_soc_pmic_crc.o - intel-soc-pmic-$(CONFIG_INTEL_PMC_IPC) += intel_soc_pmic_bxtwc.o - obj-$(CONFIG_INTEL_SOC_PMIC) += intel-soc-pmic.o - obj-$(CONFIG_MFD_MT6397) += mt6397-core.o -+ -+obj-$(CONFIG_MFD_RPISENSE_CORE) += rpisense-core.o -diff --git a/drivers/mfd/rpisense-core.c b/drivers/mfd/rpisense-core.c -new file mode 100644 -index 0000000..eea9312 ---- /dev/null -+++ b/drivers/mfd/rpisense-core.c -@@ -0,0 +1,157 @@ -+/* -+ * Raspberry Pi Sense HAT core driver -+ * http://raspberrypi.org -+ * -+ * Copyright (C) 2015 Raspberry Pi -+ * -+ * Author: Serge Schneider -+ * -+ * This program is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License as published by the -+ * Free Software Foundation; either version 2 of the License, or (at your -+ * option) any later version. -+ * -+ * This driver is based on wm8350 implementation. -+ */ -+ -+#include <linux/module.h> -+#include <linux/moduleparam.h> -+#include <linux/err.h> -+#include <linux/init.h> -+#include <linux/i2c.h> -+#include <linux/platform_device.h> -+#include <linux/mfd/rpisense/core.h> -+#include <linux/slab.h> -+ -+static struct rpisense *rpisense; -+ -+static void rpisense_client_dev_register(struct rpisense *rpisense, -+ const char *name, -+ struct platform_device **pdev) -+{ -+ int ret; -+ -+ *pdev = platform_device_alloc(name, -1); -+ if (*pdev == NULL) { -+ dev_err(rpisense->dev, "Failed to allocate %s\n", name); -+ return; -+ } -+ -+ (*pdev)->dev.parent = rpisense->dev; -+ platform_set_drvdata(*pdev, rpisense); -+ ret = platform_device_add(*pdev); -+ if (ret != 0) { -+ dev_err(rpisense->dev, "Failed to register %s: %d\n", -+ name, ret); -+ platform_device_put(*pdev); -+ *pdev = NULL; -+ } -+} -+ -+static int rpisense_probe(struct i2c_client *i2c, -+ const struct i2c_device_id *id) -+{ -+ int ret; -+ struct rpisense_js *rpisense_js; -+ -+ rpisense = devm_kzalloc(&i2c->dev, sizeof(struct rpisense), GFP_KERNEL); -+ if (rpisense == NULL) -+ return -ENOMEM; -+ -+ i2c_set_clientdata(i2c, rpisense); -+ rpisense->dev = &i2c->dev; -+ rpisense->i2c_client = i2c; -+ -+ ret = rpisense_reg_read(rpisense, RPISENSE_WAI); -+ if (ret > 0) { -+ if (ret != 's') -+ return -EINVAL; -+ } else { -+ return ret; -+ } -+ ret = rpisense_reg_read(rpisense, RPISENSE_VER); -+ if (ret < 0) -+ return ret; -+ -+ dev_info(rpisense->dev, -+ "Raspberry Pi Sense HAT firmware version %i\n", ret); -+ -+ rpisense_js = &rpisense->joystick; -+ rpisense_js->keys_desc = devm_gpiod_get(&i2c->dev, -+ "keys-int", GPIOD_IN); -+ if (IS_ERR(rpisense_js->keys_desc)) { -+ dev_warn(&i2c->dev, "Failed to get keys-int descriptor.\n"); -+ rpisense_js->keys_desc = gpio_to_desc(23); -+ if (rpisense_js->keys_desc == NULL) { -+ dev_err(&i2c->dev, "GPIO23 fallback failed.\n"); -+ return PTR_ERR(rpisense_js->keys_desc); -+ } -+ } -+ rpisense_client_dev_register(rpisense, "rpi-sense-js", -+ &(rpisense->joystick.pdev)); -+ rpisense_client_dev_register(rpisense, "rpi-sense-fb", -+ &(rpisense->framebuffer.pdev)); -+ -+ return 0; -+} -+ -+static int rpisense_remove(struct i2c_client *i2c) -+{ -+ struct rpisense *rpisense = i2c_get_clientdata(i2c); -+ -+ platform_device_unregister(rpisense->joystick.pdev); -+ return 0; -+} -+ -+struct rpisense *rpisense_get_dev(void) -+{ -+ return rpisense; -+} -+EXPORT_SYMBOL_GPL(rpisense_get_dev); -+ -+s32 rpisense_reg_read(struct rpisense *rpisense, int reg) -+{ -+ int ret = i2c_smbus_read_byte_data(rpisense->i2c_client, reg); -+ -+ if (ret < 0) -+ dev_err(rpisense->dev, "Read from reg %d failed\n", reg); -+ /* Due to the BCM270x I2C clock stretching bug, some values -+ * may have MSB set. Clear it to avoid incorrect values. -+ * */ -+ return ret & 0x7F; -+} -+EXPORT_SYMBOL_GPL(rpisense_reg_read); -+ -+int rpisense_block_write(struct rpisense *rpisense, const char *buf, int count) -+{ -+ int ret = i2c_master_send(rpisense->i2c_client, buf, count); -+ -+ if (ret < 0) -+ dev_err(rpisense->dev, "Block write failed\n"); -+ return ret; -+} -+EXPORT_SYMBOL_GPL(rpisense_block_write); -+ -+static const struct i2c_device_id rpisense_i2c_id[] = { -+ { "rpi-sense", 0 }, -+ { } -+}; -+MODULE_DEVICE_TABLE(i2c, rpisense_i2c_id); -+ -+ -+static struct i2c_driver rpisense_driver = { -+ .driver = { -+ .name = "rpi-sense", -+ .owner = THIS_MODULE, -+ }, -+ .probe = rpisense_probe, -+ .remove = rpisense_remove, -+ .id_table = rpisense_i2c_id, -+}; -+ -+module_i2c_driver(rpisense_driver); -+ -+MODULE_DESCRIPTION("Raspberry Pi Sense HAT core driver"); -+MODULE_AUTHOR("Serge Schneider <serge@raspberrypi.org>"); -+MODULE_LICENSE("GPL"); -+ -diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig -index 0f33a78..4caa417 100644 ---- a/drivers/video/fbdev/Kconfig -+++ b/drivers/video/fbdev/Kconfig -@@ -2506,3 +2506,16 @@ config FB_SM712 - This driver is also available as a module. The module will be - called sm712fb. If you want to compile it as a module, say M - here and read <file:Documentation/kbuild/modules.txt>. -+ -+config FB_RPISENSE -+ tristate "Raspberry Pi Sense HAT framebuffer" -+ depends on FB -+ select MFD_RPISENSE_CORE -+ select FB_SYS_FOPS -+ select FB_SYS_FILLRECT -+ select FB_SYS_COPYAREA -+ select FB_SYS_IMAGEBLIT -+ select FB_DEFERRED_IO -+ -+ help -+ This is the framebuffer driver for the Raspberry Pi Sense HAT -diff --git a/drivers/video/fbdev/Makefile b/drivers/video/fbdev/Makefile -index 9b086ac..7101277 100644 ---- a/drivers/video/fbdev/Makefile -+++ b/drivers/video/fbdev/Makefile -@@ -150,6 +150,7 @@ obj-$(CONFIG_FB_DA8XX) += da8xx-fb.o - obj-$(CONFIG_FB_MXS) += mxsfb.o - obj-$(CONFIG_FB_SSD1307) += ssd1307fb.o - obj-$(CONFIG_FB_SIMPLE) += simplefb.o -+obj-$(CONFIG_FB_RPISENSE) += rpisense-fb.o - - # the test framebuffer is last - obj-$(CONFIG_FB_VIRTUAL) += vfb.o -diff --git a/drivers/video/fbdev/rpisense-fb.c b/drivers/video/fbdev/rpisense-fb.c -new file mode 100644 -index 0000000..26432a5 ---- /dev/null -+++ b/drivers/video/fbdev/rpisense-fb.c -@@ -0,0 +1,293 @@ -+/* -+ * Raspberry Pi Sense HAT framebuffer driver -+ * http://raspberrypi.org -+ * -+ * Copyright (C) 2015 Raspberry Pi -+ * -+ * Author: Serge Schneider -+ * -+ * This program is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License as published by the -+ * Free Software Foundation; either version 2 of the License, or (at your -+ * option) any later version. -+ * -+ */ -+ -+#include <linux/module.h> -+#include <linux/kernel.h> -+#include <linux/errno.h> -+#include <linux/string.h> -+#include <linux/mm.h> -+#include <linux/slab.h> -+#include <linux/uaccess.h> -+#include <linux/delay.h> -+#include <linux/fb.h> -+#include <linux/init.h> -+ -+#include <linux/mfd/rpisense/framebuffer.h> -+#include <linux/mfd/rpisense/core.h> -+ -+static bool lowlight; -+module_param(lowlight, bool, 0); -+MODULE_PARM_DESC(lowlight, "Reduce LED matrix brightness to one third"); -+ -+static struct rpisense *rpisense; -+ -+struct rpisense_fb_param { -+ char __iomem *vmem; -+ u8 *vmem_work; -+ u32 vmemsize; -+ u8 *gamma; -+}; -+ -+static u8 gamma_default[32] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, -+ 0x02, 0x02, 0x03, 0x03, 0x04, 0x05, 0x06, 0x07, -+ 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0E, 0x0F, 0x11, -+ 0x12, 0x14, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F,}; -+ -+static u8 gamma_low[32] = {0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, -+ 0x03, 0x03, 0x03, 0x04, 0x04, 0x05, 0x05, 0x06, -+ 0x06, 0x07, 0x07, 0x08, 0x08, 0x09, 0x0A, 0x0A,}; -+ -+static u8 gamma_user[32]; -+ -+static struct rpisense_fb_param rpisense_fb_param = { -+ .vmem = NULL, -+ .vmemsize = 128, -+ .gamma = gamma_default, -+}; -+ -+static struct fb_deferred_io rpisense_fb_defio; -+ -+static struct fb_fix_screeninfo rpisense_fb_fix = { -+ .id = "RPi-Sense FB", -+ .type = FB_TYPE_PACKED_PIXELS, -+ .visual = FB_VISUAL_TRUECOLOR, -+ .xpanstep = 0, -+ .ypanstep = 0, -+ .ywrapstep = 0, -+ .accel = FB_ACCEL_NONE, -+ .line_length = 16, -+}; -+ -+static struct fb_var_screeninfo rpisense_fb_var = { -+ .xres = 8, -+ .yres = 8, -+ .xres_virtual = 8, -+ .yres_virtual = 8, -+ .bits_per_pixel = 16, -+ .red = {11, 5, 0}, -+ .green = {5, 6, 0}, -+ .blue = {0, 5, 0}, -+}; -+ -+static ssize_t rpisense_fb_write(struct fb_info *info, -+ const char __user *buf, size_t count, -+ loff_t *ppos) -+{ -+ ssize_t res = fb_sys_write(info, buf, count, ppos); -+ -+ schedule_delayed_work(&info->deferred_work, rpisense_fb_defio.delay); -+ return res; -+} -+ -+static void rpisense_fb_fillrect(struct fb_info *info, -+ const struct fb_fillrect *rect) -+{ -+ sys_fillrect(info, rect); -+ schedule_delayed_work(&info->deferred_work, rpisense_fb_defio.delay); -+} -+ -+static void rpisense_fb_copyarea(struct fb_info *info, -+ const struct fb_copyarea *area) -+{ -+ sys_copyarea(info, area); -+ schedule_delayed_work(&info->deferred_work, rpisense_fb_defio.delay); -+} -+ -+static void rpisense_fb_imageblit(struct fb_info *info, -+ const struct fb_image *image) -+{ -+ sys_imageblit(info, image); -+ schedule_delayed_work(&info->deferred_work, rpisense_fb_defio.delay); -+} -+ -+static void rpisense_fb_deferred_io(struct fb_info *info, -+ struct list_head *pagelist) -+{ -+ int i; -+ int j; -+ u8 *vmem_work = rpisense_fb_param.vmem_work; -+ u16 *mem = (u16 *)rpisense_fb_param.vmem; -+ u8 *gamma = rpisense_fb_param.gamma; -+ -+ vmem_work[0] = 0; -+ for (j = 0; j < 8; j++) { -+ for (i = 0; i < 8; i++) { -+ vmem_work[(j * 24) + i + 1] = -+ gamma[(mem[(j * 8) + i] >> 11) & 0x1F]; -+ vmem_work[(j * 24) + (i + 8) + 1] = -+ gamma[(mem[(j * 8) + i] >> 6) & 0x1F]; -+ vmem_work[(j * 24) + (i + 16) + 1] = -+ gamma[(mem[(j * 8) + i]) & 0x1F]; -+ } -+ } -+ rpisense_block_write(rpisense, vmem_work, 193); -+} -+ -+static struct fb_deferred_io rpisense_fb_defio = { -+ .delay = HZ/100, -+ .deferred_io = rpisense_fb_deferred_io, -+}; -+ -+static int rpisense_fb_ioctl(struct fb_info *info, unsigned int cmd, -+ unsigned long arg) -+{ -+ switch (cmd) { -+ case SENSEFB_FBIOGET_GAMMA: -+ if (copy_to_user((void __user *) arg, rpisense_fb_param.gamma, -+ sizeof(u8[32]))) -+ return -EFAULT; -+ return 0; -+ case SENSEFB_FBIOSET_GAMMA: -+ if (copy_from_user(gamma_user, (void __user *)arg, -+ sizeof(u8[32]))) -+ return -EFAULT; -+ rpisense_fb_param.gamma = gamma_user; -+ schedule_delayed_work(&info->deferred_work, -+ rpisense_fb_defio.delay); -+ return 0; -+ case SENSEFB_FBIORESET_GAMMA: -+ switch (arg) { -+ case 0: -+ rpisense_fb_param.gamma = gamma_default; -+ break; -+ case 1: -+ rpisense_fb_param.gamma = gamma_low; -+ break; -+ case 2: -+ rpisense_fb_param.gamma = gamma_user; -+ break; -+ default: -+ return -EINVAL; -+ } -+ schedule_delayed_work(&info->deferred_work, -+ rpisense_fb_defio.delay); -+ break; -+ default: -+ return -EINVAL; -+ } -+ return 0; -+} -+ -+static struct fb_ops rpisense_fb_ops = { -+ .owner = THIS_MODULE, -+ .fb_read = fb_sys_read, -+ .fb_write = rpisense_fb_write, -+ .fb_fillrect = rpisense_fb_fillrect, -+ .fb_copyarea = rpisense_fb_copyarea, -+ .fb_imageblit = rpisense_fb_imageblit, -+ .fb_ioctl = rpisense_fb_ioctl, -+}; -+ -+static int rpisense_fb_probe(struct platform_device *pdev) -+{ -+ struct fb_info *info; -+ int ret = -ENOMEM; -+ struct rpisense_fb *rpisense_fb; -+ -+ rpisense = rpisense_get_dev(); -+ rpisense_fb = &rpisense->framebuffer; -+ -+ rpisense_fb_param.vmem = vzalloc(rpisense_fb_param.vmemsize); -+ if (!rpisense_fb_param.vmem) -+ return ret; -+ -+ rpisense_fb_param.vmem_work = devm_kmalloc(&pdev->dev, 193, GFP_KERNEL); -+ if (!rpisense_fb_param.vmem_work) -+ goto err_malloc; -+ -+ info = framebuffer_alloc(0, &pdev->dev); -+ if (!info) { -+ dev_err(&pdev->dev, "Could not allocate framebuffer.\n"); -+ goto err_malloc; -+ } -+ rpisense_fb->info = info; -+ -+ rpisense_fb_fix.smem_start = (unsigned long)rpisense_fb_param.vmem; -+ rpisense_fb_fix.smem_len = rpisense_fb_param.vmemsize; -+ -+ info->fbops = &rpisense_fb_ops; -+ info->fix = rpisense_fb_fix; -+ info->var = rpisense_fb_var; -+ info->fbdefio = &rpisense_fb_defio; -+ info->flags = FBINFO_FLAG_DEFAULT | FBINFO_VIRTFB; -+ info->screen_base = rpisense_fb_param.vmem; -+ info->screen_size = rpisense_fb_param.vmemsize; -+ -+ if (lowlight) -+ rpisense_fb_param.gamma = gamma_low; -+ -+ fb_deferred_io_init(info); -+ -+ ret = register_framebuffer(info); -+ if (ret < 0) { -+ dev_err(&pdev->dev, "Could not register framebuffer.\n"); -+ goto err_fballoc; -+ } -+ -+ fb_info(info, "%s frame buffer device\n", info->fix.id); -+ schedule_delayed_work(&info->deferred_work, rpisense_fb_defio.delay); -+ return 0; -+err_fballoc: -+ framebuffer_release(info); -+err_malloc: -+ vfree(rpisense_fb_param.vmem); -+ return ret; -+} -+ -+static int rpisense_fb_remove(struct platform_device *pdev) -+{ -+ struct rpisense_fb *rpisense_fb = &rpisense->framebuffer; -+ struct fb_info *info = rpisense_fb->info; -+ -+ if (info) { -+ unregister_framebuffer(info); -+ fb_deferred_io_cleanup(info); -+ framebuffer_release(info); -+ vfree(rpisense_fb_param.vmem); -+ } -+ -+ return 0; -+} -+ -+#ifdef CONFIG_OF -+static const struct of_device_id rpisense_fb_id[] = { -+ { .compatible = "rpi,rpi-sense-fb" }, -+ { }, -+}; -+MODULE_DEVICE_TABLE(of, rpisense_fb_id); -+#endif -+ -+static struct platform_device_id rpisense_fb_device_id[] = { -+ { .name = "rpi-sense-fb" }, -+ { }, -+}; -+MODULE_DEVICE_TABLE(platform, rpisense_fb_device_id); -+ -+static struct platform_driver rpisense_fb_driver = { -+ .probe = rpisense_fb_probe, -+ .remove = rpisense_fb_remove, -+ .driver = { -+ .name = "rpi-sense-fb", -+ .owner = THIS_MODULE, -+ }, -+}; -+ -+module_platform_driver(rpisense_fb_driver); -+ -+MODULE_DESCRIPTION("Raspberry Pi Sense HAT framebuffer driver"); -+MODULE_AUTHOR("Serge Schneider <serge@raspberrypi.org>"); -+MODULE_LICENSE("GPL"); -+ -diff --git a/include/linux/mfd/rpisense/core.h b/include/linux/mfd/rpisense/core.h -new file mode 100644 -index 0000000..4856aa3 ---- /dev/null -+++ b/include/linux/mfd/rpisense/core.h -@@ -0,0 +1,47 @@ -+/* -+ * Raspberry Pi Sense HAT core driver -+ * http://raspberrypi.org -+ * -+ * Copyright (C) 2015 Raspberry Pi -+ * -+ * Author: Serge Schneider -+ * -+ * This program is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License as published by the -+ * Free Software Foundation; either version 2 of the License, or (at your -+ * option) any later version. -+ * -+ */ -+ -+#ifndef __LINUX_MFD_RPISENSE_CORE_H_ -+#define __LINUX_MFD_RPISENSE_CORE_H_ -+ -+#include <linux/mfd/rpisense/joystick.h> -+#include <linux/mfd/rpisense/framebuffer.h> -+ -+/* -+ * Register values. -+ */ -+#define RPISENSE_FB 0x00 -+#define RPISENSE_WAI 0xF0 -+#define RPISENSE_VER 0xF1 -+#define RPISENSE_KEYS 0xF2 -+#define RPISENSE_EE_WP 0xF3 -+ -+#define RPISENSE_ID 's' -+ -+struct rpisense { -+ struct device *dev; -+ struct i2c_client *i2c_client; -+ -+ /* Client devices */ -+ struct rpisense_js joystick; -+ struct rpisense_fb framebuffer; -+}; -+ -+struct rpisense *rpisense_get_dev(void); -+s32 rpisense_reg_read(struct rpisense *rpisense, int reg); -+int rpisense_reg_write(struct rpisense *rpisense, int reg, u16 val); -+int rpisense_block_write(struct rpisense *rpisense, const char *buf, int count); -+ -+#endif -diff --git a/include/linux/mfd/rpisense/framebuffer.h b/include/linux/mfd/rpisense/framebuffer.h -new file mode 100644 -index 0000000..2ba95d7 ---- /dev/null -+++ b/include/linux/mfd/rpisense/framebuffer.h -@@ -0,0 +1,32 @@ -+/* -+ * Raspberry Pi Sense HAT framebuffer driver -+ * http://raspberrypi.org -+ * -+ * Copyright (C) 2015 Raspberry Pi -+ * -+ * Author: Serge Schneider -+ * -+ * This program is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License as published by the -+ * Free Software Foundation; either version 2 of the License, or (at your -+ * option) any later version. -+ * -+ */ -+ -+#ifndef __LINUX_RPISENSE_FB_H_ -+#define __LINUX_RPISENSE_FB_H_ -+ -+#define SENSEFB_FBIO_IOC_MAGIC 0xF1 -+ -+#define SENSEFB_FBIOGET_GAMMA _IO(SENSEFB_FBIO_IOC_MAGIC, 0) -+#define SENSEFB_FBIOSET_GAMMA _IO(SENSEFB_FBIO_IOC_MAGIC, 1) -+#define SENSEFB_FBIORESET_GAMMA _IO(SENSEFB_FBIO_IOC_MAGIC, 2) -+ -+struct rpisense; -+ -+struct rpisense_fb { -+ struct platform_device *pdev; -+ struct fb_info *info; -+}; -+ -+#endif -diff --git a/include/linux/mfd/rpisense/joystick.h b/include/linux/mfd/rpisense/joystick.h -new file mode 100644 -index 0000000..56196dc ---- /dev/null -+++ b/include/linux/mfd/rpisense/joystick.h -@@ -0,0 +1,35 @@ -+/* -+ * Raspberry Pi Sense HAT joystick driver -+ * http://raspberrypi.org -+ * -+ * Copyright (C) 2015 Raspberry Pi -+ * -+ * Author: Serge Schneider -+ * -+ * This program is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License as published by the -+ * Free Software Foundation; either version 2 of the License, or (at your -+ * option) any later version. -+ * -+ */ -+ -+#ifndef __LINUX_RPISENSE_JOYSTICK_H_ -+#define __LINUX_RPISENSE_JOYSTICK_H_ -+ -+#include <linux/input.h> -+#include <linux/interrupt.h> -+#include <linux/gpio/consumer.h> -+#include <linux/platform_device.h> -+ -+struct rpisense; -+ -+struct rpisense_js { -+ struct platform_device *pdev; -+ struct input_dev *keys_dev; -+ struct gpio_desc *keys_desc; -+ struct work_struct keys_work_s; -+ int keys_irq; -+}; -+ -+ -+#endif - -From c86a74aaff9bc42b3cb04881b3aaf7f822edda04 Mon Sep 17 00:00:00 2001 -From: Jan Grulich <jan@grulich.eu> -Date: Mon, 24 Aug 2015 16:03:47 +0100 -Subject: [PATCH 085/170] RaspiDAC3 support - -Signed-off-by: Jan Grulich <jan@grulich.eu> - -config: fix RaspiDAC Rev.3x dependencies - -Change depends to SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S -like the other I2S soundcard drivers. - -Signed-off-by: Matthias Reichl <hias@horus.com> ---- - sound/soc/bcm/Kconfig | 8 ++ - sound/soc/bcm/Makefile | 2 + - sound/soc/bcm/raspidac3.c | 191 ++++++++++++++++++++++++++++++++++++++++++++++ - 3 files changed, 201 insertions(+) - create mode 100644 sound/soc/bcm/raspidac3.c - -diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig -index 8669a9a..1a3f826 100644 ---- a/sound/soc/bcm/Kconfig -+++ b/sound/soc/bcm/Kconfig -@@ -56,3 +56,11 @@ config SND_BCM2708_SOC_IQAUDIO_DAC - select SND_SOC_PCM512x_I2C - help - Say Y or M if you want to add support for IQaudIO-DAC. -+ -+config SND_BCM2708_SOC_RASPIDAC3 -+ tristate "Support for RaspiDAC Rev.3x" -+ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S -+ select SND_SOC_PCM512x_I2C -+ select SND_SOC_TPA6130A2 -+ help -+ Say Y or M if you want to add support for RaspiDAC Rev.3x. -diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile -index 4f5ab1f..b21e11e 100644 ---- a/sound/soc/bcm/Makefile -+++ b/sound/soc/bcm/Makefile -@@ -11,6 +11,7 @@ snd-soc-hifiberry-amp-objs := hifiberry_amp.o - snd-soc-rpi-dac-objs := rpi-dac.o - snd-soc-rpi-proto-objs := rpi-proto.o - snd-soc-iqaudio-dac-objs := iqaudio-dac.o -+snd-soc-raspidac3-objs := raspidac3.o - - obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o - obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS) += snd-soc-hifiberry-dacplus.o -@@ -19,3 +20,4 @@ obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_AMP) += snd-soc-hifiberry-amp.o - obj-$(CONFIG_SND_BCM2708_SOC_RPI_DAC) += snd-soc-rpi-dac.o - obj-$(CONFIG_SND_BCM2708_SOC_RPI_PROTO) += snd-soc-rpi-proto.o - obj-$(CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC) += snd-soc-iqaudio-dac.o -+obj-$(CONFIG_SND_BCM2708_SOC_RASPIDAC3) += snd-soc-raspidac3.o -diff --git a/sound/soc/bcm/raspidac3.c b/sound/soc/bcm/raspidac3.c -new file mode 100644 -index 0000000..3cabf5b ---- /dev/null -+++ b/sound/soc/bcm/raspidac3.c -@@ -0,0 +1,191 @@ -+/* -+ * ASoC Driver for RaspiDAC v3 -+ * -+ * Author: Jan Grulich <jan@grulich.eu> -+ * Copyright 2015 -+ * based on code by Daniel Matuschek <daniel@hifiberry.com> -+ * based on code by Florian Meier <florian.meier@koalo.de> -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License -+ * version 2 as published by the Free Software Foundation. -+ * -+ * This program is distributed in the hope that it will be useful, but -+ * WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * General Public License for more details. -+ */ -+ -+#include <linux/module.h> -+#include <linux/platform_device.h> -+ -+#include <sound/core.h> -+#include <sound/pcm.h> -+#include <sound/pcm_params.h> -+#include <sound/soc.h> -+#include <sound/jack.h> -+#include <sound/soc-dapm.h> -+ -+#include "../codecs/pcm512x.h" -+#include "../codecs/tpa6130a2.h" -+ -+/* sound card init */ -+static int snd_rpi_raspidac3_init(struct snd_soc_pcm_runtime *rtd) -+{ -+ int ret; -+ struct snd_soc_card *card = rtd->card; -+ struct snd_soc_codec *codec = rtd->codec; -+ snd_soc_update_bits(codec, PCM512x_GPIO_EN, 0x08, 0x08); -+ snd_soc_update_bits(codec, PCM512x_GPIO_OUTPUT_4, 0xf, 0x02); -+ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x08,0x00); -+ -+ ret = snd_soc_limit_volume(card, "Digital Playback Volume", 207); -+ if (ret < 0) -+ dev_warn(card->dev, "Failed to set volume limit: %d\n", ret); -+ else { -+ struct snd_kcontrol *kctl; -+ -+ ret = tpa6130a2_add_controls(codec); -+ if (ret < 0) -+ dev_warn(card->dev, "Failed to add TPA6130A2 controls: %d\n", -+ ret); -+ ret = snd_soc_limit_volume(card, -+ "TPA6130A2 Headphone Playback Volume", -+ 54); -+ if (ret < 0) -+ dev_warn(card->dev, "Failed to set TPA6130A2 volume limit: %d\n", -+ ret); -+ kctl = snd_soc_card_get_kcontrol(card, -+ "TPA6130A2 Headphone Playback Volume"); -+ if (kctl) { -+ strcpy(kctl->id.name, "Headphones Playback Volume"); -+ /* disable the volume dB scale so alsamixer works */ -+ kctl->vd[0].access = SNDRV_CTL_ELEM_ACCESS_READWRITE; -+ } -+ -+ kctl = snd_soc_card_get_kcontrol(card, -+ "TPA6130A2 Headphone Playback Switch"); -+ if (kctl) -+ strcpy(kctl->id.name, "Headphones Playback Switch"); -+ } -+ -+ return 0; -+} -+ -+/* set hw parameters */ -+static int snd_rpi_raspidac3_hw_params(struct snd_pcm_substream *substream, -+ struct snd_pcm_hw_params *params) -+{ -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; -+ -+ unsigned int sample_bits = -+ snd_pcm_format_physical_width(params_format(params)); -+ -+ return snd_soc_dai_set_bclk_ratio(cpu_dai, sample_bits * 2); -+} -+ -+/* startup */ -+static int snd_rpi_raspidac3_startup(struct snd_pcm_substream *substream) { -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_codec *codec = rtd->codec; -+ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x08,0x08); -+ tpa6130a2_stereo_enable(codec, 1); -+ return 0; -+} -+ -+/* shutdown */ -+static void snd_rpi_raspidac3_shutdown(struct snd_pcm_substream *substream) { -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_codec *codec = rtd->codec; -+ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x08,0x00); -+ tpa6130a2_stereo_enable(codec, 0); -+} -+ -+/* machine stream operations */ -+static struct snd_soc_ops snd_rpi_raspidac3_ops = { -+ .hw_params = snd_rpi_raspidac3_hw_params, -+ .startup = snd_rpi_raspidac3_startup, -+ .shutdown = snd_rpi_raspidac3_shutdown, -+}; -+ -+/* interface setup */ -+static struct snd_soc_dai_link snd_rpi_raspidac3_dai[] = { -+{ -+ .name = "RaspiDAC Rev.3x", -+ .stream_name = "RaspiDAC HiFi", -+ .cpu_dai_name = "bcm2708-i2s.0", -+ .codec_dai_name = "pcm512x-hifi", -+ .platform_name = "bcm2708-i2s.0", -+ .codec_name = "pcm512x.1-004c", -+ .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | -+ SND_SOC_DAIFMT_CBS_CFS, -+ .ops = &snd_rpi_raspidac3_ops, -+ .init = snd_rpi_raspidac3_init, -+}, -+}; -+ -+/* audio machine driver */ -+static struct snd_soc_card snd_rpi_raspidac3 = { -+ .name = "RaspiDAC Rev.3x HiFi Audio Card", -+ .dai_link = snd_rpi_raspidac3_dai, -+ .num_links = ARRAY_SIZE(snd_rpi_raspidac3_dai), -+}; -+ -+/* sound card test */ -+static int snd_rpi_raspidac3_probe(struct platform_device *pdev) -+{ -+ int ret = 0; -+ -+ snd_rpi_raspidac3.dev = &pdev->dev; -+ -+ if (pdev->dev.of_node) { -+ struct device_node *i2s_node; -+ struct snd_soc_dai_link *dai = &snd_rpi_raspidac3_dai[0]; -+ i2s_node = of_parse_phandle(pdev->dev.of_node, -+ "i2s-controller", 0); -+ -+ if (i2s_node) { -+ dai->cpu_dai_name = NULL; -+ dai->cpu_of_node = i2s_node; -+ dai->platform_name = NULL; -+ dai->platform_of_node = i2s_node; -+ } -+ } -+ -+ ret = snd_soc_register_card(&snd_rpi_raspidac3); -+ if (ret) -+ dev_err(&pdev->dev, -+ "snd_soc_register_card() failed: %d\n", ret); -+ -+ return ret; -+} -+ -+/* sound card disconnect */ -+static int snd_rpi_raspidac3_remove(struct platform_device *pdev) -+{ -+ return snd_soc_unregister_card(&snd_rpi_raspidac3); -+} -+ -+static const struct of_device_id raspidac3_of_match[] = { -+ { .compatible = "jg,raspidacv3", }, -+ {}, -+}; -+MODULE_DEVICE_TABLE(of, raspidac3_of_match); -+ -+/* sound card platform driver */ -+static struct platform_driver snd_rpi_raspidac3_driver = { -+ .driver = { -+ .name = "snd-rpi-raspidac3", -+ .owner = THIS_MODULE, -+ .of_match_table = raspidac3_of_match, -+ }, -+ .probe = snd_rpi_raspidac3_probe, -+ .remove = snd_rpi_raspidac3_remove, -+}; -+ -+module_platform_driver(snd_rpi_raspidac3_driver); -+ -+MODULE_AUTHOR("Jan Grulich <jan@grulich.eu>"); -+MODULE_DESCRIPTION("ASoC Driver for RaspiDAC Rev.3x"); -+MODULE_LICENSE("GPL v2"); - -From 2d340e2fbbc9f4735b798601a43ae9f0f4cc5742 Mon Sep 17 00:00:00 2001 -From: Jan Grulich <jan@grulich.eu> -Date: Mon, 24 Aug 2015 16:02:34 +0100 -Subject: [PATCH 086/170] tpa6130a2: Add headphone switch control - -Signed-off-by: Jan Grulich <jan@grulich.eu> ---- - sound/soc/codecs/tpa6130a2.c | 29 ++++++++++++++++++++++++++--- - 1 file changed, 26 insertions(+), 3 deletions(-) - -diff --git a/sound/soc/codecs/tpa6130a2.c b/sound/soc/codecs/tpa6130a2.c -index 11d85c5..3caaa17 100644 ---- a/sound/soc/codecs/tpa6130a2.c -+++ b/sound/soc/codecs/tpa6130a2.c -@@ -4,6 +4,7 @@ - * Copyright (C) Nokia Corporation - * - * Author: Peter Ujfalusi <peter.ujfalusi@ti.com> -+ * Modified: Jan Grulich <jan@grulich.eu> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License -@@ -52,6 +53,8 @@ struct tpa6130a2_data { - enum tpa_model id; - }; - -+static void tpa6130a2_channel_enable(u8 channel, int enable); -+ - static int tpa6130a2_i2c_read(int reg) - { - struct tpa6130a2_data *data; -@@ -189,7 +192,7 @@ static int tpa6130a2_power(u8 power) - } - - static int tpa6130a2_get_volsw(struct snd_kcontrol *kcontrol, -- struct snd_ctl_elem_value *ucontrol) -+ struct snd_ctl_elem_value *ucontrol) - { - struct soc_mixer_control *mc = - (struct soc_mixer_control *)kcontrol->private_value; -@@ -218,7 +221,7 @@ static int tpa6130a2_get_volsw(struct snd_kcontrol *kcontrol, - } - - static int tpa6130a2_put_volsw(struct snd_kcontrol *kcontrol, -- struct snd_ctl_elem_value *ucontrol) -+ struct snd_ctl_elem_value *ucontrol) - { - struct soc_mixer_control *mc = - (struct soc_mixer_control *)kcontrol->private_value; -@@ -255,8 +258,22 @@ static int tpa6130a2_put_volsw(struct snd_kcontrol *kcontrol, - return 1; - } - -+static int tpa6130a2_put_hp_sw(struct snd_kcontrol *kcontrol, -+ struct snd_ctl_elem_value *ucontrol) -+{ -+ int enable = ucontrol->value.integer.value[0]; -+ unsigned int state; -+ -+ state = (tpa6130a2_read(TPA6130A2_REG_VOL_MUTE) & 0x80) == 0; -+ if (state == enable) -+ return 0; /* No change */ -+ -+ tpa6130a2_channel_enable(TPA6130A2_HP_EN_R | TPA6130A2_HP_EN_L, enable); -+ return 1; /* Changed */ -+} -+ - /* -- * TPA6130 volume. From -59.5 to 4 dB with increasing step size when going -+ * TPA6130 volume. From -59.5 to +4.0 dB with increasing step size when going - * down in gain. - */ - static const DECLARE_TLV_DB_RANGE(tpa6130_tlv, -@@ -277,6 +294,9 @@ static const struct snd_kcontrol_new tpa6130a2_controls[] = { - TPA6130A2_REG_VOL_MUTE, 0, 0x3f, 0, - tpa6130a2_get_volsw, tpa6130a2_put_volsw, - tpa6130_tlv), -+ SOC_SINGLE_EXT("TPA6130A2 Headphone Playback Switch", -+ TPA6130A2_REG_VOL_MUTE, 7, 1, 1, -+ tpa6130a2_get_volsw, tpa6130a2_put_hp_sw), - }; - - static const DECLARE_TLV_DB_RANGE(tpa6140_tlv, -@@ -290,6 +310,9 @@ static const struct snd_kcontrol_new tpa6140a2_controls[] = { - TPA6130A2_REG_VOL_MUTE, 1, 0x1f, 0, - tpa6130a2_get_volsw, tpa6130a2_put_volsw, - tpa6140_tlv), -+ SOC_SINGLE_EXT("TPA6140A2 Headphone Playback Switch", -+ TPA6130A2_REG_VOL_MUTE, 7, 1, 1, -+ tpa6130a2_get_volsw, tpa6130a2_put_hp_sw), - }; - - /* - -From 6fc9d40bec5dbcf3ae8b52ab6850ed0b18193c82 Mon Sep 17 00:00:00 2001 -From: popcornmix <popcornmix@gmail.com> -Date: Mon, 28 Sep 2015 23:38:59 +0100 -Subject: [PATCH 087/170] irq-bcm2835: Fix building with 2708 - ---- - drivers/irqchip/irq-bcm2835.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/drivers/irqchip/irq-bcm2835.c b/drivers/irqchip/irq-bcm2835.c -index 20deb28..c02bf8a 100644 ---- a/drivers/irqchip/irq-bcm2835.c -+++ b/drivers/irqchip/irq-bcm2835.c -@@ -82,6 +82,7 @@ - #define NR_BANKS 3 - #define IRQS_PER_BANK 32 - #define NUMBER_IRQS MAKE_HWIRQ(NR_BANKS, 0) -+#undef FIQ_START - #define FIQ_START (NR_IRQS_BANK0 + MAKE_HWIRQ(NR_BANKS - 1, 0)) - - static const int reg_pending[] __initconst = { 0x00, 0x04, 0x08 }; -@@ -256,7 +257,7 @@ static int __init armctrl_of_init(struct device_node *node, - MAKE_HWIRQ(b, i) + NUMBER_IRQS); - BUG_ON(irq <= 0); - irq_set_chip(irq, &armctrl_chip); -- set_irq_flags(irq, IRQF_VALID | IRQF_PROBE); -+ irq_set_probe(irq); - } - } - init_FIQ(FIQ_START); - -From 0e7ec1e61b149567d5af63169cd4d701c133356f Mon Sep 17 00:00:00 2001 -From: P33M <P33M@github.com> -Date: Wed, 21 Oct 2015 14:55:21 +0100 -Subject: [PATCH 088/170] rpi_display: add backlight driver and overlay - -Add a mailbox-driven backlight controller for the Raspberry Pi DSI -touchscreen display. Requires updated GPU firmware to recognise the -mailbox request. - -Signed-off-by: Gordon Hollingworth <gordon@raspberrypi.org> ---- - arch/arm/boot/dts/overlays/Makefile | 1 + - arch/arm/boot/dts/overlays/README | 6 ++ - .../boot/dts/overlays/rpi-backlight-overlay.dts | 21 ++++ - arch/arm/configs/bcm2709_defconfig | 1 + - arch/arm/configs/bcmrpi_defconfig | 1 + - drivers/video/backlight/Kconfig | 6 ++ - drivers/video/backlight/Makefile | 1 + - drivers/video/backlight/rpi_backlight.c | 119 +++++++++++++++++++++ - include/soc/bcm2835/raspberrypi-firmware.h | 1 + - 9 files changed, 157 insertions(+) - create mode 100644 arch/arm/boot/dts/overlays/rpi-backlight-overlay.dts - create mode 100644 drivers/video/backlight/rpi_backlight.c - -diff --git a/arch/arm/boot/dts/overlays/Makefile b/arch/arm/boot/dts/overlays/Makefile -index d8c2771..fb7ac49 100644 ---- a/arch/arm/boot/dts/overlays/Makefile -+++ b/arch/arm/boot/dts/overlays/Makefile -@@ -38,6 +38,7 @@ dtb-$(RPI_DT_OVERLAYS) += pps-gpio-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += pwm-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += pwm-2chan-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += raspidac3-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += rpi-backlight-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += rpi-dac-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += rpi-display-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += rpi-ft5406-overlay.dtb -diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README -index 44e33a4..b819293 100644 ---- a/arch/arm/boot/dts/overlays/README -+++ b/arch/arm/boot/dts/overlays/README -@@ -462,6 +462,12 @@ Load: dtoverlay=raspidac3 - Params: <None> - - -+Name: rpi-backlight -+Info: Raspberry Pi official display backlight driver -+Load: dtoverlay=rpi-backlight -+Params: <None> -+ -+ - Name: rpi-dac - Info: Configures the RPi DAC audio card - Load: dtoverlay=rpi-dac -diff --git a/arch/arm/boot/dts/overlays/rpi-backlight-overlay.dts b/arch/arm/boot/dts/overlays/rpi-backlight-overlay.dts -new file mode 100644 -index 0000000..c021d02 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/rpi-backlight-overlay.dts -@@ -0,0 +1,21 @@ -+/* -+ * Devicetree overlay for mailbox-driven Raspberry Pi DSI Display -+ * backlight controller -+ */ -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target-path = "/"; -+ __overlay__ { -+ rpi_backlight: rpi_backlight { -+ compatible = "raspberrypi,rpi-backlight"; -+ firmware = <&firmware>; -+ status = "okay"; -+ }; -+ }; -+ }; -+}; -diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig -index 16062bf..13999af 100644 ---- a/arch/arm/configs/bcm2709_defconfig -+++ b/arch/arm/configs/bcm2709_defconfig -@@ -808,6 +808,7 @@ CONFIG_FB_UDL=m - CONFIG_FB_SSD1307=m - CONFIG_FB_RPISENSE=m - # CONFIG_BACKLIGHT_GENERIC is not set -+CONFIG_BACKLIGHT_RPI=m - CONFIG_BACKLIGHT_GPIO=m - CONFIG_FRAMEBUFFER_CONSOLE=y - CONFIG_LOGO=y -diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig -index 1d1b799..146add9 100644 ---- a/arch/arm/configs/bcmrpi_defconfig -+++ b/arch/arm/configs/bcmrpi_defconfig -@@ -801,6 +801,7 @@ CONFIG_FB_UDL=m - CONFIG_FB_SSD1307=m - CONFIG_FB_RPISENSE=m - # CONFIG_BACKLIGHT_GENERIC is not set -+CONFIG_BACKLIGHT_RPI=m - CONFIG_BACKLIGHT_GPIO=m - CONFIG_FRAMEBUFFER_CONSOLE=y - CONFIG_LOGO=y -diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig -index 5ffa4b4..c3023ab 100644 ---- a/drivers/video/backlight/Kconfig -+++ b/drivers/video/backlight/Kconfig -@@ -265,6 +265,12 @@ config BACKLIGHT_PWM - If you have a LCD backlight adjustable by PWM, say Y to enable - this driver. - -+config BACKLIGHT_RPI -+ tristate "Raspberry Pi display firmware driven backlight" -+ help -+ If you have the Raspberry Pi DSI touchscreen display, say Y to -+ enable the mailbox-controlled backlight driver. -+ - config BACKLIGHT_DA903X - tristate "Backlight Driver for DA9030/DA9034 using WLED" - depends on PMIC_DA903X -diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile -index 16ec534..00eff87 100644 ---- a/drivers/video/backlight/Makefile -+++ b/drivers/video/backlight/Makefile -@@ -50,6 +50,7 @@ obj-$(CONFIG_BACKLIGHT_PANDORA) += pandora_bl.o - obj-$(CONFIG_BACKLIGHT_PCF50633) += pcf50633-backlight.o - obj-$(CONFIG_BACKLIGHT_PM8941_WLED) += pm8941-wled.o - obj-$(CONFIG_BACKLIGHT_PWM) += pwm_bl.o -+obj-$(CONFIG_BACKLIGHT_RPI) += rpi_backlight.o - obj-$(CONFIG_BACKLIGHT_SAHARA) += kb3886_bl.o - obj-$(CONFIG_BACKLIGHT_SKY81452) += sky81452-backlight.o - obj-$(CONFIG_BACKLIGHT_TOSA) += tosa_bl.o -diff --git a/drivers/video/backlight/rpi_backlight.c b/drivers/video/backlight/rpi_backlight.c -new file mode 100644 -index 0000000..14a0d9b ---- /dev/null -+++ b/drivers/video/backlight/rpi_backlight.c -@@ -0,0 +1,119 @@ -+/* -+ * rpi_bl.c - Backlight controller through VPU -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 as -+ * published by the Free Software Foundation. -+ */ -+ -+#include <linux/backlight.h> -+#include <linux/err.h> -+#include <linux/fb.h> -+#include <linux/gpio.h> -+#include <linux/init.h> -+#include <linux/kernel.h> -+#include <linux/module.h> -+#include <linux/of.h> -+#include <linux/of_gpio.h> -+#include <linux/platform_device.h> -+#include <linux/slab.h> -+#include <soc/bcm2835/raspberrypi-firmware.h> -+ -+struct rpi_backlight { -+ struct device *dev; -+ struct device *fbdev; -+ struct rpi_firmware *fw; -+}; -+ -+static int rpi_backlight_update_status(struct backlight_device *bl) -+{ -+ struct rpi_backlight *gbl = bl_get_data(bl); -+ int brightness = bl->props.brightness; -+ int ret; -+ -+ if (bl->props.power != FB_BLANK_UNBLANK || -+ bl->props.fb_blank != FB_BLANK_UNBLANK || -+ bl->props.state & (BL_CORE_SUSPENDED | BL_CORE_FBBLANK)) -+ brightness = 0; -+ -+ ret = rpi_firmware_property(gbl->fw, -+ RPI_FIRMWARE_FRAMEBUFFER_SET_BACKLIGHT, -+ &brightness, sizeof(brightness)); -+ if (ret) { -+ dev_err(gbl->dev, "Failed to set brightness\n"); -+ return ret; -+ } -+ -+ if (brightness < 0) { -+ dev_err(gbl->dev, "Backlight change failed\n"); -+ return -EAGAIN; -+ } -+ -+ return 0; -+} -+ -+static const struct backlight_ops rpi_backlight_ops = { -+ .options = BL_CORE_SUSPENDRESUME, -+ .update_status = rpi_backlight_update_status, -+}; -+ -+static int rpi_backlight_probe(struct platform_device *pdev) -+{ -+ struct backlight_properties props; -+ struct backlight_device *bl; -+ struct rpi_backlight *gbl; -+ struct device_node *fw_node; -+ -+ gbl = devm_kzalloc(&pdev->dev, sizeof(*gbl), GFP_KERNEL); -+ if (gbl == NULL) -+ return -ENOMEM; -+ -+ gbl->dev = &pdev->dev; -+ -+ fw_node = of_parse_phandle(pdev->dev.of_node, "firmware", 0); -+ if (!fw_node) { -+ dev_err(&pdev->dev, "Missing firmware node\n"); -+ return -ENOENT; -+ } -+ -+ gbl->fw = rpi_firmware_get(fw_node); -+ if (!gbl->fw) -+ return -EPROBE_DEFER; -+ -+ memset(&props, 0, sizeof(props)); -+ props.type = BACKLIGHT_RAW; -+ props.max_brightness = 255; -+ bl = devm_backlight_device_register(&pdev->dev, dev_name(&pdev->dev), -+ &pdev->dev, gbl, &rpi_backlight_ops, -+ &props); -+ if (IS_ERR(bl)) { -+ dev_err(&pdev->dev, "failed to register backlight\n"); -+ return PTR_ERR(bl); -+ } -+ -+ bl->props.brightness = 255; -+ backlight_update_status(bl); -+ -+ platform_set_drvdata(pdev, bl); -+ return 0; -+} -+ -+static const struct of_device_id rpi_backlight_of_match[] = { -+ { .compatible = "raspberrypi,rpi-backlight" }, -+ { /* sentinel */ } -+}; -+MODULE_DEVICE_TABLE(of, rpi_backlight_of_match); -+ -+static struct platform_driver rpi_backlight_driver = { -+ .driver = { -+ .name = "rpi-backlight", -+ .of_match_table = of_match_ptr(rpi_backlight_of_match), -+ }, -+ .probe = rpi_backlight_probe, -+}; -+ -+module_platform_driver(rpi_backlight_driver); -+ -+MODULE_AUTHOR("Gordon Hollingworth <gordon@raspberrypi.org>"); -+MODULE_DESCRIPTION("Raspberry Pi mailbox based Backlight Driver"); -+MODULE_LICENSE("GPL"); -diff --git a/include/soc/bcm2835/raspberrypi-firmware.h b/include/soc/bcm2835/raspberrypi-firmware.h -index 525816d..b011489 100644 ---- a/include/soc/bcm2835/raspberrypi-firmware.h -+++ b/include/soc/bcm2835/raspberrypi-firmware.h -@@ -112,6 +112,7 @@ enum rpi_firmware_property_tag { - RPI_FIRMWARE_FRAMEBUFFER_SET_OVERSCAN = 0x0004800a, - RPI_FIRMWARE_FRAMEBUFFER_SET_PALETTE = 0x0004800b, - RPI_FIRMWARE_FRAMEBUFFER_SET_VSYNC = 0x0004800e, -+ RPI_FIRMWARE_FRAMEBUFFER_SET_BACKLIGHT = 0x0004800f, - - RPI_FIRMWARE_VCHIQ_INIT = 0x00048010, - - -From 0459ca97c1f2753ce805ab58ff17847cb4c142e0 Mon Sep 17 00:00:00 2001 -From: Matthias Reichl <hias@horus.com> -Date: Mon, 16 Nov 2015 14:05:35 +0000 -Subject: [PATCH 089/170] bcm2835-dma: Fix up convert to DMA pool - ---- - drivers/dma/bcm2835-dma.c | 36 ++++++++++++++++++++++++++---------- - 1 file changed, 26 insertions(+), 10 deletions(-) - -diff --git a/drivers/dma/bcm2835-dma.c b/drivers/dma/bcm2835-dma.c -index 0adc347..985019b 100644 ---- a/drivers/dma/bcm2835-dma.c -+++ b/drivers/dma/bcm2835-dma.c -@@ -488,6 +488,17 @@ static struct dma_async_tx_descriptor *bcm2835_dma_prep_dma_cyclic( - c->cyclic = true; - - return vchan_tx_prep(&c->vc, &d->vd, flags); -+error_cb: -+ i--; -+ for (; i >= 0; i--) { -+ struct bcm2835_cb_entry *cb_entry = &d->cb_list[i]; -+ -+ dma_pool_free(c->cb_pool, cb_entry->cb, cb_entry->paddr); -+ } -+ -+ kfree(d->cb_list); -+ kfree(d); -+ return NULL; - } - - static struct dma_async_tx_descriptor * -@@ -534,6 +545,7 @@ bcm2835_dma_prep_slave_sg(struct dma_chan *chan, - if (!d) - return NULL; - -+ d->c = c; - d->dir = direction; - - if (c->ch >= 8) /* LITE channel */ -@@ -553,15 +565,21 @@ bcm2835_dma_prep_slave_sg(struct dma_chan *chan, - d->frames += len / max_size + 1; - } - -- /* Allocate memory for control blocks */ -- d->control_block_size = d->frames * sizeof(struct bcm2835_dma_cb); -- d->control_block_base = dma_zalloc_coherent(chan->device->dev, -- d->control_block_size, &d->control_block_base_phys, -- GFP_NOWAIT); -- if (!d->control_block_base) { -+ d->cb_list = kcalloc(d->frames, sizeof(*d->cb_list), GFP_KERNEL); -+ if (!d->cb_list) { - kfree(d); - return NULL; - } -+ /* Allocate memory for control blocks */ -+ for (i = 0; i < d->frames; i++) { -+ struct bcm2835_cb_entry *cb_entry = &d->cb_list[i]; -+ -+ cb_entry->cb = dma_pool_zalloc(c->cb_pool, GFP_ATOMIC, -+ &cb_entry->paddr); -+ -+ if (!cb_entry->cb) -+ goto error_cb; -+ } - - /* - * Iterate over all SG entries, create a control block -@@ -578,7 +596,7 @@ bcm2835_dma_prep_slave_sg(struct dma_chan *chan, - - for (j = 0; j < len; j += max_size) { - struct bcm2835_dma_cb *control_block = -- &d->control_block_base[i + split_cnt]; -+ d->cb_list[i + split_cnt].cb; - - /* Setup addresses */ - if (d->dir == DMA_DEV_TO_MEM) { -@@ -620,9 +638,7 @@ bcm2835_dma_prep_slave_sg(struct dma_chan *chan, - if (i < sg_len - 1 || len - j > max_size) { - /* Next block is the next frame. */ - control_block->next = -- d->control_block_base_phys + -- sizeof(struct bcm2835_dma_cb) * -- (i + split_cnt + 1); -+ d->cb_list[i + split_cnt + 1].paddr; - } else { - /* Next block is empty. */ - control_block->next = 0; - -From f6dd60426dc7970ef4e9e3d9e00d374f80a6abd2 Mon Sep 17 00:00:00 2001 -From: Phil Elwell <phil@raspberrypi.org> -Date: Wed, 11 Nov 2015 11:38:59 +0000 -Subject: [PATCH 090/170] scripts: Multi-platform support for mkknlimg and - knlinfo - -The firmware uses tags in the kernel trailer to choose which dtb file -to load. Current firmware loads bcm2835-*.dtb if the '283x' tag is true, -otherwise it loads bcm270*.dtb. This scheme breaks if an image supports -multiple platforms. - -This patch adds '270X' and '283X' tags to indicate support for RPi and -upstream platforms, respectively. '283x' (note lower case 'x') is left -for old firmware, and is only set if the image only supports upstream -builds. ---- - scripts/knlinfo | 2 + - scripts/mkknlimg | 136 +++++++++++++++++++++++++++++++------------------------ - 2 files changed, 80 insertions(+), 58 deletions(-) - -diff --git a/scripts/knlinfo b/scripts/knlinfo -index a0e8663..b9ef124 100755 ---- a/scripts/knlinfo -+++ b/scripts/knlinfo -@@ -18,6 +18,8 @@ my %atom_formats = - ( - 'DTOK' => \&format_bool, - 'KVer' => \&format_string, -+ '270X' => \&format_bool, -+ '283X' => \&format_bool, - '283x' => \&format_bool, - ); - -diff --git a/scripts/mkknlimg b/scripts/mkknlimg -index 3998d43..005f404 100755 ---- a/scripts/mkknlimg -+++ b/scripts/mkknlimg -@@ -13,12 +13,20 @@ use strict; - use warnings; - use integer; - -+use constant FLAG_PI => 0x01; -+use constant FLAG_DTOK => 0x02; -+use constant FLAG_DDTK => 0x04; -+use constant FLAG_270X => 0x08; -+use constant FLAG_283X => 0x10; -+ - my $trailer_magic = 'RPTL'; - - my $tmpfile1 = "/tmp/mkknlimg_$$.1"; - my $tmpfile2 = "/tmp/mkknlimg_$$.2"; - - my $dtok = 0; -+my $ddtk = 0; -+my $is_270x = 0; - my $is_283x = 0; - - while (@ARGV && ($ARGV[0] =~ /^-/)) -@@ -28,6 +36,14 @@ while (@ARGV && ($ARGV[0] =~ /^-/)) - { - $dtok = 1; - } -+ elsif ($arg eq '--ddtk') -+ { -+ $ddtk = 1; -+ } -+ elsif ($arg eq '--270x') -+ { -+ $is_270x = 1; -+ } - elsif ($arg eq '--283x') - { - $is_283x = 1; -@@ -50,30 +66,33 @@ if (! -r $kernel_file) - usage(); - } - --my @wanted_strings = --( -- 'bcm2708_fb', -- 'brcm,bcm2835-mmc', -- 'brcm,bcm2835-sdhost', -- 'brcm,bcm2708-pinctrl', -- 'brcm,bcm2835-gpio', -- 'brcm,bcm2835', -- 'brcm,bcm2836' --); -+my $wanted_strings = -+{ -+ 'bcm2708_fb' => FLAG_PI, -+ 'brcm,bcm2835-mmc' => FLAG_PI, -+ 'brcm,bcm2835-sdhost' => FLAG_PI, -+ 'brcm,bcm2708-pinctrl' => FLAG_PI | FLAG_DTOK, -+ 'brcm,bcm2835-gpio' => FLAG_PI | FLAG_DTOK, -+ 'brcm,bcm2708' => FLAG_PI | FLAG_DTOK | FLAG_270X, -+ 'brcm,bcm2709' => FLAG_PI | FLAG_DTOK | FLAG_270X, -+ 'brcm,bcm2835' => FLAG_PI | FLAG_DTOK | FLAG_283X, -+ 'brcm,bcm2836' => FLAG_PI | FLAG_DTOK | FLAG_283X, -+ 'of_overlay_apply' => FLAG_DTOK | FLAG_DDTK, -+}; - - my $res = try_extract($kernel_file, $tmpfile1); --$res = try_decompress('\037\213\010', 'xy', 'gunzip', 0, -- $kernel_file, $tmpfile1, $tmpfile2) if (!$res); --$res = try_decompress('\3757zXZ\000', 'abcde', 'unxz --single-stream', -1, -- $kernel_file, $tmpfile1, $tmpfile2) if (!$res); --$res = try_decompress('BZh', 'xy', 'bunzip2', 0, -- $kernel_file, $tmpfile1, $tmpfile2) if (!$res); --$res = try_decompress('\135\0\0\0', 'xxx', 'unlzma', 0, -- $kernel_file, $tmpfile1, $tmpfile2) if (!$res); --$res = try_decompress('\211\114\132', 'xy', 'lzop -d', 0, -- $kernel_file, $tmpfile1, $tmpfile2) if (!$res); --$res = try_decompress('\002\041\114\030', 'xy', 'lz4 -d', 1, -- $kernel_file, $tmpfile1, $tmpfile2) if (!$res); -+$res ||= try_decompress('\037\213\010', 'xy', 'gunzip', 0, -+ $kernel_file, $tmpfile1, $tmpfile2); -+$res ||= try_decompress('\3757zXZ\000', 'abcde', 'unxz --single-stream', -1, -+ $kernel_file, $tmpfile1, $tmpfile2); -+$res ||= try_decompress('BZh', 'xy', 'bunzip2', 0, -+ $kernel_file, $tmpfile1, $tmpfile2); -+$res ||= try_decompress('\135\0\0\0', 'xxx', 'unlzma', 0, -+ $kernel_file, $tmpfile1, $tmpfile2); -+$res ||= try_decompress('\211\114\132', 'xy', 'lzop -d', 0, -+ $kernel_file, $tmpfile1, $tmpfile2); -+$res ||= try_decompress('\002\041\114\030', 'xy', 'lz4 -d', 1, -+ $kernel_file, $tmpfile1, $tmpfile2); - - my $append_trailer; - my $trailer; -@@ -83,27 +102,21 @@ $append_trailer = $dtok; - - if ($res) - { -- $kver = $res->{''} || '?'; -+ $kver = $res->{'kver'} || '?'; -+ my $flags = $res->{'flags'}; - print("Version: $kver\n"); - -- $append_trailer = $dtok; -- if (!$dtok) -+ if ($flags & FLAG_PI) - { -- if (config_bool($res, 'bcm2708_fb') || -- config_bool($res, 'brcm,bcm2835-mmc') || -- config_bool($res, 'brcm,bcm2835-sdhost')) -- { -- $dtok ||= config_bool($res, 'brcm,bcm2708-pinctrl'); -- $dtok ||= config_bool($res, 'brcm,bcm2835-gpio'); -- $is_283x ||= config_bool($res, 'brcm,bcm2835'); -- $is_283x ||= config_bool($res, 'brcm,bcm2836'); -- $dtok ||= $is_283x; -- $append_trailer = 1; -- } -- else -- { -- print ("* This doesn't look like a Raspberry Pi kernel. In pass-through mode.\n"); -- } -+ $append_trailer = 1; -+ $dtok ||= ($flags & FLAG_DTOK) != 0; -+ $is_270x ||= ($flags & FLAG_270X) != 0; -+ $is_283x ||= ($flags & FLAG_283X) != 0; -+ $ddtk ||= ($flags & FLAG_DDTK) != 0; -+ } -+ else -+ { -+ print ("* This doesn't look like a Raspberry Pi kernel. In pass-through mode.\n"); - } - } - elsif (!$dtok) -@@ -114,6 +127,8 @@ elsif (!$dtok) - if ($append_trailer) - { - printf("DT: %s\n", $dtok ? "y" : "n"); -+ printf("DDT: %s\n", $ddtk ? "y" : "n") if ($ddtk); -+ printf("270x: %s\n", $is_270x ? "y" : "n"); - printf("283x: %s\n", $is_283x ? "y" : "n"); - - my @atoms; -@@ -121,7 +136,10 @@ if ($append_trailer) - push @atoms, [ $trailer_magic, pack('V', 0) ]; - push @atoms, [ 'KVer', $kver ]; - push @atoms, [ 'DTOK', pack('V', $dtok) ]; -- push @atoms, [ '283x', pack('V', $is_283x) ]; -+ push @atoms, [ 'DDTK', pack('V', $ddtk) ] if ($ddtk); -+ push @atoms, [ '270X', pack('V', $is_270x) ]; -+ push @atoms, [ '283X', pack('V', $is_283x) ]; -+ push @atoms, [ '283x', pack('V', $is_283x && !$is_270x) ]; - - $trailer = pack_trailer(\@atoms); - $atoms[0]->[1] = pack('V', length($trailer)); -@@ -175,7 +193,7 @@ END { - - sub usage - { -- print ("Usage: mkknlimg [--dtok] [--283x] <vmlinux|zImage|bzImage> <outfile>\n"); -+ print ("Usage: mkknlimg [--dtok] [--270x] [--283x] <vmlinux|zImage|bzImage> <outfile>\n"); - exit(1); - } - -@@ -189,15 +207,8 @@ sub try_extract - - chomp($ver); - -- my $res = { ''=>$ver }; -- my $string_pattern = '^('.join('|', @wanted_strings).')$'; -- -- my @matches = `strings \"$knl\" | grep -E \"$string_pattern\"`; -- foreach my $match (@matches) -- { -- chomp($match); -- $res->{$match} = 1; -- } -+ my $res = { 'kver'=>$ver }; -+ $res->{'flags'} = strings_to_flags($knl, $wanted_strings); - - return $res; - } -@@ -224,6 +235,22 @@ sub try_decompress - return undef; - } - -+sub strings_to_flags -+{ -+ my ($knl, $strings) = @_; -+ my $string_pattern = '^('.join('|', keys(%$strings)).')$'; -+ my $flags = 0; -+ -+ my @matches = `strings \"$knl\" | grep -E \"$string_pattern\"`; -+ foreach my $match (@matches) -+ { -+ chomp($match); -+ $flags |= $strings->{$match}; -+ } -+ -+ return $flags; -+} -+ - sub pack_trailer - { - my ($atoms) = @_; -@@ -235,10 +262,3 @@ sub pack_trailer - } - return $trailer; - } -- --sub config_bool --{ -- my ($configs, $wanted) = @_; -- my $val = $configs->{$wanted} || 'n'; -- return (($val eq 'y') || ($val eq '1')); --} - -From 6d38553e5ce7fb70dd1f89665caf58064a7e97d7 Mon Sep 17 00:00:00 2001 -From: Eric Anholt <eric@anholt.net> -Date: Mon, 2 Mar 2015 13:01:12 -0800 -Subject: [PATCH 091/170] drm/vc4: Add suport for 3D rendering using the V3D - engine. - -This is a squash of the out-of-tree development series. Since that -series contained code from the first "get a demo triangle rendered -using a hacked up driver using binary shader code" to "plug the last -known security hole", it's hard to reconstruct a different series of -incremental development that's mergeable without security holes -throughout it. - -Signed-off-by: Eric Anholt <eric@anholt.net> ---- - drivers/gpu/drm/vc4/Makefile | 11 +- - drivers/gpu/drm/vc4/vc4_bo.c | 476 +++++++++++++- - drivers/gpu/drm/vc4/vc4_crtc.c | 98 ++- - drivers/gpu/drm/vc4/vc4_debugfs.c | 3 + - drivers/gpu/drm/vc4/vc4_drv.c | 45 +- - drivers/gpu/drm/vc4/vc4_drv.h | 317 ++++++++++ - drivers/gpu/drm/vc4/vc4_gem.c | 686 +++++++++++++++++++++ - drivers/gpu/drm/vc4/vc4_irq.c | 211 +++++++ - drivers/gpu/drm/vc4/vc4_kms.c | 148 ++++- - drivers/gpu/drm/vc4/vc4_packet.h | 384 ++++++++++++ - drivers/gpu/drm/vc4/vc4_plane.c | 40 ++ - drivers/gpu/drm/vc4/vc4_qpu_defines.h | 268 ++++++++ - drivers/gpu/drm/vc4/vc4_render_cl.c | 448 ++++++++++++++ - drivers/gpu/drm/vc4/vc4_trace.h | 63 ++ - drivers/gpu/drm/vc4/vc4_trace_points.c | 14 + - drivers/gpu/drm/vc4/vc4_v3d.c | 268 ++++++++ - drivers/gpu/drm/vc4/vc4_validate.c | 958 +++++++++++++++++++++++++++++ - drivers/gpu/drm/vc4/vc4_validate_shaders.c | 521 ++++++++++++++++ - include/uapi/drm/vc4_drm.h | 229 +++++++ - 19 files changed, 5173 insertions(+), 15 deletions(-) - create mode 100644 drivers/gpu/drm/vc4/vc4_gem.c - create mode 100644 drivers/gpu/drm/vc4/vc4_irq.c - create mode 100644 drivers/gpu/drm/vc4/vc4_packet.h - create mode 100644 drivers/gpu/drm/vc4/vc4_qpu_defines.h - create mode 100644 drivers/gpu/drm/vc4/vc4_render_cl.c - create mode 100644 drivers/gpu/drm/vc4/vc4_trace.h - create mode 100644 drivers/gpu/drm/vc4/vc4_trace_points.c - create mode 100644 drivers/gpu/drm/vc4/vc4_v3d.c - create mode 100644 drivers/gpu/drm/vc4/vc4_validate.c - create mode 100644 drivers/gpu/drm/vc4/vc4_validate_shaders.c - create mode 100644 include/uapi/drm/vc4_drm.h - -diff --git a/drivers/gpu/drm/vc4/Makefile b/drivers/gpu/drm/vc4/Makefile -index 32b4f9c..4c6a99f 100644 ---- a/drivers/gpu/drm/vc4/Makefile -+++ b/drivers/gpu/drm/vc4/Makefile -@@ -8,10 +8,19 @@ vc4-y := \ - vc4_crtc.o \ - vc4_drv.o \ - vc4_kms.o \ -+ vc4_gem.o \ - vc4_hdmi.o \ - vc4_hvs.o \ -- vc4_plane.o -+ vc4_irq.o \ -+ vc4_plane.o \ -+ vc4_render_cl.o \ -+ vc4_trace_points.o \ -+ vc4_v3d.o \ -+ vc4_validate.o \ -+ vc4_validate_shaders.o - - vc4-$(CONFIG_DEBUG_FS) += vc4_debugfs.o - - obj-$(CONFIG_DRM_VC4) += vc4.o -+ -+CFLAGS_vc4_trace_points.o := -I$(src) -diff --git a/drivers/gpu/drm/vc4/vc4_bo.c b/drivers/gpu/drm/vc4/vc4_bo.c -index ab9f510..bfa605f 100644 ---- a/drivers/gpu/drm/vc4/vc4_bo.c -+++ b/drivers/gpu/drm/vc4/vc4_bo.c -@@ -15,16 +15,174 @@ - */ - - #include "vc4_drv.h" -+#include "uapi/drm/vc4_drm.h" - --struct vc4_bo *vc4_bo_create(struct drm_device *dev, size_t size) -+static void vc4_bo_stats_dump(struct vc4_dev *vc4) - { -+ DRM_INFO("num bos allocated: %d\n", -+ vc4->bo_stats.num_allocated); -+ DRM_INFO("size bos allocated: %dkb\n", -+ vc4->bo_stats.size_allocated / 1024); -+ DRM_INFO("num bos used: %d\n", -+ vc4->bo_stats.num_allocated - vc4->bo_stats.num_cached); -+ DRM_INFO("size bos used: %dkb\n", -+ (vc4->bo_stats.size_allocated - -+ vc4->bo_stats.size_cached) / 1024); -+ DRM_INFO("num bos cached: %d\n", -+ vc4->bo_stats.num_cached); -+ DRM_INFO("size bos cached: %dkb\n", -+ vc4->bo_stats.size_cached / 1024); -+} -+ -+static uint32_t bo_page_index(size_t size) -+{ -+ return (size / PAGE_SIZE) - 1; -+} -+ -+/* Must be called with bo_lock held. */ -+static void vc4_bo_destroy(struct vc4_bo *bo) -+{ -+ struct drm_gem_object *obj = &bo->base.base; -+ struct vc4_dev *vc4 = to_vc4_dev(obj->dev); -+ -+ if (bo->validated_shader) { -+ kfree(bo->validated_shader->texture_samples); -+ kfree(bo->validated_shader); -+ bo->validated_shader = NULL; -+ } -+ -+ vc4->bo_stats.num_allocated--; -+ vc4->bo_stats.size_allocated -= obj->size; -+ drm_gem_cma_free_object(obj); -+} -+ -+/* Must be called with bo_lock held. */ -+static void vc4_bo_remove_from_cache(struct vc4_bo *bo) -+{ -+ struct drm_gem_object *obj = &bo->base.base; -+ struct vc4_dev *vc4 = to_vc4_dev(obj->dev); -+ -+ vc4->bo_stats.num_cached--; -+ vc4->bo_stats.size_cached -= obj->size; -+ -+ list_del(&bo->unref_head); -+ list_del(&bo->size_head); -+} -+ -+static struct list_head *vc4_get_cache_list_for_size(struct drm_device *dev, -+ size_t size) -+{ -+ struct vc4_dev *vc4 = to_vc4_dev(dev); -+ uint32_t page_index = bo_page_index(size); -+ -+ if (vc4->bo_cache.size_list_size <= page_index) { -+ uint32_t new_size = max(vc4->bo_cache.size_list_size * 2, -+ page_index + 1); -+ struct list_head *new_list; -+ uint32_t i; -+ -+ new_list = kmalloc(new_size * sizeof(struct list_head), -+ GFP_KERNEL); -+ if (!new_list) -+ return NULL; -+ -+ /* Rebase the old cached BO lists to their new list -+ * head locations. -+ */ -+ for (i = 0; i < vc4->bo_cache.size_list_size; i++) { -+ struct list_head *old_list = &vc4->bo_cache.size_list[i]; -+ if (list_empty(old_list)) -+ INIT_LIST_HEAD(&new_list[i]); -+ else -+ list_replace(old_list, &new_list[i]); -+ } -+ /* And initialize the brand new BO list heads. */ -+ for (i = vc4->bo_cache.size_list_size; i < new_size; i++) -+ INIT_LIST_HEAD(&new_list[i]); -+ -+ kfree(vc4->bo_cache.size_list); -+ vc4->bo_cache.size_list = new_list; -+ vc4->bo_cache.size_list_size = new_size; -+ } -+ -+ return &vc4->bo_cache.size_list[page_index]; -+} -+ -+void vc4_bo_cache_purge(struct drm_device *dev) -+{ -+ struct vc4_dev *vc4 = to_vc4_dev(dev); -+ -+ spin_lock(&vc4->bo_lock); -+ while (!list_empty(&vc4->bo_cache.time_list)) { -+ struct vc4_bo *bo = list_last_entry(&vc4->bo_cache.time_list, -+ struct vc4_bo, unref_head); -+ vc4_bo_remove_from_cache(bo); -+ vc4_bo_destroy(bo); -+ } -+ spin_unlock(&vc4->bo_lock); -+} -+ -+struct vc4_bo *vc4_bo_create(struct drm_device *dev, size_t unaligned_size) -+{ -+ struct vc4_dev *vc4 = to_vc4_dev(dev); -+ uint32_t size = roundup(unaligned_size, PAGE_SIZE); -+ uint32_t page_index = bo_page_index(size); - struct drm_gem_cma_object *cma_obj; -+ int pass; - -- cma_obj = drm_gem_cma_create(dev, size); -- if (IS_ERR(cma_obj)) -+ if (size == 0) - return NULL; -- else -- return to_vc4_bo(&cma_obj->base); -+ -+ /* First, try to get a vc4_bo from the kernel BO cache. */ -+ spin_lock(&vc4->bo_lock); -+ if (page_index < vc4->bo_cache.size_list_size && -+ !list_empty(&vc4->bo_cache.size_list[page_index])) { -+ struct vc4_bo *bo = -+ list_first_entry(&vc4->bo_cache.size_list[page_index], -+ struct vc4_bo, size_head); -+ vc4_bo_remove_from_cache(bo); -+ spin_unlock(&vc4->bo_lock); -+ kref_init(&bo->base.base.refcount); -+ return bo; -+ } -+ spin_unlock(&vc4->bo_lock); -+ -+ /* Otherwise, make a new BO. */ -+ for (pass = 0; ; pass++) { -+ cma_obj = drm_gem_cma_create(dev, size); -+ if (!IS_ERR(cma_obj)) -+ break; -+ -+ switch (pass) { -+ case 0: -+ /* -+ * If we've run out of CMA memory, kill the cache of -+ * CMA allocations we've got laying around and try again. -+ */ -+ vc4_bo_cache_purge(dev); -+ break; -+ case 1: -+ /* -+ * Getting desperate, so try to wait for any -+ * previous rendering to finish, free its -+ * unreferenced BOs to the cache, and then -+ * free the cache. -+ */ -+ vc4_wait_for_seqno(dev, vc4->emit_seqno, ~0ull, true); -+ vc4_job_handle_completed(vc4); -+ vc4_bo_cache_purge(dev); -+ break; -+ case 3: -+ DRM_ERROR("Failed to allocate from CMA:\n"); -+ vc4_bo_stats_dump(vc4); -+ return NULL; -+ } -+ } -+ -+ vc4->bo_stats.num_allocated++; -+ vc4->bo_stats.size_allocated += size; -+ -+ return to_vc4_bo(&cma_obj->base); - } - - int vc4_dumb_create(struct drm_file *file_priv, -@@ -41,7 +199,7 @@ int vc4_dumb_create(struct drm_file *file_priv, - if (args->size < args->pitch * args->height) - args->size = args->pitch * args->height; - -- bo = vc4_bo_create(dev, roundup(args->size, PAGE_SIZE)); -+ bo = vc4_bo_create(dev, args->size); - if (!bo) - return -ENOMEM; - -@@ -50,3 +208,309 @@ int vc4_dumb_create(struct drm_file *file_priv, - - return ret; - } -+ -+static void -+vc4_bo_cache_free_old(struct drm_device *dev) -+{ -+ struct vc4_dev *vc4 = to_vc4_dev(dev); -+ unsigned long expire_time = jiffies - msecs_to_jiffies(1000); -+ -+ spin_lock(&vc4->bo_lock); -+ while (!list_empty(&vc4->bo_cache.time_list)) { -+ struct vc4_bo *bo = list_last_entry(&vc4->bo_cache.time_list, -+ struct vc4_bo, unref_head); -+ if (time_before(expire_time, bo->free_time)) { -+ mod_timer(&vc4->bo_cache.time_timer, -+ round_jiffies_up(jiffies + -+ msecs_to_jiffies(1000))); -+ spin_unlock(&vc4->bo_lock); -+ return; -+ } -+ -+ vc4_bo_remove_from_cache(bo); -+ vc4_bo_destroy(bo); -+ } -+ spin_unlock(&vc4->bo_lock); -+} -+ -+/* Called on the last userspace/kernel unreference of the BO. Returns -+ * it to the BO cache if possible, otherwise frees it. -+ * -+ * Note that this is called with the struct_mutex held. -+ */ -+void vc4_free_object(struct drm_gem_object *gem_bo) -+{ -+ struct drm_device *dev = gem_bo->dev; -+ struct vc4_dev *vc4 = to_vc4_dev(dev); -+ struct vc4_bo *bo = to_vc4_bo(gem_bo); -+ struct list_head *cache_list; -+ -+ /* If the object references someone else's memory, we can't cache it. -+ */ -+ if (gem_bo->import_attach) { -+ vc4_bo_destroy(bo); -+ return; -+ } -+ -+ /* Don't cache if it was publicly named. */ -+ if (gem_bo->name) { -+ vc4_bo_destroy(bo); -+ return; -+ } -+ -+ spin_lock(&vc4->bo_lock); -+ cache_list = vc4_get_cache_list_for_size(dev, gem_bo->size); -+ if (!cache_list) { -+ vc4_bo_destroy(bo); -+ spin_unlock(&vc4->bo_lock); -+ return; -+ } -+ -+ if (bo->validated_shader) { -+ kfree(bo->validated_shader->texture_samples); -+ kfree(bo->validated_shader); -+ bo->validated_shader = NULL; -+ } -+ -+ bo->free_time = jiffies; -+ list_add(&bo->size_head, cache_list); -+ list_add(&bo->unref_head, &vc4->bo_cache.time_list); -+ -+ vc4->bo_stats.num_cached++; -+ vc4->bo_stats.size_cached += gem_bo->size; -+ spin_unlock(&vc4->bo_lock); -+ -+ vc4_bo_cache_free_old(dev); -+} -+ -+static void vc4_bo_cache_time_work(struct work_struct *work) -+{ -+ struct vc4_dev *vc4 = -+ container_of(work, struct vc4_dev, bo_cache.time_work); -+ struct drm_device *dev = vc4->dev; -+ -+ vc4_bo_cache_free_old(dev); -+} -+ -+static void vc4_bo_cache_time_timer(unsigned long data) -+{ -+ struct drm_device *dev = (struct drm_device *)data; -+ struct vc4_dev *vc4 = to_vc4_dev(dev); -+ -+ schedule_work(&vc4->bo_cache.time_work); -+} -+ -+struct dma_buf * -+vc4_prime_export(struct drm_device *dev, struct drm_gem_object *obj, int flags) -+{ -+ struct vc4_bo *bo = to_vc4_bo(obj); -+ -+ if (bo->validated_shader) { -+ DRM_ERROR("Attempting to export shader BO\n"); -+ return ERR_PTR(-EINVAL); -+ } -+ -+ return drm_gem_prime_export(dev, obj, flags); -+} -+ -+int -+vc4_create_bo_ioctl(struct drm_device *dev, void *data, -+ struct drm_file *file_priv) -+{ -+ struct drm_vc4_create_bo *args = data; -+ struct vc4_bo *bo = NULL; -+ int ret; -+ -+ bo = vc4_bo_create(dev, args->size); -+ if (!bo) -+ return -ENOMEM; -+ -+ ret = drm_gem_handle_create(file_priv, &bo->base.base, &args->handle); -+ drm_gem_object_unreference_unlocked(&bo->base.base); -+ -+ return ret; -+} -+ -+int -+vc4_create_shader_bo_ioctl(struct drm_device *dev, void *data, -+ struct drm_file *file_priv) -+{ -+ struct drm_vc4_create_shader_bo *args = data; -+ struct vc4_bo *bo = NULL; -+ int ret; -+ -+ if (args->size == 0) -+ return -EINVAL; -+ -+ if (args->size % sizeof(u64) != 0) -+ return -EINVAL; -+ -+ if (args->flags != 0) { -+ DRM_INFO("Unknown flags set: 0x%08x\n", args->flags); -+ return -EINVAL; -+ } -+ -+ if (args->pad != 0) { -+ DRM_INFO("Pad set: 0x%08x\n", args->pad); -+ return -EINVAL; -+ } -+ -+ bo = vc4_bo_create(dev, args->size); -+ if (!bo) -+ return -ENOMEM; -+ -+ ret = copy_from_user(bo->base.vaddr, -+ (void __user *)(uintptr_t)args->data, -+ args->size); -+ if (ret != 0) -+ goto fail; -+ -+ bo->validated_shader = vc4_validate_shader(&bo->base); -+ if (!bo->validated_shader) { -+ ret = -EINVAL; -+ goto fail; -+ } -+ -+ /* We have to create the handle after validation, to avoid -+ * races for users to do doing things like mmap the shader BO. -+ */ -+ ret = drm_gem_handle_create(file_priv, &bo->base.base, &args->handle); -+ -+ fail: -+ drm_gem_object_unreference_unlocked(&bo->base.base); -+ -+ return ret; -+} -+ -+int -+vc4_mmap_bo_ioctl(struct drm_device *dev, void *data, -+ struct drm_file *file_priv) -+{ -+ struct drm_vc4_mmap_bo *args = data; -+ struct drm_gem_object *gem_obj; -+ -+ gem_obj = drm_gem_object_lookup(dev, file_priv, args->handle); -+ if (!gem_obj) { -+ DRM_ERROR("Failed to look up GEM BO %d\n", args->handle); -+ return -EINVAL; -+ } -+ -+ /* The mmap offset was set up at BO allocation time. */ -+ args->offset = drm_vma_node_offset_addr(&gem_obj->vma_node); -+ -+ drm_gem_object_unreference(gem_obj); -+ return 0; -+} -+ -+int vc4_mmap(struct file *filp, struct vm_area_struct *vma) -+{ -+ struct drm_gem_object *gem_obj; -+ struct vc4_bo *bo; -+ int ret; -+ -+ ret = drm_gem_mmap(filp, vma); -+ if (ret) -+ return ret; -+ -+ gem_obj = vma->vm_private_data; -+ bo = to_vc4_bo(gem_obj); -+ -+ if (bo->validated_shader) { -+ DRM_ERROR("mmaping of shader BOs not allowed.\n"); -+ return -EINVAL; -+ } -+ -+ /* -+ * Clear the VM_PFNMAP flag that was set by drm_gem_mmap(), and set the -+ * vm_pgoff (used as a fake buffer offset by DRM) to 0 as we want to map -+ * the whole buffer. -+ */ -+ vma->vm_flags &= ~VM_PFNMAP; -+ vma->vm_pgoff = 0; -+ -+ ret = dma_mmap_writecombine(bo->base.base.dev->dev, vma, -+ bo->base.vaddr, bo->base.paddr, -+ vma->vm_end - vma->vm_start); -+ if (ret) -+ drm_gem_vm_close(vma); -+ -+ return ret; -+} -+ -+int vc4_prime_mmap(struct drm_gem_object *obj, struct vm_area_struct *vma) -+{ -+ struct vc4_bo *bo = to_vc4_bo(obj); -+ -+ if (bo->validated_shader) { -+ DRM_ERROR("mmaping of shader BOs not allowed.\n"); -+ return -EINVAL; -+ } -+ -+ return drm_gem_cma_prime_mmap(obj, vma); -+} -+ -+void *vc4_prime_vmap(struct drm_gem_object *obj) -+{ -+ struct vc4_bo *bo = to_vc4_bo(obj); -+ -+ if (bo->validated_shader) { -+ DRM_ERROR("mmaping of shader BOs not allowed.\n"); -+ return ERR_PTR(-EINVAL); -+ } -+ -+ return drm_gem_cma_prime_vmap(obj); -+} -+ -+void vc4_bo_cache_init(struct drm_device *dev) -+{ -+ struct vc4_dev *vc4 = to_vc4_dev(dev); -+ -+ spin_lock_init(&vc4->bo_lock); -+ -+ INIT_LIST_HEAD(&vc4->bo_cache.time_list); -+ -+ INIT_WORK(&vc4->bo_cache.time_work, vc4_bo_cache_time_work); -+ setup_timer(&vc4->bo_cache.time_timer, -+ vc4_bo_cache_time_timer, -+ (unsigned long) dev); -+} -+ -+void vc4_bo_cache_destroy(struct drm_device *dev) -+{ -+ struct vc4_dev *vc4 = to_vc4_dev(dev); -+ -+ del_timer(&vc4->bo_cache.time_timer); -+ cancel_work_sync(&vc4->bo_cache.time_work); -+ -+ vc4_bo_cache_purge(dev); -+ -+ if (vc4->bo_stats.num_allocated) { -+ DRM_ERROR("Destroying BO cache while BOs still allocated:\n"); -+ vc4_bo_stats_dump(vc4); -+ } -+} -+ -+#ifdef CONFIG_DEBUG_FS -+int vc4_bo_stats_debugfs(struct seq_file *m, void *unused) -+{ -+ struct drm_info_node *node = (struct drm_info_node *) m->private; -+ struct drm_device *dev = node->minor->dev; -+ struct vc4_dev *vc4 = to_vc4_dev(dev); -+ struct vc4_bo_stats stats; -+ -+ spin_lock(&vc4->bo_lock); -+ stats = vc4->bo_stats; -+ spin_unlock(&vc4->bo_lock); -+ -+ seq_printf(m, "num bos allocated: %d\n", stats.num_allocated); -+ seq_printf(m, "size bos allocated: %dkb\n", stats.size_allocated / 1024); -+ seq_printf(m, "num bos used: %d\n", (stats.num_allocated - -+ stats.num_cached)); -+ seq_printf(m, "size bos used: %dkb\n", (stats.size_allocated - -+ stats.size_cached) / 1024); -+ seq_printf(m, "num bos cached: %d\n", stats.num_cached); -+ seq_printf(m, "size bos cached: %dkb\n", stats.size_cached / 1024); +diff --git a/drivers/w1/masters/w1-gpio.c b/drivers/w1/masters/w1-gpio.c +index a373ae6..080e597 100644 +--- a/drivers/w1/masters/w1-gpio.c ++++ b/drivers/w1/masters/w1-gpio.c +@@ -23,6 +23,19 @@ + #include "../w1.h" + #include "../w1_int.h" + ++static int w1_gpio_pullup = 0; ++static int w1_gpio_pullup_orig = 0; ++module_param_named(pullup, w1_gpio_pullup, int, 0); ++MODULE_PARM_DESC(pullup, "Enable parasitic power (power on data) mode"); ++static int w1_gpio_pullup_pin = -1; ++static int w1_gpio_pullup_pin_orig = -1; ++module_param_named(extpullup, w1_gpio_pullup_pin, int, 0); ++MODULE_PARM_DESC(extpullup, "GPIO external pullup pin number"); ++static int w1_gpio_pin = -1; ++static int w1_gpio_pin_orig = -1; ++module_param_named(gpiopin, w1_gpio_pin, int, 0); ++MODULE_PARM_DESC(gpiopin, "GPIO pin number"); + -+ return 0; -+} -+#endif -diff --git a/drivers/gpu/drm/vc4/vc4_crtc.c b/drivers/gpu/drm/vc4/vc4_crtc.c -index 265064c..3be2720 100644 ---- a/drivers/gpu/drm/vc4/vc4_crtc.c -+++ b/drivers/gpu/drm/vc4/vc4_crtc.c -@@ -35,6 +35,7 @@ - #include "drm_atomic_helper.h" - #include "drm_crtc_helper.h" - #include "linux/clk.h" -+#include "drm_fb_cma_helper.h" - #include "linux/component.h" - #include "linux/of_device.h" - #include "vc4_drv.h" -@@ -476,10 +477,105 @@ static irqreturn_t vc4_crtc_irq_handler(int irq, void *data) - return ret; + static u8 w1_gpio_set_pullup(void *data, int delay) + { + struct w1_gpio_platform_data *pdata = data; +@@ -67,6 +80,16 @@ static u8 w1_gpio_read_bit(void *data) + return gpio_get_value(pdata->pin) ? 1 : 0; } -+struct vc4_async_flip_state { -+ struct drm_crtc *crtc; -+ struct drm_framebuffer *fb; -+ struct drm_pending_vblank_event *event; -+ -+ struct vc4_seqno_cb cb; -+}; -+ -+/* Called when the V3D execution for the BO being flipped to is done, so that -+ * we can actually update the plane's address to point to it. -+ */ -+static void -+vc4_async_page_flip_complete(struct vc4_seqno_cb *cb) -+{ -+ struct vc4_async_flip_state *flip_state = -+ container_of(cb, struct vc4_async_flip_state, cb); -+ struct drm_crtc *crtc = flip_state->crtc; -+ struct drm_device *dev = crtc->dev; -+ struct vc4_dev *vc4 = to_vc4_dev(dev); -+ struct drm_plane *plane = crtc->primary; -+ -+ vc4_plane_async_set_fb(plane, flip_state->fb); -+ if (flip_state->event) { -+ unsigned long flags; -+ spin_lock_irqsave(&dev->event_lock, flags); -+ drm_crtc_send_vblank_event(crtc, flip_state->event); -+ spin_unlock_irqrestore(&dev->event_lock, flags); -+ } -+ -+ drm_framebuffer_unreference(flip_state->fb); -+ kfree(flip_state); -+ -+ up(&vc4->async_modeset); -+} -+ -+/* Implements async (non-vblank-synced) page flips. -+ * -+ * The page flip ioctl needs to return immediately, so we grab the -+ * modeset semaphore on the pipe, and queue the address update for -+ * when V3D is done with the BO being flipped to. -+ */ -+static int vc4_async_page_flip(struct drm_crtc *crtc, -+ struct drm_framebuffer *fb, -+ struct drm_pending_vblank_event *event, -+ uint32_t flags) ++static void w1_gpio_bitbang_pullup(void *data, u8 on) +{ -+ struct drm_device *dev = crtc->dev; -+ struct vc4_dev *vc4 = to_vc4_dev(dev); -+ struct drm_plane *plane = crtc->primary; -+ int ret = 0; -+ struct vc4_async_flip_state *flip_state; -+ struct drm_gem_cma_object *cma_bo = drm_fb_cma_get_gem_obj(fb, 0); -+ struct vc4_bo *bo = to_vc4_bo(&cma_bo->base); -+ -+ flip_state = kzalloc(sizeof(*flip_state), GFP_KERNEL); -+ if (!flip_state) -+ return -ENOMEM; -+ -+ drm_framebuffer_reference(fb); -+ flip_state->fb = fb; -+ flip_state->crtc = crtc; -+ flip_state->event = event; -+ -+ /* Make sure all other async modesetes have landed. */ -+ ret = down_interruptible(&vc4->async_modeset); -+ if (ret) { -+ kfree(flip_state); -+ return ret; -+ } -+ -+ /* Immediately update the plane's legacy fb pointer, so that later -+ * modeset prep sees the state that will be present when the semaphore -+ * is released. -+ */ -+ drm_atomic_set_fb_for_plane(plane->state, fb); -+ plane->fb = fb; -+ -+ vc4_queue_seqno_cb(dev, &flip_state->cb, bo->seqno, -+ vc4_async_page_flip_complete); -+ -+ /* Driver takes ownership of state on successful async commit. */ -+ return 0; -+} ++ struct w1_gpio_platform_data *pdata = data; + -+static int vc4_page_flip(struct drm_crtc *crtc, -+ struct drm_framebuffer *fb, -+ struct drm_pending_vblank_event *event, -+ uint32_t flags) -+{ -+ if (flags & DRM_MODE_PAGE_FLIP_ASYNC) -+ return vc4_async_page_flip(crtc, fb, event, flags); ++ if (on) ++ gpio_direction_output(pdata->pin, 1); + else -+ return drm_atomic_helper_page_flip(crtc, fb, event, flags); ++ gpio_direction_input(pdata->pin); +} + - static const struct drm_crtc_funcs vc4_crtc_funcs = { - .set_config = drm_atomic_helper_set_config, - .destroy = vc4_crtc_destroy, -- .page_flip = drm_atomic_helper_page_flip, -+ .page_flip = vc4_page_flip, - .set_property = NULL, - .cursor_set = NULL, /* handled by drm_mode_cursor_universal */ - .cursor_move = NULL, /* handled by drm_mode_cursor_universal */ -diff --git a/drivers/gpu/drm/vc4/vc4_debugfs.c b/drivers/gpu/drm/vc4/vc4_debugfs.c -index 4297b0a5..d76ad10 100644 ---- a/drivers/gpu/drm/vc4/vc4_debugfs.c -+++ b/drivers/gpu/drm/vc4/vc4_debugfs.c -@@ -16,11 +16,14 @@ - #include "vc4_regs.h" - - static const struct drm_info_list vc4_debugfs_list[] = { -+ {"bo_stats", vc4_bo_stats_debugfs, 0}, - {"hdmi_regs", vc4_hdmi_debugfs_regs, 0}, - {"hvs_regs", vc4_hvs_debugfs_regs, 0}, - {"crtc0_regs", vc4_crtc_debugfs_regs, 0, (void *)(uintptr_t)0}, - {"crtc1_regs", vc4_crtc_debugfs_regs, 0, (void *)(uintptr_t)1}, - {"crtc2_regs", vc4_crtc_debugfs_regs, 0, (void *)(uintptr_t)2}, -+ {"v3d_ident", vc4_v3d_debugfs_ident, 0}, -+ {"v3d_regs", vc4_v3d_debugfs_regs, 0}, - }; + #if defined(CONFIG_OF) + static const struct of_device_id w1_gpio_dt_ids[] = { + { .compatible = "w1-gpio" }, +@@ -80,6 +103,7 @@ static int w1_gpio_probe_dt(struct platform_device *pdev) + struct w1_gpio_platform_data *pdata = dev_get_platdata(&pdev->dev); + struct device_node *np = pdev->dev.of_node; + int gpio; ++ u32 value; - #define VC4_DEBUGFS_ENTRIES ARRAY_SIZE(vc4_debugfs_list) -diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c -index d5db9e0..3baf1fc 100644 ---- a/drivers/gpu/drm/vc4/vc4_drv.c -+++ b/drivers/gpu/drm/vc4/vc4_drv.c -@@ -14,8 +14,10 @@ - #include <linux/module.h> - #include <linux/of_platform.h> - #include <linux/platform_device.h> -+#include <soc/bcm2835/raspberrypi-firmware.h> - #include "drm_fb_cma_helper.h" + pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); + if (!pdata) +@@ -88,6 +112,9 @@ static int w1_gpio_probe_dt(struct platform_device *pdev) + if (of_get_property(np, "linux,open-drain", NULL)) + pdata->is_open_drain = 1; -+#include "uapi/drm/vc4_drm.h" - #include "vc4_drv.h" - #include "vc4_regs.h" ++ if (of_property_read_u32(np, "rpi,parasitic-power", &value) == 0) ++ pdata->parasitic_power = (value != 0); ++ + gpio = of_get_gpio(np, 0); + if (gpio < 0) { + if (gpio != -EPROBE_DEFER) +@@ -103,7 +130,7 @@ static int w1_gpio_probe_dt(struct platform_device *pdev) + if (gpio == -EPROBE_DEFER) + return gpio; + /* ignore other errors as the pullup gpio is optional */ +- pdata->ext_pullup_enable_pin = gpio; ++ pdata->ext_pullup_enable_pin = (gpio >= 0) ? gpio : -1; -@@ -63,7 +65,7 @@ static const struct file_operations vc4_drm_fops = { - .open = drm_open, - .release = drm_release, - .unlocked_ioctl = drm_ioctl, -- .mmap = drm_gem_cma_mmap, -+ .mmap = vc4_mmap, - .poll = drm_poll, - .read = drm_read, - #ifdef CONFIG_COMPAT -@@ -73,16 +75,28 @@ static const struct file_operations vc4_drm_fops = { - }; + pdev->dev.platform_data = pdata; - static const struct drm_ioctl_desc vc4_drm_ioctls[] = { -+ DRM_IOCTL_DEF_DRV(VC4_SUBMIT_CL, vc4_submit_cl_ioctl, 0), -+ DRM_IOCTL_DEF_DRV(VC4_WAIT_SEQNO, vc4_wait_seqno_ioctl, 0), -+ DRM_IOCTL_DEF_DRV(VC4_WAIT_BO, vc4_wait_bo_ioctl, 0), -+ DRM_IOCTL_DEF_DRV(VC4_CREATE_BO, vc4_create_bo_ioctl, 0), -+ DRM_IOCTL_DEF_DRV(VC4_MMAP_BO, vc4_mmap_bo_ioctl, 0), -+ DRM_IOCTL_DEF_DRV(VC4_CREATE_SHADER_BO, vc4_create_shader_bo_ioctl, 0), - }; +@@ -113,13 +140,15 @@ static int w1_gpio_probe_dt(struct platform_device *pdev) + static int w1_gpio_probe(struct platform_device *pdev) + { + struct w1_bus_master *master; +- struct w1_gpio_platform_data *pdata; ++ struct w1_gpio_platform_data *pdata = pdev->dev.platform_data; + int err; - static struct drm_driver vc4_drm_driver = { - .driver_features = (DRIVER_MODESET | - DRIVER_ATOMIC | - DRIVER_GEM | -+ DRIVER_HAVE_IRQ | - DRIVER_PRIME), - .lastclose = vc4_lastclose, - .preclose = vc4_drm_preclose, - -+ .irq_handler = vc4_irq, -+ .irq_preinstall = vc4_irq_preinstall, -+ .irq_postinstall = vc4_irq_postinstall, -+ .irq_uninstall = vc4_irq_uninstall, -+ - .enable_vblank = vc4_enable_vblank, - .disable_vblank = vc4_disable_vblank, - .get_vblank_counter = drm_vblank_count, -@@ -92,18 +106,18 @@ static struct drm_driver vc4_drm_driver = { - .debugfs_cleanup = vc4_debugfs_cleanup, - #endif +- if (of_have_populated_dt()) { +- err = w1_gpio_probe_dt(pdev); +- if (err < 0) +- return err; ++ if(pdata == NULL) { ++ if (of_have_populated_dt()) { ++ err = w1_gpio_probe_dt(pdev); ++ if (err < 0) ++ return err; ++ } + } -- .gem_free_object = drm_gem_cma_free_object, -+ .gem_free_object = vc4_free_object, - .gem_vm_ops = &drm_gem_cma_vm_ops, - - .prime_handle_to_fd = drm_gem_prime_handle_to_fd, - .prime_fd_to_handle = drm_gem_prime_fd_to_handle, - .gem_prime_import = drm_gem_prime_import, -- .gem_prime_export = drm_gem_prime_export, -+ .gem_prime_export = vc4_prime_export, - .gem_prime_get_sg_table = drm_gem_cma_prime_get_sg_table, - .gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table, -- .gem_prime_vmap = drm_gem_cma_prime_vmap, -+ .gem_prime_vmap = vc4_prime_vmap, - .gem_prime_vunmap = drm_gem_cma_prime_vunmap, -- .gem_prime_mmap = drm_gem_cma_prime_mmap, -+ .gem_prime_mmap = vc4_prime_mmap, - - .dumb_create = vc4_dumb_create, - .dumb_map_offset = drm_gem_cma_dumb_map_offset, -@@ -113,6 +127,8 @@ static struct drm_driver vc4_drm_driver = { - .num_ioctls = ARRAY_SIZE(vc4_drm_ioctls), - .fops = &vc4_drm_fops, - -+ .gem_obj_size = sizeof(struct vc4_bo), -+ - .name = DRIVER_NAME, - .desc = DRIVER_DESC, - .date = DRIVER_DATE, -@@ -153,6 +169,7 @@ static int vc4_drm_bind(struct device *dev) - struct drm_device *drm; - struct drm_connector *connector; - struct vc4_dev *vc4; -+ struct device_node *firmware_node; - int ret = 0; - - dev->coherent_dma_mask = DMA_BIT_MASK(32); -@@ -161,6 +178,14 @@ static int vc4_drm_bind(struct device *dev) - if (!vc4) + pdata = dev_get_platdata(&pdev->dev); +@@ -136,6 +165,22 @@ static int w1_gpio_probe(struct platform_device *pdev) return -ENOMEM; + } -+ firmware_node = of_parse_phandle(dev->of_node, "firmware", 0); -+ vc4->firmware = rpi_firmware_get(firmware_node); -+ if (!vc4->firmware) { -+ DRM_DEBUG("Failed to get Raspberry Pi firmware reference.\n"); -+ return -EPROBE_DEFER; ++ w1_gpio_pin_orig = pdata->pin; ++ w1_gpio_pullup_pin_orig = pdata->ext_pullup_enable_pin; ++ w1_gpio_pullup_orig = pdata->parasitic_power; ++ ++ if(gpio_is_valid(w1_gpio_pin)) { ++ pdata->pin = w1_gpio_pin; ++ pdata->ext_pullup_enable_pin = -1; ++ pdata->parasitic_power = -1; ++ } ++ pdata->parasitic_power |= w1_gpio_pullup; ++ if(gpio_is_valid(w1_gpio_pullup_pin)) { ++ pdata->ext_pullup_enable_pin = w1_gpio_pullup_pin; + } -+ of_node_put(firmware_node); + - drm = drm_dev_alloc(&vc4_drm_driver, dev); - if (!drm) - return -ENOMEM; -@@ -170,13 +195,17 @@ static int vc4_drm_bind(struct device *dev) - - drm_dev_set_unique(drm, dev_name(dev)); - -+ vc4_bo_cache_init(drm); ++ dev_info(&pdev->dev, "gpio pin %d, external pullup pin %d, parasitic power %d\n", pdata->pin, pdata->ext_pullup_enable_pin, pdata->parasitic_power); + - drm_mode_config_init(drm); - if (ret) - goto unref; + err = devm_gpio_request(&pdev->dev, pdata->pin, "w1"); + if (err) { + dev_err(&pdev->dev, "gpio_request (pin) failed\n"); +@@ -165,6 +210,14 @@ static int w1_gpio_probe(struct platform_device *pdev) + master->set_pullup = w1_gpio_set_pullup; + } -+ vc4_gem_init(drm); ++ if (pdata->parasitic_power) { ++ if (pdata->is_open_drain) ++ printk(KERN_ERR "w1-gpio 'pullup'(parasitic power) " ++ "option doesn't work with open drain GPIO\n"); ++ else ++ master->bitbang_pullup = w1_gpio_bitbang_pullup; ++ } + - ret = component_bind_all(dev, drm); - if (ret) -- goto unref; -+ goto gem_destroy; + err = w1_add_master_device(master); + if (err) { + dev_err(&pdev->dev, "w1_add_master device failed\n"); +@@ -195,6 +248,10 @@ static int w1_gpio_remove(struct platform_device *pdev) - ret = drm_dev_register(drm, 0); - if (ret < 0) -@@ -200,8 +229,11 @@ static int vc4_drm_bind(struct device *dev) - drm_dev_unregister(drm); - unbind_all: - component_unbind_all(dev, drm); -+gem_destroy: -+ vc4_gem_destroy(drm); - unref: - drm_dev_unref(drm); -+ vc4_bo_cache_destroy(drm); - return ret; + w1_remove_master_device(master); + ++ pdata->pin = w1_gpio_pin_orig; ++ pdata->ext_pullup_enable_pin = w1_gpio_pullup_pin_orig; ++ pdata->parasitic_power = w1_gpio_pullup_orig; ++ + return 0; } -@@ -228,6 +260,7 @@ static struct platform_driver *const component_drivers[] = { - &vc4_hdmi_driver, - &vc4_crtc_driver, - &vc4_hvs_driver, -+ &vc4_v3d_driver, - }; +diff --git a/drivers/w1/w1.h b/drivers/w1/w1.h +index 56a49ba..881d728 100644 +--- a/drivers/w1/w1.h ++++ b/drivers/w1/w1.h +@@ -171,6 +171,12 @@ struct w1_bus_master - static int vc4_platform_drm_probe(struct platform_device *pdev) -diff --git a/drivers/gpu/drm/vc4/vc4_drv.h b/drivers/gpu/drm/vc4/vc4_drv.h -index fd8319f..8cc89d1 100644 ---- a/drivers/gpu/drm/vc4/vc4_drv.h -+++ b/drivers/gpu/drm/vc4/vc4_drv.h -@@ -15,8 +15,85 @@ struct vc4_dev { - struct vc4_hdmi *hdmi; - struct vc4_hvs *hvs; - struct vc4_crtc *crtc[3]; -+ struct vc4_v3d *v3d; - - struct drm_fbdev_cma *fbdev; -+ struct rpi_firmware *firmware; -+ -+ /* The kernel-space BO cache. Tracks buffers that have been -+ * unreferenced by all other users (refcounts of 0!) but not -+ * yet freed, so we can do cheap allocations. -+ */ -+ struct vc4_bo_cache { -+ /* Array of list heads for entries in the BO cache, -+ * based on number of pages, so we can do O(1) lookups -+ * in the cache when allocating. -+ */ -+ struct list_head *size_list; -+ uint32_t size_list_size; -+ -+ /* List of all BOs in the cache, ordered by age, so we -+ * can do O(1) lookups when trying to free old -+ * buffers. -+ */ -+ struct list_head time_list; -+ struct work_struct time_work; -+ struct timer_list time_timer; -+ } bo_cache; -+ -+ struct vc4_bo_stats { -+ u32 num_allocated; -+ u32 size_allocated; -+ u32 num_cached; -+ u32 size_cached; -+ } bo_stats; -+ -+ /* Protects bo_cache and the BO stats. */ -+ spinlock_t bo_lock; -+ -+ /* Sequence number for the last job queued in job_list. -+ * Starts at 0 (no jobs emitted). -+ */ -+ uint64_t emit_seqno; -+ -+ /* Sequence number for the last completed job on the GPU. -+ * Starts at 0 (no jobs completed). -+ */ -+ uint64_t finished_seqno; -+ -+ /* List of all struct vc4_exec_info for jobs to be executed. -+ * The first job in the list is the one currently programmed -+ * into ct0ca/ct1ca for execution. -+ */ -+ struct list_head job_list; -+ /* List of the finished vc4_exec_infos waiting to be freed by -+ * job_done_work. -+ */ -+ struct list_head job_done_list; -+ spinlock_t job_lock; -+ wait_queue_head_t job_wait_queue; -+ struct work_struct job_done_work; -+ -+ /* List of struct vc4_seqno_cb for callbacks to be made from a -+ * workqueue when the given seqno is passed. -+ */ -+ struct list_head seqno_cb_list; -+ -+ /* The binner overflow memory that's currently set up in -+ * BPOA/BPOS registers. When overflow occurs and a new one is -+ * allocated, the previous one will be moved to -+ * vc4->current_exec's free list. + u8 (*set_pullup)(void *, int); + ++ /** ++ * Turns the pullup on/off in bitbanging mode, takes an on/off argument. ++ * @return -1=Error, 0=completed + */ -+ struct vc4_bo *overflow_mem; -+ struct work_struct overflow_mem_work; -+ -+ struct { -+ uint32_t last_ct0ca, last_ct1ca; -+ struct timer_list timer; -+ struct work_struct reset_work; -+ } hangcheck; ++ void (*bitbang_pullup) (void *, u8); + -+ struct semaphore async_modeset; + void (*search)(void *, struct w1_master *, + u8, w1_slave_found_callback); }; +diff --git a/drivers/w1/w1_int.c b/drivers/w1/w1_int.c +index 20f766a..c4fbdb1 100644 +--- a/drivers/w1/w1_int.c ++++ b/drivers/w1/w1_int.c +@@ -122,6 +122,20 @@ int w1_add_master_device(struct w1_bus_master *master) + return(-EINVAL); + } - static inline struct vc4_dev * -@@ -27,6 +104,25 @@ to_vc4_dev(struct drm_device *dev) - - struct vc4_bo { - struct drm_gem_cma_object base; -+ -+ /* seqno of the last job to render to this BO. */ -+ uint64_t seqno; -+ -+ /* List entry for the BO's position in either -+ * vc4_exec_info->unref_list or vc4_dev->bo_cache.time_list -+ */ -+ struct list_head unref_head; ++ /* bitbanging hardware uses bitbang_pullup, other hardware uses set_pullup ++ * and takes care of timing itself */ ++ if (!master->write_byte && !master->touch_bit && master->set_pullup) { ++ printk(KERN_ERR "w1_add_master_device: set_pullup requires " ++ "write_byte or touch_bit, disabling\n"); ++ master->set_pullup = NULL; ++ } + -+ /* Time in jiffies when the BO was put in vc4->bo_cache. */ -+ unsigned long free_time; ++ if (master->set_pullup && master->bitbang_pullup) { ++ printk(KERN_ERR "w1_add_master_device: set_pullup should not " ++ "be set when bitbang_pullup is used, disabling\n"); ++ master->set_pullup = NULL; ++ } + -+ /* List entry for the BO's position in vc4_dev->bo_cache.size_list */ -+ struct list_head size_head; + /* Lock until the device is added (or not) to w1_masters. */ + mutex_lock(&w1_mlock); + /* Search for the first available id (starting at 1). */ +diff --git a/drivers/w1/w1_io.c b/drivers/w1/w1_io.c +index 2820924..fd0550f 100644 +--- a/drivers/w1/w1_io.c ++++ b/drivers/w1/w1_io.c +@@ -134,10 +134,22 @@ static void w1_pre_write(struct w1_master *dev) + static void w1_post_write(struct w1_master *dev) + { + if (dev->pullup_duration) { +- if (dev->enable_pullup && dev->bus_master->set_pullup) +- dev->bus_master->set_pullup(dev->bus_master->data, 0); +- else ++ if (dev->enable_pullup) { ++ if (dev->bus_master->set_pullup) { ++ dev->bus_master->set_pullup(dev-> ++ bus_master->data, ++ 0); ++ } else if (dev->bus_master->bitbang_pullup) { ++ dev->bus_master-> ++ bitbang_pullup(dev->bus_master->data, 1); ++ msleep(dev->pullup_duration); ++ dev->bus_master-> ++ bitbang_pullup(dev->bus_master->data, 0); ++ } ++ } else { + msleep(dev->pullup_duration); ++ } + -+ /* Struct for shader validation state, if created by -+ * DRM_IOCTL_VC4_CREATE_SHADER_BO. -+ */ -+ struct vc4_validated_shader_info *validated_shader; - }; - - static inline struct vc4_bo * -@@ -35,6 +131,17 @@ to_vc4_bo(struct drm_gem_object *bo) - return (struct vc4_bo *)bo; + dev->pullup_duration = 0; + } } - -+struct vc4_seqno_cb { -+ struct work_struct work; -+ uint64_t seqno; -+ void (*func)(struct vc4_seqno_cb *cb); -+}; -+ -+struct vc4_v3d { -+ struct platform_device *pdev; -+ void __iomem *regs; -+}; -+ - struct vc4_hvs { - struct platform_device *pdev; - void __iomem *regs; -@@ -72,9 +179,151 @@ to_vc4_encoder(struct drm_encoder *encoder) - return container_of(encoder, struct vc4_encoder, base); +diff --git a/include/linux/w1-gpio.h b/include/linux/w1-gpio.h +index d58594a..feae942 100644 +--- a/include/linux/w1-gpio.h ++++ b/include/linux/w1-gpio.h +@@ -18,6 +18,7 @@ + struct w1_gpio_platform_data { + unsigned int pin; + unsigned int is_open_drain:1; ++ unsigned int parasitic_power:1; + void (*enable_external_pullup)(int enable); + unsigned int ext_pullup_enable_pin; + unsigned int pullup_duration; + +From 8f8fe914a218412e705869e5ca6b205556275bf3 Mon Sep 17 00:00:00 2001 +From: popcornmix <popcornmix@gmail.com> +Date: Wed, 18 Dec 2013 22:16:19 +0000 +Subject: [PATCH 064/112] config: Enable CONFIG_MEMCG, but leave it disabled + (due to memory cost). Enable with cgroup_enable=memory. + +--- + kernel/cgroup.c | 24 +++++++++++++++++++++++- + 1 file changed, 23 insertions(+), 1 deletion(-) + +diff --git a/kernel/cgroup.c b/kernel/cgroup.c +index 86cb5c6..0b5668a 100644 +--- a/kernel/cgroup.c ++++ b/kernel/cgroup.c +@@ -5587,7 +5587,7 @@ int __init cgroup_init_early(void) + return 0; } -+#define V3D_READ(offset) readl(vc4->v3d->regs + offset) -+#define V3D_WRITE(offset, val) writel(val, vc4->v3d->regs + offset) - #define HVS_READ(offset) readl(vc4->hvs->regs + offset) - #define HVS_WRITE(offset, val) writel(val, vc4->hvs->regs + offset) +-static u16 cgroup_disable_mask __initdata; ++static u16 cgroup_disable_mask __initdata = 1<<0; -+enum vc4_bo_mode { -+ VC4_MODE_UNDECIDED, -+ VC4_MODE_RENDER, -+ VC4_MODE_SHADER, -+}; -+ -+struct vc4_bo_exec_state { -+ struct drm_gem_cma_object *bo; -+ enum vc4_bo_mode mode; -+}; -+ -+struct vc4_exec_info { -+ /* Sequence number for this bin/render job. */ -+ uint64_t seqno; -+ -+ /* Kernel-space copy of the ioctl arguments */ -+ struct drm_vc4_submit_cl *args; -+ -+ /* This is the array of BOs that were looked up at the start of exec. -+ * Command validation will use indices into this array. -+ */ -+ struct vc4_bo_exec_state *bo; -+ uint32_t bo_count; -+ -+ /* Pointers for our position in vc4->job_list */ -+ struct list_head head; -+ -+ /* List of other BOs used in the job that need to be released -+ * once the job is complete. -+ */ -+ struct list_head unref_list; -+ -+ /* Current unvalidated indices into @bo loaded by the non-hardware -+ * VC4_PACKET_GEM_HANDLES. -+ */ -+ uint32_t bo_index[2]; -+ -+ /* This is the BO where we store the validated command lists, shader -+ * records, and uniforms. -+ */ -+ struct drm_gem_cma_object *exec_bo; -+ -+ /** -+ * This tracks the per-shader-record state (packet 64) that -+ * determines the length of the shader record and the offset -+ * it's expected to be found at. It gets read in from the -+ * command lists. -+ */ -+ struct vc4_shader_state { -+ uint8_t packet; -+ uint32_t addr; -+ /* Maximum vertex index referenced by any primitive using this -+ * shader state. -+ */ -+ uint32_t max_index; -+ } *shader_state; -+ -+ /** How many shader states the user declared they were using. */ -+ uint32_t shader_state_size; -+ /** How many shader state records the validator has seen. */ -+ uint32_t shader_state_count; -+ -+ bool found_tile_binning_mode_config_packet; -+ bool found_start_tile_binning_packet; -+ bool found_increment_semaphore_packet; -+ uint8_t bin_tiles_x, bin_tiles_y; -+ struct drm_gem_cma_object *tile_bo; -+ uint32_t tile_alloc_offset; -+ -+ /** -+ * Computed addresses pointing into exec_bo where we start the -+ * bin thread (ct0) and render thread (ct1). -+ */ -+ uint32_t ct0ca, ct0ea; -+ uint32_t ct1ca, ct1ea; + /** + * cgroup_init - cgroup initialization +@@ -6117,6 +6117,28 @@ static int __init cgroup_no_v1(char *str) + } + __setup("cgroup_no_v1=", cgroup_no_v1); + ++static int __init cgroup_enable(char *str) ++{ ++ struct cgroup_subsys *ss; ++ char *token; ++ int i; + -+ /* Pointers to the shader recs. These paddr gets incremented as CL -+ * packets are relocated in validate_gl_shader_state, and the vaddrs -+ * (u and v) get incremented and size decremented as the shader recs -+ * themselves are validated. -+ */ -+ void *shader_rec_u; -+ void *shader_rec_v; -+ uint32_t shader_rec_p; -+ uint32_t shader_rec_size; ++ while ((token = strsep(&str, ",")) != NULL) { ++ if (!*token) ++ continue; + -+ /* Pointers to the uniform data. These pointers are incremented, and -+ * size decremented, as each batch of uniforms is uploaded. -+ */ -+ void *uniforms_u; -+ void *uniforms_v; -+ uint32_t uniforms_p; -+ uint32_t uniforms_size; -+}; ++ for_each_subsys(ss, i) { ++ if (strcmp(token, ss->name) && ++ strcmp(token, ss->legacy_name)) ++ continue; + -+static inline struct vc4_exec_info * -+vc4_first_job(struct vc4_dev *vc4) -+{ -+ if (list_empty(&vc4->job_list)) -+ return NULL; -+ return list_first_entry(&vc4->job_list, struct vc4_exec_info, head); ++ cgroup_disable_mask &= ~(1 << i); ++ } ++ } ++ return 1; +} -+ -+/** -+ * struct vc4_texture_sample_info - saves the offsets into the UBO for texture -+ * setup parameters. -+ * -+ * This will be used at draw time to relocate the reference to the texture -+ * contents in p0, and validate that the offset combined with -+ * width/height/stride/etc. from p1 and p2/p3 doesn't sample outside the BO. -+ * Note that the hardware treats unprovided config parameters as 0, so not all -+ * of them need to be set up for every texure sample, and we'll store ~0 as -+ * the offset to mark the unused ones. -+ * -+ * See the VC4 3D architecture guide page 41 ("Texture and Memory Lookup Unit -+ * Setup") for definitions of the texture parameters. -+ */ -+struct vc4_texture_sample_info { -+ bool is_direct; -+ uint32_t p_offset[4]; -+}; -+ -+/** -+ * struct vc4_validated_shader_info - information about validated shaders that -+ * needs to be used from command list validation. -+ * -+ * For a given shader, each time a shader state record references it, we need -+ * to verify that the shader doesn't read more uniforms than the shader state -+ * record's uniform BO pointer can provide, and we need to apply relocations -+ * and validate the shader state record's uniforms that define the texture -+ * samples. -+ */ -+struct vc4_validated_shader_info -+{ -+ uint32_t uniforms_size; -+ uint32_t uniforms_src_size; -+ uint32_t num_texture_samples; -+ struct vc4_texture_sample_info *texture_samples; -+}; ++__setup("cgroup_enable=", cgroup_enable); + /** - * _wait_for - magic (register) wait macro - * -@@ -111,6 +360,18 @@ int vc4_dumb_create(struct drm_file *file_priv, - struct drm_mode_create_dumb *args); - struct dma_buf *vc4_prime_export(struct drm_device *dev, - struct drm_gem_object *obj, int flags); -+int vc4_create_bo_ioctl(struct drm_device *dev, void *data, -+ struct drm_file *file_priv); -+int vc4_create_shader_bo_ioctl(struct drm_device *dev, void *data, -+ struct drm_file *file_priv); -+int vc4_mmap_bo_ioctl(struct drm_device *dev, void *data, -+ struct drm_file *file_priv); -+int vc4_mmap(struct file *filp, struct vm_area_struct *vma); -+int vc4_prime_mmap(struct drm_gem_object *obj, struct vm_area_struct *vma); -+void *vc4_prime_vmap(struct drm_gem_object *obj); -+void vc4_bo_cache_init(struct drm_device *dev); -+void vc4_bo_cache_destroy(struct drm_device *dev); -+int vc4_bo_stats_debugfs(struct seq_file *m, void *arg); - - /* vc4_crtc.c */ - extern struct platform_driver vc4_crtc_driver; -@@ -126,10 +387,34 @@ void vc4_debugfs_cleanup(struct drm_minor *minor); - /* vc4_drv.c */ - void __iomem *vc4_ioremap_regs(struct platform_device *dev, int index); - -+/* vc4_gem.c */ -+void vc4_gem_init(struct drm_device *dev); -+void vc4_gem_destroy(struct drm_device *dev); -+int vc4_submit_cl_ioctl(struct drm_device *dev, void *data, -+ struct drm_file *file_priv); -+int vc4_wait_seqno_ioctl(struct drm_device *dev, void *data, -+ struct drm_file *file_priv); -+int vc4_wait_bo_ioctl(struct drm_device *dev, void *data, -+ struct drm_file *file_priv); -+void vc4_submit_next_job(struct drm_device *dev); -+int vc4_wait_for_seqno(struct drm_device *dev, uint64_t seqno, -+ uint64_t timeout_ns, bool interruptible); -+void vc4_job_handle_completed(struct vc4_dev *vc4); -+int vc4_queue_seqno_cb(struct drm_device *dev, -+ struct vc4_seqno_cb *cb, uint64_t seqno, -+ void (*func)(struct vc4_seqno_cb *cb)); -+ - /* vc4_hdmi.c */ - extern struct platform_driver vc4_hdmi_driver; - int vc4_hdmi_debugfs_regs(struct seq_file *m, void *unused); - -+/* vc4_irq.c */ -+irqreturn_t vc4_irq(int irq, void *arg); -+void vc4_irq_preinstall(struct drm_device *dev); -+int vc4_irq_postinstall(struct drm_device *dev); -+void vc4_irq_uninstall(struct drm_device *dev); -+void vc4_irq_reset(struct drm_device *dev); -+ - /* vc4_hvs.c */ - extern struct platform_driver vc4_hvs_driver; - void vc4_hvs_dump_state(struct drm_device *dev); -@@ -143,3 +428,35 @@ struct drm_plane *vc4_plane_init(struct drm_device *dev, - enum drm_plane_type type); - u32 vc4_plane_write_dlist(struct drm_plane *plane, u32 __iomem *dlist); - u32 vc4_plane_dlist_size(struct drm_plane_state *state); -+void vc4_plane_async_set_fb(struct drm_plane *plane, struct drm_framebuffer *fb); -+ -+/* vc4_v3d.c */ -+extern struct platform_driver vc4_v3d_driver; -+int vc4_v3d_debugfs_ident(struct seq_file *m, void *unused); -+int vc4_v3d_debugfs_regs(struct seq_file *m, void *unused); -+int vc4_v3d_set_power(struct vc4_dev *vc4, bool on); -+ -+/* vc4_validate.c */ -+int -+vc4_validate_bin_cl(struct drm_device *dev, -+ void *validated, -+ void *unvalidated, -+ struct vc4_exec_info *exec); -+ -+int -+vc4_validate_shader_recs(struct drm_device *dev, struct vc4_exec_info *exec); -+ -+struct vc4_validated_shader_info * -+vc4_validate_shader(struct drm_gem_cma_object *shader_obj); -+ -+bool vc4_use_bo(struct vc4_exec_info *exec, -+ uint32_t hindex, -+ enum vc4_bo_mode mode, -+ struct drm_gem_cma_object **obj); -+ -+int vc4_get_rcl(struct drm_device *dev, struct vc4_exec_info *exec); + * css_tryget_online_from_dir - get corresponding css from a cgroup dentry + * @dentry: directory dentry of interest + +From 52e23c689e7112dee3f533c35dc4d952293a2694 Mon Sep 17 00:00:00 2001 +From: Florian Meier <florian.meier@koalo.de> +Date: Fri, 22 Nov 2013 14:59:51 +0100 +Subject: [PATCH 065/112] ASoC: Add support for PCM5102A codec + +Some definitions to support the PCM5102A codec +by Texas Instruments. + +Signed-off-by: Florian Meier <florian.meier@koalo.de> +--- + sound/soc/codecs/Kconfig | 5 ++++ + sound/soc/codecs/Makefile | 2 ++ + sound/soc/codecs/pcm5102a.c | 70 +++++++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 77 insertions(+) + create mode 100644 sound/soc/codecs/pcm5102a.c + +diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig +index 7ef3a0c..4308f90 100644 +--- a/sound/soc/codecs/Kconfig ++++ b/sound/soc/codecs/Kconfig +@@ -100,6 +100,7 @@ config SND_SOC_ALL_CODECS + select SND_SOC_RT298 if I2C + select SND_SOC_RT5514 if I2C + select SND_SOC_RT5616 if I2C ++ select SND_SOC_PCM5102A if I2C + select SND_SOC_RT5631 if I2C + select SND_SOC_RT5640 if I2C + select SND_SOC_RT5645 if I2C +@@ -631,6 +632,10 @@ config SND_SOC_RT5616 + tristate "Realtek RT5616 CODEC" + depends on I2C + ++config SND_SOC_PCM5102A ++ tristate ++ depends on I2C + -+bool vc4_check_tex_size(struct vc4_exec_info *exec, -+ struct drm_gem_cma_object *fbo, -+ uint32_t offset, uint8_t tiling_format, -+ uint32_t width, uint32_t height, uint8_t cpp); -diff --git a/drivers/gpu/drm/vc4/vc4_gem.c b/drivers/gpu/drm/vc4/vc4_gem.c + config SND_SOC_RT5631 + tristate "Realtek ALC5631/RT5631 CODEC" + depends on I2C +diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile +index 185a712..7522017 100644 +--- a/sound/soc/codecs/Makefile ++++ b/sound/soc/codecs/Makefile +@@ -98,6 +98,7 @@ snd-soc-rt286-objs := rt286.o + snd-soc-rt298-objs := rt298.o + snd-soc-rt5514-objs := rt5514.o + snd-soc-rt5616-objs := rt5616.o ++snd-soc-pcm5102a-objs := pcm5102a.o + snd-soc-rt5631-objs := rt5631.o + snd-soc-rt5640-objs := rt5640.o + snd-soc-rt5645-objs := rt5645.o +@@ -307,6 +308,7 @@ obj-$(CONFIG_SND_SOC_RT286) += snd-soc-rt286.o + obj-$(CONFIG_SND_SOC_RT298) += snd-soc-rt298.o + obj-$(CONFIG_SND_SOC_RT5514) += snd-soc-rt5514.o + obj-$(CONFIG_SND_SOC_RT5616) += snd-soc-rt5616.o ++obj-$(CONFIG_SND_SOC_PCM5102A) += snd-soc-pcm5102a.o + obj-$(CONFIG_SND_SOC_RT5631) += snd-soc-rt5631.o + obj-$(CONFIG_SND_SOC_RT5640) += snd-soc-rt5640.o + obj-$(CONFIG_SND_SOC_RT5645) += snd-soc-rt5645.o +diff --git a/sound/soc/codecs/pcm5102a.c b/sound/soc/codecs/pcm5102a.c new file mode 100644 -index 0000000..361390b +index 0000000..7c6598e --- /dev/null -+++ b/drivers/gpu/drm/vc4/vc4_gem.c -@@ -0,0 +1,686 @@ ++++ b/sound/soc/codecs/pcm5102a.c +@@ -0,0 +1,70 @@ +/* -+ * Copyright © 2014 Broadcom ++ * Driver for the PCM5102A codec + * -+ * Permission is hereby granted, free of charge, to any person obtaining a -+ * copy of this software and associated documentation files (the "Software"), -+ * to deal in the Software without restriction, including without limitation -+ * the rights to use, copy, modify, merge, publish, distribute, sublicense, -+ * and/or sell copies of the Software, and to permit persons to whom the -+ * Software is furnished to do so, subject to the following conditions: ++ * Author: Florian Meier <florian.meier@koalo.de> ++ * Copyright 2013 + * -+ * The above copyright notice and this permission notice (including the next -+ * paragraph) shall be included in all copies or substantial portions of the -+ * Software. ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * version 2 as published by the Free Software Foundation. + * -+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -+ * IN THE SOFTWARE. ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * General Public License for more details. + */ + ++ ++#include <linux/init.h> +#include <linux/module.h> +#include <linux/platform_device.h> -+#include <linux/device.h> -+#include <linux/io.h> -+ -+#include "uapi/drm/vc4_drm.h" -+#include "vc4_drv.h" -+#include "vc4_regs.h" -+#include "vc4_trace.h" -+ -+static void -+vc4_queue_hangcheck(struct drm_device *dev) -+{ -+ struct vc4_dev *vc4 = to_vc4_dev(dev); -+ -+ mod_timer(&vc4->hangcheck.timer, -+ round_jiffies_up(jiffies + msecs_to_jiffies(100))); -+} -+ -+static void -+vc4_reset(struct drm_device *dev) -+{ -+ struct vc4_dev *vc4 = to_vc4_dev(dev); -+ -+ DRM_INFO("Resetting GPU.\n"); -+ vc4_v3d_set_power(vc4, false); -+ vc4_v3d_set_power(vc4, true); -+ -+ vc4_irq_reset(dev); -+ -+ /* Rearm the hangcheck -- another job might have been waiting -+ * for our hung one to get kicked off, and vc4_irq_reset() -+ * would have started it. -+ */ -+ vc4_queue_hangcheck(dev); -+} -+ -+static void -+vc4_reset_work(struct work_struct *work) -+{ -+ struct vc4_dev *vc4 = -+ container_of(work, struct vc4_dev, hangcheck.reset_work); -+ -+ vc4_reset(vc4->dev); -+} -+ -+static void -+vc4_hangcheck_elapsed(unsigned long data) -+{ -+ struct drm_device *dev = (struct drm_device *)data; -+ struct vc4_dev *vc4 = to_vc4_dev(dev); -+ uint32_t ct0ca, ct1ca; -+ -+ /* If idle, we can stop watching for hangs. */ -+ if (list_empty(&vc4->job_list)) -+ return; -+ -+ ct0ca = V3D_READ(V3D_CTNCA(0)); -+ ct1ca = V3D_READ(V3D_CTNCA(1)); -+ -+ /* If we've made any progress in execution, rearm the timer -+ * and wait. -+ */ -+ if (ct0ca != vc4->hangcheck.last_ct0ca || -+ ct1ca != vc4->hangcheck.last_ct1ca) { -+ vc4->hangcheck.last_ct0ca = ct0ca; -+ vc4->hangcheck.last_ct1ca = ct1ca; -+ vc4_queue_hangcheck(dev); -+ return; -+ } -+ -+ /* We've gone too long with no progress, reset. This has to -+ * be done from a work struct, since resetting can sleep and -+ * this timer hook isn't allowed to. -+ */ -+ schedule_work(&vc4->hangcheck.reset_work); -+} -+ -+static void -+submit_cl(struct drm_device *dev, uint32_t thread, uint32_t start, uint32_t end) -+{ -+ struct vc4_dev *vc4 = to_vc4_dev(dev); -+ -+ /* Stop any existing thread and set state to "stopped at halt" */ -+ V3D_WRITE(V3D_CTNCS(thread), V3D_CTRUN); -+ barrier(); -+ -+ V3D_WRITE(V3D_CTNCA(thread), start); -+ barrier(); -+ -+ /* Set the end address of the control list. Writing this -+ * register is what starts the job. -+ */ -+ V3D_WRITE(V3D_CTNEA(thread), end); -+ barrier(); -+} -+ -+int -+vc4_wait_for_seqno(struct drm_device *dev, uint64_t seqno, uint64_t timeout_ns, -+ bool interruptible) -+{ -+ struct vc4_dev *vc4 = to_vc4_dev(dev); -+ int ret = 0; -+ unsigned long timeout_expire; -+ DEFINE_WAIT(wait); -+ -+ if (vc4->finished_seqno >= seqno) -+ return 0; -+ -+ if (timeout_ns == 0) -+ return -ETIME; -+ -+ timeout_expire = jiffies + nsecs_to_jiffies(timeout_ns); -+ -+ trace_vc4_wait_for_seqno_begin(dev, seqno, timeout_ns); -+ for (;;) { -+ prepare_to_wait(&vc4->job_wait_queue, &wait, -+ interruptible ? TASK_INTERRUPTIBLE : -+ TASK_UNINTERRUPTIBLE); -+ -+ if (interruptible && signal_pending(current)) { -+ ret = -ERESTARTSYS; -+ break; -+ } -+ -+ if (vc4->finished_seqno >= seqno) -+ break; -+ -+ if (timeout_ns != ~0ull) { -+ if (time_after_eq(jiffies, timeout_expire)) { -+ ret = -ETIME; -+ break; -+ } -+ schedule_timeout(timeout_expire - jiffies); -+ } else { -+ schedule(); -+ } -+ } -+ -+ finish_wait(&vc4->job_wait_queue, &wait); -+ trace_vc4_wait_for_seqno_end(dev, seqno); -+ -+ if (ret && ret != -ERESTARTSYS) { -+ DRM_ERROR("timeout waiting for render thread idle\n"); -+ return ret; -+ } -+ -+ return 0; -+} -+ -+static void -+vc4_flush_caches(struct drm_device *dev) -+{ -+ struct vc4_dev *vc4 = to_vc4_dev(dev); -+ -+ /* Flush the GPU L2 caches. These caches sit on top of system -+ * L3 (the 128kb or so shared with the CPU), and are -+ * non-allocating in the L3. -+ */ -+ V3D_WRITE(V3D_L2CACTL, -+ V3D_L2CACTL_L2CCLR); -+ -+ V3D_WRITE(V3D_SLCACTL, -+ VC4_SET_FIELD(0xf, V3D_SLCACTL_T1CC) | -+ VC4_SET_FIELD(0xf, V3D_SLCACTL_T0CC) | -+ VC4_SET_FIELD(0xf, V3D_SLCACTL_UCC) | -+ VC4_SET_FIELD(0xf, V3D_SLCACTL_ICC)); -+} -+ -+/* Sets the registers for the next job to be actually be executed in -+ * the hardware. -+ * -+ * The job_lock should be held during this. -+ */ -+void -+vc4_submit_next_job(struct drm_device *dev) -+{ -+ struct vc4_dev *vc4 = to_vc4_dev(dev); -+ struct vc4_exec_info *exec = vc4_first_job(vc4); -+ -+ if (!exec) -+ return; -+ -+ vc4_flush_caches(dev); -+ -+ /* Disable the binner's pre-loaded overflow memory address */ -+ V3D_WRITE(V3D_BPOA, 0); -+ V3D_WRITE(V3D_BPOS, 0); -+ -+ if (exec->ct0ca != exec->ct0ea) -+ submit_cl(dev, 0, exec->ct0ca, exec->ct0ea); -+ submit_cl(dev, 1, exec->ct1ca, exec->ct1ea); -+} -+ -+static void -+vc4_update_bo_seqnos(struct vc4_exec_info *exec, uint64_t seqno) -+{ -+ struct vc4_bo *bo; -+ unsigned i; -+ -+ for (i = 0; i < exec->bo_count; i++) { -+ bo = to_vc4_bo(&exec->bo[i].bo->base); -+ bo->seqno = seqno; -+ } -+ -+ list_for_each_entry(bo, &exec->unref_list, unref_head) { -+ bo->seqno = seqno; -+ } -+} -+ -+/* Queues a struct vc4_exec_info for execution. If no job is -+ * currently executing, then submits it. -+ * -+ * Unlike most GPUs, our hardware only handles one command list at a -+ * time. To queue multiple jobs at once, we'd need to edit the -+ * previous command list to have a jump to the new one at the end, and -+ * then bump the end address. That's a change for a later date, -+ * though. -+ */ -+static void -+vc4_queue_submit(struct drm_device *dev, struct vc4_exec_info *exec) -+{ -+ struct vc4_dev *vc4 = to_vc4_dev(dev); -+ uint64_t seqno = ++vc4->emit_seqno; -+ unsigned long irqflags; -+ -+ exec->seqno = seqno; -+ vc4_update_bo_seqnos(exec, seqno); -+ -+ spin_lock_irqsave(&vc4->job_lock, irqflags); -+ list_add_tail(&exec->head, &vc4->job_list); -+ -+ /* If no job was executing, kick ours off. Otherwise, it'll -+ * get started when the previous job's frame done interrupt -+ * occurs. -+ */ -+ if (vc4_first_job(vc4) == exec) { -+ vc4_submit_next_job(dev); -+ vc4_queue_hangcheck(dev); -+ } -+ -+ spin_unlock_irqrestore(&vc4->job_lock, irqflags); -+} -+ -+/** -+ * Looks up a bunch of GEM handles for BOs and stores the array for -+ * use in the command validator that actually writes relocated -+ * addresses pointing to them. -+ */ -+static int -+vc4_cl_lookup_bos(struct drm_device *dev, -+ struct drm_file *file_priv, -+ struct vc4_exec_info *exec) -+{ -+ struct drm_vc4_submit_cl *args = exec->args; -+ uint32_t *handles; -+ int ret = 0; -+ int i; -+ -+ exec->bo_count = args->bo_handle_count; -+ -+ if (!exec->bo_count) { -+ /* See comment on bo_index for why we have to check -+ * this. -+ */ -+ DRM_ERROR("Rendering requires BOs to validate\n"); -+ return -EINVAL; -+ } -+ -+ exec->bo = kcalloc(exec->bo_count, sizeof(struct vc4_bo_exec_state), -+ GFP_KERNEL); -+ if (!exec->bo) { -+ DRM_ERROR("Failed to allocate validated BO pointers\n"); -+ return -ENOMEM; -+ } -+ -+ handles = drm_malloc_ab(exec->bo_count, sizeof(uint32_t)); -+ if (!handles) { -+ DRM_ERROR("Failed to allocate incoming GEM handles\n"); -+ goto fail; -+ } -+ -+ ret = copy_from_user(handles, -+ (void __user *)(uintptr_t)args->bo_handles, -+ exec->bo_count * sizeof(uint32_t)); -+ if (ret) { -+ DRM_ERROR("Failed to copy in GEM handles\n"); -+ goto fail; -+ } -+ -+ spin_lock(&file_priv->table_lock); -+ for (i = 0; i < exec->bo_count; i++) { -+ struct drm_gem_object *bo = idr_find(&file_priv->object_idr, -+ handles[i]); -+ if (!bo) { -+ DRM_ERROR("Failed to look up GEM BO %d: %d\n", -+ i, handles[i]); -+ ret = -EINVAL; -+ spin_unlock(&file_priv->table_lock); -+ goto fail; -+ } -+ drm_gem_object_reference(bo); -+ exec->bo[i].bo = (struct drm_gem_cma_object *)bo; -+ } -+ spin_unlock(&file_priv->table_lock); -+ -+fail: -+ kfree(handles); -+ return 0; -+} -+ -+static int -+vc4_get_bcl(struct drm_device *dev, struct vc4_exec_info *exec) -+{ -+ struct drm_vc4_submit_cl *args = exec->args; -+ void *temp = NULL; -+ void *bin; -+ int ret = 0; -+ uint32_t bin_offset = 0; -+ uint32_t shader_rec_offset = roundup(bin_offset + args->bin_cl_size, -+ 16); -+ uint32_t uniforms_offset = shader_rec_offset + args->shader_rec_size; -+ uint32_t exec_size = uniforms_offset + args->uniforms_size; -+ uint32_t temp_size = exec_size + (sizeof(struct vc4_shader_state) * -+ args->shader_rec_count); -+ struct vc4_bo *bo; -+ -+ if (uniforms_offset < shader_rec_offset || -+ exec_size < uniforms_offset || -+ args->shader_rec_count >= (UINT_MAX / -+ sizeof(struct vc4_shader_state)) || -+ temp_size < exec_size) { -+ DRM_ERROR("overflow in exec arguments\n"); -+ goto fail; -+ } -+ -+ /* Allocate space where we'll store the copied in user command lists -+ * and shader records. -+ * -+ * We don't just copy directly into the BOs because we need to -+ * read the contents back for validation, and I think the -+ * bo->vaddr is uncached access. -+ */ -+ temp = kmalloc(temp_size, GFP_KERNEL); -+ if (!temp) { -+ DRM_ERROR("Failed to allocate storage for copying " -+ "in bin/render CLs.\n"); -+ ret = -ENOMEM; -+ goto fail; -+ } -+ bin = temp + bin_offset; -+ exec->shader_rec_u = temp + shader_rec_offset; -+ exec->uniforms_u = temp + uniforms_offset; -+ exec->shader_state = temp + exec_size; -+ exec->shader_state_size = args->shader_rec_count; -+ -+ ret = copy_from_user(bin, -+ (void __user *)(uintptr_t)args->bin_cl, -+ args->bin_cl_size); -+ if (ret) { -+ DRM_ERROR("Failed to copy in bin cl\n"); -+ goto fail; -+ } -+ -+ ret = copy_from_user(exec->shader_rec_u, -+ (void __user *)(uintptr_t)args->shader_rec, -+ args->shader_rec_size); -+ if (ret) { -+ DRM_ERROR("Failed to copy in shader recs\n"); -+ goto fail; -+ } -+ -+ ret = copy_from_user(exec->uniforms_u, -+ (void __user *)(uintptr_t)args->uniforms, -+ args->uniforms_size); -+ if (ret) { -+ DRM_ERROR("Failed to copy in uniforms cl\n"); -+ goto fail; -+ } -+ -+ bo = vc4_bo_create(dev, exec_size); -+ if (!bo) { -+ DRM_ERROR("Couldn't allocate BO for binning\n"); -+ ret = PTR_ERR(exec->exec_bo); -+ goto fail; -+ } -+ exec->exec_bo = &bo->base; -+ -+ list_add_tail(&to_vc4_bo(&exec->exec_bo->base)->unref_head, -+ &exec->unref_list); -+ -+ exec->ct0ca = exec->exec_bo->paddr + bin_offset; -+ -+ exec->shader_rec_v = exec->exec_bo->vaddr + shader_rec_offset; -+ exec->shader_rec_p = exec->exec_bo->paddr + shader_rec_offset; -+ exec->shader_rec_size = args->shader_rec_size; -+ -+ exec->uniforms_v = exec->exec_bo->vaddr + uniforms_offset; -+ exec->uniforms_p = exec->exec_bo->paddr + uniforms_offset; -+ exec->uniforms_size = args->uniforms_size; -+ -+ ret = vc4_validate_bin_cl(dev, -+ exec->exec_bo->vaddr + bin_offset, -+ bin, -+ exec); -+ if (ret) -+ goto fail; -+ -+ ret = vc4_validate_shader_recs(dev, exec); -+ -+fail: -+ kfree(temp); -+ return ret; -+} -+ -+static void -+vc4_complete_exec(struct vc4_exec_info *exec) -+{ -+ unsigned i; -+ -+ if (exec->bo) { -+ for (i = 0; i < exec->bo_count; i++) -+ drm_gem_object_unreference(&exec->bo[i].bo->base); -+ kfree(exec->bo); -+ } -+ -+ while (!list_empty(&exec->unref_list)) { -+ struct vc4_bo *bo = list_first_entry(&exec->unref_list, -+ struct vc4_bo, unref_head); -+ list_del(&bo->unref_head); -+ drm_gem_object_unreference(&bo->base.base); -+ } -+ -+ kfree(exec); -+} -+ -+void -+vc4_job_handle_completed(struct vc4_dev *vc4) -+{ -+ unsigned long irqflags; -+ struct vc4_seqno_cb *cb, *cb_temp; -+ -+ spin_lock_irqsave(&vc4->job_lock, irqflags); -+ while (!list_empty(&vc4->job_done_list)) { -+ struct vc4_exec_info *exec = -+ list_first_entry(&vc4->job_done_list, -+ struct vc4_exec_info, head); -+ list_del(&exec->head); -+ -+ spin_unlock_irqrestore(&vc4->job_lock, irqflags); -+ vc4_complete_exec(exec); -+ spin_lock_irqsave(&vc4->job_lock, irqflags); -+ } -+ spin_unlock_irqrestore(&vc4->job_lock, irqflags); -+ -+ list_for_each_entry_safe(cb, cb_temp, &vc4->seqno_cb_list, work.entry) { -+ if (cb->seqno <= vc4->finished_seqno) { -+ list_del_init(&cb->work.entry); -+ schedule_work(&cb->work); -+ } -+ } -+} -+ -+static void vc4_seqno_cb_work(struct work_struct *work) -+{ -+ struct vc4_seqno_cb *cb = container_of(work, struct vc4_seqno_cb, work); -+ cb->func(cb); -+} -+ -+int vc4_queue_seqno_cb(struct drm_device *dev, -+ struct vc4_seqno_cb *cb, uint64_t seqno, -+ void (*func)(struct vc4_seqno_cb *cb)) -+{ -+ struct vc4_dev *vc4 = to_vc4_dev(dev); -+ int ret = 0; + -+ cb->func = func; -+ INIT_WORK(&cb->work, vc4_seqno_cb_work); -+ -+ mutex_lock(&dev->struct_mutex); -+ if (seqno > vc4->finished_seqno) { -+ cb->seqno = seqno; -+ list_add_tail(&cb->work.entry, &vc4->seqno_cb_list); -+ } else { -+ schedule_work(&cb->work); -+ } -+ mutex_unlock(&dev->struct_mutex); -+ -+ return ret; -+} -+ -+/* Scheduled when any job has been completed, this walks the list of -+ * jobs that had completed and unrefs their BOs and frees their exec -+ * structs. -+ */ -+static void -+vc4_job_done_work(struct work_struct *work) -+{ -+ struct vc4_dev *vc4 = -+ container_of(work, struct vc4_dev, job_done_work); -+ struct drm_device *dev = vc4->dev; -+ -+ /* Need the struct lock for drm_gem_object_unreference(). */ -+ mutex_lock(&dev->struct_mutex); -+ vc4_job_handle_completed(vc4); -+ mutex_unlock(&dev->struct_mutex); -+} -+ -+static int -+vc4_wait_for_seqno_ioctl_helper(struct drm_device *dev, -+ uint64_t seqno, -+ uint64_t *timeout_ns) -+{ -+ unsigned long start = jiffies; -+ int ret = vc4_wait_for_seqno(dev, seqno, *timeout_ns, true); -+ -+ if ((ret == -EINTR || ret == -ERESTARTSYS) && *timeout_ns != ~0ull) { -+ uint64_t delta = jiffies_to_nsecs(jiffies - start); -+ if (*timeout_ns >= delta) -+ *timeout_ns -= delta; -+ } -+ -+ return ret; -+} ++#include <sound/soc.h> + -+int -+vc4_wait_seqno_ioctl(struct drm_device *dev, void *data, -+ struct drm_file *file_priv) -+{ -+ struct drm_vc4_wait_seqno *args = data; ++static struct snd_soc_dai_driver pcm5102a_dai = { ++ .name = "pcm5102a-hifi", ++ .playback = { ++ .channels_min = 2, ++ .channels_max = 2, ++ .rates = SNDRV_PCM_RATE_8000_192000, ++ .formats = SNDRV_PCM_FMTBIT_S16_LE | ++ SNDRV_PCM_FMTBIT_S24_LE | ++ SNDRV_PCM_FMTBIT_S32_LE ++ }, ++}; + -+ return vc4_wait_for_seqno_ioctl_helper(dev, args->seqno, -+ &args->timeout_ns); -+} ++static struct snd_soc_codec_driver soc_codec_dev_pcm5102a; + -+int -+vc4_wait_bo_ioctl(struct drm_device *dev, void *data, -+ struct drm_file *file_priv) ++static int pcm5102a_probe(struct platform_device *pdev) +{ -+ int ret; -+ struct drm_vc4_wait_bo *args = data; -+ struct drm_gem_object *gem_obj; -+ struct vc4_bo *bo; -+ -+ gem_obj = drm_gem_object_lookup(dev, file_priv, args->handle); -+ if (!gem_obj) { -+ DRM_ERROR("Failed to look up GEM BO %d\n", args->handle); -+ return -EINVAL; -+ } -+ bo = to_vc4_bo(gem_obj); -+ -+ ret = vc4_wait_for_seqno_ioctl_helper(dev, bo->seqno, &args->timeout_ns); -+ -+ drm_gem_object_unreference(gem_obj); -+ return ret; ++ return snd_soc_register_codec(&pdev->dev, &soc_codec_dev_pcm5102a, ++ &pcm5102a_dai, 1); +} + -+/** -+ * Submits a command list to the VC4. -+ * -+ * This is what is called batchbuffer emitting on other hardware. -+ */ -+int -+vc4_submit_cl_ioctl(struct drm_device *dev, void *data, -+ struct drm_file *file_priv) ++static int pcm5102a_remove(struct platform_device *pdev) +{ -+ struct vc4_dev *vc4 = to_vc4_dev(dev); -+ struct drm_vc4_submit_cl *args = data; -+ struct vc4_exec_info *exec; -+ int ret; -+ -+ if ((args->flags & ~VC4_SUBMIT_CL_USE_CLEAR_COLOR) != 0) { -+ DRM_ERROR("Unknown flags: 0x%02x\n", args->flags); -+ return -EINVAL; -+ } -+ -+ exec = kcalloc(1, sizeof(*exec), GFP_KERNEL); -+ if (!exec) { -+ DRM_ERROR("malloc failure on exec struct\n"); -+ return -ENOMEM; -+ } -+ -+ exec->args = args; -+ INIT_LIST_HEAD(&exec->unref_list); -+ -+ mutex_lock(&dev->struct_mutex); -+ -+ ret = vc4_cl_lookup_bos(dev, file_priv, exec); -+ if (ret) -+ goto fail; -+ -+ if (exec->args->bin_cl_size != 0) { -+ ret = vc4_get_bcl(dev, exec); -+ if (ret) -+ goto fail; -+ } else { -+ exec->ct0ca = exec->ct0ea = 0; -+ } -+ -+ ret = vc4_get_rcl(dev, exec); -+ if (ret) -+ goto fail; -+ -+ /* Clear this out of the struct we'll be putting in the queue, -+ * since it's part of our stack. -+ */ -+ exec->args = NULL; -+ -+ vc4_queue_submit(dev, exec); -+ -+ /* Return the seqno for our job. */ -+ args->seqno = vc4->emit_seqno; -+ -+ mutex_unlock(&dev->struct_mutex); -+ ++ snd_soc_unregister_codec(&pdev->dev); + return 0; -+ -+fail: -+ vc4_complete_exec(exec); -+ -+ mutex_unlock(&dev->struct_mutex); -+ -+ return ret; +} + -+void -+vc4_gem_init(struct drm_device *dev) -+{ -+ struct vc4_dev *vc4 = to_vc4_dev(dev); -+ -+ INIT_LIST_HEAD(&vc4->job_list); -+ INIT_LIST_HEAD(&vc4->job_done_list); -+ INIT_LIST_HEAD(&vc4->seqno_cb_list); -+ spin_lock_init(&vc4->job_lock); -+ -+ INIT_WORK(&vc4->hangcheck.reset_work, vc4_reset_work); -+ setup_timer(&vc4->hangcheck.timer, -+ vc4_hangcheck_elapsed, -+ (unsigned long) dev); ++static const struct of_device_id pcm5102a_of_match[] = { ++ { .compatible = "ti,pcm5102a", }, ++ { } ++}; ++MODULE_DEVICE_TABLE(of, pcm5102a_of_match); + -+ INIT_WORK(&vc4->job_done_work, vc4_job_done_work); -+} ++static struct platform_driver pcm5102a_codec_driver = { ++ .probe = pcm5102a_probe, ++ .remove = pcm5102a_remove, ++ .driver = { ++ .name = "pcm5102a-codec", ++ .owner = THIS_MODULE, ++ .of_match_table = pcm5102a_of_match, ++ }, ++}; + -+void -+vc4_gem_destroy(struct drm_device *dev) -+{ -+ struct vc4_dev *vc4 = to_vc4_dev(dev); ++module_platform_driver(pcm5102a_codec_driver); + -+ /* Waiting for exec to finish would need to be done before -+ * unregistering V3D. -+ */ -+ WARN_ON(vc4->emit_seqno != vc4->finished_seqno); ++MODULE_DESCRIPTION("ASoC PCM5102A codec driver"); ++MODULE_AUTHOR("Florian Meier <florian.meier@koalo.de>"); ++MODULE_LICENSE("GPL v2"); + +From 8963bf5947a58437d86fd18cd2e1a3dacb6c16ae Mon Sep 17 00:00:00 2001 +From: Florian Meier <florian.meier@koalo.de> +Date: Fri, 22 Nov 2013 19:19:08 +0100 +Subject: [PATCH 066/112] ASoC: Add support for HifiBerry DAC + +This adds a machine driver for the HifiBerry DAC. +It is a sound card that can +be stacked onto the Raspberry Pi. + +Signed-off-by: Florian Meier <florian.meier@koalo.de> +--- + sound/soc/bcm/Kconfig | 7 +++ + sound/soc/bcm/Makefile | 4 ++ + sound/soc/bcm/hifiberry_dac.c | 123 ++++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 134 insertions(+) + create mode 100644 sound/soc/bcm/hifiberry_dac.c + +diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig +index c5070ae..ce81f14 100644 +--- a/sound/soc/bcm/Kconfig ++++ b/sound/soc/bcm/Kconfig +@@ -7,3 +7,10 @@ config SND_BCM2835_SOC_I2S + Say Y or M if you want to add support for codecs attached to + the BCM2835 I2S interface. You will also need + to select the audio interfaces to support below. + -+ /* V3D should already have disabled its interrupt and cleared -+ * the overflow allocation registers. Now free the object. -+ */ -+ if (vc4->overflow_mem) { -+ drm_gem_object_unreference_unlocked(&vc4->overflow_mem->base.base); -+ vc4->overflow_mem = NULL; -+ } ++config SND_BCM2708_SOC_HIFIBERRY_DAC ++ tristate "Support for HifiBerry DAC" ++ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S ++ select SND_SOC_PCM5102A ++ help ++ Say Y or M if you want to add support for HifiBerry DAC. +diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile +index bc816b7..b877d38 100644 +--- a/sound/soc/bcm/Makefile ++++ b/sound/soc/bcm/Makefile +@@ -3,3 +3,7 @@ snd-soc-bcm2835-i2s-objs := bcm2835-i2s.o + + obj-$(CONFIG_SND_BCM2835_SOC_I2S) += snd-soc-bcm2835-i2s.o + ++# BCM2708 Machine Support ++snd-soc-hifiberry-dac-objs := hifiberry_dac.o + -+ vc4_bo_cache_destroy(dev); -+} -diff --git a/drivers/gpu/drm/vc4/vc4_irq.c b/drivers/gpu/drm/vc4/vc4_irq.c ++obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o +diff --git a/sound/soc/bcm/hifiberry_dac.c b/sound/soc/bcm/hifiberry_dac.c new file mode 100644 -index 0000000..f29b796 +index 0000000..29ecc08 --- /dev/null -+++ b/drivers/gpu/drm/vc4/vc4_irq.c -@@ -0,0 +1,211 @@ ++++ b/sound/soc/bcm/hifiberry_dac.c +@@ -0,0 +1,123 @@ +/* -+ * Copyright © 2014 Broadcom -+ * -+ * Permission is hereby granted, free of charge, to any person obtaining a -+ * copy of this software and associated documentation files (the "Software"), -+ * to deal in the Software without restriction, including without limitation -+ * the rights to use, copy, modify, merge, publish, distribute, sublicense, -+ * and/or sell copies of the Software, and to permit persons to whom the -+ * Software is furnished to do so, subject to the following conditions: -+ * -+ * The above copyright notice and this permission notice (including the next -+ * paragraph) shall be included in all copies or substantial portions of the -+ * Software. -+ * -+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -+ * IN THE SOFTWARE. -+ */ -+ -+/** DOC: Interrupt management for the V3D engine. ++ * ASoC Driver for HifiBerry DAC + * -+ * We have an interrupt status register (V3D_INTCTL) which reports -+ * interrupts, and where writing 1 bits clears those interrupts. -+ * There are also a pair of interrupt registers -+ * (V3D_INTENA/V3D_INTDIS) where writing a 1 to their bits enables or -+ * disables that specific interrupt, and 0s written are ignored -+ * (reading either one returns the set of enabled interrupts). ++ * Author: Florian Meier <florian.meier@koalo.de> ++ * Copyright 2013 + * -+ * When we take a render frame interrupt, we need to wake the -+ * processes waiting for some frame to be done, and get the next frame -+ * submitted ASAP (so the hardware doesn't sit idle when there's work -+ * to do). ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * version 2 as published by the Free Software Foundation. + * -+ * When we take the binner out of memory interrupt, we need to -+ * allocate some new memory and pass it to the binner so that the -+ * current job can make progress. ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * General Public License for more details. + */ + -+#include "vc4_drv.h" -+#include "vc4_regs.h" -+ -+#define V3D_DRIVER_IRQS (V3D_INT_OUTOMEM | \ -+ V3D_INT_FRDONE) -+ -+DECLARE_WAIT_QUEUE_HEAD(render_wait); -+ -+static void -+vc4_overflow_mem_work(struct work_struct *work) -+{ -+ struct vc4_dev *vc4 = -+ container_of(work, struct vc4_dev, overflow_mem_work); -+ struct drm_device *dev = vc4->dev; -+ struct vc4_bo *bo; -+ -+ bo = vc4_bo_create(dev, 256 * 1024); -+ if (!bo) { -+ DRM_ERROR("Couldn't allocate binner overflow mem\n"); -+ return; -+ } -+ -+ /* If there's a job executing currently, then our previous -+ * overflow allocation is getting used in that job and we need -+ * to queue it to be released when the job is done. But if no -+ * job is executing at all, then we can free the old overflow -+ * object direcctly. -+ * -+ * No lock necessary for this pointer since we're the only -+ * ones that update the pointer, and our workqueue won't -+ * reenter. -+ */ -+ if (vc4->overflow_mem) { -+ struct vc4_exec_info *current_exec; -+ unsigned long irqflags; -+ -+ spin_lock_irqsave(&vc4->job_lock, irqflags); -+ current_exec = vc4_first_job(vc4); -+ if (current_exec) { -+ vc4->overflow_mem->seqno = vc4->finished_seqno + 1; -+ list_add_tail(&vc4->overflow_mem->unref_head, -+ &current_exec->unref_list); -+ vc4->overflow_mem = NULL; -+ } -+ spin_unlock_irqrestore(&vc4->job_lock, irqflags); -+ } -+ -+ if (vc4->overflow_mem) { -+ drm_gem_object_unreference_unlocked(&vc4->overflow_mem->base.base); -+ } -+ vc4->overflow_mem = bo; ++#include <linux/module.h> ++#include <linux/platform_device.h> + -+ V3D_WRITE(V3D_BPOA, bo->base.paddr); -+ V3D_WRITE(V3D_BPOS, bo->base.base.size); -+ V3D_WRITE(V3D_INTCTL, V3D_INT_OUTOMEM); -+ V3D_WRITE(V3D_INTENA, V3D_INT_OUTOMEM); -+} ++#include <sound/core.h> ++#include <sound/pcm.h> ++#include <sound/pcm_params.h> ++#include <sound/soc.h> ++#include <sound/jack.h> + -+static void -+vc4_irq_finish_job(struct drm_device *dev) ++static int snd_rpi_hifiberry_dac_init(struct snd_soc_pcm_runtime *rtd) +{ -+ struct vc4_dev *vc4 = to_vc4_dev(dev); -+ struct vc4_exec_info *exec = vc4_first_job(vc4); -+ -+ if (!exec) -+ return; -+ -+ vc4->finished_seqno++; -+ list_move_tail(&exec->head, &vc4->job_done_list); -+ vc4_submit_next_job(dev); -+ -+ wake_up_all(&vc4->job_wait_queue); -+ schedule_work(&vc4->job_done_work); ++ return 0; +} + -+irqreturn_t -+vc4_irq(int irq, void *arg) ++static int snd_rpi_hifiberry_dac_hw_params(struct snd_pcm_substream *substream, ++ struct snd_pcm_hw_params *params) +{ -+ struct drm_device *dev = arg; -+ struct vc4_dev *vc4 = to_vc4_dev(dev); -+ uint32_t intctl; -+ irqreturn_t status = IRQ_NONE; -+ -+ barrier(); -+ intctl = V3D_READ(V3D_INTCTL); -+ -+ /* Acknowledge the interrupts we're handling here. The render -+ * frame done interrupt will be cleared, while OUTOMEM will -+ * stay high until the underlying cause is cleared. -+ */ -+ V3D_WRITE(V3D_INTCTL, intctl); -+ -+ if (intctl & V3D_INT_OUTOMEM) { -+ /* Disable OUTOMEM until the work is done. */ -+ V3D_WRITE(V3D_INTDIS, V3D_INT_OUTOMEM); -+ schedule_work(&vc4->overflow_mem_work); -+ status = IRQ_HANDLED; -+ } ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; + -+ if (intctl & V3D_INT_FRDONE) { -+ spin_lock(&vc4->job_lock); -+ vc4_irq_finish_job(dev); -+ spin_unlock(&vc4->job_lock); -+ status = IRQ_HANDLED; -+ } ++ unsigned int sample_bits = ++ snd_pcm_format_physical_width(params_format(params)); + -+ return status; ++ return snd_soc_dai_set_bclk_ratio(cpu_dai, sample_bits * 2); +} + -+void -+vc4_irq_preinstall(struct drm_device *dev) -+{ -+ struct vc4_dev *vc4 = to_vc4_dev(dev); -+ -+ init_waitqueue_head(&vc4->job_wait_queue); -+ INIT_WORK(&vc4->overflow_mem_work, vc4_overflow_mem_work); -+ -+ /* Clear any pending interrupts someone might have left around -+ * for us. -+ */ -+ V3D_WRITE(V3D_INTCTL, V3D_DRIVER_IRQS); -+} ++/* machine stream operations */ ++static struct snd_soc_ops snd_rpi_hifiberry_dac_ops = { ++ .hw_params = snd_rpi_hifiberry_dac_hw_params, ++}; + -+int -+vc4_irq_postinstall(struct drm_device *dev) ++static struct snd_soc_dai_link snd_rpi_hifiberry_dac_dai[] = { +{ -+ struct vc4_dev *vc4 = to_vc4_dev(dev); -+ -+ /* Enable both the render done and out of memory interrupts. */ -+ V3D_WRITE(V3D_INTENA, V3D_DRIVER_IRQS); ++ .name = "HifiBerry DAC", ++ .stream_name = "HifiBerry DAC HiFi", ++ .cpu_dai_name = "bcm2708-i2s.0", ++ .codec_dai_name = "pcm5102a-hifi", ++ .platform_name = "bcm2708-i2s.0", ++ .codec_name = "pcm5102a-codec", ++ .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | ++ SND_SOC_DAIFMT_CBS_CFS, ++ .ops = &snd_rpi_hifiberry_dac_ops, ++ .init = snd_rpi_hifiberry_dac_init, ++}, ++}; + -+ return 0; -+} ++/* audio machine driver */ ++static struct snd_soc_card snd_rpi_hifiberry_dac = { ++ .name = "snd_rpi_hifiberry_dac", ++ .owner = THIS_MODULE, ++ .dai_link = snd_rpi_hifiberry_dac_dai, ++ .num_links = ARRAY_SIZE(snd_rpi_hifiberry_dac_dai), ++}; + -+void -+vc4_irq_uninstall(struct drm_device *dev) ++static int snd_rpi_hifiberry_dac_probe(struct platform_device *pdev) +{ -+ struct vc4_dev *vc4 = to_vc4_dev(dev); -+ -+ /* Disable sending interrupts for our driver's IRQs. */ -+ V3D_WRITE(V3D_INTDIS, V3D_DRIVER_IRQS); -+ -+ /* Clear any pending interrupts we might have left. */ -+ V3D_WRITE(V3D_INTCTL, V3D_DRIVER_IRQS); -+ -+ cancel_work_sync(&vc4->overflow_mem_work); -+} ++ int ret = 0; + -+/** Reinitializes interrupt registers when a GPU reset is performed. */ -+void vc4_irq_reset(struct drm_device *dev) -+{ -+ struct vc4_dev *vc4 = to_vc4_dev(dev); -+ unsigned long irqflags; ++ snd_rpi_hifiberry_dac.dev = &pdev->dev; + -+ /* Acknowledge any stale IRQs. */ -+ V3D_WRITE(V3D_INTCTL, V3D_DRIVER_IRQS); ++ if (pdev->dev.of_node) { ++ struct device_node *i2s_node; ++ struct snd_soc_dai_link *dai = &snd_rpi_hifiberry_dac_dai[0]; ++ i2s_node = of_parse_phandle(pdev->dev.of_node, ++ "i2s-controller", 0); + -+ /* -+ * Turn all our interrupts on. Binner out of memory is the -+ * only one we expect to trigger at this point, since we've -+ * just come from poweron and haven't supplied any overflow -+ * memory yet. -+ */ -+ V3D_WRITE(V3D_INTENA, V3D_DRIVER_IRQS); ++ if (i2s_node) { ++ dai->cpu_dai_name = NULL; ++ dai->cpu_of_node = i2s_node; ++ dai->platform_name = NULL; ++ dai->platform_of_node = i2s_node; ++ } ++ } + -+ spin_lock_irqsave(&vc4->job_lock, irqflags); -+ vc4_irq_finish_job(dev); -+ spin_unlock_irqrestore(&vc4->job_lock, irqflags); -+} -diff --git a/drivers/gpu/drm/vc4/vc4_kms.c b/drivers/gpu/drm/vc4/vc4_kms.c -index 2e5597d..c83287a 100644 ---- a/drivers/gpu/drm/vc4/vc4_kms.c -+++ b/drivers/gpu/drm/vc4/vc4_kms.c -@@ -15,6 +15,7 @@ - */ - - #include "drm_crtc.h" -+#include "drm_atomic.h" - #include "drm_atomic_helper.h" - #include "drm_crtc_helper.h" - #include "drm_plane_helper.h" -@@ -29,10 +30,151 @@ static void vc4_output_poll_changed(struct drm_device *dev) - drm_fbdev_cma_hotplug_event(vc4->fbdev); - } - -+struct vc4_commit { -+ struct drm_device *dev; -+ struct drm_atomic_state *state; -+ struct vc4_seqno_cb cb; -+}; ++ ret = snd_soc_register_card(&snd_rpi_hifiberry_dac); ++ if (ret) ++ dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", ret); + -+static void -+vc4_atomic_complete_commit(struct vc4_commit *c) -+{ -+ struct drm_atomic_state *state = c->state; -+ struct drm_device *dev = state->dev; -+ struct vc4_dev *vc4 = to_vc4_dev(dev); ++ return ret; ++} + -+ drm_atomic_helper_commit_modeset_disables(dev, state); ++static int snd_rpi_hifiberry_dac_remove(struct platform_device *pdev) ++{ ++ return snd_soc_unregister_card(&snd_rpi_hifiberry_dac); ++} + -+ drm_atomic_helper_commit_planes(dev, state); ++static const struct of_device_id snd_rpi_hifiberry_dac_of_match[] = { ++ { .compatible = "hifiberry,hifiberry-dac", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, snd_rpi_hifiberry_dac_of_match); + -+ drm_atomic_helper_commit_modeset_enables(dev, state); ++static struct platform_driver snd_rpi_hifiberry_dac_driver = { ++ .driver = { ++ .name = "snd-hifiberry-dac", ++ .owner = THIS_MODULE, ++ .of_match_table = snd_rpi_hifiberry_dac_of_match, ++ }, ++ .probe = snd_rpi_hifiberry_dac_probe, ++ .remove = snd_rpi_hifiberry_dac_remove, ++}; + -+ drm_atomic_helper_wait_for_vblanks(dev, state); ++module_platform_driver(snd_rpi_hifiberry_dac_driver); + -+ drm_atomic_helper_cleanup_planes(dev, state); ++MODULE_AUTHOR("Florian Meier <florian.meier@koalo.de>"); ++MODULE_DESCRIPTION("ASoC Driver for HifiBerry DAC"); ++MODULE_LICENSE("GPL v2"); + +From 133cbdab8d6f90145845d63730736887fbeb3cbe Mon Sep 17 00:00:00 2001 +From: Florian Meier <florian.meier@koalo.de> +Date: Mon, 25 Jan 2016 15:48:59 +0000 +Subject: [PATCH 067/112] ASoC: Add support for Rpi-DAC + +--- + sound/soc/bcm/Kconfig | 7 +++ + sound/soc/bcm/Makefile | 2 + + sound/soc/bcm/rpi-dac.c | 119 ++++++++++++++++++++++++++++++++++++++++++++ + sound/soc/codecs/Kconfig | 9 ++++ + sound/soc/codecs/Makefile | 2 + + sound/soc/codecs/pcm1794a.c | 69 +++++++++++++++++++++++++ + 6 files changed, 208 insertions(+) + create mode 100644 sound/soc/bcm/rpi-dac.c + create mode 100644 sound/soc/codecs/pcm1794a.c + +diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig +index ce81f14..900de22 100644 +--- a/sound/soc/bcm/Kconfig ++++ b/sound/soc/bcm/Kconfig +@@ -14,3 +14,10 @@ config SND_BCM2708_SOC_HIFIBERRY_DAC + select SND_SOC_PCM5102A + help + Say Y or M if you want to add support for HifiBerry DAC. + -+ drm_atomic_state_free(state); ++config SND_BCM2708_SOC_RPI_DAC ++ tristate "Support for RPi-DAC" ++ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S ++ select SND_SOC_PCM1794A ++ help ++ Say Y or M if you want to add support for RPi-DAC. +diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile +index b877d38..99c96b4 100644 +--- a/sound/soc/bcm/Makefile ++++ b/sound/soc/bcm/Makefile +@@ -5,5 +5,7 @@ obj-$(CONFIG_SND_BCM2835_SOC_I2S) += snd-soc-bcm2835-i2s.o + + # BCM2708 Machine Support + snd-soc-hifiberry-dac-objs := hifiberry_dac.o ++snd-soc-rpi-dac-objs := rpi-dac.o + + obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o ++obj-$(CONFIG_SND_BCM2708_SOC_RPI_DAC) += snd-soc-rpi-dac.o +diff --git a/sound/soc/bcm/rpi-dac.c b/sound/soc/bcm/rpi-dac.c +new file mode 100644 +index 0000000..59dc89e +--- /dev/null ++++ b/sound/soc/bcm/rpi-dac.c +@@ -0,0 +1,119 @@ ++/* ++ * ASoC Driver for RPi-DAC. ++ * ++ * Author: Florian Meier <florian.meier@koalo.de> ++ * Copyright 2013 ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * version 2 as published by the Free Software Foundation. ++ * ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * General Public License for more details. ++ */ + -+ up(&vc4->async_modeset); ++#include <linux/module.h> ++#include <linux/platform_device.h> + -+ kfree(c); -+} ++#include <sound/core.h> ++#include <sound/pcm.h> ++#include <sound/pcm_params.h> ++#include <sound/soc.h> ++#include <sound/jack.h> + -+static void -+vc4_atomic_complete_commit_seqno_cb(struct vc4_seqno_cb *cb) ++static int snd_rpi_rpi_dac_init(struct snd_soc_pcm_runtime *rtd) +{ -+ struct vc4_commit *c = container_of(cb, struct vc4_commit, cb); -+ -+ vc4_atomic_complete_commit(c); ++ return 0; +} + -+static struct vc4_commit *commit_init(struct drm_atomic_state *state) ++static int snd_rpi_rpi_dac_hw_params(struct snd_pcm_substream *substream, ++ struct snd_pcm_hw_params *params) +{ -+ struct vc4_commit *c = kzalloc(sizeof(*c), GFP_KERNEL); -+ -+ if (!c) -+ return NULL; -+ c->dev = state->dev; -+ c->state = state; ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; + -+ return c; ++ return snd_soc_dai_set_bclk_ratio(cpu_dai, 32*2); +} + -+/** -+ * vc4_atomic_commit - commit validated state object -+ * @dev: DRM device -+ * @state: the driver state object -+ * @async: asynchronous commit -+ * -+ * This function commits a with drm_atomic_helper_check() pre-validated state -+ * object. This can still fail when e.g. the framebuffer reservation fails. For -+ * now this doesn't implement asynchronous commits. -+ * -+ * RETURNS -+ * Zero for success or -errno. -+ */ -+static int vc4_atomic_commit(struct drm_device *dev, -+ struct drm_atomic_state *state, -+ bool async) -+{ -+ struct vc4_dev *vc4 = to_vc4_dev(dev); -+ int ret; -+ int i; -+ uint64_t wait_seqno = 0; -+ struct vc4_commit *c; -+ -+ c = commit_init(state); -+ if (!c) -+ return -ENOMEM; ++/* machine stream operations */ ++static struct snd_soc_ops snd_rpi_rpi_dac_ops = { ++ .hw_params = snd_rpi_rpi_dac_hw_params, ++}; + -+ /* Make sure that any outstanding modesets have finished. */ -+ ret = down_interruptible(&vc4->async_modeset); -+ if (ret) { -+ kfree(c); -+ return ret; -+ } ++static struct snd_soc_dai_link snd_rpi_rpi_dac_dai[] = { ++{ ++ .name = "RPi-DAC", ++ .stream_name = "RPi-DAC HiFi", ++ .cpu_dai_name = "bcm2708-i2s.0", ++ .codec_dai_name = "pcm1794a-hifi", ++ .platform_name = "bcm2708-i2s.0", ++ .codec_name = "pcm1794a-codec", ++ .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | ++ SND_SOC_DAIFMT_CBS_CFS, ++ .ops = &snd_rpi_rpi_dac_ops, ++ .init = snd_rpi_rpi_dac_init, ++}, ++}; + -+ ret = drm_atomic_helper_prepare_planes(dev, state); -+ if (ret) { -+ kfree(c); -+ up(&vc4->async_modeset); -+ return ret; -+ } ++/* audio machine driver */ ++static struct snd_soc_card snd_rpi_rpi_dac = { ++ .name = "snd_rpi_rpi_dac", ++ .owner = THIS_MODULE, ++ .dai_link = snd_rpi_rpi_dac_dai, ++ .num_links = ARRAY_SIZE(snd_rpi_rpi_dac_dai), ++}; + -+ for (i = 0; i < dev->mode_config.num_total_plane; i++) { -+ struct drm_plane *plane = state->planes[i]; -+ struct drm_plane_state *new_state = state->plane_states[i]; ++static int snd_rpi_rpi_dac_probe(struct platform_device *pdev) ++{ ++ int ret = 0; + -+ if (!plane) -+ continue; ++ snd_rpi_rpi_dac.dev = &pdev->dev; ++ ++ if (pdev->dev.of_node) { ++ struct device_node *i2s_node; ++ struct snd_soc_dai_link *dai = &snd_rpi_rpi_dac_dai[0]; ++ i2s_node = of_parse_phandle(pdev->dev.of_node, "i2s-controller", 0); + -+ if ((plane->state->fb != new_state->fb) && new_state->fb) { -+ struct drm_gem_cma_object *cma_bo = -+ drm_fb_cma_get_gem_obj(new_state->fb, 0); -+ struct vc4_bo *bo = to_vc4_bo(&cma_bo->base); -+ wait_seqno = max(bo->seqno, wait_seqno); ++ if (i2s_node) { ++ dai->cpu_dai_name = NULL; ++ dai->cpu_of_node = i2s_node; ++ dai->platform_name = NULL; ++ dai->platform_of_node = i2s_node; + } + } ++ ++ ret = snd_soc_register_card(&snd_rpi_rpi_dac); ++ if (ret) ++ dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", ret); + -+ /* -+ * This is the point of no return - everything below never fails except -+ * when the hw goes bonghits. Which means we can commit the new state on -+ * the software side now. -+ */ ++ return ret; ++} + -+ drm_atomic_helper_swap_state(dev, state); ++static int snd_rpi_rpi_dac_remove(struct platform_device *pdev) ++{ ++ return snd_soc_unregister_card(&snd_rpi_rpi_dac); ++} + -+ /* -+ * Everything below can be run asynchronously without the need to grab -+ * any modeset locks at all under one condition: It must be guaranteed -+ * that the asynchronous work has either been cancelled (if the driver -+ * supports it, which at least requires that the framebuffers get -+ * cleaned up with drm_atomic_helper_cleanup_planes()) or completed -+ * before the new state gets committed on the software side with -+ * drm_atomic_helper_swap_state(). -+ * -+ * This scheme allows new atomic state updates to be prepared and -+ * checked in parallel to the asynchronous completion of the previous -+ * update. Which is important since compositors need to figure out the -+ * composition of the next frame right after having submitted the -+ * current layout. -+ */ ++static const struct of_device_id snd_rpi_rpi_dac_of_match[] = { ++ { .compatible = "rpi,rpi-dac", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, snd_rpi_rpi_dac_of_match); + -+ if (async) { -+ vc4_queue_seqno_cb(dev, &c->cb, wait_seqno, -+ vc4_atomic_complete_commit_seqno_cb); -+ } else { -+ vc4_wait_for_seqno(dev, wait_seqno, ~0ull, false); -+ vc4_atomic_complete_commit(c); -+ } ++static struct platform_driver snd_rpi_rpi_dac_driver = { ++ .driver = { ++ .name = "snd-rpi-dac", ++ .owner = THIS_MODULE, ++ .of_match_table = snd_rpi_rpi_dac_of_match, ++ }, ++ .probe = snd_rpi_rpi_dac_probe, ++ .remove = snd_rpi_rpi_dac_remove, ++}; + -+ return 0; -+} ++module_platform_driver(snd_rpi_rpi_dac_driver); + - static const struct drm_mode_config_funcs vc4_mode_funcs = { - .output_poll_changed = vc4_output_poll_changed, - .atomic_check = drm_atomic_helper_check, -- .atomic_commit = drm_atomic_helper_commit, -+ .atomic_commit = vc4_atomic_commit, - .fb_create = drm_fb_cma_create, - }; - -@@ -41,6 +183,8 @@ int vc4_kms_load(struct drm_device *dev) - struct vc4_dev *vc4 = to_vc4_dev(dev); - int ret; ++MODULE_AUTHOR("Florian Meier <florian.meier@koalo.de>"); ++MODULE_DESCRIPTION("ASoC Driver for RPi-DAC"); ++MODULE_LICENSE("GPL v2"); +diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig +index 4308f90..513ab55 100644 +--- a/sound/soc/codecs/Kconfig ++++ b/sound/soc/codecs/Kconfig +@@ -101,6 +101,7 @@ config SND_SOC_ALL_CODECS + select SND_SOC_RT5514 if I2C + select SND_SOC_RT5616 if I2C + select SND_SOC_PCM5102A if I2C ++ select SND_SOC_PCM1794A if I2C + select SND_SOC_RT5631 if I2C + select SND_SOC_RT5640 if I2C + select SND_SOC_RT5645 if I2C +@@ -632,6 +633,14 @@ config SND_SOC_RT5616 + tristate "Realtek RT5616 CODEC" + depends on I2C -+ sema_init(&vc4->async_modeset, 1); ++config SND_SOC_RT298 ++ tristate ++ depends on I2C + - ret = drm_vblank_init(dev, dev->mode_config.num_crtc); - if (ret < 0) { - dev_err(dev->dev, "failed to initialize vblank\n"); -@@ -51,6 +195,8 @@ int vc4_kms_load(struct drm_device *dev) - dev->mode_config.max_height = 2048; - dev->mode_config.funcs = &vc4_mode_funcs; - dev->mode_config.preferred_depth = 24; -+ dev->mode_config.async_page_flip = true; ++config SND_SOC_PCM1794A ++ tristate ++ depends on I2C + - dev->vblank_disable_allowed = true; - - drm_mode_config_reset(dev); -diff --git a/drivers/gpu/drm/vc4/vc4_packet.h b/drivers/gpu/drm/vc4/vc4_packet.h + config SND_SOC_PCM5102A + tristate + depends on I2C +diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile +index 7522017..b87e845 100644 +--- a/sound/soc/codecs/Makefile ++++ b/sound/soc/codecs/Makefile +@@ -98,6 +98,7 @@ snd-soc-rt286-objs := rt286.o + snd-soc-rt298-objs := rt298.o + snd-soc-rt5514-objs := rt5514.o + snd-soc-rt5616-objs := rt5616.o ++snd-soc-pcm1794a-objs := pcm1794a.o + snd-soc-pcm5102a-objs := pcm5102a.o + snd-soc-rt5631-objs := rt5631.o + snd-soc-rt5640-objs := rt5640.o +@@ -308,6 +309,7 @@ obj-$(CONFIG_SND_SOC_RT286) += snd-soc-rt286.o + obj-$(CONFIG_SND_SOC_RT298) += snd-soc-rt298.o + obj-$(CONFIG_SND_SOC_RT5514) += snd-soc-rt5514.o + obj-$(CONFIG_SND_SOC_RT5616) += snd-soc-rt5616.o ++obj-$(CONFIG_SND_SOC_PCM1794A) += snd-soc-pcm1794a.o + obj-$(CONFIG_SND_SOC_PCM5102A) += snd-soc-pcm5102a.o + obj-$(CONFIG_SND_SOC_RT5631) += snd-soc-rt5631.o + obj-$(CONFIG_SND_SOC_RT5640) += snd-soc-rt5640.o +diff --git a/sound/soc/codecs/pcm1794a.c b/sound/soc/codecs/pcm1794a.c new file mode 100644 -index 0000000..9757bc8 +index 0000000..afe1b41 --- /dev/null -+++ b/drivers/gpu/drm/vc4/vc4_packet.h -@@ -0,0 +1,384 @@ ++++ b/sound/soc/codecs/pcm1794a.c +@@ -0,0 +1,69 @@ +/* -+ * Copyright © 2014 Broadcom -+ * -+ * Permission is hereby granted, free of charge, to any person obtaining a -+ * copy of this software and associated documentation files (the "Software"), -+ * to deal in the Software without restriction, including without limitation -+ * the rights to use, copy, modify, merge, publish, distribute, sublicense, -+ * and/or sell copies of the Software, and to permit persons to whom the -+ * Software is furnished to do so, subject to the following conditions: -+ * -+ * The above copyright notice and this permission notice (including the next -+ * paragraph) shall be included in all copies or substantial portions of the -+ * Software. -+ * -+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -+ * IN THE SOFTWARE. -+ */ -+ -+#ifndef VC4_PACKET_H -+#define VC4_PACKET_H -+ -+#include "vc4_regs.h" /* for VC4_MASK, VC4_GET_FIELD, VC4_SET_FIELD */ -+ -+enum vc4_packet { -+ VC4_PACKET_HALT = 0, -+ VC4_PACKET_NOP = 1, -+ -+ VC4_PACKET_FLUSH = 4, -+ VC4_PACKET_FLUSH_ALL = 5, -+ VC4_PACKET_START_TILE_BINNING = 6, -+ VC4_PACKET_INCREMENT_SEMAPHORE = 7, -+ VC4_PACKET_WAIT_ON_SEMAPHORE = 8, -+ -+ VC4_PACKET_BRANCH = 16, -+ VC4_PACKET_BRANCH_TO_SUB_LIST = 17, -+ -+ VC4_PACKET_STORE_MS_TILE_BUFFER = 24, -+ VC4_PACKET_STORE_MS_TILE_BUFFER_AND_EOF = 25, -+ VC4_PACKET_STORE_FULL_RES_TILE_BUFFER = 26, -+ VC4_PACKET_LOAD_FULL_RES_TILE_BUFFER = 27, -+ VC4_PACKET_STORE_TILE_BUFFER_GENERAL = 28, -+ VC4_PACKET_LOAD_TILE_BUFFER_GENERAL = 29, -+ -+ VC4_PACKET_GL_INDEXED_PRIMITIVE = 32, -+ VC4_PACKET_GL_ARRAY_PRIMITIVE = 33, -+ -+ VC4_PACKET_COMPRESSED_PRIMITIVE = 48, -+ VC4_PACKET_CLIPPED_COMPRESSED_PRIMITIVE = 49, -+ -+ VC4_PACKET_PRIMITIVE_LIST_FORMAT = 56, -+ -+ VC4_PACKET_GL_SHADER_STATE = 64, -+ VC4_PACKET_NV_SHADER_STATE = 65, -+ VC4_PACKET_VG_SHADER_STATE = 66, -+ -+ VC4_PACKET_CONFIGURATION_BITS = 96, -+ VC4_PACKET_FLAT_SHADE_FLAGS = 97, -+ VC4_PACKET_POINT_SIZE = 98, -+ VC4_PACKET_LINE_WIDTH = 99, -+ VC4_PACKET_RHT_X_BOUNDARY = 100, -+ VC4_PACKET_DEPTH_OFFSET = 101, -+ VC4_PACKET_CLIP_WINDOW = 102, -+ VC4_PACKET_VIEWPORT_OFFSET = 103, -+ VC4_PACKET_Z_CLIPPING = 104, -+ VC4_PACKET_CLIPPER_XY_SCALING = 105, -+ VC4_PACKET_CLIPPER_Z_SCALING = 106, -+ -+ VC4_PACKET_TILE_BINNING_MODE_CONFIG = 112, -+ VC4_PACKET_TILE_RENDERING_MODE_CONFIG = 113, -+ VC4_PACKET_CLEAR_COLORS = 114, -+ VC4_PACKET_TILE_COORDINATES = 115, -+ -+ /* Not an actual hardware packet -- this is what we use to put -+ * references to GEM bos in the command stream, since we need the u32 -+ * int the actual address packet in order to store the offset from the -+ * start of the BO. -+ */ -+ VC4_PACKET_GEM_HANDLES = 254, -+} __attribute__ ((__packed__)); -+ -+#define VC4_PACKET_HALT_SIZE 1 -+#define VC4_PACKET_NOP_SIZE 1 -+#define VC4_PACKET_FLUSH_SIZE 1 -+#define VC4_PACKET_FLUSH_ALL_SIZE 1 -+#define VC4_PACKET_START_TILE_BINNING_SIZE 1 -+#define VC4_PACKET_INCREMENT_SEMAPHORE_SIZE 1 -+#define VC4_PACKET_WAIT_ON_SEMAPHORE_SIZE 1 -+#define VC4_PACKET_BRANCH_SIZE 5 -+#define VC4_PACKET_BRANCH_TO_SUB_LIST_SIZE 5 -+#define VC4_PACKET_STORE_MS_TILE_BUFFER_SIZE 1 -+#define VC4_PACKET_STORE_MS_TILE_BUFFER_AND_EOF_SIZE 1 -+#define VC4_PACKET_STORE_FULL_RES_TILE_BUFFER_SIZE 5 -+#define VC4_PACKET_LOAD_FULL_RES_TILE_BUFFER_SIZE 5 -+#define VC4_PACKET_STORE_TILE_BUFFER_GENERAL_SIZE 7 -+#define VC4_PACKET_LOAD_TILE_BUFFER_GENERAL_SIZE 7 -+#define VC4_PACKET_GL_INDEXED_PRIMITIVE_SIZE 14 -+#define VC4_PACKET_GL_ARRAY_PRIMITIVE_SIZE 10 -+#define VC4_PACKET_COMPRESSED_PRIMITIVE_SIZE 1 -+#define VC4_PACKET_CLIPPED_COMPRESSED_PRIMITIVE_SIZE 1 -+#define VC4_PACKET_PRIMITIVE_LIST_FORMAT_SIZE 2 -+#define VC4_PACKET_GL_SHADER_STATE_SIZE 5 -+#define VC4_PACKET_NV_SHADER_STATE_SIZE 5 -+#define VC4_PACKET_VG_SHADER_STATE_SIZE 5 -+#define VC4_PACKET_CONFIGURATION_BITS_SIZE 4 -+#define VC4_PACKET_FLAT_SHADE_FLAGS_SIZE 5 -+#define VC4_PACKET_POINT_SIZE_SIZE 5 -+#define VC4_PACKET_LINE_WIDTH_SIZE 5 -+#define VC4_PACKET_RHT_X_BOUNDARY_SIZE 3 -+#define VC4_PACKET_DEPTH_OFFSET_SIZE 5 -+#define VC4_PACKET_CLIP_WINDOW_SIZE 9 -+#define VC4_PACKET_VIEWPORT_OFFSET_SIZE 5 -+#define VC4_PACKET_Z_CLIPPING_SIZE 9 -+#define VC4_PACKET_CLIPPER_XY_SCALING_SIZE 9 -+#define VC4_PACKET_CLIPPER_Z_SCALING_SIZE 9 -+#define VC4_PACKET_TILE_BINNING_MODE_CONFIG_SIZE 16 -+#define VC4_PACKET_TILE_RENDERING_MODE_CONFIG_SIZE 11 -+#define VC4_PACKET_CLEAR_COLORS_SIZE 14 -+#define VC4_PACKET_TILE_COORDINATES_SIZE 3 -+#define VC4_PACKET_GEM_HANDLES_SIZE 9 -+ -+/** @{ -+ * Bits used by packets like VC4_PACKET_STORE_TILE_BUFFER_GENERAL and -+ * VC4_PACKET_TILE_RENDERING_MODE_CONFIG. -+*/ -+#define VC4_TILING_FORMAT_LINEAR 0 -+#define VC4_TILING_FORMAT_T 1 -+#define VC4_TILING_FORMAT_LT 2 -+/** @} */ -+ -+/** @{ ++ * Driver for the PCM1794A codec + * -+ * low bits of VC4_PACKET_STORE_FULL_RES_TILE_BUFFER and -+ * VC4_PACKET_LOAD_FULL_RES_TILE_BUFFER. -+ */ -+#define VC4_LOADSTORE_FULL_RES_EOF (1 << 3) -+#define VC4_LOADSTORE_FULL_RES_DISABLE_CLEAR_ALL (1 << 2) -+#define VC4_LOADSTORE_FULL_RES_DISABLE_ZS (1 << 1) -+#define VC4_LOADSTORE_FULL_RES_DISABLE_COLOR (1 << 0) -+ -+/** @{ ++ * Author: Florian Meier <florian.meier@koalo.de> ++ * Copyright 2013 + * -+ * byte 2 of VC4_PACKET_STORE_TILE_BUFFER_GENERAL and -+ * VC4_PACKET_LOAD_TILE_BUFFER_GENERAL (low bits of the address) -+ */ -+ -+#define VC4_LOADSTORE_TILE_BUFFER_EOF (1 << 3) -+#define VC4_LOADSTORE_TILE_BUFFER_DISABLE_FULL_VG_MASK (1 << 2) -+#define VC4_LOADSTORE_TILE_BUFFER_DISABLE_FULL_ZS (1 << 1) -+#define VC4_LOADSTORE_TILE_BUFFER_DISABLE_FULL_COLOR (1 << 0) -+ -+/** @} */ -+ -+/** @{ ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * version 2 as published by the Free Software Foundation. + * -+ * byte 0-1 of VC4_PACKET_STORE_TILE_BUFFER_GENERAL and -+ * VC4_PACKET_LOAD_TILE_BUFFER_GENERAL ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * General Public License for more details. + */ -+#define VC4_STORE_TILE_BUFFER_DISABLE_VG_MASK_CLEAR (1 << 15) -+#define VC4_STORE_TILE_BUFFER_DISABLE_ZS_CLEAR (1 << 14) -+#define VC4_STORE_TILE_BUFFER_DISABLE_COLOR_CLEAR (1 << 13) -+#define VC4_STORE_TILE_BUFFER_DISABLE_SWAP (1 << 12) -+ -+#define VC4_LOADSTORE_TILE_BUFFER_FORMAT_MASK VC4_MASK(9, 8) -+#define VC4_LOADSTORE_TILE_BUFFER_FORMAT_SHIFT 8 -+#define VC4_LOADSTORE_TILE_BUFFER_RGBA8888 0 -+#define VC4_LOADSTORE_TILE_BUFFER_BGR565_DITHER 1 -+#define VC4_LOADSTORE_TILE_BUFFER_BGR565 2 -+/** @} */ + -+/** @{ -+ * -+ * byte 0 of VC4_PACKET_STORE_TILE_BUFFER_GENERAL and -+ * VC4_PACKET_LOAD_TILE_BUFFER_GENERAL -+ */ -+#define VC4_STORE_TILE_BUFFER_MODE_MASK VC4_MASK(7, 6) -+#define VC4_STORE_TILE_BUFFER_MODE_SHIFT 6 -+#define VC4_STORE_TILE_BUFFER_MODE_SAMPLE0 (0 << 6) -+#define VC4_STORE_TILE_BUFFER_MODE_DECIMATE_X4 (1 << 6) -+#define VC4_STORE_TILE_BUFFER_MODE_DECIMATE_X16 (2 << 6) -+ -+/** The values of the field are VC4_TILING_FORMAT_* */ -+#define VC4_LOADSTORE_TILE_BUFFER_TILING_MASK VC4_MASK(5, 4) -+#define VC4_LOADSTORE_TILE_BUFFER_TILING_SHIFT 4 -+ -+#define VC4_LOADSTORE_TILE_BUFFER_BUFFER_MASK VC4_MASK(2, 0) -+#define VC4_LOADSTORE_TILE_BUFFER_BUFFER_SHIFT 0 -+#define VC4_LOADSTORE_TILE_BUFFER_NONE 0 -+#define VC4_LOADSTORE_TILE_BUFFER_COLOR 1 -+#define VC4_LOADSTORE_TILE_BUFFER_ZS 2 -+#define VC4_LOADSTORE_TILE_BUFFER_Z 3 -+#define VC4_LOADSTORE_TILE_BUFFER_VG_MASK 4 -+#define VC4_LOADSTORE_TILE_BUFFER_FULL 5 -+/** @} */ + -+#define VC4_INDEX_BUFFER_U8 (0 << 4) -+#define VC4_INDEX_BUFFER_U16 (1 << 4) ++#include <linux/init.h> ++#include <linux/module.h> ++#include <linux/platform_device.h> + -+/* This flag is only present in NV shader state. */ -+#define VC4_SHADER_FLAG_SHADED_CLIP_COORDS (1 << 3) -+#define VC4_SHADER_FLAG_ENABLE_CLIPPING (1 << 2) -+#define VC4_SHADER_FLAG_VS_POINT_SIZE (1 << 1) -+#define VC4_SHADER_FLAG_FS_SINGLE_THREAD (1 << 0) ++#include <sound/soc.h> + -+/** @{ byte 2 of config bits. */ -+#define VC4_CONFIG_BITS_EARLY_Z_UPDATE (1 << 1) -+#define VC4_CONFIG_BITS_EARLY_Z (1 << 0) -+/** @} */ ++static struct snd_soc_dai_driver pcm1794a_dai = { ++ .name = "pcm1794a-hifi", ++ .playback = { ++ .channels_min = 2, ++ .channels_max = 2, ++ .rates = SNDRV_PCM_RATE_8000_192000, ++ .formats = SNDRV_PCM_FMTBIT_S16_LE | ++ SNDRV_PCM_FMTBIT_S24_LE ++ }, ++}; + -+/** @{ byte 1 of config bits. */ -+#define VC4_CONFIG_BITS_Z_UPDATE (1 << 7) -+/** same values in this 3-bit field as PIPE_FUNC_* */ -+#define VC4_CONFIG_BITS_DEPTH_FUNC_SHIFT 4 -+#define VC4_CONFIG_BITS_COVERAGE_READ_LEAVE (1 << 3) ++static struct snd_soc_codec_driver soc_codec_dev_pcm1794a; + -+#define VC4_CONFIG_BITS_COVERAGE_UPDATE_NONZERO (0 << 1) -+#define VC4_CONFIG_BITS_COVERAGE_UPDATE_ODD (1 << 1) -+#define VC4_CONFIG_BITS_COVERAGE_UPDATE_OR (2 << 1) -+#define VC4_CONFIG_BITS_COVERAGE_UPDATE_ZERO (3 << 1) ++static int pcm1794a_probe(struct platform_device *pdev) ++{ ++ return snd_soc_register_codec(&pdev->dev, &soc_codec_dev_pcm1794a, ++ &pcm1794a_dai, 1); ++} + -+#define VC4_CONFIG_BITS_COVERAGE_PIPE_SELECT (1 << 0) -+/** @} */ ++static int pcm1794a_remove(struct platform_device *pdev) ++{ ++ snd_soc_unregister_codec(&pdev->dev); ++ return 0; ++} + -+/** @{ byte 0 of config bits. */ -+#define VC4_CONFIG_BITS_RASTERIZER_OVERSAMPLE_NONE (0 << 6) -+#define VC4_CONFIG_BITS_RASTERIZER_OVERSAMPLE_4X (1 << 6) -+#define VC4_CONFIG_BITS_RASTERIZER_OVERSAMPLE_16X (2 << 6) ++static const struct of_device_id pcm1794a_of_match[] = { ++ { .compatible = "ti,pcm1794a", }, ++ { } ++}; ++MODULE_DEVICE_TABLE(of, pcm1794a_of_match); + -+#define VC4_CONFIG_BITS_AA_POINTS_AND_LINES (1 << 4) -+#define VC4_CONFIG_BITS_ENABLE_DEPTH_OFFSET (1 << 3) -+#define VC4_CONFIG_BITS_CW_PRIMITIVES (1 << 2) -+#define VC4_CONFIG_BITS_ENABLE_PRIM_BACK (1 << 1) -+#define VC4_CONFIG_BITS_ENABLE_PRIM_FRONT (1 << 0) -+/** @} */ ++static struct platform_driver pcm1794a_codec_driver = { ++ .probe = pcm1794a_probe, ++ .remove = pcm1794a_remove, ++ .driver = { ++ .name = "pcm1794a-codec", ++ .owner = THIS_MODULE, ++ .of_match_table = of_match_ptr(pcm1794a_of_match), ++ }, ++}; + -+/** @{ bits in the last u8 of VC4_PACKET_TILE_BINNING_MODE_CONFIG */ -+#define VC4_BIN_CONFIG_DB_NON_MS (1 << 7) -+ -+#define VC4_BIN_CONFIG_ALLOC_BLOCK_SIZE_MASK VC4_MASK(6, 5) -+#define VC4_BIN_CONFIG_ALLOC_BLOCK_SIZE_SHIFT 5 -+#define VC4_BIN_CONFIG_ALLOC_BLOCK_SIZE_32 0 -+#define VC4_BIN_CONFIG_ALLOC_BLOCK_SIZE_64 1 -+#define VC4_BIN_CONFIG_ALLOC_BLOCK_SIZE_128 2 -+#define VC4_BIN_CONFIG_ALLOC_BLOCK_SIZE_256 3 -+ -+#define VC4_BIN_CONFIG_ALLOC_INIT_BLOCK_SIZE_MASK VC4_MASK(4, 3) -+#define VC4_BIN_CONFIG_ALLOC_INIT_BLOCK_SIZE_SHIFT 3 -+#define VC4_BIN_CONFIG_ALLOC_INIT_BLOCK_SIZE_32 0 -+#define VC4_BIN_CONFIG_ALLOC_INIT_BLOCK_SIZE_64 1 -+#define VC4_BIN_CONFIG_ALLOC_INIT_BLOCK_SIZE_128 2 -+#define VC4_BIN_CONFIG_ALLOC_INIT_BLOCK_SIZE_256 3 -+ -+#define VC4_BIN_CONFIG_AUTO_INIT_TSDA (1 << 2) -+#define VC4_BIN_CONFIG_TILE_BUFFER_64BIT (1 << 1) -+#define VC4_BIN_CONFIG_MS_MODE_4X (1 << 0) -+/** @} */ ++module_platform_driver(pcm1794a_codec_driver); + -+/** @{ bits in the last u16 of VC4_PACKET_TILE_RENDERING_MODE_CONFIG */ -+#define VC4_RENDER_CONFIG_DB_NON_MS (1 << 12) -+#define VC4_RENDER_CONFIG_EARLY_Z_COVERAGE_DISABLE (1 << 11) -+#define VC4_RENDER_CONFIG_EARLY_Z_DIRECTION_G (1 << 10) -+#define VC4_RENDER_CONFIG_COVERAGE_MODE (1 << 9) -+#define VC4_RENDER_CONFIG_ENABLE_VG_MASK (1 << 8) -+ -+/** The values of the field are VC4_TILING_FORMAT_* */ -+#define VC4_RENDER_CONFIG_MEMORY_FORMAT_MASK VC4_MASK(7, 6) -+#define VC4_RENDER_CONFIG_MEMORY_FORMAT_SHIFT 6 -+ -+#define VC4_RENDER_CONFIG_DECIMATE_MODE_1X (0 << 4) -+#define VC4_RENDER_CONFIG_DECIMATE_MODE_4X (1 << 4) -+#define VC4_RENDER_CONFIG_DECIMATE_MODE_16X (2 << 4) -+ -+#define VC4_RENDER_CONFIG_FORMAT_MASK VC4_MASK(3, 2) -+#define VC4_RENDER_CONFIG_FORMAT_SHIFT 2 -+#define VC4_RENDER_CONFIG_FORMAT_BGR565_DITHERED 0 -+#define VC4_RENDER_CONFIG_FORMAT_RGBA8888 1 -+#define VC4_RENDER_CONFIG_FORMAT_BGR565 2 -+ -+#define VC4_RENDER_CONFIG_TILE_BUFFER_64BIT (1 << 1) -+#define VC4_RENDER_CONFIG_MS_MODE_4X (1 << 0) -+ -+#define VC4_PRIMITIVE_LIST_FORMAT_16_INDEX (1 << 4) -+#define VC4_PRIMITIVE_LIST_FORMAT_32_XY (3 << 4) -+#define VC4_PRIMITIVE_LIST_FORMAT_TYPE_POINTS (0 << 0) -+#define VC4_PRIMITIVE_LIST_FORMAT_TYPE_LINES (1 << 0) -+#define VC4_PRIMITIVE_LIST_FORMAT_TYPE_TRIANGLES (2 << 0) -+#define VC4_PRIMITIVE_LIST_FORMAT_TYPE_RHT (3 << 0) -+ -+enum vc4_texture_data_type { -+ VC4_TEXTURE_TYPE_RGBA8888 = 0, -+ VC4_TEXTURE_TYPE_RGBX8888 = 1, -+ VC4_TEXTURE_TYPE_RGBA4444 = 2, -+ VC4_TEXTURE_TYPE_RGBA5551 = 3, -+ VC4_TEXTURE_TYPE_RGB565 = 4, -+ VC4_TEXTURE_TYPE_LUMINANCE = 5, -+ VC4_TEXTURE_TYPE_ALPHA = 6, -+ VC4_TEXTURE_TYPE_LUMALPHA = 7, -+ VC4_TEXTURE_TYPE_ETC1 = 8, -+ VC4_TEXTURE_TYPE_S16F = 9, -+ VC4_TEXTURE_TYPE_S8 = 10, -+ VC4_TEXTURE_TYPE_S16 = 11, -+ VC4_TEXTURE_TYPE_BW1 = 12, -+ VC4_TEXTURE_TYPE_A4 = 13, -+ VC4_TEXTURE_TYPE_A1 = 14, -+ VC4_TEXTURE_TYPE_RGBA64 = 15, -+ VC4_TEXTURE_TYPE_RGBA32R = 16, -+ VC4_TEXTURE_TYPE_YUV422R = 17, -+}; -+ -+#define VC4_TEX_P0_OFFSET_MASK VC4_MASK(31, 12) -+#define VC4_TEX_P0_OFFSET_SHIFT 12 -+#define VC4_TEX_P0_CSWIZ_MASK VC4_MASK(11, 10) -+#define VC4_TEX_P0_CSWIZ_SHIFT 10 -+#define VC4_TEX_P0_CMMODE_MASK VC4_MASK(9, 9) -+#define VC4_TEX_P0_CMMODE_SHIFT 9 -+#define VC4_TEX_P0_FLIPY_MASK VC4_MASK(8, 8) -+#define VC4_TEX_P0_FLIPY_SHIFT 8 -+#define VC4_TEX_P0_TYPE_MASK VC4_MASK(7, 4) -+#define VC4_TEX_P0_TYPE_SHIFT 4 -+#define VC4_TEX_P0_MIPLVLS_MASK VC4_MASK(3, 0) -+#define VC4_TEX_P0_MIPLVLS_SHIFT 0 -+ -+#define VC4_TEX_P1_TYPE4_MASK VC4_MASK(31, 31) -+#define VC4_TEX_P1_TYPE4_SHIFT 31 -+#define VC4_TEX_P1_HEIGHT_MASK VC4_MASK(30, 20) -+#define VC4_TEX_P1_HEIGHT_SHIFT 20 -+#define VC4_TEX_P1_ETCFLIP_MASK VC4_MASK(19, 19) -+#define VC4_TEX_P1_ETCFLIP_SHIFT 19 -+#define VC4_TEX_P1_WIDTH_MASK VC4_MASK(18, 8) -+#define VC4_TEX_P1_WIDTH_SHIFT 8 -+ -+#define VC4_TEX_P1_MAGFILT_MASK VC4_MASK(7, 7) -+#define VC4_TEX_P1_MAGFILT_SHIFT 7 -+# define VC4_TEX_P1_MAGFILT_LINEAR 0 -+# define VC4_TEX_P1_MAGFILT_NEAREST 1 -+ -+#define VC4_TEX_P1_MINFILT_MASK VC4_MASK(6, 4) -+#define VC4_TEX_P1_MINFILT_SHIFT 4 -+# define VC4_TEX_P1_MINFILT_LINEAR 0 -+# define VC4_TEX_P1_MINFILT_NEAREST 1 -+# define VC4_TEX_P1_MINFILT_NEAR_MIP_NEAR 2 -+# define VC4_TEX_P1_MINFILT_NEAR_MIP_LIN 3 -+# define VC4_TEX_P1_MINFILT_LIN_MIP_NEAR 4 -+# define VC4_TEX_P1_MINFILT_LIN_MIP_LIN 5 -+ -+#define VC4_TEX_P1_WRAP_T_MASK VC4_MASK(3, 2) -+#define VC4_TEX_P1_WRAP_T_SHIFT 2 -+#define VC4_TEX_P1_WRAP_S_MASK VC4_MASK(1, 0) -+#define VC4_TEX_P1_WRAP_S_SHIFT 0 -+# define VC4_TEX_P1_WRAP_REPEAT 0 -+# define VC4_TEX_P1_WRAP_CLAMP 1 -+# define VC4_TEX_P1_WRAP_MIRROR 2 -+# define VC4_TEX_P1_WRAP_BORDER 3 -+ -+#define VC4_TEX_P2_PTYPE_MASK VC4_MASK(31, 30) -+#define VC4_TEX_P2_PTYPE_SHIFT 30 -+# define VC4_TEX_P2_PTYPE_IGNORED 0 -+# define VC4_TEX_P2_PTYPE_CUBE_MAP_STRIDE 1 -+# define VC4_TEX_P2_PTYPE_CHILD_IMAGE_DIMENSIONS 2 -+# define VC4_TEX_P2_PTYPE_CHILD_IMAGE_OFFSETS 3 -+ -+/* VC4_TEX_P2_PTYPE_CUBE_MAP_STRIDE bits */ -+#define VC4_TEX_P2_CMST_MASK VC4_MASK(29, 12) -+#define VC4_TEX_P2_CMST_SHIFT 12 -+#define VC4_TEX_P2_BSLOD_MASK VC4_MASK(0, 0) -+#define VC4_TEX_P2_BSLOD_SHIFT 0 -+ -+/* VC4_TEX_P2_PTYPE_CHILD_IMAGE_DIMENSIONS */ -+#define VC4_TEX_P2_CHEIGHT_MASK VC4_MASK(22, 12) -+#define VC4_TEX_P2_CHEIGHT_SHIFT 12 -+#define VC4_TEX_P2_CWIDTH_MASK VC4_MASK(10, 0) -+#define VC4_TEX_P2_CWIDTH_SHIFT 0 -+ -+/* VC4_TEX_P2_PTYPE_CHILD_IMAGE_OFFSETS */ -+#define VC4_TEX_P2_CYOFF_MASK VC4_MASK(22, 12) -+#define VC4_TEX_P2_CYOFF_SHIFT 12 -+#define VC4_TEX_P2_CXOFF_MASK VC4_MASK(10, 0) -+#define VC4_TEX_P2_CXOFF_SHIFT 0 -+ -+#endif /* VC4_PACKET_H */ -diff --git a/drivers/gpu/drm/vc4/vc4_plane.c b/drivers/gpu/drm/vc4/vc4_plane.c -index 887f3ca..65e5455 100644 ---- a/drivers/gpu/drm/vc4/vc4_plane.c -+++ b/drivers/gpu/drm/vc4/vc4_plane.c -@@ -29,6 +29,14 @@ struct vc4_plane_state { - u32 *dlist; - u32 dlist_size; /* Number of dwords in allocated for the display list */ - u32 dlist_count; /* Number of used dwords in the display list. */ -+ -+ /* Offset in the dlist to pointer word 0. */ -+ u32 pw0_offset; -+ -+ /* Offset where the plane's dlist was last stored in the -+ hardware at vc4_crtc_atomic_flush() time. -+ */ -+ u32 *hw_dlist; ++MODULE_DESCRIPTION("ASoC PCM1794A codec driver"); ++MODULE_AUTHOR("Florian Meier <florian.meier@koalo.de>"); ++MODULE_LICENSE("GPL v2"); + +From a8113bd47e56c48df869517ceff8a9e05d61e036 Mon Sep 17 00:00:00 2001 +From: Daniel Matuschek <info@crazy-audio.com> +Date: Wed, 15 Jan 2014 21:41:23 +0100 +Subject: [PATCH 068/112] ASoC: wm8804: Implement MCLK configuration options, + add 32bit support WM8804 can run with PLL frequencies of 256xfs and 128xfs + for most sample rates. At 192kHz only 128xfs is supported. The existing + driver selects 128xfs automatically for some lower samples rates. By using an + additional mclk_div divider, it is now possible to control the behaviour. + This allows using 256xfs PLL frequency on all sample rates up to 96kHz. It + should allow lower jitter and better signal quality. The behavior has to be + controlled by the sound card driver, because some sample frequency share the + same setting. e.g. 192kHz and 96kHz use 24.576MHz master clock. The only + difference is the MCLK divider. + +This also added support for 32bit data. + +Signed-off-by: Daniel Matuschek <daniel@matuschek.net> +--- + sound/soc/codecs/wm8804.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/sound/soc/codecs/wm8804.c b/sound/soc/codecs/wm8804.c +index 8d91470..c846716 100644 +--- a/sound/soc/codecs/wm8804.c ++++ b/sound/soc/codecs/wm8804.c +@@ -304,6 +304,7 @@ static int wm8804_hw_params(struct snd_pcm_substream *substream, + blen = 0x1; + break; + case 24: ++ case 32: + blen = 0x2; + break; + default: +@@ -515,7 +516,7 @@ static const struct snd_soc_dai_ops wm8804_dai_ops = { }; - static inline struct vc4_plane_state * -@@ -207,6 +215,8 @@ static int vc4_plane_mode_set(struct drm_plane *plane, - /* Position Word 3: Context. Written by the HVS. */ - vc4_dlist_write(vc4_state, 0xc0c0c0c0); + #define WM8804_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE | \ +- SNDRV_PCM_FMTBIT_S24_LE) ++ SNDRV_PCM_FMTBIT_S24_3LE | SNDRV_PCM_FMTBIT_S32_LE) -+ vc4_state->pw0_offset = vc4_state->dlist_count; -+ - /* Pointer Word 0: RGB / Y Pointer */ - vc4_dlist_write(vc4_state, bo->paddr + offset); + #define WM8804_RATES (SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 | \ + SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_64000 | \ +@@ -543,7 +544,7 @@ static struct snd_soc_dai_driver wm8804_dai = { + }; -@@ -258,6 +268,8 @@ u32 vc4_plane_write_dlist(struct drm_plane *plane, u32 __iomem *dlist) - struct vc4_plane_state *vc4_state = to_vc4_plane_state(plane->state); - int i; + static const struct snd_soc_codec_driver soc_codec_dev_wm8804 = { +- .idle_bias_off = true, ++ .idle_bias_off = false, -+ vc4_state->hw_dlist = dlist; -+ - /* Can't memcpy_toio() because it needs to be 32-bit writes. */ - for (i = 0; i < vc4_state->dlist_count; i++) - writel(vc4_state->dlist[i], &dlist[i]); -@@ -272,6 +284,34 @@ u32 vc4_plane_dlist_size(struct drm_plane_state *state) - return vc4_state->dlist_count; - } + .dapm_widgets = wm8804_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(wm8804_dapm_widgets), + +From e4119855ee7612fe8032d43fb0cd14e87109d613 Mon Sep 17 00:00:00 2001 +From: Daniel Matuschek <info@crazy-audio.com> +Date: Wed, 15 Jan 2014 21:42:08 +0100 +Subject: [PATCH 069/112] ASoC: BCM:Add support for HiFiBerry Digi. Driver is + based on the patched WM8804 driver. + +Signed-off-by: Daniel Matuschek <daniel@matuschek.net> + +Add a parameter to turn off SPDIF output if no audio is playing + +This patch adds the paramater auto_shutdown_output to the kernel module. +Default behaviour of the module is the same, but when auto_shutdown_output +is set to 1, the SPDIF oputput will shutdown if no stream is playing. + +bugfix for 32kHz sample rate, was missing + +HiFiBerry Digi: set SPDIF status bits for sample rate + +The HiFiBerry Digi driver did not signal the sample rate in the SPDIF status bits. +While this is optional, some DACs and receivers do not accept this signal. This patch +adds the sample rate bits in the SPDIF status block. +--- + sound/soc/bcm/Kconfig | 7 ++ + sound/soc/bcm/Makefile | 2 + + sound/soc/bcm/hifiberry_digi.c | 224 +++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 233 insertions(+) + create mode 100644 sound/soc/bcm/hifiberry_digi.c + +diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig +index 900de22..a34aff2 100644 +--- a/sound/soc/bcm/Kconfig ++++ b/sound/soc/bcm/Kconfig +@@ -15,6 +15,13 @@ config SND_BCM2708_SOC_HIFIBERRY_DAC + help + Say Y or M if you want to add support for HifiBerry DAC. -+/* Updates the plane to immediately (well, once the FIFO needs -+ * refilling) scan out from at a new framebuffer. -+ */ -+void vc4_plane_async_set_fb(struct drm_plane *plane, struct drm_framebuffer *fb) -+{ -+ struct vc4_plane_state *vc4_state = to_vc4_plane_state(plane->state); -+ struct drm_gem_cma_object *bo = drm_fb_cma_get_gem_obj(fb, 0); -+ uint32_t addr; -+ -+ /* We're skipping the address adjustment for negative origin, -+ * because this is only called on the primary plane. -+ */ -+ WARN_ON_ONCE(plane->state->crtc_x < 0 || plane->state->crtc_y < 0); -+ addr = bo->paddr + fb->offsets[0]; -+ -+ /* Write the new address into the hardware immediately. The -+ * scanout will start from this address as soon as the FIFO -+ * needs to refill with pixels. -+ */ -+ writel(addr, &vc4_state->hw_dlist[vc4_state->pw0_offset]); -+ -+ /* Also update the CPU-side dlist copy, so that any later -+ * atomic updates that don't do a new modeset on our plane -+ * also use our updated address. -+ */ -+ vc4_state->dlist[vc4_state->pw0_offset] = addr; -+} ++config SND_BCM2708_SOC_HIFIBERRY_DIGI ++ tristate "Support for HifiBerry Digi" ++ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S ++ select SND_SOC_WM8804 ++ help ++ Say Y or M if you want to add support for HifiBerry Digi S/PDIF output board. + - static const struct drm_plane_helper_funcs vc4_plane_helper_funcs = { - .prepare_fb = NULL, - .cleanup_fb = NULL, -diff --git a/drivers/gpu/drm/vc4/vc4_qpu_defines.h b/drivers/gpu/drm/vc4/vc4_qpu_defines.h -new file mode 100644 -index 0000000..e47c994 ---- /dev/null -+++ b/drivers/gpu/drm/vc4/vc4_qpu_defines.h -@@ -0,0 +1,268 @@ -+/* -+ * Copyright © 2014 Broadcom -+ * -+ * Permission is hereby granted, free of charge, to any person obtaining a -+ * copy of this software and associated documentation files (the "Software"), -+ * to deal in the Software without restriction, including without limitation -+ * the rights to use, copy, modify, merge, publish, distribute, sublicense, -+ * and/or sell copies of the Software, and to permit persons to whom the -+ * Software is furnished to do so, subject to the following conditions: -+ * -+ * The above copyright notice and this permission notice (including the next -+ * paragraph) shall be included in all copies or substantial portions of the -+ * Software. -+ * -+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -+ * IN THE SOFTWARE. -+ */ -+ -+#ifndef VC4_QPU_DEFINES_H -+#define VC4_QPU_DEFINES_H -+ -+enum qpu_op_add { -+ QPU_A_NOP, -+ QPU_A_FADD, -+ QPU_A_FSUB, -+ QPU_A_FMIN, -+ QPU_A_FMAX, -+ QPU_A_FMINABS, -+ QPU_A_FMAXABS, -+ QPU_A_FTOI, -+ QPU_A_ITOF, -+ QPU_A_ADD = 12, -+ QPU_A_SUB, -+ QPU_A_SHR, -+ QPU_A_ASR, -+ QPU_A_ROR, -+ QPU_A_SHL, -+ QPU_A_MIN, -+ QPU_A_MAX, -+ QPU_A_AND, -+ QPU_A_OR, -+ QPU_A_XOR, -+ QPU_A_NOT, -+ QPU_A_CLZ, -+ QPU_A_V8ADDS = 30, -+ QPU_A_V8SUBS = 31, -+}; -+ -+enum qpu_op_mul { -+ QPU_M_NOP, -+ QPU_M_FMUL, -+ QPU_M_MUL24, -+ QPU_M_V8MULD, -+ QPU_M_V8MIN, -+ QPU_M_V8MAX, -+ QPU_M_V8ADDS, -+ QPU_M_V8SUBS, -+}; -+ -+enum qpu_raddr { -+ QPU_R_FRAG_PAYLOAD_ZW = 15, /* W for A file, Z for B file */ -+ /* 0-31 are the plain regfile a or b fields */ -+ QPU_R_UNIF = 32, -+ QPU_R_VARY = 35, -+ QPU_R_ELEM_QPU = 38, -+ QPU_R_NOP, -+ QPU_R_XY_PIXEL_COORD = 41, -+ QPU_R_MS_REV_FLAGS = 41, -+ QPU_R_VPM = 48, -+ QPU_R_VPM_LD_BUSY, -+ QPU_R_VPM_LD_WAIT, -+ QPU_R_MUTEX_ACQUIRE, -+}; -+ -+enum qpu_waddr { -+ /* 0-31 are the plain regfile a or b fields */ -+ QPU_W_ACC0 = 32, /* aka r0 */ -+ QPU_W_ACC1, -+ QPU_W_ACC2, -+ QPU_W_ACC3, -+ QPU_W_TMU_NOSWAP, -+ QPU_W_ACC5, -+ QPU_W_HOST_INT, -+ QPU_W_NOP, -+ QPU_W_UNIFORMS_ADDRESS, -+ QPU_W_QUAD_XY, /* X for regfile a, Y for regfile b */ -+ QPU_W_MS_FLAGS = 42, -+ QPU_W_REV_FLAG = 42, -+ QPU_W_TLB_STENCIL_SETUP = 43, -+ QPU_W_TLB_Z, -+ QPU_W_TLB_COLOR_MS, -+ QPU_W_TLB_COLOR_ALL, -+ QPU_W_TLB_ALPHA_MASK, -+ QPU_W_VPM, -+ QPU_W_VPMVCD_SETUP, /* LD for regfile a, ST for regfile b */ -+ QPU_W_VPM_ADDR, /* LD for regfile a, ST for regfile b */ -+ QPU_W_MUTEX_RELEASE, -+ QPU_W_SFU_RECIP, -+ QPU_W_SFU_RECIPSQRT, -+ QPU_W_SFU_EXP, -+ QPU_W_SFU_LOG, -+ QPU_W_TMU0_S, -+ QPU_W_TMU0_T, -+ QPU_W_TMU0_R, -+ QPU_W_TMU0_B, -+ QPU_W_TMU1_S, -+ QPU_W_TMU1_T, -+ QPU_W_TMU1_R, -+ QPU_W_TMU1_B, -+}; -+ -+enum qpu_sig_bits { -+ QPU_SIG_SW_BREAKPOINT, -+ QPU_SIG_NONE, -+ QPU_SIG_THREAD_SWITCH, -+ QPU_SIG_PROG_END, -+ QPU_SIG_WAIT_FOR_SCOREBOARD, -+ QPU_SIG_SCOREBOARD_UNLOCK, -+ QPU_SIG_LAST_THREAD_SWITCH, -+ QPU_SIG_COVERAGE_LOAD, -+ QPU_SIG_COLOR_LOAD, -+ QPU_SIG_COLOR_LOAD_END, -+ QPU_SIG_LOAD_TMU0, -+ QPU_SIG_LOAD_TMU1, -+ QPU_SIG_ALPHA_MASK_LOAD, -+ QPU_SIG_SMALL_IMM, -+ QPU_SIG_LOAD_IMM, -+ QPU_SIG_BRANCH -+}; -+ -+enum qpu_mux { -+ /* hardware mux values */ -+ QPU_MUX_R0, -+ QPU_MUX_R1, -+ QPU_MUX_R2, -+ QPU_MUX_R3, -+ QPU_MUX_R4, -+ QPU_MUX_R5, -+ QPU_MUX_A, -+ QPU_MUX_B, -+ -+ /* non-hardware mux values */ -+ QPU_MUX_IMM, -+}; -+ -+enum qpu_cond { -+ QPU_COND_NEVER, -+ QPU_COND_ALWAYS, -+ QPU_COND_ZS, -+ QPU_COND_ZC, -+ QPU_COND_NS, -+ QPU_COND_NC, -+ QPU_COND_CS, -+ QPU_COND_CC, -+}; -+ -+enum qpu_pack_mul { -+ QPU_PACK_MUL_NOP, -+ QPU_PACK_MUL_8888 = 3, /* replicated to each 8 bits of the 32-bit dst. */ -+ QPU_PACK_MUL_8A, -+ QPU_PACK_MUL_8B, -+ QPU_PACK_MUL_8C, -+ QPU_PACK_MUL_8D, -+}; -+ -+enum qpu_pack_a { -+ QPU_PACK_A_NOP, -+ /* convert to 16 bit float if float input, or to int16. */ -+ QPU_PACK_A_16A, -+ QPU_PACK_A_16B, -+ /* replicated to each 8 bits of the 32-bit dst. */ -+ QPU_PACK_A_8888, -+ /* Convert to 8-bit unsigned int. */ -+ QPU_PACK_A_8A, -+ QPU_PACK_A_8B, -+ QPU_PACK_A_8C, -+ QPU_PACK_A_8D, -+ -+ /* Saturating variants of the previous instructions. */ -+ QPU_PACK_A_32_SAT, /* int-only */ -+ QPU_PACK_A_16A_SAT, /* int or float */ -+ QPU_PACK_A_16B_SAT, -+ QPU_PACK_A_8888_SAT, -+ QPU_PACK_A_8A_SAT, -+ QPU_PACK_A_8B_SAT, -+ QPU_PACK_A_8C_SAT, -+ QPU_PACK_A_8D_SAT, -+}; -+ -+enum qpu_unpack_r4 { -+ QPU_UNPACK_R4_NOP, -+ QPU_UNPACK_R4_F16A_TO_F32, -+ QPU_UNPACK_R4_F16B_TO_F32, -+ QPU_UNPACK_R4_8D_REP, -+ QPU_UNPACK_R4_8A, -+ QPU_UNPACK_R4_8B, -+ QPU_UNPACK_R4_8C, -+ QPU_UNPACK_R4_8D, -+}; -+ -+#define QPU_MASK(high, low) ((((uint64_t)1<<((high)-(low)+1))-1)<<(low)) -+/* Using the GNU statement expression extension */ -+#define QPU_SET_FIELD(value, field) \ -+ ({ \ -+ uint64_t fieldval = (uint64_t)(value) << field ## _SHIFT; \ -+ assert((fieldval & ~ field ## _MASK) == 0); \ -+ fieldval & field ## _MASK; \ -+ }) -+ -+#define QPU_GET_FIELD(word, field) ((uint32_t)(((word) & field ## _MASK) >> field ## _SHIFT)) -+ -+#define QPU_SIG_SHIFT 60 -+#define QPU_SIG_MASK QPU_MASK(63, 60) -+ -+#define QPU_UNPACK_SHIFT 57 -+#define QPU_UNPACK_MASK QPU_MASK(59, 57) -+ -+/** -+ * If set, the pack field means PACK_MUL or R4 packing, instead of normal -+ * regfile a packing. -+ */ -+#define QPU_PM ((uint64_t)1 << 56) -+ -+#define QPU_PACK_SHIFT 52 -+#define QPU_PACK_MASK QPU_MASK(55, 52) -+ -+#define QPU_COND_ADD_SHIFT 49 -+#define QPU_COND_ADD_MASK QPU_MASK(51, 49) -+#define QPU_COND_MUL_SHIFT 46 -+#define QPU_COND_MUL_MASK QPU_MASK(48, 46) -+ -+#define QPU_SF ((uint64_t)1 << 45) -+ -+#define QPU_WADDR_ADD_SHIFT 38 -+#define QPU_WADDR_ADD_MASK QPU_MASK(43, 38) -+#define QPU_WADDR_MUL_SHIFT 32 -+#define QPU_WADDR_MUL_MASK QPU_MASK(37, 32) -+ -+#define QPU_OP_MUL_SHIFT 29 -+#define QPU_OP_MUL_MASK QPU_MASK(31, 29) -+ -+#define QPU_RADDR_A_SHIFT 18 -+#define QPU_RADDR_A_MASK QPU_MASK(23, 18) -+#define QPU_RADDR_B_SHIFT 12 -+#define QPU_RADDR_B_MASK QPU_MASK(17, 12) -+#define QPU_SMALL_IMM_SHIFT 12 -+#define QPU_SMALL_IMM_MASK QPU_MASK(17, 12) -+ -+#define QPU_ADD_A_SHIFT 9 -+#define QPU_ADD_A_MASK QPU_MASK(11, 9) -+#define QPU_ADD_B_SHIFT 6 -+#define QPU_ADD_B_MASK QPU_MASK(8, 6) -+#define QPU_MUL_A_SHIFT 3 -+#define QPU_MUL_A_MASK QPU_MASK(5, 3) -+#define QPU_MUL_B_SHIFT 0 -+#define QPU_MUL_B_MASK QPU_MASK(2, 0) -+ -+#define QPU_WS ((uint64_t)1 << 44) -+ -+#define QPU_OP_ADD_SHIFT 24 -+#define QPU_OP_ADD_MASK QPU_MASK(28, 24) -+ -+#endif /* VC4_QPU_DEFINES_H */ -diff --git a/drivers/gpu/drm/vc4/vc4_render_cl.c b/drivers/gpu/drm/vc4/vc4_render_cl.c + config SND_BCM2708_SOC_RPI_DAC + tristate "Support for RPi-DAC" + depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S +diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile +index 99c96b4..4d53c58 100644 +--- a/sound/soc/bcm/Makefile ++++ b/sound/soc/bcm/Makefile +@@ -5,7 +5,9 @@ obj-$(CONFIG_SND_BCM2835_SOC_I2S) += snd-soc-bcm2835-i2s.o + + # BCM2708 Machine Support + snd-soc-hifiberry-dac-objs := hifiberry_dac.o ++snd-soc-hifiberry-digi-objs := hifiberry_digi.o + snd-soc-rpi-dac-objs := rpi-dac.o + + obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o ++obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI) += snd-soc-hifiberry-digi.o + obj-$(CONFIG_SND_BCM2708_SOC_RPI_DAC) += snd-soc-rpi-dac.o +diff --git a/sound/soc/bcm/hifiberry_digi.c b/sound/soc/bcm/hifiberry_digi.c new file mode 100644 -index 0000000..0ffac8d +index 0000000..9840e15 --- /dev/null -+++ b/drivers/gpu/drm/vc4/vc4_render_cl.c -@@ -0,0 +1,448 @@ ++++ b/sound/soc/bcm/hifiberry_digi.c +@@ -0,0 +1,224 @@ +/* -+ * Copyright © 2014-2015 Broadcom ++ * ASoC Driver for HifiBerry Digi + * -+ * Permission is hereby granted, free of charge, to any person obtaining a -+ * copy of this software and associated documentation files (the "Software"), -+ * to deal in the Software without restriction, including without limitation -+ * the rights to use, copy, modify, merge, publish, distribute, sublicense, -+ * and/or sell copies of the Software, and to permit persons to whom the -+ * Software is furnished to do so, subject to the following conditions: ++ * Author: Daniel Matuschek <info@crazy-audio.com> ++ * based on the HifiBerry DAC driver by Florian Meier <florian.meier@koalo.de> ++ * Copyright 2013 + * -+ * The above copyright notice and this permission notice (including the next -+ * paragraph) shall be included in all copies or substantial portions of the -+ * Software. ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * version 2 as published by the Free Software Foundation. + * -+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -+ * IN THE SOFTWARE. ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * General Public License for more details. + */ + -+/** -+ * DOC: Render command list generation -+ * -+ * In the VC4 driver, render command list generation is performed by the -+ * kernel instead of userspace. We do this because validating a -+ * user-submitted command list is hard to get right and has high CPU overhead, -+ * while the number of valid configurations for render command lists is -+ * actually fairly low. -+ */ ++#include <linux/module.h> ++#include <linux/platform_device.h> + -+#include "uapi/drm/vc4_drm.h" -+#include "vc4_drv.h" -+#include "vc4_packet.h" ++#include <sound/core.h> ++#include <sound/pcm.h> ++#include <sound/pcm_params.h> ++#include <sound/soc.h> ++#include <sound/jack.h> + -+struct vc4_rcl_setup { -+ struct drm_gem_cma_object *color_read; -+ struct drm_gem_cma_object *color_ms_write; -+ struct drm_gem_cma_object *zs_read; -+ struct drm_gem_cma_object *zs_write; ++#include "../codecs/wm8804.h" + -+ struct drm_gem_cma_object *rcl; -+ u32 next_offset; -+}; ++static short int auto_shutdown_output = 0; ++module_param(auto_shutdown_output, short, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP); ++MODULE_PARM_DESC(auto_shutdown_output, "Shutdown SP/DIF output if playback is stopped"); + -+static inline void rcl_u8(struct vc4_rcl_setup *setup, u8 val) -+{ -+ *(u8 *)(setup->rcl->vaddr + setup->next_offset) = val; -+ setup->next_offset += 1; -+} + -+static inline void rcl_u16(struct vc4_rcl_setup *setup, u16 val) -+{ -+ *(u16 *)(setup->rcl->vaddr + setup->next_offset) = val; -+ setup->next_offset += 2; -+} ++static int samplerate=44100; + -+static inline void rcl_u32(struct vc4_rcl_setup *setup, u32 val) ++static int snd_rpi_hifiberry_digi_init(struct snd_soc_pcm_runtime *rtd) +{ -+ *(u32 *)(setup->rcl->vaddr + setup->next_offset) = val; -+ setup->next_offset += 4; -+} ++ struct snd_soc_codec *codec = rtd->codec; + ++ /* enable TX output */ ++ snd_soc_update_bits(codec, WM8804_PWRDN, 0x4, 0x0); + -+/* -+ * Emits a no-op STORE_TILE_BUFFER_GENERAL. -+ * -+ * If we emit a PACKET_TILE_COORDINATES, it must be followed by a store of -+ * some sort before another load is triggered. -+ */ -+static void vc4_store_before_load(struct vc4_rcl_setup *setup) -+{ -+ rcl_u8(setup, VC4_PACKET_STORE_TILE_BUFFER_GENERAL); -+ rcl_u16(setup, -+ VC4_SET_FIELD(VC4_LOADSTORE_TILE_BUFFER_NONE, -+ VC4_LOADSTORE_TILE_BUFFER_BUFFER) | -+ VC4_STORE_TILE_BUFFER_DISABLE_COLOR_CLEAR | -+ VC4_STORE_TILE_BUFFER_DISABLE_ZS_CLEAR | -+ VC4_STORE_TILE_BUFFER_DISABLE_VG_MASK_CLEAR); -+ rcl_u32(setup, 0); /* no address, since we're in None mode */ ++ return 0; +} + -+/* -+ * Emits a PACKET_TILE_COORDINATES if one isn't already pending. -+ * -+ * The tile coordinates packet triggers a pending load if there is one, are -+ * used for clipping during rendering, and determine where loads/stores happen -+ * relative to their base address. -+ */ -+static void vc4_tile_coordinates(struct vc4_rcl_setup *setup, -+ uint32_t x, uint32_t y) -+{ -+ rcl_u8(setup, VC4_PACKET_TILE_COORDINATES); -+ rcl_u8(setup, x); -+ rcl_u8(setup, y); ++static int snd_rpi_hifiberry_digi_startup(struct snd_pcm_substream *substream) { ++ /* turn on digital output */ ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_codec *codec = rtd->codec; ++ snd_soc_update_bits(codec, WM8804_PWRDN, 0x3c, 0x00); ++ return 0; +} + -+static void emit_tile(struct vc4_exec_info *exec, -+ struct vc4_rcl_setup *setup, -+ uint8_t x, uint8_t y, bool first, bool last) -+{ -+ struct drm_vc4_submit_cl *args = exec->args; -+ bool has_bin = args->bin_cl_size != 0; -+ -+ /* Note that the load doesn't actually occur until the -+ * tile coords packet is processed, and only one load -+ * may be outstanding at a time. -+ */ -+ if (setup->color_read) { -+ rcl_u8(setup, VC4_PACKET_LOAD_TILE_BUFFER_GENERAL); -+ rcl_u16(setup, args->color_read.bits); -+ rcl_u32(setup, -+ setup->color_read->paddr + args->color_read.offset); ++static void snd_rpi_hifiberry_digi_shutdown(struct snd_pcm_substream *substream) { ++ /* turn off output */ ++ if (auto_shutdown_output) { ++ /* turn off output */ ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_codec *codec = rtd->codec; ++ snd_soc_update_bits(codec, WM8804_PWRDN, 0x3c, 0x3c); + } ++} + -+ if (setup->zs_read) { -+ if (setup->color_read) { -+ /* Exec previous load. */ -+ vc4_tile_coordinates(setup, x, y); -+ vc4_store_before_load(setup); -+ } + -+ rcl_u8(setup, VC4_PACKET_LOAD_TILE_BUFFER_GENERAL); -+ rcl_u16(setup, args->zs_read.bits); -+ rcl_u32(setup, setup->zs_read->paddr + args->zs_read.offset); -+ } ++static int snd_rpi_hifiberry_digi_hw_params(struct snd_pcm_substream *substream, ++ struct snd_pcm_hw_params *params) ++{ ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_dai *codec_dai = rtd->codec_dai; ++ struct snd_soc_codec *codec = rtd->codec; ++ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; + -+ /* Clipping depends on tile coordinates having been -+ * emitted, so we always need one here. -+ */ -+ vc4_tile_coordinates(setup, x, y); ++ int sysclk = 27000000; /* This is fixed on this board */ + -+ /* Wait for the binner before jumping to the first -+ * tile's lists. -+ */ -+ if (first && has_bin) -+ rcl_u8(setup, VC4_PACKET_WAIT_ON_SEMAPHORE); ++ long mclk_freq=0; ++ int mclk_div=1; ++ int sampling_freq=1; + -+ if (has_bin) { -+ rcl_u8(setup, VC4_PACKET_BRANCH_TO_SUB_LIST); -+ rcl_u32(setup, (exec->tile_bo->paddr + -+ exec->tile_alloc_offset + -+ (y * exec->bin_tiles_x + x) * 32)); -+ } ++ int ret; ++ ++ samplerate = params_rate(params); + -+ if (setup->zs_write) { -+ rcl_u8(setup, VC4_PACKET_STORE_TILE_BUFFER_GENERAL); -+ rcl_u16(setup, args->zs_write.bits | -+ (setup->color_ms_write ? -+ VC4_STORE_TILE_BUFFER_DISABLE_COLOR_CLEAR : 0)); -+ rcl_u32(setup, -+ (setup->zs_write->paddr + args->zs_write.offset) | -+ ((last && !setup->color_ms_write) ? -+ VC4_LOADSTORE_TILE_BUFFER_EOF : 0)); ++ if (samplerate<=96000) { ++ mclk_freq=samplerate*256; ++ mclk_div=WM8804_MCLKDIV_256FS; ++ } else { ++ mclk_freq=samplerate*128; ++ mclk_div=WM8804_MCLKDIV_128FS; ++ } ++ ++ switch (samplerate) { ++ case 32000: ++ sampling_freq=0x03; ++ break; ++ case 44100: ++ sampling_freq=0x00; ++ break; ++ case 48000: ++ sampling_freq=0x02; ++ break; ++ case 88200: ++ sampling_freq=0x08; ++ break; ++ case 96000: ++ sampling_freq=0x0a; ++ break; ++ case 176400: ++ sampling_freq=0x0c; ++ break; ++ case 192000: ++ sampling_freq=0x0e; ++ break; ++ default: ++ dev_err(codec->dev, ++ "Failed to set WM8804 SYSCLK, unsupported samplerate %d\n", ++ samplerate); + } + -+ if (setup->color_ms_write) { -+ if (setup->zs_write) { -+ /* Reset after previous store */ -+ vc4_tile_coordinates(setup, x, y); -+ } ++ snd_soc_dai_set_clkdiv(codec_dai, WM8804_MCLK_DIV, mclk_div); ++ snd_soc_dai_set_pll(codec_dai, 0, 0, sysclk, mclk_freq); + -+ if (last) -+ rcl_u8(setup, VC4_PACKET_STORE_MS_TILE_BUFFER_AND_EOF); -+ else -+ rcl_u8(setup, VC4_PACKET_STORE_MS_TILE_BUFFER); ++ ret = snd_soc_dai_set_sysclk(codec_dai, WM8804_TX_CLKSRC_PLL, ++ sysclk, SND_SOC_CLOCK_OUT); ++ if (ret < 0) { ++ dev_err(codec->dev, ++ "Failed to set WM8804 SYSCLK: %d\n", ret); ++ return ret; + } -+} + -+static int vc4_create_rcl_bo(struct drm_device *dev, struct vc4_exec_info *exec, -+ struct vc4_rcl_setup *setup) -+{ -+ struct drm_vc4_submit_cl *args = exec->args; -+ bool has_bin = args->bin_cl_size != 0; -+ uint8_t min_x_tile = args->min_x_tile; -+ uint8_t min_y_tile = args->min_y_tile; -+ uint8_t max_x_tile = args->max_x_tile; -+ uint8_t max_y_tile = args->max_y_tile; -+ uint8_t xtiles = max_x_tile - min_x_tile + 1; -+ uint8_t ytiles = max_y_tile - min_y_tile + 1; -+ uint8_t x, y; -+ uint32_t size, loop_body_size; ++ /* Enable TX output */ ++ snd_soc_update_bits(codec, WM8804_PWRDN, 0x4, 0x0); + -+ size = VC4_PACKET_TILE_RENDERING_MODE_CONFIG_SIZE; -+ loop_body_size = VC4_PACKET_TILE_COORDINATES_SIZE; ++ /* Power on */ ++ snd_soc_update_bits(codec, WM8804_PWRDN, 0x9, 0); + -+ if (args->flags & VC4_SUBMIT_CL_USE_CLEAR_COLOR) { -+ size += VC4_PACKET_CLEAR_COLORS_SIZE + -+ VC4_PACKET_TILE_COORDINATES_SIZE + -+ VC4_PACKET_STORE_TILE_BUFFER_GENERAL_SIZE; -+ } ++ /* set sampling frequency status bits */ ++ snd_soc_update_bits(codec, WM8804_SPDTX4, 0x0f, sampling_freq); + -+ if (setup->color_read) { -+ loop_body_size += (VC4_PACKET_LOAD_TILE_BUFFER_GENERAL_SIZE); -+ } -+ if (setup->zs_read) { -+ if (setup->color_read) { -+ loop_body_size += VC4_PACKET_TILE_COORDINATES_SIZE; -+ loop_body_size += VC4_PACKET_STORE_TILE_BUFFER_GENERAL_SIZE; -+ } -+ loop_body_size += VC4_PACKET_LOAD_TILE_BUFFER_GENERAL_SIZE; -+ } ++ return snd_soc_dai_set_bclk_ratio(cpu_dai,64); ++} + -+ if (has_bin) { -+ size += VC4_PACKET_WAIT_ON_SEMAPHORE_SIZE; -+ loop_body_size += VC4_PACKET_BRANCH_TO_SUB_LIST_SIZE; -+ } ++/* machine stream operations */ ++static struct snd_soc_ops snd_rpi_hifiberry_digi_ops = { ++ .hw_params = snd_rpi_hifiberry_digi_hw_params, ++ .startup = snd_rpi_hifiberry_digi_startup, ++ .shutdown = snd_rpi_hifiberry_digi_shutdown, ++}; + -+ if (setup->zs_write) -+ loop_body_size += VC4_PACKET_STORE_TILE_BUFFER_GENERAL_SIZE; -+ if (setup->color_ms_write) { -+ if (setup->zs_write) -+ loop_body_size += VC4_PACKET_TILE_COORDINATES_SIZE; -+ loop_body_size += VC4_PACKET_STORE_MS_TILE_BUFFER_SIZE; -+ } -+ size += xtiles * ytiles * loop_body_size; ++static struct snd_soc_dai_link snd_rpi_hifiberry_digi_dai[] = { ++{ ++ .name = "HifiBerry Digi", ++ .stream_name = "HifiBerry Digi HiFi", ++ .cpu_dai_name = "bcm2708-i2s.0", ++ .codec_dai_name = "wm8804-spdif", ++ .platform_name = "bcm2708-i2s.0", ++ .codec_name = "wm8804.1-003b", ++ .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | ++ SND_SOC_DAIFMT_CBM_CFM, ++ .ops = &snd_rpi_hifiberry_digi_ops, ++ .init = snd_rpi_hifiberry_digi_init, ++}, ++}; + -+ setup->rcl = &vc4_bo_create(dev, size)->base; -+ if (!setup->rcl) -+ return -ENOMEM; -+ list_add_tail(&to_vc4_bo(&setup->rcl->base)->unref_head, -+ &exec->unref_list); -+ -+ rcl_u8(setup, VC4_PACKET_TILE_RENDERING_MODE_CONFIG); -+ rcl_u32(setup, -+ (setup->color_ms_write ? -+ (setup->color_ms_write->paddr + -+ args->color_ms_write.offset) : -+ 0)); -+ rcl_u16(setup, args->width); -+ rcl_u16(setup, args->height); -+ rcl_u16(setup, args->color_ms_write.bits); -+ -+ /* The tile buffer gets cleared when the previous tile is stored. If -+ * the clear values changed between frames, then the tile buffer has -+ * stale clear values in it, so we have to do a store in None mode (no -+ * writes) so that we trigger the tile buffer clear. -+ */ -+ if (args->flags & VC4_SUBMIT_CL_USE_CLEAR_COLOR) { -+ rcl_u8(setup, VC4_PACKET_CLEAR_COLORS); -+ rcl_u32(setup, args->clear_color[0]); -+ rcl_u32(setup, args->clear_color[1]); -+ rcl_u32(setup, args->clear_z); -+ rcl_u8(setup, args->clear_s); ++/* audio machine driver */ ++static struct snd_soc_card snd_rpi_hifiberry_digi = { ++ .name = "snd_rpi_hifiberry_digi", ++ .owner = THIS_MODULE, ++ .dai_link = snd_rpi_hifiberry_digi_dai, ++ .num_links = ARRAY_SIZE(snd_rpi_hifiberry_digi_dai), ++}; + -+ vc4_tile_coordinates(setup, 0, 0); ++static int snd_rpi_hifiberry_digi_probe(struct platform_device *pdev) ++{ ++ int ret = 0; + -+ rcl_u8(setup, VC4_PACKET_STORE_TILE_BUFFER_GENERAL); -+ rcl_u16(setup, VC4_LOADSTORE_TILE_BUFFER_NONE); -+ rcl_u32(setup, 0); /* no address, since we're in None mode */ -+ } ++ snd_rpi_hifiberry_digi.dev = &pdev->dev; + -+ for (y = min_y_tile; y <= max_y_tile; y++) { -+ for (x = min_x_tile; x <= max_x_tile; x++) { -+ bool first = (x == min_x_tile && y == min_y_tile); -+ bool last = (x == max_x_tile && y == max_y_tile); -+ emit_tile(exec, setup, x, y, first, last); -+ } ++ if (pdev->dev.of_node) { ++ struct device_node *i2s_node; ++ struct snd_soc_dai_link *dai = &snd_rpi_hifiberry_digi_dai[0]; ++ i2s_node = of_parse_phandle(pdev->dev.of_node, ++ "i2s-controller", 0); ++ ++ if (i2s_node) { ++ dai->cpu_dai_name = NULL; ++ dai->cpu_of_node = i2s_node; ++ dai->platform_name = NULL; ++ dai->platform_of_node = i2s_node; ++ } + } + -+ BUG_ON(setup->next_offset != size); -+ exec->ct1ca = setup->rcl->paddr; -+ exec->ct1ea = setup->rcl->paddr + setup->next_offset; ++ ret = snd_soc_register_card(&snd_rpi_hifiberry_digi); ++ if (ret) ++ dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", ret); + -+ return 0; ++ return ret; +} + -+static int vc4_rcl_surface_setup(struct vc4_exec_info *exec, -+ struct drm_gem_cma_object **obj, -+ struct drm_vc4_submit_rcl_surface *surf) ++static int snd_rpi_hifiberry_digi_remove(struct platform_device *pdev) +{ -+ uint8_t tiling = VC4_GET_FIELD(surf->bits, -+ VC4_LOADSTORE_TILE_BUFFER_TILING); -+ uint8_t buffer = VC4_GET_FIELD(surf->bits, -+ VC4_LOADSTORE_TILE_BUFFER_BUFFER); -+ uint8_t format = VC4_GET_FIELD(surf->bits, -+ VC4_LOADSTORE_TILE_BUFFER_FORMAT); -+ int cpp; ++ return snd_soc_unregister_card(&snd_rpi_hifiberry_digi); ++} + -+ if (surf->pad != 0) { -+ DRM_ERROR("Padding unset\n"); -+ return -EINVAL; -+ } ++static const struct of_device_id snd_rpi_hifiberry_digi_of_match[] = { ++ { .compatible = "hifiberry,hifiberry-digi", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, snd_rpi_hifiberry_digi_of_match); + -+ if (surf->hindex == ~0) -+ return 0; ++static struct platform_driver snd_rpi_hifiberry_digi_driver = { ++ .driver = { ++ .name = "snd-hifiberry-digi", ++ .owner = THIS_MODULE, ++ .of_match_table = snd_rpi_hifiberry_digi_of_match, ++ }, ++ .probe = snd_rpi_hifiberry_digi_probe, ++ .remove = snd_rpi_hifiberry_digi_remove, ++}; + -+ if (!vc4_use_bo(exec, surf->hindex, VC4_MODE_RENDER, obj)) -+ return -EINVAL; ++module_platform_driver(snd_rpi_hifiberry_digi_driver); + -+ if (surf->bits & ~(VC4_LOADSTORE_TILE_BUFFER_TILING_MASK | -+ VC4_LOADSTORE_TILE_BUFFER_BUFFER_MASK | -+ VC4_LOADSTORE_TILE_BUFFER_FORMAT_MASK)) { -+ DRM_ERROR("Unknown bits in load/store: 0x%04x\n", -+ surf->bits); -+ return -EINVAL; -+ } ++MODULE_AUTHOR("Daniel Matuschek <info@crazy-audio.com>"); ++MODULE_DESCRIPTION("ASoC Driver for HifiBerry Digi"); ++MODULE_LICENSE("GPL v2"); + +From ea72e0251bc9d43b981cf3f5caa807c41475e327 Mon Sep 17 00:00:00 2001 +From: Gordon Garrity <gordon@iqaudio.com> +Date: Sat, 8 Mar 2014 16:56:57 +0000 +Subject: [PATCH 070/112] Add IQaudIO Sound Card support for Raspberry Pi + +Set a limit of 0dB on Digital Volume Control + +The main volume control in the PCM512x DAC has a range up to ++24dB. This is dangerously loud and can potentially cause massive +clipping in the output stages. Therefore this sets a sensible +limit of 0dB for this control. + +Allow up to 24dB digital gain to be applied when using IQAudIO DAC+ + +24db_digital_gain DT param can be used to specify that PCM512x +codec "Digital" volume control should not be limited to 0dB gain, +and if specified will allow the full 24dB gain. + +Modify IQAudIO DAC+ ASoC driver to set card/dai config from dt + +Add the ability to set the card name, dai name and dai stream name, from +dt config. + +Signed-off-by: DigitalDreamtime <clive.messer@digitaldreamtime.co.uk> +--- + sound/soc/bcm/Kconfig | 7 +++ + sound/soc/bcm/Makefile | 2 + + sound/soc/bcm/iqaudio-dac.c | 148 ++++++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 157 insertions(+) + create mode 100644 sound/soc/bcm/iqaudio-dac.c + +diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig +index a34aff2..38dcdd9 100644 +--- a/sound/soc/bcm/Kconfig ++++ b/sound/soc/bcm/Kconfig +@@ -28,3 +28,10 @@ config SND_BCM2708_SOC_RPI_DAC + select SND_SOC_PCM1794A + help + Say Y or M if you want to add support for RPi-DAC. + -+ if (tiling > VC4_TILING_FORMAT_LT) { -+ DRM_ERROR("Bad tiling format\n"); -+ return -EINVAL; -+ } ++config SND_BCM2708_SOC_IQAUDIO_DAC ++ tristate "Support for IQaudIO-DAC" ++ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S ++ select SND_SOC_PCM512x_I2C ++ help ++ Say Y or M if you want to add support for IQaudIO-DAC. +diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile +index 4d53c58..08e4dc5 100644 +--- a/sound/soc/bcm/Makefile ++++ b/sound/soc/bcm/Makefile +@@ -7,7 +7,9 @@ obj-$(CONFIG_SND_BCM2835_SOC_I2S) += snd-soc-bcm2835-i2s.o + snd-soc-hifiberry-dac-objs := hifiberry_dac.o + snd-soc-hifiberry-digi-objs := hifiberry_digi.o + snd-soc-rpi-dac-objs := rpi-dac.o ++snd-soc-iqaudio-dac-objs := iqaudio-dac.o + + obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o + obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI) += snd-soc-hifiberry-digi.o + obj-$(CONFIG_SND_BCM2708_SOC_RPI_DAC) += snd-soc-rpi-dac.o ++obj-$(CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC) += snd-soc-iqaudio-dac.o +diff --git a/sound/soc/bcm/iqaudio-dac.c b/sound/soc/bcm/iqaudio-dac.c +new file mode 100644 +index 0000000..b6b6dcf +--- /dev/null ++++ b/sound/soc/bcm/iqaudio-dac.c +@@ -0,0 +1,148 @@ ++/* ++ * ASoC Driver for IQaudIO DAC ++ * ++ * Author: Florian Meier <florian.meier@koalo.de> ++ * Copyright 2013 ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * version 2 as published by the Free Software Foundation. ++ * ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * General Public License for more details. ++ */ + -+ if (buffer == VC4_LOADSTORE_TILE_BUFFER_ZS) { -+ if (format != 0) { -+ DRM_ERROR("No color format should be set for ZS\n"); -+ return -EINVAL; -+ } -+ cpp = 4; -+ } else if (buffer == VC4_LOADSTORE_TILE_BUFFER_COLOR) { -+ switch (format) { -+ case VC4_LOADSTORE_TILE_BUFFER_BGR565: -+ case VC4_LOADSTORE_TILE_BUFFER_BGR565_DITHER: -+ cpp = 2; -+ break; -+ case VC4_LOADSTORE_TILE_BUFFER_RGBA8888: -+ cpp = 4; -+ break; -+ default: -+ DRM_ERROR("Bad tile buffer format\n"); -+ return -EINVAL; -+ } -+ } else { -+ DRM_ERROR("Bad load/store buffer %d.\n", buffer); -+ return -EINVAL; -+ } ++#include <linux/module.h> ++#include <linux/platform_device.h> + -+ if (surf->offset & 0xf) { -+ DRM_ERROR("load/store buffer must be 16b aligned.\n"); -+ return -EINVAL; -+ } ++#include <sound/core.h> ++#include <sound/pcm.h> ++#include <sound/pcm_params.h> ++#include <sound/soc.h> ++#include <sound/jack.h> + -+ if (!vc4_check_tex_size(exec, *obj, surf->offset, tiling, -+ exec->args->width, exec->args->height, cpp)) { -+ return -EINVAL; ++static bool digital_gain_0db_limit = true; ++ ++static int snd_rpi_iqaudio_dac_init(struct snd_soc_pcm_runtime *rtd) ++{ ++ if (digital_gain_0db_limit) ++ { ++ int ret; ++ struct snd_soc_card *card = rtd->card; ++ ++ ret = snd_soc_limit_volume(card, "Digital Playback Volume", 207); ++ if (ret < 0) ++ dev_warn(card->dev, "Failed to set volume limit: %d\n", ret); + } + + return 0; +} + -+static int -+vc4_rcl_ms_surface_setup(struct vc4_exec_info *exec, -+ struct drm_gem_cma_object **obj, -+ struct drm_vc4_submit_rcl_surface *surf) -+{ -+ uint8_t tiling = VC4_GET_FIELD(surf->bits, -+ VC4_RENDER_CONFIG_MEMORY_FORMAT); -+ uint8_t format = VC4_GET_FIELD(surf->bits, -+ VC4_RENDER_CONFIG_FORMAT); -+ int cpp; -+ -+ if (surf->pad != 0) { -+ DRM_ERROR("Padding unset\n"); -+ return -EINVAL; -+ } ++static int snd_rpi_iqaudio_dac_hw_params(struct snd_pcm_substream *substream, ++ struct snd_pcm_hw_params *params) ++{ ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++// NOT USED struct snd_soc_dai *codec_dai = rtd->codec_dai; ++// NOT USED struct snd_soc_codec *codec = rtd->codec; ++ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; + -+ if (surf->bits & ~(VC4_RENDER_CONFIG_MEMORY_FORMAT_MASK | -+ VC4_RENDER_CONFIG_FORMAT_MASK)) { -+ DRM_ERROR("Unknown bits in render config: 0x%04x\n", -+ surf->bits); -+ return -EINVAL; -+ } ++ unsigned int sample_bits = ++ snd_pcm_format_physical_width(params_format(params)); + -+ if (surf->hindex == ~0) -+ return 0; ++ return snd_soc_dai_set_bclk_ratio(cpu_dai, sample_bits * 2); ++} + -+ if (!vc4_use_bo(exec, surf->hindex, VC4_MODE_RENDER, obj)) -+ return -EINVAL; ++/* machine stream operations */ ++static struct snd_soc_ops snd_rpi_iqaudio_dac_ops = { ++ .hw_params = snd_rpi_iqaudio_dac_hw_params, ++}; + -+ if (tiling > VC4_TILING_FORMAT_LT) { -+ DRM_ERROR("Bad tiling format\n"); -+ return -EINVAL; -+ } ++static struct snd_soc_dai_link snd_rpi_iqaudio_dac_dai[] = { ++{ ++ .cpu_dai_name = "bcm2708-i2s.0", ++ .codec_dai_name = "pcm512x-hifi", ++ .platform_name = "bcm2708-i2s.0", ++ .codec_name = "pcm512x.1-004c", ++ .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | ++ SND_SOC_DAIFMT_CBS_CFS, ++ .ops = &snd_rpi_iqaudio_dac_ops, ++ .init = snd_rpi_iqaudio_dac_init, ++}, ++}; + -+ switch (format) { -+ case VC4_RENDER_CONFIG_FORMAT_BGR565_DITHERED: -+ case VC4_RENDER_CONFIG_FORMAT_BGR565: -+ cpp = 2; -+ break; -+ case VC4_RENDER_CONFIG_FORMAT_RGBA8888: -+ cpp = 4; -+ break; -+ default: -+ DRM_ERROR("Bad tile buffer format\n"); -+ return -EINVAL; -+ } ++/* audio machine driver */ ++static struct snd_soc_card snd_rpi_iqaudio_dac = { ++ .owner = THIS_MODULE, ++ .dai_link = snd_rpi_iqaudio_dac_dai, ++ .num_links = ARRAY_SIZE(snd_rpi_iqaudio_dac_dai), ++}; + -+ if (!vc4_check_tex_size(exec, *obj, surf->offset, tiling, -+ exec->args->width, exec->args->height, cpp)) { -+ return -EINVAL; -+ } ++static int snd_rpi_iqaudio_dac_probe(struct platform_device *pdev) ++{ ++ int ret = 0; + -+ return 0; -+} ++ snd_rpi_iqaudio_dac.dev = &pdev->dev; + -+int vc4_get_rcl(struct drm_device *dev, struct vc4_exec_info *exec) -+{ -+ struct vc4_rcl_setup setup = {0}; -+ struct drm_vc4_submit_cl *args = exec->args; -+ bool has_bin = args->bin_cl_size != 0; -+ int ret; ++ if (pdev->dev.of_node) { ++ struct device_node *i2s_node; ++ struct snd_soc_card *card = &snd_rpi_iqaudio_dac; ++ struct snd_soc_dai_link *dai = &snd_rpi_iqaudio_dac_dai[0]; ++ i2s_node = of_parse_phandle(pdev->dev.of_node, ++ "i2s-controller", 0); + -+ if (args->min_x_tile > args->max_x_tile || -+ args->min_y_tile > args->max_y_tile) { -+ DRM_ERROR("Bad render tile set (%d,%d)-(%d,%d)\n", -+ args->min_x_tile, args->min_y_tile, -+ args->max_x_tile, args->max_y_tile); -+ return -EINVAL; -+ } ++ if (i2s_node) { ++ dai->cpu_dai_name = NULL; ++ dai->cpu_of_node = i2s_node; ++ dai->platform_name = NULL; ++ dai->platform_of_node = i2s_node; ++ } + -+ if (has_bin && -+ (args->max_x_tile > exec->bin_tiles_x || -+ args->max_y_tile > exec->bin_tiles_y)) { -+ DRM_ERROR("Render tiles (%d,%d) outside of bin config (%d,%d)\n", -+ args->max_x_tile, args->max_y_tile, -+ exec->bin_tiles_x, exec->bin_tiles_y); -+ return -EINVAL; ++ digital_gain_0db_limit = !of_property_read_bool(pdev->dev.of_node, ++ "iqaudio,24db_digital_gain"); ++ if (of_property_read_string(pdev->dev.of_node, "card_name", ++ &card->name)) ++ card->name = "IQaudIODAC"; ++ if (of_property_read_string(pdev->dev.of_node, "dai_name", ++ &dai->name)) ++ dai->name = "IQaudIO DAC"; ++ if (of_property_read_string(pdev->dev.of_node, "dai_stream_name", ++ &dai->stream_name)) ++ dai->stream_name = "IQaudIO DAC HiFi"; + } + -+ ret = vc4_rcl_surface_setup(exec, &setup.color_read, &args->color_read); ++ ret = snd_soc_register_card(&snd_rpi_iqaudio_dac); + if (ret) -+ return ret; ++ dev_err(&pdev->dev, ++ "snd_soc_register_card() failed: %d\n", ret); + -+ ret = vc4_rcl_ms_surface_setup(exec, &setup.color_ms_write, -+ &args->color_ms_write); -+ if (ret) -+ return ret; ++ return ret; ++} + -+ ret = vc4_rcl_surface_setup(exec, &setup.zs_read, &args->zs_read); -+ if (ret) -+ return ret; ++static int snd_rpi_iqaudio_dac_remove(struct platform_device *pdev) ++{ ++ return snd_soc_unregister_card(&snd_rpi_iqaudio_dac); ++} + -+ ret = vc4_rcl_surface_setup(exec, &setup.zs_write, &args->zs_write); -+ if (ret) -+ return ret; ++static const struct of_device_id iqaudio_of_match[] = { ++ { .compatible = "iqaudio,iqaudio-dac", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, iqaudio_of_match); + -+ /* We shouldn't even have the job submitted to us if there's no -+ * surface to write out. -+ */ -+ if (!setup.color_ms_write && !setup.zs_write) { -+ DRM_ERROR("RCL requires color or Z/S write\n"); -+ return -EINVAL; -+ } ++static struct platform_driver snd_rpi_iqaudio_dac_driver = { ++ .driver = { ++ .name = "snd-rpi-iqaudio-dac", ++ .owner = THIS_MODULE, ++ .of_match_table = iqaudio_of_match, ++ }, ++ .probe = snd_rpi_iqaudio_dac_probe, ++ .remove = snd_rpi_iqaudio_dac_remove, ++}; + -+ return vc4_create_rcl_bo(dev, exec, &setup); -+} -diff --git a/drivers/gpu/drm/vc4/vc4_trace.h b/drivers/gpu/drm/vc4/vc4_trace.h ++module_platform_driver(snd_rpi_iqaudio_dac_driver); ++ ++MODULE_AUTHOR("Florian Meier <florian.meier@koalo.de>"); ++MODULE_DESCRIPTION("ASoC Driver for IQAudio DAC"); ++MODULE_LICENSE("GPL v2"); + +From 51d3e7110c3e009d1f568a280f7645d0b44592d7 Mon Sep 17 00:00:00 2001 +From: popcornmix <popcornmix@gmail.com> +Date: Mon, 14 Jul 2014 22:02:09 +0100 +Subject: [PATCH 071/112] hid: Reduce default mouse polling interval to 60Hz + +Reduces overhead when using X +--- + drivers/hid/usbhid/hid-core.c | 10 +++++++--- + 1 file changed, 7 insertions(+), 3 deletions(-) + +diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c +index ae83af6..4a7af9d 100644 +--- a/drivers/hid/usbhid/hid-core.c ++++ b/drivers/hid/usbhid/hid-core.c +@@ -49,7 +49,7 @@ + * Module parameters. + */ + +-static unsigned int hid_mousepoll_interval; ++static unsigned int hid_mousepoll_interval = ~0; + module_param_named(mousepoll, hid_mousepoll_interval, uint, 0644); + MODULE_PARM_DESC(mousepoll, "Polling interval of mice"); + +@@ -1083,8 +1083,12 @@ static int usbhid_start(struct hid_device *hid) + } + + /* Change the polling interval of mice. */ +- if (hid->collection->usage == HID_GD_MOUSE && hid_mousepoll_interval > 0) +- interval = hid_mousepoll_interval; ++ if (hid->collection->usage == HID_GD_MOUSE) { ++ if (hid_mousepoll_interval == ~0 && interval < 16) ++ interval = 16; ++ else if (hid_mousepoll_interval != ~0 && hid_mousepoll_interval != 0) ++ interval = hid_mousepoll_interval; ++ } + + ret = -ENOMEM; + if (usb_endpoint_dir_in(endpoint)) { + +From 6b4093df74895715c00c4a7f3d364ef2bc02421d Mon Sep 17 00:00:00 2001 +From: Daniel Matuschek <info@crazy-audio.com> +Date: Mon, 4 Aug 2014 10:06:56 +0200 +Subject: [PATCH 072/112] Added support for HiFiBerry DAC+ + +The driver is based on the HiFiBerry DAC driver. However HiFiBerry DAC+ uses +a different codec chip (PCM5122), therefore a new driver is necessary. + +Add support for the HiFiBerry DAC+ Pro. + +The HiFiBerry DAC+ and DAC+ Pro products both use the existing bcm sound driver with the DAC+ Pro having a special clock device driver representing the two high precision oscillators. + +An addition bug fix is included for the PCM512x codec where by the physical size of the sample frame is used in the calculation of the LRCK divisor as it was found to be wrong when using 24-bit depth sample contained in a little endian 4-byte sample frame. + +Limit PCM512x "Digital" gain to 0dB by default with HiFiBerry DAC+ + +24db_digital_gain DT param can be used to specify that PCM512x +codec "Digital" volume control should not be limited to 0dB gain, +and if specified will allow the full 24dB gain. + +Add dt param to force HiFiBerry DAC+ Pro into slave mode + +"dtoverlay=hifiberry-dacplus,slave" + +Add 'slave' param to use HiFiBerry DAC+ Pro in slave mode, +with Pi as master for bit and frame clock. + +Signed-off-by: DigitalDreamtime <clive.messer@digitaldreamtime.co.uk> +--- + drivers/clk/Makefile | 1 + + drivers/clk/clk-hifiberry-dacpro.c | 160 +++++++++++++++++ + sound/soc/bcm/Kconfig | 7 + + sound/soc/bcm/Makefile | 2 + + sound/soc/bcm/hifiberry_dacplus.c | 358 +++++++++++++++++++++++++++++++++++++ + sound/soc/codecs/pcm512x.c | 3 +- + 6 files changed, 530 insertions(+), 1 deletion(-) + create mode 100644 drivers/clk/clk-hifiberry-dacpro.c + create mode 100644 sound/soc/bcm/hifiberry_dacplus.c + +diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile +index 46869d6..a202e6f 100644 +--- a/drivers/clk/Makefile ++++ b/drivers/clk/Makefile +@@ -25,6 +25,7 @@ obj-$(CONFIG_COMMON_CLK_CS2000_CP) += clk-cs2000-cp.o + obj-$(CONFIG_ARCH_CLPS711X) += clk-clps711x.o + obj-$(CONFIG_ARCH_EFM32) += clk-efm32gg.o + obj-$(CONFIG_ARCH_HIGHBANK) += clk-highbank.o ++obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS) += clk-hifiberry-dacpro.o + obj-$(CONFIG_MACH_LOONGSON32) += clk-ls1x.o + obj-$(CONFIG_COMMON_CLK_MAX_GEN) += clk-max-gen.o + obj-$(CONFIG_COMMON_CLK_MAX77686) += clk-max77686.o +diff --git a/drivers/clk/clk-hifiberry-dacpro.c b/drivers/clk/clk-hifiberry-dacpro.c new file mode 100644 -index 0000000..ad7b1ea +index 0000000..3e35d45 --- /dev/null -+++ b/drivers/gpu/drm/vc4/vc4_trace.h -@@ -0,0 +1,63 @@ ++++ b/drivers/clk/clk-hifiberry-dacpro.c +@@ -0,0 +1,160 @@ +/* -+ * Copyright (C) 2015 Broadcom ++ * Clock Driver for HiFiBerry DAC Pro + * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 as -+ * published by the Free Software Foundation. ++ * Author: Stuart MacLean ++ * Copyright 2015 ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * version 2 as published by the Free Software Foundation. ++ * ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * General Public License for more details. + */ + -+#if !defined(_VC4_TRACE_H_) || defined(TRACE_HEADER_MULTI_READ) -+#define _VC4_TRACE_H_ -+ -+#include <linux/stringify.h> -+#include <linux/types.h> -+#include <linux/tracepoint.h> -+ -+#undef TRACE_SYSTEM -+#define TRACE_SYSTEM vc4 -+#define TRACE_INCLUDE_FILE vc4_trace -+ -+TRACE_EVENT(vc4_wait_for_seqno_begin, -+ TP_PROTO(struct drm_device *dev, uint64_t seqno, uint64_t timeout), -+ TP_ARGS(dev, seqno, timeout), -+ -+ TP_STRUCT__entry( -+ __field(u32, dev) -+ __field(u64, seqno) -+ __field(u64, timeout) -+ ), -+ -+ TP_fast_assign( -+ __entry->dev = dev->primary->index; -+ __entry->seqno = seqno; -+ __entry->timeout = timeout; -+ ), -+ -+ TP_printk("dev=%u, seqno=%llu, timeout=%llu", -+ __entry->dev, __entry->seqno, __entry->timeout) -+); -+ -+TRACE_EVENT(vc4_wait_for_seqno_end, -+ TP_PROTO(struct drm_device *dev, uint64_t seqno), -+ TP_ARGS(dev, seqno), -+ -+ TP_STRUCT__entry( -+ __field(u32, dev) -+ __field(u64, seqno) -+ ), -+ -+ TP_fast_assign( -+ __entry->dev = dev->primary->index; -+ __entry->seqno = seqno; -+ ), -+ -+ TP_printk("dev=%u, seqno=%llu", -+ __entry->dev, __entry->seqno) -+); ++#include <linux/clk-provider.h> ++#include <linux/clkdev.h> ++#include <linux/kernel.h> ++#include <linux/module.h> ++#include <linux/of.h> ++#include <linux/slab.h> ++#include <linux/platform_device.h> + -+#endif /* _VC4_TRACE_H_ */ ++/* Clock rate of CLK44EN attached to GPIO6 pin */ ++#define CLK_44EN_RATE 22579200UL ++/* Clock rate of CLK48EN attached to GPIO3 pin */ ++#define CLK_48EN_RATE 24576000UL + -+/* This part must be outside protection */ -+#undef TRACE_INCLUDE_PATH -+#define TRACE_INCLUDE_PATH . -+#include <trace/define_trace.h> -diff --git a/drivers/gpu/drm/vc4/vc4_trace_points.c b/drivers/gpu/drm/vc4/vc4_trace_points.c -new file mode 100644 -index 0000000..e6278f2 ---- /dev/null -+++ b/drivers/gpu/drm/vc4/vc4_trace_points.c -@@ -0,0 +1,14 @@ -+/* -+ * Copyright (C) 2015 Broadcom -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 as -+ * published by the Free Software Foundation. ++/** ++ * struct hifiberry_dacpro_clk - Common struct to the HiFiBerry DAC Pro ++ * @hw: clk_hw for the common clk framework ++ * @mode: 0 => CLK44EN, 1 => CLK48EN + */ ++struct clk_hifiberry_hw { ++ struct clk_hw hw; ++ uint8_t mode; ++}; + -+#include "vc4_drv.h" ++#define to_hifiberry_clk(_hw) container_of(_hw, struct clk_hifiberry_hw, hw) + -+#ifndef __CHECKER__ -+#define CREATE_TRACE_POINTS -+#include "vc4_trace.h" -+#endif -diff --git a/drivers/gpu/drm/vc4/vc4_v3d.c b/drivers/gpu/drm/vc4/vc4_v3d.c -new file mode 100644 -index 0000000..b9cb7cf ---- /dev/null -+++ b/drivers/gpu/drm/vc4/vc4_v3d.c -@@ -0,0 +1,268 @@ -+/* -+ * Copyright (c) 2014 The Linux Foundation. All rights reserved. -+ * Copyright (C) 2013 Red Hat -+ * Author: Rob Clark <robdclark@gmail.com> -+ * -+ * This program is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License version 2 as published by -+ * the Free Software Foundation. -+ * -+ * This program is distributed in the hope that it will be useful, but WITHOUT -+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -+ * more details. -+ * -+ * You should have received a copy of the GNU General Public License along with -+ * this program. If not, see <http://www.gnu.org/licenses/>. -+ */ ++static const struct of_device_id clk_hifiberry_dacpro_dt_ids[] = { ++ { .compatible = "hifiberry,dacpro-clk",}, ++ { } ++}; ++MODULE_DEVICE_TABLE(of, clk_hifiberry_dacpro_dt_ids); + -+#include "linux/component.h" -+#include "soc/bcm2835/raspberrypi-firmware.h" -+#include "vc4_drv.h" -+#include "vc4_regs.h" ++static unsigned long clk_hifiberry_dacpro_recalc_rate(struct clk_hw *hw, ++ unsigned long parent_rate) ++{ ++ return (to_hifiberry_clk(hw)->mode == 0) ? CLK_44EN_RATE : ++ CLK_48EN_RATE; ++} + -+#ifdef CONFIG_DEBUG_FS -+#define REGDEF(reg) { reg, #reg } -+static const struct { -+ uint32_t reg; -+ const char *name; -+} vc4_reg_defs[] = { -+ REGDEF(V3D_IDENT0), -+ REGDEF(V3D_IDENT1), -+ REGDEF(V3D_IDENT2), -+ REGDEF(V3D_SCRATCH), -+ REGDEF(V3D_L2CACTL), -+ REGDEF(V3D_SLCACTL), -+ REGDEF(V3D_INTCTL), -+ REGDEF(V3D_INTENA), -+ REGDEF(V3D_INTDIS), -+ REGDEF(V3D_CT0CS), -+ REGDEF(V3D_CT1CS), -+ REGDEF(V3D_CT0EA), -+ REGDEF(V3D_CT1EA), -+ REGDEF(V3D_CT0CA), -+ REGDEF(V3D_CT1CA), -+ REGDEF(V3D_CT00RA0), -+ REGDEF(V3D_CT01RA0), -+ REGDEF(V3D_CT0LC), -+ REGDEF(V3D_CT1LC), -+ REGDEF(V3D_CT0PC), -+ REGDEF(V3D_CT1PC), -+ REGDEF(V3D_PCS), -+ REGDEF(V3D_BFC), -+ REGDEF(V3D_RFC), -+ REGDEF(V3D_BPCA), -+ REGDEF(V3D_BPCS), -+ REGDEF(V3D_BPOA), -+ REGDEF(V3D_BPOS), -+ REGDEF(V3D_BXCF), -+ REGDEF(V3D_SQRSV0), -+ REGDEF(V3D_SQRSV1), -+ REGDEF(V3D_SQCNTL), -+ REGDEF(V3D_SRQPC), -+ REGDEF(V3D_SRQUA), -+ REGDEF(V3D_SRQUL), -+ REGDEF(V3D_SRQCS), -+ REGDEF(V3D_VPACNTL), -+ REGDEF(V3D_VPMBASE), -+ REGDEF(V3D_PCTRC), -+ REGDEF(V3D_PCTRE), -+ REGDEF(V3D_PCTR0), -+ REGDEF(V3D_PCTRS0), -+ REGDEF(V3D_PCTR1), -+ REGDEF(V3D_PCTRS1), -+ REGDEF(V3D_PCTR2), -+ REGDEF(V3D_PCTRS2), -+ REGDEF(V3D_PCTR3), -+ REGDEF(V3D_PCTRS3), -+ REGDEF(V3D_PCTR4), -+ REGDEF(V3D_PCTRS4), -+ REGDEF(V3D_PCTR5), -+ REGDEF(V3D_PCTRS5), -+ REGDEF(V3D_PCTR6), -+ REGDEF(V3D_PCTRS6), -+ REGDEF(V3D_PCTR7), -+ REGDEF(V3D_PCTRS7), -+ REGDEF(V3D_PCTR8), -+ REGDEF(V3D_PCTRS8), -+ REGDEF(V3D_PCTR9), -+ REGDEF(V3D_PCTRS9), -+ REGDEF(V3D_PCTR10), -+ REGDEF(V3D_PCTRS10), -+ REGDEF(V3D_PCTR11), -+ REGDEF(V3D_PCTRS11), -+ REGDEF(V3D_PCTR12), -+ REGDEF(V3D_PCTRS12), -+ REGDEF(V3D_PCTR13), -+ REGDEF(V3D_PCTRS13), -+ REGDEF(V3D_PCTR14), -+ REGDEF(V3D_PCTRS14), -+ REGDEF(V3D_PCTR15), -+ REGDEF(V3D_PCTRS15), -+ REGDEF(V3D_BGE), -+ REGDEF(V3D_FDBGO), -+ REGDEF(V3D_FDBGB), -+ REGDEF(V3D_FDBGR), -+ REGDEF(V3D_FDBGS), -+ REGDEF(V3D_ERRSTAT), -+}; -+ -+int vc4_v3d_debugfs_regs(struct seq_file *m, void *unused) -+{ -+ struct drm_info_node *node = (struct drm_info_node *) m->private; -+ struct drm_device *dev = node->minor->dev; -+ struct vc4_dev *vc4 = to_vc4_dev(dev); -+ int i; ++static long clk_hifiberry_dacpro_round_rate(struct clk_hw *hw, ++ unsigned long rate, unsigned long *parent_rate) ++{ ++ long actual_rate; ++ ++ if (rate <= CLK_44EN_RATE) { ++ actual_rate = (long)CLK_44EN_RATE; ++ } else if (rate >= CLK_48EN_RATE) { ++ actual_rate = (long)CLK_48EN_RATE; ++ } else { ++ long diff44Rate = (long)(rate - CLK_44EN_RATE); ++ long diff48Rate = (long)(CLK_48EN_RATE - rate); + -+ for (i = 0; i < ARRAY_SIZE(vc4_reg_defs); i++) { -+ seq_printf(m, "%s (0x%04x): 0x%08x\n", -+ vc4_reg_defs[i].name, vc4_reg_defs[i].reg, -+ V3D_READ(vc4_reg_defs[i].reg)); ++ if (diff44Rate < diff48Rate) ++ actual_rate = (long)CLK_44EN_RATE; ++ else ++ actual_rate = (long)CLK_48EN_RATE; + } -+ -+ return 0; ++ return actual_rate; +} + -+int vc4_v3d_debugfs_ident(struct seq_file *m, void *unused) -+{ -+ struct drm_info_node *node = (struct drm_info_node *) m->private; -+ struct drm_device *dev = node->minor->dev; -+ struct vc4_dev *vc4 = to_vc4_dev(dev); -+ uint32_t ident1 = V3D_READ(V3D_IDENT1); -+ uint32_t nslc = VC4_GET_FIELD(ident1, V3D_IDENT1_NSLC); -+ uint32_t tups = VC4_GET_FIELD(ident1, V3D_IDENT1_TUPS); -+ uint32_t qups = VC4_GET_FIELD(ident1, V3D_IDENT1_QUPS); -+ -+ seq_printf(m, "Revision: %d\n", VC4_GET_FIELD(ident1, V3D_IDENT1_REV)); -+ seq_printf(m, "Slices: %d\n", nslc); -+ seq_printf(m, "TMUs: %d\n", nslc * tups); -+ seq_printf(m, "QPUs: %d\n", nslc * qups); -+ seq_printf(m, "Semaphores: %d\n", VC4_GET_FIELD(ident1, V3D_IDENT1_NSEM)); -+ -+ return 0; -+} -+#endif /* CONFIG_DEBUG_FS */ + -+/* -+ * Asks the firmware to turn on power to the V3D engine. -+ * -+ * This may be doable with just the clocks interface, though this -+ * packet does some other register setup from the firmware, too. -+ */ -+int -+vc4_v3d_set_power(struct vc4_dev *vc4, bool on) ++static int clk_hifiberry_dacpro_set_rate(struct clk_hw *hw, ++ unsigned long rate, unsigned long parent_rate) +{ -+ u32 packet = on; ++ unsigned long actual_rate; ++ struct clk_hifiberry_hw *clk = to_hifiberry_clk(hw); + -+ return rpi_firmware_property(vc4->firmware, -+ RPI_FIRMWARE_SET_ENABLE_QPU, -+ &packet, sizeof(packet)); ++ actual_rate = (unsigned long)clk_hifiberry_dacpro_round_rate(hw, rate, ++ &parent_rate); ++ clk->mode = (actual_rate == CLK_44EN_RATE) ? 0 : 1; ++ return 0; +} + -+static void vc4_v3d_init_hw(struct drm_device *dev) -+{ -+ struct vc4_dev *vc4 = to_vc4_dev(dev); + -+ /* Take all the memory that would have been reserved for user -+ * QPU programs, since we don't have an interface for running -+ * them, anyway. -+ */ -+ V3D_WRITE(V3D_VPMBASE, 0); -+} ++const struct clk_ops clk_hifiberry_dacpro_rate_ops = { ++ .recalc_rate = clk_hifiberry_dacpro_recalc_rate, ++ .round_rate = clk_hifiberry_dacpro_round_rate, ++ .set_rate = clk_hifiberry_dacpro_set_rate, ++}; + -+static int vc4_v3d_bind(struct device *dev, struct device *master, void *data) ++static int clk_hifiberry_dacpro_probe(struct platform_device *pdev) +{ -+ struct platform_device *pdev = to_platform_device(dev); -+ struct drm_device *drm = dev_get_drvdata(master); -+ struct vc4_dev *vc4 = to_vc4_dev(drm); -+ struct vc4_v3d *v3d = NULL; + int ret; ++ struct clk_hifiberry_hw *proclk; ++ struct clk *clk; ++ struct device *dev; ++ struct clk_init_data init; + -+ v3d = devm_kzalloc(&pdev->dev, sizeof(*v3d), GFP_KERNEL); -+ if (!v3d) -+ return -ENOMEM; -+ -+ v3d->pdev = pdev; -+ -+ v3d->regs = vc4_ioremap_regs(pdev, 0); -+ if (IS_ERR(v3d->regs)) -+ return PTR_ERR(v3d->regs); -+ -+ vc4->v3d = v3d; -+ -+ ret = vc4_v3d_set_power(vc4, true); -+ if (ret) -+ return ret; ++ dev = &pdev->dev; + -+ if (V3D_READ(V3D_IDENT0) != V3D_EXPECTED_IDENT0) { -+ DRM_ERROR("V3D_IDENT0 read 0x%08x instead of 0x%08x\n", -+ V3D_READ(V3D_IDENT0), V3D_EXPECTED_IDENT0); -+ return -EINVAL; -+ } ++ proclk = kzalloc(sizeof(struct clk_hifiberry_hw), GFP_KERNEL); ++ if (!proclk) ++ return -ENOMEM; + -+ /* Reset the binner overflow address/size at setup, to be sure -+ * we don't reuse an old one. -+ */ -+ V3D_WRITE(V3D_BPOA, 0); -+ V3D_WRITE(V3D_BPOS, 0); ++ init.name = "clk-hifiberry-dacpro"; ++ init.ops = &clk_hifiberry_dacpro_rate_ops; ++ init.flags = CLK_IS_ROOT | CLK_IS_BASIC; ++ init.parent_names = NULL; ++ init.num_parents = 0; + -+ vc4_v3d_init_hw(drm); ++ proclk->mode = 0; ++ proclk->hw.init = &init; + -+ ret = drm_irq_install(drm, platform_get_irq(pdev, 0)); -+ if (ret) { -+ DRM_ERROR("Failed to install IRQ handler\n"); -+ return ret; ++ clk = devm_clk_register(dev, &proclk->hw); ++ if (!IS_ERR(clk)) { ++ ret = of_clk_add_provider(dev->of_node, of_clk_src_simple_get, ++ clk); ++ } else { ++ dev_err(dev, "Fail to register clock driver\n"); ++ kfree(proclk); ++ ret = PTR_ERR(clk); + } -+ -+ return 0; ++ return ret; +} + -+static void vc4_v3d_unbind(struct device *dev, struct device *master, -+ void *data) ++static int clk_hifiberry_dacpro_remove(struct platform_device *pdev) +{ -+ struct drm_device *drm = dev_get_drvdata(master); -+ struct vc4_dev *vc4 = to_vc4_dev(drm); -+ -+ drm_irq_uninstall(drm); -+ -+ /* Disable the binner's overflow memory address, so the next -+ * driver probe (if any) doesn't try to reuse our old -+ * allocation. -+ */ -+ V3D_WRITE(V3D_BPOA, 0); -+ V3D_WRITE(V3D_BPOS, 0); -+ -+ vc4_v3d_set_power(vc4, false); -+ -+ vc4->v3d = NULL; ++ of_clk_del_provider(pdev->dev.of_node); ++ return 0; +} + -+static const struct component_ops vc4_v3d_ops = { -+ .bind = vc4_v3d_bind, -+ .unbind = vc4_v3d_unbind, ++static struct platform_driver clk_hifiberry_dacpro_driver = { ++ .probe = clk_hifiberry_dacpro_probe, ++ .remove = clk_hifiberry_dacpro_remove, ++ .driver = { ++ .name = "clk-hifiberry-dacpro", ++ .of_match_table = clk_hifiberry_dacpro_dt_ids, ++ }, +}; + -+static int vc4_v3d_dev_probe(struct platform_device *pdev) ++static int __init clk_hifiberry_dacpro_init(void) +{ -+ return component_add(&pdev->dev, &vc4_v3d_ops); ++ return platform_driver_register(&clk_hifiberry_dacpro_driver); +} ++core_initcall(clk_hifiberry_dacpro_init); + -+static int vc4_v3d_dev_remove(struct platform_device *pdev) ++static void __exit clk_hifiberry_dacpro_exit(void) +{ -+ component_del(&pdev->dev, &vc4_v3d_ops); -+ return 0; ++ platform_driver_unregister(&clk_hifiberry_dacpro_driver); +} ++module_exit(clk_hifiberry_dacpro_exit); + -+static const struct of_device_id vc4_v3d_dt_match[] = { -+ { .compatible = "brcm,vc4-v3d" }, -+ {} -+}; ++MODULE_DESCRIPTION("HiFiBerry DAC Pro clock driver"); ++MODULE_LICENSE("GPL v2"); ++MODULE_ALIAS("platform:clk-hifiberry-dacpro"); +diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig +index 38dcdd9..8c338b5 100644 +--- a/sound/soc/bcm/Kconfig ++++ b/sound/soc/bcm/Kconfig +@@ -15,6 +15,13 @@ config SND_BCM2708_SOC_HIFIBERRY_DAC + help + Say Y or M if you want to add support for HifiBerry DAC. + ++config SND_BCM2708_SOC_HIFIBERRY_DACPLUS ++ tristate "Support for HifiBerry DAC+" ++ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S ++ select SND_SOC_PCM512x ++ help ++ Say Y or M if you want to add support for HifiBerry DAC+. + -+struct platform_driver vc4_v3d_driver = { -+ .probe = vc4_v3d_dev_probe, -+ .remove = vc4_v3d_dev_remove, -+ .driver = { -+ .name = "vc4_v3d", -+ .of_match_table = vc4_v3d_dt_match, -+ }, -+}; -diff --git a/drivers/gpu/drm/vc4/vc4_validate.c b/drivers/gpu/drm/vc4/vc4_validate.c + config SND_BCM2708_SOC_HIFIBERRY_DIGI + tristate "Support for HifiBerry Digi" + depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S +diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile +index 08e4dc5..a29538e 100644 +--- a/sound/soc/bcm/Makefile ++++ b/sound/soc/bcm/Makefile +@@ -5,11 +5,13 @@ obj-$(CONFIG_SND_BCM2835_SOC_I2S) += snd-soc-bcm2835-i2s.o + + # BCM2708 Machine Support + snd-soc-hifiberry-dac-objs := hifiberry_dac.o ++snd-soc-hifiberry-dacplus-objs := hifiberry_dacplus.o + snd-soc-hifiberry-digi-objs := hifiberry_digi.o + snd-soc-rpi-dac-objs := rpi-dac.o + snd-soc-iqaudio-dac-objs := iqaudio-dac.o + + obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o ++obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS) += snd-soc-hifiberry-dacplus.o + obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI) += snd-soc-hifiberry-digi.o + obj-$(CONFIG_SND_BCM2708_SOC_RPI_DAC) += snd-soc-rpi-dac.o + obj-$(CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC) += snd-soc-iqaudio-dac.o +diff --git a/sound/soc/bcm/hifiberry_dacplus.c b/sound/soc/bcm/hifiberry_dacplus.c new file mode 100644 -index 0000000..ff3b62f +index 0000000..6560067 --- /dev/null -+++ b/drivers/gpu/drm/vc4/vc4_validate.c -@@ -0,0 +1,958 @@ ++++ b/sound/soc/bcm/hifiberry_dacplus.c +@@ -0,0 +1,358 @@ +/* -+ * Copyright © 2014 Broadcom ++ * ASoC Driver for HiFiBerry DAC+ / DAC Pro + * -+ * Permission is hereby granted, free of charge, to any person obtaining a -+ * copy of this software and associated documentation files (the "Software"), -+ * to deal in the Software without restriction, including without limitation -+ * the rights to use, copy, modify, merge, publish, distribute, sublicense, -+ * and/or sell copies of the Software, and to permit persons to whom the -+ * Software is furnished to do so, subject to the following conditions: ++ * Author: Daniel Matuschek, Stuart MacLean <stuart@hifiberry.com> ++ * Copyright 2014-2015 ++ * based on code by Florian Meier <florian.meier@koalo.de> + * -+ * The above copyright notice and this permission notice (including the next -+ * paragraph) shall be included in all copies or substantial portions of the -+ * Software. ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * version 2 as published by the Free Software Foundation. + * -+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -+ * IN THE SOFTWARE. ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * General Public License for more details. + */ + -+/** -+ * Command list validator for VC4. -+ * -+ * The VC4 has no IOMMU between it and system memory. So, a user with -+ * access to execute command lists could escalate privilege by -+ * overwriting system memory (drawing to it as a framebuffer) or -+ * reading system memory it shouldn't (reading it as a texture, or -+ * uniform data, or vertex data). -+ * -+ * This validates command lists to ensure that all accesses are within -+ * the bounds of the GEM objects referenced. It explicitly whitelists -+ * packets, and looks at the offsets in any address fields to make -+ * sure they're constrained within the BOs they reference. -+ * -+ * Note that because of the validation that's happening anyway, this -+ * is where GEM relocation processing happens. -+ */ ++#include <linux/module.h> ++#include <linux/platform_device.h> ++#include <linux/kernel.h> ++#include <linux/clk.h> ++#include <linux/kernel.h> ++#include <linux/module.h> ++#include <linux/of.h> ++#include <linux/slab.h> ++#include <linux/delay.h> ++ ++#include <sound/core.h> ++#include <sound/pcm.h> ++#include <sound/pcm_params.h> ++#include <sound/soc.h> ++#include <sound/jack.h> + -+#include "uapi/drm/vc4_drm.h" -+#include "vc4_drv.h" -+#include "vc4_packet.h" ++#include "../codecs/pcm512x.h" + -+#define VALIDATE_ARGS \ -+ struct vc4_exec_info *exec, \ -+ void *validated, \ -+ void *untrusted ++#define HIFIBERRY_DACPRO_NOCLOCK 0 ++#define HIFIBERRY_DACPRO_CLK44EN 1 ++#define HIFIBERRY_DACPRO_CLK48EN 2 + ++struct pcm512x_priv { ++ struct regmap *regmap; ++ struct clk *sclk; ++}; + -+/** Return the width in pixels of a 64-byte microtile. */ -+static uint32_t -+utile_width(int cpp) -+{ -+ switch (cpp) { -+ case 1: -+ case 2: -+ return 8; -+ case 4: -+ return 4; -+ case 8: -+ return 2; -+ default: -+ DRM_ERROR("unknown cpp: %d\n", cpp); -+ return 1; -+ } -+} ++/* Clock rate of CLK44EN attached to GPIO6 pin */ ++#define CLK_44EN_RATE 22579200UL ++/* Clock rate of CLK48EN attached to GPIO3 pin */ ++#define CLK_48EN_RATE 24576000UL ++ ++static bool slave; ++static bool snd_rpi_hifiberry_is_dacpro; ++static bool digital_gain_0db_limit = true; + -+/** Return the height in pixels of a 64-byte microtile. */ -+static uint32_t -+utile_height(int cpp) ++static void snd_rpi_hifiberry_dacplus_select_clk(struct snd_soc_codec *codec, ++ int clk_id) +{ -+ switch (cpp) { -+ case 1: -+ return 8; -+ case 2: -+ case 4: -+ case 8: -+ return 4; -+ default: -+ DRM_ERROR("unknown cpp: %d\n", cpp); -+ return 1; ++ switch (clk_id) { ++ case HIFIBERRY_DACPRO_NOCLOCK: ++ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x24, 0x00); ++ break; ++ case HIFIBERRY_DACPRO_CLK44EN: ++ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x24, 0x20); ++ break; ++ case HIFIBERRY_DACPRO_CLK48EN: ++ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x24, 0x04); ++ break; + } +} + -+/** -+ * The texture unit decides what tiling format a particular miplevel is using -+ * this function, so we lay out our miptrees accordingly. -+ */ -+static bool -+size_is_lt(uint32_t width, uint32_t height, int cpp) ++static void snd_rpi_hifiberry_dacplus_clk_gpio(struct snd_soc_codec *codec) +{ -+ return (width <= 4 * utile_width(cpp) || -+ height <= 4 * utile_height(cpp)); ++ snd_soc_update_bits(codec, PCM512x_GPIO_EN, 0x24, 0x24); ++ snd_soc_update_bits(codec, PCM512x_GPIO_OUTPUT_3, 0x0f, 0x02); ++ snd_soc_update_bits(codec, PCM512x_GPIO_OUTPUT_6, 0x0f, 0x02); +} + -+bool -+vc4_use_bo(struct vc4_exec_info *exec, -+ uint32_t hindex, -+ enum vc4_bo_mode mode, -+ struct drm_gem_cma_object **obj) ++static bool snd_rpi_hifiberry_dacplus_is_sclk(struct snd_soc_codec *codec) +{ -+ *obj = NULL; -+ -+ if (hindex >= exec->bo_count) { -+ DRM_ERROR("BO index %d greater than BO count %d\n", -+ hindex, exec->bo_count); -+ return false; -+ } -+ -+ if (exec->bo[hindex].mode != mode) { -+ if (exec->bo[hindex].mode == VC4_MODE_UNDECIDED) { -+ exec->bo[hindex].mode = mode; -+ } else { -+ DRM_ERROR("BO index %d reused with mode %d vs %d\n", -+ hindex, exec->bo[hindex].mode, mode); -+ return false; -+ } -+ } ++ int sck; + -+ *obj = exec->bo[hindex].bo; -+ return true; ++ sck = snd_soc_read(codec, PCM512x_RATE_DET_4); ++ return (!(sck & 0x40)); +} + -+static bool -+vc4_use_handle(struct vc4_exec_info *exec, -+ uint32_t gem_handles_packet_index, -+ enum vc4_bo_mode mode, -+ struct drm_gem_cma_object **obj) ++static bool snd_rpi_hifiberry_dacplus_is_sclk_sleep( ++ struct snd_soc_codec *codec) +{ -+ return vc4_use_bo(exec, exec->bo_index[gem_handles_packet_index], -+ mode, obj); ++ msleep(2); ++ return snd_rpi_hifiberry_dacplus_is_sclk(codec); +} + -+static uint32_t -+gl_shader_rec_size(uint32_t pointer_bits) ++static bool snd_rpi_hifiberry_dacplus_is_pro_card(struct snd_soc_codec *codec) +{ -+ uint32_t attribute_count = pointer_bits & 7; -+ bool extended = pointer_bits & 8; ++ bool isClk44EN, isClk48En, isNoClk; + -+ if (attribute_count == 0) -+ attribute_count = 8; ++ snd_rpi_hifiberry_dacplus_clk_gpio(codec); + -+ if (extended) -+ return 100 + attribute_count * 4; -+ else -+ return 36 + attribute_count * 8; ++ snd_rpi_hifiberry_dacplus_select_clk(codec, HIFIBERRY_DACPRO_CLK44EN); ++ isClk44EN = snd_rpi_hifiberry_dacplus_is_sclk_sleep(codec); ++ ++ snd_rpi_hifiberry_dacplus_select_clk(codec, HIFIBERRY_DACPRO_NOCLOCK); ++ isNoClk = snd_rpi_hifiberry_dacplus_is_sclk_sleep(codec); ++ ++ snd_rpi_hifiberry_dacplus_select_clk(codec, HIFIBERRY_DACPRO_CLK48EN); ++ isClk48En = snd_rpi_hifiberry_dacplus_is_sclk_sleep(codec); ++ ++ return (isClk44EN && isClk48En && !isNoClk); +} + -+bool -+vc4_check_tex_size(struct vc4_exec_info *exec, struct drm_gem_cma_object *fbo, -+ uint32_t offset, uint8_t tiling_format, -+ uint32_t width, uint32_t height, uint8_t cpp) ++static int snd_rpi_hifiberry_dacplus_clk_for_rate(int sample_rate) +{ -+ uint32_t aligned_width, aligned_height, stride, size; -+ uint32_t utile_w = utile_width(cpp); -+ uint32_t utile_h = utile_height(cpp); -+ -+ /* The shaded vertex format stores signed 12.4 fixed point -+ * (-2048,2047) offsets from the viewport center, so we should -+ * never have a render target larger than 4096. The texture -+ * unit can only sample from 2048x2048, so it's even more -+ * restricted. This lets us avoid worrying about overflow in -+ * our math. -+ */ -+ if (width > 4096 || height > 4096) { -+ DRM_ERROR("Surface dimesions (%d,%d) too large", width, height); -+ return false; -+ } ++ int type; + -+ switch (tiling_format) { -+ case VC4_TILING_FORMAT_LINEAR: -+ aligned_width = round_up(width, utile_w); -+ aligned_height = height; -+ break; -+ case VC4_TILING_FORMAT_T: -+ aligned_width = round_up(width, utile_w * 8); -+ aligned_height = round_up(height, utile_h * 8); -+ break; -+ case VC4_TILING_FORMAT_LT: -+ aligned_width = round_up(width, utile_w); -+ aligned_height = round_up(height, utile_h); ++ switch (sample_rate) { ++ case 11025: ++ case 22050: ++ case 44100: ++ case 88200: ++ case 176400: ++ type = HIFIBERRY_DACPRO_CLK44EN; + break; + default: -+ DRM_ERROR("buffer tiling %d unsupported\n", tiling_format); -+ return false; -+ } -+ -+ stride = aligned_width * cpp; -+ size = stride * aligned_height; -+ -+ if (size + offset < size || -+ size + offset > fbo->base.size) { -+ DRM_ERROR("Overflow in %dx%d (%dx%d) fbo size (%d + %d > %d)\n", -+ width, height, -+ aligned_width, aligned_height, -+ size, offset, fbo->base.size); -+ return false; ++ type = HIFIBERRY_DACPRO_CLK48EN; ++ break; + } -+ -+ return true; ++ return type; +} + -+static int -+validate_flush_all(VALIDATE_ARGS) ++static void snd_rpi_hifiberry_dacplus_set_sclk(struct snd_soc_codec *codec, ++ int sample_rate) +{ -+ if (exec->found_increment_semaphore_packet) { -+ DRM_ERROR("VC4_PACKET_FLUSH_ALL after " -+ "VC4_PACKET_INCREMENT_SEMAPHORE\n"); -+ return -EINVAL; -+ } -+ -+ return 0; -+} ++ struct pcm512x_priv *pcm512x = snd_soc_codec_get_drvdata(codec); + -+static int -+validate_start_tile_binning(VALIDATE_ARGS) -+{ -+ if (exec->found_start_tile_binning_packet) { -+ DRM_ERROR("Duplicate VC4_PACKET_START_TILE_BINNING\n"); -+ return -EINVAL; -+ } -+ exec->found_start_tile_binning_packet = true; ++ if (!IS_ERR(pcm512x->sclk)) { ++ int ctype; + -+ if (!exec->found_tile_binning_mode_config_packet) { -+ DRM_ERROR("missing VC4_PACKET_TILE_BINNING_MODE_CONFIG\n"); -+ return -EINVAL; ++ ctype = snd_rpi_hifiberry_dacplus_clk_for_rate(sample_rate); ++ clk_set_rate(pcm512x->sclk, (ctype == HIFIBERRY_DACPRO_CLK44EN) ++ ? CLK_44EN_RATE : CLK_48EN_RATE); ++ snd_rpi_hifiberry_dacplus_select_clk(codec, ctype); + } -+ -+ return 0; +} + -+static int -+validate_increment_semaphore(VALIDATE_ARGS) ++static int snd_rpi_hifiberry_dacplus_init(struct snd_soc_pcm_runtime *rtd) +{ -+ if (exec->found_increment_semaphore_packet) { -+ DRM_ERROR("Duplicate VC4_PACKET_INCREMENT_SEMAPHORE\n"); -+ return -EINVAL; -+ } -+ exec->found_increment_semaphore_packet = true; -+ -+ /* Once we've found the semaphore increment, there should be one FLUSH -+ * then the end of the command list. The FLUSH actually triggers the -+ * increment, so we only need to make sure there -+ */ ++ struct snd_soc_codec *codec = rtd->codec; ++ struct pcm512x_priv *priv; + -+ return 0; -+} ++ if (slave) ++ snd_rpi_hifiberry_is_dacpro = false; ++ else ++ snd_rpi_hifiberry_is_dacpro = ++ snd_rpi_hifiberry_dacplus_is_pro_card(codec); + -+static int -+validate_indexed_prim_list(VALIDATE_ARGS) -+{ -+ struct drm_gem_cma_object *ib; -+ uint32_t length = *(uint32_t *)(untrusted + 1); -+ uint32_t offset = *(uint32_t *)(untrusted + 5); -+ uint32_t max_index = *(uint32_t *)(untrusted + 9); -+ uint32_t index_size = (*(uint8_t *)(untrusted + 0) >> 4) ? 2 : 1; -+ struct vc4_shader_state *shader_state; ++ if (snd_rpi_hifiberry_is_dacpro) { ++ struct snd_soc_dai_link *dai = rtd->dai_link; + -+ if (exec->found_increment_semaphore_packet) { -+ DRM_ERROR("Drawing after VC4_PACKET_INCREMENT_SEMAPHORE\n"); -+ return -EINVAL; -+ } ++ dai->name = "HiFiBerry DAC+ Pro"; ++ dai->stream_name = "HiFiBerry DAC+ Pro HiFi"; ++ dai->dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF ++ | SND_SOC_DAIFMT_CBM_CFM; + -+ /* Check overflow condition */ -+ if (exec->shader_state_count == 0) { -+ DRM_ERROR("shader state must precede primitives\n"); -+ return -EINVAL; ++ snd_soc_update_bits(codec, PCM512x_BCLK_LRCLK_CFG, 0x31, 0x11); ++ snd_soc_update_bits(codec, PCM512x_MASTER_MODE, 0x03, 0x03); ++ snd_soc_update_bits(codec, PCM512x_MASTER_CLKDIV_2, 0x7f, 63); ++ } else { ++ priv = snd_soc_codec_get_drvdata(codec); ++ priv->sclk = ERR_PTR(-ENOENT); + } -+ shader_state = &exec->shader_state[exec->shader_state_count - 1]; + -+ if (max_index > shader_state->max_index) -+ shader_state->max_index = max_index; ++ snd_soc_update_bits(codec, PCM512x_GPIO_EN, 0x08, 0x08); ++ snd_soc_update_bits(codec, PCM512x_GPIO_OUTPUT_4, 0x0f, 0x02); ++ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x08, 0x08); + -+ if (!vc4_use_handle(exec, 0, VC4_MODE_RENDER, &ib)) -+ return -EINVAL; ++ if (digital_gain_0db_limit) ++ { ++ int ret; ++ struct snd_soc_card *card = rtd->card; + -+ if (offset > ib->base.size || -+ (ib->base.size - offset) / index_size < length) { -+ DRM_ERROR("IB access overflow (%d + %d*%d > %d)\n", -+ offset, length, index_size, ib->base.size); -+ return -EINVAL; ++ ret = snd_soc_limit_volume(card, "Digital Playback Volume", 207); ++ if (ret < 0) ++ dev_warn(card->dev, "Failed to set volume limit: %d\n", ret); + } + -+ *(uint32_t *)(validated + 5) = ib->paddr + offset; -+ + return 0; +} + -+static int -+validate_gl_array_primitive(VALIDATE_ARGS) ++static int snd_rpi_hifiberry_dacplus_update_rate_den( ++ struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params) +{ -+ uint32_t length = *(uint32_t *)(untrusted + 1); -+ uint32_t base_index = *(uint32_t *)(untrusted + 5); -+ uint32_t max_index; -+ struct vc4_shader_state *shader_state; ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_codec *codec = rtd->codec; ++ struct pcm512x_priv *pcm512x = snd_soc_codec_get_drvdata(codec); ++ struct snd_ratnum *rats_no_pll; ++ unsigned int num = 0, den = 0; ++ int err; + -+ if (exec->found_increment_semaphore_packet) { -+ DRM_ERROR("Drawing after VC4_PACKET_INCREMENT_SEMAPHORE\n"); -+ return -EINVAL; -+ } ++ rats_no_pll = devm_kzalloc(rtd->dev, sizeof(*rats_no_pll), GFP_KERNEL); ++ if (!rats_no_pll) ++ return -ENOMEM; + -+ /* Check overflow condition */ -+ if (exec->shader_state_count == 0) { -+ DRM_ERROR("shader state must precede primitives\n"); -+ return -EINVAL; -+ } -+ shader_state = &exec->shader_state[exec->shader_state_count - 1]; ++ rats_no_pll->num = clk_get_rate(pcm512x->sclk) / 64; ++ rats_no_pll->den_min = 1; ++ rats_no_pll->den_max = 128; ++ rats_no_pll->den_step = 1; + -+ if (length + base_index < length) { -+ DRM_ERROR("primitive vertex count overflow\n"); -+ return -EINVAL; ++ err = snd_interval_ratnum(hw_param_interval(params, ++ SNDRV_PCM_HW_PARAM_RATE), 1, rats_no_pll, &num, &den); ++ if (err >= 0 && den) { ++ params->rate_num = num; ++ params->rate_den = den; + } -+ max_index = length + base_index - 1; -+ -+ if (max_index > shader_state->max_index) -+ shader_state->max_index = max_index; + ++ devm_kfree(rtd->dev, rats_no_pll); + return 0; +} + -+static int -+validate_gl_shader_state(VALIDATE_ARGS) ++static int snd_rpi_hifiberry_dacplus_set_bclk_ratio_pro( ++ struct snd_soc_dai *cpu_dai, struct snd_pcm_hw_params *params) +{ -+ uint32_t i = exec->shader_state_count++; ++ int bratio = snd_pcm_format_physical_width(params_format(params)) ++ * params_channels(params); ++ return snd_soc_dai_set_bclk_ratio(cpu_dai, bratio); ++} + -+ if (i >= exec->shader_state_size) { -+ DRM_ERROR("More requests for shader states than declared\n"); -+ return -EINVAL; -+ } ++static int snd_rpi_hifiberry_dacplus_hw_params( ++ struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params) ++{ ++ int ret; ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; + -+ exec->shader_state[i].packet = VC4_PACKET_GL_SHADER_STATE; -+ exec->shader_state[i].addr = *(uint32_t *)untrusted; -+ exec->shader_state[i].max_index = 0; ++ if (snd_rpi_hifiberry_is_dacpro) { ++ struct snd_soc_codec *codec = rtd->codec; + -+ if (exec->shader_state[i].addr & ~0xf) { -+ DRM_ERROR("high bits set in GL shader rec reference\n"); -+ return -EINVAL; -+ } ++ snd_rpi_hifiberry_dacplus_set_sclk(codec, ++ params_rate(params)); + -+ *(uint32_t *)validated = (exec->shader_rec_p + -+ exec->shader_state[i].addr); ++ ret = snd_rpi_hifiberry_dacplus_set_bclk_ratio_pro(cpu_dai, ++ params); ++ if (!ret) ++ ret = snd_rpi_hifiberry_dacplus_update_rate_den( ++ substream, params); ++ } else { ++ ret = snd_soc_dai_set_bclk_ratio(cpu_dai, 64); ++ } ++ return ret; ++} + -+ exec->shader_rec_p += -+ roundup(gl_shader_rec_size(exec->shader_state[i].addr), 16); ++static int snd_rpi_hifiberry_dacplus_startup( ++ struct snd_pcm_substream *substream) ++{ ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_codec *codec = rtd->codec; + ++ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x08, 0x08); + return 0; +} + -+static int -+validate_nv_shader_state(VALIDATE_ARGS) ++static void snd_rpi_hifiberry_dacplus_shutdown( ++ struct snd_pcm_substream *substream) +{ -+ uint32_t i = exec->shader_state_count++; -+ -+ if (i >= exec->shader_state_size) { -+ DRM_ERROR("More requests for shader states than declared\n"); -+ return -EINVAL; -+ } ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_codec *codec = rtd->codec; + -+ exec->shader_state[i].packet = VC4_PACKET_NV_SHADER_STATE; -+ exec->shader_state[i].addr = *(uint32_t *)untrusted; ++ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x08, 0x00); ++} + -+ if (exec->shader_state[i].addr & 15) { -+ DRM_ERROR("NV shader state address 0x%08x misaligned\n", -+ exec->shader_state[i].addr); -+ return -EINVAL; -+ } ++/* machine stream operations */ ++static struct snd_soc_ops snd_rpi_hifiberry_dacplus_ops = { ++ .hw_params = snd_rpi_hifiberry_dacplus_hw_params, ++ .startup = snd_rpi_hifiberry_dacplus_startup, ++ .shutdown = snd_rpi_hifiberry_dacplus_shutdown, ++}; + -+ *(uint32_t *)validated = (exec->shader_state[i].addr + -+ exec->shader_rec_p); ++static struct snd_soc_dai_link snd_rpi_hifiberry_dacplus_dai[] = { ++{ ++ .name = "HiFiBerry DAC+", ++ .stream_name = "HiFiBerry DAC+ HiFi", ++ .cpu_dai_name = "bcm2708-i2s.0", ++ .codec_dai_name = "pcm512x-hifi", ++ .platform_name = "bcm2708-i2s.0", ++ .codec_name = "pcm512x.1-004d", ++ .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | ++ SND_SOC_DAIFMT_CBS_CFS, ++ .ops = &snd_rpi_hifiberry_dacplus_ops, ++ .init = snd_rpi_hifiberry_dacplus_init, ++}, ++}; + -+ return 0; -+} ++/* audio machine driver */ ++static struct snd_soc_card snd_rpi_hifiberry_dacplus = { ++ .name = "snd_rpi_hifiberry_dacplus", ++ .owner = THIS_MODULE, ++ .dai_link = snd_rpi_hifiberry_dacplus_dai, ++ .num_links = ARRAY_SIZE(snd_rpi_hifiberry_dacplus_dai), ++}; + -+static int -+validate_tile_binning_config(VALIDATE_ARGS) ++static int snd_rpi_hifiberry_dacplus_probe(struct platform_device *pdev) +{ -+ struct drm_device *dev = exec->exec_bo->base.dev; -+ uint8_t flags; -+ uint32_t tile_state_size, tile_alloc_size; -+ uint32_t tile_count; ++ int ret = 0; + -+ if (exec->found_tile_binning_mode_config_packet) { -+ DRM_ERROR("Duplicate VC4_PACKET_TILE_BINNING_MODE_CONFIG\n"); -+ return -EINVAL; -+ } -+ exec->found_tile_binning_mode_config_packet = true; ++ snd_rpi_hifiberry_dacplus.dev = &pdev->dev; ++ if (pdev->dev.of_node) { ++ struct device_node *i2s_node; ++ struct snd_soc_dai_link *dai; + -+ exec->bin_tiles_x = *(uint8_t *)(untrusted + 12); -+ exec->bin_tiles_y = *(uint8_t *)(untrusted + 13); -+ tile_count = exec->bin_tiles_x * exec->bin_tiles_y; -+ flags = *(uint8_t *)(untrusted + 14); ++ dai = &snd_rpi_hifiberry_dacplus_dai[0]; ++ i2s_node = of_parse_phandle(pdev->dev.of_node, ++ "i2s-controller", 0); + -+ if (exec->bin_tiles_x == 0 || -+ exec->bin_tiles_y == 0) { -+ DRM_ERROR("Tile binning config of %dx%d too small\n", -+ exec->bin_tiles_x, exec->bin_tiles_y); -+ return -EINVAL; -+ } ++ if (i2s_node) { ++ dai->cpu_dai_name = NULL; ++ dai->cpu_of_node = i2s_node; ++ dai->platform_name = NULL; ++ dai->platform_of_node = i2s_node; ++ } + -+ if (flags & (VC4_BIN_CONFIG_DB_NON_MS | -+ VC4_BIN_CONFIG_TILE_BUFFER_64BIT | -+ VC4_BIN_CONFIG_MS_MODE_4X)) { -+ DRM_ERROR("unsupported bining config flags 0x%02x\n", flags); -+ return -EINVAL; ++ digital_gain_0db_limit = !of_property_read_bool( ++ pdev->dev.of_node, "hifiberry,24db_digital_gain"); ++ slave = of_property_read_bool(pdev->dev.of_node, ++ "hifiberry-dacplus,slave"); + } + -+ /* The tile state data array is 48 bytes per tile, and we put it at -+ * the start of a BO containing both it and the tile alloc. -+ */ -+ tile_state_size = 48 * tile_count; ++ ret = snd_soc_register_card(&snd_rpi_hifiberry_dacplus); ++ if (ret) ++ dev_err(&pdev->dev, ++ "snd_soc_register_card() failed: %d\n", ret); + -+ /* Since the tile alloc array will follow us, align. */ -+ exec->tile_alloc_offset = roundup(tile_state_size, 4096); ++ return ret; ++} + -+ *(uint8_t *)(validated + 14) = -+ ((flags & ~(VC4_BIN_CONFIG_ALLOC_INIT_BLOCK_SIZE_MASK | -+ VC4_BIN_CONFIG_ALLOC_BLOCK_SIZE_MASK)) | -+ VC4_BIN_CONFIG_AUTO_INIT_TSDA | -+ VC4_SET_FIELD(VC4_BIN_CONFIG_ALLOC_INIT_BLOCK_SIZE_32, -+ VC4_BIN_CONFIG_ALLOC_INIT_BLOCK_SIZE) | -+ VC4_SET_FIELD(VC4_BIN_CONFIG_ALLOC_BLOCK_SIZE_128, -+ VC4_BIN_CONFIG_ALLOC_BLOCK_SIZE)); ++static int snd_rpi_hifiberry_dacplus_remove(struct platform_device *pdev) ++{ ++ return snd_soc_unregister_card(&snd_rpi_hifiberry_dacplus); ++} + -+ /* Initial block size. */ -+ tile_alloc_size = 32 * tile_count; ++static const struct of_device_id snd_rpi_hifiberry_dacplus_of_match[] = { ++ { .compatible = "hifiberry,hifiberry-dacplus", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, snd_rpi_hifiberry_dacplus_of_match); + -+ /* -+ * The initial allocation gets rounded to the next 256 bytes before -+ * the hardware starts fulfilling further allocations. -+ */ -+ tile_alloc_size = roundup(tile_alloc_size, 256); ++static struct platform_driver snd_rpi_hifiberry_dacplus_driver = { ++ .driver = { ++ .name = "snd-rpi-hifiberry-dacplus", ++ .owner = THIS_MODULE, ++ .of_match_table = snd_rpi_hifiberry_dacplus_of_match, ++ }, ++ .probe = snd_rpi_hifiberry_dacplus_probe, ++ .remove = snd_rpi_hifiberry_dacplus_remove, ++}; + -+ /* Add space for the extra allocations. This is what gets used first, -+ * before overflow memory. It must have at least 4096 bytes, but we -+ * want to avoid overflow memory usage if possible. -+ */ -+ tile_alloc_size += 1024 * 1024; ++module_platform_driver(snd_rpi_hifiberry_dacplus_driver); + -+ exec->tile_bo = &vc4_bo_create(dev, exec->tile_alloc_offset + -+ tile_alloc_size)->base; -+ if (!exec->tile_bo) -+ return -ENOMEM; -+ list_add_tail(&to_vc4_bo(&exec->tile_bo->base)->unref_head, -+ &exec->unref_list); ++MODULE_AUTHOR("Daniel Matuschek <daniel@hifiberry.com>"); ++MODULE_DESCRIPTION("ASoC Driver for HiFiBerry DAC+"); ++MODULE_LICENSE("GPL v2"); +diff --git a/sound/soc/codecs/pcm512x.c b/sound/soc/codecs/pcm512x.c +index 047c489..090fe0e 100644 +--- a/sound/soc/codecs/pcm512x.c ++++ b/sound/soc/codecs/pcm512x.c +@@ -854,7 +854,8 @@ static int pcm512x_set_dividers(struct snd_soc_dai *dai, + int fssp; + int gpio; + +- lrclk_div = snd_soc_params_to_frame_size(params); ++ lrclk_div = snd_pcm_format_physical_width(params_format(params)) ++ * params_channels(params); + if (lrclk_div == 0) { + dev_err(dev, "No LRCLK?\n"); + return -EINVAL; + +From e98480a9bdf2baa680bdd5e92a9cc914c3dea397 Mon Sep 17 00:00:00 2001 +From: Daniel Matuschek <info@crazy-audio.com> +Date: Mon, 4 Aug 2014 11:09:58 +0200 +Subject: [PATCH 073/112] Added driver for HiFiBerry Amp amplifier add-on board + +The driver contains a low-level hardware driver for the TAS5713 and the +drivers for the Raspberry Pi I2S subsystem. + +TAS5713: return error if initialisation fails + +Existing TAS5713 driver logs errors during initialisation, but does not return +an error code. Therefore even if initialisation fails, the driver will still be +loaded, but won't work. This patch fixes this. I2C communication error will now +reported correctly by a non-zero return code. + +HiFiBerry Amp: fix device-tree problems + +Some code to load the driver based on device-tree-overlays was missing. This is added by this patch. +--- + sound/soc/bcm/Kconfig | 7 + + sound/soc/bcm/Makefile | 2 + + sound/soc/bcm/hifiberry_amp.c | 128 +++++++++++++++ + sound/soc/codecs/Kconfig | 4 + + sound/soc/codecs/Makefile | 2 + + sound/soc/codecs/tas5713.c | 369 ++++++++++++++++++++++++++++++++++++++++++ + sound/soc/codecs/tas5713.h | 210 ++++++++++++++++++++++++ + 7 files changed, 722 insertions(+) + create mode 100644 sound/soc/bcm/hifiberry_amp.c + create mode 100644 sound/soc/codecs/tas5713.c + create mode 100644 sound/soc/codecs/tas5713.h + +diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig +index 8c338b5..7677c89 100644 +--- a/sound/soc/bcm/Kconfig ++++ b/sound/soc/bcm/Kconfig +@@ -29,6 +29,13 @@ config SND_BCM2708_SOC_HIFIBERRY_DIGI + help + Say Y or M if you want to add support for HifiBerry Digi S/PDIF output board. + ++config SND_BCM2708_SOC_HIFIBERRY_AMP ++ tristate "Support for the HifiBerry Amp" ++ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S ++ select SND_SOC_TAS5713 ++ help ++ Say Y or M if you want to add support for the HifiBerry Amp amplifier board. ++ + config SND_BCM2708_SOC_RPI_DAC + tristate "Support for RPi-DAC" + depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S +diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile +index a29538e..30db495 100644 +--- a/sound/soc/bcm/Makefile ++++ b/sound/soc/bcm/Makefile +@@ -7,11 +7,13 @@ obj-$(CONFIG_SND_BCM2835_SOC_I2S) += snd-soc-bcm2835-i2s.o + snd-soc-hifiberry-dac-objs := hifiberry_dac.o + snd-soc-hifiberry-dacplus-objs := hifiberry_dacplus.o + snd-soc-hifiberry-digi-objs := hifiberry_digi.o ++snd-soc-hifiberry-amp-objs := hifiberry_amp.o + snd-soc-rpi-dac-objs := rpi-dac.o + snd-soc-iqaudio-dac-objs := iqaudio-dac.o + + obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o + obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS) += snd-soc-hifiberry-dacplus.o + obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI) += snd-soc-hifiberry-digi.o ++obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_AMP) += snd-soc-hifiberry-amp.o + obj-$(CONFIG_SND_BCM2708_SOC_RPI_DAC) += snd-soc-rpi-dac.o + obj-$(CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC) += snd-soc-iqaudio-dac.o +diff --git a/sound/soc/bcm/hifiberry_amp.c b/sound/soc/bcm/hifiberry_amp.c +new file mode 100644 +index 0000000..0bb12e4 +--- /dev/null ++++ b/sound/soc/bcm/hifiberry_amp.c +@@ -0,0 +1,128 @@ ++/* ++ * ASoC Driver for HifiBerry AMP ++ * ++ * Author: Sebastian Eickhoff <basti.eickhoff@googlemail.com> ++ * Copyright 2014 ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * version 2 as published by the Free Software Foundation. ++ * ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * General Public License for more details. ++ */ + -+ /* tile alloc address. */ -+ *(uint32_t *)(validated + 0) = (exec->tile_bo->paddr + -+ exec->tile_alloc_offset); -+ /* tile alloc size. */ -+ *(uint32_t *)(validated + 4) = tile_alloc_size; -+ /* tile state address. */ -+ *(uint32_t *)(validated + 8) = exec->tile_bo->paddr; ++#include <linux/module.h> ++#include <linux/platform_device.h> + -+ return 0; -+} ++#include <sound/core.h> ++#include <sound/pcm.h> ++#include <sound/pcm_params.h> ++#include <sound/soc.h> ++#include <sound/jack.h> + -+static int -+validate_gem_handles(VALIDATE_ARGS) ++static int snd_rpi_hifiberry_amp_init(struct snd_soc_pcm_runtime *rtd) +{ -+ memcpy(exec->bo_index, untrusted, sizeof(exec->bo_index)); ++ // ToDo: init of the dsp-registers. + return 0; +} + -+#define VC4_DEFINE_PACKET(packet, name, func) \ -+ [packet] = { packet ## _SIZE, name, func } -+ -+static const struct cmd_info { -+ uint16_t len; -+ const char *name; -+ int (*func)(struct vc4_exec_info *exec, void *validated, -+ void *untrusted); -+} cmd_info[] = { -+ VC4_DEFINE_PACKET(VC4_PACKET_HALT, "halt", NULL), -+ VC4_DEFINE_PACKET(VC4_PACKET_NOP, "nop", NULL), -+ VC4_DEFINE_PACKET(VC4_PACKET_FLUSH, "flush", NULL), -+ VC4_DEFINE_PACKET(VC4_PACKET_FLUSH_ALL, "flush all state", validate_flush_all), -+ VC4_DEFINE_PACKET(VC4_PACKET_START_TILE_BINNING, "start tile binning", validate_start_tile_binning), -+ VC4_DEFINE_PACKET(VC4_PACKET_INCREMENT_SEMAPHORE, "increment semaphore", validate_increment_semaphore), -+ -+ VC4_DEFINE_PACKET(VC4_PACKET_GL_INDEXED_PRIMITIVE, "Indexed Primitive List", validate_indexed_prim_list), -+ -+ VC4_DEFINE_PACKET(VC4_PACKET_GL_ARRAY_PRIMITIVE, "Vertex Array Primitives", validate_gl_array_primitive), -+ -+ /* This is only used by clipped primitives (packets 48 and 49), which -+ * we don't support parsing yet. -+ */ -+ VC4_DEFINE_PACKET(VC4_PACKET_PRIMITIVE_LIST_FORMAT, "primitive list format", NULL), -+ -+ VC4_DEFINE_PACKET(VC4_PACKET_GL_SHADER_STATE, "GL Shader State", validate_gl_shader_state), -+ VC4_DEFINE_PACKET(VC4_PACKET_NV_SHADER_STATE, "NV Shader State", validate_nv_shader_state), -+ -+ VC4_DEFINE_PACKET(VC4_PACKET_CONFIGURATION_BITS, "configuration bits", NULL), -+ VC4_DEFINE_PACKET(VC4_PACKET_FLAT_SHADE_FLAGS, "flat shade flags", NULL), -+ VC4_DEFINE_PACKET(VC4_PACKET_POINT_SIZE, "point size", NULL), -+ VC4_DEFINE_PACKET(VC4_PACKET_LINE_WIDTH, "line width", NULL), -+ VC4_DEFINE_PACKET(VC4_PACKET_RHT_X_BOUNDARY, "RHT X boundary", NULL), -+ VC4_DEFINE_PACKET(VC4_PACKET_DEPTH_OFFSET, "Depth Offset", NULL), -+ VC4_DEFINE_PACKET(VC4_PACKET_CLIP_WINDOW, "Clip Window", NULL), -+ VC4_DEFINE_PACKET(VC4_PACKET_VIEWPORT_OFFSET, "Viewport Offset", NULL), -+ VC4_DEFINE_PACKET(VC4_PACKET_CLIPPER_XY_SCALING, "Clipper XY Scaling", NULL), -+ /* Note: The docs say this was also 105, but it was 106 in the -+ * initial userland code drop. -+ */ -+ VC4_DEFINE_PACKET(VC4_PACKET_CLIPPER_Z_SCALING, "Clipper Z Scale and Offset", NULL), ++static int snd_rpi_hifiberry_amp_hw_params( struct snd_pcm_substream *substream, ++ struct snd_pcm_hw_params *params ) ++{ ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; + -+ VC4_DEFINE_PACKET(VC4_PACKET_TILE_BINNING_MODE_CONFIG, "tile binning configuration", validate_tile_binning_config), ++ return snd_soc_dai_set_bclk_ratio(cpu_dai, 64); ++} + -+ VC4_DEFINE_PACKET(VC4_PACKET_GEM_HANDLES, "GEM handles", validate_gem_handles), ++static struct snd_soc_ops snd_rpi_hifiberry_amp_ops = { ++ .hw_params = snd_rpi_hifiberry_amp_hw_params, +}; + -+int -+vc4_validate_bin_cl(struct drm_device *dev, -+ void *validated, -+ void *unvalidated, -+ struct vc4_exec_info *exec) -+{ -+ uint32_t len = exec->args->bin_cl_size; -+ uint32_t dst_offset = 0; -+ uint32_t src_offset = 0; -+ -+ while (src_offset < len) { -+ void *dst_pkt = validated + dst_offset; -+ void *src_pkt = unvalidated + src_offset; -+ u8 cmd = *(uint8_t *)src_pkt; -+ const struct cmd_info *info; -+ -+ if (cmd > ARRAY_SIZE(cmd_info)) { -+ DRM_ERROR("0x%08x: packet %d out of bounds\n", -+ src_offset, cmd); -+ return -EINVAL; -+ } ++static struct snd_soc_dai_link snd_rpi_hifiberry_amp_dai[] = { ++ { ++ .name = "HifiBerry AMP", ++ .stream_name = "HifiBerry AMP HiFi", ++ .cpu_dai_name = "bcm2708-i2s.0", ++ .codec_dai_name = "tas5713-hifi", ++ .platform_name = "bcm2708-i2s.0", ++ .codec_name = "tas5713.1-001b", ++ .dai_fmt = SND_SOC_DAIFMT_I2S | ++ SND_SOC_DAIFMT_NB_NF | ++ SND_SOC_DAIFMT_CBS_CFS, ++ .ops = &snd_rpi_hifiberry_amp_ops, ++ .init = snd_rpi_hifiberry_amp_init, ++ }, ++}; + -+ info = &cmd_info[cmd]; -+ if (!info->name) { -+ DRM_ERROR("0x%08x: packet %d invalid\n", -+ src_offset, cmd); -+ return -EINVAL; -+ } + -+#if 0 -+ DRM_INFO("0x%08x: packet %d (%s) size %d processing...\n", -+ src_offset, cmd, info->name, info->len); -+#endif ++static struct snd_soc_card snd_rpi_hifiberry_amp = { ++ .name = "snd_rpi_hifiberry_amp", ++ .owner = THIS_MODULE, ++ .dai_link = snd_rpi_hifiberry_amp_dai, ++ .num_links = ARRAY_SIZE(snd_rpi_hifiberry_amp_dai), ++}; + -+ if (src_offset + info->len > len) { -+ DRM_ERROR("0x%08x: packet %d (%s) length 0x%08x " -+ "exceeds bounds (0x%08x)\n", -+ src_offset, cmd, info->name, info->len, -+ src_offset + len); -+ return -EINVAL; -+ } ++static const struct of_device_id snd_rpi_hifiberry_amp_of_match[] = { ++ { .compatible = "hifiberry,hifiberry-amp", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, snd_rpi_hifiberry_amp_of_match); + -+ if (cmd != VC4_PACKET_GEM_HANDLES) -+ memcpy(dst_pkt, src_pkt, info->len); + -+ if (info->func && info->func(exec, -+ dst_pkt + 1, -+ src_pkt + 1)) { -+ DRM_ERROR("0x%08x: packet %d (%s) failed to " -+ "validate\n", -+ src_offset, cmd, info->name); -+ return -EINVAL; -+ } ++static int snd_rpi_hifiberry_amp_probe(struct platform_device *pdev) ++{ ++ int ret = 0; + -+ src_offset += info->len; -+ /* GEM handle loading doesn't produce HW packets. */ -+ if (cmd != VC4_PACKET_GEM_HANDLES) -+ dst_offset += info->len; ++ snd_rpi_hifiberry_amp.dev = &pdev->dev; + -+ /* When the CL hits halt, it'll stop reading anything else. */ -+ if (cmd == VC4_PACKET_HALT) -+ break; -+ } ++ if (pdev->dev.of_node) { ++ struct device_node *i2s_node; ++ struct snd_soc_dai_link *dai = &snd_rpi_hifiberry_amp_dai[0]; ++ i2s_node = of_parse_phandle(pdev->dev.of_node, ++ "i2s-controller", 0); + -+ exec->ct0ea = exec->ct0ca + dst_offset; ++ if (i2s_node) { ++ dai->cpu_dai_name = NULL; ++ dai->cpu_of_node = i2s_node; ++ dai->platform_name = NULL; ++ dai->platform_of_node = i2s_node; ++ } ++ } + -+ if (!exec->found_start_tile_binning_packet) { -+ DRM_ERROR("Bin CL missing VC4_PACKET_START_TILE_BINNING\n"); -+ return -EINVAL; -+ } ++ ret = snd_soc_register_card(&snd_rpi_hifiberry_amp); + -+ if (!exec->found_increment_semaphore_packet) { -+ DRM_ERROR("Bin CL missing VC4_PACKET_INCREMENT_SEMAPHORE\n"); -+ return -EINVAL; ++ if (ret != 0) { ++ dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", ret); + } + -+ return 0; ++ return ret; +} + -+static bool -+reloc_tex(struct vc4_exec_info *exec, -+ void *uniform_data_u, -+ struct vc4_texture_sample_info *sample, -+ uint32_t texture_handle_index) -+ -+{ -+ struct drm_gem_cma_object *tex; -+ uint32_t p0 = *(uint32_t *)(uniform_data_u + sample->p_offset[0]); -+ uint32_t p1 = *(uint32_t *)(uniform_data_u + sample->p_offset[1]); -+ uint32_t p2 = (sample->p_offset[2] != ~0 ? -+ *(uint32_t *)(uniform_data_u + sample->p_offset[2]) : 0); -+ uint32_t p3 = (sample->p_offset[3] != ~0 ? -+ *(uint32_t *)(uniform_data_u + sample->p_offset[3]) : 0); -+ uint32_t *validated_p0 = exec->uniforms_v + sample->p_offset[0]; -+ uint32_t offset = p0 & VC4_TEX_P0_OFFSET_MASK; -+ uint32_t miplevels = VC4_GET_FIELD(p0, VC4_TEX_P0_MIPLVLS); -+ uint32_t width = VC4_GET_FIELD(p1, VC4_TEX_P1_WIDTH); -+ uint32_t height = VC4_GET_FIELD(p1, VC4_TEX_P1_HEIGHT); -+ uint32_t cpp, tiling_format, utile_w, utile_h; -+ uint32_t i; -+ uint32_t cube_map_stride = 0; -+ enum vc4_texture_data_type type; -+ -+ if (!vc4_use_bo(exec, texture_handle_index, VC4_MODE_RENDER, &tex)) -+ return false; + -+ if (sample->is_direct) { -+ uint32_t remaining_size = tex->base.size - p0; -+ if (p0 > tex->base.size - 4) { -+ DRM_ERROR("UBO offset greater than UBO size\n"); -+ goto fail; -+ } -+ if (p1 > remaining_size - 4) { -+ DRM_ERROR("UBO clamp would allow reads outside of UBO\n"); -+ goto fail; -+ } -+ *validated_p0 = tex->paddr + p0; -+ return true; -+ } ++static int snd_rpi_hifiberry_amp_remove(struct platform_device *pdev) ++{ ++ return snd_soc_unregister_card(&snd_rpi_hifiberry_amp); ++} + -+ if (width == 0) -+ width = 2048; -+ if (height == 0) -+ height = 2048; + -+ if (p0 & VC4_TEX_P0_CMMODE_MASK) { -+ if (VC4_GET_FIELD(p2, VC4_TEX_P2_PTYPE) == -+ VC4_TEX_P2_PTYPE_CUBE_MAP_STRIDE) -+ cube_map_stride = p2 & VC4_TEX_P2_CMST_MASK; -+ if (VC4_GET_FIELD(p3, VC4_TEX_P2_PTYPE) == -+ VC4_TEX_P2_PTYPE_CUBE_MAP_STRIDE) { -+ if (cube_map_stride) { -+ DRM_ERROR("Cube map stride set twice\n"); -+ goto fail; -+ } ++static struct platform_driver snd_rpi_hifiberry_amp_driver = { ++ .driver = { ++ .name = "snd-hifiberry-amp", ++ .owner = THIS_MODULE, ++ .of_match_table = snd_rpi_hifiberry_amp_of_match, ++ }, ++ .probe = snd_rpi_hifiberry_amp_probe, ++ .remove = snd_rpi_hifiberry_amp_remove, ++}; + -+ cube_map_stride = p3 & VC4_TEX_P2_CMST_MASK; -+ } -+ if (!cube_map_stride) { -+ DRM_ERROR("Cube map stride not set\n"); -+ goto fail; -+ } -+ } + -+ type = (VC4_GET_FIELD(p0, VC4_TEX_P0_TYPE) | -+ (VC4_GET_FIELD(p1, VC4_TEX_P1_TYPE4) << 4)); ++module_platform_driver(snd_rpi_hifiberry_amp_driver); + -+ switch (type) { -+ case VC4_TEXTURE_TYPE_RGBA8888: -+ case VC4_TEXTURE_TYPE_RGBX8888: -+ case VC4_TEXTURE_TYPE_RGBA32R: -+ cpp = 4; -+ break; -+ case VC4_TEXTURE_TYPE_RGBA4444: -+ case VC4_TEXTURE_TYPE_RGBA5551: -+ case VC4_TEXTURE_TYPE_RGB565: -+ case VC4_TEXTURE_TYPE_LUMALPHA: -+ case VC4_TEXTURE_TYPE_S16F: -+ case VC4_TEXTURE_TYPE_S16: -+ cpp = 2; -+ break; -+ case VC4_TEXTURE_TYPE_LUMINANCE: -+ case VC4_TEXTURE_TYPE_ALPHA: -+ case VC4_TEXTURE_TYPE_S8: -+ cpp = 1; -+ break; -+ case VC4_TEXTURE_TYPE_ETC1: -+ case VC4_TEXTURE_TYPE_BW1: -+ case VC4_TEXTURE_TYPE_A4: -+ case VC4_TEXTURE_TYPE_A1: -+ case VC4_TEXTURE_TYPE_RGBA64: -+ case VC4_TEXTURE_TYPE_YUV422R: -+ default: -+ DRM_ERROR("Texture format %d unsupported\n", type); -+ goto fail; -+ } -+ utile_w = utile_width(cpp); -+ utile_h = utile_height(cpp); + -+ if (type == VC4_TEXTURE_TYPE_RGBA32R) { -+ tiling_format = VC4_TILING_FORMAT_LINEAR; -+ } else { -+ if (size_is_lt(width, height, cpp)) -+ tiling_format = VC4_TILING_FORMAT_LT; -+ else -+ tiling_format = VC4_TILING_FORMAT_T; -+ } ++MODULE_AUTHOR("Sebastian Eickhoff <basti.eickhoff@googlemail.com>"); ++MODULE_DESCRIPTION("ASoC driver for HiFiBerry-AMP"); ++MODULE_LICENSE("GPL v2"); +diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig +index 513ab55..ebcfbfd 100644 +--- a/sound/soc/codecs/Kconfig ++++ b/sound/soc/codecs/Kconfig +@@ -129,6 +129,7 @@ config SND_SOC_ALL_CODECS + select SND_SOC_TFA9879 if I2C + select SND_SOC_TLV320AIC23_I2C if I2C + select SND_SOC_TLV320AIC23_SPI if SPI_MASTER ++ select SND_SOC_TAS5713 if I2C + select SND_SOC_TLV320AIC26 if SPI_MASTER + select SND_SOC_TLV320AIC31XX if I2C + select SND_SOC_TLV320AIC32X4 if I2C +@@ -759,6 +760,9 @@ config SND_SOC_TFA9879 + tristate "NXP Semiconductors TFA9879 amplifier" + depends on I2C + ++config SND_SOC_TAS5713 ++ tristate + -+ if (!vc4_check_tex_size(exec, tex, offset + cube_map_stride * 5, -+ tiling_format, width, height, cpp)) { -+ goto fail; -+ } + config SND_SOC_TLV320AIC23 + tristate + +diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile +index b87e845..9974a13 100644 +--- a/sound/soc/codecs/Makefile ++++ b/sound/soc/codecs/Makefile +@@ -132,6 +132,7 @@ snd-soc-sti-sas-objs := sti-sas.o + snd-soc-tas5086-objs := tas5086.o + snd-soc-tas571x-objs := tas571x.o + snd-soc-tfa9879-objs := tfa9879.o ++snd-soc-tas5713-objs := tas5713.o + snd-soc-tlv320aic23-objs := tlv320aic23.o + snd-soc-tlv320aic23-i2c-objs := tlv320aic23-i2c.o + snd-soc-tlv320aic23-spi-objs := tlv320aic23-spi.o +@@ -340,6 +341,7 @@ obj-$(CONFIG_SND_SOC_TAS2552) += snd-soc-tas2552.o + obj-$(CONFIG_SND_SOC_TAS5086) += snd-soc-tas5086.o + obj-$(CONFIG_SND_SOC_TAS571X) += snd-soc-tas571x.o + obj-$(CONFIG_SND_SOC_TFA9879) += snd-soc-tfa9879.o ++obj-$(CONFIG_SND_SOC_TAS5713) += snd-soc-tas5713.o + obj-$(CONFIG_SND_SOC_TLV320AIC23) += snd-soc-tlv320aic23.o + obj-$(CONFIG_SND_SOC_TLV320AIC23_I2C) += snd-soc-tlv320aic23-i2c.o + obj-$(CONFIG_SND_SOC_TLV320AIC23_SPI) += snd-soc-tlv320aic23-spi.o +diff --git a/sound/soc/codecs/tas5713.c b/sound/soc/codecs/tas5713.c +new file mode 100644 +index 0000000..9b27138 +--- /dev/null ++++ b/sound/soc/codecs/tas5713.c +@@ -0,0 +1,369 @@ ++/* ++ * ASoC Driver for TAS5713 ++ * ++ * Author: Sebastian Eickhoff <basti.eickhoff@googlemail.com> ++ * Copyright 2014 ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * version 2 as published by the Free Software Foundation. ++ * ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * General Public License for more details. ++ */ + -+ /* The mipmap levels are stored before the base of the texture. Make -+ * sure there is actually space in the BO. -+ */ -+ for (i = 1; i <= miplevels; i++) { -+ uint32_t level_width = max(width >> i, 1u); -+ uint32_t level_height = max(height >> i, 1u); -+ uint32_t aligned_width, aligned_height; -+ uint32_t level_size; -+ -+ /* Once the levels get small enough, they drop from T to LT. */ -+ if (tiling_format == VC4_TILING_FORMAT_T && -+ size_is_lt(level_width, level_height, cpp)) { -+ tiling_format = VC4_TILING_FORMAT_LT; -+ } -+ -+ switch (tiling_format) { -+ case VC4_TILING_FORMAT_T: -+ aligned_width = round_up(level_width, utile_w * 8); -+ aligned_height = round_up(level_height, utile_h * 8); -+ break; -+ case VC4_TILING_FORMAT_LT: -+ aligned_width = round_up(level_width, utile_w); -+ aligned_height = round_up(level_height, utile_h); -+ break; -+ default: -+ aligned_width = round_up(level_width, utile_w); -+ aligned_height = level_height; -+ break; -+ } ++#include <linux/module.h> ++#include <linux/moduleparam.h> ++#include <linux/init.h> ++#include <linux/delay.h> ++#include <linux/pm.h> ++#include <linux/i2c.h> ++#include <linux/of_device.h> ++#include <linux/spi/spi.h> ++#include <linux/regmap.h> ++#include <linux/regulator/consumer.h> ++#include <linux/slab.h> ++#include <sound/core.h> ++#include <sound/pcm.h> ++#include <sound/pcm_params.h> ++#include <sound/soc.h> ++#include <sound/initval.h> ++#include <sound/tlv.h> + -+ level_size = aligned_width * cpp * aligned_height; ++#include <linux/kernel.h> ++#include <linux/string.h> ++#include <linux/fs.h> ++#include <asm/uaccess.h> + -+ if (offset < level_size) { -+ DRM_ERROR("Level %d (%dx%d -> %dx%d) size %db " -+ "overflowed buffer bounds (offset %d)\n", -+ i, level_width, level_height, -+ aligned_width, aligned_height, -+ level_size, offset); -+ goto fail; -+ } ++#include "tas5713.h" + -+ offset -= level_size; -+ } + -+ *validated_p0 = tex->paddr + p0; ++static struct i2c_client *i2c; + -+ return true; -+ fail: -+ DRM_INFO("Texture p0 at %d: 0x%08x\n", sample->p_offset[0], p0); -+ DRM_INFO("Texture p1 at %d: 0x%08x\n", sample->p_offset[1], p1); -+ DRM_INFO("Texture p2 at %d: 0x%08x\n", sample->p_offset[2], p2); -+ DRM_INFO("Texture p3 at %d: 0x%08x\n", sample->p_offset[3], p3); -+ return false; -+} ++struct tas5713_priv { ++ struct regmap *regmap; ++ int mclk_div; ++ struct snd_soc_codec *codec; ++}; + -+static int -+validate_shader_rec(struct drm_device *dev, -+ struct vc4_exec_info *exec, -+ struct vc4_shader_state *state) -+{ -+ uint32_t *src_handles; -+ void *pkt_u, *pkt_v; -+ enum shader_rec_reloc_type { -+ RELOC_CODE, -+ RELOC_VBO, -+ }; -+ struct shader_rec_reloc { -+ enum shader_rec_reloc_type type; -+ uint32_t offset; -+ }; -+ static const struct shader_rec_reloc gl_relocs[] = { -+ { RELOC_CODE, 4 }, /* fs */ -+ { RELOC_CODE, 16 }, /* vs */ -+ { RELOC_CODE, 28 }, /* cs */ -+ }; -+ static const struct shader_rec_reloc nv_relocs[] = { -+ { RELOC_CODE, 4 }, /* fs */ -+ { RELOC_VBO, 12 } -+ }; -+ const struct shader_rec_reloc *relocs; -+ struct drm_gem_cma_object *bo[ARRAY_SIZE(gl_relocs) + 8]; -+ uint32_t nr_attributes = 0, nr_fixed_relocs, nr_relocs, packet_size; -+ int i; -+ struct vc4_validated_shader_info *validated_shader; ++static struct tas5713_priv *priv_data; + -+ if (state->packet == VC4_PACKET_NV_SHADER_STATE) { -+ relocs = nv_relocs; -+ nr_fixed_relocs = ARRAY_SIZE(nv_relocs); + -+ packet_size = 16; -+ } else { -+ relocs = gl_relocs; -+ nr_fixed_relocs = ARRAY_SIZE(gl_relocs); + -+ nr_attributes = state->addr & 0x7; -+ if (nr_attributes == 0) -+ nr_attributes = 8; -+ packet_size = gl_shader_rec_size(state->addr); -+ } -+ nr_relocs = nr_fixed_relocs + nr_attributes; + -+ if (nr_relocs * 4 > exec->shader_rec_size) { -+ DRM_ERROR("overflowed shader recs reading %d handles " -+ "from %d bytes left\n", -+ nr_relocs, exec->shader_rec_size); -+ return -EINVAL; -+ } -+ src_handles = exec->shader_rec_u; -+ exec->shader_rec_u += nr_relocs * 4; -+ exec->shader_rec_size -= nr_relocs * 4; ++/* ++ * _ _ ___ _ ___ _ _ ++ * /_\ | | / __| /_\ / __|___ _ _| |_ _ _ ___| |___ ++ * / _ \| |__\__ \/ _ \ | (__/ _ \ ' \ _| '_/ _ \ (_-< ++ * /_/ \_\____|___/_/ \_\ \___\___/_||_\__|_| \___/_/__/ ++ * ++ */ + -+ if (packet_size > exec->shader_rec_size) { -+ DRM_ERROR("overflowed shader recs copying %db packet " -+ "from %d bytes left\n", -+ packet_size, exec->shader_rec_size); -+ return -EINVAL; -+ } -+ pkt_u = exec->shader_rec_u; -+ pkt_v = exec->shader_rec_v; -+ memcpy(pkt_v, pkt_u, packet_size); -+ exec->shader_rec_u += packet_size; -+ /* Shader recs have to be aligned to 16 bytes (due to the attribute -+ * flags being in the low bytes), so round the next validated shader -+ * rec address up. This should be safe, since we've got so many -+ * relocations in a shader rec packet. -+ */ -+ BUG_ON(roundup(packet_size, 16) - packet_size > nr_relocs * 4); -+ exec->shader_rec_v += roundup(packet_size, 16); -+ exec->shader_rec_size -= packet_size; ++static const DECLARE_TLV_DB_SCALE(tas5713_vol_tlv, -10000, 50, 1); + -+ for (i = 0; i < nr_relocs; i++) { -+ enum vc4_bo_mode mode; + -+ if (i < nr_fixed_relocs && relocs[i].type == RELOC_CODE) -+ mode = VC4_MODE_SHADER; -+ else -+ mode = VC4_MODE_RENDER; ++static const struct snd_kcontrol_new tas5713_snd_controls[] = { ++ SOC_SINGLE_TLV ("Master" , TAS5713_VOL_MASTER, 0, 248, 1, tas5713_vol_tlv), ++ SOC_DOUBLE_R_TLV("Channels" , TAS5713_VOL_CH1, TAS5713_VOL_CH2, 0, 248, 1, tas5713_vol_tlv) ++}; + -+ if (!vc4_use_bo(exec, src_handles[i], mode, &bo[i])) { -+ return false; -+ } -+ } + -+ for (i = 0; i < nr_fixed_relocs; i++) { -+ uint32_t o = relocs[i].offset; -+ uint32_t src_offset = *(uint32_t *)(pkt_u + o); -+ uint32_t *texture_handles_u; -+ void *uniform_data_u; -+ uint32_t tex; + -+ *(uint32_t *)(pkt_v + o) = bo[i]->paddr + src_offset; + -+ switch (relocs[i].type) { -+ case RELOC_CODE: -+ if (src_offset != 0) { -+ DRM_ERROR("Shaders must be at offset 0 of " -+ "the BO.\n"); -+ goto fail; -+ } ++/* ++ * __ __ _ _ ___ _ ++ * | \/ |__ _ __| |_ (_)_ _ ___ | \ _ _(_)_ _____ _ _ ++ * | |\/| / _` / _| ' \| | ' \/ -_) | |) | '_| \ V / -_) '_| ++ * |_| |_\__,_\__|_||_|_|_||_\___| |___/|_| |_|\_/\___|_| ++ * ++ */ + -+ validated_shader = to_vc4_bo(&bo[i]->base)->validated_shader; -+ if (!validated_shader) -+ goto fail; ++static int tas5713_hw_params(struct snd_pcm_substream *substream, ++ struct snd_pcm_hw_params *params, ++ struct snd_soc_dai *dai) ++{ ++ u16 blen = 0x00; + -+ if (validated_shader->uniforms_src_size > -+ exec->uniforms_size) { -+ DRM_ERROR("Uniforms src buffer overflow\n"); -+ goto fail; -+ } ++ struct snd_soc_codec *codec; ++ codec = dai->codec; ++ priv_data->codec = dai->codec; + -+ texture_handles_u = exec->uniforms_u; -+ uniform_data_u = (texture_handles_u + -+ validated_shader->num_texture_samples); ++ switch (params_format(params)) { ++ case SNDRV_PCM_FORMAT_S16_LE: ++ blen = 0x03; ++ break; ++ case SNDRV_PCM_FORMAT_S20_3LE: ++ blen = 0x1; ++ break; ++ case SNDRV_PCM_FORMAT_S24_LE: ++ blen = 0x04; ++ break; ++ case SNDRV_PCM_FORMAT_S32_LE: ++ blen = 0x05; ++ break; ++ default: ++ dev_err(dai->dev, "Unsupported word length: %u\n", ++ params_format(params)); ++ return -EINVAL; ++ } + -+ memcpy(exec->uniforms_v, uniform_data_u, -+ validated_shader->uniforms_size); ++ // set word length ++ snd_soc_update_bits(codec, TAS5713_SERIAL_DATA_INTERFACE, 0x7, blen); + -+ for (tex = 0; -+ tex < validated_shader->num_texture_samples; -+ tex++) { -+ if (!reloc_tex(exec, -+ uniform_data_u, -+ &validated_shader->texture_samples[tex], -+ texture_handles_u[tex])) { -+ goto fail; -+ } -+ } ++ return 0; ++} + -+ *(uint32_t *)(pkt_v + o + 4) = exec->uniforms_p; + -+ exec->uniforms_u += validated_shader->uniforms_src_size; -+ exec->uniforms_v += validated_shader->uniforms_size; -+ exec->uniforms_p += validated_shader->uniforms_size; ++static int tas5713_mute_stream(struct snd_soc_dai *dai, int mute, int stream) ++{ ++ unsigned int val = 0; + -+ break; ++ struct tas5713_priv *tas5713; ++ struct snd_soc_codec *codec = dai->codec; ++ tas5713 = snd_soc_codec_get_drvdata(codec); + -+ case RELOC_VBO: -+ break; -+ } ++ if (mute) { ++ val = TAS5713_SOFT_MUTE_ALL; + } + -+ for (i = 0; i < nr_attributes; i++) { -+ struct drm_gem_cma_object *vbo = bo[nr_fixed_relocs + i]; -+ uint32_t o = 36 + i * 8; -+ uint32_t offset = *(uint32_t *)(pkt_u + o + 0); -+ uint32_t attr_size = *(uint8_t *)(pkt_u + o + 4) + 1; -+ uint32_t stride = *(uint8_t *)(pkt_u + o + 5); -+ uint32_t max_index; -+ -+ if (state->addr & 0x8) -+ stride |= (*(uint32_t *)(pkt_u + 100 + i * 4)) & ~0xff; ++ return regmap_write(tas5713->regmap, TAS5713_SOFT_MUTE, val); ++} + -+ if (vbo->base.size < offset || -+ vbo->base.size - offset < attr_size) { -+ DRM_ERROR("BO offset overflow (%d + %d > %d)\n", -+ offset, attr_size, vbo->base.size); -+ return -EINVAL; -+ } + -+ if (stride != 0) { -+ max_index = ((vbo->base.size - offset - attr_size) / -+ stride); -+ if (state->max_index > max_index) { -+ DRM_ERROR("primitives use index %d out of supplied %d\n", -+ state->max_index, max_index); -+ return -EINVAL; -+ } -+ } ++static const struct snd_soc_dai_ops tas5713_dai_ops = { ++ .hw_params = tas5713_hw_params, ++ .mute_stream = tas5713_mute_stream, ++}; + -+ *(uint32_t *)(pkt_v + o) = vbo->paddr + offset; -+ } + -+ return 0; ++static struct snd_soc_dai_driver tas5713_dai = { ++ .name = "tas5713-hifi", ++ .playback = { ++ .stream_name = "Playback", ++ .channels_min = 2, ++ .channels_max = 2, ++ .rates = SNDRV_PCM_RATE_8000_48000, ++ .formats = (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE ), ++ }, ++ .ops = &tas5713_dai_ops, ++}; + -+fail: -+ return -EINVAL; -+} + -+int -+vc4_validate_shader_recs(struct drm_device *dev, -+ struct vc4_exec_info *exec) -+{ -+ uint32_t i; -+ int ret = 0; + -+ for (i = 0; i < exec->shader_state_count; i++) { -+ ret = validate_shader_rec(dev, exec, &exec->shader_state[i]); -+ if (ret) -+ return ret; -+ } + -+ return ret; -+} -diff --git a/drivers/gpu/drm/vc4/vc4_validate_shaders.c b/drivers/gpu/drm/vc4/vc4_validate_shaders.c -new file mode 100644 -index 0000000..0aab9d7 ---- /dev/null -+++ b/drivers/gpu/drm/vc4/vc4_validate_shaders.c -@@ -0,0 +1,521 @@ +/* -+ * Copyright © 2014 Broadcom -+ * -+ * Permission is hereby granted, free of charge, to any person obtaining a -+ * copy of this software and associated documentation files (the "Software"), -+ * to deal in the Software without restriction, including without limitation -+ * the rights to use, copy, modify, merge, publish, distribute, sublicense, -+ * and/or sell copies of the Software, and to permit persons to whom the -+ * Software is furnished to do so, subject to the following conditions: -+ * -+ * The above copyright notice and this permission notice (including the next -+ * paragraph) shall be included in all copies or substantial portions of the -+ * Software. ++ * ___ _ ___ _ ++ * / __|___ __| |___ __ | \ _ _(_)_ _____ _ _ ++ * | (__/ _ \/ _` / -_) _| | |) | '_| \ V / -_) '_| ++ * \___\___/\__,_\___\__| |___/|_| |_|\_/\___|_| + * -+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -+ * IN THE SOFTWARE. + */ + -+/** -+ * DOC: Shader validator for VC4. -+ * -+ * The VC4 has no IOMMU between it and system memory. So, a user with access -+ * to execute shaders could escalate privilege by overwriting system memory -+ * (using the VPM write address register in the general-purpose DMA mode) or -+ * reading system memory it shouldn't (reading it as a texture, or uniform -+ * data, or vertex data). -+ * -+ * This walks over a shader starting from some offset within a BO, ensuring -+ * that its accesses are appropriately bounded, and recording how many texture -+ * accesses are made and where so that we can do relocations for them in the -+ * uniform stream. -+ * -+ * The kernel API has shaders stored in user-mapped BOs. The BOs will be -+ * forcibly unmapped from the process before validation, and any cache of -+ * validated state will be flushed if the mapping is faulted back in. -+ * -+ * Storing the shaders in BOs means that the validation process will be slow -+ * due to uncached reads, but since shaders are long-lived and shader BOs are -+ * never actually modified, this shouldn't be a problem. -+ */ ++static int tas5713_remove(struct snd_soc_codec *codec) ++{ ++ struct tas5713_priv *tas5713; + -+#include "vc4_drv.h" -+#include "vc4_qpu_defines.h" ++ tas5713 = snd_soc_codec_get_drvdata(codec); + -+struct vc4_shader_validation_state { -+ struct vc4_texture_sample_info tmu_setup[2]; -+ int tmu_write_count[2]; ++ return 0; ++} + -+ /* For registers that were last written to by a MIN instruction with -+ * one argument being a uniform, the address of the uniform. -+ * Otherwise, ~0. -+ * -+ * This is used for the validation of direct address memory reads. -+ */ -+ uint32_t live_min_clamp_offsets[32 + 32 + 4]; -+ bool live_max_clamp_regs[32 + 32 + 4]; -+}; + -+static uint32_t -+waddr_to_live_reg_index(uint32_t waddr, bool is_b) ++static int tas5713_probe(struct snd_soc_codec *codec) +{ -+ if (waddr < 32) { -+ if (is_b) -+ return 32 + waddr; -+ else -+ return waddr; -+ } else if (waddr <= QPU_W_ACC3) { ++ struct tas5713_priv *tas5713; ++ int i, ret; + -+ return 64 + waddr - QPU_W_ACC0; -+ } else { -+ return ~0; -+ } -+} ++ i2c = container_of(codec->dev, struct i2c_client, dev); + -+static uint32_t -+raddr_add_a_to_live_reg_index(uint64_t inst) -+{ -+ uint32_t sig = QPU_GET_FIELD(inst, QPU_SIG); -+ uint32_t add_a = QPU_GET_FIELD(inst, QPU_ADD_A); -+ uint32_t raddr_a = QPU_GET_FIELD(inst, QPU_RADDR_A); -+ uint32_t raddr_b = QPU_GET_FIELD(inst, QPU_RADDR_B); ++ tas5713 = snd_soc_codec_get_drvdata(codec); + -+ if (add_a == QPU_MUX_A) { -+ return raddr_a; -+ } else if (add_a == QPU_MUX_B && sig != QPU_SIG_SMALL_IMM) { -+ return 32 + raddr_b; -+ } else if (add_a <= QPU_MUX_R3) { -+ return 64 + add_a; -+ } else { -+ return ~0; -+ } -+} ++ // Reset error ++ ret = snd_soc_write(codec, TAS5713_ERROR_STATUS, 0x00); ++ if (ret < 0) return ret; + -+static bool -+is_tmu_submit(uint32_t waddr) -+{ -+ return (waddr == QPU_W_TMU0_S || -+ waddr == QPU_W_TMU1_S); -+} ++ // Trim oscillator ++ ret = snd_soc_write(codec, TAS5713_OSC_TRIM, 0x00); ++ if (ret < 0) return ret; ++ msleep(1000); + -+static bool -+is_tmu_write(uint32_t waddr) -+{ -+ return (waddr >= QPU_W_TMU0_S && -+ waddr <= QPU_W_TMU1_B); -+} ++ // Reset error ++ ret = snd_soc_write(codec, TAS5713_ERROR_STATUS, 0x00); ++ if (ret < 0) return ret; + -+static bool -+record_validated_texture_sample(struct vc4_validated_shader_info *validated_shader, -+ struct vc4_shader_validation_state *validation_state, -+ int tmu) -+{ -+ uint32_t s = validated_shader->num_texture_samples; -+ int i; -+ struct vc4_texture_sample_info *temp_samples; ++ // Clock mode: 44/48kHz, MCLK=64xfs ++ ret = snd_soc_write(codec, TAS5713_CLOCK_CTRL, 0x60); ++ if (ret < 0) return ret; + -+ temp_samples = krealloc(validated_shader->texture_samples, -+ (s + 1) * sizeof(*temp_samples), -+ GFP_KERNEL); -+ if (!temp_samples) -+ return false; ++ // I2S 24bit ++ ret = snd_soc_write(codec, TAS5713_SERIAL_DATA_INTERFACE, 0x05); ++ if (ret < 0) return ret; ++ ++ // Unmute ++ ret = snd_soc_write(codec, TAS5713_SYSTEM_CTRL2, 0x00); ++ if (ret < 0) return ret; ++ ret = snd_soc_write(codec, TAS5713_SOFT_MUTE, 0x00); ++ if (ret < 0) return ret; + -+ memcpy(&temp_samples[s], -+ &validation_state->tmu_setup[tmu], -+ sizeof(*temp_samples)); ++ // Set volume to 0db ++ ret = snd_soc_write(codec, TAS5713_VOL_MASTER, 0x00); ++ if (ret < 0) return ret; + -+ validated_shader->num_texture_samples = s + 1; -+ validated_shader->texture_samples = temp_samples; ++ // Now start programming the default initialization sequence ++ for (i = 0; i < ARRAY_SIZE(tas5713_init_sequence); ++i) { ++ ret = i2c_master_send(i2c, ++ tas5713_init_sequence[i].data, ++ tas5713_init_sequence[i].size); ++ if (ret < 0) { ++ printk(KERN_INFO "TAS5713 CODEC PROBE: InitSeq returns: %d\n", ret); ++ } ++ } + -+ for (i = 0; i < 4; i++) -+ validation_state->tmu_setup[tmu].p_offset[i] = ~0; ++ // Unmute ++ ret = snd_soc_write(codec, TAS5713_SYSTEM_CTRL2, 0x00); ++ if (ret < 0) return ret; + -+ return true; ++ return 0; +} + -+static bool -+check_tmu_write(uint64_t inst, -+ struct vc4_validated_shader_info *validated_shader, -+ struct vc4_shader_validation_state *validation_state, -+ bool is_mul) -+{ -+ uint32_t waddr = (is_mul ? -+ QPU_GET_FIELD(inst, QPU_WADDR_MUL) : -+ QPU_GET_FIELD(inst, QPU_WADDR_ADD)); -+ uint32_t raddr_a = QPU_GET_FIELD(inst, QPU_RADDR_A); -+ uint32_t raddr_b = QPU_GET_FIELD(inst, QPU_RADDR_B); -+ int tmu = waddr > QPU_W_TMU0_B; -+ bool submit = is_tmu_submit(waddr); -+ bool is_direct = submit && validation_state->tmu_write_count[tmu] == 0; -+ uint32_t sig = QPU_GET_FIELD(inst, QPU_SIG); -+ -+ if (is_direct) { -+ uint32_t add_b = QPU_GET_FIELD(inst, QPU_ADD_B); -+ uint32_t clamp_reg, clamp_offset; -+ -+ if (sig == QPU_SIG_SMALL_IMM) { -+ DRM_ERROR("direct TMU read used small immediate\n"); -+ return false; -+ } + -+ /* Make sure that this texture load is an add of the base -+ * address of the UBO to a clamped offset within the UBO. -+ */ -+ if (is_mul || -+ QPU_GET_FIELD(inst, QPU_OP_ADD) != QPU_A_ADD) { -+ DRM_ERROR("direct TMU load wasn't an add\n"); -+ return false; -+ } ++static struct snd_soc_codec_driver soc_codec_dev_tas5713 = { ++ .probe = tas5713_probe, ++ .remove = tas5713_remove, ++ .controls = tas5713_snd_controls, ++ .num_controls = ARRAY_SIZE(tas5713_snd_controls), ++}; + -+ /* We assert that the the clamped address is the first -+ * argument, and the UBO base address is the second argument. -+ * This is arbitrary, but simpler than supporting flipping the -+ * two either way. -+ */ -+ clamp_reg = raddr_add_a_to_live_reg_index(inst); -+ if (clamp_reg == ~0) { -+ DRM_ERROR("direct TMU load wasn't clamped\n"); -+ return false; -+ } + -+ clamp_offset = validation_state->live_min_clamp_offsets[clamp_reg]; -+ if (clamp_offset == ~0) { -+ DRM_ERROR("direct TMU load wasn't clamped\n"); -+ return false; -+ } + -+ /* Store the clamp value's offset in p1 (see reloc_tex() in -+ * vc4_validate.c). -+ */ -+ validation_state->tmu_setup[tmu].p_offset[1] = -+ clamp_offset; + -+ if (!(add_b == QPU_MUX_A && raddr_a == QPU_R_UNIF) && -+ !(add_b == QPU_MUX_B && raddr_b == QPU_R_UNIF)) { -+ DRM_ERROR("direct TMU load didn't add to a uniform\n"); -+ return false; -+ } ++/* ++ * ___ ___ ___ ___ _ ++ * |_ _|_ ) __| | \ _ _(_)_ _____ _ _ ++ * | | / / (__ | |) | '_| \ V / -_) '_| ++ * |___/___\___| |___/|_| |_|\_/\___|_| ++ * ++ */ + -+ validation_state->tmu_setup[tmu].is_direct = true; -+ } else { -+ if (raddr_a == QPU_R_UNIF || (sig != QPU_SIG_SMALL_IMM && -+ raddr_b == QPU_R_UNIF)) { -+ DRM_ERROR("uniform read in the same instruction as " -+ "texture setup.\n"); -+ return false; -+ } -+ } ++static const struct reg_default tas5713_reg_defaults[] = { ++ { 0x07 ,0x80 }, // R7 - VOL_MASTER - -40dB ++ { 0x08 , 30 }, // R8 - VOL_CH1 - 0dB ++ { 0x09 , 30 }, // R9 - VOL_CH2 - 0dB ++ { 0x0A ,0x80 }, // R10 - VOL_HEADPHONE - -40dB ++}; + -+ if (validation_state->tmu_write_count[tmu] >= 4) { -+ DRM_ERROR("TMU%d got too many parameters before dispatch\n", -+ tmu); -+ return false; -+ } -+ validation_state->tmu_setup[tmu].p_offset[validation_state->tmu_write_count[tmu]] = -+ validated_shader->uniforms_size; -+ validation_state->tmu_write_count[tmu]++; -+ /* Since direct uses a RADDR uniform reference, it will get counted in -+ * check_instruction_reads() -+ */ -+ if (!is_direct) -+ validated_shader->uniforms_size += 4; + -+ if (submit) { -+ if (!record_validated_texture_sample(validated_shader, -+ validation_state, tmu)) { ++static bool tas5713_reg_volatile(struct device *dev, unsigned int reg) ++{ ++ switch (reg) { ++ case TAS5713_DEVICE_ID: ++ case TAS5713_ERROR_STATUS: ++ return true; ++ default: + return false; -+ } -+ -+ validation_state->tmu_write_count[tmu] = 0; + } -+ -+ return true; +} + -+static bool -+check_register_write(uint64_t inst, -+ struct vc4_validated_shader_info *validated_shader, -+ struct vc4_shader_validation_state *validation_state, -+ bool is_mul) -+{ -+ uint32_t waddr = (is_mul ? -+ QPU_GET_FIELD(inst, QPU_WADDR_MUL) : -+ QPU_GET_FIELD(inst, QPU_WADDR_ADD)); + -+ switch (waddr) { -+ case QPU_W_UNIFORMS_ADDRESS: -+ /* XXX: We'll probably need to support this for reladdr, but -+ * it's definitely a security-related one. -+ */ -+ DRM_ERROR("uniforms address load unsupported\n"); -+ return false; ++static const struct of_device_id tas5713_of_match[] = { ++ { .compatible = "ti,tas5713", }, ++ { } ++}; ++MODULE_DEVICE_TABLE(of, tas5713_of_match); + -+ case QPU_W_TLB_COLOR_MS: -+ case QPU_W_TLB_COLOR_ALL: -+ case QPU_W_TLB_Z: -+ /* These only interact with the tile buffer, not main memory, -+ * so they're safe. -+ */ -+ return true; + -+ case QPU_W_TMU0_S: -+ case QPU_W_TMU0_T: -+ case QPU_W_TMU0_R: -+ case QPU_W_TMU0_B: -+ case QPU_W_TMU1_S: -+ case QPU_W_TMU1_T: -+ case QPU_W_TMU1_R: -+ case QPU_W_TMU1_B: -+ return check_tmu_write(inst, validated_shader, validation_state, -+ is_mul); -+ -+ case QPU_W_HOST_INT: -+ case QPU_W_TMU_NOSWAP: -+ case QPU_W_TLB_ALPHA_MASK: -+ case QPU_W_MUTEX_RELEASE: -+ /* XXX: I haven't thought about these, so don't support them -+ * for now. -+ */ -+ DRM_ERROR("Unsupported waddr %d\n", waddr); -+ return false; ++static struct regmap_config tas5713_regmap_config = { ++ .reg_bits = 8, ++ .val_bits = 8, + -+ case QPU_W_VPM_ADDR: -+ DRM_ERROR("General VPM DMA unsupported\n"); -+ return false; ++ .max_register = TAS5713_MAX_REGISTER, ++ .volatile_reg = tas5713_reg_volatile, + -+ case QPU_W_VPM: -+ case QPU_W_VPMVCD_SETUP: -+ /* We allow VPM setup in general, even including VPM DMA -+ * configuration setup, because the (unsafe) DMA can only be -+ * triggered by QPU_W_VPM_ADDR writes. -+ */ -+ return true; ++ .cache_type = REGCACHE_RBTREE, ++ .reg_defaults = tas5713_reg_defaults, ++ .num_reg_defaults = ARRAY_SIZE(tas5713_reg_defaults), ++}; + -+ case QPU_W_TLB_STENCIL_SETUP: -+ return true; -+ } + -+ return true; -+} ++static int tas5713_i2c_probe(struct i2c_client *i2c, ++ const struct i2c_device_id *id) ++{ ++ int ret; + -+static void -+track_live_clamps(uint64_t inst, -+ struct vc4_validated_shader_info *validated_shader, -+ struct vc4_shader_validation_state *validation_state) -+{ -+ uint32_t op_add = QPU_GET_FIELD(inst, QPU_OP_ADD); -+ uint32_t waddr_add = QPU_GET_FIELD(inst, QPU_WADDR_ADD); -+ uint32_t waddr_mul = QPU_GET_FIELD(inst, QPU_WADDR_MUL); -+ uint32_t cond_add = QPU_GET_FIELD(inst, QPU_COND_ADD); -+ uint32_t add_a = QPU_GET_FIELD(inst, QPU_ADD_A); -+ uint32_t add_b = QPU_GET_FIELD(inst, QPU_ADD_B); -+ uint32_t raddr_a = QPU_GET_FIELD(inst, QPU_RADDR_A); -+ uint32_t raddr_b = QPU_GET_FIELD(inst, QPU_RADDR_B); -+ uint32_t sig = QPU_GET_FIELD(inst, QPU_SIG); -+ bool ws = inst & QPU_WS; -+ uint32_t lri_add_a, lri_add, lri_mul; -+ bool add_a_is_min_0; -+ -+ /* Check whether OP_ADD's A argumennt comes from a live MAX(x, 0), -+ * before we clear previous live state. -+ */ -+ lri_add_a = raddr_add_a_to_live_reg_index(inst); -+ add_a_is_min_0 = (lri_add_a != ~0 && -+ validation_state->live_max_clamp_regs[lri_add_a]); -+ -+ /* Clear live state for registers written by our instruction. */ -+ lri_add = waddr_to_live_reg_index(waddr_add, ws); -+ lri_mul = waddr_to_live_reg_index(waddr_mul, !ws); -+ if (lri_mul != ~0) { -+ validation_state->live_max_clamp_regs[lri_mul] = false; -+ validation_state->live_min_clamp_offsets[lri_mul] = ~0; -+ } -+ if (lri_add != ~0) { -+ validation_state->live_max_clamp_regs[lri_add] = false; -+ validation_state->live_min_clamp_offsets[lri_add] = ~0; -+ } else { -+ /* Nothing further to do for live tracking, since only ADDs -+ * generate new live clamp registers. -+ */ -+ return; ++ priv_data = devm_kzalloc(&i2c->dev, sizeof *priv_data, GFP_KERNEL); ++ if (!priv_data) ++ return -ENOMEM; ++ ++ priv_data->regmap = devm_regmap_init_i2c(i2c, &tas5713_regmap_config); ++ if (IS_ERR(priv_data->regmap)) { ++ ret = PTR_ERR(priv_data->regmap); ++ return ret; + } + -+ /* Now, handle remaining live clamp tracking for the ADD operation. */ ++ i2c_set_clientdata(i2c, priv_data); + -+ if (cond_add != QPU_COND_ALWAYS) -+ return; ++ ret = snd_soc_register_codec(&i2c->dev, ++ &soc_codec_dev_tas5713, &tas5713_dai, 1); + -+ if (op_add == QPU_A_MAX) { -+ /* Track live clamps of a value to a minimum of 0 (in either -+ * arg). -+ */ -+ if (sig != QPU_SIG_SMALL_IMM || raddr_b != 0 || -+ (add_a != QPU_MUX_B && add_b != QPU_MUX_B)) { -+ return; -+ } ++ return ret; ++} + -+ validation_state->live_max_clamp_regs[lri_add] = true; -+ } if (op_add == QPU_A_MIN) { -+ /* Track live clamps of a value clamped to a minimum of 0 and -+ * a maximum of some uniform's offset. -+ */ -+ if (!add_a_is_min_0) -+ return; + -+ if (!(add_b == QPU_MUX_A && raddr_a == QPU_R_UNIF) && -+ !(add_b == QPU_MUX_B && raddr_b == QPU_R_UNIF && -+ sig != QPU_SIG_SMALL_IMM)) { -+ return; -+ } ++static int tas5713_i2c_remove(struct i2c_client *i2c) ++{ ++ snd_soc_unregister_codec(&i2c->dev); ++ i2c_set_clientdata(i2c, NULL); + -+ validation_state->live_min_clamp_offsets[lri_add] = -+ validated_shader->uniforms_size; -+ } ++ kfree(priv_data); ++ ++ return 0; +} + -+static bool -+check_instruction_writes(uint64_t inst, -+ struct vc4_validated_shader_info *validated_shader, -+ struct vc4_shader_validation_state *validation_state) -+{ -+ uint32_t waddr_add = QPU_GET_FIELD(inst, QPU_WADDR_ADD); -+ uint32_t waddr_mul = QPU_GET_FIELD(inst, QPU_WADDR_MUL); -+ bool ok; + -+ if (is_tmu_write(waddr_add) && is_tmu_write(waddr_mul)) { -+ DRM_ERROR("ADD and MUL both set up textures\n"); -+ return false; -+ } ++static const struct i2c_device_id tas5713_i2c_id[] = { ++ { "tas5713", 0 }, ++ { } ++}; + -+ ok = (check_register_write(inst, validated_shader, validation_state, false) && -+ check_register_write(inst, validated_shader, validation_state, true)); ++MODULE_DEVICE_TABLE(i2c, tas5713_i2c_id); + -+ track_live_clamps(inst, validated_shader, validation_state); + -+ return ok; -+} ++static struct i2c_driver tas5713_i2c_driver = { ++ .driver = { ++ .name = "tas5713", ++ .owner = THIS_MODULE, ++ .of_match_table = tas5713_of_match, ++ }, ++ .probe = tas5713_i2c_probe, ++ .remove = tas5713_i2c_remove, ++ .id_table = tas5713_i2c_id ++}; + -+static bool -+check_instruction_reads(uint64_t inst, -+ struct vc4_validated_shader_info *validated_shader) ++ ++static int __init tas5713_modinit(void) +{ -+ uint32_t raddr_a = QPU_GET_FIELD(inst, QPU_RADDR_A); -+ uint32_t raddr_b = QPU_GET_FIELD(inst, QPU_RADDR_B); -+ uint32_t sig = QPU_GET_FIELD(inst, QPU_SIG); ++ int ret = 0; + -+ if (raddr_a == QPU_R_UNIF || -+ (raddr_b == QPU_R_UNIF && sig != QPU_SIG_SMALL_IMM)) { -+ /* This can't overflow the uint32_t, because we're reading 8 -+ * bytes of instruction to increment by 4 here, so we'd -+ * already be OOM. -+ */ -+ validated_shader->uniforms_size += 4; ++ ret = i2c_add_driver(&tas5713_i2c_driver); ++ if (ret) { ++ printk(KERN_ERR "Failed to register tas5713 I2C driver: %d\n", ++ ret); + } + -+ return true; ++ return ret; +} ++module_init(tas5713_modinit); ++ + -+struct vc4_validated_shader_info * -+vc4_validate_shader(struct drm_gem_cma_object *shader_obj) ++static void __exit tas5713_exit(void) +{ -+ bool found_shader_end = false; -+ int shader_end_ip = 0; -+ uint32_t ip, max_ip; -+ uint64_t *shader; -+ struct vc4_validated_shader_info *validated_shader; -+ struct vc4_shader_validation_state validation_state; -+ int i; ++ i2c_del_driver(&tas5713_i2c_driver); ++} ++module_exit(tas5713_exit); + -+ memset(&validation_state, 0, sizeof(validation_state)); + -+ for (i = 0; i < 8; i++) -+ validation_state.tmu_setup[i / 4].p_offset[i % 4] = ~0; -+ for (i = 0; i < ARRAY_SIZE(validation_state.live_min_clamp_offsets); i++) -+ validation_state.live_min_clamp_offsets[i] = ~0; ++MODULE_AUTHOR("Sebastian Eickhoff <basti.eickhoff@googlemail.com>"); ++MODULE_DESCRIPTION("ASoC driver for TAS5713"); ++MODULE_LICENSE("GPL v2"); +diff --git a/sound/soc/codecs/tas5713.h b/sound/soc/codecs/tas5713.h +new file mode 100644 +index 0000000..8f019e0 +--- /dev/null ++++ b/sound/soc/codecs/tas5713.h +@@ -0,0 +1,210 @@ ++/* ++ * ASoC Driver for TAS5713 ++ * ++ * Author: Sebastian Eickhoff <basti.eickhoff@googlemail.com> ++ * Copyright 2014 ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * version 2 as published by the Free Software Foundation. ++ * ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * General Public License for more details. ++ */ + -+ shader = shader_obj->vaddr; -+ max_ip = shader_obj->base.size / sizeof(uint64_t); ++#ifndef _TAS5713_H ++#define _TAS5713_H + -+ validated_shader = kcalloc(sizeof(*validated_shader), 1, GFP_KERNEL); -+ if (!validated_shader) -+ return NULL; + -+ for (ip = 0; ip < max_ip; ip++) { -+ uint64_t inst = shader[ip]; -+ uint32_t sig = QPU_GET_FIELD(inst, QPU_SIG); -+ -+ switch (sig) { -+ case QPU_SIG_NONE: -+ case QPU_SIG_WAIT_FOR_SCOREBOARD: -+ case QPU_SIG_SCOREBOARD_UNLOCK: -+ case QPU_SIG_COLOR_LOAD: -+ case QPU_SIG_LOAD_TMU0: -+ case QPU_SIG_LOAD_TMU1: -+ case QPU_SIG_PROG_END: -+ case QPU_SIG_SMALL_IMM: -+ if (!check_instruction_writes(inst, validated_shader, -+ &validation_state)) { -+ DRM_ERROR("Bad write at ip %d\n", ip); -+ goto fail; -+ } ++// TAS5713 I2C-bus register addresses + -+ if (!check_instruction_reads(inst, validated_shader)) -+ goto fail; ++#define TAS5713_CLOCK_CTRL 0x00 ++#define TAS5713_DEVICE_ID 0x01 ++#define TAS5713_ERROR_STATUS 0x02 ++#define TAS5713_SYSTEM_CTRL1 0x03 ++#define TAS5713_SERIAL_DATA_INTERFACE 0x04 ++#define TAS5713_SYSTEM_CTRL2 0x05 ++#define TAS5713_SOFT_MUTE 0x06 ++#define TAS5713_VOL_MASTER 0x07 ++#define TAS5713_VOL_CH1 0x08 ++#define TAS5713_VOL_CH2 0x09 ++#define TAS5713_VOL_HEADPHONE 0x0A ++#define TAS5713_VOL_CONFIG 0x0E ++#define TAS5713_MODULATION_LIMIT 0x10 ++#define TAS5713_IC_DLY_CH1 0x11 ++#define TAS5713_IC_DLY_CH2 0x12 ++#define TAS5713_IC_DLY_CH3 0x13 ++#define TAS5713_IC_DLY_CH4 0x14 + -+ if (sig == QPU_SIG_PROG_END) { -+ found_shader_end = true; -+ shader_end_ip = ip; -+ } ++#define TAS5713_START_STOP_PERIOD 0x1A ++#define TAS5713_OSC_TRIM 0x1B ++#define TAS5713_BKND_ERR 0x1C + -+ break; ++#define TAS5713_INPUT_MUX 0x20 ++#define TAS5713_SRC_SELECT_CH4 0x21 ++#define TAS5713_PWM_MUX 0x25 + -+ case QPU_SIG_LOAD_IMM: -+ if (!check_instruction_writes(inst, validated_shader, -+ &validation_state)) { -+ DRM_ERROR("Bad LOAD_IMM write at ip %d\n", ip); -+ goto fail; -+ } -+ break; ++#define TAS5713_CH1_BQ0 0x29 ++#define TAS5713_CH1_BQ1 0x2A ++#define TAS5713_CH1_BQ2 0x2B ++#define TAS5713_CH1_BQ3 0x2C ++#define TAS5713_CH1_BQ4 0x2D ++#define TAS5713_CH1_BQ5 0x2E ++#define TAS5713_CH1_BQ6 0x2F ++#define TAS5713_CH1_BQ7 0x58 ++#define TAS5713_CH1_BQ8 0x59 + -+ default: -+ DRM_ERROR("Unsupported QPU signal %d at " -+ "instruction %d\n", sig, ip); -+ goto fail; -+ } ++#define TAS5713_CH2_BQ0 0x30 ++#define TAS5713_CH2_BQ1 0x31 ++#define TAS5713_CH2_BQ2 0x32 ++#define TAS5713_CH2_BQ3 0x33 ++#define TAS5713_CH2_BQ4 0x34 ++#define TAS5713_CH2_BQ5 0x35 ++#define TAS5713_CH2_BQ6 0x36 ++#define TAS5713_CH2_BQ7 0x5C ++#define TAS5713_CH2_BQ8 0x5D + -+ /* There are two delay slots after program end is signaled -+ * that are still executed, then we're finished. -+ */ -+ if (found_shader_end && ip == shader_end_ip + 2) -+ break; -+ } ++#define TAS5713_CH4_BQ0 0x5A ++#define TAS5713_CH4_BQ1 0x5B ++#define TAS5713_CH3_BQ0 0x5E ++#define TAS5713_CH3_BQ1 0x5F + -+ if (ip == max_ip) { -+ DRM_ERROR("shader failed to terminate before " -+ "shader BO end at %d\n", -+ shader_obj->base.size); -+ goto fail; -+ } ++#define TAS5713_DRC1_SOFTENING_FILTER_ALPHA_OMEGA 0x3B ++#define TAS5713_DRC1_ATTACK_RELEASE_RATE 0x3C ++#define TAS5713_DRC2_SOFTENING_FILTER_ALPHA_OMEGA 0x3E ++#define TAS5713_DRC2_ATTACK_RELEASE_RATE 0x3F ++#define TAS5713_DRC1_ATTACK_RELEASE_THRES 0x40 ++#define TAS5713_DRC2_ATTACK_RELEASE_THRES 0x43 ++#define TAS5713_DRC_CTRL 0x46 + -+ /* Again, no chance of integer overflow here because the worst case -+ * scenario is 8 bytes of uniforms plus handles per 8-byte -+ * instruction. -+ */ -+ validated_shader->uniforms_src_size = -+ (validated_shader->uniforms_size + -+ 4 * validated_shader->num_texture_samples); ++#define TAS5713_BANK_SW_CTRL 0x50 ++#define TAS5713_CH1_OUTPUT_MIXER 0x51 ++#define TAS5713_CH2_OUTPUT_MIXER 0x52 ++#define TAS5713_CH1_INPUT_MIXER 0x53 ++#define TAS5713_CH2_INPUT_MIXER 0x54 ++#define TAS5713_OUTPUT_POST_SCALE 0x56 ++#define TAS5713_OUTPUT_PRESCALE 0x57 + -+ return validated_shader; ++#define TAS5713_IDF_POST_SCALE 0x62 + -+fail: -+ if (validated_shader) { -+ kfree(validated_shader->texture_samples); -+ kfree(validated_shader); -+ } -+ return NULL; -+} -diff --git a/include/uapi/drm/vc4_drm.h b/include/uapi/drm/vc4_drm.h -new file mode 100644 -index 0000000..499daae5 ---- /dev/null -+++ b/include/uapi/drm/vc4_drm.h -@@ -0,0 +1,229 @@ -+/* -+ * Copyright © 2014-2015 Broadcom -+ * -+ * Permission is hereby granted, free of charge, to any person obtaining a -+ * copy of this software and associated documentation files (the "Software"), -+ * to deal in the Software without restriction, including without limitation -+ * the rights to use, copy, modify, merge, publish, distribute, sublicense, -+ * and/or sell copies of the Software, and to permit persons to whom the -+ * Software is furnished to do so, subject to the following conditions: -+ * -+ * The above copyright notice and this permission notice (including the next -+ * paragraph) shall be included in all copies or substantial portions of the -+ * Software. -+ * -+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -+ * IN THE SOFTWARE. -+ */ -+ -+#ifndef _UAPI_VC4_DRM_H_ -+#define _UAPI_VC4_DRM_H_ -+ -+#include <drm/drm.h> -+ -+#define DRM_VC4_SUBMIT_CL 0x00 -+#define DRM_VC4_WAIT_SEQNO 0x01 -+#define DRM_VC4_WAIT_BO 0x02 -+#define DRM_VC4_CREATE_BO 0x03 -+#define DRM_VC4_MMAP_BO 0x04 -+#define DRM_VC4_CREATE_SHADER_BO 0x05 -+ -+#define DRM_IOCTL_VC4_SUBMIT_CL DRM_IOWR( DRM_COMMAND_BASE + DRM_VC4_SUBMIT_CL, struct drm_vc4_submit_cl) -+#define DRM_IOCTL_VC4_WAIT_SEQNO DRM_IOWR( DRM_COMMAND_BASE + DRM_VC4_WAIT_SEQNO, struct drm_vc4_wait_seqno) -+#define DRM_IOCTL_VC4_WAIT_BO DRM_IOWR( DRM_COMMAND_BASE + DRM_VC4_WAIT_BO, struct drm_vc4_wait_bo) -+#define DRM_IOCTL_VC4_CREATE_BO DRM_IOWR( DRM_COMMAND_BASE + DRM_VC4_CREATE_BO, struct drm_vc4_create_bo) -+#define DRM_IOCTL_VC4_MMAP_BO DRM_IOWR( DRM_COMMAND_BASE + DRM_VC4_MMAP_BO, struct drm_vc4_mmap_bo) -+#define DRM_IOCTL_VC4_CREATE_SHADER_BO DRM_IOWR( DRM_COMMAND_BASE + DRM_VC4_CREATE_SHADER_BO, struct drm_vc4_create_shader_bo) -+ -+struct drm_vc4_submit_rcl_surface { -+ uint32_t hindex; /* Handle index, or ~0 if not present. */ -+ uint32_t offset; /* Offset to start of buffer. */ -+ /* -+ * Bits for either render config (color_ms_write) or load/store packet. -+ */ -+ uint16_t bits; -+ uint16_t pad; -+}; ++#define TAS5713_CH1_INLINE_MIXER 0x70 ++#define TAS5713_CH1_INLINE_DRC_EN_MIXER 0x71 ++#define TAS5713_CH1_R_CHANNEL_MIXER 0x72 ++#define TAS5713_CH1_L_CHANNEL_MIXER 0x73 ++#define TAS5713_CH2_INLINE_MIXER 0x74 ++#define TAS5713_CH2_INLINE_DRC_EN_MIXER 0x75 ++#define TAS5713_CH2_L_CHANNEL_MIXER 0x76 ++#define TAS5713_CH2_R_CHANNEL_MIXER 0x77 + -+/** -+ * struct drm_vc4_submit_cl - ioctl argument for submitting commands to the 3D -+ * engine. -+ * -+ * Drivers typically use GPU BOs to store batchbuffers / command lists and -+ * their associated state. However, because the VC4 lacks an MMU, we have to -+ * do validation of memory accesses by the GPU commands. If we were to store -+ * our commands in BOs, we'd need to do uncached readback from them to do the -+ * validation process, which is too expensive. Instead, userspace accumulates -+ * commands and associated state in plain memory, then the kernel copies the -+ * data to its own address space, and then validates and stores it in a GPU -+ * BO. -+ */ -+struct drm_vc4_submit_cl { -+ /* Pointer to the binner command list. -+ * -+ * This is the first set of commands executed, which runs the -+ * coordinate shader to determine where primitives land on the screen, -+ * then writes out the state updates and draw calls necessary per tile -+ * to the tile allocation BO. -+ */ -+ uint64_t bin_cl; ++#define TAS5713_UPDATE_DEV_ADDR_KEY 0xF8 ++#define TAS5713_UPDATE_DEV_ADDR_REG 0xF9 + -+ /* Pointer to the shader records. -+ * -+ * Shader records are the structures read by the hardware that contain -+ * pointers to uniforms, shaders, and vertex attributes. The -+ * reference to the shader record has enough information to determine -+ * how many pointers are necessary (fixed number for shaders/uniforms, -+ * and an attribute count), so those BO indices into bo_handles are -+ * just stored as uint32_ts before each shader record passed in. -+ */ -+ uint64_t shader_rec; ++#define TAS5713_REGISTER_COUNT 0x46 ++#define TAS5713_MAX_REGISTER 0xF9 + -+ /* Pointer to uniform data and texture handles for the textures -+ * referenced by the shader. -+ * -+ * For each shader state record, there is a set of uniform data in the -+ * order referenced by the record (FS, VS, then CS). Each set of -+ * uniform data has a uint32_t index into bo_handles per texture -+ * sample operation, in the order the QPU_W_TMUn_S writes appear in -+ * the program. Following the texture BO handle indices is the actual -+ * uniform data. -+ * -+ * The individual uniform state blocks don't have sizes passed in, -+ * because the kernel has to determine the sizes anyway during shader -+ * code validation. -+ */ -+ uint64_t uniforms; -+ uint64_t bo_handles; -+ -+ /* Size in bytes of the binner command list. */ -+ uint32_t bin_cl_size; -+ /* Size in bytes of the set of shader records. */ -+ uint32_t shader_rec_size; -+ /* Number of shader records. -+ * -+ * This could just be computed from the contents of shader_records and -+ * the address bits of references to them from the bin CL, but it -+ * keeps the kernel from having to resize some allocations it makes. -+ */ -+ uint32_t shader_rec_count; -+ /* Size in bytes of the uniform state. */ -+ uint32_t uniforms_size; -+ -+ /* Number of BO handles passed in (size is that times 4). */ -+ uint32_t bo_handle_count; -+ -+ /* RCL setup: */ -+ uint16_t width; -+ uint16_t height; -+ uint8_t min_x_tile; -+ uint8_t min_y_tile; -+ uint8_t max_x_tile; -+ uint8_t max_y_tile; -+ struct drm_vc4_submit_rcl_surface color_read; -+ struct drm_vc4_submit_rcl_surface color_ms_write; -+ struct drm_vc4_submit_rcl_surface zs_read; -+ struct drm_vc4_submit_rcl_surface zs_write; -+ uint32_t clear_color[2]; -+ uint32_t clear_z; -+ uint8_t clear_s; -+ -+ uint32_t pad:24; -+ -+#define VC4_SUBMIT_CL_USE_CLEAR_COLOR (1 << 0) -+ uint32_t flags; + -+ /* Returned value of the seqno of this render job (for the -+ * wait ioctl). -+ */ -+ uint64_t seqno; -+}; ++// Bitmasks for registers ++#define TAS5713_SOFT_MUTE_ALL 0x07 + -+/** -+ * struct drm_vc4_wait_seqno - ioctl argument for waiting for -+ * DRM_VC4_SUBMIT_CL completion using its returned seqno. -+ * -+ * timeout_ns is the timeout in nanoseconds, where "0" means "don't -+ * block, just return the status." -+ */ -+struct drm_vc4_wait_seqno { -+ uint64_t seqno; -+ uint64_t timeout_ns; -+}; + -+/** -+ * struct drm_vc4_wait_bo - ioctl argument for waiting for -+ * completion of the last DRM_VC4_SUBMIT_CL on a BO. -+ * -+ * This is useful for cases where multiple processes might be -+ * rendering to a BO and you want to wait for all rendering to be -+ * completed. -+ */ -+struct drm_vc4_wait_bo { -+ uint32_t handle; -+ uint32_t pad; -+ uint64_t timeout_ns; -+}; + -+/** -+ * struct drm_vc4_create_bo - ioctl argument for creating VC4 BOs. -+ * -+ * There are currently no values for the flags argument, but it may be -+ * used in a future extension. -+ */ -+struct drm_vc4_create_bo { -+ uint32_t size; -+ uint32_t flags; -+ /** Returned GEM handle for the BO. */ -+ uint32_t handle; -+ uint32_t pad; ++struct tas5713_init_command { ++ const int size; ++ const char *const data; +}; + -+/** -+ * struct drm_vc4_create_shader_bo - ioctl argument for creating VC4 -+ * shader BOs. -+ * -+ * Since allowing a shader to be overwritten while it's also being -+ * executed from would allow privlege escalation, shaders must be -+ * created using this ioctl, and they can't be mmapped later. -+ */ -+struct drm_vc4_create_shader_bo { -+ /* Size of the data argument. */ -+ uint32_t size; -+ /* Flags, currently must be 0. */ -+ uint32_t flags; -+ -+ /* Pointer to the data. */ -+ uint64_t data; -+ -+ /** Returned GEM handle for the BO. */ -+ uint32_t handle; -+ /* Pad, must be 0. */ -+ uint32_t pad; -+}; ++static const struct tas5713_init_command tas5713_init_sequence[] = { + -+/** -+ * struct drm_vc4_mmap_bo - ioctl argument for mapping VC4 BOs. -+ * -+ * This doesn't actually perform an mmap. Instead, it returns the -+ * offset you need to use in an mmap on the DRM device node. This -+ * means that tools like valgrind end up knowing about the mapped -+ * memory. -+ * -+ * There are currently no values for the flags argument, but it may be -+ * used in a future extension. -+ */ -+struct drm_vc4_mmap_bo { -+ /** Handle for the object being mapped. */ -+ uint32_t handle; -+ uint32_t flags; -+ /** offset into the drm node to use for subsequent mmap call. */ -+ uint64_t offset; ++ // Trim oscillator ++ { .size = 2, .data = "\x1B\x00" }, ++ // System control register 1 (0x03): block DC ++ { .size = 2, .data = "\x03\x80" }, ++ // Mute everything ++ { .size = 2, .data = "\x05\x40" }, ++ // Modulation limit register (0x10): 97.7% ++ { .size = 2, .data = "\x10\x02" }, ++ // Interchannel delay registers ++ // (0x11, 0x12, 0x13, and 0x14): BD mode ++ { .size = 2, .data = "\x11\xB8" }, ++ { .size = 2, .data = "\x12\x60" }, ++ { .size = 2, .data = "\x13\xA0" }, ++ { .size = 2, .data = "\x14\x48" }, ++ // PWM shutdown group register (0x19): no shutdown ++ { .size = 2, .data = "\x19\x00" }, ++ // Input multiplexer register (0x20): BD mode ++ { .size = 2, .data = "\x20\x00\x89\x77\x72" }, ++ // PWM output mux register (0x25) ++ // Channel 1 --> OUTA, channel 1 neg --> OUTB ++ // Channel 2 --> OUTC, channel 2 neg --> OUTD ++ { .size = 5, .data = "\x25\x01\x02\x13\x45" }, ++ // DRC control (0x46): DRC off ++ { .size = 5, .data = "\x46\x00\x00\x00\x00" }, ++ // BKND_ERR register (0x1C): 299ms reset period ++ { .size = 2, .data = "\x1C\x07" }, ++ // Mute channel 3 ++ { .size = 2, .data = "\x0A\xFF" }, ++ // Volume configuration register (0x0E): volume slew 512 steps ++ { .size = 2, .data = "\x0E\x90" }, ++ // Clock control register (0x00): 44/48kHz, MCLK=64xfs ++ { .size = 2, .data = "\x00\x60" }, ++ // Bank switch and eq control (0x50): no bank switching ++ { .size = 5, .data = "\x50\x00\x00\x00\x00" }, ++ // Volume registers (0x07, 0x08, 0x09, 0x0A) ++ { .size = 2, .data = "\x07\x20" }, ++ { .size = 2, .data = "\x08\x30" }, ++ { .size = 2, .data = "\x09\x30" }, ++ { .size = 2, .data = "\x0A\xFF" }, ++ // 0x72, 0x73, 0x76, 0x77 input mixer: ++ // no intermix between channels ++ { .size = 5, .data = "\x72\x00\x00\x00\x00" }, ++ { .size = 5, .data = "\x73\x00\x80\x00\x00" }, ++ { .size = 5, .data = "\x76\x00\x00\x00\x00" }, ++ { .size = 5, .data = "\x77\x00\x80\x00\x00" }, ++ // 0x70, 0x71, 0x74, 0x75 inline DRC mixer: ++ // no inline DRC inmix ++ { .size = 5, .data = "\x70\x00\x80\x00\x00" }, ++ { .size = 5, .data = "\x71\x00\x00\x00\x00" }, ++ { .size = 5, .data = "\x74\x00\x80\x00\x00" }, ++ { .size = 5, .data = "\x75\x00\x00\x00\x00" }, ++ // 0x56, 0x57 Output scale ++ { .size = 5, .data = "\x56\x00\x80\x00\x00" }, ++ { .size = 5, .data = "\x57\x00\x02\x00\x00" }, ++ // 0x3B, 0x3c ++ { .size = 9, .data = "\x3B\x00\x08\x00\x00\x00\x78\x00\x00" }, ++ { .size = 9, .data = "\x3C\x00\x00\x01\x00\xFF\xFF\xFF\x00" }, ++ { .size = 9, .data = "\x3E\x00\x08\x00\x00\x00\x78\x00\x00" }, ++ { .size = 9, .data = "\x3F\x00\x00\x01\x00\xFF\xFF\xFF\x00" }, ++ { .size = 9, .data = "\x40\x00\x00\x01\x00\xFF\xFF\xFF\x00" }, ++ { .size = 9, .data = "\x43\x00\x00\x01\x00\xFF\xFF\xFF\x00" }, ++ // 0x51, 0x52: output mixer ++ { .size = 9, .data = "\x51\x00\x80\x00\x00\x00\x00\x00\x00" }, ++ { .size = 9, .data = "\x52\x00\x80\x00\x00\x00\x00\x00\x00" }, ++ // PEQ defaults ++ { .size = 21, .data = "\x29\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, ++ { .size = 21, .data = "\x2A\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, ++ { .size = 21, .data = "\x2B\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, ++ { .size = 21, .data = "\x2C\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, ++ { .size = 21, .data = "\x2D\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, ++ { .size = 21, .data = "\x2E\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, ++ { .size = 21, .data = "\x2F\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, ++ { .size = 21, .data = "\x30\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, ++ { .size = 21, .data = "\x31\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, ++ { .size = 21, .data = "\x32\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, ++ { .size = 21, .data = "\x33\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, ++ { .size = 21, .data = "\x34\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, ++ { .size = 21, .data = "\x35\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, ++ { .size = 21, .data = "\x36\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, ++ { .size = 21, .data = "\x58\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, ++ { .size = 21, .data = "\x59\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, ++ { .size = 21, .data = "\x5C\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, ++ { .size = 21, .data = "\x5D\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, ++ { .size = 21, .data = "\x5E\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, ++ { .size = 21, .data = "\x5F\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, ++ { .size = 21, .data = "\x5A\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, ++ { .size = 21, .data = "\x5B\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, +}; + -+#endif /* _UAPI_VC4_DRM_H_ */ - -From aa579c7485e1bae681c50b223e89cd658dd0b2c1 Mon Sep 17 00:00:00 2001 -From: Eric Anholt <eric@anholt.net> -Date: Wed, 14 Oct 2015 11:32:14 -0700 -Subject: [PATCH 092/170] drm/vc4: Force HDMI to connected. - -For some reason on the downstream tree, the HPD GPIO isn't working. - -Signed-off-by: Eric Anholt <eric@anholt.net> ---- - drivers/gpu/drm/vc4/vc4_hdmi.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c -index da9a36d..d15c529 100644 ---- a/drivers/gpu/drm/vc4/vc4_hdmi.c -+++ b/drivers/gpu/drm/vc4/vc4_hdmi.c -@@ -164,6 +164,8 @@ vc4_hdmi_connector_detect(struct drm_connector *connector, bool force) - struct drm_device *dev = connector->dev; - struct vc4_dev *vc4 = to_vc4_dev(dev); - -+ return connector_status_connected; -+ - if (vc4->hdmi->hpd_gpio) { - if (gpio_get_value(vc4->hdmi->hpd_gpio)) - return connector_status_connected; - -From edb828d91374e8fa4f05d68be008c40d4f9a158d Mon Sep 17 00:00:00 2001 -From: Eric Anholt <eric@anholt.net> -Date: Mon, 19 Oct 2015 08:23:18 -0700 -Subject: [PATCH 093/170] drm/vc4: bo cache locking fixes. - -Signed-off-by: Eric Anholt <eric@anholt.net> ---- - drivers/gpu/drm/vc4/vc4_bo.c | 32 ++++++++++++++++++-------------- - drivers/gpu/drm/vc4/vc4_drv.h | 2 +- - 2 files changed, 19 insertions(+), 15 deletions(-) - -diff --git a/drivers/gpu/drm/vc4/vc4_bo.c b/drivers/gpu/drm/vc4/vc4_bo.c -index bfa605f..af0fde6 100644 ---- a/drivers/gpu/drm/vc4/vc4_bo.c -+++ b/drivers/gpu/drm/vc4/vc4_bo.c -@@ -112,14 +112,14 @@ void vc4_bo_cache_purge(struct drm_device *dev) - { - struct vc4_dev *vc4 = to_vc4_dev(dev); - -- spin_lock(&vc4->bo_lock); -+ mutex_lock(&vc4->bo_lock); - while (!list_empty(&vc4->bo_cache.time_list)) { - struct vc4_bo *bo = list_last_entry(&vc4->bo_cache.time_list, - struct vc4_bo, unref_head); - vc4_bo_remove_from_cache(bo); - vc4_bo_destroy(bo); - } -- spin_unlock(&vc4->bo_lock); -+ mutex_unlock(&vc4->bo_lock); - } - - struct vc4_bo *vc4_bo_create(struct drm_device *dev, size_t unaligned_size) -@@ -134,18 +134,18 @@ struct vc4_bo *vc4_bo_create(struct drm_device *dev, size_t unaligned_size) - return NULL; - - /* First, try to get a vc4_bo from the kernel BO cache. */ -- spin_lock(&vc4->bo_lock); -+ mutex_lock(&vc4->bo_lock); - if (page_index < vc4->bo_cache.size_list_size && - !list_empty(&vc4->bo_cache.size_list[page_index])) { - struct vc4_bo *bo = - list_first_entry(&vc4->bo_cache.size_list[page_index], - struct vc4_bo, size_head); - vc4_bo_remove_from_cache(bo); -- spin_unlock(&vc4->bo_lock); -+ mutex_unlock(&vc4->bo_lock); - kref_init(&bo->base.base.refcount); - return bo; - } -- spin_unlock(&vc4->bo_lock); -+ mutex_unlock(&vc4->bo_lock); - - /* Otherwise, make a new BO. */ - for (pass = 0; ; pass++) { -@@ -215,7 +215,7 @@ vc4_bo_cache_free_old(struct drm_device *dev) - struct vc4_dev *vc4 = to_vc4_dev(dev); - unsigned long expire_time = jiffies - msecs_to_jiffies(1000); - -- spin_lock(&vc4->bo_lock); -+ mutex_lock(&vc4->bo_lock); - while (!list_empty(&vc4->bo_cache.time_list)) { - struct vc4_bo *bo = list_last_entry(&vc4->bo_cache.time_list, - struct vc4_bo, unref_head); -@@ -223,14 +223,14 @@ vc4_bo_cache_free_old(struct drm_device *dev) - mod_timer(&vc4->bo_cache.time_timer, - round_jiffies_up(jiffies + - msecs_to_jiffies(1000))); -- spin_unlock(&vc4->bo_lock); -+ mutex_unlock(&vc4->bo_lock); - return; - } - - vc4_bo_remove_from_cache(bo); - vc4_bo_destroy(bo); - } -- spin_unlock(&vc4->bo_lock); -+ mutex_unlock(&vc4->bo_lock); - } - - /* Called on the last userspace/kernel unreference of the BO. Returns -@@ -248,21 +248,25 @@ void vc4_free_object(struct drm_gem_object *gem_bo) - /* If the object references someone else's memory, we can't cache it. - */ - if (gem_bo->import_attach) { -+ mutex_lock(&vc4->bo_lock); - vc4_bo_destroy(bo); -+ mutex_unlock(&vc4->bo_lock); - return; - } - - /* Don't cache if it was publicly named. */ - if (gem_bo->name) { -+ mutex_lock(&vc4->bo_lock); - vc4_bo_destroy(bo); -+ mutex_unlock(&vc4->bo_lock); - return; - } - -- spin_lock(&vc4->bo_lock); -+ mutex_lock(&vc4->bo_lock); - cache_list = vc4_get_cache_list_for_size(dev, gem_bo->size); - if (!cache_list) { - vc4_bo_destroy(bo); -- spin_unlock(&vc4->bo_lock); -+ mutex_unlock(&vc4->bo_lock); - return; - } - -@@ -278,7 +282,7 @@ void vc4_free_object(struct drm_gem_object *gem_bo) - - vc4->bo_stats.num_cached++; - vc4->bo_stats.size_cached += gem_bo->size; -- spin_unlock(&vc4->bo_lock); -+ mutex_unlock(&vc4->bo_lock); - - vc4_bo_cache_free_old(dev); - } -@@ -465,7 +469,7 @@ void vc4_bo_cache_init(struct drm_device *dev) - { - struct vc4_dev *vc4 = to_vc4_dev(dev); - -- spin_lock_init(&vc4->bo_lock); -+ mutex_init(&vc4->bo_lock); - - INIT_LIST_HEAD(&vc4->bo_cache.time_list); - -@@ -498,9 +502,9 @@ int vc4_bo_stats_debugfs(struct seq_file *m, void *unused) - struct vc4_dev *vc4 = to_vc4_dev(dev); - struct vc4_bo_stats stats; - -- spin_lock(&vc4->bo_lock); -+ mutex_lock(&vc4->bo_lock); - stats = vc4->bo_stats; -- spin_unlock(&vc4->bo_lock); -+ mutex_unlock(&vc4->bo_lock); - - seq_printf(m, "num bos allocated: %d\n", stats.num_allocated); - seq_printf(m, "size bos allocated: %dkb\n", stats.size_allocated / 1024); -diff --git a/drivers/gpu/drm/vc4/vc4_drv.h b/drivers/gpu/drm/vc4/vc4_drv.h -index 8cc89d1..c079b82 100644 ---- a/drivers/gpu/drm/vc4/vc4_drv.h -+++ b/drivers/gpu/drm/vc4/vc4_drv.h -@@ -49,7 +49,7 @@ struct vc4_dev { - } bo_stats; - - /* Protects bo_cache and the BO stats. */ -- spinlock_t bo_lock; -+ struct mutex bo_lock; - - /* Sequence number for the last job queued in job_list. - * Starts at 0 (no jobs emitted). - -From eafd7a031a15fb0d51a86b89e42ccde4f23434b4 Mon Sep 17 00:00:00 2001 -From: Eric Anholt <eric@anholt.net> -Date: Mon, 19 Oct 2015 08:29:41 -0700 -Subject: [PATCH 094/170] drm/vc4: bo cache locking cleanup. - -Signed-off-by: Eric Anholt <eric@anholt.net> ---- - drivers/gpu/drm/vc4/vc4_bo.c | 22 +++++++++------------- - 1 file changed, 9 insertions(+), 13 deletions(-) - -diff --git a/drivers/gpu/drm/vc4/vc4_bo.c b/drivers/gpu/drm/vc4/vc4_bo.c -index af0fde6..acd360c 100644 ---- a/drivers/gpu/drm/vc4/vc4_bo.c -+++ b/drivers/gpu/drm/vc4/vc4_bo.c -@@ -215,7 +215,6 @@ vc4_bo_cache_free_old(struct drm_device *dev) - struct vc4_dev *vc4 = to_vc4_dev(dev); - unsigned long expire_time = jiffies - msecs_to_jiffies(1000); - -- mutex_lock(&vc4->bo_lock); - while (!list_empty(&vc4->bo_cache.time_list)) { - struct vc4_bo *bo = list_last_entry(&vc4->bo_cache.time_list, - struct vc4_bo, unref_head); -@@ -223,14 +222,12 @@ vc4_bo_cache_free_old(struct drm_device *dev) - mod_timer(&vc4->bo_cache.time_timer, - round_jiffies_up(jiffies + - msecs_to_jiffies(1000))); -- mutex_unlock(&vc4->bo_lock); - return; - } - - vc4_bo_remove_from_cache(bo); - vc4_bo_destroy(bo); - } -- mutex_unlock(&vc4->bo_lock); - } - - /* Called on the last userspace/kernel unreference of the BO. Returns -@@ -245,29 +242,24 @@ void vc4_free_object(struct drm_gem_object *gem_bo) - struct vc4_bo *bo = to_vc4_bo(gem_bo); - struct list_head *cache_list; - -+ mutex_lock(&vc4->bo_lock); - /* If the object references someone else's memory, we can't cache it. - */ - if (gem_bo->import_attach) { -- mutex_lock(&vc4->bo_lock); - vc4_bo_destroy(bo); -- mutex_unlock(&vc4->bo_lock); -- return; -+ goto out; - } - - /* Don't cache if it was publicly named. */ - if (gem_bo->name) { -- mutex_lock(&vc4->bo_lock); - vc4_bo_destroy(bo); -- mutex_unlock(&vc4->bo_lock); -- return; -+ goto out; - } - -- mutex_lock(&vc4->bo_lock); - cache_list = vc4_get_cache_list_for_size(dev, gem_bo->size); - if (!cache_list) { - vc4_bo_destroy(bo); -- mutex_unlock(&vc4->bo_lock); -- return; -+ goto out; - } - - if (bo->validated_shader) { -@@ -282,9 +274,11 @@ void vc4_free_object(struct drm_gem_object *gem_bo) - - vc4->bo_stats.num_cached++; - vc4->bo_stats.size_cached += gem_bo->size; -- mutex_unlock(&vc4->bo_lock); - - vc4_bo_cache_free_old(dev); -+ -+out: -+ mutex_unlock(&vc4->bo_lock); - } - - static void vc4_bo_cache_time_work(struct work_struct *work) -@@ -293,7 +287,9 @@ static void vc4_bo_cache_time_work(struct work_struct *work) - container_of(work, struct vc4_dev, bo_cache.time_work); - struct drm_device *dev = vc4->dev; - -+ mutex_lock(&vc4->bo_lock); - vc4_bo_cache_free_old(dev); -+ mutex_unlock(&vc4->bo_lock); - } - - static void vc4_bo_cache_time_timer(unsigned long data) - -From 482f2b3e97e919ac0ebc55a6040747495563b9a7 Mon Sep 17 00:00:00 2001 -From: Eric Anholt <eric@anholt.net> -Date: Mon, 19 Oct 2015 08:32:24 -0700 -Subject: [PATCH 095/170] drm/vc4: Use job_lock to protect seqno_cb_list. - -We're (mostly) not supposed to be using struct_mutex in drivers these -days. - -Signed-off-by: Eric Anholt <eric@anholt.net> ---- - drivers/gpu/drm/vc4/vc4_gem.c | 8 +++++--- - 1 file changed, 5 insertions(+), 3 deletions(-) - -diff --git a/drivers/gpu/drm/vc4/vc4_gem.c b/drivers/gpu/drm/vc4/vc4_gem.c -index 361390b..b1853b2 100644 ---- a/drivers/gpu/drm/vc4/vc4_gem.c -+++ b/drivers/gpu/drm/vc4/vc4_gem.c -@@ -474,7 +474,6 @@ vc4_job_handle_completed(struct vc4_dev *vc4) - vc4_complete_exec(exec); - spin_lock_irqsave(&vc4->job_lock, irqflags); - } -- spin_unlock_irqrestore(&vc4->job_lock, irqflags); - - list_for_each_entry_safe(cb, cb_temp, &vc4->seqno_cb_list, work.entry) { - if (cb->seqno <= vc4->finished_seqno) { -@@ -482,6 +481,8 @@ vc4_job_handle_completed(struct vc4_dev *vc4) - schedule_work(&cb->work); - } - } + -+ spin_unlock_irqrestore(&vc4->job_lock, irqflags); - } - - static void vc4_seqno_cb_work(struct work_struct *work) -@@ -496,18 +497,19 @@ int vc4_queue_seqno_cb(struct drm_device *dev, - { - struct vc4_dev *vc4 = to_vc4_dev(dev); - int ret = 0; -+ unsigned long irqflags; - - cb->func = func; - INIT_WORK(&cb->work, vc4_seqno_cb_work); - -- mutex_lock(&dev->struct_mutex); -+ spin_lock_irqsave(&vc4->job_lock, irqflags); - if (seqno > vc4->finished_seqno) { - cb->seqno = seqno; - list_add_tail(&cb->work.entry, &vc4->seqno_cb_list); - } else { - schedule_work(&cb->work); - } -- mutex_unlock(&dev->struct_mutex); -+ spin_unlock_irqrestore(&vc4->job_lock, irqflags); - - return ret; - } - -From 4dc15a296586679d5b014011e44a093cf962123e Mon Sep 17 00:00:00 2001 -From: Eric Anholt <eric@anholt.net> -Date: Mon, 19 Oct 2015 08:44:35 -0700 -Subject: [PATCH 096/170] drm/vc4: Drop struct_mutex around CL validation. - -We were using it so that we could make sure that shader validation -state didn't change while we were validating, but now shader -validation state is immutable. The bcl/rcl generation doesn't do any -other BO dereferencing, and seems to have no other global state -dependency not covered by job_lock / bo_lock. ++#endif /* _TAS5713_H */ -Fixes a lock order reversal between mmap_sem and struct_mutex. +From c3ed64332c5f99c98c467d4640a94a63d8b0554f Mon Sep 17 00:00:00 2001 +From: Ryan Coe <bluemrp9@gmail.com> +Date: Sat, 31 Jan 2015 18:25:49 -0700 +Subject: [PATCH 074/112] Update ds1307 driver for device-tree support -Signed-off-by: Eric Anholt <eric@anholt.net> +Signed-off-by: Ryan Coe <bluemrp9@gmail.com> --- - drivers/gpu/drm/vc4/vc4_gem.c | 12 ++++-------- - 1 file changed, 4 insertions(+), 8 deletions(-) + drivers/rtc/rtc-ds1307.c | 8 ++++++++ + 1 file changed, 8 insertions(+) -diff --git a/drivers/gpu/drm/vc4/vc4_gem.c b/drivers/gpu/drm/vc4/vc4_gem.c -index b1853b2..32f375a 100644 ---- a/drivers/gpu/drm/vc4/vc4_gem.c -+++ b/drivers/gpu/drm/vc4/vc4_gem.c -@@ -244,13 +244,15 @@ static void - vc4_queue_submit(struct drm_device *dev, struct vc4_exec_info *exec) - { - struct vc4_dev *vc4 = to_vc4_dev(dev); -- uint64_t seqno = ++vc4->emit_seqno; -+ uint64_t seqno; - unsigned long irqflags; - -+ spin_lock_irqsave(&vc4->job_lock, irqflags); -+ -+ seqno = ++vc4->emit_seqno; - exec->seqno = seqno; - vc4_update_bo_seqnos(exec, seqno); - -- spin_lock_irqsave(&vc4->job_lock, irqflags); - list_add_tail(&exec->head, &vc4->job_list); - - /* If no job was executing, kick ours off. Otherwise, it'll -@@ -608,8 +610,6 @@ vc4_submit_cl_ioctl(struct drm_device *dev, void *data, - exec->args = args; - INIT_LIST_HEAD(&exec->unref_list); - -- mutex_lock(&dev->struct_mutex); -- - ret = vc4_cl_lookup_bos(dev, file_priv, exec); - if (ret) - goto fail; -@@ -636,15 +636,11 @@ vc4_submit_cl_ioctl(struct drm_device *dev, void *data, - /* Return the seqno for our job. */ - args->seqno = vc4->emit_seqno; - -- mutex_unlock(&dev->struct_mutex); -- +diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c +index e94eb09..f5d93be 100644 +--- a/drivers/rtc/rtc-ds1307.c ++++ b/drivers/rtc/rtc-ds1307.c +@@ -1608,6 +1608,14 @@ static int ds1307_remove(struct i2c_client *client) return 0; - - fail: - vc4_complete_exec(exec); - -- mutex_unlock(&dev->struct_mutex); -- - return ret; } ++#ifdef CONFIG_OF ++static const struct of_device_id ds1307_of_match[] = { ++ { .compatible = "maxim,ds1307" }, ++ { } ++}; ++MODULE_DEVICE_TABLE(of, ds1307_of_match); ++#endif ++ + static struct i2c_driver ds1307_driver = { + .driver = { + .name = "rtc-ds1307", -From f1924e632d16f98eee1fe1be636249b8cee4ee6e Mon Sep 17 00:00:00 2001 -From: Eric Anholt <eric@anholt.net> -Date: Mon, 19 Oct 2015 08:44:35 -0700 -Subject: [PATCH 097/170] drm/vc4: Drop struct_mutex around CL validation. - -We were using it so that we could make sure that shader validation -state didn't change while we were validating, but now shader -validation state is immutable. The bcl/rcl generation doesn't do any -other BO dereferencing, and seems to have no other global state -dependency not covered by job_lock / bo_lock. We only need to hold -struct_mutex for object unreferencing. - -Fixes a lock order reversal between mmap_sem and struct_mutex. +From 0cb5de060ca2b6655d39f5e2368439b5e1f0d8f2 Mon Sep 17 00:00:00 2001 +From: Phil Elwell <phil@raspberrypi.org> +Date: Fri, 27 Feb 2015 15:10:24 +0000 +Subject: [PATCH 075/112] enc28j60: Add device tree compatible string and an + overlay -Signed-off-by: Eric Anholt <eric@anholt.net> --- - drivers/gpu/drm/vc4/vc4_gem.c | 13 ++++++------- - 1 file changed, 6 insertions(+), 7 deletions(-) + drivers/net/ethernet/microchip/enc28j60.c | 7 +++++++ + 1 file changed, 7 insertions(+) -diff --git a/drivers/gpu/drm/vc4/vc4_gem.c b/drivers/gpu/drm/vc4/vc4_gem.c -index 32f375a..55551ea 100644 ---- a/drivers/gpu/drm/vc4/vc4_gem.c -+++ b/drivers/gpu/drm/vc4/vc4_gem.c -@@ -439,10 +439,12 @@ vc4_get_bcl(struct drm_device *dev, struct vc4_exec_info *exec) - } - - static void --vc4_complete_exec(struct vc4_exec_info *exec) -+vc4_complete_exec(struct drm_device *dev, struct vc4_exec_info *exec) - { - unsigned i; - -+ /* Need the struct lock for drm_gem_object_unreference(). */ -+ mutex_lock(&dev->struct_mutex); - if (exec->bo) { - for (i = 0; i < exec->bo_count; i++) - drm_gem_object_unreference(&exec->bo[i].bo->base); -@@ -455,6 +457,7 @@ vc4_complete_exec(struct vc4_exec_info *exec) - list_del(&bo->unref_head); - drm_gem_object_unreference(&bo->base.base); - } -+ mutex_unlock(&dev->struct_mutex); - - kfree(exec); - } -@@ -473,7 +476,7 @@ vc4_job_handle_completed(struct vc4_dev *vc4) - list_del(&exec->head); - - spin_unlock_irqrestore(&vc4->job_lock, irqflags); -- vc4_complete_exec(exec); -+ vc4_complete_exec(vc4->dev, exec); - spin_lock_irqsave(&vc4->job_lock, irqflags); - } - -@@ -525,12 +528,8 @@ vc4_job_done_work(struct work_struct *work) - { - struct vc4_dev *vc4 = - container_of(work, struct vc4_dev, job_done_work); -- struct drm_device *dev = vc4->dev; - -- /* Need the struct lock for drm_gem_object_unreference(). */ -- mutex_lock(&dev->struct_mutex); - vc4_job_handle_completed(vc4); -- mutex_unlock(&dev->struct_mutex); - } - - static int -@@ -639,7 +638,7 @@ vc4_submit_cl_ioctl(struct drm_device *dev, void *data, +diff --git a/drivers/net/ethernet/microchip/enc28j60.c b/drivers/net/ethernet/microchip/enc28j60.c +index 86ea17e..a1b20c1 100644 +--- a/drivers/net/ethernet/microchip/enc28j60.c ++++ b/drivers/net/ethernet/microchip/enc28j60.c +@@ -1630,9 +1630,16 @@ static int enc28j60_remove(struct spi_device *spi) return 0; - - fail: -- vc4_complete_exec(exec); -+ vc4_complete_exec(vc4->dev, exec); - - return ret; } - -From 0193a1e5b931c7363279282b4169c2152af1a621 Mon Sep 17 00:00:00 2001 -From: Eric Anholt <eric@anholt.net> -Date: Tue, 20 Oct 2015 13:59:15 +0100 -Subject: [PATCH 098/170] drm/vc4: Add support for more display plane formats. - -Signed-off-by: Eric Anholt <eric@anholt.net> ---- - drivers/gpu/drm/vc4/vc4_plane.c | 16 ++++++++++++++++ - 1 file changed, 16 insertions(+) - -diff --git a/drivers/gpu/drm/vc4/vc4_plane.c b/drivers/gpu/drm/vc4/vc4_plane.c -index 65e5455..0f85eb5 100644 ---- a/drivers/gpu/drm/vc4/vc4_plane.c -+++ b/drivers/gpu/drm/vc4/vc4_plane.c -@@ -59,6 +59,22 @@ static const struct hvs_format { - .drm = DRM_FORMAT_ARGB8888, .hvs = HVS_PIXEL_FORMAT_RGBA8888, - .pixel_order = HVS_PIXEL_ORDER_ABGR, .has_alpha = true, - }, -+ { -+ .drm = DRM_FORMAT_RGB565, .hvs = HVS_PIXEL_FORMAT_RGB565, -+ .pixel_order = HVS_PIXEL_ORDER_XRGB, .has_alpha = false, -+ }, -+ { -+ .drm = DRM_FORMAT_BGR565, .hvs = HVS_PIXEL_FORMAT_RGB565, -+ .pixel_order = HVS_PIXEL_ORDER_XBGR, .has_alpha = false, -+ }, -+ { -+ .drm = DRM_FORMAT_ARGB1555, .hvs = HVS_PIXEL_FORMAT_RGBA5551, -+ .pixel_order = HVS_PIXEL_ORDER_ABGR, .has_alpha = true, -+ }, -+ { -+ .drm = DRM_FORMAT_XRGB1555, .hvs = HVS_PIXEL_FORMAT_RGBA5551, -+ .pixel_order = HVS_PIXEL_ORDER_ABGR, .has_alpha = false, -+ }, - }; - - static const struct hvs_format *vc4_get_hvs_format(u32 drm_format) - -From 8faa3b83201819d56f997a2b2ecaf8c690080852 Mon Sep 17 00:00:00 2001 -From: Eric Anholt <eric@anholt.net> -Date: Fri, 23 Oct 2015 12:31:56 +0100 -Subject: [PATCH 099/170] drm/vc4: No need to stop the stopped threads. - -This was leftover debug code from the hackdriver. We never submit -unless the thread is already idle. - -Signed-off-by: Eric Anholt <eric@anholt.net> ---- - drivers/gpu/drm/vc4/vc4_gem.c | 4 ---- - 1 file changed, 4 deletions(-) - -diff --git a/drivers/gpu/drm/vc4/vc4_gem.c b/drivers/gpu/drm/vc4/vc4_gem.c -index 55551ea..eeb0925 100644 ---- a/drivers/gpu/drm/vc4/vc4_gem.c -+++ b/drivers/gpu/drm/vc4/vc4_gem.c -@@ -104,10 +104,6 @@ submit_cl(struct drm_device *dev, uint32_t thread, uint32_t start, uint32_t end) - { - struct vc4_dev *vc4 = to_vc4_dev(dev); - -- /* Stop any existing thread and set state to "stopped at halt" */ -- V3D_WRITE(V3D_CTNCS(thread), V3D_CTRUN); -- barrier(); -- - V3D_WRITE(V3D_CTNCA(thread), start); - barrier(); ++static const struct of_device_id enc28j60_of_match[] = { ++ { .compatible = "microchip,enc28j60", }, ++ { /* sentinel */ } ++}; ++MODULE_DEVICE_TABLE(of, enc28j60_of_match); ++ + static struct spi_driver enc28j60_driver = { + .driver = { + .name = DRV_NAME, ++ .of_match_table = enc28j60_of_match, + }, + .probe = enc28j60_probe, + .remove = enc28j60_remove, -From d102d0e145b58bccbea52e89bbe52dcefc044aaa Mon Sep 17 00:00:00 2001 -From: Eric Anholt <eric@anholt.net> -Date: Fri, 23 Oct 2015 12:33:43 +0100 -Subject: [PATCH 100/170] drm/vc4: Remove extra barrier()s aroudn CTnCA/CTnEA - setup. - -The writel() that these expand to already does barriers. - -Signed-off-by: Eric Anholt <eric@anholt.net> ---- - drivers/gpu/drm/vc4/vc4_gem.c | 9 +++------ - 1 file changed, 3 insertions(+), 6 deletions(-) +From b93b87463485525ab8d4a782dda0e04d36d1c1b3 Mon Sep 17 00:00:00 2001 +From: Waldemar Brodkorb <wbrodkorb@conet.de> +Date: Wed, 25 Mar 2015 09:26:17 +0100 +Subject: [PATCH 076/112] Add driver for rpi-proto -diff --git a/drivers/gpu/drm/vc4/vc4_gem.c b/drivers/gpu/drm/vc4/vc4_gem.c -index eeb0925..0cea723 100644 ---- a/drivers/gpu/drm/vc4/vc4_gem.c -+++ b/drivers/gpu/drm/vc4/vc4_gem.c -@@ -104,14 +104,11 @@ submit_cl(struct drm_device *dev, uint32_t thread, uint32_t start, uint32_t end) - { - struct vc4_dev *vc4 = to_vc4_dev(dev); - -- V3D_WRITE(V3D_CTNCA(thread), start); -- barrier(); -- -- /* Set the end address of the control list. Writing this -- * register is what starts the job. -+ /* Set the current and end address of the control list. -+ * Writing the end register is what starts the job. - */ -+ V3D_WRITE(V3D_CTNCA(thread), start); - V3D_WRITE(V3D_CTNEA(thread), end); -- barrier(); - } - - int +Forward port of 3.10.x driver from https://github.com/koalo +We are using a custom board and would like to use rpi 3.18.x +kernel. Patch works fine for our embedded system. -From 0f099b4b1354b0377376b91ae60c6c16d82683a7 Mon Sep 17 00:00:00 2001 -From: Eric Anholt <eric@anholt.net> -Date: Fri, 23 Oct 2015 14:57:22 +0100 -Subject: [PATCH 101/170] drm/vc4: Fix a typo in a V3D debug register. +URL to the audio chip: +http://www.mikroe.com/add-on-boards/audio-voice/audio-codec-proto/ -Signed-off-by: Eric Anholt <eric@anholt.net> ---- - drivers/gpu/drm/vc4/vc4_regs.h | 2 +- - drivers/gpu/drm/vc4/vc4_v3d.c | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/drivers/gpu/drm/vc4/vc4_regs.h b/drivers/gpu/drm/vc4/vc4_regs.h -index 9e4e904..4e52a0a 100644 ---- a/drivers/gpu/drm/vc4/vc4_regs.h -+++ b/drivers/gpu/drm/vc4/vc4_regs.h -@@ -154,7 +154,7 @@ - #define V3D_PCTRS14 0x006f4 - #define V3D_PCTR15 0x006f8 - #define V3D_PCTRS15 0x006fc --#define V3D_BGE 0x00f00 -+#define V3D_DBGE 0x00f00 - #define V3D_FDBGO 0x00f04 - #define V3D_FDBGB 0x00f08 - #define V3D_FDBGR 0x00f0c -diff --git a/drivers/gpu/drm/vc4/vc4_v3d.c b/drivers/gpu/drm/vc4/vc4_v3d.c -index b9cb7cf..cf35f58 100644 ---- a/drivers/gpu/drm/vc4/vc4_v3d.c -+++ b/drivers/gpu/drm/vc4/vc4_v3d.c -@@ -99,7 +99,7 @@ static const struct { - REGDEF(V3D_PCTRS14), - REGDEF(V3D_PCTR15), - REGDEF(V3D_PCTRS15), -- REGDEF(V3D_BGE), -+ REGDEF(V3D_DBGE), - REGDEF(V3D_FDBGO), - REGDEF(V3D_FDBGB), - REGDEF(V3D_FDBGR), - -From 22182768add611b53e33c5dd2e8901acc3d08181 Mon Sep 17 00:00:00 2001 -From: Phil Elwell <phil@raspberrypi.org> -Date: Mon, 2 Nov 2015 17:07:33 +0000 -Subject: [PATCH 102/170] drm/vc4: Enable VC4 modules, and increase CMA size - with overlay +Playback tested with devicetree enabled. -If using the overlay, be careful not to boot to GUI or run startx, -or the Pi will almost hang, reporting stalls in kernel threads. +Signed-off-by: Waldemar Brodkorb <wbrodkorb@conet.de> --- - arch/arm/boot/dts/overlays/README | 8 ++ - arch/arm/boot/dts/overlays/vc4-kms-v3d-overlay.dts | 95 ++++++++++++++++++++++ - arch/arm/configs/bcm2709_defconfig | 2 + - arch/arm/configs/bcmrpi_defconfig | 2 + - 4 files changed, 107 insertions(+) - create mode 100644 arch/arm/boot/dts/overlays/vc4-kms-v3d-overlay.dts + sound/soc/bcm/Kconfig | 7 +++ + sound/soc/bcm/Makefile | 2 + + sound/soc/bcm/rpi-proto.c | 154 ++++++++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 163 insertions(+) + create mode 100644 sound/soc/bcm/rpi-proto.c -diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README -index b819293..f5302b2 100644 ---- a/arch/arm/boot/dts/overlays/README -+++ b/arch/arm/boot/dts/overlays/README -@@ -601,6 +601,14 @@ Params: txd1_pin GPIO pin for TXD1 (14, 32 or 40 - default 14) - rxd1_pin GPIO pin for RXD1 (15, 33 or 41 - default 15) - +diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig +index 7677c89..8669a9a 100644 +--- a/sound/soc/bcm/Kconfig ++++ b/sound/soc/bcm/Kconfig +@@ -43,6 +43,13 @@ config SND_BCM2708_SOC_RPI_DAC + help + Say Y or M if you want to add support for RPi-DAC. -+Name: vc4-kms-v3d -+Info: Enable Eric Anholt's DRM VC4 HDMI/HVS/V3D driver. Running startx or -+ booting to GUI while this overlay is in use will cause interesting -+ lockups. -+Load: dtoverlay=vc4-kms-v3d -+Params: <None> -+ ++config SND_BCM2708_SOC_RPI_PROTO ++ tristate "Support for Rpi-PROTO" ++ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S ++ select SND_SOC_WM8731 ++ help ++ Say Y or M if you want to add support for Audio Codec Board PROTO (WM8731). + - Name: vga666 - Info: Overlay for the Fen Logic VGA666 board - This uses GPIOs 2-21 (so no I2C), and activates the output 2-3 seconds -diff --git a/arch/arm/boot/dts/overlays/vc4-kms-v3d-overlay.dts b/arch/arm/boot/dts/overlays/vc4-kms-v3d-overlay.dts + config SND_BCM2708_SOC_IQAUDIO_DAC + tristate "Support for IQaudIO-DAC" + depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S +diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile +index 30db495..4f5ab1f 100644 +--- a/sound/soc/bcm/Makefile ++++ b/sound/soc/bcm/Makefile +@@ -9,6 +9,7 @@ snd-soc-hifiberry-dacplus-objs := hifiberry_dacplus.o + snd-soc-hifiberry-digi-objs := hifiberry_digi.o + snd-soc-hifiberry-amp-objs := hifiberry_amp.o + snd-soc-rpi-dac-objs := rpi-dac.o ++snd-soc-rpi-proto-objs := rpi-proto.o + snd-soc-iqaudio-dac-objs := iqaudio-dac.o + + obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o +@@ -16,4 +17,5 @@ obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS) += snd-soc-hifiberry-dacplus.o + obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI) += snd-soc-hifiberry-digi.o + obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_AMP) += snd-soc-hifiberry-amp.o + obj-$(CONFIG_SND_BCM2708_SOC_RPI_DAC) += snd-soc-rpi-dac.o ++obj-$(CONFIG_SND_BCM2708_SOC_RPI_PROTO) += snd-soc-rpi-proto.o + obj-$(CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC) += snd-soc-iqaudio-dac.o +diff --git a/sound/soc/bcm/rpi-proto.c b/sound/soc/bcm/rpi-proto.c new file mode 100644 -index 0000000..cf5d5c9 +index 0000000..9db678e --- /dev/null -+++ b/arch/arm/boot/dts/overlays/vc4-kms-v3d-overlay.dts -@@ -0,0 +1,95 @@ ++++ b/sound/soc/bcm/rpi-proto.c +@@ -0,0 +1,154 @@ +/* -+ * vc4-kms-v3d-overlay.dts ++ * ASoC driver for PROTO AudioCODEC (with a WM8731) ++ * connected to a Raspberry Pi ++ * ++ * Author: Florian Meier, <koalo@koalo.de> ++ * Copyright 2013 ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 as ++ * published by the Free Software Foundation. + */ + -+/dts-v1/; -+/plugin/; ++#include <linux/module.h> ++#include <linux/platform_device.h> + -+#include "dt-bindings/clock/bcm2835.h" -+#include "dt-bindings/gpio/gpio.h" ++#include <sound/core.h> ++#include <sound/pcm.h> ++#include <sound/soc.h> ++#include <sound/jack.h> + -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; ++#include "../codecs/wm8731.h" + -+ fragment@0 { -+ target = <&i2c2>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; ++static const unsigned int wm8731_rates_12288000[] = { ++ 8000, 32000, 48000, 96000, ++}; + -+ fragment@1 { -+ target = <&cprman>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; ++static struct snd_pcm_hw_constraint_list wm8731_constraints_12288000 = { ++ .list = wm8731_rates_12288000, ++ .count = ARRAY_SIZE(wm8731_rates_12288000), ++}; + -+ fragment@2 { -+ target = <&fb>; -+ __overlay__ { -+ status = "disabled"; -+ }; -+ }; ++static int snd_rpi_proto_startup(struct snd_pcm_substream *substream) ++{ ++ /* Setup constraints, because there is a 12.288 MHz XTAL on the board */ ++ snd_pcm_hw_constraint_list(substream->runtime, 0, ++ SNDRV_PCM_HW_PARAM_RATE, ++ &wm8731_constraints_12288000); ++ return 0; ++} + -+ fragment@3 { -+ target = <&soc>; -+ __overlay__ { -+ #address-cells = <1>; -+ #size-cells = <1>; ++static int snd_rpi_proto_hw_params(struct snd_pcm_substream *substream, ++ struct snd_pcm_hw_params *params) ++{ ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_codec *codec = rtd->codec; ++ struct snd_soc_dai *codec_dai = rtd->codec_dai; ++ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; ++ int sysclk = 12288000; /* This is fixed on this board */ + -+ pixelvalve@7e206000 { -+ compatible = "brcm,bcm2835-pixelvalve0"; -+ reg = <0x7e206000 0x100>; -+ interrupts = <2 13>; /* pwa0 */ -+ }; ++ /* Set proto bclk */ ++ int ret = snd_soc_dai_set_bclk_ratio(cpu_dai,32*2); ++ if (ret < 0){ ++ dev_err(codec->dev, ++ "Failed to set BCLK ratio %d\n", ret); ++ return ret; ++ } + -+ pixelvalve@7e207000 { -+ compatible = "brcm,bcm2835-pixelvalve1"; -+ reg = <0x7e207000 0x100>; -+ interrupts = <2 14>; /* pwa1 */ -+ }; ++ /* Set proto sysclk */ ++ ret = snd_soc_dai_set_sysclk(codec_dai, WM8731_SYSCLK_XTAL, ++ sysclk, SND_SOC_CLOCK_IN); ++ if (ret < 0) { ++ dev_err(codec->dev, ++ "Failed to set WM8731 SYSCLK: %d\n", ret); ++ return ret; ++ } + -+ hvs@7e400000 { -+ compatible = "brcm,bcm2835-hvs"; -+ reg = <0x7e400000 0x6000>; -+ interrupts = <2 1>; -+ }; ++ return 0; ++} + -+ pixelvalve@7e807000 { -+ compatible = "brcm,bcm2835-pixelvalve2"; -+ reg = <0x7e807000 0x100>; -+ interrupts = <2 10>; /* pixelvalve */ -+ }; ++/* machine stream operations */ ++static struct snd_soc_ops snd_rpi_proto_ops = { ++ .startup = snd_rpi_proto_startup, ++ .hw_params = snd_rpi_proto_hw_params, ++}; + -+ hdmi@7e902000 { -+ compatible = "brcm,bcm2835-hdmi"; -+ reg = <0x7e902000 0x600>, -+ <0x7e808000 0x100>; -+ interrupts = <2 8>, <2 9>; -+ ddc = <&i2c2>; -+ hpd-gpio = <&gpio 46 GPIO_ACTIVE_HIGH>; -+ clocks = <&cprman BCM2835_PLLH_PIX>, -+ <&cprman BCM2835_CLOCK_HSM>; -+ clock-names = "pixel", "hdmi"; -+ }; ++static struct snd_soc_dai_link snd_rpi_proto_dai[] = { ++{ ++ .name = "WM8731", ++ .stream_name = "WM8731 HiFi", ++ .cpu_dai_name = "bcm2708-i2s.0", ++ .codec_dai_name = "wm8731-hifi", ++ .platform_name = "bcm2708-i2s.0", ++ .codec_name = "wm8731.1-001a", ++ .dai_fmt = SND_SOC_DAIFMT_I2S ++ | SND_SOC_DAIFMT_NB_NF ++ | SND_SOC_DAIFMT_CBM_CFM, ++ .ops = &snd_rpi_proto_ops, ++}, ++}; + -+ v3d@7ec00000 { -+ compatible = "brcm,vc4-v3d"; -+ reg = <0x7ec00000 0x1000>; -+ interrupts = <1 10>; -+ }; ++/* audio machine driver */ ++static struct snd_soc_card snd_rpi_proto = { ++ .name = "snd_rpi_proto", ++ .owner = THIS_MODULE, ++ .dai_link = snd_rpi_proto_dai, ++ .num_links = ARRAY_SIZE(snd_rpi_proto_dai), ++}; + -+ gpu@7e4c0000 { -+ compatible = "brcm,bcm2835-vc4"; -+ }; -+ }; -+ }; ++static int snd_rpi_proto_probe(struct platform_device *pdev) ++{ ++ int ret = 0; + -+ fragment@4 { -+ target-path = "/chosen"; -+ __overlay__ { -+ bootargs = "cma=256M@512M"; -+ }; -+ }; ++ snd_rpi_proto.dev = &pdev->dev; ++ ++ if (pdev->dev.of_node) { ++ struct device_node *i2s_node; ++ struct snd_soc_dai_link *dai = &snd_rpi_proto_dai[0]; ++ i2s_node = of_parse_phandle(pdev->dev.of_node, ++ "i2s-controller", 0); ++ ++ if (i2s_node) { ++ dai->cpu_dai_name = NULL; ++ dai->cpu_of_node = i2s_node; ++ dai->platform_name = NULL; ++ dai->platform_of_node = i2s_node; ++ } ++ } ++ ++ ret = snd_soc_register_card(&snd_rpi_proto); ++ if (ret) { ++ dev_err(&pdev->dev, ++ "snd_soc_register_card() failed: %d\n", ret); ++ } ++ ++ return ret; ++} ++ ++ ++static int snd_rpi_proto_remove(struct platform_device *pdev) ++{ ++ return snd_soc_unregister_card(&snd_rpi_proto); ++} ++ ++static const struct of_device_id snd_rpi_proto_of_match[] = { ++ { .compatible = "rpi,rpi-proto", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, snd_rpi_proto_of_match); ++ ++static struct platform_driver snd_rpi_proto_driver = { ++ .driver = { ++ .name = "snd-rpi-proto", ++ .owner = THIS_MODULE, ++ .of_match_table = snd_rpi_proto_of_match, ++ }, ++ .probe = snd_rpi_proto_probe, ++ .remove = snd_rpi_proto_remove, +}; ++ ++module_platform_driver(snd_rpi_proto_driver); ++ ++MODULE_AUTHOR("Florian Meier"); ++MODULE_DESCRIPTION("ASoC Driver for Raspberry Pi connected to PROTO board (WM8731)"); ++MODULE_LICENSE("GPL"); + +From 1bd993b072abd8431882cd24e374c24d3144d206 Mon Sep 17 00:00:00 2001 +From: popcornmix <popcornmix@gmail.com> +Date: Mon, 13 Apr 2015 17:16:29 +0100 +Subject: [PATCH 077/112] config: Add default configs + +--- + arch/arm/configs/bcm2709_defconfig | 1279 +++++++++++++++++++++++++++++++++++ + arch/arm/configs/bcmrpi_defconfig | 1289 ++++++++++++++++++++++++++++++++++++ + 2 files changed, 2568 insertions(+) + create mode 100644 arch/arm/configs/bcm2709_defconfig + create mode 100644 arch/arm/configs/bcmrpi_defconfig + diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig -index 13999af..4e474c7 100644 ---- a/arch/arm/configs/bcm2709_defconfig +new file mode 100644 +index 0000000..f42c5eb +--- /dev/null +++ b/arch/arm/configs/bcm2709_defconfig -@@ -802,6 +802,8 @@ CONFIG_VIDEO_TW9903=m - CONFIG_VIDEO_TW9906=m - CONFIG_VIDEO_OV7640=m - CONFIG_VIDEO_MT9V011=m +@@ -0,0 +1,1279 @@ ++# CONFIG_ARM_PATCH_PHYS_VIRT is not set ++CONFIG_PHYS_OFFSET=0 ++CONFIG_LOCALVERSION="-v7" ++# CONFIG_LOCALVERSION_AUTO is not set ++CONFIG_SYSVIPC=y ++CONFIG_POSIX_MQUEUE=y ++CONFIG_NO_HZ=y ++CONFIG_HIGH_RES_TIMERS=y ++CONFIG_BSD_PROCESS_ACCT=y ++CONFIG_BSD_PROCESS_ACCT_V3=y ++CONFIG_TASKSTATS=y ++CONFIG_TASK_DELAY_ACCT=y ++CONFIG_TASK_XACCT=y ++CONFIG_TASK_IO_ACCOUNTING=y ++CONFIG_IKCONFIG=m ++CONFIG_IKCONFIG_PROC=y ++CONFIG_MEMCG=y ++CONFIG_BLK_CGROUP=y ++CONFIG_CGROUP_FREEZER=y ++CONFIG_CPUSETS=y ++CONFIG_CGROUP_DEVICE=y ++CONFIG_CGROUP_CPUACCT=y ++CONFIG_NAMESPACES=y ++CONFIG_SCHED_AUTOGROUP=y ++CONFIG_BLK_DEV_INITRD=y ++CONFIG_EMBEDDED=y ++# CONFIG_COMPAT_BRK is not set ++CONFIG_PROFILING=y ++CONFIG_OPROFILE=m ++CONFIG_KPROBES=y ++CONFIG_JUMP_LABEL=y ++CONFIG_MODULES=y ++CONFIG_MODULE_UNLOAD=y ++CONFIG_MODVERSIONS=y ++CONFIG_MODULE_SRCVERSION_ALL=y ++CONFIG_BLK_DEV_THROTTLING=y ++CONFIG_PARTITION_ADVANCED=y ++CONFIG_MAC_PARTITION=y ++CONFIG_CFQ_GROUP_IOSCHED=y ++CONFIG_ARCH_BCM2709=y ++# CONFIG_CACHE_L2X0 is not set ++CONFIG_SMP=y ++CONFIG_HAVE_ARM_ARCH_TIMER=y ++CONFIG_VMSPLIT_2G=y ++CONFIG_PREEMPT_VOLUNTARY=y ++CONFIG_AEABI=y ++CONFIG_OABI_COMPAT=y ++# CONFIG_CPU_SW_DOMAIN_PAN is not set ++CONFIG_CLEANCACHE=y ++CONFIG_FRONTSWAP=y ++CONFIG_CMA=y ++CONFIG_ZSMALLOC=m ++CONFIG_PGTABLE_MAPPING=y ++CONFIG_UACCESS_WITH_MEMCPY=y ++CONFIG_SECCOMP=y ++# CONFIG_ATAGS is not set ++CONFIG_ZBOOT_ROM_TEXT=0x0 ++CONFIG_ZBOOT_ROM_BSS=0x0 ++CONFIG_CMDLINE="console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait" ++CONFIG_CPU_FREQ=y ++CONFIG_CPU_FREQ_STAT=m ++CONFIG_CPU_FREQ_STAT_DETAILS=y ++CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE=y ++CONFIG_CPU_FREQ_GOV_PERFORMANCE=y ++CONFIG_CPU_FREQ_GOV_USERSPACE=y ++CONFIG_CPU_FREQ_GOV_ONDEMAND=y ++CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y ++CONFIG_VFP=y ++CONFIG_NEON=y ++CONFIG_KERNEL_MODE_NEON=y ++CONFIG_BINFMT_MISC=m ++# CONFIG_SUSPEND is not set ++CONFIG_PM=y ++CONFIG_NET=y ++CONFIG_PACKET=y ++CONFIG_UNIX=y ++CONFIG_XFRM_USER=y ++CONFIG_NET_KEY=m ++CONFIG_INET=y ++CONFIG_IP_MULTICAST=y ++CONFIG_IP_ADVANCED_ROUTER=y ++CONFIG_IP_MULTIPLE_TABLES=y ++CONFIG_IP_ROUTE_MULTIPATH=y ++CONFIG_IP_ROUTE_VERBOSE=y ++CONFIG_IP_PNP=y ++CONFIG_IP_PNP_DHCP=y ++CONFIG_IP_PNP_RARP=y ++CONFIG_NET_IPIP=m ++CONFIG_NET_IPGRE_DEMUX=m ++CONFIG_NET_IPGRE=m ++CONFIG_IP_MROUTE=y ++CONFIG_IP_MROUTE_MULTIPLE_TABLES=y ++CONFIG_IP_PIMSM_V1=y ++CONFIG_IP_PIMSM_V2=y ++CONFIG_SYN_COOKIES=y ++CONFIG_INET_AH=m ++CONFIG_INET_ESP=m ++CONFIG_INET_IPCOMP=m ++CONFIG_INET_XFRM_MODE_TRANSPORT=m ++CONFIG_INET_XFRM_MODE_TUNNEL=m ++CONFIG_INET_XFRM_MODE_BEET=m ++CONFIG_INET_DIAG=m ++CONFIG_IPV6=m ++CONFIG_IPV6_ROUTER_PREF=y ++CONFIG_INET6_AH=m ++CONFIG_INET6_ESP=m ++CONFIG_INET6_IPCOMP=m ++CONFIG_IPV6_TUNNEL=m ++CONFIG_IPV6_MULTIPLE_TABLES=y ++CONFIG_IPV6_SUBTREES=y ++CONFIG_IPV6_MROUTE=y ++CONFIG_IPV6_MROUTE_MULTIPLE_TABLES=y ++CONFIG_IPV6_PIMSM_V2=y ++CONFIG_NETFILTER=y ++CONFIG_NF_CONNTRACK=m ++CONFIG_NF_CONNTRACK_ZONES=y ++CONFIG_NF_CONNTRACK_EVENTS=y ++CONFIG_NF_CONNTRACK_TIMESTAMP=y ++CONFIG_NF_CT_PROTO_DCCP=m ++CONFIG_NF_CT_PROTO_UDPLITE=m ++CONFIG_NF_CONNTRACK_AMANDA=m ++CONFIG_NF_CONNTRACK_FTP=m ++CONFIG_NF_CONNTRACK_H323=m ++CONFIG_NF_CONNTRACK_IRC=m ++CONFIG_NF_CONNTRACK_NETBIOS_NS=m ++CONFIG_NF_CONNTRACK_SNMP=m ++CONFIG_NF_CONNTRACK_PPTP=m ++CONFIG_NF_CONNTRACK_SANE=m ++CONFIG_NF_CONNTRACK_SIP=m ++CONFIG_NF_CONNTRACK_TFTP=m ++CONFIG_NF_CT_NETLINK=m ++CONFIG_NETFILTER_XT_SET=m ++CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m ++CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m ++CONFIG_NETFILTER_XT_TARGET_CONNMARK=m ++CONFIG_NETFILTER_XT_TARGET_DSCP=m ++CONFIG_NETFILTER_XT_TARGET_HMARK=m ++CONFIG_NETFILTER_XT_TARGET_IDLETIMER=m ++CONFIG_NETFILTER_XT_TARGET_LED=m ++CONFIG_NETFILTER_XT_TARGET_LOG=m ++CONFIG_NETFILTER_XT_TARGET_MARK=m ++CONFIG_NETFILTER_XT_TARGET_NFLOG=m ++CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m ++CONFIG_NETFILTER_XT_TARGET_NOTRACK=m ++CONFIG_NETFILTER_XT_TARGET_TEE=m ++CONFIG_NETFILTER_XT_TARGET_TPROXY=m ++CONFIG_NETFILTER_XT_TARGET_TRACE=m ++CONFIG_NETFILTER_XT_TARGET_TCPMSS=m ++CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP=m ++CONFIG_NETFILTER_XT_MATCH_ADDRTYPE=m ++CONFIG_NETFILTER_XT_MATCH_BPF=m ++CONFIG_NETFILTER_XT_MATCH_CLUSTER=m ++CONFIG_NETFILTER_XT_MATCH_COMMENT=m ++CONFIG_NETFILTER_XT_MATCH_CONNBYTES=m ++CONFIG_NETFILTER_XT_MATCH_CONNLABEL=m ++CONFIG_NETFILTER_XT_MATCH_CONNLIMIT=m ++CONFIG_NETFILTER_XT_MATCH_CONNMARK=m ++CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m ++CONFIG_NETFILTER_XT_MATCH_CPU=m ++CONFIG_NETFILTER_XT_MATCH_DCCP=m ++CONFIG_NETFILTER_XT_MATCH_DEVGROUP=m ++CONFIG_NETFILTER_XT_MATCH_DSCP=m ++CONFIG_NETFILTER_XT_MATCH_ESP=m ++CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=m ++CONFIG_NETFILTER_XT_MATCH_HELPER=m ++CONFIG_NETFILTER_XT_MATCH_IPRANGE=m ++CONFIG_NETFILTER_XT_MATCH_IPVS=m ++CONFIG_NETFILTER_XT_MATCH_LENGTH=m ++CONFIG_NETFILTER_XT_MATCH_LIMIT=m ++CONFIG_NETFILTER_XT_MATCH_MAC=m ++CONFIG_NETFILTER_XT_MATCH_MARK=m ++CONFIG_NETFILTER_XT_MATCH_MULTIPORT=m ++CONFIG_NETFILTER_XT_MATCH_NFACCT=m ++CONFIG_NETFILTER_XT_MATCH_OSF=m ++CONFIG_NETFILTER_XT_MATCH_OWNER=m ++CONFIG_NETFILTER_XT_MATCH_POLICY=m ++CONFIG_NETFILTER_XT_MATCH_PHYSDEV=m ++CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m ++CONFIG_NETFILTER_XT_MATCH_QUOTA=m ++CONFIG_NETFILTER_XT_MATCH_RATEEST=m ++CONFIG_NETFILTER_XT_MATCH_REALM=m ++CONFIG_NETFILTER_XT_MATCH_RECENT=m ++CONFIG_NETFILTER_XT_MATCH_SOCKET=m ++CONFIG_NETFILTER_XT_MATCH_STATE=m ++CONFIG_NETFILTER_XT_MATCH_STATISTIC=m ++CONFIG_NETFILTER_XT_MATCH_STRING=m ++CONFIG_NETFILTER_XT_MATCH_TCPMSS=m ++CONFIG_NETFILTER_XT_MATCH_TIME=m ++CONFIG_NETFILTER_XT_MATCH_U32=m ++CONFIG_IP_SET=m ++CONFIG_IP_SET_BITMAP_IP=m ++CONFIG_IP_SET_BITMAP_IPMAC=m ++CONFIG_IP_SET_BITMAP_PORT=m ++CONFIG_IP_SET_HASH_IP=m ++CONFIG_IP_SET_HASH_IPPORT=m ++CONFIG_IP_SET_HASH_IPPORTIP=m ++CONFIG_IP_SET_HASH_IPPORTNET=m ++CONFIG_IP_SET_HASH_NET=m ++CONFIG_IP_SET_HASH_NETPORT=m ++CONFIG_IP_SET_HASH_NETIFACE=m ++CONFIG_IP_SET_LIST_SET=m ++CONFIG_IP_VS=m ++CONFIG_IP_VS_PROTO_TCP=y ++CONFIG_IP_VS_PROTO_UDP=y ++CONFIG_IP_VS_PROTO_ESP=y ++CONFIG_IP_VS_PROTO_AH=y ++CONFIG_IP_VS_PROTO_SCTP=y ++CONFIG_IP_VS_RR=m ++CONFIG_IP_VS_WRR=m ++CONFIG_IP_VS_LC=m ++CONFIG_IP_VS_WLC=m ++CONFIG_IP_VS_LBLC=m ++CONFIG_IP_VS_LBLCR=m ++CONFIG_IP_VS_DH=m ++CONFIG_IP_VS_SH=m ++CONFIG_IP_VS_SED=m ++CONFIG_IP_VS_NQ=m ++CONFIG_IP_VS_FTP=m ++CONFIG_IP_VS_PE_SIP=m ++CONFIG_NF_CONNTRACK_IPV4=m ++CONFIG_IP_NF_IPTABLES=m ++CONFIG_IP_NF_MATCH_AH=m ++CONFIG_IP_NF_MATCH_ECN=m ++CONFIG_IP_NF_MATCH_RPFILTER=m ++CONFIG_IP_NF_MATCH_TTL=m ++CONFIG_IP_NF_FILTER=m ++CONFIG_IP_NF_TARGET_REJECT=m ++CONFIG_IP_NF_NAT=m ++CONFIG_IP_NF_TARGET_MASQUERADE=m ++CONFIG_IP_NF_TARGET_NETMAP=m ++CONFIG_IP_NF_TARGET_REDIRECT=m ++CONFIG_IP_NF_MANGLE=m ++CONFIG_IP_NF_TARGET_CLUSTERIP=m ++CONFIG_IP_NF_TARGET_ECN=m ++CONFIG_IP_NF_TARGET_TTL=m ++CONFIG_IP_NF_RAW=m ++CONFIG_IP_NF_ARPTABLES=m ++CONFIG_IP_NF_ARPFILTER=m ++CONFIG_IP_NF_ARP_MANGLE=m ++CONFIG_NF_CONNTRACK_IPV6=m ++CONFIG_IP6_NF_IPTABLES=m ++CONFIG_IP6_NF_MATCH_AH=m ++CONFIG_IP6_NF_MATCH_EUI64=m ++CONFIG_IP6_NF_MATCH_FRAG=m ++CONFIG_IP6_NF_MATCH_OPTS=m ++CONFIG_IP6_NF_MATCH_HL=m ++CONFIG_IP6_NF_MATCH_IPV6HEADER=m ++CONFIG_IP6_NF_MATCH_MH=m ++CONFIG_IP6_NF_MATCH_RPFILTER=m ++CONFIG_IP6_NF_MATCH_RT=m ++CONFIG_IP6_NF_TARGET_HL=m ++CONFIG_IP6_NF_FILTER=m ++CONFIG_IP6_NF_TARGET_REJECT=m ++CONFIG_IP6_NF_MANGLE=m ++CONFIG_IP6_NF_RAW=m ++CONFIG_IP6_NF_NAT=m ++CONFIG_IP6_NF_TARGET_MASQUERADE=m ++CONFIG_IP6_NF_TARGET_NPT=m ++CONFIG_BRIDGE_NF_EBTABLES=m ++CONFIG_BRIDGE_EBT_BROUTE=m ++CONFIG_BRIDGE_EBT_T_FILTER=m ++CONFIG_BRIDGE_EBT_T_NAT=m ++CONFIG_BRIDGE_EBT_802_3=m ++CONFIG_BRIDGE_EBT_AMONG=m ++CONFIG_BRIDGE_EBT_ARP=m ++CONFIG_BRIDGE_EBT_IP=m ++CONFIG_BRIDGE_EBT_IP6=m ++CONFIG_BRIDGE_EBT_LIMIT=m ++CONFIG_BRIDGE_EBT_MARK=m ++CONFIG_BRIDGE_EBT_PKTTYPE=m ++CONFIG_BRIDGE_EBT_STP=m ++CONFIG_BRIDGE_EBT_VLAN=m ++CONFIG_BRIDGE_EBT_ARPREPLY=m ++CONFIG_BRIDGE_EBT_DNAT=m ++CONFIG_BRIDGE_EBT_MARK_T=m ++CONFIG_BRIDGE_EBT_REDIRECT=m ++CONFIG_BRIDGE_EBT_SNAT=m ++CONFIG_BRIDGE_EBT_LOG=m ++CONFIG_BRIDGE_EBT_NFLOG=m ++CONFIG_SCTP_COOKIE_HMAC_SHA1=y ++CONFIG_ATM=m ++CONFIG_L2TP=m ++CONFIG_L2TP_V3=y ++CONFIG_L2TP_IP=m ++CONFIG_L2TP_ETH=m ++CONFIG_BRIDGE=m ++CONFIG_VLAN_8021Q=m ++CONFIG_VLAN_8021Q_GVRP=y ++CONFIG_ATALK=m ++CONFIG_6LOWPAN=m ++CONFIG_IEEE802154=m ++CONFIG_IEEE802154_6LOWPAN=m ++CONFIG_MAC802154=m ++CONFIG_NET_SCHED=y ++CONFIG_NET_SCH_CBQ=m ++CONFIG_NET_SCH_HTB=m ++CONFIG_NET_SCH_HFSC=m ++CONFIG_NET_SCH_PRIO=m ++CONFIG_NET_SCH_MULTIQ=m ++CONFIG_NET_SCH_RED=m ++CONFIG_NET_SCH_SFB=m ++CONFIG_NET_SCH_SFQ=m ++CONFIG_NET_SCH_TEQL=m ++CONFIG_NET_SCH_TBF=m ++CONFIG_NET_SCH_GRED=m ++CONFIG_NET_SCH_DSMARK=m ++CONFIG_NET_SCH_NETEM=m ++CONFIG_NET_SCH_DRR=m ++CONFIG_NET_SCH_MQPRIO=m ++CONFIG_NET_SCH_CHOKE=m ++CONFIG_NET_SCH_QFQ=m ++CONFIG_NET_SCH_CODEL=m ++CONFIG_NET_SCH_FQ_CODEL=m ++CONFIG_NET_SCH_INGRESS=m ++CONFIG_NET_SCH_PLUG=m ++CONFIG_NET_CLS_BASIC=m ++CONFIG_NET_CLS_TCINDEX=m ++CONFIG_NET_CLS_ROUTE4=m ++CONFIG_NET_CLS_FW=m ++CONFIG_NET_CLS_U32=m ++CONFIG_CLS_U32_MARK=y ++CONFIG_NET_CLS_RSVP=m ++CONFIG_NET_CLS_RSVP6=m ++CONFIG_NET_CLS_FLOW=m ++CONFIG_NET_CLS_CGROUP=m ++CONFIG_NET_EMATCH=y ++CONFIG_NET_EMATCH_CMP=m ++CONFIG_NET_EMATCH_NBYTE=m ++CONFIG_NET_EMATCH_U32=m ++CONFIG_NET_EMATCH_META=m ++CONFIG_NET_EMATCH_TEXT=m ++CONFIG_NET_EMATCH_IPSET=m ++CONFIG_NET_CLS_ACT=y ++CONFIG_NET_ACT_POLICE=m ++CONFIG_NET_ACT_GACT=m ++CONFIG_GACT_PROB=y ++CONFIG_NET_ACT_MIRRED=m ++CONFIG_NET_ACT_IPT=m ++CONFIG_NET_ACT_NAT=m ++CONFIG_NET_ACT_PEDIT=m ++CONFIG_NET_ACT_SIMP=m ++CONFIG_NET_ACT_SKBEDIT=m ++CONFIG_NET_ACT_CSUM=m ++CONFIG_BATMAN_ADV=m ++CONFIG_OPENVSWITCH=m ++CONFIG_NET_PKTGEN=m ++CONFIG_HAMRADIO=y ++CONFIG_AX25=m ++CONFIG_NETROM=m ++CONFIG_ROSE=m ++CONFIG_MKISS=m ++CONFIG_6PACK=m ++CONFIG_BPQETHER=m ++CONFIG_BAYCOM_SER_FDX=m ++CONFIG_BAYCOM_SER_HDX=m ++CONFIG_YAM=m ++CONFIG_CAN=m ++CONFIG_CAN_VCAN=m ++CONFIG_CAN_MCP251X=m ++CONFIG_IRDA=m ++CONFIG_IRLAN=m ++CONFIG_IRNET=m ++CONFIG_IRCOMM=m ++CONFIG_IRDA_ULTRA=y ++CONFIG_IRDA_CACHE_LAST_LSAP=y ++CONFIG_IRDA_FAST_RR=y ++CONFIG_IRTTY_SIR=m ++CONFIG_KINGSUN_DONGLE=m ++CONFIG_KSDAZZLE_DONGLE=m ++CONFIG_KS959_DONGLE=m ++CONFIG_USB_IRDA=m ++CONFIG_SIGMATEL_FIR=m ++CONFIG_MCS_FIR=m ++CONFIG_BT=m ++CONFIG_BT_RFCOMM=m ++CONFIG_BT_RFCOMM_TTY=y ++CONFIG_BT_BNEP=m ++CONFIG_BT_BNEP_MC_FILTER=y ++CONFIG_BT_BNEP_PROTO_FILTER=y ++CONFIG_BT_HIDP=m ++CONFIG_BT_6LOWPAN=m ++CONFIG_BT_HCIBTUSB=m ++CONFIG_BT_HCIUART=m ++CONFIG_BT_HCIUART_3WIRE=y ++CONFIG_BT_HCIUART_BCM=y ++CONFIG_BT_HCIBCM203X=m ++CONFIG_BT_HCIBPA10X=m ++CONFIG_BT_HCIBFUSB=m ++CONFIG_BT_HCIVHCI=m ++CONFIG_BT_MRVL=m ++CONFIG_BT_MRVL_SDIO=m ++CONFIG_BT_ATH3K=m ++CONFIG_BT_WILINK=m ++CONFIG_MAC80211=m ++CONFIG_MAC80211_MESH=y ++CONFIG_WIMAX=m ++CONFIG_RFKILL=m ++CONFIG_RFKILL_INPUT=y ++CONFIG_NET_9P=m ++CONFIG_NFC=m ++CONFIG_NFC_PN533=m ++CONFIG_DEVTMPFS=y ++CONFIG_DEVTMPFS_MOUNT=y ++CONFIG_DMA_CMA=y ++CONFIG_CMA_SIZE_MBYTES=5 ++CONFIG_MTD=m ++CONFIG_MTD_BLOCK=m ++CONFIG_MTD_NAND=m ++CONFIG_MTD_UBI=m ++CONFIG_OF_CONFIGFS=y ++CONFIG_ZRAM=m ++CONFIG_ZRAM_LZ4_COMPRESS=y ++CONFIG_BLK_DEV_LOOP=y ++CONFIG_BLK_DEV_CRYPTOLOOP=m ++CONFIG_BLK_DEV_DRBD=m ++CONFIG_BLK_DEV_NBD=m ++CONFIG_BLK_DEV_RAM=y ++CONFIG_CDROM_PKTCDVD=m ++CONFIG_ATA_OVER_ETH=m ++CONFIG_EEPROM_AT24=m ++CONFIG_TI_ST=m ++CONFIG_SCSI=y ++# CONFIG_SCSI_PROC_FS is not set ++CONFIG_BLK_DEV_SD=y ++CONFIG_CHR_DEV_ST=m ++CONFIG_CHR_DEV_OSST=m ++CONFIG_BLK_DEV_SR=m ++CONFIG_CHR_DEV_SG=m ++CONFIG_SCSI_ISCSI_ATTRS=y ++CONFIG_ISCSI_TCP=m ++CONFIG_ISCSI_BOOT_SYSFS=m ++CONFIG_MD=y ++CONFIG_MD_LINEAR=m ++CONFIG_MD_RAID0=m ++CONFIG_BLK_DEV_DM=m ++CONFIG_DM_CRYPT=m ++CONFIG_DM_SNAPSHOT=m ++CONFIG_DM_THIN_PROVISIONING=m ++CONFIG_DM_MIRROR=m ++CONFIG_DM_LOG_USERSPACE=m ++CONFIG_DM_RAID=m ++CONFIG_DM_ZERO=m ++CONFIG_DM_DELAY=m ++CONFIG_NETDEVICES=y ++CONFIG_BONDING=m ++CONFIG_DUMMY=m ++CONFIG_IFB=m ++CONFIG_MACVLAN=m ++CONFIG_NETCONSOLE=m ++CONFIG_TUN=m ++CONFIG_VETH=m ++CONFIG_ENC28J60=m ++CONFIG_QCA7000=m ++CONFIG_MDIO_BITBANG=m ++CONFIG_PPP=m ++CONFIG_PPP_BSDCOMP=m ++CONFIG_PPP_DEFLATE=m ++CONFIG_PPP_FILTER=y ++CONFIG_PPP_MPPE=m ++CONFIG_PPP_MULTILINK=y ++CONFIG_PPPOATM=m ++CONFIG_PPPOE=m ++CONFIG_PPPOL2TP=m ++CONFIG_PPP_ASYNC=m ++CONFIG_PPP_SYNC_TTY=m ++CONFIG_SLIP=m ++CONFIG_SLIP_COMPRESSED=y ++CONFIG_SLIP_SMART=y ++CONFIG_USB_CATC=m ++CONFIG_USB_KAWETH=m ++CONFIG_USB_PEGASUS=m ++CONFIG_USB_RTL8150=m ++CONFIG_USB_RTL8152=m ++CONFIG_USB_USBNET=y ++CONFIG_USB_NET_AX8817X=m ++CONFIG_USB_NET_AX88179_178A=m ++CONFIG_USB_NET_CDCETHER=m ++CONFIG_USB_NET_CDC_EEM=m ++CONFIG_USB_NET_CDC_NCM=m ++CONFIG_USB_NET_HUAWEI_CDC_NCM=m ++CONFIG_USB_NET_CDC_MBIM=m ++CONFIG_USB_NET_DM9601=m ++CONFIG_USB_NET_SR9700=m ++CONFIG_USB_NET_SR9800=m ++CONFIG_USB_NET_SMSC75XX=m ++CONFIG_USB_NET_SMSC95XX=y ++CONFIG_USB_NET_GL620A=m ++CONFIG_USB_NET_NET1080=m ++CONFIG_USB_NET_PLUSB=m ++CONFIG_USB_NET_MCS7830=m ++CONFIG_USB_NET_CDC_SUBSET=m ++CONFIG_USB_ALI_M5632=y ++CONFIG_USB_AN2720=y ++CONFIG_USB_EPSON2888=y ++CONFIG_USB_KC2190=y ++CONFIG_USB_NET_ZAURUS=m ++CONFIG_USB_NET_CX82310_ETH=m ++CONFIG_USB_NET_KALMIA=m ++CONFIG_USB_NET_QMI_WWAN=m ++CONFIG_USB_HSO=m ++CONFIG_USB_NET_INT51X1=m ++CONFIG_USB_IPHETH=m ++CONFIG_USB_SIERRA_NET=m ++CONFIG_USB_VL600=m ++CONFIG_ATH9K=m ++CONFIG_ATH9K_HTC=m ++CONFIG_CARL9170=m ++CONFIG_ATH6KL=m ++CONFIG_ATH6KL_USB=m ++CONFIG_AR5523=m ++CONFIG_AT76C50X_USB=m ++CONFIG_B43=m ++# CONFIG_B43_PHY_N is not set ++CONFIG_B43LEGACY=m ++CONFIG_BRCMFMAC=m ++CONFIG_BRCMFMAC_USB=y ++CONFIG_HOSTAP=m ++CONFIG_P54_COMMON=m ++CONFIG_P54_USB=m ++CONFIG_LIBERTAS=m ++CONFIG_LIBERTAS_USB=m ++CONFIG_LIBERTAS_SDIO=m ++CONFIG_LIBERTAS_THINFIRM=m ++CONFIG_LIBERTAS_THINFIRM_USB=m ++CONFIG_MWIFIEX=m ++CONFIG_MWIFIEX_SDIO=m ++CONFIG_MT7601U=m ++CONFIG_RT2X00=m ++CONFIG_RT2500USB=m ++CONFIG_RT73USB=m ++CONFIG_RT2800USB=m ++CONFIG_RT2800USB_RT3573=y ++CONFIG_RT2800USB_RT53XX=y ++CONFIG_RT2800USB_RT55XX=y ++CONFIG_RT2800USB_UNKNOWN=y ++CONFIG_RTL8187=m ++CONFIG_RTL8192CU=m ++CONFIG_USB_ZD1201=m ++CONFIG_ZD1211RW=m ++CONFIG_MAC80211_HWSIM=m ++CONFIG_USB_NET_RNDIS_WLAN=m ++CONFIG_WIMAX_I2400M_USB=m ++CONFIG_IEEE802154_AT86RF230=m ++CONFIG_IEEE802154_MRF24J40=m ++CONFIG_IEEE802154_CC2520=m ++CONFIG_INPUT_POLLDEV=m ++# CONFIG_INPUT_MOUSEDEV_PSAUX is not set ++CONFIG_INPUT_JOYDEV=m ++CONFIG_INPUT_EVDEV=m ++# CONFIG_KEYBOARD_ATKBD is not set ++CONFIG_KEYBOARD_GPIO=m ++# CONFIG_INPUT_MOUSE is not set ++CONFIG_INPUT_JOYSTICK=y ++CONFIG_JOYSTICK_IFORCE=m ++CONFIG_JOYSTICK_IFORCE_USB=y ++CONFIG_JOYSTICK_XPAD=m ++CONFIG_JOYSTICK_XPAD_FF=y ++CONFIG_JOYSTICK_RPISENSE=m ++CONFIG_INPUT_TOUCHSCREEN=y ++CONFIG_TOUCHSCREEN_ADS7846=m ++CONFIG_TOUCHSCREEN_EGALAX=m ++CONFIG_TOUCHSCREEN_FT6236=m ++CONFIG_TOUCHSCREEN_RPI_FT5406=m ++CONFIG_TOUCHSCREEN_USB_COMPOSITE=m ++CONFIG_TOUCHSCREEN_STMPE=m ++CONFIG_INPUT_MISC=y ++CONFIG_INPUT_AD714X=m ++CONFIG_INPUT_ATI_REMOTE2=m ++CONFIG_INPUT_KEYSPAN_REMOTE=m ++CONFIG_INPUT_POWERMATE=m ++CONFIG_INPUT_YEALINK=m ++CONFIG_INPUT_CM109=m ++CONFIG_INPUT_UINPUT=m ++CONFIG_INPUT_GPIO_ROTARY_ENCODER=m ++CONFIG_INPUT_ADXL34X=m ++CONFIG_INPUT_CMA3000=m ++CONFIG_SERIO=m ++CONFIG_SERIO_RAW=m ++CONFIG_GAMEPORT=m ++CONFIG_GAMEPORT_NS558=m ++CONFIG_GAMEPORT_L4=m ++CONFIG_BRCM_CHAR_DRIVERS=y ++CONFIG_BCM_VC_CMA=y ++CONFIG_BCM_VCIO=y ++CONFIG_BCM_VC_SM=y ++CONFIG_DEVPTS_MULTIPLE_INSTANCES=y ++# CONFIG_LEGACY_PTYS is not set ++# CONFIG_DEVKMEM is not set ++CONFIG_SERIAL_8250=y ++# CONFIG_SERIAL_8250_DEPRECATED_OPTIONS is not set ++CONFIG_SERIAL_8250_CONSOLE=y ++# CONFIG_SERIAL_8250_DMA is not set ++CONFIG_SERIAL_8250_NR_UARTS=1 ++CONFIG_SERIAL_8250_RUNTIME_UARTS=0 ++CONFIG_SERIAL_OF_PLATFORM=y ++CONFIG_SERIAL_AMBA_PL011=y ++CONFIG_SERIAL_AMBA_PL011_CONSOLE=y ++CONFIG_TTY_PRINTK=y ++CONFIG_HW_RANDOM=y ++CONFIG_RAW_DRIVER=y ++CONFIG_I2C=y ++CONFIG_I2C_CHARDEV=m ++CONFIG_I2C_MUX_PCA954x=m ++CONFIG_I2C_BCM2708=m ++CONFIG_I2C_GPIO=m ++CONFIG_SPI=y ++CONFIG_SPI_BCM2835=m ++CONFIG_SPI_BCM2835AUX=m ++CONFIG_SPI_SPIDEV=y ++CONFIG_PPS=m ++CONFIG_PPS_CLIENT_LDISC=m ++CONFIG_PPS_CLIENT_GPIO=m ++CONFIG_GPIO_SYSFS=y ++CONFIG_GPIO_BCM_VIRT=y ++CONFIG_GPIO_ARIZONA=m ++CONFIG_GPIO_STMPE=y ++CONFIG_W1=m ++CONFIG_W1_MASTER_DS2490=m ++CONFIG_W1_MASTER_DS2482=m ++CONFIG_W1_MASTER_DS1WM=m ++CONFIG_W1_MASTER_GPIO=m ++CONFIG_W1_SLAVE_THERM=m ++CONFIG_W1_SLAVE_SMEM=m ++CONFIG_W1_SLAVE_DS2408=m ++CONFIG_W1_SLAVE_DS2413=m ++CONFIG_W1_SLAVE_DS2406=m ++CONFIG_W1_SLAVE_DS2423=m ++CONFIG_W1_SLAVE_DS2431=m ++CONFIG_W1_SLAVE_DS2433=m ++CONFIG_W1_SLAVE_DS2760=m ++CONFIG_W1_SLAVE_DS2780=m ++CONFIG_W1_SLAVE_DS2781=m ++CONFIG_W1_SLAVE_DS28E04=m ++CONFIG_W1_SLAVE_BQ27000=m ++CONFIG_BATTERY_DS2760=m ++CONFIG_POWER_RESET=y ++CONFIG_POWER_RESET_GPIO=y ++CONFIG_HWMON=m ++CONFIG_SENSORS_SHT21=m ++CONFIG_SENSORS_SHTC1=m ++CONFIG_THERMAL=y ++CONFIG_THERMAL_BCM2835=y ++CONFIG_WATCHDOG=y ++CONFIG_BCM2835_WDT=m ++CONFIG_UCB1400_CORE=m ++CONFIG_MFD_STMPE=y ++CONFIG_STMPE_SPI=y ++CONFIG_MFD_ARIZONA_I2C=m ++CONFIG_MFD_ARIZONA_SPI=m ++CONFIG_MFD_WM5102=y ++CONFIG_MEDIA_SUPPORT=m ++CONFIG_MEDIA_CAMERA_SUPPORT=y ++CONFIG_MEDIA_ANALOG_TV_SUPPORT=y ++CONFIG_MEDIA_DIGITAL_TV_SUPPORT=y ++CONFIG_MEDIA_RADIO_SUPPORT=y ++CONFIG_MEDIA_RC_SUPPORT=y ++CONFIG_MEDIA_CONTROLLER=y ++CONFIG_LIRC=m ++CONFIG_RC_DEVICES=y ++CONFIG_RC_ATI_REMOTE=m ++CONFIG_IR_IMON=m ++CONFIG_IR_MCEUSB=m ++CONFIG_IR_REDRAT3=m ++CONFIG_IR_STREAMZAP=m ++CONFIG_IR_IGUANA=m ++CONFIG_IR_TTUSBIR=m ++CONFIG_RC_LOOPBACK=m ++CONFIG_IR_GPIO_CIR=m ++CONFIG_MEDIA_USB_SUPPORT=y ++CONFIG_USB_VIDEO_CLASS=m ++CONFIG_USB_M5602=m ++CONFIG_USB_STV06XX=m ++CONFIG_USB_GL860=m ++CONFIG_USB_GSPCA_BENQ=m ++CONFIG_USB_GSPCA_CONEX=m ++CONFIG_USB_GSPCA_CPIA1=m ++CONFIG_USB_GSPCA_DTCS033=m ++CONFIG_USB_GSPCA_ETOMS=m ++CONFIG_USB_GSPCA_FINEPIX=m ++CONFIG_USB_GSPCA_JEILINJ=m ++CONFIG_USB_GSPCA_JL2005BCD=m ++CONFIG_USB_GSPCA_KINECT=m ++CONFIG_USB_GSPCA_KONICA=m ++CONFIG_USB_GSPCA_MARS=m ++CONFIG_USB_GSPCA_MR97310A=m ++CONFIG_USB_GSPCA_NW80X=m ++CONFIG_USB_GSPCA_OV519=m ++CONFIG_USB_GSPCA_OV534=m ++CONFIG_USB_GSPCA_OV534_9=m ++CONFIG_USB_GSPCA_PAC207=m ++CONFIG_USB_GSPCA_PAC7302=m ++CONFIG_USB_GSPCA_PAC7311=m ++CONFIG_USB_GSPCA_SE401=m ++CONFIG_USB_GSPCA_SN9C2028=m ++CONFIG_USB_GSPCA_SN9C20X=m ++CONFIG_USB_GSPCA_SONIXB=m ++CONFIG_USB_GSPCA_SONIXJ=m ++CONFIG_USB_GSPCA_SPCA500=m ++CONFIG_USB_GSPCA_SPCA501=m ++CONFIG_USB_GSPCA_SPCA505=m ++CONFIG_USB_GSPCA_SPCA506=m ++CONFIG_USB_GSPCA_SPCA508=m ++CONFIG_USB_GSPCA_SPCA561=m ++CONFIG_USB_GSPCA_SPCA1528=m ++CONFIG_USB_GSPCA_SQ905=m ++CONFIG_USB_GSPCA_SQ905C=m ++CONFIG_USB_GSPCA_SQ930X=m ++CONFIG_USB_GSPCA_STK014=m ++CONFIG_USB_GSPCA_STK1135=m ++CONFIG_USB_GSPCA_STV0680=m ++CONFIG_USB_GSPCA_SUNPLUS=m ++CONFIG_USB_GSPCA_T613=m ++CONFIG_USB_GSPCA_TOPRO=m ++CONFIG_USB_GSPCA_TV8532=m ++CONFIG_USB_GSPCA_VC032X=m ++CONFIG_USB_GSPCA_VICAM=m ++CONFIG_USB_GSPCA_XIRLINK_CIT=m ++CONFIG_USB_GSPCA_ZC3XX=m ++CONFIG_USB_PWC=m ++CONFIG_VIDEO_CPIA2=m ++CONFIG_USB_ZR364XX=m ++CONFIG_USB_STKWEBCAM=m ++CONFIG_USB_S2255=m ++CONFIG_VIDEO_USBTV=m ++CONFIG_VIDEO_PVRUSB2=m ++CONFIG_VIDEO_HDPVR=m ++CONFIG_VIDEO_USBVISION=m ++CONFIG_VIDEO_STK1160_COMMON=m ++CONFIG_VIDEO_STK1160_AC97=y ++CONFIG_VIDEO_GO7007=m ++CONFIG_VIDEO_GO7007_USB=m ++CONFIG_VIDEO_GO7007_USB_S2250_BOARD=m ++CONFIG_VIDEO_AU0828=m ++CONFIG_VIDEO_AU0828_RC=y ++CONFIG_VIDEO_CX231XX=m ++CONFIG_VIDEO_CX231XX_ALSA=m ++CONFIG_VIDEO_CX231XX_DVB=m ++CONFIG_VIDEO_TM6000=m ++CONFIG_VIDEO_TM6000_ALSA=m ++CONFIG_VIDEO_TM6000_DVB=m ++CONFIG_DVB_USB=m ++CONFIG_DVB_USB_A800=m ++CONFIG_DVB_USB_DIBUSB_MB=m ++CONFIG_DVB_USB_DIBUSB_MB_FAULTY=y ++CONFIG_DVB_USB_DIBUSB_MC=m ++CONFIG_DVB_USB_DIB0700=m ++CONFIG_DVB_USB_UMT_010=m ++CONFIG_DVB_USB_CXUSB=m ++CONFIG_DVB_USB_M920X=m ++CONFIG_DVB_USB_DIGITV=m ++CONFIG_DVB_USB_VP7045=m ++CONFIG_DVB_USB_VP702X=m ++CONFIG_DVB_USB_GP8PSK=m ++CONFIG_DVB_USB_NOVA_T_USB2=m ++CONFIG_DVB_USB_TTUSB2=m ++CONFIG_DVB_USB_DTT200U=m ++CONFIG_DVB_USB_OPERA1=m ++CONFIG_DVB_USB_AF9005=m ++CONFIG_DVB_USB_AF9005_REMOTE=m ++CONFIG_DVB_USB_PCTV452E=m ++CONFIG_DVB_USB_DW2102=m ++CONFIG_DVB_USB_CINERGY_T2=m ++CONFIG_DVB_USB_DTV5100=m ++CONFIG_DVB_USB_FRIIO=m ++CONFIG_DVB_USB_AZ6027=m ++CONFIG_DVB_USB_TECHNISAT_USB2=m ++CONFIG_DVB_USB_V2=m ++CONFIG_DVB_USB_AF9015=m ++CONFIG_DVB_USB_AF9035=m ++CONFIG_DVB_USB_ANYSEE=m ++CONFIG_DVB_USB_AU6610=m ++CONFIG_DVB_USB_AZ6007=m ++CONFIG_DVB_USB_CE6230=m ++CONFIG_DVB_USB_EC168=m ++CONFIG_DVB_USB_GL861=m ++CONFIG_DVB_USB_LME2510=m ++CONFIG_DVB_USB_MXL111SF=m ++CONFIG_DVB_USB_RTL28XXU=m ++CONFIG_DVB_USB_DVBSKY=m ++CONFIG_SMS_USB_DRV=m ++CONFIG_DVB_B2C2_FLEXCOP_USB=m ++CONFIG_DVB_AS102=m ++CONFIG_VIDEO_EM28XX=m ++CONFIG_VIDEO_EM28XX_V4L2=m ++CONFIG_VIDEO_EM28XX_ALSA=m ++CONFIG_VIDEO_EM28XX_DVB=m ++CONFIG_V4L_PLATFORM_DRIVERS=y ++CONFIG_VIDEO_BCM2835=y ++CONFIG_VIDEO_BCM2835_MMAL=m ++CONFIG_RADIO_SI470X=y ++CONFIG_USB_SI470X=m ++CONFIG_I2C_SI470X=m ++CONFIG_RADIO_SI4713=m ++CONFIG_I2C_SI4713=m ++CONFIG_USB_MR800=m ++CONFIG_USB_DSBR=m ++CONFIG_RADIO_SHARK=m ++CONFIG_RADIO_SHARK2=m ++CONFIG_USB_KEENE=m ++CONFIG_USB_MA901=m ++CONFIG_RADIO_TEA5764=m ++CONFIG_RADIO_SAA7706H=m ++CONFIG_RADIO_TEF6862=m ++CONFIG_RADIO_WL1273=m ++CONFIG_RADIO_WL128X=m ++# CONFIG_MEDIA_SUBDRV_AUTOSELECT is not set ++CONFIG_VIDEO_UDA1342=m ++CONFIG_VIDEO_SONY_BTF_MPX=m ++CONFIG_VIDEO_TVP5150=m ++CONFIG_VIDEO_TW2804=m ++CONFIG_VIDEO_TW9903=m ++CONFIG_VIDEO_TW9906=m ++CONFIG_VIDEO_OV7640=m ++CONFIG_VIDEO_MT9V011=m +CONFIG_DRM=m ++CONFIG_DRM_LOAD_EDID_FIRMWARE=y ++CONFIG_DRM_UDL=m +CONFIG_DRM_VC4=m - CONFIG_FB=y - CONFIG_FB_BCM2708=y - CONFIG_FB_UDL=m ++CONFIG_FB=y ++CONFIG_FB_BCM2708=y ++CONFIG_FB_UDL=m ++CONFIG_FB_SSD1307=m ++CONFIG_FB_RPISENSE=m ++# CONFIG_BACKLIGHT_GENERIC is not set ++CONFIG_BACKLIGHT_RPI=m ++CONFIG_BACKLIGHT_GPIO=m ++CONFIG_FRAMEBUFFER_CONSOLE=y ++CONFIG_LOGO=y ++# CONFIG_LOGO_LINUX_MONO is not set ++# CONFIG_LOGO_LINUX_VGA16 is not set ++CONFIG_SOUND=y ++CONFIG_SND=m ++CONFIG_SND_SEQUENCER=m ++CONFIG_SND_SEQ_DUMMY=m ++CONFIG_SND_MIXER_OSS=m ++CONFIG_SND_PCM_OSS=m ++CONFIG_SND_SEQUENCER_OSS=y ++CONFIG_SND_HRTIMER=m ++CONFIG_SND_DUMMY=m ++CONFIG_SND_ALOOP=m ++CONFIG_SND_VIRMIDI=m ++CONFIG_SND_MTPAV=m ++CONFIG_SND_SERIAL_U16550=m ++CONFIG_SND_MPU401=m ++CONFIG_SND_BCM2835=m ++CONFIG_SND_USB_AUDIO=m ++CONFIG_SND_USB_UA101=m ++CONFIG_SND_USB_CAIAQ=m ++CONFIG_SND_USB_CAIAQ_INPUT=y ++CONFIG_SND_USB_6FIRE=m ++CONFIG_SND_SOC=m ++CONFIG_SND_BCM2835_SOC_I2S=m ++CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC=m ++CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS=m ++CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI=m ++CONFIG_SND_BCM2708_SOC_HIFIBERRY_AMP=m ++CONFIG_SND_BCM2708_SOC_RPI_DAC=m ++CONFIG_SND_BCM2708_SOC_RPI_PROTO=m ++CONFIG_SND_BCM2708_SOC_BOOMBERRY_DAC=m ++CONFIG_SND_BCM2708_SOC_BOOMBERRY_DIGI=m ++CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC=m ++CONFIG_SND_BCM2708_SOC_RASPIDAC3=m ++CONFIG_SND_BCM2708_SOC_ADAU1977_ADC=m ++CONFIG_SND_AUDIOINJECTOR_PI_SOUNDCARD=m ++CONFIG_SND_SOC_ADAU1701=m ++CONFIG_SND_SOC_WM8804_I2C=m ++CONFIG_SND_SIMPLE_CARD=m ++CONFIG_SOUND_PRIME=m ++CONFIG_HIDRAW=y ++CONFIG_UHID=m ++CONFIG_HID_A4TECH=m ++CONFIG_HID_ACRUX=m ++CONFIG_HID_APPLE=m ++CONFIG_HID_BELKIN=m ++CONFIG_HID_BETOP_FF=m ++CONFIG_HID_CHERRY=m ++CONFIG_HID_CHICONY=m ++CONFIG_HID_CYPRESS=m ++CONFIG_HID_DRAGONRISE=m ++CONFIG_HID_EMS_FF=m ++CONFIG_HID_ELECOM=m ++CONFIG_HID_ELO=m ++CONFIG_HID_EZKEY=m ++CONFIG_HID_HOLTEK=m ++CONFIG_HID_KEYTOUCH=m ++CONFIG_HID_KYE=m ++CONFIG_HID_UCLOGIC=m ++CONFIG_HID_WALTOP=m ++CONFIG_HID_GYRATION=m ++CONFIG_HID_TWINHAN=m ++CONFIG_HID_KENSINGTON=m ++CONFIG_HID_LCPOWER=m ++CONFIG_HID_LOGITECH=m ++CONFIG_HID_LOGITECH_DJ=m ++CONFIG_LOGITECH_FF=y ++CONFIG_LOGIRUMBLEPAD2_FF=y ++CONFIG_LOGIG940_FF=y ++CONFIG_HID_MAGICMOUSE=m ++CONFIG_HID_MICROSOFT=m ++CONFIG_HID_MONTEREY=m ++CONFIG_HID_MULTITOUCH=m ++CONFIG_HID_NTRIG=m ++CONFIG_HID_ORTEK=m ++CONFIG_HID_PANTHERLORD=m ++CONFIG_HID_PETALYNX=m ++CONFIG_HID_PICOLCD=m ++CONFIG_HID_ROCCAT=m ++CONFIG_HID_SAMSUNG=m ++CONFIG_HID_SONY=m ++CONFIG_HID_SPEEDLINK=m ++CONFIG_HID_SUNPLUS=m ++CONFIG_HID_GREENASIA=m ++CONFIG_HID_SMARTJOYPLUS=m ++CONFIG_HID_TOPSEED=m ++CONFIG_HID_THINGM=m ++CONFIG_HID_THRUSTMASTER=m ++CONFIG_HID_WACOM=m ++CONFIG_HID_WIIMOTE=m ++CONFIG_HID_XINMO=m ++CONFIG_HID_ZEROPLUS=m ++CONFIG_HID_ZYDACRON=m ++CONFIG_HID_PID=y ++CONFIG_USB_HIDDEV=y ++CONFIG_USB=y ++CONFIG_USB_ANNOUNCE_NEW_DEVICES=y ++CONFIG_USB_MON=m ++CONFIG_USB_DWCOTG=y ++CONFIG_USB_PRINTER=m ++CONFIG_USB_STORAGE=y ++CONFIG_USB_STORAGE_REALTEK=m ++CONFIG_USB_STORAGE_DATAFAB=m ++CONFIG_USB_STORAGE_FREECOM=m ++CONFIG_USB_STORAGE_ISD200=m ++CONFIG_USB_STORAGE_USBAT=m ++CONFIG_USB_STORAGE_SDDR09=m ++CONFIG_USB_STORAGE_SDDR55=m ++CONFIG_USB_STORAGE_JUMPSHOT=m ++CONFIG_USB_STORAGE_ALAUDA=m ++CONFIG_USB_STORAGE_ONETOUCH=m ++CONFIG_USB_STORAGE_KARMA=m ++CONFIG_USB_STORAGE_CYPRESS_ATACB=m ++CONFIG_USB_STORAGE_ENE_UB6250=m ++CONFIG_USB_MDC800=m ++CONFIG_USB_MICROTEK=m ++CONFIG_USBIP_CORE=m ++CONFIG_USBIP_VHCI_HCD=m ++CONFIG_USBIP_HOST=m ++CONFIG_USB_SERIAL=m ++CONFIG_USB_SERIAL_GENERIC=y ++CONFIG_USB_SERIAL_AIRCABLE=m ++CONFIG_USB_SERIAL_ARK3116=m ++CONFIG_USB_SERIAL_BELKIN=m ++CONFIG_USB_SERIAL_CH341=m ++CONFIG_USB_SERIAL_WHITEHEAT=m ++CONFIG_USB_SERIAL_DIGI_ACCELEPORT=m ++CONFIG_USB_SERIAL_CP210X=m ++CONFIG_USB_SERIAL_CYPRESS_M8=m ++CONFIG_USB_SERIAL_EMPEG=m ++CONFIG_USB_SERIAL_FTDI_SIO=m ++CONFIG_USB_SERIAL_VISOR=m ++CONFIG_USB_SERIAL_IPAQ=m ++CONFIG_USB_SERIAL_IR=m ++CONFIG_USB_SERIAL_EDGEPORT=m ++CONFIG_USB_SERIAL_EDGEPORT_TI=m ++CONFIG_USB_SERIAL_F81232=m ++CONFIG_USB_SERIAL_GARMIN=m ++CONFIG_USB_SERIAL_IPW=m ++CONFIG_USB_SERIAL_IUU=m ++CONFIG_USB_SERIAL_KEYSPAN_PDA=m ++CONFIG_USB_SERIAL_KEYSPAN=m ++CONFIG_USB_SERIAL_KLSI=m ++CONFIG_USB_SERIAL_KOBIL_SCT=m ++CONFIG_USB_SERIAL_MCT_U232=m ++CONFIG_USB_SERIAL_METRO=m ++CONFIG_USB_SERIAL_MOS7720=m ++CONFIG_USB_SERIAL_MOS7840=m ++CONFIG_USB_SERIAL_NAVMAN=m ++CONFIG_USB_SERIAL_PL2303=m ++CONFIG_USB_SERIAL_OTI6858=m ++CONFIG_USB_SERIAL_QCAUX=m ++CONFIG_USB_SERIAL_QUALCOMM=m ++CONFIG_USB_SERIAL_SPCP8X5=m ++CONFIG_USB_SERIAL_SAFE=m ++CONFIG_USB_SERIAL_SIERRAWIRELESS=m ++CONFIG_USB_SERIAL_SYMBOL=m ++CONFIG_USB_SERIAL_TI=m ++CONFIG_USB_SERIAL_CYBERJACK=m ++CONFIG_USB_SERIAL_XIRCOM=m ++CONFIG_USB_SERIAL_OPTION=m ++CONFIG_USB_SERIAL_OMNINET=m ++CONFIG_USB_SERIAL_OPTICON=m ++CONFIG_USB_SERIAL_XSENS_MT=m ++CONFIG_USB_SERIAL_WISHBONE=m ++CONFIG_USB_SERIAL_SSU100=m ++CONFIG_USB_SERIAL_QT2=m ++CONFIG_USB_SERIAL_DEBUG=m ++CONFIG_USB_EMI62=m ++CONFIG_USB_EMI26=m ++CONFIG_USB_ADUTUX=m ++CONFIG_USB_SEVSEG=m ++CONFIG_USB_RIO500=m ++CONFIG_USB_LEGOTOWER=m ++CONFIG_USB_LCD=m ++CONFIG_USB_LED=m ++CONFIG_USB_CYPRESS_CY7C63=m ++CONFIG_USB_CYTHERM=m ++CONFIG_USB_IDMOUSE=m ++CONFIG_USB_FTDI_ELAN=m ++CONFIG_USB_APPLEDISPLAY=m ++CONFIG_USB_LD=m ++CONFIG_USB_TRANCEVIBRATOR=m ++CONFIG_USB_IOWARRIOR=m ++CONFIG_USB_TEST=m ++CONFIG_USB_ISIGHTFW=m ++CONFIG_USB_YUREX=m ++CONFIG_USB_ATM=m ++CONFIG_USB_SPEEDTOUCH=m ++CONFIG_USB_CXACRU=m ++CONFIG_USB_UEAGLEATM=m ++CONFIG_USB_XUSBATM=m ++CONFIG_MMC=y ++CONFIG_MMC_BLOCK_MINORS=32 ++CONFIG_MMC_BCM2835=y ++CONFIG_MMC_BCM2835_DMA=y ++CONFIG_MMC_BCM2835_SDHOST=y ++CONFIG_MMC_SDHCI=y ++CONFIG_MMC_SDHCI_PLTFM=y ++CONFIG_MMC_SPI=m ++CONFIG_LEDS_CLASS=y ++CONFIG_LEDS_GPIO=y ++CONFIG_LEDS_TRIGGER_TIMER=y ++CONFIG_LEDS_TRIGGER_ONESHOT=y ++CONFIG_LEDS_TRIGGER_HEARTBEAT=y ++CONFIG_LEDS_TRIGGER_BACKLIGHT=y ++CONFIG_LEDS_TRIGGER_CPU=y ++CONFIG_LEDS_TRIGGER_GPIO=y ++CONFIG_LEDS_TRIGGER_DEFAULT_ON=y ++CONFIG_LEDS_TRIGGER_TRANSIENT=m ++CONFIG_LEDS_TRIGGER_CAMERA=m ++CONFIG_LEDS_TRIGGER_INPUT=y ++CONFIG_RTC_CLASS=y ++# CONFIG_RTC_HCTOSYS is not set ++CONFIG_RTC_DRV_DS1307=m ++CONFIG_RTC_DRV_DS1374=m ++CONFIG_RTC_DRV_DS1672=m ++CONFIG_RTC_DRV_MAX6900=m ++CONFIG_RTC_DRV_RS5C372=m ++CONFIG_RTC_DRV_ISL1208=m ++CONFIG_RTC_DRV_ISL12022=m ++CONFIG_RTC_DRV_ISL12057=m ++CONFIG_RTC_DRV_X1205=m ++CONFIG_RTC_DRV_PCF8523=m ++CONFIG_RTC_DRV_PCF8563=m ++CONFIG_RTC_DRV_PCF8583=m ++CONFIG_RTC_DRV_M41T80=m ++CONFIG_RTC_DRV_BQ32K=m ++CONFIG_RTC_DRV_S35390A=m ++CONFIG_RTC_DRV_FM3130=m ++CONFIG_RTC_DRV_RX8581=m ++CONFIG_RTC_DRV_RX8025=m ++CONFIG_RTC_DRV_EM3027=m ++CONFIG_RTC_DRV_RV3029C2=m ++CONFIG_RTC_DRV_M41T93=m ++CONFIG_RTC_DRV_M41T94=m ++CONFIG_RTC_DRV_DS1305=m ++CONFIG_RTC_DRV_DS1390=m ++CONFIG_RTC_DRV_R9701=m ++CONFIG_RTC_DRV_RX4581=m ++CONFIG_RTC_DRV_RS5C348=m ++CONFIG_RTC_DRV_MAX6902=m ++CONFIG_RTC_DRV_PCF2123=m ++CONFIG_RTC_DRV_DS3232=m ++CONFIG_RTC_DRV_PCF2127=m ++CONFIG_DMADEVICES=y ++CONFIG_DMA_BCM2835=y ++CONFIG_DMA_BCM2708=y ++CONFIG_UIO=m ++CONFIG_UIO_PDRV_GENIRQ=m ++CONFIG_STAGING=y ++CONFIG_PRISM2_USB=m ++CONFIG_R8712U=m ++CONFIG_R8188EU=m ++CONFIG_R8723AU=m ++CONFIG_VT6656=m ++CONFIG_SPEAKUP=m ++CONFIG_SPEAKUP_SYNTH_SOFT=m ++CONFIG_STAGING_MEDIA=y ++CONFIG_LIRC_STAGING=y ++CONFIG_LIRC_IMON=m ++CONFIG_LIRC_RPI=m ++CONFIG_LIRC_SASEM=m ++CONFIG_LIRC_SERIAL=m ++CONFIG_FB_TFT=m ++CONFIG_FB_TFT_AGM1264K_FL=m ++CONFIG_FB_TFT_BD663474=m ++CONFIG_FB_TFT_HX8340BN=m ++CONFIG_FB_TFT_HX8347D=m ++CONFIG_FB_TFT_HX8353D=m ++CONFIG_FB_TFT_ILI9163=m ++CONFIG_FB_TFT_ILI9320=m ++CONFIG_FB_TFT_ILI9325=m ++CONFIG_FB_TFT_ILI9340=m ++CONFIG_FB_TFT_ILI9341=m ++CONFIG_FB_TFT_ILI9481=m ++CONFIG_FB_TFT_ILI9486=m ++CONFIG_FB_TFT_PCD8544=m ++CONFIG_FB_TFT_RA8875=m ++CONFIG_FB_TFT_S6D02A1=m ++CONFIG_FB_TFT_S6D1121=m ++CONFIG_FB_TFT_SSD1289=m ++CONFIG_FB_TFT_SSD1306=m ++CONFIG_FB_TFT_SSD1331=m ++CONFIG_FB_TFT_SSD1351=m ++CONFIG_FB_TFT_ST7735R=m ++CONFIG_FB_TFT_TINYLCD=m ++CONFIG_FB_TFT_TLS8204=m ++CONFIG_FB_TFT_UC1701=m ++CONFIG_FB_TFT_UPD161704=m ++CONFIG_FB_TFT_WATTEROTT=m ++CONFIG_FB_FLEX=m ++CONFIG_FB_TFT_FBTFT_DEVICE=m ++CONFIG_MAILBOX=y ++CONFIG_BCM2835_MBOX=y ++# CONFIG_IOMMU_SUPPORT is not set ++CONFIG_RASPBERRYPI_POWER=y ++CONFIG_EXTCON=m ++CONFIG_EXTCON_ARIZONA=m ++CONFIG_IIO=m ++CONFIG_IIO_BUFFER=y ++CONFIG_IIO_BUFFER_CB=m ++CONFIG_IIO_KFIFO_BUF=m ++CONFIG_MCP320X=m ++CONFIG_MCP3422=m ++CONFIG_DHT11=m ++CONFIG_PWM_BCM2835=m ++CONFIG_PWM_PCA9685=m ++CONFIG_RASPBERRYPI_FIRMWARE=y ++CONFIG_EXT4_FS=y ++CONFIG_EXT4_FS_POSIX_ACL=y ++CONFIG_EXT4_FS_SECURITY=y ++CONFIG_REISERFS_FS=m ++CONFIG_REISERFS_FS_XATTR=y ++CONFIG_REISERFS_FS_POSIX_ACL=y ++CONFIG_REISERFS_FS_SECURITY=y ++CONFIG_JFS_FS=m ++CONFIG_JFS_POSIX_ACL=y ++CONFIG_JFS_SECURITY=y ++CONFIG_JFS_STATISTICS=y ++CONFIG_XFS_FS=m ++CONFIG_XFS_QUOTA=y ++CONFIG_XFS_POSIX_ACL=y ++CONFIG_XFS_RT=y ++CONFIG_GFS2_FS=m ++CONFIG_OCFS2_FS=m ++CONFIG_BTRFS_FS=m ++CONFIG_BTRFS_FS_POSIX_ACL=y ++CONFIG_NILFS2_FS=m ++CONFIG_F2FS_FS=y ++CONFIG_FANOTIFY=y ++CONFIG_QFMT_V1=m ++CONFIG_QFMT_V2=m ++CONFIG_AUTOFS4_FS=y ++CONFIG_FUSE_FS=m ++CONFIG_CUSE=m ++CONFIG_OVERLAY_FS=m ++CONFIG_FSCACHE=y ++CONFIG_FSCACHE_STATS=y ++CONFIG_FSCACHE_HISTOGRAM=y ++CONFIG_CACHEFILES=y ++CONFIG_ISO9660_FS=m ++CONFIG_JOLIET=y ++CONFIG_ZISOFS=y ++CONFIG_UDF_FS=m ++CONFIG_MSDOS_FS=y ++CONFIG_VFAT_FS=y ++CONFIG_FAT_DEFAULT_IOCHARSET="ascii" ++CONFIG_NTFS_FS=m ++CONFIG_NTFS_RW=y ++CONFIG_TMPFS=y ++CONFIG_TMPFS_POSIX_ACL=y ++CONFIG_ECRYPT_FS=m ++CONFIG_HFS_FS=m ++CONFIG_HFSPLUS_FS=m ++CONFIG_JFFS2_FS=m ++CONFIG_JFFS2_SUMMARY=y ++CONFIG_UBIFS_FS=m ++CONFIG_SQUASHFS=m ++CONFIG_SQUASHFS_XATTR=y ++CONFIG_SQUASHFS_LZO=y ++CONFIG_SQUASHFS_XZ=y ++CONFIG_NFS_FS=y ++CONFIG_NFS_V3_ACL=y ++CONFIG_NFS_V4=y ++CONFIG_NFS_SWAP=y ++CONFIG_ROOT_NFS=y ++CONFIG_NFS_FSCACHE=y ++CONFIG_NFSD=m ++CONFIG_NFSD_V3_ACL=y ++CONFIG_NFSD_V4=y ++CONFIG_CIFS=m ++CONFIG_CIFS_WEAK_PW_HASH=y ++CONFIG_CIFS_UPCALL=y ++CONFIG_CIFS_XATTR=y ++CONFIG_CIFS_POSIX=y ++CONFIG_CIFS_ACL=y ++CONFIG_CIFS_DFS_UPCALL=y ++CONFIG_CIFS_SMB2=y ++CONFIG_CIFS_FSCACHE=y ++CONFIG_9P_FS=m ++CONFIG_9P_FS_POSIX_ACL=y ++CONFIG_NLS_DEFAULT="utf8" ++CONFIG_NLS_CODEPAGE_437=y ++CONFIG_NLS_CODEPAGE_737=m ++CONFIG_NLS_CODEPAGE_775=m ++CONFIG_NLS_CODEPAGE_850=m ++CONFIG_NLS_CODEPAGE_852=m ++CONFIG_NLS_CODEPAGE_855=m ++CONFIG_NLS_CODEPAGE_857=m ++CONFIG_NLS_CODEPAGE_860=m ++CONFIG_NLS_CODEPAGE_861=m ++CONFIG_NLS_CODEPAGE_862=m ++CONFIG_NLS_CODEPAGE_863=m ++CONFIG_NLS_CODEPAGE_864=m ++CONFIG_NLS_CODEPAGE_865=m ++CONFIG_NLS_CODEPAGE_866=m ++CONFIG_NLS_CODEPAGE_869=m ++CONFIG_NLS_CODEPAGE_936=m ++CONFIG_NLS_CODEPAGE_950=m ++CONFIG_NLS_CODEPAGE_932=m ++CONFIG_NLS_CODEPAGE_949=m ++CONFIG_NLS_CODEPAGE_874=m ++CONFIG_NLS_ISO8859_8=m ++CONFIG_NLS_CODEPAGE_1250=m ++CONFIG_NLS_CODEPAGE_1251=m ++CONFIG_NLS_ASCII=y ++CONFIG_NLS_ISO8859_1=m ++CONFIG_NLS_ISO8859_2=m ++CONFIG_NLS_ISO8859_3=m ++CONFIG_NLS_ISO8859_4=m ++CONFIG_NLS_ISO8859_5=m ++CONFIG_NLS_ISO8859_6=m ++CONFIG_NLS_ISO8859_7=m ++CONFIG_NLS_ISO8859_9=m ++CONFIG_NLS_ISO8859_13=m ++CONFIG_NLS_ISO8859_14=m ++CONFIG_NLS_ISO8859_15=m ++CONFIG_NLS_KOI8_R=m ++CONFIG_NLS_KOI8_U=m ++CONFIG_DLM=m ++CONFIG_PRINTK_TIME=y ++CONFIG_BOOT_PRINTK_DELAY=y ++CONFIG_DEBUG_MEMORY_INIT=y ++CONFIG_DETECT_HUNG_TASK=y ++CONFIG_TIMER_STATS=y ++CONFIG_IRQSOFF_TRACER=y ++CONFIG_SCHED_TRACER=y ++CONFIG_STACK_TRACER=y ++CONFIG_BLK_DEV_IO_TRACE=y ++# CONFIG_KPROBE_EVENT is not set ++CONFIG_FUNCTION_PROFILER=y ++CONFIG_KGDB=y ++CONFIG_KGDB_KDB=y ++CONFIG_KDB_KEYBOARD=y ++CONFIG_CRYPTO_USER=m ++CONFIG_CRYPTO_CBC=y ++CONFIG_CRYPTO_CTS=m ++CONFIG_CRYPTO_XTS=m ++CONFIG_CRYPTO_XCBC=m ++CONFIG_CRYPTO_TGR192=m ++CONFIG_CRYPTO_WP512=m ++CONFIG_CRYPTO_CAST5=m ++CONFIG_CRYPTO_DES=y ++CONFIG_CRYPTO_USER_API_SKCIPHER=m ++# CONFIG_CRYPTO_HW is not set ++CONFIG_ARM_CRYPTO=y ++CONFIG_CRYPTO_SHA1_ARM_NEON=m ++CONFIG_CRYPTO_AES_ARM_BS=m ++CONFIG_CRC_ITU_T=y ++CONFIG_LIBCRC32C=y diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig -index 146add9..d6aa058 100644 ---- a/arch/arm/configs/bcmrpi_defconfig -+++ b/arch/arm/configs/bcmrpi_defconfig -@@ -795,6 +795,8 @@ CONFIG_VIDEO_TW9903=m - CONFIG_VIDEO_TW9906=m - CONFIG_VIDEO_OV7640=m - CONFIG_VIDEO_MT9V011=m -+CONFIG_DRM=m -+CONFIG_DRM_VC4=m - CONFIG_FB=y - CONFIG_FB_BCM2708=y - CONFIG_FB_UDL=m - -From 88315025318218ac04fcc66614083bb1a51f662f Mon Sep 17 00:00:00 2001 -From: popcornmix <popcornmix@gmail.com> -Date: Wed, 18 Nov 2015 18:29:58 +0000 -Subject: [PATCH 103/170] squash: fixups - ---- - drivers/gpu/drm/vc4/Kconfig | 2 +- - drivers/gpu/drm/vc4/vc4_drv.c | 2 +- - drivers/gpu/drm/vc4/vc4_kms.c | 2 +- - 3 files changed, 3 insertions(+), 3 deletions(-) - -diff --git a/drivers/gpu/drm/vc4/Kconfig b/drivers/gpu/drm/vc4/Kconfig -index 2d7d115..71f019f 100644 ---- a/drivers/gpu/drm/vc4/Kconfig -+++ b/drivers/gpu/drm/vc4/Kconfig -@@ -1,6 +1,6 @@ - config DRM_VC4 - tristate "Broadcom VC4 Graphics" -- depends on ARCH_BCM2835 || COMPILE_TEST -+ depends on ARCH_BCM2835 || ARCH_BCM2708 || ARCH_BCM2709 || COMPILE_TEST - depends on DRM && HAVE_DMA_ATTRS - select DRM_KMS_HELPER - select DRM_KMS_CMA_HELPER -diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c -index 3baf1fc..e2a2be2 100644 ---- a/drivers/gpu/drm/vc4/vc4_drv.c -+++ b/drivers/gpu/drm/vc4/vc4_drv.c -@@ -127,7 +127,7 @@ static struct drm_driver vc4_drm_driver = { - .num_ioctls = ARRAY_SIZE(vc4_drm_ioctls), - .fops = &vc4_drm_fops, - -- .gem_obj_size = sizeof(struct vc4_bo), -+ //.gem_obj_size = sizeof(struct vc4_bo), - - .name = DRIVER_NAME, - .desc = DRIVER_DESC, -diff --git a/drivers/gpu/drm/vc4/vc4_kms.c b/drivers/gpu/drm/vc4/vc4_kms.c -index c83287a..2082713 100644 ---- a/drivers/gpu/drm/vc4/vc4_kms.c -+++ b/drivers/gpu/drm/vc4/vc4_kms.c -@@ -45,7 +45,7 @@ vc4_atomic_complete_commit(struct vc4_commit *c) - - drm_atomic_helper_commit_modeset_disables(dev, state); - -- drm_atomic_helper_commit_planes(dev, state); -+ drm_atomic_helper_commit_planes(dev, state, false); - - drm_atomic_helper_commit_modeset_enables(dev, state); - - -From 3fc233b798ac8498b4e24b42ad67fb3499a30f07 Mon Sep 17 00:00:00 2001 -From: popcornmix <popcornmix@gmail.com> -Date: Wed, 18 Nov 2015 20:26:03 +0000 -Subject: [PATCH 104/170] squash: add missing vc4-kms-v3d-overlay.dtb to - makefile - ---- - arch/arm/boot/dts/overlays/Makefile | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/arch/arm/boot/dts/overlays/Makefile b/arch/arm/boot/dts/overlays/Makefile -index fb7ac49..fc09bfb 100644 ---- a/arch/arm/boot/dts/overlays/Makefile -+++ b/arch/arm/boot/dts/overlays/Makefile -@@ -52,6 +52,7 @@ dtb-$(RPI_DT_OVERLAYS) += smi-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += spi-gpio35-39-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += tinylcd35-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += uart1-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += vc4-kms-v3d-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += vga666-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += w1-gpio-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += w1-gpio-pullup-overlay.dtb - -From d9888c76bcee2a7c118ab8ba93a1204fb5ff4e44 Mon Sep 17 00:00:00 2001 -From: Eric Anholt <eric@anholt.net> -Date: Mon, 12 Oct 2015 11:23:34 -0700 -Subject: [PATCH 105/170] clk: bcm2835: Also build the driver for downstream - kernels. - -Signed-off-by: Eric Anholt <eric@anholt.net> ---- - drivers/clk/bcm/Makefile | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/drivers/clk/bcm/Makefile b/drivers/clk/bcm/Makefile -index 3fc9506..a1b4cbc 100644 ---- a/drivers/clk/bcm/Makefile -+++ b/drivers/clk/bcm/Makefile -@@ -3,7 +3,7 @@ obj-$(CONFIG_CLK_BCM_KONA) += clk-kona-setup.o - obj-$(CONFIG_CLK_BCM_KONA) += clk-bcm281xx.o - obj-$(CONFIG_CLK_BCM_KONA) += clk-bcm21664.o - obj-$(CONFIG_COMMON_CLK_IPROC) += clk-iproc-armpll.o clk-iproc-pll.o clk-iproc-asiu.o --obj-$(CONFIG_ARCH_BCM2835) += clk-bcm2835.o -+obj-$(CONFIG_ARCH_BCM2835)$(CONFIG_ARCH_BCM2708)$(CONFIG_ARCH_BCM2709) += clk-bcm2835.o - obj-$(CONFIG_COMMON_CLK_IPROC) += clk-ns2.o - obj-$(CONFIG_ARCH_BCM_CYGNUS) += clk-cygnus.o - obj-$(CONFIG_ARCH_BCM_NSP) += clk-nsp.o - -From 0dbc0fe760a54bbcff587657062df49dc0eaf2b9 Mon Sep 17 00:00:00 2001 -From: Holger Steinhaus <hsteinhaus@gmx.de> -Date: Sat, 14 Nov 2015 18:37:43 +0100 -Subject: [PATCH 106/170] dts: Added overlay for gpio_ir_recv driver - ---- - arch/arm/boot/dts/overlays/Makefile | 1 + - arch/arm/boot/dts/overlays/README | 18 ++++++++++- - arch/arm/boot/dts/overlays/gpio-ir-overlay.dts | 45 ++++++++++++++++++++++++++ - 3 files changed, 63 insertions(+), 1 deletion(-) - create mode 100644 arch/arm/boot/dts/overlays/gpio-ir-overlay.dts - -diff --git a/arch/arm/boot/dts/overlays/Makefile b/arch/arm/boot/dts/overlays/Makefile -index fc09bfb..ebc3354 100644 ---- a/arch/arm/boot/dts/overlays/Makefile -+++ b/arch/arm/boot/dts/overlays/Makefile -@@ -16,6 +16,7 @@ dtb-$(RPI_DT_OVERLAYS) += ads7846-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += bmp085_i2c-sensor-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += dht11-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += enc28j60-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += gpio-ir-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += gpio-poweroff-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += hifiberry-amp-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += hifiberry-dac-overlay.dtb -diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README -index f5302b2..409aee1 100644 ---- a/arch/arm/boot/dts/overlays/README -+++ b/arch/arm/boot/dts/overlays/README -@@ -196,6 +196,22 @@ Params: int_pin GPIO used for INT (default 25) - speed SPI bus speed (default 12000000) - - -+Name: gpio-ir -+Info: Use GPIO pin as rc-core style infrared receiver input. The rc-core- -+ based gpio_ir_recv driver maps received keys directly to a -+ /dev/input/event* device, all decoding is done by the kernel - LIRC is -+ not required! The key mapping and other decoding parameters can be -+ configured by "ir-keytable" tool. -+Load: dtoverlay=gpio-ir,<param>=<val> -+Params: gpio_pin Input pin number. Default is 18. -+ -+ gpio_pull Desired pull-up/down state (off, down, up) -+ Default is "down". -+ -+ rc-map-name Default rc keymap (can also be changed by -+ ir-keytable), defaults to "rc-rc6-mce" -+ -+ - Name: gpio-poweroff - Info: Drives a GPIO high or low on reboot - Load: dtoverlay=gpio-poweroff,<param>=<val> -@@ -308,7 +324,7 @@ Params: <None> - Name: lirc-rpi - Info: Configures lirc-rpi (Linux Infrared Remote Control for Raspberry Pi) - Consult the module documentation for more details. --Load: dtoverlay=lirc-rpi,<param>=<val>,... -+Load: dtoverlay=lirc-rpi,<param>=<val> - Params: gpio_out_pin GPIO for output (default "17") - - gpio_in_pin GPIO for input (default "18") -diff --git a/arch/arm/boot/dts/overlays/gpio-ir-overlay.dts b/arch/arm/boot/dts/overlays/gpio-ir-overlay.dts -new file mode 100644 -index 0000000..a2d6bc7 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/gpio-ir-overlay.dts -@@ -0,0 +1,45 @@ -+// Definitions for ir-gpio module -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target-path = "/"; -+ __overlay__ { -+ gpio_ir: ir-receiver { -+ compatible = "gpio-ir-receiver"; -+ -+ // pin number, high or low -+ gpios = <&gpio 18 1>; -+ -+ // parameter for keymap name -+ linux,rc-map-name = "rc-rc6-mce"; -+ -+ status = "okay"; -+ }; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&gpio>; -+ __overlay__ { -+ gpio_ir_pins: gpio_ir_pins { -+ brcm,pins = <18>; // pin 18 -+ brcm,function = <0>; // in -+ brcm,pull = <1>; // down -+ }; -+ }; -+ }; -+ -+ __overrides__ { -+ // parameters -+ gpio_pin = <&gpio_ir>,"gpios:4", -+ <&gpio_ir_pins>,"brcm,pins:0", -+ <&gpio_ir_pins>,"brcm,pull:0"; // pin number -+ gpio_pull = <&gpio_ir_pins>,"brcm,pull:0"; // pull-up/down state -+ -+ rc-map-name = <&gpio_ir>,"linux,rc-map-name"; // default rc map -+ }; -+}; - -From 938b09ce6c6736d0861c2c9eec3a7e739585b589 Mon Sep 17 00:00:00 2001 -From: Alistair Buxton <a.j.buxton@gmail.com> -Date: Sun, 1 Nov 2015 22:27:56 +0000 -Subject: [PATCH 107/170] Build i2c_gpio module and add a device tree overlay - to configure it. - ---- - arch/arm/boot/dts/overlays/Makefile | 1 + - arch/arm/boot/dts/overlays/README | 13 +++++++++++- - arch/arm/boot/dts/overlays/i2c-gpio-overlay.dts | 28 +++++++++++++++++++++++++ - arch/arm/configs/bcm2709_defconfig | 1 + - arch/arm/configs/bcmrpi_defconfig | 1 + - 5 files changed, 43 insertions(+), 1 deletion(-) - create mode 100644 arch/arm/boot/dts/overlays/i2c-gpio-overlay.dts - -diff --git a/arch/arm/boot/dts/overlays/Makefile b/arch/arm/boot/dts/overlays/Makefile -index ebc3354..e15d55c 100644 ---- a/arch/arm/boot/dts/overlays/Makefile -+++ b/arch/arm/boot/dts/overlays/Makefile -@@ -25,6 +25,7 @@ dtb-$(RPI_DT_OVERLAYS) += hifiberry-digi-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += hy28a-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += hy28b-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += i2c-rtc-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += i2c-gpio-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += i2s-mmap-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += iqaudio-dac-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += iqaudio-dacplus-overlay.dtb -diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README -index 409aee1..d278305 100644 ---- a/arch/arm/boot/dts/overlays/README -+++ b/arch/arm/boot/dts/overlays/README -@@ -287,9 +287,20 @@ Params: speed Display SPI bus speed - ledgpio GPIO used to control backlight - - -+Name: i2c-gpio -+Info: Adds support for software i2c controller on gpio pins -+Load: dtoverlay=i2c-gpio,<param>=<val> -+Params: i2c_gpio_sda GPIO used for I2C data (default "23") -+ -+ i2c_gpio_scl GPIO used for I2C clock (default "24") -+ -+ i2c_gpio_delay_us Clock delay in microseconds -+ (default "2" = ~100kHz) -+ -+ - Name: i2c-rtc - Info: Adds support for a number of I2C Real Time Clock devices --Load: dtoverlay=i2c-rtc,<param> -+Load: dtoverlay=i2c-rtc,<param>=<val> - Params: ds1307 Select the DS1307 device - - ds3231 Select the DS3231 device -diff --git a/arch/arm/boot/dts/overlays/i2c-gpio-overlay.dts b/arch/arm/boot/dts/overlays/i2c-gpio-overlay.dts new file mode 100644 -index 0000000..2a2dc98 +index 0000000..8bd0207 --- /dev/null -+++ b/arch/arm/boot/dts/overlays/i2c-gpio-overlay.dts -@@ -0,0 +1,28 @@ -+// Overlay for i2c_gpio bitbanging host bus. -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target-path = "/"; -+ __overlay__ { -+ i2c_gpio: i2c@0 { -+ compatible = "i2c-gpio"; -+ gpios = <&gpio 23 0 /* sda */ -+ &gpio 24 0 /* scl */ -+ >; -+ i2c-gpio,delay-us = <2>; /* ~100 kHz */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ }; -+ }; -+ }; -+ __overrides__ { -+ i2c_gpio_sda = <&i2c_gpio>,"gpios:4"; -+ i2c_gpio_scl = <&i2c_gpio>,"gpios:16"; -+ i2c_gpio_delay_us = <&i2c_gpio>,"i2c-gpio,delay-us:0"; -+ }; -+}; -+ -diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig -index 4e474c7..fc35254 100644 ---- a/arch/arm/configs/bcm2709_defconfig -+++ b/arch/arm/configs/bcm2709_defconfig -@@ -595,6 +595,7 @@ CONFIG_RAW_DRIVER=y - CONFIG_I2C=y - CONFIG_I2C_CHARDEV=m - CONFIG_I2C_BCM2708=m -+CONFIG_I2C_GPIO=m - CONFIG_SPI=y - CONFIG_SPI_BCM2835=m - CONFIG_SPI_SPIDEV=y -diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig -index d6aa058..51dc019 100644 ---- a/arch/arm/configs/bcmrpi_defconfig +++ b/arch/arm/configs/bcmrpi_defconfig -@@ -588,6 +588,7 @@ CONFIG_RAW_DRIVER=y - CONFIG_I2C=y - CONFIG_I2C_CHARDEV=m - CONFIG_I2C_BCM2708=m -+CONFIG_I2C_GPIO=m - CONFIG_SPI=y - CONFIG_SPI_BCM2835=m - CONFIG_SPI_SPIDEV=y - -From a4b5aa412585674d4a4f2ba7c0d818fd796f51c3 Mon Sep 17 00:00:00 2001 -From: mwilliams03 <mark.mwilliams@gmail.com> -Date: Sun, 18 Oct 2015 17:07:24 -0700 -Subject: [PATCH 108/170] New overlay for PiScreen2r - ---- - arch/arm/boot/dts/overlays/Makefile | 1 + - arch/arm/boot/dts/overlays/README | 14 +++ - arch/arm/boot/dts/overlays/piscreen2r-overlay.dts | 100 ++++++++++++++++++++++ - 3 files changed, 115 insertions(+) - create mode 100644 arch/arm/boot/dts/overlays/piscreen2r-overlay.dts - -diff --git a/arch/arm/boot/dts/overlays/Makefile b/arch/arm/boot/dts/overlays/Makefile -index e15d55c..8595b14 100644 ---- a/arch/arm/boot/dts/overlays/Makefile -+++ b/arch/arm/boot/dts/overlays/Makefile -@@ -35,6 +35,7 @@ dtb-$(RPI_DT_OVERLAYS) += mcp2515-can1-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += mmc-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += mz61581-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += piscreen-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += piscreen2r-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += pitft28-resistive-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += pps-gpio-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += pwm-overlay.dtb -diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README -index d278305..3116d1a 100644 ---- a/arch/arm/boot/dts/overlays/README -+++ b/arch/arm/boot/dts/overlays/README -@@ -425,6 +425,20 @@ Params: speed Display SPI bus speed - xohms Touchpanel sensitivity (X-plate resistance) - - -+Name: piscreen2r -+Info: PiScreen 2 with resistive TP display by OzzMaker.com -+Load: dtoverlay=piscreen2r,<param>=<val> -+Params: speed Display SPI bus speed -+ -+ rotate Display rotation {0,90,180,270} -+ -+ fps Delay between frame updates -+ -+ debug Debug output level {0-7} -+ -+ xohms Touchpanel sensitivity (X-plate resistance) -+ -+ - Name: pitft28-resistive - Info: Adafruit PiTFT 2.8" resistive touch screen - Load: dtoverlay=pitft28-resistive,<param>=<val> -diff --git a/arch/arm/boot/dts/overlays/piscreen2r-overlay.dts b/arch/arm/boot/dts/overlays/piscreen2r-overlay.dts -new file mode 100644 -index 0000000..7c018e0 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/piscreen2r-overlay.dts -@@ -0,0 +1,100 @@ -+ /* -+ * Device Tree overlay for PiScreen2 3.5" TFT with resistive touch by Ozzmaker.com -+ * -+ */ -+ -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; -+ -+ fragment@0 { -+ target = <&spi0>; -+ __overlay__ { -+ status = "okay"; -+ -+ spidev@0{ -+ status = "disabled"; -+ }; -+ -+ spidev@1{ -+ status = "disabled"; -+ }; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&gpio>; -+ __overlay__ { -+ piscreen2_pins: piscreen2_pins { -+ brcm,pins = <17 25 24 22>; -+ brcm,function = <0 1 1 1>; /* in out out out */ -+ }; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&spi0>; -+ __overlay__ { -+ /* needed to avoid dtc warning */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ piscreen2: piscreen2@0{ -+ compatible = "ilitek,ili9486"; -+ reg = <0>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&piscreen2_pins>; -+ bgr; -+ spi-max-frequency = <64000000>; -+ rotate = <90>; -+ fps = <30>; -+ buswidth = <8>; -+ regwidth = <16>; -+ txbuflen = <32768>; -+ reset-gpios = <&gpio 25 0>; -+ dc-gpios = <&gpio 24 0>; -+ led-gpios = <&gpio 22 1>; -+ debug = <0>; -+ -+ init = <0x10000b0 0x00 -+ 0x1000011 -+ 0x20000ff -+ 0x100003a 0x55 -+ 0x1000036 0x28 -+ 0x10000c0 0x11 0x09 -+ 0x10000c1 0x41 -+ 0x10000c5 0x00 0x00 0x00 0x00 -+ 0x10000b6 0x00 0x02 -+ 0x10000f7 0xa9 0x51 0x2c 0x2 -+ 0x10000be 0x00 0x04 -+ 0x10000e9 0x00 -+ 0x1000011 -+ 0x1000029>; -+ -+ }; -+ -+ piscreen2_ts: piscreen2-ts@1 { -+ compatible = "ti,ads7846"; -+ reg = <1>; -+ -+ spi-max-frequency = <2000000>; -+ interrupts = <17 2>; /* high-to-low edge triggered */ -+ interrupt-parent = <&gpio>; -+ pendown-gpio = <&gpio 17 0>; -+ ti,swap-xy; -+ ti,x-plate-ohms = /bits/ 16 <100>; -+ ti,pressure-max = /bits/ 16 <255>; -+ }; -+ }; -+ }; -+ __overrides__ { -+ speed = <&piscreen2>,"spi-max-frequency:0"; -+ rotate = <&piscreen2>,"rotate:0"; -+ fps = <&piscreen2>,"fps:0"; -+ debug = <&piscreen2>,"debug:0"; -+ xohms = <&piscreen2_ts>,"ti,x-plate-ohms;0"; -+ }; -+}; -+ - -From 1a4fac1ea6bb33a963b06406f6f44b527daa3a90 Mon Sep 17 00:00:00 2001 -From: Ondrej Wisniewski <ondrej.wisniewski@gmail.com> -Date: Fri, 6 Nov 2015 15:01:28 +0100 -Subject: [PATCH 109/170] dts: Added overlay for Adafruit PiTFT 2.8" capacitive - touch screen - ---- - arch/arm/boot/dts/overlays/Makefile | 1 + - arch/arm/boot/dts/overlays/README | 22 ++++++ - .../dts/overlays/pitft28-capacitive-overlay.dts | 88 ++++++++++++++++++++++ - 3 files changed, 111 insertions(+) - create mode 100644 arch/arm/boot/dts/overlays/pitft28-capacitive-overlay.dts - -diff --git a/arch/arm/boot/dts/overlays/Makefile b/arch/arm/boot/dts/overlays/Makefile -index 8595b14..7d747bc 100644 ---- a/arch/arm/boot/dts/overlays/Makefile -+++ b/arch/arm/boot/dts/overlays/Makefile -@@ -36,6 +36,7 @@ dtb-$(RPI_DT_OVERLAYS) += mmc-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += mz61581-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += piscreen-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += piscreen2r-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += pitft28-capacitive-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += pitft28-resistive-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += pps-gpio-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += pwm-overlay.dtb -diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README -index 3116d1a..950b6c5 100644 ---- a/arch/arm/boot/dts/overlays/README -+++ b/arch/arm/boot/dts/overlays/README -@@ -439,6 +439,28 @@ Params: speed Display SPI bus speed - xohms Touchpanel sensitivity (X-plate resistance) - - -+Name: pitft28-capacitive -+Info: Adafruit PiTFT 2.8" capacitive touch screen -+Load: dtoverlay=pitft28-capacitive,<param>=<val> -+Params: speed Display SPI bus speed -+ -+ rotate Display rotation {0,90,180,270} -+ -+ fps Delay between frame updates -+ -+ debug Debug output level {0-7} -+ -+ touch-sizex Touchscreen size x (default 240) -+ -+ touch-sizey Touchscreen size y (default 320) -+ -+ touch-invx Touchscreen inverted x axis -+ -+ touch-invy Touchscreen inverted y axis -+ -+ touch-swapxy Touchscreen swapped x y axis -+ -+ - Name: pitft28-resistive - Info: Adafruit PiTFT 2.8" resistive touch screen - Load: dtoverlay=pitft28-resistive,<param>=<val> -diff --git a/arch/arm/boot/dts/overlays/pitft28-capacitive-overlay.dts b/arch/arm/boot/dts/overlays/pitft28-capacitive-overlay.dts -new file mode 100644 -index 0000000..48920e9 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/pitft28-capacitive-overlay.dts -@@ -0,0 +1,88 @@ -+/* -+ * Device Tree overlay for Adafruit PiTFT 2.8" capacitive touch screen -+ * -+ */ -+ -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; -+ -+ fragment@0 { -+ target = <&spi0>; -+ __overlay__ { -+ status = "okay"; -+ -+ spidev@0{ -+ status = "disabled"; -+ }; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&gpio>; -+ __overlay__ { -+ pitft_pins: pitft_pins { -+ brcm,pins = <24 25>; -+ brcm,function = <0 1>; /* in out */ -+ brcm,pull = <2 0>; /* pullup none */ -+ }; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&spi0>; -+ __overlay__ { -+ /* needed to avoid dtc warning */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ pitft: pitft@0{ -+ compatible = "ilitek,ili9340"; -+ reg = <0>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pitft_pins>; -+ -+ spi-max-frequency = <32000000>; -+ rotate = <90>; -+ fps = <25>; -+ bgr; -+ buswidth = <8>; -+ dc-gpios = <&gpio 25 0>; -+ debug = <0>; -+ }; -+ }; -+ }; -+ -+ fragment@3 { -+ target = <&i2c1>; -+ __overlay__ { -+ /* needed to avoid dtc warning */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ ft6236: ft6236@38 { -+ compatible = "focaltech,ft6236"; -+ reg = <0x38>; -+ -+ interrupt-parent = <&gpio>; -+ interrupts = <24 2>; -+ touchscreen-size-x = <240>; -+ touchscreen-size-y = <320>; -+ }; -+ }; -+ }; -+ -+ __overrides__ { -+ speed = <&pitft>,"spi-max-frequency:0"; -+ rotate = <&pitft>,"rotate:0"; -+ fps = <&pitft>,"fps:0"; -+ debug = <&pitft>,"debug:0"; -+ touch-sizex = <&ft6236>,"touchscreen-size-x?"; -+ touch-sizey = <&ft6236>,"touchscreen-size-y?"; -+ touch-invx = <&ft6236>,"touchscreen-inverted-x?"; -+ touch-invy = <&ft6236>,"touchscreen-inverted-y?"; -+ touch-swapxy = <&ft6236>,"touchscreen-swapped-x-y?"; -+ }; -+}; - -From 660ba9173ca14b48d7cd2f69ff45e67ebe4d947a Mon Sep 17 00:00:00 2001 -From: Stuart MacLean <stuart@hifiberry.com> -Date: Fri, 2 Oct 2015 15:12:59 +0100 -Subject: [PATCH 110/170] Add support for the HiFiBerry DAC+ Pro. - -The HiFiBerry DAC+ and DAC+ Pro products both use the existing bcm sound driver with the DAC+ Pro having a special clock device driver representing the two high precision oscillators. - -An addition bug fix is included for the PCM512x codec where by the physical size of the sample frame is used in the calculation of the LRCK divisor as it was found to be wrong when using 24-bit depth sample contained in a little endian 4-byte sample frame. ---- - .../dts/overlays/hifiberry-dacplus-overlay.dts | 15 +- - drivers/clk/Makefile | 1 + - drivers/clk/clk-hifiberry-dacpro.c | 160 ++++++++++++++ - sound/soc/bcm/hifiberry_dacplus.c | 244 +++++++++++++++++++-- - sound/soc/codecs/pcm512x.c | 3 +- - 5 files changed, 396 insertions(+), 27 deletions(-) - create mode 100644 drivers/clk/clk-hifiberry-dacpro.c - -diff --git a/arch/arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts b/arch/arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts -index deb9c625..f923a48 100644 ---- a/arch/arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts -+++ b/arch/arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts -@@ -6,6 +6,16 @@ - compatible = "brcm,bcm2708"; - - fragment@0 { -+ target-path = "/clocks"; -+ __overlay__ { -+ dacpro_osc: dacpro_osc { -+ compatible = "hifiberry,dacpro-clk"; -+ #clock-cells = <0>; -+ }; -+ }; -+ }; -+ -+ fragment@1 { - target = <&sound>; - __overlay__ { - compatible = "hifiberry,hifiberry-dacplus"; -@@ -14,14 +24,14 @@ - }; - }; - -- fragment@1 { -+ fragment@2 { - target = <&i2s>; - __overlay__ { - status = "okay"; - }; - }; - -- fragment@2 { -+ fragment@3 { - target = <&i2c1>; - __overlay__ { - #address-cells = <1>; -@@ -32,6 +42,7 @@ - #sound-dai-cells = <0>; - compatible = "ti,pcm5122"; - reg = <0x4d>; -+ clocks = <&dacpro_osc>; - status = "okay"; - }; - }; -diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile -index 820714c..94ccf038 100644 ---- a/drivers/clk/Makefile -+++ b/drivers/clk/Makefile -@@ -24,6 +24,7 @@ obj-$(CONFIG_COMMON_CLK_CDCE706) += clk-cdce706.o - obj-$(CONFIG_ARCH_CLPS711X) += clk-clps711x.o - obj-$(CONFIG_ARCH_EFM32) += clk-efm32gg.o - obj-$(CONFIG_ARCH_HIGHBANK) += clk-highbank.o -+obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS) += clk-hifiberry-dacpro.o - obj-$(CONFIG_MACH_LOONGSON32) += clk-ls1x.o - obj-$(CONFIG_COMMON_CLK_MAX_GEN) += clk-max-gen.o - obj-$(CONFIG_COMMON_CLK_MAX77686) += clk-max77686.o -diff --git a/drivers/clk/clk-hifiberry-dacpro.c b/drivers/clk/clk-hifiberry-dacpro.c -new file mode 100644 -index 0000000..3e35d45 ---- /dev/null -+++ b/drivers/clk/clk-hifiberry-dacpro.c -@@ -0,0 +1,160 @@ -+/* -+ * Clock Driver for HiFiBerry DAC Pro -+ * -+ * Author: Stuart MacLean -+ * Copyright 2015 -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License -+ * version 2 as published by the Free Software Foundation. -+ * -+ * This program is distributed in the hope that it will be useful, but -+ * WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * General Public License for more details. -+ */ -+ -+#include <linux/clk-provider.h> -+#include <linux/clkdev.h> -+#include <linux/kernel.h> -+#include <linux/module.h> -+#include <linux/of.h> -+#include <linux/slab.h> -+#include <linux/platform_device.h> -+ -+/* Clock rate of CLK44EN attached to GPIO6 pin */ -+#define CLK_44EN_RATE 22579200UL -+/* Clock rate of CLK48EN attached to GPIO3 pin */ -+#define CLK_48EN_RATE 24576000UL -+ -+/** -+ * struct hifiberry_dacpro_clk - Common struct to the HiFiBerry DAC Pro -+ * @hw: clk_hw for the common clk framework -+ * @mode: 0 => CLK44EN, 1 => CLK48EN -+ */ -+struct clk_hifiberry_hw { -+ struct clk_hw hw; -+ uint8_t mode; -+}; -+ -+#define to_hifiberry_clk(_hw) container_of(_hw, struct clk_hifiberry_hw, hw) -+ -+static const struct of_device_id clk_hifiberry_dacpro_dt_ids[] = { -+ { .compatible = "hifiberry,dacpro-clk",}, -+ { } -+}; -+MODULE_DEVICE_TABLE(of, clk_hifiberry_dacpro_dt_ids); -+ -+static unsigned long clk_hifiberry_dacpro_recalc_rate(struct clk_hw *hw, -+ unsigned long parent_rate) -+{ -+ return (to_hifiberry_clk(hw)->mode == 0) ? CLK_44EN_RATE : -+ CLK_48EN_RATE; -+} -+ -+static long clk_hifiberry_dacpro_round_rate(struct clk_hw *hw, -+ unsigned long rate, unsigned long *parent_rate) -+{ -+ long actual_rate; -+ -+ if (rate <= CLK_44EN_RATE) { -+ actual_rate = (long)CLK_44EN_RATE; -+ } else if (rate >= CLK_48EN_RATE) { -+ actual_rate = (long)CLK_48EN_RATE; -+ } else { -+ long diff44Rate = (long)(rate - CLK_44EN_RATE); -+ long diff48Rate = (long)(CLK_48EN_RATE - rate); -+ -+ if (diff44Rate < diff48Rate) -+ actual_rate = (long)CLK_44EN_RATE; -+ else -+ actual_rate = (long)CLK_48EN_RATE; -+ } -+ return actual_rate; -+} -+ -+ -+static int clk_hifiberry_dacpro_set_rate(struct clk_hw *hw, -+ unsigned long rate, unsigned long parent_rate) -+{ -+ unsigned long actual_rate; -+ struct clk_hifiberry_hw *clk = to_hifiberry_clk(hw); -+ -+ actual_rate = (unsigned long)clk_hifiberry_dacpro_round_rate(hw, rate, -+ &parent_rate); -+ clk->mode = (actual_rate == CLK_44EN_RATE) ? 0 : 1; -+ return 0; -+} -+ -+ -+const struct clk_ops clk_hifiberry_dacpro_rate_ops = { -+ .recalc_rate = clk_hifiberry_dacpro_recalc_rate, -+ .round_rate = clk_hifiberry_dacpro_round_rate, -+ .set_rate = clk_hifiberry_dacpro_set_rate, -+}; -+ -+static int clk_hifiberry_dacpro_probe(struct platform_device *pdev) -+{ -+ int ret; -+ struct clk_hifiberry_hw *proclk; -+ struct clk *clk; -+ struct device *dev; -+ struct clk_init_data init; -+ -+ dev = &pdev->dev; -+ -+ proclk = kzalloc(sizeof(struct clk_hifiberry_hw), GFP_KERNEL); -+ if (!proclk) -+ return -ENOMEM; -+ -+ init.name = "clk-hifiberry-dacpro"; -+ init.ops = &clk_hifiberry_dacpro_rate_ops; -+ init.flags = CLK_IS_ROOT | CLK_IS_BASIC; -+ init.parent_names = NULL; -+ init.num_parents = 0; -+ -+ proclk->mode = 0; -+ proclk->hw.init = &init; -+ -+ clk = devm_clk_register(dev, &proclk->hw); -+ if (!IS_ERR(clk)) { -+ ret = of_clk_add_provider(dev->of_node, of_clk_src_simple_get, -+ clk); -+ } else { -+ dev_err(dev, "Fail to register clock driver\n"); -+ kfree(proclk); -+ ret = PTR_ERR(clk); -+ } -+ return ret; -+} -+ -+static int clk_hifiberry_dacpro_remove(struct platform_device *pdev) -+{ -+ of_clk_del_provider(pdev->dev.of_node); -+ return 0; -+} -+ -+static struct platform_driver clk_hifiberry_dacpro_driver = { -+ .probe = clk_hifiberry_dacpro_probe, -+ .remove = clk_hifiberry_dacpro_remove, -+ .driver = { -+ .name = "clk-hifiberry-dacpro", -+ .of_match_table = clk_hifiberry_dacpro_dt_ids, -+ }, -+}; -+ -+static int __init clk_hifiberry_dacpro_init(void) -+{ -+ return platform_driver_register(&clk_hifiberry_dacpro_driver); -+} -+core_initcall(clk_hifiberry_dacpro_init); -+ -+static void __exit clk_hifiberry_dacpro_exit(void) -+{ -+ platform_driver_unregister(&clk_hifiberry_dacpro_driver); -+} -+module_exit(clk_hifiberry_dacpro_exit); -+ -+MODULE_DESCRIPTION("HiFiBerry DAC Pro clock driver"); -+MODULE_LICENSE("GPL v2"); -+MODULE_ALIAS("platform:clk-hifiberry-dacpro"); -diff --git a/sound/soc/bcm/hifiberry_dacplus.c b/sound/soc/bcm/hifiberry_dacplus.c -index 11e4f39..a6b651c 100644 ---- a/sound/soc/bcm/hifiberry_dacplus.c -+++ b/sound/soc/bcm/hifiberry_dacplus.c -@@ -1,8 +1,8 @@ - /* -- * ASoC Driver for HiFiBerry DAC+ -+ * ASoC Driver for HiFiBerry DAC+ / DAC Pro - * -- * Author: Daniel Matuschek -- * Copyright 2014 -+ * Author: Daniel Matuschek, Stuart MacLean <stuart@hifiberry.com> -+ * Copyright 2014-2015 - * based on code by Florian Meier <florian.meier@koalo.de> - * - * This program is free software; you can redistribute it and/or -@@ -17,6 +17,13 @@ - - #include <linux/module.h> - #include <linux/platform_device.h> -+#include <linux/kernel.h> -+#include <linux/clk.h> -+#include <linux/kernel.h> -+#include <linux/module.h> -+#include <linux/of.h> -+#include <linux/slab.h> -+#include <linux/delay.h> - - #include <sound/core.h> - #include <sound/pcm.h> -@@ -26,34 +33,222 @@ - - #include "../codecs/pcm512x.h" +@@ -0,0 +1,1289 @@ ++# CONFIG_ARM_PATCH_PHYS_VIRT is not set ++CONFIG_PHYS_OFFSET=0 ++# CONFIG_LOCALVERSION_AUTO is not set ++CONFIG_SYSVIPC=y ++CONFIG_POSIX_MQUEUE=y ++CONFIG_NO_HZ=y ++CONFIG_HIGH_RES_TIMERS=y ++CONFIG_BSD_PROCESS_ACCT=y ++CONFIG_BSD_PROCESS_ACCT_V3=y ++CONFIG_TASKSTATS=y ++CONFIG_TASK_DELAY_ACCT=y ++CONFIG_TASK_XACCT=y ++CONFIG_TASK_IO_ACCOUNTING=y ++CONFIG_IKCONFIG=m ++CONFIG_IKCONFIG_PROC=y ++CONFIG_MEMCG=y ++CONFIG_BLK_CGROUP=y ++CONFIG_CGROUP_FREEZER=y ++CONFIG_CPUSETS=y ++CONFIG_CGROUP_DEVICE=y ++CONFIG_CGROUP_CPUACCT=y ++CONFIG_NAMESPACES=y ++CONFIG_SCHED_AUTOGROUP=y ++CONFIG_BLK_DEV_INITRD=y ++CONFIG_EMBEDDED=y ++# CONFIG_COMPAT_BRK is not set ++CONFIG_PROFILING=y ++CONFIG_OPROFILE=m ++CONFIG_KPROBES=y ++CONFIG_JUMP_LABEL=y ++CONFIG_MODULES=y ++CONFIG_MODULE_UNLOAD=y ++CONFIG_MODVERSIONS=y ++CONFIG_MODULE_SRCVERSION_ALL=y ++CONFIG_BLK_DEV_THROTTLING=y ++CONFIG_PARTITION_ADVANCED=y ++CONFIG_MAC_PARTITION=y ++CONFIG_CFQ_GROUP_IOSCHED=y ++CONFIG_ARCH_BCM2708=y ++CONFIG_PREEMPT_VOLUNTARY=y ++CONFIG_AEABI=y ++CONFIG_OABI_COMPAT=y ++# CONFIG_CPU_SW_DOMAIN_PAN is not set ++CONFIG_CLEANCACHE=y ++CONFIG_FRONTSWAP=y ++CONFIG_CMA=y ++CONFIG_ZSMALLOC=m ++CONFIG_PGTABLE_MAPPING=y ++CONFIG_UACCESS_WITH_MEMCPY=y ++CONFIG_SECCOMP=y ++# CONFIG_ATAGS is not set ++CONFIG_ZBOOT_ROM_TEXT=0x0 ++CONFIG_ZBOOT_ROM_BSS=0x0 ++CONFIG_CMDLINE="console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait" ++CONFIG_CPU_FREQ=y ++CONFIG_CPU_FREQ_STAT=m ++CONFIG_CPU_FREQ_STAT_DETAILS=y ++CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE=y ++CONFIG_CPU_FREQ_GOV_PERFORMANCE=y ++CONFIG_CPU_FREQ_GOV_USERSPACE=y ++CONFIG_CPU_FREQ_GOV_ONDEMAND=y ++CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y ++CONFIG_VFP=y ++CONFIG_BINFMT_MISC=m ++# CONFIG_SUSPEND is not set ++CONFIG_PM=y ++CONFIG_NET=y ++CONFIG_PACKET=y ++CONFIG_UNIX=y ++CONFIG_XFRM_USER=y ++CONFIG_NET_KEY=m ++CONFIG_INET=y ++CONFIG_IP_MULTICAST=y ++CONFIG_IP_ADVANCED_ROUTER=y ++CONFIG_IP_MULTIPLE_TABLES=y ++CONFIG_IP_ROUTE_MULTIPATH=y ++CONFIG_IP_ROUTE_VERBOSE=y ++CONFIG_IP_PNP=y ++CONFIG_IP_PNP_DHCP=y ++CONFIG_IP_PNP_RARP=y ++CONFIG_NET_IPIP=m ++CONFIG_NET_IPGRE_DEMUX=m ++CONFIG_NET_IPGRE=m ++CONFIG_IP_MROUTE=y ++CONFIG_IP_MROUTE_MULTIPLE_TABLES=y ++CONFIG_IP_PIMSM_V1=y ++CONFIG_IP_PIMSM_V2=y ++CONFIG_SYN_COOKIES=y ++CONFIG_INET_AH=m ++CONFIG_INET_ESP=m ++CONFIG_INET_IPCOMP=m ++CONFIG_INET_XFRM_MODE_TRANSPORT=m ++CONFIG_INET_XFRM_MODE_TUNNEL=m ++CONFIG_INET_XFRM_MODE_BEET=m ++CONFIG_INET_DIAG=m ++CONFIG_IPV6=m ++CONFIG_IPV6_ROUTER_PREF=y ++CONFIG_INET6_AH=m ++CONFIG_INET6_ESP=m ++CONFIG_INET6_IPCOMP=m ++CONFIG_IPV6_TUNNEL=m ++CONFIG_IPV6_MULTIPLE_TABLES=y ++CONFIG_IPV6_SUBTREES=y ++CONFIG_IPV6_MROUTE=y ++CONFIG_IPV6_MROUTE_MULTIPLE_TABLES=y ++CONFIG_IPV6_PIMSM_V2=y ++CONFIG_NETFILTER=y ++CONFIG_NF_CONNTRACK=m ++CONFIG_NF_CONNTRACK_ZONES=y ++CONFIG_NF_CONNTRACK_EVENTS=y ++CONFIG_NF_CONNTRACK_TIMESTAMP=y ++CONFIG_NF_CT_PROTO_DCCP=m ++CONFIG_NF_CT_PROTO_UDPLITE=m ++CONFIG_NF_CONNTRACK_AMANDA=m ++CONFIG_NF_CONNTRACK_FTP=m ++CONFIG_NF_CONNTRACK_H323=m ++CONFIG_NF_CONNTRACK_IRC=m ++CONFIG_NF_CONNTRACK_NETBIOS_NS=m ++CONFIG_NF_CONNTRACK_SNMP=m ++CONFIG_NF_CONNTRACK_PPTP=m ++CONFIG_NF_CONNTRACK_SANE=m ++CONFIG_NF_CONNTRACK_SIP=m ++CONFIG_NF_CONNTRACK_TFTP=m ++CONFIG_NF_CT_NETLINK=m ++CONFIG_NETFILTER_XT_SET=m ++CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m ++CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m ++CONFIG_NETFILTER_XT_TARGET_CONNMARK=m ++CONFIG_NETFILTER_XT_TARGET_DSCP=m ++CONFIG_NETFILTER_XT_TARGET_HMARK=m ++CONFIG_NETFILTER_XT_TARGET_IDLETIMER=m ++CONFIG_NETFILTER_XT_TARGET_LED=m ++CONFIG_NETFILTER_XT_TARGET_LOG=m ++CONFIG_NETFILTER_XT_TARGET_MARK=m ++CONFIG_NETFILTER_XT_TARGET_NFLOG=m ++CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m ++CONFIG_NETFILTER_XT_TARGET_NOTRACK=m ++CONFIG_NETFILTER_XT_TARGET_TEE=m ++CONFIG_NETFILTER_XT_TARGET_TPROXY=m ++CONFIG_NETFILTER_XT_TARGET_TRACE=m ++CONFIG_NETFILTER_XT_TARGET_TCPMSS=m ++CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP=m ++CONFIG_NETFILTER_XT_MATCH_ADDRTYPE=m ++CONFIG_NETFILTER_XT_MATCH_BPF=m ++CONFIG_NETFILTER_XT_MATCH_CLUSTER=m ++CONFIG_NETFILTER_XT_MATCH_COMMENT=m ++CONFIG_NETFILTER_XT_MATCH_CONNBYTES=m ++CONFIG_NETFILTER_XT_MATCH_CONNLABEL=m ++CONFIG_NETFILTER_XT_MATCH_CONNLIMIT=m ++CONFIG_NETFILTER_XT_MATCH_CONNMARK=m ++CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m ++CONFIG_NETFILTER_XT_MATCH_CPU=m ++CONFIG_NETFILTER_XT_MATCH_DCCP=m ++CONFIG_NETFILTER_XT_MATCH_DEVGROUP=m ++CONFIG_NETFILTER_XT_MATCH_DSCP=m ++CONFIG_NETFILTER_XT_MATCH_ESP=m ++CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=m ++CONFIG_NETFILTER_XT_MATCH_HELPER=m ++CONFIG_NETFILTER_XT_MATCH_IPRANGE=m ++CONFIG_NETFILTER_XT_MATCH_IPVS=m ++CONFIG_NETFILTER_XT_MATCH_LENGTH=m ++CONFIG_NETFILTER_XT_MATCH_LIMIT=m ++CONFIG_NETFILTER_XT_MATCH_MAC=m ++CONFIG_NETFILTER_XT_MATCH_MARK=m ++CONFIG_NETFILTER_XT_MATCH_MULTIPORT=m ++CONFIG_NETFILTER_XT_MATCH_NFACCT=m ++CONFIG_NETFILTER_XT_MATCH_OSF=m ++CONFIG_NETFILTER_XT_MATCH_OWNER=m ++CONFIG_NETFILTER_XT_MATCH_POLICY=m ++CONFIG_NETFILTER_XT_MATCH_PHYSDEV=m ++CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m ++CONFIG_NETFILTER_XT_MATCH_QUOTA=m ++CONFIG_NETFILTER_XT_MATCH_RATEEST=m ++CONFIG_NETFILTER_XT_MATCH_REALM=m ++CONFIG_NETFILTER_XT_MATCH_RECENT=m ++CONFIG_NETFILTER_XT_MATCH_SOCKET=m ++CONFIG_NETFILTER_XT_MATCH_STATE=m ++CONFIG_NETFILTER_XT_MATCH_STATISTIC=m ++CONFIG_NETFILTER_XT_MATCH_STRING=m ++CONFIG_NETFILTER_XT_MATCH_TCPMSS=m ++CONFIG_NETFILTER_XT_MATCH_TIME=m ++CONFIG_NETFILTER_XT_MATCH_U32=m ++CONFIG_IP_SET=m ++CONFIG_IP_SET_BITMAP_IP=m ++CONFIG_IP_SET_BITMAP_IPMAC=m ++CONFIG_IP_SET_BITMAP_PORT=m ++CONFIG_IP_SET_HASH_IP=m ++CONFIG_IP_SET_HASH_IPPORT=m ++CONFIG_IP_SET_HASH_IPPORTIP=m ++CONFIG_IP_SET_HASH_IPPORTNET=m ++CONFIG_IP_SET_HASH_NET=m ++CONFIG_IP_SET_HASH_NETPORT=m ++CONFIG_IP_SET_HASH_NETIFACE=m ++CONFIG_IP_SET_LIST_SET=m ++CONFIG_IP_VS=m ++CONFIG_IP_VS_PROTO_TCP=y ++CONFIG_IP_VS_PROTO_UDP=y ++CONFIG_IP_VS_PROTO_ESP=y ++CONFIG_IP_VS_PROTO_AH=y ++CONFIG_IP_VS_PROTO_SCTP=y ++CONFIG_IP_VS_RR=m ++CONFIG_IP_VS_WRR=m ++CONFIG_IP_VS_LC=m ++CONFIG_IP_VS_WLC=m ++CONFIG_IP_VS_LBLC=m ++CONFIG_IP_VS_LBLCR=m ++CONFIG_IP_VS_DH=m ++CONFIG_IP_VS_SH=m ++CONFIG_IP_VS_SED=m ++CONFIG_IP_VS_NQ=m ++CONFIG_IP_VS_FTP=m ++CONFIG_IP_VS_PE_SIP=m ++CONFIG_NF_CONNTRACK_IPV4=m ++CONFIG_IP_NF_IPTABLES=m ++CONFIG_IP_NF_MATCH_AH=m ++CONFIG_IP_NF_MATCH_ECN=m ++CONFIG_IP_NF_MATCH_RPFILTER=m ++CONFIG_IP_NF_MATCH_TTL=m ++CONFIG_IP_NF_FILTER=m ++CONFIG_IP_NF_TARGET_REJECT=m ++CONFIG_IP_NF_NAT=m ++CONFIG_IP_NF_TARGET_MASQUERADE=m ++CONFIG_IP_NF_TARGET_NETMAP=m ++CONFIG_IP_NF_TARGET_REDIRECT=m ++CONFIG_IP_NF_MANGLE=m ++CONFIG_IP_NF_TARGET_CLUSTERIP=m ++CONFIG_IP_NF_TARGET_ECN=m ++CONFIG_IP_NF_TARGET_TTL=m ++CONFIG_IP_NF_RAW=m ++CONFIG_IP_NF_ARPTABLES=m ++CONFIG_IP_NF_ARPFILTER=m ++CONFIG_IP_NF_ARP_MANGLE=m ++CONFIG_NF_CONNTRACK_IPV6=m ++CONFIG_IP6_NF_IPTABLES=m ++CONFIG_IP6_NF_MATCH_AH=m ++CONFIG_IP6_NF_MATCH_EUI64=m ++CONFIG_IP6_NF_MATCH_FRAG=m ++CONFIG_IP6_NF_MATCH_OPTS=m ++CONFIG_IP6_NF_MATCH_HL=m ++CONFIG_IP6_NF_MATCH_IPV6HEADER=m ++CONFIG_IP6_NF_MATCH_MH=m ++CONFIG_IP6_NF_MATCH_RPFILTER=m ++CONFIG_IP6_NF_MATCH_RT=m ++CONFIG_IP6_NF_TARGET_HL=m ++CONFIG_IP6_NF_FILTER=m ++CONFIG_IP6_NF_TARGET_REJECT=m ++CONFIG_IP6_NF_MANGLE=m ++CONFIG_IP6_NF_RAW=m ++CONFIG_IP6_NF_NAT=m ++CONFIG_IP6_NF_TARGET_MASQUERADE=m ++CONFIG_IP6_NF_TARGET_NPT=m ++CONFIG_BRIDGE_NF_EBTABLES=m ++CONFIG_BRIDGE_EBT_BROUTE=m ++CONFIG_BRIDGE_EBT_T_FILTER=m ++CONFIG_BRIDGE_EBT_T_NAT=m ++CONFIG_BRIDGE_EBT_802_3=m ++CONFIG_BRIDGE_EBT_AMONG=m ++CONFIG_BRIDGE_EBT_ARP=m ++CONFIG_BRIDGE_EBT_IP=m ++CONFIG_BRIDGE_EBT_IP6=m ++CONFIG_BRIDGE_EBT_LIMIT=m ++CONFIG_BRIDGE_EBT_MARK=m ++CONFIG_BRIDGE_EBT_PKTTYPE=m ++CONFIG_BRIDGE_EBT_STP=m ++CONFIG_BRIDGE_EBT_VLAN=m ++CONFIG_BRIDGE_EBT_ARPREPLY=m ++CONFIG_BRIDGE_EBT_DNAT=m ++CONFIG_BRIDGE_EBT_MARK_T=m ++CONFIG_BRIDGE_EBT_REDIRECT=m ++CONFIG_BRIDGE_EBT_SNAT=m ++CONFIG_BRIDGE_EBT_LOG=m ++CONFIG_BRIDGE_EBT_NFLOG=m ++CONFIG_SCTP_COOKIE_HMAC_SHA1=y ++CONFIG_ATM=m ++CONFIG_L2TP=m ++CONFIG_L2TP_V3=y ++CONFIG_L2TP_IP=m ++CONFIG_L2TP_ETH=m ++CONFIG_BRIDGE=m ++CONFIG_VLAN_8021Q=m ++CONFIG_VLAN_8021Q_GVRP=y ++CONFIG_ATALK=m ++CONFIG_6LOWPAN=m ++CONFIG_IEEE802154=m ++CONFIG_IEEE802154_6LOWPAN=m ++CONFIG_MAC802154=m ++CONFIG_NET_SCHED=y ++CONFIG_NET_SCH_CBQ=m ++CONFIG_NET_SCH_HTB=m ++CONFIG_NET_SCH_HFSC=m ++CONFIG_NET_SCH_PRIO=m ++CONFIG_NET_SCH_MULTIQ=m ++CONFIG_NET_SCH_RED=m ++CONFIG_NET_SCH_SFB=m ++CONFIG_NET_SCH_SFQ=m ++CONFIG_NET_SCH_TEQL=m ++CONFIG_NET_SCH_TBF=m ++CONFIG_NET_SCH_GRED=m ++CONFIG_NET_SCH_DSMARK=m ++CONFIG_NET_SCH_NETEM=m ++CONFIG_NET_SCH_DRR=m ++CONFIG_NET_SCH_MQPRIO=m ++CONFIG_NET_SCH_CHOKE=m ++CONFIG_NET_SCH_QFQ=m ++CONFIG_NET_SCH_CODEL=m ++CONFIG_NET_SCH_FQ_CODEL=m ++CONFIG_NET_SCH_INGRESS=m ++CONFIG_NET_SCH_PLUG=m ++CONFIG_NET_CLS_BASIC=m ++CONFIG_NET_CLS_TCINDEX=m ++CONFIG_NET_CLS_ROUTE4=m ++CONFIG_NET_CLS_FW=m ++CONFIG_NET_CLS_U32=m ++CONFIG_CLS_U32_MARK=y ++CONFIG_NET_CLS_RSVP=m ++CONFIG_NET_CLS_RSVP6=m ++CONFIG_NET_CLS_FLOW=m ++CONFIG_NET_CLS_CGROUP=m ++CONFIG_NET_EMATCH=y ++CONFIG_NET_EMATCH_CMP=m ++CONFIG_NET_EMATCH_NBYTE=m ++CONFIG_NET_EMATCH_U32=m ++CONFIG_NET_EMATCH_META=m ++CONFIG_NET_EMATCH_TEXT=m ++CONFIG_NET_EMATCH_IPSET=m ++CONFIG_NET_CLS_ACT=y ++CONFIG_NET_ACT_POLICE=m ++CONFIG_NET_ACT_GACT=m ++CONFIG_GACT_PROB=y ++CONFIG_NET_ACT_MIRRED=m ++CONFIG_NET_ACT_IPT=m ++CONFIG_NET_ACT_NAT=m ++CONFIG_NET_ACT_PEDIT=m ++CONFIG_NET_ACT_SIMP=m ++CONFIG_NET_ACT_SKBEDIT=m ++CONFIG_NET_ACT_CSUM=m ++CONFIG_BATMAN_ADV=m ++CONFIG_OPENVSWITCH=m ++CONFIG_NET_PKTGEN=m ++CONFIG_HAMRADIO=y ++CONFIG_AX25=m ++CONFIG_NETROM=m ++CONFIG_ROSE=m ++CONFIG_MKISS=m ++CONFIG_6PACK=m ++CONFIG_BPQETHER=m ++CONFIG_BAYCOM_SER_FDX=m ++CONFIG_BAYCOM_SER_HDX=m ++CONFIG_YAM=m ++CONFIG_CAN=m ++CONFIG_CAN_VCAN=m ++CONFIG_CAN_MCP251X=m ++CONFIG_IRDA=m ++CONFIG_IRLAN=m ++CONFIG_IRNET=m ++CONFIG_IRCOMM=m ++CONFIG_IRDA_ULTRA=y ++CONFIG_IRDA_CACHE_LAST_LSAP=y ++CONFIG_IRDA_FAST_RR=y ++CONFIG_IRTTY_SIR=m ++CONFIG_KINGSUN_DONGLE=m ++CONFIG_KSDAZZLE_DONGLE=m ++CONFIG_KS959_DONGLE=m ++CONFIG_USB_IRDA=m ++CONFIG_SIGMATEL_FIR=m ++CONFIG_MCS_FIR=m ++CONFIG_BT=m ++CONFIG_BT_RFCOMM=m ++CONFIG_BT_RFCOMM_TTY=y ++CONFIG_BT_BNEP=m ++CONFIG_BT_BNEP_MC_FILTER=y ++CONFIG_BT_BNEP_PROTO_FILTER=y ++CONFIG_BT_HIDP=m ++CONFIG_BT_6LOWPAN=m ++CONFIG_BT_HCIBTUSB=m ++CONFIG_BT_HCIUART=m ++CONFIG_BT_HCIUART_3WIRE=y ++CONFIG_BT_HCIUART_BCM=y ++CONFIG_BT_HCIBCM203X=m ++CONFIG_BT_HCIBPA10X=m ++CONFIG_BT_HCIBFUSB=m ++CONFIG_BT_HCIVHCI=m ++CONFIG_BT_MRVL=m ++CONFIG_BT_MRVL_SDIO=m ++CONFIG_BT_ATH3K=m ++CONFIG_BT_WILINK=m ++CONFIG_MAC80211=m ++CONFIG_MAC80211_MESH=y ++CONFIG_WIMAX=m ++CONFIG_RFKILL=m ++CONFIG_RFKILL_INPUT=y ++CONFIG_NET_9P=m ++CONFIG_NFC=m ++CONFIG_NFC_PN533=m ++CONFIG_DEVTMPFS=y ++CONFIG_DEVTMPFS_MOUNT=y ++CONFIG_DMA_CMA=y ++CONFIG_CMA_SIZE_MBYTES=5 ++CONFIG_MTD=m ++CONFIG_MTD_BLOCK=m ++CONFIG_MTD_NAND=m ++CONFIG_MTD_UBI=m ++CONFIG_OF_CONFIGFS=y ++CONFIG_ZRAM=m ++CONFIG_ZRAM_LZ4_COMPRESS=y ++CONFIG_BLK_DEV_LOOP=y ++CONFIG_BLK_DEV_CRYPTOLOOP=m ++CONFIG_BLK_DEV_DRBD=m ++CONFIG_BLK_DEV_NBD=m ++CONFIG_BLK_DEV_RAM=y ++CONFIG_CDROM_PKTCDVD=m ++CONFIG_ATA_OVER_ETH=m ++CONFIG_EEPROM_AT24=m ++CONFIG_TI_ST=m ++CONFIG_SCSI=y ++# CONFIG_SCSI_PROC_FS is not set ++CONFIG_BLK_DEV_SD=y ++CONFIG_CHR_DEV_ST=m ++CONFIG_CHR_DEV_OSST=m ++CONFIG_BLK_DEV_SR=m ++CONFIG_CHR_DEV_SG=m ++CONFIG_SCSI_ISCSI_ATTRS=y ++CONFIG_ISCSI_TCP=m ++CONFIG_ISCSI_BOOT_SYSFS=m ++CONFIG_MD=y ++CONFIG_MD_LINEAR=m ++CONFIG_MD_RAID0=m ++CONFIG_BLK_DEV_DM=m ++CONFIG_DM_CRYPT=m ++CONFIG_DM_SNAPSHOT=m ++CONFIG_DM_THIN_PROVISIONING=m ++CONFIG_DM_MIRROR=m ++CONFIG_DM_LOG_USERSPACE=m ++CONFIG_DM_RAID=m ++CONFIG_DM_ZERO=m ++CONFIG_DM_DELAY=m ++CONFIG_NETDEVICES=y ++CONFIG_BONDING=m ++CONFIG_DUMMY=m ++CONFIG_IFB=m ++CONFIG_MACVLAN=m ++CONFIG_NETCONSOLE=m ++CONFIG_TUN=m ++CONFIG_VETH=m ++CONFIG_ENC28J60=m ++CONFIG_QCA7000=m ++CONFIG_MDIO_BITBANG=m ++CONFIG_PPP=m ++CONFIG_PPP_BSDCOMP=m ++CONFIG_PPP_DEFLATE=m ++CONFIG_PPP_FILTER=y ++CONFIG_PPP_MPPE=m ++CONFIG_PPP_MULTILINK=y ++CONFIG_PPPOATM=m ++CONFIG_PPPOE=m ++CONFIG_PPPOL2TP=m ++CONFIG_PPP_ASYNC=m ++CONFIG_PPP_SYNC_TTY=m ++CONFIG_SLIP=m ++CONFIG_SLIP_COMPRESSED=y ++CONFIG_SLIP_SMART=y ++CONFIG_USB_CATC=m ++CONFIG_USB_KAWETH=m ++CONFIG_USB_PEGASUS=m ++CONFIG_USB_RTL8150=m ++CONFIG_USB_RTL8152=m ++CONFIG_USB_USBNET=y ++CONFIG_USB_NET_AX8817X=m ++CONFIG_USB_NET_AX88179_178A=m ++CONFIG_USB_NET_CDCETHER=m ++CONFIG_USB_NET_CDC_EEM=m ++CONFIG_USB_NET_CDC_NCM=m ++CONFIG_USB_NET_HUAWEI_CDC_NCM=m ++CONFIG_USB_NET_CDC_MBIM=m ++CONFIG_USB_NET_DM9601=m ++CONFIG_USB_NET_SR9700=m ++CONFIG_USB_NET_SR9800=m ++CONFIG_USB_NET_SMSC75XX=m ++CONFIG_USB_NET_SMSC95XX=y ++CONFIG_USB_NET_GL620A=m ++CONFIG_USB_NET_NET1080=m ++CONFIG_USB_NET_PLUSB=m ++CONFIG_USB_NET_MCS7830=m ++CONFIG_USB_NET_CDC_SUBSET=m ++CONFIG_USB_ALI_M5632=y ++CONFIG_USB_AN2720=y ++CONFIG_USB_EPSON2888=y ++CONFIG_USB_KC2190=y ++CONFIG_USB_NET_ZAURUS=m ++CONFIG_USB_NET_CX82310_ETH=m ++CONFIG_USB_NET_KALMIA=m ++CONFIG_USB_NET_QMI_WWAN=m ++CONFIG_USB_HSO=m ++CONFIG_USB_NET_INT51X1=m ++CONFIG_USB_IPHETH=m ++CONFIG_USB_SIERRA_NET=m ++CONFIG_USB_VL600=m ++CONFIG_ATH9K=m ++CONFIG_ATH9K_HTC=m ++CONFIG_CARL9170=m ++CONFIG_ATH6KL=m ++CONFIG_ATH6KL_USB=m ++CONFIG_AR5523=m ++CONFIG_AT76C50X_USB=m ++CONFIG_B43=m ++# CONFIG_B43_PHY_N is not set ++CONFIG_B43LEGACY=m ++CONFIG_BRCMFMAC=m ++CONFIG_BRCMFMAC_USB=y ++CONFIG_HOSTAP=m ++CONFIG_P54_COMMON=m ++CONFIG_P54_USB=m ++CONFIG_LIBERTAS=m ++CONFIG_LIBERTAS_USB=m ++CONFIG_LIBERTAS_SDIO=m ++CONFIG_LIBERTAS_THINFIRM=m ++CONFIG_LIBERTAS_THINFIRM_USB=m ++CONFIG_MWIFIEX=m ++CONFIG_MWIFIEX_SDIO=m ++CONFIG_MT7601U=m ++CONFIG_RT2X00=m ++CONFIG_RT2500USB=m ++CONFIG_RT73USB=m ++CONFIG_RT2800USB=m ++CONFIG_RT2800USB_RT3573=y ++CONFIG_RT2800USB_RT53XX=y ++CONFIG_RT2800USB_RT55XX=y ++CONFIG_RT2800USB_UNKNOWN=y ++CONFIG_RTL8187=m ++CONFIG_RTL8192CU=m ++CONFIG_USB_ZD1201=m ++CONFIG_ZD1211RW=m ++CONFIG_MAC80211_HWSIM=m ++CONFIG_USB_NET_RNDIS_WLAN=m ++CONFIG_WIMAX_I2400M_USB=m ++CONFIG_IEEE802154_AT86RF230=m ++CONFIG_IEEE802154_MRF24J40=m ++CONFIG_IEEE802154_CC2520=m ++CONFIG_INPUT_POLLDEV=m ++# CONFIG_INPUT_MOUSEDEV_PSAUX is not set ++CONFIG_INPUT_JOYDEV=m ++CONFIG_INPUT_EVDEV=m ++# CONFIG_KEYBOARD_ATKBD is not set ++CONFIG_KEYBOARD_GPIO=m ++# CONFIG_INPUT_MOUSE is not set ++CONFIG_INPUT_JOYSTICK=y ++CONFIG_JOYSTICK_IFORCE=m ++CONFIG_JOYSTICK_IFORCE_USB=y ++CONFIG_JOYSTICK_XPAD=m ++CONFIG_JOYSTICK_XPAD_FF=y ++CONFIG_JOYSTICK_RPISENSE=m ++CONFIG_INPUT_TOUCHSCREEN=y ++CONFIG_TOUCHSCREEN_ADS7846=m ++CONFIG_TOUCHSCREEN_EGALAX=m ++CONFIG_TOUCHSCREEN_FT6236=m ++CONFIG_TOUCHSCREEN_RPI_FT5406=m ++CONFIG_TOUCHSCREEN_USB_COMPOSITE=m ++CONFIG_TOUCHSCREEN_STMPE=m ++CONFIG_INPUT_MISC=y ++CONFIG_INPUT_AD714X=m ++CONFIG_INPUT_ATI_REMOTE2=m ++CONFIG_INPUT_KEYSPAN_REMOTE=m ++CONFIG_INPUT_POWERMATE=m ++CONFIG_INPUT_YEALINK=m ++CONFIG_INPUT_CM109=m ++CONFIG_INPUT_UINPUT=m ++CONFIG_INPUT_GPIO_ROTARY_ENCODER=m ++CONFIG_INPUT_ADXL34X=m ++CONFIG_INPUT_CMA3000=m ++CONFIG_SERIO=m ++CONFIG_SERIO_RAW=m ++CONFIG_GAMEPORT=m ++CONFIG_GAMEPORT_NS558=m ++CONFIG_GAMEPORT_L4=m ++CONFIG_BRCM_CHAR_DRIVERS=y ++CONFIG_BCM_VC_CMA=y ++CONFIG_BCM_VCIO=y ++CONFIG_BCM_VC_SM=y ++CONFIG_DEVPTS_MULTIPLE_INSTANCES=y ++# CONFIG_LEGACY_PTYS is not set ++# CONFIG_DEVKMEM is not set ++CONFIG_SERIAL_8250=y ++# CONFIG_SERIAL_8250_DEPRECATED_OPTIONS is not set ++CONFIG_SERIAL_8250_CONSOLE=y ++# CONFIG_SERIAL_8250_DMA is not set ++CONFIG_SERIAL_8250_NR_UARTS=1 ++CONFIG_SERIAL_8250_RUNTIME_UARTS=0 ++CONFIG_SERIAL_OF_PLATFORM=y ++CONFIG_SERIAL_AMBA_PL011=y ++CONFIG_SERIAL_AMBA_PL011_CONSOLE=y ++CONFIG_TTY_PRINTK=y ++CONFIG_HW_RANDOM=y ++CONFIG_RAW_DRIVER=y ++CONFIG_I2C=y ++CONFIG_I2C_CHARDEV=m ++CONFIG_I2C_MUX_PCA954x=m ++CONFIG_I2C_BCM2708=m ++CONFIG_I2C_GPIO=m ++CONFIG_SPI=y ++CONFIG_SPI_BCM2835=m ++CONFIG_SPI_BCM2835AUX=m ++CONFIG_SPI_SPIDEV=y ++CONFIG_PPS=m ++CONFIG_PPS_CLIENT_LDISC=m ++CONFIG_PPS_CLIENT_GPIO=m ++CONFIG_GPIO_SYSFS=y ++CONFIG_GPIO_ARIZONA=m ++CONFIG_GPIO_STMPE=y ++CONFIG_W1=m ++CONFIG_W1_MASTER_DS2490=m ++CONFIG_W1_MASTER_DS2482=m ++CONFIG_W1_MASTER_DS1WM=m ++CONFIG_W1_MASTER_GPIO=m ++CONFIG_W1_SLAVE_THERM=m ++CONFIG_W1_SLAVE_SMEM=m ++CONFIG_W1_SLAVE_DS2408=m ++CONFIG_W1_SLAVE_DS2413=m ++CONFIG_W1_SLAVE_DS2406=m ++CONFIG_W1_SLAVE_DS2423=m ++CONFIG_W1_SLAVE_DS2431=m ++CONFIG_W1_SLAVE_DS2433=m ++CONFIG_W1_SLAVE_DS2760=m ++CONFIG_W1_SLAVE_DS2780=m ++CONFIG_W1_SLAVE_DS2781=m ++CONFIG_W1_SLAVE_DS28E04=m ++CONFIG_W1_SLAVE_BQ27000=m ++CONFIG_BATTERY_DS2760=m ++CONFIG_POWER_RESET=y ++CONFIG_POWER_RESET_GPIO=y ++CONFIG_HWMON=m ++CONFIG_SENSORS_SHT21=m ++CONFIG_SENSORS_SHTC1=m ++CONFIG_THERMAL=y ++CONFIG_THERMAL_BCM2835=y ++CONFIG_WATCHDOG=y ++CONFIG_BCM2835_WDT=m ++CONFIG_UCB1400_CORE=m ++CONFIG_MFD_STMPE=y ++CONFIG_STMPE_SPI=y ++CONFIG_MFD_ARIZONA_I2C=m ++CONFIG_MFD_ARIZONA_SPI=m ++CONFIG_MFD_WM5102=y ++CONFIG_MEDIA_SUPPORT=m ++CONFIG_MEDIA_CAMERA_SUPPORT=y ++CONFIG_MEDIA_ANALOG_TV_SUPPORT=y ++CONFIG_MEDIA_DIGITAL_TV_SUPPORT=y ++CONFIG_MEDIA_RADIO_SUPPORT=y ++CONFIG_MEDIA_RC_SUPPORT=y ++CONFIG_MEDIA_CONTROLLER=y ++CONFIG_LIRC=m ++CONFIG_RC_DEVICES=y ++CONFIG_RC_ATI_REMOTE=m ++CONFIG_IR_IMON=m ++CONFIG_IR_MCEUSB=m ++CONFIG_IR_REDRAT3=m ++CONFIG_IR_STREAMZAP=m ++CONFIG_IR_IGUANA=m ++CONFIG_IR_TTUSBIR=m ++CONFIG_RC_LOOPBACK=m ++CONFIG_IR_GPIO_CIR=m ++CONFIG_MEDIA_USB_SUPPORT=y ++CONFIG_USB_VIDEO_CLASS=m ++CONFIG_USB_M5602=m ++CONFIG_USB_STV06XX=m ++CONFIG_USB_GL860=m ++CONFIG_USB_GSPCA_BENQ=m ++CONFIG_USB_GSPCA_CONEX=m ++CONFIG_USB_GSPCA_CPIA1=m ++CONFIG_USB_GSPCA_DTCS033=m ++CONFIG_USB_GSPCA_ETOMS=m ++CONFIG_USB_GSPCA_FINEPIX=m ++CONFIG_USB_GSPCA_JEILINJ=m ++CONFIG_USB_GSPCA_JL2005BCD=m ++CONFIG_USB_GSPCA_KINECT=m ++CONFIG_USB_GSPCA_KONICA=m ++CONFIG_USB_GSPCA_MARS=m ++CONFIG_USB_GSPCA_MR97310A=m ++CONFIG_USB_GSPCA_NW80X=m ++CONFIG_USB_GSPCA_OV519=m ++CONFIG_USB_GSPCA_OV534=m ++CONFIG_USB_GSPCA_OV534_9=m ++CONFIG_USB_GSPCA_PAC207=m ++CONFIG_USB_GSPCA_PAC7302=m ++CONFIG_USB_GSPCA_PAC7311=m ++CONFIG_USB_GSPCA_SE401=m ++CONFIG_USB_GSPCA_SN9C2028=m ++CONFIG_USB_GSPCA_SN9C20X=m ++CONFIG_USB_GSPCA_SONIXB=m ++CONFIG_USB_GSPCA_SONIXJ=m ++CONFIG_USB_GSPCA_SPCA500=m ++CONFIG_USB_GSPCA_SPCA501=m ++CONFIG_USB_GSPCA_SPCA505=m ++CONFIG_USB_GSPCA_SPCA506=m ++CONFIG_USB_GSPCA_SPCA508=m ++CONFIG_USB_GSPCA_SPCA561=m ++CONFIG_USB_GSPCA_SPCA1528=m ++CONFIG_USB_GSPCA_SQ905=m ++CONFIG_USB_GSPCA_SQ905C=m ++CONFIG_USB_GSPCA_SQ930X=m ++CONFIG_USB_GSPCA_STK014=m ++CONFIG_USB_GSPCA_STK1135=m ++CONFIG_USB_GSPCA_STV0680=m ++CONFIG_USB_GSPCA_SUNPLUS=m ++CONFIG_USB_GSPCA_T613=m ++CONFIG_USB_GSPCA_TOPRO=m ++CONFIG_USB_GSPCA_TV8532=m ++CONFIG_USB_GSPCA_VC032X=m ++CONFIG_USB_GSPCA_VICAM=m ++CONFIG_USB_GSPCA_XIRLINK_CIT=m ++CONFIG_USB_GSPCA_ZC3XX=m ++CONFIG_USB_PWC=m ++CONFIG_VIDEO_CPIA2=m ++CONFIG_USB_ZR364XX=m ++CONFIG_USB_STKWEBCAM=m ++CONFIG_USB_S2255=m ++CONFIG_VIDEO_USBTV=m ++CONFIG_VIDEO_PVRUSB2=m ++CONFIG_VIDEO_HDPVR=m ++CONFIG_VIDEO_USBVISION=m ++CONFIG_VIDEO_STK1160_COMMON=m ++CONFIG_VIDEO_STK1160_AC97=y ++CONFIG_VIDEO_GO7007=m ++CONFIG_VIDEO_GO7007_USB=m ++CONFIG_VIDEO_GO7007_USB_S2250_BOARD=m ++CONFIG_VIDEO_AU0828=m ++CONFIG_VIDEO_AU0828_RC=y ++CONFIG_VIDEO_CX231XX=m ++CONFIG_VIDEO_CX231XX_ALSA=m ++CONFIG_VIDEO_CX231XX_DVB=m ++CONFIG_VIDEO_TM6000=m ++CONFIG_VIDEO_TM6000_ALSA=m ++CONFIG_VIDEO_TM6000_DVB=m ++CONFIG_DVB_USB=m ++CONFIG_DVB_USB_A800=m ++CONFIG_DVB_USB_DIBUSB_MB=m ++CONFIG_DVB_USB_DIBUSB_MB_FAULTY=y ++CONFIG_DVB_USB_DIBUSB_MC=m ++CONFIG_DVB_USB_DIB0700=m ++CONFIG_DVB_USB_UMT_010=m ++CONFIG_DVB_USB_CXUSB=m ++CONFIG_DVB_USB_M920X=m ++CONFIG_DVB_USB_DIGITV=m ++CONFIG_DVB_USB_VP7045=m ++CONFIG_DVB_USB_VP702X=m ++CONFIG_DVB_USB_GP8PSK=m ++CONFIG_DVB_USB_NOVA_T_USB2=m ++CONFIG_DVB_USB_TTUSB2=m ++CONFIG_DVB_USB_DTT200U=m ++CONFIG_DVB_USB_OPERA1=m ++CONFIG_DVB_USB_AF9005=m ++CONFIG_DVB_USB_AF9005_REMOTE=m ++CONFIG_DVB_USB_PCTV452E=m ++CONFIG_DVB_USB_DW2102=m ++CONFIG_DVB_USB_CINERGY_T2=m ++CONFIG_DVB_USB_DTV5100=m ++CONFIG_DVB_USB_FRIIO=m ++CONFIG_DVB_USB_AZ6027=m ++CONFIG_DVB_USB_TECHNISAT_USB2=m ++CONFIG_DVB_USB_V2=m ++CONFIG_DVB_USB_AF9015=m ++CONFIG_DVB_USB_AF9035=m ++CONFIG_DVB_USB_ANYSEE=m ++CONFIG_DVB_USB_AU6610=m ++CONFIG_DVB_USB_AZ6007=m ++CONFIG_DVB_USB_CE6230=m ++CONFIG_DVB_USB_EC168=m ++CONFIG_DVB_USB_GL861=m ++CONFIG_DVB_USB_LME2510=m ++CONFIG_DVB_USB_MXL111SF=m ++CONFIG_DVB_USB_RTL28XXU=m ++CONFIG_DVB_USB_DVBSKY=m ++CONFIG_SMS_USB_DRV=m ++CONFIG_DVB_B2C2_FLEXCOP_USB=m ++CONFIG_DVB_AS102=m ++CONFIG_VIDEO_EM28XX=m ++CONFIG_VIDEO_EM28XX_V4L2=m ++CONFIG_VIDEO_EM28XX_ALSA=m ++CONFIG_VIDEO_EM28XX_DVB=m ++CONFIG_V4L_PLATFORM_DRIVERS=y ++CONFIG_VIDEO_BCM2835=y ++CONFIG_VIDEO_BCM2835_MMAL=m ++CONFIG_RADIO_SI470X=y ++CONFIG_USB_SI470X=m ++CONFIG_I2C_SI470X=m ++CONFIG_RADIO_SI4713=m ++CONFIG_I2C_SI4713=m ++CONFIG_USB_MR800=m ++CONFIG_USB_DSBR=m ++CONFIG_RADIO_SHARK=m ++CONFIG_RADIO_SHARK2=m ++CONFIG_USB_KEENE=m ++CONFIG_USB_MA901=m ++CONFIG_RADIO_TEA5764=m ++CONFIG_RADIO_SAA7706H=m ++CONFIG_RADIO_TEF6862=m ++CONFIG_RADIO_WL1273=m ++CONFIG_RADIO_WL128X=m ++# CONFIG_MEDIA_SUBDRV_AUTOSELECT is not set ++CONFIG_VIDEO_UDA1342=m ++CONFIG_VIDEO_SONY_BTF_MPX=m ++CONFIG_VIDEO_TVP5150=m ++CONFIG_VIDEO_TW2804=m ++CONFIG_VIDEO_TW9903=m ++CONFIG_VIDEO_TW9906=m ++CONFIG_VIDEO_OV7640=m ++CONFIG_VIDEO_MT9V011=m ++CONFIG_DRM=m ++CONFIG_DRM_LOAD_EDID_FIRMWARE=y ++CONFIG_DRM_UDL=m ++CONFIG_DRM_VC4=m ++CONFIG_FB=y ++CONFIG_FB_BCM2708=y ++CONFIG_FB_UDL=m ++CONFIG_FB_SSD1307=m ++CONFIG_FB_RPISENSE=m ++# CONFIG_BACKLIGHT_GENERIC is not set ++CONFIG_BACKLIGHT_RPI=m ++CONFIG_BACKLIGHT_GPIO=m ++CONFIG_FRAMEBUFFER_CONSOLE=y ++CONFIG_LOGO=y ++# CONFIG_LOGO_LINUX_MONO is not set ++# CONFIG_LOGO_LINUX_VGA16 is not set ++CONFIG_SOUND=y ++CONFIG_SND=m ++CONFIG_SND_SEQUENCER=m ++CONFIG_SND_SEQ_DUMMY=m ++CONFIG_SND_MIXER_OSS=m ++CONFIG_SND_PCM_OSS=m ++CONFIG_SND_SEQUENCER_OSS=y ++CONFIG_SND_HRTIMER=m ++CONFIG_SND_DUMMY=m ++CONFIG_SND_ALOOP=m ++CONFIG_SND_VIRMIDI=m ++CONFIG_SND_MTPAV=m ++CONFIG_SND_SERIAL_U16550=m ++CONFIG_SND_MPU401=m ++CONFIG_SND_BCM2835=m ++CONFIG_SND_USB_AUDIO=m ++CONFIG_SND_USB_UA101=m ++CONFIG_SND_USB_CAIAQ=m ++CONFIG_SND_USB_CAIAQ_INPUT=y ++CONFIG_SND_USB_6FIRE=m ++CONFIG_SND_SOC=m ++CONFIG_SND_BCM2835_SOC_I2S=m ++CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC=m ++CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS=m ++CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI=m ++CONFIG_SND_BCM2708_SOC_HIFIBERRY_AMP=m ++CONFIG_SND_BCM2708_SOC_RPI_DAC=m ++CONFIG_SND_BCM2708_SOC_RPI_PROTO=m ++CONFIG_SND_BCM2708_SOC_BOOMBERRY_DAC=m ++CONFIG_SND_BCM2708_SOC_BOOMBERRY_DIGI=m ++CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC=m ++CONFIG_SND_BCM2708_SOC_RASPIDAC3=m ++CONFIG_SND_BCM2708_SOC_ADAU1977_ADC=m ++CONFIG_SND_AUDIOINJECTOR_PI_SOUNDCARD=m ++CONFIG_SND_SOC_ADAU1701=m ++CONFIG_SND_SOC_WM8804_I2C=m ++CONFIG_SND_SIMPLE_CARD=m ++CONFIG_SOUND_PRIME=m ++CONFIG_HIDRAW=y ++CONFIG_UHID=m ++CONFIG_HID_A4TECH=m ++CONFIG_HID_ACRUX=m ++CONFIG_HID_APPLE=m ++CONFIG_HID_BELKIN=m ++CONFIG_HID_BETOP_FF=m ++CONFIG_HID_CHERRY=m ++CONFIG_HID_CHICONY=m ++CONFIG_HID_CYPRESS=m ++CONFIG_HID_DRAGONRISE=m ++CONFIG_HID_EMS_FF=m ++CONFIG_HID_ELECOM=m ++CONFIG_HID_ELO=m ++CONFIG_HID_EZKEY=m ++CONFIG_HID_HOLTEK=m ++CONFIG_HID_KEYTOUCH=m ++CONFIG_HID_KYE=m ++CONFIG_HID_UCLOGIC=m ++CONFIG_HID_WALTOP=m ++CONFIG_HID_GYRATION=m ++CONFIG_HID_TWINHAN=m ++CONFIG_HID_KENSINGTON=m ++CONFIG_HID_LCPOWER=m ++CONFIG_HID_LOGITECH=m ++CONFIG_HID_LOGITECH_DJ=m ++CONFIG_LOGITECH_FF=y ++CONFIG_LOGIRUMBLEPAD2_FF=y ++CONFIG_LOGIG940_FF=y ++CONFIG_HID_MAGICMOUSE=m ++CONFIG_HID_MICROSOFT=m ++CONFIG_HID_MONTEREY=m ++CONFIG_HID_MULTITOUCH=m ++CONFIG_HID_NTRIG=m ++CONFIG_HID_ORTEK=m ++CONFIG_HID_PANTHERLORD=m ++CONFIG_HID_PETALYNX=m ++CONFIG_HID_PICOLCD=m ++CONFIG_HID_ROCCAT=m ++CONFIG_HID_SAMSUNG=m ++CONFIG_HID_SONY=m ++CONFIG_HID_SPEEDLINK=m ++CONFIG_HID_SUNPLUS=m ++CONFIG_HID_GREENASIA=m ++CONFIG_HID_SMARTJOYPLUS=m ++CONFIG_HID_TOPSEED=m ++CONFIG_HID_THINGM=m ++CONFIG_HID_THRUSTMASTER=m ++CONFIG_HID_WACOM=m ++CONFIG_HID_WIIMOTE=m ++CONFIG_HID_XINMO=m ++CONFIG_HID_ZEROPLUS=m ++CONFIG_HID_ZYDACRON=m ++CONFIG_HID_PID=y ++CONFIG_USB_HIDDEV=y ++CONFIG_USB=y ++CONFIG_USB_ANNOUNCE_NEW_DEVICES=y ++CONFIG_USB_MON=m ++CONFIG_USB_DWCOTG=y ++CONFIG_USB_PRINTER=m ++CONFIG_USB_STORAGE=y ++CONFIG_USB_STORAGE_REALTEK=m ++CONFIG_USB_STORAGE_DATAFAB=m ++CONFIG_USB_STORAGE_FREECOM=m ++CONFIG_USB_STORAGE_ISD200=m ++CONFIG_USB_STORAGE_USBAT=m ++CONFIG_USB_STORAGE_SDDR09=m ++CONFIG_USB_STORAGE_SDDR55=m ++CONFIG_USB_STORAGE_JUMPSHOT=m ++CONFIG_USB_STORAGE_ALAUDA=m ++CONFIG_USB_STORAGE_ONETOUCH=m ++CONFIG_USB_STORAGE_KARMA=m ++CONFIG_USB_STORAGE_CYPRESS_ATACB=m ++CONFIG_USB_STORAGE_ENE_UB6250=m ++CONFIG_USB_MDC800=m ++CONFIG_USB_MICROTEK=m ++CONFIG_USBIP_CORE=m ++CONFIG_USBIP_VHCI_HCD=m ++CONFIG_USBIP_HOST=m ++CONFIG_USB_DWC2=m ++CONFIG_USB_SERIAL=m ++CONFIG_USB_SERIAL_GENERIC=y ++CONFIG_USB_SERIAL_AIRCABLE=m ++CONFIG_USB_SERIAL_ARK3116=m ++CONFIG_USB_SERIAL_BELKIN=m ++CONFIG_USB_SERIAL_CH341=m ++CONFIG_USB_SERIAL_WHITEHEAT=m ++CONFIG_USB_SERIAL_DIGI_ACCELEPORT=m ++CONFIG_USB_SERIAL_CP210X=m ++CONFIG_USB_SERIAL_CYPRESS_M8=m ++CONFIG_USB_SERIAL_EMPEG=m ++CONFIG_USB_SERIAL_FTDI_SIO=m ++CONFIG_USB_SERIAL_VISOR=m ++CONFIG_USB_SERIAL_IPAQ=m ++CONFIG_USB_SERIAL_IR=m ++CONFIG_USB_SERIAL_EDGEPORT=m ++CONFIG_USB_SERIAL_EDGEPORT_TI=m ++CONFIG_USB_SERIAL_F81232=m ++CONFIG_USB_SERIAL_GARMIN=m ++CONFIG_USB_SERIAL_IPW=m ++CONFIG_USB_SERIAL_IUU=m ++CONFIG_USB_SERIAL_KEYSPAN_PDA=m ++CONFIG_USB_SERIAL_KEYSPAN=m ++CONFIG_USB_SERIAL_KLSI=m ++CONFIG_USB_SERIAL_KOBIL_SCT=m ++CONFIG_USB_SERIAL_MCT_U232=m ++CONFIG_USB_SERIAL_METRO=m ++CONFIG_USB_SERIAL_MOS7720=m ++CONFIG_USB_SERIAL_MOS7840=m ++CONFIG_USB_SERIAL_NAVMAN=m ++CONFIG_USB_SERIAL_PL2303=m ++CONFIG_USB_SERIAL_OTI6858=m ++CONFIG_USB_SERIAL_QCAUX=m ++CONFIG_USB_SERIAL_QUALCOMM=m ++CONFIG_USB_SERIAL_SPCP8X5=m ++CONFIG_USB_SERIAL_SAFE=m ++CONFIG_USB_SERIAL_SIERRAWIRELESS=m ++CONFIG_USB_SERIAL_SYMBOL=m ++CONFIG_USB_SERIAL_TI=m ++CONFIG_USB_SERIAL_CYBERJACK=m ++CONFIG_USB_SERIAL_XIRCOM=m ++CONFIG_USB_SERIAL_OPTION=m ++CONFIG_USB_SERIAL_OMNINET=m ++CONFIG_USB_SERIAL_OPTICON=m ++CONFIG_USB_SERIAL_XSENS_MT=m ++CONFIG_USB_SERIAL_WISHBONE=m ++CONFIG_USB_SERIAL_SSU100=m ++CONFIG_USB_SERIAL_QT2=m ++CONFIG_USB_SERIAL_DEBUG=m ++CONFIG_USB_EMI62=m ++CONFIG_USB_EMI26=m ++CONFIG_USB_ADUTUX=m ++CONFIG_USB_SEVSEG=m ++CONFIG_USB_RIO500=m ++CONFIG_USB_LEGOTOWER=m ++CONFIG_USB_LCD=m ++CONFIG_USB_LED=m ++CONFIG_USB_CYPRESS_CY7C63=m ++CONFIG_USB_CYTHERM=m ++CONFIG_USB_IDMOUSE=m ++CONFIG_USB_FTDI_ELAN=m ++CONFIG_USB_APPLEDISPLAY=m ++CONFIG_USB_LD=m ++CONFIG_USB_TRANCEVIBRATOR=m ++CONFIG_USB_IOWARRIOR=m ++CONFIG_USB_TEST=m ++CONFIG_USB_ISIGHTFW=m ++CONFIG_USB_YUREX=m ++CONFIG_USB_ATM=m ++CONFIG_USB_SPEEDTOUCH=m ++CONFIG_USB_CXACRU=m ++CONFIG_USB_UEAGLEATM=m ++CONFIG_USB_XUSBATM=m ++CONFIG_USB_GADGET=m ++CONFIG_USB_ZERO=m ++CONFIG_USB_AUDIO=m ++CONFIG_USB_ETH=m ++CONFIG_USB_GADGETFS=m ++CONFIG_USB_MASS_STORAGE=m ++CONFIG_USB_G_SERIAL=m ++CONFIG_USB_MIDI_GADGET=m ++CONFIG_USB_G_PRINTER=m ++CONFIG_USB_CDC_COMPOSITE=m ++CONFIG_USB_G_ACM_MS=m ++CONFIG_USB_G_MULTI=m ++CONFIG_USB_G_HID=m ++CONFIG_USB_G_WEBCAM=m ++CONFIG_MMC=y ++CONFIG_MMC_BLOCK_MINORS=32 ++CONFIG_MMC_BCM2835=y ++CONFIG_MMC_BCM2835_DMA=y ++CONFIG_MMC_BCM2835_SDHOST=y ++CONFIG_MMC_SDHCI=y ++CONFIG_MMC_SDHCI_PLTFM=y ++CONFIG_MMC_SPI=m ++CONFIG_LEDS_CLASS=y ++CONFIG_LEDS_GPIO=y ++CONFIG_LEDS_TRIGGER_TIMER=y ++CONFIG_LEDS_TRIGGER_ONESHOT=y ++CONFIG_LEDS_TRIGGER_HEARTBEAT=y ++CONFIG_LEDS_TRIGGER_BACKLIGHT=y ++CONFIG_LEDS_TRIGGER_CPU=y ++CONFIG_LEDS_TRIGGER_GPIO=y ++CONFIG_LEDS_TRIGGER_DEFAULT_ON=y ++CONFIG_LEDS_TRIGGER_TRANSIENT=m ++CONFIG_LEDS_TRIGGER_CAMERA=m ++CONFIG_LEDS_TRIGGER_INPUT=y ++CONFIG_RTC_CLASS=y ++# CONFIG_RTC_HCTOSYS is not set ++CONFIG_RTC_DRV_DS1307=m ++CONFIG_RTC_DRV_DS1374=m ++CONFIG_RTC_DRV_DS1672=m ++CONFIG_RTC_DRV_MAX6900=m ++CONFIG_RTC_DRV_RS5C372=m ++CONFIG_RTC_DRV_ISL1208=m ++CONFIG_RTC_DRV_ISL12022=m ++CONFIG_RTC_DRV_ISL12057=m ++CONFIG_RTC_DRV_X1205=m ++CONFIG_RTC_DRV_PCF8523=m ++CONFIG_RTC_DRV_PCF8563=m ++CONFIG_RTC_DRV_PCF8583=m ++CONFIG_RTC_DRV_M41T80=m ++CONFIG_RTC_DRV_BQ32K=m ++CONFIG_RTC_DRV_S35390A=m ++CONFIG_RTC_DRV_FM3130=m ++CONFIG_RTC_DRV_RX8581=m ++CONFIG_RTC_DRV_RX8025=m ++CONFIG_RTC_DRV_EM3027=m ++CONFIG_RTC_DRV_RV3029C2=m ++CONFIG_RTC_DRV_M41T93=m ++CONFIG_RTC_DRV_M41T94=m ++CONFIG_RTC_DRV_DS1305=m ++CONFIG_RTC_DRV_DS1390=m ++CONFIG_RTC_DRV_R9701=m ++CONFIG_RTC_DRV_RX4581=m ++CONFIG_RTC_DRV_RS5C348=m ++CONFIG_RTC_DRV_MAX6902=m ++CONFIG_RTC_DRV_PCF2123=m ++CONFIG_RTC_DRV_DS3232=m ++CONFIG_RTC_DRV_PCF2127=m ++CONFIG_DMADEVICES=y ++CONFIG_DMA_BCM2835=y ++CONFIG_DMA_BCM2708=y ++CONFIG_UIO=m ++CONFIG_UIO_PDRV_GENIRQ=m ++CONFIG_STAGING=y ++CONFIG_PRISM2_USB=m ++CONFIG_R8712U=m ++CONFIG_R8188EU=m ++CONFIG_R8723AU=m ++CONFIG_VT6656=m ++CONFIG_SPEAKUP=m ++CONFIG_SPEAKUP_SYNTH_SOFT=m ++CONFIG_STAGING_MEDIA=y ++CONFIG_LIRC_STAGING=y ++CONFIG_LIRC_IMON=m ++CONFIG_LIRC_RPI=m ++CONFIG_LIRC_SASEM=m ++CONFIG_LIRC_SERIAL=m ++CONFIG_FB_TFT=m ++CONFIG_FB_TFT_AGM1264K_FL=m ++CONFIG_FB_TFT_BD663474=m ++CONFIG_FB_TFT_HX8340BN=m ++CONFIG_FB_TFT_HX8347D=m ++CONFIG_FB_TFT_HX8353D=m ++CONFIG_FB_TFT_ILI9163=m ++CONFIG_FB_TFT_ILI9320=m ++CONFIG_FB_TFT_ILI9325=m ++CONFIG_FB_TFT_ILI9340=m ++CONFIG_FB_TFT_ILI9341=m ++CONFIG_FB_TFT_ILI9481=m ++CONFIG_FB_TFT_ILI9486=m ++CONFIG_FB_TFT_PCD8544=m ++CONFIG_FB_TFT_RA8875=m ++CONFIG_FB_TFT_S6D02A1=m ++CONFIG_FB_TFT_S6D1121=m ++CONFIG_FB_TFT_SSD1289=m ++CONFIG_FB_TFT_SSD1306=m ++CONFIG_FB_TFT_SSD1331=m ++CONFIG_FB_TFT_SSD1351=m ++CONFIG_FB_TFT_ST7735R=m ++CONFIG_FB_TFT_TINYLCD=m ++CONFIG_FB_TFT_TLS8204=m ++CONFIG_FB_TFT_UC1701=m ++CONFIG_FB_TFT_UPD161704=m ++CONFIG_FB_TFT_WATTEROTT=m ++CONFIG_FB_FLEX=m ++CONFIG_FB_TFT_FBTFT_DEVICE=m ++CONFIG_MAILBOX=y ++CONFIG_BCM2835_MBOX=y ++# CONFIG_IOMMU_SUPPORT is not set ++CONFIG_RASPBERRYPI_POWER=y ++CONFIG_EXTCON=m ++CONFIG_EXTCON_ARIZONA=m ++CONFIG_IIO=m ++CONFIG_IIO_BUFFER=y ++CONFIG_IIO_BUFFER_CB=m ++CONFIG_IIO_KFIFO_BUF=m ++CONFIG_MCP320X=m ++CONFIG_MCP3422=m ++CONFIG_DHT11=m ++CONFIG_PWM_BCM2835=m ++CONFIG_PWM_PCA9685=m ++CONFIG_RASPBERRYPI_FIRMWARE=y ++CONFIG_EXT4_FS=y ++CONFIG_EXT4_FS_POSIX_ACL=y ++CONFIG_EXT4_FS_SECURITY=y ++CONFIG_REISERFS_FS=m ++CONFIG_REISERFS_FS_XATTR=y ++CONFIG_REISERFS_FS_POSIX_ACL=y ++CONFIG_REISERFS_FS_SECURITY=y ++CONFIG_JFS_FS=m ++CONFIG_JFS_POSIX_ACL=y ++CONFIG_JFS_SECURITY=y ++CONFIG_JFS_STATISTICS=y ++CONFIG_XFS_FS=m ++CONFIG_XFS_QUOTA=y ++CONFIG_XFS_POSIX_ACL=y ++CONFIG_XFS_RT=y ++CONFIG_GFS2_FS=m ++CONFIG_OCFS2_FS=m ++CONFIG_BTRFS_FS=m ++CONFIG_BTRFS_FS_POSIX_ACL=y ++CONFIG_NILFS2_FS=m ++CONFIG_F2FS_FS=y ++CONFIG_FANOTIFY=y ++CONFIG_QFMT_V1=m ++CONFIG_QFMT_V2=m ++CONFIG_AUTOFS4_FS=y ++CONFIG_FUSE_FS=m ++CONFIG_CUSE=m ++CONFIG_OVERLAY_FS=m ++CONFIG_FSCACHE=y ++CONFIG_FSCACHE_STATS=y ++CONFIG_FSCACHE_HISTOGRAM=y ++CONFIG_CACHEFILES=y ++CONFIG_ISO9660_FS=m ++CONFIG_JOLIET=y ++CONFIG_ZISOFS=y ++CONFIG_UDF_FS=m ++CONFIG_MSDOS_FS=y ++CONFIG_VFAT_FS=y ++CONFIG_FAT_DEFAULT_IOCHARSET="ascii" ++CONFIG_NTFS_FS=m ++CONFIG_NTFS_RW=y ++CONFIG_TMPFS=y ++CONFIG_TMPFS_POSIX_ACL=y ++CONFIG_ECRYPT_FS=m ++CONFIG_HFS_FS=m ++CONFIG_HFSPLUS_FS=m ++CONFIG_JFFS2_FS=m ++CONFIG_JFFS2_SUMMARY=y ++CONFIG_UBIFS_FS=m ++CONFIG_SQUASHFS=m ++CONFIG_SQUASHFS_XATTR=y ++CONFIG_SQUASHFS_LZO=y ++CONFIG_SQUASHFS_XZ=y ++CONFIG_NFS_FS=y ++CONFIG_NFS_V3_ACL=y ++CONFIG_NFS_V4=y ++CONFIG_NFS_SWAP=y ++CONFIG_ROOT_NFS=y ++CONFIG_NFS_FSCACHE=y ++CONFIG_NFSD=m ++CONFIG_NFSD_V3_ACL=y ++CONFIG_NFSD_V4=y ++CONFIG_CIFS=m ++CONFIG_CIFS_WEAK_PW_HASH=y ++CONFIG_CIFS_UPCALL=y ++CONFIG_CIFS_XATTR=y ++CONFIG_CIFS_POSIX=y ++CONFIG_CIFS_ACL=y ++CONFIG_CIFS_DFS_UPCALL=y ++CONFIG_CIFS_SMB2=y ++CONFIG_CIFS_FSCACHE=y ++CONFIG_9P_FS=m ++CONFIG_9P_FS_POSIX_ACL=y ++CONFIG_NLS_DEFAULT="utf8" ++CONFIG_NLS_CODEPAGE_437=y ++CONFIG_NLS_CODEPAGE_737=m ++CONFIG_NLS_CODEPAGE_775=m ++CONFIG_NLS_CODEPAGE_850=m ++CONFIG_NLS_CODEPAGE_852=m ++CONFIG_NLS_CODEPAGE_855=m ++CONFIG_NLS_CODEPAGE_857=m ++CONFIG_NLS_CODEPAGE_860=m ++CONFIG_NLS_CODEPAGE_861=m ++CONFIG_NLS_CODEPAGE_862=m ++CONFIG_NLS_CODEPAGE_863=m ++CONFIG_NLS_CODEPAGE_864=m ++CONFIG_NLS_CODEPAGE_865=m ++CONFIG_NLS_CODEPAGE_866=m ++CONFIG_NLS_CODEPAGE_869=m ++CONFIG_NLS_CODEPAGE_936=m ++CONFIG_NLS_CODEPAGE_950=m ++CONFIG_NLS_CODEPAGE_932=m ++CONFIG_NLS_CODEPAGE_949=m ++CONFIG_NLS_CODEPAGE_874=m ++CONFIG_NLS_ISO8859_8=m ++CONFIG_NLS_CODEPAGE_1250=m ++CONFIG_NLS_CODEPAGE_1251=m ++CONFIG_NLS_ASCII=y ++CONFIG_NLS_ISO8859_1=m ++CONFIG_NLS_ISO8859_2=m ++CONFIG_NLS_ISO8859_3=m ++CONFIG_NLS_ISO8859_4=m ++CONFIG_NLS_ISO8859_5=m ++CONFIG_NLS_ISO8859_6=m ++CONFIG_NLS_ISO8859_7=m ++CONFIG_NLS_ISO8859_9=m ++CONFIG_NLS_ISO8859_13=m ++CONFIG_NLS_ISO8859_14=m ++CONFIG_NLS_ISO8859_15=m ++CONFIG_NLS_KOI8_R=m ++CONFIG_NLS_KOI8_U=m ++CONFIG_DLM=m ++CONFIG_PRINTK_TIME=y ++CONFIG_BOOT_PRINTK_DELAY=y ++CONFIG_DEBUG_MEMORY_INIT=y ++CONFIG_DETECT_HUNG_TASK=y ++CONFIG_TIMER_STATS=y ++CONFIG_LATENCYTOP=y ++CONFIG_IRQSOFF_TRACER=y ++CONFIG_SCHED_TRACER=y ++CONFIG_STACK_TRACER=y ++CONFIG_BLK_DEV_IO_TRACE=y ++# CONFIG_KPROBE_EVENT is not set ++CONFIG_FUNCTION_PROFILER=y ++CONFIG_KGDB=y ++CONFIG_KGDB_KDB=y ++CONFIG_KDB_KEYBOARD=y ++CONFIG_CRYPTO_USER=m ++CONFIG_CRYPTO_CRYPTD=m ++CONFIG_CRYPTO_CBC=y ++CONFIG_CRYPTO_CTS=m ++CONFIG_CRYPTO_XTS=m ++CONFIG_CRYPTO_XCBC=m ++CONFIG_CRYPTO_SHA512=m ++CONFIG_CRYPTO_TGR192=m ++CONFIG_CRYPTO_WP512=m ++CONFIG_CRYPTO_CAST5=m ++CONFIG_CRYPTO_DES=y ++CONFIG_CRYPTO_USER_API_SKCIPHER=m ++# CONFIG_CRYPTO_HW is not set ++CONFIG_ARM_CRYPTO=y ++CONFIG_CRYPTO_SHA1_ARM=m ++CONFIG_CRYPTO_AES_ARM=m ++CONFIG_CRC_ITU_T=y ++CONFIG_LIBCRC32C=y + +From 62dcca217ece326d398b5a2ded691690d01014f1 Mon Sep 17 00:00:00 2001 +From: Gordon Hollingworth <gordon@raspberrypi.org> +Date: Tue, 12 May 2015 14:47:56 +0100 +Subject: [PATCH 078/112] rpi-ft5406: Add touchscreen driver for pi LCD display + +Fix driver detection failure Check that the buffer response is non-zero meaning the touchscreen was detected + +rpi-ft5406: Use firmware API +--- + drivers/input/touchscreen/Kconfig | 7 + + drivers/input/touchscreen/Makefile | 1 + + drivers/input/touchscreen/rpi-ft5406.c | 246 +++++++++++++++++++++++++++++++++ + 3 files changed, 254 insertions(+) + create mode 100644 drivers/input/touchscreen/rpi-ft5406.c + +diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig +index 8ecdc38..1e4e7a0 100644 +--- a/drivers/input/touchscreen/Kconfig ++++ b/drivers/input/touchscreen/Kconfig +@@ -630,6 +630,13 @@ config TOUCHSCREEN_EDT_FT5X06 + To compile this driver as a module, choose M here: the + module will be called edt-ft5x06. -+#define HIFIBERRY_DACPRO_NOCLOCK 0 -+#define HIFIBERRY_DACPRO_CLK44EN 1 -+#define HIFIBERRY_DACPRO_CLK48EN 2 -+ -+struct pcm512x_priv { -+ struct regmap *regmap; -+ struct clk *sclk; -+}; ++config TOUCHSCREEN_RPI_FT5406 ++ tristate "Raspberry Pi FT5406 driver" ++ depends on RASPBERRYPI_FIRMWARE ++ help ++ Say Y here to enable the Raspberry Pi memory based FT5406 device + -+/* Clock rate of CLK44EN attached to GPIO6 pin */ -+#define CLK_44EN_RATE 22579200UL -+/* Clock rate of CLK48EN attached to GPIO3 pin */ -+#define CLK_48EN_RATE 24576000UL + -+static bool snd_rpi_hifiberry_is_dacpro; + config TOUCHSCREEN_MIGOR + tristate "Renesas MIGO-R touchscreen" + depends on SH_MIGOR && I2C +diff --git a/drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile +index f42975e..92590b3 100644 +--- a/drivers/input/touchscreen/Makefile ++++ b/drivers/input/touchscreen/Makefile +@@ -29,6 +29,7 @@ obj-$(CONFIG_TOUCHSCREEN_DA9034) += da9034-ts.o + obj-$(CONFIG_TOUCHSCREEN_DA9052) += da9052_tsi.o + obj-$(CONFIG_TOUCHSCREEN_DYNAPRO) += dynapro.o + obj-$(CONFIG_TOUCHSCREEN_EDT_FT5X06) += edt-ft5x06.o ++obj-$(CONFIG_TOUCHSCREEN_RPI_FT5406) += rpi-ft5406.o + obj-$(CONFIG_TOUCHSCREEN_HAMPSHIRE) += hampshire.o + obj-$(CONFIG_TOUCHSCREEN_GUNZE) += gunze.o + obj-$(CONFIG_TOUCHSCREEN_EETI) += eeti_ts.o +diff --git a/drivers/input/touchscreen/rpi-ft5406.c b/drivers/input/touchscreen/rpi-ft5406.c +new file mode 100644 +index 0000000..b27dbee +--- /dev/null ++++ b/drivers/input/touchscreen/rpi-ft5406.c +@@ -0,0 +1,246 @@ ++/* ++ * Driver for memory based ft5406 touchscreen ++ * ++ * Copyright (C) 2015 Raspberry Pi ++ * ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 as ++ * published by the Free Software Foundation. ++ */ + -+static void snd_rpi_hifiberry_dacplus_select_clk(struct snd_soc_codec *codec, -+ int clk_id) -+{ -+ switch (clk_id) { -+ case HIFIBERRY_DACPRO_NOCLOCK: -+ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x24, 0x00); -+ break; -+ case HIFIBERRY_DACPRO_CLK44EN: -+ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x24, 0x20); -+ break; -+ case HIFIBERRY_DACPRO_CLK48EN: -+ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x24, 0x04); -+ break; -+ } -+} + -+static void snd_rpi_hifiberry_dacplus_clk_gpio(struct snd_soc_codec *codec) -+{ -+ snd_soc_update_bits(codec, PCM512x_GPIO_EN, 0x24, 0x24); -+ snd_soc_update_bits(codec, PCM512x_GPIO_OUTPUT_3, 0x0f, 0x02); -+ snd_soc_update_bits(codec, PCM512x_GPIO_OUTPUT_6, 0x0f, 0x02); -+} ++#include <linux/module.h> ++#include <linux/interrupt.h> ++#include <linux/input.h> ++#include <linux/irq.h> ++#include <linux/delay.h> ++#include <linux/slab.h> ++#include <linux/bitops.h> ++#include <linux/input/mt.h> ++#include <linux/kthread.h> ++#include <linux/platform_device.h> ++#include <asm/io.h> ++#include <soc/bcm2835/raspberrypi-firmware.h> + -+static bool snd_rpi_hifiberry_dacplus_is_sclk(struct snd_soc_codec *codec) -+{ -+ int sck; ++#define MAXIMUM_SUPPORTED_POINTS 10 ++struct ft5406_regs { ++ uint8_t device_mode; ++ uint8_t gesture_id; ++ uint8_t num_points; ++ struct ft5406_touch { ++ uint8_t xh; ++ uint8_t xl; ++ uint8_t yh; ++ uint8_t yl; ++ uint8_t res1; ++ uint8_t res2; ++ } point[MAXIMUM_SUPPORTED_POINTS]; ++}; + -+ sck = snd_soc_read(codec, PCM512x_RATE_DET_4); -+ return (!(sck & 0x40)); -+} ++#define SCREEN_WIDTH 800 ++#define SCREEN_HEIGHT 480 + -+static bool snd_rpi_hifiberry_dacplus_is_sclk_sleep( -+ struct snd_soc_codec *codec) -+{ -+ msleep(2); -+ return snd_rpi_hifiberry_dacplus_is_sclk(codec); -+} ++struct ft5406 { ++ struct platform_device * pdev; ++ struct input_dev * input_dev; ++ void __iomem * ts_base; ++ struct ft5406_regs * regs; ++ struct task_struct * thread; ++}; + -+static bool snd_rpi_hifiberry_dacplus_is_pro_card(struct snd_soc_codec *codec) ++/* Thread to poll for touchscreen events ++ * ++ * This thread polls the memory based register copy of the ft5406 registers ++ * using the number of points register to know whether the copy has been ++ * updated (we write 99 to the memory copy, the GPU will write between ++ * 0 - 10 points) ++ */ ++static int ft5406_thread(void *arg) +{ -+ bool isClk44EN, isClk48En, isNoClk; -+ -+ snd_rpi_hifiberry_dacplus_clk_gpio(codec); -+ -+ snd_rpi_hifiberry_dacplus_select_clk(codec, HIFIBERRY_DACPRO_CLK44EN); -+ isClk44EN = snd_rpi_hifiberry_dacplus_is_sclk_sleep(codec); -+ -+ snd_rpi_hifiberry_dacplus_select_clk(codec, HIFIBERRY_DACPRO_NOCLOCK); -+ isNoClk = snd_rpi_hifiberry_dacplus_is_sclk_sleep(codec); ++ struct ft5406 *ts = (struct ft5406 *) arg; ++ struct ft5406_regs regs; ++ int known_ids = 0; ++ ++ while(!kthread_should_stop()) ++ { ++ // 60fps polling ++ msleep_interruptible(17); ++ memcpy_fromio(&regs, ts->regs, sizeof(*ts->regs)); ++ writel(99, &ts->regs->num_points); ++ // Do not output if theres no new information (num_points is 99) ++ // or we have no touch points and don't need to release any ++ if(!(regs.num_points == 99 || (regs.num_points == 0 && known_ids == 0))) ++ { ++ int i; ++ int modified_ids = 0, released_ids; ++ for(i = 0; i < regs.num_points; i++) ++ { ++ int x = (((int) regs.point[i].xh & 0xf) << 8) + regs.point[i].xl; ++ int y = (((int) regs.point[i].yh & 0xf) << 8) + regs.point[i].yl; ++ int touchid = (regs.point[i].yh >> 4) & 0xf; ++ ++ modified_ids |= 1 << touchid; + -+ snd_rpi_hifiberry_dacplus_select_clk(codec, HIFIBERRY_DACPRO_CLK48EN); -+ isClk48En = snd_rpi_hifiberry_dacplus_is_sclk_sleep(codec); ++ if(!((1 << touchid) & known_ids)) ++ dev_dbg(&ts->pdev->dev, "x = %d, y = %d, touchid = %d\n", x, y, touchid); ++ ++ input_mt_slot(ts->input_dev, touchid); ++ input_mt_report_slot_state(ts->input_dev, MT_TOOL_FINGER, 1); + -+ return (isClk44EN && isClk48En && !isNoClk); -+} ++ input_report_abs(ts->input_dev, ABS_MT_POSITION_X, x); ++ input_report_abs(ts->input_dev, ABS_MT_POSITION_Y, y); + -+static int snd_rpi_hifiberry_dacplus_clk_for_rate(int sample_rate) -+{ -+ int type; ++ } + -+ switch (sample_rate) { -+ case 11025: -+ case 22050: -+ case 44100: -+ case 88200: -+ case 176400: -+ type = HIFIBERRY_DACPRO_CLK44EN; -+ break; -+ default: -+ type = HIFIBERRY_DACPRO_CLK48EN; -+ break; ++ released_ids = known_ids & ~modified_ids; ++ for(i = 0; released_ids && i < MAXIMUM_SUPPORTED_POINTS; i++) ++ { ++ if(released_ids & (1<<i)) ++ { ++ dev_dbg(&ts->pdev->dev, "Released %d, known = %x modified = %x\n", i, known_ids, modified_ids); ++ input_mt_slot(ts->input_dev, i); ++ input_mt_report_slot_state(ts->input_dev, MT_TOOL_FINGER, 0); ++ modified_ids &= ~(1 << i); ++ } ++ } ++ known_ids = modified_ids; ++ ++ input_mt_report_pointer_emulation(ts->input_dev, true); ++ input_sync(ts->input_dev); ++ } ++ + } -+ return type; ++ ++ return 0; +} + -+static void snd_rpi_hifiberry_dacplus_set_sclk(struct snd_soc_codec *codec, -+ int sample_rate) ++static int ft5406_probe(struct platform_device *pdev) +{ -+ struct pcm512x_priv *pcm512x = snd_soc_codec_get_drvdata(codec); ++ int ret; ++ struct input_dev * input_dev = input_allocate_device(); ++ struct ft5406 * ts; ++ struct device_node *fw_node; ++ struct rpi_firmware *fw; ++ u32 touchbuf; ++ ++ dev_info(&pdev->dev, "Probing device\n"); ++ ++ fw_node = of_parse_phandle(pdev->dev.of_node, "firmware", 0); ++ if (!fw_node) { ++ dev_err(&pdev->dev, "Missing firmware node\n"); ++ return -ENOENT; ++ } + -+ if (!IS_ERR(pcm512x->sclk)) { -+ int ctype; ++ fw = rpi_firmware_get(fw_node); ++ if (!fw) ++ return -EPROBE_DEFER; + -+ ctype = snd_rpi_hifiberry_dacplus_clk_for_rate(sample_rate); -+ clk_set_rate(pcm512x->sclk, (ctype == HIFIBERRY_DACPRO_CLK44EN) -+ ? CLK_44EN_RATE : CLK_48EN_RATE); -+ snd_rpi_hifiberry_dacplus_select_clk(codec, ctype); ++ ret = rpi_firmware_property(fw, RPI_FIRMWARE_FRAMEBUFFER_GET_TOUCHBUF, ++ &touchbuf, sizeof(touchbuf)); ++ if (ret) { ++ dev_err(&pdev->dev, "Failed to get touch buffer\n"); ++ return ret; + } -+} -+ - static int snd_rpi_hifiberry_dacplus_init(struct snd_soc_pcm_runtime *rtd) - { - struct snd_soc_codec *codec = rtd->codec; -+ struct pcm512x_priv *priv; + -+ snd_rpi_hifiberry_is_dacpro -+ = snd_rpi_hifiberry_dacplus_is_pro_card(codec); ++ if (!touchbuf) { ++ dev_err(&pdev->dev, "Touchscreen not detected\n"); ++ return -ENODEV; ++ } + -+ if (snd_rpi_hifiberry_is_dacpro) { -+ struct snd_soc_dai_link *dai = rtd->dai_link; ++ dev_dbg(&pdev->dev, "Got TS buffer 0x%x\n", touchbuf); + -+ dai->name = "HiFiBerry DAC+ Pro"; -+ dai->stream_name = "HiFiBerry DAC+ Pro HiFi"; -+ dai->dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF -+ | SND_SOC_DAIFMT_CBM_CFM; ++ ts = kzalloc(sizeof(struct ft5406), GFP_KERNEL); + -+ snd_soc_update_bits(codec, PCM512x_BCLK_LRCLK_CFG, 0x31, 0x11); -+ snd_soc_update_bits(codec, PCM512x_MASTER_MODE, 0x03, 0x03); -+ snd_soc_update_bits(codec, PCM512x_MASTER_CLKDIV_2, 0x7f, 63); -+ } else { -+ priv = snd_soc_codec_get_drvdata(codec); -+ priv->sclk = ERR_PTR(-ENOENT); ++ if (!ts || !input_dev) { ++ ret = -ENOMEM; ++ dev_err(&pdev->dev, "Failed to allocate memory\n"); ++ return ret; + } ++ ts->input_dev = input_dev; ++ platform_set_drvdata(pdev, ts); ++ ts->pdev = pdev; ++ ++ input_dev->name = "FT5406 memory based driver"; ++ ++ __set_bit(EV_KEY, input_dev->evbit); ++ __set_bit(EV_SYN, input_dev->evbit); ++ __set_bit(EV_ABS, input_dev->evbit); + - snd_soc_update_bits(codec, PCM512x_GPIO_EN, 0x08, 0x08); -- snd_soc_update_bits(codec, PCM512x_GPIO_OUTPUT_4, 0xf, 0x02); -- snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x08,0x08); -+ snd_soc_update_bits(codec, PCM512x_GPIO_OUTPUT_4, 0x0f, 0x02); -+ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x08, 0x08); -+ -+ return 0; -+} ++ input_set_abs_params(input_dev, ABS_MT_POSITION_X, 0, ++ SCREEN_WIDTH, 0, 0); ++ input_set_abs_params(input_dev, ABS_MT_POSITION_Y, 0, ++ SCREEN_HEIGHT, 0, 0); + -+static int snd_rpi_hifiberry_dacplus_update_rate_den( -+ struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params) -+{ -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_codec *codec = rtd->codec; -+ struct pcm512x_priv *pcm512x = snd_soc_codec_get_drvdata(codec); -+ struct snd_ratnum *rats_no_pll; -+ unsigned int num = 0, den = 0; -+ int err; ++ input_mt_init_slots(input_dev, MAXIMUM_SUPPORTED_POINTS, INPUT_MT_DIRECT); + -+ rats_no_pll = devm_kzalloc(rtd->dev, sizeof(*rats_no_pll), GFP_KERNEL); -+ if (!rats_no_pll) ++ input_set_drvdata(input_dev, ts); ++ ++ ret = input_register_device(input_dev); ++ if (ret) { ++ dev_err(&pdev->dev, "could not register input device, %d\n", ++ ret); ++ return ret; ++ } ++ ++ // mmap the physical memory ++ touchbuf &= ~0xc0000000; ++ ts->ts_base = ioremap(touchbuf, sizeof(*ts->regs)); ++ if(ts->ts_base == NULL) ++ { ++ dev_err(&pdev->dev, "Failed to map physical address\n"); ++ input_unregister_device(input_dev); ++ kzfree(ts); + return -ENOMEM; ++ } ++ ++ ts->regs = (struct ft5406_regs *) ts->ts_base; + -+ rats_no_pll->num = clk_get_rate(pcm512x->sclk) / 64; -+ rats_no_pll->den_min = 1; -+ rats_no_pll->den_max = 128; -+ rats_no_pll->den_step = 1; -+ -+ err = snd_interval_ratnum(hw_param_interval(params, -+ SNDRV_PCM_HW_PARAM_RATE), 1, rats_no_pll, &num, &den); -+ if (err >= 0 && den) { -+ params->rate_num = num; -+ params->rate_den = den; ++ // create thread to poll the touch events ++ ts->thread = kthread_run(ft5406_thread, ts, "ft5406"); ++ if(ts->thread == NULL) ++ { ++ dev_err(&pdev->dev, "Failed to create kernel thread"); ++ iounmap(ts->ts_base); ++ input_unregister_device(input_dev); ++ kzfree(ts); + } + -+ devm_kfree(rtd->dev, rats_no_pll); - return 0; - } - --static int snd_rpi_hifiberry_dacplus_hw_params(struct snd_pcm_substream *substream, -- struct snd_pcm_hw_params *params) -+static int snd_rpi_hifiberry_dacplus_set_bclk_ratio_pro( -+ struct snd_soc_dai *cpu_dai, struct snd_pcm_hw_params *params) - { -+ int bratio = snd_pcm_format_physical_width(params_format(params)) -+ * params_channels(params); -+ return snd_soc_dai_set_bclk_ratio(cpu_dai, bratio); ++ return 0; +} + -+static int snd_rpi_hifiberry_dacplus_hw_params( -+ struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params) -+{ -+ int ret; - struct snd_soc_pcm_runtime *rtd = substream->private_data; - struct snd_soc_dai *cpu_dai = rtd->cpu_dai; -- return snd_soc_dai_set_bclk_ratio(cpu_dai, 64); -+ -+ if (snd_rpi_hifiberry_is_dacpro) { -+ struct snd_soc_codec *codec = rtd->codec; -+ -+ snd_rpi_hifiberry_dacplus_set_sclk(codec, -+ params_rate(params)); -+ -+ ret = snd_rpi_hifiberry_dacplus_set_bclk_ratio_pro(cpu_dai, -+ params); -+ if (!ret) -+ ret = snd_rpi_hifiberry_dacplus_update_rate_den( -+ substream, params); -+ } else { -+ ret = snd_soc_dai_set_bclk_ratio(cpu_dai, 64); -+ } -+ return ret; - } - --static int snd_rpi_hifiberry_dacplus_startup(struct snd_pcm_substream *substream) { -+static int snd_rpi_hifiberry_dacplus_startup( -+ struct snd_pcm_substream *substream) ++static int ft5406_remove(struct platform_device *pdev) +{ - struct snd_soc_pcm_runtime *rtd = substream->private_data; - struct snd_soc_codec *codec = rtd->codec; -- snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x08,0x08); ++ struct ft5406 *ts = (struct ft5406 *) platform_get_drvdata(pdev); ++ ++ dev_info(&pdev->dev, "Removing rpi-ft5406\n"); ++ ++ kthread_stop(ts->thread); ++ iounmap(ts->ts_base); ++ input_unregister_device(ts->input_dev); ++ kzfree(ts); ++ ++ return 0; ++} + -+ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x08, 0x08); - return 0; - } - --static void snd_rpi_hifiberry_dacplus_shutdown(struct snd_pcm_substream *substream) { -+static void snd_rpi_hifiberry_dacplus_shutdown( -+ struct snd_pcm_substream *substream) -+{ - struct snd_soc_pcm_runtime *rtd = substream->private_data; - struct snd_soc_codec *codec = rtd->codec; -- snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x08,0x00); ++static const struct of_device_id ft5406_match[] = { ++ { .compatible = "rpi,rpi-ft5406", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, ft5406_match); + -+ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x08, 0x00); - } - - /* machine stream operations */ -@@ -90,19 +285,20 @@ static int snd_rpi_hifiberry_dacplus_probe(struct platform_device *pdev) - int ret = 0; - - snd_rpi_hifiberry_dacplus.dev = &pdev->dev; -- - if (pdev->dev.of_node) { -- struct device_node *i2s_node; -- struct snd_soc_dai_link *dai = &snd_rpi_hifiberry_dacplus_dai[0]; -- i2s_node = of_parse_phandle(pdev->dev.of_node, -- "i2s-controller", 0); -- -- if (i2s_node) { -- dai->cpu_dai_name = NULL; -- dai->cpu_of_node = i2s_node; -- dai->platform_name = NULL; -- dai->platform_of_node = i2s_node; -- } -+ struct device_node *i2s_node; -+ struct snd_soc_dai_link *dai; ++static struct platform_driver ft5406_driver = { ++ .driver = { ++ .name = "rpi-ft5406", ++ .owner = THIS_MODULE, ++ .of_match_table = ft5406_match, ++ }, ++ .probe = ft5406_probe, ++ .remove = ft5406_remove, ++}; + -+ dai = &snd_rpi_hifiberry_dacplus_dai[0]; -+ i2s_node = of_parse_phandle(pdev->dev.of_node, -+ "i2s-controller", 0); ++module_platform_driver(ft5406_driver); + -+ if (i2s_node) { -+ dai->cpu_dai_name = NULL; -+ dai->cpu_of_node = i2s_node; -+ dai->platform_name = NULL; -+ dai->platform_of_node = i2s_node; -+ } - } - - ret = snd_soc_register_card(&snd_rpi_hifiberry_dacplus); -diff --git a/sound/soc/codecs/pcm512x.c b/sound/soc/codecs/pcm512x.c -index 047c489..090fe0ee 100644 ---- a/sound/soc/codecs/pcm512x.c -+++ b/sound/soc/codecs/pcm512x.c -@@ -854,7 +854,8 @@ static int pcm512x_set_dividers(struct snd_soc_dai *dai, - int fssp; - int gpio; - -- lrclk_div = snd_soc_params_to_frame_size(params); -+ lrclk_div = snd_pcm_format_physical_width(params_format(params)) -+ * params_channels(params); - if (lrclk_div == 0) { - dev_err(dev, "No LRCLK?\n"); - return -EINVAL; ++MODULE_AUTHOR("Gordon Hollingworth"); ++MODULE_DESCRIPTION("Touchscreen driver for memory based FT5406"); ++MODULE_LICENSE("GPL"); -From 14b6c7013e62b3917ce73841dc8e379d011d37a5 Mon Sep 17 00:00:00 2001 +From d3b07af9751b03a6d60b5bcd95df067add313b78 Mon Sep 17 00:00:00 2001 From: Phil Elwell <phil@raspberrypi.org> -Date: Mon, 5 Oct 2015 10:47:45 +0100 -Subject: [PATCH 111/170] BCM270X_DT: Add at86rf233 overlay +Date: Mon, 13 Oct 2014 11:47:53 +0100 +Subject: [PATCH 079/112] Improve __copy_to_user and __copy_from_user + performance + +Provide a __copy_from_user that uses memcpy. On BCM2708, use +optimised memcpy/memmove/memcmp/memset implementations. + +arch/arm: Add mmiocpy/set aliases for memcpy/set + +See: https://github.com/raspberrypi/linux/issues/1082 + +copy_from_user: CPU_SW_DOMAIN_PAN compatibility -Add an overlay to support the Atmel AT86RF233 WPAN transceiver on spi0.0. +The downstream copy_from_user acceleration must also play nice with +CONFIG_CPU_SW_DOMAIN_PAN. -See: https://github.com/raspberrypi/linux/issues/1151 +See: https://github.com/raspberrypi/linux/issues/1381 + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> --- - arch/arm/boot/dts/overlays/Makefile | 1 + - arch/arm/boot/dts/overlays/README | 21 +++++++-- - arch/arm/boot/dts/overlays/at86rf233-overlay.dts | 54 ++++++++++++++++++++++++ - 3 files changed, 72 insertions(+), 4 deletions(-) - create mode 100644 arch/arm/boot/dts/overlays/at86rf233-overlay.dts + arch/arm/include/asm/string.h | 5 + + arch/arm/include/asm/uaccess.h | 3 + + arch/arm/lib/Makefile | 15 +- + arch/arm/lib/arm-mem.h | 159 ++++++++++++ + arch/arm/lib/copy_from_user.S | 4 +- + arch/arm/lib/exports_rpi.c | 37 +++ + arch/arm/lib/memcmp_rpi.S | 285 +++++++++++++++++++++ + arch/arm/lib/memcpy_rpi.S | 61 +++++ + arch/arm/lib/memcpymove.h | 506 +++++++++++++++++++++++++++++++++++++ + arch/arm/lib/memmove_rpi.S | 61 +++++ + arch/arm/lib/memset_rpi.S | 123 +++++++++ + arch/arm/lib/uaccess_with_memcpy.c | 120 ++++++++- + 12 files changed, 1373 insertions(+), 6 deletions(-) + create mode 100644 arch/arm/lib/arm-mem.h + create mode 100644 arch/arm/lib/exports_rpi.c + create mode 100644 arch/arm/lib/memcmp_rpi.S + create mode 100644 arch/arm/lib/memcpy_rpi.S + create mode 100644 arch/arm/lib/memcpymove.h + create mode 100644 arch/arm/lib/memmove_rpi.S + create mode 100644 arch/arm/lib/memset_rpi.S -diff --git a/arch/arm/boot/dts/overlays/Makefile b/arch/arm/boot/dts/overlays/Makefile -index 7d747bc..be9dead 100644 ---- a/arch/arm/boot/dts/overlays/Makefile -+++ b/arch/arm/boot/dts/overlays/Makefile -@@ -13,6 +13,7 @@ ifeq ($(CONFIG_ARCH_BCM2835),y) - endif +diff --git a/arch/arm/include/asm/string.h b/arch/arm/include/asm/string.h +index cf4f3aa..9fe7780 100644 +--- a/arch/arm/include/asm/string.h ++++ b/arch/arm/include/asm/string.h +@@ -24,6 +24,11 @@ extern void * memchr(const void *, int, __kernel_size_t); + #define __HAVE_ARCH_MEMSET + extern void * memset(void *, int, __kernel_size_t); - dtb-$(RPI_DT_OVERLAYS) += ads7846-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += at86rf233-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += bmp085_i2c-sensor-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += dht11-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += enc28j60-overlay.dtb -diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README -index 950b6c5..04e55ce 100644 ---- a/arch/arm/boot/dts/overlays/README -+++ b/arch/arm/boot/dts/overlays/README -@@ -69,13 +69,14 @@ DT parameters: ++#ifdef CONFIG_MACH_BCM2708 ++#define __HAVE_ARCH_MEMCMP ++extern int memcmp(const void *, const void *, size_t); ++#endif ++ + extern void __memzero(void *ptr, __kernel_size_t n); - Parameters always have default values, although in some cases (e.g. "w1-gpio") - it is necessary to provided multiple overlays in order to get the desired --behaviour. See the list of overlays below for a description of the parameters and their defaults. -+behaviour. See the list of overlays below for a description of the parameters -+and their defaults. + #define memset(p,v,n) \ +diff --git a/arch/arm/include/asm/uaccess.h b/arch/arm/include/asm/uaccess.h +index 35c9db8..52d3401 100644 +--- a/arch/arm/include/asm/uaccess.h ++++ b/arch/arm/include/asm/uaccess.h +@@ -493,6 +493,9 @@ do { \ + extern unsigned long __must_check + arm_copy_from_user(void *to, const void __user *from, unsigned long n); - The Overlay and Parameter Reference - =================================== ++extern unsigned long __must_check ++__copy_from_user_std(void *to, const void __user *from, unsigned long n); ++ + static inline unsigned long __must_check + __copy_from_user(void *to, const void __user *from, unsigned long n) + { +diff --git a/arch/arm/lib/Makefile b/arch/arm/lib/Makefile +index d8a7807..9c7dc5b 100644 +--- a/arch/arm/lib/Makefile ++++ b/arch/arm/lib/Makefile +@@ -6,9 +6,8 @@ --N.B. When editing this file, please preserve the indentation levels to make it simple to parse --programmatically. NO HARD TABS. -+N.B. When editing this file, please preserve the indentation levels to make it -+simple to parse programmatically. NO HARD TABS. + lib-y := backtrace.o changebit.o csumipv6.o csumpartial.o \ + csumpartialcopy.o csumpartialcopyuser.o clearbit.o \ +- delay.o delay-loop.o findbit.o memchr.o memcpy.o \ +- memmove.o memset.o memzero.o setbit.o \ +- strchr.o strrchr.o \ ++ delay.o delay-loop.o findbit.o memchr.o memzero.o \ ++ setbit.o strchr.o strrchr.o \ + testchangebit.o testclearbit.o testsetbit.o \ + ashldi3.o ashrdi3.o lshrdi3.o muldi3.o \ + ucmpdi2.o lib1funcs.o div64.o \ +@@ -18,6 +17,16 @@ lib-y := backtrace.o changebit.o csumipv6.o csumpartial.o \ + mmu-y := clear_user.o copy_page.o getuser.o putuser.o \ + copy_from_user.o copy_to_user.o + ++# Choose optimised implementations for Raspberry Pi ++ifeq ($(CONFIG_MACH_BCM2708),y) ++ CFLAGS_uaccess_with_memcpy.o += -DCOPY_FROM_USER_THRESHOLD=1600 ++ CFLAGS_uaccess_with_memcpy.o += -DCOPY_TO_USER_THRESHOLD=672 ++ obj-$(CONFIG_MODULES) += exports_rpi.o ++ lib-y += memcpy_rpi.o memmove_rpi.o memset_rpi.o memcmp_rpi.o ++else ++ lib-y += memcpy.o memmove.o memset.o ++endif ++ + # using lib_ here won't override already available weak symbols + obj-$(CONFIG_UACCESS_WITH_MEMCPY) += uaccess_with_memcpy.o + +diff --git a/arch/arm/lib/arm-mem.h b/arch/arm/lib/arm-mem.h +new file mode 100644 +index 0000000..5d4bda1 +--- /dev/null ++++ b/arch/arm/lib/arm-mem.h +@@ -0,0 +1,159 @@ ++/* ++Copyright (c) 2013, Raspberry Pi Foundation ++Copyright (c) 2013, RISC OS Open Ltd ++All rights reserved. ++ ++Redistribution and use in source and binary forms, with or without ++modification, are permitted provided that the following conditions are met: ++ * Redistributions of source code must retain the above copyright ++ notice, this list of conditions and the following disclaimer. ++ * 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. ++ * Neither the name of the copyright holder nor the ++ names of its contributors may be used to endorse or promote products ++ derived from this software without specific prior written permission. ++ ++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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. ++*/ ++ ++.macro myfunc fname ++ .func fname ++ .global fname ++fname: ++.endm ++ ++.macro preload_leading_step1 backwards, ptr, base ++/* If the destination is already 16-byte aligned, then we need to preload ++ * between 0 and prefetch_distance (inclusive) cache lines ahead so there ++ * are no gaps when the inner loop starts. ++ */ ++ .if backwards ++ sub ptr, base, #1 ++ bic ptr, ptr, #31 ++ .else ++ bic ptr, base, #31 ++ .endif ++ .set OFFSET, 0 ++ .rept prefetch_distance+1 ++ pld [ptr, #OFFSET] ++ .if backwards ++ .set OFFSET, OFFSET-32 ++ .else ++ .set OFFSET, OFFSET+32 ++ .endif ++ .endr ++.endm ++ ++.macro preload_leading_step2 backwards, ptr, base, leading_bytes, tmp ++/* However, if the destination is not 16-byte aligned, we may need to ++ * preload one more cache line than that. The question we need to ask is: ++ * are the leading bytes more than the amount by which the source ++ * pointer will be rounded down for preloading, and if so, by how many ++ * cache lines? ++ */ ++ .if backwards ++/* Here we compare against how many bytes we are into the ++ * cache line, counting down from the highest such address. ++ * Effectively, we want to calculate ++ * leading_bytes = dst&15 ++ * cacheline_offset = 31-((src-leading_bytes-1)&31) ++ * extra_needed = leading_bytes - cacheline_offset ++ * and test if extra_needed is <= 0, or rearranging: ++ * leading_bytes + (src-leading_bytes-1)&31 <= 31 ++ */ ++ mov tmp, base, lsl #32-5 ++ sbc tmp, tmp, leading_bytes, lsl #32-5 ++ adds tmp, tmp, leading_bytes, lsl #32-5 ++ bcc 61f ++ pld [ptr, #-32*(prefetch_distance+1)] ++ .else ++/* Effectively, we want to calculate ++ * leading_bytes = (-dst)&15 ++ * cacheline_offset = (src+leading_bytes)&31 ++ * extra_needed = leading_bytes - cacheline_offset ++ * and test if extra_needed is <= 0. ++ */ ++ mov tmp, base, lsl #32-5 ++ add tmp, tmp, leading_bytes, lsl #32-5 ++ rsbs tmp, tmp, leading_bytes, lsl #32-5 ++ bls 61f ++ pld [ptr, #32*(prefetch_distance+1)] ++ .endif ++61: ++.endm ++ ++.macro preload_trailing backwards, base, remain, tmp ++ /* We need either 0, 1 or 2 extra preloads */ ++ .if backwards ++ rsb tmp, base, #0 ++ mov tmp, tmp, lsl #32-5 ++ .else ++ mov tmp, base, lsl #32-5 ++ .endif ++ adds tmp, tmp, remain, lsl #32-5 ++ adceqs tmp, tmp, #0 ++ /* The instruction above has two effects: ensures Z is only ++ * set if C was clear (so Z indicates that both shifted quantities ++ * were 0), and clears C if Z was set (so C indicates that the sum ++ * of the shifted quantities was greater and not equal to 32) */ ++ beq 82f ++ .if backwards ++ sub tmp, base, #1 ++ bic tmp, tmp, #31 ++ .else ++ bic tmp, base, #31 ++ .endif ++ bcc 81f ++ .if backwards ++ pld [tmp, #-32*(prefetch_distance+1)] ++81: ++ pld [tmp, #-32*prefetch_distance] ++ .else ++ pld [tmp, #32*(prefetch_distance+2)] ++81: ++ pld [tmp, #32*(prefetch_distance+1)] ++ .endif ++82: ++.endm ++ ++.macro preload_all backwards, narrow_case, shift, base, remain, tmp0, tmp1 ++ .if backwards ++ sub tmp0, base, #1 ++ bic tmp0, tmp0, #31 ++ pld [tmp0] ++ sub tmp1, base, remain, lsl #shift ++ .else ++ bic tmp0, base, #31 ++ pld [tmp0] ++ add tmp1, base, remain, lsl #shift ++ sub tmp1, tmp1, #1 ++ .endif ++ bic tmp1, tmp1, #31 ++ cmp tmp1, tmp0 ++ beq 92f ++ .if narrow_case ++ /* In this case, all the data fits in either 1 or 2 cache lines */ ++ pld [tmp1] ++ .else ++91: ++ .if backwards ++ sub tmp0, tmp0, #32 ++ .else ++ add tmp0, tmp0, #32 ++ .endif ++ cmp tmp0, tmp1 ++ pld [tmp0] ++ bne 91b ++ .endif ++92: ++.endm +diff --git a/arch/arm/lib/copy_from_user.S b/arch/arm/lib/copy_from_user.S +index 1512beb..3da60dd 100644 +--- a/arch/arm/lib/copy_from_user.S ++++ b/arch/arm/lib/copy_from_user.S +@@ -89,11 +89,13 @@ + .text - Name: <The base DTB> -@@ -149,7 +150,7 @@ Name: ads7846 - Info: ADS7846 Touch controller - Load: dtoverlay=ads7846,<param>=<val> - Params: cs SPI bus Chip Select (default 1) -- speed SPI bus speed (default 2Mhz, max 3.25MHz) -+ speed SPI bus speed (default 2MHz, max 3.25MHz) - penirq GPIO used for PENIRQ. REQUIRED - penirq_pull Set GPIO pull (default 0=none, 2=pullup) - swapxy Swap x and y axis -@@ -170,6 +171,18 @@ Params: cs SPI bus Chip Select (default 1) - www.kernel.org/doc/Documentation/devicetree/bindings/input/ads7846.txt +-ENTRY(arm_copy_from_user) ++ENTRY(__copy_from_user_std) ++WEAK(arm_copy_from_user) + #include "copy_template.S" -+Name: at86rf233 -+Info: Configures the Atmel AT86RF233 802.15.4 low-power WPAN transceiver, -+ connected to spi0.0 -+Load: dtoverlay=at86rf233,<param>=<val> -+Params: interrupt GPIO used for INT (default 23) -+ reset GPIO used for Reset (default 24) -+ sleep GPIO used for Sleep (default 25) -+ speed SPI bus speed in Hz (default 6000000) -+ trim Fine tuning of the internal capacitance -+ arrays (0=+0pF, 15=+4.5pF, default 15) + ENDPROC(arm_copy_from_user) ++ENDPROC(__copy_from_user_std) + + .pushsection .fixup,"ax" + .align 0 +diff --git a/arch/arm/lib/exports_rpi.c b/arch/arm/lib/exports_rpi.c +new file mode 100644 +index 0000000..1f82604 +--- /dev/null ++++ b/arch/arm/lib/exports_rpi.c +@@ -0,0 +1,37 @@ ++/** ++ * Copyright (c) 2014, Raspberry Pi (Trading) Ltd. ++ * ++ * 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, ++ * without modification. ++ * 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. ++ * 3. The names of the above-listed copyright holders may not be used ++ * to endorse or promote products derived from this software without ++ * specific prior written permission. ++ * ++ * ALTERNATIVELY, this software may be distributed under the terms of the ++ * GNU General Public License ("GPL") version 2, as published by the Free ++ * Software Foundation. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER OR ++ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ++ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, ++ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR ++ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF ++ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING ++ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ */ + ++#include <linux/kernel.h> ++#include <linux/module.h> + - Name: bmp085_i2c-sensor - Info: Configures the BMP085/BMP180 digital barometric pressure and temperature - sensors from Bosch Sensortec -diff --git a/arch/arm/boot/dts/overlays/at86rf233-overlay.dts b/arch/arm/boot/dts/overlays/at86rf233-overlay.dts ++EXPORT_SYMBOL(memcmp); +diff --git a/arch/arm/lib/memcmp_rpi.S b/arch/arm/lib/memcmp_rpi.S new file mode 100644 -index 0000000..0460269 +index 0000000..bf6e4ed --- /dev/null -+++ b/arch/arm/boot/dts/overlays/at86rf233-overlay.dts -@@ -0,0 +1,54 @@ -+/dts-v1/; -+/plugin/; ++++ b/arch/arm/lib/memcmp_rpi.S +@@ -0,0 +1,285 @@ ++/* ++Copyright (c) 2013, Raspberry Pi Foundation ++Copyright (c) 2013, RISC OS Open Ltd ++All rights reserved. + -+/* Overlay for Atmel AT86RF233 IEEE 802.15.4 WPAN transceiver on spi0.0 */ ++Redistribution and use in source and binary forms, with or without ++modification, are permitted provided that the following conditions are met: ++ * Redistributions of source code must retain the above copyright ++ notice, this list of conditions and the following disclaimer. ++ * 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. ++ * Neither the name of the copyright holder nor the ++ names of its contributors may be used to endorse or promote products ++ derived from this software without specific prior written permission. + -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2836", "brcm,bcm2708", "brcm,bcm2709"; ++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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. ++*/ + -+ fragment@0 { -+ target = <&spi0>; -+ __overlay__ { -+ #address-cells = <1>; -+ #size-cells = <0>; ++#include <linux/linkage.h> ++#include "arm-mem.h" + -+ status = "okay"; ++/* Prevent the stack from becoming executable */ ++#if defined(__linux__) && defined(__ELF__) ++.section .note.GNU-stack,"",%progbits ++#endif + -+ spidev@0{ -+ status = "disabled"; -+ }; ++ .text ++ .arch armv6 ++ .object_arch armv4 ++ .arm ++ .altmacro ++ .p2align 2 + -+ lowpan0: at86rf233@0 { -+ compatible = "atmel,at86rf233"; -+ reg = <0>; -+ interrupt-parent = <&gpio>; -+ interrupts = <23 4>; /* active high */ -+ reset-gpio = <&gpio 24 1>; -+ sleep-gpio = <&gpio 25 1>; -+ spi-max-frequency = <6000000>; -+ xtal-trim = /bits/ 8 <0xf>; -+ }; -+ }; -+ }; ++.macro memcmp_process_head unaligned ++ .if unaligned ++ ldr DAT0, [S_1], #4 ++ ldr DAT1, [S_1], #4 ++ ldr DAT2, [S_1], #4 ++ ldr DAT3, [S_1], #4 ++ .else ++ ldmia S_1!, {DAT0, DAT1, DAT2, DAT3} ++ .endif ++ ldmia S_2!, {DAT4, DAT5, DAT6, DAT7} ++.endm + -+ fragment@1 { -+ target = <&gpio>; -+ __overlay__ { -+ lowpan0_pins: lowpan0_pins { -+ brcm,pins = <23 24 25>; -+ brcm,function = <0 1 1>; /* in out out */ -+ }; -+ }; -+ }; ++.macro memcmp_process_tail ++ cmp DAT0, DAT4 ++ cmpeq DAT1, DAT5 ++ cmpeq DAT2, DAT6 ++ cmpeq DAT3, DAT7 ++ bne 200f ++.endm + -+ __overrides__ { -+ interrupt = <&lowpan0>, "interrupts:0", -+ <&lowpan0_pins>, "brcm,pins:0"; -+ reset = <&lowpan0>, "reset-gpio:4", -+ <&lowpan0_pins>, "brcm,pins:4"; -+ sleep = <&lowpan0>, "sleep-gpio:4", -+ <&lowpan0_pins>, "brcm,pins:8"; -+ speed = <&lowpan0>, "spi-max-frequency:0"; -+ trim = <&lowpan0>, "xtal-trim.0"; -+ }; -+}; - -From d33b3717e86cd6aa28c58d465a22e6c11a66bc13 Mon Sep 17 00:00:00 2001 -From: Eric Anholt <eric@anholt.net> -Date: Thu, 18 Dec 2014 16:07:15 -0800 -Subject: [PATCH 112/170] mm: Remove the PFN busy warning - -See commit dae803e165a11bc88ca8dbc07a11077caf97bbcb -- the warning is -expected sometimes when using CMA. However, that commit still spams -my kernel log with these warnings. - -Signed-off-by: Eric Anholt <eric@anholt.net> ---- - mm/page_alloc.c | 2 -- - 1 file changed, 2 deletions(-) - -diff --git a/mm/page_alloc.c b/mm/page_alloc.c -index 9d666df..b682acc 100644 ---- a/mm/page_alloc.c -+++ b/mm/page_alloc.c -@@ -6760,8 +6760,6 @@ int alloc_contig_range(unsigned long start, unsigned long end, - - /* Make sure the range is really isolated. */ - if (test_pages_isolated(outer_start, end, false)) { -- pr_info("%s: [%lx, %lx) PFNs busy\n", -- __func__, outer_start, end); - ret = -EBUSY; - goto done; - } - -From a71d6ebfcbc401e520fa4a5aa185d027dfbe5ce1 Mon Sep 17 00:00:00 2001 -From: Eric Anholt <eric@anholt.net> -Date: Wed, 19 Nov 2014 12:06:38 -0800 -Subject: [PATCH 113/170] drm: Put an optional field in the driver struct for - GEM obj struct size. - -This allows a driver to derive from the CMA object without copying all -of the code. - -Signed-off-by: Eric Anholt <eric@anholt.net> ---- - drivers/gpu/drm/drm_gem_cma_helper.c | 5 ++++- - include/drm/drmP.h | 1 + - 2 files changed, 5 insertions(+), 1 deletion(-) - -diff --git a/drivers/gpu/drm/drm_gem_cma_helper.c b/drivers/gpu/drm/drm_gem_cma_helper.c -index e109b49..1c25500 100644 ---- a/drivers/gpu/drm/drm_gem_cma_helper.c -+++ b/drivers/gpu/drm/drm_gem_cma_helper.c -@@ -58,8 +58,11 @@ __drm_gem_cma_create(struct drm_device *drm, size_t size) - struct drm_gem_cma_object *cma_obj; - struct drm_gem_object *gem_obj; - int ret; -+ size_t obj_size = (drm->driver->gem_obj_size ? -+ drm->driver->gem_obj_size : -+ sizeof(*cma_obj)); - -- cma_obj = kzalloc(sizeof(*cma_obj), GFP_KERNEL); -+ cma_obj = kzalloc(obj_size, GFP_KERNEL); - if (!cma_obj) - return ERR_PTR(-ENOMEM); - -diff --git a/include/drm/drmP.h b/include/drm/drmP.h -index 0a271ca..54f5469 100644 ---- a/include/drm/drmP.h -+++ b/include/drm/drmP.h -@@ -639,6 +639,7 @@ struct drm_driver { - - u32 driver_features; - int dev_priv_size; -+ size_t gem_obj_size; - const struct drm_ioctl_desc *ioctls; - int num_ioctls; - const struct file_operations *fops; - -From 1c343ed1f86866d2625518774536bbef77f7a20a Mon Sep 17 00:00:00 2001 -From: Eric Anholt <eric@anholt.net> -Date: Fri, 30 Oct 2015 10:09:02 -0700 -Subject: [PATCH 114/170] drm/vc4: Add an interface for capturing the GPU state - after a hang. - -This can be parsed with vc4-gpu-tools tools for trying to figure out -what was going on. - -Signed-off-by: Eric Anholt <eric@anholt.net> ---- - drivers/gpu/drm/vc4/vc4_bo.c | 4 +- - drivers/gpu/drm/vc4/vc4_drv.c | 1 + - drivers/gpu/drm/vc4/vc4_drv.h | 4 + - drivers/gpu/drm/vc4/vc4_gem.c | 185 ++++++++++++++++++++++++++++++++++++++++++ - include/uapi/drm/vc4_drm.h | 45 ++++++++++ - 5 files changed, 237 insertions(+), 2 deletions(-) - -diff --git a/drivers/gpu/drm/vc4/vc4_bo.c b/drivers/gpu/drm/vc4/vc4_bo.c -index acd360c..58dcbae 100644 ---- a/drivers/gpu/drm/vc4/vc4_bo.c -+++ b/drivers/gpu/drm/vc4/vc4_bo.c -@@ -415,8 +415,8 @@ int vc4_mmap(struct file *filp, struct vm_area_struct *vma) - gem_obj = vma->vm_private_data; - bo = to_vc4_bo(gem_obj); - -- if (bo->validated_shader) { -- DRM_ERROR("mmaping of shader BOs not allowed.\n"); -+ if (bo->validated_shader && (vma->vm_flags & VM_WRITE)) { -+ DRM_ERROR("mmaping of shader BOs for writing not allowed.\n"); - return -EINVAL; - } - -diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c -index e2a2be2..e8192b4 100644 ---- a/drivers/gpu/drm/vc4/vc4_drv.c -+++ b/drivers/gpu/drm/vc4/vc4_drv.c -@@ -81,6 +81,7 @@ static const struct drm_ioctl_desc vc4_drm_ioctls[] = { - DRM_IOCTL_DEF_DRV(VC4_CREATE_BO, vc4_create_bo_ioctl, 0), - DRM_IOCTL_DEF_DRV(VC4_MMAP_BO, vc4_mmap_bo_ioctl, 0), - DRM_IOCTL_DEF_DRV(VC4_CREATE_SHADER_BO, vc4_create_shader_bo_ioctl, 0), -+ DRM_IOCTL_DEF_DRV(VC4_GET_HANG_STATE, vc4_get_hang_state_ioctl, DRM_ROOT_ONLY), - }; - - static struct drm_driver vc4_drm_driver = { -diff --git a/drivers/gpu/drm/vc4/vc4_drv.h b/drivers/gpu/drm/vc4/vc4_drv.h -index c079b82..24845c1 100644 ---- a/drivers/gpu/drm/vc4/vc4_drv.h -+++ b/drivers/gpu/drm/vc4/vc4_drv.h -@@ -20,6 +20,8 @@ struct vc4_dev { - struct drm_fbdev_cma *fbdev; - struct rpi_firmware *firmware; - -+ struct vc4_hang_state *hang_state; -+ - /* The kernel-space BO cache. Tracks buffers that have been - * unreferenced by all other users (refcounts of 0!) but not - * yet freed, so we can do cheap allocations. -@@ -366,6 +368,8 @@ int vc4_create_shader_bo_ioctl(struct drm_device *dev, void *data, - struct drm_file *file_priv); - int vc4_mmap_bo_ioctl(struct drm_device *dev, void *data, - struct drm_file *file_priv); -+int vc4_get_hang_state_ioctl(struct drm_device *dev, void *data, -+ struct drm_file *file_priv); - int vc4_mmap(struct file *filp, struct vm_area_struct *vma); - int vc4_prime_mmap(struct drm_gem_object *obj, struct vm_area_struct *vma); - void *vc4_prime_vmap(struct drm_gem_object *obj); -diff --git a/drivers/gpu/drm/vc4/vc4_gem.c b/drivers/gpu/drm/vc4/vc4_gem.c -index 0cea723..d90c664 100644 ---- a/drivers/gpu/drm/vc4/vc4_gem.c -+++ b/drivers/gpu/drm/vc4/vc4_gem.c -@@ -40,6 +40,186 @@ vc4_queue_hangcheck(struct drm_device *dev) - round_jiffies_up(jiffies + msecs_to_jiffies(100))); - } - -+struct vc4_hang_state { -+ struct drm_vc4_get_hang_state user_state; ++.macro memcmp_leading_31bytes ++ movs DAT0, OFF, lsl #31 ++ ldrmib DAT0, [S_1], #1 ++ ldrcsh DAT1, [S_1], #2 ++ ldrmib DAT4, [S_2], #1 ++ ldrcsh DAT5, [S_2], #2 ++ movpl DAT0, #0 ++ movcc DAT1, #0 ++ movpl DAT4, #0 ++ movcc DAT5, #0 ++ submi N, N, #1 ++ subcs N, N, #2 ++ cmp DAT0, DAT4 ++ cmpeq DAT1, DAT5 ++ bne 200f ++ movs DAT0, OFF, lsl #29 ++ ldrmi DAT0, [S_1], #4 ++ ldrcs DAT1, [S_1], #4 ++ ldrcs DAT2, [S_1], #4 ++ ldrmi DAT4, [S_2], #4 ++ ldmcsia S_2!, {DAT5, DAT6} ++ movpl DAT0, #0 ++ movcc DAT1, #0 ++ movcc DAT2, #0 ++ movpl DAT4, #0 ++ movcc DAT5, #0 ++ movcc DAT6, #0 ++ submi N, N, #4 ++ subcs N, N, #8 ++ cmp DAT0, DAT4 ++ cmpeq DAT1, DAT5 ++ cmpeq DAT2, DAT6 ++ bne 200f ++ tst OFF, #16 ++ beq 105f ++ memcmp_process_head 1 ++ sub N, N, #16 ++ memcmp_process_tail ++105: ++.endm + -+ u32 bo_count; -+ struct drm_gem_object **bo; -+}; ++.macro memcmp_trailing_15bytes unaligned ++ movs N, N, lsl #29 ++ .if unaligned ++ ldrcs DAT0, [S_1], #4 ++ ldrcs DAT1, [S_1], #4 ++ .else ++ ldmcsia S_1!, {DAT0, DAT1} ++ .endif ++ ldrmi DAT2, [S_1], #4 ++ ldmcsia S_2!, {DAT4, DAT5} ++ ldrmi DAT6, [S_2], #4 ++ movcc DAT0, #0 ++ movcc DAT1, #0 ++ movpl DAT2, #0 ++ movcc DAT4, #0 ++ movcc DAT5, #0 ++ movpl DAT6, #0 ++ cmp DAT0, DAT4 ++ cmpeq DAT1, DAT5 ++ cmpeq DAT2, DAT6 ++ bne 200f ++ movs N, N, lsl #2 ++ ldrcsh DAT0, [S_1], #2 ++ ldrmib DAT1, [S_1] ++ ldrcsh DAT4, [S_2], #2 ++ ldrmib DAT5, [S_2] ++ movcc DAT0, #0 ++ movpl DAT1, #0 ++ movcc DAT4, #0 ++ movpl DAT5, #0 ++ cmp DAT0, DAT4 ++ cmpeq DAT1, DAT5 ++ bne 200f ++.endm ++ ++.macro memcmp_long_inner_loop unaligned ++110: ++ memcmp_process_head unaligned ++ pld [S_2, #prefetch_distance*32 + 16] ++ memcmp_process_tail ++ memcmp_process_head unaligned ++ pld [S_1, OFF] ++ memcmp_process_tail ++ subs N, N, #32 ++ bhs 110b ++ /* Just before the final (prefetch_distance+1) 32-byte blocks, ++ * deal with final preloads */ ++ preload_trailing 0, S_1, N, DAT0 ++ preload_trailing 0, S_2, N, DAT0 ++ add N, N, #(prefetch_distance+2)*32 - 16 ++120: ++ memcmp_process_head unaligned ++ memcmp_process_tail ++ subs N, N, #16 ++ bhs 120b ++ /* Trailing words and bytes */ ++ tst N, #15 ++ beq 199f ++ memcmp_trailing_15bytes unaligned ++199: /* Reached end without detecting a difference */ ++ mov a1, #0 ++ setend le ++ pop {DAT1-DAT6, pc} ++.endm + -+static void -+vc4_free_hang_state(struct drm_device *dev, struct vc4_hang_state *state) -+{ -+ unsigned int i; ++.macro memcmp_short_inner_loop unaligned ++ subs N, N, #16 /* simplifies inner loop termination */ ++ blo 122f ++120: ++ memcmp_process_head unaligned ++ memcmp_process_tail ++ subs N, N, #16 ++ bhs 120b ++122: /* Trailing words and bytes */ ++ tst N, #15 ++ beq 199f ++ memcmp_trailing_15bytes unaligned ++199: /* Reached end without detecting a difference */ ++ mov a1, #0 ++ setend le ++ pop {DAT1-DAT6, pc} ++.endm + -+ mutex_lock(&dev->struct_mutex); -+ for (i = 0; i < state->user_state.bo_count; i++) { -+ drm_gem_object_unreference(state->bo[i]); -+ } -+ mutex_unlock(&dev->struct_mutex); ++/* ++ * int memcmp(const void *s1, const void *s2, size_t n); ++ * On entry: ++ * a1 = pointer to buffer 1 ++ * a2 = pointer to buffer 2 ++ * a3 = number of bytes to compare (as unsigned chars) ++ * On exit: ++ * a1 = >0/=0/<0 if s1 >/=/< s2 ++ */ + -+ kfree(state); -+} ++.set prefetch_distance, 2 + -+int -+vc4_get_hang_state_ioctl(struct drm_device *dev, void *data, -+ struct drm_file *file_priv) -+{ -+ struct drm_vc4_get_hang_state *get_state = data; -+ struct drm_vc4_get_hang_state_bo *bo_state; -+ struct vc4_hang_state *kernel_state; -+ struct drm_vc4_get_hang_state *state; -+ struct vc4_dev *vc4 = to_vc4_dev(dev); -+ unsigned long irqflags; -+ u32 i; -+ int ret; ++ENTRY(memcmp) ++ S_1 .req a1 ++ S_2 .req a2 ++ N .req a3 ++ DAT0 .req a4 ++ DAT1 .req v1 ++ DAT2 .req v2 ++ DAT3 .req v3 ++ DAT4 .req v4 ++ DAT5 .req v5 ++ DAT6 .req v6 ++ DAT7 .req ip ++ OFF .req lr + -+ spin_lock_irqsave(&vc4->job_lock, irqflags); -+ kernel_state = vc4->hang_state; -+ if (!kernel_state) { -+ spin_unlock_irqrestore(&vc4->job_lock, irqflags); -+ return -ENOENT; -+ } -+ state = &kernel_state->user_state; ++ push {DAT1-DAT6, lr} ++ setend be /* lowest-addressed bytes are most significant */ + -+ /* If the user's array isn't big enough, just return the -+ * required array size. -+ */ -+ if (get_state->bo_count < state->bo_count) { -+ get_state->bo_count = state->bo_count; -+ spin_unlock_irqrestore(&vc4->job_lock, irqflags); -+ return 0; -+ } ++ /* To preload ahead as we go, we need at least (prefetch_distance+2) 32-byte blocks */ ++ cmp N, #(prefetch_distance+3)*32 - 1 ++ blo 170f + -+ vc4->hang_state = NULL; -+ spin_unlock_irqrestore(&vc4->job_lock, irqflags); ++ /* Long case */ ++ /* Adjust N so that the decrement instruction can also test for ++ * inner loop termination. We want it to stop when there are ++ * (prefetch_distance+1) complete blocks to go. */ ++ sub N, N, #(prefetch_distance+2)*32 ++ preload_leading_step1 0, DAT0, S_1 ++ preload_leading_step1 0, DAT1, S_2 ++ tst S_2, #31 ++ beq 154f ++ rsb OFF, S_2, #0 /* no need to AND with 15 here */ ++ preload_leading_step2 0, DAT0, S_1, OFF, DAT2 ++ preload_leading_step2 0, DAT1, S_2, OFF, DAT2 ++ memcmp_leading_31bytes ++154: /* Second source now cacheline (32-byte) aligned; we have at ++ * least one prefetch to go. */ ++ /* Prefetch offset is best selected such that it lies in the ++ * first 8 of each 32 bytes - but it's just as easy to aim for ++ * the first one */ ++ and OFF, S_1, #31 ++ rsb OFF, OFF, #32*prefetch_distance ++ tst S_1, #3 ++ bne 140f ++ memcmp_long_inner_loop 0 ++140: memcmp_long_inner_loop 1 + -+ /* Save the user's BO pointer, so we don't stomp it with the memcpy. */ -+ state->bo = get_state->bo; -+ memcpy(get_state, state, sizeof(*state)); ++170: /* Short case */ ++ teq N, #0 ++ beq 199f ++ preload_all 0, 0, 0, S_1, N, DAT0, DAT1 ++ preload_all 0, 0, 0, S_2, N, DAT0, DAT1 ++ tst S_2, #3 ++ beq 174f ++172: subs N, N, #1 ++ blo 199f ++ ldrb DAT0, [S_1], #1 ++ ldrb DAT4, [S_2], #1 ++ cmp DAT0, DAT4 ++ bne 200f ++ tst S_2, #3 ++ bne 172b ++174: /* Second source now 4-byte aligned; we have 0 or more bytes to go */ ++ tst S_1, #3 ++ bne 140f ++ memcmp_short_inner_loop 0 ++140: memcmp_short_inner_loop 1 + -+ bo_state = kcalloc(state->bo_count, sizeof(*bo_state), GFP_KERNEL); -+ if (!bo_state) { -+ ret = -ENOMEM; -+ goto err_free; -+ } ++200: /* Difference found: determine sign. */ ++ movhi a1, #1 ++ movlo a1, #-1 ++ setend le ++ pop {DAT1-DAT6, pc} + -+ for (i = 0; i < state->bo_count; i++) { -+ struct vc4_bo *vc4_bo = to_vc4_bo(kernel_state->bo[i]); -+ u32 handle; -+ ret = drm_gem_handle_create(file_priv, kernel_state->bo[i], -+ &handle); ++ .unreq S_1 ++ .unreq S_2 ++ .unreq N ++ .unreq DAT0 ++ .unreq DAT1 ++ .unreq DAT2 ++ .unreq DAT3 ++ .unreq DAT4 ++ .unreq DAT5 ++ .unreq DAT6 ++ .unreq DAT7 ++ .unreq OFF ++ENDPROC(memcmp) +diff --git a/arch/arm/lib/memcpy_rpi.S b/arch/arm/lib/memcpy_rpi.S +new file mode 100644 +index 0000000..30f8a90 +--- /dev/null ++++ b/arch/arm/lib/memcpy_rpi.S +@@ -0,0 +1,61 @@ ++/* ++Copyright (c) 2013, Raspberry Pi Foundation ++Copyright (c) 2013, RISC OS Open Ltd ++All rights reserved. + -+ if (ret) { -+ state->bo_count = i - 1; -+ goto err; -+ } -+ bo_state[i].handle = handle; -+ bo_state[i].paddr = vc4_bo->base.paddr; -+ bo_state[i].size = vc4_bo->base.base.size; -+ } ++Redistribution and use in source and binary forms, with or without ++modification, are permitted provided that the following conditions are met: ++ * Redistributions of source code must retain the above copyright ++ notice, this list of conditions and the following disclaimer. ++ * 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. ++ * Neither the name of the copyright holder nor the ++ names of its contributors may be used to endorse or promote products ++ derived from this software without specific prior written permission. + -+ ret = copy_to_user((void __user *)(uintptr_t)get_state->bo, -+ bo_state, -+ state->bo_count * sizeof(*bo_state)); -+ kfree(bo_state); ++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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. ++*/ + -+ err_free: ++#include <linux/linkage.h> ++#include "arm-mem.h" ++#include "memcpymove.h" + -+ vc4_free_hang_state(dev, kernel_state); ++/* Prevent the stack from becoming executable */ ++#if defined(__linux__) && defined(__ELF__) ++.section .note.GNU-stack,"",%progbits ++#endif + -+err: -+ return ret; -+} ++ .text ++ .arch armv6 ++ .object_arch armv4 ++ .arm ++ .altmacro ++ .p2align 2 + -+static void -+vc4_save_hang_state(struct drm_device *dev) -+{ -+ struct vc4_dev *vc4 = to_vc4_dev(dev); -+ struct drm_vc4_get_hang_state *state; -+ struct vc4_hang_state *kernel_state; -+ struct vc4_exec_info *exec; -+ struct vc4_bo *bo; -+ unsigned long irqflags; -+ unsigned int i, unref_list_count; -+ -+ kernel_state = kcalloc(1, sizeof(*state), GFP_KERNEL); -+ if (!kernel_state) -+ return; ++/* ++ * void *memcpy(void * restrict s1, const void * restrict s2, size_t n); ++ * On entry: ++ * a1 = pointer to destination ++ * a2 = pointer to source ++ * a3 = number of bytes to copy ++ * On exit: ++ * a1 preserved ++ */ + -+ state = &kernel_state->user_state; ++.set prefetch_distance, 3 + -+ spin_lock_irqsave(&vc4->job_lock, irqflags); -+ exec = vc4_first_job(vc4); -+ if (!exec) { -+ spin_unlock_irqrestore(&vc4->job_lock, irqflags); -+ return; -+ } ++ENTRY(mmiocpy) ++ENTRY(memcpy) ++ memcpy 0 ++ENDPROC(memcpy) ++ENDPROC(mmiocpy) +diff --git a/arch/arm/lib/memcpymove.h b/arch/arm/lib/memcpymove.h +new file mode 100644 +index 0000000..d8be584 +--- /dev/null ++++ b/arch/arm/lib/memcpymove.h +@@ -0,0 +1,506 @@ ++/* ++Copyright (c) 2013, Raspberry Pi Foundation ++Copyright (c) 2013, RISC OS Open Ltd ++All rights reserved. + -+ unref_list_count = 0; -+ list_for_each_entry(bo, &exec->unref_list, unref_head) -+ unref_list_count++; ++Redistribution and use in source and binary forms, with or without ++modification, are permitted provided that the following conditions are met: ++ * Redistributions of source code must retain the above copyright ++ notice, this list of conditions and the following disclaimer. ++ * 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. ++ * Neither the name of the copyright holder nor the ++ names of its contributors may be used to endorse or promote products ++ derived from this software without specific prior written permission. + -+ state->bo_count = exec->bo_count + unref_list_count; -+ kernel_state->bo = kcalloc(state->bo_count, sizeof(*kernel_state->bo), -+ GFP_ATOMIC); -+ if (!kernel_state->bo) { -+ spin_unlock_irqrestore(&vc4->job_lock, irqflags); -+ return; -+ } ++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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. ++*/ + -+ for (i = 0; i < exec->bo_count; i++) { -+ drm_gem_object_reference(&exec->bo[i].bo->base); -+ kernel_state->bo[i] = &exec->bo[i].bo->base; -+ } ++.macro unaligned_words backwards, align, use_pld, words, r0, r1, r2, r3, r4, r5, r6, r7, r8 ++ .if words == 1 ++ .if backwards ++ mov r1, r0, lsl #32-align*8 ++ ldr r0, [S, #-4]! ++ orr r1, r1, r0, lsr #align*8 ++ str r1, [D, #-4]! ++ .else ++ mov r0, r1, lsr #align*8 ++ ldr r1, [S, #4]! ++ orr r0, r0, r1, lsl #32-align*8 ++ str r0, [D], #4 ++ .endif ++ .elseif words == 2 ++ .if backwards ++ ldr r1, [S, #-4]! ++ mov r2, r0, lsl #32-align*8 ++ ldr r0, [S, #-4]! ++ orr r2, r2, r1, lsr #align*8 ++ mov r1, r1, lsl #32-align*8 ++ orr r1, r1, r0, lsr #align*8 ++ stmdb D!, {r1, r2} ++ .else ++ ldr r1, [S, #4]! ++ mov r0, r2, lsr #align*8 ++ ldr r2, [S, #4]! ++ orr r0, r0, r1, lsl #32-align*8 ++ mov r1, r1, lsr #align*8 ++ orr r1, r1, r2, lsl #32-align*8 ++ stmia D!, {r0, r1} ++ .endif ++ .elseif words == 4 ++ .if backwards ++ ldmdb S!, {r2, r3} ++ mov r4, r0, lsl #32-align*8 ++ ldmdb S!, {r0, r1} ++ orr r4, r4, r3, lsr #align*8 ++ mov r3, r3, lsl #32-align*8 ++ orr r3, r3, r2, lsr #align*8 ++ mov r2, r2, lsl #32-align*8 ++ orr r2, r2, r1, lsr #align*8 ++ mov r1, r1, lsl #32-align*8 ++ orr r1, r1, r0, lsr #align*8 ++ stmdb D!, {r1, r2, r3, r4} ++ .else ++ ldmib S!, {r1, r2} ++ mov r0, r4, lsr #align*8 ++ ldmib S!, {r3, r4} ++ orr r0, r0, r1, lsl #32-align*8 ++ mov r1, r1, lsr #align*8 ++ orr r1, r1, r2, lsl #32-align*8 ++ mov r2, r2, lsr #align*8 ++ orr r2, r2, r3, lsl #32-align*8 ++ mov r3, r3, lsr #align*8 ++ orr r3, r3, r4, lsl #32-align*8 ++ stmia D!, {r0, r1, r2, r3} ++ .endif ++ .elseif words == 8 ++ .if backwards ++ ldmdb S!, {r4, r5, r6, r7} ++ mov r8, r0, lsl #32-align*8 ++ ldmdb S!, {r0, r1, r2, r3} ++ .if use_pld ++ pld [S, OFF] ++ .endif ++ orr r8, r8, r7, lsr #align*8 ++ mov r7, r7, lsl #32-align*8 ++ orr r7, r7, r6, lsr #align*8 ++ mov r6, r6, lsl #32-align*8 ++ orr r6, r6, r5, lsr #align*8 ++ mov r5, r5, lsl #32-align*8 ++ orr r5, r5, r4, lsr #align*8 ++ mov r4, r4, lsl #32-align*8 ++ orr r4, r4, r3, lsr #align*8 ++ mov r3, r3, lsl #32-align*8 ++ orr r3, r3, r2, lsr #align*8 ++ mov r2, r2, lsl #32-align*8 ++ orr r2, r2, r1, lsr #align*8 ++ mov r1, r1, lsl #32-align*8 ++ orr r1, r1, r0, lsr #align*8 ++ stmdb D!, {r5, r6, r7, r8} ++ stmdb D!, {r1, r2, r3, r4} ++ .else ++ ldmib S!, {r1, r2, r3, r4} ++ mov r0, r8, lsr #align*8 ++ ldmib S!, {r5, r6, r7, r8} ++ .if use_pld ++ pld [S, OFF] ++ .endif ++ orr r0, r0, r1, lsl #32-align*8 ++ mov r1, r1, lsr #align*8 ++ orr r1, r1, r2, lsl #32-align*8 ++ mov r2, r2, lsr #align*8 ++ orr r2, r2, r3, lsl #32-align*8 ++ mov r3, r3, lsr #align*8 ++ orr r3, r3, r4, lsl #32-align*8 ++ mov r4, r4, lsr #align*8 ++ orr r4, r4, r5, lsl #32-align*8 ++ mov r5, r5, lsr #align*8 ++ orr r5, r5, r6, lsl #32-align*8 ++ mov r6, r6, lsr #align*8 ++ orr r6, r6, r7, lsl #32-align*8 ++ mov r7, r7, lsr #align*8 ++ orr r7, r7, r8, lsl #32-align*8 ++ stmia D!, {r0, r1, r2, r3} ++ stmia D!, {r4, r5, r6, r7} ++ .endif ++ .endif ++.endm + -+ list_for_each_entry(bo, &exec->unref_list, unref_head) { -+ drm_gem_object_reference(&bo->base.base); -+ kernel_state->bo[i] = &bo->base.base; -+ i++; -+ } ++.macro memcpy_leading_15bytes backwards, align ++ movs DAT1, DAT2, lsl #31 ++ sub N, N, DAT2 ++ .if backwards ++ ldrmib DAT0, [S, #-1]! ++ ldrcsh DAT1, [S, #-2]! ++ strmib DAT0, [D, #-1]! ++ strcsh DAT1, [D, #-2]! ++ .else ++ ldrmib DAT0, [S], #1 ++ ldrcsh DAT1, [S], #2 ++ strmib DAT0, [D], #1 ++ strcsh DAT1, [D], #2 ++ .endif ++ movs DAT1, DAT2, lsl #29 ++ .if backwards ++ ldrmi DAT0, [S, #-4]! ++ .if align == 0 ++ ldmcsdb S!, {DAT1, DAT2} ++ .else ++ ldrcs DAT2, [S, #-4]! ++ ldrcs DAT1, [S, #-4]! ++ .endif ++ strmi DAT0, [D, #-4]! ++ stmcsdb D!, {DAT1, DAT2} ++ .else ++ ldrmi DAT0, [S], #4 ++ .if align == 0 ++ ldmcsia S!, {DAT1, DAT2} ++ .else ++ ldrcs DAT1, [S], #4 ++ ldrcs DAT2, [S], #4 ++ .endif ++ strmi DAT0, [D], #4 ++ stmcsia D!, {DAT1, DAT2} ++ .endif ++.endm + -+ state->start_bin = exec->ct0ca; -+ state->start_render = exec->ct1ca; ++.macro memcpy_trailing_15bytes backwards, align ++ movs N, N, lsl #29 ++ .if backwards ++ .if align == 0 ++ ldmcsdb S!, {DAT0, DAT1} ++ .else ++ ldrcs DAT1, [S, #-4]! ++ ldrcs DAT0, [S, #-4]! ++ .endif ++ ldrmi DAT2, [S, #-4]! ++ stmcsdb D!, {DAT0, DAT1} ++ strmi DAT2, [D, #-4]! ++ .else ++ .if align == 0 ++ ldmcsia S!, {DAT0, DAT1} ++ .else ++ ldrcs DAT0, [S], #4 ++ ldrcs DAT1, [S], #4 ++ .endif ++ ldrmi DAT2, [S], #4 ++ stmcsia D!, {DAT0, DAT1} ++ strmi DAT2, [D], #4 ++ .endif ++ movs N, N, lsl #2 ++ .if backwards ++ ldrcsh DAT0, [S, #-2]! ++ ldrmib DAT1, [S, #-1] ++ strcsh DAT0, [D, #-2]! ++ strmib DAT1, [D, #-1] ++ .else ++ ldrcsh DAT0, [S], #2 ++ ldrmib DAT1, [S] ++ strcsh DAT0, [D], #2 ++ strmib DAT1, [D] ++ .endif ++.endm + -+ spin_unlock_irqrestore(&vc4->job_lock, irqflags); ++.macro memcpy_long_inner_loop backwards, align ++ .if align != 0 ++ .if backwards ++ ldr DAT0, [S, #-align]! ++ .else ++ ldr LAST, [S, #-align]! ++ .endif ++ .endif ++110: ++ .if align == 0 ++ .if backwards ++ ldmdb S!, {DAT0, DAT1, DAT2, DAT3, DAT4, DAT5, DAT6, LAST} ++ pld [S, OFF] ++ stmdb D!, {DAT4, DAT5, DAT6, LAST} ++ stmdb D!, {DAT0, DAT1, DAT2, DAT3} ++ .else ++ ldmia S!, {DAT0, DAT1, DAT2, DAT3, DAT4, DAT5, DAT6, LAST} ++ pld [S, OFF] ++ stmia D!, {DAT0, DAT1, DAT2, DAT3} ++ stmia D!, {DAT4, DAT5, DAT6, LAST} ++ .endif ++ .else ++ unaligned_words backwards, align, 1, 8, DAT0, DAT1, DAT2, DAT3, DAT4, DAT5, DAT6, DAT7, LAST ++ .endif ++ subs N, N, #32 ++ bhs 110b ++ /* Just before the final (prefetch_distance+1) 32-byte blocks, deal with final preloads */ ++ preload_trailing backwards, S, N, OFF ++ add N, N, #(prefetch_distance+2)*32 - 32 ++120: ++ .if align == 0 ++ .if backwards ++ ldmdb S!, {DAT0, DAT1, DAT2, DAT3, DAT4, DAT5, DAT6, LAST} ++ stmdb D!, {DAT4, DAT5, DAT6, LAST} ++ stmdb D!, {DAT0, DAT1, DAT2, DAT3} ++ .else ++ ldmia S!, {DAT0, DAT1, DAT2, DAT3, DAT4, DAT5, DAT6, LAST} ++ stmia D!, {DAT0, DAT1, DAT2, DAT3} ++ stmia D!, {DAT4, DAT5, DAT6, LAST} ++ .endif ++ .else ++ unaligned_words backwards, align, 0, 8, DAT0, DAT1, DAT2, DAT3, DAT4, DAT5, DAT6, DAT7, LAST ++ .endif ++ subs N, N, #32 ++ bhs 120b ++ tst N, #16 ++ .if align == 0 ++ .if backwards ++ ldmnedb S!, {DAT0, DAT1, DAT2, LAST} ++ stmnedb D!, {DAT0, DAT1, DAT2, LAST} ++ .else ++ ldmneia S!, {DAT0, DAT1, DAT2, LAST} ++ stmneia D!, {DAT0, DAT1, DAT2, LAST} ++ .endif ++ .else ++ beq 130f ++ unaligned_words backwards, align, 0, 4, DAT0, DAT1, DAT2, DAT3, LAST ++130: ++ .endif ++ /* Trailing words and bytes */ ++ tst N, #15 ++ beq 199f ++ .if align != 0 ++ add S, S, #align ++ .endif ++ memcpy_trailing_15bytes backwards, align ++199: ++ pop {DAT3, DAT4, DAT5, DAT6, DAT7} ++ pop {D, DAT1, DAT2, pc} ++.endm + -+ state->ct0ca = V3D_READ(V3D_CTNCA(0)); -+ state->ct0ea = V3D_READ(V3D_CTNEA(0)); ++.macro memcpy_medium_inner_loop backwards, align ++120: ++ .if backwards ++ .if align == 0 ++ ldmdb S!, {DAT0, DAT1, DAT2, LAST} ++ .else ++ ldr LAST, [S, #-4]! ++ ldr DAT2, [S, #-4]! ++ ldr DAT1, [S, #-4]! ++ ldr DAT0, [S, #-4]! ++ .endif ++ stmdb D!, {DAT0, DAT1, DAT2, LAST} ++ .else ++ .if align == 0 ++ ldmia S!, {DAT0, DAT1, DAT2, LAST} ++ .else ++ ldr DAT0, [S], #4 ++ ldr DAT1, [S], #4 ++ ldr DAT2, [S], #4 ++ ldr LAST, [S], #4 ++ .endif ++ stmia D!, {DAT0, DAT1, DAT2, LAST} ++ .endif ++ subs N, N, #16 ++ bhs 120b ++ /* Trailing words and bytes */ ++ tst N, #15 ++ beq 199f ++ memcpy_trailing_15bytes backwards, align ++199: ++ pop {D, DAT1, DAT2, pc} ++.endm + -+ state->ct1ca = V3D_READ(V3D_CTNCA(1)); -+ state->ct1ea = V3D_READ(V3D_CTNEA(1)); ++.macro memcpy_short_inner_loop backwards, align ++ tst N, #16 ++ .if backwards ++ .if align == 0 ++ ldmnedb S!, {DAT0, DAT1, DAT2, LAST} ++ .else ++ ldrne LAST, [S, #-4]! ++ ldrne DAT2, [S, #-4]! ++ ldrne DAT1, [S, #-4]! ++ ldrne DAT0, [S, #-4]! ++ .endif ++ stmnedb D!, {DAT0, DAT1, DAT2, LAST} ++ .else ++ .if align == 0 ++ ldmneia S!, {DAT0, DAT1, DAT2, LAST} ++ .else ++ ldrne DAT0, [S], #4 ++ ldrne DAT1, [S], #4 ++ ldrne DAT2, [S], #4 ++ ldrne LAST, [S], #4 ++ .endif ++ stmneia D!, {DAT0, DAT1, DAT2, LAST} ++ .endif ++ memcpy_trailing_15bytes backwards, align ++199: ++ pop {D, DAT1, DAT2, pc} ++.endm + -+ state->ct0cs = V3D_READ(V3D_CTNCS(0)); -+ state->ct1cs = V3D_READ(V3D_CTNCS(1)); ++.macro memcpy backwards ++ D .req a1 ++ S .req a2 ++ N .req a3 ++ DAT0 .req a4 ++ DAT1 .req v1 ++ DAT2 .req v2 ++ DAT3 .req v3 ++ DAT4 .req v4 ++ DAT5 .req v5 ++ DAT6 .req v6 ++ DAT7 .req sl ++ LAST .req ip ++ OFF .req lr + -+ state->ct0ra0 = V3D_READ(V3D_CT00RA0); -+ state->ct1ra0 = V3D_READ(V3D_CT01RA0); ++ .cfi_startproc + -+ state->bpca = V3D_READ(V3D_BPCA); -+ state->bpcs = V3D_READ(V3D_BPCS); -+ state->bpoa = V3D_READ(V3D_BPOA); -+ state->bpos = V3D_READ(V3D_BPOS); ++ push {D, DAT1, DAT2, lr} + -+ state->vpmbase = V3D_READ(V3D_VPMBASE); ++ .cfi_def_cfa_offset 16 ++ .cfi_rel_offset D, 0 ++ .cfi_undefined S ++ .cfi_undefined N ++ .cfi_undefined DAT0 ++ .cfi_rel_offset DAT1, 4 ++ .cfi_rel_offset DAT2, 8 ++ .cfi_undefined LAST ++ .cfi_rel_offset lr, 12 + -+ state->dbge = V3D_READ(V3D_DBGE); -+ state->fdbgo = V3D_READ(V3D_FDBGO); -+ state->fdbgb = V3D_READ(V3D_FDBGB); -+ state->fdbgr = V3D_READ(V3D_FDBGR); -+ state->fdbgs = V3D_READ(V3D_FDBGS); -+ state->errstat = V3D_READ(V3D_ERRSTAT); ++ .if backwards ++ add D, D, N ++ add S, S, N ++ .endif + -+ spin_lock_irqsave(&vc4->job_lock, irqflags); -+ if (vc4->hang_state) { -+ spin_unlock_irqrestore(&vc4->job_lock, irqflags); -+ vc4_free_hang_state(dev, kernel_state); -+ } else { -+ vc4->hang_state = kernel_state; -+ spin_unlock_irqrestore(&vc4->job_lock, irqflags); -+ } -+} ++ /* See if we're guaranteed to have at least one 16-byte aligned 16-byte write */ ++ cmp N, #31 ++ blo 170f ++ /* To preload ahead as we go, we need at least (prefetch_distance+2) 32-byte blocks */ ++ cmp N, #(prefetch_distance+3)*32 - 1 ++ blo 160f + - static void - vc4_reset(struct drm_device *dev) - { -@@ -64,6 +244,8 @@ vc4_reset_work(struct work_struct *work) - struct vc4_dev *vc4 = - container_of(work, struct vc4_dev, hangcheck.reset_work); - -+ vc4_save_hang_state(vc4->dev); ++ /* Long case */ ++ push {DAT3, DAT4, DAT5, DAT6, DAT7} + - vc4_reset(vc4->dev); - } - -@@ -673,4 +855,7 @@ vc4_gem_destroy(struct drm_device *dev) - } - - vc4_bo_cache_destroy(dev); ++ .cfi_def_cfa_offset 36 ++ .cfi_rel_offset D, 20 ++ .cfi_rel_offset DAT1, 24 ++ .cfi_rel_offset DAT2, 28 ++ .cfi_rel_offset DAT3, 0 ++ .cfi_rel_offset DAT4, 4 ++ .cfi_rel_offset DAT5, 8 ++ .cfi_rel_offset DAT6, 12 ++ .cfi_rel_offset DAT7, 16 ++ .cfi_rel_offset lr, 32 + -+ if (vc4->hang_state) -+ vc4_free_hang_state(dev, vc4->hang_state); - } -diff --git a/include/uapi/drm/vc4_drm.h b/include/uapi/drm/vc4_drm.h -index 499daae5..4a8d19f 100644 ---- a/include/uapi/drm/vc4_drm.h -+++ b/include/uapi/drm/vc4_drm.h -@@ -32,6 +32,7 @@ - #define DRM_VC4_CREATE_BO 0x03 - #define DRM_VC4_MMAP_BO 0x04 - #define DRM_VC4_CREATE_SHADER_BO 0x05 -+#define DRM_VC4_GET_HANG_STATE 0x06 - - #define DRM_IOCTL_VC4_SUBMIT_CL DRM_IOWR( DRM_COMMAND_BASE + DRM_VC4_SUBMIT_CL, struct drm_vc4_submit_cl) - #define DRM_IOCTL_VC4_WAIT_SEQNO DRM_IOWR( DRM_COMMAND_BASE + DRM_VC4_WAIT_SEQNO, struct drm_vc4_wait_seqno) -@@ -39,6 +40,7 @@ - #define DRM_IOCTL_VC4_CREATE_BO DRM_IOWR( DRM_COMMAND_BASE + DRM_VC4_CREATE_BO, struct drm_vc4_create_bo) - #define DRM_IOCTL_VC4_MMAP_BO DRM_IOWR( DRM_COMMAND_BASE + DRM_VC4_MMAP_BO, struct drm_vc4_mmap_bo) - #define DRM_IOCTL_VC4_CREATE_SHADER_BO DRM_IOWR( DRM_COMMAND_BASE + DRM_VC4_CREATE_SHADER_BO, struct drm_vc4_create_shader_bo) -+#define DRM_IOCTL_VC4_GET_HANG_STATE DRM_IOWR( DRM_COMMAND_BASE + DRM_VC4_GET_HANG_STATE, struct drm_vc4_get_hang_state) - - struct drm_vc4_submit_rcl_surface { - uint32_t hindex; /* Handle index, or ~0 if not present. */ -@@ -226,4 +228,47 @@ struct drm_vc4_mmap_bo { - uint64_t offset; - }; - -+struct drm_vc4_get_hang_state_bo { -+ uint32_t handle; -+ uint32_t paddr; -+ uint32_t size; -+ uint32_t pad; -+}; ++ /* Adjust N so that the decrement instruction can also test for ++ * inner loop termination. We want it to stop when there are ++ * (prefetch_distance+1) complete blocks to go. */ ++ sub N, N, #(prefetch_distance+2)*32 ++ preload_leading_step1 backwards, DAT0, S ++ .if backwards ++ /* Bug in GAS: it accepts, but mis-assembles the instruction ++ * ands DAT2, D, #60, 2 ++ * which sets DAT2 to the number of leading bytes until destination is aligned and also clears C (sets borrow) ++ */ ++ .word 0xE210513C ++ beq 154f ++ .else ++ ands DAT2, D, #15 ++ beq 154f ++ rsb DAT2, DAT2, #16 /* number of leading bytes until destination aligned */ ++ .endif ++ preload_leading_step2 backwards, DAT0, S, DAT2, OFF ++ memcpy_leading_15bytes backwards, 1 ++154: /* Destination now 16-byte aligned; we have at least one prefetch as well as at least one 16-byte output block */ ++ /* Prefetch offset is best selected such that it lies in the first 8 of each 32 bytes - but it's just as easy to aim for the first one */ ++ .if backwards ++ rsb OFF, S, #3 ++ and OFF, OFF, #28 ++ sub OFF, OFF, #32*(prefetch_distance+1) ++ .else ++ and OFF, S, #28 ++ rsb OFF, OFF, #32*prefetch_distance ++ .endif ++ movs DAT0, S, lsl #31 ++ bhi 157f ++ bcs 156f ++ bmi 155f ++ memcpy_long_inner_loop backwards, 0 ++155: memcpy_long_inner_loop backwards, 1 ++156: memcpy_long_inner_loop backwards, 2 ++157: memcpy_long_inner_loop backwards, 3 + -+/** -+ * struct drm_vc4_hang_state - ioctl argument for collecting state -+ * from a GPU hang for analysis. -+*/ -+struct drm_vc4_get_hang_state { -+ /** Pointer to array of struct drm_vc4_get_hang_state_bo. */ -+ uint64_t bo; -+ /** -+ * On input, the size of the bo array. Output is the number -+ * of bos to be returned. -+ */ -+ uint32_t bo_count; ++ .cfi_def_cfa_offset 16 ++ .cfi_rel_offset D, 0 ++ .cfi_rel_offset DAT1, 4 ++ .cfi_rel_offset DAT2, 8 ++ .cfi_same_value DAT3 ++ .cfi_same_value DAT4 ++ .cfi_same_value DAT5 ++ .cfi_same_value DAT6 ++ .cfi_same_value DAT7 ++ .cfi_rel_offset lr, 12 + -+ uint32_t start_bin, start_render; ++160: /* Medium case */ ++ preload_all backwards, 0, 0, S, N, DAT2, OFF ++ sub N, N, #16 /* simplifies inner loop termination */ ++ .if backwards ++ ands DAT2, D, #15 ++ beq 164f ++ .else ++ ands DAT2, D, #15 ++ beq 164f ++ rsb DAT2, DAT2, #16 ++ .endif ++ memcpy_leading_15bytes backwards, align ++164: /* Destination now 16-byte aligned; we have at least one 16-byte output block */ ++ tst S, #3 ++ bne 140f ++ memcpy_medium_inner_loop backwards, 0 ++140: memcpy_medium_inner_loop backwards, 1 + -+ uint32_t ct0ca, ct0ea; -+ uint32_t ct1ca, ct1ea; -+ uint32_t ct0cs, ct1cs; -+ uint32_t ct0ra0, ct1ra0; ++170: /* Short case, less than 31 bytes, so no guarantee of at least one 16-byte block */ ++ teq N, #0 ++ beq 199f ++ preload_all backwards, 1, 0, S, N, DAT2, LAST ++ tst D, #3 ++ beq 174f ++172: subs N, N, #1 ++ blo 199f ++ .if backwards ++ ldrb DAT0, [S, #-1]! ++ strb DAT0, [D, #-1]! ++ .else ++ ldrb DAT0, [S], #1 ++ strb DAT0, [D], #1 ++ .endif ++ tst D, #3 ++ bne 172b ++174: /* Destination now 4-byte aligned; we have 0 or more output bytes to go */ ++ tst S, #3 ++ bne 140f ++ memcpy_short_inner_loop backwards, 0 ++140: memcpy_short_inner_loop backwards, 1 + -+ uint32_t bpca, bpcs; -+ uint32_t bpoa, bpos; ++ .cfi_endproc + -+ uint32_t vpmbase; ++ .unreq D ++ .unreq S ++ .unreq N ++ .unreq DAT0 ++ .unreq DAT1 ++ .unreq DAT2 ++ .unreq DAT3 ++ .unreq DAT4 ++ .unreq DAT5 ++ .unreq DAT6 ++ .unreq DAT7 ++ .unreq LAST ++ .unreq OFF ++.endm +diff --git a/arch/arm/lib/memmove_rpi.S b/arch/arm/lib/memmove_rpi.S +new file mode 100644 +index 0000000..8b0760c +--- /dev/null ++++ b/arch/arm/lib/memmove_rpi.S +@@ -0,0 +1,61 @@ ++/* ++Copyright (c) 2013, Raspberry Pi Foundation ++Copyright (c) 2013, RISC OS Open Ltd ++All rights reserved. + -+ uint32_t dbge; -+ uint32_t fdbgo; -+ uint32_t fdbgb; -+ uint32_t fdbgr; -+ uint32_t fdbgs; -+ uint32_t errstat; ++Redistribution and use in source and binary forms, with or without ++modification, are permitted provided that the following conditions are met: ++ * Redistributions of source code must retain the above copyright ++ notice, this list of conditions and the following disclaimer. ++ * 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. ++ * Neither the name of the copyright holder nor the ++ names of its contributors may be used to endorse or promote products ++ derived from this software without specific prior written permission. + -+ /* Pad that we may save more registers into in the future. */ -+ uint32_t pad[16]; -+}; ++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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. ++*/ + - #endif /* _UAPI_VC4_DRM_H_ */ - -From 431be9af0aa88da94986effdff649330cfde1f5a Mon Sep 17 00:00:00 2001 -From: Eric Anholt <eric@anholt.net> -Date: Fri, 4 Dec 2015 11:35:34 -0800 -Subject: [PATCH 115/170] drm/vc4: Update a bunch of code to match upstream - submission. - -This gets almost everything matching, except for the MSAA support and -using generic PM domains. - -Signed-off-by: Eric Anholt <eric@anholt.net> ---- - drivers/gpu/drm/drm_gem_cma_helper.c | 13 +- - drivers/gpu/drm/vc4/vc4_bo.c | 322 +++++++++++++++++------------ - drivers/gpu/drm/vc4/vc4_crtc.c | 7 +- - drivers/gpu/drm/vc4/vc4_drv.c | 6 +- - drivers/gpu/drm/vc4/vc4_drv.h | 20 +- - drivers/gpu/drm/vc4/vc4_gem.c | 24 ++- - drivers/gpu/drm/vc4/vc4_irq.c | 5 +- - drivers/gpu/drm/vc4/vc4_kms.c | 1 + - drivers/gpu/drm/vc4/vc4_packet.h | 210 +++++++++---------- - drivers/gpu/drm/vc4/vc4_qpu_defines.h | 308 ++++++++++++++------------- - drivers/gpu/drm/vc4/vc4_render_cl.c | 4 +- - drivers/gpu/drm/vc4/vc4_v3d.c | 10 +- - drivers/gpu/drm/vc4/vc4_validate.c | 130 ++++++------ - drivers/gpu/drm/vc4/vc4_validate_shaders.c | 66 +++--- - include/drm/drmP.h | 8 +- - 15 files changed, 598 insertions(+), 536 deletions(-) - -diff --git a/drivers/gpu/drm/drm_gem_cma_helper.c b/drivers/gpu/drm/drm_gem_cma_helper.c -index 1c25500..0f7b00b 100644 ---- a/drivers/gpu/drm/drm_gem_cma_helper.c -+++ b/drivers/gpu/drm/drm_gem_cma_helper.c -@@ -58,15 +58,14 @@ __drm_gem_cma_create(struct drm_device *drm, size_t size) - struct drm_gem_cma_object *cma_obj; - struct drm_gem_object *gem_obj; - int ret; -- size_t obj_size = (drm->driver->gem_obj_size ? -- drm->driver->gem_obj_size : -- sizeof(*cma_obj)); - -- cma_obj = kzalloc(obj_size, GFP_KERNEL); -- if (!cma_obj) -+ if (drm->driver->gem_create_object) -+ gem_obj = drm->driver->gem_create_object(drm, size); -+ else -+ gem_obj = kzalloc(sizeof(*cma_obj), GFP_KERNEL); -+ if (!gem_obj) - return ERR_PTR(-ENOMEM); -- -- gem_obj = &cma_obj->base; -+ cma_obj = container_of(gem_obj, struct drm_gem_cma_object, base); - - ret = drm_gem_object_init(drm, gem_obj, size); - if (ret) -diff --git a/drivers/gpu/drm/vc4/vc4_bo.c b/drivers/gpu/drm/vc4/vc4_bo.c -index 58dcbae..6247ff8 100644 ---- a/drivers/gpu/drm/vc4/vc4_bo.c -+++ b/drivers/gpu/drm/vc4/vc4_bo.c -@@ -12,6 +12,10 @@ - * access to system memory with no MMU in between. To support it, we - * use the GEM CMA helper functions to allocate contiguous ranges of - * physical memory for our BOs. -+ * -+ * Since the CMA allocator is very slow, we keep a cache of recently -+ * freed BOs around so that the kernel's allocation of objects for 3D -+ * rendering can return quickly. - */ - - #include "vc4_drv.h" -@@ -34,6 +38,36 @@ static void vc4_bo_stats_dump(struct vc4_dev *vc4) - vc4->bo_stats.size_cached / 1024); - } - -+#ifdef CONFIG_DEBUG_FS -+int vc4_bo_stats_debugfs(struct seq_file *m, void *unused) -+{ -+ struct drm_info_node *node = (struct drm_info_node *)m->private; -+ struct drm_device *dev = node->minor->dev; -+ struct vc4_dev *vc4 = to_vc4_dev(dev); -+ struct vc4_bo_stats stats; -+ -+ /* Take a snapshot of the current stats with the lock held. */ -+ mutex_lock(&vc4->bo_lock); -+ stats = vc4->bo_stats; -+ mutex_unlock(&vc4->bo_lock); -+ -+ seq_printf(m, "num bos allocated: %d\n", -+ stats.num_allocated); -+ seq_printf(m, "size bos allocated: %dkb\n", -+ stats.size_allocated / 1024); -+ seq_printf(m, "num bos used: %d\n", -+ stats.num_allocated - stats.num_cached); -+ seq_printf(m, "size bos used: %dkb\n", -+ (stats.size_allocated - stats.size_cached) / 1024); -+ seq_printf(m, "num bos cached: %d\n", -+ stats.num_cached); -+ seq_printf(m, "size bos cached: %dkb\n", -+ stats.size_cached / 1024); ++#include <linux/linkage.h> ++#include "arm-mem.h" ++#include "memcpymove.h" + -+ return 0; -+} ++/* Prevent the stack from becoming executable */ ++#if defined(__linux__) && defined(__ELF__) ++.section .note.GNU-stack,"",%progbits +#endif + - static uint32_t bo_page_index(size_t size) - { - return (size / PAGE_SIZE) - 1; -@@ -81,8 +115,8 @@ static struct list_head *vc4_get_cache_list_for_size(struct drm_device *dev, - struct list_head *new_list; - uint32_t i; - -- new_list = kmalloc(new_size * sizeof(struct list_head), -- GFP_KERNEL); -+ new_list = kmalloc_array(new_size, sizeof(struct list_head), -+ GFP_KERNEL); - if (!new_list) - return NULL; - -@@ -90,7 +124,9 @@ static struct list_head *vc4_get_cache_list_for_size(struct drm_device *dev, - * head locations. - */ - for (i = 0; i < vc4->bo_cache.size_list_size; i++) { -- struct list_head *old_list = &vc4->bo_cache.size_list[i]; -+ struct list_head *old_list = -+ &vc4->bo_cache.size_list[i]; -+ - if (list_empty(old_list)) - INIT_LIST_HEAD(&new_list[i]); - else -@@ -122,11 +158,60 @@ void vc4_bo_cache_purge(struct drm_device *dev) - mutex_unlock(&vc4->bo_lock); - } - --struct vc4_bo *vc4_bo_create(struct drm_device *dev, size_t unaligned_size) -+static struct vc4_bo *vc4_bo_get_from_cache(struct drm_device *dev, -+ uint32_t size) - { - struct vc4_dev *vc4 = to_vc4_dev(dev); -- uint32_t size = roundup(unaligned_size, PAGE_SIZE); - uint32_t page_index = bo_page_index(size); -+ struct vc4_bo *bo = NULL; -+ -+ size = roundup(size, PAGE_SIZE); ++ .text ++ .arch armv6 ++ .object_arch armv4 ++ .arm ++ .altmacro ++ .p2align 2 + -+ mutex_lock(&vc4->bo_lock); -+ if (page_index >= vc4->bo_cache.size_list_size) -+ goto out; ++/* ++ * void *memmove(void *s1, const void *s2, size_t n); ++ * On entry: ++ * a1 = pointer to destination ++ * a2 = pointer to source ++ * a3 = number of bytes to copy ++ * On exit: ++ * a1 preserved ++ */ + -+ if (list_empty(&vc4->bo_cache.size_list[page_index])) -+ goto out; ++.set prefetch_distance, 3 + -+ bo = list_first_entry(&vc4->bo_cache.size_list[page_index], -+ struct vc4_bo, size_head); -+ vc4_bo_remove_from_cache(bo); -+ kref_init(&bo->base.base.refcount); ++ENTRY(memmove) ++ cmp a2, a1 ++ bpl memcpy /* pl works even over -1 - 0 and 0x7fffffff - 0x80000000 boundaries */ ++ memcpy 1 ++ENDPROC(memmove) +diff --git a/arch/arm/lib/memset_rpi.S b/arch/arm/lib/memset_rpi.S +new file mode 100644 +index 0000000..7067415 +--- /dev/null ++++ b/arch/arm/lib/memset_rpi.S +@@ -0,0 +1,123 @@ ++/* ++Copyright (c) 2013, Raspberry Pi Foundation ++Copyright (c) 2013, RISC OS Open Ltd ++All rights reserved. + -+out: -+ mutex_unlock(&vc4->bo_lock); -+ return bo; -+} ++Redistribution and use in source and binary forms, with or without ++modification, are permitted provided that the following conditions are met: ++ * Redistributions of source code must retain the above copyright ++ notice, this list of conditions and the following disclaimer. ++ * 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. ++ * Neither the name of the copyright holder nor the ++ names of its contributors may be used to endorse or promote products ++ derived from this software without specific prior written permission. + -+/** -+ * vc4_gem_create_object - Implementation of driver->gem_create_object. -+ * -+ * This lets the CMA helpers allocate object structs for us, and keep -+ * our BO stats correct. -+ */ -+struct drm_gem_object *vc4_create_object(struct drm_device *dev, size_t size) -+{ -+ struct vc4_dev *vc4 = to_vc4_dev(dev); -+ struct vc4_bo *bo; ++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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. ++*/ + -+ bo = kzalloc(sizeof(*bo), GFP_KERNEL); -+ if (!bo) -+ return ERR_PTR(-ENOMEM); ++#include <linux/linkage.h> ++#include "arm-mem.h" + -+ mutex_lock(&vc4->bo_lock); -+ vc4->bo_stats.num_allocated++; -+ vc4->bo_stats.size_allocated += size; -+ mutex_unlock(&vc4->bo_lock); ++/* Prevent the stack from becoming executable */ ++#if defined(__linux__) && defined(__ELF__) ++.section .note.GNU-stack,"",%progbits ++#endif + -+ return &bo->base.base; -+} ++ .text ++ .arch armv6 ++ .object_arch armv4 ++ .arm ++ .altmacro ++ .p2align 2 + -+struct vc4_bo *vc4_bo_create(struct drm_device *dev, size_t unaligned_size, -+ bool from_cache) -+{ -+ size_t size = roundup(unaligned_size, PAGE_SIZE); -+ struct vc4_dev *vc4 = to_vc4_dev(dev); - struct drm_gem_cma_object *cma_obj; - int pass; - -@@ -134,18 +219,12 @@ struct vc4_bo *vc4_bo_create(struct drm_device *dev, size_t unaligned_size) - return NULL; - - /* First, try to get a vc4_bo from the kernel BO cache. */ -- mutex_lock(&vc4->bo_lock); -- if (page_index < vc4->bo_cache.size_list_size && -- !list_empty(&vc4->bo_cache.size_list[page_index])) { -- struct vc4_bo *bo = -- list_first_entry(&vc4->bo_cache.size_list[page_index], -- struct vc4_bo, size_head); -- vc4_bo_remove_from_cache(bo); -- mutex_unlock(&vc4->bo_lock); -- kref_init(&bo->base.base.refcount); -- return bo; -+ if (from_cache) { -+ struct vc4_bo *bo = vc4_bo_get_from_cache(dev, size); -+ -+ if (bo) -+ return bo; - } -- mutex_unlock(&vc4->bo_lock); - - /* Otherwise, make a new BO. */ - for (pass = 0; ; pass++) { -@@ -179,9 +258,6 @@ struct vc4_bo *vc4_bo_create(struct drm_device *dev, size_t unaligned_size) - } - } - -- vc4->bo_stats.num_allocated++; -- vc4->bo_stats.size_allocated += size; -- - return to_vc4_bo(&cma_obj->base); - } - -@@ -199,7 +275,7 @@ int vc4_dumb_create(struct drm_file *file_priv, - if (args->size < args->pitch * args->height) - args->size = args->pitch * args->height; - -- bo = vc4_bo_create(dev, args->size); -+ bo = vc4_bo_create(dev, args->size, false); - if (!bo) - return -ENOMEM; - -@@ -209,8 +285,8 @@ int vc4_dumb_create(struct drm_file *file_priv, - return ret; - } - --static void --vc4_bo_cache_free_old(struct drm_device *dev) -+/* Must be called with bo_lock held. */ -+static void vc4_bo_cache_free_old(struct drm_device *dev) - { - struct vc4_dev *vc4 = to_vc4_dev(dev); - unsigned long expire_time = jiffies - msecs_to_jiffies(1000); -@@ -313,15 +389,77 @@ vc4_prime_export(struct drm_device *dev, struct drm_gem_object *obj, int flags) - return drm_gem_prime_export(dev, obj, flags); - } - --int --vc4_create_bo_ioctl(struct drm_device *dev, void *data, -- struct drm_file *file_priv) -+int vc4_mmap(struct file *filp, struct vm_area_struct *vma) -+{ -+ struct drm_gem_object *gem_obj; -+ struct vc4_bo *bo; -+ int ret; ++/* ++ * void *memset(void *s, int c, size_t n); ++ * On entry: ++ * a1 = pointer to buffer to fill ++ * a2 = byte pattern to fill with (caller-narrowed) ++ * a3 = number of bytes to fill ++ * On exit: ++ * a1 preserved ++ */ ++ENTRY(mmioset) ++ENTRY(memset) ++ S .req a1 ++ DAT0 .req a2 ++ N .req a3 ++ DAT1 .req a4 ++ DAT2 .req ip ++ DAT3 .req lr + -+ ret = drm_gem_mmap(filp, vma); -+ if (ret) -+ return ret; ++ orr DAT0, DAT0, lsl #8 ++ push {S, lr} ++ orr DAT0, DAT0, lsl #16 ++ mov DAT1, DAT0 + -+ gem_obj = vma->vm_private_data; -+ bo = to_vc4_bo(gem_obj); ++ /* See if we're guaranteed to have at least one 16-byte aligned 16-byte write */ ++ cmp N, #31 ++ blo 170f + -+ if (bo->validated_shader && (vma->vm_flags & VM_WRITE)) { -+ DRM_ERROR("mmaping of shader BOs for writing not allowed.\n"); -+ return -EINVAL; -+ } ++161: sub N, N, #16 /* simplifies inner loop termination */ ++ /* Leading words and bytes */ ++ tst S, #15 ++ beq 164f ++ rsb DAT3, S, #0 /* bits 0-3 = number of leading bytes until aligned */ ++ movs DAT2, DAT3, lsl #31 ++ submi N, N, #1 ++ strmib DAT0, [S], #1 ++ subcs N, N, #2 ++ strcsh DAT0, [S], #2 ++ movs DAT2, DAT3, lsl #29 ++ submi N, N, #4 ++ strmi DAT0, [S], #4 ++ subcs N, N, #8 ++ stmcsia S!, {DAT0, DAT1} ++164: /* Delayed set up of DAT2 and DAT3 so we could use them as scratch registers above */ ++ mov DAT2, DAT0 ++ mov DAT3, DAT0 ++ /* Now the inner loop of 16-byte stores */ ++165: stmia S!, {DAT0, DAT1, DAT2, DAT3} ++ subs N, N, #16 ++ bhs 165b ++166: /* Trailing words and bytes */ ++ movs N, N, lsl #29 ++ stmcsia S!, {DAT0, DAT1} ++ strmi DAT0, [S], #4 ++ movs N, N, lsl #2 ++ strcsh DAT0, [S], #2 ++ strmib DAT0, [S] ++199: pop {S, pc} + -+ /* -+ * Clear the VM_PFNMAP flag that was set by drm_gem_mmap(), and set the -+ * vm_pgoff (used as a fake buffer offset by DRM) to 0 as we want to map -+ * the whole buffer. -+ */ -+ vma->vm_flags &= ~VM_PFNMAP; -+ vma->vm_pgoff = 0; ++170: /* Short case */ ++ mov DAT2, DAT0 ++ mov DAT3, DAT0 ++ tst S, #3 ++ beq 174f ++172: subs N, N, #1 ++ blo 199b ++ strb DAT0, [S], #1 ++ tst S, #3 ++ bne 172b ++174: tst N, #16 ++ stmneia S!, {DAT0, DAT1, DAT2, DAT3} ++ b 166b + -+ ret = dma_mmap_writecombine(bo->base.base.dev->dev, vma, -+ bo->base.vaddr, bo->base.paddr, -+ vma->vm_end - vma->vm_start); -+ if (ret) -+ drm_gem_vm_close(vma); ++ .unreq S ++ .unreq DAT0 ++ .unreq N ++ .unreq DAT1 ++ .unreq DAT2 ++ .unreq DAT3 ++ENDPROC(memset) ++ENDPROC(mmioset) +diff --git a/arch/arm/lib/uaccess_with_memcpy.c b/arch/arm/lib/uaccess_with_memcpy.c +index 6bd1089..cd17dd1 100644 +--- a/arch/arm/lib/uaccess_with_memcpy.c ++++ b/arch/arm/lib/uaccess_with_memcpy.c +@@ -22,6 +22,14 @@ + #include <asm/current.h> + #include <asm/page.h> + ++#ifndef COPY_FROM_USER_THRESHOLD ++#define COPY_FROM_USER_THRESHOLD 64 ++#endif + -+ return ret; -+} ++#ifndef COPY_TO_USER_THRESHOLD ++#define COPY_TO_USER_THRESHOLD 64 ++#endif + -+int vc4_prime_mmap(struct drm_gem_object *obj, struct vm_area_struct *vma) + static int + pin_page_for_write(const void __user *_addr, pte_t **ptep, spinlock_t **ptlp) + { +@@ -84,7 +92,44 @@ pin_page_for_write(const void __user *_addr, pte_t **ptep, spinlock_t **ptlp) + return 1; + } + +-static unsigned long noinline ++static int ++pin_page_for_read(const void __user *_addr, pte_t **ptep, spinlock_t **ptlp) +{ -+ struct vc4_bo *bo = to_vc4_bo(obj); ++ unsigned long addr = (unsigned long)_addr; ++ pgd_t *pgd; ++ pmd_t *pmd; ++ pte_t *pte; ++ pud_t *pud; ++ spinlock_t *ptl; + -+ if (bo->validated_shader && (vma->vm_flags & VM_WRITE)) { -+ DRM_ERROR("mmaping of shader BOs for writing not allowed.\n"); -+ return -EINVAL; ++ pgd = pgd_offset(current->mm, addr); ++ if (unlikely(pgd_none(*pgd) || pgd_bad(*pgd))) ++ { ++ return 0; ++ } ++ pud = pud_offset(pgd, addr); ++ if (unlikely(pud_none(*pud) || pud_bad(*pud))) ++ { ++ return 0; + } + -+ return drm_gem_cma_prime_mmap(obj, vma); -+} -+ -+void *vc4_prime_vmap(struct drm_gem_object *obj) -+{ -+ struct vc4_bo *bo = to_vc4_bo(obj); ++ pmd = pmd_offset(pud, addr); ++ if (unlikely(pmd_none(*pmd) || pmd_bad(*pmd))) ++ return 0; + -+ if (bo->validated_shader) { -+ DRM_ERROR("mmaping of shader BOs not allowed.\n"); -+ return ERR_PTR(-EINVAL); ++ pte = pte_offset_map_lock(current->mm, pmd, addr, &ptl); ++ if (unlikely(!pte_present(*pte) || !pte_young(*pte))) { ++ pte_unmap_unlock(pte, ptl); ++ return 0; + } + -+ return drm_gem_cma_prime_vmap(obj); ++ *ptep = pte; ++ *ptlp = ptl; ++ ++ return 1; +} + -+int vc4_create_bo_ioctl(struct drm_device *dev, void *data, -+ struct drm_file *file_priv) ++unsigned long noinline + __copy_to_user_memcpy(void __user *to, const void *from, unsigned long n) { - struct drm_vc4_create_bo *args = data; - struct vc4_bo *bo = NULL; - int ret; - -- bo = vc4_bo_create(dev, args->size); -+ /* -+ * We can't allocate from the BO cache, because the BOs don't -+ * get zeroed, and that might leak data between users. -+ */ -+ bo = vc4_bo_create(dev, args->size, false); - if (!bo) - return -ENOMEM; - -@@ -331,6 +469,25 @@ vc4_create_bo_ioctl(struct drm_device *dev, void *data, - return ret; + unsigned long ua_flags; +@@ -137,6 +182,57 @@ out: + return n; } -+int vc4_mmap_bo_ioctl(struct drm_device *dev, void *data, -+ struct drm_file *file_priv) ++unsigned long noinline ++__copy_from_user_memcpy(void *to, const void __user *from, unsigned long n) +{ -+ struct drm_vc4_mmap_bo *args = data; -+ struct drm_gem_object *gem_obj; ++ unsigned long ua_flags; ++ int atomic; + -+ gem_obj = drm_gem_object_lookup(dev, file_priv, args->handle); -+ if (!gem_obj) { -+ DRM_ERROR("Failed to look up GEM BO %d\n", args->handle); -+ return -EINVAL; ++ if (unlikely(segment_eq(get_fs(), KERNEL_DS))) { ++ memcpy(to, (const void *)from, n); ++ return 0; + } + -+ /* The mmap offset was set up at BO allocation time. */ -+ args->offset = drm_vma_node_offset_addr(&gem_obj->vma_node); ++ /* the mmap semaphore is taken only if not in an atomic context */ ++ atomic = in_atomic(); + -+ drm_gem_object_unreference_unlocked(gem_obj); -+ return 0; -+} ++ if (!atomic) ++ down_read(&current->mm->mmap_sem); ++ while (n) { ++ pte_t *pte; ++ spinlock_t *ptl; ++ int tocopy; + - int - vc4_create_shader_bo_ioctl(struct drm_device *dev, void *data, - struct drm_file *file_priv) -@@ -355,7 +512,7 @@ vc4_create_shader_bo_ioctl(struct drm_device *dev, void *data, - return -EINVAL; - } - -- bo = vc4_bo_create(dev, args->size); -+ bo = vc4_bo_create(dev, args->size, true); - if (!bo) - return -ENOMEM; - -@@ -364,6 +521,11 @@ vc4_create_shader_bo_ioctl(struct drm_device *dev, void *data, - args->size); - if (ret != 0) - goto fail; -+ /* Clear the rest of the memory from allocating from the BO -+ * cache. -+ */ -+ memset(bo->base.vaddr + args->size, 0, -+ bo->base.base.size - args->size); - - bo->validated_shader = vc4_validate_shader(&bo->base); - if (!bo->validated_shader) { -@@ -382,85 +544,6 @@ vc4_create_shader_bo_ioctl(struct drm_device *dev, void *data, - return ret; - } - --int --vc4_mmap_bo_ioctl(struct drm_device *dev, void *data, -- struct drm_file *file_priv) --{ -- struct drm_vc4_mmap_bo *args = data; -- struct drm_gem_object *gem_obj; -- -- gem_obj = drm_gem_object_lookup(dev, file_priv, args->handle); -- if (!gem_obj) { -- DRM_ERROR("Failed to look up GEM BO %d\n", args->handle); -- return -EINVAL; -- } -- -- /* The mmap offset was set up at BO allocation time. */ -- args->offset = drm_vma_node_offset_addr(&gem_obj->vma_node); -- -- drm_gem_object_unreference(gem_obj); -- return 0; --} -- --int vc4_mmap(struct file *filp, struct vm_area_struct *vma) --{ -- struct drm_gem_object *gem_obj; -- struct vc4_bo *bo; -- int ret; -- -- ret = drm_gem_mmap(filp, vma); -- if (ret) -- return ret; -- -- gem_obj = vma->vm_private_data; -- bo = to_vc4_bo(gem_obj); -- -- if (bo->validated_shader && (vma->vm_flags & VM_WRITE)) { -- DRM_ERROR("mmaping of shader BOs for writing not allowed.\n"); -- return -EINVAL; -- } -- -- /* -- * Clear the VM_PFNMAP flag that was set by drm_gem_mmap(), and set the -- * vm_pgoff (used as a fake buffer offset by DRM) to 0 as we want to map -- * the whole buffer. -- */ -- vma->vm_flags &= ~VM_PFNMAP; -- vma->vm_pgoff = 0; -- -- ret = dma_mmap_writecombine(bo->base.base.dev->dev, vma, -- bo->base.vaddr, bo->base.paddr, -- vma->vm_end - vma->vm_start); -- if (ret) -- drm_gem_vm_close(vma); -- -- return ret; --} -- --int vc4_prime_mmap(struct drm_gem_object *obj, struct vm_area_struct *vma) --{ -- struct vc4_bo *bo = to_vc4_bo(obj); -- -- if (bo->validated_shader) { -- DRM_ERROR("mmaping of shader BOs not allowed.\n"); -- return -EINVAL; -- } -- -- return drm_gem_cma_prime_mmap(obj, vma); --} -- --void *vc4_prime_vmap(struct drm_gem_object *obj) --{ -- struct vc4_bo *bo = to_vc4_bo(obj); -- -- if (bo->validated_shader) { -- DRM_ERROR("mmaping of shader BOs not allowed.\n"); -- return ERR_PTR(-EINVAL); -- } -- -- return drm_gem_cma_prime_vmap(obj); --} -- - void vc4_bo_cache_init(struct drm_device *dev) - { - struct vc4_dev *vc4 = to_vc4_dev(dev); -@@ -472,7 +555,7 @@ void vc4_bo_cache_init(struct drm_device *dev) - INIT_WORK(&vc4->bo_cache.time_work, vc4_bo_cache_time_work); - setup_timer(&vc4->bo_cache.time_timer, - vc4_bo_cache_time_timer, -- (unsigned long) dev); -+ (unsigned long)dev); - } - - void vc4_bo_cache_destroy(struct drm_device *dev) -@@ -489,28 +572,3 @@ void vc4_bo_cache_destroy(struct drm_device *dev) - vc4_bo_stats_dump(vc4); - } - } -- --#ifdef CONFIG_DEBUG_FS --int vc4_bo_stats_debugfs(struct seq_file *m, void *unused) --{ -- struct drm_info_node *node = (struct drm_info_node *) m->private; -- struct drm_device *dev = node->minor->dev; -- struct vc4_dev *vc4 = to_vc4_dev(dev); -- struct vc4_bo_stats stats; -- -- mutex_lock(&vc4->bo_lock); -- stats = vc4->bo_stats; -- mutex_unlock(&vc4->bo_lock); -- -- seq_printf(m, "num bos allocated: %d\n", stats.num_allocated); -- seq_printf(m, "size bos allocated: %dkb\n", stats.size_allocated / 1024); -- seq_printf(m, "num bos used: %d\n", (stats.num_allocated - -- stats.num_cached)); -- seq_printf(m, "size bos used: %dkb\n", (stats.size_allocated - -- stats.size_cached) / 1024); -- seq_printf(m, "num bos cached: %d\n", stats.num_cached); -- seq_printf(m, "size bos cached: %dkb\n", stats.size_cached / 1024); -- -- return 0; --} --#endif -diff --git a/drivers/gpu/drm/vc4/vc4_crtc.c b/drivers/gpu/drm/vc4/vc4_crtc.c -index 3be2720..3c67914 100644 ---- a/drivers/gpu/drm/vc4/vc4_crtc.c -+++ b/drivers/gpu/drm/vc4/vc4_crtc.c -@@ -501,6 +501,7 @@ vc4_async_page_flip_complete(struct vc4_seqno_cb *cb) - vc4_plane_async_set_fb(plane, flip_state->fb); - if (flip_state->event) { - unsigned long flags; -+ - spin_lock_irqsave(&dev->event_lock, flags); - drm_crtc_send_vblank_event(crtc, flip_state->event); - spin_unlock_irqrestore(&dev->event_lock, flags); -@@ -562,9 +563,9 @@ static int vc4_async_page_flip(struct drm_crtc *crtc, - } - - static int vc4_page_flip(struct drm_crtc *crtc, -- struct drm_framebuffer *fb, -- struct drm_pending_vblank_event *event, -- uint32_t flags) -+ struct drm_framebuffer *fb, -+ struct drm_pending_vblank_event *event, -+ uint32_t flags) - { - if (flags & DRM_MODE_PAGE_FLIP_ASYNC) - return vc4_async_page_flip(crtc, fb, event, flags); -diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c -index e8192b4..22061ae 100644 ---- a/drivers/gpu/drm/vc4/vc4_drv.c -+++ b/drivers/gpu/drm/vc4/vc4_drv.c -@@ -81,7 +81,8 @@ static const struct drm_ioctl_desc vc4_drm_ioctls[] = { - DRM_IOCTL_DEF_DRV(VC4_CREATE_BO, vc4_create_bo_ioctl, 0), - DRM_IOCTL_DEF_DRV(VC4_MMAP_BO, vc4_mmap_bo_ioctl, 0), - DRM_IOCTL_DEF_DRV(VC4_CREATE_SHADER_BO, vc4_create_shader_bo_ioctl, 0), -- DRM_IOCTL_DEF_DRV(VC4_GET_HANG_STATE, vc4_get_hang_state_ioctl, DRM_ROOT_ONLY), -+ DRM_IOCTL_DEF_DRV(VC4_GET_HANG_STATE, vc4_get_hang_state_ioctl, -+ DRM_ROOT_ONLY), - }; - - static struct drm_driver vc4_drm_driver = { -@@ -107,6 +108,7 @@ static struct drm_driver vc4_drm_driver = { - .debugfs_cleanup = vc4_debugfs_cleanup, - #endif - -+ .gem_create_object = vc4_create_object, - .gem_free_object = vc4_free_object, - .gem_vm_ops = &drm_gem_cma_vm_ops, - -@@ -128,8 +130,6 @@ static struct drm_driver vc4_drm_driver = { - .num_ioctls = ARRAY_SIZE(vc4_drm_ioctls), - .fops = &vc4_drm_fops, - -- //.gem_obj_size = sizeof(struct vc4_bo), -- - .name = DRIVER_NAME, - .desc = DRIVER_DESC, - .date = DRIVER_DATE, -diff --git a/drivers/gpu/drm/vc4/vc4_drv.h b/drivers/gpu/drm/vc4/vc4_drv.h -index 24845c1..53dfa8df 100644 ---- a/drivers/gpu/drm/vc4/vc4_drv.h -+++ b/drivers/gpu/drm/vc4/vc4_drv.h -@@ -72,6 +72,9 @@ struct vc4_dev { - * job_done_work. - */ - struct list_head job_done_list; -+ /* Spinlock used to synchronize the job_list and seqno -+ * accesses between the IRQ handler and GEM ioctls. -+ */ - spinlock_t job_lock; - wait_queue_head_t job_wait_queue; - struct work_struct job_done_work; -@@ -318,8 +321,7 @@ struct vc4_texture_sample_info { - * and validate the shader state record's uniforms that define the texture - * samples. - */ --struct vc4_validated_shader_info --{ -+struct vc4_validated_shader_info { - uint32_t uniforms_size; - uint32_t uniforms_src_size; - uint32_t num_texture_samples; -@@ -355,8 +357,10 @@ struct vc4_validated_shader_info - #define wait_for(COND, MS) _wait_for(COND, MS, 1) - - /* vc4_bo.c */ -+struct drm_gem_object *vc4_create_object(struct drm_device *dev, size_t size); - void vc4_free_object(struct drm_gem_object *gem_obj); --struct vc4_bo *vc4_bo_create(struct drm_device *dev, size_t size); -+struct vc4_bo *vc4_bo_create(struct drm_device *dev, size_t size, -+ bool from_cache); - int vc4_dumb_create(struct drm_file *file_priv, - struct drm_device *dev, - struct drm_mode_create_dumb *args); -@@ -432,7 +436,8 @@ struct drm_plane *vc4_plane_init(struct drm_device *dev, - enum drm_plane_type type); - u32 vc4_plane_write_dlist(struct drm_plane *plane, u32 __iomem *dlist); - u32 vc4_plane_dlist_size(struct drm_plane_state *state); --void vc4_plane_async_set_fb(struct drm_plane *plane, struct drm_framebuffer *fb); -+void vc4_plane_async_set_fb(struct drm_plane *plane, -+ struct drm_framebuffer *fb); - - /* vc4_v3d.c */ - extern struct platform_driver vc4_v3d_driver; -@@ -450,9 +455,6 @@ vc4_validate_bin_cl(struct drm_device *dev, - int - vc4_validate_shader_recs(struct drm_device *dev, struct vc4_exec_info *exec); - --struct vc4_validated_shader_info * --vc4_validate_shader(struct drm_gem_cma_object *shader_obj); -- - bool vc4_use_bo(struct vc4_exec_info *exec, - uint32_t hindex, - enum vc4_bo_mode mode, -@@ -464,3 +466,7 @@ bool vc4_check_tex_size(struct vc4_exec_info *exec, - struct drm_gem_cma_object *fbo, - uint32_t offset, uint8_t tiling_format, - uint32_t width, uint32_t height, uint8_t cpp); -+ -+/* vc4_validate_shader.c */ -+struct vc4_validated_shader_info * -+vc4_validate_shader(struct drm_gem_cma_object *shader_obj); -diff --git a/drivers/gpu/drm/vc4/vc4_gem.c b/drivers/gpu/drm/vc4/vc4_gem.c -index d90c664..fb0b92d 100644 ---- a/drivers/gpu/drm/vc4/vc4_gem.c -+++ b/drivers/gpu/drm/vc4/vc4_gem.c -@@ -53,9 +53,8 @@ vc4_free_hang_state(struct drm_device *dev, struct vc4_hang_state *state) - unsigned int i; - - mutex_lock(&dev->struct_mutex); -- for (i = 0; i < state->user_state.bo_count; i++) { -+ for (i = 0; i < state->user_state.bo_count; i++) - drm_gem_object_unreference(state->bo[i]); -- } - mutex_unlock(&dev->struct_mutex); - - kfree(state); -@@ -65,10 +64,10 @@ int - vc4_get_hang_state_ioctl(struct drm_device *dev, void *data, - struct drm_file *file_priv) - { -- struct drm_vc4_get_hang_state *get_state = data; -+ struct drm_vc4_get_hang_state *get_state = data; - struct drm_vc4_get_hang_state_bo *bo_state; - struct vc4_hang_state *kernel_state; -- struct drm_vc4_get_hang_state *state; -+ struct drm_vc4_get_hang_state *state; - struct vc4_dev *vc4 = to_vc4_dev(dev); - unsigned long irqflags; - u32 i; -@@ -107,6 +106,7 @@ vc4_get_hang_state_ioctl(struct drm_device *dev, void *data, - for (i = 0; i < state->bo_count; i++) { - struct vc4_bo *vc4_bo = to_vc4_bo(kernel_state->bo[i]); - u32 handle; ++ while (!pin_page_for_read(from, &pte, &ptl)) { ++ char temp; ++ if (!atomic) ++ up_read(&current->mm->mmap_sem); ++ if (__get_user(temp, (char __user *)from)) ++ goto out; ++ if (!atomic) ++ down_read(&current->mm->mmap_sem); ++ } + - ret = drm_gem_handle_create(file_priv, kernel_state->bo[i], - &handle); - -@@ -124,7 +124,7 @@ vc4_get_hang_state_ioctl(struct drm_device *dev, void *data, - state->bo_count * sizeof(*bo_state)); - kfree(bo_state); - -- err_free: -+err_free: - - vc4_free_hang_state(dev, kernel_state); - -@@ -578,7 +578,7 @@ vc4_get_bcl(struct drm_device *dev, struct vc4_exec_info *exec) - goto fail; - } - -- bo = vc4_bo_create(dev, exec_size); -+ bo = vc4_bo_create(dev, exec_size, true); - if (!bo) { - DRM_ERROR("Couldn't allocate BO for binning\n"); - ret = PTR_ERR(exec->exec_bo); -@@ -668,6 +668,7 @@ vc4_job_handle_completed(struct vc4_dev *vc4) - static void vc4_seqno_cb_work(struct work_struct *work) - { - struct vc4_seqno_cb *cb = container_of(work, struct vc4_seqno_cb, work); ++ tocopy = (~(unsigned long)from & ~PAGE_MASK) + 1; ++ if (tocopy > n) ++ tocopy = n; + - cb->func(cb); - } - -@@ -717,6 +718,7 @@ vc4_wait_for_seqno_ioctl_helper(struct drm_device *dev, - - if ((ret == -EINTR || ret == -ERESTARTSYS) && *timeout_ns != ~0ull) { - uint64_t delta = jiffies_to_nsecs(jiffies - start); ++ ua_flags = uaccess_save_and_enable(); ++ memcpy(to, (const void *)from, tocopy); ++ uaccess_restore(ua_flags); ++ to += tocopy; ++ from += tocopy; ++ n -= tocopy; + - if (*timeout_ns >= delta) - *timeout_ns -= delta; - } -@@ -750,9 +752,10 @@ vc4_wait_bo_ioctl(struct drm_device *dev, void *data, - } - bo = to_vc4_bo(gem_obj); - -- ret = vc4_wait_for_seqno_ioctl_helper(dev, bo->seqno, &args->timeout_ns); -+ ret = vc4_wait_for_seqno_ioctl_helper(dev, bo->seqno, -+ &args->timeout_ns); - -- drm_gem_object_unreference(gem_obj); -+ drm_gem_object_unreference_unlocked(gem_obj); - return ret; - } - -@@ -793,7 +796,8 @@ vc4_submit_cl_ioctl(struct drm_device *dev, void *data, - if (ret) - goto fail; - } else { -- exec->ct0ca = exec->ct0ea = 0; -+ exec->ct0ca = 0; -+ exec->ct0ea = 0; - } - - ret = vc4_get_rcl(dev, exec); -@@ -831,7 +835,7 @@ vc4_gem_init(struct drm_device *dev) - INIT_WORK(&vc4->hangcheck.reset_work, vc4_reset_work); - setup_timer(&vc4->hangcheck.timer, - vc4_hangcheck_elapsed, -- (unsigned long) dev); -+ (unsigned long)dev); - - INIT_WORK(&vc4->job_done_work, vc4_job_done_work); - } -diff --git a/drivers/gpu/drm/vc4/vc4_irq.c b/drivers/gpu/drm/vc4/vc4_irq.c -index f29b796..b68060e 100644 ---- a/drivers/gpu/drm/vc4/vc4_irq.c -+++ b/drivers/gpu/drm/vc4/vc4_irq.c -@@ -56,7 +56,7 @@ vc4_overflow_mem_work(struct work_struct *work) - struct drm_device *dev = vc4->dev; - struct vc4_bo *bo; - -- bo = vc4_bo_create(dev, 256 * 1024); -+ bo = vc4_bo_create(dev, 256 * 1024, true); - if (!bo) { - DRM_ERROR("Couldn't allocate binner overflow mem\n"); - return; -@@ -87,9 +87,8 @@ vc4_overflow_mem_work(struct work_struct *work) - spin_unlock_irqrestore(&vc4->job_lock, irqflags); - } - -- if (vc4->overflow_mem) { -+ if (vc4->overflow_mem) - drm_gem_object_unreference_unlocked(&vc4->overflow_mem->base.base); -- } - vc4->overflow_mem = bo; - - V3D_WRITE(V3D_BPOA, bo->base.paddr); -diff --git a/drivers/gpu/drm/vc4/vc4_kms.c b/drivers/gpu/drm/vc4/vc4_kms.c -index 2082713..f95f2df 100644 ---- a/drivers/gpu/drm/vc4/vc4_kms.c -+++ b/drivers/gpu/drm/vc4/vc4_kms.c -@@ -132,6 +132,7 @@ static int vc4_atomic_commit(struct drm_device *dev, - struct drm_gem_cma_object *cma_bo = - drm_fb_cma_get_gem_obj(new_state->fb, 0); - struct vc4_bo *bo = to_vc4_bo(&cma_bo->base); -+ - wait_seqno = max(bo->seqno, wait_seqno); - } - } -diff --git a/drivers/gpu/drm/vc4/vc4_packet.h b/drivers/gpu/drm/vc4/vc4_packet.h -index 9757bc8..cee38aad 100644 ---- a/drivers/gpu/drm/vc4/vc4_packet.h -+++ b/drivers/gpu/drm/vc4/vc4_packet.h -@@ -27,60 +27,60 @@ - #include "vc4_regs.h" /* for VC4_MASK, VC4_GET_FIELD, VC4_SET_FIELD */ - - enum vc4_packet { -- VC4_PACKET_HALT = 0, -- VC4_PACKET_NOP = 1, -- -- VC4_PACKET_FLUSH = 4, -- VC4_PACKET_FLUSH_ALL = 5, -- VC4_PACKET_START_TILE_BINNING = 6, -- VC4_PACKET_INCREMENT_SEMAPHORE = 7, -- VC4_PACKET_WAIT_ON_SEMAPHORE = 8, -- -- VC4_PACKET_BRANCH = 16, -- VC4_PACKET_BRANCH_TO_SUB_LIST = 17, -- -- VC4_PACKET_STORE_MS_TILE_BUFFER = 24, -- VC4_PACKET_STORE_MS_TILE_BUFFER_AND_EOF = 25, -- VC4_PACKET_STORE_FULL_RES_TILE_BUFFER = 26, -- VC4_PACKET_LOAD_FULL_RES_TILE_BUFFER = 27, -- VC4_PACKET_STORE_TILE_BUFFER_GENERAL = 28, -- VC4_PACKET_LOAD_TILE_BUFFER_GENERAL = 29, -- -- VC4_PACKET_GL_INDEXED_PRIMITIVE = 32, -- VC4_PACKET_GL_ARRAY_PRIMITIVE = 33, -- -- VC4_PACKET_COMPRESSED_PRIMITIVE = 48, -- VC4_PACKET_CLIPPED_COMPRESSED_PRIMITIVE = 49, -- -- VC4_PACKET_PRIMITIVE_LIST_FORMAT = 56, -- -- VC4_PACKET_GL_SHADER_STATE = 64, -- VC4_PACKET_NV_SHADER_STATE = 65, -- VC4_PACKET_VG_SHADER_STATE = 66, -- -- VC4_PACKET_CONFIGURATION_BITS = 96, -- VC4_PACKET_FLAT_SHADE_FLAGS = 97, -- VC4_PACKET_POINT_SIZE = 98, -- VC4_PACKET_LINE_WIDTH = 99, -- VC4_PACKET_RHT_X_BOUNDARY = 100, -- VC4_PACKET_DEPTH_OFFSET = 101, -- VC4_PACKET_CLIP_WINDOW = 102, -- VC4_PACKET_VIEWPORT_OFFSET = 103, -- VC4_PACKET_Z_CLIPPING = 104, -- VC4_PACKET_CLIPPER_XY_SCALING = 105, -- VC4_PACKET_CLIPPER_Z_SCALING = 106, -- -- VC4_PACKET_TILE_BINNING_MODE_CONFIG = 112, -- VC4_PACKET_TILE_RENDERING_MODE_CONFIG = 113, -- VC4_PACKET_CLEAR_COLORS = 114, -- VC4_PACKET_TILE_COORDINATES = 115, -- -- /* Not an actual hardware packet -- this is what we use to put -- * references to GEM bos in the command stream, since we need the u32 -- * int the actual address packet in order to store the offset from the -- * start of the BO. -- */ -- VC4_PACKET_GEM_HANDLES = 254, -+ VC4_PACKET_HALT = 0, -+ VC4_PACKET_NOP = 1, -+ -+ VC4_PACKET_FLUSH = 4, -+ VC4_PACKET_FLUSH_ALL = 5, -+ VC4_PACKET_START_TILE_BINNING = 6, -+ VC4_PACKET_INCREMENT_SEMAPHORE = 7, -+ VC4_PACKET_WAIT_ON_SEMAPHORE = 8, -+ -+ VC4_PACKET_BRANCH = 16, -+ VC4_PACKET_BRANCH_TO_SUB_LIST = 17, -+ -+ VC4_PACKET_STORE_MS_TILE_BUFFER = 24, -+ VC4_PACKET_STORE_MS_TILE_BUFFER_AND_EOF = 25, -+ VC4_PACKET_STORE_FULL_RES_TILE_BUFFER = 26, -+ VC4_PACKET_LOAD_FULL_RES_TILE_BUFFER = 27, -+ VC4_PACKET_STORE_TILE_BUFFER_GENERAL = 28, -+ VC4_PACKET_LOAD_TILE_BUFFER_GENERAL = 29, -+ -+ VC4_PACKET_GL_INDEXED_PRIMITIVE = 32, -+ VC4_PACKET_GL_ARRAY_PRIMITIVE = 33, -+ -+ VC4_PACKET_COMPRESSED_PRIMITIVE = 48, -+ VC4_PACKET_CLIPPED_COMPRESSED_PRIMITIVE = 49, -+ -+ VC4_PACKET_PRIMITIVE_LIST_FORMAT = 56, -+ -+ VC4_PACKET_GL_SHADER_STATE = 64, -+ VC4_PACKET_NV_SHADER_STATE = 65, -+ VC4_PACKET_VG_SHADER_STATE = 66, -+ -+ VC4_PACKET_CONFIGURATION_BITS = 96, -+ VC4_PACKET_FLAT_SHADE_FLAGS = 97, -+ VC4_PACKET_POINT_SIZE = 98, -+ VC4_PACKET_LINE_WIDTH = 99, -+ VC4_PACKET_RHT_X_BOUNDARY = 100, -+ VC4_PACKET_DEPTH_OFFSET = 101, -+ VC4_PACKET_CLIP_WINDOW = 102, -+ VC4_PACKET_VIEWPORT_OFFSET = 103, -+ VC4_PACKET_Z_CLIPPING = 104, -+ VC4_PACKET_CLIPPER_XY_SCALING = 105, -+ VC4_PACKET_CLIPPER_Z_SCALING = 106, -+ -+ VC4_PACKET_TILE_BINNING_MODE_CONFIG = 112, -+ VC4_PACKET_TILE_RENDERING_MODE_CONFIG = 113, -+ VC4_PACKET_CLEAR_COLORS = 114, -+ VC4_PACKET_TILE_COORDINATES = 115, -+ -+ /* Not an actual hardware packet -- this is what we use to put -+ * references to GEM bos in the command stream, since we need the u32 -+ * int the actual address packet in order to store the offset from the -+ * start of the BO. -+ */ -+ VC4_PACKET_GEM_HANDLES = 254, - } __attribute__ ((__packed__)); - - #define VC4_PACKET_HALT_SIZE 1 -@@ -148,10 +148,10 @@ enum vc4_packet { - * VC4_PACKET_LOAD_TILE_BUFFER_GENERAL (low bits of the address) - */ - --#define VC4_LOADSTORE_TILE_BUFFER_EOF (1 << 3) --#define VC4_LOADSTORE_TILE_BUFFER_DISABLE_FULL_VG_MASK (1 << 2) --#define VC4_LOADSTORE_TILE_BUFFER_DISABLE_FULL_ZS (1 << 1) --#define VC4_LOADSTORE_TILE_BUFFER_DISABLE_FULL_COLOR (1 << 0) -+#define VC4_LOADSTORE_TILE_BUFFER_EOF BIT(3) -+#define VC4_LOADSTORE_TILE_BUFFER_DISABLE_FULL_VG_MASK BIT(2) -+#define VC4_LOADSTORE_TILE_BUFFER_DISABLE_FULL_ZS BIT(1) -+#define VC4_LOADSTORE_TILE_BUFFER_DISABLE_FULL_COLOR BIT(0) - - /** @} */ - -@@ -160,10 +160,10 @@ enum vc4_packet { - * byte 0-1 of VC4_PACKET_STORE_TILE_BUFFER_GENERAL and - * VC4_PACKET_LOAD_TILE_BUFFER_GENERAL - */ --#define VC4_STORE_TILE_BUFFER_DISABLE_VG_MASK_CLEAR (1 << 15) --#define VC4_STORE_TILE_BUFFER_DISABLE_ZS_CLEAR (1 << 14) --#define VC4_STORE_TILE_BUFFER_DISABLE_COLOR_CLEAR (1 << 13) --#define VC4_STORE_TILE_BUFFER_DISABLE_SWAP (1 << 12) -+#define VC4_STORE_TILE_BUFFER_DISABLE_VG_MASK_CLEAR BIT(15) -+#define VC4_STORE_TILE_BUFFER_DISABLE_ZS_CLEAR BIT(14) -+#define VC4_STORE_TILE_BUFFER_DISABLE_COLOR_CLEAR BIT(13) -+#define VC4_STORE_TILE_BUFFER_DISABLE_SWAP BIT(12) - - #define VC4_LOADSTORE_TILE_BUFFER_FORMAT_MASK VC4_MASK(9, 8) - #define VC4_LOADSTORE_TILE_BUFFER_FORMAT_SHIFT 8 -@@ -201,28 +201,28 @@ enum vc4_packet { - #define VC4_INDEX_BUFFER_U16 (1 << 4) - - /* This flag is only present in NV shader state. */ --#define VC4_SHADER_FLAG_SHADED_CLIP_COORDS (1 << 3) --#define VC4_SHADER_FLAG_ENABLE_CLIPPING (1 << 2) --#define VC4_SHADER_FLAG_VS_POINT_SIZE (1 << 1) --#define VC4_SHADER_FLAG_FS_SINGLE_THREAD (1 << 0) -+#define VC4_SHADER_FLAG_SHADED_CLIP_COORDS BIT(3) -+#define VC4_SHADER_FLAG_ENABLE_CLIPPING BIT(2) -+#define VC4_SHADER_FLAG_VS_POINT_SIZE BIT(1) -+#define VC4_SHADER_FLAG_FS_SINGLE_THREAD BIT(0) - - /** @{ byte 2 of config bits. */ --#define VC4_CONFIG_BITS_EARLY_Z_UPDATE (1 << 1) --#define VC4_CONFIG_BITS_EARLY_Z (1 << 0) -+#define VC4_CONFIG_BITS_EARLY_Z_UPDATE BIT(1) -+#define VC4_CONFIG_BITS_EARLY_Z BIT(0) - /** @} */ - - /** @{ byte 1 of config bits. */ --#define VC4_CONFIG_BITS_Z_UPDATE (1 << 7) -+#define VC4_CONFIG_BITS_Z_UPDATE BIT(7) - /** same values in this 3-bit field as PIPE_FUNC_* */ - #define VC4_CONFIG_BITS_DEPTH_FUNC_SHIFT 4 --#define VC4_CONFIG_BITS_COVERAGE_READ_LEAVE (1 << 3) -+#define VC4_CONFIG_BITS_COVERAGE_READ_LEAVE BIT(3) - - #define VC4_CONFIG_BITS_COVERAGE_UPDATE_NONZERO (0 << 1) - #define VC4_CONFIG_BITS_COVERAGE_UPDATE_ODD (1 << 1) - #define VC4_CONFIG_BITS_COVERAGE_UPDATE_OR (2 << 1) - #define VC4_CONFIG_BITS_COVERAGE_UPDATE_ZERO (3 << 1) - --#define VC4_CONFIG_BITS_COVERAGE_PIPE_SELECT (1 << 0) -+#define VC4_CONFIG_BITS_COVERAGE_PIPE_SELECT BIT(0) - /** @} */ - - /** @{ byte 0 of config bits. */ -@@ -230,15 +230,15 @@ enum vc4_packet { - #define VC4_CONFIG_BITS_RASTERIZER_OVERSAMPLE_4X (1 << 6) - #define VC4_CONFIG_BITS_RASTERIZER_OVERSAMPLE_16X (2 << 6) - --#define VC4_CONFIG_BITS_AA_POINTS_AND_LINES (1 << 4) --#define VC4_CONFIG_BITS_ENABLE_DEPTH_OFFSET (1 << 3) --#define VC4_CONFIG_BITS_CW_PRIMITIVES (1 << 2) --#define VC4_CONFIG_BITS_ENABLE_PRIM_BACK (1 << 1) --#define VC4_CONFIG_BITS_ENABLE_PRIM_FRONT (1 << 0) -+#define VC4_CONFIG_BITS_AA_POINTS_AND_LINES BIT(4) -+#define VC4_CONFIG_BITS_ENABLE_DEPTH_OFFSET BIT(3) -+#define VC4_CONFIG_BITS_CW_PRIMITIVES BIT(2) -+#define VC4_CONFIG_BITS_ENABLE_PRIM_BACK BIT(1) -+#define VC4_CONFIG_BITS_ENABLE_PRIM_FRONT BIT(0) - /** @} */ - - /** @{ bits in the last u8 of VC4_PACKET_TILE_BINNING_MODE_CONFIG */ --#define VC4_BIN_CONFIG_DB_NON_MS (1 << 7) -+#define VC4_BIN_CONFIG_DB_NON_MS BIT(7) - - #define VC4_BIN_CONFIG_ALLOC_BLOCK_SIZE_MASK VC4_MASK(6, 5) - #define VC4_BIN_CONFIG_ALLOC_BLOCK_SIZE_SHIFT 5 -@@ -254,17 +254,17 @@ enum vc4_packet { - #define VC4_BIN_CONFIG_ALLOC_INIT_BLOCK_SIZE_128 2 - #define VC4_BIN_CONFIG_ALLOC_INIT_BLOCK_SIZE_256 3 - --#define VC4_BIN_CONFIG_AUTO_INIT_TSDA (1 << 2) --#define VC4_BIN_CONFIG_TILE_BUFFER_64BIT (1 << 1) --#define VC4_BIN_CONFIG_MS_MODE_4X (1 << 0) -+#define VC4_BIN_CONFIG_AUTO_INIT_TSDA BIT(2) -+#define VC4_BIN_CONFIG_TILE_BUFFER_64BIT BIT(1) -+#define VC4_BIN_CONFIG_MS_MODE_4X BIT(0) - /** @} */ - - /** @{ bits in the last u16 of VC4_PACKET_TILE_RENDERING_MODE_CONFIG */ --#define VC4_RENDER_CONFIG_DB_NON_MS (1 << 12) --#define VC4_RENDER_CONFIG_EARLY_Z_COVERAGE_DISABLE (1 << 11) --#define VC4_RENDER_CONFIG_EARLY_Z_DIRECTION_G (1 << 10) --#define VC4_RENDER_CONFIG_COVERAGE_MODE (1 << 9) --#define VC4_RENDER_CONFIG_ENABLE_VG_MASK (1 << 8) -+#define VC4_RENDER_CONFIG_DB_NON_MS BIT(12) -+#define VC4_RENDER_CONFIG_EARLY_Z_COVERAGE_DISABLE BIT(11) -+#define VC4_RENDER_CONFIG_EARLY_Z_DIRECTION_G BIT(10) -+#define VC4_RENDER_CONFIG_COVERAGE_MODE BIT(9) -+#define VC4_RENDER_CONFIG_ENABLE_VG_MASK BIT(8) - - /** The values of the field are VC4_TILING_FORMAT_* */ - #define VC4_RENDER_CONFIG_MEMORY_FORMAT_MASK VC4_MASK(7, 6) -@@ -280,8 +280,8 @@ enum vc4_packet { - #define VC4_RENDER_CONFIG_FORMAT_RGBA8888 1 - #define VC4_RENDER_CONFIG_FORMAT_BGR565 2 - --#define VC4_RENDER_CONFIG_TILE_BUFFER_64BIT (1 << 1) --#define VC4_RENDER_CONFIG_MS_MODE_4X (1 << 0) -+#define VC4_RENDER_CONFIG_TILE_BUFFER_64BIT BIT(1) -+#define VC4_RENDER_CONFIG_MS_MODE_4X BIT(0) - - #define VC4_PRIMITIVE_LIST_FORMAT_16_INDEX (1 << 4) - #define VC4_PRIMITIVE_LIST_FORMAT_32_XY (3 << 4) -@@ -291,24 +291,24 @@ enum vc4_packet { - #define VC4_PRIMITIVE_LIST_FORMAT_TYPE_RHT (3 << 0) - - enum vc4_texture_data_type { -- VC4_TEXTURE_TYPE_RGBA8888 = 0, -- VC4_TEXTURE_TYPE_RGBX8888 = 1, -- VC4_TEXTURE_TYPE_RGBA4444 = 2, -- VC4_TEXTURE_TYPE_RGBA5551 = 3, -- VC4_TEXTURE_TYPE_RGB565 = 4, -- VC4_TEXTURE_TYPE_LUMINANCE = 5, -- VC4_TEXTURE_TYPE_ALPHA = 6, -- VC4_TEXTURE_TYPE_LUMALPHA = 7, -- VC4_TEXTURE_TYPE_ETC1 = 8, -- VC4_TEXTURE_TYPE_S16F = 9, -- VC4_TEXTURE_TYPE_S8 = 10, -- VC4_TEXTURE_TYPE_S16 = 11, -- VC4_TEXTURE_TYPE_BW1 = 12, -- VC4_TEXTURE_TYPE_A4 = 13, -- VC4_TEXTURE_TYPE_A1 = 14, -- VC4_TEXTURE_TYPE_RGBA64 = 15, -- VC4_TEXTURE_TYPE_RGBA32R = 16, -- VC4_TEXTURE_TYPE_YUV422R = 17, -+ VC4_TEXTURE_TYPE_RGBA8888 = 0, -+ VC4_TEXTURE_TYPE_RGBX8888 = 1, -+ VC4_TEXTURE_TYPE_RGBA4444 = 2, -+ VC4_TEXTURE_TYPE_RGBA5551 = 3, -+ VC4_TEXTURE_TYPE_RGB565 = 4, -+ VC4_TEXTURE_TYPE_LUMINANCE = 5, -+ VC4_TEXTURE_TYPE_ALPHA = 6, -+ VC4_TEXTURE_TYPE_LUMALPHA = 7, -+ VC4_TEXTURE_TYPE_ETC1 = 8, -+ VC4_TEXTURE_TYPE_S16F = 9, -+ VC4_TEXTURE_TYPE_S8 = 10, -+ VC4_TEXTURE_TYPE_S16 = 11, -+ VC4_TEXTURE_TYPE_BW1 = 12, -+ VC4_TEXTURE_TYPE_A4 = 13, -+ VC4_TEXTURE_TYPE_A1 = 14, -+ VC4_TEXTURE_TYPE_RGBA64 = 15, -+ VC4_TEXTURE_TYPE_RGBA32R = 16, -+ VC4_TEXTURE_TYPE_YUV422R = 17, - }; - - #define VC4_TEX_P0_OFFSET_MASK VC4_MASK(31, 12) -diff --git a/drivers/gpu/drm/vc4/vc4_qpu_defines.h b/drivers/gpu/drm/vc4/vc4_qpu_defines.h -index e47c994..d5c2f3c 100644 ---- a/drivers/gpu/drm/vc4/vc4_qpu_defines.h -+++ b/drivers/gpu/drm/vc4/vc4_qpu_defines.h -@@ -25,194 +25,190 @@ - #define VC4_QPU_DEFINES_H - - enum qpu_op_add { -- QPU_A_NOP, -- QPU_A_FADD, -- QPU_A_FSUB, -- QPU_A_FMIN, -- QPU_A_FMAX, -- QPU_A_FMINABS, -- QPU_A_FMAXABS, -- QPU_A_FTOI, -- QPU_A_ITOF, -- QPU_A_ADD = 12, -- QPU_A_SUB, -- QPU_A_SHR, -- QPU_A_ASR, -- QPU_A_ROR, -- QPU_A_SHL, -- QPU_A_MIN, -- QPU_A_MAX, -- QPU_A_AND, -- QPU_A_OR, -- QPU_A_XOR, -- QPU_A_NOT, -- QPU_A_CLZ, -- QPU_A_V8ADDS = 30, -- QPU_A_V8SUBS = 31, -+ QPU_A_NOP, -+ QPU_A_FADD, -+ QPU_A_FSUB, -+ QPU_A_FMIN, -+ QPU_A_FMAX, -+ QPU_A_FMINABS, -+ QPU_A_FMAXABS, -+ QPU_A_FTOI, -+ QPU_A_ITOF, -+ QPU_A_ADD = 12, -+ QPU_A_SUB, -+ QPU_A_SHR, -+ QPU_A_ASR, -+ QPU_A_ROR, -+ QPU_A_SHL, -+ QPU_A_MIN, -+ QPU_A_MAX, -+ QPU_A_AND, -+ QPU_A_OR, -+ QPU_A_XOR, -+ QPU_A_NOT, -+ QPU_A_CLZ, -+ QPU_A_V8ADDS = 30, -+ QPU_A_V8SUBS = 31, - }; - - enum qpu_op_mul { -- QPU_M_NOP, -- QPU_M_FMUL, -- QPU_M_MUL24, -- QPU_M_V8MULD, -- QPU_M_V8MIN, -- QPU_M_V8MAX, -- QPU_M_V8ADDS, -- QPU_M_V8SUBS, -+ QPU_M_NOP, -+ QPU_M_FMUL, -+ QPU_M_MUL24, -+ QPU_M_V8MULD, -+ QPU_M_V8MIN, -+ QPU_M_V8MAX, -+ QPU_M_V8ADDS, -+ QPU_M_V8SUBS, - }; - - enum qpu_raddr { -- QPU_R_FRAG_PAYLOAD_ZW = 15, /* W for A file, Z for B file */ -- /* 0-31 are the plain regfile a or b fields */ -- QPU_R_UNIF = 32, -- QPU_R_VARY = 35, -- QPU_R_ELEM_QPU = 38, -- QPU_R_NOP, -- QPU_R_XY_PIXEL_COORD = 41, -- QPU_R_MS_REV_FLAGS = 41, -- QPU_R_VPM = 48, -- QPU_R_VPM_LD_BUSY, -- QPU_R_VPM_LD_WAIT, -- QPU_R_MUTEX_ACQUIRE, -+ QPU_R_FRAG_PAYLOAD_ZW = 15, /* W for A file, Z for B file */ -+ /* 0-31 are the plain regfile a or b fields */ -+ QPU_R_UNIF = 32, -+ QPU_R_VARY = 35, -+ QPU_R_ELEM_QPU = 38, -+ QPU_R_NOP, -+ QPU_R_XY_PIXEL_COORD = 41, -+ QPU_R_MS_REV_FLAGS = 41, -+ QPU_R_VPM = 48, -+ QPU_R_VPM_LD_BUSY, -+ QPU_R_VPM_LD_WAIT, -+ QPU_R_MUTEX_ACQUIRE, - }; - - enum qpu_waddr { -- /* 0-31 are the plain regfile a or b fields */ -- QPU_W_ACC0 = 32, /* aka r0 */ -- QPU_W_ACC1, -- QPU_W_ACC2, -- QPU_W_ACC3, -- QPU_W_TMU_NOSWAP, -- QPU_W_ACC5, -- QPU_W_HOST_INT, -- QPU_W_NOP, -- QPU_W_UNIFORMS_ADDRESS, -- QPU_W_QUAD_XY, /* X for regfile a, Y for regfile b */ -- QPU_W_MS_FLAGS = 42, -- QPU_W_REV_FLAG = 42, -- QPU_W_TLB_STENCIL_SETUP = 43, -- QPU_W_TLB_Z, -- QPU_W_TLB_COLOR_MS, -- QPU_W_TLB_COLOR_ALL, -- QPU_W_TLB_ALPHA_MASK, -- QPU_W_VPM, -- QPU_W_VPMVCD_SETUP, /* LD for regfile a, ST for regfile b */ -- QPU_W_VPM_ADDR, /* LD for regfile a, ST for regfile b */ -- QPU_W_MUTEX_RELEASE, -- QPU_W_SFU_RECIP, -- QPU_W_SFU_RECIPSQRT, -- QPU_W_SFU_EXP, -- QPU_W_SFU_LOG, -- QPU_W_TMU0_S, -- QPU_W_TMU0_T, -- QPU_W_TMU0_R, -- QPU_W_TMU0_B, -- QPU_W_TMU1_S, -- QPU_W_TMU1_T, -- QPU_W_TMU1_R, -- QPU_W_TMU1_B, -+ /* 0-31 are the plain regfile a or b fields */ -+ QPU_W_ACC0 = 32, /* aka r0 */ -+ QPU_W_ACC1, -+ QPU_W_ACC2, -+ QPU_W_ACC3, -+ QPU_W_TMU_NOSWAP, -+ QPU_W_ACC5, -+ QPU_W_HOST_INT, -+ QPU_W_NOP, -+ QPU_W_UNIFORMS_ADDRESS, -+ QPU_W_QUAD_XY, /* X for regfile a, Y for regfile b */ -+ QPU_W_MS_FLAGS = 42, -+ QPU_W_REV_FLAG = 42, -+ QPU_W_TLB_STENCIL_SETUP = 43, -+ QPU_W_TLB_Z, -+ QPU_W_TLB_COLOR_MS, -+ QPU_W_TLB_COLOR_ALL, -+ QPU_W_TLB_ALPHA_MASK, -+ QPU_W_VPM, -+ QPU_W_VPMVCD_SETUP, /* LD for regfile a, ST for regfile b */ -+ QPU_W_VPM_ADDR, /* LD for regfile a, ST for regfile b */ -+ QPU_W_MUTEX_RELEASE, -+ QPU_W_SFU_RECIP, -+ QPU_W_SFU_RECIPSQRT, -+ QPU_W_SFU_EXP, -+ QPU_W_SFU_LOG, -+ QPU_W_TMU0_S, -+ QPU_W_TMU0_T, -+ QPU_W_TMU0_R, -+ QPU_W_TMU0_B, -+ QPU_W_TMU1_S, -+ QPU_W_TMU1_T, -+ QPU_W_TMU1_R, -+ QPU_W_TMU1_B, - }; - - enum qpu_sig_bits { -- QPU_SIG_SW_BREAKPOINT, -- QPU_SIG_NONE, -- QPU_SIG_THREAD_SWITCH, -- QPU_SIG_PROG_END, -- QPU_SIG_WAIT_FOR_SCOREBOARD, -- QPU_SIG_SCOREBOARD_UNLOCK, -- QPU_SIG_LAST_THREAD_SWITCH, -- QPU_SIG_COVERAGE_LOAD, -- QPU_SIG_COLOR_LOAD, -- QPU_SIG_COLOR_LOAD_END, -- QPU_SIG_LOAD_TMU0, -- QPU_SIG_LOAD_TMU1, -- QPU_SIG_ALPHA_MASK_LOAD, -- QPU_SIG_SMALL_IMM, -- QPU_SIG_LOAD_IMM, -- QPU_SIG_BRANCH -+ QPU_SIG_SW_BREAKPOINT, -+ QPU_SIG_NONE, -+ QPU_SIG_THREAD_SWITCH, -+ QPU_SIG_PROG_END, -+ QPU_SIG_WAIT_FOR_SCOREBOARD, -+ QPU_SIG_SCOREBOARD_UNLOCK, -+ QPU_SIG_LAST_THREAD_SWITCH, -+ QPU_SIG_COVERAGE_LOAD, -+ QPU_SIG_COLOR_LOAD, -+ QPU_SIG_COLOR_LOAD_END, -+ QPU_SIG_LOAD_TMU0, -+ QPU_SIG_LOAD_TMU1, -+ QPU_SIG_ALPHA_MASK_LOAD, -+ QPU_SIG_SMALL_IMM, -+ QPU_SIG_LOAD_IMM, -+ QPU_SIG_BRANCH - }; - - enum qpu_mux { -- /* hardware mux values */ -- QPU_MUX_R0, -- QPU_MUX_R1, -- QPU_MUX_R2, -- QPU_MUX_R3, -- QPU_MUX_R4, -- QPU_MUX_R5, -- QPU_MUX_A, -- QPU_MUX_B, -+ /* hardware mux values */ -+ QPU_MUX_R0, -+ QPU_MUX_R1, -+ QPU_MUX_R2, -+ QPU_MUX_R3, -+ QPU_MUX_R4, -+ QPU_MUX_R5, -+ QPU_MUX_A, -+ QPU_MUX_B, - -- /* non-hardware mux values */ -- QPU_MUX_IMM, -+ /* non-hardware mux values */ -+ QPU_MUX_IMM, - }; - - enum qpu_cond { -- QPU_COND_NEVER, -- QPU_COND_ALWAYS, -- QPU_COND_ZS, -- QPU_COND_ZC, -- QPU_COND_NS, -- QPU_COND_NC, -- QPU_COND_CS, -- QPU_COND_CC, -+ QPU_COND_NEVER, -+ QPU_COND_ALWAYS, -+ QPU_COND_ZS, -+ QPU_COND_ZC, -+ QPU_COND_NS, -+ QPU_COND_NC, -+ QPU_COND_CS, -+ QPU_COND_CC, - }; - - enum qpu_pack_mul { -- QPU_PACK_MUL_NOP, -- QPU_PACK_MUL_8888 = 3, /* replicated to each 8 bits of the 32-bit dst. */ -- QPU_PACK_MUL_8A, -- QPU_PACK_MUL_8B, -- QPU_PACK_MUL_8C, -- QPU_PACK_MUL_8D, -+ QPU_PACK_MUL_NOP, -+ /* replicated to each 8 bits of the 32-bit dst. */ -+ QPU_PACK_MUL_8888 = 3, -+ QPU_PACK_MUL_8A, -+ QPU_PACK_MUL_8B, -+ QPU_PACK_MUL_8C, -+ QPU_PACK_MUL_8D, - }; - - enum qpu_pack_a { -- QPU_PACK_A_NOP, -- /* convert to 16 bit float if float input, or to int16. */ -- QPU_PACK_A_16A, -- QPU_PACK_A_16B, -- /* replicated to each 8 bits of the 32-bit dst. */ -- QPU_PACK_A_8888, -- /* Convert to 8-bit unsigned int. */ -- QPU_PACK_A_8A, -- QPU_PACK_A_8B, -- QPU_PACK_A_8C, -- QPU_PACK_A_8D, -+ QPU_PACK_A_NOP, -+ /* convert to 16 bit float if float input, or to int16. */ -+ QPU_PACK_A_16A, -+ QPU_PACK_A_16B, -+ /* replicated to each 8 bits of the 32-bit dst. */ -+ QPU_PACK_A_8888, -+ /* Convert to 8-bit unsigned int. */ -+ QPU_PACK_A_8A, -+ QPU_PACK_A_8B, -+ QPU_PACK_A_8C, -+ QPU_PACK_A_8D, - -- /* Saturating variants of the previous instructions. */ -- QPU_PACK_A_32_SAT, /* int-only */ -- QPU_PACK_A_16A_SAT, /* int or float */ -- QPU_PACK_A_16B_SAT, -- QPU_PACK_A_8888_SAT, -- QPU_PACK_A_8A_SAT, -- QPU_PACK_A_8B_SAT, -- QPU_PACK_A_8C_SAT, -- QPU_PACK_A_8D_SAT, -+ /* Saturating variants of the previous instructions. */ -+ QPU_PACK_A_32_SAT, /* int-only */ -+ QPU_PACK_A_16A_SAT, /* int or float */ -+ QPU_PACK_A_16B_SAT, -+ QPU_PACK_A_8888_SAT, -+ QPU_PACK_A_8A_SAT, -+ QPU_PACK_A_8B_SAT, -+ QPU_PACK_A_8C_SAT, -+ QPU_PACK_A_8D_SAT, - }; - - enum qpu_unpack_r4 { -- QPU_UNPACK_R4_NOP, -- QPU_UNPACK_R4_F16A_TO_F32, -- QPU_UNPACK_R4_F16B_TO_F32, -- QPU_UNPACK_R4_8D_REP, -- QPU_UNPACK_R4_8A, -- QPU_UNPACK_R4_8B, -- QPU_UNPACK_R4_8C, -- QPU_UNPACK_R4_8D, -+ QPU_UNPACK_R4_NOP, -+ QPU_UNPACK_R4_F16A_TO_F32, -+ QPU_UNPACK_R4_F16B_TO_F32, -+ QPU_UNPACK_R4_8D_REP, -+ QPU_UNPACK_R4_8A, -+ QPU_UNPACK_R4_8B, -+ QPU_UNPACK_R4_8C, -+ QPU_UNPACK_R4_8D, - }; - --#define QPU_MASK(high, low) ((((uint64_t)1<<((high)-(low)+1))-1)<<(low)) --/* Using the GNU statement expression extension */ --#define QPU_SET_FIELD(value, field) \ -- ({ \ -- uint64_t fieldval = (uint64_t)(value) << field ## _SHIFT; \ -- assert((fieldval & ~ field ## _MASK) == 0); \ -- fieldval & field ## _MASK; \ -- }) -+#define QPU_MASK(high, low) \ -+ ((((uint64_t)1 << ((high) - (low) + 1)) - 1) << (low)) - --#define QPU_GET_FIELD(word, field) ((uint32_t)(((word) & field ## _MASK) >> field ## _SHIFT)) -+#define QPU_GET_FIELD(word, field) \ -+ ((uint32_t)(((word) & field ## _MASK) >> field ## _SHIFT)) - - #define QPU_SIG_SHIFT 60 - #define QPU_SIG_MASK QPU_MASK(63, 60) -diff --git a/drivers/gpu/drm/vc4/vc4_render_cl.c b/drivers/gpu/drm/vc4/vc4_render_cl.c -index 0ffac8d..3516354 100644 ---- a/drivers/gpu/drm/vc4/vc4_render_cl.c -+++ b/drivers/gpu/drm/vc4/vc4_render_cl.c -@@ -63,7 +63,6 @@ static inline void rcl_u32(struct vc4_rcl_setup *setup, u32 val) - setup->next_offset += 4; - } - -- - /* - * Emits a no-op STORE_TILE_BUFFER_GENERAL. - * -@@ -217,7 +216,7 @@ static int vc4_create_rcl_bo(struct drm_device *dev, struct vc4_exec_info *exec, - } - size += xtiles * ytiles * loop_body_size; - -- setup->rcl = &vc4_bo_create(dev, size)->base; -+ setup->rcl = &vc4_bo_create(dev, size, true)->base; - if (!setup->rcl) - return -ENOMEM; - list_add_tail(&to_vc4_bo(&setup->rcl->base)->unref_head, -@@ -256,6 +255,7 @@ static int vc4_create_rcl_bo(struct drm_device *dev, struct vc4_exec_info *exec, - for (x = min_x_tile; x <= max_x_tile; x++) { - bool first = (x == min_x_tile && y == min_y_tile); - bool last = (x == max_x_tile && y == max_y_tile); ++ pte_unmap_unlock(pte, ptl); ++ } ++ if (!atomic) ++ up_read(&current->mm->mmap_sem); + - emit_tile(exec, setup, x, y, first, last); - } - } -diff --git a/drivers/gpu/drm/vc4/vc4_v3d.c b/drivers/gpu/drm/vc4/vc4_v3d.c -index cf35f58..29a222f 100644 ---- a/drivers/gpu/drm/vc4/vc4_v3d.c -+++ b/drivers/gpu/drm/vc4/vc4_v3d.c -@@ -125,7 +125,7 @@ int vc4_v3d_debugfs_regs(struct seq_file *m, void *unused) - - int vc4_v3d_debugfs_ident(struct seq_file *m, void *unused) - { -- struct drm_info_node *node = (struct drm_info_node *) m->private; -+ struct drm_info_node *node = (struct drm_info_node *)m->private; - struct drm_device *dev = node->minor->dev; - struct vc4_dev *vc4 = to_vc4_dev(dev); - uint32_t ident1 = V3D_READ(V3D_IDENT1); -@@ -133,11 +133,13 @@ int vc4_v3d_debugfs_ident(struct seq_file *m, void *unused) - uint32_t tups = VC4_GET_FIELD(ident1, V3D_IDENT1_TUPS); - uint32_t qups = VC4_GET_FIELD(ident1, V3D_IDENT1_QUPS); - -- seq_printf(m, "Revision: %d\n", VC4_GET_FIELD(ident1, V3D_IDENT1_REV)); -+ seq_printf(m, "Revision: %d\n", -+ VC4_GET_FIELD(ident1, V3D_IDENT1_REV)); - seq_printf(m, "Slices: %d\n", nslc); - seq_printf(m, "TMUs: %d\n", nslc * tups); - seq_printf(m, "QPUs: %d\n", nslc * qups); -- seq_printf(m, "Semaphores: %d\n", VC4_GET_FIELD(ident1, V3D_IDENT1_NSEM)); -+ seq_printf(m, "Semaphores: %d\n", -+ VC4_GET_FIELD(ident1, V3D_IDENT1_NSEM)); - - return 0; - } -@@ -218,7 +220,7 @@ static int vc4_v3d_bind(struct device *dev, struct device *master, void *data) - } - - static void vc4_v3d_unbind(struct device *dev, struct device *master, -- void *data) -+ void *data) - { - struct drm_device *drm = dev_get_drvdata(master); - struct vc4_dev *vc4 = to_vc4_dev(drm); -diff --git a/drivers/gpu/drm/vc4/vc4_validate.c b/drivers/gpu/drm/vc4/vc4_validate.c -index ff3b62f..e44e35539 100644 ---- a/drivers/gpu/drm/vc4/vc4_validate.c -+++ b/drivers/gpu/drm/vc4/vc4_validate.c -@@ -48,7 +48,6 @@ - void *validated, \ - void *untrusted - -- - /** Return the width in pixels of a 64-byte microtile. */ - static uint32_t - utile_width(int cpp) -@@ -192,7 +191,7 @@ vc4_check_tex_size(struct vc4_exec_info *exec, struct drm_gem_cma_object *fbo, - - if (size + offset < size || - size + offset > fbo->base.size) { -- DRM_ERROR("Overflow in %dx%d (%dx%d) fbo size (%d + %d > %d)\n", -+ DRM_ERROR("Overflow in %dx%d (%dx%d) fbo size (%d + %d > %zd)\n", - width, height, - aligned_width, aligned_height, - size, offset, fbo->base.size); -@@ -278,7 +277,7 @@ validate_indexed_prim_list(VALIDATE_ARGS) - - if (offset > ib->base.size || - (ib->base.size - offset) / index_size < length) { -- DRM_ERROR("IB access overflow (%d + %d*%d > %d)\n", -+ DRM_ERROR("IB access overflow (%d + %d*%d > %zd)\n", - offset, length, index_size, ib->base.size); - return -EINVAL; - } -@@ -377,6 +376,7 @@ static int - validate_tile_binning_config(VALIDATE_ARGS) ++out: ++ return n; ++} ++ + unsigned long + arm_copy_to_user(void __user *to, const void *from, unsigned long n) { - struct drm_device *dev = exec->exec_bo->base.dev; -+ struct vc4_bo *tile_bo; - uint8_t flags; - uint32_t tile_state_size, tile_alloc_size; - uint32_t tile_count; -@@ -438,12 +438,12 @@ validate_tile_binning_config(VALIDATE_ARGS) - */ - tile_alloc_size += 1024 * 1024; - -- exec->tile_bo = &vc4_bo_create(dev, exec->tile_alloc_offset + -- tile_alloc_size)->base; -+ tile_bo = vc4_bo_create(dev, exec->tile_alloc_offset + tile_alloc_size, -+ true); -+ exec->tile_bo = &tile_bo->base; - if (!exec->tile_bo) - return -ENOMEM; -- list_add_tail(&to_vc4_bo(&exec->tile_bo->base)->unref_head, -- &exec->unref_list); -+ list_add_tail(&tile_bo->unref_head, &exec->unref_list); - - /* tile alloc address. */ - *(uint32_t *)(validated + 0) = (exec->tile_bo->paddr + -@@ -463,8 +463,8 @@ validate_gem_handles(VALIDATE_ARGS) - return 0; - } - --#define VC4_DEFINE_PACKET(packet, name, func) \ -- [packet] = { packet ## _SIZE, name, func } -+#define VC4_DEFINE_PACKET(packet, func) \ -+ [packet] = { packet ## _SIZE, #packet, func } - - static const struct cmd_info { - uint16_t len; -@@ -472,42 +472,43 @@ static const struct cmd_info { - int (*func)(struct vc4_exec_info *exec, void *validated, - void *untrusted); - } cmd_info[] = { -- VC4_DEFINE_PACKET(VC4_PACKET_HALT, "halt", NULL), -- VC4_DEFINE_PACKET(VC4_PACKET_NOP, "nop", NULL), -- VC4_DEFINE_PACKET(VC4_PACKET_FLUSH, "flush", NULL), -- VC4_DEFINE_PACKET(VC4_PACKET_FLUSH_ALL, "flush all state", validate_flush_all), -- VC4_DEFINE_PACKET(VC4_PACKET_START_TILE_BINNING, "start tile binning", validate_start_tile_binning), -- VC4_DEFINE_PACKET(VC4_PACKET_INCREMENT_SEMAPHORE, "increment semaphore", validate_increment_semaphore), -- -- VC4_DEFINE_PACKET(VC4_PACKET_GL_INDEXED_PRIMITIVE, "Indexed Primitive List", validate_indexed_prim_list), -- -- VC4_DEFINE_PACKET(VC4_PACKET_GL_ARRAY_PRIMITIVE, "Vertex Array Primitives", validate_gl_array_primitive), -- -- /* This is only used by clipped primitives (packets 48 and 49), which -- * we don't support parsing yet. -- */ -- VC4_DEFINE_PACKET(VC4_PACKET_PRIMITIVE_LIST_FORMAT, "primitive list format", NULL), -- -- VC4_DEFINE_PACKET(VC4_PACKET_GL_SHADER_STATE, "GL Shader State", validate_gl_shader_state), -- VC4_DEFINE_PACKET(VC4_PACKET_NV_SHADER_STATE, "NV Shader State", validate_nv_shader_state), -- -- VC4_DEFINE_PACKET(VC4_PACKET_CONFIGURATION_BITS, "configuration bits", NULL), -- VC4_DEFINE_PACKET(VC4_PACKET_FLAT_SHADE_FLAGS, "flat shade flags", NULL), -- VC4_DEFINE_PACKET(VC4_PACKET_POINT_SIZE, "point size", NULL), -- VC4_DEFINE_PACKET(VC4_PACKET_LINE_WIDTH, "line width", NULL), -- VC4_DEFINE_PACKET(VC4_PACKET_RHT_X_BOUNDARY, "RHT X boundary", NULL), -- VC4_DEFINE_PACKET(VC4_PACKET_DEPTH_OFFSET, "Depth Offset", NULL), -- VC4_DEFINE_PACKET(VC4_PACKET_CLIP_WINDOW, "Clip Window", NULL), -- VC4_DEFINE_PACKET(VC4_PACKET_VIEWPORT_OFFSET, "Viewport Offset", NULL), -- VC4_DEFINE_PACKET(VC4_PACKET_CLIPPER_XY_SCALING, "Clipper XY Scaling", NULL), -+ VC4_DEFINE_PACKET(VC4_PACKET_HALT, NULL), -+ VC4_DEFINE_PACKET(VC4_PACKET_NOP, NULL), -+ VC4_DEFINE_PACKET(VC4_PACKET_FLUSH, NULL), -+ VC4_DEFINE_PACKET(VC4_PACKET_FLUSH_ALL, validate_flush_all), -+ VC4_DEFINE_PACKET(VC4_PACKET_START_TILE_BINNING, -+ validate_start_tile_binning), -+ VC4_DEFINE_PACKET(VC4_PACKET_INCREMENT_SEMAPHORE, -+ validate_increment_semaphore), -+ -+ VC4_DEFINE_PACKET(VC4_PACKET_GL_INDEXED_PRIMITIVE, -+ validate_indexed_prim_list), -+ VC4_DEFINE_PACKET(VC4_PACKET_GL_ARRAY_PRIMITIVE, -+ validate_gl_array_primitive), -+ -+ VC4_DEFINE_PACKET(VC4_PACKET_PRIMITIVE_LIST_FORMAT, NULL), -+ -+ VC4_DEFINE_PACKET(VC4_PACKET_GL_SHADER_STATE, validate_gl_shader_state), -+ VC4_DEFINE_PACKET(VC4_PACKET_NV_SHADER_STATE, validate_nv_shader_state), -+ -+ VC4_DEFINE_PACKET(VC4_PACKET_CONFIGURATION_BITS, NULL), -+ VC4_DEFINE_PACKET(VC4_PACKET_FLAT_SHADE_FLAGS, NULL), -+ VC4_DEFINE_PACKET(VC4_PACKET_POINT_SIZE, NULL), -+ VC4_DEFINE_PACKET(VC4_PACKET_LINE_WIDTH, NULL), -+ VC4_DEFINE_PACKET(VC4_PACKET_RHT_X_BOUNDARY, NULL), -+ VC4_DEFINE_PACKET(VC4_PACKET_DEPTH_OFFSET, NULL), -+ VC4_DEFINE_PACKET(VC4_PACKET_CLIP_WINDOW, NULL), -+ VC4_DEFINE_PACKET(VC4_PACKET_VIEWPORT_OFFSET, NULL), -+ VC4_DEFINE_PACKET(VC4_PACKET_CLIPPER_XY_SCALING, NULL), - /* Note: The docs say this was also 105, but it was 106 in the - * initial userland code drop. +@@ -147,7 +243,7 @@ arm_copy_to_user(void __user *to, const void *from, unsigned long n) + * With frame pointer disabled, tail call optimization kicks in + * as well making this test almost invisible. */ -- VC4_DEFINE_PACKET(VC4_PACKET_CLIPPER_Z_SCALING, "Clipper Z Scale and Offset", NULL), -+ VC4_DEFINE_PACKET(VC4_PACKET_CLIPPER_Z_SCALING, NULL), - -- VC4_DEFINE_PACKET(VC4_PACKET_TILE_BINNING_MODE_CONFIG, "tile binning configuration", validate_tile_binning_config), -+ VC4_DEFINE_PACKET(VC4_PACKET_TILE_BINNING_MODE_CONFIG, -+ validate_tile_binning_config), - -- VC4_DEFINE_PACKET(VC4_PACKET_GEM_HANDLES, "GEM handles", validate_gem_handles), -+ VC4_DEFINE_PACKET(VC4_PACKET_GEM_HANDLES, validate_gem_handles), - }; - - int -@@ -526,7 +527,7 @@ vc4_validate_bin_cl(struct drm_device *dev, - u8 cmd = *(uint8_t *)src_pkt; - const struct cmd_info *info; - -- if (cmd > ARRAY_SIZE(cmd_info)) { -+ if (cmd >= ARRAY_SIZE(cmd_info)) { - DRM_ERROR("0x%08x: packet %d out of bounds\n", - src_offset, cmd); - return -EINVAL; -@@ -539,11 +540,6 @@ vc4_validate_bin_cl(struct drm_device *dev, - return -EINVAL; - } - --#if 0 -- DRM_INFO("0x%08x: packet %d (%s) size %d processing...\n", -- src_offset, cmd, info->name, info->len); --#endif -- - if (src_offset + info->len > len) { - DRM_ERROR("0x%08x: packet %d (%s) length 0x%08x " - "exceeds bounds (0x%08x)\n", -@@ -558,8 +554,7 @@ vc4_validate_bin_cl(struct drm_device *dev, - if (info->func && info->func(exec, - dst_pkt + 1, - src_pkt + 1)) { -- DRM_ERROR("0x%08x: packet %d (%s) failed to " -- "validate\n", -+ DRM_ERROR("0x%08x: packet %d (%s) failed to validate\n", - src_offset, cmd, info->name); - return -EINVAL; - } -@@ -618,12 +613,14 @@ reloc_tex(struct vc4_exec_info *exec, - - if (sample->is_direct) { - uint32_t remaining_size = tex->base.size - p0; -+ - if (p0 > tex->base.size - 4) { - DRM_ERROR("UBO offset greater than UBO size\n"); - goto fail; - } - if (p1 > remaining_size - 4) { -- DRM_ERROR("UBO clamp would allow reads outside of UBO\n"); -+ DRM_ERROR("UBO clamp would allow reads " -+ "outside of UBO\n"); - goto fail; - } - *validated_p0 = tex->paddr + p0; -@@ -786,7 +783,7 @@ validate_shader_rec(struct drm_device *dev, - struct drm_gem_cma_object *bo[ARRAY_SIZE(gl_relocs) + 8]; - uint32_t nr_attributes = 0, nr_fixed_relocs, nr_relocs, packet_size; - int i; -- struct vc4_validated_shader_info *validated_shader; -+ struct vc4_validated_shader_info *shader; - - if (state->packet == VC4_PACKET_NV_SHADER_STATE) { - relocs = nv_relocs; -@@ -841,12 +838,12 @@ validate_shader_rec(struct drm_device *dev, - else - mode = VC4_MODE_RENDER; - -- if (!vc4_use_bo(exec, src_handles[i], mode, &bo[i])) { -+ if (!vc4_use_bo(exec, src_handles[i], mode, &bo[i])) - return false; -- } +- if (n < 64) { ++ if (n < COPY_TO_USER_THRESHOLD) { + unsigned long ua_flags = uaccess_save_and_enable(); + n = __copy_to_user_std(to, from, n); + uaccess_restore(ua_flags); +@@ -156,6 +252,26 @@ arm_copy_to_user(void __user *to, const void *from, unsigned long n) } - - for (i = 0; i < nr_fixed_relocs; i++) { -+ struct vc4_bo *vc4_bo; - uint32_t o = relocs[i].offset; - uint32_t src_offset = *(uint32_t *)(pkt_u + o); - uint32_t *texture_handles_u; -@@ -858,34 +855,34 @@ validate_shader_rec(struct drm_device *dev, - switch (relocs[i].type) { - case RELOC_CODE: - if (src_offset != 0) { -- DRM_ERROR("Shaders must be at offset 0 of " -- "the BO.\n"); -+ DRM_ERROR("Shaders must be at offset 0 " -+ "of the BO.\n"); - goto fail; - } - -- validated_shader = to_vc4_bo(&bo[i]->base)->validated_shader; -- if (!validated_shader) -+ vc4_bo = to_vc4_bo(&bo[i]->base); -+ shader = vc4_bo->validated_shader; -+ if (!shader) - goto fail; - -- if (validated_shader->uniforms_src_size > -- exec->uniforms_size) { -+ if (shader->uniforms_src_size > exec->uniforms_size) { - DRM_ERROR("Uniforms src buffer overflow\n"); - goto fail; - } - - texture_handles_u = exec->uniforms_u; - uniform_data_u = (texture_handles_u + -- validated_shader->num_texture_samples); -+ shader->num_texture_samples); - - memcpy(exec->uniforms_v, uniform_data_u, -- validated_shader->uniforms_size); -+ shader->uniforms_size); - - for (tex = 0; -- tex < validated_shader->num_texture_samples; -+ tex < shader->num_texture_samples; - tex++) { - if (!reloc_tex(exec, - uniform_data_u, -- &validated_shader->texture_samples[tex], -+ &shader->texture_samples[tex], - texture_handles_u[tex])) { - goto fail; - } -@@ -893,9 +890,9 @@ validate_shader_rec(struct drm_device *dev, - - *(uint32_t *)(pkt_v + o + 4) = exec->uniforms_p; - -- exec->uniforms_u += validated_shader->uniforms_src_size; -- exec->uniforms_v += validated_shader->uniforms_size; -- exec->uniforms_p += validated_shader->uniforms_size; -+ exec->uniforms_u += shader->uniforms_src_size; -+ exec->uniforms_v += shader->uniforms_size; -+ exec->uniforms_p += shader->uniforms_size; - - break; - -@@ -926,7 +923,8 @@ validate_shader_rec(struct drm_device *dev, - max_index = ((vbo->base.size - offset - attr_size) / - stride); - if (state->max_index > max_index) { -- DRM_ERROR("primitives use index %d out of supplied %d\n", -+ DRM_ERROR("primitives use index %d out of " -+ "supplied %d\n", - state->max_index, max_index); - return -EINVAL; - } -diff --git a/drivers/gpu/drm/vc4/vc4_validate_shaders.c b/drivers/gpu/drm/vc4/vc4_validate_shaders.c -index 0aab9d7..f67124b 100644 ---- a/drivers/gpu/drm/vc4/vc4_validate_shaders.c -+++ b/drivers/gpu/drm/vc4/vc4_validate_shaders.c -@@ -24,24 +24,16 @@ - /** - * DOC: Shader validator for VC4. - * -- * The VC4 has no IOMMU between it and system memory. So, a user with access -- * to execute shaders could escalate privilege by overwriting system memory -- * (using the VPM write address register in the general-purpose DMA mode) or -- * reading system memory it shouldn't (reading it as a texture, or uniform -- * data, or vertex data). -+ * The VC4 has no IOMMU between it and system memory, so a user with -+ * access to execute shaders could escalate privilege by overwriting -+ * system memory (using the VPM write address register in the -+ * general-purpose DMA mode) or reading system memory it shouldn't -+ * (reading it as a texture, or uniform data, or vertex data). - * -- * This walks over a shader starting from some offset within a BO, ensuring -- * that its accesses are appropriately bounded, and recording how many texture -- * accesses are made and where so that we can do relocations for them in the -+ * This walks over a shader BO, ensuring that its accesses are -+ * appropriately bounded, and recording how many texture accesses are -+ * made and where so that we can do relocations for them in the - * uniform stream. -- * -- * The kernel API has shaders stored in user-mapped BOs. The BOs will be -- * forcibly unmapped from the process before validation, and any cache of -- * validated state will be flushed if the mapping is faulted back in. -- * -- * Storing the shaders in BOs means that the validation process will be slow -- * due to uncached reads, but since shaders are long-lived and shader BOs are -- * never actually modified, this shouldn't be a problem. - */ - - #include "vc4_drv.h" -@@ -70,7 +62,6 @@ waddr_to_live_reg_index(uint32_t waddr, bool is_b) - else - return waddr; - } else if (waddr <= QPU_W_ACC3) { -- - return 64 + waddr - QPU_W_ACC0; - } else { - return ~0; -@@ -85,15 +76,14 @@ raddr_add_a_to_live_reg_index(uint64_t inst) - uint32_t raddr_a = QPU_GET_FIELD(inst, QPU_RADDR_A); - uint32_t raddr_b = QPU_GET_FIELD(inst, QPU_RADDR_B); - -- if (add_a == QPU_MUX_A) { -+ if (add_a == QPU_MUX_A) - return raddr_a; -- } else if (add_a == QPU_MUX_B && sig != QPU_SIG_SMALL_IMM) { -+ else if (add_a == QPU_MUX_B && sig != QPU_SIG_SMALL_IMM) - return 32 + raddr_b; -- } else if (add_a <= QPU_MUX_R3) { -+ else if (add_a <= QPU_MUX_R3) - return 64 + add_a; -- } else { -+ else - return ~0; -- } - } - - static bool -@@ -111,9 +101,9 @@ is_tmu_write(uint32_t waddr) - } - - static bool --record_validated_texture_sample(struct vc4_validated_shader_info *validated_shader, -- struct vc4_shader_validation_state *validation_state, -- int tmu) -+record_texture_sample(struct vc4_validated_shader_info *validated_shader, -+ struct vc4_shader_validation_state *validation_state, -+ int tmu) - { - uint32_t s = validated_shader->num_texture_samples; - int i; -@@ -226,8 +216,8 @@ check_tmu_write(uint64_t inst, - validated_shader->uniforms_size += 4; - - if (submit) { -- if (!record_validated_texture_sample(validated_shader, -- validation_state, tmu)) { -+ if (!record_texture_sample(validated_shader, -+ validation_state, tmu)) { - return false; - } - -@@ -238,10 +228,10 @@ check_tmu_write(uint64_t inst, + return n; } - - static bool --check_register_write(uint64_t inst, -- struct vc4_validated_shader_info *validated_shader, -- struct vc4_shader_validation_state *validation_state, -- bool is_mul) -+check_reg_write(uint64_t inst, -+ struct vc4_validated_shader_info *validated_shader, -+ struct vc4_shader_validation_state *validation_state, -+ bool is_mul) - { - uint32_t waddr = (is_mul ? - QPU_GET_FIELD(inst, QPU_WADDR_MUL) : -@@ -297,7 +287,7 @@ check_register_write(uint64_t inst, - return true; - - case QPU_W_TLB_STENCIL_SETUP: -- return true; -+ return true; - } - - return true; -@@ -360,7 +350,7 @@ track_live_clamps(uint64_t inst, - } - - validation_state->live_max_clamp_regs[lri_add] = true; -- } if (op_add == QPU_A_MIN) { -+ } else if (op_add == QPU_A_MIN) { - /* Track live clamps of a value clamped to a minimum of 0 and - * a maximum of some uniform's offset. - */ -@@ -392,8 +382,10 @@ check_instruction_writes(uint64_t inst, - return false; - } - -- ok = (check_register_write(inst, validated_shader, validation_state, false) && -- check_register_write(inst, validated_shader, validation_state, true)); -+ ok = (check_reg_write(inst, validated_shader, validation_state, -+ false) && -+ check_reg_write(inst, validated_shader, validation_state, -+ true)); - - track_live_clamps(inst, validated_shader, validation_state); - -@@ -441,7 +433,7 @@ vc4_validate_shader(struct drm_gem_cma_object *shader_obj) - shader = shader_obj->vaddr; - max_ip = shader_obj->base.size / sizeof(uint64_t); - -- validated_shader = kcalloc(sizeof(*validated_shader), 1, GFP_KERNEL); -+ validated_shader = kcalloc(1, sizeof(*validated_shader), GFP_KERNEL); - if (!validated_shader) - return NULL; - -@@ -497,7 +489,7 @@ vc4_validate_shader(struct drm_gem_cma_object *shader_obj) - - if (ip == max_ip) { - DRM_ERROR("shader failed to terminate before " -- "shader BO end at %d\n", -+ "shader BO end at %zd\n", - shader_obj->base.size); - goto fail; - } -diff --git a/include/drm/drmP.h b/include/drm/drmP.h -index 54f5469..987c25a 100644 ---- a/include/drm/drmP.h -+++ b/include/drm/drmP.h -@@ -585,6 +585,13 @@ struct drm_driver { - int (*gem_open_object) (struct drm_gem_object *, struct drm_file *); - void (*gem_close_object) (struct drm_gem_object *, struct drm_file *); - -+ /** -+ * Hook for allocating the GEM object struct, for use by core -+ * helpers. ++ ++unsigned long __must_check ++arm_copy_from_user(void *to, const void __user *from, unsigned long n) ++{ ++ /* ++ * This test is stubbed out of the main function above to keep ++ * the overhead for small copies low by avoiding a large ++ * register dump on the stack just to reload them right away. ++ * With frame pointer disabled, tail call optimization kicks in ++ * as well making this test almost invisible. + */ -+ struct drm_gem_object *(*gem_create_object)(struct drm_device *dev, -+ size_t size); -+ - /* prime: */ - /* export handle -> fd (see drm_gem_prime_handle_to_fd() helper) */ - int (*prime_handle_to_fd)(struct drm_device *dev, struct drm_file *file_priv, -@@ -639,7 +646,6 @@ struct drm_driver { - - u32 driver_features; - int dev_priv_size; -- size_t gem_obj_size; - const struct drm_ioctl_desc *ioctls; - int num_ioctls; - const struct file_operations *fops; - -From 7d4ed9f40e9484ded3965b13fbb7914a1daf85d7 Mon Sep 17 00:00:00 2001 -From: Eric Anholt <eric@anholt.net> -Date: Fri, 11 Dec 2015 19:45:03 -0800 -Subject: [PATCH 116/170] drm: Use the driver's gem_object_free function from - CMA helpers. ++ if (n < COPY_TO_USER_THRESHOLD) { ++ unsigned long ua_flags = uaccess_save_and_enable(); ++ n = __copy_from_user_std(to, from, n); ++ uaccess_restore(ua_flags); ++ } else { ++ n = __copy_from_user_memcpy(to, from, n); ++ } ++ return n; ++} + + static unsigned long noinline + __clear_user_memset(void __user *addr, unsigned long n) -VC4 wraps the CMA objects in its own structures, so it needs to do its -own teardown (waiting for GPU to finish, updating bo_stats tracking). -The other CMA drivers are using drm_gem_cma_free_object as their -gem_free_object, so this should be a no-op for them. +From d67c5533e1929885c312599acdf853138761f6ed Mon Sep 17 00:00:00 2001 +From: Phil Elwell <phil@raspberrypi.org> +Date: Thu, 25 Jun 2015 12:16:11 +0100 +Subject: [PATCH 080/112] gpio-poweroff: Allow it to work on Raspberry Pi -Signed-off-by: Eric Anholt <eric@anholt.net> +The Raspberry Pi firmware manages the power-down and reboot +process. To do this it installs a pm_power_off handler, causing +the gpio-poweroff module to abort the probe function. + +This patch introduces a "force" DT property that overrides that +behaviour, and also adds a DT overlay to enable and control it. + +Note that running in an active-low configuration (DT parameter +"active_low") requires a custom dt-blob.bin and probably won't +allow a reboot without switching off, so an external inversion +of the trigger signal may be preferable. --- - drivers/gpu/drm/drm_fb_cma_helper.c | 6 +++--- - drivers/gpu/drm/drm_gem_cma_helper.c | 4 ++-- - 2 files changed, 5 insertions(+), 5 deletions(-) - -diff --git a/drivers/gpu/drm/drm_fb_cma_helper.c b/drivers/gpu/drm/drm_fb_cma_helper.c -index c19a625..c1a37d3 100644 ---- a/drivers/gpu/drm/drm_fb_cma_helper.c -+++ b/drivers/gpu/drm/drm_fb_cma_helper.c -@@ -266,7 +266,7 @@ static int drm_fbdev_cma_create(struct drm_fb_helper *helper, - fbi = drm_fb_helper_alloc_fbi(helper); - if (IS_ERR(fbi)) { - ret = PTR_ERR(fbi); -- goto err_drm_gem_cma_free_object; -+ goto err_gem_free_object; - } - - fbdev_cma->fb = drm_fb_cma_alloc(dev, &mode_cmd, &obj, 1); -@@ -299,8 +299,8 @@ static int drm_fbdev_cma_create(struct drm_fb_helper *helper, - - err_fb_info_destroy: - drm_fb_helper_release_fbi(helper); --err_drm_gem_cma_free_object: -- drm_gem_cma_free_object(&obj->base); -+err_gem_free_object: -+ dev->driver->gem_free_object(&obj->base); - return ret; - } - -diff --git a/drivers/gpu/drm/drm_gem_cma_helper.c b/drivers/gpu/drm/drm_gem_cma_helper.c -index 0f7b00b..e5df53b 100644 ---- a/drivers/gpu/drm/drm_gem_cma_helper.c -+++ b/drivers/gpu/drm/drm_gem_cma_helper.c -@@ -121,7 +121,7 @@ struct drm_gem_cma_object *drm_gem_cma_create(struct drm_device *drm, - return cma_obj; - - error: -- drm_gem_cma_free_object(&cma_obj->base); -+ drm->driver->gem_free_object(&cma_obj->base); - return ERR_PTR(ret); - } - EXPORT_SYMBOL_GPL(drm_gem_cma_create); -@@ -171,7 +171,7 @@ drm_gem_cma_create_with_handle(struct drm_file *file_priv, - return cma_obj; - - err_handle_create: -- drm_gem_cma_free_object(gem_obj); -+ drm->driver->gem_free_object(gem_obj); - - return ERR_PTR(ret); - } + drivers/power/reset/gpio-poweroff.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) -From 522e6f9cc4376fe49e8b41b40e7ddb98cf385a9e Mon Sep 17 00:00:00 2001 -From: Eric Anholt <eric@anholt.net> -Date: Fri, 17 Jul 2015 13:15:50 -0700 -Subject: [PATCH 117/170] drm/vc4: Add support for MSAA rendering. +diff --git a/drivers/power/reset/gpio-poweroff.c b/drivers/power/reset/gpio-poweroff.c +index be3d81f..a030ae9 100644 +--- a/drivers/power/reset/gpio-poweroff.c ++++ b/drivers/power/reset/gpio-poweroff.c +@@ -49,9 +49,11 @@ static int gpio_poweroff_probe(struct platform_device *pdev) + { + bool input = false; + enum gpiod_flags flags; ++ bool force = false; + + /* If a pm_power_off function has already been added, leave it alone */ +- if (pm_power_off != NULL) { ++ force = of_property_read_bool(pdev->dev.of_node, "force"); ++ if (!force && (pm_power_off != NULL)) { + dev_err(&pdev->dev, + "%s: pm_power_off function already registered", + __func__); -For MSAA, you set a bit in the binner that halves the size of tiles in -each direction, so you can pack 4 samples per pixel in the tile -buffer. During rendering, you can load and store raw tile buffer -contents (to save the per-sample MSAA contents), or you can load/store -resolved tile buffer contents (loads spam the pixel value to all 4 -samples, and stores either average the 4 color samples, or store the -first sample for Z/S). +From e72f41d909aa46e9bc234f6f2a6301ef9ef23676 Mon Sep 17 00:00:00 2001 +From: Phil Elwell <pelwell@users.noreply.github.com> +Date: Tue, 14 Jul 2015 14:32:47 +0100 +Subject: [PATCH 081/112] mfd: Add Raspberry Pi Sense HAT core driver -Signed-off-by: Eric Anholt <eric@anholt.net> --- - drivers/gpu/drm/vc4/vc4_packet.h | 23 ++- - drivers/gpu/drm/vc4/vc4_render_cl.c | 274 ++++++++++++++++++++++++++++++------ - drivers/gpu/drm/vc4/vc4_validate.c | 5 +- - include/uapi/drm/vc4_drm.h | 11 +- - 4 files changed, 258 insertions(+), 55 deletions(-) - -diff --git a/drivers/gpu/drm/vc4/vc4_packet.h b/drivers/gpu/drm/vc4/vc4_packet.h -index cee38aad..0f31cc0 100644 ---- a/drivers/gpu/drm/vc4/vc4_packet.h -+++ b/drivers/gpu/drm/vc4/vc4_packet.h -@@ -123,6 +123,11 @@ enum vc4_packet { - #define VC4_PACKET_TILE_COORDINATES_SIZE 3 - #define VC4_PACKET_GEM_HANDLES_SIZE 9 - -+/* Number of multisamples supported. */ -+#define VC4_MAX_SAMPLES 4 -+/* Size of a full resolution color or Z tile buffer load/store. */ -+#define VC4_TILE_BUFFER_SIZE (64 * 64 * 4) -+ - /** @{ - * Bits used by packets like VC4_PACKET_STORE_TILE_BUFFER_GENERAL and - * VC4_PACKET_TILE_RENDERING_MODE_CONFIG. -@@ -137,10 +142,20 @@ enum vc4_packet { - * low bits of VC4_PACKET_STORE_FULL_RES_TILE_BUFFER and - * VC4_PACKET_LOAD_FULL_RES_TILE_BUFFER. - */ --#define VC4_LOADSTORE_FULL_RES_EOF (1 << 3) --#define VC4_LOADSTORE_FULL_RES_DISABLE_CLEAR_ALL (1 << 2) --#define VC4_LOADSTORE_FULL_RES_DISABLE_ZS (1 << 1) --#define VC4_LOADSTORE_FULL_RES_DISABLE_COLOR (1 << 0) -+#define VC4_LOADSTORE_FULL_RES_EOF BIT(3) -+#define VC4_LOADSTORE_FULL_RES_DISABLE_CLEAR_ALL BIT(2) -+#define VC4_LOADSTORE_FULL_RES_DISABLE_ZS BIT(1) -+#define VC4_LOADSTORE_FULL_RES_DISABLE_COLOR BIT(0) -+ -+/** @{ -+ * -+ * low bits of VC4_PACKET_STORE_FULL_RES_TILE_BUFFER and -+ * VC4_PACKET_LOAD_FULL_RES_TILE_BUFFER. -+ */ -+#define VC4_LOADSTORE_FULL_RES_EOF BIT(3) -+#define VC4_LOADSTORE_FULL_RES_DISABLE_CLEAR_ALL BIT(2) -+#define VC4_LOADSTORE_FULL_RES_DISABLE_ZS BIT(1) -+#define VC4_LOADSTORE_FULL_RES_DISABLE_COLOR BIT(0) - - /** @{ - * -diff --git a/drivers/gpu/drm/vc4/vc4_render_cl.c b/drivers/gpu/drm/vc4/vc4_render_cl.c -index 3516354..8f2ec57 100644 ---- a/drivers/gpu/drm/vc4/vc4_render_cl.c -+++ b/drivers/gpu/drm/vc4/vc4_render_cl.c -@@ -37,9 +37,11 @@ - - struct vc4_rcl_setup { - struct drm_gem_cma_object *color_read; -- struct drm_gem_cma_object *color_ms_write; -+ struct drm_gem_cma_object *color_write; - struct drm_gem_cma_object *zs_read; - struct drm_gem_cma_object *zs_write; -+ struct drm_gem_cma_object *msaa_color_write; -+ struct drm_gem_cma_object *msaa_zs_write; - - struct drm_gem_cma_object *rcl; - u32 next_offset; -@@ -82,6 +84,22 @@ static void vc4_store_before_load(struct vc4_rcl_setup *setup) - } + drivers/input/joystick/Kconfig | 8 + + drivers/input/joystick/Makefile | 1 + + drivers/input/joystick/rpisense-js.c | 153 ++++++++++++++++ + drivers/mfd/Kconfig | 8 + + drivers/mfd/Makefile | 2 + + drivers/mfd/rpisense-core.c | 157 +++++++++++++++++ + drivers/video/fbdev/Kconfig | 13 ++ + drivers/video/fbdev/Makefile | 1 + + drivers/video/fbdev/rpisense-fb.c | 293 +++++++++++++++++++++++++++++++ + include/linux/mfd/rpisense/core.h | 47 +++++ + include/linux/mfd/rpisense/framebuffer.h | 32 ++++ + include/linux/mfd/rpisense/joystick.h | 35 ++++ + 12 files changed, 750 insertions(+) + create mode 100644 drivers/input/joystick/rpisense-js.c + create mode 100644 drivers/mfd/rpisense-core.c + create mode 100644 drivers/video/fbdev/rpisense-fb.c + create mode 100644 include/linux/mfd/rpisense/core.h + create mode 100644 include/linux/mfd/rpisense/framebuffer.h + create mode 100644 include/linux/mfd/rpisense/joystick.h + +diff --git a/drivers/input/joystick/Kconfig b/drivers/input/joystick/Kconfig +index 4215b53..4364d7c 100644 +--- a/drivers/input/joystick/Kconfig ++++ b/drivers/input/joystick/Kconfig +@@ -330,4 +330,12 @@ config JOYSTICK_MAPLE + To compile this as a module choose M here: the module will be called + maplecontrol. - /* -+ * Calculates the physical address of the start of a tile in a RCL surface. ++config JOYSTICK_RPISENSE ++ tristate "Raspberry Pi Sense HAT joystick" ++ depends on GPIOLIB && INPUT ++ select MFD_RPISENSE_CORE ++ ++ help ++ This is the joystick driver for the Raspberry Pi Sense HAT ++ + endif +diff --git a/drivers/input/joystick/Makefile b/drivers/input/joystick/Makefile +index 92dc0de..1758160 100644 +--- a/drivers/input/joystick/Makefile ++++ b/drivers/input/joystick/Makefile +@@ -32,4 +32,5 @@ obj-$(CONFIG_JOYSTICK_WARRIOR) += warrior.o + obj-$(CONFIG_JOYSTICK_XPAD) += xpad.o + obj-$(CONFIG_JOYSTICK_ZHENHUA) += zhenhua.o + obj-$(CONFIG_JOYSTICK_WALKERA0701) += walkera0701.o ++obj-$(CONFIG_JOYSTICK_RPISENSE) += rpisense-js.o + +diff --git a/drivers/input/joystick/rpisense-js.c b/drivers/input/joystick/rpisense-js.c +new file mode 100644 +index 0000000..6a41676 +--- /dev/null ++++ b/drivers/input/joystick/rpisense-js.c +@@ -0,0 +1,153 @@ ++/* ++ * Raspberry Pi Sense HAT joystick driver ++ * http://raspberrypi.org ++ * ++ * Copyright (C) 2015 Raspberry Pi ++ * ++ * Author: Serge Schneider ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License as published by the ++ * Free Software Foundation; either version 2 of the License, or (at your ++ * option) any later version. + * -+ * Unlike the other load/store packets, -+ * VC4_PACKET_LOAD/STORE_FULL_RES_TILE_BUFFER don't look at the tile -+ * coordinates packet, and instead just store to the address given. + */ -+static uint32_t vc4_full_res_offset(struct vc4_exec_info *exec, -+ struct drm_gem_cma_object *bo, -+ struct drm_vc4_submit_rcl_surface *surf, -+ uint8_t x, uint8_t y) -+{ -+ return bo->paddr + surf->offset + VC4_TILE_BUFFER_SIZE * -+ (DIV_ROUND_UP(exec->args->width, 32) * y + x); -+} + -+/* - * Emits a PACKET_TILE_COORDINATES if one isn't already pending. - * - * The tile coordinates packet triggers a pending load if there is one, are -@@ -108,22 +126,41 @@ static void emit_tile(struct vc4_exec_info *exec, - * may be outstanding at a time. - */ - if (setup->color_read) { -- rcl_u8(setup, VC4_PACKET_LOAD_TILE_BUFFER_GENERAL); -- rcl_u16(setup, args->color_read.bits); -- rcl_u32(setup, -- setup->color_read->paddr + args->color_read.offset); -+ if (args->color_read.flags & -+ VC4_SUBMIT_RCL_SURFACE_READ_IS_FULL_RES) { -+ rcl_u8(setup, VC4_PACKET_LOAD_FULL_RES_TILE_BUFFER); -+ rcl_u32(setup, -+ vc4_full_res_offset(exec, setup->color_read, -+ &args->color_read, x, y) | -+ VC4_LOADSTORE_FULL_RES_DISABLE_ZS); -+ } else { -+ rcl_u8(setup, VC4_PACKET_LOAD_TILE_BUFFER_GENERAL); -+ rcl_u16(setup, args->color_read.bits); -+ rcl_u32(setup, setup->color_read->paddr + -+ args->color_read.offset); -+ } - } - - if (setup->zs_read) { -- if (setup->color_read) { -- /* Exec previous load. */ -- vc4_tile_coordinates(setup, x, y); -- vc4_store_before_load(setup); -+ if (args->zs_read.flags & -+ VC4_SUBMIT_RCL_SURFACE_READ_IS_FULL_RES) { -+ rcl_u8(setup, VC4_PACKET_LOAD_FULL_RES_TILE_BUFFER); -+ rcl_u32(setup, -+ vc4_full_res_offset(exec, setup->zs_read, -+ &args->zs_read, x, y) | -+ VC4_LOADSTORE_FULL_RES_DISABLE_COLOR); -+ } else { -+ if (setup->color_read) { -+ /* Exec previous load. */ -+ vc4_tile_coordinates(setup, x, y); -+ vc4_store_before_load(setup); -+ } ++#include <linux/module.h> + -+ rcl_u8(setup, VC4_PACKET_LOAD_TILE_BUFFER_GENERAL); -+ rcl_u16(setup, args->zs_read.bits); -+ rcl_u32(setup, setup->zs_read->paddr + -+ args->zs_read.offset); - } -- -- rcl_u8(setup, VC4_PACKET_LOAD_TILE_BUFFER_GENERAL); -- rcl_u16(setup, args->zs_read.bits); -- rcl_u32(setup, setup->zs_read->paddr + args->zs_read.offset); - } - - /* Clipping depends on tile coordinates having been -@@ -144,20 +181,60 @@ static void emit_tile(struct vc4_exec_info *exec, - (y * exec->bin_tiles_x + x) * 32)); - } - -+ if (setup->msaa_color_write) { -+ bool last_tile_write = (!setup->msaa_zs_write && -+ !setup->zs_write && -+ !setup->color_write); -+ uint32_t bits = VC4_LOADSTORE_FULL_RES_DISABLE_ZS; -+ -+ if (!last_tile_write) -+ bits |= VC4_LOADSTORE_FULL_RES_DISABLE_CLEAR_ALL; -+ else if (last) -+ bits |= VC4_LOADSTORE_FULL_RES_EOF; -+ rcl_u8(setup, VC4_PACKET_STORE_FULL_RES_TILE_BUFFER); -+ rcl_u32(setup, -+ vc4_full_res_offset(exec, setup->msaa_color_write, -+ &args->msaa_color_write, x, y) | -+ bits); -+ } -+ -+ if (setup->msaa_zs_write) { -+ bool last_tile_write = (!setup->zs_write && -+ !setup->color_write); -+ uint32_t bits = VC4_LOADSTORE_FULL_RES_DISABLE_COLOR; -+ -+ if (setup->msaa_color_write) -+ vc4_tile_coordinates(setup, x, y); -+ if (!last_tile_write) -+ bits |= VC4_LOADSTORE_FULL_RES_DISABLE_CLEAR_ALL; -+ else if (last) -+ bits |= VC4_LOADSTORE_FULL_RES_EOF; -+ rcl_u8(setup, VC4_PACKET_STORE_FULL_RES_TILE_BUFFER); -+ rcl_u32(setup, -+ vc4_full_res_offset(exec, setup->msaa_zs_write, -+ &args->msaa_zs_write, x, y) | -+ bits); -+ } -+ - if (setup->zs_write) { -+ bool last_tile_write = !setup->color_write; -+ -+ if (setup->msaa_color_write || setup->msaa_zs_write) -+ vc4_tile_coordinates(setup, x, y); -+ - rcl_u8(setup, VC4_PACKET_STORE_TILE_BUFFER_GENERAL); - rcl_u16(setup, args->zs_write.bits | -- (setup->color_ms_write ? -- VC4_STORE_TILE_BUFFER_DISABLE_COLOR_CLEAR : 0)); -+ (last_tile_write ? -+ 0 : VC4_STORE_TILE_BUFFER_DISABLE_COLOR_CLEAR)); - rcl_u32(setup, - (setup->zs_write->paddr + args->zs_write.offset) | -- ((last && !setup->color_ms_write) ? -+ ((last && last_tile_write) ? - VC4_LOADSTORE_TILE_BUFFER_EOF : 0)); - } - -- if (setup->color_ms_write) { -- if (setup->zs_write) { -- /* Reset after previous store */ -+ if (setup->color_write) { -+ if (setup->msaa_color_write || setup->msaa_zs_write || -+ setup->zs_write) { - vc4_tile_coordinates(setup, x, y); - } - -@@ -192,14 +269,26 @@ static int vc4_create_rcl_bo(struct drm_device *dev, struct vc4_exec_info *exec, - } - - if (setup->color_read) { -- loop_body_size += (VC4_PACKET_LOAD_TILE_BUFFER_GENERAL_SIZE); -+ if (args->color_read.flags & -+ VC4_SUBMIT_RCL_SURFACE_READ_IS_FULL_RES) { -+ loop_body_size += VC4_PACKET_LOAD_FULL_RES_TILE_BUFFER_SIZE; -+ } else { -+ loop_body_size += VC4_PACKET_LOAD_TILE_BUFFER_GENERAL_SIZE; -+ } - } - if (setup->zs_read) { -- if (setup->color_read) { -- loop_body_size += VC4_PACKET_TILE_COORDINATES_SIZE; -- loop_body_size += VC4_PACKET_STORE_TILE_BUFFER_GENERAL_SIZE; -+ if (args->zs_read.flags & -+ VC4_SUBMIT_RCL_SURFACE_READ_IS_FULL_RES) { -+ loop_body_size += VC4_PACKET_LOAD_FULL_RES_TILE_BUFFER_SIZE; -+ } else { -+ if (setup->color_read && -+ !(args->color_read.flags & -+ VC4_SUBMIT_RCL_SURFACE_READ_IS_FULL_RES)) { -+ loop_body_size += VC4_PACKET_TILE_COORDINATES_SIZE; -+ loop_body_size += VC4_PACKET_STORE_TILE_BUFFER_GENERAL_SIZE; -+ } -+ loop_body_size += VC4_PACKET_LOAD_TILE_BUFFER_GENERAL_SIZE; - } -- loop_body_size += VC4_PACKET_LOAD_TILE_BUFFER_GENERAL_SIZE; - } - - if (has_bin) { -@@ -207,13 +296,23 @@ static int vc4_create_rcl_bo(struct drm_device *dev, struct vc4_exec_info *exec, - loop_body_size += VC4_PACKET_BRANCH_TO_SUB_LIST_SIZE; - } - -+ if (setup->msaa_color_write) -+ loop_body_size += VC4_PACKET_STORE_FULL_RES_TILE_BUFFER_SIZE; -+ if (setup->msaa_zs_write) -+ loop_body_size += VC4_PACKET_STORE_FULL_RES_TILE_BUFFER_SIZE; -+ - if (setup->zs_write) - loop_body_size += VC4_PACKET_STORE_TILE_BUFFER_GENERAL_SIZE; -- if (setup->color_ms_write) { -- if (setup->zs_write) -- loop_body_size += VC4_PACKET_TILE_COORDINATES_SIZE; -+ if (setup->color_write) - loop_body_size += VC4_PACKET_STORE_MS_TILE_BUFFER_SIZE; -- } ++#include <linux/mfd/rpisense/joystick.h> ++#include <linux/mfd/rpisense/core.h> + -+ /* We need a VC4_PACKET_TILE_COORDINATES in between each store. */ -+ loop_body_size += VC4_PACKET_TILE_COORDINATES_SIZE * -+ ((setup->msaa_color_write != NULL) + -+ (setup->msaa_zs_write != NULL) + -+ (setup->color_write != NULL) + -+ (setup->zs_write != NULL) - 1); -+ - size += xtiles * ytiles * loop_body_size; - - setup->rcl = &vc4_bo_create(dev, size, true)->base; -@@ -224,13 +323,12 @@ static int vc4_create_rcl_bo(struct drm_device *dev, struct vc4_exec_info *exec, - - rcl_u8(setup, VC4_PACKET_TILE_RENDERING_MODE_CONFIG); - rcl_u32(setup, -- (setup->color_ms_write ? -- (setup->color_ms_write->paddr + -- args->color_ms_write.offset) : -+ (setup->color_write ? (setup->color_write->paddr + -+ args->color_write.offset) : - 0)); - rcl_u16(setup, args->width); - rcl_u16(setup, args->height); -- rcl_u16(setup, args->color_ms_write.bits); -+ rcl_u16(setup, args->color_write.bits); - - /* The tile buffer gets cleared when the previous tile is stored. If - * the clear values changed between frames, then the tile buffer has -@@ -267,6 +365,56 @@ static int vc4_create_rcl_bo(struct drm_device *dev, struct vc4_exec_info *exec, - return 0; - } - -+static int vc4_full_res_bounds_check(struct vc4_exec_info *exec, -+ struct drm_gem_cma_object *obj, -+ struct drm_vc4_submit_rcl_surface *surf) ++static struct rpisense *rpisense; ++static unsigned char keymap[5] = {KEY_DOWN, KEY_RIGHT, KEY_UP, KEY_ENTER, KEY_LEFT,}; ++ ++static void keys_work_fn(struct work_struct *work) +{ -+ struct drm_vc4_submit_cl *args = exec->args; -+ u32 render_tiles_stride = DIV_ROUND_UP(exec->args->width, 32); ++ int i; ++ static s32 prev_keys; ++ struct rpisense_js *rpisense_js = &rpisense->joystick; ++ s32 keys = rpisense_reg_read(rpisense, RPISENSE_KEYS); ++ s32 changes = keys ^ prev_keys; + -+ if (surf->offset > obj->base.size) { -+ DRM_ERROR("surface offset %d > BO size %zd\n", -+ surf->offset, obj->base.size); -+ return -EINVAL; ++ prev_keys = keys; ++ for (i = 0; i < 5; i++) { ++ if (changes & 1) { ++ input_report_key(rpisense_js->keys_dev, ++ keymap[i], keys & 1); ++ } ++ changes >>= 1; ++ keys >>= 1; + } ++ input_sync(rpisense_js->keys_dev); ++} + -+ if ((obj->base.size - surf->offset) / VC4_TILE_BUFFER_SIZE < -+ render_tiles_stride * args->max_y_tile + args->max_x_tile) { -+ DRM_ERROR("MSAA tile %d, %d out of bounds " -+ "(bo size %zd, offset %d).\n", -+ args->max_x_tile, args->max_y_tile, -+ obj->base.size, -+ surf->offset); -+ return -EINVAL; -+ } ++static irqreturn_t keys_irq_handler(int irq, void *pdev) ++{ ++ struct rpisense_js *rpisense_js = &rpisense->joystick; + -+ return 0; ++ schedule_work(&rpisense_js->keys_work_s); ++ return IRQ_HANDLED; +} + -+static int vc4_rcl_msaa_surface_setup(struct vc4_exec_info *exec, -+ struct drm_gem_cma_object **obj, -+ struct drm_vc4_submit_rcl_surface *surf) ++static int rpisense_js_probe(struct platform_device *pdev) +{ -+ if (surf->flags != 0 || surf->bits != 0) { -+ DRM_ERROR("MSAA surface had nonzero flags/bits\n"); -+ return -EINVAL; -+ } ++ int ret; ++ int i; ++ struct rpisense_js *rpisense_js; + -+ if (surf->hindex == ~0) -+ return 0; ++ rpisense = rpisense_get_dev(); ++ rpisense_js = &rpisense->joystick; + -+ *obj = vc4_use_bo(exec, surf->hindex); -+ if (!*obj) -+ return -EINVAL; ++ INIT_WORK(&rpisense_js->keys_work_s, keys_work_fn); + -+ if (surf->offset & 0xf) { -+ DRM_ERROR("MSAA write must be 16b aligned.\n"); -+ return -EINVAL; ++ rpisense_js->keys_dev = input_allocate_device(); ++ if (!rpisense_js->keys_dev) { ++ dev_err(&pdev->dev, "Could not allocate input device.\n"); ++ return -ENOMEM; + } + -+ return vc4_full_res_bounds_check(exec, *obj, surf); -+} -+ - static int vc4_rcl_surface_setup(struct vc4_exec_info *exec, - struct drm_gem_cma_object **obj, - struct drm_vc4_submit_rcl_surface *surf) -@@ -278,9 +426,10 @@ static int vc4_rcl_surface_setup(struct vc4_exec_info *exec, - uint8_t format = VC4_GET_FIELD(surf->bits, - VC4_LOADSTORE_TILE_BUFFER_FORMAT); - int cpp; -+ int ret; - -- if (surf->pad != 0) { -- DRM_ERROR("Padding unset\n"); -+ if (surf->flags & ~VC4_SUBMIT_RCL_SURFACE_READ_IS_FULL_RES) { -+ DRM_ERROR("Extra flags set\n"); - return -EINVAL; - } - -@@ -290,6 +439,25 @@ static int vc4_rcl_surface_setup(struct vc4_exec_info *exec, - if (!vc4_use_bo(exec, surf->hindex, VC4_MODE_RENDER, obj)) - return -EINVAL; - -+ if (surf->flags & VC4_SUBMIT_RCL_SURFACE_READ_IS_FULL_RES) { -+ if (surf == &exec->args->zs_write) { -+ DRM_ERROR("general zs write may not be a full-res.\n"); -+ return -EINVAL; -+ } -+ -+ if (surf->bits != 0) { -+ DRM_ERROR("load/store general bits set with " -+ "full res load/store.\n"); -+ return -EINVAL; -+ } ++ rpisense_js->keys_dev->evbit[0] = BIT_MASK(EV_KEY); ++ for (i = 0; i < ARRAY_SIZE(keymap); i++) { ++ set_bit(keymap[i], ++ rpisense_js->keys_dev->keybit); ++ } + -+ ret = vc4_full_res_bounds_check(exec, *obj, surf); -+ if (!ret) -+ return ret; ++ rpisense_js->keys_dev->name = "Raspberry Pi Sense HAT Joystick"; ++ rpisense_js->keys_dev->phys = "rpi-sense-joy/input0"; ++ rpisense_js->keys_dev->id.bustype = BUS_I2C; ++ rpisense_js->keys_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP); ++ rpisense_js->keys_dev->keycode = keymap; ++ rpisense_js->keys_dev->keycodesize = sizeof(unsigned char); ++ rpisense_js->keys_dev->keycodemax = ARRAY_SIZE(keymap); + -+ return 0; ++ ret = input_register_device(rpisense_js->keys_dev); ++ if (ret) { ++ dev_err(&pdev->dev, "Could not register input device.\n"); ++ goto err_keys_alloc; + } + - if (surf->bits & ~(VC4_LOADSTORE_TILE_BUFFER_TILING_MASK | - VC4_LOADSTORE_TILE_BUFFER_BUFFER_MASK | - VC4_LOADSTORE_TILE_BUFFER_FORMAT_MASK)) { -@@ -341,9 +509,10 @@ static int vc4_rcl_surface_setup(struct vc4_exec_info *exec, - } - - static int --vc4_rcl_ms_surface_setup(struct vc4_exec_info *exec, -- struct drm_gem_cma_object **obj, -- struct drm_vc4_submit_rcl_surface *surf) -+vc4_rcl_render_config_surface_setup(struct vc4_exec_info *exec, -+ struct vc4_rcl_setup *setup, -+ struct drm_gem_cma_object **obj, -+ struct drm_vc4_submit_rcl_surface *surf) - { - uint8_t tiling = VC4_GET_FIELD(surf->bits, - VC4_RENDER_CONFIG_MEMORY_FORMAT); -@@ -351,13 +520,15 @@ vc4_rcl_ms_surface_setup(struct vc4_exec_info *exec, - VC4_RENDER_CONFIG_FORMAT); - int cpp; - -- if (surf->pad != 0) { -- DRM_ERROR("Padding unset\n"); -+ if (surf->flags != 0) { -+ DRM_ERROR("No flags supported on render config.\n"); - return -EINVAL; - } - - if (surf->bits & ~(VC4_RENDER_CONFIG_MEMORY_FORMAT_MASK | -- VC4_RENDER_CONFIG_FORMAT_MASK)) { -+ VC4_RENDER_CONFIG_FORMAT_MASK | -+ VC4_RENDER_CONFIG_MS_MODE_4X | -+ VC4_RENDER_CONFIG_DECIMATE_MODE_4X)) { - DRM_ERROR("Unknown bits in render config: 0x%04x\n", - surf->bits); - return -EINVAL; -@@ -413,18 +584,20 @@ int vc4_get_rcl(struct drm_device *dev, struct vc4_exec_info *exec) - if (has_bin && - (args->max_x_tile > exec->bin_tiles_x || - args->max_y_tile > exec->bin_tiles_y)) { -- DRM_ERROR("Render tiles (%d,%d) outside of bin config (%d,%d)\n", -+ DRM_ERROR("Render tiles (%d,%d) outside of bin config " -+ "(%d,%d)\n", - args->max_x_tile, args->max_y_tile, - exec->bin_tiles_x, exec->bin_tiles_y); - return -EINVAL; - } - -- ret = vc4_rcl_surface_setup(exec, &setup.color_read, &args->color_read); -+ ret = vc4_rcl_render_config_surface_setup(exec, &setup, -+ &setup.color_write, -+ &args->color_write); - if (ret) - return ret; - -- ret = vc4_rcl_ms_surface_setup(exec, &setup.color_ms_write, -- &args->color_ms_write); -+ ret = vc4_rcl_surface_setup(exec, &setup.color_read, &args->color_read); - if (ret) - return ret; - -@@ -436,10 +609,21 @@ int vc4_get_rcl(struct drm_device *dev, struct vc4_exec_info *exec) - if (ret) - return ret; - -+ ret = vc4_rcl_msaa_surface_setup(exec, &setup.msaa_color_write, -+ &args->msaa_color_write); -+ if (ret) -+ return ret; ++ ret = gpiod_direction_input(rpisense_js->keys_desc); ++ if (ret) { ++ dev_err(&pdev->dev, "Could not set keys-int direction.\n"); ++ goto err_keys_reg; ++ } + -+ ret = vc4_rcl_msaa_surface_setup(exec, &setup.msaa_zs_write, -+ &args->msaa_zs_write); -+ if (ret) -+ return ret; ++ rpisense_js->keys_irq = gpiod_to_irq(rpisense_js->keys_desc); ++ if (rpisense_js->keys_irq < 0) { ++ dev_err(&pdev->dev, "Could not determine keys-int IRQ.\n"); ++ ret = rpisense_js->keys_irq; ++ goto err_keys_reg; ++ } + - /* We shouldn't even have the job submitted to us if there's no - * surface to write out. - */ -- if (!setup.color_ms_write && !setup.zs_write) { -+ if (!setup.color_write && !setup.zs_write && -+ !setup.msaa_color_write && !setup.msaa_zs_write) { - DRM_ERROR("RCL requires color or Z/S write\n"); - return -EINVAL; - } -diff --git a/drivers/gpu/drm/vc4/vc4_validate.c b/drivers/gpu/drm/vc4/vc4_validate.c -index e44e35539..2f22f19 100644 ---- a/drivers/gpu/drm/vc4/vc4_validate.c -+++ b/drivers/gpu/drm/vc4/vc4_validate.c -@@ -400,9 +400,8 @@ validate_tile_binning_config(VALIDATE_ARGS) - } - - if (flags & (VC4_BIN_CONFIG_DB_NON_MS | -- VC4_BIN_CONFIG_TILE_BUFFER_64BIT | -- VC4_BIN_CONFIG_MS_MODE_4X)) { -- DRM_ERROR("unsupported bining config flags 0x%02x\n", flags); -+ VC4_BIN_CONFIG_TILE_BUFFER_64BIT)) { -+ DRM_ERROR("unsupported binning config flags 0x%02x\n", flags); - return -EINVAL; - } - -diff --git a/include/uapi/drm/vc4_drm.h b/include/uapi/drm/vc4_drm.h -index 4a8d19f..49cd992 100644 ---- a/include/uapi/drm/vc4_drm.h -+++ b/include/uapi/drm/vc4_drm.h -@@ -46,10 +46,13 @@ struct drm_vc4_submit_rcl_surface { - uint32_t hindex; /* Handle index, or ~0 if not present. */ - uint32_t offset; /* Offset to start of buffer. */ - /* -- * Bits for either render config (color_ms_write) or load/store packet. -+ * Bits for either render config (color_write) or load/store packet. -+ * Bits should all be 0 for MSAA load/stores. - */ - uint16_t bits; -- uint16_t pad; ++ ret = devm_request_irq(&pdev->dev, rpisense_js->keys_irq, ++ keys_irq_handler, IRQF_TRIGGER_RISING, ++ "keys", &pdev->dev); ++ if (ret) { ++ dev_err(&pdev->dev, "IRQ request failed.\n"); ++ goto err_keys_reg; ++ } ++ return 0; ++err_keys_reg: ++ input_unregister_device(rpisense_js->keys_dev); ++err_keys_alloc: ++ input_free_device(rpisense_js->keys_dev); ++ return ret; ++} + -+#define VC4_SUBMIT_RCL_SURFACE_READ_IS_FULL_RES (1 << 0) -+ uint16_t flags; - }; - - /** -@@ -128,9 +131,11 @@ struct drm_vc4_submit_cl { - uint8_t max_x_tile; - uint8_t max_y_tile; - struct drm_vc4_submit_rcl_surface color_read; -- struct drm_vc4_submit_rcl_surface color_ms_write; -+ struct drm_vc4_submit_rcl_surface color_write; - struct drm_vc4_submit_rcl_surface zs_read; - struct drm_vc4_submit_rcl_surface zs_write; -+ struct drm_vc4_submit_rcl_surface msaa_color_write; -+ struct drm_vc4_submit_rcl_surface msaa_zs_write; - uint32_t clear_color[2]; - uint32_t clear_z; - uint8_t clear_s; - -From 50a1843ffd2e6f408dcb6a64ca0a2ef3b062fd5a Mon Sep 17 00:00:00 2001 -From: Eric Anholt <eric@anholt.net> -Date: Tue, 8 Dec 2015 14:00:43 -0800 -Subject: [PATCH 118/170] drm/vc4: A few more non-functional changes to sync to - upstream. - -At this point all that's left is the force-enable of HDMI connector, -and using direct firmware calls to turn on V3D instead of the generic -power domain support. - -Signed-off-by: Eric Anholt <eric@anholt.net> ---- - drivers/gpu/drm/vc4/vc4_v3d.c | 2 +- - include/uapi/drm/vc4_drm.h | 182 +++++++++++++++++++++--------------------- - 2 files changed, 92 insertions(+), 92 deletions(-) - -diff --git a/drivers/gpu/drm/vc4/vc4_v3d.c b/drivers/gpu/drm/vc4/vc4_v3d.c -index 29a222f..4d103f7f 100644 ---- a/drivers/gpu/drm/vc4/vc4_v3d.c -+++ b/drivers/gpu/drm/vc4/vc4_v3d.c -@@ -109,7 +109,7 @@ static const struct { - - int vc4_v3d_debugfs_regs(struct seq_file *m, void *unused) - { -- struct drm_info_node *node = (struct drm_info_node *) m->private; -+ struct drm_info_node *node = (struct drm_info_node *)m->private; - struct drm_device *dev = node->minor->dev; - struct vc4_dev *vc4 = to_vc4_dev(dev); - int i; -diff --git a/include/uapi/drm/vc4_drm.h b/include/uapi/drm/vc4_drm.h -index 49cd992..eeb37e3 100644 ---- a/include/uapi/drm/vc4_drm.h -+++ b/include/uapi/drm/vc4_drm.h -@@ -24,7 +24,7 @@ - #ifndef _UAPI_VC4_DRM_H_ - #define _UAPI_VC4_DRM_H_ - --#include <drm/drm.h> -+#include "drm.h" - - #define DRM_VC4_SUBMIT_CL 0x00 - #define DRM_VC4_WAIT_SEQNO 0x01 -@@ -34,25 +34,25 @@ - #define DRM_VC4_CREATE_SHADER_BO 0x05 - #define DRM_VC4_GET_HANG_STATE 0x06 - --#define DRM_IOCTL_VC4_SUBMIT_CL DRM_IOWR( DRM_COMMAND_BASE + DRM_VC4_SUBMIT_CL, struct drm_vc4_submit_cl) --#define DRM_IOCTL_VC4_WAIT_SEQNO DRM_IOWR( DRM_COMMAND_BASE + DRM_VC4_WAIT_SEQNO, struct drm_vc4_wait_seqno) --#define DRM_IOCTL_VC4_WAIT_BO DRM_IOWR( DRM_COMMAND_BASE + DRM_VC4_WAIT_BO, struct drm_vc4_wait_bo) --#define DRM_IOCTL_VC4_CREATE_BO DRM_IOWR( DRM_COMMAND_BASE + DRM_VC4_CREATE_BO, struct drm_vc4_create_bo) --#define DRM_IOCTL_VC4_MMAP_BO DRM_IOWR( DRM_COMMAND_BASE + DRM_VC4_MMAP_BO, struct drm_vc4_mmap_bo) --#define DRM_IOCTL_VC4_CREATE_SHADER_BO DRM_IOWR( DRM_COMMAND_BASE + DRM_VC4_CREATE_SHADER_BO, struct drm_vc4_create_shader_bo) --#define DRM_IOCTL_VC4_GET_HANG_STATE DRM_IOWR( DRM_COMMAND_BASE + DRM_VC4_GET_HANG_STATE, struct drm_vc4_get_hang_state) -+#define DRM_IOCTL_VC4_SUBMIT_CL DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_SUBMIT_CL, struct drm_vc4_submit_cl) -+#define DRM_IOCTL_VC4_WAIT_SEQNO DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_WAIT_SEQNO, struct drm_vc4_wait_seqno) -+#define DRM_IOCTL_VC4_WAIT_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_WAIT_BO, struct drm_vc4_wait_bo) -+#define DRM_IOCTL_VC4_CREATE_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_CREATE_BO, struct drm_vc4_create_bo) -+#define DRM_IOCTL_VC4_MMAP_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_MMAP_BO, struct drm_vc4_mmap_bo) -+#define DRM_IOCTL_VC4_CREATE_SHADER_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_CREATE_SHADER_BO, struct drm_vc4_create_shader_bo) -+#define DRM_IOCTL_VC4_GET_HANG_STATE DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_GET_HANG_STATE, struct drm_vc4_get_hang_state) - - struct drm_vc4_submit_rcl_surface { -- uint32_t hindex; /* Handle index, or ~0 if not present. */ -- uint32_t offset; /* Offset to start of buffer. */ -+ __u32 hindex; /* Handle index, or ~0 if not present. */ -+ __u32 offset; /* Offset to start of buffer. */ - /* -- * Bits for either render config (color_write) or load/store packet. -- * Bits should all be 0 for MSAA load/stores. -+ * Bits for either render config (color_write) or load/store packet. -+ * Bits should all be 0 for MSAA load/stores. - */ -- uint16_t bits; -+ __u16 bits; - - #define VC4_SUBMIT_RCL_SURFACE_READ_IS_FULL_RES (1 << 0) -- uint16_t flags; -+ __u16 flags; - }; - - /** -@@ -76,7 +76,7 @@ struct drm_vc4_submit_cl { - * then writes out the state updates and draw calls necessary per tile - * to the tile allocation BO. - */ -- uint64_t bin_cl; -+ __u64 bin_cl; - - /* Pointer to the shader records. - * -@@ -85,16 +85,16 @@ struct drm_vc4_submit_cl { - * reference to the shader record has enough information to determine - * how many pointers are necessary (fixed number for shaders/uniforms, - * and an attribute count), so those BO indices into bo_handles are -- * just stored as uint32_ts before each shader record passed in. -+ * just stored as __u32s before each shader record passed in. - */ -- uint64_t shader_rec; -+ __u64 shader_rec; - - /* Pointer to uniform data and texture handles for the textures - * referenced by the shader. - * - * For each shader state record, there is a set of uniform data in the - * order referenced by the record (FS, VS, then CS). Each set of -- * uniform data has a uint32_t index into bo_handles per texture -+ * uniform data has a __u32 index into bo_handles per texture - * sample operation, in the order the QPU_W_TMUn_S writes appear in - * the program. Following the texture BO handle indices is the actual - * uniform data. -@@ -103,52 +103,52 @@ struct drm_vc4_submit_cl { - * because the kernel has to determine the sizes anyway during shader - * code validation. - */ -- uint64_t uniforms; -- uint64_t bo_handles; -+ __u64 uniforms; -+ __u64 bo_handles; - - /* Size in bytes of the binner command list. */ -- uint32_t bin_cl_size; -+ __u32 bin_cl_size; - /* Size in bytes of the set of shader records. */ -- uint32_t shader_rec_size; -+ __u32 shader_rec_size; - /* Number of shader records. - * - * This could just be computed from the contents of shader_records and - * the address bits of references to them from the bin CL, but it - * keeps the kernel from having to resize some allocations it makes. - */ -- uint32_t shader_rec_count; -+ __u32 shader_rec_count; - /* Size in bytes of the uniform state. */ -- uint32_t uniforms_size; -+ __u32 uniforms_size; - - /* Number of BO handles passed in (size is that times 4). */ -- uint32_t bo_handle_count; -+ __u32 bo_handle_count; - - /* RCL setup: */ -- uint16_t width; -- uint16_t height; -- uint8_t min_x_tile; -- uint8_t min_y_tile; -- uint8_t max_x_tile; -- uint8_t max_y_tile; -+ __u16 width; -+ __u16 height; -+ __u8 min_x_tile; -+ __u8 min_y_tile; -+ __u8 max_x_tile; -+ __u8 max_y_tile; - struct drm_vc4_submit_rcl_surface color_read; - struct drm_vc4_submit_rcl_surface color_write; - struct drm_vc4_submit_rcl_surface zs_read; - struct drm_vc4_submit_rcl_surface zs_write; - struct drm_vc4_submit_rcl_surface msaa_color_write; - struct drm_vc4_submit_rcl_surface msaa_zs_write; -- uint32_t clear_color[2]; -- uint32_t clear_z; -- uint8_t clear_s; -+ __u32 clear_color[2]; -+ __u32 clear_z; -+ __u8 clear_s; - -- uint32_t pad:24; -+ __u32 pad:24; - - #define VC4_SUBMIT_CL_USE_CLEAR_COLOR (1 << 0) -- uint32_t flags; -+ __u32 flags; - - /* Returned value of the seqno of this render job (for the - * wait ioctl). - */ -- uint64_t seqno; -+ __u64 seqno; - }; - - /** -@@ -159,8 +159,8 @@ struct drm_vc4_submit_cl { - * block, just return the status." - */ - struct drm_vc4_wait_seqno { -- uint64_t seqno; -- uint64_t timeout_ns; -+ __u64 seqno; -+ __u64 timeout_ns; - }; - - /** -@@ -172,9 +172,9 @@ struct drm_vc4_wait_seqno { - * completed. - */ - struct drm_vc4_wait_bo { -- uint32_t handle; -- uint32_t pad; -- uint64_t timeout_ns; -+ __u32 handle; -+ __u32 pad; -+ __u64 timeout_ns; - }; - - /** -@@ -184,11 +184,30 @@ struct drm_vc4_wait_bo { - * used in a future extension. - */ - struct drm_vc4_create_bo { -- uint32_t size; -- uint32_t flags; -+ __u32 size; -+ __u32 flags; - /** Returned GEM handle for the BO. */ -- uint32_t handle; -- uint32_t pad; -+ __u32 handle; -+ __u32 pad; -+}; -+ -+/** -+ * struct drm_vc4_mmap_bo - ioctl argument for mapping VC4 BOs. -+ * -+ * This doesn't actually perform an mmap. Instead, it returns the -+ * offset you need to use in an mmap on the DRM device node. This -+ * means that tools like valgrind end up knowing about the mapped -+ * memory. -+ * -+ * There are currently no values for the flags argument, but it may be -+ * used in a future extension. -+ */ -+struct drm_vc4_mmap_bo { -+ /** Handle for the object being mapped. */ -+ __u32 handle; -+ __u32 flags; -+ /** offset into the drm node to use for subsequent mmap call. */ -+ __u64 offset; - }; - - /** -@@ -201,43 +220,24 @@ struct drm_vc4_create_bo { - */ - struct drm_vc4_create_shader_bo { - /* Size of the data argument. */ -- uint32_t size; -+ __u32 size; - /* Flags, currently must be 0. */ -- uint32_t flags; -+ __u32 flags; - - /* Pointer to the data. */ -- uint64_t data; -+ __u64 data; - - /** Returned GEM handle for the BO. */ -- uint32_t handle; -+ __u32 handle; - /* Pad, must be 0. */ -- uint32_t pad; --}; -- --/** -- * struct drm_vc4_mmap_bo - ioctl argument for mapping VC4 BOs. -- * -- * This doesn't actually perform an mmap. Instead, it returns the -- * offset you need to use in an mmap on the DRM device node. This -- * means that tools like valgrind end up knowing about the mapped -- * memory. -- * -- * There are currently no values for the flags argument, but it may be -- * used in a future extension. -- */ --struct drm_vc4_mmap_bo { -- /** Handle for the object being mapped. */ -- uint32_t handle; -- uint32_t flags; -- /** offset into the drm node to use for subsequent mmap call. */ -- uint64_t offset; -+ __u32 pad; - }; - - struct drm_vc4_get_hang_state_bo { -- uint32_t handle; -- uint32_t paddr; -- uint32_t size; -- uint32_t pad; -+ __u32 handle; -+ __u32 paddr; -+ __u32 size; -+ __u32 pad; - }; - - /** -@@ -246,34 +246,34 @@ struct drm_vc4_get_hang_state_bo { - */ - struct drm_vc4_get_hang_state { - /** Pointer to array of struct drm_vc4_get_hang_state_bo. */ -- uint64_t bo; -+ __u64 bo; - /** - * On input, the size of the bo array. Output is the number - * of bos to be returned. - */ -- uint32_t bo_count; -+ __u32 bo_count; - -- uint32_t start_bin, start_render; -+ __u32 start_bin, start_render; - -- uint32_t ct0ca, ct0ea; -- uint32_t ct1ca, ct1ea; -- uint32_t ct0cs, ct1cs; -- uint32_t ct0ra0, ct1ra0; -+ __u32 ct0ca, ct0ea; -+ __u32 ct1ca, ct1ea; -+ __u32 ct0cs, ct1cs; -+ __u32 ct0ra0, ct1ra0; - -- uint32_t bpca, bpcs; -- uint32_t bpoa, bpos; -+ __u32 bpca, bpcs; -+ __u32 bpoa, bpos; - -- uint32_t vpmbase; -+ __u32 vpmbase; - -- uint32_t dbge; -- uint32_t fdbgo; -- uint32_t fdbgb; -- uint32_t fdbgr; -- uint32_t fdbgs; -- uint32_t errstat; -+ __u32 dbge; -+ __u32 fdbgo; -+ __u32 fdbgb; -+ __u32 fdbgr; -+ __u32 fdbgs; -+ __u32 errstat; - - /* Pad that we may save more registers into in the future. */ -- uint32_t pad[16]; -+ __u32 pad[16]; - }; - - #endif /* _UAPI_VC4_DRM_H_ */ - -From 0a373a81664b9e9b8994512fb3d15ed296526e89 Mon Sep 17 00:00:00 2001 -From: Eric Anholt <eric@anholt.net> -Date: Tue, 15 Dec 2015 23:46:32 +0000 -Subject: [PATCH 119/170] drm/vc4: Use "hpd-gpios" for HDMI GPIO, like what - landed upstream. - -Signed-off-by: Eric Anholt <eric@anholt.net> ---- - arch/arm/boot/dts/overlays/vc4-kms-v3d-overlay.dts | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/arch/arm/boot/dts/overlays/vc4-kms-v3d-overlay.dts b/arch/arm/boot/dts/overlays/vc4-kms-v3d-overlay.dts -index cf5d5c9..da37483 100644 ---- a/arch/arm/boot/dts/overlays/vc4-kms-v3d-overlay.dts -+++ b/arch/arm/boot/dts/overlays/vc4-kms-v3d-overlay.dts -@@ -68,7 +68,7 @@ - <0x7e808000 0x100>; - interrupts = <2 8>, <2 9>; - ddc = <&i2c2>; -- hpd-gpio = <&gpio 46 GPIO_ACTIVE_HIGH>; -+ hpd-gpios = <&gpio 46 GPIO_ACTIVE_HIGH>; - clocks = <&cprman BCM2835_PLLH_PIX>, - <&cprman BCM2835_CLOCK_HSM>; - clock-names = "pixel", "hdmi"; - -From f8453aacbe60712c31c57580a126017b798bd339 Mon Sep 17 00:00:00 2001 -From: Eric Anholt <eric@anholt.net> -Date: Mon, 7 Dec 2015 12:35:01 -0800 -Subject: [PATCH 120/170] drm/vc4: Synchronize validation code for v2 - submission upstream. - -Signed-off-by: Eric Anholt <eric@anholt.net> ---- - drivers/gpu/drm/vc4/vc4_drv.h | 24 +-- - drivers/gpu/drm/vc4/vc4_gem.c | 14 +- - drivers/gpu/drm/vc4/vc4_render_cl.c | 6 +- - drivers/gpu/drm/vc4/vc4_validate.c | 287 +++++++++++++++--------------------- - 4 files changed, 135 insertions(+), 196 deletions(-) - -diff --git a/drivers/gpu/drm/vc4/vc4_drv.h b/drivers/gpu/drm/vc4/vc4_drv.h -index 53dfa8df..ed93fa78 100644 ---- a/drivers/gpu/drm/vc4/vc4_drv.h -+++ b/drivers/gpu/drm/vc4/vc4_drv.h -@@ -189,17 +189,6 @@ to_vc4_encoder(struct drm_encoder *encoder) - #define HVS_READ(offset) readl(vc4->hvs->regs + offset) - #define HVS_WRITE(offset, val) writel(val, vc4->hvs->regs + offset) - --enum vc4_bo_mode { -- VC4_MODE_UNDECIDED, -- VC4_MODE_RENDER, -- VC4_MODE_SHADER, --}; -- --struct vc4_bo_exec_state { -- struct drm_gem_cma_object *bo; -- enum vc4_bo_mode mode; --}; -- - struct vc4_exec_info { - /* Sequence number for this bin/render job. */ - uint64_t seqno; -@@ -210,7 +199,7 @@ struct vc4_exec_info { - /* This is the array of BOs that were looked up at the start of exec. - * Command validation will use indices into this array. - */ -- struct vc4_bo_exec_state *bo; -+ struct drm_gem_cma_object **bo; - uint32_t bo_count; - - /* Pointers for our position in vc4->job_list */ -@@ -238,7 +227,6 @@ struct vc4_exec_info { - * command lists. - */ - struct vc4_shader_state { -- uint8_t packet; - uint32_t addr; - /* Maximum vertex index referenced by any primitive using this - * shader state. -@@ -254,6 +242,7 @@ struct vc4_exec_info { - bool found_tile_binning_mode_config_packet; - bool found_start_tile_binning_packet; - bool found_increment_semaphore_packet; -+ bool found_flush; - uint8_t bin_tiles_x, bin_tiles_y; - struct drm_gem_cma_object *tile_bo; - uint32_t tile_alloc_offset; -@@ -265,6 +254,9 @@ struct vc4_exec_info { - uint32_t ct0ca, ct0ea; - uint32_t ct1ca, ct1ea; - -+ /* Pointer to the unvalidated bin CL (if present). */ -+ void *bin_u; -+ - /* Pointers to the shader recs. These paddr gets incremented as CL - * packets are relocated in validate_gl_shader_state, and the vaddrs - * (u and v) get incremented and size decremented as the shader recs -@@ -455,10 +447,8 @@ vc4_validate_bin_cl(struct drm_device *dev, - int - vc4_validate_shader_recs(struct drm_device *dev, struct vc4_exec_info *exec); - --bool vc4_use_bo(struct vc4_exec_info *exec, -- uint32_t hindex, -- enum vc4_bo_mode mode, -- struct drm_gem_cma_object **obj); -+struct drm_gem_cma_object *vc4_use_bo(struct vc4_exec_info *exec, -+ uint32_t hindex); - - int vc4_get_rcl(struct drm_device *dev, struct vc4_exec_info *exec); - -diff --git a/drivers/gpu/drm/vc4/vc4_gem.c b/drivers/gpu/drm/vc4/vc4_gem.c -index fb0b92d..39f29e7 100644 ---- a/drivers/gpu/drm/vc4/vc4_gem.c -+++ b/drivers/gpu/drm/vc4/vc4_gem.c -@@ -169,8 +169,8 @@ vc4_save_hang_state(struct drm_device *dev) - } - - for (i = 0; i < exec->bo_count; i++) { -- drm_gem_object_reference(&exec->bo[i].bo->base); -- kernel_state->bo[i] = &exec->bo[i].bo->base; -+ drm_gem_object_reference(&exec->bo[i]->base); -+ kernel_state->bo[i] = &exec->bo[i]->base; - } - - list_for_each_entry(bo, &exec->unref_list, unref_head) { -@@ -397,7 +397,7 @@ vc4_update_bo_seqnos(struct vc4_exec_info *exec, uint64_t seqno) - unsigned i; - - for (i = 0; i < exec->bo_count; i++) { -- bo = to_vc4_bo(&exec->bo[i].bo->base); -+ bo = to_vc4_bo(&exec->bo[i]->base); - bo->seqno = seqno; - } - -@@ -467,7 +467,7 @@ vc4_cl_lookup_bos(struct drm_device *dev, - return -EINVAL; - } - -- exec->bo = kcalloc(exec->bo_count, sizeof(struct vc4_bo_exec_state), -+ exec->bo = kcalloc(exec->bo_count, sizeof(struct drm_gem_cma_object *), - GFP_KERNEL); - if (!exec->bo) { - DRM_ERROR("Failed to allocate validated BO pointers\n"); -@@ -500,7 +500,7 @@ vc4_cl_lookup_bos(struct drm_device *dev, - goto fail; - } - drm_gem_object_reference(bo); -- exec->bo[i].bo = (struct drm_gem_cma_object *)bo; -+ exec->bo[i] = (struct drm_gem_cma_object *)bo; - } - spin_unlock(&file_priv->table_lock); - -@@ -591,6 +591,8 @@ vc4_get_bcl(struct drm_device *dev, struct vc4_exec_info *exec) - - exec->ct0ca = exec->exec_bo->paddr + bin_offset; - -+ exec->bin_u = bin; ++static int rpisense_js_remove(struct platform_device *pdev) ++{ ++ struct rpisense_js *rpisense_js = &rpisense->joystick; + - exec->shader_rec_v = exec->exec_bo->vaddr + shader_rec_offset; - exec->shader_rec_p = exec->exec_bo->paddr + shader_rec_offset; - exec->shader_rec_size = args->shader_rec_size; -@@ -622,7 +624,7 @@ vc4_complete_exec(struct drm_device *dev, struct vc4_exec_info *exec) - mutex_lock(&dev->struct_mutex); - if (exec->bo) { - for (i = 0; i < exec->bo_count; i++) -- drm_gem_object_unreference(&exec->bo[i].bo->base); -+ drm_gem_object_unreference(&exec->bo[i]->base); - kfree(exec->bo); - } - -diff --git a/drivers/gpu/drm/vc4/vc4_render_cl.c b/drivers/gpu/drm/vc4/vc4_render_cl.c -index 8f2ec57..8a2a312 100644 ---- a/drivers/gpu/drm/vc4/vc4_render_cl.c -+++ b/drivers/gpu/drm/vc4/vc4_render_cl.c -@@ -436,7 +436,8 @@ static int vc4_rcl_surface_setup(struct vc4_exec_info *exec, - if (surf->hindex == ~0) - return 0; - -- if (!vc4_use_bo(exec, surf->hindex, VC4_MODE_RENDER, obj)) -+ *obj = vc4_use_bo(exec, surf->hindex); -+ if (!*obj) - return -EINVAL; - - if (surf->flags & VC4_SUBMIT_RCL_SURFACE_READ_IS_FULL_RES) { -@@ -537,7 +538,8 @@ vc4_rcl_render_config_surface_setup(struct vc4_exec_info *exec, - if (surf->hindex == ~0) - return 0; - -- if (!vc4_use_bo(exec, surf->hindex, VC4_MODE_RENDER, obj)) -+ *obj = vc4_use_bo(exec, surf->hindex); -+ if (!*obj) - return -EINVAL; - - if (tiling > VC4_TILING_FORMAT_LT) { -diff --git a/drivers/gpu/drm/vc4/vc4_validate.c b/drivers/gpu/drm/vc4/vc4_validate.c -index 2f22f19..0fb5b99 100644 ---- a/drivers/gpu/drm/vc4/vc4_validate.c -+++ b/drivers/gpu/drm/vc4/vc4_validate.c -@@ -94,42 +94,42 @@ size_is_lt(uint32_t width, uint32_t height, int cpp) - height <= 4 * utile_height(cpp)); - } - --bool --vc4_use_bo(struct vc4_exec_info *exec, -- uint32_t hindex, -- enum vc4_bo_mode mode, -- struct drm_gem_cma_object **obj) -+struct drm_gem_cma_object * -+vc4_use_bo(struct vc4_exec_info *exec, uint32_t hindex) - { -- *obj = NULL; -+ struct drm_gem_cma_object *obj; -+ struct vc4_bo *bo; - - if (hindex >= exec->bo_count) { - DRM_ERROR("BO index %d greater than BO count %d\n", - hindex, exec->bo_count); -- return false; -+ return NULL; - } -+ obj = exec->bo[hindex]; -+ bo = to_vc4_bo(&obj->base); - -- if (exec->bo[hindex].mode != mode) { -- if (exec->bo[hindex].mode == VC4_MODE_UNDECIDED) { -- exec->bo[hindex].mode = mode; -- } else { -- DRM_ERROR("BO index %d reused with mode %d vs %d\n", -- hindex, exec->bo[hindex].mode, mode); -- return false; -- } -+ if (bo->validated_shader) { -+ DRM_ERROR("Trying to use shader BO as something other than " -+ "a shader\n"); -+ return NULL; - } - -- *obj = exec->bo[hindex].bo; -- return true; -+ return obj; ++ input_unregister_device(rpisense_js->keys_dev); ++ input_free_device(rpisense_js->keys_dev); ++ return 0; +} + -+static struct drm_gem_cma_object * -+vc4_use_handle(struct vc4_exec_info *exec, uint32_t gem_handles_packet_index) -+{ -+ return vc4_use_bo(exec, exec->bo_index[gem_handles_packet_index]); - } - - static bool --vc4_use_handle(struct vc4_exec_info *exec, -- uint32_t gem_handles_packet_index, -- enum vc4_bo_mode mode, -- struct drm_gem_cma_object **obj) -+validate_bin_pos(struct vc4_exec_info *exec, void *untrusted, uint32_t pos) - { -- return vc4_use_bo(exec, exec->bo_index[gem_handles_packet_index], -- mode, obj); -+ /* Note that the untrusted pointer passed to these functions is -+ * incremented past the packet byte. -+ */ -+ return (untrusted - 1 == exec->bin_u + pos); - } - - static uint32_t -@@ -202,13 +202,13 @@ vc4_check_tex_size(struct vc4_exec_info *exec, struct drm_gem_cma_object *fbo, - } - - static int --validate_flush_all(VALIDATE_ARGS) -+validate_flush(VALIDATE_ARGS) - { -- if (exec->found_increment_semaphore_packet) { -- DRM_ERROR("VC4_PACKET_FLUSH_ALL after " -- "VC4_PACKET_INCREMENT_SEMAPHORE\n"); -+ if (!validate_bin_pos(exec, untrusted, exec->args->bin_cl_size - 1)) { -+ DRM_ERROR("Bin CL must end with VC4_PACKET_FLUSH\n"); - return -EINVAL; - } -+ exec->found_flush = true; - - return 0; - } -@@ -233,17 +233,13 @@ validate_start_tile_binning(VALIDATE_ARGS) - static int - validate_increment_semaphore(VALIDATE_ARGS) - { -- if (exec->found_increment_semaphore_packet) { -- DRM_ERROR("Duplicate VC4_PACKET_INCREMENT_SEMAPHORE\n"); -+ if (!validate_bin_pos(exec, untrusted, exec->args->bin_cl_size - 2)) { -+ DRM_ERROR("Bin CL must end with " -+ "VC4_PACKET_INCREMENT_SEMAPHORE\n"); - return -EINVAL; - } - exec->found_increment_semaphore_packet = true; - -- /* Once we've found the semaphore increment, there should be one FLUSH -- * then the end of the command list. The FLUSH actually triggers the -- * increment, so we only need to make sure there -- */ -- - return 0; - } - -@@ -257,11 +253,6 @@ validate_indexed_prim_list(VALIDATE_ARGS) - uint32_t index_size = (*(uint8_t *)(untrusted + 0) >> 4) ? 2 : 1; - struct vc4_shader_state *shader_state; - -- if (exec->found_increment_semaphore_packet) { -- DRM_ERROR("Drawing after VC4_PACKET_INCREMENT_SEMAPHORE\n"); -- return -EINVAL; -- } -- - /* Check overflow condition */ - if (exec->shader_state_count == 0) { - DRM_ERROR("shader state must precede primitives\n"); -@@ -272,7 +263,8 @@ validate_indexed_prim_list(VALIDATE_ARGS) - if (max_index > shader_state->max_index) - shader_state->max_index = max_index; - -- if (!vc4_use_handle(exec, 0, VC4_MODE_RENDER, &ib)) -+ ib = vc4_use_handle(exec, 0); -+ if (!ib) - return -EINVAL; - - if (offset > ib->base.size || -@@ -295,11 +287,6 @@ validate_gl_array_primitive(VALIDATE_ARGS) - uint32_t max_index; - struct vc4_shader_state *shader_state; - -- if (exec->found_increment_semaphore_packet) { -- DRM_ERROR("Drawing after VC4_PACKET_INCREMENT_SEMAPHORE\n"); -- return -EINVAL; -- } -- - /* Check overflow condition */ - if (exec->shader_state_count == 0) { - DRM_ERROR("shader state must precede primitives\n"); -@@ -329,7 +316,6 @@ validate_gl_shader_state(VALIDATE_ARGS) - return -EINVAL; - } - -- exec->shader_state[i].packet = VC4_PACKET_GL_SHADER_STATE; - exec->shader_state[i].addr = *(uint32_t *)untrusted; - exec->shader_state[i].max_index = 0; - -@@ -348,31 +334,6 @@ validate_gl_shader_state(VALIDATE_ARGS) - } - - static int --validate_nv_shader_state(VALIDATE_ARGS) --{ -- uint32_t i = exec->shader_state_count++; -- -- if (i >= exec->shader_state_size) { -- DRM_ERROR("More requests for shader states than declared\n"); -- return -EINVAL; -- } -- -- exec->shader_state[i].packet = VC4_PACKET_NV_SHADER_STATE; -- exec->shader_state[i].addr = *(uint32_t *)untrusted; -- -- if (exec->shader_state[i].addr & 15) { -- DRM_ERROR("NV shader state address 0x%08x misaligned\n", -- exec->shader_state[i].addr); -- return -EINVAL; -- } -- -- *(uint32_t *)validated = (exec->shader_state[i].addr + -- exec->shader_rec_p); -- -- return 0; --} -- --static int - validate_tile_binning_config(VALIDATE_ARGS) - { - struct drm_device *dev = exec->exec_bo->base.dev; -@@ -473,8 +434,8 @@ static const struct cmd_info { - } cmd_info[] = { - VC4_DEFINE_PACKET(VC4_PACKET_HALT, NULL), - VC4_DEFINE_PACKET(VC4_PACKET_NOP, NULL), -- VC4_DEFINE_PACKET(VC4_PACKET_FLUSH, NULL), -- VC4_DEFINE_PACKET(VC4_PACKET_FLUSH_ALL, validate_flush_all), -+ VC4_DEFINE_PACKET(VC4_PACKET_FLUSH, validate_flush), -+ VC4_DEFINE_PACKET(VC4_PACKET_FLUSH_ALL, NULL), - VC4_DEFINE_PACKET(VC4_PACKET_START_TILE_BINNING, - validate_start_tile_binning), - VC4_DEFINE_PACKET(VC4_PACKET_INCREMENT_SEMAPHORE, -@@ -488,7 +449,6 @@ static const struct cmd_info { - VC4_DEFINE_PACKET(VC4_PACKET_PRIMITIVE_LIST_FORMAT, NULL), - - VC4_DEFINE_PACKET(VC4_PACKET_GL_SHADER_STATE, validate_gl_shader_state), -- VC4_DEFINE_PACKET(VC4_PACKET_NV_SHADER_STATE, validate_nv_shader_state), - - VC4_DEFINE_PACKET(VC4_PACKET_CONFIGURATION_BITS, NULL), - VC4_DEFINE_PACKET(VC4_PACKET_FLAT_SHADE_FLAGS, NULL), -@@ -575,8 +535,16 @@ vc4_validate_bin_cl(struct drm_device *dev, - return -EINVAL; - } - -- if (!exec->found_increment_semaphore_packet) { -- DRM_ERROR("Bin CL missing VC4_PACKET_INCREMENT_SEMAPHORE\n"); -+ /* The bin CL must be ended with INCREMENT_SEMAPHORE and FLUSH. The -+ * semaphore is used to trigger the render CL to start up, and the -+ * FLUSH is what caps the bin lists with -+ * VC4_PACKET_RETURN_FROM_SUB_LIST (so they jump back to the main -+ * render CL when they get called to) and actually triggers the queued -+ * semaphore increment. -+ */ -+ if (!exec->found_increment_semaphore_packet || !exec->found_flush) { -+ DRM_ERROR("Bin CL missing VC4_PACKET_INCREMENT_SEMAPHORE + " -+ "VC4_PACKET_FLUSH\n"); - return -EINVAL; - } - -@@ -607,7 +575,8 @@ reloc_tex(struct vc4_exec_info *exec, - uint32_t cube_map_stride = 0; - enum vc4_texture_data_type type; - -- if (!vc4_use_bo(exec, texture_handle_index, VC4_MODE_RENDER, &tex)) -+ tex = vc4_use_bo(exec, texture_handle_index); -+ if (!tex) - return false; - - if (sample->is_direct) { -@@ -755,51 +724,28 @@ reloc_tex(struct vc4_exec_info *exec, - } - - static int --validate_shader_rec(struct drm_device *dev, -- struct vc4_exec_info *exec, -- struct vc4_shader_state *state) -+validate_gl_shader_rec(struct drm_device *dev, -+ struct vc4_exec_info *exec, -+ struct vc4_shader_state *state) - { - uint32_t *src_handles; - void *pkt_u, *pkt_v; -- enum shader_rec_reloc_type { -- RELOC_CODE, -- RELOC_VBO, -- }; -- struct shader_rec_reloc { -- enum shader_rec_reloc_type type; -- uint32_t offset; -- }; -- static const struct shader_rec_reloc gl_relocs[] = { -- { RELOC_CODE, 4 }, /* fs */ -- { RELOC_CODE, 16 }, /* vs */ -- { RELOC_CODE, 28 }, /* cs */ -- }; -- static const struct shader_rec_reloc nv_relocs[] = { -- { RELOC_CODE, 4 }, /* fs */ -- { RELOC_VBO, 12 } -+ static const uint32_t shader_reloc_offsets[] = { -+ 4, /* fs */ -+ 16, /* vs */ -+ 28, /* cs */ - }; -- const struct shader_rec_reloc *relocs; -- struct drm_gem_cma_object *bo[ARRAY_SIZE(gl_relocs) + 8]; -- uint32_t nr_attributes = 0, nr_fixed_relocs, nr_relocs, packet_size; -+ uint32_t shader_reloc_count = ARRAY_SIZE(shader_reloc_offsets); -+ struct drm_gem_cma_object *bo[shader_reloc_count + 8]; -+ uint32_t nr_attributes, nr_relocs, packet_size; - int i; -- struct vc4_validated_shader_info *shader; - -- if (state->packet == VC4_PACKET_NV_SHADER_STATE) { -- relocs = nv_relocs; -- nr_fixed_relocs = ARRAY_SIZE(nv_relocs); -- -- packet_size = 16; -- } else { -- relocs = gl_relocs; -- nr_fixed_relocs = ARRAY_SIZE(gl_relocs); -- -- nr_attributes = state->addr & 0x7; -- if (nr_attributes == 0) -- nr_attributes = 8; -- packet_size = gl_shader_rec_size(state->addr); -- } -- nr_relocs = nr_fixed_relocs + nr_attributes; -+ nr_attributes = state->addr & 0x7; -+ if (nr_attributes == 0) -+ nr_attributes = 8; -+ packet_size = gl_shader_rec_size(state->addr); - -+ nr_relocs = ARRAY_SIZE(shader_reloc_offsets) + nr_attributes; - if (nr_relocs * 4 > exec->shader_rec_size) { - DRM_ERROR("overflowed shader recs reading %d handles " - "from %d bytes left\n", -@@ -829,21 +775,30 @@ validate_shader_rec(struct drm_device *dev, - exec->shader_rec_v += roundup(packet_size, 16); - exec->shader_rec_size -= packet_size; - -- for (i = 0; i < nr_relocs; i++) { -- enum vc4_bo_mode mode; -+ if (!(*(uint16_t *)pkt_u & VC4_SHADER_FLAG_FS_SINGLE_THREAD)) { -+ DRM_ERROR("Multi-threaded fragment shaders not supported.\n"); -+ return -EINVAL; -+ } - -- if (i < nr_fixed_relocs && relocs[i].type == RELOC_CODE) -- mode = VC4_MODE_SHADER; -- else -- mode = VC4_MODE_RENDER; -+ for (i = 0; i < shader_reloc_count; i++) { -+ if (src_handles[i] > exec->bo_count) { -+ DRM_ERROR("Shader handle %d too big\n", src_handles[i]); -+ return -EINVAL; -+ } - -- if (!vc4_use_bo(exec, src_handles[i], mode, &bo[i])) -- return false; -+ bo[i] = exec->bo[src_handles[i]]; -+ if (!bo[i]) -+ return -EINVAL; -+ } -+ for (i = shader_reloc_count; i < nr_relocs; i++) { -+ bo[i] = vc4_use_bo(exec, src_handles[i]); -+ if (!bo[i]) -+ return -EINVAL; - } - -- for (i = 0; i < nr_fixed_relocs; i++) { -- struct vc4_bo *vc4_bo; -- uint32_t o = relocs[i].offset; -+ for (i = 0; i < shader_reloc_count; i++) { -+ struct vc4_validated_shader_info *validated_shader; -+ uint32_t o = shader_reloc_offsets[i]; - uint32_t src_offset = *(uint32_t *)(pkt_u + o); - uint32_t *texture_handles_u; - void *uniform_data_u; -@@ -851,57 +806,50 @@ validate_shader_rec(struct drm_device *dev, - - *(uint32_t *)(pkt_v + o) = bo[i]->paddr + src_offset; - -- switch (relocs[i].type) { -- case RELOC_CODE: -- if (src_offset != 0) { -- DRM_ERROR("Shaders must be at offset 0 " -- "of the BO.\n"); -- goto fail; -- } -+ if (src_offset != 0) { -+ DRM_ERROR("Shaders must be at offset 0 of " -+ "the BO.\n"); -+ return -EINVAL; -+ } - -- vc4_bo = to_vc4_bo(&bo[i]->base); -- shader = vc4_bo->validated_shader; -- if (!shader) -- goto fail; -+ validated_shader = to_vc4_bo(&bo[i]->base)->validated_shader; -+ if (!validated_shader) -+ return -EINVAL; - -- if (shader->uniforms_src_size > exec->uniforms_size) { -- DRM_ERROR("Uniforms src buffer overflow\n"); -- goto fail; -- } -+ if (validated_shader->uniforms_src_size > -+ exec->uniforms_size) { -+ DRM_ERROR("Uniforms src buffer overflow\n"); -+ return -EINVAL; -+ } - -- texture_handles_u = exec->uniforms_u; -- uniform_data_u = (texture_handles_u + -- shader->num_texture_samples); -- -- memcpy(exec->uniforms_v, uniform_data_u, -- shader->uniforms_size); -- -- for (tex = 0; -- tex < shader->num_texture_samples; -- tex++) { -- if (!reloc_tex(exec, -- uniform_data_u, -- &shader->texture_samples[tex], -- texture_handles_u[tex])) { -- goto fail; -- } -- } -+ texture_handles_u = exec->uniforms_u; -+ uniform_data_u = (texture_handles_u + -+ validated_shader->num_texture_samples); - -- *(uint32_t *)(pkt_v + o + 4) = exec->uniforms_p; -+ memcpy(exec->uniforms_v, uniform_data_u, -+ validated_shader->uniforms_size); - -- exec->uniforms_u += shader->uniforms_src_size; -- exec->uniforms_v += shader->uniforms_size; -- exec->uniforms_p += shader->uniforms_size; -+ for (tex = 0; -+ tex < validated_shader->num_texture_samples; -+ tex++) { -+ if (!reloc_tex(exec, -+ uniform_data_u, -+ &validated_shader->texture_samples[tex], -+ texture_handles_u[tex])) { -+ return -EINVAL; -+ } -+ } - -- break; -+ *(uint32_t *)(pkt_v + o + 4) = exec->uniforms_p; - -- case RELOC_VBO: -- break; -- } -+ exec->uniforms_u += validated_shader->uniforms_src_size; -+ exec->uniforms_v += validated_shader->uniforms_size; -+ exec->uniforms_p += validated_shader->uniforms_size; - } - - for (i = 0; i < nr_attributes; i++) { -- struct drm_gem_cma_object *vbo = bo[nr_fixed_relocs + i]; -+ struct drm_gem_cma_object *vbo = -+ bo[ARRAY_SIZE(shader_reloc_offsets) + i]; - uint32_t o = 36 + i * 8; - uint32_t offset = *(uint32_t *)(pkt_u + o + 0); - uint32_t attr_size = *(uint8_t *)(pkt_u + o + 4) + 1; -@@ -933,9 +881,6 @@ validate_shader_rec(struct drm_device *dev, - } - - return 0; -- --fail: -- return -EINVAL; - } - - int -@@ -946,7 +891,7 @@ vc4_validate_shader_recs(struct drm_device *dev, - int ret = 0; - - for (i = 0; i < exec->shader_state_count; i++) { -- ret = validate_shader_rec(dev, exec, &exec->shader_state[i]); -+ ret = validate_gl_shader_rec(dev, exec, &exec->shader_state[i]); - if (ret) - return ret; - } - -From 280bea89916813978b81811c2769411d438eb52f Mon Sep 17 00:00:00 2001 -From: janluca <janluca@zedat.fu-berlin.de> -Date: Sun, 27 Dec 2015 14:34:04 +0100 -Subject: [PATCH 121/170] MMC: Do not use mmc_debug if CONFIG_MMC_BCM2835 is - not set - -If CONFIG_MMC_BCM2835 was not set the compiling of the kernel failed -since mmc_debug was not defined but used in drivers/mmc/core/quirks.c. - -This patch add a ifdef-check for CONFIG_MMC_BCM2835 to the change of -commit 64d395457f793250d2e582eeb38cc3403b1db98c ---- - drivers/mmc/core/quirks.c | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/drivers/mmc/core/quirks.c b/drivers/mmc/core/quirks.c -index 87ae2e9..b79fe14 100644 ---- a/drivers/mmc/core/quirks.c -+++ b/drivers/mmc/core/quirks.c -@@ -53,7 +53,9 @@ static const struct mmc_fixup mmc_fixup_methods[] = { - - void mmc_fixup_device(struct mmc_card *card, const struct mmc_fixup *table) - { -+#ifdef CONFIG_MMC_BCM2835 - extern unsigned mmc_debug; -+#endif - const struct mmc_fixup *f; - u64 rev = cid_rev_card(card); - -@@ -81,7 +83,9 @@ void mmc_fixup_device(struct mmc_card *card, const struct mmc_fixup *table) - /* SDHCI on BCM2708 - bug causes a certain sequence of CMD23 operations to fail. - * Disable this flag for all cards (fall-back to CMD25/CMD18 multi-block transfers). - */ -+#ifdef CONFIG_MMC_BCM2835 - if (mmc_debug & (1<<13)) - card->quirks |= MMC_QUIRK_BLK_NO_CMD23; ++#ifdef CONFIG_OF ++static const struct of_device_id rpisense_js_id[] = { ++ { .compatible = "rpi,rpi-sense-js" }, ++ { }, ++}; ++MODULE_DEVICE_TABLE(of, rpisense_js_id); +#endif - } - EXPORT_SYMBOL(mmc_fixup_device); - -From d0390ae0ff774d8e7b5b4d5f38c33726354996bc Mon Sep 17 00:00:00 2001 -From: Devon Fyson <devonfyson@gmail.com> -Date: Wed, 30 Dec 2015 16:40:47 -0500 -Subject: [PATCH 122/170] Extend clock timeout, fix modprobe baudrate - parameter. - -Set the BSC_CLKT clock streching timeout to 35ms as per SMBus specs.\n- Increase priority of baudrate parameter passed to modprobe (in /etc/modprobe.d/*.conf or command line). Currently custom baudrates don't work because they are overridden by clock-frequency in the platform_device passed to the function. ---- - drivers/i2c/busses/i2c-bcm2708.c | 45 ++++++++++++++++++++++++++-------------- - 1 file changed, 29 insertions(+), 16 deletions(-) - -diff --git a/drivers/i2c/busses/i2c-bcm2708.c b/drivers/i2c/busses/i2c-bcm2708.c -index 85f411c..b152639 100644 ---- a/drivers/i2c/busses/i2c-bcm2708.c -+++ b/drivers/i2c/busses/i2c-bcm2708.c -@@ -71,7 +71,8 @@ - - #define DRV_NAME "bcm2708_i2c" - --static unsigned int baudrate = CONFIG_I2C_BCM2708_BAUDRATE; -+static unsigned int baudrate_default = CONFIG_I2C_BCM2708_BAUDRATE; -+static unsigned int baudrate; - module_param(baudrate, uint, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP); - MODULE_PARM_DESC(baudrate, "The I2C baudrate"); - -@@ -87,6 +88,7 @@ struct bcm2708_i2c { - int irq; - struct clk *clk; - u32 cdiv; -+ u32 clk_tout; - - struct completion done; - -@@ -126,7 +128,7 @@ static inline void bcm2708_bsc_fifo_fill(struct bcm2708_i2c *bi) - - static inline int bcm2708_bsc_setup(struct bcm2708_i2c *bi) - { -- u32 cdiv, s; -+ u32 cdiv, s, clk_tout; - u32 c = BSC_C_I2CEN | BSC_C_INTD | BSC_C_ST | BSC_C_CLEAR_1; - int wait_loops = I2C_WAIT_LOOP_COUNT; - -@@ -134,12 +136,14 @@ static inline int bcm2708_bsc_setup(struct bcm2708_i2c *bi) - * Use the value that we cached in the probe. - */ - cdiv = bi->cdiv; -+ clk_tout = bi->clk_tout; - - if (bi->msg->flags & I2C_M_RD) - c |= BSC_C_INTR | BSC_C_READ; - else - c |= BSC_C_INTT; - -+ bcm2708_wr(bi, BSC_CLKT, clk_tout); - bcm2708_wr(bi, BSC_DIV, cdiv); - bcm2708_wr(bi, BSC_A, bi->msg->addr); - bcm2708_wr(bi, BSC_DLEN, bi->msg->len); -@@ -312,21 +316,24 @@ static int bcm2708_i2c_probe(struct platform_device *pdev) - struct bcm2708_i2c *bi; - struct i2c_adapter *adap; - unsigned long bus_hz; -- u32 cdiv; -- -- if (pdev->dev.of_node) { -- u32 bus_clk_rate; -- pdev->id = of_alias_get_id(pdev->dev.of_node, "i2c"); -- if (pdev->id < 0) { -- dev_err(&pdev->dev, "alias is missing\n"); -- return -EINVAL; -+ u32 cdiv, clk_tout; -+ -+ if (!baudrate) { -+ baudrate = baudrate_default; -+ if (pdev->dev.of_node) { -+ u32 bus_clk_rate; -+ pdev->id = of_alias_get_id(pdev->dev.of_node, "i2c"); -+ if (pdev->id < 0) { -+ dev_err(&pdev->dev, "alias is missing\n"); -+ return -EINVAL; -+ } -+ if (!of_property_read_u32(pdev->dev.of_node, -+ "clock-frequency", &bus_clk_rate)) -+ baudrate = bus_clk_rate; -+ else -+ dev_warn(&pdev->dev, -+ "Could not read clock-frequency property\n"); - } -- if (!of_property_read_u32(pdev->dev.of_node, -- "clock-frequency", &bus_clk_rate)) -- baudrate = bus_clk_rate; -- else -- dev_warn(&pdev->dev, -- "Could not read clock-frequency property\n"); - } - - regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); -@@ -417,7 +424,13 @@ static int bcm2708_i2c_probe(struct platform_device *pdev) - cdiv = 0xffff; - baudrate = bus_hz / cdiv; - } -+ -+ clk_tout = 35/1000*baudrate; //35ms timeout as per SMBus specs. -+ if (clk_tout > 0xffff) -+ clk_tout = 0xffff; -+ - bi->cdiv = cdiv; -+ bi->clk_tout = clk_tout; - - dev_info(&pdev->dev, "BSC%d Controller at 0x%08lx (irq %d) (baudrate %d)\n", - pdev->id, (unsigned long)regs->start, irq, baudrate); - -From 62dca1937fc3acfe4b6471607b7a4d58c34e73b7 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= <noralf@tronnes.org> -Date: Thu, 31 Dec 2015 16:44:58 +0100 -Subject: [PATCH 123/170] bcm270x_dt: Add dwc2 and dwc-otg overlays - ---- - arch/arm/boot/dts/overlays/Makefile | 2 ++ - arch/arm/boot/dts/overlays/README | 21 +++++++++++++++++++ - arch/arm/boot/dts/overlays/dwc-otg-overlay.dts | 20 ++++++++++++++++++ - arch/arm/boot/dts/overlays/dwc2-overlay.dts | 29 ++++++++++++++++++++++++++ - 4 files changed, 72 insertions(+) - create mode 100644 arch/arm/boot/dts/overlays/dwc-otg-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/dwc2-overlay.dts - -diff --git a/arch/arm/boot/dts/overlays/Makefile b/arch/arm/boot/dts/overlays/Makefile -index be9dead..aaa8976 100644 ---- a/arch/arm/boot/dts/overlays/Makefile -+++ b/arch/arm/boot/dts/overlays/Makefile -@@ -15,6 +15,8 @@ endif - dtb-$(RPI_DT_OVERLAYS) += ads7846-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += at86rf233-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += bmp085_i2c-sensor-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += dwc2-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += dwc-otg-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += dht11-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += enc28j60-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += gpio-ir-overlay.dtb -diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README -index 04e55ce..c70c1e59 100644 ---- a/arch/arm/boot/dts/overlays/README -+++ b/arch/arm/boot/dts/overlays/README -@@ -198,6 +198,27 @@ Params: gpiopin GPIO connected to the sensor's DATA output. - (default 4) - ++ ++static struct platform_device_id rpisense_js_device_id[] = { ++ { .name = "rpi-sense-js" }, ++ { }, ++}; ++MODULE_DEVICE_TABLE(platform, rpisense_js_device_id); ++ ++static struct platform_driver rpisense_js_driver = { ++ .probe = rpisense_js_probe, ++ .remove = rpisense_js_remove, ++ .driver = { ++ .name = "rpi-sense-js", ++ .owner = THIS_MODULE, ++ }, ++}; ++ ++module_platform_driver(rpisense_js_driver); ++ ++MODULE_DESCRIPTION("Raspberry Pi Sense HAT joystick driver"); ++MODULE_AUTHOR("Serge Schneider <serge@raspberrypi.org>"); ++MODULE_LICENSE("GPL"); +diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig +index eea61e3..d2c3b72 100644 +--- a/drivers/mfd/Kconfig ++++ b/drivers/mfd/Kconfig +@@ -10,6 +10,14 @@ config MFD_CORE + select IRQ_DOMAIN + default n -+Name: dwc-otg -+Info: Selects the dwc_otg USB controller driver which has fiq support. This -+ is the default on all except the Pi Zero which defaults to dwc2. -+Load: dtoverlay=dwc-otg -+Params: <None> ++config MFD_RPISENSE_CORE ++ tristate "Raspberry Pi Sense HAT core functions" ++ depends on I2C ++ select MFD_CORE ++ help ++ This is the core driver for the Raspberry Pi Sense HAT. This provides ++ the necessary functions to communicate with the hardware. ++ + config MFD_CS5535 + tristate "AMD CS5535 and CS5536 southbridge core functions" + select MFD_CORE +diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile +index 5eaa6465d..8dc2dde 100644 +--- a/drivers/mfd/Makefile ++++ b/drivers/mfd/Makefile +@@ -203,3 +203,5 @@ intel-soc-pmic-objs := intel_soc_pmic_core.o intel_soc_pmic_crc.o + intel-soc-pmic-$(CONFIG_INTEL_PMC_IPC) += intel_soc_pmic_bxtwc.o + obj-$(CONFIG_INTEL_SOC_PMIC) += intel-soc-pmic.o + obj-$(CONFIG_MFD_MT6397) += mt6397-core.o ++ ++obj-$(CONFIG_MFD_RPISENSE_CORE) += rpisense-core.o +diff --git a/drivers/mfd/rpisense-core.c b/drivers/mfd/rpisense-core.c +new file mode 100644 +index 0000000..eea9312 +--- /dev/null ++++ b/drivers/mfd/rpisense-core.c +@@ -0,0 +1,157 @@ ++/* ++ * Raspberry Pi Sense HAT core driver ++ * http://raspberrypi.org ++ * ++ * Copyright (C) 2015 Raspberry Pi ++ * ++ * Author: Serge Schneider ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License as published by the ++ * Free Software Foundation; either version 2 of the License, or (at your ++ * option) any later version. ++ * ++ * This driver is based on wm8350 implementation. ++ */ + ++#include <linux/module.h> ++#include <linux/moduleparam.h> ++#include <linux/err.h> ++#include <linux/init.h> ++#include <linux/i2c.h> ++#include <linux/platform_device.h> ++#include <linux/mfd/rpisense/core.h> ++#include <linux/slab.h> + -+Name: dwc2 -+Info: Selects the dwc2 USB controller driver -+Load: dtoverlay=dwc2,<param>=<val> -+Params: dr_mode Dual role mode: "host", "peripheral" or "otg" ++static struct rpisense *rpisense; + -+ g-rx-fifo-size Size of rx fifo size in gadget mode ++static void rpisense_client_dev_register(struct rpisense *rpisense, ++ const char *name, ++ struct platform_device **pdev) ++{ ++ int ret; + -+ g-np-tx-fifo-size Size of non-periodic tx fifo size in gadget -+ mode ++ *pdev = platform_device_alloc(name, -1); ++ if (*pdev == NULL) { ++ dev_err(rpisense->dev, "Failed to allocate %s\n", name); ++ return; ++ } + -+ g-tx-fifo-size Size of periodic tx fifo per endpoint -+ (except ep0) in gadget mode ++ (*pdev)->dev.parent = rpisense->dev; ++ platform_set_drvdata(*pdev, rpisense); ++ ret = platform_device_add(*pdev); ++ if (ret != 0) { ++ dev_err(rpisense->dev, "Failed to register %s: %d\n", ++ name, ret); ++ platform_device_put(*pdev); ++ *pdev = NULL; ++ } ++} + ++static int rpisense_probe(struct i2c_client *i2c, ++ const struct i2c_device_id *id) ++{ ++ int ret; ++ struct rpisense_js *rpisense_js; + - [ The ds1307-rtc overlay has been deleted. See i2c-rtc. ] - - -diff --git a/arch/arm/boot/dts/overlays/dwc-otg-overlay.dts b/arch/arm/boot/dts/overlays/dwc-otg-overlay.dts -new file mode 100644 -index 0000000..fc48bd1 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/dwc-otg-overlay.dts -@@ -0,0 +1,20 @@ -+/dts-v1/; -+/plugin/; ++ rpisense = devm_kzalloc(&i2c->dev, sizeof(struct rpisense), GFP_KERNEL); ++ if (rpisense == NULL) ++ return -ENOMEM; + -+/{ -+ compatible = "brcm,bcm2708"; ++ i2c_set_clientdata(i2c, rpisense); ++ rpisense->dev = &i2c->dev; ++ rpisense->i2c_client = i2c; + -+ fragment@0 { -+ target = <&usb>; -+ #address-cells = <1>; -+ #size-cells = <1>; -+ __overlay__ { -+ compatible = "brcm,bcm2708-usb"; -+ reg = <0x7e980000 0x10000>, -+ <0x7e006000 0x1000>; -+ interrupts = <2 0>, -+ <1 9>; -+ status = "okay"; -+ }; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/dwc2-overlay.dts b/arch/arm/boot/dts/overlays/dwc2-overlay.dts -new file mode 100644 -index 0000000..90c9811 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/dwc2-overlay.dts -@@ -0,0 +1,29 @@ -+/dts-v1/; -+/plugin/; ++ ret = rpisense_reg_read(rpisense, RPISENSE_WAI); ++ if (ret > 0) { ++ if (ret != 's') ++ return -EINVAL; ++ } else { ++ return ret; ++ } ++ ret = rpisense_reg_read(rpisense, RPISENSE_VER); ++ if (ret < 0) ++ return ret; + -+/{ -+ compatible = "brcm,bcm2708"; ++ dev_info(rpisense->dev, ++ "Raspberry Pi Sense HAT firmware version %i\n", ret); + -+ fragment@0 { -+ target = <&usb>; -+ #address-cells = <1>; -+ #size-cells = <1>; -+ __overlay__ { -+ compatible = "brcm,bcm2835-usb"; -+ reg = <0x7e980000 0x10000>; -+ interrupts = <1 9>; -+ dr_mode = "otg"; -+ g-np-tx-fifo-size = <32>; -+ g-rx-fifo-size = <256>; -+ g-tx-fifo-size = <256 128 128 64 64 64 32>; -+ status = "okay"; -+ }; -+ }; ++ rpisense_js = &rpisense->joystick; ++ rpisense_js->keys_desc = devm_gpiod_get(&i2c->dev, ++ "keys-int", GPIOD_IN); ++ if (IS_ERR(rpisense_js->keys_desc)) { ++ dev_warn(&i2c->dev, "Failed to get keys-int descriptor.\n"); ++ rpisense_js->keys_desc = gpio_to_desc(23); ++ if (rpisense_js->keys_desc == NULL) { ++ dev_err(&i2c->dev, "GPIO23 fallback failed.\n"); ++ return PTR_ERR(rpisense_js->keys_desc); ++ } ++ } ++ rpisense_client_dev_register(rpisense, "rpi-sense-js", ++ &(rpisense->joystick.pdev)); ++ rpisense_client_dev_register(rpisense, "rpi-sense-fb", ++ &(rpisense->framebuffer.pdev)); + -+ __overrides__ { -+ dr_mode = <&usb>, "dr_mode"; -+ g-np-tx-fifo-size = <&usb>,"g-np-tx-fifo-size:0"; -+ g-rx-fifo-size = <&usb>,"g-rx-fifo-size:0"; -+ g-tx-fifo-size = <&usb>,"g-tx-fifo-size:0"; -+ }; ++ return 0; ++} ++ ++static int rpisense_remove(struct i2c_client *i2c) ++{ ++ struct rpisense *rpisense = i2c_get_clientdata(i2c); ++ ++ platform_device_unregister(rpisense->joystick.pdev); ++ return 0; ++} ++ ++struct rpisense *rpisense_get_dev(void) ++{ ++ return rpisense; ++} ++EXPORT_SYMBOL_GPL(rpisense_get_dev); ++ ++s32 rpisense_reg_read(struct rpisense *rpisense, int reg) ++{ ++ int ret = i2c_smbus_read_byte_data(rpisense->i2c_client, reg); ++ ++ if (ret < 0) ++ dev_err(rpisense->dev, "Read from reg %d failed\n", reg); ++ /* Due to the BCM270x I2C clock stretching bug, some values ++ * may have MSB set. Clear it to avoid incorrect values. ++ * */ ++ return ret & 0x7F; ++} ++EXPORT_SYMBOL_GPL(rpisense_reg_read); ++ ++int rpisense_block_write(struct rpisense *rpisense, const char *buf, int count) ++{ ++ int ret = i2c_master_send(rpisense->i2c_client, buf, count); ++ ++ if (ret < 0) ++ dev_err(rpisense->dev, "Block write failed\n"); ++ return ret; ++} ++EXPORT_SYMBOL_GPL(rpisense_block_write); ++ ++static const struct i2c_device_id rpisense_i2c_id[] = { ++ { "rpi-sense", 0 }, ++ { } ++}; ++MODULE_DEVICE_TABLE(i2c, rpisense_i2c_id); ++ ++ ++static struct i2c_driver rpisense_driver = { ++ .driver = { ++ .name = "rpi-sense", ++ .owner = THIS_MODULE, ++ }, ++ .probe = rpisense_probe, ++ .remove = rpisense_remove, ++ .id_table = rpisense_i2c_id, +}; - -From 162dd00041afb2995f90a928ea80aeaa0d141ce5 Mon Sep 17 00:00:00 2001 -From: Phil Elwell <phil@raspberrypi.org> -Date: Mon, 4 Jan 2016 14:42:17 +0000 -Subject: [PATCH 124/170] BCM270X_DT: Add the sdtweak overlay, for tuning - sdhost - -The sdhost overlay declares the sdhost interface and allows parameters -to be set. This is overkill for situations where the user just wants to -tweak the parameters of a pre-declared sdhost interface, so create an -sdtweak overlay that does just that. ---- - arch/arm/boot/dts/overlays/Makefile | 1 + - arch/arm/boot/dts/overlays/README | 14 ++++++++++++++ - arch/arm/boot/dts/overlays/sdtweak-overlay.dts | 21 +++++++++++++++++++++ - 3 files changed, 36 insertions(+) - create mode 100644 arch/arm/boot/dts/overlays/sdtweak-overlay.dts - -diff --git a/arch/arm/boot/dts/overlays/Makefile b/arch/arm/boot/dts/overlays/Makefile -index aaa8976..4d9d640 100644 ---- a/arch/arm/boot/dts/overlays/Makefile -+++ b/arch/arm/boot/dts/overlays/Makefile -@@ -53,6 +53,7 @@ dtb-$(RPI_DT_OVERLAYS) += rpi-proto-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += rpi-sense-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += sdhost-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += sdio-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += sdtweak-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += smi-dev-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += smi-nand-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += smi-overlay.dtb -diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README -index c70c1e59..00f03fc 100644 ---- a/arch/arm/boot/dts/overlays/README -+++ b/arch/arm/boot/dts/overlays/README -@@ -635,6 +635,20 @@ Params: overclock_50 Clock (in MHz) to use when the MMC framework - (default on: polling once at boot-time) - - -+Name: sdtweak -+Info: Tunes the bcm2835-sdhost SD/MMC driver -+Load: dtoverlay=sdtweak,<param>=<val> -+Params: overclock_50 Clock (in MHz) to use when the MMC framework -+ requests 50MHz + -+ force_pio Disable DMA support (default off) ++module_i2c_driver(rpisense_driver); + -+ pio_limit Number of blocks above which to use DMA -+ (default 1) ++MODULE_DESCRIPTION("Raspberry Pi Sense HAT core driver"); ++MODULE_AUTHOR("Serge Schneider <serge@raspberrypi.org>"); ++MODULE_LICENSE("GPL"); + -+ debug Enable debug output (default off) +diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig +index ee72c3a..5be1a31 100644 +--- a/drivers/video/fbdev/Kconfig ++++ b/drivers/video/fbdev/Kconfig +@@ -2502,3 +2502,16 @@ config FB_SM712 + This driver is also available as a module. The module will be + called sm712fb. If you want to compile it as a module, say M + here and read <file:Documentation/kbuild/modules.txt>. + ++config FB_RPISENSE ++ tristate "Raspberry Pi Sense HAT framebuffer" ++ depends on FB ++ select MFD_RPISENSE_CORE ++ select FB_SYS_FOPS ++ select FB_SYS_FILLRECT ++ select FB_SYS_COPYAREA ++ select FB_SYS_IMAGEBLIT ++ select FB_DEFERRED_IO + - Name: smi - Info: Enables the Secondary Memory Interface peripheral. Uses GPIOs 2-25! - Load: dtoverlay=smi -diff --git a/arch/arm/boot/dts/overlays/sdtweak-overlay.dts b/arch/arm/boot/dts/overlays/sdtweak-overlay.dts ++ help ++ This is the framebuffer driver for the Raspberry Pi Sense HAT +diff --git a/drivers/video/fbdev/Makefile b/drivers/video/fbdev/Makefile +index df473d8..474c567 100644 +--- a/drivers/video/fbdev/Makefile ++++ b/drivers/video/fbdev/Makefile +@@ -149,6 +149,7 @@ obj-$(CONFIG_FB_DA8XX) += da8xx-fb.o + obj-$(CONFIG_FB_MXS) += mxsfb.o + obj-$(CONFIG_FB_SSD1307) += ssd1307fb.o + obj-$(CONFIG_FB_SIMPLE) += simplefb.o ++obj-$(CONFIG_FB_RPISENSE) += rpisense-fb.o + + # the test framebuffer is last + obj-$(CONFIG_FB_VIRTUAL) += vfb.o +diff --git a/drivers/video/fbdev/rpisense-fb.c b/drivers/video/fbdev/rpisense-fb.c new file mode 100644 -index 0000000..74c168d +index 0000000..26432a5 --- /dev/null -+++ b/arch/arm/boot/dts/overlays/sdtweak-overlay.dts -@@ -0,0 +1,21 @@ -+/dts-v1/; -+/plugin/; ++++ b/drivers/video/fbdev/rpisense-fb.c +@@ -0,0 +1,293 @@ ++/* ++ * Raspberry Pi Sense HAT framebuffer driver ++ * http://raspberrypi.org ++ * ++ * Copyright (C) 2015 Raspberry Pi ++ * ++ * Author: Serge Schneider ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License as published by the ++ * Free Software Foundation; either version 2 of the License, or (at your ++ * option) any later version. ++ * ++ */ + -+/{ -+ compatible = "brcm,bcm2708"; ++#include <linux/module.h> ++#include <linux/kernel.h> ++#include <linux/errno.h> ++#include <linux/string.h> ++#include <linux/mm.h> ++#include <linux/slab.h> ++#include <linux/uaccess.h> ++#include <linux/delay.h> ++#include <linux/fb.h> ++#include <linux/init.h> + -+ fragment@0 { -+ target = <&sdhost>; -+ frag1: __overlay__ { -+ brcm,overclock-50 = <0>; -+ brcm,pio-limit = <1>; -+ }; -+ }; ++#include <linux/mfd/rpisense/framebuffer.h> ++#include <linux/mfd/rpisense/core.h> + -+ __overrides__ { -+ overclock_50 = <&frag1>,"brcm,overclock-50:0"; -+ force_pio = <&frag1>,"brcm,force-pio?"; -+ pio_limit = <&frag1>,"brcm,pio-limit:0"; -+ debug = <&frag1>,"brcm,debug?"; -+ }; ++static bool lowlight; ++module_param(lowlight, bool, 0); ++MODULE_PARM_DESC(lowlight, "Reduce LED matrix brightness to one third"); ++ ++static struct rpisense *rpisense; ++ ++struct rpisense_fb_param { ++ char __iomem *vmem; ++ u8 *vmem_work; ++ u32 vmemsize; ++ u8 *gamma; +}; - -From b07c427a7732a0fabcf521085e0fd61b0ef9047c Mon Sep 17 00:00:00 2001 -From: Andrew Litt <ajlitt@splunge.net> -Date: Mon, 11 Jan 2016 07:54:21 +0000 -Subject: [PATCH 125/170] bcm2835-mmc: Don't override bus width capabilities - from devicetree - -Take out the force setting of the MMC_CAP_4_BIT_DATA host capability -so that the result read from devicetree via mmc_of_parse() is -preserved. ---- - drivers/mmc/host/bcm2835-mmc.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/drivers/mmc/host/bcm2835-mmc.c b/drivers/mmc/host/bcm2835-mmc.c -index 43aed6e..104f93e 100644 ---- a/drivers/mmc/host/bcm2835-mmc.c -+++ b/drivers/mmc/host/bcm2835-mmc.c -@@ -1305,7 +1305,7 @@ static int bcm2835_mmc_add_host(struct bcm2835_host *host) - /* host controller capabilities */ - mmc->caps |= MMC_CAP_CMD23 | MMC_CAP_ERASE | MMC_CAP_NEEDS_POLL | - MMC_CAP_SDIO_IRQ | MMC_CAP_SD_HIGHSPEED | -- MMC_CAP_MMC_HIGHSPEED | MMC_CAP_4_BIT_DATA; -+ MMC_CAP_MMC_HIGHSPEED; - - mmc->caps2 |= MMC_CAP2_SDIO_IRQ_NOTHREAD; - - -From f74652d026105ecc4a87b581a9c1c89a6e504d2c Mon Sep 17 00:00:00 2001 -From: Andrew Litt <ajlitt@splunge.net> -Date: Mon, 11 Jan 2016 07:55:54 +0000 -Subject: [PATCH 126/170] SDIO-overlay: add bus_width parameter - -Allow setting of the SDIO bus width capability of the bcm2835-mmc -host. This is helpful when only a 1 bit wide bus is connected -between host and device but both host and device advertise 4 bit -mode. ---- - arch/arm/boot/dts/overlays/README | 2 ++ - arch/arm/boot/dts/overlays/sdio-overlay.dts | 2 ++ - 2 files changed, 4 insertions(+) - -diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README -index 00f03fc..aa57078 100644 ---- a/arch/arm/boot/dts/overlays/README -+++ b/arch/arm/boot/dts/overlays/README -@@ -634,6 +634,8 @@ Params: overclock_50 Clock (in MHz) to use when the MMC framework - poll_once Disable SDIO-device polling every second - (default on: polling once at boot-time) - -+ bus_width Set the SDIO host bus width (default 4 bits) + - - Name: sdtweak - Info: Tunes the bcm2835-sdhost SD/MMC driver -diff --git a/arch/arm/boot/dts/overlays/sdio-overlay.dts b/arch/arm/boot/dts/overlays/sdio-overlay.dts -index afc8742..7935e7a 100644 ---- a/arch/arm/boot/dts/overlays/sdio-overlay.dts -+++ b/arch/arm/boot/dts/overlays/sdio-overlay.dts -@@ -11,6 +11,7 @@ - pinctrl-names = "default"; - pinctrl-0 = <&sdio_pins>; - non-removable; -+ bus-width = <4>; - status = "okay"; - }; - }; -@@ -28,5 +29,6 @@ - - __overrides__ { - poll_once = <&sdio_mmc>,"non-removable?"; -+ bus_width = <&sdio_mmc>,"bus-width:0"; - }; - }; - -From 232754cb0ecd1967a8b72d6bd05467843d65a441 Mon Sep 17 00:00:00 2001 -From: Phil Elwell <phil@raspberrypi.org> -Date: Fri, 8 Jan 2016 13:42:06 +0000 -Subject: [PATCH 127/170] FIXUP BCM270X_DT: "random" (HWRNG) dtparam default is - on - ---- - arch/arm/boot/dts/overlays/README | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README -index aa57078..34a1b7f 100644 ---- a/arch/arm/boot/dts/overlays/README -+++ b/arch/arm/boot/dts/overlays/README -@@ -110,7 +110,7 @@ Params: - (default "off") - - random Set to "on" to enable the hardware random -- number generator (default "off") -+ number generator (default "on") - - uart0 Set to "off" to disable uart0 (default "on") - - -From 320bdec200197f074541e3999fa4b87889c5eb18 Mon Sep 17 00:00:00 2001 -From: wm4 <wm4@nowhere> -Date: Wed, 13 Jan 2016 19:41:45 +0100 -Subject: [PATCH 128/170] bcm2835: extend allowed range of channels and - samplerates - -Allow everything the videocore accepts. ---- - sound/arm/bcm2835-pcm.c | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -diff --git a/sound/arm/bcm2835-pcm.c b/sound/arm/bcm2835-pcm.c -index 8c86375..31e3131 100755 ---- a/sound/arm/bcm2835-pcm.c -+++ b/sound/arm/bcm2835-pcm.c -@@ -26,9 +26,9 @@ static struct snd_pcm_hardware snd_bcm2835_playback_hw = { - .formats = SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE, - .rates = SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_8000_48000, - .rate_min = 8000, -- .rate_max = 48000, -+ .rate_max = 192000, - .channels_min = 1, -- .channels_max = 2, -+ .channels_max = 8, - .buffer_bytes_max = 128 * 1024, - .period_bytes_min = 1 * 1024, - .period_bytes_max = 128 * 1024, -@@ -43,9 +43,9 @@ static struct snd_pcm_hardware snd_bcm2835_playback_spdif_hw = { - .rates = SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_44100 | - SNDRV_PCM_RATE_48000, - .rate_min = 44100, -- .rate_max = 48000, -+ .rate_max = 192000, - .channels_min = 2, -- .channels_max = 2, -+ .channels_max = 8, - .buffer_bytes_max = 128 * 1024, - .period_bytes_min = 1 * 1024, - .period_bytes_max = 128 * 1024, - -From 7e634c8f8fe70286e0b8b404494d3143aa7bc3fc Mon Sep 17 00:00:00 2001 -From: wm4 <wm4@nowhere> -Date: Wed, 13 Jan 2016 19:42:18 +0100 -Subject: [PATCH 129/170] bcm2835: restrict channels*rate to 8*960000 - -This is required at least for SPDIF. If the bitrate goes above, -videocore will either resample the audio or corrupt it due to -underruns. Supposedly the hardware isn't designed to output -higher rates, but it can still resample it down to supported -rates. - -Some code is based on ac97_pcm.c. ---- - sound/arm/bcm2835-pcm.c | 41 +++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 41 insertions(+) - -diff --git a/sound/arm/bcm2835-pcm.c b/sound/arm/bcm2835-pcm.c -index 31e3131..b17ed32 100755 ---- a/sound/arm/bcm2835-pcm.c -+++ b/sound/arm/bcm2835-pcm.c -@@ -19,6 +19,9 @@ - - #include "bcm2835.h" - -+/* The hardware can not do much more num_channels*samplerate then this value */ -+#define MAX_COMBINED_RATE 768000 ++static u8 gamma_default[32] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, ++ 0x02, 0x02, 0x03, 0x03, 0x04, 0x05, 0x06, 0x07, ++ 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0E, 0x0F, 0x11, ++ 0x12, 0x14, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F,}; + - /* hardware definition */ - static struct snd_pcm_hardware snd_bcm2835_playback_hw = { - .info = (SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | -@@ -107,6 +110,31 @@ static irqreturn_t bcm2835_playback_fifo_irq(int irq, void *dev_id) - return IRQ_HANDLED; - } - ++static u8 gamma_low[32] = {0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, ++ 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, ++ 0x03, 0x03, 0x03, 0x04, 0x04, 0x05, 0x05, 0x06, ++ 0x06, 0x07, 0x07, 0x08, 0x08, 0x09, 0x0A, 0x0A,}; ++ ++static u8 gamma_user[32]; ++ ++static struct rpisense_fb_param rpisense_fb_param = { ++ .vmem = NULL, ++ .vmemsize = 128, ++ .gamma = gamma_default, ++}; ++ ++static struct fb_deferred_io rpisense_fb_defio; ++ ++static struct fb_fix_screeninfo rpisense_fb_fix = { ++ .id = "RPi-Sense FB", ++ .type = FB_TYPE_PACKED_PIXELS, ++ .visual = FB_VISUAL_TRUECOLOR, ++ .xpanstep = 0, ++ .ypanstep = 0, ++ .ywrapstep = 0, ++ .accel = FB_ACCEL_NONE, ++ .line_length = 16, ++}; + -+static int rate_hw_constraint_rate(struct snd_pcm_hw_params *params, -+ struct snd_pcm_hw_rule *rule) ++static struct fb_var_screeninfo rpisense_fb_var = { ++ .xres = 8, ++ .yres = 8, ++ .xres_virtual = 8, ++ .yres_virtual = 8, ++ .bits_per_pixel = 16, ++ .red = {11, 5, 0}, ++ .green = {5, 6, 0}, ++ .blue = {0, 5, 0}, ++}; ++ ++static ssize_t rpisense_fb_write(struct fb_info *info, ++ const char __user *buf, size_t count, ++ loff_t *ppos) +{ -+ struct snd_interval *channels = hw_param_interval(params, SNDRV_PCM_HW_PARAM_CHANNELS); -+ struct snd_interval rates = { -+ .min = 8000, -+ .max = min(192000u, MAX_COMBINED_RATE / max(channels->min, 1u)), -+ }; -+ struct snd_interval *rate = hw_param_interval(params, SNDRV_PCM_HW_PARAM_RATE); -+ return snd_interval_refine(rate, &rates); ++ ssize_t res = fb_sys_write(info, buf, count, ppos); ++ ++ schedule_delayed_work(&info->deferred_work, rpisense_fb_defio.delay); ++ return res; +} + -+static int rate_hw_constraint_channels(struct snd_pcm_hw_params *params, -+ struct snd_pcm_hw_rule *rule) ++static void rpisense_fb_fillrect(struct fb_info *info, ++ const struct fb_fillrect *rect) +{ -+ struct snd_interval *rate = hw_param_interval(params, SNDRV_PCM_HW_PARAM_RATE); -+ struct snd_interval channels_interval = { -+ .min = 1, -+ .max = min(8u, MAX_COMBINED_RATE / max(rate->min, 1u)), -+ }; -+ struct snd_interval *channels = hw_param_interval(params, SNDRV_PCM_HW_PARAM_CHANNELS); -+ return snd_interval_refine(channels, &channels_interval); ++ sys_fillrect(info, rect); ++ schedule_delayed_work(&info->deferred_work, rpisense_fb_defio.delay); +} + - /* open callback */ - static int snd_bcm2835_playback_open_generic( - struct snd_pcm_substream *substream, int spdif) -@@ -188,6 +216,19 @@ static int snd_bcm2835_playback_open_generic( - snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, - 16); - -+ /* When playing PCM, pretend that we support the full range of channels -+ * and sample rates. The GPU can't output it, but is able to resample -+ * the data to a rate the hardware can handle it. This won't work with -+ * compressed data; the resampler would just destroy it. */ -+ if (spdif) { -+ err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, -+ rate_hw_constraint_rate, NULL, -+ SNDRV_PCM_HW_PARAM_CHANNELS, -1); -+ err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS, -+ rate_hw_constraint_channels, NULL, -+ SNDRV_PCM_HW_PARAM_RATE, -1); -+ } ++static void rpisense_fb_copyarea(struct fb_info *info, ++ const struct fb_copyarea *area) ++{ ++ sys_copyarea(info, area); ++ schedule_delayed_work(&info->deferred_work, rpisense_fb_defio.delay); ++} + - chip->alsa_stream[idx] = alsa_stream; - - chip->opened |= (1 << idx); - -From dcead34f063fc8c37ebfcfc9ab6696060c336bad Mon Sep 17 00:00:00 2001 -From: wm4 <wm4@nowhere> -Date: Wed, 13 Jan 2016 19:42:48 +0100 -Subject: [PATCH 130/170] rpi: update vc_vchi_audioserv_defs.h - -Add audioserv 3 extensions. The changes were taken from the paste -linked here: - -https://github.com/raspberrypi/linux/pull/1166#issuecomment-151917067 ---- - sound/arm/vc_vchi_audioserv_defs.h | 13 +++++++++++-- - 1 file changed, 11 insertions(+), 2 deletions(-) - -diff --git a/sound/arm/vc_vchi_audioserv_defs.h b/sound/arm/vc_vchi_audioserv_defs.h -index af3e6eb..5f4409f 100644 ---- a/sound/arm/vc_vchi_audioserv_defs.h -+++ b/sound/arm/vc_vchi_audioserv_defs.h -@@ -16,7 +16,7 @@ - #define _VC_AUDIO_DEFS_H_ - - #define VC_AUDIOSERV_MIN_VER 1 --#define VC_AUDIOSERV_VER 2 -+#define VC_AUDIOSERV_VER 3 - - // FourCC code used for VCHI connection - #define VC_AUDIO_SERVER_NAME MAKE_FOURCC("AUDS") -@@ -36,6 +36,7 @@ typedef enum { - VC_AUDIO_MSG_TYPE_START, // Configure audio - VC_AUDIO_MSG_TYPE_STOP, // Configure audio - VC_AUDIO_MSG_TYPE_WRITE, // Configure audio -+ VC_AUDIO_MSG_TYPE_LATENCY, // request latency in cycles - VC_AUDIO_MSG_TYPE_MAX - } VC_AUDIO_MSG_TYPE; - -@@ -44,6 +45,7 @@ typedef struct { - uint32_t channels; - uint32_t samplerate; - uint32_t bps; -+ uint32_t channelmap; - - } VC_AUDIO_CONFIG_T; - -@@ -84,6 +86,12 @@ typedef struct { - uint16_t max_packet; - } VC_AUDIO_WRITE_T; - -+// query latency in samples of sink -+typedef struct ++static void rpisense_fb_imageblit(struct fb_info *info, ++ const struct fb_image *image) +{ -+ uint32_t dummy; -+} VC_AUDIO_LATENCY_T; -+ - // Generic result for a request (VC->HOST) - typedef struct { - int32_t success; // Success value -@@ -108,9 +116,10 @@ typedef struct { - VC_AUDIO_START_T start; - VC_AUDIO_STOP_T stop; - VC_AUDIO_WRITE_T write; -+ VC_AUDIO_LATENCY_T latency; - VC_AUDIO_RESULT_T result; - VC_AUDIO_COMPLETE_T complete; - } u; - } VC_AUDIO_MSG_T; - --#endif // _VC_AUDIO_DEFS_H_ -+#endif // _VC_AUDIO_DEFS_H_ -\ No newline at end of file - -From 7c7d2db494fbf1fd0b014dab0bb4c5c740f90442 Mon Sep 17 00:00:00 2001 -From: wm4 <wm4@nowhere> -Date: Wed, 13 Jan 2016 19:43:12 +0100 -Subject: [PATCH 131/170] bcm2835: implement channel map API - -Report all layouts supported by the HDMI protocol to userspace. -Make the videocore set the correct layout according to the -userspace request. - -Some code taken from patch_hdmi.c. In particular, the HDMI channel -layout table was copied without changes - with the idea in mind that -hopefully it can be shared one day. Or at least updating it will be -simpler. - -In my tests, everything appears to work, except when outputting -FL FR RL RR. Then my receiver outputs RL on both the RL and RR -speakers, while RR is never heard. ---- - sound/arm/bcm2835-ctl.c | 276 ++++++++++++++++++++++++++++++++++++++++++++++ - sound/arm/bcm2835-pcm.c | 22 +++- - sound/arm/bcm2835-vchiq.c | 13 +++ - sound/arm/bcm2835.h | 4 + - 4 files changed, 311 insertions(+), 4 deletions(-) - -diff --git a/sound/arm/bcm2835-ctl.c b/sound/arm/bcm2835-ctl.c -index aad905f..92d3f76 100755 ---- a/sound/arm/bcm2835-ctl.c -+++ b/sound/arm/bcm2835-ctl.c -@@ -300,6 +300,281 @@ static struct snd_kcontrol_new snd_bcm2835_spdif[] = { - }, - }; - -+struct cea_channel_speaker_allocation { -+ int ca_index; -+ int speakers[8]; -+}; -+ -+#define FL SNDRV_CHMAP_FL -+#define FR SNDRV_CHMAP_FR -+#define RL SNDRV_CHMAP_RL -+#define RR SNDRV_CHMAP_RR -+#define LFE SNDRV_CHMAP_LFE -+#define FC SNDRV_CHMAP_FC -+#define RLC SNDRV_CHMAP_RLC -+#define RRC SNDRV_CHMAP_RRC -+#define RC SNDRV_CHMAP_RC -+#define FLC SNDRV_CHMAP_FLC -+#define FRC SNDRV_CHMAP_FRC -+#define FLH SNDRV_CHMAP_TFL -+#define FRH SNDRV_CHMAP_TFR -+#define FLW SNDRV_CHMAP_FLW -+#define FRW SNDRV_CHMAP_FRW -+#define TC SNDRV_CHMAP_TC -+#define FCH SNDRV_CHMAP_TFC ++ sys_imageblit(info, image); ++ schedule_delayed_work(&info->deferred_work, rpisense_fb_defio.delay); ++} + -+/* -+ * CEA-861 channel maps -+ * -+ * Stolen from sound/pci/hda/patch_hdmi.c -+ * (unlike the source, this uses SNDRV_* constants directly, as by the -+ * map_tables array in patch_hdmi.c) -+ * Unknown entries use 0, which unfortunately is SNDRV_CHMAP_UNKNOWN instead -+ * of SNDRV_CHMAP_NA. -+ */ -+static struct cea_channel_speaker_allocation channel_allocations[] = { -+/* channel: 7 6 5 4 3 2 1 0 */ -+{ .ca_index = 0x00, .speakers = { 0, 0, 0, 0, 0, 0, FR, FL } }, -+ /* 2.1 */ -+{ .ca_index = 0x01, .speakers = { 0, 0, 0, 0, 0, LFE, FR, FL } }, -+ /* Dolby Surround */ -+{ .ca_index = 0x02, .speakers = { 0, 0, 0, 0, FC, 0, FR, FL } }, -+ /* surround40 */ -+{ .ca_index = 0x08, .speakers = { 0, 0, RR, RL, 0, 0, FR, FL } }, -+ /* surround41 */ -+{ .ca_index = 0x09, .speakers = { 0, 0, RR, RL, 0, LFE, FR, FL } }, -+ /* surround50 */ -+{ .ca_index = 0x0a, .speakers = { 0, 0, RR, RL, FC, 0, FR, FL } }, -+ /* surround51 */ -+{ .ca_index = 0x0b, .speakers = { 0, 0, RR, RL, FC, LFE, FR, FL } }, -+ /* 6.1 */ -+{ .ca_index = 0x0f, .speakers = { 0, RC, RR, RL, FC, LFE, FR, FL } }, -+ /* surround71 */ -+{ .ca_index = 0x13, .speakers = { RRC, RLC, RR, RL, FC, LFE, FR, FL } }, -+ -+{ .ca_index = 0x03, .speakers = { 0, 0, 0, 0, FC, LFE, FR, FL } }, -+{ .ca_index = 0x04, .speakers = { 0, 0, 0, RC, 0, 0, FR, FL } }, -+{ .ca_index = 0x05, .speakers = { 0, 0, 0, RC, 0, LFE, FR, FL } }, -+{ .ca_index = 0x06, .speakers = { 0, 0, 0, RC, FC, 0, FR, FL } }, -+{ .ca_index = 0x07, .speakers = { 0, 0, 0, RC, FC, LFE, FR, FL } }, -+{ .ca_index = 0x0c, .speakers = { 0, RC, RR, RL, 0, 0, FR, FL } }, -+{ .ca_index = 0x0d, .speakers = { 0, RC, RR, RL, 0, LFE, FR, FL } }, -+{ .ca_index = 0x0e, .speakers = { 0, RC, RR, RL, FC, 0, FR, FL } }, -+{ .ca_index = 0x10, .speakers = { RRC, RLC, RR, RL, 0, 0, FR, FL } }, -+{ .ca_index = 0x11, .speakers = { RRC, RLC, RR, RL, 0, LFE, FR, FL } }, -+{ .ca_index = 0x12, .speakers = { RRC, RLC, RR, RL, FC, 0, FR, FL } }, -+{ .ca_index = 0x14, .speakers = { FRC, FLC, 0, 0, 0, 0, FR, FL } }, -+{ .ca_index = 0x15, .speakers = { FRC, FLC, 0, 0, 0, LFE, FR, FL } }, -+{ .ca_index = 0x16, .speakers = { FRC, FLC, 0, 0, FC, 0, FR, FL } }, -+{ .ca_index = 0x17, .speakers = { FRC, FLC, 0, 0, FC, LFE, FR, FL } }, -+{ .ca_index = 0x18, .speakers = { FRC, FLC, 0, RC, 0, 0, FR, FL } }, -+{ .ca_index = 0x19, .speakers = { FRC, FLC, 0, RC, 0, LFE, FR, FL } }, -+{ .ca_index = 0x1a, .speakers = { FRC, FLC, 0, RC, FC, 0, FR, FL } }, -+{ .ca_index = 0x1b, .speakers = { FRC, FLC, 0, RC, FC, LFE, FR, FL } }, -+{ .ca_index = 0x1c, .speakers = { FRC, FLC, RR, RL, 0, 0, FR, FL } }, -+{ .ca_index = 0x1d, .speakers = { FRC, FLC, RR, RL, 0, LFE, FR, FL } }, -+{ .ca_index = 0x1e, .speakers = { FRC, FLC, RR, RL, FC, 0, FR, FL } }, -+{ .ca_index = 0x1f, .speakers = { FRC, FLC, RR, RL, FC, LFE, FR, FL } }, -+{ .ca_index = 0x20, .speakers = { 0, FCH, RR, RL, FC, 0, FR, FL } }, -+{ .ca_index = 0x21, .speakers = { 0, FCH, RR, RL, FC, LFE, FR, FL } }, -+{ .ca_index = 0x22, .speakers = { TC, 0, RR, RL, FC, 0, FR, FL } }, -+{ .ca_index = 0x23, .speakers = { TC, 0, RR, RL, FC, LFE, FR, FL } }, -+{ .ca_index = 0x24, .speakers = { FRH, FLH, RR, RL, 0, 0, FR, FL } }, -+{ .ca_index = 0x25, .speakers = { FRH, FLH, RR, RL, 0, LFE, FR, FL } }, -+{ .ca_index = 0x26, .speakers = { FRW, FLW, RR, RL, 0, 0, FR, FL } }, -+{ .ca_index = 0x27, .speakers = { FRW, FLW, RR, RL, 0, LFE, FR, FL } }, -+{ .ca_index = 0x28, .speakers = { TC, RC, RR, RL, FC, 0, FR, FL } }, -+{ .ca_index = 0x29, .speakers = { TC, RC, RR, RL, FC, LFE, FR, FL } }, -+{ .ca_index = 0x2a, .speakers = { FCH, RC, RR, RL, FC, 0, FR, FL } }, -+{ .ca_index = 0x2b, .speakers = { FCH, RC, RR, RL, FC, LFE, FR, FL } }, -+{ .ca_index = 0x2c, .speakers = { TC, FCH, RR, RL, FC, 0, FR, FL } }, -+{ .ca_index = 0x2d, .speakers = { TC, FCH, RR, RL, FC, LFE, FR, FL } }, -+{ .ca_index = 0x2e, .speakers = { FRH, FLH, RR, RL, FC, 0, FR, FL } }, -+{ .ca_index = 0x2f, .speakers = { FRH, FLH, RR, RL, FC, LFE, FR, FL } }, -+{ .ca_index = 0x30, .speakers = { FRW, FLW, RR, RL, FC, 0, FR, FL } }, -+{ .ca_index = 0x31, .speakers = { FRW, FLW, RR, RL, FC, LFE, FR, FL } }, -+}; -+ -+static int snd_bcm2835_chmap_ctl_tlv(struct snd_kcontrol *kcontrol, int op_flag, -+ unsigned int size, unsigned int __user *tlv) -+{ -+ unsigned int __user *dst; -+ int count = 0; ++static void rpisense_fb_deferred_io(struct fb_info *info, ++ struct list_head *pagelist) ++{ + int i; ++ int j; ++ u8 *vmem_work = rpisense_fb_param.vmem_work; ++ u16 *mem = (u16 *)rpisense_fb_param.vmem; ++ u8 *gamma = rpisense_fb_param.gamma; + -+ if (size < 8) -+ return -ENOMEM; -+ if (put_user(SNDRV_CTL_TLVT_CONTAINER, tlv)) -+ return -EFAULT; -+ size -= 8; -+ dst = tlv + 2; -+ for (i = 0; i < ARRAY_SIZE(channel_allocations); i++) { -+ struct cea_channel_speaker_allocation *ch = &channel_allocations[i]; -+ int num_chs = 0; -+ int chs_bytes; -+ int c; -+ -+ for (c = 0; c < 8; c++) { -+ if (ch->speakers[c]) -+ num_chs++; ++ vmem_work[0] = 0; ++ for (j = 0; j < 8; j++) { ++ for (i = 0; i < 8; i++) { ++ vmem_work[(j * 24) + i + 1] = ++ gamma[(mem[(j * 8) + i] >> 11) & 0x1F]; ++ vmem_work[(j * 24) + (i + 8) + 1] = ++ gamma[(mem[(j * 8) + i] >> 6) & 0x1F]; ++ vmem_work[(j * 24) + (i + 16) + 1] = ++ gamma[(mem[(j * 8) + i]) & 0x1F]; + } ++ } ++ rpisense_block_write(rpisense, vmem_work, 193); ++} + -+ chs_bytes = num_chs * 4; -+ if (size < 8) -+ return -ENOMEM; -+ if (put_user(SNDRV_CTL_TLVT_CHMAP_FIXED, dst) || -+ put_user(chs_bytes, dst + 1)) ++static struct fb_deferred_io rpisense_fb_defio = { ++ .delay = HZ/100, ++ .deferred_io = rpisense_fb_deferred_io, ++}; ++ ++static int rpisense_fb_ioctl(struct fb_info *info, unsigned int cmd, ++ unsigned long arg) ++{ ++ switch (cmd) { ++ case SENSEFB_FBIOGET_GAMMA: ++ if (copy_to_user((void __user *) arg, rpisense_fb_param.gamma, ++ sizeof(u8[32]))) + return -EFAULT; -+ dst += 2; -+ size -= 8; -+ count += 8; -+ if (size < chs_bytes) -+ return -ENOMEM; -+ size -= chs_bytes; -+ count += chs_bytes; -+ for (c = 0; c < 8; c++) { -+ int sp = ch->speakers[7 - c]; -+ if (sp) { -+ if (put_user(sp, dst)) -+ return -EFAULT; -+ dst++; -+ } ++ return 0; ++ case SENSEFB_FBIOSET_GAMMA: ++ if (copy_from_user(gamma_user, (void __user *)arg, ++ sizeof(u8[32]))) ++ return -EFAULT; ++ rpisense_fb_param.gamma = gamma_user; ++ schedule_delayed_work(&info->deferred_work, ++ rpisense_fb_defio.delay); ++ return 0; ++ case SENSEFB_FBIORESET_GAMMA: ++ switch (arg) { ++ case 0: ++ rpisense_fb_param.gamma = gamma_default; ++ break; ++ case 1: ++ rpisense_fb_param.gamma = gamma_low; ++ break; ++ case 2: ++ rpisense_fb_param.gamma = gamma_user; ++ break; ++ default: ++ return -EINVAL; + } ++ schedule_delayed_work(&info->deferred_work, ++ rpisense_fb_defio.delay); ++ break; ++ default: ++ return -EINVAL; + } -+ if (put_user(count, tlv + 1)) -+ return -EFAULT; + return 0; +} + -+static int snd_bcm2835_chmap_ctl_get(struct snd_kcontrol *kcontrol, -+ struct snd_ctl_elem_value *ucontrol) ++static struct fb_ops rpisense_fb_ops = { ++ .owner = THIS_MODULE, ++ .fb_read = fb_sys_read, ++ .fb_write = rpisense_fb_write, ++ .fb_fillrect = rpisense_fb_fillrect, ++ .fb_copyarea = rpisense_fb_copyarea, ++ .fb_imageblit = rpisense_fb_imageblit, ++ .fb_ioctl = rpisense_fb_ioctl, ++}; ++ ++static int rpisense_fb_probe(struct platform_device *pdev) +{ -+ struct snd_pcm_chmap *info = snd_kcontrol_chip(kcontrol); -+ bcm2835_chip_t *chip = info->private_data; -+ unsigned int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); -+ struct snd_pcm_substream *substream = snd_pcm_chmap_substream(info, idx); -+ struct cea_channel_speaker_allocation *ch = NULL; -+ int cur = 0; -+ int i; ++ struct fb_info *info; ++ int ret = -ENOMEM; ++ struct rpisense_fb *rpisense_fb; + -+ if (!substream || !substream->runtime) -+ return -ENODEV; ++ rpisense = rpisense_get_dev(); ++ rpisense_fb = &rpisense->framebuffer; + -+ for (i = 0; i < ARRAY_SIZE(channel_allocations); i++) { -+ if (channel_allocations[i].ca_index == chip->cea_chmap) -+ ch = &channel_allocations[i]; -+ } ++ rpisense_fb_param.vmem = vzalloc(rpisense_fb_param.vmemsize); ++ if (!rpisense_fb_param.vmem) ++ return ret; + -+ /* If no layout was set yet, return a dummy. Apparently the userspace -+ * API will be confused if we don't. */ -+ if (!ch) -+ ch = &channel_allocations[0]; ++ rpisense_fb_param.vmem_work = devm_kmalloc(&pdev->dev, 193, GFP_KERNEL); ++ if (!rpisense_fb_param.vmem_work) ++ goto err_malloc; + -+ for (i = 0; i < 8; i++) { -+ if (ch->speakers[7 - i]) -+ ucontrol->value.integer.value[cur++] = ch->speakers[7 - i]; ++ info = framebuffer_alloc(0, &pdev->dev); ++ if (!info) { ++ dev_err(&pdev->dev, "Could not allocate framebuffer.\n"); ++ goto err_malloc; + } -+ while (cur < 8) -+ ucontrol->value.integer.value[cur++] = SNDRV_CHMAP_NA; -+ return 0; -+} -+ -+static int snd_bcm2835_chmap_ctl_put(struct snd_kcontrol *kcontrol, -+ struct snd_ctl_elem_value *ucontrol) -+{ -+ struct snd_pcm_chmap *info = snd_kcontrol_chip(kcontrol); -+ bcm2835_chip_t *chip = info->private_data; -+ unsigned int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); -+ struct snd_pcm_substream *substream = snd_pcm_chmap_substream(info, idx); -+ int i, prepared = 0, cea_chmap = -1; -+ int remap[8]; ++ rpisense_fb->info = info; + -+ if (!substream || !substream->runtime) -+ return -ENODEV; ++ rpisense_fb_fix.smem_start = (unsigned long)rpisense_fb_param.vmem; ++ rpisense_fb_fix.smem_len = rpisense_fb_param.vmemsize; + -+ switch (substream->runtime->status->state) { -+ case SNDRV_PCM_STATE_OPEN: -+ case SNDRV_PCM_STATE_SETUP: -+ break; -+ case SNDRV_PCM_STATE_PREPARED: -+ prepared = 1; -+ break; -+ default: -+ return -EBUSY; -+ } ++ info->fbops = &rpisense_fb_ops; ++ info->fix = rpisense_fb_fix; ++ info->var = rpisense_fb_var; ++ info->fbdefio = &rpisense_fb_defio; ++ info->flags = FBINFO_FLAG_DEFAULT | FBINFO_VIRTFB; ++ info->screen_base = rpisense_fb_param.vmem; ++ info->screen_size = rpisense_fb_param.vmemsize; + -+ for (i = 0; i < ARRAY_SIZE(channel_allocations); i++) { -+ struct cea_channel_speaker_allocation *ch = &channel_allocations[i]; -+ int matches = 1; -+ int cur = 0; -+ int x; -+ memset(remap, 0, sizeof(remap)); -+ for (x = 0; x < substream->runtime->channels; x++) { -+ int sp = ucontrol->value.integer.value[x]; -+ while (cur < 8 && !ch->speakers[7 - cur]) -+ cur++; -+ if (cur >= 8) { -+ /* user has more channels than ch */ -+ matches = 0; -+ break; -+ } -+ if (ch->speakers[7 - cur] != sp) { -+ matches = 0; -+ break; -+ } -+ remap[x] = cur; -+ cur++; -+ } -+ for (x = cur; x < 8; x++) { -+ if (ch->speakers[7 - x]) { -+ /* ch has more channels than user */ -+ matches = 0; -+ break; -+ } -+ } -+ if (matches) { -+ cea_chmap = ch->ca_index; -+ break; -+ } -+ } ++ if (lowlight) ++ rpisense_fb_param.gamma = gamma_low; + -+ if (cea_chmap < 0) -+ return -EINVAL; ++ fb_deferred_io_init(info); + -+ /* don't change the layout if another substream is active */ -+ if (chip->opened != (1 << substream->number) && chip->cea_chmap != cea_chmap) -+ return -EBUSY; /* unsure whether this is a good error code */ ++ ret = register_framebuffer(info); ++ if (ret < 0) { ++ dev_err(&pdev->dev, "Could not register framebuffer.\n"); ++ goto err_fballoc; ++ } + -+ chip->cea_chmap = cea_chmap; -+ for (i = 0; i < 8; i++) -+ chip->map_channels[i] = remap[i]; -+ if (prepared) -+ snd_bcm2835_pcm_prepare_again(substream); ++ fb_info(info, "%s frame buffer device\n", info->fix.id); ++ schedule_delayed_work(&info->deferred_work, rpisense_fb_defio.delay); + return 0; ++err_fballoc: ++ framebuffer_release(info); ++err_malloc: ++ vfree(rpisense_fb_param.vmem); ++ return ret; +} + -+static int snd_bcm2835_add_chmap_ctl(bcm2835_chip_t * chip) ++static int rpisense_fb_remove(struct platform_device *pdev) +{ -+ struct snd_pcm_chmap *chmap; -+ struct snd_kcontrol *kctl; -+ int err, i; ++ struct rpisense_fb *rpisense_fb = &rpisense->framebuffer; ++ struct fb_info *info = rpisense_fb->info; ++ ++ if (info) { ++ unregister_framebuffer(info); ++ fb_deferred_io_cleanup(info); ++ framebuffer_release(info); ++ vfree(rpisense_fb_param.vmem); ++ } + -+ err = snd_pcm_add_chmap_ctls(chip->pcm, -+ SNDRV_PCM_STREAM_PLAYBACK, -+ NULL, 8, 0, &chmap); -+ if (err < 0) -+ return err; -+ /* override handlers */ -+ chmap->private_data = chip; -+ kctl = chmap->kctl; -+ for (i = 0; i < kctl->count; i++) -+ kctl->vd[i].access |= SNDRV_CTL_ELEM_ACCESS_WRITE; -+ kctl->get = snd_bcm2835_chmap_ctl_get; -+ kctl->put = snd_bcm2835_chmap_ctl_put; -+ kctl->tlv.c = snd_bcm2835_chmap_ctl_tlv; + return 0; +} + - int snd_bcm2835_new_ctl(bcm2835_chip_t * chip) - { - int err; -@@ -313,6 +588,7 @@ int snd_bcm2835_new_ctl(bcm2835_chip_t * chip) - if (err < 0) - return err; - } -+ snd_bcm2835_add_chmap_ctl(chip); - for (idx = 0; idx < ARRAY_SIZE(snd_bcm2835_spdif); idx++) { - err = snd_ctl_add(chip->card, - snd_ctl_new1(&snd_bcm2835_spdif[idx], chip)); -diff --git a/sound/arm/bcm2835-pcm.c b/sound/arm/bcm2835-pcm.c -index b17ed32..1067460 100755 ---- a/sound/arm/bcm2835-pcm.c -+++ b/sound/arm/bcm2835-pcm.c -@@ -231,6 +231,9 @@ static int snd_bcm2835_playback_open_generic( - - chip->alsa_stream[idx] = alsa_stream; - -+ if (!chip->opened) -+ chip->cea_chmap = -1; ++#ifdef CONFIG_OF ++static const struct of_device_id rpisense_fb_id[] = { ++ { .compatible = "rpi,rpi-sense-fb" }, ++ { }, ++}; ++MODULE_DEVICE_TABLE(of, rpisense_fb_id); ++#endif + - chip->opened |= (1 << idx); - alsa_stream->open = 1; - alsa_stream->draining = 1; -@@ -341,8 +344,7 @@ static int snd_bcm2835_pcm_hw_free(struct snd_pcm_substream *substream) - return snd_pcm_lib_free_pages(substream); - } - --/* prepare callback */ --static int snd_bcm2835_pcm_prepare(struct snd_pcm_substream *substream) -+int snd_bcm2835_pcm_prepare_again(struct snd_pcm_substream *substream) - { - bcm2835_chip_t *chip = snd_pcm_substream_chip(substream); - struct snd_pcm_runtime *runtime = substream->runtime; -@@ -350,8 +352,6 @@ static int snd_bcm2835_pcm_prepare(struct snd_pcm_substream *substream) - int channels; - int err; - -- audio_info(" .. IN\n"); -- - /* notify the vchiq that it should enter spdif passthrough mode by - * setting channels=0 (see - * https://github.com/raspberrypi/linux/issues/528) */ -@@ -367,6 +367,20 @@ static int snd_bcm2835_pcm_prepare(struct snd_pcm_substream *substream) - audio_error(" error setting hw params\n"); - } - -+ return err; -+} ++static struct platform_device_id rpisense_fb_device_id[] = { ++ { .name = "rpi-sense-fb" }, ++ { }, ++}; ++MODULE_DEVICE_TABLE(platform, rpisense_fb_device_id); + -+/* prepare callback */ -+static int snd_bcm2835_pcm_prepare(struct snd_pcm_substream *substream) -+{ -+ bcm2835_chip_t *chip = snd_pcm_substream_chip(substream); -+ struct snd_pcm_runtime *runtime = substream->runtime; -+ bcm2835_alsa_stream_t *alsa_stream = runtime->private_data; ++static struct platform_driver rpisense_fb_driver = { ++ .probe = rpisense_fb_probe, ++ .remove = rpisense_fb_remove, ++ .driver = { ++ .name = "rpi-sense-fb", ++ .owner = THIS_MODULE, ++ }, ++}; + -+ audio_info(" .. IN\n"); ++module_platform_driver(rpisense_fb_driver); + -+ snd_bcm2835_pcm_prepare_again(substream); ++MODULE_DESCRIPTION("Raspberry Pi Sense HAT framebuffer driver"); ++MODULE_AUTHOR("Serge Schneider <serge@raspberrypi.org>"); ++MODULE_LICENSE("GPL"); + - bcm2835_audio_setup(alsa_stream); - - /* in preparation of the stream, set the controls (volume level) of the stream */ -diff --git a/sound/arm/bcm2835-vchiq.c b/sound/arm/bcm2835-vchiq.c -index 3de3094..8ecd2d73 100755 ---- a/sound/arm/bcm2835-vchiq.c -+++ b/sound/arm/bcm2835-vchiq.c -@@ -570,6 +570,8 @@ int bcm2835_audio_set_params(bcm2835_alsa_stream_t * alsa_stream, - VC_AUDIO_MSG_T m; - AUDIO_INSTANCE_T *instance = alsa_stream->instance; - int32_t success; -+ uint32_t chmap_value; -+ int i; - int ret; - LOG_DBG(" .. IN\n"); - -@@ -593,10 +595,21 @@ int bcm2835_audio_set_params(bcm2835_alsa_stream_t * alsa_stream, - - instance->result = -1; - -+ if (alsa_stream->chip->cea_chmap >= 0) { -+ chmap_value = (unsigned)alsa_stream->chip->cea_chmap << 24; -+ } else { -+ chmap_value = 0; /* force stereo */ -+ for (i = 0; i < 8; i++) -+ alsa_stream->chip->map_channels[i] = i; -+ } -+ for (i = 0; i < 8; i++) -+ chmap_value |= alsa_stream->chip->map_channels[i] << (i * 3); +diff --git a/include/linux/mfd/rpisense/core.h b/include/linux/mfd/rpisense/core.h +new file mode 100644 +index 0000000..4856aa3 +--- /dev/null ++++ b/include/linux/mfd/rpisense/core.h +@@ -0,0 +1,47 @@ ++/* ++ * Raspberry Pi Sense HAT core driver ++ * http://raspberrypi.org ++ * ++ * Copyright (C) 2015 Raspberry Pi ++ * ++ * Author: Serge Schneider ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License as published by the ++ * Free Software Foundation; either version 2 of the License, or (at your ++ * option) any later version. ++ * ++ */ + - m.type = VC_AUDIO_MSG_TYPE_CONFIG; - m.u.config.channels = channels; - m.u.config.samplerate = samplerate; - m.u.config.bps = bps; -+ m.u.config.channelmap = chmap_value; - - /* Create the message available completion */ - init_completion(&instance->msg_avail_comp); -diff --git a/sound/arm/bcm2835.h b/sound/arm/bcm2835.h -index 0f71c5d..997fb69 100755 ---- a/sound/arm/bcm2835.h -+++ b/sound/arm/bcm2835.h -@@ -107,6 +107,8 @@ typedef struct bcm2835_chip { - int old_volume; /* stores the volume value whist muted */ - int dest; - int mute; -+ int cea_chmap; /* currently requested Audio InfoFrame Data Byte 4 */ -+ int map_channels[8]; - - unsigned int opened; - unsigned int spdif_status; -@@ -149,6 +151,8 @@ int snd_bcm2835_new_ctl(bcm2835_chip_t * chip); - int snd_bcm2835_new_pcm(bcm2835_chip_t * chip); - int snd_bcm2835_new_spdif_pcm(bcm2835_chip_t * chip); - -+int snd_bcm2835_pcm_prepare_again(struct snd_pcm_substream *substream); -+ - int bcm2835_audio_open(bcm2835_alsa_stream_t * alsa_stream); - int bcm2835_audio_close(bcm2835_alsa_stream_t * alsa_stream); - int bcm2835_audio_set_params(bcm2835_alsa_stream_t * alsa_stream, - -From 2a64337156d0f84537e04338b2ebd89eb6ec1f09 Mon Sep 17 00:00:00 2001 -From: wm4 <wm4@nowhere> -Date: Wed, 13 Jan 2016 19:43:35 +0100 -Subject: [PATCH 132/170] bcm2835: access controls under the audio mutex ++#ifndef __LINUX_MFD_RPISENSE_CORE_H_ ++#define __LINUX_MFD_RPISENSE_CORE_H_ ++ ++#include <linux/mfd/rpisense/joystick.h> ++#include <linux/mfd/rpisense/framebuffer.h> ++ ++/* ++ * Register values. ++ */ ++#define RPISENSE_FB 0x00 ++#define RPISENSE_WAI 0xF0 ++#define RPISENSE_VER 0xF1 ++#define RPISENSE_KEYS 0xF2 ++#define RPISENSE_EE_WP 0xF3 ++ ++#define RPISENSE_ID 's' ++ ++struct rpisense { ++ struct device *dev; ++ struct i2c_client *i2c_client; ++ ++ /* Client devices */ ++ struct rpisense_js joystick; ++ struct rpisense_fb framebuffer; ++}; ++ ++struct rpisense *rpisense_get_dev(void); ++s32 rpisense_reg_read(struct rpisense *rpisense, int reg); ++int rpisense_reg_write(struct rpisense *rpisense, int reg, u16 val); ++int rpisense_block_write(struct rpisense *rpisense, const char *buf, int count); ++ ++#endif +diff --git a/include/linux/mfd/rpisense/framebuffer.h b/include/linux/mfd/rpisense/framebuffer.h +new file mode 100644 +index 0000000..2ba95d7 +--- /dev/null ++++ b/include/linux/mfd/rpisense/framebuffer.h +@@ -0,0 +1,32 @@ ++/* ++ * Raspberry Pi Sense HAT framebuffer driver ++ * http://raspberrypi.org ++ * ++ * Copyright (C) 2015 Raspberry Pi ++ * ++ * Author: Serge Schneider ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License as published by the ++ * Free Software Foundation; either version 2 of the License, or (at your ++ * option) any later version. ++ * ++ */ ++ ++#ifndef __LINUX_RPISENSE_FB_H_ ++#define __LINUX_RPISENSE_FB_H_ ++ ++#define SENSEFB_FBIO_IOC_MAGIC 0xF1 ++ ++#define SENSEFB_FBIOGET_GAMMA _IO(SENSEFB_FBIO_IOC_MAGIC, 0) ++#define SENSEFB_FBIOSET_GAMMA _IO(SENSEFB_FBIO_IOC_MAGIC, 1) ++#define SENSEFB_FBIORESET_GAMMA _IO(SENSEFB_FBIO_IOC_MAGIC, 2) ++ ++struct rpisense; ++ ++struct rpisense_fb { ++ struct platform_device *pdev; ++ struct fb_info *info; ++}; ++ ++#endif +diff --git a/include/linux/mfd/rpisense/joystick.h b/include/linux/mfd/rpisense/joystick.h +new file mode 100644 +index 0000000..56196dc +--- /dev/null ++++ b/include/linux/mfd/rpisense/joystick.h +@@ -0,0 +1,35 @@ ++/* ++ * Raspberry Pi Sense HAT joystick driver ++ * http://raspberrypi.org ++ * ++ * Copyright (C) 2015 Raspberry Pi ++ * ++ * Author: Serge Schneider ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License as published by the ++ * Free Software Foundation; either version 2 of the License, or (at your ++ * option) any later version. ++ * ++ */ ++ ++#ifndef __LINUX_RPISENSE_JOYSTICK_H_ ++#define __LINUX_RPISENSE_JOYSTICK_H_ ++ ++#include <linux/input.h> ++#include <linux/interrupt.h> ++#include <linux/gpio/consumer.h> ++#include <linux/platform_device.h> ++ ++struct rpisense; ++ ++struct rpisense_js { ++ struct platform_device *pdev; ++ struct input_dev *keys_dev; ++ struct gpio_desc *keys_desc; ++ struct work_struct keys_work_s; ++ int keys_irq; ++}; ++ ++ ++#endif -I don't think the ALSA framework provides any kind of automatic -synchronization within the control callbacks. We most likely need -to ensure this manually, so add locking around all access to shared -mutable data. In particular, bcm2835_audio_set_ctls() should -probably always be called under our own audio lock. +From 4b70a98f86ebee7fe728cc485ce689ea8f842ab6 Mon Sep 17 00:00:00 2001 +From: Jan Grulich <jan@grulich.eu> +Date: Mon, 24 Aug 2015 16:03:47 +0100 +Subject: [PATCH 082/112] RaspiDAC3 support + +Signed-off-by: Jan Grulich <jan@grulich.eu> + +config: fix RaspiDAC Rev.3x dependencies + +Change depends to SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S +like the other I2S soundcard drivers. + +Signed-off-by: Matthias Reichl <hias@horus.com> --- - sound/arm/bcm2835-ctl.c | 74 +++++++++++++++++++++++++++++++++++++++++-------- - sound/arm/bcm2835-pcm.c | 4 +++ - 2 files changed, 66 insertions(+), 12 deletions(-) + sound/soc/bcm/Kconfig | 8 ++ + sound/soc/bcm/Makefile | 2 + + sound/soc/bcm/raspidac3.c | 192 ++++++++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 202 insertions(+) + create mode 100644 sound/soc/bcm/raspidac3.c -diff --git a/sound/arm/bcm2835-ctl.c b/sound/arm/bcm2835-ctl.c -index 92d3f76..5b8e6bd2 100755 ---- a/sound/arm/bcm2835-ctl.c -+++ b/sound/arm/bcm2835-ctl.c -@@ -94,6 +94,9 @@ static int snd_bcm2835_ctl_get(struct snd_kcontrol *kcontrol, - { - struct bcm2835_chip *chip = snd_kcontrol_chip(kcontrol); - -+ if (mutex_lock_interruptible(&chip->audio_mutex)) -+ return -EINTR; +diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig +index 8669a9a..1a3f826 100644 +--- a/sound/soc/bcm/Kconfig ++++ b/sound/soc/bcm/Kconfig +@@ -56,3 +56,11 @@ config SND_BCM2708_SOC_IQAUDIO_DAC + select SND_SOC_PCM512x_I2C + help + Say Y or M if you want to add support for IQaudIO-DAC. + - BUG_ON(!chip && !(chip->avail_substreams & AVAIL_SUBSTREAMS_MASK)); - - if (kcontrol->private_value == PCM_PLAYBACK_VOLUME) -@@ -103,6 +106,7 @@ static int snd_bcm2835_ctl_get(struct snd_kcontrol *kcontrol, - else if (kcontrol->private_value == PCM_PLAYBACK_DEVICE) - ucontrol->value.integer.value[0] = chip->dest; - -+ mutex_unlock(&chip->audio_mutex); - return 0; - } - -@@ -112,11 +116,15 @@ static int snd_bcm2835_ctl_put(struct snd_kcontrol *kcontrol, - struct bcm2835_chip *chip = snd_kcontrol_chip(kcontrol); - int changed = 0; ++config SND_BCM2708_SOC_RASPIDAC3 ++ tristate "Support for RaspiDAC Rev.3x" ++ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S ++ select SND_SOC_PCM512x_I2C ++ select SND_SOC_TPA6130A2 ++ help ++ Say Y or M if you want to add support for RaspiDAC Rev.3x. +diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile +index 4f5ab1f..b21e11e 100644 +--- a/sound/soc/bcm/Makefile ++++ b/sound/soc/bcm/Makefile +@@ -11,6 +11,7 @@ snd-soc-hifiberry-amp-objs := hifiberry_amp.o + snd-soc-rpi-dac-objs := rpi-dac.o + snd-soc-rpi-proto-objs := rpi-proto.o + snd-soc-iqaudio-dac-objs := iqaudio-dac.o ++snd-soc-raspidac3-objs := raspidac3.o -+ if (mutex_lock_interruptible(&chip->audio_mutex)) -+ return -EINTR; + obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o + obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS) += snd-soc-hifiberry-dacplus.o +@@ -19,3 +20,4 @@ obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_AMP) += snd-soc-hifiberry-amp.o + obj-$(CONFIG_SND_BCM2708_SOC_RPI_DAC) += snd-soc-rpi-dac.o + obj-$(CONFIG_SND_BCM2708_SOC_RPI_PROTO) += snd-soc-rpi-proto.o + obj-$(CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC) += snd-soc-iqaudio-dac.o ++obj-$(CONFIG_SND_BCM2708_SOC_RASPIDAC3) += snd-soc-raspidac3.o +diff --git a/sound/soc/bcm/raspidac3.c b/sound/soc/bcm/raspidac3.c +new file mode 100644 +index 0000000..e7422e2 +--- /dev/null ++++ b/sound/soc/bcm/raspidac3.c +@@ -0,0 +1,192 @@ ++/* ++ * ASoC Driver for RaspiDAC v3 ++ * ++ * Author: Jan Grulich <jan@grulich.eu> ++ * Copyright 2015 ++ * based on code by Daniel Matuschek <daniel@hifiberry.com> ++ * based on code by Florian Meier <florian.meier@koalo.de> ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * version 2 as published by the Free Software Foundation. ++ * ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * General Public License for more details. ++ */ + - if (kcontrol->private_value == PCM_PLAYBACK_VOLUME) { - audio_info("Volume change attempted.. volume = %d new_volume = %d\n", chip->volume, (int)ucontrol->value.integer.value[0]); - if (chip->mute == CTRL_VOL_MUTE) { - /* changed = toggle_mute(chip, CTRL_VOL_UNMUTE); */ -- return 1; /* should return 0 to signify no change but the mixer takes this as the opposite sign (no idea why) */ -+ changed = 1; /* should return 0 to signify no change but the mixer takes this as the opposite sign (no idea why) */ -+ goto unlock; - } - if (changed - || (ucontrol->value.integer.value[0] != chip2alsa(chip->volume))) { -@@ -142,6 +150,8 @@ static int snd_bcm2835_ctl_put(struct snd_kcontrol *kcontrol, - printk(KERN_ERR "Failed to set ALSA controls..\n"); - } - -+unlock: -+ mutex_unlock(&chip->audio_mutex); - return changed; - } - -@@ -198,10 +208,14 @@ static int snd_bcm2835_spdif_default_get(struct snd_kcontrol *kcontrol, - struct bcm2835_chip *chip = snd_kcontrol_chip(kcontrol); - int i; - -+ if (mutex_lock_interruptible(&chip->audio_mutex)) -+ return -EINTR; ++#include <linux/module.h> ++#include <linux/platform_device.h> + - for (i = 0; i < 4; i++) - ucontrol->value.iec958.status[i] = - (chip->spdif_status >> (i * 8)) && 0xff; - -+ mutex_unlock(&chip->audio_mutex); - return 0; - } - -@@ -212,12 +226,16 @@ static int snd_bcm2835_spdif_default_put(struct snd_kcontrol *kcontrol, - unsigned int val = 0; - int i, change; - -+ if (mutex_lock_interruptible(&chip->audio_mutex)) -+ return -EINTR; ++#include <sound/core.h> ++#include <sound/pcm.h> ++#include <sound/pcm_params.h> ++#include <sound/soc.h> ++#include <sound/jack.h> ++#include <sound/soc-dapm.h> + - for (i = 0; i < 4; i++) - val |= (unsigned int)ucontrol->value.iec958.status[i] << (i * 8); - - change = val != chip->spdif_status; - chip->spdif_status = val; - -+ mutex_unlock(&chip->audio_mutex); - return change; - } - -@@ -253,9 +271,14 @@ static int snd_bcm2835_spdif_stream_get(struct snd_kcontrol *kcontrol, - struct bcm2835_chip *chip = snd_kcontrol_chip(kcontrol); - int i; - -+ if (mutex_lock_interruptible(&chip->audio_mutex)) -+ return -EINTR; ++#include "../codecs/pcm512x.h" ++#include "../codecs/tpa6130a2.h" + - for (i = 0; i < 4; i++) - ucontrol->value.iec958.status[i] = - (chip->spdif_status >> (i * 8)) & 0xff; ++/* sound card init */ ++static int snd_rpi_raspidac3_init(struct snd_soc_pcm_runtime *rtd) ++{ ++ int ret; ++ struct snd_soc_card *card = rtd->card; ++ struct snd_soc_codec *codec = rtd->codec; ++ snd_soc_update_bits(codec, PCM512x_GPIO_EN, 0x08, 0x08); ++ snd_soc_update_bits(codec, PCM512x_GPIO_OUTPUT_4, 0xf, 0x02); ++ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x08,0x00); + -+ mutex_unlock(&chip->audio_mutex); - return 0; - } - -@@ -266,11 +289,15 @@ static int snd_bcm2835_spdif_stream_put(struct snd_kcontrol *kcontrol, - unsigned int val = 0; - int i, change; - -+ if (mutex_lock_interruptible(&chip->audio_mutex)) -+ return -EINTR; ++ ret = snd_soc_limit_volume(card, "Digital Playback Volume", 207); ++ if (ret < 0) ++ dev_warn(card->dev, "Failed to set volume limit: %d\n", ret); ++ else { ++ struct snd_kcontrol *kctl; + - for (i = 0; i < 4; i++) - val |= (unsigned int)ucontrol->value.iec958.status[i] << (i * 8); - change = val != chip->spdif_status; - chip->spdif_status = val; - -+ mutex_unlock(&chip->audio_mutex); - return change; - } - -@@ -454,11 +481,17 @@ static int snd_bcm2835_chmap_ctl_get(struct snd_kcontrol *kcontrol, - unsigned int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); - struct snd_pcm_substream *substream = snd_pcm_chmap_substream(info, idx); - struct cea_channel_speaker_allocation *ch = NULL; -+ int res = 0; - int cur = 0; - int i; - -- if (!substream || !substream->runtime) -- return -ENODEV; -+ if (mutex_lock_interruptible(&chip->audio_mutex)) -+ return -EINTR; ++ ret = tpa6130a2_add_controls(codec); ++ if (ret < 0) ++ dev_warn(card->dev, "Failed to add TPA6130A2 controls: %d\n", ++ ret); ++ ret = snd_soc_limit_volume(card, ++ "TPA6130A2 Headphone Playback Volume", ++ 54); ++ if (ret < 0) ++ dev_warn(card->dev, "Failed to set TPA6130A2 volume limit: %d\n", ++ ret); ++ kctl = snd_soc_card_get_kcontrol(card, ++ "TPA6130A2 Headphone Playback Volume"); ++ if (kctl) { ++ strcpy(kctl->id.name, "Headphones Playback Volume"); ++ /* disable the volume dB scale so alsamixer works */ ++ kctl->vd[0].access = SNDRV_CTL_ELEM_ACCESS_READWRITE; ++ } + -+ if (!substream || !substream->runtime) { -+ res = -ENODEV; -+ goto unlock; ++ kctl = snd_soc_card_get_kcontrol(card, ++ "TPA6130A2 Headphone Playback Switch"); ++ if (kctl) ++ strcpy(kctl->id.name, "Headphones Playback Switch"); + } - - for (i = 0; i < ARRAY_SIZE(channel_allocations); i++) { - if (channel_allocations[i].ca_index == chip->cea_chmap) -@@ -476,7 +509,10 @@ static int snd_bcm2835_chmap_ctl_get(struct snd_kcontrol *kcontrol, - } - while (cur < 8) - ucontrol->value.integer.value[cur++] = SNDRV_CHMAP_NA; -- return 0; + -+unlock: -+ mutex_unlock(&chip->audio_mutex); -+ return res; - } - - static int snd_bcm2835_chmap_ctl_put(struct snd_kcontrol *kcontrol, -@@ -487,10 +523,16 @@ static int snd_bcm2835_chmap_ctl_put(struct snd_kcontrol *kcontrol, - unsigned int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); - struct snd_pcm_substream *substream = snd_pcm_chmap_substream(info, idx); - int i, prepared = 0, cea_chmap = -1; -+ int res = 0; - int remap[8]; - -- if (!substream || !substream->runtime) -- return -ENODEV; -+ if (mutex_lock_interruptible(&chip->audio_mutex)) -+ return -EINTR; ++ return 0; ++} ++ ++/* set hw parameters */ ++static int snd_rpi_raspidac3_hw_params(struct snd_pcm_substream *substream, ++ struct snd_pcm_hw_params *params) ++{ ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; ++ ++ unsigned int sample_bits = ++ snd_pcm_format_physical_width(params_format(params)); ++ ++ return snd_soc_dai_set_bclk_ratio(cpu_dai, sample_bits * 2); ++} ++ ++/* startup */ ++static int snd_rpi_raspidac3_startup(struct snd_pcm_substream *substream) { ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_codec *codec = rtd->codec; ++ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x08,0x08); ++ tpa6130a2_stereo_enable(codec, 1); ++ return 0; ++} ++ ++/* shutdown */ ++static void snd_rpi_raspidac3_shutdown(struct snd_pcm_substream *substream) { ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_codec *codec = rtd->codec; ++ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x08,0x00); ++ tpa6130a2_stereo_enable(codec, 0); ++} ++ ++/* machine stream operations */ ++static struct snd_soc_ops snd_rpi_raspidac3_ops = { ++ .hw_params = snd_rpi_raspidac3_hw_params, ++ .startup = snd_rpi_raspidac3_startup, ++ .shutdown = snd_rpi_raspidac3_shutdown, ++}; ++ ++/* interface setup */ ++static struct snd_soc_dai_link snd_rpi_raspidac3_dai[] = { ++{ ++ .name = "RaspiDAC Rev.3x", ++ .stream_name = "RaspiDAC HiFi", ++ .cpu_dai_name = "bcm2708-i2s.0", ++ .codec_dai_name = "pcm512x-hifi", ++ .platform_name = "bcm2708-i2s.0", ++ .codec_name = "pcm512x.1-004c", ++ .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | ++ SND_SOC_DAIFMT_CBS_CFS, ++ .ops = &snd_rpi_raspidac3_ops, ++ .init = snd_rpi_raspidac3_init, ++}, ++}; ++ ++/* audio machine driver */ ++static struct snd_soc_card snd_rpi_raspidac3 = { ++ .name = "RaspiDAC Rev.3x HiFi Audio Card", ++ .owner = THIS_MODULE, ++ .dai_link = snd_rpi_raspidac3_dai, ++ .num_links = ARRAY_SIZE(snd_rpi_raspidac3_dai), ++}; ++ ++/* sound card test */ ++static int snd_rpi_raspidac3_probe(struct platform_device *pdev) ++{ ++ int ret = 0; ++ ++ snd_rpi_raspidac3.dev = &pdev->dev; + -+ if (!substream || !substream->runtime) { -+ res = -ENODEV; -+ goto unlock; -+ } - - switch (substream->runtime->status->state) { - case SNDRV_PCM_STATE_OPEN: -@@ -500,7 +542,8 @@ static int snd_bcm2835_chmap_ctl_put(struct snd_kcontrol *kcontrol, - prepared = 1; - break; - default: -- return -EBUSY; -+ res = -EBUSY; -+ goto unlock; - } - - for (i = 0; i < ARRAY_SIZE(channel_allocations); i++) { -@@ -538,19 +581,26 @@ static int snd_bcm2835_chmap_ctl_put(struct snd_kcontrol *kcontrol, - } - } - -- if (cea_chmap < 0) -- return -EINVAL; -+ if (cea_chmap < 0) { -+ res = -EINVAL; -+ goto unlock; -+ } - - /* don't change the layout if another substream is active */ -- if (chip->opened != (1 << substream->number) && chip->cea_chmap != cea_chmap) -- return -EBUSY; /* unsure whether this is a good error code */ -+ if (chip->opened != (1 << substream->number) && chip->cea_chmap != cea_chmap) { -+ res = -EBUSY; /* unsure whether this is a good error code */ -+ goto unlock; ++ if (pdev->dev.of_node) { ++ struct device_node *i2s_node; ++ struct snd_soc_dai_link *dai = &snd_rpi_raspidac3_dai[0]; ++ i2s_node = of_parse_phandle(pdev->dev.of_node, ++ "i2s-controller", 0); ++ ++ if (i2s_node) { ++ dai->cpu_dai_name = NULL; ++ dai->cpu_of_node = i2s_node; ++ dai->platform_name = NULL; ++ dai->platform_of_node = i2s_node; ++ } + } - - chip->cea_chmap = cea_chmap; - for (i = 0; i < 8; i++) - chip->map_channels[i] = remap[i]; - if (prepared) - snd_bcm2835_pcm_prepare_again(substream); -- return 0; + -+unlock: -+ mutex_unlock(&chip->audio_mutex); -+ return res; - } - - static int snd_bcm2835_add_chmap_ctl(bcm2835_chip_t * chip) -diff --git a/sound/arm/bcm2835-pcm.c b/sound/arm/bcm2835-pcm.c -index 1067460..48da3bb 100755 ---- a/sound/arm/bcm2835-pcm.c -+++ b/sound/arm/bcm2835-pcm.c -@@ -379,6 +379,9 @@ static int snd_bcm2835_pcm_prepare(struct snd_pcm_substream *substream) - - audio_info(" .. IN\n"); - -+ if (mutex_lock_interruptible(&chip->audio_mutex)) -+ return -EINTR; ++ ret = snd_soc_register_card(&snd_rpi_raspidac3); ++ if (ret) ++ dev_err(&pdev->dev, ++ "snd_soc_register_card() failed: %d\n", ret); + - snd_bcm2835_pcm_prepare_again(substream); - - bcm2835_audio_setup(alsa_stream); -@@ -401,6 +404,7 @@ static int snd_bcm2835_pcm_prepare(struct snd_pcm_substream *substream) - alsa_stream->buffer_size, alsa_stream->period_size, - alsa_stream->pos, runtime->frame_bits); - -+ mutex_unlock(&chip->audio_mutex); - audio_info(" .. OUT\n"); - return 0; - } - -From 6e781f631f7e23f7d88256d020d83950c9bf213a Mon Sep 17 00:00:00 2001 -From: wm4 <wm4@nowhere> -Date: Wed, 13 Jan 2016 19:44:03 +0100 -Subject: [PATCH 133/170] bcm2835: always use 2/4/8 channels for multichannel - layouts - -Pad the unused channels with NA. This means userspace needs to write -additional, silent padding channels, which is not ideal, but better -than noise. - -Works around noise at the following channel counts: 3, 5, 6, 7 ---- - sound/arm/bcm2835-ctl.c | 89 +++++++++++++++++++++++++------------------------ - 1 file changed, 45 insertions(+), 44 deletions(-) - -diff --git a/sound/arm/bcm2835-ctl.c b/sound/arm/bcm2835-ctl.c -index 5b8e6bd2..dec052b 100755 ---- a/sound/arm/bcm2835-ctl.c -+++ b/sound/arm/bcm2835-ctl.c -@@ -349,6 +349,7 @@ struct cea_channel_speaker_allocation { - #define FRW SNDRV_CHMAP_FRW - #define TC SNDRV_CHMAP_TC - #define FCH SNDRV_CHMAP_TFC -+#define NA SNDRV_CHMAP_NA - - /* - * CEA-861 channel maps -@@ -356,69 +357,69 @@ struct cea_channel_speaker_allocation { - * Stolen from sound/pci/hda/patch_hdmi.c - * (unlike the source, this uses SNDRV_* constants directly, as by the - * map_tables array in patch_hdmi.c) -- * Unknown entries use 0, which unfortunately is SNDRV_CHMAP_UNKNOWN instead -- * of SNDRV_CHMAP_NA. -+ * Entries which do not have a physical output channel use 0. Entries which -+ * require userspace to output silence use NA (SNDRV_CHMAP_NA). - */ - static struct cea_channel_speaker_allocation channel_allocations[] = { - /* channel: 7 6 5 4 3 2 1 0 */ - { .ca_index = 0x00, .speakers = { 0, 0, 0, 0, 0, 0, FR, FL } }, - /* 2.1 */ --{ .ca_index = 0x01, .speakers = { 0, 0, 0, 0, 0, LFE, FR, FL } }, -+{ .ca_index = 0x01, .speakers = { 0, 0, 0, 0, NA, LFE, FR, FL } }, - /* Dolby Surround */ --{ .ca_index = 0x02, .speakers = { 0, 0, 0, 0, FC, 0, FR, FL } }, -+{ .ca_index = 0x02, .speakers = { 0, 0, 0, 0, FC, NA, FR, FL } }, - /* surround40 */ --{ .ca_index = 0x08, .speakers = { 0, 0, RR, RL, 0, 0, FR, FL } }, -+{ .ca_index = 0x08, .speakers = { NA, NA, RR, RL, NA, NA, FR, FL } }, - /* surround41 */ --{ .ca_index = 0x09, .speakers = { 0, 0, RR, RL, 0, LFE, FR, FL } }, -+{ .ca_index = 0x09, .speakers = { NA, NA, RR, RL, NA, LFE, FR, FL } }, - /* surround50 */ --{ .ca_index = 0x0a, .speakers = { 0, 0, RR, RL, FC, 0, FR, FL } }, -+{ .ca_index = 0x0a, .speakers = { NA, NA, RR, RL, FC, NA, FR, FL } }, - /* surround51 */ --{ .ca_index = 0x0b, .speakers = { 0, 0, RR, RL, FC, LFE, FR, FL } }, -+{ .ca_index = 0x0b, .speakers = { NA, NA, RR, RL, FC, LFE, FR, FL } }, - /* 6.1 */ --{ .ca_index = 0x0f, .speakers = { 0, RC, RR, RL, FC, LFE, FR, FL } }, -+{ .ca_index = 0x0f, .speakers = { NA, RC, RR, RL, FC, LFE, FR, FL } }, - /* surround71 */ - { .ca_index = 0x13, .speakers = { RRC, RLC, RR, RL, FC, LFE, FR, FL } }, - --{ .ca_index = 0x03, .speakers = { 0, 0, 0, 0, FC, LFE, FR, FL } }, --{ .ca_index = 0x04, .speakers = { 0, 0, 0, RC, 0, 0, FR, FL } }, --{ .ca_index = 0x05, .speakers = { 0, 0, 0, RC, 0, LFE, FR, FL } }, --{ .ca_index = 0x06, .speakers = { 0, 0, 0, RC, FC, 0, FR, FL } }, --{ .ca_index = 0x07, .speakers = { 0, 0, 0, RC, FC, LFE, FR, FL } }, --{ .ca_index = 0x0c, .speakers = { 0, RC, RR, RL, 0, 0, FR, FL } }, --{ .ca_index = 0x0d, .speakers = { 0, RC, RR, RL, 0, LFE, FR, FL } }, --{ .ca_index = 0x0e, .speakers = { 0, RC, RR, RL, FC, 0, FR, FL } }, --{ .ca_index = 0x10, .speakers = { RRC, RLC, RR, RL, 0, 0, FR, FL } }, --{ .ca_index = 0x11, .speakers = { RRC, RLC, RR, RL, 0, LFE, FR, FL } }, --{ .ca_index = 0x12, .speakers = { RRC, RLC, RR, RL, FC, 0, FR, FL } }, --{ .ca_index = 0x14, .speakers = { FRC, FLC, 0, 0, 0, 0, FR, FL } }, --{ .ca_index = 0x15, .speakers = { FRC, FLC, 0, 0, 0, LFE, FR, FL } }, --{ .ca_index = 0x16, .speakers = { FRC, FLC, 0, 0, FC, 0, FR, FL } }, --{ .ca_index = 0x17, .speakers = { FRC, FLC, 0, 0, FC, LFE, FR, FL } }, --{ .ca_index = 0x18, .speakers = { FRC, FLC, 0, RC, 0, 0, FR, FL } }, --{ .ca_index = 0x19, .speakers = { FRC, FLC, 0, RC, 0, LFE, FR, FL } }, --{ .ca_index = 0x1a, .speakers = { FRC, FLC, 0, RC, FC, 0, FR, FL } }, --{ .ca_index = 0x1b, .speakers = { FRC, FLC, 0, RC, FC, LFE, FR, FL } }, --{ .ca_index = 0x1c, .speakers = { FRC, FLC, RR, RL, 0, 0, FR, FL } }, --{ .ca_index = 0x1d, .speakers = { FRC, FLC, RR, RL, 0, LFE, FR, FL } }, --{ .ca_index = 0x1e, .speakers = { FRC, FLC, RR, RL, FC, 0, FR, FL } }, -+{ .ca_index = 0x03, .speakers = { NA, NA, NA, NA, FC, LFE, FR, FL } }, -+{ .ca_index = 0x04, .speakers = { NA, NA, NA, RC, NA, NA, FR, FL } }, -+{ .ca_index = 0x05, .speakers = { NA, NA, NA, RC, NA, LFE, FR, FL } }, -+{ .ca_index = 0x06, .speakers = { NA, NA, NA, RC, FC, NA, FR, FL } }, -+{ .ca_index = 0x07, .speakers = { NA, NA, NA, RC, FC, LFE, FR, FL } }, -+{ .ca_index = 0x0c, .speakers = { NA, RC, RR, RL, NA, NA, FR, FL } }, -+{ .ca_index = 0x0d, .speakers = { NA, RC, RR, RL, NA, LFE, FR, FL } }, -+{ .ca_index = 0x0e, .speakers = { NA, RC, RR, RL, FC, NA, FR, FL } }, -+{ .ca_index = 0x10, .speakers = { RRC, RLC, RR, RL, NA, NA, FR, FL } }, -+{ .ca_index = 0x11, .speakers = { RRC, RLC, RR, RL, NA, LFE, FR, FL } }, -+{ .ca_index = 0x12, .speakers = { RRC, RLC, RR, RL, FC, NA, FR, FL } }, -+{ .ca_index = 0x14, .speakers = { FRC, FLC, NA, NA, NA, NA, FR, FL } }, -+{ .ca_index = 0x15, .speakers = { FRC, FLC, NA, NA, NA, LFE, FR, FL } }, -+{ .ca_index = 0x16, .speakers = { FRC, FLC, NA, NA, FC, NA, FR, FL } }, -+{ .ca_index = 0x17, .speakers = { FRC, FLC, NA, NA, FC, LFE, FR, FL } }, -+{ .ca_index = 0x18, .speakers = { FRC, FLC, NA, RC, NA, NA, FR, FL } }, -+{ .ca_index = 0x19, .speakers = { FRC, FLC, NA, RC, NA, LFE, FR, FL } }, -+{ .ca_index = 0x1a, .speakers = { FRC, FLC, NA, RC, FC, NA, FR, FL } }, -+{ .ca_index = 0x1b, .speakers = { FRC, FLC, NA, RC, FC, LFE, FR, FL } }, -+{ .ca_index = 0x1c, .speakers = { FRC, FLC, RR, RL, NA, NA, FR, FL } }, -+{ .ca_index = 0x1d, .speakers = { FRC, FLC, RR, RL, NA, LFE, FR, FL } }, -+{ .ca_index = 0x1e, .speakers = { FRC, FLC, RR, RL, FC, NA, FR, FL } }, - { .ca_index = 0x1f, .speakers = { FRC, FLC, RR, RL, FC, LFE, FR, FL } }, --{ .ca_index = 0x20, .speakers = { 0, FCH, RR, RL, FC, 0, FR, FL } }, --{ .ca_index = 0x21, .speakers = { 0, FCH, RR, RL, FC, LFE, FR, FL } }, --{ .ca_index = 0x22, .speakers = { TC, 0, RR, RL, FC, 0, FR, FL } }, --{ .ca_index = 0x23, .speakers = { TC, 0, RR, RL, FC, LFE, FR, FL } }, --{ .ca_index = 0x24, .speakers = { FRH, FLH, RR, RL, 0, 0, FR, FL } }, --{ .ca_index = 0x25, .speakers = { FRH, FLH, RR, RL, 0, LFE, FR, FL } }, --{ .ca_index = 0x26, .speakers = { FRW, FLW, RR, RL, 0, 0, FR, FL } }, --{ .ca_index = 0x27, .speakers = { FRW, FLW, RR, RL, 0, LFE, FR, FL } }, --{ .ca_index = 0x28, .speakers = { TC, RC, RR, RL, FC, 0, FR, FL } }, -+{ .ca_index = 0x20, .speakers = { NA, FCH, RR, RL, FC, NA, FR, FL } }, -+{ .ca_index = 0x21, .speakers = { NA, FCH, RR, RL, FC, LFE, FR, FL } }, -+{ .ca_index = 0x22, .speakers = { TC, NA, RR, RL, FC, NA, FR, FL } }, -+{ .ca_index = 0x23, .speakers = { TC, NA, RR, RL, FC, LFE, FR, FL } }, -+{ .ca_index = 0x24, .speakers = { FRH, FLH, RR, RL, NA, NA, FR, FL } }, -+{ .ca_index = 0x25, .speakers = { FRH, FLH, RR, RL, NA, LFE, FR, FL } }, -+{ .ca_index = 0x26, .speakers = { FRW, FLW, RR, RL, NA, NA, FR, FL } }, -+{ .ca_index = 0x27, .speakers = { FRW, FLW, RR, RL, NA, LFE, FR, FL } }, -+{ .ca_index = 0x28, .speakers = { TC, RC, RR, RL, FC, NA, FR, FL } }, - { .ca_index = 0x29, .speakers = { TC, RC, RR, RL, FC, LFE, FR, FL } }, --{ .ca_index = 0x2a, .speakers = { FCH, RC, RR, RL, FC, 0, FR, FL } }, -+{ .ca_index = 0x2a, .speakers = { FCH, RC, RR, RL, FC, NA, FR, FL } }, - { .ca_index = 0x2b, .speakers = { FCH, RC, RR, RL, FC, LFE, FR, FL } }, --{ .ca_index = 0x2c, .speakers = { TC, FCH, RR, RL, FC, 0, FR, FL } }, -+{ .ca_index = 0x2c, .speakers = { TC, FCH, RR, RL, FC, NA, FR, FL } }, - { .ca_index = 0x2d, .speakers = { TC, FCH, RR, RL, FC, LFE, FR, FL } }, --{ .ca_index = 0x2e, .speakers = { FRH, FLH, RR, RL, FC, 0, FR, FL } }, -+{ .ca_index = 0x2e, .speakers = { FRH, FLH, RR, RL, FC, NA, FR, FL } }, - { .ca_index = 0x2f, .speakers = { FRH, FLH, RR, RL, FC, LFE, FR, FL } }, --{ .ca_index = 0x30, .speakers = { FRW, FLW, RR, RL, FC, 0, FR, FL } }, -+{ .ca_index = 0x30, .speakers = { FRW, FLW, RR, RL, FC, NA, FR, FL } }, - { .ca_index = 0x31, .speakers = { FRW, FLW, RR, RL, FC, LFE, FR, FL } }, - }; - - -From aaa2a41f44a0fc141b9a983a5f9f30bb8b6dbc8b Mon Sep 17 00:00:00 2001 -From: wm4 <wm4@nowhere> -Date: Wed, 13 Jan 2016 19:44:24 +0100 -Subject: [PATCH 134/170] bcm2835: only allow stereo if analogue jack is - selected - -Sending more than 2 channels to videocore while outputting to analogue -mysteriously outputs heavy artifacts. So just paint it over with a -hack: if analogue is explicitly selected as destination, do not -reporting support for anything other than stereo. - -I'm not sure how to deal with the auto case (destination 0). There's -probably way to retrieve this and even to listen to plug events, but -I didn't find one yet, and it's probably not worth the trouble. Just -don't use this setting, I guess. Unless you like noise. - -Changing the setting while an audio stream is active also doesn't -work properly. We could probably interrupt running streams by -returning ENODEV or using kernel hotplug stuff (maybe), but that -also doesn't seem worth the trouble. ---- - sound/arm/bcm2835-ctl.c | 12 ++++++++++++ - 1 file changed, 12 insertions(+) - -diff --git a/sound/arm/bcm2835-ctl.c b/sound/arm/bcm2835-ctl.c -index dec052b..e930718 100755 ---- a/sound/arm/bcm2835-ctl.c -+++ b/sound/arm/bcm2835-ctl.c -@@ -423,9 +423,16 @@ static struct cea_channel_speaker_allocation channel_allocations[] = { - { .ca_index = 0x31, .speakers = { FRW, FLW, RR, RL, FC, LFE, FR, FL } }, - }; - -+static int uses_analogue(bcm2835_chip_t *chip) ++ return ret; ++} ++ ++/* sound card disconnect */ ++static int snd_rpi_raspidac3_remove(struct platform_device *pdev) +{ -+ return chip->dest == 1; ++ return snd_soc_unregister_card(&snd_rpi_raspidac3); +} + - static int snd_bcm2835_chmap_ctl_tlv(struct snd_kcontrol *kcontrol, int op_flag, - unsigned int size, unsigned int __user *tlv) - { -+ struct snd_pcm_chmap *info = snd_kcontrol_chip(kcontrol); -+ bcm2835_chip_t *chip = info->private_data; - unsigned int __user *dst; - int count = 0; - int i; -@@ -442,6 +449,9 @@ static int snd_bcm2835_chmap_ctl_tlv(struct snd_kcontrol *kcontrol, int op_flag, - int chs_bytes; - int c; - -+ if (i > 0 && uses_analogue(chip)) -+ break; ++static const struct of_device_id raspidac3_of_match[] = { ++ { .compatible = "jg,raspidacv3", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, raspidac3_of_match); + - for (c = 0; c < 8; c++) { - if (ch->speakers[c]) - num_chs++; -@@ -552,6 +562,8 @@ static int snd_bcm2835_chmap_ctl_put(struct snd_kcontrol *kcontrol, - int matches = 1; - int cur = 0; - int x; -+ if (i > 0 && uses_analogue(chip)) -+ break; - memset(remap, 0, sizeof(remap)); - for (x = 0; x < substream->runtime->channels; x++) { - int sp = ucontrol->value.integer.value[x]; - -From 2c967fa0f5b0d10c86c796098574ba09ffe66cd5 Mon Sep 17 00:00:00 2001 -From: wm4 <wm4@nowhere> -Date: Wed, 13 Jan 2016 19:44:47 +0100 -Subject: [PATCH 135/170] bcm2835: interpolate audio delay - -It appears the GPU only sends us a message all 10ms to update -the playback progress. Other than this, the playback position -(what SNDRV_PCM_IOCTL_DELAY will return) is not updated at all. -Userspace will see jitter up to 10ms in the audio position. - -Make this a bit nicer for userspace by interpolating the -position using the CPU clock. - -I'm not sure if setting snd_pcm_runtime.delay is the right -approach for this. Or if there is maybe an already existing -mechanism for position interpolation in the ALSA core. - -I only set SNDRV_PCM_INFO_BATCH because this appears to remove -at least one situation snd_pcm_runtime.delay is used, so I have -to worry less in which place I have to update this field, or -how it interacts with the rest of ALSA. - -In the future, it might be nice to use VC_AUDIO_MSG_TYPE_LATENCY. -One problem is that it requires sending a videocore message, and -waiting for a reply, which could make the implementation much -harder due to locking and synchronization requirements. ---- - sound/arm/bcm2835-pcm.c | 12 +++++++++++- - sound/arm/bcm2835.h | 1 + - 2 files changed, 12 insertions(+), 1 deletion(-) - -diff --git a/sound/arm/bcm2835-pcm.c b/sound/arm/bcm2835-pcm.c -index 48da3bb..f3a4c6d 100755 ---- a/sound/arm/bcm2835-pcm.c -+++ b/sound/arm/bcm2835-pcm.c -@@ -25,7 +25,7 @@ - /* hardware definition */ - static struct snd_pcm_hardware snd_bcm2835_playback_hw = { - .info = (SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | -- SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID), -+ SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID | SNDRV_PCM_INFO_BATCH), - .formats = SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE, - .rates = SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_8000_48000, - .rate_min = 8000, -@@ -99,6 +99,8 @@ static irqreturn_t bcm2835_playback_fifo_irq(int irq, void *dev_id) - alsa_stream->pos %= alsa_stream->buffer_size; - } - -+ alsa_stream->interpolate_start = ktime_get_ns(); ++/* sound card platform driver */ ++static struct platform_driver snd_rpi_raspidac3_driver = { ++ .driver = { ++ .name = "snd-rpi-raspidac3", ++ .owner = THIS_MODULE, ++ .of_match_table = raspidac3_of_match, ++ }, ++ .probe = snd_rpi_raspidac3_probe, ++ .remove = snd_rpi_raspidac3_remove, ++}; + - if (alsa_stream->substream) { - if (new_period) - snd_pcm_period_elapsed(alsa_stream->substream); -@@ -399,6 +401,7 @@ static int snd_bcm2835_pcm_prepare(struct snd_pcm_substream *substream) - alsa_stream->buffer_size = snd_pcm_lib_buffer_bytes(substream); - alsa_stream->period_size = snd_pcm_lib_period_bytes(substream); - alsa_stream->pos = 0; -+ alsa_stream->interpolate_start = ktime_get_ns(); - - audio_debug("buffer_size=%d, period_size=%d pos=%d frame_bits=%d\n", - alsa_stream->buffer_size, alsa_stream->period_size, -@@ -495,6 +498,7 @@ snd_bcm2835_pcm_pointer(struct snd_pcm_substream *substream) - { - struct snd_pcm_runtime *runtime = substream->runtime; - bcm2835_alsa_stream_t *alsa_stream = runtime->private_data; -+ u64 now = ktime_get_ns(); - - audio_info(" .. IN\n"); - -@@ -503,6 +507,12 @@ snd_bcm2835_pcm_pointer(struct snd_pcm_substream *substream) - frames_to_bytes(runtime, runtime->control->appl_ptr), - alsa_stream->pos); - -+ /* Give userspace better delay reporting by interpolating between GPU -+ * notifications, assuming audio speed is close enough to the clock -+ * used for ktime */ -+ if (alsa_stream->interpolate_start && alsa_stream->interpolate_start < now) -+ runtime->delay = -(int)div_u64((now - alsa_stream->interpolate_start) * runtime->rate, 1000000000); ++module_platform_driver(snd_rpi_raspidac3_driver); + - audio_info(" .. OUT\n"); - return snd_pcm_indirect_playback_pointer(substream, - &alsa_stream->pcm_indirect, -diff --git a/sound/arm/bcm2835.h b/sound/arm/bcm2835.h -index 997fb69..20ef108 100755 ---- a/sound/arm/bcm2835.h -+++ b/sound/arm/bcm2835.h -@@ -137,6 +137,7 @@ typedef struct bcm2835_alsa_stream { - unsigned int pos; - unsigned int buffer_size; - unsigned int period_size; -+ u64 interpolate_start; - - uint32_t enable_fifo_irq; - irq_handler_t fifo_irq_handler; ++MODULE_AUTHOR("Jan Grulich <jan@grulich.eu>"); ++MODULE_DESCRIPTION("ASoC Driver for RaspiDAC Rev.3x"); ++MODULE_LICENSE("GPL v2"); -From 205e27a7f94a5531764cc517ce43623361ca466c Mon Sep 17 00:00:00 2001 -From: Phil Elwell <phil@raspberrypi.org> -Date: Tue, 19 Jan 2016 17:16:38 +0000 -Subject: [PATCH 136/170] bcm2835-sdhost: Add workaround for odd behaviour on - some cards +From 5d9f6033f4aa5a9c0430dfec7dae4ff5b5fb1d60 Mon Sep 17 00:00:00 2001 +From: Jan Grulich <jan@grulich.eu> +Date: Mon, 24 Aug 2015 16:02:34 +0100 +Subject: [PATCH 083/112] tpa6130a2: Add headphone switch control -For reasons not understood, the sdhost driver fails when reading -sectors very near the end of some SD cards. The problem could -be related to the similar issue that reading the final sector -of any card as part of a multiple read never completes, and the -workaround is an extension of the mechanism introduced to solve -that problem which ensures those sectors are always read singly. +Signed-off-by: Jan Grulich <jan@grulich.eu> --- - drivers/mmc/host/bcm2835-sdhost.c | 61 +++++++++++++++++++++++++++++++++------ - 1 file changed, 52 insertions(+), 9 deletions(-) + sound/soc/codecs/tpa6130a2.c | 29 ++++++++++++++++++++++++++--- + 1 file changed, 26 insertions(+), 3 deletions(-) -diff --git a/drivers/mmc/host/bcm2835-sdhost.c b/drivers/mmc/host/bcm2835-sdhost.c -index da089985..309633c 100644 ---- a/drivers/mmc/host/bcm2835-sdhost.c -+++ b/drivers/mmc/host/bcm2835-sdhost.c -@@ -173,6 +173,9 @@ struct bcm2835_host { - u32 overclock_50; /* frequency to use when 50MHz is requested (in MHz) */ - u32 overclock; /* Current frequency if overclocked, else zero */ - u32 pio_limit; /* Maximum block count for PIO (0 = always DMA) */ -+ -+ u32 sectors; /* Cached card size in sectors */ -+ u32 single_read_sectors[8]; +diff --git a/sound/soc/codecs/tpa6130a2.c b/sound/soc/codecs/tpa6130a2.c +index 11d85c5..3caaa17 100644 +--- a/sound/soc/codecs/tpa6130a2.c ++++ b/sound/soc/codecs/tpa6130a2.c +@@ -4,6 +4,7 @@ + * Copyright (C) Nokia Corporation + * + * Author: Peter Ujfalusi <peter.ujfalusi@ti.com> ++ * Modified: Jan Grulich <jan@grulich.eu> + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License +@@ -52,6 +53,8 @@ struct tpa6130a2_data { + enum tpa_model id; }; - -@@ -277,6 +280,9 @@ static void bcm2835_sdhost_reset_internal(struct bcm2835_host *host) - { - u32 temp; - -+ if (host->debug) -+ pr_info("%s: reset\n", mmc_hostname(host->mmc)); ++static void tpa6130a2_channel_enable(u8 channel, int enable); + - bcm2835_sdhost_set_power(host, false); - - bcm2835_sdhost_write(host, 0, SDCMD); -@@ -299,6 +305,8 @@ static void bcm2835_sdhost_reset_internal(struct bcm2835_host *host) - bcm2835_sdhost_set_power(host, true); - mdelay(10); - host->clock = 0; -+ host->sectors = 0; -+ host->single_read_sectors[0] = ~0; - bcm2835_sdhost_write(host, host->hcfg, SDHCFG); - bcm2835_sdhost_write(host, host->cdiv, SDCDIV); - mmiowb(); -@@ -309,8 +317,6 @@ static void bcm2835_sdhost_reset(struct mmc_host *mmc) + static int tpa6130a2_i2c_read(int reg) { - struct bcm2835_host *host = mmc_priv(mmc); - unsigned long flags; -- if (host->debug) -- pr_info("%s: reset\n", mmc_hostname(mmc)); - spin_lock_irqsave(&host->lock, flags); - - bcm2835_sdhost_reset_internal(host); -@@ -676,6 +682,32 @@ static void bcm2835_sdhost_prepare_data(struct bcm2835_host *host, struct mmc_co - host->flush_fifo = 0; - host->data->bytes_xfered = 0; - -+ if (!host->sectors && host->mmc->card) -+ { -+ struct mmc_card *card = host->mmc->card; -+ if (!mmc_card_sd(card) && mmc_card_blockaddr(card)) { -+ /* -+ * The EXT_CSD sector count is in number of 512 byte -+ * sectors. -+ */ -+ host->sectors = card->ext_csd.sectors; -+ pr_err("%s: using ext_csd!\n", mmc_hostname(host->mmc)); -+ } else { -+ /* -+ * The CSD capacity field is in units of read_blkbits. -+ * set_capacity takes units of 512 bytes. -+ */ -+ host->sectors = card->csd.capacity << -+ (card->csd.read_blkbits - 9); -+ } -+ host->single_read_sectors[0] = host->sectors - 65; -+ host->single_read_sectors[1] = host->sectors - 64; -+ host->single_read_sectors[2] = host->sectors - 33; -+ host->single_read_sectors[3] = host->sectors - 32; -+ host->single_read_sectors[4] = host->sectors - 1; -+ host->single_read_sectors[5] = ~0; /* Safety net */ -+ } -+ - host->use_dma = host->have_dma && (data->blocks > host->pio_limit); - if (!host->use_dma) { - int flags; -@@ -1246,6 +1278,10 @@ static u32 bcm2835_sdhost_block_irq(struct bcm2835_host *host, u32 intmask) - - bcm2835_sdhost_finish_data(host); - } else { -+ /* Reset the timer */ -+ mod_timer(&host->pio_timer, -+ jiffies + host->pio_timeout); -+ - bcm2835_sdhost_transfer_pio(host); - - /* Reset the timer */ -@@ -1450,8 +1486,8 @@ void bcm2835_sdhost_set_clock(struct bcm2835_host *host, unsigned int clock) - host->cdiv = div; - bcm2835_sdhost_write(host, host->cdiv, SDCDIV); - -- /* Set the timeout to 500ms */ -- bcm2835_sdhost_write(host, host->mmc->actual_clock/2, SDTOUT); -+ /* Set the timeout to 250ms */ -+ bcm2835_sdhost_write(host, host->mmc->actual_clock/4, SDTOUT); - - if (host->debug) - pr_info("%s: clock=%d -> max_clk=%d, cdiv=%x (actual clock %d)\n", -@@ -1566,13 +1602,20 @@ static int bcm2835_sdhost_multi_io_quirk(struct mmc_card *card, - reading the final sector of the card as part of a multiple read - problematic. Detect that case and shorten the read accordingly. - */ -- /* csd.capacity is in weird units - convert to sectors */ -- u32 card_sectors = (card->csd.capacity << (card->csd.read_blkbits - 9)); -+ struct bcm2835_host *host; -+ -+ host = mmc_priv(card->host); - -- if ((direction == MMC_DATA_READ) && -- ((blk_pos + blk_size) == card_sectors)) -- blk_size--; -+ if (direction == MMC_DATA_READ) -+ { -+ int i; -+ int sector; -+ for (i = 0; blk_pos > (sector = host->single_read_sectors[i]); i++) -+ continue; - -+ if ((blk_pos + blk_size) > sector) -+ blk_size = (blk_pos == sector) ? 1 : (sector - blk_pos); -+ } - return blk_size; + struct tpa6130a2_data *data; +@@ -189,7 +192,7 @@ exit: } - -From c5d24cba808118647d01a1869cf1c46d0658d78b Mon Sep 17 00:00:00 2001 -From: Phil Elwell <phil@raspberrypi.org> -Date: Fri, 22 Jan 2016 16:03:24 +0000 -Subject: [PATCH 137/170] bcm2835-sdhost: Add debug_flags dtparam - -Bit zero disables the single-read-sectors map: - -If the default MMC driver is bcm2835-mmc: - dtoverlay=sdhost,debug_flags=1 -If the default MMC driver is bcm2835-sdhost: - dtoverlay=sdtweak,debug_flags=1 -(although the sdhost overlay may also work, sdtweak is -less invasive and will work in more circumstances). - -Also revert the timeout change, just in case. ---- - arch/arm/boot/dts/overlays/sdhost-overlay.dts | 2 ++ - arch/arm/boot/dts/overlays/sdtweak-overlay.dts | 2 ++ - drivers/mmc/host/bcm2835-sdhost.c | 26 +++++++++++++++++++++----- - 3 files changed, 25 insertions(+), 5 deletions(-) - -diff --git a/arch/arm/boot/dts/overlays/sdhost-overlay.dts b/arch/arm/boot/dts/overlays/sdhost-overlay.dts -index 85f0725..dbe6574 100644 ---- a/arch/arm/boot/dts/overlays/sdhost-overlay.dts -+++ b/arch/arm/boot/dts/overlays/sdhost-overlay.dts -@@ -16,6 +16,7 @@ - frag1: __overlay__ { - brcm,overclock-50 = <0>; - brcm,pio-limit = <1>; -+ brcm,debug-flags = <0>; - status = "okay"; - }; - }; -@@ -25,5 +26,6 @@ - force_pio = <&frag1>,"brcm,force-pio?"; - pio_limit = <&frag1>,"brcm,pio-limit:0"; - debug = <&frag1>,"brcm,debug?"; -+ debug_flags = <&frag1>,"brcm,debug-flags:0"; - }; - }; -diff --git a/arch/arm/boot/dts/overlays/sdtweak-overlay.dts b/arch/arm/boot/dts/overlays/sdtweak-overlay.dts -index 74c168d..b0b208c 100644 ---- a/arch/arm/boot/dts/overlays/sdtweak-overlay.dts -+++ b/arch/arm/boot/dts/overlays/sdtweak-overlay.dts -@@ -9,6 +9,7 @@ - frag1: __overlay__ { - brcm,overclock-50 = <0>; - brcm,pio-limit = <1>; -+ brcm,debug-flags = <0>; - }; - }; + static int tpa6130a2_get_volsw(struct snd_kcontrol *kcontrol, +- struct snd_ctl_elem_value *ucontrol) ++ struct snd_ctl_elem_value *ucontrol) + { + struct soc_mixer_control *mc = + (struct soc_mixer_control *)kcontrol->private_value; +@@ -218,7 +221,7 @@ static int tpa6130a2_get_volsw(struct snd_kcontrol *kcontrol, + } -@@ -17,5 +18,6 @@ - force_pio = <&frag1>,"brcm,force-pio?"; - pio_limit = <&frag1>,"brcm,pio-limit:0"; - debug = <&frag1>,"brcm,debug?"; -+ debug_flags = <&frag1>,"brcm,debug-flags:0"; - }; - }; -diff --git a/drivers/mmc/host/bcm2835-sdhost.c b/drivers/mmc/host/bcm2835-sdhost.c -index 309633c..ef9b1e6 100644 ---- a/drivers/mmc/host/bcm2835-sdhost.c -+++ b/drivers/mmc/host/bcm2835-sdhost.c -@@ -174,6 +174,8 @@ struct bcm2835_host { - u32 overclock; /* Current frequency if overclocked, else zero */ - u32 pio_limit; /* Maximum block count for PIO (0 = always DMA) */ + static int tpa6130a2_put_volsw(struct snd_kcontrol *kcontrol, +- struct snd_ctl_elem_value *ucontrol) ++ struct snd_ctl_elem_value *ucontrol) + { + struct soc_mixer_control *mc = + (struct soc_mixer_control *)kcontrol->private_value; +@@ -255,8 +258,22 @@ static int tpa6130a2_put_volsw(struct snd_kcontrol *kcontrol, + return 1; + } -+ u32 debug_flags; ++static int tpa6130a2_put_hp_sw(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol) ++{ ++ int enable = ucontrol->value.integer.value[0]; ++ unsigned int state; + - u32 sectors; /* Cached card size in sectors */ - u32 single_read_sectors[8]; - }; -@@ -682,7 +684,7 @@ static void bcm2835_sdhost_prepare_data(struct bcm2835_host *host, struct mmc_co - host->flush_fifo = 0; - host->data->bytes_xfered = 0; - -- if (!host->sectors && host->mmc->card) -+ if (!host->sectors && host->mmc->card && !(host->debug_flags & 1)) - { - struct mmc_card *card = host->mmc->card; - if (!mmc_card_sd(card) && mmc_card_blockaddr(card)) { -@@ -1486,8 +1488,8 @@ void bcm2835_sdhost_set_clock(struct bcm2835_host *host, unsigned int clock) - host->cdiv = div; - bcm2835_sdhost_write(host, host->cdiv, SDCDIV); - -- /* Set the timeout to 250ms */ -- bcm2835_sdhost_write(host, host->mmc->actual_clock/4, SDTOUT); -+ /* Set the timeout to 500ms */ -+ bcm2835_sdhost_write(host, host->mmc->actual_clock/2, SDTOUT); - - if (host->debug) - pr_info("%s: clock=%d -> max_clk=%d, cdiv=%x (actual clock %d)\n", -@@ -1606,8 +1608,16 @@ static int bcm2835_sdhost_multi_io_quirk(struct mmc_card *card, - - host = mmc_priv(card->host); - -- if (direction == MMC_DATA_READ) -- { -+ if (!host->sectors) { -+ /* csd.capacity is in weird units - convert to sectors */ -+ u32 card_sectors = (card->csd.capacity << (card->csd.read_blkbits - 9)); -+ if ((direction == MMC_DATA_READ) && -+ ((blk_pos + blk_size) == card_sectors)) -+ blk_size--; -+ return blk_size; -+ } -+ -+ if (direction == MMC_DATA_READ) { - int i; - int sector; - for (i = 0; blk_pos > (sector = host->single_read_sectors[i]); i++) -@@ -1838,8 +1848,14 @@ static int bcm2835_sdhost_probe(struct platform_device *pdev) - host->allow_dma = ALLOW_DMA && - !of_property_read_bool(node, "brcm,force-pio"); - host->debug = of_property_read_bool(node, "brcm,debug"); -+ of_property_read_u32(node, -+ "brcm,debug-flags", -+ &host->debug_flags); - } - -+ if (host->debug_flags) -+ dev_err(dev, "debug_flags=%x\n", host->debug_flags); ++ state = (tpa6130a2_read(TPA6130A2_REG_VOL_MUTE) & 0x80) == 0; ++ if (state == enable) ++ return 0; /* No change */ + - if (host->allow_dma) { - if (node) { - host->dma_chan_tx = - -From 1a451a35b70fa9ed32f23a4ba925e5b2c2c3af78 Mon Sep 17 00:00:00 2001 -From: Phil Elwell <phil@raspberrypi.org> -Date: Mon, 25 Jan 2016 09:12:06 +0000 -Subject: [PATCH 138/170] BCM270X_DT: Add sdio_overclock parameter to sdio - overlay - -The sdio_overclock parameter is like the overclock_50 parameter, i.e. -it sets an alternate frequency (in MHz) to use when the MMC framework -requests 50MHz, except that it applies to the SDIO bus. - -Be aware that the actual frequencies achievable are limited to even integer -divisions of 250MHz, and that the driver will round up to include fractions -(e.g. 62 will include 62.5) but then round down to the nearest frequency. -In other words, the chosen frequency is the highest possible that is less than -the parameter value + 1. In practise this means that 62 is the only sensible -value. - -Examples: - 250MHz/4 = 62.5MHz (sdio_overclock=62) - 250MHz/2 = 125MHz (sdio_overclock=125) # Too fast ---- - arch/arm/boot/dts/overlays/README | 9 ++++++--- - arch/arm/boot/dts/overlays/sdio-overlay.dts | 2 ++ - 2 files changed, 8 insertions(+), 3 deletions(-) - -diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README -index 34a1b7f..709d3e4 100644 ---- a/arch/arm/boot/dts/overlays/README -+++ b/arch/arm/boot/dts/overlays/README -@@ -53,8 +53,8 @@ have its contents deleted (or commented out). - Using Overlays - ============== ++ tpa6130a2_channel_enable(TPA6130A2_HP_EN_R | TPA6130A2_HP_EN_L, enable); ++ return 1; /* Changed */ ++} ++ + /* +- * TPA6130 volume. From -59.5 to 4 dB with increasing step size when going ++ * TPA6130 volume. From -59.5 to +4.0 dB with increasing step size when going + * down in gain. + */ + static const DECLARE_TLV_DB_RANGE(tpa6130_tlv, +@@ -277,6 +294,9 @@ static const struct snd_kcontrol_new tpa6130a2_controls[] = { + TPA6130A2_REG_VOL_MUTE, 0, 0x3f, 0, + tpa6130a2_get_volsw, tpa6130a2_put_volsw, + tpa6130_tlv), ++ SOC_SINGLE_EXT("TPA6130A2 Headphone Playback Switch", ++ TPA6130A2_REG_VOL_MUTE, 7, 1, 1, ++ tpa6130a2_get_volsw, tpa6130a2_put_hp_sw), + }; --Overlays are loaded using the "dtoverlay" directive. As an example, consider the --popular lirc-rpi module, the Linux Infrared Remote Control driver. In the -+Overlays are loaded using the "dtoverlay" directive. As an example, consider -+the popular lirc-rpi module, the Linux Infrared Remote Control driver. In the - pre-DT world this would be loaded from /etc/modules, with an explicit - "modprobe lirc-rpi" command, or programmatically by lircd. With DT enabled, - this becomes a line in config.txt: -@@ -621,9 +621,12 @@ Name: sdio - Info: Selects the bcm2835-sdhost SD/MMC driver, optionally with overclock, - and enables SDIO via GPIOs 22-27. - Load: dtoverlay=sdio,<param>=<val> --Params: overclock_50 Clock (in MHz) to use when the MMC framework -+Params: overclock_50 SD Clock (in MHz) to use when the MMC framework - requests 50MHz - -+ sdio_overclock SDIO Clock (in MHz) to use when the MMC -+ framework requests 50MHz -+ - force_pio Disable DMA support (default off) - - pio_limit Number of blocks above which to use DMA -diff --git a/arch/arm/boot/dts/overlays/sdio-overlay.dts b/arch/arm/boot/dts/overlays/sdio-overlay.dts -index 7935e7a..398bd81 100644 ---- a/arch/arm/boot/dts/overlays/sdio-overlay.dts -+++ b/arch/arm/boot/dts/overlays/sdio-overlay.dts -@@ -12,6 +12,7 @@ - pinctrl-0 = <&sdio_pins>; - non-removable; - bus-width = <4>; -+ brcm,overclock-50 = <0>; - status = "okay"; - }; - }; -@@ -30,5 +31,6 @@ - __overrides__ { - poll_once = <&sdio_mmc>,"non-removable?"; - bus_width = <&sdio_mmc>,"bus-width:0"; -+ sdio_overclock = <&sdio_mmc>,"brcm,overclock-50:0"; - }; + static const DECLARE_TLV_DB_RANGE(tpa6140_tlv, +@@ -290,6 +310,9 @@ static const struct snd_kcontrol_new tpa6140a2_controls[] = { + TPA6130A2_REG_VOL_MUTE, 1, 0x1f, 0, + tpa6130a2_get_volsw, tpa6130a2_put_volsw, + tpa6140_tlv), ++ SOC_SINGLE_EXT("TPA6140A2 Headphone Playback Switch", ++ TPA6130A2_REG_VOL_MUTE, 7, 1, 1, ++ tpa6130a2_get_volsw, tpa6130a2_put_hp_sw), }; + + /* -From 49ff16d7af98e6191d6dd60ba75b711612e948ab Mon Sep 17 00:00:00 2001 -From: Michael Lange <linuxstuff@milaw.biz> -Date: Thu, 21 Jan 2016 18:10:16 +0100 -Subject: [PATCH 139/170] rtc: ds1307: add support for the DT property - 'wakeup-source' - -For RTC chips with no IRQ directly connected to the SoC, the RTC chip -can be forced as a wakeup source by stating that explicitly in -the device's .dts file using the "wakeup-source" boolean property. -This will guarantee the 'wakealarm' sysfs entry is available on the -device, if supported by the RTC. - -With these changes to the driver rtc-ds1307 and the necessary entries -in the .dts file, I get an working ds1337 RTC on the Witty Pi extension -board by UUGear for the Raspberry Pi. - -An example for the entry in the .dts file: - - rtc: ds1337@68 { - compatible = "dallas,ds1337"; - reg = <0x68>; - wakeup-source; +From 5859bcaed12501a27b5ac8adb573eccb739bbc7e Mon Sep 17 00:00:00 2001 +From: P33M <P33M@github.com> +Date: Wed, 21 Oct 2015 14:55:21 +0100 +Subject: [PATCH 084/112] rpi_display: add backlight driver and overlay -If the "wakeup-source" property is set, do not request an IRQ. -Set also UIE mode to unsupported, to get a working 'hwclock' binary. +Add a mailbox-driven backlight controller for the Raspberry Pi DSI +touchscreen display. Requires updated GPU firmware to recognise the +mailbox request. -Signed-off-by: Michael Lange <linuxstuff@milaw.biz> -Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com> +Signed-off-by: Gordon Hollingworth <gordon@raspberrypi.org> --- - drivers/rtc/rtc-ds1307.c | 29 +++++++++++++++++++++++++++-- - 1 file changed, 27 insertions(+), 2 deletions(-) + drivers/video/backlight/Kconfig | 6 ++ + drivers/video/backlight/Makefile | 1 + + drivers/video/backlight/rpi_backlight.c | 119 ++++++++++++++++++++++++++++++++ + 3 files changed, 126 insertions(+) + create mode 100644 drivers/video/backlight/rpi_backlight.c -diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c -index 1cb13fee..28ca4bf 100644 ---- a/drivers/rtc/rtc-ds1307.c -+++ b/drivers/rtc/rtc-ds1307.c -@@ -860,6 +860,7 @@ static int ds1307_probe(struct i2c_client *client, - struct chip_desc *chip = &chips[id->driver_data]; - struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent); - bool want_irq = false; -+ bool ds1307_can_wakeup_device = false; - unsigned char *buf; - struct ds1307_platform_data *pdata = dev_get_platdata(&client->dev); - irq_handler_t irq_handler = ds1307_irq; -@@ -907,6 +908,20 @@ static int ds1307_probe(struct i2c_client *client, - ds1307->write_block_data = ds1307_write_block_data; - } - -+#ifdef CONFIG_OF -+/* -+ * For devices with no IRQ directly connected to the SoC, the RTC chip -+ * can be forced as a wakeup source by stating that explicitly in -+ * the device's .dts file using the "wakeup-source" boolean property. -+ * If the "wakeup-source" property is set, don't request an IRQ. -+ * This will guarantee the 'wakealarm' sysfs entry is available on the device, -+ * if supported by the RTC. -+ */ -+ if (of_property_read_bool(client->dev.of_node, "wakeup-source")) { -+ ds1307_can_wakeup_device = true; -+ } -+#endif -+ - switch (ds1307->type) { - case ds_1337: - case ds_1339: -@@ -925,11 +940,13 @@ static int ds1307_probe(struct i2c_client *client, - ds1307->regs[0] &= ~DS1337_BIT_nEOSC; - - /* -- * Using IRQ? Disable the square wave and both alarms. -+ * Using IRQ or defined as wakeup-source? -+ * Disable the square wave and both alarms. - * For some variants, be sure alarms can trigger when we're - * running on Vbackup (BBSQI/BBSQW) - */ -- if (ds1307->client->irq > 0 && chip->alarm) { -+ if (chip->alarm && (ds1307->client->irq > 0 || -+ ds1307_can_wakeup_device)) { - ds1307->regs[0] |= DS1337_BIT_INTCN - | bbsqi_bitpos[ds1307->type]; - ds1307->regs[0] &= ~(DS1337_BIT_A2IE | DS1337_BIT_A1IE); -@@ -1144,6 +1161,14 @@ static int ds1307_probe(struct i2c_client *client, - return PTR_ERR(ds1307->rtc); - } +diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig +index 5ffa4b4..c3023ab 100644 +--- a/drivers/video/backlight/Kconfig ++++ b/drivers/video/backlight/Kconfig +@@ -265,6 +265,12 @@ config BACKLIGHT_PWM + If you have a LCD backlight adjustable by PWM, say Y to enable + this driver. -+ if (ds1307_can_wakeup_device) { -+ /* Disable request for an IRQ */ -+ want_irq = false; -+ dev_info(&client->dev, "'wakeup-source' is set, request for an IRQ is disabled!\n"); -+ /* We cannot support UIE mode if we do not have an IRQ line */ -+ ds1307->rtc->uie_unsupported = 1; -+ } ++config BACKLIGHT_RPI ++ tristate "Raspberry Pi display firmware driven backlight" ++ help ++ If you have the Raspberry Pi DSI touchscreen display, say Y to ++ enable the mailbox-controlled backlight driver. + - if (want_irq) { - err = devm_request_threaded_irq(&client->dev, - client->irq, NULL, irq_handler, - -From e382e888be3f59b0ba3645809ae686947313e0c1 Mon Sep 17 00:00:00 2001 -From: vitalogy <vitalogy_github@milaw.biz> -Date: Tue, 19 Jan 2016 07:02:02 +0100 -Subject: [PATCH 140/170] dt-overlay: add wittypi-overlay.dts - ---- - arch/arm/boot/dts/overlays/wittypi-overlay.dts | 44 ++++++++++++++++++++++++++ - 1 file changed, 44 insertions(+) - create mode 100644 arch/arm/boot/dts/overlays/wittypi-overlay.dts - -diff --git a/arch/arm/boot/dts/overlays/wittypi-overlay.dts b/arch/arm/boot/dts/overlays/wittypi-overlay.dts + config BACKLIGHT_DA903X + tristate "Backlight Driver for DA9030/DA9034 using WLED" + depends on PMIC_DA903X +diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile +index 16ec534..00eff87 100644 +--- a/drivers/video/backlight/Makefile ++++ b/drivers/video/backlight/Makefile +@@ -50,6 +50,7 @@ obj-$(CONFIG_BACKLIGHT_PANDORA) += pandora_bl.o + obj-$(CONFIG_BACKLIGHT_PCF50633) += pcf50633-backlight.o + obj-$(CONFIG_BACKLIGHT_PM8941_WLED) += pm8941-wled.o + obj-$(CONFIG_BACKLIGHT_PWM) += pwm_bl.o ++obj-$(CONFIG_BACKLIGHT_RPI) += rpi_backlight.o + obj-$(CONFIG_BACKLIGHT_SAHARA) += kb3886_bl.o + obj-$(CONFIG_BACKLIGHT_SKY81452) += sky81452-backlight.o + obj-$(CONFIG_BACKLIGHT_TOSA) += tosa_bl.o +diff --git a/drivers/video/backlight/rpi_backlight.c b/drivers/video/backlight/rpi_backlight.c new file mode 100644 -index 0000000..be5987d +index 0000000..14a0d9b --- /dev/null -+++ b/arch/arm/boot/dts/overlays/wittypi-overlay.dts -@@ -0,0 +1,44 @@ ++++ b/drivers/video/backlight/rpi_backlight.c +@@ -0,0 +1,119 @@ +/* -+ * Device Tree overlay for Witty Pi extension board by UUGear ++ * rpi_bl.c - Backlight controller through VPU + * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 as ++ * published by the Free Software Foundation. + */ + -+/dts-v1/; -+/plugin/; ++#include <linux/backlight.h> ++#include <linux/err.h> ++#include <linux/fb.h> ++#include <linux/gpio.h> ++#include <linux/init.h> ++#include <linux/kernel.h> ++#include <linux/module.h> ++#include <linux/of.h> ++#include <linux/of_gpio.h> ++#include <linux/platform_device.h> ++#include <linux/slab.h> ++#include <soc/bcm2835/raspberrypi-firmware.h> + -+/ { ++struct rpi_backlight { ++ struct device *dev; ++ struct device *fbdev; ++ struct rpi_firmware *fw; ++}; + -+ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; ++static int rpi_backlight_update_status(struct backlight_device *bl) ++{ ++ struct rpi_backlight *gbl = bl_get_data(bl); ++ int brightness = bl->props.brightness; ++ int ret; + -+ fragment@0 { -+ target = <&leds>; -+ __overlay__ { -+ compatible = "gpio-leds"; -+ wittypi_led: wittypi_led { -+ label = "wittypi_led"; -+ linux,default-trigger = "default-on"; -+ gpios = <&gpio 17 0>; -+ }; -+ }; -+ }; ++ if (bl->props.power != FB_BLANK_UNBLANK || ++ bl->props.fb_blank != FB_BLANK_UNBLANK || ++ bl->props.state & (BL_CORE_SUSPENDED | BL_CORE_FBBLANK)) ++ brightness = 0; + -+ fragment@1 { -+ target = <&i2c1>; -+ __overlay__ { -+ #address-cells = <1>; -+ #size-cells = <0>; ++ ret = rpi_firmware_property(gbl->fw, ++ RPI_FIRMWARE_FRAMEBUFFER_SET_BACKLIGHT, ++ &brightness, sizeof(brightness)); ++ if (ret) { ++ dev_err(gbl->dev, "Failed to set brightness\n"); ++ return ret; ++ } + -+ rtc: ds1337@68 { -+ compatible = "dallas,ds1337"; -+ reg = <0x68>; -+ wakeup-source; -+ }; -+ }; -+ }; ++ if (brightness < 0) { ++ dev_err(gbl->dev, "Backlight change failed\n"); ++ return -EAGAIN; ++ } + -+ __overrides__ { -+ led_gpio = <&wittypi_led>,"gpios:4"; -+ led_trigger = <&wittypi_led>,"linux,default-trigger"; -+ }; ++ return 0; ++} + ++static const struct backlight_ops rpi_backlight_ops = { ++ .options = BL_CORE_SUSPENDRESUME, ++ .update_status = rpi_backlight_update_status, +}; - -From 6dcfc3daab7c1c459b36261163b4e1dc15a6e965 Mon Sep 17 00:00:00 2001 -From: Phil Elwell <phil@raspberrypi.org> -Date: Wed, 3 Feb 2016 16:12:54 +0000 -Subject: [PATCH 141/170] BCM270X_DT: Disable DMA for bcm2835-sdhost on Pi2 - -This is an interim patch to verify that problems seen with -some cards can be worked around at the expense of an increased -CPU load by forcing PIO mode. - -Although this could have used the brcm,force-pio attribute, that -is a boolean (true if present, false if absent) and attributes -can't be deleted by overlays. Instead, make brcm,pio-limit -unfeasibly high instead to allow DMA to be re-enabled using the -pio_limit parameter of the sdhost or sdtweak overlays. ---- - arch/arm/boot/dts/bcm2709-rpi-2-b.dts | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/arch/arm/boot/dts/bcm2709-rpi-2-b.dts b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts -index 5206ba2..0b68db5 100644 ---- a/arch/arm/boot/dts/bcm2709-rpi-2-b.dts -+++ b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts -@@ -43,6 +43,7 @@ - pinctrl-names = "default"; - pinctrl-0 = <&sdhost_pins>; - bus-width = <4>; -+ brcm,pio-limit = <0x7fffffff>; - status = "okay"; - }; - - -From 7519a79f61a67792e238a118db58600fb5f60ec8 Mon Sep 17 00:00:00 2001 -From: Phil Elwell <phil@raspberrypi.org> -Date: Tue, 19 Jan 2016 16:28:05 +0000 -Subject: [PATCH 142/170] FIXUP i2c_bcm2708: Don't change module baudrate - parameter - -Overwriting the baudrate module parameter creates an apparent -forced baudrate for i2c busses after the first. Not only does this -override the baudrate from DT it also prevents the bus ID from -being initialised. - -Also fix whitespace errors. ---- - drivers/i2c/busses/i2c-bcm2708.c | 48 +++++++++++++++++++++------------------- - 1 file changed, 25 insertions(+), 23 deletions(-) - -diff --git a/drivers/i2c/busses/i2c-bcm2708.c b/drivers/i2c/busses/i2c-bcm2708.c -index b152639..c9b8e5c 100644 ---- a/drivers/i2c/busses/i2c-bcm2708.c -+++ b/drivers/i2c/busses/i2c-bcm2708.c -@@ -71,7 +71,6 @@ - - #define DRV_NAME "bcm2708_i2c" - --static unsigned int baudrate_default = CONFIG_I2C_BCM2708_BAUDRATE; - static unsigned int baudrate; - module_param(baudrate, uint, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP); - MODULE_PARM_DESC(baudrate, "The I2C baudrate"); -@@ -317,25 +316,28 @@ static int bcm2708_i2c_probe(struct platform_device *pdev) - struct i2c_adapter *adap; - unsigned long bus_hz; - u32 cdiv, clk_tout; -- -- if (!baudrate) { -- baudrate = baudrate_default; -- if (pdev->dev.of_node) { -- u32 bus_clk_rate; -- pdev->id = of_alias_get_id(pdev->dev.of_node, "i2c"); -- if (pdev->id < 0) { -- dev_err(&pdev->dev, "alias is missing\n"); -- return -EINVAL; -- } -- if (!of_property_read_u32(pdev->dev.of_node, -- "clock-frequency", &bus_clk_rate)) -- baudrate = bus_clk_rate; -- else -- dev_warn(&pdev->dev, -- "Could not read clock-frequency property\n"); -+ u32 baud; -+ -+ baud = CONFIG_I2C_BCM2708_BAUDRATE; + -+ if (pdev->dev.of_node) { -+ u32 bus_clk_rate; -+ pdev->id = of_alias_get_id(pdev->dev.of_node, "i2c"); -+ if (pdev->id < 0) { -+ dev_err(&pdev->dev, "alias is missing\n"); -+ return -EINVAL; - } -+ if (!of_property_read_u32(pdev->dev.of_node, -+ "clock-frequency", &bus_clk_rate)) -+ baud = bus_clk_rate; -+ else -+ dev_warn(&pdev->dev, -+ "Could not read clock-frequency property\n"); - } - -+ if (baudrate) -+ baud = baudrate; ++static int rpi_backlight_probe(struct platform_device *pdev) ++{ ++ struct backlight_properties props; ++ struct backlight_device *bl; ++ struct rpi_backlight *gbl; ++ struct device_node *fw_node; + - regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!regs) { - dev_err(&pdev->dev, "could not get IO memory\n"); -@@ -419,21 +421,21 @@ static int bcm2708_i2c_probe(struct platform_device *pdev) - } - - bus_hz = clk_get_rate(bi->clk); -- cdiv = bus_hz / baudrate; -+ cdiv = bus_hz / baud; - if (cdiv > 0xffff) { - cdiv = 0xffff; -- baudrate = bus_hz / cdiv; -+ baud = bus_hz / cdiv; - } -- -- clk_tout = 35/1000*baudrate; //35ms timeout as per SMBus specs. -- if (clk_tout > 0xffff) ++ gbl = devm_kzalloc(&pdev->dev, sizeof(*gbl), GFP_KERNEL); ++ if (gbl == NULL) ++ return -ENOMEM; + -+ clk_tout = 35/1000*baud; //35ms timeout as per SMBus specs. -+ if (clk_tout > 0xffff) - clk_tout = 0xffff; - - bi->cdiv = cdiv; - bi->clk_tout = clk_tout; - - dev_info(&pdev->dev, "BSC%d Controller at 0x%08lx (irq %d) (baudrate %d)\n", -- pdev->id, (unsigned long)regs->start, irq, baudrate); -+ pdev->id, (unsigned long)regs->start, irq, baud); - - return 0; - - -From f2d36d57d7e17b9f44ff914824df5b150eb9e3bd Mon Sep 17 00:00:00 2001 -From: Digital Dreamtime <clive.messer@digitaldreamtime.co.uk> -Date: Thu, 4 Feb 2016 14:14:44 +0000 -Subject: [PATCH 143/170] Allow up to 24dB digital gain to be applied when - using IQAudIO DAC+ - -24db_digital_gain DT param can be used to specify that PCM512x -codec "Digital" volume control should not be limited to 0dB gain, -and if specified will allow the full 24dB gain. ---- - arch/arm/boot/dts/overlays/README | 17 +++++++++++++++-- - .../boot/dts/overlays/iqaudio-dacplus-overlay.dts | 6 +++++- - sound/soc/bcm/iqaudio-dac.c | 20 ++++++++++++++------ - 3 files changed, 34 insertions(+), 9 deletions(-) - -diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README -index 709d3e4..3c8436e 100644 ---- a/arch/arm/boot/dts/overlays/README -+++ b/arch/arm/boot/dts/overlays/README -@@ -362,8 +362,21 @@ Params: <None> - - Name: iqaudio-dacplus - Info: Configures the IQaudio DAC+ audio card --Load: dtoverlay=iqaudio-dacplus --Params: <None> -+Load: dtoverlay=iqaudio-dacplus,<param>=<val> -+Params: 24db_digital_gain Allow gain to be applied via the PCM512x codec -+ Digital volume control. Enable with -+ "dtoverlay=iqaudio-dacplus,24db_digital_gain" -+ (The default behaviour is that the Digital -+ volume control is limited to a maximum of -+ 0dB. ie. it can attenuate but not provide -+ gain. For most users, this will be desired -+ as it will prevent clipping. By appending -+ the 24db_digital_gain parameter, the Digital -+ volume control will allow up to 24dB of -+ gain. If this parameter is enabled, it is the -+ responsibility of the user to ensure that -+ the Digital volume control is set to a value -+ that does not result in clipping/distortion!) - - - Name: lirc-rpi -diff --git a/arch/arm/boot/dts/overlays/iqaudio-dacplus-overlay.dts b/arch/arm/boot/dts/overlays/iqaudio-dacplus-overlay.dts -index 735d8ab..e0aaf8f 100644 ---- a/arch/arm/boot/dts/overlays/iqaudio-dacplus-overlay.dts -+++ b/arch/arm/boot/dts/overlays/iqaudio-dacplus-overlay.dts -@@ -7,7 +7,7 @@ - - fragment@0 { - target = <&sound>; -- __overlay__ { -+ frag0: __overlay__ { - compatible = "iqaudio,iqaudio-dac"; - i2s-controller = <&i2s>; - status = "okay"; -@@ -36,4 +36,8 @@ - }; - }; - }; ++ gbl->dev = &pdev->dev; + -+ __overrides__ { -+ 24db_digital_gain = <&frag0>,"iqaudio,24db_digital_gain?"; -+ }; - }; -diff --git a/sound/soc/bcm/iqaudio-dac.c b/sound/soc/bcm/iqaudio-dac.c -index 37038d4..124d7a9 100644 ---- a/sound/soc/bcm/iqaudio-dac.c -+++ b/sound/soc/bcm/iqaudio-dac.c -@@ -23,14 +23,19 @@ - #include <sound/soc.h> - #include <sound/jack.h> - -+static bool digital_gain_0db_limit = true; ++ fw_node = of_parse_phandle(pdev->dev.of_node, "firmware", 0); ++ if (!fw_node) { ++ dev_err(&pdev->dev, "Missing firmware node\n"); ++ return -ENOENT; ++ } + - static int snd_rpi_iqaudio_dac_init(struct snd_soc_pcm_runtime *rtd) - { -- int ret; -- struct snd_soc_card *card = rtd->card; -- -- ret = snd_soc_limit_volume(card, "Digital Playback Volume", 207); -- if (ret < 0) -- dev_warn(card->dev, "Failed to set volume limit: %d\n", ret); -+ if (digital_gain_0db_limit) -+ { -+ int ret; -+ struct snd_soc_card *card = rtd->card; ++ gbl->fw = rpi_firmware_get(fw_node); ++ if (!gbl->fw) ++ return -EPROBE_DEFER; + -+ ret = snd_soc_limit_volume(card, "Digital Playback Volume", 207); -+ if (ret < 0) -+ dev_warn(card->dev, "Failed to set volume limit: %d\n", ret); ++ memset(&props, 0, sizeof(props)); ++ props.type = BACKLIGHT_RAW; ++ props.max_brightness = 255; ++ bl = devm_backlight_device_register(&pdev->dev, dev_name(&pdev->dev), ++ &pdev->dev, gbl, &rpi_backlight_ops, ++ &props); ++ if (IS_ERR(bl)) { ++ dev_err(&pdev->dev, "failed to register backlight\n"); ++ return PTR_ERR(bl); + } - - return 0; - } -@@ -94,6 +99,9 @@ static int snd_rpi_iqaudio_dac_probe(struct platform_device *pdev) - dai->platform_name = NULL; - dai->platform_of_node = i2s_node; - } -+ -+ digital_gain_0db_limit = !of_property_read_bool(pdev->dev.of_node, -+ "iqaudio,24db_digital_gain"); - } - - ret = snd_soc_register_card(&snd_rpi_iqaudio_dac); - -From 8a189f18de820c6facd00ba2db97ba7c4a75156f Mon Sep 17 00:00:00 2001 -From: Digital Dreamtime <clive.messer@digitaldreamtime.co.uk> -Date: Thu, 4 Feb 2016 20:04:00 +0000 -Subject: [PATCH 144/170] Limit PCM512x "Digital" gain to 0dB by default with - HiFiBerry DAC+ - -24db_digital_gain DT param can be used to specify that PCM512x -codec "Digital" volume control should not be limited to 0dB gain, -and if specified will allow the full 24dB gain. ---- - arch/arm/boot/dts/overlays/README | 17 +++++++++++++++-- - .../arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts | 6 +++++- - sound/soc/bcm/hifiberry_dacplus.c | 14 ++++++++++++++ - 3 files changed, 34 insertions(+), 3 deletions(-) - -diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README -index 3c8436e..296184f 100644 ---- a/arch/arm/boot/dts/overlays/README -+++ b/arch/arm/boot/dts/overlays/README -@@ -273,8 +273,21 @@ Params: <None> - - Name: hifiberry-dacplus - Info: Configures the HifiBerry DAC+ audio card --Load: dtoverlay=hifiberry-dacplus --Params: <None> -+Load: dtoverlay=hifiberry-dacplus,<param>=<val> -+Params: 24db_digital_gain Allow gain to be applied via the PCM512x codec -+ Digital volume control. Enable with -+ "dtoverlay=hifiberry-dacplus,24db_digital_gain" -+ (The default behaviour is that the Digital -+ volume control is limited to a maximum of -+ 0dB. ie. it can attenuate but not provide -+ gain. For most users, this will be desired -+ as it will prevent clipping. By appending -+ the 24dB_digital_gain parameter, the Digital -+ volume control will allow up to 24dB of -+ gain. If this parameter is enabled, it is the -+ responsibility of the user to ensure that -+ the Digital volume control is set to a value -+ that does not result in clipping/distortion!) - - - Name: hifiberry-digi -diff --git a/arch/arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts b/arch/arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts -index f923a48..42a0194 100644 ---- a/arch/arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts -+++ b/arch/arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts -@@ -17,7 +17,7 @@ - - fragment@1 { - target = <&sound>; -- __overlay__ { -+ frag1: __overlay__ { - compatible = "hifiberry,hifiberry-dacplus"; - i2s-controller = <&i2s>; - status = "okay"; -@@ -47,4 +47,8 @@ - }; - }; - }; + -+ __overrides__ { -+ 24db_digital_gain = <&frag1>,"hifiberry,24db_digital_gain?"; -+ }; - }; -diff --git a/sound/soc/bcm/hifiberry_dacplus.c b/sound/soc/bcm/hifiberry_dacplus.c -index a6b651c..153dbcd 100644 ---- a/sound/soc/bcm/hifiberry_dacplus.c -+++ b/sound/soc/bcm/hifiberry_dacplus.c -@@ -48,6 +48,7 @@ struct pcm512x_priv { - #define CLK_48EN_RATE 24576000UL - - static bool snd_rpi_hifiberry_is_dacpro; -+static bool digital_gain_0db_limit = true; - - static void snd_rpi_hifiberry_dacplus_select_clk(struct snd_soc_codec *codec, - int clk_id) -@@ -167,6 +168,16 @@ static int snd_rpi_hifiberry_dacplus_init(struct snd_soc_pcm_runtime *rtd) - snd_soc_update_bits(codec, PCM512x_GPIO_OUTPUT_4, 0x0f, 0x02); - snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x08, 0x08); - -+ if (digital_gain_0db_limit) -+ { -+ int ret; -+ struct snd_soc_card *card = rtd->card; ++ bl->props.brightness = 255; ++ backlight_update_status(bl); + -+ ret = snd_soc_limit_volume(card, "Digital Playback Volume", 207); -+ if (ret < 0) -+ dev_warn(card->dev, "Failed to set volume limit: %d\n", ret); -+ } ++ platform_set_drvdata(pdev, bl); ++ return 0; ++} + - return 0; - } - -@@ -299,6 +310,9 @@ static int snd_rpi_hifiberry_dacplus_probe(struct platform_device *pdev) - dai->platform_name = NULL; - dai->platform_of_node = i2s_node; - } ++static const struct of_device_id rpi_backlight_of_match[] = { ++ { .compatible = "raspberrypi,rpi-backlight" }, ++ { /* sentinel */ } ++}; ++MODULE_DEVICE_TABLE(of, rpi_backlight_of_match); + -+ digital_gain_0db_limit = !of_property_read_bool( -+ pdev->dev.of_node, "hifiberry,24db_digital_gain"); - } - - ret = snd_soc_register_card(&snd_rpi_hifiberry_dacplus); - -From 14ba431031afa218c0db43a7c20fe54916f8d357 Mon Sep 17 00:00:00 2001 -From: Phil Elwell <phil@raspberrypi.org> -Date: Mon, 8 Feb 2016 09:46:33 +0000 -Subject: [PATCH 145/170] BCM270X_DT: Adjust overlay README formatting - ---- - arch/arm/boot/dts/overlays/README | 420 +++++++++++++++++++------------------- - 1 file changed, 210 insertions(+), 210 deletions(-) - -diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README -index 296184f..ec1ae91 100644 ---- a/arch/arm/boot/dts/overlays/README -+++ b/arch/arm/boot/dts/overlays/README -@@ -83,58 +83,58 @@ Name: <The base DTB> - Info: Configures the base Raspberry Pi hardware - Load: <loaded automatically> - Params: -- audio Set to "on" to enable the onboard ALSA audio -- interface (default "off") -+ audio Set to "on" to enable the onboard ALSA audio -+ interface (default "off") - -- i2c_arm Set to "on" to enable the ARM's i2c interface -- (default "off") -+ i2c_arm Set to "on" to enable the ARM's i2c interface -+ (default "off") - -- i2c_vc Set to "on" to enable the i2c interface -- usually reserved for the VideoCore processor -- (default "off") -+ i2c_vc Set to "on" to enable the i2c interface -+ usually reserved for the VideoCore processor -+ (default "off") - -- i2c An alias for i2c_arm -+ i2c An alias for i2c_arm - -- i2c_arm_baudrate Set the baudrate of the ARM's i2c interface -- (default "100000") -+ i2c_arm_baudrate Set the baudrate of the ARM's i2c interface -+ (default "100000") - -- i2c_vc_baudrate Set the baudrate of the VideoCore i2c interface -- (default "100000") -+ i2c_vc_baudrate Set the baudrate of the VideoCore i2c interface -+ (default "100000") - -- i2c_baudrate An alias for i2c_arm_baudrate -+ i2c_baudrate An alias for i2c_arm_baudrate - -- i2s Set to "on" to enable the i2s interface -- (default "off") -+ i2s Set to "on" to enable the i2s interface -+ (default "off") - -- spi Set to "on" to enable the spi interfaces -- (default "off") -+ spi Set to "on" to enable the spi interfaces -+ (default "off") - -- random Set to "on" to enable the hardware random -- number generator (default "on") -+ random Set to "on" to enable the hardware random -+ number generator (default "on") - -- uart0 Set to "off" to disable uart0 (default "on") -+ uart0 Set to "off" to disable uart0 (default "on") - -- watchdog Set to "on" to enable the hardware watchdog -- (default "off") -+ watchdog Set to "on" to enable the hardware watchdog -+ (default "off") - -- act_led_trigger Choose which activity the LED tracks. -- Use "heartbeat" for a nice load indicator. -- (default "mmc") -+ act_led_trigger Choose which activity the LED tracks. -+ Use "heartbeat" for a nice load indicator. -+ (default "mmc") - -- act_led_activelow Set to "on" to invert the sense of the LED -- (default "off") -+ act_led_activelow Set to "on" to invert the sense of the LED -+ (default "off") - -- act_led_gpio Set which GPIO to use for the activity LED -- (in case you want to connect it to an external -- device) -- (default "16" on a non-Plus board, "47" on a -- Plus or Pi 2) -+ act_led_gpio Set which GPIO to use for the activity LED -+ (in case you want to connect it to an external -+ device) -+ (default "16" on a non-Plus board, "47" on a -+ Plus or Pi 2) - - pwr_led_trigger - pwr_led_activelow - pwr_led_gpio -- As for act_led_*, but using the PWR LED. -- Not available on Model A/B boards. -+ As for act_led_*, but using the PWR LED. -+ Not available on Model A/B boards. - - N.B. It is recommended to only enable those interfaces that are needed. - Leaving all interfaces enabled can lead to unwanted behaviour (i2c_vc -@@ -149,19 +149,19 @@ Params: - Name: ads7846 - Info: ADS7846 Touch controller - Load: dtoverlay=ads7846,<param>=<val> --Params: cs SPI bus Chip Select (default 1) -- speed SPI bus speed (default 2MHz, max 3.25MHz) -- penirq GPIO used for PENIRQ. REQUIRED -- penirq_pull Set GPIO pull (default 0=none, 2=pullup) -- swapxy Swap x and y axis -- xmin Minimum value on the X axis (default 0) -- ymin Minimum value on the Y axis (default 0) -- xmax Maximum value on the X axis (default 4095) -- ymax Maximum value on the Y axis (default 4095) -- pmin Minimum reported pressure value (default 0) -- pmax Maximum reported pressure value (default 65535) -- xohms Touchpanel sensitivity (X-plate resistance) -- (default 400) -+Params: cs SPI bus Chip Select (default 1) -+ speed SPI bus speed (default 2MHz, max 3.25MHz) -+ penirq GPIO used for PENIRQ. REQUIRED -+ penirq_pull Set GPIO pull (default 0=none, 2=pullup) -+ swapxy Swap x and y axis -+ xmin Minimum value on the X axis (default 0) -+ ymin Minimum value on the Y axis (default 0) -+ xmax Maximum value on the X axis (default 4095) -+ ymax Maximum value on the Y axis (default 4095) -+ pmin Minimum reported pressure value (default 0) -+ pmax Maximum reported pressure value (default 65535) -+ xohms Touchpanel sensitivity (X-plate resistance) -+ (default 400) - - penirq is required and usually xohms (60-100) has to be set as well. - Apart from that, pmax (255) and swapxy are also common. -@@ -175,12 +175,12 @@ Name: at86rf233 - Info: Configures the Atmel AT86RF233 802.15.4 low-power WPAN transceiver, - connected to spi0.0 - Load: dtoverlay=at86rf233,<param>=<val> --Params: interrupt GPIO used for INT (default 23) -- reset GPIO used for Reset (default 24) -- sleep GPIO used for Sleep (default 25) -- speed SPI bus speed in Hz (default 6000000) -- trim Fine tuning of the internal capacitance -- arrays (0=+0pF, 15=+4.5pF, default 15) -+Params: interrupt GPIO used for INT (default 23) -+ reset GPIO used for Reset (default 24) -+ sleep GPIO used for Sleep (default 25) -+ speed SPI bus speed in Hz (default 6000000) -+ trim Fine tuning of the internal capacitance -+ arrays (0=+0pF, 15=+4.5pF, default 15) - - - Name: bmp085_i2c-sensor -@@ -194,8 +194,8 @@ Name: dht11 - Info: Overlay for the DHT11/DHT21/DHT22 humidity/temperature sensors - Also sometimes found with the part number(s) AM230x. - Load: dtoverlay=dht11,<param>=<val> --Params: gpiopin GPIO connected to the sensor's DATA output. -- (default 4) -+Params: gpiopin GPIO connected to the sensor's DATA output. -+ (default 4) - - - Name: dwc-otg -@@ -208,15 +208,15 @@ Params: <None> - Name: dwc2 - Info: Selects the dwc2 USB controller driver - Load: dtoverlay=dwc2,<param>=<val> --Params: dr_mode Dual role mode: "host", "peripheral" or "otg" -+Params: dr_mode Dual role mode: "host", "peripheral" or "otg" - -- g-rx-fifo-size Size of rx fifo size in gadget mode -+ g-rx-fifo-size Size of rx fifo size in gadget mode - -- g-np-tx-fifo-size Size of non-periodic tx fifo size in gadget -- mode -+ g-np-tx-fifo-size Size of non-periodic tx fifo size in gadget -+ mode - -- g-tx-fifo-size Size of periodic tx fifo per endpoint -- (except ep0) in gadget mode -+ g-tx-fifo-size Size of periodic tx fifo per endpoint -+ (except ep0) in gadget mode - - - [ The ds1307-rtc overlay has been deleted. See i2c-rtc. ] -@@ -225,9 +225,9 @@ Params: dr_mode Dual role mode: "host", "peripheral" or "otg" - Name: enc28j60 - Info: Overlay for the Microchip ENC28J60 Ethernet Controller (SPI) - Load: dtoverlay=enc28j60,<param>=<val> --Params: int_pin GPIO used for INT (default 25) -+Params: int_pin GPIO used for INT (default 25) - -- speed SPI bus speed (default 12000000) -+ speed SPI bus speed (default 12000000) - - - Name: gpio-ir -@@ -237,26 +237,26 @@ Info: Use GPIO pin as rc-core style infrared receiver input. The rc-core- - not required! The key mapping and other decoding parameters can be - configured by "ir-keytable" tool. - Load: dtoverlay=gpio-ir,<param>=<val> --Params: gpio_pin Input pin number. Default is 18. -+Params: gpio_pin Input pin number. Default is 18. - -- gpio_pull Desired pull-up/down state (off, down, up) -- Default is "down". -+ gpio_pull Desired pull-up/down state (off, down, up) -+ Default is "down". - -- rc-map-name Default rc keymap (can also be changed by -- ir-keytable), defaults to "rc-rc6-mce" -+ rc-map-name Default rc keymap (can also be changed by -+ ir-keytable), defaults to "rc-rc6-mce" - - - Name: gpio-poweroff - Info: Drives a GPIO high or low on reboot - Load: dtoverlay=gpio-poweroff,<param>=<val> --Params: gpiopin GPIO for signalling (default 26) -+Params: gpiopin GPIO for signalling (default 26) - -- active_low Set if the power control device requires a -- high->low transition to trigger a power-down. -- Note that this will require the support of a -- custom dt-blob.bin to prevent a power-down -- during the boot process, and that a reboot -- will also cause the pin to go low. -+ active_low Set if the power control device requires a -+ high->low transition to trigger a power-down. -+ Note that this will require the support of a -+ custom dt-blob.bin to prevent a power-down -+ during the boot process, and that a reboot -+ will also cause the pin to go low. - - - Name: hifiberry-amp -@@ -300,65 +300,65 @@ Name: hy28a - Info: HY28A - 2.8" TFT LCD Display Module by HAOYU Electronics - Default values match Texy's display shield - Load: dtoverlay=hy28a,<param>=<val> --Params: speed Display SPI bus speed -+Params: speed Display SPI bus speed - -- rotate Display rotation {0,90,180,270} -+ rotate Display rotation {0,90,180,270} - -- fps Delay between frame updates -+ fps Delay between frame updates - -- debug Debug output level {0-7} -+ debug Debug output level {0-7} - -- xohms Touchpanel sensitivity (X-plate resistance) -+ xohms Touchpanel sensitivity (X-plate resistance) - -- resetgpio GPIO used to reset controller -+ resetgpio GPIO used to reset controller - -- ledgpio GPIO used to control backlight -+ ledgpio GPIO used to control backlight - - - Name: hy28b - Info: HY28B - 2.8" TFT LCD Display Module by HAOYU Electronics - Default values match Texy's display shield - Load: dtoverlay=hy28b,<param>=<val> --Params: speed Display SPI bus speed -+Params: speed Display SPI bus speed - -- rotate Display rotation {0,90,180,270} -+ rotate Display rotation {0,90,180,270} - -- fps Delay between frame updates -+ fps Delay between frame updates - -- debug Debug output level {0-7} -+ debug Debug output level {0-7} - -- xohms Touchpanel sensitivity (X-plate resistance) -+ xohms Touchpanel sensitivity (X-plate resistance) - -- resetgpio GPIO used to reset controller -+ resetgpio GPIO used to reset controller - -- ledgpio GPIO used to control backlight -+ ledgpio GPIO used to control backlight - - - Name: i2c-gpio - Info: Adds support for software i2c controller on gpio pins - Load: dtoverlay=i2c-gpio,<param>=<val> --Params: i2c_gpio_sda GPIO used for I2C data (default "23") -+Params: i2c_gpio_sda GPIO used for I2C data (default "23") - -- i2c_gpio_scl GPIO used for I2C clock (default "24") -+ i2c_gpio_scl GPIO used for I2C clock (default "24") - -- i2c_gpio_delay_us Clock delay in microseconds -- (default "2" = ~100kHz) -+ i2c_gpio_delay_us Clock delay in microseconds -+ (default "2" = ~100kHz) - - - Name: i2c-rtc - Info: Adds support for a number of I2C Real Time Clock devices - Load: dtoverlay=i2c-rtc,<param>=<val> --Params: ds1307 Select the DS1307 device -+Params: ds1307 Select the DS1307 device - -- ds3231 Select the DS3231 device -+ ds3231 Select the DS3231 device - -- mcp7941x Select the MCP7941x device -+ mcp7941x Select the MCP7941x device - -- pcf2127 Select the PCF2127 device -+ pcf2127 Select the PCF2127 device - -- pcf8523 Select the PCF8523 device -+ pcf8523 Select the PCF8523 device - -- pcf8563 Select the PCF8563 device -+ pcf8563 Select the PCF8563 device - - - Name: i2s-mmap -@@ -396,70 +396,70 @@ Name: lirc-rpi - Info: Configures lirc-rpi (Linux Infrared Remote Control for Raspberry Pi) - Consult the module documentation for more details. - Load: dtoverlay=lirc-rpi,<param>=<val> --Params: gpio_out_pin GPIO for output (default "17") -+Params: gpio_out_pin GPIO for output (default "17") - -- gpio_in_pin GPIO for input (default "18") -+ gpio_in_pin GPIO for input (default "18") - -- gpio_in_pull Pull up/down/off on the input pin -- (default "down") -+ gpio_in_pull Pull up/down/off on the input pin -+ (default "down") - -- sense Override the IR receive auto-detection logic: -- "0" = force active-high -- "1" = force active-low -- "-1" = use auto-detection -- (default "-1") -+ sense Override the IR receive auto-detection logic: -+ "0" = force active-high -+ "1" = force active-low -+ "-1" = use auto-detection -+ (default "-1") - -- softcarrier Turn the software carrier "on" or "off" -- (default "on") -+ softcarrier Turn the software carrier "on" or "off" -+ (default "on") - -- invert "on" = invert the output pin (default "off") -+ invert "on" = invert the output pin (default "off") - -- debug "on" = enable additional debug messages -- (default "off") -+ debug "on" = enable additional debug messages -+ (default "off") - - - Name: mcp2515-can0 - Info: Configures the MCP2515 CAN controller on spi0.0 - Load: dtoverlay=mcp2515-can0,<param>=<val> --Params: oscillator Clock frequency for the CAN controller (Hz) -+Params: oscillator Clock frequency for the CAN controller (Hz) - -- spimaxfrequency Maximum SPI frequence (Hz) -+ spimaxfrequency Maximum SPI frequence (Hz) - -- interrupt GPIO for interrupt signal -+ interrupt GPIO for interrupt signal - - - Name: mcp2515-can1 - Info: Configures the MCP2515 CAN controller on spi0.1 - Load: dtoverlay=mcp2515-can1,<param>=<val> --Params: oscillator Clock frequency for the CAN controller (Hz) -+Params: oscillator Clock frequency for the CAN controller (Hz) - -- spimaxfrequency Maximum SPI frequence (Hz) -+ spimaxfrequency Maximum SPI frequence (Hz) - -- interrupt GPIO for interrupt signal -+ interrupt GPIO for interrupt signal - - - Name: mmc - Info: Selects the bcm2835-mmc SD/MMC driver, optionally with overclock - Load: dtoverlay=mmc,<param>=<val> --Params: overclock_50 Clock (in MHz) to use when the MMC framework -- requests 50MHz -- force_pio Disable DMA support -+Params: overclock_50 Clock (in MHz) to use when the MMC framework -+ requests 50MHz -+ force_pio Disable DMA support - - - Name: mz61581 - Info: MZ61581 display by Tontec - Load: dtoverlay=mz61581,<param>=<val> --Params: speed Display SPI bus speed -+Params: speed Display SPI bus speed - -- rotate Display rotation {0,90,180,270} -+ rotate Display rotation {0,90,180,270} - -- fps Delay between frame updates -+ fps Delay between frame updates - -- txbuflen Transmit buffer length (default 32768) -+ txbuflen Transmit buffer length (default 32768) - -- debug Debug output level {0-7} -+ debug Debug output level {0-7} - -- xohms Touchpanel sensitivity (X-plate resistance) -+ xohms Touchpanel sensitivity (X-plate resistance) - - - [ The pcf2127-rtc overlay has been deleted. See i2c-rtc. ] -@@ -474,69 +474,69 @@ Params: speed Display SPI bus speed - Name: piscreen - Info: PiScreen display by OzzMaker.com - Load: dtoverlay=piscreen,<param>=<val> --Params: speed Display SPI bus speed -+Params: speed Display SPI bus speed - -- rotate Display rotation {0,90,180,270} -+ rotate Display rotation {0,90,180,270} - -- fps Delay between frame updates -+ fps Delay between frame updates - -- debug Debug output level {0-7} -+ debug Debug output level {0-7} - -- xohms Touchpanel sensitivity (X-plate resistance) -+ xohms Touchpanel sensitivity (X-plate resistance) - - - Name: piscreen2r - Info: PiScreen 2 with resistive TP display by OzzMaker.com - Load: dtoverlay=piscreen2r,<param>=<val> --Params: speed Display SPI bus speed -+Params: speed Display SPI bus speed - -- rotate Display rotation {0,90,180,270} -+ rotate Display rotation {0,90,180,270} - -- fps Delay between frame updates -+ fps Delay between frame updates - -- debug Debug output level {0-7} -+ debug Debug output level {0-7} - -- xohms Touchpanel sensitivity (X-plate resistance) -+ xohms Touchpanel sensitivity (X-plate resistance) - - - Name: pitft28-capacitive - Info: Adafruit PiTFT 2.8" capacitive touch screen - Load: dtoverlay=pitft28-capacitive,<param>=<val> --Params: speed Display SPI bus speed -+Params: speed Display SPI bus speed - -- rotate Display rotation {0,90,180,270} -+ rotate Display rotation {0,90,180,270} - -- fps Delay between frame updates -+ fps Delay between frame updates - -- debug Debug output level {0-7} -+ debug Debug output level {0-7} - -- touch-sizex Touchscreen size x (default 240) -+ touch-sizex Touchscreen size x (default 240) - -- touch-sizey Touchscreen size y (default 320) -+ touch-sizey Touchscreen size y (default 320) - -- touch-invx Touchscreen inverted x axis -+ touch-invx Touchscreen inverted x axis - -- touch-invy Touchscreen inverted y axis -+ touch-invy Touchscreen inverted y axis - -- touch-swapxy Touchscreen swapped x y axis -+ touch-swapxy Touchscreen swapped x y axis - - - Name: pitft28-resistive - Info: Adafruit PiTFT 2.8" resistive touch screen - Load: dtoverlay=pitft28-resistive,<param>=<val> --Params: speed Display SPI bus speed -+Params: speed Display SPI bus speed - -- rotate Display rotation {0,90,180,270} -+ rotate Display rotation {0,90,180,270} - -- fps Delay between frame updates -+ fps Delay between frame updates - -- debug Debug output level {0-7} -+ debug Debug output level {0-7} - - - Name: pps-gpio - Info: Configures the pps-gpio (pulse-per-second time signal via GPIO). - Load: dtoverlay=pps-gpio,<param>=<val> --Params: gpiopin Input GPIO (default "18") -+Params: gpiopin Input GPIO (default "18") - - - Name: pwm -@@ -550,12 +550,12 @@ Info: Configures a single PWM channel - Pins 12 and 13 might be better choices on an A+, B+ or Pi2. - 2) The onboard analogue audio output uses both PWM channels. - 3) So be careful mixing audio and PWM. -- 4) Currently the clock must have been enabled and configured -+ 4) Currently the clockmust have been enabled and configured - by other means. - Load: dtoverlay=pwm,<param>=<val> --Params: pin Output pin (default 18) - see table -- func Pin function (default 2 = Alt5) - see above -- clock PWM clock frequency (informational) -+Params: pin Output pin (default 18) - see table -+ func Pin function (default 2 = Alt5) - see above -+ clock PWM clock frequency (informational) - - - Name: pwm-2chan -@@ -569,14 +569,14 @@ Info: Configures both PWM channels - Pins 12 and 13 might be better choices on an A+, B+ or Pi2. - 2) The onboard analogue audio output uses both PWM channels. - 3) So be careful mixing audio and PWM. -- 4) Currently the clock must have been enabled and configured -+ 4) Currently the clockmust have been enabled and configured - by other means. - Load: dtoverlay=pwm-2chan,<param>=<val> --Params: pin Output pin (default 18) - see table -- pin2 Output pin for other channel (default 19) -- func Pin function (default 2 = Alt5) - see above -- func2 Function for pin2 (default 2 = Alt5) -- clock PWM clock frequency (informational) -+Params: pin Output pin (default 18) - see table -+ pin2 Output pin for other channel (default 19) -+ func Pin function (default 2 = Alt5) - see above -+ func2 Function for pin2 (default 2 = Alt5) -+ clock PWM clock frequency (informational) - - - Name: raspidac3 -@@ -600,15 +600,15 @@ Params: <None> - Name: rpi-display - Info: RPi-Display - 2.8" Touch Display by Watterott - Load: dtoverlay=rpi-display,<param>=<val> --Params: speed Display SPI bus speed -+Params: speed Display SPI bus speed - -- rotate Display rotation {0,90,180,270} -+ rotate Display rotation {0,90,180,270} - -- fps Delay between frame updates -+ fps Delay between frame updates - -- debug Debug output level {0-7} -+ debug Debug output level {0-7} - -- xohms Touchpanel sensitivity (X-plate resistance) -+ xohms Touchpanel sensitivity (X-plate resistance) - - - Name: rpi-ft5406 -@@ -632,52 +632,52 @@ Params: <None> - Name: sdhost - Info: Selects the bcm2835-sdhost SD/MMC driver, optionally with overclock - Load: dtoverlay=sdhost,<param>=<val> --Params: overclock_50 Clock (in MHz) to use when the MMC framework -- requests 50MHz -+Params: overclock_50 Clock (in MHz) to use when the MMC framework -+ requests 50MHz - -- force_pio Disable DMA support (default off) -+ force_pio Disable DMA support (default off) - -- pio_limit Number of blocks above which to use DMA -- (default 1) -+ pio_limit Number of blocks above which to use DMA -+ (default 1) - -- debug Enable debug output (default off) -+ debug Enable debug output (default off) - - - Name: sdio - Info: Selects the bcm2835-sdhost SD/MMC driver, optionally with overclock, - and enables SDIO via GPIOs 22-27. - Load: dtoverlay=sdio,<param>=<val> --Params: overclock_50 SD Clock (in MHz) to use when the MMC framework -- requests 50MHz -+Params: overclock_50 SD Clock (in MHz) to use when the MMC framework -+ requests 50MHz - -- sdio_overclock SDIO Clock (in MHz) to use when the MMC -- framework requests 50MHz -+ sdio_overclock SDIO Clock (in MHz) to use when the MMC -+ framework requests 50MHz - -- force_pio Disable DMA support (default off) -+ force_pio Disable DMA support (default off) - -- pio_limit Number of blocks above which to use DMA -- (default 1) -+ pio_limit Number of blocks above which to use DMA -+ (default 1) - -- debug Enable debug output (default off) -+ debug Enable debug output (default off) - -- poll_once Disable SDIO-device polling every second -- (default on: polling once at boot-time) -+ poll_once Disable SDIO-device polling every second -+ (default on: polling once at boot-time) - -- bus_width Set the SDIO host bus width (default 4 bits) -+ bus_width Set the SDIO host bus width (default 4 bits) - - - Name: sdtweak - Info: Tunes the bcm2835-sdhost SD/MMC driver - Load: dtoverlay=sdtweak,<param>=<val> --Params: overclock_50 Clock (in MHz) to use when the MMC framework -- requests 50MHz -+Params: overclock_50 Clock (in MHz) to use when the MMC framework -+ requests 50MHz - -- force_pio Disable DMA support (default off) -+ force_pio Disable DMA support (default off) - -- pio_limit Number of blocks above which to use DMA -- (default 1) -+ pio_limit Number of blocks above which to use DMA -+ (default 1) - -- debug Enable debug output (default off) -+ debug Enable debug output (default off) - - - Name: smi -@@ -708,25 +708,25 @@ Name: tinylcd35 - Info: 3.5" Color TFT Display by www.tinylcd.com - Options: Touch, RTC, keypad - Load: dtoverlay=tinylcd35,<param>=<val> --Params: speed Display SPI bus speed -+Params: speed Display SPI bus speed - -- rotate Display rotation {0,90,180,270} -+ rotate Display rotation {0,90,180,270} - -- fps Delay between frame updates -+ fps Delay between frame updates - -- debug Debug output level {0-7} -+ debug Debug output level {0-7} - -- touch Enable touch panel -+ touch Enable touch panel - -- touchgpio Touch controller IRQ GPIO -+ touchgpio Touch controller IRQ GPIO - -- xohms Touchpanel: Resistance of X-plate in ohms -+ xohms Touchpanel: Resistance of X-plate in ohms - -- rtc-pcf PCF8563 Real Time Clock -+ rtc-pcf PCF8563 Real Time Clock - -- rtc-ds DS1307 Real Time Clock -+ rtc-ds DS1307 Real Time Clock - -- keypad Enable keypad -+ keypad Enable keypad - - Examples: - Display with touchpanel, PCF8563 RTC and keypad: -@@ -738,9 +738,9 @@ Params: speed Display SPI bus speed - Name: uart1 - Info: Enable uart1 in place of uart0 - Load: dtoverlay=uart1,<param>=<val> --Params: txd1_pin GPIO pin for TXD1 (14, 32 or 40 - default 14) -+Params: txd1_pin GPIO pin for TXD1 (14, 32 or 40 - default 14) - -- rxd1_pin GPIO pin for RXD1 (15, 33 or 41 - default 15) -+ rxd1_pin GPIO pin for RXD1 (15, 33 or 41 - default 15) - - - Name: vc4-kms-v3d -@@ -753,7 +753,7 @@ Params: <None> - - Name: vga666 - Info: Overlay for the Fen Logic VGA666 board -- This uses GPIOs 2-21 (so no I2C), and activates the output 2-3 seconds -+ This uses GPIOs 2-21 (sono I2C), and activates the output 2-3 seconds - after the kernel has started. - Load: dtoverlay=vga666 - Params: <None> -@@ -763,22 +763,22 @@ Name: w1-gpio - Info: Configures the w1-gpio Onewire interface module. - Use this overlay if you *don't* need a GPIO to drive an external pullup. - Load: dtoverlay=w1-gpio,<param>=<val> --Params: gpiopin GPIO for I/O (default "4") -+Params: gpiopin GPIO for I/O (default "4") - -- pullup Non-zero, "on", or "y" to enable the parasitic -- power (2-wire, power-on-data) feature -+ pullup Non-zero, "on", or "y" to enable the parasitic -+ power (2-wire, power-on-data) feature - - - Name: w1-gpio-pullup - Info: Configures the w1-gpio Onewire interface module. - Use this overlay if you *do* need a GPIO to drive an external pullup. - Load: dtoverlay=w1-gpio-pullup,<param>=<val> --Params: gpiopin GPIO for I/O (default "4") -+Params: gpiopin GPIO for I/O (default "4") - -- pullup Non-zero, "on", or "y" to enable the parasitic -- power (2-wire, power-on-data) feature -+ pullup Non-zero, "on", or "y" to enable the parasitic -+ power (2-wire, power-on-data) feature - -- extpullup GPIO for external pullup (default "5") -+ extpullup GPIO for external pullup (default "5") - - - Troubleshooting ++static struct platform_driver rpi_backlight_driver = { ++ .driver = { ++ .name = "rpi-backlight", ++ .of_match_table = of_match_ptr(rpi_backlight_of_match), ++ }, ++ .probe = rpi_backlight_probe, ++}; ++ ++module_platform_driver(rpi_backlight_driver); ++ ++MODULE_AUTHOR("Gordon Hollingworth <gordon@raspberrypi.org>"); ++MODULE_DESCRIPTION("Raspberry Pi mailbox based Backlight Driver"); ++MODULE_LICENSE("GPL"); -From d32795d2be55748552ddacd9b1e47efc61264a98 Mon Sep 17 00:00:00 2001 -From: Phil Elwell <phil@raspberrypi.org> -Date: Mon, 8 Feb 2016 12:53:44 +0000 -Subject: [PATCH 146/170] FIXUP: Overlay README - Restore spaces deleted in - error +From 8b5f29a6c47607b328c57a67aca43a9f46f779c6 Mon Sep 17 00:00:00 2001 +From: popcornmix <popcornmix@gmail.com> +Date: Tue, 23 Feb 2016 19:56:04 +0000 +Subject: [PATCH 085/112] bcm2835-virtgpio: Virtual GPIO driver +Add a virtual GPIO driver that uses the firmware mailbox interface to +request that the VPU toggles LEDs. --- - arch/arm/boot/dts/overlays/README | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) + drivers/gpio/Kconfig | 6 ++ + drivers/gpio/Makefile | 1 + + drivers/gpio/gpio-bcm-virt.c | 179 +++++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 186 insertions(+) + create mode 100644 drivers/gpio/gpio-bcm-virt.c -diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README -index ec1ae91..f987565 100644 ---- a/arch/arm/boot/dts/overlays/README -+++ b/arch/arm/boot/dts/overlays/README -@@ -550,7 +550,7 @@ Info: Configures a single PWM channel - Pins 12 and 13 might be better choices on an A+, B+ or Pi2. - 2) The onboard analogue audio output uses both PWM channels. - 3) So be careful mixing audio and PWM. -- 4) Currently the clockmust have been enabled and configured -+ 4) Currently the clock must have been enabled and configured - by other means. - Load: dtoverlay=pwm,<param>=<val> - Params: pin Output pin (default 18) - see table -@@ -569,7 +569,7 @@ Info: Configures both PWM channels - Pins 12 and 13 might be better choices on an A+, B+ or Pi2. - 2) The onboard analogue audio output uses both PWM channels. - 3) So be careful mixing audio and PWM. -- 4) Currently the clockmust have been enabled and configured -+ 4) Currently the clock must have been enabled and configured - by other means. - Load: dtoverlay=pwm-2chan,<param>=<val> - Params: pin Output pin (default 18) - see table -@@ -753,7 +753,7 @@ Params: <None> - - Name: vga666 - Info: Overlay for the Fen Logic VGA666 board -- This uses GPIOs 2-21 (sono I2C), and activates the output 2-3 seconds -+ This uses GPIOs 2-21 (so no I2C), and activates the output 2-3 seconds - after the kernel has started. - Load: dtoverlay=vga666 - Params: <None> +diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig +index 5f3429f..86cb971 100644 +--- a/drivers/gpio/Kconfig ++++ b/drivers/gpio/Kconfig +@@ -142,6 +142,12 @@ config GPIO_BCM_KONA + help + Turn on GPIO support for Broadcom "Kona" chips. + ++config GPIO_BCM_VIRT ++ bool "Broadcom Virt GPIO" ++ depends on OF_GPIO && RASPBERRYPI_FIRMWARE && (ARCH_BCM2835 || ARCH_BCM2708 || ARCH_BCM2709 || COMPILE_TEST) ++ help ++ Turn on virtual GPIO support for Broadcom BCM283X chips. ++ + config GPIO_BRCMSTB + tristate "BRCMSTB GPIO support" + default y if (ARCH_BRCMSTB || BMIPS_GENERIC) +diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile +index 1e0b74f..908596d 100644 +--- a/drivers/gpio/Makefile ++++ b/drivers/gpio/Makefile +@@ -26,6 +26,7 @@ obj-$(CONFIG_GPIO_AMDPT) += gpio-amdpt.o + obj-$(CONFIG_GPIO_ARIZONA) += gpio-arizona.o + obj-$(CONFIG_GPIO_ATH79) += gpio-ath79.o + obj-$(CONFIG_GPIO_BCM_KONA) += gpio-bcm-kona.o ++obj-$(CONFIG_GPIO_BCM_VIRT) += gpio-bcm-virt.o + obj-$(CONFIG_GPIO_BRCMSTB) += gpio-brcmstb.o + obj-$(CONFIG_GPIO_BT8XX) += gpio-bt8xx.o + obj-$(CONFIG_GPIO_CLPS711X) += gpio-clps711x.o +diff --git a/drivers/gpio/gpio-bcm-virt.c b/drivers/gpio/gpio-bcm-virt.c +new file mode 100644 +index 0000000..f3e0f16 +--- /dev/null ++++ b/drivers/gpio/gpio-bcm-virt.c +@@ -0,0 +1,179 @@ ++/* ++ * brcmvirt GPIO driver ++ * ++ * Copyright (C) 2012,2013 Dom Cobley <popcornmix@gmail.com> ++ * Based on gpio-clps711x.c by Alexander Shiyan <shc_work@mail.ru> ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ */ ++ ++#include <linux/err.h> ++#include <linux/gpio.h> ++#include <linux/module.h> ++#include <linux/platform_device.h> ++#include <soc/bcm2835/raspberrypi-firmware.h> ++ ++#define MODULE_NAME "brcmvirt-gpio" ++#define NUM_GPIO 2 ++ ++struct brcmvirt_gpio { ++ struct gpio_chip gc; ++ u32 __iomem *ts_base; ++ /* two packed 16-bit counts of enabled and disables ++ Allows host to detect a brief enable that was missed */ ++ u32 enables_disables[NUM_GPIO]; ++}; ++ ++static int brcmvirt_gpio_dir_in(struct gpio_chip *gc, unsigned off) ++{ ++ struct brcmvirt_gpio *gpio; ++ gpio = container_of(gc, struct brcmvirt_gpio, gc); ++ return -EINVAL; ++} ++ ++static int brcmvirt_gpio_dir_out(struct gpio_chip *gc, unsigned off, int val) ++{ ++ struct brcmvirt_gpio *gpio; ++ gpio = container_of(gc, struct brcmvirt_gpio, gc); ++ return 0; ++} ++ ++static int brcmvirt_gpio_get(struct gpio_chip *gc, unsigned off) ++{ ++ struct brcmvirt_gpio *gpio; ++ unsigned v; ++ gpio = container_of(gc, struct brcmvirt_gpio, gc); ++ v = readl(gpio->ts_base + off); ++ return (v >> off) & 1; ++} ++ ++static void brcmvirt_gpio_set(struct gpio_chip *gc, unsigned off, int val) ++{ ++ struct brcmvirt_gpio *gpio; ++ u16 enables, disables; ++ s16 diff; ++ bool lit; ++ gpio = container_of(gc, struct brcmvirt_gpio, gc); ++ enables = gpio->enables_disables[off] >> 16; ++ disables = gpio->enables_disables[off] >> 0; ++ diff = (s16)(enables - disables); ++ lit = diff > 0; ++ if ((val && lit) || (!val && !lit)) ++ return; ++ if (val) ++ enables++; ++ else ++ disables++; ++ diff = (s16)(enables - disables); ++ BUG_ON(diff != 0 && diff != 1); ++ gpio->enables_disables[off] = (enables << 16) | (disables << 0); ++ writel(gpio->enables_disables[off], gpio->ts_base + off); ++} ++ ++static int brcmvirt_gpio_probe(struct platform_device *pdev) ++{ ++ struct device *dev = &pdev->dev; ++ struct device_node *np = dev->of_node; ++ struct device_node *fw_node; ++ struct rpi_firmware *fw; ++ struct brcmvirt_gpio *ucb; ++ u32 gpiovirtbuf; ++ int err = 0; ++ ++ fw_node = of_parse_phandle(np, "firmware", 0); ++ if (!fw_node) { ++ dev_err(dev, "Missing firmware node\n"); ++ return -ENOENT; ++ } ++ ++ fw = rpi_firmware_get(fw_node); ++ if (!fw) ++ return -EPROBE_DEFER; ++ ++ err = rpi_firmware_property(fw, RPI_FIRMWARE_FRAMEBUFFER_GET_GPIOVIRTBUF, ++ &gpiovirtbuf, sizeof(gpiovirtbuf)); ++ ++ if (err) { ++ dev_err(dev, "Failed to get gpiovirtbuf\n"); ++ goto err; ++ } ++ ++ if (!gpiovirtbuf) { ++ dev_err(dev, "No virtgpio buffer\n"); ++ err = -ENOENT; ++ goto err; ++ } ++ ++ ucb = devm_kzalloc(dev, sizeof *ucb, GFP_KERNEL); ++ if (!ucb) { ++ err = -EINVAL; ++ goto err; ++ } ++ ++ // mmap the physical memory ++ gpiovirtbuf &= ~0xc0000000; ++ ucb->ts_base = ioremap(gpiovirtbuf, 4096); ++ if (ucb->ts_base == NULL) { ++ dev_err(dev, "Failed to map physical address\n"); ++ err = -ENOENT; ++ goto err; ++ } ++ ++ ucb->gc.label = MODULE_NAME; ++ ucb->gc.owner = THIS_MODULE; ++ //ucb->gc.dev = dev; ++ ucb->gc.of_node = np; ++ ucb->gc.base = 100; ++ ucb->gc.ngpio = NUM_GPIO; ++ ++ ucb->gc.direction_input = brcmvirt_gpio_dir_in; ++ ucb->gc.direction_output = brcmvirt_gpio_dir_out; ++ ucb->gc.get = brcmvirt_gpio_get; ++ ucb->gc.set = brcmvirt_gpio_set; ++ ucb->gc.can_sleep = true; ++ ++ err = gpiochip_add(&ucb->gc); ++ if (err) ++ goto err; ++ ++ platform_set_drvdata(pdev, ucb); ++ ++err: ++ return err; ++ ++} ++ ++static int brcmvirt_gpio_remove(struct platform_device *pdev) ++{ ++ int err = 0; ++ struct brcmvirt_gpio *ucb = platform_get_drvdata(pdev); ++ ++ gpiochip_remove(&ucb->gc); ++ iounmap(ucb->ts_base); ++ return err; ++} ++ ++static const struct of_device_id __maybe_unused brcmvirt_gpio_ids[] = { ++ { .compatible = "brcm,bcm2835-virtgpio" }, ++ { } ++}; ++MODULE_DEVICE_TABLE(of, brcmvirt_gpio_ids); ++ ++static struct platform_driver brcmvirt_gpio_driver = { ++ .driver = { ++ .name = MODULE_NAME, ++ .owner = THIS_MODULE, ++ .of_match_table = of_match_ptr(brcmvirt_gpio_ids), ++ }, ++ .probe = brcmvirt_gpio_probe, ++ .remove = brcmvirt_gpio_remove, ++}; ++module_platform_driver(brcmvirt_gpio_driver); ++ ++MODULE_LICENSE("GPL"); ++MODULE_AUTHOR("Dom Cobley <popcornmix@gmail.com>"); ++MODULE_DESCRIPTION("brcmvirt GPIO driver"); ++MODULE_ALIAS("platform:brcmvirt-gpio"); + +From 4af55e5c7890f15b3ee2953fe66a7af6a35fde5d Mon Sep 17 00:00:00 2001 +From: popcornmix <popcornmix@gmail.com> +Date: Fri, 4 Mar 2016 12:49:09 +0000 +Subject: [PATCH 086/112] DRM_VC4: Allow to be built for ARCH_BCM270x -From be4e718cccf6909072eeab1032b1d9fb6dd92b43 Mon Sep 17 00:00:00 2001 -From: Phil Elwell <phil@raspberrypi.org> -Date: Tue, 9 Feb 2016 09:52:13 +0000 -Subject: [PATCH 147/170] pinctrl-bcm2835: Fix cut-and-paste error in "pull" - parsing - -The DT bindings for pinctrl-bcm2835 allow both the function and pull -to contain either one entry or one per pin. However, an error in the -DT parsing can cause failures if the number of pulls differs from the -number of functions. --- - drivers/pinctrl/bcm/pinctrl-bcm2835.c | 2 +- + drivers/gpu/drm/vc4/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -diff --git a/drivers/pinctrl/bcm/pinctrl-bcm2835.c b/drivers/pinctrl/bcm/pinctrl-bcm2835.c -index 640e3b0..32f779e 100644 ---- a/drivers/pinctrl/bcm/pinctrl-bcm2835.c -+++ b/drivers/pinctrl/bcm/pinctrl-bcm2835.c -@@ -802,7 +802,7 @@ static int bcm2835_pctl_dt_node_to_map(struct pinctrl_dev *pctldev, - } - if (num_pulls) { - err = of_property_read_u32_index(np, "brcm,pull", -- (num_funcs > 1) ? i : 0, &pull); -+ (num_pulls > 1) ? i : 0, &pull); - if (err) - goto out; - err = bcm2835_pctl_dt_node_to_map_pull(pc, np, pin, - -From 14e35b8cca5bf1f6223ebc6cc4d527645076a3a3 Mon Sep 17 00:00:00 2001 -From: popcornmix <popcornmix@gmail.com> -Date: Thu, 11 Feb 2016 17:30:49 +0000 -Subject: [PATCH 148/170] Revert "BCM270X_DT: Disable DMA for bcm2835-sdhost on - Pi2" +diff --git a/drivers/gpu/drm/vc4/Kconfig b/drivers/gpu/drm/vc4/Kconfig +index 5848104..870fea5 100644 +--- a/drivers/gpu/drm/vc4/Kconfig ++++ b/drivers/gpu/drm/vc4/Kconfig +@@ -1,6 +1,6 @@ + config DRM_VC4 + tristate "Broadcom VC4 Graphics" +- depends on ARCH_BCM2835 || COMPILE_TEST ++ depends on ARCH_BCM2835 || ARCH_BCM2708 || ARCH_BCM2709 || COMPILE_TEST + depends on DRM + select DRM_KMS_HELPER + select DRM_KMS_CMA_HELPER + +From 98b2c4aae5e4450f7fe526b36cb22d144d394f5b Mon Sep 17 00:00:00 2001 +From: Phil Elwell <phil@raspberrypi.org> +Date: Tue, 23 Feb 2016 17:26:48 +0000 +Subject: [PATCH 087/112] amba_pl011: Don't use DT aliases for numbering -This reverts commit 9c1adcc07a40f762fd4ac580f07646784de135e1. +The pl011 driver looks for DT aliases of the form "serial<n>", +and if found uses <n> as the device ID. This can cause +/dev/ttyAMA0 to become /dev/ttyAMA1, which is confusing if the +other serial port is provided by the 8250 driver which doesn't +use the same logic. --- - arch/arm/boot/dts/bcm2709-rpi-2-b.dts | 1 - - 1 file changed, 1 deletion(-) + drivers/tty/serial/amba-pl011.c | 5 +++++ + 1 file changed, 5 insertions(+) -diff --git a/arch/arm/boot/dts/bcm2709-rpi-2-b.dts b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts -index 0b68db5..5206ba2 100644 ---- a/arch/arm/boot/dts/bcm2709-rpi-2-b.dts -+++ b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts -@@ -43,7 +43,6 @@ - pinctrl-names = "default"; - pinctrl-0 = <&sdhost_pins>; - bus-width = <4>; -- brcm,pio-limit = <0x7fffffff>; - status = "okay"; - }; +diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c +index 7c198e0..4f9e97b 100644 +--- a/drivers/tty/serial/amba-pl011.c ++++ b/drivers/tty/serial/amba-pl011.c +@@ -2413,7 +2413,12 @@ static int pl011_setup_port(struct device *dev, struct uart_amba_port *uap, + if (IS_ERR(base)) + return PTR_ERR(base); + ++ /* Don't use DT serial<n> aliases - it causes the device to ++ be renumbered to ttyAMA1 if it is the second serial port in the ++ system, even though the other one is ttyS0. The 8250 driver ++ doesn't use this logic, so always remains ttyS0. + index = pl011_probe_dt_alias(index, dev); ++ */ + uap->old_cr = 0; + uap->port.dev = dev; -From 5a117bd925d13a305d94eeb28919dedeaa9be17d Mon Sep 17 00:00:00 2001 -From: Phil Elwell <phil@raspberrypi.org> -Date: Thu, 11 Feb 2016 16:51:01 +0000 -Subject: [PATCH 149/170] bcm2835-sdhost: Major revision +From 74026743feb7e22a4393a00f227736160e146bb2 Mon Sep 17 00:00:00 2001 +From: Pantelis Antoniou <pantelis.antoniou@konsulko.com> +Date: Wed, 3 Dec 2014 13:23:28 +0200 +Subject: [PATCH 088/112] OF: DT-Overlay configfs interface -This is a significant revision of the bcm2835-sdhost driver. It -improves on the original in a number of ways: +This is a port of Pantelis Antoniou's v3 port that makes use of the +new upstreamed configfs support for binary attributes. -1) Through the use of CMD23 for reads it appears to avoid problems - reading some sectors on certain high speed cards. -2) Better atomicity to prevent crashes. -3) Higher performance. -4) Activity logging included, for easier diagnosis in the event - of a problem. +Original commit message: + +Add a runtime interface to using configfs for generic device tree overlay +usage. With it its possible to use device tree overlays without having +to use a per-platform overlay manager. +Please see Documentation/devicetree/configfs-overlays.txt for more info. + +Changes since v2: +- Removed ifdef CONFIG_OF_OVERLAY (since for now it's required) +- Created a documentation entry +- Slight rewording in Kconfig + +Changes since v1: +- of_resolve() -> of_resolve_phandles(). + +Originally-signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com> Signed-off-by: Phil Elwell <phil@raspberrypi.org> ---- - drivers/mmc/host/bcm2835-sdhost.c | 1284 ++++++++++++++++++++----------------- - 1 file changed, 686 insertions(+), 598 deletions(-) -diff --git a/drivers/mmc/host/bcm2835-sdhost.c b/drivers/mmc/host/bcm2835-sdhost.c -index ef9b1e6..262180b 100644 ---- a/drivers/mmc/host/bcm2835-sdhost.c -+++ b/drivers/mmc/host/bcm2835-sdhost.c -@@ -2,7 +2,7 @@ - * BCM2835 SD host driver. - * - * Author: Phil Elwell <phil@raspberrypi.org> -- * Copyright 2015 -+ * Copyright (C) 2015-2016 Raspberry Pi (Trading) Ltd. - * - * Based on - * mmc-bcm2835.c by Gellert Weisz -@@ -24,12 +24,13 @@ - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - --#define SAFE_READ_THRESHOLD 4 --#define SAFE_WRITE_THRESHOLD 4 --#define ALLOW_DMA 1 --#define ALLOW_CMD23 0 --#define ALLOW_FAST 1 --#define USE_BLOCK_IRQ 1 -+#define FIFO_READ_THRESHOLD 4 -+#define FIFO_WRITE_THRESHOLD 4 -+#define ALLOW_CMD23_READ 1 -+#define ALLOW_CMD23_WRITE 0 -+#define ENABLE_LOG 1 -+#define SDDATA_FIFO_PIO_BURST 8 -+#define CMD_DALLY_US 1 - - #include <linux/delay.h> - #include <linux/module.h> -@@ -48,6 +49,7 @@ - #include <linux/dma-mapping.h> - #include <linux/of_dma.h> - #include <linux/time.h> -+#include <linux/workqueue.h> - - #define DRIVER_NAME "sdhost-bcm2835" - -@@ -110,6 +112,28 @@ - #define SDEDM_READ_THRESHOLD_SHIFT 14 - #define SDEDM_THRESHOLD_MASK 0x1f - -+#define SDEDM_FSM_MASK 0xf -+#define SDEDM_FSM_IDENTMODE 0x0 -+#define SDEDM_FSM_DATAMODE 0x1 -+#define SDEDM_FSM_READDATA 0x2 -+#define SDEDM_FSM_WRITEDATA 0x3 -+#define SDEDM_FSM_READWAIT 0x4 -+#define SDEDM_FSM_READCRC 0x5 -+#define SDEDM_FSM_WRITECRC 0x6 -+#define SDEDM_FSM_WRITEWAIT1 0x7 -+#define SDEDM_FSM_POWERDOWN 0x8 -+#define SDEDM_FSM_POWERUP 0x9 -+#define SDEDM_FSM_WRITESTART1 0xa -+#define SDEDM_FSM_WRITESTART2 0xb -+#define SDEDM_FSM_GENPULSES 0xc -+#define SDEDM_FSM_WRITEWAIT2 0xd -+#define SDEDM_FSM_STARTPOWDOWN 0xf +DT configfs: Fix build errors on other platforms + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> + +DT configfs: fix build error + +There is an error when compiling rpi-4.6.y branch: + CC drivers/of/configfs.o +drivers/of/configfs.c:291:21: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types] + .default_groups = of_cfs_def_groups, + ^ +drivers/of/configfs.c:291:21: note: (near initialization for 'of_cfs_subsys.su_group.default_groups.next') + +The .default_groups is linked list since commit +1ae1602de028acaa42a0f6ff18d19756f8e825c6. +This commit uses configfs_add_default_group to fix this problem. + +Signed-off-by: Slawomir Stepien <sst@poczta.fm> +--- + Documentation/devicetree/configfs-overlays.txt | 31 +++ + drivers/of/Kconfig | 7 + + drivers/of/Makefile | 1 + + drivers/of/configfs.c | 311 +++++++++++++++++++++++++ + 4 files changed, 350 insertions(+) + create mode 100644 Documentation/devicetree/configfs-overlays.txt + create mode 100644 drivers/of/configfs.c + +diff --git a/Documentation/devicetree/configfs-overlays.txt b/Documentation/devicetree/configfs-overlays.txt +new file mode 100644 +index 0000000..5fa43e0 +--- /dev/null ++++ b/Documentation/devicetree/configfs-overlays.txt +@@ -0,0 +1,31 @@ ++Howto use the configfs overlay interface. + -+#define SDDATA_FIFO_WORDS 16 ++A device-tree configfs entry is created in /config/device-tree/overlays ++and and it is manipulated using standard file system I/O. ++Note that this is a debug level interface, for use by developers and ++not necessarily something accessed by normal users due to the ++security implications of having direct access to the kernel's device tree. + -+#define USE_CMD23_FLAGS ((ALLOW_CMD23_READ * MMC_DATA_READ) | \ -+ (ALLOW_CMD23_WRITE * MMC_DATA_WRITE)) ++* To create an overlay you mkdir the directory: + - #define MHZ 1000000 - - -@@ -131,15 +155,17 @@ struct bcm2835_host { - - struct tasklet_struct finish_tasklet; /* Tasklet structures */ - -- struct timer_list timer; /* Timer for timeouts */ -+ struct work_struct cmd_wait_wq; /* Workqueue function */ - -- struct timer_list pio_timer; /* PIO error detection timer */ -+ struct timer_list timer; /* Timer for timeouts */ - - struct sg_mapping_iter sg_miter; /* SG state for PIO */ - unsigned int blocks; /* remaining PIO blocks */ - - int irq; /* Device IRQ */ - -+ u32 cmd_quick_poll_retries; -+ u32 ns_per_fifo_word; - - /* cached registers */ - u32 hcfg; -@@ -154,16 +180,21 @@ struct bcm2835_host { - - unsigned int use_busy:1; /* Wait for busy interrupt */ - -- unsigned int debug:1; /* Enable debug output */ -+ unsigned int use_sbc:1; /* Send CMD23 */ - -- u32 thread_isr; -+ unsigned int debug:1; /* Enable debug output */ - - /*DMA part*/ - struct dma_chan *dma_chan_rx; /* DMA channel for reads */ - struct dma_chan *dma_chan_tx; /* DMA channel for writes */ -+ struct dma_chan *dma_chan; /* Channel in used */ -+ struct dma_async_tx_descriptor *dma_desc; -+ u32 dma_dir; -+ u32 drain_words; -+ struct page *drain_page; -+ u32 drain_offset; - - bool allow_dma; -- bool have_dma; - bool use_dma; - /*end of DMA part*/ - -@@ -173,13 +204,98 @@ struct bcm2835_host { - u32 overclock_50; /* frequency to use when 50MHz is requested (in MHz) */ - u32 overclock; /* Current frequency if overclocked, else zero */ - u32 pio_limit; /* Maximum block count for PIO (0 = always DMA) */ -+}; - -- u32 debug_flags; -+#if ENABLE_LOG - -- u32 sectors; /* Cached card size in sectors */ -- u32 single_read_sectors[8]; -+struct log_entry_struct { -+ char event[4]; -+ u32 timestamp; -+ u32 param1; -+ u32 param2; - }; ++ # mkdir /config/device-tree/overlays/foo ++ ++* Either you echo the overlay firmware file to the path property file. ++ ++ # echo foo.dtbo >/config/device-tree/overlays/foo/path ++ ++* Or you cat the contents of the overlay to the dtbo file ++ ++ # cat foo.dtbo >/config/device-tree/overlays/foo/dtbo ++ ++The overlay file will be applied, and devices will be created/destroyed ++as required. ++ ++To remove it simply rmdir the directory. ++ ++ # rmdir /config/device-tree/overlays/foo ++ ++The rationalle of the dual interface (firmware & direct copy) is that each is ++better suited to different use patterns. The firmware interface is what's ++intended to be used by hardware managers in the kernel, while the copy interface ++make sense for developers (since it avoids problems with namespaces). +diff --git a/drivers/of/Kconfig b/drivers/of/Kconfig +index e2a4841..7e5e6c4 100644 +--- a/drivers/of/Kconfig ++++ b/drivers/of/Kconfig +@@ -112,4 +112,11 @@ config OF_OVERLAY + While this option is selected automatically when needed, you can + enable it manually to improve device tree unit test coverage. -+typedef struct log_entry_struct LOG_ENTRY_T; ++config OF_CONFIGFS ++ bool "Device Tree Overlay ConfigFS interface" ++ select CONFIGFS_FS ++ select OF_OVERLAY ++ help ++ Enable a simple user-space driven DT overlay interface. ++ + endif # OF +diff --git a/drivers/of/Makefile b/drivers/of/Makefile +index 156c072..46c8f57 100644 +--- a/drivers/of/Makefile ++++ b/drivers/of/Makefile +@@ -1,4 +1,5 @@ + obj-y = base.o device.o platform.o ++obj-$(CONFIG_OF_CONFIGFS) += configfs.o + obj-$(CONFIG_OF_DYNAMIC) += dynamic.o + obj-$(CONFIG_OF_FLATTREE) += fdt.o + obj-$(CONFIG_OF_EARLY_FLATTREE) += fdt_address.o +diff --git a/drivers/of/configfs.c b/drivers/of/configfs.c +new file mode 100644 +index 0000000..68f889d +--- /dev/null ++++ b/drivers/of/configfs.c +@@ -0,0 +1,311 @@ ++/* ++ * Configfs entries for device-tree ++ * ++ * Copyright (C) 2013 - Pantelis Antoniou <panto@antoniou-consulting.com> ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * as published by the Free Software Foundation; either version ++ * 2 of the License, or (at your option) any later version. ++ */ ++#include <linux/ctype.h> ++#include <linux/cpu.h> ++#include <linux/module.h> ++#include <linux/of.h> ++#include <linux/of_fdt.h> ++#include <linux/spinlock.h> ++#include <linux/slab.h> ++#include <linux/proc_fs.h> ++#include <linux/configfs.h> ++#include <linux/types.h> ++#include <linux/stat.h> ++#include <linux/limits.h> ++#include <linux/file.h> ++#include <linux/vmalloc.h> ++#include <linux/firmware.h> ++#include <linux/sizes.h> + -+LOG_ENTRY_T *sdhost_log_buf; -+dma_addr_t sdhost_log_addr; -+static u32 sdhost_log_idx; -+static spinlock_t log_lock; -+static void __iomem *timer_base; ++#include "of_private.h" + -+#define LOG_ENTRIES (256*1) -+#define LOG_SIZE (sizeof(LOG_ENTRY_T)*LOG_ENTRIES) ++struct cfs_overlay_item { ++ struct config_item item; + -+static void log_init(u32 bus_to_phys) -+{ -+ spin_lock_init(&log_lock); -+ sdhost_log_buf = dma_zalloc_coherent(NULL, LOG_SIZE, &sdhost_log_addr, -+ GFP_KERNEL); -+ if (sdhost_log_buf) { -+ pr_err("sdhost: log_buf @ %p (%x)\n", -+ sdhost_log_buf, sdhost_log_addr); -+ timer_base = ioremap_nocache(bus_to_phys + 0x7e003000, SZ_4K); -+ if (!timer_base) -+ pr_err("sdhost: failed to remap timer\n"); -+ } -+ else -+ pr_err("sdhost: failed to allocate log buf\n"); -+} ++ char path[PATH_MAX]; + -+static void log_event_impl(const char *event, u32 param1, u32 param2) ++ const struct firmware *fw; ++ struct device_node *overlay; ++ int ov_id; ++ ++ void *dtbo; ++ int dtbo_size; ++}; ++ ++static int create_overlay(struct cfs_overlay_item *overlay, void *blob) +{ -+ if (sdhost_log_buf) { -+ LOG_ENTRY_T *entry; -+ unsigned long flags; ++ int err; + -+ spin_lock_irqsave(&log_lock, flags); ++ /* unflatten the tree */ ++ of_fdt_unflatten_tree(blob, &overlay->overlay); ++ if (overlay->overlay == NULL) { ++ pr_err("%s: failed to unflatten tree\n", __func__); ++ err = -EINVAL; ++ goto out_err; ++ } ++ pr_debug("%s: unflattened OK\n", __func__); + -+ entry = sdhost_log_buf + sdhost_log_idx; -+ memcpy(entry->event, event, 4); -+ entry->timestamp = (readl(timer_base + 4) & 0x3fffffff) + -+ (smp_processor_id()<<30); -+ entry->param1 = param1; -+ entry->param2 = param2; -+ sdhost_log_idx = (sdhost_log_idx + 1) % LOG_ENTRIES; ++ /* mark it as detached */ ++ of_node_set_flag(overlay->overlay, OF_DETACHED); + -+ spin_unlock_irqrestore(&log_lock, flags); ++ /* perform resolution */ ++ err = of_resolve_phandles(overlay->overlay); ++ if (err != 0) { ++ pr_err("%s: Failed to resolve tree\n", __func__); ++ goto out_err; ++ } ++ pr_debug("%s: resolved OK\n", __func__); ++ ++ err = of_overlay_create(overlay->overlay); ++ if (err < 0) { ++ pr_err("%s: Failed to create overlay (err=%d)\n", ++ __func__, err); ++ goto out_err; + } ++ overlay->ov_id = err; ++ ++out_err: ++ return err; +} + -+static void log_dump(void) ++static inline struct cfs_overlay_item *to_cfs_overlay_item( ++ struct config_item *item) +{ -+ if (sdhost_log_buf) { -+ LOG_ENTRY_T *entry; -+ unsigned long flags; -+ int idx; ++ return item ? container_of(item, struct cfs_overlay_item, item) : NULL; ++} + -+ spin_lock_irqsave(&log_lock, flags); ++static ssize_t cfs_overlay_item_path_show(struct config_item *item, ++ char *page) ++{ ++ struct cfs_overlay_item *overlay = to_cfs_overlay_item(item); ++ return sprintf(page, "%s\n", overlay->path); ++} + -+ idx = sdhost_log_idx; -+ do { -+ entry = sdhost_log_buf + idx; -+ if (entry->event[0] != '\0') -+ pr_err("[%08x] %.4s %x %x\n", -+ entry->timestamp, -+ entry->event, -+ entry->param1, -+ entry->param2); -+ idx = (idx + 1) % LOG_ENTRIES; -+ } while (idx != sdhost_log_idx); ++static ssize_t cfs_overlay_item_path_store(struct config_item *item, ++ const char *page, size_t count) ++{ ++ struct cfs_overlay_item *overlay = to_cfs_overlay_item(item); ++ const char *p = page; ++ char *s; ++ int err; + -+ spin_unlock_irqrestore(&log_lock, flags); -+ } -+} ++ /* if it's set do not allow changes */ ++ if (overlay->path[0] != '\0' || overlay->dtbo_size > 0) ++ return -EPERM; + -+#define log_event(event, param1, param2) log_event_impl(event, param1, param2) ++ /* copy to path buffer (and make sure it's always zero terminated */ ++ count = snprintf(overlay->path, sizeof(overlay->path) - 1, "%s", p); ++ overlay->path[sizeof(overlay->path) - 1] = '\0'; + -+#else ++ /* strip trailing newlines */ ++ s = overlay->path + strlen(overlay->path); ++ while (s > overlay->path && *--s == '\n') ++ *s = '\0'; + -+#define log_init(x) (void)0 -+#define log_event(event, param1, param2) (void)0 -+#define log_dump() (void)0 ++ pr_debug("%s: path is '%s'\n", __func__, overlay->path); + -+#endif - - static inline void bcm2835_sdhost_write(struct bcm2835_host *host, u32 val, int reg) - { -@@ -201,7 +317,7 @@ static void bcm2835_sdhost_dumpcmd(struct bcm2835_host *host, - const char *label) - { - if (cmd) -- pr_info("%s:%c%s op %d arg 0x%x flags 0x%x - resp %08x %08x %08x %08x, err %d\n", -+ pr_err("%s:%c%s op %d arg 0x%x flags 0x%x - resp %08x %08x %08x %08x, err %d\n", - mmc_hostname(host->mmc), - (cmd == host->cmd) ? '>' : ' ', - label, cmd->opcode, cmd->arg, cmd->flags, -@@ -211,73 +327,74 @@ static void bcm2835_sdhost_dumpcmd(struct bcm2835_host *host, - - static void bcm2835_sdhost_dumpregs(struct bcm2835_host *host) - { -- bcm2835_sdhost_dumpcmd(host, host->mrq->sbc, "sbc"); -- bcm2835_sdhost_dumpcmd(host, host->mrq->cmd, "cmd"); -- if (host->mrq->data) -- pr_err("%s: data blocks %x blksz %x - err %d\n", -- mmc_hostname(host->mmc), -- host->mrq->data->blocks, -- host->mrq->data->blksz, -- host->mrq->data->error); -- bcm2835_sdhost_dumpcmd(host, host->mrq->stop, "stop"); -+ if (host->mrq) -+ { -+ bcm2835_sdhost_dumpcmd(host, host->mrq->sbc, "sbc"); -+ bcm2835_sdhost_dumpcmd(host, host->mrq->cmd, "cmd"); -+ if (host->mrq->data) -+ pr_err("%s: data blocks %x blksz %x - err %d\n", -+ mmc_hostname(host->mmc), -+ host->mrq->data->blocks, -+ host->mrq->data->blksz, -+ host->mrq->data->error); -+ bcm2835_sdhost_dumpcmd(host, host->mrq->stop, "stop"); -+ } - -- pr_info("%s: =========== REGISTER DUMP ===========\n", -+ pr_err("%s: =========== REGISTER DUMP ===========\n", - mmc_hostname(host->mmc)); - -- pr_info("%s: SDCMD 0x%08x\n", -+ pr_err("%s: SDCMD 0x%08x\n", - mmc_hostname(host->mmc), - bcm2835_sdhost_read(host, SDCMD)); -- pr_info("%s: SDARG 0x%08x\n", -+ pr_err("%s: SDARG 0x%08x\n", - mmc_hostname(host->mmc), - bcm2835_sdhost_read(host, SDARG)); -- pr_info("%s: SDTOUT 0x%08x\n", -+ pr_err("%s: SDTOUT 0x%08x\n", - mmc_hostname(host->mmc), - bcm2835_sdhost_read(host, SDTOUT)); -- pr_info("%s: SDCDIV 0x%08x\n", -+ pr_err("%s: SDCDIV 0x%08x\n", - mmc_hostname(host->mmc), - bcm2835_sdhost_read(host, SDCDIV)); -- pr_info("%s: SDRSP0 0x%08x\n", -+ pr_err("%s: SDRSP0 0x%08x\n", - mmc_hostname(host->mmc), - bcm2835_sdhost_read(host, SDRSP0)); -- pr_info("%s: SDRSP1 0x%08x\n", -+ pr_err("%s: SDRSP1 0x%08x\n", - mmc_hostname(host->mmc), - bcm2835_sdhost_read(host, SDRSP1)); -- pr_info("%s: SDRSP2 0x%08x\n", -+ pr_err("%s: SDRSP2 0x%08x\n", - mmc_hostname(host->mmc), - bcm2835_sdhost_read(host, SDRSP2)); -- pr_info("%s: SDRSP3 0x%08x\n", -+ pr_err("%s: SDRSP3 0x%08x\n", - mmc_hostname(host->mmc), - bcm2835_sdhost_read(host, SDRSP3)); -- pr_info("%s: SDHSTS 0x%08x\n", -+ pr_err("%s: SDHSTS 0x%08x\n", - mmc_hostname(host->mmc), - bcm2835_sdhost_read(host, SDHSTS)); -- pr_info("%s: SDVDD 0x%08x\n", -+ pr_err("%s: SDVDD 0x%08x\n", - mmc_hostname(host->mmc), - bcm2835_sdhost_read(host, SDVDD)); -- pr_info("%s: SDEDM 0x%08x\n", -+ pr_err("%s: SDEDM 0x%08x\n", - mmc_hostname(host->mmc), - bcm2835_sdhost_read(host, SDEDM)); -- pr_info("%s: SDHCFG 0x%08x\n", -+ pr_err("%s: SDHCFG 0x%08x\n", - mmc_hostname(host->mmc), - bcm2835_sdhost_read(host, SDHCFG)); -- pr_info("%s: SDHBCT 0x%08x\n", -+ pr_err("%s: SDHBCT 0x%08x\n", - mmc_hostname(host->mmc), - bcm2835_sdhost_read(host, SDHBCT)); -- pr_info("%s: SDHBLC 0x%08x\n", -+ pr_err("%s: SDHBLC 0x%08x\n", - mmc_hostname(host->mmc), - bcm2835_sdhost_read(host, SDHBLC)); - -- pr_info("%s: ===========================================\n", -+ pr_err("%s: ===========================================\n", - mmc_hostname(host->mmc)); - } - -- - static void bcm2835_sdhost_set_power(struct bcm2835_host *host, bool on) - { - bcm2835_sdhost_write(host, on ? 1 : 0, SDVDD); - } - -- - static void bcm2835_sdhost_reset_internal(struct bcm2835_host *host) - { - u32 temp; -@@ -300,26 +417,24 @@ static void bcm2835_sdhost_reset_internal(struct bcm2835_host *host) - temp = bcm2835_sdhost_read(host, SDEDM); - temp &= ~((SDEDM_THRESHOLD_MASK<<SDEDM_READ_THRESHOLD_SHIFT) | - (SDEDM_THRESHOLD_MASK<<SDEDM_WRITE_THRESHOLD_SHIFT)); -- temp |= (SAFE_READ_THRESHOLD << SDEDM_READ_THRESHOLD_SHIFT) | -- (SAFE_WRITE_THRESHOLD << SDEDM_WRITE_THRESHOLD_SHIFT); -+ temp |= (FIFO_READ_THRESHOLD << SDEDM_READ_THRESHOLD_SHIFT) | -+ (FIFO_WRITE_THRESHOLD << SDEDM_WRITE_THRESHOLD_SHIFT); - bcm2835_sdhost_write(host, temp, SDEDM); - mdelay(10); - bcm2835_sdhost_set_power(host, true); - mdelay(10); - host->clock = 0; -- host->sectors = 0; -- host->single_read_sectors[0] = ~0; - bcm2835_sdhost_write(host, host->hcfg, SDHCFG); - bcm2835_sdhost_write(host, host->cdiv, SDCDIV); - mmiowb(); - } - -- - static void bcm2835_sdhost_reset(struct mmc_host *mmc) - { - struct bcm2835_host *host = mmc_priv(mmc); - unsigned long flags; - spin_lock_irqsave(&host->lock, flags); -+ log_event("RST<", 0, 0); - - bcm2835_sdhost_reset_internal(host); - -@@ -344,82 +459,48 @@ static void bcm2835_sdhost_init(struct bcm2835_host *host, int soft) - } - } - --static bool bcm2835_sdhost_is_write_complete(struct bcm2835_host *host) -+static void bcm2835_sdhost_wait_transfer_complete(struct bcm2835_host *host) - { -- bool write_complete = ((bcm2835_sdhost_read(host, SDEDM) & 0xf) == 1); -- -- if (!write_complete) { -- /* Request an IRQ for the last block */ -- host->hcfg |= SDHCFG_BLOCK_IRPT_EN; -- bcm2835_sdhost_write(host, host->hcfg, SDHCFG); -- if ((bcm2835_sdhost_read(host, SDEDM) & 0xf) == 1) { -- /* The write has now completed. Disable the interrupt -- and clear the status flag */ -- host->hcfg &= ~SDHCFG_BLOCK_IRPT_EN; -- bcm2835_sdhost_write(host, host->hcfg, SDHCFG); -- bcm2835_sdhost_write(host, SDHSTS_BLOCK_IRPT, SDHSTS); -- write_complete = true; -- } -- } -+ int timediff; -+ u32 alternate_idle; -+ u32 edm; - -- return write_complete; --} -+ alternate_idle = (host->mrq->data->flags & MMC_DATA_READ) ? -+ SDEDM_FSM_READWAIT : SDEDM_FSM_WRITESTART1; - --static void bcm2835_sdhost_wait_write_complete(struct bcm2835_host *host) --{ -- int timediff; --#ifdef DEBUG -- static struct timeval start_time; -- static int max_stall_time = 0; -- static int total_stall_time = 0; -- struct timeval before, after; -+ edm = bcm2835_sdhost_read(host, SDEDM); - -- do_gettimeofday(&before); -- if (max_stall_time == 0) -- start_time = before; --#endif -+ log_event("WTC<", edm, 0); - - timediff = 0; - - while (1) { -- u32 edm = bcm2835_sdhost_read(host, SDEDM); -- if ((edm & 0xf) == 1) -+ u32 fsm = edm & SDEDM_FSM_MASK; -+ if ((fsm == SDEDM_FSM_IDENTMODE) || -+ (fsm == SDEDM_FSM_DATAMODE)) - break; -- timediff++; -- if (timediff > 5000000) { --#ifdef DEBUG -- do_gettimeofday(&after); -- timediff = (after.tv_sec - before.tv_sec)*1000000 + -- (after.tv_usec - before.tv_usec); -+ if (fsm == alternate_idle) { -+ bcm2835_sdhost_write(host, -+ edm | SDEDM_FORCE_DATA_MODE, -+ SDEDM); -+ break; -+ } - -- pr_err(" wait_write_complete - still waiting after %dus\n", -- timediff); --#else -- pr_err(" wait_write_complete - still waiting after %d retries\n", -+ timediff++; -+ if (timediff == 100000) { -+ pr_err("%s: wait_transfer_complete - still waiting after %d retries\n", -+ mmc_hostname(host->mmc), - timediff); --#endif -+ log_dump(); - bcm2835_sdhost_dumpregs(host); -- host->data->error = -ETIMEDOUT; -+ host->mrq->data->error = -ETIMEDOUT; -+ log_event("WTC!", edm, 0); - return; - } -+ cpu_relax(); -+ edm = bcm2835_sdhost_read(host, SDEDM); - } -- --#ifdef DEBUG -- do_gettimeofday(&after); -- timediff = (after.tv_sec - before.tv_sec)*1000000 + (after.tv_usec - before.tv_usec); -- -- total_stall_time += timediff; -- if (timediff > max_stall_time) -- max_stall_time = timediff; -- -- if ((after.tv_sec - start_time.tv_sec) > 10) { -- pr_debug(" wait_write_complete - max wait %dus, total %dus\n", -- max_stall_time, total_stall_time); -- start_time = after; -- max_stall_time = 0; -- total_stall_time = 0; -- } --#endif -+ log_event("WTC>", edm, 0); - } - - static void bcm2835_sdhost_finish_data(struct bcm2835_host *host); -@@ -427,65 +508,44 @@ static void bcm2835_sdhost_finish_data(struct bcm2835_host *host); - static void bcm2835_sdhost_dma_complete(void *param) - { - struct bcm2835_host *host = param; -- struct dma_chan *dma_chan; -+ struct mmc_data *data = host->data; - unsigned long flags; -- u32 dir_data; - - spin_lock_irqsave(&host->lock, flags); -+ log_event("DMA<", (u32)host->data, bcm2835_sdhost_read(host, SDHSTS)); -+ log_event("DMA ", bcm2835_sdhost_read(host, SDCMD), -+ bcm2835_sdhost_read(host, SDEDM)); - -- if (host->data) { -- bool write_complete; -- if (USE_BLOCK_IRQ) -- write_complete = bcm2835_sdhost_is_write_complete(host); -- else { -- bcm2835_sdhost_wait_write_complete(host); -- write_complete = true; -- } -- pr_debug("dma_complete() - write_complete=%d\n", -- write_complete); -- -- if (write_complete || (host->data->flags & MMC_DATA_READ)) -- { -- if (write_complete) { -- dma_chan = host->dma_chan_tx; -- dir_data = DMA_TO_DEVICE; -- } else { -- dma_chan = host->dma_chan_rx; -- dir_data = DMA_FROM_DEVICE; -- } -- -- dma_unmap_sg(dma_chan->device->dev, -- host->data->sg, host->data->sg_len, -- dir_data); -+ if (host->dma_chan) { -+ dma_unmap_sg(host->dma_chan->device->dev, -+ data->sg, data->sg_len, -+ host->dma_dir); - -- bcm2835_sdhost_finish_data(host); -- } -+ host->dma_chan = NULL; - } - -- spin_unlock_irqrestore(&host->lock, flags); --} -+ if (host->drain_words) { -+ void *page; -+ u32 *buf; - --static bool data_transfer_wait(struct bcm2835_host *host) --{ -- unsigned long timeout = 1000000; -- while (timeout) -- { -- u32 sdhsts = bcm2835_sdhost_read(host, SDHSTS); -- if (sdhsts & SDHSTS_DATA_FLAG) { -- bcm2835_sdhost_write(host, SDHSTS_DATA_FLAG, SDHSTS); -- break; -+ page = kmap_atomic(host->drain_page); -+ buf = page + host->drain_offset; ++ err = request_firmware(&overlay->fw, overlay->path, NULL); ++ if (err != 0) ++ goto out_err; + -+ while (host->drain_words) { -+ u32 edm = bcm2835_sdhost_read(host, SDEDM); -+ if ((edm >> 4) & 0x1f) -+ *(buf++) = bcm2835_sdhost_read(host, -+ SDDATA); -+ host->drain_words--; - } -- timeout--; -- } -- if (timeout == 0) { -- pr_err("%s: Data %s timeout\n", -- mmc_hostname(host->mmc), -- (host->data->flags & MMC_DATA_READ) ? "read" : "write"); -- bcm2835_sdhost_dumpregs(host); -- host->data->error = -ETIMEDOUT; -- return false; ++ err = create_overlay(overlay, (void *)overlay->fw->data); ++ if (err != 0) ++ goto out_err; + -+ kunmap_atomic(page); - } -- return true; ++ return count; + -+ bcm2835_sdhost_finish_data(host); ++out_err: + -+ log_event("DMA>", (u32)host->data, 0); -+ spin_unlock_irqrestore(&host->lock, flags); - } - - static void bcm2835_sdhost_read_block_pio(struct bcm2835_host *host) -@@ -493,32 +553,83 @@ static void bcm2835_sdhost_read_block_pio(struct bcm2835_host *host) - unsigned long flags; - size_t blksize, len; - u32 *buf; -+ unsigned long wait_max; - - blksize = host->data->blksz; - -+ wait_max = jiffies + msecs_to_jiffies(host->pio_timeout); ++ release_firmware(overlay->fw); ++ overlay->fw = NULL; + - local_irq_save(flags); - - while (blksize) { -- if (!sg_miter_next(&host->sg_miter)) -- BUG(); -+ int copy_words; -+ u32 hsts = 0; ++ overlay->path[0] = '\0'; ++ return err; ++} + -+ if (!sg_miter_next(&host->sg_miter)) { -+ host->data->error = -EINVAL; -+ break; -+ } - - len = min(host->sg_miter.length, blksize); -- BUG_ON(len % 4); -+ if (len % 4) { -+ host->data->error = -EINVAL; -+ break; -+ } - - blksize -= len; - host->sg_miter.consumed = len; - - buf = (u32 *)host->sg_miter.addr; - -- while (len) { -- if (!data_transfer_wait(host)) -- break; -+ copy_words = len/4; ++static ssize_t cfs_overlay_item_status_show(struct config_item *item, ++ char *page) ++{ ++ struct cfs_overlay_item *overlay = to_cfs_overlay_item(item); + -+ while (copy_words) { -+ int burst_words, words; -+ u32 edm; ++ return sprintf(page, "%s\n", ++ overlay->ov_id >= 0 ? "applied" : "unapplied"); ++} + -+ burst_words = SDDATA_FIFO_PIO_BURST; -+ if (burst_words > copy_words) -+ burst_words = copy_words; -+ edm = bcm2835_sdhost_read(host, SDEDM); -+ words = ((edm >> 4) & 0x1f); ++CONFIGFS_ATTR(cfs_overlay_item_, path); ++CONFIGFS_ATTR_RO(cfs_overlay_item_, status); + -+ if (words < burst_words) { -+ int fsm_state = (edm & SDEDM_FSM_MASK); -+ if ((fsm_state != SDEDM_FSM_READDATA) && -+ (fsm_state != SDEDM_FSM_READWAIT) && -+ (fsm_state != SDEDM_FSM_READCRC)) { -+ hsts = bcm2835_sdhost_read(host, -+ SDHSTS); -+ pr_err("%s: fsm %x, hsts %x\n", -+ mmc_hostname(host->mmc), -+ fsm_state, hsts); -+ if (hsts & SDHSTS_ERROR_MASK) -+ break; -+ } ++static struct configfs_attribute *cfs_overlay_attrs[] = { ++ &cfs_overlay_item_attr_path, ++ &cfs_overlay_item_attr_status, ++ NULL, ++}; + -+ if (time_after(jiffies, wait_max)) { -+ pr_err("%s: PIO read timeout - EDM %x\n", -+ mmc_hostname(host->mmc), -+ edm); -+ hsts = SDHSTS_REW_TIME_OUT; -+ break; -+ } -+ ndelay((burst_words - words) * -+ host->ns_per_fifo_word); -+ continue; -+ } else if (words > copy_words) { -+ words = copy_words; -+ } ++ssize_t cfs_overlay_item_dtbo_read(struct config_item *item, ++ void *buf, size_t max_count) ++{ ++ struct cfs_overlay_item *overlay = to_cfs_overlay_item(item); + -+ copy_words -= words; - -- *(buf++) = bcm2835_sdhost_read(host, SDDATA); -- len -= 4; -+ while (words) { -+ *(buf++) = bcm2835_sdhost_read(host, SDDATA); -+ words--; -+ } - } - -- if (host->data->error) -+ if (hsts & SDHSTS_ERROR_MASK) - break; - } - -@@ -532,32 +643,83 @@ static void bcm2835_sdhost_write_block_pio(struct bcm2835_host *host) - unsigned long flags; - size_t blksize, len; - u32 *buf; -+ unsigned long wait_max; - - blksize = host->data->blksz; - -+ wait_max = jiffies + msecs_to_jiffies(host->pio_timeout); ++ pr_debug("%s: buf=%p max_count=%zu\n", __func__, ++ buf, max_count); + - local_irq_save(flags); - - while (blksize) { -- if (!sg_miter_next(&host->sg_miter)) -- BUG(); -+ int copy_words; -+ u32 hsts = 0; ++ if (overlay->dtbo == NULL) ++ return 0; + -+ if (!sg_miter_next(&host->sg_miter)) { -+ host->data->error = -EINVAL; -+ break; -+ } - - len = min(host->sg_miter.length, blksize); -- BUG_ON(len % 4); -+ if (len % 4) { -+ host->data->error = -EINVAL; -+ break; -+ } - - blksize -= len; - host->sg_miter.consumed = len; - -- buf = host->sg_miter.addr; -+ buf = (u32 *)host->sg_miter.addr; - -- while (len) { -- if (!data_transfer_wait(host)) -- break; -+ copy_words = len/4; ++ /* copy if buffer provided */ ++ if (buf != NULL) { ++ /* the buffer must be large enough */ ++ if (overlay->dtbo_size > max_count) ++ return -ENOSPC; + -+ while (copy_words) { -+ int burst_words, words; -+ u32 edm; ++ memcpy(buf, overlay->dtbo, overlay->dtbo_size); ++ } + -+ burst_words = SDDATA_FIFO_PIO_BURST; -+ if (burst_words > copy_words) -+ burst_words = copy_words; -+ edm = bcm2835_sdhost_read(host, SDEDM); -+ words = SDDATA_FIFO_WORDS - ((edm >> 4) & 0x1f); ++ return overlay->dtbo_size; ++} + -+ if (words < burst_words) { -+ int fsm_state = (edm & SDEDM_FSM_MASK); -+ if ((fsm_state != SDEDM_FSM_WRITEDATA) && -+ (fsm_state != SDEDM_FSM_WRITESTART1) && -+ (fsm_state != SDEDM_FSM_WRITESTART2)) { -+ hsts = bcm2835_sdhost_read(host, -+ SDHSTS); -+ pr_err("%s: fsm %x, hsts %x\n", -+ mmc_hostname(host->mmc), -+ fsm_state, hsts); -+ if (hsts & SDHSTS_ERROR_MASK) -+ break; -+ } ++ssize_t cfs_overlay_item_dtbo_write(struct config_item *item, ++ const void *buf, size_t count) ++{ ++ struct cfs_overlay_item *overlay = to_cfs_overlay_item(item); ++ int err; + -+ if (time_after(jiffies, wait_max)) { -+ pr_err("%s: PIO write timeout - EDM %x\n", -+ mmc_hostname(host->mmc), -+ edm); -+ hsts = SDHSTS_REW_TIME_OUT; -+ break; -+ } -+ ndelay((burst_words - words) * -+ host->ns_per_fifo_word); -+ continue; -+ } else if (words > copy_words) { -+ words = copy_words; -+ } ++ /* if it's set do not allow changes */ ++ if (overlay->path[0] != '\0' || overlay->dtbo_size > 0) ++ return -EPERM; + -+ copy_words -= words; - -- bcm2835_sdhost_write(host, *(buf++), SDDATA); -- len -= 4; -+ while (words) { -+ bcm2835_sdhost_write(host, *(buf++), SDDATA); -+ words--; -+ } - } - -- if (host->data->error) -+ if (hsts & SDHSTS_ERROR_MASK) - break; - } - -@@ -566,12 +728,12 @@ static void bcm2835_sdhost_write_block_pio(struct bcm2835_host *host) - local_irq_restore(flags); - } - -- - static void bcm2835_sdhost_transfer_pio(struct bcm2835_host *host) - { - u32 sdhsts; - bool is_read; - BUG_ON(!host->data); -+ log_event("XFP<", (u32)host->data, host->blocks); - - is_read = (host->data->flags & MMC_DATA_READ) != 0; - if (is_read) -@@ -595,28 +757,21 @@ static void bcm2835_sdhost_transfer_pio(struct bcm2835_host *host) - is_read ? "read" : "write", - sdhsts); - host->data->error = -ETIMEDOUT; -- } else if (!is_read && !host->data->error) { -- /* Start a timer in case a transfer error occurs because -- there is no error interrupt */ -- mod_timer(&host->pio_timer, jiffies + host->pio_timeout); - } -+ log_event("XFP>", (u32)host->data, host->blocks); - } - -- --static void bcm2835_sdhost_transfer_dma(struct bcm2835_host *host) -+static void bcm2835_sdhost_prepare_dma(struct bcm2835_host *host, -+ struct mmc_data *data) - { -- u32 len, dir_data, dir_slave; -+ int len, dir_data, dir_slave; - struct dma_async_tx_descriptor *desc = NULL; - struct dma_chan *dma_chan; - -- pr_debug("bcm2835_sdhost_transfer_dma()\n"); -- -- WARN_ON(!host->data); -- -- if (!host->data) -- return; -+ log_event("PRD<", (u32)data, 0); -+ pr_debug("bcm2835_sdhost_prepare_dma()\n"); - -- if (host->data->flags & MMC_DATA_READ) { -+ if (data->flags & MMC_DATA_READ) { - dma_chan = host->dma_chan_rx; - dir_data = DMA_FROM_DEVICE; - dir_slave = DMA_DEV_TO_MEM; -@@ -625,35 +780,71 @@ static void bcm2835_sdhost_transfer_dma(struct bcm2835_host *host) - dir_data = DMA_TO_DEVICE; - dir_slave = DMA_MEM_TO_DEV; - } -+ log_event("PRD1", (u32)dma_chan, 0); - - BUG_ON(!dma_chan->device); - BUG_ON(!dma_chan->device->dev); -- BUG_ON(!host->data->sg); -+ BUG_ON(!data->sg); ++ /* copy the contents */ ++ overlay->dtbo = kmemdup(buf, count, GFP_KERNEL); ++ if (overlay->dtbo == NULL) ++ return -ENOMEM; + -+ /* The block doesn't manage the FIFO DREQs properly for multi-block -+ transfers, so don't attempt to DMA the final few words. -+ Unfortunately this requires the final sg entry to be trimmed. -+ N.B. This code demands that the overspill is contained in -+ a single sg entry. -+ */ ++ overlay->dtbo_size = count; + -+ host->drain_words = 0; -+ if ((data->blocks > 1) && (dir_data == DMA_FROM_DEVICE)) { -+ struct scatterlist *sg; -+ u32 len; -+ int i; ++ err = create_overlay(overlay, overlay->dtbo); ++ if (err != 0) ++ goto out_err; + -+ len = min((u32)(FIFO_READ_THRESHOLD - 1) * 4, -+ (u32)data->blocks * data->blksz); - -- len = dma_map_sg(dma_chan->device->dev, host->data->sg, -- host->data->sg_len, dir_data); -- if (len > 0) { -- desc = dmaengine_prep_slave_sg(dma_chan, host->data->sg, -+ for_each_sg(data->sg, sg, data->sg_len, i) { -+ if (sg_is_last(sg)) { -+ BUG_ON(sg->length < len); -+ sg->length -= len; -+ host->drain_page = (struct page *)sg->page_link; -+ host->drain_offset = sg->offset + sg->length; -+ } -+ } -+ host->drain_words = len/4; -+ } ++ return count; + -+ len = dma_map_sg(dma_chan->device->dev, data->sg, data->sg_len, -+ dir_data); ++out_err: ++ kfree(overlay->dtbo); ++ overlay->dtbo = NULL; ++ overlay->dtbo_size = 0; + -+ log_event("PRD2", len, 0); -+ if (len > 0) -+ desc = dmaengine_prep_slave_sg(dma_chan, data->sg, - len, dir_slave, - DMA_PREP_INTERRUPT | DMA_CTRL_ACK); -- } else { -- dev_err(mmc_dev(host->mmc), "dma_map_sg returned zero length\n"); -- } -+ log_event("PRD3", (u32)desc, 0); ++ return err; ++} + - if (desc) { - desc->callback = bcm2835_sdhost_dma_complete; - desc->callback_param = host; -- dmaengine_submit(desc); -- dma_async_issue_pending(dma_chan); -+ host->dma_desc = desc; -+ host->dma_chan = dma_chan; -+ host->dma_dir = dir_data; - } -- -+ log_event("PDM>", (u32)data, 0); - } - -+static void bcm2835_sdhost_start_dma(struct bcm2835_host *host) ++CONFIGFS_BIN_ATTR(cfs_overlay_item_, dtbo, NULL, SZ_1M); ++ ++static struct configfs_bin_attribute *cfs_overlay_bin_attrs[] = { ++ &cfs_overlay_item_attr_dtbo, ++ NULL, ++}; ++ ++static void cfs_overlay_release(struct config_item *item) +{ -+ log_event("SDMA", (u32)host->data, (u32)host->dma_chan); -+ dmaengine_submit(host->dma_desc); -+ dma_async_issue_pending(host->dma_chan); ++ struct cfs_overlay_item *overlay = to_cfs_overlay_item(item); ++ ++ if (overlay->ov_id >= 0) ++ of_overlay_destroy(overlay->ov_id); ++ if (overlay->fw) ++ release_firmware(overlay->fw); ++ /* kfree with NULL is safe */ ++ kfree(overlay->dtbo); ++ kfree(overlay); +} - - static void bcm2835_sdhost_set_transfer_irqs(struct bcm2835_host *host) - { - u32 all_irqs = SDHCFG_DATA_IRPT_EN | SDHCFG_BLOCK_IRPT_EN | - SDHCFG_BUSY_IRPT_EN; -- if (host->use_dma) -+ if (host->dma_desc) - host->hcfg = (host->hcfg & ~all_irqs) | - SDHCFG_BUSY_IRPT_EN; - else -@@ -664,13 +855,13 @@ static void bcm2835_sdhost_set_transfer_irqs(struct bcm2835_host *host) - bcm2835_sdhost_write(host, host->hcfg, SDHCFG); - } - -- - static void bcm2835_sdhost_prepare_data(struct bcm2835_host *host, struct mmc_command *cmd) - { - struct mmc_data *data = cmd->data; - - WARN_ON(host->data); - -+ host->data = data; - if (!data) - return; - -@@ -679,46 +870,19 @@ static void bcm2835_sdhost_prepare_data(struct bcm2835_host *host, struct mmc_co - BUG_ON(data->blksz > host->mmc->max_blk_size); - BUG_ON(data->blocks > 65535); - -- host->data = data; - host->data_complete = 0; - host->flush_fifo = 0; - host->data->bytes_xfered = 0; - -- if (!host->sectors && host->mmc->card && !(host->debug_flags & 1)) -- { -- struct mmc_card *card = host->mmc->card; -- if (!mmc_card_sd(card) && mmc_card_blockaddr(card)) { -- /* -- * The EXT_CSD sector count is in number of 512 byte -- * sectors. -- */ -- host->sectors = card->ext_csd.sectors; -- pr_err("%s: using ext_csd!\n", mmc_hostname(host->mmc)); -- } else { -- /* -- * The CSD capacity field is in units of read_blkbits. -- * set_capacity takes units of 512 bytes. -- */ -- host->sectors = card->csd.capacity << -- (card->csd.read_blkbits - 9); -- } -- host->single_read_sectors[0] = host->sectors - 65; -- host->single_read_sectors[1] = host->sectors - 64; -- host->single_read_sectors[2] = host->sectors - 33; -- host->single_read_sectors[3] = host->sectors - 32; -- host->single_read_sectors[4] = host->sectors - 1; -- host->single_read_sectors[5] = ~0; /* Safety net */ -- } - -- host->use_dma = host->have_dma && (data->blocks > host->pio_limit); -- if (!host->use_dma) { -+ if (!host->dma_desc) { -+ /* Use PIO */ - int flags; - -- flags = SG_MITER_ATOMIC; - if (data->flags & MMC_DATA_READ) -- flags |= SG_MITER_TO_SG; -+ flags = SG_MITER_TO_SG; - else -- flags |= SG_MITER_FROM_SG; -+ flags = SG_MITER_FROM_SG; - sg_miter_start(&host->sg_miter, data->sg, data->sg_len, flags); - host->blocks = data->blocks; - } -@@ -726,19 +890,20 @@ static void bcm2835_sdhost_prepare_data(struct bcm2835_host *host, struct mmc_co - bcm2835_sdhost_set_transfer_irqs(host); - - bcm2835_sdhost_write(host, data->blksz, SDHBCT); -- bcm2835_sdhost_write(host, host->use_dma ? data->blocks : 0, SDHBLC); -+ bcm2835_sdhost_write(host, data->blocks, SDHBLC); - - BUG_ON(!host->data); - } - -- --void bcm2835_sdhost_send_command(struct bcm2835_host *host, struct mmc_command *cmd) -+bool bcm2835_sdhost_send_command(struct bcm2835_host *host, -+ struct mmc_command *cmd) - { - u32 sdcmd, sdhsts; - unsigned long timeout; - int delay; - - WARN_ON(host->cmd); -+ log_event("CMD<", cmd->opcode, cmd->arg); - - if (cmd->data) - pr_debug("%s: send_command %d 0x%x " -@@ -761,9 +926,9 @@ void bcm2835_sdhost_send_command(struct bcm2835_host *host, struct mmc_command * - pr_err("%s: previous command never completed.\n", - mmc_hostname(host->mmc)); - bcm2835_sdhost_dumpregs(host); -- cmd->error = -EIO; -+ cmd->error = -EILSEQ; - tasklet_schedule(&host->finish_tasklet); -- return; -+ return false; - } - timeout--; - udelay(10); -@@ -791,23 +956,24 @@ void bcm2835_sdhost_send_command(struct bcm2835_host *host, struct mmc_command * - if (sdhsts & SDHSTS_ERROR_MASK) - bcm2835_sdhost_write(host, sdhsts, SDHSTS); - -- bcm2835_sdhost_prepare_data(host, cmd); -- -- bcm2835_sdhost_write(host, cmd->arg, SDARG); -- - if ((cmd->flags & MMC_RSP_136) && (cmd->flags & MMC_RSP_BUSY)) { - pr_err("%s: unsupported response type!\n", - mmc_hostname(host->mmc)); - cmd->error = -EINVAL; - tasklet_schedule(&host->finish_tasklet); -- return; -+ return false; - } - -+ bcm2835_sdhost_prepare_data(host, cmd); + -+ bcm2835_sdhost_write(host, cmd->arg, SDARG); ++static struct configfs_item_operations cfs_overlay_item_ops = { ++ .release = cfs_overlay_release, ++}; + - sdcmd = cmd->opcode & SDCMD_CMD_MASK; - -- if (!(cmd->flags & MMC_RSP_PRESENT)) -+ host->use_busy = 0; -+ if (!(cmd->flags & MMC_RSP_PRESENT)) { - sdcmd |= SDCMD_NO_RESPONSE; -- else { -+ } else { - if (cmd->flags & MMC_RSP_136) - sdcmd |= SDCMD_LONG_RESPONSE; - if (cmd->flags & MMC_RSP_BUSY) { -@@ -817,6 +983,7 @@ void bcm2835_sdhost_send_command(struct bcm2835_host *host, struct mmc_command * - } - - if (cmd->data) { -+ log_event("CMDD", cmd->data->blocks, cmd->data->blksz); - if (host->delay_after_stop) { - struct timeval now; - int time_since_stop; -@@ -839,10 +1006,12 @@ void bcm2835_sdhost_send_command(struct bcm2835_host *host, struct mmc_command * - } - - bcm2835_sdhost_write(host, sdcmd | SDCMD_NEW_FLAG, SDCMD); --} - -+ return true; -+} - --static void bcm2835_sdhost_finish_command(struct bcm2835_host *host); -+static void bcm2835_sdhost_finish_command(struct bcm2835_host *host, -+ unsigned long *irq_flags); - static void bcm2835_sdhost_transfer_complete(struct bcm2835_host *host); - - static void bcm2835_sdhost_finish_data(struct bcm2835_host *host) -@@ -852,6 +1021,7 @@ static void bcm2835_sdhost_finish_data(struct bcm2835_host *host) - data = host->data; - BUG_ON(!data); - -+ log_event("FDA<", (u32)host->mrq, (u32)host->cmd); - pr_debug("finish_data(error %d, stop %d, sbc %d)\n", - data->error, data->stop ? 1 : 0, - host->mrq->sbc ? 1 : 0); -@@ -859,10 +1029,7 @@ static void bcm2835_sdhost_finish_data(struct bcm2835_host *host) - host->hcfg &= ~(SDHCFG_DATA_IRPT_EN | SDHCFG_BLOCK_IRPT_EN); - bcm2835_sdhost_write(host, host->hcfg, SDHCFG); - -- if (data->error) { -- data->bytes_xfered = 0; -- } else -- data->bytes_xfered = data->blksz * data->blocks; -+ data->bytes_xfered = data->error ? 0 : (data->blksz * data->blocks); - - host->data_complete = 1; - -@@ -877,9 +1044,9 @@ static void bcm2835_sdhost_finish_data(struct bcm2835_host *host) - } - else - bcm2835_sdhost_transfer_complete(host); -+ log_event("FDA>", (u32)host->mrq, (u32)host->cmd); - } - -- - static void bcm2835_sdhost_transfer_complete(struct bcm2835_host *host) - { - struct mmc_data *data; -@@ -891,6 +1058,7 @@ static void bcm2835_sdhost_transfer_complete(struct bcm2835_host *host) - data = host->data; - host->data = NULL; - -+ log_event("TCM<", (u32)data, data->error); - pr_debug("transfer_complete(error %d, stop %d)\n", - data->error, data->stop ? 1 : 0); - -@@ -899,88 +1067,114 @@ static void bcm2835_sdhost_transfer_complete(struct bcm2835_host *host) - * a) open-ended multiblock transfer (no CMD23) - * b) error in multiblock transfer - */ -- if (data->stop && -- (data->error || -- !host->mrq->sbc)) { -- host->flush_fifo = 1; -- bcm2835_sdhost_send_command(host, data->stop); -- if (host->delay_after_stop) -- do_gettimeofday(&host->stop_time); -- if (!host->use_busy) -- bcm2835_sdhost_finish_command(host); -+ if (host->mrq->stop && (data->error || !host->use_sbc)) { -+ if (bcm2835_sdhost_send_command(host, host->mrq->stop)) { -+ /* No busy, so poll for completion */ -+ if (!host->use_busy) -+ bcm2835_sdhost_finish_command(host, NULL); ++static struct config_item_type cfs_overlay_type = { ++ .ct_item_ops = &cfs_overlay_item_ops, ++ .ct_attrs = cfs_overlay_attrs, ++ .ct_bin_attrs = cfs_overlay_bin_attrs, ++ .ct_owner = THIS_MODULE, ++}; + -+ if (host->delay_after_stop) -+ do_gettimeofday(&host->stop_time); -+ } - } else { -+ bcm2835_sdhost_wait_transfer_complete(host); - tasklet_schedule(&host->finish_tasklet); - } -+ log_event("TCM>", (u32)data, 0); - } - --static void bcm2835_sdhost_finish_command(struct bcm2835_host *host) -+/* If irq_flags is valid, the caller is in a thread context and is allowed -+ to sleep */ -+static void bcm2835_sdhost_finish_command(struct bcm2835_host *host, -+ unsigned long *irq_flags) - { - u32 sdcmd; -- unsigned long timeout; -+ u32 retries; - #ifdef DEBUG - struct timeval before, after; - int timediff = 0; - #endif - -+ log_event("FCM<", (u32)host->mrq, (u32)host->cmd); - pr_debug("finish_command(%x)\n", bcm2835_sdhost_read(host, SDCMD)); - - BUG_ON(!host->cmd || !host->mrq); - --#ifdef DEBUG -- do_gettimeofday(&before); --#endif -- /* Wait max 100 ms */ -- timeout = 10000; -+ /* Poll quickly at first */ ++static struct config_item *cfs_overlay_group_make_item( ++ struct config_group *group, const char *name) ++{ ++ struct cfs_overlay_item *overlay; + -+ retries = host->cmd_quick_poll_retries; -+ if (!retries) { -+ /* Work out how many polls take 1us by timing 10us */ -+ struct timeval start, now; -+ int us_diff; ++ overlay = kzalloc(sizeof(*overlay), GFP_KERNEL); ++ if (!overlay) ++ return ERR_PTR(-ENOMEM); ++ overlay->ov_id = -1; + -+ retries = 1; -+ do { -+ int i; ++ config_item_init_type_name(&overlay->item, name, &cfs_overlay_type); ++ return &overlay->item; ++} + -+ retries *= 2; ++static void cfs_overlay_group_drop_item(struct config_group *group, ++ struct config_item *item) ++{ ++ struct cfs_overlay_item *overlay = to_cfs_overlay_item(item); + -+ do_gettimeofday(&start); ++ config_item_put(&overlay->item); ++} + -+ for (i = 0; i < retries; i++) { -+ cpu_relax(); -+ sdcmd = bcm2835_sdhost_read(host, SDCMD); -+ } ++static struct configfs_group_operations overlays_ops = { ++ .make_item = cfs_overlay_group_make_item, ++ .drop_item = cfs_overlay_group_drop_item, ++}; + -+ do_gettimeofday(&now); -+ us_diff = (now.tv_sec - start.tv_sec) * 1000000 + -+ (now.tv_usec - start.tv_usec); -+ } while (us_diff < 10); ++static struct config_item_type overlays_type = { ++ .ct_group_ops = &overlays_ops, ++ .ct_owner = THIS_MODULE, ++}; + -+ host->cmd_quick_poll_retries = ((retries * us_diff + 9)*CMD_DALLY_US)/10 + 1; -+ retries = 1; // We've already waited long enough this time -+ } ++static struct configfs_group_operations of_cfs_ops = { ++ /* empty - we don't allow anything to be created */ ++}; + -+ retries = host->cmd_quick_poll_retries; - for (sdcmd = bcm2835_sdhost_read(host, SDCMD); -- (sdcmd & SDCMD_NEW_FLAG) && timeout; -- timeout--) { -- if (host->flush_fifo) { -- while (bcm2835_sdhost_read(host, SDHSTS) & -- SDHSTS_DATA_FLAG) -- (void)bcm2835_sdhost_read(host, SDDATA); -- } -- udelay(10); -+ (sdcmd & SDCMD_NEW_FLAG) && !(sdcmd & SDCMD_FAIL_FLAG) && retries; -+ retries--) { -+ cpu_relax(); - sdcmd = bcm2835_sdhost_read(host, SDCMD); - } --#ifdef DEBUG -- do_gettimeofday(&after); -- timediff = (after.tv_sec - before.tv_sec)*1000000 + -- (after.tv_usec - before.tv_usec); - -- pr_debug(" finish_command - waited %dus\n", timediff); --#endif -+ if (!retries) { -+ unsigned long wait_max; ++static struct config_item_type of_cfs_type = { ++ .ct_group_ops = &of_cfs_ops, ++ .ct_owner = THIS_MODULE, ++}; + -+ if (!irq_flags) { -+ /* Schedule the work */ -+ log_event("CWWQ", 0, 0); -+ schedule_work(&host->cmd_wait_wq); -+ return; -+ } ++struct config_group of_cfs_overlay_group; + -+ /* Wait max 100 ms */ -+ wait_max = jiffies + msecs_to_jiffies(100); -+ while (time_before(jiffies, wait_max)) { -+ spin_unlock_irqrestore(&host->lock, *irq_flags); -+ usleep_range(1, 10); -+ spin_lock_irqsave(&host->lock, *irq_flags); -+ sdcmd = bcm2835_sdhost_read(host, SDCMD); -+ if (!(sdcmd & SDCMD_NEW_FLAG) || -+ (sdcmd & SDCMD_FAIL_FLAG)) -+ break; -+ } ++static struct configfs_subsystem of_cfs_subsys = { ++ .su_group = { ++ .cg_item = { ++ .ci_namebuf = "device-tree", ++ .ci_type = &of_cfs_type, ++ }, ++ }, ++ .su_mutex = __MUTEX_INITIALIZER(of_cfs_subsys.su_mutex), ++}; ++ ++static int __init of_cfs_init(void) ++{ ++ int ret; ++ ++ pr_info("%s\n", __func__); ++ ++ config_group_init(&of_cfs_subsys.su_group); ++ config_group_init_type_name(&of_cfs_overlay_group, "overlays", ++ &overlays_type); ++ configfs_add_default_group(&of_cfs_overlay_group, ++ &of_cfs_subsys.su_group); ++ ++ ret = configfs_register_subsystem(&of_cfs_subsys); ++ if (ret != 0) { ++ pr_err("%s: failed to register subsys\n", __func__); ++ goto out; + } ++ pr_info("%s: OK\n", __func__); ++out: ++ return ret; ++} ++late_initcall(of_cfs_init); + +From 84da37731727b20a8b585757ad3b16f09a1d0073 Mon Sep 17 00:00:00 2001 +From: Cheong2K <cheong@redbear.cc> +Date: Fri, 26 Feb 2016 18:20:10 +0800 +Subject: [PATCH 089/112] brcm: adds support for BCM43341 wifi + +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 2 ++ + drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h | 1 + + 2 files changed, 3 insertions(+) + +diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +index 43fd3f4..c3c7c79 100644 +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +@@ -606,6 +606,7 @@ BRCMF_FW_NVRAM_DEF(4329, "brcmfmac4329-sdio.bin", "brcmfmac4329-sdio.txt"); + BRCMF_FW_NVRAM_DEF(4330, "brcmfmac4330-sdio.bin", "brcmfmac4330-sdio.txt"); + BRCMF_FW_NVRAM_DEF(4334, "brcmfmac4334-sdio.bin", "brcmfmac4334-sdio.txt"); + BRCMF_FW_NVRAM_DEF(43340, "brcmfmac43340-sdio.bin", "brcmfmac43340-sdio.txt"); ++BRCMF_FW_NVRAM_DEF(43341, "brcmfmac43341-sdio.bin", "brcmfmac43341-sdio.txt"); + BRCMF_FW_NVRAM_DEF(4335, "brcmfmac4335-sdio.bin", "brcmfmac4335-sdio.txt"); + BRCMF_FW_NVRAM_DEF(43362, "brcmfmac43362-sdio.bin", "brcmfmac43362-sdio.txt"); + BRCMF_FW_NVRAM_DEF(4339, "brcmfmac4339-sdio.bin", "brcmfmac4339-sdio.txt"); +@@ -622,6 +623,7 @@ static struct brcmf_firmware_mapping brcmf_sdio_fwnames[] = { + BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4330_CHIP_ID, 0xFFFFFFFF, 4330), + BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4334_CHIP_ID, 0xFFFFFFFF, 4334), + BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43340_CHIP_ID, 0xFFFFFFFF, 43340), ++ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43341_CHIP_ID, 0xFFFFFFFF, 43341), + BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4335_CHIP_ID, 0xFFFFFFFF, 4335), + BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43362_CHIP_ID, 0xFFFFFFFE, 43362), + BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4339_CHIP_ID, 0xFFFFFFFF, 4339), +diff --git a/drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h b/drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h +index 699f2c2..15598b3 100644 +--- a/drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h ++++ b/drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h +@@ -35,6 +35,7 @@ + #define BRCM_CC_4330_CHIP_ID 0x4330 + #define BRCM_CC_4334_CHIP_ID 0x4334 + #define BRCM_CC_43340_CHIP_ID 43340 ++#define BRCM_CC_43341_CHIP_ID 43341 + #define BRCM_CC_43362_CHIP_ID 43362 + #define BRCM_CC_4335_CHIP_ID 0x4335 + #define BRCM_CC_4339_CHIP_ID 0x4339 + +From 48b27165b0d028e22700c9c760ee28758191e153 Mon Sep 17 00:00:00 2001 +From: Phil Elwell <phil@raspberrypi.org> +Date: Wed, 9 Mar 2016 17:25:59 +0000 +Subject: [PATCH 090/112] brcmfmac: Disable power management + +Disable wireless power saving in the brcmfmac WLAN driver. This is a +temporary measure until the connectivity loss resulting from power +saving is resolved. + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +index d5c2a27..5a08f59 100644 +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +@@ -2623,6 +2623,8 @@ brcmf_cfg80211_set_power_mgmt(struct wiphy *wiphy, struct net_device *ndev, + * preference in cfg struct to apply this to + * FW later while initializing the dongle + */ ++ pr_info("power management disabled\n"); ++ enabled = false; + cfg->pwr_save = enabled; + if (!check_vif_up(ifp->vif)) { -- if (timeout == 0) { -+ /* Check for errors */ -+ if (sdcmd & SDCMD_NEW_FLAG) { - pr_err("%s: command never completed.\n", - mmc_hostname(host->mmc)); - bcm2835_sdhost_dumpregs(host); - host->cmd->error = -EIO; - tasklet_schedule(&host->finish_tasklet); - return; -- } -- -- if (host->flush_fifo) { -- for (timeout = 100; -- (bcm2835_sdhost_read(host, SDHSTS) & SDHSTS_DATA_FLAG) && timeout; -- timeout--) { -- (void)bcm2835_sdhost_read(host, SDDATA); -- } -- host->flush_fifo = 0; -- if (timeout == 0) { -- pr_err("%s: FIFO never drained.\n", -- mmc_hostname(host->mmc)); -- bcm2835_sdhost_dumpregs(host); -- host->cmd->error = -EIO; -- tasklet_schedule(&host->finish_tasklet); -- return; -- } -- } -- -- /* Check for errors */ -- if (sdcmd & SDCMD_FAIL_FLAG) -- { -+ } else if (sdcmd & SDCMD_FAIL_FLAG) { - u32 sdhsts = bcm2835_sdhost_read(host, SDHSTS); + +From cf6845399aab2b43a579bc613a8c2b2f4cda5920 Mon Sep 17 00:00:00 2001 +From: Phil Elwell <phil@raspberrypi.org> +Date: Thu, 28 Apr 2016 17:13:47 +0100 +Subject: [PATCH 091/112] brcmfmac: Use original country code as a fallback + +Commit 73345fd212980d2e28a5c6d83801c903bd773680: + + brcmfmac: Configure country code using device specific settings + +prevents region codes from working on devices that lack a region code +translation table. In the event of an absent table, preserve the old +behaviour of using the provided code as-is. + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> +--- + .../wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 20 +++++++++++++++----- + 1 file changed, 15 insertions(+), 5 deletions(-) + +diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +index 5a08f59..ceba7b6 100644 +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +@@ -6516,12 +6516,18 @@ static s32 brcmf_translate_country_code(struct brcmf_pub *drvr, char alpha2[2], + struct brcmfmac_pd_cc *country_codes; + struct brcmfmac_pd_cc_entry *cc; + s32 found_index; ++ char ccode[BRCMF_COUNTRY_BUF_SZ]; ++ int rev; + int i; -+ /* Clear the errors */ -+ bcm2835_sdhost_write(host, SDHSTS_ERROR_MASK, SDHSTS); ++ memcpy(ccode, alpha2, sizeof(ccode)); ++ rev = -1; + - if (host->debug) - pr_info("%s: error detected - CMD %x, HSTS %03x, EDM %x\n", - mmc_hostname(host->mmc), sdcmd, sdhsts, -@@ -1003,7 +1197,7 @@ static void bcm2835_sdhost_finish_command(struct bcm2835_host *host) - mmc_hostname(host->mmc), - host->cmd->opcode); - bcm2835_sdhost_dumpregs(host); -- host->cmd->error = -EIO; -+ host->cmd->error = -EILSEQ; - } - tasklet_schedule(&host->finish_tasklet); - return; -@@ -1018,31 +1212,31 @@ static void bcm2835_sdhost_finish_command(struct bcm2835_host *host) - pr_debug("%s: finish_command %08x %08x %08x %08x\n", - mmc_hostname(host->mmc), - host->cmd->resp[0], host->cmd->resp[1], host->cmd->resp[2], host->cmd->resp[3]); -+ log_event("RSP ", host->cmd->resp[0], host->cmd->resp[1]); - } else { - host->cmd->resp[0] = bcm2835_sdhost_read(host, SDRSP0); - pr_debug("%s: finish_command %08x\n", - mmc_hostname(host->mmc), - host->cmd->resp[0]); -+ log_event("RSP ", host->cmd->resp[0], 0); - } - } - -- host->cmd->error = 0; -- - if (host->cmd == host->mrq->sbc) { - /* Finished CMD23, now send actual command. */ - host->cmd = NULL; -- bcm2835_sdhost_send_command(host, host->mrq->cmd); -- -- if (host->cmd->data && host->use_dma) -- /* DMA transfer starts now, PIO starts after irq */ -- bcm2835_sdhost_transfer_dma(host); -+ if (bcm2835_sdhost_send_command(host, host->mrq->cmd)) { -+ if (host->data && host->dma_desc) -+ /* DMA transfer starts now, PIO starts after irq */ -+ bcm2835_sdhost_start_dma(host); - -- if (!host->use_busy) -- bcm2835_sdhost_finish_command(host); -- } else if (host->cmd == host->mrq->stop) -+ if (!host->use_busy) -+ bcm2835_sdhost_finish_command(host, NULL); -+ } -+ } else if (host->cmd == host->mrq->stop) { - /* Finished CMD12 */ - tasklet_schedule(&host->finish_tasklet); -- else { -+ } else { - /* Processed actual command. */ - host->cmd = NULL; - if (!host->data) -@@ -1050,6 +1244,7 @@ static void bcm2835_sdhost_finish_command(struct bcm2835_host *host) - else if (host->data_complete) - bcm2835_sdhost_transfer_complete(host); - } -+ log_event("FCM>", (u32)host->mrq, (u32)host->cmd); - } - - static void bcm2835_sdhost_timeout(unsigned long data) -@@ -1060,10 +1255,12 @@ static void bcm2835_sdhost_timeout(unsigned long data) - host = (struct bcm2835_host *)data; - - spin_lock_irqsave(&host->lock, flags); -+ log_event("TIM<", 0, 0); - - if (host->mrq) { - pr_err("%s: timeout waiting for hardware interrupt.\n", - mmc_hostname(host->mmc)); -+ log_dump(); - bcm2835_sdhost_dumpregs(host); - - if (host->data) { -@@ -1084,74 +1281,15 @@ static void bcm2835_sdhost_timeout(unsigned long data) - spin_unlock_irqrestore(&host->lock, flags); - } - --static void bcm2835_sdhost_pio_timeout(unsigned long data) -+static void bcm2835_sdhost_busy_irq(struct bcm2835_host *host, u32 intmask) - { -- struct bcm2835_host *host; -- unsigned long flags; -- -- host = (struct bcm2835_host *)data; -- -- spin_lock_irqsave(&host->lock, flags); -- -- if (host->data) { -- u32 sdhsts = bcm2835_sdhost_read(host, SDHSTS); -- -- if (sdhsts & SDHSTS_REW_TIME_OUT) { -- pr_err("%s: transfer timeout\n", -- mmc_hostname(host->mmc)); -- if (host->debug) -- bcm2835_sdhost_dumpregs(host); -- } else { -- pr_err("%s: unexpected transfer timeout\n", -- mmc_hostname(host->mmc)); -- bcm2835_sdhost_dumpregs(host); -- } -- -- bcm2835_sdhost_write(host, SDHSTS_TRANSFER_ERROR_MASK, -- SDHSTS); -- -- host->data->error = -ETIMEDOUT; -- -- bcm2835_sdhost_finish_data(host); -- } -- -- mmiowb(); -- spin_unlock_irqrestore(&host->lock, flags); --} -- --static void bcm2835_sdhost_enable_sdio_irq_nolock(struct bcm2835_host *host, int enable) --{ -- if (enable) -- host->hcfg |= SDHCFG_SDIO_IRPT_EN; -- else -- host->hcfg &= ~SDHCFG_SDIO_IRPT_EN; -- bcm2835_sdhost_write(host, host->hcfg, SDHCFG); -- mmiowb(); --} -- --static void bcm2835_sdhost_enable_sdio_irq(struct mmc_host *mmc, int enable) --{ -- struct bcm2835_host *host = mmc_priv(mmc); -- unsigned long flags; -- -- pr_debug("%s: enable_sdio_irq(%d)\n", mmc_hostname(mmc), enable); -- spin_lock_irqsave(&host->lock, flags); -- bcm2835_sdhost_enable_sdio_irq_nolock(host, enable); -- spin_unlock_irqrestore(&host->lock, flags); --} -- --static u32 bcm2835_sdhost_busy_irq(struct bcm2835_host *host, u32 intmask) --{ -- const u32 handled = (SDHSTS_REW_TIME_OUT | SDHSTS_CMD_TIME_OUT | -- SDHSTS_CRC16_ERROR | SDHSTS_CRC7_ERROR | -- SDHSTS_FIFO_ERROR); -- -+ log_event("IRQB", (u32)host->cmd, intmask); - if (!host->cmd) { - pr_err("%s: got command busy interrupt 0x%08x even " - "though no command operation was in progress.\n", - mmc_hostname(host->mmc), (unsigned)intmask); - bcm2835_sdhost_dumpregs(host); -- return 0; -+ return; - } - - if (!host->use_busy) { -@@ -1159,7 +1297,7 @@ static u32 bcm2835_sdhost_busy_irq(struct bcm2835_host *host, u32 intmask) - "though not expecting one.\n", - mmc_hostname(host->mmc), (unsigned)intmask); - bcm2835_sdhost_dumpregs(host); -- return 0; -+ return; - } - host->use_busy = 0; - -@@ -1182,28 +1320,23 @@ static u32 bcm2835_sdhost_busy_irq(struct bcm2835_host *host, u32 intmask) - } else if (intmask & SDHSTS_CMD_TIME_OUT) - host->cmd->error = -ETIMEDOUT; - -+ log_dump(); - bcm2835_sdhost_dumpregs(host); -- tasklet_schedule(&host->finish_tasklet); - } - else -- bcm2835_sdhost_finish_command(host); -- -- return handled; -+ bcm2835_sdhost_finish_command(host, NULL); - } - --static u32 bcm2835_sdhost_data_irq(struct bcm2835_host *host, u32 intmask) -+static void bcm2835_sdhost_data_irq(struct bcm2835_host *host, u32 intmask) - { -- const u32 handled = (SDHSTS_REW_TIME_OUT | -- SDHSTS_CRC16_ERROR | -- SDHSTS_FIFO_ERROR); -- - /* There are no dedicated data/space available interrupt - status bits, so it is necessary to use the single shared - data/space available FIFO status bits. It is therefore not - an error to get here when there is no data transfer in - progress. */ -+ log_event("IRQD", (u32)host->data, intmask); - if (!host->data) -- return 0; -+ return; - - if (intmask & (SDHSTS_CRC16_ERROR | - SDHSTS_FIFO_ERROR | -@@ -1214,46 +1347,37 @@ static u32 bcm2835_sdhost_data_irq(struct bcm2835_host *host, u32 intmask) - else - host->data->error = -ETIMEDOUT; - -- bcm2835_sdhost_dumpregs(host); -- tasklet_schedule(&host->finish_tasklet); -- return handled; -+ if (host->debug) { -+ log_dump(); -+ bcm2835_sdhost_dumpregs(host); -+ } - } - -- /* Use the block interrupt for writes after the first block */ -- if (host->data->flags & MMC_DATA_WRITE) { -+ if (host->data->error) { -+ bcm2835_sdhost_finish_data(host); -+ } else if (host->data->flags & MMC_DATA_WRITE) { -+ /* Use the block interrupt for writes after the first block */ - host->hcfg &= ~(SDHCFG_DATA_IRPT_EN); - host->hcfg |= SDHCFG_BLOCK_IRPT_EN; - bcm2835_sdhost_write(host, host->hcfg, SDHCFG); -- if (host->data->error) -- bcm2835_sdhost_finish_data(host); -- else -- bcm2835_sdhost_transfer_pio(host); -+ bcm2835_sdhost_transfer_pio(host); - } else { -- if (!host->data->error) { -- bcm2835_sdhost_transfer_pio(host); -- host->blocks--; -- } -+ bcm2835_sdhost_transfer_pio(host); -+ host->blocks--; - if ((host->blocks == 0) || host->data->error) - bcm2835_sdhost_finish_data(host); - } -- -- return handled; - } - --static u32 bcm2835_sdhost_block_irq(struct bcm2835_host *host, u32 intmask) -+static void bcm2835_sdhost_block_irq(struct bcm2835_host *host, u32 intmask) - { -- struct dma_chan *dma_chan; -- u32 dir_data; -- const u32 handled = (SDHSTS_REW_TIME_OUT | -- SDHSTS_CRC16_ERROR | -- SDHSTS_FIFO_ERROR); -- -+ log_event("IRQK", (u32)host->data, intmask); - if (!host->data) { - pr_err("%s: got block interrupt 0x%08x even " - "though no data operation was in progress.\n", - mmc_hostname(host->mmc), (unsigned)intmask); - bcm2835_sdhost_dumpregs(host); -- return handled; -+ return; - } - - if (intmask & (SDHSTS_CRC16_ERROR | -@@ -1265,149 +1389,69 @@ static u32 bcm2835_sdhost_block_irq(struct bcm2835_host *host, u32 intmask) - else - host->data->error = -ETIMEDOUT; - -- if (host->debug) -+ if (host->debug) { -+ log_dump(); - bcm2835_sdhost_dumpregs(host); -- tasklet_schedule(&host->finish_tasklet); -- return handled; -+ } + country_codes = drvr->settings->country_codes; + if (!country_codes) { +- brcmf_dbg(TRACE, "No country codes configured for device\n"); +- return -EINVAL; ++ brcmf_dbg(TRACE, "No country codes configured for device" ++ " - use requested value\n"); ++ goto use_input_value; } -- if (!host->use_dma) { -+ if (!host->dma_desc) { - BUG_ON(!host->blocks); -- host->blocks--; -- if ((host->blocks == 0) || host->data->error) { -- /* Cancel the timer */ -- del_timer(&host->pio_timer); -- -+ if (host->data->error || (--host->blocks == 0)) { - bcm2835_sdhost_finish_data(host); - } else { -- /* Reset the timer */ -- mod_timer(&host->pio_timer, -- jiffies + host->pio_timeout); -- - bcm2835_sdhost_transfer_pio(host); -- -- /* Reset the timer */ -- mod_timer(&host->pio_timer, -- jiffies + host->pio_timeout); - } - } else if (host->data->flags & MMC_DATA_WRITE) { -- dma_chan = host->dma_chan_tx; -- dir_data = DMA_TO_DEVICE; -- dma_unmap_sg(dma_chan->device->dev, -- host->data->sg, host->data->sg_len, -- dir_data); -- - bcm2835_sdhost_finish_data(host); + if ((alpha2[0] == ccreq->country_abbrev[0]) && +@@ -6545,10 +6551,14 @@ static s32 brcmf_translate_country_code(struct brcmf_pub *drvr, char alpha2[2], + brcmf_dbg(TRACE, "No country code match found\n"); + return -EINVAL; } -- -- return handled; - } - -- - static irqreturn_t bcm2835_sdhost_irq(int irq, void *dev_id) - { - irqreturn_t result = IRQ_NONE; - struct bcm2835_host *host = dev_id; -- u32 unexpected = 0, early = 0; -- int loops = 0; -+ u32 intmask; - - spin_lock(&host->lock); - -- for (loops = 0; loops < 1; loops++) { -- u32 intmask, handled; -- -- intmask = bcm2835_sdhost_read(host, SDHSTS); -- handled = intmask & (SDHSTS_BUSY_IRPT | -- SDHSTS_BLOCK_IRPT | -- SDHSTS_SDIO_IRPT | -- SDHSTS_DATA_FLAG); -- if ((handled == SDHSTS_DATA_FLAG) && -- (loops == 0) && !host->data) { -- pr_err("%s: sdhost_irq data interrupt 0x%08x even " -- "though no data operation was in progress.\n", -- mmc_hostname(host->mmc), -- (unsigned)intmask); -- -- bcm2835_sdhost_dumpregs(host); -- } -- -- if (!handled) -- break; -+ intmask = bcm2835_sdhost_read(host, SDHSTS); -+ log_event("IRQ<", intmask, 0); - -- if (loops) -- early |= handled; -+ bcm2835_sdhost_write(host, -+ SDHSTS_BUSY_IRPT | -+ SDHSTS_BLOCK_IRPT | -+ SDHSTS_SDIO_IRPT | -+ SDHSTS_DATA_FLAG, -+ SDHSTS); - -+ if (intmask & SDHSTS_BLOCK_IRPT) { -+ bcm2835_sdhost_block_irq(host, intmask); - result = IRQ_HANDLED; -+ } - -- /* Clear all interrupts and notifications */ -- bcm2835_sdhost_write(host, intmask, SDHSTS); -- -- if (intmask & SDHSTS_BUSY_IRPT) -- handled |= bcm2835_sdhost_busy_irq(host, intmask); -- -- /* There is no true data interrupt status bit, so it is -- necessary to qualify the data flag with the interrupt -- enable bit */ -- if ((intmask & SDHSTS_DATA_FLAG) && -- (host->hcfg & SDHCFG_DATA_IRPT_EN)) -- handled |= bcm2835_sdhost_data_irq(host, intmask); -- -- if (intmask & SDHSTS_BLOCK_IRPT) -- handled |= bcm2835_sdhost_block_irq(host, intmask); -- -- if (intmask & SDHSTS_SDIO_IRPT) { -- bcm2835_sdhost_enable_sdio_irq_nolock(host, false); -- host->thread_isr |= SDHSTS_SDIO_IRPT; -- result = IRQ_WAKE_THREAD; -- } -+ if (intmask & SDHSTS_BUSY_IRPT) { -+ bcm2835_sdhost_busy_irq(host, intmask); -+ result = IRQ_HANDLED; -+ } - -- unexpected |= (intmask & ~handled); -+ /* There is no true data interrupt status bit, so it is -+ necessary to qualify the data flag with the interrupt -+ enable bit */ -+ if ((intmask & SDHSTS_DATA_FLAG) && -+ (host->hcfg & SDHCFG_DATA_IRPT_EN)) { -+ bcm2835_sdhost_data_irq(host, intmask); -+ result = IRQ_HANDLED; +- memset(ccreq, 0, sizeof(*ccreq)); +- ccreq->rev = cpu_to_le32(country_codes->table[found_index].rev); +- memcpy(ccreq->ccode, country_codes->table[found_index].cc, ++ rev = country_codes->table[found_index].rev; ++ memcpy(ccode, country_codes->table[found_index].cc, + BRCMF_COUNTRY_BUF_SZ); ++ ++use_input_value: ++ memset(ccreq, 0, sizeof(*ccreq)); ++ ccreq->rev = cpu_to_le32(rev); ++ memcpy(ccreq->ccode, ccode, sizeof(ccode)); + ccreq->country_abbrev[0] = alpha2[0]; + ccreq->country_abbrev[1] = alpha2[1]; + ccreq->country_abbrev[2] = 0; + +From 57720f476dafd8ad6d218c75d816df912d572d01 Mon Sep 17 00:00:00 2001 +From: Phil Elwell <phil@raspberrypi.org> +Date: Thu, 19 May 2016 15:36:09 +0100 +Subject: [PATCH 092/112] brcmfmac: Plug memory leak in brcmf_fill_bss_param + +See: https://github.com/raspberrypi/linux/issues/1471 + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +index ceba7b6..afb0154 100644 +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +@@ -2413,7 +2413,7 @@ static void brcmf_fill_bss_param(struct brcmf_if *ifp, struct station_info *si) + WL_BSS_INFO_MAX); + if (err) { + brcmf_err("Failed to get bss info (%d)\n", err); +- return; ++ goto out_err; } - - mmiowb(); - -+ log_event("IRQ>", bcm2835_sdhost_read(host, SDHSTS), 0); - spin_unlock(&host->lock); - -- if (early) -- pr_debug("%s: early %x (loops %d)\n", -- mmc_hostname(host->mmc), early, loops); -- -- if (unexpected) { -- pr_err("%s: unexpected interrupt 0x%08x.\n", -- mmc_hostname(host->mmc), unexpected); -- bcm2835_sdhost_dumpregs(host); -- } -- - return result; + si->filled |= BIT(NL80211_STA_INFO_BSS_PARAM); + si->bss_param.beacon_interval = le16_to_cpu(buf->bss_le.beacon_period); +@@ -2425,6 +2425,9 @@ static void brcmf_fill_bss_param(struct brcmf_if *ifp, struct station_info *si) + si->bss_param.flags |= BSS_PARAM_FLAGS_SHORT_PREAMBLE; + if (capability & WLAN_CAPABILITY_SHORT_SLOT_TIME) + si->bss_param.flags |= BSS_PARAM_FLAGS_SHORT_SLOT_TIME; ++ ++out_err: ++ kfree(buf); } --static irqreturn_t bcm2835_sdhost_thread_irq(int irq, void *dev_id) --{ -- struct bcm2835_host *host = dev_id; -- unsigned long flags; -- u32 isr; -- -- spin_lock_irqsave(&host->lock, flags); -- isr = host->thread_isr; -- host->thread_isr = 0; -- spin_unlock_irqrestore(&host->lock, flags); -- -- if (isr & SDHSTS_SDIO_IRPT) { -- sdio_run_irqs(host->mmc); -- --/* Is this necessary? Why re-enable an interrupt which is enabled? -- spin_lock_irqsave(&host->lock, flags); -- if (host->flags & SDHSTS_SDIO_IRPT_ENABLED) -- bcm2835_sdhost_enable_sdio_irq_nolock(host, true); -- spin_unlock_irqrestore(&host->lock, flags); --*/ -- } -- -- return isr ? IRQ_HANDLED : IRQ_NONE; --} -- -- -- - void bcm2835_sdhost_set_clock(struct bcm2835_host *host, unsigned int clock) - { - int div = 0; /* Initialized for compiler warning */ -@@ -1417,9 +1461,8 @@ void bcm2835_sdhost_set_clock(struct bcm2835_host *host, unsigned int clock) - pr_info("%s: set_clock(%d)\n", mmc_hostname(host->mmc), clock); + static s32 + +From b83945eb624ddcfbf5687cbb64b3e502765b8847 Mon Sep 17 00:00:00 2001 +From: Phil Elwell <phil@raspberrypi.org> +Date: Thu, 17 Dec 2015 13:37:07 +0000 +Subject: [PATCH 093/112] hci_h5: Don't send conf_req when ACTIVE + +Without this patch, a modem and kernel can continuously bombard each +other with conf_req and conf_rsp messages, in a demented game of tag. +--- + drivers/bluetooth/hci_h5.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/bluetooth/hci_h5.c b/drivers/bluetooth/hci_h5.c +index 0879d64..5161ab3 100644 +--- a/drivers/bluetooth/hci_h5.c ++++ b/drivers/bluetooth/hci_h5.c +@@ -310,7 +310,8 @@ static void h5_handle_internal_rx(struct hci_uart *hu) + h5_link_control(hu, conf_req, 3); + } else if (memcmp(data, conf_req, 2) == 0) { + h5_link_control(hu, conf_rsp, 2); +- h5_link_control(hu, conf_req, 3); ++ if (h5->state != H5_ACTIVE) ++ h5_link_control(hu, conf_req, 3); + } else if (memcmp(data, conf_rsp, 2) == 0) { + if (H5_HDR_LEN(hdr) > 2) + h5->tx_win = (data[2] & 0x07); + +From b233a26228b7db2f5ce2dcf40cf27c9461661335 Mon Sep 17 00:00:00 2001 +From: Eric Anholt <eric@anholt.net> +Date: Fri, 22 Jan 2016 13:06:39 -0800 +Subject: [PATCH 094/112] drm/vc4: Add a debugfs node for tracking execution + state. + +Signed-off-by: Eric Anholt <eric@anholt.net> +--- + drivers/gpu/drm/vc4/vc4_debugfs.c | 1 + + drivers/gpu/drm/vc4/vc4_drv.h | 1 + + drivers/gpu/drm/vc4/vc4_gem.c | 14 ++++++++++++++ + 3 files changed, 16 insertions(+) + +diff --git a/drivers/gpu/drm/vc4/vc4_debugfs.c b/drivers/gpu/drm/vc4/vc4_debugfs.c +index d76ad10..a99aa86 100644 +--- a/drivers/gpu/drm/vc4/vc4_debugfs.c ++++ b/drivers/gpu/drm/vc4/vc4_debugfs.c +@@ -17,6 +17,7 @@ - if ((host->overclock_50 > 50) && -- (clock == 50*MHZ)) { -+ (clock == 50*MHZ)) - clock = host->overclock_50 * MHZ + (MHZ - 1); -- } + static const struct drm_info_list vc4_debugfs_list[] = { + {"bo_stats", vc4_bo_stats_debugfs, 0}, ++ {"gem_exec", vc4_gem_exec_debugfs, 0}, + {"hdmi_regs", vc4_hdmi_debugfs_regs, 0}, + {"hvs_regs", vc4_hvs_debugfs_regs, 0}, + {"crtc0_regs", vc4_crtc_debugfs_regs, 0, (void *)(uintptr_t)0}, +diff --git a/drivers/gpu/drm/vc4/vc4_drv.h b/drivers/gpu/drm/vc4/vc4_drv.h +index fa2ad15..f092986 100644 +--- a/drivers/gpu/drm/vc4/vc4_drv.h ++++ b/drivers/gpu/drm/vc4/vc4_drv.h +@@ -440,6 +440,7 @@ void vc4_job_handle_completed(struct vc4_dev *vc4); + int vc4_queue_seqno_cb(struct drm_device *dev, + struct vc4_seqno_cb *cb, uint64_t seqno, + void (*func)(struct vc4_seqno_cb *cb)); ++int vc4_gem_exec_debugfs(struct seq_file *m, void *arg); - /* The SDCDIV register has 11 bits, and holds (div - 2). - But in data mode the max is 50MHz wihout a minimum, and only the -@@ -1466,6 +1509,11 @@ void bcm2835_sdhost_set_clock(struct bcm2835_host *host, unsigned int clock) - clock = host->max_clk / (div + 2); - host->mmc->actual_clock = clock; + /* vc4_hdmi.c */ + extern struct platform_driver vc4_hdmi_driver; +diff --git a/drivers/gpu/drm/vc4/vc4_gem.c b/drivers/gpu/drm/vc4/vc4_gem.c +index 8d4384f..aa4517c 100644 +--- a/drivers/gpu/drm/vc4/vc4_gem.c ++++ b/drivers/gpu/drm/vc4/vc4_gem.c +@@ -32,6 +32,20 @@ + #include "vc4_regs.h" + #include "vc4_trace.h" -+ /* Calibrate some delays */ ++#ifdef CONFIG_DEBUG_FS ++int vc4_gem_exec_debugfs(struct seq_file *m, void *unused) ++{ ++ struct drm_info_node *node = (struct drm_info_node *)m->private; ++ struct drm_device *dev = node->minor->dev; ++ struct vc4_dev *vc4 = to_vc4_dev(dev); + -+ host->ns_per_fifo_word = (1000000000/clock) * -+ ((host->mmc->caps & MMC_CAP_4_BIT_DATA) ? 8 : 32); ++ seq_printf(m, "Emitted seqno: 0x%016llx\n", vc4->emit_seqno); ++ seq_printf(m, "Finished seqno: 0x%016llx\n", vc4->finished_seqno); ++ ++ return 0; ++} ++#endif /* CONFIG_DEBUG_FS */ + - if (clock > input_clock) { - /* Save the closest value, to make it easier - to reduce in the event of error */ -@@ -1501,6 +1549,7 @@ static void bcm2835_sdhost_request(struct mmc_host *mmc, struct mmc_request *mrq + static void + vc4_queue_hangcheck(struct drm_device *dev) { - struct bcm2835_host *host; - unsigned long flags; -+ u32 edm, fsm; - - host = mmc_priv(mmc); + +From 9e309d7f765e380b8e707659ab9ed4b182dc22f6 Mon Sep 17 00:00:00 2001 +From: Eric Anholt <eric@anholt.net> +Date: Mon, 25 Jan 2016 13:03:33 -0800 +Subject: [PATCH 095/112] drm/vc4: Include vc4_drm.h in uapi in downstream + build. + +Signed-off-by: Eric Anholt <eric@anholt.net> +--- + include/uapi/drm/Kbuild | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/include/uapi/drm/Kbuild b/include/uapi/drm/Kbuild +index 9355dd8..68828bf 100644 +--- a/include/uapi/drm/Kbuild ++++ b/include/uapi/drm/Kbuild +@@ -15,6 +15,7 @@ header-y += radeon_drm.h + header-y += savage_drm.h + header-y += sis_drm.h + header-y += tegra_drm.h ++header-y += vc4_drm.h + header-y += via_drm.h + header-y += vmwgfx_drm.h + header-y += msm_drm.h + +From 8ebc53b4f06a2076f30f0ec77153af7dcb5d1edb Mon Sep 17 00:00:00 2001 +From: Phil Elwell <phil@raspberrypi.org> +Date: Wed, 30 Mar 2016 17:23:15 +0100 +Subject: [PATCH 096/112] cpufreq: Temporarily ignore io_is_busy=1 + +To speed testing of the new sdhost driver that adapts to changes in +core_freq, hack the on-demand governor to treat io_is_busy=1 as +io_is_busy=0. The io_is_busy feature can still be forced using +io_is_busy=2. + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> +--- + drivers/cpufreq/cpufreq_ondemand.c | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/drivers/cpufreq/cpufreq_ondemand.c b/drivers/cpufreq/cpufreq_ondemand.c +index acd8027..72c5a4c 100644 +--- a/drivers/cpufreq/cpufreq_ondemand.c ++++ b/drivers/cpufreq/cpufreq_ondemand.c +@@ -216,7 +216,12 @@ static ssize_t store_io_is_busy(struct dbs_data *dbs_data, const char *buf, + ret = sscanf(buf, "%u", &input); + if (ret != 1) + return -EINVAL; +- dbs_data->io_is_busy = !!input; ++ // XXX temporary hack ++ if (input > 1) ++ input = 1; ++ else ++ input = 0; ++ dbs_data->io_is_busy = input; -@@ -1521,6 +1570,8 @@ static void bcm2835_sdhost_request(struct mmc_host *mmc, struct mmc_request *mrq - } + /* we need to re-evaluate prev_cpu_idle */ + gov_update_cpu_data(dbs_data); + +From 29509a4b9e47b129d5032bb7c0fdba0a7f9b66b6 Mon Sep 17 00:00:00 2001 +From: popcornmix <popcornmix@gmail.com> +Date: Wed, 27 Apr 2016 16:59:24 +0100 +Subject: [PATCH 097/112] Revert "ASoC: bcm2835: move to use the clock + framework" + +This reverts commit 517e7a1537ae4663268be5d0c0ec62c563b9fc99. +--- + sound/soc/bcm/bcm2835-i2s.c | 284 ++++++++++++++++++++++++++++++++++---------- + 1 file changed, 220 insertions(+), 64 deletions(-) + +diff --git a/sound/soc/bcm/bcm2835-i2s.c b/sound/soc/bcm/bcm2835-i2s.c +index 1c1f221..3303d5f 100644 +--- a/sound/soc/bcm/bcm2835-i2s.c ++++ b/sound/soc/bcm/bcm2835-i2s.c +@@ -37,7 +37,6 @@ + #include <linux/init.h> + #include <linux/io.h> + #include <linux/module.h> +-#include <linux/of_address.h> + #include <linux/slab.h> - /* Reset the error statuses in case this is a retry */ -+ if (mrq->sbc) -+ mrq->sbc->error = 0; - if (mrq->cmd) - mrq->cmd->error = 0; - if (mrq->data) -@@ -1536,28 +1587,58 @@ static void bcm2835_sdhost_request(struct mmc_host *mmc, struct mmc_request *mrq - return; - } + #include <sound/core.h> +@@ -47,6 +46,55 @@ + #include <sound/pcm_params.h> + #include <sound/soc.h> -+ if (host->use_dma && mrq->data && -+ (mrq->data->blocks > host->pio_limit)) -+ bcm2835_sdhost_prepare_dma(host, mrq->data); ++/* Clock registers */ ++#define BCM2835_CLK_PCMCTL_REG 0x00 ++#define BCM2835_CLK_PCMDIV_REG 0x04 ++ ++/* Clock register settings */ ++#define BCM2835_CLK_PASSWD (0x5a000000) ++#define BCM2835_CLK_PASSWD_MASK (0xff000000) ++#define BCM2835_CLK_MASH(v) ((v) << 9) ++#define BCM2835_CLK_FLIP BIT(8) ++#define BCM2835_CLK_BUSY BIT(7) ++#define BCM2835_CLK_KILL BIT(5) ++#define BCM2835_CLK_ENAB BIT(4) ++#define BCM2835_CLK_SRC(v) (v) ++ ++#define BCM2835_CLK_SHIFT (12) ++#define BCM2835_CLK_DIVI(v) ((v) << BCM2835_CLK_SHIFT) ++#define BCM2835_CLK_DIVF(v) (v) ++#define BCM2835_CLK_DIVF_MASK (0xFFF) + - spin_lock_irqsave(&host->lock, flags); - - WARN_ON(host->mrq != NULL); -- - host->mrq = mrq; - -- if (mrq->sbc) -- bcm2835_sdhost_send_command(host, mrq->sbc); -- else -- bcm2835_sdhost_send_command(host, mrq->cmd); -+ edm = bcm2835_sdhost_read(host, SDEDM); -+ fsm = edm & SDEDM_FSM_MASK; - -- mmiowb(); -- spin_unlock_irqrestore(&host->lock, flags); -+ log_event("REQ<", (u32)mrq, edm); -+ if ((fsm != SDEDM_FSM_IDENTMODE) && -+ (fsm != SDEDM_FSM_DATAMODE)) { -+ pr_err("%s: previous command (%d) not complete (EDM %x)\n", -+ mmc_hostname(host->mmc), -+ bcm2835_sdhost_read(host, SDCMD) & SDCMD_CMD_MASK, -+ edm); -+ log_event("REQ!", (u32)mrq, edm); -+ log_dump(); -+ bcm2835_sdhost_dumpregs(host); -+ mrq->cmd->error = -EILSEQ; -+ tasklet_schedule(&host->finish_tasklet); -+ mmiowb(); -+ spin_unlock_irqrestore(&host->lock, flags); -+ return; -+ } - -- if (!mrq->sbc && mrq->cmd->data && host->use_dma) -- /* DMA transfer starts now, PIO starts after irq */ -- bcm2835_sdhost_transfer_dma(host); -+ host->use_sbc = !!mrq->sbc && -+ (host->mrq->data->flags & USE_CMD23_FLAGS); -+ if (host->use_sbc) { -+ if (bcm2835_sdhost_send_command(host, mrq->sbc)) { -+ if (!host->use_busy) -+ bcm2835_sdhost_finish_command(host, &flags); -+ } -+ } else if (bcm2835_sdhost_send_command(host, mrq->cmd)) { -+ if (host->data && host->dma_desc) -+ /* DMA transfer starts now, PIO starts after irq */ -+ bcm2835_sdhost_start_dma(host); - -- if (!host->use_busy) -- bcm2835_sdhost_finish_command(host); --} -+ if (!host->use_busy) -+ bcm2835_sdhost_finish_command(host, &flags); -+ } ++enum { ++ BCM2835_CLK_MASH_0 = 0, ++ BCM2835_CLK_MASH_1, ++ BCM2835_CLK_MASH_2, ++ BCM2835_CLK_MASH_3, ++}; ++ ++enum { ++ BCM2835_CLK_SRC_GND = 0, ++ BCM2835_CLK_SRC_OSC, ++ BCM2835_CLK_SRC_DBG0, ++ BCM2835_CLK_SRC_DBG1, ++ BCM2835_CLK_SRC_PLLA, ++ BCM2835_CLK_SRC_PLLC, ++ BCM2835_CLK_SRC_PLLD, ++ BCM2835_CLK_SRC_HDMI, ++}; ++ ++/* Most clocks are not useable (freq = 0) */ ++static const unsigned int bcm2835_clk_freq[BCM2835_CLK_SRC_HDMI+1] = { ++ [BCM2835_CLK_SRC_GND] = 0, ++ [BCM2835_CLK_SRC_OSC] = 19200000, ++ [BCM2835_CLK_SRC_DBG0] = 0, ++ [BCM2835_CLK_SRC_DBG1] = 0, ++ [BCM2835_CLK_SRC_PLLA] = 0, ++ [BCM2835_CLK_SRC_PLLC] = 0, ++ [BCM2835_CLK_SRC_PLLD] = 500000000, ++ [BCM2835_CLK_SRC_HDMI] = 0, ++}; ++ + /* I2S registers */ + #define BCM2835_I2S_CS_A_REG 0x00 + #define BCM2835_I2S_FIFO_A_REG 0x04 +@@ -110,6 +158,10 @@ + #define BCM2835_I2S_INT_RXR BIT(1) + #define BCM2835_I2S_INT_TXW BIT(0) -+ log_event("CMD ", (u32)mrq->cmd->opcode, -+ mrq->data ? (u32)mrq->data->blksz : 0); -+ mmiowb(); ++/* I2S DMA interface */ ++/* FIXME: Needs IOMMU support */ ++#define BCM2835_VCMMU_SHIFT (0x7E000000 - 0x20000000) + -+ log_event("REQ>", (u32)mrq, 0); -+ spin_unlock_irqrestore(&host->lock, flags); -+} + /* General device struct */ + struct bcm2835_i2s_dev { + struct device *dev; +@@ -117,23 +169,21 @@ struct bcm2835_i2s_dev { + unsigned int fmt; + unsigned int bclk_ratio; + +- struct regmap *i2s_regmap; +- struct clk *clk; +- bool clk_prepared; ++ struct regmap *i2s_regmap; ++ struct regmap *clk_regmap; + }; - static void bcm2835_sdhost_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) + static void bcm2835_i2s_start_clock(struct bcm2835_i2s_dev *dev) { -@@ -1574,6 +1655,8 @@ static void bcm2835_sdhost_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) ++ /* Start the clock if in master mode */ + unsigned int master = dev->fmt & SND_SOC_DAIFMT_MASTER_MASK; - spin_lock_irqsave(&host->lock, flags); +- if (dev->clk_prepared) +- return; +- + switch (master) { + case SND_SOC_DAIFMT_CBS_CFS: + case SND_SOC_DAIFMT_CBS_CFM: +- clk_prepare_enable(dev->clk); +- dev->clk_prepared = true; ++ regmap_update_bits(dev->clk_regmap, BCM2835_CLK_PCMCTL_REG, ++ BCM2835_CLK_PASSWD_MASK | BCM2835_CLK_ENAB, ++ BCM2835_CLK_PASSWD | BCM2835_CLK_ENAB); + break; + default: + break; +@@ -142,9 +192,28 @@ static void bcm2835_i2s_start_clock(struct bcm2835_i2s_dev *dev) -+ log_event("IOS<", ios->clock, 0); + static void bcm2835_i2s_stop_clock(struct bcm2835_i2s_dev *dev) + { +- if (dev->clk_prepared) +- clk_disable_unprepare(dev->clk); +- dev->clk_prepared = false; ++ uint32_t clkreg; ++ int timeout = 1000; ++ ++ /* Stop clock */ ++ regmap_update_bits(dev->clk_regmap, BCM2835_CLK_PCMCTL_REG, ++ BCM2835_CLK_PASSWD_MASK | BCM2835_CLK_ENAB, ++ BCM2835_CLK_PASSWD); ++ ++ /* Wait for the BUSY flag going down */ ++ while (--timeout) { ++ regmap_read(dev->clk_regmap, BCM2835_CLK_PCMCTL_REG, &clkreg); ++ if (!(clkreg & BCM2835_CLK_BUSY)) ++ break; ++ } + - if (!ios->clock || ios->clock != host->clock) { - bcm2835_sdhost_set_clock(host, ios->clock); - host->clock = ios->clock; -@@ -1596,59 +1679,53 @@ static void bcm2835_sdhost_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) - spin_unlock_irqrestore(&host->lock, flags); ++ if (!timeout) { ++ /* KILL the clock */ ++ dev_err(dev->dev, "I2S clock didn't stop. Kill the clock!\n"); ++ regmap_update_bits(dev->clk_regmap, BCM2835_CLK_PCMCTL_REG, ++ BCM2835_CLK_KILL | BCM2835_CLK_PASSWD_MASK, ++ BCM2835_CLK_KILL | BCM2835_CLK_PASSWD); ++ } } --static int bcm2835_sdhost_multi_io_quirk(struct mmc_card *card, -- unsigned int direction, -- u32 blk_pos, int blk_size) -+static struct mmc_host_ops bcm2835_sdhost_ops = { -+ .request = bcm2835_sdhost_request, -+ .set_ios = bcm2835_sdhost_set_ios, -+ .hw_reset = bcm2835_sdhost_reset, -+}; -+ -+static void bcm2835_sdhost_cmd_wait_work(struct work_struct *work) + static void bcm2835_i2s_clear_fifos(struct bcm2835_i2s_dev *dev, +@@ -154,7 +223,8 @@ static void bcm2835_i2s_clear_fifos(struct bcm2835_i2s_dev *dev, + uint32_t syncval; + uint32_t csreg; + uint32_t i2s_active_state; +- bool clk_was_prepared; ++ uint32_t clkreg; ++ uint32_t clk_active_state; + uint32_t off; + uint32_t clr; + +@@ -168,10 +238,15 @@ static void bcm2835_i2s_clear_fifos(struct bcm2835_i2s_dev *dev, + regmap_read(dev->i2s_regmap, BCM2835_I2S_CS_A_REG, &csreg); + i2s_active_state = csreg & (BCM2835_I2S_RXON | BCM2835_I2S_TXON); + ++ regmap_read(dev->clk_regmap, BCM2835_CLK_PCMCTL_REG, &clkreg); ++ clk_active_state = clkreg & BCM2835_CLK_ENAB; ++ + /* Start clock if not running */ +- clk_was_prepared = dev->clk_prepared; +- if (!clk_was_prepared) +- bcm2835_i2s_start_clock(dev); ++ if (!clk_active_state) { ++ regmap_update_bits(dev->clk_regmap, BCM2835_CLK_PCMCTL_REG, ++ BCM2835_CLK_PASSWD_MASK | BCM2835_CLK_ENAB, ++ BCM2835_CLK_PASSWD | BCM2835_CLK_ENAB); ++ } + + /* Stop I2S module */ + regmap_update_bits(dev->i2s_regmap, BCM2835_I2S_CS_A_REG, off, 0); +@@ -205,7 +280,7 @@ static void bcm2835_i2s_clear_fifos(struct bcm2835_i2s_dev *dev, + dev_err(dev->dev, "I2S SYNC error!\n"); + + /* Stop clock if it was not running before */ +- if (!clk_was_prepared) ++ if (!clk_active_state) + bcm2835_i2s_stop_clock(dev); + + /* Restore I2S state */ +@@ -234,9 +309,19 @@ static int bcm2835_i2s_hw_params(struct snd_pcm_substream *substream, + struct snd_soc_dai *dai) { -- /* There is a bug in the host controller hardware that makes -- reading the final sector of the card as part of a multiple read -- problematic. Detect that case and shorten the read accordingly. -- */ - struct bcm2835_host *host; -+ unsigned long flags; - -- host = mmc_priv(card->host); -+ host = container_of(work, struct bcm2835_host, cmd_wait_wq); - -- if (!host->sectors) { -- /* csd.capacity is in weird units - convert to sectors */ -- u32 card_sectors = (card->csd.capacity << (card->csd.read_blkbits - 9)); -- if ((direction == MMC_DATA_READ) && -- ((blk_pos + blk_size) == card_sectors)) -- blk_size--; -- return blk_size; -- } -+ spin_lock_irqsave(&host->lock, flags); + struct bcm2835_i2s_dev *dev = snd_soc_dai_get_drvdata(dai); ++ + unsigned int sampling_rate = params_rate(params); + unsigned int data_length, data_delay, bclk_ratio; + unsigned int ch1pos, ch2pos, mode, format; ++ unsigned int mash = BCM2835_CLK_MASH_1; ++ unsigned int divi, divf, target_frequency; ++ int clk_src = -1; ++ unsigned int master = dev->fmt & SND_SOC_DAIFMT_MASTER_MASK; ++ bool bit_master = (master == SND_SOC_DAIFMT_CBS_CFS ++ || master == SND_SOC_DAIFMT_CBS_CFM); ++ ++ bool frame_master = (master == SND_SOC_DAIFMT_CBS_CFS ++ || master == SND_SOC_DAIFMT_CBM_CFS); + uint32_t csreg; -- if (direction == MMC_DATA_READ) { -- int i; -- int sector; -- for (i = 0; blk_pos > (sector = host->single_read_sectors[i]); i++) -- continue; -+ log_event("CWK<", (u32)host->cmd, (u32)host->mrq); + /* +@@ -258,9 +343,11 @@ static int bcm2835_i2s_hw_params(struct snd_pcm_substream *substream, + switch (params_format(params)) { + case SNDRV_PCM_FORMAT_S16_LE: + data_length = 16; ++ bclk_ratio = 40; + break; + case SNDRV_PCM_FORMAT_S32_LE: + data_length = 32; ++ bclk_ratio = 80; + break; + default: + return -EINVAL; +@@ -269,12 +356,69 @@ static int bcm2835_i2s_hw_params(struct snd_pcm_substream *substream, + /* If bclk_ratio already set, use that one. */ + if (dev->bclk_ratio) + bclk_ratio = dev->bclk_ratio; +- else +- /* otherwise calculate a fitting block ratio */ +- bclk_ratio = 2 * data_length; -- if ((blk_pos + blk_size) > sector) -- blk_size = (blk_pos == sector) ? 1 : (sector - blk_pos); +- /* set target clock rate*/ +- clk_set_rate(dev->clk, sampling_rate * bclk_ratio); + /* -+ * If this tasklet gets rescheduled while running, it will -+ * be run again afterwards but without any active request. ++ * Clock Settings ++ * ++ * The target frequency of the bit clock is ++ * sampling rate * frame length ++ * ++ * Integer mode: ++ * Sampling rates that are multiples of 8000 kHz ++ * can be driven by the oscillator of 19.2 MHz ++ * with an integer divider as long as the frame length ++ * is an integer divider of 19200000/8000=2400 as set up above. ++ * This is no longer possible if the sampling rate ++ * is too high (e.g. 192 kHz), because the oscillator is too slow. ++ * ++ * MASH mode: ++ * For all other sampling rates, it is not possible to ++ * have an integer divider. Approximate the clock ++ * with the MASH module that induces a slight frequency ++ * variance. To minimize that it is best to have the fastest ++ * clock here. That is PLLD with 500 MHz. + */ -+ if (!host->mrq) { -+ spin_unlock_irqrestore(&host->lock, flags); -+ return; - } -- return blk_size; --} - -+ bcm2835_sdhost_finish_command(host, &flags); - --static struct mmc_host_ops bcm2835_sdhost_ops = { -- .request = bcm2835_sdhost_request, -- .set_ios = bcm2835_sdhost_set_ios, -- .enable_sdio_irq = bcm2835_sdhost_enable_sdio_irq, -- .hw_reset = bcm2835_sdhost_reset, -- .multi_io_quirk = bcm2835_sdhost_multi_io_quirk, --}; -+ mmiowb(); ++ target_frequency = sampling_rate * bclk_ratio; ++ clk_src = BCM2835_CLK_SRC_OSC; ++ mash = BCM2835_CLK_MASH_0; ++ ++ if (bcm2835_clk_freq[clk_src] % target_frequency == 0 ++ && bit_master && frame_master) { ++ divi = bcm2835_clk_freq[clk_src] / target_frequency; ++ divf = 0; ++ } else { ++ uint64_t dividend; + -+ log_event("CWK>", (u32)host->cmd, 0); - -+ spin_unlock_irqrestore(&host->lock, flags); -+} - - static void bcm2835_sdhost_tasklet_finish(unsigned long param) - { - struct bcm2835_host *host; - unsigned long flags; - struct mmc_request *mrq; -+ struct dma_chan *terminate_chan = NULL; - - host = (struct bcm2835_host *)param; - - spin_lock_irqsave(&host->lock, flags); - -+ log_event("TSK<", (u32)host->mrq, 0); - /* - * If this tasklet gets rescheduled while running, it will - * be run again afterwards but without any active request. -@@ -1683,11 +1760,23 @@ static void bcm2835_sdhost_tasklet_finish(unsigned long param) - - mmiowb(); - -+ host->dma_desc = NULL; -+ terminate_chan = host->dma_chan; -+ host->dma_chan = NULL; ++ if (!dev->bclk_ratio) { ++ /* ++ * Overwrite bclk_ratio, because the ++ * above trick is not needed or can ++ * not be used. ++ */ ++ bclk_ratio = 2 * data_length; ++ } + - spin_unlock_irqrestore(&host->lock, flags); -- mmc_request_done(host->mmc, mrq); --} - -+ if (terminate_chan) -+ { -+ int err = dmaengine_terminate_all(terminate_chan); -+ if (err) -+ pr_err("%s: failed to terminate DMA (%d)\n", -+ mmc_hostname(host->mmc), err); ++ target_frequency = sampling_rate * bclk_ratio; ++ ++ clk_src = BCM2835_CLK_SRC_PLLD; ++ mash = BCM2835_CLK_MASH_1; ++ ++ dividend = bcm2835_clk_freq[clk_src]; ++ dividend <<= BCM2835_CLK_SHIFT; ++ do_div(dividend, target_frequency); ++ divi = dividend >> BCM2835_CLK_SHIFT; ++ divf = dividend & BCM2835_CLK_DIVF_MASK; + } - -+ mmc_request_done(host->mmc, mrq); -+ log_event("TSK>", (u32)mrq, 0); -+} - - int bcm2835_sdhost_add_host(struct bcm2835_host *host) - { -@@ -1709,10 +1798,10 @@ int bcm2835_sdhost_add_host(struct bcm2835_host *host) - mmc->f_max, mmc->f_min, mmc->max_busy_timeout); - - /* host controller capabilities */ -- mmc->caps |= /* MMC_CAP_SDIO_IRQ |*/ MMC_CAP_4_BIT_DATA | -+ mmc->caps |= - MMC_CAP_SD_HIGHSPEED | MMC_CAP_MMC_HIGHSPEED | - MMC_CAP_NEEDS_POLL | MMC_CAP_HW_RESET | MMC_CAP_ERASE | -- (ALLOW_CMD23 * MMC_CAP_CMD23); -+ ((ALLOW_CMD23_READ|ALLOW_CMD23_WRITE) * MMC_CAP_CMD23); - - spin_lock_init(&host->lock); - -@@ -1722,9 +1811,9 @@ int bcm2835_sdhost_add_host(struct bcm2835_host *host) - pr_err("%s: unable to initialise DMA channels. " - "Falling back to PIO\n", - mmc_hostname(mmc)); -- host->have_dma = false; -+ host->use_dma = false; - } else { -- host->have_dma = true; -+ host->use_dma = true; - - cfg.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; - cfg.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; -@@ -1741,7 +1830,7 @@ int bcm2835_sdhost_add_host(struct bcm2835_host *host) - ret = dmaengine_slave_config(host->dma_chan_rx, &cfg); - } - } else { -- host->have_dma = false; -+ host->use_dma = false; - } - - mmc->max_segs = 128; -@@ -1756,16 +1845,15 @@ int bcm2835_sdhost_add_host(struct bcm2835_host *host) - tasklet_init(&host->finish_tasklet, - bcm2835_sdhost_tasklet_finish, (unsigned long)host); - -- setup_timer(&host->timer, bcm2835_sdhost_timeout, -- (unsigned long)host); -+ INIT_WORK(&host->cmd_wait_wq, bcm2835_sdhost_cmd_wait_work); - -- setup_timer(&host->pio_timer, bcm2835_sdhost_pio_timeout, -+ setup_timer(&host->timer, bcm2835_sdhost_timeout, - (unsigned long)host); - - bcm2835_sdhost_init(host, 0); -- ret = request_threaded_irq(host->irq, bcm2835_sdhost_irq, -- bcm2835_sdhost_thread_irq, -- IRQF_SHARED, mmc_hostname(mmc), host); + -+ ret = request_irq(host->irq, bcm2835_sdhost_irq, 0 /*IRQF_SHARED*/, -+ mmc_hostname(mmc), host); - if (ret) { - pr_err("%s: failed to request IRQ %d: %d\n", - mmc_hostname(mmc), host->irq, ret); -@@ -1776,11 +1864,11 @@ int bcm2835_sdhost_add_host(struct bcm2835_host *host) - mmc_add_host(mmc); - - pio_limit_string[0] = '\0'; -- if (host->have_dma && (host->pio_limit > 0)) -+ if (host->use_dma && (host->pio_limit > 0)) - sprintf(pio_limit_string, " (>%d)", host->pio_limit); - pr_info("%s: %s loaded - DMA %s%s\n", - mmc_hostname(mmc), DRIVER_NAME, -- host->have_dma ? "enabled" : "disabled", -+ host->use_dma ? "enabled" : "disabled", - pio_limit_string); - - return 0; -@@ -1810,8 +1898,11 @@ static int bcm2835_sdhost_probe(struct platform_device *pdev) - mmc->ops = &bcm2835_sdhost_ops; - host = mmc_priv(mmc); - host->mmc = mmc; -+ host->cmd_quick_poll_retries = 0; - host->pio_timeout = msecs_to_jiffies(500); -+ host->pio_limit = 1; - host->max_delay = 1; /* Warn if over 1ms */ -+ host->allow_dma = 1; - spin_lock_init(&host->lock); - - iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0); -@@ -1827,13 +1918,12 @@ static int bcm2835_sdhost_probe(struct platform_device *pdev) - return -ENODEV; - } - host->bus_addr = be32_to_cpup(addr); -+ log_init(iomem->start - host->bus_addr); - pr_debug(" - ioaddr %lx, iomem->start %lx, bus_addr %lx\n", - (unsigned long)host->ioaddr, - (unsigned long)iomem->start, - (unsigned long)host->bus_addr); - -- host->allow_dma = ALLOW_DMA; -- - if (node) { - /* Read any custom properties */ - of_property_read_u32(node, -@@ -1845,16 +1935,17 @@ static int bcm2835_sdhost_probe(struct platform_device *pdev) - of_property_read_u32(node, - "brcm,pio-limit", - &host->pio_limit); -- host->allow_dma = ALLOW_DMA && -+ host->allow_dma = - !of_property_read_bool(node, "brcm,force-pio"); - host->debug = of_property_read_bool(node, "brcm,debug"); -- of_property_read_u32(node, -- "brcm,debug-flags", -- &host->debug_flags); - } - -- if (host->debug_flags) -- dev_err(dev, "debug_flags=%x\n", host->debug_flags); -+ host->dma_chan = NULL; -+ host->dma_desc = NULL; ++ /* Set clock divider */ ++ regmap_write(dev->clk_regmap, BCM2835_CLK_PCMDIV_REG, BCM2835_CLK_PASSWD ++ | BCM2835_CLK_DIVI(divi) ++ | BCM2835_CLK_DIVF(divf)); + -+ /* Formally recognise the other way of disabling DMA */ -+ if (host->pio_limit == 0x7fffffff) -+ host->allow_dma = false; - - if (host->allow_dma) { - if (node) { -@@ -1940,15 +2031,12 @@ static int bcm2835_sdhost_remove(struct platform_device *pdev) - return 0; - } ++ /* Setup clock, but don't start it yet */ ++ regmap_write(dev->clk_regmap, BCM2835_CLK_PCMCTL_REG, BCM2835_CLK_PASSWD ++ | BCM2835_CLK_MASH(mash) ++ | BCM2835_CLK_SRC(clk_src)); -- - static const struct of_device_id bcm2835_sdhost_match[] = { - { .compatible = "brcm,bcm2835-sdhost" }, - { } + /* Setup the frame format */ + format = BCM2835_I2S_CHEN; +@@ -548,7 +692,7 @@ static const struct snd_soc_dai_ops bcm2835_i2s_dai_ops = { + .trigger = bcm2835_i2s_trigger, + .hw_params = bcm2835_i2s_hw_params, + .set_fmt = bcm2835_i2s_set_dai_fmt, +- .set_bclk_ratio = bcm2835_i2s_set_dai_bclk_ratio, ++ .set_bclk_ratio = bcm2835_i2s_set_dai_bclk_ratio }; - MODULE_DEVICE_TABLE(of, bcm2835_sdhost_match); -- -- - static struct platform_driver bcm2835_sdhost_driver = { - .probe = bcm2835_sdhost_probe, - .remove = bcm2835_sdhost_remove, - -From d15e041e838bd735a7ed3eaa5dbff785213baf6d Mon Sep 17 00:00:00 2001 -From: Phil Elwell <phil@raspberrypi.org> -Date: Fri, 12 Feb 2016 15:38:00 +0000 -Subject: [PATCH 150/170] BCM270X_DT: Add dtparams for the SD interface - -Add new base dtparams sd_overclock, sd_force_pio, sd_pio_limit -and sd_debug. ---- - arch/arm/boot/dts/bcm2708-rpi-b-plus.dts | 4 ++++ - arch/arm/boot/dts/bcm2708-rpi-b.dts | 4 ++++ - arch/arm/boot/dts/bcm2708-rpi-cm.dts | 1 - - arch/arm/boot/dts/bcm2708-rpi-cm.dtsi | 13 +++++++++++++ - arch/arm/boot/dts/bcm2708_common.dtsi | 2 ++ - arch/arm/boot/dts/bcm2709-rpi-2-b.dts | 4 ++++ - arch/arm/boot/dts/overlays/README | 11 ++++++++++- - arch/arm/boot/dts/overlays/mmc-overlay.dts | 1 - - arch/arm/boot/dts/overlays/sdhost-overlay.dts | 27 +++++++++++++------------- - arch/arm/boot/dts/overlays/sdtweak-overlay.dts | 14 ++++++------- - 10 files changed, 58 insertions(+), 23 deletions(-) - -diff --git a/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts b/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts -index 2e4df17..d2d6fa0 100644 ---- a/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts -+++ b/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts -@@ -141,5 +141,9 @@ - audio = <&audio>,"status"; - watchdog = <&watchdog>,"status"; - random = <&random>,"status"; -+ sd_overclock = <&sdhost>,"brcm,overclock-50:0"; -+ sd_force_pio = <&sdhost>,"brcm,force-pio?"; -+ sd_pio_limit = <&sdhost>,"brcm,pio-limit:0"; -+ sd_debug = <&sdhost>,"brcm,debug"; - }; - }; -diff --git a/arch/arm/boot/dts/bcm2708-rpi-b.dts b/arch/arm/boot/dts/bcm2708-rpi-b.dts -index 0445b46..d033ee4 100644 ---- a/arch/arm/boot/dts/bcm2708-rpi-b.dts -+++ b/arch/arm/boot/dts/bcm2708-rpi-b.dts -@@ -131,5 +131,9 @@ - audio = <&audio>,"status"; - watchdog = <&watchdog>,"status"; - random = <&random>,"status"; -+ sd_overclock = <&sdhost>,"brcm,overclock-50:0"; -+ sd_force_pio = <&sdhost>,"brcm,force-pio?"; -+ sd_pio_limit = <&sdhost>,"brcm,pio-limit:0"; -+ sd_debug = <&sdhost>,"brcm,debug"; - }; - }; -diff --git a/arch/arm/boot/dts/bcm2708-rpi-cm.dts b/arch/arm/boot/dts/bcm2708-rpi-cm.dts -index 87c1a54..8bcafb41 100755 ---- a/arch/arm/boot/dts/bcm2708-rpi-cm.dts -+++ b/arch/arm/boot/dts/bcm2708-rpi-cm.dts -@@ -97,6 +97,5 @@ - i2c0_baudrate = <&i2c0>,"clock-frequency:0"; - i2c1_baudrate = <&i2c1>,"clock-frequency:0"; - i2c2_baudrate = <&i2c2>,"clock-frequency:0"; -- core_freq = <&clk_core>,"clock-frequency:0"; - }; - }; -diff --git a/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi b/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi -index 3c8bdde..e09e499 100644 ---- a/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi -+++ b/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi -@@ -7,6 +7,13 @@ + static int bcm2835_i2s_dai_probe(struct snd_soc_dai *dai) +@@ -606,14 +750,34 @@ static bool bcm2835_i2s_precious_reg(struct device *dev, unsigned int reg) }; - }; + } -+&gpio { -+ sdhost_pins: sdhost_pins { -+ brcm,pins = <48 49 50 51 52 53>; -+ brcm,function = <4>; /* alt0 */ +-static const struct regmap_config bcm2835_regmap_config = { +- .reg_bits = 32, +- .reg_stride = 4, +- .val_bits = 32, +- .max_register = BCM2835_I2S_GRAY_REG, +- .precious_reg = bcm2835_i2s_precious_reg, +- .volatile_reg = bcm2835_i2s_volatile_reg, +- .cache_type = REGCACHE_RBTREE, ++static bool bcm2835_clk_volatile_reg(struct device *dev, unsigned int reg) ++{ ++ switch (reg) { ++ case BCM2835_CLK_PCMCTL_REG: ++ return true; ++ default: ++ return false; + }; -+}; -+ - &leds { - act_led: act { - label = "led0"; -@@ -29,6 +36,8 @@ - - / { - __overrides__ { -+ core_freq = <&clk_core>,"clock-frequency:0"; ++} + - act_led_gpio = <&act_led>,"gpios:4"; - act_led_activelow = <&act_led>,"gpios:8"; - act_led_trigger = <&act_led>,"linux,default-trigger"; -@@ -36,5 +45,9 @@ - audio = <&audio>,"status"; - watchdog = <&watchdog>,"status"; - random = <&random>,"status"; -+ sd_overclock = <&sdhost>,"brcm,overclock-50:0"; -+ sd_force_pio = <&sdhost>,"brcm,force-pio?"; -+ sd_pio_limit = <&sdhost>,"brcm,pio-limit:0"; -+ sd_debug = <&sdhost>,"brcm,debug"; - }; - }; -diff --git a/arch/arm/boot/dts/bcm2708_common.dtsi b/arch/arm/boot/dts/bcm2708_common.dtsi -index 75fb4ce..18d3c45 100644 ---- a/arch/arm/boot/dts/bcm2708_common.dtsi -+++ b/arch/arm/boot/dts/bcm2708_common.dtsi -@@ -135,6 +135,7 @@ - dmas = <&dma 13>, - <&dma 13>; - dma-names = "tx", "rx"; -+ brcm,overclock-50 = <0>; - brcm,pio-limit = <1>; - status = "disabled"; - }; -@@ -203,6 +204,7 @@ - dmas = <&dma 11>, - <&dma 11>; - dma-names = "tx", "rx"; -+ brcm,overclock-50 = <0>; - status = "disabled"; - }; - -diff --git a/arch/arm/boot/dts/bcm2709-rpi-2-b.dts b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts -index 5206ba2..aca253f 100644 ---- a/arch/arm/boot/dts/bcm2709-rpi-2-b.dts -+++ b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts -@@ -141,5 +141,9 @@ - audio = <&audio>,"status"; - watchdog = <&watchdog>,"status"; - random = <&random>,"status"; -+ sd_overclock = <&sdhost>,"brcm,overclock-50:0"; -+ sd_force_pio = <&sdhost>,"brcm,force-pio?"; -+ sd_pio_limit = <&sdhost>,"brcm,pio-limit:0"; -+ sd_debug = <&sdhost>,"brcm,debug"; - }; ++static const struct regmap_config bcm2835_regmap_config[] = { ++ { ++ .reg_bits = 32, ++ .reg_stride = 4, ++ .val_bits = 32, ++ .max_register = BCM2835_I2S_GRAY_REG, ++ .precious_reg = bcm2835_i2s_precious_reg, ++ .volatile_reg = bcm2835_i2s_volatile_reg, ++ .cache_type = REGCACHE_RBTREE, ++ }, ++ { ++ .reg_bits = 32, ++ .reg_stride = 4, ++ .val_bits = 32, ++ .max_register = BCM2835_CLK_PCMDIV_REG, ++ .volatile_reg = bcm2835_clk_volatile_reg, ++ .cache_type = REGCACHE_RBTREE, ++ }, }; -diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README -index f987565..0a2df01 100644 ---- a/arch/arm/boot/dts/overlays/README -+++ b/arch/arm/boot/dts/overlays/README -@@ -112,6 +112,16 @@ Params: - random Set to "on" to enable the hardware random - number generator (default "on") -+ sd_overclock Clock (in MHz) to use when the MMC framework -+ requests 50MHz -+ -+ sd_force_pio Disable DMA support for SD driver (default off) + static const struct snd_soc_component_driver bcm2835_i2s_component = { +@@ -623,50 +787,42 @@ static const struct snd_soc_component_driver bcm2835_i2s_component = { + static int bcm2835_i2s_probe(struct platform_device *pdev) + { + struct bcm2835_i2s_dev *dev; ++ int i; + int ret; +- struct resource *mem; +- void __iomem *base; +- const __be32 *addr; +- dma_addr_t dma_base; ++ struct regmap *regmap[2]; ++ struct resource *mem[2]; + -+ sd_pio_limit Number of blocks above which to use DMA for -+ SD card (default 1) ++ /* Request both ioareas */ ++ for (i = 0; i <= 1; i++) { ++ void __iomem *base; + -+ sd_debug Enable debug output from SD driver (default off) ++ mem[i] = platform_get_resource(pdev, IORESOURCE_MEM, i); ++ base = devm_ioremap_resource(&pdev->dev, mem[i]); ++ if (IS_ERR(base)) ++ return PTR_ERR(base); + - uart0 Set to "off" to disable uart0 (default "on") ++ regmap[i] = devm_regmap_init_mmio(&pdev->dev, base, ++ &bcm2835_regmap_config[i]); ++ if (IS_ERR(regmap[i])) ++ return PTR_ERR(regmap[i]); ++ } - watchdog Set to "on" to enable the hardware watchdog -@@ -443,7 +453,6 @@ Info: Selects the bcm2835-mmc SD/MMC driver, optionally with overclock - Load: dtoverlay=mmc,<param>=<val> - Params: overclock_50 Clock (in MHz) to use when the MMC framework - requests 50MHz -- force_pio Disable DMA support + dev = devm_kzalloc(&pdev->dev, sizeof(*dev), + GFP_KERNEL); + if (!dev) + return -ENOMEM; +- /* get the clock */ +- dev->clk_prepared = false; +- dev->clk = devm_clk_get(&pdev->dev, NULL); +- if (IS_ERR(dev->clk)) { +- dev_err(&pdev->dev, "could not get clk: %ld\n", +- PTR_ERR(dev->clk)); +- return PTR_ERR(dev->clk); +- } +- +- /* Request ioarea */ +- mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); +- base = devm_ioremap_resource(&pdev->dev, mem); +- if (IS_ERR(base)) +- return PTR_ERR(base); +- +- dev->i2s_regmap = devm_regmap_init_mmio(&pdev->dev, base, +- &bcm2835_regmap_config); +- if (IS_ERR(dev->i2s_regmap)) +- return PTR_ERR(dev->i2s_regmap); +- +- /* Set the DMA address - we have to parse DT ourselves */ +- addr = of_get_address(pdev->dev.of_node, 0, NULL, NULL); +- if (!addr) { +- dev_err(&pdev->dev, "could not get DMA-register address\n"); +- return -EINVAL; +- } +- dma_base = be32_to_cpup(addr); ++ dev->i2s_regmap = regmap[0]; ++ dev->clk_regmap = regmap[1]; - Name: mz61581 -diff --git a/arch/arm/boot/dts/overlays/mmc-overlay.dts b/arch/arm/boot/dts/overlays/mmc-overlay.dts -index 00a22be..d32b02c 100644 ---- a/arch/arm/boot/dts/overlays/mmc-overlay.dts -+++ b/arch/arm/boot/dts/overlays/mmc-overlay.dts -@@ -34,6 +34,5 @@ ++ /* Set the DMA address */ + dev->dma_data[SNDRV_PCM_STREAM_PLAYBACK].addr = +- dma_base + BCM2835_I2S_FIFO_A_REG; ++ (dma_addr_t)mem[0]->start + BCM2835_I2S_FIFO_A_REG ++ + BCM2835_VCMMU_SHIFT; - __overrides__ { - overclock_50 = <&frag0>,"brcm,overclock-50:0"; -- force_pio = <&frag0>,"brcm,force-pio?"; - }; - }; -diff --git a/arch/arm/boot/dts/overlays/sdhost-overlay.dts b/arch/arm/boot/dts/overlays/sdhost-overlay.dts -index dbe6574..a431177 100644 ---- a/arch/arm/boot/dts/overlays/sdhost-overlay.dts -+++ b/arch/arm/boot/dts/overlays/sdhost-overlay.dts -@@ -1,19 +1,14 @@ - /dts-v1/; - /plugin/; + dev->dma_data[SNDRV_PCM_STREAM_CAPTURE].addr = +- dma_base + BCM2835_I2S_FIFO_A_REG; ++ (dma_addr_t)mem[0]->start + BCM2835_I2S_FIFO_A_REG ++ + BCM2835_VCMMU_SHIFT; -+/* Provide backwards compatible aliases for the old sdhost dtparams. */ -+ - /{ - compatible = "brcm,bcm2708"; + /* Set the bus width */ + dev->dma_data[SNDRV_PCM_STREAM_PLAYBACK].addr_width = + +From d62af4b3c919fa6330797345e0304d1d0d85e98f Mon Sep 17 00:00:00 2001 +From: Matthias Reichl <hias@horus.com> +Date: Sun, 11 Oct 2015 16:44:05 +0200 +Subject: [PATCH 098/112] bcm2835-i2s: get base address for DMA from devicetree + +Code copied from spi-bcm2835. Get physical address from devicetree +instead of using hardcoded constant. + +Signed-off-by: Matthias Reichl <hias@horus.com> +--- + sound/soc/bcm/bcm2835-i2s.c | 20 ++++++++++++-------- + 1 file changed, 12 insertions(+), 8 deletions(-) + +diff --git a/sound/soc/bcm/bcm2835-i2s.c b/sound/soc/bcm/bcm2835-i2s.c +index 3303d5f..0f25db4 100644 +--- a/sound/soc/bcm/bcm2835-i2s.c ++++ b/sound/soc/bcm/bcm2835-i2s.c +@@ -38,6 +38,7 @@ + #include <linux/io.h> + #include <linux/module.h> + #include <linux/slab.h> ++#include <linux/of_address.h> - fragment@0 { -- target = <&mmc>; -- __overlay__ { -- status = "disabled"; -- }; -- }; -- -- fragment@1 { - target = <&sdhost>; -- frag1: __overlay__ { -+ frag0: __overlay__ { - brcm,overclock-50 = <0>; - brcm,pio-limit = <1>; - brcm,debug-flags = <0>; -@@ -21,11 +16,17 @@ - }; - }; + #include <sound/core.h> + #include <sound/dmaengine_pcm.h> +@@ -158,10 +159,6 @@ static const unsigned int bcm2835_clk_freq[BCM2835_CLK_SRC_HDMI+1] = { + #define BCM2835_I2S_INT_RXR BIT(1) + #define BCM2835_I2S_INT_TXW BIT(0) -+ fragment@1 { -+ target = <&mmc>; -+ __overlay__ { -+ status = "disabled"; -+ }; -+ }; +-/* I2S DMA interface */ +-/* FIXME: Needs IOMMU support */ +-#define BCM2835_VCMMU_SHIFT (0x7E000000 - 0x20000000) +- + /* General device struct */ + struct bcm2835_i2s_dev { + struct device *dev; +@@ -791,6 +788,15 @@ static int bcm2835_i2s_probe(struct platform_device *pdev) + int ret; + struct regmap *regmap[2]; + struct resource *mem[2]; ++ const __be32 *addr; ++ dma_addr_t dma_reg_base; + - __overrides__ { -- overclock_50 = <&frag1>,"brcm,overclock-50:0"; -- force_pio = <&frag1>,"brcm,force-pio?"; -- pio_limit = <&frag1>,"brcm,pio-limit:0"; -- debug = <&frag1>,"brcm,debug?"; -- debug_flags = <&frag1>,"brcm,debug-flags:0"; -+ overclock_50 = <&frag0>,"brcm,overclock-50:0"; -+ force_pio = <&frag0>,"brcm,force-pio?"; -+ pio_limit = <&frag0>,"brcm,pio-limit:0"; -+ debug = <&frag0>,"brcm,debug?"; - }; - }; -diff --git a/arch/arm/boot/dts/overlays/sdtweak-overlay.dts b/arch/arm/boot/dts/overlays/sdtweak-overlay.dts -index b0b208c..e4a4677 100644 ---- a/arch/arm/boot/dts/overlays/sdtweak-overlay.dts -+++ b/arch/arm/boot/dts/overlays/sdtweak-overlay.dts -@@ -1,23 +1,23 @@ - /dts-v1/; - /plugin/; ++ addr = of_get_address(pdev->dev.of_node, 0, NULL, NULL); ++ if (!addr) { ++ dev_err(&pdev->dev, "could not get DMA-register address\n"); ++ return -ENODEV; ++ } ++ dma_reg_base = be32_to_cpup(addr); -+/* Provide backwards compatible aliases for the old sdhost dtparams. */ -+ - /{ - compatible = "brcm,bcm2708"; + /* Request both ioareas */ + for (i = 0; i <= 1; i++) { +@@ -817,12 +823,10 @@ static int bcm2835_i2s_probe(struct platform_device *pdev) - fragment@0 { - target = <&sdhost>; -- frag1: __overlay__ { -+ frag0: __overlay__ { - brcm,overclock-50 = <0>; - brcm,pio-limit = <1>; -- brcm,debug-flags = <0>; - }; - }; + /* Set the DMA address */ + dev->dma_data[SNDRV_PCM_STREAM_PLAYBACK].addr = +- (dma_addr_t)mem[0]->start + BCM2835_I2S_FIFO_A_REG +- + BCM2835_VCMMU_SHIFT; ++ dma_reg_base + BCM2835_I2S_FIFO_A_REG; - __overrides__ { -- overclock_50 = <&frag1>,"brcm,overclock-50:0"; -- force_pio = <&frag1>,"brcm,force-pio?"; -- pio_limit = <&frag1>,"brcm,pio-limit:0"; -- debug = <&frag1>,"brcm,debug?"; -- debug_flags = <&frag1>,"brcm,debug-flags:0"; -+ overclock_50 = <&frag0>,"brcm,overclock-50:0"; -+ force_pio = <&frag0>,"brcm,force-pio?"; -+ pio_limit = <&frag0>,"brcm,pio-limit:0"; -+ debug = <&frag0>,"brcm,debug?"; - }; - }; + dev->dma_data[SNDRV_PCM_STREAM_CAPTURE].addr = +- (dma_addr_t)mem[0]->start + BCM2835_I2S_FIFO_A_REG +- + BCM2835_VCMMU_SHIFT; ++ dma_reg_base + BCM2835_I2S_FIFO_A_REG; + + /* Set the bus width */ + dev->dma_data[SNDRV_PCM_STREAM_PLAYBACK].addr_width = -From bc7400cadff6bf33451b124eac2e8bf80ebb0197 Mon Sep 17 00:00:00 2001 -From: popcornmix <popcornmix@gmail.com> -Date: Fri, 12 Feb 2016 14:50:25 +0000 -Subject: [PATCH 151/170] dcw_otg: trim xfer length when buffer larger than - allocated size is received +From 8a02cd06b98460363d598c1df1a92b05b4dc1ad5 Mon Sep 17 00:00:00 2001 +From: Matthias Reichl <hias@horus.com> +Date: Sun, 11 Oct 2015 15:21:16 +0200 +Subject: [PATCH 099/112] bcm2835-i2s: add 24bit support, update bclk_ratio to + more correct values ---- - drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c | 11 +++++++++++ - 1 file changed, 11 insertions(+) +Code ported from bcm2708-i2s driver in Raspberry Pi tree. -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c b/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c -index 8db3dfc..d672a76 100644 ---- a/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c -+++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c -@@ -737,6 +737,11 @@ static int update_urb_state_xfer_comp(dwc_hc_t * hc, - DWC_OTG_HC_XFER_COMPLETE, - &short_read); - -+ if (urb->actual_length + xfer_length > urb->length) { -+ DWC_WARN("%s(): trimming xfer length\n", __func__); -+ xfer_length = urb->length - urb->actual_length; -+ } -+ - /* non DWORD-aligned buffer case handling. */ - if (hc->align_buff && xfer_length && hc->ep_is_in) { - dwc_memcpy(urb->buf + urb->actual_length, hc->qh->dw_align_buf, -@@ -1423,6 +1428,12 @@ static void update_urb_state_xfer_intr(dwc_hc_t * hc, - { - uint32_t bytes_transferred = get_actual_xfer_length(hc, hc_regs, qtd, - halt_status, NULL); -+ -+ if (urb->actual_length + bytes_transferred > urb->length) { -+ DWC_WARN("%s(): trimming xfer length\n", __func__); -+ bytes_transferred = urb->length - urb->actual_length; -+ } -+ - /* non DWORD-aligned buffer case handling. */ - if (hc->align_buff && bytes_transferred && hc->ep_is_in) { - dwc_memcpy(urb->buf + urb->actual_length, hc->qh->dw_align_buf, +RPi commit 62c05a0b5328d9376d39c9e74da10b8a2465c234 ("ASoC: BCM2708: +Add 24 bit support") -From f395ff998f2bde846499b1a0ef84519989dc2d4e Mon Sep 17 00:00:00 2001 -From: Phil Elwell <phil@raspberrypi.org> -Date: Mon, 15 Feb 2016 10:00:27 +0000 -Subject: [PATCH 152/170] bcm2835-sdhost: Restore ATOMIC flag to PIO sg mapping +This adds 24 bit support to the I2S driver of the BCM2708. +Besides enabling the 24 bit flags, it includes two bug fixes: -Allocation problems have been seen in a wireless driver, and -this is the only change which might have been responsible. +MMAP is not supported. Claiming this leads to strange issues +when the format of driver and file do not match. + +The datasheet states that the width extension bit should be set +for widths greater than 24, but greater or equal would be correct. +This follows from the definition of the width field. + +Signed-off-by: Florian Meier <florian.meier@koalo.de> + +RPi commit 3e8c672bc4e92d457aa4654bbb4cfd79a18a2327 ("bcm2708-i2s: +Update bclk_ratio to more correct values") + +Discussion about blck_ratio affecting sound quality: +https://github.com/raspberrypi/linux/issues/681 + +Signed-off-by: Matthias Reichl <hias@horus.com> --- - drivers/mmc/host/bcm2835-sdhost.c | 7 +++---- - 1 file changed, 3 insertions(+), 4 deletions(-) + sound/soc/bcm/bcm2835-i2s.c | 12 +++++++++--- + 1 file changed, 9 insertions(+), 3 deletions(-) -diff --git a/drivers/mmc/host/bcm2835-sdhost.c b/drivers/mmc/host/bcm2835-sdhost.c -index 262180b..d66385c 100644 ---- a/drivers/mmc/host/bcm2835-sdhost.c -+++ b/drivers/mmc/host/bcm2835-sdhost.c -@@ -874,15 +874,14 @@ static void bcm2835_sdhost_prepare_data(struct bcm2835_host *host, struct mmc_co - host->flush_fifo = 0; - host->data->bytes_xfered = 0; +diff --git a/sound/soc/bcm/bcm2835-i2s.c b/sound/soc/bcm/bcm2835-i2s.c +index 0f25db4..0f35d7c 100644 +--- a/sound/soc/bcm/bcm2835-i2s.c ++++ b/sound/soc/bcm/bcm2835-i2s.c +@@ -340,11 +340,15 @@ static int bcm2835_i2s_hw_params(struct snd_pcm_substream *substream, + switch (params_format(params)) { + case SNDRV_PCM_FORMAT_S16_LE: + data_length = 16; +- bclk_ratio = 40; ++ bclk_ratio = 50; ++ break; ++ case SNDRV_PCM_FORMAT_S24_LE: ++ data_length = 24; ++ bclk_ratio = 50; + break; + case SNDRV_PCM_FORMAT_S32_LE: + data_length = 32; +- bclk_ratio = 80; ++ bclk_ratio = 100; + break; + default: + return -EINVAL; +@@ -420,7 +424,7 @@ static int bcm2835_i2s_hw_params(struct snd_pcm_substream *substream, + /* Setup the frame format */ + format = BCM2835_I2S_CHEN; -- - if (!host->dma_desc) { - /* Use PIO */ -- int flags; -+ int flags = SG_MITER_ATOMIC; +- if (data_length > 24) ++ if (data_length >= 24) + format |= BCM2835_I2S_CHWEX; - if (data->flags & MMC_DATA_READ) -- flags = SG_MITER_TO_SG; -+ flags |= SG_MITER_TO_SG; - else -- flags = SG_MITER_FROM_SG; -+ flags |= SG_MITER_FROM_SG; - sg_miter_start(&host->sg_miter, data->sg, data->sg_len, flags); - host->blocks = data->blocks; - } + format |= BCM2835_I2S_CHWID((data_length-8)&0xf); +@@ -711,6 +715,7 @@ static struct snd_soc_dai_driver bcm2835_i2s_dai = { + .channels_max = 2, + .rates = SNDRV_PCM_RATE_8000_192000, + .formats = SNDRV_PCM_FMTBIT_S16_LE ++ | SNDRV_PCM_FMTBIT_S24_LE + | SNDRV_PCM_FMTBIT_S32_LE + }, + .capture = { +@@ -718,6 +723,7 @@ static struct snd_soc_dai_driver bcm2835_i2s_dai = { + .channels_max = 2, + .rates = SNDRV_PCM_RATE_8000_192000, + .formats = SNDRV_PCM_FMTBIT_S16_LE ++ | SNDRV_PCM_FMTBIT_S24_LE + | SNDRV_PCM_FMTBIT_S32_LE + }, + .ops = &bcm2835_i2s_dai_ops, -From d2943c4ee1c52cb2c9802be194ca90442e4fe34f Mon Sep 17 00:00:00 2001 -From: Phil Elwell <phil@raspberrypi.org> -Date: Tue, 16 Feb 2016 08:47:56 +0000 -Subject: [PATCH 153/170] Revert "Add blk_pos parameter to mmc multi_io_quirk - callback" +From c7032249121b5eb95cfeb1812782c204810dc939 Mon Sep 17 00:00:00 2001 +From: Matthias Reichl <hias@horus.com> +Date: Sun, 11 Oct 2015 15:25:51 +0200 +Subject: [PATCH 100/112] bcm2835-i2s: setup clock only if CPU is clock master -This reverts commit aab95f9b10e8c3d32de2bf163b86f220c88214fe. +Code ported from bcm2708-i2s driver in Raspberry Pi tree. + +RPi commit c14827ecdaa36607f6110f9ce8df96e698672191 ("bcm2708: Allow +option card devices to be configured via DT") -The bcm2835-sdhost driver no longer needs this patch. +Original work by Zoltan Szenczi, committed to RPi tree by +Phil Elwell. + +Signed-off-by: Matthias Reichl <hias@horus.com> --- - drivers/mmc/card/block.c | 1 - - drivers/mmc/host/omap_hsmmc.c | 4 +--- - drivers/mmc/host/sh_mobile_sdhi.c | 4 +--- - drivers/mmc/host/tmio_mmc_pio.c | 4 +--- - include/linux/mmc/host.h | 4 +--- - 5 files changed, 4 insertions(+), 13 deletions(-) + sound/soc/bcm/bcm2835-i2s.c | 28 +++++++++++++++++++--------- + 1 file changed, 19 insertions(+), 9 deletions(-) -diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c -index b35f0c4..d848616 100644 ---- a/drivers/mmc/card/block.c -+++ b/drivers/mmc/card/block.c -@@ -1510,7 +1510,6 @@ static void mmc_blk_rw_rq_prep(struct mmc_queue_req *mqrq, - brq->data.blocks = card->host->ops->multi_io_quirk(card, - (rq_data_dir(req) == READ) ? - MMC_DATA_READ : MMC_DATA_WRITE, -- blk_rq_pos(req), - brq->data.blocks); +diff --git a/sound/soc/bcm/bcm2835-i2s.c b/sound/soc/bcm/bcm2835-i2s.c +index 0f35d7c..d5e4123 100644 +--- a/sound/soc/bcm/bcm2835-i2s.c ++++ b/sound/soc/bcm/bcm2835-i2s.c +@@ -411,15 +411,25 @@ static int bcm2835_i2s_hw_params(struct snd_pcm_substream *substream, + divf = dividend & BCM2835_CLK_DIVF_MASK; } -diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c -index 708d0fa..7fb0753 100644 ---- a/drivers/mmc/host/omap_hsmmc.c -+++ b/drivers/mmc/host/omap_hsmmc.c -@@ -1832,9 +1832,7 @@ static void omap_hsmmc_conf_bus_power(struct omap_hsmmc_host *host) - } - - static int omap_hsmmc_multi_io_quirk(struct mmc_card *card, -- unsigned int direction, -- u32 blk_pos, -- int blk_size) -+ unsigned int direction, int blk_size) - { - /* This controller can't do multiblock reads due to hw bugs */ - if (direction == MMC_DATA_READ) -diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c -index 4f1ccf3..354f4f3 100644 ---- a/drivers/mmc/host/sh_mobile_sdhi.c -+++ b/drivers/mmc/host/sh_mobile_sdhi.c -@@ -170,9 +170,7 @@ static int sh_mobile_sdhi_write16_hook(struct tmio_mmc_host *host, int addr) - } - - static int sh_mobile_sdhi_multi_io_quirk(struct mmc_card *card, -- unsigned int direction, -- u32 blk_pos, -- int blk_size) -+ unsigned int direction, int blk_size) - { - /* - * In Renesas controllers, when performing a -diff --git a/drivers/mmc/host/tmio_mmc_pio.c b/drivers/mmc/host/tmio_mmc_pio.c -index 7b730d8..a10fde4 100644 ---- a/drivers/mmc/host/tmio_mmc_pio.c -+++ b/drivers/mmc/host/tmio_mmc_pio.c -@@ -1003,9 +1003,7 @@ static int tmio_mmc_get_ro(struct mmc_host *mmc) - } - - static int tmio_multi_io_quirk(struct mmc_card *card, -- unsigned int direction, -- u32 blk_pos, -- int blk_size) -+ unsigned int direction, int blk_size) - { - struct tmio_mmc_host *host = mmc_priv(card->host); +- /* Set clock divider */ +- regmap_write(dev->clk_regmap, BCM2835_CLK_PCMDIV_REG, BCM2835_CLK_PASSWD +- | BCM2835_CLK_DIVI(divi) +- | BCM2835_CLK_DIVF(divf)); +- +- /* Setup clock, but don't start it yet */ +- regmap_write(dev->clk_regmap, BCM2835_CLK_PCMCTL_REG, BCM2835_CLK_PASSWD +- | BCM2835_CLK_MASH(mash) +- | BCM2835_CLK_SRC(clk_src)); ++ /* Clock should only be set up here if CPU is clock master */ ++ switch (dev->fmt & SND_SOC_DAIFMT_MASTER_MASK) { ++ case SND_SOC_DAIFMT_CBS_CFS: ++ case SND_SOC_DAIFMT_CBS_CFM: ++ /* Set clock divider */ ++ regmap_write(dev->clk_regmap, BCM2835_CLK_PCMDIV_REG, ++ BCM2835_CLK_PASSWD ++ | BCM2835_CLK_DIVI(divi) ++ | BCM2835_CLK_DIVF(divf)); ++ ++ /* Setup clock, but don't start it yet */ ++ regmap_write(dev->clk_regmap, BCM2835_CLK_PCMCTL_REG, ++ BCM2835_CLK_PASSWD ++ | BCM2835_CLK_MASH(mash) ++ | BCM2835_CLK_SRC(clk_src)); ++ break; ++ default: ++ break; ++ } -diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h -index 105b3e6..ad22ebb 100644 ---- a/include/linux/mmc/host.h -+++ b/include/linux/mmc/host.h -@@ -143,9 +143,7 @@ struct mmc_host_ops { - * I/O. Returns the number of supported blocks for the request. - */ - int (*multi_io_quirk)(struct mmc_card *card, -- unsigned int direction, -- u32 blk_pos, -- int blk_size); -+ unsigned int direction, int blk_size); + /* Setup the frame format */ + format = BCM2835_I2S_CHEN; + +From 1fcff3b17e19175b7fc986f868ac4209abc5a71d Mon Sep 17 00:00:00 2001 +From: Matthias Reichl <hias@horus.com> +Date: Sun, 11 Oct 2015 15:49:51 +0200 +Subject: [PATCH 101/112] bcm2835-i2s: Eliminate debugfs directory error + +Code ported from bcm2708-i2s driver in Raspberry Pi tree. + +RPi commit fd7d7a3dbe9262d16971ef81c234ed28c6499dd7 ("bcm2708: +Eliminate i2s debugfs directory error") + +Qualify the two regmap ranges uses by bcm2708-i2s ('-i2s' and '-clk') +to avoid the name clash when registering debugfs entries. + +Signed-off-by: Matthias Reichl <hias@horus.com> +--- + sound/soc/bcm/bcm2835-i2s.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/sound/soc/bcm/bcm2835-i2s.c b/sound/soc/bcm/bcm2835-i2s.c +index d5e4123..2d29050 100644 +--- a/sound/soc/bcm/bcm2835-i2s.c ++++ b/sound/soc/bcm/bcm2835-i2s.c +@@ -782,6 +782,7 @@ static const struct regmap_config bcm2835_regmap_config[] = { + .precious_reg = bcm2835_i2s_precious_reg, + .volatile_reg = bcm2835_i2s_volatile_reg, + .cache_type = REGCACHE_RBTREE, ++ .name = "i2s", + }, + { + .reg_bits = 32, +@@ -790,6 +791,7 @@ static const struct regmap_config bcm2835_regmap_config[] = { + .max_register = BCM2835_CLK_PCMDIV_REG, + .volatile_reg = bcm2835_clk_volatile_reg, + .cache_type = REGCACHE_RBTREE, ++ .name = "clk", + }, }; - struct mmc_card; -From ee83592659ae5dc5ceee63790a8cba57ebfa57b3 Mon Sep 17 00:00:00 2001 -From: Craig Roberts <cjr@craigroberts.net> -Date: Tue, 16 Feb 2016 10:03:42 +0000 -Subject: [PATCH 154/170] Updated smsc95xx driver to check for a valid MAC - address in eeprom before using smsc95xx.macaddr parameter passed on command - line. +From 46931a1a476d1f1deb4dd654305a911e720bda21 Mon Sep 17 00:00:00 2001 +From: Matthias Reichl <hias@horus.com> +Date: Sun, 11 Oct 2015 15:35:20 +0200 +Subject: [PATCH 102/112] bcm2835-i2s: Register PCM device + +Code ported from bcm2708-i2s driver in Raspberry Pi tree. + +RPi commit ba46b4935a23aa2caac1855ead52a035d4776680 ("ASoC: Add +support for BCM2708") + +This driver adds support for digital audio (I2S) +for the BCM2708 SoC that is used by the +Raspberry Pi. External audio codecs can be +connected to the Raspberry Pi via P5 header. + +It relies on cyclic DMA engine support for BCM2708. + +Signed-off-by: Florian Meier <florian.meier@koalo.de> -The built-in RPi adaptor will still get a MAC address based on the parameter passed on the command line as the RPi hardware does not have an eeprom, -however usb->ethernet adaptors using the same driver should have an eeprom with MAC address as part of their hardware and therefore will use this -meaning they don't end up with the same MAC address as the built-in RPi adaptor. +Signed-off-by: Matthias Reichl <hias@horus.com> --- - drivers/net/usb/smsc95xx.c | 10 +++++----- - 1 file changed, 5 insertions(+), 5 deletions(-) + sound/soc/bcm/bcm2835-i2s.c | 23 ++++++++++++++++++++++- + 1 file changed, 22 insertions(+), 1 deletion(-) -diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c -index 3244a90..7483222 100755 ---- a/drivers/net/usb/smsc95xx.c -+++ b/drivers/net/usb/smsc95xx.c -@@ -817,10 +817,6 @@ static int smsc95xx_is_macaddr_param(struct usbnet *dev, u8 *dev_mac) +diff --git a/sound/soc/bcm/bcm2835-i2s.c b/sound/soc/bcm/bcm2835-i2s.c +index 2d29050..ce93ef0 100644 +--- a/sound/soc/bcm/bcm2835-i2s.c ++++ b/sound/soc/bcm/bcm2835-i2s.c +@@ -799,6 +799,25 @@ static const struct snd_soc_component_driver bcm2835_i2s_component = { + .name = "bcm2835-i2s-comp", + }; - static void smsc95xx_init_mac_address(struct usbnet *dev) ++static const struct snd_pcm_hardware bcm2835_pcm_hardware = { ++ .info = SNDRV_PCM_INFO_INTERLEAVED | ++ SNDRV_PCM_INFO_JOINT_DUPLEX, ++ .formats = SNDRV_PCM_FMTBIT_S16_LE | ++ SNDRV_PCM_FMTBIT_S24_LE | ++ SNDRV_PCM_FMTBIT_S32_LE, ++ .period_bytes_min = 32, ++ .period_bytes_max = 64 * PAGE_SIZE, ++ .periods_min = 2, ++ .periods_max = 255, ++ .buffer_bytes_max = 128 * PAGE_SIZE, ++}; ++ ++static const struct snd_dmaengine_pcm_config bcm2835_dmaengine_pcm_config = { ++ .prepare_slave_config = snd_dmaengine_pcm_prepare_slave_config, ++ .pcm_hardware = &bcm2835_pcm_hardware, ++ .prealloc_buffer_size = 256 * PAGE_SIZE, ++}; ++ + static int bcm2835_i2s_probe(struct platform_device *pdev) { -- /* Check module parameters */ -- if (smsc95xx_is_macaddr_param(dev, dev->net->dev_addr)) -- return; -- - /* try reading mac address from EEPROM */ - if (smsc95xx_read_eeprom(dev, EEPROM_MAC_OFFSET, ETH_ALEN, - dev->net->dev_addr) == 0) { -@@ -831,7 +827,11 @@ static void smsc95xx_init_mac_address(struct usbnet *dev) - } + struct bcm2835_i2s_dev *dev; +@@ -870,7 +889,9 @@ static int bcm2835_i2s_probe(struct platform_device *pdev) + return ret; } -- /* no eeprom, or eeprom values are invalid. generate random MAC */ -+ /* Check module parameters */ -+ if (smsc95xx_is_macaddr_param(dev, dev->net->dev_addr)) -+ return; -+ -+ /* no eeprom, or eeprom values are invalid, and no module parameter specified to set MAC. Generate random MAC */ - eth_hw_addr_random(dev->net); - netif_dbg(dev, ifup, dev->net, "MAC address set to eth_random_addr\n"); - } +- ret = devm_snd_dmaengine_pcm_register(&pdev->dev, NULL, 0); ++ ret = devm_snd_dmaengine_pcm_register(&pdev->dev, ++ &bcm2835_dmaengine_pcm_config, ++ SND_DMAENGINE_PCM_FLAG_COMPAT); + if (ret) { + dev_err(&pdev->dev, "Could not register PCM: %d\n", ret); + return ret; -From 1c43ff69763f4537b76b3248850256da2bda211b Mon Sep 17 00:00:00 2001 -From: popcornmix <popcornmix@gmail.com> -Date: Wed, 17 Feb 2016 19:02:31 +0000 -Subject: [PATCH 155/170] dcw_otg: Make trimming messages less noisy +From 04c99807249213d277900d529ad921edad28af25 Mon Sep 17 00:00:00 2001 +From: Matthias Reichl <hias@horus.com> +Date: Sun, 11 Oct 2015 15:55:21 +0200 +Subject: [PATCH 103/112] bcm2835-i2s: Enable MMAP support via a DT property + +Code ported from bcm2708-i2s driver in Raspberry Pi tree. + +RPi commit 7ee829fd77a30127db5d0b3c7d79b8718166e568 ("bcm2708-i2s: +Enable MMAP support via a DT property and overlay") + +The i2s driver used to claim to support MMAP, but that feature was disabled +when some problems were found. Add the ability to enable this feature +through Device Tree, using the i2s-mmap overlay. +See: #1004 + +Signed-off-by: Matthias Reichl <hias@horus.com> --- - drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c | 6 ++++-- - 1 file changed, 4 insertions(+), 2 deletions(-) + sound/soc/bcm/bcm2835-i2s.c | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c b/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c -index d672a76..e6b38ac3 100644 ---- a/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c -+++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c -@@ -738,7 +738,8 @@ static int update_urb_state_xfer_comp(dwc_hc_t * hc, - &short_read); - - if (urb->actual_length + xfer_length > urb->length) { -- DWC_WARN("%s(): trimming xfer length\n", __func__); -+ printk_once(KERN_DEBUG "dwc_otg: DEVICE:%03d : %s:%d:trimming xfer length\n", -+ hc->dev_addr, __func__, __LINE__); - xfer_length = urb->length - urb->actual_length; - } - -@@ -1430,7 +1431,8 @@ static void update_urb_state_xfer_intr(dwc_hc_t * hc, - halt_status, NULL); +diff --git a/sound/soc/bcm/bcm2835-i2s.c b/sound/soc/bcm/bcm2835-i2s.c +index ce93ef0..6f60c2c 100644 +--- a/sound/soc/bcm/bcm2835-i2s.c ++++ b/sound/soc/bcm/bcm2835-i2s.c +@@ -799,7 +799,7 @@ static const struct snd_soc_component_driver bcm2835_i2s_component = { + .name = "bcm2835-i2s-comp", + }; - if (urb->actual_length + bytes_transferred > urb->length) { -- DWC_WARN("%s(): trimming xfer length\n", __func__); -+ printk_once(KERN_DEBUG "dwc_otg: DEVICE:%03d : %s:%d:trimming xfer length\n", -+ hc->dev_addr, __func__, __LINE__); - bytes_transferred = urb->length - urb->actual_length; +-static const struct snd_pcm_hardware bcm2835_pcm_hardware = { ++static struct snd_pcm_hardware bcm2835_pcm_hardware = { + .info = SNDRV_PCM_INFO_INTERLEAVED | + SNDRV_PCM_INFO_JOINT_DUPLEX, + .formats = SNDRV_PCM_FMTBIT_S16_LE | +@@ -835,6 +835,11 @@ static int bcm2835_i2s_probe(struct platform_device *pdev) } + dma_reg_base = be32_to_cpup(addr); ++ if (of_property_read_bool(pdev->dev.of_node, "brcm,enable-mmap")) ++ bcm2835_pcm_hardware.info |= ++ SNDRV_PCM_INFO_MMAP | ++ SNDRV_PCM_INFO_MMAP_VALID; ++ + /* Request both ioareas */ + for (i = 0; i <= 1; i++) { + void __iomem *base; -From 7f9781f9875f2aa638d5afdaa9709fa1ef9bda8d Mon Sep 17 00:00:00 2001 +From 262486d1cc4f3cf204c012100bd7bfd36f446b37 Mon Sep 17 00:00:00 2001 From: Phil Elwell <phil@raspberrypi.org> -Date: Thu, 18 Feb 2016 15:28:14 +0000 -Subject: [PATCH 156/170] BCM270X_DT: at86rf233 overlay - drop to 3MHz +Date: Thu, 21 Apr 2016 15:44:14 +0100 +Subject: [PATCH 104/112] bcm2835-i2s: Reduce the TX DREQ threshold + +TX FIFO overrun is thought to be the cause of channel swapping, so +reducing the DREQ threshold seems reasonable and appears to be +effective. -The consensus is that 6MHz is too fast, but that 3MHz is OK. +See: https://github.com/raspberrypi/linux/issues/1417 -See: https://github.com/raspberrypi/linux/issues/1294 - https://github.com/raspberrypi/linux/issues/1151 +Signed-off-by: Phil Elwell <phil@raspberrypi.org> --- - arch/arm/boot/dts/overlays/README | 2 +- - arch/arm/boot/dts/overlays/at86rf233-overlay.dts | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) + sound/soc/bcm/bcm2835-i2s.c | 21 ++++++++++++++------- + 1 file changed, 14 insertions(+), 7 deletions(-) -diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README -index 0a2df01..4de0b6f 100644 ---- a/arch/arm/boot/dts/overlays/README -+++ b/arch/arm/boot/dts/overlays/README -@@ -188,7 +188,7 @@ Load: dtoverlay=at86rf233,<param>=<val> - Params: interrupt GPIO used for INT (default 23) - reset GPIO used for Reset (default 24) - sleep GPIO used for Sleep (default 25) -- speed SPI bus speed in Hz (default 6000000) -+ speed SPI bus speed in Hz (default 3000000) - trim Fine tuning of the internal capacitance - arrays (0=+0pF, 15=+4.5pF, default 15) - -diff --git a/arch/arm/boot/dts/overlays/at86rf233-overlay.dts b/arch/arm/boot/dts/overlays/at86rf233-overlay.dts -index 0460269..eab4052 100644 ---- a/arch/arm/boot/dts/overlays/at86rf233-overlay.dts -+++ b/arch/arm/boot/dts/overlays/at86rf233-overlay.dts -@@ -25,7 +25,7 @@ - interrupts = <23 4>; /* active high */ - reset-gpio = <&gpio 24 1>; - sleep-gpio = <&gpio 25 1>; -- spi-max-frequency = <6000000>; -+ spi-max-frequency = <3000000>; - xtal-trim = /bits/ 8 <0xf>; - }; - }; +diff --git a/sound/soc/bcm/bcm2835-i2s.c b/sound/soc/bcm/bcm2835-i2s.c +index 6f60c2c..b26f958 100644 +--- a/sound/soc/bcm/bcm2835-i2s.c ++++ b/sound/soc/bcm/bcm2835-i2s.c +@@ -555,15 +555,22 @@ static int bcm2835_i2s_hw_params(struct snd_pcm_substream *substream, + + /* Setup the DMA parameters */ + regmap_update_bits(dev->i2s_regmap, BCM2835_I2S_CS_A_REG, +- BCM2835_I2S_RXTHR(1) +- | BCM2835_I2S_TXTHR(1) +- | BCM2835_I2S_DMAEN, 0xffffffff); ++ BCM2835_I2S_RXTHR(3) ++ | BCM2835_I2S_TXTHR(3) ++ | BCM2835_I2S_DMAEN, ++ BCM2835_I2S_RXTHR(1) ++ | BCM2835_I2S_TXTHR(1) ++ | BCM2835_I2S_DMAEN); + + regmap_update_bits(dev->i2s_regmap, BCM2835_I2S_DREQ_A_REG, +- BCM2835_I2S_TX_PANIC(0x10) +- | BCM2835_I2S_RX_PANIC(0x30) +- | BCM2835_I2S_TX(0x30) +- | BCM2835_I2S_RX(0x20), 0xffffffff); ++ BCM2835_I2S_TX_PANIC(0x7f) ++ | BCM2835_I2S_RX_PANIC(0x7f) ++ | BCM2835_I2S_TX(0x7f) ++ | BCM2835_I2S_RX(0x7f), ++ BCM2835_I2S_TX_PANIC(0x10) ++ | BCM2835_I2S_RX_PANIC(0x30) ++ | BCM2835_I2S_TX(0x20) ++ | BCM2835_I2S_RX(0x20)); + + /* Clear FIFOs */ + bcm2835_i2s_clear_fifos(dev, true, true); + +From de142c7f01c5fea98e0548d564c08e0084cb4706 Mon Sep 17 00:00:00 2001 +From: Eric Anholt <eric@anholt.net> +Date: Wed, 14 Oct 2015 11:32:14 -0700 +Subject: [PATCH 105/112] drm/vc4: Force HDMI to connected. -From 5af831a3f879c89c8c0b39c8f88e7600bdc3a765 Mon Sep 17 00:00:00 2001 -From: Phil Elwell <phil@raspberrypi.org> -Date: Fri, 19 Feb 2016 12:04:48 +0000 -Subject: [PATCH 157/170] bcm2835-sdhost: Downgrade log message status +For some reason on the downstream tree, the HPD GPIO isn't working. +Signed-off-by: Eric Anholt <eric@anholt.net> --- - drivers/mmc/host/bcm2835-sdhost.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) + drivers/gpu/drm/vc4/vc4_hdmi.c | 2 ++ + 1 file changed, 2 insertions(+) -diff --git a/drivers/mmc/host/bcm2835-sdhost.c b/drivers/mmc/host/bcm2835-sdhost.c -index d66385c..4f6cab5 100644 ---- a/drivers/mmc/host/bcm2835-sdhost.c -+++ b/drivers/mmc/host/bcm2835-sdhost.c -@@ -232,8 +232,8 @@ static void log_init(u32 bus_to_phys) - sdhost_log_buf = dma_zalloc_coherent(NULL, LOG_SIZE, &sdhost_log_addr, - GFP_KERNEL); - if (sdhost_log_buf) { -- pr_err("sdhost: log_buf @ %p (%x)\n", -- sdhost_log_buf, sdhost_log_addr); -+ pr_info("sdhost: log_buf @ %p (%x)\n", -+ sdhost_log_buf, sdhost_log_addr); - timer_base = ioremap_nocache(bus_to_phys + 0x7e003000, SZ_4K); - if (!timer_base) - pr_err("sdhost: failed to remap timer\n"); +diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c +index d8b8649..136847e 100644 +--- a/drivers/gpu/drm/vc4/vc4_hdmi.c ++++ b/drivers/gpu/drm/vc4/vc4_hdmi.c +@@ -166,6 +166,8 @@ vc4_hdmi_connector_detect(struct drm_connector *connector, bool force) + struct drm_device *dev = connector->dev; + struct vc4_dev *vc4 = to_vc4_dev(dev); + ++ return connector_status_connected; ++ + if (vc4->hdmi->hpd_gpio) { + if (gpio_get_value_cansleep(vc4->hdmi->hpd_gpio) ^ + vc4->hdmi->hpd_active_low) -From e08f6b3aad073d8130d2ec0f8398f55983c0eac8 Mon Sep 17 00:00:00 2001 -From: Phil Elwell <phil@raspberrypi.org> -Date: Fri, 15 Jan 2016 16:48:27 +0000 -Subject: [PATCH 158/170] config: Enable HCI over UARTs +From 69dd4dd3bef6d673a6b81f115b83238e70c30e7b Mon Sep 17 00:00:00 2001 +From: Aaron Shaw <shawaj@gmail.com> +Date: Thu, 7 Apr 2016 21:26:21 +0100 +Subject: [PATCH 106/112] Add Support for JustBoom Audio boards +justboom-dac: Adjust for ALSA API change + +As of 4.4, snd_soc_limit_volume now takes a struct snd_soc_card * +rather than a struct snd_soc_codec *. + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> --- - arch/arm/configs/bcm2709_defconfig | 3 +++ - arch/arm/configs/bcmrpi_defconfig | 2 ++ - 2 files changed, 5 insertions(+) + arch/arm/configs/bcm2709_defconfig | 4 +- + arch/arm/configs/bcmrpi_defconfig | 4 +- + sound/soc/bcm/Kconfig | 14 +++ + sound/soc/bcm/Makefile | 4 + + sound/soc/bcm/justboom-dac.c | 162 ++++++++++++++++++++++++++++ + sound/soc/bcm/justboom-digi.c | 215 +++++++++++++++++++++++++++++++++++++ + 6 files changed, 399 insertions(+), 4 deletions(-) + create mode 100644 sound/soc/bcm/justboom-dac.c + create mode 100644 sound/soc/bcm/justboom-digi.c diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig -index fc35254..48ecb2e 100644 +index f42c5eb..055ecfc 100644 --- a/arch/arm/configs/bcm2709_defconfig +++ b/arch/arm/configs/bcm2709_defconfig -@@ -376,6 +376,9 @@ CONFIG_BT_BNEP_PROTO_FILTER=y - CONFIG_BT_HIDP=m - CONFIG_BT_6LOWPAN=m - CONFIG_BT_HCIBTUSB=m -+CONFIG_BT_HCIUART=m -+CONFIG_BT_HCIUART_3WIRE=y -+CONFIG_BT_HCIUART_BCM=y - CONFIG_BT_HCIBCM203X=m - CONFIG_BT_HCIBPA10X=m - CONFIG_BT_HCIBFUSB=m +@@ -856,8 +856,8 @@ CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI=m + CONFIG_SND_BCM2708_SOC_HIFIBERRY_AMP=m + CONFIG_SND_BCM2708_SOC_RPI_DAC=m + CONFIG_SND_BCM2708_SOC_RPI_PROTO=m +-CONFIG_SND_BCM2708_SOC_BOOMBERRY_DAC=m +-CONFIG_SND_BCM2708_SOC_BOOMBERRY_DIGI=m ++CONFIG_SND_BCM2708_SOC_JUSTBOOM_DAC=m ++CONFIG_SND_BCM2708_SOC_JUSTBOOM_DIGI=m + CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC=m + CONFIG_SND_BCM2708_SOC_RASPIDAC3=m + CONFIG_SND_BCM2708_SOC_ADAU1977_ADC=m diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig -index 51dc019..4368f0d 100644 +index 8bd0207..8e0b51f 100644 --- a/arch/arm/configs/bcmrpi_defconfig +++ b/arch/arm/configs/bcmrpi_defconfig -@@ -370,6 +370,8 @@ CONFIG_BT_HIDP=m - CONFIG_BT_6LOWPAN=m - CONFIG_BT_HCIBTUSB=m - CONFIG_BT_HCIUART=m -+CONFIG_BT_HCIUART_3WIRE=y -+CONFIG_BT_HCIUART_BCM=y - CONFIG_BT_HCIBCM203X=m - CONFIG_BT_HCIBPA10X=m - CONFIG_BT_HCIBFUSB=m - -From 20c4c47bca3674d746518b1cca1e066e46b52900 Mon Sep 17 00:00:00 2001 -From: Phil Elwell <phil@raspberrypi.org> -Date: Thu, 17 Dec 2015 13:37:07 +0000 -Subject: [PATCH 159/170] hci_h5: Don't send conf_req when ACTIVE - -Without this patch, a modem and kernel can continuously bombard each -other with conf_req and conf_rsp messages, in a demented game of tag. ---- - drivers/bluetooth/hci_h5.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/drivers/bluetooth/hci_h5.c b/drivers/bluetooth/hci_h5.c -index abee221..2825833 100644 ---- a/drivers/bluetooth/hci_h5.c -+++ b/drivers/bluetooth/hci_h5.c -@@ -314,7 +314,8 @@ static void h5_handle_internal_rx(struct hci_uart *hu) - h5_link_control(hu, conf_req, 3); - } else if (memcmp(data, conf_req, 2) == 0) { - h5_link_control(hu, conf_rsp, 2); -- h5_link_control(hu, conf_req, 3); -+ if (h5->state != H5_ACTIVE) -+ h5_link_control(hu, conf_req, 3); - } else if (memcmp(data, conf_rsp, 2) == 0) { - if (H5_HDR_LEN(hdr) > 2) - h5->tx_win = (data[2] & 7); - -From 00dba6ec2ac004fc17075febd4504646eb3dc543 Mon Sep 17 00:00:00 2001 -From: Phil Elwell <phil@raspberrypi.org> -Date: Tue, 23 Feb 2016 17:26:48 +0000 -Subject: [PATCH 160/170] amba_pl011: Don't use DT aliases for numbering - -The pl011 driver looks for DT aliases of the form "serial<n>", -and if found uses <n> as the device ID. This can cause -/dev/ttyAMA0 to become /dev/ttyAMA1, which is confusing if the -other serial port is provided by the 8250 driver which doesn't -use the same logic. ---- - drivers/tty/serial/amba-pl011.c | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c -index 899a771..68b3353 100644 ---- a/drivers/tty/serial/amba-pl011.c -+++ b/drivers/tty/serial/amba-pl011.c -@@ -2313,7 +2313,12 @@ static int pl011_setup_port(struct device *dev, struct uart_amba_port *uap, - if (IS_ERR(base)) - return PTR_ERR(base); - -+ /* Don't use DT serial<n> aliases - it causes the device to -+ be renumbered to ttyAMA1 if it is the second serial port in the -+ system, even though the other one is ttyS0. The 8250 driver -+ doesn't use this logic, so always remains ttyS0. - index = pl011_probe_dt_alias(index, dev); -+ */ +@@ -848,8 +848,8 @@ CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI=m + CONFIG_SND_BCM2708_SOC_HIFIBERRY_AMP=m + CONFIG_SND_BCM2708_SOC_RPI_DAC=m + CONFIG_SND_BCM2708_SOC_RPI_PROTO=m +-CONFIG_SND_BCM2708_SOC_BOOMBERRY_DAC=m +-CONFIG_SND_BCM2708_SOC_BOOMBERRY_DIGI=m ++CONFIG_SND_BCM2708_SOC_JUSTBOOM_DAC=m ++CONFIG_SND_BCM2708_SOC_JUSTBOOM_DIGI=m + CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC=m + CONFIG_SND_BCM2708_SOC_RASPIDAC3=m + CONFIG_SND_BCM2708_SOC_ADAU1977_ADC=m +diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig +index 1a3f826..e2e2782 100644 +--- a/sound/soc/bcm/Kconfig ++++ b/sound/soc/bcm/Kconfig +@@ -50,6 +50,20 @@ config SND_BCM2708_SOC_RPI_PROTO + help + Say Y or M if you want to add support for Audio Codec Board PROTO (WM8731). - uap->old_cr = 0; - uap->port.dev = dev; - -From 95136c932ac4433a6a50d394817812f8eb2cc914 Mon Sep 17 00:00:00 2001 -From: Eric Anholt <eric@anholt.net> -Date: Tue, 15 Dec 2015 15:35:57 -0800 -Subject: [PATCH 161/170] clk: bcm2835: Add bindings for the auxiliary - peripheral clock gates. - -These will be used for enabling UART1, SPI1, and SPI2. - -Signed-off-by: Eric Anholt <eric@anholt.net> -Acked-by: Rob Herring <robh@kernel.org> -Signed-off-by: Michael Turquette <mturquette@baylibre.com> ---- - .../bindings/clock/brcm,bcm2835-aux-clock.txt | 31 ++++++++++++++++++++++ - include/dt-bindings/clock/bcm2835-aux.h | 17 ++++++++++++ - 2 files changed, 48 insertions(+) - create mode 100644 Documentation/devicetree/bindings/clock/brcm,bcm2835-aux-clock.txt - create mode 100644 include/dt-bindings/clock/bcm2835-aux.h - -diff --git a/Documentation/devicetree/bindings/clock/brcm,bcm2835-aux-clock.txt b/Documentation/devicetree/bindings/clock/brcm,bcm2835-aux-clock.txt -new file mode 100644 -index 0000000..7a837d2 ---- /dev/null -+++ b/Documentation/devicetree/bindings/clock/brcm,bcm2835-aux-clock.txt -@@ -0,0 +1,31 @@ -+Broadcom BCM2835 auxiliary peripheral support -+ -+This binding uses the common clock binding: -+ Documentation/devicetree/bindings/clock/clock-bindings.txt -+ -+The auxiliary peripherals (UART, SPI1, and SPI2) have a small register -+area controlling clock gating to the peripherals, and providing an IRQ -+status register. -+ -+Required properties: -+- compatible: Should be "brcm,bcm2835-aux" -+- #clock-cells: Should be <1>. The permitted clock-specifier values can be -+ found in include/dt-bindings/clock/bcm2835-aux.h -+- reg: Specifies base physical address and size of the registers -+- clocks: The parent clock phandle -+ -+Example: ++config SND_BCM2708_SOC_JUSTBOOM_DAC ++ tristate "Support for JustBoom DAC" ++ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S ++ select SND_SOC_PCM512x ++ help ++ Say Y or M if you want to add support for JustBoom DAC. + -+ clocks: cprman@7e101000 { -+ compatible = "brcm,bcm2835-cprman"; -+ #clock-cells = <1>; -+ reg = <0x7e101000 0x2000>; -+ clocks = <&clk_osc>; -+ }; ++config SND_BCM2708_SOC_JUSTBOOM_DIGI ++ tristate "Support for JustBoom Digi" ++ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S ++ select SND_SOC_WM8804 ++ help ++ Say Y or M if you want to add support for JustBoom Digi. + -+ aux: aux@0x7e215004 { -+ compatible = "brcm,bcm2835-aux"; -+ #clock-cells = <1>; -+ reg = <0x7e215000 0x8>; -+ clocks = <&clocks BCM2835_CLOCK_VPU>; -+ }; -diff --git a/include/dt-bindings/clock/bcm2835-aux.h b/include/dt-bindings/clock/bcm2835-aux.h + config SND_BCM2708_SOC_IQAUDIO_DAC + tristate "Support for IQaudIO-DAC" + depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S +diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile +index b21e11e..6c9714c 100644 +--- a/sound/soc/bcm/Makefile ++++ b/sound/soc/bcm/Makefile +@@ -8,6 +8,8 @@ snd-soc-hifiberry-dac-objs := hifiberry_dac.o + snd-soc-hifiberry-dacplus-objs := hifiberry_dacplus.o + snd-soc-hifiberry-digi-objs := hifiberry_digi.o + snd-soc-hifiberry-amp-objs := hifiberry_amp.o ++snd-soc-justboom-dac-objs := justboom-dac.o ++snd-soc-justboom-digi-objs := justboom-digi.o + snd-soc-rpi-dac-objs := rpi-dac.o + snd-soc-rpi-proto-objs := rpi-proto.o + snd-soc-iqaudio-dac-objs := iqaudio-dac.o +@@ -17,6 +19,8 @@ obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o + obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS) += snd-soc-hifiberry-dacplus.o + obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI) += snd-soc-hifiberry-digi.o + obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_AMP) += snd-soc-hifiberry-amp.o ++obj-$(CONFIG_SND_BCM2708_SOC_JUSTBOOM_DAC) += snd-soc-justboom-dac.o ++obj-$(CONFIG_SND_BCM2708_SOC_JUSTBOOM_DIGI) += snd-soc-justboom-digi.o + obj-$(CONFIG_SND_BCM2708_SOC_RPI_DAC) += snd-soc-rpi-dac.o + obj-$(CONFIG_SND_BCM2708_SOC_RPI_PROTO) += snd-soc-rpi-proto.o + obj-$(CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC) += snd-soc-iqaudio-dac.o +diff --git a/sound/soc/bcm/justboom-dac.c b/sound/soc/bcm/justboom-dac.c new file mode 100644 -index 0000000..d91156e +index 0000000..8fd50db --- /dev/null -+++ b/include/dt-bindings/clock/bcm2835-aux.h -@@ -0,0 +1,17 @@ ++++ b/sound/soc/bcm/justboom-dac.c +@@ -0,0 +1,162 @@ +/* -+ * Copyright (C) 2015 Broadcom Corporation -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License as -+ * published by the Free Software Foundation version 2. ++ * ASoC Driver for JustBoom DAC Raspberry Pi HAT Sound Card + * -+ * This program is distributed "as is" WITHOUT ANY WARRANTY of any -+ * kind, whether express or implied; without even the implied warranty -+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ */ -+ -+#define BCM2835_AUX_CLOCK_UART 0 -+#define BCM2835_AUX_CLOCK_SPI1 1 -+#define BCM2835_AUX_CLOCK_SPI2 2 -+#define BCM2835_AUX_CLOCK_COUNT 3 - -From 924276b92ff47f0e778a9405d00637be4ca88736 Mon Sep 17 00:00:00 2001 -From: Eric Anholt <eric@anholt.net> -Date: Tue, 15 Dec 2015 15:35:58 -0800 -Subject: [PATCH 162/170] clk: bcm2835: Add a driver for the auxiliary - peripheral clock gates. - -There are a pair of SPI masters and a mini UART that were last minute -additions. As a result, they didn't get integrated in the same way as -the other gates off of the VPU clock in CPRMAN. - -Signed-off-by: Eric Anholt <eric@anholt.net> -Signed-off-by: Michael Turquette <mturquette@baylibre.com> - -updated Makefile to preserve the rasoberry pi architectures ---- - drivers/clk/bcm/Makefile | 1 + - drivers/clk/bcm/clk-bcm2835-aux.c | 85 +++++++++++++++++++++++++++++++++++++++ - 2 files changed, 86 insertions(+) - create mode 100644 drivers/clk/bcm/clk-bcm2835-aux.c - -diff --git a/drivers/clk/bcm/Makefile b/drivers/clk/bcm/Makefile -index a1b4cbc..84070d51 100644 ---- a/drivers/clk/bcm/Makefile -+++ b/drivers/clk/bcm/Makefile -@@ -4,6 +4,7 @@ obj-$(CONFIG_CLK_BCM_KONA) += clk-bcm281xx.o - obj-$(CONFIG_CLK_BCM_KONA) += clk-bcm21664.o - obj-$(CONFIG_COMMON_CLK_IPROC) += clk-iproc-armpll.o clk-iproc-pll.o clk-iproc-asiu.o - obj-$(CONFIG_ARCH_BCM2835)$(CONFIG_ARCH_BCM2708)$(CONFIG_ARCH_BCM2709) += clk-bcm2835.o -+obj-$(CONFIG_ARCH_BCM2835) += clk-bcm2835-aux.o - obj-$(CONFIG_COMMON_CLK_IPROC) += clk-ns2.o - obj-$(CONFIG_ARCH_BCM_CYGNUS) += clk-cygnus.o - obj-$(CONFIG_ARCH_BCM_NSP) += clk-nsp.o -diff --git a/drivers/clk/bcm/clk-bcm2835-aux.c b/drivers/clk/bcm/clk-bcm2835-aux.c -new file mode 100644 -index 0000000..e4f89e2 ---- /dev/null -+++ b/drivers/clk/bcm/clk-bcm2835-aux.c -@@ -0,0 +1,85 @@ -+/* -+ * Copyright (C) 2015 Broadcom ++ * Author: Milan Neskovic ++ * Copyright 2016 ++ * based on code by Daniel Matuschek <info@crazy-audio.com> ++ * based on code by Florian Meier <florian.meier@koalo.de> + * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2 of the License, or -+ * (at your option) any later version. ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * version 2 as published by the Free Software Foundation. + * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * General Public License for more details. + */ + -+#include <linux/clk.h> -+#include <linux/clk-provider.h> -+#include <linux/clk/bcm2835.h> +#include <linux/module.h> +#include <linux/platform_device.h> -+#include <dt-bindings/clock/bcm2835-aux.h> -+ -+#define BCM2835_AUXIRQ 0x00 -+#define BCM2835_AUXENB 0x04 -+ -+static int bcm2835_aux_clk_probe(struct platform_device *pdev) -+{ -+ struct device *dev = &pdev->dev; -+ struct clk_onecell_data *onecell; -+ const char *parent; -+ struct clk *parent_clk; -+ struct resource *res; -+ void __iomem *reg, *gate; -+ -+ parent_clk = devm_clk_get(dev, NULL); -+ if (IS_ERR(parent_clk)) -+ return PTR_ERR(parent_clk); -+ parent = __clk_get_name(parent_clk); + -+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); -+ reg = devm_ioremap_resource(dev, res); -+ if (!reg) -+ return -ENODEV; ++#include <sound/core.h> ++#include <sound/pcm.h> ++#include <sound/pcm_params.h> ++#include <sound/soc.h> ++#include <sound/jack.h> + -+ onecell = devm_kmalloc(dev, sizeof(*onecell), GFP_KERNEL); -+ if (!onecell) -+ return -ENOMEM; -+ onecell->clk_num = BCM2835_AUX_CLOCK_COUNT; -+ onecell->clks = devm_kcalloc(dev, BCM2835_AUX_CLOCK_COUNT, -+ sizeof(*onecell->clks), GFP_KERNEL); -+ if (!onecell->clks) -+ return -ENOMEM; ++#include "../codecs/pcm512x.h" + -+ gate = reg + BCM2835_AUXENB; -+ onecell->clks[BCM2835_AUX_CLOCK_UART] = -+ clk_register_gate(dev, "aux_uart", parent, 0, gate, 0, 0, NULL); ++static bool digital_gain_0db_limit = true; + -+ onecell->clks[BCM2835_AUX_CLOCK_SPI1] = -+ clk_register_gate(dev, "aux_spi1", parent, 0, gate, 1, 0, NULL); ++static int snd_rpi_justboom_dac_init(struct snd_soc_pcm_runtime *rtd) ++{ ++ struct snd_soc_codec *codec = rtd->codec; ++ snd_soc_update_bits(codec, PCM512x_GPIO_EN, 0x08, 0x08); ++ snd_soc_update_bits(codec, PCM512x_GPIO_OUTPUT_4, 0xf, 0x02); ++ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x08,0x08); + -+ onecell->clks[BCM2835_AUX_CLOCK_SPI2] = -+ clk_register_gate(dev, "aux_spi2", parent, 0, gate, 2, 0, NULL); ++ if (digital_gain_0db_limit) ++ { ++ int ret; ++ struct snd_soc_card *card = rtd->card; + -+ of_clk_add_provider(pdev->dev.of_node, of_clk_src_onecell_get, onecell); ++ ret = snd_soc_limit_volume(card, "Digital Playback Volume", 207); ++ if (ret < 0) ++ dev_warn(card->dev, "Failed to set volume limit: %d\n", ret); ++ } + + return 0; +} + -+static const struct of_device_id bcm2835_aux_clk_of_match[] = { -+ { .compatible = "brcm,bcm2835-aux", }, -+ {}, -+}; -+MODULE_DEVICE_TABLE(of, bcm2835_aux_clk_of_match); -+ -+static struct platform_driver bcm2835_aux_clk_driver = { -+ .driver = { -+ .name = "bcm2835-aux-clk", -+ .of_match_table = bcm2835_aux_clk_of_match, -+ }, -+ .probe = bcm2835_aux_clk_probe, -+}; -+builtin_platform_driver(bcm2835_aux_clk_driver); -+ -+MODULE_AUTHOR("Eric Anholt <eric@anholt.net>"); -+MODULE_DESCRIPTION("BCM2835 auxiliary peripheral clock driver"); -+MODULE_LICENSE("GPL v2"); - -From 43477e669f736f6da34afbd8a96683b239b1fd1f Mon Sep 17 00:00:00 2001 -From: Fraser <github@frasersdev.net> -Date: Tue, 23 Feb 2016 10:04:37 +1100 -Subject: [PATCH 163/170] Aux SPI 1&2 implementation - -Adds aux spi 1 & 2 devices to compatible raspberry PIs. -* Minor config of the driver build environment to ensure they get built -for CONFIG_ARCH_BCM2708 & CONFIG_ARCH_BCM2709 devices. -* Adds the aux spi driver into the defconfigs as a module. -* Adds the auxiliary and spi1/2 devices into the device tree in a -disabled state -* Provides decide tree overlays which enables the devices and gives -users a degree of control over how they are setup. ---- - arch/arm/boot/dts/bcm2708_common.dtsi | 34 ++++++++- - arch/arm/boot/dts/overlays/Makefile | 6 ++ - arch/arm/boot/dts/overlays/README | 99 +++++++++++++++++++++++++ - arch/arm/boot/dts/overlays/spi1-1cs-overlay.dts | 57 ++++++++++++++ - arch/arm/boot/dts/overlays/spi1-2cs-overlay.dts | 69 +++++++++++++++++ - arch/arm/boot/dts/overlays/spi1-3cs-overlay.dts | 81 ++++++++++++++++++++ - arch/arm/boot/dts/overlays/spi2-1cs-overlay.dts | 57 ++++++++++++++ - arch/arm/boot/dts/overlays/spi2-2cs-overlay.dts | 69 +++++++++++++++++ - arch/arm/boot/dts/overlays/spi2-3cs-overlay.dts | 81 ++++++++++++++++++++ - arch/arm/configs/bcm2709_defconfig | 1 + - arch/arm/configs/bcmrpi_defconfig | 1 + - drivers/clk/bcm/Makefile | 2 +- - drivers/spi/Kconfig | 2 +- - 13 files changed, 556 insertions(+), 3 deletions(-) - create mode 100644 arch/arm/boot/dts/overlays/spi1-1cs-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/spi1-2cs-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/spi1-3cs-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/spi2-1cs-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/spi2-2cs-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/spi2-3cs-overlay.dts - -diff --git a/arch/arm/boot/dts/bcm2708_common.dtsi b/arch/arm/boot/dts/bcm2708_common.dtsi -index 18d3c45..4f65203 100644 ---- a/arch/arm/boot/dts/bcm2708_common.dtsi -+++ b/arch/arm/boot/dts/bcm2708_common.dtsi -@@ -1,3 +1,4 @@ -+#include <dt-bindings/clock/bcm2835-aux.h> - #include "skeleton.dtsi" - - / { -@@ -5,6 +6,7 @@ - - aliases { - audio = &audio; -+ aux = &aux; - sound = &sound; - soc = &soc; - dma = &dma; -@@ -19,6 +21,8 @@ - spi0 = &spi0; - i2c0 = &i2c0; - uart1 = &uart1; -+ spi1 = &spi1; -+ spi2 = &spi2; - mmc = &mmc; - i2c1 = &i2c1; - i2c2 = &i2c2; -@@ -186,6 +190,14 @@ - status = "disabled"; - }; - -+ aux: aux@0x7e215004 { -+ compatible = "brcm,bcm2835-aux"; -+ #clock-cells = <1>; -+ reg = <0x7e215000 0x8>; -+ clocks = <&clk_core>; -+ status = "disabled"; -+ }; -+ - uart1: uart@7e215040 { - compatible = "brcm,bcm2835-aux-uart", "ns16550"; - reg = <0x7e215040 0x40>; -@@ -194,7 +206,27 @@ - reg-shift = <2>; - no-loopback-test; - status = "disabled"; -- }; -+ }; -+ -+ spi1: spi@7e215080 { -+ compatible = "brcm,bcm2835-aux-spi"; -+ reg = <0x7e215080 0x40>, <0x7e215000 0x8>; -+ interrupts = <1 29>; -+ clocks = <&aux BCM2835_AUX_CLOCK_SPI1>; -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "disabled"; -+ }; -+ -+ spi2: spi@7e2150C0 { -+ compatible = "brcm,bcm2835-aux-spi"; -+ reg = <0x7e2150C0 0x40>, <0x7e215000 0x8>; -+ interrupts = <1 29>; -+ clocks = <&aux BCM2835_AUX_CLOCK_SPI2>; -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "disabled"; -+ }; - - mmc: mmc@7e300000 { - compatible = "brcm,bcm2835-mmc"; -diff --git a/arch/arm/boot/dts/overlays/Makefile b/arch/arm/boot/dts/overlays/Makefile -index 4d9d640..a787d66 100644 ---- a/arch/arm/boot/dts/overlays/Makefile -+++ b/arch/arm/boot/dts/overlays/Makefile -@@ -57,6 +57,12 @@ dtb-$(RPI_DT_OVERLAYS) += sdtweak-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += smi-dev-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += smi-nand-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += smi-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += spi1-1cs-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += spi1-2cs-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += spi1-3cs-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += spi2-1cs-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += spi2-2cs-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += spi2-3cs-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += spi-gpio35-39-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += tinylcd35-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += uart1-overlay.dtb -diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README -index 4de0b6f..cf5f5be 100644 ---- a/arch/arm/boot/dts/overlays/README -+++ b/arch/arm/boot/dts/overlays/README -@@ -713,6 +713,105 @@ Load: dtoverlay=spi-gpio35-39 - Params: <None> - - -+Name: spi1-1cs -+Info: Enables spi1 with a single chip select (CS) line and associated spidev -+ dev node. The gpio pin number for the CS line and spidev device node -+ creation are configurable. -+ N.B.: spi1 is only accessible on devices with a 40pin header, eg: -+ A+, B+, Zero and PI2 B; as well as the Compute Module. -+Load: dtoverlay=spi1-1cs,<param>=<val> -+Params: cs0_pin GPIO pin for CS0 (default 18 - BCM SPI1_CE0). -+ cs0_spidev Set to 'disabled' to stop the creation of a -+ userspace device node /dev/spidev1.0 (default -+ is 'okay' or enabled). -+ -+ -+Name: spi1-2cs -+Info: Enables spi1 with two chip select (CS) lines and associated spidev -+ dev nodes. The gpio pin numbers for the CS lines and spidev device node -+ creation are configurable. -+ N.B.: spi1 is only accessible on devices with a 40pin header, eg: -+ A+, B+, Zero and PI2 B; as well as the Compute Module. -+Load: dtoverlay=spi1-2cs,<param>=<val> -+Params: cs0_pin GPIO pin for CS0 (default 18 - BCM SPI1_CE0). -+ cs1_pin GPIO pin for CS1 (default 17 - BCM SPI1_CE1). -+ cs0_spidev Set to 'disabled' to stop the creation of a -+ userspace device node /dev/spidev1.0 (default -+ is 'okay' or enabled). -+ cs1_spidev Set to 'disabled' to stop the creation of a -+ userspace device node /dev/spidev1.1 (default -+ is 'okay' or enabled). -+ -+ -+Name: spi1-3cs -+Info: Enables spi1 with three chip select (CS) lines and associated spidev -+ dev nodes. The gpio pin numbers for the CS lines and spidev device node -+ creation are configurable. -+ N.B.: spi1 is only accessible on devices with a 40pin header, eg: -+ A+, B+, Zero and PI2 B; as well as the Compute Module. -+Load: dtoverlay=spi1-3cs,<param>=<val> -+Params: cs0_pin GPIO pin for CS0 (default 18 - BCM SPI1_CE0). -+ cs1_pin GPIO pin for CS1 (default 17 - BCM SPI1_CE1). -+ cs2_pin GPIO pin for CS2 (default 16 - BCM SPI1_CE2). -+ cs0_spidev Set to 'disabled' to stop the creation of a -+ userspace device node /dev/spidev1.0 (default -+ is 'okay' or enabled). -+ cs1_spidev Set to 'disabled' to stop the creation of a -+ userspace device node /dev/spidev1.1 (default -+ is 'okay' or enabled). -+ cs2_spidev Set to 'disabled' to stop the creation of a -+ userspace device node /dev/spidev1.2 (default -+ is 'okay' or enabled). -+ -+ -+Name: spi2-1cs -+Info: Enables spi2 with a single chip select (CS) line and associated spidev -+ dev node. The gpio pin number for the CS line and spidev device node -+ creation are configurable. -+ N.B.: spi2 is only accessible with the Compute Module. -+Load: dtoverlay=spi2-1cs,<param>=<val> -+Params: cs0_pin GPIO pin for CS0 (default 43 - BCM SPI2_CE0). -+ cs0_spidev Set to 'disabled' to stop the creation of a -+ userspace device node /dev/spidev2.0 (default -+ is 'okay' or enabled). -+ -+ -+Name: spi2-2cs -+Info: Enables spi2 with two chip select (CS) lines and associated spidev -+ dev nodes. The gpio pin numbers for the CS lines and spidev device node -+ creation are configurable. -+ N.B.: spi2 is only accessible with the Compute Module. -+Load: dtoverlay=spi2-2cs,<param>=<val> -+Params: cs0_pin GPIO pin for CS0 (default 43 - BCM SPI2_CE0). -+ cs1_pin GPIO pin for CS1 (default 44 - BCM SPI2_CE1). -+ cs0_spidev Set to 'disabled' to stop the creation of a -+ userspace device node /dev/spidev2.0 (default -+ is 'okay' or enabled). -+ cs1_spidev Set to 'disabled' to stop the creation of a -+ userspace device node /dev/spidev2.1 (default -+ is 'okay' or enabled). -+ -+ -+Name: spi2-3cs -+Info: Enables spi2 with three chip select (CS) lines and associated spidev -+ dev nodes. The gpio pin numbers for the CS lines and spidev device node -+ creation are configurable. -+ N.B.: spi2 is only accessible with the Compute Module. -+Load: dtoverlay=spi2-3cs,<param>=<val> -+Params: cs0_pin GPIO pin for CS0 (default 43 - BCM SPI2_CE0). -+ cs1_pin GPIO pin for CS1 (default 44 - BCM SPI2_CE1). -+ cs2_pin GPIO pin for CS2 (default 45 - BCM SPI2_CE2). -+ cs0_spidev Set to 'disabled' to stop the creation of a -+ userspace device node /dev/spidev2.0 (default -+ is 'okay' or enabled). -+ cs1_spidev Set to 'disabled' to stop the creation of a -+ userspace device node /dev/spidev2.1 (default -+ is 'okay' or enabled). -+ cs2_spidev Set to 'disabled' to stop the creation of a -+ userspace device node /dev/spidev2.2 (default -+ is 'okay' or enabled). -+ -+ - Name: tinylcd35 - Info: 3.5" Color TFT Display by www.tinylcd.com - Options: Touch, RTC, keypad -diff --git a/arch/arm/boot/dts/overlays/spi1-1cs-overlay.dts b/arch/arm/boot/dts/overlays/spi1-1cs-overlay.dts -new file mode 100644 -index 0000000..71c2439 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/spi1-1cs-overlay.dts -@@ -0,0 +1,57 @@ -+/dts-v1/; -+/plugin/; -+ -+ -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; -+ -+ fragment@0 { -+ target = <&gpio>; -+ __overlay__ { -+ spi1_pins: spi1_pins { -+ brcm,pins = <19 20 21>; -+ brcm,function = <3>; /* alt4 */ -+ }; -+ -+ spi1_cs_pins: spi1_cs_pins { -+ brcm,pins = <18>; -+ brcm,function = <1>; /* output */ -+ }; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&spi1>; -+ frag1: __overlay__ { -+ /* needed to avoid dtc warning */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&spi1_pins &spi1_cs_pins>; -+ cs-gpios = <&gpio 18 1>; -+ status = "okay"; -+ -+ spidev1_0: spidev@0 { -+ compatible = "spidev"; -+ reg = <0>; /* CE0 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; -+ status = "okay"; -+ }; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&aux>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ __overrides__ { -+ cs0_pin = <&spi1_cs_pins>,"brcm,pins:0", -+ <&frag1>,"cs-gpios:4"; -+ cs0_spidev = <&spidev1_0>,"status"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/spi1-2cs-overlay.dts b/arch/arm/boot/dts/overlays/spi1-2cs-overlay.dts -new file mode 100644 -index 0000000..2ae0885 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/spi1-2cs-overlay.dts -@@ -0,0 +1,69 @@ -+/dts-v1/; -+/plugin/; -+ -+ -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; -+ -+ fragment@0 { -+ target = <&gpio>; -+ __overlay__ { -+ spi1_pins: spi1_pins { -+ brcm,pins = <19 20 21>; -+ brcm,function = <3>; /* alt4 */ -+ }; -+ -+ spi1_cs_pins: spi1_cs_pins { -+ brcm,pins = <18 17>; -+ brcm,function = <1>; /* output */ -+ }; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&spi1>; -+ frag1: __overlay__ { -+ /* needed to avoid dtc warning */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&spi1_pins &spi1_cs_pins>; -+ cs-gpios = <&gpio 18 1>, <&gpio 17 1>; -+ status = "okay"; -+ -+ spidev1_0: spidev@0 { -+ compatible = "spidev"; -+ reg = <0>; /* CE0 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; -+ status = "okay"; -+ }; ++static int snd_rpi_justboom_dac_hw_params(struct snd_pcm_substream *substream, ++ struct snd_pcm_hw_params *params) ++{ ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; ++ /*return snd_soc_dai_set_bclk_ratio(cpu_dai, 64);*/ ++ unsigned int sample_bits = ++ snd_pcm_format_physical_width(params_format(params)); ++ return snd_soc_dai_set_bclk_ratio(cpu_dai, sample_bits * 2); ++} + -+ spidev1_1: spidev@1 { -+ compatible = "spidev"; -+ reg = <1>; /* CE1 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; -+ status = "okay"; -+ }; -+ }; -+ }; ++static int snd_rpi_justboom_dac_startup(struct snd_pcm_substream *substream) { ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_codec *codec = rtd->codec; ++ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x08,0x08); ++ return 0; ++} + -+ fragment@2 { -+ target = <&aux>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; ++static void snd_rpi_justboom_dac_shutdown(struct snd_pcm_substream *substream) { ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_codec *codec = rtd->codec; ++ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x08,0x00); ++} + -+ __overrides__ { -+ cs0_pin = <&spi1_cs_pins>,"brcm,pins:0", -+ <&frag1>,"cs-gpios:4"; -+ cs1_pin = <&spi1_cs_pins>,"brcm,pins:4", -+ <&frag1>,"cs-gpios:16"; -+ cs0_spidev = <&spidev1_0>,"status"; -+ cs1_spidev = <&spidev1_1>,"status"; -+ }; ++/* machine stream operations */ ++static struct snd_soc_ops snd_rpi_justboom_dac_ops = { ++ .hw_params = snd_rpi_justboom_dac_hw_params, ++ .startup = snd_rpi_justboom_dac_startup, ++ .shutdown = snd_rpi_justboom_dac_shutdown, +}; -diff --git a/arch/arm/boot/dts/overlays/spi1-3cs-overlay.dts b/arch/arm/boot/dts/overlays/spi1-3cs-overlay.dts -new file mode 100644 -index 0000000..8f79044 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/spi1-3cs-overlay.dts -@@ -0,0 +1,81 @@ -+/dts-v1/; -+/plugin/; -+ -+ -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; -+ -+ fragment@0 { -+ target = <&gpio>; -+ __overlay__ { -+ spi1_pins: spi1_pins { -+ brcm,pins = <19 20 21>; -+ brcm,function = <3>; /* alt4 */ -+ }; -+ -+ spi1_cs_pins: spi1_cs_pins { -+ brcm,pins = <18 17 16>; -+ brcm,function = <1>; /* output */ -+ }; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&spi1>; -+ frag1: __overlay__ { -+ /* needed to avoid dtc warning */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&spi1_pins &spi1_cs_pins>; -+ cs-gpios = <&gpio 18 1>, <&gpio 17 1>, <&gpio 16 1>; -+ status = "okay"; -+ -+ spidev1_0: spidev@0 { -+ compatible = "spidev"; -+ reg = <0>; /* CE0 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; -+ status = "okay"; -+ }; -+ -+ spidev1_1: spidev@1 { -+ compatible = "spidev"; -+ reg = <1>; /* CE1 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; -+ status = "okay"; -+ }; -+ -+ spidev1_2: spidev@2 { -+ compatible = "spidev"; -+ reg = <2>; /* CE2 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; -+ status = "okay"; -+ }; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&aux>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; + -+ __overrides__ { -+ cs0_pin = <&spi1_cs_pins>,"brcm,pins:0", -+ <&frag1>,"cs-gpios:4"; -+ cs1_pin = <&spi1_cs_pins>,"brcm,pins:4", -+ <&frag1>,"cs-gpios:16"; -+ cs2_pin = <&spi1_cs_pins>,"brcm,pins:8", -+ <&frag1>,"cs-gpios:28"; -+ cs0_spidev = <&spidev1_0>,"status"; -+ cs1_spidev = <&spidev1_1>,"status"; -+ cs2_spidev = <&spidev1_2>,"status"; -+ }; ++static struct snd_soc_dai_link snd_rpi_justboom_dac_dai[] = { ++{ ++ .name = "JustBoom DAC", ++ .stream_name = "JustBoom DAC HiFi", ++ .cpu_dai_name = "bcm2708-i2s.0", ++ .codec_dai_name = "pcm512x-hifi", ++ .platform_name = "bcm2708-i2s.0", ++ .codec_name = "pcm512x.1-004d", ++ .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | ++ SND_SOC_DAIFMT_CBS_CFS, ++ .ops = &snd_rpi_justboom_dac_ops, ++ .init = snd_rpi_justboom_dac_init, ++}, +}; -diff --git a/arch/arm/boot/dts/overlays/spi2-1cs-overlay.dts b/arch/arm/boot/dts/overlays/spi2-1cs-overlay.dts -new file mode 100644 -index 0000000..6f57bc7 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/spi2-1cs-overlay.dts -@@ -0,0 +1,57 @@ -+/dts-v1/; -+/plugin/; + -+ -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; -+ -+ fragment@0 { -+ target = <&gpio>; -+ __overlay__ { -+ spi2_pins: spi2_pins { -+ brcm,pins = <40 41 42>; -+ brcm,function = <3>; /* alt4 */ -+ }; -+ -+ spi2_cs_pins: spi2_cs_pins { -+ brcm,pins = <43>; -+ brcm,function = <1>; /* output */ -+ }; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&spi2>; -+ frag1: __overlay__ { -+ /* needed to avoid dtc warning */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&spi2_pins &spi2_cs_pins>; -+ cs-gpios = <&gpio 43 1>; -+ status = "okay"; -+ -+ spidev2_0: spidev@0 { -+ compatible = "spidev"; -+ reg = <0>; /* CE0 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; -+ status = "okay"; -+ }; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&aux>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ __overrides__ { -+ cs0_pin = <&spi2_cs_pins>,"brcm,pins:0", -+ <&frag1>,"cs-gpios:4"; -+ cs0_spidev = <&spidev2_0>,"status"; -+ }; ++/* audio machine driver */ ++static struct snd_soc_card snd_rpi_justboom_dac = { ++ .name = "snd_rpi_justboom_dac", ++ .owner = THIS_MODULE, ++ .dai_link = snd_rpi_justboom_dac_dai, ++ .num_links = ARRAY_SIZE(snd_rpi_justboom_dac_dai), +}; -diff --git a/arch/arm/boot/dts/overlays/spi2-2cs-overlay.dts b/arch/arm/boot/dts/overlays/spi2-2cs-overlay.dts -new file mode 100644 -index 0000000..d090631 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/spi2-2cs-overlay.dts -@@ -0,0 +1,69 @@ -+/dts-v1/; -+/plugin/; + ++static int snd_rpi_justboom_dac_probe(struct platform_device *pdev) ++{ ++ int ret = 0; + -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; ++ snd_rpi_justboom_dac.dev = &pdev->dev; + -+ fragment@0 { -+ target = <&gpio>; -+ __overlay__ { -+ spi2_pins: spi2_pins { -+ brcm,pins = <40 41 42>; -+ brcm,function = <3>; /* alt4 */ -+ }; ++ if (pdev->dev.of_node) { ++ struct device_node *i2s_node; ++ struct snd_soc_dai_link *dai = &snd_rpi_justboom_dac_dai[0]; ++ i2s_node = of_parse_phandle(pdev->dev.of_node, ++ "i2s-controller", 0); + -+ spi2_cs_pins: spi2_cs_pins { -+ brcm,pins = <43 44>; -+ brcm,function = <1>; /* output */ -+ }; -+ }; -+ }; ++ if (i2s_node) { ++ dai->cpu_dai_name = NULL; ++ dai->cpu_of_node = i2s_node; ++ dai->platform_name = NULL; ++ dai->platform_of_node = i2s_node; ++ } + -+ fragment@1 { -+ target = <&spi2>; -+ frag1: __overlay__ { -+ /* needed to avoid dtc warning */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&spi2_pins &spi2_cs_pins>; -+ cs-gpios = <&gpio 43 1>, <&gpio 44 1>; -+ status = "okay"; ++ digital_gain_0db_limit = !of_property_read_bool( ++ pdev->dev.of_node, "justboom,24db_digital_gain"); ++ } + -+ spidev2_0: spidev@0 { -+ compatible = "spidev"; -+ reg = <0>; /* CE0 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; -+ status = "okay"; -+ }; ++ ret = snd_soc_register_card(&snd_rpi_justboom_dac); ++ if (ret) ++ dev_err(&pdev->dev, ++ "snd_soc_register_card() failed: %d\n", ret); + -+ spidev2_1: spidev@1 { -+ compatible = "spidev"; -+ reg = <1>; /* CE1 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; -+ status = "okay"; -+ }; -+ }; -+ }; ++ return ret; ++} + -+ fragment@2 { -+ target = <&aux>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; ++static int snd_rpi_justboom_dac_remove(struct platform_device *pdev) ++{ ++ return snd_soc_unregister_card(&snd_rpi_justboom_dac); ++} + -+ __overrides__ { -+ cs0_pin = <&spi2_cs_pins>,"brcm,pins:0", -+ <&frag1>,"cs-gpios:4"; -+ cs1_pin = <&spi2_cs_pins>,"brcm,pins:4", -+ <&frag1>,"cs-gpios:16"; -+ cs0_spidev = <&spidev2_0>,"status"; -+ cs1_spidev = <&spidev2_1>,"status"; -+ }; ++static const struct of_device_id snd_rpi_justboom_dac_of_match[] = { ++ { .compatible = "justboom,justboom-dac", }, ++ {}, +}; -diff --git a/arch/arm/boot/dts/overlays/spi2-3cs-overlay.dts b/arch/arm/boot/dts/overlays/spi2-3cs-overlay.dts -new file mode 100644 -index 0000000..e258672 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/spi2-3cs-overlay.dts -@@ -0,0 +1,81 @@ -+/dts-v1/; -+/plugin/; -+ -+ -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; -+ -+ fragment@0 { -+ target = <&gpio>; -+ __overlay__ { -+ spi2_pins: spi2_pins { -+ brcm,pins = <40 41 42>; -+ brcm,function = <3>; /* alt4 */ -+ }; -+ -+ spi2_cs_pins: spi2_cs_pins { -+ brcm,pins = <43 44 45>; -+ brcm,function = <1>; /* output */ -+ }; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&spi2>; -+ frag1: __overlay__ { -+ /* needed to avoid dtc warning */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&spi2_pins &spi2_cs_pins>; -+ cs-gpios = <&gpio 43 1>, <&gpio 44 1>, <&gpio 45 1>; -+ status = "okay"; -+ -+ spidev2_0: spidev@0 { -+ compatible = "spidev"; -+ reg = <0>; /* CE0 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; -+ status = "okay"; -+ }; -+ -+ spidev2_1: spidev@1 { -+ compatible = "spidev"; -+ reg = <1>; /* CE1 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; -+ status = "okay"; -+ }; -+ -+ spidev2_2: spidev@2 { -+ compatible = "spidev"; -+ reg = <2>; /* CE2 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; -+ status = "okay"; -+ }; -+ }; -+ }; ++MODULE_DEVICE_TABLE(of, snd_rpi_justboom_dac_of_match); + -+ fragment@2 { -+ target = <&aux>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ __overrides__ { -+ cs0_pin = <&spi2_cs_pins>,"brcm,pins:0", -+ <&frag1>,"cs-gpios:4"; -+ cs1_pin = <&spi2_cs_pins>,"brcm,pins:4", -+ <&frag1>,"cs-gpios:16"; -+ cs2_pin = <&spi2_cs_pins>,"brcm,pins:8", -+ <&frag1>,"cs-gpios:28"; -+ cs0_spidev = <&spidev2_0>,"status"; -+ cs1_spidev = <&spidev2_1>,"status"; -+ cs2_spidev = <&spidev2_2>,"status"; -+ }; ++static struct platform_driver snd_rpi_justboom_dac_driver = { ++ .driver = { ++ .name = "snd-rpi-justboom-dac", ++ .owner = THIS_MODULE, ++ .of_match_table = snd_rpi_justboom_dac_of_match, ++ }, ++ .probe = snd_rpi_justboom_dac_probe, ++ .remove = snd_rpi_justboom_dac_remove, +}; -diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig -index 48ecb2e..76b3a88 100644 ---- a/arch/arm/configs/bcm2709_defconfig -+++ b/arch/arm/configs/bcm2709_defconfig -@@ -601,6 +601,7 @@ CONFIG_I2C_BCM2708=m - CONFIG_I2C_GPIO=m - CONFIG_SPI=y - CONFIG_SPI_BCM2835=m -+CONFIG_SPI_BCM2835AUX=m - CONFIG_SPI_SPIDEV=y - CONFIG_PPS=m - CONFIG_PPS_CLIENT_LDISC=m -diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig -index 4368f0d..1ca1695 100644 ---- a/arch/arm/configs/bcmrpi_defconfig -+++ b/arch/arm/configs/bcmrpi_defconfig -@@ -593,6 +593,7 @@ CONFIG_I2C_BCM2708=m - CONFIG_I2C_GPIO=m - CONFIG_SPI=y - CONFIG_SPI_BCM2835=m -+CONFIG_SPI_BCM2835AUX=m - CONFIG_SPI_SPIDEV=y - CONFIG_PPS=m - CONFIG_PPS_CLIENT_LDISC=m -diff --git a/drivers/clk/bcm/Makefile b/drivers/clk/bcm/Makefile -index 84070d51..d60fd3f 100644 ---- a/drivers/clk/bcm/Makefile -+++ b/drivers/clk/bcm/Makefile -@@ -4,7 +4,7 @@ obj-$(CONFIG_CLK_BCM_KONA) += clk-bcm281xx.o - obj-$(CONFIG_CLK_BCM_KONA) += clk-bcm21664.o - obj-$(CONFIG_COMMON_CLK_IPROC) += clk-iproc-armpll.o clk-iproc-pll.o clk-iproc-asiu.o - obj-$(CONFIG_ARCH_BCM2835)$(CONFIG_ARCH_BCM2708)$(CONFIG_ARCH_BCM2709) += clk-bcm2835.o --obj-$(CONFIG_ARCH_BCM2835) += clk-bcm2835-aux.o -+obj-$(CONFIG_ARCH_BCM2835)$(CONFIG_ARCH_BCM2708)$(CONFIG_ARCH_BCM2709) += clk-bcm2835-aux.o - obj-$(CONFIG_COMMON_CLK_IPROC) += clk-ns2.o - obj-$(CONFIG_ARCH_BCM_CYGNUS) += clk-cygnus.o - obj-$(CONFIG_ARCH_BCM_NSP) += clk-nsp.o -diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig -index e842e86..c9d1558 100644 ---- a/drivers/spi/Kconfig -+++ b/drivers/spi/Kconfig -@@ -90,7 +90,7 @@ config SPI_BCM2835 - - config SPI_BCM2835AUX - tristate "BCM2835 SPI auxiliary controller" -- depends on ARCH_BCM2835 || COMPILE_TEST -+ depends on ARCH_BCM2835 || ARCH_BCM2708 || ARCH_BCM2709 || COMPILE_TEST - depends on GPIOLIB - help - This selects a driver for the Broadcom BCM2835 SPI aux master. - -From 84c2e063885bb0ae3d5d2ad2e24e7a2bdb5729ae Mon Sep 17 00:00:00 2001 -From: Matthias Reichl <hias@horus.com> -Date: Tue, 23 Feb 2016 17:28:23 +0100 -Subject: [PATCH 164/170] ASoC: bcm: add missing .owner fields in sound card - drivers - -If snd_soc_card.owner is not set the kernel won't do usage refcounting -and one can remove the card driver module while it's in use (eg playback -active) - which leads to a kernel crash. - -The missing owner field also prevents ALSA slot ordering -(options snd slots=module-name1,module-name-2,...) from working with -the I2S cards as it has no module name to match against. - -Fix these issues by setting the .owner field in the snd_soc_card structs. - -Signed-off-by: Matthias Reichl <hias@horus.com> ---- - sound/soc/bcm/hifiberry_amp.c | 1 + - sound/soc/bcm/hifiberry_dac.c | 1 + - sound/soc/bcm/hifiberry_dacplus.c | 1 + - sound/soc/bcm/hifiberry_digi.c | 1 + - sound/soc/bcm/iqaudio-dac.c | 1 + - sound/soc/bcm/raspidac3.c | 1 + - sound/soc/bcm/rpi-dac.c | 1 + - sound/soc/bcm/rpi-proto.c | 1 + - 8 files changed, 8 insertions(+) - -diff --git a/sound/soc/bcm/hifiberry_amp.c b/sound/soc/bcm/hifiberry_amp.c -index 5903915..0bb12e4 100644 ---- a/sound/soc/bcm/hifiberry_amp.c -+++ b/sound/soc/bcm/hifiberry_amp.c -@@ -61,6 +61,7 @@ static struct snd_soc_dai_link snd_rpi_hifiberry_amp_dai[] = { - - static struct snd_soc_card snd_rpi_hifiberry_amp = { - .name = "snd_rpi_hifiberry_amp", -+ .owner = THIS_MODULE, - .dai_link = snd_rpi_hifiberry_amp_dai, - .num_links = ARRAY_SIZE(snd_rpi_hifiberry_amp_dai), - }; -diff --git a/sound/soc/bcm/hifiberry_dac.c b/sound/soc/bcm/hifiberry_dac.c -index 3ab0f47..29ecc08 100644 ---- a/sound/soc/bcm/hifiberry_dac.c -+++ b/sound/soc/bcm/hifiberry_dac.c -@@ -63,6 +63,7 @@ static struct snd_soc_dai_link snd_rpi_hifiberry_dac_dai[] = { - /* audio machine driver */ - static struct snd_soc_card snd_rpi_hifiberry_dac = { - .name = "snd_rpi_hifiberry_dac", -+ .owner = THIS_MODULE, - .dai_link = snd_rpi_hifiberry_dac_dai, - .num_links = ARRAY_SIZE(snd_rpi_hifiberry_dac_dai), - }; -diff --git a/sound/soc/bcm/hifiberry_dacplus.c b/sound/soc/bcm/hifiberry_dacplus.c -index 153dbcd..03d8d2a 100644 ---- a/sound/soc/bcm/hifiberry_dacplus.c -+++ b/sound/soc/bcm/hifiberry_dacplus.c -@@ -287,6 +287,7 @@ static struct snd_soc_dai_link snd_rpi_hifiberry_dacplus_dai[] = { - /* audio machine driver */ - static struct snd_soc_card snd_rpi_hifiberry_dacplus = { - .name = "snd_rpi_hifiberry_dacplus", -+ .owner = THIS_MODULE, - .dai_link = snd_rpi_hifiberry_dacplus_dai, - .num_links = ARRAY_SIZE(snd_rpi_hifiberry_dacplus_dai), - }; -diff --git a/sound/soc/bcm/hifiberry_digi.c b/sound/soc/bcm/hifiberry_digi.c -index 80732b8..9840e15 100644 ---- a/sound/soc/bcm/hifiberry_digi.c -+++ b/sound/soc/bcm/hifiberry_digi.c -@@ -164,6 +164,7 @@ static struct snd_soc_dai_link snd_rpi_hifiberry_digi_dai[] = { - /* audio machine driver */ - static struct snd_soc_card snd_rpi_hifiberry_digi = { - .name = "snd_rpi_hifiberry_digi", -+ .owner = THIS_MODULE, - .dai_link = snd_rpi_hifiberry_digi_dai, - .num_links = ARRAY_SIZE(snd_rpi_hifiberry_digi_dai), - }; -diff --git a/sound/soc/bcm/iqaudio-dac.c b/sound/soc/bcm/iqaudio-dac.c -index 124d7a9..a5eaa9e 100644 ---- a/sound/soc/bcm/iqaudio-dac.c -+++ b/sound/soc/bcm/iqaudio-dac.c -@@ -77,6 +77,7 @@ static struct snd_soc_dai_link snd_rpi_iqaudio_dac_dai[] = { - /* audio machine driver */ - static struct snd_soc_card snd_rpi_iqaudio_dac = { - .name = "IQaudIODAC", -+ .owner = THIS_MODULE, - .dai_link = snd_rpi_iqaudio_dac_dai, - .num_links = ARRAY_SIZE(snd_rpi_iqaudio_dac_dai), - }; -diff --git a/sound/soc/bcm/raspidac3.c b/sound/soc/bcm/raspidac3.c -index 3cabf5b..e7422e2 100644 ---- a/sound/soc/bcm/raspidac3.c -+++ b/sound/soc/bcm/raspidac3.c -@@ -128,6 +128,7 @@ static struct snd_soc_dai_link snd_rpi_raspidac3_dai[] = { - /* audio machine driver */ - static struct snd_soc_card snd_rpi_raspidac3 = { - .name = "RaspiDAC Rev.3x HiFi Audio Card", -+ .owner = THIS_MODULE, - .dai_link = snd_rpi_raspidac3_dai, - .num_links = ARRAY_SIZE(snd_rpi_raspidac3_dai), - }; -diff --git a/sound/soc/bcm/rpi-dac.c b/sound/soc/bcm/rpi-dac.c -index d5fac1b..59dc89e 100644 ---- a/sound/soc/bcm/rpi-dac.c -+++ b/sound/soc/bcm/rpi-dac.c -@@ -60,6 +60,7 @@ static struct snd_soc_dai_link snd_rpi_rpi_dac_dai[] = { - /* audio machine driver */ - static struct snd_soc_card snd_rpi_rpi_dac = { - .name = "snd_rpi_rpi_dac", -+ .owner = THIS_MODULE, - .dai_link = snd_rpi_rpi_dac_dai, - .num_links = ARRAY_SIZE(snd_rpi_rpi_dac_dai), - }; -diff --git a/sound/soc/bcm/rpi-proto.c b/sound/soc/bcm/rpi-proto.c -index c6e45a0..9db678e 100644 ---- a/sound/soc/bcm/rpi-proto.c -+++ b/sound/soc/bcm/rpi-proto.c -@@ -91,6 +91,7 @@ static struct snd_soc_dai_link snd_rpi_proto_dai[] = { - /* audio machine driver */ - static struct snd_soc_card snd_rpi_proto = { - .name = "snd_rpi_proto", -+ .owner = THIS_MODULE, - .dai_link = snd_rpi_proto_dai, - .num_links = ARRAY_SIZE(snd_rpi_proto_dai), - }; - -From 18674a7da1c3d50d9c957a8f88aaea2aa653d223 Mon Sep 17 00:00:00 2001 -From: popcornmix <popcornmix@gmail.com> -Date: Wed, 20 Jan 2016 17:50:09 +0000 -Subject: [PATCH 165/170] smsx95xx: Add option to disable the crimes against - truesize fix - -It may improve iperf numbers on Pi 1, but may generate dmesg warnings and possibly cause network issues -See issue 1248. ---- - drivers/net/usb/smsc95xx.c | 8 ++++++++ - 1 file changed, 8 insertions(+) - mode change 100755 => 100644 drivers/net/usb/smsc95xx.c - -diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c -old mode 100755 -new mode 100644 -index 7483222..a61bd08 ---- a/drivers/net/usb/smsc95xx.c -+++ b/drivers/net/usb/smsc95xx.c -@@ -75,6 +75,10 @@ static bool turbo_mode = false; - module_param(turbo_mode, bool, 0644); - MODULE_PARM_DESC(turbo_mode, "Enable multiple frames per Rx transaction"); - -+static bool truesize_mode = false; -+module_param(truesize_mode, bool, 0644); -+MODULE_PARM_DESC(truesize_mode, "Report larger truesize value"); + - static char *macaddr = ":"; - module_param(macaddr, charp, 0); - MODULE_PARM_DESC(macaddr, "MAC address"); -@@ -1841,6 +1845,8 @@ static int smsc95xx_rx_fixup(struct usbnet *dev, struct sk_buff *skb) - if (dev->net->features & NETIF_F_RXCSUM) - smsc95xx_rx_csum_offload(skb); - skb_trim(skb, skb->len - 4); /* remove fcs */ -+ if (truesize_mode) -+ skb->truesize = size + sizeof(struct sk_buff); - - return 1; - } -@@ -1858,6 +1864,8 @@ static int smsc95xx_rx_fixup(struct usbnet *dev, struct sk_buff *skb) - if (dev->net->features & NETIF_F_RXCSUM) - smsc95xx_rx_csum_offload(ax_skb); - skb_trim(ax_skb, ax_skb->len - 4); /* remove fcs */ -+ if (truesize_mode) -+ ax_skb->truesize = size + sizeof(struct sk_buff); - - usbnet_skb_return(dev, ax_skb); - } - -From 5e3c3e845f998f86c2f22017576cb19e5d7fe9bb Mon Sep 17 00:00:00 2001 -From: popcornmix <popcornmix@gmail.com> -Date: Tue, 23 Feb 2016 19:56:04 +0000 -Subject: [PATCH 166/170] bcm2835-virtgpio: Virtual GPIO driver - -Add a virtual GPIO driver that uses the firmware mailbox interface to -request that the VPU toggles LEDs. ---- - arch/arm/configs/bcm2709_defconfig | 1 + - drivers/gpio/Kconfig | 6 + - drivers/gpio/Makefile | 1 + - drivers/gpio/gpio-bcm-virt.c | 180 +++++++++++++++++++++++++++++ - include/soc/bcm2835/raspberrypi-firmware.h | 1 + - 5 files changed, 189 insertions(+) - create mode 100644 drivers/gpio/gpio-bcm-virt.c - -diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig -index 76b3a88..6d6b519 100644 ---- a/arch/arm/configs/bcm2709_defconfig -+++ b/arch/arm/configs/bcm2709_defconfig -@@ -607,6 +607,7 @@ CONFIG_PPS=m - CONFIG_PPS_CLIENT_LDISC=m - CONFIG_PPS_CLIENT_GPIO=m - CONFIG_GPIO_SYSFS=y -+CONFIG_GPIO_BCM_VIRT=y - CONFIG_GPIO_ARIZONA=m - CONFIG_GPIO_STMPE=y - CONFIG_W1=m -diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig -index b18bea0..a1f4ccee 100644 ---- a/drivers/gpio/Kconfig -+++ b/drivers/gpio/Kconfig -@@ -132,6 +132,12 @@ config GPIO_BCM_KONA - help - Turn on GPIO support for Broadcom "Kona" chips. - -+config GPIO_BCM_VIRT -+ bool "Broadcom Virt GPIO" -+ depends on OF_GPIO && RASPBERRYPI_FIRMWARE && (ARCH_BCM2835 || ARCH_BCM2708 || ARCH_BCM2709 || COMPILE_TEST) -+ help -+ Turn on virtual GPIO support for Broadcom BCM283X chips. ++module_platform_driver(snd_rpi_justboom_dac_driver); + - config GPIO_BRCMSTB - tristate "BRCMSTB GPIO support" - default y if ARCH_BRCMSTB -diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile -index 986dbd8..b2ccc9f 100644 ---- a/drivers/gpio/Makefile -+++ b/drivers/gpio/Makefile -@@ -24,6 +24,7 @@ obj-$(CONFIG_GPIO_AMDPT) += gpio-amdpt.o - obj-$(CONFIG_GPIO_ARIZONA) += gpio-arizona.o - obj-$(CONFIG_ATH79) += gpio-ath79.o - obj-$(CONFIG_GPIO_BCM_KONA) += gpio-bcm-kona.o -+obj-$(CONFIG_GPIO_BCM_VIRT) += gpio-bcm-virt.o - obj-$(CONFIG_GPIO_BRCMSTB) += gpio-brcmstb.o - obj-$(CONFIG_GPIO_BT8XX) += gpio-bt8xx.o - obj-$(CONFIG_GPIO_CLPS711X) += gpio-clps711x.o -diff --git a/drivers/gpio/gpio-bcm-virt.c b/drivers/gpio/gpio-bcm-virt.c ++MODULE_AUTHOR("Milan Neskovic <info@justboom.co>"); ++MODULE_DESCRIPTION("ASoC Driver for JustBoom PI DAC HAT Sound Card"); ++MODULE_LICENSE("GPL v2"); +diff --git a/sound/soc/bcm/justboom-digi.c b/sound/soc/bcm/justboom-digi.c new file mode 100644 -index 0000000..53edcb4 +index 0000000..91acb66 --- /dev/null -+++ b/drivers/gpio/gpio-bcm-virt.c -@@ -0,0 +1,180 @@ ++++ b/sound/soc/bcm/justboom-digi.c +@@ -0,0 +1,215 @@ +/* -+ * brcmvirt GPIO driver ++ * ASoC Driver for JustBoom Raspberry Pi Digi HAT Sound Card + * -+ * Copyright (C) 2012,2013 Dom Cobley <popcornmix@gmail.com> -+ * Based on gpio-clps711x.c by Alexander Shiyan <shc_work@mail.ru> ++ * Author: Milan Neskovic ++ * Copyright 2016 ++ * based on code by Daniel Matuschek <info@crazy-audio.com> ++ * based on code by Florian Meier <florian.meier@koalo.de> + * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2 of the License, or -+ * (at your option) any later version. ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * version 2 as published by the Free Software Foundation. ++ * ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * General Public License for more details. + */ + -+#include <linux/err.h> -+#include <linux/gpio.h> +#include <linux/module.h> -+#include <linux/basic_mmio_gpio.h> +#include <linux/platform_device.h> -+#include <soc/bcm2835/raspberrypi-firmware.h> + -+#define MODULE_NAME "brcmvirt-gpio" -+#define NUM_GPIO 2 ++#include <sound/core.h> ++#include <sound/pcm.h> ++#include <sound/pcm_params.h> ++#include <sound/soc.h> ++#include <sound/jack.h> + -+struct brcmvirt_gpio { -+ struct gpio_chip gc; -+ u32 __iomem *ts_base; -+ /* two packed 16-bit counts of enabled and disables -+ Allows host to detect a brief enable that was missed */ -+ u32 enables_disables[NUM_GPIO]; -+}; ++#include "../codecs/wm8804.h" + -+static int brcmvirt_gpio_dir_in(struct gpio_chip *gc, unsigned off) ++static int snd_rpi_justboom_digi_init(struct snd_soc_pcm_runtime *rtd) +{ -+ struct brcmvirt_gpio *gpio; -+ gpio = container_of(gc, struct brcmvirt_gpio, gc); -+ return -EINVAL; -+} ++ struct snd_soc_codec *codec = rtd->codec; ++ ++ /* enable TX output */ ++ snd_soc_update_bits(codec, WM8804_PWRDN, 0x4, 0x0); + -+static int brcmvirt_gpio_dir_out(struct gpio_chip *gc, unsigned off, int val) -+{ -+ struct brcmvirt_gpio *gpio; -+ gpio = container_of(gc, struct brcmvirt_gpio, gc); + return 0; +} + -+static int brcmvirt_gpio_get(struct gpio_chip *gc, unsigned off) -+{ -+ struct brcmvirt_gpio *gpio; -+ unsigned v; -+ gpio = container_of(gc, struct brcmvirt_gpio, gc); -+ v = readl(gpio->ts_base + off); -+ return (v >> off) & 1; ++static int snd_rpi_justboom_digi_startup(struct snd_pcm_substream *substream) { ++ /* turn on digital output */ ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_codec *codec = rtd->codec; ++ snd_soc_update_bits(codec, WM8804_PWRDN, 0x3c, 0x00); ++ return 0; +} + -+static void brcmvirt_gpio_set(struct gpio_chip *gc, unsigned off, int val) -+{ -+ struct brcmvirt_gpio *gpio; -+ u16 enables, disables; -+ s16 diff; -+ bool lit; -+ gpio = container_of(gc, struct brcmvirt_gpio, gc); -+ enables = gpio->enables_disables[off] >> 16; -+ disables = gpio->enables_disables[off] >> 0; -+ diff = (s16)(enables - disables); -+ lit = diff > 0; -+ if ((val && lit) || (!val && !lit)) -+ return; -+ if (val) -+ enables++; -+ else -+ disables++; -+ diff = (s16)(enables - disables); -+ BUG_ON(diff != 0 && diff != 1); -+ gpio->enables_disables[off] = (enables << 16) | (disables << 0); -+ writel(gpio->enables_disables[off], gpio->ts_base + off); ++static void snd_rpi_justboom_digi_shutdown(struct snd_pcm_substream *substream) { ++ /* turn off output */ ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_codec *codec = rtd->codec; ++ snd_soc_update_bits(codec, WM8804_PWRDN, 0x3c, 0x3c); +} + -+static int brcmvirt_gpio_probe(struct platform_device *pdev) ++static int snd_rpi_justboom_digi_hw_params(struct snd_pcm_substream *substream, ++ struct snd_pcm_hw_params *params) +{ -+ struct device *dev = &pdev->dev; -+ struct device_node *np = dev->of_node; -+ struct device_node *fw_node; -+ struct rpi_firmware *fw; -+ struct brcmvirt_gpio *ucb; -+ u32 gpiovirtbuf; -+ int err = 0; ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_dai *codec_dai = rtd->codec_dai; ++ struct snd_soc_codec *codec = rtd->codec; ++ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; + -+ fw_node = of_parse_phandle(np, "firmware", 0); -+ if (!fw_node) { -+ dev_err(dev, "Missing firmware node\n"); -+ return -ENOENT; -+ } ++ int sysclk = 27000000; /* This is fixed on this board */ + -+ fw = rpi_firmware_get(fw_node); -+ if (!fw) -+ return -EPROBE_DEFER; ++ long mclk_freq=0; ++ int mclk_div=1; ++ int sampling_freq=1; + -+ err = rpi_firmware_property(fw, RPI_FIRMWARE_FRAMEBUFFER_GET_GPIOVIRTBUF, -+ &gpiovirtbuf, sizeof(gpiovirtbuf)); ++ int ret; + -+ if (err) { -+ dev_err(dev, "Failed to get gpiovirtbuf\n"); -+ goto err; -+ } ++ int samplerate = params_rate(params); + -+ if (!gpiovirtbuf) { -+ dev_err(dev, "No virtgpio buffer\n"); -+ err = -ENOENT; -+ goto err; ++ if (samplerate<=96000) { ++ mclk_freq=samplerate*256; ++ mclk_div=WM8804_MCLKDIV_256FS; ++ } else { ++ mclk_freq=samplerate*128; ++ mclk_div=WM8804_MCLKDIV_128FS; + } + -+ ucb = devm_kzalloc(dev, sizeof *ucb, GFP_KERNEL); -+ if (!ucb) { -+ err = -EINVAL; -+ goto err; ++ switch (samplerate) { ++ case 32000: ++ sampling_freq=0x03; ++ break; ++ case 44100: ++ sampling_freq=0x00; ++ break; ++ case 48000: ++ sampling_freq=0x02; ++ break; ++ case 88200: ++ sampling_freq=0x08; ++ break; ++ case 96000: ++ sampling_freq=0x0a; ++ break; ++ case 176400: ++ sampling_freq=0x0c; ++ break; ++ case 192000: ++ sampling_freq=0x0e; ++ break; ++ default: ++ dev_err(codec->dev, ++ "Failed to set WM8804 SYSCLK, unsupported samplerate %d\n", ++ samplerate); + } + -+ // mmap the physical memory -+ gpiovirtbuf &= ~0xc0000000; -+ ucb->ts_base = ioremap(gpiovirtbuf, 4096); -+ if (ucb->ts_base == NULL) { -+ dev_err(dev, "Failed to map physical address\n"); -+ err = -ENOENT; -+ goto err; ++ snd_soc_dai_set_clkdiv(codec_dai, WM8804_MCLK_DIV, mclk_div); ++ snd_soc_dai_set_pll(codec_dai, 0, 0, sysclk, mclk_freq); ++ ++ ret = snd_soc_dai_set_sysclk(codec_dai, WM8804_TX_CLKSRC_PLL, ++ sysclk, SND_SOC_CLOCK_OUT); ++ if (ret < 0) { ++ dev_err(codec->dev, ++ "Failed to set WM8804 SYSCLK: %d\n", ret); ++ return ret; + } + -+ ucb->gc.label = MODULE_NAME; -+ ucb->gc.owner = THIS_MODULE; -+ ucb->gc.dev = dev; -+ ucb->gc.of_node = np; -+ ucb->gc.base = 100; -+ ucb->gc.ngpio = NUM_GPIO; ++ /* Enable TX output */ ++ snd_soc_update_bits(codec, WM8804_PWRDN, 0x4, 0x0); + -+ ucb->gc.direction_input = brcmvirt_gpio_dir_in; -+ ucb->gc.direction_output = brcmvirt_gpio_dir_out; -+ ucb->gc.get = brcmvirt_gpio_get; -+ ucb->gc.set = brcmvirt_gpio_set; -+ ucb->gc.can_sleep = true; ++ /* Power on */ ++ snd_soc_update_bits(codec, WM8804_PWRDN, 0x9, 0); + -+ err = gpiochip_add(&ucb->gc); -+ if (err) -+ goto err; ++ /* set sampling frequency status bits */ ++ snd_soc_update_bits(codec, WM8804_SPDTX4, 0x0f, sampling_freq); + -+ platform_set_drvdata(pdev, ucb); ++ return snd_soc_dai_set_bclk_ratio(cpu_dai,64); ++} + -+err: -+ return err; ++/* machine stream operations */ ++static struct snd_soc_ops snd_rpi_justboom_digi_ops = { ++ .hw_params = snd_rpi_justboom_digi_hw_params, ++ .startup = snd_rpi_justboom_digi_startup, ++ .shutdown = snd_rpi_justboom_digi_shutdown, ++}; + -+} ++static struct snd_soc_dai_link snd_rpi_justboom_digi_dai[] = { ++{ ++ .name = "JustBoom Digi", ++ .stream_name = "JustBoom Digi HiFi", ++ .cpu_dai_name = "bcm2708-i2s.0", ++ .codec_dai_name = "wm8804-spdif", ++ .platform_name = "bcm2708-i2s.0", ++ .codec_name = "wm8804.1-003b", ++ .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | ++ SND_SOC_DAIFMT_CBM_CFM, ++ .ops = &snd_rpi_justboom_digi_ops, ++ .init = snd_rpi_justboom_digi_init, ++}, ++}; + -+static int brcmvirt_gpio_remove(struct platform_device *pdev) ++/* audio machine driver */ ++static struct snd_soc_card snd_rpi_justboom_digi = { ++ .name = "snd_rpi_justboom_digi", ++ .owner = THIS_MODULE, ++ .dai_link = snd_rpi_justboom_digi_dai, ++ .num_links = ARRAY_SIZE(snd_rpi_justboom_digi_dai), ++}; ++ ++static int snd_rpi_justboom_digi_probe(struct platform_device *pdev) +{ -+ int err = 0; -+ struct brcmvirt_gpio *ucb = platform_get_drvdata(pdev); ++ int ret = 0; + -+ gpiochip_remove(&ucb->gc); -+ iounmap(ucb->ts_base); -+ return err; ++ snd_rpi_justboom_digi.dev = &pdev->dev; ++ ++ if (pdev->dev.of_node) { ++ struct device_node *i2s_node; ++ struct snd_soc_dai_link *dai = &snd_rpi_justboom_digi_dai[0]; ++ i2s_node = of_parse_phandle(pdev->dev.of_node, ++ "i2s-controller", 0); ++ ++ if (i2s_node) { ++ dai->cpu_dai_name = NULL; ++ dai->cpu_of_node = i2s_node; ++ dai->platform_name = NULL; ++ dai->platform_of_node = i2s_node; ++ } ++ } ++ ++ ret = snd_soc_register_card(&snd_rpi_justboom_digi); ++ if (ret) ++ dev_err(&pdev->dev, ++ "snd_soc_register_card() failed: %d\n", ret); ++ ++ return ret; +} + -+static const struct of_device_id __maybe_unused brcmvirt_gpio_ids[] = { -+ { .compatible = "brcm,bcm2835-virtgpio" }, -+ { } ++static int snd_rpi_justboom_digi_remove(struct platform_device *pdev) ++{ ++ return snd_soc_unregister_card(&snd_rpi_justboom_digi); ++} ++ ++static const struct of_device_id snd_rpi_justboom_digi_of_match[] = { ++ { .compatible = "justboom,justboom-digi", }, ++ {}, +}; -+MODULE_DEVICE_TABLE(of, brcmvirt_gpio_ids); ++MODULE_DEVICE_TABLE(of, snd_rpi_justboom_digi_of_match); + -+static struct platform_driver brcmvirt_gpio_driver = { -+ .driver = { -+ .name = MODULE_NAME, -+ .owner = THIS_MODULE, -+ .of_match_table = of_match_ptr(brcmvirt_gpio_ids), ++static struct platform_driver snd_rpi_justboom_digi_driver = { ++ .driver = { ++ .name = "snd-rpi-justboom-digi", ++ .owner = THIS_MODULE, ++ .of_match_table = snd_rpi_justboom_digi_of_match, + }, -+ .probe = brcmvirt_gpio_probe, -+ .remove = brcmvirt_gpio_remove, ++ .probe = snd_rpi_justboom_digi_probe, ++ .remove = snd_rpi_justboom_digi_remove, +}; -+module_platform_driver(brcmvirt_gpio_driver); + -+MODULE_LICENSE("GPL"); -+MODULE_AUTHOR("Dom Cobley <popcornmix@gmail.com>"); -+MODULE_DESCRIPTION("brcmvirt GPIO driver"); -+MODULE_ALIAS("platform:brcmvirt-gpio"); -diff --git a/include/soc/bcm2835/raspberrypi-firmware.h b/include/soc/bcm2835/raspberrypi-firmware.h -index b011489..c844968 100644 ---- a/include/soc/bcm2835/raspberrypi-firmware.h -+++ b/include/soc/bcm2835/raspberrypi-firmware.h -@@ -93,6 +93,7 @@ enum rpi_firmware_property_tag { - RPI_FIRMWARE_FRAMEBUFFER_GET_OVERSCAN = 0x0004000a, - RPI_FIRMWARE_FRAMEBUFFER_GET_PALETTE = 0x0004000b, - RPI_FIRMWARE_FRAMEBUFFER_GET_TOUCHBUF = 0x0004000f, -+ RPI_FIRMWARE_FRAMEBUFFER_GET_GPIOVIRTBUF = 0x00040010, - RPI_FIRMWARE_FRAMEBUFFER_RELEASE = 0x00048001, - RPI_FIRMWARE_FRAMEBUFFER_TEST_PHYSICAL_WIDTH_HEIGHT = 0x00044003, - RPI_FIRMWARE_FRAMEBUFFER_TEST_VIRTUAL_WIDTH_HEIGHT = 0x00044004, ++module_platform_driver(snd_rpi_justboom_digi_driver); ++ ++MODULE_AUTHOR("Milan Neskovic <info@justboom.co>"); ++MODULE_DESCRIPTION("ASoC Driver for JustBoom PI Digi HAT Sound Card"); ++MODULE_LICENSE("GPL v2"); -From 6aa2c847f76f21c830544e8c79f9030a170ef475 Mon Sep 17 00:00:00 2001 -From: Phil Elwell <phil@raspberrypi.org> -Date: Thu, 21 Jan 2016 17:57:49 +0000 -Subject: [PATCH 167/170] BCM270X_DT: Add Pi3 support +From 2fc52b7468ac688af8a702978eb688fac59eb97b Mon Sep 17 00:00:00 2001 +From: Eric Anholt <eric@anholt.net> +Date: Tue, 19 Apr 2016 15:55:02 -0700 +Subject: [PATCH 107/112] ARM: bcm2708: Enable building power domain driver. +Signed-off-by: Eric Anholt <eric@anholt.net> --- - arch/arm/boot/dts/Makefile | 1 + - arch/arm/boot/dts/bcm2710-rpi-3-b.dts | 174 ++++++++++++++++++++++++++++++++++ - arch/arm/boot/dts/bcm2710.dtsi | 102 ++++++++++++++++++++ - 3 files changed, 277 insertions(+) - create mode 100644 arch/arm/boot/dts/bcm2710-rpi-3-b.dts - create mode 100644 arch/arm/boot/dts/bcm2710.dtsi + drivers/soc/bcm/Kconfig | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) -diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile -index d583e67..fdc450f4 100644 ---- a/arch/arm/boot/dts/Makefile -+++ b/arch/arm/boot/dts/Makefile -@@ -5,6 +5,7 @@ dtb-$(CONFIG_ARCH_BCM2708) += bcm2708-rpi-b-plus.dtb - dtb-$(CONFIG_ARCH_BCM2708) += bcm2708-rpi-cm.dtb - dtb-$(CONFIG_ARCH_BCM2835) += bcm2835-rpi-cm.dtb - dtb-$(CONFIG_ARCH_BCM2709) += bcm2709-rpi-2-b.dtb -+dtb-$(CONFIG_ARCH_BCM2709) += bcm2710-rpi-3-b.dtb +diff --git a/drivers/soc/bcm/Kconfig b/drivers/soc/bcm/Kconfig +index 3066ede..e235181 100644 +--- a/drivers/soc/bcm/Kconfig ++++ b/drivers/soc/bcm/Kconfig +@@ -1,6 +1,6 @@ + config RASPBERRYPI_POWER + bool "Raspberry Pi power domain driver" +- depends on ARCH_BCM2835 || COMPILE_TEST ++ depends on ARCH_BCM2835 || ARCH_BCM2708 || ARCH_BCM2709 || COMPILE_TEST + depends on RASPBERRYPI_FIRMWARE=y + select PM_GENERIC_DOMAINS if PM + select PM_GENERIC_DOMAINS_OF if PM + +From 1acf838a61e40b5f1a59152810802e6e2db3d273 Mon Sep 17 00:00:00 2001 +From: Andrey Grodzovsky <andrey2805@gmail.com> +Date: Tue, 3 May 2016 22:10:59 -0400 +Subject: [PATCH 108/112] ARM: adau1977-adc: Add basic machine driver for + adau1977 codec driver. + +This commit adds basic support for the codec usage including: Device tree overlay, +binding I2S bus and setting I2S mode, clock source and frequency setting according +to spec. + +Signed-off-by: Andrey Grodzovsky <andrey2805@gmail.com> +--- + sound/soc/bcm/Kconfig | 7 +++ + sound/soc/bcm/Makefile | 2 + + sound/soc/bcm/adau1977-adc.c | 125 +++++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 134 insertions(+) + create mode 100644 sound/soc/bcm/adau1977-adc.c + +diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig +index e2e2782..59890cc 100644 +--- a/sound/soc/bcm/Kconfig ++++ b/sound/soc/bcm/Kconfig +@@ -78,3 +78,10 @@ config SND_BCM2708_SOC_RASPIDAC3 + select SND_SOC_TPA6130A2 + help + Say Y or M if you want to add support for RaspiDAC Rev.3x. ++ ++config SND_BCM2708_SOC_ADAU1977_ADC ++ tristate "Support for ADAU1977 ADC" ++ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S ++ select SND_SOC_ADAU1977_I2C ++ help ++ Say Y or M if you want to add support for ADAU1977 ADC. +diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile +index 6c9714c..d3124f5 100644 +--- a/sound/soc/bcm/Makefile ++++ b/sound/soc/bcm/Makefile +@@ -4,6 +4,7 @@ snd-soc-bcm2835-i2s-objs := bcm2835-i2s.o + obj-$(CONFIG_SND_BCM2835_SOC_I2S) += snd-soc-bcm2835-i2s.o - # Raspberry Pi - ifeq ($(CONFIG_ARCH_BCM2708),y) -diff --git a/arch/arm/boot/dts/bcm2710-rpi-3-b.dts b/arch/arm/boot/dts/bcm2710-rpi-3-b.dts + # BCM2708 Machine Support ++snd-soc-adau1977-adc-objs := adau1977-adc.o + snd-soc-hifiberry-dac-objs := hifiberry_dac.o + snd-soc-hifiberry-dacplus-objs := hifiberry_dacplus.o + snd-soc-hifiberry-digi-objs := hifiberry_digi.o +@@ -15,6 +16,7 @@ snd-soc-rpi-proto-objs := rpi-proto.o + snd-soc-iqaudio-dac-objs := iqaudio-dac.o + snd-soc-raspidac3-objs := raspidac3.o + ++obj-$(CONFIG_SND_BCM2708_SOC_ADAU1977_ADC) += snd-soc-adau1977-adc.o + obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o + obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS) += snd-soc-hifiberry-dacplus.o + obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI) += snd-soc-hifiberry-digi.o +diff --git a/sound/soc/bcm/adau1977-adc.c b/sound/soc/bcm/adau1977-adc.c new file mode 100644 -index 0000000..a6ecb51 +index 0000000..6e2ee02 --- /dev/null -+++ b/arch/arm/boot/dts/bcm2710-rpi-3-b.dts -@@ -0,0 +1,174 @@ -+/dts-v1/; ++++ b/sound/soc/bcm/adau1977-adc.c +@@ -0,0 +1,125 @@ ++/* ++ * ASoC Driver for ADAU1977 ADC ++ * ++ * Author: Andrey Grodzovsky <andrey2805@gmail.com> ++ * Copyright 2016 ++ * ++ * This file is based on hifibery_dac driver by Florian Meier. ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * version 2 as published by the Free Software Foundation. ++ * ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * General Public License for more details. ++ */ + -+#include "bcm2710.dtsi" ++#include <linux/module.h> ++#include <linux/platform_device.h> + -+/ { -+ compatible = "brcm,bcm2710","brcm,bcm2709"; -+ model = "Raspberry Pi 3 Model B"; ++#include <sound/core.h> ++#include <sound/pcm.h> ++#include <sound/pcm_params.h> ++#include <sound/soc.h> ++#include <sound/jack.h> ++ ++enum adau1977_clk_id { ++ ADAU1977_SYSCLK, ++}; ++ ++enum adau1977_sysclk_src { ++ ADAU1977_SYSCLK_SRC_MCLK, ++ ADAU1977_SYSCLK_SRC_LRCLK, +}; + -+&gpio { -+ sdhost_pins: sdhost_pins { -+ brcm,pins = <48 49 50 51 52 53>; -+ brcm,function = <4>; /* alt0 */ -+ }; ++static int eval_adau1977_init(struct snd_soc_pcm_runtime *rtd) ++{ ++ int ret; ++ struct snd_soc_dai *codec_dai = rtd->codec_dai; ++ ++ ret = snd_soc_dai_set_tdm_slot(codec_dai, 0, 0, 0, 0); ++ if (ret < 0) ++ return ret; + -+ spi0_pins: spi0_pins { -+ brcm,pins = <9 10 11>; -+ brcm,function = <4>; /* alt0 */ -+ }; ++ return snd_soc_codec_set_sysclk(rtd->codec, ADAU1977_SYSCLK, ++ ADAU1977_SYSCLK_SRC_MCLK, 11289600, SND_SOC_CLOCK_IN); ++} ++ ++static struct snd_soc_dai_link snd_rpi_adau1977_dai[] = { ++ { ++ .name = "adau1977", ++ .stream_name = "ADAU1977", ++ .cpu_dai_name = "bcm2708-i2s.0", ++ .codec_dai_name = "adau1977-hifi", ++ .platform_name = "bcm2708-i2s.0", ++ .codec_name = "adau1977.1-0011", ++ .init = eval_adau1977_init, ++ .dai_fmt = SND_SOC_DAIFMT_I2S | ++ SND_SOC_DAIFMT_NB_NF | ++ SND_SOC_DAIFMT_CBM_CFM, ++ }, ++}; + -+ spi0_cs_pins: spi0_cs_pins { -+ brcm,pins = <8 7>; -+ brcm,function = <1>; /* output */ -+ }; ++/* audio machine driver */ ++static struct snd_soc_card snd_adau1977_adc = { ++ .name = "snd_rpi_adau1977_adc", ++ .owner = THIS_MODULE, ++ .dai_link = snd_rpi_adau1977_dai, ++ .num_links = ARRAY_SIZE(snd_rpi_adau1977_dai), ++}; + -+ i2c0_pins: i2c0 { -+ brcm,pins = <0 1>; -+ brcm,function = <4>; -+ }; ++static int snd_adau1977_adc_probe(struct platform_device *pdev) ++{ ++ int ret = 0; + -+ i2c1_pins: i2c1 { -+ brcm,pins = <2 3>; -+ brcm,function = <4>; -+ }; ++ snd_adau1977_adc.dev = &pdev->dev; ++ if (pdev->dev.of_node) { ++ struct device_node *i2s_node; ++ struct snd_soc_dai_link *dai = &snd_rpi_adau1977_dai[0]; ++ i2s_node = of_parse_phandle(pdev->dev.of_node, ++ "i2s-controller", 0); + -+ i2s_pins: i2s { -+ brcm,pins = <18 19 20 21>; -+ brcm,function = <4>; /* alt0 */ -+ }; ++ if (i2s_node) { ++ dai->cpu_dai_name = NULL; ++ dai->cpu_of_node = i2s_node; ++ dai->platform_name = NULL; ++ dai->platform_of_node = i2s_node; ++ } ++ } + -+ sdio_pins: sdio_pins { -+ brcm,pins = <34 35 36 37 38 39>; -+ brcm,function = <7>; // alt3 = SD1 -+ brcm,pull = <0 2 2 2 2 2>; -+ }; ++ ret = snd_soc_register_card(&snd_adau1977_adc); ++ if (ret) ++ dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", ret); + -+ bt_pins: bt_pins { -+ brcm,pins = <28 29 30 31 14 15 43>; -+ brcm,function = <6 6 6 6 2 2 4>; -+ // alt2:PCM alt5:UART1 alt0:GPCLK2 -+ brcm,pull = <0 0 0 0 0 2 0>; -+ }; ++ return ret; ++} + -+ uart1_pins: uart1_pins { -+ brcm,pins = <32 33>; -+ brcm,function = <7>; /* alt3=UART0 */ -+ brcm,pull = <0>; -+ }; -+}; ++static int snd_adau1977_adc_remove(struct platform_device *pdev) ++{ ++ return snd_soc_unregister_card(&snd_adau1977_adc); ++} + -+&sdhost { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&sdhost_pins>; -+ bus-width = <4>; -+ status = "okay"; ++static const struct of_device_id snd_adau1977_adc_of_match[] = { ++ { .compatible = "adi,adau1977-adc", }, ++ {}, +}; + -+&mmc { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&sdio_pins>; -+ non-removable; -+ bus-width = <4>; -+ status = "okay"; -+}; ++MODULE_DEVICE_TABLE(of, snd_adau1977_adc_of_match); + -+&fb { -+ status = "okay"; ++static struct platform_driver snd_adau1977_adc_driver = { ++ .driver = { ++ .name = "snd-adau1977-adc", ++ .owner = THIS_MODULE, ++ .of_match_table = snd_adau1977_adc_of_match, ++ }, ++ .probe = snd_adau1977_adc_probe, ++ .remove = snd_adau1977_adc_remove, +}; + -+&uart0 { -+ status = "okay"; -+}; ++module_platform_driver(snd_adau1977_adc_driver); + -+&uart1 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&uart1_pins &bt_pins>; -+ status = "okay"; -+}; ++MODULE_AUTHOR("Andrey Grodzovsky <andrey2805@gmail.com>"); ++MODULE_DESCRIPTION("ASoC Driver for ADAU1977 ADC"); ++MODULE_LICENSE("GPL v2"); + +From ae03e3ad4d50779677d0cf9ca847c8a1b4372e1c Mon Sep 17 00:00:00 2001 +From: Matt Flax <flatmax@flatmax.org> +Date: Mon, 16 May 2016 21:36:31 +1000 +Subject: [PATCH 109/112] New AudioInjector.net Pi soundcard with low jitter + audio in and out. + +Contains the sound/soc/bcm ALSA machine driver and necessary alterations to the Kconfig and Makefile. +Adds the dts overlay and updates the Makefile and README. +Updates the relevant defconfig files to enable building for the Raspberry Pi. +Thanks to Phil Elwell (pelwell) for the review, simple-card concepts and discussion. Thanks to Clive Messer for overlay naming suggestions. +--- + sound/soc/bcm/Kconfig | 7 ++ + sound/soc/bcm/Makefile | 3 + + sound/soc/bcm/audioinjector-pi-soundcard.c | 142 +++++++++++++++++++++++++++++ + 3 files changed, 152 insertions(+) + create mode 100644 sound/soc/bcm/audioinjector-pi-soundcard.c + +diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig +index 59890cc..e2e40ed 100644 +--- a/sound/soc/bcm/Kconfig ++++ b/sound/soc/bcm/Kconfig +@@ -85,3 +85,10 @@ config SND_BCM2708_SOC_ADAU1977_ADC + select SND_SOC_ADAU1977_I2C + help + Say Y or M if you want to add support for ADAU1977 ADC. + -+&spi0 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&spi0_pins &spi0_cs_pins>; -+ cs-gpios = <&gpio 8 1>, <&gpio 7 1>; ++config SND_AUDIOINJECTOR_PI_SOUNDCARD ++ tristate "Support for audioinjector.net Pi add on soundcard" ++ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S ++ select SND_SOC_WM8731 ++ help ++ Say Y or M if you want to add support for audioinjector.net Pi Hat +diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile +index d3124f5..3353192 100644 +--- a/sound/soc/bcm/Makefile ++++ b/sound/soc/bcm/Makefile +@@ -15,6 +15,7 @@ snd-soc-rpi-dac-objs := rpi-dac.o + snd-soc-rpi-proto-objs := rpi-proto.o + snd-soc-iqaudio-dac-objs := iqaudio-dac.o + snd-soc-raspidac3-objs := raspidac3.o ++snd-soc-audioinjector-pi-soundcard-objs := audioinjector-pi-soundcard.o + + obj-$(CONFIG_SND_BCM2708_SOC_ADAU1977_ADC) += snd-soc-adau1977-adc.o + obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o +@@ -27,3 +28,5 @@ obj-$(CONFIG_SND_BCM2708_SOC_RPI_DAC) += snd-soc-rpi-dac.o + obj-$(CONFIG_SND_BCM2708_SOC_RPI_PROTO) += snd-soc-rpi-proto.o + obj-$(CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC) += snd-soc-iqaudio-dac.o + obj-$(CONFIG_SND_BCM2708_SOC_RASPIDAC3) += snd-soc-raspidac3.o ++obj-$(CONFIG_SND_AUDIOINJECTOR_PI_SOUNDCARD) += snd-soc-audioinjector-pi-soundcard.o + -+ spidev@0{ -+ compatible = "spidev"; -+ reg = <0>; /* CE0 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; -+ }; +diff --git a/sound/soc/bcm/audioinjector-pi-soundcard.c b/sound/soc/bcm/audioinjector-pi-soundcard.c +new file mode 100644 +index 0000000..39f29e2 +--- /dev/null ++++ b/sound/soc/bcm/audioinjector-pi-soundcard.c +@@ -0,0 +1,142 @@ ++/* ++ * ASoC Driver for AudioInjector Pi add on soundcard ++ * ++ * Created on: 13-May-2016 ++ * Author: flatmax@flatmax.org ++ * based on code by Cliff Cai <Cliff.Cai@analog.com> for the ssm2602 machine blackfin. ++ * with help from Lars-Peter Clausen for simplifying the original code to use the dai_fmt field. ++ * i2s_node code taken from the other sound/soc/bcm machine drivers. ++ * ++ * Copyright (C) 2016 Flatmax Pty. Ltd. ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * version 2 as published by the Free Software Foundation. ++ * ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * General Public License for more details. ++ */ + -+ spidev@1{ -+ compatible = "spidev"; -+ reg = <1>; /* CE1 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; -+ }; -+}; ++#include <linux/module.h> ++#include <linux/types.h> + -+&i2c0 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&i2c0_pins>; -+ clock-frequency = <100000>; -+}; ++#include <sound/core.h> ++#include <sound/soc.h> ++#include <sound/pcm_params.h> ++#include <sound/control.h> + -+&i2c1 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&i2c1_pins>; -+ clock-frequency = <100000>; -+}; ++#include "../codecs/wm8731.h" + -+&i2c2 { -+ clock-frequency = <100000>; -+}; ++static int audioinjector_pi_soundcard_dai_init(struct snd_soc_pcm_runtime *rtd) ++{ ++ struct snd_soc_dapm_context *dapm = &rtd->card->dapm; + -+&i2s { -+ #sound-dai-cells = <0>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&i2s_pins>; -+}; ++ // not connected ++ snd_soc_dapm_nc_pin(dapm, "Mic Bias"); ++ snd_soc_dapm_nc_pin(dapm, "MICIN"); ++ snd_soc_dapm_nc_pin(dapm, "RHPOUT"); ++ snd_soc_dapm_nc_pin(dapm, "LHPOUT"); + -+&random { -+ status = "okay"; -+}; ++ return snd_soc_dai_set_sysclk(rtd->codec_dai, WM8731_SYSCLK_XTAL, 12000000, SND_SOC_CLOCK_IN); ++} + -+&leds { -+ act_led: act { -+ label = "led0"; -+ linux,default-trigger = "mmc0"; -+ gpios = <&gpio 47 0>; -+ }; ++static struct snd_soc_dai_link audioinjector_pi_soundcard_dai[] = { ++ { ++ .name = "AudioInjector audio", ++ .stream_name = "AudioInjector audio", ++ .cpu_dai_name = "bcm2708-i2s.0", ++ .codec_dai_name = "wm8731-hifi", ++ .platform_name = "bcm2835-i2s.0", ++ .codec_name = "wm8731.1-001a", ++ .init = audioinjector_pi_soundcard_dai_init, ++ .dai_fmt = SND_SOC_DAIFMT_CBM_CFM|SND_SOC_DAIFMT_I2S|SND_SOC_DAIFMT_NB_NF, ++ }, +}; + -+/ { -+ chosen { -+ bootargs = "8250.nr_uarts=1"; -+ }; ++static const struct snd_soc_dapm_widget wm8731_dapm_widgets[] = { ++ SND_SOC_DAPM_SPK("Ext Spk", NULL), ++ SND_SOC_DAPM_LINE("Line In Jacks", NULL), +}; + -+/ { -+ __overrides__ { -+ uart0 = <&uart0>,"status"; -+ uart0_clkrate = <&clk_uart0>,"clock-frequency:0"; -+ i2s = <&i2s>,"status"; -+ spi = <&spi0>,"status"; -+ i2c0 = <&i2c0>,"status"; -+ i2c1 = <&i2c1>,"status"; -+ i2c2_iknowwhatimdoing = <&i2c2>,"status"; -+ i2c0_baudrate = <&i2c0>,"clock-frequency:0"; -+ i2c1_baudrate = <&i2c1>,"clock-frequency:0"; -+ i2c2_baudrate = <&i2c2>,"clock-frequency:0"; -+ core_freq = <&clk_core>,"clock-frequency:0"; -+ -+ act_led_gpio = <&act_led>,"gpios:4"; -+ act_led_activelow = <&act_led>,"gpios:8"; -+ act_led_trigger = <&act_led>,"linux,default-trigger"; ++/* Corgi machine connections to the codec pins */ ++static const struct snd_soc_dapm_route audioinjector_audio_map[] = { ++ /* speaker connected to LOUT, ROUT */ ++ {"Ext Spk", NULL, "ROUT"}, ++ {"Ext Spk", NULL, "LOUT"}, + -+ audio = <&audio>,"status"; -+ watchdog = <&watchdog>,"status"; -+ random = <&random>,"status"; -+ }; ++ /* line inputs */ ++ {"Line In Jacks", NULL, "Line Input"}, +}; -diff --git a/arch/arm/boot/dts/bcm2710.dtsi b/arch/arm/boot/dts/bcm2710.dtsi -new file mode 100644 -index 0000000..1a48686 ---- /dev/null -+++ b/arch/arm/boot/dts/bcm2710.dtsi -@@ -0,0 +1,102 @@ -+#include "bcm2708_common.dtsi" -+ -+/ { -+ compatible = "brcm,bcm2710","brcm,bcm2709"; -+ model = "BCM2710"; -+ -+ chosen { -+ /* No padding required - the boot loader can do that. */ -+ bootargs = ""; -+ }; -+ -+ soc { -+ ranges = <0x7e000000 0x3f000000 0x01000000>, -+ <0x40000000 0x40000000 0x00040000>; -+ -+ local_intc: local_intc { -+ compatible = "brcm,bcm2836-l1-intc"; -+ reg = <0x40000000 0x100>; -+ interrupt-controller; -+ #interrupt-cells = <1>; -+ interrupt-parent = <&local_intc>; -+ }; -+ -+ arm-pmu { -+ compatible = "arm,cortex-a7-pmu"; -+ interrupt-parent = <&local_intc>; -+ interrupts = <9>; -+ }; + -+ gpiomem { -+ compatible = "brcm,bcm2835-gpiomem"; -+ reg = <0x7e200000 0x1000>; -+ status = "okay"; -+ }; ++static struct snd_soc_card snd_soc_audioinjector = { ++ .name = "audioinjector-pi-soundcard", ++ .dai_link = audioinjector_pi_soundcard_dai, ++ .num_links = 1, + -+ timer { -+ compatible = "arm,armv7-timer"; -+ clock-frequency = <19200000>; -+ interrupt-parent = <&local_intc>; -+ interrupts = <0>, // PHYS_SECURE_PPI -+ <1>, // PHYS_NONSECURE_PPI -+ <3>, // VIRT_PPI -+ <2>; // HYP_PPI -+ always-on; -+ }; ++ .dapm_widgets = wm8731_dapm_widgets, ++ .num_dapm_widgets = ARRAY_SIZE(wm8731_dapm_widgets), ++ .dapm_routes = audioinjector_audio_map, ++ .num_dapm_routes = ARRAY_SIZE(audioinjector_audio_map), ++}; + -+ syscon@40000000 { -+ compatible = "brcm,bcm2836-arm-local", "syscon"; -+ reg = <0x40000000 0x100>; -+ }; -+ }; ++static int audioinjector_pi_soundcard_probe(struct platform_device *pdev) ++{ ++ struct snd_soc_card *card = &snd_soc_audioinjector; ++ int ret; ++ ++ card->dev = &pdev->dev; + -+ cpus: cpus { -+ #address-cells = <1>; -+ #size-cells = <0>; ++ if (pdev->dev.of_node) { ++ struct snd_soc_dai_link *dai = &audioinjector_pi_soundcard_dai[0]; ++ struct device_node *i2s_node = of_parse_phandle(pdev->dev.of_node, ++ "i2s-controller", 0); + -+ v7_cpu0: cpu@0 { -+ device_type = "cpu"; -+ compatible = "arm,cortex-a7"; -+ reg = <0x000>; -+ clock-frequency = <800000000>; -+ }; ++ if (i2s_node) { ++ dai->cpu_dai_name = NULL; ++ dai->cpu_of_node = i2s_node; ++ dai->platform_name = NULL; ++ dai->platform_of_node = i2s_node; ++ } else ++ if (!dai->cpu_of_node) { ++ dev_err(&pdev->dev, "Property 'i2s-controller' missing or invalid\n"); ++ return -EINVAL; ++ } ++ } + -+ v7_cpu1: cpu@1 { -+ device_type = "cpu"; -+ compatible = "arm,cortex-a7"; -+ reg = <0x001>; -+ clock-frequency = <800000000>; -+ }; ++ if ((ret = snd_soc_register_card(card))) { ++ dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", ret); ++ } ++ return ret; ++} + -+ v7_cpu2: cpu@2 { -+ device_type = "cpu"; -+ compatible = "arm,cortex-a7"; -+ reg = <0x002>; -+ clock-frequency = <800000000>; -+ }; ++static int audioinjector_pi_soundcard_remove(struct platform_device *pdev) ++{ ++ struct snd_soc_card *card = platform_get_drvdata(pdev); ++ return snd_soc_unregister_card(card); + -+ v7_cpu3: cpu@3 { -+ device_type = "cpu"; -+ compatible = "arm,cortex-a7"; -+ reg = <0x003>; -+ clock-frequency = <800000000>; -+ }; -+ }; ++} + -+ __overrides__ { -+ arm_freq = <&v7_cpu0>, "clock-frequency:0", -+ <&v7_cpu1>, "clock-frequency:0", -+ <&v7_cpu2>, "clock-frequency:0", -+ <&v7_cpu3>, "clock-frequency:0"; -+ }; ++static const struct of_device_id audioinjector_pi_soundcard_of_match[] = { ++ { .compatible = "ai,audioinjector-pi-soundcard", }, ++ {}, +}; ++MODULE_DEVICE_TABLE(of, audioinjector_pi_soundcard_of_match); + -+&watchdog { -+ status = "okay"; ++static struct platform_driver audioinjector_pi_soundcard_driver = { ++ .driver = { ++ .name = "audioinjector-audio", ++ .owner = THIS_MODULE, ++ .of_match_table = audioinjector_pi_soundcard_of_match, ++ }, ++ .probe = audioinjector_pi_soundcard_probe, ++ .remove = audioinjector_pi_soundcard_remove, +}; + -+&intc { -+ compatible = "brcm,bcm2836-armctrl-ic"; -+ interrupt-parent = <&local_intc>; -+ interrupts = <8>; -+}; ++module_platform_driver(audioinjector_pi_soundcard_driver); ++MODULE_AUTHOR("Matt Flax <flatmax@flatmax.org>"); ++MODULE_DESCRIPTION("AudioInjector.net Pi Soundcard"); ++MODULE_LICENSE("GPL v2"); ++MODULE_ALIAS("platform:audioinjector-pi-soundcard"); ++ -From 52015bd5f0bb4d64ca51c5f8539cf2552dfb8a42 Mon Sep 17 00:00:00 2001 -From: Phil Elwell <phil@raspberrypi.org> -Date: Thu, 21 Jan 2016 17:57:49 +0000 -Subject: [PATCH 168/170] FIXUP: BCM270X_DT: Update to latest Pi3 DTS +From aa9aed28809dbf4d95025626cb5de26b7da023d1 Mon Sep 17 00:00:00 2001 +From: Dave Stevenson <6by9@users.noreply.github.com> +Date: Wed, 25 May 2016 23:25:36 +0100 +Subject: [PATCH 110/112] BCM2835-V4L2: Correct handling for BGR24 vs RGB24. +There was a bug in the GPU firmware that had reversed these +two formats. +Detect the old firmware, and reverse the formats if necessary. + +Signed-off-by: Dave Stevenson <6by9@users.noreply.github.com> --- - arch/arm/boot/dts/bcm2710-rpi-3-b.dts | 34 ++++++++++++++++++++++++++-------- - 1 file changed, 26 insertions(+), 8 deletions(-) + drivers/media/platform/bcm2835/bcm2835-camera.c | 69 ++++++++++++++++++------- + drivers/media/platform/bcm2835/bcm2835-camera.h | 1 + + 2 files changed, 52 insertions(+), 18 deletions(-) -diff --git a/arch/arm/boot/dts/bcm2710-rpi-3-b.dts b/arch/arm/boot/dts/bcm2710-rpi-3-b.dts -index a6ecb51..cc060898 100644 ---- a/arch/arm/boot/dts/bcm2710-rpi-3-b.dts -+++ b/arch/arm/boot/dts/bcm2710-rpi-3-b.dts -@@ -45,16 +45,21 @@ - }; +diff --git a/drivers/media/platform/bcm2835/bcm2835-camera.c b/drivers/media/platform/bcm2835/bcm2835-camera.c +index 1b16c63..70f4db2 100644 +--- a/drivers/media/platform/bcm2835/bcm2835-camera.c ++++ b/drivers/media/platform/bcm2835/bcm2835-camera.c +@@ -115,7 +115,7 @@ static struct mmal_fmt formats[] = { + .name = "RGB24 (LE)", + .fourcc = V4L2_PIX_FMT_RGB24, + .flags = 0, +- .mmal = MMAL_ENCODING_BGR24, ++ .mmal = MMAL_ENCODING_RGB24, + .depth = 24, + .mmal_component = MMAL_COMPONENT_CAMERA, + .ybbp = 3, +@@ -187,7 +187,7 @@ static struct mmal_fmt formats[] = { + .name = "RGB24 (BE)", + .fourcc = V4L2_PIX_FMT_BGR24, + .flags = 0, +- .mmal = MMAL_ENCODING_RGB24, ++ .mmal = MMAL_ENCODING_BGR24, + .depth = 24, + .mmal_component = MMAL_COMPONENT_CAMERA, + .ybbp = 3, +@@ -1061,6 +1061,13 @@ static int mmal_setup_components(struct bm2835_mmal_dev *dev, + else + camera_port->format.encoding = mfmt->mmal; - bt_pins: bt_pins { -- brcm,pins = <28 29 30 31 14 15 43>; -- brcm,function = <6 6 6 6 2 2 4>; -- // alt2:PCM alt5:UART1 alt0:GPCLK2 -- brcm,pull = <0 0 0 0 0 2 0>; -+ brcm,pins = <28 29 30 31 43>; -+ brcm,function = <6 6 6 6 4>; /* alt2:PCM alt0:GPCLK2 */ -+ brcm,pull = <0 0 0 0 0>; - }; ++ if (dev->rgb_bgr_swapped) { ++ if (camera_port->format.encoding == MMAL_ENCODING_RGB24) ++ camera_port->format.encoding = MMAL_ENCODING_BGR24; ++ else if (camera_port->format.encoding == MMAL_ENCODING_BGR24) ++ camera_port->format.encoding = MMAL_ENCODING_RGB24; ++ } ++ + camera_port->format.encoding_variant = 0; + camera_port->es.video.width = f->fmt.pix.width; + camera_port->es.video.height = f->fmt.pix.height; +@@ -1571,12 +1578,17 @@ static int set_camera_parameters(struct vchiq_mmal_instance *instance, + return ret; + } -- uart1_pins: uart1_pins { -+ uart0_pins: uart0_pins { - brcm,pins = <32 33>; - brcm,function = <7>; /* alt3=UART0 */ -- brcm,pull = <0>; -+ brcm,pull = <0 0>; -+ }; ++#define MAX_SUPPORTED_ENCODINGS 20 + -+ uart1_pins: uart1_pins { -+ brcm,pins = <14 15>; -+ brcm,function = <2>; /* alt5=UART1 */ -+ brcm,pull = <0 0>; - }; - }; + /* MMAL instance and component init */ + static int __init mmal_init(struct bm2835_mmal_dev *dev) + { + int ret; + struct mmal_es_format *format; + u32 bool_true = 1; ++ u32 supported_encodings[MAX_SUPPORTED_ENCODINGS]; ++ int param_size; ++ struct vchiq_mmal_component *camera; -@@ -71,6 +76,17 @@ - non-removable; - bus-width = <4>; - status = "okay"; -+ brcm,overclock-50 = <0>; -+}; + ret = vchiq_mmal_init(&dev->instance); + if (ret < 0) +@@ -1588,21 +1600,48 @@ static int __init mmal_init(struct bm2835_mmal_dev *dev) + if (ret < 0) + goto unreg_mmal; + +- if (dev->component[MMAL_COMPONENT_CAMERA]->outputs < +- MMAL_CAMERA_PORT_COUNT) { ++ camera = dev->component[MMAL_COMPONENT_CAMERA]; ++ if (camera->outputs < MMAL_CAMERA_PORT_COUNT) { + ret = -EINVAL; + goto unreg_camera; + } + + ret = set_camera_parameters(dev->instance, +- dev->component[MMAL_COMPONENT_CAMERA], ++ camera, + dev); + if (ret < 0) + goto unreg_camera; + +- format = +- &dev->component[MMAL_COMPONENT_CAMERA]-> +- output[MMAL_CAMERA_PORT_PREVIEW].format; ++ /* There was an error in the firmware that meant the camera component ++ * produced BGR instead of RGB. ++ * This is now fixed, but in order to support the old firmwares, we ++ * have to check. ++ */ ++ dev->rgb_bgr_swapped = true; ++ param_size = sizeof(supported_encodings); ++ ret = vchiq_mmal_port_parameter_get(dev->instance, ++ &camera->output[MMAL_CAMERA_PORT_CAPTURE], ++ MMAL_PARAMETER_SUPPORTED_ENCODINGS, ++ &supported_encodings, ++ &param_size); ++ if (ret == 0) { ++ int i; + -+&soc { -+ virtgpio: virtgpio { -+ compatible = "brcm,bcm2835-virtgpio"; -+ gpio-controller; -+ #gpio-cells = <2>; -+ firmware = <&firmware>; -+ status = "okay"; -+ }; - }; ++ for (i = 0; i < param_size/sizeof(u32); i++) { ++ if (supported_encodings[i] == MMAL_ENCODING_BGR24) { ++ /* Found BGR24 first - old firmware. */ ++ break; ++ } ++ if (supported_encodings[i] == MMAL_ENCODING_RGB24) { ++ /* Found RGB24 first ++ * new firmware, so use RGB24. ++ */ ++ dev->rgb_bgr_swapped = false; ++ break; ++ } ++ } ++ } ++ format = &camera->output[MMAL_CAMERA_PORT_PREVIEW].format; - &fb { -@@ -78,12 +94,14 @@ - }; + format->encoding = MMAL_ENCODING_OPAQUE; + format->encoding_variant = MMAL_ENCODING_I420; +@@ -1616,9 +1655,7 @@ static int __init mmal_init(struct bm2835_mmal_dev *dev) + format->es->video.frame_rate.num = 0; /* Rely on fps_range */ + format->es->video.frame_rate.den = 1; - &uart0 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&uart0_pins &bt_pins>; - status = "okay"; - }; +- format = +- &dev->component[MMAL_COMPONENT_CAMERA]-> +- output[MMAL_CAMERA_PORT_VIDEO].format; ++ format = &camera->output[MMAL_CAMERA_PORT_VIDEO].format; - &uart1 { - pinctrl-names = "default"; -- pinctrl-0 = <&uart1_pins &bt_pins>; -+ pinctrl-0 = <&uart1_pins>; - status = "okay"; - }; + format->encoding = MMAL_ENCODING_OPAQUE; + format->encoding_variant = MMAL_ENCODING_I420; +@@ -1633,14 +1670,11 @@ static int __init mmal_init(struct bm2835_mmal_dev *dev) + format->es->video.frame_rate.den = 1; -@@ -139,7 +157,7 @@ - act_led: act { - label = "led0"; - linux,default-trigger = "mmc0"; -- gpios = <&gpio 47 0>; -+ gpios = <&virtgpio 0 0>; - }; + vchiq_mmal_port_parameter_set(dev->instance, +- &dev->component[MMAL_COMPONENT_CAMERA]-> +- output[MMAL_CAMERA_PORT_VIDEO], ++ &camera->output[MMAL_CAMERA_PORT_VIDEO], + MMAL_PARAMETER_NO_IMAGE_PADDING, + &bool_true, sizeof(bool_true)); + +- format = +- &dev->component[MMAL_COMPONENT_CAMERA]-> +- output[MMAL_CAMERA_PORT_CAPTURE].format; ++ format = &camera->output[MMAL_CAMERA_PORT_CAPTURE].format; + + format->encoding = MMAL_ENCODING_OPAQUE; + +@@ -1662,8 +1696,7 @@ static int __init mmal_init(struct bm2835_mmal_dev *dev) + dev->capture.enc_level = V4L2_MPEG_VIDEO_H264_LEVEL_4_0; + + vchiq_mmal_port_parameter_set(dev->instance, +- &dev->component[MMAL_COMPONENT_CAMERA]-> +- output[MMAL_CAMERA_PORT_CAPTURE], ++ &camera->output[MMAL_CAMERA_PORT_CAPTURE], + MMAL_PARAMETER_NO_IMAGE_PADDING, + &bool_true, sizeof(bool_true)); + +diff --git a/drivers/media/platform/bcm2835/bcm2835-camera.h b/drivers/media/platform/bcm2835/bcm2835-camera.h +index 13f426f..e6aeb7e 100644 +--- a/drivers/media/platform/bcm2835/bcm2835-camera.h ++++ b/drivers/media/platform/bcm2835/bcm2835-camera.h +@@ -109,6 +109,7 @@ struct bm2835_mmal_dev { + unsigned int camera_num; + unsigned int max_width; + unsigned int max_height; ++ unsigned int rgb_bgr_swapped; }; + int bm2835_mmal_init_controls( + +From e17217216036509a8711ab042e4808b0b4c59a66 Mon Sep 17 00:00:00 2001 +From: escalator2015 <jmtasende@gmail.com> +Date: Tue, 24 May 2016 16:20:09 +0100 +Subject: [PATCH 111/112] New driver for RRA DigiDAC1 soundcard using WM8741 + + WM8804 -From 310f5af54ca26b68795f0376c67b41e2bb18a0e0 Mon Sep 17 00:00:00 2001 -From: Dave Stevenson <6by9@users.noreply.github.com> -Date: Mon, 8 Feb 2016 23:49:41 +0000 -Subject: [PATCH 169/170] DT: Add overlays to configure I2C pins - -Lifted from -https://www.raspberrypi.org/forums/viewtopic.php?f=107&t=120938&p=825883 -so not claiming this to be my own work. -Adds overlays i2c0-bcm2708 and i2c1-bcm2708 that allow the pin -allocations for i2c-0 and i2c-1 to be changed. --- - arch/arm/boot/dts/overlays/Makefile | 2 ++ - arch/arm/boot/dts/overlays/README | 16 ++++++++++ - .../arm/boot/dts/overlays/i2c0-bcm2708-overlay.dts | 36 +++++++++++++++++++++ - .../arm/boot/dts/overlays/i2c1-bcm2708-overlay.dts | 37 ++++++++++++++++++++++ - 4 files changed, 91 insertions(+) - create mode 100644 arch/arm/boot/dts/overlays/i2c0-bcm2708-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/i2c1-bcm2708-overlay.dts + arch/arm/configs/bcm2709_defconfig | 1 + + arch/arm/configs/bcmrpi_defconfig | 1 + + sound/soc/bcm/Kconfig | 8 + + sound/soc/bcm/Makefile | 2 + + sound/soc/bcm/digidac1-soundcard.c | 422 +++++++++++++++++++++++++++++++++++++ + 5 files changed, 434 insertions(+) + create mode 100644 sound/soc/bcm/digidac1-soundcard.c -diff --git a/arch/arm/boot/dts/overlays/Makefile b/arch/arm/boot/dts/overlays/Makefile -index a787d66..f2bc3ce 100644 ---- a/arch/arm/boot/dts/overlays/Makefile -+++ b/arch/arm/boot/dts/overlays/Makefile -@@ -29,6 +29,8 @@ dtb-$(RPI_DT_OVERLAYS) += hy28a-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += hy28b-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += i2c-rtc-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += i2c-gpio-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += i2c0-bcm2708-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += i2c1-bcm2708-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += i2s-mmap-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += iqaudio-dac-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += iqaudio-dacplus-overlay.dtb -diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README -index cf5f5be..7d7bbb8 100644 ---- a/arch/arm/boot/dts/overlays/README -+++ b/arch/arm/boot/dts/overlays/README -@@ -371,6 +371,22 @@ Params: ds1307 Select the DS1307 device - pcf8563 Select the PCF8563 device +diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig +index 055ecfc..1643dab 100644 +--- a/arch/arm/configs/bcm2709_defconfig ++++ b/arch/arm/configs/bcm2709_defconfig +@@ -862,6 +862,7 @@ CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC=m + CONFIG_SND_BCM2708_SOC_RASPIDAC3=m + CONFIG_SND_BCM2708_SOC_ADAU1977_ADC=m + CONFIG_SND_AUDIOINJECTOR_PI_SOUNDCARD=m ++CONFIG_SND_DIGIDAC1_SOUNDCARD=m + CONFIG_SND_SOC_ADAU1701=m + CONFIG_SND_SOC_WM8804_I2C=m + CONFIG_SND_SIMPLE_CARD=m +diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig +index 8e0b51f..d936b43 100644 +--- a/arch/arm/configs/bcmrpi_defconfig ++++ b/arch/arm/configs/bcmrpi_defconfig +@@ -854,6 +854,7 @@ CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC=m + CONFIG_SND_BCM2708_SOC_RASPIDAC3=m + CONFIG_SND_BCM2708_SOC_ADAU1977_ADC=m + CONFIG_SND_AUDIOINJECTOR_PI_SOUNDCARD=m ++CONFIG_SND_DIGIDAC1_SOUNDCARD=m + CONFIG_SND_SOC_ADAU1701=m + CONFIG_SND_SOC_WM8804_I2C=m + CONFIG_SND_SIMPLE_CARD=m +diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig +index e2e40ed..fa11cd7 100644 +--- a/sound/soc/bcm/Kconfig ++++ b/sound/soc/bcm/Kconfig +@@ -92,3 +92,11 @@ config SND_AUDIOINJECTOR_PI_SOUNDCARD + select SND_SOC_WM8731 + help + Say Y or M if you want to add support for audioinjector.net Pi Hat ++ ++config SND_DIGIDAC1_SOUNDCARD ++ tristate "Support for Red Rocks Audio DigiDAC1" ++ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S ++ select SND_SOC_WM8804 ++ select SND_SOC_WM8741 ++ help ++ Say Y or M if you want to add support for Red Rocks Audio DigiDAC1 board. +diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile +index 3353192..a9448fd 100644 +--- a/sound/soc/bcm/Makefile ++++ b/sound/soc/bcm/Makefile +@@ -16,6 +16,7 @@ snd-soc-rpi-proto-objs := rpi-proto.o + snd-soc-iqaudio-dac-objs := iqaudio-dac.o + snd-soc-raspidac3-objs := raspidac3.o + snd-soc-audioinjector-pi-soundcard-objs := audioinjector-pi-soundcard.o ++snd-soc-digidac1-soundcard-objs := digidac1-soundcard.o + obj-$(CONFIG_SND_BCM2708_SOC_ADAU1977_ADC) += snd-soc-adau1977-adc.o + obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o +@@ -29,4 +30,5 @@ obj-$(CONFIG_SND_BCM2708_SOC_RPI_PROTO) += snd-soc-rpi-proto.o + obj-$(CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC) += snd-soc-iqaudio-dac.o + obj-$(CONFIG_SND_BCM2708_SOC_RASPIDAC3) += snd-soc-raspidac3.o + obj-$(CONFIG_SND_AUDIOINJECTOR_PI_SOUNDCARD) += snd-soc-audioinjector-pi-soundcard.o ++obj-$(CONFIG_SND_DIGIDAC1_SOUNDCARD) += snd-soc-digidac1-soundcard.o -+Name: i2c0-bcm2708 -+Info: Enable the i2c_bcm2708 driver for the i2c0 bus -+Load: dtoverlay=i2c0-bcm2708,<param>=<val> -+Params: sda0_pin GPIO pin for SDA0 (0, 28 [or 44] - default 0) -+ scl0_pin GPIO pin for SCL0 (1, 29 [or 45] - default 1) -+ -+ -+Name: i2c1-bcm2708 -+Info: Enable the i2c_bcm2708 driver for the i2c1 bus -+Load: dtoverlay=i2c1-bcm2708,<param>=<val> -+Params: sda1_pin GPIO pin for SDA1 (2 or 44 - default 2) -+ scl1_pin GPIO pin for SCL1 (3 or 45 - default 3) -+ pin_func Alternative pin function (4 (alt0), 6 (alt2) - -+ default 4) -+ -+ - Name: i2s-mmap - Info: Enables mmap support in the bcm2708-i2s driver - Load: dtoverlay=i2s-mmap -diff --git a/arch/arm/boot/dts/overlays/i2c0-bcm2708-overlay.dts b/arch/arm/boot/dts/overlays/i2c0-bcm2708-overlay.dts +diff --git a/sound/soc/bcm/digidac1-soundcard.c b/sound/soc/bcm/digidac1-soundcard.c new file mode 100644 -index 0000000..5c0e55b +index 0000000..446796e --- /dev/null -+++ b/arch/arm/boot/dts/overlays/i2c0-bcm2708-overlay.dts -@@ -0,0 +1,36 @@ ++++ b/sound/soc/bcm/digidac1-soundcard.c +@@ -0,0 +1,422 @@ +/* -+ * Device tree overlay for i2c_bcm2708, i2c0 bus ++ * ASoC Driver for RRA DigiDAC1 ++ * Copyright 2016 ++ * Author: José M. Tasende <vintage@redrocksaudio.es> ++ * based on the HifiBerry DAC driver by Florian Meier <florian.meier@koalo.de> ++ * and the Wolfson card driver by Nikesh Oswal, <Nikesh.Oswal@wolfsonmicro.com> ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * version 2 as published by the Free Software Foundation. + * -+ * Compile: -+ * dtc -@ -I dts -O dtb -o i2c0-bcm2708-overlay.dtb i2c0-bcm2708-overlay.dts ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * General Public License for more details. + */ + -+/dts-v1/; -+/plugin/; ++#include <linux/module.h> ++#include <linux/platform_device.h> ++#include <linux/i2c.h> ++#include <sound/core.h> ++#include <sound/pcm.h> ++#include <sound/pcm_params.h> ++#include <sound/soc.h> ++#include <sound/jack.h> ++#include <sound/soc-dapm.h> ++#include <sound/tlv.h> ++#include <linux/regulator/consumer.h> + -+/{ -+ compatible = "brcm,bcm2708"; ++#include "../codecs/wm8804.h" ++#include "../codecs/wm8741.h" + -+ fragment@0 { -+ target = <&i2c0>; -+ __overlay__ { -+ pinctrl-0 = <&i2c0_pins>; -+ status = "okay"; -+ }; -+ }; ++#define WM8741_NUM_SUPPLIES 2 + -+ fragment@1 { -+ target = <&gpio>; -+ __overlay__ { -+ i2c0_pins: i2c0 { -+ brcm,pins = <0 1>; -+ brcm,function = <4>; /* alt0 */ -+ }; -+ }; -+ }; ++/* codec private data */ ++struct wm8741_priv { ++ struct wm8741_platform_data pdata; ++ struct regmap *regmap; ++ struct regulator_bulk_data supplies[WM8741_NUM_SUPPLIES]; ++ unsigned int sysclk; ++ const struct snd_pcm_hw_constraint_list *sysclk_constraints; ++}; ++ ++static int samplerate = 44100; ++ ++/* New Alsa Controls not exposed by original wm8741 codec driver */ ++/* in actual driver the att. adjustment is wrong because */ ++/* this DAC has a coarse attenuation register with 4dB steps */ ++/* and a fine level register with 0.125dB steps */ ++/* each register has 32 steps so combining both we have 1024 steps */ ++/* of 0.125 dB. */ ++/* The original level controls from driver are removed at startup */ ++/* and replaced by the corrected ones. */ ++/* The same wm8741 driver can be used for wm8741 and wm8742 devices */ ++ ++static const DECLARE_TLV_DB_SCALE(dac_tlv_fine, 0, 13, 0); ++static const DECLARE_TLV_DB_SCALE(dac_tlv_coarse, -12700, 400, 1); ++static const char *w8741_dither[4] = {"Off", "RPDF", "TPDF", "HPDF"}; ++static const char *w8741_filter[5] = { ++ "Type 1", "Type 2", "Type 3", "Type 4", "Type 5"}; ++static const char *w8741_switch[2] = {"Off", "On"}; ++static const struct soc_enum w8741_enum[] = { ++SOC_ENUM_SINGLE(WM8741_MODE_CONTROL_2, 0, 4, w8741_dither),/* dithering type */ ++SOC_ENUM_SINGLE(WM8741_FILTER_CONTROL, 0, 5, w8741_filter),/* filter type */ ++SOC_ENUM_SINGLE(WM8741_FORMAT_CONTROL, 6, 2, w8741_switch),/* phase invert */ ++SOC_ENUM_SINGLE(WM8741_VOLUME_CONTROL, 0, 2, w8741_switch),/* volume ramp */ ++SOC_ENUM_SINGLE(WM8741_VOLUME_CONTROL, 3, 2, w8741_switch),/* soft mute */ ++}; ++ ++static const struct snd_kcontrol_new w8741_snd_controls_stereo[] = { ++SOC_DOUBLE_R_TLV("DAC Fine Playback Volume", WM8741_DACLLSB_ATTENUATION, ++ WM8741_DACRLSB_ATTENUATION, 0, 31, 1, dac_tlv_fine), ++SOC_DOUBLE_R_TLV("Digital Playback Volume", WM8741_DACLMSB_ATTENUATION, ++ WM8741_DACRMSB_ATTENUATION, 0, 31, 1, dac_tlv_coarse), ++SOC_ENUM("DAC Dither", w8741_enum[0]), ++SOC_ENUM("DAC Digital Filter", w8741_enum[1]), ++SOC_ENUM("DAC Phase Invert", w8741_enum[2]), ++SOC_ENUM("DAC Volume Ramp", w8741_enum[3]), ++SOC_ENUM("DAC Soft Mute", w8741_enum[4]), ++}; ++ ++static const struct snd_kcontrol_new w8741_snd_controls_mono_left[] = { ++SOC_SINGLE_TLV("DAC Fine Playback Volume", WM8741_DACLLSB_ATTENUATION, ++ 0, 31, 0, dac_tlv_fine), ++SOC_SINGLE_TLV("Digital Playback Volume", WM8741_DACLMSB_ATTENUATION, ++ 0, 31, 1, dac_tlv_coarse), ++SOC_ENUM("DAC Dither", w8741_enum[0]), ++SOC_ENUM("DAC Digital Filter", w8741_enum[1]), ++SOC_ENUM("DAC Phase Invert", w8741_enum[2]), ++SOC_ENUM("DAC Volume Ramp", w8741_enum[3]), ++SOC_ENUM("DAC Soft Mute", w8741_enum[4]), ++}; ++ ++static const struct snd_kcontrol_new w8741_snd_controls_mono_right[] = { ++SOC_SINGLE_TLV("DAC Fine Playback Volume", WM8741_DACRLSB_ATTENUATION, ++ 0, 31, 0, dac_tlv_fine), ++SOC_SINGLE_TLV("Digital Playback Volume", WM8741_DACRMSB_ATTENUATION, ++ 0, 31, 1, dac_tlv_coarse), ++SOC_ENUM("DAC Dither", w8741_enum[0]), ++SOC_ENUM("DAC Digital Filter", w8741_enum[1]), ++SOC_ENUM("DAC Phase Invert", w8741_enum[2]), ++SOC_ENUM("DAC Volume Ramp", w8741_enum[3]), ++SOC_ENUM("DAC Soft Mute", w8741_enum[4]), ++}; ++ ++static int w8741_add_controls(struct snd_soc_codec *codec) ++{ ++ struct wm8741_priv *wm8741 = snd_soc_codec_get_drvdata(codec); ++ ++ switch (wm8741->pdata.diff_mode) { ++ case WM8741_DIFF_MODE_STEREO: ++ case WM8741_DIFF_MODE_STEREO_REVERSED: ++ snd_soc_add_codec_controls(codec, ++ w8741_snd_controls_stereo, ++ ARRAY_SIZE(w8741_snd_controls_stereo)); ++ break; ++ case WM8741_DIFF_MODE_MONO_LEFT: ++ snd_soc_add_codec_controls(codec, ++ w8741_snd_controls_mono_left, ++ ARRAY_SIZE(w8741_snd_controls_mono_left)); ++ break; ++ case WM8741_DIFF_MODE_MONO_RIGHT: ++ snd_soc_add_codec_controls(codec, ++ w8741_snd_controls_mono_right, ++ ARRAY_SIZE(w8741_snd_controls_mono_right)); ++ break; ++ default: ++ return -EINVAL; ++ } + -+ __overrides__ { -+ sda0_pin = <&i2c0_pins>,"brcm,pins:0"; -+ scl0_pin = <&i2c0_pins>,"brcm,pins:4"; -+ }; ++ return 0; ++} ++ ++static int digidac1_soundcard_init(struct snd_soc_pcm_runtime *rtd) ++{ ++ struct snd_soc_codec *codec = rtd->codec; ++ struct snd_soc_card *card = rtd->card; ++ struct snd_soc_pcm_runtime *wm8741_rtd; ++ struct snd_soc_codec *wm8741_codec; ++ struct snd_card *sound_card = card->snd_card; ++ struct snd_kcontrol *kctl; ++ int ret; ++ ++ wm8741_rtd = snd_soc_get_pcm_runtime(card, card->dai_link[1].name); ++ if (!wm8741_rtd) { ++ dev_warn(card->dev, "digidac1_soundcard_init: couldn't get wm8741 rtd\n"); ++ return -EFAULT; ++ } ++ wm8741_codec = wm8741_rtd->codec; ++ ret = w8741_add_controls(wm8741_codec); ++ if (ret < 0) ++ dev_warn(card->dev, "Failed to add new wm8741 controls: %d\n", ++ ret); ++ ++ /* enable TX output */ ++ snd_soc_update_bits(codec, WM8804_PWRDN, 0x4, 0x0); ++ ++ kctl = snd_soc_card_get_kcontrol(card, ++ "Playback Volume"); ++ if (kctl) { ++ kctl->vd[0].access = SNDRV_CTL_ELEM_ACCESS_READWRITE; ++ snd_ctl_remove(sound_card, kctl); ++ } ++ kctl = snd_soc_card_get_kcontrol(card, ++ "Fine Playback Volume"); ++ if (kctl) { ++ kctl->vd[0].access = SNDRV_CTL_ELEM_ACCESS_READWRITE; ++ snd_ctl_remove(sound_card, kctl); ++ } ++ return 0; ++} ++ ++static int digidac1_soundcard_startup(struct snd_pcm_substream *substream) ++{ ++ /* turn on wm8804 digital output */ ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_codec *codec = rtd->codec; ++ struct snd_soc_card *card = rtd->card; ++ struct snd_soc_pcm_runtime *wm8741_rtd; ++ struct snd_soc_codec *wm8741_codec; ++ ++ snd_soc_update_bits(codec, WM8804_PWRDN, 0x3c, 0x00); ++ wm8741_rtd = snd_soc_get_pcm_runtime(card, card->dai_link[1].name); ++ if (!wm8741_rtd) { ++ dev_warn(card->dev, "digidac1_soundcard_startup: couldn't get WM8741 rtd\n"); ++ return -EFAULT; ++ } ++ wm8741_codec = wm8741_rtd->codec; ++ ++ /* latch wm8741 level */ ++ snd_soc_update_bits(wm8741_codec, WM8741_DACLLSB_ATTENUATION, ++ WM8741_UPDATELL, WM8741_UPDATELL); ++ snd_soc_update_bits(wm8741_codec, WM8741_DACLMSB_ATTENUATION, ++ WM8741_UPDATELM, WM8741_UPDATELM); ++ snd_soc_update_bits(wm8741_codec, WM8741_DACRLSB_ATTENUATION, ++ WM8741_UPDATERL, WM8741_UPDATERL); ++ snd_soc_update_bits(wm8741_codec, WM8741_DACRMSB_ATTENUATION, ++ WM8741_UPDATERM, WM8741_UPDATERM); ++ ++ return 0; ++} ++ ++static void digidac1_soundcard_shutdown(struct snd_pcm_substream *substream) ++{ ++ /* turn off wm8804 digital output */ ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_codec *codec = rtd->codec; ++ ++ snd_soc_update_bits(codec, WM8804_PWRDN, 0x3c, 0x3c); ++} ++ ++static int digidac1_soundcard_hw_params(struct snd_pcm_substream *substream, ++ struct snd_pcm_hw_params *params) ++{ ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_dai *codec_dai = rtd->codec_dai; ++ struct snd_soc_codec *codec = rtd->codec; ++ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; ++ struct snd_soc_card *card = rtd->card; ++ struct snd_soc_pcm_runtime *wm8741_rtd; ++ struct snd_soc_codec *wm8741_codec; ++ ++ int sysclk = 27000000; ++ long mclk_freq = 0; ++ int mclk_div = 1; ++ int sampling_freq = 1; ++ int ret; ++ ++ wm8741_rtd = snd_soc_get_pcm_runtime(card, card->dai_link[1].name); ++ if (!wm8741_rtd) { ++ dev_warn(card->dev, "digidac1_soundcard_hw_params: couldn't get WM8741 rtd\n"); ++ return -EFAULT; ++ } ++ wm8741_codec = wm8741_rtd->codec; ++ samplerate = params_rate(params); ++ ++ if (samplerate <= 96000) { ++ mclk_freq = samplerate*256; ++ mclk_div = WM8804_MCLKDIV_256FS; ++ } else { ++ mclk_freq = samplerate*128; ++ mclk_div = WM8804_MCLKDIV_128FS; ++ } ++ ++ switch (samplerate) { ++ case 32000: ++ sampling_freq = 0x03; ++ break; ++ case 44100: ++ sampling_freq = 0x00; ++ break; ++ case 48000: ++ sampling_freq = 0x02; ++ break; ++ case 88200: ++ sampling_freq = 0x08; ++ break; ++ case 96000: ++ sampling_freq = 0x0a; ++ break; ++ case 176400: ++ sampling_freq = 0x0c; ++ break; ++ case 192000: ++ sampling_freq = 0x0e; ++ break; ++ default: ++ dev_err(codec->dev, ++ "Failed to set WM8804 SYSCLK, unsupported samplerate %d\n", ++ samplerate); ++ } ++ ++ snd_soc_dai_set_clkdiv(codec_dai, WM8804_MCLK_DIV, mclk_div); ++ snd_soc_dai_set_pll(codec_dai, 0, 0, sysclk, mclk_freq); ++ ++ ret = snd_soc_dai_set_sysclk(codec_dai, WM8804_TX_CLKSRC_PLL, ++ sysclk, SND_SOC_CLOCK_OUT); ++ if (ret < 0) { ++ dev_err(codec->dev, ++ "Failed to set WM8804 SYSCLK: %d\n", ret); ++ return ret; ++ } ++ /* Enable wm8804 TX output */ ++ snd_soc_update_bits(codec, WM8804_PWRDN, 0x4, 0x0); ++ ++ /* wm8804 Power on */ ++ snd_soc_update_bits(codec, WM8804_PWRDN, 0x9, 0); ++ ++ /* wm8804 set sampling frequency status bits */ ++ snd_soc_update_bits(codec, WM8804_SPDTX4, 0x0f, sampling_freq); ++ ++ /* Now update wm8741 registers for the correct oversampling */ ++ if (samplerate <= 48000) ++ snd_soc_update_bits(wm8741_codec, WM8741_MODE_CONTROL_1, ++ WM8741_OSR_MASK, 0x00); ++ else if (samplerate <= 96000) ++ snd_soc_update_bits(wm8741_codec, WM8741_MODE_CONTROL_1, ++ WM8741_OSR_MASK, 0x20); ++ else ++ snd_soc_update_bits(wm8741_codec, WM8741_MODE_CONTROL_1, ++ WM8741_OSR_MASK, 0x40); ++ ++ /* wm8741 bit size */ ++ switch (params_width(params)) { ++ case 16: ++ snd_soc_update_bits(wm8741_codec, WM8741_FORMAT_CONTROL, ++ WM8741_IWL_MASK, 0x00); ++ break; ++ case 20: ++ snd_soc_update_bits(wm8741_codec, WM8741_FORMAT_CONTROL, ++ WM8741_IWL_MASK, 0x01); ++ break; ++ case 24: ++ snd_soc_update_bits(wm8741_codec, WM8741_FORMAT_CONTROL, ++ WM8741_IWL_MASK, 0x02); ++ break; ++ case 32: ++ snd_soc_update_bits(wm8741_codec, WM8741_FORMAT_CONTROL, ++ WM8741_IWL_MASK, 0x03); ++ break; ++ default: ++ dev_dbg(codec->dev, "wm8741_hw_params: Unsupported bit size param = %d", ++ params_width(params)); ++ return -EINVAL; ++ } ++ ++ return snd_soc_dai_set_bclk_ratio(cpu_dai, 64); ++} ++/* machine stream operations */ ++static struct snd_soc_ops digidac1_soundcard_ops = { ++ .hw_params = digidac1_soundcard_hw_params, ++ .startup = digidac1_soundcard_startup, ++ .shutdown = digidac1_soundcard_shutdown, +}; -diff --git a/arch/arm/boot/dts/overlays/i2c1-bcm2708-overlay.dts b/arch/arm/boot/dts/overlays/i2c1-bcm2708-overlay.dts -new file mode 100644 -index 0000000..e303b9c ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/i2c1-bcm2708-overlay.dts -@@ -0,0 +1,37 @@ -+/* -+ * Device tree overlay for i2c_bcm2708, i2c1 bus -+ * -+ * Compile: -+ * dtc -@ -I dts -O dtb -o i2c1-bcm2708-overlay.dtb i2c1-bcm2708-overlay.dts -+ */ + -+/dts-v1/; -+/plugin/; ++static struct snd_soc_dai_link digidac1_soundcard_dai[] = { ++ { ++ .name = "RRA DigiDAC1", ++ .stream_name = "RRA DigiDAC1 HiFi", ++ .cpu_dai_name = "bcm2708-i2s.0", ++ .codec_dai_name = "wm8804-spdif", ++ .platform_name = "bcm2708-i2s.0", ++ .codec_name = "wm8804.1-003b", ++ .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | ++ SND_SOC_DAIFMT_CBM_CFM, ++ .ops = &digidac1_soundcard_ops, ++ .init = digidac1_soundcard_init, ++ }, ++ { ++ .name = "RRA DigiDAC11", ++ .stream_name = "RRA DigiDAC11 HiFi", ++ .cpu_dai_name = "wm8804-spdif", ++ .codec_dai_name = "wm8741", ++ .codec_name = "wm8741.1-001a", ++ .dai_fmt = SND_SOC_DAIFMT_I2S ++ | SND_SOC_DAIFMT_NB_NF ++ | SND_SOC_DAIFMT_CBS_CFS, ++ }, ++}; + -+/{ -+ compatible = "brcm,bcm2708"; ++/* audio machine driver */ ++static struct snd_soc_card digidac1_soundcard = { ++ .name = "digidac1-soundcard", ++ .owner = THIS_MODULE, ++ .dai_link = digidac1_soundcard_dai, ++ .num_links = ARRAY_SIZE(digidac1_soundcard_dai), ++}; + -+ fragment@0 { -+ target = <&i2c1>; -+ __overlay__ { -+ pinctrl-0 = <&i2c1_pins>; -+ status = "okay"; -+ }; -+ }; ++static int digidac1_soundcard_probe(struct platform_device *pdev) ++{ ++ int ret = 0; + -+ fragment@1 { -+ target = <&gpio>; -+ __overlay__ { -+ i2c1_pins: i2c1 { -+ brcm,pins = <2 3>; -+ brcm,function = <4>; /* alt0 */ -+ }; -+ }; -+ }; ++ digidac1_soundcard.dev = &pdev->dev; + -+ __overrides__ { -+ sda1_pin = <&i2c1_pins>,"brcm,pins:0"; -+ scl1_pin = <&i2c1_pins>,"brcm,pins:4"; -+ pin_func = <&i2c1_pins>,"brcm,function:0"; -+ }; ++ if (pdev->dev.of_node) { ++ struct device_node *i2s_node; ++ struct snd_soc_dai_link *dai = &digidac1_soundcard_dai[0]; ++ ++ i2s_node = of_parse_phandle(pdev->dev.of_node, ++ "i2s-controller", 0); ++ ++ if (i2s_node) { ++ dai->cpu_dai_name = NULL; ++ dai->cpu_of_node = i2s_node; ++ dai->platform_name = NULL; ++ dai->platform_of_node = i2s_node; ++ } ++ } ++ ++ ret = snd_soc_register_card(&digidac1_soundcard); ++ if (ret) ++ dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", ++ ret); ++ ++ return ret; ++} ++ ++static int digidac1_soundcard_remove(struct platform_device *pdev) ++{ ++ return snd_soc_unregister_card(&digidac1_soundcard); ++} ++ ++static const struct of_device_id digidac1_soundcard_of_match[] = { ++ { .compatible = "rra,digidac1-soundcard", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, digidac1_soundcard_of_match); ++ ++static struct platform_driver digidac1_soundcard_driver = { ++ .driver = { ++ .name = "digidac1-audio", ++ .owner = THIS_MODULE, ++ .of_match_table = digidac1_soundcard_of_match, ++ }, ++ .probe = digidac1_soundcard_probe, ++ .remove = digidac1_soundcard_remove, +}; ++ ++module_platform_driver(digidac1_soundcard_driver); ++ ++MODULE_AUTHOR("José M. Tasende <vintage@redrocksaudio.es>"); ++MODULE_DESCRIPTION("ASoC Driver for RRA DigiDAC1"); ++MODULE_LICENSE("GPL v2"); -From c5cbb66686e7e289e8a7aff49a954f86893e628d Mon Sep 17 00:00:00 2001 -From: Dhiraj Goel <dhiraj.goel@gmail.com> -Date: Thu, 3 Mar 2016 21:10:50 -0800 -Subject: [PATCH 170/170] bcm2835-camera: fix a bug in computation of frame - timestamp +From 8f1f7957d7684294706126f51dc46e362d7822a4 Mon Sep 17 00:00:00 2001 +From: Phil Elwell <phil@raspberrypi.org> +Date: Fri, 3 Jun 2016 21:56:40 +0100 +Subject: [PATCH 112/112] BCM270X_DT: Fix rpi-dac overlay -Fixes #1318 +The rpi-dac overlay is almost identical to the hifiberry-dac overlay - +the codec used is different but it also doesn't sit on the I2C bus. As +a result, when the overlays were modified for dynamic loading and it +was discovered that the hifiberry-dac overlay didn't work any more, the +the rpi-dac overlay was also broken. + +The failure was caused by the fact that outside a bus, device names are +constructed from the concatenation of the path elements leading to it, +so moving the codec instantiation inside /soc caused the device name +to get a "soc" added, breaking ALSA's naming. + +See: http://forum.kodi.tv/showthread.php?tid=269814&pid=2349776#pid2349776 + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> --- - drivers/media/platform/bcm2835/bcm2835-camera.c | 3 +-- - 1 file changed, 1 insertion(+), 2 deletions(-) + arch/arm/boot/dts/overlays/rpi-dac-overlay.dts | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) -diff --git a/drivers/media/platform/bcm2835/bcm2835-camera.c b/drivers/media/platform/bcm2835/bcm2835-camera.c -index e83334c..98a892e 100644 ---- a/drivers/media/platform/bcm2835/bcm2835-camera.c -+++ b/drivers/media/platform/bcm2835/bcm2835-camera.c -@@ -360,8 +360,7 @@ static void buffer_cb(struct vchiq_mmal_instance *instance, - div = - div_u64_rem(runtime_us, USEC_PER_SEC, &rem); - buf->vb.timestamp.tv_sec = -- dev->capture.kernel_start_ts.tv_sec - 1 + -- div; -+ dev->capture.kernel_start_ts.tv_sec + div; - buf->vb.timestamp.tv_usec = - dev->capture.kernel_start_ts.tv_usec + rem; +diff --git a/arch/arm/boot/dts/overlays/rpi-dac-overlay.dts b/arch/arm/boot/dts/overlays/rpi-dac-overlay.dts +index 1523eae..a442c8f0 100644 +--- a/arch/arm/boot/dts/overlays/rpi-dac-overlay.dts ++++ b/arch/arm/boot/dts/overlays/rpi-dac-overlay.dts +@@ -13,7 +13,7 @@ + }; + fragment@1 { +- target = <&soc>; ++ target-path = "/"; + __overlay__ { + pcm1794a-codec { + #sound-dai-cells = <0>; diff --git a/projects/RPi2/filesystem/usr/lib/systemd/system/serial-console.service b/projects/RPi2/filesystem/usr/lib/systemd/system/serial-console.service index 5dffa1a8431..196e8c4a97a 100644 --- a/projects/RPi2/filesystem/usr/lib/systemd/system/serial-console.service +++ b/projects/RPi2/filesystem/usr/lib/systemd/system/serial-console.service @@ -6,6 +6,7 @@ ConditionKernelCommandLine=console [Service] WorkingDirectory=/storage Environment="ENV=/etc/profile" +ExecStartPre=/bin/sh -c 'echo -en "\033[?25h"' ExecStart=/bin/sh Restart=always RestartSec=0 diff --git a/projects/RPi2/kodi/advancedsettings.xml b/projects/RPi2/kodi/advancedsettings.xml index e1a7c0dc9bc..45b34cb598e 100644 --- a/projects/RPi2/kodi/advancedsettings.xml +++ b/projects/RPi2/kodi/advancedsettings.xml @@ -12,9 +12,4 @@ <samba> <clienttimeout>30</clienttimeout> </samba> - - <network> - <readbufferfactor>4.0</readbufferfactor> - </network> - </advancedsettings> diff --git a/projects/RPi2/linux/linux.arm.conf b/projects/RPi2/linux/linux.arm.conf index 4079f359920..14c03de21d6 100644 --- a/projects/RPi2/linux/linux.arm.conf +++ b/projects/RPi2/linux/linux.arm.conf @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/arm 4.4.2 Kernel Configuration +# Linux/arm 4.6.0-rc5 Kernel Configuration # CONFIG_ARM=y CONFIG_SYS_SUPPORTS_APM_EMULATION=y @@ -109,23 +109,22 @@ CONFIG_LOG_BUF_SHIFT=17 CONFIG_LOG_CPU_MAX_BUF_SHIFT=12 CONFIG_GENERIC_SCHED_CLOCK=y CONFIG_CGROUPS=y -# CONFIG_CGROUP_DEBUG is not set -CONFIG_CGROUP_FREEZER=y -# CONFIG_CGROUP_PIDS is not set -CONFIG_CGROUP_DEVICE=y -CONFIG_CPUSETS=y -CONFIG_PROC_PID_CPUSET=y -CONFIG_CGROUP_CPUACCT=y CONFIG_PAGE_COUNTER=y CONFIG_MEMCG=y # CONFIG_MEMCG_SWAP is not set -# CONFIG_MEMCG_KMEM is not set -CONFIG_CGROUP_SCHED=y -# CONFIG_FAIR_GROUP_SCHED is not set -# CONFIG_RT_GROUP_SCHED is not set CONFIG_BLK_CGROUP=y # CONFIG_DEBUG_BLK_CGROUP is not set CONFIG_CGROUP_WRITEBACK=y +CONFIG_CGROUP_SCHED=y +# CONFIG_FAIR_GROUP_SCHED is not set +# CONFIG_RT_GROUP_SCHED is not set +# CONFIG_CGROUP_PIDS is not set +CONFIG_CGROUP_FREEZER=y +CONFIG_CPUSETS=y +CONFIG_PROC_PID_CPUSET=y +CONFIG_CGROUP_DEVICE=y +CONFIG_CGROUP_CPUACCT=y +# CONFIG_CGROUP_DEBUG is not set # CONFIG_CHECKPOINT_RESTORE is not set CONFIG_NAMESPACES=y CONFIG_UTS_NS=y @@ -159,6 +158,8 @@ CONFIG_MULTIUSER=y CONFIG_SYSCTL_SYSCALL=y CONFIG_KALLSYMS=y # CONFIG_KALLSYMS_ALL is not set +# CONFIG_KALLSYMS_ABSOLUTE_PERCPU is not set +CONFIG_KALLSYMS_BASE_RELATIVE=y CONFIG_PRINTK=y CONFIG_BUG=y CONFIG_ELF_CORE=y @@ -203,7 +204,6 @@ CONFIG_HAVE_KPROBES=y CONFIG_HAVE_KRETPROBES=y CONFIG_HAVE_OPTPROBES=y CONFIG_HAVE_ARCH_TRACEHOOK=y -CONFIG_HAVE_DMA_ATTRS=y CONFIG_HAVE_DMA_CONTIGUOUS=y CONFIG_GENERIC_SMP_IDLE_THREAD=y CONFIG_GENERIC_IDLE_POLL_SETUP=y @@ -226,6 +226,10 @@ CONFIG_HAVE_IRQ_TIME_ACCOUNTING=y CONFIG_HAVE_MOD_ARCH_SPECIFIC=y CONFIG_MODULES_USE_ELF_REL=y CONFIG_ARCH_HAS_ELF_RANDOMIZE=y +CONFIG_HAVE_ARCH_MMAP_RND_BITS=y +CONFIG_ARCH_MMAP_RND_BITS_MIN=8 +CONFIG_ARCH_MMAP_RND_BITS_MAX=15 +CONFIG_ARCH_MMAP_RND_BITS=8 CONFIG_CLONE_BACKWARDS=y CONFIG_OLD_SIGSUSPEND3=y CONFIG_OLD_SIGACTION=y @@ -309,8 +313,6 @@ CONFIG_MMU=y # CONFIG_ARCH_BCM2708 is not set CONFIG_ARCH_BCM2709=y # CONFIG_ARCH_MULTIPLATFORM is not set -# CONFIG_ARCH_REALVIEW is not set -# CONFIG_ARCH_VERSATILE is not set # CONFIG_ARCH_CLPS711X is not set # CONFIG_ARCH_GEMINI is not set # CONFIG_ARCH_EBSA110 is not set @@ -322,9 +324,6 @@ CONFIG_ARCH_BCM2709=y # CONFIG_ARCH_IOP33X is not set # CONFIG_ARCH_IXP4XX is not set # CONFIG_ARCH_DOVE is not set -# CONFIG_ARCH_MV78XX0 is not set -# CONFIG_ARCH_ORION5X is not set -# CONFIG_ARCH_MMP is not set # CONFIG_ARCH_KS8695 is not set # CONFIG_ARCH_W90X900 is not set # CONFIG_ARCH_LPC32XX is not set @@ -332,7 +331,6 @@ CONFIG_ARCH_BCM2709=y # CONFIG_ARCH_RPC is not set # CONFIG_ARCH_SA1100 is not set # CONFIG_ARCH_S3C24XX is not set -# CONFIG_ARCH_S3C64XX is not set # CONFIG_ARCH_DAVINCI is not set # CONFIG_ARCH_OMAP1 is not set CONFIG_BCM2708_NOL2CACHE=y @@ -376,7 +374,8 @@ CONFIG_MIGHT_HAVE_CACHE_L2X0=y CONFIG_ARM_L1_CACHE_SHIFT_6=y CONFIG_ARM_L1_CACHE_SHIFT=6 CONFIG_ARM_DMA_MEM_BUFFERABLE=y -# CONFIG_ARM_KERNMEM_PERMS is not set +CONFIG_DEBUG_RODATA=y +CONFIG_DEBUG_ALIGN_RODATA=y CONFIG_MULTI_IRQ_HANDLER=y # CONFIG_ARM_ERRATA_430973 is not set # CONFIG_ARM_ERRATA_458693 is not set @@ -435,6 +434,7 @@ CONFIG_HZ_300=y CONFIG_HZ=300 CONFIG_SCHED_HRTICK=y # CONFIG_THUMB2_KERNEL is not set +CONFIG_ARM_PATCH_IDIV=y CONFIG_AEABI=y # CONFIG_OABI_COMPAT is not set # CONFIG_ARCH_SPARSEMEM_DEFAULT is not set @@ -467,6 +467,7 @@ CONFIG_CMA_AREAS=7 # CONFIG_ZPOOL is not set # CONFIG_ZBUD is not set # CONFIG_ZSMALLOC is not set +CONFIG_GENERIC_EARLY_IOREMAP=y # CONFIG_IDLE_PAGE_TRACKING is not set CONFIG_FRAME_VECTOR=y CONFIG_FORCE_MAX_ZONEORDER=11 @@ -475,6 +476,8 @@ CONFIG_UACCESS_WITH_MEMCPY=y # CONFIG_SECCOMP is not set CONFIG_SWIOTLB=y CONFIG_IOMMU_HELPER=y +# CONFIG_PARAVIRT is not set +# CONFIG_PARAVIRT_TIME_ACCOUNTING is not set # CONFIG_XEN is not set # @@ -565,6 +568,7 @@ CONFIG_COREDUMP=y # CONFIG_SUSPEND is not set # CONFIG_HIBERNATION is not set # CONFIG_PM is not set +# CONFIG_APM_EMULATION is not set CONFIG_CPU_PM=y CONFIG_ARCH_SUSPEND_POSSIBLE=y # CONFIG_ARM_CPU_SUSPEND is not set @@ -605,7 +609,6 @@ CONFIG_INET_TUNNEL=m # CONFIG_INET_XFRM_MODE_TRANSPORT is not set # CONFIG_INET_XFRM_MODE_TUNNEL is not set # CONFIG_INET_XFRM_MODE_BEET is not set -CONFIG_INET_LRO=y # CONFIG_INET_DIAG is not set # CONFIG_TCP_CONG_ADVANCED is not set CONFIG_TCP_CONG_CUBIC=y @@ -854,7 +857,6 @@ CONFIG_DNS_RESOLVER=y # CONFIG_BATMAN_ADV is not set # CONFIG_OPENVSWITCH is not set # CONFIG_VSOCKETS is not set -# CONFIG_NETLINK_MMAP is not set # CONFIG_NETLINK_DIAG is not set # CONFIG_MPLS is not set # CONFIG_HSR is not set @@ -863,6 +865,7 @@ CONFIG_DNS_RESOLVER=y CONFIG_RPS=y CONFIG_RFS_ACCEL=y CONFIG_XPS=y +# CONFIG_SOCK_CGROUP_DATA is not set # CONFIG_CGROUP_NET_PRIO is not set # CONFIG_CGROUP_NET_CLASSID is not set CONFIG_NET_RX_BUSY_POLL=y @@ -885,6 +888,7 @@ CONFIG_BT_RFCOMM_TTY=y CONFIG_BT_HIDP=m CONFIG_BT_HS=y CONFIG_BT_LE=y +# CONFIG_BT_LEDS is not set # CONFIG_BT_SELFTEST is not set # CONFIG_BT_DEBUGFS is not set @@ -907,6 +911,7 @@ CONFIG_BT_HCIUART_3WIRE=y # CONFIG_BT_HCIUART_INTEL is not set CONFIG_BT_HCIUART_BCM=y # CONFIG_BT_HCIUART_QCA is not set +# CONFIG_BT_HCIUART_AG6XX is not set CONFIG_BT_HCIBCM203X=m # CONFIG_BT_HCIBPA10X is not set CONFIG_BT_HCIBFUSB=m @@ -914,6 +919,7 @@ CONFIG_BT_HCIBFUSB=m # CONFIG_BT_MRVL is not set CONFIG_BT_ATH3K=m # CONFIG_AF_RXRPC is not set +# CONFIG_AF_KCM is not set CONFIG_WIRELESS=y CONFIG_WIRELESS_EXT=y CONFIG_WEXT_CORE=y @@ -922,7 +928,6 @@ CONFIG_WEXT_PRIV=y CONFIG_CFG80211=m # CONFIG_NL80211_TESTMODE is not set # CONFIG_CFG80211_DEVELOPER_WARNINGS is not set -# CONFIG_CFG80211_REG_DEBUG is not set # CONFIG_CFG80211_CERTIFICATION_ONUS is not set CONFIG_CFG80211_DEFAULT_PS=y # CONFIG_CFG80211_DEBUGFS is not set @@ -950,13 +955,15 @@ CONFIG_MAC80211_STA_HASH_MAX_SIZE=0 # CONFIG_CEPH_LIB is not set # CONFIG_NFC is not set # CONFIG_LWTUNNEL is not set +CONFIG_DST_CACHE=y +# CONFIG_NET_DEVLINK is not set +CONFIG_MAY_USE_DEVLINK=y CONFIG_HAVE_BPF_JIT=y # # Device Drivers # CONFIG_ARM_AMBA=y -# CONFIG_TEGRA_AHB is not set # # Generic Driver Options @@ -976,8 +983,8 @@ CONFIG_EXTRA_FIRMWARE="" # CONFIG_SYS_HYPERVISOR is not set # CONFIG_GENERIC_CPU_DEVICES is not set CONFIG_REGMAP=y -CONFIG_REGMAP_I2C=m -CONFIG_REGMAP_SPI=m +CONFIG_REGMAP_I2C=y +CONFIG_REGMAP_SPI=y CONFIG_REGMAP_MMIO=y CONFIG_REGMAP_IRQ=y CONFIG_DMA_SHARED_BUFFER=y @@ -1006,12 +1013,15 @@ CONFIG_OF=y # CONFIG_OF_UNITTEST is not set CONFIG_OF_FLATTREE=y CONFIG_OF_EARLY_FLATTREE=y +CONFIG_OF_DYNAMIC=y CONFIG_OF_ADDRESS=y CONFIG_OF_IRQ=y CONFIG_OF_NET=y CONFIG_OF_MDIO=y CONFIG_OF_RESERVED_MEM=y -# CONFIG_OF_OVERLAY is not set +CONFIG_OF_RESOLVE=y +CONFIG_OF_OVERLAY=y +CONFIG_OF_CONFIGFS=y CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y # CONFIG_PARPORT is not set CONFIG_BLK_DEV=y @@ -1087,6 +1097,10 @@ CONFIG_BCM2708_VCHIQ=y # SCIF Bus Driver # +# +# VOP Bus Driver +# + # # Intel MIC Host Driver # @@ -1102,6 +1116,10 @@ CONFIG_BCM2708_VCHIQ=y # # Intel MIC Coprocessor State Management (COSM) Drivers # + +# +# VOP Driver +# # CONFIG_ECHO is not set # CONFIG_CXL_BASE is not set # CONFIG_CXL_KERNEL_API is not set @@ -1162,7 +1180,9 @@ CONFIG_MACVLAN=m # CONFIG_MACVTAP is not set # CONFIG_IPVLAN is not set # CONFIG_VXLAN is not set +# CONFIG_MACSEC is not set CONFIG_NETCONSOLE=y +# CONFIG_NETCONSOLE_DYNAMIC is not set CONFIG_NETPOLL=y CONFIG_NET_POLL_CONTROLLER=y CONFIG_TUN=y @@ -1261,15 +1281,9 @@ CONFIG_USB_IPHETH=m # CONFIG_USB_VL600 is not set # CONFIG_USB_NET_CH9200 is not set CONFIG_WLAN=y -# CONFIG_LIBERTAS_THINFIRM is not set -# CONFIG_AT76C50X_USB is not set -CONFIG_USB_ZD1201=m -CONFIG_USB_NET_RNDIS_WLAN=m -CONFIG_RTL8187=m -CONFIG_RTL8187_LEDS=y -# CONFIG_MAC80211_HWSIM is not set +CONFIG_WLAN_VENDOR_ADMTEK=y CONFIG_ATH_COMMON=m -CONFIG_ATH_CARDS=m +CONFIG_WLAN_VENDOR_ATH=y # CONFIG_ATH_DEBUG is not set CONFIG_ATH9K_HW=m CONFIG_ATH9K_COMMON=m @@ -1282,6 +1296,7 @@ CONFIG_ATH9K_AHB=y CONFIG_ATH9K_PCOEM=y CONFIG_ATH9K_HTC=m # CONFIG_ATH9K_HTC_DEBUGFS is not set +CONFIG_ATH9K_HWRNG=y CONFIG_CARL9170=m CONFIG_CARL9170_LEDS=y CONFIG_CARL9170_WPC=y @@ -1294,6 +1309,9 @@ CONFIG_AR5523=m # CONFIG_ATH10K is not set CONFIG_WCN36XX=m # CONFIG_WCN36XX_DEBUGFS is not set +CONFIG_WLAN_VENDOR_ATMEL=y +# CONFIG_AT76C50X_USB is not set +CONFIG_WLAN_VENDOR_BROADCOM=y CONFIG_B43=m CONFIG_B43_BCMA=y CONFIG_B43_SSB=y @@ -1319,12 +1337,21 @@ CONFIG_BRCMFMAC_SDIO=y CONFIG_BRCMFMAC_USB=y # CONFIG_BRCM_TRACING is not set # CONFIG_BRCMDBG is not set +CONFIG_WLAN_VENDOR_CISCO=y +CONFIG_WLAN_VENDOR_INTEL=y +CONFIG_WLAN_VENDOR_INTERSIL=y # CONFIG_HOSTAP is not set -# CONFIG_LIBERTAS is not set CONFIG_P54_COMMON=m CONFIG_P54_USB=m # CONFIG_P54_SPI is not set CONFIG_P54_LEDS=y +CONFIG_WLAN_VENDOR_MARVELL=y +# CONFIG_LIBERTAS is not set +# CONFIG_LIBERTAS_THINFIRM is not set +# CONFIG_MWIFIEX is not set +CONFIG_WLAN_VENDOR_MEDIATEK=y +CONFIG_MT7601U=m +CONFIG_WLAN_VENDOR_RALINK=y CONFIG_RT2X00=m CONFIG_RT2500USB=m CONFIG_RT73USB=m @@ -1342,18 +1369,26 @@ CONFIG_RT2X00_LIB_FIRMWARE=y CONFIG_RT2X00_LIB_CRYPTO=y CONFIG_RT2X00_LIB_LEDS=y # CONFIG_RT2X00_DEBUG is not set -CONFIG_WL_MEDIATEK=y -CONFIG_MT7601U=m -CONFIG_RTL_CARDS=m -# CONFIG_RTL8192CU is not set -CONFIG_RTL8XXXU=m -CONFIG_RTL8XXXU_UNTESTED=y -# CONFIG_WL_TI is not set +CONFIG_WLAN_VENDOR_REALTEK=y +CONFIG_RTL8187=m +CONFIG_RTL8187_LEDS=y +# CONFIG_RTL_CARDS is not set +# CONFIG_RTL8XXXU is not set +CONFIG_WLAN_VENDOR_RSI=y +# CONFIG_RSI_91X is not set +CONFIG_WLAN_VENDOR_ST=y +# CONFIG_CW1200 is not set +CONFIG_WLAN_VENDOR_TI=y +# CONFIG_WL1251 is not set +# CONFIG_WL12XX is not set +# CONFIG_WL18XX is not set +# CONFIG_WLCORE is not set +CONFIG_WLAN_VENDOR_ZYDAS=y +CONFIG_USB_ZD1201=m CONFIG_ZD1211RW=m # CONFIG_ZD1211RW_DEBUG is not set -# CONFIG_MWIFIEX is not set -# CONFIG_CW1200 is not set -# CONFIG_RSI_91X is not set +# CONFIG_MAC80211_HWSIM is not set +CONFIG_USB_NET_RNDIS_WLAN=m # # Enable WiMAX (Networking options) to see the WiMAX drivers @@ -1432,6 +1467,7 @@ CONFIG_TOUCHSCREEN_ADS7846=m # CONFIG_TOUCHSCREEN_HAMPSHIRE is not set # CONFIG_TOUCHSCREEN_EETI is not set CONFIG_TOUCHSCREEN_EGALAX=m +# CONFIG_TOUCHSCREEN_EGALAX_SERIAL is not set # CONFIG_TOUCHSCREEN_FT6236 is not set # CONFIG_TOUCHSCREEN_FUJITSU is not set # CONFIG_TOUCHSCREEN_GOODIX is not set @@ -1444,6 +1480,7 @@ CONFIG_TOUCHSCREEN_EGALAX=m # CONFIG_TOUCHSCREEN_MAX11801 is not set # CONFIG_TOUCHSCREEN_MCS5000 is not set # CONFIG_TOUCHSCREEN_MMS114 is not set +# CONFIG_TOUCHSCREEN_MELFAS_MIP4 is not set # CONFIG_TOUCHSCREEN_MTOUCH is not set # CONFIG_TOUCHSCREEN_IMX6UL_TSC is not set # CONFIG_TOUCHSCREEN_INEXIO is not set @@ -1511,6 +1548,7 @@ CONFIG_INPUT_UINPUT=y # CONFIG_INPUT_DRV260X_HAPTICS is not set # CONFIG_INPUT_DRV2665_HAPTICS is not set # CONFIG_INPUT_DRV2667_HAPTICS is not set +# CONFIG_RMI4_CORE is not set # # Hardware I/O ports @@ -1558,7 +1596,7 @@ CONFIG_SERIAL_8250_FSL=y # CONFIG_SERIAL_8250_DW is not set # CONFIG_SERIAL_8250_EM is not set # CONFIG_SERIAL_8250_RT288X is not set -# CONFIG_SERIAL_8250_INGENIC is not set +CONFIG_SERIAL_OF_PLATFORM=y # # Non-8250 serial port support @@ -1572,7 +1610,6 @@ CONFIG_SERIAL_AMBA_PL011_CONSOLE=y # CONFIG_SERIAL_UARTLITE is not set CONFIG_SERIAL_CORE=y CONFIG_SERIAL_CORE_CONSOLE=y -CONFIG_SERIAL_OF_PLATFORM=y # CONFIG_SERIAL_SCCNXP is not set # CONFIG_SERIAL_SC16IS7XX is not set # CONFIG_SERIAL_BCM63XX is not set @@ -1585,6 +1622,7 @@ CONFIG_SERIAL_OF_PLATFORM=y # CONFIG_SERIAL_CONEXANT_DIGICOLOR is not set # CONFIG_SERIAL_ST_ASC is not set # CONFIG_SERIAL_STM32 is not set +# CONFIG_SERIAL_MVEBU_UART is not set # CONFIG_TTY_PRINTK is not set # CONFIG_HVC_DCC is not set # CONFIG_IPMI_HANDLER is not set @@ -1614,6 +1652,7 @@ CONFIG_I2C_MUX=m # CONFIG_I2C_MUX_PCA954x is not set # CONFIG_I2C_MUX_PINCTRL is not set # CONFIG_I2C_MUX_REG is not set +# CONFIG_I2C_DEMUX_PINCTRL is not set CONFIG_I2C_HELPER_AUTO=y CONFIG_I2C_ALGOBIT=y @@ -1664,10 +1703,12 @@ CONFIG_SPI_MASTER=y # SPI Master Controller Drivers # # CONFIG_SPI_ALTERA is not set +# CONFIG_SPI_AXI_SPI_ENGINE is not set CONFIG_SPI_BCM2835=m CONFIG_SPI_BCM2835AUX=m # CONFIG_SPI_BITBANG is not set # CONFIG_SPI_CADENCE is not set +# CONFIG_SPI_DESIGNWARE is not set # CONFIG_SPI_GPIO is not set # CONFIG_SPI_FSL_SPI is not set # CONFIG_SPI_OC_TINY is not set @@ -1678,12 +1719,12 @@ CONFIG_SPI_BCM2835AUX=m # CONFIG_SPI_XCOMM is not set # CONFIG_SPI_XILINX is not set # CONFIG_SPI_ZYNQMP_GQSPI is not set -# CONFIG_SPI_DESIGNWARE is not set # # SPI Protocol Masters # CONFIG_SPI_SPIDEV=y +# CONFIG_SPI_LOOPBACK_TEST is not set # CONFIG_SPI_TLE62X0 is not set # CONFIG_SPMI is not set # CONFIG_HSI is not set @@ -1734,6 +1775,7 @@ CONFIG_GPIO_BCM_VIRT=y # CONFIG_GPIO_EM is not set # CONFIG_GPIO_GENERIC_PLATFORM is not set # CONFIG_GPIO_GRGPIO is not set +# CONFIG_GPIO_MPC8XXX is not set # CONFIG_GPIO_PL061 is not set # CONFIG_GPIO_SYSCON is not set # CONFIG_GPIO_XILINX is not set @@ -1750,6 +1792,7 @@ CONFIG_GPIO_BCM_VIRT=y # CONFIG_GPIO_PCA953X is not set # CONFIG_GPIO_PCF857X is not set # CONFIG_GPIO_SX150X is not set +# CONFIG_GPIO_TPIC2810 is not set # # MFD GPIO expanders @@ -1762,6 +1805,7 @@ CONFIG_GPIO_ARIZONA=m # CONFIG_GPIO_74X164 is not set # CONFIG_GPIO_MAX7301 is not set # CONFIG_GPIO_MC33880 is not set +# CONFIG_GPIO_PISOSR is not set # # SPI or I2C GPIO expanders @@ -1819,7 +1863,15 @@ CONFIG_POWER_SUPPLY=y # CONFIG_CHARGER_SMB347 is not set # CONFIG_BATTERY_GAUGE_LTC2941 is not set # CONFIG_CHARGER_RT9455 is not set -# CONFIG_POWER_RESET is not set +CONFIG_POWER_RESET=y +# CONFIG_POWER_RESET_BRCMSTB is not set +CONFIG_POWER_RESET_GPIO=y +CONFIG_POWER_RESET_GPIO_RESTART=y +# CONFIG_POWER_RESET_LTC2952 is not set +CONFIG_POWER_RESET_RESTART=y +# CONFIG_POWER_RESET_VERSATILE is not set +# CONFIG_POWER_RESET_SYSCON is not set +# CONFIG_POWER_RESET_SYSCON_POWEROFF is not set # CONFIG_POWER_AVS is not set CONFIG_HWMON=y # CONFIG_HWMON_VID is not set @@ -1861,6 +1913,7 @@ CONFIG_HWMON=y # CONFIG_SENSORS_POWR1220 is not set # CONFIG_SENSORS_LINEAGE is not set # CONFIG_SENSORS_LTC2945 is not set +# CONFIG_SENSORS_LTC2990 is not set # CONFIG_SENSORS_LTC4151 is not set # CONFIG_SENSORS_LTC4215 is not set # CONFIG_SENSORS_LTC4222 is not set @@ -1877,7 +1930,6 @@ CONFIG_HWMON=y # CONFIG_SENSORS_MAX6650 is not set # CONFIG_SENSORS_MAX6697 is not set # CONFIG_SENSORS_MAX31790 is not set -# CONFIG_SENSORS_HTU21 is not set # CONFIG_SENSORS_MCP3021 is not set # CONFIG_SENSORS_ADCXX is not set # CONFIG_SENSORS_LM63 is not set @@ -1961,6 +2013,7 @@ CONFIG_THERMAL_BCM2835=y CONFIG_WATCHDOG=y CONFIG_WATCHDOG_CORE=y # CONFIG_WATCHDOG_NOWAYOUT is not set +# CONFIG_WATCHDOG_SYSFS is not set # # Watchdog Device Drivers @@ -1968,12 +2021,12 @@ CONFIG_WATCHDOG_CORE=y # CONFIG_SOFT_WATCHDOG is not set # CONFIG_GPIO_WATCHDOG is not set # CONFIG_XILINX_WATCHDOG is not set +# CONFIG_ZIIRAVE_WATCHDOG is not set # CONFIG_ARM_SP805_WATCHDOG is not set # CONFIG_CADENCE_WATCHDOG is not set # CONFIG_DW_WATCHDOG is not set # CONFIG_MAX63XX_WATCHDOG is not set CONFIG_BCM2835_WDT=m -# CONFIG_BCM7038_WDT is not set # CONFIG_MEN_A21_WDT is not set # @@ -1989,7 +2042,6 @@ CONFIG_SSB=m CONFIG_SSB_BLOCKIO=y CONFIG_SSB_SDIOHOST_POSSIBLE=y # CONFIG_SSB_SDIOHOST is not set -# CONFIG_SSB_HOST_SOC is not set # CONFIG_SSB_SILENT is not set # CONFIG_SSB_DEBUG is not set # CONFIG_SSB_DRIVER_GPIO is not set @@ -2010,6 +2062,7 @@ CONFIG_BCMA_DRIVER_GMAC_CMN=y # CONFIG_MFD_CORE=y # CONFIG_MFD_RPISENSE_CORE is not set +# CONFIG_MFD_ACT8945A is not set # CONFIG_MFD_AS3711 is not set # CONFIG_MFD_AS3722 is not set # CONFIG_PMIC_ADP5520 is not set @@ -2017,7 +2070,7 @@ CONFIG_MFD_CORE=y # CONFIG_MFD_ATMEL_FLEXCOM is not set # CONFIG_MFD_ATMEL_HLCDC is not set # CONFIG_MFD_BCM590XX is not set -# CONFIG_MFD_AXP20X is not set +# CONFIG_MFD_AXP20X_I2C is not set # CONFIG_MFD_CROS_EC is not set # CONFIG_MFD_ASIC3 is not set # CONFIG_PMIC_DA903X is not set @@ -2075,12 +2128,12 @@ CONFIG_MFD_SYSCON=y # CONFIG_TPS6105X is not set # CONFIG_TPS65010 is not set # CONFIG_TPS6507X is not set +# CONFIG_MFD_TPS65086 is not set # CONFIG_MFD_TPS65090 is not set # CONFIG_MFD_TPS65217 is not set # CONFIG_MFD_TPS65218 is not set # CONFIG_MFD_TPS6586X is not set # CONFIG_MFD_TPS65910 is not set -# CONFIG_MFD_TPS65912 is not set # CONFIG_MFD_TPS65912_I2C is not set # CONFIG_MFD_TPS65912_SPI is not set # CONFIG_MFD_TPS80031 is not set @@ -2096,6 +2149,7 @@ CONFIG_MFD_SYSCON=y CONFIG_MFD_ARIZONA=y CONFIG_MFD_ARIZONA_I2C=m CONFIG_MFD_ARIZONA_SPI=m +# CONFIG_MFD_CS47L24 is not set CONFIG_MFD_WM5102=y # CONFIG_MFD_WM5110 is not set # CONFIG_MFD_WM8997 is not set @@ -2495,12 +2549,18 @@ CONFIG_DVB_AF9033=m # # CONFIG_DRM is not set +# +# ACP (Audio CoProcessor) Configuration +# +# CONFIG_DRM_AMD_ACP is not set + # # Frame buffer Devices # CONFIG_FB=y # CONFIG_FIRMWARE_EDID is not set CONFIG_FB_CMDLINE=y +CONFIG_FB_NOTIFY=y # CONFIG_FB_DDC is not set # CONFIG_FB_BOOT_VESA_SUPPORT is not set CONFIG_FB_CFB_FILLRECT=y @@ -2535,7 +2595,31 @@ CONFIG_FB_BCM2708=y # CONFIG_FB_SIMPLE is not set # CONFIG_FB_SSD1307 is not set # CONFIG_FB_RPISENSE is not set -# CONFIG_BACKLIGHT_LCD_SUPPORT is not set +CONFIG_BACKLIGHT_LCD_SUPPORT=y +CONFIG_LCD_CLASS_DEVICE=m +# CONFIG_LCD_L4F00242T03 is not set +# CONFIG_LCD_LMS283GF05 is not set +# CONFIG_LCD_LTV350QV is not set +# CONFIG_LCD_ILI922X is not set +# CONFIG_LCD_ILI9320 is not set +# CONFIG_LCD_TDO24M is not set +# CONFIG_LCD_VGG2432A4 is not set +# CONFIG_LCD_PLATFORM is not set +# CONFIG_LCD_S6E63M0 is not set +# CONFIG_LCD_LD9040 is not set +# CONFIG_LCD_AMS369FG06 is not set +# CONFIG_LCD_LMS501KF03 is not set +# CONFIG_LCD_HX8357 is not set +CONFIG_BACKLIGHT_CLASS_DEVICE=y +# CONFIG_BACKLIGHT_GENERIC is not set +CONFIG_BACKLIGHT_RPI=y +# CONFIG_BACKLIGHT_PM8941_WLED is not set +# CONFIG_BACKLIGHT_ADP8860 is not set +# CONFIG_BACKLIGHT_ADP8870 is not set +# CONFIG_BACKLIGHT_LM3639 is not set +CONFIG_BACKLIGHT_GPIO=y +# CONFIG_BACKLIGHT_LV5207LP is not set +# CONFIG_BACKLIGHT_BD6107 is not set # CONFIG_VGASTATE is not set # @@ -2555,6 +2639,7 @@ CONFIG_SND_DMAENGINE_PCM=m CONFIG_SND_HWDEP=m CONFIG_SND_RAWMIDI=m CONFIG_SND_JACK=y +CONFIG_SND_JACK_INPUT_DEV=y # CONFIG_SND_SEQUENCER is not set # CONFIG_SND_MIXER_OSS is not set # CONFIG_SND_PCM_OSS is not set @@ -2599,6 +2684,7 @@ CONFIG_SND_USB_TONEPORT=m CONFIG_SND_USB_VARIAX=m CONFIG_SND_SOC=m CONFIG_SND_SOC_GENERIC_DMAENGINE_PCM=y +# CONFIG_SND_SOC_AMD_ACP is not set # CONFIG_SND_ATMEL_SOC is not set CONFIG_SND_BCM2835_SOC_I2S=m CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC=m @@ -2607,6 +2693,8 @@ CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI=m CONFIG_SND_BCM2708_SOC_HIFIBERRY_AMP=m CONFIG_SND_BCM2708_SOC_RPI_DAC=m CONFIG_SND_BCM2708_SOC_RPI_PROTO=m +CONFIG_SND_BCM2708_SOC_BOOMBERRY_DAC=m +CONFIG_SND_BCM2708_SOC_BOOMBERRY_DIGI=m CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC=m CONFIG_SND_BCM2708_SOC_RASPIDAC3=m # CONFIG_SND_DESIGNWARE_I2S is not set @@ -2624,11 +2712,13 @@ CONFIG_SND_BCM2708_SOC_RASPIDAC3=m # CONFIG_SND_SOC_FSL_SPDIF is not set # CONFIG_SND_SOC_FSL_ESAI is not set # CONFIG_SND_SOC_IMX_AUDMUX is not set +# CONFIG_SND_SOC_IMG is not set # # Allwinner SoC Audio support # # CONFIG_SND_SUN4I_CODEC is not set +# CONFIG_SND_SUN4I_SPDIF is not set # CONFIG_SND_SOC_XTFPGA_I2S is not set CONFIG_SND_SOC_I2C_AND_SPI=m @@ -2656,11 +2746,16 @@ CONFIG_SND_SOC_I2C_AND_SPI=m # CONFIG_SND_SOC_CS4349 is not set # CONFIG_SND_SOC_ES8328 is not set # CONFIG_SND_SOC_GTM601 is not set +# CONFIG_SND_SOC_INNO_RK3036 is not set # CONFIG_SND_SOC_PCM1681 is not set -# CONFIG_SND_SOC_PCM1792A is not set +# CONFIG_SND_SOC_PCM179X_I2C is not set +# CONFIG_SND_SOC_PCM179X_SPI is not set +# CONFIG_SND_SOC_PCM3168A_I2C is not set +# CONFIG_SND_SOC_PCM3168A_SPI is not set CONFIG_SND_SOC_PCM512x=m CONFIG_SND_SOC_PCM512x_I2C=m # CONFIG_SND_SOC_PCM512x_SPI is not set +# CONFIG_SND_SOC_RT5616 is not set CONFIG_SND_SOC_PCM1794A=m CONFIG_SND_SOC_PCM5102A=m # CONFIG_SND_SOC_RT5631 is not set @@ -2701,6 +2796,7 @@ CONFIG_SND_SOC_WM8804_I2C=m # CONFIG_SND_SOC_WM8804_SPI is not set # CONFIG_SND_SOC_WM8903 is not set # CONFIG_SND_SOC_WM8962 is not set +# CONFIG_SND_SOC_WM8974 is not set # CONFIG_SND_SOC_WM8978 is not set CONFIG_SND_SOC_TPA6130A2=m # CONFIG_SND_SIMPLE_CARD is not set @@ -2730,6 +2826,7 @@ CONFIG_HID_CHERRY=y CONFIG_HID_CHICONY=y # CONFIG_HID_CORSAIR is not set # CONFIG_HID_PRODIKEYS is not set +# CONFIG_HID_CMEDIA is not set # CONFIG_HID_CP2112 is not set CONFIG_HID_CYPRESS=y CONFIG_HID_DRAGONRISE=m @@ -3045,6 +3142,7 @@ CONFIG_LEDS_GPIO=y # CONFIG_LEDS_TLC591XX is not set # CONFIG_LEDS_LM355x is not set # CONFIG_LEDS_KTD2692 is not set +# CONFIG_LEDS_IS31FL32XX is not set # # LED driver for blink(1) USB RGB LED is under Special HID drivers (HID_THINGM) @@ -3057,18 +3155,18 @@ CONFIG_LEDS_GPIO=y # CONFIG_LEDS_TRIGGERS=y CONFIG_LEDS_TRIGGER_TIMER=y -# CONFIG_LEDS_TRIGGER_ONESHOT is not set +CONFIG_LEDS_TRIGGER_ONESHOT=y CONFIG_LEDS_TRIGGER_HEARTBEAT=y -# CONFIG_LEDS_TRIGGER_BACKLIGHT is not set -# CONFIG_LEDS_TRIGGER_CPU is not set -# CONFIG_LEDS_TRIGGER_GPIO is not set +CONFIG_LEDS_TRIGGER_BACKLIGHT=y +CONFIG_LEDS_TRIGGER_CPU=y +CONFIG_LEDS_TRIGGER_GPIO=y CONFIG_LEDS_TRIGGER_DEFAULT_ON=y # # iptables trigger is under Netfilter config (LED target) # -# CONFIG_LEDS_TRIGGER_TRANSIENT is not set -# CONFIG_LEDS_TRIGGER_CAMERA is not set +CONFIG_LEDS_TRIGGER_TRANSIENT=y +CONFIG_LEDS_TRIGGER_CAMERA=y CONFIG_LEDS_TRIGGER_INPUT=y # CONFIG_ACCESSIBILITY is not set CONFIG_EDAC_ATOMIC_SCRUB=y @@ -3096,9 +3194,9 @@ CONFIG_RTC_INTF_DEV=y # CONFIG_RTC_DRV_ABB5ZES3 is not set # CONFIG_RTC_DRV_ABX80X is not set CONFIG_RTC_DRV_DS1307=m +CONFIG_RTC_DRV_DS1307_HWMON=y # CONFIG_RTC_DRV_DS1374 is not set # CONFIG_RTC_DRV_DS1672 is not set -# CONFIG_RTC_DRV_DS3232 is not set # CONFIG_RTC_DRV_HYM8563 is not set # CONFIG_RTC_DRV_MAX6900 is not set # CONFIG_RTC_DRV_RS5C372 is not set @@ -3106,15 +3204,15 @@ CONFIG_RTC_DRV_DS1307=m # CONFIG_RTC_DRV_ISL12022 is not set # CONFIG_RTC_DRV_ISL12057 is not set # CONFIG_RTC_DRV_X1205 is not set -CONFIG_RTC_DRV_PCF2127=m CONFIG_RTC_DRV_PCF8523=m -CONFIG_RTC_DRV_PCF8563=m # CONFIG_RTC_DRV_PCF85063 is not set +CONFIG_RTC_DRV_PCF8563=m # CONFIG_RTC_DRV_PCF8583 is not set # CONFIG_RTC_DRV_M41T80 is not set # CONFIG_RTC_DRV_BQ32K is not set # CONFIG_RTC_DRV_S35390A is not set # CONFIG_RTC_DRV_FM3130 is not set +# CONFIG_RTC_DRV_RX8010 is not set # CONFIG_RTC_DRV_RX8581 is not set # CONFIG_RTC_DRV_RX8025 is not set # CONFIG_RTC_DRV_EM3027 is not set @@ -3130,13 +3228,20 @@ CONFIG_RTC_DRV_PCF8563=m # CONFIG_RTC_DRV_DS1343 is not set # CONFIG_RTC_DRV_DS1347 is not set # CONFIG_RTC_DRV_DS1390 is not set -# CONFIG_RTC_DRV_MAX6902 is not set # CONFIG_RTC_DRV_R9701 is not set +# CONFIG_RTC_DRV_RX4581 is not set +# CONFIG_RTC_DRV_RX6110 is not set # CONFIG_RTC_DRV_RS5C348 is not set -# CONFIG_RTC_DRV_DS3234 is not set +# CONFIG_RTC_DRV_MAX6902 is not set # CONFIG_RTC_DRV_PCF2123 is not set -# CONFIG_RTC_DRV_RX4581 is not set # CONFIG_RTC_DRV_MCP795 is not set +CONFIG_RTC_I2C_AND_SPI=y + +# +# SPI and I2C RTC drivers +# +CONFIG_RTC_DRV_DS3232=m +CONFIG_RTC_DRV_PCF2127=m # # Platform RTC drivers @@ -3185,6 +3290,8 @@ CONFIG_DMA_BCM2835=y # CONFIG_NBPFAXI_DMA is not set # CONFIG_PL330_DMA is not set CONFIG_DMA_BCM2708=y +# CONFIG_QCOM_HIDMA_MGMT is not set +# CONFIG_QCOM_HIDMA is not set # CONFIG_DW_DMAC is not set # @@ -3216,32 +3323,30 @@ CONFIG_VT6656=m # Speakup console speech # # CONFIG_SPEAKUP is not set -# CONFIG_TOUCHSCREEN_SYNAPTICS_I2C_RMI4 is not set CONFIG_STAGING_MEDIA=y CONFIG_DVB_MN88472=m -CONFIG_DVB_MN88473=m CONFIG_LIRC_STAGING=y # CONFIG_LIRC_IMON is not set CONFIG_LIRC_RPI=m # CONFIG_LIRC_SASEM is not set # CONFIG_LIRC_SERIAL is not set # CONFIG_LIRC_SIR is not set -CONFIG_LIRC_XBOX=m +# CONFIG_LIRC_XBOX is not set # CONFIG_LIRC_ZILOG is not set # # Android # # CONFIG_STAGING_BOARD is not set -# CONFIG_WIMAX_GDM72XX is not set # CONFIG_LTE_GDM724X is not set -# CONFIG_LUSTRE_FS is not set -# CONFIG_DGAP is not set +# CONFIG_LNET is not set # CONFIG_GS_FPGABOOT is not set # CONFIG_COMMON_CLK_XLNX_CLKWZRD is not set # CONFIG_FB_TFT is not set -# CONFIG_WILC1000_DRIVER is not set +# CONFIG_WILC1000_SDIO is not set +# CONFIG_WILC1000_SPI is not set # CONFIG_MOST is not set +# CONFIG_GOLDFISH is not set # CONFIG_CHROME_PLATFORMS is not set CONFIG_CLKDEV_LOOKUP=y CONFIG_HAVE_CLK_PREPARE=y @@ -3253,10 +3358,12 @@ CONFIG_COMMON_CLK=y # CONFIG_COMMON_CLK_SI5351 is not set # CONFIG_COMMON_CLK_SI514 is not set # CONFIG_COMMON_CLK_SI570 is not set +# CONFIG_COMMON_CLK_CDCE706 is not set # CONFIG_COMMON_CLK_CDCE925 is not set +# CONFIG_COMMON_CLK_CS2000_CP is not set # CONFIG_CLK_QORIQ is not set +# CONFIG_COMMON_CLK_NXP is not set # CONFIG_COMMON_CLK_PXA is not set -# CONFIG_COMMON_CLK_CDCE706 is not set # # Hardware Spinlock drivers @@ -3306,6 +3413,7 @@ CONFIG_EXTCON=m # CONFIG_EXTCON_ARIZONA=m # CONFIG_EXTCON_GPIO is not set +# CONFIG_EXTCON_MAX3355 is not set # CONFIG_EXTCON_RT8973A is not set # CONFIG_EXTCON_SM5502 is not set # CONFIG_EXTCON_USB_GPIO is not set @@ -3313,6 +3421,7 @@ CONFIG_EXTCON_ARIZONA=m # CONFIG_IIO is not set # CONFIG_PWM is not set CONFIG_IRQCHIP=y +CONFIG_ARM_GIC_MAX_NR=1 # CONFIG_IPACK_BUS is not set # CONFIG_RESET_CONTROLLER is not set # CONFIG_FMC is not set @@ -3338,8 +3447,6 @@ CONFIG_IRQCHIP=y # CONFIG_ANDROID is not set # CONFIG_NVMEM is not set # CONFIG_STM is not set -# CONFIG_STM_DUMMY is not set -# CONFIG_STM_SOURCE_CONSOLE is not set # CONFIG_INTEL_TH is not set # @@ -3352,6 +3459,8 @@ CONFIG_IRQCHIP=y # # CONFIG_FIRMWARE_MEMMAP is not set CONFIG_RASPBERRYPI_FIRMWARE=y +# CONFIG_FW_CFG_SYSFS is not set +CONFIG_HAVE_ARM_SMCCC=y # # File systems @@ -3384,6 +3493,7 @@ CONFIG_XFS_FS=m # CONFIG_XFS_WARN is not set # CONFIG_XFS_DEBUG is not set # CONFIG_GFS2_FS is not set +# CONFIG_OCFS2_FS is not set CONFIG_BTRFS_FS=m # CONFIG_BTRFS_FS_POSIX_ACL is not set # CONFIG_BTRFS_FS_CHECK_INTEGRITY is not set @@ -3398,6 +3508,8 @@ CONFIG_F2FS_CHECK_FS=y CONFIG_FS_POSIX_ACL=y CONFIG_EXPORTFS=y CONFIG_FILE_LOCKING=y +CONFIG_MANDATORY_FILE_LOCKING=y +# CONFIG_FS_ENCRYPTION is not set CONFIG_FSNOTIFY=y CONFIG_DNOTIFY=y CONFIG_INOTIFY_USER=y @@ -3431,6 +3543,7 @@ CONFIG_FAT_FS=y CONFIG_VFAT_FS=y CONFIG_FAT_DEFAULT_CODEPAGE=437 CONFIG_FAT_DEFAULT_IOCHARSET="ascii" +# CONFIG_FAT_DEFAULT_UTF8 is not set # CONFIG_NTFS_FS is not set # @@ -3446,8 +3559,9 @@ CONFIG_TMPFS=y CONFIG_TMPFS_POSIX_ACL=y CONFIG_TMPFS_XATTR=y # CONFIG_HUGETLB_PAGE is not set -# CONFIG_CONFIGFS_FS is not set +CONFIG_CONFIGFS_FS=y CONFIG_MISC_FILESYSTEMS=y +# CONFIG_ORANGEFS_FS is not set # CONFIG_ADFS_FS is not set # CONFIG_AFFS_FS is not set # CONFIG_ECRYPT_FS is not set @@ -3574,6 +3688,7 @@ CONFIG_NLS_ISO8859_1=y # CONFIG_NLS_MAC_ROMANIAN is not set # CONFIG_NLS_MAC_TURKISH is not set CONFIG_NLS_UTF8=y +# CONFIG_DLM is not set # # Kernel hacking @@ -3613,6 +3728,7 @@ CONFIG_DEBUG_KERNEL=y # # CONFIG_PAGE_EXTENSION is not set # CONFIG_DEBUG_PAGEALLOC is not set +# CONFIG_PAGE_POISONING is not set # CONFIG_DEBUG_OBJECTS is not set # CONFIG_SLUB_DEBUG_ON is not set # CONFIG_SLUB_STATS is not set @@ -3631,6 +3747,7 @@ CONFIG_LOCKUP_DETECTOR=y # CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0 # CONFIG_DETECT_HUNG_TASK is not set +# CONFIG_WQ_WATCHDOG is not set # CONFIG_PANIC_ON_OOPS is not set CONFIG_PANIC_ON_OOPS_VALUE=0 CONFIG_PANIC_TIMEOUT=0 @@ -3673,9 +3790,11 @@ CONFIG_PANIC_TIMEOUT=0 CONFIG_RCU_CPU_STALL_TIMEOUT=21 # CONFIG_RCU_TRACE is not set # CONFIG_RCU_EQS_DEBUG is not set +# CONFIG_DEBUG_WQ_FORCE_RR_CPU is not set # CONFIG_DEBUG_BLOCK_EXT_DEVT is not set # CONFIG_NOTIFIER_ERROR_INJECTION is not set # CONFIG_FAULT_INJECTION is not set +# CONFIG_LATENCYTOP is not set CONFIG_HAVE_FUNCTION_TRACER=y CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y CONFIG_HAVE_DYNAMIC_FTRACE=y @@ -3699,6 +3818,7 @@ CONFIG_TRACING_SUPPORT=y # CONFIG_TEST_STRING_HELPERS is not set # CONFIG_TEST_KSTRTOX is not set # CONFIG_TEST_PRINTF is not set +# CONFIG_TEST_BITMAP is not set # CONFIG_TEST_RHASHTABLE is not set # CONFIG_DMA_API_DEBUG is not set # CONFIG_TEST_LKM is not set @@ -3711,14 +3831,15 @@ CONFIG_TRACING_SUPPORT=y # CONFIG_SAMPLES is not set CONFIG_HAVE_ARCH_KGDB=y # CONFIG_KGDB is not set -# CONFIG_ARM_PTDUMP is not set +# CONFIG_UBSAN is not set +CONFIG_ARCH_HAS_DEVMEM_IS_ALLOWED=y # CONFIG_STRICT_DEVMEM is not set +# CONFIG_ARM_PTDUMP is not set # CONFIG_ARM_UNWIND is not set # CONFIG_DEBUG_USER is not set # CONFIG_DEBUG_LL is not set CONFIG_DEBUG_LL_INCLUDE="mach/debug-macro.S" # CONFIG_DEBUG_UART_8250 is not set -# CONFIG_DEBUG_UART_BCM63XX is not set CONFIG_UNCOMPRESS_INCLUDE="mach/uncompress.h" # CONFIG_PID_IN_CONTEXTIDR is not set # CONFIG_DEBUG_SET_MODULE_RONX is not set @@ -3753,7 +3874,6 @@ CONFIG_CRYPTO_HASH2=y CONFIG_CRYPTO_RNG=m CONFIG_CRYPTO_RNG2=y CONFIG_CRYPTO_RNG_DEFAULT=m -CONFIG_CRYPTO_PCOMP2=y CONFIG_CRYPTO_AKCIPHER2=y # CONFIG_CRYPTO_RSA is not set CONFIG_CRYPTO_MANAGER=y @@ -3803,7 +3923,7 @@ CONFIG_CRYPTO_HMAC=y # Digest # CONFIG_CRYPTO_CRC32C=y -# CONFIG_CRYPTO_CRC32 is not set +CONFIG_CRYPTO_CRC32=y # CONFIG_CRYPTO_CRCT10DIF is not set CONFIG_CRYPTO_GHASH=m # CONFIG_CRYPTO_POLY1305 is not set @@ -3844,7 +3964,6 @@ CONFIG_CRYPTO_DES=y # Compression # # CONFIG_CRYPTO_DEFLATE is not set -# CONFIG_CRYPTO_ZLIB is not set CONFIG_CRYPTO_LZO=m # CONFIG_CRYPTO_842 is not set # CONFIG_CRYPTO_LZ4 is not set @@ -3932,6 +4051,7 @@ CONFIG_NLATTR=y CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE=y # CONFIG_CORDIC is not set # CONFIG_DDR is not set +# CONFIG_IRQ_POLL is not set CONFIG_LIBFDT=y CONFIG_OID_REGISTRY=y CONFIG_FONT_SUPPORT=y diff --git a/projects/RPi2/options b/projects/RPi2/options index 45a2db297b9..ccca477e3c1 100644 --- a/projects/RPi2/options +++ b/projects/RPi2/options @@ -63,7 +63,7 @@ NOOBS_HEX="1040,1041,2082" # NOOBS supported model versions - NOOBS_SUPPORTED_MODELS="'Pi 2','Pi 3'" + NOOBS_SUPPORTED_MODELS='"Pi 2","Pi 3"' ################################################################################ # setup build defaults @@ -149,8 +149,3 @@ # Space separated list is supported, # e.g. ADDITIONAL_DRIVERS="DRIVER1 DRIVER2" ADDITIONAL_DRIVERS="$ADDITIONAL_DRIVERS" - - # set up serial console when building a development image - if [ "$DEVEL_VERSION" = "devel" ] ; then - EXTRA_CMDLINE="console=ttyAMA0,115200" - fi diff --git a/projects/RPi2/patches/kodi/kodi-002-isengard-rpb-backports.patch b/projects/RPi2/patches/kodi/kodi-002-isengard-rpb-backports.patch deleted file mode 100644 index 15013fd768a..00000000000 --- a/projects/RPi2/patches/kodi/kodi-002-isengard-rpb-backports.patch +++ /dev/null @@ -1,29 +0,0 @@ -From a68c7ca33ce0a3aa20caf3eb235e11d489e1fd5b Mon Sep 17 00:00:00 2001 -From: popcornmix <popcornmix@gmail.com> -Date: Sun, 11 Oct 2015 20:55:35 +0100 -Subject: [PATCH] Revert "Revert "Disable extra logging by default"" - -This reverts commit a880554325be187b877cd8f0e2b338e7267da636. ---- - system/settings/settings.xml | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/system/settings/settings.xml b/system/settings/settings.xml -index f1cbefa..b1b2ced 100644 ---- a/system/settings/settings.xml -+++ b/system/settings/settings.xml -@@ -2917,12 +2917,12 @@ - </setting> - <setting id="debug.extralogging" type="boolean" label="666" help="36394"> - <level>1</level> -- <default>true</default> -+ <default>false</default> - <control type="toggle" /> - </setting> - <setting id="debug.setextraloglevel" type="list[integer]" parent="debug.extralogging" label="668" help="36534"> - <level>1</level> -- <default>32768</default> -+ <default></default> - <constraints> - <options>loggingcomponents</options> - <delimiter>,</delimiter> diff --git a/projects/RPi2/patches/linux/linux-01-RPi_support.patch b/projects/RPi2/patches/linux/linux-01-RPi_support.patch index 863e39ebcad..27eeea44d11 100644 --- a/projects/RPi2/patches/linux/linux-01-RPi_support.patch +++ b/projects/RPi2/patches/linux/linux-01-RPi_support.patch @@ -1,7 +1,104 @@ -From b6cc28abbbf710379772d3da9227ce66926c46a3 Mon Sep 17 00:00:00 2001 +From ca75e975f8f57caa637e9cc52b3ff6feb869b74a Mon Sep 17 00:00:00 2001 +From: popcornmix <popcornmix@gmail.com> +Date: Wed, 27 Apr 2016 17:43:28 +0100 +Subject: [PATCH 001/112] Revert "SUNRPC: Make NFS swap work with multipath" + +This reverts commit 15001e5a7e1e207b6bd258cd8f187814cd15b6dc. +--- + net/sunrpc/clnt.c | 66 +++++++++++++++++++++++++++++++++++-------------------- + 1 file changed, 42 insertions(+), 24 deletions(-) + +diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c +index 7e0c9bf..0693685 100644 +--- a/net/sunrpc/clnt.c ++++ b/net/sunrpc/clnt.c +@@ -2683,39 +2683,57 @@ void rpc_show_tasks(struct net *net) + #endif + + #if IS_ENABLED(CONFIG_SUNRPC_SWAP) +-static int +-rpc_clnt_swap_activate_callback(struct rpc_clnt *clnt, +- struct rpc_xprt *xprt, +- void *dummy) +-{ +- return xprt_enable_swap(xprt); +-} +- + int + rpc_clnt_swap_activate(struct rpc_clnt *clnt) + { +- if (atomic_inc_return(&clnt->cl_swapper) == 1) +- return rpc_clnt_iterate_for_each_xprt(clnt, +- rpc_clnt_swap_activate_callback, NULL); +- return 0; +-} +-EXPORT_SYMBOL_GPL(rpc_clnt_swap_activate); ++ int ret = 0; ++ struct rpc_xprt *xprt; + +-static int +-rpc_clnt_swap_deactivate_callback(struct rpc_clnt *clnt, +- struct rpc_xprt *xprt, +- void *dummy) +-{ +- xprt_disable_swap(xprt); +- return 0; ++ if (atomic_inc_return(&clnt->cl_swapper) == 1) { ++retry: ++ rcu_read_lock(); ++ xprt = xprt_get(rcu_dereference(clnt->cl_xprt)); ++ rcu_read_unlock(); ++ if (!xprt) { ++ /* ++ * If we didn't get a reference, then we likely are ++ * racing with a migration event. Wait for a grace ++ * period and try again. ++ */ ++ synchronize_rcu(); ++ goto retry; ++ } ++ ++ ret = xprt_enable_swap(xprt); ++ xprt_put(xprt); ++ } ++ return ret; + } ++EXPORT_SYMBOL_GPL(rpc_clnt_swap_activate); + + void + rpc_clnt_swap_deactivate(struct rpc_clnt *clnt) + { +- if (atomic_dec_if_positive(&clnt->cl_swapper) == 0) +- rpc_clnt_iterate_for_each_xprt(clnt, +- rpc_clnt_swap_deactivate_callback, NULL); ++ struct rpc_xprt *xprt; ++ ++ if (atomic_dec_if_positive(&clnt->cl_swapper) == 0) { ++retry: ++ rcu_read_lock(); ++ xprt = xprt_get(rcu_dereference(clnt->cl_xprt)); ++ rcu_read_unlock(); ++ if (!xprt) { ++ /* ++ * If we didn't get a reference, then we likely are ++ * racing with a migration event. Wait for a grace ++ * period and try again. ++ */ ++ synchronize_rcu(); ++ goto retry; ++ } ++ ++ xprt_disable_swap(xprt); ++ xprt_put(xprt); ++ } + } + EXPORT_SYMBOL_GPL(rpc_clnt_swap_deactivate); + #endif /* CONFIG_SUNRPC_SWAP */ + +From 7ff74cfdea35caefc11486c463819aa0a559d032 Mon Sep 17 00:00:00 2001 From: Steve Glendinning <steve.glendinning@smsc.com> Date: Thu, 19 Feb 2015 18:47:12 +0000 -Subject: [PATCH 001/170] smsx95xx: fix crimes against truesize +Subject: [PATCH 002/112] smsx95xx: fix crimes against truesize smsc95xx is adjusting truesize when it shouldn't, and following a recent patch from Eric this is now triggering warnings. @@ -9,47 +106,59 @@ This patch stops smsc95xx from changing truesize. Signed-off-by: Steve Glendinning <steve.glendinning@smsc.com> --- - drivers/net/usb/smsc95xx.c | 2 -- - 1 file changed, 2 deletions(-) - mode change 100644 => 100755 drivers/net/usb/smsc95xx.c + drivers/net/usb/smsc95xx.c | 10 ++++++++-- + 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c -old mode 100644 -new mode 100755 -index 66b3ab9..b544181 +index 2edc2bc..2ce8d2b 100644 --- a/drivers/net/usb/smsc95xx.c +++ b/drivers/net/usb/smsc95xx.c -@@ -1785,7 +1785,6 @@ static int smsc95xx_rx_fixup(struct usbnet *dev, struct sk_buff *skb) +@@ -75,6 +75,10 @@ static bool turbo_mode = true; + module_param(turbo_mode, bool, 0644); + MODULE_PARM_DESC(turbo_mode, "Enable multiple frames per Rx transaction"); + ++static bool truesize_mode = false; ++module_param(truesize_mode, bool, 0644); ++MODULE_PARM_DESC(truesize_mode, "Report larger truesize value"); ++ + static int __must_check __smsc95xx_read_reg(struct usbnet *dev, u32 index, + u32 *data, int in_pm) + { +@@ -1795,7 +1799,8 @@ static int smsc95xx_rx_fixup(struct usbnet *dev, struct sk_buff *skb) if (dev->net->features & NETIF_F_RXCSUM) smsc95xx_rx_csum_offload(skb); skb_trim(skb, skb->len - 4); /* remove fcs */ - skb->truesize = size + sizeof(struct sk_buff); ++ if (truesize_mode) ++ skb->truesize = size + sizeof(struct sk_buff); return 1; } -@@ -1803,7 +1802,6 @@ static int smsc95xx_rx_fixup(struct usbnet *dev, struct sk_buff *skb) +@@ -1813,7 +1818,8 @@ static int smsc95xx_rx_fixup(struct usbnet *dev, struct sk_buff *skb) if (dev->net->features & NETIF_F_RXCSUM) smsc95xx_rx_csum_offload(ax_skb); skb_trim(ax_skb, ax_skb->len - 4); /* remove fcs */ - ax_skb->truesize = size + sizeof(struct sk_buff); ++ if (truesize_mode) ++ ax_skb->truesize = size + sizeof(struct sk_buff); usbnet_skb_return(dev, ax_skb); } -From 37e24d2f0af32632a17692076dddcf176d1af1f7 Mon Sep 17 00:00:00 2001 +From 1772115b52b325a46fafc57611663584bc9aef41 Mon Sep 17 00:00:00 2001 From: popcornmix <popcornmix@gmail.com> Date: Fri, 17 Apr 2015 16:58:45 +0100 -Subject: [PATCH 002/170] smsc95xx: Disable turbo mode by default +Subject: [PATCH 003/112] smsc95xx: Disable turbo mode by default --- drivers/net/usb/smsc95xx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c -index b544181..9c0da18 100755 +index 2ce8d2b..35ebf75 100644 --- a/drivers/net/usb/smsc95xx.c +++ b/drivers/net/usb/smsc95xx.c -@@ -70,7 +70,7 @@ struct smsc95xx_priv { +@@ -71,7 +71,7 @@ struct smsc95xx_priv { u8 suspend_flags; }; @@ -59,10 +168,246 @@ index b544181..9c0da18 100755 MODULE_PARM_DESC(turbo_mode, "Enable multiple frames per Rx transaction"); -From d5cb475205138f9df1fdbb74d8810ab1928696ea Mon Sep 17 00:00:00 2001 +From 0174c345e5904dd88065c5512082f92e5bac390c Mon Sep 17 00:00:00 2001 +From: Sam Nazarko <email@samnazarko.co.uk> +Date: Fri, 1 Apr 2016 17:27:21 +0100 +Subject: [PATCH 004/112] add smsc95xx packetsize module_param + +Signed-off-by: Sam Nazarko <email@samnazarko.co.uk> +--- + drivers/net/usb/smsc95xx.c | 14 +++++++++----- + 1 file changed, 9 insertions(+), 5 deletions(-) + +diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c +index 35ebf75..3cac3c9 100644 +--- a/drivers/net/usb/smsc95xx.c ++++ b/drivers/net/usb/smsc95xx.c +@@ -79,6 +79,10 @@ static bool truesize_mode = false; + module_param(truesize_mode, bool, 0644); + MODULE_PARM_DESC(truesize_mode, "Report larger truesize value"); + ++static int packetsize = 0; ++module_param(packetsize, int, 0644); ++MODULE_PARM_DESC(packetsize, "Override the RX URB packet size"); ++ + static int __must_check __smsc95xx_read_reg(struct usbnet *dev, u32 index, + u32 *data, int in_pm) + { +@@ -960,13 +964,13 @@ static int smsc95xx_reset(struct usbnet *dev) + + if (!turbo_mode) { + burst_cap = 0; +- dev->rx_urb_size = MAX_SINGLE_PACKET_SIZE; ++ dev->rx_urb_size = packetsize ? packetsize : MAX_SINGLE_PACKET_SIZE; + } else if (dev->udev->speed == USB_SPEED_HIGH) { +- burst_cap = DEFAULT_HS_BURST_CAP_SIZE / HS_USB_PKT_SIZE; +- dev->rx_urb_size = DEFAULT_HS_BURST_CAP_SIZE; ++ dev->rx_urb_size = packetsize ? packetsize : DEFAULT_HS_BURST_CAP_SIZE; ++ burst_cap = dev->rx_urb_size / HS_USB_PKT_SIZE; + } else { +- burst_cap = DEFAULT_FS_BURST_CAP_SIZE / FS_USB_PKT_SIZE; +- dev->rx_urb_size = DEFAULT_FS_BURST_CAP_SIZE; ++ dev->rx_urb_size = packetsize ? packetsize : DEFAULT_FS_BURST_CAP_SIZE; ++ burst_cap = dev->rx_urb_size / FS_USB_PKT_SIZE; + } + + netif_dbg(dev, ifup, dev->net, "rx_urb_size=%ld\n", + +From be730bbaaddeb27448477933ffc1ddf37491c897 Mon Sep 17 00:00:00 2001 +From: popcornmix <popcornmix@gmail.com> +Date: Tue, 26 Mar 2013 17:26:38 +0000 +Subject: [PATCH 005/112] Allow mac address to be set in smsc95xx + +Signed-off-by: popcornmix <popcornmix@gmail.com> +--- + drivers/net/usb/smsc95xx.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 56 insertions(+) + +diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c +index 3cac3c9..d9bdc74 100644 +--- a/drivers/net/usb/smsc95xx.c ++++ b/drivers/net/usb/smsc95xx.c +@@ -60,6 +60,7 @@ + #define SUSPEND_SUSPEND3 (0x08) + #define SUSPEND_ALLMODES (SUSPEND_SUSPEND0 | SUSPEND_SUSPEND1 | \ + SUSPEND_SUSPEND2 | SUSPEND_SUSPEND3) ++#define MAC_ADDR_LEN (6) + + struct smsc95xx_priv { + u32 mac_cr; +@@ -83,6 +84,10 @@ static int packetsize = 0; + module_param(packetsize, int, 0644); + MODULE_PARM_DESC(packetsize, "Override the RX URB packet size"); + ++static char *macaddr = ":"; ++module_param(macaddr, charp, 0); ++MODULE_PARM_DESC(macaddr, "MAC address"); ++ + static int __must_check __smsc95xx_read_reg(struct usbnet *dev, u32 index, + u32 *data, int in_pm) + { +@@ -772,6 +777,53 @@ static int smsc95xx_ioctl(struct net_device *netdev, struct ifreq *rq, int cmd) + return generic_mii_ioctl(&dev->mii, if_mii(rq), cmd, NULL); + } + ++/* Check the macaddr module parameter for a MAC address */ ++static int smsc95xx_is_macaddr_param(struct usbnet *dev, u8 *dev_mac) ++{ ++ int i, j, got_num, num; ++ u8 mtbl[MAC_ADDR_LEN]; ++ ++ if (macaddr[0] == ':') ++ return 0; ++ ++ i = 0; ++ j = 0; ++ num = 0; ++ got_num = 0; ++ while (j < MAC_ADDR_LEN) { ++ if (macaddr[i] && macaddr[i] != ':') { ++ got_num++; ++ if ('0' <= macaddr[i] && macaddr[i] <= '9') ++ num = num * 16 + macaddr[i] - '0'; ++ else if ('A' <= macaddr[i] && macaddr[i] <= 'F') ++ num = num * 16 + 10 + macaddr[i] - 'A'; ++ else if ('a' <= macaddr[i] && macaddr[i] <= 'f') ++ num = num * 16 + 10 + macaddr[i] - 'a'; ++ else ++ break; ++ i++; ++ } else if (got_num == 2) { ++ mtbl[j++] = (u8) num; ++ num = 0; ++ got_num = 0; ++ i++; ++ } else { ++ break; ++ } ++ } ++ ++ if (j == MAC_ADDR_LEN) { ++ netif_dbg(dev, ifup, dev->net, "Overriding MAC address with: " ++ "%02x:%02x:%02x:%02x:%02x:%02x\n", mtbl[0], mtbl[1], mtbl[2], ++ mtbl[3], mtbl[4], mtbl[5]); ++ for (i = 0; i < MAC_ADDR_LEN; i++) ++ dev_mac[i] = mtbl[i]; ++ return 1; ++ } else { ++ return 0; ++ } ++} ++ + static void smsc95xx_init_mac_address(struct usbnet *dev) + { + const u8 *mac_addr; +@@ -793,6 +845,10 @@ static void smsc95xx_init_mac_address(struct usbnet *dev) + } + } + ++ /* Check module parameters */ ++ if (smsc95xx_is_macaddr_param(dev, dev->net->dev_addr)) ++ return; ++ + /* no useful static MAC address found. generate a random one */ + eth_hw_addr_random(dev->net); + netif_dbg(dev, ifup, dev->net, "MAC address set to eth_random_addr\n"); + +From 2f4a1d4938769ec3951b779bb607a841d6abdf7b Mon Sep 17 00:00:00 2001 +From: Nicolas Boullis <nboullis@debian.org> +Date: Sun, 10 Apr 2016 13:23:05 +0200 +Subject: [PATCH 006/112] rtc: ds1307: ensure that any pending alarm is cleared + before a new alarm is enabled +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +If a previously-set alarm was disabled and then triggered, it may still +be pending when a new alarm is configured. + +Then, if the alarm is enabled before the pending alarm is cleared, then +an interrupt is immediately raised. + +Unfortunately, when the alarm is cleared and enabled during the same I²C +block write, the chip (at least the DS1339 I have) considers that the +alarm is enabled before it is cleared, and raises an interrupt. + +This patch ensures that the pending alarm is cleared before the alarm is +enabled. + +Signed-off-by: Nicolas Boullis <nboullis@debian.org> +Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com> +--- + drivers/rtc/rtc-ds1307.c | 13 ++++++++----- + 1 file changed, 8 insertions(+), 5 deletions(-) + +diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c +index ecb7dba..e94eb09 100644 +--- a/drivers/rtc/rtc-ds1307.c ++++ b/drivers/rtc/rtc-ds1307.c +@@ -538,12 +538,8 @@ static int ds1337_set_alarm(struct device *dev, struct rtc_wkalrm *t) + buf[5] = 0; + buf[6] = 0; + +- /* optionally enable ALARM1 */ ++ /* disable alarms */ + buf[7] = control & ~(DS1337_BIT_A1IE | DS1337_BIT_A2IE); +- if (t->enabled) { +- dev_dbg(dev, "alarm IRQ armed\n"); +- buf[7] |= DS1337_BIT_A1IE; /* only ALARM1 is used */ +- } + buf[8] = status & ~(DS1337_BIT_A1I | DS1337_BIT_A2I); + + ret = ds1307->write_block_data(client, +@@ -553,6 +549,13 @@ static int ds1337_set_alarm(struct device *dev, struct rtc_wkalrm *t) + return ret; + } + ++ /* optionally enable ALARM1 */ ++ if (t->enabled) { ++ dev_dbg(dev, "alarm IRQ armed\n"); ++ buf[7] |= DS1337_BIT_A1IE; /* only ALARM1 is used */ ++ i2c_smbus_write_byte_data(client, DS1337_REG_CONTROL, buf[7]); ++ } ++ + return 0; + } + + +From c28f0cf7c000000c6af92915e49b11b3a0b5db55 Mon Sep 17 00:00:00 2001 +From: Phil Elwell <phil@raspberrypi.org> +Date: Wed, 9 Mar 2016 13:28:24 +0000 +Subject: [PATCH 007/112] serial: Take care starting a hung-up tty's port + +tty_port_hangup sets a port's tty field to NULL (holding the port lock), +but uart_tx_stopped, called from __uart_start (with the port lock), +uses the tty field without checking for NULL. + +Change uart_tx_stopped to treat a NULL tty field as another stopped +indication. + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> +--- + include/linux/serial_core.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h +index cbfcf38..96bc15a 100644 +--- a/include/linux/serial_core.h ++++ b/include/linux/serial_core.h +@@ -403,7 +403,7 @@ int uart_resume_port(struct uart_driver *reg, struct uart_port *port); + static inline int uart_tx_stopped(struct uart_port *port) + { + struct tty_struct *tty = port->state->port.tty; +- if (tty->stopped || port->hw_stopped) ++ if (!tty || tty->stopped || port->hw_stopped) + return 1; + return 0; + } + +From c6d7c03c674161544d9cb391acc3bbf18bc3ac95 Mon Sep 17 00:00:00 2001 From: popcornmix <popcornmix@gmail.com> Date: Wed, 18 Jun 2014 13:42:01 +0100 -Subject: [PATCH 003/170] vmstat: Workaround for issue where dirty page count +Subject: [PATCH 008/112] vmstat: Workaround for issue where dirty page count goes negative See: @@ -73,10 +418,10 @@ http://www.spinics.net/lists/linux-mm/msg72236.html 1 file changed, 4 insertions(+) diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h -index 3e5d907..2539068 100644 +index 73fae8c..5dd1278 100644 --- a/include/linux/vmstat.h +++ b/include/linux/vmstat.h -@@ -219,7 +219,11 @@ static inline void __inc_zone_state(struct zone *zone, enum zone_stat_item item) +@@ -220,7 +220,11 @@ static inline void __inc_zone_state(struct zone *zone, enum zone_stat_item item) static inline void __dec_zone_state(struct zone *zone, enum zone_stat_item item) { atomic_long_dec(&zone->vm_stat[item]); @@ -89,16 +434,74 @@ index 3e5d907..2539068 100644 static inline void __inc_zone_page_state(struct page *page, -From 249a499b1d4b6f8a57b3377d4f505841e99f60c8 Mon Sep 17 00:00:00 2001 +From 31b90174e46b5e1eb81aa8c29e7f42fdf6c74f2b Mon Sep 17 00:00:00 2001 +From: Phil Elwell <phil@raspberrypi.org> +Date: Fri, 13 Mar 2015 12:43:36 +0000 +Subject: [PATCH 009/112] Protect __release_resource against resources without + parents + +Without this patch, removing a device tree overlay can crash here. + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> +--- + kernel/resource.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/kernel/resource.c b/kernel/resource.c +index 9b5f044..f8a9af6 100644 +--- a/kernel/resource.c ++++ b/kernel/resource.c +@@ -246,6 +246,12 @@ static int __release_resource(struct resource *old, bool release_child) + { + struct resource *tmp, **p, *chd; + ++ if (!old->parent) { ++ WARN(old->sibling, "sibling but no parent"); ++ if (old->sibling) ++ return -EINVAL; ++ return 0; ++ } + p = &old->parent->child; + for (;;) { + tmp = *p; + +From 40f5929ab19a370adb498aa3249ca28942127d9b Mon Sep 17 00:00:00 2001 +From: Eric Anholt <eric@anholt.net> +Date: Thu, 18 Dec 2014 16:07:15 -0800 +Subject: [PATCH 010/112] mm: Remove the PFN busy warning + +See commit dae803e165a11bc88ca8dbc07a11077caf97bbcb -- the warning is +expected sometimes when using CMA. However, that commit still spams +my kernel log with these warnings. + +Signed-off-by: Eric Anholt <eric@anholt.net> +--- + mm/page_alloc.c | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/mm/page_alloc.c b/mm/page_alloc.c +index c1069ef..fe21be6 100644 +--- a/mm/page_alloc.c ++++ b/mm/page_alloc.c +@@ -7101,8 +7101,6 @@ int alloc_contig_range(unsigned long start, unsigned long end, + + /* Make sure the range is really isolated. */ + if (test_pages_isolated(outer_start, end, false)) { +- pr_info("%s: [%lx, %lx) PFNs busy\n", +- __func__, outer_start, end); + ret = -EBUSY; + goto done; + } + +From d7c3a06d1bace2ac531e73c63b5fa08117ed7826 Mon Sep 17 00:00:00 2001 From: Robert Tiemann <rtie@gmx.de> Date: Mon, 20 Jul 2015 11:01:25 +0200 -Subject: [PATCH 004/170] BCM2835_DT: Fix I2S register map +Subject: [PATCH 011/112] BCM2835_DT: Fix I2S register map --- Documentation/devicetree/bindings/dma/brcm,bcm2835-dma.txt | 4 ++-- Documentation/devicetree/bindings/sound/brcm,bcm2835-i2s.txt | 4 ++-- - arch/arm/boot/dts/bcm2835.dtsi | 4 ++-- - 3 files changed, 6 insertions(+), 6 deletions(-) + 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Documentation/devicetree/bindings/dma/brcm,bcm2835-dma.txt b/Documentation/devicetree/bindings/dma/brcm,bcm2835-dma.txt index 1396078..2db8294 100644 @@ -130,26 +533,11 @@ index 65783de..a89fe42 100644 dmas = <&dma 2>, <&dma 3>; -diff --git a/arch/arm/boot/dts/bcm2835.dtsi b/arch/arm/boot/dts/bcm2835.dtsi -index aef64de..864a3ef 100644 ---- a/arch/arm/boot/dts/bcm2835.dtsi -+++ b/arch/arm/boot/dts/bcm2835.dtsi -@@ -120,8 +120,8 @@ - - i2s: i2s@7e203000 { - compatible = "brcm,bcm2835-i2s"; -- reg = <0x7e203000 0x20>, -- <0x7e101098 0x02>; -+ reg = <0x7e203000 0x24>, -+ <0x7e101098 0x08>; - - dmas = <&dma 2>, - <&dma 3>; -From c24657505a2aac71d0409b0ef703fc21ecab4b2e Mon Sep 17 00:00:00 2001 +From 4c752b5cd3a5486b9fcba5d591175e5b742cfbef Mon Sep 17 00:00:00 2001 From: Phil Elwell <phil@raspberrypi.org> Date: Fri, 4 Dec 2015 17:41:50 +0000 -Subject: [PATCH 005/170] irq-bcm2836: Prevent spurious interrupts, and trap +Subject: [PATCH 012/112] irq-bcm2836: Prevent spurious interrupts, and trap them early The old arch-specific IRQ macros included a dsb to ensure the @@ -160,30 +548,26 @@ precaution to avoid spurious interrupts. Spurious interrupts are still possible for other reasons, though, so trap them early. --- - drivers/irqchip/irq-bcm2836.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) + drivers/irqchip/irq-bcm2836.c | 1 + + 1 file changed, 1 insertion(+) diff --git a/drivers/irqchip/irq-bcm2836.c b/drivers/irqchip/irq-bcm2836.c -index f687082..4cd8ebe 100644 +index b6e950d..bbb92c2 100644 --- a/drivers/irqchip/irq-bcm2836.c +++ b/drivers/irqchip/irq-bcm2836.c -@@ -170,9 +170,10 @@ __exception_irq_entry bcm2836_arm_irqchip_handle_irq(struct pt_regs *regs) +@@ -175,6 +175,7 @@ __exception_irq_entry bcm2836_arm_irqchip_handle_irq(struct pt_regs *regs) u32 ipi = ffs(mbox_val) - 1; writel(1 << ipi, mailbox0); + dsb(); handle_IPI(ipi, regs); #endif -- } else { -+ } else if (stat) { - u32 hwirq = ffs(stat) - 1; - - handle_IRQ(irq_linear_revmap(intc.domain, hwirq), regs); + } else if (stat) { -From 229bcf2e73ce37e8a18d68773471024c848d84bd Mon Sep 17 00:00:00 2001 +From 035dd0ae04e88afb2133082dce4c15527f5fb0ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= <noralf@tronnes.org> Date: Fri, 12 Jun 2015 19:01:05 +0200 -Subject: [PATCH 006/170] irqchip: bcm2835: Add FIQ support +Subject: [PATCH 013/112] irqchip: bcm2835: Add FIQ support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -201,12 +585,12 @@ Acked-by: Stephen Warren <swarren@wwwdotorg.org> 2 files changed, 47 insertions(+), 5 deletions(-) diff --git a/arch/arm/mach-bcm/Kconfig b/arch/arm/mach-bcm/Kconfig -index 8c53c55..c943747b 100644 +index 7ef1214..b1a5a7b 100644 --- a/arch/arm/mach-bcm/Kconfig +++ b/arch/arm/mach-bcm/Kconfig -@@ -128,6 +128,7 @@ config ARCH_BCM2835 - select ARM_ERRATA_411920 +@@ -143,6 +143,7 @@ config ARCH_BCM2835 select ARM_TIMER_SP804 + select HAVE_ARM_ARCH_TIMER if ARCH_MULTI_V7 select CLKSRC_OF + select FIQ select PINCTRL @@ -312,10 +696,10 @@ index bf9cc5f..3f601f9 100644 } -From 6780f0a5c6af19f2b9850e961a0f81fbfdfa48fe Mon Sep 17 00:00:00 2001 +From bfbf2463f40ebf7f80ce73ad7b15ea4ca2e446a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= <noralf@tronnes.org> Date: Fri, 23 Oct 2015 16:26:55 +0200 -Subject: [PATCH 007/170] irqchip: irq-bcm2835: Add 2836 FIQ support +Subject: [PATCH 014/112] irqchip: irq-bcm2835: Add 2836 FIQ support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -411,17 +795,41 @@ index 3f601f9..20deb28 100644 for (b = 0; b < NR_BANKS; b++) { for (i = 0; i < bank_irqs[b]; i++) { -From 4b9529b98c01569dff06f4e67ba28a47318e5ea5 Mon Sep 17 00:00:00 2001 +From 18707aacc4b3f082193c87f86edfaeaeed90f56a Mon Sep 17 00:00:00 2001 +From: Phil Elwell <phil@raspberrypi.org> +Date: Tue, 14 Jul 2015 10:26:09 +0100 +Subject: [PATCH 015/112] spidev: Add "spidev" compatible string to silence + warning + +See: https://github.com/raspberrypi/linux/issues/1054 +--- + drivers/spi/spidev.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c +index e3c19f3..f4963e3 100644 +--- a/drivers/spi/spidev.c ++++ b/drivers/spi/spidev.c +@@ -695,6 +695,7 @@ static struct class *spidev_class; + static const struct of_device_id spidev_dt_ids[] = { + { .compatible = "rohm,dh2228fv" }, + { .compatible = "lineartechnology,ltc2488" }, ++ { .compatible = "spidev" }, + {}, + }; + MODULE_DEVICE_TABLE(of, spidev_dt_ids); + +From 9a451703f2138a4c8543033879948e3e167a0c26 Mon Sep 17 00:00:00 2001 From: Phil Elwell <phil@raspberrypi.org> Date: Tue, 30 Jun 2015 14:12:42 +0100 -Subject: [PATCH 008/170] serial: 8250: Don't crash when nr_uarts is 0 +Subject: [PATCH 016/112] serial: 8250: Don't crash when nr_uarts is 0 --- drivers/tty/serial/8250/8250_core.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c -index 3912646..b51a59c 100644 +index 2f4f5ee..edc1355 100644 --- a/drivers/tty/serial/8250/8250_core.c +++ b/drivers/tty/serial/8250/8250_core.c @@ -509,6 +509,8 @@ static void __init serial8250_isa_init_ports(void) @@ -434,10 +842,10 @@ index 3912646..b51a59c 100644 for (i = 0; i < nr_uarts; i++) { struct uart_8250_port *up = &serial8250_ports[i]; -From 5fd6ab82b1027504faa66cf4fc8b999fafaacd12 Mon Sep 17 00:00:00 2001 +From 888e562b188603c0fd16585155bb5393bd1a5704 Mon Sep 17 00:00:00 2001 From: notro <notro@tronnes.org> Date: Thu, 10 Jul 2014 13:59:47 +0200 -Subject: [PATCH 009/170] pinctrl-bcm2835: Set base to 0 give expected gpio +Subject: [PATCH 017/112] pinctrl-bcm2835: Set base to 0 give expected gpio numbering Signed-off-by: Noralf Tronnes <notro@tronnes.org> @@ -446,7 +854,7 @@ Signed-off-by: Noralf Tronnes <notro@tronnes.org> 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pinctrl/bcm/pinctrl-bcm2835.c b/drivers/pinctrl/bcm/pinctrl-bcm2835.c -index 2e6ca69..62cc363 100644 +index 08b1d93..0a23c81 100644 --- a/drivers/pinctrl/bcm/pinctrl-bcm2835.c +++ b/drivers/pinctrl/bcm/pinctrl-bcm2835.c @@ -373,7 +373,7 @@ static struct gpio_chip bcm2835_gpio_chip = { @@ -459,10 +867,10 @@ index 2e6ca69..62cc363 100644 .can_sleep = false, }; -From 4254ef2647e89061427836443eac60351b3306a7 Mon Sep 17 00:00:00 2001 +From 44235a003f98fa50a4a03958bc6f224675dd1aea Mon Sep 17 00:00:00 2001 From: Phil Elwell <phil@raspberrypi.org> Date: Tue, 24 Feb 2015 13:40:50 +0000 -Subject: [PATCH 010/170] pinctrl-bcm2835: Fix interrupt handling for GPIOs +Subject: [PATCH 018/112] pinctrl-bcm2835: Fix interrupt handling for GPIOs 28-31 and 46-53 Contrary to the documentation, the BCM2835 GPIO controller actually has @@ -483,7 +891,7 @@ the pins are often used for I2S instead. 1 file changed, 39 insertions(+), 12 deletions(-) diff --git a/drivers/pinctrl/bcm/pinctrl-bcm2835.c b/drivers/pinctrl/bcm/pinctrl-bcm2835.c -index 62cc363..ab345f4 100644 +index 0a23c81..b793bbd 100644 --- a/drivers/pinctrl/bcm/pinctrl-bcm2835.c +++ b/drivers/pinctrl/bcm/pinctrl-bcm2835.c @@ -47,6 +47,7 @@ @@ -608,10 +1016,10 @@ index 62cc363..ab345f4 100644 }, }; -From 93b12e64d0e2a8a65189dedd667e00b0a0fab60a Mon Sep 17 00:00:00 2001 +From 338386be825f60aefee3d3613778b6233d3759b3 Mon Sep 17 00:00:00 2001 From: Phil Elwell <phil@raspberrypi.org> Date: Thu, 26 Feb 2015 09:58:22 +0000 -Subject: [PATCH 011/170] pinctrl-bcm2835: Only request the interrupts listed +Subject: [PATCH 019/112] pinctrl-bcm2835: Only request the interrupts listed in the DTB Although the GPIO controller can generate three interrupts (four counting @@ -625,7 +1033,7 @@ interface, is unlikely to be a problem. 1 file changed, 2 insertions(+) diff --git a/drivers/pinctrl/bcm/pinctrl-bcm2835.c b/drivers/pinctrl/bcm/pinctrl-bcm2835.c -index ab345f4..640e3b0 100644 +index b793bbd..8683a1b 100644 --- a/drivers/pinctrl/bcm/pinctrl-bcm2835.c +++ b/drivers/pinctrl/bcm/pinctrl-bcm2835.c @@ -1029,6 +1029,8 @@ static int bcm2835_pinctrl_probe(struct platform_device *pdev) @@ -638,10 +1046,54 @@ index ab345f4..640e3b0 100644 pc->irq_data[i].irqgroup = i; -From bb8ff388ad26721eebb7249afb6f6f57bc196de4 Mon Sep 17 00:00:00 2001 +From 74dbec2e38b6b8b6fb046a161cc86b835eadbde4 Mon Sep 17 00:00:00 2001 +From: Phil Elwell <phil@raspberrypi.org> +Date: Fri, 6 May 2016 12:32:47 +0100 +Subject: [PATCH 020/112] pinctrl-bcm2835: Return pins to inputs when freed + +When dynamically unloading overlays, it is important that freed pins are +restored to being inputs to prevent functions from being enabled in +multiple places at once. + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> +--- + drivers/pinctrl/bcm/pinctrl-bcm2835.c | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/drivers/pinctrl/bcm/pinctrl-bcm2835.c b/drivers/pinctrl/bcm/pinctrl-bcm2835.c +index 8683a1b..6327122 100644 +--- a/drivers/pinctrl/bcm/pinctrl-bcm2835.c ++++ b/drivers/pinctrl/bcm/pinctrl-bcm2835.c +@@ -831,6 +831,16 @@ static const struct pinctrl_ops bcm2835_pctl_ops = { + .dt_free_map = bcm2835_pctl_dt_free_map, + }; + ++static int bcm2835_pmx_free(struct pinctrl_dev *pctldev, ++ unsigned offset) ++{ ++ struct bcm2835_pinctrl *pc = pinctrl_dev_get_drvdata(pctldev); ++ ++ /* disable by setting to GPIO_IN */ ++ bcm2835_pinctrl_fsel_set(pc, offset, BCM2835_FSEL_GPIO_IN); ++ return 0; ++} ++ + static int bcm2835_pmx_get_functions_count(struct pinctrl_dev *pctldev) + { + return BCM2835_FSEL_COUNT; +@@ -890,6 +900,7 @@ static int bcm2835_pmx_gpio_set_direction(struct pinctrl_dev *pctldev, + } + + static const struct pinmux_ops bcm2835_pmx_ops = { ++ .free = bcm2835_pmx_free, + .get_functions_count = bcm2835_pmx_get_functions_count, + .get_function_name = bcm2835_pmx_get_function_name, + .get_function_groups = bcm2835_pmx_get_function_groups, + +From 1dc43cf973493169b270cba5302c4cbbdf940a3f Mon Sep 17 00:00:00 2001 From: Phil Elwell <phil@raspberrypi.org> Date: Wed, 24 Jun 2015 14:10:44 +0100 -Subject: [PATCH 012/170] spi-bcm2835: Support pin groups other than 7-11 +Subject: [PATCH 021/112] spi-bcm2835: Support pin groups other than 7-11 The spi-bcm2835 driver automatically uses GPIO chip-selects due to some unreliability of the native ones. In doing so it chooses the @@ -658,7 +1110,7 @@ Signed-off-by: Phil Elwell <phil@raspberrypi.org> 1 file changed, 37 insertions(+), 8 deletions(-) diff --git a/drivers/spi/spi-bcm2835.c b/drivers/spi/spi-bcm2835.c -index cf04960..a2b1f45 100644 +index f35cc10..5dfe20f 100644 --- a/drivers/spi/spi-bcm2835.c +++ b/drivers/spi/spi-bcm2835.c @@ -688,6 +688,8 @@ static int bcm2835_spi_setup(struct spi_device *spi) @@ -722,10 +1174,10 @@ index cf04960..a2b1f45 100644 /* and set up the "mode" and level */ dev_info(&spi->dev, "setting up native-CS%i as GPIO %i\n", -From bfcfed788d152e828747ea889a88f8b179217ddb Mon Sep 17 00:00:00 2001 +From fa44a350bfe28a2ee33e460c4710036241db1054 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= <noralf@tronnes.org> Date: Wed, 3 Jun 2015 12:26:13 +0200 -Subject: [PATCH 013/170] ARM: bcm2835: Set Serial number and Revision +Subject: [PATCH 022/112] ARM: bcm2835: Set Serial number and Revision MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -750,7 +1202,7 @@ Signed-off-by: Noralf Trønnes <noralf@tronnes.org> 1 file changed, 9 insertions(+) diff --git a/arch/arm/mach-bcm/board_bcm2835.c b/arch/arm/mach-bcm/board_bcm2835.c -index 0f7b9ea..1e6f1cf9 100644 +index 834d676..3b68a8d 100644 --- a/arch/arm/mach-bcm/board_bcm2835.c +++ b/arch/arm/mach-bcm/board_bcm2835.c @@ -17,12 +17,16 @@ @@ -783,370 +1235,10 @@ index 0f7b9ea..1e6f1cf9 100644 static const char * const bcm2835_compat[] = { -From fb968a02c00e2722df2dcfec6f54b7524ff5a155 Mon Sep 17 00:00:00 2001 -From: Matthias Reichl <hias@horus.com> -Date: Sun, 11 Oct 2015 16:44:05 +0200 -Subject: [PATCH 014/170] bcm2835-i2s: get base address for DMA from devicetree - -Code copied from spi-bcm2835. Get physical address from devicetree -instead of using hardcoded constant. - -Signed-off-by: Matthias Reichl <hias@horus.com> ---- - sound/soc/bcm/bcm2835-i2s.c | 20 ++++++++++++-------- - 1 file changed, 12 insertions(+), 8 deletions(-) - -diff --git a/sound/soc/bcm/bcm2835-i2s.c b/sound/soc/bcm/bcm2835-i2s.c -index 8c435be..0bc4f47 100644 ---- a/sound/soc/bcm/bcm2835-i2s.c -+++ b/sound/soc/bcm/bcm2835-i2s.c -@@ -38,6 +38,7 @@ - #include <linux/delay.h> - #include <linux/io.h> - #include <linux/clk.h> -+#include <linux/of_address.h> - - #include <sound/core.h> - #include <sound/pcm.h> -@@ -158,10 +159,6 @@ static const unsigned int bcm2835_clk_freq[BCM2835_CLK_SRC_HDMI+1] = { - #define BCM2835_I2S_INT_RXR BIT(1) - #define BCM2835_I2S_INT_TXW BIT(0) - --/* I2S DMA interface */ --/* FIXME: Needs IOMMU support */ --#define BCM2835_VCMMU_SHIFT (0x7E000000 - 0x20000000) -- - /* General device struct */ - struct bcm2835_i2s_dev { - struct device *dev; -@@ -791,6 +788,15 @@ static int bcm2835_i2s_probe(struct platform_device *pdev) - int ret; - struct regmap *regmap[2]; - struct resource *mem[2]; -+ const __be32 *addr; -+ dma_addr_t dma_reg_base; -+ -+ addr = of_get_address(pdev->dev.of_node, 0, NULL, NULL); -+ if (!addr) { -+ dev_err(&pdev->dev, "could not get DMA-register address\n"); -+ return -ENODEV; -+ } -+ dma_reg_base = be32_to_cpup(addr); - - /* Request both ioareas */ - for (i = 0; i <= 1; i++) { -@@ -817,12 +823,10 @@ static int bcm2835_i2s_probe(struct platform_device *pdev) - - /* Set the DMA address */ - dev->dma_data[SNDRV_PCM_STREAM_PLAYBACK].addr = -- (dma_addr_t)mem[0]->start + BCM2835_I2S_FIFO_A_REG -- + BCM2835_VCMMU_SHIFT; -+ dma_reg_base + BCM2835_I2S_FIFO_A_REG; - - dev->dma_data[SNDRV_PCM_STREAM_CAPTURE].addr = -- (dma_addr_t)mem[0]->start + BCM2835_I2S_FIFO_A_REG -- + BCM2835_VCMMU_SHIFT; -+ dma_reg_base + BCM2835_I2S_FIFO_A_REG; - - /* Set the bus width */ - dev->dma_data[SNDRV_PCM_STREAM_PLAYBACK].addr_width = - -From abbe565abfe075b76e01b9671c6fc4cf42cc0328 Mon Sep 17 00:00:00 2001 -From: Matthias Reichl <hias@horus.com> -Date: Sun, 11 Oct 2015 15:21:16 +0200 -Subject: [PATCH 015/170] bcm2835-i2s: add 24bit support, update bclk_ratio to - more correct values - -Code ported from bcm2708-i2s driver in Raspberry Pi tree. - -RPi commit 62c05a0b5328d9376d39c9e74da10b8a2465c234 ("ASoC: BCM2708: -Add 24 bit support") - -This adds 24 bit support to the I2S driver of the BCM2708. -Besides enabling the 24 bit flags, it includes two bug fixes: - -MMAP is not supported. Claiming this leads to strange issues -when the format of driver and file do not match. - -The datasheet states that the width extension bit should be set -for widths greater than 24, but greater or equal would be correct. -This follows from the definition of the width field. - -Signed-off-by: Florian Meier <florian.meier@koalo.de> - -RPi commit 3e8c672bc4e92d457aa4654bbb4cfd79a18a2327 ("bcm2708-i2s: -Update bclk_ratio to more correct values") - -Discussion about blck_ratio affecting sound quality: -https://github.com/raspberrypi/linux/issues/681 - -Signed-off-by: Matthias Reichl <hias@horus.com> ---- - sound/soc/bcm/bcm2835-i2s.c | 12 +++++++++--- - 1 file changed, 9 insertions(+), 3 deletions(-) - -diff --git a/sound/soc/bcm/bcm2835-i2s.c b/sound/soc/bcm/bcm2835-i2s.c -index 0bc4f47..cf60390 100644 ---- a/sound/soc/bcm/bcm2835-i2s.c -+++ b/sound/soc/bcm/bcm2835-i2s.c -@@ -340,11 +340,15 @@ static int bcm2835_i2s_hw_params(struct snd_pcm_substream *substream, - switch (params_format(params)) { - case SNDRV_PCM_FORMAT_S16_LE: - data_length = 16; -- bclk_ratio = 40; -+ bclk_ratio = 50; -+ break; -+ case SNDRV_PCM_FORMAT_S24_LE: -+ data_length = 24; -+ bclk_ratio = 50; - break; - case SNDRV_PCM_FORMAT_S32_LE: - data_length = 32; -- bclk_ratio = 80; -+ bclk_ratio = 100; - break; - default: - return -EINVAL; -@@ -420,7 +424,7 @@ static int bcm2835_i2s_hw_params(struct snd_pcm_substream *substream, - /* Setup the frame format */ - format = BCM2835_I2S_CHEN; - -- if (data_length > 24) -+ if (data_length >= 24) - format |= BCM2835_I2S_CHWEX; - - format |= BCM2835_I2S_CHWID((data_length-8)&0xf); -@@ -711,6 +715,7 @@ static struct snd_soc_dai_driver bcm2835_i2s_dai = { - .channels_max = 2, - .rates = SNDRV_PCM_RATE_8000_192000, - .formats = SNDRV_PCM_FMTBIT_S16_LE -+ | SNDRV_PCM_FMTBIT_S24_LE - | SNDRV_PCM_FMTBIT_S32_LE - }, - .capture = { -@@ -718,6 +723,7 @@ static struct snd_soc_dai_driver bcm2835_i2s_dai = { - .channels_max = 2, - .rates = SNDRV_PCM_RATE_8000_192000, - .formats = SNDRV_PCM_FMTBIT_S16_LE -+ | SNDRV_PCM_FMTBIT_S24_LE - | SNDRV_PCM_FMTBIT_S32_LE - }, - .ops = &bcm2835_i2s_dai_ops, - -From b2cc62cd13099d6d2f21b9927df248aa3bdd8d5b Mon Sep 17 00:00:00 2001 -From: Matthias Reichl <hias@horus.com> -Date: Sun, 11 Oct 2015 15:25:51 +0200 -Subject: [PATCH 016/170] bcm2835-i2s: setup clock only if CPU is clock master - -Code ported from bcm2708-i2s driver in Raspberry Pi tree. - -RPi commit c14827ecdaa36607f6110f9ce8df96e698672191 ("bcm2708: Allow -option card devices to be configured via DT") - -Original work by Zoltan Szenczi, committed to RPi tree by -Phil Elwell. - -Signed-off-by: Matthias Reichl <hias@horus.com> ---- - sound/soc/bcm/bcm2835-i2s.c | 28 +++++++++++++++++++--------- - 1 file changed, 19 insertions(+), 9 deletions(-) - -diff --git a/sound/soc/bcm/bcm2835-i2s.c b/sound/soc/bcm/bcm2835-i2s.c -index cf60390..4ac4e92 100644 ---- a/sound/soc/bcm/bcm2835-i2s.c -+++ b/sound/soc/bcm/bcm2835-i2s.c -@@ -411,15 +411,25 @@ static int bcm2835_i2s_hw_params(struct snd_pcm_substream *substream, - divf = dividend & BCM2835_CLK_DIVF_MASK; - } - -- /* Set clock divider */ -- regmap_write(dev->clk_regmap, BCM2835_CLK_PCMDIV_REG, BCM2835_CLK_PASSWD -- | BCM2835_CLK_DIVI(divi) -- | BCM2835_CLK_DIVF(divf)); -- -- /* Setup clock, but don't start it yet */ -- regmap_write(dev->clk_regmap, BCM2835_CLK_PCMCTL_REG, BCM2835_CLK_PASSWD -- | BCM2835_CLK_MASH(mash) -- | BCM2835_CLK_SRC(clk_src)); -+ /* Clock should only be set up here if CPU is clock master */ -+ switch (dev->fmt & SND_SOC_DAIFMT_MASTER_MASK) { -+ case SND_SOC_DAIFMT_CBS_CFS: -+ case SND_SOC_DAIFMT_CBS_CFM: -+ /* Set clock divider */ -+ regmap_write(dev->clk_regmap, BCM2835_CLK_PCMDIV_REG, -+ BCM2835_CLK_PASSWD -+ | BCM2835_CLK_DIVI(divi) -+ | BCM2835_CLK_DIVF(divf)); -+ -+ /* Setup clock, but don't start it yet */ -+ regmap_write(dev->clk_regmap, BCM2835_CLK_PCMCTL_REG, -+ BCM2835_CLK_PASSWD -+ | BCM2835_CLK_MASH(mash) -+ | BCM2835_CLK_SRC(clk_src)); -+ break; -+ default: -+ break; -+ } - - /* Setup the frame format */ - format = BCM2835_I2S_CHEN; - -From 71b2c93cd332be280b9ca7f293e463f30d5fb108 Mon Sep 17 00:00:00 2001 -From: Matthias Reichl <hias@horus.com> -Date: Sun, 11 Oct 2015 15:49:51 +0200 -Subject: [PATCH 017/170] bcm2835-i2s: Eliminate debugfs directory error - -Code ported from bcm2708-i2s driver in Raspberry Pi tree. - -RPi commit fd7d7a3dbe9262d16971ef81c234ed28c6499dd7 ("bcm2708: -Eliminate i2s debugfs directory error") - -Qualify the two regmap ranges uses by bcm2708-i2s ('-i2s' and '-clk') -to avoid the name clash when registering debugfs entries. - -Signed-off-by: Matthias Reichl <hias@horus.com> ---- - sound/soc/bcm/bcm2835-i2s.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/sound/soc/bcm/bcm2835-i2s.c b/sound/soc/bcm/bcm2835-i2s.c -index 4ac4e92..aab3df9 100644 ---- a/sound/soc/bcm/bcm2835-i2s.c -+++ b/sound/soc/bcm/bcm2835-i2s.c -@@ -782,6 +782,7 @@ static const struct regmap_config bcm2835_regmap_config[] = { - .precious_reg = bcm2835_i2s_precious_reg, - .volatile_reg = bcm2835_i2s_volatile_reg, - .cache_type = REGCACHE_RBTREE, -+ .name = "i2s", - }, - { - .reg_bits = 32, -@@ -790,6 +791,7 @@ static const struct regmap_config bcm2835_regmap_config[] = { - .max_register = BCM2835_CLK_PCMDIV_REG, - .volatile_reg = bcm2835_clk_volatile_reg, - .cache_type = REGCACHE_RBTREE, -+ .name = "clk", - }, - }; - - -From fae43fcaa20df1d39c09c98372100bb1dedd6090 Mon Sep 17 00:00:00 2001 -From: Matthias Reichl <hias@horus.com> -Date: Sun, 11 Oct 2015 15:35:20 +0200 -Subject: [PATCH 018/170] bcm2835-i2s: Register PCM device - -Code ported from bcm2708-i2s driver in Raspberry Pi tree. - -RPi commit ba46b4935a23aa2caac1855ead52a035d4776680 ("ASoC: Add -support for BCM2708") - -This driver adds support for digital audio (I2S) -for the BCM2708 SoC that is used by the -Raspberry Pi. External audio codecs can be -connected to the Raspberry Pi via P5 header. - -It relies on cyclic DMA engine support for BCM2708. - -Signed-off-by: Florian Meier <florian.meier@koalo.de> - -Signed-off-by: Matthias Reichl <hias@horus.com> ---- - sound/soc/bcm/bcm2835-i2s.c | 23 ++++++++++++++++++++++- - 1 file changed, 22 insertions(+), 1 deletion(-) - -diff --git a/sound/soc/bcm/bcm2835-i2s.c b/sound/soc/bcm/bcm2835-i2s.c -index aab3df9..0e5c787 100644 ---- a/sound/soc/bcm/bcm2835-i2s.c -+++ b/sound/soc/bcm/bcm2835-i2s.c -@@ -799,6 +799,25 @@ static const struct snd_soc_component_driver bcm2835_i2s_component = { - .name = "bcm2835-i2s-comp", - }; - -+static const struct snd_pcm_hardware bcm2835_pcm_hardware = { -+ .info = SNDRV_PCM_INFO_INTERLEAVED | -+ SNDRV_PCM_INFO_JOINT_DUPLEX, -+ .formats = SNDRV_PCM_FMTBIT_S16_LE | -+ SNDRV_PCM_FMTBIT_S24_LE | -+ SNDRV_PCM_FMTBIT_S32_LE, -+ .period_bytes_min = 32, -+ .period_bytes_max = 64 * PAGE_SIZE, -+ .periods_min = 2, -+ .periods_max = 255, -+ .buffer_bytes_max = 128 * PAGE_SIZE, -+}; -+ -+static const struct snd_dmaengine_pcm_config bcm2835_dmaengine_pcm_config = { -+ .prepare_slave_config = snd_dmaengine_pcm_prepare_slave_config, -+ .pcm_hardware = &bcm2835_pcm_hardware, -+ .prealloc_buffer_size = 256 * PAGE_SIZE, -+}; -+ - static int bcm2835_i2s_probe(struct platform_device *pdev) - { - struct bcm2835_i2s_dev *dev; -@@ -870,7 +889,9 @@ static int bcm2835_i2s_probe(struct platform_device *pdev) - return ret; - } - -- ret = devm_snd_dmaengine_pcm_register(&pdev->dev, NULL, 0); -+ ret = devm_snd_dmaengine_pcm_register(&pdev->dev, -+ &bcm2835_dmaengine_pcm_config, -+ SND_DMAENGINE_PCM_FLAG_COMPAT); - if (ret) { - dev_err(&pdev->dev, "Could not register PCM: %d\n", ret); - return ret; - -From c9e2eeee4889f965a29744718bbff2de409ac649 Mon Sep 17 00:00:00 2001 -From: Matthias Reichl <hias@horus.com> -Date: Sun, 11 Oct 2015 15:55:21 +0200 -Subject: [PATCH 019/170] bcm2835-i2s: Enable MMAP support via a DT property - -Code ported from bcm2708-i2s driver in Raspberry Pi tree. - -RPi commit 7ee829fd77a30127db5d0b3c7d79b8718166e568 ("bcm2708-i2s: -Enable MMAP support via a DT property and overlay") - -The i2s driver used to claim to support MMAP, but that feature was disabled -when some problems were found. Add the ability to enable this feature -through Device Tree, using the i2s-mmap overlay. - -See: #1004 - -Signed-off-by: Matthias Reichl <hias@horus.com> ---- - sound/soc/bcm/bcm2835-i2s.c | 7 ++++++- - 1 file changed, 6 insertions(+), 1 deletion(-) - -diff --git a/sound/soc/bcm/bcm2835-i2s.c b/sound/soc/bcm/bcm2835-i2s.c -index 0e5c787..04c1d13 100644 ---- a/sound/soc/bcm/bcm2835-i2s.c -+++ b/sound/soc/bcm/bcm2835-i2s.c -@@ -799,7 +799,7 @@ static const struct snd_soc_component_driver bcm2835_i2s_component = { - .name = "bcm2835-i2s-comp", - }; - --static const struct snd_pcm_hardware bcm2835_pcm_hardware = { -+static struct snd_pcm_hardware bcm2835_pcm_hardware = { - .info = SNDRV_PCM_INFO_INTERLEAVED | - SNDRV_PCM_INFO_JOINT_DUPLEX, - .formats = SNDRV_PCM_FMTBIT_S16_LE | -@@ -835,6 +835,11 @@ static int bcm2835_i2s_probe(struct platform_device *pdev) - } - dma_reg_base = be32_to_cpup(addr); - -+ if (of_property_read_bool(pdev->dev.of_node, "brcm,enable-mmap")) -+ bcm2835_pcm_hardware.info |= -+ SNDRV_PCM_INFO_MMAP | -+ SNDRV_PCM_INFO_MMAP_VALID; -+ - /* Request both ioareas */ - for (i = 0; i <= 1; i++) { - void __iomem *base; - -From dc5b926436bccc4efbb1695ec3696b5db6746d3b Mon Sep 17 00:00:00 2001 +From 52ab2f4e1b211feaf4f5be19022bc08e5cea6ec9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= <noralf@tronnes.org> Date: Thu, 9 Apr 2015 12:34:11 +0200 -Subject: [PATCH 020/170] dmaengine: bcm2835: Add slave dma support +Subject: [PATCH 023/112] dmaengine: bcm2835: Add slave dma support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -1466,10 +1558,10 @@ index 996c4b0..b278c66 100644 +MODULE_AUTHOR("Gellert Weisz <gellert@raspberrypi.org>"); MODULE_LICENSE("GPL v2"); -From 9c6955f3fbfbb46242c63b4640886b9a0d87910a Mon Sep 17 00:00:00 2001 +From 160840d9d207155501ca02d2bc97eba91747839c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= <noralf@tronnes.org> Date: Sat, 3 Oct 2015 15:58:59 +0200 -Subject: [PATCH 021/170] dmaengine: bcm2835: set residue_granularity field +Subject: [PATCH 024/112] dmaengine: bcm2835: set residue_granularity field MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -1498,10 +1590,10 @@ index b278c66..696fb30 100644 INIT_LIST_HEAD(&od->ddev.channels); spin_lock_init(&od->lock); -From 8da7ee8d9b714dbbac842fb5ae0471b52e0393ec Mon Sep 17 00:00:00 2001 +From 84ae1b4ea9964f0152d06115b8ed12c30dbb2366 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= <noralf@tronnes.org> Date: Sat, 3 Oct 2015 22:22:55 +0200 -Subject: [PATCH 022/170] dmaengine: bcm2835: Load driver early and support +Subject: [PATCH 025/112] dmaengine: bcm2835: Load driver early and support legacy API MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -1519,7 +1611,7 @@ Signed-off-by: Noralf Trønnes <noralf@tronnes.org> 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig -index e6cd1a3..060306e 100644 +index d96d87c..4d0425c 100644 --- a/drivers/dma/Kconfig +++ b/drivers/dma/Kconfig @@ -108,7 +108,7 @@ config COH901318 @@ -1601,34 +1693,10 @@ index 696fb30..5db0a95 100644 MODULE_ALIAS("platform:bcm2835-dma"); MODULE_DESCRIPTION("BCM2835 DMA engine driver"); -From 0f3a30eb7ad7e709fdc6447c70bc3f1d5704eb63 Mon Sep 17 00:00:00 2001 -From: Matthias Reichl <hias@horus.com> -Date: Sat, 10 Oct 2015 12:29:18 +0200 -Subject: [PATCH 023/170] bcm2835-dma: Fix dreq not set for slave transfers - -Set dreq to slave_id if it is not set like in bcm2708-dmaengine. ---- - drivers/dma/bcm2835-dma.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/drivers/dma/bcm2835-dma.c b/drivers/dma/bcm2835-dma.c -index 5db0a95..fe1fd60 100644 ---- a/drivers/dma/bcm2835-dma.c -+++ b/drivers/dma/bcm2835-dma.c -@@ -657,6 +657,8 @@ static int bcm2835_dma_slave_config(struct dma_chan *chan, - } - - c->cfg = *cfg; -+ if (!c->dreq) -+ c->dreq = cfg->slave_id; - - return 0; - } - -From 305370f7caaecafbabb77b630380dbc0c436bb4c Mon Sep 17 00:00:00 2001 +From ccc5b14a95ee999444d995c565a7e631cae946dd Mon Sep 17 00:00:00 2001 From: Matthias Reichl <hias@horus.com> Date: Sun, 11 Oct 2015 12:28:30 +0200 -Subject: [PATCH 024/170] bcm2835-dma: Limit cyclic transfers on lite channels +Subject: [PATCH 026/112] bcm2835-dma: Limit cyclic transfers on lite channels to 32k Transfers larger than 32k cause repeated clicking with I2S soundcards. @@ -1639,7 +1707,7 @@ did as an intermediate fix. 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/dma/bcm2835-dma.c b/drivers/dma/bcm2835-dma.c -index fe1fd60..0adc347 100644 +index 5db0a95..6b87ce2 100644 --- a/drivers/dma/bcm2835-dma.c +++ b/drivers/dma/bcm2835-dma.c @@ -144,6 +144,12 @@ struct bcm2835_desc { @@ -1665,10 +1733,98 @@ index fe1fd60..0adc347 100644 max_size = MAX_NORMAL_TRANSFER; period_len = min(period_len, max_size); -From d801c33b7e2fb0d02ac11b95ea92b7d692286ffc Mon Sep 17 00:00:00 2001 +From 7ecbf96abab7daa1e09881d457ea72d4756037ba Mon Sep 17 00:00:00 2001 +From: Matthias Reichl <hias@horus.com> +Date: Mon, 16 Nov 2015 14:05:35 +0000 +Subject: [PATCH 027/112] bcm2835-dma: Fix up convert to DMA pool + +--- + drivers/dma/bcm2835-dma.c | 36 ++++++++++++++++++++++++++---------- + 1 file changed, 26 insertions(+), 10 deletions(-) + +diff --git a/drivers/dma/bcm2835-dma.c b/drivers/dma/bcm2835-dma.c +index 6b87ce2..d26b6bd 100644 +--- a/drivers/dma/bcm2835-dma.c ++++ b/drivers/dma/bcm2835-dma.c +@@ -488,6 +488,17 @@ static struct dma_async_tx_descriptor *bcm2835_dma_prep_dma_cyclic( + c->cyclic = true; + + return vchan_tx_prep(&c->vc, &d->vd, flags); ++error_cb: ++ i--; ++ for (; i >= 0; i--) { ++ struct bcm2835_cb_entry *cb_entry = &d->cb_list[i]; ++ ++ dma_pool_free(c->cb_pool, cb_entry->cb, cb_entry->paddr); ++ } ++ ++ kfree(d->cb_list); ++ kfree(d); ++ return NULL; + } + + static struct dma_async_tx_descriptor * +@@ -534,6 +545,7 @@ bcm2835_dma_prep_slave_sg(struct dma_chan *chan, + if (!d) + return NULL; + ++ d->c = c; + d->dir = direction; + + if (c->ch >= 8) /* LITE channel */ +@@ -553,15 +565,21 @@ bcm2835_dma_prep_slave_sg(struct dma_chan *chan, + d->frames += len / max_size + 1; + } + +- /* Allocate memory for control blocks */ +- d->control_block_size = d->frames * sizeof(struct bcm2835_dma_cb); +- d->control_block_base = dma_zalloc_coherent(chan->device->dev, +- d->control_block_size, &d->control_block_base_phys, +- GFP_NOWAIT); +- if (!d->control_block_base) { ++ d->cb_list = kcalloc(d->frames, sizeof(*d->cb_list), GFP_KERNEL); ++ if (!d->cb_list) { + kfree(d); + return NULL; + } ++ /* Allocate memory for control blocks */ ++ for (i = 0; i < d->frames; i++) { ++ struct bcm2835_cb_entry *cb_entry = &d->cb_list[i]; ++ ++ cb_entry->cb = dma_pool_zalloc(c->cb_pool, GFP_ATOMIC, ++ &cb_entry->paddr); ++ ++ if (!cb_entry->cb) ++ goto error_cb; ++ } + + /* + * Iterate over all SG entries, create a control block +@@ -578,7 +596,7 @@ bcm2835_dma_prep_slave_sg(struct dma_chan *chan, + + for (j = 0; j < len; j += max_size) { + struct bcm2835_dma_cb *control_block = +- &d->control_block_base[i + split_cnt]; ++ d->cb_list[i + split_cnt].cb; + + /* Setup addresses */ + if (d->dir == DMA_DEV_TO_MEM) { +@@ -620,9 +638,7 @@ bcm2835_dma_prep_slave_sg(struct dma_chan *chan, + if (i < sg_len - 1 || len - j > max_size) { + /* Next block is the next frame. */ + control_block->next = +- d->control_block_base_phys + +- sizeof(struct bcm2835_dma_cb) * +- (i + split_cnt + 1); ++ d->cb_list[i + split_cnt + 1].paddr; + } else { + /* Next block is empty. */ + control_block->next = 0; + +From 16a0a53f8ce5f32ac79b204ff05efd91bf770be9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= <noralf@tronnes.org> Date: Sat, 15 Aug 2015 20:50:02 +0200 -Subject: [PATCH 025/170] bcm2835: Add support for uart1 +Subject: [PATCH 028/112] bcm2835: Add support for uart1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -1682,7 +1838,7 @@ Signed-off-by: Noralf Trønnes <noralf@tronnes.org> 1 file changed, 25 insertions(+) diff --git a/arch/arm/mach-bcm/board_bcm2835.c b/arch/arm/mach-bcm/board_bcm2835.c -index 1e6f1cf9..ea36eec 100644 +index 3b68a8d..e72e522 100644 --- a/arch/arm/mach-bcm/board_bcm2835.c +++ b/arch/arm/mach-bcm/board_bcm2835.c @@ -22,6 +22,29 @@ @@ -1725,21 +1881,17 @@ index 1e6f1cf9..ea36eec 100644 static const char * const bcm2835_compat[] = { -From 5e90e32b539720ad8c6c8d7ec462378685924f22 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= <noralf@tronnes.org> -Date: Fri, 26 Jun 2015 14:21:20 +0200 -Subject: [PATCH 026/170] firmware: bcm2835: Add missing property tags -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit +From 6d0faf9fef879b1ba6ee3796d07a63fac5984151 Mon Sep 17 00:00:00 2001 +From: popcornmix <popcornmix@gmail.com> +Date: Mon, 25 Jan 2016 17:25:12 +0000 +Subject: [PATCH 029/112] firmware: Updated mailbox header -Signed-off-by: Noralf Trønnes <noralf@tronnes.org> --- - include/soc/bcm2835/raspberrypi-firmware.h | 8 ++++++++ - 1 file changed, 8 insertions(+) + include/soc/bcm2835/raspberrypi-firmware.h | 11 +++++++++++ + 1 file changed, 11 insertions(+) diff --git a/include/soc/bcm2835/raspberrypi-firmware.h b/include/soc/bcm2835/raspberrypi-firmware.h -index c07d74a..525816d 100644 +index 3fb3571..227a107 100644 --- a/include/soc/bcm2835/raspberrypi-firmware.h +++ b/include/soc/bcm2835/raspberrypi-firmware.h @@ -63,6 +63,7 @@ enum rpi_firmware_property_tag { @@ -1750,28 +1902,32 @@ index c07d74a..525816d 100644 RPI_FIRMWARE_ALLOCATE_MEMORY = 0x0003000c, RPI_FIRMWARE_LOCK_MEMORY = 0x0003000d, RPI_FIRMWARE_UNLOCK_MEMORY = 0x0003000e, -@@ -72,10 +73,12 @@ enum rpi_firmware_property_tag { +@@ -72,12 +73,15 @@ enum rpi_firmware_property_tag { RPI_FIRMWARE_SET_ENABLE_QPU = 0x00030012, RPI_FIRMWARE_GET_DISPMANX_RESOURCE_MEM_HANDLE = 0x00030014, RPI_FIRMWARE_GET_EDID_BLOCK = 0x00030020, + RPI_FIRMWARE_GET_CUSTOMER_OTP = 0x00030021, + RPI_FIRMWARE_GET_DOMAIN_STATE = 0x00030030, RPI_FIRMWARE_SET_CLOCK_STATE = 0x00038001, RPI_FIRMWARE_SET_CLOCK_RATE = 0x00038002, RPI_FIRMWARE_SET_VOLTAGE = 0x00038003, RPI_FIRMWARE_SET_TURBO = 0x00038009, + RPI_FIRMWARE_SET_CUSTOMER_OTP = 0x00038021, + RPI_FIRMWARE_SET_DOMAIN_STATE = 0x00038030, ++ RPI_FIRMWARE_SET_SDHOST_CLOCK = 0x00038042, /* Dispmanx TAGS */ RPI_FIRMWARE_FRAMEBUFFER_ALLOCATE = 0x00040001, -@@ -89,6 +92,7 @@ enum rpi_firmware_property_tag { +@@ -91,6 +95,8 @@ enum rpi_firmware_property_tag { RPI_FIRMWARE_FRAMEBUFFER_GET_VIRTUAL_OFFSET = 0x00040009, RPI_FIRMWARE_FRAMEBUFFER_GET_OVERSCAN = 0x0004000a, RPI_FIRMWARE_FRAMEBUFFER_GET_PALETTE = 0x0004000b, + RPI_FIRMWARE_FRAMEBUFFER_GET_TOUCHBUF = 0x0004000f, ++ RPI_FIRMWARE_FRAMEBUFFER_GET_GPIOVIRTBUF = 0x00040010, RPI_FIRMWARE_FRAMEBUFFER_RELEASE = 0x00048001, RPI_FIRMWARE_FRAMEBUFFER_TEST_PHYSICAL_WIDTH_HEIGHT = 0x00044003, RPI_FIRMWARE_FRAMEBUFFER_TEST_VIRTUAL_WIDTH_HEIGHT = 0x00044004, -@@ -98,6 +102,7 @@ enum rpi_firmware_property_tag { +@@ -100,6 +106,7 @@ enum rpi_firmware_property_tag { RPI_FIRMWARE_FRAMEBUFFER_TEST_VIRTUAL_OFFSET = 0x00044009, RPI_FIRMWARE_FRAMEBUFFER_TEST_OVERSCAN = 0x0004400a, RPI_FIRMWARE_FRAMEBUFFER_TEST_PALETTE = 0x0004400b, @@ -1779,21 +1935,22 @@ index c07d74a..525816d 100644 RPI_FIRMWARE_FRAMEBUFFER_SET_PHYSICAL_WIDTH_HEIGHT = 0x00048003, RPI_FIRMWARE_FRAMEBUFFER_SET_VIRTUAL_WIDTH_HEIGHT = 0x00048004, RPI_FIRMWARE_FRAMEBUFFER_SET_DEPTH = 0x00048005, -@@ -106,6 +111,9 @@ enum rpi_firmware_property_tag { +@@ -108,6 +115,10 @@ enum rpi_firmware_property_tag { RPI_FIRMWARE_FRAMEBUFFER_SET_VIRTUAL_OFFSET = 0x00048009, RPI_FIRMWARE_FRAMEBUFFER_SET_OVERSCAN = 0x0004800a, RPI_FIRMWARE_FRAMEBUFFER_SET_PALETTE = 0x0004800b, + RPI_FIRMWARE_FRAMEBUFFER_SET_VSYNC = 0x0004800e, ++ RPI_FIRMWARE_FRAMEBUFFER_SET_BACKLIGHT = 0x0004800f, + + RPI_FIRMWARE_VCHIQ_INIT = 0x00048010, RPI_FIRMWARE_GET_COMMAND_LINE = 0x00050001, RPI_FIRMWARE_GET_DMA_CHANNELS = 0x00060001, -From 894f124497e95c9af506af2ed7335857f2e71358 Mon Sep 17 00:00:00 2001 +From a29233f17de884f942e0d232deb042796dcb5788 Mon Sep 17 00:00:00 2001 From: popcornmix <popcornmix@gmail.com> Date: Sun, 12 May 2013 12:24:19 +0100 -Subject: [PATCH 027/170] Main bcm2708/bcm2709 linux port +Subject: [PATCH 030/112] Main bcm2708/bcm2709 linux port MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -1831,14 +1988,13 @@ Signed-off-by: Noralf Trønnes <noralf@tronnes.org> arch/arm/mach-bcm2709/include/mach/vc_mem.h | 35 ++ arch/arm/mach-bcm2709/include/mach/vmalloc.h | 20 ++ arch/arm/mach-bcm2709/vc_mem.c | 431 +++++++++++++++++++++++ - arch/arm/mm/Kconfig | 2 +- arch/arm/mm/proc-v6.S | 15 +- - arch/arm/mm/proc-v7.S | 1 + arch/arm/tools/mach-types | 2 + drivers/clocksource/Makefile | 2 +- drivers/irqchip/Makefile | 3 + + drivers/irqchip/irq-bcm2835.c | 3 +- include/linux/mmc/host.h | 1 + - 37 files changed, 2147 insertions(+), 5 deletions(-) + 36 files changed, 2147 insertions(+), 5 deletions(-) create mode 100644 arch/arm/mach-bcm2708/Kconfig create mode 100644 arch/arm/mach-bcm2708/Makefile create mode 100644 arch/arm/mach-bcm2708/Makefile.boot @@ -1866,11 +2022,11 @@ Signed-off-by: Noralf Trønnes <noralf@tronnes.org> create mode 100644 arch/arm/mach-bcm2709/vc_mem.c diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig -index 34e1569..8f06ea8 100644 +index cdfa6c2..aad7157 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig -@@ -317,6 +317,52 @@ choice - default ARCH_VERSATILE if !MMU +@@ -322,6 +322,52 @@ choice + default ARM_SINGLE_ARMV7M if !MMU default ARCH_MULTIPLATFORM if MMU +config ARCH_BCM2708 @@ -1922,7 +2078,7 @@ index 34e1569..8f06ea8 100644 config ARCH_MULTIPLATFORM bool "Allow multiple platforms to be selected" depends on MMU -@@ -808,6 +854,9 @@ config ARCH_VIRT +@@ -721,6 +767,9 @@ config ARCH_VIRT # Kconfigs may be included either alphabetically (according to the # plat- suffix) or along side the corresponding mach-* source. # @@ -1933,10 +2089,10 @@ index 34e1569..8f06ea8 100644 source "arch/arm/mach-alpine/Kconfig" diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug -index ddbb361..340b759 100644 +index 1098e91..e119675 100644 --- a/arch/arm/Kconfig.debug +++ b/arch/arm/Kconfig.debug -@@ -1240,6 +1240,14 @@ choice +@@ -1302,6 +1302,14 @@ choice options; the platform specific options are deprecated and will be soon removed. @@ -1952,18 +2108,18 @@ index ddbb361..340b759 100644 config DEBUG_EXYNOS_UART diff --git a/arch/arm/Makefile b/arch/arm/Makefile -index 2c2b28e..a2e7cf7 100644 +index 8c3ce2a..c4d7d10 100644 --- a/arch/arm/Makefile +++ b/arch/arm/Makefile -@@ -154,6 +154,8 @@ textofs-$(CONFIG_ARCH_AXXIA) := 0x00308000 +@@ -153,6 +153,8 @@ textofs-$(CONFIG_ARCH_AXXIA) := 0x00308000 # Machine directory name. This list is sorted alphanumerically # by CONFIG_* macro name. +machine-$(CONFIG_ARCH_BCM2708) += bcm2708 +machine-$(CONFIG_ARCH_BCM2709) += bcm2709 machine-$(CONFIG_ARCH_ALPINE) += alpine + machine-$(CONFIG_ARCH_ARTPEC) += artpec machine-$(CONFIG_ARCH_AT91) += at91 - machine-$(CONFIG_ARCH_AXXIA) += axxia diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S index 04286fd..ed82628 100644 --- a/arch/arm/kernel/head.S @@ -2693,7 +2849,7 @@ index 0000000..502c617 +#define VMALLOC_END (0xe8000000) diff --git a/arch/arm/mach-bcm2709/Kconfig b/arch/arm/mach-bcm2709/Kconfig new file mode 100644 -index 0000000..643b4b98 +index 0000000..643b4b9 --- /dev/null +++ b/arch/arm/mach-bcm2709/Kconfig @@ -0,0 +1,16 @@ @@ -4203,19 +4359,6 @@ index 0000000..d2adfd1 +module_param(phys_addr, uint, 0644); +module_param(mem_size, uint, 0644); +module_param(mem_base, uint, 0644); -diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig -index 4121886..253bed8 100644 ---- a/arch/arm/mm/Kconfig -+++ b/arch/arm/mm/Kconfig -@@ -358,7 +358,7 @@ config CPU_PJ4B - - # ARMv6 - config CPU_V6 -- bool "Support ARM V6 processor" if (!ARCH_MULTIPLATFORM || ARCH_MULTI_V6) && (ARCH_INTEGRATOR || MACH_REALVIEW_EB || MACH_REALVIEW_PBX) -+ bool "Support ARM V6 processor" if (!ARCH_MULTIPLATFORM || ARCH_MULTI_V6) && (ARCH_INTEGRATOR || MACH_REALVIEW_EB || MACH_REALVIEW_PBX || MACH_BCM2708) - select CPU_32v6 - select CPU_ABRT_EV6 - select CPU_CACHE_V6 diff --git a/arch/arm/mm/proc-v6.S b/arch/arm/mm/proc-v6.S index 06d890a..30d96e8 100644 --- a/arch/arm/mm/proc-v6.S @@ -4243,18 +4386,6 @@ index 06d890a..30d96e8 100644 ret lr ENTRY(cpu_v6_dcache_clean_area) -diff --git a/arch/arm/mm/proc-v7.S b/arch/arm/mm/proc-v7.S -index 8e1ea43..be40ccb 100644 ---- a/arch/arm/mm/proc-v7.S -+++ b/arch/arm/mm/proc-v7.S -@@ -480,6 +480,7 @@ __errata_finish: - orr r0, r0, r6 @ set them - THUMB( orr r0, r0, #1 << 30 ) @ Thumb exceptions - ret lr @ return to head.S:__ret -+ .space 256 - ENDPROC(__v7_setup) - - .align 2 diff --git a/arch/arm/tools/mach-types b/arch/arm/tools/mach-types index 2ed1b8a..b52d949 100644 --- a/arch/arm/tools/mach-types @@ -4269,7 +4400,7 @@ index 2ed1b8a..b52d949 100644 ics_if_voip MACH_ICS_IF_VOIP ICS_IF_VOIP 3206 wlf_cragg_6410 MACH_WLF_CRAGG_6410 WLF_CRAGG_6410 3207 diff --git a/drivers/clocksource/Makefile b/drivers/clocksource/Makefile -index 56bd16e..c2ac46d 100644 +index dc2b899..c38fb1a 100644 --- a/drivers/clocksource/Makefile +++ b/drivers/clocksource/Makefile @@ -19,7 +19,7 @@ obj-$(CONFIG_CLKSRC_NOMADIK_MTU) += nomadik-mtu.o @@ -4282,11 +4413,11 @@ index 56bd16e..c2ac46d 100644 obj-$(CONFIG_ARCH_ATLAS7) += timer-atlas7.o obj-$(CONFIG_ARCH_MOXART) += moxart_timer.o diff --git a/drivers/irqchip/Makefile b/drivers/irqchip/Makefile -index 177f78f..6a9e2d0 100644 +index b03cfcb..70cad6b 100644 --- a/drivers/irqchip/Makefile +++ b/drivers/irqchip/Makefile -@@ -2,6 +2,9 @@ obj-$(CONFIG_IRQCHIP) += irqchip.o - +@@ -5,6 +5,9 @@ obj-$(CONFIG_ATH79) += irq-ath79-cpu.o + obj-$(CONFIG_ATH79) += irq-ath79-misc.o obj-$(CONFIG_ARCH_BCM2835) += irq-bcm2835.o obj-$(CONFIG_ARCH_BCM2835) += irq-bcm2836.o +obj-$(CONFIG_ARCH_BCM2708) += irq-bcm2835.o @@ -4295,37 +4426,87 @@ index 177f78f..6a9e2d0 100644 obj-$(CONFIG_ARCH_EXYNOS) += exynos-combiner.o obj-$(CONFIG_ARCH_HIP04) += irq-hip04.o obj-$(CONFIG_ARCH_MMP) += irq-mmp.o +diff --git a/drivers/irqchip/irq-bcm2835.c b/drivers/irqchip/irq-bcm2835.c +index 20deb28..c02bf8a 100644 +--- a/drivers/irqchip/irq-bcm2835.c ++++ b/drivers/irqchip/irq-bcm2835.c +@@ -82,6 +82,7 @@ + #define NR_BANKS 3 + #define IRQS_PER_BANK 32 + #define NUMBER_IRQS MAKE_HWIRQ(NR_BANKS, 0) ++#undef FIQ_START + #define FIQ_START (NR_IRQS_BANK0 + MAKE_HWIRQ(NR_BANKS - 1, 0)) + + static const int reg_pending[] __initconst = { 0x00, 0x04, 0x08 }; +@@ -256,7 +257,7 @@ static int __init armctrl_of_init(struct device_node *node, + MAKE_HWIRQ(b, i) + NUMBER_IRQS); + BUG_ON(irq <= 0); + irq_set_chip(irq, &armctrl_chip); +- set_irq_flags(irq, IRQF_VALID | IRQF_PROBE); ++ irq_set_probe(irq); + } + } + init_FIQ(FIQ_START); diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h -index 8673ffe..ad22ebb 100644 +index 8dd4d29..f7fe8bd 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h -@@ -289,6 +289,7 @@ struct mmc_host { - #define MMC_CAP2_HSX00_1_2V (MMC_CAP2_HS200_1_2V_SDR | MMC_CAP2_HS400_1_2V) +@@ -291,6 +291,7 @@ struct mmc_host { #define MMC_CAP2_SDIO_IRQ_NOTHREAD (1 << 17) #define MMC_CAP2_NO_WRITE_PROTECT (1 << 18) /* No physical write protect pin, assume that card is always read-write */ + #define MMC_CAP2_NO_SDIO (1 << 19) /* Do not send SDIO commands during initialization */ +#define MMC_CAP2_FORCE_MULTIBLOCK (1 << 31) /* Always use multiblock transfers */ mmc_pm_flag_t pm_caps; /* supported pm features */ -From 74b2c26348d94949561979a9a3ad61adcac74398 Mon Sep 17 00:00:00 2001 +From 3d28cd3bfb43f8c4a9b722532c63f54823ae6136 Mon Sep 17 00:00:00 2001 +From: popcornmix <popcornmix@gmail.com> +Date: Tue, 5 Apr 2016 19:40:12 +0100 +Subject: [PATCH 031/112] reboot: Use power off rather than busy spinning when + halt is requested + +--- + arch/arm/kernel/reboot.c | 6 +----- + 1 file changed, 1 insertion(+), 5 deletions(-) + +diff --git a/arch/arm/kernel/reboot.c b/arch/arm/kernel/reboot.c +index 71a2ff9..812c15e 100644 +--- a/arch/arm/kernel/reboot.c ++++ b/arch/arm/kernel/reboot.c +@@ -102,11 +102,7 @@ void machine_shutdown(void) + */ + void machine_halt(void) + { +- local_irq_disable(); +- smp_send_stop(); +- +- local_irq_disable(); +- while (1); ++ machine_power_off(); + } + + /* + +From 9a84e16b5bda0ca0a5c55ea67e923f13fa63a172 Mon Sep 17 00:00:00 2001 From: popcornmix <popcornmix@gmail.com> Date: Wed, 11 Nov 2015 21:01:15 +0000 -Subject: [PATCH 028/170] squash: include ARCH_BCM2708 / ARCH_BCM2709 +Subject: [PATCH 032/112] squash: include ARCH_BCM2708 / ARCH_BCM2709 --- drivers/char/hw_random/Kconfig | 2 +- + drivers/clk/bcm/Makefile | 4 ++-- drivers/mailbox/Kconfig | 2 +- drivers/mailbox/bcm2835-mailbox.c | 18 ++++++++++++++++-- drivers/pinctrl/Makefile | 1 + drivers/pwm/Kconfig | 2 +- - drivers/spi/Kconfig | 2 +- + drivers/spi/Kconfig | 4 ++-- drivers/watchdog/Kconfig | 2 +- sound/soc/bcm/Kconfig | 2 +- - 8 files changed, 23 insertions(+), 8 deletions(-) + 9 files changed, 26 insertions(+), 11 deletions(-) diff --git a/drivers/char/hw_random/Kconfig b/drivers/char/hw_random/Kconfig -index dbf2271..e11e3f2 100644 +index 67ee8b0..b3ca2ee 100644 --- a/drivers/char/hw_random/Kconfig +++ b/drivers/char/hw_random/Kconfig @@ -90,7 +90,7 @@ config HW_RANDOM_BCM63XX @@ -4337,11 +4518,26 @@ index dbf2271..e11e3f2 100644 default HW_RANDOM ---help--- This driver provides kernel-side support for the Random Number +diff --git a/drivers/clk/bcm/Makefile b/drivers/clk/bcm/Makefile +index 1d79bd2..fcf1bb5 100644 +--- a/drivers/clk/bcm/Makefile ++++ b/drivers/clk/bcm/Makefile +@@ -4,8 +4,8 @@ obj-$(CONFIG_CLK_BCM_KONA) += clk-kona-setup.o + obj-$(CONFIG_CLK_BCM_KONA) += clk-bcm281xx.o + obj-$(CONFIG_CLK_BCM_KONA) += clk-bcm21664.o + obj-$(CONFIG_COMMON_CLK_IPROC) += clk-iproc-armpll.o clk-iproc-pll.o clk-iproc-asiu.o +-obj-$(CONFIG_ARCH_BCM2835) += clk-bcm2835.o +-obj-$(CONFIG_ARCH_BCM2835) += clk-bcm2835-aux.o ++obj-$(CONFIG_ARCH_BCM2835)$(CONFIG_ARCH_BCM2708)$(CONFIG_ARCH_BCM2709) += clk-bcm2835.o ++obj-$(CONFIG_ARCH_BCM2835)$(CONFIG_ARCH_BCM2708)$(CONFIG_ARCH_BCM2709) += clk-bcm2835-aux.o + obj-$(CONFIG_COMMON_CLK_IPROC) += clk-ns2.o + obj-$(CONFIG_ARCH_BCM_CYGNUS) += clk-cygnus.o + obj-$(CONFIG_ARCH_BCM_NSP) += clk-nsp.o diff --git a/drivers/mailbox/Kconfig b/drivers/mailbox/Kconfig -index 546d05f..5a045c9 100644 +index 5305923..3de0dcb 100644 --- a/drivers/mailbox/Kconfig +++ b/drivers/mailbox/Kconfig -@@ -65,7 +65,7 @@ config ALTERA_MBOX +@@ -74,7 +74,7 @@ config ALTERA_MBOX config BCM2835_MBOX tristate "BCM2835 Mailbox" @@ -4400,19 +4596,19 @@ index cfb4b44..d9c6c21 100644 MODULE_AUTHOR("Lubomir Rintel <lkundrak@v3.sk>"); MODULE_DESCRIPTION("BCM2835 mailbox IPC driver"); diff --git a/drivers/pinctrl/Makefile b/drivers/pinctrl/Makefile -index 738cb492..4fd086f 100644 +index e4bc115..d996fe7 100644 --- a/drivers/pinctrl/Makefile +++ b/drivers/pinctrl/Makefile -@@ -40,6 +40,7 @@ obj-$(CONFIG_PINCTRL_TB10X) += pinctrl-tb10x.o +@@ -35,6 +35,7 @@ obj-$(CONFIG_PINCTRL_TB10X) += pinctrl-tb10x.o obj-$(CONFIG_PINCTRL_ST) += pinctrl-st.o obj-$(CONFIG_PINCTRL_ZYNQ) += pinctrl-zynq.o +obj-$(CONFIG_ARCH_BCM2708)$(CONFIG_ARCH_BCM2709) += bcm/ obj-$(CONFIG_ARCH_BCM) += bcm/ - obj-$(CONFIG_ARCH_BERLIN) += berlin/ + obj-$(CONFIG_PINCTRL_BERLIN) += berlin/ obj-y += freescale/ diff --git a/drivers/pwm/Kconfig b/drivers/pwm/Kconfig -index 2f4641a..d5c1a5d 100644 +index c182efc..fe0f845 100644 --- a/drivers/pwm/Kconfig +++ b/drivers/pwm/Kconfig @@ -85,7 +85,7 @@ config PWM_BCM_KONA @@ -4425,23 +4621,32 @@ index 2f4641a..d5c1a5d 100644 PWM framework driver for BCM2835 controller (Raspberry Pi) diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig -index 8b9c2a3..e842e86 100644 +index 9d8c84b..2a27a37 100644 --- a/drivers/spi/Kconfig +++ b/drivers/spi/Kconfig -@@ -78,7 +78,7 @@ config SPI_ATMEL +@@ -94,7 +94,7 @@ config SPI_AXI_SPI_ENGINE config SPI_BCM2835 tristate "BCM2835 SPI controller" depends on GPIOLIB - depends on ARCH_BCM2835 || COMPILE_TEST + depends on ARCH_BCM2835 || ARCH_BCM2708 || ARCH_BCM2709 || COMPILE_TEST - depends on GPIOLIB help This selects a driver for the Broadcom BCM2835 SPI master. + +@@ -105,7 +105,7 @@ config SPI_BCM2835 + + config SPI_BCM2835AUX + tristate "BCM2835 SPI auxiliary controller" +- depends on (ARCH_BCM2835 && GPIOLIB) || COMPILE_TEST ++ depends on ((ARCH_BCM2835 || ARCH_BCM2708 || ARCH_BCM2709) && GPIOLIB) || COMPILE_TEST + help + This selects a driver for the Broadcom BCM2835 SPI aux master. + diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig -index 1c427be..3c03d17 100644 +index fb94765..8b2de7f 100644 --- a/drivers/watchdog/Kconfig +++ b/drivers/watchdog/Kconfig -@@ -1282,7 +1282,7 @@ config BCM63XX_WDT +@@ -1401,7 +1401,7 @@ config BCM63XX_WDT config BCM2835_WDT tristate "Broadcom BCM2835 hardware watchdog" @@ -4463,10 +4668,10 @@ index 6a834e1..c5070ae 100644 select REGMAP_MMIO help -From a03df8d0f93365689c718f3d1fb62695e9fffe31 Mon Sep 17 00:00:00 2001 +From 153b5f0f1f31e246cfc43ff80c07df63ca16cd31 Mon Sep 17 00:00:00 2001 From: popcornmix <popcornmix@gmail.com> Date: Wed, 1 May 2013 19:46:17 +0100 -Subject: [PATCH 029/170] Add dwc_otg driver +Subject: [PATCH 033/112] Add dwc_otg driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -4929,6 +5134,35 @@ Also add error checking on the returned irq number. Signed-off-by: Noralf Trønnes <noralf@tronnes.org> dwc_otg: Remove duplicate gadget probe/unregister function + +dwc_otg: Properly set the HFIR + +Douglas Anderson reported: + +According to the most up to date version of the dwc2 databook, the FRINT +field of the HFIR register should be programmed to: +* 125 us * (PHY clock freq for HS) - 1 +* 1000 us * (PHY clock freq for FS/LS) - 1 + +This is opposed to older versions of the doc that claimed it should be: +* 125 us * (PHY clock freq for HS) +* 1000 us * (PHY clock freq for FS/LS) + +and reported lower timing jitter on a USB analyser + +dcw_otg: trim xfer length when buffer larger than allocated size is received + +dwc_otg: Don't free qh align buffers in atomic context + +dwc_otg: Enable the hack for Split Interrupt transactions by default + +dwc_otg.fiq_fsm_mask=0xF has long been a suggestion for users with audio stutters or other USB bandwidth issues. +So far we are aware of many success stories but no failure caused by this setting. +Make it a default to learn more. + +See: https://www.raspberrypi.org/forums/viewtopic.php?f=28&t=70437 + +Signed-off-by: popcornmix <popcornmix@gmail.com> --- arch/arm/include/asm/irqflags.h | 16 +- arch/arm/kernel/fiqasm.S | 4 + @@ -4986,9 +5220,9 @@ dwc_otg: Remove duplicate gadget probe/unregister function drivers/usb/host/dwc_otg/dwc_otg_hcd.h | 862 +++ drivers/usb/host/dwc_otg/dwc_otg_hcd_ddma.c | 1132 ++++ drivers/usb/host/dwc_otg/dwc_otg_hcd_if.h | 417 ++ - drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c | 2714 ++++++++ + drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c | 2727 ++++++++ drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c | 1005 +++ - drivers/usb/host/dwc_otg/dwc_otg_hcd_queue.c | 957 +++ + drivers/usb/host/dwc_otg/dwc_otg_hcd_queue.c | 962 +++ drivers/usb/host/dwc_otg/dwc_otg_os_dep.h | 188 + drivers/usb/host/dwc_otg/dwc_otg_pcd.c | 2712 ++++++++ drivers/usb/host/dwc_otg/dwc_otg_pcd.h | 266 + @@ -5000,7 +5234,7 @@ dwc_otg: Remove duplicate gadget probe/unregister function drivers/usb/host/dwc_otg/test/dwc_otg_test.pm | 337 + drivers/usb/host/dwc_otg/test/test_mod_param.pl | 133 + drivers/usb/host/dwc_otg/test/test_sysfs.pl | 193 + - 70 files changed, 59867 insertions(+), 16 deletions(-) + 70 files changed, 59885 insertions(+), 16 deletions(-) create mode 100644 drivers/usb/gadget/file_storage.c create mode 100644 drivers/usb/host/dwc_common_port/Makefile create mode 100644 drivers/usb/host/dwc_common_port/Makefile.fbsd @@ -5107,7 +5341,7 @@ index 8dd26e1..eef4847 100644 + mov pc, r8 +ENDPROC(__FIQ_Branch) diff --git a/drivers/usb/Makefile b/drivers/usb/Makefile -index d5c57f1e..0e15a22 100644 +index dca7856..5c467de 100644 --- a/drivers/usb/Makefile +++ b/drivers/usb/Makefile @@ -7,6 +7,7 @@ @@ -5131,10 +5365,10 @@ index 358ca8d..abaac7c 100644 return i; } diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c -index 1560f3f..dd4dd69 100644 +index 1ab42bf..292a26c 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c -@@ -4967,7 +4967,7 @@ static void port_event(struct usb_hub *hub, int port1) +@@ -5044,7 +5044,7 @@ static void port_event(struct usb_hub *hub, int port1) if (portchange & USB_PORT_STAT_C_OVERCURRENT) { u16 status = 0, unused; @@ -5147,7 +5381,7 @@ diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c index 8e641b5..de3ed7d 100644 --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c -@@ -1909,6 +1909,85 @@ int usb_set_configuration(struct usb_device *dev, int configuration) +@@ -1909,6 +1909,85 @@ free_interfaces: if (cp->string == NULL && !(dev->quirks & USB_QUIRK_CONFIG_INTF_STRINGS)) cp->string = usb_cache_string(dev, cp->desc.iConfiguration); @@ -5392,7 +5626,7 @@ index a95b0c9..17b605f 100644 diff --git a/drivers/usb/gadget/file_storage.c b/drivers/usb/gadget/file_storage.c new file mode 100644 -index 0000000..a896d73f +index 0000000..a896d73 --- /dev/null +++ b/drivers/usb/gadget/file_storage.c @@ -0,0 +1,3676 @@ @@ -9073,10 +9307,10 @@ index 0000000..a896d73f +} +module_exit(fsg_cleanup); diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig -index 3bb0887..0905a86 100644 +index e9d4dde..867dc98 100644 --- a/drivers/usb/host/Kconfig +++ b/drivers/usb/host/Kconfig -@@ -735,6 +735,19 @@ config USB_HWA_HCD +@@ -753,6 +753,19 @@ config USB_HWA_HCD To compile this driver a module, choose M here: the module will be called "hwa-hc". @@ -9097,18 +9331,18 @@ index 3bb0887..0905a86 100644 tristate "i.MX21 HCD support" depends on ARM && ARCH_MXC diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile -index e7558ab..0bb50e6 100644 +index a9ddd3c..11d7761 100644 --- a/drivers/usb/host/Makefile +++ b/drivers/usb/host/Makefile -@@ -69,6 +69,8 @@ obj-$(CONFIG_USB_SL811_CS) += sl811_cs.o +@@ -73,6 +73,8 @@ obj-$(CONFIG_USB_SL811_CS) += sl811_cs.o obj-$(CONFIG_USB_U132_HCD) += u132-hcd.o obj-$(CONFIG_USB_R8A66597_HCD) += r8a66597-hcd.o obj-$(CONFIG_USB_HWA_HCD) += hwa-hc.o + +obj-$(CONFIG_USB_DWCOTG) += dwc_otg/ dwc_common_port/ obj-$(CONFIG_USB_IMX21_HCD) += imx21-hcd.o - obj-$(CONFIG_USB_FSL_MPH_DR_OF) += fsl-mph-dr-of.o - obj-$(CONFIG_USB_EHCI_FSL) += ehci-fsl.o + obj-$(CONFIG_USB_FSL_USB2) += fsl-mph-dr-of.o + obj-$(CONFIG_USB_EHCI_FSL) += fsl-mph-dr-of.o diff --git a/drivers/usb/host/dwc_common_port/Makefile b/drivers/usb/host/dwc_common_port/Makefile new file mode 100644 index 0000000..f10d466 @@ -13230,7 +13464,7 @@ index 0000000..4664684 +#endif /* DWC_LIBMODULE */ diff --git a/drivers/usb/host/dwc_common_port/dwc_common_nbsd.c b/drivers/usb/host/dwc_common_port/dwc_common_nbsd.c new file mode 100644 -index 0000000..49b07e17 +index 0000000..49b07e1 --- /dev/null +++ b/drivers/usb/host/dwc_common_port/dwc_common_nbsd.c @@ -0,0 +1,1275 @@ @@ -25757,7 +25991,7 @@ index 0000000..bbb3d32 +#endif //DWC_UTE_CFI diff --git a/drivers/usb/host/dwc_otg/dwc_otg_cfi.h b/drivers/usb/host/dwc_otg/dwc_otg_cfi.h new file mode 100644 -index 0000000..55fd337a +index 0000000..55fd337 --- /dev/null +++ b/drivers/usb/host/dwc_otg/dwc_otg_cfi.h @@ -0,0 +1,320 @@ @@ -26083,7 +26317,7 @@ index 0000000..55fd337a +#endif /* (__DWC_OTG_CFI_H__) */ diff --git a/drivers/usb/host/dwc_otg/dwc_otg_cil.c b/drivers/usb/host/dwc_otg/dwc_otg_cil.c new file mode 100644 -index 0000000..beaa8b3 +index 0000000..38abd0b --- /dev/null +++ b/drivers/usb/host/dwc_otg/dwc_otg_cil.c @@ -0,0 +1,7141 @@ @@ -29247,10 +29481,10 @@ index 0000000..beaa8b3 + clock = 48; + if (hprt0.b.prtspd == 0) + /* High speed case */ -+ return 125 * clock; ++ return 125 * clock - 1; + else + /* FS/LS case */ -+ return 1000 * clock; ++ return 1000 * clock - 1; +} + +/** @@ -37134,7 +37368,7 @@ index 0000000..ccc24e0 +#endif diff --git a/drivers/usb/host/dwc_otg/dwc_otg_driver.c b/drivers/usb/host/dwc_otg/dwc_otg_driver.c new file mode 100644 -index 0000000..95edadf +index 0000000..cb060a7 --- /dev/null +++ b/drivers/usb/host/dwc_otg/dwc_otg_driver.c @@ -0,0 +1,1757 @@ @@ -37387,7 +37621,7 @@ index 0000000..95edadf +//Bulk split-transaction NAK holdoff in microframes +uint16_t nak_holdoff = 8; + -+unsigned short fiq_fsm_mask = 0x07; ++unsigned short fiq_fsm_mask = 0x0F; + +/** + * This function shows the Driver Version. @@ -47504,10 +47738,10 @@ index 0000000..fb57db0 +#endif /* DWC_DEVICE_ONLY */ diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c b/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c new file mode 100644 -index 0000000..8db3dfc +index 0000000..e6b38ac --- /dev/null +++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c -@@ -0,0 +1,2714 @@ +@@ -0,0 +1,2727 @@ +/* ========================================================================== + * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_hcd_intr.c $ + * $Revision: #89 $ @@ -48247,6 +48481,12 @@ index 0000000..8db3dfc + DWC_OTG_HC_XFER_COMPLETE, + &short_read); + ++ if (urb->actual_length + xfer_length > urb->length) { ++ printk_once(KERN_DEBUG "dwc_otg: DEVICE:%03d : %s:%d:trimming xfer length\n", ++ hc->dev_addr, __func__, __LINE__); ++ xfer_length = urb->length - urb->actual_length; ++ } ++ + /* non DWORD-aligned buffer case handling. */ + if (hc->align_buff && xfer_length && hc->ep_is_in) { + dwc_memcpy(urb->buf + urb->actual_length, hc->qh->dw_align_buf, @@ -48933,6 +49173,13 @@ index 0000000..8db3dfc +{ + uint32_t bytes_transferred = get_actual_xfer_length(hc, hc_regs, qtd, + halt_status, NULL); ++ ++ if (urb->actual_length + bytes_transferred > urb->length) { ++ printk_once(KERN_DEBUG "dwc_otg: DEVICE:%03d : %s:%d:trimming xfer length\n", ++ hc->dev_addr, __func__, __LINE__); ++ bytes_transferred = urb->length - urb->actual_length; ++ } ++ + /* non DWORD-aligned buffer case handling. */ + if (hc->align_buff && bytes_transferred && hc->ep_is_in) { + dwc_memcpy(urb->buf + urb->actual_length, hc->qh->dw_align_buf, @@ -51235,10 +51482,10 @@ index 0000000..2ceed42 +#endif /* DWC_DEVICE_ONLY */ diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd_queue.c b/drivers/usb/host/dwc_otg/dwc_otg_hcd_queue.c new file mode 100644 -index 0000000..acd0dd7 +index 0000000..3b2a607 --- /dev/null +++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd_queue.c -@@ -0,0 +1,957 @@ +@@ -0,0 +1,962 @@ +/* ========================================================================== + * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_hcd_queue.c $ + * $Revision: #44 $ @@ -51297,6 +51544,9 @@ index 0000000..acd0dd7 +{ + dwc_otg_qtd_t *qtd, *qtd_tmp; + dwc_irqflags_t flags; ++ uint32_t buf_size = 0; ++ uint8_t *align_buf_virt = NULL; ++ dwc_dma_t align_buf_dma; + + /* Free each QTD in the QTD list */ + DWC_SPINLOCK_IRQSAVE(hcd->lock, &flags); @@ -51308,17 +51558,19 @@ index 0000000..acd0dd7 + if (hcd->core_if->dma_desc_enable) { + dwc_otg_hcd_qh_free_ddma(hcd, qh); + } else if (qh->dw_align_buf) { -+ uint32_t buf_size; + if (qh->ep_type == UE_ISOCHRONOUS) { + buf_size = 4096; + } else { + buf_size = hcd->core_if->core_params->max_transfer_size; + } -+ DWC_DMA_FREE(buf_size, qh->dw_align_buf, qh->dw_align_buf_dma); ++ align_buf_virt = qh->dw_align_buf; ++ align_buf_dma = qh->dw_align_buf_dma; + } + + DWC_FREE(qh); + DWC_SPINUNLOCK_IRQRESTORE(hcd->lock, flags); ++ if (align_buf_virt) ++ DWC_DMA_FREE(buf_size, align_buf_virt, align_buf_dma); + return; +} + @@ -55748,7 +56000,7 @@ index 0000000..c8d2e0e +#endif /* DWC_HOST_ONLY */ diff --git a/drivers/usb/host/dwc_otg/dwc_otg_pcd_intr.c b/drivers/usb/host/dwc_otg/dwc_otg_pcd_intr.c new file mode 100644 -index 0000000..c8590b52 +index 0000000..c8590b5 --- /dev/null +++ b/drivers/usb/host/dwc_otg/dwc_otg_pcd_intr.c @@ -0,0 +1,5147 @@ @@ -65445,10 +65697,10 @@ index 0000000..cdc9963 +test_main(); +0; -From 845f985818d3d9ba162ab1102da78b0e39eaedba Mon Sep 17 00:00:00 2001 +From 5eb9e2e749d68100ad84ad874d095e96f7583860 Mon Sep 17 00:00:00 2001 From: popcornmix <popcornmix@gmail.com> Date: Wed, 17 Jun 2015 17:06:34 +0100 -Subject: [PATCH 030/170] bcm2708 framebuffer driver +Subject: [PATCH 034/112] bcm2708 framebuffer driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -65524,16 +65776,16 @@ Signed-off-by: Noralf Trønnes <noralf@tronnes.org> --- drivers/video/fbdev/Kconfig | 14 + drivers/video/fbdev/Makefile | 1 + - drivers/video/fbdev/bcm2708_fb.c | 847 ++++++++++ + drivers/video/fbdev/bcm2708_fb.c | 844 ++++++++++ drivers/video/logo/logo_linux_clut224.ppm | 2483 ++++++++++------------------- - 4 files changed, 1743 insertions(+), 1602 deletions(-) + 4 files changed, 1740 insertions(+), 1602 deletions(-) create mode 100644 drivers/video/fbdev/bcm2708_fb.c diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig -index e6d16d6..0f33a78 100644 +index 983280e..ee72c3a 100644 --- a/drivers/video/fbdev/Kconfig +++ b/drivers/video/fbdev/Kconfig -@@ -224,6 +224,20 @@ config FB_TILEBLITTING +@@ -228,6 +228,20 @@ config FB_TILEBLITTING comment "Frame buffer hardware drivers" depends on FB @@ -65555,7 +65807,7 @@ index e6d16d6..0f33a78 100644 tristate "Aeroflex Gaisler framebuffer support" depends on FB && SPARC diff --git a/drivers/video/fbdev/Makefile b/drivers/video/fbdev/Makefile -index 50ed1b4..9b086ac 100644 +index 65fb150..df473d8 100644 --- a/drivers/video/fbdev/Makefile +++ b/drivers/video/fbdev/Makefile @@ -12,6 +12,7 @@ obj-$(CONFIG_FB_MACMODES) += macmodes.o @@ -65568,10 +65820,10 @@ index 50ed1b4..9b086ac 100644 obj-$(CONFIG_FB_CLPS711X) += clps711x-fb.o diff --git a/drivers/video/fbdev/bcm2708_fb.c b/drivers/video/fbdev/bcm2708_fb.c new file mode 100644 -index 0000000..a20539a +index 0000000..cae5aab --- /dev/null +++ b/drivers/video/fbdev/bcm2708_fb.c -@@ -0,0 +1,847 @@ +@@ -0,0 +1,844 @@ +/* + * linux/drivers/video/bcm2708_fb.c + * @@ -65792,9 +66044,6 @@ index 0000000..a20539a + struct fb_info *info) +{ + /* info input, var output */ -+ int yres; -+ -+ /* info input, var output */ + print_debug("bcm2708_fb_check_var info(%p) %dx%d (%dx%d), %d, %d\n", info, + info->var.xres, info->var.yres, info->var.xres_virtual, + info->var.yres_virtual, (int)info->screen_size, @@ -66420,7 +66669,7 @@ index 0000000..a20539a +MODULE_PARM_DESC(fbdepth, "Bit depth of ARM Framebuffer"); +MODULE_PARM_DESC(fbswap, "Swap order of red and blue in 24 and 32 bit modes"); diff --git a/drivers/video/logo/logo_linux_clut224.ppm b/drivers/video/logo/logo_linux_clut224.ppm -index 3c14e43..7626beb6a 100644 +index 3c14e43..7626beb 100644 --- a/drivers/video/logo/logo_linux_clut224.ppm +++ b/drivers/video/logo/logo_linux_clut224.ppm @@ -1,1604 +1,883 @@ @@ -68910,10 +69159,10 @@ index 3c14e43..7626beb6a 100644 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 -From a35139d316b78606bfdeb0f10656ba6f1729c83f Mon Sep 17 00:00:00 2001 +From e25ec90f213f3d1c6437f42059f442c84a997114 Mon Sep 17 00:00:00 2001 From: Florian Meier <florian.meier@koalo.de> Date: Fri, 22 Nov 2013 14:22:53 +0100 -Subject: [PATCH 031/170] dmaengine: Add support for BCM2708 +Subject: [PATCH 035/112] dmaengine: Add support for BCM2708 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -69070,10 +69319,10 @@ Signed-off-by: Noralf Trønnes <noralf@tronnes.org> create mode 100644 include/linux/platform_data/dma-bcm2708.h diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig -index 060306e..33e36b9 100644 +index 4d0425c..b7863f0 100644 --- a/drivers/dma/Kconfig +++ b/drivers/dma/Kconfig -@@ -470,6 +470,10 @@ config TIMB_DMA +@@ -474,6 +474,10 @@ config TIMB_DMA help Enable support for the Timberdale FPGA DMA engine. @@ -69085,7 +69334,7 @@ index 060306e..33e36b9 100644 tristate "AM33xx CPPI41 DMA support" depends on ARCH_OMAP diff --git a/drivers/dma/Makefile b/drivers/dma/Makefile -index ef9c099..e0cf5e61 100644 +index 6084127..8188c36 100644 --- a/drivers/dma/Makefile +++ b/drivers/dma/Makefile @@ -18,6 +18,7 @@ obj-$(CONFIG_AT_HDMAC) += at_hdmac.o @@ -69533,96 +69782,10 @@ index 0000000..99cc7fd + +#endif /* _PLAT_BCM2708_DMA_H */ -From 462591cf98f15614620667e93b7f8bc0da6e86da Mon Sep 17 00:00:00 2001 -From: Phil Elwell <phil@raspberrypi.org> -Date: Fri, 17 Apr 2015 19:30:22 +0100 -Subject: [PATCH 032/170] Add blk_pos parameter to mmc multi_io_quirk callback - ---- - drivers/mmc/card/block.c | 1 + - drivers/mmc/host/omap_hsmmc.c | 4 +++- - drivers/mmc/host/sh_mobile_sdhi.c | 4 +++- - drivers/mmc/host/tmio_mmc_pio.c | 4 +++- - include/linux/mmc/host.h | 4 +++- - 5 files changed, 13 insertions(+), 4 deletions(-) - -diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c -index d848616..b35f0c4 100644 ---- a/drivers/mmc/card/block.c -+++ b/drivers/mmc/card/block.c -@@ -1510,6 +1510,7 @@ static void mmc_blk_rw_rq_prep(struct mmc_queue_req *mqrq, - brq->data.blocks = card->host->ops->multi_io_quirk(card, - (rq_data_dir(req) == READ) ? - MMC_DATA_READ : MMC_DATA_WRITE, -+ blk_rq_pos(req), - brq->data.blocks); - } - -diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c -index 7fb0753..708d0fa 100644 ---- a/drivers/mmc/host/omap_hsmmc.c -+++ b/drivers/mmc/host/omap_hsmmc.c -@@ -1832,7 +1832,9 @@ static void omap_hsmmc_conf_bus_power(struct omap_hsmmc_host *host) - } - - static int omap_hsmmc_multi_io_quirk(struct mmc_card *card, -- unsigned int direction, int blk_size) -+ unsigned int direction, -+ u32 blk_pos, -+ int blk_size) - { - /* This controller can't do multiblock reads due to hw bugs */ - if (direction == MMC_DATA_READ) -diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c -index 354f4f3..4f1ccf3 100644 ---- a/drivers/mmc/host/sh_mobile_sdhi.c -+++ b/drivers/mmc/host/sh_mobile_sdhi.c -@@ -170,7 +170,9 @@ static int sh_mobile_sdhi_write16_hook(struct tmio_mmc_host *host, int addr) - } - - static int sh_mobile_sdhi_multi_io_quirk(struct mmc_card *card, -- unsigned int direction, int blk_size) -+ unsigned int direction, -+ u32 blk_pos, -+ int blk_size) - { - /* - * In Renesas controllers, when performing a -diff --git a/drivers/mmc/host/tmio_mmc_pio.c b/drivers/mmc/host/tmio_mmc_pio.c -index a10fde4..7b730d8 100644 ---- a/drivers/mmc/host/tmio_mmc_pio.c -+++ b/drivers/mmc/host/tmio_mmc_pio.c -@@ -1003,7 +1003,9 @@ static int tmio_mmc_get_ro(struct mmc_host *mmc) - } - - static int tmio_multi_io_quirk(struct mmc_card *card, -- unsigned int direction, int blk_size) -+ unsigned int direction, -+ u32 blk_pos, -+ int blk_size) - { - struct tmio_mmc_host *host = mmc_priv(card->host); - -diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h -index ad22ebb..105b3e6 100644 ---- a/include/linux/mmc/host.h -+++ b/include/linux/mmc/host.h -@@ -143,7 +143,9 @@ struct mmc_host_ops { - * I/O. Returns the number of supported blocks for the request. - */ - int (*multi_io_quirk)(struct mmc_card *card, -- unsigned int direction, int blk_size); -+ unsigned int direction, -+ u32 blk_pos, -+ int blk_size); - }; - - struct mmc_card; - -From 3d0ca77d187abbbde572f4a73b1f864ffb8b5d8a Mon Sep 17 00:00:00 2001 +From 786f8c7793b58831efa8e1ffe5a02723842d3728 Mon Sep 17 00:00:00 2001 From: gellert <gellert@raspberrypi.org> Date: Fri, 15 Aug 2014 16:35:06 +0100 -Subject: [PATCH 033/170] MMC: added alternative MMC driver +Subject: [PATCH 036/112] MMC: added alternative MMC driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -69688,39 +69851,59 @@ In non-DT mode, don't add the device in the board file. Signed-off-by: Noralf Trønnes <noralf@tronnes.org> bcm2835-mmc: Don't overwrite MMC capabilities from DT + +bcm2835-mmc: Don't override bus width capabilities from devicetree + +Take out the force setting of the MMC_CAP_4_BIT_DATA host capability +so that the result read from devicetree via mmc_of_parse() is +preserved. + +bcm2835-mmc: Only claim one DMA channel + +With both MMC controllers enabled there are few DMA channels left. The +bcm2835-mmc driver only uses DMA in one direction at a time, so it +doesn't need to claim two channels. + +See: https://github.com/raspberrypi/linux/issues/1327 + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> --- - drivers/mmc/core/quirks.c | 6 + + drivers/mmc/core/quirks.c | 10 + drivers/mmc/host/Kconfig | 29 + drivers/mmc/host/Makefile | 1 + - drivers/mmc/host/bcm2835-mmc.c | 1542 ++++++++++++++++++++++++++++++++++++++++ - 4 files changed, 1578 insertions(+) + drivers/mmc/host/bcm2835-mmc.c | 1571 ++++++++++++++++++++++++++++++++++++++++ + 4 files changed, 1611 insertions(+) create mode 100644 drivers/mmc/host/bcm2835-mmc.c diff --git a/drivers/mmc/core/quirks.c b/drivers/mmc/core/quirks.c -index fad660b..87ae2e9 100644 +index fad660b..b79fe14 100644 --- a/drivers/mmc/core/quirks.c +++ b/drivers/mmc/core/quirks.c -@@ -53,6 +53,7 @@ static const struct mmc_fixup mmc_fixup_methods[] = { +@@ -53,6 +53,9 @@ static const struct mmc_fixup mmc_fixup_methods[] = { void mmc_fixup_device(struct mmc_card *card, const struct mmc_fixup *table) { ++#ifdef CONFIG_MMC_BCM2835 + extern unsigned mmc_debug; ++#endif const struct mmc_fixup *f; u64 rev = cid_rev_card(card); -@@ -77,5 +78,10 @@ void mmc_fixup_device(struct mmc_card *card, const struct mmc_fixup *table) +@@ -77,5 +80,12 @@ void mmc_fixup_device(struct mmc_card *card, const struct mmc_fixup *table) f->vendor_fixup(card, f->data); } } + /* SDHCI on BCM2708 - bug causes a certain sequence of CMD23 operations to fail. + * Disable this flag for all cards (fall-back to CMD25/CMD18 multi-block transfers). + */ ++#ifdef CONFIG_MMC_BCM2835 + if (mmc_debug & (1<<13)) + card->quirks |= MMC_QUIRK_BLK_NO_CMD23; ++#endif } EXPORT_SYMBOL(mmc_fixup_device); diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig -index 1dee533..9b72d2c 100644 +index e657af0..0476061 100644 --- a/drivers/mmc/host/Kconfig +++ b/drivers/mmc/host/Kconfig @@ -4,6 +4,35 @@ @@ -69760,7 +69943,7 @@ index 1dee533..9b72d2c 100644 tristate "ARM AMBA Multimedia Card Interface support" depends on ARM_AMBA diff --git a/drivers/mmc/host/Makefile b/drivers/mmc/host/Makefile -index 3595f83..6cf6457 100644 +index af918d2..3ba94f0 100644 --- a/drivers/mmc/host/Makefile +++ b/drivers/mmc/host/Makefile @@ -18,6 +18,7 @@ obj-$(CONFIG_MMC_SDHCI_S3C) += sdhci-s3c.o @@ -69773,10 +69956,10 @@ index 3595f83..6cf6457 100644 obj-$(CONFIG_MMC_MTK) += mtk-sd.o diff --git a/drivers/mmc/host/bcm2835-mmc.c b/drivers/mmc/host/bcm2835-mmc.c new file mode 100644 -index 0000000..43aed6e +index 0000000..ceb3793 --- /dev/null +++ b/drivers/mmc/host/bcm2835-mmc.c -@@ -0,0 +1,1542 @@ +@@ -0,0 +1,1571 @@ +/* + * BCM2835 MMC host driver. + * @@ -69887,8 +70070,9 @@ index 0000000..43aed6e + u32 shadow; + + /*DMA part*/ -+ struct dma_chan *dma_chan_rx; /* DMA channel for reads */ -+ struct dma_chan *dma_chan_tx; /* DMA channel for writes */ ++ struct dma_chan *dma_chan_rxtx; /* DMA channel for reads and writes */ ++ struct dma_slave_config dma_cfg_rx; ++ struct dma_slave_config dma_cfg_tx; + struct dma_async_tx_descriptor *tx_desc; /* descriptor */ + + bool have_dma; @@ -70121,7 +70305,7 @@ index 0000000..43aed6e + + if (host->data && !(host->data->flags & MMC_DATA_WRITE)) { + /* otherwise handled in SDHCI IRQ */ -+ dma_chan = host->dma_chan_rx; ++ dma_chan = host->dma_chan_rxtx; + dir_data = DMA_FROM_DEVICE; + + dma_unmap_sg(dma_chan->device->dev, @@ -70272,16 +70456,21 @@ index 0000000..43aed6e + if (host->blocks == 0) + return; + ++ dma_chan = host->dma_chan_rxtx; + if (host->data->flags & MMC_DATA_READ) { -+ dma_chan = host->dma_chan_rx; + dir_data = DMA_FROM_DEVICE; + dir_slave = DMA_DEV_TO_MEM; + } else { -+ dma_chan = host->dma_chan_tx; + dir_data = DMA_TO_DEVICE; + dir_slave = DMA_MEM_TO_DEV; + } + ++ /* The parameters have already been validated, so this will not fail */ ++ (void)dmaengine_slave_config(dma_chan, ++ (dir_data == DMA_FROM_DEVICE) ? ++ &host->dma_cfg_rx : ++ &host->dma_cfg_tx); ++ + BUG_ON(!dma_chan->device); + BUG_ON(!dma_chan->device->dev); + BUG_ON(!host->data->sg); @@ -70715,7 +70904,7 @@ index 0000000..43aed6e + if (host->data->flags & MMC_DATA_WRITE) { + /* IRQ handled here */ + -+ dma_chan = host->dma_chan_tx; ++ dma_chan = host->dma_chan_rxtx; + dir_data = DMA_TO_DEVICE; + dma_unmap_sg(dma_chan->device->dev, + host->data->sg, host->data->sg_len, @@ -71084,7 +71273,7 @@ index 0000000..43aed6e + /* host controller capabilities */ + mmc->caps |= MMC_CAP_CMD23 | MMC_CAP_ERASE | MMC_CAP_NEEDS_POLL | + MMC_CAP_SDIO_IRQ | MMC_CAP_SD_HIGHSPEED | -+ MMC_CAP_MMC_HIGHSPEED | MMC_CAP_4_BIT_DATA; ++ MMC_CAP_MMC_HIGHSPEED; + + mmc->caps2 |= MMC_CAP2_SDIO_IRQ_NOTHREAD; + @@ -71095,28 +71284,47 @@ index 0000000..43aed6e + dev_info(dev, "Forcing PIO mode\n"); + host->have_dma = false; +#else -+ if (IS_ERR_OR_NULL(host->dma_chan_tx) || -+ IS_ERR_OR_NULL(host->dma_chan_rx)) { -+ dev_err(dev, "%s: Unable to initialise DMA channels. Falling back to PIO\n", ++ if (IS_ERR_OR_NULL(host->dma_chan_rxtx)) { ++ dev_err(dev, "%s: Unable to initialise DMA channel. Falling back to PIO\n", + DRIVER_NAME); + host->have_dma = false; + } else { -+ dev_info(dev, "DMA channels allocated"); -+ host->have_dma = true; ++ dev_info(dev, "DMA channel allocated"); + + cfg.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; + cfg.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; + cfg.slave_id = 11; /* DREQ channel */ + ++ /* Validate the slave configurations */ ++ + cfg.direction = DMA_MEM_TO_DEV; + cfg.src_addr = 0; + cfg.dst_addr = host->bus_addr + SDHCI_BUFFER; -+ ret = dmaengine_slave_config(host->dma_chan_tx, &cfg); + -+ cfg.direction = DMA_DEV_TO_MEM; -+ cfg.src_addr = host->bus_addr + SDHCI_BUFFER; -+ cfg.dst_addr = 0; -+ ret = dmaengine_slave_config(host->dma_chan_rx, &cfg); ++ ret = dmaengine_slave_config(host->dma_chan_rxtx, &cfg); ++ ++ if (ret == 0) { ++ host->dma_cfg_tx = cfg; ++ ++ cfg.direction = DMA_DEV_TO_MEM; ++ cfg.src_addr = host->bus_addr + SDHCI_BUFFER; ++ cfg.dst_addr = 0; ++ ++ ret = dmaengine_slave_config(host->dma_chan_rxtx, &cfg); ++ } ++ ++ if (ret == 0) { ++ host->dma_cfg_rx = cfg; ++ ++ host->use_dma = true; ++ } else { ++ pr_err("%s: unable to configure DMA channel. " ++ "Faling back to PIO\n", ++ mmc_hostname(mmc)); ++ dma_release_channel(host->dma_chan_rxtx); ++ host->dma_chan_rxtx = NULL; ++ host->use_dma = false; ++ } + } +#endif + mmc->max_segs = 128; @@ -71195,16 +71403,20 @@ index 0000000..43aed6e + +#ifndef FORCE_PIO + if (node) { -+ host->dma_chan_tx = dma_request_slave_channel(dev, "tx"); -+ host->dma_chan_rx = dma_request_slave_channel(dev, "rx"); ++ host->dma_chan_rxtx = dma_request_slave_channel(dev, "rx-tx"); ++ if (!host->dma_chan_rxtx) ++ host->dma_chan_rxtx = ++ dma_request_slave_channel(dev, "tx"); ++ if (!host->dma_chan_rxtx) ++ host->dma_chan_rxtx = ++ dma_request_slave_channel(dev, "rx"); + } else { + dma_cap_mask_t mask; + + dma_cap_zero(mask); + /* we don't care about the channel, any would work */ + dma_cap_set(DMA_SLAVE, mask); -+ host->dma_chan_tx = dma_request_channel(mask, NULL, NULL); -+ host->dma_chan_rx = dma_request_channel(mask, NULL, NULL); ++ host->dma_chan_rxtx = dma_request_channel(mask, NULL, NULL); + } +#endif + clk = devm_clk_get(dev, NULL); @@ -71320,10 +71532,10 @@ index 0000000..43aed6e +MODULE_LICENSE("GPL v2"); +MODULE_AUTHOR("Gellert Weisz"); -From 756bf8b8f081be45e16d4d58d3fbe2ca073df298 Mon Sep 17 00:00:00 2001 +From 56c375164a7120be703d11e3614f78b3e5cb784d Mon Sep 17 00:00:00 2001 From: Phil Elwell <phil@raspberrypi.org> Date: Wed, 25 Mar 2015 17:49:47 +0000 -Subject: [PATCH 034/170] Adding bcm2835-sdhost driver, and an overlay to +Subject: [PATCH 037/112] Adding bcm2835-sdhost driver, and an overlay to enable it BCM2835 has two SD card interfaces. This driver uses the other one. @@ -71396,15 +71608,86 @@ The MMC card-discovery process generates timeouts. This is expected behaviour, so reporting it to the user serves no purpose. Suppress the reporting of timeout errors unless the debug flag is on. + +bcm2835-sdhost: Add workaround for odd behaviour on some cards + +For reasons not understood, the sdhost driver fails when reading +sectors very near the end of some SD cards. The problem could +be related to the similar issue that reading the final sector +of any card as part of a multiple read never completes, and the +workaround is an extension of the mechanism introduced to solve +that problem which ensures those sectors are always read singly. + +bcm2835-sdhost: Major revision + +This is a significant revision of the bcm2835-sdhost driver. It +improves on the original in a number of ways: + +1) Through the use of CMD23 for reads it appears to avoid problems + reading some sectors on certain high speed cards. +2) Better atomicity to prevent crashes. +3) Higher performance. +4) Activity logging included, for easier diagnosis in the event + of a problem. + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> + +bcm2835-sdhost: Restore ATOMIC flag to PIO sg mapping + +Allocation problems have been seen in a wireless driver, and +this is the only change which might have been responsible. + +SQUASH: bcm2835-sdhost: Only claim one DMA channel + +With both MMC controllers enabled there are few DMA channels left. The +bcm2835-sdhost driver only uses DMA in one direction at a time, so it +doesn't need to claim two channels. + +See: https://github.com/raspberrypi/linux/issues/1327 + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> + +bcm2835-sdhost: Workaround for "slow" sectors + +Some cards have been seen to cause timeouts after certain sectors are +read. This workaround enforces a minimum delay between the stop after +reading one of those sectors and a subsequent data command. + +Using CMD23 (SET_BLOCK_COUNT) avoids this problem, so good cards will +not be penalised by this workaround. + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> + +bcm2835-sdhost: Firmware manages the clock divisor + +The bcm2835-sdhost driver hands control of the CDIV clock divisor +register to matching firmware, allowing it to adjust to a changing +core clock. This removes the need to use the performance governor or +to enable io_is_busy on the on-demand governor in order to get the +best SD performance. + +N.B. As SD clocks must be an integer divisor of the core clock, it is +possible that the SD clock for "turbo" mode can be different (even +lower) than "normal" mode. + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> + +bcm2835-sdhost: Reset the clock in task context + +Since reprogramming the clock can now involve a round-trip to the +firmware it must not be done at atomic context, and a tasklet +is not a task. + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> --- drivers/mmc/host/Kconfig | 10 + drivers/mmc/host/Makefile | 1 + - drivers/mmc/host/bcm2835-sdhost.c | 1907 +++++++++++++++++++++++++++++++++++++ - 3 files changed, 1918 insertions(+) + drivers/mmc/host/bcm2835-sdhost.c | 2158 +++++++++++++++++++++++++++++++++++++ + 3 files changed, 2169 insertions(+) create mode 100644 drivers/mmc/host/bcm2835-sdhost.c diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig -index 9b72d2c..d509d10 100644 +index 0476061..2595474 100644 --- a/drivers/mmc/host/Kconfig +++ b/drivers/mmc/host/Kconfig @@ -33,6 +33,16 @@ config MMC_BCM2835_PIO_DMA_BARRIER @@ -71425,7 +71708,7 @@ index 9b72d2c..d509d10 100644 tristate "ARM AMBA Multimedia Card Interface support" depends on ARM_AMBA diff --git a/drivers/mmc/host/Makefile b/drivers/mmc/host/Makefile -index 6cf6457..df27ae9 100644 +index 3ba94f0..8daaa94 100644 --- a/drivers/mmc/host/Makefile +++ b/drivers/mmc/host/Makefile @@ -18,6 +18,7 @@ obj-$(CONFIG_MMC_SDHCI_S3C) += sdhci-s3c.o @@ -71438,15 +71721,15 @@ index 6cf6457..df27ae9 100644 obj-$(CONFIG_MMC_AU1X) += au1xmmc.o diff --git a/drivers/mmc/host/bcm2835-sdhost.c b/drivers/mmc/host/bcm2835-sdhost.c new file mode 100644 -index 0000000..da089985 +index 0000000..a57faed --- /dev/null +++ b/drivers/mmc/host/bcm2835-sdhost.c -@@ -0,0 +1,1907 @@ +@@ -0,0 +1,2158 @@ +/* + * BCM2835 SD host driver. + * + * Author: Phil Elwell <phil@raspberrypi.org> -+ * Copyright 2015 ++ * Copyright (C) 2015-2016 Raspberry Pi (Trading) Ltd. + * + * Based on + * mmc-bcm2835.c by Gellert Weisz @@ -71468,12 +71751,13 @@ index 0000000..da089985 + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + -+#define SAFE_READ_THRESHOLD 4 -+#define SAFE_WRITE_THRESHOLD 4 -+#define ALLOW_DMA 1 -+#define ALLOW_CMD23 0 -+#define ALLOW_FAST 1 -+#define USE_BLOCK_IRQ 1 ++#define FIFO_READ_THRESHOLD 4 ++#define FIFO_WRITE_THRESHOLD 4 ++#define ALLOW_CMD23_READ 1 ++#define ALLOW_CMD23_WRITE 0 ++#define ENABLE_LOG 1 ++#define SDDATA_FIFO_PIO_BURST 8 ++#define CMD_DALLY_US 1 + +#include <linux/delay.h> +#include <linux/module.h> @@ -71492,6 +71776,8 @@ index 0000000..da089985 +#include <linux/dma-mapping.h> +#include <linux/of_dma.h> +#include <linux/time.h> ++#include <linux/workqueue.h> ++#include <soc/bcm2835/raspberrypi-firmware.h> + +#define DRIVER_NAME "sdhost-bcm2835" + @@ -71554,6 +71840,28 @@ index 0000000..da089985 +#define SDEDM_READ_THRESHOLD_SHIFT 14 +#define SDEDM_THRESHOLD_MASK 0x1f + ++#define SDEDM_FSM_MASK 0xf ++#define SDEDM_FSM_IDENTMODE 0x0 ++#define SDEDM_FSM_DATAMODE 0x1 ++#define SDEDM_FSM_READDATA 0x2 ++#define SDEDM_FSM_WRITEDATA 0x3 ++#define SDEDM_FSM_READWAIT 0x4 ++#define SDEDM_FSM_READCRC 0x5 ++#define SDEDM_FSM_WRITECRC 0x6 ++#define SDEDM_FSM_WRITEWAIT1 0x7 ++#define SDEDM_FSM_POWERDOWN 0x8 ++#define SDEDM_FSM_POWERUP 0x9 ++#define SDEDM_FSM_WRITESTART1 0xa ++#define SDEDM_FSM_WRITESTART2 0xb ++#define SDEDM_FSM_GENPULSES 0xc ++#define SDEDM_FSM_WRITEWAIT2 0xd ++#define SDEDM_FSM_STARTPOWDOWN 0xf ++ ++#define SDDATA_FIFO_WORDS 16 ++ ++#define USE_CMD23_FLAGS ((ALLOW_CMD23_READ * MMC_DATA_READ) | \ ++ (ALLOW_CMD23_WRITE * MMC_DATA_WRITE)) ++ +#define MHZ 1000000 + + @@ -71575,15 +71883,17 @@ index 0000000..da089985 + + struct tasklet_struct finish_tasklet; /* Tasklet structures */ + -+ struct timer_list timer; /* Timer for timeouts */ ++ struct work_struct cmd_wait_wq; /* Workqueue function */ + -+ struct timer_list pio_timer; /* PIO error detection timer */ ++ struct timer_list timer; /* Timer for timeouts */ + + struct sg_mapping_iter sg_miter; /* SG state for PIO */ + unsigned int blocks; /* remaining PIO blocks */ + + int irq; /* Device IRQ */ + ++ u32 cmd_quick_poll_retries; ++ u32 ns_per_fifo_word; + + /* cached registers */ + u32 hcfg; @@ -71598,27 +71908,128 @@ index 0000000..da089985 + + unsigned int use_busy:1; /* Wait for busy interrupt */ + -+ unsigned int debug:1; /* Enable debug output */ ++ unsigned int use_sbc:1; /* Send CMD23 */ + -+ u32 thread_isr; ++ unsigned int debug:1; /* Enable debug output */ ++ unsigned int firmware_sets_cdiv:1; /* Let the firmware manage the clock */ ++ unsigned int reset_clock:1; /* Reset the clock fore the next request */ + + /*DMA part*/ -+ struct dma_chan *dma_chan_rx; /* DMA channel for reads */ -+ struct dma_chan *dma_chan_tx; /* DMA channel for writes */ ++ struct dma_chan *dma_chan_rxtx; /* DMA channel for reads and writes */ ++ struct dma_chan *dma_chan; /* Channel in use */ ++ struct dma_slave_config dma_cfg_rx; ++ struct dma_slave_config dma_cfg_tx; ++ struct dma_async_tx_descriptor *dma_desc; ++ u32 dma_dir; ++ u32 drain_words; ++ struct page *drain_page; ++ u32 drain_offset; + + bool allow_dma; -+ bool have_dma; + bool use_dma; + /*end of DMA part*/ + + int max_delay; /* maximum length of time spent waiting */ + struct timeval stop_time; /* when the last stop was issued */ + u32 delay_after_stop; /* minimum time between stop and subsequent data transfer */ ++ u32 delay_after_this_stop; /* minimum time between this stop and subsequent data transfer */ + u32 overclock_50; /* frequency to use when 50MHz is requested (in MHz) */ + u32 overclock; /* Current frequency if overclocked, else zero */ + u32 pio_limit; /* Maximum block count for PIO (0 = always DMA) */ ++ ++ u32 sectors; /* Cached card size in sectors */ +}; + ++#if ENABLE_LOG ++ ++struct log_entry_struct { ++ char event[4]; ++ u32 timestamp; ++ u32 param1; ++ u32 param2; ++}; ++ ++typedef struct log_entry_struct LOG_ENTRY_T; ++ ++LOG_ENTRY_T *sdhost_log_buf; ++dma_addr_t sdhost_log_addr; ++static u32 sdhost_log_idx; ++static spinlock_t log_lock; ++static void __iomem *timer_base; ++ ++#define LOG_ENTRIES (256*1) ++#define LOG_SIZE (sizeof(LOG_ENTRY_T)*LOG_ENTRIES) ++ ++static void log_init(u32 bus_to_phys) ++{ ++ spin_lock_init(&log_lock); ++ sdhost_log_buf = dma_zalloc_coherent(NULL, LOG_SIZE, &sdhost_log_addr, ++ GFP_KERNEL); ++ if (sdhost_log_buf) { ++ pr_info("sdhost: log_buf @ %p (%x)\n", ++ sdhost_log_buf, sdhost_log_addr); ++ timer_base = ioremap_nocache(bus_to_phys + 0x7e003000, SZ_4K); ++ if (!timer_base) ++ pr_err("sdhost: failed to remap timer\n"); ++ } ++ else ++ pr_err("sdhost: failed to allocate log buf\n"); ++} ++ ++static void log_event_impl(const char *event, u32 param1, u32 param2) ++{ ++ if (sdhost_log_buf) { ++ LOG_ENTRY_T *entry; ++ unsigned long flags; ++ ++ spin_lock_irqsave(&log_lock, flags); ++ ++ entry = sdhost_log_buf + sdhost_log_idx; ++ memcpy(entry->event, event, 4); ++ entry->timestamp = (readl(timer_base + 4) & 0x3fffffff) + ++ (smp_processor_id()<<30); ++ entry->param1 = param1; ++ entry->param2 = param2; ++ sdhost_log_idx = (sdhost_log_idx + 1) % LOG_ENTRIES; ++ ++ spin_unlock_irqrestore(&log_lock, flags); ++ } ++} ++ ++static void log_dump(void) ++{ ++ if (sdhost_log_buf) { ++ LOG_ENTRY_T *entry; ++ unsigned long flags; ++ int idx; ++ ++ spin_lock_irqsave(&log_lock, flags); ++ ++ idx = sdhost_log_idx; ++ do { ++ entry = sdhost_log_buf + idx; ++ if (entry->event[0] != '\0') ++ pr_err("[%08x] %.4s %x %x\n", ++ entry->timestamp, ++ entry->event, ++ entry->param1, ++ entry->param2); ++ idx = (idx + 1) % LOG_ENTRIES; ++ } while (idx != sdhost_log_idx); ++ ++ spin_unlock_irqrestore(&log_lock, flags); ++ } ++} ++ ++#define log_event(event, param1, param2) log_event_impl(event, param1, param2) ++ ++#else ++ ++#define log_init(x) (void)0 ++#define log_event(event, param1, param2) (void)0 ++#define log_dump() (void)0 ++ ++#endif + +static inline void bcm2835_sdhost_write(struct bcm2835_host *host, u32 val, int reg) +{ @@ -71640,7 +72051,7 @@ index 0000000..da089985 + const char *label) +{ + if (cmd) -+ pr_info("%s:%c%s op %d arg 0x%x flags 0x%x - resp %08x %08x %08x %08x, err %d\n", ++ pr_err("%s:%c%s op %d arg 0x%x flags 0x%x - resp %08x %08x %08x %08x, err %d\n", + mmc_hostname(host->mmc), + (cmd == host->cmd) ? '>' : ' ', + label, cmd->opcode, cmd->arg, cmd->flags, @@ -71650,77 +72061,81 @@ index 0000000..da089985 + +static void bcm2835_sdhost_dumpregs(struct bcm2835_host *host) +{ -+ bcm2835_sdhost_dumpcmd(host, host->mrq->sbc, "sbc"); -+ bcm2835_sdhost_dumpcmd(host, host->mrq->cmd, "cmd"); -+ if (host->mrq->data) -+ pr_err("%s: data blocks %x blksz %x - err %d\n", -+ mmc_hostname(host->mmc), -+ host->mrq->data->blocks, -+ host->mrq->data->blksz, -+ host->mrq->data->error); -+ bcm2835_sdhost_dumpcmd(host, host->mrq->stop, "stop"); ++ if (host->mrq) ++ { ++ bcm2835_sdhost_dumpcmd(host, host->mrq->sbc, "sbc"); ++ bcm2835_sdhost_dumpcmd(host, host->mrq->cmd, "cmd"); ++ if (host->mrq->data) ++ pr_err("%s: data blocks %x blksz %x - err %d\n", ++ mmc_hostname(host->mmc), ++ host->mrq->data->blocks, ++ host->mrq->data->blksz, ++ host->mrq->data->error); ++ bcm2835_sdhost_dumpcmd(host, host->mrq->stop, "stop"); ++ } + -+ pr_info("%s: =========== REGISTER DUMP ===========\n", ++ pr_err("%s: =========== REGISTER DUMP ===========\n", + mmc_hostname(host->mmc)); + -+ pr_info("%s: SDCMD 0x%08x\n", ++ pr_err("%s: SDCMD 0x%08x\n", + mmc_hostname(host->mmc), + bcm2835_sdhost_read(host, SDCMD)); -+ pr_info("%s: SDARG 0x%08x\n", ++ pr_err("%s: SDARG 0x%08x\n", + mmc_hostname(host->mmc), + bcm2835_sdhost_read(host, SDARG)); -+ pr_info("%s: SDTOUT 0x%08x\n", ++ pr_err("%s: SDTOUT 0x%08x\n", + mmc_hostname(host->mmc), + bcm2835_sdhost_read(host, SDTOUT)); -+ pr_info("%s: SDCDIV 0x%08x\n", ++ pr_err("%s: SDCDIV 0x%08x\n", + mmc_hostname(host->mmc), + bcm2835_sdhost_read(host, SDCDIV)); -+ pr_info("%s: SDRSP0 0x%08x\n", ++ pr_err("%s: SDRSP0 0x%08x\n", + mmc_hostname(host->mmc), + bcm2835_sdhost_read(host, SDRSP0)); -+ pr_info("%s: SDRSP1 0x%08x\n", ++ pr_err("%s: SDRSP1 0x%08x\n", + mmc_hostname(host->mmc), + bcm2835_sdhost_read(host, SDRSP1)); -+ pr_info("%s: SDRSP2 0x%08x\n", ++ pr_err("%s: SDRSP2 0x%08x\n", + mmc_hostname(host->mmc), + bcm2835_sdhost_read(host, SDRSP2)); -+ pr_info("%s: SDRSP3 0x%08x\n", ++ pr_err("%s: SDRSP3 0x%08x\n", + mmc_hostname(host->mmc), + bcm2835_sdhost_read(host, SDRSP3)); -+ pr_info("%s: SDHSTS 0x%08x\n", ++ pr_err("%s: SDHSTS 0x%08x\n", + mmc_hostname(host->mmc), + bcm2835_sdhost_read(host, SDHSTS)); -+ pr_info("%s: SDVDD 0x%08x\n", ++ pr_err("%s: SDVDD 0x%08x\n", + mmc_hostname(host->mmc), + bcm2835_sdhost_read(host, SDVDD)); -+ pr_info("%s: SDEDM 0x%08x\n", ++ pr_err("%s: SDEDM 0x%08x\n", + mmc_hostname(host->mmc), + bcm2835_sdhost_read(host, SDEDM)); -+ pr_info("%s: SDHCFG 0x%08x\n", ++ pr_err("%s: SDHCFG 0x%08x\n", + mmc_hostname(host->mmc), + bcm2835_sdhost_read(host, SDHCFG)); -+ pr_info("%s: SDHBCT 0x%08x\n", ++ pr_err("%s: SDHBCT 0x%08x\n", + mmc_hostname(host->mmc), + bcm2835_sdhost_read(host, SDHBCT)); -+ pr_info("%s: SDHBLC 0x%08x\n", ++ pr_err("%s: SDHBLC 0x%08x\n", + mmc_hostname(host->mmc), + bcm2835_sdhost_read(host, SDHBLC)); + -+ pr_info("%s: ===========================================\n", ++ pr_err("%s: ===========================================\n", + mmc_hostname(host->mmc)); +} + -+ +static void bcm2835_sdhost_set_power(struct bcm2835_host *host, bool on) +{ + bcm2835_sdhost_write(host, on ? 1 : 0, SDVDD); +} + -+ +static void bcm2835_sdhost_reset_internal(struct bcm2835_host *host) +{ + u32 temp; + ++ if (host->debug) ++ pr_info("%s: reset\n", mmc_hostname(host->mmc)); ++ + bcm2835_sdhost_set_power(host, false); + + bcm2835_sdhost_write(host, 0, SDCMD); @@ -71736,26 +72151,25 @@ index 0000000..da089985 + temp = bcm2835_sdhost_read(host, SDEDM); + temp &= ~((SDEDM_THRESHOLD_MASK<<SDEDM_READ_THRESHOLD_SHIFT) | + (SDEDM_THRESHOLD_MASK<<SDEDM_WRITE_THRESHOLD_SHIFT)); -+ temp |= (SAFE_READ_THRESHOLD << SDEDM_READ_THRESHOLD_SHIFT) | -+ (SAFE_WRITE_THRESHOLD << SDEDM_WRITE_THRESHOLD_SHIFT); ++ temp |= (FIFO_READ_THRESHOLD << SDEDM_READ_THRESHOLD_SHIFT) | ++ (FIFO_WRITE_THRESHOLD << SDEDM_WRITE_THRESHOLD_SHIFT); + bcm2835_sdhost_write(host, temp, SDEDM); + mdelay(10); + bcm2835_sdhost_set_power(host, true); + mdelay(10); + host->clock = 0; ++ host->sectors = 0; + bcm2835_sdhost_write(host, host->hcfg, SDHCFG); -+ bcm2835_sdhost_write(host, host->cdiv, SDCDIV); ++ bcm2835_sdhost_write(host, SDCDIV_MAX_CDIV, SDCDIV); + mmiowb(); +} + -+ +static void bcm2835_sdhost_reset(struct mmc_host *mmc) +{ + struct bcm2835_host *host = mmc_priv(mmc); + unsigned long flags; -+ if (host->debug) -+ pr_info("%s: reset\n", mmc_hostname(mmc)); + spin_lock_irqsave(&host->lock, flags); ++ log_event("RST<", 0, 0); + + bcm2835_sdhost_reset_internal(host); + @@ -71780,82 +72194,48 @@ index 0000000..da089985 + } +} + -+static bool bcm2835_sdhost_is_write_complete(struct bcm2835_host *host) ++static void bcm2835_sdhost_wait_transfer_complete(struct bcm2835_host *host) +{ -+ bool write_complete = ((bcm2835_sdhost_read(host, SDEDM) & 0xf) == 1); -+ -+ if (!write_complete) { -+ /* Request an IRQ for the last block */ -+ host->hcfg |= SDHCFG_BLOCK_IRPT_EN; -+ bcm2835_sdhost_write(host, host->hcfg, SDHCFG); -+ if ((bcm2835_sdhost_read(host, SDEDM) & 0xf) == 1) { -+ /* The write has now completed. Disable the interrupt -+ and clear the status flag */ -+ host->hcfg &= ~SDHCFG_BLOCK_IRPT_EN; -+ bcm2835_sdhost_write(host, host->hcfg, SDHCFG); -+ bcm2835_sdhost_write(host, SDHSTS_BLOCK_IRPT, SDHSTS); -+ write_complete = true; -+ } -+ } ++ int timediff; ++ u32 alternate_idle; ++ u32 edm; + -+ return write_complete; -+} ++ alternate_idle = (host->mrq->data->flags & MMC_DATA_READ) ? ++ SDEDM_FSM_READWAIT : SDEDM_FSM_WRITESTART1; + -+static void bcm2835_sdhost_wait_write_complete(struct bcm2835_host *host) -+{ -+ int timediff; -+#ifdef DEBUG -+ static struct timeval start_time; -+ static int max_stall_time = 0; -+ static int total_stall_time = 0; -+ struct timeval before, after; ++ edm = bcm2835_sdhost_read(host, SDEDM); + -+ do_gettimeofday(&before); -+ if (max_stall_time == 0) -+ start_time = before; -+#endif ++ log_event("WTC<", edm, 0); + + timediff = 0; + + while (1) { -+ u32 edm = bcm2835_sdhost_read(host, SDEDM); -+ if ((edm & 0xf) == 1) ++ u32 fsm = edm & SDEDM_FSM_MASK; ++ if ((fsm == SDEDM_FSM_IDENTMODE) || ++ (fsm == SDEDM_FSM_DATAMODE)) + break; -+ timediff++; -+ if (timediff > 5000000) { -+#ifdef DEBUG -+ do_gettimeofday(&after); -+ timediff = (after.tv_sec - before.tv_sec)*1000000 + -+ (after.tv_usec - before.tv_usec); ++ if (fsm == alternate_idle) { ++ bcm2835_sdhost_write(host, ++ edm | SDEDM_FORCE_DATA_MODE, ++ SDEDM); ++ break; ++ } + -+ pr_err(" wait_write_complete - still waiting after %dus\n", -+ timediff); -+#else -+ pr_err(" wait_write_complete - still waiting after %d retries\n", ++ timediff++; ++ if (timediff == 100000) { ++ pr_err("%s: wait_transfer_complete - still waiting after %d retries\n", ++ mmc_hostname(host->mmc), + timediff); -+#endif ++ log_dump(); + bcm2835_sdhost_dumpregs(host); -+ host->data->error = -ETIMEDOUT; ++ host->mrq->data->error = -ETIMEDOUT; ++ log_event("WTC!", edm, 0); + return; + } ++ cpu_relax(); ++ edm = bcm2835_sdhost_read(host, SDEDM); + } -+ -+#ifdef DEBUG -+ do_gettimeofday(&after); -+ timediff = (after.tv_sec - before.tv_sec)*1000000 + (after.tv_usec - before.tv_usec); -+ -+ total_stall_time += timediff; -+ if (timediff > max_stall_time) -+ max_stall_time = timediff; -+ -+ if ((after.tv_sec - start_time.tv_sec) > 10) { -+ pr_debug(" wait_write_complete - max wait %dus, total %dus\n", -+ max_stall_time, total_stall_time); -+ start_time = after; -+ max_stall_time = 0; -+ total_stall_time = 0; -+ } -+#endif ++ log_event("WTC>", edm, 0); +} + +static void bcm2835_sdhost_finish_data(struct bcm2835_host *host); @@ -71863,65 +72243,44 @@ index 0000000..da089985 +static void bcm2835_sdhost_dma_complete(void *param) +{ + struct bcm2835_host *host = param; -+ struct dma_chan *dma_chan; ++ struct mmc_data *data = host->data; + unsigned long flags; -+ u32 dir_data; + + spin_lock_irqsave(&host->lock, flags); ++ log_event("DMA<", (u32)host->data, bcm2835_sdhost_read(host, SDHSTS)); ++ log_event("DMA ", bcm2835_sdhost_read(host, SDCMD), ++ bcm2835_sdhost_read(host, SDEDM)); + -+ if (host->data) { -+ bool write_complete; -+ if (USE_BLOCK_IRQ) -+ write_complete = bcm2835_sdhost_is_write_complete(host); -+ else { -+ bcm2835_sdhost_wait_write_complete(host); -+ write_complete = true; -+ } -+ pr_debug("dma_complete() - write_complete=%d\n", -+ write_complete); ++ if (host->dma_chan) { ++ dma_unmap_sg(host->dma_chan->device->dev, ++ data->sg, data->sg_len, ++ host->dma_dir); + -+ if (write_complete || (host->data->flags & MMC_DATA_READ)) -+ { -+ if (write_complete) { -+ dma_chan = host->dma_chan_tx; -+ dir_data = DMA_TO_DEVICE; -+ } else { -+ dma_chan = host->dma_chan_rx; -+ dir_data = DMA_FROM_DEVICE; -+ } ++ host->dma_chan = NULL; ++ } + -+ dma_unmap_sg(dma_chan->device->dev, -+ host->data->sg, host->data->sg_len, -+ dir_data); ++ if (host->drain_words) { ++ void *page; ++ u32 *buf; + -+ bcm2835_sdhost_finish_data(host); ++ page = kmap_atomic(host->drain_page); ++ buf = page + host->drain_offset; ++ ++ while (host->drain_words) { ++ u32 edm = bcm2835_sdhost_read(host, SDEDM); ++ if ((edm >> 4) & 0x1f) ++ *(buf++) = bcm2835_sdhost_read(host, ++ SDDATA); ++ host->drain_words--; + } ++ ++ kunmap_atomic(page); + } + -+ spin_unlock_irqrestore(&host->lock, flags); -+} ++ bcm2835_sdhost_finish_data(host); + -+static bool data_transfer_wait(struct bcm2835_host *host) -+{ -+ unsigned long timeout = 1000000; -+ while (timeout) -+ { -+ u32 sdhsts = bcm2835_sdhost_read(host, SDHSTS); -+ if (sdhsts & SDHSTS_DATA_FLAG) { -+ bcm2835_sdhost_write(host, SDHSTS_DATA_FLAG, SDHSTS); -+ break; -+ } -+ timeout--; -+ } -+ if (timeout == 0) { -+ pr_err("%s: Data %s timeout\n", -+ mmc_hostname(host->mmc), -+ (host->data->flags & MMC_DATA_READ) ? "read" : "write"); -+ bcm2835_sdhost_dumpregs(host); -+ host->data->error = -ETIMEDOUT; -+ return false; -+ } -+ return true; ++ log_event("DMA>", (u32)host->data, 0); ++ spin_unlock_irqrestore(&host->lock, flags); +} + +static void bcm2835_sdhost_read_block_pio(struct bcm2835_host *host) @@ -71929,32 +72288,83 @@ index 0000000..da089985 + unsigned long flags; + size_t blksize, len; + u32 *buf; ++ unsigned long wait_max; + + blksize = host->data->blksz; + ++ wait_max = jiffies + msecs_to_jiffies(host->pio_timeout); ++ + local_irq_save(flags); + + while (blksize) { -+ if (!sg_miter_next(&host->sg_miter)) -+ BUG(); ++ int copy_words; ++ u32 hsts = 0; ++ ++ if (!sg_miter_next(&host->sg_miter)) { ++ host->data->error = -EINVAL; ++ break; ++ } + + len = min(host->sg_miter.length, blksize); -+ BUG_ON(len % 4); ++ if (len % 4) { ++ host->data->error = -EINVAL; ++ break; ++ } + + blksize -= len; + host->sg_miter.consumed = len; + + buf = (u32 *)host->sg_miter.addr; + -+ while (len) { -+ if (!data_transfer_wait(host)) -+ break; ++ copy_words = len/4; ++ ++ while (copy_words) { ++ int burst_words, words; ++ u32 edm; ++ ++ burst_words = SDDATA_FIFO_PIO_BURST; ++ if (burst_words > copy_words) ++ burst_words = copy_words; ++ edm = bcm2835_sdhost_read(host, SDEDM); ++ words = ((edm >> 4) & 0x1f); ++ ++ if (words < burst_words) { ++ int fsm_state = (edm & SDEDM_FSM_MASK); ++ if ((fsm_state != SDEDM_FSM_READDATA) && ++ (fsm_state != SDEDM_FSM_READWAIT) && ++ (fsm_state != SDEDM_FSM_READCRC)) { ++ hsts = bcm2835_sdhost_read(host, ++ SDHSTS); ++ pr_err("%s: fsm %x, hsts %x\n", ++ mmc_hostname(host->mmc), ++ fsm_state, hsts); ++ if (hsts & SDHSTS_ERROR_MASK) ++ break; ++ } ++ ++ if (time_after(jiffies, wait_max)) { ++ pr_err("%s: PIO read timeout - EDM %x\n", ++ mmc_hostname(host->mmc), ++ edm); ++ hsts = SDHSTS_REW_TIME_OUT; ++ break; ++ } ++ ndelay((burst_words - words) * ++ host->ns_per_fifo_word); ++ continue; ++ } else if (words > copy_words) { ++ words = copy_words; ++ } ++ ++ copy_words -= words; + -+ *(buf++) = bcm2835_sdhost_read(host, SDDATA); -+ len -= 4; ++ while (words) { ++ *(buf++) = bcm2835_sdhost_read(host, SDDATA); ++ words--; ++ } + } + -+ if (host->data->error) ++ if (hsts & SDHSTS_ERROR_MASK) + break; + } + @@ -71968,32 +72378,83 @@ index 0000000..da089985 + unsigned long flags; + size_t blksize, len; + u32 *buf; ++ unsigned long wait_max; + + blksize = host->data->blksz; + ++ wait_max = jiffies + msecs_to_jiffies(host->pio_timeout); ++ + local_irq_save(flags); + + while (blksize) { -+ if (!sg_miter_next(&host->sg_miter)) -+ BUG(); ++ int copy_words; ++ u32 hsts = 0; ++ ++ if (!sg_miter_next(&host->sg_miter)) { ++ host->data->error = -EINVAL; ++ break; ++ } + + len = min(host->sg_miter.length, blksize); -+ BUG_ON(len % 4); ++ if (len % 4) { ++ host->data->error = -EINVAL; ++ break; ++ } + + blksize -= len; + host->sg_miter.consumed = len; + -+ buf = host->sg_miter.addr; ++ buf = (u32 *)host->sg_miter.addr; + -+ while (len) { -+ if (!data_transfer_wait(host)) -+ break; ++ copy_words = len/4; ++ ++ while (copy_words) { ++ int burst_words, words; ++ u32 edm; ++ ++ burst_words = SDDATA_FIFO_PIO_BURST; ++ if (burst_words > copy_words) ++ burst_words = copy_words; ++ edm = bcm2835_sdhost_read(host, SDEDM); ++ words = SDDATA_FIFO_WORDS - ((edm >> 4) & 0x1f); ++ ++ if (words < burst_words) { ++ int fsm_state = (edm & SDEDM_FSM_MASK); ++ if ((fsm_state != SDEDM_FSM_WRITEDATA) && ++ (fsm_state != SDEDM_FSM_WRITESTART1) && ++ (fsm_state != SDEDM_FSM_WRITESTART2)) { ++ hsts = bcm2835_sdhost_read(host, ++ SDHSTS); ++ pr_err("%s: fsm %x, hsts %x\n", ++ mmc_hostname(host->mmc), ++ fsm_state, hsts); ++ if (hsts & SDHSTS_ERROR_MASK) ++ break; ++ } ++ ++ if (time_after(jiffies, wait_max)) { ++ pr_err("%s: PIO write timeout - EDM %x\n", ++ mmc_hostname(host->mmc), ++ edm); ++ hsts = SDHSTS_REW_TIME_OUT; ++ break; ++ } ++ ndelay((burst_words - words) * ++ host->ns_per_fifo_word); ++ continue; ++ } else if (words > copy_words) { ++ words = copy_words; ++ } + -+ bcm2835_sdhost_write(host, *(buf++), SDDATA); -+ len -= 4; ++ copy_words -= words; ++ ++ while (words) { ++ bcm2835_sdhost_write(host, *(buf++), SDDATA); ++ words--; ++ } + } + -+ if (host->data->error) ++ if (hsts & SDHSTS_ERROR_MASK) + break; + } + @@ -72002,12 +72463,12 @@ index 0000000..da089985 + local_irq_restore(flags); +} + -+ +static void bcm2835_sdhost_transfer_pio(struct bcm2835_host *host) +{ + u32 sdhsts; + bool is_read; + BUG_ON(!host->data); ++ log_event("XFP<", (u32)host->data, host->blocks); + + is_read = (host->data->flags & MMC_DATA_READ) != 0; + if (is_read) @@ -72031,65 +72492,99 @@ index 0000000..da089985 + is_read ? "read" : "write", + sdhsts); + host->data->error = -ETIMEDOUT; -+ } else if (!is_read && !host->data->error) { -+ /* Start a timer in case a transfer error occurs because -+ there is no error interrupt */ -+ mod_timer(&host->pio_timer, jiffies + host->pio_timeout); + } ++ log_event("XFP>", (u32)host->data, host->blocks); +} + -+ -+static void bcm2835_sdhost_transfer_dma(struct bcm2835_host *host) ++static void bcm2835_sdhost_prepare_dma(struct bcm2835_host *host, ++ struct mmc_data *data) +{ -+ u32 len, dir_data, dir_slave; ++ int len, dir_data, dir_slave; + struct dma_async_tx_descriptor *desc = NULL; + struct dma_chan *dma_chan; + -+ pr_debug("bcm2835_sdhost_transfer_dma()\n"); -+ -+ WARN_ON(!host->data); -+ -+ if (!host->data) -+ return; ++ log_event("PRD<", (u32)data, 0); ++ pr_debug("bcm2835_sdhost_prepare_dma()\n"); + -+ if (host->data->flags & MMC_DATA_READ) { -+ dma_chan = host->dma_chan_rx; ++ dma_chan = host->dma_chan_rxtx; ++ if (data->flags & MMC_DATA_READ) { + dir_data = DMA_FROM_DEVICE; + dir_slave = DMA_DEV_TO_MEM; + } else { -+ dma_chan = host->dma_chan_tx; + dir_data = DMA_TO_DEVICE; + dir_slave = DMA_MEM_TO_DEV; + } ++ log_event("PRD1", (u32)dma_chan, 0); + + BUG_ON(!dma_chan->device); + BUG_ON(!dma_chan->device->dev); -+ BUG_ON(!host->data->sg); ++ BUG_ON(!data->sg); + -+ len = dma_map_sg(dma_chan->device->dev, host->data->sg, -+ host->data->sg_len, dir_data); -+ if (len > 0) { -+ desc = dmaengine_prep_slave_sg(dma_chan, host->data->sg, ++ /* The block doesn't manage the FIFO DREQs properly for multi-block ++ transfers, so don't attempt to DMA the final few words. ++ Unfortunately this requires the final sg entry to be trimmed. ++ N.B. This code demands that the overspill is contained in ++ a single sg entry. ++ */ ++ ++ host->drain_words = 0; ++ if ((data->blocks > 1) && (dir_data == DMA_FROM_DEVICE)) { ++ struct scatterlist *sg; ++ u32 len; ++ int i; ++ ++ len = min((u32)(FIFO_READ_THRESHOLD - 1) * 4, ++ (u32)data->blocks * data->blksz); ++ ++ for_each_sg(data->sg, sg, data->sg_len, i) { ++ if (sg_is_last(sg)) { ++ BUG_ON(sg->length < len); ++ sg->length -= len; ++ host->drain_page = (struct page *)sg->page_link; ++ host->drain_offset = sg->offset + sg->length; ++ } ++ } ++ host->drain_words = len/4; ++ } ++ ++ /* The parameters have already been validated, so this will not fail */ ++ (void)dmaengine_slave_config(dma_chan, ++ (dir_data == DMA_FROM_DEVICE) ? ++ &host->dma_cfg_rx : ++ &host->dma_cfg_tx); ++ ++ len = dma_map_sg(dma_chan->device->dev, data->sg, data->sg_len, ++ dir_data); ++ ++ log_event("PRD2", len, 0); ++ if (len > 0) ++ desc = dmaengine_prep_slave_sg(dma_chan, data->sg, + len, dir_slave, + DMA_PREP_INTERRUPT | DMA_CTRL_ACK); -+ } else { -+ dev_err(mmc_dev(host->mmc), "dma_map_sg returned zero length\n"); -+ } ++ log_event("PRD3", (u32)desc, 0); ++ + if (desc) { + desc->callback = bcm2835_sdhost_dma_complete; + desc->callback_param = host; -+ dmaengine_submit(desc); -+ dma_async_issue_pending(dma_chan); ++ host->dma_desc = desc; ++ host->dma_chan = dma_chan; ++ host->dma_dir = dir_data; + } -+ ++ log_event("PDM>", (u32)data, 0); +} + ++static void bcm2835_sdhost_start_dma(struct bcm2835_host *host) ++{ ++ log_event("SDMA", (u32)host->data, (u32)host->dma_chan); ++ dmaengine_submit(host->dma_desc); ++ dma_async_issue_pending(host->dma_chan); ++} + +static void bcm2835_sdhost_set_transfer_irqs(struct bcm2835_host *host) +{ + u32 all_irqs = SDHCFG_DATA_IRPT_EN | SDHCFG_BLOCK_IRPT_EN | + SDHCFG_BUSY_IRPT_EN; -+ if (host->use_dma) ++ if (host->dma_desc) + host->hcfg = (host->hcfg & ~all_irqs) | + SDHCFG_BUSY_IRPT_EN; + else @@ -72100,13 +72595,13 @@ index 0000000..da089985 + bcm2835_sdhost_write(host, host->hcfg, SDHCFG); +} + -+ +static void bcm2835_sdhost_prepare_data(struct bcm2835_host *host, struct mmc_command *cmd) +{ + struct mmc_data *data = cmd->data; + + WARN_ON(host->data); + ++ host->data = data; + if (!data) + return; + @@ -72115,16 +72610,32 @@ index 0000000..da089985 + BUG_ON(data->blksz > host->mmc->max_blk_size); + BUG_ON(data->blocks > 65535); + -+ host->data = data; + host->data_complete = 0; + host->flush_fifo = 0; + host->data->bytes_xfered = 0; + -+ host->use_dma = host->have_dma && (data->blocks > host->pio_limit); -+ if (!host->use_dma) { -+ int flags; ++ if (!host->sectors && host->mmc->card) { ++ struct mmc_card *card = host->mmc->card; ++ if (!mmc_card_sd(card) && mmc_card_blockaddr(card)) { ++ /* ++ * The EXT_CSD sector count is in number of 512 byte ++ * sectors. ++ */ ++ host->sectors = card->ext_csd.sectors; ++ } else { ++ /* ++ * The CSD capacity field is in units of read_blkbits. ++ * set_capacity takes units of 512 bytes. ++ */ ++ host->sectors = card->csd.capacity << ++ (card->csd.read_blkbits - 9); ++ } ++ } ++ ++ if (!host->dma_desc) { ++ /* Use PIO */ ++ int flags = SG_MITER_ATOMIC; + -+ flags = SG_MITER_ATOMIC; + if (data->flags & MMC_DATA_READ) + flags |= SG_MITER_TO_SG; + else @@ -72136,19 +72647,20 @@ index 0000000..da089985 + bcm2835_sdhost_set_transfer_irqs(host); + + bcm2835_sdhost_write(host, data->blksz, SDHBCT); -+ bcm2835_sdhost_write(host, host->use_dma ? data->blocks : 0, SDHBLC); ++ bcm2835_sdhost_write(host, data->blocks, SDHBLC); + + BUG_ON(!host->data); +} + -+ -+void bcm2835_sdhost_send_command(struct bcm2835_host *host, struct mmc_command *cmd) ++bool bcm2835_sdhost_send_command(struct bcm2835_host *host, ++ struct mmc_command *cmd) +{ + u32 sdcmd, sdhsts; + unsigned long timeout; + int delay; + + WARN_ON(host->cmd); ++ log_event("CMD<", cmd->opcode, cmd->arg); + + if (cmd->data) + pr_debug("%s: send_command %d 0x%x " @@ -72171,9 +72683,9 @@ index 0000000..da089985 + pr_err("%s: previous command never completed.\n", + mmc_hostname(host->mmc)); + bcm2835_sdhost_dumpregs(host); -+ cmd->error = -EIO; ++ cmd->error = -EILSEQ; + tasklet_schedule(&host->finish_tasklet); -+ return; ++ return false; + } + timeout--; + udelay(10); @@ -72201,23 +72713,24 @@ index 0000000..da089985 + if (sdhsts & SDHSTS_ERROR_MASK) + bcm2835_sdhost_write(host, sdhsts, SDHSTS); + -+ bcm2835_sdhost_prepare_data(host, cmd); -+ -+ bcm2835_sdhost_write(host, cmd->arg, SDARG); -+ + if ((cmd->flags & MMC_RSP_136) && (cmd->flags & MMC_RSP_BUSY)) { + pr_err("%s: unsupported response type!\n", + mmc_hostname(host->mmc)); + cmd->error = -EINVAL; + tasklet_schedule(&host->finish_tasklet); -+ return; ++ return false; + } + ++ bcm2835_sdhost_prepare_data(host, cmd); ++ ++ bcm2835_sdhost_write(host, cmd->arg, SDARG); ++ + sdcmd = cmd->opcode & SDCMD_CMD_MASK; + -+ if (!(cmd->flags & MMC_RSP_PRESENT)) ++ host->use_busy = 0; ++ if (!(cmd->flags & MMC_RSP_PRESENT)) { + sdcmd |= SDCMD_NO_RESPONSE; -+ else { ++ } else { + if (cmd->flags & MMC_RSP_136) + sdcmd |= SDCMD_LONG_RESPONSE; + if (cmd->flags & MMC_RSP_BUSY) { @@ -72227,7 +72740,8 @@ index 0000000..da089985 + } + + if (cmd->data) { -+ if (host->delay_after_stop) { ++ log_event("CMDD", cmd->data->blocks, cmd->data->blksz); ++ if (host->delay_after_this_stop) { + struct timeval now; + int time_since_stop; + do_gettimeofday(&now); @@ -72236,12 +72750,32 @@ index 0000000..da089985 + /* Possibly less than one second */ + time_since_stop = time_since_stop * 1000000 + + (now.tv_usec - host->stop_time.tv_usec); -+ if (time_since_stop < host->delay_after_stop) -+ udelay(host->delay_after_stop - ++ if (time_since_stop < ++ host->delay_after_this_stop) ++ udelay(host->delay_after_this_stop - + time_since_stop); + } + } + ++ host->delay_after_this_stop = host->delay_after_stop; ++ if ((cmd->data->flags & MMC_DATA_READ) && !host->use_sbc) { ++ /* See if read crosses one of the hazardous sectors */ ++ u32 first_blk, last_blk; ++ ++ /* Intentionally include the following sector because ++ without CMD23/SBC the read may run on. */ ++ first_blk = host->mrq->cmd->arg; ++ last_blk = first_blk + cmd->data->blocks; ++ ++ if (((last_blk >= (host->sectors - 64)) && ++ (first_blk <= (host->sectors - 64))) || ++ ((last_blk >= (host->sectors - 32)) && ++ (first_blk <= (host->sectors - 32)))) { ++ host->delay_after_this_stop = ++ max(250u, host->delay_after_stop); ++ } ++ } ++ + if (cmd->data->flags & MMC_DATA_WRITE) + sdcmd |= SDCMD_WRITE_CMD; + if (cmd->data->flags & MMC_DATA_READ) @@ -72249,10 +72783,12 @@ index 0000000..da089985 + } + + bcm2835_sdhost_write(host, sdcmd | SDCMD_NEW_FLAG, SDCMD); -+} + ++ return true; ++} + -+static void bcm2835_sdhost_finish_command(struct bcm2835_host *host); ++static void bcm2835_sdhost_finish_command(struct bcm2835_host *host, ++ unsigned long *irq_flags); +static void bcm2835_sdhost_transfer_complete(struct bcm2835_host *host); + +static void bcm2835_sdhost_finish_data(struct bcm2835_host *host) @@ -72262,6 +72798,7 @@ index 0000000..da089985 + data = host->data; + BUG_ON(!data); + ++ log_event("FDA<", (u32)host->mrq, (u32)host->cmd); + pr_debug("finish_data(error %d, stop %d, sbc %d)\n", + data->error, data->stop ? 1 : 0, + host->mrq->sbc ? 1 : 0); @@ -72269,10 +72806,7 @@ index 0000000..da089985 + host->hcfg &= ~(SDHCFG_DATA_IRPT_EN | SDHCFG_BLOCK_IRPT_EN); + bcm2835_sdhost_write(host, host->hcfg, SDHCFG); + -+ if (data->error) { -+ data->bytes_xfered = 0; -+ } else -+ data->bytes_xfered = data->blksz * data->blocks; ++ data->bytes_xfered = data->error ? 0 : (data->blksz * data->blocks); + + host->data_complete = 1; + @@ -72287,9 +72821,9 @@ index 0000000..da089985 + } + else + bcm2835_sdhost_transfer_complete(host); ++ log_event("FDA>", (u32)host->mrq, (u32)host->cmd); +} + -+ +static void bcm2835_sdhost_transfer_complete(struct bcm2835_host *host) +{ + struct mmc_data *data; @@ -72301,6 +72835,7 @@ index 0000000..da089985 + data = host->data; + host->data = NULL; + ++ log_event("TCM<", (u32)data, data->error); + pr_debug("transfer_complete(error %d, stop %d)\n", + data->error, data->stop ? 1 : 0); + @@ -72309,88 +72844,114 @@ index 0000000..da089985 + * a) open-ended multiblock transfer (no CMD23) + * b) error in multiblock transfer + */ -+ if (data->stop && -+ (data->error || -+ !host->mrq->sbc)) { -+ host->flush_fifo = 1; -+ bcm2835_sdhost_send_command(host, data->stop); -+ if (host->delay_after_stop) -+ do_gettimeofday(&host->stop_time); -+ if (!host->use_busy) -+ bcm2835_sdhost_finish_command(host); ++ if (host->mrq->stop && (data->error || !host->use_sbc)) { ++ if (bcm2835_sdhost_send_command(host, host->mrq->stop)) { ++ /* No busy, so poll for completion */ ++ if (!host->use_busy) ++ bcm2835_sdhost_finish_command(host, NULL); ++ ++ if (host->delay_after_this_stop) ++ do_gettimeofday(&host->stop_time); ++ } + } else { ++ bcm2835_sdhost_wait_transfer_complete(host); + tasklet_schedule(&host->finish_tasklet); + } ++ log_event("TCM>", (u32)data, 0); +} + -+static void bcm2835_sdhost_finish_command(struct bcm2835_host *host) ++/* If irq_flags is valid, the caller is in a thread context and is allowed ++ to sleep */ ++static void bcm2835_sdhost_finish_command(struct bcm2835_host *host, ++ unsigned long *irq_flags) +{ + u32 sdcmd; -+ unsigned long timeout; ++ u32 retries; +#ifdef DEBUG + struct timeval before, after; + int timediff = 0; +#endif + ++ log_event("FCM<", (u32)host->mrq, (u32)host->cmd); + pr_debug("finish_command(%x)\n", bcm2835_sdhost_read(host, SDCMD)); + + BUG_ON(!host->cmd || !host->mrq); + -+#ifdef DEBUG -+ do_gettimeofday(&before); -+#endif -+ /* Wait max 100 ms */ -+ timeout = 10000; ++ /* Poll quickly at first */ ++ ++ retries = host->cmd_quick_poll_retries; ++ if (!retries) { ++ /* Work out how many polls take 1us by timing 10us */ ++ struct timeval start, now; ++ int us_diff; ++ ++ retries = 1; ++ do { ++ int i; ++ ++ retries *= 2; ++ ++ do_gettimeofday(&start); ++ ++ for (i = 0; i < retries; i++) { ++ cpu_relax(); ++ sdcmd = bcm2835_sdhost_read(host, SDCMD); ++ } ++ ++ do_gettimeofday(&now); ++ us_diff = (now.tv_sec - start.tv_sec) * 1000000 + ++ (now.tv_usec - start.tv_usec); ++ } while (us_diff < 10); ++ ++ host->cmd_quick_poll_retries = ((retries * us_diff + 9)*CMD_DALLY_US)/10 + 1; ++ retries = 1; // We've already waited long enough this time ++ } ++ ++ retries = host->cmd_quick_poll_retries; + for (sdcmd = bcm2835_sdhost_read(host, SDCMD); -+ (sdcmd & SDCMD_NEW_FLAG) && timeout; -+ timeout--) { -+ if (host->flush_fifo) { -+ while (bcm2835_sdhost_read(host, SDHSTS) & -+ SDHSTS_DATA_FLAG) -+ (void)bcm2835_sdhost_read(host, SDDATA); -+ } -+ udelay(10); ++ (sdcmd & SDCMD_NEW_FLAG) && !(sdcmd & SDCMD_FAIL_FLAG) && retries; ++ retries--) { ++ cpu_relax(); + sdcmd = bcm2835_sdhost_read(host, SDCMD); + } -+#ifdef DEBUG -+ do_gettimeofday(&after); -+ timediff = (after.tv_sec - before.tv_sec)*1000000 + -+ (after.tv_usec - before.tv_usec); + -+ pr_debug(" finish_command - waited %dus\n", timediff); -+#endif ++ if (!retries) { ++ unsigned long wait_max; ++ ++ if (!irq_flags) { ++ /* Schedule the work */ ++ log_event("CWWQ", 0, 0); ++ schedule_work(&host->cmd_wait_wq); ++ return; ++ } + -+ if (timeout == 0) { ++ /* Wait max 100 ms */ ++ wait_max = jiffies + msecs_to_jiffies(100); ++ while (time_before(jiffies, wait_max)) { ++ spin_unlock_irqrestore(&host->lock, *irq_flags); ++ usleep_range(1, 10); ++ spin_lock_irqsave(&host->lock, *irq_flags); ++ sdcmd = bcm2835_sdhost_read(host, SDCMD); ++ if (!(sdcmd & SDCMD_NEW_FLAG) || ++ (sdcmd & SDCMD_FAIL_FLAG)) ++ break; ++ } ++ } ++ ++ /* Check for errors */ ++ if (sdcmd & SDCMD_NEW_FLAG) { + pr_err("%s: command never completed.\n", + mmc_hostname(host->mmc)); + bcm2835_sdhost_dumpregs(host); + host->cmd->error = -EIO; + tasklet_schedule(&host->finish_tasklet); + return; -+ } -+ -+ if (host->flush_fifo) { -+ for (timeout = 100; -+ (bcm2835_sdhost_read(host, SDHSTS) & SDHSTS_DATA_FLAG) && timeout; -+ timeout--) { -+ (void)bcm2835_sdhost_read(host, SDDATA); -+ } -+ host->flush_fifo = 0; -+ if (timeout == 0) { -+ pr_err("%s: FIFO never drained.\n", -+ mmc_hostname(host->mmc)); -+ bcm2835_sdhost_dumpregs(host); -+ host->cmd->error = -EIO; -+ tasklet_schedule(&host->finish_tasklet); -+ return; -+ } -+ } -+ -+ /* Check for errors */ -+ if (sdcmd & SDCMD_FAIL_FLAG) -+ { ++ } else if (sdcmd & SDCMD_FAIL_FLAG) { + u32 sdhsts = bcm2835_sdhost_read(host, SDHSTS); + ++ /* Clear the errors */ ++ bcm2835_sdhost_write(host, SDHSTS_ERROR_MASK, SDHSTS); ++ + if (host->debug) + pr_info("%s: error detected - CMD %x, HSTS %03x, EDM %x\n", + mmc_hostname(host->mmc), sdcmd, sdhsts, @@ -72413,7 +72974,7 @@ index 0000000..da089985 + mmc_hostname(host->mmc), + host->cmd->opcode); + bcm2835_sdhost_dumpregs(host); -+ host->cmd->error = -EIO; ++ host->cmd->error = -EILSEQ; + } + tasklet_schedule(&host->finish_tasklet); + return; @@ -72428,31 +72989,31 @@ index 0000000..da089985 + pr_debug("%s: finish_command %08x %08x %08x %08x\n", + mmc_hostname(host->mmc), + host->cmd->resp[0], host->cmd->resp[1], host->cmd->resp[2], host->cmd->resp[3]); ++ log_event("RSP ", host->cmd->resp[0], host->cmd->resp[1]); + } else { + host->cmd->resp[0] = bcm2835_sdhost_read(host, SDRSP0); + pr_debug("%s: finish_command %08x\n", + mmc_hostname(host->mmc), + host->cmd->resp[0]); ++ log_event("RSP ", host->cmd->resp[0], 0); + } + } + -+ host->cmd->error = 0; -+ + if (host->cmd == host->mrq->sbc) { + /* Finished CMD23, now send actual command. */ + host->cmd = NULL; -+ bcm2835_sdhost_send_command(host, host->mrq->cmd); -+ -+ if (host->cmd->data && host->use_dma) -+ /* DMA transfer starts now, PIO starts after irq */ -+ bcm2835_sdhost_transfer_dma(host); ++ if (bcm2835_sdhost_send_command(host, host->mrq->cmd)) { ++ if (host->data && host->dma_desc) ++ /* DMA transfer starts now, PIO starts after irq */ ++ bcm2835_sdhost_start_dma(host); + -+ if (!host->use_busy) -+ bcm2835_sdhost_finish_command(host); -+ } else if (host->cmd == host->mrq->stop) ++ if (!host->use_busy) ++ bcm2835_sdhost_finish_command(host, NULL); ++ } ++ } else if (host->cmd == host->mrq->stop) { + /* Finished CMD12 */ + tasklet_schedule(&host->finish_tasklet); -+ else { ++ } else { + /* Processed actual command. */ + host->cmd = NULL; + if (!host->data) @@ -72460,6 +73021,7 @@ index 0000000..da089985 + else if (host->data_complete) + bcm2835_sdhost_transfer_complete(host); + } ++ log_event("FCM>", (u32)host->mrq, (u32)host->cmd); +} + +static void bcm2835_sdhost_timeout(unsigned long data) @@ -72470,10 +73032,12 @@ index 0000000..da089985 + host = (struct bcm2835_host *)data; + + spin_lock_irqsave(&host->lock, flags); ++ log_event("TIM<", 0, 0); + + if (host->mrq) { + pr_err("%s: timeout waiting for hardware interrupt.\n", + mmc_hostname(host->mmc)); ++ log_dump(); + bcm2835_sdhost_dumpregs(host); + + if (host->data) { @@ -72494,74 +73058,15 @@ index 0000000..da089985 + spin_unlock_irqrestore(&host->lock, flags); +} + -+static void bcm2835_sdhost_pio_timeout(unsigned long data) -+{ -+ struct bcm2835_host *host; -+ unsigned long flags; -+ -+ host = (struct bcm2835_host *)data; -+ -+ spin_lock_irqsave(&host->lock, flags); -+ -+ if (host->data) { -+ u32 sdhsts = bcm2835_sdhost_read(host, SDHSTS); -+ -+ if (sdhsts & SDHSTS_REW_TIME_OUT) { -+ pr_err("%s: transfer timeout\n", -+ mmc_hostname(host->mmc)); -+ if (host->debug) -+ bcm2835_sdhost_dumpregs(host); -+ } else { -+ pr_err("%s: unexpected transfer timeout\n", -+ mmc_hostname(host->mmc)); -+ bcm2835_sdhost_dumpregs(host); -+ } -+ -+ bcm2835_sdhost_write(host, SDHSTS_TRANSFER_ERROR_MASK, -+ SDHSTS); -+ -+ host->data->error = -ETIMEDOUT; -+ -+ bcm2835_sdhost_finish_data(host); -+ } -+ -+ mmiowb(); -+ spin_unlock_irqrestore(&host->lock, flags); -+} -+ -+static void bcm2835_sdhost_enable_sdio_irq_nolock(struct bcm2835_host *host, int enable) -+{ -+ if (enable) -+ host->hcfg |= SDHCFG_SDIO_IRPT_EN; -+ else -+ host->hcfg &= ~SDHCFG_SDIO_IRPT_EN; -+ bcm2835_sdhost_write(host, host->hcfg, SDHCFG); -+ mmiowb(); -+} -+ -+static void bcm2835_sdhost_enable_sdio_irq(struct mmc_host *mmc, int enable) -+{ -+ struct bcm2835_host *host = mmc_priv(mmc); -+ unsigned long flags; -+ -+ pr_debug("%s: enable_sdio_irq(%d)\n", mmc_hostname(mmc), enable); -+ spin_lock_irqsave(&host->lock, flags); -+ bcm2835_sdhost_enable_sdio_irq_nolock(host, enable); -+ spin_unlock_irqrestore(&host->lock, flags); -+} -+ -+static u32 bcm2835_sdhost_busy_irq(struct bcm2835_host *host, u32 intmask) ++static void bcm2835_sdhost_busy_irq(struct bcm2835_host *host, u32 intmask) +{ -+ const u32 handled = (SDHSTS_REW_TIME_OUT | SDHSTS_CMD_TIME_OUT | -+ SDHSTS_CRC16_ERROR | SDHSTS_CRC7_ERROR | -+ SDHSTS_FIFO_ERROR); -+ ++ log_event("IRQB", (u32)host->cmd, intmask); + if (!host->cmd) { + pr_err("%s: got command busy interrupt 0x%08x even " + "though no command operation was in progress.\n", + mmc_hostname(host->mmc), (unsigned)intmask); + bcm2835_sdhost_dumpregs(host); -+ return 0; ++ return; + } + + if (!host->use_busy) { @@ -72569,7 +73074,7 @@ index 0000000..da089985 + "though not expecting one.\n", + mmc_hostname(host->mmc), (unsigned)intmask); + bcm2835_sdhost_dumpregs(host); -+ return 0; ++ return; + } + host->use_busy = 0; + @@ -72592,28 +73097,23 @@ index 0000000..da089985 + } else if (intmask & SDHSTS_CMD_TIME_OUT) + host->cmd->error = -ETIMEDOUT; + ++ log_dump(); + bcm2835_sdhost_dumpregs(host); -+ tasklet_schedule(&host->finish_tasklet); + } + else -+ bcm2835_sdhost_finish_command(host); -+ -+ return handled; ++ bcm2835_sdhost_finish_command(host, NULL); +} + -+static u32 bcm2835_sdhost_data_irq(struct bcm2835_host *host, u32 intmask) ++static void bcm2835_sdhost_data_irq(struct bcm2835_host *host, u32 intmask) +{ -+ const u32 handled = (SDHSTS_REW_TIME_OUT | -+ SDHSTS_CRC16_ERROR | -+ SDHSTS_FIFO_ERROR); -+ + /* There are no dedicated data/space available interrupt + status bits, so it is necessary to use the single shared + data/space available FIFO status bits. It is therefore not + an error to get here when there is no data transfer in + progress. */ ++ log_event("IRQD", (u32)host->data, intmask); + if (!host->data) -+ return 0; ++ return; + + if (intmask & (SDHSTS_CRC16_ERROR | + SDHSTS_FIFO_ERROR | @@ -72624,46 +73124,37 @@ index 0000000..da089985 + else + host->data->error = -ETIMEDOUT; + -+ bcm2835_sdhost_dumpregs(host); -+ tasklet_schedule(&host->finish_tasklet); -+ return handled; ++ if (host->debug) { ++ log_dump(); ++ bcm2835_sdhost_dumpregs(host); ++ } + } + -+ /* Use the block interrupt for writes after the first block */ -+ if (host->data->flags & MMC_DATA_WRITE) { ++ if (host->data->error) { ++ bcm2835_sdhost_finish_data(host); ++ } else if (host->data->flags & MMC_DATA_WRITE) { ++ /* Use the block interrupt for writes after the first block */ + host->hcfg &= ~(SDHCFG_DATA_IRPT_EN); + host->hcfg |= SDHCFG_BLOCK_IRPT_EN; + bcm2835_sdhost_write(host, host->hcfg, SDHCFG); -+ if (host->data->error) -+ bcm2835_sdhost_finish_data(host); -+ else -+ bcm2835_sdhost_transfer_pio(host); ++ bcm2835_sdhost_transfer_pio(host); + } else { -+ if (!host->data->error) { -+ bcm2835_sdhost_transfer_pio(host); -+ host->blocks--; -+ } ++ bcm2835_sdhost_transfer_pio(host); ++ host->blocks--; + if ((host->blocks == 0) || host->data->error) + bcm2835_sdhost_finish_data(host); + } -+ -+ return handled; +} + -+static u32 bcm2835_sdhost_block_irq(struct bcm2835_host *host, u32 intmask) ++static void bcm2835_sdhost_block_irq(struct bcm2835_host *host, u32 intmask) +{ -+ struct dma_chan *dma_chan; -+ u32 dir_data; -+ const u32 handled = (SDHSTS_REW_TIME_OUT | -+ SDHSTS_CRC16_ERROR | -+ SDHSTS_FIFO_ERROR); -+ ++ log_event("IRQK", (u32)host->data, intmask); + if (!host->data) { + pr_err("%s: got block interrupt 0x%08x even " + "though no data operation was in progress.\n", + mmc_hostname(host->mmc), (unsigned)intmask); + bcm2835_sdhost_dumpregs(host); -+ return handled; ++ return; + } + + if (intmask & (SDHSTS_CRC16_ERROR | @@ -72675,157 +73166,81 @@ index 0000000..da089985 + else + host->data->error = -ETIMEDOUT; + -+ if (host->debug) ++ if (host->debug) { ++ log_dump(); + bcm2835_sdhost_dumpregs(host); -+ tasklet_schedule(&host->finish_tasklet); -+ return handled; ++ } + } + -+ if (!host->use_dma) { ++ if (!host->dma_desc) { + BUG_ON(!host->blocks); -+ host->blocks--; -+ if ((host->blocks == 0) || host->data->error) { -+ /* Cancel the timer */ -+ del_timer(&host->pio_timer); -+ ++ if (host->data->error || (--host->blocks == 0)) { + bcm2835_sdhost_finish_data(host); + } else { + bcm2835_sdhost_transfer_pio(host); -+ -+ /* Reset the timer */ -+ mod_timer(&host->pio_timer, -+ jiffies + host->pio_timeout); + } + } else if (host->data->flags & MMC_DATA_WRITE) { -+ dma_chan = host->dma_chan_tx; -+ dir_data = DMA_TO_DEVICE; -+ dma_unmap_sg(dma_chan->device->dev, -+ host->data->sg, host->data->sg_len, -+ dir_data); -+ + bcm2835_sdhost_finish_data(host); + } -+ -+ return handled; +} + -+ +static irqreturn_t bcm2835_sdhost_irq(int irq, void *dev_id) +{ + irqreturn_t result = IRQ_NONE; + struct bcm2835_host *host = dev_id; -+ u32 unexpected = 0, early = 0; -+ int loops = 0; ++ u32 intmask; + + spin_lock(&host->lock); + -+ for (loops = 0; loops < 1; loops++) { -+ u32 intmask, handled; -+ -+ intmask = bcm2835_sdhost_read(host, SDHSTS); -+ handled = intmask & (SDHSTS_BUSY_IRPT | -+ SDHSTS_BLOCK_IRPT | -+ SDHSTS_SDIO_IRPT | -+ SDHSTS_DATA_FLAG); -+ if ((handled == SDHSTS_DATA_FLAG) && -+ (loops == 0) && !host->data) { -+ pr_err("%s: sdhost_irq data interrupt 0x%08x even " -+ "though no data operation was in progress.\n", -+ mmc_hostname(host->mmc), -+ (unsigned)intmask); -+ -+ bcm2835_sdhost_dumpregs(host); -+ } -+ -+ if (!handled) -+ break; ++ intmask = bcm2835_sdhost_read(host, SDHSTS); ++ log_event("IRQ<", intmask, 0); + -+ if (loops) -+ early |= handled; ++ bcm2835_sdhost_write(host, ++ SDHSTS_BUSY_IRPT | ++ SDHSTS_BLOCK_IRPT | ++ SDHSTS_SDIO_IRPT | ++ SDHSTS_DATA_FLAG, ++ SDHSTS); + ++ if (intmask & SDHSTS_BLOCK_IRPT) { ++ bcm2835_sdhost_block_irq(host, intmask); + result = IRQ_HANDLED; ++ } + -+ /* Clear all interrupts and notifications */ -+ bcm2835_sdhost_write(host, intmask, SDHSTS); -+ -+ if (intmask & SDHSTS_BUSY_IRPT) -+ handled |= bcm2835_sdhost_busy_irq(host, intmask); -+ -+ /* There is no true data interrupt status bit, so it is -+ necessary to qualify the data flag with the interrupt -+ enable bit */ -+ if ((intmask & SDHSTS_DATA_FLAG) && -+ (host->hcfg & SDHCFG_DATA_IRPT_EN)) -+ handled |= bcm2835_sdhost_data_irq(host, intmask); -+ -+ if (intmask & SDHSTS_BLOCK_IRPT) -+ handled |= bcm2835_sdhost_block_irq(host, intmask); -+ -+ if (intmask & SDHSTS_SDIO_IRPT) { -+ bcm2835_sdhost_enable_sdio_irq_nolock(host, false); -+ host->thread_isr |= SDHSTS_SDIO_IRPT; -+ result = IRQ_WAKE_THREAD; -+ } ++ if (intmask & SDHSTS_BUSY_IRPT) { ++ bcm2835_sdhost_busy_irq(host, intmask); ++ result = IRQ_HANDLED; ++ } + -+ unexpected |= (intmask & ~handled); ++ /* There is no true data interrupt status bit, so it is ++ necessary to qualify the data flag with the interrupt ++ enable bit */ ++ if ((intmask & SDHSTS_DATA_FLAG) && ++ (host->hcfg & SDHCFG_DATA_IRPT_EN)) { ++ bcm2835_sdhost_data_irq(host, intmask); ++ result = IRQ_HANDLED; + } + + mmiowb(); + ++ log_event("IRQ>", bcm2835_sdhost_read(host, SDHSTS), 0); + spin_unlock(&host->lock); + -+ if (early) -+ pr_debug("%s: early %x (loops %d)\n", -+ mmc_hostname(host->mmc), early, loops); -+ -+ if (unexpected) { -+ pr_err("%s: unexpected interrupt 0x%08x.\n", -+ mmc_hostname(host->mmc), unexpected); -+ bcm2835_sdhost_dumpregs(host); -+ } -+ + return result; +} + -+static irqreturn_t bcm2835_sdhost_thread_irq(int irq, void *dev_id) -+{ -+ struct bcm2835_host *host = dev_id; -+ unsigned long flags; -+ u32 isr; -+ -+ spin_lock_irqsave(&host->lock, flags); -+ isr = host->thread_isr; -+ host->thread_isr = 0; -+ spin_unlock_irqrestore(&host->lock, flags); -+ -+ if (isr & SDHSTS_SDIO_IRPT) { -+ sdio_run_irqs(host->mmc); -+ -+/* Is this necessary? Why re-enable an interrupt which is enabled? -+ spin_lock_irqsave(&host->lock, flags); -+ if (host->flags & SDHSTS_SDIO_IRPT_ENABLED) -+ bcm2835_sdhost_enable_sdio_irq_nolock(host, true); -+ spin_unlock_irqrestore(&host->lock, flags); -+*/ -+ } -+ -+ return isr ? IRQ_HANDLED : IRQ_NONE; -+} -+ -+ -+ +void bcm2835_sdhost_set_clock(struct bcm2835_host *host, unsigned int clock) +{ + int div = 0; /* Initialized for compiler warning */ + unsigned int input_clock = clock; ++ unsigned long flags; + + if (host->debug) + pr_info("%s: set_clock(%d)\n", mmc_hostname(host->mmc), clock); + + if ((host->overclock_50 > 50) && -+ (clock == 50*MHZ)) { ++ (clock == 50*MHZ)) + clock = host->overclock_50 * MHZ + (MHZ - 1); -+ } + + /* The SDCDIV register has 11 bits, and holds (div - 2). + But in data mode the max is 50MHz wihout a minimum, and only the @@ -72850,63 +73265,91 @@ index 0000000..da089985 + + host->mmc->actual_clock = 0; + -+ if (clock < 100000) { -+ /* Can't stop the clock, but make it as slow as possible -+ * to show willing -+ */ -+ host->cdiv = SDCDIV_MAX_CDIV; -+ bcm2835_sdhost_write(host, host->cdiv, SDCDIV); -+ return; -+ } ++ if (host->firmware_sets_cdiv) { ++ u32 msg[3] = { clock, 0, 0 }; ++ ++ rpi_firmware_property(rpi_firmware_get(NULL), ++ RPI_FIRMWARE_SET_SDHOST_CLOCK, ++ &msg, sizeof(msg)); ++ ++ clock = max(msg[1], msg[2]); ++ spin_lock_irqsave(&host->lock, flags); ++ } else { ++ spin_lock_irqsave(&host->lock, flags); ++ if (clock < 100000) { ++ /* Can't stop the clock, but make it as slow as ++ * possible to show willing ++ */ ++ host->cdiv = SDCDIV_MAX_CDIV; ++ bcm2835_sdhost_write(host, host->cdiv, SDCDIV); ++ mmiowb(); ++ spin_unlock_irqrestore(&host->lock, flags); ++ return; ++ } + -+ div = host->max_clk / clock; -+ if (div < 2) -+ div = 2; -+ if ((host->max_clk / div) > clock) -+ div++; -+ div -= 2; ++ div = host->max_clk / clock; ++ if (div < 2) ++ div = 2; ++ if ((host->max_clk / div) > clock) ++ div++; ++ div -= 2; + -+ if (div > SDCDIV_MAX_CDIV) -+ div = SDCDIV_MAX_CDIV; ++ if (div > SDCDIV_MAX_CDIV) ++ div = SDCDIV_MAX_CDIV; + -+ clock = host->max_clk / (div + 2); -+ host->mmc->actual_clock = clock; ++ clock = host->max_clk / (div + 2); + -+ if (clock > input_clock) { -+ /* Save the closest value, to make it easier -+ to reduce in the event of error */ -+ host->overclock_50 = (clock/MHZ); ++ host->cdiv = div; ++ bcm2835_sdhost_write(host, host->cdiv, SDCDIV); + -+ if (clock != host->overclock) { -+ pr_warn("%s: overclocking to %dHz\n", -+ mmc_hostname(host->mmc), clock); -+ host->overclock = clock; -+ } -+ } -+ else if (host->overclock) -+ { -+ host->overclock = 0; -+ if (clock == 50 * MHZ) -+ pr_warn("%s: cancelling overclock\n", -+ mmc_hostname(host->mmc)); ++ if (host->debug) ++ pr_info("%s: clock=%d -> max_clk=%d, cdiv=%x " ++ "(actual clock %d)\n", ++ mmc_hostname(host->mmc), input_clock, ++ host->max_clk, host->cdiv, ++ clock); + } + -+ host->cdiv = div; -+ bcm2835_sdhost_write(host, host->cdiv, SDCDIV); ++ /* Calibrate some delays */ ++ ++ host->ns_per_fifo_word = (1000000000/clock) * ++ ((host->mmc->caps & MMC_CAP_4_BIT_DATA) ? 8 : 32); ++ ++ if (input_clock == 50 * MHZ) { ++ if (clock > input_clock) { ++ /* Save the closest value, to make it easier ++ to reduce in the event of error */ ++ host->overclock_50 = (clock/MHZ); ++ ++ if (clock != host->overclock) { ++ pr_warn("%s: overclocking to %dHz\n", ++ mmc_hostname(host->mmc), clock); ++ host->overclock = clock; ++ } ++ } else if (host->overclock) { ++ host->overclock = 0; ++ if (clock == 50 * MHZ) ++ pr_warn("%s: cancelling overclock\n", ++ mmc_hostname(host->mmc)); ++ } ++ } + + /* Set the timeout to 500ms */ -+ bcm2835_sdhost_write(host, host->mmc->actual_clock/2, SDTOUT); ++ bcm2835_sdhost_write(host, clock/2, SDTOUT); + -+ if (host->debug) -+ pr_info("%s: clock=%d -> max_clk=%d, cdiv=%x (actual clock %d)\n", -+ mmc_hostname(host->mmc), input_clock, -+ host->max_clk, host->cdiv, host->mmc->actual_clock); ++ host->mmc->actual_clock = clock; ++ host->clock = input_clock; ++ host->reset_clock = 0; ++ ++ mmiowb(); ++ spin_unlock_irqrestore(&host->lock, flags); +} + +static void bcm2835_sdhost_request(struct mmc_host *mmc, struct mmc_request *mrq) +{ + struct bcm2835_host *host; + unsigned long flags; ++ u32 edm, fsm; + + host = mmc_priv(mmc); + @@ -72927,6 +73370,8 @@ index 0000000..da089985 + } + + /* Reset the error statuses in case this is a retry */ ++ if (mrq->sbc) ++ mrq->sbc->error = 0; + if (mrq->cmd) + mrq->cmd->error = 0; + if (mrq->data) @@ -72942,28 +73387,61 @@ index 0000000..da089985 + return; + } + ++ if (host->use_dma && mrq->data && ++ (mrq->data->blocks > host->pio_limit)) ++ bcm2835_sdhost_prepare_dma(host, mrq->data); ++ ++ if (host->reset_clock) ++ bcm2835_sdhost_set_clock(host, host->clock); ++ + spin_lock_irqsave(&host->lock, flags); + + WARN_ON(host->mrq != NULL); -+ + host->mrq = mrq; + -+ if (mrq->sbc) -+ bcm2835_sdhost_send_command(host, mrq->sbc); -+ else -+ bcm2835_sdhost_send_command(host, mrq->cmd); ++ edm = bcm2835_sdhost_read(host, SDEDM); ++ fsm = edm & SDEDM_FSM_MASK; + -+ mmiowb(); -+ spin_unlock_irqrestore(&host->lock, flags); ++ log_event("REQ<", (u32)mrq, edm); ++ if ((fsm != SDEDM_FSM_IDENTMODE) && ++ (fsm != SDEDM_FSM_DATAMODE)) { ++ pr_err("%s: previous command (%d) not complete (EDM %x)\n", ++ mmc_hostname(host->mmc), ++ bcm2835_sdhost_read(host, SDCMD) & SDCMD_CMD_MASK, ++ edm); ++ log_event("REQ!", (u32)mrq, edm); ++ log_dump(); ++ bcm2835_sdhost_dumpregs(host); ++ mrq->cmd->error = -EILSEQ; ++ tasklet_schedule(&host->finish_tasklet); ++ mmiowb(); ++ spin_unlock_irqrestore(&host->lock, flags); ++ return; ++ } ++ ++ host->use_sbc = !!mrq->sbc && ++ (host->mrq->data->flags & USE_CMD23_FLAGS); ++ if (host->use_sbc) { ++ if (bcm2835_sdhost_send_command(host, mrq->sbc)) { ++ if (!host->use_busy) ++ bcm2835_sdhost_finish_command(host, &flags); ++ } ++ } else if (bcm2835_sdhost_send_command(host, mrq->cmd)) { ++ if (host->data && host->dma_desc) ++ /* DMA transfer starts now, PIO starts after irq */ ++ bcm2835_sdhost_start_dma(host); + -+ if (!mrq->sbc && mrq->cmd->data && host->use_dma) -+ /* DMA transfer starts now, PIO starts after irq */ -+ bcm2835_sdhost_transfer_dma(host); ++ if (!host->use_busy) ++ bcm2835_sdhost_finish_command(host, &flags); ++ } + -+ if (!host->use_busy) -+ bcm2835_sdhost_finish_command(host); -+} ++ log_event("CMD ", (u32)mrq->cmd->opcode, ++ mrq->data ? (u32)mrq->data->blksz : 0); ++ mmiowb(); + ++ log_event("REQ>", (u32)mrq, 0); ++ spin_unlock_irqrestore(&host->lock, flags); ++} + +static void bcm2835_sdhost_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) +{ @@ -72980,10 +73458,7 @@ index 0000000..da089985 + + spin_lock_irqsave(&host->lock, flags); + -+ if (!ios->clock || ios->clock != host->clock) { -+ bcm2835_sdhost_set_clock(host, ios->clock); -+ host->clock = ios->clock; -+ } ++ log_event("IOS<", ios->clock, 0); + + /* set bus width */ + host->hcfg &= ~SDHCFG_WIDE_EXT_BUS; @@ -73000,46 +73475,58 @@ index 0000000..da089985 + mmiowb(); + + spin_unlock_irqrestore(&host->lock, flags); -+} -+ -+static int bcm2835_sdhost_multi_io_quirk(struct mmc_card *card, -+ unsigned int direction, -+ u32 blk_pos, int blk_size) -+{ -+ /* There is a bug in the host controller hardware that makes -+ reading the final sector of the card as part of a multiple read -+ problematic. Detect that case and shorten the read accordingly. -+ */ -+ /* csd.capacity is in weird units - convert to sectors */ -+ u32 card_sectors = (card->csd.capacity << (card->csd.read_blkbits - 9)); -+ -+ if ((direction == MMC_DATA_READ) && -+ ((blk_pos + blk_size) == card_sectors)) -+ blk_size--; + -+ return blk_size; ++ if (!ios->clock || ios->clock != host->clock) ++ bcm2835_sdhost_set_clock(host, ios->clock); +} + -+ +static struct mmc_host_ops bcm2835_sdhost_ops = { + .request = bcm2835_sdhost_request, + .set_ios = bcm2835_sdhost_set_ios, -+ .enable_sdio_irq = bcm2835_sdhost_enable_sdio_irq, + .hw_reset = bcm2835_sdhost_reset, -+ .multi_io_quirk = bcm2835_sdhost_multi_io_quirk, +}; + ++static void bcm2835_sdhost_cmd_wait_work(struct work_struct *work) ++{ ++ struct bcm2835_host *host; ++ unsigned long flags; ++ ++ host = container_of(work, struct bcm2835_host, cmd_wait_wq); ++ ++ spin_lock_irqsave(&host->lock, flags); ++ ++ log_event("CWK<", (u32)host->cmd, (u32)host->mrq); ++ ++ /* ++ * If this tasklet gets rescheduled while running, it will ++ * be run again afterwards but without any active request. ++ */ ++ if (!host->mrq) { ++ spin_unlock_irqrestore(&host->lock, flags); ++ return; ++ } ++ ++ bcm2835_sdhost_finish_command(host, &flags); ++ ++ mmiowb(); ++ ++ log_event("CWK>", (u32)host->cmd, 0); ++ ++ spin_unlock_irqrestore(&host->lock, flags); ++} + +static void bcm2835_sdhost_tasklet_finish(unsigned long param) +{ + struct bcm2835_host *host; + unsigned long flags; + struct mmc_request *mrq; ++ struct dma_chan *terminate_chan = NULL; + + host = (struct bcm2835_host *)param; + + spin_lock_irqsave(&host->lock, flags); + ++ log_event("TSK<", (u32)host->mrq, 0); + /* + * If this tasklet gets rescheduled while running, it will + * be run again afterwards but without any active request. @@ -73062,7 +73549,7 @@ index 0000000..da089985 + host->overclock_50--; + pr_warn("%s: reducing overclock due to errors\n", + mmc_hostname(host->mmc)); -+ bcm2835_sdhost_set_clock(host,50*MHZ); ++ host->reset_clock = 1; + mrq->cmd->error = -EILSEQ; + mrq->cmd->retries = 1; + } @@ -73074,11 +73561,23 @@ index 0000000..da089985 + + mmiowb(); + ++ host->dma_desc = NULL; ++ terminate_chan = host->dma_chan; ++ host->dma_chan = NULL; ++ + spin_unlock_irqrestore(&host->lock, flags); -+ mmc_request_done(host->mmc, mrq); -+} + ++ if (terminate_chan) ++ { ++ int err = dmaengine_terminate_all(terminate_chan); ++ if (err) ++ pr_err("%s: failed to terminate DMA (%d)\n", ++ mmc_hostname(host->mmc), err); ++ } + ++ mmc_request_done(host->mmc, mrq); ++ log_event("TSK>", (u32)mrq, 0); ++} + +int bcm2835_sdhost_add_host(struct bcm2835_host *host) +{ @@ -73100,39 +73599,57 @@ index 0000000..da089985 + mmc->f_max, mmc->f_min, mmc->max_busy_timeout); + + /* host controller capabilities */ -+ mmc->caps |= /* MMC_CAP_SDIO_IRQ |*/ MMC_CAP_4_BIT_DATA | ++ mmc->caps |= + MMC_CAP_SD_HIGHSPEED | MMC_CAP_MMC_HIGHSPEED | + MMC_CAP_NEEDS_POLL | MMC_CAP_HW_RESET | MMC_CAP_ERASE | -+ (ALLOW_CMD23 * MMC_CAP_CMD23); ++ ((ALLOW_CMD23_READ|ALLOW_CMD23_WRITE) * MMC_CAP_CMD23); + + spin_lock_init(&host->lock); + + if (host->allow_dma) { -+ if (IS_ERR_OR_NULL(host->dma_chan_tx) || -+ IS_ERR_OR_NULL(host->dma_chan_rx)) { -+ pr_err("%s: unable to initialise DMA channels. " ++ if (IS_ERR_OR_NULL(host->dma_chan_rxtx)) { ++ pr_err("%s: unable to initialise DMA channel. " + "Falling back to PIO\n", + mmc_hostname(mmc)); -+ host->have_dma = false; ++ host->use_dma = false; + } else { -+ host->have_dma = true; -+ + cfg.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; + cfg.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; + cfg.slave_id = 13; /* DREQ channel */ + ++ /* Validate the slave configurations */ ++ + cfg.direction = DMA_MEM_TO_DEV; + cfg.src_addr = 0; + cfg.dst_addr = host->bus_addr + SDDATA; -+ ret = dmaengine_slave_config(host->dma_chan_tx, &cfg); + -+ cfg.direction = DMA_DEV_TO_MEM; -+ cfg.src_addr = host->bus_addr + SDDATA; -+ cfg.dst_addr = 0; -+ ret = dmaengine_slave_config(host->dma_chan_rx, &cfg); ++ ret = dmaengine_slave_config(host->dma_chan_rxtx, &cfg); ++ ++ if (ret == 0) { ++ host->dma_cfg_tx = cfg; ++ ++ cfg.direction = DMA_DEV_TO_MEM; ++ cfg.src_addr = host->bus_addr + SDDATA; ++ cfg.dst_addr = 0; ++ ++ ret = dmaengine_slave_config(host->dma_chan_rxtx, &cfg); ++ } ++ ++ if (ret == 0) { ++ host->dma_cfg_rx = cfg; ++ ++ host->use_dma = true; ++ } else { ++ pr_err("%s: unable to configure DMA channel. " ++ "Falling back to PIO\n", ++ mmc_hostname(mmc)); ++ dma_release_channel(host->dma_chan_rxtx); ++ host->dma_chan_rxtx = NULL; ++ host->use_dma = false; ++ } + } + } else { -+ host->have_dma = false; ++ host->use_dma = false; + } + + mmc->max_segs = 128; @@ -73147,16 +73664,15 @@ index 0000000..da089985 + tasklet_init(&host->finish_tasklet, + bcm2835_sdhost_tasklet_finish, (unsigned long)host); + -+ setup_timer(&host->timer, bcm2835_sdhost_timeout, -+ (unsigned long)host); ++ INIT_WORK(&host->cmd_wait_wq, bcm2835_sdhost_cmd_wait_work); + -+ setup_timer(&host->pio_timer, bcm2835_sdhost_pio_timeout, ++ setup_timer(&host->timer, bcm2835_sdhost_timeout, + (unsigned long)host); + + bcm2835_sdhost_init(host, 0); -+ ret = request_threaded_irq(host->irq, bcm2835_sdhost_irq, -+ bcm2835_sdhost_thread_irq, -+ IRQF_SHARED, mmc_hostname(mmc), host); ++ ++ ret = request_irq(host->irq, bcm2835_sdhost_irq, 0 /*IRQF_SHARED*/, ++ mmc_hostname(mmc), host); + if (ret) { + pr_err("%s: failed to request IRQ %d: %d\n", + mmc_hostname(mmc), host->irq, ret); @@ -73167,11 +73683,11 @@ index 0000000..da089985 + mmc_add_host(mmc); + + pio_limit_string[0] = '\0'; -+ if (host->have_dma && (host->pio_limit > 0)) ++ if (host->use_dma && (host->pio_limit > 0)) + sprintf(pio_limit_string, " (>%d)", host->pio_limit); + pr_info("%s: %s loaded - DMA %s%s\n", + mmc_hostname(mmc), DRIVER_NAME, -+ host->have_dma ? "enabled" : "disabled", ++ host->use_dma ? "enabled" : "disabled", + pio_limit_string); + + return 0; @@ -73191,6 +73707,7 @@ index 0000000..da089985 + struct bcm2835_host *host; + struct mmc_host *mmc; + const __be32 *addr; ++ u32 msg[3]; + int ret; + + pr_debug("bcm2835_sdhost_probe\n"); @@ -73202,7 +73719,9 @@ index 0000000..da089985 + host = mmc_priv(mmc); + host->mmc = mmc; + host->pio_timeout = msecs_to_jiffies(500); ++ host->pio_limit = 1; + host->max_delay = 1; /* Warn if over 1ms */ ++ host->allow_dma = 1; + spin_lock_init(&host->lock); + + iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0); @@ -73218,13 +73737,12 @@ index 0000000..da089985 + return -ENODEV; + } + host->bus_addr = be32_to_cpup(addr); ++ log_init(iomem->start - host->bus_addr); + pr_debug(" - ioaddr %lx, iomem->start %lx, bus_addr %lx\n", + (unsigned long)host->ioaddr, + (unsigned long)iomem->start, + (unsigned long)host->bus_addr); + -+ host->allow_dma = ALLOW_DMA; -+ + if (node) { + /* Read any custom properties */ + of_property_read_u32(node, @@ -73236,26 +73754,35 @@ index 0000000..da089985 + of_property_read_u32(node, + "brcm,pio-limit", + &host->pio_limit); -+ host->allow_dma = ALLOW_DMA && ++ host->allow_dma = + !of_property_read_bool(node, "brcm,force-pio"); + host->debug = of_property_read_bool(node, "brcm,debug"); + } + ++ host->dma_chan = NULL; ++ host->dma_desc = NULL; ++ ++ /* Formally recognise the other way of disabling DMA */ ++ if (host->pio_limit == 0x7fffffff) ++ host->allow_dma = false; ++ + if (host->allow_dma) { + if (node) { -+ host->dma_chan_tx = -+ dma_request_slave_channel(dev, "tx"); -+ host->dma_chan_rx = -+ dma_request_slave_channel(dev, "rx"); ++ host->dma_chan_rxtx = ++ dma_request_slave_channel(dev, "rx-tx"); ++ if (!host->dma_chan_rxtx) ++ host->dma_chan_rxtx = ++ dma_request_slave_channel(dev, "tx"); ++ if (!host->dma_chan_rxtx) ++ host->dma_chan_rxtx = ++ dma_request_slave_channel(dev, "rx"); + } else { + dma_cap_mask_t mask; + + dma_cap_zero(mask); + /* we don't care about the channel, any would work */ + dma_cap_set(DMA_SLAVE, mask); -+ host->dma_chan_tx = -+ dma_request_channel(mask, NULL, NULL); -+ host->dma_chan_rx = ++ host->dma_chan_rxtx = + dma_request_channel(mask, NULL, NULL); + } + } @@ -73285,6 +73812,16 @@ index 0000000..da089985 + else + mmc->caps |= MMC_CAP_4_BIT_DATA; + ++ msg[0] = 0; ++ msg[1] = ~0; ++ msg[2] = ~0; ++ ++ rpi_firmware_property(rpi_firmware_get(NULL), ++ RPI_FIRMWARE_SET_SDHOST_CLOCK, ++ &msg, sizeof(msg)); ++ ++ host->firmware_sets_cdiv = (msg[1] != ~0); ++ + ret = bcm2835_sdhost_add_host(host); + if (ret) + goto err; @@ -73325,15 +73862,12 @@ index 0000000..da089985 + return 0; +} + -+ +static const struct of_device_id bcm2835_sdhost_match[] = { + { .compatible = "brcm,bcm2835-sdhost" }, + { } +}; +MODULE_DEVICE_TABLE(of, bcm2835_sdhost_match); + -+ -+ +static struct platform_driver bcm2835_sdhost_driver = { + .probe = bcm2835_sdhost_probe, + .remove = bcm2835_sdhost_remove, @@ -73350,10 +73884,149 @@ index 0000000..da089985 +MODULE_LICENSE("GPL v2"); +MODULE_AUTHOR("Phil Elwell"); -From 8dbb0430386b772f636f474ed45496076d135428 Mon Sep 17 00:00:00 2001 +From 6f2e23aee85a87ba940dd5649a290e4e0a1fd84e Mon Sep 17 00:00:00 2001 +From: Phil Elwell <phil@raspberrypi.org> +Date: Wed, 11 May 2016 12:50:33 +0100 +Subject: [PATCH 038/112] mmc: Add MMC_QUIRK_ERASE_BROKEN for some cards + +Some SD cards have been found that corrupt data when small blocks +are erased. Add a quirk to indicate that ERASE should not be used, +and set it for cards of that type. + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> + +mmc: Apply QUIRK_BROKEN_ERASE to other capacities + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> + +mmc: Add card_quirks module parameter, log quirks + +Use mmc_block.card_quirks to override the quirks for all SD or MMC +cards. The value is a bitfield using the bit positions defined in +include/linux/mmc/card.h. If the module parameter is placed in the +kernel command line (or bootargs) stored on the card then, assuming the +device only has one SD card interface, the override effectively becomes +card-specific. + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> +--- + drivers/mmc/card/block.c | 39 ++++++++++++++++++++++++++++++++++++--- + drivers/mmc/core/core.c | 3 ++- + include/linux/mmc/card.h | 3 +++ + 3 files changed, 41 insertions(+), 4 deletions(-) + +diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c +index b0a2741..9ce8676 100644 +--- a/drivers/mmc/card/block.c ++++ b/drivers/mmc/card/block.c +@@ -132,6 +132,13 @@ enum { + module_param(perdev_minors, int, 0444); + MODULE_PARM_DESC(perdev_minors, "Minors numbers to allocate per device"); + ++/* ++ * Allow quirks to be overridden for the current card ++ */ ++static char *card_quirks; ++module_param(card_quirks, charp, 0644); ++MODULE_PARM_DESC(card_quirks, "Force the use of the indicated quirks (a bitfield)"); ++ + static inline int mmc_blk_part_switch(struct mmc_card *card, + struct mmc_blk_data *md); + static int get_card_status(struct mmc_card *card, u32 *status, int retries); +@@ -2532,6 +2539,17 @@ static const struct mmc_fixup blk_fixups[] = + MMC_FIXUP("V10016", CID_MANFID_KINGSTON, CID_OEMID_ANY, add_quirk_mmc, + MMC_QUIRK_TRIM_BROKEN), + ++ /* ++ * On some Kingston SD cards, multiple erases of less than 64 ++ * sectors can cause corruption. ++ */ ++ MMC_FIXUP("SD16G", 0x41, 0x3432, add_quirk_mmc, ++ MMC_QUIRK_ERASE_BROKEN), ++ MMC_FIXUP("SD32G", 0x41, 0x3432, add_quirk_mmc, ++ MMC_QUIRK_ERASE_BROKEN), ++ MMC_FIXUP("SD64G", 0x41, 0x3432, add_quirk_mmc, ++ MMC_QUIRK_ERASE_BROKEN), ++ + END_FIXUP + }; + +@@ -2539,6 +2557,7 @@ static int mmc_blk_probe(struct mmc_card *card) + { + struct mmc_blk_data *md, *part_md; + char cap_str[10]; ++ char quirk_str[24]; + + /* + * Check that the card supports the command class(es) we need. +@@ -2546,7 +2565,16 @@ static int mmc_blk_probe(struct mmc_card *card) + if (!(card->csd.cmdclass & CCC_BLOCK_READ)) + return -ENODEV; + +- mmc_fixup_device(card, blk_fixups); ++ if (card_quirks) { ++ unsigned long quirks; ++ if (kstrtoul(card_quirks, 0, &quirks) == 0) ++ card->quirks = (unsigned int)quirks; ++ else ++ pr_err("mmc_block: Invalid card_quirks parameter '%s'\n", ++ card_quirks); ++ } ++ else ++ mmc_fixup_device(card, blk_fixups); + + md = mmc_blk_alloc(card); + if (IS_ERR(md)) +@@ -2554,9 +2582,14 @@ static int mmc_blk_probe(struct mmc_card *card) + + string_get_size((u64)get_capacity(md->disk), 512, STRING_UNITS_2, + cap_str, sizeof(cap_str)); +- pr_info("%s: %s %s %s %s\n", ++ if (card->quirks) ++ snprintf(quirk_str, sizeof(quirk_str), ++ " (quirks 0x%08x)", card->quirks); ++ else ++ quirk_str[0] = '\0'; ++ pr_info("%s: %s %s %s%s%s\n", + md->disk->disk_name, mmc_card_id(card), mmc_card_name(card), +- cap_str, md->read_only ? "(ro)" : ""); ++ cap_str, md->read_only ? " (ro)" : "", quirk_str); + + if (mmc_blk_alloc_parts(card, md)) + goto out; +diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c +index 9eba56c..4b1ff84 100644 +--- a/drivers/mmc/core/core.c ++++ b/drivers/mmc/core/core.c +@@ -2253,7 +2253,8 @@ EXPORT_SYMBOL(mmc_erase); + int mmc_can_erase(struct mmc_card *card) + { + if ((card->host->caps & MMC_CAP_ERASE) && +- (card->csd.cmdclass & CCC_ERASE) && card->erase_size) ++ (card->csd.cmdclass & CCC_ERASE) && card->erase_size && ++ !(card->quirks & MMC_QUIRK_ERASE_BROKEN)) + return 1; + return 0; + } +diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h +index eb0151b..fa4e645 100644 +--- a/include/linux/mmc/card.h ++++ b/include/linux/mmc/card.h +@@ -281,6 +281,9 @@ struct mmc_card { + #define MMC_QUIRK_TRIM_BROKEN (1<<12) /* Skip trim */ + + ++#define MMC_QUIRK_ERASE_BROKEN (1<<31) /* Skip erase */ ++ ++ + unsigned int erase_size; /* erase size in sectors */ + unsigned int erase_shift; /* if erase unit is power 2 */ + unsigned int pref_erase; /* in sectors */ + +From b3dfc4d3fd00b16fdde707b9974710ca1378b1b8 Mon Sep 17 00:00:00 2001 From: popcornmix <popcornmix@gmail.com> Date: Wed, 3 Jul 2013 00:31:47 +0100 -Subject: [PATCH 035/170] cma: Add vc_cma driver to enable use of CMA +Subject: [PATCH 039/112] cma: Add vc_cma driver to enable use of CMA MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -73385,7 +74058,7 @@ Signed-off-by: Noralf Trønnes <noralf@tronnes.org> create mode 100644 include/linux/broadcom/vc_cma.h diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig -index a043107..2ba2d82 100644 +index 3ec0766..aec9337 100644 --- a/drivers/char/Kconfig +++ b/drivers/char/Kconfig @@ -4,6 +4,8 @@ @@ -74696,10 +75369,10 @@ index 0000000..be2819d + +#endif /* VC_CMA_H */ -From 1e8eb30b259278ea7ab9d14c66d2fab5f580f73c Mon Sep 17 00:00:00 2001 +From b66d625fcacb21a8529ef74eeb6c33e550d841e6 Mon Sep 17 00:00:00 2001 From: popcornmix <popcornmix@gmail.com> Date: Mon, 26 Mar 2012 22:15:50 +0100 -Subject: [PATCH 036/170] bcm2708: alsa sound driver +Subject: [PATCH 040/112] bcm2708: alsa sound driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -74736,16 +75409,24 @@ Add device to Device Tree. Don't add platform devices when booting in DT mode. Signed-off-by: Noralf Trønnes <noralf@tronnes.org> + +bcm2835: access controls under the audio mutex + +I don't think the ALSA framework provides any kind of automatic +synchronization within the control callbacks. We most likely need +to ensure this manually, so add locking around all access to shared +mutable data. In particular, bcm2835_audio_set_ctls() should +probably always be called under our own audio lock. --- sound/arm/Kconfig | 8 + sound/arm/Makefile | 5 + - sound/arm/bcm2835-ctl.c | 323 +++++++++++++ - sound/arm/bcm2835-pcm.c | 557 +++++++++++++++++++++++ + sound/arm/bcm2835-ctl.c | 350 ++++++++++++++ + sound/arm/bcm2835-pcm.c | 561 +++++++++++++++++++++++ sound/arm/bcm2835-vchiq.c | 902 +++++++++++++++++++++++++++++++++++++ sound/arm/bcm2835.c | 511 +++++++++++++++++++++ sound/arm/bcm2835.h | 167 +++++++ sound/arm/vc_vchi_audioserv_defs.h | 116 +++++ - 8 files changed, 2589 insertions(+) + 8 files changed, 2620 insertions(+) create mode 100755 sound/arm/bcm2835-ctl.c create mode 100755 sound/arm/bcm2835-pcm.c create mode 100755 sound/arm/bcm2835-vchiq.c @@ -74786,10 +75467,10 @@ index 8c0c851..6796d7f 100644 +ccflags-y += -Idrivers/misc/vc04_services -Idrivers/misc/vc04_services/interface/vcos/linuxkernel -D__VCCOREVER__=0x04000000 diff --git a/sound/arm/bcm2835-ctl.c b/sound/arm/bcm2835-ctl.c new file mode 100755 -index 0000000..aad905f +index 0000000..75dc322 --- /dev/null +++ b/sound/arm/bcm2835-ctl.c -@@ -0,0 +1,323 @@ +@@ -0,0 +1,350 @@ +/***************************************************************************** +* Copyright 2011 Broadcom Corporation. All rights reserved. +* @@ -74886,6 +75567,9 @@ index 0000000..aad905f +{ + struct bcm2835_chip *chip = snd_kcontrol_chip(kcontrol); + ++ if (mutex_lock_interruptible(&chip->audio_mutex)) ++ return -EINTR; ++ + BUG_ON(!chip && !(chip->avail_substreams & AVAIL_SUBSTREAMS_MASK)); + + if (kcontrol->private_value == PCM_PLAYBACK_VOLUME) @@ -74895,6 +75579,7 @@ index 0000000..aad905f + else if (kcontrol->private_value == PCM_PLAYBACK_DEVICE) + ucontrol->value.integer.value[0] = chip->dest; + ++ mutex_unlock(&chip->audio_mutex); + return 0; +} + @@ -74904,11 +75589,15 @@ index 0000000..aad905f + struct bcm2835_chip *chip = snd_kcontrol_chip(kcontrol); + int changed = 0; + ++ if (mutex_lock_interruptible(&chip->audio_mutex)) ++ return -EINTR; ++ + if (kcontrol->private_value == PCM_PLAYBACK_VOLUME) { + audio_info("Volume change attempted.. volume = %d new_volume = %d\n", chip->volume, (int)ucontrol->value.integer.value[0]); + if (chip->mute == CTRL_VOL_MUTE) { + /* changed = toggle_mute(chip, CTRL_VOL_UNMUTE); */ -+ return 1; /* should return 0 to signify no change but the mixer takes this as the opposite sign (no idea why) */ ++ changed = 1; /* should return 0 to signify no change but the mixer takes this as the opposite sign (no idea why) */ ++ goto unlock; + } + if (changed + || (ucontrol->value.integer.value[0] != chip2alsa(chip->volume))) { @@ -74934,6 +75623,8 @@ index 0000000..aad905f + printk(KERN_ERR "Failed to set ALSA controls..\n"); + } + ++unlock: ++ mutex_unlock(&chip->audio_mutex); + return changed; +} + @@ -74990,10 +75681,14 @@ index 0000000..aad905f + struct bcm2835_chip *chip = snd_kcontrol_chip(kcontrol); + int i; + ++ if (mutex_lock_interruptible(&chip->audio_mutex)) ++ return -EINTR; ++ + for (i = 0; i < 4; i++) + ucontrol->value.iec958.status[i] = + (chip->spdif_status >> (i * 8)) && 0xff; + ++ mutex_unlock(&chip->audio_mutex); + return 0; +} + @@ -75004,12 +75699,16 @@ index 0000000..aad905f + unsigned int val = 0; + int i, change; + ++ if (mutex_lock_interruptible(&chip->audio_mutex)) ++ return -EINTR; ++ + for (i = 0; i < 4; i++) + val |= (unsigned int)ucontrol->value.iec958.status[i] << (i * 8); + + change = val != chip->spdif_status; + chip->spdif_status = val; + ++ mutex_unlock(&chip->audio_mutex); + return change; +} + @@ -75045,9 +75744,14 @@ index 0000000..aad905f + struct bcm2835_chip *chip = snd_kcontrol_chip(kcontrol); + int i; + ++ if (mutex_lock_interruptible(&chip->audio_mutex)) ++ return -EINTR; ++ + for (i = 0; i < 4; i++) + ucontrol->value.iec958.status[i] = + (chip->spdif_status >> (i * 8)) & 0xff; ++ ++ mutex_unlock(&chip->audio_mutex); + return 0; +} + @@ -75058,11 +75762,15 @@ index 0000000..aad905f + unsigned int val = 0; + int i, change; + ++ if (mutex_lock_interruptible(&chip->audio_mutex)) ++ return -EINTR; ++ + for (i = 0; i < 4; i++) + val |= (unsigned int)ucontrol->value.iec958.status[i] << (i * 8); + change = val != chip->spdif_status; + chip->spdif_status = val; + ++ mutex_unlock(&chip->audio_mutex); + return change; +} + @@ -75115,10 +75823,10 @@ index 0000000..aad905f +} diff --git a/sound/arm/bcm2835-pcm.c b/sound/arm/bcm2835-pcm.c new file mode 100755 -index 0000000..8c86375 +index 0000000..d2de13c --- /dev/null +++ b/sound/arm/bcm2835-pcm.c -@@ -0,0 +1,557 @@ +@@ -0,0 +1,561 @@ +/***************************************************************************** +* Copyright 2011 Broadcom Corporation. All rights reserved. +* @@ -75432,6 +76140,9 @@ index 0000000..8c86375 + + audio_info(" .. IN\n"); + ++ if (mutex_lock_interruptible(&chip->audio_mutex)) ++ return -EINTR; ++ + /* notify the vchiq that it should enter spdif passthrough mode by + * setting channels=0 (see + * https://github.com/raspberrypi/linux/issues/528) */ @@ -75467,6 +76178,7 @@ index 0000000..8c86375 + alsa_stream->buffer_size, alsa_stream->period_size, + alsa_stream->pos, runtime->frame_bits); + ++ mutex_unlock(&chip->audio_mutex); + audio_info(" .. OUT\n"); + return 0; +} @@ -76586,7 +77298,7 @@ index 0000000..3de3094 +MODULE_PARM_DESC(force_bulk, "Force use of vchiq bulk for audio"); diff --git a/sound/arm/bcm2835.c b/sound/arm/bcm2835.c new file mode 100644 -index 0000000..6b545e7 +index 0000000..7a2ed78 --- /dev/null +++ b/sound/arm/bcm2835.c @@ -0,0 +1,511 @@ @@ -76695,7 +77407,7 @@ index 0000000..6b545e7 + numchans); + } + -+ err = snd_card_new(NULL, -1, NULL, THIS_MODULE, 0, &card); ++ err = snd_card_new(&pdev->dev, -1, NULL, THIS_MODULE, 0, &card); + if (err) { + dev_err(dev, "Failed to create soundcard structure\n"); + return err; @@ -76775,7 +77487,7 @@ index 0000000..6b545e7 + if (dev > 0) + goto add_register_map; + -+ err = snd_card_new(NULL, index[dev], id[dev], THIS_MODULE, 0, &g_card); ++ err = snd_card_new(&pdev->dev, index[dev], id[dev], THIS_MODULE, 0, &g_card); + if (err < 0) + goto out; + @@ -77397,10 +78109,10 @@ index 0000000..af3e6eb + +#endif // _VC_AUDIO_DEFS_H_ -From 20c0f57db9cca65943519bd404b3e346958f4544 Mon Sep 17 00:00:00 2001 +From cd1caba5928a0a0e6c8901da2151c83428f03b4f Mon Sep 17 00:00:00 2001 From: popcornmix <popcornmix@gmail.com> Date: Tue, 2 Jul 2013 23:42:01 +0100 -Subject: [PATCH 037/170] bcm2708 vchiq driver +Subject: [PATCH 041/112] bcm2708 vchiq driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -77570,6 +78282,49 @@ vchiq_arm: Sort out the vmalloc case See: https://github.com/raspberrypi/linux/issues/1055 vchiq: hack: Add include depecated dma include file + +vchiq_arm: Tweak the logging output + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> + +vchiq_arm: Access the dequeue_pending flag locked + +Reading through this code looking for another problem (now found in userland) +the use of dequeue_pending outside a lock didn't seem safe. + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> + +vchiq_arm: Service callbacks must not fail + +Service callbacks are not allowed to return an error. The internal callback +that delivers events and messages to user tasks does not enqueue them if +the service is closing, but this is not an error and should not be +reported as such. + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> + +vchiq_arm: do not use page_cache_release(page) macro (#1403) + +This macro is gone since 1fa64f198b9f8d6ec0f7aec7c18dc94684391140. + +Signed-off-by: Slawomir Stepien <sst@poczta.fm> + +vchiq: Upate to match get_user_pages prototype + +vchiq_arm: Add completion records under the mutex + +An issue was observed when flushing openmax components +which generate a large number of messages returning +buffers to host. + +We occasionally found a duplicate message from 16 +messages prior, resulting in a buffer returned twice. + +While only one thread adds completions, without the +mutex you don't get the protection of the automatic +memory barrier you get with synchronisation objects. + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> --- arch/arm/mach-bcm2708/include/mach/platform.h | 2 + arch/arm/mach-bcm2709/include/mach/platform.h | 2 + @@ -77587,13 +78342,13 @@ vchiq: hack: Add include depecated dma include file .../misc/vc04_services/interface/vchiq_arm/vchiq.h | 40 + .../vc04_services/interface/vchiq_arm/vchiq_2835.h | 42 + .../interface/vchiq_arm/vchiq_2835_arm.c | 586 +++ - .../vc04_services/interface/vchiq_arm/vchiq_arm.c | 2903 +++++++++++++++ + .../vc04_services/interface/vchiq_arm/vchiq_arm.c | 2920 +++++++++++++++ .../vc04_services/interface/vchiq_arm/vchiq_arm.h | 220 ++ .../interface/vchiq_arm/vchiq_build_info.h | 37 + .../vc04_services/interface/vchiq_arm/vchiq_cfg.h | 69 + .../interface/vchiq_arm/vchiq_connected.c | 120 + .../interface/vchiq_arm/vchiq_connected.h | 50 + - .../vc04_services/interface/vchiq_arm/vchiq_core.c | 3934 ++++++++++++++++++++ + .../vc04_services/interface/vchiq_arm/vchiq_core.c | 3929 ++++++++++++++++++++ .../vc04_services/interface/vchiq_arm/vchiq_core.h | 712 ++++ .../interface/vchiq_arm/vchiq_debugfs.c | 383 ++ .../interface/vchiq_arm/vchiq_debugfs.h | 52 + @@ -77608,7 +78363,7 @@ vchiq: hack: Add include depecated dma include file .../vc04_services/interface/vchiq_arm/vchiq_util.c | 156 + .../vc04_services/interface/vchiq_arm/vchiq_util.h | 82 + .../interface/vchiq_arm/vchiq_version.c | 59 + - 37 files changed, 12819 insertions(+) + 37 files changed, 12831 insertions(+) create mode 100644 drivers/misc/vc04_services/Kconfig create mode 100644 drivers/misc/vc04_services/Makefile create mode 100644 drivers/misc/vc04_services/interface/vchi/connections/connection.h @@ -77670,10 +78425,10 @@ index 311b9f2..9a638f5 100644 /* * Watchdog diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig -index 22892c7..b859ce0 100644 +index a216b46..90af750 100644 --- a/drivers/misc/Kconfig +++ b/drivers/misc/Kconfig -@@ -533,6 +533,7 @@ source "drivers/misc/lis3lv02d/Kconfig" +@@ -812,6 +812,7 @@ source "drivers/misc/lis3lv02d/Kconfig" source "drivers/misc/altera-stapl/Kconfig" source "drivers/misc/mei/Kconfig" source "drivers/misc/vmw_vmci/Kconfig" @@ -77682,7 +78437,7 @@ index 22892c7..b859ce0 100644 source "drivers/misc/genwqe/Kconfig" source "drivers/misc/echo/Kconfig" diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile -index 537d7f3..ac24d77 100644 +index b2fb6dbf..1a58cf7 100644 --- a/drivers/misc/Makefile +++ b/drivers/misc/Makefile @@ -51,6 +51,7 @@ obj-$(CONFIG_INTEL_MEI) += mei/ @@ -78658,7 +79413,7 @@ index 0000000..1b17e98 +/****************************** End of file **********************************/ diff --git a/drivers/misc/vc04_services/interface/vchi/vchi_cfg.h b/drivers/misc/vc04_services/interface/vchi/vchi_cfg.h new file mode 100644 -index 0000000..26bc2d38 +index 0000000..26bc2d3 --- /dev/null +++ b/drivers/misc/vc04_services/interface/vchi/vchi_cfg.h @@ -0,0 +1,224 @@ @@ -79288,7 +80043,7 @@ index 0000000..7ea5c64 +#endif /* VCHIQ_2835_H */ diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c new file mode 100644 -index 0000000..c29040f +index 0000000..4cb5bff --- /dev/null +++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c @@ -0,0 +1,586 @@ @@ -79714,7 +80469,7 @@ index 0000000..c29040f + *need_release = 0; /* do not try and release vmalloc pages */ + } else { + down_read(&task->mm->mmap_sem); -+ actual_pages = get_user_pages(task, task->mm, ++ actual_pages = get_user_pages( + (unsigned long)buf & ~(PAGE_SIZE - 1), + num_pages, + (type == PAGELIST_READ) /*Write */ , @@ -79733,7 +80488,7 @@ index 0000000..c29040f + while (actual_pages > 0) + { + actual_pages--; -+ page_cache_release(pages[actual_pages]); ++ put_page(pages[actual_pages]); + } + kfree(pagelist); + if (actual_pages == 0) @@ -79872,7 +80627,7 @@ index 0000000..c29040f + offset = 0; + set_page_dirty(pg); + } -+ page_cache_release(pg); ++ put_page(pg); + } + } + @@ -79880,10 +80635,10 @@ index 0000000..c29040f +} diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm.c new file mode 100644 -index 0000000..e11c0e0 +index 0000000..51e6018 --- /dev/null +++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm.c -@@ -0,0 +1,2903 @@ +@@ -0,0 +1,2920 @@ +/** + * Copyright (c) 2014 Raspberry Pi (Trading) Ltd. All rights reserved. + * Copyright (c) 2010-2012 Broadcom. All rights reserved. @@ -80096,6 +80851,8 @@ index 0000000..e11c0e0 + VCHIQ_COMPLETION_DATA_T *completion; + DEBUG_INITIALISE(g_state.local) + ++ mutex_lock(&instance->completion_mutex); ++ + while (instance->completion_insert == + (instance->completion_remove + MAX_COMPLETIONS)) { + /* Out of space - wait for the client */ @@ -80103,14 +80860,20 @@ index 0000000..e11c0e0 + vchiq_log_trace(vchiq_arm_log_level, + "add_completion - completion queue full"); + DEBUG_COUNT(COMPLETION_QUEUE_FULL_COUNT); ++ ++ mutex_unlock(&instance->completion_mutex); + if (down_interruptible(&instance->remove_event) != 0) { + vchiq_log_info(vchiq_arm_log_level, + "service_callback interrupted"); + return VCHIQ_RETRY; -+ } else if (instance->closing) { ++ } ++ ++ mutex_lock(&instance->completion_mutex); ++ if (instance->closing) { ++ mutex_unlock(&instance->completion_mutex); + vchiq_log_info(vchiq_arm_log_level, + "service_callback closing"); -+ return VCHIQ_ERROR; ++ return VCHIQ_SUCCESS; + } + DEBUG_TRACE(SERVICE_CALLBACK_LINE); + } @@ -80140,8 +80903,11 @@ index 0000000..e11c0e0 + if (reason == VCHIQ_MESSAGE_AVAILABLE) + user_service->message_available_pos = + instance->completion_insert; ++ + instance->completion_insert++; + ++ mutex_unlock(&instance->completion_mutex); ++ + up(&instance->insert_event); + + return VCHIQ_SUCCESS; @@ -80165,6 +80931,7 @@ index 0000000..e11c0e0 + USER_SERVICE_T *user_service; + VCHIQ_SERVICE_T *service; + VCHIQ_INSTANCE_T instance; ++ int skip_completion = 0; + DEBUG_INITIALISE(g_state.local) + + DEBUG_TRACE(SERVICE_CALLBACK_LINE); @@ -80231,9 +80998,6 @@ index 0000000..e11c0e0 + user_service->msg_queue[user_service->msg_insert & + (MSG_QUEUE_SIZE - 1)] = header; + user_service->msg_insert++; -+ spin_unlock(&msg_queue_spinlock); -+ -+ up(&user_service->insert_event); + + /* If there is a thread waiting in DEQUEUE_MESSAGE, or if + ** there is a MESSAGE_AVAILABLE in the completion queue then @@ -80242,13 +81006,22 @@ index 0000000..e11c0e0 + if (((user_service->message_available_pos - + instance->completion_remove) >= 0) || + user_service->dequeue_pending) { -+ DEBUG_TRACE(SERVICE_CALLBACK_LINE); + user_service->dequeue_pending = 0; -+ return VCHIQ_SUCCESS; ++ skip_completion = 1; + } + ++ spin_unlock(&msg_queue_spinlock); ++ ++ up(&user_service->insert_event); ++ + header = NULL; + } ++ ++ if (skip_completion) { ++ DEBUG_TRACE(SERVICE_CALLBACK_LINE); ++ return VCHIQ_SUCCESS; ++ } ++ + DEBUG_TRACE(SERVICE_CALLBACK_LINE); + + return add_completion(instance, reason, header, user_service, @@ -81359,8 +82132,7 @@ index 0000000..e11c0e0 + } + + down_read(&current->mm->mmap_sem); -+ rc = get_user_pages(current, /* task */ -+ current->mm, /* mm */ ++ rc = get_user_pages( + (unsigned long)virt_addr, /* start */ + num_pages, /* len */ + 0, /* write */ @@ -81399,7 +82171,7 @@ index 0000000..e11c0e0 + kunmap(page); + + for (page_idx = 0; page_idx < num_pages; page_idx++) -+ page_cache_release(pages[page_idx]); ++ put_page(pages[page_idx]); + + kfree(pages); +} @@ -83315,10 +84087,10 @@ index 0000000..863b3e3 +#endif /* VCHIQ_CONNECTED_H */ diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_core.c b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_core.c new file mode 100644 -index 0000000..2c98da4 +index 0000000..160db24 --- /dev/null +++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_core.c -@@ -0,0 +1,3934 @@ +@@ -0,0 +1,3929 @@ +/** + * Copyright (c) 2010-2012 Broadcom. All rights reserved. + * @@ -84212,16 +84984,14 @@ index 0000000..2c98da4 + error_count); + return VCHIQ_ERROR; + } -+ if (i == 0) { -+ if (SRVTRACE_ENABLED(service, -+ VCHIQ_LOG_INFO)) -+ vchiq_log_dump_mem("Sent", 0, -+ header->data + pos, -+ min(64u, -+ elements[0].size)); -+ } + } + ++ if (SRVTRACE_ENABLED(service, ++ VCHIQ_LOG_INFO)) ++ vchiq_log_dump_mem("Sent", 0, ++ header->data, ++ min(16, pos)); ++ + spin_lock(&quota_spinlock); + service_quota->message_use_count++; + @@ -84360,16 +85130,13 @@ index 0000000..2c98da4 + error_count); + return VCHIQ_ERROR; + } -+ if (i == 0) { -+ if (vchiq_sync_log_level >= -+ VCHIQ_LOG_TRACE) -+ vchiq_log_dump_mem("Sent Sync", -+ 0, header->data + pos, -+ min(64u, -+ elements[0].size)); -+ } + } + ++ if (vchiq_sync_log_level >= VCHIQ_LOG_TRACE) ++ vchiq_log_dump_mem("Sent Sync", ++ 0, header->data, ++ min(16, pos)); ++ + VCHIQ_SERVICE_STATS_INC(service, ctrl_tx_count); + VCHIQ_SERVICE_STATS_ADD(service, ctrl_tx_bytes, size); + } else { @@ -85041,7 +85808,7 @@ index 0000000..2c98da4 + remoteport, localport, size); + if (size > 0) + vchiq_log_dump_mem("Rcvd", 0, header->data, -+ min(64, size)); ++ min(16, size)); + } + + if (((unsigned int)header & VCHIQ_SLOT_MASK) + calc_stride(size) @@ -85508,7 +86275,7 @@ index 0000000..2c98da4 + remoteport, localport, size); + if (size > 0) + vchiq_log_dump_mem("Rcvd", 0, header->data, -+ min(64, size)); ++ min(16, size)); + } + + switch (type) { @@ -90705,10 +91472,10 @@ index 0000000..b6bfa21 + return vchiq_build_time; +} -From 2cabfc660c80dd79f24a8323b3913b5060ebf750 Mon Sep 17 00:00:00 2001 +From 5e58581648c99f1696b84c9e4b8b89eb3c659407 Mon Sep 17 00:00:00 2001 From: popcornmix <popcornmix@gmail.com> Date: Wed, 17 Jun 2015 16:07:06 +0100 -Subject: [PATCH 038/170] vc_mem: Add vc_mem driver +Subject: [PATCH 042/112] vc_mem: Add vc_mem driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -91713,10 +92480,10 @@ index 0000000..20a4753 + +#endif /* _VC_MEM_H */ -From 01574b9e0f1086399e7f796cc1dc8fcadabf4a46 Mon Sep 17 00:00:00 2001 +From 9e8a9f6739d247779cfed83ca57c70c963eaa14e Mon Sep 17 00:00:00 2001 From: Tim Gover <tgover@broadcom.com> Date: Tue, 22 Jul 2014 15:41:04 +0100 -Subject: [PATCH 039/170] vcsm: VideoCore shared memory service for BCM2835 +Subject: [PATCH 043/112] vcsm: VideoCore shared memory service for BCM2835 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -91764,9 +92531,9 @@ Signed-off-by: Noralf Trønnes <noralf@tronnes.org> drivers/char/broadcom/vc_sm/vc_sm_knl.h | 55 + drivers/char/broadcom/vc_sm/vc_vchi_sm.c | 492 +++++ drivers/char/broadcom/vc_sm/vc_vchi_sm.h | 82 + - drivers/char/broadcom/vc_sm/vmcs_sm.c | 3211 ++++++++++++++++++++++++++++++ + drivers/char/broadcom/vc_sm/vmcs_sm.c | 3213 ++++++++++++++++++++++++++++++ include/linux/broadcom/vmcs_sm_ioctl.h | 248 +++ - 9 files changed, 4299 insertions(+) + 9 files changed, 4301 insertions(+) create mode 100644 drivers/char/broadcom/vc_sm/Makefile create mode 100644 drivers/char/broadcom/vc_sm/vc_sm_defs.h create mode 100644 drivers/char/broadcom/vc_sm/vc_sm_knl.h @@ -92662,10 +93429,10 @@ index 0000000..5e279f5 +#endif /* __VC_VCHI_SM_H__INCLUDED__ */ diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c new file mode 100644 -index 0000000..5d16e35 +index 0000000..1db6716 --- /dev/null +++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c -@@ -0,0 +1,3211 @@ +@@ -0,0 +1,3213 @@ +/***************************************************************************** +* Copyright 2011-2012 Broadcom Corporation. All rights reserved. +* @@ -92865,12 +93632,14 @@ index 0000000..5d16e35 +static struct SM_STATE_T *sm_state; +static int sm_inited; + ++#if 0 +static const char *const sm_cache_map_vector[] = { + "(null)", + "host", + "videocore", + "host+videocore", +}; ++#endif + +/* ---- Private Function Prototypes -------------------------------------- */ + @@ -96132,10 +96901,10 @@ index 0000000..334f36d + +#endif /* __VMCS_SM_IOCTL_H__INCLUDED__ */ -From 832077a0f61e44a9259b153f60eb233fa723c2a9 Mon Sep 17 00:00:00 2001 +From a8149b98a7e18684c916b50e54b5b4c365bbe530 Mon Sep 17 00:00:00 2001 From: Luke Wren <luke@raspberrypi.org> Date: Fri, 21 Aug 2015 23:14:48 +0100 -Subject: [PATCH 040/170] Add /dev/gpiomem device for rootless user GPIO access +Subject: [PATCH 044/112] Add /dev/gpiomem device for rootless user GPIO access Signed-off-by: Luke Wren <luke@raspberrypi.org> @@ -96446,10 +97215,10 @@ index 0000000..911f5b7 +MODULE_DESCRIPTION("gpiomem driver for accessing GPIO from userspace"); +MODULE_AUTHOR("Luke Wren <luke@raspberrypi.org>"); -From 6609b15c34f26f34b4b49e7726693a1de321078c Mon Sep 17 00:00:00 2001 +From e4a7770dc5ecfcd28d0caef360659afd54bb95e5 Mon Sep 17 00:00:00 2001 From: Luke Wren <wren6991@gmail.com> Date: Sat, 5 Sep 2015 01:14:45 +0100 -Subject: [PATCH 041/170] Add SMI driver +Subject: [PATCH 045/112] Add SMI driver Signed-off-by: Luke Wren <wren6991@gmail.com> --- @@ -96981,7 +97750,7 @@ index 0000000..d6efd92 + "Character device driver for BCM2835's secondary memory interface"); +MODULE_AUTHOR("Luke Wren <luke@raspberrypi.org>"); diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig -index b859ce0..b978ba9 100644 +index 90af750..7011b2d 100644 --- a/drivers/misc/Kconfig +++ b/drivers/misc/Kconfig @@ -10,6 +10,14 @@ config SENSORS_LIS3LV02D @@ -97000,7 +97769,7 @@ index b859ce0..b978ba9 100644 tristate "Analog Devices Digital Potentiometers" depends on (I2C || SPI) && SYSFS diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile -index ac24d77..1acff5b 100644 +index 1a58cf7..28989fa 100644 --- a/drivers/misc/Makefile +++ b/drivers/misc/Makefile @@ -9,6 +9,7 @@ obj-$(CONFIG_AD525X_DPOT_SPI) += ad525x_dpot-spi.o @@ -98400,18 +99169,18 @@ index 0000000..ee3a75e + +#endif /* BCM2835_SMI_H */ -From f4d44b2c447c401791645627e88d0ef9830c1239 Mon Sep 17 00:00:00 2001 +From 6da5091e686e4c92424fe6d70a96baf54fbcc2fd Mon Sep 17 00:00:00 2001 From: Luke Wren <wren6991@gmail.com> Date: Sat, 5 Sep 2015 01:16:10 +0100 -Subject: [PATCH 042/170] Add SMI NAND driver +Subject: [PATCH 046/112] Add SMI NAND driver Signed-off-by: Luke Wren <wren6991@gmail.com> --- .../bindings/mtd/brcm,bcm2835-smi-nand.txt | 42 ++++ drivers/mtd/nand/Kconfig | 7 + drivers/mtd/nand/Makefile | 1 + - drivers/mtd/nand/bcm2835_smi_nand.c | 268 +++++++++++++++++++++ - 4 files changed, 318 insertions(+) + drivers/mtd/nand/bcm2835_smi_nand.c | 267 +++++++++++++++++++++ + 4 files changed, 317 insertions(+) create mode 100644 Documentation/devicetree/bindings/mtd/brcm,bcm2835-smi-nand.txt create mode 100644 drivers/mtd/nand/bcm2835_smi_nand.c @@ -98465,7 +99234,7 @@ index 0000000..159544d +}; \ No newline at end of file diff --git a/drivers/mtd/nand/Kconfig b/drivers/mtd/nand/Kconfig -index 2896640..56ff00b 100644 +index f05e0e9..8c69541 100644 --- a/drivers/mtd/nand/Kconfig +++ b/drivers/mtd/nand/Kconfig @@ -41,6 +41,13 @@ config MTD_SM_COMMON @@ -98483,7 +99252,7 @@ index 2896640..56ff00b 100644 tristate diff --git a/drivers/mtd/nand/Makefile b/drivers/mtd/nand/Makefile -index 2c7f014b..30e22f0 100644 +index f553353..ea8d647 100644 --- a/drivers/mtd/nand/Makefile +++ b/drivers/mtd/nand/Makefile @@ -14,6 +14,7 @@ obj-$(CONFIG_MTD_NAND_DENALI) += denali.o @@ -98496,10 +99265,10 @@ index 2c7f014b..30e22f0 100644 obj-$(CONFIG_MTD_NAND_DAVINCI) += davinci_nand.o diff --git a/drivers/mtd/nand/bcm2835_smi_nand.c b/drivers/mtd/nand/bcm2835_smi_nand.c new file mode 100644 -index 0000000..b747326 +index 0000000..02adda6 --- /dev/null +++ b/drivers/mtd/nand/bcm2835_smi_nand.c -@@ -0,0 +1,268 @@ +@@ -0,0 +1,267 @@ +/** + * NAND flash driver for Broadcom Secondary Memory Interface + * @@ -98692,7 +99461,6 @@ index 0000000..b747326 + mtd->owner = THIS_MODULE; + mtd->dev.parent = dev; + mtd->name = DRIVER_NAME; -+ ppdata.of_node = node; + + /* 20 us command delay time... */ + this->chip_delay = 20; @@ -98769,10 +99537,10 @@ index 0000000..b747326 + ("Driver for NAND chips using Broadcom Secondary Memory Interface"); +MODULE_AUTHOR("Luke Wren <luke@raspberrypi.org>"); -From 2faad8f6644fa53418c5a7b80da8d5400b72df3f Mon Sep 17 00:00:00 2001 +From d294fc10d2c2d93dd5280e2ef30f4b6dfa7ad3bf Mon Sep 17 00:00:00 2001 From: Aron Szabo <aron@aron.ws> Date: Sat, 16 Jun 2012 12:15:55 +0200 -Subject: [PATCH 043/170] lirc: added support for RaspberryPi GPIO +Subject: [PATCH 047/112] lirc: added support for RaspberryPi GPIO lirc_rpi: Use read_current_timer to determine transmitter delay. Thanks to jjmz and others See: https://github.com/raspberrypi/linux/issues/525 @@ -98857,7 +99625,7 @@ index 5430adf..9e53cd0 100644 obj-$(CONFIG_LIRC_SIR) += lirc_sir.o diff --git a/drivers/staging/media/lirc/lirc_rpi.c b/drivers/staging/media/lirc/lirc_rpi.c new file mode 100644 -index 0000000..cd09c99 +index 0000000..0624439 --- /dev/null +++ b/drivers/staging/media/lirc/lirc_rpi.c @@ -0,0 +1,730 @@ @@ -99134,7 +99902,7 @@ index 0000000..cd09c99 + data = PULSE_MASK; /* really long time */ + if (!(signal^sense)) { + /* sanity check */ -+ printk(KERN_WARNING LIRC_DRIVER_NAME ++ printk(KERN_DEBUG LIRC_DRIVER_NAME + ": AIEEEE: %d %d %lx %lx %lx %lx\n", + signal, sense, tv.tv_sec, lasttv.tv_sec, + tv.tv_usec, lasttv.tv_usec); @@ -99621,10 +100389,10 @@ index 0000000..fb69624 + +#endif -From 3c7ea37319a4974cbf6b89a84c109a53f4d6b408 Mon Sep 17 00:00:00 2001 +From 2fd607ce8d6e45776c6f6d750dc5e167d8865f54 Mon Sep 17 00:00:00 2001 From: popcornmix <popcornmix@gmail.com> Date: Wed, 3 Jul 2013 00:49:20 +0100 -Subject: [PATCH 044/170] Add cpufreq driver +Subject: [PATCH 048/112] Add cpufreq driver Signed-off-by: popcornmix <popcornmix@gmail.com> --- @@ -99635,12 +100403,12 @@ Signed-off-by: popcornmix <popcornmix@gmail.com> create mode 100644 drivers/cpufreq/bcm2835-cpufreq.c diff --git a/drivers/cpufreq/Kconfig.arm b/drivers/cpufreq/Kconfig.arm -index b1f8a73..930b3ef 100644 +index 14b1f93..c6e8bd5 100644 --- a/drivers/cpufreq/Kconfig.arm +++ b/drivers/cpufreq/Kconfig.arm -@@ -217,6 +217,15 @@ config ARM_SPEAR_CPUFREQ - help - This adds the CPUFreq driver support for SPEAr SOCs. +@@ -229,6 +229,15 @@ config ARM_STI_CPUFREQ + this config option if you wish to add CPUFreq support for STi based + SoCs. +config ARM_BCM2835_CPUFREQ + depends on RASPBERRYPI_FIRMWARE @@ -99655,13 +100423,13 @@ index b1f8a73..930b3ef 100644 bool "Tegra20 CPUFreq support" depends on ARCH_TEGRA diff --git a/drivers/cpufreq/Makefile b/drivers/cpufreq/Makefile -index c0af1a1..f6a753a 100644 +index 9e63fb1..9e55083 100644 --- a/drivers/cpufreq/Makefile +++ b/drivers/cpufreq/Makefile -@@ -73,6 +73,7 @@ obj-$(CONFIG_ARM_SA1100_CPUFREQ) += sa1100-cpufreq.o - obj-$(CONFIG_ARM_SA1110_CPUFREQ) += sa1110-cpufreq.o +@@ -74,6 +74,7 @@ obj-$(CONFIG_ARM_SA1110_CPUFREQ) += sa1110-cpufreq.o obj-$(CONFIG_ARM_SCPI_CPUFREQ) += scpi-cpufreq.o obj-$(CONFIG_ARM_SPEAR_CPUFREQ) += spear-cpufreq.o + obj-$(CONFIG_ARM_STI_CPUFREQ) += sti-cpufreq.o +obj-$(CONFIG_ARM_BCM2835_CPUFREQ) += bcm2835-cpufreq.o obj-$(CONFIG_ARM_TEGRA20_CPUFREQ) += tegra20-cpufreq.o obj-$(CONFIG_ARM_TEGRA124_CPUFREQ) += tegra124-cpufreq.o @@ -99886,10 +100654,10 @@ index 0000000..3eb9e93 +module_init(bcm2835_cpufreq_module_init); +module_exit(bcm2835_cpufreq_module_exit); -From 776e87ffc8b137ea465e7b0076e56cd71d9c56d1 Mon Sep 17 00:00:00 2001 +From aed691d5d3e8bd608d947a963c71413b068f4575 Mon Sep 17 00:00:00 2001 From: popcornmix <popcornmix@gmail.com> Date: Tue, 26 Mar 2013 19:24:24 +0000 -Subject: [PATCH 045/170] Added hwmon/thermal driver for reporting core +Subject: [PATCH 049/112] Added hwmon/thermal driver for reporting core temperature. Thanks Dorian MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -99903,17 +100671,17 @@ Don't add platform device when booting in DT mode. Signed-off-by: Noralf Trønnes <noralf@tronnes.org> --- - drivers/thermal/Kconfig | 7 ++ + drivers/thermal/Kconfig | 7 +++ drivers/thermal/Makefile | 1 + - drivers/thermal/bcm2835-thermal.c | 141 ++++++++++++++++++++++++++++++++++++++ - 3 files changed, 149 insertions(+) + drivers/thermal/bcm2835-thermal.c | 109 ++++++++++++++++++++++++++++++++++++++ + 3 files changed, 117 insertions(+) create mode 100644 drivers/thermal/bcm2835-thermal.c diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig -index 8cc4ac6..b273311 100644 +index 3c3dc4a..6789340 100644 --- a/drivers/thermal/Kconfig +++ b/drivers/thermal/Kconfig -@@ -285,6 +285,13 @@ config INTEL_POWERCLAMP +@@ -292,6 +292,13 @@ config INTEL_POWERCLAMP enforce idle time which results in more package C-state residency. The user interface is exposed via generic thermal framework. @@ -99928,7 +100696,7 @@ index 8cc4ac6..b273311 100644 tristate "X86 package temperature thermal driver" depends on X86_THERMAL_VECTOR diff --git a/drivers/thermal/Makefile b/drivers/thermal/Makefile -index cfae6a6..b0e336f 100644 +index 8e9cbc3..497014c 100644 --- a/drivers/thermal/Makefile +++ b/drivers/thermal/Makefile @@ -38,6 +38,7 @@ obj-$(CONFIG_ARMADA_THERMAL) += armada_thermal.o @@ -99941,10 +100709,10 @@ index cfae6a6..b0e336f 100644 obj-$(CONFIG_INTEL_SOC_DTS_THERMAL) += intel_soc_dts_thermal.o diff --git a/drivers/thermal/bcm2835-thermal.c b/drivers/thermal/bcm2835-thermal.c new file mode 100644 -index 0000000..08d8dc7 +index 0000000..c63fb9f --- /dev/null +++ b/drivers/thermal/bcm2835-thermal.c -@@ -0,0 +1,141 @@ +@@ -0,0 +1,109 @@ +/***************************************************************************** +* Copyright 2011 Broadcom Corporation. All rights reserved. +* @@ -99996,38 +100764,8 @@ index 0000000..08d8dc7 + RPI_FIRMWARE_GET_TEMPERATURE); +} + -+static int bcm2835_thermal_get_max_temp(struct thermal_zone_device *tz, -+ int trip, int *temp) -+{ -+ /* -+ * The maximum safe temperature of the SoC. -+ * Overclock may be disabled above this temperature. -+ */ -+ return bcm2835_thermal_get_property(tz, temp, -+ RPI_FIRMWARE_GET_MAX_TEMPERATURE); -+} -+ -+static int bcm2835_thermal_get_trip_type(struct thermal_zone_device *tz, -+ int trip, enum thermal_trip_type *type) -+{ -+ *type = THERMAL_TRIP_HOT; -+ -+ return 0; -+} -+ -+static int bcm2835_thermal_get_mode(struct thermal_zone_device *tz, -+ enum thermal_device_mode *mode) -+{ -+ *mode = THERMAL_DEVICE_ENABLED; -+ -+ return 0; -+} -+ +static struct thermal_zone_device_ops ops = { + .get_temp = bcm2835_thermal_get_temp, -+ .get_trip_temp = bcm2835_thermal_get_max_temp, -+ .get_trip_type = bcm2835_thermal_get_trip_type, -+ .get_mode = bcm2835_thermal_get_mode, +}; + +static int bcm2835_thermal_probe(struct platform_device *pdev) @@ -100037,17 +100775,15 @@ index 0000000..08d8dc7 + struct thermal_zone_device *tz; + + fw_np = of_parse_phandle(pdev->dev.of_node, "firmware", 0); -+/* Remove comment when booting without Device Tree is no longer supported + if (!fw_np) { + dev_err(&pdev->dev, "Missing firmware node\n"); + return -ENOENT; + } -+*/ + fw = rpi_firmware_get(fw_np); + if (!fw) + return -EPROBE_DEFER; + -+ tz = thermal_zone_device_register("bcm2835_thermal", 1, 0, fw, &ops, ++ tz = thermal_zone_device_register("bcm2835_thermal", 0, 0, fw, &ops, + NULL, 0, 0); + if (IS_ERR(tz)) { + dev_err(&pdev->dev, "Failed to register the thermal device\n"); @@ -100087,10 +100823,10 @@ index 0000000..08d8dc7 +MODULE_DESCRIPTION("Thermal driver for bcm2835 chip"); +MODULE_LICENSE("GPL"); -From 72181304010d3aa74cd2b98db592554a541ce4c2 Mon Sep 17 00:00:00 2001 +From 61031ab34cccd4b7be3198a2b91bd585caceed78 Mon Sep 17 00:00:00 2001 From: popcornmix <popcornmix@gmail.com> Date: Wed, 17 Jun 2015 15:44:08 +0100 -Subject: [PATCH 046/170] Add Chris Boot's i2c driver +Subject: [PATCH 050/112] Add Chris Boot's i2c driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -100171,15 +100907,17 @@ validity of the chip_select value. i2c-bcm2708: Remove non-DT support Signed-off-by: Noralf Trønnes <noralf@tronnes.org> + +Set the BSC_CLKT clock streching timeout to 35ms as per SMBus specs. --- drivers/i2c/busses/Kconfig | 21 +- drivers/i2c/busses/Makefile | 2 + - drivers/i2c/busses/i2c-bcm2708.c | 493 +++++++++++++++++++++++++++++++++++++++ - 3 files changed, 515 insertions(+), 1 deletion(-) + drivers/i2c/busses/i2c-bcm2708.c | 508 +++++++++++++++++++++++++++++++++++++++ + 3 files changed, 530 insertions(+), 1 deletion(-) create mode 100644 drivers/i2c/busses/i2c-bcm2708.c diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig -index 7b0aa82..effadb0 100644 +index 0967e1a..c11fce1 100644 --- a/drivers/i2c/busses/Kconfig +++ b/drivers/i2c/busses/Kconfig @@ -8,6 +8,25 @@ menu "I2C Hardware Bus support" @@ -100232,10 +100970,10 @@ index 37f2819..e309579 100644 diff --git a/drivers/i2c/busses/i2c-bcm2708.c b/drivers/i2c/busses/i2c-bcm2708.c new file mode 100644 -index 0000000..85f411c +index 0000000..c9b8e5c --- /dev/null +++ b/drivers/i2c/busses/i2c-bcm2708.c -@@ -0,0 +1,493 @@ +@@ -0,0 +1,508 @@ +/* + * Driver for Broadcom BCM2708 BSC Controllers + * @@ -100309,7 +101047,7 @@ index 0000000..85f411c + +#define DRV_NAME "bcm2708_i2c" + -+static unsigned int baudrate = CONFIG_I2C_BCM2708_BAUDRATE; ++static unsigned int baudrate; +module_param(baudrate, uint, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP); +MODULE_PARM_DESC(baudrate, "The I2C baudrate"); + @@ -100325,6 +101063,7 @@ index 0000000..85f411c + int irq; + struct clk *clk; + u32 cdiv; ++ u32 clk_tout; + + struct completion done; + @@ -100364,7 +101103,7 @@ index 0000000..85f411c + +static inline int bcm2708_bsc_setup(struct bcm2708_i2c *bi) +{ -+ u32 cdiv, s; ++ u32 cdiv, s, clk_tout; + u32 c = BSC_C_I2CEN | BSC_C_INTD | BSC_C_ST | BSC_C_CLEAR_1; + int wait_loops = I2C_WAIT_LOOP_COUNT; + @@ -100372,12 +101111,14 @@ index 0000000..85f411c + * Use the value that we cached in the probe. + */ + cdiv = bi->cdiv; ++ clk_tout = bi->clk_tout; + + if (bi->msg->flags & I2C_M_RD) + c |= BSC_C_INTR | BSC_C_READ; + else + c |= BSC_C_INTT; + ++ bcm2708_wr(bi, BSC_CLKT, clk_tout); + bcm2708_wr(bi, BSC_DIV, cdiv); + bcm2708_wr(bi, BSC_A, bi->msg->addr); + bcm2708_wr(bi, BSC_DLEN, bi->msg->len); @@ -100550,7 +101291,10 @@ index 0000000..85f411c + struct bcm2708_i2c *bi; + struct i2c_adapter *adap; + unsigned long bus_hz; -+ u32 cdiv; ++ u32 cdiv, clk_tout; ++ u32 baud; ++ ++ baud = CONFIG_I2C_BCM2708_BAUDRATE; + + if (pdev->dev.of_node) { + u32 bus_clk_rate; @@ -100561,12 +101305,15 @@ index 0000000..85f411c + } + if (!of_property_read_u32(pdev->dev.of_node, + "clock-frequency", &bus_clk_rate)) -+ baudrate = bus_clk_rate; ++ baud = bus_clk_rate; + else + dev_warn(&pdev->dev, + "Could not read clock-frequency property\n"); + } + ++ if (baudrate) ++ baud = baudrate; ++ + regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!regs) { + dev_err(&pdev->dev, "could not get IO memory\n"); @@ -100650,15 +101397,21 @@ index 0000000..85f411c + } + + bus_hz = clk_get_rate(bi->clk); -+ cdiv = bus_hz / baudrate; ++ cdiv = bus_hz / baud; + if (cdiv > 0xffff) { + cdiv = 0xffff; -+ baudrate = bus_hz / cdiv; ++ baud = bus_hz / cdiv; + } ++ ++ clk_tout = 35/1000*baud; //35ms timeout as per SMBus specs. ++ if (clk_tout > 0xffff) ++ clk_tout = 0xffff; ++ + bi->cdiv = cdiv; ++ bi->clk_tout = clk_tout; + + dev_info(&pdev->dev, "BSC%d Controller at 0x%08lx (irq %d) (baudrate %d)\n", -+ pdev->id, (unsigned long)regs->start, irq, baudrate); ++ pdev->id, (unsigned long)regs->start, irq, baud); + + return 0; + @@ -100730,10 +101483,10 @@ index 0000000..85f411c +MODULE_LICENSE("GPL v2"); +MODULE_ALIAS("platform:" DRV_NAME); -From abcf04d54ccb3d0897b1f7a95ddf9d9ccf63dc76 Mon Sep 17 00:00:00 2001 +From 299b995c56f17d7b8b67cb128f170f7f552e7b54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= <noralf@tronnes.org> Date: Fri, 26 Jun 2015 14:27:06 +0200 -Subject: [PATCH 047/170] char: broadcom: Add vcio module +Subject: [PATCH 051/112] char: broadcom: Add vcio module MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -100959,10 +101712,10 @@ index 0000000..c19bc20 +MODULE_DESCRIPTION("Mailbox userspace access"); +MODULE_LICENSE("GPL"); -From a205e934b63b6bf3f5f74bc39974ec6ff09df596 Mon Sep 17 00:00:00 2001 +From ae4644ff503855f8f68767d92b9abbf9ffa7c5bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= <noralf@tronnes.org> Date: Fri, 26 Jun 2015 14:25:01 +0200 -Subject: [PATCH 048/170] firmware: bcm2835: Support ARCH_BCM270x +Subject: [PATCH 052/112] firmware: bcm2835: Support ARCH_BCM270x MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -101068,10 +101821,10 @@ index dd506cd3..b980d53 100644 MODULE_AUTHOR("Eric Anholt <eric@anholt.net>"); MODULE_DESCRIPTION("Raspberry Pi firmware driver"); -From 4d74ee3d433df319ae3fc36bd16fd96b4bbff865 Mon Sep 17 00:00:00 2001 +From fcaa83d6edd872b393cad689acf8b1975af74867 Mon Sep 17 00:00:00 2001 From: Vincent Sanders <vincent.sanders@collabora.co.uk> Date: Wed, 30 Jan 2013 12:45:18 +0000 -Subject: [PATCH 049/170] bcm2835: add v4l2 camera device +Subject: [PATCH 053/112] bcm2835: add v4l2 camera device - Supports raw YUV capture, preview, JPEG and H264. - Uses videobuf2 for data transfer, using dma_buf. @@ -101348,25 +102101,120 @@ are now returned as they are being flushed on stop_streaming. squash: Fixup bcm2835-camera for changes in kernel 4.4 api + +v4l2: Fix up driver to upstream timestamp changes + +bcm2835-camera: fix a bug in computation of frame timestamp + +Fixes #1318 + +V4L2 driver updates (#1393) + +* BCM2835-V4L2: Correct ISO control and add V4L2_CID_ISO_SENSITIVITY_AUTO + +https://github.com/raspberrypi/linux/issues/1251 + +V4L2_CID_ISO_SENSITIVITY was not advertising ISO*1000 as it should. +V4L2_CID_ISO_SENSITIVITY_AUTO was not implemented, so was taking +V4L2_CID_ISO_SENSITIVITY as 0 for auto mode. +Still accepts 0 for auto, but also abides by the new parameter. + +Signed-off-by: Dave Stevenson <6by9@users.noreply.github.com> + +* BCM2835-V4L2: Add a video_nr parameter. + +Adds a kernel parameter "video_nr" to specify the preferred +/dev/videoX device node. +https://www.raspberrypi.org/forums/viewtopic.php?f=38&t=136120&p=905545 + +Signed-off-by: Dave Stevenson <6by9@users.noreply.github.com> + +* BCM2835-V4L2: Add support for multiple cameras + +Ask GPU on load how many cameras have been detected, and +enumerate that number of devices. +Only applicable on the Compute Module as no other device +exposes multiple CSI2 interfaces. + +Signed-off-by: Dave Stevenson <6by9@users.noreply.github.com> + +* BCM2835-V4L2: Add control of the overlay location and alpha. + +Actually do something useful in vidioc_s_fmt_vid_overlay and +vidioc_try_fmt_vid_overlay, rather than effectively having +read-only fields. + +Signed-off-by: Dave Stevenson <6by9@users.noreply.github.com> + +* BCM2835-V4L2: V4L2-Compliance failure fix + +VIDIOC_TRY_FMT was failing due to bytesperline not +being set correctly by default. + +Signed-off-by: Dave Stevenson <6by9@users.noreply.github.com> + +* BCM2835-V4L2: Make all module parameters static + +Clean up to correct variable scope + +Signed-off-by: Dave Stevenson <6by9@users.noreply.github.com> + +V4L2: Request maximum resolution from GPU + +Get resolution information about the sensors from the GPU +and advertise it correctly. + +Signed-off-by: Dave Stevenson <6by9@users.noreply.github.com> + +BCM2835-V4L2: Increase minimum resolution to 32x32 + +https://github.com/raspberrypi/linux/issues/1498 showed +up that 16x16 is failing to work on the GPU for some reason. + +GPU bug being tracked on +https://github.com/raspberrypi/firmware/issues/607 +Workaround here by increasing minimum resolution via V4L2 +to 32x32. + +Signed-off-by: Dave Stevenson <6by9@users.noreply.github.com> + +[media]: bcm2835-camera: fix compilation error + +There is an error when compiling rpi-4.6.y branch: + CC [M] drivers/media/platform/bcm2835/bcm2835-camera.o +drivers/media/platform/bcm2835/bcm2835-camera.c:639:17: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types] + .queue_setup = queue_setup, + ^ +drivers/media/platform/bcm2835/bcm2835-camera.c:639:17: note: (near initialization for 'bm2835_mmal_video_qops.queue_setup') + +The const void *parg in setup_queue callback is not needed since commit: +df9ecb0cad14b952a2865f8b3af86b2bbadfab45. +This commit removes it. + +Signed-off-by: Slawomir Stepien <sst@poczta.fm> + +bcm2835-camera: Fix max/min error when looping over cameras/resolutions + +See: https://github.com/raspberrypi/linux/issues/1447#issuecomment-221303506 --- Documentation/video4linux/bcm2835-v4l2.txt | 60 + drivers/media/platform/Kconfig | 2 + drivers/media/platform/Makefile | 2 + drivers/media/platform/bcm2835/Kconfig | 25 + drivers/media/platform/bcm2835/Makefile | 5 + - drivers/media/platform/bcm2835/bcm2835-camera.c | 1844 +++++++++++++++++++++ - drivers/media/platform/bcm2835/bcm2835-camera.h | 126 ++ - drivers/media/platform/bcm2835/controls.c | 1324 +++++++++++++++ + drivers/media/platform/bcm2835/bcm2835-camera.c | 1982 ++++++++++++++++++++++ + drivers/media/platform/bcm2835/bcm2835-camera.h | 144 ++ + drivers/media/platform/bcm2835/controls.c | 1345 +++++++++++++++ drivers/media/platform/bcm2835/mmal-common.h | 53 + drivers/media/platform/bcm2835/mmal-encodings.h | 127 ++ drivers/media/platform/bcm2835/mmal-msg-common.h | 50 + drivers/media/platform/bcm2835/mmal-msg-format.h | 81 + drivers/media/platform/bcm2835/mmal-msg-port.h | 107 ++ drivers/media/platform/bcm2835/mmal-msg.h | 404 +++++ - drivers/media/platform/bcm2835/mmal-parameters.h | 656 ++++++++ - drivers/media/platform/bcm2835/mmal-vchiq.c | 1916 ++++++++++++++++++++++ + drivers/media/platform/bcm2835/mmal-parameters.h | 689 ++++++++ + drivers/media/platform/bcm2835/mmal-vchiq.c | 1916 +++++++++++++++++++++ drivers/media/platform/bcm2835/mmal-vchiq.h | 178 ++ - 17 files changed, 6960 insertions(+) + 17 files changed, 7170 insertions(+) create mode 100644 Documentation/video4linux/bcm2835-v4l2.txt create mode 100644 drivers/media/platform/bcm2835/Kconfig create mode 100644 drivers/media/platform/bcm2835/Makefile @@ -101450,7 +102298,7 @@ index 0000000..c585a8f + +$ v4l2-ctl --list-formats diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig -index ccbc974..63c9715 100644 +index 201f5c2..b798ab8 100644 --- a/drivers/media/platform/Kconfig +++ b/drivers/media/platform/Kconfig @@ -11,6 +11,8 @@ menuconfig V4L_PLATFORM_DRIVERS @@ -101463,7 +102311,7 @@ index ccbc974..63c9715 100644 config VIDEO_VIA_CAMERA diff --git a/drivers/media/platform/Makefile b/drivers/media/platform/Makefile -index efa0295..8c0b3b5 100644 +index bbb7bd1..6fe5b3f 100644 --- a/drivers/media/platform/Makefile +++ b/drivers/media/platform/Makefile @@ -2,6 +2,8 @@ @@ -101472,9 +102320,9 @@ index efa0295..8c0b3b5 100644 +obj-$(CONFIG_VIDEO_BCM2835) += bcm2835/ + - obj-$(CONFIG_VIDEO_TIMBERDALE) += timblogiw.o obj-$(CONFIG_VIDEO_M32R_AR_M64278) += arv.o + obj-$(CONFIG_VIDEO_VIA_CAMERA) += via-camera.o diff --git a/drivers/media/platform/bcm2835/Kconfig b/drivers/media/platform/bcm2835/Kconfig new file mode 100644 index 0000000..99a5cbc @@ -101519,10 +102367,10 @@ index 0000000..f17c79c +ccflags-$(CONFIG_VIDEO_BCM2835) += -Idrivers/misc/vc04_services -Idrivers/misc/vc04_services/interface/vcos/linuxkernel -D__VCCOREVER__=0x04000000 diff --git a/drivers/media/platform/bcm2835/bcm2835-camera.c b/drivers/media/platform/bcm2835/bcm2835-camera.c new file mode 100644 -index 0000000..e83334c +index 0000000..1b16c63 --- /dev/null +++ b/drivers/media/platform/bcm2835/bcm2835-camera.c -@@ -0,0 +1,1844 @@ +@@ -0,0 +1,1982 @@ +/* + * Broadcom BM2835 V4L2 driver + * @@ -101561,15 +102409,15 @@ index 0000000..e83334c + +#define BM2835_MMAL_VERSION "0.0.2" +#define BM2835_MMAL_MODULE_NAME "bcm2835-v4l2" -+#define MIN_WIDTH 16 -+#define MIN_HEIGHT 16 -+#define MAX_WIDTH 2592 -+#define MAX_HEIGHT 1944 ++#define MIN_WIDTH 32 ++#define MIN_HEIGHT 32 +#define MIN_BUFFER_SIZE (80*1024) + +#define MAX_VIDEO_MODE_WIDTH 1280 +#define MAX_VIDEO_MODE_HEIGHT 720 + ++#define MAX_BCM2835_CAMERAS 2 ++ +MODULE_DESCRIPTION("Broadcom 2835 MMAL video capture"); +MODULE_AUTHOR("Vincent Sanders"); +MODULE_LICENSE("GPL"); @@ -101579,8 +102427,13 @@ index 0000000..e83334c +module_param_named(debug, bcm2835_v4l2_debug, int, 0644); +MODULE_PARM_DESC(bcm2835_v4l2_debug, "Debug level 0-2"); + -+int max_video_width = MAX_VIDEO_MODE_WIDTH; -+int max_video_height = MAX_VIDEO_MODE_HEIGHT; ++#define UNSET (-1) ++static int video_nr[] = {[0 ... (MAX_BCM2835_CAMERAS - 1)] = UNSET }; ++module_param_array(video_nr, int, NULL, 0644); ++MODULE_PARM_DESC(video_nr, "videoX start numbers, -1 is autodetect"); ++ ++static int max_video_width = MAX_VIDEO_MODE_WIDTH; ++static int max_video_height = MAX_VIDEO_MODE_HEIGHT; +module_param(max_video_width, int, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); +MODULE_PARM_DESC(max_video_width, "Threshold for video mode"); +module_param(max_video_height, int, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); @@ -101595,11 +102448,12 @@ index 0000000..e83334c + * our function table list (actually switch to an alternate set, but same + * result). + */ -+int gst_v4l2src_is_broken = 0; ++static int gst_v4l2src_is_broken; +module_param(gst_v4l2src_is_broken, int, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); +MODULE_PARM_DESC(gst_v4l2src_is_broken, "If non-zero, enable workaround for Gstreamer"); + -+static struct bm2835_mmal_dev *gdev; /* global device data */ ++/* global device data array */ ++static struct bm2835_mmal_dev *gdev[MAX_BCM2835_CAMERAS]; + +#define FPS_MIN 1 +#define FPS_MAX 90 @@ -101761,7 +102615,7 @@ index 0000000..e83334c + Videobuf queue operations + ------------------------------------------------------------------*/ + -+static int queue_setup(struct vb2_queue *vq, const void *parg, ++static int queue_setup(struct vb2_queue *vq, + unsigned int *nbuffers, unsigned int *nplanes, + unsigned int sizes[], void *alloc_ctxs[]) +{ @@ -101877,6 +102731,7 @@ index 0000000..e83334c + if (dev->capture.frame_count) { + if (dev->capture.vc_start_timestamp != -1 && + pts != 0) { ++ struct timeval timestamp; + s64 runtime_us = pts - + dev->capture.vc_start_timestamp; + u32 div = 0; @@ -101884,16 +102739,15 @@ index 0000000..e83334c + + div = + div_u64_rem(runtime_us, USEC_PER_SEC, &rem); -+ buf->vb.timestamp.tv_sec = -+ dev->capture.kernel_start_ts.tv_sec - 1 + -+ div; -+ buf->vb.timestamp.tv_usec = ++ timestamp.tv_sec = ++ dev->capture.kernel_start_ts.tv_sec + div; ++ timestamp.tv_usec = + dev->capture.kernel_start_ts.tv_usec + rem; + -+ if (buf->vb.timestamp.tv_usec >= ++ if (timestamp.tv_usec >= + USEC_PER_SEC) { -+ buf->vb.timestamp.tv_sec++; -+ buf->vb.timestamp.tv_usec -= ++ timestamp.tv_sec++; ++ timestamp.tv_usec -= + USEC_PER_SEC; + } + v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, @@ -101904,11 +102758,12 @@ index 0000000..e83334c + (int)dev->capture.kernel_start_ts. + tv_usec, + dev->capture.vc_start_timestamp, pts, -+ (int)buf->vb.timestamp.tv_sec, -+ (int)buf->vb.timestamp. -+ tv_usec); ++ (int)timestamp.tv_sec, ++ (int)timestamp.tv_usec); ++ buf->vb.vb2_buf.timestamp = timestamp.tv_sec * 1000000000ULL + ++ timestamp.tv_usec * 1000ULL; + } else { -+ v4l2_get_timestamp(&buf->vb.timestamp); ++ buf->vb.vb2_buf.timestamp = ktime_get_ns(); + } + + vb2_set_plane_payload(&buf->vb.vb2_buf, 0, length); @@ -101939,6 +102794,17 @@ index 0000000..e83334c +{ + int ret; + if (!dev->camera_use_count) { ++ ret = vchiq_mmal_port_parameter_set( ++ dev->instance, ++ &dev->component[MMAL_COMPONENT_CAMERA]->control, ++ MMAL_PARAMETER_CAMERA_NUM, &dev->camera_num, ++ sizeof(dev->camera_num)); ++ if (ret < 0) { ++ v4l2_err(&dev->v4l2_dev, ++ "Failed setting camera num, ret %d\n", ret); ++ return -EINVAL; ++ } ++ + ret = vchiq_mmal_component_enable( + dev->instance, + dev->component[MMAL_COMPONENT_CAMERA]); @@ -102173,6 +103039,30 @@ index 0000000..e83334c + IOCTL operations + ------------------------------------------------------------------*/ + ++static int set_overlay_params(struct bm2835_mmal_dev *dev, ++ struct vchiq_mmal_port *port) ++{ ++ int ret; ++ struct mmal_parameter_displayregion prev_config = { ++ .set = MMAL_DISPLAY_SET_LAYER | MMAL_DISPLAY_SET_ALPHA | ++ MMAL_DISPLAY_SET_DEST_RECT | MMAL_DISPLAY_SET_FULLSCREEN, ++ .layer = PREVIEW_LAYER, ++ .alpha = dev->overlay.global_alpha, ++ .fullscreen = 0, ++ .dest_rect = { ++ .x = dev->overlay.w.left, ++ .y = dev->overlay.w.top, ++ .width = dev->overlay.w.width, ++ .height = dev->overlay.w.height, ++ }, ++ }; ++ ret = vchiq_mmal_port_parameter_set(dev->instance, port, ++ MMAL_PARAMETER_DISPLAYREGION, ++ &prev_config, sizeof(prev_config)); ++ ++ return ret; ++} ++ +/* overlay ioctl */ +static int vidioc_enum_fmt_vid_overlay(struct file *file, void *priv, + struct v4l2_fmtdesc *f) @@ -102204,10 +103094,31 @@ index 0000000..e83334c +static int vidioc_try_fmt_vid_overlay(struct file *file, void *priv, + struct v4l2_format *f) +{ -+ /* Only support one format so get the current one. */ -+ vidioc_g_fmt_vid_overlay(file, priv, f); ++ struct bm2835_mmal_dev *dev = video_drvdata(file); + -+ /* todo: allow the size and/or offset to be changed. */ ++ f->fmt.win.field = V4L2_FIELD_NONE; ++ f->fmt.win.chromakey = 0; ++ f->fmt.win.clips = NULL; ++ f->fmt.win.clipcount = 0; ++ f->fmt.win.bitmap = NULL; ++ ++ v4l_bound_align_image(&f->fmt.win.w.width, MIN_WIDTH, dev->max_width, 1, ++ &f->fmt.win.w.height, MIN_HEIGHT, dev->max_height, ++ 1, 0); ++ v4l_bound_align_image(&f->fmt.win.w.left, MIN_WIDTH, dev->max_width, 1, ++ &f->fmt.win.w.top, MIN_HEIGHT, dev->max_height, ++ 1, 0); ++ ++ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, ++ "Overlay: Now w/h %dx%d l/t %dx%d\n", ++ f->fmt.win.w.width, f->fmt.win.w.height, ++ f->fmt.win.w.left, f->fmt.win.w.top); ++ ++ v4l2_dump_win_format(1, ++ bcm2835_v4l2_debug, ++ &dev->v4l2_dev, ++ &f->fmt.win, ++ __func__); + return 0; +} + @@ -102219,8 +103130,11 @@ index 0000000..e83334c + vidioc_try_fmt_vid_overlay(file, priv, f); + + dev->overlay = f->fmt.win; ++ if (dev->component[MMAL_COMPONENT_PREVIEW]->enabled) { ++ set_overlay_params(dev, ++ &dev->component[MMAL_COMPONENT_PREVIEW]->input[0]); ++ } + -+ /* todo: program the preview port parameters */ + return 0; +} + @@ -102230,20 +103144,6 @@ index 0000000..e83334c + struct bm2835_mmal_dev *dev = video_drvdata(file); + struct vchiq_mmal_port *src; + struct vchiq_mmal_port *dst; -+ struct mmal_parameter_displayregion prev_config = { -+ .set = MMAL_DISPLAY_SET_LAYER | MMAL_DISPLAY_SET_ALPHA | -+ MMAL_DISPLAY_SET_DEST_RECT | MMAL_DISPLAY_SET_FULLSCREEN, -+ .layer = PREVIEW_LAYER, -+ .alpha = 255, -+ .fullscreen = 0, -+ .dest_rect = { -+ .x = dev->overlay.w.left, -+ .y = dev->overlay.w.top, -+ .width = dev->overlay.w.width, -+ .height = dev->overlay.w.height, -+ }, -+ }; -+ + if ((on && dev->component[MMAL_COMPONENT_PREVIEW]->enabled) || + (!on && !dev->component[MMAL_COMPONENT_PREVIEW]->enabled)) + return 0; /* already in requested state */ @@ -102275,9 +103175,7 @@ index 0000000..e83334c + if (ret < 0) + goto error; + -+ ret = vchiq_mmal_port_parameter_set(dev->instance, dst, -+ MMAL_PARAMETER_DISPLAYREGION, -+ &prev_config, sizeof(prev_config)); ++ ret = set_overlay_params(dev, dst); + if (ret < 0) + goto error; + @@ -102308,6 +103206,9 @@ index 0000000..e83334c + struct vchiq_mmal_port *preview_port = + &dev->component[MMAL_COMPONENT_CAMERA]-> + output[MMAL_CAMERA_PORT_PREVIEW]; ++ ++ a->capability = V4L2_FBUF_CAP_EXTERNOVERLAY | ++ V4L2_FBUF_CAP_GLOBAL_ALPHA; + a->flags = V4L2_FBUF_FLAG_OVERLAY; + a->fmt.width = preview_port->es.video.width; + a->fmt.height = preview_port->es.video.height; @@ -102433,8 +103334,9 @@ index 0000000..e83334c + "Clipping/aligning %dx%d format %08X\n", + f->fmt.pix.width, f->fmt.pix.height, f->fmt.pix.pixelformat); + -+ v4l_bound_align_image(&f->fmt.pix.width, MIN_WIDTH, MAX_WIDTH, 1, -+ &f->fmt.pix.height, MIN_HEIGHT, MAX_HEIGHT, 1, 0); ++ v4l_bound_align_image(&f->fmt.pix.width, MIN_WIDTH, dev->max_width, 1, ++ &f->fmt.pix.height, MIN_HEIGHT, dev->max_height, ++ 1, 0); + f->fmt.pix.bytesperline = f->fmt.pix.width * mfmt->ybbp; + + /* Image buffer has to be padded to allow for alignment, even though @@ -102773,9 +103675,10 @@ index 0000000..e83334c +int vidioc_enum_framesizes(struct file *file, void *fh, + struct v4l2_frmsizeenum *fsize) +{ ++ struct bm2835_mmal_dev *dev = video_drvdata(file); + static const struct v4l2_frmsize_stepwise sizes = { -+ MIN_WIDTH, MAX_WIDTH, 2, -+ MIN_HEIGHT, MAX_HEIGHT, 2 ++ MIN_WIDTH, 0, 2, ++ MIN_HEIGHT, 0, 2 + }; + int i; + @@ -102788,6 +103691,8 @@ index 0000000..e83334c + return -EINVAL; + fsize->type = V4L2_FRMSIZE_TYPE_STEPWISE; + fsize->stepwise = sizes; ++ fsize->stepwise.max_width = dev->max_width; ++ fsize->stepwise.max_height = dev->max_height; + return 0; +} + @@ -102795,6 +103700,7 @@ index 0000000..e83334c +static int vidioc_enum_frameintervals(struct file *file, void *priv, + struct v4l2_frmivalenum *fival) +{ ++ struct bm2835_mmal_dev *dev = video_drvdata(file); + int i; + + if (fival->index) @@ -102807,8 +103713,8 @@ index 0000000..e83334c + return -EINVAL; + + /* regarding width & height - we support any within range */ -+ if (fival->width < MIN_WIDTH || fival->width > MAX_WIDTH || -+ fival->height < MIN_HEIGHT || fival->height > MAX_HEIGHT) ++ if (fival->width < MIN_WIDTH || fival->width > dev->max_width || ++ fival->height < MIN_HEIGHT || fival->height > dev->max_height) + return -EINVAL; + + fival->type = V4L2_FRMIVAL_TYPE_CONTINUOUS; @@ -102971,13 +103877,55 @@ index 0000000..e83334c + .release = video_device_release_empty, +}; + ++/* Returns the number of cameras, and also the max resolution supported ++ * by those cameras. ++ */ ++static int get_num_cameras(struct vchiq_mmal_instance *instance, ++ unsigned int resolutions[][2], int num_resolutions) ++{ ++ int ret; ++ struct vchiq_mmal_component *cam_info_component; ++ struct mmal_parameter_camera_info_t cam_info = {0}; ++ int param_size = sizeof(cam_info); ++ int i; ++ ++ /* create a camera_info component */ ++ ret = vchiq_mmal_component_init(instance, "camera_info", ++ &cam_info_component); ++ if (ret < 0) ++ /* Unusual failure - let's guess one camera. */ ++ return 1; ++ ++ if (vchiq_mmal_port_parameter_get(instance, ++ &cam_info_component->control, ++ MMAL_PARAMETER_CAMERA_INFO, ++ &cam_info, ++ &param_size)) { ++ pr_info("Failed to get camera info\n"); ++ } ++ for (i = 0; ++ i < (cam_info.num_cameras > num_resolutions ? ++ num_resolutions : ++ cam_info.num_cameras); ++ i++) { ++ resolutions[i][0] = cam_info.cameras[i].max_width; ++ resolutions[i][1] = cam_info.cameras[i].max_height; ++ } ++ ++ vchiq_mmal_component_finalise(instance, ++ cam_info_component); ++ ++ return cam_info.num_cameras; ++} ++ +static int set_camera_parameters(struct vchiq_mmal_instance *instance, -+ struct vchiq_mmal_component *camera) ++ struct vchiq_mmal_component *camera, ++ struct bm2835_mmal_dev *dev) +{ + int ret; + struct mmal_parameter_camera_config cam_config = { -+ .max_stills_w = MAX_WIDTH, -+ .max_stills_h = MAX_HEIGHT, ++ .max_stills_w = dev->max_width, ++ .max_stills_h = dev->max_height, + .stills_yuv422 = 1, + .one_shot_stills = 1, + .max_preview_video_w = (max_video_width > 1920) ? @@ -103020,7 +103968,8 @@ index 0000000..e83334c + } + + ret = set_camera_parameters(dev->instance, -+ dev->component[MMAL_COMPONENT_CAMERA]); ++ dev->component[MMAL_COMPONENT_CAMERA], ++ dev); + if (ret < 0) + goto unreg_camera; + @@ -103211,7 +104160,9 @@ index 0000000..e83334c + /* video device needs to be able to access instance data */ + video_set_drvdata(vfd, dev); + -+ ret = video_register_device(vfd, VFL_TYPE_GRABBER, -1); ++ ret = video_register_device(vfd, ++ VFL_TYPE_GRABBER, ++ video_nr[dev->camera_num]); + if (ret < 0) + return ret; + @@ -103222,10 +104173,52 @@ index 0000000..e83334c + return 0; +} + ++void bcm2835_cleanup_instance(struct bm2835_mmal_dev *dev) ++{ ++ if (!dev) ++ return; ++ ++ v4l2_info(&dev->v4l2_dev, "unregistering %s\n", ++ video_device_node_name(&dev->vdev)); ++ ++ video_unregister_device(&dev->vdev); ++ ++ if (dev->capture.encode_component) { ++ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, ++ "mmal_exit - disconnect tunnel\n"); ++ vchiq_mmal_port_connect_tunnel(dev->instance, ++ dev->capture.camera_port, NULL); ++ vchiq_mmal_component_disable(dev->instance, ++ dev->capture.encode_component); ++ } ++ vchiq_mmal_component_disable(dev->instance, ++ dev->component[MMAL_COMPONENT_CAMERA]); ++ ++ vchiq_mmal_component_finalise(dev->instance, ++ dev-> ++ component[MMAL_COMPONENT_VIDEO_ENCODE]); ++ ++ vchiq_mmal_component_finalise(dev->instance, ++ dev-> ++ component[MMAL_COMPONENT_IMAGE_ENCODE]); ++ ++ vchiq_mmal_component_finalise(dev->instance, ++ dev->component[MMAL_COMPONENT_PREVIEW]); ++ ++ vchiq_mmal_component_finalise(dev->instance, ++ dev->component[MMAL_COMPONENT_CAMERA]); ++ ++ v4l2_ctrl_handler_free(&dev->ctrl_handler); ++ ++ v4l2_device_unregister(&dev->v4l2_dev); ++ ++ kfree(dev); ++} ++ +static struct v4l2_format default_v4l2_format = { + .fmt.pix.pixelformat = V4L2_PIX_FMT_JPEG, + .fmt.pix.width = 1024, -+ .fmt.pix.bytesperline = 1024, ++ .fmt.pix.bytesperline = 0, + .fmt.pix.height = 768, + .fmt.pix.sizeimage = 1024*768, +}; @@ -103235,76 +104228,98 @@ index 0000000..e83334c + int ret; + struct bm2835_mmal_dev *dev; + struct vb2_queue *q; ++ int camera; ++ unsigned int num_cameras; ++ struct vchiq_mmal_instance *instance; ++ unsigned int resolutions[MAX_BCM2835_CAMERAS][2]; + -+ dev = kzalloc(sizeof(*gdev), GFP_KERNEL); -+ if (!dev) -+ return -ENOMEM; ++ ret = vchiq_mmal_init(&instance); ++ if (ret < 0) ++ return ret; + -+ /* setup device defaults */ -+ dev->overlay.w.left = 150; -+ dev->overlay.w.top = 50; -+ dev->overlay.w.width = 1024; -+ dev->overlay.w.height = 768; -+ dev->overlay.clipcount = 0; -+ dev->overlay.field = V4L2_FIELD_NONE; ++ num_cameras = get_num_cameras(instance, ++ resolutions, ++ MAX_BCM2835_CAMERAS); ++ if (num_cameras > MAX_BCM2835_CAMERAS) ++ num_cameras = MAX_BCM2835_CAMERAS; + -+ dev->capture.fmt = &formats[3]; /* JPEG */ ++ for (camera = 0; camera < num_cameras; camera++) { ++ dev = kzalloc(sizeof(struct bm2835_mmal_dev), GFP_KERNEL); ++ if (!dev) ++ return -ENOMEM; + -+ /* v4l device registration */ -+ snprintf(dev->v4l2_dev.name, sizeof(dev->v4l2_dev.name), -+ "%s", BM2835_MMAL_MODULE_NAME); -+ ret = v4l2_device_register(NULL, &dev->v4l2_dev); -+ if (ret) -+ goto free_dev; ++ dev->camera_num = camera; ++ dev->max_width = resolutions[camera][0]; ++ dev->max_height = resolutions[camera][1]; ++ ++ /* setup device defaults */ ++ dev->overlay.w.left = 150; ++ dev->overlay.w.top = 50; ++ dev->overlay.w.width = 1024; ++ dev->overlay.w.height = 768; ++ dev->overlay.clipcount = 0; ++ dev->overlay.field = V4L2_FIELD_NONE; ++ dev->overlay.global_alpha = 255; ++ ++ dev->capture.fmt = &formats[3]; /* JPEG */ ++ ++ /* v4l device registration */ ++ snprintf(dev->v4l2_dev.name, sizeof(dev->v4l2_dev.name), ++ "%s", BM2835_MMAL_MODULE_NAME); ++ ret = v4l2_device_register(NULL, &dev->v4l2_dev); ++ if (ret) ++ goto free_dev; + -+ /* setup v4l controls */ -+ ret = bm2835_mmal_init_controls(dev, &dev->ctrl_handler); -+ if (ret < 0) -+ goto unreg_dev; -+ dev->v4l2_dev.ctrl_handler = &dev->ctrl_handler; ++ /* setup v4l controls */ ++ ret = bm2835_mmal_init_controls(dev, &dev->ctrl_handler); ++ if (ret < 0) ++ goto unreg_dev; ++ dev->v4l2_dev.ctrl_handler = &dev->ctrl_handler; + -+ /* mmal init */ -+ ret = mmal_init(dev); -+ if (ret < 0) -+ goto unreg_dev; -+ -+ /* initialize queue */ -+ q = &dev->capture.vb_vidq; -+ memset(q, 0, sizeof(*q)); -+ q->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; -+ q->io_modes = VB2_MMAP | VB2_USERPTR | VB2_READ; -+ q->drv_priv = dev; -+ q->buf_struct_size = sizeof(struct mmal_buffer); -+ q->ops = &bm2835_mmal_video_qops; -+ q->mem_ops = &vb2_vmalloc_memops; -+ q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; -+ ret = vb2_queue_init(q); -+ if (ret < 0) -+ goto unreg_dev; ++ /* mmal init */ ++ dev->instance = instance; ++ ret = mmal_init(dev); ++ if (ret < 0) ++ goto unreg_dev; ++ ++ /* initialize queue */ ++ q = &dev->capture.vb_vidq; ++ memset(q, 0, sizeof(*q)); ++ q->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; ++ q->io_modes = VB2_MMAP | VB2_USERPTR | VB2_READ; ++ q->drv_priv = dev; ++ q->buf_struct_size = sizeof(struct mmal_buffer); ++ q->ops = &bm2835_mmal_video_qops; ++ q->mem_ops = &vb2_vmalloc_memops; ++ q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; ++ ret = vb2_queue_init(q); ++ if (ret < 0) ++ goto unreg_dev; + -+ /* v4l2 core mutex used to protect all fops and v4l2 ioctls. */ -+ mutex_init(&dev->mutex); ++ /* v4l2 core mutex used to protect all fops and v4l2 ioctls. */ ++ mutex_init(&dev->mutex); + -+ /* initialise video devices */ -+ ret = bm2835_mmal_init_device(dev, &dev->vdev); -+ if (ret < 0) -+ goto unreg_dev; ++ /* initialise video devices */ ++ ret = bm2835_mmal_init_device(dev, &dev->vdev); ++ if (ret < 0) ++ goto unreg_dev; + -+ /* Really want to call vidioc_s_fmt_vid_cap with the default -+ * format, but currently the APIs don't join up. -+ */ -+ ret = mmal_setup_components(dev, &default_v4l2_format); -+ if (ret < 0) { -+ v4l2_err(&dev->v4l2_dev, -+ "%s: could not setup components\n", __func__); -+ goto unreg_dev; -+ } ++ /* Really want to call vidioc_s_fmt_vid_cap with the default ++ * format, but currently the APIs don't join up. ++ */ ++ ret = mmal_setup_components(dev, &default_v4l2_format); ++ if (ret < 0) { ++ v4l2_err(&dev->v4l2_dev, ++ "%s: could not setup components\n", __func__); ++ goto unreg_dev; ++ } + -+ v4l2_info(&dev->v4l2_dev, -+ "Broadcom 2835 MMAL video capture ver %s loaded.\n", -+ BM2835_MMAL_VERSION); ++ v4l2_info(&dev->v4l2_dev, ++ "Broadcom 2835 MMAL video capture ver %s loaded.\n", ++ BM2835_MMAL_VERSION); + -+ gdev = dev; ++ gdev[camera] = dev; ++ } + return 0; + +unreg_dev: @@ -103314,8 +104329,11 @@ index 0000000..e83334c +free_dev: + kfree(dev); + -+ v4l2_err(&dev->v4l2_dev, -+ "%s: error %d while loading driver\n", ++ for ( ; camera > 0; camera--) { ++ bcm2835_cleanup_instance(gdev[camera]); ++ gdev[camera] = NULL; ++ } ++ pr_info("%s: error %d while loading driver\n", + BM2835_MMAL_MODULE_NAME, ret); + + return ret; @@ -103323,56 +104341,24 @@ index 0000000..e83334c + +static void __exit bm2835_mmal_exit(void) +{ -+ if (!gdev) -+ return; ++ int camera; ++ struct vchiq_mmal_instance *instance = gdev[0]->instance; + -+ v4l2_info(&gdev->v4l2_dev, "unregistering %s\n", -+ video_device_node_name(&gdev->vdev)); -+ -+ video_unregister_device(&gdev->vdev); -+ -+ if (gdev->capture.encode_component) { -+ v4l2_dbg(1, bcm2835_v4l2_debug, &gdev->v4l2_dev, -+ "mmal_exit - disconnect tunnel\n"); -+ vchiq_mmal_port_connect_tunnel(gdev->instance, -+ gdev->capture.camera_port, NULL); -+ vchiq_mmal_component_disable(gdev->instance, -+ gdev->capture.encode_component); ++ for (camera = 0; camera < MAX_BCM2835_CAMERAS; camera++) { ++ bcm2835_cleanup_instance(gdev[camera]); ++ gdev[camera] = NULL; + } -+ vchiq_mmal_component_disable(gdev->instance, -+ gdev->component[MMAL_COMPONENT_CAMERA]); -+ -+ vchiq_mmal_component_finalise(gdev->instance, -+ gdev-> -+ component[MMAL_COMPONENT_VIDEO_ENCODE]); -+ -+ vchiq_mmal_component_finalise(gdev->instance, -+ gdev-> -+ component[MMAL_COMPONENT_IMAGE_ENCODE]); -+ -+ vchiq_mmal_component_finalise(gdev->instance, -+ gdev->component[MMAL_COMPONENT_PREVIEW]); -+ -+ vchiq_mmal_component_finalise(gdev->instance, -+ gdev->component[MMAL_COMPONENT_CAMERA]); -+ -+ vchiq_mmal_finalise(gdev->instance); -+ -+ v4l2_ctrl_handler_free(&gdev->ctrl_handler); -+ -+ v4l2_device_unregister(&gdev->v4l2_dev); -+ -+ kfree(gdev); ++ vchiq_mmal_finalise(instance); +} + +module_init(bm2835_mmal_init); +module_exit(bm2835_mmal_exit); diff --git a/drivers/media/platform/bcm2835/bcm2835-camera.h b/drivers/media/platform/bcm2835/bcm2835-camera.h new file mode 100644 -index 0000000..7fe9f65 +index 0000000..13f426f --- /dev/null +++ b/drivers/media/platform/bcm2835/bcm2835-camera.h -@@ -0,0 +1,126 @@ +@@ -0,0 +1,144 @@ +/* + * Broadcom BM2835 V4L2 driver + * @@ -103390,7 +104376,7 @@ index 0000000..7fe9f65 + * core driver device + */ + -+#define V4L2_CTRL_COUNT 28 /* number of v4l controls */ ++#define V4L2_CTRL_COUNT 29 /* number of v4l controls */ + +enum { + MMAL_COMPONENT_CAMERA = 0, @@ -103433,6 +104419,8 @@ index 0000000..7fe9f65 + enum mmal_parameter_exposuremeteringmode metering_mode; + unsigned int manual_shutter_speed; + bool exp_auto_priority; ++ bool manual_iso_enabled; ++ uint32_t iso; + + /* allocated mmal instance and components */ + struct vchiq_mmal_instance *instance; @@ -103479,6 +104467,9 @@ index 0000000..7fe9f65 + + } capture; + ++ unsigned int camera_num; ++ unsigned int max_width; ++ unsigned int max_height; +}; + +int bm2835_mmal_init_controls( @@ -103499,12 +104490,25 @@ index 0000000..7fe9f65 + (pix_fmt)->pixelformat, (pix_fmt)->bytesperline, \ + (pix_fmt)->sizeimage, (pix_fmt)->colorspace, (pix_fmt)->priv); \ +} ++#define v4l2_dump_win_format(level, debug, dev, win_fmt, desc) \ ++{ \ ++ v4l2_dbg(level, debug, dev, \ ++"%s: w %u h %u l %u t %u field %u chromakey %06X clip %p " \ ++"clipcount %u bitmap %p\n", \ ++ desc == NULL ? "" : desc, \ ++ (win_fmt)->w.width, (win_fmt)->w.height, \ ++ (win_fmt)->w.left, (win_fmt)->w.top, \ ++ (win_fmt)->field, \ ++ (win_fmt)->chromakey, \ ++ (win_fmt)->clips, (win_fmt)->clipcount, \ ++ (win_fmt)->bitmap); \ ++} diff --git a/drivers/media/platform/bcm2835/controls.c b/drivers/media/platform/bcm2835/controls.c new file mode 100644 -index 0000000..f9f903f +index 0000000..fe61330 --- /dev/null +++ b/drivers/media/platform/bcm2835/controls.c -@@ -0,0 +1,1324 @@ +@@ -0,0 +1,1345 @@ +/* + * Broadcom BM2835 V4L2 driver + * @@ -103556,10 +104560,13 @@ index 0000000..f9f903f + 4000 +}; + -+/* Supported ISO values ++/* Supported ISO values (*1000) + * ISOO = auto ISO + */ +static const s64 iso_qmenu[] = { ++ 0, 100000, 200000, 400000, 800000, ++}; ++static const uint32_t iso_values[] = { + 0, 100, 200, 400, 800, +}; + @@ -103708,7 +104715,7 @@ index 0000000..f9f903f + &u32_value, sizeof(u32_value)); +} + -+static int ctrl_set_value_menu(struct bm2835_mmal_dev *dev, ++static int ctrl_set_iso(struct bm2835_mmal_dev *dev, + struct v4l2_ctrl *ctrl, + const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl) +{ @@ -103718,12 +104725,23 @@ index 0000000..f9f903f + if (ctrl->val > mmal_ctrl->max || ctrl->val < mmal_ctrl->min) + return 1; + ++ if (ctrl->id == V4L2_CID_ISO_SENSITIVITY) ++ dev->iso = iso_values[ctrl->val]; ++ else if (ctrl->id == V4L2_CID_ISO_SENSITIVITY_AUTO) ++ dev->manual_iso_enabled = ++ (ctrl->val == V4L2_ISO_SENSITIVITY_MANUAL ? ++ true : ++ false); ++ + control = &dev->component[MMAL_COMPONENT_CAMERA]->control; + -+ u32_value = mmal_ctrl->imenu[ctrl->val]; ++ if (dev->manual_iso_enabled) ++ u32_value = dev->iso; ++ else ++ u32_value = 0; + + return vchiq_mmal_port_parameter_set(dev->instance, control, -+ mmal_ctrl->mmal_id, ++ MMAL_PARAMETER_ISO, + &u32_value, sizeof(u32_value)); +} + @@ -104463,7 +105481,14 @@ index 0000000..f9f903f + V4L2_CID_ISO_SENSITIVITY, MMAL_CONTROL_TYPE_INT_MENU, + 0, ARRAY_SIZE(iso_qmenu) - 1, 0, 1, iso_qmenu, + MMAL_PARAMETER_ISO, -+ &ctrl_set_value_menu, ++ &ctrl_set_iso, ++ false ++ }, ++ { ++ V4L2_CID_ISO_SENSITIVITY_AUTO, MMAL_CONTROL_TYPE_STD_MENU, ++ 0, 1, V4L2_ISO_SENSITIVITY_AUTO, 1, NULL, ++ MMAL_PARAMETER_ISO, ++ &ctrl_set_iso, + false + }, + { @@ -104831,7 +105856,7 @@ index 0000000..f9f903f +} diff --git a/drivers/media/platform/bcm2835/mmal-common.h b/drivers/media/platform/bcm2835/mmal-common.h new file mode 100644 -index 0000000..840fd139 +index 0000000..840fd13 --- /dev/null +++ b/drivers/media/platform/bcm2835/mmal-common.h @@ -0,0 +1,53 @@ @@ -105689,10 +106714,10 @@ index 0000000..67b1076 +}; diff --git a/drivers/media/platform/bcm2835/mmal-parameters.h b/drivers/media/platform/bcm2835/mmal-parameters.h new file mode 100644 -index 0000000..aa0fd18 +index 0000000..f6abb5c --- /dev/null +++ b/drivers/media/platform/bcm2835/mmal-parameters.h -@@ -0,0 +1,656 @@ +@@ -0,0 +1,689 @@ +/* + * Broadcom BM2835 V4L2 driver + * @@ -106349,6 +107374,39 @@ index 0000000..aa0fd18 + u32 num_effect_params; + u32 effect_parameter[MMAL_MAX_IMAGEFX_PARAMETERS]; +}; ++ ++#define MMAL_PARAMETER_CAMERA_INFO_MAX_CAMERAS 4 ++#define MMAL_PARAMETER_CAMERA_INFO_MAX_FLASHES 2 ++#define MMAL_PARAMETER_CAMERA_INFO_MAX_STR_LEN 16 ++ ++struct mmal_parameter_camera_info_camera_t { ++ u32 port_id; ++ u32 max_width; ++ u32 max_height; ++ u32 lens_present; ++ u8 camera_name[MMAL_PARAMETER_CAMERA_INFO_MAX_STR_LEN]; ++}; ++ ++enum mmal_parameter_camera_info_flash_type_t { ++ /* Make values explicit to ensure they match values in config ini */ ++ MMAL_PARAMETER_CAMERA_INFO_FLASH_TYPE_XENON = 0, ++ MMAL_PARAMETER_CAMERA_INFO_FLASH_TYPE_LED = 1, ++ MMAL_PARAMETER_CAMERA_INFO_FLASH_TYPE_OTHER = 2, ++ MMAL_PARAMETER_CAMERA_INFO_FLASH_TYPE_MAX = 0x7FFFFFFF ++}; ++ ++struct mmal_parameter_camera_info_flash_t { ++ enum mmal_parameter_camera_info_flash_type_t flash_type; ++}; ++ ++struct mmal_parameter_camera_info_t { ++ u32 num_cameras; ++ u32 num_flashes; ++ struct mmal_parameter_camera_info_camera_t ++ cameras[MMAL_PARAMETER_CAMERA_INFO_MAX_CAMERAS]; ++ struct mmal_parameter_camera_info_flash_t ++ flashes[MMAL_PARAMETER_CAMERA_INFO_MAX_FLASHES]; ++}; diff --git a/drivers/media/platform/bcm2835/mmal-vchiq.c b/drivers/media/platform/bcm2835/mmal-vchiq.c new file mode 100644 index 0000000..78132254 @@ -108456,10 +109514,10 @@ index 0000000..9d1d11e + +#endif /* MMAL_VCHIQ_H */ -From 03435989bbadbd333a810644c8246dd7eb0bad07 Mon Sep 17 00:00:00 2001 +From f91fde0e119041b5a8c762748fc51c2637eb38a4 Mon Sep 17 00:00:00 2001 From: Phil Elwell <phil@raspberrypi.org> Date: Mon, 11 May 2015 09:00:42 +0100 -Subject: [PATCH 050/170] scripts: Add mkknlimg and knlinfo scripts from tools +Subject: [PATCH 054/112] scripts: Add mkknlimg and knlinfo scripts from tools repo The Raspberry Pi firmware looks for a trailer on the kernel image to @@ -108492,19 +109550,44 @@ Also, since the canned configuration is no longer built in (it's a module), remove the config string checking. See: https://github.com/raspberrypi/linux/issues/1157 + +scripts: Multi-platform support for mkknlimg and knlinfo + +The firmware uses tags in the kernel trailer to choose which dtb file +to load. Current firmware loads bcm2835-*.dtb if the '283x' tag is true, +otherwise it loads bcm270*.dtb. This scheme breaks if an image supports +multiple platforms. + +This patch adds '270X' and '283X' tags to indicate support for RPi and +upstream platforms, respectively. '283x' (note lower case 'x') is left +for old firmware, and is only set if the image only supports upstream +builds. + +scripts/mkknlimg: Append a trailer for all input + +Now that the firmware assumes an unsigned kernel is DT-capable, it is +helpful to be able to mark a kernel as being non-DT-capable. + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> + +scripts/knlinfo: Decode DDTK atom + +Show the DDTK atom as being a boolean. + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> --- - scripts/knlinfo | 168 ++++++++++++++++++++++++++++++++++++++ - scripts/mkknlimg | 244 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ - 2 files changed, 412 insertions(+) + scripts/knlinfo | 171 ++++++++++++++++++++++++++++++++++++ + scripts/mkknlimg | 263 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 434 insertions(+) create mode 100755 scripts/knlinfo create mode 100755 scripts/mkknlimg diff --git a/scripts/knlinfo b/scripts/knlinfo new file mode 100755 -index 0000000..a0e8663 +index 0000000..263ec93 --- /dev/null +++ b/scripts/knlinfo -@@ -0,0 +1,168 @@ +@@ -0,0 +1,171 @@ +#!/usr/bin/env perl +# ---------------------------------------------------------------------- +# knlinfo by Phil Elwell for Raspberry Pi @@ -108523,8 +109606,11 @@ index 0000000..a0e8663 + +my %atom_formats = +( ++ 'DDTK' => \&format_bool, + 'DTOK' => \&format_bool, + 'KVer' => \&format_string, ++ '270X' => \&format_bool, ++ '283X' => \&format_bool, + '283x' => \&format_bool, +); + @@ -108653,7 +109739,7 @@ index 0000000..a0e8663 +sub format_bool +{ + my ($data) = @_; -+ return unpack('V', $data) ? 'true' : 'false'; ++ return unpack('V', $data) ? 'y' : 'n'; +} + +sub format_int @@ -108675,10 +109761,10 @@ index 0000000..a0e8663 +} diff --git a/scripts/mkknlimg b/scripts/mkknlimg new file mode 100755 -index 0000000..3998d43 +index 0000000..78c5845 --- /dev/null +++ b/scripts/mkknlimg -@@ -0,0 +1,244 @@ +@@ -0,0 +1,263 @@ +#!/usr/bin/env perl +# ---------------------------------------------------------------------- +# mkknlimg by Phil Elwell for Raspberry Pi @@ -108694,12 +109780,20 @@ index 0000000..3998d43 +use warnings; +use integer; + ++use constant FLAG_PI => 0x01; ++use constant FLAG_DTOK => 0x02; ++use constant FLAG_DDTK => 0x04; ++use constant FLAG_270X => 0x08; ++use constant FLAG_283X => 0x10; ++ +my $trailer_magic = 'RPTL'; + +my $tmpfile1 = "/tmp/mkknlimg_$$.1"; +my $tmpfile2 = "/tmp/mkknlimg_$$.2"; + +my $dtok = 0; ++my $ddtk = 0; ++my $is_270x = 0; +my $is_283x = 0; + +while (@ARGV && ($ARGV[0] =~ /^-/)) @@ -108709,6 +109803,14 @@ index 0000000..3998d43 + { + $dtok = 1; + } ++ elsif ($arg eq '--ddtk') ++ { ++ $ddtk = 1; ++ } ++ elsif ($arg eq '--270x') ++ { ++ $is_270x = 1; ++ } + elsif ($arg eq '--283x') + { + $is_283x = 1; @@ -108731,70 +109833,68 @@ index 0000000..3998d43 + usage(); +} + -+my @wanted_strings = -+( -+ 'bcm2708_fb', -+ 'brcm,bcm2835-mmc', -+ 'brcm,bcm2835-sdhost', -+ 'brcm,bcm2708-pinctrl', -+ 'brcm,bcm2835-gpio', -+ 'brcm,bcm2835', -+ 'brcm,bcm2836' -+); ++my $wanted_strings = ++{ ++ 'bcm2708_fb' => FLAG_PI, ++ 'brcm,bcm2835-mmc' => FLAG_PI, ++ 'brcm,bcm2835-sdhost' => FLAG_PI, ++ 'brcm,bcm2708-pinctrl' => FLAG_PI | FLAG_DTOK, ++ 'brcm,bcm2835-gpio' => FLAG_PI | FLAG_DTOK, ++ 'brcm,bcm2708' => FLAG_PI | FLAG_DTOK | FLAG_270X, ++ 'brcm,bcm2709' => FLAG_PI | FLAG_DTOK | FLAG_270X, ++ 'brcm,bcm2835' => FLAG_PI | FLAG_DTOK | FLAG_283X, ++ 'brcm,bcm2836' => FLAG_PI | FLAG_DTOK | FLAG_283X, ++ 'of_overlay_apply' => FLAG_DTOK | FLAG_DDTK, ++}; + +my $res = try_extract($kernel_file, $tmpfile1); -+$res = try_decompress('\037\213\010', 'xy', 'gunzip', 0, -+ $kernel_file, $tmpfile1, $tmpfile2) if (!$res); -+$res = try_decompress('\3757zXZ\000', 'abcde', 'unxz --single-stream', -1, -+ $kernel_file, $tmpfile1, $tmpfile2) if (!$res); -+$res = try_decompress('BZh', 'xy', 'bunzip2', 0, -+ $kernel_file, $tmpfile1, $tmpfile2) if (!$res); -+$res = try_decompress('\135\0\0\0', 'xxx', 'unlzma', 0, -+ $kernel_file, $tmpfile1, $tmpfile2) if (!$res); -+$res = try_decompress('\211\114\132', 'xy', 'lzop -d', 0, -+ $kernel_file, $tmpfile1, $tmpfile2) if (!$res); -+$res = try_decompress('\002\041\114\030', 'xy', 'lz4 -d', 1, -+ $kernel_file, $tmpfile1, $tmpfile2) if (!$res); ++$res ||= try_decompress('\037\213\010', 'xy', 'gunzip', 0, ++ $kernel_file, $tmpfile1, $tmpfile2); ++$res ||= try_decompress('\3757zXZ\000', 'abcde', 'unxz --single-stream', -1, ++ $kernel_file, $tmpfile1, $tmpfile2); ++$res ||= try_decompress('BZh', 'xy', 'bunzip2', 0, ++ $kernel_file, $tmpfile1, $tmpfile2); ++$res ||= try_decompress('\135\0\0\0', 'xxx', 'unlzma', 0, ++ $kernel_file, $tmpfile1, $tmpfile2); ++$res ||= try_decompress('\211\114\132', 'xy', 'lzop -d', 0, ++ $kernel_file, $tmpfile1, $tmpfile2); ++$res ||= try_decompress('\002\041\114\030', 'xy', 'lz4 -d', 1, ++ $kernel_file, $tmpfile1, $tmpfile2); + +my $append_trailer; +my $trailer; +my $kver = '?'; + -+$append_trailer = $dtok; ++$append_trailer = 1; + +if ($res) +{ -+ $kver = $res->{''} || '?'; ++ $kver = $res->{'kver'} || '?'; ++ my $flags = $res->{'flags'}; + print("Version: $kver\n"); + -+ $append_trailer = $dtok; -+ if (!$dtok) ++ if ($flags & FLAG_PI) + { -+ if (config_bool($res, 'bcm2708_fb') || -+ config_bool($res, 'brcm,bcm2835-mmc') || -+ config_bool($res, 'brcm,bcm2835-sdhost')) -+ { -+ $dtok ||= config_bool($res, 'brcm,bcm2708-pinctrl'); -+ $dtok ||= config_bool($res, 'brcm,bcm2835-gpio'); -+ $is_283x ||= config_bool($res, 'brcm,bcm2835'); -+ $is_283x ||= config_bool($res, 'brcm,bcm2836'); -+ $dtok ||= $is_283x; -+ $append_trailer = 1; -+ } -+ else -+ { -+ print ("* This doesn't look like a Raspberry Pi kernel. In pass-through mode.\n"); -+ } ++ $dtok ||= ($flags & FLAG_DTOK) != 0; ++ $is_270x ||= ($flags & FLAG_270X) != 0; ++ $is_283x ||= ($flags & FLAG_283X) != 0; ++ $ddtk ||= ($flags & FLAG_DDTK) != 0; ++ } ++ else ++ { ++ print ("* This doesn't look like a Raspberry Pi kernel.\n"); + } +} +elsif (!$dtok) +{ -+ print ("* Is this a valid kernel? In pass-through mode.\n"); ++ print ("* Is this a valid kernel?\n"); +} + +if ($append_trailer) +{ + printf("DT: %s\n", $dtok ? "y" : "n"); ++ printf("DDT: %s\n", $ddtk ? "y" : "n"); ++ printf("270x: %s\n", $is_270x ? "y" : "n"); + printf("283x: %s\n", $is_283x ? "y" : "n"); + + my @atoms; @@ -108802,7 +109902,10 @@ index 0000000..3998d43 + push @atoms, [ $trailer_magic, pack('V', 0) ]; + push @atoms, [ 'KVer', $kver ]; + push @atoms, [ 'DTOK', pack('V', $dtok) ]; -+ push @atoms, [ '283x', pack('V', $is_283x) ]; ++ push @atoms, [ 'DDTK', pack('V', $ddtk) ]; ++ push @atoms, [ '270X', pack('V', $is_270x) ]; ++ push @atoms, [ '283X', pack('V', $is_283x) ]; ++ push @atoms, [ '283x', pack('V', $is_283x && !$is_270x) ]; + + $trailer = pack_trailer(\@atoms); + $atoms[0]->[1] = pack('V', length($trailer)); @@ -108856,7 +109959,7 @@ index 0000000..3998d43 + +sub usage +{ -+ print ("Usage: mkknlimg [--dtok] [--283x] <vmlinux|zImage|bzImage> <outfile>\n"); ++ print ("Usage: mkknlimg [--dtok] [--270x] [--283x] <vmlinux|zImage|bzImage> <outfile>\n"); + exit(1); +} + @@ -108870,15 +109973,8 @@ index 0000000..3998d43 + + chomp($ver); + -+ my $res = { ''=>$ver }; -+ my $string_pattern = '^('.join('|', @wanted_strings).')$'; -+ -+ my @matches = `strings \"$knl\" | grep -E \"$string_pattern\"`; -+ foreach my $match (@matches) -+ { -+ chomp($match); -+ $res->{$match} = 1; -+ } ++ my $res = { 'kver'=>$ver }; ++ $res->{'flags'} = strings_to_flags($knl, $wanted_strings); + + return $res; +} @@ -108905,6 +110001,22 @@ index 0000000..3998d43 + return undef; +} + ++sub strings_to_flags ++{ ++ my ($knl, $strings) = @_; ++ my $string_pattern = '^('.join('|', keys(%$strings)).')$'; ++ my $flags = 0; ++ ++ my @matches = `strings \"$knl\" | grep -E \"$string_pattern\"`; ++ foreach my $match (@matches) ++ { ++ chomp($match); ++ $flags |= $strings->{$match}; ++ } ++ ++ return $flags; ++} ++ +sub pack_trailer +{ + my ($atoms) = @_; @@ -108916,1161 +110028,3240 @@ index 0000000..3998d43 + } + return $trailer; +} -+ -+sub config_bool -+{ -+ my ($configs, $wanted) = @_; -+ my $val = $configs->{$wanted} || 'n'; -+ return (($val eq 'y') || ($val eq '1')); -+} -From a251bf4a37d8fd468bc3ff853bcebe8ee452a31e Mon Sep 17 00:00:00 2001 +From bcf6cc7b91fb794994940d91f41159cd16d1cb18 Mon Sep 17 00:00:00 2001 From: Phil Elwell <phil@raspberrypi.org> -Date: Fri, 5 Dec 2014 17:26:26 +0000 -Subject: [PATCH 051/170] fdt: Add support for the CONFIG_CMDLINE_EXTEND option - ---- - drivers/of/fdt.c | 29 ++++++++++++++++++++++++----- - 1 file changed, 24 insertions(+), 5 deletions(-) - -diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c -index 655f79d..fdc4501 100644 ---- a/drivers/of/fdt.c -+++ b/drivers/of/fdt.c -@@ -954,19 +954,38 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname, - - /* Retrieve command line */ - p = of_get_flat_dt_prop(node, "bootargs", &l); -- if (p != NULL && l > 0) -- strlcpy(data, p, min((int)l, COMMAND_LINE_SIZE)); - - /* - * CONFIG_CMDLINE is meant to be a default in case nothing else - * managed to set the command line, unless CONFIG_CMDLINE_FORCE - * is set in which case we override whatever was found earlier. -+ * -+ * However, it can be useful to be able to treat the default as -+ * a starting point to be extended using CONFIG_CMDLINE_EXTEND. - */ -+ ((char *)data)[0] = '\0'; -+ - #ifdef CONFIG_CMDLINE --#ifndef CONFIG_CMDLINE_FORCE -- if (!((char *)data)[0]) -+ strlcpy(data, CONFIG_CMDLINE, COMMAND_LINE_SIZE); -+ -+ if (p != NULL && l > 0) { -+#if defined(CONFIG_CMDLINE_EXTEND) -+ int len = strlen(data); -+ if (len > 0) { -+ strlcat(data, " ", COMMAND_LINE_SIZE); -+ len++; -+ } -+ strlcpy((char *)data + len, p, min((int)l, COMMAND_LINE_SIZE - len)); -+#elif defined(CONFIG_CMDLINE_FORCE) -+ pr_warning("Ignoring bootargs property (using the default kernel command line)\n"); -+#else -+ /* Neither extend nor force - just override */ -+ strlcpy(data, p, min((int)l, COMMAND_LINE_SIZE)); - #endif -- strlcpy(data, CONFIG_CMDLINE, COMMAND_LINE_SIZE); -+ } -+#else /* CONFIG_CMDLINE */ -+ if (p != NULL && l > 0) -+ strlcpy(data, p, min((int)l, COMMAND_LINE_SIZE)); - #endif /* CONFIG_CMDLINE */ - - pr_debug("Command line is: %s\n", (char*)data); - -From 0112c4ce9db6cdc53af67dc7634966c3594de7ff Mon Sep 17 00:00:00 2001 -From: notro <notro@tronnes.org> -Date: Wed, 9 Jul 2014 14:46:08 +0200 -Subject: [PATCH 052/170] BCM2708: Add core Device Tree support - -Add the bare minimum needed to boot BCM2708 from a Device Tree. - -Signed-off-by: Noralf Tronnes <notro@tronnes.org> - -BCM2708: DT: change 'axi' nodename to 'soc' - -Change DT node named 'axi' to 'soc' so it matches ARCH_BCM2835. -The VC4 bootloader fills in certain properties in the 'axi' subtree, -but since this is part of an upstreaming effort, the name is changed. - -Signed-off-by: Noralf Tronnes notro@tronnes.org - -BCM2708_DT: Correct length of the peripheral space - -Use dts-dirs feature for overlays. - -The kernel makefiles have a dts-dirs target that is for vendor subdirectories. - -Using this fixes the install_dtbs target, which previously did not install the overlays. +Date: Mon, 10 Aug 2015 09:49:15 +0100 +Subject: [PATCH 055/112] scripts/dtc: Update to upstream version 1.4.1 -BCM270X_DT: configure I2S DMA channels +Includes the new localfixups format. -Signed-off-by: Matthias Reichl <hias@horus.com> +Signed-off-by: Phil Elwell <phil@raspberrypi.org> -BCM270X_DT: switch to bcm2835-i2s +scripts/dtc: Fix UMR causing corrupt dtbo overlay files -I2S soundcard drivers with proper devicetree support (i.e. not linking -to the cpu_dai/platform via name but to cpu/platform via of_node) -will work out of the box without any modifications. +struct fixup_entry is allocated from the heap but it's member +local_fixup_generated was never initialized. This lead to +corrupted dtbo files. -When the kernel is compiled without devicetree support the platform -code will instantiate the bcm2708-i2s driver and I2S soundcard drivers -will link to it via name, as before. +Fix this by initializing local_fixup_generated to false. Signed-off-by: Matthias Reichl <hias@horus.com> -SDIO-overlay: add poll_once-boolean parameter - -Add paramter to toggle sdio-device-polling -done every second or once at boot-time. - -Signed-off-by: Patrick Boettcher <patrick.boettcher@posteo.de> - -BCM270X_DT: Make mmc overlay compatible with current firmware - -The original DT overlay logic followed a merge-then-patch procedure, -i.e. parameters are applied to the loaded overlay before the overlay -is merged into the base DTB. This sequence has been changed to -patch-then-merge, in order to support parameterised node names, and -to protect against bad overlays. As a result, overrides (parameters) -must only target labels in the overlay, but the overlay can obviously target nodes in the base DTB. - -mmc-overlay.dts (that switches back to the original mmc sdcard -driver) is the only overlay violating that rule, and this patch -fixes it. - -bcm270x_dt: Use the sdhost MMC controller by default - -The "mmc" overlay reverts to using the other controller. +scripts/dtc: Only emit local fixups for overlays -squash: Add cprman to dt - -BCM270X_DT: Use clk_core for I2C interfaces +Signed-off-by: Phil Elwell <phil@raspberrypi.org> --- - arch/arm/boot/dts/Makefile | 30 + - arch/arm/boot/dts/bcm2708-rpi-b-plus.dts | 145 +++++ - arch/arm/boot/dts/bcm2708-rpi-b.dts | 135 +++++ - arch/arm/boot/dts/bcm2708-rpi-cm.dts | 102 ++++ - arch/arm/boot/dts/bcm2708-rpi-cm.dtsi | 40 ++ - arch/arm/boot/dts/bcm2708.dtsi | 40 ++ - arch/arm/boot/dts/bcm2708_common.dtsi | 347 +++++++++++ - arch/arm/boot/dts/bcm2709-rpi-2-b.dts | 145 +++++ - arch/arm/boot/dts/bcm2709.dtsi | 102 ++++ - arch/arm/boot/dts/bcm2835-rpi-cm.dts | 93 +++ - arch/arm/boot/dts/bcm2835-rpi-cm.dtsi | 30 + - arch/arm/boot/dts/overlays/Makefile | 69 +++ - arch/arm/boot/dts/overlays/README | 648 +++++++++++++++++++++ - arch/arm/boot/dts/overlays/ads7846-overlay.dts | 83 +++ - .../dts/overlays/bmp085_i2c-sensor-overlay.dts | 23 + - arch/arm/boot/dts/overlays/dht11-overlay.dts | 39 ++ - arch/arm/boot/dts/overlays/enc28j60-overlay.dts | 50 ++ - .../boot/dts/overlays/gpio-poweroff-overlay.dts | 34 ++ - .../boot/dts/overlays/hifiberry-amp-overlay.dts | 39 ++ - .../boot/dts/overlays/hifiberry-dac-overlay.dts | 34 ++ - .../dts/overlays/hifiberry-dacplus-overlay.dts | 39 ++ - .../boot/dts/overlays/hifiberry-digi-overlay.dts | 39 ++ - arch/arm/boot/dts/overlays/hy28a-overlay.dts | 87 +++ - arch/arm/boot/dts/overlays/hy28b-overlay.dts | 142 +++++ - arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts | 55 ++ - arch/arm/boot/dts/overlays/i2s-mmap-overlay.dts | 13 + - arch/arm/boot/dts/overlays/iqaudio-dac-overlay.dts | 39 ++ - .../boot/dts/overlays/iqaudio-dacplus-overlay.dts | 39 ++ - arch/arm/boot/dts/overlays/lirc-rpi-overlay.dts | 57 ++ - .../arm/boot/dts/overlays/mcp2515-can0-overlay.dts | 69 +++ - .../arm/boot/dts/overlays/mcp2515-can1-overlay.dts | 69 +++ - arch/arm/boot/dts/overlays/mmc-overlay.dts | 39 ++ - arch/arm/boot/dts/overlays/mz61581-overlay.dts | 111 ++++ - arch/arm/boot/dts/overlays/piscreen-overlay.dts | 96 +++ - .../dts/overlays/pitft28-resistive-overlay.dts | 115 ++++ - arch/arm/boot/dts/overlays/pps-gpio-overlay.dts | 34 ++ - arch/arm/boot/dts/overlays/pwm-2chan-overlay.dts | 46 ++ - arch/arm/boot/dts/overlays/pwm-overlay.dts | 42 ++ - arch/arm/boot/dts/overlays/raspidac3-overlay.dts | 45 ++ - arch/arm/boot/dts/overlays/rpi-dac-overlay.dts | 34 ++ - arch/arm/boot/dts/overlays/rpi-display-overlay.dts | 82 +++ - arch/arm/boot/dts/overlays/rpi-ft5406-overlay.dts | 17 + - arch/arm/boot/dts/overlays/rpi-proto-overlay.dts | 39 ++ - arch/arm/boot/dts/overlays/rpi-sense-overlay.dts | 47 ++ - arch/arm/boot/dts/overlays/sdhost-overlay.dts | 29 + - arch/arm/boot/dts/overlays/sdio-overlay.dts | 32 + - arch/arm/boot/dts/overlays/smi-dev-overlay.dts | 18 + - arch/arm/boot/dts/overlays/smi-nand-overlay.dts | 69 +++ - arch/arm/boot/dts/overlays/smi-overlay.dts | 37 ++ - .../boot/dts/overlays/spi-gpio35-39-overlay.dts | 31 + - arch/arm/boot/dts/overlays/tinylcd35-overlay.dts | 216 +++++++ - arch/arm/boot/dts/overlays/uart1-overlay.dts | 38 ++ - arch/arm/boot/dts/overlays/vga666-overlay.dts | 30 + - arch/arm/boot/dts/overlays/w1-gpio-overlay.dts | 39 ++ - .../boot/dts/overlays/w1-gpio-pullup-overlay.dts | 41 ++ - 55 files changed, 4203 insertions(+) - create mode 100644 arch/arm/boot/dts/bcm2708-rpi-b-plus.dts - create mode 100644 arch/arm/boot/dts/bcm2708-rpi-b.dts - create mode 100755 arch/arm/boot/dts/bcm2708-rpi-cm.dts - create mode 100644 arch/arm/boot/dts/bcm2708-rpi-cm.dtsi - create mode 100644 arch/arm/boot/dts/bcm2708.dtsi - create mode 100644 arch/arm/boot/dts/bcm2708_common.dtsi - create mode 100644 arch/arm/boot/dts/bcm2709-rpi-2-b.dts - create mode 100644 arch/arm/boot/dts/bcm2709.dtsi - create mode 100644 arch/arm/boot/dts/bcm2835-rpi-cm.dts - create mode 100644 arch/arm/boot/dts/bcm2835-rpi-cm.dtsi - create mode 100644 arch/arm/boot/dts/overlays/Makefile - create mode 100644 arch/arm/boot/dts/overlays/README - create mode 100644 arch/arm/boot/dts/overlays/ads7846-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/bmp085_i2c-sensor-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/dht11-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/enc28j60-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/gpio-poweroff-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/hifiberry-amp-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/hifiberry-dac-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/hifiberry-digi-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/hy28a-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/hy28b-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/i2s-mmap-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/iqaudio-dac-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/iqaudio-dacplus-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/lirc-rpi-overlay.dts - create mode 100755 arch/arm/boot/dts/overlays/mcp2515-can0-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/mcp2515-can1-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/mmc-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/mz61581-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/piscreen-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/pitft28-resistive-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/pps-gpio-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/pwm-2chan-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/pwm-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/raspidac3-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/rpi-dac-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/rpi-display-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/rpi-ft5406-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/rpi-proto-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/rpi-sense-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/sdhost-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/sdio-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/smi-dev-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/smi-nand-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/smi-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/spi-gpio35-39-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/tinylcd35-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/uart1-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/vga666-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/w1-gpio-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/w1-gpio-pullup-overlay.dts + scripts/dtc/checks.c | 106 +++++- + scripts/dtc/dtc-lexer.l | 5 + + scripts/dtc/dtc-lexer.lex.c_shipped | 537 +++++++++++++------------- + scripts/dtc/dtc-parser.tab.c_shipped | 714 ++++++++++++++++++----------------- + scripts/dtc/dtc-parser.tab.h_shipped | 46 +-- + scripts/dtc/dtc-parser.y | 22 +- + scripts/dtc/dtc.c | 9 +- + scripts/dtc/dtc.h | 40 ++ + scripts/dtc/flattree.c | 202 ++++++++++ + scripts/dtc/version_gen.h | 2 +- + 10 files changed, 1029 insertions(+), 654 deletions(-) -diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile -index 30bbc37..d583e67 100644 ---- a/arch/arm/boot/dts/Makefile -+++ b/arch/arm/boot/dts/Makefile -@@ -1,5 +1,25 @@ - ifeq ($(CONFIG_OF),y) - -+dtb-$(CONFIG_ARCH_BCM2708) += bcm2708-rpi-b.dtb -+dtb-$(CONFIG_ARCH_BCM2708) += bcm2708-rpi-b-plus.dtb -+dtb-$(CONFIG_ARCH_BCM2708) += bcm2708-rpi-cm.dtb -+dtb-$(CONFIG_ARCH_BCM2835) += bcm2835-rpi-cm.dtb -+dtb-$(CONFIG_ARCH_BCM2709) += bcm2709-rpi-2-b.dtb -+ -+# Raspberry Pi -+ifeq ($(CONFIG_ARCH_BCM2708),y) -+ RPI_DT_OVERLAYS=y -+endif -+ifeq ($(CONFIG_ARCH_BCM2709),y) -+ RPI_DT_OVERLAYS=y -+endif -+ifeq ($(CONFIG_ARCH_BCM2835),y) -+ RPI_DT_OVERLAYS=y -+endif -+ifeq ($(RPI_DT_OVERLAYS),y) -+ dts-dirs += overlays -+endif -+ - dtb-$(CONFIG_ARCH_ALPINE) += \ - alpine-db.dtb - dtb-$(CONFIG_MACH_ASM9260) += \ -@@ -777,10 +797,20 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \ - mt8127-moose.dtb \ - mt8135-evbp1.dtb - dtb-$(CONFIG_ARCH_ZX) += zx296702-ad1.dtb -+ -+targets += dtbs dtbs_install -+targets += $(dtb-y) -+ - endif +diff --git a/scripts/dtc/checks.c b/scripts/dtc/checks.c +index 0c03ac9..88550b4 100644 +--- a/scripts/dtc/checks.c ++++ b/scripts/dtc/checks.c +@@ -458,6 +458,8 @@ static void fixup_phandle_references(struct check *c, struct node *dt, + struct node *node, struct property *prop) + { + struct marker *m = prop->val.markers; ++ struct fixup *f, **fp; ++ struct fixup_entry *fe, **fep; + struct node *refnode; + cell_t phandle; - dtstree := $(srctree)/$(src) - dtb-$(CONFIG_OF_ALL_DTBS) := $(patsubst $(dtstree)/%.dts,%.dtb, $(wildcard $(dtstree)/*.dts)) +@@ -466,11 +468,70 @@ static void fixup_phandle_references(struct check *c, struct node *dt, - always := $(dtb-y) -+subdir-y := $(dts-dirs) - clean-files := *.dtb -+ -+# Enable fixups to support overlays on BCM2708 platforms -+ifeq ($(RPI_DT_OVERLAYS),y) -+ DTC_FLAGS ?= -@ -+endif -diff --git a/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts b/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts -new file mode 100644 -index 0000000..2e4df17 ---- /dev/null -+++ b/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts -@@ -0,0 +1,145 @@ -+/dts-v1/; -+ -+#include "bcm2708.dtsi" -+ -+/ { -+ compatible = "brcm,bcm2708"; -+ model = "Raspberry Pi Model B+"; -+}; + refnode = get_node_by_ref(dt, m->ref); + if (! refnode) { +- FAIL(c, "Reference to non-existent node or label \"%s\"\n", +- m->ref); ++ if (!dt->is_plugin) { ++ FAIL(c, "Reference to non-existent node or label \"%s\"\n", ++ m->ref); ++ continue; ++ } + -+&gpio { -+ sdhost_pins: sdhost_pins { -+ brcm,pins = <48 49 50 51 52 53>; -+ brcm,function = <4>; /* alt0 */ -+ }; ++ /* allocate fixup entry */ ++ fe = xmalloc(sizeof(*fe)); + -+ spi0_pins: spi0_pins { -+ brcm,pins = <9 10 11>; -+ brcm,function = <4>; /* alt0 */ -+ }; ++ fe->node = node; ++ fe->prop = prop; ++ fe->offset = m->offset; ++ fe->next = NULL; + -+ spi0_cs_pins: spi0_cs_pins { -+ brcm,pins = <8 7>; -+ brcm,function = <1>; /* output */ -+ }; ++ /* search for an already existing fixup */ ++ for_each_fixup(dt, f) ++ if (strcmp(f->ref, m->ref) == 0) ++ break; + -+ i2c0_pins: i2c0 { -+ brcm,pins = <0 1>; -+ brcm,function = <4>; -+ }; ++ /* no fixup found, add new */ ++ if (f == NULL) { ++ f = xmalloc(sizeof(*f)); ++ f->ref = m->ref; ++ f->entries = NULL; ++ f->next = NULL; + -+ i2c1_pins: i2c1 { -+ brcm,pins = <2 3>; -+ brcm,function = <4>; -+ }; ++ /* add it to the tree */ ++ fp = &dt->fixups; ++ while (*fp) ++ fp = &(*fp)->next; ++ *fp = f; ++ } + -+ i2s_pins: i2s { -+ brcm,pins = <18 19 20 21>; -+ brcm,function = <4>; /* alt0 */ -+ }; -+}; ++ /* and now append fixup entry */ ++ fep = &f->entries; ++ while (*fep) ++ fep = &(*fep)->next; ++ *fep = fe; + -+&sdhost { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&sdhost_pins>; -+ bus-width = <4>; -+ status = "okay"; -+}; ++ /* mark the entry as unresolved */ ++ *((cell_t *)(prop->val.val + m->offset)) = ++ cpu_to_fdt32(0xdeadbeef); + continue; + } + ++ /* if it's a local reference, we need to record it */ ++ if (symbol_fixup_support && dt->is_plugin) { + -+&fb { -+ status = "okay"; -+}; ++ /* allocate a new local fixup entry */ ++ fe = xmalloc(sizeof(*fe)); + -+&uart0 { -+ status = "okay"; -+}; ++ fe->node = node; ++ fe->prop = prop; ++ fe->offset = m->offset; ++ fe->next = NULL; ++ fe->local_fixup_generated = false; + -+&spi0 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&spi0_pins &spi0_cs_pins>; -+ cs-gpios = <&gpio 8 1>, <&gpio 7 1>; ++ /* append it to the local fixups */ ++ fep = &dt->local_fixups; ++ while (*fep) ++ fep = &(*fep)->next; ++ *fep = fe; ++ } + -+ spidev@0{ -+ compatible = "spidev"; -+ reg = <0>; /* CE0 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; -+ }; + phandle = get_node_phandle(dt, refnode); + *((cell_t *)(prop->val.val + m->offset)) = cpu_to_fdt32(phandle); + } +@@ -652,6 +713,45 @@ static void check_obsolete_chosen_interrupt_controller(struct check *c, + } + TREE_WARNING(obsolete_chosen_interrupt_controller, NULL); + ++static void check_auto_label_phandles(struct check *c, struct node *dt, ++ struct node *node) ++{ ++ struct label *l; ++ struct symbol *s, **sp; ++ int has_label; + -+ spidev@1{ -+ compatible = "spidev"; -+ reg = <1>; /* CE1 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; -+ }; -+}; ++ if (!symbol_fixup_support) ++ return; + -+&i2c0 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&i2c0_pins>; -+ clock-frequency = <100000>; -+}; ++ has_label = 0; ++ for_each_label(node->labels, l) { ++ has_label = 1; ++ break; ++ } + -+&i2c1 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&i2c1_pins>; -+ clock-frequency = <100000>; -+}; ++ if (!has_label) ++ return; + -+&i2c2 { -+ clock-frequency = <100000>; -+}; ++ /* force allocation of a phandle for this node */ ++ (void)get_node_phandle(dt, node); + -+&i2s { -+ #sound-dai-cells = <0>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&i2s_pins>; -+}; ++ /* add the symbol */ ++ for_each_label(node->labels, l) { + -+&random { -+ status = "okay"; -+}; ++ s = xmalloc(sizeof(*s)); ++ s->label = l; ++ s->node = node; ++ s->next = NULL; + -+&leds { -+ act_led: act { -+ label = "led0"; -+ linux,default-trigger = "mmc0"; -+ gpios = <&gpio 47 0>; -+ }; ++ /* add it to the symbols list */ ++ sp = &dt->symbols; ++ while (*sp) ++ sp = &((*sp)->next); ++ *sp = s; ++ } ++} ++NODE_WARNING(auto_label_phandles, NULL); + -+ pwr_led: pwr { -+ label = "led1"; -+ linux,default-trigger = "input"; -+ gpios = <&gpio 35 0>; -+ }; -+}; + static struct check *check_table[] = { + &duplicate_node_names, &duplicate_property_names, + &node_name_chars, &node_name_format, &property_name_chars, +@@ -670,6 +770,8 @@ static struct check *check_table[] = { + &avoid_default_addr_size, + &obsolete_chosen_interrupt_controller, + ++ &auto_label_phandles, + -+/ { -+ __overrides__ { -+ uart0 = <&uart0>,"status"; -+ uart0_clkrate = <&clk_uart0>,"clock-frequency:0"; -+ i2s = <&i2s>,"status"; -+ spi = <&spi0>,"status"; -+ i2c0 = <&i2c0>,"status"; -+ i2c1 = <&i2c1>,"status"; -+ i2c2_iknowwhatimdoing = <&i2c2>,"status"; -+ i2c0_baudrate = <&i2c0>,"clock-frequency:0"; -+ i2c1_baudrate = <&i2c1>,"clock-frequency:0"; -+ i2c2_baudrate = <&i2c2>,"clock-frequency:0"; -+ core_freq = <&clk_core>,"clock-frequency:0"; + &always_fail, + }; + +diff --git a/scripts/dtc/dtc-lexer.l b/scripts/dtc/dtc-lexer.l +index 790fbf6..40bbc87 100644 +--- a/scripts/dtc/dtc-lexer.l ++++ b/scripts/dtc/dtc-lexer.l +@@ -121,6 +121,11 @@ static void lexical_error(const char *fmt, ...); + return DT_V1; + } + ++<*>"/plugin/" { ++ DPRINT("Keyword: /plugin/\n"); ++ return DT_PLUGIN; ++ } + -+ act_led_gpio = <&act_led>,"gpios:4"; -+ act_led_activelow = <&act_led>,"gpios:8"; -+ act_led_trigger = <&act_led>,"linux,default-trigger"; + <*>"/memreserve/" { + DPRINT("Keyword: /memreserve/\n"); + BEGIN_DEFAULT(); +diff --git a/scripts/dtc/dtc-lexer.lex.c_shipped b/scripts/dtc/dtc-lexer.lex.c_shipped +index ba525c2..1518525 100644 +--- a/scripts/dtc/dtc-lexer.lex.c_shipped ++++ b/scripts/dtc/dtc-lexer.lex.c_shipped +@@ -9,7 +9,7 @@ + #define FLEX_SCANNER + #define YY_FLEX_MAJOR_VERSION 2 + #define YY_FLEX_MINOR_VERSION 5 +-#define YY_FLEX_SUBMINOR_VERSION 39 ++#define YY_FLEX_SUBMINOR_VERSION 35 + #if YY_FLEX_SUBMINOR_VERSION > 0 + #define FLEX_BETA + #endif +@@ -162,12 +162,7 @@ typedef unsigned int flex_uint32_t; + typedef struct yy_buffer_state *YY_BUFFER_STATE; + #endif + +-#ifndef YY_TYPEDEF_YY_SIZE_T +-#define YY_TYPEDEF_YY_SIZE_T +-typedef size_t yy_size_t; +-#endif +- +-extern yy_size_t yyleng; ++extern int yyleng; + + extern FILE *yyin, *yyout; + +@@ -176,7 +171,6 @@ extern FILE *yyin, *yyout; + #define EOB_ACT_LAST_MATCH 2 + + #define YY_LESS_LINENO(n) +- #define YY_LINENO_REWIND_TO(ptr) + + /* Return all but the first "n" matched characters back to the input stream. */ + #define yyless(n) \ +@@ -194,6 +188,11 @@ extern FILE *yyin, *yyout; + + #define unput(c) yyunput( c, (yytext_ptr) ) + ++#ifndef YY_TYPEDEF_YY_SIZE_T ++#define YY_TYPEDEF_YY_SIZE_T ++typedef size_t yy_size_t; ++#endif + -+ pwr_led_gpio = <&pwr_led>,"gpios:4"; -+ pwr_led_activelow = <&pwr_led>,"gpios:8"; -+ pwr_led_trigger = <&pwr_led>,"linux,default-trigger"; + #ifndef YY_STRUCT_YY_BUFFER_STATE + #define YY_STRUCT_YY_BUFFER_STATE + struct yy_buffer_state +@@ -211,7 +210,7 @@ struct yy_buffer_state + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ +- yy_size_t yy_n_chars; ++ int yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to +@@ -281,8 +280,8 @@ static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ + + /* yy_hold_char holds the character lost when yytext is formed. */ + static char yy_hold_char; +-static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */ +-yy_size_t yyleng; ++static int yy_n_chars; /* number of characters read into yy_ch_buf */ ++int yyleng; + + /* Points to current character in buffer. */ + static char *yy_c_buf_p = (char *) 0; +@@ -310,7 +309,7 @@ static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ); + + YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ); + YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ); +-YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,yy_size_t len ); ++YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len ); + + void *yyalloc (yy_size_t ); + void *yyrealloc (void *,yy_size_t ); +@@ -342,7 +341,7 @@ void yyfree (void * ); + + /* Begin user sect3 */ + +-#define yywrap() 1 ++#define yywrap(n) 1 + #define YY_SKIP_YYWRAP + + typedef unsigned char YY_CHAR; +@@ -373,8 +372,8 @@ static void yy_fatal_error (yyconst char msg[] ); + *yy_cp = '\0'; \ + (yy_c_buf_p) = yy_cp; + +-#define YY_NUM_RULES 30 +-#define YY_END_OF_BUFFER 31 ++#define YY_NUM_RULES 31 ++#define YY_END_OF_BUFFER 32 + /* This struct is not used in this scanner, + but its presence is necessary. */ + struct yy_trans_info +@@ -382,25 +381,26 @@ struct yy_trans_info + flex_int32_t yy_verify; + flex_int32_t yy_nxt; + }; +-static yyconst flex_int16_t yy_accept[159] = ++static yyconst flex_int16_t yy_accept[166] = + { 0, +- 0, 0, 0, 0, 0, 0, 0, 0, 31, 29, +- 18, 18, 29, 29, 29, 29, 29, 29, 29, 29, +- 29, 29, 29, 29, 29, 29, 15, 16, 16, 29, +- 16, 10, 10, 18, 26, 0, 3, 0, 27, 12, +- 0, 0, 11, 0, 0, 0, 0, 0, 0, 0, +- 21, 23, 25, 24, 22, 0, 9, 28, 0, 0, +- 0, 14, 14, 16, 16, 16, 10, 10, 10, 0, +- 12, 0, 11, 0, 0, 0, 20, 0, 0, 0, +- 0, 0, 0, 0, 0, 16, 10, 10, 10, 0, +- 13, 19, 0, 0, 0, 0, 0, 0, 0, 0, +- +- 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, +- 0, 16, 6, 0, 0, 0, 0, 0, 0, 2, +- 0, 0, 0, 0, 0, 0, 0, 0, 4, 17, +- 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, +- 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, +- 5, 8, 0, 0, 0, 0, 7, 0 ++ 0, 0, 0, 0, 0, 0, 0, 0, 32, 30, ++ 19, 19, 30, 30, 30, 30, 30, 30, 30, 30, ++ 30, 30, 30, 30, 30, 30, 16, 17, 17, 30, ++ 17, 11, 11, 19, 27, 0, 3, 0, 28, 13, ++ 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, ++ 0, 22, 24, 26, 25, 23, 0, 10, 29, 0, ++ 0, 0, 15, 15, 17, 17, 17, 11, 11, 11, ++ 0, 13, 0, 12, 0, 0, 0, 21, 0, 0, ++ 0, 0, 0, 0, 0, 0, 0, 17, 11, 11, ++ 11, 0, 14, 20, 0, 0, 0, 0, 0, 0, + -+ audio = <&audio>,"status"; -+ watchdog = <&watchdog>,"status"; -+ random = <&random>,"status"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/bcm2708-rpi-b.dts b/arch/arm/boot/dts/bcm2708-rpi-b.dts -new file mode 100644 -index 0000000..0445b46 ---- /dev/null -+++ b/arch/arm/boot/dts/bcm2708-rpi-b.dts -@@ -0,0 +1,135 @@ -+/dts-v1/; ++ 0, 0, 0, 0, 17, 0, 0, 0, 0, 0, ++ 0, 0, 0, 0, 0, 17, 7, 0, 0, 0, ++ 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, ++ 0, 0, 0, 0, 4, 18, 0, 0, 5, 2, ++ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ++ 0, 0, 1, 0, 0, 0, 0, 6, 9, 0, ++ 0, 0, 0, 8, 0 + } ; + + static yyconst flex_int32_t yy_ec[256] = +@@ -416,9 +416,9 @@ static yyconst flex_int32_t yy_ec[256] = + 22, 22, 22, 22, 24, 22, 22, 25, 22, 22, + 1, 26, 27, 1, 22, 1, 21, 28, 29, 30, + +- 31, 21, 22, 22, 32, 22, 22, 33, 34, 35, +- 36, 37, 22, 38, 39, 40, 41, 42, 22, 25, +- 43, 22, 44, 45, 46, 1, 1, 1, 1, 1, ++ 31, 21, 32, 22, 33, 22, 22, 34, 35, 36, ++ 37, 38, 22, 39, 40, 41, 42, 43, 22, 25, ++ 44, 22, 45, 46, 47, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +@@ -435,163 +435,165 @@ static yyconst flex_int32_t yy_ec[256] = + 1, 1, 1, 1, 1 + } ; + +-static yyconst flex_int32_t yy_meta[47] = ++static yyconst flex_int32_t yy_meta[48] = + { 0, + 1, 1, 1, 1, 1, 1, 2, 3, 1, 2, + 2, 2, 4, 5, 5, 5, 6, 1, 1, 1, + 7, 8, 8, 8, 8, 1, 1, 7, 7, 7, + 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, +- 8, 8, 8, 3, 1, 4 ++ 8, 8, 8, 8, 3, 1, 4 + } ; + +-static yyconst flex_int16_t yy_base[173] = ++static yyconst flex_int16_t yy_base[180] = + { 0, +- 0, 383, 34, 382, 65, 381, 37, 105, 387, 391, +- 54, 111, 367, 110, 109, 109, 112, 41, 366, 104, +- 367, 338, 124, 117, 0, 144, 391, 0, 121, 0, +- 135, 155, 140, 179, 391, 160, 391, 379, 391, 0, +- 368, 141, 391, 167, 370, 376, 346, 103, 342, 345, +- 391, 391, 391, 391, 391, 358, 391, 391, 175, 342, +- 338, 391, 355, 0, 185, 339, 184, 347, 346, 0, +- 0, 322, 175, 357, 175, 363, 352, 324, 330, 323, +- 332, 326, 201, 324, 329, 322, 391, 333, 181, 309, +- 391, 341, 340, 313, 320, 338, 178, 311, 146, 317, +- +- 314, 315, 335, 331, 303, 300, 309, 299, 308, 188, +- 336, 335, 391, 305, 320, 281, 283, 271, 203, 288, +- 281, 271, 266, 264, 245, 242, 208, 104, 391, 391, +- 244, 218, 204, 219, 206, 224, 201, 212, 204, 229, +- 215, 208, 207, 200, 219, 391, 233, 221, 200, 181, +- 391, 391, 149, 122, 86, 41, 391, 391, 245, 251, +- 259, 263, 267, 273, 280, 284, 292, 300, 304, 310, +- 318, 326 ++ 0, 393, 35, 392, 66, 391, 38, 107, 397, 401, ++ 55, 113, 377, 112, 111, 111, 114, 42, 376, 106, ++ 377, 347, 126, 120, 0, 147, 401, 0, 124, 0, ++ 137, 158, 170, 163, 401, 153, 401, 389, 401, 0, ++ 378, 120, 401, 131, 380, 386, 355, 139, 351, 355, ++ 351, 401, 401, 401, 401, 401, 367, 401, 401, 185, ++ 350, 346, 401, 364, 0, 185, 347, 189, 356, 355, ++ 0, 0, 330, 180, 366, 141, 372, 361, 332, 338, ++ 331, 341, 334, 326, 205, 331, 337, 329, 401, 341, ++ 167, 316, 401, 349, 348, 320, 328, 346, 180, 318, + -+#include "bcm2708.dtsi" ++ 324, 209, 324, 320, 322, 342, 338, 309, 306, 315, ++ 305, 315, 312, 192, 342, 341, 401, 293, 306, 282, ++ 268, 252, 255, 203, 285, 282, 272, 268, 252, 233, ++ 232, 239, 208, 107, 401, 401, 238, 211, 401, 211, ++ 212, 208, 228, 203, 215, 207, 233, 222, 212, 211, ++ 203, 227, 401, 237, 225, 204, 185, 401, 401, 149, ++ 128, 88, 42, 401, 401, 253, 259, 267, 271, 275, ++ 281, 288, 292, 300, 308, 312, 318, 326, 334 + } ; + +-static yyconst flex_int16_t yy_def[173] = ++static yyconst flex_int16_t yy_def[180] = + { 0, +- 158, 1, 1, 3, 158, 5, 1, 1, 158, 158, +- 158, 158, 158, 159, 160, 161, 158, 158, 158, 158, +- 162, 158, 158, 158, 163, 162, 158, 164, 165, 164, +- 164, 158, 158, 158, 158, 159, 158, 159, 158, 166, +- 158, 161, 158, 161, 167, 168, 158, 158, 158, 158, +- 158, 158, 158, 158, 158, 162, 158, 158, 158, 158, +- 158, 158, 162, 164, 165, 164, 158, 158, 158, 169, +- 166, 170, 161, 167, 167, 168, 158, 158, 158, 158, +- 158, 158, 158, 158, 158, 164, 158, 158, 169, 170, +- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, +- +- 158, 164, 158, 158, 158, 158, 158, 158, 158, 171, +- 158, 164, 158, 158, 158, 158, 158, 158, 171, 158, +- 171, 158, 158, 158, 158, 158, 158, 158, 158, 158, +- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, +- 172, 158, 158, 158, 172, 158, 172, 158, 158, 158, +- 158, 158, 158, 158, 158, 158, 158, 0, 158, 158, +- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, +- 158, 158 ++ 165, 1, 1, 3, 165, 5, 1, 1, 165, 165, ++ 165, 165, 165, 166, 167, 168, 165, 165, 165, 165, ++ 169, 165, 165, 165, 170, 169, 165, 171, 172, 171, ++ 171, 165, 165, 165, 165, 166, 165, 166, 165, 173, ++ 165, 168, 165, 168, 174, 175, 165, 165, 165, 165, ++ 165, 165, 165, 165, 165, 165, 169, 165, 165, 165, ++ 165, 165, 165, 169, 171, 172, 171, 165, 165, 165, ++ 176, 173, 177, 168, 174, 174, 175, 165, 165, 165, ++ 165, 165, 165, 165, 165, 165, 165, 171, 165, 165, ++ 176, 177, 165, 165, 165, 165, 165, 165, 165, 165, + -+/ { -+ compatible = "brcm,bcm2708"; -+ model = "Raspberry Pi Model B"; -+}; ++ 165, 165, 165, 165, 171, 165, 165, 165, 165, 165, ++ 165, 165, 165, 178, 165, 171, 165, 165, 165, 165, ++ 165, 165, 165, 178, 165, 178, 165, 165, 165, 165, ++ 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, ++ 165, 165, 165, 165, 165, 165, 165, 179, 165, 165, ++ 165, 179, 165, 179, 165, 165, 165, 165, 165, 165, ++ 165, 165, 165, 165, 0, 165, 165, 165, 165, 165, ++ 165, 165, 165, 165, 165, 165, 165, 165, 165 + } ; + +-static yyconst flex_int16_t yy_nxt[438] = ++static yyconst flex_int16_t yy_nxt[449] = + { 0, + 10, 11, 12, 11, 13, 14, 10, 15, 16, 10, + 10, 10, 17, 10, 10, 10, 10, 18, 19, 20, + 21, 21, 21, 21, 21, 10, 10, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, +- 21, 21, 21, 10, 22, 10, 24, 25, 25, 25, +- 32, 33, 33, 157, 26, 34, 34, 34, 51, 52, +- 27, 26, 26, 26, 26, 10, 11, 12, 11, 13, +- 14, 28, 15, 16, 28, 28, 28, 24, 28, 28, +- 28, 10, 18, 19, 20, 29, 29, 29, 29, 29, +- 30, 10, 29, 29, 29, 29, 29, 29, 29, 29, +- +- 29, 29, 29, 29, 29, 29, 29, 29, 10, 22, +- 10, 23, 34, 34, 34, 37, 39, 43, 32, 33, +- 33, 45, 54, 55, 46, 59, 45, 64, 156, 46, +- 64, 64, 64, 79, 44, 38, 59, 57, 134, 47, +- 135, 48, 80, 49, 47, 50, 48, 99, 61, 43, +- 50, 110, 41, 67, 67, 67, 60, 63, 63, 63, +- 57, 155, 68, 69, 63, 37, 44, 66, 67, 67, +- 67, 63, 63, 63, 63, 73, 59, 68, 69, 70, +- 34, 34, 34, 43, 75, 38, 154, 92, 83, 83, +- 83, 64, 44, 120, 64, 64, 64, 67, 67, 67, +- +- 44, 57, 99, 68, 69, 107, 68, 69, 120, 127, +- 108, 153, 152, 121, 83, 83, 83, 133, 133, 133, +- 146, 133, 133, 133, 146, 140, 140, 140, 121, 141, +- 140, 140, 140, 151, 141, 158, 150, 149, 148, 144, +- 147, 143, 142, 139, 147, 36, 36, 36, 36, 36, +- 36, 36, 36, 40, 138, 137, 136, 40, 40, 42, +- 42, 42, 42, 42, 42, 42, 42, 56, 56, 56, +- 56, 62, 132, 62, 64, 131, 130, 64, 129, 64, +- 64, 65, 128, 158, 65, 65, 65, 65, 71, 127, +- 71, 71, 74, 74, 74, 74, 74, 74, 74, 74, +- +- 76, 76, 76, 76, 76, 76, 76, 76, 89, 126, +- 89, 90, 125, 90, 90, 124, 90, 90, 119, 119, +- 119, 119, 119, 119, 119, 119, 145, 145, 145, 145, +- 145, 145, 145, 145, 123, 122, 59, 59, 118, 117, +- 116, 115, 114, 113, 45, 112, 108, 111, 109, 106, +- 105, 104, 46, 103, 91, 87, 102, 101, 100, 98, +- 97, 96, 95, 94, 93, 77, 75, 91, 88, 87, +- 86, 57, 85, 84, 57, 82, 81, 78, 77, 75, +- 72, 158, 58, 57, 53, 35, 158, 31, 23, 23, +- 9, 158, 158, 158, 158, 158, 158, 158, 158, 158, +- +- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, +- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, +- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, +- 158, 158, 158, 158, 158, 158, 158 ++ 21, 21, 21, 21, 10, 22, 10, 24, 25, 25, ++ 25, 32, 33, 33, 164, 26, 34, 34, 34, 52, ++ 53, 27, 26, 26, 26, 26, 10, 11, 12, 11, ++ 13, 14, 28, 15, 16, 28, 28, 28, 24, 28, ++ 28, 28, 10, 18, 19, 20, 29, 29, 29, 29, ++ 29, 30, 10, 29, 29, 29, 29, 29, 29, 29, + -+&gpio { -+ sdhost_pins: sdhost_pins { -+ brcm,pins = <48 49 50 51 52 53>; -+ brcm,function = <4>; /* alt0 */ -+ }; ++ 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, ++ 10, 22, 10, 23, 34, 34, 34, 37, 39, 43, ++ 32, 33, 33, 45, 55, 56, 46, 60, 43, 45, ++ 65, 163, 46, 65, 65, 65, 44, 38, 60, 74, ++ 58, 47, 141, 48, 142, 44, 49, 47, 50, 48, ++ 76, 51, 62, 94, 50, 41, 44, 51, 37, 61, ++ 64, 64, 64, 58, 34, 34, 34, 64, 162, 80, ++ 67, 68, 68, 68, 64, 64, 64, 64, 38, 81, ++ 69, 70, 71, 68, 68, 68, 60, 161, 43, 69, ++ 70, 65, 69, 70, 65, 65, 65, 125, 85, 85, + -+ spi0_pins: spi0_pins { -+ brcm,pins = <9 10 11>; -+ brcm,function = <4>; /* alt0 */ -+ }; ++ 85, 58, 68, 68, 68, 44, 102, 110, 125, 133, ++ 102, 69, 70, 111, 114, 160, 159, 126, 85, 85, ++ 85, 140, 140, 140, 140, 140, 140, 153, 126, 147, ++ 147, 147, 153, 148, 147, 147, 147, 158, 148, 165, ++ 157, 156, 155, 151, 150, 149, 146, 154, 145, 144, ++ 143, 139, 154, 36, 36, 36, 36, 36, 36, 36, ++ 36, 40, 138, 137, 136, 40, 40, 42, 42, 42, ++ 42, 42, 42, 42, 42, 57, 57, 57, 57, 63, ++ 135, 63, 65, 134, 165, 65, 133, 65, 65, 66, ++ 132, 131, 66, 66, 66, 66, 72, 130, 72, 72, + -+ spi0_cs_pins: spi0_cs_pins { -+ brcm,pins = <8 7>; -+ brcm,function = <1>; /* output */ -+ }; ++ 75, 75, 75, 75, 75, 75, 75, 75, 77, 77, ++ 77, 77, 77, 77, 77, 77, 91, 129, 91, 92, ++ 128, 92, 92, 127, 92, 92, 124, 124, 124, 124, ++ 124, 124, 124, 124, 152, 152, 152, 152, 152, 152, ++ 152, 152, 60, 60, 123, 122, 121, 120, 119, 118, ++ 117, 45, 116, 111, 115, 113, 112, 109, 108, 107, ++ 46, 106, 93, 89, 105, 104, 103, 101, 100, 99, ++ 98, 97, 96, 95, 78, 76, 93, 90, 89, 88, ++ 58, 87, 86, 58, 84, 83, 82, 79, 78, 76, ++ 73, 165, 59, 58, 54, 35, 165, 31, 23, 23, + -+ i2c0_pins: i2c0 { -+ brcm,pins = <0 1>; -+ brcm,function = <4>; -+ }; ++ 9, 165, 165, 165, 165, 165, 165, 165, 165, 165, ++ 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, ++ 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, ++ 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, ++ 165, 165, 165, 165, 165, 165, 165, 165 + } ; + +-static yyconst flex_int16_t yy_chk[438] = ++static yyconst flex_int16_t yy_chk[449] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +- 1, 1, 1, 1, 1, 1, 3, 3, 3, 3, +- 7, 7, 7, 156, 3, 11, 11, 11, 18, 18, +- 3, 3, 3, 3, 3, 5, 5, 5, 5, 5, ++ 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, ++ 3, 7, 7, 7, 163, 3, 11, 11, 11, 18, ++ 18, 3, 3, 3, 3, 3, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, +- 5, 8, 12, 12, 12, 14, 15, 16, 8, 8, +- 8, 17, 20, 20, 17, 23, 24, 29, 155, 24, +- 29, 29, 29, 48, 16, 14, 31, 29, 128, 17, +- 128, 17, 48, 17, 24, 17, 24, 99, 24, 42, +- 24, 99, 15, 33, 33, 33, 23, 26, 26, 26, +- 26, 154, 33, 33, 26, 36, 42, 31, 32, 32, +- 32, 26, 26, 26, 26, 44, 59, 32, 32, 32, +- 34, 34, 34, 73, 75, 36, 153, 75, 59, 59, +- 59, 65, 44, 110, 65, 65, 65, 67, 67, 67, +- +- 73, 65, 83, 89, 89, 97, 67, 67, 119, 127, +- 97, 150, 149, 110, 83, 83, 83, 133, 133, 133, +- 141, 127, 127, 127, 145, 136, 136, 136, 119, 136, +- 140, 140, 140, 148, 140, 147, 144, 143, 142, 139, +- 141, 138, 137, 135, 145, 159, 159, 159, 159, 159, +- 159, 159, 159, 160, 134, 132, 131, 160, 160, 161, +- 161, 161, 161, 161, 161, 161, 161, 162, 162, 162, +- 162, 163, 126, 163, 164, 125, 124, 164, 123, 164, +- 164, 165, 122, 121, 165, 165, 165, 165, 166, 120, +- 166, 166, 167, 167, 167, 167, 167, 167, 167, 167, +- +- 168, 168, 168, 168, 168, 168, 168, 168, 169, 118, +- 169, 170, 117, 170, 170, 116, 170, 170, 171, 171, +- 171, 171, 171, 171, 171, 171, 172, 172, 172, 172, +- 172, 172, 172, 172, 115, 114, 112, 111, 109, 108, +- 107, 106, 105, 104, 103, 102, 101, 100, 98, 96, +- 95, 94, 93, 92, 90, 88, 86, 85, 84, 82, +- 81, 80, 79, 78, 77, 76, 74, 72, 69, 68, +- 66, 63, 61, 60, 56, 50, 49, 47, 46, 45, ++ 5, 5, 5, 8, 12, 12, 12, 14, 15, 16, ++ 8, 8, 8, 17, 20, 20, 17, 23, 42, 24, ++ 29, 162, 24, 29, 29, 29, 16, 14, 31, 44, ++ 29, 17, 134, 17, 134, 42, 17, 24, 17, 24, ++ 76, 17, 24, 76, 24, 15, 44, 24, 36, 23, ++ 26, 26, 26, 26, 34, 34, 34, 26, 161, 48, ++ 31, 32, 32, 32, 26, 26, 26, 26, 36, 48, ++ 32, 32, 32, 33, 33, 33, 60, 160, 74, 91, ++ 91, 66, 33, 33, 66, 66, 66, 114, 60, 60, + -+ i2c1_pins: i2c1 { -+ brcm,pins = <2 3>; -+ brcm,function = <4>; -+ }; ++ 60, 66, 68, 68, 68, 74, 85, 99, 124, 133, ++ 102, 68, 68, 99, 102, 157, 156, 114, 85, 85, ++ 85, 133, 133, 133, 140, 140, 140, 148, 124, 143, ++ 143, 143, 152, 143, 147, 147, 147, 155, 147, 154, ++ 151, 150, 149, 146, 145, 144, 142, 148, 141, 138, ++ 137, 132, 152, 166, 166, 166, 166, 166, 166, 166, ++ 166, 167, 131, 130, 129, 167, 167, 168, 168, 168, ++ 168, 168, 168, 168, 168, 169, 169, 169, 169, 170, ++ 128, 170, 171, 127, 126, 171, 125, 171, 171, 172, ++ 123, 122, 172, 172, 172, 172, 173, 121, 173, 173, + -+ i2s_pins: i2s { -+ brcm,pins = <28 29 30 31>; -+ brcm,function = <6>; /* alt2 */ -+ }; -+}; -+ -+&sdhost { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&sdhost_pins>; -+ bus-width = <4>; -+ status = "okay"; -+}; -+ -+&fb { -+ status = "okay"; -+}; -+ -+&uart0 { -+ status = "okay"; -+}; -+ -+&spi0 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&spi0_pins &spi0_cs_pins>; -+ cs-gpios = <&gpio 8 1>, <&gpio 7 1>; -+ -+ spidev@0{ -+ compatible = "spidev"; -+ reg = <0>; /* CE0 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; -+ }; -+ -+ spidev@1{ -+ compatible = "spidev"; -+ reg = <1>; /* CE1 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; -+ }; -+}; -+ -+&i2c0 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&i2c0_pins>; -+ clock-frequency = <100000>; -+}; -+ -+&i2c1 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&i2c1_pins>; -+ clock-frequency = <100000>; -+}; -+ -+&i2c2 { -+ clock-frequency = <100000>; -+}; -+ -+&i2s { -+ #sound-dai-cells = <0>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&i2s_pins>; -+}; -+ -+&random { -+ status = "okay"; -+}; -+ -+&leds { -+ act_led: act { -+ label = "led0"; -+ linux,default-trigger = "mmc0"; -+ gpios = <&gpio 16 1>; -+ }; -+}; -+ -+/ { -+ __overrides__ { -+ uart0 = <&uart0>,"status"; -+ uart0_clkrate = <&clk_uart0>,"clock-frequency:0"; -+ i2s = <&i2s>,"status"; -+ spi = <&spi0>,"status"; -+ i2c0 = <&i2c0>,"status"; -+ i2c1 = <&i2c1>,"status"; -+ i2c2_iknowwhatimdoing = <&i2c2>,"status"; -+ i2c0_baudrate = <&i2c0>,"clock-frequency:0"; -+ i2c1_baudrate = <&i2c1>,"clock-frequency:0"; -+ i2c2_baudrate = <&i2c2>,"clock-frequency:0"; -+ core_freq = <&clk_core>,"clock-frequency:0"; -+ -+ act_led_gpio = <&act_led>,"gpios:4"; -+ act_led_activelow = <&act_led>,"gpios:8"; -+ act_led_trigger = <&act_led>,"linux,default-trigger"; -+ -+ audio = <&audio>,"status"; -+ watchdog = <&watchdog>,"status"; -+ random = <&random>,"status"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/bcm2708-rpi-cm.dts b/arch/arm/boot/dts/bcm2708-rpi-cm.dts -new file mode 100755 -index 0000000..87c1a54 ---- /dev/null -+++ b/arch/arm/boot/dts/bcm2708-rpi-cm.dts -@@ -0,0 +1,102 @@ -+/dts-v1/; -+ -+#include "bcm2708-rpi-cm.dtsi" -+ -+/ { -+ model = "Raspberry Pi Compute Module"; -+}; -+ -+&uart0 { -+ status = "okay"; -+}; -+ -+&gpio { -+ spi0_pins: spi0_pins { -+ brcm,pins = <9 10 11>; -+ brcm,function = <4>; /* alt0 */ -+ }; -+ -+ spi0_cs_pins: spi0_cs_pins { -+ brcm,pins = <8 7>; -+ brcm,function = <1>; /* output */ -+ }; -+ -+ i2c0_pins: i2c0 { -+ brcm,pins = <0 1>; -+ brcm,function = <4>; -+ }; -+ -+ i2c1_pins: i2c1 { -+ brcm,pins = <2 3>; -+ brcm,function = <4>; -+ }; ++ 174, 174, 174, 174, 174, 174, 174, 174, 175, 175, ++ 175, 175, 175, 175, 175, 175, 176, 120, 176, 177, ++ 119, 177, 177, 118, 177, 177, 178, 178, 178, 178, ++ 178, 178, 178, 178, 179, 179, 179, 179, 179, 179, ++ 179, 179, 116, 115, 113, 112, 111, 110, 109, 108, ++ 107, 106, 105, 104, 103, 101, 100, 98, 97, 96, ++ 95, 94, 92, 90, 88, 87, 86, 84, 83, 82, ++ 81, 80, 79, 78, 77, 75, 73, 70, 69, 67, ++ 64, 62, 61, 57, 51, 50, 49, 47, 46, 45, + 41, 38, 22, 21, 19, 13, 9, 6, 4, 2, +- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, + +- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, +- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, +- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, +- 158, 158, 158, 158, 158, 158, 158 ++ 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, ++ 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, ++ 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, ++ 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, ++ 165, 165, 165, 165, 165, 165, 165, 165 + } ; + + static yy_state_type yy_last_accepting_state; +@@ -662,7 +664,7 @@ static int dts_version = 1; + static void push_input_file(const char *filename); + static bool pop_input_file(void); + static void lexical_error(const char *fmt, ...); +-#line 666 "dtc-lexer.lex.c" ++#line 668 "dtc-lexer.lex.c" + + #define INITIAL 0 + #define BYTESTRING 1 +@@ -704,7 +706,7 @@ FILE *yyget_out (void ); + + void yyset_out (FILE * out_str ); + +-yy_size_t yyget_leng (void ); ++int yyget_leng (void ); + + char *yyget_text (void ); + +@@ -853,6 +855,10 @@ YY_DECL + register char *yy_cp, *yy_bp; + register int yy_act; + ++#line 68 "dtc-lexer.l" + -+ i2s_pins: i2s { -+ brcm,pins = <18 19 20 21>; -+ brcm,function = <4>; /* alt0 */ -+ }; -+}; ++#line 861 "dtc-lexer.lex.c" + -+&spi0 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&spi0_pins &spi0_cs_pins>; -+ cs-gpios = <&gpio 8 1>, <&gpio 7 1>; + if ( !(yy_init) ) + { + (yy_init) = 1; +@@ -879,11 +885,6 @@ YY_DECL + yy_load_buffer_state( ); + } + +- { +-#line 68 "dtc-lexer.l" +- +-#line 886 "dtc-lexer.lex.c" +- + while ( 1 ) /* loops until end-of-file is reached */ + { + yy_cp = (yy_c_buf_p); +@@ -901,7 +902,7 @@ YY_DECL + yy_match: + do + { +- register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ; ++ register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; +@@ -910,13 +911,13 @@ yy_match: + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; +- if ( yy_current_state >= 159 ) ++ if ( yy_current_state >= 166 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + ++yy_cp; + } +- while ( yy_current_state != 158 ); ++ while ( yy_current_state != 165 ); + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + +@@ -951,39 +952,31 @@ case 2: + YY_RULE_SETUP + #line 75 "dtc-lexer.l" + { +- char *line, *fnstart, *fnend; +- struct data fn; ++ char *line, *tmp, *fn; + /* skip text before line # */ + line = yytext; + while (!isdigit((unsigned char)*line)) + line++; +- +- /* regexp ensures that first and list " +- * in the whole yytext are those at +- * beginning and end of the filename string */ +- fnstart = memchr(yytext, '"', yyleng); +- for (fnend = yytext + yyleng - 1; +- *fnend != '"'; fnend--) +- ; +- assert(fnstart && fnend && (fnend > fnstart)); +- +- fn = data_copy_escape_string(fnstart + 1, +- fnend - fnstart - 1); +- +- /* Don't allow nuls in filenames */ +- if (memchr(fn.val, '\0', fn.len - 1)) +- lexical_error("nul in line number directive"); +- ++ /* skip digits in line # */ ++ tmp = line; ++ while (!isspace((unsigned char)*tmp)) ++ tmp++; ++ /* "NULL"-terminate line # */ ++ *tmp = '\0'; ++ /* start of filename */ ++ fn = strchr(tmp + 1, '"') + 1; ++ /* strip trailing " from filename */ ++ tmp = strchr(fn, '"'); ++ *tmp = 0; + /* -1 since #line is the number of the next line */ +- srcpos_set_line(xstrdup(fn.val), atoi(line) - 1); +- data_free(fn); ++ srcpos_set_line(xstrdup(fn), atoi(line) - 1); + } + YY_BREAK + case YY_STATE_EOF(INITIAL): + case YY_STATE_EOF(BYTESTRING): + case YY_STATE_EOF(PROPNODENAME): + case YY_STATE_EOF(V1): +-#line 104 "dtc-lexer.l" ++#line 96 "dtc-lexer.l" + { + if (!pop_input_file()) { + yyterminate(); +@@ -993,7 +986,7 @@ case YY_STATE_EOF(V1): + case 3: + /* rule 3 can match eol */ + YY_RULE_SETUP +-#line 110 "dtc-lexer.l" ++#line 102 "dtc-lexer.l" + { + DPRINT("String: %s\n", yytext); + yylval.data = data_copy_escape_string(yytext+1, +@@ -1003,7 +996,7 @@ YY_RULE_SETUP + YY_BREAK + case 4: + YY_RULE_SETUP +-#line 117 "dtc-lexer.l" ++#line 109 "dtc-lexer.l" + { + DPRINT("Keyword: /dts-v1/\n"); + dts_version = 1; +@@ -1013,25 +1006,33 @@ YY_RULE_SETUP + YY_BREAK + case 5: + YY_RULE_SETUP +-#line 124 "dtc-lexer.l" ++#line 116 "dtc-lexer.l" ++{ ++ DPRINT("Keyword: /plugin/\n"); ++ return DT_PLUGIN; ++ } ++ YY_BREAK ++case 6: ++YY_RULE_SETUP ++#line 121 "dtc-lexer.l" + { + DPRINT("Keyword: /memreserve/\n"); + BEGIN_DEFAULT(); + return DT_MEMRESERVE; + } + YY_BREAK +-case 6: ++case 7: + YY_RULE_SETUP +-#line 130 "dtc-lexer.l" ++#line 127 "dtc-lexer.l" + { + DPRINT("Keyword: /bits/\n"); + BEGIN_DEFAULT(); + return DT_BITS; + } + YY_BREAK +-case 7: ++case 8: + YY_RULE_SETUP +-#line 136 "dtc-lexer.l" ++#line 133 "dtc-lexer.l" + { + DPRINT("Keyword: /delete-property/\n"); + DPRINT("<PROPNODENAME>\n"); +@@ -1039,9 +1040,9 @@ YY_RULE_SETUP + return DT_DEL_PROP; + } + YY_BREAK +-case 8: ++case 9: + YY_RULE_SETUP +-#line 143 "dtc-lexer.l" ++#line 140 "dtc-lexer.l" + { + DPRINT("Keyword: /delete-node/\n"); + DPRINT("<PROPNODENAME>\n"); +@@ -1049,9 +1050,9 @@ YY_RULE_SETUP + return DT_DEL_NODE; + } + YY_BREAK +-case 9: ++case 10: + YY_RULE_SETUP +-#line 150 "dtc-lexer.l" ++#line 147 "dtc-lexer.l" + { + DPRINT("Label: %s\n", yytext); + yylval.labelref = xstrdup(yytext); +@@ -1059,9 +1060,9 @@ YY_RULE_SETUP + return DT_LABEL; + } + YY_BREAK +-case 10: ++case 11: + YY_RULE_SETUP +-#line 157 "dtc-lexer.l" ++#line 154 "dtc-lexer.l" + { + char *e; + DPRINT("Integer Literal: '%s'\n", yytext); +@@ -1069,10 +1070,7 @@ YY_RULE_SETUP + errno = 0; + yylval.integer = strtoull(yytext, &e, 0); + +- if (*e && e[strspn(e, "UL")]) { +- lexical_error("Bad integer literal '%s'", +- yytext); +- } ++ assert(!(*e) || !e[strspn(e, "UL")]); + + if (errno == ERANGE) + lexical_error("Integer literal '%s' out of range", +@@ -1084,10 +1082,10 @@ YY_RULE_SETUP + return DT_LITERAL; + } + YY_BREAK +-case 11: +-/* rule 11 can match eol */ ++case 12: ++/* rule 12 can match eol */ + YY_RULE_SETUP +-#line 179 "dtc-lexer.l" ++#line 173 "dtc-lexer.l" + { + struct data d; + DPRINT("Character literal: %s\n", yytext); +@@ -1109,18 +1107,18 @@ YY_RULE_SETUP + return DT_CHAR_LITERAL; + } + YY_BREAK +-case 12: ++case 13: + YY_RULE_SETUP +-#line 200 "dtc-lexer.l" ++#line 194 "dtc-lexer.l" + { /* label reference */ + DPRINT("Ref: %s\n", yytext+1); + yylval.labelref = xstrdup(yytext+1); + return DT_REF; + } + YY_BREAK +-case 13: ++case 14: + YY_RULE_SETUP +-#line 206 "dtc-lexer.l" ++#line 200 "dtc-lexer.l" + { /* new-style path reference */ + yytext[yyleng-1] = '\0'; + DPRINT("Ref: %s\n", yytext+2); +@@ -1128,27 +1126,27 @@ YY_RULE_SETUP + return DT_REF; + } + YY_BREAK +-case 14: ++case 15: + YY_RULE_SETUP +-#line 213 "dtc-lexer.l" ++#line 207 "dtc-lexer.l" + { + yylval.byte = strtol(yytext, NULL, 16); + DPRINT("Byte: %02x\n", (int)yylval.byte); + return DT_BYTE; + } + YY_BREAK +-case 15: ++case 16: + YY_RULE_SETUP +-#line 219 "dtc-lexer.l" ++#line 213 "dtc-lexer.l" + { + DPRINT("/BYTESTRING\n"); + BEGIN_DEFAULT(); + return ']'; + } + YY_BREAK +-case 16: ++case 17: + YY_RULE_SETUP +-#line 225 "dtc-lexer.l" ++#line 219 "dtc-lexer.l" + { + DPRINT("PropNodeName: %s\n", yytext); + yylval.propnodename = xstrdup((yytext[0] == '\\') ? +@@ -1157,75 +1155,75 @@ YY_RULE_SETUP + return DT_PROPNODENAME; + } + YY_BREAK +-case 17: ++case 18: + YY_RULE_SETUP +-#line 233 "dtc-lexer.l" ++#line 227 "dtc-lexer.l" + { + DPRINT("Binary Include\n"); + return DT_INCBIN; + } + YY_BREAK +-case 18: +-/* rule 18 can match eol */ +-YY_RULE_SETUP +-#line 238 "dtc-lexer.l" +-/* eat whitespace */ +- YY_BREAK + case 19: + /* rule 19 can match eol */ + YY_RULE_SETUP +-#line 239 "dtc-lexer.l" +-/* eat C-style comments */ ++#line 232 "dtc-lexer.l" ++/* eat whitespace */ + YY_BREAK + case 20: + /* rule 20 can match eol */ + YY_RULE_SETUP +-#line 240 "dtc-lexer.l" +-/* eat C++-style comments */ ++#line 233 "dtc-lexer.l" ++/* eat C-style comments */ + YY_BREAK + case 21: ++/* rule 21 can match eol */ + YY_RULE_SETUP +-#line 242 "dtc-lexer.l" +-{ return DT_LSHIFT; }; ++#line 234 "dtc-lexer.l" ++/* eat C++-style comments */ + YY_BREAK + case 22: + YY_RULE_SETUP +-#line 243 "dtc-lexer.l" +-{ return DT_RSHIFT; }; ++#line 236 "dtc-lexer.l" ++{ return DT_LSHIFT; }; + YY_BREAK + case 23: + YY_RULE_SETUP +-#line 244 "dtc-lexer.l" +-{ return DT_LE; }; ++#line 237 "dtc-lexer.l" ++{ return DT_RSHIFT; }; + YY_BREAK + case 24: + YY_RULE_SETUP +-#line 245 "dtc-lexer.l" +-{ return DT_GE; }; ++#line 238 "dtc-lexer.l" ++{ return DT_LE; }; + YY_BREAK + case 25: + YY_RULE_SETUP +-#line 246 "dtc-lexer.l" +-{ return DT_EQ; }; ++#line 239 "dtc-lexer.l" ++{ return DT_GE; }; + YY_BREAK + case 26: + YY_RULE_SETUP +-#line 247 "dtc-lexer.l" +-{ return DT_NE; }; ++#line 240 "dtc-lexer.l" ++{ return DT_EQ; }; + YY_BREAK + case 27: + YY_RULE_SETUP +-#line 248 "dtc-lexer.l" +-{ return DT_AND; }; ++#line 241 "dtc-lexer.l" ++{ return DT_NE; }; + YY_BREAK + case 28: + YY_RULE_SETUP +-#line 249 "dtc-lexer.l" +-{ return DT_OR; }; ++#line 242 "dtc-lexer.l" ++{ return DT_AND; }; + YY_BREAK + case 29: + YY_RULE_SETUP +-#line 251 "dtc-lexer.l" ++#line 243 "dtc-lexer.l" ++{ return DT_OR; }; ++ YY_BREAK ++case 30: ++YY_RULE_SETUP ++#line 245 "dtc-lexer.l" + { + DPRINT("Char: %c (\\x%02x)\n", yytext[0], + (unsigned)yytext[0]); +@@ -1241,12 +1239,12 @@ YY_RULE_SETUP + return yytext[0]; + } + YY_BREAK +-case 30: ++case 31: + YY_RULE_SETUP +-#line 266 "dtc-lexer.l" ++#line 260 "dtc-lexer.l" + ECHO; + YY_BREAK +-#line 1250 "dtc-lexer.lex.c" ++#line 1248 "dtc-lexer.lex.c" + + case YY_END_OF_BUFFER: + { +@@ -1376,7 +1374,6 @@ ECHO; + "fatal flex scanner internal error--no action found" ); + } /* end of action switch */ + } /* end of scanning one token */ +- } /* end of user's declarations */ + } /* end of yylex */ + + /* yy_get_next_buffer - try to read in a new buffer +@@ -1432,21 +1429,21 @@ static int yy_get_next_buffer (void) + + else + { +- yy_size_t num_to_read = ++ int num_to_read = + YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; + + while ( num_to_read <= 0 ) + { /* Not enough room in the buffer - grow it. */ + + /* just a shorter name for the current buffer */ +- YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE; ++ YY_BUFFER_STATE b = YY_CURRENT_BUFFER; + + int yy_c_buf_p_offset = + (int) ((yy_c_buf_p) - b->yy_ch_buf); + + if ( b->yy_is_our_buffer ) + { +- yy_size_t new_size = b->yy_buf_size * 2; ++ int new_size = b->yy_buf_size * 2; + + if ( new_size <= 0 ) + b->yy_buf_size += b->yy_buf_size / 8; +@@ -1477,7 +1474,7 @@ static int yy_get_next_buffer (void) + + /* Read in more data. */ + YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), +- (yy_n_chars), num_to_read ); ++ (yy_n_chars), (size_t) num_to_read ); + + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } +@@ -1539,7 +1536,7 @@ static int yy_get_next_buffer (void) + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; +- if ( yy_current_state >= 159 ) ++ if ( yy_current_state >= 166 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; +@@ -1567,13 +1564,13 @@ static int yy_get_next_buffer (void) + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; +- if ( yy_current_state >= 159 ) ++ if ( yy_current_state >= 166 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; +- yy_is_jam = (yy_current_state == 158); ++ yy_is_jam = (yy_current_state == 165); + +- return yy_is_jam ? 0 : yy_current_state; ++ return yy_is_jam ? 0 : yy_current_state; + } + + #ifndef YY_NO_INPUT +@@ -1600,7 +1597,7 @@ static int yy_get_next_buffer (void) + + else + { /* need more input */ +- yy_size_t offset = (yy_c_buf_p) - (yytext_ptr); ++ int offset = (yy_c_buf_p) - (yytext_ptr); + ++(yy_c_buf_p); + + switch ( yy_get_next_buffer( ) ) +@@ -1874,7 +1871,7 @@ void yypop_buffer_state (void) + */ + static void yyensure_buffer_stack (void) + { +- yy_size_t num_to_alloc; ++ int num_to_alloc; + + if (!(yy_buffer_stack)) { + +@@ -1971,12 +1968,12 @@ YY_BUFFER_STATE yy_scan_string (yyconst char * yystr ) + * + * @return the newly allocated buffer state object. + */ +-YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len ) ++YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, int _yybytes_len ) + { + YY_BUFFER_STATE b; + char *buf; + yy_size_t n; +- yy_size_t i; ++ int i; + + /* Get memory for full buffer, including space for trailing EOB's. */ + n = _yybytes_len + 2; +@@ -2058,7 +2055,7 @@ FILE *yyget_out (void) + /** Get the length of the current token. + * + */ +-yy_size_t yyget_leng (void) ++int yyget_leng (void) + { + return yyleng; + } +@@ -2206,7 +2203,7 @@ void yyfree (void * ptr ) + + #define YYTABLES_NAME "yytables" + +-#line 265 "dtc-lexer.l" ++#line 260 "dtc-lexer.l" + + + +diff --git a/scripts/dtc/dtc-parser.tab.c_shipped b/scripts/dtc/dtc-parser.tab.c_shipped +index 31cec50..844c462 100644 +--- a/scripts/dtc/dtc-parser.tab.c_shipped ++++ b/scripts/dtc/dtc-parser.tab.c_shipped +@@ -65,6 +65,7 @@ + #line 20 "dtc-parser.y" /* yacc.c:339 */ + + #include <stdio.h> ++#include <inttypes.h> + + #include "dtc.h" + #include "srcpos.h" +@@ -80,7 +81,7 @@ extern void yyerror(char const *s); + extern struct boot_info *the_boot_info; + extern bool treesource_error; + +-#line 84 "dtc-parser.tab.c" /* yacc.c:339 */ ++#line 85 "dtc-parser.tab.c" /* yacc.c:339 */ + + # ifndef YY_NULLPTR + # if defined __cplusplus && 201103L <= __cplusplus +@@ -116,26 +117,27 @@ extern int yydebug; + enum yytokentype + { + DT_V1 = 258, +- DT_MEMRESERVE = 259, +- DT_LSHIFT = 260, +- DT_RSHIFT = 261, +- DT_LE = 262, +- DT_GE = 263, +- DT_EQ = 264, +- DT_NE = 265, +- DT_AND = 266, +- DT_OR = 267, +- DT_BITS = 268, +- DT_DEL_PROP = 269, +- DT_DEL_NODE = 270, +- DT_PROPNODENAME = 271, +- DT_LITERAL = 272, +- DT_CHAR_LITERAL = 273, +- DT_BYTE = 274, +- DT_STRING = 275, +- DT_LABEL = 276, +- DT_REF = 277, +- DT_INCBIN = 278 ++ DT_PLUGIN = 259, ++ DT_MEMRESERVE = 260, ++ DT_LSHIFT = 261, ++ DT_RSHIFT = 262, ++ DT_LE = 263, ++ DT_GE = 264, ++ DT_EQ = 265, ++ DT_NE = 266, ++ DT_AND = 267, ++ DT_OR = 268, ++ DT_BITS = 269, ++ DT_DEL_PROP = 270, ++ DT_DEL_NODE = 271, ++ DT_PROPNODENAME = 272, ++ DT_LITERAL = 273, ++ DT_CHAR_LITERAL = 274, ++ DT_BYTE = 275, ++ DT_STRING = 276, ++ DT_LABEL = 277, ++ DT_REF = 278, ++ DT_INCBIN = 279 + }; + #endif + +@@ -144,7 +146,7 @@ extern int yydebug; + typedef union YYSTYPE YYSTYPE; + union YYSTYPE + { +-#line 38 "dtc-parser.y" /* yacc.c:355 */ ++#line 39 "dtc-parser.y" /* yacc.c:355 */ + + char *propnodename; + char *labelref; +@@ -162,8 +164,9 @@ union YYSTYPE + struct node *nodelist; + struct reserve_info *re; + uint64_t integer; ++ bool is_plugin; + +-#line 167 "dtc-parser.tab.c" /* yacc.c:355 */ ++#line 170 "dtc-parser.tab.c" /* yacc.c:355 */ + }; + # define YYSTYPE_IS_TRIVIAL 1 + # define YYSTYPE_IS_DECLARED 1 +@@ -192,7 +195,7 @@ int yyparse (void); + + /* Copy the second part of user declarations. */ + +-#line 196 "dtc-parser.tab.c" /* yacc.c:358 */ ++#line 199 "dtc-parser.tab.c" /* yacc.c:358 */ + + #ifdef short + # undef short +@@ -439,18 +442,18 @@ union yyalloc + #define YYLAST 136 + + /* YYNTOKENS -- Number of terminals. */ +-#define YYNTOKENS 47 ++#define YYNTOKENS 48 + /* YYNNTS -- Number of nonterminals. */ +-#define YYNNTS 28 ++#define YYNNTS 29 + /* YYNRULES -- Number of rules. */ +-#define YYNRULES 80 ++#define YYNRULES 82 + /* YYNSTATES -- Number of states. */ +-#define YYNSTATES 144 ++#define YYNSTATES 147 + + /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned + by yylex, with out-of-bounds checking. */ + #define YYUNDEFTOK 2 +-#define YYMAXUTOK 278 ++#define YYMAXUTOK 279 + + #define YYTRANSLATE(YYX) \ + ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) +@@ -462,16 +465,16 @@ static const yytype_uint8 yytranslate[] = + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +- 2, 2, 2, 46, 2, 2, 2, 44, 40, 2, +- 32, 34, 43, 41, 33, 42, 2, 25, 2, 2, +- 2, 2, 2, 2, 2, 2, 2, 2, 37, 24, +- 35, 28, 29, 36, 2, 2, 2, 2, 2, 2, ++ 2, 2, 2, 47, 2, 2, 2, 45, 41, 2, ++ 33, 35, 44, 42, 34, 43, 2, 26, 2, 2, ++ 2, 2, 2, 2, 2, 2, 2, 2, 38, 25, ++ 36, 29, 30, 37, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +- 2, 30, 2, 31, 39, 2, 2, 2, 2, 2, ++ 2, 31, 2, 32, 40, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +- 2, 2, 2, 26, 38, 27, 45, 2, 2, 2, ++ 2, 2, 2, 27, 39, 28, 46, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +@@ -486,22 +489,22 @@ static const yytype_uint8 yytranslate[] = + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, + 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, +- 15, 16, 17, 18, 19, 20, 21, 22, 23 ++ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24 + }; + + #if YYDEBUG + /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ + static const yytype_uint16 yyrline[] = + { +- 0, 104, 104, 113, 116, 123, 127, 135, 139, 144, +- 155, 165, 180, 188, 191, 198, 202, 206, 210, 218, +- 222, 226, 230, 234, 250, 260, 268, 271, 275, 282, +- 298, 303, 322, 336, 343, 344, 345, 352, 356, 357, +- 361, 362, 366, 367, 371, 372, 376, 377, 381, 382, +- 386, 387, 388, 392, 393, 394, 395, 396, 400, 401, +- 402, 406, 407, 408, 412, 413, 422, 431, 435, 436, +- 437, 438, 443, 446, 450, 458, 461, 465, 473, 477, +- 481 ++ 0, 108, 108, 118, 121, 129, 132, 139, 143, 151, ++ 155, 160, 171, 181, 196, 204, 207, 214, 218, 222, ++ 226, 234, 238, 242, 246, 250, 266, 276, 284, 287, ++ 291, 298, 314, 319, 338, 352, 359, 360, 361, 368, ++ 372, 373, 377, 378, 382, 383, 387, 388, 392, 393, ++ 397, 398, 402, 403, 404, 408, 409, 410, 411, 412, ++ 416, 417, 418, 422, 423, 424, 428, 429, 430, 431, ++ 435, 436, 437, 438, 443, 446, 450, 458, 461, 465, ++ 473, 477, 481 + }; + #endif + +@@ -510,19 +513,19 @@ static const yytype_uint16 yyrline[] = + First, the terminals, then, starting at YYNTOKENS, nonterminals. */ + static const char *const yytname[] = + { +- "$end", "error", "$undefined", "DT_V1", "DT_MEMRESERVE", "DT_LSHIFT", +- "DT_RSHIFT", "DT_LE", "DT_GE", "DT_EQ", "DT_NE", "DT_AND", "DT_OR", +- "DT_BITS", "DT_DEL_PROP", "DT_DEL_NODE", "DT_PROPNODENAME", "DT_LITERAL", +- "DT_CHAR_LITERAL", "DT_BYTE", "DT_STRING", "DT_LABEL", "DT_REF", +- "DT_INCBIN", "';'", "'/'", "'{'", "'}'", "'='", "'>'", "'['", "']'", +- "'('", "','", "')'", "'<'", "'?'", "':'", "'|'", "'^'", "'&'", "'+'", +- "'-'", "'*'", "'%'", "'~'", "'!'", "$accept", "sourcefile", +- "memreserves", "memreserve", "devicetree", "nodedef", "proplist", +- "propdef", "propdata", "propdataprefix", "arrayprefix", "integer_prim", +- "integer_expr", "integer_trinary", "integer_or", "integer_and", +- "integer_bitor", "integer_bitxor", "integer_bitand", "integer_eq", +- "integer_rela", "integer_shift", "integer_add", "integer_mul", +- "integer_unary", "bytestring", "subnodes", "subnode", YY_NULLPTR ++ "$end", "error", "$undefined", "DT_V1", "DT_PLUGIN", "DT_MEMRESERVE", ++ "DT_LSHIFT", "DT_RSHIFT", "DT_LE", "DT_GE", "DT_EQ", "DT_NE", "DT_AND", ++ "DT_OR", "DT_BITS", "DT_DEL_PROP", "DT_DEL_NODE", "DT_PROPNODENAME", ++ "DT_LITERAL", "DT_CHAR_LITERAL", "DT_BYTE", "DT_STRING", "DT_LABEL", ++ "DT_REF", "DT_INCBIN", "';'", "'/'", "'{'", "'}'", "'='", "'>'", "'['", ++ "']'", "'('", "','", "')'", "'<'", "'?'", "':'", "'|'", "'^'", "'&'", ++ "'+'", "'-'", "'*'", "'%'", "'~'", "'!'", "$accept", "sourcefile", ++ "plugindecl", "memreserves", "memreserve", "devicetree", "nodedef", ++ "proplist", "propdef", "propdata", "propdataprefix", "arrayprefix", ++ "integer_prim", "integer_expr", "integer_trinary", "integer_or", ++ "integer_and", "integer_bitor", "integer_bitxor", "integer_bitand", ++ "integer_eq", "integer_rela", "integer_shift", "integer_add", ++ "integer_mul", "integer_unary", "bytestring", "subnodes", "subnode", YY_NULLPTR + }; + #endif + +@@ -533,16 +536,16 @@ static const yytype_uint16 yytoknum[] = + { + 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, + 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, +- 275, 276, 277, 278, 59, 47, 123, 125, 61, 62, +- 91, 93, 40, 44, 41, 60, 63, 58, 124, 94, +- 38, 43, 45, 42, 37, 126, 33 ++ 275, 276, 277, 278, 279, 59, 47, 123, 125, 61, ++ 62, 91, 93, 40, 44, 41, 60, 63, 58, 124, ++ 94, 38, 43, 45, 42, 37, 126, 33 + }; + # endif + +-#define YYPACT_NINF -81 ++#define YYPACT_NINF -84 + + #define yypact_value_is_default(Yystate) \ +- (!!((Yystate) == (-81))) ++ (!!((Yystate) == (-84))) + + #define YYTABLE_NINF -1 + +@@ -553,21 +556,21 @@ static const yytype_uint16 yytoknum[] = + STATE-NUM. */ + static const yytype_int8 yypact[] = + { +- 16, -11, 21, 10, -81, 25, 10, 19, 10, -81, +- -81, -9, 25, -81, 2, 51, -81, -9, -9, -9, +- -81, 1, -81, -6, 50, 14, 28, 29, 36, 3, +- 58, 44, -3, -81, 47, -81, -81, 65, 68, 2, +- 2, -81, -81, -81, -81, -9, -9, -9, -9, -9, +- -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, +- -9, -9, -9, -9, -81, 63, 69, 2, -81, -81, +- 50, 57, 14, 28, 29, 36, 3, 3, 58, 58, +- 58, 58, 44, 44, -3, -3, -81, -81, -81, 79, +- 80, -8, 63, -81, 72, 63, -81, -81, -9, 76, +- 77, -81, -81, -81, -81, -81, 78, -81, -81, -81, +- -81, -81, 35, 4, -81, -81, -81, -81, 86, -81, +- -81, -81, 73, -81, -81, 33, 71, 84, 39, -81, +- -81, -81, -81, -81, 41, -81, -81, -81, 25, -81, +- 74, 25, 75, -81 ++ 15, -12, 35, 42, -84, 27, 9, -84, 24, 9, ++ 43, 9, -84, -84, -10, 24, -84, 60, 44, -84, ++ -10, -10, -10, -84, 55, -84, -7, 52, 53, 51, ++ 54, 10, 2, 38, 37, -4, -84, 68, -84, -84, ++ 71, 73, 60, 60, -84, -84, -84, -84, -10, -10, ++ -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, ++ -10, -10, -10, -10, -10, -10, -10, -84, 56, 72, ++ 60, -84, -84, 52, 61, 53, 51, 54, 10, 2, ++ 2, 38, 38, 38, 38, 37, 37, -4, -4, -84, ++ -84, -84, 81, 83, 34, 56, -84, 74, 56, -84, ++ -84, -10, 76, 78, -84, -84, -84, -84, -84, 79, ++ -84, -84, -84, -84, -84, -6, 3, -84, -84, -84, ++ -84, 87, -84, -84, -84, 75, -84, -84, 32, 70, ++ 86, 36, -84, -84, -84, -84, -84, 47, -84, -84, ++ -84, 24, -84, 77, 24, 80, -84 + }; + + /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. +@@ -575,37 +578,37 @@ static const yytype_int8 yypact[] = + means the default is an error. */ + static const yytype_uint8 yydefact[] = + { +- 0, 0, 0, 3, 1, 0, 0, 0, 3, 34, +- 35, 0, 0, 6, 0, 2, 4, 0, 0, 0, +- 68, 0, 37, 38, 40, 42, 44, 46, 48, 50, +- 53, 60, 63, 67, 0, 13, 7, 0, 0, 0, +- 0, 69, 70, 71, 36, 0, 0, 0, 0, 0, ++ 0, 0, 0, 3, 1, 0, 5, 4, 0, 0, ++ 0, 5, 36, 37, 0, 0, 8, 0, 2, 6, ++ 0, 0, 0, 70, 0, 39, 40, 42, 44, 46, ++ 48, 50, 52, 55, 62, 65, 69, 0, 15, 9, ++ 0, 0, 0, 0, 71, 72, 73, 38, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +- 0, 0, 0, 0, 5, 75, 0, 0, 10, 8, +- 41, 0, 43, 45, 47, 49, 51, 52, 56, 57, +- 55, 54, 58, 59, 61, 62, 65, 64, 66, 0, +- 0, 0, 0, 14, 0, 75, 11, 9, 0, 0, +- 0, 16, 26, 78, 18, 80, 0, 77, 76, 39, +- 17, 79, 0, 0, 12, 25, 15, 27, 0, 19, +- 28, 22, 0, 72, 30, 0, 0, 0, 0, 33, +- 32, 20, 31, 29, 0, 73, 74, 21, 0, 24, +- 0, 0, 0, 23 ++ 0, 0, 0, 0, 0, 0, 0, 7, 77, 0, ++ 0, 12, 10, 43, 0, 45, 47, 49, 51, 53, ++ 54, 58, 59, 57, 56, 60, 61, 63, 64, 67, ++ 66, 68, 0, 0, 0, 0, 16, 0, 77, 13, ++ 11, 0, 0, 0, 18, 28, 80, 20, 82, 0, ++ 79, 78, 41, 19, 81, 0, 0, 14, 27, 17, ++ 29, 0, 21, 30, 24, 0, 74, 32, 0, 0, ++ 0, 0, 35, 34, 22, 33, 31, 0, 75, 76, ++ 23, 0, 26, 0, 0, 0, 25 + }; + + /* YYPGOTO[NTERM-NUM]. */ + static const yytype_int8 yypgoto[] = + { +- -81, -81, 100, 104, -81, -38, -81, -80, -81, -81, +- -81, -5, 66, 13, -81, 70, 67, 81, 64, 82, +- 37, 27, 34, 38, -14, -81, 22, 24 ++ -84, -84, -84, 98, 101, -84, -41, -84, -83, -84, ++ -84, -84, -8, 63, 12, -84, 66, 67, 65, 69, ++ 82, 29, 18, 25, 26, -17, -84, 20, 28 + }; + + /* YYDEFGOTO[NTERM-NUM]. */ + static const yytype_int16 yydefgoto[] = + { +- -1, 2, 7, 8, 15, 36, 65, 93, 112, 113, +- 125, 20, 21, 22, 23, 24, 25, 26, 27, 28, +- 29, 30, 31, 32, 33, 128, 94, 95 ++ -1, 2, 6, 10, 11, 18, 39, 68, 96, 115, ++ 116, 128, 23, 24, 25, 26, 27, 28, 29, 30, ++ 31, 32, 33, 34, 35, 36, 131, 97, 98 + }; + + /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If +@@ -613,87 +616,87 @@ static const yytype_int16 yydefgoto[] = + number is the opposite. If YYTABLE_NINF, syntax error. */ + static const yytype_uint8 yytable[] = + { +- 12, 68, 69, 41, 42, 43, 45, 34, 9, 10, +- 53, 54, 104, 3, 5, 107, 101, 118, 35, 1, +- 102, 4, 61, 11, 119, 120, 121, 122, 35, 97, +- 46, 6, 55, 17, 123, 44, 18, 19, 56, 124, +- 62, 63, 9, 10, 14, 51, 52, 86, 87, 88, +- 9, 10, 48, 103, 129, 130, 115, 11, 135, 116, +- 136, 47, 131, 57, 58, 11, 37, 49, 117, 50, +- 137, 64, 38, 39, 138, 139, 40, 89, 90, 91, +- 78, 79, 80, 81, 92, 59, 60, 66, 76, 77, +- 67, 82, 83, 96, 98, 99, 100, 84, 85, 106, +- 110, 111, 114, 126, 134, 127, 133, 141, 16, 143, +- 13, 109, 71, 74, 72, 70, 105, 108, 0, 0, +- 132, 0, 0, 0, 0, 0, 0, 0, 0, 73, +- 0, 0, 75, 140, 0, 0, 142 ++ 15, 71, 72, 44, 45, 46, 48, 37, 12, 13, ++ 56, 57, 107, 3, 8, 110, 118, 121, 1, 119, ++ 54, 55, 64, 14, 122, 123, 124, 125, 120, 100, ++ 49, 9, 58, 20, 126, 4, 21, 22, 59, 127, ++ 65, 66, 12, 13, 60, 61, 5, 89, 90, 91, ++ 12, 13, 7, 106, 132, 133, 138, 14, 139, 104, ++ 40, 38, 134, 105, 50, 14, 41, 42, 140, 17, ++ 43, 92, 93, 94, 81, 82, 83, 84, 95, 62, ++ 63, 141, 142, 79, 80, 85, 86, 38, 87, 88, ++ 47, 52, 51, 67, 69, 53, 70, 99, 102, 101, ++ 103, 113, 109, 114, 117, 129, 136, 137, 130, 19, ++ 16, 144, 74, 112, 73, 146, 76, 75, 111, 0, ++ 135, 77, 0, 108, 0, 0, 0, 0, 0, 0, ++ 0, 0, 0, 143, 0, 78, 145 + }; + + static const yytype_int16 yycheck[] = + { +- 5, 39, 40, 17, 18, 19, 12, 12, 17, 18, +- 7, 8, 92, 24, 4, 95, 24, 13, 26, 3, +- 28, 0, 25, 32, 20, 21, 22, 23, 26, 67, +- 36, 21, 29, 42, 30, 34, 45, 46, 35, 35, +- 43, 44, 17, 18, 25, 9, 10, 61, 62, 63, +- 17, 18, 38, 91, 21, 22, 21, 32, 19, 24, +- 21, 11, 29, 5, 6, 32, 15, 39, 33, 40, +- 31, 24, 21, 22, 33, 34, 25, 14, 15, 16, +- 53, 54, 55, 56, 21, 41, 42, 22, 51, 52, +- 22, 57, 58, 24, 37, 16, 16, 59, 60, 27, +- 24, 24, 24, 17, 20, 32, 35, 33, 8, 34, +- 6, 98, 46, 49, 47, 45, 92, 95, -1, -1, +- 125, -1, -1, -1, -1, -1, -1, -1, -1, 48, +- -1, -1, 50, 138, -1, -1, 141 ++ 8, 42, 43, 20, 21, 22, 13, 15, 18, 19, ++ 8, 9, 95, 25, 5, 98, 22, 14, 3, 25, ++ 10, 11, 26, 33, 21, 22, 23, 24, 34, 70, ++ 37, 22, 30, 43, 31, 0, 46, 47, 36, 36, ++ 44, 45, 18, 19, 6, 7, 4, 64, 65, 66, ++ 18, 19, 25, 94, 22, 23, 20, 33, 22, 25, ++ 16, 27, 30, 29, 12, 33, 22, 23, 32, 26, ++ 26, 15, 16, 17, 56, 57, 58, 59, 22, 42, ++ 43, 34, 35, 54, 55, 60, 61, 27, 62, 63, ++ 35, 40, 39, 25, 23, 41, 23, 25, 17, 38, ++ 17, 25, 28, 25, 25, 18, 36, 21, 33, 11, ++ 9, 34, 49, 101, 48, 35, 51, 50, 98, -1, ++ 128, 52, -1, 95, -1, -1, -1, -1, -1, -1, ++ -1, -1, -1, 141, -1, 53, 144 + }; + + /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ + static const yytype_uint8 yystos[] = + { +- 0, 3, 48, 24, 0, 4, 21, 49, 50, 17, +- 18, 32, 58, 50, 25, 51, 49, 42, 45, 46, +- 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, +- 68, 69, 70, 71, 58, 26, 52, 15, 21, 22, +- 25, 71, 71, 71, 34, 12, 36, 11, 38, 39, +- 40, 9, 10, 7, 8, 29, 35, 5, 6, 41, +- 42, 25, 43, 44, 24, 53, 22, 22, 52, 52, +- 62, 59, 63, 64, 65, 66, 67, 67, 68, 68, +- 68, 68, 69, 69, 70, 70, 71, 71, 71, 14, +- 15, 16, 21, 54, 73, 74, 24, 52, 37, 16, +- 16, 24, 28, 52, 54, 74, 27, 54, 73, 60, +- 24, 24, 55, 56, 24, 21, 24, 33, 13, 20, +- 21, 22, 23, 30, 35, 57, 17, 32, 72, 21, +- 22, 29, 58, 35, 20, 19, 21, 31, 33, 34, +- 58, 33, 58, 34 ++ 0, 3, 49, 25, 0, 4, 50, 25, 5, 22, ++ 51, 52, 18, 19, 33, 60, 52, 26, 53, 51, ++ 43, 46, 47, 60, 61, 62, 63, 64, 65, 66, ++ 67, 68, 69, 70, 71, 72, 73, 60, 27, 54, ++ 16, 22, 23, 26, 73, 73, 73, 35, 13, 37, ++ 12, 39, 40, 41, 10, 11, 8, 9, 30, 36, ++ 6, 7, 42, 43, 26, 44, 45, 25, 55, 23, ++ 23, 54, 54, 64, 61, 65, 66, 67, 68, 69, ++ 69, 70, 70, 70, 70, 71, 71, 72, 72, 73, ++ 73, 73, 15, 16, 17, 22, 56, 75, 76, 25, ++ 54, 38, 17, 17, 25, 29, 54, 56, 76, 28, ++ 56, 75, 62, 25, 25, 57, 58, 25, 22, 25, ++ 34, 14, 21, 22, 23, 24, 31, 36, 59, 18, ++ 33, 74, 22, 23, 30, 60, 36, 21, 20, 22, ++ 32, 34, 35, 60, 34, 60, 35 + }; + + /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ + static const yytype_uint8 yyr1[] = + { +- 0, 47, 48, 49, 49, 50, 50, 51, 51, 51, +- 51, 51, 52, 53, 53, 54, 54, 54, 54, 55, +- 55, 55, 55, 55, 55, 55, 56, 56, 56, 57, +- 57, 57, 57, 57, 58, 58, 58, 59, 60, 60, +- 61, 61, 62, 62, 63, 63, 64, 64, 65, 65, +- 66, 66, 66, 67, 67, 67, 67, 67, 68, 68, +- 68, 69, 69, 69, 70, 70, 70, 70, 71, 71, +- 71, 71, 72, 72, 72, 73, 73, 73, 74, 74, +- 74 ++ 0, 48, 49, 50, 50, 51, 51, 52, 52, 53, ++ 53, 53, 53, 53, 54, 55, 55, 56, 56, 56, ++ 56, 57, 57, 57, 57, 57, 57, 57, 58, 58, ++ 58, 59, 59, 59, 59, 59, 60, 60, 60, 61, ++ 62, 62, 63, 63, 64, 64, 65, 65, 66, 66, ++ 67, 67, 68, 68, 68, 69, 69, 69, 69, 69, ++ 70, 70, 70, 71, 71, 71, 72, 72, 72, 72, ++ 73, 73, 73, 73, 74, 74, 74, 75, 75, 75, ++ 76, 76, 76 + }; + + /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ + static const yytype_uint8 yyr2[] = + { +- 0, 2, 4, 0, 2, 4, 2, 2, 3, 4, +- 3, 4, 5, 0, 2, 4, 2, 3, 2, 2, +- 3, 4, 2, 9, 5, 2, 0, 2, 2, 3, +- 1, 2, 2, 2, 1, 1, 3, 1, 1, 5, +- 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, +- 1, 3, 3, 1, 3, 3, 3, 3, 3, 3, +- 1, 3, 3, 1, 3, 3, 3, 1, 1, 2, +- 2, 2, 0, 2, 2, 0, 2, 2, 2, 3, +- 2 ++ 0, 2, 5, 0, 2, 0, 2, 4, 2, 2, ++ 3, 4, 3, 4, 5, 0, 2, 4, 2, 3, ++ 2, 2, 3, 4, 2, 9, 5, 2, 0, 2, ++ 2, 3, 1, 2, 2, 2, 1, 1, 3, 1, ++ 1, 5, 1, 3, 1, 3, 1, 3, 1, 3, ++ 1, 3, 1, 3, 3, 1, 3, 3, 3, 3, ++ 3, 3, 1, 3, 3, 1, 3, 3, 3, 1, ++ 1, 2, 2, 2, 0, 2, 2, 0, 2, 2, ++ 2, 3, 2 + }; + + +@@ -1463,65 +1466,82 @@ yyreduce: + switch (yyn) + { + case 2: +-#line 105 "dtc-parser.y" /* yacc.c:1646 */ ++#line 109 "dtc-parser.y" /* yacc.c:1646 */ + { ++ (yyvsp[0].node)->is_plugin = (yyvsp[-2].is_plugin); + the_boot_info = build_boot_info((yyvsp[-1].re), (yyvsp[0].node), + guess_boot_cpuid((yyvsp[0].node))); + } +-#line 1472 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1476 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + + case 3: +-#line 113 "dtc-parser.y" /* yacc.c:1646 */ ++#line 118 "dtc-parser.y" /* yacc.c:1646 */ + { +- (yyval.re) = NULL; ++ (yyval.is_plugin) = false; + } +-#line 1480 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1484 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + + case 4: +-#line 117 "dtc-parser.y" /* yacc.c:1646 */ ++#line 122 "dtc-parser.y" /* yacc.c:1646 */ + { +- (yyval.re) = chain_reserve_entry((yyvsp[-1].re), (yyvsp[0].re)); ++ (yyval.is_plugin) = true; + } +-#line 1488 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1492 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + + case 5: +-#line 124 "dtc-parser.y" /* yacc.c:1646 */ ++#line 129 "dtc-parser.y" /* yacc.c:1646 */ + { +- (yyval.re) = build_reserve_entry((yyvsp[-2].integer), (yyvsp[-1].integer)); ++ (yyval.re) = NULL; + } +-#line 1496 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1500 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + + case 6: +-#line 128 "dtc-parser.y" /* yacc.c:1646 */ ++#line 133 "dtc-parser.y" /* yacc.c:1646 */ ++ { ++ (yyval.re) = chain_reserve_entry((yyvsp[-1].re), (yyvsp[0].re)); ++ } ++#line 1508 "dtc-parser.tab.c" /* yacc.c:1646 */ ++ break; + -+ spidev@0{ -+ compatible = "spidev"; -+ reg = <0>; /* CE0 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; -+ }; ++ case 7: ++#line 140 "dtc-parser.y" /* yacc.c:1646 */ ++ { ++ (yyval.re) = build_reserve_entry((yyvsp[-2].integer), (yyvsp[-1].integer)); ++ } ++#line 1516 "dtc-parser.tab.c" /* yacc.c:1646 */ ++ break; + -+ spidev@1{ -+ compatible = "spidev"; -+ reg = <1>; /* CE1 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; -+ }; -+}; -+ -+&i2c0 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&i2c0_pins>; -+ clock-frequency = <100000>; -+}; -+ -+&i2c1 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&i2c1_pins>; -+ clock-frequency = <100000>; -+}; ++ case 8: ++#line 144 "dtc-parser.y" /* yacc.c:1646 */ + { + add_label(&(yyvsp[0].re)->labels, (yyvsp[-1].labelref)); + (yyval.re) = (yyvsp[0].re); + } +-#line 1505 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1525 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 7: +-#line 136 "dtc-parser.y" /* yacc.c:1646 */ ++ case 9: ++#line 152 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = name_node((yyvsp[0].node), ""); + } +-#line 1513 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1533 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 8: +-#line 140 "dtc-parser.y" /* yacc.c:1646 */ ++ case 10: ++#line 156 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = merge_nodes((yyvsp[-2].node), (yyvsp[0].node)); + } +-#line 1521 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1541 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 9: +-#line 145 "dtc-parser.y" /* yacc.c:1646 */ ++ case 11: ++#line 161 "dtc-parser.y" /* yacc.c:1646 */ + { + struct node *target = get_node_by_ref((yyvsp[-3].node), (yyvsp[-1].labelref)); + +@@ -1532,11 +1552,11 @@ yyreduce: + ERROR(&(yylsp[-1]), "Label or path %s not found", (yyvsp[-1].labelref)); + (yyval.node) = (yyvsp[-3].node); + } +-#line 1536 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1556 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 10: +-#line 156 "dtc-parser.y" /* yacc.c:1646 */ ++ case 12: ++#line 172 "dtc-parser.y" /* yacc.c:1646 */ + { + struct node *target = get_node_by_ref((yyvsp[-2].node), (yyvsp[-1].labelref)); + +@@ -1546,11 +1566,11 @@ yyreduce: + ERROR(&(yylsp[-1]), "Label or path %s not found", (yyvsp[-1].labelref)); + (yyval.node) = (yyvsp[-2].node); + } +-#line 1550 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1570 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 11: +-#line 166 "dtc-parser.y" /* yacc.c:1646 */ ++ case 13: ++#line 182 "dtc-parser.y" /* yacc.c:1646 */ + { + struct node *target = get_node_by_ref((yyvsp[-3].node), (yyvsp[-1].labelref)); + +@@ -1562,100 +1582,100 @@ yyreduce: + + (yyval.node) = (yyvsp[-3].node); + } +-#line 1566 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1586 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 12: +-#line 181 "dtc-parser.y" /* yacc.c:1646 */ ++ case 14: ++#line 197 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = build_node((yyvsp[-3].proplist), (yyvsp[-2].nodelist)); + } +-#line 1574 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1594 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 13: +-#line 188 "dtc-parser.y" /* yacc.c:1646 */ ++ case 15: ++#line 204 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.proplist) = NULL; + } +-#line 1582 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1602 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 14: +-#line 192 "dtc-parser.y" /* yacc.c:1646 */ ++ case 16: ++#line 208 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.proplist) = chain_property((yyvsp[0].prop), (yyvsp[-1].proplist)); + } +-#line 1590 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1610 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 15: +-#line 199 "dtc-parser.y" /* yacc.c:1646 */ ++ case 17: ++#line 215 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.prop) = build_property((yyvsp[-3].propnodename), (yyvsp[-1].data)); + } +-#line 1598 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1618 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 16: +-#line 203 "dtc-parser.y" /* yacc.c:1646 */ ++ case 18: ++#line 219 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.prop) = build_property((yyvsp[-1].propnodename), empty_data); + } +-#line 1606 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1626 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 17: +-#line 207 "dtc-parser.y" /* yacc.c:1646 */ ++ case 19: ++#line 223 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.prop) = build_property_delete((yyvsp[-1].propnodename)); + } +-#line 1614 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1634 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 18: +-#line 211 "dtc-parser.y" /* yacc.c:1646 */ ++ case 20: ++#line 227 "dtc-parser.y" /* yacc.c:1646 */ + { + add_label(&(yyvsp[0].prop)->labels, (yyvsp[-1].labelref)); + (yyval.prop) = (yyvsp[0].prop); + } +-#line 1623 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1643 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 19: +-#line 219 "dtc-parser.y" /* yacc.c:1646 */ ++ case 21: ++#line 235 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.data) = data_merge((yyvsp[-1].data), (yyvsp[0].data)); + } +-#line 1631 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1651 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 20: +-#line 223 "dtc-parser.y" /* yacc.c:1646 */ ++ case 22: ++#line 239 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.data) = data_merge((yyvsp[-2].data), (yyvsp[-1].array).data); + } +-#line 1639 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1659 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 21: +-#line 227 "dtc-parser.y" /* yacc.c:1646 */ ++ case 23: ++#line 243 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.data) = data_merge((yyvsp[-3].data), (yyvsp[-1].data)); + } +-#line 1647 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1667 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 22: +-#line 231 "dtc-parser.y" /* yacc.c:1646 */ ++ case 24: ++#line 247 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.data) = data_add_marker((yyvsp[-1].data), REF_PATH, (yyvsp[0].labelref)); + } +-#line 1655 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1675 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 23: +-#line 235 "dtc-parser.y" /* yacc.c:1646 */ ++ case 25: ++#line 251 "dtc-parser.y" /* yacc.c:1646 */ + { + FILE *f = srcfile_relative_open((yyvsp[-5].data).val, NULL); + struct data d; +@@ -1671,11 +1691,11 @@ yyreduce: + (yyval.data) = data_merge((yyvsp[-8].data), d); + fclose(f); + } +-#line 1675 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1695 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 24: +-#line 251 "dtc-parser.y" /* yacc.c:1646 */ ++ case 26: ++#line 267 "dtc-parser.y" /* yacc.c:1646 */ + { + FILE *f = srcfile_relative_open((yyvsp[-1].data).val, NULL); + struct data d = empty_data; +@@ -1685,43 +1705,43 @@ yyreduce: + (yyval.data) = data_merge((yyvsp[-4].data), d); + fclose(f); + } +-#line 1689 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1709 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 25: +-#line 261 "dtc-parser.y" /* yacc.c:1646 */ ++ case 27: ++#line 277 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.data) = data_add_marker((yyvsp[-1].data), LABEL, (yyvsp[0].labelref)); + } +-#line 1697 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1717 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 26: +-#line 268 "dtc-parser.y" /* yacc.c:1646 */ ++ case 28: ++#line 284 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.data) = empty_data; + } +-#line 1705 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1725 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 27: +-#line 272 "dtc-parser.y" /* yacc.c:1646 */ ++ case 29: ++#line 288 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.data) = (yyvsp[-1].data); + } +-#line 1713 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1733 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 28: +-#line 276 "dtc-parser.y" /* yacc.c:1646 */ ++ case 30: ++#line 292 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.data) = data_add_marker((yyvsp[-1].data), LABEL, (yyvsp[0].labelref)); + } +-#line 1721 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1741 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 29: +-#line 283 "dtc-parser.y" /* yacc.c:1646 */ ++ case 31: ++#line 299 "dtc-parser.y" /* yacc.c:1646 */ + { + unsigned long long bits; + +@@ -1737,20 +1757,20 @@ yyreduce: + (yyval.array).data = empty_data; + (yyval.array).bits = bits; + } +-#line 1741 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1761 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 30: +-#line 299 "dtc-parser.y" /* yacc.c:1646 */ ++ case 32: ++#line 315 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.array).data = empty_data; + (yyval.array).bits = 32; + } +-#line 1750 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1770 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 31: +-#line 304 "dtc-parser.y" /* yacc.c:1646 */ ++ case 33: ++#line 320 "dtc-parser.y" /* yacc.c:1646 */ + { + if ((yyvsp[-1].array).bits < 64) { + uint64_t mask = (1ULL << (yyvsp[-1].array).bits) - 1; +@@ -1769,11 +1789,11 @@ yyreduce: + + (yyval.array).data = data_append_integer((yyvsp[-1].array).data, (yyvsp[0].integer), (yyvsp[-1].array).bits); + } +-#line 1773 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1793 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 32: +-#line 323 "dtc-parser.y" /* yacc.c:1646 */ ++ case 34: ++#line 339 "dtc-parser.y" /* yacc.c:1646 */ + { + uint64_t val = ~0ULL >> (64 - (yyvsp[-1].array).bits); + +@@ -1787,247 +1807,233 @@ yyreduce: + + (yyval.array).data = data_append_integer((yyvsp[-1].array).data, val, (yyvsp[-1].array).bits); + } +-#line 1791 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1811 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 33: +-#line 337 "dtc-parser.y" /* yacc.c:1646 */ ++ case 35: ++#line 353 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.array).data = data_add_marker((yyvsp[-1].array).data, LABEL, (yyvsp[0].labelref)); + } +-#line 1799 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1819 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 36: +-#line 346 "dtc-parser.y" /* yacc.c:1646 */ ++ case 38: ++#line 362 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.integer) = (yyvsp[-1].integer); + } +-#line 1807 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1827 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 39: +-#line 357 "dtc-parser.y" /* yacc.c:1646 */ ++ case 41: ++#line 373 "dtc-parser.y" /* yacc.c:1646 */ + { (yyval.integer) = (yyvsp[-4].integer) ? (yyvsp[-2].integer) : (yyvsp[0].integer); } +-#line 1813 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1833 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 41: +-#line 362 "dtc-parser.y" /* yacc.c:1646 */ ++ case 43: ++#line 378 "dtc-parser.y" /* yacc.c:1646 */ + { (yyval.integer) = (yyvsp[-2].integer) || (yyvsp[0].integer); } +-#line 1819 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1839 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 43: +-#line 367 "dtc-parser.y" /* yacc.c:1646 */ ++ case 45: ++#line 383 "dtc-parser.y" /* yacc.c:1646 */ + { (yyval.integer) = (yyvsp[-2].integer) && (yyvsp[0].integer); } +-#line 1825 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1845 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 45: +-#line 372 "dtc-parser.y" /* yacc.c:1646 */ ++ case 47: ++#line 388 "dtc-parser.y" /* yacc.c:1646 */ + { (yyval.integer) = (yyvsp[-2].integer) | (yyvsp[0].integer); } +-#line 1831 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1851 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 47: +-#line 377 "dtc-parser.y" /* yacc.c:1646 */ ++ case 49: ++#line 393 "dtc-parser.y" /* yacc.c:1646 */ + { (yyval.integer) = (yyvsp[-2].integer) ^ (yyvsp[0].integer); } +-#line 1837 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1857 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 49: +-#line 382 "dtc-parser.y" /* yacc.c:1646 */ ++ case 51: ++#line 398 "dtc-parser.y" /* yacc.c:1646 */ + { (yyval.integer) = (yyvsp[-2].integer) & (yyvsp[0].integer); } +-#line 1843 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1863 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 51: +-#line 387 "dtc-parser.y" /* yacc.c:1646 */ ++ case 53: ++#line 403 "dtc-parser.y" /* yacc.c:1646 */ + { (yyval.integer) = (yyvsp[-2].integer) == (yyvsp[0].integer); } +-#line 1849 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1869 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 52: +-#line 388 "dtc-parser.y" /* yacc.c:1646 */ ++ case 54: ++#line 404 "dtc-parser.y" /* yacc.c:1646 */ + { (yyval.integer) = (yyvsp[-2].integer) != (yyvsp[0].integer); } +-#line 1855 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1875 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 54: +-#line 393 "dtc-parser.y" /* yacc.c:1646 */ ++ case 56: ++#line 409 "dtc-parser.y" /* yacc.c:1646 */ + { (yyval.integer) = (yyvsp[-2].integer) < (yyvsp[0].integer); } +-#line 1861 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1881 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 55: +-#line 394 "dtc-parser.y" /* yacc.c:1646 */ ++ case 57: ++#line 410 "dtc-parser.y" /* yacc.c:1646 */ + { (yyval.integer) = (yyvsp[-2].integer) > (yyvsp[0].integer); } +-#line 1867 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1887 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 56: +-#line 395 "dtc-parser.y" /* yacc.c:1646 */ ++ case 58: ++#line 411 "dtc-parser.y" /* yacc.c:1646 */ + { (yyval.integer) = (yyvsp[-2].integer) <= (yyvsp[0].integer); } +-#line 1873 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1893 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 57: +-#line 396 "dtc-parser.y" /* yacc.c:1646 */ ++ case 59: ++#line 412 "dtc-parser.y" /* yacc.c:1646 */ + { (yyval.integer) = (yyvsp[-2].integer) >= (yyvsp[0].integer); } +-#line 1879 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1899 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 58: +-#line 400 "dtc-parser.y" /* yacc.c:1646 */ ++ case 60: ++#line 416 "dtc-parser.y" /* yacc.c:1646 */ + { (yyval.integer) = (yyvsp[-2].integer) << (yyvsp[0].integer); } +-#line 1885 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1905 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 59: +-#line 401 "dtc-parser.y" /* yacc.c:1646 */ ++ case 61: ++#line 417 "dtc-parser.y" /* yacc.c:1646 */ + { (yyval.integer) = (yyvsp[-2].integer) >> (yyvsp[0].integer); } +-#line 1891 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1911 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 61: +-#line 406 "dtc-parser.y" /* yacc.c:1646 */ ++ case 63: ++#line 422 "dtc-parser.y" /* yacc.c:1646 */ + { (yyval.integer) = (yyvsp[-2].integer) + (yyvsp[0].integer); } +-#line 1897 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1917 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 62: +-#line 407 "dtc-parser.y" /* yacc.c:1646 */ ++ case 64: ++#line 423 "dtc-parser.y" /* yacc.c:1646 */ + { (yyval.integer) = (yyvsp[-2].integer) - (yyvsp[0].integer); } +-#line 1903 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1923 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 64: +-#line 412 "dtc-parser.y" /* yacc.c:1646 */ ++ case 66: ++#line 428 "dtc-parser.y" /* yacc.c:1646 */ + { (yyval.integer) = (yyvsp[-2].integer) * (yyvsp[0].integer); } +-#line 1909 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1929 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 65: +-#line 414 "dtc-parser.y" /* yacc.c:1646 */ +- { +- if ((yyvsp[0].integer) != 0) { +- (yyval.integer) = (yyvsp[-2].integer) / (yyvsp[0].integer); +- } else { +- ERROR(&(yyloc), "Division by zero"); +- (yyval.integer) = 0; +- } +- } +-#line 1922 "dtc-parser.tab.c" /* yacc.c:1646 */ ++ case 67: ++#line 429 "dtc-parser.y" /* yacc.c:1646 */ ++ { (yyval.integer) = (yyvsp[-2].integer) / (yyvsp[0].integer); } ++#line 1935 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 66: +-#line 423 "dtc-parser.y" /* yacc.c:1646 */ +- { +- if ((yyvsp[0].integer) != 0) { +- (yyval.integer) = (yyvsp[-2].integer) % (yyvsp[0].integer); +- } else { +- ERROR(&(yyloc), "Division by zero"); +- (yyval.integer) = 0; +- } +- } +-#line 1935 "dtc-parser.tab.c" /* yacc.c:1646 */ ++ case 68: ++#line 430 "dtc-parser.y" /* yacc.c:1646 */ ++ { (yyval.integer) = (yyvsp[-2].integer) % (yyvsp[0].integer); } ++#line 1941 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 69: ++ case 71: + #line 436 "dtc-parser.y" /* yacc.c:1646 */ + { (yyval.integer) = -(yyvsp[0].integer); } +-#line 1941 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1947 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 70: ++ case 72: + #line 437 "dtc-parser.y" /* yacc.c:1646 */ + { (yyval.integer) = ~(yyvsp[0].integer); } +-#line 1947 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1953 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 71: ++ case 73: + #line 438 "dtc-parser.y" /* yacc.c:1646 */ + { (yyval.integer) = !(yyvsp[0].integer); } +-#line 1953 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1959 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 72: ++ case 74: + #line 443 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.data) = empty_data; + } +-#line 1961 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1967 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 73: ++ case 75: + #line 447 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.data) = data_append_byte((yyvsp[-1].data), (yyvsp[0].byte)); + } +-#line 1969 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1975 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 74: ++ case 76: + #line 451 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.data) = data_add_marker((yyvsp[-1].data), LABEL, (yyvsp[0].labelref)); + } +-#line 1977 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1983 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 75: ++ case 77: + #line 458 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.nodelist) = NULL; + } +-#line 1985 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1991 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 76: ++ case 78: + #line 462 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.nodelist) = chain_node((yyvsp[-1].node), (yyvsp[0].nodelist)); + } +-#line 1993 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1999 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 77: ++ case 79: + #line 466 "dtc-parser.y" /* yacc.c:1646 */ + { + ERROR(&(yylsp[0]), "Properties must precede subnodes"); + YYERROR; + } +-#line 2002 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 2008 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 78: ++ case 80: + #line 474 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = name_node((yyvsp[0].node), (yyvsp[-1].propnodename)); + } +-#line 2010 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 2016 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 79: ++ case 81: + #line 478 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = name_node(build_node_delete(), (yyvsp[-1].propnodename)); + } +-#line 2018 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 2024 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 80: ++ case 82: + #line 482 "dtc-parser.y" /* yacc.c:1646 */ + { + add_label(&(yyvsp[0].node)->labels, (yyvsp[-1].labelref)); + (yyval.node) = (yyvsp[0].node); + } +-#line 2027 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 2033 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + + +-#line 2031 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 2037 "dtc-parser.tab.c" /* yacc.c:1646 */ + default: break; + } + /* User semantic actions sometimes alter yychar, and that requires +diff --git a/scripts/dtc/dtc-parser.tab.h_shipped b/scripts/dtc/dtc-parser.tab.h_shipped +index 30867c6..276d078 100644 +--- a/scripts/dtc/dtc-parser.tab.h_shipped ++++ b/scripts/dtc/dtc-parser.tab.h_shipped +@@ -46,26 +46,27 @@ extern int yydebug; + enum yytokentype + { + DT_V1 = 258, +- DT_MEMRESERVE = 259, +- DT_LSHIFT = 260, +- DT_RSHIFT = 261, +- DT_LE = 262, +- DT_GE = 263, +- DT_EQ = 264, +- DT_NE = 265, +- DT_AND = 266, +- DT_OR = 267, +- DT_BITS = 268, +- DT_DEL_PROP = 269, +- DT_DEL_NODE = 270, +- DT_PROPNODENAME = 271, +- DT_LITERAL = 272, +- DT_CHAR_LITERAL = 273, +- DT_BYTE = 274, +- DT_STRING = 275, +- DT_LABEL = 276, +- DT_REF = 277, +- DT_INCBIN = 278 ++ DT_PLUGIN = 259, ++ DT_MEMRESERVE = 260, ++ DT_LSHIFT = 261, ++ DT_RSHIFT = 262, ++ DT_LE = 263, ++ DT_GE = 264, ++ DT_EQ = 265, ++ DT_NE = 266, ++ DT_AND = 267, ++ DT_OR = 268, ++ DT_BITS = 269, ++ DT_DEL_PROP = 270, ++ DT_DEL_NODE = 271, ++ DT_PROPNODENAME = 272, ++ DT_LITERAL = 273, ++ DT_CHAR_LITERAL = 274, ++ DT_BYTE = 275, ++ DT_STRING = 276, ++ DT_LABEL = 277, ++ DT_REF = 278, ++ DT_INCBIN = 279 + }; + #endif + +@@ -74,7 +75,7 @@ extern int yydebug; + typedef union YYSTYPE YYSTYPE; + union YYSTYPE + { +-#line 38 "dtc-parser.y" /* yacc.c:1909 */ ++#line 39 "dtc-parser.y" /* yacc.c:1909 */ + + char *propnodename; + char *labelref; +@@ -92,8 +93,9 @@ union YYSTYPE + struct node *nodelist; + struct reserve_info *re; + uint64_t integer; ++ bool is_plugin; + +-#line 97 "dtc-parser.tab.h" /* yacc.c:1909 */ ++#line 99 "dtc-parser.tab.h" /* yacc.c:1909 */ + }; + # define YYSTYPE_IS_TRIVIAL 1 + # define YYSTYPE_IS_DECLARED 1 +diff --git a/scripts/dtc/dtc-parser.y b/scripts/dtc/dtc-parser.y +index 000873f..bd67bac 100644 +--- a/scripts/dtc/dtc-parser.y ++++ b/scripts/dtc/dtc-parser.y +@@ -19,6 +19,7 @@ + */ + %{ + #include <stdio.h> ++#include <inttypes.h> + + #include "dtc.h" + #include "srcpos.h" +@@ -52,9 +53,11 @@ extern bool treesource_error; + struct node *nodelist; + struct reserve_info *re; + uint64_t integer; ++ bool is_plugin; + } + + %token DT_V1 ++%token DT_PLUGIN + %token DT_MEMRESERVE + %token DT_LSHIFT DT_RSHIFT DT_LE DT_GE DT_EQ DT_NE DT_AND DT_OR + %token DT_BITS +@@ -71,6 +74,7 @@ extern bool treesource_error; + + %type <data> propdata + %type <data> propdataprefix ++%type <is_plugin> plugindecl + %type <re> memreserve + %type <re> memreserves + %type <array> arrayprefix +@@ -101,10 +105,22 @@ extern bool treesource_error; + %% + + sourcefile: +- DT_V1 ';' memreserves devicetree ++ DT_V1 ';' plugindecl memreserves devicetree + { +- the_boot_info = build_boot_info($3, $4, +- guess_boot_cpuid($4)); ++ $5->is_plugin = $3; ++ the_boot_info = build_boot_info($4, $5, ++ guess_boot_cpuid($5)); ++ } ++ ; + -+&i2c2 { -+ clock-frequency = <100000>; ++plugindecl: ++ /* empty */ ++ { ++ $$ = false; ++ } ++ | DT_PLUGIN ';' ++ { ++ $$ = true; + } + ; + +diff --git a/scripts/dtc/dtc.c b/scripts/dtc/dtc.c +index 5fa23c4..1f8c285 100644 +--- a/scripts/dtc/dtc.c ++++ b/scripts/dtc/dtc.c +@@ -31,6 +31,7 @@ int reservenum; /* Number of memory reservation slots */ + int minsize; /* Minimum blob size */ + int padsize; /* Additional padding to blob */ + int phandle_format = PHANDLE_BOTH; /* Use linux,phandle or phandle properties */ ++int symbol_fixup_support = 0; + + static void fill_fullpaths(struct node *tree, const char *prefix) + { +@@ -53,7 +54,7 @@ static void fill_fullpaths(struct node *tree, const char *prefix) + #define FDT_VERSION(version) _FDT_VERSION(version) + #define _FDT_VERSION(version) #version + static const char usage_synopsis[] = "dtc [options] <input file>"; +-static const char usage_short_opts[] = "qI:O:o:V:d:R:S:p:fb:i:H:sW:E:hv"; ++static const char usage_short_opts[] = "qI:O:o:V:d:R:S:p:fb:i:H:sW:E:@hv"; + static struct option const usage_long_opts[] = { + {"quiet", no_argument, NULL, 'q'}, + {"in-format", a_argument, NULL, 'I'}, +@@ -71,6 +72,7 @@ static struct option const usage_long_opts[] = { + {"phandle", a_argument, NULL, 'H'}, + {"warning", a_argument, NULL, 'W'}, + {"error", a_argument, NULL, 'E'}, ++ {"symbols", no_argument, NULL, '@'}, + {"help", no_argument, NULL, 'h'}, + {"version", no_argument, NULL, 'v'}, + {NULL, no_argument, NULL, 0x0}, +@@ -101,6 +103,7 @@ static const char * const usage_opts_help[] = { + "\t\tboth - Both \"linux,phandle\" and \"phandle\" properties", + "\n\tEnable/disable warnings (prefix with \"no-\")", + "\n\tEnable/disable errors (prefix with \"no-\")", ++ "\n\tEnable symbols/fixup support", + "\n\tPrint this help and exit", + "\n\tPrint version and exit", + NULL, +@@ -233,7 +236,9 @@ int main(int argc, char *argv[]) + case 'E': + parse_checks_option(false, true, optarg); + break; +- ++ case '@': ++ symbol_fixup_support = 1; ++ break; + case 'h': + usage(NULL); + default: +diff --git a/scripts/dtc/dtc.h b/scripts/dtc/dtc.h +index 56212c8..f163b22 100644 +--- a/scripts/dtc/dtc.h ++++ b/scripts/dtc/dtc.h +@@ -54,6 +54,7 @@ extern int reservenum; /* Number of memory reservation slots */ + extern int minsize; /* Minimum blob size */ + extern int padsize; /* Additional padding to blob */ + extern int phandle_format; /* Use linux,phandle or phandle properties */ ++extern int symbol_fixup_support;/* enable symbols & fixup support */ + + #define PHANDLE_LEGACY 0x1 + #define PHANDLE_EPAPR 0x2 +@@ -132,6 +133,26 @@ struct label { + struct label *next; + }; + ++struct fixup_entry { ++ int offset; ++ struct node *node; ++ struct property *prop; ++ struct fixup_entry *next; ++ bool local_fixup_generated; +}; + -+&i2s { -+ #sound-dai-cells = <0>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&i2s_pins>; ++struct fixup { ++ char *ref; ++ struct fixup_entry *entries; ++ struct fixup *next; +}; + -+&random { -+ status = "okay"; ++struct symbol { ++ struct label *label; ++ struct node *node; ++ struct symbol *next; +}; + -+/ { -+ __overrides__ { -+ uart0 = <&uart0>,"status"; -+ uart0_clkrate = <&clk_uart0>,"clock-frequency:0"; -+ i2s = <&i2s>,"status"; -+ spi = <&spi0>,"status"; -+ i2c0 = <&i2c0>,"status"; -+ i2c1 = <&i2c1>,"status"; -+ i2c2_iknowwhatimdoing = <&i2c2>,"status"; -+ i2c0_baudrate = <&i2c0>,"clock-frequency:0"; -+ i2c1_baudrate = <&i2c1>,"clock-frequency:0"; -+ i2c2_baudrate = <&i2c2>,"clock-frequency:0"; -+ core_freq = <&clk_core>,"clock-frequency:0"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi b/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi -new file mode 100644 -index 0000000..3c8bdde ---- /dev/null -+++ b/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi -@@ -0,0 +1,40 @@ -+#include "bcm2708.dtsi" + struct property { + bool deleted; + char *name; +@@ -158,6 +179,13 @@ struct node { + int addr_cells, size_cells; + + struct label *labels; + -+&gpio { -+ sdhost_pins: sdhost_pins { -+ brcm,pins = <48 49 50 51 52 53>; -+ brcm,function = <4>; /* alt0 */ -+ }; -+}; ++ struct symbol *symbols; ++ struct fixup_entry *local_fixups; ++ bool emit_local_fixup_node; + -+&leds { -+ act_led: act { -+ label = "led0"; -+ linux,default-trigger = "mmc0"; -+ gpios = <&gpio 47 0>; -+ }; -+}; ++ bool is_plugin; ++ struct fixup *fixups; + }; + + #define for_each_label_withdel(l0, l) \ +@@ -181,6 +209,18 @@ struct node { + for_each_child_withdel(n, c) \ + if (!(c)->deleted) + ++#define for_each_fixup(n, f) \ ++ for ((f) = (n)->fixups; (f); (f) = (f)->next) + -+&sdhost { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&sdhost_pins>; -+ bus-width = <4>; -+ non-removable; -+ status = "okay"; -+}; ++#define for_each_fixup_entry(f, fe) \ ++ for ((fe) = (f)->entries; (fe); (fe) = (fe)->next) + -+&fb { -+ status = "okay"; -+}; ++#define for_each_symbol(n, s) \ ++ for ((s) = (n)->symbols; (s); (s) = (s)->next) + -+/ { -+ __overrides__ { -+ act_led_gpio = <&act_led>,"gpios:4"; -+ act_led_activelow = <&act_led>,"gpios:8"; -+ act_led_trigger = <&act_led>,"linux,default-trigger"; ++#define for_each_local_fixup_entry(n, fe) \ ++ for ((fe) = (n)->local_fixups; (fe); (fe) = (fe)->next) + -+ audio = <&audio>,"status"; -+ watchdog = <&watchdog>,"status"; -+ random = <&random>,"status"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/bcm2708.dtsi b/arch/arm/boot/dts/bcm2708.dtsi -new file mode 100644 -index 0000000..f5a44cd ---- /dev/null -+++ b/arch/arm/boot/dts/bcm2708.dtsi -@@ -0,0 +1,40 @@ -+#include "bcm2708_common.dtsi" + void add_label(struct label **labels, char *label); + void delete_labels(struct label **labels); + +diff --git a/scripts/dtc/flattree.c b/scripts/dtc/flattree.c +index bd99fa2..2385137 100644 +--- a/scripts/dtc/flattree.c ++++ b/scripts/dtc/flattree.c +@@ -255,6 +255,204 @@ static int stringtable_insert(struct data *d, const char *str) + return i; + } + ++static void emit_local_fixups(struct node *tree, struct emitter *emit, ++ void *etarget, struct data *strbuf, struct version_info *vi, ++ struct node *node) ++{ ++ struct fixup_entry *fe, *fen; ++ struct node *child; ++ int nameoff, count; ++ cell_t *buf; ++ struct data d; + -+/ { -+ compatible = "brcm,bcm2708"; -+ model = "BCM2708"; ++ if (node->emit_local_fixup_node) { + -+ chosen { -+ /* No padding required - the boot loader can do that. */ -+ bootargs = ""; -+ }; ++ /* emit the external fixups (do not emit /) */ ++ if (node != tree) { ++ emit->beginnode(etarget, NULL); ++ emit->string(etarget, node->name, 0); ++ emit->align(etarget, sizeof(cell_t)); ++ } + -+ soc { -+ ranges = <0x7e000000 0x20000000 0x01000000>; ++ for_each_local_fixup_entry(tree, fe) { ++ if (fe->node != node || fe->local_fixup_generated) ++ continue; + -+ timer@7e003000 { -+ compatible = "brcm,bcm2835-system-timer"; -+ reg = <0x7e003000 0x1000>; -+ interrupts = <1 0>, <1 1>, <1 2>, <1 3>; -+ clock-frequency = <1000000>; -+ }; ++ /* count the number of fixup entries */ ++ count = 0; ++ for_each_local_fixup_entry(tree, fen) { ++ if (fen->prop != fe->prop) ++ continue; ++ fen->local_fixup_generated = true; ++ count++; ++ } + -+ arm-pmu { -+ compatible = "arm,arm1176-pmu"; -+ }; ++ /* allocate buffer */ ++ buf = xmalloc(count * sizeof(cell_t)); + -+ gpiomem { -+ compatible = "brcm,bcm2835-gpiomem"; -+ reg = <0x7e200000 0x1000>; -+ status = "okay"; -+ }; -+ }; -+}; ++ /* collect all the offsets in buffer */ ++ count = 0; ++ for_each_local_fixup_entry(tree, fen) { ++ if (fen->prop != fe->prop) ++ continue; ++ fen->local_fixup_generated = true; ++ buf[count++] = cpu_to_fdt32(fen->offset); ++ } ++ d = empty_data; ++ d.len = count * sizeof(cell_t); ++ d.val = (char *)buf; + -+&intc { -+ compatible = "brcm,bcm2835-armctrl-ic"; -+}; ++ nameoff = stringtable_insert(strbuf, fe->prop->name); ++ emit->property(etarget, fe->prop->labels); ++ emit->cell(etarget, count * sizeof(cell_t)); ++ emit->cell(etarget, nameoff); + -+&watchdog { -+ status = "okay"; -+}; -diff --git a/arch/arm/boot/dts/bcm2708_common.dtsi b/arch/arm/boot/dts/bcm2708_common.dtsi -new file mode 100644 -index 0000000..75fb4ce ---- /dev/null -+++ b/arch/arm/boot/dts/bcm2708_common.dtsi -@@ -0,0 +1,347 @@ -+#include "skeleton.dtsi" ++ if ((vi->flags & FTF_VARALIGN) && ++ (count * sizeof(cell_t)) >= 8) ++ emit->align(etarget, 8); + -+/ { -+ interrupt-parent = <&intc>; ++ emit->data(etarget, d); ++ emit->align(etarget, sizeof(cell_t)); + -+ aliases { -+ audio = &audio; -+ sound = &sound; -+ soc = &soc; -+ dma = &dma; -+ intc = &intc; -+ watchdog = &watchdog; -+ random = &random; -+ mailbox = &mailbox; -+ gpio = &gpio; -+ uart0 = &uart0; -+ sdhost = &sdhost; -+ i2s = &i2s; -+ spi0 = &spi0; -+ i2c0 = &i2c0; -+ uart1 = &uart1; -+ mmc = &mmc; -+ i2c1 = &i2c1; -+ i2c2 = &i2c2; -+ usb = &usb; -+ leds = &leds; -+ fb = &fb; -+ vchiq = &vchiq; -+ thermal = &thermal; -+ clocks = &clocks; -+ }; ++ free(buf); ++ } ++ } + -+ /* Onboard audio */ -+ audio: audio { -+ compatible = "brcm,bcm2835-audio"; -+ brcm,pwm-channels = <8>; -+ status = "disabled"; -+ }; ++ for_each_child(node, child) ++ emit_local_fixups(tree, emit, etarget, strbuf, vi, child); + -+ /* External sound card */ -+ sound: sound { -+ }; ++ if (node->emit_local_fixup_node && node != tree) ++ emit->endnode(etarget, tree->labels); ++} + -+ soc: soc { -+ compatible = "simple-bus"; -+ #address-cells = <1>; -+ #size-cells = <1>; ++static void emit_symbols_node(struct node *tree, struct emitter *emit, ++ void *etarget, struct data *strbuf, ++ struct version_info *vi) ++{ ++ struct symbol *sym; ++ int nameoff, vallen; + -+ dma: dma@7e007000 { -+ compatible = "brcm,bcm2835-dma"; -+ reg = <0x7e007000 0xf00>; -+ interrupts = <1 16>, -+ <1 17>, -+ <1 18>, -+ <1 19>, -+ <1 20>, -+ <1 21>, -+ <1 22>, -+ <1 23>, -+ <1 24>, -+ <1 25>, -+ <1 26>, -+ <1 27>; ++ /* do nothing if no symbols */ ++ if (!tree->symbols) ++ return; + -+ #dma-cells = <1>; -+ brcm,dma-channel-mask = <0x0f35>; -+ }; ++ emit->beginnode(etarget, NULL); ++ emit->string(etarget, "__symbols__", 0); ++ emit->align(etarget, sizeof(cell_t)); + -+ intc: interrupt-controller@7e00b200 { -+ compatible = "brcm,bcm2708-armctrl-ic"; -+ reg = <0x7e00b200 0x200>; -+ interrupt-controller; -+ #interrupt-cells = <2>; -+ }; ++ for_each_symbol(tree, sym) { + -+ mailbox: mailbox@7e00b800 { -+ compatible = "brcm,bcm2835-mbox"; -+ reg = <0x7e00b880 0x40>; -+ interrupts = <0 1>; -+ #mbox-cells = <0>; -+ }; ++ vallen = strlen(sym->node->fullpath); + -+ watchdog: watchdog@7e100000 { -+ compatible = "brcm,bcm2835-pm-wdt"; -+ reg = <0x7e100000 0x28>; -+ status = "disabled"; -+ }; ++ nameoff = stringtable_insert(strbuf, sym->label->label); + -+ cprman: cprman@7e101000 { -+ compatible = "brcm,bcm2835-cprman"; -+ #clock-cells = <1>; -+ reg = <0x7e101000 0x2000>; ++ emit->property(etarget, NULL); ++ emit->cell(etarget, vallen + 1); ++ emit->cell(etarget, nameoff); + -+ /* CPRMAN derives everything from the platform's -+ * oscillator. -+ */ -+ clocks = <&clk_osc>; -+ status = "disabled"; -+ }; ++ if ((vi->flags & FTF_VARALIGN) && vallen >= 8) ++ emit->align(etarget, 8); + -+ random: rng@7e104000 { -+ compatible = "brcm,bcm2835-rng"; -+ reg = <0x7e104000 0x10>; -+ status = "disabled"; -+ }; ++ emit->string(etarget, sym->node->fullpath, ++ strlen(sym->node->fullpath)); ++ emit->align(etarget, sizeof(cell_t)); ++ } + -+ gpio: gpio@7e200000 { -+ compatible = "brcm,bcm2835-gpio"; -+ reg = <0x7e200000 0xb4>; -+ interrupts = <2 17>, <2 18>; ++ emit->endnode(etarget, NULL); ++} + -+ gpio-controller; -+ #gpio-cells = <2>; ++static void emit_local_fixups_node(struct node *tree, struct emitter *emit, ++ void *etarget, struct data *strbuf, ++ struct version_info *vi) ++{ ++ struct fixup_entry *fe; ++ struct node *node; + -+ interrupt-controller; -+ #interrupt-cells = <2>; -+ }; ++ /* do nothing if no local fixups */ ++ if (!tree->local_fixups) ++ return; + -+ uart0: uart@7e201000 { -+ compatible = "arm,pl011", "arm,primecell"; -+ reg = <0x7e201000 0x1000>; -+ interrupts = <2 25>; -+ clocks = <&clk_uart0 &clk_apb_p>; -+ clock-names = "uartclk","apb_pclk"; -+ arm,primecell-periphid = <0x00241011>; // For an explanation, see -+ // https://github.com/raspberrypi/linux/commit/13731d862cf5219216533a3b0de052cee4cc5038 -+ status = "disabled"; -+ }; ++ /* mark all nodes that need a local fixup generated (and parents) */ ++ for_each_local_fixup_entry(tree, fe) { ++ node = fe->node; ++ while (node != NULL && !node->emit_local_fixup_node) { ++ node->emit_local_fixup_node = true; ++ node = node->parent; ++ } ++ } + -+ sdhost: sdhost@7e202000 { -+ compatible = "brcm,bcm2835-sdhost"; -+ reg = <0x7e202000 0x100>; -+ interrupts = <2 24>; -+ clocks = <&clk_core>; -+ dmas = <&dma 13>, -+ <&dma 13>; -+ dma-names = "tx", "rx"; -+ brcm,pio-limit = <1>; -+ status = "disabled"; -+ }; ++ /* emit the local fixups node now */ ++ emit->beginnode(etarget, NULL); ++ emit->string(etarget, "__local_fixups__", 0); ++ emit->align(etarget, sizeof(cell_t)); + -+ i2s: i2s@7e203000 { -+ compatible = "brcm,bcm2835-i2s"; -+ reg = <0x7e203000 0x24>, -+ <0x7e101098 0x08>; ++ emit_local_fixups(tree, emit, etarget, strbuf, vi, tree); + -+ dmas = <&dma 2>, <&dma 3>; -+ dma-names = "tx", "rx"; -+ status = "disabled"; -+ }; ++ emit->endnode(etarget, tree->labels); ++} + -+ spi0: spi@7e204000 { -+ compatible = "brcm,bcm2835-spi"; -+ reg = <0x7e204000 0x1000>; -+ interrupts = <2 22>; -+ clocks = <&clk_core>; -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "disabled"; -+ /* the dma channels */ -+ dmas = <&dma 6>, <&dma 7>; -+ dma-names = "tx", "rx"; -+ /* the chipselects used - <0> means native GPIO -+ * add more gpios if necessary as <&gpio 6 1> -+ * (but do not forget to make them output!) -+ */ -+ cs-gpios = <0>, <0>; -+ }; ++static void emit_fixups_node(struct node *tree, struct emitter *emit, ++ void *etarget, struct data *strbuf, ++ struct version_info *vi) ++{ ++ struct fixup *f; ++ struct fixup_entry *fe; ++ char *name, *s; ++ const char *fullpath; ++ int namesz, nameoff, vallen; + -+ i2c0: i2c@7e205000 { -+ compatible = "brcm,bcm2708-i2c"; -+ reg = <0x7e205000 0x1000>; -+ interrupts = <2 21>; -+ clocks = <&clk_core>; -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "disabled"; -+ }; ++ /* do nothing if no fixups */ ++ if (!tree->fixups) ++ return; + -+ pwm: pwm@7e20c000 { -+ compatible = "brcm,bcm2835-pwm"; -+ reg = <0x7e20c000 0x28>; -+ clocks = <&clk_pwm>; -+ #pwm-cells = <2>; -+ status = "disabled"; -+ }; ++ /* emit the external fixups */ ++ emit->beginnode(etarget, NULL); ++ emit->string(etarget, "__fixups__", 0); ++ emit->align(etarget, sizeof(cell_t)); + -+ uart1: uart@7e215040 { -+ compatible = "brcm,bcm2835-aux-uart", "ns16550"; -+ reg = <0x7e215040 0x40>; -+ interrupts = <1 29>; -+ clocks = <&clk_uart1>; -+ reg-shift = <2>; -+ no-loopback-test; -+ status = "disabled"; -+ }; ++ for_each_fixup(tree, f) { + -+ mmc: mmc@7e300000 { -+ compatible = "brcm,bcm2835-mmc"; -+ reg = <0x7e300000 0x100>; -+ interrupts = <2 30>; -+ clocks = <&clk_mmc>; -+ dmas = <&dma 11>, -+ <&dma 11>; -+ dma-names = "tx", "rx"; -+ status = "disabled"; -+ }; ++ namesz = 0; ++ for_each_fixup_entry(f, fe) { ++ fullpath = fe->node->fullpath; ++ if (fullpath[0] == '\0') ++ fullpath = "/"; ++ namesz += strlen(fullpath) + 1; ++ namesz += strlen(fe->prop->name) + 1; ++ namesz += 32; /* space for :<number> + '\0' */ ++ } + -+ i2c1: i2c@7e804000 { -+ compatible = "brcm,bcm2708-i2c"; -+ reg = <0x7e804000 0x1000>; -+ interrupts = <2 21>; -+ clocks = <&clk_core>; -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "disabled"; -+ }; ++ name = xmalloc(namesz); + -+ i2c2: i2c@7e805000 { -+ // Beware - this is shared with the HDMI module. -+ // Careless use may break (really) your display. -+ // Caveat emptor. -+ compatible = "brcm,bcm2708-i2c"; -+ reg = <0x7e805000 0x1000>; -+ interrupts = <2 21>; -+ clocks = <&clk_core>; -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "disabled"; -+ }; ++ s = name; ++ for_each_fixup_entry(f, fe) { ++ fullpath = fe->node->fullpath; ++ if (fullpath[0] == '\0') ++ fullpath = "/"; ++ snprintf(s, name + namesz - s, "%s:%s:%d", fullpath, ++ fe->prop->name, fe->offset); ++ s += strlen(s) + 1; ++ } + -+ smi: smi@7e600000 { -+ compatible = "brcm,bcm2835-smi"; -+ reg = <0x7e600000 0x44>, <0x7e1010b0 0x8>; -+ interrupts = <2 16>; -+ brcm,smi-clock-source = <6>; -+ brcm,smi-clock-divisor = <4>; -+ dmas = <&dma 4>; -+ dma-names = "rx-tx"; -+ status = "disabled"; -+ }; ++ nameoff = stringtable_insert(strbuf, f->ref); ++ vallen = s - name - 1; + -+ usb: usb@7e980000 { -+ compatible = "brcm,bcm2708-usb"; -+ reg = <0x7e980000 0x10000>, -+ <0x7e006000 0x1000>; -+ interrupts = <2 0>, -+ <1 9>; -+ }; ++ emit->property(etarget, NULL); ++ emit->cell(etarget, vallen + 1); ++ emit->cell(etarget, nameoff); + -+ firmware: firmware { -+ compatible = "raspberrypi,bcm2835-firmware"; -+ mboxes = <&mailbox>; -+ }; ++ if ((vi->flags & FTF_VARALIGN) && vallen >= 8) ++ emit->align(etarget, 8); + -+ leds: leds { -+ compatible = "gpio-leds"; -+ }; ++ emit->string(etarget, name, vallen); ++ emit->align(etarget, sizeof(cell_t)); + -+ fb: fb { -+ compatible = "brcm,bcm2708-fb"; -+ firmware = <&firmware>; -+ status = "disabled"; -+ }; ++ free(name); ++ } + -+ vchiq: vchiq { -+ compatible = "brcm,bcm2835-vchiq"; -+ reg = <0x7e00b840 0xf>; -+ interrupts = <0 2>; -+ cache-line-size = <32>; -+ firmware = <&firmware>; -+ }; ++ emit->endnode(etarget, tree->labels); ++} + -+ thermal: thermal { -+ compatible = "brcm,bcm2835-thermal"; -+ firmware = <&firmware>; -+ }; -+ }; + static void flatten_tree(struct node *tree, struct emitter *emit, + void *etarget, struct data *strbuf, + struct version_info *vi) +@@ -310,6 +508,10 @@ static void flatten_tree(struct node *tree, struct emitter *emit, + flatten_tree(child, emit, etarget, strbuf, vi); + } + ++ emit_symbols_node(tree, emit, etarget, strbuf, vi); ++ emit_local_fixups_node(tree, emit, etarget, strbuf, vi); ++ emit_fixups_node(tree, emit, etarget, strbuf, vi); + -+ clocks: clocks { -+ compatible = "simple-bus"; -+ #address-cells = <1>; -+ #size-cells = <0>; + emit->endnode(etarget, tree->labels); + } + +diff --git a/scripts/dtc/version_gen.h b/scripts/dtc/version_gen.h +index 11d93e6..2595dfd 100644 +--- a/scripts/dtc/version_gen.h ++++ b/scripts/dtc/version_gen.h +@@ -1 +1 @@ +-#define DTC_VERSION "DTC 1.4.1-gb06e55c8" ++#define DTC_VERSION "DTC 1.4.1-g25efc119" + +From 43f338fd4cb0e7a0813f527883930806c712369e Mon Sep 17 00:00:00 2001 +From: Phil Elwell <phil@raspberrypi.org> +Date: Fri, 5 Dec 2014 17:26:26 +0000 +Subject: [PATCH 056/112] fdt: Add support for the CONFIG_CMDLINE_EXTEND option + +--- + drivers/of/fdt.c | 29 ++++++++++++++++++++++++----- + 1 file changed, 24 insertions(+), 5 deletions(-) + +diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c +index 3349d2a..1e26605 100644 +--- a/drivers/of/fdt.c ++++ b/drivers/of/fdt.c +@@ -960,19 +960,38 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname, + + /* Retrieve command line */ + p = of_get_flat_dt_prop(node, "bootargs", &l); +- if (p != NULL && l > 0) +- strlcpy(data, p, min((int)l, COMMAND_LINE_SIZE)); + + /* + * CONFIG_CMDLINE is meant to be a default in case nothing else + * managed to set the command line, unless CONFIG_CMDLINE_FORCE + * is set in which case we override whatever was found earlier. ++ * ++ * However, it can be useful to be able to treat the default as ++ * a starting point to be extended using CONFIG_CMDLINE_EXTEND. + */ ++ ((char *)data)[0] = '\0'; + -+ clk_core: clock@0 { -+ compatible = "fixed-clock"; -+ reg = <0>; -+ #clock-cells = <0>; -+ clock-output-names = "core"; -+ clock-frequency = <250000000>; -+ }; + #ifdef CONFIG_CMDLINE +-#ifndef CONFIG_CMDLINE_FORCE +- if (!((char *)data)[0]) ++ strlcpy(data, CONFIG_CMDLINE, COMMAND_LINE_SIZE); + -+ clk_mmc: clock@1 { -+ compatible = "fixed-clock"; -+ reg = <1>; -+ #clock-cells = <0>; -+ clock-output-names = "mmc"; -+ clock-frequency = <250000000>; -+ }; -+ -+ clk_uart0: clock@2 { -+ compatible = "fixed-clock"; -+ reg = <2>; -+ #clock-cells = <0>; -+ clock-output-names = "uart0_pclk"; -+ clock-frequency = <3000000>; -+ }; ++ if (p != NULL && l > 0) { ++#if defined(CONFIG_CMDLINE_EXTEND) ++ int len = strlen(data); ++ if (len > 0) { ++ strlcat(data, " ", COMMAND_LINE_SIZE); ++ len++; ++ } ++ strlcpy((char *)data + len, p, min((int)l, COMMAND_LINE_SIZE - len)); ++#elif defined(CONFIG_CMDLINE_FORCE) ++ pr_warning("Ignoring bootargs property (using the default kernel command line)\n"); ++#else ++ /* Neither extend nor force - just override */ ++ strlcpy(data, p, min((int)l, COMMAND_LINE_SIZE)); + #endif +- strlcpy(data, CONFIG_CMDLINE, COMMAND_LINE_SIZE); ++ } ++#else /* CONFIG_CMDLINE */ ++ if (p != NULL && l > 0) ++ strlcpy(data, p, min((int)l, COMMAND_LINE_SIZE)); + #endif /* CONFIG_CMDLINE */ + + pr_debug("Command line is: %s\n", (char*)data); + +From d0653a1baeb2b6a9507051fb026b01a1621cb321 Mon Sep 17 00:00:00 2001 +From: notro <notro@tronnes.org> +Date: Wed, 9 Jul 2014 14:46:08 +0200 +Subject: [PATCH 057/112] BCM2708: Add core Device Tree support + +Add the bare minimum needed to boot BCM2708 from a Device Tree. + +Signed-off-by: Noralf Tronnes <notro@tronnes.org> + +BCM2708: DT: change 'axi' nodename to 'soc' + +Change DT node named 'axi' to 'soc' so it matches ARCH_BCM2835. +The VC4 bootloader fills in certain properties in the 'axi' subtree, +but since this is part of an upstreaming effort, the name is changed. + +Signed-off-by: Noralf Tronnes notro@tronnes.org + +BCM2708_DT: Correct length of the peripheral space + +Use dts-dirs feature for overlays. + +The kernel makefiles have a dts-dirs target that is for vendor subdirectories. + +Using this fixes the install_dtbs target, which previously did not install the overlays. + +BCM270X_DT: configure I2S DMA channels + +Signed-off-by: Matthias Reichl <hias@horus.com> + +BCM270X_DT: switch to bcm2835-i2s + +I2S soundcard drivers with proper devicetree support (i.e. not linking +to the cpu_dai/platform via name but to cpu/platform via of_node) +will work out of the box without any modifications. + +When the kernel is compiled without devicetree support the platform +code will instantiate the bcm2708-i2s driver and I2S soundcard drivers +will link to it via name, as before. + +Signed-off-by: Matthias Reichl <hias@horus.com> + +SDIO-overlay: add poll_once-boolean parameter + +Add paramter to toggle sdio-device-polling +done every second or once at boot-time. + +Signed-off-by: Patrick Boettcher <patrick.boettcher@posteo.de> + +BCM270X_DT: Make mmc overlay compatible with current firmware + +The original DT overlay logic followed a merge-then-patch procedure, +i.e. parameters are applied to the loaded overlay before the overlay +is merged into the base DTB. This sequence has been changed to +patch-then-merge, in order to support parameterised node names, and +to protect against bad overlays. As a result, overrides (parameters) +must only target labels in the overlay, but the overlay can obviously target nodes in the base DTB. + +mmc-overlay.dts (that switches back to the original mmc sdcard +driver) is the only overlay violating that rule, and this patch +fixes it. + +bcm270x_dt: Use the sdhost MMC controller by default + +The "mmc" overlay reverts to using the other controller. + +squash: Add cprman to dt + +BCM270X_DT: Use clk_core for I2C interfaces +--- + arch/arm/boot/dts/Makefile | 31 + + arch/arm/boot/dts/bcm2708-rpi-b-plus.dts | 154 +++ + arch/arm/boot/dts/bcm2708-rpi-b.dts | 144 +++ + arch/arm/boot/dts/bcm2708-rpi-cm.dts | 102 ++ + arch/arm/boot/dts/bcm2708-rpi-cm.dtsi | 52 + + arch/arm/boot/dts/bcm2708.dtsi | 40 + + arch/arm/boot/dts/bcm2708_common.dtsi | 438 ++++++++ + arch/arm/boot/dts/bcm2709-rpi-2-b.dts | 154 +++ + arch/arm/boot/dts/bcm2709.dtsi | 102 ++ + arch/arm/boot/dts/bcm2710-rpi-3-b.dts | 201 ++++ + arch/arm/boot/dts/bcm2710.dtsi | 102 ++ + arch/arm/boot/dts/bcm2835-rpi-cm.dts | 93 ++ + arch/arm/boot/dts/bcm2835-rpi-cm.dtsi | 30 + + arch/arm/boot/dts/overlays/Makefile | 99 ++ + arch/arm/boot/dts/overlays/README | 1161 ++++++++++++++++++++ + .../arm/boot/dts/overlays/adau1977-adc-overlay.dts | 53 + + arch/arm/boot/dts/overlays/ads7846-overlay.dts | 89 ++ + .../dts/overlays/akkordion-iqdacplus-overlay.dts | 46 + + arch/arm/boot/dts/overlays/at86rf233-overlay.dts | 57 + + .../audioinjector-wm8731-audio-overlay.dts | 39 + + .../dts/overlays/bmp085_i2c-sensor-overlay.dts | 23 + + arch/arm/boot/dts/overlays/dht11-overlay.dts | 39 + + arch/arm/boot/dts/overlays/dpi24-overlay.dts | 31 + + arch/arm/boot/dts/overlays/dwc-otg-overlay.dts | 20 + + arch/arm/boot/dts/overlays/dwc2-overlay.dts | 29 + + arch/arm/boot/dts/overlays/enc28j60-overlay.dts | 53 + + arch/arm/boot/dts/overlays/gpio-ir-overlay.dts | 45 + + .../boot/dts/overlays/gpio-poweroff-overlay.dts | 34 + + .../boot/dts/overlays/hifiberry-amp-overlay.dts | 39 + + .../boot/dts/overlays/hifiberry-dac-overlay.dts | 34 + + .../dts/overlays/hifiberry-dacplus-overlay.dts | 56 + + .../boot/dts/overlays/hifiberry-digi-overlay.dts | 39 + + arch/arm/boot/dts/overlays/hy28a-overlay.dts | 93 ++ + arch/arm/boot/dts/overlays/hy28b-overlay.dts | 148 +++ + arch/arm/boot/dts/overlays/i2c-gpio-overlay.dts | 28 + + arch/arm/boot/dts/overlays/i2c-mux-overlay.dts | 139 +++ + .../boot/dts/overlays/i2c-pwm-pca9685a-overlay.dts | 26 + + arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts | 69 ++ + .../arm/boot/dts/overlays/i2c0-bcm2708-overlay.dts | 61 + + .../arm/boot/dts/overlays/i2c1-bcm2708-overlay.dts | 37 + + .../boot/dts/overlays/i2s-gpio28-31-overlay.dts | 18 + + arch/arm/boot/dts/overlays/i2s-mmap-overlay.dts | 13 + + arch/arm/boot/dts/overlays/iqaudio-dac-overlay.dts | 43 + + .../boot/dts/overlays/iqaudio-dacplus-overlay.dts | 43 + + .../arm/boot/dts/overlays/justboom-dac-overlay.dts | 43 + + .../boot/dts/overlays/justboom-digi-overlay.dts | 39 + + arch/arm/boot/dts/overlays/lirc-rpi-overlay.dts | 57 + + arch/arm/boot/dts/overlays/mcp23017-overlay.dts | 54 + + .../arm/boot/dts/overlays/mcp2515-can0-overlay.dts | 73 ++ + .../arm/boot/dts/overlays/mcp2515-can1-overlay.dts | 73 ++ + arch/arm/boot/dts/overlays/mmc-overlay.dts | 38 + + arch/arm/boot/dts/overlays/mz61581-overlay.dts | 117 ++ + arch/arm/boot/dts/overlays/pi3-act-led-overlay.dts | 27 + + .../boot/dts/overlays/pi3-disable-bt-overlay.dts | 46 + + .../boot/dts/overlays/pi3-miniuart-bt-overlay.dts | 64 ++ + arch/arm/boot/dts/overlays/piscreen-overlay.dts | 102 ++ + arch/arm/boot/dts/overlays/piscreen2r-overlay.dts | 106 ++ + arch/arm/boot/dts/overlays/pitft22-overlay.dts | 69 ++ + .../dts/overlays/pitft28-capacitive-overlay.dts | 91 ++ + .../dts/overlays/pitft28-resistive-overlay.dts | 121 ++ + arch/arm/boot/dts/overlays/pps-gpio-overlay.dts | 34 + + arch/arm/boot/dts/overlays/pwm-2chan-overlay.dts | 53 + + arch/arm/boot/dts/overlays/pwm-overlay.dts | 49 + + arch/arm/boot/dts/overlays/qca7000-overlay.dts | 52 + + arch/arm/boot/dts/overlays/raspidac3-overlay.dts | 45 + + .../boot/dts/overlays/rpi-backlight-overlay.dts | 21 + + arch/arm/boot/dts/overlays/rpi-dac-overlay.dts | 34 + + arch/arm/boot/dts/overlays/rpi-display-overlay.dts | 89 ++ + arch/arm/boot/dts/overlays/rpi-ft5406-overlay.dts | 17 + + arch/arm/boot/dts/overlays/rpi-proto-overlay.dts | 39 + + arch/arm/boot/dts/overlays/rpi-sense-overlay.dts | 47 + + .../overlays/rra-digidac1-wm8741-audio-overlay.dts | 81 ++ + arch/arm/boot/dts/overlays/sdhost-overlay.dts | 32 + + arch/arm/boot/dts/overlays/sdio-1bit-overlay.dts | 36 + + arch/arm/boot/dts/overlays/sdio-overlay.dts | 36 + + arch/arm/boot/dts/overlays/sdtweak-overlay.dts | 23 + + arch/arm/boot/dts/overlays/smi-dev-overlay.dts | 18 + + arch/arm/boot/dts/overlays/smi-nand-overlay.dts | 69 ++ + arch/arm/boot/dts/overlays/smi-overlay.dts | 37 + + .../boot/dts/overlays/spi-gpio35-39-overlay.dts | 31 + + arch/arm/boot/dts/overlays/spi1-1cs-overlay.dts | 57 + + arch/arm/boot/dts/overlays/spi1-2cs-overlay.dts | 69 ++ + arch/arm/boot/dts/overlays/spi1-3cs-overlay.dts | 81 ++ + arch/arm/boot/dts/overlays/spi2-1cs-overlay.dts | 57 + + arch/arm/boot/dts/overlays/spi2-2cs-overlay.dts | 69 ++ + arch/arm/boot/dts/overlays/spi2-3cs-overlay.dts | 81 ++ + arch/arm/boot/dts/overlays/tinylcd35-overlay.dts | 224 ++++ + arch/arm/boot/dts/overlays/uart1-overlay.dts | 38 + + arch/arm/boot/dts/overlays/vc4-kms-v3d-overlay.dts | 129 +++ + arch/arm/boot/dts/overlays/vga666-overlay.dts | 30 + + arch/arm/boot/dts/overlays/w1-gpio-overlay.dts | 39 + + .../boot/dts/overlays/w1-gpio-pullup-overlay.dts | 41 + + arch/arm/boot/dts/overlays/wittypi-overlay.dts | 44 + + 93 files changed, 7269 insertions(+) + create mode 100644 arch/arm/boot/dts/bcm2708-rpi-b-plus.dts + create mode 100644 arch/arm/boot/dts/bcm2708-rpi-b.dts + create mode 100755 arch/arm/boot/dts/bcm2708-rpi-cm.dts + create mode 100644 arch/arm/boot/dts/bcm2708-rpi-cm.dtsi + create mode 100644 arch/arm/boot/dts/bcm2708.dtsi + create mode 100644 arch/arm/boot/dts/bcm2708_common.dtsi + create mode 100644 arch/arm/boot/dts/bcm2709-rpi-2-b.dts + create mode 100644 arch/arm/boot/dts/bcm2709.dtsi + create mode 100644 arch/arm/boot/dts/bcm2710-rpi-3-b.dts + create mode 100644 arch/arm/boot/dts/bcm2710.dtsi + create mode 100644 arch/arm/boot/dts/bcm2835-rpi-cm.dts + create mode 100644 arch/arm/boot/dts/bcm2835-rpi-cm.dtsi + create mode 100644 arch/arm/boot/dts/overlays/Makefile + create mode 100644 arch/arm/boot/dts/overlays/README + create mode 100644 arch/arm/boot/dts/overlays/adau1977-adc-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/ads7846-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/akkordion-iqdacplus-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/at86rf233-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/audioinjector-wm8731-audio-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/bmp085_i2c-sensor-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/dht11-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/dpi24-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/dwc-otg-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/dwc2-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/enc28j60-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/gpio-ir-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/gpio-poweroff-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/hifiberry-amp-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/hifiberry-dac-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/hifiberry-digi-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/hy28a-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/hy28b-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/i2c-gpio-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/i2c-mux-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/i2c-pwm-pca9685a-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/i2c0-bcm2708-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/i2c1-bcm2708-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/i2s-gpio28-31-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/i2s-mmap-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/iqaudio-dac-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/iqaudio-dacplus-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/justboom-dac-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/justboom-digi-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/lirc-rpi-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/mcp23017-overlay.dts + create mode 100755 arch/arm/boot/dts/overlays/mcp2515-can0-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/mcp2515-can1-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/mmc-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/mz61581-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/pi3-act-led-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/pi3-disable-bt-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/pi3-miniuart-bt-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/piscreen-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/piscreen2r-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/pitft22-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/pitft28-capacitive-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/pitft28-resistive-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/pps-gpio-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/pwm-2chan-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/pwm-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/qca7000-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/raspidac3-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/rpi-backlight-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/rpi-dac-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/rpi-display-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/rpi-ft5406-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/rpi-proto-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/rpi-sense-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/rra-digidac1-wm8741-audio-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/sdhost-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/sdio-1bit-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/sdio-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/sdtweak-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/smi-dev-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/smi-nand-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/smi-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/spi-gpio35-39-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/spi1-1cs-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/spi1-2cs-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/spi1-3cs-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/spi2-1cs-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/spi2-2cs-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/spi2-3cs-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/tinylcd35-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/uart1-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/vc4-kms-v3d-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/vga666-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/w1-gpio-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/w1-gpio-pullup-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/wittypi-overlay.dts + +diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile +index 95c1923..1af92d7 100644 +--- a/arch/arm/boot/dts/Makefile ++++ b/arch/arm/boot/dts/Makefile +@@ -1,5 +1,26 @@ + ifeq ($(CONFIG_OF),y) + ++dtb-$(CONFIG_ARCH_BCM2708) += bcm2708-rpi-b.dtb ++dtb-$(CONFIG_ARCH_BCM2708) += bcm2708-rpi-b-plus.dtb ++dtb-$(CONFIG_ARCH_BCM2708) += bcm2708-rpi-cm.dtb ++dtb-$(CONFIG_ARCH_BCM2835) += bcm2835-rpi-cm.dtb ++dtb-$(CONFIG_ARCH_BCM2709) += bcm2709-rpi-2-b.dtb ++dtb-$(CONFIG_ARCH_BCM2709) += bcm2710-rpi-3-b.dtb + -+ clk_apb_p: clock@3 { -+ compatible = "fixed-clock"; -+ reg = <3>; -+ #clock-cells = <0>; -+ clock-output-names = "apb_pclk"; -+ clock-frequency = <126000000>; -+ }; ++# Raspberry Pi ++ifeq ($(CONFIG_ARCH_BCM2708),y) ++ RPI_DT_OVERLAYS=y ++endif ++ifeq ($(CONFIG_ARCH_BCM2709),y) ++ RPI_DT_OVERLAYS=y ++endif ++ifeq ($(CONFIG_ARCH_BCM2835),y) ++ RPI_DT_OVERLAYS=y ++endif ++ifeq ($(RPI_DT_OVERLAYS),y) ++ dts-dirs += overlays ++endif + -+ clk_pwm: clock@4 { -+ compatible = "fixed-clock"; -+ reg = <4>; -+ #clock-cells = <0>; -+ clock-output-names = "pwm"; -+ clock-frequency = <100000000>; -+ }; + dtb-$(CONFIG_ARCH_ALPINE) += \ + alpine-db.dtb + dtb-$(CONFIG_MACH_ARTPEC6) += \ +@@ -839,10 +860,20 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \ + mt8127-moose.dtb \ + mt8135-evbp1.dtb + dtb-$(CONFIG_ARCH_ZX) += zx296702-ad1.dtb + -+ clk_uart1: clock@5 { -+ compatible = "fixed-factor-clock"; -+ reg = <5>; -+ clocks = <&clk_core>; -+ #clock-cells = <0>; -+ clock-div = <1>; -+ clock-mult = <2>; -+ }; ++targets += dtbs dtbs_install ++targets += $(dtb-y) + -+ /* The oscillator is the root of the clock tree. */ -+ clk_osc: clock@6 { -+ compatible = "fixed-clock"; -+ reg = <6>; -+ #clock-cells = <0>; -+ clock-output-names = "osc"; -+ clock-frequency = <19200000>; -+ }; -+ }; + endif + + dtstree := $(srctree)/$(src) + dtb-$(CONFIG_OF_ALL_DTBS) := $(patsubst $(dtstree)/%.dts,%.dtb, $(wildcard $(dtstree)/*.dts)) + + always := $(dtb-y) ++subdir-y := $(dts-dirs) + clean-files := *.dtb + -+ __overrides__ { -+ cache_line_size = <&vchiq>, "cache-line-size:0"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/bcm2709-rpi-2-b.dts b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts ++# Enable fixups to support overlays on BCM2708 platforms ++ifeq ($(RPI_DT_OVERLAYS),y) ++ DTC_FLAGS ?= -@ -H epapr ++endif +diff --git a/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts b/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts new file mode 100644 -index 0000000..5206ba2 +index 0000000..0ac7725 --- /dev/null -+++ b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts -@@ -0,0 +1,145 @@ ++++ b/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts +@@ -0,0 +1,154 @@ +/dts-v1/; + -+#include "bcm2709.dtsi" ++#include "bcm2708.dtsi" + +/ { -+ compatible = "brcm,bcm2709"; -+ model = "Raspberry Pi 2 Model B"; ++ compatible = "brcm,bcm2708"; ++ model = "Raspberry Pi Model B+"; +}; + +&gpio { @@ -110125,7 +113316,7 @@ index 0000000..5206ba2 + pinctrl-0 = <&spi0_pins &spi0_cs_pins>; + cs-gpios = <&gpio 8 1>, <&gpio 7 1>; + -+ spidev@0{ ++ spidev0: spidev@0{ + compatible = "spidev"; + reg = <0>; /* CE0 */ + #address-cells = <1>; @@ -110133,7 +113324,7 @@ index 0000000..5206ba2 + spi-max-frequency = <500000>; + }; + -+ spidev@1{ ++ spidev1: spidev@1{ + compatible = "spidev"; + reg = <1>; /* CE1 */ + #address-cells = <1>; @@ -110182,10 +113373,15 @@ index 0000000..5206ba2 + }; +}; + ++&hdmi { ++ hpd-gpios = <&gpio 46 GPIO_ACTIVE_LOW>; ++}; ++ +/ { + __overrides__ { + uart0 = <&uart0>,"status"; + uart0_clkrate = <&clk_uart0>,"clock-frequency:0"; ++ uart1 = <&uart1>,"status"; + i2s = <&i2s>,"status"; + spi = <&spi0>,"status"; + i2c0 = <&i2c0>,"status"; @@ -110207,125 +113403,171 @@ index 0000000..5206ba2 + audio = <&audio>,"status"; + watchdog = <&watchdog>,"status"; + random = <&random>,"status"; ++ sd_overclock = <&sdhost>,"brcm,overclock-50:0"; ++ sd_force_pio = <&sdhost>,"brcm,force-pio?"; ++ sd_pio_limit = <&sdhost>,"brcm,pio-limit:0"; ++ sd_debug = <&sdhost>,"brcm,debug"; + }; +}; -diff --git a/arch/arm/boot/dts/bcm2709.dtsi b/arch/arm/boot/dts/bcm2709.dtsi +diff --git a/arch/arm/boot/dts/bcm2708-rpi-b.dts b/arch/arm/boot/dts/bcm2708-rpi-b.dts new file mode 100644 -index 0000000..a8cfd7c +index 0000000..8474834 --- /dev/null -+++ b/arch/arm/boot/dts/bcm2709.dtsi -@@ -0,0 +1,102 @@ -+#include "bcm2708_common.dtsi" ++++ b/arch/arm/boot/dts/bcm2708-rpi-b.dts +@@ -0,0 +1,144 @@ ++/dts-v1/; ++ ++#include "bcm2708.dtsi" + +/ { -+ compatible = "brcm,bcm2709"; -+ model = "BCM2709"; ++ compatible = "brcm,bcm2708"; ++ model = "Raspberry Pi Model B"; ++}; + -+ chosen { -+ /* No padding required - the boot loader can do that. */ -+ bootargs = ""; ++&gpio { ++ sdhost_pins: sdhost_pins { ++ brcm,pins = <48 49 50 51 52 53>; ++ brcm,function = <4>; /* alt0 */ + }; + -+ soc { -+ ranges = <0x7e000000 0x3f000000 0x01000000>, -+ <0x40000000 0x40000000 0x00040000>; ++ spi0_pins: spi0_pins { ++ brcm,pins = <9 10 11>; ++ brcm,function = <4>; /* alt0 */ ++ }; + -+ local_intc: local_intc { -+ compatible = "brcm,bcm2836-l1-intc"; -+ reg = <0x40000000 0x100>; -+ interrupt-controller; -+ #interrupt-cells = <1>; -+ interrupt-parent = <&local_intc>; -+ }; ++ spi0_cs_pins: spi0_cs_pins { ++ brcm,pins = <8 7>; ++ brcm,function = <1>; /* output */ ++ }; + -+ arm-pmu { -+ compatible = "arm,cortex-a7-pmu"; -+ interrupt-parent = <&local_intc>; -+ interrupts = <9>; -+ }; ++ i2c0_pins: i2c0 { ++ brcm,pins = <0 1>; ++ brcm,function = <4>; ++ }; + -+ gpiomem { -+ compatible = "brcm,bcm2835-gpiomem"; -+ reg = <0x7e200000 0x1000>; -+ status = "okay"; -+ }; ++ i2c1_pins: i2c1 { ++ brcm,pins = <2 3>; ++ brcm,function = <4>; ++ }; + -+ timer { -+ compatible = "arm,armv7-timer"; -+ clock-frequency = <19200000>; -+ interrupt-parent = <&local_intc>; -+ interrupts = <0>, // PHYS_SECURE_PPI -+ <1>, // PHYS_NONSECURE_PPI -+ <3>, // VIRT_PPI -+ <2>; // HYP_PPI -+ always-on; -+ }; ++ i2s_pins: i2s { ++ brcm,pins = <28 29 30 31>; ++ brcm,function = <6>; /* alt2 */ ++ }; ++}; + -+ syscon@40000000 { -+ compatible = "brcm,bcm2836-arm-local", "syscon"; -+ reg = <0x40000000 0x100>; -+ }; ++&sdhost { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&sdhost_pins>; ++ bus-width = <4>; ++ status = "okay"; ++}; ++ ++&fb { ++ status = "okay"; ++}; ++ ++&uart0 { ++ status = "okay"; ++}; ++ ++&spi0 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&spi0_pins &spi0_cs_pins>; ++ cs-gpios = <&gpio 8 1>, <&gpio 7 1>; ++ ++ spidev0: spidev@0{ ++ compatible = "spidev"; ++ reg = <0>; /* CE0 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; + }; + -+ cpus: cpus { ++ spidev1: spidev@1{ ++ compatible = "spidev"; ++ reg = <1>; /* CE1 */ + #address-cells = <1>; + #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ }; ++}; + -+ v7_cpu0: cpu@0 { -+ device_type = "cpu"; -+ compatible = "arm,cortex-a7"; -+ reg = <0xf00>; -+ clock-frequency = <800000000>; -+ }; ++&i2c0 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2c0_pins>; ++ clock-frequency = <100000>; ++}; + -+ v7_cpu1: cpu@1 { -+ device_type = "cpu"; -+ compatible = "arm,cortex-a7"; -+ reg = <0xf01>; -+ clock-frequency = <800000000>; -+ }; ++&i2c1 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2c1_pins>; ++ clock-frequency = <100000>; ++}; + -+ v7_cpu2: cpu@2 { -+ device_type = "cpu"; -+ compatible = "arm,cortex-a7"; -+ reg = <0xf02>; -+ clock-frequency = <800000000>; -+ }; ++&i2c2 { ++ clock-frequency = <100000>; ++}; + -+ v7_cpu3: cpu@3 { -+ device_type = "cpu"; -+ compatible = "arm,cortex-a7"; -+ reg = <0xf03>; -+ clock-frequency = <800000000>; -+ }; -+ }; ++&i2s { ++ #sound-dai-cells = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2s_pins>; ++}; + -+ __overrides__ { -+ arm_freq = <&v7_cpu0>, "clock-frequency:0", -+ <&v7_cpu1>, "clock-frequency:0", -+ <&v7_cpu2>, "clock-frequency:0", -+ <&v7_cpu3>, "clock-frequency:0"; ++&random { ++ status = "okay"; ++}; ++ ++&leds { ++ act_led: act { ++ label = "led0"; ++ linux,default-trigger = "mmc0"; ++ gpios = <&gpio 16 1>; + }; +}; + -+&watchdog { -+ status = "okay"; ++&hdmi { ++ hpd-gpios = <&gpio 46 GPIO_ACTIVE_HIGH>; +}; + -+&intc { -+ compatible = "brcm,bcm2836-armctrl-ic"; -+ interrupt-parent = <&local_intc>; -+ interrupts = <8>; ++/ { ++ __overrides__ { ++ uart0 = <&uart0>,"status"; ++ uart0_clkrate = <&clk_uart0>,"clock-frequency:0"; ++ uart1 = <&uart1>,"status"; ++ i2s = <&i2s>,"status"; ++ spi = <&spi0>,"status"; ++ i2c0 = <&i2c0>,"status"; ++ i2c1 = <&i2c1>,"status"; ++ i2c2_iknowwhatimdoing = <&i2c2>,"status"; ++ i2c0_baudrate = <&i2c0>,"clock-frequency:0"; ++ i2c1_baudrate = <&i2c1>,"clock-frequency:0"; ++ i2c2_baudrate = <&i2c2>,"clock-frequency:0"; ++ core_freq = <&clk_core>,"clock-frequency:0"; ++ ++ act_led_gpio = <&act_led>,"gpios:4"; ++ act_led_activelow = <&act_led>,"gpios:8"; ++ act_led_trigger = <&act_led>,"linux,default-trigger"; ++ ++ audio = <&audio>,"status"; ++ watchdog = <&watchdog>,"status"; ++ random = <&random>,"status"; ++ sd_overclock = <&sdhost>,"brcm,overclock-50:0"; ++ sd_force_pio = <&sdhost>,"brcm,force-pio?"; ++ sd_pio_limit = <&sdhost>,"brcm,pio-limit:0"; ++ sd_debug = <&sdhost>,"brcm,debug"; ++ }; +}; -diff --git a/arch/arm/boot/dts/bcm2835-rpi-cm.dts b/arch/arm/boot/dts/bcm2835-rpi-cm.dts -new file mode 100644 -index 0000000..c6e6860a +diff --git a/arch/arm/boot/dts/bcm2708-rpi-cm.dts b/arch/arm/boot/dts/bcm2708-rpi-cm.dts +new file mode 100755 +index 0000000..cd0e1ac --- /dev/null -+++ b/arch/arm/boot/dts/bcm2835-rpi-cm.dts -@@ -0,0 +1,93 @@ ++++ b/arch/arm/boot/dts/bcm2708-rpi-cm.dts +@@ -0,0 +1,102 @@ +/dts-v1/; + -+#include "bcm2835-rpi-cm.dtsi" ++#include "bcm2708-rpi-cm.dtsi" + +/ { + model = "Raspberry Pi Compute Module"; @@ -110337,10 +113579,15 @@ index 0000000..c6e6860a + +&gpio { + spi0_pins: spi0_pins { -+ brcm,pins = <7 8 9 10 11>; ++ brcm,pins = <9 10 11>; + brcm,function = <4>; /* alt0 */ + }; + ++ spi0_cs_pins: spi0_cs_pins { ++ brcm,pins = <8 7>; ++ brcm,function = <1>; /* output */ ++ }; ++ + i2c0_pins: i2c0 { + brcm,pins = <0 1>; + brcm,function = <4>; @@ -110359,9 +113606,10 @@ index 0000000..c6e6860a + +&spi0 { + pinctrl-names = "default"; -+ pinctrl-0 = <&spi0_pins>; ++ pinctrl-0 = <&spi0_pins &spi0_cs_pins>; ++ cs-gpios = <&gpio 8 1>, <&gpio 7 1>; + -+ spidev@0{ ++ spidev0: spidev@0{ + compatible = "spidev"; + reg = <0>; /* CE0 */ + #address-cells = <1>; @@ -110369,7 +113617,7 @@ index 0000000..c6e6860a + spi-max-frequency = <500000>; + }; + -+ spidev@1{ ++ spidev1: spidev@1{ + compatible = "spidev"; + reg = <1>; /* CE1 */ + #address-cells = <1>; @@ -110400,11 +113648,15 @@ index 0000000..c6e6860a + pinctrl-0 = <&i2s_pins>; +}; + ++&random { ++ status = "okay"; ++}; ++ +/ { + __overrides__ { + uart0 = <&uart0>,"status"; + uart0_clkrate = <&clk_uart0>,"clock-frequency:0"; -+ uart1_clkrate = <&uart1>,"clock-frequency:0"; ++ uart1 = <&uart1>,"status"; + i2s = <&i2s>,"status"; + spi = <&spi0>,"status"; + i2c0 = <&i2c0>,"status"; @@ -110413,16 +113665,29 @@ index 0000000..c6e6860a + i2c0_baudrate = <&i2c0>,"clock-frequency:0"; + i2c1_baudrate = <&i2c1>,"clock-frequency:0"; + i2c2_baudrate = <&i2c2>,"clock-frequency:0"; -+ core_freq = <&clk_core>,"clock-frequency:0"; + }; +}; -diff --git a/arch/arm/boot/dts/bcm2835-rpi-cm.dtsi b/arch/arm/boot/dts/bcm2835-rpi-cm.dtsi +diff --git a/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi b/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi new file mode 100644 -index 0000000..9c4000f +index 0000000..90e330d --- /dev/null -+++ b/arch/arm/boot/dts/bcm2835-rpi-cm.dtsi -@@ -0,0 +1,30 @@ -+#include "bcm2835.dtsi" ++++ b/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi +@@ -0,0 +1,52 @@ ++#include "bcm2708.dtsi" ++ ++&gpio { ++ sdhost_pins: sdhost_pins { ++ brcm,pins = <48 49 50 51 52 53>; ++ brcm,function = <4>; /* alt0 */ ++ }; ++}; ++ ++&gpio { ++ mmc_pins: mmc_pins { ++ brcm,pins = <48 49 50 51 52 53>; ++ brcm,function = <7>; /* alt3 */ ++ }; ++}; + +&leds { + act_led: act { @@ -110432,9 +113697,14 @@ index 0000000..9c4000f + }; +}; + ++ +&mmc { -+ status = "okay"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&mmc_pins>; ++ non-removable; + bus-width = <4>; ++ status = "okay"; ++ brcm,overclock-50 = <0>; +}; + +&fb { @@ -110443,6 +113713,8 @@ index 0000000..9c4000f + +/ { + __overrides__ { ++ core_freq = <&clk_core>,"clock-frequency:0"; ++ + act_led_gpio = <&act_led>,"gpios:4"; + act_led_activelow = <&act_led>,"gpios:8"; + act_led_trigger = <&act_led>,"linux,default-trigger"; @@ -110450,1848 +113722,2556 @@ index 0000000..9c4000f + audio = <&audio>,"status"; + watchdog = <&watchdog>,"status"; + random = <&random>,"status"; ++ sd_overclock = <&mmc>,"brcm,overclock-50:0"; + }; +}; -diff --git a/arch/arm/boot/dts/overlays/Makefile b/arch/arm/boot/dts/overlays/Makefile +diff --git a/arch/arm/boot/dts/bcm2708.dtsi b/arch/arm/boot/dts/bcm2708.dtsi new file mode 100644 -index 0000000..d8c2771 +index 0000000..f5a44cd --- /dev/null -+++ b/arch/arm/boot/dts/overlays/Makefile -@@ -0,0 +1,69 @@ -+ifeq ($(CONFIG_OF),y) ++++ b/arch/arm/boot/dts/bcm2708.dtsi +@@ -0,0 +1,40 @@ ++#include "bcm2708_common.dtsi" + -+# Overlays for the Raspberry Pi platform ++/ { ++ compatible = "brcm,bcm2708"; ++ model = "BCM2708"; + -+ifeq ($(CONFIG_ARCH_BCM2708),y) -+ RPI_DT_OVERLAYS=y -+endif -+ifeq ($(CONFIG_ARCH_BCM2709),y) -+ RPI_DT_OVERLAYS=y -+endif -+ifeq ($(CONFIG_ARCH_BCM2835),y) -+ RPI_DT_OVERLAYS=y -+endif ++ chosen { ++ /* No padding required - the boot loader can do that. */ ++ bootargs = ""; ++ }; + -+dtb-$(RPI_DT_OVERLAYS) += ads7846-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += bmp085_i2c-sensor-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += dht11-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += enc28j60-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += gpio-poweroff-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += hifiberry-amp-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += hifiberry-dac-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += hifiberry-dacplus-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += hifiberry-digi-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += hy28a-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += hy28b-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += i2c-rtc-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += i2s-mmap-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += iqaudio-dac-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += iqaudio-dacplus-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += lirc-rpi-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += mcp2515-can0-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += mcp2515-can1-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += mmc-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += mz61581-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += piscreen-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += pitft28-resistive-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += pps-gpio-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += pwm-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += pwm-2chan-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += raspidac3-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += rpi-dac-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += rpi-display-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += rpi-ft5406-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += rpi-proto-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += rpi-sense-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += sdhost-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += sdio-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += smi-dev-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += smi-nand-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += smi-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += spi-gpio35-39-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += tinylcd35-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += uart1-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += vga666-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += w1-gpio-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += w1-gpio-pullup-overlay.dtb ++ soc { ++ ranges = <0x7e000000 0x20000000 0x01000000>; + -+targets += dtbs dtbs_install -+targets += $(dtb-y) ++ timer@7e003000 { ++ compatible = "brcm,bcm2835-system-timer"; ++ reg = <0x7e003000 0x1000>; ++ interrupts = <1 0>, <1 1>, <1 2>, <1 3>; ++ clock-frequency = <1000000>; ++ }; + -+endif ++ arm-pmu { ++ compatible = "arm,arm1176-pmu"; ++ }; + -+always := $(dtb-y) -+clean-files := *.dtb ++ gpiomem { ++ compatible = "brcm,bcm2835-gpiomem"; ++ reg = <0x7e200000 0x1000>; ++ status = "okay"; ++ }; ++ }; ++}; + -+# Enable fixups to support overlays on BCM2708 platforms -+ifeq ($(RPI_DT_OVERLAYS),y) -+ DTC_FLAGS ?= -@ -+endif -diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README ++&intc { ++ compatible = "brcm,bcm2835-armctrl-ic"; ++}; ++ ++&watchdog { ++ status = "okay"; ++}; +diff --git a/arch/arm/boot/dts/bcm2708_common.dtsi b/arch/arm/boot/dts/bcm2708_common.dtsi new file mode 100644 -index 0000000..44e33a4 +index 0000000..6ea37c5 --- /dev/null -+++ b/arch/arm/boot/dts/overlays/README -@@ -0,0 +1,648 @@ -+Introduction -+============ -+ -+This directory contains Device Tree overlays. Device Tree makes it possible -+to support many hardware configurations with a single kernel and without the -+need to explicitly load or blacklist kernel modules. Note that this isn't a -+"pure" Device Tree configuration (c.f. MACH_BCM2835) - some on-board devices -+are still configured by the board support code, but the intention is to -+eventually reach that goal. ++++ b/arch/arm/boot/dts/bcm2708_common.dtsi +@@ -0,0 +1,438 @@ ++#include "dt-bindings/clock/bcm2835.h" ++#include <dt-bindings/clock/bcm2835-aux.h> ++#include "dt-bindings/power/raspberrypi-power.h" ++#include "dt-bindings/gpio/gpio.h" ++#include "skeleton.dtsi" + -+On Raspberry Pi, Device Tree usage is controlled from /boot/config.txt. By -+default, the Raspberry Pi kernel boots with device tree enabled. You can -+completely disable DT usage (for now) by adding: ++/ { ++ interrupt-parent = <&intc>; + -+ device_tree= ++ aliases { ++ audio = &audio; ++ aux = &aux; ++ sound = &sound; ++ soc = &soc; ++ dma = &dma; ++ intc = &intc; ++ watchdog = &watchdog; ++ random = &random; ++ mailbox = &mailbox; ++ gpio = &gpio; ++ uart0 = &uart0; ++ sdhost = &sdhost; ++ i2s = &i2s; ++ spi0 = &spi0; ++ i2c0 = &i2c0; ++ uart1 = &uart1; ++ spi1 = &spi1; ++ spi2 = &spi2; ++ mmc = &mmc; ++ i2c1 = &i2c1; ++ i2c2 = &i2c2; ++ usb = &usb; ++ leds = &leds; ++ fb = &fb; ++ vchiq = &vchiq; ++ thermal = &thermal; ++ clocks = &clocks; ++ }; + -+to your config.txt, which should cause your Pi to revert to the old way of -+doing things after a reboot. ++ soc: soc { ++ compatible = "simple-bus"; ++ #address-cells = <1>; ++ #size-cells = <1>; + -+In /boot you will find a .dtb for each base platform. This describes the -+hardware that is part of the Raspberry Pi board. The loader (start.elf and its -+siblings) selects the .dtb file appropriate for the platform by name, and reads -+it into memory. At this point, all of the optional interfaces (i2c, i2s, spi) -+are disabled, but they can be enabled using Device Tree parameters: ++ dma: dma@7e007000 { ++ compatible = "brcm,bcm2835-dma"; ++ reg = <0x7e007000 0xf00>; ++ interrupts = <1 16>, ++ <1 17>, ++ <1 18>, ++ <1 19>, ++ <1 20>, ++ <1 21>, ++ <1 22>, ++ <1 23>, ++ <1 24>, ++ <1 25>, ++ <1 26>, ++ <1 27>; + -+ dtparam=i2c=on,i2s=on,spi=on ++ #dma-cells = <1>; ++ brcm,dma-channel-mask = <0x0f35>; ++ }; + -+However, this shouldn't be necessary in many use cases because loading an -+overlay that requires one of those interfaces will cause it to be enabled -+automatically, and it is advisable to only enable interfaces if they are -+needed. ++ intc: interrupt-controller@7e00b200 { ++ compatible = "brcm,bcm2708-armctrl-ic"; ++ reg = <0x7e00b200 0x200>; ++ interrupt-controller; ++ #interrupt-cells = <2>; ++ }; + -+Configuring additional, optional hardware is done using Device Tree overlays -+(see below). ++ mailbox: mailbox@7e00b800 { ++ compatible = "brcm,bcm2835-mbox"; ++ reg = <0x7e00b880 0x40>; ++ interrupts = <0 1>; ++ #mbox-cells = <0>; ++ }; + -+raspi-config -+============ ++ watchdog: watchdog@7e100000 { ++ compatible = "brcm,bcm2835-pm-wdt"; ++ reg = <0x7e100000 0x28>; ++ status = "disabled"; ++ }; + -+The Advanced Options section of the raspi-config utility can enable and disable -+Device Tree use, as well as toggling the I2C and SPI interfaces. Note that it -+is possible to both enable an interface and blacklist the driver, if for some -+reason you should want to defer the loading. ++ cprman: cprman@7e101000 { ++ compatible = "brcm,bcm2835-cprman"; ++ #clock-cells = <1>; ++ reg = <0x7e101000 0x2000>; + -+Modules -+======= ++ /* CPRMAN derives everything from the platform's ++ * oscillator. ++ */ ++ clocks = <&clk_osc>; ++ status = "disabled"; ++ }; + -+As well as describing the hardware, Device Tree also gives enough information -+to allow suitable driver modules to be located and loaded, with the corollary -+that unneeded modules are not loaded. As a result it should be possible to -+remove lines from /etc/modules, and /etc/modprobe.d/raspi-blacklist.conf can -+have its contents deleted (or commented out). ++ random: rng@7e104000 { ++ compatible = "brcm,bcm2835-rng"; ++ reg = <0x7e104000 0x10>; ++ status = "disabled"; ++ }; + -+Using Overlays -+============== ++ gpio: gpio@7e200000 { ++ compatible = "brcm,bcm2835-gpio"; ++ reg = <0x7e200000 0xb4>; ++ interrupts = <2 17>, <2 18>; + -+Overlays are loaded using the "dtoverlay" directive. As an example, consider the -+popular lirc-rpi module, the Linux Infrared Remote Control driver. In the -+pre-DT world this would be loaded from /etc/modules, with an explicit -+"modprobe lirc-rpi" command, or programmatically by lircd. With DT enabled, -+this becomes a line in config.txt: ++ gpio-controller; ++ #gpio-cells = <2>; + -+ dtoverlay=lirc-rpi ++ interrupt-controller; ++ #interrupt-cells = <2>; ++ }; + -+This causes the file /boot/overlays/lirc-rpi-overlay.dtb to be loaded. By -+default it will use GPIOs 17 (out) and 18 (in), but this can be modified using -+DT parameters: ++ uart0: uart@7e201000 { ++ compatible = "arm,pl011", "arm,primecell"; ++ reg = <0x7e201000 0x1000>; ++ interrupts = <2 25>; ++ clocks = <&clk_uart0 &clk_apb_p>; ++ clock-names = "uartclk","apb_pclk"; ++ arm,primecell-periphid = <0x00241011>; // For an explanation, see ++ // https://github.com/raspberrypi/linux/commit/13731d862cf5219216533a3b0de052cee4cc5038 ++ status = "disabled"; ++ }; + -+ dtoverlay=lirc-rpi,gpio_out_pin=17,gpio_in_pin=13 ++ sdhost: sdhost@7e202000 { ++ compatible = "brcm,bcm2835-sdhost"; ++ reg = <0x7e202000 0x100>; ++ interrupts = <2 24>; ++ clocks = <&clk_core>; ++ dmas = <&dma 13>; ++ dma-names = "rx-tx"; ++ brcm,overclock-50 = <0>; ++ brcm,pio-limit = <1>; ++ status = "disabled"; ++ }; + -+Parameters always have default values, although in some cases (e.g. "w1-gpio") -+it is necessary to provided multiple overlays in order to get the desired -+behaviour. See the list of overlays below for a description of the parameters and their defaults. ++ i2s: i2s@7e203000 { ++ compatible = "brcm,bcm2835-i2s"; ++ #sound-dai-cells = <0>; ++ reg = <0x7e203000 0x24>, ++ <0x7e101098 0x08>; + -+The Overlay and Parameter Reference -+=================================== ++ dmas = <&dma 2>, <&dma 3>; ++ dma-names = "tx", "rx"; ++ status = "disabled"; ++ }; + -+N.B. When editing this file, please preserve the indentation levels to make it simple to parse -+programmatically. NO HARD TABS. ++ spi0: spi@7e204000 { ++ compatible = "brcm,bcm2835-spi"; ++ reg = <0x7e204000 0x1000>; ++ interrupts = <2 22>; ++ clocks = <&clk_core>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "disabled"; ++ /* the dma channels */ ++ dmas = <&dma 6>, <&dma 7>; ++ dma-names = "tx", "rx"; ++ /* the chipselects used - <0> means native GPIO ++ * add more gpios if necessary as <&gpio 6 1> ++ * (but do not forget to make them output!) ++ */ ++ cs-gpios = <0>, <0>; ++ }; + ++ i2c0: i2c@7e205000 { ++ compatible = "brcm,bcm2708-i2c"; ++ reg = <0x7e205000 0x1000>; ++ interrupts = <2 21>; ++ clocks = <&clk_core>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "disabled"; ++ }; + -+Name: <The base DTB> -+Info: Configures the base Raspberry Pi hardware -+Load: <loaded automatically> -+Params: -+ audio Set to "on" to enable the onboard ALSA audio -+ interface (default "off") ++ pixelvalve0: pixelvalve@7e206000 { ++ compatible = "brcm,bcm2835-pixelvalve0"; ++ reg = <0x7e206000 0x100>; ++ status = "disabled"; ++ }; + -+ i2c_arm Set to "on" to enable the ARM's i2c interface -+ (default "off") ++ pixelvalve1: pixelvalve@7e207000 { ++ compatible = "brcm,bcm2835-pixelvalve1"; ++ reg = <0x7e207000 0x100>; ++ status = "disabled"; ++ }; + -+ i2c_vc Set to "on" to enable the i2c interface -+ usually reserved for the VideoCore processor -+ (default "off") ++ pwm: pwm@7e20c000 { ++ compatible = "brcm,bcm2835-pwm"; ++ reg = <0x7e20c000 0x28>; ++ clocks = <&clk_pwm>; ++ #pwm-cells = <2>; ++ status = "disabled"; ++ }; + -+ i2c An alias for i2c_arm ++ aux: aux@0x7e215004 { ++ compatible = "brcm,bcm2835-aux"; ++ #clock-cells = <1>; ++ reg = <0x7e215000 0x8>; ++ clocks = <&clk_core>; ++ status = "disabled"; ++ }; + -+ i2c_arm_baudrate Set the baudrate of the ARM's i2c interface -+ (default "100000") ++ uart1: uart@7e215040 { ++ compatible = "brcm,bcm2835-aux-uart", "ns16550"; ++ reg = <0x7e215040 0x40>; ++ interrupts = <1 29>; ++ clocks = <&clk_uart1>; ++ reg-shift = <2>; ++ no-loopback-test; ++ status = "disabled"; ++ }; + -+ i2c_vc_baudrate Set the baudrate of the VideoCore i2c interface -+ (default "100000") ++ spi1: spi@7e215080 { ++ compatible = "brcm,bcm2835-aux-spi"; ++ reg = <0x7e215080 0x40>, <0x7e215000 0x8>; ++ interrupts = <1 29>; ++ clocks = <&aux BCM2835_AUX_CLOCK_SPI1>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "disabled"; ++ }; + -+ i2c_baudrate An alias for i2c_arm_baudrate ++ spi2: spi@7e2150C0 { ++ compatible = "brcm,bcm2835-aux-spi"; ++ reg = <0x7e2150C0 0x40>, <0x7e215000 0x8>; ++ interrupts = <1 29>; ++ clocks = <&aux BCM2835_AUX_CLOCK_SPI2>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "disabled"; ++ }; + -+ i2s Set to "on" to enable the i2s interface -+ (default "off") ++ mmc: mmc@7e300000 { ++ compatible = "brcm,bcm2835-mmc"; ++ reg = <0x7e300000 0x100>; ++ interrupts = <2 30>; ++ clocks = <&clk_mmc>; ++ dmas = <&dma 11>; ++ dma-names = "rx-tx"; ++ brcm,overclock-50 = <0>; ++ status = "disabled"; ++ }; + -+ spi Set to "on" to enable the spi interfaces -+ (default "off") ++ hvs: hvs@7e400000 { ++ compatible = "brcm,bcm2835-hvs"; ++ reg = <0x7e400000 0x6000>; ++ status = "disabled"; ++ }; + -+ random Set to "on" to enable the hardware random -+ number generator (default "off") ++ i2c1: i2c@7e804000 { ++ compatible = "brcm,bcm2708-i2c"; ++ reg = <0x7e804000 0x1000>; ++ interrupts = <2 21>; ++ clocks = <&clk_core>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "disabled"; ++ }; + -+ uart0 Set to "off" to disable uart0 (default "on") ++ i2c2: i2c@7e805000 { ++ // Beware - this is shared with the HDMI module. ++ // Careless use may break (really) your display. ++ // Caveat emptor. ++ compatible = "brcm,bcm2708-i2c"; ++ reg = <0x7e805000 0x1000>; ++ interrupts = <2 21>; ++ clocks = <&clk_core>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "disabled"; ++ }; + -+ watchdog Set to "on" to enable the hardware watchdog -+ (default "off") ++ smi: smi@7e600000 { ++ compatible = "brcm,bcm2835-smi"; ++ reg = <0x7e600000 0x44>, <0x7e1010b0 0x8>; ++ interrupts = <2 16>; ++ brcm,smi-clock-source = <6>; ++ brcm,smi-clock-divisor = <4>; ++ dmas = <&dma 4>; ++ dma-names = "rx-tx"; ++ status = "disabled"; ++ }; + -+ act_led_trigger Choose which activity the LED tracks. -+ Use "heartbeat" for a nice load indicator. -+ (default "mmc") ++ pixelvalve2: pixelvalve@7e807000 { ++ compatible = "brcm,bcm2835-pixelvalve2"; ++ reg = <0x7e807000 0x100>; ++ status = "disabled"; ++ }; + -+ act_led_activelow Set to "on" to invert the sense of the LED -+ (default "off") ++ hdmi: hdmi@7e902000 { ++ compatible = "brcm,bcm2835-hdmi"; ++ reg = <0x7e902000 0x600>, ++ <0x7e808000 0x100>; ++ ddc = <&i2c2>; ++ hpd-gpios = <&gpio 46 GPIO_ACTIVE_HIGH>; ++ clocks = <&cprman BCM2835_PLLH_PIX>, ++ <&cprman BCM2835_CLOCK_HSM>; ++ clock-names = "pixel", "hdmi"; ++ power-domains = <&power RPI_POWER_DOMAIN_HDMI>; ++ status = "disabled"; ++ }; + -+ act_led_gpio Set which GPIO to use for the activity LED -+ (in case you want to connect it to an external -+ device) -+ (default "16" on a non-Plus board, "47" on a -+ Plus or Pi 2) ++ usb: usb@7e980000 { ++ compatible = "brcm,bcm2708-usb"; ++ reg = <0x7e980000 0x10000>, ++ <0x7e006000 0x1000>; ++ interrupts = <2 0>, ++ <1 9>; ++ }; + -+ pwr_led_trigger -+ pwr_led_activelow -+ pwr_led_gpio -+ As for act_led_*, but using the PWR LED. -+ Not available on Model A/B boards. ++ v3d: v3d@7ec00000 { ++ compatible = "brcm,vc4-v3d"; ++ reg = <0x7ec00000 0x1000>; ++ status = "disabled"; ++ }; + -+ N.B. It is recommended to only enable those interfaces that are needed. -+ Leaving all interfaces enabled can lead to unwanted behaviour (i2c_vc -+ interfering with Pi Camera, I2S and SPI hogging GPIO pins, etc.) -+ Note also that i2c, i2c_arm and i2c_vc are aliases for the physical -+ interfaces i2c0 and i2c1. Use of the numeric variants is still possible -+ but deprecated because the ARM/VC assignments differ between board -+ revisions. The same board-specific mapping applies to i2c_baudrate, -+ and the other i2c baudrate parameters. ++ firmware: firmware { ++ compatible = "raspberrypi,bcm2835-firmware"; ++ mboxes = <&mailbox>; ++ }; + ++ power: power { ++ compatible = "raspberrypi,bcm2835-power"; ++ firmware = <&firmware>; ++ #power-domain-cells = <1>; ++ }; + -+Name: ads7846 -+Info: ADS7846 Touch controller -+Load: dtoverlay=ads7846,<param>=<val> -+Params: cs SPI bus Chip Select (default 1) -+ speed SPI bus speed (default 2Mhz, max 3.25MHz) -+ penirq GPIO used for PENIRQ. REQUIRED -+ penirq_pull Set GPIO pull (default 0=none, 2=pullup) -+ swapxy Swap x and y axis -+ xmin Minimum value on the X axis (default 0) -+ ymin Minimum value on the Y axis (default 0) -+ xmax Maximum value on the X axis (default 4095) -+ ymax Maximum value on the Y axis (default 4095) -+ pmin Minimum reported pressure value (default 0) -+ pmax Maximum reported pressure value (default 65535) -+ xohms Touchpanel sensitivity (X-plate resistance) -+ (default 400) ++ leds: leds { ++ compatible = "gpio-leds"; ++ }; + -+ penirq is required and usually xohms (60-100) has to be set as well. -+ Apart from that, pmax (255) and swapxy are also common. -+ The rest of the calibration can be done with xinput-calibrator. -+ See: github.com/notro/fbtft/wiki/FBTFT-on-Raspian -+ Device Tree binding document: -+ www.kernel.org/doc/Documentation/devicetree/bindings/input/ads7846.txt ++ fb: fb { ++ compatible = "brcm,bcm2708-fb"; ++ firmware = <&firmware>; ++ status = "disabled"; ++ }; + ++ vchiq: vchiq { ++ compatible = "brcm,bcm2835-vchiq"; ++ reg = <0x7e00b840 0xf>; ++ interrupts = <0 2>; ++ cache-line-size = <32>; ++ firmware = <&firmware>; ++ }; + -+Name: bmp085_i2c-sensor -+Info: Configures the BMP085/BMP180 digital barometric pressure and temperature -+ sensors from Bosch Sensortec -+Load: dtoverlay=bmp085_i2c-sensor -+Params: <None> ++ thermal: thermal { ++ compatible = "brcm,bcm2835-thermal"; ++ firmware = <&firmware>; ++ }; + ++ gpu: gpu { ++ compatible = "brcm,bcm2835-vc4"; ++ status = "disabled"; ++ }; + -+Name: dht11 -+Info: Overlay for the DHT11/DHT21/DHT22 humidity/temperature sensors -+ Also sometimes found with the part number(s) AM230x. -+Load: dtoverlay=dht11,<param>=<val> -+Params: gpiopin GPIO connected to the sensor's DATA output. -+ (default 4) ++ /* Onboard audio */ ++ audio: audio { ++ compatible = "brcm,bcm2835-audio"; ++ brcm,pwm-channels = <8>; ++ status = "disabled"; ++ }; + ++ /* External sound card */ ++ sound: sound { ++ status = "disabled"; ++ }; ++ }; + -+[ The ds1307-rtc overlay has been deleted. See i2c-rtc. ] ++ clocks: clocks { ++ compatible = "simple-bus"; ++ #address-cells = <1>; ++ #size-cells = <0>; + ++ clk_core: clock@0 { ++ compatible = "fixed-clock"; ++ reg = <0>; ++ #clock-cells = <0>; ++ clock-output-names = "core"; ++ clock-frequency = <250000000>; ++ }; + -+Name: enc28j60 -+Info: Overlay for the Microchip ENC28J60 Ethernet Controller (SPI) -+Load: dtoverlay=enc28j60,<param>=<val> -+Params: int_pin GPIO used for INT (default 25) ++ clk_mmc: clock@1 { ++ compatible = "fixed-clock"; ++ reg = <1>; ++ #clock-cells = <0>; ++ clock-output-names = "mmc"; ++ clock-frequency = <250000000>; ++ }; + -+ speed SPI bus speed (default 12000000) ++ clk_uart0: clock@2 { ++ compatible = "fixed-clock"; ++ reg = <2>; ++ #clock-cells = <0>; ++ clock-output-names = "uart0_pclk"; ++ clock-frequency = <3000000>; ++ }; + ++ clk_apb_p: clock@3 { ++ compatible = "fixed-clock"; ++ reg = <3>; ++ #clock-cells = <0>; ++ clock-output-names = "apb_pclk"; ++ clock-frequency = <126000000>; ++ }; + -+Name: gpio-poweroff -+Info: Drives a GPIO high or low on reboot -+Load: dtoverlay=gpio-poweroff,<param>=<val> -+Params: gpiopin GPIO for signalling (default 26) ++ clk_pwm: clock@4 { ++ compatible = "fixed-clock"; ++ reg = <4>; ++ #clock-cells = <0>; ++ clock-output-names = "pwm"; ++ clock-frequency = <100000000>; ++ }; + -+ active_low Set if the power control device requires a -+ high->low transition to trigger a power-down. -+ Note that this will require the support of a -+ custom dt-blob.bin to prevent a power-down -+ during the boot process, and that a reboot -+ will also cause the pin to go low. ++ clk_uart1: clock@5 { ++ compatible = "fixed-factor-clock"; ++ reg = <5>; ++ clocks = <&clk_core>; ++ #clock-cells = <0>; ++ clock-div = <1>; ++ clock-mult = <2>; ++ }; + ++ /* The oscillator is the root of the clock tree. */ ++ clk_osc: clock@6 { ++ compatible = "fixed-clock"; ++ reg = <6>; ++ #clock-cells = <0>; ++ clock-output-names = "osc"; ++ clock-frequency = <19200000>; ++ }; ++ }; + -+Name: hifiberry-amp -+Info: Configures the HifiBerry Amp and Amp+ audio cards -+Load: dtoverlay=hifiberry-amp -+Params: <None> ++ __overrides__ { ++ cache_line_size = <&vchiq>, "cache-line-size:0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/bcm2709-rpi-2-b.dts b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts +new file mode 100644 +index 0000000..5e23c04 +--- /dev/null ++++ b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts +@@ -0,0 +1,154 @@ ++/dts-v1/; + ++#include "bcm2709.dtsi" + -+Name: hifiberry-dac -+Info: Configures the HifiBerry DAC audio card -+Load: dtoverlay=hifiberry-dac -+Params: <None> ++/ { ++ compatible = "brcm,bcm2709"; ++ model = "Raspberry Pi 2 Model B"; ++}; + ++&gpio { ++ sdhost_pins: sdhost_pins { ++ brcm,pins = <48 49 50 51 52 53>; ++ brcm,function = <4>; /* alt0 */ ++ }; + -+Name: hifiberry-dacplus -+Info: Configures the HifiBerry DAC+ audio card -+Load: dtoverlay=hifiberry-dacplus -+Params: <None> ++ spi0_pins: spi0_pins { ++ brcm,pins = <9 10 11>; ++ brcm,function = <4>; /* alt0 */ ++ }; + ++ spi0_cs_pins: spi0_cs_pins { ++ brcm,pins = <8 7>; ++ brcm,function = <1>; /* output */ ++ }; + -+Name: hifiberry-digi -+Info: Configures the HifiBerry Digi audio card -+Load: dtoverlay=hifiberry-digi -+Params: <None> ++ i2c0_pins: i2c0 { ++ brcm,pins = <0 1>; ++ brcm,function = <4>; ++ }; + ++ i2c1_pins: i2c1 { ++ brcm,pins = <2 3>; ++ brcm,function = <4>; ++ }; + -+Name: hy28a -+Info: HY28A - 2.8" TFT LCD Display Module by HAOYU Electronics -+ Default values match Texy's display shield -+Load: dtoverlay=hy28a,<param>=<val> -+Params: speed Display SPI bus speed ++ i2s_pins: i2s { ++ brcm,pins = <18 19 20 21>; ++ brcm,function = <4>; /* alt0 */ ++ }; ++}; + -+ rotate Display rotation {0,90,180,270} ++&sdhost { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&sdhost_pins>; ++ bus-width = <4>; ++ status = "okay"; ++}; + -+ fps Delay between frame updates ++&fb { ++ status = "okay"; ++}; + -+ debug Debug output level {0-7} ++&uart0 { ++ status = "okay"; ++}; + -+ xohms Touchpanel sensitivity (X-plate resistance) ++&spi0 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&spi0_pins &spi0_cs_pins>; ++ cs-gpios = <&gpio 8 1>, <&gpio 7 1>; + -+ resetgpio GPIO used to reset controller ++ spidev0: spidev@0{ ++ compatible = "spidev"; ++ reg = <0>; /* CE0 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ }; + -+ ledgpio GPIO used to control backlight ++ spidev1: spidev@1{ ++ compatible = "spidev"; ++ reg = <1>; /* CE1 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ }; ++}; + ++&i2c0 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2c0_pins>; ++ clock-frequency = <100000>; ++}; + -+Name: hy28b -+Info: HY28B - 2.8" TFT LCD Display Module by HAOYU Electronics -+ Default values match Texy's display shield -+Load: dtoverlay=hy28b,<param>=<val> -+Params: speed Display SPI bus speed ++&i2c1 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2c1_pins>; ++ clock-frequency = <100000>; ++}; + -+ rotate Display rotation {0,90,180,270} ++&i2c2 { ++ clock-frequency = <100000>; ++}; + -+ fps Delay between frame updates ++&i2s { ++ #sound-dai-cells = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2s_pins>; ++}; + -+ debug Debug output level {0-7} ++&random { ++ status = "okay"; ++}; + -+ xohms Touchpanel sensitivity (X-plate resistance) ++&leds { ++ act_led: act { ++ label = "led0"; ++ linux,default-trigger = "mmc0"; ++ gpios = <&gpio 47 0>; ++ }; + -+ resetgpio GPIO used to reset controller ++ pwr_led: pwr { ++ label = "led1"; ++ linux,default-trigger = "input"; ++ gpios = <&gpio 35 0>; ++ }; ++}; + -+ ledgpio GPIO used to control backlight ++&hdmi { ++ hpd-gpios = <&gpio 46 GPIO_ACTIVE_LOW>; ++}; + ++/ { ++ __overrides__ { ++ uart0 = <&uart0>,"status"; ++ uart0_clkrate = <&clk_uart0>,"clock-frequency:0"; ++ uart1 = <&uart1>,"status"; ++ i2s = <&i2s>,"status"; ++ spi = <&spi0>,"status"; ++ i2c0 = <&i2c0>,"status"; ++ i2c1 = <&i2c1>,"status"; ++ i2c2_iknowwhatimdoing = <&i2c2>,"status"; ++ i2c0_baudrate = <&i2c0>,"clock-frequency:0"; ++ i2c1_baudrate = <&i2c1>,"clock-frequency:0"; ++ i2c2_baudrate = <&i2c2>,"clock-frequency:0"; ++ core_freq = <&clk_core>,"clock-frequency:0"; + -+Name: i2c-rtc -+Info: Adds support for a number of I2C Real Time Clock devices -+Load: dtoverlay=i2c-rtc,<param> -+Params: ds1307 Select the DS1307 device ++ act_led_gpio = <&act_led>,"gpios:4"; ++ act_led_activelow = <&act_led>,"gpios:8"; ++ act_led_trigger = <&act_led>,"linux,default-trigger"; + -+ ds3231 Select the DS3231 device ++ pwr_led_gpio = <&pwr_led>,"gpios:4"; ++ pwr_led_activelow = <&pwr_led>,"gpios:8"; ++ pwr_led_trigger = <&pwr_led>,"linux,default-trigger"; + -+ mcp7941x Select the MCP7941x device ++ audio = <&audio>,"status"; ++ watchdog = <&watchdog>,"status"; ++ random = <&random>,"status"; ++ sd_overclock = <&sdhost>,"brcm,overclock-50:0"; ++ sd_force_pio = <&sdhost>,"brcm,force-pio?"; ++ sd_pio_limit = <&sdhost>,"brcm,pio-limit:0"; ++ sd_debug = <&sdhost>,"brcm,debug"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/bcm2709.dtsi b/arch/arm/boot/dts/bcm2709.dtsi +new file mode 100644 +index 0000000..a8cfd7c +--- /dev/null ++++ b/arch/arm/boot/dts/bcm2709.dtsi +@@ -0,0 +1,102 @@ ++#include "bcm2708_common.dtsi" + -+ pcf2127 Select the PCF2127 device ++/ { ++ compatible = "brcm,bcm2709"; ++ model = "BCM2709"; + -+ pcf8523 Select the PCF8523 device ++ chosen { ++ /* No padding required - the boot loader can do that. */ ++ bootargs = ""; ++ }; + -+ pcf8563 Select the PCF8563 device ++ soc { ++ ranges = <0x7e000000 0x3f000000 0x01000000>, ++ <0x40000000 0x40000000 0x00040000>; + ++ local_intc: local_intc { ++ compatible = "brcm,bcm2836-l1-intc"; ++ reg = <0x40000000 0x100>; ++ interrupt-controller; ++ #interrupt-cells = <1>; ++ interrupt-parent = <&local_intc>; ++ }; + -+Name: i2s-mmap -+Info: Enables mmap support in the bcm2708-i2s driver -+Load: dtoverlay=i2s-mmap -+Params: <None> ++ arm-pmu { ++ compatible = "arm,cortex-a7-pmu"; ++ interrupt-parent = <&local_intc>; ++ interrupts = <9>; ++ }; + ++ gpiomem { ++ compatible = "brcm,bcm2835-gpiomem"; ++ reg = <0x7e200000 0x1000>; ++ status = "okay"; ++ }; + -+Name: iqaudio-dac -+Info: Configures the IQaudio DAC audio card -+Load: dtoverlay=iqaudio-dac -+Params: <None> ++ timer { ++ compatible = "arm,armv7-timer"; ++ clock-frequency = <19200000>; ++ interrupt-parent = <&local_intc>; ++ interrupts = <0>, // PHYS_SECURE_PPI ++ <1>, // PHYS_NONSECURE_PPI ++ <3>, // VIRT_PPI ++ <2>; // HYP_PPI ++ always-on; ++ }; + ++ syscon@40000000 { ++ compatible = "brcm,bcm2836-arm-local", "syscon"; ++ reg = <0x40000000 0x100>; ++ }; ++ }; + -+Name: iqaudio-dacplus -+Info: Configures the IQaudio DAC+ audio card -+Load: dtoverlay=iqaudio-dacplus -+Params: <None> ++ cpus: cpus { ++ #address-cells = <1>; ++ #size-cells = <0>; + ++ v7_cpu0: cpu@0 { ++ device_type = "cpu"; ++ compatible = "arm,cortex-a7"; ++ reg = <0xf00>; ++ clock-frequency = <800000000>; ++ }; + -+Name: lirc-rpi -+Info: Configures lirc-rpi (Linux Infrared Remote Control for Raspberry Pi) -+ Consult the module documentation for more details. -+Load: dtoverlay=lirc-rpi,<param>=<val>,... -+Params: gpio_out_pin GPIO for output (default "17") ++ v7_cpu1: cpu@1 { ++ device_type = "cpu"; ++ compatible = "arm,cortex-a7"; ++ reg = <0xf01>; ++ clock-frequency = <800000000>; ++ }; + -+ gpio_in_pin GPIO for input (default "18") ++ v7_cpu2: cpu@2 { ++ device_type = "cpu"; ++ compatible = "arm,cortex-a7"; ++ reg = <0xf02>; ++ clock-frequency = <800000000>; ++ }; + -+ gpio_in_pull Pull up/down/off on the input pin -+ (default "down") ++ v7_cpu3: cpu@3 { ++ device_type = "cpu"; ++ compatible = "arm,cortex-a7"; ++ reg = <0xf03>; ++ clock-frequency = <800000000>; ++ }; ++ }; + -+ sense Override the IR receive auto-detection logic: -+ "0" = force active-high -+ "1" = force active-low -+ "-1" = use auto-detection -+ (default "-1") ++ __overrides__ { ++ arm_freq = <&v7_cpu0>, "clock-frequency:0", ++ <&v7_cpu1>, "clock-frequency:0", ++ <&v7_cpu2>, "clock-frequency:0", ++ <&v7_cpu3>, "clock-frequency:0"; ++ }; ++}; + -+ softcarrier Turn the software carrier "on" or "off" -+ (default "on") ++&watchdog { ++ status = "okay"; ++}; + -+ invert "on" = invert the output pin (default "off") ++&intc { ++ compatible = "brcm,bcm2836-armctrl-ic"; ++ interrupt-parent = <&local_intc>; ++ interrupts = <8>; ++}; +diff --git a/arch/arm/boot/dts/bcm2710-rpi-3-b.dts b/arch/arm/boot/dts/bcm2710-rpi-3-b.dts +new file mode 100644 +index 0000000..0979a27 +--- /dev/null ++++ b/arch/arm/boot/dts/bcm2710-rpi-3-b.dts +@@ -0,0 +1,201 @@ ++/dts-v1/; + -+ debug "on" = enable additional debug messages -+ (default "off") ++#include "bcm2710.dtsi" + ++/ { ++ compatible = "brcm,bcm2710","brcm,bcm2709"; ++ model = "Raspberry Pi 3 Model B"; ++}; + -+Name: mcp2515-can0 -+Info: Configures the MCP2515 CAN controller on spi0.0 -+Load: dtoverlay=mcp2515-can0,<param>=<val> -+Params: oscillator Clock frequency for the CAN controller (Hz) ++&gpio { ++ sdhost_pins: sdhost_pins { ++ brcm,pins = <48 49 50 51 52 53>; ++ brcm,function = <4>; /* alt0 */ ++ }; + -+ spimaxfrequency Maximum SPI frequence (Hz) ++ spi0_pins: spi0_pins { ++ brcm,pins = <9 10 11>; ++ brcm,function = <4>; /* alt0 */ ++ }; + -+ interrupt GPIO for interrupt signal ++ spi0_cs_pins: spi0_cs_pins { ++ brcm,pins = <8 7>; ++ brcm,function = <1>; /* output */ ++ }; + ++ i2c0_pins: i2c0 { ++ brcm,pins = <0 1>; ++ brcm,function = <4>; ++ }; + -+Name: mcp2515-can1 -+Info: Configures the MCP2515 CAN controller on spi0.1 -+Load: dtoverlay=mcp2515-can1,<param>=<val> -+Params: oscillator Clock frequency for the CAN controller (Hz) ++ i2c1_pins: i2c1 { ++ brcm,pins = <2 3>; ++ brcm,function = <4>; ++ }; + -+ spimaxfrequency Maximum SPI frequence (Hz) ++ i2s_pins: i2s { ++ brcm,pins = <18 19 20 21>; ++ brcm,function = <4>; /* alt0 */ ++ }; + -+ interrupt GPIO for interrupt signal ++ sdio_pins: sdio_pins { ++ brcm,pins = <34 35 36 37 38 39>; ++ brcm,function = <7>; // alt3 = SD1 ++ brcm,pull = <0 2 2 2 2 2>; ++ }; + ++ bt_pins: bt_pins { ++ brcm,pins = <43>; ++ brcm,function = <4>; /* alt0:GPCLK2 */ ++ brcm,pull = <0>; ++ }; + -+Name: mmc -+Info: Selects the bcm2835-mmc SD/MMC driver, optionally with overclock -+Load: dtoverlay=mmc,<param>=<val> -+Params: overclock_50 Clock (in MHz) to use when the MMC framework -+ requests 50MHz -+ force_pio Disable DMA support ++ uart0_pins: uart0_pins { ++ brcm,pins = <32 33>; ++ brcm,function = <7>; /* alt3=UART0 */ ++ brcm,pull = <0 2>; ++ }; + ++ uart1_pins: uart1_pins { ++ brcm,pins; ++ brcm,function; ++ brcm,pull; ++ }; ++}; + -+Name: mz61581 -+Info: MZ61581 display by Tontec -+Load: dtoverlay=mz61581,<param>=<val> -+Params: speed Display SPI bus speed ++&sdhost { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&sdhost_pins>; ++ bus-width = <4>; ++ status = "okay"; ++}; + -+ rotate Display rotation {0,90,180,270} ++&mmc { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&sdio_pins>; ++ non-removable; ++ bus-width = <4>; ++ status = "okay"; ++ brcm,overclock-50 = <0>; ++}; + -+ fps Delay between frame updates ++&soc { ++ virtgpio: virtgpio { ++ compatible = "brcm,bcm2835-virtgpio"; ++ gpio-controller; ++ #gpio-cells = <2>; ++ firmware = <&firmware>; ++ status = "okay"; ++ }; ++}; + -+ txbuflen Transmit buffer length (default 32768) ++&fb { ++ status = "okay"; ++}; + -+ debug Debug output level {0-7} ++&uart0 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&uart0_pins &bt_pins>; ++ status = "okay"; ++}; + -+ xohms Touchpanel sensitivity (X-plate resistance) ++&uart1 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&uart1_pins>; ++ status = "okay"; ++}; + ++&spi0 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&spi0_pins &spi0_cs_pins>; ++ cs-gpios = <&gpio 8 1>, <&gpio 7 1>; + -+[ The pcf2127-rtc overlay has been deleted. See i2c-rtc. ] ++ spidev0: spidev@0{ ++ compatible = "spidev"; ++ reg = <0>; /* CE0 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ }; + ++ spidev1: spidev@1{ ++ compatible = "spidev"; ++ reg = <1>; /* CE1 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ }; ++}; + -+[ The pcf8523-rtc overlay has been deleted. See i2c-rtc. ] ++&i2c0 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2c0_pins>; ++ clock-frequency = <100000>; ++}; + ++&i2c1 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2c1_pins>; ++ clock-frequency = <100000>; ++}; + -+[ The pcf8563-rtc overlay has been deleted. See i2c-rtc. ] ++&i2c2 { ++ clock-frequency = <100000>; ++}; + ++&i2s { ++ #sound-dai-cells = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2s_pins>; ++}; + -+Name: piscreen -+Info: PiScreen display by OzzMaker.com -+Load: dtoverlay=piscreen,<param>=<val> -+Params: speed Display SPI bus speed ++&random { ++ status = "okay"; ++}; + -+ rotate Display rotation {0,90,180,270} ++&leds { ++ act_led: act { ++ label = "led0"; ++ linux,default-trigger = "mmc0"; ++ gpios = <&virtgpio 0 0>; ++ }; ++}; + -+ fps Delay between frame updates ++&hdmi { ++ hpd-gpios = <&gpio 46 GPIO_ACTIVE_LOW>; ++}; + -+ debug Debug output level {0-7} ++/ { ++ chosen { ++ bootargs = "8250.nr_uarts=1"; ++ }; ++}; + -+ xohms Touchpanel sensitivity (X-plate resistance) ++/ { ++ __overrides__ { ++ uart0 = <&uart0>,"status"; ++ uart0_clkrate = <&clk_uart0>,"clock-frequency:0"; ++ uart1 = <&uart1>,"status"; ++ i2s = <&i2s>,"status"; ++ spi = <&spi0>,"status"; ++ i2c0 = <&i2c0>,"status"; ++ i2c1 = <&i2c1>,"status"; ++ i2c2_iknowwhatimdoing = <&i2c2>,"status"; ++ i2c0_baudrate = <&i2c0>,"clock-frequency:0"; ++ i2c1_baudrate = <&i2c1>,"clock-frequency:0"; ++ i2c2_baudrate = <&i2c2>,"clock-frequency:0"; ++ core_freq = <&clk_core>,"clock-frequency:0"; + ++ act_led_gpio = <&act_led>,"gpios:4"; ++ act_led_activelow = <&act_led>,"gpios:8"; ++ act_led_trigger = <&act_led>,"linux,default-trigger"; + -+Name: pitft28-resistive -+Info: Adafruit PiTFT 2.8" resistive touch screen -+Load: dtoverlay=pitft28-resistive,<param>=<val> -+Params: speed Display SPI bus speed ++ audio = <&audio>,"status"; ++ watchdog = <&watchdog>,"status"; ++ random = <&random>,"status"; ++ sd_overclock = <&sdhost>,"brcm,overclock-50:0"; ++ sd_force_pio = <&sdhost>,"brcm,force-pio?"; ++ sd_pio_limit = <&sdhost>,"brcm,pio-limit:0"; ++ sd_debug = <&sdhost>,"brcm,debug"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/bcm2710.dtsi b/arch/arm/boot/dts/bcm2710.dtsi +new file mode 100644 +index 0000000..1a48686 +--- /dev/null ++++ b/arch/arm/boot/dts/bcm2710.dtsi +@@ -0,0 +1,102 @@ ++#include "bcm2708_common.dtsi" + -+ rotate Display rotation {0,90,180,270} ++/ { ++ compatible = "brcm,bcm2710","brcm,bcm2709"; ++ model = "BCM2710"; + -+ fps Delay between frame updates ++ chosen { ++ /* No padding required - the boot loader can do that. */ ++ bootargs = ""; ++ }; + -+ debug Debug output level {0-7} ++ soc { ++ ranges = <0x7e000000 0x3f000000 0x01000000>, ++ <0x40000000 0x40000000 0x00040000>; + ++ local_intc: local_intc { ++ compatible = "brcm,bcm2836-l1-intc"; ++ reg = <0x40000000 0x100>; ++ interrupt-controller; ++ #interrupt-cells = <1>; ++ interrupt-parent = <&local_intc>; ++ }; + -+Name: pps-gpio -+Info: Configures the pps-gpio (pulse-per-second time signal via GPIO). -+Load: dtoverlay=pps-gpio,<param>=<val> -+Params: gpiopin Input GPIO (default "18") ++ arm-pmu { ++ compatible = "arm,cortex-a7-pmu"; ++ interrupt-parent = <&local_intc>; ++ interrupts = <9>; ++ }; + ++ gpiomem { ++ compatible = "brcm,bcm2835-gpiomem"; ++ reg = <0x7e200000 0x1000>; ++ status = "okay"; ++ }; + -+Name: pwm -+Info: Configures a single PWM channel -+ Legal pin,function combinations for each channel: -+ PWM0: 12,4(Alt0) 18,2(Alt5) 40,4(Alt0) 52,5(Alt1) -+ PWM1: 13,4(Alt0) 19,2(Alt5) 41,4(Alt0) 45,4(Alt0) 53,5(Alt1) -+ N.B.: -+ 1) Pin 18 is the only one available on all platforms, and -+ it is the one used by the I2S audio interface. -+ Pins 12 and 13 might be better choices on an A+, B+ or Pi2. -+ 2) The onboard analogue audio output uses both PWM channels. -+ 3) So be careful mixing audio and PWM. -+ 4) Currently the clock must have been enabled and configured -+ by other means. -+Load: dtoverlay=pwm,<param>=<val> -+Params: pin Output pin (default 18) - see table -+ func Pin function (default 2 = Alt5) - see above -+ clock PWM clock frequency (informational) ++ timer { ++ compatible = "arm,armv7-timer"; ++ clock-frequency = <19200000>; ++ interrupt-parent = <&local_intc>; ++ interrupts = <0>, // PHYS_SECURE_PPI ++ <1>, // PHYS_NONSECURE_PPI ++ <3>, // VIRT_PPI ++ <2>; // HYP_PPI ++ always-on; ++ }; + ++ syscon@40000000 { ++ compatible = "brcm,bcm2836-arm-local", "syscon"; ++ reg = <0x40000000 0x100>; ++ }; ++ }; + -+Name: pwm-2chan -+Info: Configures both PWM channels -+ Legal pin,function combinations for each channel: -+ PWM0: 12,4(Alt0) 18,2(Alt5) 40,4(Alt0) 52,5(Alt1) -+ PWM1: 13,4(Alt0) 19,2(Alt5) 41,4(Alt0) 45,4(Alt0) 53,5(Alt1) -+ N.B.: -+ 1) Pin 18 is the only one available on all platforms, and -+ it is the one used by the I2S audio interface. -+ Pins 12 and 13 might be better choices on an A+, B+ or Pi2. -+ 2) The onboard analogue audio output uses both PWM channels. -+ 3) So be careful mixing audio and PWM. -+ 4) Currently the clock must have been enabled and configured -+ by other means. -+Load: dtoverlay=pwm-2chan,<param>=<val> -+Params: pin Output pin (default 18) - see table -+ pin2 Output pin for other channel (default 19) -+ func Pin function (default 2 = Alt5) - see above -+ func2 Function for pin2 (default 2 = Alt5) -+ clock PWM clock frequency (informational) ++ cpus: cpus { ++ #address-cells = <1>; ++ #size-cells = <0>; + ++ v7_cpu0: cpu@0 { ++ device_type = "cpu"; ++ compatible = "arm,cortex-a7"; ++ reg = <0x000>; ++ clock-frequency = <800000000>; ++ }; + -+Name: raspidac3 -+Info: Configures the RaspiDAV Rev.3x audio card -+Load: dtoverlay=raspidac3 -+Params: <None> ++ v7_cpu1: cpu@1 { ++ device_type = "cpu"; ++ compatible = "arm,cortex-a7"; ++ reg = <0x001>; ++ clock-frequency = <800000000>; ++ }; + ++ v7_cpu2: cpu@2 { ++ device_type = "cpu"; ++ compatible = "arm,cortex-a7"; ++ reg = <0x002>; ++ clock-frequency = <800000000>; ++ }; + -+Name: rpi-dac -+Info: Configures the RPi DAC audio card -+Load: dtoverlay=rpi-dac -+Params: <None> ++ v7_cpu3: cpu@3 { ++ device_type = "cpu"; ++ compatible = "arm,cortex-a7"; ++ reg = <0x003>; ++ clock-frequency = <800000000>; ++ }; ++ }; + ++ __overrides__ { ++ arm_freq = <&v7_cpu0>, "clock-frequency:0", ++ <&v7_cpu1>, "clock-frequency:0", ++ <&v7_cpu2>, "clock-frequency:0", ++ <&v7_cpu3>, "clock-frequency:0"; ++ }; ++}; + -+Name: rpi-display -+Info: RPi-Display - 2.8" Touch Display by Watterott -+Load: dtoverlay=rpi-display,<param>=<val> -+Params: speed Display SPI bus speed ++&watchdog { ++ status = "okay"; ++}; + -+ rotate Display rotation {0,90,180,270} ++&intc { ++ compatible = "brcm,bcm2836-armctrl-ic"; ++ interrupt-parent = <&local_intc>; ++ interrupts = <8>; ++}; +diff --git a/arch/arm/boot/dts/bcm2835-rpi-cm.dts b/arch/arm/boot/dts/bcm2835-rpi-cm.dts +new file mode 100644 +index 0000000..c6e6860 +--- /dev/null ++++ b/arch/arm/boot/dts/bcm2835-rpi-cm.dts +@@ -0,0 +1,93 @@ ++/dts-v1/; + -+ fps Delay between frame updates ++#include "bcm2835-rpi-cm.dtsi" + -+ debug Debug output level {0-7} ++/ { ++ model = "Raspberry Pi Compute Module"; ++}; + -+ xohms Touchpanel sensitivity (X-plate resistance) ++&uart0 { ++ status = "okay"; ++}; + ++&gpio { ++ spi0_pins: spi0_pins { ++ brcm,pins = <7 8 9 10 11>; ++ brcm,function = <4>; /* alt0 */ ++ }; + -+Name: rpi-ft5406 -+Info: Official Raspberry Pi display touchscreen -+Load: dtoverlay=rpi-ft5406 -+Params: <None> ++ i2c0_pins: i2c0 { ++ brcm,pins = <0 1>; ++ brcm,function = <4>; ++ }; + ++ i2c1_pins: i2c1 { ++ brcm,pins = <2 3>; ++ brcm,function = <4>; ++ }; + -+Name: rpi-proto -+Info: Configures the RPi Proto audio card -+Load: dtoverlay=rpi-proto -+Params: <None> ++ i2s_pins: i2s { ++ brcm,pins = <18 19 20 21>; ++ brcm,function = <4>; /* alt0 */ ++ }; ++}; + ++&spi0 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&spi0_pins>; + -+Name: rpi-sense -+Info: Raspberry Pi Sense HAT -+Load: dtoverlay=rpi-sense -+Params: <None> ++ spidev@0{ ++ compatible = "spidev"; ++ reg = <0>; /* CE0 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ }; + ++ spidev@1{ ++ compatible = "spidev"; ++ reg = <1>; /* CE1 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ }; ++}; + -+Name: sdhost -+Info: Selects the bcm2835-sdhost SD/MMC driver, optionally with overclock -+Load: dtoverlay=sdhost,<param>=<val> -+Params: overclock_50 Clock (in MHz) to use when the MMC framework -+ requests 50MHz ++&i2c0 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2c0_pins>; ++ clock-frequency = <100000>; ++}; + -+ force_pio Disable DMA support (default off) ++&i2c1 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2c1_pins>; ++ clock-frequency = <100000>; ++}; + -+ pio_limit Number of blocks above which to use DMA -+ (default 1) ++&i2c2 { ++ clock-frequency = <100000>; ++}; + -+ debug Enable debug output (default off) ++&i2s { ++ #sound-dai-cells = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2s_pins>; ++}; + ++/ { ++ __overrides__ { ++ uart0 = <&uart0>,"status"; ++ uart0_clkrate = <&clk_uart0>,"clock-frequency:0"; ++ uart1_clkrate = <&uart1>,"clock-frequency:0"; ++ i2s = <&i2s>,"status"; ++ spi = <&spi0>,"status"; ++ i2c0 = <&i2c0>,"status"; ++ i2c1 = <&i2c1>,"status"; ++ i2c2_iknowwhatimdoing = <&i2c2>,"status"; ++ i2c0_baudrate = <&i2c0>,"clock-frequency:0"; ++ i2c1_baudrate = <&i2c1>,"clock-frequency:0"; ++ i2c2_baudrate = <&i2c2>,"clock-frequency:0"; ++ core_freq = <&clk_core>,"clock-frequency:0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/bcm2835-rpi-cm.dtsi b/arch/arm/boot/dts/bcm2835-rpi-cm.dtsi +new file mode 100644 +index 0000000..9c4000f +--- /dev/null ++++ b/arch/arm/boot/dts/bcm2835-rpi-cm.dtsi +@@ -0,0 +1,30 @@ ++#include "bcm2835.dtsi" + -+Name: sdio -+Info: Selects the bcm2835-sdhost SD/MMC driver, optionally with overclock, -+ and enables SDIO via GPIOs 22-27. -+Load: dtoverlay=sdio,<param>=<val> -+Params: overclock_50 Clock (in MHz) to use when the MMC framework -+ requests 50MHz ++&leds { ++ act_led: act { ++ label = "led0"; ++ linux,default-trigger = "mmc0"; ++ gpios = <&gpio 47 0>; ++ }; ++}; + -+ force_pio Disable DMA support (default off) ++&mmc { ++ status = "okay"; ++ bus-width = <4>; ++}; + -+ pio_limit Number of blocks above which to use DMA -+ (default 1) ++&fb { ++ status = "okay"; ++}; + -+ debug Enable debug output (default off) ++/ { ++ __overrides__ { ++ act_led_gpio = <&act_led>,"gpios:4"; ++ act_led_activelow = <&act_led>,"gpios:8"; ++ act_led_trigger = <&act_led>,"linux,default-trigger"; + -+ poll_once Disable SDIO-device polling every second -+ (default on: polling once at boot-time) ++ audio = <&audio>,"status"; ++ watchdog = <&watchdog>,"status"; ++ random = <&random>,"status"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/Makefile b/arch/arm/boot/dts/overlays/Makefile +new file mode 100644 +index 0000000..0adb5b9 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/Makefile +@@ -0,0 +1,99 @@ ++ifeq ($(CONFIG_OF),y) + ++# Overlays for the Raspberry Pi platform + -+Name: smi -+Info: Enables the Secondary Memory Interface peripheral. Uses GPIOs 2-25! -+Load: dtoverlay=smi -+Params: <None> ++ifeq ($(CONFIG_ARCH_BCM2708),y) ++ RPI_DT_OVERLAYS=y ++endif ++ifeq ($(CONFIG_ARCH_BCM2709),y) ++ RPI_DT_OVERLAYS=y ++endif ++ifeq ($(CONFIG_ARCH_BCM2835),y) ++ RPI_DT_OVERLAYS=y ++endif + ++dtbo-$(RPI_DT_OVERLAYS) += adau1977-adc.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += ads7846.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += akkordion-iqdacplus.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += at86rf233.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += audioinjector-wm8731-audio.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += bmp085_i2c-sensor.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += dpi24.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += dwc2.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += dwc-otg.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += dht11.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += enc28j60.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += gpio-ir.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += gpio-poweroff.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += hifiberry-amp.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += hifiberry-dac.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += hifiberry-dacplus.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += hifiberry-digi.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += hy28a.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += hy28b.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += i2c-rtc.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += i2c-gpio.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += i2c-mux.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += i2c-pwm-pca9685a.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += i2c0-bcm2708.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += i2c1-bcm2708.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += i2s-gpio28-31.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += i2s-mmap.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += iqaudio-dac.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += iqaudio-dacplus.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += justboom-dac.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += justboom-digi.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += lirc-rpi.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += mcp2515-can0.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += mcp2515-can1.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += mmc.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += mz61581.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += pi3-act-led.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += pi3-disable-bt.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += pi3-miniuart-bt.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += piscreen.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += piscreen2r.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += pitft22.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += pitft28-capacitive.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += pitft28-resistive.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += pps-gpio.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += pwm.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += pwm-2chan.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += qca7000.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += raspidac3.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += rpi-backlight.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += rpi-dac.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += rpi-display.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += rpi-ft5406.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += rpi-proto.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += rpi-sense.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += rra-digidac1-wm8741-audio.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += sdhost.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += sdio.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += sdio-1bit.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += sdtweak.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += smi-dev.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += smi-nand.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += smi.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += spi1-1cs.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += spi1-2cs.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += spi1-3cs.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += spi2-1cs.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += spi2-2cs.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += spi2-3cs.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += spi-gpio35-39.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += tinylcd35.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += uart1.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += vc4-kms-v3d.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += vga666.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += w1-gpio.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += w1-gpio-pullup.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += wittypi.dtbo + -+Name: smi-dev -+Info: Enables the userspace interface for the SMI driver -+Load: dtoverlay=smi-dev -+Params: <None> ++targets += dtbs dtbs_install ++targets += $(dtbo-y) + ++endif + -+Name: smi-nand -+Info: Enables access to NAND flash via the SMI interface -+Load: dtoverlay=smi-nand -+Params: <None> ++always := $(dtbo-y) ++clean-files := *.dtbo +diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README +new file mode 100644 +index 0000000..1516cc2 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/README +@@ -0,0 +1,1161 @@ ++Introduction ++============ + ++This directory contains Device Tree overlays. Device Tree makes it possible ++to support many hardware configurations with a single kernel and without the ++need to explicitly load or blacklist kernel modules. Note that this isn't a ++"pure" Device Tree configuration (c.f. MACH_BCM2835) - some on-board devices ++are still configured by the board support code, but the intention is to ++eventually reach that goal. + -+Name: spi-gpio35-39 -+Info: move SPI function block to GPIO 35 to 39 -+Load: dtoverlay=spi-gpio35-39 -+Params: <None> ++On Raspberry Pi, Device Tree usage is controlled from /boot/config.txt. By ++default, the Raspberry Pi kernel boots with device tree enabled. You can ++completely disable DT usage (for now) by adding: + ++ device_tree= + -+Name: tinylcd35 -+Info: 3.5" Color TFT Display by www.tinylcd.com -+ Options: Touch, RTC, keypad -+Load: dtoverlay=tinylcd35,<param>=<val> -+Params: speed Display SPI bus speed ++to your config.txt, which should cause your Pi to revert to the old way of ++doing things after a reboot. + -+ rotate Display rotation {0,90,180,270} ++In /boot you will find a .dtb for each base platform. This describes the ++hardware that is part of the Raspberry Pi board. The loader (start.elf and its ++siblings) selects the .dtb file appropriate for the platform by name, and reads ++it into memory. At this point, all of the optional interfaces (i2c, i2s, spi) ++are disabled, but they can be enabled using Device Tree parameters: + -+ fps Delay between frame updates ++ dtparam=i2c=on,i2s=on,spi=on + -+ debug Debug output level {0-7} ++However, this shouldn't be necessary in many use cases because loading an ++overlay that requires one of those interfaces will cause it to be enabled ++automatically, and it is advisable to only enable interfaces if they are ++needed. + -+ touch Enable touch panel ++Configuring additional, optional hardware is done using Device Tree overlays ++(see below). + -+ touchgpio Touch controller IRQ GPIO ++raspi-config ++============ + -+ xohms Touchpanel: Resistance of X-plate in ohms ++The Advanced Options section of the raspi-config utility can enable and disable ++Device Tree use, as well as toggling the I2C and SPI interfaces. Note that it ++is possible to both enable an interface and blacklist the driver, if for some ++reason you should want to defer the loading. + -+ rtc-pcf PCF8563 Real Time Clock ++Modules ++======= + -+ rtc-ds DS1307 Real Time Clock ++As well as describing the hardware, Device Tree also gives enough information ++to allow suitable driver modules to be located and loaded, with the corollary ++that unneeded modules are not loaded. As a result it should be possible to ++remove lines from /etc/modules, and /etc/modprobe.d/raspi-blacklist.conf can ++have its contents deleted (or commented out). + -+ keypad Enable keypad ++Using Overlays ++============== + -+ Examples: -+ Display with touchpanel, PCF8563 RTC and keypad: -+ dtoverlay=tinylcd35,touch,rtc-pcf,keypad -+ Old touch display: -+ dtoverlay=tinylcd35,touch,touchgpio=3 ++Overlays are loaded using the "dtoverlay" directive. As an example, consider ++the popular lirc-rpi module, the Linux Infrared Remote Control driver. In the ++pre-DT world this would be loaded from /etc/modules, with an explicit ++"modprobe lirc-rpi" command, or programmatically by lircd. With DT enabled, ++this becomes a line in config.txt: + ++ dtoverlay=lirc-rpi + -+Name: uart1 -+Info: Enable uart1 in place of uart0 -+Load: dtoverlay=uart1,<param>=<val> -+Params: txd1_pin GPIO pin for TXD1 (14, 32 or 40 - default 14) ++This causes the file /boot/overlays/lirc-rpi-overlay.dtb to be loaded. By ++default it will use GPIOs 17 (out) and 18 (in), but this can be modified using ++DT parameters: + -+ rxd1_pin GPIO pin for RXD1 (15, 33 or 41 - default 15) ++ dtoverlay=lirc-rpi,gpio_out_pin=17,gpio_in_pin=13 + ++Parameters always have default values, although in some cases (e.g. "w1-gpio") ++it is necessary to provided multiple overlays in order to get the desired ++behaviour. See the list of overlays below for a description of the parameters ++and their defaults. + -+Name: vga666 -+Info: Overlay for the Fen Logic VGA666 board -+ This uses GPIOs 2-21 (so no I2C), and activates the output 2-3 seconds -+ after the kernel has started. -+Load: dtoverlay=vga666 -+Params: <None> ++The Overlay and Parameter Reference ++=================================== + ++N.B. When editing this file, please preserve the indentation levels to make it ++simple to parse programmatically. NO HARD TABS. + -+Name: w1-gpio -+Info: Configures the w1-gpio Onewire interface module. -+ Use this overlay if you *don't* need a GPIO to drive an external pullup. -+Load: dtoverlay=w1-gpio,<param>=<val> -+Params: gpiopin GPIO for I/O (default "4") + -+ pullup Non-zero, "on", or "y" to enable the parasitic -+ power (2-wire, power-on-data) feature ++Name: <The base DTB> ++Info: Configures the base Raspberry Pi hardware ++Load: <loaded automatically> ++Params: ++ audio Set to "on" to enable the onboard ALSA audio ++ interface (default "off") + ++ i2c_arm Set to "on" to enable the ARM's i2c interface ++ (default "off") + -+Name: w1-gpio-pullup -+Info: Configures the w1-gpio Onewire interface module. -+ Use this overlay if you *do* need a GPIO to drive an external pullup. -+Load: dtoverlay=w1-gpio-pullup,<param>=<val> -+Params: gpiopin GPIO for I/O (default "4") ++ i2c_vc Set to "on" to enable the i2c interface ++ usually reserved for the VideoCore processor ++ (default "off") + -+ pullup Non-zero, "on", or "y" to enable the parasitic -+ power (2-wire, power-on-data) feature ++ i2c An alias for i2c_arm + -+ extpullup GPIO for external pullup (default "5") ++ i2c_arm_baudrate Set the baudrate of the ARM's i2c interface ++ (default "100000") + ++ i2c_vc_baudrate Set the baudrate of the VideoCore i2c interface ++ (default "100000") + -+Troubleshooting -+=============== ++ i2c_baudrate An alias for i2c_arm_baudrate + -+If you are experiencing problems that you think are DT-related, enable DT -+diagnostic output by adding this to /boot/config.txt: ++ i2s Set to "on" to enable the i2s interface ++ (default "off") + -+ dtdebug=on ++ spi Set to "on" to enable the spi interfaces ++ (default "off") + -+and rebooting. Then run: ++ random Set to "on" to enable the hardware random ++ number generator (default "on") + -+ sudo vcdbg log msg ++ sd_overclock Clock (in MHz) to use when the MMC framework ++ requests 50MHz + -+and look for relevant messages. ++ sd_force_pio Disable DMA support for SD driver (default off) + -+Further reading -+=============== ++ sd_pio_limit Number of blocks above which to use DMA for ++ SD card (default 1) + -+This is only meant to be a quick introduction to the subject of Device Tree on -+Raspberry Pi. There is a more complete explanation here: ++ sd_debug Enable debug output from SD driver (default off) + -+http://www.raspberrypi.org/documentation/configuration/device-tree.md -diff --git a/arch/arm/boot/dts/overlays/ads7846-overlay.dts b/arch/arm/boot/dts/overlays/ads7846-overlay.dts -new file mode 100644 -index 0000000..6a92cd1 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/ads7846-overlay.dts -@@ -0,0 +1,83 @@ -+/* -+ * Generic Device Tree overlay for the ADS7846 touch controller -+ * -+ */ ++ uart0 Set to "off" to disable uart0 (default "on") + -+/dts-v1/; -+/plugin/; ++ uart1 Set to "on" or "off" to enable or disable uart1 ++ (default varies) + -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; ++ watchdog Set to "on" to enable the hardware watchdog ++ (default "off") + -+ fragment@0 { -+ target = <&spi0>; -+ __overlay__ { -+ status = "okay"; ++ act_led_trigger Choose which activity the LED tracks. ++ Use "heartbeat" for a nice load indicator. ++ (default "mmc") + -+ spidev@0{ -+ status = "disabled"; -+ }; ++ act_led_activelow Set to "on" to invert the sense of the LED ++ (default "off") ++ N.B. For Pi3 see pi3-act-led overlay. + -+ spidev@1{ -+ status = "disabled"; -+ }; -+ }; -+ }; ++ act_led_gpio Set which GPIO to use for the activity LED ++ (in case you want to connect it to an external ++ device) ++ (default "16" on a non-Plus board, "47" on a ++ Plus or Pi 2) ++ N.B. For Pi3 see pi3-act-led overlay. + -+ fragment@1 { -+ target = <&gpio>; -+ __overlay__ { -+ ads7846_pins: ads7846_pins { -+ brcm,pins = <255>; /* illegal default value */ -+ brcm,function = <0>; /* in */ -+ brcm,pull = <0>; /* none */ -+ }; -+ }; -+ }; ++ pwr_led_trigger ++ pwr_led_activelow ++ pwr_led_gpio ++ As for act_led_*, but using the PWR LED. ++ Not available on Model A/B boards. + -+ fragment@2 { -+ target = <&spi0>; -+ __overlay__ { -+ /* needed to avoid dtc warning */ -+ #address-cells = <1>; -+ #size-cells = <0>; ++ N.B. It is recommended to only enable those interfaces that are needed. ++ Leaving all interfaces enabled can lead to unwanted behaviour (i2c_vc ++ interfering with Pi Camera, I2S and SPI hogging GPIO pins, etc.) ++ Note also that i2c, i2c_arm and i2c_vc are aliases for the physical ++ interfaces i2c0 and i2c1. Use of the numeric variants is still possible ++ but deprecated because the ARM/VC assignments differ between board ++ revisions. The same board-specific mapping applies to i2c_baudrate, ++ and the other i2c baudrate parameters. + -+ ads7846: ads7846@1 { -+ compatible = "ti,ads7846"; -+ reg = <1>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&ads7846_pins>; + -+ spi-max-frequency = <2000000>; -+ interrupts = <255 2>; /* high-to-low edge triggered */ -+ interrupt-parent = <&gpio>; -+ pendown-gpio = <&gpio 255 0>; ++Name: adau1977-adc ++Info: Overlay for activation of ADAU1977 ADC codec over I2C for control ++ and I2S for data. ++Load: dtoverlay=adau1977-adc ++Params: <None> + -+ /* driver defaults */ -+ ti,x-min = /bits/ 16 <0>; -+ ti,y-min = /bits/ 16 <0>; -+ ti,x-max = /bits/ 16 <0x0FFF>; -+ ti,y-max = /bits/ 16 <0x0FFF>; -+ ti,pressure-min = /bits/ 16 <0>; -+ ti,pressure-max = /bits/ 16 <0xFFFF>; -+ ti,x-plate-ohms = /bits/ 16 <400>; -+ }; -+ }; -+ }; -+ __overrides__ { -+ cs = <&ads7846>,"reg:0"; -+ speed = <&ads7846>,"spi-max-frequency:0"; -+ penirq = <&ads7846_pins>,"brcm,pins:0", /* REQUIRED */ -+ <&ads7846>,"interrupts:0", -+ <&ads7846>,"pendown-gpio:4"; -+ penirq_pull = <&ads7846_pins>,"brcm,pull:0"; -+ swapxy = <&ads7846>,"ti,swap-xy?"; -+ xmin = <&ads7846>,"ti,x-min;0"; -+ ymin = <&ads7846>,"ti,y-min;0"; -+ xmax = <&ads7846>,"ti,x-max;0"; -+ ymax = <&ads7846>,"ti,y-max;0"; -+ pmin = <&ads7846>,"ti,pressure-min;0"; -+ pmax = <&ads7846>,"ti,pressure-max;0"; -+ xohms = <&ads7846>,"ti,x-plate-ohms;0"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/bmp085_i2c-sensor-overlay.dts b/arch/arm/boot/dts/overlays/bmp085_i2c-sensor-overlay.dts -new file mode 100644 -index 0000000..782b171 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/bmp085_i2c-sensor-overlay.dts -@@ -0,0 +1,23 @@ -+// Definitions for BMP085/BMP180 digital barometric pressure and temperature sensors from Bosch Sensortec -+/dts-v1/; -+/plugin/; + -+/ { -+ compatible = "brcm,bcm2708"; ++Name: ads7846 ++Info: ADS7846 Touch controller ++Load: dtoverlay=ads7846,<param>=<val> ++Params: cs SPI bus Chip Select (default 1) ++ speed SPI bus speed (default 2MHz, max 3.25MHz) ++ penirq GPIO used for PENIRQ. REQUIRED ++ penirq_pull Set GPIO pull (default 0=none, 2=pullup) ++ swapxy Swap x and y axis ++ xmin Minimum value on the X axis (default 0) ++ ymin Minimum value on the Y axis (default 0) ++ xmax Maximum value on the X axis (default 4095) ++ ymax Maximum value on the Y axis (default 4095) ++ pmin Minimum reported pressure value (default 0) ++ pmax Maximum reported pressure value (default 65535) ++ xohms Touchpanel sensitivity (X-plate resistance) ++ (default 400) + -+ fragment@0 { -+ target = <&i2c_arm>; -+ __overlay__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; ++ penirq is required and usually xohms (60-100) has to be set as well. ++ Apart from that, pmax (255) and swapxy are also common. ++ The rest of the calibration can be done with xinput-calibrator. ++ See: github.com/notro/fbtft/wiki/FBTFT-on-Raspian ++ Device Tree binding document: ++ www.kernel.org/doc/Documentation/devicetree/bindings/input/ads7846.txt + -+ bmp085@77 { -+ compatible = "bosch,bmp085"; -+ reg = <0x77>; -+ default-oversampling = <3>; -+ status = "okay"; -+ }; -+ }; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/dht11-overlay.dts b/arch/arm/boot/dts/overlays/dht11-overlay.dts -new file mode 100644 -index 0000000..9bf67fd ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/dht11-overlay.dts -@@ -0,0 +1,39 @@ -+/* -+ * Overlay for the DHT11/21/22 humidity/temperature sensor modules. -+ */ -+/dts-v1/; -+/plugin/; + -+/ { -+ compatible = "brcm,bcm2708"; ++Name: akkordion-iqdacplus ++Info: Configures the Digital Dreamtime Akkordion Music Player (based on the ++ OEM IQAudIO DAC+ or DAC Zero module). ++Load: dtoverlay=akkordion-iqdacplus,<param>=<val> ++Params: 24db_digital_gain Allow gain to be applied via the PCM512x codec ++ Digital volume control. Enable with ++ dtoverlay=akkordion-iqdacplus,24db_digital_gain ++ (The default behaviour is that the Digital ++ volume control is limited to a maximum of ++ 0dB. ie. it can attenuate but not provide ++ gain. For most users, this will be desired ++ as it will prevent clipping. By appending ++ the 24db_digital_gain parameter, the Digital ++ volume control will allow up to 24dB of ++ gain. If this parameter is enabled, it is the ++ responsibility of the user to ensure that ++ the Digital volume control is set to a value ++ that does not result in clipping/distortion!) + -+ fragment@0 { -+ target-path = "/"; -+ __overlay__ { + -+ dht11: dht11@0 { -+ compatible = "dht11"; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&dht11_pins>; -+ gpios = <&gpio 4 0>; -+ status = "okay"; -+ }; -+ }; -+ }; ++Name: at86rf233 ++Info: Configures the Atmel AT86RF233 802.15.4 low-power WPAN transceiver, ++ connected to spi0.0 ++Load: dtoverlay=at86rf233,<param>=<val> ++Params: interrupt GPIO used for INT (default 23) ++ reset GPIO used for Reset (default 24) ++ sleep GPIO used for Sleep (default 25) ++ speed SPI bus speed in Hz (default 3000000) ++ trim Fine tuning of the internal capacitance ++ arrays (0=+0pF, 15=+4.5pF, default 15) + -+ fragment@1 { -+ target = <&gpio>; -+ __overlay__ { -+ dht11_pins: dht11_pins { -+ brcm,pins = <4>; -+ brcm,function = <0>; // in -+ brcm,pull = <0>; // off -+ }; -+ }; -+ }; + -+ __overrides__ { -+ gpiopin = <&dht11_pins>,"brcm,pins:0", -+ <&dht11>,"gpios:4"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/enc28j60-overlay.dts b/arch/arm/boot/dts/overlays/enc28j60-overlay.dts -new file mode 100644 -index 0000000..8fae869 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/enc28j60-overlay.dts -@@ -0,0 +1,50 @@ -+// Overlay for the Microchip ENC28J60 Ethernet Controller -+/dts-v1/; -+/plugin/; ++Name: audioinjector-wm8731-audio ++Info: Configures the audioinjector.net audio add on soundcard ++Load: dtoverlay=audioinjector-wm8731-audio ++Params: <None> + -+/ { -+ compatible = "brcm,bcm2708"; + -+ fragment@0 { -+ target = <&spi0>; -+ __overlay__ { -+ /* needed to avoid dtc warning */ -+ #address-cells = <1>; -+ #size-cells = <0>; ++Name: bmp085_i2c-sensor ++Info: Configures the BMP085/BMP180 digital barometric pressure and temperature ++ sensors from Bosch Sensortec ++Load: dtoverlay=bmp085_i2c-sensor ++Params: <None> + -+ status = "okay"; + -+ spidev@0{ -+ status = "disabled"; -+ }; ++Name: dht11 ++Info: Overlay for the DHT11/DHT21/DHT22 humidity/temperature sensors ++ Also sometimes found with the part number(s) AM230x. ++Load: dtoverlay=dht11,<param>=<val> ++Params: gpiopin GPIO connected to the sensor's DATA output. ++ (default 4) + -+ eth1: enc28j60@0{ -+ compatible = "microchip,enc28j60"; -+ reg = <0>; /* CE0 */ -+ pinctrl-names = "default"; -+ pinctrl-0 = <&eth1_pins>; -+ interrupt-parent = <&gpio>; -+ interrupts = <25 0x2>; /* falling edge */ -+ spi-max-frequency = <12000000>; -+ status = "okay"; -+ }; -+ }; -+ }; + -+ fragment@1 { -+ target = <&gpio>; -+ __overlay__ { -+ eth1_pins: eth1_pins { -+ brcm,pins = <25>; -+ brcm,function = <0>; /* in */ -+ brcm,pull = <0>; /* none */ -+ }; -+ }; -+ }; ++Name: dpi24 ++Info: Overlay for a generic 24-bit DPI display ++ This uses GPIOs 0-27 (so no I2C, uart etc.), and activates the output ++ 2-3 seconds after the kernel has started. ++Load: dtoverlay=dpi24 ++Params: <None> + -+ __overrides__ { -+ int_pin = <&eth1>, "interrupts:0", -+ <&eth1_pins>, "brcm,pins:0"; -+ speed = <&eth1>, "spi-max-frequency:0"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/gpio-poweroff-overlay.dts b/arch/arm/boot/dts/overlays/gpio-poweroff-overlay.dts -new file mode 100644 -index 0000000..ff8cb36 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/gpio-poweroff-overlay.dts -@@ -0,0 +1,34 @@ -+// Definitions for gpio-poweroff module -+/dts-v1/; -+/plugin/; + -+/ { -+ compatible = "brcm,bcm2708"; ++Name: dwc-otg ++Info: Selects the dwc_otg USB controller driver which has fiq support. This ++ is the default on all except the Pi Zero which defaults to dwc2. ++Load: dtoverlay=dwc-otg ++Params: <None> + -+ fragment@0 { -+ target-path = "/"; -+ __overlay__ { -+ power_ctrl: power_ctrl { -+ compatible = "gpio-poweroff"; -+ gpios = <&gpio 26 0>; -+ force; -+ }; -+ }; -+ }; + -+ fragment@1 { -+ target = <&gpio>; -+ __overlay__ { -+ power_ctrl_pins: power_ctrl_pins { -+ brcm,pins = <26>; -+ brcm,function = <1>; // out -+ }; -+ }; -+ }; ++Name: dwc2 ++Info: Selects the dwc2 USB controller driver ++Load: dtoverlay=dwc2,<param>=<val> ++Params: dr_mode Dual role mode: "host", "peripheral" or "otg" + -+ __overrides__ { -+ gpiopin = <&power_ctrl>,"gpios:4", -+ <&power_ctrl_pins>,"brcm,pins:0"; -+ active_low = <&power_ctrl>,"gpios:8"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/hifiberry-amp-overlay.dts b/arch/arm/boot/dts/overlays/hifiberry-amp-overlay.dts -new file mode 100644 -index 0000000..2c81448 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/hifiberry-amp-overlay.dts -@@ -0,0 +1,39 @@ -+// Definitions for HiFiBerry Amp/Amp+ -+/dts-v1/; -+/plugin/; ++ g-rx-fifo-size Size of rx fifo size in gadget mode + -+/ { -+ compatible = "brcm,bcm2708"; ++ g-np-tx-fifo-size Size of non-periodic tx fifo size in gadget ++ mode + -+ fragment@0 { -+ target = <&sound>; -+ __overlay__ { -+ compatible = "hifiberry,hifiberry-amp"; -+ i2s-controller = <&i2s>; -+ status = "okay"; -+ }; -+ }; ++ g-tx-fifo-size Size of periodic tx fifo per endpoint ++ (except ep0) in gadget mode + -+ fragment@1 { -+ target = <&i2s>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; + -+ fragment@2 { -+ target = <&i2c1>; -+ __overlay__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; ++[ The ds1307-rtc overlay has been deleted. See i2c-rtc. ] + -+ tas5713@1b { -+ #sound-dai-cells = <0>; -+ compatible = "ti,tas5713"; -+ reg = <0x1b>; -+ status = "okay"; -+ }; -+ }; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/hifiberry-dac-overlay.dts b/arch/arm/boot/dts/overlays/hifiberry-dac-overlay.dts -new file mode 100644 -index 0000000..5e7633ae ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/hifiberry-dac-overlay.dts -@@ -0,0 +1,34 @@ -+// Definitions for HiFiBerry DAC -+/dts-v1/; -+/plugin/; + -+/ { -+ compatible = "brcm,bcm2708"; ++Name: enc28j60 ++Info: Overlay for the Microchip ENC28J60 Ethernet Controller (SPI) ++Load: dtoverlay=enc28j60,<param>=<val> ++Params: int_pin GPIO used for INT (default 25) + -+ fragment@0 { -+ target = <&sound>; -+ __overlay__ { -+ compatible = "hifiberry,hifiberry-dac"; -+ i2s-controller = <&i2s>; -+ status = "okay"; -+ }; -+ }; ++ speed SPI bus speed (default 12000000) + -+ fragment@1 { -+ target = <&i2s>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; + -+ fragment@2 { -+ target-path = "/"; -+ __overlay__ { -+ pcm5102a-codec { -+ #sound-dai-cells = <0>; -+ compatible = "ti,pcm5102a"; -+ status = "okay"; -+ }; -+ }; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts b/arch/arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts -new file mode 100644 -index 0000000..deb9c625 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts -@@ -0,0 +1,39 @@ -+// Definitions for HiFiBerry DAC+ -+/dts-v1/; -+/plugin/; ++Name: gpio-ir ++Info: Use GPIO pin as rc-core style infrared receiver input. The rc-core- ++ based gpio_ir_recv driver maps received keys directly to a ++ /dev/input/event* device, all decoding is done by the kernel - LIRC is ++ not required! The key mapping and other decoding parameters can be ++ configured by "ir-keytable" tool. ++Load: dtoverlay=gpio-ir,<param>=<val> ++Params: gpio_pin Input pin number. Default is 18. + -+/ { -+ compatible = "brcm,bcm2708"; ++ gpio_pull Desired pull-up/down state (off, down, up) ++ Default is "down". + -+ fragment@0 { -+ target = <&sound>; -+ __overlay__ { -+ compatible = "hifiberry,hifiberry-dacplus"; -+ i2s-controller = <&i2s>; -+ status = "okay"; -+ }; -+ }; ++ rc-map-name Default rc keymap (can also be changed by ++ ir-keytable), defaults to "rc-rc6-mce" + -+ fragment@1 { -+ target = <&i2s>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; + -+ fragment@2 { -+ target = <&i2c1>; -+ __overlay__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; ++Name: gpio-poweroff ++Info: Drives a GPIO high or low on reboot ++Load: dtoverlay=gpio-poweroff,<param>=<val> ++Params: gpiopin GPIO for signalling (default 26) + -+ pcm5122@4d { -+ #sound-dai-cells = <0>; -+ compatible = "ti,pcm5122"; -+ reg = <0x4d>; -+ status = "okay"; -+ }; -+ }; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/hifiberry-digi-overlay.dts b/arch/arm/boot/dts/overlays/hifiberry-digi-overlay.dts -new file mode 100644 -index 0000000..d0e0d8a ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/hifiberry-digi-overlay.dts -@@ -0,0 +1,39 @@ -+// Definitions for HiFiBerry Digi -+/dts-v1/; -+/plugin/; ++ active_low Set if the power control device requires a ++ high->low transition to trigger a power-down. ++ Note that this will require the support of a ++ custom dt-blob.bin to prevent a power-down ++ during the boot process, and that a reboot ++ will also cause the pin to go low. + -+/ { -+ compatible = "brcm,bcm2708"; + -+ fragment@0 { -+ target = <&sound>; -+ __overlay__ { -+ compatible = "hifiberry,hifiberry-digi"; -+ i2s-controller = <&i2s>; -+ status = "okay"; -+ }; -+ }; ++Name: hifiberry-amp ++Info: Configures the HifiBerry Amp and Amp+ audio cards ++Load: dtoverlay=hifiberry-amp ++Params: <None> + -+ fragment@1 { -+ target = <&i2s>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; + -+ fragment@2 { -+ target = <&i2c1>; -+ __overlay__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; ++Name: hifiberry-dac ++Info: Configures the HifiBerry DAC audio card ++Load: dtoverlay=hifiberry-dac ++Params: <None> + -+ wm8804@3b { -+ #sound-dai-cells = <0>; -+ compatible = "wlf,wm8804"; -+ reg = <0x3b>; -+ status = "okay"; -+ }; -+ }; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/hy28a-overlay.dts b/arch/arm/boot/dts/overlays/hy28a-overlay.dts -new file mode 100644 -index 0000000..3cd3083 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/hy28a-overlay.dts -@@ -0,0 +1,87 @@ -+/* -+ * Device Tree overlay for HY28A display -+ * -+ */ + -+/dts-v1/; -+/plugin/; ++Name: hifiberry-dacplus ++Info: Configures the HifiBerry DAC+ audio card ++Load: dtoverlay=hifiberry-dacplus,<param>=<val> ++Params: 24db_digital_gain Allow gain to be applied via the PCM512x codec ++ Digital volume control. Enable with ++ "dtoverlay=hifiberry-dacplus,24db_digital_gain" ++ (The default behaviour is that the Digital ++ volume control is limited to a maximum of ++ 0dB. ie. it can attenuate but not provide ++ gain. For most users, this will be desired ++ as it will prevent clipping. By appending ++ the 24dB_digital_gain parameter, the Digital ++ volume control will allow up to 24dB of ++ gain. If this parameter is enabled, it is the ++ responsibility of the user to ensure that ++ the Digital volume control is set to a value ++ that does not result in clipping/distortion!) ++ slave Force DAC+ Pro into slave mode, using Pi as ++ master for bit clock and frame clock. + -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; + -+ fragment@0 { -+ target = <&spi0>; -+ __overlay__ { -+ status = "okay"; ++Name: hifiberry-digi ++Info: Configures the HifiBerry Digi audio card ++Load: dtoverlay=hifiberry-digi ++Params: <None> + -+ spidev@0{ -+ status = "disabled"; -+ }; + -+ spidev@1{ -+ status = "disabled"; -+ }; -+ }; -+ }; ++Name: hy28a ++Info: HY28A - 2.8" TFT LCD Display Module by HAOYU Electronics ++ Default values match Texy's display shield ++Load: dtoverlay=hy28a,<param>=<val> ++Params: speed Display SPI bus speed + -+ fragment@1 { -+ target = <&gpio>; -+ __overlay__ { -+ hy28a_pins: hy28a_pins { -+ brcm,pins = <17 25 18>; -+ brcm,function = <0 1 1>; /* in out out */ -+ }; -+ }; -+ }; ++ rotate Display rotation {0,90,180,270} + -+ fragment@2 { -+ target = <&spi0>; -+ __overlay__ { -+ /* needed to avoid dtc warning */ -+ #address-cells = <1>; -+ #size-cells = <0>; ++ fps Delay between frame updates + -+ hy28a: hy28a@0{ -+ compatible = "ilitek,ili9320"; -+ reg = <0>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&hy28a_pins>; ++ debug Debug output level {0-7} + -+ spi-max-frequency = <32000000>; -+ spi-cpol; -+ spi-cpha; -+ rotate = <270>; -+ bgr; -+ fps = <50>; -+ buswidth = <8>; -+ startbyte = <0x70>; -+ reset-gpios = <&gpio 25 0>; -+ led-gpios = <&gpio 18 1>; -+ debug = <0>; -+ }; ++ xohms Touchpanel sensitivity (X-plate resistance) + -+ hy28a_ts: hy28a-ts@1 { -+ compatible = "ti,ads7846"; -+ reg = <1>; ++ resetgpio GPIO used to reset controller + -+ spi-max-frequency = <2000000>; -+ interrupts = <17 2>; /* high-to-low edge triggered */ -+ interrupt-parent = <&gpio>; -+ pendown-gpio = <&gpio 17 0>; -+ ti,x-plate-ohms = /bits/ 16 <100>; -+ ti,pressure-max = /bits/ 16 <255>; -+ }; -+ }; -+ }; -+ __overrides__ { -+ speed = <&hy28a>,"spi-max-frequency:0"; -+ rotate = <&hy28a>,"rotate:0"; -+ fps = <&hy28a>,"fps:0"; -+ debug = <&hy28a>,"debug:0"; -+ xohms = <&hy28a_ts>,"ti,x-plate-ohms;0"; -+ resetgpio = <&hy28a>,"reset-gpios:4", -+ <&hy28a_pins>, "brcm,pins:1"; -+ ledgpio = <&hy28a>,"led-gpios:4", -+ <&hy28a_pins>, "brcm,pins:2"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/hy28b-overlay.dts b/arch/arm/boot/dts/overlays/hy28b-overlay.dts -new file mode 100644 -index 0000000..f774c4a ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/hy28b-overlay.dts -@@ -0,0 +1,142 @@ -+/* -+ * Device Tree overlay for HY28b display shield by Texy -+ * -+ */ ++ ledgpio GPIO used to control backlight + -+/dts-v1/; -+/plugin/; + -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; ++Name: hy28b ++Info: HY28B - 2.8" TFT LCD Display Module by HAOYU Electronics ++ Default values match Texy's display shield ++Load: dtoverlay=hy28b,<param>=<val> ++Params: speed Display SPI bus speed + -+ fragment@0 { -+ target = <&spi0>; -+ __overlay__ { -+ status = "okay"; ++ rotate Display rotation {0,90,180,270} + -+ spidev@0{ -+ status = "disabled"; -+ }; ++ fps Delay between frame updates + -+ spidev@1{ -+ status = "disabled"; -+ }; -+ }; -+ }; ++ debug Debug output level {0-7} + -+ fragment@1 { -+ target = <&gpio>; -+ __overlay__ { -+ hy28b_pins: hy28b_pins { -+ brcm,pins = <17 25 18>; -+ brcm,function = <0 1 1>; /* in out out */ -+ }; -+ }; -+ }; ++ xohms Touchpanel sensitivity (X-plate resistance) + -+ fragment@2 { -+ target = <&spi0>; -+ __overlay__ { -+ /* needed to avoid dtc warning */ -+ #address-cells = <1>; -+ #size-cells = <0>; ++ resetgpio GPIO used to reset controller + -+ hy28b: hy28b@0{ -+ compatible = "ilitek,ili9325"; -+ reg = <0>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&hy28b_pins>; ++ ledgpio GPIO used to control backlight + -+ spi-max-frequency = <48000000>; -+ spi-cpol; -+ spi-cpha; -+ rotate = <270>; -+ bgr; -+ fps = <50>; -+ buswidth = <8>; -+ startbyte = <0x70>; -+ reset-gpios = <&gpio 25 0>; -+ led-gpios = <&gpio 18 1>; + -+ gamma = "04 1F 4 7 7 0 7 7 6 0\n0F 00 1 7 4 0 0 0 6 7"; ++Name: i2c-gpio ++Info: Adds support for software i2c controller on gpio pins ++Load: dtoverlay=i2c-gpio,<param>=<val> ++Params: i2c_gpio_sda GPIO used for I2C data (default "23") + -+ init = <0x10000e7 0x0010 -+ 0x1000000 0x0001 -+ 0x1000001 0x0100 -+ 0x1000002 0x0700 -+ 0x1000003 0x1030 -+ 0x1000004 0x0000 -+ 0x1000008 0x0207 -+ 0x1000009 0x0000 -+ 0x100000a 0x0000 -+ 0x100000c 0x0001 -+ 0x100000d 0x0000 -+ 0x100000f 0x0000 -+ 0x1000010 0x0000 -+ 0x1000011 0x0007 -+ 0x1000012 0x0000 -+ 0x1000013 0x0000 -+ 0x2000032 -+ 0x1000010 0x1590 -+ 0x1000011 0x0227 -+ 0x2000032 -+ 0x1000012 0x009c -+ 0x2000032 -+ 0x1000013 0x1900 -+ 0x1000029 0x0023 -+ 0x100002b 0x000e -+ 0x2000032 -+ 0x1000020 0x0000 -+ 0x1000021 0x0000 -+ 0x2000032 -+ 0x1000050 0x0000 -+ 0x1000051 0x00ef -+ 0x1000052 0x0000 -+ 0x1000053 0x013f -+ 0x1000060 0xa700 -+ 0x1000061 0x0001 -+ 0x100006a 0x0000 -+ 0x1000080 0x0000 -+ 0x1000081 0x0000 -+ 0x1000082 0x0000 -+ 0x1000083 0x0000 -+ 0x1000084 0x0000 -+ 0x1000085 0x0000 -+ 0x1000090 0x0010 -+ 0x1000092 0x0000 -+ 0x1000093 0x0003 -+ 0x1000095 0x0110 -+ 0x1000097 0x0000 -+ 0x1000098 0x0000 -+ 0x1000007 0x0133 -+ 0x1000020 0x0000 -+ 0x1000021 0x0000 -+ 0x2000064>; -+ debug = <0>; -+ }; ++ i2c_gpio_scl GPIO used for I2C clock (default "24") + -+ hy28b_ts: hy28b-ts@1 { -+ compatible = "ti,ads7846"; -+ reg = <1>; ++ i2c_gpio_delay_us Clock delay in microseconds ++ (default "2" = ~100kHz) + -+ spi-max-frequency = <2000000>; -+ interrupts = <17 2>; /* high-to-low edge triggered */ -+ interrupt-parent = <&gpio>; -+ pendown-gpio = <&gpio 17 0>; -+ ti,x-plate-ohms = /bits/ 16 <100>; -+ ti,pressure-max = /bits/ 16 <255>; -+ }; -+ }; -+ }; -+ __overrides__ { -+ speed = <&hy28b>,"spi-max-frequency:0"; -+ rotate = <&hy28b>,"rotate:0"; -+ fps = <&hy28b>,"fps:0"; -+ debug = <&hy28b>,"debug:0"; -+ xohms = <&hy28b_ts>,"ti,x-plate-ohms;0"; -+ resetgpio = <&hy28b>,"reset-gpios:4", -+ <&hy28b_pins>, "brcm,pins:1"; -+ ledgpio = <&hy28b>,"led-gpios:4", -+ <&hy28b_pins>, "brcm,pins:2"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts b/arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts -new file mode 100644 -index 0000000..fed4bd8 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts -@@ -0,0 +1,55 @@ -+// Definitions for several I2C based Real Time Clocks -+/dts-v1/; -+/plugin/; + -+/ { -+ compatible = "brcm,bcm2708"; ++Name: i2c-mux ++Info: Adds support for a number of I2C bus multiplexers on i2c_arm ++Load: dtoverlay=i2c-mux,<param>=<val> ++Params: pca9542 Select the NXP PCA9542 device + -+ fragment@0 { -+ target = <&i2c_arm>; -+ __overlay__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; ++ pca9545 Select the NXP PCA9545 device + -+ ds1307: ds1307@68 { -+ compatible = "maxim,ds1307"; -+ reg = <0x68>; -+ status = "disable"; -+ }; -+ mcp7941x: mcp7941x@6f { -+ compatible = "microchip,mcp7941x"; -+ reg = <0x6f>; -+ status = "disable"; -+ }; -+ ds3231: ds3231@68 { -+ compatible = "maxim,ds3231"; -+ reg = <0x68>; -+ status = "disable"; -+ }; -+ pcf2127: pcf2127@51 { -+ compatible = "nxp,pcf2127"; -+ reg = <0x51>; -+ status = "disable"; -+ }; -+ pcf8523: pcf8523@68 { -+ compatible = "nxp,pcf8523"; -+ reg = <0x68>; -+ status = "disable"; -+ }; -+ pcf8563: pcf8563@51 { -+ compatible = "nxp,pcf8563"; -+ reg = <0x51>; -+ status = "disable"; -+ }; -+ }; -+ }; -+ __overrides__ { -+ ds1307 = <&ds1307>,"status"; -+ ds3231 = <&ds3231>,"status"; -+ mcp7941x = <&mcp7941x>,"status"; -+ pcf2127 = <&pcf2127>,"status"; -+ pcf8523 = <&pcf8523>,"status"; -+ pcf8563 = <&pcf8563>,"status"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/i2s-mmap-overlay.dts b/arch/arm/boot/dts/overlays/i2s-mmap-overlay.dts -new file mode 100644 -index 0000000..a11160a ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/i2s-mmap-overlay.dts -@@ -0,0 +1,13 @@ -+/dts-v1/; -+/plugin/; ++ pca9548 Select the NXP PCA9548 device + -+/{ -+ compatible = "brcm,bcm2708"; ++ addr Change I2C address of the device (default 0x70) + -+ fragment@0 { -+ target = <&i2s>; -+ __overlay__ { -+ brcm,enable-mmap; -+ }; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/iqaudio-dac-overlay.dts b/arch/arm/boot/dts/overlays/iqaudio-dac-overlay.dts -new file mode 100644 -index 0000000..ea8173e ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/iqaudio-dac-overlay.dts -@@ -0,0 +1,39 @@ -+// Definitions for IQaudIO DAC -+/dts-v1/; -+/plugin/; + -+/ { -+ compatible = "brcm,bcm2708"; ++[ The i2c-mux-pca9548a overlay has been deleted. See i2c-mux. ] + -+ fragment@0 { -+ target = <&sound>; -+ __overlay__ { -+ compatible = "iqaudio,iqaudio-dac"; -+ i2s-controller = <&i2s>; -+ status = "okay"; -+ }; -+ }; + -+ fragment@1 { -+ target = <&i2s>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; ++Name: i2c-pwm-pca9685a ++Info: Adds support for an NXP PCA9685A I2C PWM controller on i2c_arm ++Load: dtoverlay=i2c-pwm-pca9685a,<param>=<val> ++Params: addr I2C address of PCA9685A (default 0x40) + -+ fragment@2 { -+ target = <&i2c1>; -+ __overlay__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; + -+ pcm5122@4c { -+ #sound-dai-cells = <0>; -+ compatible = "ti,pcm5122"; -+ reg = <0x4c>; -+ status = "okay"; -+ }; -+ }; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/iqaudio-dacplus-overlay.dts b/arch/arm/boot/dts/overlays/iqaudio-dacplus-overlay.dts -new file mode 100644 -index 0000000..735d8ab ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/iqaudio-dacplus-overlay.dts -@@ -0,0 +1,39 @@ -+// Definitions for IQaudIO DAC+ -+/dts-v1/; -+/plugin/; ++Name: i2c-rtc ++Info: Adds support for a number of I2C Real Time Clock devices ++Load: dtoverlay=i2c-rtc,<param>=<val> ++Params: ds1307 Select the DS1307 device + -+/ { -+ compatible = "brcm,bcm2708"; ++ ds1339 Select the DS1339 device + -+ fragment@0 { -+ target = <&sound>; -+ __overlay__ { -+ compatible = "iqaudio,iqaudio-dac"; -+ i2s-controller = <&i2s>; -+ status = "okay"; -+ }; -+ }; ++ ds3231 Select the DS3231 device + -+ fragment@1 { -+ target = <&i2s>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; ++ mcp7940x Select the MCP7940x device + -+ fragment@2 { -+ target = <&i2c1>; -+ __overlay__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; ++ mcp7941x Select the MCP7941x device + -+ pcm5122@4c { -+ #sound-dai-cells = <0>; -+ compatible = "ti,pcm5122"; -+ reg = <0x4c>; -+ status = "okay"; -+ }; -+ }; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/lirc-rpi-overlay.dts b/arch/arm/boot/dts/overlays/lirc-rpi-overlay.dts -new file mode 100644 -index 0000000..7d5d82b ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/lirc-rpi-overlay.dts -@@ -0,0 +1,57 @@ -+// Definitions for lirc-rpi module -+/dts-v1/; -+/plugin/; ++ pcf2127 Select the PCF2127 device + -+/ { -+ compatible = "brcm,bcm2708"; ++ pcf8523 Select the PCF8523 device + -+ fragment@0 { -+ target-path = "/"; -+ __overlay__ { -+ lirc_rpi: lirc_rpi { -+ compatible = "rpi,lirc-rpi"; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&lirc_pins>; -+ status = "okay"; ++ pcf8563 Select the PCF8563 device + -+ // Override autodetection of IR receiver circuit -+ // (0 = active high, 1 = active low, -1 = no override ) -+ rpi,sense = <0xffffffff>; ++ trickle-resistor-ohms Resistor value for trickle charge (DS1339-only) + -+ // Software carrier -+ // (0 = off, 1 = on) -+ rpi,softcarrier = <1>; + -+ // Invert output -+ // (0 = off, 1 = on) -+ rpi,invert = <0>; ++Name: i2c0-bcm2708 ++Info: Enable the i2c_bcm2708 driver for the i2c0 bus. Not all pin combinations ++ are usable on all platforms. ++Load: dtoverlay=i2c0-bcm2708,<param>=<val> ++Params: sda0_pin GPIO pin for SDA0 (deprecated - use pins_*) ++ scl0_pin GPIO pin for SCL0 (deprecated - use pins_*) ++ pins_0_1 Use pins 0 and 1 (default) ++ pins_28_29 Use pins 28 and 29 ++ pins_44_45 Use pins 44 and 45 ++ pins_46_47 Use pins 46 and 47 + -+ // Enable debugging messages -+ // (0 = off, 1 = on) -+ rpi,debug = <0>; -+ }; -+ }; -+ }; + -+ fragment@1 { -+ target = <&gpio>; -+ __overlay__ { -+ lirc_pins: lirc_pins { -+ brcm,pins = <17 18>; -+ brcm,function = <1 0>; // out in -+ brcm,pull = <0 1>; // off down -+ }; -+ }; -+ }; ++Name: i2c1-bcm2708 ++Info: Enable the i2c_bcm2708 driver for the i2c1 bus ++Load: dtoverlay=i2c1-bcm2708,<param>=<val> ++Params: sda1_pin GPIO pin for SDA1 (2 or 44 - default 2) ++ scl1_pin GPIO pin for SCL1 (3 or 45 - default 3) ++ pin_func Alternative pin function (4 (alt0), 6 (alt2) - ++ default 4) + -+ __overrides__ { -+ gpio_out_pin = <&lirc_pins>,"brcm,pins:0"; -+ gpio_in_pin = <&lirc_pins>,"brcm,pins:4"; -+ gpio_in_pull = <&lirc_pins>,"brcm,pull:4"; + -+ sense = <&lirc_rpi>,"rpi,sense:0"; -+ softcarrier = <&lirc_rpi>,"rpi,softcarrier:0"; -+ invert = <&lirc_rpi>,"rpi,invert:0"; -+ debug = <&lirc_rpi>,"rpi,debug:0"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/mcp2515-can0-overlay.dts b/arch/arm/boot/dts/overlays/mcp2515-can0-overlay.dts -new file mode 100755 -index 0000000..398d59c ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/mcp2515-can0-overlay.dts -@@ -0,0 +1,69 @@ -+/* -+ * Device tree overlay for mcp251x/can0 on spi0.0 -+ */ ++Name: i2s-gpio28-31 ++Info: move I2S function block to GPIO 28 to 31 ++Load: dtoverlay=i2s-gpio28-31 ++Params: <None> + -+/dts-v1/; -+/plugin/; + -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2836", "brcm,bcm2708", "brcm,bcm2709"; -+ /* disable spi-dev for spi0.0 */ -+ fragment@0 { -+ target = <&spi0>; -+ __overlay__ { -+ status = "okay"; -+ spidev@0{ -+ status = "disabled"; -+ }; -+ }; -+ }; ++Name: i2s-mmap ++Info: Enables mmap support in the bcm2708-i2s driver ++Load: dtoverlay=i2s-mmap ++Params: <None> + -+ /* the interrupt pin of the can-controller */ -+ fragment@1 { -+ target = <&gpio>; -+ __overlay__ { -+ can0_pins: can0_pins { -+ brcm,pins = <25>; -+ brcm,function = <0>; /* input */ -+ }; -+ }; -+ }; + -+ /* the clock/oscillator of the can-controller */ -+ fragment@2 { -+ target-path = "/clocks"; -+ __overlay__ { -+ /* external oscillator of mcp2515 on SPI0.0 */ -+ can0_osc: can0_osc { -+ compatible = "fixed-clock"; -+ #clock-cells = <0>; -+ clock-frequency = <16000000>; -+ }; -+ }; -+ }; ++Name: iqaudio-dac ++Info: Configures the IQaudio DAC audio card ++Load: dtoverlay=iqaudio-dac,<param> ++Params: 24db_digital_gain Allow gain to be applied via the PCM512x codec ++ Digital volume control. Enable with ++ "dtoverlay=iqaudio-dac,24db_digital_gain" ++ (The default behaviour is that the Digital ++ volume control is limited to a maximum of ++ 0dB. ie. it can attenuate but not provide ++ gain. For most users, this will be desired ++ as it will prevent clipping. By appending ++ the 24db_digital_gain parameter, the Digital ++ volume control will allow up to 24dB of ++ gain. If this parameter is enabled, it is the ++ responsibility of the user to ensure that ++ the Digital volume control is set to a value ++ that does not result in clipping/distortion!) + -+ /* the spi config of the can-controller itself binding everything together */ -+ fragment@3 { -+ target = <&spi0>; -+ __overlay__ { -+ /* needed to avoid dtc warning */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ can0: mcp2515@0 { -+ reg = <0>; -+ compatible = "microchip,mcp2515"; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&can0_pins>; -+ spi-max-frequency = <10000000>; -+ interrupt-parent = <&gpio>; -+ interrupts = <25 0x2>; -+ clocks = <&can0_osc>; -+ }; -+ }; -+ }; -+ __overrides__ { -+ oscillator = <&can0_osc>,"clock-frequency:0"; -+ spimaxfrequency = <&can0>,"spi-max-frequency:0"; -+ interrupt = <&can0_pins>,"brcm,pins:0",<&can0>,"interrupts:0"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/mcp2515-can1-overlay.dts b/arch/arm/boot/dts/overlays/mcp2515-can1-overlay.dts -new file mode 100644 -index 0000000..6bef9ae ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/mcp2515-can1-overlay.dts -@@ -0,0 +1,69 @@ -+/* -+ * Device tree overlay for mcp251x/can1 on spi0.1 edited by petit_miner -+ */ + -+/dts-v1/; -+/plugin/; ++Name: iqaudio-dacplus ++Info: Configures the IQaudio DAC+ audio card ++Load: dtoverlay=iqaudio-dacplus,<param>=<val> ++Params: 24db_digital_gain Allow gain to be applied via the PCM512x codec ++ Digital volume control. Enable with ++ "dtoverlay=iqaudio-dacplus,24db_digital_gain" ++ (The default behaviour is that the Digital ++ volume control is limited to a maximum of ++ 0dB. ie. it can attenuate but not provide ++ gain. For most users, this will be desired ++ as it will prevent clipping. By appending ++ the 24db_digital_gain parameter, the Digital ++ volume control will allow up to 24dB of ++ gain. If this parameter is enabled, it is the ++ responsibility of the user to ensure that ++ the Digital volume control is set to a value ++ that does not result in clipping/distortion!) + -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2836", "brcm,bcm2708", "brcm,bcm2709"; -+ /* disable spi-dev for spi0.1 */ -+ fragment@0 { -+ target = <&spi0>; -+ __overlay__ { -+ status = "okay"; -+ spidev@1{ -+ status = "disabled"; -+ }; -+ }; -+ }; + -+ /* the interrupt pin of the can-controller */ -+ fragment@1 { -+ target = <&gpio>; -+ __overlay__ { -+ can1_pins: can1_pins { -+ brcm,pins = <25>; -+ brcm,function = <0>; /* input */ -+ }; -+ }; -+ }; ++Name: justboom-dac ++Info: Configures the JustBoom DAC HAT, Amp HAT, DAC Zero and Amp Zero audio ++ cards ++Load: dtoverlay=justboom-dac,<param>=<val> ++Params: 24db_digital_gain Allow gain to be applied via the PCM512x codec ++ Digital volume control. Enable with ++ "dtoverlay=justboom-dac,24db_digital_gain" ++ (The default behaviour is that the Digital ++ volume control is limited to a maximum of ++ 0dB. ie. it can attenuate but not provide ++ gain. For most users, this will be desired ++ as it will prevent clipping. By appending ++ the 24dB_digital_gain parameter, the Digital ++ volume control will allow up to 24dB of ++ gain. If this parameter is enabled, it is the ++ responsibility of the user to ensure that ++ the Digital volume control is set to a value ++ that does not result in clipping/distortion!) + -+ /* the clock/oscillator of the can-controller */ -+ fragment@2 { -+ target-path = "/clocks"; -+ __overlay__ { -+ /* external oscillator of mcp2515 on spi0.1 */ -+ can1_osc: can1_osc { -+ compatible = "fixed-clock"; -+ #clock-cells = <0>; -+ clock-frequency = <16000000>; -+ }; -+ }; -+ }; + -+ /* the spi config of the can-controller itself binding everything together */ -+ fragment@3 { -+ target = <&spi0>; -+ __overlay__ { -+ /* needed to avoid dtc warning */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ can1: mcp2515@1 { -+ reg = <1>; -+ compatible = "microchip,mcp2515"; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&can1_pins>; -+ spi-max-frequency = <10000000>; -+ interrupt-parent = <&gpio>; -+ interrupts = <25 0x2>; -+ clocks = <&can1_osc>; -+ }; -+ }; -+ }; -+ __overrides__ { -+ oscillator = <&can1_osc>,"clock-frequency:0"; -+ spimaxfrequency = <&can1>,"spi-max-frequency:0"; -+ interrupt = <&can1_pins>,"brcm,pins:0",<&can1>,"interrupts:0"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/mmc-overlay.dts b/arch/arm/boot/dts/overlays/mmc-overlay.dts ++Name: justboom-digi ++Info: Configures the JustBoom Digi HAT and Digi Zero audio cards ++Load: dtoverlay=justboom-digi ++Params: <None> ++ ++ ++Name: lirc-rpi ++Info: Configures lirc-rpi (Linux Infrared Remote Control for Raspberry Pi) ++ Consult the module documentation for more details. ++Load: dtoverlay=lirc-rpi,<param>=<val> ++Params: gpio_out_pin GPIO for output (default "17") ++ ++ gpio_in_pin GPIO for input (default "18") ++ ++ gpio_in_pull Pull up/down/off on the input pin ++ (default "down") ++ ++ sense Override the IR receive auto-detection logic: ++ "0" = force active-high ++ "1" = force active-low ++ "-1" = use auto-detection ++ (default "-1") ++ ++ softcarrier Turn the software carrier "on" or "off" ++ (default "on") ++ ++ invert "on" = invert the output pin (default "off") ++ ++ debug "on" = enable additional debug messages ++ (default "off") ++ ++ ++Name: mcp23017 ++Info: Configures the MCP23017 I2C port expander ++Load: dtoverlay=mcp23017,<param>=<val> ++Params: gpiopin Gpio pin connected to the INTA output of the ++ MCP23017 (default: 4) ++ ++ addr I2C address of the MCP23017 (default: 0x20) ++ ++ ++Name: mcp2515-can0 ++Info: Configures the MCP2515 CAN controller on spi0.0 ++Load: dtoverlay=mcp2515-can0,<param>=<val> ++Params: oscillator Clock frequency for the CAN controller (Hz) ++ ++ spimaxfrequency Maximum SPI frequence (Hz) ++ ++ interrupt GPIO for interrupt signal ++ ++ ++Name: mcp2515-can1 ++Info: Configures the MCP2515 CAN controller on spi0.1 ++Load: dtoverlay=mcp2515-can1,<param>=<val> ++Params: oscillator Clock frequency for the CAN controller (Hz) ++ ++ spimaxfrequency Maximum SPI frequence (Hz) ++ ++ interrupt GPIO for interrupt signal ++ ++ ++Name: mmc ++Info: Selects the bcm2835-mmc SD/MMC driver, optionally with overclock ++Load: dtoverlay=mmc,<param>=<val> ++Params: overclock_50 Clock (in MHz) to use when the MMC framework ++ requests 50MHz ++ ++ ++Name: mz61581 ++Info: MZ61581 display by Tontec ++Load: dtoverlay=mz61581,<param>=<val> ++Params: speed Display SPI bus speed ++ ++ rotate Display rotation {0,90,180,270} ++ ++ fps Delay between frame updates ++ ++ txbuflen Transmit buffer length (default 32768) ++ ++ debug Debug output level {0-7} ++ ++ xohms Touchpanel sensitivity (X-plate resistance) ++ ++ ++[ The pcf2127-rtc overlay has been deleted. See i2c-rtc. ] ++ ++ ++[ The pcf8523-rtc overlay has been deleted. See i2c-rtc. ] ++ ++ ++[ The pcf8563-rtc overlay has been deleted. See i2c-rtc. ] ++ ++ ++Name: pi3-act-led ++Info: Pi3 uses a GPIO expander to drive the LEDs which can only be accessed ++ from the VPU. There is a special driver for this with a separate DT ++ node, which has the unfortunate consequence of breaking the ++ act_led_gpio and act_led_activelow dtparams. ++ This overlay changes the GPIO controller back to the standard one and ++ restores the dtparams. ++Load: dtoverlay=pi3-act-led,<param>=<val> ++Params: activelow Set to "on" to invert the sense of the LED ++ (default "off") ++ ++ gpio Set which GPIO to use for the activity LED ++ (in case you want to connect it to an external ++ device) ++ REQUIRED ++ ++ ++Name: pi3-disable-bt ++Info: Disable Pi3 Bluetooth and restore UART0/ttyAMA0 over GPIOs 14 & 15 ++ N.B. To disable the systemd service that initialises the modem so it ++ doesn't use the UART, use 'sudo systemctl disable hciuart'. ++Load: dtoverlay=pi3-disable-bt ++Params: <None> ++ ++ ++Name: pi3-miniuart-bt ++Info: Switch Pi3 Bluetooth function to use the mini-UART (ttyS0) and restore ++ UART0/ttyAMA0 over GPIOs 14 & 15. Note that this may reduce the maximum ++ usable baudrate. ++ N.B. It is also necessary to edit /lib/systemd/system/hciuart.service ++ and replace ttyAMA0 with ttyS0, unless you have a system with udev rules ++ that create /dev/serial0 and /dev/serial1, in which case use ++ /dev/serial1 instead because it will always be correct. ++Load: dtoverlay=pi3-miniuart-bt ++Params: <None> ++ ++ ++Name: piscreen ++Info: PiScreen display by OzzMaker.com ++Load: dtoverlay=piscreen,<param>=<val> ++Params: speed Display SPI bus speed ++ ++ rotate Display rotation {0,90,180,270} ++ ++ fps Delay between frame updates ++ ++ debug Debug output level {0-7} ++ ++ xohms Touchpanel sensitivity (X-plate resistance) ++ ++ ++Name: piscreen2r ++Info: PiScreen 2 with resistive TP display by OzzMaker.com ++Load: dtoverlay=piscreen2r,<param>=<val> ++Params: speed Display SPI bus speed ++ ++ rotate Display rotation {0,90,180,270} ++ ++ fps Delay between frame updates ++ ++ debug Debug output level {0-7} ++ ++ xohms Touchpanel sensitivity (X-plate resistance) ++ ++ ++Name: pitft22 ++Info: Adafruit PiTFT 2.2" screen ++Load: dtoverlay=pitft22,<param>=<val> ++Params: speed Display SPI bus speed ++ ++ rotate Display rotation {0,90,180,270} ++ ++ fps Delay between frame updates ++ ++ debug Debug output level {0-7} ++ ++ ++Name: pitft28-capacitive ++Info: Adafruit PiTFT 2.8" capacitive touch screen ++Load: dtoverlay=pitft28-capacitive,<param>=<val> ++Params: speed Display SPI bus speed ++ ++ rotate Display rotation {0,90,180,270} ++ ++ fps Delay between frame updates ++ ++ debug Debug output level {0-7} ++ ++ touch-sizex Touchscreen size x (default 240) ++ ++ touch-sizey Touchscreen size y (default 320) ++ ++ touch-invx Touchscreen inverted x axis ++ ++ touch-invy Touchscreen inverted y axis ++ ++ touch-swapxy Touchscreen swapped x y axis ++ ++ ++Name: pitft28-resistive ++Info: Adafruit PiTFT 2.8" resistive touch screen ++Load: dtoverlay=pitft28-resistive,<param>=<val> ++Params: speed Display SPI bus speed ++ ++ rotate Display rotation {0,90,180,270} ++ ++ fps Delay between frame updates ++ ++ debug Debug output level {0-7} ++ ++ ++Name: pps-gpio ++Info: Configures the pps-gpio (pulse-per-second time signal via GPIO). ++Load: dtoverlay=pps-gpio,<param>=<val> ++Params: gpiopin Input GPIO (default "18") ++ ++ ++Name: pwm ++Info: Configures a single PWM channel ++ Legal pin,function combinations for each channel: ++ PWM0: 12,4(Alt0) 18,2(Alt5) 40,4(Alt0) 52,5(Alt1) ++ PWM1: 13,4(Alt0) 19,2(Alt5) 41,4(Alt0) 45,4(Alt0) 53,5(Alt1) ++ N.B.: ++ 1) Pin 18 is the only one available on all platforms, and ++ it is the one used by the I2S audio interface. ++ Pins 12 and 13 might be better choices on an A+, B+ or Pi2. ++ 2) The onboard analogue audio output uses both PWM channels. ++ 3) So be careful mixing audio and PWM. ++ 4) Currently the clock must have been enabled and configured ++ by other means. ++Load: dtoverlay=pwm,<param>=<val> ++Params: pin Output pin (default 18) - see table ++ func Pin function (default 2 = Alt5) - see above ++ clock PWM clock frequency (informational) ++ ++ ++Name: pwm-2chan ++Info: Configures both PWM channels ++ Legal pin,function combinations for each channel: ++ PWM0: 12,4(Alt0) 18,2(Alt5) 40,4(Alt0) 52,5(Alt1) ++ PWM1: 13,4(Alt0) 19,2(Alt5) 41,4(Alt0) 45,4(Alt0) 53,5(Alt1) ++ N.B.: ++ 1) Pin 18 is the only one available on all platforms, and ++ it is the one used by the I2S audio interface. ++ Pins 12 and 13 might be better choices on an A+, B+ or Pi2. ++ 2) The onboard analogue audio output uses both PWM channels. ++ 3) So be careful mixing audio and PWM. ++ 4) Currently the clock must have been enabled and configured ++ by other means. ++Load: dtoverlay=pwm-2chan,<param>=<val> ++Params: pin Output pin (default 18) - see table ++ pin2 Output pin for other channel (default 19) ++ func Pin function (default 2 = Alt5) - see above ++ func2 Function for pin2 (default 2 = Alt5) ++ clock PWM clock frequency (informational) ++ ++ ++Name: qca7000 ++Info: I2SE's Evaluation Board for PLC Stamp micro ++Load: dtoverlay=qca7000,<param>=<val> ++Params: int_pin GPIO pin for interrupt signal (default 23) ++ ++ speed SPI bus speed (default 12 MHz) ++ ++ ++Name: raspidac3 ++Info: Configures the RaspiDAV Rev.3x audio card ++Load: dtoverlay=raspidac3 ++Params: <None> ++ ++ ++Name: rpi-backlight ++Info: Raspberry Pi official display backlight driver ++Load: dtoverlay=rpi-backlight ++Params: <None> ++ ++ ++Name: rpi-dac ++Info: Configures the RPi DAC audio card ++Load: dtoverlay=rpi-dac ++Params: <None> ++ ++ ++Name: rpi-display ++Info: RPi-Display - 2.8" Touch Display by Watterott ++Load: dtoverlay=rpi-display,<param>=<val> ++Params: speed Display SPI bus speed ++ rotate Display rotation {0,90,180,270} ++ fps Delay between frame updates ++ debug Debug output level {0-7} ++ xohms Touchpanel sensitivity (X-plate resistance) ++ swapxy Swap x and y axis ++ ++ ++Name: rpi-ft5406 ++Info: Official Raspberry Pi display touchscreen ++Load: dtoverlay=rpi-ft5406 ++Params: <None> ++ ++ ++Name: rpi-proto ++Info: Configures the RPi Proto audio card ++Load: dtoverlay=rpi-proto ++Params: <None> ++ ++ ++Name: rpi-sense ++Info: Raspberry Pi Sense HAT ++Load: dtoverlay=rpi-sense ++Params: <None> ++ ++ ++Name: rra-digidac1-wm8741-audio ++Info: Configures the Red Rocks Audio DigiDAC1 soundcard ++Load: dtoverlay=rra-digidac1-wm8741-audio ++Params: <None> ++ ++ ++Name: sdhost ++Info: Selects the bcm2835-sdhost SD/MMC driver, optionally with overclock. ++ N.B. This overlay is designed for situations where the mmc driver is ++ the default, so it disables the other (mmc) interface - this will kill ++ WiFi on a Pi3. If this isn't what you want, either use the sdtweak ++ overlay or the new sd_* dtparams of the base DTBs. ++Load: dtoverlay=sdhost,<param>=<val> ++Params: overclock_50 Clock (in MHz) to use when the MMC framework ++ requests 50MHz ++ ++ force_pio Disable DMA support (default off) ++ ++ pio_limit Number of blocks above which to use DMA ++ (default 1) ++ ++ debug Enable debug output (default off) ++ ++ ++Name: sdio ++Info: Selects the bcm2835-sdhost SD/MMC driver, optionally with overclock, ++ and enables SDIO via GPIOs 22-27. ++Load: dtoverlay=sdio,<param>=<val> ++Params: overclock_50 SD Clock (in MHz) to use when the MMC framework ++ requests 50MHz ++ ++ sdio_overclock SDIO Clock (in MHz) to use when the MMC ++ framework requests 50MHz ++ ++ force_pio Disable DMA support (default off) ++ ++ pio_limit Number of blocks above which to use DMA ++ (default 1) ++ ++ debug Enable debug output (default off) ++ ++ poll_once Disable SDIO-device polling every second ++ (default on: polling once at boot-time) ++ ++ bus_width Set the SDIO host bus width (default 4 bits) ++ ++ ++Name: sdio-1bit ++Info: Selects the bcm2835-sdhost SD/MMC driver, optionally with overclock, ++ and enables 1-bit SDIO via GPIOs 22-25. ++Load: dtoverlay=sdio-1bit,<param>=<val> ++Params: overclock_50 SD Clock (in MHz) to use when the MMC framework ++ requests 50MHz ++ ++ sdio_overclock SDIO Clock (in MHz) to use when the MMC ++ framework requests 50MHz ++ ++ force_pio Disable DMA support (default off) ++ ++ pio_limit Number of blocks above which to use DMA ++ (default 1) ++ ++ debug Enable debug output (default off) ++ ++ poll_once Disable SDIO-device polling every second ++ (default on: polling once at boot-time) ++ ++ ++Name: sdtweak ++Info: Tunes the bcm2835-sdhost SD/MMC driver ++ N.B. This functionality is now available via the sd_* dtparams in the ++ base DTB. ++Load: dtoverlay=sdtweak,<param>=<val> ++Params: overclock_50 Clock (in MHz) to use when the MMC framework ++ requests 50MHz ++ ++ force_pio Disable DMA support (default off) ++ ++ pio_limit Number of blocks above which to use DMA ++ (default 1) ++ ++ debug Enable debug output (default off) ++ ++ ++Name: smi ++Info: Enables the Secondary Memory Interface peripheral. Uses GPIOs 2-25! ++Load: dtoverlay=smi ++Params: <None> ++ ++ ++Name: smi-dev ++Info: Enables the userspace interface for the SMI driver ++Load: dtoverlay=smi-dev ++Params: <None> ++ ++ ++Name: smi-nand ++Info: Enables access to NAND flash via the SMI interface ++Load: dtoverlay=smi-nand ++Params: <None> ++ ++ ++Name: spi-gpio35-39 ++Info: move SPI function block to GPIO 35 to 39 ++Load: dtoverlay=spi-gpio35-39 ++Params: <None> ++ ++ ++Name: spi1-1cs ++Info: Enables spi1 with a single chip select (CS) line and associated spidev ++ dev node. The gpio pin number for the CS line and spidev device node ++ creation are configurable. ++ N.B.: spi1 is only accessible on devices with a 40pin header, eg: ++ A+, B+, Zero and PI2 B; as well as the Compute Module. ++Load: dtoverlay=spi1-1cs,<param>=<val> ++Params: cs0_pin GPIO pin for CS0 (default 18 - BCM SPI1_CE0). ++ cs0_spidev Set to 'disabled' to stop the creation of a ++ userspace device node /dev/spidev1.0 (default ++ is 'okay' or enabled). ++ ++ ++Name: spi1-2cs ++Info: Enables spi1 with two chip select (CS) lines and associated spidev ++ dev nodes. The gpio pin numbers for the CS lines and spidev device node ++ creation are configurable. ++ N.B.: spi1 is only accessible on devices with a 40pin header, eg: ++ A+, B+, Zero and PI2 B; as well as the Compute Module. ++Load: dtoverlay=spi1-2cs,<param>=<val> ++Params: cs0_pin GPIO pin for CS0 (default 18 - BCM SPI1_CE0). ++ cs1_pin GPIO pin for CS1 (default 17 - BCM SPI1_CE1). ++ cs0_spidev Set to 'disabled' to stop the creation of a ++ userspace device node /dev/spidev1.0 (default ++ is 'okay' or enabled). ++ cs1_spidev Set to 'disabled' to stop the creation of a ++ userspace device node /dev/spidev1.1 (default ++ is 'okay' or enabled). ++ ++ ++Name: spi1-3cs ++Info: Enables spi1 with three chip select (CS) lines and associated spidev ++ dev nodes. The gpio pin numbers for the CS lines and spidev device node ++ creation are configurable. ++ N.B.: spi1 is only accessible on devices with a 40pin header, eg: ++ A+, B+, Zero and PI2 B; as well as the Compute Module. ++Load: dtoverlay=spi1-3cs,<param>=<val> ++Params: cs0_pin GPIO pin for CS0 (default 18 - BCM SPI1_CE0). ++ cs1_pin GPIO pin for CS1 (default 17 - BCM SPI1_CE1). ++ cs2_pin GPIO pin for CS2 (default 16 - BCM SPI1_CE2). ++ cs0_spidev Set to 'disabled' to stop the creation of a ++ userspace device node /dev/spidev1.0 (default ++ is 'okay' or enabled). ++ cs1_spidev Set to 'disabled' to stop the creation of a ++ userspace device node /dev/spidev1.1 (default ++ is 'okay' or enabled). ++ cs2_spidev Set to 'disabled' to stop the creation of a ++ userspace device node /dev/spidev1.2 (default ++ is 'okay' or enabled). ++ ++ ++Name: spi2-1cs ++Info: Enables spi2 with a single chip select (CS) line and associated spidev ++ dev node. The gpio pin number for the CS line and spidev device node ++ creation are configurable. ++ N.B.: spi2 is only accessible with the Compute Module. ++Load: dtoverlay=spi2-1cs,<param>=<val> ++Params: cs0_pin GPIO pin for CS0 (default 43 - BCM SPI2_CE0). ++ cs0_spidev Set to 'disabled' to stop the creation of a ++ userspace device node /dev/spidev2.0 (default ++ is 'okay' or enabled). ++ ++ ++Name: spi2-2cs ++Info: Enables spi2 with two chip select (CS) lines and associated spidev ++ dev nodes. The gpio pin numbers for the CS lines and spidev device node ++ creation are configurable. ++ N.B.: spi2 is only accessible with the Compute Module. ++Load: dtoverlay=spi2-2cs,<param>=<val> ++Params: cs0_pin GPIO pin for CS0 (default 43 - BCM SPI2_CE0). ++ cs1_pin GPIO pin for CS1 (default 44 - BCM SPI2_CE1). ++ cs0_spidev Set to 'disabled' to stop the creation of a ++ userspace device node /dev/spidev2.0 (default ++ is 'okay' or enabled). ++ cs1_spidev Set to 'disabled' to stop the creation of a ++ userspace device node /dev/spidev2.1 (default ++ is 'okay' or enabled). ++ ++ ++Name: spi2-3cs ++Info: Enables spi2 with three chip select (CS) lines and associated spidev ++ dev nodes. The gpio pin numbers for the CS lines and spidev device node ++ creation are configurable. ++ N.B.: spi2 is only accessible with the Compute Module. ++Load: dtoverlay=spi2-3cs,<param>=<val> ++Params: cs0_pin GPIO pin for CS0 (default 43 - BCM SPI2_CE0). ++ cs1_pin GPIO pin for CS1 (default 44 - BCM SPI2_CE1). ++ cs2_pin GPIO pin for CS2 (default 45 - BCM SPI2_CE2). ++ cs0_spidev Set to 'disabled' to stop the creation of a ++ userspace device node /dev/spidev2.0 (default ++ is 'okay' or enabled). ++ cs1_spidev Set to 'disabled' to stop the creation of a ++ userspace device node /dev/spidev2.1 (default ++ is 'okay' or enabled). ++ cs2_spidev Set to 'disabled' to stop the creation of a ++ userspace device node /dev/spidev2.2 (default ++ is 'okay' or enabled). ++ ++ ++Name: tinylcd35 ++Info: 3.5" Color TFT Display by www.tinylcd.com ++ Options: Touch, RTC, keypad ++Load: dtoverlay=tinylcd35,<param>=<val> ++Params: speed Display SPI bus speed ++ ++ rotate Display rotation {0,90,180,270} ++ ++ fps Delay between frame updates ++ ++ debug Debug output level {0-7} ++ ++ touch Enable touch panel ++ ++ touchgpio Touch controller IRQ GPIO ++ ++ xohms Touchpanel: Resistance of X-plate in ohms ++ ++ rtc-pcf PCF8563 Real Time Clock ++ ++ rtc-ds DS1307 Real Time Clock ++ ++ keypad Enable keypad ++ ++ Examples: ++ Display with touchpanel, PCF8563 RTC and keypad: ++ dtoverlay=tinylcd35,touch,rtc-pcf,keypad ++ Old touch display: ++ dtoverlay=tinylcd35,touch,touchgpio=3 ++ ++ ++Name: uart1 ++Info: Enable uart1 in place of uart0 ++Load: dtoverlay=uart1,<param>=<val> ++Params: txd1_pin GPIO pin for TXD1 (14, 32 or 40 - default 14) ++ ++ rxd1_pin GPIO pin for RXD1 (15, 33 or 41 - default 15) ++ ++ ++Name: vc4-kms-v3d ++Info: Enable Eric Anholt's DRM VC4 HDMI/HVS/V3D driver. Running startx or ++ booting to GUI while this overlay is in use will cause interesting ++ lockups. ++Load: dtoverlay=vc4-kms-v3d,<param> ++Params: cma-256 CMA is 256MB, 256MB-aligned (needs 1GB) ++ cma-192 CMA is 192MB, 256MB-aligned (needs 1GB) ++ cma-128 CMA is 128MB, 128MB-aligned ++ cma-96 CMA is 96MB, 128MB-aligned ++ cma-64 CMA is 64MB, 64MB-aligned ++ ++ ++Name: vga666 ++Info: Overlay for the Fen Logic VGA666 board ++ This uses GPIOs 2-21 (so no I2C), and activates the output 2-3 seconds ++ after the kernel has started. ++Load: dtoverlay=vga666 ++Params: <None> ++ ++ ++Name: w1-gpio ++Info: Configures the w1-gpio Onewire interface module. ++ Use this overlay if you *don't* need a GPIO to drive an external pullup. ++Load: dtoverlay=w1-gpio,<param>=<val> ++Params: gpiopin GPIO for I/O (default "4") ++ ++ pullup Non-zero, "on", or "y" to enable the parasitic ++ power (2-wire, power-on-data) feature ++ ++ ++Name: w1-gpio-pullup ++Info: Configures the w1-gpio Onewire interface module. ++ Use this overlay if you *do* need a GPIO to drive an external pullup. ++Load: dtoverlay=w1-gpio-pullup,<param>=<val> ++Params: gpiopin GPIO for I/O (default "4") ++ ++ pullup Non-zero, "on", or "y" to enable the parasitic ++ power (2-wire, power-on-data) feature ++ ++ extpullup GPIO for external pullup (default "5") ++ ++ ++Name: wittypi ++Info: Configures the wittypi RTC module. ++Load: dtoverlay=wittypi,<param>=<val> ++Params: led_gpio GPIO for LED (default "17") ++ led_trigger Choose which activity the LED tracks (default ++ "default-on") ++ ++ ++Troubleshooting ++=============== ++ ++If you are experiencing problems that you think are DT-related, enable DT ++diagnostic output by adding this to /boot/config.txt: ++ ++ dtdebug=on ++ ++and rebooting. Then run: ++ ++ sudo vcdbg log msg ++ ++and look for relevant messages. ++ ++Further reading ++=============== ++ ++This is only meant to be a quick introduction to the subject of Device Tree on ++Raspberry Pi. There is a more complete explanation here: ++ ++http://www.raspberrypi.org/documentation/configuration/device-tree.md +diff --git a/arch/arm/boot/dts/overlays/adau1977-adc-overlay.dts b/arch/arm/boot/dts/overlays/adau1977-adc-overlay.dts new file mode 100644 -index 0000000..00a22be +index 0000000..24fcd58 --- /dev/null -+++ b/arch/arm/boot/dts/overlays/mmc-overlay.dts -@@ -0,0 +1,39 @@ ++++ b/arch/arm/boot/dts/overlays/adau1977-adc-overlay.dts +@@ -0,0 +1,53 @@ ++// Definitions for ADAU1977 ADC +/dts-v1/; +/plugin/; + -+/{ ++/ { + compatible = "brcm,bcm2708"; -+ ++ + fragment@0 { -+ target = <&mmc>; -+ frag0: __overlay__ { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&mmc_pins>; -+ bus-width = <4>; -+ brcm,overclock-50 = <0>; -+ status = "okay"; ++ target = <&soc>; ++ ++ __overlay__ { ++ codec_supply: fixedregulator@0 { ++ compatible = "regulator-fixed"; ++ regulator-name = "AVDD"; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ }; + }; + }; -+ ++ + fragment@1 { -+ target = <&gpio>; ++ target = <&i2c>; ++ + __overlay__ { -+ mmc_pins: mmc_pins { -+ brcm,pins = <48 49 50 51 52 53>; -+ brcm,function = <7>; /* alt3 */ -+ }; -+ }; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ adau1977: codec@11 { ++ compatible = "adi,adau1977"; ++ reg = <0x11>; ++ reset-gpios = <&gpio 5 0>; ++ AVDD-supply = <&codec_supply>; ++ }; ++ }; + }; + + fragment@2 { -+ target = <&sdhost>; ++ target = <&i2s>; + __overlay__ { -+ status = "disabled"; ++ status = "okay"; + }; + }; + -+ __overrides__ { -+ overclock_50 = <&frag0>,"brcm,overclock-50:0"; -+ force_pio = <&frag0>,"brcm,force-pio?"; ++ fragment@3 { ++ target = <&sound>; ++ __overlay__ { ++ compatible = "adi,adau1977-adc"; ++ i2s-controller = <&i2s>; ++ status = "okay"; ++ }; + }; +}; -diff --git a/arch/arm/boot/dts/overlays/mz61581-overlay.dts b/arch/arm/boot/dts/overlays/mz61581-overlay.dts +diff --git a/arch/arm/boot/dts/overlays/ads7846-overlay.dts b/arch/arm/boot/dts/overlays/ads7846-overlay.dts new file mode 100644 -index 0000000..9242a6e +index 0000000..edf2dc9 --- /dev/null -+++ b/arch/arm/boot/dts/overlays/mz61581-overlay.dts -@@ -0,0 +1,111 @@ ++++ b/arch/arm/boot/dts/overlays/ads7846-overlay.dts +@@ -0,0 +1,89 @@ +/* -+ * Device Tree overlay for MZ61581-PI-EXT 2014.12.28 by Tontec ++ * Generic Device Tree overlay for the ADS7846 touch controller + * + */ + @@ -112305,344 +116285,293 @@ index 0000000..9242a6e + target = <&spi0>; + __overlay__ { + status = "okay"; ++ }; ++ }; + -+ spidev@0{ -+ status = "disabled"; -+ }; ++ fragment@1 { ++ target = <&spidev0>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; + -+ spidev@1{ -+ status = "disabled"; -+ }; ++ fragment@2 { ++ target = <&spidev1>; ++ __overlay__ { ++ status = "disabled"; + }; + }; + -+ fragment@1 { ++ fragment@3 { + target = <&gpio>; + __overlay__ { -+ mz61581_pins: mz61581_pins { -+ brcm,pins = <4 15 18 25>; -+ brcm,function = <0 1 1 1>; /* in out out out */ ++ ads7846_pins: ads7846_pins { ++ brcm,pins = <255>; /* illegal default value */ ++ brcm,function = <0>; /* in */ ++ brcm,pull = <0>; /* none */ + }; + }; + }; + -+ fragment@2 { ++ fragment@4 { + target = <&spi0>; + __overlay__ { + /* needed to avoid dtc warning */ + #address-cells = <1>; + #size-cells = <0>; + -+ mz61581: mz61581@0{ -+ compatible = "samsung,s6d02a1"; -+ reg = <0>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&mz61581_pins>; -+ -+ spi-max-frequency = <128000000>; -+ spi-cpol; -+ spi-cpha; -+ -+ width = <320>; -+ height = <480>; -+ rotate = <270>; -+ bgr; -+ fps = <30>; -+ buswidth = <8>; -+ txbuflen = <32768>; -+ -+ reset-gpios = <&gpio 15 0>; -+ dc-gpios = <&gpio 25 0>; -+ led-gpios = <&gpio 18 0>; -+ -+ init = <0x10000b0 00 -+ 0x1000011 -+ 0x20000ff -+ 0x10000b3 0x02 0x00 0x00 0x00 -+ 0x10000c0 0x13 0x3b 0x00 0x02 0x00 0x01 0x00 0x43 -+ 0x10000c1 0x08 0x16 0x08 0x08 -+ 0x10000c4 0x11 0x07 0x03 0x03 -+ 0x10000c6 0x00 -+ 0x10000c8 0x03 0x03 0x13 0x5c 0x03 0x07 0x14 0x08 0x00 0x21 0x08 0x14 0x07 0x53 0x0c 0x13 0x03 0x03 0x21 0x00 -+ 0x1000035 0x00 -+ 0x1000036 0xa0 -+ 0x100003a 0x55 -+ 0x1000044 0x00 0x01 -+ 0x10000d0 0x07 0x07 0x1d 0x03 -+ 0x10000d1 0x03 0x30 0x10 -+ 0x10000d2 0x03 0x14 0x04 -+ 0x1000029 -+ 0x100002c>; -+ -+ /* This is a workaround to make sure the init sequence slows down and doesn't fail */ -+ debug = <3>; -+ }; -+ -+ mz61581_ts: mz61581_ts@1 { ++ ads7846: ads7846@1 { + compatible = "ti,ads7846"; + reg = <1>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&ads7846_pins>; + + spi-max-frequency = <2000000>; -+ interrupts = <4 2>; /* high-to-low edge triggered */ ++ interrupts = <255 2>; /* high-to-low edge triggered */ + interrupt-parent = <&gpio>; -+ pendown-gpio = <&gpio 4 0>; ++ pendown-gpio = <&gpio 255 0>; + -+ ti,x-plate-ohms = /bits/ 16 <60>; -+ ti,pressure-max = /bits/ 16 <255>; ++ /* driver defaults */ ++ ti,x-min = /bits/ 16 <0>; ++ ti,y-min = /bits/ 16 <0>; ++ ti,x-max = /bits/ 16 <0x0FFF>; ++ ti,y-max = /bits/ 16 <0x0FFF>; ++ ti,pressure-min = /bits/ 16 <0>; ++ ti,pressure-max = /bits/ 16 <0xFFFF>; ++ ti,x-plate-ohms = /bits/ 16 <400>; + }; + }; + }; + __overrides__ { -+ speed = <&mz61581>, "spi-max-frequency:0"; -+ rotate = <&mz61581>, "rotate:0"; -+ fps = <&mz61581>, "fps:0"; -+ txbuflen = <&mz61581>, "txbuflen:0"; -+ debug = <&mz61581>, "debug:0"; -+ xohms = <&mz61581_ts>,"ti,x-plate-ohms;0"; ++ cs = <&ads7846>,"reg:0"; ++ speed = <&ads7846>,"spi-max-frequency:0"; ++ penirq = <&ads7846_pins>,"brcm,pins:0", /* REQUIRED */ ++ <&ads7846>,"interrupts:0", ++ <&ads7846>,"pendown-gpio:4"; ++ penirq_pull = <&ads7846_pins>,"brcm,pull:0"; ++ swapxy = <&ads7846>,"ti,swap-xy?"; ++ xmin = <&ads7846>,"ti,x-min;0"; ++ ymin = <&ads7846>,"ti,y-min;0"; ++ xmax = <&ads7846>,"ti,x-max;0"; ++ ymax = <&ads7846>,"ti,y-max;0"; ++ pmin = <&ads7846>,"ti,pressure-min;0"; ++ pmax = <&ads7846>,"ti,pressure-max;0"; ++ xohms = <&ads7846>,"ti,x-plate-ohms;0"; + }; +}; -diff --git a/arch/arm/boot/dts/overlays/piscreen-overlay.dts b/arch/arm/boot/dts/overlays/piscreen-overlay.dts +diff --git a/arch/arm/boot/dts/overlays/akkordion-iqdacplus-overlay.dts b/arch/arm/boot/dts/overlays/akkordion-iqdacplus-overlay.dts new file mode 100644 -index 0000000..ba4ad33 +index 0000000..208849d --- /dev/null -+++ b/arch/arm/boot/dts/overlays/piscreen-overlay.dts -@@ -0,0 +1,96 @@ -+/* -+ * Device Tree overlay for PiScreen 3.5" display shield by Ozzmaker -+ * -+ */ -+ ++++ b/arch/arm/boot/dts/overlays/akkordion-iqdacplus-overlay.dts +@@ -0,0 +1,46 @@ ++// Definitions for Digital Dreamtime Akkordion using IQaudIO DAC+ or DACZero +/dts-v1/; +/plugin/; + +/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; ++ compatible = "brcm,bcm2708"; + + fragment@0 { -+ target = <&spi0>; ++ target = <&i2s>; + __overlay__ { + status = "okay"; -+ -+ spidev@0{ -+ status = "disabled"; -+ }; -+ -+ spidev@1{ -+ status = "disabled"; -+ }; + }; + }; + + fragment@1 { -+ target = <&gpio>; -+ __overlay__ { -+ piscreen_pins: piscreen_pins { -+ brcm,pins = <17 25 24 22>; -+ brcm,function = <0 1 1 1>; /* in out out out */ -+ }; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&spi0>; ++ target = <&i2c1>; + __overlay__ { -+ /* needed to avoid dtc warning */ + #address-cells = <1>; + #size-cells = <0>; ++ status = "okay"; + -+ piscreen: piscreen@0{ -+ compatible = "ilitek,ili9486"; -+ reg = <0>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&piscreen_pins>; -+ -+ spi-max-frequency = <24000000>; -+ rotate = <270>; -+ bgr; -+ fps = <30>; -+ buswidth = <8>; -+ regwidth = <16>; -+ reset-gpios = <&gpio 25 0>; -+ dc-gpios = <&gpio 24 0>; -+ led-gpios = <&gpio 22 1>; -+ debug = <0>; -+ -+ init = <0x10000b0 0x00 -+ 0x1000011 -+ 0x20000ff -+ 0x100003a 0x55 -+ 0x1000036 0x28 -+ 0x10000c2 0x44 -+ 0x10000c5 0x00 0x00 0x00 0x00 -+ 0x10000e0 0x0f 0x1f 0x1c 0x0c 0x0f 0x08 0x48 0x98 0x37 0x0a 0x13 0x04 0x11 0x0d 0x00 -+ 0x10000e1 0x0f 0x32 0x2e 0x0b 0x0d 0x05 0x47 0x75 0x37 0x06 0x10 0x03 0x24 0x20 0x00 -+ 0x10000e2 0x0f 0x32 0x2e 0x0b 0x0d 0x05 0x47 0x75 0x37 0x06 0x10 0x03 0x24 0x20 0x00 -+ 0x1000011 -+ 0x1000029>; ++ pcm5122@4c { ++ #sound-dai-cells = <0>; ++ compatible = "ti,pcm5122"; ++ reg = <0x4c>; ++ status = "okay"; + }; ++ }; ++ }; + -+ piscreen_ts: piscreen-ts@1 { -+ compatible = "ti,ads7846"; -+ reg = <1>; -+ -+ spi-max-frequency = <2000000>; -+ interrupts = <17 2>; /* high-to-low edge triggered */ -+ interrupt-parent = <&gpio>; -+ pendown-gpio = <&gpio 17 0>; -+ ti,swap-xy; -+ ti,x-plate-ohms = /bits/ 16 <100>; -+ ti,pressure-max = /bits/ 16 <255>; -+ }; ++ fragment@2 { ++ target = <&sound>; ++ frag2: __overlay__ { ++ compatible = "iqaudio,iqaudio-dac"; ++ card_name = "Akkordion"; ++ dai_name = "IQaudIO DAC"; ++ dai_stream_name = "IQaudIO DAC HiFi"; ++ i2s-controller = <&i2s>; ++ status = "okay"; + }; + }; ++ + __overrides__ { -+ speed = <&piscreen>,"spi-max-frequency:0"; -+ rotate = <&piscreen>,"rotate:0"; -+ fps = <&piscreen>,"fps:0"; -+ debug = <&piscreen>,"debug:0"; -+ xohms = <&piscreen_ts>,"ti,x-plate-ohms;0"; ++ 24db_digital_gain = <&frag2>,"iqaudio,24db_digital_gain?"; + }; +}; -diff --git a/arch/arm/boot/dts/overlays/pitft28-resistive-overlay.dts b/arch/arm/boot/dts/overlays/pitft28-resistive-overlay.dts +diff --git a/arch/arm/boot/dts/overlays/at86rf233-overlay.dts b/arch/arm/boot/dts/overlays/at86rf233-overlay.dts new file mode 100644 -index 0000000..d506eae +index 0000000..880c753 --- /dev/null -+++ b/arch/arm/boot/dts/overlays/pitft28-resistive-overlay.dts -@@ -0,0 +1,115 @@ -+/* -+ * Device Tree overlay for Adafruit PiTFT 2.8" resistive touch screen -+ * -+ */ -+ ++++ b/arch/arm/boot/dts/overlays/at86rf233-overlay.dts +@@ -0,0 +1,57 @@ +/dts-v1/; +/plugin/; + ++/* Overlay for Atmel AT86RF233 IEEE 802.15.4 WPAN transceiver on spi0.0 */ ++ +/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; ++ compatible = "brcm,bcm2835", "brcm,bcm2836", "brcm,bcm2708", "brcm,bcm2709"; + + fragment@0 { + target = <&spi0>; + __overlay__ { -+ status = "okay"; ++ #address-cells = <1>; ++ #size-cells = <0>; + -+ spidev@0{ -+ status = "disabled"; -+ }; ++ status = "okay"; + -+ spidev@1{ -+ status = "disabled"; ++ lowpan0: at86rf233@0 { ++ compatible = "atmel,at86rf233"; ++ reg = <0>; ++ interrupt-parent = <&gpio>; ++ interrupts = <23 4>; /* active high */ ++ reset-gpio = <&gpio 24 1>; ++ sleep-gpio = <&gpio 25 1>; ++ spi-max-frequency = <3000000>; ++ xtal-trim = /bits/ 8 <0xf>; + }; + }; + }; + + fragment@1 { -+ target = <&gpio>; ++ target = <&spidev0>; + __overlay__ { -+ pitft_pins: pitft_pins { -+ brcm,pins = <24 25>; -+ brcm,function = <0 1>; /* in out */ -+ brcm,pull = <2 0>; /* pullup none */ -+ }; ++ status = "disabled"; + }; + }; + + fragment@2 { -+ target = <&spi0>; ++ target = <&gpio>; + __overlay__ { -+ /* needed to avoid dtc warning */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ pitft: pitft@0{ -+ compatible = "ilitek,ili9340"; -+ reg = <0>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pitft_pins>; -+ -+ spi-max-frequency = <32000000>; -+ rotate = <90>; -+ fps = <25>; -+ bgr; -+ buswidth = <8>; -+ dc-gpios = <&gpio 25 0>; -+ debug = <0>; ++ lowpan0_pins: lowpan0_pins { ++ brcm,pins = <23 24 25>; ++ brcm,function = <0 1 1>; /* in out out */ + }; ++ }; ++ }; + -+ pitft_ts@1 { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ compatible = "st,stmpe610"; -+ reg = <1>; -+ -+ spi-max-frequency = <500000>; -+ irq-gpio = <&gpio 24 0x2>; /* IRQF_TRIGGER_FALLING */ -+ interrupts = <24 2>; /* high-to-low edge triggered */ -+ interrupt-parent = <&gpio>; -+ interrupt-controller; ++ __overrides__ { ++ interrupt = <&lowpan0>, "interrupts:0", ++ <&lowpan0_pins>, "brcm,pins:0"; ++ reset = <&lowpan0>, "reset-gpio:4", ++ <&lowpan0_pins>, "brcm,pins:4"; ++ sleep = <&lowpan0>, "sleep-gpio:4", ++ <&lowpan0_pins>, "brcm,pins:8"; ++ speed = <&lowpan0>, "spi-max-frequency:0"; ++ trim = <&lowpan0>, "xtal-trim.0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/audioinjector-wm8731-audio-overlay.dts b/arch/arm/boot/dts/overlays/audioinjector-wm8731-audio-overlay.dts +new file mode 100644 +index 0000000..4ed66577 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/audioinjector-wm8731-audio-overlay.dts +@@ -0,0 +1,39 @@ ++// Definitions for audioinjector.net audio add on soundcard ++/dts-v1/; ++/plugin/; + -+ stmpe_touchscreen { -+ compatible = "st,stmpe-ts"; -+ st,sample-time = <4>; -+ st,mod-12b = <1>; -+ st,ref-sel = <0>; -+ st,adc-freq = <2>; -+ st,ave-ctrl = <3>; -+ st,touch-det-delay = <4>; -+ st,settling = <2>; -+ st,fraction-z = <7>; -+ st,i-drive = <0>; -+ }; ++/ { ++ compatible = "brcm,bcm2708"; + -+ stmpe_gpio: stmpe_gpio { -+ #gpio-cells = <2>; -+ compatible = "st,stmpe-gpio"; -+ /* -+ * only GPIO2 is wired/available -+ * and it is wired to the backlight -+ */ -+ st,norequest-mask = <0x7b>; -+ }; -+ }; ++ fragment@0 { ++ target = <&i2s>; ++ __overlay__ { ++ status = "okay"; + }; + }; + -+ fragment@3 { -+ target-path = "/soc"; ++ fragment@1 { ++ target = <&i2c1>; + __overlay__ { -+ backlight { -+ compatible = "gpio-backlight"; -+ gpios = <&stmpe_gpio 2 0>; -+ default-on; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ wm8731@1a { ++ #sound-dai-cells = <0>; ++ compatible = "wlf,wm8731"; ++ reg = <0x1a>; ++ status = "okay"; + }; + }; + }; + -+ __overrides__ { -+ speed = <&pitft>,"spi-max-frequency:0"; -+ rotate = <&pitft>,"rotate:0"; -+ fps = <&pitft>,"fps:0"; -+ debug = <&pitft>,"debug:0"; ++ fragment@2 { ++ target = <&sound>; ++ __overlay__ { ++ compatible = "ai,audioinjector-pi-soundcard"; ++ i2s-controller = <&i2s>; ++ status = "okay"; ++ }; + }; +}; -diff --git a/arch/arm/boot/dts/overlays/pps-gpio-overlay.dts b/arch/arm/boot/dts/overlays/pps-gpio-overlay.dts +diff --git a/arch/arm/boot/dts/overlays/bmp085_i2c-sensor-overlay.dts b/arch/arm/boot/dts/overlays/bmp085_i2c-sensor-overlay.dts new file mode 100644 -index 0000000..40bf0e1 +index 0000000..782b171 --- /dev/null -+++ b/arch/arm/boot/dts/overlays/pps-gpio-overlay.dts -@@ -0,0 +1,34 @@ ++++ b/arch/arm/boot/dts/overlays/bmp085_i2c-sensor-overlay.dts +@@ -0,0 +1,23 @@ ++// Definitions for BMP085/BMP180 digital barometric pressure and temperature sensors from Bosch Sensortec ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&i2c_arm>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ bmp085@77 { ++ compatible = "bosch,bmp085"; ++ reg = <0x77>; ++ default-oversampling = <3>; ++ status = "okay"; ++ }; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/dht11-overlay.dts b/arch/arm/boot/dts/overlays/dht11-overlay.dts +new file mode 100644 +index 0000000..9bf67fd +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/dht11-overlay.dts +@@ -0,0 +1,39 @@ ++/* ++ * Overlay for the DHT11/21/22 humidity/temperature sensor modules. ++ */ +/dts-v1/; +/plugin/; + +/ { + compatible = "brcm,bcm2708"; ++ + fragment@0 { + target-path = "/"; + __overlay__ { -+ pps: pps { -+ compatible = "pps-gpio"; ++ ++ dht11: dht11@0 { ++ compatible = "dht11"; + pinctrl-names = "default"; -+ pinctrl-0 = <&pps_pins>; -+ gpios = <&gpio 18 0>; ++ pinctrl-0 = <&dht11_pins>; ++ gpios = <&gpio 4 0>; + status = "okay"; + }; + }; @@ -112651,177 +116580,124 @@ index 0000000..40bf0e1 + fragment@1 { + target = <&gpio>; + __overlay__ { -+ pps_pins: pps_pins { -+ brcm,pins = <18>; -+ brcm,function = <0>; // in -+ brcm,pull = <0>; // off ++ dht11_pins: dht11_pins { ++ brcm,pins = <4>; ++ brcm,function = <0>; // in ++ brcm,pull = <0>; // off + }; + }; + }; + + __overrides__ { -+ gpiopin = <&pps>,"gpios:4", -+ <&pps_pins>,"brcm,pins:0"; ++ gpiopin = <&dht11_pins>,"brcm,pins:0", ++ <&dht11>,"gpios:4"; + }; +}; -diff --git a/arch/arm/boot/dts/overlays/pwm-2chan-overlay.dts b/arch/arm/boot/dts/overlays/pwm-2chan-overlay.dts +diff --git a/arch/arm/boot/dts/overlays/dpi24-overlay.dts b/arch/arm/boot/dts/overlays/dpi24-overlay.dts new file mode 100644 -index 0000000..957e1a4 +index 0000000..e4dbe40 --- /dev/null -+++ b/arch/arm/boot/dts/overlays/pwm-2chan-overlay.dts -@@ -0,0 +1,46 @@ ++++ b/arch/arm/boot/dts/overlays/dpi24-overlay.dts +@@ -0,0 +1,31 @@ +/dts-v1/; +/plugin/; + -+/* -+This is the 2-channel overlay - only use it if you need both channels. ++/{ ++ compatible = "brcm,bcm2708"; + -+Legal pin,function combinations for each channel: -+ PWM0: 12,4(Alt0) 18,2(Alt5) 40,4(Alt0) 52,5(Alt1) -+ PWM1: 13,4(Alt0) 19,2(Alt5) 41,4(Alt0) 45,4(Alt0) 53,5(Alt1) -+ -+N.B.: -+ 1) Pin 18 is the only one available on all platforms, and -+ it is the one used by the I2S audio interface. -+ Pins 12 and 13 might be better choices on an A+, B+ or Pi2. -+ 2) The onboard analogue audio output uses both PWM channels. -+ 3) So be careful mixing audio and PWM. -+*/ ++ // There is no DPI driver module, but we need a platform device ++ // node (that doesn't already use pinctrl) to hang the pinctrl ++ // reference on - leds will do + -+/ { + fragment@0 { -+ target = <&gpio>; ++ target = <&leds>; + __overlay__ { -+ pwm_pins: pwm_pins { -+ brcm,pins = <18 19>; -+ brcm,function = <2 2>; /* Alt5 */ -+ }; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&dpi24_pins>; + }; + }; + + fragment@1 { -+ target = <&pwm>; ++ target = <&gpio>; + __overlay__ { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pwm_pins>; -+ status = "okay"; ++ dpi24_pins: dpi24_pins { ++ brcm,pins = <0 1 2 3 4 5 6 7 8 9 10 11 ++ 12 13 14 15 16 17 18 19 20 ++ 21 22 23 24 25 26 27>; ++ brcm,function = <6>; /* alt2 */ ++ brcm,pull = <0>; /* no pull */ ++ }; + }; + }; -+ -+ __overrides__ { -+ pin = <&pwm_pins>,"brcm,pins:0"; -+ pin2 = <&pwm_pins>,"brcm,pins:4"; -+ func = <&pwm_pins>,"brcm,function:0"; -+ func2 = <&pwm_pins>,"brcm,function:4"; -+ clock = <&clk_pwm>,"clock-frequency:0"; -+ }; +}; -diff --git a/arch/arm/boot/dts/overlays/pwm-overlay.dts b/arch/arm/boot/dts/overlays/pwm-overlay.dts +diff --git a/arch/arm/boot/dts/overlays/dwc-otg-overlay.dts b/arch/arm/boot/dts/overlays/dwc-otg-overlay.dts new file mode 100644 -index 0000000..ddd67ff +index 0000000..fc48bd1 --- /dev/null -+++ b/arch/arm/boot/dts/overlays/pwm-overlay.dts -@@ -0,0 +1,42 @@ ++++ b/arch/arm/boot/dts/overlays/dwc-otg-overlay.dts +@@ -0,0 +1,20 @@ +/dts-v1/; +/plugin/; + -+/* -+Legal pin,function combinations for each channel: -+ PWM0: 12,4(Alt0) 18,2(Alt5) 40,4(Alt0) 52,5(Alt1) -+ PWM1: 13,4(Alt0) 19,2(Alt5) 41,4(Alt0) 45,4(Alt0) 53,5(Alt1) -+ -+N.B.: -+ 1) Pin 18 is the only one available on all platforms, and -+ it is the one used by the I2S audio interface. -+ Pins 12 and 13 might be better choices on an A+, B+ or Pi2. -+ 2) The onboard analogue audio output uses both PWM channels. -+ 3) So be careful mixing audio and PWM. -+*/ ++/{ ++ compatible = "brcm,bcm2708"; + -+/ { + fragment@0 { -+ target = <&gpio>; -+ __overlay__ { -+ pwm_pins: pwm_pins { -+ brcm,pins = <18>; -+ brcm,function = <2>; /* Alt5 */ -+ }; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&pwm>; ++ target = <&usb>; ++ #address-cells = <1>; ++ #size-cells = <1>; + __overlay__ { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pwm_pins>; ++ compatible = "brcm,bcm2708-usb"; ++ reg = <0x7e980000 0x10000>, ++ <0x7e006000 0x1000>; ++ interrupts = <2 0>, ++ <1 9>; + status = "okay"; + }; + }; -+ -+ __overrides__ { -+ pin = <&pwm_pins>,"brcm,pins:0"; -+ func = <&pwm_pins>,"brcm,function:0"; -+ clock = <&clk_pwm>,"clock-frequency:0"; -+ }; +}; -diff --git a/arch/arm/boot/dts/overlays/raspidac3-overlay.dts b/arch/arm/boot/dts/overlays/raspidac3-overlay.dts +diff --git a/arch/arm/boot/dts/overlays/dwc2-overlay.dts b/arch/arm/boot/dts/overlays/dwc2-overlay.dts new file mode 100644 -index 0000000..1bd8054 +index 0000000..527abc9 --- /dev/null -+++ b/arch/arm/boot/dts/overlays/raspidac3-overlay.dts -@@ -0,0 +1,45 @@ -+// Definitions for RaspiDACv3 ++++ b/arch/arm/boot/dts/overlays/dwc2-overlay.dts +@@ -0,0 +1,29 @@ +/dts-v1/; +/plugin/; + -+/ { ++/{ + compatible = "brcm,bcm2708"; + + fragment@0 { -+ target = <&sound>; -+ __overlay__ { -+ compatible = "jg,raspidacv3"; -+ i2s-controller = <&i2s>; -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&i2s>; -+ __overlay__ { ++ target = <&usb>; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ dwc2_usb: __overlay__ { ++ compatible = "brcm,bcm2835-usb"; ++ reg = <0x7e980000 0x10000>; ++ interrupts = <1 9>; ++ dr_mode = "otg"; ++ g-np-tx-fifo-size = <32>; ++ g-rx-fifo-size = <256>; ++ g-tx-fifo-size = <256 128 128 64 64 64 32>; + status = "okay"; + }; + }; + -+ fragment@2 { -+ target = <&i2c1>; -+ __overlay__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; -+ -+ pcm5122@4c { -+ #sound-dai-cells = <0>; -+ compatible = "ti,pcm5122"; -+ reg = <0x4c>; -+ status = "okay"; -+ }; -+ -+ tpa6130a2: tpa6130a2@60 { -+ compatible = "ti,tpa6130a2"; -+ reg = <0x60>; -+ status = "okay"; -+ }; -+ }; ++ __overrides__ { ++ dr_mode = <&dwc2_usb>, "dr_mode"; ++ g-np-tx-fifo-size = <&dwc2_usb>,"g-np-tx-fifo-size:0"; ++ g-rx-fifo-size = <&dwc2_usb>,"g-rx-fifo-size:0"; ++ g-tx-fifo-size = <&dwc2_usb>,"g-tx-fifo-size:0"; + }; +}; -diff --git a/arch/arm/boot/dts/overlays/rpi-dac-overlay.dts b/arch/arm/boot/dts/overlays/rpi-dac-overlay.dts +diff --git a/arch/arm/boot/dts/overlays/enc28j60-overlay.dts b/arch/arm/boot/dts/overlays/enc28j60-overlay.dts new file mode 100644 -index 0000000..7fc6ac99 +index 0000000..db8a8fe --- /dev/null -+++ b/arch/arm/boot/dts/overlays/rpi-dac-overlay.dts -@@ -0,0 +1,34 @@ -+// Definitions for RPi DAC ++++ b/arch/arm/boot/dts/overlays/enc28j60-overlay.dts +@@ -0,0 +1,53 @@ ++// Overlay for the Microchip ENC28J60 Ethernet Controller +/dts-v1/; +/plugin/; + @@ -112829,126 +116705,109 @@ index 0000000..7fc6ac99 + compatible = "brcm,bcm2708"; + + fragment@0 { -+ target = <&sound>; ++ target = <&spi0>; + __overlay__ { -+ compatible = "rpi,rpi-dac"; -+ i2s-controller = <&i2s>; ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ + status = "okay"; ++ ++ eth1: enc28j60@0{ ++ compatible = "microchip,enc28j60"; ++ reg = <0>; /* CE0 */ ++ pinctrl-names = "default"; ++ pinctrl-0 = <&eth1_pins>; ++ interrupt-parent = <&gpio>; ++ interrupts = <25 0x2>; /* falling edge */ ++ spi-max-frequency = <12000000>; ++ status = "okay"; ++ }; + }; + }; + + fragment@1 { -+ target = <&i2s>; ++ target = <&spidev0>; + __overlay__ { -+ status = "okay"; ++ status = "disabled"; + }; + }; + + fragment@2 { -+ target-path = "/"; ++ target = <&gpio>; + __overlay__ { -+ pcm1794a-codec { -+ #sound-dai-cells = <0>; -+ compatible = "ti,pcm1794a"; -+ status = "okay"; ++ eth1_pins: eth1_pins { ++ brcm,pins = <25>; ++ brcm,function = <0>; /* in */ ++ brcm,pull = <0>; /* none */ + }; + }; + }; ++ ++ __overrides__ { ++ int_pin = <&eth1>, "interrupts:0", ++ <&eth1_pins>, "brcm,pins:0"; ++ speed = <&eth1>, "spi-max-frequency:0"; ++ }; +}; -diff --git a/arch/arm/boot/dts/overlays/rpi-display-overlay.dts b/arch/arm/boot/dts/overlays/rpi-display-overlay.dts +diff --git a/arch/arm/boot/dts/overlays/gpio-ir-overlay.dts b/arch/arm/boot/dts/overlays/gpio-ir-overlay.dts new file mode 100644 -index 0000000..a8fa974 +index 0000000..a2d6bc7 --- /dev/null -+++ b/arch/arm/boot/dts/overlays/rpi-display-overlay.dts -@@ -0,0 +1,82 @@ -+/* -+ * Device Tree overlay for rpi-display by Watterott -+ * -+ */ -+ ++++ b/arch/arm/boot/dts/overlays/gpio-ir-overlay.dts +@@ -0,0 +1,45 @@ ++// Definitions for ir-gpio module +/dts-v1/; +/plugin/; + +/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; -+ -+ fragment@0 { -+ target = <&spi0>; -+ __overlay__ { -+ status = "okay"; -+ -+ spidev@0{ -+ status = "disabled"; -+ }; ++ compatible = "brcm,bcm2708"; + -+ spidev@1{ -+ status = "disabled"; -+ }; -+ }; -+ }; ++ fragment@0 { ++ target-path = "/"; ++ __overlay__ { ++ gpio_ir: ir-receiver { ++ compatible = "gpio-ir-receiver"; + -+ fragment@1 { -+ target = <&gpio>; -+ __overlay__ { -+ rpi_display_pins: rpi_display_pins { -+ brcm,pins = <18 23 24 25>; -+ brcm,function = <1 1 1 0>; /* out out out in */ -+ brcm,pull = <0 0 0 2>; /* - - - up */ -+ }; -+ }; -+ }; ++ // pin number, high or low ++ gpios = <&gpio 18 1>; + -+ fragment@2 { -+ target = <&spi0>; -+ __overlay__ { -+ /* needed to avoid dtc warning */ -+ #address-cells = <1>; -+ #size-cells = <0>; ++ // parameter for keymap name ++ linux,rc-map-name = "rc-rc6-mce"; + -+ rpidisplay: rpi-display@0{ -+ compatible = "ilitek,ili9341"; -+ reg = <0>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&rpi_display_pins>; ++ status = "okay"; ++ }; ++ }; ++ }; + -+ spi-max-frequency = <32000000>; -+ rotate = <270>; -+ bgr; -+ fps = <30>; -+ buswidth = <8>; -+ reset-gpios = <&gpio 23 0>; -+ dc-gpios = <&gpio 24 0>; -+ led-gpios = <&gpio 18 1>; -+ debug = <0>; -+ }; ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ gpio_ir_pins: gpio_ir_pins { ++ brcm,pins = <18>; // pin 18 ++ brcm,function = <0>; // in ++ brcm,pull = <1>; // down ++ }; ++ }; ++ }; + -+ rpidisplay_ts: rpi-display-ts@1 { -+ compatible = "ti,ads7846"; -+ reg = <1>; ++ __overrides__ { ++ // parameters ++ gpio_pin = <&gpio_ir>,"gpios:4", ++ <&gpio_ir_pins>,"brcm,pins:0", ++ <&gpio_ir_pins>,"brcm,pull:0"; // pin number ++ gpio_pull = <&gpio_ir_pins>,"brcm,pull:0"; // pull-up/down state + -+ spi-max-frequency = <2000000>; -+ interrupts = <25 2>; /* high-to-low edge triggered */ -+ interrupt-parent = <&gpio>; -+ pendown-gpio = <&gpio 25 0>; -+ ti,x-plate-ohms = /bits/ 16 <60>; -+ ti,pressure-max = /bits/ 16 <255>; -+ }; -+ }; -+ }; -+ __overrides__ { -+ speed = <&rpidisplay>,"spi-max-frequency:0"; -+ rotate = <&rpidisplay>,"rotate:0"; -+ fps = <&rpidisplay>,"fps:0"; -+ debug = <&rpidisplay>,"debug:0"; -+ xohms = <&rpidisplay_ts>,"ti,x-plate-ohms;0"; -+ }; ++ rc-map-name = <&gpio_ir>,"linux,rc-map-name"; // default rc map ++ }; +}; -diff --git a/arch/arm/boot/dts/overlays/rpi-ft5406-overlay.dts b/arch/arm/boot/dts/overlays/rpi-ft5406-overlay.dts +diff --git a/arch/arm/boot/dts/overlays/gpio-poweroff-overlay.dts b/arch/arm/boot/dts/overlays/gpio-poweroff-overlay.dts new file mode 100644 -index 0000000..2e53a17 +index 0000000..ff8cb36 --- /dev/null -+++ b/arch/arm/boot/dts/overlays/rpi-ft5406-overlay.dts -@@ -0,0 +1,17 @@ ++++ b/arch/arm/boot/dts/overlays/gpio-poweroff-overlay.dts +@@ -0,0 +1,34 @@ ++// Definitions for gpio-poweroff module +/dts-v1/; +/plugin/; + @@ -112958,21 +116817,37 @@ index 0000000..2e53a17 + fragment@0 { + target-path = "/"; + __overlay__ { -+ rpi_ft5406: rpi_ft5406 { -+ compatible = "rpi,rpi-ft5406"; -+ firmware = <&firmware>; -+ status = "okay"; ++ power_ctrl: power_ctrl { ++ compatible = "gpio-poweroff"; ++ gpios = <&gpio 26 0>; ++ force; + }; + }; + }; ++ ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ power_ctrl_pins: power_ctrl_pins { ++ brcm,pins = <26>; ++ brcm,function = <1>; // out ++ }; ++ }; ++ }; ++ ++ __overrides__ { ++ gpiopin = <&power_ctrl>,"gpios:4", ++ <&power_ctrl_pins>,"brcm,pins:0"; ++ active_low = <&power_ctrl>,"gpios:8"; ++ }; +}; -diff --git a/arch/arm/boot/dts/overlays/rpi-proto-overlay.dts b/arch/arm/boot/dts/overlays/rpi-proto-overlay.dts +diff --git a/arch/arm/boot/dts/overlays/hifiberry-amp-overlay.dts b/arch/arm/boot/dts/overlays/hifiberry-amp-overlay.dts new file mode 100644 -index 0000000..2029930 +index 0000000..5f57855 --- /dev/null -+++ b/arch/arm/boot/dts/overlays/rpi-proto-overlay.dts ++++ b/arch/arm/boot/dts/overlays/hifiberry-amp-overlay.dts @@ -0,0 +1,39 @@ -+// Definitions for Rpi-Proto ++// Definitions for HiFiBerry Amp/Amp+ +/dts-v1/; +/plugin/; + @@ -112980,367 +116855,291 @@ index 0000000..2029930 + compatible = "brcm,bcm2708"; + + fragment@0 { -+ target = <&sound>; -+ __overlay__ { -+ compatible = "rpi,rpi-proto"; -+ i2s-controller = <&i2s>; -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@1 { + target = <&i2s>; + __overlay__ { + status = "okay"; + }; + }; + -+ fragment@2 { ++ fragment@1 { + target = <&i2c1>; + __overlay__ { + #address-cells = <1>; + #size-cells = <0>; + status = "okay"; + -+ wm8731@1a { ++ tas5713@1b { + #sound-dai-cells = <0>; -+ compatible = "wlf,wm8731"; -+ reg = <0x1a>; ++ compatible = "ti,tas5713"; ++ reg = <0x1b>; + status = "okay"; + }; + }; + }; ++ ++ fragment@2 { ++ target = <&sound>; ++ __overlay__ { ++ compatible = "hifiberry,hifiberry-amp"; ++ i2s-controller = <&i2s>; ++ status = "okay"; ++ }; ++ }; +}; -diff --git a/arch/arm/boot/dts/overlays/rpi-sense-overlay.dts b/arch/arm/boot/dts/overlays/rpi-sense-overlay.dts +diff --git a/arch/arm/boot/dts/overlays/hifiberry-dac-overlay.dts b/arch/arm/boot/dts/overlays/hifiberry-dac-overlay.dts new file mode 100644 -index 0000000..2715324 +index 0000000..0b74fdc --- /dev/null -+++ b/arch/arm/boot/dts/overlays/rpi-sense-overlay.dts -@@ -0,0 +1,47 @@ -+// rpi-sense HAT ++++ b/arch/arm/boot/dts/overlays/hifiberry-dac-overlay.dts +@@ -0,0 +1,34 @@ ++// Definitions for HiFiBerry DAC +/dts-v1/; +/plugin/; + +/ { -+ compatible = "brcm,bcm2708", "brcm,bcm2709"; ++ compatible = "brcm,bcm2708"; + + fragment@0 { -+ target = <&i2c1>; ++ target = <&i2s>; + __overlay__ { -+ #address-cells = <1>; -+ #size-cells = <0>; + status = "okay"; ++ }; ++ }; + -+ rpi-sense@46 { -+ compatible = "rpi,rpi-sense"; -+ reg = <0x46>; -+ keys-int-gpios = <&gpio 23 1>; -+ status = "okay"; -+ }; -+ -+ lsm9ds1-magn@1c { -+ compatible = "st,lsm9ds1-magn"; -+ reg = <0x1c>; -+ status = "okay"; -+ }; -+ -+ lsm9ds1-accel6a { -+ compatible = "st,lsm9ds1-accel"; -+ reg = <0x6a>; -+ status = "okay"; -+ }; -+ -+ lps25h-press@5c { -+ compatible = "st,lps25h-press"; -+ reg = <0x5c>; ++ fragment@1 { ++ target-path = "/"; ++ __overlay__ { ++ pcm5102a-codec { ++ #sound-dai-cells = <0>; ++ compatible = "ti,pcm5102a"; + status = "okay"; + }; ++ }; ++ }; + -+ hts221-humid@5f { -+ compatible = "st,hts221-humid"; -+ reg = <0x5f>; -+ status = "okay"; -+ }; ++ fragment@2 { ++ target = <&sound>; ++ __overlay__ { ++ compatible = "hifiberry,hifiberry-dac"; ++ i2s-controller = <&i2s>; ++ status = "okay"; + }; + }; +}; -diff --git a/arch/arm/boot/dts/overlays/sdhost-overlay.dts b/arch/arm/boot/dts/overlays/sdhost-overlay.dts +diff --git a/arch/arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts b/arch/arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts new file mode 100644 -index 0000000..85f0725 +index 0000000..2f078d4 --- /dev/null -+++ b/arch/arm/boot/dts/overlays/sdhost-overlay.dts -@@ -0,0 +1,29 @@ ++++ b/arch/arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts +@@ -0,0 +1,56 @@ ++// Definitions for HiFiBerry DAC+ +/dts-v1/; +/plugin/; + -+/{ ++/ { + compatible = "brcm,bcm2708"; + + fragment@0 { -+ target = <&mmc>; ++ target-path = "/clocks"; + __overlay__ { -+ status = "disabled"; ++ dacpro_osc: dacpro_osc { ++ compatible = "hifiberry,dacpro-clk"; ++ #clock-cells = <0>; ++ }; + }; + }; + + fragment@1 { -+ target = <&sdhost>; -+ frag1: __overlay__ { -+ brcm,overclock-50 = <0>; -+ brcm,pio-limit = <1>; ++ target = <&i2s>; ++ __overlay__ { + status = "okay"; + }; + }; + -+ __overrides__ { -+ overclock_50 = <&frag1>,"brcm,overclock-50:0"; -+ force_pio = <&frag1>,"brcm,force-pio?"; -+ pio_limit = <&frag1>,"brcm,pio-limit:0"; -+ debug = <&frag1>,"brcm,debug?"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/sdio-overlay.dts b/arch/arm/boot/dts/overlays/sdio-overlay.dts -new file mode 100644 -index 0000000..afc8742 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/sdio-overlay.dts -@@ -0,0 +1,32 @@ -+/* Enable SDIO from MMC interface via GPIOs 22-27. Includes sdhost overlay. */ -+ -+/include/ "sdhost-overlay.dts" -+ -+/{ -+ compatible = "brcm,bcm2708"; -+ -+ fragment@3 { -+ target = <&mmc>; -+ sdio_mmc: __overlay__ { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&sdio_pins>; -+ non-removable; ++ fragment@2 { ++ target = <&i2c1>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; + status = "okay"; -+ }; -+ }; + -+ fragment@4 { -+ target = <&gpio>; -+ __overlay__ { -+ sdio_pins: sdio_pins { -+ brcm,pins = <22 23 24 25 26 27>; -+ brcm,function = <7 7 7 7 7 7>; /* ALT3 = SD1 */ -+ brcm,pull = <0 2 2 2 2 2>; ++ pcm5122@4d { ++ #sound-dai-cells = <0>; ++ compatible = "ti,pcm5122"; ++ reg = <0x4d>; ++ clocks = <&dacpro_osc>; ++ status = "okay"; + }; + }; + }; + -+ __overrides__ { -+ poll_once = <&sdio_mmc>,"non-removable?"; ++ fragment@3 { ++ target = <&sound>; ++ hifiberry_dacplus: __overlay__ { ++ compatible = "hifiberry,hifiberry-dacplus"; ++ i2s-controller = <&i2s>; ++ status = "okay"; ++ }; + }; -+}; -diff --git a/arch/arm/boot/dts/overlays/smi-dev-overlay.dts b/arch/arm/boot/dts/overlays/smi-dev-overlay.dts -new file mode 100644 -index 0000000..b610d82 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/smi-dev-overlay.dts -@@ -0,0 +1,18 @@ -+// Description: Overlay to enable character device interface for SMI. -+// Author: Luke Wren <luke@raspberrypi.org> -+ -+/dts-v1/; -+/plugin/; + -+/{ -+ fragment@0 { -+ target = <&soc>; -+ __overlay__ { -+ smi_dev { -+ compatible = "brcm,bcm2835-smi-dev"; -+ smi_handle = <&smi>; -+ status = "okay"; -+ }; -+ }; ++ __overrides__ { ++ 24db_digital_gain = ++ <&hifiberry_dacplus>,"hifiberry,24db_digital_gain?"; ++ slave = <&hifiberry_dacplus>,"hifiberry-dacplus,slave?"; + }; +}; -diff --git a/arch/arm/boot/dts/overlays/smi-nand-overlay.dts b/arch/arm/boot/dts/overlays/smi-nand-overlay.dts +diff --git a/arch/arm/boot/dts/overlays/hifiberry-digi-overlay.dts b/arch/arm/boot/dts/overlays/hifiberry-digi-overlay.dts new file mode 100644 -index 0000000..13ce0b7 +index 0000000..f5e41f4 --- /dev/null -+++ b/arch/arm/boot/dts/overlays/smi-nand-overlay.dts -@@ -0,0 +1,69 @@ -+// Description: Overlay to enable NAND flash through -+// the secondary memory interface -+// Author: Luke Wren -+ ++++ b/arch/arm/boot/dts/overlays/hifiberry-digi-overlay.dts +@@ -0,0 +1,39 @@ ++// Definitions for HiFiBerry Digi +/dts-v1/; +/plugin/; + -+/{ ++/ { + compatible = "brcm,bcm2708"; + + fragment@0 { -+ target = <&smi>; ++ target = <&i2s>; + __overlay__ { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&smi_pins>; + status = "okay"; + }; + }; + + fragment@1 { -+ target = <&soc>; ++ target = <&i2c1>; + __overlay__ { + #address-cells = <1>; -+ #size-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; + -+ nand: flash@0 { -+ compatible = "brcm,bcm2835-smi-nand"; -+ smi_handle = <&smi>; -+ #address-cells = <1>; -+ #size-cells = <1>; ++ wm8804@3b { ++ #sound-dai-cells = <0>; ++ compatible = "wlf,wm8804"; ++ reg = <0x3b>; + status = "okay"; -+ -+ partition@0 { -+ label = "stage2"; -+ // 128k -+ reg = <0 0x20000>; -+ read-only; -+ }; -+ partition@1 { -+ label = "firmware"; -+ // 16M -+ reg = <0x20000 0x1000000>; -+ read-only; -+ }; -+ partition@2 { -+ label = "root"; -+ // 2G (will need to use 64 bit for >=4G) -+ reg = <0x1020000 0x80000000>; -+ }; + }; + }; + }; + + fragment@2 { -+ target = <&gpio>; ++ target = <&sound>; + __overlay__ { -+ smi_pins: smi_pins { -+ brcm,pins = <0 1 2 3 4 5 6 7 8 9 10 11 -+ 12 13 14 15>; -+ /* Alt 1: SMI */ -+ brcm,function = <5 5 5 5 5 5 5 5 5 5 5 -+ 5 5 5 5 5>; -+ /* /CS, /WE and /OE are pulled high, as they are -+ generally active low signals */ -+ brcm,pull = <2 2 2 2 2 2 2 2 0 0 0 0 0 0 0 0>; -+ }; ++ compatible = "hifiberry,hifiberry-digi"; ++ i2s-controller = <&i2s>; ++ status = "okay"; + }; + }; +}; -diff --git a/arch/arm/boot/dts/overlays/smi-overlay.dts b/arch/arm/boot/dts/overlays/smi-overlay.dts +diff --git a/arch/arm/boot/dts/overlays/hy28a-overlay.dts b/arch/arm/boot/dts/overlays/hy28a-overlay.dts new file mode 100644 -index 0000000..095f52c +index 0000000..ac0f3c2 --- /dev/null -+++ b/arch/arm/boot/dts/overlays/smi-overlay.dts -@@ -0,0 +1,37 @@ -+// Description: Overlay to enable the secondary memory interface peripheral -+// Author: Luke Wren ++++ b/arch/arm/boot/dts/overlays/hy28a-overlay.dts +@@ -0,0 +1,93 @@ ++/* ++ * Device Tree overlay for HY28A display ++ * ++ */ + +/dts-v1/; +/plugin/; + -+/{ -+ compatible = "brcm,bcm2708"; ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; + + fragment@0 { -+ target = <&smi>; ++ target = <&spi0>; + __overlay__ { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&smi_pins>; + status = "okay"; + }; + }; + + fragment@1 { -+ target = <&gpio>; ++ target = <&spidev0>; + __overlay__ { -+ smi_pins: smi_pins { -+ /* Don't configure the top two address bits, as -+ these are already used as ID_SD and ID_SC */ -+ brcm,pins = <2 3 4 5 6 7 8 9 10 11 12 13 14 15 -+ 16 17 18 19 20 21 22 23 24 25>; -+ /* Alt 0: SMI */ -+ brcm,function = <5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 -+ 5 5 5 5 5 5 5 5 5>; -+ /* /CS, /WE and /OE are pulled high, as they are -+ generally active low signals */ -+ brcm,pull = <2 2 2 2 2 2 0 0 0 0 0 0 0 0 0 0 0 -+ 0 0 0 0 0 0 0>; -+ }; ++ status = "disabled"; + }; + }; -+}; -diff --git a/arch/arm/boot/dts/overlays/spi-gpio35-39-overlay.dts b/arch/arm/boot/dts/overlays/spi-gpio35-39-overlay.dts -new file mode 100644 -index 0000000..9648063 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/spi-gpio35-39-overlay.dts -@@ -0,0 +1,31 @@ -+/* -+ * Device tree overlay to move spi0 to gpio 35 to 39 on CM -+ */ -+ -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2836", "brcm,bcm2708", "brcm,bcm2709"; + -+ fragment@0 { -+ target = <&spi0>; ++ fragment@2 { ++ target = <&spidev1>; + __overlay__ { -+ cs-gpios = <&gpio 36 1>, <&gpio 35 1>; ++ status = "disabled"; + }; + }; + -+ fragment@1 { -+ target = <&spi0_cs_pins>; ++ fragment@3 { ++ target = <&gpio>; + __overlay__ { -+ bcrm,pins = <36 35>; ++ hy28a_pins: hy28a_pins { ++ brcm,pins = <17 25 18>; ++ brcm,function = <0 1 1>; /* in out out */ ++ }; + }; + }; + -+ fragment@2 { -+ target = <&spi0_pins>; ++ fragment@4 { ++ target = <&spi0>; + __overlay__ { -+ bcrm,pins = <37 38 39>; ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ hy28a: hy28a@0{ ++ compatible = "ilitek,ili9320"; ++ reg = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&hy28a_pins>; ++ ++ spi-max-frequency = <32000000>; ++ spi-cpol; ++ spi-cpha; ++ rotate = <270>; ++ bgr; ++ fps = <50>; ++ buswidth = <8>; ++ startbyte = <0x70>; ++ reset-gpios = <&gpio 25 0>; ++ led-gpios = <&gpio 18 1>; ++ debug = <0>; ++ }; ++ ++ hy28a_ts: hy28a-ts@1 { ++ compatible = "ti,ads7846"; ++ reg = <1>; ++ ++ spi-max-frequency = <2000000>; ++ interrupts = <17 2>; /* high-to-low edge triggered */ ++ interrupt-parent = <&gpio>; ++ pendown-gpio = <&gpio 17 0>; ++ ti,x-plate-ohms = /bits/ 16 <100>; ++ ti,pressure-max = /bits/ 16 <255>; ++ }; + }; + }; ++ __overrides__ { ++ speed = <&hy28a>,"spi-max-frequency:0"; ++ rotate = <&hy28a>,"rotate:0"; ++ fps = <&hy28a>,"fps:0"; ++ debug = <&hy28a>,"debug:0"; ++ xohms = <&hy28a_ts>,"ti,x-plate-ohms;0"; ++ resetgpio = <&hy28a>,"reset-gpios:4", ++ <&hy28a_pins>, "brcm,pins:1"; ++ ledgpio = <&hy28a>,"led-gpios:4", ++ <&hy28a_pins>, "brcm,pins:2"; ++ }; +}; -diff --git a/arch/arm/boot/dts/overlays/tinylcd35-overlay.dts b/arch/arm/boot/dts/overlays/tinylcd35-overlay.dts +diff --git a/arch/arm/boot/dts/overlays/hy28b-overlay.dts b/arch/arm/boot/dts/overlays/hy28b-overlay.dts new file mode 100644 -index 0000000..f7102c8 +index 0000000..8018aeb --- /dev/null -+++ b/arch/arm/boot/dts/overlays/tinylcd35-overlay.dts -@@ -0,0 +1,216 @@ ++++ b/arch/arm/boot/dts/overlays/hy28b-overlay.dts +@@ -0,0 +1,148 @@ +/* -+ * tinylcd35-overlay.dts -+ * -+ * ------------------------------------------------- -+ * www.tinlylcd.com -+ * ------------------------------------------------- -+ * Device---Driver-----BUS GPIO's -+ * display tinylcd35 spi0.0 25 24 18 -+ * touch ads7846 spi0.1 5 -+ * rtc ds1307 i2c1-0068 -+ * rtc pcf8563 i2c1-0051 -+ * keypad gpio-keys --------- 17 22 27 23 28 -+ * -+ * -+ * TinyLCD.com 3.5 inch TFT -+ * -+ * Version 001 -+ * 5/3/2015 -- Noralf Trønnes Initial Device tree framework -+ * 10/3/2015 -- tinylcd@gmail.com added ds1307 support. ++ * Device Tree overlay for HY28b display shield by Texy + * + */ + @@ -113354,196 +117153,325 @@ index 0000000..f7102c8 + target = <&spi0>; + __overlay__ { + status = "okay"; ++ }; ++ }; + -+ spidev@0{ -+ status = "disabled"; -+ }; ++ fragment@1 { ++ target = <&spidev0>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; + -+ spidev@1{ -+ status = "disabled"; -+ }; ++ fragment@2 { ++ target = <&spidev1>; ++ __overlay__ { ++ status = "disabled"; + }; + }; + -+ fragment@1 { ++ fragment@3 { + target = <&gpio>; + __overlay__ { -+ tinylcd35_pins: tinylcd35_pins { -+ brcm,pins = <25 24 18>; -+ brcm,function = <1>; /* out */ -+ }; -+ tinylcd35_ts_pins: tinylcd35_ts_pins { -+ brcm,pins = <5>; -+ brcm,function = <0>; /* in */ -+ }; -+ keypad_pins: keypad_pins { -+ brcm,pins = <4 17 22 23 27>; -+ brcm,function = <0>; /* in */ -+ brcm,pull = <1>; /* down */ ++ hy28b_pins: hy28b_pins { ++ brcm,pins = <17 25 18>; ++ brcm,function = <0 1 1>; /* in out out */ + }; + }; + }; + -+ fragment@2 { ++ fragment@4 { + target = <&spi0>; + __overlay__ { + /* needed to avoid dtc warning */ + #address-cells = <1>; + #size-cells = <0>; + -+ tinylcd35: tinylcd35@0{ -+ compatible = "neosec,tinylcd"; ++ hy28b: hy28b@0{ ++ compatible = "ilitek,ili9325"; + reg = <0>; + pinctrl-names = "default"; -+ pinctrl-0 = <&tinylcd35_pins>, -+ <&tinylcd35_ts_pins>; ++ pinctrl-0 = <&hy28b_pins>; + + spi-max-frequency = <48000000>; ++ spi-cpol; ++ spi-cpha; + rotate = <270>; -+ fps = <20>; + bgr; ++ fps = <50>; + buswidth = <8>; ++ startbyte = <0x70>; + reset-gpios = <&gpio 25 0>; -+ dc-gpios = <&gpio 24 0>; + led-gpios = <&gpio 18 1>; -+ debug = <0>; + -+ init = <0x10000B0 0x80 -+ 0x10000C0 0x0A 0x0A -+ 0x10000C1 0x01 0x01 -+ 0x10000C2 0x33 -+ 0x10000C5 0x00 0x42 0x80 -+ 0x10000B1 0xD0 0x11 -+ 0x10000B4 0x02 -+ 0x10000B6 0x00 0x22 0x3B -+ 0x10000B7 0x07 -+ 0x1000036 0x58 -+ 0x10000F0 0x36 0xA5 0xD3 -+ 0x10000E5 0x80 -+ 0x10000E5 0x01 -+ 0x10000B3 0x00 -+ 0x10000E5 0x00 -+ 0x10000F0 0x36 0xA5 0x53 -+ 0x10000E0 0x00 0x35 0x33 0x00 0x00 0x00 0x00 0x35 0x33 0x00 0x00 0x00 -+ 0x100003A 0x55 -+ 0x1000011 -+ 0x2000001 -+ 0x1000029>; ++ gamma = "04 1F 4 7 7 0 7 7 6 0\n0F 00 1 7 4 0 0 0 6 7"; ++ ++ init = <0x10000e7 0x0010 ++ 0x1000000 0x0001 ++ 0x1000001 0x0100 ++ 0x1000002 0x0700 ++ 0x1000003 0x1030 ++ 0x1000004 0x0000 ++ 0x1000008 0x0207 ++ 0x1000009 0x0000 ++ 0x100000a 0x0000 ++ 0x100000c 0x0001 ++ 0x100000d 0x0000 ++ 0x100000f 0x0000 ++ 0x1000010 0x0000 ++ 0x1000011 0x0007 ++ 0x1000012 0x0000 ++ 0x1000013 0x0000 ++ 0x2000032 ++ 0x1000010 0x1590 ++ 0x1000011 0x0227 ++ 0x2000032 ++ 0x1000012 0x009c ++ 0x2000032 ++ 0x1000013 0x1900 ++ 0x1000029 0x0023 ++ 0x100002b 0x000e ++ 0x2000032 ++ 0x1000020 0x0000 ++ 0x1000021 0x0000 ++ 0x2000032 ++ 0x1000050 0x0000 ++ 0x1000051 0x00ef ++ 0x1000052 0x0000 ++ 0x1000053 0x013f ++ 0x1000060 0xa700 ++ 0x1000061 0x0001 ++ 0x100006a 0x0000 ++ 0x1000080 0x0000 ++ 0x1000081 0x0000 ++ 0x1000082 0x0000 ++ 0x1000083 0x0000 ++ 0x1000084 0x0000 ++ 0x1000085 0x0000 ++ 0x1000090 0x0010 ++ 0x1000092 0x0000 ++ 0x1000093 0x0003 ++ 0x1000095 0x0110 ++ 0x1000097 0x0000 ++ 0x1000098 0x0000 ++ 0x1000007 0x0133 ++ 0x1000020 0x0000 ++ 0x1000021 0x0000 ++ 0x2000064>; ++ debug = <0>; + }; + -+ tinylcd35_ts: tinylcd35_ts@1 { ++ hy28b_ts: hy28b-ts@1 { + compatible = "ti,ads7846"; + reg = <1>; -+ status = "disabled"; + + spi-max-frequency = <2000000>; -+ interrupts = <5 2>; /* high-to-low edge triggered */ ++ interrupts = <17 2>; /* high-to-low edge triggered */ + interrupt-parent = <&gpio>; -+ pendown-gpio = <&gpio 5 0>; ++ pendown-gpio = <&gpio 17 0>; + ti,x-plate-ohms = /bits/ 16 <100>; + ti,pressure-max = /bits/ 16 <255>; + }; + }; + }; ++ __overrides__ { ++ speed = <&hy28b>,"spi-max-frequency:0"; ++ rotate = <&hy28b>,"rotate:0"; ++ fps = <&hy28b>,"fps:0"; ++ debug = <&hy28b>,"debug:0"; ++ xohms = <&hy28b_ts>,"ti,x-plate-ohms;0"; ++ resetgpio = <&hy28b>,"reset-gpios:4", ++ <&hy28b_pins>, "brcm,pins:1"; ++ ledgpio = <&hy28b>,"led-gpios:4", ++ <&hy28b_pins>, "brcm,pins:2"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/i2c-gpio-overlay.dts b/arch/arm/boot/dts/overlays/i2c-gpio-overlay.dts +new file mode 100644 +index 0000000..2a2dc98 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/i2c-gpio-overlay.dts +@@ -0,0 +1,28 @@ ++// Overlay for i2c_gpio bitbanging host bus. ++/dts-v1/; ++/plugin/; + -+ /* RTC */ ++/ { ++ compatible = "brcm,bcm2708"; + -+ fragment@3 { -+ target = <&i2c1>; ++ fragment@0 { ++ target-path = "/"; + __overlay__ { ++ i2c_gpio: i2c@0 { ++ compatible = "i2c-gpio"; ++ gpios = <&gpio 23 0 /* sda */ ++ &gpio 24 0 /* scl */ ++ >; ++ i2c-gpio,delay-us = <2>; /* ~100 kHz */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ }; ++ }; ++ }; ++ __overrides__ { ++ i2c_gpio_sda = <&i2c_gpio>,"gpios:4"; ++ i2c_gpio_scl = <&i2c_gpio>,"gpios:16"; ++ i2c_gpio_delay_us = <&i2c_gpio>,"i2c-gpio,delay-us:0"; ++ }; ++}; ++ +diff --git a/arch/arm/boot/dts/overlays/i2c-mux-overlay.dts b/arch/arm/boot/dts/overlays/i2c-mux-overlay.dts +new file mode 100644 +index 0000000..976d38e +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/i2c-mux-overlay.dts +@@ -0,0 +1,139 @@ ++// Umbrella I2C Mux overlay ++ ++/dts-v1/; ++/plugin/; ++ ++/{ ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&i2c_arm>; ++ __dormant__ { + #address-cells = <1>; + #size-cells = <0>; ++ status = "okay"; + -+ pcf8563: pcf8563@51 { -+ compatible = "nxp,pcf8563"; -+ reg = <0x51>; -+ status = "disabled"; ++ pca9542: mux@70 { ++ compatible = "nxp,pca9542"; ++ reg = <0x70>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ i2c@0 { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ reg = <0>; ++ }; ++ i2c@1 { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ reg = <1>; ++ }; + }; + }; + }; + -+ fragment@4 { -+ target = <&i2c1>; -+ __overlay__ { ++ fragment@1 { ++ target = <&i2c_arm>; ++ __dormant__ { + #address-cells = <1>; + #size-cells = <0>; ++ status = "okay"; + -+ ds1307: ds1307@68 { -+ compatible = "maxim,ds1307"; -+ reg = <0x68>; -+ status = "disabled"; ++ pca9545: mux@70 { ++ compatible = "nxp,pca9545"; ++ reg = <0x70>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ i2c@0 { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ reg = <0>; ++ }; ++ i2c@1 { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ reg = <1>; ++ }; ++ i2c@2 { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ reg = <2>; ++ }; ++ i2c@3 { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ reg = <3>; ++ }; + }; + }; + }; + -+ /* -+ * Values for input event code is found under the -+ * 'Keys and buttons' heading in include/uapi/linux/input.h -+ */ -+ fragment@5 { -+ target-path = "/soc"; -+ __overlay__ { -+ keypad: keypad { -+ compatible = "gpio-keys"; ++ fragment@2 { ++ target = <&i2c_arm>; ++ __dormant__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ pca9548: mux@70 { ++ compatible = "nxp,pca9548"; ++ reg = <0x70>; + #address-cells = <1>; + #size-cells = <0>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&keypad_pins>; -+ status = "disabled"; -+ autorepeat; + -+ button@17 { -+ label = "GPIO KEY_UP"; -+ linux,code = <103>; -+ gpios = <&gpio 17 0>; ++ i2c@0 { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ reg = <0>; + }; -+ button@22 { -+ label = "GPIO KEY_DOWN"; -+ linux,code = <108>; -+ gpios = <&gpio 22 0>; ++ i2c@1 { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ reg = <1>; + }; -+ button@27 { -+ label = "GPIO KEY_LEFT"; -+ linux,code = <105>; -+ gpios = <&gpio 27 0>; ++ i2c@2 { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ reg = <2>; + }; -+ button@23 { -+ label = "GPIO KEY_RIGHT"; -+ linux,code = <106>; -+ gpios = <&gpio 23 0>; ++ i2c@3 { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ reg = <3>; + }; -+ button@4 { -+ label = "GPIO KEY_ENTER"; -+ linux,code = <28>; -+ gpios = <&gpio 4 0>; ++ i2c@4 { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ reg = <4>; ++ }; ++ i2c@5 { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ reg = <5>; ++ }; ++ i2c@6 { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ reg = <6>; ++ }; ++ i2c@7 { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ reg = <7>; + }; + }; + }; + }; + + __overrides__ { -+ speed = <&tinylcd35>,"spi-max-frequency:0"; -+ rotate = <&tinylcd35>,"rotate:0"; -+ fps = <&tinylcd35>,"fps:0"; -+ debug = <&tinylcd35>,"debug:0"; -+ touch = <&tinylcd35_ts>,"status"; -+ touchgpio = <&tinylcd35_ts_pins>,"brcm,pins:0", -+ <&tinylcd35_ts>,"interrupts:0", -+ <&tinylcd35_ts>,"pendown-gpio:4"; -+ xohms = <&tinylcd35_ts>,"ti,x-plate-ohms;0"; -+ rtc-pcf = <&i2c1>,"status", -+ <&pcf8563>,"status"; -+ rtc-ds = <&i2c1>,"status", -+ <&ds1307>,"status"; -+ keypad = <&keypad>,"status"; ++ pca9542 = <0>, "+0"; ++ pca9545 = <0>, "+1"; ++ pca9548 = <0>, "+2"; ++ ++ addr = <&pca9542>,"reg:0", ++ <&pca9545>,"reg:0", ++ <&pca9548>,"reg:0"; + }; +}; -diff --git a/arch/arm/boot/dts/overlays/uart1-overlay.dts b/arch/arm/boot/dts/overlays/uart1-overlay.dts +diff --git a/arch/arm/boot/dts/overlays/i2c-pwm-pca9685a-overlay.dts b/arch/arm/boot/dts/overlays/i2c-pwm-pca9685a-overlay.dts new file mode 100644 -index 0000000..fa73e1f +index 0000000..d1ffd23 --- /dev/null -+++ b/arch/arm/boot/dts/overlays/uart1-overlay.dts -@@ -0,0 +1,38 @@ ++++ b/arch/arm/boot/dts/overlays/i2c-pwm-pca9685a-overlay.dts +@@ -0,0 +1,26 @@ ++// Definitions for NXP PCA9685A I2C PWM controller on ARM I2C bus. +/dts-v1/; +/plugin/; + @@ -113551,80 +117479,308 @@ index 0000000..fa73e1f + compatible = "brcm,bcm2708"; + + fragment@0 { -+ target = <&uart1>; ++ target = <&i2c_arm>; + __overlay__ { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&uart1_pins>; ++ #address-cells = <1>; ++ #size-cells = <0>; + status = "okay"; -+ }; -+ }; + -+ fragment@1 { -+ target = <&gpio>; -+ __overlay__ { -+ uart1_pins: uart1_pins { -+ brcm,pins = <14 15>; -+ brcm,function = <2>; /* alt5 */ -+ brcm,pull = <0 2>; ++ pca: pca@40 { ++ compatible = "nxp,pca9685"; ++ #pwm-cells = <2>; ++ reg = <0x40>; ++ status = "okay"; + }; + }; + }; -+ -+ fragment@2 { -+ target-path = "/chosen"; -+ __overlay__ { -+ bootargs = "8250.nr_uarts=1"; -+ }; -+ }; -+ + __overrides__ { -+ txd1_pin = <&uart1_pins>,"brcm,pins:0"; -+ rxd1_pin = <&uart1_pins>,"brcm,pins:4"; ++ addr = <&pca>,"reg:0"; + }; +}; -diff --git a/arch/arm/boot/dts/overlays/vga666-overlay.dts b/arch/arm/boot/dts/overlays/vga666-overlay.dts +diff --git a/arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts b/arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts new file mode 100644 -index 0000000..7fcab96 +index 0000000..4065647 --- /dev/null -+++ b/arch/arm/boot/dts/overlays/vga666-overlay.dts -@@ -0,0 +1,30 @@ ++++ b/arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts +@@ -0,0 +1,69 @@ ++// Definitions for several I2C based Real Time Clocks +/dts-v1/; +/plugin/; + -+/{ ++/ { + compatible = "brcm,bcm2708"; + -+ // There is no VGA driver module, but we need a platform device -+ // node (that doesn't already use pinctrl) to hang the pinctrl -+ // reference on - leds will do -+ + fragment@0 { -+ target = <&leds>; ++ target = <&i2c_arm>; + __overlay__ { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&vga666_pins>; -+ }; -+ }; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ ds1307: ds1307@68 { ++ compatible = "maxim,ds1307"; ++ reg = <0x68>; ++ status = "disable"; ++ }; ++ ds1339: ds1339@68 { ++ compatible = "dallas,ds1339"; ++ trickle-resistor-ohms = <0>; ++ reg = <0x68>; ++ status = "disable"; ++ }; ++ mcp7940x: mcp7940x@6f { ++ compatible = "microchip,mcp7940x"; ++ reg = <0x6f>; ++ status = "disable"; ++ }; ++ mcp7941x: mcp7941x@6f { ++ compatible = "microchip,mcp7941x"; ++ reg = <0x6f>; ++ status = "disable"; ++ }; ++ ds3231: ds3231@68 { ++ compatible = "maxim,ds3231"; ++ reg = <0x68>; ++ status = "disable"; ++ }; ++ pcf2127: pcf2127@51 { ++ compatible = "nxp,pcf2127"; ++ reg = <0x51>; ++ status = "disable"; ++ }; ++ pcf8523: pcf8523@68 { ++ compatible = "nxp,pcf8523"; ++ reg = <0x68>; ++ status = "disable"; ++ }; ++ pcf8563: pcf8563@51 { ++ compatible = "nxp,pcf8563"; ++ reg = <0x51>; ++ status = "disable"; ++ }; ++ }; ++ }; ++ __overrides__ { ++ ds1307 = <&ds1307>,"status"; ++ ds1339 = <&ds1339>,"status"; ++ ds3231 = <&ds3231>,"status"; ++ mcp7940x = <&mcp7940x>,"status"; ++ mcp7941x = <&mcp7941x>,"status"; ++ pcf2127 = <&pcf2127>,"status"; ++ pcf8523 = <&pcf8523>,"status"; ++ pcf8563 = <&pcf8563>,"status"; ++ trickle-resistor-ohms = <&ds1339>,"trickle-resistor-ohms:0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/i2c0-bcm2708-overlay.dts b/arch/arm/boot/dts/overlays/i2c0-bcm2708-overlay.dts +new file mode 100644 +index 0000000..1f4fc7b +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/i2c0-bcm2708-overlay.dts +@@ -0,0 +1,61 @@ ++/* ++ * Device tree overlay for i2c_bcm2708, i2c0 bus ++ * ++ * Compile: ++ * dtc -@ -I dts -O dtb -o i2c0-bcm2708-overlay.dtb i2c0-bcm2708-overlay.dts ++ */ ++ ++/dts-v1/; ++/plugin/; ++ ++/{ ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&i2c0>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&i2c0_pins>; ++ frag1: __overlay__ { ++ brcm,pins = <0 1>; ++ brcm,function = <4>; /* alt0 */ ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&i2c0_pins>; ++ __dormant__ { ++ brcm,pins = <28 29>; ++ brcm,function = <4>; /* alt0 */ ++ }; ++ }; ++ ++ fragment@3 { ++ target = <&i2c0_pins>; ++ __dormant__ { ++ brcm,pins = <44 45>; ++ brcm,function = <5>; /* alt1 */ ++ }; ++ }; ++ ++ fragment@4 { ++ target = <&i2c0_pins>; ++ __dormant__ { ++ brcm,pins = <46 47>; ++ brcm,function = <4>; /* alt0 */ ++ }; ++ }; ++ ++ __overrides__ { ++ sda0_pin = <&frag1>,"brcm,pins:0"; ++ scl0_pin = <&frag1>,"brcm,pins:4"; ++ pins_0_1 = <0>,"+1-2-3-4"; ++ pins_28_29 = <0>,"-1+2-3-4"; ++ pins_44_45 = <0>,"-1-2+3-4"; ++ pins_46_47 = <0>,"-1-2-3+4"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/i2c1-bcm2708-overlay.dts b/arch/arm/boot/dts/overlays/i2c1-bcm2708-overlay.dts +new file mode 100644 +index 0000000..e303b9c +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/i2c1-bcm2708-overlay.dts +@@ -0,0 +1,37 @@ ++/* ++ * Device tree overlay for i2c_bcm2708, i2c1 bus ++ * ++ * Compile: ++ * dtc -@ -I dts -O dtb -o i2c1-bcm2708-overlay.dtb i2c1-bcm2708-overlay.dts ++ */ ++ ++/dts-v1/; ++/plugin/; ++ ++/{ ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&i2c1>; ++ __overlay__ { ++ pinctrl-0 = <&i2c1_pins>; ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ i2c1_pins: i2c1 { ++ brcm,pins = <2 3>; ++ brcm,function = <4>; /* alt0 */ ++ }; ++ }; ++ }; ++ ++ __overrides__ { ++ sda1_pin = <&i2c1_pins>,"brcm,pins:0"; ++ scl1_pin = <&i2c1_pins>,"brcm,pins:4"; ++ pin_func = <&i2c1_pins>,"brcm,function:0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/i2s-gpio28-31-overlay.dts b/arch/arm/boot/dts/overlays/i2s-gpio28-31-overlay.dts +new file mode 100644 +index 0000000..30c356d6 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/i2s-gpio28-31-overlay.dts +@@ -0,0 +1,18 @@ ++/* ++ * Device tree overlay to move i2s to gpio 28 to 31 on CM ++ */ ++ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2836", "brcm,bcm2708", "brcm,bcm2709"; ++ ++ fragment@0 { ++ target = <&i2s_pins>; ++ __overlay__ { ++ brcm,pins = <28 29 30 31>; ++ brcm,function = <6>; /* alt2 */ ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/i2s-mmap-overlay.dts b/arch/arm/boot/dts/overlays/i2s-mmap-overlay.dts +new file mode 100644 +index 0000000..a11160a +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/i2s-mmap-overlay.dts +@@ -0,0 +1,13 @@ ++/dts-v1/; ++/plugin/; ++ ++/{ ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&i2s>; ++ __overlay__ { ++ brcm,enable-mmap; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/iqaudio-dac-overlay.dts b/arch/arm/boot/dts/overlays/iqaudio-dac-overlay.dts +new file mode 100644 +index 0000000..0d35c85 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/iqaudio-dac-overlay.dts +@@ -0,0 +1,43 @@ ++// Definitions for IQaudIO DAC ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&i2s>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; + + fragment@1 { -+ target = <&gpio>; ++ target = <&i2c1>; + __overlay__ { -+ vga666_pins: vga666_pins { -+ brcm,pins = <2 3 4 5 6 7 8 9 10 11 12 -+ 13 14 15 16 17 18 19 20 21>; -+ brcm,function = <6>; /* alt2 */ -+ brcm,pull = <0>; /* no pull */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ pcm5122@4c { ++ #sound-dai-cells = <0>; ++ compatible = "ti,pcm5122"; ++ reg = <0x4c>; ++ status = "okay"; + }; + }; + }; ++ ++ fragment@2 { ++ target = <&sound>; ++ frag2: __overlay__ { ++ compatible = "iqaudio,iqaudio-dac"; ++ i2s-controller = <&i2s>; ++ status = "okay"; ++ }; ++ }; ++ ++ __overrides__ { ++ 24db_digital_gain = <&frag2>,"iqaudio,24db_digital_gain?"; ++ }; +}; -diff --git a/arch/arm/boot/dts/overlays/w1-gpio-overlay.dts b/arch/arm/boot/dts/overlays/w1-gpio-overlay.dts +diff --git a/arch/arm/boot/dts/overlays/iqaudio-dacplus-overlay.dts b/arch/arm/boot/dts/overlays/iqaudio-dacplus-overlay.dts new file mode 100644 -index 0000000..29a3b48 +index 0000000..1d0663e --- /dev/null -+++ b/arch/arm/boot/dts/overlays/w1-gpio-overlay.dts -@@ -0,0 +1,39 @@ -+// Definitions for w1-gpio module (without external pullup) ++++ b/arch/arm/boot/dts/overlays/iqaudio-dacplus-overlay.dts +@@ -0,0 +1,43 @@ ++// Definitions for IQaudIO DAC+ +/dts-v1/; +/plugin/; + @@ -113632,44 +117788,97 @@ index 0000000..29a3b48 + compatible = "brcm,bcm2708"; + + fragment@0 { -+ target-path = "/"; ++ target = <&i2s>; + __overlay__ { ++ status = "okay"; ++ }; ++ }; + -+ w1: onewire@0 { -+ compatible = "w1-gpio"; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&w1_pins>; -+ gpios = <&gpio 4 0>; -+ rpi,parasitic-power = <0>; ++ fragment@1 { ++ target = <&i2c1>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ pcm5122@4c { ++ #sound-dai-cells = <0>; ++ compatible = "ti,pcm5122"; ++ reg = <0x4c>; + status = "okay"; + }; + }; + }; + ++ fragment@2 { ++ target = <&sound>; ++ frag2: __overlay__ { ++ compatible = "iqaudio,iqaudio-dac"; ++ i2s-controller = <&i2s>; ++ status = "okay"; ++ }; ++ }; ++ ++ __overrides__ { ++ 24db_digital_gain = <&frag2>,"iqaudio,24db_digital_gain?"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/justboom-dac-overlay.dts b/arch/arm/boot/dts/overlays/justboom-dac-overlay.dts +new file mode 100644 +index 0000000..312632a +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/justboom-dac-overlay.dts +@@ -0,0 +1,43 @@ ++// Definitions for JustBoom DAC ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&i2s>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ + fragment@1 { -+ target = <&gpio>; ++ target = <&i2c1>; + __overlay__ { -+ w1_pins: w1_pins { -+ brcm,pins = <4>; -+ brcm,function = <0>; // in (initially) -+ brcm,pull = <0>; // off ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ pcm5122@4d { ++ #sound-dai-cells = <0>; ++ compatible = "ti,pcm5122"; ++ reg = <0x4d>; ++ status = "okay"; + }; + }; + }; + ++ fragment@2 { ++ target = <&sound>; ++ frag2: __overlay__ { ++ compatible = "justboom,justboom-dac"; ++ i2s-controller = <&i2s>; ++ status = "okay"; ++ }; ++ }; ++ + __overrides__ { -+ gpiopin = <&w1>,"gpios:4", -+ <&w1_pins>,"brcm,pins:0"; -+ pullup = <&w1>,"rpi,parasitic-power:0"; ++ 24db_digital_gain = <&frag2>,"justboom,24db_digital_gain?"; + }; +}; -diff --git a/arch/arm/boot/dts/overlays/w1-gpio-pullup-overlay.dts b/arch/arm/boot/dts/overlays/w1-gpio-pullup-overlay.dts +diff --git a/arch/arm/boot/dts/overlays/justboom-digi-overlay.dts b/arch/arm/boot/dts/overlays/justboom-digi-overlay.dts new file mode 100644 -index 0000000..66a98f6 +index 0000000..cbbede9 --- /dev/null -+++ b/arch/arm/boot/dts/overlays/w1-gpio-pullup-overlay.dts -@@ -0,0 +1,41 @@ -+// Definitions for w1-gpio module (with external pullup) ++++ b/arch/arm/boot/dts/overlays/justboom-digi-overlay.dts +@@ -0,0 +1,39 @@ ++// Definitions for JustBoom Digi +/dts-v1/; +/plugin/; + @@ -113677,16 +117886,74 @@ index 0000000..66a98f6 + compatible = "brcm,bcm2708"; + + fragment@0 { -+ target-path = "/"; ++ target = <&i2s>; + __overlay__ { ++ status = "okay"; ++ }; ++ }; + -+ w1: onewire@0 { -+ compatible = "w1-gpio"; ++ fragment@1 { ++ target = <&i2c1>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ wm8804@3b { ++ #sound-dai-cells = <0>; ++ compatible = "wlf,wm8804"; ++ reg = <0x3b>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&sound>; ++ __overlay__ { ++ compatible = "justboom,justboom-digi"; ++ i2s-controller = <&i2s>; ++ status = "okay"; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/lirc-rpi-overlay.dts b/arch/arm/boot/dts/overlays/lirc-rpi-overlay.dts +new file mode 100644 +index 0000000..7d5d82b +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/lirc-rpi-overlay.dts +@@ -0,0 +1,57 @@ ++// Definitions for lirc-rpi module ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target-path = "/"; ++ __overlay__ { ++ lirc_rpi: lirc_rpi { ++ compatible = "rpi,lirc-rpi"; + pinctrl-names = "default"; -+ pinctrl-0 = <&w1_pins>; -+ gpios = <&gpio 4 0>, <&gpio 5 1>; -+ rpi,parasitic-power = <0>; ++ pinctrl-0 = <&lirc_pins>; + status = "okay"; ++ ++ // Override autodetection of IR receiver circuit ++ // (0 = active high, 1 = active low, -1 = no override ) ++ rpi,sense = <0xffffffff>; ++ ++ // Software carrier ++ // (0 = off, 1 = on) ++ rpi,softcarrier = <1>; ++ ++ // Invert output ++ // (0 = off, 1 = on) ++ rpi,invert = <0>; ++ ++ // Enable debugging messages ++ // (0 = off, 1 = on) ++ rpi,debug = <0>; + }; + }; + }; @@ -113694,3499 +117961,3204 @@ index 0000000..66a98f6 + fragment@1 { + target = <&gpio>; + __overlay__ { -+ w1_pins: w1_pins { -+ brcm,pins = <4 5>; -+ brcm,function = <0 1>; // in out -+ brcm,pull = <0 0>; // off off ++ lirc_pins: lirc_pins { ++ brcm,pins = <17 18>; ++ brcm,function = <1 0>; // out in ++ brcm,pull = <0 1>; // off down + }; + }; + }; + + __overrides__ { -+ gpiopin = <&w1>,"gpios:4", -+ <&w1_pins>,"brcm,pins:0"; -+ extpullup = <&w1>,"gpios:16", -+ <&w1_pins>,"brcm,pins:4"; -+ pullup = <&w1>,"rpi,parasitic-power:0"; ++ gpio_out_pin = <&lirc_pins>,"brcm,pins:0"; ++ gpio_in_pin = <&lirc_pins>,"brcm,pins:4"; ++ gpio_in_pull = <&lirc_pins>,"brcm,pull:4"; ++ ++ sense = <&lirc_rpi>,"rpi,sense:0"; ++ softcarrier = <&lirc_rpi>,"rpi,softcarrier:0"; ++ invert = <&lirc_rpi>,"rpi,invert:0"; ++ debug = <&lirc_rpi>,"rpi,debug:0"; + }; +}; - -From 23eabf2220f0f748df3e88a35e55a82c53242b4a Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= <noralf@tronnes.org> -Date: Sat, 15 Aug 2015 20:47:07 +0200 -Subject: [PATCH 053/170] bcm2835: Match with BCM2708 Device Trees -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Signed-off-by: Noralf Trønnes <noralf@tronnes.org> ---- - arch/arm/boot/dts/bcm2835-rpi-b-plus.dts | 132 ++++++++++++++++++--- - arch/arm/boot/dts/bcm2835-rpi-b.dts | 115 ++++++++++++++++-- - arch/arm/boot/dts/bcm2835.dtsi | 195 +++---------------------------- - 3 files changed, 237 insertions(+), 205 deletions(-) - -diff --git a/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts b/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts -index 668442b..17e2443 100644 ---- a/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts -+++ b/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts -@@ -1,30 +1,128 @@ - /dts-v1/; --#include "bcm2835-rpi.dtsi" -+#include "bcm2835.dtsi" - - / { - compatible = "raspberrypi,model-b-plus", "brcm,bcm2835"; - model = "Raspberry Pi Model B+"; -+}; - -- leds { -- act { -- gpios = <&gpio 47 0>; -- }; -+&gpio { -+ spi0_pins: spi0_pins { -+ brcm,pins = <7 8 9 10 11>; -+ brcm,function = <4>; /* alt0 */ +diff --git a/arch/arm/boot/dts/overlays/mcp23017-overlay.dts b/arch/arm/boot/dts/overlays/mcp23017-overlay.dts +new file mode 100644 +index 0000000..412f966 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/mcp23017-overlay.dts +@@ -0,0 +1,54 @@ ++// Definitions for MCP23017 Gpio Extender from Microchip Semiconductor ++ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; ++ ++ fragment@0 { ++ target = <&i2c1>; ++ __overlay__ { ++ status = "okay"; ++ }; + }; - -- pwr { -- label = "PWR"; -- gpios = <&gpio 35 0>; -- default-state = "keep"; -- linux,default-trigger = "default-on"; -- }; -+ i2c0_pins: i2c0 { -+ brcm,pins = <0 1>; -+ brcm,function = <4>; - }; --}; - --&gpio { -- pinctrl-0 = <&gpioout &alt0 &i2s_alt0 &alt3>; -+ i2c1_pins: i2c1 { -+ brcm,pins = <2 3>; -+ brcm,function = <4>; ++ ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ mcp23017_pins: mcp23017_pins { ++ brcm,pins = <4>; ++ brcm,function = <0>; ++ }; ++ }; + }; - -- /* I2S interface */ -- i2s_alt0: i2s_alt0 { -+ i2s_pins: i2s { - brcm,pins = <18 19 20 21>; -- brcm,function = <BCM2835_FSEL_ALT0>; -+ brcm,function = <4>; /* alt0 */ ++ ++ fragment@2 { ++ target = <&i2c1>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ mcp23017: mcp@20 { ++ compatible = "microchip,mcp23017"; ++ reg = <0x20>; ++ gpio-controller; ++ #gpio-cells = <2>; ++ #interrupt-cells=<2>; ++ interrupt-parent = <&gpio>; ++ interrupts = <4 2>; ++ interrupt-controller; ++ microchip,irq-mirror; ++ ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ __overrides__ { ++ gpiopin = <&mcp23017_pins>,"brcm,pins:0", ++ <&mcp23017>,"interrupts:0"; ++ addr = <&mcp23017>,"reg:0"; + }; +}; + -+&mmc { -+ status = "okay"; -+ bus-width = <4>; -+}; +diff --git a/arch/arm/boot/dts/overlays/mcp2515-can0-overlay.dts b/arch/arm/boot/dts/overlays/mcp2515-can0-overlay.dts +new file mode 100755 +index 0000000..c96cdae +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/mcp2515-can0-overlay.dts +@@ -0,0 +1,73 @@ ++/* ++ * Device tree overlay for mcp251x/can0 on spi0.0 ++ */ + -+&fb { -+ status = "okay"; -+}; ++/dts-v1/; ++/plugin/; + -+&uart0 { -+ status = "okay"; ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2836", "brcm,bcm2708", "brcm,bcm2709"; ++ /* disable spi-dev for spi0.0 */ ++ fragment@0 { ++ target = <&spi0>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&spidev0>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; ++ ++ /* the interrupt pin of the can-controller */ ++ fragment@2 { ++ target = <&gpio>; ++ __overlay__ { ++ can0_pins: can0_pins { ++ brcm,pins = <25>; ++ brcm,function = <0>; /* input */ ++ }; ++ }; ++ }; ++ ++ /* the clock/oscillator of the can-controller */ ++ fragment@3 { ++ target-path = "/clocks"; ++ __overlay__ { ++ /* external oscillator of mcp2515 on SPI0.0 */ ++ can0_osc: can0_osc { ++ compatible = "fixed-clock"; ++ #clock-cells = <0>; ++ clock-frequency = <16000000>; ++ }; ++ }; ++ }; ++ ++ /* the spi config of the can-controller itself binding everything together */ ++ fragment@4 { ++ target = <&spi0>; ++ __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ can0: mcp2515@0 { ++ reg = <0>; ++ compatible = "microchip,mcp2515"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&can0_pins>; ++ spi-max-frequency = <10000000>; ++ interrupt-parent = <&gpio>; ++ interrupts = <25 0x2>; ++ clocks = <&can0_osc>; ++ }; ++ }; ++ }; ++ __overrides__ { ++ oscillator = <&can0_osc>,"clock-frequency:0"; ++ spimaxfrequency = <&can0>,"spi-max-frequency:0"; ++ interrupt = <&can0_pins>,"brcm,pins:0",<&can0>,"interrupts:0"; ++ }; +}; +diff --git a/arch/arm/boot/dts/overlays/mcp2515-can1-overlay.dts b/arch/arm/boot/dts/overlays/mcp2515-can1-overlay.dts +new file mode 100644 +index 0000000..67bd0d9 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/mcp2515-can1-overlay.dts +@@ -0,0 +1,73 @@ ++/* ++ * Device tree overlay for mcp251x/can1 on spi0.1 edited by petit_miner ++ */ + -+&spi0 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&spi0_pins>; ++/dts-v1/; ++/plugin/; + -+ spidev@0{ -+ compatible = "spidev"; -+ reg = <0>; /* CE0 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; -+ }; ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2836", "brcm,bcm2708", "brcm,bcm2709"; ++ /* disable spi-dev for spi0.1 */ ++ fragment@0 { ++ target = <&spi0>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; + -+ spidev@1{ -+ compatible = "spidev"; -+ reg = <1>; /* CE1 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; ++ fragment@1 { ++ target = <&spidev1>; ++ __overlay__ { ++ status = "disabled"; + }; -+}; ++ }; + -+&i2c0 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&i2c0_pins>; -+ clock-frequency = <100000>; -+}; ++ /* the interrupt pin of the can-controller */ ++ fragment@2 { ++ target = <&gpio>; ++ __overlay__ { ++ can1_pins: can1_pins { ++ brcm,pins = <25>; ++ brcm,function = <0>; /* input */ ++ }; ++ }; ++ }; + -+&i2c1 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&i2c1_pins>; -+ clock-frequency = <100000>; -+}; ++ /* the clock/oscillator of the can-controller */ ++ fragment@3 { ++ target-path = "/clocks"; ++ __overlay__ { ++ /* external oscillator of mcp2515 on spi0.1 */ ++ can1_osc: can1_osc { ++ compatible = "fixed-clock"; ++ #clock-cells = <0>; ++ clock-frequency = <16000000>; ++ }; ++ }; ++ }; + -+&i2c2 { -+ clock-frequency = <100000>; ++ /* the spi config of the can-controller itself binding everything together */ ++ fragment@4 { ++ target = <&spi0>; ++ __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ can1: mcp2515@1 { ++ reg = <1>; ++ compatible = "microchip,mcp2515"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&can1_pins>; ++ spi-max-frequency = <10000000>; ++ interrupt-parent = <&gpio>; ++ interrupts = <25 0x2>; ++ clocks = <&can1_osc>; ++ }; ++ }; ++ }; ++ __overrides__ { ++ oscillator = <&can1_osc>,"clock-frequency:0"; ++ spimaxfrequency = <&can1>,"spi-max-frequency:0"; ++ interrupt = <&can1_pins>,"brcm,pins:0",<&can1>,"interrupts:0"; ++ }; +}; +diff --git a/arch/arm/boot/dts/overlays/mmc-overlay.dts b/arch/arm/boot/dts/overlays/mmc-overlay.dts +new file mode 100644 +index 0000000..d32b02c +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/mmc-overlay.dts +@@ -0,0 +1,38 @@ ++/dts-v1/; ++/plugin/; + -+&i2s { -+ #sound-dai-cells = <0>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&i2s_pins>; -+}; ++/{ ++ compatible = "brcm,bcm2708"; + -+&leds { -+ act_led: act { -+ label = "led0"; -+ linux,default-trigger = "mmc0"; -+ gpios = <&gpio 47 0>; ++ fragment@0 { ++ target = <&mmc>; ++ frag0: __overlay__ { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&mmc_pins>; ++ bus-width = <4>; ++ brcm,overclock-50 = <0>; ++ status = "okay"; ++ }; + }; + -+ pwr_led: pwr { -+ label = "led1"; -+ linux,default-trigger = "input"; -+ gpios = <&gpio 35 0>; ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ mmc_pins: mmc_pins { ++ brcm,pins = <48 49 50 51 52 53>; ++ brcm,function = <7>; /* alt3 */ ++ }; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&sdhost>; ++ __overlay__ { ++ status = "disabled"; ++ }; + }; -+}; + -+/ { + __overrides__ { -+ uart0 = <&uart0>,"status"; -+ uart0_clkrate = <&clk_uart0>,"clock-frequency:0"; -+ uart1_clkrate = <&uart1>,"clock-frequency:0"; -+ i2s = <&i2s>,"status"; -+ spi = <&spi0>,"status"; -+ i2c0 = <&i2c0>,"status"; -+ i2c1 = <&i2c1>,"status"; -+ i2c2_iknowwhatimdoing = <&i2c2>,"status"; -+ i2c0_baudrate = <&i2c0>,"clock-frequency:0"; -+ i2c1_baudrate = <&i2c1>,"clock-frequency:0"; -+ i2c2_baudrate = <&i2c2>,"clock-frequency:0"; -+ core_freq = <&clk_core>,"clock-frequency:0"; ++ overclock_50 = <&frag0>,"brcm,overclock-50:0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/mz61581-overlay.dts b/arch/arm/boot/dts/overlays/mz61581-overlay.dts +new file mode 100644 +index 0000000..2c29aae +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/mz61581-overlay.dts +@@ -0,0 +1,117 @@ ++/* ++ * Device Tree overlay for MZ61581-PI-EXT 2014.12.28 by Tontec ++ * ++ */ + -+ act_led_gpio = <&act_led>,"gpios:4"; -+ act_led_activelow = <&act_led>,"gpios:8"; -+ act_led_trigger = <&act_led>,"linux,default-trigger"; ++/dts-v1/; ++/plugin/; + -+ pwr_led_gpio = <&pwr_led>,"gpios:4"; -+ pwr_led_activelow = <&pwr_led>,"gpios:8"; -+ pwr_led_trigger = <&pwr_led>,"linux,default-trigger"; ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; + -+ audio = <&audio>,"status"; -+ watchdog = <&watchdog>,"status"; -+ random = <&random>,"status"; - }; - }; -diff --git a/arch/arm/boot/dts/bcm2835-rpi-b.dts b/arch/arm/boot/dts/bcm2835-rpi-b.dts -index ff6b2d1..221d252 100644 ---- a/arch/arm/boot/dts/bcm2835-rpi-b.dts -+++ b/arch/arm/boot/dts/bcm2835-rpi-b.dts -@@ -1,17 +1,118 @@ - /dts-v1/; --#include "bcm2835-rpi.dtsi" -+#include "bcm2835.dtsi" - - / { - compatible = "raspberrypi,model-b", "brcm,bcm2835"; - model = "Raspberry Pi Model B"; -+}; - -- leds { -- act { -- gpios = <&gpio 16 1>; -- }; -+&gpio { -+ spi0_pins: spi0_pins { -+ brcm,pins = <7 8 9 10 11>; -+ brcm,function = <4>; /* alt0 */ ++ fragment@0 { ++ target = <&spi0>; ++ __overlay__ { ++ status = "okay"; ++ }; + }; + -+ i2c0_pins: i2c0 { -+ brcm,pins = <0 1>; -+ brcm,function = <4>; ++ fragment@1 { ++ target = <&spidev0>; ++ __overlay__ { ++ status = "disabled"; ++ }; + }; + -+ i2c1_pins: i2c1 { -+ brcm,pins = <2 3>; -+ brcm,function = <4>; ++ fragment@2 { ++ target = <&spidev1>; ++ __overlay__ { ++ status = "disabled"; ++ }; + }; + -+ i2s_pins: i2s { -+ brcm,pins = <28 29 30 31>; -+ brcm,function = <6>; /* alt2 */ - }; - }; - --&gpio { -- pinctrl-0 = <&gpioout &alt0 &alt3>; -+&mmc { -+ status = "okay"; -+ bus-width = <4>; -+}; ++ fragment@3 { ++ target = <&gpio>; ++ __overlay__ { ++ mz61581_pins: mz61581_pins { ++ brcm,pins = <4 15 18 25>; ++ brcm,function = <0 1 1 1>; /* in out out out */ ++ }; ++ }; ++ }; + -+&fb { -+ status = "okay"; -+}; ++ fragment@4 { ++ target = <&spi0>; ++ __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; + -+&uart0 { -+ status = "okay"; ++ mz61581: mz61581@0{ ++ compatible = "samsung,s6d02a1"; ++ reg = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&mz61581_pins>; ++ ++ spi-max-frequency = <128000000>; ++ spi-cpol; ++ spi-cpha; ++ ++ width = <320>; ++ height = <480>; ++ rotate = <270>; ++ bgr; ++ fps = <30>; ++ buswidth = <8>; ++ txbuflen = <32768>; ++ ++ reset-gpios = <&gpio 15 0>; ++ dc-gpios = <&gpio 25 0>; ++ led-gpios = <&gpio 18 0>; ++ ++ init = <0x10000b0 00 ++ 0x1000011 ++ 0x20000ff ++ 0x10000b3 0x02 0x00 0x00 0x00 ++ 0x10000c0 0x13 0x3b 0x00 0x02 0x00 0x01 0x00 0x43 ++ 0x10000c1 0x08 0x16 0x08 0x08 ++ 0x10000c4 0x11 0x07 0x03 0x03 ++ 0x10000c6 0x00 ++ 0x10000c8 0x03 0x03 0x13 0x5c 0x03 0x07 0x14 0x08 0x00 0x21 0x08 0x14 0x07 0x53 0x0c 0x13 0x03 0x03 0x21 0x00 ++ 0x1000035 0x00 ++ 0x1000036 0xa0 ++ 0x100003a 0x55 ++ 0x1000044 0x00 0x01 ++ 0x10000d0 0x07 0x07 0x1d 0x03 ++ 0x10000d1 0x03 0x30 0x10 ++ 0x10000d2 0x03 0x14 0x04 ++ 0x1000029 ++ 0x100002c>; ++ ++ /* This is a workaround to make sure the init sequence slows down and doesn't fail */ ++ debug = <3>; ++ }; ++ ++ mz61581_ts: mz61581_ts@1 { ++ compatible = "ti,ads7846"; ++ reg = <1>; ++ ++ spi-max-frequency = <2000000>; ++ interrupts = <4 2>; /* high-to-low edge triggered */ ++ interrupt-parent = <&gpio>; ++ pendown-gpio = <&gpio 4 0>; ++ ++ ti,x-plate-ohms = /bits/ 16 <60>; ++ ti,pressure-max = /bits/ 16 <255>; ++ }; ++ }; ++ }; ++ __overrides__ { ++ speed = <&mz61581>, "spi-max-frequency:0"; ++ rotate = <&mz61581>, "rotate:0"; ++ fps = <&mz61581>, "fps:0"; ++ txbuflen = <&mz61581>, "txbuflen:0"; ++ debug = <&mz61581>, "debug:0"; ++ xohms = <&mz61581_ts>,"ti,x-plate-ohms;0"; ++ }; +}; +diff --git a/arch/arm/boot/dts/overlays/pi3-act-led-overlay.dts b/arch/arm/boot/dts/overlays/pi3-act-led-overlay.dts +new file mode 100644 +index 0000000..14a59dc +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/pi3-act-led-overlay.dts +@@ -0,0 +1,27 @@ ++/dts-v1/; ++/plugin/; + -+&spi0 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&spi0_pins>; ++/* Pi3 uses a GPIO expander to drive the LEDs which can only be accessed ++ from the VPU. There is a special driver for this with a separate DT node, ++ which has the unfortunate consequence of breaking the act_led_gpio and ++ act_led_activelow dtparams. + -+ spidev@0{ -+ compatible = "spidev"; -+ reg = <0>; /* CE0 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; ++ This overlay changes the GPIO controller back to the standard one and ++ restores the dtparams. ++*/ ++ ++/{ ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&act_led>; ++ frag0: __overlay__ { ++ gpios = <&gpio 0 0>; ++ }; + }; + -+ spidev@1{ -+ compatible = "spidev"; -+ reg = <1>; /* CE1 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; ++ __overrides__ { ++ gpio = <&frag0>,"gpios:4"; ++ activelow = <&frag0>,"gpios:8"; + }; +}; +diff --git a/arch/arm/boot/dts/overlays/pi3-disable-bt-overlay.dts b/arch/arm/boot/dts/overlays/pi3-disable-bt-overlay.dts +new file mode 100644 +index 0000000..68f6069 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/pi3-disable-bt-overlay.dts +@@ -0,0 +1,46 @@ ++/dts-v1/; ++/plugin/; + -+&i2c0 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&i2c0_pins>; -+ clock-frequency = <100000>; -+}; ++/* Disable Bluetooth and restore UART0/ttyAMA0 over GPIOs 14 & 15. ++ To disable the systemd service that initialises the modem so it doesn't use ++ the UART: + -+&i2c1 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&i2c1_pins>; -+ clock-frequency = <100000>; -+}; ++ sudo systemctl disable hciuart ++*/ + -+&i2c2 { -+ clock-frequency = <100000>; -+}; ++/{ ++ compatible = "brcm,bcm2708"; + -+&i2s { -+ #sound-dai-cells = <0>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&i2s_pins>; -+}; ++ fragment@0 { ++ target = <&uart1>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; + -+&leds { -+ act_led: act { -+ label = "led0"; -+ linux,default-trigger = "mmc0"; -+ gpios = <&gpio 16 1>; ++ fragment@1 { ++ target = <&uart0>; ++ __overlay__ { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&uart0_pins>; ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&uart0_pins>; ++ __overlay__ { ++ brcm,pins; ++ brcm,function; ++ brcm,pull; ++ }; ++ }; ++ ++ fragment@3 { ++ target-path = "/aliases"; ++ __overlay__ { ++ serial0 = "/soc/uart@7e201000"; ++ serial1 = "/soc/uart@7e215040"; ++ }; + }; +}; +diff --git a/arch/arm/boot/dts/overlays/pi3-miniuart-bt-overlay.dts b/arch/arm/boot/dts/overlays/pi3-miniuart-bt-overlay.dts +new file mode 100644 +index 0000000..17d04cf +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/pi3-miniuart-bt-overlay.dts +@@ -0,0 +1,64 @@ ++/dts-v1/; ++/plugin/; + -+/ { -+ __overrides__ { -+ uart0 = <&uart0>,"status"; -+ uart0_clkrate = <&clk_uart0>,"clock-frequency:0"; -+ uart1_clkrate = <&uart1>,"clock-frequency:0"; -+ i2s = <&i2s>,"status"; -+ spi = <&spi0>,"status"; -+ i2c0 = <&i2c0>,"status"; -+ i2c1 = <&i2c1>,"status"; -+ i2c2_iknowwhatimdoing = <&i2c2>,"status"; -+ i2c0_baudrate = <&i2c0>,"clock-frequency:0"; -+ i2c1_baudrate = <&i2c1>,"clock-frequency:0"; -+ i2c2_baudrate = <&i2c2>,"clock-frequency:0"; -+ core_freq = <&clk_core>,"clock-frequency:0"; ++/* Switch Pi3 Bluetooth function to use the mini-UART (ttyS0) and restore ++ UART0/ttyAMA0 over GPIOs 14 & 15. Note that this may reduce the maximum ++ usable baudrate. + -+ act_led_gpio = <&act_led>,"gpios:4"; -+ act_led_activelow = <&act_led>,"gpios:8"; -+ act_led_trigger = <&act_led>,"linux,default-trigger"; ++ It is also necessary to edit /lib/systemd/system/hciuart.service and ++ replace ttyAMA0 with ttyS0, unless you have a system with udev rules ++ that create /dev/serial0 and /dev/serial1, in which case use /dev/serial1 ++ instead because it will always be correct. + -+ audio = <&audio>,"status"; -+ watchdog = <&watchdog>,"status"; -+ random = <&random>,"status"; ++ If cmdline.txt uses the alias serial0 to refer to the user-accessable port ++ then the firmware will replace with the appropriate port whether or not ++ this overlay is used. ++*/ ++ ++/{ ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&uart0>; ++ __overlay__ { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&uart0_pins>; ++ status = "okay"; ++ }; + }; - }; -diff --git a/arch/arm/boot/dts/bcm2835.dtsi b/arch/arm/boot/dts/bcm2835.dtsi -index 864a3ef..3256bff 100644 ---- a/arch/arm/boot/dts/bcm2835.dtsi -+++ b/arch/arm/boot/dts/bcm2835.dtsi -@@ -1,206 +1,39 @@ --#include <dt-bindings/pinctrl/bcm2835.h> --#include <dt-bindings/clock/bcm2835.h> --#include "skeleton.dtsi" -+#include "bcm2708_common.dtsi" - - / { - compatible = "brcm,bcm2835"; - model = "BCM2835"; -- interrupt-parent = <&intc>; - - chosen { -- bootargs = "earlyprintk console=ttyAMA0"; -+ bootargs = ""; - }; - - soc { -- compatible = "simple-bus"; -- #address-cells = <1>; -- #size-cells = <1>; -- ranges = <0x7e000000 0x20000000 0x02000000>; -+ ranges = <0x7e000000 0x20000000 0x01000000>; - dma-ranges = <0x40000000 0x00000000 0x20000000>; - - timer@7e003000 { - compatible = "brcm,bcm2835-system-timer"; - reg = <0x7e003000 0x1000>; - interrupts = <1 0>, <1 1>, <1 2>, <1 3>; -- /* This could be a reference to BCM2835_CLOCK_TIMER, -- * but we don't have the driver using the common clock -- * support yet. -- */ - clock-frequency = <1000000>; - }; - -- dma: dma@7e007000 { -- compatible = "brcm,bcm2835-dma"; -- reg = <0x7e007000 0xf00>; -- interrupts = <1 16>, -- <1 17>, -- <1 18>, -- <1 19>, -- <1 20>, -- <1 21>, -- <1 22>, -- <1 23>, -- <1 24>, -- <1 25>, -- <1 26>, -- <1 27>, -- <1 28>; -- -- #dma-cells = <1>; -- brcm,dma-channel-mask = <0x7f35>; -- }; -- -- intc: interrupt-controller@7e00b200 { -- compatible = "brcm,bcm2835-armctrl-ic"; -- reg = <0x7e00b200 0x200>; -- interrupt-controller; -- #interrupt-cells = <2>; -- }; -- -- watchdog@7e100000 { -- compatible = "brcm,bcm2835-pm-wdt"; -- reg = <0x7e100000 0x28>; -- }; -- -- clocks: cprman@7e101000 { -- compatible = "brcm,bcm2835-cprman"; -- #clock-cells = <1>; -- reg = <0x7e101000 0x2000>; -- -- /* CPRMAN derives everything from the platform's -- * oscillator. -- */ -- clocks = <&clk_osc>; -- }; -- -- rng@7e104000 { -- compatible = "brcm,bcm2835-rng"; -- reg = <0x7e104000 0x10>; -- }; -- -- mailbox: mailbox@7e00b800 { -- compatible = "brcm,bcm2835-mbox"; -- reg = <0x7e00b880 0x40>; -- interrupts = <0 1>; -- #mbox-cells = <0>; -- }; -- -- gpio: gpio@7e200000 { -- compatible = "brcm,bcm2835-gpio"; -- reg = <0x7e200000 0xb4>; -- /* -- * The GPIO IP block is designed for 3 banks of GPIOs. -- * Each bank has a GPIO interrupt for itself. -- * There is an overall "any bank" interrupt. -- * In order, these are GIC interrupts 17, 18, 19, 20. -- * Since the BCM2835 only has 2 banks, the 2nd bank -- * interrupt output appears to be mirrored onto the -- * 3rd bank's interrupt signal. -- * So, a bank0 interrupt shows up on 17, 20, and -- * a bank1 interrupt shows up on 18, 19, 20! -- */ -- interrupts = <2 17>, <2 18>, <2 19>, <2 20>; -- -- gpio-controller; -- #gpio-cells = <2>; -- -- interrupt-controller; -- #interrupt-cells = <2>; -- }; -- -- uart0: uart@7e201000 { -- compatible = "brcm,bcm2835-pl011", "arm,pl011", "arm,primecell"; -- reg = <0x7e201000 0x1000>; -- interrupts = <2 25>; -- clocks = <&clocks BCM2835_CLOCK_UART>, -- <&clocks BCM2835_CLOCK_VPU>; -- clock-names = "uartclk", "apb_pclk"; -- arm,primecell-periphid = <0x00241011>; -- }; -- -- i2s: i2s@7e203000 { -- compatible = "brcm,bcm2835-i2s"; -- reg = <0x7e203000 0x24>, -- <0x7e101098 0x08>; -- -- dmas = <&dma 2>, -- <&dma 3>; -- dma-names = "tx", "rx"; -- status = "disabled"; -- }; -- -- spi: spi@7e204000 { -- compatible = "brcm,bcm2835-spi"; -- reg = <0x7e204000 0x1000>; -- interrupts = <2 22>; -- clocks = <&clocks BCM2835_CLOCK_VPU>; -- #address-cells = <1>; -- #size-cells = <0>; -- status = "disabled"; -- }; -- -- i2c0: i2c@7e205000 { -- compatible = "brcm,bcm2835-i2c"; -- reg = <0x7e205000 0x1000>; -- interrupts = <2 21>; -- clocks = <&clocks BCM2835_CLOCK_VPU>; -- #address-cells = <1>; -- #size-cells = <0>; -- status = "disabled"; -- }; -- -- sdhci: sdhci@7e300000 { -- compatible = "brcm,bcm2835-sdhci"; -- reg = <0x7e300000 0x100>; -- interrupts = <2 30>; -- clocks = <&clocks BCM2835_CLOCK_EMMC>; -- status = "disabled"; -- }; -- -- i2c1: i2c@7e804000 { -- compatible = "brcm,bcm2835-i2c"; -- reg = <0x7e804000 0x1000>; -- interrupts = <2 21>; -- clocks = <&clocks BCM2835_CLOCK_VPU>; -- #address-cells = <1>; -- #size-cells = <0>; -- status = "disabled"; -- }; -- -- i2c2: i2c@7e805000 { -- compatible = "brcm,bcm2835-i2c"; -- reg = <0x7e805000 0x1000>; -- interrupts = <2 21>; -- clocks = <&clocks BCM2835_CLOCK_VPU>; -- #address-cells = <1>; -- #size-cells = <0>; -- status = "disabled"; -- }; -- -- usb@7e980000 { -- compatible = "brcm,bcm2835-usb"; -- reg = <0x7e980000 0x10000>; -- interrupts = <1 9>; -- }; -- - arm-pmu { - compatible = "arm,arm1176-pmu"; - }; -- }; -- -- clocks { -- compatible = "simple-bus"; -- #address-cells = <1>; -- #size-cells = <0>; - -- /* The oscillator is the root of the clock tree. */ -- clk_osc: clock@3 { -- compatible = "fixed-clock"; -- reg = <3>; -- #clock-cells = <0>; -- clock-output-names = "osc"; -- clock-frequency = <19200000>; -+ aux_enable: aux_enable@0x7e215004 { -+ compatible = "bcrm,bcm2835-aux-enable"; -+ reg = <0x7e215004 0x04>; - }; -- - }; - }; + -+&intc { -+ compatible = "brcm,bcm2835-armctrl-ic"; -+}; ++ fragment@1 { ++ target = <&uart1>; ++ __overlay__ { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&uart1_pins &bt_pins>; ++ status = "okay"; ++ }; ++ }; + -+&watchdog { -+ status = "okay"; ++ fragment@2 { ++ target = <&uart0_pins>; ++ __overlay__ { ++ brcm,pins; ++ brcm,function; ++ brcm,pull; ++ }; ++ }; ++ ++ fragment@3 { ++ target = <&uart1_pins>; ++ __overlay__ { ++ brcm,pins = <32 33>; ++ brcm,function = <2>; /* alt5=UART1 */ ++ brcm,pull = <0 2>; ++ }; ++ }; ++ ++ fragment@4 { ++ target-path = "/aliases"; ++ __overlay__ { ++ serial0 = "/soc/uart@7e201000"; ++ serial1 = "/soc/uart@7e215040"; ++ }; ++ }; +}; - -From f978fb3b816681159b6cc97104954dea31488add Mon Sep 17 00:00:00 2001 -From: Siarhei Siamashka <siarhei.siamashka@gmail.com> -Date: Mon, 17 Jun 2013 13:32:11 +0300 -Subject: [PATCH 054/170] fbdev: add FBIOCOPYAREA ioctl - -Based on the patch authored by Ali Gholami Rudi at - https://lkml.org/lkml/2009/7/13/153 - -Provide an ioctl for userspace applications, but only if this operation -is hardware accelerated (otherwide it does not make any sense). - -Signed-off-by: Siarhei Siamashka <siarhei.siamashka@gmail.com> ---- - drivers/video/fbdev/core/fbmem.c | 30 ++++++++++++++++++++++++++++++ - include/uapi/linux/fb.h | 5 +++++ - 2 files changed, 35 insertions(+) - -diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c -index 0705d88..771992a 100644 ---- a/drivers/video/fbdev/core/fbmem.c -+++ b/drivers/video/fbdev/core/fbmem.c -@@ -1084,6 +1084,25 @@ fb_blank(struct fb_info *info, int blank) - } - EXPORT_SYMBOL(fb_blank); - -+static int fb_copyarea_user(struct fb_info *info, -+ struct fb_copyarea *copy) -+{ -+ int ret = 0; -+ if (!lock_fb_info(info)) -+ return -ENODEV; -+ if (copy->dx + copy->width > info->var.xres || -+ copy->sx + copy->width > info->var.xres || -+ copy->dy + copy->height > info->var.yres || -+ copy->sy + copy->height > info->var.yres) { -+ ret = -EINVAL; -+ goto out; -+ } -+ info->fbops->fb_copyarea(info, copy); -+out: -+ unlock_fb_info(info); -+ return ret; -+} -+ - static long do_fb_ioctl(struct fb_info *info, unsigned int cmd, - unsigned long arg) - { -@@ -1094,6 +1113,7 @@ static long do_fb_ioctl(struct fb_info *info, unsigned int cmd, - struct fb_cmap cmap_from; - struct fb_cmap_user cmap; - struct fb_event event; -+ struct fb_copyarea copy; - void __user *argp = (void __user *)arg; - long ret = 0; - -@@ -1211,6 +1231,15 @@ static long do_fb_ioctl(struct fb_info *info, unsigned int cmd, - unlock_fb_info(info); - console_unlock(); - break; -+ case FBIOCOPYAREA: -+ if (info->flags & FBINFO_HWACCEL_COPYAREA) { -+ /* only provide this ioctl if it is accelerated */ -+ if (copy_from_user(&copy, argp, sizeof(copy))) -+ return -EFAULT; -+ ret = fb_copyarea_user(info, &copy); -+ break; -+ } -+ /* fall through */ - default: - if (!lock_fb_info(info)) - return -ENODEV; -@@ -1365,6 +1394,7 @@ static long fb_compat_ioctl(struct file *file, unsigned int cmd, - case FBIOPAN_DISPLAY: - case FBIOGET_CON2FBMAP: - case FBIOPUT_CON2FBMAP: -+ case FBIOCOPYAREA: - arg = (unsigned long) compat_ptr(arg); - case FBIOBLANK: - ret = do_fb_ioctl(info, cmd, arg); -diff --git a/include/uapi/linux/fb.h b/include/uapi/linux/fb.h -index fb795c3..fa72af0c 100644 ---- a/include/uapi/linux/fb.h -+++ b/include/uapi/linux/fb.h -@@ -34,6 +34,11 @@ - #define FBIOPUT_MODEINFO 0x4617 - #define FBIOGET_DISPINFO 0x4618 - #define FBIO_WAITFORVSYNC _IOW('F', 0x20, __u32) -+/* -+ * HACK: use 'z' in order not to clash with any other ioctl numbers which might -+ * be concurrently added to the mainline kernel -+ */ -+#define FBIOCOPYAREA _IOW('z', 0x21, struct fb_copyarea) - - #define FB_TYPE_PACKED_PIXELS 0 /* Packed Pixels */ - #define FB_TYPE_PLANES 1 /* Non interleaved planes */ - -From 53bcd6e5a43a353508c7aff48abcdcaae1b35ca8 Mon Sep 17 00:00:00 2001 -From: Harm Hanemaaijer <fgenfb@yahoo.com> -Date: Thu, 20 Jun 2013 20:21:39 +0200 -Subject: [PATCH 058/170] Speed up console framebuffer imageblit function - -Especially on platforms with a slower CPU but a relatively high -framebuffer fill bandwidth, like current ARM devices, the existing -console monochrome imageblit function used to draw console text is -suboptimal for common pixel depths such as 16bpp and 32bpp. The existing -code is quite general and can deal with several pixel depths. By creating -special case functions for 16bpp and 32bpp, by far the most common pixel -formats used on modern systems, a significant speed-up is attained -which can be readily felt on ARM-based devices like the Raspberry Pi -and the Allwinner platform, but should help any platform using the -fb layer. - -The special case functions allow constant folding, eliminating a number -of instructions including divide operations, and allow the use of an -unrolled loop, eliminating instructions with a variable shift size, -reducing source memory access instructions, and eliminating excessive -branching. These unrolled loops also allow much better code optimization -by the C compiler. The code that selects which optimized variant is used -is also simplified, eliminating integer divide instructions. - -The speed-up, measured by timing 'cat file.txt' in the console, varies -between 40% and 70%, when testing on the Raspberry Pi and Allwinner -ARM-based platforms, depending on font size and the pixel depth, with -the greater benefit for 32bpp. - -Signed-off-by: Harm Hanemaaijer <fgenfb@yahoo.com> ---- - drivers/video/fbdev/core/cfbimgblt.c | 152 +++++++++++++++++++++++++++++++++-- - 1 file changed, 147 insertions(+), 5 deletions(-) - -diff --git a/drivers/video/fbdev/core/cfbimgblt.c b/drivers/video/fbdev/core/cfbimgblt.c -index a2bb276..436494f 100644 ---- a/drivers/video/fbdev/core/cfbimgblt.c -+++ b/drivers/video/fbdev/core/cfbimgblt.c -@@ -28,6 +28,11 @@ - * - * Also need to add code to deal with cards endians that are different than - * the native cpu endians. I also need to deal with MSB position in the word. -+ * Modified by Harm Hanemaaijer (fgenfb@yahoo.com) 2013: -+ * - Provide optimized versions of fast_imageblit for 16 and 32bpp that are -+ * significantly faster than the previous implementation. -+ * - Simplify the fast/slow_imageblit selection code, avoiding integer -+ * divides. - */ - #include <linux/module.h> - #include <linux/string.h> -@@ -262,6 +267,133 @@ static inline void fast_imageblit(const struct fb_image *image, struct fb_info * - } - } - +diff --git a/arch/arm/boot/dts/overlays/piscreen-overlay.dts b/arch/arm/boot/dts/overlays/piscreen-overlay.dts +new file mode 100644 +index 0000000..40a1f29 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/piscreen-overlay.dts +@@ -0,0 +1,102 @@ +/* -+ * Optimized fast_imageblit for bpp == 16. ppw = 2, bit_mask = 3 folded -+ * into the code, main loop unrolled. ++ * Device Tree overlay for PiScreen 3.5" display shield by Ozzmaker ++ * + */ + -+static inline void fast_imageblit16(const struct fb_image *image, -+ struct fb_info *p, u8 __iomem * dst1, -+ u32 fgcolor, u32 bgcolor) -+{ -+ u32 fgx = fgcolor, bgx = bgcolor; -+ u32 spitch = (image->width + 7) / 8; -+ u32 end_mask, eorx; -+ const char *s = image->data, *src; -+ u32 __iomem *dst; -+ const u32 *tab = NULL; -+ int i, j, k; ++/dts-v1/; ++/plugin/; + -+ tab = fb_be_math(p) ? cfb_tab16_be : cfb_tab16_le; ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; + -+ fgx <<= 16; -+ bgx <<= 16; -+ fgx |= fgcolor; -+ bgx |= bgcolor; ++ fragment@0 { ++ target = <&spi0>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; + -+ eorx = fgx ^ bgx; -+ k = image->width / 2; ++ fragment@1 { ++ target = <&spidev0>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; + -+ for (i = image->height; i--;) { -+ dst = (u32 __iomem *) dst1; -+ src = s; ++ fragment@2 { ++ target = <&spidev1>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; + -+ j = k; -+ while (j >= 4) { -+ u8 bits = *src; -+ end_mask = tab[(bits >> 6) & 3]; -+ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); -+ end_mask = tab[(bits >> 4) & 3]; -+ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); -+ end_mask = tab[(bits >> 2) & 3]; -+ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); -+ end_mask = tab[bits & 3]; -+ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); -+ src++; -+ j -= 4; -+ } -+ if (j != 0) { -+ u8 bits = *src; -+ end_mask = tab[(bits >> 6) & 3]; -+ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); -+ if (j >= 2) { -+ end_mask = tab[(bits >> 4) & 3]; -+ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); -+ if (j == 3) { -+ end_mask = tab[(bits >> 2) & 3]; -+ FB_WRITEL((end_mask & eorx) ^ bgx, dst); -+ } -+ } -+ } -+ dst1 += p->fix.line_length; -+ s += spitch; -+ } -+} ++ fragment@3 { ++ target = <&gpio>; ++ __overlay__ { ++ piscreen_pins: piscreen_pins { ++ brcm,pins = <17 25 24 22>; ++ brcm,function = <0 1 1 1>; /* in out out out */ ++ }; ++ }; ++ }; + -+/* -+ * Optimized fast_imageblit for bpp == 32. ppw = 1, bit_mask = 1 folded -+ * into the code, main loop unrolled. -+ */ ++ fragment@4 { ++ target = <&spi0>; ++ __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; + -+static inline void fast_imageblit32(const struct fb_image *image, -+ struct fb_info *p, u8 __iomem * dst1, -+ u32 fgcolor, u32 bgcolor) -+{ -+ u32 fgx = fgcolor, bgx = bgcolor; -+ u32 spitch = (image->width + 7) / 8; -+ u32 end_mask, eorx; -+ const char *s = image->data, *src; -+ u32 __iomem *dst; -+ const u32 *tab = NULL; -+ int i, j, k; ++ piscreen: piscreen@0{ ++ compatible = "ilitek,ili9486"; ++ reg = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&piscreen_pins>; + -+ tab = cfb_tab32; ++ spi-max-frequency = <24000000>; ++ rotate = <270>; ++ bgr; ++ fps = <30>; ++ buswidth = <8>; ++ regwidth = <16>; ++ reset-gpios = <&gpio 25 0>; ++ dc-gpios = <&gpio 24 0>; ++ led-gpios = <&gpio 22 1>; ++ debug = <0>; + -+ eorx = fgx ^ bgx; -+ k = image->width; ++ init = <0x10000b0 0x00 ++ 0x1000011 ++ 0x20000ff ++ 0x100003a 0x55 ++ 0x1000036 0x28 ++ 0x10000c2 0x44 ++ 0x10000c5 0x00 0x00 0x00 0x00 ++ 0x10000e0 0x0f 0x1f 0x1c 0x0c 0x0f 0x08 0x48 0x98 0x37 0x0a 0x13 0x04 0x11 0x0d 0x00 ++ 0x10000e1 0x0f 0x32 0x2e 0x0b 0x0d 0x05 0x47 0x75 0x37 0x06 0x10 0x03 0x24 0x20 0x00 ++ 0x10000e2 0x0f 0x32 0x2e 0x0b 0x0d 0x05 0x47 0x75 0x37 0x06 0x10 0x03 0x24 0x20 0x00 ++ 0x1000011 ++ 0x1000029>; ++ }; + -+ for (i = image->height; i--;) { -+ dst = (u32 __iomem *) dst1; -+ src = s; ++ piscreen_ts: piscreen-ts@1 { ++ compatible = "ti,ads7846"; ++ reg = <1>; + -+ j = k; -+ while (j >= 8) { -+ u8 bits = *src; -+ end_mask = tab[(bits >> 7) & 1]; -+ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); -+ end_mask = tab[(bits >> 6) & 1]; -+ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); -+ end_mask = tab[(bits >> 5) & 1]; -+ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); -+ end_mask = tab[(bits >> 4) & 1]; -+ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); -+ end_mask = tab[(bits >> 3) & 1]; -+ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); -+ end_mask = tab[(bits >> 2) & 1]; -+ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); -+ end_mask = tab[(bits >> 1) & 1]; -+ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); -+ end_mask = tab[bits & 1]; -+ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); -+ src++; -+ j -= 8; -+ } -+ if (j != 0) { -+ u32 bits = (u32) * src; -+ while (j > 1) { -+ end_mask = tab[(bits >> 7) & 1]; -+ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); -+ bits <<= 1; -+ j--; -+ } -+ end_mask = tab[(bits >> 7) & 1]; -+ FB_WRITEL((end_mask & eorx) ^ bgx, dst); -+ } -+ dst1 += p->fix.line_length; -+ s += spitch; -+ } -+} ++ spi-max-frequency = <2000000>; ++ interrupts = <17 2>; /* high-to-low edge triggered */ ++ interrupt-parent = <&gpio>; ++ pendown-gpio = <&gpio 17 0>; ++ ti,swap-xy; ++ ti,x-plate-ohms = /bits/ 16 <100>; ++ ti,pressure-max = /bits/ 16 <255>; ++ }; ++ }; ++ }; ++ __overrides__ { ++ speed = <&piscreen>,"spi-max-frequency:0"; ++ rotate = <&piscreen>,"rotate:0"; ++ fps = <&piscreen>,"fps:0"; ++ debug = <&piscreen>,"debug:0"; ++ xohms = <&piscreen_ts>,"ti,x-plate-ohms;0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/piscreen2r-overlay.dts b/arch/arm/boot/dts/overlays/piscreen2r-overlay.dts +new file mode 100644 +index 0000000..9c0bed8 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/piscreen2r-overlay.dts +@@ -0,0 +1,106 @@ ++ /* ++ * Device Tree overlay for PiScreen2 3.5" TFT with resistive touch by Ozzmaker.com ++ * ++ */ + - void cfb_imageblit(struct fb_info *p, const struct fb_image *image) - { - u32 fgcolor, bgcolor, start_index, bitstart, pitch_index = 0; -@@ -294,11 +426,21 @@ void cfb_imageblit(struct fb_info *p, const struct fb_image *image) - bgcolor = image->bg_color; - } - -- if (32 % bpp == 0 && !start_index && !pitch_index && -- ((width & (32/bpp-1)) == 0) && -- bpp >= 8 && bpp <= 32) -- fast_imageblit(image, p, dst1, fgcolor, bgcolor); -- else -+ if (!start_index && !pitch_index) { -+ if (bpp == 32) -+ fast_imageblit32(image, p, dst1, fgcolor, -+ bgcolor); -+ else if (bpp == 16 && (width & 1) == 0) -+ fast_imageblit16(image, p, dst1, fgcolor, -+ bgcolor); -+ else if (bpp == 8 && (width & 3) == 0) -+ fast_imageblit(image, p, dst1, fgcolor, -+ bgcolor); -+ else -+ slow_imageblit(image, p, dst1, fgcolor, -+ bgcolor, -+ start_index, pitch_index); -+ } else - slow_imageblit(image, p, dst1, fgcolor, bgcolor, - start_index, pitch_index); - } else - -From 6c0a9150827dc58fac38c8e787c050626325842e Mon Sep 17 00:00:00 2001 -From: popcornmix <popcornmix@gmail.com> -Date: Tue, 26 Mar 2013 17:26:38 +0000 -Subject: [PATCH 059/170] Allow mac address to be set in smsc95xx - -Signed-off-by: popcornmix <popcornmix@gmail.com> ---- - drivers/net/usb/smsc95xx.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 56 insertions(+) - -diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c -index 9c0da18..3244a90 100755 ---- a/drivers/net/usb/smsc95xx.c -+++ b/drivers/net/usb/smsc95xx.c -@@ -59,6 +59,7 @@ - #define SUSPEND_SUSPEND3 (0x08) - #define SUSPEND_ALLMODES (SUSPEND_SUSPEND0 | SUSPEND_SUSPEND1 | \ - SUSPEND_SUSPEND2 | SUSPEND_SUSPEND3) -+#define MAC_ADDR_LEN (6) - - struct smsc95xx_priv { - u32 mac_cr; -@@ -74,6 +75,10 @@ static bool turbo_mode = false; - module_param(turbo_mode, bool, 0644); - MODULE_PARM_DESC(turbo_mode, "Enable multiple frames per Rx transaction"); - -+static char *macaddr = ":"; -+module_param(macaddr, charp, 0); -+MODULE_PARM_DESC(macaddr, "MAC address"); ++/dts-v1/; ++/plugin/; + - static int __must_check __smsc95xx_read_reg(struct usbnet *dev, u32 index, - u32 *data, int in_pm) - { -@@ -763,8 +768,59 @@ static int smsc95xx_ioctl(struct net_device *netdev, struct ifreq *rq, int cmd) - return generic_mii_ioctl(&dev->mii, if_mii(rq), cmd, NULL); - } - -+/* Check the macaddr module parameter for a MAC address */ -+static int smsc95xx_is_macaddr_param(struct usbnet *dev, u8 *dev_mac) -+{ -+ int i, j, got_num, num; -+ u8 mtbl[MAC_ADDR_LEN]; ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; + -+ if (macaddr[0] == ':') -+ return 0; ++ fragment@0 { ++ target = <&spi0>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; + -+ i = 0; -+ j = 0; -+ num = 0; -+ got_num = 0; -+ while (j < MAC_ADDR_LEN) { -+ if (macaddr[i] && macaddr[i] != ':') { -+ got_num++; -+ if ('0' <= macaddr[i] && macaddr[i] <= '9') -+ num = num * 16 + macaddr[i] - '0'; -+ else if ('A' <= macaddr[i] && macaddr[i] <= 'F') -+ num = num * 16 + 10 + macaddr[i] - 'A'; -+ else if ('a' <= macaddr[i] && macaddr[i] <= 'f') -+ num = num * 16 + 10 + macaddr[i] - 'a'; -+ else -+ break; -+ i++; -+ } else if (got_num == 2) { -+ mtbl[j++] = (u8) num; -+ num = 0; -+ got_num = 0; -+ i++; -+ } else { -+ break; -+ } -+ } ++ fragment@1 { ++ target = <&spidev0>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; + -+ if (j == MAC_ADDR_LEN) { -+ netif_dbg(dev, ifup, dev->net, "Overriding MAC address with: " -+ "%02x:%02x:%02x:%02x:%02x:%02x\n", mtbl[0], mtbl[1], mtbl[2], -+ mtbl[3], mtbl[4], mtbl[5]); -+ for (i = 0; i < MAC_ADDR_LEN; i++) -+ dev_mac[i] = mtbl[i]; -+ return 1; -+ } else { -+ return 0; -+ } -+} ++ fragment@2 { ++ target = <&spidev1>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; + - static void smsc95xx_init_mac_address(struct usbnet *dev) - { -+ /* Check module parameters */ -+ if (smsc95xx_is_macaddr_param(dev, dev->net->dev_addr)) -+ return; ++ fragment@3 { ++ target = <&gpio>; ++ __overlay__ { ++ piscreen2_pins: piscreen2_pins { ++ brcm,pins = <17 25 24 22>; ++ brcm,function = <0 1 1 1>; /* in out out out */ ++ }; ++ }; ++ }; + - /* try reading mac address from EEPROM */ - if (smsc95xx_read_eeprom(dev, EEPROM_MAC_OFFSET, ETH_ALEN, - dev->net->dev_addr) == 0) { - -From e172d31b8402f13aed5679cd7023f0c0935aab05 Mon Sep 17 00:00:00 2001 -From: popcornmix <popcornmix@gmail.com> -Date: Wed, 8 May 2013 11:46:50 +0100 -Subject: [PATCH 060/170] enabling the realtime clock 1-wire chip DS1307 and - 1-wire on GPIO4 (as a module) - -1-wire: Add support for configuring pin for w1-gpio kernel module -See: https://github.com/raspberrypi/linux/pull/457 - -Add bitbanging pullups, use them for w1-gpio - -Allows parasite power to work, uses module option pullup=1 - -bcm2708: Ensure 1-wire pullup is disabled by default, and expose as module parameter - -Signed-off-by: Alex J Lennon <ajlennon@dynamicdevices.co.uk> - -w1-gpio: Add gpiopin module parameter and correctly free up gpio pull-up pin, if set - -Signed-off-by: Alex J Lennon <ajlennon@dynamicdevices.co.uk> - -w1-gpio: Sort out the pullup/parasitic power tangle ---- - drivers/w1/masters/w1-gpio.c | 69 ++++++++++++++++++++++++++++++++++++++++---- - drivers/w1/w1.h | 6 ++++ - drivers/w1/w1_int.c | 14 +++++++++ - drivers/w1/w1_io.c | 18 ++++++++++-- - include/linux/w1-gpio.h | 1 + - 5 files changed, 99 insertions(+), 9 deletions(-) - -diff --git a/drivers/w1/masters/w1-gpio.c b/drivers/w1/masters/w1-gpio.c -index a373ae6..080e597 100644 ---- a/drivers/w1/masters/w1-gpio.c -+++ b/drivers/w1/masters/w1-gpio.c -@@ -23,6 +23,19 @@ - #include "../w1.h" - #include "../w1_int.h" - -+static int w1_gpio_pullup = 0; -+static int w1_gpio_pullup_orig = 0; -+module_param_named(pullup, w1_gpio_pullup, int, 0); -+MODULE_PARM_DESC(pullup, "Enable parasitic power (power on data) mode"); -+static int w1_gpio_pullup_pin = -1; -+static int w1_gpio_pullup_pin_orig = -1; -+module_param_named(extpullup, w1_gpio_pullup_pin, int, 0); -+MODULE_PARM_DESC(extpullup, "GPIO external pullup pin number"); -+static int w1_gpio_pin = -1; -+static int w1_gpio_pin_orig = -1; -+module_param_named(gpiopin, w1_gpio_pin, int, 0); -+MODULE_PARM_DESC(gpiopin, "GPIO pin number"); ++ fragment@4 { ++ target = <&spi0>; ++ __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; + - static u8 w1_gpio_set_pullup(void *data, int delay) - { - struct w1_gpio_platform_data *pdata = data; -@@ -67,6 +80,16 @@ static u8 w1_gpio_read_bit(void *data) - return gpio_get_value(pdata->pin) ? 1 : 0; - } - -+static void w1_gpio_bitbang_pullup(void *data, u8 on) -+{ -+ struct w1_gpio_platform_data *pdata = data; ++ piscreen2: piscreen2@0{ ++ compatible = "ilitek,ili9486"; ++ reg = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&piscreen2_pins>; ++ bgr; ++ spi-max-frequency = <64000000>; ++ rotate = <90>; ++ fps = <30>; ++ buswidth = <8>; ++ regwidth = <16>; ++ txbuflen = <32768>; ++ reset-gpios = <&gpio 25 0>; ++ dc-gpios = <&gpio 24 0>; ++ led-gpios = <&gpio 22 1>; ++ debug = <0>; + -+ if (on) -+ gpio_direction_output(pdata->pin, 1); -+ else -+ gpio_direction_input(pdata->pin); -+} ++ init = <0x10000b0 0x00 ++ 0x1000011 ++ 0x20000ff ++ 0x100003a 0x55 ++ 0x1000036 0x28 ++ 0x10000c0 0x11 0x09 ++ 0x10000c1 0x41 ++ 0x10000c5 0x00 0x00 0x00 0x00 ++ 0x10000b6 0x00 0x02 ++ 0x10000f7 0xa9 0x51 0x2c 0x2 ++ 0x10000be 0x00 0x04 ++ 0x10000e9 0x00 ++ 0x1000011 ++ 0x1000029>; + - #if defined(CONFIG_OF) - static const struct of_device_id w1_gpio_dt_ids[] = { - { .compatible = "w1-gpio" }, -@@ -80,6 +103,7 @@ static int w1_gpio_probe_dt(struct platform_device *pdev) - struct w1_gpio_platform_data *pdata = dev_get_platdata(&pdev->dev); - struct device_node *np = pdev->dev.of_node; - int gpio; -+ u32 value; - - pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); - if (!pdata) -@@ -88,6 +112,9 @@ static int w1_gpio_probe_dt(struct platform_device *pdev) - if (of_get_property(np, "linux,open-drain", NULL)) - pdata->is_open_drain = 1; - -+ if (of_property_read_u32(np, "rpi,parasitic-power", &value) == 0) -+ pdata->parasitic_power = (value != 0); ++ }; + - gpio = of_get_gpio(np, 0); - if (gpio < 0) { - if (gpio != -EPROBE_DEFER) -@@ -103,7 +130,7 @@ static int w1_gpio_probe_dt(struct platform_device *pdev) - if (gpio == -EPROBE_DEFER) - return gpio; - /* ignore other errors as the pullup gpio is optional */ -- pdata->ext_pullup_enable_pin = gpio; -+ pdata->ext_pullup_enable_pin = (gpio >= 0) ? gpio : -1; - - pdev->dev.platform_data = pdata; - -@@ -113,13 +140,15 @@ static int w1_gpio_probe_dt(struct platform_device *pdev) - static int w1_gpio_probe(struct platform_device *pdev) - { - struct w1_bus_master *master; -- struct w1_gpio_platform_data *pdata; -+ struct w1_gpio_platform_data *pdata = pdev->dev.platform_data; - int err; - -- if (of_have_populated_dt()) { -- err = w1_gpio_probe_dt(pdev); -- if (err < 0) -- return err; -+ if(pdata == NULL) { -+ if (of_have_populated_dt()) { -+ err = w1_gpio_probe_dt(pdev); -+ if (err < 0) -+ return err; -+ } - } - - pdata = dev_get_platdata(&pdev->dev); -@@ -136,6 +165,22 @@ static int w1_gpio_probe(struct platform_device *pdev) - return -ENOMEM; - } - -+ w1_gpio_pin_orig = pdata->pin; -+ w1_gpio_pullup_pin_orig = pdata->ext_pullup_enable_pin; -+ w1_gpio_pullup_orig = pdata->parasitic_power; ++ piscreen2_ts: piscreen2-ts@1 { ++ compatible = "ti,ads7846"; ++ reg = <1>; + -+ if(gpio_is_valid(w1_gpio_pin)) { -+ pdata->pin = w1_gpio_pin; -+ pdata->ext_pullup_enable_pin = -1; -+ pdata->parasitic_power = -1; -+ } -+ pdata->parasitic_power |= w1_gpio_pullup; -+ if(gpio_is_valid(w1_gpio_pullup_pin)) { -+ pdata->ext_pullup_enable_pin = w1_gpio_pullup_pin; -+ } ++ spi-max-frequency = <2000000>; ++ interrupts = <17 2>; /* high-to-low edge triggered */ ++ interrupt-parent = <&gpio>; ++ pendown-gpio = <&gpio 17 0>; ++ ti,swap-xy; ++ ti,x-plate-ohms = /bits/ 16 <100>; ++ ti,pressure-max = /bits/ 16 <255>; ++ }; ++ }; ++ }; ++ __overrides__ { ++ speed = <&piscreen2>,"spi-max-frequency:0"; ++ rotate = <&piscreen2>,"rotate:0"; ++ fps = <&piscreen2>,"fps:0"; ++ debug = <&piscreen2>,"debug:0"; ++ xohms = <&piscreen2_ts>,"ti,x-plate-ohms;0"; ++ }; ++}; + -+ dev_info(&pdev->dev, "gpio pin %d, external pullup pin %d, parasitic power %d\n", pdata->pin, pdata->ext_pullup_enable_pin, pdata->parasitic_power); +diff --git a/arch/arm/boot/dts/overlays/pitft22-overlay.dts b/arch/arm/boot/dts/overlays/pitft22-overlay.dts +new file mode 100644 +index 0000000..894ba22 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/pitft22-overlay.dts +@@ -0,0 +1,69 @@ ++/* ++ * Device Tree overlay for pitft by Adafruit ++ * ++ */ + - err = devm_gpio_request(&pdev->dev, pdata->pin, "w1"); - if (err) { - dev_err(&pdev->dev, "gpio_request (pin) failed\n"); -@@ -165,6 +210,14 @@ static int w1_gpio_probe(struct platform_device *pdev) - master->set_pullup = w1_gpio_set_pullup; - } - -+ if (pdata->parasitic_power) { -+ if (pdata->is_open_drain) -+ printk(KERN_ERR "w1-gpio 'pullup'(parasitic power) " -+ "option doesn't work with open drain GPIO\n"); -+ else -+ master->bitbang_pullup = w1_gpio_bitbang_pullup; -+ } ++/dts-v1/; ++/plugin/; + - err = w1_add_master_device(master); - if (err) { - dev_err(&pdev->dev, "w1_add_master device failed\n"); -@@ -195,6 +248,10 @@ static int w1_gpio_remove(struct platform_device *pdev) - - w1_remove_master_device(master); - -+ pdata->pin = w1_gpio_pin_orig; -+ pdata->ext_pullup_enable_pin = w1_gpio_pullup_pin_orig; -+ pdata->parasitic_power = w1_gpio_pullup_orig; ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; + - return 0; - } - -diff --git a/drivers/w1/w1.h b/drivers/w1/w1.h -index 56a49ba..881d728 100644 ---- a/drivers/w1/w1.h -+++ b/drivers/w1/w1.h -@@ -171,6 +171,12 @@ struct w1_bus_master - - u8 (*set_pullup)(void *, int); - -+ /** -+ * Turns the pullup on/off in bitbanging mode, takes an on/off argument. -+ * @return -1=Error, 0=completed -+ */ -+ void (*bitbang_pullup) (void *, u8); ++ fragment@0 { ++ target = <&spi0>; ++ __overlay__ { ++ status = "okay"; + - void (*search)(void *, struct w1_master *, - u8, w1_slave_found_callback); - }; -diff --git a/drivers/w1/w1_int.c b/drivers/w1/w1_int.c -index 20f766a..c4fbdb1 100644 ---- a/drivers/w1/w1_int.c -+++ b/drivers/w1/w1_int.c -@@ -122,6 +122,20 @@ int w1_add_master_device(struct w1_bus_master *master) - return(-EINVAL); - } - -+ /* bitbanging hardware uses bitbang_pullup, other hardware uses set_pullup -+ * and takes care of timing itself */ -+ if (!master->write_byte && !master->touch_bit && master->set_pullup) { -+ printk(KERN_ERR "w1_add_master_device: set_pullup requires " -+ "write_byte or touch_bit, disabling\n"); -+ master->set_pullup = NULL; -+ } ++ spidev@0{ ++ status = "disabled"; ++ }; + -+ if (master->set_pullup && master->bitbang_pullup) { -+ printk(KERN_ERR "w1_add_master_device: set_pullup should not " -+ "be set when bitbang_pullup is used, disabling\n"); -+ master->set_pullup = NULL; -+ } ++ spidev@1{ ++ status = "disabled"; ++ }; ++ }; ++ }; + - /* Lock until the device is added (or not) to w1_masters. */ - mutex_lock(&w1_mlock); - /* Search for the first available id (starting at 1). */ -diff --git a/drivers/w1/w1_io.c b/drivers/w1/w1_io.c -index 2820924..fd0550f 100644 ---- a/drivers/w1/w1_io.c -+++ b/drivers/w1/w1_io.c -@@ -134,10 +134,22 @@ static void w1_pre_write(struct w1_master *dev) - static void w1_post_write(struct w1_master *dev) - { - if (dev->pullup_duration) { -- if (dev->enable_pullup && dev->bus_master->set_pullup) -- dev->bus_master->set_pullup(dev->bus_master->data, 0); -- else -+ if (dev->enable_pullup) { -+ if (dev->bus_master->set_pullup) { -+ dev->bus_master->set_pullup(dev-> -+ bus_master->data, -+ 0); -+ } else if (dev->bus_master->bitbang_pullup) { -+ dev->bus_master-> -+ bitbang_pullup(dev->bus_master->data, 1); -+ msleep(dev->pullup_duration); -+ dev->bus_master-> -+ bitbang_pullup(dev->bus_master->data, 0); -+ } -+ } else { - msleep(dev->pullup_duration); -+ } ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ pitft_pins: pitft_pins { ++ brcm,pins = <25>; ++ brcm,function = <1>; /* out */ ++ brcm,pull = <0>; /* none */ ++ }; ++ }; ++ }; + - dev->pullup_duration = 0; - } - } -diff --git a/include/linux/w1-gpio.h b/include/linux/w1-gpio.h -index d58594a..feae942 100644 ---- a/include/linux/w1-gpio.h -+++ b/include/linux/w1-gpio.h -@@ -18,6 +18,7 @@ - struct w1_gpio_platform_data { - unsigned int pin; - unsigned int is_open_drain:1; -+ unsigned int parasitic_power:1; - void (*enable_external_pullup)(int enable); - unsigned int ext_pullup_enable_pin; - unsigned int pullup_duration; - -From d0f48fe7aab3e4036fd55b491a9be94ea24f377d Mon Sep 17 00:00:00 2001 -From: popcornmix <popcornmix@gmail.com> -Date: Wed, 18 Dec 2013 22:16:19 +0000 -Subject: [PATCH 062/170] config: Enable CONFIG_MEMCG, but leave it disabled - (due to memory cost). Enable with cgroup_enable=memory. - ---- - kernel/cgroup.c | 23 ++++++++++++++++++++++- - 1 file changed, 22 insertions(+), 1 deletion(-) - -diff --git a/kernel/cgroup.c b/kernel/cgroup.c -index fb1ecfd..888d308 100644 ---- a/kernel/cgroup.c -+++ b/kernel/cgroup.c -@@ -5286,7 +5286,7 @@ int __init cgroup_init_early(void) - return 0; - } - --static unsigned long cgroup_disable_mask __initdata; -+static unsigned long cgroup_disable_mask __initdata = 1<<0; - - /** - * cgroup_init - cgroup initialization -@@ -5782,6 +5782,27 @@ static int __init cgroup_disable(char *str) - } - __setup("cgroup_disable=", cgroup_disable); - -+static int __init cgroup_enable(char *str) -+{ -+ struct cgroup_subsys *ss; -+ char *token; -+ int i; ++ fragment@2 { ++ target = <&spi0>; ++ __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; + -+ while ((token = strsep(&str, ",")) != NULL) { -+ if (!*token) -+ continue; ++ pitft: pitft@0{ ++ compatible = "ilitek,ili9340"; ++ reg = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pitft_pins>; + -+ for_each_subsys(ss, i) { -+ if (strcmp(token, ss->name) && -+ strcmp(token, ss->legacy_name)) -+ continue; -+ cgroup_disable_mask &= ~(1 << i); -+ } -+ } -+ return 1; -+} -+__setup("cgroup_enable=", cgroup_enable); ++ spi-max-frequency = <32000000>; ++ rotate = <90>; ++ fps = <25>; ++ bgr; ++ buswidth = <8>; ++ dc-gpios = <&gpio 25 0>; ++ debug = <0>; ++ }; + - /** - * css_tryget_online_from_dir - get corresponding css from a cgroup dentry - * @dentry: directory dentry of interest - -From 8d35b3a72d3580ad6f5bc5835bfe13b00cce6086 Mon Sep 17 00:00:00 2001 -From: Florian Meier <florian.meier@koalo.de> -Date: Fri, 22 Nov 2013 14:59:51 +0100 -Subject: [PATCH 063/170] ASoC: Add support for PCM5102A codec - -Some definitions to support the PCM5102A codec -by Texas Instruments. - -Signed-off-by: Florian Meier <florian.meier@koalo.de> ---- - sound/soc/codecs/Kconfig | 5 ++++ - sound/soc/codecs/Makefile | 2 ++ - sound/soc/codecs/pcm5102a.c | 70 +++++++++++++++++++++++++++++++++++++++++++++ - 3 files changed, 77 insertions(+) - create mode 100644 sound/soc/codecs/pcm5102a.c - -diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig -index cfdafc4..bd38590 100644 ---- a/sound/soc/codecs/Kconfig -+++ b/sound/soc/codecs/Kconfig -@@ -89,6 +89,7 @@ config SND_SOC_ALL_CODECS - select SND_SOC_PCM512x_SPI if SPI_MASTER - select SND_SOC_RT286 if I2C - select SND_SOC_RT298 if I2C -+ select SND_SOC_PCM5102A if I2C - select SND_SOC_RT5631 if I2C - select SND_SOC_RT5640 if I2C - select SND_SOC_RT5645 if I2C -@@ -549,6 +550,10 @@ config SND_SOC_RT298 - tristate - depends on I2C - -+config SND_SOC_PCM5102A -+ tristate -+ depends on I2C ++ }; ++ }; + - config SND_SOC_RT5631 - tristate "Realtek ALC5631/RT5631 CODEC" - depends on I2C -diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile -index f632fc4..7ba76ba 100644 ---- a/sound/soc/codecs/Makefile -+++ b/sound/soc/codecs/Makefile -@@ -85,6 +85,7 @@ snd-soc-rl6231-objs := rl6231.o - snd-soc-rl6347a-objs := rl6347a.o - snd-soc-rt286-objs := rt286.o - snd-soc-rt298-objs := rt298.o -+snd-soc-pcm5102a-objs := pcm5102a.o - snd-soc-rt5631-objs := rt5631.o - snd-soc-rt5640-objs := rt5640.o - snd-soc-rt5645-objs := rt5645.o -@@ -280,6 +281,7 @@ obj-$(CONFIG_SND_SOC_RL6231) += snd-soc-rl6231.o - obj-$(CONFIG_SND_SOC_RL6347A) += snd-soc-rl6347a.o - obj-$(CONFIG_SND_SOC_RT286) += snd-soc-rt286.o - obj-$(CONFIG_SND_SOC_RT298) += snd-soc-rt298.o -+obj-$(CONFIG_SND_SOC_PCM5102A) += snd-soc-pcm5102a.o - obj-$(CONFIG_SND_SOC_RT5631) += snd-soc-rt5631.o - obj-$(CONFIG_SND_SOC_RT5640) += snd-soc-rt5640.o - obj-$(CONFIG_SND_SOC_RT5645) += snd-soc-rt5645.o -diff --git a/sound/soc/codecs/pcm5102a.c b/sound/soc/codecs/pcm5102a.c ++ __overrides__ { ++ speed = <&pitft>,"spi-max-frequency:0"; ++ rotate = <&pitft>,"rotate:0"; ++ fps = <&pitft>,"fps:0"; ++ debug = <&pitft>,"debug:0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/pitft28-capacitive-overlay.dts b/arch/arm/boot/dts/overlays/pitft28-capacitive-overlay.dts new file mode 100644 -index 0000000..7c6598e +index 0000000..5c07526 --- /dev/null -+++ b/sound/soc/codecs/pcm5102a.c -@@ -0,0 +1,70 @@ ++++ b/arch/arm/boot/dts/overlays/pitft28-capacitive-overlay.dts +@@ -0,0 +1,91 @@ +/* -+ * Driver for the PCM5102A codec -+ * -+ * Author: Florian Meier <florian.meier@koalo.de> -+ * Copyright 2013 -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License -+ * version 2 as published by the Free Software Foundation. ++ * Device Tree overlay for Adafruit PiTFT 2.8" capacitive touch screen + * -+ * This program is distributed in the hope that it will be useful, but -+ * WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * General Public License for more details. + */ + ++/dts-v1/; ++/plugin/; + -+#include <linux/init.h> -+#include <linux/module.h> -+#include <linux/platform_device.h> ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; + -+#include <sound/soc.h> ++ fragment@0 { ++ target = <&spi0>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; + -+static struct snd_soc_dai_driver pcm5102a_dai = { -+ .name = "pcm5102a-hifi", -+ .playback = { -+ .channels_min = 2, -+ .channels_max = 2, -+ .rates = SNDRV_PCM_RATE_8000_192000, -+ .formats = SNDRV_PCM_FMTBIT_S16_LE | -+ SNDRV_PCM_FMTBIT_S24_LE | -+ SNDRV_PCM_FMTBIT_S32_LE -+ }, -+}; ++ fragment@1 { ++ target = <&spidev0>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; + -+static struct snd_soc_codec_driver soc_codec_dev_pcm5102a; ++ fragment@2 { ++ target = <&gpio>; ++ __overlay__ { ++ pitft_pins: pitft_pins { ++ brcm,pins = <24 25>; ++ brcm,function = <0 1>; /* in out */ ++ brcm,pull = <2 0>; /* pullup none */ ++ }; ++ }; ++ }; + -+static int pcm5102a_probe(struct platform_device *pdev) -+{ -+ return snd_soc_register_codec(&pdev->dev, &soc_codec_dev_pcm5102a, -+ &pcm5102a_dai, 1); -+} ++ fragment@3 { ++ target = <&spi0>; ++ __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; + -+static int pcm5102a_remove(struct platform_device *pdev) -+{ -+ snd_soc_unregister_codec(&pdev->dev); -+ return 0; -+} ++ pitft: pitft@0{ ++ compatible = "ilitek,ili9340"; ++ reg = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pitft_pins>; + -+static const struct of_device_id pcm5102a_of_match[] = { -+ { .compatible = "ti,pcm5102a", }, -+ { } -+}; -+MODULE_DEVICE_TABLE(of, pcm5102a_of_match); ++ spi-max-frequency = <32000000>; ++ rotate = <90>; ++ fps = <25>; ++ bgr; ++ buswidth = <8>; ++ dc-gpios = <&gpio 25 0>; ++ debug = <0>; ++ }; ++ }; ++ }; + -+static struct platform_driver pcm5102a_codec_driver = { -+ .probe = pcm5102a_probe, -+ .remove = pcm5102a_remove, -+ .driver = { -+ .name = "pcm5102a-codec", -+ .owner = THIS_MODULE, -+ .of_match_table = pcm5102a_of_match, -+ }, -+}; -+ -+module_platform_driver(pcm5102a_codec_driver); ++ fragment@4 { ++ target = <&i2c1>; ++ __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; + -+MODULE_DESCRIPTION("ASoC PCM5102A codec driver"); -+MODULE_AUTHOR("Florian Meier <florian.meier@koalo.de>"); -+MODULE_LICENSE("GPL v2"); - -From 9ced0e86593de2214ff8a81f71c802d7e7301b05 Mon Sep 17 00:00:00 2001 -From: Florian Meier <florian.meier@koalo.de> -Date: Fri, 22 Nov 2013 19:19:08 +0100 -Subject: [PATCH 064/170] ASoC: Add support for HifiBerry DAC - -This adds a machine driver for the HifiBerry DAC. -It is a sound card that can -be stacked onto the Raspberry Pi. - -Signed-off-by: Florian Meier <florian.meier@koalo.de> ---- - sound/soc/bcm/Kconfig | 7 +++ - sound/soc/bcm/Makefile | 4 ++ - sound/soc/bcm/hifiberry_dac.c | 122 ++++++++++++++++++++++++++++++++++++++++++ - 3 files changed, 133 insertions(+) - create mode 100644 sound/soc/bcm/hifiberry_dac.c - -diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig -index c5070ae..ce81f14 100644 ---- a/sound/soc/bcm/Kconfig -+++ b/sound/soc/bcm/Kconfig -@@ -7,3 +7,10 @@ config SND_BCM2835_SOC_I2S - Say Y or M if you want to add support for codecs attached to - the BCM2835 I2S interface. You will also need - to select the audio interfaces to support below. ++ ft6236: ft6236@38 { ++ compatible = "focaltech,ft6236"; ++ reg = <0x38>; + -+config SND_BCM2708_SOC_HIFIBERRY_DAC -+ tristate "Support for HifiBerry DAC" -+ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S -+ select SND_SOC_PCM5102A -+ help -+ Say Y or M if you want to add support for HifiBerry DAC. -diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile -index bc816b7..b877d38 100644 ---- a/sound/soc/bcm/Makefile -+++ b/sound/soc/bcm/Makefile -@@ -3,3 +3,7 @@ snd-soc-bcm2835-i2s-objs := bcm2835-i2s.o - - obj-$(CONFIG_SND_BCM2835_SOC_I2S) += snd-soc-bcm2835-i2s.o - -+# BCM2708 Machine Support -+snd-soc-hifiberry-dac-objs := hifiberry_dac.o ++ interrupt-parent = <&gpio>; ++ interrupts = <24 2>; ++ touchscreen-size-x = <240>; ++ touchscreen-size-y = <320>; ++ }; ++ }; ++ }; + -+obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o -diff --git a/sound/soc/bcm/hifiberry_dac.c b/sound/soc/bcm/hifiberry_dac.c ++ __overrides__ { ++ speed = <&pitft>,"spi-max-frequency:0"; ++ rotate = <&pitft>,"rotate:0"; ++ fps = <&pitft>,"fps:0"; ++ debug = <&pitft>,"debug:0"; ++ touch-sizex = <&ft6236>,"touchscreen-size-x?"; ++ touch-sizey = <&ft6236>,"touchscreen-size-y?"; ++ touch-invx = <&ft6236>,"touchscreen-inverted-x?"; ++ touch-invy = <&ft6236>,"touchscreen-inverted-y?"; ++ touch-swapxy = <&ft6236>,"touchscreen-swapped-x-y?"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/pitft28-resistive-overlay.dts b/arch/arm/boot/dts/overlays/pitft28-resistive-overlay.dts new file mode 100644 -index 0000000..3ab0f47 +index 0000000..ed2afc2 --- /dev/null -+++ b/sound/soc/bcm/hifiberry_dac.c -@@ -0,0 +1,122 @@ ++++ b/arch/arm/boot/dts/overlays/pitft28-resistive-overlay.dts +@@ -0,0 +1,121 @@ +/* -+ * ASoC Driver for HifiBerry DAC -+ * -+ * Author: Florian Meier <florian.meier@koalo.de> -+ * Copyright 2013 -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License -+ * version 2 as published by the Free Software Foundation. ++ * Device Tree overlay for Adafruit PiTFT 2.8" resistive touch screen + * -+ * This program is distributed in the hope that it will be useful, but -+ * WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * General Public License for more details. + */ + -+#include <linux/module.h> -+#include <linux/platform_device.h> -+ -+#include <sound/core.h> -+#include <sound/pcm.h> -+#include <sound/pcm_params.h> -+#include <sound/soc.h> -+#include <sound/jack.h> -+ -+static int snd_rpi_hifiberry_dac_init(struct snd_soc_pcm_runtime *rtd) -+{ -+ return 0; -+} -+ -+static int snd_rpi_hifiberry_dac_hw_params(struct snd_pcm_substream *substream, -+ struct snd_pcm_hw_params *params) -+{ -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; ++/dts-v1/; ++/plugin/; + -+ unsigned int sample_bits = -+ snd_pcm_format_physical_width(params_format(params)); ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; + -+ return snd_soc_dai_set_bclk_ratio(cpu_dai, sample_bits * 2); -+} ++ fragment@0 { ++ target = <&spi0>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; + -+/* machine stream operations */ -+static struct snd_soc_ops snd_rpi_hifiberry_dac_ops = { -+ .hw_params = snd_rpi_hifiberry_dac_hw_params, -+}; ++ fragment@1 { ++ target = <&spidev0>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; + -+static struct snd_soc_dai_link snd_rpi_hifiberry_dac_dai[] = { -+{ -+ .name = "HifiBerry DAC", -+ .stream_name = "HifiBerry DAC HiFi", -+ .cpu_dai_name = "bcm2708-i2s.0", -+ .codec_dai_name = "pcm5102a-hifi", -+ .platform_name = "bcm2708-i2s.0", -+ .codec_name = "pcm5102a-codec", -+ .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | -+ SND_SOC_DAIFMT_CBS_CFS, -+ .ops = &snd_rpi_hifiberry_dac_ops, -+ .init = snd_rpi_hifiberry_dac_init, -+}, -+}; ++ fragment@2 { ++ target = <&spidev1>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; + -+/* audio machine driver */ -+static struct snd_soc_card snd_rpi_hifiberry_dac = { -+ .name = "snd_rpi_hifiberry_dac", -+ .dai_link = snd_rpi_hifiberry_dac_dai, -+ .num_links = ARRAY_SIZE(snd_rpi_hifiberry_dac_dai), -+}; ++ fragment@3 { ++ target = <&gpio>; ++ __overlay__ { ++ pitft_pins: pitft_pins { ++ brcm,pins = <24 25>; ++ brcm,function = <0 1>; /* in out */ ++ brcm,pull = <2 0>; /* pullup none */ ++ }; ++ }; ++ }; + -+static int snd_rpi_hifiberry_dac_probe(struct platform_device *pdev) -+{ -+ int ret = 0; ++ fragment@4 { ++ target = <&spi0>; ++ __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; + -+ snd_rpi_hifiberry_dac.dev = &pdev->dev; ++ pitft: pitft@0{ ++ compatible = "ilitek,ili9340"; ++ reg = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pitft_pins>; + -+ if (pdev->dev.of_node) { -+ struct device_node *i2s_node; -+ struct snd_soc_dai_link *dai = &snd_rpi_hifiberry_dac_dai[0]; -+ i2s_node = of_parse_phandle(pdev->dev.of_node, -+ "i2s-controller", 0); ++ spi-max-frequency = <32000000>; ++ rotate = <90>; ++ fps = <25>; ++ bgr; ++ buswidth = <8>; ++ dc-gpios = <&gpio 25 0>; ++ debug = <0>; ++ }; + -+ if (i2s_node) { -+ dai->cpu_dai_name = NULL; -+ dai->cpu_of_node = i2s_node; -+ dai->platform_name = NULL; -+ dai->platform_of_node = i2s_node; -+ } -+ } ++ pitft_ts@1 { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ compatible = "st,stmpe610"; ++ reg = <1>; + -+ ret = snd_soc_register_card(&snd_rpi_hifiberry_dac); -+ if (ret) -+ dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", ret); ++ spi-max-frequency = <500000>; ++ irq-gpio = <&gpio 24 0x2>; /* IRQF_TRIGGER_FALLING */ ++ interrupts = <24 2>; /* high-to-low edge triggered */ ++ interrupt-parent = <&gpio>; ++ interrupt-controller; + -+ return ret; -+} ++ stmpe_touchscreen { ++ compatible = "st,stmpe-ts"; ++ st,sample-time = <4>; ++ st,mod-12b = <1>; ++ st,ref-sel = <0>; ++ st,adc-freq = <2>; ++ st,ave-ctrl = <3>; ++ st,touch-det-delay = <4>; ++ st,settling = <2>; ++ st,fraction-z = <7>; ++ st,i-drive = <0>; ++ }; + -+static int snd_rpi_hifiberry_dac_remove(struct platform_device *pdev) -+{ -+ return snd_soc_unregister_card(&snd_rpi_hifiberry_dac); -+} ++ stmpe_gpio: stmpe_gpio { ++ #gpio-cells = <2>; ++ compatible = "st,stmpe-gpio"; ++ /* ++ * only GPIO2 is wired/available ++ * and it is wired to the backlight ++ */ ++ st,norequest-mask = <0x7b>; ++ }; ++ }; ++ }; ++ }; + -+static const struct of_device_id snd_rpi_hifiberry_dac_of_match[] = { -+ { .compatible = "hifiberry,hifiberry-dac", }, -+ {}, -+}; -+MODULE_DEVICE_TABLE(of, snd_rpi_hifiberry_dac_of_match); ++ fragment@5 { ++ target-path = "/soc"; ++ __overlay__ { ++ backlight { ++ compatible = "gpio-backlight"; ++ gpios = <&stmpe_gpio 2 0>; ++ default-on; ++ }; ++ }; ++ }; + -+static struct platform_driver snd_rpi_hifiberry_dac_driver = { -+ .driver = { -+ .name = "snd-hifiberry-dac", -+ .owner = THIS_MODULE, -+ .of_match_table = snd_rpi_hifiberry_dac_of_match, -+ }, -+ .probe = snd_rpi_hifiberry_dac_probe, -+ .remove = snd_rpi_hifiberry_dac_remove, ++ __overrides__ { ++ speed = <&pitft>,"spi-max-frequency:0"; ++ rotate = <&pitft>,"rotate:0"; ++ fps = <&pitft>,"fps:0"; ++ debug = <&pitft>,"debug:0"; ++ }; +}; +diff --git a/arch/arm/boot/dts/overlays/pps-gpio-overlay.dts b/arch/arm/boot/dts/overlays/pps-gpio-overlay.dts +new file mode 100644 +index 0000000..40bf0e1 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/pps-gpio-overlay.dts +@@ -0,0 +1,34 @@ ++/dts-v1/; ++/plugin/; + -+module_platform_driver(snd_rpi_hifiberry_dac_driver); ++/ { ++ compatible = "brcm,bcm2708"; ++ fragment@0 { ++ target-path = "/"; ++ __overlay__ { ++ pps: pps { ++ compatible = "pps-gpio"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pps_pins>; ++ gpios = <&gpio 18 0>; ++ status = "okay"; ++ }; ++ }; ++ }; + -+MODULE_AUTHOR("Florian Meier <florian.meier@koalo.de>"); -+MODULE_DESCRIPTION("ASoC Driver for HifiBerry DAC"); -+MODULE_LICENSE("GPL v2"); - -From f16a654f57b024d44fe58d62b660e01de6a7811a Mon Sep 17 00:00:00 2001 -From: Florian Meier <florian.meier@koalo.de> -Date: Fri, 22 Nov 2013 19:21:34 +0100 -Subject: [PATCH 065/170] ASoC: Add support for Rpi-DAC - ---- - sound/soc/bcm/Kconfig | 7 +++ - sound/soc/bcm/Makefile | 2 + - sound/soc/bcm/rpi-dac.c | 118 ++++++++++++++++++++++++++++++++++++++++++++ - sound/soc/codecs/Kconfig | 9 ++++ - sound/soc/codecs/Makefile | 2 + - sound/soc/codecs/pcm1794a.c | 69 ++++++++++++++++++++++++++ - 6 files changed, 207 insertions(+) - create mode 100644 sound/soc/bcm/rpi-dac.c - create mode 100644 sound/soc/codecs/pcm1794a.c - -diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig -index ce81f14..900de22 100644 ---- a/sound/soc/bcm/Kconfig -+++ b/sound/soc/bcm/Kconfig -@@ -14,3 +14,10 @@ config SND_BCM2708_SOC_HIFIBERRY_DAC - select SND_SOC_PCM5102A - help - Say Y or M if you want to add support for HifiBerry DAC. ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ pps_pins: pps_pins { ++ brcm,pins = <18>; ++ brcm,function = <0>; // in ++ brcm,pull = <0>; // off ++ }; ++ }; ++ }; + -+config SND_BCM2708_SOC_RPI_DAC -+ tristate "Support for RPi-DAC" -+ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S -+ select SND_SOC_PCM1794A -+ help -+ Say Y or M if you want to add support for RPi-DAC. -diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile -index b877d38..99c96b4 100644 ---- a/sound/soc/bcm/Makefile -+++ b/sound/soc/bcm/Makefile -@@ -5,5 +5,7 @@ obj-$(CONFIG_SND_BCM2835_SOC_I2S) += snd-soc-bcm2835-i2s.o - - # BCM2708 Machine Support - snd-soc-hifiberry-dac-objs := hifiberry_dac.o -+snd-soc-rpi-dac-objs := rpi-dac.o - - obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o -+obj-$(CONFIG_SND_BCM2708_SOC_RPI_DAC) += snd-soc-rpi-dac.o -diff --git a/sound/soc/bcm/rpi-dac.c b/sound/soc/bcm/rpi-dac.c ++ __overrides__ { ++ gpiopin = <&pps>,"gpios:4", ++ <&pps_pins>,"brcm,pins:0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/pwm-2chan-overlay.dts b/arch/arm/boot/dts/overlays/pwm-2chan-overlay.dts new file mode 100644 -index 0000000..d5fac1b +index 0000000..18e4e4f --- /dev/null -+++ b/sound/soc/bcm/rpi-dac.c -@@ -0,0 +1,118 @@ ++++ b/arch/arm/boot/dts/overlays/pwm-2chan-overlay.dts +@@ -0,0 +1,53 @@ ++/dts-v1/; ++/plugin/; ++ +/* -+ * ASoC Driver for RPi-DAC. -+ * -+ * Author: Florian Meier <florian.meier@koalo.de> -+ * Copyright 2013 -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License -+ * version 2 as published by the Free Software Foundation. -+ * -+ * This program is distributed in the hope that it will be useful, but -+ * WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * General Public License for more details. -+ */ ++This is the 2-channel overlay - only use it if you need both channels. + -+#include <linux/module.h> -+#include <linux/platform_device.h> ++Legal pin,function combinations for each channel: ++ PWM0: 12,4(Alt0) 18,2(Alt5) 40,4(Alt0) 52,5(Alt1) ++ PWM1: 13,4(Alt0) 19,2(Alt5) 41,4(Alt0) 45,4(Alt0) 53,5(Alt1) + -+#include <sound/core.h> -+#include <sound/pcm.h> -+#include <sound/pcm_params.h> -+#include <sound/soc.h> -+#include <sound/jack.h> ++N.B.: ++ 1) Pin 18 is the only one available on all platforms, and ++ it is the one used by the I2S audio interface. ++ Pins 12 and 13 might be better choices on an A+, B+ or Pi2. ++ 2) The onboard analogue audio output uses both PWM channels. ++ 3) So be careful mixing audio and PWM. ++*/ + -+static int snd_rpi_rpi_dac_init(struct snd_soc_pcm_runtime *rtd) -+{ -+ return 0; -+} ++/ { ++ fragment@0 { ++ target = <&gpio>; ++ __overlay__ { ++ pwm_pins: pwm_pins { ++ brcm,pins = <18 19>; ++ brcm,function = <2 2>; /* Alt5 */ ++ }; ++ }; ++ }; + -+static int snd_rpi_rpi_dac_hw_params(struct snd_pcm_substream *substream, -+ struct snd_pcm_hw_params *params) -+{ -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; ++ fragment@1 { ++ target = <&pwm>; ++ __overlay__ { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pwm_pins>; ++ status = "okay"; ++ }; ++ }; + -+ return snd_soc_dai_set_bclk_ratio(cpu_dai, 32*2); -+} ++ fragment@2 { ++ target = <&clk_pwm>; ++ frag2: __overlay__ { ++ clock-frequency = <100000000>; ++ }; ++ }; + -+/* machine stream operations */ -+static struct snd_soc_ops snd_rpi_rpi_dac_ops = { -+ .hw_params = snd_rpi_rpi_dac_hw_params, ++ __overrides__ { ++ pin = <&pwm_pins>,"brcm,pins:0"; ++ pin2 = <&pwm_pins>,"brcm,pins:4"; ++ func = <&pwm_pins>,"brcm,function:0"; ++ func2 = <&pwm_pins>,"brcm,function:4"; ++ clock = <&frag2>,"clock-frequency:0"; ++ }; +}; +diff --git a/arch/arm/boot/dts/overlays/pwm-overlay.dts b/arch/arm/boot/dts/overlays/pwm-overlay.dts +new file mode 100644 +index 0000000..bf030a6 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/pwm-overlay.dts +@@ -0,0 +1,49 @@ ++/dts-v1/; ++/plugin/; + -+static struct snd_soc_dai_link snd_rpi_rpi_dac_dai[] = { -+{ -+ .name = "RPi-DAC", -+ .stream_name = "RPi-DAC HiFi", -+ .cpu_dai_name = "bcm2708-i2s.0", -+ .codec_dai_name = "pcm1794a-hifi", -+ .platform_name = "bcm2708-i2s.0", -+ .codec_name = "pcm1794a-codec", -+ .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | -+ SND_SOC_DAIFMT_CBS_CFS, -+ .ops = &snd_rpi_rpi_dac_ops, -+ .init = snd_rpi_rpi_dac_init, -+}, -+}; ++/* ++Legal pin,function combinations for each channel: ++ PWM0: 12,4(Alt0) 18,2(Alt5) 40,4(Alt0) 52,5(Alt1) ++ PWM1: 13,4(Alt0) 19,2(Alt5) 41,4(Alt0) 45,4(Alt0) 53,5(Alt1) + -+/* audio machine driver */ -+static struct snd_soc_card snd_rpi_rpi_dac = { -+ .name = "snd_rpi_rpi_dac", -+ .dai_link = snd_rpi_rpi_dac_dai, -+ .num_links = ARRAY_SIZE(snd_rpi_rpi_dac_dai), -+}; ++N.B.: ++ 1) Pin 18 is the only one available on all platforms, and ++ it is the one used by the I2S audio interface. ++ Pins 12 and 13 might be better choices on an A+, B+ or Pi2. ++ 2) The onboard analogue audio output uses both PWM channels. ++ 3) So be careful mixing audio and PWM. ++*/ + -+static int snd_rpi_rpi_dac_probe(struct platform_device *pdev) -+{ -+ int ret = 0; ++/ { ++ fragment@0 { ++ target = <&gpio>; ++ __overlay__ { ++ pwm_pins: pwm_pins { ++ brcm,pins = <18>; ++ brcm,function = <2>; /* Alt5 */ ++ }; ++ }; ++ }; + -+ snd_rpi_rpi_dac.dev = &pdev->dev; -+ -+ if (pdev->dev.of_node) { -+ struct device_node *i2s_node; -+ struct snd_soc_dai_link *dai = &snd_rpi_rpi_dac_dai[0]; -+ i2s_node = of_parse_phandle(pdev->dev.of_node, "i2s-controller", 0); ++ fragment@1 { ++ target = <&pwm>; ++ __overlay__ { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pwm_pins>; ++ status = "okay"; ++ }; ++ }; + -+ if (i2s_node) { -+ dai->cpu_dai_name = NULL; -+ dai->cpu_of_node = i2s_node; -+ dai->platform_name = NULL; -+ dai->platform_of_node = i2s_node; -+ } -+ } -+ -+ ret = snd_soc_register_card(&snd_rpi_rpi_dac); -+ if (ret) -+ dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", ret); ++ fragment@2 { ++ target = <&clk_pwm>; ++ frag2: __overlay__ { ++ clock-frequency = <100000000>; ++ }; ++ }; + -+ return ret; -+} ++ __overrides__ { ++ pin = <&pwm_pins>,"brcm,pins:0"; ++ func = <&pwm_pins>,"brcm,function:0"; ++ clock = <&frag2>,"clock-frequency:0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/qca7000-overlay.dts b/arch/arm/boot/dts/overlays/qca7000-overlay.dts +new file mode 100644 +index 0000000..b4e6013 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/qca7000-overlay.dts +@@ -0,0 +1,52 @@ ++// Overlay for the Qualcomm Atheros QCA7000 on I2SE's PLC Stamp micro EVK ++// Visit: https://www.i2se.com/product/plc-stamp-micro-evk for details + -+static int snd_rpi_rpi_dac_remove(struct platform_device *pdev) -+{ -+ return snd_soc_unregister_card(&snd_rpi_rpi_dac); -+} ++/dts-v1/; ++/plugin/; + -+static const struct of_device_id snd_rpi_rpi_dac_of_match[] = { -+ { .compatible = "rpi,rpi-dac", }, -+ {}, -+}; -+MODULE_DEVICE_TABLE(of, snd_rpi_rpi_dac_of_match); ++/ { ++ compatible = "brcm,bcm2708"; + -+static struct platform_driver snd_rpi_rpi_dac_driver = { -+ .driver = { -+ .name = "snd-rpi-dac", -+ .owner = THIS_MODULE, -+ .of_match_table = snd_rpi_rpi_dac_of_match, -+ }, -+ .probe = snd_rpi_rpi_dac_probe, -+ .remove = snd_rpi_rpi_dac_remove, -+}; ++ fragment@0 { ++ target = <&spi0>; ++ __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; + -+module_platform_driver(snd_rpi_rpi_dac_driver); ++ status = "okay"; + -+MODULE_AUTHOR("Florian Meier <florian.meier@koalo.de>"); -+MODULE_DESCRIPTION("ASoC Driver for RPi-DAC"); -+MODULE_LICENSE("GPL v2"); -diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig -index bd38590..b63f2fb 100644 ---- a/sound/soc/codecs/Kconfig -+++ b/sound/soc/codecs/Kconfig -@@ -90,6 +90,7 @@ config SND_SOC_ALL_CODECS - select SND_SOC_RT286 if I2C - select SND_SOC_RT298 if I2C - select SND_SOC_PCM5102A if I2C -+ select SND_SOC_PCM1794A if I2C - select SND_SOC_RT5631 if I2C - select SND_SOC_RT5640 if I2C - select SND_SOC_RT5645 if I2C -@@ -550,6 +551,14 @@ config SND_SOC_RT298 - tristate - depends on I2C - -+config SND_SOC_RT298 -+ tristate -+ depends on I2C ++ spidev@0 { ++ status = "disabled"; ++ }; + -+config SND_SOC_PCM1794A -+ tristate -+ depends on I2C ++ eth1: qca7000@0 { ++ compatible = "qca,qca7000"; ++ reg = <0>; /* CE0 */ ++ pinctrl-names = "default"; ++ pinctrl-0 = <&eth1_pins>; ++ interrupt-parent = <&gpio>; ++ interrupts = <23 0x1>; /* rising edge */ ++ spi-max-frequency = <12000000>; ++ status = "okay"; ++ }; ++ }; ++ }; + - config SND_SOC_PCM5102A - tristate - depends on I2C -diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile -index 7ba76ba..2147436 100644 ---- a/sound/soc/codecs/Makefile -+++ b/sound/soc/codecs/Makefile -@@ -85,6 +85,7 @@ snd-soc-rl6231-objs := rl6231.o - snd-soc-rl6347a-objs := rl6347a.o - snd-soc-rt286-objs := rt286.o - snd-soc-rt298-objs := rt298.o -+snd-soc-pcm1794a-objs := pcm1794a.o - snd-soc-pcm5102a-objs := pcm5102a.o - snd-soc-rt5631-objs := rt5631.o - snd-soc-rt5640-objs := rt5640.o -@@ -281,6 +282,7 @@ obj-$(CONFIG_SND_SOC_RL6231) += snd-soc-rl6231.o - obj-$(CONFIG_SND_SOC_RL6347A) += snd-soc-rl6347a.o - obj-$(CONFIG_SND_SOC_RT286) += snd-soc-rt286.o - obj-$(CONFIG_SND_SOC_RT298) += snd-soc-rt298.o -+obj-$(CONFIG_SND_SOC_PCM1794A) += snd-soc-pcm1794a.o - obj-$(CONFIG_SND_SOC_PCM5102A) += snd-soc-pcm5102a.o - obj-$(CONFIG_SND_SOC_RT5631) += snd-soc-rt5631.o - obj-$(CONFIG_SND_SOC_RT5640) += snd-soc-rt5640.o -diff --git a/sound/soc/codecs/pcm1794a.c b/sound/soc/codecs/pcm1794a.c ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ eth1_pins: eth1_pins { ++ brcm,pins = <23>; ++ brcm,function = <0>; /* in */ ++ brcm,pull = <0>; /* none */ ++ }; ++ }; ++ }; ++ ++ __overrides__ { ++ int_pin = <&eth1>, "interrupts:0", ++ <&eth1_pins>, "brcm,pins:0"; ++ speed = <&eth1>, "spi-max-frequency:0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/raspidac3-overlay.dts b/arch/arm/boot/dts/overlays/raspidac3-overlay.dts new file mode 100644 -index 0000000..afe1b41 +index 0000000..2fac57c --- /dev/null -+++ b/sound/soc/codecs/pcm1794a.c -@@ -0,0 +1,69 @@ -+/* -+ * Driver for the PCM1794A codec -+ * -+ * Author: Florian Meier <florian.meier@koalo.de> -+ * Copyright 2013 -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License -+ * version 2 as published by the Free Software Foundation. -+ * -+ * This program is distributed in the hope that it will be useful, but -+ * WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * General Public License for more details. -+ */ ++++ b/arch/arm/boot/dts/overlays/raspidac3-overlay.dts +@@ -0,0 +1,45 @@ ++// Definitions for RaspiDACv3 ++/dts-v1/; ++/plugin/; + ++/ { ++ compatible = "brcm,bcm2708"; + -+#include <linux/init.h> -+#include <linux/module.h> -+#include <linux/platform_device.h> ++ fragment@0 { ++ target = <&i2s>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; + -+#include <sound/soc.h> ++ fragment@1 { ++ target = <&i2c1>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; + -+static struct snd_soc_dai_driver pcm1794a_dai = { -+ .name = "pcm1794a-hifi", -+ .playback = { -+ .channels_min = 2, -+ .channels_max = 2, -+ .rates = SNDRV_PCM_RATE_8000_192000, -+ .formats = SNDRV_PCM_FMTBIT_S16_LE | -+ SNDRV_PCM_FMTBIT_S24_LE -+ }, -+}; ++ pcm5122@4c { ++ #sound-dai-cells = <0>; ++ compatible = "ti,pcm5122"; ++ reg = <0x4c>; ++ status = "okay"; ++ }; + -+static struct snd_soc_codec_driver soc_codec_dev_pcm1794a; ++ tpa6130a2: tpa6130a2@60 { ++ compatible = "ti,tpa6130a2"; ++ reg = <0x60>; ++ status = "okay"; ++ }; ++ }; ++ }; + -+static int pcm1794a_probe(struct platform_device *pdev) -+{ -+ return snd_soc_register_codec(&pdev->dev, &soc_codec_dev_pcm1794a, -+ &pcm1794a_dai, 1); -+} ++ fragment@2 { ++ target = <&sound>; ++ __overlay__ { ++ compatible = "jg,raspidacv3"; ++ i2s-controller = <&i2s>; ++ status = "okay"; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/rpi-backlight-overlay.dts b/arch/arm/boot/dts/overlays/rpi-backlight-overlay.dts +new file mode 100644 +index 0000000..c021d02 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/rpi-backlight-overlay.dts +@@ -0,0 +1,21 @@ ++/* ++ * Devicetree overlay for mailbox-driven Raspberry Pi DSI Display ++ * backlight controller ++ */ ++/dts-v1/; ++/plugin/; + -+static int pcm1794a_remove(struct platform_device *pdev) -+{ -+ snd_soc_unregister_codec(&pdev->dev); -+ return 0; -+} ++/ { ++ compatible = "brcm,bcm2708"; + -+static const struct of_device_id pcm1794a_of_match[] = { -+ { .compatible = "ti,pcm1794a", }, -+ { } ++ fragment@0 { ++ target-path = "/"; ++ __overlay__ { ++ rpi_backlight: rpi_backlight { ++ compatible = "raspberrypi,rpi-backlight"; ++ firmware = <&firmware>; ++ status = "okay"; ++ }; ++ }; ++ }; +}; -+MODULE_DEVICE_TABLE(of, pcm1794a_of_match); +diff --git a/arch/arm/boot/dts/overlays/rpi-dac-overlay.dts b/arch/arm/boot/dts/overlays/rpi-dac-overlay.dts +new file mode 100644 +index 0000000..1523eae +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/rpi-dac-overlay.dts +@@ -0,0 +1,34 @@ ++// Definitions for RPi DAC ++/dts-v1/; ++/plugin/; + -+static struct platform_driver pcm1794a_codec_driver = { -+ .probe = pcm1794a_probe, -+ .remove = pcm1794a_remove, -+ .driver = { -+ .name = "pcm1794a-codec", -+ .owner = THIS_MODULE, -+ .of_match_table = of_match_ptr(pcm1794a_of_match), -+ }, -+}; ++/ { ++ compatible = "brcm,bcm2708"; + -+module_platform_driver(pcm1794a_codec_driver); ++ fragment@0 { ++ target = <&i2s>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; + -+MODULE_DESCRIPTION("ASoC PCM1794A codec driver"); -+MODULE_AUTHOR("Florian Meier <florian.meier@koalo.de>"); -+MODULE_LICENSE("GPL v2"); - -From dbdeca565b0850da182d3bd0b3ed41f667ca8a45 Mon Sep 17 00:00:00 2001 -From: Daniel Matuschek <info@crazy-audio.com> -Date: Wed, 15 Jan 2014 21:41:23 +0100 -Subject: [PATCH 066/170] ASoC: wm8804: Implement MCLK configuration options, - add 32bit support WM8804 can run with PLL frequencies of 256xfs and 128xfs - for most sample rates. At 192kHz only 128xfs is supported. The existing - driver selects 128xfs automatically for some lower samples rates. By using an - additional mclk_div divider, it is now possible to control the behaviour. - This allows using 256xfs PLL frequency on all sample rates up to 96kHz. It - should allow lower jitter and better signal quality. The behavior has to be - controlled by the sound card driver, because some sample frequency share the - same setting. e.g. 192kHz and 96kHz use 24.576MHz master clock. The only - difference is the MCLK divider. - -This also added support for 32bit data. - -Signed-off-by: Daniel Matuschek <daniel@matuschek.net> ---- - sound/soc/codecs/wm8804.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/sound/soc/codecs/wm8804.c b/sound/soc/codecs/wm8804.c -index 8d91470..5795fb1 100644 ---- a/sound/soc/codecs/wm8804.c -+++ b/sound/soc/codecs/wm8804.c -@@ -304,6 +304,7 @@ static int wm8804_hw_params(struct snd_pcm_substream *substream, - blen = 0x1; - break; - case 24: -+ case 32: - blen = 0x2; - break; - default: -@@ -515,7 +516,7 @@ static const struct snd_soc_dai_ops wm8804_dai_ops = { - }; - - #define WM8804_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE | \ -- SNDRV_PCM_FMTBIT_S24_LE) -+ SNDRV_PCM_FMTBIT_S24_3LE | SNDRV_PCM_FMTBIT_S32_LE) - - #define WM8804_RATES (SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 | \ - SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_64000 | \ - -From 0c2e64d3eda229c2f52ce6ed9d0b1c1572dd9b19 Mon Sep 17 00:00:00 2001 -From: Daniel Matuschek <info@crazy-audio.com> -Date: Wed, 15 Jan 2014 21:42:08 +0100 -Subject: [PATCH 067/170] ASoC: BCM:Add support for HiFiBerry Digi. Driver is - based on the patched WM8804 driver. - -Signed-off-by: Daniel Matuschek <daniel@matuschek.net> - -Add a parameter to turn off SPDIF output if no audio is playing - -This patch adds the paramater auto_shutdown_output to the kernel module. -Default behaviour of the module is the same, but when auto_shutdown_output -is set to 1, the SPDIF oputput will shutdown if no stream is playing. - -bugfix for 32kHz sample rate, was missing - -HiFiBerry Digi: set SPDIF status bits for sample rate - -The HiFiBerry Digi driver did not signal the sample rate in the SPDIF status bits. -While this is optional, some DACs and receivers do not accept this signal. This patch -adds the sample rate bits in the SPDIF status block. ---- - sound/soc/bcm/Kconfig | 7 ++ - sound/soc/bcm/Makefile | 2 + - sound/soc/bcm/hifiberry_digi.c | 223 +++++++++++++++++++++++++++++++++++++++++ - 3 files changed, 232 insertions(+) - create mode 100644 sound/soc/bcm/hifiberry_digi.c - -diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig -index 900de22..a34aff2 100644 ---- a/sound/soc/bcm/Kconfig -+++ b/sound/soc/bcm/Kconfig -@@ -15,6 +15,13 @@ config SND_BCM2708_SOC_HIFIBERRY_DAC - help - Say Y or M if you want to add support for HifiBerry DAC. - -+config SND_BCM2708_SOC_HIFIBERRY_DIGI -+ tristate "Support for HifiBerry Digi" -+ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S -+ select SND_SOC_WM8804 -+ help -+ Say Y or M if you want to add support for HifiBerry Digi S/PDIF output board. ++ fragment@1 { ++ target = <&soc>; ++ __overlay__ { ++ pcm1794a-codec { ++ #sound-dai-cells = <0>; ++ compatible = "ti,pcm1794a"; ++ status = "okay"; ++ }; ++ }; ++ }; + - config SND_BCM2708_SOC_RPI_DAC - tristate "Support for RPi-DAC" - depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S -diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile -index 99c96b4..4d53c58 100644 ---- a/sound/soc/bcm/Makefile -+++ b/sound/soc/bcm/Makefile -@@ -5,7 +5,9 @@ obj-$(CONFIG_SND_BCM2835_SOC_I2S) += snd-soc-bcm2835-i2s.o - - # BCM2708 Machine Support - snd-soc-hifiberry-dac-objs := hifiberry_dac.o -+snd-soc-hifiberry-digi-objs := hifiberry_digi.o - snd-soc-rpi-dac-objs := rpi-dac.o - - obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o -+obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI) += snd-soc-hifiberry-digi.o - obj-$(CONFIG_SND_BCM2708_SOC_RPI_DAC) += snd-soc-rpi-dac.o -diff --git a/sound/soc/bcm/hifiberry_digi.c b/sound/soc/bcm/hifiberry_digi.c ++ fragment@2 { ++ target = <&sound>; ++ __overlay__ { ++ compatible = "rpi,rpi-dac"; ++ i2s-controller = <&i2s>; ++ status = "okay"; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/rpi-display-overlay.dts b/arch/arm/boot/dts/overlays/rpi-display-overlay.dts new file mode 100644 -index 0000000..80732b8 +index 0000000..d7e72ee --- /dev/null -+++ b/sound/soc/bcm/hifiberry_digi.c -@@ -0,0 +1,223 @@ ++++ b/arch/arm/boot/dts/overlays/rpi-display-overlay.dts +@@ -0,0 +1,89 @@ +/* -+ * ASoC Driver for HifiBerry Digi -+ * -+ * Author: Daniel Matuschek <info@crazy-audio.com> -+ * based on the HifiBerry DAC driver by Florian Meier <florian.meier@koalo.de> -+ * Copyright 2013 -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License -+ * version 2 as published by the Free Software Foundation. ++ * Device Tree overlay for rpi-display by Watterott + * -+ * This program is distributed in the hope that it will be useful, but -+ * WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * General Public License for more details. + */ + -+#include <linux/module.h> -+#include <linux/platform_device.h> -+ -+#include <sound/core.h> -+#include <sound/pcm.h> -+#include <sound/pcm_params.h> -+#include <sound/soc.h> -+#include <sound/jack.h> -+ -+#include "../codecs/wm8804.h" ++/dts-v1/; ++/plugin/; + -+static short int auto_shutdown_output = 0; -+module_param(auto_shutdown_output, short, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP); -+MODULE_PARM_DESC(auto_shutdown_output, "Shutdown SP/DIF output if playback is stopped"); ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; + ++ fragment@0 { ++ target = <&spi0>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; + -+static int samplerate=44100; ++ fragment@1 { ++ target = <&spidev0>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; + -+static int snd_rpi_hifiberry_digi_init(struct snd_soc_pcm_runtime *rtd) -+{ -+ struct snd_soc_codec *codec = rtd->codec; ++ fragment@2 { ++ target = <&spidev1>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; + -+ /* enable TX output */ -+ snd_soc_update_bits(codec, WM8804_PWRDN, 0x4, 0x0); ++ fragment@3 { ++ target = <&gpio>; ++ __overlay__ { ++ rpi_display_pins: rpi_display_pins { ++ brcm,pins = <18 23 24 25>; ++ brcm,function = <1 1 1 0>; /* out out out in */ ++ brcm,pull = <0 0 0 2>; /* - - - up */ ++ }; ++ }; ++ }; + -+ return 0; -+} ++ fragment@4 { ++ target = <&spi0>; ++ __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; + -+static int snd_rpi_hifiberry_digi_startup(struct snd_pcm_substream *substream) { -+ /* turn on digital output */ -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_codec *codec = rtd->codec; -+ snd_soc_update_bits(codec, WM8804_PWRDN, 0x3c, 0x00); -+ return 0; -+} ++ rpidisplay: rpi-display@0{ ++ compatible = "ilitek,ili9341"; ++ reg = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&rpi_display_pins>; + -+static void snd_rpi_hifiberry_digi_shutdown(struct snd_pcm_substream *substream) { -+ /* turn off output */ -+ if (auto_shutdown_output) { -+ /* turn off output */ -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_codec *codec = rtd->codec; -+ snd_soc_update_bits(codec, WM8804_PWRDN, 0x3c, 0x3c); -+ } -+} ++ spi-max-frequency = <32000000>; ++ rotate = <270>; ++ bgr; ++ fps = <30>; ++ buswidth = <8>; ++ reset-gpios = <&gpio 23 0>; ++ dc-gpios = <&gpio 24 0>; ++ led-gpios = <&gpio 18 1>; ++ debug = <0>; ++ }; + ++ rpidisplay_ts: rpi-display-ts@1 { ++ compatible = "ti,ads7846"; ++ reg = <1>; + -+static int snd_rpi_hifiberry_digi_hw_params(struct snd_pcm_substream *substream, -+ struct snd_pcm_hw_params *params) -+{ -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_dai *codec_dai = rtd->codec_dai; -+ struct snd_soc_codec *codec = rtd->codec; -+ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; ++ spi-max-frequency = <2000000>; ++ interrupts = <25 2>; /* high-to-low edge triggered */ ++ interrupt-parent = <&gpio>; ++ pendown-gpio = <&gpio 25 0>; ++ ti,x-plate-ohms = /bits/ 16 <60>; ++ ti,pressure-max = /bits/ 16 <255>; ++ }; ++ }; ++ }; ++ __overrides__ { ++ speed = <&rpidisplay>,"spi-max-frequency:0"; ++ rotate = <&rpidisplay>,"rotate:0"; ++ fps = <&rpidisplay>,"fps:0"; ++ debug = <&rpidisplay>,"debug:0"; ++ xohms = <&rpidisplay_ts>,"ti,x-plate-ohms;0"; ++ swapxy = <&rpidisplay_ts>,"ti,swap-xy?"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/rpi-ft5406-overlay.dts b/arch/arm/boot/dts/overlays/rpi-ft5406-overlay.dts +new file mode 100644 +index 0000000..2e53a17 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/rpi-ft5406-overlay.dts +@@ -0,0 +1,17 @@ ++/dts-v1/; ++/plugin/; + -+ int sysclk = 27000000; /* This is fixed on this board */ ++/ { ++ compatible = "brcm,bcm2708"; + -+ long mclk_freq=0; -+ int mclk_div=1; -+ int sampling_freq=1; ++ fragment@0 { ++ target-path = "/"; ++ __overlay__ { ++ rpi_ft5406: rpi_ft5406 { ++ compatible = "rpi,rpi-ft5406"; ++ firmware = <&firmware>; ++ status = "okay"; ++ }; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/rpi-proto-overlay.dts b/arch/arm/boot/dts/overlays/rpi-proto-overlay.dts +new file mode 100644 +index 0000000..8332d01 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/rpi-proto-overlay.dts +@@ -0,0 +1,39 @@ ++// Definitions for Rpi-Proto ++/dts-v1/; ++/plugin/; + -+ int ret; ++/ { ++ compatible = "brcm,bcm2708"; + -+ samplerate = params_rate(params); ++ fragment@0 { ++ target = <&i2s>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; + -+ if (samplerate<=96000) { -+ mclk_freq=samplerate*256; -+ mclk_div=WM8804_MCLKDIV_256FS; -+ } else { -+ mclk_freq=samplerate*128; -+ mclk_div=WM8804_MCLKDIV_128FS; -+ } -+ -+ switch (samplerate) { -+ case 32000: -+ sampling_freq=0x03; -+ break; -+ case 44100: -+ sampling_freq=0x00; -+ break; -+ case 48000: -+ sampling_freq=0x02; -+ break; -+ case 88200: -+ sampling_freq=0x08; -+ break; -+ case 96000: -+ sampling_freq=0x0a; -+ break; -+ case 176400: -+ sampling_freq=0x0c; -+ break; -+ case 192000: -+ sampling_freq=0x0e; -+ break; -+ default: -+ dev_err(codec->dev, -+ "Failed to set WM8804 SYSCLK, unsupported samplerate %d\n", -+ samplerate); -+ } ++ fragment@1 { ++ target = <&i2c1>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; + -+ snd_soc_dai_set_clkdiv(codec_dai, WM8804_MCLK_DIV, mclk_div); -+ snd_soc_dai_set_pll(codec_dai, 0, 0, sysclk, mclk_freq); ++ wm8731@1a { ++ #sound-dai-cells = <0>; ++ compatible = "wlf,wm8731"; ++ reg = <0x1a>; ++ status = "okay"; ++ }; ++ }; ++ }; + -+ ret = snd_soc_dai_set_sysclk(codec_dai, WM8804_TX_CLKSRC_PLL, -+ sysclk, SND_SOC_CLOCK_OUT); -+ if (ret < 0) { -+ dev_err(codec->dev, -+ "Failed to set WM8804 SYSCLK: %d\n", ret); -+ return ret; -+ } ++ fragment@2 { ++ target = <&sound>; ++ __overlay__ { ++ compatible = "rpi,rpi-proto"; ++ i2s-controller = <&i2s>; ++ status = "okay"; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/rpi-sense-overlay.dts b/arch/arm/boot/dts/overlays/rpi-sense-overlay.dts +new file mode 100644 +index 0000000..2715324 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/rpi-sense-overlay.dts +@@ -0,0 +1,47 @@ ++// rpi-sense HAT ++/dts-v1/; ++/plugin/; + -+ /* Enable TX output */ -+ snd_soc_update_bits(codec, WM8804_PWRDN, 0x4, 0x0); ++/ { ++ compatible = "brcm,bcm2708", "brcm,bcm2709"; + -+ /* Power on */ -+ snd_soc_update_bits(codec, WM8804_PWRDN, 0x9, 0); ++ fragment@0 { ++ target = <&i2c1>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; + -+ /* set sampling frequency status bits */ -+ snd_soc_update_bits(codec, WM8804_SPDTX4, 0x0f, sampling_freq); ++ rpi-sense@46 { ++ compatible = "rpi,rpi-sense"; ++ reg = <0x46>; ++ keys-int-gpios = <&gpio 23 1>; ++ status = "okay"; ++ }; + -+ return snd_soc_dai_set_bclk_ratio(cpu_dai,64); -+} ++ lsm9ds1-magn@1c { ++ compatible = "st,lsm9ds1-magn"; ++ reg = <0x1c>; ++ status = "okay"; ++ }; + -+/* machine stream operations */ -+static struct snd_soc_ops snd_rpi_hifiberry_digi_ops = { -+ .hw_params = snd_rpi_hifiberry_digi_hw_params, -+ .startup = snd_rpi_hifiberry_digi_startup, -+ .shutdown = snd_rpi_hifiberry_digi_shutdown, -+}; ++ lsm9ds1-accel6a { ++ compatible = "st,lsm9ds1-accel"; ++ reg = <0x6a>; ++ status = "okay"; ++ }; + -+static struct snd_soc_dai_link snd_rpi_hifiberry_digi_dai[] = { -+{ -+ .name = "HifiBerry Digi", -+ .stream_name = "HifiBerry Digi HiFi", -+ .cpu_dai_name = "bcm2708-i2s.0", -+ .codec_dai_name = "wm8804-spdif", -+ .platform_name = "bcm2708-i2s.0", -+ .codec_name = "wm8804.1-003b", -+ .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | -+ SND_SOC_DAIFMT_CBM_CFM, -+ .ops = &snd_rpi_hifiberry_digi_ops, -+ .init = snd_rpi_hifiberry_digi_init, -+}, -+}; ++ lps25h-press@5c { ++ compatible = "st,lps25h-press"; ++ reg = <0x5c>; ++ status = "okay"; ++ }; + -+/* audio machine driver */ -+static struct snd_soc_card snd_rpi_hifiberry_digi = { -+ .name = "snd_rpi_hifiberry_digi", -+ .dai_link = snd_rpi_hifiberry_digi_dai, -+ .num_links = ARRAY_SIZE(snd_rpi_hifiberry_digi_dai), ++ hts221-humid@5f { ++ compatible = "st,hts221-humid"; ++ reg = <0x5f>; ++ status = "okay"; ++ }; ++ }; ++ }; +}; +diff --git a/arch/arm/boot/dts/overlays/rra-digidac1-wm8741-audio-overlay.dts b/arch/arm/boot/dts/overlays/rra-digidac1-wm8741-audio-overlay.dts +new file mode 100644 +index 0000000..16b1247 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/rra-digidac1-wm8741-audio-overlay.dts +@@ -0,0 +1,81 @@ ++// Definitions for RRA DigiDAC1 Audio card ++/dts-v1/; ++/plugin/; + -+static int snd_rpi_hifiberry_digi_probe(struct platform_device *pdev) -+{ -+ int ret = 0; ++/ { ++ compatible = "brcm,bcm2708"; + -+ snd_rpi_hifiberry_digi.dev = &pdev->dev; ++ fragment@0 { ++ target-path = "/"; ++ __overlay__ { ++ aliases { ++ ldo0 = &ldo0; ++ ldo1 = &ldo1; ++ }; ++ }; ++ }; + -+ if (pdev->dev.of_node) { -+ struct device_node *i2s_node; -+ struct snd_soc_dai_link *dai = &snd_rpi_hifiberry_digi_dai[0]; -+ i2s_node = of_parse_phandle(pdev->dev.of_node, -+ "i2s-controller", 0); ++ fragment@1 { ++ target-path = "/soc"; ++ __overlay__ { + -+ if (i2s_node) { -+ dai->cpu_dai_name = NULL; -+ dai->cpu_of_node = i2s_node; -+ dai->platform_name = NULL; -+ dai->platform_of_node = i2s_node; -+ } -+ } ++ ldo1: ldo1 { ++ compatible = "regulator-fixed"; ++ regulator-name = "DC_5V"; ++ regulator-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; ++ regulator-always-on; ++ }; + -+ ret = snd_soc_register_card(&snd_rpi_hifiberry_digi); -+ if (ret) -+ dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", ret); ++ ldo0: ldo0 { ++ compatible = "regulator-fixed"; ++ regulator-name = "DC_3V3"; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ regulator-always-on; ++ }; ++ }; ++ }; + -+ return ret; -+} ++ fragment@2 { ++ target = <&i2s>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; + -+static int snd_rpi_hifiberry_digi_remove(struct platform_device *pdev) -+{ -+ return snd_soc_unregister_card(&snd_rpi_hifiberry_digi); -+} ++ fragment@3 { ++ target = <&i2c1>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; + -+static const struct of_device_id snd_rpi_hifiberry_digi_of_match[] = { -+ { .compatible = "hifiberry,hifiberry-digi", }, -+ {}, -+}; -+MODULE_DEVICE_TABLE(of, snd_rpi_hifiberry_digi_of_match); ++ wm8804@3b { ++ #sound-dai-cells = <0>; ++ compatible = "wlf,wm8804"; ++ reg = <0x3b>; ++ status = "okay"; ++ PVDD-supply = <&ldo0>; ++ DVDD-supply = <&ldo0>; ++ }; + -+static struct platform_driver snd_rpi_hifiberry_digi_driver = { -+ .driver = { -+ .name = "snd-hifiberry-digi", -+ .owner = THIS_MODULE, -+ .of_match_table = snd_rpi_hifiberry_digi_of_match, -+ }, -+ .probe = snd_rpi_hifiberry_digi_probe, -+ .remove = snd_rpi_hifiberry_digi_remove, ++ wm8742: wm8741@1a { ++ compatible = "wlf,wm8741"; ++ reg = <0x1a>; ++ status = "okay"; ++ AVDD-supply = <&ldo1>; ++ DVDD-supply = <&ldo0>; ++ }; ++ }; ++ }; ++ ++ fragment@4 { ++ target = <&sound>; ++ __overlay__ { ++ compatible = "rra,digidac1-soundcard"; ++ i2s-controller = <&i2s>; ++ status = "okay"; ++ }; ++ }; +}; +diff --git a/arch/arm/boot/dts/overlays/sdhost-overlay.dts b/arch/arm/boot/dts/overlays/sdhost-overlay.dts +new file mode 100644 +index 0000000..a431177 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/sdhost-overlay.dts +@@ -0,0 +1,32 @@ ++/dts-v1/; ++/plugin/; + -+module_platform_driver(snd_rpi_hifiberry_digi_driver); ++/* Provide backwards compatible aliases for the old sdhost dtparams. */ + -+MODULE_AUTHOR("Daniel Matuschek <info@crazy-audio.com>"); -+MODULE_DESCRIPTION("ASoC Driver for HifiBerry Digi"); -+MODULE_LICENSE("GPL v2"); - -From f2789622ff7c1297e28f38bb198f5fd24b4602ef Mon Sep 17 00:00:00 2001 -From: Daniel Matuschek <info@crazy-audio.com> -Date: Thu, 16 Jan 2014 07:36:35 +0100 -Subject: [PATCH 068/170] ASoC: wm8804: Set idle_bias_off to false Idle bias - has been change to remove warning on driver startup - -Signed-off-by: Daniel Matuschek <daniel@matuschek.net> ---- - sound/soc/codecs/wm8804.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/sound/soc/codecs/wm8804.c b/sound/soc/codecs/wm8804.c -index 5795fb1..c846716 100644 ---- a/sound/soc/codecs/wm8804.c -+++ b/sound/soc/codecs/wm8804.c -@@ -544,7 +544,7 @@ static struct snd_soc_dai_driver wm8804_dai = { - }; - - static const struct snd_soc_codec_driver soc_codec_dev_wm8804 = { -- .idle_bias_off = true, -+ .idle_bias_off = false, - - .dapm_widgets = wm8804_dapm_widgets, - .num_dapm_widgets = ARRAY_SIZE(wm8804_dapm_widgets), - -From 80fa31f923b4967bc86be20c5af780ef284fc972 Mon Sep 17 00:00:00 2001 -From: Gordon Garrity <gordon@iqaudio.com> -Date: Sat, 8 Mar 2014 16:56:57 +0000 -Subject: [PATCH 069/170] Add IQaudIO Sound Card support for Raspberry Pi - -Set a limit of 0dB on Digital Volume Control - -The main volume control in the PCM512x DAC has a range up to -+24dB. This is dangerously loud and can potentially cause massive -clipping in the output stages. Therefore this sets a sensible -limit of 0dB for this control. ---- - sound/soc/bcm/Kconfig | 7 +++ - sound/soc/bcm/Makefile | 2 + - sound/soc/bcm/iqaudio-dac.c | 132 ++++++++++++++++++++++++++++++++++++++++++++ - 3 files changed, 141 insertions(+) - create mode 100644 sound/soc/bcm/iqaudio-dac.c - -diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig -index a34aff2..38dcdd9 100644 ---- a/sound/soc/bcm/Kconfig -+++ b/sound/soc/bcm/Kconfig -@@ -28,3 +28,10 @@ config SND_BCM2708_SOC_RPI_DAC - select SND_SOC_PCM1794A - help - Say Y or M if you want to add support for RPi-DAC. ++/{ ++ compatible = "brcm,bcm2708"; + -+config SND_BCM2708_SOC_IQAUDIO_DAC -+ tristate "Support for IQaudIO-DAC" -+ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S -+ select SND_SOC_PCM512x_I2C -+ help -+ Say Y or M if you want to add support for IQaudIO-DAC. -diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile -index 4d53c58..08e4dc5 100644 ---- a/sound/soc/bcm/Makefile -+++ b/sound/soc/bcm/Makefile -@@ -7,7 +7,9 @@ obj-$(CONFIG_SND_BCM2835_SOC_I2S) += snd-soc-bcm2835-i2s.o - snd-soc-hifiberry-dac-objs := hifiberry_dac.o - snd-soc-hifiberry-digi-objs := hifiberry_digi.o - snd-soc-rpi-dac-objs := rpi-dac.o -+snd-soc-iqaudio-dac-objs := iqaudio-dac.o - - obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o - obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI) += snd-soc-hifiberry-digi.o - obj-$(CONFIG_SND_BCM2708_SOC_RPI_DAC) += snd-soc-rpi-dac.o -+obj-$(CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC) += snd-soc-iqaudio-dac.o -diff --git a/sound/soc/bcm/iqaudio-dac.c b/sound/soc/bcm/iqaudio-dac.c ++ fragment@0 { ++ target = <&sdhost>; ++ frag0: __overlay__ { ++ brcm,overclock-50 = <0>; ++ brcm,pio-limit = <1>; ++ brcm,debug-flags = <0>; ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&mmc>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; ++ ++ __overrides__ { ++ overclock_50 = <&frag0>,"brcm,overclock-50:0"; ++ force_pio = <&frag0>,"brcm,force-pio?"; ++ pio_limit = <&frag0>,"brcm,pio-limit:0"; ++ debug = <&frag0>,"brcm,debug?"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/sdio-1bit-overlay.dts b/arch/arm/boot/dts/overlays/sdio-1bit-overlay.dts new file mode 100644 -index 0000000..37038d4 +index 0000000..46d4538 --- /dev/null -+++ b/sound/soc/bcm/iqaudio-dac.c -@@ -0,0 +1,132 @@ -+/* -+ * ASoC Driver for IQaudIO DAC -+ * -+ * Author: Florian Meier <florian.meier@koalo.de> -+ * Copyright 2013 -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License -+ * version 2 as published by the Free Software Foundation. -+ * -+ * This program is distributed in the hope that it will be useful, but -+ * WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * General Public License for more details. -+ */ ++++ b/arch/arm/boot/dts/overlays/sdio-1bit-overlay.dts +@@ -0,0 +1,36 @@ ++/* Enable 1-bit SDIO from MMC interface via GPIOs 22-25. Includes sdhost overlay. */ + -+#include <linux/module.h> -+#include <linux/platform_device.h> ++/include/ "sdhost-overlay.dts" + -+#include <sound/core.h> -+#include <sound/pcm.h> -+#include <sound/pcm_params.h> -+#include <sound/soc.h> -+#include <sound/jack.h> ++/{ ++ compatible = "brcm,bcm2708"; + -+static int snd_rpi_iqaudio_dac_init(struct snd_soc_pcm_runtime *rtd) -+{ -+ int ret; -+ struct snd_soc_card *card = rtd->card; ++ fragment@3 { ++ target = <&mmc>; ++ sdio_mmc: __overlay__ { ++ compatible = "brcm,bcm2835-mmc"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&sdio_pins>; ++ non-removable; ++ bus-width = <1>; ++ brcm,overclock-50 = <0>; ++ status = "okay"; ++ }; ++ }; + -+ ret = snd_soc_limit_volume(card, "Digital Playback Volume", 207); -+ if (ret < 0) -+ dev_warn(card->dev, "Failed to set volume limit: %d\n", ret); ++ fragment@4 { ++ target = <&gpio>; ++ __overlay__ { ++ sdio_pins: sdio_pins { ++ brcm,pins = <22 23 24 25>; ++ brcm,function = <7 7 7 7>; /* ALT3 = SD1 */ ++ brcm,pull = <0 2 2 2>; ++ }; ++ }; ++ }; + -+ return 0; -+} ++ __overrides__ { ++ poll_once = <&sdio_mmc>,"non-removable?"; ++ sdio_overclock = <&sdio_mmc>,"brcm,overclock-50:0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/sdio-overlay.dts b/arch/arm/boot/dts/overlays/sdio-overlay.dts +new file mode 100644 +index 0000000..398bd81 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/sdio-overlay.dts +@@ -0,0 +1,36 @@ ++/* Enable SDIO from MMC interface via GPIOs 22-27. Includes sdhost overlay. */ + -+static int snd_rpi_iqaudio_dac_hw_params(struct snd_pcm_substream *substream, -+ struct snd_pcm_hw_params *params) -+{ -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+// NOT USED struct snd_soc_dai *codec_dai = rtd->codec_dai; -+// NOT USED struct snd_soc_codec *codec = rtd->codec; -+ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; ++/include/ "sdhost-overlay.dts" + -+ unsigned int sample_bits = -+ snd_pcm_format_physical_width(params_format(params)); ++/{ ++ compatible = "brcm,bcm2708"; + -+ return snd_soc_dai_set_bclk_ratio(cpu_dai, sample_bits * 2); -+} ++ fragment@3 { ++ target = <&mmc>; ++ sdio_mmc: __overlay__ { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&sdio_pins>; ++ non-removable; ++ bus-width = <4>; ++ brcm,overclock-50 = <0>; ++ status = "okay"; ++ }; ++ }; + -+/* machine stream operations */ -+static struct snd_soc_ops snd_rpi_iqaudio_dac_ops = { -+ .hw_params = snd_rpi_iqaudio_dac_hw_params, -+}; ++ fragment@4 { ++ target = <&gpio>; ++ __overlay__ { ++ sdio_pins: sdio_pins { ++ brcm,pins = <22 23 24 25 26 27>; ++ brcm,function = <7 7 7 7 7 7>; /* ALT3 = SD1 */ ++ brcm,pull = <0 2 2 2 2 2>; ++ }; ++ }; ++ }; + -+static struct snd_soc_dai_link snd_rpi_iqaudio_dac_dai[] = { -+{ -+ .name = "IQaudIO DAC", -+ .stream_name = "IQaudIO DAC HiFi", -+ .cpu_dai_name = "bcm2708-i2s.0", -+ .codec_dai_name = "pcm512x-hifi", -+ .platform_name = "bcm2708-i2s.0", -+ .codec_name = "pcm512x.1-004c", -+ .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | -+ SND_SOC_DAIFMT_CBS_CFS, -+ .ops = &snd_rpi_iqaudio_dac_ops, -+ .init = snd_rpi_iqaudio_dac_init, -+}, ++ __overrides__ { ++ poll_once = <&sdio_mmc>,"non-removable?"; ++ bus_width = <&sdio_mmc>,"bus-width:0"; ++ sdio_overclock = <&sdio_mmc>,"brcm,overclock-50:0"; ++ }; +}; +diff --git a/arch/arm/boot/dts/overlays/sdtweak-overlay.dts b/arch/arm/boot/dts/overlays/sdtweak-overlay.dts +new file mode 100644 +index 0000000..e4a4677 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/sdtweak-overlay.dts +@@ -0,0 +1,23 @@ ++/dts-v1/; ++/plugin/; + -+/* audio machine driver */ -+static struct snd_soc_card snd_rpi_iqaudio_dac = { -+ .name = "IQaudIODAC", -+ .dai_link = snd_rpi_iqaudio_dac_dai, -+ .num_links = ARRAY_SIZE(snd_rpi_iqaudio_dac_dai), ++/* Provide backwards compatible aliases for the old sdhost dtparams. */ ++ ++/{ ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&sdhost>; ++ frag0: __overlay__ { ++ brcm,overclock-50 = <0>; ++ brcm,pio-limit = <1>; ++ }; ++ }; ++ ++ __overrides__ { ++ overclock_50 = <&frag0>,"brcm,overclock-50:0"; ++ force_pio = <&frag0>,"brcm,force-pio?"; ++ pio_limit = <&frag0>,"brcm,pio-limit:0"; ++ debug = <&frag0>,"brcm,debug?"; ++ }; +}; +diff --git a/arch/arm/boot/dts/overlays/smi-dev-overlay.dts b/arch/arm/boot/dts/overlays/smi-dev-overlay.dts +new file mode 100644 +index 0000000..b610d82 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/smi-dev-overlay.dts +@@ -0,0 +1,18 @@ ++// Description: Overlay to enable character device interface for SMI. ++// Author: Luke Wren <luke@raspberrypi.org> + -+static int snd_rpi_iqaudio_dac_probe(struct platform_device *pdev) -+{ -+ int ret = 0; ++/dts-v1/; ++/plugin/; + -+ snd_rpi_iqaudio_dac.dev = &pdev->dev; ++/{ ++ fragment@0 { ++ target = <&soc>; ++ __overlay__ { ++ smi_dev { ++ compatible = "brcm,bcm2835-smi-dev"; ++ smi_handle = <&smi>; ++ status = "okay"; ++ }; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/smi-nand-overlay.dts b/arch/arm/boot/dts/overlays/smi-nand-overlay.dts +new file mode 100644 +index 0000000..13ce0b7 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/smi-nand-overlay.dts +@@ -0,0 +1,69 @@ ++// Description: Overlay to enable NAND flash through ++// the secondary memory interface ++// Author: Luke Wren + -+ if (pdev->dev.of_node) { -+ struct device_node *i2s_node; -+ struct snd_soc_dai_link *dai = &snd_rpi_iqaudio_dac_dai[0]; -+ i2s_node = of_parse_phandle(pdev->dev.of_node, -+ "i2s-controller", 0); ++/dts-v1/; ++/plugin/; + -+ if (i2s_node) { -+ dai->cpu_dai_name = NULL; -+ dai->cpu_of_node = i2s_node; -+ dai->platform_name = NULL; -+ dai->platform_of_node = i2s_node; -+ } -+ } ++/{ ++ compatible = "brcm,bcm2708"; + -+ ret = snd_soc_register_card(&snd_rpi_iqaudio_dac); -+ if (ret) -+ dev_err(&pdev->dev, -+ "snd_soc_register_card() failed: %d\n", ret); ++ fragment@0 { ++ target = <&smi>; ++ __overlay__ { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&smi_pins>; ++ status = "okay"; ++ }; ++ }; + -+ return ret; -+} ++ fragment@1 { ++ target = <&soc>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <1>; + -+static int snd_rpi_iqaudio_dac_remove(struct platform_device *pdev) -+{ -+ return snd_soc_unregister_card(&snd_rpi_iqaudio_dac); -+} ++ nand: flash@0 { ++ compatible = "brcm,bcm2835-smi-nand"; ++ smi_handle = <&smi>; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ status = "okay"; + -+static const struct of_device_id iqaudio_of_match[] = { -+ { .compatible = "iqaudio,iqaudio-dac", }, -+ {}, -+}; -+MODULE_DEVICE_TABLE(of, iqaudio_of_match); ++ partition@0 { ++ label = "stage2"; ++ // 128k ++ reg = <0 0x20000>; ++ read-only; ++ }; ++ partition@1 { ++ label = "firmware"; ++ // 16M ++ reg = <0x20000 0x1000000>; ++ read-only; ++ }; ++ partition@2 { ++ label = "root"; ++ // 2G (will need to use 64 bit for >=4G) ++ reg = <0x1020000 0x80000000>; ++ }; ++ }; ++ }; ++ }; + -+static struct platform_driver snd_rpi_iqaudio_dac_driver = { -+ .driver = { -+ .name = "snd-rpi-iqaudio-dac", -+ .owner = THIS_MODULE, -+ .of_match_table = iqaudio_of_match, -+ }, -+ .probe = snd_rpi_iqaudio_dac_probe, -+ .remove = snd_rpi_iqaudio_dac_remove, ++ fragment@2 { ++ target = <&gpio>; ++ __overlay__ { ++ smi_pins: smi_pins { ++ brcm,pins = <0 1 2 3 4 5 6 7 8 9 10 11 ++ 12 13 14 15>; ++ /* Alt 1: SMI */ ++ brcm,function = <5 5 5 5 5 5 5 5 5 5 5 ++ 5 5 5 5 5>; ++ /* /CS, /WE and /OE are pulled high, as they are ++ generally active low signals */ ++ brcm,pull = <2 2 2 2 2 2 2 2 0 0 0 0 0 0 0 0>; ++ }; ++ }; ++ }; +}; +diff --git a/arch/arm/boot/dts/overlays/smi-overlay.dts b/arch/arm/boot/dts/overlays/smi-overlay.dts +new file mode 100644 +index 0000000..095f52c +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/smi-overlay.dts +@@ -0,0 +1,37 @@ ++// Description: Overlay to enable the secondary memory interface peripheral ++// Author: Luke Wren + -+module_platform_driver(snd_rpi_iqaudio_dac_driver); ++/dts-v1/; ++/plugin/; + -+MODULE_AUTHOR("Florian Meier <florian.meier@koalo.de>"); -+MODULE_DESCRIPTION("ASoC Driver for IQAudio DAC"); -+MODULE_LICENSE("GPL v2"); - -From b15f112ddaf2cd20a8f999ac823ddb51d7d513b9 Mon Sep 17 00:00:00 2001 -From: popcornmix <popcornmix@gmail.com> -Date: Mon, 14 Jul 2014 22:02:09 +0100 -Subject: [PATCH 070/170] hid: Reduce default mouse polling interval to 60Hz - -Reduces overhead when using X ---- - drivers/hid/usbhid/hid-core.c | 10 +++++++--- - 1 file changed, 7 insertions(+), 3 deletions(-) - -diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c -index 5dd426f..9ae0cd5 100644 ---- a/drivers/hid/usbhid/hid-core.c -+++ b/drivers/hid/usbhid/hid-core.c -@@ -49,7 +49,7 @@ - * Module parameters. - */ - --static unsigned int hid_mousepoll_interval; -+static unsigned int hid_mousepoll_interval = ~0; - module_param_named(mousepoll, hid_mousepoll_interval, uint, 0644); - MODULE_PARM_DESC(mousepoll, "Polling interval of mice"); - -@@ -1091,8 +1091,12 @@ static int usbhid_start(struct hid_device *hid) - } - - /* Change the polling interval of mice. */ -- if (hid->collection->usage == HID_GD_MOUSE && hid_mousepoll_interval > 0) -- interval = hid_mousepoll_interval; -+ if (hid->collection->usage == HID_GD_MOUSE) { -+ if (hid_mousepoll_interval == ~0 && interval < 16) -+ interval = 16; -+ else if (hid_mousepoll_interval != ~0 && hid_mousepoll_interval != 0) -+ interval = hid_mousepoll_interval; -+ } - - ret = -ENOMEM; - if (usb_endpoint_dir_in(endpoint)) { - -From debd3d30b1127328b5a1e444bd1550cb45c50362 Mon Sep 17 00:00:00 2001 -From: Daniel Matuschek <info@crazy-audio.com> -Date: Mon, 4 Aug 2014 10:06:56 +0200 -Subject: [PATCH 071/170] Added support for HiFiBerry DAC+ - -The driver is based on the HiFiBerry DAC driver. However HiFiBerry DAC+ uses -a different codec chip (PCM5122), therefore a new driver is necessary. ---- - sound/soc/bcm/Kconfig | 7 ++ - sound/soc/bcm/Makefile | 2 + - sound/soc/bcm/hifiberry_dacplus.c | 141 ++++++++++++++++++++++++++++++++++++++ - 3 files changed, 150 insertions(+) - create mode 100644 sound/soc/bcm/hifiberry_dacplus.c - -diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig -index 38dcdd9..8c338b5 100644 ---- a/sound/soc/bcm/Kconfig -+++ b/sound/soc/bcm/Kconfig -@@ -15,6 +15,13 @@ config SND_BCM2708_SOC_HIFIBERRY_DAC - help - Say Y or M if you want to add support for HifiBerry DAC. - -+config SND_BCM2708_SOC_HIFIBERRY_DACPLUS -+ tristate "Support for HifiBerry DAC+" -+ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S -+ select SND_SOC_PCM512x -+ help -+ Say Y or M if you want to add support for HifiBerry DAC+. ++/{ ++ compatible = "brcm,bcm2708"; + - config SND_BCM2708_SOC_HIFIBERRY_DIGI - tristate "Support for HifiBerry Digi" - depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S -diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile -index 08e4dc5..a29538e 100644 ---- a/sound/soc/bcm/Makefile -+++ b/sound/soc/bcm/Makefile -@@ -5,11 +5,13 @@ obj-$(CONFIG_SND_BCM2835_SOC_I2S) += snd-soc-bcm2835-i2s.o - - # BCM2708 Machine Support - snd-soc-hifiberry-dac-objs := hifiberry_dac.o -+snd-soc-hifiberry-dacplus-objs := hifiberry_dacplus.o - snd-soc-hifiberry-digi-objs := hifiberry_digi.o - snd-soc-rpi-dac-objs := rpi-dac.o - snd-soc-iqaudio-dac-objs := iqaudio-dac.o - - obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o -+obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS) += snd-soc-hifiberry-dacplus.o - obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI) += snd-soc-hifiberry-digi.o - obj-$(CONFIG_SND_BCM2708_SOC_RPI_DAC) += snd-soc-rpi-dac.o - obj-$(CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC) += snd-soc-iqaudio-dac.o -diff --git a/sound/soc/bcm/hifiberry_dacplus.c b/sound/soc/bcm/hifiberry_dacplus.c ++ fragment@0 { ++ target = <&smi>; ++ __overlay__ { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&smi_pins>; ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ smi_pins: smi_pins { ++ /* Don't configure the top two address bits, as ++ these are already used as ID_SD and ID_SC */ ++ brcm,pins = <2 3 4 5 6 7 8 9 10 11 12 13 14 15 ++ 16 17 18 19 20 21 22 23 24 25>; ++ /* Alt 0: SMI */ ++ brcm,function = <5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 ++ 5 5 5 5 5 5 5 5 5>; ++ /* /CS, /WE and /OE are pulled high, as they are ++ generally active low signals */ ++ brcm,pull = <2 2 2 2 2 2 0 0 0 0 0 0 0 0 0 0 0 ++ 0 0 0 0 0 0 0>; ++ }; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/spi-gpio35-39-overlay.dts b/arch/arm/boot/dts/overlays/spi-gpio35-39-overlay.dts new file mode 100644 -index 0000000..11e4f39 +index 0000000..9648063 --- /dev/null -+++ b/sound/soc/bcm/hifiberry_dacplus.c -@@ -0,0 +1,141 @@ ++++ b/arch/arm/boot/dts/overlays/spi-gpio35-39-overlay.dts +@@ -0,0 +1,31 @@ +/* -+ * ASoC Driver for HiFiBerry DAC+ -+ * -+ * Author: Daniel Matuschek -+ * Copyright 2014 -+ * based on code by Florian Meier <florian.meier@koalo.de> -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License -+ * version 2 as published by the Free Software Foundation. -+ * -+ * This program is distributed in the hope that it will be useful, but -+ * WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * General Public License for more details. ++ * Device tree overlay to move spi0 to gpio 35 to 39 on CM + */ + -+#include <linux/module.h> -+#include <linux/platform_device.h> ++/dts-v1/; ++/plugin/; + -+#include <sound/core.h> -+#include <sound/pcm.h> -+#include <sound/pcm_params.h> -+#include <sound/soc.h> -+#include <sound/jack.h> ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2836", "brcm,bcm2708", "brcm,bcm2709"; + -+#include "../codecs/pcm512x.h" ++ fragment@0 { ++ target = <&spi0>; ++ __overlay__ { ++ cs-gpios = <&gpio 36 1>, <&gpio 35 1>; ++ }; ++ }; + -+static int snd_rpi_hifiberry_dacplus_init(struct snd_soc_pcm_runtime *rtd) -+{ -+ struct snd_soc_codec *codec = rtd->codec; -+ snd_soc_update_bits(codec, PCM512x_GPIO_EN, 0x08, 0x08); -+ snd_soc_update_bits(codec, PCM512x_GPIO_OUTPUT_4, 0xf, 0x02); -+ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x08,0x08); -+ return 0; -+} ++ fragment@1 { ++ target = <&spi0_cs_pins>; ++ __overlay__ { ++ bcrm,pins = <36 35>; ++ }; ++ }; + -+static int snd_rpi_hifiberry_dacplus_hw_params(struct snd_pcm_substream *substream, -+ struct snd_pcm_hw_params *params) -+{ -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; -+ return snd_soc_dai_set_bclk_ratio(cpu_dai, 64); -+} ++ fragment@2 { ++ target = <&spi0_pins>; ++ __overlay__ { ++ bcrm,pins = <37 38 39>; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/spi1-1cs-overlay.dts b/arch/arm/boot/dts/overlays/spi1-1cs-overlay.dts +new file mode 100644 +index 0000000..71c2439 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/spi1-1cs-overlay.dts +@@ -0,0 +1,57 @@ ++/dts-v1/; ++/plugin/; + -+static int snd_rpi_hifiberry_dacplus_startup(struct snd_pcm_substream *substream) { -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_codec *codec = rtd->codec; -+ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x08,0x08); -+ return 0; -+} + -+static void snd_rpi_hifiberry_dacplus_shutdown(struct snd_pcm_substream *substream) { -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_codec *codec = rtd->codec; -+ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x08,0x00); -+} ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; + -+/* machine stream operations */ -+static struct snd_soc_ops snd_rpi_hifiberry_dacplus_ops = { -+ .hw_params = snd_rpi_hifiberry_dacplus_hw_params, -+ .startup = snd_rpi_hifiberry_dacplus_startup, -+ .shutdown = snd_rpi_hifiberry_dacplus_shutdown, -+}; ++ fragment@0 { ++ target = <&gpio>; ++ __overlay__ { ++ spi1_pins: spi1_pins { ++ brcm,pins = <19 20 21>; ++ brcm,function = <3>; /* alt4 */ ++ }; + -+static struct snd_soc_dai_link snd_rpi_hifiberry_dacplus_dai[] = { -+{ -+ .name = "HiFiBerry DAC+", -+ .stream_name = "HiFiBerry DAC+ HiFi", -+ .cpu_dai_name = "bcm2708-i2s.0", -+ .codec_dai_name = "pcm512x-hifi", -+ .platform_name = "bcm2708-i2s.0", -+ .codec_name = "pcm512x.1-004d", -+ .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | -+ SND_SOC_DAIFMT_CBS_CFS, -+ .ops = &snd_rpi_hifiberry_dacplus_ops, -+ .init = snd_rpi_hifiberry_dacplus_init, -+}, -+}; ++ spi1_cs_pins: spi1_cs_pins { ++ brcm,pins = <18>; ++ brcm,function = <1>; /* output */ ++ }; ++ }; ++ }; + -+/* audio machine driver */ -+static struct snd_soc_card snd_rpi_hifiberry_dacplus = { -+ .name = "snd_rpi_hifiberry_dacplus", -+ .dai_link = snd_rpi_hifiberry_dacplus_dai, -+ .num_links = ARRAY_SIZE(snd_rpi_hifiberry_dacplus_dai), -+}; ++ fragment@1 { ++ target = <&spi1>; ++ frag1: __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&spi1_pins &spi1_cs_pins>; ++ cs-gpios = <&gpio 18 1>; ++ status = "okay"; + -+static int snd_rpi_hifiberry_dacplus_probe(struct platform_device *pdev) -+{ -+ int ret = 0; ++ spidev1_0: spidev@0 { ++ compatible = "spidev"; ++ reg = <0>; /* CE0 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ status = "okay"; ++ }; ++ }; ++ }; + -+ snd_rpi_hifiberry_dacplus.dev = &pdev->dev; ++ fragment@2 { ++ target = <&aux>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; + -+ if (pdev->dev.of_node) { -+ struct device_node *i2s_node; -+ struct snd_soc_dai_link *dai = &snd_rpi_hifiberry_dacplus_dai[0]; -+ i2s_node = of_parse_phandle(pdev->dev.of_node, -+ "i2s-controller", 0); ++ __overrides__ { ++ cs0_pin = <&spi1_cs_pins>,"brcm,pins:0", ++ <&frag1>,"cs-gpios:4"; ++ cs0_spidev = <&spidev1_0>,"status"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/spi1-2cs-overlay.dts b/arch/arm/boot/dts/overlays/spi1-2cs-overlay.dts +new file mode 100644 +index 0000000..2ae0885 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/spi1-2cs-overlay.dts +@@ -0,0 +1,69 @@ ++/dts-v1/; ++/plugin/; + -+ if (i2s_node) { -+ dai->cpu_dai_name = NULL; -+ dai->cpu_of_node = i2s_node; -+ dai->platform_name = NULL; -+ dai->platform_of_node = i2s_node; -+ } -+ } + -+ ret = snd_soc_register_card(&snd_rpi_hifiberry_dacplus); -+ if (ret) -+ dev_err(&pdev->dev, -+ "snd_soc_register_card() failed: %d\n", ret); ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; + -+ return ret; -+} ++ fragment@0 { ++ target = <&gpio>; ++ __overlay__ { ++ spi1_pins: spi1_pins { ++ brcm,pins = <19 20 21>; ++ brcm,function = <3>; /* alt4 */ ++ }; + -+static int snd_rpi_hifiberry_dacplus_remove(struct platform_device *pdev) -+{ -+ return snd_soc_unregister_card(&snd_rpi_hifiberry_dacplus); -+} ++ spi1_cs_pins: spi1_cs_pins { ++ brcm,pins = <18 17>; ++ brcm,function = <1>; /* output */ ++ }; ++ }; ++ }; + -+static const struct of_device_id snd_rpi_hifiberry_dacplus_of_match[] = { -+ { .compatible = "hifiberry,hifiberry-dacplus", }, -+ {}, -+}; -+MODULE_DEVICE_TABLE(of, snd_rpi_hifiberry_dacplus_of_match); ++ fragment@1 { ++ target = <&spi1>; ++ frag1: __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&spi1_pins &spi1_cs_pins>; ++ cs-gpios = <&gpio 18 1>, <&gpio 17 1>; ++ status = "okay"; + -+static struct platform_driver snd_rpi_hifiberry_dacplus_driver = { -+ .driver = { -+ .name = "snd-rpi-hifiberry-dacplus", -+ .owner = THIS_MODULE, -+ .of_match_table = snd_rpi_hifiberry_dacplus_of_match, -+ }, -+ .probe = snd_rpi_hifiberry_dacplus_probe, -+ .remove = snd_rpi_hifiberry_dacplus_remove, -+}; ++ spidev1_0: spidev@0 { ++ compatible = "spidev"; ++ reg = <0>; /* CE0 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ status = "okay"; ++ }; + -+module_platform_driver(snd_rpi_hifiberry_dacplus_driver); ++ spidev1_1: spidev@1 { ++ compatible = "spidev"; ++ reg = <1>; /* CE1 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ status = "okay"; ++ }; ++ }; ++ }; + -+MODULE_AUTHOR("Daniel Matuschek <daniel@hifiberry.com>"); -+MODULE_DESCRIPTION("ASoC Driver for HiFiBerry DAC+"); -+MODULE_LICENSE("GPL v2"); - -From 9c6f0b1812313d39afeefd700b7f9df9a82a47cd Mon Sep 17 00:00:00 2001 -From: Daniel Matuschek <info@crazy-audio.com> -Date: Mon, 4 Aug 2014 11:09:58 +0200 -Subject: [PATCH 072/170] Added driver for HiFiBerry Amp amplifier add-on board - -The driver contains a low-level hardware driver for the TAS5713 and the -drivers for the Raspberry Pi I2S subsystem. - -TAS5713: return error if initialisation fails - -Existing TAS5713 driver logs errors during initialisation, but does not return -an error code. Therefore even if initialisation fails, the driver will still be -loaded, but won't work. This patch fixes this. I2C communication error will now -reported correctly by a non-zero return code. - -HiFiBerry Amp: fix device-tree problems - -Some code to load the driver based on device-tree-overlays was missing. This is added by this patch. ---- - sound/soc/bcm/Kconfig | 7 + - sound/soc/bcm/Makefile | 2 + - sound/soc/bcm/hifiberry_amp.c | 127 +++++++++++++++ - sound/soc/codecs/Kconfig | 4 + - sound/soc/codecs/Makefile | 2 + - sound/soc/codecs/tas5713.c | 369 ++++++++++++++++++++++++++++++++++++++++++ - sound/soc/codecs/tas5713.h | 210 ++++++++++++++++++++++++ - 7 files changed, 721 insertions(+) - create mode 100644 sound/soc/bcm/hifiberry_amp.c - create mode 100644 sound/soc/codecs/tas5713.c - create mode 100644 sound/soc/codecs/tas5713.h - -diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig -index 8c338b5..7677c89 100644 ---- a/sound/soc/bcm/Kconfig -+++ b/sound/soc/bcm/Kconfig -@@ -29,6 +29,13 @@ config SND_BCM2708_SOC_HIFIBERRY_DIGI - help - Say Y or M if you want to add support for HifiBerry Digi S/PDIF output board. - -+config SND_BCM2708_SOC_HIFIBERRY_AMP -+ tristate "Support for the HifiBerry Amp" -+ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S -+ select SND_SOC_TAS5713 -+ help -+ Say Y or M if you want to add support for the HifiBerry Amp amplifier board. ++ fragment@2 { ++ target = <&aux>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; + - config SND_BCM2708_SOC_RPI_DAC - tristate "Support for RPi-DAC" - depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S -diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile -index a29538e..30db495 100644 ---- a/sound/soc/bcm/Makefile -+++ b/sound/soc/bcm/Makefile -@@ -7,11 +7,13 @@ obj-$(CONFIG_SND_BCM2835_SOC_I2S) += snd-soc-bcm2835-i2s.o - snd-soc-hifiberry-dac-objs := hifiberry_dac.o - snd-soc-hifiberry-dacplus-objs := hifiberry_dacplus.o - snd-soc-hifiberry-digi-objs := hifiberry_digi.o -+snd-soc-hifiberry-amp-objs := hifiberry_amp.o - snd-soc-rpi-dac-objs := rpi-dac.o - snd-soc-iqaudio-dac-objs := iqaudio-dac.o - - obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o - obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS) += snd-soc-hifiberry-dacplus.o - obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI) += snd-soc-hifiberry-digi.o -+obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_AMP) += snd-soc-hifiberry-amp.o - obj-$(CONFIG_SND_BCM2708_SOC_RPI_DAC) += snd-soc-rpi-dac.o - obj-$(CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC) += snd-soc-iqaudio-dac.o -diff --git a/sound/soc/bcm/hifiberry_amp.c b/sound/soc/bcm/hifiberry_amp.c ++ __overrides__ { ++ cs0_pin = <&spi1_cs_pins>,"brcm,pins:0", ++ <&frag1>,"cs-gpios:4"; ++ cs1_pin = <&spi1_cs_pins>,"brcm,pins:4", ++ <&frag1>,"cs-gpios:16"; ++ cs0_spidev = <&spidev1_0>,"status"; ++ cs1_spidev = <&spidev1_1>,"status"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/spi1-3cs-overlay.dts b/arch/arm/boot/dts/overlays/spi1-3cs-overlay.dts new file mode 100644 -index 0000000..5903915 +index 0000000..8f79044 --- /dev/null -+++ b/sound/soc/bcm/hifiberry_amp.c -@@ -0,0 +1,127 @@ -+/* -+ * ASoC Driver for HifiBerry AMP -+ * -+ * Author: Sebastian Eickhoff <basti.eickhoff@googlemail.com> -+ * Copyright 2014 -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License -+ * version 2 as published by the Free Software Foundation. -+ * -+ * This program is distributed in the hope that it will be useful, but -+ * WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * General Public License for more details. -+ */ ++++ b/arch/arm/boot/dts/overlays/spi1-3cs-overlay.dts +@@ -0,0 +1,81 @@ ++/dts-v1/; ++/plugin/; + -+#include <linux/module.h> -+#include <linux/platform_device.h> + -+#include <sound/core.h> -+#include <sound/pcm.h> -+#include <sound/pcm_params.h> -+#include <sound/soc.h> -+#include <sound/jack.h> ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; + -+static int snd_rpi_hifiberry_amp_init(struct snd_soc_pcm_runtime *rtd) -+{ -+ // ToDo: init of the dsp-registers. -+ return 0; -+} ++ fragment@0 { ++ target = <&gpio>; ++ __overlay__ { ++ spi1_pins: spi1_pins { ++ brcm,pins = <19 20 21>; ++ brcm,function = <3>; /* alt4 */ ++ }; + -+static int snd_rpi_hifiberry_amp_hw_params( struct snd_pcm_substream *substream, -+ struct snd_pcm_hw_params *params ) -+{ -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; ++ spi1_cs_pins: spi1_cs_pins { ++ brcm,pins = <18 17 16>; ++ brcm,function = <1>; /* output */ ++ }; ++ }; ++ }; + -+ return snd_soc_dai_set_bclk_ratio(cpu_dai, 64); -+} ++ fragment@1 { ++ target = <&spi1>; ++ frag1: __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&spi1_pins &spi1_cs_pins>; ++ cs-gpios = <&gpio 18 1>, <&gpio 17 1>, <&gpio 16 1>; ++ status = "okay"; + -+static struct snd_soc_ops snd_rpi_hifiberry_amp_ops = { -+ .hw_params = snd_rpi_hifiberry_amp_hw_params, -+}; ++ spidev1_0: spidev@0 { ++ compatible = "spidev"; ++ reg = <0>; /* CE0 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ status = "okay"; ++ }; + -+static struct snd_soc_dai_link snd_rpi_hifiberry_amp_dai[] = { -+ { -+ .name = "HifiBerry AMP", -+ .stream_name = "HifiBerry AMP HiFi", -+ .cpu_dai_name = "bcm2708-i2s.0", -+ .codec_dai_name = "tas5713-hifi", -+ .platform_name = "bcm2708-i2s.0", -+ .codec_name = "tas5713.1-001b", -+ .dai_fmt = SND_SOC_DAIFMT_I2S | -+ SND_SOC_DAIFMT_NB_NF | -+ SND_SOC_DAIFMT_CBS_CFS, -+ .ops = &snd_rpi_hifiberry_amp_ops, -+ .init = snd_rpi_hifiberry_amp_init, -+ }, -+}; ++ spidev1_1: spidev@1 { ++ compatible = "spidev"; ++ reg = <1>; /* CE1 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ status = "okay"; ++ }; + ++ spidev1_2: spidev@2 { ++ compatible = "spidev"; ++ reg = <2>; /* CE2 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ status = "okay"; ++ }; ++ }; ++ }; + -+static struct snd_soc_card snd_rpi_hifiberry_amp = { -+ .name = "snd_rpi_hifiberry_amp", -+ .dai_link = snd_rpi_hifiberry_amp_dai, -+ .num_links = ARRAY_SIZE(snd_rpi_hifiberry_amp_dai), -+}; ++ fragment@2 { ++ target = <&aux>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; + -+static const struct of_device_id snd_rpi_hifiberry_amp_of_match[] = { -+ { .compatible = "hifiberry,hifiberry-amp", }, -+ {}, ++ __overrides__ { ++ cs0_pin = <&spi1_cs_pins>,"brcm,pins:0", ++ <&frag1>,"cs-gpios:4"; ++ cs1_pin = <&spi1_cs_pins>,"brcm,pins:4", ++ <&frag1>,"cs-gpios:16"; ++ cs2_pin = <&spi1_cs_pins>,"brcm,pins:8", ++ <&frag1>,"cs-gpios:28"; ++ cs0_spidev = <&spidev1_0>,"status"; ++ cs1_spidev = <&spidev1_1>,"status"; ++ cs2_spidev = <&spidev1_2>,"status"; ++ }; +}; -+MODULE_DEVICE_TABLE(of, snd_rpi_hifiberry_amp_of_match); +diff --git a/arch/arm/boot/dts/overlays/spi2-1cs-overlay.dts b/arch/arm/boot/dts/overlays/spi2-1cs-overlay.dts +new file mode 100644 +index 0000000..6f57bc7 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/spi2-1cs-overlay.dts +@@ -0,0 +1,57 @@ ++/dts-v1/; ++/plugin/; + + -+static int snd_rpi_hifiberry_amp_probe(struct platform_device *pdev) -+{ -+ int ret = 0; ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; + -+ snd_rpi_hifiberry_amp.dev = &pdev->dev; ++ fragment@0 { ++ target = <&gpio>; ++ __overlay__ { ++ spi2_pins: spi2_pins { ++ brcm,pins = <40 41 42>; ++ brcm,function = <3>; /* alt4 */ ++ }; + -+ if (pdev->dev.of_node) { -+ struct device_node *i2s_node; -+ struct snd_soc_dai_link *dai = &snd_rpi_hifiberry_amp_dai[0]; -+ i2s_node = of_parse_phandle(pdev->dev.of_node, -+ "i2s-controller", 0); ++ spi2_cs_pins: spi2_cs_pins { ++ brcm,pins = <43>; ++ brcm,function = <1>; /* output */ ++ }; ++ }; ++ }; + -+ if (i2s_node) { -+ dai->cpu_dai_name = NULL; -+ dai->cpu_of_node = i2s_node; -+ dai->platform_name = NULL; -+ dai->platform_of_node = i2s_node; -+ } -+ } ++ fragment@1 { ++ target = <&spi2>; ++ frag1: __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&spi2_pins &spi2_cs_pins>; ++ cs-gpios = <&gpio 43 1>; ++ status = "okay"; + -+ ret = snd_soc_register_card(&snd_rpi_hifiberry_amp); ++ spidev2_0: spidev@0 { ++ compatible = "spidev"; ++ reg = <0>; /* CE0 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ status = "okay"; ++ }; ++ }; ++ }; + -+ if (ret != 0) { -+ dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", ret); -+ } ++ fragment@2 { ++ target = <&aux>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; + -+ return ret; -+} ++ __overrides__ { ++ cs0_pin = <&spi2_cs_pins>,"brcm,pins:0", ++ <&frag1>,"cs-gpios:4"; ++ cs0_spidev = <&spidev2_0>,"status"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/spi2-2cs-overlay.dts b/arch/arm/boot/dts/overlays/spi2-2cs-overlay.dts +new file mode 100644 +index 0000000..d090631 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/spi2-2cs-overlay.dts +@@ -0,0 +1,69 @@ ++/dts-v1/; ++/plugin/; + + -+static int snd_rpi_hifiberry_amp_remove(struct platform_device *pdev) -+{ -+ return snd_soc_unregister_card(&snd_rpi_hifiberry_amp); -+} ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; + ++ fragment@0 { ++ target = <&gpio>; ++ __overlay__ { ++ spi2_pins: spi2_pins { ++ brcm,pins = <40 41 42>; ++ brcm,function = <3>; /* alt4 */ ++ }; + -+static struct platform_driver snd_rpi_hifiberry_amp_driver = { -+ .driver = { -+ .name = "snd-hifiberry-amp", -+ .owner = THIS_MODULE, -+ .of_match_table = snd_rpi_hifiberry_amp_of_match, -+ }, -+ .probe = snd_rpi_hifiberry_amp_probe, -+ .remove = snd_rpi_hifiberry_amp_remove, -+}; ++ spi2_cs_pins: spi2_cs_pins { ++ brcm,pins = <43 44>; ++ brcm,function = <1>; /* output */ ++ }; ++ }; ++ }; + ++ fragment@1 { ++ target = <&spi2>; ++ frag1: __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&spi2_pins &spi2_cs_pins>; ++ cs-gpios = <&gpio 43 1>, <&gpio 44 1>; ++ status = "okay"; + -+module_platform_driver(snd_rpi_hifiberry_amp_driver); ++ spidev2_0: spidev@0 { ++ compatible = "spidev"; ++ reg = <0>; /* CE0 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ status = "okay"; ++ }; + ++ spidev2_1: spidev@1 { ++ compatible = "spidev"; ++ reg = <1>; /* CE1 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ status = "okay"; ++ }; ++ }; ++ }; + -+MODULE_AUTHOR("Sebastian Eickhoff <basti.eickhoff@googlemail.com>"); -+MODULE_DESCRIPTION("ASoC driver for HiFiBerry-AMP"); -+MODULE_LICENSE("GPL v2"); -diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig -index b63f2fb..fe32cca 100644 ---- a/sound/soc/codecs/Kconfig -+++ b/sound/soc/codecs/Kconfig -@@ -117,6 +117,7 @@ config SND_SOC_ALL_CODECS - select SND_SOC_TFA9879 if I2C - select SND_SOC_TLV320AIC23_I2C if I2C - select SND_SOC_TLV320AIC23_SPI if SPI_MASTER -+ select SND_SOC_TAS5713 if I2C - select SND_SOC_TLV320AIC26 if SPI_MASTER - select SND_SOC_TLV320AIC31XX if I2C - select SND_SOC_TLV320AIC32X4 if I2C -@@ -674,6 +675,9 @@ config SND_SOC_TFA9879 - tristate "NXP Semiconductors TFA9879 amplifier" - depends on I2C - -+config SND_SOC_TAS5713 -+ tristate ++ fragment@2 { ++ target = <&aux>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; + - config SND_SOC_TLV320AIC23 - tristate - -diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile -index 2147436..dbb213d 100644 ---- a/sound/soc/codecs/Makefile -+++ b/sound/soc/codecs/Makefile -@@ -118,6 +118,7 @@ snd-soc-sti-sas-objs := sti-sas.o - snd-soc-tas5086-objs := tas5086.o - snd-soc-tas571x-objs := tas571x.o - snd-soc-tfa9879-objs := tfa9879.o -+snd-soc-tas5713-objs := tas5713.o - snd-soc-tlv320aic23-objs := tlv320aic23.o - snd-soc-tlv320aic23-i2c-objs := tlv320aic23-i2c.o - snd-soc-tlv320aic23-spi-objs := tlv320aic23-spi.o -@@ -312,6 +313,7 @@ obj-$(CONFIG_SND_SOC_TAS2552) += snd-soc-tas2552.o - obj-$(CONFIG_SND_SOC_TAS5086) += snd-soc-tas5086.o - obj-$(CONFIG_SND_SOC_TAS571X) += snd-soc-tas571x.o - obj-$(CONFIG_SND_SOC_TFA9879) += snd-soc-tfa9879.o -+obj-$(CONFIG_SND_SOC_TAS5713) += snd-soc-tas5713.o - obj-$(CONFIG_SND_SOC_TLV320AIC23) += snd-soc-tlv320aic23.o - obj-$(CONFIG_SND_SOC_TLV320AIC23_I2C) += snd-soc-tlv320aic23-i2c.o - obj-$(CONFIG_SND_SOC_TLV320AIC23_SPI) += snd-soc-tlv320aic23-spi.o -diff --git a/sound/soc/codecs/tas5713.c b/sound/soc/codecs/tas5713.c ++ __overrides__ { ++ cs0_pin = <&spi2_cs_pins>,"brcm,pins:0", ++ <&frag1>,"cs-gpios:4"; ++ cs1_pin = <&spi2_cs_pins>,"brcm,pins:4", ++ <&frag1>,"cs-gpios:16"; ++ cs0_spidev = <&spidev2_0>,"status"; ++ cs1_spidev = <&spidev2_1>,"status"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/spi2-3cs-overlay.dts b/arch/arm/boot/dts/overlays/spi2-3cs-overlay.dts new file mode 100644 -index 0000000..9b27138 +index 0000000..e258672 --- /dev/null -+++ b/sound/soc/codecs/tas5713.c -@@ -0,0 +1,369 @@ -+/* -+ * ASoC Driver for TAS5713 -+ * -+ * Author: Sebastian Eickhoff <basti.eickhoff@googlemail.com> -+ * Copyright 2014 -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License -+ * version 2 as published by the Free Software Foundation. -+ * -+ * This program is distributed in the hope that it will be useful, but -+ * WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * General Public License for more details. -+ */ -+ -+#include <linux/module.h> -+#include <linux/moduleparam.h> -+#include <linux/init.h> -+#include <linux/delay.h> -+#include <linux/pm.h> -+#include <linux/i2c.h> -+#include <linux/of_device.h> -+#include <linux/spi/spi.h> -+#include <linux/regmap.h> -+#include <linux/regulator/consumer.h> -+#include <linux/slab.h> -+#include <sound/core.h> -+#include <sound/pcm.h> -+#include <sound/pcm_params.h> -+#include <sound/soc.h> -+#include <sound/initval.h> -+#include <sound/tlv.h> ++++ b/arch/arm/boot/dts/overlays/spi2-3cs-overlay.dts +@@ -0,0 +1,81 @@ ++/dts-v1/; ++/plugin/; + -+#include <linux/kernel.h> -+#include <linux/string.h> -+#include <linux/fs.h> -+#include <asm/uaccess.h> + -+#include "tas5713.h" ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; + ++ fragment@0 { ++ target = <&gpio>; ++ __overlay__ { ++ spi2_pins: spi2_pins { ++ brcm,pins = <40 41 42>; ++ brcm,function = <3>; /* alt4 */ ++ }; + -+static struct i2c_client *i2c; ++ spi2_cs_pins: spi2_cs_pins { ++ brcm,pins = <43 44 45>; ++ brcm,function = <1>; /* output */ ++ }; ++ }; ++ }; + -+struct tas5713_priv { -+ struct regmap *regmap; -+ int mclk_div; -+ struct snd_soc_codec *codec; -+}; ++ fragment@1 { ++ target = <&spi2>; ++ frag1: __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&spi2_pins &spi2_cs_pins>; ++ cs-gpios = <&gpio 43 1>, <&gpio 44 1>, <&gpio 45 1>; ++ status = "okay"; + -+static struct tas5713_priv *priv_data; ++ spidev2_0: spidev@0 { ++ compatible = "spidev"; ++ reg = <0>; /* CE0 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ status = "okay"; ++ }; + ++ spidev2_1: spidev@1 { ++ compatible = "spidev"; ++ reg = <1>; /* CE1 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ status = "okay"; ++ }; + ++ spidev2_2: spidev@2 { ++ compatible = "spidev"; ++ reg = <2>; /* CE2 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ status = "okay"; ++ }; ++ }; ++ }; + ++ fragment@2 { ++ target = <&aux>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; + ++ __overrides__ { ++ cs0_pin = <&spi2_cs_pins>,"brcm,pins:0", ++ <&frag1>,"cs-gpios:4"; ++ cs1_pin = <&spi2_cs_pins>,"brcm,pins:4", ++ <&frag1>,"cs-gpios:16"; ++ cs2_pin = <&spi2_cs_pins>,"brcm,pins:8", ++ <&frag1>,"cs-gpios:28"; ++ cs0_spidev = <&spidev2_0>,"status"; ++ cs1_spidev = <&spidev2_1>,"status"; ++ cs2_spidev = <&spidev2_2>,"status"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/tinylcd35-overlay.dts b/arch/arm/boot/dts/overlays/tinylcd35-overlay.dts +new file mode 100644 +index 0000000..ed2b053 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/tinylcd35-overlay.dts +@@ -0,0 +1,224 @@ +/* -+ * _ _ ___ _ ___ _ _ -+ * /_\ | | / __| /_\ / __|___ _ _| |_ _ _ ___| |___ -+ * / _ \| |__\__ \/ _ \ | (__/ _ \ ' \ _| '_/ _ \ (_-< -+ * /_/ \_\____|___/_/ \_\ \___\___/_||_\__|_| \___/_/__/ ++ * tinylcd35-overlay.dts ++ * ++ * ------------------------------------------------- ++ * www.tinlylcd.com ++ * ------------------------------------------------- ++ * Device---Driver-----BUS GPIO's ++ * display tinylcd35 spi0.0 25 24 18 ++ * touch ads7846 spi0.1 5 ++ * rtc ds1307 i2c1-0068 ++ * rtc pcf8563 i2c1-0051 ++ * keypad gpio-keys --------- 17 22 27 23 28 ++ * ++ * ++ * TinyLCD.com 3.5 inch TFT ++ * ++ * Version 001 ++ * 5/3/2015 -- Noralf Trønnes Initial Device tree framework ++ * 10/3/2015 -- tinylcd@gmail.com added ds1307 support. + * + */ + -+static const DECLARE_TLV_DB_SCALE(tas5713_vol_tlv, -10000, 50, 1); ++/dts-v1/; ++/plugin/; + ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; + -+static const struct snd_kcontrol_new tas5713_snd_controls[] = { -+ SOC_SINGLE_TLV ("Master" , TAS5713_VOL_MASTER, 0, 248, 1, tas5713_vol_tlv), -+ SOC_DOUBLE_R_TLV("Channels" , TAS5713_VOL_CH1, TAS5713_VOL_CH2, 0, 248, 1, tas5713_vol_tlv) -+}; ++ fragment@0 { ++ target = <&spi0>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; + ++ fragment@1 { ++ target = <&spidev0>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; + ++ fragment@2 { ++ target = <&spidev1>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; + ++ fragment@3 { ++ target = <&gpio>; ++ __overlay__ { ++ tinylcd35_pins: tinylcd35_pins { ++ brcm,pins = <25 24 18>; ++ brcm,function = <1>; /* out */ ++ }; ++ tinylcd35_ts_pins: tinylcd35_ts_pins { ++ brcm,pins = <5>; ++ brcm,function = <0>; /* in */ ++ }; ++ keypad_pins: keypad_pins { ++ brcm,pins = <4 17 22 23 27>; ++ brcm,function = <0>; /* in */ ++ brcm,pull = <1>; /* down */ ++ }; ++ }; ++ }; + -+/* -+ * __ __ _ _ ___ _ -+ * | \/ |__ _ __| |_ (_)_ _ ___ | \ _ _(_)_ _____ _ _ -+ * | |\/| / _` / _| ' \| | ' \/ -_) | |) | '_| \ V / -_) '_| -+ * |_| |_\__,_\__|_||_|_|_||_\___| |___/|_| |_|\_/\___|_| -+ * -+ */ ++ fragment@4 { ++ target = <&spi0>; ++ __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; + -+static int tas5713_hw_params(struct snd_pcm_substream *substream, -+ struct snd_pcm_hw_params *params, -+ struct snd_soc_dai *dai) -+{ -+ u16 blen = 0x00; ++ tinylcd35: tinylcd35@0{ ++ compatible = "neosec,tinylcd"; ++ reg = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&tinylcd35_pins>, ++ <&tinylcd35_ts_pins>; + -+ struct snd_soc_codec *codec; -+ codec = dai->codec; -+ priv_data->codec = dai->codec; ++ spi-max-frequency = <48000000>; ++ rotate = <270>; ++ fps = <20>; ++ bgr; ++ buswidth = <8>; ++ reset-gpios = <&gpio 25 0>; ++ dc-gpios = <&gpio 24 0>; ++ led-gpios = <&gpio 18 1>; ++ debug = <0>; + -+ switch (params_format(params)) { -+ case SNDRV_PCM_FORMAT_S16_LE: -+ blen = 0x03; -+ break; -+ case SNDRV_PCM_FORMAT_S20_3LE: -+ blen = 0x1; -+ break; -+ case SNDRV_PCM_FORMAT_S24_LE: -+ blen = 0x04; -+ break; -+ case SNDRV_PCM_FORMAT_S32_LE: -+ blen = 0x05; -+ break; -+ default: -+ dev_err(dai->dev, "Unsupported word length: %u\n", -+ params_format(params)); -+ return -EINVAL; -+ } ++ init = <0x10000B0 0x80 ++ 0x10000C0 0x0A 0x0A ++ 0x10000C1 0x01 0x01 ++ 0x10000C2 0x33 ++ 0x10000C5 0x00 0x42 0x80 ++ 0x10000B1 0xD0 0x11 ++ 0x10000B4 0x02 ++ 0x10000B6 0x00 0x22 0x3B ++ 0x10000B7 0x07 ++ 0x1000036 0x58 ++ 0x10000F0 0x36 0xA5 0xD3 ++ 0x10000E5 0x80 ++ 0x10000E5 0x01 ++ 0x10000B3 0x00 ++ 0x10000E5 0x00 ++ 0x10000F0 0x36 0xA5 0x53 ++ 0x10000E0 0x00 0x35 0x33 0x00 0x00 0x00 0x00 0x35 0x33 0x00 0x00 0x00 ++ 0x100003A 0x55 ++ 0x1000011 ++ 0x2000001 ++ 0x1000029>; ++ }; + -+ // set word length -+ snd_soc_update_bits(codec, TAS5713_SERIAL_DATA_INTERFACE, 0x7, blen); ++ tinylcd35_ts: tinylcd35_ts@1 { ++ compatible = "ti,ads7846"; ++ reg = <1>; ++ status = "disabled"; + -+ return 0; -+} ++ spi-max-frequency = <2000000>; ++ interrupts = <5 2>; /* high-to-low edge triggered */ ++ interrupt-parent = <&gpio>; ++ pendown-gpio = <&gpio 5 0>; ++ ti,x-plate-ohms = /bits/ 16 <100>; ++ ti,pressure-max = /bits/ 16 <255>; ++ }; ++ }; ++ }; + ++ /* RTC */ + -+static int tas5713_mute_stream(struct snd_soc_dai *dai, int mute, int stream) -+{ -+ unsigned int val = 0; ++ fragment@5 { ++ target = <&i2c1>; ++ __dormant__ { ++ #address-cells = <1>; ++ #size-cells = <0>; + -+ struct tas5713_priv *tas5713; -+ struct snd_soc_codec *codec = dai->codec; -+ tas5713 = snd_soc_codec_get_drvdata(codec); ++ status = "okay"; + -+ if (mute) { -+ val = TAS5713_SOFT_MUTE_ALL; -+ } ++ pcf8563: pcf8563@51 { ++ compatible = "nxp,pcf8563"; ++ reg = <0x51>; ++ status = "okay"; ++ }; ++ }; ++ }; + -+ return regmap_write(tas5713->regmap, TAS5713_SOFT_MUTE, val); -+} ++ fragment@6 { ++ target = <&i2c1>; ++ __dormant__ { ++ #address-cells = <1>; ++ #size-cells = <0>; + ++ status = "okay"; + -+static const struct snd_soc_dai_ops tas5713_dai_ops = { -+ .hw_params = tas5713_hw_params, -+ .mute_stream = tas5713_mute_stream, -+}; ++ ds1307: ds1307@68 { ++ compatible = "maxim,ds1307"; ++ reg = <0x68>; ++ status = "okay"; ++ }; ++ }; ++ }; + ++ /* ++ * Values for input event code is found under the ++ * 'Keys and buttons' heading in include/uapi/linux/input.h ++ */ ++ fragment@7 { ++ target-path = "/soc"; ++ __overlay__ { ++ keypad: keypad { ++ compatible = "gpio-keys"; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&keypad_pins>; ++ status = "disabled"; ++ autorepeat; + -+static struct snd_soc_dai_driver tas5713_dai = { -+ .name = "tas5713-hifi", -+ .playback = { -+ .stream_name = "Playback", -+ .channels_min = 2, -+ .channels_max = 2, -+ .rates = SNDRV_PCM_RATE_8000_48000, -+ .formats = (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE ), -+ }, -+ .ops = &tas5713_dai_ops, ++ button@17 { ++ label = "GPIO KEY_UP"; ++ linux,code = <103>; ++ gpios = <&gpio 17 0>; ++ }; ++ button@22 { ++ label = "GPIO KEY_DOWN"; ++ linux,code = <108>; ++ gpios = <&gpio 22 0>; ++ }; ++ button@27 { ++ label = "GPIO KEY_LEFT"; ++ linux,code = <105>; ++ gpios = <&gpio 27 0>; ++ }; ++ button@23 { ++ label = "GPIO KEY_RIGHT"; ++ linux,code = <106>; ++ gpios = <&gpio 23 0>; ++ }; ++ button@4 { ++ label = "GPIO KEY_ENTER"; ++ linux,code = <28>; ++ gpios = <&gpio 4 0>; ++ }; ++ }; ++ }; ++ }; ++ ++ __overrides__ { ++ speed = <&tinylcd35>,"spi-max-frequency:0"; ++ rotate = <&tinylcd35>,"rotate:0"; ++ fps = <&tinylcd35>,"fps:0"; ++ debug = <&tinylcd35>,"debug:0"; ++ touch = <&tinylcd35_ts>,"status"; ++ touchgpio = <&tinylcd35_ts_pins>,"brcm,pins:0", ++ <&tinylcd35_ts>,"interrupts:0", ++ <&tinylcd35_ts>,"pendown-gpio:4"; ++ xohms = <&tinylcd35_ts>,"ti,x-plate-ohms;0"; ++ rtc-pcf = <0>,"=5"; ++ rtc-ds = <0>,"=6"; ++ keypad = <&keypad>,"status"; ++ }; +}; +diff --git a/arch/arm/boot/dts/overlays/uart1-overlay.dts b/arch/arm/boot/dts/overlays/uart1-overlay.dts +new file mode 100644 +index 0000000..fa73e1f +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/uart1-overlay.dts +@@ -0,0 +1,38 @@ ++/dts-v1/; ++/plugin/; ++ ++/{ ++ compatible = "brcm,bcm2708"; + ++ fragment@0 { ++ target = <&uart1>; ++ __overlay__ { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&uart1_pins>; ++ status = "okay"; ++ }; ++ }; + ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ uart1_pins: uart1_pins { ++ brcm,pins = <14 15>; ++ brcm,function = <2>; /* alt5 */ ++ brcm,pull = <0 2>; ++ }; ++ }; ++ }; + ++ fragment@2 { ++ target-path = "/chosen"; ++ __overlay__ { ++ bootargs = "8250.nr_uarts=1"; ++ }; ++ }; + ++ __overrides__ { ++ txd1_pin = <&uart1_pins>,"brcm,pins:0"; ++ rxd1_pin = <&uart1_pins>,"brcm,pins:4"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/vc4-kms-v3d-overlay.dts b/arch/arm/boot/dts/overlays/vc4-kms-v3d-overlay.dts +new file mode 100644 +index 0000000..a4ca2ca +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/vc4-kms-v3d-overlay.dts +@@ -0,0 +1,129 @@ +/* -+ * ___ _ ___ _ -+ * / __|___ __| |___ __ | \ _ _(_)_ _____ _ _ -+ * | (__/ _ \/ _` / -_) _| | |) | '_| \ V / -_) '_| -+ * \___\___/\__,_\___\__| |___/|_| |_|\_/\___|_| -+ * ++ * vc4-kms-v3d-overlay.dts + */ + -+static int tas5713_remove(struct snd_soc_codec *codec) -+{ -+ struct tas5713_priv *tas5713; -+ -+ tas5713 = snd_soc_codec_get_drvdata(codec); ++/dts-v1/; ++/plugin/; + -+ return 0; -+} ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; + ++ fragment@0 { ++ target-path = "/chosen"; ++ __overlay__ { ++ bootargs = "cma=256M@256M"; ++ }; ++ }; + -+static int tas5713_probe(struct snd_soc_codec *codec) -+{ -+ struct tas5713_priv *tas5713; -+ int i, ret; ++ fragment@1 { ++ target-path = "/chosen"; ++ __dormant__ { ++ bootargs = "cma=192M@256M"; ++ }; ++ }; + -+ i2c = container_of(codec->dev, struct i2c_client, dev); ++ fragment@2 { ++ target-path = "/chosen"; ++ __dormant__ { ++ bootargs = "cma=128M@128M"; ++ }; ++ }; + -+ tas5713 = snd_soc_codec_get_drvdata(codec); ++ fragment@3 { ++ target-path = "/chosen"; ++ __dormant__ { ++ bootargs = "cma=96M@128M"; ++ }; ++ }; + -+ // Reset error -+ ret = snd_soc_write(codec, TAS5713_ERROR_STATUS, 0x00); -+ if (ret < 0) return ret; ++ fragment@4 { ++ target-path = "/chosen"; ++ __dormant__ { ++ bootargs = "cma=64M@64M"; ++ }; ++ }; + -+ // Trim oscillator -+ ret = snd_soc_write(codec, TAS5713_OSC_TRIM, 0x00); -+ if (ret < 0) return ret; -+ msleep(1000); ++ fragment@5 { ++ target = <&i2c2>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; + -+ // Reset error -+ ret = snd_soc_write(codec, TAS5713_ERROR_STATUS, 0x00); -+ if (ret < 0) return ret; ++ fragment@6 { ++ target = <&cprman>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; + -+ // Clock mode: 44/48kHz, MCLK=64xfs -+ ret = snd_soc_write(codec, TAS5713_CLOCK_CTRL, 0x60); -+ if (ret < 0) return ret; ++ fragment@7 { ++ target = <&fb>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; + -+ // I2S 24bit -+ ret = snd_soc_write(codec, TAS5713_SERIAL_DATA_INTERFACE, 0x05); -+ if (ret < 0) return ret; ++ fragment@8 { ++ target = <&pixelvalve0>; ++ __overlay__ { ++ interrupts = <2 13>; /* pwa0 */ ++ status = "okay"; ++ }; ++ }; + -+ // Unmute -+ ret = snd_soc_write(codec, TAS5713_SYSTEM_CTRL2, 0x00); -+ if (ret < 0) return ret; -+ ret = snd_soc_write(codec, TAS5713_SOFT_MUTE, 0x00); -+ if (ret < 0) return ret; ++ fragment@9 { ++ target = <&pixelvalve1>; ++ __overlay__ { ++ interrupts = <2 14>; /* pwa1 */ ++ status = "okay"; ++ }; ++ }; + -+ // Set volume to 0db -+ ret = snd_soc_write(codec, TAS5713_VOL_MASTER, 0x00); -+ if (ret < 0) return ret; ++ fragment@10 { ++ target = <&pixelvalve2>; ++ __overlay__ { ++ interrupts = <2 10>; /* pixelvalve */ ++ status = "okay"; ++ }; ++ }; + -+ // Now start programming the default initialization sequence -+ for (i = 0; i < ARRAY_SIZE(tas5713_init_sequence); ++i) { -+ ret = i2c_master_send(i2c, -+ tas5713_init_sequence[i].data, -+ tas5713_init_sequence[i].size); -+ if (ret < 0) { -+ printk(KERN_INFO "TAS5713 CODEC PROBE: InitSeq returns: %d\n", ret); -+ } -+ } ++ fragment@11 { ++ target = <&hvs>; ++ __overlay__ { ++ interrupts = <2 1>; ++ status = "okay"; ++ }; ++ }; + -+ // Unmute -+ ret = snd_soc_write(codec, TAS5713_SYSTEM_CTRL2, 0x00); -+ if (ret < 0) return ret; ++ fragment@12 { ++ target = <&hdmi>; ++ __overlay__ { ++ interrupts = <2 8>, <2 9>; ++ status = "okay"; ++ }; ++ }; + -+ return 0; -+} ++ fragment@13 { ++ target = <&v3d>; ++ __overlay__ { ++ interrupts = <1 10>; ++ status = "okay"; ++ }; ++ }; + ++ fragment@14 { ++ target = <&gpu>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; + -+static struct snd_soc_codec_driver soc_codec_dev_tas5713 = { -+ .probe = tas5713_probe, -+ .remove = tas5713_remove, -+ .controls = tas5713_snd_controls, -+ .num_controls = ARRAY_SIZE(tas5713_snd_controls), ++ __overrides__ { ++ cma-256 = <0>,"+0-1-2-3-4"; ++ cma-192 = <0>,"-0+1-2-3-4"; ++ cma-128 = <0>,"-0-1+2-3-4"; ++ cma-96 = <0>,"-0-1-2+3-4"; ++ cma-64 = <0>,"-0-1-2-3+4"; ++ }; +}; +diff --git a/arch/arm/boot/dts/overlays/vga666-overlay.dts b/arch/arm/boot/dts/overlays/vga666-overlay.dts +new file mode 100644 +index 0000000..7fcab96 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/vga666-overlay.dts +@@ -0,0 +1,30 @@ ++/dts-v1/; ++/plugin/; + ++/{ ++ compatible = "brcm,bcm2708"; + ++ // There is no VGA driver module, but we need a platform device ++ // node (that doesn't already use pinctrl) to hang the pinctrl ++ // reference on - leds will do + ++ fragment@0 { ++ target = <&leds>; ++ __overlay__ { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&vga666_pins>; ++ }; ++ }; + -+/* -+ * ___ ___ ___ ___ _ -+ * |_ _|_ ) __| | \ _ _(_)_ _____ _ _ -+ * | | / / (__ | |) | '_| \ V / -_) '_| -+ * |___/___\___| |___/|_| |_|\_/\___|_| -+ * -+ */ -+ -+static const struct reg_default tas5713_reg_defaults[] = { -+ { 0x07 ,0x80 }, // R7 - VOL_MASTER - -40dB -+ { 0x08 , 30 }, // R8 - VOL_CH1 - 0dB -+ { 0x09 , 30 }, // R9 - VOL_CH2 - 0dB -+ { 0x0A ,0x80 }, // R10 - VOL_HEADPHONE - -40dB ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ vga666_pins: vga666_pins { ++ brcm,pins = <2 3 4 5 6 7 8 9 10 11 12 ++ 13 14 15 16 17 18 19 20 21>; ++ brcm,function = <6>; /* alt2 */ ++ brcm,pull = <0>; /* no pull */ ++ }; ++ }; ++ }; +}; +diff --git a/arch/arm/boot/dts/overlays/w1-gpio-overlay.dts b/arch/arm/boot/dts/overlays/w1-gpio-overlay.dts +new file mode 100644 +index 0000000..29a3b48 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/w1-gpio-overlay.dts +@@ -0,0 +1,39 @@ ++// Definitions for w1-gpio module (without external pullup) ++/dts-v1/; ++/plugin/; + ++/ { ++ compatible = "brcm,bcm2708"; + -+static bool tas5713_reg_volatile(struct device *dev, unsigned int reg) -+{ -+ switch (reg) { -+ case TAS5713_DEVICE_ID: -+ case TAS5713_ERROR_STATUS: -+ return true; -+ default: -+ return false; -+ } -+} -+ -+ -+static const struct of_device_id tas5713_of_match[] = { -+ { .compatible = "ti,tas5713", }, -+ { } -+}; -+MODULE_DEVICE_TABLE(of, tas5713_of_match); -+ ++ fragment@0 { ++ target-path = "/"; ++ __overlay__ { + -+static struct regmap_config tas5713_regmap_config = { -+ .reg_bits = 8, -+ .val_bits = 8, ++ w1: onewire@0 { ++ compatible = "w1-gpio"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&w1_pins>; ++ gpios = <&gpio 4 0>; ++ rpi,parasitic-power = <0>; ++ status = "okay"; ++ }; ++ }; ++ }; + -+ .max_register = TAS5713_MAX_REGISTER, -+ .volatile_reg = tas5713_reg_volatile, ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ w1_pins: w1_pins { ++ brcm,pins = <4>; ++ brcm,function = <0>; // in (initially) ++ brcm,pull = <0>; // off ++ }; ++ }; ++ }; + -+ .cache_type = REGCACHE_RBTREE, -+ .reg_defaults = tas5713_reg_defaults, -+ .num_reg_defaults = ARRAY_SIZE(tas5713_reg_defaults), ++ __overrides__ { ++ gpiopin = <&w1>,"gpios:4", ++ <&w1_pins>,"brcm,pins:0"; ++ pullup = <&w1>,"rpi,parasitic-power:0"; ++ }; +}; +diff --git a/arch/arm/boot/dts/overlays/w1-gpio-pullup-overlay.dts b/arch/arm/boot/dts/overlays/w1-gpio-pullup-overlay.dts +new file mode 100644 +index 0000000..66a98f6 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/w1-gpio-pullup-overlay.dts +@@ -0,0 +1,41 @@ ++// Definitions for w1-gpio module (with external pullup) ++/dts-v1/; ++/plugin/; + ++/ { ++ compatible = "brcm,bcm2708"; + -+static int tas5713_i2c_probe(struct i2c_client *i2c, -+ const struct i2c_device_id *id) -+{ -+ int ret; -+ -+ priv_data = devm_kzalloc(&i2c->dev, sizeof *priv_data, GFP_KERNEL); -+ if (!priv_data) -+ return -ENOMEM; -+ -+ priv_data->regmap = devm_regmap_init_i2c(i2c, &tas5713_regmap_config); -+ if (IS_ERR(priv_data->regmap)) { -+ ret = PTR_ERR(priv_data->regmap); -+ return ret; -+ } -+ -+ i2c_set_clientdata(i2c, priv_data); -+ -+ ret = snd_soc_register_codec(&i2c->dev, -+ &soc_codec_dev_tas5713, &tas5713_dai, 1); -+ -+ return ret; -+} -+ -+ -+static int tas5713_i2c_remove(struct i2c_client *i2c) -+{ -+ snd_soc_unregister_codec(&i2c->dev); -+ i2c_set_clientdata(i2c, NULL); -+ -+ kfree(priv_data); -+ -+ return 0; -+} -+ -+ -+static const struct i2c_device_id tas5713_i2c_id[] = { -+ { "tas5713", 0 }, -+ { } -+}; ++ fragment@0 { ++ target-path = "/"; ++ __overlay__ { + -+MODULE_DEVICE_TABLE(i2c, tas5713_i2c_id); ++ w1: onewire@0 { ++ compatible = "w1-gpio"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&w1_pins>; ++ gpios = <&gpio 4 0>, <&gpio 5 1>; ++ rpi,parasitic-power = <0>; ++ status = "okay"; ++ }; ++ }; ++ }; + ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ w1_pins: w1_pins { ++ brcm,pins = <4 5>; ++ brcm,function = <0 1>; // in out ++ brcm,pull = <0 0>; // off off ++ }; ++ }; ++ }; + -+static struct i2c_driver tas5713_i2c_driver = { -+ .driver = { -+ .name = "tas5713", -+ .owner = THIS_MODULE, -+ .of_match_table = tas5713_of_match, -+ }, -+ .probe = tas5713_i2c_probe, -+ .remove = tas5713_i2c_remove, -+ .id_table = tas5713_i2c_id ++ __overrides__ { ++ gpiopin = <&w1>,"gpios:4", ++ <&w1_pins>,"brcm,pins:0"; ++ extpullup = <&w1>,"gpios:16", ++ <&w1_pins>,"brcm,pins:4"; ++ pullup = <&w1>,"rpi,parasitic-power:0"; ++ }; +}; -+ -+ -+static int __init tas5713_modinit(void) -+{ -+ int ret = 0; -+ -+ ret = i2c_add_driver(&tas5713_i2c_driver); -+ if (ret) { -+ printk(KERN_ERR "Failed to register tas5713 I2C driver: %d\n", -+ ret); -+ } -+ -+ return ret; -+} -+module_init(tas5713_modinit); -+ -+ -+static void __exit tas5713_exit(void) -+{ -+ i2c_del_driver(&tas5713_i2c_driver); -+} -+module_exit(tas5713_exit); -+ -+ -+MODULE_AUTHOR("Sebastian Eickhoff <basti.eickhoff@googlemail.com>"); -+MODULE_DESCRIPTION("ASoC driver for TAS5713"); -+MODULE_LICENSE("GPL v2"); -diff --git a/sound/soc/codecs/tas5713.h b/sound/soc/codecs/tas5713.h +diff --git a/arch/arm/boot/dts/overlays/wittypi-overlay.dts b/arch/arm/boot/dts/overlays/wittypi-overlay.dts new file mode 100644 -index 0000000..8f019e0 +index 0000000..8498134 --- /dev/null -+++ b/sound/soc/codecs/tas5713.h -@@ -0,0 +1,210 @@ ++++ b/arch/arm/boot/dts/overlays/wittypi-overlay.dts +@@ -0,0 +1,44 @@ +/* -+ * ASoC Driver for TAS5713 -+ * -+ * Author: Sebastian Eickhoff <basti.eickhoff@googlemail.com> -+ * Copyright 2014 -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License -+ * version 2 as published by the Free Software Foundation. ++ * Device Tree overlay for Witty Pi extension board by UUGear + * -+ * This program is distributed in the hope that it will be useful, but -+ * WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * General Public License for more details. + */ + -+#ifndef _TAS5713_H -+#define _TAS5713_H -+ -+ -+// TAS5713 I2C-bus register addresses -+ -+#define TAS5713_CLOCK_CTRL 0x00 -+#define TAS5713_DEVICE_ID 0x01 -+#define TAS5713_ERROR_STATUS 0x02 -+#define TAS5713_SYSTEM_CTRL1 0x03 -+#define TAS5713_SERIAL_DATA_INTERFACE 0x04 -+#define TAS5713_SYSTEM_CTRL2 0x05 -+#define TAS5713_SOFT_MUTE 0x06 -+#define TAS5713_VOL_MASTER 0x07 -+#define TAS5713_VOL_CH1 0x08 -+#define TAS5713_VOL_CH2 0x09 -+#define TAS5713_VOL_HEADPHONE 0x0A -+#define TAS5713_VOL_CONFIG 0x0E -+#define TAS5713_MODULATION_LIMIT 0x10 -+#define TAS5713_IC_DLY_CH1 0x11 -+#define TAS5713_IC_DLY_CH2 0x12 -+#define TAS5713_IC_DLY_CH3 0x13 -+#define TAS5713_IC_DLY_CH4 0x14 -+ -+#define TAS5713_START_STOP_PERIOD 0x1A -+#define TAS5713_OSC_TRIM 0x1B -+#define TAS5713_BKND_ERR 0x1C -+ -+#define TAS5713_INPUT_MUX 0x20 -+#define TAS5713_SRC_SELECT_CH4 0x21 -+#define TAS5713_PWM_MUX 0x25 -+ -+#define TAS5713_CH1_BQ0 0x29 -+#define TAS5713_CH1_BQ1 0x2A -+#define TAS5713_CH1_BQ2 0x2B -+#define TAS5713_CH1_BQ3 0x2C -+#define TAS5713_CH1_BQ4 0x2D -+#define TAS5713_CH1_BQ5 0x2E -+#define TAS5713_CH1_BQ6 0x2F -+#define TAS5713_CH1_BQ7 0x58 -+#define TAS5713_CH1_BQ8 0x59 -+ -+#define TAS5713_CH2_BQ0 0x30 -+#define TAS5713_CH2_BQ1 0x31 -+#define TAS5713_CH2_BQ2 0x32 -+#define TAS5713_CH2_BQ3 0x33 -+#define TAS5713_CH2_BQ4 0x34 -+#define TAS5713_CH2_BQ5 0x35 -+#define TAS5713_CH2_BQ6 0x36 -+#define TAS5713_CH2_BQ7 0x5C -+#define TAS5713_CH2_BQ8 0x5D -+ -+#define TAS5713_CH4_BQ0 0x5A -+#define TAS5713_CH4_BQ1 0x5B -+#define TAS5713_CH3_BQ0 0x5E -+#define TAS5713_CH3_BQ1 0x5F -+ -+#define TAS5713_DRC1_SOFTENING_FILTER_ALPHA_OMEGA 0x3B -+#define TAS5713_DRC1_ATTACK_RELEASE_RATE 0x3C -+#define TAS5713_DRC2_SOFTENING_FILTER_ALPHA_OMEGA 0x3E -+#define TAS5713_DRC2_ATTACK_RELEASE_RATE 0x3F -+#define TAS5713_DRC1_ATTACK_RELEASE_THRES 0x40 -+#define TAS5713_DRC2_ATTACK_RELEASE_THRES 0x43 -+#define TAS5713_DRC_CTRL 0x46 -+ -+#define TAS5713_BANK_SW_CTRL 0x50 -+#define TAS5713_CH1_OUTPUT_MIXER 0x51 -+#define TAS5713_CH2_OUTPUT_MIXER 0x52 -+#define TAS5713_CH1_INPUT_MIXER 0x53 -+#define TAS5713_CH2_INPUT_MIXER 0x54 -+#define TAS5713_OUTPUT_POST_SCALE 0x56 -+#define TAS5713_OUTPUT_PRESCALE 0x57 -+ -+#define TAS5713_IDF_POST_SCALE 0x62 -+ -+#define TAS5713_CH1_INLINE_MIXER 0x70 -+#define TAS5713_CH1_INLINE_DRC_EN_MIXER 0x71 -+#define TAS5713_CH1_R_CHANNEL_MIXER 0x72 -+#define TAS5713_CH1_L_CHANNEL_MIXER 0x73 -+#define TAS5713_CH2_INLINE_MIXER 0x74 -+#define TAS5713_CH2_INLINE_DRC_EN_MIXER 0x75 -+#define TAS5713_CH2_L_CHANNEL_MIXER 0x76 -+#define TAS5713_CH2_R_CHANNEL_MIXER 0x77 ++/dts-v1/; ++/plugin/; + -+#define TAS5713_UPDATE_DEV_ADDR_KEY 0xF8 -+#define TAS5713_UPDATE_DEV_ADDR_REG 0xF9 ++/ { + -+#define TAS5713_REGISTER_COUNT 0x46 -+#define TAS5713_MAX_REGISTER 0xF9 ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; + ++ fragment@0 { ++ target = <&leds>; ++ __overlay__ { ++ compatible = "gpio-leds"; ++ wittypi_led: wittypi_led { ++ label = "wittypi_led"; ++ linux,default-trigger = "default-on"; ++ gpios = <&gpio 17 0>; ++ }; ++ }; ++ }; + -+// Bitmasks for registers -+#define TAS5713_SOFT_MUTE_ALL 0x07 ++ fragment@1 { ++ target = <&i2c1>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; + ++ rtc: ds1337@68 { ++ compatible = "dallas,ds1337"; ++ reg = <0x68>; ++ wakeup-source; ++ }; ++ }; ++ }; + ++ __overrides__ { ++ led_gpio = <&wittypi_led>,"gpios:4"; ++ led_trigger = <&wittypi_led>,"linux,default-trigger"; ++ }; + -+struct tas5713_init_command { -+ const int size; -+ const char *const data; +}; + +From 548bca82b6fa7a057e5db331334a25c80810dfc7 Mon Sep 17 00:00:00 2001 +From: Phil Elwell <phil@raspberrypi.org> +Date: Fri, 13 Mar 2015 20:00:21 +0000 +Subject: [PATCH 058/112] BCM270X_DT: Add a .dtbo target, use for overlays + +Change the filenames and extensions to keep the pre-DDT style of +overlay (<name>-overlay.dtb) distinct from new ones that use a +different style of local fixups (<name>.dtbo), and to match other +platforms. + +The RPi firmware uses the DDTK trailer atom to choose which type of +overlay to use for each kernel. + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> +--- + arch/arm/boot/.gitignore | 2 +- + scripts/Makefile.dtbinst | 10 +++++++--- + scripts/Makefile.lib | 10 ++++++++++ + 3 files changed, 18 insertions(+), 4 deletions(-) + +diff --git a/arch/arm/boot/.gitignore b/arch/arm/boot/.gitignore +index 3c79f85..eaaeb17 100644 +--- a/arch/arm/boot/.gitignore ++++ b/arch/arm/boot/.gitignore +@@ -3,4 +3,4 @@ zImage + xipImage + bootpImage + uImage +-*.dtb ++*.dtb* +diff --git a/scripts/Makefile.dtbinst b/scripts/Makefile.dtbinst +index a1be75d..ad8dc1c 100644 +--- a/scripts/Makefile.dtbinst ++++ b/scripts/Makefile.dtbinst +@@ -27,6 +27,7 @@ ifeq ("$(dtbinst-root)", "$(obj)") + endif + + dtbinst-files := $(dtb-y) ++dtboinst-files := $(dtbo-y) + dtbinst-dirs := $(dts-dirs) + + # Helper targets for Installing DTBs into the boot directory +@@ -35,15 +36,18 @@ quiet_cmd_dtb_install = INSTALL $< + + install-dir = $(patsubst $(dtbinst-root)%,$(INSTALL_DTBS_PATH)%,$(obj)) + +-$(dtbinst-files) $(dtbinst-dirs): | __dtbs_install_prep ++$(dtbinst-files) $(dtboinst-files) $(dtbinst-dirs): | __dtbs_install_prep + + $(dtbinst-files): %.dtb: $(obj)/%.dtb + $(call cmd,dtb_install,$(install-dir)) + ++$(dtboinst-files): %.dtbo: $(obj)/%.dtbo ++ $(call cmd,dtb_install,$(install-dir)) + -+static const struct tas5713_init_command tas5713_init_sequence[] = { -+ -+ // Trim oscillator -+ { .size = 2, .data = "\x1B\x00" }, -+ // System control register 1 (0x03): block DC -+ { .size = 2, .data = "\x03\x80" }, -+ // Mute everything -+ { .size = 2, .data = "\x05\x40" }, -+ // Modulation limit register (0x10): 97.7% -+ { .size = 2, .data = "\x10\x02" }, -+ // Interchannel delay registers -+ // (0x11, 0x12, 0x13, and 0x14): BD mode -+ { .size = 2, .data = "\x11\xB8" }, -+ { .size = 2, .data = "\x12\x60" }, -+ { .size = 2, .data = "\x13\xA0" }, -+ { .size = 2, .data = "\x14\x48" }, -+ // PWM shutdown group register (0x19): no shutdown -+ { .size = 2, .data = "\x19\x00" }, -+ // Input multiplexer register (0x20): BD mode -+ { .size = 2, .data = "\x20\x00\x89\x77\x72" }, -+ // PWM output mux register (0x25) -+ // Channel 1 --> OUTA, channel 1 neg --> OUTB -+ // Channel 2 --> OUTC, channel 2 neg --> OUTD -+ { .size = 5, .data = "\x25\x01\x02\x13\x45" }, -+ // DRC control (0x46): DRC off -+ { .size = 5, .data = "\x46\x00\x00\x00\x00" }, -+ // BKND_ERR register (0x1C): 299ms reset period -+ { .size = 2, .data = "\x1C\x07" }, -+ // Mute channel 3 -+ { .size = 2, .data = "\x0A\xFF" }, -+ // Volume configuration register (0x0E): volume slew 512 steps -+ { .size = 2, .data = "\x0E\x90" }, -+ // Clock control register (0x00): 44/48kHz, MCLK=64xfs -+ { .size = 2, .data = "\x00\x60" }, -+ // Bank switch and eq control (0x50): no bank switching -+ { .size = 5, .data = "\x50\x00\x00\x00\x00" }, -+ // Volume registers (0x07, 0x08, 0x09, 0x0A) -+ { .size = 2, .data = "\x07\x20" }, -+ { .size = 2, .data = "\x08\x30" }, -+ { .size = 2, .data = "\x09\x30" }, -+ { .size = 2, .data = "\x0A\xFF" }, -+ // 0x72, 0x73, 0x76, 0x77 input mixer: -+ // no intermix between channels -+ { .size = 5, .data = "\x72\x00\x00\x00\x00" }, -+ { .size = 5, .data = "\x73\x00\x80\x00\x00" }, -+ { .size = 5, .data = "\x76\x00\x00\x00\x00" }, -+ { .size = 5, .data = "\x77\x00\x80\x00\x00" }, -+ // 0x70, 0x71, 0x74, 0x75 inline DRC mixer: -+ // no inline DRC inmix -+ { .size = 5, .data = "\x70\x00\x80\x00\x00" }, -+ { .size = 5, .data = "\x71\x00\x00\x00\x00" }, -+ { .size = 5, .data = "\x74\x00\x80\x00\x00" }, -+ { .size = 5, .data = "\x75\x00\x00\x00\x00" }, -+ // 0x56, 0x57 Output scale -+ { .size = 5, .data = "\x56\x00\x80\x00\x00" }, -+ { .size = 5, .data = "\x57\x00\x02\x00\x00" }, -+ // 0x3B, 0x3c -+ { .size = 9, .data = "\x3B\x00\x08\x00\x00\x00\x78\x00\x00" }, -+ { .size = 9, .data = "\x3C\x00\x00\x01\x00\xFF\xFF\xFF\x00" }, -+ { .size = 9, .data = "\x3E\x00\x08\x00\x00\x00\x78\x00\x00" }, -+ { .size = 9, .data = "\x3F\x00\x00\x01\x00\xFF\xFF\xFF\x00" }, -+ { .size = 9, .data = "\x40\x00\x00\x01\x00\xFF\xFF\xFF\x00" }, -+ { .size = 9, .data = "\x43\x00\x00\x01\x00\xFF\xFF\xFF\x00" }, -+ // 0x51, 0x52: output mixer -+ { .size = 9, .data = "\x51\x00\x80\x00\x00\x00\x00\x00\x00" }, -+ { .size = 9, .data = "\x52\x00\x80\x00\x00\x00\x00\x00\x00" }, -+ // PEQ defaults -+ { .size = 21, .data = "\x29\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x2A\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x2B\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x2C\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x2D\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x2E\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x2F\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x30\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x31\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x32\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x33\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x34\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x35\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x36\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x58\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x59\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x5C\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x5D\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x5E\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x5F\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x5A\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x5B\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+}; + $(dtbinst-dirs): + $(Q)$(MAKE) $(dtbinst)=$(obj)/$@ + +-PHONY += $(dtbinst-files) $(dtbinst-dirs) +-__dtbs_install: $(dtbinst-files) $(dtbinst-dirs) ++PHONY += $(dtbinst-files) $(dtboinst-files) $(dtbinst-dirs) ++__dtbs_install: $(dtbinst-files) $(dtboinst-files) $(dtbinst-dirs) + + .PHONY: $(PHONY) +diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib +index ddf83d0..c819ddc 100644 +--- a/scripts/Makefile.lib ++++ b/scripts/Makefile.lib +@@ -306,6 +306,16 @@ cmd_dtc = mkdir -p $(dir ${dtc-tmp}) ; \ + $(obj)/%.dtb: $(src)/%.dts FORCE + $(call if_changed_dep,dtc) + ++quiet_cmd_dtco = DTCO $@ ++cmd_dtco = $(CPP) $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $< ; \ ++ $(objtree)/scripts/dtc/dtc -@ -O dtb -o $@ -b 0 \ ++ -i $(dir $<) $(DTC_FLAGS) \ ++ -d $(depfile).dtc.tmp $(dtc-tmp) ; \ ++ cat $(depfile).pre.tmp $(depfile).dtc.tmp > $(depfile) + ++$(obj)/%.dtbo: $(src)/%-overlay.dts FORCE ++ $(call if_changed_dep,dtco) + -+#endif /* _TAS5713_H */ + dtc-tmp = $(subst $(comma),_,$(dot-target).dts.tmp) + + # Bzip2 -From 21d08f232ffc350b2930f761f3da26f9867b1d4d Mon Sep 17 00:00:00 2001 -From: Ryan Coe <bluemrp9@gmail.com> -Date: Sat, 31 Jan 2015 18:25:49 -0700 -Subject: [PATCH 073/170] Update ds1307 driver for device-tree support +From cea163c683858d514cbdeac63a351a160c1ff4e6 Mon Sep 17 00:00:00 2001 +From: Phil Elwell <phil@raspberrypi.org> +Date: Fri, 8 Apr 2016 17:43:27 +0100 +Subject: [PATCH 059/112] BCM270X_DT: Don't generate "linux,phandle" props -Signed-off-by: Ryan Coe <bluemrp9@gmail.com> ---- - drivers/rtc/rtc-ds1307.c | 8 ++++++++ - 1 file changed, 8 insertions(+) +The EPAPR standard says to use "phandle" properties to store phandles, +rather than the deprecated "linux,phandle" version. By default, dtc +generates both, but adding "-H epapr" causes it to only generate +"phandle"s, saving some space and clutter. -diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c -index aa705bb..1cb13fee 100644 ---- a/drivers/rtc/rtc-ds1307.c -+++ b/drivers/rtc/rtc-ds1307.c -@@ -1207,6 +1207,14 @@ static int ds1307_remove(struct i2c_client *client) - return 0; - } - -+#ifdef CONFIG_OF -+static const struct of_device_id ds1307_of_match[] = { -+ { .compatible = "maxim,ds1307" }, -+ { } -+}; -+MODULE_DEVICE_TABLE(of, ds1307_of_match); -+#endif -+ - static struct i2c_driver ds1307_driver = { - .driver = { - .name = "rtc-ds1307", +Signed-off-by: Phil Elwell <phil@raspberrypi.org> +--- + scripts/Makefile.lib | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) -From a2b52a3af1314e2b691d9518afb3051193758671 Mon Sep 17 00:00:00 2001 +diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib +index c819ddc..b36099a 100644 +--- a/scripts/Makefile.lib ++++ b/scripts/Makefile.lib +@@ -308,7 +308,7 @@ $(obj)/%.dtb: $(src)/%.dts FORCE + + quiet_cmd_dtco = DTCO $@ + cmd_dtco = $(CPP) $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $< ; \ +- $(objtree)/scripts/dtc/dtc -@ -O dtb -o $@ -b 0 \ ++ $(objtree)/scripts/dtc/dtc -@ -H epapr -O dtb -o $@ -b 0 \ + -i $(dir $<) $(DTC_FLAGS) \ + -d $(depfile).dtc.tmp $(dtc-tmp) ; \ + cat $(depfile).pre.tmp $(depfile).dtc.tmp > $(depfile) + +From 273e251cd1f6808847b4f04d87a04048f549fb9d Mon Sep 17 00:00:00 2001 From: Phil Elwell <phil@raspberrypi.org> Date: Fri, 6 Feb 2015 13:50:57 +0000 -Subject: [PATCH 074/170] BCM270x_DT: Add pwr_led, and the required "input" +Subject: [PATCH 060/112] BCM270x_DT: Add pwr_led, and the required "input" trigger The "input" trigger makes the associated GPIO an input. This is to support @@ -117216,35 +121188,28 @@ See: https://github.com/raspberrypi/linux/issues/1064 create mode 100644 drivers/leds/trigger/ledtrig-input.c diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c -index 5db4515..685a8b5 100644 +index 61143f5..e98df59 100644 --- a/drivers/leds/leds-gpio.c +++ b/drivers/leds/leds-gpio.c -@@ -42,6 +42,13 @@ static void gpio_led_work(struct work_struct *work) - led_dat->platform_gpio_blink_set(led_dat->gpiod, - led_dat->new_level, NULL, NULL); +@@ -46,8 +46,15 @@ static void gpio_led_set(struct led_classdev *led_cdev, + led_dat->platform_gpio_blink_set(led_dat->gpiod, level, + NULL, NULL); led_dat->blinking = 0; + } else if (led_dat->cdev.flags & SET_GPIO_INPUT) { + gpiod_direction_input(led_dat->gpiod); + led_dat->cdev.flags &= ~SET_GPIO_INPUT; -+ } -+ else if (led_dat->cdev.flags & SET_GPIO_OUTPUT) { -+ gpiod_direction_output(led_dat->gpiod, led_dat->new_level); ++ } else if (led_dat->cdev.flags & SET_GPIO_OUTPUT) { ++ gpiod_direction_output(led_dat->gpiod, level); + led_dat->cdev.flags &= ~SET_GPIO_OUTPUT; - } else - gpiod_set_value_cansleep(led_dat->gpiod, led_dat->new_level); - } -@@ -62,7 +69,8 @@ static void gpio_led_set(struct led_classdev *led_cdev, - * seem to have a reliable way to know if we're already in one; so - * let's just assume the worst. - */ -- if (led_dat->can_sleep) { -+ if (led_dat->can_sleep || -+ (led_dat->cdev.flags & (SET_GPIO_INPUT | SET_GPIO_OUTPUT) )) { - led_dat->new_level = level; - schedule_work(&led_dat->work); } else { -@@ -75,6 +83,13 @@ static void gpio_led_set(struct led_classdev *led_cdev, - } +- if (led_dat->can_sleep) ++ if (led_dat->can_sleep || ++ (led_dat->cdev.flags & (SET_GPIO_INPUT | SET_GPIO_OUTPUT) )) + gpiod_set_value_cansleep(led_dat->gpiod, level); + else + gpiod_set_value(led_dat->gpiod, level); +@@ -61,6 +68,13 @@ static int gpio_led_set_blocking(struct led_classdev *led_cdev, + return 0; } +static enum led_brightness gpio_led_get(struct led_classdev *led_cdev) @@ -117257,10 +121222,11 @@ index 5db4515..685a8b5 100644 static int gpio_blink_set(struct led_classdev *led_cdev, unsigned long *delay_on, unsigned long *delay_off) { -@@ -131,6 +146,7 @@ static int create_gpio_led(const struct gpio_led *template, +@@ -120,6 +134,8 @@ static int create_gpio_led(const struct gpio_led *template, + led_dat->platform_gpio_blink_set = blink_set; led_dat->cdev.blink_set = gpio_blink_set; } - led_dat->cdev.brightness_set = gpio_led_set; ++ led_dat->cdev.brightness_set = gpio_led_set; + led_dat->cdev.brightness_get = gpio_led_get; if (template->default_state == LEDS_GPIO_DEFSTATE_KEEP) state = !!gpiod_get_value_cansleep(led_dat->gpiod); @@ -117292,7 +121258,7 @@ index 1abf48d..c03afdc 100644 +obj-$(CONFIG_LEDS_TRIGGER_INPUT) += ledtrig-input.o diff --git a/drivers/leds/trigger/ledtrig-input.c b/drivers/leds/trigger/ledtrig-input.c new file mode 100644 -index 0000000..07d1219 +index 0000000..27f8ebe --- /dev/null +++ b/drivers/leds/trigger/ledtrig-input.c @@ -0,0 +1,54 @@ @@ -117319,13 +121285,13 @@ index 0000000..07d1219 +static void input_trig_activate(struct led_classdev *led_cdev) +{ + led_cdev->flags |= SET_GPIO_INPUT; -+ led_set_brightness_async(led_cdev, 0); ++ led_set_brightness(led_cdev, 0); +} + +static void input_trig_deactivate(struct led_classdev *led_cdev) +{ + led_cdev->flags |= SET_GPIO_OUTPUT; -+ led_set_brightness_async(led_cdev, 0); ++ led_set_brightness(led_cdev, 0); +} + +static struct led_trigger input_led_trigger = { @@ -117351,32005 +121317,12958 @@ index 0000000..07d1219 +MODULE_DESCRIPTION("Set LED GPIO to Input \"trigger\""); +MODULE_LICENSE("GPL"); diff --git a/include/linux/leds.h b/include/linux/leds.h -index fa359c7..4b25a1a 100644 +index f203a8f..555cf15 100644 --- a/include/linux/leds.h +++ b/include/linux/leds.h -@@ -48,6 +48,9 @@ struct led_classdev { - #define SET_BRIGHTNESS_ASYNC (1 << 21) - #define SET_BRIGHTNESS_SYNC (1 << 22) +@@ -50,6 +50,9 @@ struct led_classdev { + #define LED_SYSFS_DISABLE (1 << 22) #define LED_DEV_CAP_FLASH (1 << 23) + #define LED_HW_PLUGGABLE (1 << 24) + /* Additions for Raspberry Pi PWR LED */ +#define SET_GPIO_INPUT (1 << 30) +#define SET_GPIO_OUTPUT (1 << 31) - /* Set LED brightness level */ - /* Must not sleep, use a workqueue if needed */ + /* Set LED brightness level + * Must not sleep. Use brightness_set_blocking for drivers -From 12ad9b7c670220b1b8b80ebf507651d106cb28c0 Mon Sep 17 00:00:00 2001 -From: Phil Elwell <phil@raspberrypi.org> -Date: Fri, 27 Feb 2015 15:10:24 +0000 -Subject: [PATCH 075/170] enc28j60: Add device tree compatible string and an - overlay +From ea3dfa01346c7b37d14b3b01b82d05fff57903bd Mon Sep 17 00:00:00 2001 +From: Siarhei Siamashka <siarhei.siamashka@gmail.com> +Date: Mon, 17 Jun 2013 13:32:11 +0300 +Subject: [PATCH 061/112] fbdev: add FBIOCOPYAREA ioctl + +Based on the patch authored by Ali Gholami Rudi at + https://lkml.org/lkml/2009/7/13/153 + +Provide an ioctl for userspace applications, but only if this operation +is hardware accelerated (otherwide it does not make any sense). +Signed-off-by: Siarhei Siamashka <siarhei.siamashka@gmail.com> --- - drivers/net/ethernet/microchip/enc28j60.c | 7 +++++++ - 1 file changed, 7 insertions(+) + drivers/video/fbdev/core/fbmem.c | 30 ++++++++++++++++++++++++++++++ + include/uapi/linux/fb.h | 5 +++++ + 2 files changed, 35 insertions(+) -diff --git a/drivers/net/ethernet/microchip/enc28j60.c b/drivers/net/ethernet/microchip/enc28j60.c -index 86ea17e..a1b20c1 100644 ---- a/drivers/net/ethernet/microchip/enc28j60.c -+++ b/drivers/net/ethernet/microchip/enc28j60.c -@@ -1630,9 +1630,16 @@ static int enc28j60_remove(struct spi_device *spi) - return 0; +diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c +index 4e73b6f..d3a8cc3 100644 +--- a/drivers/video/fbdev/core/fbmem.c ++++ b/drivers/video/fbdev/core/fbmem.c +@@ -1084,6 +1084,25 @@ fb_blank(struct fb_info *info, int blank) } + EXPORT_SYMBOL(fb_blank); -+static const struct of_device_id enc28j60_of_match[] = { -+ { .compatible = "microchip,enc28j60", }, -+ { /* sentinel */ } -+}; -+MODULE_DEVICE_TABLE(of, enc28j60_of_match); ++static int fb_copyarea_user(struct fb_info *info, ++ struct fb_copyarea *copy) ++{ ++ int ret = 0; ++ if (!lock_fb_info(info)) ++ return -ENODEV; ++ if (copy->dx + copy->width > info->var.xres || ++ copy->sx + copy->width > info->var.xres || ++ copy->dy + copy->height > info->var.yres || ++ copy->sy + copy->height > info->var.yres) { ++ ret = -EINVAL; ++ goto out; ++ } ++ info->fbops->fb_copyarea(info, copy); ++out: ++ unlock_fb_info(info); ++ return ret; ++} + - static struct spi_driver enc28j60_driver = { - .driver = { - .name = DRV_NAME, -+ .of_match_table = enc28j60_of_match, - }, - .probe = enc28j60_probe, - .remove = enc28j60_remove, + static long do_fb_ioctl(struct fb_info *info, unsigned int cmd, + unsigned long arg) + { +@@ -1094,6 +1113,7 @@ static long do_fb_ioctl(struct fb_info *info, unsigned int cmd, + struct fb_cmap cmap_from; + struct fb_cmap_user cmap; + struct fb_event event; ++ struct fb_copyarea copy; + void __user *argp = (void __user *)arg; + long ret = 0; + +@@ -1211,6 +1231,15 @@ static long do_fb_ioctl(struct fb_info *info, unsigned int cmd, + unlock_fb_info(info); + console_unlock(); + break; ++ case FBIOCOPYAREA: ++ if (info->flags & FBINFO_HWACCEL_COPYAREA) { ++ /* only provide this ioctl if it is accelerated */ ++ if (copy_from_user(&copy, argp, sizeof(copy))) ++ return -EFAULT; ++ ret = fb_copyarea_user(info, &copy); ++ break; ++ } ++ /* fall through */ + default: + if (!lock_fb_info(info)) + return -ENODEV; +@@ -1365,6 +1394,7 @@ static long fb_compat_ioctl(struct file *file, unsigned int cmd, + case FBIOPAN_DISPLAY: + case FBIOGET_CON2FBMAP: + case FBIOPUT_CON2FBMAP: ++ case FBIOCOPYAREA: + arg = (unsigned long) compat_ptr(arg); + case FBIOBLANK: + ret = do_fb_ioctl(info, cmd, arg); +diff --git a/include/uapi/linux/fb.h b/include/uapi/linux/fb.h +index fb795c3..fa72af0 100644 +--- a/include/uapi/linux/fb.h ++++ b/include/uapi/linux/fb.h +@@ -34,6 +34,11 @@ + #define FBIOPUT_MODEINFO 0x4617 + #define FBIOGET_DISPINFO 0x4618 + #define FBIO_WAITFORVSYNC _IOW('F', 0x20, __u32) ++/* ++ * HACK: use 'z' in order not to clash with any other ioctl numbers which might ++ * be concurrently added to the mainline kernel ++ */ ++#define FBIOCOPYAREA _IOW('z', 0x21, struct fb_copyarea) + + #define FB_TYPE_PACKED_PIXELS 0 /* Packed Pixels */ + #define FB_TYPE_PLANES 1 /* Non interleaved planes */ -From 660d2fba0483aafc4a1ce678016620c0871bb759 Mon Sep 17 00:00:00 2001 -From: Waldemar Brodkorb <wbrodkorb@conet.de> -Date: Wed, 25 Mar 2015 09:26:17 +0100 -Subject: [PATCH 076/170] Add driver for rpi-proto +From 3de9d9af98b49cd140532eee17196742d1d875c7 Mon Sep 17 00:00:00 2001 +From: Harm Hanemaaijer <fgenfb@yahoo.com> +Date: Thu, 20 Jun 2013 20:21:39 +0200 +Subject: [PATCH 062/112] Speed up console framebuffer imageblit function -Forward port of 3.10.x driver from https://github.com/koalo -We are using a custom board and would like to use rpi 3.18.x -kernel. Patch works fine for our embedded system. +Especially on platforms with a slower CPU but a relatively high +framebuffer fill bandwidth, like current ARM devices, the existing +console monochrome imageblit function used to draw console text is +suboptimal for common pixel depths such as 16bpp and 32bpp. The existing +code is quite general and can deal with several pixel depths. By creating +special case functions for 16bpp and 32bpp, by far the most common pixel +formats used on modern systems, a significant speed-up is attained +which can be readily felt on ARM-based devices like the Raspberry Pi +and the Allwinner platform, but should help any platform using the +fb layer. -URL to the audio chip: -http://www.mikroe.com/add-on-boards/audio-voice/audio-codec-proto/ +The special case functions allow constant folding, eliminating a number +of instructions including divide operations, and allow the use of an +unrolled loop, eliminating instructions with a variable shift size, +reducing source memory access instructions, and eliminating excessive +branching. These unrolled loops also allow much better code optimization +by the C compiler. The code that selects which optimized variant is used +is also simplified, eliminating integer divide instructions. -Playback tested with devicetree enabled. +The speed-up, measured by timing 'cat file.txt' in the console, varies +between 40% and 70%, when testing on the Raspberry Pi and Allwinner +ARM-based platforms, depending on font size and the pixel depth, with +the greater benefit for 32bpp. -Signed-off-by: Waldemar Brodkorb <wbrodkorb@conet.de> +Signed-off-by: Harm Hanemaaijer <fgenfb@yahoo.com> --- - sound/soc/bcm/Kconfig | 7 +++ - sound/soc/bcm/Makefile | 2 + - sound/soc/bcm/rpi-proto.c | 153 ++++++++++++++++++++++++++++++++++++++++++++++ - 3 files changed, 162 insertions(+) - create mode 100644 sound/soc/bcm/rpi-proto.c + drivers/video/fbdev/core/cfbimgblt.c | 152 +++++++++++++++++++++++++++++++++-- + 1 file changed, 147 insertions(+), 5 deletions(-) -diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig -index 7677c89..8669a9a 100644 ---- a/sound/soc/bcm/Kconfig -+++ b/sound/soc/bcm/Kconfig -@@ -43,6 +43,13 @@ config SND_BCM2708_SOC_RPI_DAC - help - Say Y or M if you want to add support for RPi-DAC. - -+config SND_BCM2708_SOC_RPI_PROTO -+ tristate "Support for Rpi-PROTO" -+ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S -+ select SND_SOC_WM8731 -+ help -+ Say Y or M if you want to add support for Audio Codec Board PROTO (WM8731). -+ - config SND_BCM2708_SOC_IQAUDIO_DAC - tristate "Support for IQaudIO-DAC" - depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S -diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile -index 30db495..4f5ab1f 100644 ---- a/sound/soc/bcm/Makefile -+++ b/sound/soc/bcm/Makefile -@@ -9,6 +9,7 @@ snd-soc-hifiberry-dacplus-objs := hifiberry_dacplus.o - snd-soc-hifiberry-digi-objs := hifiberry_digi.o - snd-soc-hifiberry-amp-objs := hifiberry_amp.o - snd-soc-rpi-dac-objs := rpi-dac.o -+snd-soc-rpi-proto-objs := rpi-proto.o - snd-soc-iqaudio-dac-objs := iqaudio-dac.o - - obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o -@@ -16,4 +17,5 @@ obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS) += snd-soc-hifiberry-dacplus.o - obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI) += snd-soc-hifiberry-digi.o - obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_AMP) += snd-soc-hifiberry-amp.o - obj-$(CONFIG_SND_BCM2708_SOC_RPI_DAC) += snd-soc-rpi-dac.o -+obj-$(CONFIG_SND_BCM2708_SOC_RPI_PROTO) += snd-soc-rpi-proto.o - obj-$(CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC) += snd-soc-iqaudio-dac.o -diff --git a/sound/soc/bcm/rpi-proto.c b/sound/soc/bcm/rpi-proto.c -new file mode 100644 -index 0000000..c6e45a0 ---- /dev/null -+++ b/sound/soc/bcm/rpi-proto.c -@@ -0,0 +1,153 @@ +diff --git a/drivers/video/fbdev/core/cfbimgblt.c b/drivers/video/fbdev/core/cfbimgblt.c +index a2bb276..436494f 100644 +--- a/drivers/video/fbdev/core/cfbimgblt.c ++++ b/drivers/video/fbdev/core/cfbimgblt.c +@@ -28,6 +28,11 @@ + * + * Also need to add code to deal with cards endians that are different than + * the native cpu endians. I also need to deal with MSB position in the word. ++ * Modified by Harm Hanemaaijer (fgenfb@yahoo.com) 2013: ++ * - Provide optimized versions of fast_imageblit for 16 and 32bpp that are ++ * significantly faster than the previous implementation. ++ * - Simplify the fast/slow_imageblit selection code, avoiding integer ++ * divides. + */ + #include <linux/module.h> + #include <linux/string.h> +@@ -262,6 +267,133 @@ static inline void fast_imageblit(const struct fb_image *image, struct fb_info * + } + } + +/* -+ * ASoC driver for PROTO AudioCODEC (with a WM8731) -+ * connected to a Raspberry Pi -+ * -+ * Author: Florian Meier, <koalo@koalo.de> -+ * Copyright 2013 -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 as -+ * published by the Free Software Foundation. ++ * Optimized fast_imageblit for bpp == 16. ppw = 2, bit_mask = 3 folded ++ * into the code, main loop unrolled. + */ + -+#include <linux/module.h> -+#include <linux/platform_device.h> -+ -+#include <sound/core.h> -+#include <sound/pcm.h> -+#include <sound/soc.h> -+#include <sound/jack.h> -+ -+#include "../codecs/wm8731.h" -+ -+static const unsigned int wm8731_rates_12288000[] = { -+ 8000, 32000, 48000, 96000, -+}; ++static inline void fast_imageblit16(const struct fb_image *image, ++ struct fb_info *p, u8 __iomem * dst1, ++ u32 fgcolor, u32 bgcolor) ++{ ++ u32 fgx = fgcolor, bgx = bgcolor; ++ u32 spitch = (image->width + 7) / 8; ++ u32 end_mask, eorx; ++ const char *s = image->data, *src; ++ u32 __iomem *dst; ++ const u32 *tab = NULL; ++ int i, j, k; + -+static struct snd_pcm_hw_constraint_list wm8731_constraints_12288000 = { -+ .list = wm8731_rates_12288000, -+ .count = ARRAY_SIZE(wm8731_rates_12288000), -+}; ++ tab = fb_be_math(p) ? cfb_tab16_be : cfb_tab16_le; + -+static int snd_rpi_proto_startup(struct snd_pcm_substream *substream) -+{ -+ /* Setup constraints, because there is a 12.288 MHz XTAL on the board */ -+ snd_pcm_hw_constraint_list(substream->runtime, 0, -+ SNDRV_PCM_HW_PARAM_RATE, -+ &wm8731_constraints_12288000); -+ return 0; -+} ++ fgx <<= 16; ++ bgx <<= 16; ++ fgx |= fgcolor; ++ bgx |= bgcolor; + -+static int snd_rpi_proto_hw_params(struct snd_pcm_substream *substream, -+ struct snd_pcm_hw_params *params) -+{ -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_codec *codec = rtd->codec; -+ struct snd_soc_dai *codec_dai = rtd->codec_dai; -+ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; -+ int sysclk = 12288000; /* This is fixed on this board */ ++ eorx = fgx ^ bgx; ++ k = image->width / 2; + -+ /* Set proto bclk */ -+ int ret = snd_soc_dai_set_bclk_ratio(cpu_dai,32*2); -+ if (ret < 0){ -+ dev_err(codec->dev, -+ "Failed to set BCLK ratio %d\n", ret); -+ return ret; -+ } ++ for (i = image->height; i--;) { ++ dst = (u32 __iomem *) dst1; ++ src = s; + -+ /* Set proto sysclk */ -+ ret = snd_soc_dai_set_sysclk(codec_dai, WM8731_SYSCLK_XTAL, -+ sysclk, SND_SOC_CLOCK_IN); -+ if (ret < 0) { -+ dev_err(codec->dev, -+ "Failed to set WM8731 SYSCLK: %d\n", ret); -+ return ret; ++ j = k; ++ while (j >= 4) { ++ u8 bits = *src; ++ end_mask = tab[(bits >> 6) & 3]; ++ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); ++ end_mask = tab[(bits >> 4) & 3]; ++ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); ++ end_mask = tab[(bits >> 2) & 3]; ++ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); ++ end_mask = tab[bits & 3]; ++ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); ++ src++; ++ j -= 4; ++ } ++ if (j != 0) { ++ u8 bits = *src; ++ end_mask = tab[(bits >> 6) & 3]; ++ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); ++ if (j >= 2) { ++ end_mask = tab[(bits >> 4) & 3]; ++ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); ++ if (j == 3) { ++ end_mask = tab[(bits >> 2) & 3]; ++ FB_WRITEL((end_mask & eorx) ^ bgx, dst); ++ } ++ } ++ } ++ dst1 += p->fix.line_length; ++ s += spitch; + } -+ -+ return 0; +} + -+/* machine stream operations */ -+static struct snd_soc_ops snd_rpi_proto_ops = { -+ .startup = snd_rpi_proto_startup, -+ .hw_params = snd_rpi_proto_hw_params, -+}; ++/* ++ * Optimized fast_imageblit for bpp == 32. ppw = 1, bit_mask = 1 folded ++ * into the code, main loop unrolled. ++ */ + -+static struct snd_soc_dai_link snd_rpi_proto_dai[] = { ++static inline void fast_imageblit32(const struct fb_image *image, ++ struct fb_info *p, u8 __iomem * dst1, ++ u32 fgcolor, u32 bgcolor) +{ -+ .name = "WM8731", -+ .stream_name = "WM8731 HiFi", -+ .cpu_dai_name = "bcm2708-i2s.0", -+ .codec_dai_name = "wm8731-hifi", -+ .platform_name = "bcm2708-i2s.0", -+ .codec_name = "wm8731.1-001a", -+ .dai_fmt = SND_SOC_DAIFMT_I2S -+ | SND_SOC_DAIFMT_NB_NF -+ | SND_SOC_DAIFMT_CBM_CFM, -+ .ops = &snd_rpi_proto_ops, -+}, -+}; -+ -+/* audio machine driver */ -+static struct snd_soc_card snd_rpi_proto = { -+ .name = "snd_rpi_proto", -+ .dai_link = snd_rpi_proto_dai, -+ .num_links = ARRAY_SIZE(snd_rpi_proto_dai), -+}; ++ u32 fgx = fgcolor, bgx = bgcolor; ++ u32 spitch = (image->width + 7) / 8; ++ u32 end_mask, eorx; ++ const char *s = image->data, *src; ++ u32 __iomem *dst; ++ const u32 *tab = NULL; ++ int i, j, k; + -+static int snd_rpi_proto_probe(struct platform_device *pdev) -+{ -+ int ret = 0; ++ tab = cfb_tab32; + -+ snd_rpi_proto.dev = &pdev->dev; ++ eorx = fgx ^ bgx; ++ k = image->width; + -+ if (pdev->dev.of_node) { -+ struct device_node *i2s_node; -+ struct snd_soc_dai_link *dai = &snd_rpi_proto_dai[0]; -+ i2s_node = of_parse_phandle(pdev->dev.of_node, -+ "i2s-controller", 0); ++ for (i = image->height; i--;) { ++ dst = (u32 __iomem *) dst1; ++ src = s; + -+ if (i2s_node) { -+ dai->cpu_dai_name = NULL; -+ dai->cpu_of_node = i2s_node; -+ dai->platform_name = NULL; -+ dai->platform_of_node = i2s_node; ++ j = k; ++ while (j >= 8) { ++ u8 bits = *src; ++ end_mask = tab[(bits >> 7) & 1]; ++ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); ++ end_mask = tab[(bits >> 6) & 1]; ++ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); ++ end_mask = tab[(bits >> 5) & 1]; ++ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); ++ end_mask = tab[(bits >> 4) & 1]; ++ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); ++ end_mask = tab[(bits >> 3) & 1]; ++ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); ++ end_mask = tab[(bits >> 2) & 1]; ++ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); ++ end_mask = tab[(bits >> 1) & 1]; ++ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); ++ end_mask = tab[bits & 1]; ++ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); ++ src++; ++ j -= 8; + } ++ if (j != 0) { ++ u32 bits = (u32) * src; ++ while (j > 1) { ++ end_mask = tab[(bits >> 7) & 1]; ++ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); ++ bits <<= 1; ++ j--; ++ } ++ end_mask = tab[(bits >> 7) & 1]; ++ FB_WRITEL((end_mask & eorx) ^ bgx, dst); ++ } ++ dst1 += p->fix.line_length; ++ s += spitch; + } -+ -+ ret = snd_soc_register_card(&snd_rpi_proto); -+ if (ret) { -+ dev_err(&pdev->dev, -+ "snd_soc_register_card() failed: %d\n", ret); -+ } -+ -+ return ret; -+} -+ -+ -+static int snd_rpi_proto_remove(struct platform_device *pdev) -+{ -+ return snd_soc_unregister_card(&snd_rpi_proto); +} + -+static const struct of_device_id snd_rpi_proto_of_match[] = { -+ { .compatible = "rpi,rpi-proto", }, -+ {}, -+}; -+MODULE_DEVICE_TABLE(of, snd_rpi_proto_of_match); -+ -+static struct platform_driver snd_rpi_proto_driver = { -+ .driver = { -+ .name = "snd-rpi-proto", -+ .owner = THIS_MODULE, -+ .of_match_table = snd_rpi_proto_of_match, -+ }, -+ .probe = snd_rpi_proto_probe, -+ .remove = snd_rpi_proto_remove, -+}; -+ -+module_platform_driver(snd_rpi_proto_driver); -+ -+MODULE_AUTHOR("Florian Meier"); -+MODULE_DESCRIPTION("ASoC Driver for Raspberry Pi connected to PROTO board (WM8731)"); -+MODULE_LICENSE("GPL"); + void cfb_imageblit(struct fb_info *p, const struct fb_image *image) + { + u32 fgcolor, bgcolor, start_index, bitstart, pitch_index = 0; +@@ -294,11 +426,21 @@ void cfb_imageblit(struct fb_info *p, const struct fb_image *image) + bgcolor = image->bg_color; + } + +- if (32 % bpp == 0 && !start_index && !pitch_index && +- ((width & (32/bpp-1)) == 0) && +- bpp >= 8 && bpp <= 32) +- fast_imageblit(image, p, dst1, fgcolor, bgcolor); +- else ++ if (!start_index && !pitch_index) { ++ if (bpp == 32) ++ fast_imageblit32(image, p, dst1, fgcolor, ++ bgcolor); ++ else if (bpp == 16 && (width & 1) == 0) ++ fast_imageblit16(image, p, dst1, fgcolor, ++ bgcolor); ++ else if (bpp == 8 && (width & 3) == 0) ++ fast_imageblit(image, p, dst1, fgcolor, ++ bgcolor); ++ else ++ slow_imageblit(image, p, dst1, fgcolor, ++ bgcolor, ++ start_index, pitch_index); ++ } else + slow_imageblit(image, p, dst1, fgcolor, bgcolor, + start_index, pitch_index); + } else -From e2af169e60b4ebd710e733996d57ad86264bae27 Mon Sep 17 00:00:00 2001 +From fe2e696dfa4ad9e5a5f6c772efc6be7e8aba5a75 Mon Sep 17 00:00:00 2001 From: popcornmix <popcornmix@gmail.com> -Date: Mon, 13 Apr 2015 17:16:29 +0100 -Subject: [PATCH 077/170] config: Add default configs +Date: Wed, 8 May 2013 11:46:50 +0100 +Subject: [PATCH 063/112] enabling the realtime clock 1-wire chip DS1307 and + 1-wire on GPIO4 (as a module) + +1-wire: Add support for configuring pin for w1-gpio kernel module +See: https://github.com/raspberrypi/linux/pull/457 + +Add bitbanging pullups, use them for w1-gpio + +Allows parasite power to work, uses module option pullup=1 + +bcm2708: Ensure 1-wire pullup is disabled by default, and expose as module parameter + +Signed-off-by: Alex J Lennon <ajlennon@dynamicdevices.co.uk> +w1-gpio: Add gpiopin module parameter and correctly free up gpio pull-up pin, if set + +Signed-off-by: Alex J Lennon <ajlennon@dynamicdevices.co.uk> + +w1-gpio: Sort out the pullup/parasitic power tangle --- - arch/arm/configs/bcm2709_defconfig | 1254 +++++++++++++++++++++++++++++++++++ - arch/arm/configs/bcmrpi_defconfig | 1265 ++++++++++++++++++++++++++++++++++++ - 2 files changed, 2519 insertions(+) - create mode 100644 arch/arm/configs/bcm2709_defconfig - create mode 100644 arch/arm/configs/bcmrpi_defconfig + drivers/w1/masters/w1-gpio.c | 69 ++++++++++++++++++++++++++++++++++++++++---- + drivers/w1/w1.h | 6 ++++ + drivers/w1/w1_int.c | 14 +++++++++ + drivers/w1/w1_io.c | 18 ++++++++++-- + include/linux/w1-gpio.h | 1 + + 5 files changed, 99 insertions(+), 9 deletions(-) -diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig -new file mode 100644 -index 0000000..16062bf ---- /dev/null -+++ b/arch/arm/configs/bcm2709_defconfig -@@ -0,0 +1,1254 @@ -+# CONFIG_ARM_PATCH_PHYS_VIRT is not set -+CONFIG_PHYS_OFFSET=0 -+CONFIG_LOCALVERSION="-v7" -+# CONFIG_LOCALVERSION_AUTO is not set -+CONFIG_SYSVIPC=y -+CONFIG_POSIX_MQUEUE=y -+CONFIG_FHANDLE=y -+CONFIG_NO_HZ=y -+CONFIG_HIGH_RES_TIMERS=y -+CONFIG_BSD_PROCESS_ACCT=y -+CONFIG_BSD_PROCESS_ACCT_V3=y -+CONFIG_TASKSTATS=y -+CONFIG_TASK_DELAY_ACCT=y -+CONFIG_TASK_XACCT=y -+CONFIG_TASK_IO_ACCOUNTING=y -+CONFIG_IKCONFIG=m -+CONFIG_IKCONFIG_PROC=y -+CONFIG_CGROUP_FREEZER=y -+CONFIG_CGROUP_DEVICE=y -+CONFIG_CPUSETS=y -+CONFIG_CGROUP_CPUACCT=y -+CONFIG_MEMCG=y -+CONFIG_BLK_CGROUP=y -+CONFIG_NAMESPACES=y -+CONFIG_SCHED_AUTOGROUP=y -+CONFIG_BLK_DEV_INITRD=y -+CONFIG_EMBEDDED=y -+# CONFIG_COMPAT_BRK is not set -+CONFIG_PROFILING=y -+CONFIG_OPROFILE=m -+CONFIG_KPROBES=y -+CONFIG_JUMP_LABEL=y -+CONFIG_MODULES=y -+CONFIG_MODULE_UNLOAD=y -+CONFIG_MODVERSIONS=y -+CONFIG_MODULE_SRCVERSION_ALL=y -+CONFIG_BLK_DEV_THROTTLING=y -+CONFIG_PARTITION_ADVANCED=y -+CONFIG_MAC_PARTITION=y -+CONFIG_CFQ_GROUP_IOSCHED=y -+CONFIG_ARCH_BCM2709=y -+# CONFIG_CACHE_L2X0 is not set -+CONFIG_SMP=y -+CONFIG_HAVE_ARM_ARCH_TIMER=y -+CONFIG_VMSPLIT_2G=y -+CONFIG_PREEMPT_VOLUNTARY=y -+CONFIG_AEABI=y -+CONFIG_OABI_COMPAT=y -+# CONFIG_CPU_SW_DOMAIN_PAN is not set -+CONFIG_CLEANCACHE=y -+CONFIG_FRONTSWAP=y -+CONFIG_CMA=y -+CONFIG_ZSMALLOC=m -+CONFIG_PGTABLE_MAPPING=y -+CONFIG_UACCESS_WITH_MEMCPY=y -+CONFIG_SECCOMP=y -+# CONFIG_ATAGS is not set -+CONFIG_ZBOOT_ROM_TEXT=0x0 -+CONFIG_ZBOOT_ROM_BSS=0x0 -+CONFIG_CMDLINE="console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait" -+CONFIG_CPU_FREQ=y -+CONFIG_CPU_FREQ_STAT=m -+CONFIG_CPU_FREQ_STAT_DETAILS=y -+CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE=y -+CONFIG_CPU_FREQ_GOV_PERFORMANCE=y -+CONFIG_CPU_FREQ_GOV_USERSPACE=y -+CONFIG_CPU_FREQ_GOV_ONDEMAND=y -+CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y -+CONFIG_VFP=y -+CONFIG_NEON=y -+CONFIG_KERNEL_MODE_NEON=y -+CONFIG_BINFMT_MISC=m -+# CONFIG_SUSPEND is not set -+CONFIG_NET=y -+CONFIG_PACKET=y -+CONFIG_UNIX=y -+CONFIG_XFRM_USER=y -+CONFIG_NET_KEY=m -+CONFIG_INET=y -+CONFIG_IP_MULTICAST=y -+CONFIG_IP_ADVANCED_ROUTER=y -+CONFIG_IP_MULTIPLE_TABLES=y -+CONFIG_IP_ROUTE_MULTIPATH=y -+CONFIG_IP_ROUTE_VERBOSE=y -+CONFIG_IP_PNP=y -+CONFIG_IP_PNP_DHCP=y -+CONFIG_IP_PNP_RARP=y -+CONFIG_NET_IPIP=m -+CONFIG_NET_IPGRE_DEMUX=m -+CONFIG_NET_IPGRE=m -+CONFIG_IP_MROUTE=y -+CONFIG_IP_MROUTE_MULTIPLE_TABLES=y -+CONFIG_IP_PIMSM_V1=y -+CONFIG_IP_PIMSM_V2=y -+CONFIG_SYN_COOKIES=y -+CONFIG_INET_AH=m -+CONFIG_INET_ESP=m -+CONFIG_INET_IPCOMP=m -+CONFIG_INET_XFRM_MODE_TRANSPORT=m -+CONFIG_INET_XFRM_MODE_TUNNEL=m -+CONFIG_INET_XFRM_MODE_BEET=m -+CONFIG_INET_LRO=m -+CONFIG_INET_DIAG=m -+CONFIG_INET6_AH=m -+CONFIG_INET6_ESP=m -+CONFIG_INET6_IPCOMP=m -+CONFIG_IPV6_TUNNEL=m -+CONFIG_IPV6_MULTIPLE_TABLES=y -+CONFIG_IPV6_MROUTE=y -+CONFIG_IPV6_MROUTE_MULTIPLE_TABLES=y -+CONFIG_IPV6_PIMSM_V2=y -+CONFIG_NETFILTER=y -+CONFIG_NF_CONNTRACK=m -+CONFIG_NF_CONNTRACK_ZONES=y -+CONFIG_NF_CONNTRACK_EVENTS=y -+CONFIG_NF_CONNTRACK_TIMESTAMP=y -+CONFIG_NF_CT_PROTO_DCCP=m -+CONFIG_NF_CT_PROTO_UDPLITE=m -+CONFIG_NF_CONNTRACK_AMANDA=m -+CONFIG_NF_CONNTRACK_FTP=m -+CONFIG_NF_CONNTRACK_H323=m -+CONFIG_NF_CONNTRACK_IRC=m -+CONFIG_NF_CONNTRACK_NETBIOS_NS=m -+CONFIG_NF_CONNTRACK_SNMP=m -+CONFIG_NF_CONNTRACK_PPTP=m -+CONFIG_NF_CONNTRACK_SANE=m -+CONFIG_NF_CONNTRACK_SIP=m -+CONFIG_NF_CONNTRACK_TFTP=m -+CONFIG_NF_CT_NETLINK=m -+CONFIG_NETFILTER_XT_SET=m -+CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m -+CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m -+CONFIG_NETFILTER_XT_TARGET_CONNMARK=m -+CONFIG_NETFILTER_XT_TARGET_DSCP=m -+CONFIG_NETFILTER_XT_TARGET_HMARK=m -+CONFIG_NETFILTER_XT_TARGET_IDLETIMER=m -+CONFIG_NETFILTER_XT_TARGET_LED=m -+CONFIG_NETFILTER_XT_TARGET_LOG=m -+CONFIG_NETFILTER_XT_TARGET_MARK=m -+CONFIG_NETFILTER_XT_TARGET_NFLOG=m -+CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m -+CONFIG_NETFILTER_XT_TARGET_NOTRACK=m -+CONFIG_NETFILTER_XT_TARGET_TEE=m -+CONFIG_NETFILTER_XT_TARGET_TPROXY=m -+CONFIG_NETFILTER_XT_TARGET_TRACE=m -+CONFIG_NETFILTER_XT_TARGET_TCPMSS=m -+CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP=m -+CONFIG_NETFILTER_XT_MATCH_ADDRTYPE=m -+CONFIG_NETFILTER_XT_MATCH_BPF=m -+CONFIG_NETFILTER_XT_MATCH_CLUSTER=m -+CONFIG_NETFILTER_XT_MATCH_COMMENT=m -+CONFIG_NETFILTER_XT_MATCH_CONNBYTES=m -+CONFIG_NETFILTER_XT_MATCH_CONNLABEL=m -+CONFIG_NETFILTER_XT_MATCH_CONNLIMIT=m -+CONFIG_NETFILTER_XT_MATCH_CONNMARK=m -+CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m -+CONFIG_NETFILTER_XT_MATCH_CPU=m -+CONFIG_NETFILTER_XT_MATCH_DCCP=m -+CONFIG_NETFILTER_XT_MATCH_DEVGROUP=m -+CONFIG_NETFILTER_XT_MATCH_DSCP=m -+CONFIG_NETFILTER_XT_MATCH_ESP=m -+CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=m -+CONFIG_NETFILTER_XT_MATCH_HELPER=m -+CONFIG_NETFILTER_XT_MATCH_IPRANGE=m -+CONFIG_NETFILTER_XT_MATCH_IPVS=m -+CONFIG_NETFILTER_XT_MATCH_LENGTH=m -+CONFIG_NETFILTER_XT_MATCH_LIMIT=m -+CONFIG_NETFILTER_XT_MATCH_MAC=m -+CONFIG_NETFILTER_XT_MATCH_MARK=m -+CONFIG_NETFILTER_XT_MATCH_MULTIPORT=m -+CONFIG_NETFILTER_XT_MATCH_NFACCT=m -+CONFIG_NETFILTER_XT_MATCH_OSF=m -+CONFIG_NETFILTER_XT_MATCH_OWNER=m -+CONFIG_NETFILTER_XT_MATCH_POLICY=m -+CONFIG_NETFILTER_XT_MATCH_PHYSDEV=m -+CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m -+CONFIG_NETFILTER_XT_MATCH_QUOTA=m -+CONFIG_NETFILTER_XT_MATCH_RATEEST=m -+CONFIG_NETFILTER_XT_MATCH_REALM=m -+CONFIG_NETFILTER_XT_MATCH_RECENT=m -+CONFIG_NETFILTER_XT_MATCH_SOCKET=m -+CONFIG_NETFILTER_XT_MATCH_STATE=m -+CONFIG_NETFILTER_XT_MATCH_STATISTIC=m -+CONFIG_NETFILTER_XT_MATCH_STRING=m -+CONFIG_NETFILTER_XT_MATCH_TCPMSS=m -+CONFIG_NETFILTER_XT_MATCH_TIME=m -+CONFIG_NETFILTER_XT_MATCH_U32=m -+CONFIG_IP_SET=m -+CONFIG_IP_SET_BITMAP_IP=m -+CONFIG_IP_SET_BITMAP_IPMAC=m -+CONFIG_IP_SET_BITMAP_PORT=m -+CONFIG_IP_SET_HASH_IP=m -+CONFIG_IP_SET_HASH_IPPORT=m -+CONFIG_IP_SET_HASH_IPPORTIP=m -+CONFIG_IP_SET_HASH_IPPORTNET=m -+CONFIG_IP_SET_HASH_NET=m -+CONFIG_IP_SET_HASH_NETPORT=m -+CONFIG_IP_SET_HASH_NETIFACE=m -+CONFIG_IP_SET_LIST_SET=m -+CONFIG_IP_VS=m -+CONFIG_IP_VS_PROTO_TCP=y -+CONFIG_IP_VS_PROTO_UDP=y -+CONFIG_IP_VS_PROTO_ESP=y -+CONFIG_IP_VS_PROTO_AH=y -+CONFIG_IP_VS_PROTO_SCTP=y -+CONFIG_IP_VS_RR=m -+CONFIG_IP_VS_WRR=m -+CONFIG_IP_VS_LC=m -+CONFIG_IP_VS_WLC=m -+CONFIG_IP_VS_LBLC=m -+CONFIG_IP_VS_LBLCR=m -+CONFIG_IP_VS_DH=m -+CONFIG_IP_VS_SH=m -+CONFIG_IP_VS_SED=m -+CONFIG_IP_VS_NQ=m -+CONFIG_IP_VS_FTP=m -+CONFIG_IP_VS_PE_SIP=m -+CONFIG_NF_CONNTRACK_IPV4=m -+CONFIG_IP_NF_IPTABLES=m -+CONFIG_IP_NF_MATCH_AH=m -+CONFIG_IP_NF_MATCH_ECN=m -+CONFIG_IP_NF_MATCH_TTL=m -+CONFIG_IP_NF_FILTER=m -+CONFIG_IP_NF_TARGET_REJECT=m -+CONFIG_IP_NF_NAT=m -+CONFIG_IP_NF_TARGET_MASQUERADE=m -+CONFIG_IP_NF_TARGET_NETMAP=m -+CONFIG_IP_NF_TARGET_REDIRECT=m -+CONFIG_IP_NF_MANGLE=m -+CONFIG_IP_NF_TARGET_CLUSTERIP=m -+CONFIG_IP_NF_TARGET_ECN=m -+CONFIG_IP_NF_TARGET_TTL=m -+CONFIG_IP_NF_RAW=m -+CONFIG_IP_NF_ARPTABLES=m -+CONFIG_IP_NF_ARPFILTER=m -+CONFIG_IP_NF_ARP_MANGLE=m -+CONFIG_NF_CONNTRACK_IPV6=m -+CONFIG_IP6_NF_IPTABLES=m -+CONFIG_IP6_NF_MATCH_AH=m -+CONFIG_IP6_NF_MATCH_EUI64=m -+CONFIG_IP6_NF_MATCH_FRAG=m -+CONFIG_IP6_NF_MATCH_OPTS=m -+CONFIG_IP6_NF_MATCH_HL=m -+CONFIG_IP6_NF_MATCH_IPV6HEADER=m -+CONFIG_IP6_NF_MATCH_MH=m -+CONFIG_IP6_NF_MATCH_RT=m -+CONFIG_IP6_NF_TARGET_HL=m -+CONFIG_IP6_NF_FILTER=m -+CONFIG_IP6_NF_TARGET_REJECT=m -+CONFIG_IP6_NF_MANGLE=m -+CONFIG_IP6_NF_RAW=m -+CONFIG_IP6_NF_NAT=m -+CONFIG_IP6_NF_TARGET_MASQUERADE=m -+CONFIG_IP6_NF_TARGET_NPT=m -+CONFIG_BRIDGE_NF_EBTABLES=m -+CONFIG_BRIDGE_EBT_BROUTE=m -+CONFIG_BRIDGE_EBT_T_FILTER=m -+CONFIG_BRIDGE_EBT_T_NAT=m -+CONFIG_BRIDGE_EBT_802_3=m -+CONFIG_BRIDGE_EBT_AMONG=m -+CONFIG_BRIDGE_EBT_ARP=m -+CONFIG_BRIDGE_EBT_IP=m -+CONFIG_BRIDGE_EBT_IP6=m -+CONFIG_BRIDGE_EBT_LIMIT=m -+CONFIG_BRIDGE_EBT_MARK=m -+CONFIG_BRIDGE_EBT_PKTTYPE=m -+CONFIG_BRIDGE_EBT_STP=m -+CONFIG_BRIDGE_EBT_VLAN=m -+CONFIG_BRIDGE_EBT_ARPREPLY=m -+CONFIG_BRIDGE_EBT_DNAT=m -+CONFIG_BRIDGE_EBT_MARK_T=m -+CONFIG_BRIDGE_EBT_REDIRECT=m -+CONFIG_BRIDGE_EBT_SNAT=m -+CONFIG_BRIDGE_EBT_LOG=m -+CONFIG_BRIDGE_EBT_NFLOG=m -+CONFIG_SCTP_COOKIE_HMAC_SHA1=y -+CONFIG_ATM=m -+CONFIG_L2TP=m -+CONFIG_L2TP_V3=y -+CONFIG_L2TP_IP=m -+CONFIG_L2TP_ETH=m -+CONFIG_BRIDGE=m -+CONFIG_VLAN_8021Q=m -+CONFIG_VLAN_8021Q_GVRP=y -+CONFIG_ATALK=m -+CONFIG_6LOWPAN=m -+CONFIG_IEEE802154=m -+CONFIG_IEEE802154_6LOWPAN=m -+CONFIG_MAC802154=m -+CONFIG_NET_SCHED=y -+CONFIG_NET_SCH_CBQ=m -+CONFIG_NET_SCH_HTB=m -+CONFIG_NET_SCH_HFSC=m -+CONFIG_NET_SCH_PRIO=m -+CONFIG_NET_SCH_MULTIQ=m -+CONFIG_NET_SCH_RED=m -+CONFIG_NET_SCH_SFB=m -+CONFIG_NET_SCH_SFQ=m -+CONFIG_NET_SCH_TEQL=m -+CONFIG_NET_SCH_TBF=m -+CONFIG_NET_SCH_GRED=m -+CONFIG_NET_SCH_DSMARK=m -+CONFIG_NET_SCH_NETEM=m -+CONFIG_NET_SCH_DRR=m -+CONFIG_NET_SCH_MQPRIO=m -+CONFIG_NET_SCH_CHOKE=m -+CONFIG_NET_SCH_QFQ=m -+CONFIG_NET_SCH_CODEL=m -+CONFIG_NET_SCH_FQ_CODEL=m -+CONFIG_NET_SCH_INGRESS=m -+CONFIG_NET_SCH_PLUG=m -+CONFIG_NET_CLS_BASIC=m -+CONFIG_NET_CLS_TCINDEX=m -+CONFIG_NET_CLS_ROUTE4=m -+CONFIG_NET_CLS_FW=m -+CONFIG_NET_CLS_U32=m -+CONFIG_CLS_U32_MARK=y -+CONFIG_NET_CLS_RSVP=m -+CONFIG_NET_CLS_RSVP6=m -+CONFIG_NET_CLS_FLOW=m -+CONFIG_NET_CLS_CGROUP=m -+CONFIG_NET_EMATCH=y -+CONFIG_NET_EMATCH_CMP=m -+CONFIG_NET_EMATCH_NBYTE=m -+CONFIG_NET_EMATCH_U32=m -+CONFIG_NET_EMATCH_META=m -+CONFIG_NET_EMATCH_TEXT=m -+CONFIG_NET_EMATCH_IPSET=m -+CONFIG_NET_CLS_ACT=y -+CONFIG_NET_ACT_POLICE=m -+CONFIG_NET_ACT_GACT=m -+CONFIG_GACT_PROB=y -+CONFIG_NET_ACT_MIRRED=m -+CONFIG_NET_ACT_IPT=m -+CONFIG_NET_ACT_NAT=m -+CONFIG_NET_ACT_PEDIT=m -+CONFIG_NET_ACT_SIMP=m -+CONFIG_NET_ACT_SKBEDIT=m -+CONFIG_NET_ACT_CSUM=m -+CONFIG_BATMAN_ADV=m -+CONFIG_OPENVSWITCH=m -+CONFIG_NET_PKTGEN=m -+CONFIG_HAMRADIO=y -+CONFIG_AX25=m -+CONFIG_NETROM=m -+CONFIG_ROSE=m -+CONFIG_MKISS=m -+CONFIG_6PACK=m -+CONFIG_BPQETHER=m -+CONFIG_BAYCOM_SER_FDX=m -+CONFIG_BAYCOM_SER_HDX=m -+CONFIG_YAM=m -+CONFIG_CAN=m -+CONFIG_CAN_VCAN=m -+CONFIG_CAN_MCP251X=m -+CONFIG_IRDA=m -+CONFIG_IRLAN=m -+CONFIG_IRNET=m -+CONFIG_IRCOMM=m -+CONFIG_IRDA_ULTRA=y -+CONFIG_IRDA_CACHE_LAST_LSAP=y -+CONFIG_IRDA_FAST_RR=y -+CONFIG_IRTTY_SIR=m -+CONFIG_KINGSUN_DONGLE=m -+CONFIG_KSDAZZLE_DONGLE=m -+CONFIG_KS959_DONGLE=m -+CONFIG_USB_IRDA=m -+CONFIG_SIGMATEL_FIR=m -+CONFIG_MCS_FIR=m -+CONFIG_BT=m -+CONFIG_BT_RFCOMM=m -+CONFIG_BT_RFCOMM_TTY=y -+CONFIG_BT_BNEP=m -+CONFIG_BT_BNEP_MC_FILTER=y -+CONFIG_BT_BNEP_PROTO_FILTER=y -+CONFIG_BT_HIDP=m -+CONFIG_BT_6LOWPAN=m -+CONFIG_BT_HCIBTUSB=m -+CONFIG_BT_HCIBCM203X=m -+CONFIG_BT_HCIBPA10X=m -+CONFIG_BT_HCIBFUSB=m -+CONFIG_BT_HCIVHCI=m -+CONFIG_BT_MRVL=m -+CONFIG_BT_MRVL_SDIO=m -+CONFIG_BT_ATH3K=m -+CONFIG_BT_WILINK=m -+CONFIG_MAC80211=m -+CONFIG_MAC80211_MESH=y -+CONFIG_WIMAX=m -+CONFIG_RFKILL=m -+CONFIG_RFKILL_INPUT=y -+CONFIG_NET_9P=m -+CONFIG_NFC=m -+CONFIG_NFC_PN533=m -+CONFIG_DEVTMPFS=y -+CONFIG_DEVTMPFS_MOUNT=y -+CONFIG_DMA_CMA=y -+CONFIG_CMA_SIZE_MBYTES=5 -+CONFIG_MTD=m -+CONFIG_MTD_BLOCK=m -+CONFIG_MTD_NAND=m -+CONFIG_MTD_UBI=m -+CONFIG_ZRAM=m -+CONFIG_ZRAM_LZ4_COMPRESS=y -+CONFIG_BLK_DEV_LOOP=y -+CONFIG_BLK_DEV_CRYPTOLOOP=m -+CONFIG_BLK_DEV_DRBD=m -+CONFIG_BLK_DEV_NBD=m -+CONFIG_BLK_DEV_RAM=y -+CONFIG_CDROM_PKTCDVD=m -+CONFIG_ATA_OVER_ETH=m -+CONFIG_EEPROM_AT24=m -+CONFIG_TI_ST=m -+CONFIG_SCSI=y -+# CONFIG_SCSI_PROC_FS is not set -+CONFIG_BLK_DEV_SD=y -+CONFIG_CHR_DEV_ST=m -+CONFIG_CHR_DEV_OSST=m -+CONFIG_BLK_DEV_SR=m -+CONFIG_CHR_DEV_SG=m -+CONFIG_SCSI_ISCSI_ATTRS=y -+CONFIG_ISCSI_TCP=m -+CONFIG_ISCSI_BOOT_SYSFS=m -+CONFIG_MD=y -+CONFIG_MD_LINEAR=m -+CONFIG_MD_RAID0=m -+CONFIG_BLK_DEV_DM=m -+CONFIG_DM_CRYPT=m -+CONFIG_DM_SNAPSHOT=m -+CONFIG_DM_THIN_PROVISIONING=m -+CONFIG_DM_MIRROR=m -+CONFIG_DM_LOG_USERSPACE=m -+CONFIG_DM_RAID=m -+CONFIG_DM_ZERO=m -+CONFIG_DM_DELAY=m -+CONFIG_NETDEVICES=y -+CONFIG_BONDING=m -+CONFIG_DUMMY=m -+CONFIG_IFB=m -+CONFIG_MACVLAN=m -+CONFIG_NETCONSOLE=m -+CONFIG_TUN=m -+CONFIG_VETH=m -+CONFIG_ENC28J60=m -+CONFIG_MDIO_BITBANG=m -+CONFIG_PPP=m -+CONFIG_PPP_BSDCOMP=m -+CONFIG_PPP_DEFLATE=m -+CONFIG_PPP_FILTER=y -+CONFIG_PPP_MPPE=m -+CONFIG_PPP_MULTILINK=y -+CONFIG_PPPOATM=m -+CONFIG_PPPOE=m -+CONFIG_PPPOL2TP=m -+CONFIG_PPP_ASYNC=m -+CONFIG_PPP_SYNC_TTY=m -+CONFIG_SLIP=m -+CONFIG_SLIP_COMPRESSED=y -+CONFIG_SLIP_SMART=y -+CONFIG_USB_CATC=m -+CONFIG_USB_KAWETH=m -+CONFIG_USB_PEGASUS=m -+CONFIG_USB_RTL8150=m -+CONFIG_USB_RTL8152=m -+CONFIG_USB_USBNET=y -+CONFIG_USB_NET_AX8817X=m -+CONFIG_USB_NET_AX88179_178A=m -+CONFIG_USB_NET_CDCETHER=m -+CONFIG_USB_NET_CDC_EEM=m -+CONFIG_USB_NET_CDC_NCM=m -+CONFIG_USB_NET_HUAWEI_CDC_NCM=m -+CONFIG_USB_NET_CDC_MBIM=m -+CONFIG_USB_NET_DM9601=m -+CONFIG_USB_NET_SR9700=m -+CONFIG_USB_NET_SR9800=m -+CONFIG_USB_NET_SMSC75XX=m -+CONFIG_USB_NET_SMSC95XX=y -+CONFIG_USB_NET_GL620A=m -+CONFIG_USB_NET_NET1080=m -+CONFIG_USB_NET_PLUSB=m -+CONFIG_USB_NET_MCS7830=m -+CONFIG_USB_NET_CDC_SUBSET=m -+CONFIG_USB_ALI_M5632=y -+CONFIG_USB_AN2720=y -+CONFIG_USB_EPSON2888=y -+CONFIG_USB_KC2190=y -+CONFIG_USB_NET_ZAURUS=m -+CONFIG_USB_NET_CX82310_ETH=m -+CONFIG_USB_NET_KALMIA=m -+CONFIG_USB_NET_QMI_WWAN=m -+CONFIG_USB_HSO=m -+CONFIG_USB_NET_INT51X1=m -+CONFIG_USB_IPHETH=m -+CONFIG_USB_SIERRA_NET=m -+CONFIG_USB_VL600=m -+CONFIG_LIBERTAS_THINFIRM=m -+CONFIG_LIBERTAS_THINFIRM_USB=m -+CONFIG_AT76C50X_USB=m -+CONFIG_USB_ZD1201=m -+CONFIG_USB_NET_RNDIS_WLAN=m -+CONFIG_RTL8187=m -+CONFIG_MAC80211_HWSIM=m -+CONFIG_ATH_CARDS=m -+CONFIG_ATH9K=m -+CONFIG_ATH9K_HTC=m -+CONFIG_CARL9170=m -+CONFIG_ATH6KL=m -+CONFIG_ATH6KL_USB=m -+CONFIG_AR5523=m -+CONFIG_B43=m -+# CONFIG_B43_PHY_N is not set -+CONFIG_B43LEGACY=m -+CONFIG_BRCMFMAC=m -+CONFIG_BRCMFMAC_USB=y -+CONFIG_HOSTAP=m -+CONFIG_LIBERTAS=m -+CONFIG_LIBERTAS_USB=m -+CONFIG_LIBERTAS_SDIO=m -+CONFIG_P54_COMMON=m -+CONFIG_P54_USB=m -+CONFIG_RT2X00=m -+CONFIG_RT2500USB=m -+CONFIG_RT73USB=m -+CONFIG_RT2800USB=m -+CONFIG_RT2800USB_RT3573=y -+CONFIG_RT2800USB_RT53XX=y -+CONFIG_RT2800USB_RT55XX=y -+CONFIG_RT2800USB_UNKNOWN=y -+CONFIG_WL_MEDIATEK=y -+CONFIG_MT7601U=m -+CONFIG_RTL8192CU=m -+CONFIG_ZD1211RW=m -+CONFIG_MWIFIEX=m -+CONFIG_MWIFIEX_SDIO=m -+CONFIG_WIMAX_I2400M_USB=m -+CONFIG_IEEE802154_AT86RF230=m -+CONFIG_IEEE802154_MRF24J40=m -+CONFIG_IEEE802154_CC2520=m -+CONFIG_INPUT_POLLDEV=m -+# CONFIG_INPUT_MOUSEDEV_PSAUX is not set -+CONFIG_INPUT_JOYDEV=m -+CONFIG_INPUT_EVDEV=m -+# CONFIG_KEYBOARD_ATKBD is not set -+CONFIG_KEYBOARD_GPIO=m -+# CONFIG_INPUT_MOUSE is not set -+CONFIG_INPUT_JOYSTICK=y -+CONFIG_JOYSTICK_IFORCE=m -+CONFIG_JOYSTICK_IFORCE_USB=y -+CONFIG_JOYSTICK_XPAD=m -+CONFIG_JOYSTICK_XPAD_FF=y -+CONFIG_JOYSTICK_RPISENSE=m -+CONFIG_INPUT_TOUCHSCREEN=y -+CONFIG_TOUCHSCREEN_ADS7846=m -+CONFIG_TOUCHSCREEN_EGALAX=m -+CONFIG_TOUCHSCREEN_FT6236=m -+CONFIG_TOUCHSCREEN_RPI_FT5406=m -+CONFIG_TOUCHSCREEN_USB_COMPOSITE=m -+CONFIG_TOUCHSCREEN_STMPE=m -+CONFIG_INPUT_MISC=y -+CONFIG_INPUT_AD714X=m -+CONFIG_INPUT_ATI_REMOTE2=m -+CONFIG_INPUT_KEYSPAN_REMOTE=m -+CONFIG_INPUT_POWERMATE=m -+CONFIG_INPUT_YEALINK=m -+CONFIG_INPUT_CM109=m -+CONFIG_INPUT_UINPUT=m -+CONFIG_INPUT_GPIO_ROTARY_ENCODER=m -+CONFIG_INPUT_ADXL34X=m -+CONFIG_INPUT_CMA3000=m -+CONFIG_SERIO=m -+CONFIG_SERIO_RAW=m -+CONFIG_GAMEPORT=m -+CONFIG_GAMEPORT_NS558=m -+CONFIG_GAMEPORT_L4=m -+CONFIG_BRCM_CHAR_DRIVERS=y -+CONFIG_BCM_VC_CMA=y -+CONFIG_BCM_VCIO=y -+CONFIG_BCM_VC_SM=y -+CONFIG_DEVPTS_MULTIPLE_INSTANCES=y -+# CONFIG_LEGACY_PTYS is not set -+# CONFIG_DEVKMEM is not set -+CONFIG_SERIAL_8250=y -+# CONFIG_SERIAL_8250_DEPRECATED_OPTIONS is not set -+CONFIG_SERIAL_8250_CONSOLE=y -+# CONFIG_SERIAL_8250_DMA is not set -+CONFIG_SERIAL_8250_NR_UARTS=1 -+CONFIG_SERIAL_8250_RUNTIME_UARTS=0 -+CONFIG_SERIAL_AMBA_PL011=y -+CONFIG_SERIAL_AMBA_PL011_CONSOLE=y -+CONFIG_SERIAL_OF_PLATFORM=y -+CONFIG_TTY_PRINTK=y -+CONFIG_HW_RANDOM=y -+CONFIG_HW_RANDOM_BCM2835=y -+CONFIG_RAW_DRIVER=y -+CONFIG_I2C=y -+CONFIG_I2C_CHARDEV=m -+CONFIG_I2C_BCM2708=m -+CONFIG_SPI=y -+CONFIG_SPI_BCM2835=m -+CONFIG_SPI_SPIDEV=y -+CONFIG_PPS=m -+CONFIG_PPS_CLIENT_LDISC=m -+CONFIG_PPS_CLIENT_GPIO=m -+CONFIG_GPIO_SYSFS=y -+CONFIG_GPIO_ARIZONA=m -+CONFIG_GPIO_STMPE=y -+CONFIG_W1=m -+CONFIG_W1_MASTER_DS2490=m -+CONFIG_W1_MASTER_DS2482=m -+CONFIG_W1_MASTER_DS1WM=m -+CONFIG_W1_MASTER_GPIO=m -+CONFIG_W1_SLAVE_THERM=m -+CONFIG_W1_SLAVE_SMEM=m -+CONFIG_W1_SLAVE_DS2408=m -+CONFIG_W1_SLAVE_DS2413=m -+CONFIG_W1_SLAVE_DS2406=m -+CONFIG_W1_SLAVE_DS2423=m -+CONFIG_W1_SLAVE_DS2431=m -+CONFIG_W1_SLAVE_DS2433=m -+CONFIG_W1_SLAVE_DS2760=m -+CONFIG_W1_SLAVE_DS2780=m -+CONFIG_W1_SLAVE_DS2781=m -+CONFIG_W1_SLAVE_DS28E04=m -+CONFIG_W1_SLAVE_BQ27000=m -+CONFIG_BATTERY_DS2760=m -+CONFIG_POWER_RESET=y -+CONFIG_POWER_RESET_GPIO=y -+CONFIG_HWMON=m -+CONFIG_SENSORS_SHT21=m -+CONFIG_SENSORS_SHTC1=m -+CONFIG_THERMAL=y -+CONFIG_THERMAL_BCM2835=y -+CONFIG_WATCHDOG=y -+CONFIG_BCM2835_WDT=m -+CONFIG_UCB1400_CORE=m -+CONFIG_MFD_STMPE=y -+CONFIG_STMPE_SPI=y -+CONFIG_MFD_ARIZONA_I2C=m -+CONFIG_MFD_ARIZONA_SPI=m -+CONFIG_MFD_WM5102=y -+CONFIG_MEDIA_SUPPORT=m -+CONFIG_MEDIA_CAMERA_SUPPORT=y -+CONFIG_MEDIA_ANALOG_TV_SUPPORT=y -+CONFIG_MEDIA_DIGITAL_TV_SUPPORT=y -+CONFIG_MEDIA_RADIO_SUPPORT=y -+CONFIG_MEDIA_RC_SUPPORT=y -+CONFIG_MEDIA_CONTROLLER=y -+CONFIG_LIRC=m -+CONFIG_RC_DEVICES=y -+CONFIG_RC_ATI_REMOTE=m -+CONFIG_IR_IMON=m -+CONFIG_IR_MCEUSB=m -+CONFIG_IR_REDRAT3=m -+CONFIG_IR_STREAMZAP=m -+CONFIG_IR_IGUANA=m -+CONFIG_IR_TTUSBIR=m -+CONFIG_RC_LOOPBACK=m -+CONFIG_IR_GPIO_CIR=m -+CONFIG_MEDIA_USB_SUPPORT=y -+CONFIG_USB_VIDEO_CLASS=m -+CONFIG_USB_M5602=m -+CONFIG_USB_STV06XX=m -+CONFIG_USB_GL860=m -+CONFIG_USB_GSPCA_BENQ=m -+CONFIG_USB_GSPCA_CONEX=m -+CONFIG_USB_GSPCA_CPIA1=m -+CONFIG_USB_GSPCA_DTCS033=m -+CONFIG_USB_GSPCA_ETOMS=m -+CONFIG_USB_GSPCA_FINEPIX=m -+CONFIG_USB_GSPCA_JEILINJ=m -+CONFIG_USB_GSPCA_JL2005BCD=m -+CONFIG_USB_GSPCA_KINECT=m -+CONFIG_USB_GSPCA_KONICA=m -+CONFIG_USB_GSPCA_MARS=m -+CONFIG_USB_GSPCA_MR97310A=m -+CONFIG_USB_GSPCA_NW80X=m -+CONFIG_USB_GSPCA_OV519=m -+CONFIG_USB_GSPCA_OV534=m -+CONFIG_USB_GSPCA_OV534_9=m -+CONFIG_USB_GSPCA_PAC207=m -+CONFIG_USB_GSPCA_PAC7302=m -+CONFIG_USB_GSPCA_PAC7311=m -+CONFIG_USB_GSPCA_SE401=m -+CONFIG_USB_GSPCA_SN9C2028=m -+CONFIG_USB_GSPCA_SN9C20X=m -+CONFIG_USB_GSPCA_SONIXB=m -+CONFIG_USB_GSPCA_SONIXJ=m -+CONFIG_USB_GSPCA_SPCA500=m -+CONFIG_USB_GSPCA_SPCA501=m -+CONFIG_USB_GSPCA_SPCA505=m -+CONFIG_USB_GSPCA_SPCA506=m -+CONFIG_USB_GSPCA_SPCA508=m -+CONFIG_USB_GSPCA_SPCA561=m -+CONFIG_USB_GSPCA_SPCA1528=m -+CONFIG_USB_GSPCA_SQ905=m -+CONFIG_USB_GSPCA_SQ905C=m -+CONFIG_USB_GSPCA_SQ930X=m -+CONFIG_USB_GSPCA_STK014=m -+CONFIG_USB_GSPCA_STK1135=m -+CONFIG_USB_GSPCA_STV0680=m -+CONFIG_USB_GSPCA_SUNPLUS=m -+CONFIG_USB_GSPCA_T613=m -+CONFIG_USB_GSPCA_TOPRO=m -+CONFIG_USB_GSPCA_TV8532=m -+CONFIG_USB_GSPCA_VC032X=m -+CONFIG_USB_GSPCA_VICAM=m -+CONFIG_USB_GSPCA_XIRLINK_CIT=m -+CONFIG_USB_GSPCA_ZC3XX=m -+CONFIG_USB_PWC=m -+CONFIG_VIDEO_CPIA2=m -+CONFIG_USB_ZR364XX=m -+CONFIG_USB_STKWEBCAM=m -+CONFIG_USB_S2255=m -+CONFIG_VIDEO_USBTV=m -+CONFIG_VIDEO_PVRUSB2=m -+CONFIG_VIDEO_HDPVR=m -+CONFIG_VIDEO_USBVISION=m -+CONFIG_VIDEO_STK1160_COMMON=m -+CONFIG_VIDEO_STK1160_AC97=y -+CONFIG_VIDEO_GO7007=m -+CONFIG_VIDEO_GO7007_USB=m -+CONFIG_VIDEO_GO7007_USB_S2250_BOARD=m -+CONFIG_VIDEO_AU0828=m -+CONFIG_VIDEO_AU0828_RC=y -+CONFIG_VIDEO_CX231XX=m -+CONFIG_VIDEO_CX231XX_ALSA=m -+CONFIG_VIDEO_CX231XX_DVB=m -+CONFIG_VIDEO_TM6000=m -+CONFIG_VIDEO_TM6000_ALSA=m -+CONFIG_VIDEO_TM6000_DVB=m -+CONFIG_DVB_USB=m -+CONFIG_DVB_USB_A800=m -+CONFIG_DVB_USB_DIBUSB_MB=m -+CONFIG_DVB_USB_DIBUSB_MB_FAULTY=y -+CONFIG_DVB_USB_DIBUSB_MC=m -+CONFIG_DVB_USB_DIB0700=m -+CONFIG_DVB_USB_UMT_010=m -+CONFIG_DVB_USB_CXUSB=m -+CONFIG_DVB_USB_M920X=m -+CONFIG_DVB_USB_DIGITV=m -+CONFIG_DVB_USB_VP7045=m -+CONFIG_DVB_USB_VP702X=m -+CONFIG_DVB_USB_GP8PSK=m -+CONFIG_DVB_USB_NOVA_T_USB2=m -+CONFIG_DVB_USB_TTUSB2=m -+CONFIG_DVB_USB_DTT200U=m -+CONFIG_DVB_USB_OPERA1=m -+CONFIG_DVB_USB_AF9005=m -+CONFIG_DVB_USB_AF9005_REMOTE=m -+CONFIG_DVB_USB_PCTV452E=m -+CONFIG_DVB_USB_DW2102=m -+CONFIG_DVB_USB_CINERGY_T2=m -+CONFIG_DVB_USB_DTV5100=m -+CONFIG_DVB_USB_FRIIO=m -+CONFIG_DVB_USB_AZ6027=m -+CONFIG_DVB_USB_TECHNISAT_USB2=m -+CONFIG_DVB_USB_V2=m -+CONFIG_DVB_USB_AF9015=m -+CONFIG_DVB_USB_AF9035=m -+CONFIG_DVB_USB_ANYSEE=m -+CONFIG_DVB_USB_AU6610=m -+CONFIG_DVB_USB_AZ6007=m -+CONFIG_DVB_USB_CE6230=m -+CONFIG_DVB_USB_EC168=m -+CONFIG_DVB_USB_GL861=m -+CONFIG_DVB_USB_LME2510=m -+CONFIG_DVB_USB_MXL111SF=m -+CONFIG_DVB_USB_RTL28XXU=m -+CONFIG_DVB_USB_DVBSKY=m -+CONFIG_SMS_USB_DRV=m -+CONFIG_DVB_B2C2_FLEXCOP_USB=m -+CONFIG_DVB_AS102=m -+CONFIG_VIDEO_EM28XX=m -+CONFIG_VIDEO_EM28XX_V4L2=m -+CONFIG_VIDEO_EM28XX_ALSA=m -+CONFIG_VIDEO_EM28XX_DVB=m -+CONFIG_V4L_PLATFORM_DRIVERS=y -+CONFIG_VIDEO_BCM2835=y -+CONFIG_VIDEO_BCM2835_MMAL=m -+CONFIG_RADIO_SI470X=y -+CONFIG_USB_SI470X=m -+CONFIG_I2C_SI470X=m -+CONFIG_RADIO_SI4713=m -+CONFIG_I2C_SI4713=m -+CONFIG_USB_MR800=m -+CONFIG_USB_DSBR=m -+CONFIG_RADIO_SHARK=m -+CONFIG_RADIO_SHARK2=m -+CONFIG_USB_KEENE=m -+CONFIG_USB_MA901=m -+CONFIG_RADIO_TEA5764=m -+CONFIG_RADIO_SAA7706H=m -+CONFIG_RADIO_TEF6862=m -+CONFIG_RADIO_WL1273=m -+CONFIG_RADIO_WL128X=m -+# CONFIG_MEDIA_SUBDRV_AUTOSELECT is not set -+CONFIG_VIDEO_UDA1342=m -+CONFIG_VIDEO_SONY_BTF_MPX=m -+CONFIG_VIDEO_TVP5150=m -+CONFIG_VIDEO_TW2804=m -+CONFIG_VIDEO_TW9903=m -+CONFIG_VIDEO_TW9906=m -+CONFIG_VIDEO_OV7640=m -+CONFIG_VIDEO_MT9V011=m -+CONFIG_FB=y -+CONFIG_FB_BCM2708=y -+CONFIG_FB_UDL=m -+CONFIG_FB_SSD1307=m -+CONFIG_FB_RPISENSE=m -+# CONFIG_BACKLIGHT_GENERIC is not set -+CONFIG_BACKLIGHT_GPIO=m -+CONFIG_FRAMEBUFFER_CONSOLE=y -+CONFIG_LOGO=y -+# CONFIG_LOGO_LINUX_MONO is not set -+# CONFIG_LOGO_LINUX_VGA16 is not set -+CONFIG_SOUND=y -+CONFIG_SND=m -+CONFIG_SND_SEQUENCER=m -+CONFIG_SND_SEQ_DUMMY=m -+CONFIG_SND_MIXER_OSS=m -+CONFIG_SND_PCM_OSS=m -+CONFIG_SND_SEQUENCER_OSS=y -+CONFIG_SND_HRTIMER=m -+CONFIG_SND_DUMMY=m -+CONFIG_SND_ALOOP=m -+CONFIG_SND_VIRMIDI=m -+CONFIG_SND_MTPAV=m -+CONFIG_SND_SERIAL_U16550=m -+CONFIG_SND_MPU401=m -+CONFIG_SND_BCM2835=m -+CONFIG_SND_USB_AUDIO=m -+CONFIG_SND_USB_UA101=m -+CONFIG_SND_USB_CAIAQ=m -+CONFIG_SND_USB_CAIAQ_INPUT=y -+CONFIG_SND_USB_6FIRE=m -+CONFIG_SND_SOC=m -+CONFIG_SND_BCM2835_SOC_I2S=m -+CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC=m -+CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS=m -+CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI=m -+CONFIG_SND_BCM2708_SOC_HIFIBERRY_AMP=m -+CONFIG_SND_BCM2708_SOC_RPI_DAC=m -+CONFIG_SND_BCM2708_SOC_RPI_PROTO=m -+CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC=m -+CONFIG_SND_BCM2708_SOC_RASPIDAC3=m -+CONFIG_SND_SOC_ADAU1701=m -+CONFIG_SND_SOC_WM8804_I2C=m -+CONFIG_SND_SIMPLE_CARD=m -+CONFIG_SOUND_PRIME=m -+CONFIG_HIDRAW=y -+CONFIG_UHID=m -+CONFIG_HID_A4TECH=m -+CONFIG_HID_ACRUX=m -+CONFIG_HID_APPLE=m -+CONFIG_HID_BELKIN=m -+CONFIG_HID_CHERRY=m -+CONFIG_HID_CHICONY=m -+CONFIG_HID_CYPRESS=m -+CONFIG_HID_DRAGONRISE=m -+CONFIG_HID_EMS_FF=m -+CONFIG_HID_ELECOM=m -+CONFIG_HID_ELO=m -+CONFIG_HID_EZKEY=m -+CONFIG_HID_HOLTEK=m -+CONFIG_HID_KEYTOUCH=m -+CONFIG_HID_KYE=m -+CONFIG_HID_UCLOGIC=m -+CONFIG_HID_WALTOP=m -+CONFIG_HID_GYRATION=m -+CONFIG_HID_TWINHAN=m -+CONFIG_HID_KENSINGTON=m -+CONFIG_HID_LCPOWER=m -+CONFIG_HID_LOGITECH=m -+CONFIG_HID_MAGICMOUSE=m -+CONFIG_HID_MICROSOFT=m -+CONFIG_HID_MONTEREY=m -+CONFIG_HID_MULTITOUCH=m -+CONFIG_HID_NTRIG=m -+CONFIG_HID_ORTEK=m -+CONFIG_HID_PANTHERLORD=m -+CONFIG_HID_PETALYNX=m -+CONFIG_HID_PICOLCD=m -+CONFIG_HID_ROCCAT=m -+CONFIG_HID_SAMSUNG=m -+CONFIG_HID_SONY=m -+CONFIG_HID_SPEEDLINK=m -+CONFIG_HID_SUNPLUS=m -+CONFIG_HID_GREENASIA=m -+CONFIG_HID_SMARTJOYPLUS=m -+CONFIG_HID_TOPSEED=m -+CONFIG_HID_THINGM=m -+CONFIG_HID_THRUSTMASTER=m -+CONFIG_HID_WACOM=m -+CONFIG_HID_WIIMOTE=m -+CONFIG_HID_XINMO=m -+CONFIG_HID_ZEROPLUS=m -+CONFIG_HID_ZYDACRON=m -+CONFIG_HID_PID=y -+CONFIG_USB_HIDDEV=y -+CONFIG_USB=y -+CONFIG_USB_ANNOUNCE_NEW_DEVICES=y -+CONFIG_USB_MON=m -+CONFIG_USB_DWCOTG=y -+CONFIG_USB_PRINTER=m -+CONFIG_USB_STORAGE=y -+CONFIG_USB_STORAGE_REALTEK=m -+CONFIG_USB_STORAGE_DATAFAB=m -+CONFIG_USB_STORAGE_FREECOM=m -+CONFIG_USB_STORAGE_ISD200=m -+CONFIG_USB_STORAGE_USBAT=m -+CONFIG_USB_STORAGE_SDDR09=m -+CONFIG_USB_STORAGE_SDDR55=m -+CONFIG_USB_STORAGE_JUMPSHOT=m -+CONFIG_USB_STORAGE_ALAUDA=m -+CONFIG_USB_STORAGE_ONETOUCH=m -+CONFIG_USB_STORAGE_KARMA=m -+CONFIG_USB_STORAGE_CYPRESS_ATACB=m -+CONFIG_USB_STORAGE_ENE_UB6250=m -+CONFIG_USB_MDC800=m -+CONFIG_USB_MICROTEK=m -+CONFIG_USBIP_CORE=m -+CONFIG_USBIP_VHCI_HCD=m -+CONFIG_USBIP_HOST=m -+CONFIG_USB_SERIAL=m -+CONFIG_USB_SERIAL_GENERIC=y -+CONFIG_USB_SERIAL_AIRCABLE=m -+CONFIG_USB_SERIAL_ARK3116=m -+CONFIG_USB_SERIAL_BELKIN=m -+CONFIG_USB_SERIAL_CH341=m -+CONFIG_USB_SERIAL_WHITEHEAT=m -+CONFIG_USB_SERIAL_DIGI_ACCELEPORT=m -+CONFIG_USB_SERIAL_CP210X=m -+CONFIG_USB_SERIAL_CYPRESS_M8=m -+CONFIG_USB_SERIAL_EMPEG=m -+CONFIG_USB_SERIAL_FTDI_SIO=m -+CONFIG_USB_SERIAL_VISOR=m -+CONFIG_USB_SERIAL_IPAQ=m -+CONFIG_USB_SERIAL_IR=m -+CONFIG_USB_SERIAL_EDGEPORT=m -+CONFIG_USB_SERIAL_EDGEPORT_TI=m -+CONFIG_USB_SERIAL_F81232=m -+CONFIG_USB_SERIAL_GARMIN=m -+CONFIG_USB_SERIAL_IPW=m -+CONFIG_USB_SERIAL_IUU=m -+CONFIG_USB_SERIAL_KEYSPAN_PDA=m -+CONFIG_USB_SERIAL_KEYSPAN=m -+CONFIG_USB_SERIAL_KLSI=m -+CONFIG_USB_SERIAL_KOBIL_SCT=m -+CONFIG_USB_SERIAL_MCT_U232=m -+CONFIG_USB_SERIAL_METRO=m -+CONFIG_USB_SERIAL_MOS7720=m -+CONFIG_USB_SERIAL_MOS7840=m -+CONFIG_USB_SERIAL_NAVMAN=m -+CONFIG_USB_SERIAL_PL2303=m -+CONFIG_USB_SERIAL_OTI6858=m -+CONFIG_USB_SERIAL_QCAUX=m -+CONFIG_USB_SERIAL_QUALCOMM=m -+CONFIG_USB_SERIAL_SPCP8X5=m -+CONFIG_USB_SERIAL_SAFE=m -+CONFIG_USB_SERIAL_SIERRAWIRELESS=m -+CONFIG_USB_SERIAL_SYMBOL=m -+CONFIG_USB_SERIAL_TI=m -+CONFIG_USB_SERIAL_CYBERJACK=m -+CONFIG_USB_SERIAL_XIRCOM=m -+CONFIG_USB_SERIAL_OPTION=m -+CONFIG_USB_SERIAL_OMNINET=m -+CONFIG_USB_SERIAL_OPTICON=m -+CONFIG_USB_SERIAL_XSENS_MT=m -+CONFIG_USB_SERIAL_WISHBONE=m -+CONFIG_USB_SERIAL_SSU100=m -+CONFIG_USB_SERIAL_QT2=m -+CONFIG_USB_SERIAL_DEBUG=m -+CONFIG_USB_EMI62=m -+CONFIG_USB_EMI26=m -+CONFIG_USB_ADUTUX=m -+CONFIG_USB_SEVSEG=m -+CONFIG_USB_RIO500=m -+CONFIG_USB_LEGOTOWER=m -+CONFIG_USB_LCD=m -+CONFIG_USB_LED=m -+CONFIG_USB_CYPRESS_CY7C63=m -+CONFIG_USB_CYTHERM=m -+CONFIG_USB_IDMOUSE=m -+CONFIG_USB_FTDI_ELAN=m -+CONFIG_USB_APPLEDISPLAY=m -+CONFIG_USB_LD=m -+CONFIG_USB_TRANCEVIBRATOR=m -+CONFIG_USB_IOWARRIOR=m -+CONFIG_USB_TEST=m -+CONFIG_USB_ISIGHTFW=m -+CONFIG_USB_YUREX=m -+CONFIG_USB_ATM=m -+CONFIG_USB_SPEEDTOUCH=m -+CONFIG_USB_CXACRU=m -+CONFIG_USB_UEAGLEATM=m -+CONFIG_USB_XUSBATM=m -+CONFIG_MMC=y -+CONFIG_MMC_BLOCK_MINORS=32 -+CONFIG_MMC_BCM2835=y -+CONFIG_MMC_BCM2835_DMA=y -+CONFIG_MMC_BCM2835_SDHOST=y -+CONFIG_MMC_SDHCI=y -+CONFIG_MMC_SDHCI_PLTFM=y -+CONFIG_MMC_SPI=m -+CONFIG_LEDS_CLASS=y -+CONFIG_LEDS_GPIO=y -+CONFIG_LEDS_TRIGGER_TIMER=y -+CONFIG_LEDS_TRIGGER_ONESHOT=y -+CONFIG_LEDS_TRIGGER_HEARTBEAT=y -+CONFIG_LEDS_TRIGGER_BACKLIGHT=y -+CONFIG_LEDS_TRIGGER_CPU=y -+CONFIG_LEDS_TRIGGER_GPIO=y -+CONFIG_LEDS_TRIGGER_DEFAULT_ON=y -+CONFIG_LEDS_TRIGGER_TRANSIENT=m -+CONFIG_LEDS_TRIGGER_CAMERA=m -+CONFIG_LEDS_TRIGGER_INPUT=y -+CONFIG_RTC_CLASS=y -+# CONFIG_RTC_HCTOSYS is not set -+CONFIG_RTC_DRV_DS1307=m -+CONFIG_RTC_DRV_DS1374=m -+CONFIG_RTC_DRV_DS1672=m -+CONFIG_RTC_DRV_DS3232=m -+CONFIG_RTC_DRV_MAX6900=m -+CONFIG_RTC_DRV_RS5C372=m -+CONFIG_RTC_DRV_ISL1208=m -+CONFIG_RTC_DRV_ISL12022=m -+CONFIG_RTC_DRV_ISL12057=m -+CONFIG_RTC_DRV_X1205=m -+CONFIG_RTC_DRV_PCF2127=m -+CONFIG_RTC_DRV_PCF8523=m -+CONFIG_RTC_DRV_PCF8563=m -+CONFIG_RTC_DRV_PCF8583=m -+CONFIG_RTC_DRV_M41T80=m -+CONFIG_RTC_DRV_BQ32K=m -+CONFIG_RTC_DRV_S35390A=m -+CONFIG_RTC_DRV_FM3130=m -+CONFIG_RTC_DRV_RX8581=m -+CONFIG_RTC_DRV_RX8025=m -+CONFIG_RTC_DRV_EM3027=m -+CONFIG_RTC_DRV_RV3029C2=m -+CONFIG_RTC_DRV_M41T93=m -+CONFIG_RTC_DRV_M41T94=m -+CONFIG_RTC_DRV_DS1305=m -+CONFIG_RTC_DRV_DS1390=m -+CONFIG_RTC_DRV_MAX6902=m -+CONFIG_RTC_DRV_R9701=m -+CONFIG_RTC_DRV_RS5C348=m -+CONFIG_RTC_DRV_DS3234=m -+CONFIG_RTC_DRV_PCF2123=m -+CONFIG_RTC_DRV_RX4581=m -+CONFIG_DMADEVICES=y -+CONFIG_DMA_BCM2835=y -+CONFIG_DMA_BCM2708=y -+CONFIG_UIO=m -+CONFIG_UIO_PDRV_GENIRQ=m -+CONFIG_STAGING=y -+CONFIG_PRISM2_USB=m -+CONFIG_R8712U=m -+CONFIG_R8188EU=m -+CONFIG_R8723AU=m -+CONFIG_VT6656=m -+CONFIG_SPEAKUP=m -+CONFIG_SPEAKUP_SYNTH_SOFT=m -+CONFIG_STAGING_MEDIA=y -+CONFIG_LIRC_STAGING=y -+CONFIG_LIRC_IMON=m -+CONFIG_LIRC_RPI=m -+CONFIG_LIRC_SASEM=m -+CONFIG_LIRC_SERIAL=m -+CONFIG_FB_TFT=m -+CONFIG_FB_TFT_AGM1264K_FL=m -+CONFIG_FB_TFT_BD663474=m -+CONFIG_FB_TFT_HX8340BN=m -+CONFIG_FB_TFT_HX8347D=m -+CONFIG_FB_TFT_HX8353D=m -+CONFIG_FB_TFT_ILI9163=m -+CONFIG_FB_TFT_ILI9320=m -+CONFIG_FB_TFT_ILI9325=m -+CONFIG_FB_TFT_ILI9340=m -+CONFIG_FB_TFT_ILI9341=m -+CONFIG_FB_TFT_ILI9481=m -+CONFIG_FB_TFT_ILI9486=m -+CONFIG_FB_TFT_PCD8544=m -+CONFIG_FB_TFT_RA8875=m -+CONFIG_FB_TFT_S6D02A1=m -+CONFIG_FB_TFT_S6D1121=m -+CONFIG_FB_TFT_SSD1289=m -+CONFIG_FB_TFT_SSD1306=m -+CONFIG_FB_TFT_SSD1331=m -+CONFIG_FB_TFT_SSD1351=m -+CONFIG_FB_TFT_ST7735R=m -+CONFIG_FB_TFT_TINYLCD=m -+CONFIG_FB_TFT_TLS8204=m -+CONFIG_FB_TFT_UC1701=m -+CONFIG_FB_TFT_UPD161704=m -+CONFIG_FB_TFT_WATTEROTT=m -+CONFIG_FB_FLEX=m -+CONFIG_FB_TFT_FBTFT_DEVICE=m -+CONFIG_MAILBOX=y -+CONFIG_BCM2835_MBOX=y -+# CONFIG_IOMMU_SUPPORT is not set -+CONFIG_EXTCON=m -+CONFIG_EXTCON_ARIZONA=m -+CONFIG_IIO=m -+CONFIG_IIO_BUFFER=y -+CONFIG_IIO_BUFFER_CB=y -+CONFIG_IIO_KFIFO_BUF=m -+CONFIG_MCP320X=m -+CONFIG_DHT11=m -+CONFIG_PWM_BCM2835=m -+CONFIG_RASPBERRYPI_FIRMWARE=y -+CONFIG_EXT4_FS=y -+CONFIG_EXT4_FS_POSIX_ACL=y -+CONFIG_EXT4_FS_SECURITY=y -+CONFIG_REISERFS_FS=m -+CONFIG_REISERFS_FS_XATTR=y -+CONFIG_REISERFS_FS_POSIX_ACL=y -+CONFIG_REISERFS_FS_SECURITY=y -+CONFIG_JFS_FS=m -+CONFIG_JFS_POSIX_ACL=y -+CONFIG_JFS_SECURITY=y -+CONFIG_JFS_STATISTICS=y -+CONFIG_XFS_FS=m -+CONFIG_XFS_QUOTA=y -+CONFIG_XFS_POSIX_ACL=y -+CONFIG_XFS_RT=y -+CONFIG_GFS2_FS=m -+CONFIG_OCFS2_FS=m -+CONFIG_BTRFS_FS=m -+CONFIG_BTRFS_FS_POSIX_ACL=y -+CONFIG_NILFS2_FS=m -+CONFIG_F2FS_FS=y -+CONFIG_FANOTIFY=y -+CONFIG_QFMT_V1=m -+CONFIG_QFMT_V2=m -+CONFIG_AUTOFS4_FS=y -+CONFIG_FUSE_FS=m -+CONFIG_CUSE=m -+CONFIG_OVERLAY_FS=m -+CONFIG_FSCACHE=y -+CONFIG_FSCACHE_STATS=y -+CONFIG_FSCACHE_HISTOGRAM=y -+CONFIG_CACHEFILES=y -+CONFIG_ISO9660_FS=m -+CONFIG_JOLIET=y -+CONFIG_ZISOFS=y -+CONFIG_UDF_FS=m -+CONFIG_MSDOS_FS=y -+CONFIG_VFAT_FS=y -+CONFIG_FAT_DEFAULT_IOCHARSET="ascii" -+CONFIG_NTFS_FS=m -+CONFIG_NTFS_RW=y -+CONFIG_TMPFS=y -+CONFIG_TMPFS_POSIX_ACL=y -+CONFIG_CONFIGFS_FS=y -+CONFIG_ECRYPT_FS=m -+CONFIG_HFS_FS=m -+CONFIG_HFSPLUS_FS=m -+CONFIG_JFFS2_FS=m -+CONFIG_JFFS2_SUMMARY=y -+CONFIG_UBIFS_FS=m -+CONFIG_SQUASHFS=m -+CONFIG_SQUASHFS_XATTR=y -+CONFIG_SQUASHFS_LZO=y -+CONFIG_SQUASHFS_XZ=y -+CONFIG_NFS_FS=y -+CONFIG_NFS_V3_ACL=y -+CONFIG_NFS_V4=y -+CONFIG_NFS_SWAP=y -+CONFIG_ROOT_NFS=y -+CONFIG_NFS_FSCACHE=y -+CONFIG_NFSD=m -+CONFIG_NFSD_V3_ACL=y -+CONFIG_NFSD_V4=y -+CONFIG_CIFS=m -+CONFIG_CIFS_WEAK_PW_HASH=y -+CONFIG_CIFS_UPCALL=y -+CONFIG_CIFS_XATTR=y -+CONFIG_CIFS_POSIX=y -+CONFIG_CIFS_ACL=y -+CONFIG_CIFS_DFS_UPCALL=y -+CONFIG_CIFS_SMB2=y -+CONFIG_CIFS_FSCACHE=y -+CONFIG_9P_FS=m -+CONFIG_9P_FS_POSIX_ACL=y -+CONFIG_NLS_DEFAULT="utf8" -+CONFIG_NLS_CODEPAGE_437=y -+CONFIG_NLS_CODEPAGE_737=m -+CONFIG_NLS_CODEPAGE_775=m -+CONFIG_NLS_CODEPAGE_850=m -+CONFIG_NLS_CODEPAGE_852=m -+CONFIG_NLS_CODEPAGE_855=m -+CONFIG_NLS_CODEPAGE_857=m -+CONFIG_NLS_CODEPAGE_860=m -+CONFIG_NLS_CODEPAGE_861=m -+CONFIG_NLS_CODEPAGE_862=m -+CONFIG_NLS_CODEPAGE_863=m -+CONFIG_NLS_CODEPAGE_864=m -+CONFIG_NLS_CODEPAGE_865=m -+CONFIG_NLS_CODEPAGE_866=m -+CONFIG_NLS_CODEPAGE_869=m -+CONFIG_NLS_CODEPAGE_936=m -+CONFIG_NLS_CODEPAGE_950=m -+CONFIG_NLS_CODEPAGE_932=m -+CONFIG_NLS_CODEPAGE_949=m -+CONFIG_NLS_CODEPAGE_874=m -+CONFIG_NLS_ISO8859_8=m -+CONFIG_NLS_CODEPAGE_1250=m -+CONFIG_NLS_CODEPAGE_1251=m -+CONFIG_NLS_ASCII=y -+CONFIG_NLS_ISO8859_1=m -+CONFIG_NLS_ISO8859_2=m -+CONFIG_NLS_ISO8859_3=m -+CONFIG_NLS_ISO8859_4=m -+CONFIG_NLS_ISO8859_5=m -+CONFIG_NLS_ISO8859_6=m -+CONFIG_NLS_ISO8859_7=m -+CONFIG_NLS_ISO8859_9=m -+CONFIG_NLS_ISO8859_13=m -+CONFIG_NLS_ISO8859_14=m -+CONFIG_NLS_ISO8859_15=m -+CONFIG_NLS_KOI8_R=m -+CONFIG_NLS_KOI8_U=m -+CONFIG_DLM=m -+CONFIG_PRINTK_TIME=y -+CONFIG_BOOT_PRINTK_DELAY=y -+CONFIG_DEBUG_MEMORY_INIT=y -+CONFIG_DETECT_HUNG_TASK=y -+CONFIG_TIMER_STATS=y -+CONFIG_IRQSOFF_TRACER=y -+CONFIG_SCHED_TRACER=y -+CONFIG_STACK_TRACER=y -+CONFIG_BLK_DEV_IO_TRACE=y -+# CONFIG_KPROBE_EVENT is not set -+CONFIG_FUNCTION_PROFILER=y -+CONFIG_KGDB=y -+CONFIG_KGDB_KDB=y -+CONFIG_KDB_KEYBOARD=y -+CONFIG_CRYPTO_USER=m -+CONFIG_CRYPTO_CBC=y -+CONFIG_CRYPTO_CTS=m -+CONFIG_CRYPTO_XTS=m -+CONFIG_CRYPTO_XCBC=m -+CONFIG_CRYPTO_TGR192=m -+CONFIG_CRYPTO_WP512=m -+CONFIG_CRYPTO_CAST5=m -+CONFIG_CRYPTO_DES=y -+CONFIG_CRYPTO_USER_API_SKCIPHER=m -+# CONFIG_CRYPTO_HW is not set -+CONFIG_ARM_CRYPTO=y -+CONFIG_CRYPTO_SHA1_ARM_NEON=m -+CONFIG_CRYPTO_AES_ARM_BS=m -+CONFIG_CRC_ITU_T=y -+CONFIG_LIBCRC32C=y -diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig -new file mode 100644 -index 0000000..1d1b799 ---- /dev/null -+++ b/arch/arm/configs/bcmrpi_defconfig -@@ -0,0 +1,1265 @@ -+# CONFIG_ARM_PATCH_PHYS_VIRT is not set -+CONFIG_PHYS_OFFSET=0 -+# CONFIG_LOCALVERSION_AUTO is not set -+CONFIG_SYSVIPC=y -+CONFIG_POSIX_MQUEUE=y -+CONFIG_FHANDLE=y -+CONFIG_NO_HZ=y -+CONFIG_HIGH_RES_TIMERS=y -+CONFIG_BSD_PROCESS_ACCT=y -+CONFIG_BSD_PROCESS_ACCT_V3=y -+CONFIG_TASKSTATS=y -+CONFIG_TASK_DELAY_ACCT=y -+CONFIG_TASK_XACCT=y -+CONFIG_TASK_IO_ACCOUNTING=y -+CONFIG_IKCONFIG=m -+CONFIG_IKCONFIG_PROC=y -+CONFIG_CGROUP_FREEZER=y -+CONFIG_CGROUP_DEVICE=y -+CONFIG_CPUSETS=y -+CONFIG_CGROUP_CPUACCT=y -+CONFIG_MEMCG=y -+CONFIG_BLK_CGROUP=y -+CONFIG_NAMESPACES=y -+CONFIG_SCHED_AUTOGROUP=y -+CONFIG_BLK_DEV_INITRD=y -+CONFIG_EMBEDDED=y -+# CONFIG_COMPAT_BRK is not set -+CONFIG_PROFILING=y -+CONFIG_OPROFILE=m -+CONFIG_KPROBES=y -+CONFIG_JUMP_LABEL=y -+CONFIG_MODULES=y -+CONFIG_MODULE_UNLOAD=y -+CONFIG_MODVERSIONS=y -+CONFIG_MODULE_SRCVERSION_ALL=y -+CONFIG_BLK_DEV_THROTTLING=y -+CONFIG_PARTITION_ADVANCED=y -+CONFIG_MAC_PARTITION=y -+CONFIG_CFQ_GROUP_IOSCHED=y -+CONFIG_ARCH_BCM2708=y -+CONFIG_PREEMPT_VOLUNTARY=y -+CONFIG_AEABI=y -+CONFIG_OABI_COMPAT=y -+# CONFIG_CPU_SW_DOMAIN_PAN is not set -+CONFIG_CLEANCACHE=y -+CONFIG_FRONTSWAP=y -+CONFIG_CMA=y -+CONFIG_ZSMALLOC=m -+CONFIG_PGTABLE_MAPPING=y -+CONFIG_UACCESS_WITH_MEMCPY=y -+CONFIG_SECCOMP=y -+# CONFIG_ATAGS is not set -+CONFIG_ZBOOT_ROM_TEXT=0x0 -+CONFIG_ZBOOT_ROM_BSS=0x0 -+CONFIG_CMDLINE="console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait" -+CONFIG_CPU_FREQ=y -+CONFIG_CPU_FREQ_STAT=m -+CONFIG_CPU_FREQ_STAT_DETAILS=y -+CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE=y -+CONFIG_CPU_FREQ_GOV_PERFORMANCE=y -+CONFIG_CPU_FREQ_GOV_USERSPACE=y -+CONFIG_CPU_FREQ_GOV_ONDEMAND=y -+CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y -+CONFIG_VFP=y -+CONFIG_BINFMT_MISC=m -+# CONFIG_SUSPEND is not set -+CONFIG_NET=y -+CONFIG_PACKET=y -+CONFIG_UNIX=y -+CONFIG_XFRM_USER=y -+CONFIG_NET_KEY=m -+CONFIG_INET=y -+CONFIG_IP_MULTICAST=y -+CONFIG_IP_ADVANCED_ROUTER=y -+CONFIG_IP_MULTIPLE_TABLES=y -+CONFIG_IP_ROUTE_MULTIPATH=y -+CONFIG_IP_ROUTE_VERBOSE=y -+CONFIG_IP_PNP=y -+CONFIG_IP_PNP_DHCP=y -+CONFIG_IP_PNP_RARP=y -+CONFIG_NET_IPIP=m -+CONFIG_NET_IPGRE_DEMUX=m -+CONFIG_NET_IPGRE=m -+CONFIG_IP_MROUTE=y -+CONFIG_IP_MROUTE_MULTIPLE_TABLES=y -+CONFIG_IP_PIMSM_V1=y -+CONFIG_IP_PIMSM_V2=y -+CONFIG_SYN_COOKIES=y -+CONFIG_INET_AH=m -+CONFIG_INET_ESP=m -+CONFIG_INET_IPCOMP=m -+CONFIG_INET_XFRM_MODE_TRANSPORT=m -+CONFIG_INET_XFRM_MODE_TUNNEL=m -+CONFIG_INET_XFRM_MODE_BEET=m -+CONFIG_INET_LRO=m -+CONFIG_INET_DIAG=m -+CONFIG_INET6_AH=m -+CONFIG_INET6_ESP=m -+CONFIG_INET6_IPCOMP=m -+CONFIG_IPV6_TUNNEL=m -+CONFIG_IPV6_MULTIPLE_TABLES=y -+CONFIG_IPV6_MROUTE=y -+CONFIG_IPV6_MROUTE_MULTIPLE_TABLES=y -+CONFIG_IPV6_PIMSM_V2=y -+CONFIG_NETFILTER=y -+CONFIG_NF_CONNTRACK=m -+CONFIG_NF_CONNTRACK_ZONES=y -+CONFIG_NF_CONNTRACK_EVENTS=y -+CONFIG_NF_CONNTRACK_TIMESTAMP=y -+CONFIG_NF_CT_PROTO_DCCP=m -+CONFIG_NF_CT_PROTO_UDPLITE=m -+CONFIG_NF_CONNTRACK_AMANDA=m -+CONFIG_NF_CONNTRACK_FTP=m -+CONFIG_NF_CONNTRACK_H323=m -+CONFIG_NF_CONNTRACK_IRC=m -+CONFIG_NF_CONNTRACK_NETBIOS_NS=m -+CONFIG_NF_CONNTRACK_SNMP=m -+CONFIG_NF_CONNTRACK_PPTP=m -+CONFIG_NF_CONNTRACK_SANE=m -+CONFIG_NF_CONNTRACK_SIP=m -+CONFIG_NF_CONNTRACK_TFTP=m -+CONFIG_NF_CT_NETLINK=m -+CONFIG_NETFILTER_XT_SET=m -+CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m -+CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m -+CONFIG_NETFILTER_XT_TARGET_CONNMARK=m -+CONFIG_NETFILTER_XT_TARGET_DSCP=m -+CONFIG_NETFILTER_XT_TARGET_HMARK=m -+CONFIG_NETFILTER_XT_TARGET_IDLETIMER=m -+CONFIG_NETFILTER_XT_TARGET_LED=m -+CONFIG_NETFILTER_XT_TARGET_LOG=m -+CONFIG_NETFILTER_XT_TARGET_MARK=m -+CONFIG_NETFILTER_XT_TARGET_NFLOG=m -+CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m -+CONFIG_NETFILTER_XT_TARGET_NOTRACK=m -+CONFIG_NETFILTER_XT_TARGET_TEE=m -+CONFIG_NETFILTER_XT_TARGET_TPROXY=m -+CONFIG_NETFILTER_XT_TARGET_TRACE=m -+CONFIG_NETFILTER_XT_TARGET_TCPMSS=m -+CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP=m -+CONFIG_NETFILTER_XT_MATCH_ADDRTYPE=m -+CONFIG_NETFILTER_XT_MATCH_BPF=m -+CONFIG_NETFILTER_XT_MATCH_CLUSTER=m -+CONFIG_NETFILTER_XT_MATCH_COMMENT=m -+CONFIG_NETFILTER_XT_MATCH_CONNBYTES=m -+CONFIG_NETFILTER_XT_MATCH_CONNLABEL=m -+CONFIG_NETFILTER_XT_MATCH_CONNLIMIT=m -+CONFIG_NETFILTER_XT_MATCH_CONNMARK=m -+CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m -+CONFIG_NETFILTER_XT_MATCH_CPU=m -+CONFIG_NETFILTER_XT_MATCH_DCCP=m -+CONFIG_NETFILTER_XT_MATCH_DEVGROUP=m -+CONFIG_NETFILTER_XT_MATCH_DSCP=m -+CONFIG_NETFILTER_XT_MATCH_ESP=m -+CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=m -+CONFIG_NETFILTER_XT_MATCH_HELPER=m -+CONFIG_NETFILTER_XT_MATCH_IPRANGE=m -+CONFIG_NETFILTER_XT_MATCH_IPVS=m -+CONFIG_NETFILTER_XT_MATCH_LENGTH=m -+CONFIG_NETFILTER_XT_MATCH_LIMIT=m -+CONFIG_NETFILTER_XT_MATCH_MAC=m -+CONFIG_NETFILTER_XT_MATCH_MARK=m -+CONFIG_NETFILTER_XT_MATCH_MULTIPORT=m -+CONFIG_NETFILTER_XT_MATCH_NFACCT=m -+CONFIG_NETFILTER_XT_MATCH_OSF=m -+CONFIG_NETFILTER_XT_MATCH_OWNER=m -+CONFIG_NETFILTER_XT_MATCH_POLICY=m -+CONFIG_NETFILTER_XT_MATCH_PHYSDEV=m -+CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m -+CONFIG_NETFILTER_XT_MATCH_QUOTA=m -+CONFIG_NETFILTER_XT_MATCH_RATEEST=m -+CONFIG_NETFILTER_XT_MATCH_REALM=m -+CONFIG_NETFILTER_XT_MATCH_RECENT=m -+CONFIG_NETFILTER_XT_MATCH_SOCKET=m -+CONFIG_NETFILTER_XT_MATCH_STATE=m -+CONFIG_NETFILTER_XT_MATCH_STATISTIC=m -+CONFIG_NETFILTER_XT_MATCH_STRING=m -+CONFIG_NETFILTER_XT_MATCH_TCPMSS=m -+CONFIG_NETFILTER_XT_MATCH_TIME=m -+CONFIG_NETFILTER_XT_MATCH_U32=m -+CONFIG_IP_SET=m -+CONFIG_IP_SET_BITMAP_IP=m -+CONFIG_IP_SET_BITMAP_IPMAC=m -+CONFIG_IP_SET_BITMAP_PORT=m -+CONFIG_IP_SET_HASH_IP=m -+CONFIG_IP_SET_HASH_IPPORT=m -+CONFIG_IP_SET_HASH_IPPORTIP=m -+CONFIG_IP_SET_HASH_IPPORTNET=m -+CONFIG_IP_SET_HASH_NET=m -+CONFIG_IP_SET_HASH_NETPORT=m -+CONFIG_IP_SET_HASH_NETIFACE=m -+CONFIG_IP_SET_LIST_SET=m -+CONFIG_IP_VS=m -+CONFIG_IP_VS_PROTO_TCP=y -+CONFIG_IP_VS_PROTO_UDP=y -+CONFIG_IP_VS_PROTO_ESP=y -+CONFIG_IP_VS_PROTO_AH=y -+CONFIG_IP_VS_PROTO_SCTP=y -+CONFIG_IP_VS_RR=m -+CONFIG_IP_VS_WRR=m -+CONFIG_IP_VS_LC=m -+CONFIG_IP_VS_WLC=m -+CONFIG_IP_VS_LBLC=m -+CONFIG_IP_VS_LBLCR=m -+CONFIG_IP_VS_DH=m -+CONFIG_IP_VS_SH=m -+CONFIG_IP_VS_SED=m -+CONFIG_IP_VS_NQ=m -+CONFIG_IP_VS_FTP=m -+CONFIG_IP_VS_PE_SIP=m -+CONFIG_NF_CONNTRACK_IPV4=m -+CONFIG_IP_NF_IPTABLES=m -+CONFIG_IP_NF_MATCH_AH=m -+CONFIG_IP_NF_MATCH_ECN=m -+CONFIG_IP_NF_MATCH_TTL=m -+CONFIG_IP_NF_FILTER=m -+CONFIG_IP_NF_TARGET_REJECT=m -+CONFIG_IP_NF_NAT=m -+CONFIG_IP_NF_TARGET_MASQUERADE=m -+CONFIG_IP_NF_TARGET_NETMAP=m -+CONFIG_IP_NF_TARGET_REDIRECT=m -+CONFIG_IP_NF_MANGLE=m -+CONFIG_IP_NF_TARGET_CLUSTERIP=m -+CONFIG_IP_NF_TARGET_ECN=m -+CONFIG_IP_NF_TARGET_TTL=m -+CONFIG_IP_NF_RAW=m -+CONFIG_IP_NF_ARPTABLES=m -+CONFIG_IP_NF_ARPFILTER=m -+CONFIG_IP_NF_ARP_MANGLE=m -+CONFIG_NF_CONNTRACK_IPV6=m -+CONFIG_IP6_NF_IPTABLES=m -+CONFIG_IP6_NF_MATCH_AH=m -+CONFIG_IP6_NF_MATCH_EUI64=m -+CONFIG_IP6_NF_MATCH_FRAG=m -+CONFIG_IP6_NF_MATCH_OPTS=m -+CONFIG_IP6_NF_MATCH_HL=m -+CONFIG_IP6_NF_MATCH_IPV6HEADER=m -+CONFIG_IP6_NF_MATCH_MH=m -+CONFIG_IP6_NF_MATCH_RT=m -+CONFIG_IP6_NF_TARGET_HL=m -+CONFIG_IP6_NF_FILTER=m -+CONFIG_IP6_NF_TARGET_REJECT=m -+CONFIG_IP6_NF_MANGLE=m -+CONFIG_IP6_NF_RAW=m -+CONFIG_IP6_NF_NAT=m -+CONFIG_IP6_NF_TARGET_MASQUERADE=m -+CONFIG_IP6_NF_TARGET_NPT=m -+CONFIG_BRIDGE_NF_EBTABLES=m -+CONFIG_BRIDGE_EBT_BROUTE=m -+CONFIG_BRIDGE_EBT_T_FILTER=m -+CONFIG_BRIDGE_EBT_T_NAT=m -+CONFIG_BRIDGE_EBT_802_3=m -+CONFIG_BRIDGE_EBT_AMONG=m -+CONFIG_BRIDGE_EBT_ARP=m -+CONFIG_BRIDGE_EBT_IP=m -+CONFIG_BRIDGE_EBT_IP6=m -+CONFIG_BRIDGE_EBT_LIMIT=m -+CONFIG_BRIDGE_EBT_MARK=m -+CONFIG_BRIDGE_EBT_PKTTYPE=m -+CONFIG_BRIDGE_EBT_STP=m -+CONFIG_BRIDGE_EBT_VLAN=m -+CONFIG_BRIDGE_EBT_ARPREPLY=m -+CONFIG_BRIDGE_EBT_DNAT=m -+CONFIG_BRIDGE_EBT_MARK_T=m -+CONFIG_BRIDGE_EBT_REDIRECT=m -+CONFIG_BRIDGE_EBT_SNAT=m -+CONFIG_BRIDGE_EBT_LOG=m -+CONFIG_BRIDGE_EBT_NFLOG=m -+CONFIG_SCTP_COOKIE_HMAC_SHA1=y -+CONFIG_ATM=m -+CONFIG_L2TP=m -+CONFIG_L2TP_V3=y -+CONFIG_L2TP_IP=m -+CONFIG_L2TP_ETH=m -+CONFIG_BRIDGE=m -+CONFIG_VLAN_8021Q=m -+CONFIG_VLAN_8021Q_GVRP=y -+CONFIG_ATALK=m -+CONFIG_6LOWPAN=m -+CONFIG_IEEE802154=m -+CONFIG_IEEE802154_6LOWPAN=m -+CONFIG_MAC802154=m -+CONFIG_NET_SCHED=y -+CONFIG_NET_SCH_CBQ=m -+CONFIG_NET_SCH_HTB=m -+CONFIG_NET_SCH_HFSC=m -+CONFIG_NET_SCH_PRIO=m -+CONFIG_NET_SCH_MULTIQ=m -+CONFIG_NET_SCH_RED=m -+CONFIG_NET_SCH_SFB=m -+CONFIG_NET_SCH_SFQ=m -+CONFIG_NET_SCH_TEQL=m -+CONFIG_NET_SCH_TBF=m -+CONFIG_NET_SCH_GRED=m -+CONFIG_NET_SCH_DSMARK=m -+CONFIG_NET_SCH_NETEM=m -+CONFIG_NET_SCH_DRR=m -+CONFIG_NET_SCH_MQPRIO=m -+CONFIG_NET_SCH_CHOKE=m -+CONFIG_NET_SCH_QFQ=m -+CONFIG_NET_SCH_CODEL=m -+CONFIG_NET_SCH_FQ_CODEL=m -+CONFIG_NET_SCH_INGRESS=m -+CONFIG_NET_SCH_PLUG=m -+CONFIG_NET_CLS_BASIC=m -+CONFIG_NET_CLS_TCINDEX=m -+CONFIG_NET_CLS_ROUTE4=m -+CONFIG_NET_CLS_FW=m -+CONFIG_NET_CLS_U32=m -+CONFIG_CLS_U32_MARK=y -+CONFIG_NET_CLS_RSVP=m -+CONFIG_NET_CLS_RSVP6=m -+CONFIG_NET_CLS_FLOW=m -+CONFIG_NET_CLS_CGROUP=m -+CONFIG_NET_EMATCH=y -+CONFIG_NET_EMATCH_CMP=m -+CONFIG_NET_EMATCH_NBYTE=m -+CONFIG_NET_EMATCH_U32=m -+CONFIG_NET_EMATCH_META=m -+CONFIG_NET_EMATCH_TEXT=m -+CONFIG_NET_EMATCH_IPSET=m -+CONFIG_NET_CLS_ACT=y -+CONFIG_NET_ACT_POLICE=m -+CONFIG_NET_ACT_GACT=m -+CONFIG_GACT_PROB=y -+CONFIG_NET_ACT_MIRRED=m -+CONFIG_NET_ACT_IPT=m -+CONFIG_NET_ACT_NAT=m -+CONFIG_NET_ACT_PEDIT=m -+CONFIG_NET_ACT_SIMP=m -+CONFIG_NET_ACT_SKBEDIT=m -+CONFIG_NET_ACT_CSUM=m -+CONFIG_BATMAN_ADV=m -+CONFIG_OPENVSWITCH=m -+CONFIG_NET_PKTGEN=m -+CONFIG_HAMRADIO=y -+CONFIG_AX25=m -+CONFIG_NETROM=m -+CONFIG_ROSE=m -+CONFIG_MKISS=m -+CONFIG_6PACK=m -+CONFIG_BPQETHER=m -+CONFIG_BAYCOM_SER_FDX=m -+CONFIG_BAYCOM_SER_HDX=m -+CONFIG_YAM=m -+CONFIG_CAN=m -+CONFIG_CAN_VCAN=m -+CONFIG_CAN_MCP251X=m -+CONFIG_IRDA=m -+CONFIG_IRLAN=m -+CONFIG_IRNET=m -+CONFIG_IRCOMM=m -+CONFIG_IRDA_ULTRA=y -+CONFIG_IRDA_CACHE_LAST_LSAP=y -+CONFIG_IRDA_FAST_RR=y -+CONFIG_IRTTY_SIR=m -+CONFIG_KINGSUN_DONGLE=m -+CONFIG_KSDAZZLE_DONGLE=m -+CONFIG_KS959_DONGLE=m -+CONFIG_USB_IRDA=m -+CONFIG_SIGMATEL_FIR=m -+CONFIG_MCS_FIR=m -+CONFIG_BT=m -+CONFIG_BT_RFCOMM=m -+CONFIG_BT_RFCOMM_TTY=y -+CONFIG_BT_BNEP=m -+CONFIG_BT_BNEP_MC_FILTER=y -+CONFIG_BT_BNEP_PROTO_FILTER=y -+CONFIG_BT_HIDP=m -+CONFIG_BT_6LOWPAN=m -+CONFIG_BT_HCIBTUSB=m -+CONFIG_BT_HCIUART=m -+CONFIG_BT_HCIBCM203X=m -+CONFIG_BT_HCIBPA10X=m -+CONFIG_BT_HCIBFUSB=m -+CONFIG_BT_HCIVHCI=m -+CONFIG_BT_MRVL=m -+CONFIG_BT_MRVL_SDIO=m -+CONFIG_BT_ATH3K=m -+CONFIG_BT_WILINK=m -+CONFIG_MAC80211=m -+CONFIG_MAC80211_MESH=y -+CONFIG_WIMAX=m -+CONFIG_RFKILL=m -+CONFIG_RFKILL_INPUT=y -+CONFIG_NET_9P=m -+CONFIG_NFC=m -+CONFIG_NFC_PN533=m -+CONFIG_DEVTMPFS=y -+CONFIG_DEVTMPFS_MOUNT=y -+CONFIG_DMA_CMA=y -+CONFIG_CMA_SIZE_MBYTES=5 -+CONFIG_MTD=m -+CONFIG_MTD_BLOCK=m -+CONFIG_MTD_NAND=m -+CONFIG_MTD_UBI=m -+CONFIG_ZRAM=m -+CONFIG_ZRAM_LZ4_COMPRESS=y -+CONFIG_BLK_DEV_LOOP=y -+CONFIG_BLK_DEV_CRYPTOLOOP=m -+CONFIG_BLK_DEV_DRBD=m -+CONFIG_BLK_DEV_NBD=m -+CONFIG_BLK_DEV_RAM=y -+CONFIG_CDROM_PKTCDVD=m -+CONFIG_ATA_OVER_ETH=m -+CONFIG_EEPROM_AT24=m -+CONFIG_TI_ST=m -+CONFIG_SCSI=y -+# CONFIG_SCSI_PROC_FS is not set -+CONFIG_BLK_DEV_SD=y -+CONFIG_CHR_DEV_ST=m -+CONFIG_CHR_DEV_OSST=m -+CONFIG_BLK_DEV_SR=m -+CONFIG_CHR_DEV_SG=m -+CONFIG_SCSI_ISCSI_ATTRS=y -+CONFIG_ISCSI_TCP=m -+CONFIG_ISCSI_BOOT_SYSFS=m -+CONFIG_MD=y -+CONFIG_MD_LINEAR=m -+CONFIG_MD_RAID0=m -+CONFIG_BLK_DEV_DM=m -+CONFIG_DM_CRYPT=m -+CONFIG_DM_SNAPSHOT=m -+CONFIG_DM_THIN_PROVISIONING=m -+CONFIG_DM_MIRROR=m -+CONFIG_DM_LOG_USERSPACE=m -+CONFIG_DM_RAID=m -+CONFIG_DM_ZERO=m -+CONFIG_DM_DELAY=m -+CONFIG_NETDEVICES=y -+CONFIG_BONDING=m -+CONFIG_DUMMY=m -+CONFIG_IFB=m -+CONFIG_MACVLAN=m -+CONFIG_NETCONSOLE=m -+CONFIG_TUN=m -+CONFIG_VETH=m -+CONFIG_ENC28J60=m -+CONFIG_MDIO_BITBANG=m -+CONFIG_PPP=m -+CONFIG_PPP_BSDCOMP=m -+CONFIG_PPP_DEFLATE=m -+CONFIG_PPP_FILTER=y -+CONFIG_PPP_MPPE=m -+CONFIG_PPP_MULTILINK=y -+CONFIG_PPPOATM=m -+CONFIG_PPPOE=m -+CONFIG_PPPOL2TP=m -+CONFIG_PPP_ASYNC=m -+CONFIG_PPP_SYNC_TTY=m -+CONFIG_SLIP=m -+CONFIG_SLIP_COMPRESSED=y -+CONFIG_SLIP_SMART=y -+CONFIG_USB_CATC=m -+CONFIG_USB_KAWETH=m -+CONFIG_USB_PEGASUS=m -+CONFIG_USB_RTL8150=m -+CONFIG_USB_RTL8152=m -+CONFIG_USB_USBNET=y -+CONFIG_USB_NET_AX8817X=m -+CONFIG_USB_NET_AX88179_178A=m -+CONFIG_USB_NET_CDCETHER=m -+CONFIG_USB_NET_CDC_EEM=m -+CONFIG_USB_NET_CDC_NCM=m -+CONFIG_USB_NET_HUAWEI_CDC_NCM=m -+CONFIG_USB_NET_CDC_MBIM=m -+CONFIG_USB_NET_DM9601=m -+CONFIG_USB_NET_SR9700=m -+CONFIG_USB_NET_SR9800=m -+CONFIG_USB_NET_SMSC75XX=m -+CONFIG_USB_NET_SMSC95XX=y -+CONFIG_USB_NET_GL620A=m -+CONFIG_USB_NET_NET1080=m -+CONFIG_USB_NET_PLUSB=m -+CONFIG_USB_NET_MCS7830=m -+CONFIG_USB_NET_CDC_SUBSET=m -+CONFIG_USB_ALI_M5632=y -+CONFIG_USB_AN2720=y -+CONFIG_USB_EPSON2888=y -+CONFIG_USB_KC2190=y -+CONFIG_USB_NET_ZAURUS=m -+CONFIG_USB_NET_CX82310_ETH=m -+CONFIG_USB_NET_KALMIA=m -+CONFIG_USB_NET_QMI_WWAN=m -+CONFIG_USB_HSO=m -+CONFIG_USB_NET_INT51X1=m -+CONFIG_USB_IPHETH=m -+CONFIG_USB_SIERRA_NET=m -+CONFIG_USB_VL600=m -+CONFIG_LIBERTAS_THINFIRM=m -+CONFIG_LIBERTAS_THINFIRM_USB=m -+CONFIG_AT76C50X_USB=m -+CONFIG_USB_ZD1201=m -+CONFIG_USB_NET_RNDIS_WLAN=m -+CONFIG_RTL8187=m -+CONFIG_MAC80211_HWSIM=m -+CONFIG_ATH_CARDS=m -+CONFIG_ATH9K=m -+CONFIG_ATH9K_HTC=m -+CONFIG_CARL9170=m -+CONFIG_ATH6KL=m -+CONFIG_ATH6KL_USB=m -+CONFIG_AR5523=m -+CONFIG_B43=m -+# CONFIG_B43_PHY_N is not set -+CONFIG_B43LEGACY=m -+CONFIG_BRCMFMAC=m -+CONFIG_BRCMFMAC_USB=y -+CONFIG_HOSTAP=m -+CONFIG_LIBERTAS=m -+CONFIG_LIBERTAS_USB=m -+CONFIG_LIBERTAS_SDIO=m -+CONFIG_P54_COMMON=m -+CONFIG_P54_USB=m -+CONFIG_RT2X00=m -+CONFIG_RT2500USB=m -+CONFIG_RT73USB=m -+CONFIG_RT2800USB=m -+CONFIG_RT2800USB_RT3573=y -+CONFIG_RT2800USB_RT53XX=y -+CONFIG_RT2800USB_RT55XX=y -+CONFIG_RT2800USB_UNKNOWN=y -+CONFIG_WL_MEDIATEK=y -+CONFIG_MT7601U=m -+CONFIG_RTL8192CU=m -+CONFIG_ZD1211RW=m -+CONFIG_MWIFIEX=m -+CONFIG_MWIFIEX_SDIO=m -+CONFIG_WIMAX_I2400M_USB=m -+CONFIG_IEEE802154_AT86RF230=m -+CONFIG_IEEE802154_MRF24J40=m -+CONFIG_IEEE802154_CC2520=m -+CONFIG_INPUT_POLLDEV=m -+# CONFIG_INPUT_MOUSEDEV_PSAUX is not set -+CONFIG_INPUT_JOYDEV=m -+CONFIG_INPUT_EVDEV=m -+# CONFIG_KEYBOARD_ATKBD is not set -+CONFIG_KEYBOARD_GPIO=m -+# CONFIG_INPUT_MOUSE is not set -+CONFIG_INPUT_JOYSTICK=y -+CONFIG_JOYSTICK_IFORCE=m -+CONFIG_JOYSTICK_IFORCE_USB=y -+CONFIG_JOYSTICK_XPAD=m -+CONFIG_JOYSTICK_XPAD_FF=y -+CONFIG_JOYSTICK_RPISENSE=m -+CONFIG_INPUT_TOUCHSCREEN=y -+CONFIG_TOUCHSCREEN_ADS7846=m -+CONFIG_TOUCHSCREEN_EGALAX=m -+CONFIG_TOUCHSCREEN_FT6236=m -+CONFIG_TOUCHSCREEN_RPI_FT5406=m -+CONFIG_TOUCHSCREEN_USB_COMPOSITE=m -+CONFIG_TOUCHSCREEN_STMPE=m -+CONFIG_INPUT_MISC=y -+CONFIG_INPUT_AD714X=m -+CONFIG_INPUT_ATI_REMOTE2=m -+CONFIG_INPUT_KEYSPAN_REMOTE=m -+CONFIG_INPUT_POWERMATE=m -+CONFIG_INPUT_YEALINK=m -+CONFIG_INPUT_CM109=m -+CONFIG_INPUT_UINPUT=m -+CONFIG_INPUT_GPIO_ROTARY_ENCODER=m -+CONFIG_INPUT_ADXL34X=m -+CONFIG_INPUT_CMA3000=m -+CONFIG_SERIO=m -+CONFIG_SERIO_RAW=m -+CONFIG_GAMEPORT=m -+CONFIG_GAMEPORT_NS558=m -+CONFIG_GAMEPORT_L4=m -+CONFIG_BRCM_CHAR_DRIVERS=y -+CONFIG_BCM_VC_CMA=y -+CONFIG_BCM_VCIO=y -+CONFIG_BCM_VC_SM=y -+CONFIG_DEVPTS_MULTIPLE_INSTANCES=y -+# CONFIG_LEGACY_PTYS is not set -+# CONFIG_DEVKMEM is not set -+CONFIG_SERIAL_8250=y -+# CONFIG_SERIAL_8250_DEPRECATED_OPTIONS is not set -+CONFIG_SERIAL_8250_CONSOLE=y -+# CONFIG_SERIAL_8250_DMA is not set -+CONFIG_SERIAL_8250_NR_UARTS=1 -+CONFIG_SERIAL_8250_RUNTIME_UARTS=0 -+CONFIG_SERIAL_AMBA_PL011=y -+CONFIG_SERIAL_AMBA_PL011_CONSOLE=y -+CONFIG_SERIAL_OF_PLATFORM=y -+CONFIG_TTY_PRINTK=y -+CONFIG_HW_RANDOM=y -+CONFIG_RAW_DRIVER=y -+CONFIG_I2C=y -+CONFIG_I2C_CHARDEV=m -+CONFIG_I2C_BCM2708=m -+CONFIG_SPI=y -+CONFIG_SPI_BCM2835=m -+CONFIG_SPI_SPIDEV=y -+CONFIG_PPS=m -+CONFIG_PPS_CLIENT_LDISC=m -+CONFIG_PPS_CLIENT_GPIO=m -+CONFIG_GPIO_SYSFS=y -+CONFIG_GPIO_ARIZONA=m -+CONFIG_GPIO_STMPE=y -+CONFIG_W1=m -+CONFIG_W1_MASTER_DS2490=m -+CONFIG_W1_MASTER_DS2482=m -+CONFIG_W1_MASTER_DS1WM=m -+CONFIG_W1_MASTER_GPIO=m -+CONFIG_W1_SLAVE_THERM=m -+CONFIG_W1_SLAVE_SMEM=m -+CONFIG_W1_SLAVE_DS2408=m -+CONFIG_W1_SLAVE_DS2413=m -+CONFIG_W1_SLAVE_DS2406=m -+CONFIG_W1_SLAVE_DS2423=m -+CONFIG_W1_SLAVE_DS2431=m -+CONFIG_W1_SLAVE_DS2433=m -+CONFIG_W1_SLAVE_DS2760=m -+CONFIG_W1_SLAVE_DS2780=m -+CONFIG_W1_SLAVE_DS2781=m -+CONFIG_W1_SLAVE_DS28E04=m -+CONFIG_W1_SLAVE_BQ27000=m -+CONFIG_BATTERY_DS2760=m -+CONFIG_POWER_RESET=y -+CONFIG_POWER_RESET_GPIO=y -+CONFIG_HWMON=m -+CONFIG_SENSORS_SHT21=m -+CONFIG_SENSORS_SHTC1=m -+CONFIG_THERMAL=y -+CONFIG_THERMAL_BCM2835=y -+CONFIG_WATCHDOG=y -+CONFIG_BCM2835_WDT=m -+CONFIG_UCB1400_CORE=m -+CONFIG_MFD_STMPE=y -+CONFIG_STMPE_SPI=y -+CONFIG_MFD_ARIZONA_I2C=m -+CONFIG_MFD_ARIZONA_SPI=m -+CONFIG_MFD_WM5102=y -+CONFIG_MEDIA_SUPPORT=m -+CONFIG_MEDIA_CAMERA_SUPPORT=y -+CONFIG_MEDIA_ANALOG_TV_SUPPORT=y -+CONFIG_MEDIA_DIGITAL_TV_SUPPORT=y -+CONFIG_MEDIA_RADIO_SUPPORT=y -+CONFIG_MEDIA_RC_SUPPORT=y -+CONFIG_MEDIA_CONTROLLER=y -+CONFIG_LIRC=m -+CONFIG_RC_DEVICES=y -+CONFIG_RC_ATI_REMOTE=m -+CONFIG_IR_IMON=m -+CONFIG_IR_MCEUSB=m -+CONFIG_IR_REDRAT3=m -+CONFIG_IR_STREAMZAP=m -+CONFIG_IR_IGUANA=m -+CONFIG_IR_TTUSBIR=m -+CONFIG_RC_LOOPBACK=m -+CONFIG_IR_GPIO_CIR=m -+CONFIG_MEDIA_USB_SUPPORT=y -+CONFIG_USB_VIDEO_CLASS=m -+CONFIG_USB_M5602=m -+CONFIG_USB_STV06XX=m -+CONFIG_USB_GL860=m -+CONFIG_USB_GSPCA_BENQ=m -+CONFIG_USB_GSPCA_CONEX=m -+CONFIG_USB_GSPCA_CPIA1=m -+CONFIG_USB_GSPCA_DTCS033=m -+CONFIG_USB_GSPCA_ETOMS=m -+CONFIG_USB_GSPCA_FINEPIX=m -+CONFIG_USB_GSPCA_JEILINJ=m -+CONFIG_USB_GSPCA_JL2005BCD=m -+CONFIG_USB_GSPCA_KINECT=m -+CONFIG_USB_GSPCA_KONICA=m -+CONFIG_USB_GSPCA_MARS=m -+CONFIG_USB_GSPCA_MR97310A=m -+CONFIG_USB_GSPCA_NW80X=m -+CONFIG_USB_GSPCA_OV519=m -+CONFIG_USB_GSPCA_OV534=m -+CONFIG_USB_GSPCA_OV534_9=m -+CONFIG_USB_GSPCA_PAC207=m -+CONFIG_USB_GSPCA_PAC7302=m -+CONFIG_USB_GSPCA_PAC7311=m -+CONFIG_USB_GSPCA_SE401=m -+CONFIG_USB_GSPCA_SN9C2028=m -+CONFIG_USB_GSPCA_SN9C20X=m -+CONFIG_USB_GSPCA_SONIXB=m -+CONFIG_USB_GSPCA_SONIXJ=m -+CONFIG_USB_GSPCA_SPCA500=m -+CONFIG_USB_GSPCA_SPCA501=m -+CONFIG_USB_GSPCA_SPCA505=m -+CONFIG_USB_GSPCA_SPCA506=m -+CONFIG_USB_GSPCA_SPCA508=m -+CONFIG_USB_GSPCA_SPCA561=m -+CONFIG_USB_GSPCA_SPCA1528=m -+CONFIG_USB_GSPCA_SQ905=m -+CONFIG_USB_GSPCA_SQ905C=m -+CONFIG_USB_GSPCA_SQ930X=m -+CONFIG_USB_GSPCA_STK014=m -+CONFIG_USB_GSPCA_STK1135=m -+CONFIG_USB_GSPCA_STV0680=m -+CONFIG_USB_GSPCA_SUNPLUS=m -+CONFIG_USB_GSPCA_T613=m -+CONFIG_USB_GSPCA_TOPRO=m -+CONFIG_USB_GSPCA_TV8532=m -+CONFIG_USB_GSPCA_VC032X=m -+CONFIG_USB_GSPCA_VICAM=m -+CONFIG_USB_GSPCA_XIRLINK_CIT=m -+CONFIG_USB_GSPCA_ZC3XX=m -+CONFIG_USB_PWC=m -+CONFIG_VIDEO_CPIA2=m -+CONFIG_USB_ZR364XX=m -+CONFIG_USB_STKWEBCAM=m -+CONFIG_USB_S2255=m -+CONFIG_VIDEO_USBTV=m -+CONFIG_VIDEO_PVRUSB2=m -+CONFIG_VIDEO_HDPVR=m -+CONFIG_VIDEO_USBVISION=m -+CONFIG_VIDEO_STK1160_COMMON=m -+CONFIG_VIDEO_STK1160_AC97=y -+CONFIG_VIDEO_GO7007=m -+CONFIG_VIDEO_GO7007_USB=m -+CONFIG_VIDEO_GO7007_USB_S2250_BOARD=m -+CONFIG_VIDEO_AU0828=m -+CONFIG_VIDEO_AU0828_RC=y -+CONFIG_VIDEO_CX231XX=m -+CONFIG_VIDEO_CX231XX_ALSA=m -+CONFIG_VIDEO_CX231XX_DVB=m -+CONFIG_VIDEO_TM6000=m -+CONFIG_VIDEO_TM6000_ALSA=m -+CONFIG_VIDEO_TM6000_DVB=m -+CONFIG_DVB_USB=m -+CONFIG_DVB_USB_A800=m -+CONFIG_DVB_USB_DIBUSB_MB=m -+CONFIG_DVB_USB_DIBUSB_MB_FAULTY=y -+CONFIG_DVB_USB_DIBUSB_MC=m -+CONFIG_DVB_USB_DIB0700=m -+CONFIG_DVB_USB_UMT_010=m -+CONFIG_DVB_USB_CXUSB=m -+CONFIG_DVB_USB_M920X=m -+CONFIG_DVB_USB_DIGITV=m -+CONFIG_DVB_USB_VP7045=m -+CONFIG_DVB_USB_VP702X=m -+CONFIG_DVB_USB_GP8PSK=m -+CONFIG_DVB_USB_NOVA_T_USB2=m -+CONFIG_DVB_USB_TTUSB2=m -+CONFIG_DVB_USB_DTT200U=m -+CONFIG_DVB_USB_OPERA1=m -+CONFIG_DVB_USB_AF9005=m -+CONFIG_DVB_USB_AF9005_REMOTE=m -+CONFIG_DVB_USB_PCTV452E=m -+CONFIG_DVB_USB_DW2102=m -+CONFIG_DVB_USB_CINERGY_T2=m -+CONFIG_DVB_USB_DTV5100=m -+CONFIG_DVB_USB_FRIIO=m -+CONFIG_DVB_USB_AZ6027=m -+CONFIG_DVB_USB_TECHNISAT_USB2=m -+CONFIG_DVB_USB_V2=m -+CONFIG_DVB_USB_AF9015=m -+CONFIG_DVB_USB_AF9035=m -+CONFIG_DVB_USB_ANYSEE=m -+CONFIG_DVB_USB_AU6610=m -+CONFIG_DVB_USB_AZ6007=m -+CONFIG_DVB_USB_CE6230=m -+CONFIG_DVB_USB_EC168=m -+CONFIG_DVB_USB_GL861=m -+CONFIG_DVB_USB_LME2510=m -+CONFIG_DVB_USB_MXL111SF=m -+CONFIG_DVB_USB_RTL28XXU=m -+CONFIG_DVB_USB_DVBSKY=m -+CONFIG_SMS_USB_DRV=m -+CONFIG_DVB_B2C2_FLEXCOP_USB=m -+CONFIG_DVB_AS102=m -+CONFIG_VIDEO_EM28XX=m -+CONFIG_VIDEO_EM28XX_V4L2=m -+CONFIG_VIDEO_EM28XX_ALSA=m -+CONFIG_VIDEO_EM28XX_DVB=m -+CONFIG_V4L_PLATFORM_DRIVERS=y -+CONFIG_VIDEO_BCM2835=y -+CONFIG_VIDEO_BCM2835_MMAL=m -+CONFIG_RADIO_SI470X=y -+CONFIG_USB_SI470X=m -+CONFIG_I2C_SI470X=m -+CONFIG_RADIO_SI4713=m -+CONFIG_I2C_SI4713=m -+CONFIG_USB_MR800=m -+CONFIG_USB_DSBR=m -+CONFIG_RADIO_SHARK=m -+CONFIG_RADIO_SHARK2=m -+CONFIG_USB_KEENE=m -+CONFIG_USB_MA901=m -+CONFIG_RADIO_TEA5764=m -+CONFIG_RADIO_SAA7706H=m -+CONFIG_RADIO_TEF6862=m -+CONFIG_RADIO_WL1273=m -+CONFIG_RADIO_WL128X=m -+# CONFIG_MEDIA_SUBDRV_AUTOSELECT is not set -+CONFIG_VIDEO_UDA1342=m -+CONFIG_VIDEO_SONY_BTF_MPX=m -+CONFIG_VIDEO_TVP5150=m -+CONFIG_VIDEO_TW2804=m -+CONFIG_VIDEO_TW9903=m -+CONFIG_VIDEO_TW9906=m -+CONFIG_VIDEO_OV7640=m -+CONFIG_VIDEO_MT9V011=m -+CONFIG_FB=y -+CONFIG_FB_BCM2708=y -+CONFIG_FB_UDL=m -+CONFIG_FB_SSD1307=m -+CONFIG_FB_RPISENSE=m -+# CONFIG_BACKLIGHT_GENERIC is not set -+CONFIG_BACKLIGHT_GPIO=m -+CONFIG_FRAMEBUFFER_CONSOLE=y -+CONFIG_LOGO=y -+# CONFIG_LOGO_LINUX_MONO is not set -+# CONFIG_LOGO_LINUX_VGA16 is not set -+CONFIG_SOUND=y -+CONFIG_SND=m -+CONFIG_SND_SEQUENCER=m -+CONFIG_SND_SEQ_DUMMY=m -+CONFIG_SND_MIXER_OSS=m -+CONFIG_SND_PCM_OSS=m -+CONFIG_SND_SEQUENCER_OSS=y -+CONFIG_SND_HRTIMER=m -+CONFIG_SND_DUMMY=m -+CONFIG_SND_ALOOP=m -+CONFIG_SND_VIRMIDI=m -+CONFIG_SND_MTPAV=m -+CONFIG_SND_SERIAL_U16550=m -+CONFIG_SND_MPU401=m -+CONFIG_SND_BCM2835=m -+CONFIG_SND_USB_AUDIO=m -+CONFIG_SND_USB_UA101=m -+CONFIG_SND_USB_CAIAQ=m -+CONFIG_SND_USB_CAIAQ_INPUT=y -+CONFIG_SND_USB_6FIRE=m -+CONFIG_SND_SOC=m -+CONFIG_SND_BCM2835_SOC_I2S=m -+CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC=m -+CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS=m -+CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI=m -+CONFIG_SND_BCM2708_SOC_HIFIBERRY_AMP=m -+CONFIG_SND_BCM2708_SOC_RPI_DAC=m -+CONFIG_SND_BCM2708_SOC_RPI_PROTO=m -+CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC=m -+CONFIG_SND_BCM2708_SOC_RASPIDAC3=m -+CONFIG_SND_SOC_ADAU1701=m -+CONFIG_SND_SOC_WM8804_I2C=m -+CONFIG_SND_SIMPLE_CARD=m -+CONFIG_SOUND_PRIME=m -+CONFIG_HIDRAW=y -+CONFIG_UHID=m -+CONFIG_HID_A4TECH=m -+CONFIG_HID_ACRUX=m -+CONFIG_HID_APPLE=m -+CONFIG_HID_BELKIN=m -+CONFIG_HID_CHERRY=m -+CONFIG_HID_CHICONY=m -+CONFIG_HID_CYPRESS=m -+CONFIG_HID_DRAGONRISE=m -+CONFIG_HID_EMS_FF=m -+CONFIG_HID_ELECOM=m -+CONFIG_HID_ELO=m -+CONFIG_HID_EZKEY=m -+CONFIG_HID_HOLTEK=m -+CONFIG_HID_KEYTOUCH=m -+CONFIG_HID_KYE=m -+CONFIG_HID_UCLOGIC=m -+CONFIG_HID_WALTOP=m -+CONFIG_HID_GYRATION=m -+CONFIG_HID_TWINHAN=m -+CONFIG_HID_KENSINGTON=m -+CONFIG_HID_LCPOWER=m -+CONFIG_HID_LOGITECH=m -+CONFIG_HID_MAGICMOUSE=m -+CONFIG_HID_MICROSOFT=m -+CONFIG_HID_MONTEREY=m -+CONFIG_HID_MULTITOUCH=m -+CONFIG_HID_NTRIG=m -+CONFIG_HID_ORTEK=m -+CONFIG_HID_PANTHERLORD=m -+CONFIG_HID_PETALYNX=m -+CONFIG_HID_PICOLCD=m -+CONFIG_HID_ROCCAT=m -+CONFIG_HID_SAMSUNG=m -+CONFIG_HID_SONY=m -+CONFIG_HID_SPEEDLINK=m -+CONFIG_HID_SUNPLUS=m -+CONFIG_HID_GREENASIA=m -+CONFIG_HID_SMARTJOYPLUS=m -+CONFIG_HID_TOPSEED=m -+CONFIG_HID_THINGM=m -+CONFIG_HID_THRUSTMASTER=m -+CONFIG_HID_WACOM=m -+CONFIG_HID_WIIMOTE=m -+CONFIG_HID_XINMO=m -+CONFIG_HID_ZEROPLUS=m -+CONFIG_HID_ZYDACRON=m -+CONFIG_HID_PID=y -+CONFIG_USB_HIDDEV=y -+CONFIG_USB=y -+CONFIG_USB_ANNOUNCE_NEW_DEVICES=y -+CONFIG_USB_MON=m -+CONFIG_USB_DWCOTG=y -+CONFIG_USB_PRINTER=m -+CONFIG_USB_STORAGE=y -+CONFIG_USB_STORAGE_REALTEK=m -+CONFIG_USB_STORAGE_DATAFAB=m -+CONFIG_USB_STORAGE_FREECOM=m -+CONFIG_USB_STORAGE_ISD200=m -+CONFIG_USB_STORAGE_USBAT=m -+CONFIG_USB_STORAGE_SDDR09=m -+CONFIG_USB_STORAGE_SDDR55=m -+CONFIG_USB_STORAGE_JUMPSHOT=m -+CONFIG_USB_STORAGE_ALAUDA=m -+CONFIG_USB_STORAGE_ONETOUCH=m -+CONFIG_USB_STORAGE_KARMA=m -+CONFIG_USB_STORAGE_CYPRESS_ATACB=m -+CONFIG_USB_STORAGE_ENE_UB6250=m -+CONFIG_USB_MDC800=m -+CONFIG_USB_MICROTEK=m -+CONFIG_USBIP_CORE=m -+CONFIG_USBIP_VHCI_HCD=m -+CONFIG_USBIP_HOST=m -+CONFIG_USB_DWC2=m -+CONFIG_USB_SERIAL=m -+CONFIG_USB_SERIAL_GENERIC=y -+CONFIG_USB_SERIAL_AIRCABLE=m -+CONFIG_USB_SERIAL_ARK3116=m -+CONFIG_USB_SERIAL_BELKIN=m -+CONFIG_USB_SERIAL_CH341=m -+CONFIG_USB_SERIAL_WHITEHEAT=m -+CONFIG_USB_SERIAL_DIGI_ACCELEPORT=m -+CONFIG_USB_SERIAL_CP210X=m -+CONFIG_USB_SERIAL_CYPRESS_M8=m -+CONFIG_USB_SERIAL_EMPEG=m -+CONFIG_USB_SERIAL_FTDI_SIO=m -+CONFIG_USB_SERIAL_VISOR=m -+CONFIG_USB_SERIAL_IPAQ=m -+CONFIG_USB_SERIAL_IR=m -+CONFIG_USB_SERIAL_EDGEPORT=m -+CONFIG_USB_SERIAL_EDGEPORT_TI=m -+CONFIG_USB_SERIAL_F81232=m -+CONFIG_USB_SERIAL_GARMIN=m -+CONFIG_USB_SERIAL_IPW=m -+CONFIG_USB_SERIAL_IUU=m -+CONFIG_USB_SERIAL_KEYSPAN_PDA=m -+CONFIG_USB_SERIAL_KEYSPAN=m -+CONFIG_USB_SERIAL_KLSI=m -+CONFIG_USB_SERIAL_KOBIL_SCT=m -+CONFIG_USB_SERIAL_MCT_U232=m -+CONFIG_USB_SERIAL_METRO=m -+CONFIG_USB_SERIAL_MOS7720=m -+CONFIG_USB_SERIAL_MOS7840=m -+CONFIG_USB_SERIAL_NAVMAN=m -+CONFIG_USB_SERIAL_PL2303=m -+CONFIG_USB_SERIAL_OTI6858=m -+CONFIG_USB_SERIAL_QCAUX=m -+CONFIG_USB_SERIAL_QUALCOMM=m -+CONFIG_USB_SERIAL_SPCP8X5=m -+CONFIG_USB_SERIAL_SAFE=m -+CONFIG_USB_SERIAL_SIERRAWIRELESS=m -+CONFIG_USB_SERIAL_SYMBOL=m -+CONFIG_USB_SERIAL_TI=m -+CONFIG_USB_SERIAL_CYBERJACK=m -+CONFIG_USB_SERIAL_XIRCOM=m -+CONFIG_USB_SERIAL_OPTION=m -+CONFIG_USB_SERIAL_OMNINET=m -+CONFIG_USB_SERIAL_OPTICON=m -+CONFIG_USB_SERIAL_XSENS_MT=m -+CONFIG_USB_SERIAL_WISHBONE=m -+CONFIG_USB_SERIAL_SSU100=m -+CONFIG_USB_SERIAL_QT2=m -+CONFIG_USB_SERIAL_DEBUG=m -+CONFIG_USB_EMI62=m -+CONFIG_USB_EMI26=m -+CONFIG_USB_ADUTUX=m -+CONFIG_USB_SEVSEG=m -+CONFIG_USB_RIO500=m -+CONFIG_USB_LEGOTOWER=m -+CONFIG_USB_LCD=m -+CONFIG_USB_LED=m -+CONFIG_USB_CYPRESS_CY7C63=m -+CONFIG_USB_CYTHERM=m -+CONFIG_USB_IDMOUSE=m -+CONFIG_USB_FTDI_ELAN=m -+CONFIG_USB_APPLEDISPLAY=m -+CONFIG_USB_LD=m -+CONFIG_USB_TRANCEVIBRATOR=m -+CONFIG_USB_IOWARRIOR=m -+CONFIG_USB_TEST=m -+CONFIG_USB_ISIGHTFW=m -+CONFIG_USB_YUREX=m -+CONFIG_USB_ATM=m -+CONFIG_USB_SPEEDTOUCH=m -+CONFIG_USB_CXACRU=m -+CONFIG_USB_UEAGLEATM=m -+CONFIG_USB_XUSBATM=m -+CONFIG_USB_GADGET=m -+CONFIG_USB_ZERO=m -+CONFIG_USB_AUDIO=m -+CONFIG_USB_ETH=m -+CONFIG_USB_GADGETFS=m -+CONFIG_USB_MASS_STORAGE=m -+CONFIG_USB_G_SERIAL=m -+CONFIG_USB_MIDI_GADGET=m -+CONFIG_USB_G_PRINTER=m -+CONFIG_USB_CDC_COMPOSITE=m -+CONFIG_USB_G_ACM_MS=m -+CONFIG_USB_G_MULTI=m -+CONFIG_USB_G_HID=m -+CONFIG_USB_G_WEBCAM=m -+CONFIG_MMC=y -+CONFIG_MMC_BLOCK_MINORS=32 -+CONFIG_MMC_BCM2835=y -+CONFIG_MMC_BCM2835_DMA=y -+CONFIG_MMC_BCM2835_SDHOST=y -+CONFIG_MMC_SDHCI=y -+CONFIG_MMC_SDHCI_PLTFM=y -+CONFIG_MMC_SPI=m -+CONFIG_LEDS_CLASS=y -+CONFIG_LEDS_GPIO=y -+CONFIG_LEDS_TRIGGER_TIMER=y -+CONFIG_LEDS_TRIGGER_ONESHOT=y -+CONFIG_LEDS_TRIGGER_HEARTBEAT=y -+CONFIG_LEDS_TRIGGER_BACKLIGHT=y -+CONFIG_LEDS_TRIGGER_CPU=y -+CONFIG_LEDS_TRIGGER_GPIO=y -+CONFIG_LEDS_TRIGGER_DEFAULT_ON=y -+CONFIG_LEDS_TRIGGER_TRANSIENT=m -+CONFIG_LEDS_TRIGGER_CAMERA=m -+CONFIG_LEDS_TRIGGER_INPUT=y -+CONFIG_RTC_CLASS=y -+# CONFIG_RTC_HCTOSYS is not set -+CONFIG_RTC_DRV_DS1307=m -+CONFIG_RTC_DRV_DS1374=m -+CONFIG_RTC_DRV_DS1672=m -+CONFIG_RTC_DRV_DS3232=m -+CONFIG_RTC_DRV_MAX6900=m -+CONFIG_RTC_DRV_RS5C372=m -+CONFIG_RTC_DRV_ISL1208=m -+CONFIG_RTC_DRV_ISL12022=m -+CONFIG_RTC_DRV_ISL12057=m -+CONFIG_RTC_DRV_X1205=m -+CONFIG_RTC_DRV_PCF2127=m -+CONFIG_RTC_DRV_PCF8523=m -+CONFIG_RTC_DRV_PCF8563=m -+CONFIG_RTC_DRV_PCF8583=m -+CONFIG_RTC_DRV_M41T80=m -+CONFIG_RTC_DRV_BQ32K=m -+CONFIG_RTC_DRV_S35390A=m -+CONFIG_RTC_DRV_FM3130=m -+CONFIG_RTC_DRV_RX8581=m -+CONFIG_RTC_DRV_RX8025=m -+CONFIG_RTC_DRV_EM3027=m -+CONFIG_RTC_DRV_RV3029C2=m -+CONFIG_RTC_DRV_M41T93=m -+CONFIG_RTC_DRV_M41T94=m -+CONFIG_RTC_DRV_DS1305=m -+CONFIG_RTC_DRV_DS1390=m -+CONFIG_RTC_DRV_MAX6902=m -+CONFIG_RTC_DRV_R9701=m -+CONFIG_RTC_DRV_RS5C348=m -+CONFIG_RTC_DRV_DS3234=m -+CONFIG_RTC_DRV_PCF2123=m -+CONFIG_RTC_DRV_RX4581=m -+CONFIG_DMADEVICES=y -+CONFIG_DMA_BCM2835=y -+CONFIG_DMA_BCM2708=y -+CONFIG_UIO=m -+CONFIG_UIO_PDRV_GENIRQ=m -+CONFIG_STAGING=y -+CONFIG_PRISM2_USB=m -+CONFIG_R8712U=m -+CONFIG_R8188EU=m -+CONFIG_R8723AU=m -+CONFIG_VT6656=m -+CONFIG_SPEAKUP=m -+CONFIG_SPEAKUP_SYNTH_SOFT=m -+CONFIG_STAGING_MEDIA=y -+CONFIG_LIRC_STAGING=y -+CONFIG_LIRC_IMON=m -+CONFIG_LIRC_RPI=m -+CONFIG_LIRC_SASEM=m -+CONFIG_LIRC_SERIAL=m -+CONFIG_FB_TFT=m -+CONFIG_FB_TFT_AGM1264K_FL=m -+CONFIG_FB_TFT_BD663474=m -+CONFIG_FB_TFT_HX8340BN=m -+CONFIG_FB_TFT_HX8347D=m -+CONFIG_FB_TFT_HX8353D=m -+CONFIG_FB_TFT_ILI9163=m -+CONFIG_FB_TFT_ILI9320=m -+CONFIG_FB_TFT_ILI9325=m -+CONFIG_FB_TFT_ILI9340=m -+CONFIG_FB_TFT_ILI9341=m -+CONFIG_FB_TFT_ILI9481=m -+CONFIG_FB_TFT_ILI9486=m -+CONFIG_FB_TFT_PCD8544=m -+CONFIG_FB_TFT_RA8875=m -+CONFIG_FB_TFT_S6D02A1=m -+CONFIG_FB_TFT_S6D1121=m -+CONFIG_FB_TFT_SSD1289=m -+CONFIG_FB_TFT_SSD1306=m -+CONFIG_FB_TFT_SSD1331=m -+CONFIG_FB_TFT_SSD1351=m -+CONFIG_FB_TFT_ST7735R=m -+CONFIG_FB_TFT_TINYLCD=m -+CONFIG_FB_TFT_TLS8204=m -+CONFIG_FB_TFT_UC1701=m -+CONFIG_FB_TFT_UPD161704=m -+CONFIG_FB_TFT_WATTEROTT=m -+CONFIG_FB_FLEX=m -+CONFIG_FB_TFT_FBTFT_DEVICE=m -+CONFIG_MAILBOX=y -+CONFIG_BCM2835_MBOX=y -+# CONFIG_IOMMU_SUPPORT is not set -+CONFIG_EXTCON=m -+CONFIG_EXTCON_ARIZONA=m -+CONFIG_IIO=m -+CONFIG_IIO_BUFFER=y -+CONFIG_IIO_BUFFER_CB=m -+CONFIG_IIO_KFIFO_BUF=m -+CONFIG_MCP320X=m -+CONFIG_DHT11=m -+CONFIG_PWM_BCM2835=m -+CONFIG_RASPBERRYPI_FIRMWARE=y -+CONFIG_EXT4_FS=y -+CONFIG_EXT4_FS_POSIX_ACL=y -+CONFIG_EXT4_FS_SECURITY=y -+CONFIG_REISERFS_FS=m -+CONFIG_REISERFS_FS_XATTR=y -+CONFIG_REISERFS_FS_POSIX_ACL=y -+CONFIG_REISERFS_FS_SECURITY=y -+CONFIG_JFS_FS=m -+CONFIG_JFS_POSIX_ACL=y -+CONFIG_JFS_SECURITY=y -+CONFIG_JFS_STATISTICS=y -+CONFIG_XFS_FS=m -+CONFIG_XFS_QUOTA=y -+CONFIG_XFS_POSIX_ACL=y -+CONFIG_XFS_RT=y -+CONFIG_GFS2_FS=m -+CONFIG_OCFS2_FS=m -+CONFIG_BTRFS_FS=m -+CONFIG_BTRFS_FS_POSIX_ACL=y -+CONFIG_NILFS2_FS=m -+CONFIG_F2FS_FS=y -+CONFIG_FANOTIFY=y -+CONFIG_QFMT_V1=m -+CONFIG_QFMT_V2=m -+CONFIG_AUTOFS4_FS=y -+CONFIG_FUSE_FS=m -+CONFIG_CUSE=m -+CONFIG_OVERLAY_FS=m -+CONFIG_FSCACHE=y -+CONFIG_FSCACHE_STATS=y -+CONFIG_FSCACHE_HISTOGRAM=y -+CONFIG_CACHEFILES=y -+CONFIG_ISO9660_FS=m -+CONFIG_JOLIET=y -+CONFIG_ZISOFS=y -+CONFIG_UDF_FS=m -+CONFIG_MSDOS_FS=y -+CONFIG_VFAT_FS=y -+CONFIG_FAT_DEFAULT_IOCHARSET="ascii" -+CONFIG_NTFS_FS=m -+CONFIG_NTFS_RW=y -+CONFIG_TMPFS=y -+CONFIG_TMPFS_POSIX_ACL=y -+CONFIG_CONFIGFS_FS=y -+CONFIG_ECRYPT_FS=m -+CONFIG_HFS_FS=m -+CONFIG_HFSPLUS_FS=m -+CONFIG_JFFS2_FS=m -+CONFIG_JFFS2_SUMMARY=y -+CONFIG_UBIFS_FS=m -+CONFIG_SQUASHFS=m -+CONFIG_SQUASHFS_XATTR=y -+CONFIG_SQUASHFS_LZO=y -+CONFIG_SQUASHFS_XZ=y -+CONFIG_NFS_FS=y -+CONFIG_NFS_V3_ACL=y -+CONFIG_NFS_V4=y -+CONFIG_NFS_SWAP=y -+CONFIG_ROOT_NFS=y -+CONFIG_NFS_FSCACHE=y -+CONFIG_NFSD=m -+CONFIG_NFSD_V3_ACL=y -+CONFIG_NFSD_V4=y -+CONFIG_CIFS=m -+CONFIG_CIFS_WEAK_PW_HASH=y -+CONFIG_CIFS_UPCALL=y -+CONFIG_CIFS_XATTR=y -+CONFIG_CIFS_POSIX=y -+CONFIG_CIFS_ACL=y -+CONFIG_CIFS_DFS_UPCALL=y -+CONFIG_CIFS_SMB2=y -+CONFIG_CIFS_FSCACHE=y -+CONFIG_9P_FS=m -+CONFIG_9P_FS_POSIX_ACL=y -+CONFIG_NLS_DEFAULT="utf8" -+CONFIG_NLS_CODEPAGE_437=y -+CONFIG_NLS_CODEPAGE_737=m -+CONFIG_NLS_CODEPAGE_775=m -+CONFIG_NLS_CODEPAGE_850=m -+CONFIG_NLS_CODEPAGE_852=m -+CONFIG_NLS_CODEPAGE_855=m -+CONFIG_NLS_CODEPAGE_857=m -+CONFIG_NLS_CODEPAGE_860=m -+CONFIG_NLS_CODEPAGE_861=m -+CONFIG_NLS_CODEPAGE_862=m -+CONFIG_NLS_CODEPAGE_863=m -+CONFIG_NLS_CODEPAGE_864=m -+CONFIG_NLS_CODEPAGE_865=m -+CONFIG_NLS_CODEPAGE_866=m -+CONFIG_NLS_CODEPAGE_869=m -+CONFIG_NLS_CODEPAGE_936=m -+CONFIG_NLS_CODEPAGE_950=m -+CONFIG_NLS_CODEPAGE_932=m -+CONFIG_NLS_CODEPAGE_949=m -+CONFIG_NLS_CODEPAGE_874=m -+CONFIG_NLS_ISO8859_8=m -+CONFIG_NLS_CODEPAGE_1250=m -+CONFIG_NLS_CODEPAGE_1251=m -+CONFIG_NLS_ASCII=y -+CONFIG_NLS_ISO8859_1=m -+CONFIG_NLS_ISO8859_2=m -+CONFIG_NLS_ISO8859_3=m -+CONFIG_NLS_ISO8859_4=m -+CONFIG_NLS_ISO8859_5=m -+CONFIG_NLS_ISO8859_6=m -+CONFIG_NLS_ISO8859_7=m -+CONFIG_NLS_ISO8859_9=m -+CONFIG_NLS_ISO8859_13=m -+CONFIG_NLS_ISO8859_14=m -+CONFIG_NLS_ISO8859_15=m -+CONFIG_NLS_KOI8_R=m -+CONFIG_NLS_KOI8_U=m -+CONFIG_DLM=m -+CONFIG_PRINTK_TIME=y -+CONFIG_BOOT_PRINTK_DELAY=y -+CONFIG_DEBUG_MEMORY_INIT=y -+CONFIG_DETECT_HUNG_TASK=y -+CONFIG_TIMER_STATS=y -+CONFIG_LATENCYTOP=y -+CONFIG_IRQSOFF_TRACER=y -+CONFIG_SCHED_TRACER=y -+CONFIG_STACK_TRACER=y -+CONFIG_BLK_DEV_IO_TRACE=y -+# CONFIG_KPROBE_EVENT is not set -+CONFIG_FUNCTION_PROFILER=y -+CONFIG_KGDB=y -+CONFIG_KGDB_KDB=y -+CONFIG_KDB_KEYBOARD=y -+CONFIG_CRYPTO_USER=m -+CONFIG_CRYPTO_CRYPTD=m -+CONFIG_CRYPTO_CBC=y -+CONFIG_CRYPTO_CTS=m -+CONFIG_CRYPTO_XTS=m -+CONFIG_CRYPTO_XCBC=m -+CONFIG_CRYPTO_SHA512=m -+CONFIG_CRYPTO_TGR192=m -+CONFIG_CRYPTO_WP512=m -+CONFIG_CRYPTO_CAST5=m -+CONFIG_CRYPTO_DES=y -+CONFIG_CRYPTO_USER_API_SKCIPHER=m -+# CONFIG_CRYPTO_HW is not set -+CONFIG_ARM_CRYPTO=y -+CONFIG_CRYPTO_SHA1_ARM=m -+CONFIG_CRYPTO_AES_ARM=m -+CONFIG_CRC_ITU_T=y -+CONFIG_LIBCRC32C=y - -From e5292198fc83805a9f4751fddeb802f69c0270f0 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= <noralf@tronnes.org> -Date: Wed, 29 Apr 2015 17:24:02 +0200 -Subject: [PATCH 078/170] bcm2835: bcm2835_defconfig -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Some options in bcm2835_defconfig are now the default and -some have changed. Update to keep functionality. - -No longer available: SCSI_MULTI_LUN and RESOURCE_COUNTERS. - -Signed-off-by: Noralf Trønnes <noralf@tronnes.org> - -bcm2835: bcm2835_defconfig enable MMC_BCM2835 - -Enable the downstream bcm2835-mmc driver and DMA support. - -Signed-off-by: Noralf Trønnes <noralf@tronnes.org> - -bcm2835: bcm2835_defconfig enable BCM2708_MBOX - -Enable the mailbox driver. - -Signed-off-by: Noralf Trønnes <noralf@tronnes.org> - -bcm2835: bcm2835_defconfig use FB_BCM2708 - -Enable the bcm2708 framebuffer driver. -Disable the simple framebuffer driver, which matches the -device handed over by u-boot. - -Signed-off-by: Noralf Trønnes <noralf@tronnes.org> - -bcm2835: Merge bcm2835_defconfig with bcmrpi_defconfig - -These commands where used to make this commit: - -./scripts/diffconfig -m arch/arm/configs/bcm2835_defconfig arch/arm/configs/bcmrpi_defconfig > merge.cfg - -cat << EOF > filter -CONFIG_ARCH_BCM2708 -CONFIG_BCM2708_DT -CONFIG_ARM_PATCH_PHYS_VIRT -CONFIG_PHYS_OFFSET -CONFIG_CMDLINE -CONFIG_BCM2708_WDT -CONFIG_HW_RANDOM_BCM2708 -CONFIG_I2C_BCM2708 -CONFIG_SPI_BCM2708 -CONFIG_SND_BCM2708_SOC_I2S -CONFIG_USB_DWCOTG -CONFIG_LIRC_RPI -EOF - -grep -F -v -f filter merge.cfg > filtered.cfg - -cat << EOF > added.cfg -CONFIG_WATCHDOG=y -CONFIG_BCM2835_WDT=y -CONFIG_MISC_FILESYSTEMS=y -CONFIG_SND_BCM2835_SOC_I2S=m -EOF - -ARCH=arm scripts/kconfig/merge_config.sh arch/arm/configs/bcm2835_defconfig filtered.cfg added.cfg -ARCH=arm make oldconfig - -ARCH=arm make savedefconfig -cp defconfig arch/arm/configs/bcm2835_defconfig - -rm merge.cfg filter filtered.cfg added.cfg defconfig - -ARCH=arm make bcm2835_defconfig -ARCH=arm make oldconfig - -Signed-off-by: Noralf Trønnes <noralf@tronnes.org> - -configs: Incorporate v4.1 dependency changes - -Commit 78e9b7de78bb53e8bc7f4c4a60ebacb250c0c190 added a -dependency on TI_ST instead of selecting it, disabling: -CONFIG_BT_WILINK=m -CONFIG_RADIO_WL128X=m - -Commit 652ccae5cc4e1305fb0a4619947f9ee89d8c7f5a added a -depency on ARM_CRYPTO, disabling: -CONFIG_CRYPTO_SHA*_ARM*=m -CONFIG_CRYPTO_AES_ARM*=m - -Signed-off-by: Noralf Trønnes <noralf@tronnes.org> - -Conflicts: - arch/arm/configs/bcm2709_defconfig - -bcm2835: Sync bcm2835_defconfig with bcmrpi_defconfig - -These commands where used to make this commit: - -: Get changed and new config values from a merge -./scripts/diffconfig -m arch/arm/configs/bcm2835_defconfig arch/arm/configs/bcmrpi_defconfig > merge.cfg - -: Remove these options -cat << EOF > filter -CONFIG_ARCH_BCM2708 -CONFIG_BCM2708_DT -CONFIG_ARM_PATCH_PHYS_VIRT -CONFIG_PHYS_OFFSET -CONFIG_CMDLINE -CONFIG_BCM2708_WDT -CONFIG_HW_RANDOM_BCM2708 -CONFIG_SPI_BCM2708 -EOF - -: Apply filter -grep -F -v -f filter merge.cfg > filtered.cfg - -: Add these options -: watchdog contains the restart/poweroff code. -cat << EOF > added.cfg -CONFIG_WATCHDOG=y -CONFIG_BCM2835_WDT=y -CONFIG_MISC_FILESYSTEMS=y -CONFIG_I2C_BCM2835=m -CONFIG_SND_BCM2835_SOC_I2S=m -EOF - -: Create new config -ARCH=arm scripts/kconfig/merge_config.sh arch/arm/configs/bcm2835_defconfig filtered.cfg added.cfg -: Verify -ARCH=arm make oldconfig - -: Update bcm2835_defconfig -ARCH=arm make savedefconfig -cp defconfig arch/arm/configs/bcm2835_defconfig - -: Clean up -rm merge.cfg filter filtered.cfg added.cfg defconfig - -Signed-off-by: Noralf Trønnes <noralf@tronnes.org> ---- - arch/arm/configs/bcm2835_defconfig | 1166 +++++++++++++++++++++++++++++++++++- - 1 file changed, 1140 insertions(+), 26 deletions(-) - -diff --git a/arch/arm/configs/bcm2835_defconfig b/arch/arm/configs/bcm2835_defconfig -index 31cb073..fdb2e2a8 100644 ---- a/arch/arm/configs/bcm2835_defconfig -+++ b/arch/arm/configs/bcm2835_defconfig -@@ -1,105 +1,1103 @@ - # CONFIG_LOCALVERSION_AUTO is not set - CONFIG_SYSVIPC=y -+CONFIG_POSIX_MQUEUE=y - CONFIG_FHANDLE=y - CONFIG_NO_HZ=y - CONFIG_HIGH_RES_TIMERS=y - CONFIG_BSD_PROCESS_ACCT=y - CONFIG_BSD_PROCESS_ACCT_V3=y -+CONFIG_TASKSTATS=y -+CONFIG_TASK_DELAY_ACCT=y -+CONFIG_TASK_XACCT=y -+CONFIG_TASK_IO_ACCOUNTING=y -+CONFIG_IKCONFIG=m -+CONFIG_IKCONFIG_PROC=y - CONFIG_LOG_BUF_SHIFT=18 - CONFIG_CGROUP_FREEZER=y - CONFIG_CGROUP_DEVICE=y - CONFIG_CPUSETS=y - CONFIG_CGROUP_CPUACCT=y --CONFIG_RESOURCE_COUNTERS=y -+CONFIG_MEMCG=y - CONFIG_CGROUP_PERF=y - CONFIG_CFS_BANDWIDTH=y - CONFIG_RT_GROUP_SCHED=y -+CONFIG_BLK_CGROUP=y - CONFIG_NAMESPACES=y - CONFIG_SCHED_AUTOGROUP=y --CONFIG_RELAY=y - CONFIG_BLK_DEV_INITRD=y --CONFIG_RD_BZIP2=y --CONFIG_RD_LZMA=y --CONFIG_RD_XZ=y --CONFIG_RD_LZO=y - CONFIG_CC_OPTIMIZE_FOR_SIZE=y --CONFIG_KALLSYMS_ALL=y - CONFIG_EMBEDDED=y - # CONFIG_COMPAT_BRK is not set - CONFIG_PROFILING=y --CONFIG_OPROFILE=y -+CONFIG_OPROFILE=m -+CONFIG_KPROBES=y - CONFIG_JUMP_LABEL=y -+CONFIG_CC_STACKPROTECTOR_REGULAR=y -+CONFIG_MODULES=y -+CONFIG_MODULE_UNLOAD=y -+CONFIG_MODVERSIONS=y -+CONFIG_MODULE_SRCVERSION_ALL=y -+CONFIG_BLK_DEV_THROTTLING=y -+CONFIG_PARTITION_ADVANCED=y -+CONFIG_MAC_PARTITION=y -+CONFIG_CFQ_GROUP_IOSCHED=y - CONFIG_ARCH_MULTI_V6=y - # CONFIG_ARCH_MULTI_V7 is not set - CONFIG_ARCH_BCM=y - CONFIG_ARCH_BCM2835=y --CONFIG_PREEMPT_VOLUNTARY=y -+CONFIG_PREEMPT=y - CONFIG_AEABI=y -+CONFIG_OABI_COMPAT=y - CONFIG_KSM=y - CONFIG_CLEANCACHE=y -+CONFIG_FRONTSWAP=y -+CONFIG_CMA=y -+CONFIG_ZSMALLOC=m -+CONFIG_PGTABLE_MAPPING=y -+CONFIG_UACCESS_WITH_MEMCPY=y - CONFIG_SECCOMP=y --CONFIG_CC_STACKPROTECTOR=y -+CONFIG_ZBOOT_ROM_TEXT=0x0 -+CONFIG_ZBOOT_ROM_BSS=0x0 - CONFIG_KEXEC=y - CONFIG_CRASH_DUMP=y -+CONFIG_CPU_FREQ=y -+CONFIG_CPU_FREQ_STAT=m -+CONFIG_CPU_FREQ_STAT_DETAILS=y -+CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE=y -+CONFIG_CPU_FREQ_GOV_PERFORMANCE=y -+CONFIG_CPU_FREQ_GOV_USERSPACE=y -+CONFIG_CPU_FREQ_GOV_ONDEMAND=y -+CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y - CONFIG_VFP=y - # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set -+CONFIG_BINFMT_MISC=m - # CONFIG_SUSPEND is not set - CONFIG_NET=y - CONFIG_PACKET=y - CONFIG_UNIX=y -+CONFIG_XFRM_USER=y -+CONFIG_NET_KEY=m - CONFIG_INET=y -+CONFIG_IP_MULTICAST=y -+CONFIG_IP_ADVANCED_ROUTER=y -+CONFIG_IP_MULTIPLE_TABLES=y -+CONFIG_IP_ROUTE_MULTIPATH=y -+CONFIG_IP_ROUTE_VERBOSE=y -+CONFIG_IP_PNP=y -+CONFIG_IP_PNP_DHCP=y -+CONFIG_IP_PNP_RARP=y -+CONFIG_NET_IPIP=m -+CONFIG_NET_IPGRE_DEMUX=m -+CONFIG_NET_IPGRE=m -+CONFIG_IP_MROUTE=y -+CONFIG_IP_MROUTE_MULTIPLE_TABLES=y -+CONFIG_IP_PIMSM_V1=y -+CONFIG_IP_PIMSM_V2=y -+CONFIG_SYN_COOKIES=y -+CONFIG_INET_AH=m -+CONFIG_INET_ESP=m -+CONFIG_INET_IPCOMP=m -+CONFIG_INET_XFRM_MODE_TRANSPORT=m -+CONFIG_INET_XFRM_MODE_TUNNEL=m -+CONFIG_INET_XFRM_MODE_BEET=m -+CONFIG_INET_LRO=m -+CONFIG_INET_DIAG=m -+CONFIG_INET6_AH=m -+CONFIG_INET6_ESP=m -+CONFIG_INET6_IPCOMP=m -+CONFIG_IPV6_TUNNEL=m -+CONFIG_IPV6_MULTIPLE_TABLES=y -+CONFIG_IPV6_MROUTE=y -+CONFIG_IPV6_MROUTE_MULTIPLE_TABLES=y -+CONFIG_IPV6_PIMSM_V2=y - CONFIG_NETWORK_SECMARK=y - CONFIG_NETFILTER=y --CONFIG_CFG80211=y --CONFIG_MAC80211=y -+CONFIG_NF_CONNTRACK=m -+CONFIG_NF_CONNTRACK_ZONES=y -+CONFIG_NF_CONNTRACK_EVENTS=y -+CONFIG_NF_CONNTRACK_TIMESTAMP=y -+CONFIG_NF_CT_PROTO_DCCP=m -+CONFIG_NF_CT_PROTO_UDPLITE=m -+CONFIG_NF_CONNTRACK_AMANDA=m -+CONFIG_NF_CONNTRACK_FTP=m -+CONFIG_NF_CONNTRACK_H323=m -+CONFIG_NF_CONNTRACK_IRC=m -+CONFIG_NF_CONNTRACK_NETBIOS_NS=m -+CONFIG_NF_CONNTRACK_SNMP=m -+CONFIG_NF_CONNTRACK_PPTP=m -+CONFIG_NF_CONNTRACK_SANE=m -+CONFIG_NF_CONNTRACK_SIP=m -+CONFIG_NF_CONNTRACK_TFTP=m -+CONFIG_NF_CT_NETLINK=m -+CONFIG_NETFILTER_XT_SET=m -+CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m -+CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m -+CONFIG_NETFILTER_XT_TARGET_CONNMARK=m -+CONFIG_NETFILTER_XT_TARGET_DSCP=m -+CONFIG_NETFILTER_XT_TARGET_HMARK=m -+CONFIG_NETFILTER_XT_TARGET_IDLETIMER=m -+CONFIG_NETFILTER_XT_TARGET_LED=m -+CONFIG_NETFILTER_XT_TARGET_LOG=m -+CONFIG_NETFILTER_XT_TARGET_MARK=m -+CONFIG_NETFILTER_XT_TARGET_NFLOG=m -+CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m -+CONFIG_NETFILTER_XT_TARGET_NOTRACK=m -+CONFIG_NETFILTER_XT_TARGET_TEE=m -+CONFIG_NETFILTER_XT_TARGET_TPROXY=m -+CONFIG_NETFILTER_XT_TARGET_TRACE=m -+CONFIG_NETFILTER_XT_TARGET_TCPMSS=m -+CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP=m -+CONFIG_NETFILTER_XT_MATCH_ADDRTYPE=m -+CONFIG_NETFILTER_XT_MATCH_BPF=m -+CONFIG_NETFILTER_XT_MATCH_CLUSTER=m -+CONFIG_NETFILTER_XT_MATCH_COMMENT=m -+CONFIG_NETFILTER_XT_MATCH_CONNBYTES=m -+CONFIG_NETFILTER_XT_MATCH_CONNLABEL=m -+CONFIG_NETFILTER_XT_MATCH_CONNLIMIT=m -+CONFIG_NETFILTER_XT_MATCH_CONNMARK=m -+CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m -+CONFIG_NETFILTER_XT_MATCH_CPU=m -+CONFIG_NETFILTER_XT_MATCH_DCCP=m -+CONFIG_NETFILTER_XT_MATCH_DEVGROUP=m -+CONFIG_NETFILTER_XT_MATCH_DSCP=m -+CONFIG_NETFILTER_XT_MATCH_ESP=m -+CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=m -+CONFIG_NETFILTER_XT_MATCH_HELPER=m -+CONFIG_NETFILTER_XT_MATCH_IPRANGE=m -+CONFIG_NETFILTER_XT_MATCH_IPVS=m -+CONFIG_NETFILTER_XT_MATCH_LENGTH=m -+CONFIG_NETFILTER_XT_MATCH_LIMIT=m -+CONFIG_NETFILTER_XT_MATCH_MAC=m -+CONFIG_NETFILTER_XT_MATCH_MARK=m -+CONFIG_NETFILTER_XT_MATCH_MULTIPORT=m -+CONFIG_NETFILTER_XT_MATCH_NFACCT=m -+CONFIG_NETFILTER_XT_MATCH_OSF=m -+CONFIG_NETFILTER_XT_MATCH_OWNER=m -+CONFIG_NETFILTER_XT_MATCH_POLICY=m -+CONFIG_NETFILTER_XT_MATCH_PHYSDEV=m -+CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m -+CONFIG_NETFILTER_XT_MATCH_QUOTA=m -+CONFIG_NETFILTER_XT_MATCH_RATEEST=m -+CONFIG_NETFILTER_XT_MATCH_REALM=m -+CONFIG_NETFILTER_XT_MATCH_RECENT=m -+CONFIG_NETFILTER_XT_MATCH_SOCKET=m -+CONFIG_NETFILTER_XT_MATCH_STATE=m -+CONFIG_NETFILTER_XT_MATCH_STATISTIC=m -+CONFIG_NETFILTER_XT_MATCH_STRING=m -+CONFIG_NETFILTER_XT_MATCH_TCPMSS=m -+CONFIG_NETFILTER_XT_MATCH_TIME=m -+CONFIG_NETFILTER_XT_MATCH_U32=m -+CONFIG_IP_SET=m -+CONFIG_IP_SET_BITMAP_IP=m -+CONFIG_IP_SET_BITMAP_IPMAC=m -+CONFIG_IP_SET_BITMAP_PORT=m -+CONFIG_IP_SET_HASH_IP=m -+CONFIG_IP_SET_HASH_IPPORT=m -+CONFIG_IP_SET_HASH_IPPORTIP=m -+CONFIG_IP_SET_HASH_IPPORTNET=m -+CONFIG_IP_SET_HASH_NET=m -+CONFIG_IP_SET_HASH_NETPORT=m -+CONFIG_IP_SET_HASH_NETIFACE=m -+CONFIG_IP_SET_LIST_SET=m -+CONFIG_IP_VS=m -+CONFIG_IP_VS_PROTO_TCP=y -+CONFIG_IP_VS_PROTO_UDP=y -+CONFIG_IP_VS_PROTO_ESP=y -+CONFIG_IP_VS_PROTO_AH=y -+CONFIG_IP_VS_PROTO_SCTP=y -+CONFIG_IP_VS_RR=m -+CONFIG_IP_VS_WRR=m -+CONFIG_IP_VS_LC=m -+CONFIG_IP_VS_WLC=m -+CONFIG_IP_VS_LBLC=m -+CONFIG_IP_VS_LBLCR=m -+CONFIG_IP_VS_DH=m -+CONFIG_IP_VS_SH=m -+CONFIG_IP_VS_SED=m -+CONFIG_IP_VS_NQ=m -+CONFIG_IP_VS_FTP=m -+CONFIG_IP_VS_PE_SIP=m -+CONFIG_NF_CONNTRACK_IPV4=m -+CONFIG_IP_NF_IPTABLES=m -+CONFIG_IP_NF_MATCH_AH=m -+CONFIG_IP_NF_MATCH_ECN=m -+CONFIG_IP_NF_MATCH_TTL=m -+CONFIG_IP_NF_FILTER=m -+CONFIG_IP_NF_TARGET_REJECT=m -+CONFIG_IP_NF_NAT=m -+CONFIG_IP_NF_TARGET_MASQUERADE=m -+CONFIG_IP_NF_TARGET_NETMAP=m -+CONFIG_IP_NF_TARGET_REDIRECT=m -+CONFIG_IP_NF_MANGLE=m -+CONFIG_IP_NF_TARGET_CLUSTERIP=m -+CONFIG_IP_NF_TARGET_ECN=m -+CONFIG_IP_NF_TARGET_TTL=m -+CONFIG_IP_NF_RAW=m -+CONFIG_IP_NF_ARPTABLES=m -+CONFIG_IP_NF_ARPFILTER=m -+CONFIG_IP_NF_ARP_MANGLE=m -+CONFIG_NF_CONNTRACK_IPV6=m -+CONFIG_IP6_NF_IPTABLES=m -+CONFIG_IP6_NF_MATCH_AH=m -+CONFIG_IP6_NF_MATCH_EUI64=m -+CONFIG_IP6_NF_MATCH_FRAG=m -+CONFIG_IP6_NF_MATCH_OPTS=m -+CONFIG_IP6_NF_MATCH_HL=m -+CONFIG_IP6_NF_MATCH_IPV6HEADER=m -+CONFIG_IP6_NF_MATCH_MH=m -+CONFIG_IP6_NF_MATCH_RT=m -+CONFIG_IP6_NF_TARGET_HL=m -+CONFIG_IP6_NF_FILTER=m -+CONFIG_IP6_NF_TARGET_REJECT=m -+CONFIG_IP6_NF_MANGLE=m -+CONFIG_IP6_NF_RAW=m -+CONFIG_IP6_NF_NAT=m -+CONFIG_IP6_NF_TARGET_MASQUERADE=m -+CONFIG_IP6_NF_TARGET_NPT=m -+CONFIG_BRIDGE_NF_EBTABLES=m -+CONFIG_BRIDGE_EBT_BROUTE=m -+CONFIG_BRIDGE_EBT_T_FILTER=m -+CONFIG_BRIDGE_EBT_T_NAT=m -+CONFIG_BRIDGE_EBT_802_3=m -+CONFIG_BRIDGE_EBT_AMONG=m -+CONFIG_BRIDGE_EBT_ARP=m -+CONFIG_BRIDGE_EBT_IP=m -+CONFIG_BRIDGE_EBT_IP6=m -+CONFIG_BRIDGE_EBT_LIMIT=m -+CONFIG_BRIDGE_EBT_MARK=m -+CONFIG_BRIDGE_EBT_PKTTYPE=m -+CONFIG_BRIDGE_EBT_STP=m -+CONFIG_BRIDGE_EBT_VLAN=m -+CONFIG_BRIDGE_EBT_ARPREPLY=m -+CONFIG_BRIDGE_EBT_DNAT=m -+CONFIG_BRIDGE_EBT_MARK_T=m -+CONFIG_BRIDGE_EBT_REDIRECT=m -+CONFIG_BRIDGE_EBT_SNAT=m -+CONFIG_BRIDGE_EBT_LOG=m -+CONFIG_BRIDGE_EBT_NFLOG=m -+CONFIG_SCTP_COOKIE_HMAC_SHA1=y -+CONFIG_ATM=m -+CONFIG_L2TP=m -+CONFIG_L2TP_V3=y -+CONFIG_L2TP_IP=m -+CONFIG_L2TP_ETH=m -+CONFIG_BRIDGE=m -+CONFIG_VLAN_8021Q=m -+CONFIG_VLAN_8021Q_GVRP=y -+CONFIG_ATALK=m -+CONFIG_6LOWPAN=m -+CONFIG_NET_SCHED=y -+CONFIG_NET_SCH_CBQ=m -+CONFIG_NET_SCH_HTB=m -+CONFIG_NET_SCH_HFSC=m -+CONFIG_NET_SCH_PRIO=m -+CONFIG_NET_SCH_MULTIQ=m -+CONFIG_NET_SCH_RED=m -+CONFIG_NET_SCH_SFB=m -+CONFIG_NET_SCH_SFQ=m -+CONFIG_NET_SCH_TEQL=m -+CONFIG_NET_SCH_TBF=m -+CONFIG_NET_SCH_GRED=m -+CONFIG_NET_SCH_DSMARK=m -+CONFIG_NET_SCH_NETEM=m -+CONFIG_NET_SCH_DRR=m -+CONFIG_NET_SCH_MQPRIO=m -+CONFIG_NET_SCH_CHOKE=m -+CONFIG_NET_SCH_QFQ=m -+CONFIG_NET_SCH_CODEL=m -+CONFIG_NET_SCH_FQ_CODEL=m -+CONFIG_NET_SCH_INGRESS=m -+CONFIG_NET_SCH_PLUG=m -+CONFIG_NET_CLS_BASIC=m -+CONFIG_NET_CLS_TCINDEX=m -+CONFIG_NET_CLS_ROUTE4=m -+CONFIG_NET_CLS_FW=m -+CONFIG_NET_CLS_U32=m -+CONFIG_CLS_U32_MARK=y -+CONFIG_NET_CLS_RSVP=m -+CONFIG_NET_CLS_RSVP6=m -+CONFIG_NET_CLS_FLOW=m -+CONFIG_NET_CLS_CGROUP=m -+CONFIG_NET_EMATCH=y -+CONFIG_NET_EMATCH_CMP=m -+CONFIG_NET_EMATCH_NBYTE=m -+CONFIG_NET_EMATCH_U32=m -+CONFIG_NET_EMATCH_META=m -+CONFIG_NET_EMATCH_TEXT=m -+CONFIG_NET_EMATCH_IPSET=m -+CONFIG_NET_CLS_ACT=y -+CONFIG_NET_ACT_POLICE=m -+CONFIG_NET_ACT_GACT=m -+CONFIG_GACT_PROB=y -+CONFIG_NET_ACT_MIRRED=m -+CONFIG_NET_ACT_IPT=m -+CONFIG_NET_ACT_NAT=m -+CONFIG_NET_ACT_PEDIT=m -+CONFIG_NET_ACT_SIMP=m -+CONFIG_NET_ACT_SKBEDIT=m -+CONFIG_NET_ACT_CSUM=m -+CONFIG_BATMAN_ADV=m -+CONFIG_OPENVSWITCH=m -+CONFIG_NET_PKTGEN=m -+CONFIG_HAMRADIO=y -+CONFIG_AX25=m -+CONFIG_NETROM=m -+CONFIG_ROSE=m -+CONFIG_MKISS=m -+CONFIG_6PACK=m -+CONFIG_BPQETHER=m -+CONFIG_BAYCOM_SER_FDX=m -+CONFIG_BAYCOM_SER_HDX=m -+CONFIG_YAM=m -+CONFIG_CAN=m -+CONFIG_CAN_VCAN=m -+CONFIG_CAN_MCP251X=m -+CONFIG_IRDA=m -+CONFIG_IRLAN=m -+CONFIG_IRNET=m -+CONFIG_IRCOMM=m -+CONFIG_IRDA_ULTRA=y -+CONFIG_IRDA_CACHE_LAST_LSAP=y -+CONFIG_IRDA_FAST_RR=y -+CONFIG_IRTTY_SIR=m -+CONFIG_KINGSUN_DONGLE=m -+CONFIG_KSDAZZLE_DONGLE=m -+CONFIG_KS959_DONGLE=m -+CONFIG_USB_IRDA=m -+CONFIG_SIGMATEL_FIR=m -+CONFIG_MCS_FIR=m -+CONFIG_BT=m -+CONFIG_BT_RFCOMM=m -+CONFIG_BT_RFCOMM_TTY=y -+CONFIG_BT_BNEP=m -+CONFIG_BT_BNEP_MC_FILTER=y -+CONFIG_BT_BNEP_PROTO_FILTER=y -+CONFIG_BT_HIDP=m -+CONFIG_BT_6LOWPAN=m -+CONFIG_BT_HCIBTUSB=m -+CONFIG_BT_HCIBCM203X=m -+CONFIG_BT_HCIBPA10X=m -+CONFIG_BT_HCIBFUSB=m -+CONFIG_BT_HCIVHCI=m -+CONFIG_BT_MRVL=m -+CONFIG_BT_MRVL_SDIO=m -+CONFIG_BT_ATH3K=m -+CONFIG_BT_WILINK=m -+CONFIG_MAC80211=m -+CONFIG_MAC80211_MESH=y -+CONFIG_WIMAX=m -+CONFIG_RFKILL=m -+CONFIG_RFKILL_INPUT=y -+CONFIG_NET_9P=m -+CONFIG_NFC=m -+CONFIG_NFC_PN533=m - CONFIG_DEVTMPFS=y - CONFIG_DEVTMPFS_MOUNT=y - # CONFIG_STANDALONE is not set -+CONFIG_DMA_CMA=y -+CONFIG_CMA_SIZE_MBYTES=5 -+CONFIG_ZRAM=m -+CONFIG_ZRAM_LZ4_COMPRESS=y -+CONFIG_BLK_DEV_LOOP=y -+CONFIG_BLK_DEV_CRYPTOLOOP=m -+CONFIG_BLK_DEV_DRBD=m -+CONFIG_BLK_DEV_NBD=m -+CONFIG_BLK_DEV_RAM=y -+CONFIG_CDROM_PKTCDVD=m -+CONFIG_ATA_OVER_ETH=m -+CONFIG_EEPROM_AT24=m -+CONFIG_TI_ST=m - CONFIG_SCSI=y -+# CONFIG_SCSI_PROC_FS is not set - CONFIG_BLK_DEV_SD=y --CONFIG_SCSI_MULTI_LUN=y -+CONFIG_CHR_DEV_ST=m -+CONFIG_CHR_DEV_OSST=m -+CONFIG_BLK_DEV_SR=m -+CONFIG_CHR_DEV_SG=m - CONFIG_SCSI_CONSTANTS=y - CONFIG_SCSI_SCAN_ASYNC=y -+CONFIG_SCSI_ISCSI_ATTRS=y -+CONFIG_ISCSI_TCP=m -+CONFIG_ISCSI_BOOT_SYSFS=m -+CONFIG_MD=y -+CONFIG_MD_LINEAR=m -+CONFIG_MD_RAID0=m -+CONFIG_BLK_DEV_DM=m -+CONFIG_DM_CRYPT=m -+CONFIG_DM_SNAPSHOT=m -+CONFIG_DM_MIRROR=m -+CONFIG_DM_LOG_USERSPACE=m -+CONFIG_DM_RAID=m -+CONFIG_DM_ZERO=m -+CONFIG_DM_DELAY=m - CONFIG_NETDEVICES=y -+CONFIG_BONDING=m -+CONFIG_DUMMY=m -+CONFIG_IFB=m -+CONFIG_MACVLAN=m -+CONFIG_NETCONSOLE=m -+CONFIG_TUN=m -+CONFIG_VETH=m -+CONFIG_ENC28J60=m -+CONFIG_MDIO_BITBANG=m -+CONFIG_PPP=m -+CONFIG_PPP_BSDCOMP=m -+CONFIG_PPP_DEFLATE=m -+CONFIG_PPP_FILTER=y -+CONFIG_PPP_MPPE=m -+CONFIG_PPP_MULTILINK=y -+CONFIG_PPPOATM=m -+CONFIG_PPPOE=m -+CONFIG_PPPOL2TP=m -+CONFIG_PPP_ASYNC=m -+CONFIG_PPP_SYNC_TTY=m -+CONFIG_SLIP=m -+CONFIG_SLIP_COMPRESSED=y -+CONFIG_SLIP_SMART=y -+CONFIG_USB_CATC=m -+CONFIG_USB_KAWETH=m -+CONFIG_USB_PEGASUS=m -+CONFIG_USB_RTL8150=m -+CONFIG_USB_RTL8152=m - CONFIG_USB_USBNET=y -+CONFIG_USB_NET_AX8817X=m -+CONFIG_USB_NET_AX88179_178A=m -+CONFIG_USB_NET_CDCETHER=m -+CONFIG_USB_NET_CDC_EEM=m -+CONFIG_USB_NET_CDC_NCM=m -+CONFIG_USB_NET_HUAWEI_CDC_NCM=m -+CONFIG_USB_NET_CDC_MBIM=m -+CONFIG_USB_NET_DM9601=m -+CONFIG_USB_NET_SR9700=m -+CONFIG_USB_NET_SR9800=m -+CONFIG_USB_NET_SMSC75XX=m - CONFIG_USB_NET_SMSC95XX=y --CONFIG_ZD1211RW=y --CONFIG_INPUT_EVDEV=y -+CONFIG_USB_NET_GL620A=m -+CONFIG_USB_NET_NET1080=m -+CONFIG_USB_NET_PLUSB=m -+CONFIG_USB_NET_MCS7830=m -+CONFIG_USB_NET_CDC_SUBSET=m -+CONFIG_USB_ALI_M5632=y -+CONFIG_USB_AN2720=y -+CONFIG_USB_EPSON2888=y -+CONFIG_USB_KC2190=y -+CONFIG_USB_NET_ZAURUS=m -+CONFIG_USB_NET_CX82310_ETH=m -+CONFIG_USB_NET_KALMIA=m -+CONFIG_USB_NET_QMI_WWAN=m -+CONFIG_USB_HSO=m -+CONFIG_USB_NET_INT51X1=m -+CONFIG_USB_IPHETH=m -+CONFIG_USB_SIERRA_NET=m -+CONFIG_USB_VL600=m -+CONFIG_LIBERTAS_THINFIRM=m -+CONFIG_LIBERTAS_THINFIRM_USB=m -+CONFIG_AT76C50X_USB=m -+CONFIG_USB_ZD1201=m -+CONFIG_USB_NET_RNDIS_WLAN=m -+CONFIG_RTL8187=m -+CONFIG_MAC80211_HWSIM=m -+CONFIG_ATH_CARDS=m -+CONFIG_ATH9K=m -+CONFIG_ATH9K_HTC=m -+CONFIG_CARL9170=m -+CONFIG_ATH6KL=m -+CONFIG_ATH6KL_USB=m -+CONFIG_AR5523=m -+CONFIG_B43=m -+# CONFIG_B43_PHY_N is not set -+CONFIG_B43LEGACY=m -+CONFIG_BRCMFMAC=m -+CONFIG_BRCMFMAC_USB=y -+CONFIG_HOSTAP=m -+CONFIG_LIBERTAS=m -+CONFIG_LIBERTAS_USB=m -+CONFIG_LIBERTAS_SDIO=m -+CONFIG_P54_COMMON=m -+CONFIG_P54_USB=m -+CONFIG_RT2X00=m -+CONFIG_RT2500USB=m -+CONFIG_RT73USB=m -+CONFIG_RT2800USB=m -+CONFIG_RT2800USB_RT3573=y -+CONFIG_RT2800USB_RT53XX=y -+CONFIG_RT2800USB_RT55XX=y -+CONFIG_RT2800USB_UNKNOWN=y -+CONFIG_WL_MEDIATEK=y -+CONFIG_MT7601U=m -+CONFIG_RTL8192CU=m -+CONFIG_ZD1211RW=m -+CONFIG_MWIFIEX=m -+CONFIG_MWIFIEX_SDIO=m -+CONFIG_WIMAX_I2400M_USB=m -+CONFIG_INPUT_POLLDEV=m -+# CONFIG_INPUT_MOUSEDEV_PSAUX is not set -+CONFIG_INPUT_JOYDEV=m -+CONFIG_INPUT_EVDEV=m -+# CONFIG_KEYBOARD_ATKBD is not set -+CONFIG_KEYBOARD_GPIO=m -+# CONFIG_INPUT_MOUSE is not set -+CONFIG_INPUT_JOYSTICK=y -+CONFIG_JOYSTICK_IFORCE=m -+CONFIG_JOYSTICK_IFORCE_USB=y -+CONFIG_JOYSTICK_XPAD=m -+CONFIG_JOYSTICK_XPAD_FF=y -+CONFIG_JOYSTICK_RPISENSE=m -+CONFIG_INPUT_TOUCHSCREEN=y -+CONFIG_TOUCHSCREEN_ADS7846=m -+CONFIG_TOUCHSCREEN_EGALAX=m -+CONFIG_TOUCHSCREEN_RPI_FT5406=m -+CONFIG_TOUCHSCREEN_USB_COMPOSITE=m -+CONFIG_TOUCHSCREEN_STMPE=m -+CONFIG_INPUT_MISC=y -+CONFIG_INPUT_AD714X=m -+CONFIG_INPUT_ATI_REMOTE2=m -+CONFIG_INPUT_KEYSPAN_REMOTE=m -+CONFIG_INPUT_POWERMATE=m -+CONFIG_INPUT_YEALINK=m -+CONFIG_INPUT_CM109=m -+CONFIG_INPUT_UINPUT=m -+CONFIG_INPUT_GPIO_ROTARY_ENCODER=m -+CONFIG_INPUT_ADXL34X=m -+CONFIG_INPUT_CMA3000=m -+CONFIG_SERIO=m -+CONFIG_SERIO_RAW=m -+CONFIG_GAMEPORT=m -+CONFIG_GAMEPORT_NS558=m -+CONFIG_GAMEPORT_L4=m -+CONFIG_BRCM_CHAR_DRIVERS=y -+CONFIG_BCM_VC_CMA=y -+CONFIG_BCM_VCIO=y -+CONFIG_BCM_VC_SM=y -+CONFIG_DEVPTS_MULTIPLE_INSTANCES=y - # CONFIG_LEGACY_PTYS is not set - # CONFIG_DEVKMEM is not set -+CONFIG_SERIAL_8250=y -+# CONFIG_SERIAL_8250_DEPRECATED_OPTIONS is not set -+CONFIG_SERIAL_8250_CONSOLE=y -+# CONFIG_SERIAL_8250_DMA is not set -+CONFIG_SERIAL_8250_NR_UARTS=1 -+CONFIG_SERIAL_8250_RUNTIME_UARTS=0 - CONFIG_SERIAL_AMBA_PL011=y - CONFIG_SERIAL_AMBA_PL011_CONSOLE=y -+CONFIG_SERIAL_OF_PLATFORM=y - CONFIG_TTY_PRINTK=y -+CONFIG_HW_RANDOM=y -+CONFIG_HW_RANDOM_BCM2835=m -+CONFIG_RAW_DRIVER=y - CONFIG_I2C=y --CONFIG_I2C_CHARDEV=y --CONFIG_I2C_BCM2835=y -+CONFIG_I2C_CHARDEV=m -+CONFIG_I2C_BCM2708=m -+CONFIG_I2C_BCM2835=m - CONFIG_SPI=y --CONFIG_SPI_BCM2835=y -+CONFIG_SPI_BCM2835=m -+CONFIG_SPI_SPIDEV=y -+CONFIG_PPS=m -+CONFIG_PPS_CLIENT_LDISC=m -+CONFIG_PPS_CLIENT_GPIO=m - CONFIG_GPIO_SYSFS=y -+CONFIG_GPIO_ARIZONA=m -+CONFIG_GPIO_STMPE=y -+CONFIG_W1=m -+CONFIG_W1_MASTER_DS2490=m -+CONFIG_W1_MASTER_DS2482=m -+CONFIG_W1_MASTER_DS1WM=m -+CONFIG_W1_MASTER_GPIO=m -+CONFIG_W1_SLAVE_THERM=m -+CONFIG_W1_SLAVE_SMEM=m -+CONFIG_W1_SLAVE_DS2408=m -+CONFIG_W1_SLAVE_DS2413=m -+CONFIG_W1_SLAVE_DS2406=m -+CONFIG_W1_SLAVE_DS2423=m -+CONFIG_W1_SLAVE_DS2431=m -+CONFIG_W1_SLAVE_DS2433=m -+CONFIG_W1_SLAVE_DS2760=m -+CONFIG_W1_SLAVE_DS2780=m -+CONFIG_W1_SLAVE_DS2781=m -+CONFIG_W1_SLAVE_DS28E04=m -+CONFIG_W1_SLAVE_BQ27000=m -+CONFIG_BATTERY_DS2760=m -+CONFIG_POWER_RESET=y -+CONFIG_POWER_RESET_GPIO=y - # CONFIG_HWMON is not set -+CONFIG_THERMAL=y -+CONFIG_THERMAL_BCM2835=y -+CONFIG_WATCHDOG=y -+CONFIG_BCM2835_WDT=y -+CONFIG_UCB1400_CORE=m -+CONFIG_MFD_STMPE=y -+CONFIG_STMPE_SPI=y -+CONFIG_MFD_ARIZONA_I2C=m -+CONFIG_MFD_ARIZONA_SPI=m -+CONFIG_MFD_WM5102=y -+CONFIG_MEDIA_SUPPORT=m -+CONFIG_MEDIA_CAMERA_SUPPORT=y -+CONFIG_MEDIA_ANALOG_TV_SUPPORT=y -+CONFIG_MEDIA_DIGITAL_TV_SUPPORT=y -+CONFIG_MEDIA_RADIO_SUPPORT=y -+CONFIG_MEDIA_RC_SUPPORT=y -+CONFIG_MEDIA_CONTROLLER=y -+CONFIG_LIRC=m -+CONFIG_RC_DEVICES=y -+CONFIG_RC_ATI_REMOTE=m -+CONFIG_IR_IMON=m -+CONFIG_IR_MCEUSB=m -+CONFIG_IR_REDRAT3=m -+CONFIG_IR_STREAMZAP=m -+CONFIG_IR_IGUANA=m -+CONFIG_IR_TTUSBIR=m -+CONFIG_RC_LOOPBACK=m -+CONFIG_IR_GPIO_CIR=m -+CONFIG_MEDIA_USB_SUPPORT=y -+CONFIG_USB_VIDEO_CLASS=m -+CONFIG_USB_M5602=m -+CONFIG_USB_STV06XX=m -+CONFIG_USB_GL860=m -+CONFIG_USB_GSPCA_BENQ=m -+CONFIG_USB_GSPCA_CONEX=m -+CONFIG_USB_GSPCA_CPIA1=m -+CONFIG_USB_GSPCA_DTCS033=m -+CONFIG_USB_GSPCA_ETOMS=m -+CONFIG_USB_GSPCA_FINEPIX=m -+CONFIG_USB_GSPCA_JEILINJ=m -+CONFIG_USB_GSPCA_JL2005BCD=m -+CONFIG_USB_GSPCA_KINECT=m -+CONFIG_USB_GSPCA_KONICA=m -+CONFIG_USB_GSPCA_MARS=m -+CONFIG_USB_GSPCA_MR97310A=m -+CONFIG_USB_GSPCA_NW80X=m -+CONFIG_USB_GSPCA_OV519=m -+CONFIG_USB_GSPCA_OV534=m -+CONFIG_USB_GSPCA_OV534_9=m -+CONFIG_USB_GSPCA_PAC207=m -+CONFIG_USB_GSPCA_PAC7302=m -+CONFIG_USB_GSPCA_PAC7311=m -+CONFIG_USB_GSPCA_SE401=m -+CONFIG_USB_GSPCA_SN9C2028=m -+CONFIG_USB_GSPCA_SN9C20X=m -+CONFIG_USB_GSPCA_SONIXB=m -+CONFIG_USB_GSPCA_SONIXJ=m -+CONFIG_USB_GSPCA_SPCA500=m -+CONFIG_USB_GSPCA_SPCA501=m -+CONFIG_USB_GSPCA_SPCA505=m -+CONFIG_USB_GSPCA_SPCA506=m -+CONFIG_USB_GSPCA_SPCA508=m -+CONFIG_USB_GSPCA_SPCA561=m -+CONFIG_USB_GSPCA_SPCA1528=m -+CONFIG_USB_GSPCA_SQ905=m -+CONFIG_USB_GSPCA_SQ905C=m -+CONFIG_USB_GSPCA_SQ930X=m -+CONFIG_USB_GSPCA_STK014=m -+CONFIG_USB_GSPCA_STK1135=m -+CONFIG_USB_GSPCA_STV0680=m -+CONFIG_USB_GSPCA_SUNPLUS=m -+CONFIG_USB_GSPCA_T613=m -+CONFIG_USB_GSPCA_TOPRO=m -+CONFIG_USB_GSPCA_TV8532=m -+CONFIG_USB_GSPCA_VC032X=m -+CONFIG_USB_GSPCA_VICAM=m -+CONFIG_USB_GSPCA_XIRLINK_CIT=m -+CONFIG_USB_GSPCA_ZC3XX=m -+CONFIG_USB_PWC=m -+CONFIG_VIDEO_CPIA2=m -+CONFIG_USB_ZR364XX=m -+CONFIG_USB_STKWEBCAM=m -+CONFIG_USB_S2255=m -+CONFIG_VIDEO_USBTV=m -+CONFIG_VIDEO_PVRUSB2=m -+CONFIG_VIDEO_HDPVR=m -+CONFIG_VIDEO_USBVISION=m -+CONFIG_VIDEO_STK1160_COMMON=m -+CONFIG_VIDEO_STK1160_AC97=y -+CONFIG_VIDEO_GO7007=m -+CONFIG_VIDEO_GO7007_USB=m -+CONFIG_VIDEO_GO7007_USB_S2250_BOARD=m -+CONFIG_VIDEO_AU0828=m -+CONFIG_VIDEO_AU0828_RC=y -+CONFIG_VIDEO_CX231XX=m -+CONFIG_VIDEO_CX231XX_ALSA=m -+CONFIG_VIDEO_CX231XX_DVB=m -+CONFIG_VIDEO_TM6000=m -+CONFIG_VIDEO_TM6000_ALSA=m -+CONFIG_VIDEO_TM6000_DVB=m -+CONFIG_DVB_USB=m -+CONFIG_DVB_USB_A800=m -+CONFIG_DVB_USB_DIBUSB_MB=m -+CONFIG_DVB_USB_DIBUSB_MB_FAULTY=y -+CONFIG_DVB_USB_DIBUSB_MC=m -+CONFIG_DVB_USB_DIB0700=m -+CONFIG_DVB_USB_UMT_010=m -+CONFIG_DVB_USB_CXUSB=m -+CONFIG_DVB_USB_M920X=m -+CONFIG_DVB_USB_DIGITV=m -+CONFIG_DVB_USB_VP7045=m -+CONFIG_DVB_USB_VP702X=m -+CONFIG_DVB_USB_GP8PSK=m -+CONFIG_DVB_USB_NOVA_T_USB2=m -+CONFIG_DVB_USB_TTUSB2=m -+CONFIG_DVB_USB_DTT200U=m -+CONFIG_DVB_USB_OPERA1=m -+CONFIG_DVB_USB_AF9005=m -+CONFIG_DVB_USB_AF9005_REMOTE=m -+CONFIG_DVB_USB_PCTV452E=m -+CONFIG_DVB_USB_DW2102=m -+CONFIG_DVB_USB_CINERGY_T2=m -+CONFIG_DVB_USB_DTV5100=m -+CONFIG_DVB_USB_FRIIO=m -+CONFIG_DVB_USB_AZ6027=m -+CONFIG_DVB_USB_TECHNISAT_USB2=m -+CONFIG_DVB_USB_V2=m -+CONFIG_DVB_USB_AF9015=m -+CONFIG_DVB_USB_AF9035=m -+CONFIG_DVB_USB_ANYSEE=m -+CONFIG_DVB_USB_AU6610=m -+CONFIG_DVB_USB_AZ6007=m -+CONFIG_DVB_USB_CE6230=m -+CONFIG_DVB_USB_EC168=m -+CONFIG_DVB_USB_GL861=m -+CONFIG_DVB_USB_LME2510=m -+CONFIG_DVB_USB_MXL111SF=m -+CONFIG_DVB_USB_RTL28XXU=m -+CONFIG_DVB_USB_DVBSKY=m -+CONFIG_SMS_USB_DRV=m -+CONFIG_DVB_B2C2_FLEXCOP_USB=m -+CONFIG_DVB_AS102=m -+CONFIG_VIDEO_EM28XX=m -+CONFIG_VIDEO_EM28XX_V4L2=m -+CONFIG_VIDEO_EM28XX_ALSA=m -+CONFIG_VIDEO_EM28XX_DVB=m -+CONFIG_V4L_PLATFORM_DRIVERS=y -+CONFIG_VIDEO_BCM2835=y -+CONFIG_VIDEO_BCM2835_MMAL=m -+CONFIG_RADIO_SI470X=y -+CONFIG_USB_SI470X=m -+CONFIG_I2C_SI470X=m -+CONFIG_RADIO_SI4713=m -+CONFIG_I2C_SI4713=m -+CONFIG_USB_MR800=m -+CONFIG_USB_DSBR=m -+CONFIG_RADIO_SHARK=m -+CONFIG_RADIO_SHARK2=m -+CONFIG_USB_KEENE=m -+CONFIG_USB_MA901=m -+CONFIG_RADIO_TEA5764=m -+CONFIG_RADIO_SAA7706H=m -+CONFIG_RADIO_TEF6862=m -+CONFIG_RADIO_WL1273=m -+CONFIG_RADIO_WL128X=m -+# CONFIG_MEDIA_SUBDRV_AUTOSELECT is not set -+CONFIG_VIDEO_UDA1342=m -+CONFIG_VIDEO_SONY_BTF_MPX=m -+CONFIG_VIDEO_TVP5150=m -+CONFIG_VIDEO_TW2804=m -+CONFIG_VIDEO_TW9903=m -+CONFIG_VIDEO_TW9906=m -+CONFIG_VIDEO_OV7640=m -+CONFIG_VIDEO_MT9V011=m - CONFIG_FB=y --CONFIG_FB_SIMPLE=y -+CONFIG_FB_BCM2708=y -+CONFIG_FB_SSD1307=m -+CONFIG_FB_RPISENSE=m -+# CONFIG_BACKLIGHT_GENERIC is not set -+CONFIG_BACKLIGHT_GPIO=m - CONFIG_FRAMEBUFFER_CONSOLE=y - CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y -+CONFIG_LOGO=y -+# CONFIG_LOGO_LINUX_MONO is not set -+# CONFIG_LOGO_LINUX_VGA16 is not set -+CONFIG_SOUND=y -+CONFIG_SND=m -+CONFIG_SND_SEQUENCER=m -+CONFIG_SND_SEQ_DUMMY=m -+CONFIG_SND_MIXER_OSS=m -+CONFIG_SND_PCM_OSS=m -+CONFIG_SND_SEQUENCER_OSS=y -+CONFIG_SND_HRTIMER=m -+CONFIG_SND_DUMMY=m -+CONFIG_SND_ALOOP=m -+CONFIG_SND_VIRMIDI=m -+CONFIG_SND_MTPAV=m -+CONFIG_SND_SERIAL_U16550=m -+CONFIG_SND_MPU401=m -+CONFIG_SND_BCM2835=m -+CONFIG_SND_USB_AUDIO=m -+CONFIG_SND_USB_UA101=m -+CONFIG_SND_USB_CAIAQ=m -+CONFIG_SND_USB_CAIAQ_INPUT=y -+CONFIG_SND_USB_6FIRE=m -+CONFIG_SND_SOC=m -+CONFIG_SND_BCM2835_SOC_I2S=m -+CONFIG_SND_BCM2708_SOC_I2S=m -+CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC=m -+CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS=m -+CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI=m -+CONFIG_SND_BCM2708_SOC_HIFIBERRY_AMP=m -+CONFIG_SND_BCM2708_SOC_RPI_DAC=m -+CONFIG_SND_BCM2708_SOC_RPI_PROTO=m -+CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC=m -+CONFIG_SND_SOC_WM8804_I2C=m -+CONFIG_SND_SIMPLE_CARD=m -+CONFIG_SOUND_PRIME=m -+CONFIG_HIDRAW=y -+CONFIG_HID_A4TECH=m -+CONFIG_HID_ACRUX=m -+CONFIG_HID_APPLE=m -+CONFIG_HID_BELKIN=m -+CONFIG_HID_CHERRY=m -+CONFIG_HID_CHICONY=m -+CONFIG_HID_CYPRESS=m -+CONFIG_HID_DRAGONRISE=m -+CONFIG_HID_EMS_FF=m -+CONFIG_HID_ELECOM=m -+CONFIG_HID_ELO=m -+CONFIG_HID_EZKEY=m -+CONFIG_HID_HOLTEK=m -+CONFIG_HID_KEYTOUCH=m -+CONFIG_HID_KYE=m -+CONFIG_HID_UCLOGIC=m -+CONFIG_HID_WALTOP=m -+CONFIG_HID_GYRATION=m -+CONFIG_HID_TWINHAN=m -+CONFIG_HID_KENSINGTON=m -+CONFIG_HID_LCPOWER=m -+CONFIG_HID_LOGITECH=m -+CONFIG_HID_MAGICMOUSE=m -+CONFIG_HID_MICROSOFT=m -+CONFIG_HID_MONTEREY=m -+CONFIG_HID_MULTITOUCH=m -+CONFIG_HID_NTRIG=m -+CONFIG_HID_ORTEK=m -+CONFIG_HID_PANTHERLORD=m -+CONFIG_HID_PETALYNX=m -+CONFIG_HID_PICOLCD=m -+CONFIG_HID_ROCCAT=m -+CONFIG_HID_SAMSUNG=m -+CONFIG_HID_SONY=m -+CONFIG_HID_SPEEDLINK=m -+CONFIG_HID_SUNPLUS=m -+CONFIG_HID_GREENASIA=m -+CONFIG_HID_SMARTJOYPLUS=m -+CONFIG_HID_TOPSEED=m -+CONFIG_HID_THINGM=m -+CONFIG_HID_THRUSTMASTER=m -+CONFIG_HID_WACOM=m -+CONFIG_HID_WIIMOTE=m -+CONFIG_HID_XINMO=m -+CONFIG_HID_ZEROPLUS=m -+CONFIG_HID_ZYDACRON=m -+CONFIG_HID_PID=y -+CONFIG_USB_HIDDEV=y - CONFIG_USB=y -+CONFIG_USB_ANNOUNCE_NEW_DEVICES=y -+CONFIG_USB_MON=m -+CONFIG_USB_DWCOTG=y -+CONFIG_USB_PRINTER=m - CONFIG_USB_STORAGE=y -+CONFIG_USB_STORAGE_REALTEK=m -+CONFIG_USB_STORAGE_DATAFAB=m -+CONFIG_USB_STORAGE_FREECOM=m -+CONFIG_USB_STORAGE_ISD200=m -+CONFIG_USB_STORAGE_USBAT=m -+CONFIG_USB_STORAGE_SDDR09=m -+CONFIG_USB_STORAGE_SDDR55=m -+CONFIG_USB_STORAGE_JUMPSHOT=m -+CONFIG_USB_STORAGE_ALAUDA=m -+CONFIG_USB_STORAGE_ONETOUCH=m -+CONFIG_USB_STORAGE_KARMA=m -+CONFIG_USB_STORAGE_CYPRESS_ATACB=m -+CONFIG_USB_STORAGE_ENE_UB6250=m -+CONFIG_USB_MDC800=m -+CONFIG_USB_MICROTEK=m -+CONFIG_USBIP_CORE=m -+CONFIG_USBIP_VHCI_HCD=m -+CONFIG_USBIP_HOST=m -+CONFIG_USB_DWC2=y -+CONFIG_USB_SERIAL=m -+CONFIG_USB_SERIAL_GENERIC=y -+CONFIG_USB_SERIAL_AIRCABLE=m -+CONFIG_USB_SERIAL_ARK3116=m -+CONFIG_USB_SERIAL_BELKIN=m -+CONFIG_USB_SERIAL_CH341=m -+CONFIG_USB_SERIAL_WHITEHEAT=m -+CONFIG_USB_SERIAL_DIGI_ACCELEPORT=m -+CONFIG_USB_SERIAL_CP210X=m -+CONFIG_USB_SERIAL_CYPRESS_M8=m -+CONFIG_USB_SERIAL_EMPEG=m -+CONFIG_USB_SERIAL_FTDI_SIO=m -+CONFIG_USB_SERIAL_VISOR=m -+CONFIG_USB_SERIAL_IPAQ=m -+CONFIG_USB_SERIAL_IR=m -+CONFIG_USB_SERIAL_EDGEPORT=m -+CONFIG_USB_SERIAL_EDGEPORT_TI=m -+CONFIG_USB_SERIAL_F81232=m -+CONFIG_USB_SERIAL_GARMIN=m -+CONFIG_USB_SERIAL_IPW=m -+CONFIG_USB_SERIAL_IUU=m -+CONFIG_USB_SERIAL_KEYSPAN_PDA=m -+CONFIG_USB_SERIAL_KEYSPAN=m -+CONFIG_USB_SERIAL_KLSI=m -+CONFIG_USB_SERIAL_KOBIL_SCT=m -+CONFIG_USB_SERIAL_MCT_U232=m -+CONFIG_USB_SERIAL_METRO=m -+CONFIG_USB_SERIAL_MOS7720=m -+CONFIG_USB_SERIAL_MOS7840=m -+CONFIG_USB_SERIAL_NAVMAN=m -+CONFIG_USB_SERIAL_PL2303=m -+CONFIG_USB_SERIAL_OTI6858=m -+CONFIG_USB_SERIAL_QCAUX=m -+CONFIG_USB_SERIAL_QUALCOMM=m -+CONFIG_USB_SERIAL_SPCP8X5=m -+CONFIG_USB_SERIAL_SAFE=m -+CONFIG_USB_SERIAL_SIERRAWIRELESS=m -+CONFIG_USB_SERIAL_SYMBOL=m -+CONFIG_USB_SERIAL_TI=m -+CONFIG_USB_SERIAL_CYBERJACK=m -+CONFIG_USB_SERIAL_XIRCOM=m -+CONFIG_USB_SERIAL_OPTION=m -+CONFIG_USB_SERIAL_OMNINET=m -+CONFIG_USB_SERIAL_OPTICON=m -+CONFIG_USB_SERIAL_XSENS_MT=m -+CONFIG_USB_SERIAL_WISHBONE=m -+CONFIG_USB_SERIAL_SSU100=m -+CONFIG_USB_SERIAL_QT2=m -+CONFIG_USB_SERIAL_DEBUG=m -+CONFIG_USB_EMI62=m -+CONFIG_USB_EMI26=m -+CONFIG_USB_ADUTUX=m -+CONFIG_USB_SEVSEG=m -+CONFIG_USB_RIO500=m -+CONFIG_USB_LEGOTOWER=m -+CONFIG_USB_LCD=m -+CONFIG_USB_LED=m -+CONFIG_USB_CYPRESS_CY7C63=m -+CONFIG_USB_CYTHERM=m -+CONFIG_USB_IDMOUSE=m -+CONFIG_USB_FTDI_ELAN=m -+CONFIG_USB_APPLEDISPLAY=m -+CONFIG_USB_LD=m -+CONFIG_USB_TRANCEVIBRATOR=m -+CONFIG_USB_IOWARRIOR=m -+CONFIG_USB_TEST=m -+CONFIG_USB_ISIGHTFW=m -+CONFIG_USB_YUREX=m -+CONFIG_USB_ATM=m -+CONFIG_USB_SPEEDTOUCH=m -+CONFIG_USB_CXACRU=m -+CONFIG_USB_UEAGLEATM=m -+CONFIG_USB_XUSBATM=m - CONFIG_MMC=y -+CONFIG_MMC_BLOCK_MINORS=32 -+CONFIG_MMC_BCM2835=y -+CONFIG_MMC_BCM2835_DMA=y -+CONFIG_MMC_BCM2835_SDHOST=y - CONFIG_MMC_SDHCI=y - CONFIG_MMC_SDHCI_PLTFM=y - CONFIG_MMC_SDHCI_BCM2835=y -+CONFIG_MMC_SPI=m -+CONFIG_LEDS_CLASS=y - CONFIG_LEDS_GPIO=y - CONFIG_LEDS_TRIGGER_TIMER=y - CONFIG_LEDS_TRIGGER_ONESHOT=y - CONFIG_LEDS_TRIGGER_HEARTBEAT=y -+CONFIG_LEDS_TRIGGER_BACKLIGHT=y - CONFIG_LEDS_TRIGGER_CPU=y - CONFIG_LEDS_TRIGGER_GPIO=y - CONFIG_LEDS_TRIGGER_DEFAULT_ON=y --CONFIG_LEDS_TRIGGER_TRANSIENT=y --CONFIG_LEDS_TRIGGER_CAMERA=y -+CONFIG_LEDS_TRIGGER_TRANSIENT=m -+CONFIG_LEDS_TRIGGER_CAMERA=m -+CONFIG_LEDS_TRIGGER_INPUT=y -+CONFIG_RTC_CLASS=y -+# CONFIG_RTC_HCTOSYS is not set -+CONFIG_RTC_DRV_DS1307=m -+CONFIG_RTC_DRV_DS1374=m -+CONFIG_RTC_DRV_DS1672=m -+CONFIG_RTC_DRV_DS3232=m -+CONFIG_RTC_DRV_MAX6900=m -+CONFIG_RTC_DRV_RS5C372=m -+CONFIG_RTC_DRV_ISL1208=m -+CONFIG_RTC_DRV_ISL12022=m -+CONFIG_RTC_DRV_ISL12057=m -+CONFIG_RTC_DRV_X1205=m -+CONFIG_RTC_DRV_PCF2127=m -+CONFIG_RTC_DRV_PCF8523=m -+CONFIG_RTC_DRV_PCF8563=m -+CONFIG_RTC_DRV_PCF8583=m -+CONFIG_RTC_DRV_M41T80=m -+CONFIG_RTC_DRV_BQ32K=m -+CONFIG_RTC_DRV_S35390A=m -+CONFIG_RTC_DRV_FM3130=m -+CONFIG_RTC_DRV_RX8581=m -+CONFIG_RTC_DRV_RX8025=m -+CONFIG_RTC_DRV_EM3027=m -+CONFIG_RTC_DRV_RV3029C2=m -+CONFIG_RTC_DRV_M41T93=m -+CONFIG_RTC_DRV_M41T94=m -+CONFIG_RTC_DRV_DS1305=m -+CONFIG_RTC_DRV_DS1390=m -+CONFIG_RTC_DRV_MAX6902=m -+CONFIG_RTC_DRV_R9701=m -+CONFIG_RTC_DRV_RS5C348=m -+CONFIG_RTC_DRV_DS3234=m -+CONFIG_RTC_DRV_PCF2123=m -+CONFIG_RTC_DRV_RX4581=m -+CONFIG_DMADEVICES=y -+CONFIG_DMA_BCM2835=y -+CONFIG_DMA_BCM2708=y -+CONFIG_UIO=m -+CONFIG_UIO_PDRV_GENIRQ=m - CONFIG_STAGING=y --CONFIG_USB_DWC2=y --CONFIG_USB_DWC2_HOST=y -+CONFIG_PRISM2_USB=m -+CONFIG_R8712U=m -+CONFIG_R8188EU=m -+CONFIG_R8723AU=m -+CONFIG_VT6656=m -+CONFIG_SPEAKUP=m -+CONFIG_SPEAKUP_SYNTH_SOFT=m -+CONFIG_STAGING_MEDIA=y -+CONFIG_LIRC_STAGING=y -+CONFIG_LIRC_IMON=m -+CONFIG_LIRC_RPI=m -+CONFIG_LIRC_SASEM=m -+CONFIG_LIRC_SERIAL=m -+CONFIG_FB_TFT=m -+CONFIG_FB_TFT_AGM1264K_FL=m -+CONFIG_FB_TFT_BD663474=m -+CONFIG_FB_TFT_HX8340BN=m -+CONFIG_FB_TFT_HX8347D=m -+CONFIG_FB_TFT_HX8353D=m -+CONFIG_FB_TFT_ILI9320=m -+CONFIG_FB_TFT_ILI9325=m -+CONFIG_FB_TFT_ILI9340=m -+CONFIG_FB_TFT_ILI9341=m -+CONFIG_FB_TFT_ILI9481=m -+CONFIG_FB_TFT_ILI9486=m -+CONFIG_FB_TFT_PCD8544=m -+CONFIG_FB_TFT_RA8875=m -+CONFIG_FB_TFT_S6D02A1=m -+CONFIG_FB_TFT_S6D1121=m -+CONFIG_FB_TFT_SSD1289=m -+CONFIG_FB_TFT_SSD1306=m -+CONFIG_FB_TFT_SSD1331=m -+CONFIG_FB_TFT_SSD1351=m -+CONFIG_FB_TFT_ST7735R=m -+CONFIG_FB_TFT_TINYLCD=m -+CONFIG_FB_TFT_TLS8204=m -+CONFIG_FB_TFT_UC1701=m -+CONFIG_FB_TFT_UPD161704=m -+CONFIG_FB_TFT_WATTEROTT=m -+CONFIG_FB_FLEX=m -+CONFIG_FB_TFT_FBTFT_DEVICE=m -+CONFIG_MAILBOX=y -+CONFIG_BCM2835_MBOX=y - # CONFIG_IOMMU_SUPPORT is not set -+CONFIG_EXTCON=m -+CONFIG_EXTCON_ARIZONA=m -+CONFIG_IIO=m -+CONFIG_IIO_BUFFER=y -+CONFIG_IIO_BUFFER_CB=y -+CONFIG_IIO_KFIFO_BUF=m -+CONFIG_DHT11=m -+CONFIG_RASPBERRYPI_FIRMWARE=y - CONFIG_EXT2_FS=y - CONFIG_EXT2_FS_XATTR=y - CONFIG_EXT2_FS_POSIX_ACL=y -@@ -107,18 +1105,110 @@ CONFIG_EXT3_FS=y - CONFIG_EXT3_FS_POSIX_ACL=y - CONFIG_EXT4_FS=y - CONFIG_EXT4_FS_POSIX_ACL=y -+CONFIG_EXT4_FS_SECURITY=y -+CONFIG_REISERFS_FS=m -+CONFIG_REISERFS_FS_XATTR=y -+CONFIG_REISERFS_FS_POSIX_ACL=y -+CONFIG_REISERFS_FS_SECURITY=y -+CONFIG_JFS_FS=m -+CONFIG_JFS_POSIX_ACL=y -+CONFIG_JFS_SECURITY=y -+CONFIG_JFS_STATISTICS=y -+CONFIG_XFS_FS=m -+CONFIG_XFS_QUOTA=y -+CONFIG_XFS_POSIX_ACL=y -+CONFIG_XFS_RT=y -+CONFIG_GFS2_FS=m -+CONFIG_OCFS2_FS=m -+CONFIG_BTRFS_FS=m -+CONFIG_BTRFS_FS_POSIX_ACL=y -+CONFIG_NILFS2_FS=m -+CONFIG_F2FS_FS=y - CONFIG_FANOTIFY=y -+CONFIG_QFMT_V1=m -+CONFIG_QFMT_V2=m -+CONFIG_AUTOFS4_FS=y -+CONFIG_FUSE_FS=m -+CONFIG_CUSE=m -+CONFIG_FSCACHE=y -+CONFIG_FSCACHE_STATS=y -+CONFIG_FSCACHE_HISTOGRAM=y -+CONFIG_CACHEFILES=y -+CONFIG_ISO9660_FS=m -+CONFIG_JOLIET=y -+CONFIG_ZISOFS=y -+CONFIG_UDF_FS=m - CONFIG_MSDOS_FS=y - CONFIG_VFAT_FS=y -+CONFIG_FAT_DEFAULT_IOCHARSET="ascii" -+CONFIG_NTFS_FS=m -+CONFIG_NTFS_RW=y - CONFIG_TMPFS=y - CONFIG_TMPFS_POSIX_ACL=y --# CONFIG_MISC_FILESYSTEMS is not set -+CONFIG_CONFIGFS_FS=y -+CONFIG_ECRYPT_FS=m -+CONFIG_HFS_FS=m -+CONFIG_HFSPLUS_FS=m -+CONFIG_SQUASHFS=m -+CONFIG_SQUASHFS_XATTR=y -+CONFIG_SQUASHFS_LZO=y -+CONFIG_SQUASHFS_XZ=y - CONFIG_NFS_FS=y --CONFIG_NFSD=y -+CONFIG_NFS_V3_ACL=y -+CONFIG_NFS_V4=y -+CONFIG_NFS_SWAP=y -+CONFIG_ROOT_NFS=y -+CONFIG_NFS_FSCACHE=y -+CONFIG_NFSD=m -+CONFIG_NFSD_V3_ACL=y -+CONFIG_NFSD_V4=y -+CONFIG_CIFS=m -+CONFIG_CIFS_WEAK_PW_HASH=y -+CONFIG_CIFS_UPCALL=y -+CONFIG_CIFS_XATTR=y -+CONFIG_CIFS_POSIX=y -+CONFIG_9P_FS=m -+CONFIG_9P_FS_POSIX_ACL=y -+CONFIG_NLS_DEFAULT="utf8" - CONFIG_NLS_CODEPAGE_437=y -+CONFIG_NLS_CODEPAGE_737=m -+CONFIG_NLS_CODEPAGE_775=m -+CONFIG_NLS_CODEPAGE_850=m -+CONFIG_NLS_CODEPAGE_852=m -+CONFIG_NLS_CODEPAGE_855=m -+CONFIG_NLS_CODEPAGE_857=m -+CONFIG_NLS_CODEPAGE_860=m -+CONFIG_NLS_CODEPAGE_861=m -+CONFIG_NLS_CODEPAGE_862=m -+CONFIG_NLS_CODEPAGE_863=m -+CONFIG_NLS_CODEPAGE_864=m -+CONFIG_NLS_CODEPAGE_865=m -+CONFIG_NLS_CODEPAGE_866=m -+CONFIG_NLS_CODEPAGE_869=m -+CONFIG_NLS_CODEPAGE_936=m -+CONFIG_NLS_CODEPAGE_950=m -+CONFIG_NLS_CODEPAGE_932=m -+CONFIG_NLS_CODEPAGE_949=m -+CONFIG_NLS_CODEPAGE_874=m -+CONFIG_NLS_ISO8859_8=m -+CONFIG_NLS_CODEPAGE_1250=m -+CONFIG_NLS_CODEPAGE_1251=m - CONFIG_NLS_ASCII=y --CONFIG_NLS_ISO8859_1=y -+CONFIG_NLS_ISO8859_1=m -+CONFIG_NLS_ISO8859_2=m -+CONFIG_NLS_ISO8859_3=m -+CONFIG_NLS_ISO8859_4=m -+CONFIG_NLS_ISO8859_5=m -+CONFIG_NLS_ISO8859_6=m -+CONFIG_NLS_ISO8859_7=m -+CONFIG_NLS_ISO8859_9=m -+CONFIG_NLS_ISO8859_13=m -+CONFIG_NLS_ISO8859_14=m -+CONFIG_NLS_ISO8859_15=m -+CONFIG_NLS_KOI8_R=m -+CONFIG_NLS_KOI8_U=m - CONFIG_NLS_UTF8=y -+CONFIG_DLM=m - CONFIG_PRINTK_TIME=y - CONFIG_BOOT_PRINTK_DELAY=y - CONFIG_DYNAMIC_DEBUG=y -@@ -128,14 +1218,38 @@ CONFIG_DEBUG_INFO=y - CONFIG_UNUSED_SYMBOLS=y - CONFIG_DEBUG_MEMORY_INIT=y - CONFIG_LOCKUP_DETECTOR=y -+CONFIG_TIMER_STATS=y -+# CONFIG_DEBUG_PREEMPT is not set -+CONFIG_LATENCYTOP=y -+CONFIG_IRQSOFF_TRACER=y - CONFIG_SCHED_TRACER=y - CONFIG_STACK_TRACER=y -+CONFIG_BLK_DEV_IO_TRACE=y -+# CONFIG_KPROBE_EVENT is not set - CONFIG_FUNCTION_PROFILER=y - CONFIG_TEST_KSTRTOX=y - CONFIG_KGDB=y - CONFIG_KGDB_KDB=y -+CONFIG_KDB_KEYBOARD=y - CONFIG_STRICT_DEVMEM=y - CONFIG_DEBUG_LL=y - CONFIG_EARLY_PRINTK=y -+CONFIG_CRYPTO_USER=m -+CONFIG_CRYPTO_CRYPTD=m -+CONFIG_CRYPTO_CBC=y -+CONFIG_CRYPTO_CTS=m -+CONFIG_CRYPTO_XTS=m -+CONFIG_CRYPTO_XCBC=m -+CONFIG_CRYPTO_SHA512=m -+CONFIG_CRYPTO_TGR192=m -+CONFIG_CRYPTO_WP512=m -+CONFIG_CRYPTO_CAST5=m -+CONFIG_CRYPTO_DES=y -+# CONFIG_CRYPTO_HW is not set -+CONFIG_ARM_CRYPTO=y -+CONFIG_CRYPTO_SHA1_ARM=m -+CONFIG_CRYPTO_AES_ARM=m -+CONFIG_CRC_ITU_T=y -+CONFIG_LIBCRC32C=y - # CONFIG_XZ_DEC_ARM is not set - # CONFIG_XZ_DEC_ARMTHUMB is not set - -From 6fb12ee15eb9b0f5b6fea66c861a9db8ec6671ed Mon Sep 17 00:00:00 2001 -From: Gordon Hollingworth <gordon@raspberrypi.org> -Date: Tue, 12 May 2015 14:47:56 +0100 -Subject: [PATCH 079/170] rpi-ft5406: Add touchscreen driver for pi LCD display - -Fix driver detection failure Check that the buffer response is non-zero meaning the touchscreen was detected - -rpi-ft5406: Use firmware API ---- - drivers/input/touchscreen/Kconfig | 7 + - drivers/input/touchscreen/Makefile | 1 + - drivers/input/touchscreen/rpi-ft5406.c | 246 +++++++++++++++++++++++++++++++++ - 3 files changed, 254 insertions(+) - create mode 100644 drivers/input/touchscreen/rpi-ft5406.c - -diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig -index ae33da7..5935716 100644 ---- a/drivers/input/touchscreen/Kconfig -+++ b/drivers/input/touchscreen/Kconfig -@@ -608,6 +608,13 @@ config TOUCHSCREEN_EDT_FT5X06 - To compile this driver as a module, choose M here: the - module will be called edt-ft5x06. - -+config TOUCHSCREEN_RPI_FT5406 -+ tristate "Raspberry Pi FT5406 driver" -+ depends on RASPBERRYPI_FIRMWARE -+ help -+ Say Y here to enable the Raspberry Pi memory based FT5406 device -+ -+ - config TOUCHSCREEN_MIGOR - tristate "Renesas MIGO-R touchscreen" - depends on SH_MIGOR && I2C -diff --git a/drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile -index cbaa6ab..13ab8c0 100644 ---- a/drivers/input/touchscreen/Makefile -+++ b/drivers/input/touchscreen/Makefile -@@ -29,6 +29,7 @@ obj-$(CONFIG_TOUCHSCREEN_DA9034) += da9034-ts.o - obj-$(CONFIG_TOUCHSCREEN_DA9052) += da9052_tsi.o - obj-$(CONFIG_TOUCHSCREEN_DYNAPRO) += dynapro.o - obj-$(CONFIG_TOUCHSCREEN_EDT_FT5X06) += edt-ft5x06.o -+obj-$(CONFIG_TOUCHSCREEN_RPI_FT5406) += rpi-ft5406.o - obj-$(CONFIG_TOUCHSCREEN_HAMPSHIRE) += hampshire.o - obj-$(CONFIG_TOUCHSCREEN_GUNZE) += gunze.o - obj-$(CONFIG_TOUCHSCREEN_EETI) += eeti_ts.o -diff --git a/drivers/input/touchscreen/rpi-ft5406.c b/drivers/input/touchscreen/rpi-ft5406.c -new file mode 100644 -index 0000000..b27dbee ---- /dev/null -+++ b/drivers/input/touchscreen/rpi-ft5406.c -@@ -0,0 +1,246 @@ -+/* -+ * Driver for memory based ft5406 touchscreen -+ * -+ * Copyright (C) 2015 Raspberry Pi -+ * -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 as -+ * published by the Free Software Foundation. -+ */ -+ -+ -+#include <linux/module.h> -+#include <linux/interrupt.h> -+#include <linux/input.h> -+#include <linux/irq.h> -+#include <linux/delay.h> -+#include <linux/slab.h> -+#include <linux/bitops.h> -+#include <linux/input/mt.h> -+#include <linux/kthread.h> -+#include <linux/platform_device.h> -+#include <asm/io.h> -+#include <soc/bcm2835/raspberrypi-firmware.h> -+ -+#define MAXIMUM_SUPPORTED_POINTS 10 -+struct ft5406_regs { -+ uint8_t device_mode; -+ uint8_t gesture_id; -+ uint8_t num_points; -+ struct ft5406_touch { -+ uint8_t xh; -+ uint8_t xl; -+ uint8_t yh; -+ uint8_t yl; -+ uint8_t res1; -+ uint8_t res2; -+ } point[MAXIMUM_SUPPORTED_POINTS]; -+}; -+ -+#define SCREEN_WIDTH 800 -+#define SCREEN_HEIGHT 480 -+ -+struct ft5406 { -+ struct platform_device * pdev; -+ struct input_dev * input_dev; -+ void __iomem * ts_base; -+ struct ft5406_regs * regs; -+ struct task_struct * thread; -+}; -+ -+/* Thread to poll for touchscreen events -+ * -+ * This thread polls the memory based register copy of the ft5406 registers -+ * using the number of points register to know whether the copy has been -+ * updated (we write 99 to the memory copy, the GPU will write between -+ * 0 - 10 points) -+ */ -+static int ft5406_thread(void *arg) -+{ -+ struct ft5406 *ts = (struct ft5406 *) arg; -+ struct ft5406_regs regs; -+ int known_ids = 0; -+ -+ while(!kthread_should_stop()) -+ { -+ // 60fps polling -+ msleep_interruptible(17); -+ memcpy_fromio(&regs, ts->regs, sizeof(*ts->regs)); -+ writel(99, &ts->regs->num_points); -+ // Do not output if theres no new information (num_points is 99) -+ // or we have no touch points and don't need to release any -+ if(!(regs.num_points == 99 || (regs.num_points == 0 && known_ids == 0))) -+ { -+ int i; -+ int modified_ids = 0, released_ids; -+ for(i = 0; i < regs.num_points; i++) -+ { -+ int x = (((int) regs.point[i].xh & 0xf) << 8) + regs.point[i].xl; -+ int y = (((int) regs.point[i].yh & 0xf) << 8) + regs.point[i].yl; -+ int touchid = (regs.point[i].yh >> 4) & 0xf; -+ -+ modified_ids |= 1 << touchid; -+ -+ if(!((1 << touchid) & known_ids)) -+ dev_dbg(&ts->pdev->dev, "x = %d, y = %d, touchid = %d\n", x, y, touchid); -+ -+ input_mt_slot(ts->input_dev, touchid); -+ input_mt_report_slot_state(ts->input_dev, MT_TOOL_FINGER, 1); -+ -+ input_report_abs(ts->input_dev, ABS_MT_POSITION_X, x); -+ input_report_abs(ts->input_dev, ABS_MT_POSITION_Y, y); -+ -+ } -+ -+ released_ids = known_ids & ~modified_ids; -+ for(i = 0; released_ids && i < MAXIMUM_SUPPORTED_POINTS; i++) -+ { -+ if(released_ids & (1<<i)) -+ { -+ dev_dbg(&ts->pdev->dev, "Released %d, known = %x modified = %x\n", i, known_ids, modified_ids); -+ input_mt_slot(ts->input_dev, i); -+ input_mt_report_slot_state(ts->input_dev, MT_TOOL_FINGER, 0); -+ modified_ids &= ~(1 << i); -+ } -+ } -+ known_ids = modified_ids; -+ -+ input_mt_report_pointer_emulation(ts->input_dev, true); -+ input_sync(ts->input_dev); -+ } -+ -+ } -+ -+ return 0; -+} -+ -+static int ft5406_probe(struct platform_device *pdev) -+{ -+ int ret; -+ struct input_dev * input_dev = input_allocate_device(); -+ struct ft5406 * ts; -+ struct device_node *fw_node; -+ struct rpi_firmware *fw; -+ u32 touchbuf; -+ -+ dev_info(&pdev->dev, "Probing device\n"); -+ -+ fw_node = of_parse_phandle(pdev->dev.of_node, "firmware", 0); -+ if (!fw_node) { -+ dev_err(&pdev->dev, "Missing firmware node\n"); -+ return -ENOENT; -+ } -+ -+ fw = rpi_firmware_get(fw_node); -+ if (!fw) -+ return -EPROBE_DEFER; -+ -+ ret = rpi_firmware_property(fw, RPI_FIRMWARE_FRAMEBUFFER_GET_TOUCHBUF, -+ &touchbuf, sizeof(touchbuf)); -+ if (ret) { -+ dev_err(&pdev->dev, "Failed to get touch buffer\n"); -+ return ret; -+ } -+ -+ if (!touchbuf) { -+ dev_err(&pdev->dev, "Touchscreen not detected\n"); -+ return -ENODEV; -+ } -+ -+ dev_dbg(&pdev->dev, "Got TS buffer 0x%x\n", touchbuf); -+ -+ ts = kzalloc(sizeof(struct ft5406), GFP_KERNEL); -+ -+ if (!ts || !input_dev) { -+ ret = -ENOMEM; -+ dev_err(&pdev->dev, "Failed to allocate memory\n"); -+ return ret; -+ } -+ ts->input_dev = input_dev; -+ platform_set_drvdata(pdev, ts); -+ ts->pdev = pdev; -+ -+ input_dev->name = "FT5406 memory based driver"; -+ -+ __set_bit(EV_KEY, input_dev->evbit); -+ __set_bit(EV_SYN, input_dev->evbit); -+ __set_bit(EV_ABS, input_dev->evbit); -+ -+ input_set_abs_params(input_dev, ABS_MT_POSITION_X, 0, -+ SCREEN_WIDTH, 0, 0); -+ input_set_abs_params(input_dev, ABS_MT_POSITION_Y, 0, -+ SCREEN_HEIGHT, 0, 0); -+ -+ input_mt_init_slots(input_dev, MAXIMUM_SUPPORTED_POINTS, INPUT_MT_DIRECT); -+ -+ input_set_drvdata(input_dev, ts); -+ -+ ret = input_register_device(input_dev); -+ if (ret) { -+ dev_err(&pdev->dev, "could not register input device, %d\n", -+ ret); -+ return ret; -+ } -+ -+ // mmap the physical memory -+ touchbuf &= ~0xc0000000; -+ ts->ts_base = ioremap(touchbuf, sizeof(*ts->regs)); -+ if(ts->ts_base == NULL) -+ { -+ dev_err(&pdev->dev, "Failed to map physical address\n"); -+ input_unregister_device(input_dev); -+ kzfree(ts); -+ return -ENOMEM; -+ } -+ -+ ts->regs = (struct ft5406_regs *) ts->ts_base; -+ -+ // create thread to poll the touch events -+ ts->thread = kthread_run(ft5406_thread, ts, "ft5406"); -+ if(ts->thread == NULL) -+ { -+ dev_err(&pdev->dev, "Failed to create kernel thread"); -+ iounmap(ts->ts_base); -+ input_unregister_device(input_dev); -+ kzfree(ts); -+ } -+ -+ return 0; -+} -+ -+static int ft5406_remove(struct platform_device *pdev) -+{ -+ struct ft5406 *ts = (struct ft5406 *) platform_get_drvdata(pdev); -+ -+ dev_info(&pdev->dev, "Removing rpi-ft5406\n"); -+ -+ kthread_stop(ts->thread); -+ iounmap(ts->ts_base); -+ input_unregister_device(ts->input_dev); -+ kzfree(ts); -+ -+ return 0; -+} -+ -+static const struct of_device_id ft5406_match[] = { -+ { .compatible = "rpi,rpi-ft5406", }, -+ {}, -+}; -+MODULE_DEVICE_TABLE(of, ft5406_match); -+ -+static struct platform_driver ft5406_driver = { -+ .driver = { -+ .name = "rpi-ft5406", -+ .owner = THIS_MODULE, -+ .of_match_table = ft5406_match, -+ }, -+ .probe = ft5406_probe, -+ .remove = ft5406_remove, -+}; -+ -+module_platform_driver(ft5406_driver); -+ -+MODULE_AUTHOR("Gordon Hollingworth"); -+MODULE_DESCRIPTION("Touchscreen driver for memory based FT5406"); -+MODULE_LICENSE("GPL"); - -From b57a6269e03fe055f78ab50add6e2c68d43254e2 Mon Sep 17 00:00:00 2001 -From: Phil Elwell <phil@raspberrypi.org> -Date: Mon, 13 Oct 2014 11:47:53 +0100 -Subject: [PATCH 080/170] Improve __copy_to_user and __copy_from_user - performance - -Provide a __copy_from_user that uses memcpy. On BCM2708, use -optimised memcpy/memmove/memcmp/memset implementations. - -arch/arm: Add mmiocpy/set aliases for memcpy/set - -See: https://github.com/raspberrypi/linux/issues/1082 ---- - arch/arm/include/asm/string.h | 5 + - arch/arm/include/asm/uaccess.h | 3 + - arch/arm/lib/Makefile | 15 +- - arch/arm/lib/arm-mem.h | 159 ++++++++++++ - arch/arm/lib/copy_from_user.S | 4 +- - arch/arm/lib/exports_rpi.c | 37 +++ - arch/arm/lib/memcmp_rpi.S | 285 +++++++++++++++++++++ - arch/arm/lib/memcpy_rpi.S | 61 +++++ - arch/arm/lib/memcpymove.h | 506 +++++++++++++++++++++++++++++++++++++ - arch/arm/lib/memmove_rpi.S | 61 +++++ - arch/arm/lib/memset_rpi.S | 123 +++++++++ - arch/arm/lib/uaccess_with_memcpy.c | 112 +++++++- - 12 files changed, 1365 insertions(+), 6 deletions(-) - create mode 100644 arch/arm/lib/arm-mem.h - create mode 100644 arch/arm/lib/exports_rpi.c - create mode 100644 arch/arm/lib/memcmp_rpi.S - create mode 100644 arch/arm/lib/memcpy_rpi.S - create mode 100644 arch/arm/lib/memcpymove.h - create mode 100644 arch/arm/lib/memmove_rpi.S - create mode 100644 arch/arm/lib/memset_rpi.S - -diff --git a/arch/arm/include/asm/string.h b/arch/arm/include/asm/string.h -index cf4f3aa..9fe7780 100644 ---- a/arch/arm/include/asm/string.h -+++ b/arch/arm/include/asm/string.h -@@ -24,6 +24,11 @@ extern void * memchr(const void *, int, __kernel_size_t); - #define __HAVE_ARCH_MEMSET - extern void * memset(void *, int, __kernel_size_t); - -+#ifdef CONFIG_MACH_BCM2708 -+#define __HAVE_ARCH_MEMCMP -+extern int memcmp(const void *, const void *, size_t); -+#endif -+ - extern void __memzero(void *ptr, __kernel_size_t n); - - #define memset(p,v,n) \ -diff --git a/arch/arm/include/asm/uaccess.h b/arch/arm/include/asm/uaccess.h -index 35c9db8..52d3401 100644 ---- a/arch/arm/include/asm/uaccess.h -+++ b/arch/arm/include/asm/uaccess.h -@@ -493,6 +493,9 @@ do { \ - extern unsigned long __must_check - arm_copy_from_user(void *to, const void __user *from, unsigned long n); - -+extern unsigned long __must_check -+__copy_from_user_std(void *to, const void __user *from, unsigned long n); -+ - static inline unsigned long __must_check - __copy_from_user(void *to, const void __user *from, unsigned long n) - { -diff --git a/arch/arm/lib/Makefile b/arch/arm/lib/Makefile -index d8a7807..9c7dc5b 100644 ---- a/arch/arm/lib/Makefile -+++ b/arch/arm/lib/Makefile -@@ -6,9 +6,8 @@ - - lib-y := backtrace.o changebit.o csumipv6.o csumpartial.o \ - csumpartialcopy.o csumpartialcopyuser.o clearbit.o \ -- delay.o delay-loop.o findbit.o memchr.o memcpy.o \ -- memmove.o memset.o memzero.o setbit.o \ -- strchr.o strrchr.o \ -+ delay.o delay-loop.o findbit.o memchr.o memzero.o \ -+ setbit.o strchr.o strrchr.o \ - testchangebit.o testclearbit.o testsetbit.o \ - ashldi3.o ashrdi3.o lshrdi3.o muldi3.o \ - ucmpdi2.o lib1funcs.o div64.o \ -@@ -18,6 +17,16 @@ lib-y := backtrace.o changebit.o csumipv6.o csumpartial.o \ - mmu-y := clear_user.o copy_page.o getuser.o putuser.o \ - copy_from_user.o copy_to_user.o - -+# Choose optimised implementations for Raspberry Pi -+ifeq ($(CONFIG_MACH_BCM2708),y) -+ CFLAGS_uaccess_with_memcpy.o += -DCOPY_FROM_USER_THRESHOLD=1600 -+ CFLAGS_uaccess_with_memcpy.o += -DCOPY_TO_USER_THRESHOLD=672 -+ obj-$(CONFIG_MODULES) += exports_rpi.o -+ lib-y += memcpy_rpi.o memmove_rpi.o memset_rpi.o memcmp_rpi.o -+else -+ lib-y += memcpy.o memmove.o memset.o -+endif -+ - # using lib_ here won't override already available weak symbols - obj-$(CONFIG_UACCESS_WITH_MEMCPY) += uaccess_with_memcpy.o - -diff --git a/arch/arm/lib/arm-mem.h b/arch/arm/lib/arm-mem.h -new file mode 100644 -index 0000000..5d4bda1 ---- /dev/null -+++ b/arch/arm/lib/arm-mem.h -@@ -0,0 +1,159 @@ -+/* -+Copyright (c) 2013, Raspberry Pi Foundation -+Copyright (c) 2013, RISC OS Open Ltd -+All rights reserved. -+ -+Redistribution and use in source and binary forms, with or without -+modification, are permitted provided that the following conditions are met: -+ * Redistributions of source code must retain the above copyright -+ notice, this list of conditions and the following disclaimer. -+ * 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. -+ * Neither the name of the copyright holder nor the -+ names of its contributors may be used to endorse or promote products -+ derived from this software without specific prior written permission. -+ -+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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. -+*/ -+ -+.macro myfunc fname -+ .func fname -+ .global fname -+fname: -+.endm -+ -+.macro preload_leading_step1 backwards, ptr, base -+/* If the destination is already 16-byte aligned, then we need to preload -+ * between 0 and prefetch_distance (inclusive) cache lines ahead so there -+ * are no gaps when the inner loop starts. -+ */ -+ .if backwards -+ sub ptr, base, #1 -+ bic ptr, ptr, #31 -+ .else -+ bic ptr, base, #31 -+ .endif -+ .set OFFSET, 0 -+ .rept prefetch_distance+1 -+ pld [ptr, #OFFSET] -+ .if backwards -+ .set OFFSET, OFFSET-32 -+ .else -+ .set OFFSET, OFFSET+32 -+ .endif -+ .endr -+.endm -+ -+.macro preload_leading_step2 backwards, ptr, base, leading_bytes, tmp -+/* However, if the destination is not 16-byte aligned, we may need to -+ * preload one more cache line than that. The question we need to ask is: -+ * are the leading bytes more than the amount by which the source -+ * pointer will be rounded down for preloading, and if so, by how many -+ * cache lines? -+ */ -+ .if backwards -+/* Here we compare against how many bytes we are into the -+ * cache line, counting down from the highest such address. -+ * Effectively, we want to calculate -+ * leading_bytes = dst&15 -+ * cacheline_offset = 31-((src-leading_bytes-1)&31) -+ * extra_needed = leading_bytes - cacheline_offset -+ * and test if extra_needed is <= 0, or rearranging: -+ * leading_bytes + (src-leading_bytes-1)&31 <= 31 -+ */ -+ mov tmp, base, lsl #32-5 -+ sbc tmp, tmp, leading_bytes, lsl #32-5 -+ adds tmp, tmp, leading_bytes, lsl #32-5 -+ bcc 61f -+ pld [ptr, #-32*(prefetch_distance+1)] -+ .else -+/* Effectively, we want to calculate -+ * leading_bytes = (-dst)&15 -+ * cacheline_offset = (src+leading_bytes)&31 -+ * extra_needed = leading_bytes - cacheline_offset -+ * and test if extra_needed is <= 0. -+ */ -+ mov tmp, base, lsl #32-5 -+ add tmp, tmp, leading_bytes, lsl #32-5 -+ rsbs tmp, tmp, leading_bytes, lsl #32-5 -+ bls 61f -+ pld [ptr, #32*(prefetch_distance+1)] -+ .endif -+61: -+.endm -+ -+.macro preload_trailing backwards, base, remain, tmp -+ /* We need either 0, 1 or 2 extra preloads */ -+ .if backwards -+ rsb tmp, base, #0 -+ mov tmp, tmp, lsl #32-5 -+ .else -+ mov tmp, base, lsl #32-5 -+ .endif -+ adds tmp, tmp, remain, lsl #32-5 -+ adceqs tmp, tmp, #0 -+ /* The instruction above has two effects: ensures Z is only -+ * set if C was clear (so Z indicates that both shifted quantities -+ * were 0), and clears C if Z was set (so C indicates that the sum -+ * of the shifted quantities was greater and not equal to 32) */ -+ beq 82f -+ .if backwards -+ sub tmp, base, #1 -+ bic tmp, tmp, #31 -+ .else -+ bic tmp, base, #31 -+ .endif -+ bcc 81f -+ .if backwards -+ pld [tmp, #-32*(prefetch_distance+1)] -+81: -+ pld [tmp, #-32*prefetch_distance] -+ .else -+ pld [tmp, #32*(prefetch_distance+2)] -+81: -+ pld [tmp, #32*(prefetch_distance+1)] -+ .endif -+82: -+.endm -+ -+.macro preload_all backwards, narrow_case, shift, base, remain, tmp0, tmp1 -+ .if backwards -+ sub tmp0, base, #1 -+ bic tmp0, tmp0, #31 -+ pld [tmp0] -+ sub tmp1, base, remain, lsl #shift -+ .else -+ bic tmp0, base, #31 -+ pld [tmp0] -+ add tmp1, base, remain, lsl #shift -+ sub tmp1, tmp1, #1 -+ .endif -+ bic tmp1, tmp1, #31 -+ cmp tmp1, tmp0 -+ beq 92f -+ .if narrow_case -+ /* In this case, all the data fits in either 1 or 2 cache lines */ -+ pld [tmp1] -+ .else -+91: -+ .if backwards -+ sub tmp0, tmp0, #32 -+ .else -+ add tmp0, tmp0, #32 -+ .endif -+ cmp tmp0, tmp1 -+ pld [tmp0] -+ bne 91b -+ .endif -+92: -+.endm -diff --git a/arch/arm/lib/copy_from_user.S b/arch/arm/lib/copy_from_user.S -index 1512beb..3da60dd 100644 ---- a/arch/arm/lib/copy_from_user.S -+++ b/arch/arm/lib/copy_from_user.S -@@ -89,11 +89,13 @@ - - .text - --ENTRY(arm_copy_from_user) -+ENTRY(__copy_from_user_std) -+WEAK(arm_copy_from_user) - - #include "copy_template.S" - - ENDPROC(arm_copy_from_user) -+ENDPROC(__copy_from_user_std) - - .pushsection .fixup,"ax" - .align 0 -diff --git a/arch/arm/lib/exports_rpi.c b/arch/arm/lib/exports_rpi.c -new file mode 100644 -index 0000000..1f82604 ---- /dev/null -+++ b/arch/arm/lib/exports_rpi.c -@@ -0,0 +1,37 @@ -+/** -+ * Copyright (c) 2014, Raspberry Pi (Trading) Ltd. -+ * -+ * 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, -+ * without modification. -+ * 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. -+ * 3. The names of the above-listed copyright holders may not be used -+ * to endorse or promote products derived from this software without -+ * specific prior written permission. -+ * -+ * ALTERNATIVELY, this software may be distributed under the terms of the -+ * GNU General Public License ("GPL") version 2, as published by the Free -+ * Software Foundation. -+ * -+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER OR -+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+ */ -+ -+#include <linux/kernel.h> -+#include <linux/module.h> -+ -+EXPORT_SYMBOL(memcmp); -diff --git a/arch/arm/lib/memcmp_rpi.S b/arch/arm/lib/memcmp_rpi.S -new file mode 100644 -index 0000000..bf6e4ed ---- /dev/null -+++ b/arch/arm/lib/memcmp_rpi.S -@@ -0,0 +1,285 @@ -+/* -+Copyright (c) 2013, Raspberry Pi Foundation -+Copyright (c) 2013, RISC OS Open Ltd -+All rights reserved. -+ -+Redistribution and use in source and binary forms, with or without -+modification, are permitted provided that the following conditions are met: -+ * Redistributions of source code must retain the above copyright -+ notice, this list of conditions and the following disclaimer. -+ * 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. -+ * Neither the name of the copyright holder nor the -+ names of its contributors may be used to endorse or promote products -+ derived from this software without specific prior written permission. -+ -+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY -+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+*/ -+ -+#include <linux/linkage.h> -+#include "arm-mem.h" -+ -+/* Prevent the stack from becoming executable */ -+#if defined(__linux__) && defined(__ELF__) -+.section .note.GNU-stack,"",%progbits -+#endif -+ -+ .text -+ .arch armv6 -+ .object_arch armv4 -+ .arm -+ .altmacro -+ .p2align 2 -+ -+.macro memcmp_process_head unaligned -+ .if unaligned -+ ldr DAT0, [S_1], #4 -+ ldr DAT1, [S_1], #4 -+ ldr DAT2, [S_1], #4 -+ ldr DAT3, [S_1], #4 -+ .else -+ ldmia S_1!, {DAT0, DAT1, DAT2, DAT3} -+ .endif -+ ldmia S_2!, {DAT4, DAT5, DAT6, DAT7} -+.endm -+ -+.macro memcmp_process_tail -+ cmp DAT0, DAT4 -+ cmpeq DAT1, DAT5 -+ cmpeq DAT2, DAT6 -+ cmpeq DAT3, DAT7 -+ bne 200f -+.endm -+ -+.macro memcmp_leading_31bytes -+ movs DAT0, OFF, lsl #31 -+ ldrmib DAT0, [S_1], #1 -+ ldrcsh DAT1, [S_1], #2 -+ ldrmib DAT4, [S_2], #1 -+ ldrcsh DAT5, [S_2], #2 -+ movpl DAT0, #0 -+ movcc DAT1, #0 -+ movpl DAT4, #0 -+ movcc DAT5, #0 -+ submi N, N, #1 -+ subcs N, N, #2 -+ cmp DAT0, DAT4 -+ cmpeq DAT1, DAT5 -+ bne 200f -+ movs DAT0, OFF, lsl #29 -+ ldrmi DAT0, [S_1], #4 -+ ldrcs DAT1, [S_1], #4 -+ ldrcs DAT2, [S_1], #4 -+ ldrmi DAT4, [S_2], #4 -+ ldmcsia S_2!, {DAT5, DAT6} -+ movpl DAT0, #0 -+ movcc DAT1, #0 -+ movcc DAT2, #0 -+ movpl DAT4, #0 -+ movcc DAT5, #0 -+ movcc DAT6, #0 -+ submi N, N, #4 -+ subcs N, N, #8 -+ cmp DAT0, DAT4 -+ cmpeq DAT1, DAT5 -+ cmpeq DAT2, DAT6 -+ bne 200f -+ tst OFF, #16 -+ beq 105f -+ memcmp_process_head 1 -+ sub N, N, #16 -+ memcmp_process_tail -+105: -+.endm -+ -+.macro memcmp_trailing_15bytes unaligned -+ movs N, N, lsl #29 -+ .if unaligned -+ ldrcs DAT0, [S_1], #4 -+ ldrcs DAT1, [S_1], #4 -+ .else -+ ldmcsia S_1!, {DAT0, DAT1} -+ .endif -+ ldrmi DAT2, [S_1], #4 -+ ldmcsia S_2!, {DAT4, DAT5} -+ ldrmi DAT6, [S_2], #4 -+ movcc DAT0, #0 -+ movcc DAT1, #0 -+ movpl DAT2, #0 -+ movcc DAT4, #0 -+ movcc DAT5, #0 -+ movpl DAT6, #0 -+ cmp DAT0, DAT4 -+ cmpeq DAT1, DAT5 -+ cmpeq DAT2, DAT6 -+ bne 200f -+ movs N, N, lsl #2 -+ ldrcsh DAT0, [S_1], #2 -+ ldrmib DAT1, [S_1] -+ ldrcsh DAT4, [S_2], #2 -+ ldrmib DAT5, [S_2] -+ movcc DAT0, #0 -+ movpl DAT1, #0 -+ movcc DAT4, #0 -+ movpl DAT5, #0 -+ cmp DAT0, DAT4 -+ cmpeq DAT1, DAT5 -+ bne 200f -+.endm -+ -+.macro memcmp_long_inner_loop unaligned -+110: -+ memcmp_process_head unaligned -+ pld [S_2, #prefetch_distance*32 + 16] -+ memcmp_process_tail -+ memcmp_process_head unaligned -+ pld [S_1, OFF] -+ memcmp_process_tail -+ subs N, N, #32 -+ bhs 110b -+ /* Just before the final (prefetch_distance+1) 32-byte blocks, -+ * deal with final preloads */ -+ preload_trailing 0, S_1, N, DAT0 -+ preload_trailing 0, S_2, N, DAT0 -+ add N, N, #(prefetch_distance+2)*32 - 16 -+120: -+ memcmp_process_head unaligned -+ memcmp_process_tail -+ subs N, N, #16 -+ bhs 120b -+ /* Trailing words and bytes */ -+ tst N, #15 -+ beq 199f -+ memcmp_trailing_15bytes unaligned -+199: /* Reached end without detecting a difference */ -+ mov a1, #0 -+ setend le -+ pop {DAT1-DAT6, pc} -+.endm -+ -+.macro memcmp_short_inner_loop unaligned -+ subs N, N, #16 /* simplifies inner loop termination */ -+ blo 122f -+120: -+ memcmp_process_head unaligned -+ memcmp_process_tail -+ subs N, N, #16 -+ bhs 120b -+122: /* Trailing words and bytes */ -+ tst N, #15 -+ beq 199f -+ memcmp_trailing_15bytes unaligned -+199: /* Reached end without detecting a difference */ -+ mov a1, #0 -+ setend le -+ pop {DAT1-DAT6, pc} -+.endm -+ -+/* -+ * int memcmp(const void *s1, const void *s2, size_t n); -+ * On entry: -+ * a1 = pointer to buffer 1 -+ * a2 = pointer to buffer 2 -+ * a3 = number of bytes to compare (as unsigned chars) -+ * On exit: -+ * a1 = >0/=0/<0 if s1 >/=/< s2 -+ */ -+ -+.set prefetch_distance, 2 -+ -+ENTRY(memcmp) -+ S_1 .req a1 -+ S_2 .req a2 -+ N .req a3 -+ DAT0 .req a4 -+ DAT1 .req v1 -+ DAT2 .req v2 -+ DAT3 .req v3 -+ DAT4 .req v4 -+ DAT5 .req v5 -+ DAT6 .req v6 -+ DAT7 .req ip -+ OFF .req lr -+ -+ push {DAT1-DAT6, lr} -+ setend be /* lowest-addressed bytes are most significant */ -+ -+ /* To preload ahead as we go, we need at least (prefetch_distance+2) 32-byte blocks */ -+ cmp N, #(prefetch_distance+3)*32 - 1 -+ blo 170f -+ -+ /* Long case */ -+ /* Adjust N so that the decrement instruction can also test for -+ * inner loop termination. We want it to stop when there are -+ * (prefetch_distance+1) complete blocks to go. */ -+ sub N, N, #(prefetch_distance+2)*32 -+ preload_leading_step1 0, DAT0, S_1 -+ preload_leading_step1 0, DAT1, S_2 -+ tst S_2, #31 -+ beq 154f -+ rsb OFF, S_2, #0 /* no need to AND with 15 here */ -+ preload_leading_step2 0, DAT0, S_1, OFF, DAT2 -+ preload_leading_step2 0, DAT1, S_2, OFF, DAT2 -+ memcmp_leading_31bytes -+154: /* Second source now cacheline (32-byte) aligned; we have at -+ * least one prefetch to go. */ -+ /* Prefetch offset is best selected such that it lies in the -+ * first 8 of each 32 bytes - but it's just as easy to aim for -+ * the first one */ -+ and OFF, S_1, #31 -+ rsb OFF, OFF, #32*prefetch_distance -+ tst S_1, #3 -+ bne 140f -+ memcmp_long_inner_loop 0 -+140: memcmp_long_inner_loop 1 -+ -+170: /* Short case */ -+ teq N, #0 -+ beq 199f -+ preload_all 0, 0, 0, S_1, N, DAT0, DAT1 -+ preload_all 0, 0, 0, S_2, N, DAT0, DAT1 -+ tst S_2, #3 -+ beq 174f -+172: subs N, N, #1 -+ blo 199f -+ ldrb DAT0, [S_1], #1 -+ ldrb DAT4, [S_2], #1 -+ cmp DAT0, DAT4 -+ bne 200f -+ tst S_2, #3 -+ bne 172b -+174: /* Second source now 4-byte aligned; we have 0 or more bytes to go */ -+ tst S_1, #3 -+ bne 140f -+ memcmp_short_inner_loop 0 -+140: memcmp_short_inner_loop 1 -+ -+200: /* Difference found: determine sign. */ -+ movhi a1, #1 -+ movlo a1, #-1 -+ setend le -+ pop {DAT1-DAT6, pc} -+ -+ .unreq S_1 -+ .unreq S_2 -+ .unreq N -+ .unreq DAT0 -+ .unreq DAT1 -+ .unreq DAT2 -+ .unreq DAT3 -+ .unreq DAT4 -+ .unreq DAT5 -+ .unreq DAT6 -+ .unreq DAT7 -+ .unreq OFF -+ENDPROC(memcmp) -diff --git a/arch/arm/lib/memcpy_rpi.S b/arch/arm/lib/memcpy_rpi.S -new file mode 100644 -index 0000000..30f8a90 ---- /dev/null -+++ b/arch/arm/lib/memcpy_rpi.S -@@ -0,0 +1,61 @@ -+/* -+Copyright (c) 2013, Raspberry Pi Foundation -+Copyright (c) 2013, RISC OS Open Ltd -+All rights reserved. -+ -+Redistribution and use in source and binary forms, with or without -+modification, are permitted provided that the following conditions are met: -+ * Redistributions of source code must retain the above copyright -+ notice, this list of conditions and the following disclaimer. -+ * 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. -+ * Neither the name of the copyright holder nor the -+ names of its contributors may be used to endorse or promote products -+ derived from this software without specific prior written permission. -+ -+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY -+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+*/ -+ -+#include <linux/linkage.h> -+#include "arm-mem.h" -+#include "memcpymove.h" -+ -+/* Prevent the stack from becoming executable */ -+#if defined(__linux__) && defined(__ELF__) -+.section .note.GNU-stack,"",%progbits -+#endif -+ -+ .text -+ .arch armv6 -+ .object_arch armv4 -+ .arm -+ .altmacro -+ .p2align 2 -+ -+/* -+ * void *memcpy(void * restrict s1, const void * restrict s2, size_t n); -+ * On entry: -+ * a1 = pointer to destination -+ * a2 = pointer to source -+ * a3 = number of bytes to copy -+ * On exit: -+ * a1 preserved -+ */ -+ -+.set prefetch_distance, 3 -+ -+ENTRY(mmiocpy) -+ENTRY(memcpy) -+ memcpy 0 -+ENDPROC(memcpy) -+ENDPROC(mmiocpy) -diff --git a/arch/arm/lib/memcpymove.h b/arch/arm/lib/memcpymove.h -new file mode 100644 -index 0000000..d8be584 ---- /dev/null -+++ b/arch/arm/lib/memcpymove.h -@@ -0,0 +1,506 @@ -+/* -+Copyright (c) 2013, Raspberry Pi Foundation -+Copyright (c) 2013, RISC OS Open Ltd -+All rights reserved. -+ -+Redistribution and use in source and binary forms, with or without -+modification, are permitted provided that the following conditions are met: -+ * Redistributions of source code must retain the above copyright -+ notice, this list of conditions and the following disclaimer. -+ * 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. -+ * Neither the name of the copyright holder nor the -+ names of its contributors may be used to endorse or promote products -+ derived from this software without specific prior written permission. -+ -+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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. -+*/ -+ -+.macro unaligned_words backwards, align, use_pld, words, r0, r1, r2, r3, r4, r5, r6, r7, r8 -+ .if words == 1 -+ .if backwards -+ mov r1, r0, lsl #32-align*8 -+ ldr r0, [S, #-4]! -+ orr r1, r1, r0, lsr #align*8 -+ str r1, [D, #-4]! -+ .else -+ mov r0, r1, lsr #align*8 -+ ldr r1, [S, #4]! -+ orr r0, r0, r1, lsl #32-align*8 -+ str r0, [D], #4 -+ .endif -+ .elseif words == 2 -+ .if backwards -+ ldr r1, [S, #-4]! -+ mov r2, r0, lsl #32-align*8 -+ ldr r0, [S, #-4]! -+ orr r2, r2, r1, lsr #align*8 -+ mov r1, r1, lsl #32-align*8 -+ orr r1, r1, r0, lsr #align*8 -+ stmdb D!, {r1, r2} -+ .else -+ ldr r1, [S, #4]! -+ mov r0, r2, lsr #align*8 -+ ldr r2, [S, #4]! -+ orr r0, r0, r1, lsl #32-align*8 -+ mov r1, r1, lsr #align*8 -+ orr r1, r1, r2, lsl #32-align*8 -+ stmia D!, {r0, r1} -+ .endif -+ .elseif words == 4 -+ .if backwards -+ ldmdb S!, {r2, r3} -+ mov r4, r0, lsl #32-align*8 -+ ldmdb S!, {r0, r1} -+ orr r4, r4, r3, lsr #align*8 -+ mov r3, r3, lsl #32-align*8 -+ orr r3, r3, r2, lsr #align*8 -+ mov r2, r2, lsl #32-align*8 -+ orr r2, r2, r1, lsr #align*8 -+ mov r1, r1, lsl #32-align*8 -+ orr r1, r1, r0, lsr #align*8 -+ stmdb D!, {r1, r2, r3, r4} -+ .else -+ ldmib S!, {r1, r2} -+ mov r0, r4, lsr #align*8 -+ ldmib S!, {r3, r4} -+ orr r0, r0, r1, lsl #32-align*8 -+ mov r1, r1, lsr #align*8 -+ orr r1, r1, r2, lsl #32-align*8 -+ mov r2, r2, lsr #align*8 -+ orr r2, r2, r3, lsl #32-align*8 -+ mov r3, r3, lsr #align*8 -+ orr r3, r3, r4, lsl #32-align*8 -+ stmia D!, {r0, r1, r2, r3} -+ .endif -+ .elseif words == 8 -+ .if backwards -+ ldmdb S!, {r4, r5, r6, r7} -+ mov r8, r0, lsl #32-align*8 -+ ldmdb S!, {r0, r1, r2, r3} -+ .if use_pld -+ pld [S, OFF] -+ .endif -+ orr r8, r8, r7, lsr #align*8 -+ mov r7, r7, lsl #32-align*8 -+ orr r7, r7, r6, lsr #align*8 -+ mov r6, r6, lsl #32-align*8 -+ orr r6, r6, r5, lsr #align*8 -+ mov r5, r5, lsl #32-align*8 -+ orr r5, r5, r4, lsr #align*8 -+ mov r4, r4, lsl #32-align*8 -+ orr r4, r4, r3, lsr #align*8 -+ mov r3, r3, lsl #32-align*8 -+ orr r3, r3, r2, lsr #align*8 -+ mov r2, r2, lsl #32-align*8 -+ orr r2, r2, r1, lsr #align*8 -+ mov r1, r1, lsl #32-align*8 -+ orr r1, r1, r0, lsr #align*8 -+ stmdb D!, {r5, r6, r7, r8} -+ stmdb D!, {r1, r2, r3, r4} -+ .else -+ ldmib S!, {r1, r2, r3, r4} -+ mov r0, r8, lsr #align*8 -+ ldmib S!, {r5, r6, r7, r8} -+ .if use_pld -+ pld [S, OFF] -+ .endif -+ orr r0, r0, r1, lsl #32-align*8 -+ mov r1, r1, lsr #align*8 -+ orr r1, r1, r2, lsl #32-align*8 -+ mov r2, r2, lsr #align*8 -+ orr r2, r2, r3, lsl #32-align*8 -+ mov r3, r3, lsr #align*8 -+ orr r3, r3, r4, lsl #32-align*8 -+ mov r4, r4, lsr #align*8 -+ orr r4, r4, r5, lsl #32-align*8 -+ mov r5, r5, lsr #align*8 -+ orr r5, r5, r6, lsl #32-align*8 -+ mov r6, r6, lsr #align*8 -+ orr r6, r6, r7, lsl #32-align*8 -+ mov r7, r7, lsr #align*8 -+ orr r7, r7, r8, lsl #32-align*8 -+ stmia D!, {r0, r1, r2, r3} -+ stmia D!, {r4, r5, r6, r7} -+ .endif -+ .endif -+.endm -+ -+.macro memcpy_leading_15bytes backwards, align -+ movs DAT1, DAT2, lsl #31 -+ sub N, N, DAT2 -+ .if backwards -+ ldrmib DAT0, [S, #-1]! -+ ldrcsh DAT1, [S, #-2]! -+ strmib DAT0, [D, #-1]! -+ strcsh DAT1, [D, #-2]! -+ .else -+ ldrmib DAT0, [S], #1 -+ ldrcsh DAT1, [S], #2 -+ strmib DAT0, [D], #1 -+ strcsh DAT1, [D], #2 -+ .endif -+ movs DAT1, DAT2, lsl #29 -+ .if backwards -+ ldrmi DAT0, [S, #-4]! -+ .if align == 0 -+ ldmcsdb S!, {DAT1, DAT2} -+ .else -+ ldrcs DAT2, [S, #-4]! -+ ldrcs DAT1, [S, #-4]! -+ .endif -+ strmi DAT0, [D, #-4]! -+ stmcsdb D!, {DAT1, DAT2} -+ .else -+ ldrmi DAT0, [S], #4 -+ .if align == 0 -+ ldmcsia S!, {DAT1, DAT2} -+ .else -+ ldrcs DAT1, [S], #4 -+ ldrcs DAT2, [S], #4 -+ .endif -+ strmi DAT0, [D], #4 -+ stmcsia D!, {DAT1, DAT2} -+ .endif -+.endm -+ -+.macro memcpy_trailing_15bytes backwards, align -+ movs N, N, lsl #29 -+ .if backwards -+ .if align == 0 -+ ldmcsdb S!, {DAT0, DAT1} -+ .else -+ ldrcs DAT1, [S, #-4]! -+ ldrcs DAT0, [S, #-4]! -+ .endif -+ ldrmi DAT2, [S, #-4]! -+ stmcsdb D!, {DAT0, DAT1} -+ strmi DAT2, [D, #-4]! -+ .else -+ .if align == 0 -+ ldmcsia S!, {DAT0, DAT1} -+ .else -+ ldrcs DAT0, [S], #4 -+ ldrcs DAT1, [S], #4 -+ .endif -+ ldrmi DAT2, [S], #4 -+ stmcsia D!, {DAT0, DAT1} -+ strmi DAT2, [D], #4 -+ .endif -+ movs N, N, lsl #2 -+ .if backwards -+ ldrcsh DAT0, [S, #-2]! -+ ldrmib DAT1, [S, #-1] -+ strcsh DAT0, [D, #-2]! -+ strmib DAT1, [D, #-1] -+ .else -+ ldrcsh DAT0, [S], #2 -+ ldrmib DAT1, [S] -+ strcsh DAT0, [D], #2 -+ strmib DAT1, [D] -+ .endif -+.endm -+ -+.macro memcpy_long_inner_loop backwards, align -+ .if align != 0 -+ .if backwards -+ ldr DAT0, [S, #-align]! -+ .else -+ ldr LAST, [S, #-align]! -+ .endif -+ .endif -+110: -+ .if align == 0 -+ .if backwards -+ ldmdb S!, {DAT0, DAT1, DAT2, DAT3, DAT4, DAT5, DAT6, LAST} -+ pld [S, OFF] -+ stmdb D!, {DAT4, DAT5, DAT6, LAST} -+ stmdb D!, {DAT0, DAT1, DAT2, DAT3} -+ .else -+ ldmia S!, {DAT0, DAT1, DAT2, DAT3, DAT4, DAT5, DAT6, LAST} -+ pld [S, OFF] -+ stmia D!, {DAT0, DAT1, DAT2, DAT3} -+ stmia D!, {DAT4, DAT5, DAT6, LAST} -+ .endif -+ .else -+ unaligned_words backwards, align, 1, 8, DAT0, DAT1, DAT2, DAT3, DAT4, DAT5, DAT6, DAT7, LAST -+ .endif -+ subs N, N, #32 -+ bhs 110b -+ /* Just before the final (prefetch_distance+1) 32-byte blocks, deal with final preloads */ -+ preload_trailing backwards, S, N, OFF -+ add N, N, #(prefetch_distance+2)*32 - 32 -+120: -+ .if align == 0 -+ .if backwards -+ ldmdb S!, {DAT0, DAT1, DAT2, DAT3, DAT4, DAT5, DAT6, LAST} -+ stmdb D!, {DAT4, DAT5, DAT6, LAST} -+ stmdb D!, {DAT0, DAT1, DAT2, DAT3} -+ .else -+ ldmia S!, {DAT0, DAT1, DAT2, DAT3, DAT4, DAT5, DAT6, LAST} -+ stmia D!, {DAT0, DAT1, DAT2, DAT3} -+ stmia D!, {DAT4, DAT5, DAT6, LAST} -+ .endif -+ .else -+ unaligned_words backwards, align, 0, 8, DAT0, DAT1, DAT2, DAT3, DAT4, DAT5, DAT6, DAT7, LAST -+ .endif -+ subs N, N, #32 -+ bhs 120b -+ tst N, #16 -+ .if align == 0 -+ .if backwards -+ ldmnedb S!, {DAT0, DAT1, DAT2, LAST} -+ stmnedb D!, {DAT0, DAT1, DAT2, LAST} -+ .else -+ ldmneia S!, {DAT0, DAT1, DAT2, LAST} -+ stmneia D!, {DAT0, DAT1, DAT2, LAST} -+ .endif -+ .else -+ beq 130f -+ unaligned_words backwards, align, 0, 4, DAT0, DAT1, DAT2, DAT3, LAST -+130: -+ .endif -+ /* Trailing words and bytes */ -+ tst N, #15 -+ beq 199f -+ .if align != 0 -+ add S, S, #align -+ .endif -+ memcpy_trailing_15bytes backwards, align -+199: -+ pop {DAT3, DAT4, DAT5, DAT6, DAT7} -+ pop {D, DAT1, DAT2, pc} -+.endm -+ -+.macro memcpy_medium_inner_loop backwards, align -+120: -+ .if backwards -+ .if align == 0 -+ ldmdb S!, {DAT0, DAT1, DAT2, LAST} -+ .else -+ ldr LAST, [S, #-4]! -+ ldr DAT2, [S, #-4]! -+ ldr DAT1, [S, #-4]! -+ ldr DAT0, [S, #-4]! -+ .endif -+ stmdb D!, {DAT0, DAT1, DAT2, LAST} -+ .else -+ .if align == 0 -+ ldmia S!, {DAT0, DAT1, DAT2, LAST} -+ .else -+ ldr DAT0, [S], #4 -+ ldr DAT1, [S], #4 -+ ldr DAT2, [S], #4 -+ ldr LAST, [S], #4 -+ .endif -+ stmia D!, {DAT0, DAT1, DAT2, LAST} -+ .endif -+ subs N, N, #16 -+ bhs 120b -+ /* Trailing words and bytes */ -+ tst N, #15 -+ beq 199f -+ memcpy_trailing_15bytes backwards, align -+199: -+ pop {D, DAT1, DAT2, pc} -+.endm -+ -+.macro memcpy_short_inner_loop backwards, align -+ tst N, #16 -+ .if backwards -+ .if align == 0 -+ ldmnedb S!, {DAT0, DAT1, DAT2, LAST} -+ .else -+ ldrne LAST, [S, #-4]! -+ ldrne DAT2, [S, #-4]! -+ ldrne DAT1, [S, #-4]! -+ ldrne DAT0, [S, #-4]! -+ .endif -+ stmnedb D!, {DAT0, DAT1, DAT2, LAST} -+ .else -+ .if align == 0 -+ ldmneia S!, {DAT0, DAT1, DAT2, LAST} -+ .else -+ ldrne DAT0, [S], #4 -+ ldrne DAT1, [S], #4 -+ ldrne DAT2, [S], #4 -+ ldrne LAST, [S], #4 -+ .endif -+ stmneia D!, {DAT0, DAT1, DAT2, LAST} -+ .endif -+ memcpy_trailing_15bytes backwards, align -+199: -+ pop {D, DAT1, DAT2, pc} -+.endm -+ -+.macro memcpy backwards -+ D .req a1 -+ S .req a2 -+ N .req a3 -+ DAT0 .req a4 -+ DAT1 .req v1 -+ DAT2 .req v2 -+ DAT3 .req v3 -+ DAT4 .req v4 -+ DAT5 .req v5 -+ DAT6 .req v6 -+ DAT7 .req sl -+ LAST .req ip -+ OFF .req lr -+ -+ .cfi_startproc -+ -+ push {D, DAT1, DAT2, lr} -+ -+ .cfi_def_cfa_offset 16 -+ .cfi_rel_offset D, 0 -+ .cfi_undefined S -+ .cfi_undefined N -+ .cfi_undefined DAT0 -+ .cfi_rel_offset DAT1, 4 -+ .cfi_rel_offset DAT2, 8 -+ .cfi_undefined LAST -+ .cfi_rel_offset lr, 12 -+ -+ .if backwards -+ add D, D, N -+ add S, S, N -+ .endif -+ -+ /* See if we're guaranteed to have at least one 16-byte aligned 16-byte write */ -+ cmp N, #31 -+ blo 170f -+ /* To preload ahead as we go, we need at least (prefetch_distance+2) 32-byte blocks */ -+ cmp N, #(prefetch_distance+3)*32 - 1 -+ blo 160f -+ -+ /* Long case */ -+ push {DAT3, DAT4, DAT5, DAT6, DAT7} -+ -+ .cfi_def_cfa_offset 36 -+ .cfi_rel_offset D, 20 -+ .cfi_rel_offset DAT1, 24 -+ .cfi_rel_offset DAT2, 28 -+ .cfi_rel_offset DAT3, 0 -+ .cfi_rel_offset DAT4, 4 -+ .cfi_rel_offset DAT5, 8 -+ .cfi_rel_offset DAT6, 12 -+ .cfi_rel_offset DAT7, 16 -+ .cfi_rel_offset lr, 32 -+ -+ /* Adjust N so that the decrement instruction can also test for -+ * inner loop termination. We want it to stop when there are -+ * (prefetch_distance+1) complete blocks to go. */ -+ sub N, N, #(prefetch_distance+2)*32 -+ preload_leading_step1 backwards, DAT0, S -+ .if backwards -+ /* Bug in GAS: it accepts, but mis-assembles the instruction -+ * ands DAT2, D, #60, 2 -+ * which sets DAT2 to the number of leading bytes until destination is aligned and also clears C (sets borrow) -+ */ -+ .word 0xE210513C -+ beq 154f -+ .else -+ ands DAT2, D, #15 -+ beq 154f -+ rsb DAT2, DAT2, #16 /* number of leading bytes until destination aligned */ -+ .endif -+ preload_leading_step2 backwards, DAT0, S, DAT2, OFF -+ memcpy_leading_15bytes backwards, 1 -+154: /* Destination now 16-byte aligned; we have at least one prefetch as well as at least one 16-byte output block */ -+ /* Prefetch offset is best selected such that it lies in the first 8 of each 32 bytes - but it's just as easy to aim for the first one */ -+ .if backwards -+ rsb OFF, S, #3 -+ and OFF, OFF, #28 -+ sub OFF, OFF, #32*(prefetch_distance+1) -+ .else -+ and OFF, S, #28 -+ rsb OFF, OFF, #32*prefetch_distance -+ .endif -+ movs DAT0, S, lsl #31 -+ bhi 157f -+ bcs 156f -+ bmi 155f -+ memcpy_long_inner_loop backwards, 0 -+155: memcpy_long_inner_loop backwards, 1 -+156: memcpy_long_inner_loop backwards, 2 -+157: memcpy_long_inner_loop backwards, 3 -+ -+ .cfi_def_cfa_offset 16 -+ .cfi_rel_offset D, 0 -+ .cfi_rel_offset DAT1, 4 -+ .cfi_rel_offset DAT2, 8 -+ .cfi_same_value DAT3 -+ .cfi_same_value DAT4 -+ .cfi_same_value DAT5 -+ .cfi_same_value DAT6 -+ .cfi_same_value DAT7 -+ .cfi_rel_offset lr, 12 -+ -+160: /* Medium case */ -+ preload_all backwards, 0, 0, S, N, DAT2, OFF -+ sub N, N, #16 /* simplifies inner loop termination */ -+ .if backwards -+ ands DAT2, D, #15 -+ beq 164f -+ .else -+ ands DAT2, D, #15 -+ beq 164f -+ rsb DAT2, DAT2, #16 -+ .endif -+ memcpy_leading_15bytes backwards, align -+164: /* Destination now 16-byte aligned; we have at least one 16-byte output block */ -+ tst S, #3 -+ bne 140f -+ memcpy_medium_inner_loop backwards, 0 -+140: memcpy_medium_inner_loop backwards, 1 -+ -+170: /* Short case, less than 31 bytes, so no guarantee of at least one 16-byte block */ -+ teq N, #0 -+ beq 199f -+ preload_all backwards, 1, 0, S, N, DAT2, LAST -+ tst D, #3 -+ beq 174f -+172: subs N, N, #1 -+ blo 199f -+ .if backwards -+ ldrb DAT0, [S, #-1]! -+ strb DAT0, [D, #-1]! -+ .else -+ ldrb DAT0, [S], #1 -+ strb DAT0, [D], #1 -+ .endif -+ tst D, #3 -+ bne 172b -+174: /* Destination now 4-byte aligned; we have 0 or more output bytes to go */ -+ tst S, #3 -+ bne 140f -+ memcpy_short_inner_loop backwards, 0 -+140: memcpy_short_inner_loop backwards, 1 -+ -+ .cfi_endproc -+ -+ .unreq D -+ .unreq S -+ .unreq N -+ .unreq DAT0 -+ .unreq DAT1 -+ .unreq DAT2 -+ .unreq DAT3 -+ .unreq DAT4 -+ .unreq DAT5 -+ .unreq DAT6 -+ .unreq DAT7 -+ .unreq LAST -+ .unreq OFF -+.endm -diff --git a/arch/arm/lib/memmove_rpi.S b/arch/arm/lib/memmove_rpi.S -new file mode 100644 -index 0000000..8b0760c ---- /dev/null -+++ b/arch/arm/lib/memmove_rpi.S -@@ -0,0 +1,61 @@ -+/* -+Copyright (c) 2013, Raspberry Pi Foundation -+Copyright (c) 2013, RISC OS Open Ltd -+All rights reserved. -+ -+Redistribution and use in source and binary forms, with or without -+modification, are permitted provided that the following conditions are met: -+ * Redistributions of source code must retain the above copyright -+ notice, this list of conditions and the following disclaimer. -+ * 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. -+ * Neither the name of the copyright holder nor the -+ names of its contributors may be used to endorse or promote products -+ derived from this software without specific prior written permission. -+ -+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY -+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+*/ -+ -+#include <linux/linkage.h> -+#include "arm-mem.h" -+#include "memcpymove.h" -+ -+/* Prevent the stack from becoming executable */ -+#if defined(__linux__) && defined(__ELF__) -+.section .note.GNU-stack,"",%progbits -+#endif -+ -+ .text -+ .arch armv6 -+ .object_arch armv4 -+ .arm -+ .altmacro -+ .p2align 2 -+ -+/* -+ * void *memmove(void *s1, const void *s2, size_t n); -+ * On entry: -+ * a1 = pointer to destination -+ * a2 = pointer to source -+ * a3 = number of bytes to copy -+ * On exit: -+ * a1 preserved -+ */ -+ -+.set prefetch_distance, 3 -+ -+ENTRY(memmove) -+ cmp a2, a1 -+ bpl memcpy /* pl works even over -1 - 0 and 0x7fffffff - 0x80000000 boundaries */ -+ memcpy 1 -+ENDPROC(memmove) -diff --git a/arch/arm/lib/memset_rpi.S b/arch/arm/lib/memset_rpi.S -new file mode 100644 -index 0000000..7067415 ---- /dev/null -+++ b/arch/arm/lib/memset_rpi.S -@@ -0,0 +1,123 @@ -+/* -+Copyright (c) 2013, Raspberry Pi Foundation -+Copyright (c) 2013, RISC OS Open Ltd -+All rights reserved. -+ -+Redistribution and use in source and binary forms, with or without -+modification, are permitted provided that the following conditions are met: -+ * Redistributions of source code must retain the above copyright -+ notice, this list of conditions and the following disclaimer. -+ * 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. -+ * Neither the name of the copyright holder nor the -+ names of its contributors may be used to endorse or promote products -+ derived from this software without specific prior written permission. -+ -+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY -+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+*/ -+ -+#include <linux/linkage.h> -+#include "arm-mem.h" -+ -+/* Prevent the stack from becoming executable */ -+#if defined(__linux__) && defined(__ELF__) -+.section .note.GNU-stack,"",%progbits -+#endif -+ -+ .text -+ .arch armv6 -+ .object_arch armv4 -+ .arm -+ .altmacro -+ .p2align 2 -+ -+/* -+ * void *memset(void *s, int c, size_t n); -+ * On entry: -+ * a1 = pointer to buffer to fill -+ * a2 = byte pattern to fill with (caller-narrowed) -+ * a3 = number of bytes to fill -+ * On exit: -+ * a1 preserved -+ */ -+ENTRY(mmioset) -+ENTRY(memset) -+ S .req a1 -+ DAT0 .req a2 -+ N .req a3 -+ DAT1 .req a4 -+ DAT2 .req ip -+ DAT3 .req lr -+ -+ orr DAT0, DAT0, lsl #8 -+ push {S, lr} -+ orr DAT0, DAT0, lsl #16 -+ mov DAT1, DAT0 -+ -+ /* See if we're guaranteed to have at least one 16-byte aligned 16-byte write */ -+ cmp N, #31 -+ blo 170f -+ -+161: sub N, N, #16 /* simplifies inner loop termination */ -+ /* Leading words and bytes */ -+ tst S, #15 -+ beq 164f -+ rsb DAT3, S, #0 /* bits 0-3 = number of leading bytes until aligned */ -+ movs DAT2, DAT3, lsl #31 -+ submi N, N, #1 -+ strmib DAT0, [S], #1 -+ subcs N, N, #2 -+ strcsh DAT0, [S], #2 -+ movs DAT2, DAT3, lsl #29 -+ submi N, N, #4 -+ strmi DAT0, [S], #4 -+ subcs N, N, #8 -+ stmcsia S!, {DAT0, DAT1} -+164: /* Delayed set up of DAT2 and DAT3 so we could use them as scratch registers above */ -+ mov DAT2, DAT0 -+ mov DAT3, DAT0 -+ /* Now the inner loop of 16-byte stores */ -+165: stmia S!, {DAT0, DAT1, DAT2, DAT3} -+ subs N, N, #16 -+ bhs 165b -+166: /* Trailing words and bytes */ -+ movs N, N, lsl #29 -+ stmcsia S!, {DAT0, DAT1} -+ strmi DAT0, [S], #4 -+ movs N, N, lsl #2 -+ strcsh DAT0, [S], #2 -+ strmib DAT0, [S] -+199: pop {S, pc} -+ -+170: /* Short case */ -+ mov DAT2, DAT0 -+ mov DAT3, DAT0 -+ tst S, #3 -+ beq 174f -+172: subs N, N, #1 -+ blo 199b -+ strb DAT0, [S], #1 -+ tst S, #3 -+ bne 172b -+174: tst N, #16 -+ stmneia S!, {DAT0, DAT1, DAT2, DAT3} -+ b 166b -+ -+ .unreq S -+ .unreq DAT0 -+ .unreq N -+ .unreq DAT1 -+ .unreq DAT2 -+ .unreq DAT3 -+ENDPROC(memset) -+ENDPROC(mmioset) -diff --git a/arch/arm/lib/uaccess_with_memcpy.c b/arch/arm/lib/uaccess_with_memcpy.c -index 588bbc2..c29df92 100644 ---- a/arch/arm/lib/uaccess_with_memcpy.c -+++ b/arch/arm/lib/uaccess_with_memcpy.c -@@ -22,6 +22,14 @@ - #include <asm/current.h> - #include <asm/page.h> - -+#ifndef COPY_FROM_USER_THRESHOLD -+#define COPY_FROM_USER_THRESHOLD 64 -+#endif -+ -+#ifndef COPY_TO_USER_THRESHOLD -+#define COPY_TO_USER_THRESHOLD 64 -+#endif -+ - static int - pin_page_for_write(const void __user *_addr, pte_t **ptep, spinlock_t **ptlp) - { -@@ -85,7 +93,44 @@ pin_page_for_write(const void __user *_addr, pte_t **ptep, spinlock_t **ptlp) - return 1; - } - --static unsigned long noinline -+static int -+pin_page_for_read(const void __user *_addr, pte_t **ptep, spinlock_t **ptlp) -+{ -+ unsigned long addr = (unsigned long)_addr; -+ pgd_t *pgd; -+ pmd_t *pmd; -+ pte_t *pte; -+ pud_t *pud; -+ spinlock_t *ptl; -+ -+ pgd = pgd_offset(current->mm, addr); -+ if (unlikely(pgd_none(*pgd) || pgd_bad(*pgd))) -+ { -+ return 0; -+ } -+ pud = pud_offset(pgd, addr); -+ if (unlikely(pud_none(*pud) || pud_bad(*pud))) -+ { -+ return 0; -+ } -+ -+ pmd = pmd_offset(pud, addr); -+ if (unlikely(pmd_none(*pmd) || pmd_bad(*pmd))) -+ return 0; -+ -+ pte = pte_offset_map_lock(current->mm, pmd, addr, &ptl); -+ if (unlikely(!pte_present(*pte) || !pte_young(*pte))) { -+ pte_unmap_unlock(pte, ptl); -+ return 0; -+ } -+ -+ *ptep = pte; -+ *ptlp = ptl; -+ -+ return 1; -+} -+ -+unsigned long noinline - __copy_to_user_memcpy(void __user *to, const void *from, unsigned long n) - { - unsigned long ua_flags; -@@ -138,6 +183,54 @@ __copy_to_user_memcpy(void __user *to, const void *from, unsigned long n) - return n; - } - -+unsigned long noinline -+__copy_from_user_memcpy(void *to, const void __user *from, unsigned long n) -+{ -+ int atomic; -+ -+ if (unlikely(segment_eq(get_fs(), KERNEL_DS))) { -+ memcpy(to, (const void *)from, n); -+ return 0; -+ } -+ -+ /* the mmap semaphore is taken only if not in an atomic context */ -+ atomic = in_atomic(); -+ -+ if (!atomic) -+ down_read(&current->mm->mmap_sem); -+ while (n) { -+ pte_t *pte; -+ spinlock_t *ptl; -+ int tocopy; -+ -+ while (!pin_page_for_read(from, &pte, &ptl)) { -+ char temp; -+ if (!atomic) -+ up_read(&current->mm->mmap_sem); -+ if (__get_user(temp, (char __user *)from)) -+ goto out; -+ if (!atomic) -+ down_read(&current->mm->mmap_sem); -+ } -+ -+ tocopy = (~(unsigned long)from & ~PAGE_MASK) + 1; -+ if (tocopy > n) -+ tocopy = n; -+ -+ memcpy(to, (const void *)from, tocopy); -+ to += tocopy; -+ from += tocopy; -+ n -= tocopy; -+ -+ pte_unmap_unlock(pte, ptl); -+ } -+ if (!atomic) -+ up_read(&current->mm->mmap_sem); -+ -+out: -+ return n; -+} -+ - unsigned long - arm_copy_to_user(void __user *to, const void *from, unsigned long n) - { -@@ -148,7 +241,7 @@ arm_copy_to_user(void __user *to, const void *from, unsigned long n) - * With frame pointer disabled, tail call optimization kicks in - * as well making this test almost invisible. - */ -- if (n < 64) { -+ if (n < COPY_TO_USER_THRESHOLD) { - unsigned long ua_flags = uaccess_save_and_enable(); - n = __copy_to_user_std(to, from, n); - uaccess_restore(ua_flags); -@@ -157,6 +250,21 @@ arm_copy_to_user(void __user *to, const void *from, unsigned long n) - } - return n; - } -+ -+unsigned long __must_check -+arm_copy_from_user(void *to, const void __user *from, unsigned long n) -+{ -+ /* -+ * This test is stubbed out of the main function above to keep -+ * the overhead for small copies low by avoiding a large -+ * register dump on the stack just to reload them right away. -+ * With frame pointer disabled, tail call optimization kicks in -+ * as well making this test almost invisible. -+ */ -+ if (n < COPY_FROM_USER_THRESHOLD) -+ return __copy_from_user_std(to, from, n); -+ return __copy_from_user_memcpy(to, from, n); -+} - - static unsigned long noinline - __clear_user_memset(void __user *addr, unsigned long n) - -From 44d43099a94c8b2db818c80c67789ef5f9857b81 Mon Sep 17 00:00:00 2001 -From: Phil Elwell <phil@raspberrypi.org> -Date: Thu, 25 Jun 2015 12:16:11 +0100 -Subject: [PATCH 081/170] gpio-poweroff: Allow it to work on Raspberry Pi - -The Raspberry Pi firmware manages the power-down and reboot -process. To do this it installs a pm_power_off handler, causing -the gpio-poweroff module to abort the probe function. - -This patch introduces a "force" DT property that overrides that -behaviour, and also adds a DT overlay to enable and control it. - -Note that running in an active-low configuration (DT parameter -"active_low") requires a custom dt-blob.bin and probably won't -allow a reboot without switching off, so an external inversion -of the trigger signal may be preferable. ---- - drivers/power/reset/gpio-poweroff.c | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -diff --git a/drivers/power/reset/gpio-poweroff.c b/drivers/power/reset/gpio-poweroff.c -index be3d81f..a030ae9 100644 ---- a/drivers/power/reset/gpio-poweroff.c -+++ b/drivers/power/reset/gpio-poweroff.c -@@ -49,9 +49,11 @@ static int gpio_poweroff_probe(struct platform_device *pdev) - { - bool input = false; - enum gpiod_flags flags; -+ bool force = false; - - /* If a pm_power_off function has already been added, leave it alone */ -- if (pm_power_off != NULL) { -+ force = of_property_read_bool(pdev->dev.of_node, "force"); -+ if (!force && (pm_power_off != NULL)) { - dev_err(&pdev->dev, - "%s: pm_power_off function already registered", - __func__); - -From 5b2d8bca046bd6f1a426e9205f194ece5b95e300 Mon Sep 17 00:00:00 2001 -From: Phil Elwell <phil@raspberrypi.org> -Date: Tue, 14 Jul 2015 10:26:09 +0100 -Subject: [PATCH 082/170] spidev: Add "spidev" compatible string to silence - warning - -See: https://github.com/raspberrypi/linux/issues/1054 ---- - drivers/spi/spidev.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c -index d0e7dfc..57b0760 100644 ---- a/drivers/spi/spidev.c -+++ b/drivers/spi/spidev.c -@@ -695,6 +695,7 @@ static struct class *spidev_class; - static const struct of_device_id spidev_dt_ids[] = { - { .compatible = "rohm,dh2228fv" }, - { .compatible = "lineartechnology,ltc2488" }, -+ { .compatible = "spidev" }, - {}, - }; - MODULE_DEVICE_TABLE(of, spidev_dt_ids); - -From 534c337ea28bee34f886a1d1e00d281365c94efa Mon Sep 17 00:00:00 2001 -From: Phil Elwell <phil@raspberrypi.org> -Date: Tue, 14 Jul 2015 17:00:18 +0100 -Subject: [PATCH 083/170] scripts/dtc: Add overlay support - ---- - scripts/dtc/checks.c | 119 ++- - scripts/dtc/dtc-lexer.l | 5 + - scripts/dtc/dtc-lexer.lex.c_shipped | 490 ++++----- - scripts/dtc/dtc-parser.tab.c_shipped | 1896 +++++++++++++++++++--------------- - scripts/dtc/dtc-parser.tab.h_shipped | 107 +- - scripts/dtc/dtc-parser.y | 23 +- - scripts/dtc/dtc.c | 9 +- - scripts/dtc/dtc.h | 38 + - scripts/dtc/flattree.c | 141 ++- - scripts/dtc/version_gen.h | 2 +- - 10 files changed, 1685 insertions(+), 1145 deletions(-) - -diff --git a/scripts/dtc/checks.c b/scripts/dtc/checks.c -index e81a8c74..efd1bc6 100644 ---- a/scripts/dtc/checks.c -+++ b/scripts/dtc/checks.c -@@ -458,21 +458,91 @@ static void fixup_phandle_references(struct check *c, struct node *dt, - struct node *node, struct property *prop) - { - struct marker *m = prop->val.markers; -+ struct fixup *f, **fp; -+ struct fixup_entry *fe, **fep; - struct node *refnode; - cell_t phandle; -+ int has_phandle_refs; -+ -+ has_phandle_refs = 0; -+ for_each_marker_of_type(m, REF_PHANDLE) { -+ has_phandle_refs = 1; -+ break; -+ } -+ -+ if (!has_phandle_refs) -+ return; - - for_each_marker_of_type(m, REF_PHANDLE) { - assert(m->offset + sizeof(cell_t) <= prop->val.len); - - refnode = get_node_by_ref(dt, m->ref); -- if (! refnode) { -+ if (!refnode && !symbol_fixup_support) { - FAIL(c, "Reference to non-existent node or label \"%s\"\n", -- m->ref); -+ m->ref); - continue; - } - -- phandle = get_node_phandle(dt, refnode); -- *((cell_t *)(prop->val.val + m->offset)) = cpu_to_fdt32(phandle); -+ if (!refnode) { -+ /* allocate fixup entry */ -+ fe = xmalloc(sizeof(*fe)); -+ -+ fe->node = node; -+ fe->prop = prop; -+ fe->offset = m->offset; -+ fe->next = NULL; -+ -+ /* search for an already existing fixup */ -+ for_each_fixup(dt, f) -+ if (strcmp(f->ref, m->ref) == 0) -+ break; -+ -+ /* no fixup found, add new */ -+ if (f == NULL) { -+ f = xmalloc(sizeof(*f)); -+ f->ref = m->ref; -+ f->entries = NULL; -+ f->next = NULL; -+ -+ /* add it to the tree */ -+ fp = &dt->fixups; -+ while (*fp) -+ fp = &(*fp)->next; -+ *fp = f; -+ } -+ -+ /* and now append fixup entry */ -+ fep = &f->entries; -+ while (*fep) -+ fep = &(*fep)->next; -+ *fep = fe; -+ -+ /* mark the entry as unresolved */ -+ phandle = 0xdeadbeef; -+ } else { -+ phandle = get_node_phandle(dt, refnode); -+ -+ /* if it's a plugin, we need to record it */ -+ if (symbol_fixup_support && dt->is_plugin) { -+ -+ /* allocate a new local fixup entry */ -+ fe = xmalloc(sizeof(*fe)); -+ -+ fe->node = node; -+ fe->prop = prop; -+ fe->offset = m->offset; -+ fe->next = NULL; -+ -+ /* append it to the local fixups */ -+ fep = &dt->local_fixups; -+ while (*fep) -+ fep = &(*fep)->next; -+ *fep = fe; -+ } -+ } -+ -+ *((cell_t *)(prop->val.val + m->offset)) = -+ cpu_to_fdt32(phandle); - } - } - ERROR(phandle_references, NULL, NULL, fixup_phandle_references, NULL, -@@ -652,6 +722,45 @@ static void check_obsolete_chosen_interrupt_controller(struct check *c, - } - TREE_WARNING(obsolete_chosen_interrupt_controller, NULL); - -+static void check_auto_label_phandles(struct check *c, struct node *dt, -+ struct node *node) -+{ -+ struct label *l; -+ struct symbol *s, **sp; -+ int has_label; -+ -+ if (!symbol_fixup_support) -+ return; -+ -+ has_label = 0; -+ for_each_label(node->labels, l) { -+ has_label = 1; -+ break; -+ } -+ -+ if (!has_label) -+ return; -+ -+ /* force allocation of a phandle for this node */ -+ (void)get_node_phandle(dt, node); -+ -+ /* add the symbol */ -+ for_each_label(node->labels, l) { -+ -+ s = xmalloc(sizeof(*s)); -+ s->label = l; -+ s->node = node; -+ s->next = NULL; -+ -+ /* add it to the symbols list */ -+ sp = &dt->symbols; -+ while (*sp) -+ sp = &((*sp)->next); -+ *sp = s; -+ } -+} -+NODE_WARNING(auto_label_phandles, NULL); -+ - static struct check *check_table[] = { - &duplicate_node_names, &duplicate_property_names, - &node_name_chars, &node_name_format, &property_name_chars, -@@ -670,6 +779,8 @@ static struct check *check_table[] = { - &avoid_default_addr_size, - &obsolete_chosen_interrupt_controller, - -+ &auto_label_phandles, -+ - &always_fail, - }; - -diff --git a/scripts/dtc/dtc-lexer.l b/scripts/dtc/dtc-lexer.l -index 0ee1caf0..dd44ba2 100644 ---- a/scripts/dtc/dtc-lexer.l -+++ b/scripts/dtc/dtc-lexer.l -@@ -113,6 +113,11 @@ static void lexical_error(const char *fmt, ...); - return DT_V1; - } - -+<*>"/plugin/" { -+ DPRINT("Keyword: /plugin/\n"); -+ return DT_PLUGIN; -+ } -+ - <*>"/memreserve/" { - DPRINT("Keyword: /memreserve/\n"); - BEGIN_DEFAULT(); -diff --git a/scripts/dtc/dtc-lexer.lex.c_shipped b/scripts/dtc/dtc-lexer.lex.c_shipped -index 11cd78e..1518525 100644 ---- a/scripts/dtc/dtc-lexer.lex.c_shipped -+++ b/scripts/dtc/dtc-lexer.lex.c_shipped -@@ -9,7 +9,7 @@ - #define FLEX_SCANNER - #define YY_FLEX_MAJOR_VERSION 2 - #define YY_FLEX_MINOR_VERSION 5 --#define YY_FLEX_SUBMINOR_VERSION 39 -+#define YY_FLEX_SUBMINOR_VERSION 35 - #if YY_FLEX_SUBMINOR_VERSION > 0 - #define FLEX_BETA - #endif -@@ -162,12 +162,7 @@ typedef unsigned int flex_uint32_t; - typedef struct yy_buffer_state *YY_BUFFER_STATE; - #endif - --#ifndef YY_TYPEDEF_YY_SIZE_T --#define YY_TYPEDEF_YY_SIZE_T --typedef size_t yy_size_t; --#endif -- --extern yy_size_t yyleng; -+extern int yyleng; - - extern FILE *yyin, *yyout; - -@@ -176,7 +171,6 @@ extern FILE *yyin, *yyout; - #define EOB_ACT_LAST_MATCH 2 - - #define YY_LESS_LINENO(n) -- #define YY_LINENO_REWIND_TO(ptr) - - /* Return all but the first "n" matched characters back to the input stream. */ - #define yyless(n) \ -@@ -194,6 +188,11 @@ extern FILE *yyin, *yyout; - - #define unput(c) yyunput( c, (yytext_ptr) ) - -+#ifndef YY_TYPEDEF_YY_SIZE_T -+#define YY_TYPEDEF_YY_SIZE_T -+typedef size_t yy_size_t; -+#endif -+ - #ifndef YY_STRUCT_YY_BUFFER_STATE - #define YY_STRUCT_YY_BUFFER_STATE - struct yy_buffer_state -@@ -211,7 +210,7 @@ struct yy_buffer_state - /* Number of characters read into yy_ch_buf, not including EOB - * characters. - */ -- yy_size_t yy_n_chars; -+ int yy_n_chars; - - /* Whether we "own" the buffer - i.e., we know we created it, - * and can realloc() it to grow it, and should free() it to -@@ -281,8 +280,8 @@ static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ - - /* yy_hold_char holds the character lost when yytext is formed. */ - static char yy_hold_char; --static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */ --yy_size_t yyleng; -+static int yy_n_chars; /* number of characters read into yy_ch_buf */ -+int yyleng; - - /* Points to current character in buffer. */ - static char *yy_c_buf_p = (char *) 0; -@@ -310,7 +309,7 @@ static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ); - - YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ); - YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ); --YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,yy_size_t len ); -+YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len ); - - void *yyalloc (yy_size_t ); - void *yyrealloc (void *,yy_size_t ); -@@ -342,7 +341,7 @@ void yyfree (void * ); - - /* Begin user sect3 */ - --#define yywrap() 1 -+#define yywrap(n) 1 - #define YY_SKIP_YYWRAP - - typedef unsigned char YY_CHAR; -@@ -373,8 +372,8 @@ static void yy_fatal_error (yyconst char msg[] ); - *yy_cp = '\0'; \ - (yy_c_buf_p) = yy_cp; - --#define YY_NUM_RULES 30 --#define YY_END_OF_BUFFER 31 -+#define YY_NUM_RULES 31 -+#define YY_END_OF_BUFFER 32 - /* This struct is not used in this scanner, - but its presence is necessary. */ - struct yy_trans_info -@@ -382,25 +381,26 @@ struct yy_trans_info - flex_int32_t yy_verify; - flex_int32_t yy_nxt; - }; --static yyconst flex_int16_t yy_accept[159] = -+static yyconst flex_int16_t yy_accept[166] = - { 0, -- 0, 0, 0, 0, 0, 0, 0, 0, 31, 29, -- 18, 18, 29, 29, 29, 29, 29, 29, 29, 29, -- 29, 29, 29, 29, 29, 29, 15, 16, 16, 29, -- 16, 10, 10, 18, 26, 0, 3, 0, 27, 12, -- 0, 0, 11, 0, 0, 0, 0, 0, 0, 0, -- 21, 23, 25, 24, 22, 0, 9, 28, 0, 0, -- 0, 14, 14, 16, 16, 16, 10, 10, 10, 0, -- 12, 0, 11, 0, 0, 0, 20, 0, 0, 0, -- 0, 0, 0, 0, 0, 16, 10, 10, 10, 0, -- 13, 19, 0, 0, 0, 0, 0, 0, 0, 0, -- -- 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, -- 0, 16, 6, 0, 0, 0, 0, 0, 0, 2, -- 0, 0, 0, 0, 0, 0, 0, 0, 4, 17, -- 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, -- 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, -- 5, 8, 0, 0, 0, 0, 7, 0 -+ 0, 0, 0, 0, 0, 0, 0, 0, 32, 30, -+ 19, 19, 30, 30, 30, 30, 30, 30, 30, 30, -+ 30, 30, 30, 30, 30, 30, 16, 17, 17, 30, -+ 17, 11, 11, 19, 27, 0, 3, 0, 28, 13, -+ 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, -+ 0, 22, 24, 26, 25, 23, 0, 10, 29, 0, -+ 0, 0, 15, 15, 17, 17, 17, 11, 11, 11, -+ 0, 13, 0, 12, 0, 0, 0, 21, 0, 0, -+ 0, 0, 0, 0, 0, 0, 0, 17, 11, 11, -+ 11, 0, 14, 20, 0, 0, 0, 0, 0, 0, -+ -+ 0, 0, 0, 0, 17, 0, 0, 0, 0, 0, -+ 0, 0, 0, 0, 0, 17, 7, 0, 0, 0, -+ 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, -+ 0, 0, 0, 0, 4, 18, 0, 0, 5, 2, -+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -+ 0, 0, 1, 0, 0, 0, 0, 6, 9, 0, -+ 0, 0, 0, 8, 0 - } ; - - static yyconst flex_int32_t yy_ec[256] = -@@ -416,9 +416,9 @@ static yyconst flex_int32_t yy_ec[256] = - 22, 22, 22, 22, 24, 22, 22, 25, 22, 22, - 1, 26, 27, 1, 22, 1, 21, 28, 29, 30, - -- 31, 21, 22, 22, 32, 22, 22, 33, 34, 35, -- 36, 37, 22, 38, 39, 40, 41, 42, 22, 25, -- 43, 22, 44, 45, 46, 1, 1, 1, 1, 1, -+ 31, 21, 32, 22, 33, 22, 22, 34, 35, 36, -+ 37, 38, 22, 39, 40, 41, 42, 43, 22, 25, -+ 44, 22, 45, 46, 47, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -@@ -435,163 +435,165 @@ static yyconst flex_int32_t yy_ec[256] = - 1, 1, 1, 1, 1 - } ; - --static yyconst flex_int32_t yy_meta[47] = -+static yyconst flex_int32_t yy_meta[48] = - { 0, - 1, 1, 1, 1, 1, 1, 2, 3, 1, 2, - 2, 2, 4, 5, 5, 5, 6, 1, 1, 1, - 7, 8, 8, 8, 8, 1, 1, 7, 7, 7, - 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, -- 8, 8, 8, 3, 1, 4 -+ 8, 8, 8, 8, 3, 1, 4 - } ; - --static yyconst flex_int16_t yy_base[173] = -+static yyconst flex_int16_t yy_base[180] = - { 0, -- 0, 383, 34, 382, 65, 381, 37, 105, 387, 391, -- 54, 111, 367, 110, 109, 109, 112, 41, 366, 104, -- 367, 338, 124, 117, 0, 144, 391, 0, 121, 0, -- 135, 155, 140, 179, 391, 160, 391, 379, 391, 0, -- 368, 141, 391, 167, 370, 376, 346, 103, 342, 345, -- 391, 391, 391, 391, 391, 358, 391, 391, 175, 342, -- 338, 391, 355, 0, 185, 339, 184, 347, 346, 0, -- 0, 322, 175, 357, 175, 363, 352, 324, 330, 323, -- 332, 326, 201, 324, 329, 322, 391, 333, 181, 309, -- 391, 341, 340, 313, 320, 338, 178, 311, 146, 317, -- -- 314, 315, 335, 331, 303, 300, 309, 299, 308, 188, -- 336, 335, 391, 305, 320, 281, 283, 271, 203, 288, -- 281, 271, 266, 264, 245, 242, 208, 104, 391, 391, -- 244, 218, 204, 219, 206, 224, 201, 212, 204, 229, -- 215, 208, 207, 200, 219, 391, 233, 221, 200, 181, -- 391, 391, 149, 122, 86, 41, 391, 391, 245, 251, -- 259, 263, 267, 273, 280, 284, 292, 300, 304, 310, -- 318, 326 -+ 0, 393, 35, 392, 66, 391, 38, 107, 397, 401, -+ 55, 113, 377, 112, 111, 111, 114, 42, 376, 106, -+ 377, 347, 126, 120, 0, 147, 401, 0, 124, 0, -+ 137, 158, 170, 163, 401, 153, 401, 389, 401, 0, -+ 378, 120, 401, 131, 380, 386, 355, 139, 351, 355, -+ 351, 401, 401, 401, 401, 401, 367, 401, 401, 185, -+ 350, 346, 401, 364, 0, 185, 347, 189, 356, 355, -+ 0, 0, 330, 180, 366, 141, 372, 361, 332, 338, -+ 331, 341, 334, 326, 205, 331, 337, 329, 401, 341, -+ 167, 316, 401, 349, 348, 320, 328, 346, 180, 318, -+ -+ 324, 209, 324, 320, 322, 342, 338, 309, 306, 315, -+ 305, 315, 312, 192, 342, 341, 401, 293, 306, 282, -+ 268, 252, 255, 203, 285, 282, 272, 268, 252, 233, -+ 232, 239, 208, 107, 401, 401, 238, 211, 401, 211, -+ 212, 208, 228, 203, 215, 207, 233, 222, 212, 211, -+ 203, 227, 401, 237, 225, 204, 185, 401, 401, 149, -+ 128, 88, 42, 401, 401, 253, 259, 267, 271, 275, -+ 281, 288, 292, 300, 308, 312, 318, 326, 334 - } ; - --static yyconst flex_int16_t yy_def[173] = -+static yyconst flex_int16_t yy_def[180] = - { 0, -- 158, 1, 1, 3, 158, 5, 1, 1, 158, 158, -- 158, 158, 158, 159, 160, 161, 158, 158, 158, 158, -- 162, 158, 158, 158, 163, 162, 158, 164, 165, 164, -- 164, 158, 158, 158, 158, 159, 158, 159, 158, 166, -- 158, 161, 158, 161, 167, 168, 158, 158, 158, 158, -- 158, 158, 158, 158, 158, 162, 158, 158, 158, 158, -- 158, 158, 162, 164, 165, 164, 158, 158, 158, 169, -- 166, 170, 161, 167, 167, 168, 158, 158, 158, 158, -- 158, 158, 158, 158, 158, 164, 158, 158, 169, 170, -- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, -- -- 158, 164, 158, 158, 158, 158, 158, 158, 158, 171, -- 158, 164, 158, 158, 158, 158, 158, 158, 171, 158, -- 171, 158, 158, 158, 158, 158, 158, 158, 158, 158, -- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, -- 172, 158, 158, 158, 172, 158, 172, 158, 158, 158, -- 158, 158, 158, 158, 158, 158, 158, 0, 158, 158, -- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, -- 158, 158 -+ 165, 1, 1, 3, 165, 5, 1, 1, 165, 165, -+ 165, 165, 165, 166, 167, 168, 165, 165, 165, 165, -+ 169, 165, 165, 165, 170, 169, 165, 171, 172, 171, -+ 171, 165, 165, 165, 165, 166, 165, 166, 165, 173, -+ 165, 168, 165, 168, 174, 175, 165, 165, 165, 165, -+ 165, 165, 165, 165, 165, 165, 169, 165, 165, 165, -+ 165, 165, 165, 169, 171, 172, 171, 165, 165, 165, -+ 176, 173, 177, 168, 174, 174, 175, 165, 165, 165, -+ 165, 165, 165, 165, 165, 165, 165, 171, 165, 165, -+ 176, 177, 165, 165, 165, 165, 165, 165, 165, 165, -+ -+ 165, 165, 165, 165, 171, 165, 165, 165, 165, 165, -+ 165, 165, 165, 178, 165, 171, 165, 165, 165, 165, -+ 165, 165, 165, 178, 165, 178, 165, 165, 165, 165, -+ 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, -+ 165, 165, 165, 165, 165, 165, 165, 179, 165, 165, -+ 165, 179, 165, 179, 165, 165, 165, 165, 165, 165, -+ 165, 165, 165, 165, 0, 165, 165, 165, 165, 165, -+ 165, 165, 165, 165, 165, 165, 165, 165, 165 - } ; - --static yyconst flex_int16_t yy_nxt[438] = -+static yyconst flex_int16_t yy_nxt[449] = - { 0, - 10, 11, 12, 11, 13, 14, 10, 15, 16, 10, - 10, 10, 17, 10, 10, 10, 10, 18, 19, 20, - 21, 21, 21, 21, 21, 10, 10, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, -- 21, 21, 21, 10, 22, 10, 24, 25, 25, 25, -- 32, 33, 33, 157, 26, 34, 34, 34, 51, 52, -- 27, 26, 26, 26, 26, 10, 11, 12, 11, 13, -- 14, 28, 15, 16, 28, 28, 28, 24, 28, 28, -- 28, 10, 18, 19, 20, 29, 29, 29, 29, 29, -- 30, 10, 29, 29, 29, 29, 29, 29, 29, 29, -- -- 29, 29, 29, 29, 29, 29, 29, 29, 10, 22, -- 10, 23, 34, 34, 34, 37, 39, 43, 32, 33, -- 33, 45, 54, 55, 46, 59, 45, 64, 156, 46, -- 64, 64, 64, 79, 44, 38, 59, 57, 134, 47, -- 135, 48, 80, 49, 47, 50, 48, 99, 61, 43, -- 50, 110, 41, 67, 67, 67, 60, 63, 63, 63, -- 57, 155, 68, 69, 63, 37, 44, 66, 67, 67, -- 67, 63, 63, 63, 63, 73, 59, 68, 69, 70, -- 34, 34, 34, 43, 75, 38, 154, 92, 83, 83, -- 83, 64, 44, 120, 64, 64, 64, 67, 67, 67, -- -- 44, 57, 99, 68, 69, 107, 68, 69, 120, 127, -- 108, 153, 152, 121, 83, 83, 83, 133, 133, 133, -- 146, 133, 133, 133, 146, 140, 140, 140, 121, 141, -- 140, 140, 140, 151, 141, 158, 150, 149, 148, 144, -- 147, 143, 142, 139, 147, 36, 36, 36, 36, 36, -- 36, 36, 36, 40, 138, 137, 136, 40, 40, 42, -- 42, 42, 42, 42, 42, 42, 42, 56, 56, 56, -- 56, 62, 132, 62, 64, 131, 130, 64, 129, 64, -- 64, 65, 128, 158, 65, 65, 65, 65, 71, 127, -- 71, 71, 74, 74, 74, 74, 74, 74, 74, 74, -- -- 76, 76, 76, 76, 76, 76, 76, 76, 89, 126, -- 89, 90, 125, 90, 90, 124, 90, 90, 119, 119, -- 119, 119, 119, 119, 119, 119, 145, 145, 145, 145, -- 145, 145, 145, 145, 123, 122, 59, 59, 118, 117, -- 116, 115, 114, 113, 45, 112, 108, 111, 109, 106, -- 105, 104, 46, 103, 91, 87, 102, 101, 100, 98, -- 97, 96, 95, 94, 93, 77, 75, 91, 88, 87, -- 86, 57, 85, 84, 57, 82, 81, 78, 77, 75, -- 72, 158, 58, 57, 53, 35, 158, 31, 23, 23, -- 9, 158, 158, 158, 158, 158, 158, 158, 158, 158, -- -- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, -- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, -- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, -- 158, 158, 158, 158, 158, 158, 158 -+ 21, 21, 21, 21, 10, 22, 10, 24, 25, 25, -+ 25, 32, 33, 33, 164, 26, 34, 34, 34, 52, -+ 53, 27, 26, 26, 26, 26, 10, 11, 12, 11, -+ 13, 14, 28, 15, 16, 28, 28, 28, 24, 28, -+ 28, 28, 10, 18, 19, 20, 29, 29, 29, 29, -+ 29, 30, 10, 29, 29, 29, 29, 29, 29, 29, -+ -+ 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, -+ 10, 22, 10, 23, 34, 34, 34, 37, 39, 43, -+ 32, 33, 33, 45, 55, 56, 46, 60, 43, 45, -+ 65, 163, 46, 65, 65, 65, 44, 38, 60, 74, -+ 58, 47, 141, 48, 142, 44, 49, 47, 50, 48, -+ 76, 51, 62, 94, 50, 41, 44, 51, 37, 61, -+ 64, 64, 64, 58, 34, 34, 34, 64, 162, 80, -+ 67, 68, 68, 68, 64, 64, 64, 64, 38, 81, -+ 69, 70, 71, 68, 68, 68, 60, 161, 43, 69, -+ 70, 65, 69, 70, 65, 65, 65, 125, 85, 85, -+ -+ 85, 58, 68, 68, 68, 44, 102, 110, 125, 133, -+ 102, 69, 70, 111, 114, 160, 159, 126, 85, 85, -+ 85, 140, 140, 140, 140, 140, 140, 153, 126, 147, -+ 147, 147, 153, 148, 147, 147, 147, 158, 148, 165, -+ 157, 156, 155, 151, 150, 149, 146, 154, 145, 144, -+ 143, 139, 154, 36, 36, 36, 36, 36, 36, 36, -+ 36, 40, 138, 137, 136, 40, 40, 42, 42, 42, -+ 42, 42, 42, 42, 42, 57, 57, 57, 57, 63, -+ 135, 63, 65, 134, 165, 65, 133, 65, 65, 66, -+ 132, 131, 66, 66, 66, 66, 72, 130, 72, 72, -+ -+ 75, 75, 75, 75, 75, 75, 75, 75, 77, 77, -+ 77, 77, 77, 77, 77, 77, 91, 129, 91, 92, -+ 128, 92, 92, 127, 92, 92, 124, 124, 124, 124, -+ 124, 124, 124, 124, 152, 152, 152, 152, 152, 152, -+ 152, 152, 60, 60, 123, 122, 121, 120, 119, 118, -+ 117, 45, 116, 111, 115, 113, 112, 109, 108, 107, -+ 46, 106, 93, 89, 105, 104, 103, 101, 100, 99, -+ 98, 97, 96, 95, 78, 76, 93, 90, 89, 88, -+ 58, 87, 86, 58, 84, 83, 82, 79, 78, 76, -+ 73, 165, 59, 58, 54, 35, 165, 31, 23, 23, -+ -+ 9, 165, 165, 165, 165, 165, 165, 165, 165, 165, -+ 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, -+ 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, -+ 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, -+ 165, 165, 165, 165, 165, 165, 165, 165 - } ; - --static yyconst flex_int16_t yy_chk[438] = -+static yyconst flex_int16_t yy_chk[449] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -- 1, 1, 1, 1, 1, 1, 3, 3, 3, 3, -- 7, 7, 7, 156, 3, 11, 11, 11, 18, 18, -- 3, 3, 3, 3, 3, 5, 5, 5, 5, 5, -+ 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, -+ 3, 7, 7, 7, 163, 3, 11, 11, 11, 18, -+ 18, 3, 3, 3, 3, 3, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, -- 5, 8, 12, 12, 12, 14, 15, 16, 8, 8, -- 8, 17, 20, 20, 17, 23, 24, 29, 155, 24, -- 29, 29, 29, 48, 16, 14, 31, 29, 128, 17, -- 128, 17, 48, 17, 24, 17, 24, 99, 24, 42, -- 24, 99, 15, 33, 33, 33, 23, 26, 26, 26, -- 26, 154, 33, 33, 26, 36, 42, 31, 32, 32, -- 32, 26, 26, 26, 26, 44, 59, 32, 32, 32, -- 34, 34, 34, 73, 75, 36, 153, 75, 59, 59, -- 59, 65, 44, 110, 65, 65, 65, 67, 67, 67, -- -- 73, 65, 83, 89, 89, 97, 67, 67, 119, 127, -- 97, 150, 149, 110, 83, 83, 83, 133, 133, 133, -- 141, 127, 127, 127, 145, 136, 136, 136, 119, 136, -- 140, 140, 140, 148, 140, 147, 144, 143, 142, 139, -- 141, 138, 137, 135, 145, 159, 159, 159, 159, 159, -- 159, 159, 159, 160, 134, 132, 131, 160, 160, 161, -- 161, 161, 161, 161, 161, 161, 161, 162, 162, 162, -- 162, 163, 126, 163, 164, 125, 124, 164, 123, 164, -- 164, 165, 122, 121, 165, 165, 165, 165, 166, 120, -- 166, 166, 167, 167, 167, 167, 167, 167, 167, 167, -- -- 168, 168, 168, 168, 168, 168, 168, 168, 169, 118, -- 169, 170, 117, 170, 170, 116, 170, 170, 171, 171, -- 171, 171, 171, 171, 171, 171, 172, 172, 172, 172, -- 172, 172, 172, 172, 115, 114, 112, 111, 109, 108, -- 107, 106, 105, 104, 103, 102, 101, 100, 98, 96, -- 95, 94, 93, 92, 90, 88, 86, 85, 84, 82, -- 81, 80, 79, 78, 77, 76, 74, 72, 69, 68, -- 66, 63, 61, 60, 56, 50, 49, 47, 46, 45, -+ 5, 5, 5, 8, 12, 12, 12, 14, 15, 16, -+ 8, 8, 8, 17, 20, 20, 17, 23, 42, 24, -+ 29, 162, 24, 29, 29, 29, 16, 14, 31, 44, -+ 29, 17, 134, 17, 134, 42, 17, 24, 17, 24, -+ 76, 17, 24, 76, 24, 15, 44, 24, 36, 23, -+ 26, 26, 26, 26, 34, 34, 34, 26, 161, 48, -+ 31, 32, 32, 32, 26, 26, 26, 26, 36, 48, -+ 32, 32, 32, 33, 33, 33, 60, 160, 74, 91, -+ 91, 66, 33, 33, 66, 66, 66, 114, 60, 60, -+ -+ 60, 66, 68, 68, 68, 74, 85, 99, 124, 133, -+ 102, 68, 68, 99, 102, 157, 156, 114, 85, 85, -+ 85, 133, 133, 133, 140, 140, 140, 148, 124, 143, -+ 143, 143, 152, 143, 147, 147, 147, 155, 147, 154, -+ 151, 150, 149, 146, 145, 144, 142, 148, 141, 138, -+ 137, 132, 152, 166, 166, 166, 166, 166, 166, 166, -+ 166, 167, 131, 130, 129, 167, 167, 168, 168, 168, -+ 168, 168, 168, 168, 168, 169, 169, 169, 169, 170, -+ 128, 170, 171, 127, 126, 171, 125, 171, 171, 172, -+ 123, 122, 172, 172, 172, 172, 173, 121, 173, 173, -+ -+ 174, 174, 174, 174, 174, 174, 174, 174, 175, 175, -+ 175, 175, 175, 175, 175, 175, 176, 120, 176, 177, -+ 119, 177, 177, 118, 177, 177, 178, 178, 178, 178, -+ 178, 178, 178, 178, 179, 179, 179, 179, 179, 179, -+ 179, 179, 116, 115, 113, 112, 111, 110, 109, 108, -+ 107, 106, 105, 104, 103, 101, 100, 98, 97, 96, -+ 95, 94, 92, 90, 88, 87, 86, 84, 83, 82, -+ 81, 80, 79, 78, 77, 75, 73, 70, 69, 67, -+ 64, 62, 61, 57, 51, 50, 49, 47, 46, 45, - 41, 38, 22, 21, 19, 13, 9, 6, 4, 2, -- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, - -- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, -- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, -- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, -- 158, 158, 158, 158, 158, 158, 158 -+ 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, -+ 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, -+ 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, -+ 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, -+ 165, 165, 165, 165, 165, 165, 165, 165 - } ; - - static yy_state_type yy_last_accepting_state; -@@ -662,7 +664,7 @@ static int dts_version = 1; - static void push_input_file(const char *filename); - static bool pop_input_file(void); - static void lexical_error(const char *fmt, ...); --#line 666 "dtc-lexer.lex.c" -+#line 668 "dtc-lexer.lex.c" - - #define INITIAL 0 - #define BYTESTRING 1 -@@ -704,7 +706,7 @@ FILE *yyget_out (void ); - - void yyset_out (FILE * out_str ); - --yy_size_t yyget_leng (void ); -+int yyget_leng (void ); - - char *yyget_text (void ); - -@@ -853,6 +855,10 @@ YY_DECL - register char *yy_cp, *yy_bp; - register int yy_act; - -+#line 68 "dtc-lexer.l" -+ -+#line 861 "dtc-lexer.lex.c" -+ - if ( !(yy_init) ) - { - (yy_init) = 1; -@@ -879,11 +885,6 @@ YY_DECL - yy_load_buffer_state( ); - } - -- { --#line 68 "dtc-lexer.l" -- --#line 886 "dtc-lexer.lex.c" -- - while ( 1 ) /* loops until end-of-file is reached */ - { - yy_cp = (yy_c_buf_p); -@@ -901,7 +902,7 @@ YY_DECL - yy_match: - do - { -- register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ; -+ register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; - if ( yy_accept[yy_current_state] ) - { - (yy_last_accepting_state) = yy_current_state; -@@ -910,13 +911,13 @@ yy_match: - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; -- if ( yy_current_state >= 159 ) -+ if ( yy_current_state >= 166 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - ++yy_cp; - } -- while ( yy_current_state != 158 ); -+ while ( yy_current_state != 165 ); - yy_cp = (yy_last_accepting_cpos); - yy_current_state = (yy_last_accepting_state); - -@@ -1007,23 +1008,31 @@ case 5: - YY_RULE_SETUP - #line 116 "dtc-lexer.l" - { -+ DPRINT("Keyword: /plugin/\n"); -+ return DT_PLUGIN; -+ } -+ YY_BREAK -+case 6: -+YY_RULE_SETUP -+#line 121 "dtc-lexer.l" -+{ - DPRINT("Keyword: /memreserve/\n"); - BEGIN_DEFAULT(); - return DT_MEMRESERVE; - } - YY_BREAK --case 6: -+case 7: - YY_RULE_SETUP --#line 122 "dtc-lexer.l" -+#line 127 "dtc-lexer.l" - { - DPRINT("Keyword: /bits/\n"); - BEGIN_DEFAULT(); - return DT_BITS; - } - YY_BREAK --case 7: -+case 8: - YY_RULE_SETUP --#line 128 "dtc-lexer.l" -+#line 133 "dtc-lexer.l" - { - DPRINT("Keyword: /delete-property/\n"); - DPRINT("<PROPNODENAME>\n"); -@@ -1031,9 +1040,9 @@ YY_RULE_SETUP - return DT_DEL_PROP; - } - YY_BREAK --case 8: -+case 9: - YY_RULE_SETUP --#line 135 "dtc-lexer.l" -+#line 140 "dtc-lexer.l" - { - DPRINT("Keyword: /delete-node/\n"); - DPRINT("<PROPNODENAME>\n"); -@@ -1041,9 +1050,9 @@ YY_RULE_SETUP - return DT_DEL_NODE; - } - YY_BREAK --case 9: -+case 10: - YY_RULE_SETUP --#line 142 "dtc-lexer.l" -+#line 147 "dtc-lexer.l" - { - DPRINT("Label: %s\n", yytext); - yylval.labelref = xstrdup(yytext); -@@ -1051,9 +1060,9 @@ YY_RULE_SETUP - return DT_LABEL; - } - YY_BREAK --case 10: -+case 11: - YY_RULE_SETUP --#line 149 "dtc-lexer.l" -+#line 154 "dtc-lexer.l" - { - char *e; - DPRINT("Integer Literal: '%s'\n", yytext); -@@ -1073,10 +1082,10 @@ YY_RULE_SETUP - return DT_LITERAL; - } - YY_BREAK --case 11: --/* rule 11 can match eol */ -+case 12: -+/* rule 12 can match eol */ - YY_RULE_SETUP --#line 168 "dtc-lexer.l" -+#line 173 "dtc-lexer.l" - { - struct data d; - DPRINT("Character literal: %s\n", yytext); -@@ -1098,18 +1107,18 @@ YY_RULE_SETUP - return DT_CHAR_LITERAL; - } - YY_BREAK --case 12: -+case 13: - YY_RULE_SETUP --#line 189 "dtc-lexer.l" -+#line 194 "dtc-lexer.l" - { /* label reference */ - DPRINT("Ref: %s\n", yytext+1); - yylval.labelref = xstrdup(yytext+1); - return DT_REF; - } - YY_BREAK --case 13: -+case 14: - YY_RULE_SETUP --#line 195 "dtc-lexer.l" -+#line 200 "dtc-lexer.l" - { /* new-style path reference */ - yytext[yyleng-1] = '\0'; - DPRINT("Ref: %s\n", yytext+2); -@@ -1117,27 +1126,27 @@ YY_RULE_SETUP - return DT_REF; - } - YY_BREAK --case 14: -+case 15: - YY_RULE_SETUP --#line 202 "dtc-lexer.l" -+#line 207 "dtc-lexer.l" - { - yylval.byte = strtol(yytext, NULL, 16); - DPRINT("Byte: %02x\n", (int)yylval.byte); - return DT_BYTE; - } - YY_BREAK --case 15: -+case 16: - YY_RULE_SETUP --#line 208 "dtc-lexer.l" -+#line 213 "dtc-lexer.l" - { - DPRINT("/BYTESTRING\n"); - BEGIN_DEFAULT(); - return ']'; - } - YY_BREAK --case 16: -+case 17: - YY_RULE_SETUP --#line 214 "dtc-lexer.l" -+#line 219 "dtc-lexer.l" - { - DPRINT("PropNodeName: %s\n", yytext); - yylval.propnodename = xstrdup((yytext[0] == '\\') ? -@@ -1146,75 +1155,75 @@ YY_RULE_SETUP - return DT_PROPNODENAME; - } - YY_BREAK --case 17: -+case 18: - YY_RULE_SETUP --#line 222 "dtc-lexer.l" -+#line 227 "dtc-lexer.l" - { - DPRINT("Binary Include\n"); - return DT_INCBIN; - } - YY_BREAK --case 18: --/* rule 18 can match eol */ --YY_RULE_SETUP --#line 227 "dtc-lexer.l" --/* eat whitespace */ -- YY_BREAK - case 19: - /* rule 19 can match eol */ - YY_RULE_SETUP --#line 228 "dtc-lexer.l" --/* eat C-style comments */ -+#line 232 "dtc-lexer.l" -+/* eat whitespace */ - YY_BREAK - case 20: - /* rule 20 can match eol */ - YY_RULE_SETUP --#line 229 "dtc-lexer.l" --/* eat C++-style comments */ -+#line 233 "dtc-lexer.l" -+/* eat C-style comments */ - YY_BREAK - case 21: -+/* rule 21 can match eol */ - YY_RULE_SETUP --#line 231 "dtc-lexer.l" --{ return DT_LSHIFT; }; -+#line 234 "dtc-lexer.l" -+/* eat C++-style comments */ - YY_BREAK - case 22: - YY_RULE_SETUP --#line 232 "dtc-lexer.l" --{ return DT_RSHIFT; }; -+#line 236 "dtc-lexer.l" -+{ return DT_LSHIFT; }; - YY_BREAK - case 23: - YY_RULE_SETUP --#line 233 "dtc-lexer.l" --{ return DT_LE; }; -+#line 237 "dtc-lexer.l" -+{ return DT_RSHIFT; }; - YY_BREAK - case 24: - YY_RULE_SETUP --#line 234 "dtc-lexer.l" --{ return DT_GE; }; -+#line 238 "dtc-lexer.l" -+{ return DT_LE; }; - YY_BREAK - case 25: - YY_RULE_SETUP --#line 235 "dtc-lexer.l" --{ return DT_EQ; }; -+#line 239 "dtc-lexer.l" -+{ return DT_GE; }; - YY_BREAK - case 26: - YY_RULE_SETUP --#line 236 "dtc-lexer.l" --{ return DT_NE; }; -+#line 240 "dtc-lexer.l" -+{ return DT_EQ; }; - YY_BREAK - case 27: - YY_RULE_SETUP --#line 237 "dtc-lexer.l" --{ return DT_AND; }; -+#line 241 "dtc-lexer.l" -+{ return DT_NE; }; - YY_BREAK - case 28: - YY_RULE_SETUP --#line 238 "dtc-lexer.l" --{ return DT_OR; }; -+#line 242 "dtc-lexer.l" -+{ return DT_AND; }; - YY_BREAK - case 29: - YY_RULE_SETUP --#line 240 "dtc-lexer.l" -+#line 243 "dtc-lexer.l" -+{ return DT_OR; }; -+ YY_BREAK -+case 30: -+YY_RULE_SETUP -+#line 245 "dtc-lexer.l" - { - DPRINT("Char: %c (\\x%02x)\n", yytext[0], - (unsigned)yytext[0]); -@@ -1230,12 +1239,12 @@ YY_RULE_SETUP - return yytext[0]; - } - YY_BREAK --case 30: -+case 31: - YY_RULE_SETUP --#line 255 "dtc-lexer.l" -+#line 260 "dtc-lexer.l" - ECHO; - YY_BREAK --#line 1239 "dtc-lexer.lex.c" -+#line 1248 "dtc-lexer.lex.c" - - case YY_END_OF_BUFFER: - { -@@ -1365,7 +1374,6 @@ ECHO; - "fatal flex scanner internal error--no action found" ); - } /* end of action switch */ - } /* end of scanning one token */ -- } /* end of user's declarations */ - } /* end of yylex */ - - /* yy_get_next_buffer - try to read in a new buffer -@@ -1421,21 +1429,21 @@ static int yy_get_next_buffer (void) - - else - { -- yy_size_t num_to_read = -+ int num_to_read = - YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; - - while ( num_to_read <= 0 ) - { /* Not enough room in the buffer - grow it. */ - - /* just a shorter name for the current buffer */ -- YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE; -+ YY_BUFFER_STATE b = YY_CURRENT_BUFFER; - - int yy_c_buf_p_offset = - (int) ((yy_c_buf_p) - b->yy_ch_buf); - - if ( b->yy_is_our_buffer ) - { -- yy_size_t new_size = b->yy_buf_size * 2; -+ int new_size = b->yy_buf_size * 2; - - if ( new_size <= 0 ) - b->yy_buf_size += b->yy_buf_size / 8; -@@ -1466,7 +1474,7 @@ static int yy_get_next_buffer (void) - - /* Read in more data. */ - YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), -- (yy_n_chars), num_to_read ); -+ (yy_n_chars), (size_t) num_to_read ); - - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } -@@ -1528,7 +1536,7 @@ static int yy_get_next_buffer (void) - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; -- if ( yy_current_state >= 159 ) -+ if ( yy_current_state >= 166 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; -@@ -1556,13 +1564,13 @@ static int yy_get_next_buffer (void) - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; -- if ( yy_current_state >= 159 ) -+ if ( yy_current_state >= 166 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; -- yy_is_jam = (yy_current_state == 158); -+ yy_is_jam = (yy_current_state == 165); - -- return yy_is_jam ? 0 : yy_current_state; -+ return yy_is_jam ? 0 : yy_current_state; - } - - #ifndef YY_NO_INPUT -@@ -1589,7 +1597,7 @@ static int yy_get_next_buffer (void) - - else - { /* need more input */ -- yy_size_t offset = (yy_c_buf_p) - (yytext_ptr); -+ int offset = (yy_c_buf_p) - (yytext_ptr); - ++(yy_c_buf_p); - - switch ( yy_get_next_buffer( ) ) -@@ -1863,7 +1871,7 @@ void yypop_buffer_state (void) - */ - static void yyensure_buffer_stack (void) - { -- yy_size_t num_to_alloc; -+ int num_to_alloc; - - if (!(yy_buffer_stack)) { - -@@ -1960,12 +1968,12 @@ YY_BUFFER_STATE yy_scan_string (yyconst char * yystr ) - * - * @return the newly allocated buffer state object. - */ --YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len ) -+YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, int _yybytes_len ) - { - YY_BUFFER_STATE b; - char *buf; - yy_size_t n; -- yy_size_t i; -+ int i; - - /* Get memory for full buffer, including space for trailing EOB's. */ - n = _yybytes_len + 2; -@@ -2047,7 +2055,7 @@ FILE *yyget_out (void) - /** Get the length of the current token. - * - */ --yy_size_t yyget_leng (void) -+int yyget_leng (void) - { - return yyleng; - } -@@ -2195,7 +2203,7 @@ void yyfree (void * ptr ) - - #define YYTABLES_NAME "yytables" - --#line 254 "dtc-lexer.l" -+#line 260 "dtc-lexer.l" - - - -diff --git a/scripts/dtc/dtc-parser.tab.c_shipped b/scripts/dtc/dtc-parser.tab.c_shipped -index 116458c..2c1784e 100644 ---- a/scripts/dtc/dtc-parser.tab.c_shipped -+++ b/scripts/dtc/dtc-parser.tab.c_shipped -@@ -1,19 +1,19 @@ --/* A Bison parser, made by GNU Bison 3.0.2. */ -+/* A Bison parser, made by GNU Bison 2.5. */ - - /* Bison implementation for Yacc-like parsers in C -- -- Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. -- -+ -+ Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc. -+ - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. -- -+ - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. -- -+ - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -@@ -26,7 +26,7 @@ - special exception, which will cause the skeleton and the resulting - Bison output files to be licensed under the GNU General Public - License without this special exception. -- -+ - This special exception was added by the Free Software Foundation in - version 2.2 of Bison. */ - -@@ -44,7 +44,7 @@ - #define YYBISON 1 - - /* Bison version. */ --#define YYBISON_VERSION "3.0.2" -+#define YYBISON_VERSION "2.5" - - /* Skeleton name. */ - #define YYSKELETON_NAME "yacc.c" -@@ -58,13 +58,18 @@ - /* Pull parsers. */ - #define YYPULL 1 - -+/* Using locations. */ -+#define YYLSP_NEEDED 1 - - - - /* Copy the first part of user declarations. */ --#line 20 "dtc-parser.y" /* yacc.c:339 */ -+ -+/* Line 268 of yacc.c */ -+#line 20 "dtc-parser.y" - - #include <stdio.h> -+#include <inttypes.h> - - #include "dtc.h" - #include "srcpos.h" -@@ -80,15 +85,14 @@ extern void yyerror(char const *s); - extern struct boot_info *the_boot_info; - extern bool treesource_error; - --#line 84 "dtc-parser.tab.c" /* yacc.c:339 */ - --# ifndef YY_NULLPTR --# if defined __cplusplus && 201103L <= __cplusplus --# define YY_NULLPTR nullptr --# else --# define YY_NULLPTR 0 --# endif --# endif -+/* Line 268 of yacc.c */ -+#line 91 "dtc-parser.tab.c" -+ -+/* Enabling traces. */ -+#ifndef YYDEBUG -+# define YYDEBUG 0 -+#endif - - /* Enabling verbose error messages. */ - #ifdef YYERROR_VERBOSE -@@ -98,53 +102,51 @@ extern bool treesource_error; - # define YYERROR_VERBOSE 0 - #endif - --/* In a future release of Bison, this section will be replaced -- by #include "dtc-parser.tab.h". */ --#ifndef YY_YY_DTC_PARSER_TAB_H_INCLUDED --# define YY_YY_DTC_PARSER_TAB_H_INCLUDED --/* Debug traces. */ --#ifndef YYDEBUG --# define YYDEBUG 0 --#endif --#if YYDEBUG --extern int yydebug; -+/* Enabling the token table. */ -+#ifndef YYTOKEN_TABLE -+# define YYTOKEN_TABLE 0 - #endif - --/* Token type. */ -+ -+/* Tokens. */ - #ifndef YYTOKENTYPE - # define YYTOKENTYPE -- enum yytokentype -- { -- DT_V1 = 258, -- DT_MEMRESERVE = 259, -- DT_LSHIFT = 260, -- DT_RSHIFT = 261, -- DT_LE = 262, -- DT_GE = 263, -- DT_EQ = 264, -- DT_NE = 265, -- DT_AND = 266, -- DT_OR = 267, -- DT_BITS = 268, -- DT_DEL_PROP = 269, -- DT_DEL_NODE = 270, -- DT_PROPNODENAME = 271, -- DT_LITERAL = 272, -- DT_CHAR_LITERAL = 273, -- DT_BYTE = 274, -- DT_STRING = 275, -- DT_LABEL = 276, -- DT_REF = 277, -- DT_INCBIN = 278 -- }; -+ /* Put the tokens into the symbol table, so that GDB and other debuggers -+ know about them. */ -+ enum yytokentype { -+ DT_V1 = 258, -+ DT_PLUGIN = 259, -+ DT_MEMRESERVE = 260, -+ DT_LSHIFT = 261, -+ DT_RSHIFT = 262, -+ DT_LE = 263, -+ DT_GE = 264, -+ DT_EQ = 265, -+ DT_NE = 266, -+ DT_AND = 267, -+ DT_OR = 268, -+ DT_BITS = 269, -+ DT_DEL_PROP = 270, -+ DT_DEL_NODE = 271, -+ DT_PROPNODENAME = 272, -+ DT_LITERAL = 273, -+ DT_CHAR_LITERAL = 274, -+ DT_BYTE = 275, -+ DT_STRING = 276, -+ DT_LABEL = 277, -+ DT_REF = 278, -+ DT_INCBIN = 279 -+ }; - #endif - --/* Value type. */ -+ -+ - #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED --typedef union YYSTYPE YYSTYPE; --union YYSTYPE -+typedef union YYSTYPE - { --#line 38 "dtc-parser.y" /* yacc.c:355 */ -+ -+/* Line 293 of yacc.c */ -+#line 39 "dtc-parser.y" - - char *propnodename; - char *labelref; -@@ -162,37 +164,37 @@ union YYSTYPE - struct node *nodelist; - struct reserve_info *re; - uint64_t integer; -+ int is_plugin; - --#line 167 "dtc-parser.tab.c" /* yacc.c:355 */ --}; -+ -+ -+/* Line 293 of yacc.c */ -+#line 173 "dtc-parser.tab.c" -+} YYSTYPE; - # define YYSTYPE_IS_TRIVIAL 1 -+# define yystype YYSTYPE /* obsolescent; will be withdrawn */ - # define YYSTYPE_IS_DECLARED 1 - #endif - --/* Location type. */ - #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED --typedef struct YYLTYPE YYLTYPE; --struct YYLTYPE -+typedef struct YYLTYPE - { - int first_line; - int first_column; - int last_line; - int last_column; --}; -+} YYLTYPE; -+# define yyltype YYLTYPE /* obsolescent; will be withdrawn */ - # define YYLTYPE_IS_DECLARED 1 - # define YYLTYPE_IS_TRIVIAL 1 - #endif - - --extern YYSTYPE yylval; --extern YYLTYPE yylloc; --int yyparse (void); -- --#endif /* !YY_YY_DTC_PARSER_TAB_H_INCLUDED */ -- - /* Copy the second part of user declarations. */ - --#line 196 "dtc-parser.tab.c" /* yacc.c:358 */ -+ -+/* Line 343 of yacc.c */ -+#line 198 "dtc-parser.tab.c" - - #ifdef short - # undef short -@@ -206,8 +208,11 @@ typedef unsigned char yytype_uint8; - - #ifdef YYTYPE_INT8 - typedef YYTYPE_INT8 yytype_int8; --#else -+#elif (defined __STDC__ || defined __C99__FUNC__ \ -+ || defined __cplusplus || defined _MSC_VER) - typedef signed char yytype_int8; -+#else -+typedef short int yytype_int8; - #endif - - #ifdef YYTYPE_UINT16 -@@ -227,7 +232,8 @@ typedef short int yytype_int16; - # define YYSIZE_T __SIZE_TYPE__ - # elif defined size_t - # define YYSIZE_T size_t --# elif ! defined YYSIZE_T -+# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ -+ || defined __cplusplus || defined _MSC_VER) - # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ - # define YYSIZE_T size_t - # else -@@ -241,68 +247,39 @@ typedef short int yytype_int16; - # if defined YYENABLE_NLS && YYENABLE_NLS - # if ENABLE_NLS - # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ --# define YY_(Msgid) dgettext ("bison-runtime", Msgid) -+# define YY_(msgid) dgettext ("bison-runtime", msgid) - # endif - # endif - # ifndef YY_ --# define YY_(Msgid) Msgid --# endif --#endif -- --#ifndef YY_ATTRIBUTE --# if (defined __GNUC__ \ -- && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ -- || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C --# define YY_ATTRIBUTE(Spec) __attribute__(Spec) --# else --# define YY_ATTRIBUTE(Spec) /* empty */ --# endif --#endif -- --#ifndef YY_ATTRIBUTE_PURE --# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) --#endif -- --#ifndef YY_ATTRIBUTE_UNUSED --# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) --#endif -- --#if !defined _Noreturn \ -- && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112) --# if defined _MSC_VER && 1200 <= _MSC_VER --# define _Noreturn __declspec (noreturn) --# else --# define _Noreturn YY_ATTRIBUTE ((__noreturn__)) -+# define YY_(msgid) msgid - # endif - #endif - - /* Suppress unused-variable warnings by "using" E. */ - #if ! defined lint || defined __GNUC__ --# define YYUSE(E) ((void) (E)) -+# define YYUSE(e) ((void) (e)) - #else --# define YYUSE(E) /* empty */ -+# define YYUSE(e) /* empty */ - #endif - --#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ --/* Suppress an incorrect diagnostic about yylval being uninitialized. */ --# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ -- _Pragma ("GCC diagnostic push") \ -- _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ -- _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") --# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ -- _Pragma ("GCC diagnostic pop") -+/* Identity function, used to suppress warnings about constant conditions. */ -+#ifndef lint -+# define YYID(n) (n) - #else --# define YY_INITIAL_VALUE(Value) Value --#endif --#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN --# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN --# define YY_IGNORE_MAYBE_UNINITIALIZED_END -+#if (defined __STDC__ || defined __C99__FUNC__ \ -+ || defined __cplusplus || defined _MSC_VER) -+static int -+YYID (int yyi) -+#else -+static int -+YYID (yyi) -+ int yyi; - #endif --#ifndef YY_INITIAL_VALUE --# define YY_INITIAL_VALUE(Value) /* Nothing. */ -+{ -+ return yyi; -+} - #endif - -- - #if ! defined yyoverflow || YYERROR_VERBOSE - - /* The parser invokes alloca or malloc; define the necessary symbols. */ -@@ -320,9 +297,9 @@ typedef short int yytype_int16; - # define alloca _alloca - # else - # define YYSTACK_ALLOC alloca --# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS -+# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ -+ || defined __cplusplus || defined _MSC_VER) - # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ -- /* Use EXIT_SUCCESS as a witness for stdlib.h. */ - # ifndef EXIT_SUCCESS - # define EXIT_SUCCESS 0 - # endif -@@ -332,8 +309,8 @@ typedef short int yytype_int16; - # endif - - # ifdef YYSTACK_ALLOC -- /* Pacify GCC's 'empty if-body' warning. */ --# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) -+ /* Pacify GCC's `empty if-body' warning. */ -+# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) - # ifndef YYSTACK_ALLOC_MAXIMUM - /* The OS might guarantee only one guard page at the bottom of the stack, - and a page size can be as small as 4096 bytes. So we cannot safely -@@ -349,7 +326,7 @@ typedef short int yytype_int16; - # endif - # if (defined __cplusplus && ! defined EXIT_SUCCESS \ - && ! ((defined YYMALLOC || defined malloc) \ -- && (defined YYFREE || defined free))) -+ && (defined YYFREE || defined free))) - # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ - # ifndef EXIT_SUCCESS - # define EXIT_SUCCESS 0 -@@ -357,13 +334,15 @@ typedef short int yytype_int16; - # endif - # ifndef YYMALLOC - # define YYMALLOC malloc --# if ! defined malloc && ! defined EXIT_SUCCESS -+# if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ -+ || defined __cplusplus || defined _MSC_VER) - void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ - # endif - # endif - # ifndef YYFREE - # define YYFREE free --# if ! defined free && ! defined EXIT_SUCCESS -+# if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ -+ || defined __cplusplus || defined _MSC_VER) - void free (void *); /* INFRINGES ON USER NAME SPACE */ - # endif - # endif -@@ -373,8 +352,8 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */ - - #if (! defined yyoverflow \ - && (! defined __cplusplus \ -- || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \ -- && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) -+ || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \ -+ && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) - - /* A type that is properly aligned for any stack member. */ - union yyalloc -@@ -400,35 +379,35 @@ union yyalloc - elements in the stack, and YYPTR gives the new location of the - stack. Advance YYPTR to a properly aligned location for the next - stack. */ --# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ -- do \ -- { \ -- YYSIZE_T yynewbytes; \ -- YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ -- Stack = &yyptr->Stack_alloc; \ -- yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ -- yyptr += yynewbytes / sizeof (*yyptr); \ -- } \ -- while (0) -+# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ -+ do \ -+ { \ -+ YYSIZE_T yynewbytes; \ -+ YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ -+ Stack = &yyptr->Stack_alloc; \ -+ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ -+ yyptr += yynewbytes / sizeof (*yyptr); \ -+ } \ -+ while (YYID (0)) - - #endif - - #if defined YYCOPY_NEEDED && YYCOPY_NEEDED --/* Copy COUNT objects from SRC to DST. The source and destination do -+/* Copy COUNT objects from FROM to TO. The source and destination do - not overlap. */ - # ifndef YYCOPY - # if defined __GNUC__ && 1 < __GNUC__ --# define YYCOPY(Dst, Src, Count) \ -- __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) -+# define YYCOPY(To, From, Count) \ -+ __builtin_memcpy (To, From, (Count) * sizeof (*(From))) - # else --# define YYCOPY(Dst, Src, Count) \ -- do \ -- { \ -- YYSIZE_T yyi; \ -- for (yyi = 0; yyi < (Count); yyi++) \ -- (Dst)[yyi] = (Src)[yyi]; \ -- } \ -- while (0) -+# define YYCOPY(To, From, Count) \ -+ do \ -+ { \ -+ YYSIZE_T yyi; \ -+ for (yyi = 0; yyi < (Count); yyi++) \ -+ (To)[yyi] = (From)[yyi]; \ -+ } \ -+ while (YYID (0)) - # endif - # endif - #endif /* !YYCOPY_NEEDED */ -@@ -439,39 +418,37 @@ union yyalloc - #define YYLAST 136 - - /* YYNTOKENS -- Number of terminals. */ --#define YYNTOKENS 47 -+#define YYNTOKENS 48 - /* YYNNTS -- Number of nonterminals. */ --#define YYNNTS 28 -+#define YYNNTS 29 - /* YYNRULES -- Number of rules. */ --#define YYNRULES 80 --/* YYNSTATES -- Number of states. */ --#define YYNSTATES 144 -+#define YYNRULES 82 -+/* YYNRULES -- Number of states. */ -+#define YYNSTATES 147 - --/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned -- by yylex, with out-of-bounds checking. */ -+/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ - #define YYUNDEFTOK 2 --#define YYMAXUTOK 278 -+#define YYMAXUTOK 279 - --#define YYTRANSLATE(YYX) \ -+#define YYTRANSLATE(YYX) \ - ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) - --/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM -- as returned by yylex, without out-of-bounds checking. */ -+/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ - static const yytype_uint8 yytranslate[] = - { - 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, -- 2, 2, 2, 46, 2, 2, 2, 44, 40, 2, -- 32, 34, 43, 41, 33, 42, 2, 25, 2, 2, -- 2, 2, 2, 2, 2, 2, 2, 2, 37, 24, -- 35, 28, 29, 36, 2, 2, 2, 2, 2, 2, -+ 2, 2, 2, 47, 2, 2, 2, 45, 41, 2, -+ 33, 35, 44, 42, 34, 43, 2, 26, 2, 2, -+ 2, 2, 2, 2, 2, 2, 2, 2, 38, 25, -+ 36, 29, 30, 37, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, -- 2, 30, 2, 31, 39, 2, 2, 2, 2, 2, -+ 2, 31, 2, 32, 40, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, -- 2, 2, 2, 26, 38, 27, 45, 2, 2, 2, -+ 2, 2, 2, 27, 39, 28, 46, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, -@@ -486,292 +463,335 @@ static const yytype_uint8 yytranslate[] = - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, - 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, -- 15, 16, 17, 18, 19, 20, 21, 22, 23 -+ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24 - }; - - #if YYDEBUG -- /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ -+/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in -+ YYRHS. */ -+static const yytype_uint16 yyprhs[] = -+{ -+ 0, 0, 3, 9, 10, 13, 14, 17, 22, 25, -+ 28, 32, 37, 41, 46, 52, 53, 56, 61, 64, -+ 68, 71, 74, 78, 83, 86, 96, 102, 105, 106, -+ 109, 112, 116, 118, 121, 124, 127, 129, 131, 135, -+ 137, 139, 145, 147, 151, 153, 157, 159, 163, 165, -+ 169, 171, 175, 177, 181, 185, 187, 191, 195, 199, -+ 203, 207, 211, 213, 217, 221, 223, 227, 231, 235, -+ 237, 239, 242, 245, 248, 249, 252, 255, 256, 259, -+ 262, 265, 269 -+}; -+ -+/* YYRHS -- A `-1'-separated list of the rules' RHS. */ -+static const yytype_int8 yyrhs[] = -+{ -+ 49, 0, -1, 3, 25, 50, 51, 53, -1, -1, -+ 4, 25, -1, -1, 52, 51, -1, 5, 60, 60, -+ 25, -1, 22, 52, -1, 26, 54, -1, 53, 26, -+ 54, -1, 53, 22, 23, 54, -1, 53, 23, 54, -+ -1, 53, 16, 23, 25, -1, 27, 55, 75, 28, -+ 25, -1, -1, 55, 56, -1, 17, 29, 57, 25, -+ -1, 17, 25, -1, 15, 17, 25, -1, 22, 56, -+ -1, 58, 21, -1, 58, 59, 30, -1, 58, 31, -+ 74, 32, -1, 58, 23, -1, 58, 24, 33, 21, -+ 34, 60, 34, 60, 35, -1, 58, 24, 33, 21, -+ 35, -1, 57, 22, -1, -1, 57, 34, -1, 58, -+ 22, -1, 14, 18, 36, -1, 36, -1, 59, 60, -+ -1, 59, 23, -1, 59, 22, -1, 18, -1, 19, -+ -1, 33, 61, 35, -1, 62, -1, 63, -1, 63, -+ 37, 61, 38, 62, -1, 64, -1, 63, 13, 64, -+ -1, 65, -1, 64, 12, 65, -1, 66, -1, 65, -+ 39, 66, -1, 67, -1, 66, 40, 67, -1, 68, -+ -1, 67, 41, 68, -1, 69, -1, 68, 10, 69, -+ -1, 68, 11, 69, -1, 70, -1, 69, 36, 70, -+ -1, 69, 30, 70, -1, 69, 8, 70, -1, 69, -+ 9, 70, -1, 70, 6, 71, -1, 70, 7, 71, -+ -1, 71, -1, 71, 42, 72, -1, 71, 43, 72, -+ -1, 72, -1, 72, 44, 73, -1, 72, 26, 73, -+ -1, 72, 45, 73, -1, 73, -1, 60, -1, 43, -+ 73, -1, 46, 73, -1, 47, 73, -1, -1, 74, -+ 20, -1, 74, 22, -1, -1, 76, 75, -1, 76, -+ 56, -1, 17, 54, -1, 16, 17, 25, -1, 22, -+ 76, -1 -+}; -+ -+/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ - static const yytype_uint16 yyrline[] = - { -- 0, 104, 104, 113, 116, 123, 127, 135, 139, 144, -- 155, 165, 180, 188, 191, 198, 202, 206, 210, 218, -- 222, 226, 230, 234, 250, 260, 268, 271, 275, 282, -- 298, 303, 322, 336, 343, 344, 345, 352, 356, 357, -- 361, 362, 366, 367, 371, 372, 376, 377, 381, 382, -- 386, 387, 388, 392, 393, 394, 395, 396, 400, 401, -- 402, 406, 407, 408, 412, 413, 414, 415, 419, 420, -- 421, 422, 427, 430, 434, 442, 445, 449, 457, 461, -- 465 -+ 0, 108, 108, 119, 122, 130, 133, 140, 144, 152, -+ 156, 161, 172, 182, 197, 205, 208, 215, 219, 223, -+ 227, 235, 239, 243, 247, 251, 267, 277, 285, 288, -+ 292, 299, 315, 320, 339, 353, 360, 361, 362, 369, -+ 373, 374, 378, 379, 383, 384, 388, 389, 393, 394, -+ 398, 399, 403, 404, 405, 409, 410, 411, 412, 413, -+ 417, 418, 419, 423, 424, 425, 429, 430, 431, 432, -+ 436, 437, 438, 439, 444, 447, 451, 459, 462, 466, -+ 474, 478, 482 - }; - #endif - --#if YYDEBUG || YYERROR_VERBOSE || 0 -+#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE - /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. - First, the terminals, then, starting at YYNTOKENS, nonterminals. */ - static const char *const yytname[] = - { -- "$end", "error", "$undefined", "DT_V1", "DT_MEMRESERVE", "DT_LSHIFT", -- "DT_RSHIFT", "DT_LE", "DT_GE", "DT_EQ", "DT_NE", "DT_AND", "DT_OR", -- "DT_BITS", "DT_DEL_PROP", "DT_DEL_NODE", "DT_PROPNODENAME", "DT_LITERAL", -- "DT_CHAR_LITERAL", "DT_BYTE", "DT_STRING", "DT_LABEL", "DT_REF", -- "DT_INCBIN", "';'", "'/'", "'{'", "'}'", "'='", "'>'", "'['", "']'", -- "'('", "','", "')'", "'<'", "'?'", "':'", "'|'", "'^'", "'&'", "'+'", -- "'-'", "'*'", "'%'", "'~'", "'!'", "$accept", "sourcefile", -- "memreserves", "memreserve", "devicetree", "nodedef", "proplist", -- "propdef", "propdata", "propdataprefix", "arrayprefix", "integer_prim", -- "integer_expr", "integer_trinary", "integer_or", "integer_and", -- "integer_bitor", "integer_bitxor", "integer_bitand", "integer_eq", -- "integer_rela", "integer_shift", "integer_add", "integer_mul", -- "integer_unary", "bytestring", "subnodes", "subnode", YY_NULLPTR -+ "$end", "error", "$undefined", "DT_V1", "DT_PLUGIN", "DT_MEMRESERVE", -+ "DT_LSHIFT", "DT_RSHIFT", "DT_LE", "DT_GE", "DT_EQ", "DT_NE", "DT_AND", -+ "DT_OR", "DT_BITS", "DT_DEL_PROP", "DT_DEL_NODE", "DT_PROPNODENAME", -+ "DT_LITERAL", "DT_CHAR_LITERAL", "DT_BYTE", "DT_STRING", "DT_LABEL", -+ "DT_REF", "DT_INCBIN", "';'", "'/'", "'{'", "'}'", "'='", "'>'", "'['", -+ "']'", "'('", "','", "')'", "'<'", "'?'", "':'", "'|'", "'^'", "'&'", -+ "'+'", "'-'", "'*'", "'%'", "'~'", "'!'", "$accept", "sourcefile", -+ "plugindecl", "memreserves", "memreserve", "devicetree", "nodedef", -+ "proplist", "propdef", "propdata", "propdataprefix", "arrayprefix", -+ "integer_prim", "integer_expr", "integer_trinary", "integer_or", -+ "integer_and", "integer_bitor", "integer_bitxor", "integer_bitand", -+ "integer_eq", "integer_rela", "integer_shift", "integer_add", -+ "integer_mul", "integer_unary", "bytestring", "subnodes", "subnode", 0 - }; - #endif - - # ifdef YYPRINT --/* YYTOKNUM[NUM] -- (External) token number corresponding to the -- (internal) symbol number NUM (which must be that of a token). */ -+/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to -+ token YYLEX-NUM. */ - static const yytype_uint16 yytoknum[] = - { - 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, - 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, -- 275, 276, 277, 278, 59, 47, 123, 125, 61, 62, -- 91, 93, 40, 44, 41, 60, 63, 58, 124, 94, -- 38, 43, 45, 42, 37, 126, 33 -+ 275, 276, 277, 278, 279, 59, 47, 123, 125, 61, -+ 62, 91, 93, 40, 44, 41, 60, 63, 58, 124, -+ 94, 38, 43, 45, 42, 37, 126, 33 - }; - # endif - --#define YYPACT_NINF -81 -- --#define yypact_value_is_default(Yystate) \ -- (!!((Yystate) == (-81))) -- --#define YYTABLE_NINF -1 -- --#define yytable_value_is_error(Yytable_value) \ -- 0 -- -- /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing -- STATE-NUM. */ --static const yytype_int8 yypact[] = -+/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ -+static const yytype_uint8 yyr1[] = - { -- 16, -11, 21, 10, -81, 25, 10, 19, 10, -81, -- -81, -9, 25, -81, 2, 51, -81, -9, -9, -9, -- -81, 1, -81, -6, 50, 14, 28, 29, 36, 3, -- 58, 44, -3, -81, 47, -81, -81, 65, 68, 2, -- 2, -81, -81, -81, -81, -9, -9, -9, -9, -9, -- -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -- -9, -9, -9, -9, -81, 63, 69, 2, -81, -81, -- 50, 57, 14, 28, 29, 36, 3, 3, 58, 58, -- 58, 58, 44, 44, -3, -3, -81, -81, -81, 79, -- 80, -8, 63, -81, 72, 63, -81, -81, -9, 76, -- 77, -81, -81, -81, -81, -81, 78, -81, -81, -81, -- -81, -81, 35, 4, -81, -81, -81, -81, 86, -81, -- -81, -81, 73, -81, -81, 33, 71, 84, 39, -81, -- -81, -81, -81, -81, 41, -81, -81, -81, 25, -81, -- 74, 25, 75, -81 -+ 0, 48, 49, 50, 50, 51, 51, 52, 52, 53, -+ 53, 53, 53, 53, 54, 55, 55, 56, 56, 56, -+ 56, 57, 57, 57, 57, 57, 57, 57, 58, 58, -+ 58, 59, 59, 59, 59, 59, 60, 60, 60, 61, -+ 62, 62, 63, 63, 64, 64, 65, 65, 66, 66, -+ 67, 67, 68, 68, 68, 69, 69, 69, 69, 69, -+ 70, 70, 70, 71, 71, 71, 72, 72, 72, 72, -+ 73, 73, 73, 73, 74, 74, 74, 75, 75, 75, -+ 76, 76, 76 - }; - -- /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. -- Performed when YYTABLE does not specify something else to do. Zero -- means the default is an error. */ --static const yytype_uint8 yydefact[] = -+/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ -+static const yytype_uint8 yyr2[] = - { -- 0, 0, 0, 3, 1, 0, 0, 0, 3, 34, -- 35, 0, 0, 6, 0, 2, 4, 0, 0, 0, -- 68, 0, 37, 38, 40, 42, 44, 46, 48, 50, -- 53, 60, 63, 67, 0, 13, 7, 0, 0, 0, -- 0, 69, 70, 71, 36, 0, 0, 0, 0, 0, -- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- 0, 0, 0, 0, 5, 75, 0, 0, 10, 8, -- 41, 0, 43, 45, 47, 49, 51, 52, 56, 57, -- 55, 54, 58, 59, 61, 62, 65, 64, 66, 0, -- 0, 0, 0, 14, 0, 75, 11, 9, 0, 0, -- 0, 16, 26, 78, 18, 80, 0, 77, 76, 39, -- 17, 79, 0, 0, 12, 25, 15, 27, 0, 19, -- 28, 22, 0, 72, 30, 0, 0, 0, 0, 33, -- 32, 20, 31, 29, 0, 73, 74, 21, 0, 24, -- 0, 0, 0, 23 -+ 0, 2, 5, 0, 2, 0, 2, 4, 2, 2, -+ 3, 4, 3, 4, 5, 0, 2, 4, 2, 3, -+ 2, 2, 3, 4, 2, 9, 5, 2, 0, 2, -+ 2, 3, 1, 2, 2, 2, 1, 1, 3, 1, -+ 1, 5, 1, 3, 1, 3, 1, 3, 1, 3, -+ 1, 3, 1, 3, 3, 1, 3, 3, 3, 3, -+ 3, 3, 1, 3, 3, 1, 3, 3, 3, 1, -+ 1, 2, 2, 2, 0, 2, 2, 0, 2, 2, -+ 2, 3, 2 - }; - -- /* YYPGOTO[NTERM-NUM]. */ --static const yytype_int8 yypgoto[] = -+/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM. -+ Performed when YYTABLE doesn't specify something else to do. Zero -+ means the default is an error. */ -+static const yytype_uint8 yydefact[] = - { -- -81, -81, 100, 104, -81, -38, -81, -80, -81, -81, -- -81, -5, 66, 13, -81, 70, 67, 81, 64, 82, -- 37, 27, 34, 38, -14, -81, 22, 24 -+ 0, 0, 0, 3, 1, 0, 5, 4, 0, 0, -+ 0, 5, 36, 37, 0, 0, 8, 0, 2, 6, -+ 0, 0, 0, 70, 0, 39, 40, 42, 44, 46, -+ 48, 50, 52, 55, 62, 65, 69, 0, 15, 9, -+ 0, 0, 0, 0, 71, 72, 73, 38, 0, 0, -+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -+ 0, 0, 0, 0, 0, 0, 0, 7, 77, 0, -+ 0, 12, 10, 43, 0, 45, 47, 49, 51, 53, -+ 54, 58, 59, 57, 56, 60, 61, 63, 64, 67, -+ 66, 68, 0, 0, 0, 0, 16, 0, 77, 13, -+ 11, 0, 0, 0, 18, 28, 80, 20, 82, 0, -+ 79, 78, 41, 19, 81, 0, 0, 14, 27, 17, -+ 29, 0, 21, 30, 24, 0, 74, 32, 0, 0, -+ 0, 0, 35, 34, 22, 33, 31, 0, 75, 76, -+ 23, 0, 26, 0, 0, 0, 25 - }; - -- /* YYDEFGOTO[NTERM-NUM]. */ -+/* YYDEFGOTO[NTERM-NUM]. */ - static const yytype_int16 yydefgoto[] = - { -- -1, 2, 7, 8, 15, 36, 65, 93, 112, 113, -- 125, 20, 21, 22, 23, 24, 25, 26, 27, 28, -- 29, 30, 31, 32, 33, 128, 94, 95 -+ -1, 2, 6, 10, 11, 18, 39, 68, 96, 115, -+ 116, 128, 23, 24, 25, 26, 27, 28, 29, 30, -+ 31, 32, 33, 34, 35, 36, 131, 97, 98 - }; - -- /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If -- positive, shift that token. If negative, reduce the rule whose -- number is the opposite. If YYTABLE_NINF, syntax error. */ --static const yytype_uint8 yytable[] = -+/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing -+ STATE-NUM. */ -+#define YYPACT_NINF -84 -+static const yytype_int8 yypact[] = - { -- 12, 68, 69, 41, 42, 43, 45, 34, 9, 10, -- 53, 54, 104, 3, 5, 107, 101, 118, 35, 1, -- 102, 4, 61, 11, 119, 120, 121, 122, 35, 97, -- 46, 6, 55, 17, 123, 44, 18, 19, 56, 124, -- 62, 63, 9, 10, 14, 51, 52, 86, 87, 88, -- 9, 10, 48, 103, 129, 130, 115, 11, 135, 116, -- 136, 47, 131, 57, 58, 11, 37, 49, 117, 50, -- 137, 64, 38, 39, 138, 139, 40, 89, 90, 91, -- 78, 79, 80, 81, 92, 59, 60, 66, 76, 77, -- 67, 82, 83, 96, 98, 99, 100, 84, 85, 106, -- 110, 111, 114, 126, 134, 127, 133, 141, 16, 143, -- 13, 109, 71, 74, 72, 70, 105, 108, 0, 0, -- 132, 0, 0, 0, 0, 0, 0, 0, 0, 73, -- 0, 0, 75, 140, 0, 0, 142 -+ 15, -12, 35, 42, -84, 27, 9, -84, 24, 9, -+ 43, 9, -84, -84, -10, 24, -84, 60, 44, -84, -+ -10, -10, -10, -84, 55, -84, -7, 52, 53, 51, -+ 54, 10, 2, 38, 37, -4, -84, 68, -84, -84, -+ 71, 73, 60, 60, -84, -84, -84, -84, -10, -10, -+ -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -+ -10, -10, -10, -10, -10, -10, -10, -84, 56, 72, -+ 60, -84, -84, 52, 61, 53, 51, 54, 10, 2, -+ 2, 38, 38, 38, 38, 37, 37, -4, -4, -84, -+ -84, -84, 81, 83, 34, 56, -84, 74, 56, -84, -+ -84, -10, 76, 78, -84, -84, -84, -84, -84, 79, -+ -84, -84, -84, -84, -84, -6, 3, -84, -84, -84, -+ -84, 87, -84, -84, -84, 75, -84, -84, 32, 70, -+ 86, 36, -84, -84, -84, -84, -84, 47, -84, -84, -+ -84, 24, -84, 77, 24, 80, -84 - }; - --static const yytype_int16 yycheck[] = -+/* YYPGOTO[NTERM-NUM]. */ -+static const yytype_int8 yypgoto[] = - { -- 5, 39, 40, 17, 18, 19, 12, 12, 17, 18, -- 7, 8, 92, 24, 4, 95, 24, 13, 26, 3, -- 28, 0, 25, 32, 20, 21, 22, 23, 26, 67, -- 36, 21, 29, 42, 30, 34, 45, 46, 35, 35, -- 43, 44, 17, 18, 25, 9, 10, 61, 62, 63, -- 17, 18, 38, 91, 21, 22, 21, 32, 19, 24, -- 21, 11, 29, 5, 6, 32, 15, 39, 33, 40, -- 31, 24, 21, 22, 33, 34, 25, 14, 15, 16, -- 53, 54, 55, 56, 21, 41, 42, 22, 51, 52, -- 22, 57, 58, 24, 37, 16, 16, 59, 60, 27, -- 24, 24, 24, 17, 20, 32, 35, 33, 8, 34, -- 6, 98, 46, 49, 47, 45, 92, 95, -1, -1, -- 125, -1, -1, -1, -1, -1, -1, -1, -1, 48, -- -1, -1, 50, 138, -1, -1, 141 -+ -84, -84, -84, 98, 101, -84, -41, -84, -83, -84, -+ -84, -84, -8, 63, 12, -84, 66, 67, 65, 69, -+ 82, 29, 18, 25, 26, -17, -84, 20, 28 - }; - -- /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing -- symbol of state STATE-NUM. */ --static const yytype_uint8 yystos[] = -+/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If -+ positive, shift that token. If negative, reduce the rule which -+ number is the opposite. If YYTABLE_NINF, syntax error. */ -+#define YYTABLE_NINF -1 -+static const yytype_uint8 yytable[] = - { -- 0, 3, 48, 24, 0, 4, 21, 49, 50, 17, -- 18, 32, 58, 50, 25, 51, 49, 42, 45, 46, -- 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, -- 68, 69, 70, 71, 58, 26, 52, 15, 21, 22, -- 25, 71, 71, 71, 34, 12, 36, 11, 38, 39, -- 40, 9, 10, 7, 8, 29, 35, 5, 6, 41, -- 42, 25, 43, 44, 24, 53, 22, 22, 52, 52, -- 62, 59, 63, 64, 65, 66, 67, 67, 68, 68, -- 68, 68, 69, 69, 70, 70, 71, 71, 71, 14, -- 15, 16, 21, 54, 73, 74, 24, 52, 37, 16, -- 16, 24, 28, 52, 54, 74, 27, 54, 73, 60, -- 24, 24, 55, 56, 24, 21, 24, 33, 13, 20, -- 21, 22, 23, 30, 35, 57, 17, 32, 72, 21, -- 22, 29, 58, 35, 20, 19, 21, 31, 33, 34, -- 58, 33, 58, 34 -+ 15, 71, 72, 44, 45, 46, 48, 37, 12, 13, -+ 56, 57, 107, 3, 8, 110, 118, 121, 1, 119, -+ 54, 55, 64, 14, 122, 123, 124, 125, 120, 100, -+ 49, 9, 58, 20, 126, 4, 21, 22, 59, 127, -+ 65, 66, 12, 13, 60, 61, 5, 89, 90, 91, -+ 12, 13, 7, 106, 132, 133, 138, 14, 139, 104, -+ 40, 38, 134, 105, 50, 14, 41, 42, 140, 17, -+ 43, 92, 93, 94, 81, 82, 83, 84, 95, 62, -+ 63, 141, 142, 79, 80, 85, 86, 38, 87, 88, -+ 47, 52, 51, 67, 69, 53, 70, 99, 102, 101, -+ 103, 113, 109, 114, 117, 129, 136, 137, 130, 19, -+ 16, 144, 74, 112, 73, 146, 76, 75, 111, 0, -+ 135, 77, 0, 108, 0, 0, 0, 0, 0, 0, -+ 0, 0, 0, 143, 0, 78, 145 - }; - -- /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ --static const yytype_uint8 yyr1[] = -+#define yypact_value_is_default(yystate) \ -+ ((yystate) == (-84)) -+ -+#define yytable_value_is_error(yytable_value) \ -+ YYID (0) -+ -+static const yytype_int16 yycheck[] = - { -- 0, 47, 48, 49, 49, 50, 50, 51, 51, 51, -- 51, 51, 52, 53, 53, 54, 54, 54, 54, 55, -- 55, 55, 55, 55, 55, 55, 56, 56, 56, 57, -- 57, 57, 57, 57, 58, 58, 58, 59, 60, 60, -- 61, 61, 62, 62, 63, 63, 64, 64, 65, 65, -- 66, 66, 66, 67, 67, 67, 67, 67, 68, 68, -- 68, 69, 69, 69, 70, 70, 70, 70, 71, 71, -- 71, 71, 72, 72, 72, 73, 73, 73, 74, 74, -- 74 -+ 8, 42, 43, 20, 21, 22, 13, 15, 18, 19, -+ 8, 9, 95, 25, 5, 98, 22, 14, 3, 25, -+ 10, 11, 26, 33, 21, 22, 23, 24, 34, 70, -+ 37, 22, 30, 43, 31, 0, 46, 47, 36, 36, -+ 44, 45, 18, 19, 6, 7, 4, 64, 65, 66, -+ 18, 19, 25, 94, 22, 23, 20, 33, 22, 25, -+ 16, 27, 30, 29, 12, 33, 22, 23, 32, 26, -+ 26, 15, 16, 17, 56, 57, 58, 59, 22, 42, -+ 43, 34, 35, 54, 55, 60, 61, 27, 62, 63, -+ 35, 40, 39, 25, 23, 41, 23, 25, 17, 38, -+ 17, 25, 28, 25, 25, 18, 36, 21, 33, 11, -+ 9, 34, 49, 101, 48, 35, 51, 50, 98, -1, -+ 128, 52, -1, 95, -1, -1, -1, -1, -1, -1, -+ -1, -1, -1, 141, -1, 53, 144 - }; - -- /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ --static const yytype_uint8 yyr2[] = -+/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing -+ symbol of state STATE-NUM. */ -+static const yytype_uint8 yystos[] = - { -- 0, 2, 4, 0, 2, 4, 2, 2, 3, 4, -- 3, 4, 5, 0, 2, 4, 2, 3, 2, 2, -- 3, 4, 2, 9, 5, 2, 0, 2, 2, 3, -- 1, 2, 2, 2, 1, 1, 3, 1, 1, 5, -- 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, -- 1, 3, 3, 1, 3, 3, 3, 3, 3, 3, -- 1, 3, 3, 1, 3, 3, 3, 1, 1, 2, -- 2, 2, 0, 2, 2, 0, 2, 2, 2, 3, -- 2 -+ 0, 3, 49, 25, 0, 4, 50, 25, 5, 22, -+ 51, 52, 18, 19, 33, 60, 52, 26, 53, 51, -+ 43, 46, 47, 60, 61, 62, 63, 64, 65, 66, -+ 67, 68, 69, 70, 71, 72, 73, 60, 27, 54, -+ 16, 22, 23, 26, 73, 73, 73, 35, 13, 37, -+ 12, 39, 40, 41, 10, 11, 8, 9, 30, 36, -+ 6, 7, 42, 43, 26, 44, 45, 25, 55, 23, -+ 23, 54, 54, 64, 61, 65, 66, 67, 68, 69, -+ 69, 70, 70, 70, 70, 71, 71, 72, 72, 73, -+ 73, 73, 15, 16, 17, 22, 56, 75, 76, 25, -+ 54, 38, 17, 17, 25, 29, 54, 56, 76, 28, -+ 56, 75, 62, 25, 25, 57, 58, 25, 22, 25, -+ 34, 14, 21, 22, 23, 24, 31, 36, 59, 18, -+ 33, 74, 22, 23, 30, 60, 36, 21, 20, 22, -+ 32, 34, 35, 60, 34, 60, 35 - }; - -- --#define yyerrok (yyerrstatus = 0) --#define yyclearin (yychar = YYEMPTY) --#define YYEMPTY (-2) --#define YYEOF 0 -- --#define YYACCEPT goto yyacceptlab --#define YYABORT goto yyabortlab --#define YYERROR goto yyerrorlab -- -+#define yyerrok (yyerrstatus = 0) -+#define yyclearin (yychar = YYEMPTY) -+#define YYEMPTY (-2) -+#define YYEOF 0 -+ -+#define YYACCEPT goto yyacceptlab -+#define YYABORT goto yyabortlab -+#define YYERROR goto yyerrorlab -+ -+ -+/* Like YYERROR except do call yyerror. This remains here temporarily -+ to ease the transition to the new meaning of YYERROR, for GCC. -+ Once GCC version 2 has supplanted version 1, this can go. However, -+ YYFAIL appears to be in use. Nevertheless, it is formally deprecated -+ in Bison 2.4.2's NEWS entry, where a plan to phase it out is -+ discussed. */ -+ -+#define YYFAIL goto yyerrlab -+#if defined YYFAIL -+ /* This is here to suppress warnings from the GCC cpp's -+ -Wunused-macros. Normally we don't worry about that warning, but -+ some users do, and we want to make it easy for users to remove -+ YYFAIL uses, which will produce warnings from Bison 2.5. */ -+#endif - - #define YYRECOVERING() (!!yyerrstatus) - --#define YYBACKUP(Token, Value) \ --do \ -- if (yychar == YYEMPTY) \ -- { \ -- yychar = (Token); \ -- yylval = (Value); \ -- YYPOPSTACK (yylen); \ -- yystate = *yyssp; \ -- goto yybackup; \ -- } \ -- else \ -- { \ -+#define YYBACKUP(Token, Value) \ -+do \ -+ if (yychar == YYEMPTY && yylen == 1) \ -+ { \ -+ yychar = (Token); \ -+ yylval = (Value); \ -+ YYPOPSTACK (1); \ -+ goto yybackup; \ -+ } \ -+ else \ -+ { \ - yyerror (YY_("syntax error: cannot back up")); \ -- YYERROR; \ -- } \ --while (0) -+ YYERROR; \ -+ } \ -+while (YYID (0)) -+ - --/* Error token number */ --#define YYTERROR 1 --#define YYERRCODE 256 -+#define YYTERROR 1 -+#define YYERRCODE 256 - - - /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. - If N is 0, then set CURRENT to the empty location which ends - the previous symbol: RHS[0] (always defined). */ - -+#define YYRHSLOC(Rhs, K) ((Rhs)[K]) - #ifndef YYLLOC_DEFAULT --# define YYLLOC_DEFAULT(Current, Rhs, N) \ -- do \ -- if (N) \ -- { \ -- (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ -- (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ -- (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ -- (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ -- } \ -- else \ -- { \ -- (Current).first_line = (Current).last_line = \ -- YYRHSLOC (Rhs, 0).last_line; \ -- (Current).first_column = (Current).last_column = \ -- YYRHSLOC (Rhs, 0).last_column; \ -- } \ -- while (0) -+# define YYLLOC_DEFAULT(Current, Rhs, N) \ -+ do \ -+ if (YYID (N)) \ -+ { \ -+ (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ -+ (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ -+ (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ -+ (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ -+ } \ -+ else \ -+ { \ -+ (Current).first_line = (Current).last_line = \ -+ YYRHSLOC (Rhs, 0).last_line; \ -+ (Current).first_column = (Current).last_column = \ -+ YYRHSLOC (Rhs, 0).last_column; \ -+ } \ -+ while (YYID (0)) - #endif - --#define YYRHSLOC(Rhs, K) ((Rhs)[K]) -- -- --/* Enable debugging if requested. */ --#if YYDEBUG -- --# ifndef YYFPRINTF --# include <stdio.h> /* INFRINGES ON USER NAME SPACE */ --# define YYFPRINTF fprintf --# endif -- --# define YYDPRINTF(Args) \ --do { \ -- if (yydebug) \ -- YYFPRINTF Args; \ --} while (0) -- - - /* YY_LOCATION_PRINT -- Print the location on the stream. - This macro was not mandated originally: define only if we know -@@ -779,73 +799,82 @@ do { \ - - #ifndef YY_LOCATION_PRINT - # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL -+# define YY_LOCATION_PRINT(File, Loc) \ -+ fprintf (File, "%d.%d-%d.%d", \ -+ (Loc).first_line, (Loc).first_column, \ -+ (Loc).last_line, (Loc).last_column) -+# else -+# define YY_LOCATION_PRINT(File, Loc) ((void) 0) -+# endif -+#endif - --/* Print *YYLOCP on YYO. Private, do not rely on its existence. */ - --YY_ATTRIBUTE_UNUSED --static unsigned --yy_location_print_ (FILE *yyo, YYLTYPE const * const yylocp) --{ -- unsigned res = 0; -- int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; -- if (0 <= yylocp->first_line) -- { -- res += YYFPRINTF (yyo, "%d", yylocp->first_line); -- if (0 <= yylocp->first_column) -- res += YYFPRINTF (yyo, ".%d", yylocp->first_column); -- } -- if (0 <= yylocp->last_line) -- { -- if (yylocp->first_line < yylocp->last_line) -- { -- res += YYFPRINTF (yyo, "-%d", yylocp->last_line); -- if (0 <= end_col) -- res += YYFPRINTF (yyo, ".%d", end_col); -- } -- else if (0 <= end_col && yylocp->first_column < end_col) -- res += YYFPRINTF (yyo, "-%d", end_col); -- } -- return res; -- } -+/* YYLEX -- calling `yylex' with the right arguments. */ - --# define YY_LOCATION_PRINT(File, Loc) \ -- yy_location_print_ (File, &(Loc)) -+#ifdef YYLEX_PARAM -+# define YYLEX yylex (YYLEX_PARAM) -+#else -+# define YYLEX yylex () -+#endif - --# else --# define YY_LOCATION_PRINT(File, Loc) ((void) 0) -+/* Enable debugging if requested. */ -+#if YYDEBUG -+ -+# ifndef YYFPRINTF -+# include <stdio.h> /* INFRINGES ON USER NAME SPACE */ -+# define YYFPRINTF fprintf - # endif --#endif - -+# define YYDPRINTF(Args) \ -+do { \ -+ if (yydebug) \ -+ YYFPRINTF Args; \ -+} while (YYID (0)) - --# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ --do { \ -- if (yydebug) \ -- { \ -- YYFPRINTF (stderr, "%s ", Title); \ -- yy_symbol_print (stderr, \ -- Type, Value, Location); \ -- YYFPRINTF (stderr, "\n"); \ -- } \ --} while (0) -+# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ -+do { \ -+ if (yydebug) \ -+ { \ -+ YYFPRINTF (stderr, "%s ", Title); \ -+ yy_symbol_print (stderr, \ -+ Type, Value, Location); \ -+ YYFPRINTF (stderr, "\n"); \ -+ } \ -+} while (YYID (0)) - - --/*----------------------------------------. --| Print this symbol's value on YYOUTPUT. | --`----------------------------------------*/ -+/*--------------------------------. -+| Print this symbol on YYOUTPUT. | -+`--------------------------------*/ - -+/*ARGSUSED*/ -+#if (defined __STDC__ || defined __C99__FUNC__ \ -+ || defined __cplusplus || defined _MSC_VER) - static void - yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp) -+#else -+static void -+yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp) -+ FILE *yyoutput; -+ int yytype; -+ YYSTYPE const * const yyvaluep; -+ YYLTYPE const * const yylocationp; -+#endif - { -- FILE *yyo = yyoutput; -- YYUSE (yyo); -- YYUSE (yylocationp); - if (!yyvaluep) - return; -+ YYUSE (yylocationp); - # ifdef YYPRINT - if (yytype < YYNTOKENS) - YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); -+# else -+ YYUSE (yyoutput); - # endif -- YYUSE (yytype); -+ switch (yytype) -+ { -+ default: -+ break; -+ } - } - - -@@ -853,11 +882,23 @@ yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvalue - | Print this symbol on YYOUTPUT. | - `--------------------------------*/ - -+#if (defined __STDC__ || defined __C99__FUNC__ \ -+ || defined __cplusplus || defined _MSC_VER) - static void - yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp) -+#else -+static void -+yy_symbol_print (yyoutput, yytype, yyvaluep, yylocationp) -+ FILE *yyoutput; -+ int yytype; -+ YYSTYPE const * const yyvaluep; -+ YYLTYPE const * const yylocationp; -+#endif - { -- YYFPRINTF (yyoutput, "%s %s (", -- yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); -+ if (yytype < YYNTOKENS) -+ YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); -+ else -+ YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); - - YY_LOCATION_PRINT (yyoutput, *yylocationp); - YYFPRINTF (yyoutput, ": "); -@@ -870,8 +911,16 @@ yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYL - | TOP (included). | - `------------------------------------------------------------------*/ - -+#if (defined __STDC__ || defined __C99__FUNC__ \ -+ || defined __cplusplus || defined _MSC_VER) - static void - yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) -+#else -+static void -+yy_stack_print (yybottom, yytop) -+ yytype_int16 *yybottom; -+ yytype_int16 *yytop; -+#endif - { - YYFPRINTF (stderr, "Stack now"); - for (; yybottom <= yytop; yybottom++) -@@ -882,42 +931,50 @@ yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) - YYFPRINTF (stderr, "\n"); - } - --# define YY_STACK_PRINT(Bottom, Top) \ --do { \ -- if (yydebug) \ -- yy_stack_print ((Bottom), (Top)); \ --} while (0) -+# define YY_STACK_PRINT(Bottom, Top) \ -+do { \ -+ if (yydebug) \ -+ yy_stack_print ((Bottom), (Top)); \ -+} while (YYID (0)) - - - /*------------------------------------------------. - | Report that the YYRULE is going to be reduced. | - `------------------------------------------------*/ - -+#if (defined __STDC__ || defined __C99__FUNC__ \ -+ || defined __cplusplus || defined _MSC_VER) -+static void -+yy_reduce_print (YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule) -+#else - static void --yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule) -+yy_reduce_print (yyvsp, yylsp, yyrule) -+ YYSTYPE *yyvsp; -+ YYLTYPE *yylsp; -+ int yyrule; -+#endif - { -- unsigned long int yylno = yyrline[yyrule]; - int yynrhs = yyr2[yyrule]; - int yyi; -+ unsigned long int yylno = yyrline[yyrule]; - YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", -- yyrule - 1, yylno); -+ yyrule - 1, yylno); - /* The symbols being reduced. */ - for (yyi = 0; yyi < yynrhs; yyi++) - { - YYFPRINTF (stderr, " $%d = ", yyi + 1); -- yy_symbol_print (stderr, -- yystos[yyssp[yyi + 1 - yynrhs]], -- &(yyvsp[(yyi + 1) - (yynrhs)]) -- , &(yylsp[(yyi + 1) - (yynrhs)]) ); -+ yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], -+ &(yyvsp[(yyi + 1) - (yynrhs)]) -+ , &(yylsp[(yyi + 1) - (yynrhs)]) ); - YYFPRINTF (stderr, "\n"); - } - } - --# define YY_REDUCE_PRINT(Rule) \ --do { \ -- if (yydebug) \ -- yy_reduce_print (yyssp, yyvsp, yylsp, Rule); \ --} while (0) -+# define YY_REDUCE_PRINT(Rule) \ -+do { \ -+ if (yydebug) \ -+ yy_reduce_print (yyvsp, yylsp, Rule); \ -+} while (YYID (0)) - - /* Nonzero means print parse trace. It is left uninitialized so that - multiple parsers can coexist. */ -@@ -931,7 +988,7 @@ int yydebug; - - - /* YYINITDEPTH -- initial size of the parser's stacks. */ --#ifndef YYINITDEPTH -+#ifndef YYINITDEPTH - # define YYINITDEPTH 200 - #endif - -@@ -954,8 +1011,15 @@ int yydebug; - # define yystrlen strlen - # else - /* Return the length of YYSTR. */ -+#if (defined __STDC__ || defined __C99__FUNC__ \ -+ || defined __cplusplus || defined _MSC_VER) - static YYSIZE_T - yystrlen (const char *yystr) -+#else -+static YYSIZE_T -+yystrlen (yystr) -+ const char *yystr; -+#endif - { - YYSIZE_T yylen; - for (yylen = 0; yystr[yylen]; yylen++) -@@ -971,8 +1035,16 @@ yystrlen (const char *yystr) - # else - /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in - YYDEST. */ -+#if (defined __STDC__ || defined __C99__FUNC__ \ -+ || defined __cplusplus || defined _MSC_VER) - static char * - yystpcpy (char *yydest, const char *yysrc) -+#else -+static char * -+yystpcpy (yydest, yysrc) -+ char *yydest; -+ const char *yysrc; -+#endif - { - char *yyd = yydest; - const char *yys = yysrc; -@@ -1002,27 +1074,27 @@ yytnamerr (char *yyres, const char *yystr) - char const *yyp = yystr; - - for (;;) -- switch (*++yyp) -- { -- case '\'': -- case ',': -- goto do_not_strip_quotes; -- -- case '\\': -- if (*++yyp != '\\') -- goto do_not_strip_quotes; -- /* Fall through. */ -- default: -- if (yyres) -- yyres[yyn] = *yyp; -- yyn++; -- break; -- -- case '"': -- if (yyres) -- yyres[yyn] = '\0'; -- return yyn; -- } -+ switch (*++yyp) -+ { -+ case '\'': -+ case ',': -+ goto do_not_strip_quotes; -+ -+ case '\\': -+ if (*++yyp != '\\') -+ goto do_not_strip_quotes; -+ /* Fall through. */ -+ default: -+ if (yyres) -+ yyres[yyn] = *yyp; -+ yyn++; -+ break; -+ -+ case '"': -+ if (yyres) -+ yyres[yyn] = '\0'; -+ return yyn; -+ } - do_not_strip_quotes: ; - } - -@@ -1045,11 +1117,12 @@ static int - yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, - yytype_int16 *yyssp, int yytoken) - { -- YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); -+ YYSIZE_T yysize0 = yytnamerr (0, yytname[yytoken]); - YYSIZE_T yysize = yysize0; -+ YYSIZE_T yysize1; - enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; - /* Internationalized format string. */ -- const char *yyformat = YY_NULLPTR; -+ const char *yyformat = 0; - /* Arguments of yyformat. */ - char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; - /* Number of reported tokens (one for the "unexpected", one per -@@ -1057,6 +1130,10 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, - int yycount = 0; - - /* There are many possibilities here to consider: -+ - Assume YYFAIL is not used. It's too flawed to consider. See -+ <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html> -+ for details. YYERROR is fine as it does not invoke this -+ function. - - If this state is a consistent state with a default action, then - the only way this function was invoked is if the default action - is an error action. In that case, don't check for expected -@@ -1105,13 +1182,11 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, - break; - } - yyarg[yycount++] = yytname[yyx]; -- { -- YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); -- if (! (yysize <= yysize1 -- && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) -- return 2; -- yysize = yysize1; -- } -+ yysize1 = yysize + yytnamerr (0, yytname[yyx]); -+ if (! (yysize <= yysize1 -+ && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) -+ return 2; -+ yysize = yysize1; - } - } - } -@@ -1131,12 +1206,10 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, - # undef YYCASE_ - } - -- { -- YYSIZE_T yysize1 = yysize + yystrlen (yyformat); -- if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) -- return 2; -- yysize = yysize1; -- } -+ yysize1 = yysize + yystrlen (yyformat); -+ if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) -+ return 2; -+ yysize = yysize1; - - if (*yymsg_alloc < yysize) - { -@@ -1173,21 +1246,50 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, - | Release the memory associated to this symbol. | - `-----------------------------------------------*/ - -+/*ARGSUSED*/ -+#if (defined __STDC__ || defined __C99__FUNC__ \ -+ || defined __cplusplus || defined _MSC_VER) - static void - yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp) -+#else -+static void -+yydestruct (yymsg, yytype, yyvaluep, yylocationp) -+ const char *yymsg; -+ int yytype; -+ YYSTYPE *yyvaluep; -+ YYLTYPE *yylocationp; -+#endif - { - YYUSE (yyvaluep); - YYUSE (yylocationp); -+ - if (!yymsg) - yymsg = "Deleting"; - YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); - -- YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN -- YYUSE (yytype); -- YY_IGNORE_MAYBE_UNINITIALIZED_END -+ switch (yytype) -+ { -+ -+ default: -+ break; -+ } - } - - -+/* Prevent warnings from -Wmissing-prototypes. */ -+#ifdef YYPARSE_PARAM -+#if defined __STDC__ || defined __cplusplus -+int yyparse (void *YYPARSE_PARAM); -+#else -+int yyparse (); -+#endif -+#else /* ! YYPARSE_PARAM */ -+#if defined __STDC__ || defined __cplusplus -+int yyparse (void); -+#else -+int yyparse (); -+#endif -+#endif /* ! YYPARSE_PARAM */ - - - /* The lookahead symbol. */ -@@ -1195,12 +1297,10 @@ int yychar; - - /* The semantic value of the lookahead symbol. */ - YYSTYPE yylval; -+ - /* Location data for the lookahead symbol. */ --YYLTYPE yylloc --# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL -- = { 1, 1, 1, 1 } --# endif --; -+YYLTYPE yylloc; -+ - /* Number of syntax errors so far. */ - int yynerrs; - -@@ -1209,19 +1309,38 @@ int yynerrs; - | yyparse. | - `----------*/ - -+#ifdef YYPARSE_PARAM -+#if (defined __STDC__ || defined __C99__FUNC__ \ -+ || defined __cplusplus || defined _MSC_VER) -+int -+yyparse (void *YYPARSE_PARAM) -+#else -+int -+yyparse (YYPARSE_PARAM) -+ void *YYPARSE_PARAM; -+#endif -+#else /* ! YYPARSE_PARAM */ -+#if (defined __STDC__ || defined __C99__FUNC__ \ -+ || defined __cplusplus || defined _MSC_VER) - int - yyparse (void) -+#else -+int -+yyparse () -+ -+#endif -+#endif - { - int yystate; - /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus; - - /* The stacks and their tools: -- 'yyss': related to states. -- 'yyvs': related to semantic values. -- 'yyls': related to locations. -+ `yyss': related to states. -+ `yyvs': related to semantic values. -+ `yyls': related to locations. - -- Refer to the stacks through separate pointers, to allow yyoverflow -+ Refer to the stacks thru separate pointers, to allow yyoverflow - to reallocate them elsewhere. */ - - /* The state stack. */ -@@ -1247,7 +1366,7 @@ yyparse (void) - int yyn; - int yyresult; - /* Lookahead token as an internal (translated) token number. */ -- int yytoken = 0; -+ int yytoken; - /* The variables used to return semantic value and location from the - action routines. */ - YYSTYPE yyval; -@@ -1266,9 +1385,10 @@ yyparse (void) - Keep to zero when no symbol should be popped. */ - int yylen = 0; - -- yyssp = yyss = yyssa; -- yyvsp = yyvs = yyvsa; -- yylsp = yyls = yylsa; -+ yytoken = 0; -+ yyss = yyssa; -+ yyvs = yyvsa; -+ yyls = yylsa; - yystacksize = YYINITDEPTH; - - YYDPRINTF ((stderr, "Starting parse\n")); -@@ -1277,7 +1397,21 @@ yyparse (void) - yyerrstatus = 0; - yynerrs = 0; - yychar = YYEMPTY; /* Cause a token to be read. */ -- yylsp[0] = yylloc; -+ -+ /* Initialize stack pointers. -+ Waste one element of value and location stack -+ so that they stay on the same level as the state stack. -+ The wasted elements are never initialized. */ -+ yyssp = yyss; -+ yyvsp = yyvs; -+ yylsp = yyls; -+ -+#if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL -+ /* Initialize the default location before parsing starts. */ -+ yylloc.first_line = yylloc.last_line = 1; -+ yylloc.first_column = yylloc.last_column = 1; -+#endif -+ - goto yysetstate; - - /*------------------------------------------------------------. -@@ -1298,26 +1432,26 @@ yyparse (void) - - #ifdef yyoverflow - { -- /* Give user a chance to reallocate the stack. Use copies of -- these so that the &'s don't force the real ones into -- memory. */ -- YYSTYPE *yyvs1 = yyvs; -- yytype_int16 *yyss1 = yyss; -- YYLTYPE *yyls1 = yyls; -- -- /* Each stack pointer address is followed by the size of the -- data in use in that stack, in bytes. This used to be a -- conditional around just the two extra args, but that might -- be undefined if yyoverflow is a macro. */ -- yyoverflow (YY_("memory exhausted"), -- &yyss1, yysize * sizeof (*yyssp), -- &yyvs1, yysize * sizeof (*yyvsp), -- &yyls1, yysize * sizeof (*yylsp), -- &yystacksize); -- -- yyls = yyls1; -- yyss = yyss1; -- yyvs = yyvs1; -+ /* Give user a chance to reallocate the stack. Use copies of -+ these so that the &'s don't force the real ones into -+ memory. */ -+ YYSTYPE *yyvs1 = yyvs; -+ yytype_int16 *yyss1 = yyss; -+ YYLTYPE *yyls1 = yyls; -+ -+ /* Each stack pointer address is followed by the size of the -+ data in use in that stack, in bytes. This used to be a -+ conditional around just the two extra args, but that might -+ be undefined if yyoverflow is a macro. */ -+ yyoverflow (YY_("memory exhausted"), -+ &yyss1, yysize * sizeof (*yyssp), -+ &yyvs1, yysize * sizeof (*yyvsp), -+ &yyls1, yysize * sizeof (*yylsp), -+ &yystacksize); -+ -+ yyls = yyls1; -+ yyss = yyss1; -+ yyvs = yyvs1; - } - #else /* no yyoverflow */ - # ifndef YYSTACK_RELOCATE -@@ -1325,23 +1459,23 @@ yyparse (void) - # else - /* Extend the stack our own way. */ - if (YYMAXDEPTH <= yystacksize) -- goto yyexhaustedlab; -+ goto yyexhaustedlab; - yystacksize *= 2; - if (YYMAXDEPTH < yystacksize) -- yystacksize = YYMAXDEPTH; -+ yystacksize = YYMAXDEPTH; - - { -- yytype_int16 *yyss1 = yyss; -- union yyalloc *yyptr = -- (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); -- if (! yyptr) -- goto yyexhaustedlab; -- YYSTACK_RELOCATE (yyss_alloc, yyss); -- YYSTACK_RELOCATE (yyvs_alloc, yyvs); -- YYSTACK_RELOCATE (yyls_alloc, yyls); -+ yytype_int16 *yyss1 = yyss; -+ union yyalloc *yyptr = -+ (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); -+ if (! yyptr) -+ goto yyexhaustedlab; -+ YYSTACK_RELOCATE (yyss_alloc, yyss); -+ YYSTACK_RELOCATE (yyvs_alloc, yyvs); -+ YYSTACK_RELOCATE (yyls_alloc, yyls); - # undef YYSTACK_RELOCATE -- if (yyss1 != yyssa) -- YYSTACK_FREE (yyss1); -+ if (yyss1 != yyssa) -+ YYSTACK_FREE (yyss1); - } - # endif - #endif /* no yyoverflow */ -@@ -1351,10 +1485,10 @@ yyparse (void) - yylsp = yyls + yysize - 1; - - YYDPRINTF ((stderr, "Stack size increased to %lu\n", -- (unsigned long int) yystacksize)); -+ (unsigned long int) yystacksize)); - - if (yyss + yystacksize - 1 <= yyssp) -- YYABORT; -+ YYABORT; - } - - YYDPRINTF ((stderr, "Entering state %d\n", yystate)); -@@ -1383,7 +1517,7 @@ yybackup: - if (yychar == YYEMPTY) - { - YYDPRINTF ((stderr, "Reading a token: ")); -- yychar = yylex (); -+ yychar = YYLEX; - } - - if (yychar <= YYEOF) -@@ -1423,9 +1557,7 @@ yybackup: - yychar = YYEMPTY; - - yystate = yyn; -- YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN - *++yyvsp = yylval; -- YY_IGNORE_MAYBE_UNINITIALIZED_END - *++yylsp = yylloc; - goto yynewstate; - -@@ -1448,7 +1580,7 @@ yyreduce: - yylen = yyr2[yyn]; - - /* If YYLEN is nonzero, implement the default value of the action: -- '$$ = $1'. -+ `$$ = $1'. - - Otherwise, the following line sets YYVAL to garbage. - This behavior is undocumented and Bison -@@ -1463,273 +1595,322 @@ yyreduce: - switch (yyn) - { - case 2: --#line 105 "dtc-parser.y" /* yacc.c:1646 */ -+ -+/* Line 1806 of yacc.c */ -+#line 109 "dtc-parser.y" - { -- the_boot_info = build_boot_info((yyvsp[-1].re), (yyvsp[0].node), -- guess_boot_cpuid((yyvsp[0].node))); -+ (yyvsp[(5) - (5)].node)->is_plugin = (yyvsp[(3) - (5)].is_plugin); -+ (yyvsp[(5) - (5)].node)->is_root = 1; -+ the_boot_info = build_boot_info((yyvsp[(4) - (5)].re), (yyvsp[(5) - (5)].node), -+ guess_boot_cpuid((yyvsp[(5) - (5)].node))); - } --#line 1472 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - - case 3: --#line 113 "dtc-parser.y" /* yacc.c:1646 */ -+ -+/* Line 1806 of yacc.c */ -+#line 119 "dtc-parser.y" - { -- (yyval.re) = NULL; -+ (yyval.is_plugin) = 0; - } --#line 1480 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - - case 4: --#line 117 "dtc-parser.y" /* yacc.c:1646 */ -+ -+/* Line 1806 of yacc.c */ -+#line 123 "dtc-parser.y" - { -- (yyval.re) = chain_reserve_entry((yyvsp[-1].re), (yyvsp[0].re)); -+ (yyval.is_plugin) = 1; - } --#line 1488 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - - case 5: --#line 124 "dtc-parser.y" /* yacc.c:1646 */ -+ -+/* Line 1806 of yacc.c */ -+#line 130 "dtc-parser.y" - { -- (yyval.re) = build_reserve_entry((yyvsp[-2].integer), (yyvsp[-1].integer)); -+ (yyval.re) = NULL; - } --#line 1496 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - - case 6: --#line 128 "dtc-parser.y" /* yacc.c:1646 */ -+ -+/* Line 1806 of yacc.c */ -+#line 134 "dtc-parser.y" - { -- add_label(&(yyvsp[0].re)->labels, (yyvsp[-1].labelref)); -- (yyval.re) = (yyvsp[0].re); -+ (yyval.re) = chain_reserve_entry((yyvsp[(1) - (2)].re), (yyvsp[(2) - (2)].re)); - } --#line 1505 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - - case 7: --#line 136 "dtc-parser.y" /* yacc.c:1646 */ -+ -+/* Line 1806 of yacc.c */ -+#line 141 "dtc-parser.y" - { -- (yyval.node) = name_node((yyvsp[0].node), ""); -+ (yyval.re) = build_reserve_entry((yyvsp[(2) - (4)].integer), (yyvsp[(3) - (4)].integer)); - } --#line 1513 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - - case 8: --#line 140 "dtc-parser.y" /* yacc.c:1646 */ -+ -+/* Line 1806 of yacc.c */ -+#line 145 "dtc-parser.y" - { -- (yyval.node) = merge_nodes((yyvsp[-2].node), (yyvsp[0].node)); -+ add_label(&(yyvsp[(2) - (2)].re)->labels, (yyvsp[(1) - (2)].labelref)); -+ (yyval.re) = (yyvsp[(2) - (2)].re); - } --#line 1521 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - - case 9: --#line 145 "dtc-parser.y" /* yacc.c:1646 */ -- { -- struct node *target = get_node_by_ref((yyvsp[-3].node), (yyvsp[-1].labelref)); - -- add_label(&target->labels, (yyvsp[-2].labelref)); -- if (target) -- merge_nodes(target, (yyvsp[0].node)); -- else -- ERROR(&(yylsp[-1]), "Label or path %s not found", (yyvsp[-1].labelref)); -- (yyval.node) = (yyvsp[-3].node); -+/* Line 1806 of yacc.c */ -+#line 153 "dtc-parser.y" -+ { -+ (yyval.node) = name_node((yyvsp[(2) - (2)].node), ""); - } --#line 1536 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - - case 10: --#line 156 "dtc-parser.y" /* yacc.c:1646 */ -- { -- struct node *target = get_node_by_ref((yyvsp[-2].node), (yyvsp[-1].labelref)); - -- if (target) -- merge_nodes(target, (yyvsp[0].node)); -- else -- ERROR(&(yylsp[-1]), "Label or path %s not found", (yyvsp[-1].labelref)); -- (yyval.node) = (yyvsp[-2].node); -+/* Line 1806 of yacc.c */ -+#line 157 "dtc-parser.y" -+ { -+ (yyval.node) = merge_nodes((yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); - } --#line 1550 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - - case 11: --#line 166 "dtc-parser.y" /* yacc.c:1646 */ -+ -+/* Line 1806 of yacc.c */ -+#line 162 "dtc-parser.y" - { -- struct node *target = get_node_by_ref((yyvsp[-3].node), (yyvsp[-1].labelref)); -+ struct node *target = get_node_by_ref((yyvsp[(1) - (4)].node), (yyvsp[(3) - (4)].labelref)); - -+ add_label(&target->labels, (yyvsp[(2) - (4)].labelref)); - if (target) -- delete_node(target); -+ merge_nodes(target, (yyvsp[(4) - (4)].node)); - else -- ERROR(&(yylsp[-1]), "Label or path %s not found", (yyvsp[-1].labelref)); -- -- -- (yyval.node) = (yyvsp[-3].node); -+ ERROR(&(yylsp[(3) - (4)]), "Label or path %s not found", (yyvsp[(3) - (4)].labelref)); -+ (yyval.node) = (yyvsp[(1) - (4)].node); - } --#line 1566 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - - case 12: --#line 181 "dtc-parser.y" /* yacc.c:1646 */ -+ -+/* Line 1806 of yacc.c */ -+#line 173 "dtc-parser.y" - { -- (yyval.node) = build_node((yyvsp[-3].proplist), (yyvsp[-2].nodelist)); -+ struct node *target = get_node_by_ref((yyvsp[(1) - (3)].node), (yyvsp[(2) - (3)].labelref)); -+ -+ if (target) -+ merge_nodes(target, (yyvsp[(3) - (3)].node)); -+ else -+ ERROR(&(yylsp[(2) - (3)]), "Label or path %s not found", (yyvsp[(2) - (3)].labelref)); -+ (yyval.node) = (yyvsp[(1) - (3)].node); - } --#line 1574 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - - case 13: --#line 188 "dtc-parser.y" /* yacc.c:1646 */ -+ -+/* Line 1806 of yacc.c */ -+#line 183 "dtc-parser.y" - { -- (yyval.proplist) = NULL; -+ struct node *target = get_node_by_ref((yyvsp[(1) - (4)].node), (yyvsp[(3) - (4)].labelref)); -+ -+ if (target) -+ delete_node(target); -+ else -+ ERROR(&(yylsp[(3) - (4)]), "Label or path %s not found", (yyvsp[(3) - (4)].labelref)); -+ -+ -+ (yyval.node) = (yyvsp[(1) - (4)].node); - } --#line 1582 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - - case 14: --#line 192 "dtc-parser.y" /* yacc.c:1646 */ -+ -+/* Line 1806 of yacc.c */ -+#line 198 "dtc-parser.y" - { -- (yyval.proplist) = chain_property((yyvsp[0].prop), (yyvsp[-1].proplist)); -+ (yyval.node) = build_node((yyvsp[(2) - (5)].proplist), (yyvsp[(3) - (5)].nodelist)); - } --#line 1590 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - - case 15: --#line 199 "dtc-parser.y" /* yacc.c:1646 */ -+ -+/* Line 1806 of yacc.c */ -+#line 205 "dtc-parser.y" - { -- (yyval.prop) = build_property((yyvsp[-3].propnodename), (yyvsp[-1].data)); -+ (yyval.proplist) = NULL; - } --#line 1598 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - - case 16: --#line 203 "dtc-parser.y" /* yacc.c:1646 */ -+ -+/* Line 1806 of yacc.c */ -+#line 209 "dtc-parser.y" - { -- (yyval.prop) = build_property((yyvsp[-1].propnodename), empty_data); -+ (yyval.proplist) = chain_property((yyvsp[(2) - (2)].prop), (yyvsp[(1) - (2)].proplist)); - } --#line 1606 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - - case 17: --#line 207 "dtc-parser.y" /* yacc.c:1646 */ -+ -+/* Line 1806 of yacc.c */ -+#line 216 "dtc-parser.y" - { -- (yyval.prop) = build_property_delete((yyvsp[-1].propnodename)); -+ (yyval.prop) = build_property((yyvsp[(1) - (4)].propnodename), (yyvsp[(3) - (4)].data)); - } --#line 1614 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - - case 18: --#line 211 "dtc-parser.y" /* yacc.c:1646 */ -+ -+/* Line 1806 of yacc.c */ -+#line 220 "dtc-parser.y" - { -- add_label(&(yyvsp[0].prop)->labels, (yyvsp[-1].labelref)); -- (yyval.prop) = (yyvsp[0].prop); -+ (yyval.prop) = build_property((yyvsp[(1) - (2)].propnodename), empty_data); - } --#line 1623 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - - case 19: --#line 219 "dtc-parser.y" /* yacc.c:1646 */ -+ -+/* Line 1806 of yacc.c */ -+#line 224 "dtc-parser.y" - { -- (yyval.data) = data_merge((yyvsp[-1].data), (yyvsp[0].data)); -+ (yyval.prop) = build_property_delete((yyvsp[(2) - (3)].propnodename)); - } --#line 1631 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - - case 20: --#line 223 "dtc-parser.y" /* yacc.c:1646 */ -+ -+/* Line 1806 of yacc.c */ -+#line 228 "dtc-parser.y" - { -- (yyval.data) = data_merge((yyvsp[-2].data), (yyvsp[-1].array).data); -+ add_label(&(yyvsp[(2) - (2)].prop)->labels, (yyvsp[(1) - (2)].labelref)); -+ (yyval.prop) = (yyvsp[(2) - (2)].prop); - } --#line 1639 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - - case 21: --#line 227 "dtc-parser.y" /* yacc.c:1646 */ -+ -+/* Line 1806 of yacc.c */ -+#line 236 "dtc-parser.y" - { -- (yyval.data) = data_merge((yyvsp[-3].data), (yyvsp[-1].data)); -+ (yyval.data) = data_merge((yyvsp[(1) - (2)].data), (yyvsp[(2) - (2)].data)); - } --#line 1647 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - - case 22: --#line 231 "dtc-parser.y" /* yacc.c:1646 */ -+ -+/* Line 1806 of yacc.c */ -+#line 240 "dtc-parser.y" - { -- (yyval.data) = data_add_marker((yyvsp[-1].data), REF_PATH, (yyvsp[0].labelref)); -+ (yyval.data) = data_merge((yyvsp[(1) - (3)].data), (yyvsp[(2) - (3)].array).data); - } --#line 1655 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - - case 23: --#line 235 "dtc-parser.y" /* yacc.c:1646 */ -+ -+/* Line 1806 of yacc.c */ -+#line 244 "dtc-parser.y" - { -- FILE *f = srcfile_relative_open((yyvsp[-5].data).val, NULL); -+ (yyval.data) = data_merge((yyvsp[(1) - (4)].data), (yyvsp[(3) - (4)].data)); -+ } -+ break; -+ -+ case 24: -+ -+/* Line 1806 of yacc.c */ -+#line 248 "dtc-parser.y" -+ { -+ (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), REF_PATH, (yyvsp[(2) - (2)].labelref)); -+ } -+ break; -+ -+ case 25: -+ -+/* Line 1806 of yacc.c */ -+#line 252 "dtc-parser.y" -+ { -+ FILE *f = srcfile_relative_open((yyvsp[(4) - (9)].data).val, NULL); - struct data d; - -- if ((yyvsp[-3].integer) != 0) -- if (fseek(f, (yyvsp[-3].integer), SEEK_SET) != 0) -+ if ((yyvsp[(6) - (9)].integer) != 0) -+ if (fseek(f, (yyvsp[(6) - (9)].integer), SEEK_SET) != 0) - die("Couldn't seek to offset %llu in \"%s\": %s", -- (unsigned long long)(yyvsp[-3].integer), (yyvsp[-5].data).val, -+ (unsigned long long)(yyvsp[(6) - (9)].integer), (yyvsp[(4) - (9)].data).val, - strerror(errno)); - -- d = data_copy_file(f, (yyvsp[-1].integer)); -+ d = data_copy_file(f, (yyvsp[(8) - (9)].integer)); - -- (yyval.data) = data_merge((yyvsp[-8].data), d); -+ (yyval.data) = data_merge((yyvsp[(1) - (9)].data), d); - fclose(f); - } --#line 1675 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 24: --#line 251 "dtc-parser.y" /* yacc.c:1646 */ -+ case 26: -+ -+/* Line 1806 of yacc.c */ -+#line 268 "dtc-parser.y" - { -- FILE *f = srcfile_relative_open((yyvsp[-1].data).val, NULL); -+ FILE *f = srcfile_relative_open((yyvsp[(4) - (5)].data).val, NULL); - struct data d = empty_data; - - d = data_copy_file(f, -1); - -- (yyval.data) = data_merge((yyvsp[-4].data), d); -+ (yyval.data) = data_merge((yyvsp[(1) - (5)].data), d); - fclose(f); - } --#line 1689 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 25: --#line 261 "dtc-parser.y" /* yacc.c:1646 */ -+ case 27: -+ -+/* Line 1806 of yacc.c */ -+#line 278 "dtc-parser.y" - { -- (yyval.data) = data_add_marker((yyvsp[-1].data), LABEL, (yyvsp[0].labelref)); -+ (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref)); - } --#line 1697 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 26: --#line 268 "dtc-parser.y" /* yacc.c:1646 */ -+ case 28: -+ -+/* Line 1806 of yacc.c */ -+#line 285 "dtc-parser.y" - { - (yyval.data) = empty_data; - } --#line 1705 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 27: --#line 272 "dtc-parser.y" /* yacc.c:1646 */ -+ case 29: -+ -+/* Line 1806 of yacc.c */ -+#line 289 "dtc-parser.y" - { -- (yyval.data) = (yyvsp[-1].data); -+ (yyval.data) = (yyvsp[(1) - (2)].data); - } --#line 1713 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 28: --#line 276 "dtc-parser.y" /* yacc.c:1646 */ -+ case 30: -+ -+/* Line 1806 of yacc.c */ -+#line 293 "dtc-parser.y" - { -- (yyval.data) = data_add_marker((yyvsp[-1].data), LABEL, (yyvsp[0].labelref)); -+ (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref)); - } --#line 1721 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 29: --#line 283 "dtc-parser.y" /* yacc.c:1646 */ -+ case 31: -+ -+/* Line 1806 of yacc.c */ -+#line 300 "dtc-parser.y" - { - unsigned long long bits; - -- bits = (yyvsp[-1].integer); -+ bits = (yyvsp[(2) - (3)].integer); - - if ((bits != 8) && (bits != 16) && - (bits != 32) && (bits != 64)) { -- ERROR(&(yylsp[-1]), "Array elements must be" -+ ERROR(&(yylsp[(2) - (3)]), "Array elements must be" - " 8, 16, 32 or 64-bits"); - bits = 32; - } -@@ -1737,23 +1918,25 @@ yyreduce: - (yyval.array).data = empty_data; - (yyval.array).bits = bits; - } --#line 1741 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 30: --#line 299 "dtc-parser.y" /* yacc.c:1646 */ -+ case 32: -+ -+/* Line 1806 of yacc.c */ -+#line 316 "dtc-parser.y" - { - (yyval.array).data = empty_data; - (yyval.array).bits = 32; - } --#line 1750 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 31: --#line 304 "dtc-parser.y" /* yacc.c:1646 */ -+ case 33: -+ -+/* Line 1806 of yacc.c */ -+#line 321 "dtc-parser.y" - { -- if ((yyvsp[-1].array).bits < 64) { -- uint64_t mask = (1ULL << (yyvsp[-1].array).bits) - 1; -+ if ((yyvsp[(1) - (2)].array).bits < 64) { -+ uint64_t mask = (1ULL << (yyvsp[(1) - (2)].array).bits) - 1; - /* - * Bits above mask must either be all zero - * (positive within range of mask) or all one -@@ -1762,258 +1945,293 @@ yyreduce: - * within the mask to one (i.e. | in the - * mask), all bits are one. - */ -- if (((yyvsp[0].integer) > mask) && (((yyvsp[0].integer) | mask) != -1ULL)) -- ERROR(&(yylsp[0]), "Value out of range for" -- " %d-bit array element", (yyvsp[-1].array).bits); -+ if (((yyvsp[(2) - (2)].integer) > mask) && (((yyvsp[(2) - (2)].integer) | mask) != -1ULL)) -+ ERROR(&(yylsp[(2) - (2)]), "Value out of range for" -+ " %d-bit array element", (yyvsp[(1) - (2)].array).bits); - } - -- (yyval.array).data = data_append_integer((yyvsp[-1].array).data, (yyvsp[0].integer), (yyvsp[-1].array).bits); -+ (yyval.array).data = data_append_integer((yyvsp[(1) - (2)].array).data, (yyvsp[(2) - (2)].integer), (yyvsp[(1) - (2)].array).bits); - } --#line 1773 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 32: --#line 323 "dtc-parser.y" /* yacc.c:1646 */ -+ case 34: -+ -+/* Line 1806 of yacc.c */ -+#line 340 "dtc-parser.y" - { -- uint64_t val = ~0ULL >> (64 - (yyvsp[-1].array).bits); -+ uint64_t val = ~0ULL >> (64 - (yyvsp[(1) - (2)].array).bits); - -- if ((yyvsp[-1].array).bits == 32) -- (yyvsp[-1].array).data = data_add_marker((yyvsp[-1].array).data, -+ if ((yyvsp[(1) - (2)].array).bits == 32) -+ (yyvsp[(1) - (2)].array).data = data_add_marker((yyvsp[(1) - (2)].array).data, - REF_PHANDLE, -- (yyvsp[0].labelref)); -+ (yyvsp[(2) - (2)].labelref)); - else -- ERROR(&(yylsp[0]), "References are only allowed in " -+ ERROR(&(yylsp[(2) - (2)]), "References are only allowed in " - "arrays with 32-bit elements."); - -- (yyval.array).data = data_append_integer((yyvsp[-1].array).data, val, (yyvsp[-1].array).bits); -+ (yyval.array).data = data_append_integer((yyvsp[(1) - (2)].array).data, val, (yyvsp[(1) - (2)].array).bits); - } --#line 1791 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 33: --#line 337 "dtc-parser.y" /* yacc.c:1646 */ -+ case 35: -+ -+/* Line 1806 of yacc.c */ -+#line 354 "dtc-parser.y" - { -- (yyval.array).data = data_add_marker((yyvsp[-1].array).data, LABEL, (yyvsp[0].labelref)); -+ (yyval.array).data = data_add_marker((yyvsp[(1) - (2)].array).data, LABEL, (yyvsp[(2) - (2)].labelref)); - } --#line 1799 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 36: --#line 346 "dtc-parser.y" /* yacc.c:1646 */ -+ case 38: -+ -+/* Line 1806 of yacc.c */ -+#line 363 "dtc-parser.y" - { -- (yyval.integer) = (yyvsp[-1].integer); -+ (yyval.integer) = (yyvsp[(2) - (3)].integer); - } --#line 1807 "dtc-parser.tab.c" /* yacc.c:1646 */ -- break; -- -- case 39: --#line 357 "dtc-parser.y" /* yacc.c:1646 */ -- { (yyval.integer) = (yyvsp[-4].integer) ? (yyvsp[-2].integer) : (yyvsp[0].integer); } --#line 1813 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - - case 41: --#line 362 "dtc-parser.y" /* yacc.c:1646 */ -- { (yyval.integer) = (yyvsp[-2].integer) || (yyvsp[0].integer); } --#line 1819 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ -+/* Line 1806 of yacc.c */ -+#line 374 "dtc-parser.y" -+ { (yyval.integer) = (yyvsp[(1) - (5)].integer) ? (yyvsp[(3) - (5)].integer) : (yyvsp[(5) - (5)].integer); } - break; - - case 43: --#line 367 "dtc-parser.y" /* yacc.c:1646 */ -- { (yyval.integer) = (yyvsp[-2].integer) && (yyvsp[0].integer); } --#line 1825 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ -+/* Line 1806 of yacc.c */ -+#line 379 "dtc-parser.y" -+ { (yyval.integer) = (yyvsp[(1) - (3)].integer) || (yyvsp[(3) - (3)].integer); } - break; - - case 45: --#line 372 "dtc-parser.y" /* yacc.c:1646 */ -- { (yyval.integer) = (yyvsp[-2].integer) | (yyvsp[0].integer); } --#line 1831 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ -+/* Line 1806 of yacc.c */ -+#line 384 "dtc-parser.y" -+ { (yyval.integer) = (yyvsp[(1) - (3)].integer) && (yyvsp[(3) - (3)].integer); } - break; - - case 47: --#line 377 "dtc-parser.y" /* yacc.c:1646 */ -- { (yyval.integer) = (yyvsp[-2].integer) ^ (yyvsp[0].integer); } --#line 1837 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ -+/* Line 1806 of yacc.c */ -+#line 389 "dtc-parser.y" -+ { (yyval.integer) = (yyvsp[(1) - (3)].integer) | (yyvsp[(3) - (3)].integer); } - break; - - case 49: --#line 382 "dtc-parser.y" /* yacc.c:1646 */ -- { (yyval.integer) = (yyvsp[-2].integer) & (yyvsp[0].integer); } --#line 1843 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ -+/* Line 1806 of yacc.c */ -+#line 394 "dtc-parser.y" -+ { (yyval.integer) = (yyvsp[(1) - (3)].integer) ^ (yyvsp[(3) - (3)].integer); } - break; - - case 51: --#line 387 "dtc-parser.y" /* yacc.c:1646 */ -- { (yyval.integer) = (yyvsp[-2].integer) == (yyvsp[0].integer); } --#line 1849 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ -+/* Line 1806 of yacc.c */ -+#line 399 "dtc-parser.y" -+ { (yyval.integer) = (yyvsp[(1) - (3)].integer) & (yyvsp[(3) - (3)].integer); } - break; - -- case 52: --#line 388 "dtc-parser.y" /* yacc.c:1646 */ -- { (yyval.integer) = (yyvsp[-2].integer) != (yyvsp[0].integer); } --#line 1855 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ case 53: -+ -+/* Line 1806 of yacc.c */ -+#line 404 "dtc-parser.y" -+ { (yyval.integer) = (yyvsp[(1) - (3)].integer) == (yyvsp[(3) - (3)].integer); } - break; - - case 54: --#line 393 "dtc-parser.y" /* yacc.c:1646 */ -- { (yyval.integer) = (yyvsp[-2].integer) < (yyvsp[0].integer); } --#line 1861 "dtc-parser.tab.c" /* yacc.c:1646 */ -- break; - -- case 55: --#line 394 "dtc-parser.y" /* yacc.c:1646 */ -- { (yyval.integer) = (yyvsp[-2].integer) > (yyvsp[0].integer); } --#line 1867 "dtc-parser.tab.c" /* yacc.c:1646 */ -+/* Line 1806 of yacc.c */ -+#line 405 "dtc-parser.y" -+ { (yyval.integer) = (yyvsp[(1) - (3)].integer) != (yyvsp[(3) - (3)].integer); } - break; - - case 56: --#line 395 "dtc-parser.y" /* yacc.c:1646 */ -- { (yyval.integer) = (yyvsp[-2].integer) <= (yyvsp[0].integer); } --#line 1873 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ -+/* Line 1806 of yacc.c */ -+#line 410 "dtc-parser.y" -+ { (yyval.integer) = (yyvsp[(1) - (3)].integer) < (yyvsp[(3) - (3)].integer); } - break; - - case 57: --#line 396 "dtc-parser.y" /* yacc.c:1646 */ -- { (yyval.integer) = (yyvsp[-2].integer) >= (yyvsp[0].integer); } --#line 1879 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ -+/* Line 1806 of yacc.c */ -+#line 411 "dtc-parser.y" -+ { (yyval.integer) = (yyvsp[(1) - (3)].integer) > (yyvsp[(3) - (3)].integer); } - break; - - case 58: --#line 400 "dtc-parser.y" /* yacc.c:1646 */ -- { (yyval.integer) = (yyvsp[-2].integer) << (yyvsp[0].integer); } --#line 1885 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ -+/* Line 1806 of yacc.c */ -+#line 412 "dtc-parser.y" -+ { (yyval.integer) = (yyvsp[(1) - (3)].integer) <= (yyvsp[(3) - (3)].integer); } - break; - - case 59: --#line 401 "dtc-parser.y" /* yacc.c:1646 */ -- { (yyval.integer) = (yyvsp[-2].integer) >> (yyvsp[0].integer); } --#line 1891 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ -+/* Line 1806 of yacc.c */ -+#line 413 "dtc-parser.y" -+ { (yyval.integer) = (yyvsp[(1) - (3)].integer) >= (yyvsp[(3) - (3)].integer); } -+ break; -+ -+ case 60: -+ -+/* Line 1806 of yacc.c */ -+#line 417 "dtc-parser.y" -+ { (yyval.integer) = (yyvsp[(1) - (3)].integer) << (yyvsp[(3) - (3)].integer); } - break; - - case 61: --#line 406 "dtc-parser.y" /* yacc.c:1646 */ -- { (yyval.integer) = (yyvsp[-2].integer) + (yyvsp[0].integer); } --#line 1897 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ -+/* Line 1806 of yacc.c */ -+#line 418 "dtc-parser.y" -+ { (yyval.integer) = (yyvsp[(1) - (3)].integer) >> (yyvsp[(3) - (3)].integer); } - break; - -- case 62: --#line 407 "dtc-parser.y" /* yacc.c:1646 */ -- { (yyval.integer) = (yyvsp[-2].integer) - (yyvsp[0].integer); } --#line 1903 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ case 63: -+ -+/* Line 1806 of yacc.c */ -+#line 423 "dtc-parser.y" -+ { (yyval.integer) = (yyvsp[(1) - (3)].integer) + (yyvsp[(3) - (3)].integer); } - break; - - case 64: --#line 412 "dtc-parser.y" /* yacc.c:1646 */ -- { (yyval.integer) = (yyvsp[-2].integer) * (yyvsp[0].integer); } --#line 1909 "dtc-parser.tab.c" /* yacc.c:1646 */ -- break; - -- case 65: --#line 413 "dtc-parser.y" /* yacc.c:1646 */ -- { (yyval.integer) = (yyvsp[-2].integer) / (yyvsp[0].integer); } --#line 1915 "dtc-parser.tab.c" /* yacc.c:1646 */ -+/* Line 1806 of yacc.c */ -+#line 424 "dtc-parser.y" -+ { (yyval.integer) = (yyvsp[(1) - (3)].integer) - (yyvsp[(3) - (3)].integer); } - break; - - case 66: --#line 414 "dtc-parser.y" /* yacc.c:1646 */ -- { (yyval.integer) = (yyvsp[-2].integer) % (yyvsp[0].integer); } --#line 1921 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ -+/* Line 1806 of yacc.c */ -+#line 429 "dtc-parser.y" -+ { (yyval.integer) = (yyvsp[(1) - (3)].integer) * (yyvsp[(3) - (3)].integer); } - break; - -- case 69: --#line 420 "dtc-parser.y" /* yacc.c:1646 */ -- { (yyval.integer) = -(yyvsp[0].integer); } --#line 1927 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ case 67: -+ -+/* Line 1806 of yacc.c */ -+#line 430 "dtc-parser.y" -+ { (yyval.integer) = (yyvsp[(1) - (3)].integer) / (yyvsp[(3) - (3)].integer); } - break; - -- case 70: --#line 421 "dtc-parser.y" /* yacc.c:1646 */ -- { (yyval.integer) = ~(yyvsp[0].integer); } --#line 1933 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ case 68: -+ -+/* Line 1806 of yacc.c */ -+#line 431 "dtc-parser.y" -+ { (yyval.integer) = (yyvsp[(1) - (3)].integer) % (yyvsp[(3) - (3)].integer); } - break; - - case 71: --#line 422 "dtc-parser.y" /* yacc.c:1646 */ -- { (yyval.integer) = !(yyvsp[0].integer); } --#line 1939 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ -+/* Line 1806 of yacc.c */ -+#line 437 "dtc-parser.y" -+ { (yyval.integer) = -(yyvsp[(2) - (2)].integer); } - break; - - case 72: --#line 427 "dtc-parser.y" /* yacc.c:1646 */ -- { -- (yyval.data) = empty_data; -- } --#line 1947 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ -+/* Line 1806 of yacc.c */ -+#line 438 "dtc-parser.y" -+ { (yyval.integer) = ~(yyvsp[(2) - (2)].integer); } - break; - - case 73: --#line 431 "dtc-parser.y" /* yacc.c:1646 */ -- { -- (yyval.data) = data_append_byte((yyvsp[-1].data), (yyvsp[0].byte)); -- } --#line 1955 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ -+/* Line 1806 of yacc.c */ -+#line 439 "dtc-parser.y" -+ { (yyval.integer) = !(yyvsp[(2) - (2)].integer); } - break; - - case 74: --#line 435 "dtc-parser.y" /* yacc.c:1646 */ -+ -+/* Line 1806 of yacc.c */ -+#line 444 "dtc-parser.y" - { -- (yyval.data) = data_add_marker((yyvsp[-1].data), LABEL, (yyvsp[0].labelref)); -+ (yyval.data) = empty_data; - } --#line 1963 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - - case 75: --#line 442 "dtc-parser.y" /* yacc.c:1646 */ -+ -+/* Line 1806 of yacc.c */ -+#line 448 "dtc-parser.y" - { -- (yyval.nodelist) = NULL; -+ (yyval.data) = data_append_byte((yyvsp[(1) - (2)].data), (yyvsp[(2) - (2)].byte)); - } --#line 1971 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - - case 76: --#line 446 "dtc-parser.y" /* yacc.c:1646 */ -+ -+/* Line 1806 of yacc.c */ -+#line 452 "dtc-parser.y" - { -- (yyval.nodelist) = chain_node((yyvsp[-1].node), (yyvsp[0].nodelist)); -+ (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref)); - } --#line 1979 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - - case 77: --#line 450 "dtc-parser.y" /* yacc.c:1646 */ -+ -+/* Line 1806 of yacc.c */ -+#line 459 "dtc-parser.y" - { -- ERROR(&(yylsp[0]), "Properties must precede subnodes"); -- YYERROR; -+ (yyval.nodelist) = NULL; - } --#line 1988 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - - case 78: --#line 458 "dtc-parser.y" /* yacc.c:1646 */ -+ -+/* Line 1806 of yacc.c */ -+#line 463 "dtc-parser.y" - { -- (yyval.node) = name_node((yyvsp[0].node), (yyvsp[-1].propnodename)); -+ (yyval.nodelist) = chain_node((yyvsp[(1) - (2)].node), (yyvsp[(2) - (2)].nodelist)); - } --#line 1996 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - - case 79: --#line 462 "dtc-parser.y" /* yacc.c:1646 */ -+ -+/* Line 1806 of yacc.c */ -+#line 467 "dtc-parser.y" - { -- (yyval.node) = name_node(build_node_delete(), (yyvsp[-1].propnodename)); -+ ERROR(&(yylsp[(2) - (2)]), "Properties must precede subnodes"); -+ YYERROR; - } --#line 2004 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - - case 80: --#line 466 "dtc-parser.y" /* yacc.c:1646 */ -+ -+/* Line 1806 of yacc.c */ -+#line 475 "dtc-parser.y" - { -- add_label(&(yyvsp[0].node)->labels, (yyvsp[-1].labelref)); -- (yyval.node) = (yyvsp[0].node); -+ (yyval.node) = name_node((yyvsp[(2) - (2)].node), (yyvsp[(1) - (2)].propnodename)); - } --#line 2013 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -+ case 81: - --#line 2017 "dtc-parser.tab.c" /* yacc.c:1646 */ -+/* Line 1806 of yacc.c */ -+#line 479 "dtc-parser.y" -+ { -+ (yyval.node) = name_node(build_node_delete(), (yyvsp[(2) - (3)].propnodename)); -+ } -+ break; -+ -+ case 82: -+ -+/* Line 1806 of yacc.c */ -+#line 483 "dtc-parser.y" -+ { -+ add_label(&(yyvsp[(2) - (2)].node)->labels, (yyvsp[(1) - (2)].labelref)); -+ (yyval.node) = (yyvsp[(2) - (2)].node); -+ } -+ break; -+ -+ -+ -+/* Line 1806 of yacc.c */ -+#line 2235 "dtc-parser.tab.c" - default: break; - } - /* User semantic actions sometimes alter yychar, and that requires -@@ -2036,7 +2254,7 @@ yyreduce: - *++yyvsp = yyval; - *++yylsp = yyloc; - -- /* Now 'shift' the result of the reduction. Determine what state -+ /* Now `shift' the result of the reduction. Determine what state - that goes to, based on the state we popped back to and the rule - number reduced by. */ - -@@ -2051,9 +2269,9 @@ yyreduce: - goto yynewstate; - - --/*--------------------------------------. --| yyerrlab -- here on detecting error. | --`--------------------------------------*/ -+/*------------------------------------. -+| yyerrlab -- here on detecting error | -+`------------------------------------*/ - yyerrlab: - /* Make sure we have latest lookahead translation. See comments at - user semantic actions for why this is necessary. */ -@@ -2104,20 +2322,20 @@ yyerrlab: - if (yyerrstatus == 3) - { - /* If just tried and failed to reuse lookahead token after an -- error, discard it. */ -+ error, discard it. */ - - if (yychar <= YYEOF) -- { -- /* Return failure if at end of input. */ -- if (yychar == YYEOF) -- YYABORT; -- } -+ { -+ /* Return failure if at end of input. */ -+ if (yychar == YYEOF) -+ YYABORT; -+ } - else -- { -- yydestruct ("Error: discarding", -- yytoken, &yylval, &yylloc); -- yychar = YYEMPTY; -- } -+ { -+ yydestruct ("Error: discarding", -+ yytoken, &yylval, &yylloc); -+ yychar = YYEMPTY; -+ } - } - - /* Else will try to reuse lookahead token after shifting the error -@@ -2137,7 +2355,7 @@ yyerrorlab: - goto yyerrorlab; - - yyerror_range[1] = yylsp[1-yylen]; -- /* Do not reclaim the symbols of the rule whose action triggered -+ /* Do not reclaim the symbols of the rule which action triggered - this YYERROR. */ - YYPOPSTACK (yylen); - yylen = 0; -@@ -2150,37 +2368,35 @@ yyerrorlab: - | yyerrlab1 -- common code for both syntax error and YYERROR. | - `-------------------------------------------------------------*/ - yyerrlab1: -- yyerrstatus = 3; /* Each real token shifted decrements this. */ -+ yyerrstatus = 3; /* Each real token shifted decrements this. */ - - for (;;) - { - yyn = yypact[yystate]; - if (!yypact_value_is_default (yyn)) -- { -- yyn += YYTERROR; -- if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) -- { -- yyn = yytable[yyn]; -- if (0 < yyn) -- break; -- } -- } -+ { -+ yyn += YYTERROR; -+ if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) -+ { -+ yyn = yytable[yyn]; -+ if (0 < yyn) -+ break; -+ } -+ } - - /* Pop the current state because it cannot handle the error token. */ - if (yyssp == yyss) -- YYABORT; -+ YYABORT; - - yyerror_range[1] = *yylsp; - yydestruct ("Error: popping", -- yystos[yystate], yyvsp, yylsp); -+ yystos[yystate], yyvsp, yylsp); - YYPOPSTACK (1); - yystate = *yyssp; - YY_STACK_PRINT (yyss, yyssp); - } - -- YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN - *++yyvsp = yylval; -- YY_IGNORE_MAYBE_UNINITIALIZED_END - - yyerror_range[2] = yylloc; - /* Using YYLLOC is tempting, but would change the location of -@@ -2209,7 +2425,7 @@ yyabortlab: - yyresult = 1; - goto yyreturn; - --#if !defined yyoverflow || YYERROR_VERBOSE -+#if !defined(yyoverflow) || YYERROR_VERBOSE - /*-------------------------------------------------. - | yyexhaustedlab -- memory exhaustion comes here. | - `-------------------------------------------------*/ -@@ -2228,14 +2444,14 @@ yyreturn: - yydestruct ("Cleanup: discarding lookahead", - yytoken, &yylval, &yylloc); - } -- /* Do not reclaim the symbols of the rule whose action triggered -+ /* Do not reclaim the symbols of the rule which action triggered - this YYABORT or YYACCEPT. */ - YYPOPSTACK (yylen); - YY_STACK_PRINT (yyss, yyssp); - while (yyssp != yyss) - { - yydestruct ("Cleanup: popping", -- yystos[*yyssp], yyvsp, yylsp); -+ yystos[*yyssp], yyvsp, yylsp); - YYPOPSTACK (1); - } - #ifndef yyoverflow -@@ -2246,12 +2462,18 @@ yyreturn: - if (yymsg != yymsgbuf) - YYSTACK_FREE (yymsg); - #endif -- return yyresult; -+ /* Make sure YYID is used. */ -+ return YYID (yyresult); - } --#line 472 "dtc-parser.y" /* yacc.c:1906 */ -+ -+ -+ -+/* Line 2067 of yacc.c */ -+#line 489 "dtc-parser.y" - - - void yyerror(char const *s) - { - ERROR(&yylloc, "%s", s); - } -+ -diff --git a/scripts/dtc/dtc-parser.tab.h_shipped b/scripts/dtc/dtc-parser.tab.h_shipped -index 30867c6..0b22bbb 100644 ---- a/scripts/dtc/dtc-parser.tab.h_shipped -+++ b/scripts/dtc/dtc-parser.tab.h_shipped -@@ -1,19 +1,19 @@ --/* A Bison parser, made by GNU Bison 3.0.2. */ -+/* A Bison parser, made by GNU Bison 2.5. */ - - /* Bison interface for Yacc-like parsers in C -- -- Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. -- -+ -+ Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc. -+ - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. -- -+ - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. -- -+ - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -@@ -26,55 +26,50 @@ - special exception, which will cause the skeleton and the resulting - Bison output files to be licensed under the GNU General Public - License without this special exception. -- -+ - This special exception was added by the Free Software Foundation in - version 2.2 of Bison. */ - --#ifndef YY_YY_DTC_PARSER_TAB_H_INCLUDED --# define YY_YY_DTC_PARSER_TAB_H_INCLUDED --/* Debug traces. */ --#ifndef YYDEBUG --# define YYDEBUG 0 --#endif --#if YYDEBUG --extern int yydebug; --#endif - --/* Token type. */ -+/* Tokens. */ - #ifndef YYTOKENTYPE - # define YYTOKENTYPE -- enum yytokentype -- { -- DT_V1 = 258, -- DT_MEMRESERVE = 259, -- DT_LSHIFT = 260, -- DT_RSHIFT = 261, -- DT_LE = 262, -- DT_GE = 263, -- DT_EQ = 264, -- DT_NE = 265, -- DT_AND = 266, -- DT_OR = 267, -- DT_BITS = 268, -- DT_DEL_PROP = 269, -- DT_DEL_NODE = 270, -- DT_PROPNODENAME = 271, -- DT_LITERAL = 272, -- DT_CHAR_LITERAL = 273, -- DT_BYTE = 274, -- DT_STRING = 275, -- DT_LABEL = 276, -- DT_REF = 277, -- DT_INCBIN = 278 -- }; -+ /* Put the tokens into the symbol table, so that GDB and other debuggers -+ know about them. */ -+ enum yytokentype { -+ DT_V1 = 258, -+ DT_PLUGIN = 259, -+ DT_MEMRESERVE = 260, -+ DT_LSHIFT = 261, -+ DT_RSHIFT = 262, -+ DT_LE = 263, -+ DT_GE = 264, -+ DT_EQ = 265, -+ DT_NE = 266, -+ DT_AND = 267, -+ DT_OR = 268, -+ DT_BITS = 269, -+ DT_DEL_PROP = 270, -+ DT_DEL_NODE = 271, -+ DT_PROPNODENAME = 272, -+ DT_LITERAL = 273, -+ DT_CHAR_LITERAL = 274, -+ DT_BYTE = 275, -+ DT_STRING = 276, -+ DT_LABEL = 277, -+ DT_REF = 278, -+ DT_INCBIN = 279 -+ }; - #endif - --/* Value type. */ -+ -+ - #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED --typedef union YYSTYPE YYSTYPE; --union YYSTYPE -+typedef union YYSTYPE - { --#line 38 "dtc-parser.y" /* yacc.c:1909 */ -+ -+/* Line 2068 of yacc.c */ -+#line 39 "dtc-parser.y" - - char *propnodename; - char *labelref; -@@ -92,30 +87,32 @@ union YYSTYPE - struct node *nodelist; - struct reserve_info *re; - uint64_t integer; -+ int is_plugin; -+ -+ - --#line 97 "dtc-parser.tab.h" /* yacc.c:1909 */ --}; -+/* Line 2068 of yacc.c */ -+#line 96 "dtc-parser.tab.h" -+} YYSTYPE; - # define YYSTYPE_IS_TRIVIAL 1 -+# define yystype YYSTYPE /* obsolescent; will be withdrawn */ - # define YYSTYPE_IS_DECLARED 1 - #endif - --/* Location type. */ -+extern YYSTYPE yylval; -+ - #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED --typedef struct YYLTYPE YYLTYPE; --struct YYLTYPE -+typedef struct YYLTYPE - { - int first_line; - int first_column; - int last_line; - int last_column; --}; -+} YYLTYPE; -+# define yyltype YYLTYPE /* obsolescent; will be withdrawn */ - # define YYLTYPE_IS_DECLARED 1 - # define YYLTYPE_IS_TRIVIAL 1 - #endif - -- --extern YYSTYPE yylval; - extern YYLTYPE yylloc; --int yyparse (void); - --#endif /* !YY_YY_DTC_PARSER_TAB_H_INCLUDED */ -diff --git a/scripts/dtc/dtc-parser.y b/scripts/dtc/dtc-parser.y -index 5a897e3..56b9c15 100644 ---- a/scripts/dtc/dtc-parser.y -+++ b/scripts/dtc/dtc-parser.y -@@ -19,6 +19,7 @@ - */ - %{ - #include <stdio.h> -+#include <inttypes.h> - - #include "dtc.h" - #include "srcpos.h" -@@ -52,9 +53,11 @@ extern bool treesource_error; - struct node *nodelist; - struct reserve_info *re; - uint64_t integer; -+ int is_plugin; - } - - %token DT_V1 -+%token DT_PLUGIN - %token DT_MEMRESERVE - %token DT_LSHIFT DT_RSHIFT DT_LE DT_GE DT_EQ DT_NE DT_AND DT_OR - %token DT_BITS -@@ -71,6 +74,7 @@ extern bool treesource_error; - - %type <data> propdata - %type <data> propdataprefix -+%type <is_plugin> plugindecl - %type <re> memreserve - %type <re> memreserves - %type <array> arrayprefix -@@ -101,10 +105,23 @@ extern bool treesource_error; - %% - - sourcefile: -- DT_V1 ';' memreserves devicetree -+ DT_V1 ';' plugindecl memreserves devicetree - { -- the_boot_info = build_boot_info($3, $4, -- guess_boot_cpuid($4)); -+ $5->is_plugin = $3; -+ $5->is_root = 1; -+ the_boot_info = build_boot_info($4, $5, -+ guess_boot_cpuid($5)); -+ } -+ ; -+ -+plugindecl: -+ /* empty */ -+ { -+ $$ = 0; -+ } -+ | DT_PLUGIN ';' -+ { -+ $$ = 1; - } - ; - -diff --git a/scripts/dtc/dtc.c b/scripts/dtc/dtc.c -index 8c4add6..0cbb14c 100644 ---- a/scripts/dtc/dtc.c -+++ b/scripts/dtc/dtc.c -@@ -29,6 +29,7 @@ int reservenum; /* Number of memory reservation slots */ - int minsize; /* Minimum blob size */ - int padsize; /* Additional padding to blob */ - int phandle_format = PHANDLE_BOTH; /* Use linux,phandle or phandle properties */ -+int symbol_fixup_support = 0; - - static void fill_fullpaths(struct node *tree, const char *prefix) - { -@@ -51,7 +52,7 @@ static void fill_fullpaths(struct node *tree, const char *prefix) - #define FDT_VERSION(version) _FDT_VERSION(version) - #define _FDT_VERSION(version) #version - static const char usage_synopsis[] = "dtc [options] <input file>"; --static const char usage_short_opts[] = "qI:O:o:V:d:R:S:p:fb:i:H:sW:E:hv"; -+static const char usage_short_opts[] = "qI:O:o:V:d:R:S:p:fb:i:H:sW:E:hv@"; - static struct option const usage_long_opts[] = { - {"quiet", no_argument, NULL, 'q'}, - {"in-format", a_argument, NULL, 'I'}, -@@ -69,6 +70,7 @@ static struct option const usage_long_opts[] = { - {"phandle", a_argument, NULL, 'H'}, - {"warning", a_argument, NULL, 'W'}, - {"error", a_argument, NULL, 'E'}, -+ {"symbols", a_argument, NULL, '@'}, - {"help", no_argument, NULL, 'h'}, - {"version", no_argument, NULL, 'v'}, - {NULL, no_argument, NULL, 0x0}, -@@ -99,6 +101,7 @@ static const char * const usage_opts_help[] = { - "\t\tboth - Both \"linux,phandle\" and \"phandle\" properties", - "\n\tEnable/disable warnings (prefix with \"no-\")", - "\n\tEnable/disable errors (prefix with \"no-\")", -+ "\n\tSymbols and Fixups support", - "\n\tPrint this help and exit", - "\n\tPrint version and exit", - NULL, -@@ -186,7 +189,9 @@ int main(int argc, char *argv[]) - case 'E': - parse_checks_option(false, true, optarg); - break; -- -+ case '@': -+ symbol_fixup_support = 1; -+ break; - case 'h': - usage(NULL); - default: -diff --git a/scripts/dtc/dtc.h b/scripts/dtc/dtc.h -index 56212c8..fe45748 100644 ---- a/scripts/dtc/dtc.h -+++ b/scripts/dtc/dtc.h -@@ -54,6 +54,7 @@ extern int reservenum; /* Number of memory reservation slots */ - extern int minsize; /* Minimum blob size */ - extern int padsize; /* Additional padding to blob */ - extern int phandle_format; /* Use linux,phandle or phandle properties */ -+extern int symbol_fixup_support;/* enable symbols & fixup support */ - - #define PHANDLE_LEGACY 0x1 - #define PHANDLE_EPAPR 0x2 -@@ -132,6 +133,25 @@ struct label { - struct label *next; - }; - -+struct fixup_entry { -+ int offset; -+ struct node *node; -+ struct property *prop; -+ struct fixup_entry *next; -+}; -+ -+struct fixup { -+ char *ref; -+ struct fixup_entry *entries; -+ struct fixup *next; -+}; -+ -+struct symbol { -+ struct label *label; -+ struct node *node; -+ struct symbol *next; -+}; -+ - struct property { - bool deleted; - char *name; -@@ -158,6 +178,12 @@ struct node { - int addr_cells, size_cells; - - struct label *labels; -+ -+ int is_root; -+ int is_plugin; -+ struct fixup *fixups; -+ struct symbol *symbols; -+ struct fixup_entry *local_fixups; - }; - - #define for_each_label_withdel(l0, l) \ -@@ -181,6 +207,18 @@ struct node { - for_each_child_withdel(n, c) \ - if (!(c)->deleted) - -+#define for_each_fixup(n, f) \ -+ for ((f) = (n)->fixups; (f); (f) = (f)->next) -+ -+#define for_each_fixup_entry(f, fe) \ -+ for ((fe) = (f)->entries; (fe); (fe) = (fe)->next) -+ -+#define for_each_symbol(n, s) \ -+ for ((s) = (n)->symbols; (s); (s) = (s)->next) -+ -+#define for_each_local_fixup_entry(n, fe) \ -+ for ((fe) = (n)->local_fixups; (fe); (fe) = (fe)->next) -+ - void add_label(struct label **labels, char *label); - void delete_labels(struct label **labels); - -diff --git a/scripts/dtc/flattree.c b/scripts/dtc/flattree.c -index bd99fa2..f439b40 100644 ---- a/scripts/dtc/flattree.c -+++ b/scripts/dtc/flattree.c -@@ -262,6 +262,12 @@ static void flatten_tree(struct node *tree, struct emitter *emit, - struct property *prop; - struct node *child; - bool seen_name_prop = false; -+ struct symbol *sym; -+ struct fixup *f; -+ struct fixup_entry *fe; -+ char *name, *s; -+ const char *fullpath; -+ int namesz, nameoff, vallen; - - if (tree->deleted) - return; -@@ -276,8 +282,6 @@ static void flatten_tree(struct node *tree, struct emitter *emit, - emit->align(etarget, sizeof(cell_t)); - - for_each_property(tree, prop) { -- int nameoff; -- - if (streq(prop->name, "name")) - seen_name_prop = true; - -@@ -310,6 +314,139 @@ static void flatten_tree(struct node *tree, struct emitter *emit, - flatten_tree(child, emit, etarget, strbuf, vi); - } - -+ if (!symbol_fixup_support) -+ goto no_symbols; -+ -+ /* add the symbol nodes (if any) */ -+ if (tree->symbols) { -+ -+ emit->beginnode(etarget, NULL); -+ emit->string(etarget, "__symbols__", 0); -+ emit->align(etarget, sizeof(cell_t)); -+ -+ for_each_symbol(tree, sym) { -+ -+ vallen = strlen(sym->node->fullpath); -+ -+ nameoff = stringtable_insert(strbuf, sym->label->label); -+ -+ emit->property(etarget, NULL); -+ emit->cell(etarget, vallen + 1); -+ emit->cell(etarget, nameoff); -+ -+ if ((vi->flags & FTF_VARALIGN) && vallen >= 8) -+ emit->align(etarget, 8); -+ -+ emit->string(etarget, sym->node->fullpath, -+ strlen(sym->node->fullpath)); -+ emit->align(etarget, sizeof(cell_t)); -+ } -+ -+ emit->endnode(etarget, NULL); -+ } -+ -+ /* add the fixup nodes */ -+ if (tree->fixups) { -+ -+ /* emit the external fixups */ -+ emit->beginnode(etarget, NULL); -+ emit->string(etarget, "__fixups__", 0); -+ emit->align(etarget, sizeof(cell_t)); -+ -+ for_each_fixup(tree, f) { -+ -+ namesz = 0; -+ for_each_fixup_entry(f, fe) { -+ fullpath = fe->node->fullpath; -+ if (fullpath[0] == '\0') -+ fullpath = "/"; -+ namesz += strlen(fullpath) + 1; -+ namesz += strlen(fe->prop->name) + 1; -+ namesz += 32; /* space for :<number> + '\0' */ -+ } -+ -+ name = xmalloc(namesz); -+ -+ s = name; -+ for_each_fixup_entry(f, fe) { -+ fullpath = fe->node->fullpath; -+ if (fullpath[0] == '\0') -+ fullpath = "/"; -+ snprintf(s, name + namesz - s, "%s:%s:%d", -+ fullpath, -+ fe->prop->name, fe->offset); -+ s += strlen(s) + 1; -+ } -+ -+ nameoff = stringtable_insert(strbuf, f->ref); -+ vallen = s - name - 1; -+ -+ emit->property(etarget, NULL); -+ emit->cell(etarget, vallen + 1); -+ emit->cell(etarget, nameoff); -+ -+ if ((vi->flags & FTF_VARALIGN) && vallen >= 8) -+ emit->align(etarget, 8); -+ -+ emit->string(etarget, name, vallen); -+ emit->align(etarget, sizeof(cell_t)); -+ -+ free(name); -+ } -+ -+ emit->endnode(etarget, tree->labels); -+ } -+ -+ /* add the local fixup property */ -+ if (tree->local_fixups) { -+ -+ /* emit the external fixups */ -+ emit->beginnode(etarget, NULL); -+ emit->string(etarget, "__local_fixups__", 0); -+ emit->align(etarget, sizeof(cell_t)); -+ -+ namesz = 0; -+ for_each_local_fixup_entry(tree, fe) { -+ fullpath = fe->node->fullpath; -+ if (fullpath[0] == '\0') -+ fullpath = "/"; -+ namesz += strlen(fullpath) + 1; -+ namesz += strlen(fe->prop->name) + 1; -+ namesz += 32; /* space for :<number> + '\0' */ -+ } -+ -+ name = xmalloc(namesz); -+ -+ s = name; -+ for_each_local_fixup_entry(tree, fe) { -+ fullpath = fe->node->fullpath; -+ if (fullpath[0] == '\0') -+ fullpath = "/"; -+ snprintf(s, name + namesz - s, "%s:%s:%d", -+ fullpath, fe->prop->name, -+ fe->offset); -+ s += strlen(s) + 1; -+ } -+ -+ nameoff = stringtable_insert(strbuf, "fixup"); -+ vallen = s - name - 1; -+ -+ emit->property(etarget, NULL); -+ emit->cell(etarget, vallen + 1); -+ emit->cell(etarget, nameoff); -+ -+ if ((vi->flags & FTF_VARALIGN) && vallen >= 8) -+ emit->align(etarget, 8); -+ -+ emit->string(etarget, name, vallen); -+ emit->align(etarget, sizeof(cell_t)); -+ -+ free(name); -+ -+ emit->endnode(etarget, tree->labels); -+ } -+ -+no_symbols: - emit->endnode(etarget, tree->labels); - } - -diff --git a/scripts/dtc/version_gen.h b/scripts/dtc/version_gen.h -index 5b8c7d5..86b7338 100644 ---- a/scripts/dtc/version_gen.h -+++ b/scripts/dtc/version_gen.h -@@ -1 +1 @@ --#define DTC_VERSION "DTC 1.4.1-g9d3649bd" -+#define DTC_VERSION "DTC 1.4.1-g9d3649bd-dirty" - -From b065c580329ecb7c7e77bb7019c6059d7db83398 Mon Sep 17 00:00:00 2001 -From: Phil Elwell <pelwell@users.noreply.github.com> -Date: Tue, 14 Jul 2015 14:32:47 +0100 -Subject: [PATCH 084/170] mfd: Add Raspberry Pi Sense HAT core driver - ---- - drivers/input/joystick/Kconfig | 8 + - drivers/input/joystick/Makefile | 1 + - drivers/input/joystick/rpisense-js.c | 153 ++++++++++++++++ - drivers/mfd/Kconfig | 8 + - drivers/mfd/Makefile | 2 + - drivers/mfd/rpisense-core.c | 157 +++++++++++++++++ - drivers/video/fbdev/Kconfig | 13 ++ - drivers/video/fbdev/Makefile | 1 + - drivers/video/fbdev/rpisense-fb.c | 293 +++++++++++++++++++++++++++++++ - include/linux/mfd/rpisense/core.h | 47 +++++ - include/linux/mfd/rpisense/framebuffer.h | 32 ++++ - include/linux/mfd/rpisense/joystick.h | 35 ++++ - 12 files changed, 750 insertions(+) - create mode 100644 drivers/input/joystick/rpisense-js.c - create mode 100644 drivers/mfd/rpisense-core.c - create mode 100644 drivers/video/fbdev/rpisense-fb.c - create mode 100644 include/linux/mfd/rpisense/core.h - create mode 100644 include/linux/mfd/rpisense/framebuffer.h - create mode 100644 include/linux/mfd/rpisense/joystick.h - -diff --git a/drivers/input/joystick/Kconfig b/drivers/input/joystick/Kconfig -index 4215b53..4364d7c8 100644 ---- a/drivers/input/joystick/Kconfig -+++ b/drivers/input/joystick/Kconfig -@@ -330,4 +330,12 @@ config JOYSTICK_MAPLE - To compile this as a module choose M here: the module will be called - maplecontrol. - -+config JOYSTICK_RPISENSE -+ tristate "Raspberry Pi Sense HAT joystick" -+ depends on GPIOLIB && INPUT -+ select MFD_RPISENSE_CORE -+ -+ help -+ This is the joystick driver for the Raspberry Pi Sense HAT -+ - endif -diff --git a/drivers/input/joystick/Makefile b/drivers/input/joystick/Makefile -index 92dc0de..1758160 100644 ---- a/drivers/input/joystick/Makefile -+++ b/drivers/input/joystick/Makefile -@@ -32,4 +32,5 @@ obj-$(CONFIG_JOYSTICK_WARRIOR) += warrior.o - obj-$(CONFIG_JOYSTICK_XPAD) += xpad.o - obj-$(CONFIG_JOYSTICK_ZHENHUA) += zhenhua.o - obj-$(CONFIG_JOYSTICK_WALKERA0701) += walkera0701.o -+obj-$(CONFIG_JOYSTICK_RPISENSE) += rpisense-js.o - -diff --git a/drivers/input/joystick/rpisense-js.c b/drivers/input/joystick/rpisense-js.c -new file mode 100644 -index 0000000..6a41676 ---- /dev/null -+++ b/drivers/input/joystick/rpisense-js.c -@@ -0,0 +1,153 @@ -+/* -+ * Raspberry Pi Sense HAT joystick driver -+ * http://raspberrypi.org -+ * -+ * Copyright (C) 2015 Raspberry Pi -+ * -+ * Author: Serge Schneider -+ * -+ * This program is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License as published by the -+ * Free Software Foundation; either version 2 of the License, or (at your -+ * option) any later version. -+ * -+ */ -+ -+#include <linux/module.h> -+ -+#include <linux/mfd/rpisense/joystick.h> -+#include <linux/mfd/rpisense/core.h> -+ -+static struct rpisense *rpisense; -+static unsigned char keymap[5] = {KEY_DOWN, KEY_RIGHT, KEY_UP, KEY_ENTER, KEY_LEFT,}; -+ -+static void keys_work_fn(struct work_struct *work) -+{ -+ int i; -+ static s32 prev_keys; -+ struct rpisense_js *rpisense_js = &rpisense->joystick; -+ s32 keys = rpisense_reg_read(rpisense, RPISENSE_KEYS); -+ s32 changes = keys ^ prev_keys; -+ -+ prev_keys = keys; -+ for (i = 0; i < 5; i++) { -+ if (changes & 1) { -+ input_report_key(rpisense_js->keys_dev, -+ keymap[i], keys & 1); -+ } -+ changes >>= 1; -+ keys >>= 1; -+ } -+ input_sync(rpisense_js->keys_dev); -+} -+ -+static irqreturn_t keys_irq_handler(int irq, void *pdev) -+{ -+ struct rpisense_js *rpisense_js = &rpisense->joystick; -+ -+ schedule_work(&rpisense_js->keys_work_s); -+ return IRQ_HANDLED; -+} -+ -+static int rpisense_js_probe(struct platform_device *pdev) -+{ -+ int ret; -+ int i; -+ struct rpisense_js *rpisense_js; -+ -+ rpisense = rpisense_get_dev(); -+ rpisense_js = &rpisense->joystick; -+ -+ INIT_WORK(&rpisense_js->keys_work_s, keys_work_fn); -+ -+ rpisense_js->keys_dev = input_allocate_device(); -+ if (!rpisense_js->keys_dev) { -+ dev_err(&pdev->dev, "Could not allocate input device.\n"); -+ return -ENOMEM; -+ } -+ -+ rpisense_js->keys_dev->evbit[0] = BIT_MASK(EV_KEY); -+ for (i = 0; i < ARRAY_SIZE(keymap); i++) { -+ set_bit(keymap[i], -+ rpisense_js->keys_dev->keybit); -+ } -+ -+ rpisense_js->keys_dev->name = "Raspberry Pi Sense HAT Joystick"; -+ rpisense_js->keys_dev->phys = "rpi-sense-joy/input0"; -+ rpisense_js->keys_dev->id.bustype = BUS_I2C; -+ rpisense_js->keys_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP); -+ rpisense_js->keys_dev->keycode = keymap; -+ rpisense_js->keys_dev->keycodesize = sizeof(unsigned char); -+ rpisense_js->keys_dev->keycodemax = ARRAY_SIZE(keymap); -+ -+ ret = input_register_device(rpisense_js->keys_dev); -+ if (ret) { -+ dev_err(&pdev->dev, "Could not register input device.\n"); -+ goto err_keys_alloc; -+ } -+ -+ ret = gpiod_direction_input(rpisense_js->keys_desc); -+ if (ret) { -+ dev_err(&pdev->dev, "Could not set keys-int direction.\n"); -+ goto err_keys_reg; -+ } -+ -+ rpisense_js->keys_irq = gpiod_to_irq(rpisense_js->keys_desc); -+ if (rpisense_js->keys_irq < 0) { -+ dev_err(&pdev->dev, "Could not determine keys-int IRQ.\n"); -+ ret = rpisense_js->keys_irq; -+ goto err_keys_reg; -+ } -+ -+ ret = devm_request_irq(&pdev->dev, rpisense_js->keys_irq, -+ keys_irq_handler, IRQF_TRIGGER_RISING, -+ "keys", &pdev->dev); -+ if (ret) { -+ dev_err(&pdev->dev, "IRQ request failed.\n"); -+ goto err_keys_reg; -+ } -+ return 0; -+err_keys_reg: -+ input_unregister_device(rpisense_js->keys_dev); -+err_keys_alloc: -+ input_free_device(rpisense_js->keys_dev); -+ return ret; -+} -+ -+static int rpisense_js_remove(struct platform_device *pdev) -+{ -+ struct rpisense_js *rpisense_js = &rpisense->joystick; -+ -+ input_unregister_device(rpisense_js->keys_dev); -+ input_free_device(rpisense_js->keys_dev); -+ return 0; -+} -+ -+#ifdef CONFIG_OF -+static const struct of_device_id rpisense_js_id[] = { -+ { .compatible = "rpi,rpi-sense-js" }, -+ { }, -+}; -+MODULE_DEVICE_TABLE(of, rpisense_js_id); -+#endif -+ -+static struct platform_device_id rpisense_js_device_id[] = { -+ { .name = "rpi-sense-js" }, -+ { }, -+}; -+MODULE_DEVICE_TABLE(platform, rpisense_js_device_id); -+ -+static struct platform_driver rpisense_js_driver = { -+ .probe = rpisense_js_probe, -+ .remove = rpisense_js_remove, -+ .driver = { -+ .name = "rpi-sense-js", -+ .owner = THIS_MODULE, -+ }, -+}; -+ -+module_platform_driver(rpisense_js_driver); -+ -+MODULE_DESCRIPTION("Raspberry Pi Sense HAT joystick driver"); -+MODULE_AUTHOR("Serge Schneider <serge@raspberrypi.org>"); -+MODULE_LICENSE("GPL"); -diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig -index 4d92df6..c5730dc 100644 ---- a/drivers/mfd/Kconfig -+++ b/drivers/mfd/Kconfig -@@ -10,6 +10,14 @@ config MFD_CORE - select IRQ_DOMAIN - default n - -+config MFD_RPISENSE_CORE -+ tristate "Raspberry Pi Sense HAT core functions" -+ depends on I2C -+ select MFD_CORE -+ help -+ This is the core driver for the Raspberry Pi Sense HAT. This provides -+ the necessary functions to communicate with the hardware. -+ - config MFD_CS5535 - tristate "AMD CS5535 and CS5536 southbridge core functions" - select MFD_CORE -diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile -index a8b76b8..e6339d2 100644 ---- a/drivers/mfd/Makefile -+++ b/drivers/mfd/Makefile -@@ -194,3 +194,5 @@ intel-soc-pmic-objs := intel_soc_pmic_core.o intel_soc_pmic_crc.o - intel-soc-pmic-$(CONFIG_INTEL_PMC_IPC) += intel_soc_pmic_bxtwc.o - obj-$(CONFIG_INTEL_SOC_PMIC) += intel-soc-pmic.o - obj-$(CONFIG_MFD_MT6397) += mt6397-core.o -+ -+obj-$(CONFIG_MFD_RPISENSE_CORE) += rpisense-core.o -diff --git a/drivers/mfd/rpisense-core.c b/drivers/mfd/rpisense-core.c -new file mode 100644 -index 0000000..eea9312 ---- /dev/null -+++ b/drivers/mfd/rpisense-core.c -@@ -0,0 +1,157 @@ -+/* -+ * Raspberry Pi Sense HAT core driver -+ * http://raspberrypi.org -+ * -+ * Copyright (C) 2015 Raspberry Pi -+ * -+ * Author: Serge Schneider -+ * -+ * This program is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License as published by the -+ * Free Software Foundation; either version 2 of the License, or (at your -+ * option) any later version. -+ * -+ * This driver is based on wm8350 implementation. -+ */ -+ -+#include <linux/module.h> -+#include <linux/moduleparam.h> -+#include <linux/err.h> -+#include <linux/init.h> -+#include <linux/i2c.h> -+#include <linux/platform_device.h> -+#include <linux/mfd/rpisense/core.h> -+#include <linux/slab.h> -+ -+static struct rpisense *rpisense; -+ -+static void rpisense_client_dev_register(struct rpisense *rpisense, -+ const char *name, -+ struct platform_device **pdev) -+{ -+ int ret; -+ -+ *pdev = platform_device_alloc(name, -1); -+ if (*pdev == NULL) { -+ dev_err(rpisense->dev, "Failed to allocate %s\n", name); -+ return; -+ } -+ -+ (*pdev)->dev.parent = rpisense->dev; -+ platform_set_drvdata(*pdev, rpisense); -+ ret = platform_device_add(*pdev); -+ if (ret != 0) { -+ dev_err(rpisense->dev, "Failed to register %s: %d\n", -+ name, ret); -+ platform_device_put(*pdev); -+ *pdev = NULL; -+ } -+} -+ -+static int rpisense_probe(struct i2c_client *i2c, -+ const struct i2c_device_id *id) -+{ -+ int ret; -+ struct rpisense_js *rpisense_js; -+ -+ rpisense = devm_kzalloc(&i2c->dev, sizeof(struct rpisense), GFP_KERNEL); -+ if (rpisense == NULL) -+ return -ENOMEM; -+ -+ i2c_set_clientdata(i2c, rpisense); -+ rpisense->dev = &i2c->dev; -+ rpisense->i2c_client = i2c; -+ -+ ret = rpisense_reg_read(rpisense, RPISENSE_WAI); -+ if (ret > 0) { -+ if (ret != 's') -+ return -EINVAL; -+ } else { -+ return ret; -+ } -+ ret = rpisense_reg_read(rpisense, RPISENSE_VER); -+ if (ret < 0) -+ return ret; -+ -+ dev_info(rpisense->dev, -+ "Raspberry Pi Sense HAT firmware version %i\n", ret); -+ -+ rpisense_js = &rpisense->joystick; -+ rpisense_js->keys_desc = devm_gpiod_get(&i2c->dev, -+ "keys-int", GPIOD_IN); -+ if (IS_ERR(rpisense_js->keys_desc)) { -+ dev_warn(&i2c->dev, "Failed to get keys-int descriptor.\n"); -+ rpisense_js->keys_desc = gpio_to_desc(23); -+ if (rpisense_js->keys_desc == NULL) { -+ dev_err(&i2c->dev, "GPIO23 fallback failed.\n"); -+ return PTR_ERR(rpisense_js->keys_desc); -+ } -+ } -+ rpisense_client_dev_register(rpisense, "rpi-sense-js", -+ &(rpisense->joystick.pdev)); -+ rpisense_client_dev_register(rpisense, "rpi-sense-fb", -+ &(rpisense->framebuffer.pdev)); -+ -+ return 0; -+} -+ -+static int rpisense_remove(struct i2c_client *i2c) -+{ -+ struct rpisense *rpisense = i2c_get_clientdata(i2c); -+ -+ platform_device_unregister(rpisense->joystick.pdev); -+ return 0; -+} -+ -+struct rpisense *rpisense_get_dev(void) -+{ -+ return rpisense; -+} -+EXPORT_SYMBOL_GPL(rpisense_get_dev); -+ -+s32 rpisense_reg_read(struct rpisense *rpisense, int reg) -+{ -+ int ret = i2c_smbus_read_byte_data(rpisense->i2c_client, reg); -+ -+ if (ret < 0) -+ dev_err(rpisense->dev, "Read from reg %d failed\n", reg); -+ /* Due to the BCM270x I2C clock stretching bug, some values -+ * may have MSB set. Clear it to avoid incorrect values. -+ * */ -+ return ret & 0x7F; -+} -+EXPORT_SYMBOL_GPL(rpisense_reg_read); -+ -+int rpisense_block_write(struct rpisense *rpisense, const char *buf, int count) -+{ -+ int ret = i2c_master_send(rpisense->i2c_client, buf, count); -+ -+ if (ret < 0) -+ dev_err(rpisense->dev, "Block write failed\n"); -+ return ret; -+} -+EXPORT_SYMBOL_GPL(rpisense_block_write); -+ -+static const struct i2c_device_id rpisense_i2c_id[] = { -+ { "rpi-sense", 0 }, -+ { } -+}; -+MODULE_DEVICE_TABLE(i2c, rpisense_i2c_id); -+ -+ -+static struct i2c_driver rpisense_driver = { -+ .driver = { -+ .name = "rpi-sense", -+ .owner = THIS_MODULE, -+ }, -+ .probe = rpisense_probe, -+ .remove = rpisense_remove, -+ .id_table = rpisense_i2c_id, -+}; -+ -+module_i2c_driver(rpisense_driver); -+ -+MODULE_DESCRIPTION("Raspberry Pi Sense HAT core driver"); -+MODULE_AUTHOR("Serge Schneider <serge@raspberrypi.org>"); -+MODULE_LICENSE("GPL"); -+ -diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig -index 0f33a78..4caa417 100644 ---- a/drivers/video/fbdev/Kconfig -+++ b/drivers/video/fbdev/Kconfig -@@ -2506,3 +2506,16 @@ config FB_SM712 - This driver is also available as a module. The module will be - called sm712fb. If you want to compile it as a module, say M - here and read <file:Documentation/kbuild/modules.txt>. -+ -+config FB_RPISENSE -+ tristate "Raspberry Pi Sense HAT framebuffer" -+ depends on FB -+ select MFD_RPISENSE_CORE -+ select FB_SYS_FOPS -+ select FB_SYS_FILLRECT -+ select FB_SYS_COPYAREA -+ select FB_SYS_IMAGEBLIT -+ select FB_DEFERRED_IO -+ -+ help -+ This is the framebuffer driver for the Raspberry Pi Sense HAT -diff --git a/drivers/video/fbdev/Makefile b/drivers/video/fbdev/Makefile -index 9b086ac..7101277 100644 ---- a/drivers/video/fbdev/Makefile -+++ b/drivers/video/fbdev/Makefile -@@ -150,6 +150,7 @@ obj-$(CONFIG_FB_DA8XX) += da8xx-fb.o - obj-$(CONFIG_FB_MXS) += mxsfb.o - obj-$(CONFIG_FB_SSD1307) += ssd1307fb.o - obj-$(CONFIG_FB_SIMPLE) += simplefb.o -+obj-$(CONFIG_FB_RPISENSE) += rpisense-fb.o - - # the test framebuffer is last - obj-$(CONFIG_FB_VIRTUAL) += vfb.o -diff --git a/drivers/video/fbdev/rpisense-fb.c b/drivers/video/fbdev/rpisense-fb.c -new file mode 100644 -index 0000000..26432a5 ---- /dev/null -+++ b/drivers/video/fbdev/rpisense-fb.c -@@ -0,0 +1,293 @@ -+/* -+ * Raspberry Pi Sense HAT framebuffer driver -+ * http://raspberrypi.org -+ * -+ * Copyright (C) 2015 Raspberry Pi -+ * -+ * Author: Serge Schneider -+ * -+ * This program is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License as published by the -+ * Free Software Foundation; either version 2 of the License, or (at your -+ * option) any later version. -+ * -+ */ -+ -+#include <linux/module.h> -+#include <linux/kernel.h> -+#include <linux/errno.h> -+#include <linux/string.h> -+#include <linux/mm.h> -+#include <linux/slab.h> -+#include <linux/uaccess.h> -+#include <linux/delay.h> -+#include <linux/fb.h> -+#include <linux/init.h> -+ -+#include <linux/mfd/rpisense/framebuffer.h> -+#include <linux/mfd/rpisense/core.h> -+ -+static bool lowlight; -+module_param(lowlight, bool, 0); -+MODULE_PARM_DESC(lowlight, "Reduce LED matrix brightness to one third"); -+ -+static struct rpisense *rpisense; -+ -+struct rpisense_fb_param { -+ char __iomem *vmem; -+ u8 *vmem_work; -+ u32 vmemsize; -+ u8 *gamma; -+}; -+ -+static u8 gamma_default[32] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, -+ 0x02, 0x02, 0x03, 0x03, 0x04, 0x05, 0x06, 0x07, -+ 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0E, 0x0F, 0x11, -+ 0x12, 0x14, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F,}; -+ -+static u8 gamma_low[32] = {0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, -+ 0x03, 0x03, 0x03, 0x04, 0x04, 0x05, 0x05, 0x06, -+ 0x06, 0x07, 0x07, 0x08, 0x08, 0x09, 0x0A, 0x0A,}; -+ -+static u8 gamma_user[32]; -+ -+static struct rpisense_fb_param rpisense_fb_param = { -+ .vmem = NULL, -+ .vmemsize = 128, -+ .gamma = gamma_default, -+}; -+ -+static struct fb_deferred_io rpisense_fb_defio; -+ -+static struct fb_fix_screeninfo rpisense_fb_fix = { -+ .id = "RPi-Sense FB", -+ .type = FB_TYPE_PACKED_PIXELS, -+ .visual = FB_VISUAL_TRUECOLOR, -+ .xpanstep = 0, -+ .ypanstep = 0, -+ .ywrapstep = 0, -+ .accel = FB_ACCEL_NONE, -+ .line_length = 16, -+}; -+ -+static struct fb_var_screeninfo rpisense_fb_var = { -+ .xres = 8, -+ .yres = 8, -+ .xres_virtual = 8, -+ .yres_virtual = 8, -+ .bits_per_pixel = 16, -+ .red = {11, 5, 0}, -+ .green = {5, 6, 0}, -+ .blue = {0, 5, 0}, -+}; -+ -+static ssize_t rpisense_fb_write(struct fb_info *info, -+ const char __user *buf, size_t count, -+ loff_t *ppos) -+{ -+ ssize_t res = fb_sys_write(info, buf, count, ppos); -+ -+ schedule_delayed_work(&info->deferred_work, rpisense_fb_defio.delay); -+ return res; -+} -+ -+static void rpisense_fb_fillrect(struct fb_info *info, -+ const struct fb_fillrect *rect) -+{ -+ sys_fillrect(info, rect); -+ schedule_delayed_work(&info->deferred_work, rpisense_fb_defio.delay); -+} -+ -+static void rpisense_fb_copyarea(struct fb_info *info, -+ const struct fb_copyarea *area) -+{ -+ sys_copyarea(info, area); -+ schedule_delayed_work(&info->deferred_work, rpisense_fb_defio.delay); -+} -+ -+static void rpisense_fb_imageblit(struct fb_info *info, -+ const struct fb_image *image) -+{ -+ sys_imageblit(info, image); -+ schedule_delayed_work(&info->deferred_work, rpisense_fb_defio.delay); -+} -+ -+static void rpisense_fb_deferred_io(struct fb_info *info, -+ struct list_head *pagelist) -+{ -+ int i; -+ int j; -+ u8 *vmem_work = rpisense_fb_param.vmem_work; -+ u16 *mem = (u16 *)rpisense_fb_param.vmem; -+ u8 *gamma = rpisense_fb_param.gamma; -+ -+ vmem_work[0] = 0; -+ for (j = 0; j < 8; j++) { -+ for (i = 0; i < 8; i++) { -+ vmem_work[(j * 24) + i + 1] = -+ gamma[(mem[(j * 8) + i] >> 11) & 0x1F]; -+ vmem_work[(j * 24) + (i + 8) + 1] = -+ gamma[(mem[(j * 8) + i] >> 6) & 0x1F]; -+ vmem_work[(j * 24) + (i + 16) + 1] = -+ gamma[(mem[(j * 8) + i]) & 0x1F]; -+ } -+ } -+ rpisense_block_write(rpisense, vmem_work, 193); -+} -+ -+static struct fb_deferred_io rpisense_fb_defio = { -+ .delay = HZ/100, -+ .deferred_io = rpisense_fb_deferred_io, -+}; -+ -+static int rpisense_fb_ioctl(struct fb_info *info, unsigned int cmd, -+ unsigned long arg) -+{ -+ switch (cmd) { -+ case SENSEFB_FBIOGET_GAMMA: -+ if (copy_to_user((void __user *) arg, rpisense_fb_param.gamma, -+ sizeof(u8[32]))) -+ return -EFAULT; -+ return 0; -+ case SENSEFB_FBIOSET_GAMMA: -+ if (copy_from_user(gamma_user, (void __user *)arg, -+ sizeof(u8[32]))) -+ return -EFAULT; -+ rpisense_fb_param.gamma = gamma_user; -+ schedule_delayed_work(&info->deferred_work, -+ rpisense_fb_defio.delay); -+ return 0; -+ case SENSEFB_FBIORESET_GAMMA: -+ switch (arg) { -+ case 0: -+ rpisense_fb_param.gamma = gamma_default; -+ break; -+ case 1: -+ rpisense_fb_param.gamma = gamma_low; -+ break; -+ case 2: -+ rpisense_fb_param.gamma = gamma_user; -+ break; -+ default: -+ return -EINVAL; -+ } -+ schedule_delayed_work(&info->deferred_work, -+ rpisense_fb_defio.delay); -+ break; -+ default: -+ return -EINVAL; -+ } -+ return 0; -+} -+ -+static struct fb_ops rpisense_fb_ops = { -+ .owner = THIS_MODULE, -+ .fb_read = fb_sys_read, -+ .fb_write = rpisense_fb_write, -+ .fb_fillrect = rpisense_fb_fillrect, -+ .fb_copyarea = rpisense_fb_copyarea, -+ .fb_imageblit = rpisense_fb_imageblit, -+ .fb_ioctl = rpisense_fb_ioctl, -+}; -+ -+static int rpisense_fb_probe(struct platform_device *pdev) -+{ -+ struct fb_info *info; -+ int ret = -ENOMEM; -+ struct rpisense_fb *rpisense_fb; -+ -+ rpisense = rpisense_get_dev(); -+ rpisense_fb = &rpisense->framebuffer; -+ -+ rpisense_fb_param.vmem = vzalloc(rpisense_fb_param.vmemsize); -+ if (!rpisense_fb_param.vmem) -+ return ret; -+ -+ rpisense_fb_param.vmem_work = devm_kmalloc(&pdev->dev, 193, GFP_KERNEL); -+ if (!rpisense_fb_param.vmem_work) -+ goto err_malloc; -+ -+ info = framebuffer_alloc(0, &pdev->dev); -+ if (!info) { -+ dev_err(&pdev->dev, "Could not allocate framebuffer.\n"); -+ goto err_malloc; -+ } -+ rpisense_fb->info = info; -+ -+ rpisense_fb_fix.smem_start = (unsigned long)rpisense_fb_param.vmem; -+ rpisense_fb_fix.smem_len = rpisense_fb_param.vmemsize; -+ -+ info->fbops = &rpisense_fb_ops; -+ info->fix = rpisense_fb_fix; -+ info->var = rpisense_fb_var; -+ info->fbdefio = &rpisense_fb_defio; -+ info->flags = FBINFO_FLAG_DEFAULT | FBINFO_VIRTFB; -+ info->screen_base = rpisense_fb_param.vmem; -+ info->screen_size = rpisense_fb_param.vmemsize; -+ -+ if (lowlight) -+ rpisense_fb_param.gamma = gamma_low; -+ -+ fb_deferred_io_init(info); -+ -+ ret = register_framebuffer(info); -+ if (ret < 0) { -+ dev_err(&pdev->dev, "Could not register framebuffer.\n"); -+ goto err_fballoc; -+ } -+ -+ fb_info(info, "%s frame buffer device\n", info->fix.id); -+ schedule_delayed_work(&info->deferred_work, rpisense_fb_defio.delay); -+ return 0; -+err_fballoc: -+ framebuffer_release(info); -+err_malloc: -+ vfree(rpisense_fb_param.vmem); -+ return ret; -+} -+ -+static int rpisense_fb_remove(struct platform_device *pdev) -+{ -+ struct rpisense_fb *rpisense_fb = &rpisense->framebuffer; -+ struct fb_info *info = rpisense_fb->info; -+ -+ if (info) { -+ unregister_framebuffer(info); -+ fb_deferred_io_cleanup(info); -+ framebuffer_release(info); -+ vfree(rpisense_fb_param.vmem); -+ } -+ -+ return 0; -+} -+ -+#ifdef CONFIG_OF -+static const struct of_device_id rpisense_fb_id[] = { -+ { .compatible = "rpi,rpi-sense-fb" }, -+ { }, -+}; -+MODULE_DEVICE_TABLE(of, rpisense_fb_id); -+#endif -+ -+static struct platform_device_id rpisense_fb_device_id[] = { -+ { .name = "rpi-sense-fb" }, -+ { }, -+}; -+MODULE_DEVICE_TABLE(platform, rpisense_fb_device_id); -+ -+static struct platform_driver rpisense_fb_driver = { -+ .probe = rpisense_fb_probe, -+ .remove = rpisense_fb_remove, -+ .driver = { -+ .name = "rpi-sense-fb", -+ .owner = THIS_MODULE, -+ }, -+}; -+ -+module_platform_driver(rpisense_fb_driver); -+ -+MODULE_DESCRIPTION("Raspberry Pi Sense HAT framebuffer driver"); -+MODULE_AUTHOR("Serge Schneider <serge@raspberrypi.org>"); -+MODULE_LICENSE("GPL"); -+ -diff --git a/include/linux/mfd/rpisense/core.h b/include/linux/mfd/rpisense/core.h -new file mode 100644 -index 0000000..4856aa3 ---- /dev/null -+++ b/include/linux/mfd/rpisense/core.h -@@ -0,0 +1,47 @@ -+/* -+ * Raspberry Pi Sense HAT core driver -+ * http://raspberrypi.org -+ * -+ * Copyright (C) 2015 Raspberry Pi -+ * -+ * Author: Serge Schneider -+ * -+ * This program is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License as published by the -+ * Free Software Foundation; either version 2 of the License, or (at your -+ * option) any later version. -+ * -+ */ -+ -+#ifndef __LINUX_MFD_RPISENSE_CORE_H_ -+#define __LINUX_MFD_RPISENSE_CORE_H_ -+ -+#include <linux/mfd/rpisense/joystick.h> -+#include <linux/mfd/rpisense/framebuffer.h> -+ -+/* -+ * Register values. -+ */ -+#define RPISENSE_FB 0x00 -+#define RPISENSE_WAI 0xF0 -+#define RPISENSE_VER 0xF1 -+#define RPISENSE_KEYS 0xF2 -+#define RPISENSE_EE_WP 0xF3 -+ -+#define RPISENSE_ID 's' -+ -+struct rpisense { -+ struct device *dev; -+ struct i2c_client *i2c_client; -+ -+ /* Client devices */ -+ struct rpisense_js joystick; -+ struct rpisense_fb framebuffer; -+}; -+ -+struct rpisense *rpisense_get_dev(void); -+s32 rpisense_reg_read(struct rpisense *rpisense, int reg); -+int rpisense_reg_write(struct rpisense *rpisense, int reg, u16 val); -+int rpisense_block_write(struct rpisense *rpisense, const char *buf, int count); -+ -+#endif -diff --git a/include/linux/mfd/rpisense/framebuffer.h b/include/linux/mfd/rpisense/framebuffer.h -new file mode 100644 -index 0000000..2ba95d7 ---- /dev/null -+++ b/include/linux/mfd/rpisense/framebuffer.h -@@ -0,0 +1,32 @@ -+/* -+ * Raspberry Pi Sense HAT framebuffer driver -+ * http://raspberrypi.org -+ * -+ * Copyright (C) 2015 Raspberry Pi -+ * -+ * Author: Serge Schneider -+ * -+ * This program is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License as published by the -+ * Free Software Foundation; either version 2 of the License, or (at your -+ * option) any later version. -+ * -+ */ -+ -+#ifndef __LINUX_RPISENSE_FB_H_ -+#define __LINUX_RPISENSE_FB_H_ -+ -+#define SENSEFB_FBIO_IOC_MAGIC 0xF1 -+ -+#define SENSEFB_FBIOGET_GAMMA _IO(SENSEFB_FBIO_IOC_MAGIC, 0) -+#define SENSEFB_FBIOSET_GAMMA _IO(SENSEFB_FBIO_IOC_MAGIC, 1) -+#define SENSEFB_FBIORESET_GAMMA _IO(SENSEFB_FBIO_IOC_MAGIC, 2) -+ -+struct rpisense; -+ -+struct rpisense_fb { -+ struct platform_device *pdev; -+ struct fb_info *info; -+}; -+ -+#endif -diff --git a/include/linux/mfd/rpisense/joystick.h b/include/linux/mfd/rpisense/joystick.h -new file mode 100644 -index 0000000..56196dc ---- /dev/null -+++ b/include/linux/mfd/rpisense/joystick.h -@@ -0,0 +1,35 @@ -+/* -+ * Raspberry Pi Sense HAT joystick driver -+ * http://raspberrypi.org -+ * -+ * Copyright (C) 2015 Raspberry Pi -+ * -+ * Author: Serge Schneider -+ * -+ * This program is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License as published by the -+ * Free Software Foundation; either version 2 of the License, or (at your -+ * option) any later version. -+ * -+ */ -+ -+#ifndef __LINUX_RPISENSE_JOYSTICK_H_ -+#define __LINUX_RPISENSE_JOYSTICK_H_ -+ -+#include <linux/input.h> -+#include <linux/interrupt.h> -+#include <linux/gpio/consumer.h> -+#include <linux/platform_device.h> -+ -+struct rpisense; -+ -+struct rpisense_js { -+ struct platform_device *pdev; -+ struct input_dev *keys_dev; -+ struct gpio_desc *keys_desc; -+ struct work_struct keys_work_s; -+ int keys_irq; -+}; -+ -+ -+#endif - -From c86a74aaff9bc42b3cb04881b3aaf7f822edda04 Mon Sep 17 00:00:00 2001 -From: Jan Grulich <jan@grulich.eu> -Date: Mon, 24 Aug 2015 16:03:47 +0100 -Subject: [PATCH 085/170] RaspiDAC3 support - -Signed-off-by: Jan Grulich <jan@grulich.eu> - -config: fix RaspiDAC Rev.3x dependencies - -Change depends to SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S -like the other I2S soundcard drivers. - -Signed-off-by: Matthias Reichl <hias@horus.com> ---- - sound/soc/bcm/Kconfig | 8 ++ - sound/soc/bcm/Makefile | 2 + - sound/soc/bcm/raspidac3.c | 191 ++++++++++++++++++++++++++++++++++++++++++++++ - 3 files changed, 201 insertions(+) - create mode 100644 sound/soc/bcm/raspidac3.c - -diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig -index 8669a9a..1a3f826 100644 ---- a/sound/soc/bcm/Kconfig -+++ b/sound/soc/bcm/Kconfig -@@ -56,3 +56,11 @@ config SND_BCM2708_SOC_IQAUDIO_DAC - select SND_SOC_PCM512x_I2C - help - Say Y or M if you want to add support for IQaudIO-DAC. -+ -+config SND_BCM2708_SOC_RASPIDAC3 -+ tristate "Support for RaspiDAC Rev.3x" -+ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S -+ select SND_SOC_PCM512x_I2C -+ select SND_SOC_TPA6130A2 -+ help -+ Say Y or M if you want to add support for RaspiDAC Rev.3x. -diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile -index 4f5ab1f..b21e11e 100644 ---- a/sound/soc/bcm/Makefile -+++ b/sound/soc/bcm/Makefile -@@ -11,6 +11,7 @@ snd-soc-hifiberry-amp-objs := hifiberry_amp.o - snd-soc-rpi-dac-objs := rpi-dac.o - snd-soc-rpi-proto-objs := rpi-proto.o - snd-soc-iqaudio-dac-objs := iqaudio-dac.o -+snd-soc-raspidac3-objs := raspidac3.o - - obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o - obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS) += snd-soc-hifiberry-dacplus.o -@@ -19,3 +20,4 @@ obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_AMP) += snd-soc-hifiberry-amp.o - obj-$(CONFIG_SND_BCM2708_SOC_RPI_DAC) += snd-soc-rpi-dac.o - obj-$(CONFIG_SND_BCM2708_SOC_RPI_PROTO) += snd-soc-rpi-proto.o - obj-$(CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC) += snd-soc-iqaudio-dac.o -+obj-$(CONFIG_SND_BCM2708_SOC_RASPIDAC3) += snd-soc-raspidac3.o -diff --git a/sound/soc/bcm/raspidac3.c b/sound/soc/bcm/raspidac3.c -new file mode 100644 -index 0000000..3cabf5b ---- /dev/null -+++ b/sound/soc/bcm/raspidac3.c -@@ -0,0 +1,191 @@ -+/* -+ * ASoC Driver for RaspiDAC v3 -+ * -+ * Author: Jan Grulich <jan@grulich.eu> -+ * Copyright 2015 -+ * based on code by Daniel Matuschek <daniel@hifiberry.com> -+ * based on code by Florian Meier <florian.meier@koalo.de> -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License -+ * version 2 as published by the Free Software Foundation. -+ * -+ * This program is distributed in the hope that it will be useful, but -+ * WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * General Public License for more details. -+ */ -+ -+#include <linux/module.h> -+#include <linux/platform_device.h> -+ -+#include <sound/core.h> -+#include <sound/pcm.h> -+#include <sound/pcm_params.h> -+#include <sound/soc.h> -+#include <sound/jack.h> -+#include <sound/soc-dapm.h> -+ -+#include "../codecs/pcm512x.h" -+#include "../codecs/tpa6130a2.h" -+ -+/* sound card init */ -+static int snd_rpi_raspidac3_init(struct snd_soc_pcm_runtime *rtd) -+{ -+ int ret; -+ struct snd_soc_card *card = rtd->card; -+ struct snd_soc_codec *codec = rtd->codec; -+ snd_soc_update_bits(codec, PCM512x_GPIO_EN, 0x08, 0x08); -+ snd_soc_update_bits(codec, PCM512x_GPIO_OUTPUT_4, 0xf, 0x02); -+ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x08,0x00); -+ -+ ret = snd_soc_limit_volume(card, "Digital Playback Volume", 207); -+ if (ret < 0) -+ dev_warn(card->dev, "Failed to set volume limit: %d\n", ret); -+ else { -+ struct snd_kcontrol *kctl; -+ -+ ret = tpa6130a2_add_controls(codec); -+ if (ret < 0) -+ dev_warn(card->dev, "Failed to add TPA6130A2 controls: %d\n", -+ ret); -+ ret = snd_soc_limit_volume(card, -+ "TPA6130A2 Headphone Playback Volume", -+ 54); -+ if (ret < 0) -+ dev_warn(card->dev, "Failed to set TPA6130A2 volume limit: %d\n", -+ ret); -+ kctl = snd_soc_card_get_kcontrol(card, -+ "TPA6130A2 Headphone Playback Volume"); -+ if (kctl) { -+ strcpy(kctl->id.name, "Headphones Playback Volume"); -+ /* disable the volume dB scale so alsamixer works */ -+ kctl->vd[0].access = SNDRV_CTL_ELEM_ACCESS_READWRITE; -+ } -+ -+ kctl = snd_soc_card_get_kcontrol(card, -+ "TPA6130A2 Headphone Playback Switch"); -+ if (kctl) -+ strcpy(kctl->id.name, "Headphones Playback Switch"); -+ } -+ -+ return 0; -+} -+ -+/* set hw parameters */ -+static int snd_rpi_raspidac3_hw_params(struct snd_pcm_substream *substream, -+ struct snd_pcm_hw_params *params) -+{ -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; -+ -+ unsigned int sample_bits = -+ snd_pcm_format_physical_width(params_format(params)); -+ -+ return snd_soc_dai_set_bclk_ratio(cpu_dai, sample_bits * 2); -+} -+ -+/* startup */ -+static int snd_rpi_raspidac3_startup(struct snd_pcm_substream *substream) { -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_codec *codec = rtd->codec; -+ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x08,0x08); -+ tpa6130a2_stereo_enable(codec, 1); -+ return 0; -+} -+ -+/* shutdown */ -+static void snd_rpi_raspidac3_shutdown(struct snd_pcm_substream *substream) { -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_codec *codec = rtd->codec; -+ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x08,0x00); -+ tpa6130a2_stereo_enable(codec, 0); -+} -+ -+/* machine stream operations */ -+static struct snd_soc_ops snd_rpi_raspidac3_ops = { -+ .hw_params = snd_rpi_raspidac3_hw_params, -+ .startup = snd_rpi_raspidac3_startup, -+ .shutdown = snd_rpi_raspidac3_shutdown, -+}; -+ -+/* interface setup */ -+static struct snd_soc_dai_link snd_rpi_raspidac3_dai[] = { -+{ -+ .name = "RaspiDAC Rev.3x", -+ .stream_name = "RaspiDAC HiFi", -+ .cpu_dai_name = "bcm2708-i2s.0", -+ .codec_dai_name = "pcm512x-hifi", -+ .platform_name = "bcm2708-i2s.0", -+ .codec_name = "pcm512x.1-004c", -+ .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | -+ SND_SOC_DAIFMT_CBS_CFS, -+ .ops = &snd_rpi_raspidac3_ops, -+ .init = snd_rpi_raspidac3_init, -+}, -+}; -+ -+/* audio machine driver */ -+static struct snd_soc_card snd_rpi_raspidac3 = { -+ .name = "RaspiDAC Rev.3x HiFi Audio Card", -+ .dai_link = snd_rpi_raspidac3_dai, -+ .num_links = ARRAY_SIZE(snd_rpi_raspidac3_dai), -+}; -+ -+/* sound card test */ -+static int snd_rpi_raspidac3_probe(struct platform_device *pdev) -+{ -+ int ret = 0; -+ -+ snd_rpi_raspidac3.dev = &pdev->dev; -+ -+ if (pdev->dev.of_node) { -+ struct device_node *i2s_node; -+ struct snd_soc_dai_link *dai = &snd_rpi_raspidac3_dai[0]; -+ i2s_node = of_parse_phandle(pdev->dev.of_node, -+ "i2s-controller", 0); -+ -+ if (i2s_node) { -+ dai->cpu_dai_name = NULL; -+ dai->cpu_of_node = i2s_node; -+ dai->platform_name = NULL; -+ dai->platform_of_node = i2s_node; -+ } -+ } -+ -+ ret = snd_soc_register_card(&snd_rpi_raspidac3); -+ if (ret) -+ dev_err(&pdev->dev, -+ "snd_soc_register_card() failed: %d\n", ret); -+ -+ return ret; -+} -+ -+/* sound card disconnect */ -+static int snd_rpi_raspidac3_remove(struct platform_device *pdev) -+{ -+ return snd_soc_unregister_card(&snd_rpi_raspidac3); -+} -+ -+static const struct of_device_id raspidac3_of_match[] = { -+ { .compatible = "jg,raspidacv3", }, -+ {}, -+}; -+MODULE_DEVICE_TABLE(of, raspidac3_of_match); -+ -+/* sound card platform driver */ -+static struct platform_driver snd_rpi_raspidac3_driver = { -+ .driver = { -+ .name = "snd-rpi-raspidac3", -+ .owner = THIS_MODULE, -+ .of_match_table = raspidac3_of_match, -+ }, -+ .probe = snd_rpi_raspidac3_probe, -+ .remove = snd_rpi_raspidac3_remove, -+}; -+ -+module_platform_driver(snd_rpi_raspidac3_driver); -+ -+MODULE_AUTHOR("Jan Grulich <jan@grulich.eu>"); -+MODULE_DESCRIPTION("ASoC Driver for RaspiDAC Rev.3x"); -+MODULE_LICENSE("GPL v2"); - -From 2d340e2fbbc9f4735b798601a43ae9f0f4cc5742 Mon Sep 17 00:00:00 2001 -From: Jan Grulich <jan@grulich.eu> -Date: Mon, 24 Aug 2015 16:02:34 +0100 -Subject: [PATCH 086/170] tpa6130a2: Add headphone switch control - -Signed-off-by: Jan Grulich <jan@grulich.eu> ---- - sound/soc/codecs/tpa6130a2.c | 29 ++++++++++++++++++++++++++--- - 1 file changed, 26 insertions(+), 3 deletions(-) - -diff --git a/sound/soc/codecs/tpa6130a2.c b/sound/soc/codecs/tpa6130a2.c -index 11d85c5..3caaa17 100644 ---- a/sound/soc/codecs/tpa6130a2.c -+++ b/sound/soc/codecs/tpa6130a2.c -@@ -4,6 +4,7 @@ - * Copyright (C) Nokia Corporation - * - * Author: Peter Ujfalusi <peter.ujfalusi@ti.com> -+ * Modified: Jan Grulich <jan@grulich.eu> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License -@@ -52,6 +53,8 @@ struct tpa6130a2_data { - enum tpa_model id; - }; - -+static void tpa6130a2_channel_enable(u8 channel, int enable); -+ - static int tpa6130a2_i2c_read(int reg) - { - struct tpa6130a2_data *data; -@@ -189,7 +192,7 @@ static int tpa6130a2_power(u8 power) - } - - static int tpa6130a2_get_volsw(struct snd_kcontrol *kcontrol, -- struct snd_ctl_elem_value *ucontrol) -+ struct snd_ctl_elem_value *ucontrol) - { - struct soc_mixer_control *mc = - (struct soc_mixer_control *)kcontrol->private_value; -@@ -218,7 +221,7 @@ static int tpa6130a2_get_volsw(struct snd_kcontrol *kcontrol, - } - - static int tpa6130a2_put_volsw(struct snd_kcontrol *kcontrol, -- struct snd_ctl_elem_value *ucontrol) -+ struct snd_ctl_elem_value *ucontrol) - { - struct soc_mixer_control *mc = - (struct soc_mixer_control *)kcontrol->private_value; -@@ -255,8 +258,22 @@ static int tpa6130a2_put_volsw(struct snd_kcontrol *kcontrol, - return 1; - } - -+static int tpa6130a2_put_hp_sw(struct snd_kcontrol *kcontrol, -+ struct snd_ctl_elem_value *ucontrol) -+{ -+ int enable = ucontrol->value.integer.value[0]; -+ unsigned int state; -+ -+ state = (tpa6130a2_read(TPA6130A2_REG_VOL_MUTE) & 0x80) == 0; -+ if (state == enable) -+ return 0; /* No change */ -+ -+ tpa6130a2_channel_enable(TPA6130A2_HP_EN_R | TPA6130A2_HP_EN_L, enable); -+ return 1; /* Changed */ -+} -+ - /* -- * TPA6130 volume. From -59.5 to 4 dB with increasing step size when going -+ * TPA6130 volume. From -59.5 to +4.0 dB with increasing step size when going - * down in gain. - */ - static const DECLARE_TLV_DB_RANGE(tpa6130_tlv, -@@ -277,6 +294,9 @@ static const struct snd_kcontrol_new tpa6130a2_controls[] = { - TPA6130A2_REG_VOL_MUTE, 0, 0x3f, 0, - tpa6130a2_get_volsw, tpa6130a2_put_volsw, - tpa6130_tlv), -+ SOC_SINGLE_EXT("TPA6130A2 Headphone Playback Switch", -+ TPA6130A2_REG_VOL_MUTE, 7, 1, 1, -+ tpa6130a2_get_volsw, tpa6130a2_put_hp_sw), - }; - - static const DECLARE_TLV_DB_RANGE(tpa6140_tlv, -@@ -290,6 +310,9 @@ static const struct snd_kcontrol_new tpa6140a2_controls[] = { - TPA6130A2_REG_VOL_MUTE, 1, 0x1f, 0, - tpa6130a2_get_volsw, tpa6130a2_put_volsw, - tpa6140_tlv), -+ SOC_SINGLE_EXT("TPA6140A2 Headphone Playback Switch", -+ TPA6130A2_REG_VOL_MUTE, 7, 1, 1, -+ tpa6130a2_get_volsw, tpa6130a2_put_hp_sw), - }; - - /* - -From 6fc9d40bec5dbcf3ae8b52ab6850ed0b18193c82 Mon Sep 17 00:00:00 2001 -From: popcornmix <popcornmix@gmail.com> -Date: Mon, 28 Sep 2015 23:38:59 +0100 -Subject: [PATCH 087/170] irq-bcm2835: Fix building with 2708 - ---- - drivers/irqchip/irq-bcm2835.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/drivers/irqchip/irq-bcm2835.c b/drivers/irqchip/irq-bcm2835.c -index 20deb28..c02bf8a 100644 ---- a/drivers/irqchip/irq-bcm2835.c -+++ b/drivers/irqchip/irq-bcm2835.c -@@ -82,6 +82,7 @@ - #define NR_BANKS 3 - #define IRQS_PER_BANK 32 - #define NUMBER_IRQS MAKE_HWIRQ(NR_BANKS, 0) -+#undef FIQ_START - #define FIQ_START (NR_IRQS_BANK0 + MAKE_HWIRQ(NR_BANKS - 1, 0)) - - static const int reg_pending[] __initconst = { 0x00, 0x04, 0x08 }; -@@ -256,7 +257,7 @@ static int __init armctrl_of_init(struct device_node *node, - MAKE_HWIRQ(b, i) + NUMBER_IRQS); - BUG_ON(irq <= 0); - irq_set_chip(irq, &armctrl_chip); -- set_irq_flags(irq, IRQF_VALID | IRQF_PROBE); -+ irq_set_probe(irq); - } - } - init_FIQ(FIQ_START); - -From 0e7ec1e61b149567d5af63169cd4d701c133356f Mon Sep 17 00:00:00 2001 -From: P33M <P33M@github.com> -Date: Wed, 21 Oct 2015 14:55:21 +0100 -Subject: [PATCH 088/170] rpi_display: add backlight driver and overlay - -Add a mailbox-driven backlight controller for the Raspberry Pi DSI -touchscreen display. Requires updated GPU firmware to recognise the -mailbox request. - -Signed-off-by: Gordon Hollingworth <gordon@raspberrypi.org> ---- - arch/arm/boot/dts/overlays/Makefile | 1 + - arch/arm/boot/dts/overlays/README | 6 ++ - .../boot/dts/overlays/rpi-backlight-overlay.dts | 21 ++++ - arch/arm/configs/bcm2709_defconfig | 1 + - arch/arm/configs/bcmrpi_defconfig | 1 + - drivers/video/backlight/Kconfig | 6 ++ - drivers/video/backlight/Makefile | 1 + - drivers/video/backlight/rpi_backlight.c | 119 +++++++++++++++++++++ - include/soc/bcm2835/raspberrypi-firmware.h | 1 + - 9 files changed, 157 insertions(+) - create mode 100644 arch/arm/boot/dts/overlays/rpi-backlight-overlay.dts - create mode 100644 drivers/video/backlight/rpi_backlight.c - -diff --git a/arch/arm/boot/dts/overlays/Makefile b/arch/arm/boot/dts/overlays/Makefile -index d8c2771..fb7ac49 100644 ---- a/arch/arm/boot/dts/overlays/Makefile -+++ b/arch/arm/boot/dts/overlays/Makefile -@@ -38,6 +38,7 @@ dtb-$(RPI_DT_OVERLAYS) += pps-gpio-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += pwm-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += pwm-2chan-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += raspidac3-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += rpi-backlight-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += rpi-dac-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += rpi-display-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += rpi-ft5406-overlay.dtb -diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README -index 44e33a4..b819293 100644 ---- a/arch/arm/boot/dts/overlays/README -+++ b/arch/arm/boot/dts/overlays/README -@@ -462,6 +462,12 @@ Load: dtoverlay=raspidac3 - Params: <None> - - -+Name: rpi-backlight -+Info: Raspberry Pi official display backlight driver -+Load: dtoverlay=rpi-backlight -+Params: <None> -+ -+ - Name: rpi-dac - Info: Configures the RPi DAC audio card - Load: dtoverlay=rpi-dac -diff --git a/arch/arm/boot/dts/overlays/rpi-backlight-overlay.dts b/arch/arm/boot/dts/overlays/rpi-backlight-overlay.dts -new file mode 100644 -index 0000000..c021d02 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/rpi-backlight-overlay.dts -@@ -0,0 +1,21 @@ -+/* -+ * Devicetree overlay for mailbox-driven Raspberry Pi DSI Display -+ * backlight controller -+ */ -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target-path = "/"; -+ __overlay__ { -+ rpi_backlight: rpi_backlight { -+ compatible = "raspberrypi,rpi-backlight"; -+ firmware = <&firmware>; -+ status = "okay"; -+ }; -+ }; -+ }; -+}; -diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig -index 16062bf..13999af 100644 ---- a/arch/arm/configs/bcm2709_defconfig -+++ b/arch/arm/configs/bcm2709_defconfig -@@ -808,6 +808,7 @@ CONFIG_FB_UDL=m - CONFIG_FB_SSD1307=m - CONFIG_FB_RPISENSE=m - # CONFIG_BACKLIGHT_GENERIC is not set -+CONFIG_BACKLIGHT_RPI=m - CONFIG_BACKLIGHT_GPIO=m - CONFIG_FRAMEBUFFER_CONSOLE=y - CONFIG_LOGO=y -diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig -index 1d1b799..146add9 100644 ---- a/arch/arm/configs/bcmrpi_defconfig -+++ b/arch/arm/configs/bcmrpi_defconfig -@@ -801,6 +801,7 @@ CONFIG_FB_UDL=m - CONFIG_FB_SSD1307=m - CONFIG_FB_RPISENSE=m - # CONFIG_BACKLIGHT_GENERIC is not set -+CONFIG_BACKLIGHT_RPI=m - CONFIG_BACKLIGHT_GPIO=m - CONFIG_FRAMEBUFFER_CONSOLE=y - CONFIG_LOGO=y -diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig -index 5ffa4b4..c3023ab 100644 ---- a/drivers/video/backlight/Kconfig -+++ b/drivers/video/backlight/Kconfig -@@ -265,6 +265,12 @@ config BACKLIGHT_PWM - If you have a LCD backlight adjustable by PWM, say Y to enable - this driver. - -+config BACKLIGHT_RPI -+ tristate "Raspberry Pi display firmware driven backlight" -+ help -+ If you have the Raspberry Pi DSI touchscreen display, say Y to -+ enable the mailbox-controlled backlight driver. -+ - config BACKLIGHT_DA903X - tristate "Backlight Driver for DA9030/DA9034 using WLED" - depends on PMIC_DA903X -diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile -index 16ec534..00eff87 100644 ---- a/drivers/video/backlight/Makefile -+++ b/drivers/video/backlight/Makefile -@@ -50,6 +50,7 @@ obj-$(CONFIG_BACKLIGHT_PANDORA) += pandora_bl.o - obj-$(CONFIG_BACKLIGHT_PCF50633) += pcf50633-backlight.o - obj-$(CONFIG_BACKLIGHT_PM8941_WLED) += pm8941-wled.o - obj-$(CONFIG_BACKLIGHT_PWM) += pwm_bl.o -+obj-$(CONFIG_BACKLIGHT_RPI) += rpi_backlight.o - obj-$(CONFIG_BACKLIGHT_SAHARA) += kb3886_bl.o - obj-$(CONFIG_BACKLIGHT_SKY81452) += sky81452-backlight.o - obj-$(CONFIG_BACKLIGHT_TOSA) += tosa_bl.o -diff --git a/drivers/video/backlight/rpi_backlight.c b/drivers/video/backlight/rpi_backlight.c -new file mode 100644 -index 0000000..14a0d9b ---- /dev/null -+++ b/drivers/video/backlight/rpi_backlight.c -@@ -0,0 +1,119 @@ -+/* -+ * rpi_bl.c - Backlight controller through VPU -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 as -+ * published by the Free Software Foundation. -+ */ -+ -+#include <linux/backlight.h> -+#include <linux/err.h> -+#include <linux/fb.h> -+#include <linux/gpio.h> -+#include <linux/init.h> -+#include <linux/kernel.h> -+#include <linux/module.h> -+#include <linux/of.h> -+#include <linux/of_gpio.h> -+#include <linux/platform_device.h> -+#include <linux/slab.h> -+#include <soc/bcm2835/raspberrypi-firmware.h> -+ -+struct rpi_backlight { -+ struct device *dev; -+ struct device *fbdev; -+ struct rpi_firmware *fw; -+}; -+ -+static int rpi_backlight_update_status(struct backlight_device *bl) -+{ -+ struct rpi_backlight *gbl = bl_get_data(bl); -+ int brightness = bl->props.brightness; -+ int ret; -+ -+ if (bl->props.power != FB_BLANK_UNBLANK || -+ bl->props.fb_blank != FB_BLANK_UNBLANK || -+ bl->props.state & (BL_CORE_SUSPENDED | BL_CORE_FBBLANK)) -+ brightness = 0; -+ -+ ret = rpi_firmware_property(gbl->fw, -+ RPI_FIRMWARE_FRAMEBUFFER_SET_BACKLIGHT, -+ &brightness, sizeof(brightness)); -+ if (ret) { -+ dev_err(gbl->dev, "Failed to set brightness\n"); -+ return ret; -+ } -+ -+ if (brightness < 0) { -+ dev_err(gbl->dev, "Backlight change failed\n"); -+ return -EAGAIN; -+ } -+ -+ return 0; -+} -+ -+static const struct backlight_ops rpi_backlight_ops = { -+ .options = BL_CORE_SUSPENDRESUME, -+ .update_status = rpi_backlight_update_status, -+}; -+ -+static int rpi_backlight_probe(struct platform_device *pdev) -+{ -+ struct backlight_properties props; -+ struct backlight_device *bl; -+ struct rpi_backlight *gbl; -+ struct device_node *fw_node; -+ -+ gbl = devm_kzalloc(&pdev->dev, sizeof(*gbl), GFP_KERNEL); -+ if (gbl == NULL) -+ return -ENOMEM; -+ -+ gbl->dev = &pdev->dev; -+ -+ fw_node = of_parse_phandle(pdev->dev.of_node, "firmware", 0); -+ if (!fw_node) { -+ dev_err(&pdev->dev, "Missing firmware node\n"); -+ return -ENOENT; -+ } -+ -+ gbl->fw = rpi_firmware_get(fw_node); -+ if (!gbl->fw) -+ return -EPROBE_DEFER; -+ -+ memset(&props, 0, sizeof(props)); -+ props.type = BACKLIGHT_RAW; -+ props.max_brightness = 255; -+ bl = devm_backlight_device_register(&pdev->dev, dev_name(&pdev->dev), -+ &pdev->dev, gbl, &rpi_backlight_ops, -+ &props); -+ if (IS_ERR(bl)) { -+ dev_err(&pdev->dev, "failed to register backlight\n"); -+ return PTR_ERR(bl); -+ } -+ -+ bl->props.brightness = 255; -+ backlight_update_status(bl); -+ -+ platform_set_drvdata(pdev, bl); -+ return 0; -+} -+ -+static const struct of_device_id rpi_backlight_of_match[] = { -+ { .compatible = "raspberrypi,rpi-backlight" }, -+ { /* sentinel */ } -+}; -+MODULE_DEVICE_TABLE(of, rpi_backlight_of_match); -+ -+static struct platform_driver rpi_backlight_driver = { -+ .driver = { -+ .name = "rpi-backlight", -+ .of_match_table = of_match_ptr(rpi_backlight_of_match), -+ }, -+ .probe = rpi_backlight_probe, -+}; -+ -+module_platform_driver(rpi_backlight_driver); -+ -+MODULE_AUTHOR("Gordon Hollingworth <gordon@raspberrypi.org>"); -+MODULE_DESCRIPTION("Raspberry Pi mailbox based Backlight Driver"); -+MODULE_LICENSE("GPL"); -diff --git a/include/soc/bcm2835/raspberrypi-firmware.h b/include/soc/bcm2835/raspberrypi-firmware.h -index 525816d..b011489 100644 ---- a/include/soc/bcm2835/raspberrypi-firmware.h -+++ b/include/soc/bcm2835/raspberrypi-firmware.h -@@ -112,6 +112,7 @@ enum rpi_firmware_property_tag { - RPI_FIRMWARE_FRAMEBUFFER_SET_OVERSCAN = 0x0004800a, - RPI_FIRMWARE_FRAMEBUFFER_SET_PALETTE = 0x0004800b, - RPI_FIRMWARE_FRAMEBUFFER_SET_VSYNC = 0x0004800e, -+ RPI_FIRMWARE_FRAMEBUFFER_SET_BACKLIGHT = 0x0004800f, - - RPI_FIRMWARE_VCHIQ_INIT = 0x00048010, - - -From 0459ca97c1f2753ce805ab58ff17847cb4c142e0 Mon Sep 17 00:00:00 2001 -From: Matthias Reichl <hias@horus.com> -Date: Mon, 16 Nov 2015 14:05:35 +0000 -Subject: [PATCH 089/170] bcm2835-dma: Fix up convert to DMA pool - ---- - drivers/dma/bcm2835-dma.c | 36 ++++++++++++++++++++++++++---------- - 1 file changed, 26 insertions(+), 10 deletions(-) - -diff --git a/drivers/dma/bcm2835-dma.c b/drivers/dma/bcm2835-dma.c -index 0adc347..985019b 100644 ---- a/drivers/dma/bcm2835-dma.c -+++ b/drivers/dma/bcm2835-dma.c -@@ -488,6 +488,17 @@ static struct dma_async_tx_descriptor *bcm2835_dma_prep_dma_cyclic( - c->cyclic = true; - - return vchan_tx_prep(&c->vc, &d->vd, flags); -+error_cb: -+ i--; -+ for (; i >= 0; i--) { -+ struct bcm2835_cb_entry *cb_entry = &d->cb_list[i]; -+ -+ dma_pool_free(c->cb_pool, cb_entry->cb, cb_entry->paddr); -+ } -+ -+ kfree(d->cb_list); -+ kfree(d); -+ return NULL; - } - - static struct dma_async_tx_descriptor * -@@ -534,6 +545,7 @@ bcm2835_dma_prep_slave_sg(struct dma_chan *chan, - if (!d) - return NULL; - -+ d->c = c; - d->dir = direction; - - if (c->ch >= 8) /* LITE channel */ -@@ -553,15 +565,21 @@ bcm2835_dma_prep_slave_sg(struct dma_chan *chan, - d->frames += len / max_size + 1; - } - -- /* Allocate memory for control blocks */ -- d->control_block_size = d->frames * sizeof(struct bcm2835_dma_cb); -- d->control_block_base = dma_zalloc_coherent(chan->device->dev, -- d->control_block_size, &d->control_block_base_phys, -- GFP_NOWAIT); -- if (!d->control_block_base) { -+ d->cb_list = kcalloc(d->frames, sizeof(*d->cb_list), GFP_KERNEL); -+ if (!d->cb_list) { - kfree(d); - return NULL; - } -+ /* Allocate memory for control blocks */ -+ for (i = 0; i < d->frames; i++) { -+ struct bcm2835_cb_entry *cb_entry = &d->cb_list[i]; -+ -+ cb_entry->cb = dma_pool_zalloc(c->cb_pool, GFP_ATOMIC, -+ &cb_entry->paddr); -+ -+ if (!cb_entry->cb) -+ goto error_cb; -+ } - - /* - * Iterate over all SG entries, create a control block -@@ -578,7 +596,7 @@ bcm2835_dma_prep_slave_sg(struct dma_chan *chan, - - for (j = 0; j < len; j += max_size) { - struct bcm2835_dma_cb *control_block = -- &d->control_block_base[i + split_cnt]; -+ d->cb_list[i + split_cnt].cb; - - /* Setup addresses */ - if (d->dir == DMA_DEV_TO_MEM) { -@@ -620,9 +638,7 @@ bcm2835_dma_prep_slave_sg(struct dma_chan *chan, - if (i < sg_len - 1 || len - j > max_size) { - /* Next block is the next frame. */ - control_block->next = -- d->control_block_base_phys + -- sizeof(struct bcm2835_dma_cb) * -- (i + split_cnt + 1); -+ d->cb_list[i + split_cnt + 1].paddr; - } else { - /* Next block is empty. */ - control_block->next = 0; - -From f6dd60426dc7970ef4e9e3d9e00d374f80a6abd2 Mon Sep 17 00:00:00 2001 -From: Phil Elwell <phil@raspberrypi.org> -Date: Wed, 11 Nov 2015 11:38:59 +0000 -Subject: [PATCH 090/170] scripts: Multi-platform support for mkknlimg and - knlinfo - -The firmware uses tags in the kernel trailer to choose which dtb file -to load. Current firmware loads bcm2835-*.dtb if the '283x' tag is true, -otherwise it loads bcm270*.dtb. This scheme breaks if an image supports -multiple platforms. - -This patch adds '270X' and '283X' tags to indicate support for RPi and -upstream platforms, respectively. '283x' (note lower case 'x') is left -for old firmware, and is only set if the image only supports upstream -builds. ---- - scripts/knlinfo | 2 + - scripts/mkknlimg | 136 +++++++++++++++++++++++++++++++------------------------ - 2 files changed, 80 insertions(+), 58 deletions(-) - -diff --git a/scripts/knlinfo b/scripts/knlinfo -index a0e8663..b9ef124 100755 ---- a/scripts/knlinfo -+++ b/scripts/knlinfo -@@ -18,6 +18,8 @@ my %atom_formats = - ( - 'DTOK' => \&format_bool, - 'KVer' => \&format_string, -+ '270X' => \&format_bool, -+ '283X' => \&format_bool, - '283x' => \&format_bool, - ); - -diff --git a/scripts/mkknlimg b/scripts/mkknlimg -index 3998d43..005f404 100755 ---- a/scripts/mkknlimg -+++ b/scripts/mkknlimg -@@ -13,12 +13,20 @@ use strict; - use warnings; - use integer; - -+use constant FLAG_PI => 0x01; -+use constant FLAG_DTOK => 0x02; -+use constant FLAG_DDTK => 0x04; -+use constant FLAG_270X => 0x08; -+use constant FLAG_283X => 0x10; -+ - my $trailer_magic = 'RPTL'; - - my $tmpfile1 = "/tmp/mkknlimg_$$.1"; - my $tmpfile2 = "/tmp/mkknlimg_$$.2"; - - my $dtok = 0; -+my $ddtk = 0; -+my $is_270x = 0; - my $is_283x = 0; - - while (@ARGV && ($ARGV[0] =~ /^-/)) -@@ -28,6 +36,14 @@ while (@ARGV && ($ARGV[0] =~ /^-/)) - { - $dtok = 1; - } -+ elsif ($arg eq '--ddtk') -+ { -+ $ddtk = 1; -+ } -+ elsif ($arg eq '--270x') -+ { -+ $is_270x = 1; -+ } - elsif ($arg eq '--283x') - { - $is_283x = 1; -@@ -50,30 +66,33 @@ if (! -r $kernel_file) - usage(); - } - --my @wanted_strings = --( -- 'bcm2708_fb', -- 'brcm,bcm2835-mmc', -- 'brcm,bcm2835-sdhost', -- 'brcm,bcm2708-pinctrl', -- 'brcm,bcm2835-gpio', -- 'brcm,bcm2835', -- 'brcm,bcm2836' --); -+my $wanted_strings = -+{ -+ 'bcm2708_fb' => FLAG_PI, -+ 'brcm,bcm2835-mmc' => FLAG_PI, -+ 'brcm,bcm2835-sdhost' => FLAG_PI, -+ 'brcm,bcm2708-pinctrl' => FLAG_PI | FLAG_DTOK, -+ 'brcm,bcm2835-gpio' => FLAG_PI | FLAG_DTOK, -+ 'brcm,bcm2708' => FLAG_PI | FLAG_DTOK | FLAG_270X, -+ 'brcm,bcm2709' => FLAG_PI | FLAG_DTOK | FLAG_270X, -+ 'brcm,bcm2835' => FLAG_PI | FLAG_DTOK | FLAG_283X, -+ 'brcm,bcm2836' => FLAG_PI | FLAG_DTOK | FLAG_283X, -+ 'of_overlay_apply' => FLAG_DTOK | FLAG_DDTK, -+}; - - my $res = try_extract($kernel_file, $tmpfile1); --$res = try_decompress('\037\213\010', 'xy', 'gunzip', 0, -- $kernel_file, $tmpfile1, $tmpfile2) if (!$res); --$res = try_decompress('\3757zXZ\000', 'abcde', 'unxz --single-stream', -1, -- $kernel_file, $tmpfile1, $tmpfile2) if (!$res); --$res = try_decompress('BZh', 'xy', 'bunzip2', 0, -- $kernel_file, $tmpfile1, $tmpfile2) if (!$res); --$res = try_decompress('\135\0\0\0', 'xxx', 'unlzma', 0, -- $kernel_file, $tmpfile1, $tmpfile2) if (!$res); --$res = try_decompress('\211\114\132', 'xy', 'lzop -d', 0, -- $kernel_file, $tmpfile1, $tmpfile2) if (!$res); --$res = try_decompress('\002\041\114\030', 'xy', 'lz4 -d', 1, -- $kernel_file, $tmpfile1, $tmpfile2) if (!$res); -+$res ||= try_decompress('\037\213\010', 'xy', 'gunzip', 0, -+ $kernel_file, $tmpfile1, $tmpfile2); -+$res ||= try_decompress('\3757zXZ\000', 'abcde', 'unxz --single-stream', -1, -+ $kernel_file, $tmpfile1, $tmpfile2); -+$res ||= try_decompress('BZh', 'xy', 'bunzip2', 0, -+ $kernel_file, $tmpfile1, $tmpfile2); -+$res ||= try_decompress('\135\0\0\0', 'xxx', 'unlzma', 0, -+ $kernel_file, $tmpfile1, $tmpfile2); -+$res ||= try_decompress('\211\114\132', 'xy', 'lzop -d', 0, -+ $kernel_file, $tmpfile1, $tmpfile2); -+$res ||= try_decompress('\002\041\114\030', 'xy', 'lz4 -d', 1, -+ $kernel_file, $tmpfile1, $tmpfile2); - - my $append_trailer; - my $trailer; -@@ -83,27 +102,21 @@ $append_trailer = $dtok; - - if ($res) - { -- $kver = $res->{''} || '?'; -+ $kver = $res->{'kver'} || '?'; -+ my $flags = $res->{'flags'}; - print("Version: $kver\n"); - -- $append_trailer = $dtok; -- if (!$dtok) -+ if ($flags & FLAG_PI) - { -- if (config_bool($res, 'bcm2708_fb') || -- config_bool($res, 'brcm,bcm2835-mmc') || -- config_bool($res, 'brcm,bcm2835-sdhost')) -- { -- $dtok ||= config_bool($res, 'brcm,bcm2708-pinctrl'); -- $dtok ||= config_bool($res, 'brcm,bcm2835-gpio'); -- $is_283x ||= config_bool($res, 'brcm,bcm2835'); -- $is_283x ||= config_bool($res, 'brcm,bcm2836'); -- $dtok ||= $is_283x; -- $append_trailer = 1; -- } -- else -- { -- print ("* This doesn't look like a Raspberry Pi kernel. In pass-through mode.\n"); -- } -+ $append_trailer = 1; -+ $dtok ||= ($flags & FLAG_DTOK) != 0; -+ $is_270x ||= ($flags & FLAG_270X) != 0; -+ $is_283x ||= ($flags & FLAG_283X) != 0; -+ $ddtk ||= ($flags & FLAG_DDTK) != 0; -+ } -+ else -+ { -+ print ("* This doesn't look like a Raspberry Pi kernel. In pass-through mode.\n"); - } - } - elsif (!$dtok) -@@ -114,6 +127,8 @@ elsif (!$dtok) - if ($append_trailer) - { - printf("DT: %s\n", $dtok ? "y" : "n"); -+ printf("DDT: %s\n", $ddtk ? "y" : "n") if ($ddtk); -+ printf("270x: %s\n", $is_270x ? "y" : "n"); - printf("283x: %s\n", $is_283x ? "y" : "n"); - - my @atoms; -@@ -121,7 +136,10 @@ if ($append_trailer) - push @atoms, [ $trailer_magic, pack('V', 0) ]; - push @atoms, [ 'KVer', $kver ]; - push @atoms, [ 'DTOK', pack('V', $dtok) ]; -- push @atoms, [ '283x', pack('V', $is_283x) ]; -+ push @atoms, [ 'DDTK', pack('V', $ddtk) ] if ($ddtk); -+ push @atoms, [ '270X', pack('V', $is_270x) ]; -+ push @atoms, [ '283X', pack('V', $is_283x) ]; -+ push @atoms, [ '283x', pack('V', $is_283x && !$is_270x) ]; - - $trailer = pack_trailer(\@atoms); - $atoms[0]->[1] = pack('V', length($trailer)); -@@ -175,7 +193,7 @@ END { - - sub usage - { -- print ("Usage: mkknlimg [--dtok] [--283x] <vmlinux|zImage|bzImage> <outfile>\n"); -+ print ("Usage: mkknlimg [--dtok] [--270x] [--283x] <vmlinux|zImage|bzImage> <outfile>\n"); - exit(1); - } - -@@ -189,15 +207,8 @@ sub try_extract - - chomp($ver); - -- my $res = { ''=>$ver }; -- my $string_pattern = '^('.join('|', @wanted_strings).')$'; -- -- my @matches = `strings \"$knl\" | grep -E \"$string_pattern\"`; -- foreach my $match (@matches) -- { -- chomp($match); -- $res->{$match} = 1; -- } -+ my $res = { 'kver'=>$ver }; -+ $res->{'flags'} = strings_to_flags($knl, $wanted_strings); - - return $res; - } -@@ -224,6 +235,22 @@ sub try_decompress - return undef; - } - -+sub strings_to_flags -+{ -+ my ($knl, $strings) = @_; -+ my $string_pattern = '^('.join('|', keys(%$strings)).')$'; -+ my $flags = 0; -+ -+ my @matches = `strings \"$knl\" | grep -E \"$string_pattern\"`; -+ foreach my $match (@matches) -+ { -+ chomp($match); -+ $flags |= $strings->{$match}; -+ } -+ -+ return $flags; -+} -+ - sub pack_trailer - { - my ($atoms) = @_; -@@ -235,10 +262,3 @@ sub pack_trailer - } - return $trailer; - } -- --sub config_bool --{ -- my ($configs, $wanted) = @_; -- my $val = $configs->{$wanted} || 'n'; -- return (($val eq 'y') || ($val eq '1')); --} - -From 6d38553e5ce7fb70dd1f89665caf58064a7e97d7 Mon Sep 17 00:00:00 2001 -From: Eric Anholt <eric@anholt.net> -Date: Mon, 2 Mar 2015 13:01:12 -0800 -Subject: [PATCH 091/170] drm/vc4: Add suport for 3D rendering using the V3D - engine. - -This is a squash of the out-of-tree development series. Since that -series contained code from the first "get a demo triangle rendered -using a hacked up driver using binary shader code" to "plug the last -known security hole", it's hard to reconstruct a different series of -incremental development that's mergeable without security holes -throughout it. - -Signed-off-by: Eric Anholt <eric@anholt.net> ---- - drivers/gpu/drm/vc4/Makefile | 11 +- - drivers/gpu/drm/vc4/vc4_bo.c | 476 +++++++++++++- - drivers/gpu/drm/vc4/vc4_crtc.c | 98 ++- - drivers/gpu/drm/vc4/vc4_debugfs.c | 3 + - drivers/gpu/drm/vc4/vc4_drv.c | 45 +- - drivers/gpu/drm/vc4/vc4_drv.h | 317 ++++++++++ - drivers/gpu/drm/vc4/vc4_gem.c | 686 +++++++++++++++++++++ - drivers/gpu/drm/vc4/vc4_irq.c | 211 +++++++ - drivers/gpu/drm/vc4/vc4_kms.c | 148 ++++- - drivers/gpu/drm/vc4/vc4_packet.h | 384 ++++++++++++ - drivers/gpu/drm/vc4/vc4_plane.c | 40 ++ - drivers/gpu/drm/vc4/vc4_qpu_defines.h | 268 ++++++++ - drivers/gpu/drm/vc4/vc4_render_cl.c | 448 ++++++++++++++ - drivers/gpu/drm/vc4/vc4_trace.h | 63 ++ - drivers/gpu/drm/vc4/vc4_trace_points.c | 14 + - drivers/gpu/drm/vc4/vc4_v3d.c | 268 ++++++++ - drivers/gpu/drm/vc4/vc4_validate.c | 958 +++++++++++++++++++++++++++++ - drivers/gpu/drm/vc4/vc4_validate_shaders.c | 521 ++++++++++++++++ - include/uapi/drm/vc4_drm.h | 229 +++++++ - 19 files changed, 5173 insertions(+), 15 deletions(-) - create mode 100644 drivers/gpu/drm/vc4/vc4_gem.c - create mode 100644 drivers/gpu/drm/vc4/vc4_irq.c - create mode 100644 drivers/gpu/drm/vc4/vc4_packet.h - create mode 100644 drivers/gpu/drm/vc4/vc4_qpu_defines.h - create mode 100644 drivers/gpu/drm/vc4/vc4_render_cl.c - create mode 100644 drivers/gpu/drm/vc4/vc4_trace.h - create mode 100644 drivers/gpu/drm/vc4/vc4_trace_points.c - create mode 100644 drivers/gpu/drm/vc4/vc4_v3d.c - create mode 100644 drivers/gpu/drm/vc4/vc4_validate.c - create mode 100644 drivers/gpu/drm/vc4/vc4_validate_shaders.c - create mode 100644 include/uapi/drm/vc4_drm.h - -diff --git a/drivers/gpu/drm/vc4/Makefile b/drivers/gpu/drm/vc4/Makefile -index 32b4f9c..4c6a99f 100644 ---- a/drivers/gpu/drm/vc4/Makefile -+++ b/drivers/gpu/drm/vc4/Makefile -@@ -8,10 +8,19 @@ vc4-y := \ - vc4_crtc.o \ - vc4_drv.o \ - vc4_kms.o \ -+ vc4_gem.o \ - vc4_hdmi.o \ - vc4_hvs.o \ -- vc4_plane.o -+ vc4_irq.o \ -+ vc4_plane.o \ -+ vc4_render_cl.o \ -+ vc4_trace_points.o \ -+ vc4_v3d.o \ -+ vc4_validate.o \ -+ vc4_validate_shaders.o - - vc4-$(CONFIG_DEBUG_FS) += vc4_debugfs.o - - obj-$(CONFIG_DRM_VC4) += vc4.o -+ -+CFLAGS_vc4_trace_points.o := -I$(src) -diff --git a/drivers/gpu/drm/vc4/vc4_bo.c b/drivers/gpu/drm/vc4/vc4_bo.c -index ab9f510..bfa605f 100644 ---- a/drivers/gpu/drm/vc4/vc4_bo.c -+++ b/drivers/gpu/drm/vc4/vc4_bo.c -@@ -15,16 +15,174 @@ - */ - - #include "vc4_drv.h" -+#include "uapi/drm/vc4_drm.h" - --struct vc4_bo *vc4_bo_create(struct drm_device *dev, size_t size) -+static void vc4_bo_stats_dump(struct vc4_dev *vc4) - { -+ DRM_INFO("num bos allocated: %d\n", -+ vc4->bo_stats.num_allocated); -+ DRM_INFO("size bos allocated: %dkb\n", -+ vc4->bo_stats.size_allocated / 1024); -+ DRM_INFO("num bos used: %d\n", -+ vc4->bo_stats.num_allocated - vc4->bo_stats.num_cached); -+ DRM_INFO("size bos used: %dkb\n", -+ (vc4->bo_stats.size_allocated - -+ vc4->bo_stats.size_cached) / 1024); -+ DRM_INFO("num bos cached: %d\n", -+ vc4->bo_stats.num_cached); -+ DRM_INFO("size bos cached: %dkb\n", -+ vc4->bo_stats.size_cached / 1024); -+} -+ -+static uint32_t bo_page_index(size_t size) -+{ -+ return (size / PAGE_SIZE) - 1; -+} -+ -+/* Must be called with bo_lock held. */ -+static void vc4_bo_destroy(struct vc4_bo *bo) -+{ -+ struct drm_gem_object *obj = &bo->base.base; -+ struct vc4_dev *vc4 = to_vc4_dev(obj->dev); -+ -+ if (bo->validated_shader) { -+ kfree(bo->validated_shader->texture_samples); -+ kfree(bo->validated_shader); -+ bo->validated_shader = NULL; -+ } -+ -+ vc4->bo_stats.num_allocated--; -+ vc4->bo_stats.size_allocated -= obj->size; -+ drm_gem_cma_free_object(obj); -+} -+ -+/* Must be called with bo_lock held. */ -+static void vc4_bo_remove_from_cache(struct vc4_bo *bo) -+{ -+ struct drm_gem_object *obj = &bo->base.base; -+ struct vc4_dev *vc4 = to_vc4_dev(obj->dev); -+ -+ vc4->bo_stats.num_cached--; -+ vc4->bo_stats.size_cached -= obj->size; -+ -+ list_del(&bo->unref_head); -+ list_del(&bo->size_head); -+} -+ -+static struct list_head *vc4_get_cache_list_for_size(struct drm_device *dev, -+ size_t size) -+{ -+ struct vc4_dev *vc4 = to_vc4_dev(dev); -+ uint32_t page_index = bo_page_index(size); -+ -+ if (vc4->bo_cache.size_list_size <= page_index) { -+ uint32_t new_size = max(vc4->bo_cache.size_list_size * 2, -+ page_index + 1); -+ struct list_head *new_list; -+ uint32_t i; -+ -+ new_list = kmalloc(new_size * sizeof(struct list_head), -+ GFP_KERNEL); -+ if (!new_list) -+ return NULL; -+ -+ /* Rebase the old cached BO lists to their new list -+ * head locations. -+ */ -+ for (i = 0; i < vc4->bo_cache.size_list_size; i++) { -+ struct list_head *old_list = &vc4->bo_cache.size_list[i]; -+ if (list_empty(old_list)) -+ INIT_LIST_HEAD(&new_list[i]); -+ else -+ list_replace(old_list, &new_list[i]); -+ } -+ /* And initialize the brand new BO list heads. */ -+ for (i = vc4->bo_cache.size_list_size; i < new_size; i++) -+ INIT_LIST_HEAD(&new_list[i]); -+ -+ kfree(vc4->bo_cache.size_list); -+ vc4->bo_cache.size_list = new_list; -+ vc4->bo_cache.size_list_size = new_size; -+ } -+ -+ return &vc4->bo_cache.size_list[page_index]; -+} -+ -+void vc4_bo_cache_purge(struct drm_device *dev) -+{ -+ struct vc4_dev *vc4 = to_vc4_dev(dev); -+ -+ spin_lock(&vc4->bo_lock); -+ while (!list_empty(&vc4->bo_cache.time_list)) { -+ struct vc4_bo *bo = list_last_entry(&vc4->bo_cache.time_list, -+ struct vc4_bo, unref_head); -+ vc4_bo_remove_from_cache(bo); -+ vc4_bo_destroy(bo); -+ } -+ spin_unlock(&vc4->bo_lock); -+} -+ -+struct vc4_bo *vc4_bo_create(struct drm_device *dev, size_t unaligned_size) -+{ -+ struct vc4_dev *vc4 = to_vc4_dev(dev); -+ uint32_t size = roundup(unaligned_size, PAGE_SIZE); -+ uint32_t page_index = bo_page_index(size); - struct drm_gem_cma_object *cma_obj; -+ int pass; - -- cma_obj = drm_gem_cma_create(dev, size); -- if (IS_ERR(cma_obj)) -+ if (size == 0) - return NULL; -- else -- return to_vc4_bo(&cma_obj->base); -+ -+ /* First, try to get a vc4_bo from the kernel BO cache. */ -+ spin_lock(&vc4->bo_lock); -+ if (page_index < vc4->bo_cache.size_list_size && -+ !list_empty(&vc4->bo_cache.size_list[page_index])) { -+ struct vc4_bo *bo = -+ list_first_entry(&vc4->bo_cache.size_list[page_index], -+ struct vc4_bo, size_head); -+ vc4_bo_remove_from_cache(bo); -+ spin_unlock(&vc4->bo_lock); -+ kref_init(&bo->base.base.refcount); -+ return bo; -+ } -+ spin_unlock(&vc4->bo_lock); -+ -+ /* Otherwise, make a new BO. */ -+ for (pass = 0; ; pass++) { -+ cma_obj = drm_gem_cma_create(dev, size); -+ if (!IS_ERR(cma_obj)) -+ break; -+ -+ switch (pass) { -+ case 0: -+ /* -+ * If we've run out of CMA memory, kill the cache of -+ * CMA allocations we've got laying around and try again. -+ */ -+ vc4_bo_cache_purge(dev); -+ break; -+ case 1: -+ /* -+ * Getting desperate, so try to wait for any -+ * previous rendering to finish, free its -+ * unreferenced BOs to the cache, and then -+ * free the cache. -+ */ -+ vc4_wait_for_seqno(dev, vc4->emit_seqno, ~0ull, true); -+ vc4_job_handle_completed(vc4); -+ vc4_bo_cache_purge(dev); -+ break; -+ case 3: -+ DRM_ERROR("Failed to allocate from CMA:\n"); -+ vc4_bo_stats_dump(vc4); -+ return NULL; -+ } -+ } -+ -+ vc4->bo_stats.num_allocated++; -+ vc4->bo_stats.size_allocated += size; -+ -+ return to_vc4_bo(&cma_obj->base); - } - - int vc4_dumb_create(struct drm_file *file_priv, -@@ -41,7 +199,7 @@ int vc4_dumb_create(struct drm_file *file_priv, - if (args->size < args->pitch * args->height) - args->size = args->pitch * args->height; - -- bo = vc4_bo_create(dev, roundup(args->size, PAGE_SIZE)); -+ bo = vc4_bo_create(dev, args->size); - if (!bo) - return -ENOMEM; - -@@ -50,3 +208,309 @@ int vc4_dumb_create(struct drm_file *file_priv, - - return ret; - } -+ -+static void -+vc4_bo_cache_free_old(struct drm_device *dev) -+{ -+ struct vc4_dev *vc4 = to_vc4_dev(dev); -+ unsigned long expire_time = jiffies - msecs_to_jiffies(1000); -+ -+ spin_lock(&vc4->bo_lock); -+ while (!list_empty(&vc4->bo_cache.time_list)) { -+ struct vc4_bo *bo = list_last_entry(&vc4->bo_cache.time_list, -+ struct vc4_bo, unref_head); -+ if (time_before(expire_time, bo->free_time)) { -+ mod_timer(&vc4->bo_cache.time_timer, -+ round_jiffies_up(jiffies + -+ msecs_to_jiffies(1000))); -+ spin_unlock(&vc4->bo_lock); -+ return; -+ } -+ -+ vc4_bo_remove_from_cache(bo); -+ vc4_bo_destroy(bo); -+ } -+ spin_unlock(&vc4->bo_lock); -+} -+ -+/* Called on the last userspace/kernel unreference of the BO. Returns -+ * it to the BO cache if possible, otherwise frees it. -+ * -+ * Note that this is called with the struct_mutex held. -+ */ -+void vc4_free_object(struct drm_gem_object *gem_bo) -+{ -+ struct drm_device *dev = gem_bo->dev; -+ struct vc4_dev *vc4 = to_vc4_dev(dev); -+ struct vc4_bo *bo = to_vc4_bo(gem_bo); -+ struct list_head *cache_list; -+ -+ /* If the object references someone else's memory, we can't cache it. -+ */ -+ if (gem_bo->import_attach) { -+ vc4_bo_destroy(bo); -+ return; -+ } -+ -+ /* Don't cache if it was publicly named. */ -+ if (gem_bo->name) { -+ vc4_bo_destroy(bo); -+ return; -+ } -+ -+ spin_lock(&vc4->bo_lock); -+ cache_list = vc4_get_cache_list_for_size(dev, gem_bo->size); -+ if (!cache_list) { -+ vc4_bo_destroy(bo); -+ spin_unlock(&vc4->bo_lock); -+ return; -+ } -+ -+ if (bo->validated_shader) { -+ kfree(bo->validated_shader->texture_samples); -+ kfree(bo->validated_shader); -+ bo->validated_shader = NULL; -+ } -+ -+ bo->free_time = jiffies; -+ list_add(&bo->size_head, cache_list); -+ list_add(&bo->unref_head, &vc4->bo_cache.time_list); -+ -+ vc4->bo_stats.num_cached++; -+ vc4->bo_stats.size_cached += gem_bo->size; -+ spin_unlock(&vc4->bo_lock); -+ -+ vc4_bo_cache_free_old(dev); -+} -+ -+static void vc4_bo_cache_time_work(struct work_struct *work) -+{ -+ struct vc4_dev *vc4 = -+ container_of(work, struct vc4_dev, bo_cache.time_work); -+ struct drm_device *dev = vc4->dev; -+ -+ vc4_bo_cache_free_old(dev); -+} -+ -+static void vc4_bo_cache_time_timer(unsigned long data) -+{ -+ struct drm_device *dev = (struct drm_device *)data; -+ struct vc4_dev *vc4 = to_vc4_dev(dev); -+ -+ schedule_work(&vc4->bo_cache.time_work); -+} -+ -+struct dma_buf * -+vc4_prime_export(struct drm_device *dev, struct drm_gem_object *obj, int flags) -+{ -+ struct vc4_bo *bo = to_vc4_bo(obj); -+ -+ if (bo->validated_shader) { -+ DRM_ERROR("Attempting to export shader BO\n"); -+ return ERR_PTR(-EINVAL); -+ } -+ -+ return drm_gem_prime_export(dev, obj, flags); -+} -+ -+int -+vc4_create_bo_ioctl(struct drm_device *dev, void *data, -+ struct drm_file *file_priv) -+{ -+ struct drm_vc4_create_bo *args = data; -+ struct vc4_bo *bo = NULL; -+ int ret; -+ -+ bo = vc4_bo_create(dev, args->size); -+ if (!bo) -+ return -ENOMEM; -+ -+ ret = drm_gem_handle_create(file_priv, &bo->base.base, &args->handle); -+ drm_gem_object_unreference_unlocked(&bo->base.base); -+ -+ return ret; -+} -+ -+int -+vc4_create_shader_bo_ioctl(struct drm_device *dev, void *data, -+ struct drm_file *file_priv) -+{ -+ struct drm_vc4_create_shader_bo *args = data; -+ struct vc4_bo *bo = NULL; -+ int ret; -+ -+ if (args->size == 0) -+ return -EINVAL; -+ -+ if (args->size % sizeof(u64) != 0) -+ return -EINVAL; -+ -+ if (args->flags != 0) { -+ DRM_INFO("Unknown flags set: 0x%08x\n", args->flags); -+ return -EINVAL; -+ } -+ -+ if (args->pad != 0) { -+ DRM_INFO("Pad set: 0x%08x\n", args->pad); -+ return -EINVAL; -+ } -+ -+ bo = vc4_bo_create(dev, args->size); -+ if (!bo) -+ return -ENOMEM; -+ -+ ret = copy_from_user(bo->base.vaddr, -+ (void __user *)(uintptr_t)args->data, -+ args->size); -+ if (ret != 0) -+ goto fail; -+ -+ bo->validated_shader = vc4_validate_shader(&bo->base); -+ if (!bo->validated_shader) { -+ ret = -EINVAL; -+ goto fail; -+ } -+ -+ /* We have to create the handle after validation, to avoid -+ * races for users to do doing things like mmap the shader BO. -+ */ -+ ret = drm_gem_handle_create(file_priv, &bo->base.base, &args->handle); -+ -+ fail: -+ drm_gem_object_unreference_unlocked(&bo->base.base); -+ -+ return ret; -+} -+ -+int -+vc4_mmap_bo_ioctl(struct drm_device *dev, void *data, -+ struct drm_file *file_priv) -+{ -+ struct drm_vc4_mmap_bo *args = data; -+ struct drm_gem_object *gem_obj; -+ -+ gem_obj = drm_gem_object_lookup(dev, file_priv, args->handle); -+ if (!gem_obj) { -+ DRM_ERROR("Failed to look up GEM BO %d\n", args->handle); -+ return -EINVAL; -+ } -+ -+ /* The mmap offset was set up at BO allocation time. */ -+ args->offset = drm_vma_node_offset_addr(&gem_obj->vma_node); -+ -+ drm_gem_object_unreference(gem_obj); -+ return 0; -+} -+ -+int vc4_mmap(struct file *filp, struct vm_area_struct *vma) -+{ -+ struct drm_gem_object *gem_obj; -+ struct vc4_bo *bo; -+ int ret; -+ -+ ret = drm_gem_mmap(filp, vma); -+ if (ret) -+ return ret; -+ -+ gem_obj = vma->vm_private_data; -+ bo = to_vc4_bo(gem_obj); -+ -+ if (bo->validated_shader) { -+ DRM_ERROR("mmaping of shader BOs not allowed.\n"); -+ return -EINVAL; -+ } -+ -+ /* -+ * Clear the VM_PFNMAP flag that was set by drm_gem_mmap(), and set the -+ * vm_pgoff (used as a fake buffer offset by DRM) to 0 as we want to map -+ * the whole buffer. -+ */ -+ vma->vm_flags &= ~VM_PFNMAP; -+ vma->vm_pgoff = 0; -+ -+ ret = dma_mmap_writecombine(bo->base.base.dev->dev, vma, -+ bo->base.vaddr, bo->base.paddr, -+ vma->vm_end - vma->vm_start); -+ if (ret) -+ drm_gem_vm_close(vma); -+ -+ return ret; -+} -+ -+int vc4_prime_mmap(struct drm_gem_object *obj, struct vm_area_struct *vma) -+{ -+ struct vc4_bo *bo = to_vc4_bo(obj); -+ -+ if (bo->validated_shader) { -+ DRM_ERROR("mmaping of shader BOs not allowed.\n"); -+ return -EINVAL; -+ } -+ -+ return drm_gem_cma_prime_mmap(obj, vma); -+} -+ -+void *vc4_prime_vmap(struct drm_gem_object *obj) -+{ -+ struct vc4_bo *bo = to_vc4_bo(obj); -+ -+ if (bo->validated_shader) { -+ DRM_ERROR("mmaping of shader BOs not allowed.\n"); -+ return ERR_PTR(-EINVAL); -+ } -+ -+ return drm_gem_cma_prime_vmap(obj); -+} -+ -+void vc4_bo_cache_init(struct drm_device *dev) -+{ -+ struct vc4_dev *vc4 = to_vc4_dev(dev); -+ -+ spin_lock_init(&vc4->bo_lock); -+ -+ INIT_LIST_HEAD(&vc4->bo_cache.time_list); -+ -+ INIT_WORK(&vc4->bo_cache.time_work, vc4_bo_cache_time_work); -+ setup_timer(&vc4->bo_cache.time_timer, -+ vc4_bo_cache_time_timer, -+ (unsigned long) dev); -+} -+ -+void vc4_bo_cache_destroy(struct drm_device *dev) -+{ -+ struct vc4_dev *vc4 = to_vc4_dev(dev); -+ -+ del_timer(&vc4->bo_cache.time_timer); -+ cancel_work_sync(&vc4->bo_cache.time_work); -+ -+ vc4_bo_cache_purge(dev); -+ -+ if (vc4->bo_stats.num_allocated) { -+ DRM_ERROR("Destroying BO cache while BOs still allocated:\n"); -+ vc4_bo_stats_dump(vc4); -+ } -+} -+ -+#ifdef CONFIG_DEBUG_FS -+int vc4_bo_stats_debugfs(struct seq_file *m, void *unused) -+{ -+ struct drm_info_node *node = (struct drm_info_node *) m->private; -+ struct drm_device *dev = node->minor->dev; -+ struct vc4_dev *vc4 = to_vc4_dev(dev); -+ struct vc4_bo_stats stats; -+ -+ spin_lock(&vc4->bo_lock); -+ stats = vc4->bo_stats; -+ spin_unlock(&vc4->bo_lock); -+ -+ seq_printf(m, "num bos allocated: %d\n", stats.num_allocated); -+ seq_printf(m, "size bos allocated: %dkb\n", stats.size_allocated / 1024); -+ seq_printf(m, "num bos used: %d\n", (stats.num_allocated - -+ stats.num_cached)); -+ seq_printf(m, "size bos used: %dkb\n", (stats.size_allocated - -+ stats.size_cached) / 1024); -+ seq_printf(m, "num bos cached: %d\n", stats.num_cached); -+ seq_printf(m, "size bos cached: %dkb\n", stats.size_cached / 1024); +diff --git a/drivers/w1/masters/w1-gpio.c b/drivers/w1/masters/w1-gpio.c +index a373ae6..080e597 100644 +--- a/drivers/w1/masters/w1-gpio.c ++++ b/drivers/w1/masters/w1-gpio.c +@@ -23,6 +23,19 @@ + #include "../w1.h" + #include "../w1_int.h" + ++static int w1_gpio_pullup = 0; ++static int w1_gpio_pullup_orig = 0; ++module_param_named(pullup, w1_gpio_pullup, int, 0); ++MODULE_PARM_DESC(pullup, "Enable parasitic power (power on data) mode"); ++static int w1_gpio_pullup_pin = -1; ++static int w1_gpio_pullup_pin_orig = -1; ++module_param_named(extpullup, w1_gpio_pullup_pin, int, 0); ++MODULE_PARM_DESC(extpullup, "GPIO external pullup pin number"); ++static int w1_gpio_pin = -1; ++static int w1_gpio_pin_orig = -1; ++module_param_named(gpiopin, w1_gpio_pin, int, 0); ++MODULE_PARM_DESC(gpiopin, "GPIO pin number"); + -+ return 0; -+} -+#endif -diff --git a/drivers/gpu/drm/vc4/vc4_crtc.c b/drivers/gpu/drm/vc4/vc4_crtc.c -index 265064c..3be2720 100644 ---- a/drivers/gpu/drm/vc4/vc4_crtc.c -+++ b/drivers/gpu/drm/vc4/vc4_crtc.c -@@ -35,6 +35,7 @@ - #include "drm_atomic_helper.h" - #include "drm_crtc_helper.h" - #include "linux/clk.h" -+#include "drm_fb_cma_helper.h" - #include "linux/component.h" - #include "linux/of_device.h" - #include "vc4_drv.h" -@@ -476,10 +477,105 @@ static irqreturn_t vc4_crtc_irq_handler(int irq, void *data) - return ret; + static u8 w1_gpio_set_pullup(void *data, int delay) + { + struct w1_gpio_platform_data *pdata = data; +@@ -67,6 +80,16 @@ static u8 w1_gpio_read_bit(void *data) + return gpio_get_value(pdata->pin) ? 1 : 0; } -+struct vc4_async_flip_state { -+ struct drm_crtc *crtc; -+ struct drm_framebuffer *fb; -+ struct drm_pending_vblank_event *event; -+ -+ struct vc4_seqno_cb cb; -+}; -+ -+/* Called when the V3D execution for the BO being flipped to is done, so that -+ * we can actually update the plane's address to point to it. -+ */ -+static void -+vc4_async_page_flip_complete(struct vc4_seqno_cb *cb) -+{ -+ struct vc4_async_flip_state *flip_state = -+ container_of(cb, struct vc4_async_flip_state, cb); -+ struct drm_crtc *crtc = flip_state->crtc; -+ struct drm_device *dev = crtc->dev; -+ struct vc4_dev *vc4 = to_vc4_dev(dev); -+ struct drm_plane *plane = crtc->primary; -+ -+ vc4_plane_async_set_fb(plane, flip_state->fb); -+ if (flip_state->event) { -+ unsigned long flags; -+ spin_lock_irqsave(&dev->event_lock, flags); -+ drm_crtc_send_vblank_event(crtc, flip_state->event); -+ spin_unlock_irqrestore(&dev->event_lock, flags); -+ } -+ -+ drm_framebuffer_unreference(flip_state->fb); -+ kfree(flip_state); -+ -+ up(&vc4->async_modeset); -+} -+ -+/* Implements async (non-vblank-synced) page flips. -+ * -+ * The page flip ioctl needs to return immediately, so we grab the -+ * modeset semaphore on the pipe, and queue the address update for -+ * when V3D is done with the BO being flipped to. -+ */ -+static int vc4_async_page_flip(struct drm_crtc *crtc, -+ struct drm_framebuffer *fb, -+ struct drm_pending_vblank_event *event, -+ uint32_t flags) ++static void w1_gpio_bitbang_pullup(void *data, u8 on) +{ -+ struct drm_device *dev = crtc->dev; -+ struct vc4_dev *vc4 = to_vc4_dev(dev); -+ struct drm_plane *plane = crtc->primary; -+ int ret = 0; -+ struct vc4_async_flip_state *flip_state; -+ struct drm_gem_cma_object *cma_bo = drm_fb_cma_get_gem_obj(fb, 0); -+ struct vc4_bo *bo = to_vc4_bo(&cma_bo->base); -+ -+ flip_state = kzalloc(sizeof(*flip_state), GFP_KERNEL); -+ if (!flip_state) -+ return -ENOMEM; -+ -+ drm_framebuffer_reference(fb); -+ flip_state->fb = fb; -+ flip_state->crtc = crtc; -+ flip_state->event = event; -+ -+ /* Make sure all other async modesetes have landed. */ -+ ret = down_interruptible(&vc4->async_modeset); -+ if (ret) { -+ kfree(flip_state); -+ return ret; -+ } -+ -+ /* Immediately update the plane's legacy fb pointer, so that later -+ * modeset prep sees the state that will be present when the semaphore -+ * is released. -+ */ -+ drm_atomic_set_fb_for_plane(plane->state, fb); -+ plane->fb = fb; -+ -+ vc4_queue_seqno_cb(dev, &flip_state->cb, bo->seqno, -+ vc4_async_page_flip_complete); -+ -+ /* Driver takes ownership of state on successful async commit. */ -+ return 0; -+} ++ struct w1_gpio_platform_data *pdata = data; + -+static int vc4_page_flip(struct drm_crtc *crtc, -+ struct drm_framebuffer *fb, -+ struct drm_pending_vblank_event *event, -+ uint32_t flags) -+{ -+ if (flags & DRM_MODE_PAGE_FLIP_ASYNC) -+ return vc4_async_page_flip(crtc, fb, event, flags); ++ if (on) ++ gpio_direction_output(pdata->pin, 1); + else -+ return drm_atomic_helper_page_flip(crtc, fb, event, flags); ++ gpio_direction_input(pdata->pin); +} + - static const struct drm_crtc_funcs vc4_crtc_funcs = { - .set_config = drm_atomic_helper_set_config, - .destroy = vc4_crtc_destroy, -- .page_flip = drm_atomic_helper_page_flip, -+ .page_flip = vc4_page_flip, - .set_property = NULL, - .cursor_set = NULL, /* handled by drm_mode_cursor_universal */ - .cursor_move = NULL, /* handled by drm_mode_cursor_universal */ -diff --git a/drivers/gpu/drm/vc4/vc4_debugfs.c b/drivers/gpu/drm/vc4/vc4_debugfs.c -index 4297b0a5..d76ad10 100644 ---- a/drivers/gpu/drm/vc4/vc4_debugfs.c -+++ b/drivers/gpu/drm/vc4/vc4_debugfs.c -@@ -16,11 +16,14 @@ - #include "vc4_regs.h" - - static const struct drm_info_list vc4_debugfs_list[] = { -+ {"bo_stats", vc4_bo_stats_debugfs, 0}, - {"hdmi_regs", vc4_hdmi_debugfs_regs, 0}, - {"hvs_regs", vc4_hvs_debugfs_regs, 0}, - {"crtc0_regs", vc4_crtc_debugfs_regs, 0, (void *)(uintptr_t)0}, - {"crtc1_regs", vc4_crtc_debugfs_regs, 0, (void *)(uintptr_t)1}, - {"crtc2_regs", vc4_crtc_debugfs_regs, 0, (void *)(uintptr_t)2}, -+ {"v3d_ident", vc4_v3d_debugfs_ident, 0}, -+ {"v3d_regs", vc4_v3d_debugfs_regs, 0}, - }; + #if defined(CONFIG_OF) + static const struct of_device_id w1_gpio_dt_ids[] = { + { .compatible = "w1-gpio" }, +@@ -80,6 +103,7 @@ static int w1_gpio_probe_dt(struct platform_device *pdev) + struct w1_gpio_platform_data *pdata = dev_get_platdata(&pdev->dev); + struct device_node *np = pdev->dev.of_node; + int gpio; ++ u32 value; - #define VC4_DEBUGFS_ENTRIES ARRAY_SIZE(vc4_debugfs_list) -diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c -index d5db9e0..3baf1fc 100644 ---- a/drivers/gpu/drm/vc4/vc4_drv.c -+++ b/drivers/gpu/drm/vc4/vc4_drv.c -@@ -14,8 +14,10 @@ - #include <linux/module.h> - #include <linux/of_platform.h> - #include <linux/platform_device.h> -+#include <soc/bcm2835/raspberrypi-firmware.h> - #include "drm_fb_cma_helper.h" + pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); + if (!pdata) +@@ -88,6 +112,9 @@ static int w1_gpio_probe_dt(struct platform_device *pdev) + if (of_get_property(np, "linux,open-drain", NULL)) + pdata->is_open_drain = 1; -+#include "uapi/drm/vc4_drm.h" - #include "vc4_drv.h" - #include "vc4_regs.h" ++ if (of_property_read_u32(np, "rpi,parasitic-power", &value) == 0) ++ pdata->parasitic_power = (value != 0); ++ + gpio = of_get_gpio(np, 0); + if (gpio < 0) { + if (gpio != -EPROBE_DEFER) +@@ -103,7 +130,7 @@ static int w1_gpio_probe_dt(struct platform_device *pdev) + if (gpio == -EPROBE_DEFER) + return gpio; + /* ignore other errors as the pullup gpio is optional */ +- pdata->ext_pullup_enable_pin = gpio; ++ pdata->ext_pullup_enable_pin = (gpio >= 0) ? gpio : -1; -@@ -63,7 +65,7 @@ static const struct file_operations vc4_drm_fops = { - .open = drm_open, - .release = drm_release, - .unlocked_ioctl = drm_ioctl, -- .mmap = drm_gem_cma_mmap, -+ .mmap = vc4_mmap, - .poll = drm_poll, - .read = drm_read, - #ifdef CONFIG_COMPAT -@@ -73,16 +75,28 @@ static const struct file_operations vc4_drm_fops = { - }; + pdev->dev.platform_data = pdata; - static const struct drm_ioctl_desc vc4_drm_ioctls[] = { -+ DRM_IOCTL_DEF_DRV(VC4_SUBMIT_CL, vc4_submit_cl_ioctl, 0), -+ DRM_IOCTL_DEF_DRV(VC4_WAIT_SEQNO, vc4_wait_seqno_ioctl, 0), -+ DRM_IOCTL_DEF_DRV(VC4_WAIT_BO, vc4_wait_bo_ioctl, 0), -+ DRM_IOCTL_DEF_DRV(VC4_CREATE_BO, vc4_create_bo_ioctl, 0), -+ DRM_IOCTL_DEF_DRV(VC4_MMAP_BO, vc4_mmap_bo_ioctl, 0), -+ DRM_IOCTL_DEF_DRV(VC4_CREATE_SHADER_BO, vc4_create_shader_bo_ioctl, 0), - }; +@@ -113,13 +140,15 @@ static int w1_gpio_probe_dt(struct platform_device *pdev) + static int w1_gpio_probe(struct platform_device *pdev) + { + struct w1_bus_master *master; +- struct w1_gpio_platform_data *pdata; ++ struct w1_gpio_platform_data *pdata = pdev->dev.platform_data; + int err; - static struct drm_driver vc4_drm_driver = { - .driver_features = (DRIVER_MODESET | - DRIVER_ATOMIC | - DRIVER_GEM | -+ DRIVER_HAVE_IRQ | - DRIVER_PRIME), - .lastclose = vc4_lastclose, - .preclose = vc4_drm_preclose, - -+ .irq_handler = vc4_irq, -+ .irq_preinstall = vc4_irq_preinstall, -+ .irq_postinstall = vc4_irq_postinstall, -+ .irq_uninstall = vc4_irq_uninstall, -+ - .enable_vblank = vc4_enable_vblank, - .disable_vblank = vc4_disable_vblank, - .get_vblank_counter = drm_vblank_count, -@@ -92,18 +106,18 @@ static struct drm_driver vc4_drm_driver = { - .debugfs_cleanup = vc4_debugfs_cleanup, - #endif +- if (of_have_populated_dt()) { +- err = w1_gpio_probe_dt(pdev); +- if (err < 0) +- return err; ++ if(pdata == NULL) { ++ if (of_have_populated_dt()) { ++ err = w1_gpio_probe_dt(pdev); ++ if (err < 0) ++ return err; ++ } + } -- .gem_free_object = drm_gem_cma_free_object, -+ .gem_free_object = vc4_free_object, - .gem_vm_ops = &drm_gem_cma_vm_ops, - - .prime_handle_to_fd = drm_gem_prime_handle_to_fd, - .prime_fd_to_handle = drm_gem_prime_fd_to_handle, - .gem_prime_import = drm_gem_prime_import, -- .gem_prime_export = drm_gem_prime_export, -+ .gem_prime_export = vc4_prime_export, - .gem_prime_get_sg_table = drm_gem_cma_prime_get_sg_table, - .gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table, -- .gem_prime_vmap = drm_gem_cma_prime_vmap, -+ .gem_prime_vmap = vc4_prime_vmap, - .gem_prime_vunmap = drm_gem_cma_prime_vunmap, -- .gem_prime_mmap = drm_gem_cma_prime_mmap, -+ .gem_prime_mmap = vc4_prime_mmap, - - .dumb_create = vc4_dumb_create, - .dumb_map_offset = drm_gem_cma_dumb_map_offset, -@@ -113,6 +127,8 @@ static struct drm_driver vc4_drm_driver = { - .num_ioctls = ARRAY_SIZE(vc4_drm_ioctls), - .fops = &vc4_drm_fops, - -+ .gem_obj_size = sizeof(struct vc4_bo), -+ - .name = DRIVER_NAME, - .desc = DRIVER_DESC, - .date = DRIVER_DATE, -@@ -153,6 +169,7 @@ static int vc4_drm_bind(struct device *dev) - struct drm_device *drm; - struct drm_connector *connector; - struct vc4_dev *vc4; -+ struct device_node *firmware_node; - int ret = 0; - - dev->coherent_dma_mask = DMA_BIT_MASK(32); -@@ -161,6 +178,14 @@ static int vc4_drm_bind(struct device *dev) - if (!vc4) + pdata = dev_get_platdata(&pdev->dev); +@@ -136,6 +165,22 @@ static int w1_gpio_probe(struct platform_device *pdev) return -ENOMEM; + } -+ firmware_node = of_parse_phandle(dev->of_node, "firmware", 0); -+ vc4->firmware = rpi_firmware_get(firmware_node); -+ if (!vc4->firmware) { -+ DRM_DEBUG("Failed to get Raspberry Pi firmware reference.\n"); -+ return -EPROBE_DEFER; ++ w1_gpio_pin_orig = pdata->pin; ++ w1_gpio_pullup_pin_orig = pdata->ext_pullup_enable_pin; ++ w1_gpio_pullup_orig = pdata->parasitic_power; ++ ++ if(gpio_is_valid(w1_gpio_pin)) { ++ pdata->pin = w1_gpio_pin; ++ pdata->ext_pullup_enable_pin = -1; ++ pdata->parasitic_power = -1; ++ } ++ pdata->parasitic_power |= w1_gpio_pullup; ++ if(gpio_is_valid(w1_gpio_pullup_pin)) { ++ pdata->ext_pullup_enable_pin = w1_gpio_pullup_pin; + } -+ of_node_put(firmware_node); + - drm = drm_dev_alloc(&vc4_drm_driver, dev); - if (!drm) - return -ENOMEM; -@@ -170,13 +195,17 @@ static int vc4_drm_bind(struct device *dev) - - drm_dev_set_unique(drm, dev_name(dev)); - -+ vc4_bo_cache_init(drm); ++ dev_info(&pdev->dev, "gpio pin %d, external pullup pin %d, parasitic power %d\n", pdata->pin, pdata->ext_pullup_enable_pin, pdata->parasitic_power); + - drm_mode_config_init(drm); - if (ret) - goto unref; + err = devm_gpio_request(&pdev->dev, pdata->pin, "w1"); + if (err) { + dev_err(&pdev->dev, "gpio_request (pin) failed\n"); +@@ -165,6 +210,14 @@ static int w1_gpio_probe(struct platform_device *pdev) + master->set_pullup = w1_gpio_set_pullup; + } -+ vc4_gem_init(drm); ++ if (pdata->parasitic_power) { ++ if (pdata->is_open_drain) ++ printk(KERN_ERR "w1-gpio 'pullup'(parasitic power) " ++ "option doesn't work with open drain GPIO\n"); ++ else ++ master->bitbang_pullup = w1_gpio_bitbang_pullup; ++ } + - ret = component_bind_all(dev, drm); - if (ret) -- goto unref; -+ goto gem_destroy; + err = w1_add_master_device(master); + if (err) { + dev_err(&pdev->dev, "w1_add_master device failed\n"); +@@ -195,6 +248,10 @@ static int w1_gpio_remove(struct platform_device *pdev) - ret = drm_dev_register(drm, 0); - if (ret < 0) -@@ -200,8 +229,11 @@ static int vc4_drm_bind(struct device *dev) - drm_dev_unregister(drm); - unbind_all: - component_unbind_all(dev, drm); -+gem_destroy: -+ vc4_gem_destroy(drm); - unref: - drm_dev_unref(drm); -+ vc4_bo_cache_destroy(drm); - return ret; + w1_remove_master_device(master); + ++ pdata->pin = w1_gpio_pin_orig; ++ pdata->ext_pullup_enable_pin = w1_gpio_pullup_pin_orig; ++ pdata->parasitic_power = w1_gpio_pullup_orig; ++ + return 0; } -@@ -228,6 +260,7 @@ static struct platform_driver *const component_drivers[] = { - &vc4_hdmi_driver, - &vc4_crtc_driver, - &vc4_hvs_driver, -+ &vc4_v3d_driver, - }; +diff --git a/drivers/w1/w1.h b/drivers/w1/w1.h +index 56a49ba..881d728 100644 +--- a/drivers/w1/w1.h ++++ b/drivers/w1/w1.h +@@ -171,6 +171,12 @@ struct w1_bus_master - static int vc4_platform_drm_probe(struct platform_device *pdev) -diff --git a/drivers/gpu/drm/vc4/vc4_drv.h b/drivers/gpu/drm/vc4/vc4_drv.h -index fd8319f..8cc89d1 100644 ---- a/drivers/gpu/drm/vc4/vc4_drv.h -+++ b/drivers/gpu/drm/vc4/vc4_drv.h -@@ -15,8 +15,85 @@ struct vc4_dev { - struct vc4_hdmi *hdmi; - struct vc4_hvs *hvs; - struct vc4_crtc *crtc[3]; -+ struct vc4_v3d *v3d; - - struct drm_fbdev_cma *fbdev; -+ struct rpi_firmware *firmware; -+ -+ /* The kernel-space BO cache. Tracks buffers that have been -+ * unreferenced by all other users (refcounts of 0!) but not -+ * yet freed, so we can do cheap allocations. -+ */ -+ struct vc4_bo_cache { -+ /* Array of list heads for entries in the BO cache, -+ * based on number of pages, so we can do O(1) lookups -+ * in the cache when allocating. -+ */ -+ struct list_head *size_list; -+ uint32_t size_list_size; -+ -+ /* List of all BOs in the cache, ordered by age, so we -+ * can do O(1) lookups when trying to free old -+ * buffers. -+ */ -+ struct list_head time_list; -+ struct work_struct time_work; -+ struct timer_list time_timer; -+ } bo_cache; -+ -+ struct vc4_bo_stats { -+ u32 num_allocated; -+ u32 size_allocated; -+ u32 num_cached; -+ u32 size_cached; -+ } bo_stats; -+ -+ /* Protects bo_cache and the BO stats. */ -+ spinlock_t bo_lock; -+ -+ /* Sequence number for the last job queued in job_list. -+ * Starts at 0 (no jobs emitted). -+ */ -+ uint64_t emit_seqno; -+ -+ /* Sequence number for the last completed job on the GPU. -+ * Starts at 0 (no jobs completed). -+ */ -+ uint64_t finished_seqno; -+ -+ /* List of all struct vc4_exec_info for jobs to be executed. -+ * The first job in the list is the one currently programmed -+ * into ct0ca/ct1ca for execution. -+ */ -+ struct list_head job_list; -+ /* List of the finished vc4_exec_infos waiting to be freed by -+ * job_done_work. -+ */ -+ struct list_head job_done_list; -+ spinlock_t job_lock; -+ wait_queue_head_t job_wait_queue; -+ struct work_struct job_done_work; -+ -+ /* List of struct vc4_seqno_cb for callbacks to be made from a -+ * workqueue when the given seqno is passed. -+ */ -+ struct list_head seqno_cb_list; -+ -+ /* The binner overflow memory that's currently set up in -+ * BPOA/BPOS registers. When overflow occurs and a new one is -+ * allocated, the previous one will be moved to -+ * vc4->current_exec's free list. + u8 (*set_pullup)(void *, int); + ++ /** ++ * Turns the pullup on/off in bitbanging mode, takes an on/off argument. ++ * @return -1=Error, 0=completed + */ -+ struct vc4_bo *overflow_mem; -+ struct work_struct overflow_mem_work; -+ -+ struct { -+ uint32_t last_ct0ca, last_ct1ca; -+ struct timer_list timer; -+ struct work_struct reset_work; -+ } hangcheck; ++ void (*bitbang_pullup) (void *, u8); + -+ struct semaphore async_modeset; + void (*search)(void *, struct w1_master *, + u8, w1_slave_found_callback); }; +diff --git a/drivers/w1/w1_int.c b/drivers/w1/w1_int.c +index 20f766a..c4fbdb1 100644 +--- a/drivers/w1/w1_int.c ++++ b/drivers/w1/w1_int.c +@@ -122,6 +122,20 @@ int w1_add_master_device(struct w1_bus_master *master) + return(-EINVAL); + } - static inline struct vc4_dev * -@@ -27,6 +104,25 @@ to_vc4_dev(struct drm_device *dev) - - struct vc4_bo { - struct drm_gem_cma_object base; -+ -+ /* seqno of the last job to render to this BO. */ -+ uint64_t seqno; -+ -+ /* List entry for the BO's position in either -+ * vc4_exec_info->unref_list or vc4_dev->bo_cache.time_list -+ */ -+ struct list_head unref_head; ++ /* bitbanging hardware uses bitbang_pullup, other hardware uses set_pullup ++ * and takes care of timing itself */ ++ if (!master->write_byte && !master->touch_bit && master->set_pullup) { ++ printk(KERN_ERR "w1_add_master_device: set_pullup requires " ++ "write_byte or touch_bit, disabling\n"); ++ master->set_pullup = NULL; ++ } + -+ /* Time in jiffies when the BO was put in vc4->bo_cache. */ -+ unsigned long free_time; ++ if (master->set_pullup && master->bitbang_pullup) { ++ printk(KERN_ERR "w1_add_master_device: set_pullup should not " ++ "be set when bitbang_pullup is used, disabling\n"); ++ master->set_pullup = NULL; ++ } + -+ /* List entry for the BO's position in vc4_dev->bo_cache.size_list */ -+ struct list_head size_head; + /* Lock until the device is added (or not) to w1_masters. */ + mutex_lock(&w1_mlock); + /* Search for the first available id (starting at 1). */ +diff --git a/drivers/w1/w1_io.c b/drivers/w1/w1_io.c +index 2820924..fd0550f 100644 +--- a/drivers/w1/w1_io.c ++++ b/drivers/w1/w1_io.c +@@ -134,10 +134,22 @@ static void w1_pre_write(struct w1_master *dev) + static void w1_post_write(struct w1_master *dev) + { + if (dev->pullup_duration) { +- if (dev->enable_pullup && dev->bus_master->set_pullup) +- dev->bus_master->set_pullup(dev->bus_master->data, 0); +- else ++ if (dev->enable_pullup) { ++ if (dev->bus_master->set_pullup) { ++ dev->bus_master->set_pullup(dev-> ++ bus_master->data, ++ 0); ++ } else if (dev->bus_master->bitbang_pullup) { ++ dev->bus_master-> ++ bitbang_pullup(dev->bus_master->data, 1); ++ msleep(dev->pullup_duration); ++ dev->bus_master-> ++ bitbang_pullup(dev->bus_master->data, 0); ++ } ++ } else { + msleep(dev->pullup_duration); ++ } + -+ /* Struct for shader validation state, if created by -+ * DRM_IOCTL_VC4_CREATE_SHADER_BO. -+ */ -+ struct vc4_validated_shader_info *validated_shader; - }; - - static inline struct vc4_bo * -@@ -35,6 +131,17 @@ to_vc4_bo(struct drm_gem_object *bo) - return (struct vc4_bo *)bo; + dev->pullup_duration = 0; + } } - -+struct vc4_seqno_cb { -+ struct work_struct work; -+ uint64_t seqno; -+ void (*func)(struct vc4_seqno_cb *cb); -+}; -+ -+struct vc4_v3d { -+ struct platform_device *pdev; -+ void __iomem *regs; -+}; -+ - struct vc4_hvs { - struct platform_device *pdev; - void __iomem *regs; -@@ -72,9 +179,151 @@ to_vc4_encoder(struct drm_encoder *encoder) - return container_of(encoder, struct vc4_encoder, base); +diff --git a/include/linux/w1-gpio.h b/include/linux/w1-gpio.h +index d58594a..feae942 100644 +--- a/include/linux/w1-gpio.h ++++ b/include/linux/w1-gpio.h +@@ -18,6 +18,7 @@ + struct w1_gpio_platform_data { + unsigned int pin; + unsigned int is_open_drain:1; ++ unsigned int parasitic_power:1; + void (*enable_external_pullup)(int enable); + unsigned int ext_pullup_enable_pin; + unsigned int pullup_duration; + +From 8f8fe914a218412e705869e5ca6b205556275bf3 Mon Sep 17 00:00:00 2001 +From: popcornmix <popcornmix@gmail.com> +Date: Wed, 18 Dec 2013 22:16:19 +0000 +Subject: [PATCH 064/112] config: Enable CONFIG_MEMCG, but leave it disabled + (due to memory cost). Enable with cgroup_enable=memory. + +--- + kernel/cgroup.c | 24 +++++++++++++++++++++++- + 1 file changed, 23 insertions(+), 1 deletion(-) + +diff --git a/kernel/cgroup.c b/kernel/cgroup.c +index 86cb5c6..0b5668a 100644 +--- a/kernel/cgroup.c ++++ b/kernel/cgroup.c +@@ -5587,7 +5587,7 @@ int __init cgroup_init_early(void) + return 0; } -+#define V3D_READ(offset) readl(vc4->v3d->regs + offset) -+#define V3D_WRITE(offset, val) writel(val, vc4->v3d->regs + offset) - #define HVS_READ(offset) readl(vc4->hvs->regs + offset) - #define HVS_WRITE(offset, val) writel(val, vc4->hvs->regs + offset) +-static u16 cgroup_disable_mask __initdata; ++static u16 cgroup_disable_mask __initdata = 1<<0; -+enum vc4_bo_mode { -+ VC4_MODE_UNDECIDED, -+ VC4_MODE_RENDER, -+ VC4_MODE_SHADER, -+}; -+ -+struct vc4_bo_exec_state { -+ struct drm_gem_cma_object *bo; -+ enum vc4_bo_mode mode; -+}; -+ -+struct vc4_exec_info { -+ /* Sequence number for this bin/render job. */ -+ uint64_t seqno; -+ -+ /* Kernel-space copy of the ioctl arguments */ -+ struct drm_vc4_submit_cl *args; -+ -+ /* This is the array of BOs that were looked up at the start of exec. -+ * Command validation will use indices into this array. -+ */ -+ struct vc4_bo_exec_state *bo; -+ uint32_t bo_count; -+ -+ /* Pointers for our position in vc4->job_list */ -+ struct list_head head; -+ -+ /* List of other BOs used in the job that need to be released -+ * once the job is complete. -+ */ -+ struct list_head unref_list; -+ -+ /* Current unvalidated indices into @bo loaded by the non-hardware -+ * VC4_PACKET_GEM_HANDLES. -+ */ -+ uint32_t bo_index[2]; -+ -+ /* This is the BO where we store the validated command lists, shader -+ * records, and uniforms. -+ */ -+ struct drm_gem_cma_object *exec_bo; -+ -+ /** -+ * This tracks the per-shader-record state (packet 64) that -+ * determines the length of the shader record and the offset -+ * it's expected to be found at. It gets read in from the -+ * command lists. -+ */ -+ struct vc4_shader_state { -+ uint8_t packet; -+ uint32_t addr; -+ /* Maximum vertex index referenced by any primitive using this -+ * shader state. -+ */ -+ uint32_t max_index; -+ } *shader_state; -+ -+ /** How many shader states the user declared they were using. */ -+ uint32_t shader_state_size; -+ /** How many shader state records the validator has seen. */ -+ uint32_t shader_state_count; -+ -+ bool found_tile_binning_mode_config_packet; -+ bool found_start_tile_binning_packet; -+ bool found_increment_semaphore_packet; -+ uint8_t bin_tiles_x, bin_tiles_y; -+ struct drm_gem_cma_object *tile_bo; -+ uint32_t tile_alloc_offset; -+ -+ /** -+ * Computed addresses pointing into exec_bo where we start the -+ * bin thread (ct0) and render thread (ct1). -+ */ -+ uint32_t ct0ca, ct0ea; -+ uint32_t ct1ca, ct1ea; + /** + * cgroup_init - cgroup initialization +@@ -6117,6 +6117,28 @@ static int __init cgroup_no_v1(char *str) + } + __setup("cgroup_no_v1=", cgroup_no_v1); + ++static int __init cgroup_enable(char *str) ++{ ++ struct cgroup_subsys *ss; ++ char *token; ++ int i; + -+ /* Pointers to the shader recs. These paddr gets incremented as CL -+ * packets are relocated in validate_gl_shader_state, and the vaddrs -+ * (u and v) get incremented and size decremented as the shader recs -+ * themselves are validated. -+ */ -+ void *shader_rec_u; -+ void *shader_rec_v; -+ uint32_t shader_rec_p; -+ uint32_t shader_rec_size; ++ while ((token = strsep(&str, ",")) != NULL) { ++ if (!*token) ++ continue; + -+ /* Pointers to the uniform data. These pointers are incremented, and -+ * size decremented, as each batch of uniforms is uploaded. -+ */ -+ void *uniforms_u; -+ void *uniforms_v; -+ uint32_t uniforms_p; -+ uint32_t uniforms_size; -+}; ++ for_each_subsys(ss, i) { ++ if (strcmp(token, ss->name) && ++ strcmp(token, ss->legacy_name)) ++ continue; + -+static inline struct vc4_exec_info * -+vc4_first_job(struct vc4_dev *vc4) -+{ -+ if (list_empty(&vc4->job_list)) -+ return NULL; -+ return list_first_entry(&vc4->job_list, struct vc4_exec_info, head); ++ cgroup_disable_mask &= ~(1 << i); ++ } ++ } ++ return 1; +} -+ -+/** -+ * struct vc4_texture_sample_info - saves the offsets into the UBO for texture -+ * setup parameters. -+ * -+ * This will be used at draw time to relocate the reference to the texture -+ * contents in p0, and validate that the offset combined with -+ * width/height/stride/etc. from p1 and p2/p3 doesn't sample outside the BO. -+ * Note that the hardware treats unprovided config parameters as 0, so not all -+ * of them need to be set up for every texure sample, and we'll store ~0 as -+ * the offset to mark the unused ones. -+ * -+ * See the VC4 3D architecture guide page 41 ("Texture and Memory Lookup Unit -+ * Setup") for definitions of the texture parameters. -+ */ -+struct vc4_texture_sample_info { -+ bool is_direct; -+ uint32_t p_offset[4]; -+}; -+ -+/** -+ * struct vc4_validated_shader_info - information about validated shaders that -+ * needs to be used from command list validation. -+ * -+ * For a given shader, each time a shader state record references it, we need -+ * to verify that the shader doesn't read more uniforms than the shader state -+ * record's uniform BO pointer can provide, and we need to apply relocations -+ * and validate the shader state record's uniforms that define the texture -+ * samples. -+ */ -+struct vc4_validated_shader_info -+{ -+ uint32_t uniforms_size; -+ uint32_t uniforms_src_size; -+ uint32_t num_texture_samples; -+ struct vc4_texture_sample_info *texture_samples; -+}; ++__setup("cgroup_enable=", cgroup_enable); + /** - * _wait_for - magic (register) wait macro - * -@@ -111,6 +360,18 @@ int vc4_dumb_create(struct drm_file *file_priv, - struct drm_mode_create_dumb *args); - struct dma_buf *vc4_prime_export(struct drm_device *dev, - struct drm_gem_object *obj, int flags); -+int vc4_create_bo_ioctl(struct drm_device *dev, void *data, -+ struct drm_file *file_priv); -+int vc4_create_shader_bo_ioctl(struct drm_device *dev, void *data, -+ struct drm_file *file_priv); -+int vc4_mmap_bo_ioctl(struct drm_device *dev, void *data, -+ struct drm_file *file_priv); -+int vc4_mmap(struct file *filp, struct vm_area_struct *vma); -+int vc4_prime_mmap(struct drm_gem_object *obj, struct vm_area_struct *vma); -+void *vc4_prime_vmap(struct drm_gem_object *obj); -+void vc4_bo_cache_init(struct drm_device *dev); -+void vc4_bo_cache_destroy(struct drm_device *dev); -+int vc4_bo_stats_debugfs(struct seq_file *m, void *arg); - - /* vc4_crtc.c */ - extern struct platform_driver vc4_crtc_driver; -@@ -126,10 +387,34 @@ void vc4_debugfs_cleanup(struct drm_minor *minor); - /* vc4_drv.c */ - void __iomem *vc4_ioremap_regs(struct platform_device *dev, int index); - -+/* vc4_gem.c */ -+void vc4_gem_init(struct drm_device *dev); -+void vc4_gem_destroy(struct drm_device *dev); -+int vc4_submit_cl_ioctl(struct drm_device *dev, void *data, -+ struct drm_file *file_priv); -+int vc4_wait_seqno_ioctl(struct drm_device *dev, void *data, -+ struct drm_file *file_priv); -+int vc4_wait_bo_ioctl(struct drm_device *dev, void *data, -+ struct drm_file *file_priv); -+void vc4_submit_next_job(struct drm_device *dev); -+int vc4_wait_for_seqno(struct drm_device *dev, uint64_t seqno, -+ uint64_t timeout_ns, bool interruptible); -+void vc4_job_handle_completed(struct vc4_dev *vc4); -+int vc4_queue_seqno_cb(struct drm_device *dev, -+ struct vc4_seqno_cb *cb, uint64_t seqno, -+ void (*func)(struct vc4_seqno_cb *cb)); -+ - /* vc4_hdmi.c */ - extern struct platform_driver vc4_hdmi_driver; - int vc4_hdmi_debugfs_regs(struct seq_file *m, void *unused); - -+/* vc4_irq.c */ -+irqreturn_t vc4_irq(int irq, void *arg); -+void vc4_irq_preinstall(struct drm_device *dev); -+int vc4_irq_postinstall(struct drm_device *dev); -+void vc4_irq_uninstall(struct drm_device *dev); -+void vc4_irq_reset(struct drm_device *dev); -+ - /* vc4_hvs.c */ - extern struct platform_driver vc4_hvs_driver; - void vc4_hvs_dump_state(struct drm_device *dev); -@@ -143,3 +428,35 @@ struct drm_plane *vc4_plane_init(struct drm_device *dev, - enum drm_plane_type type); - u32 vc4_plane_write_dlist(struct drm_plane *plane, u32 __iomem *dlist); - u32 vc4_plane_dlist_size(struct drm_plane_state *state); -+void vc4_plane_async_set_fb(struct drm_plane *plane, struct drm_framebuffer *fb); -+ -+/* vc4_v3d.c */ -+extern struct platform_driver vc4_v3d_driver; -+int vc4_v3d_debugfs_ident(struct seq_file *m, void *unused); -+int vc4_v3d_debugfs_regs(struct seq_file *m, void *unused); -+int vc4_v3d_set_power(struct vc4_dev *vc4, bool on); -+ -+/* vc4_validate.c */ -+int -+vc4_validate_bin_cl(struct drm_device *dev, -+ void *validated, -+ void *unvalidated, -+ struct vc4_exec_info *exec); -+ -+int -+vc4_validate_shader_recs(struct drm_device *dev, struct vc4_exec_info *exec); -+ -+struct vc4_validated_shader_info * -+vc4_validate_shader(struct drm_gem_cma_object *shader_obj); -+ -+bool vc4_use_bo(struct vc4_exec_info *exec, -+ uint32_t hindex, -+ enum vc4_bo_mode mode, -+ struct drm_gem_cma_object **obj); -+ -+int vc4_get_rcl(struct drm_device *dev, struct vc4_exec_info *exec); + * css_tryget_online_from_dir - get corresponding css from a cgroup dentry + * @dentry: directory dentry of interest + +From 52e23c689e7112dee3f533c35dc4d952293a2694 Mon Sep 17 00:00:00 2001 +From: Florian Meier <florian.meier@koalo.de> +Date: Fri, 22 Nov 2013 14:59:51 +0100 +Subject: [PATCH 065/112] ASoC: Add support for PCM5102A codec + +Some definitions to support the PCM5102A codec +by Texas Instruments. + +Signed-off-by: Florian Meier <florian.meier@koalo.de> +--- + sound/soc/codecs/Kconfig | 5 ++++ + sound/soc/codecs/Makefile | 2 ++ + sound/soc/codecs/pcm5102a.c | 70 +++++++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 77 insertions(+) + create mode 100644 sound/soc/codecs/pcm5102a.c + +diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig +index 7ef3a0c..4308f90 100644 +--- a/sound/soc/codecs/Kconfig ++++ b/sound/soc/codecs/Kconfig +@@ -100,6 +100,7 @@ config SND_SOC_ALL_CODECS + select SND_SOC_RT298 if I2C + select SND_SOC_RT5514 if I2C + select SND_SOC_RT5616 if I2C ++ select SND_SOC_PCM5102A if I2C + select SND_SOC_RT5631 if I2C + select SND_SOC_RT5640 if I2C + select SND_SOC_RT5645 if I2C +@@ -631,6 +632,10 @@ config SND_SOC_RT5616 + tristate "Realtek RT5616 CODEC" + depends on I2C + ++config SND_SOC_PCM5102A ++ tristate ++ depends on I2C + -+bool vc4_check_tex_size(struct vc4_exec_info *exec, -+ struct drm_gem_cma_object *fbo, -+ uint32_t offset, uint8_t tiling_format, -+ uint32_t width, uint32_t height, uint8_t cpp); -diff --git a/drivers/gpu/drm/vc4/vc4_gem.c b/drivers/gpu/drm/vc4/vc4_gem.c + config SND_SOC_RT5631 + tristate "Realtek ALC5631/RT5631 CODEC" + depends on I2C +diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile +index 185a712..7522017 100644 +--- a/sound/soc/codecs/Makefile ++++ b/sound/soc/codecs/Makefile +@@ -98,6 +98,7 @@ snd-soc-rt286-objs := rt286.o + snd-soc-rt298-objs := rt298.o + snd-soc-rt5514-objs := rt5514.o + snd-soc-rt5616-objs := rt5616.o ++snd-soc-pcm5102a-objs := pcm5102a.o + snd-soc-rt5631-objs := rt5631.o + snd-soc-rt5640-objs := rt5640.o + snd-soc-rt5645-objs := rt5645.o +@@ -307,6 +308,7 @@ obj-$(CONFIG_SND_SOC_RT286) += snd-soc-rt286.o + obj-$(CONFIG_SND_SOC_RT298) += snd-soc-rt298.o + obj-$(CONFIG_SND_SOC_RT5514) += snd-soc-rt5514.o + obj-$(CONFIG_SND_SOC_RT5616) += snd-soc-rt5616.o ++obj-$(CONFIG_SND_SOC_PCM5102A) += snd-soc-pcm5102a.o + obj-$(CONFIG_SND_SOC_RT5631) += snd-soc-rt5631.o + obj-$(CONFIG_SND_SOC_RT5640) += snd-soc-rt5640.o + obj-$(CONFIG_SND_SOC_RT5645) += snd-soc-rt5645.o +diff --git a/sound/soc/codecs/pcm5102a.c b/sound/soc/codecs/pcm5102a.c new file mode 100644 -index 0000000..361390b +index 0000000..7c6598e --- /dev/null -+++ b/drivers/gpu/drm/vc4/vc4_gem.c -@@ -0,0 +1,686 @@ ++++ b/sound/soc/codecs/pcm5102a.c +@@ -0,0 +1,70 @@ +/* -+ * Copyright © 2014 Broadcom ++ * Driver for the PCM5102A codec + * -+ * Permission is hereby granted, free of charge, to any person obtaining a -+ * copy of this software and associated documentation files (the "Software"), -+ * to deal in the Software without restriction, including without limitation -+ * the rights to use, copy, modify, merge, publish, distribute, sublicense, -+ * and/or sell copies of the Software, and to permit persons to whom the -+ * Software is furnished to do so, subject to the following conditions: ++ * Author: Florian Meier <florian.meier@koalo.de> ++ * Copyright 2013 + * -+ * The above copyright notice and this permission notice (including the next -+ * paragraph) shall be included in all copies or substantial portions of the -+ * Software. ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * version 2 as published by the Free Software Foundation. + * -+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -+ * IN THE SOFTWARE. ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * General Public License for more details. + */ + ++ ++#include <linux/init.h> +#include <linux/module.h> +#include <linux/platform_device.h> -+#include <linux/device.h> -+#include <linux/io.h> -+ -+#include "uapi/drm/vc4_drm.h" -+#include "vc4_drv.h" -+#include "vc4_regs.h" -+#include "vc4_trace.h" -+ -+static void -+vc4_queue_hangcheck(struct drm_device *dev) -+{ -+ struct vc4_dev *vc4 = to_vc4_dev(dev); -+ -+ mod_timer(&vc4->hangcheck.timer, -+ round_jiffies_up(jiffies + msecs_to_jiffies(100))); -+} -+ -+static void -+vc4_reset(struct drm_device *dev) -+{ -+ struct vc4_dev *vc4 = to_vc4_dev(dev); -+ -+ DRM_INFO("Resetting GPU.\n"); -+ vc4_v3d_set_power(vc4, false); -+ vc4_v3d_set_power(vc4, true); -+ -+ vc4_irq_reset(dev); -+ -+ /* Rearm the hangcheck -- another job might have been waiting -+ * for our hung one to get kicked off, and vc4_irq_reset() -+ * would have started it. -+ */ -+ vc4_queue_hangcheck(dev); -+} -+ -+static void -+vc4_reset_work(struct work_struct *work) -+{ -+ struct vc4_dev *vc4 = -+ container_of(work, struct vc4_dev, hangcheck.reset_work); -+ -+ vc4_reset(vc4->dev); -+} -+ -+static void -+vc4_hangcheck_elapsed(unsigned long data) -+{ -+ struct drm_device *dev = (struct drm_device *)data; -+ struct vc4_dev *vc4 = to_vc4_dev(dev); -+ uint32_t ct0ca, ct1ca; -+ -+ /* If idle, we can stop watching for hangs. */ -+ if (list_empty(&vc4->job_list)) -+ return; -+ -+ ct0ca = V3D_READ(V3D_CTNCA(0)); -+ ct1ca = V3D_READ(V3D_CTNCA(1)); -+ -+ /* If we've made any progress in execution, rearm the timer -+ * and wait. -+ */ -+ if (ct0ca != vc4->hangcheck.last_ct0ca || -+ ct1ca != vc4->hangcheck.last_ct1ca) { -+ vc4->hangcheck.last_ct0ca = ct0ca; -+ vc4->hangcheck.last_ct1ca = ct1ca; -+ vc4_queue_hangcheck(dev); -+ return; -+ } -+ -+ /* We've gone too long with no progress, reset. This has to -+ * be done from a work struct, since resetting can sleep and -+ * this timer hook isn't allowed to. -+ */ -+ schedule_work(&vc4->hangcheck.reset_work); -+} -+ -+static void -+submit_cl(struct drm_device *dev, uint32_t thread, uint32_t start, uint32_t end) -+{ -+ struct vc4_dev *vc4 = to_vc4_dev(dev); -+ -+ /* Stop any existing thread and set state to "stopped at halt" */ -+ V3D_WRITE(V3D_CTNCS(thread), V3D_CTRUN); -+ barrier(); -+ -+ V3D_WRITE(V3D_CTNCA(thread), start); -+ barrier(); -+ -+ /* Set the end address of the control list. Writing this -+ * register is what starts the job. -+ */ -+ V3D_WRITE(V3D_CTNEA(thread), end); -+ barrier(); -+} -+ -+int -+vc4_wait_for_seqno(struct drm_device *dev, uint64_t seqno, uint64_t timeout_ns, -+ bool interruptible) -+{ -+ struct vc4_dev *vc4 = to_vc4_dev(dev); -+ int ret = 0; -+ unsigned long timeout_expire; -+ DEFINE_WAIT(wait); -+ -+ if (vc4->finished_seqno >= seqno) -+ return 0; -+ -+ if (timeout_ns == 0) -+ return -ETIME; -+ -+ timeout_expire = jiffies + nsecs_to_jiffies(timeout_ns); -+ -+ trace_vc4_wait_for_seqno_begin(dev, seqno, timeout_ns); -+ for (;;) { -+ prepare_to_wait(&vc4->job_wait_queue, &wait, -+ interruptible ? TASK_INTERRUPTIBLE : -+ TASK_UNINTERRUPTIBLE); -+ -+ if (interruptible && signal_pending(current)) { -+ ret = -ERESTARTSYS; -+ break; -+ } -+ -+ if (vc4->finished_seqno >= seqno) -+ break; -+ -+ if (timeout_ns != ~0ull) { -+ if (time_after_eq(jiffies, timeout_expire)) { -+ ret = -ETIME; -+ break; -+ } -+ schedule_timeout(timeout_expire - jiffies); -+ } else { -+ schedule(); -+ } -+ } -+ -+ finish_wait(&vc4->job_wait_queue, &wait); -+ trace_vc4_wait_for_seqno_end(dev, seqno); -+ -+ if (ret && ret != -ERESTARTSYS) { -+ DRM_ERROR("timeout waiting for render thread idle\n"); -+ return ret; -+ } -+ -+ return 0; -+} -+ -+static void -+vc4_flush_caches(struct drm_device *dev) -+{ -+ struct vc4_dev *vc4 = to_vc4_dev(dev); -+ -+ /* Flush the GPU L2 caches. These caches sit on top of system -+ * L3 (the 128kb or so shared with the CPU), and are -+ * non-allocating in the L3. -+ */ -+ V3D_WRITE(V3D_L2CACTL, -+ V3D_L2CACTL_L2CCLR); -+ -+ V3D_WRITE(V3D_SLCACTL, -+ VC4_SET_FIELD(0xf, V3D_SLCACTL_T1CC) | -+ VC4_SET_FIELD(0xf, V3D_SLCACTL_T0CC) | -+ VC4_SET_FIELD(0xf, V3D_SLCACTL_UCC) | -+ VC4_SET_FIELD(0xf, V3D_SLCACTL_ICC)); -+} -+ -+/* Sets the registers for the next job to be actually be executed in -+ * the hardware. -+ * -+ * The job_lock should be held during this. -+ */ -+void -+vc4_submit_next_job(struct drm_device *dev) -+{ -+ struct vc4_dev *vc4 = to_vc4_dev(dev); -+ struct vc4_exec_info *exec = vc4_first_job(vc4); -+ -+ if (!exec) -+ return; -+ -+ vc4_flush_caches(dev); -+ -+ /* Disable the binner's pre-loaded overflow memory address */ -+ V3D_WRITE(V3D_BPOA, 0); -+ V3D_WRITE(V3D_BPOS, 0); -+ -+ if (exec->ct0ca != exec->ct0ea) -+ submit_cl(dev, 0, exec->ct0ca, exec->ct0ea); -+ submit_cl(dev, 1, exec->ct1ca, exec->ct1ea); -+} -+ -+static void -+vc4_update_bo_seqnos(struct vc4_exec_info *exec, uint64_t seqno) -+{ -+ struct vc4_bo *bo; -+ unsigned i; -+ -+ for (i = 0; i < exec->bo_count; i++) { -+ bo = to_vc4_bo(&exec->bo[i].bo->base); -+ bo->seqno = seqno; -+ } -+ -+ list_for_each_entry(bo, &exec->unref_list, unref_head) { -+ bo->seqno = seqno; -+ } -+} -+ -+/* Queues a struct vc4_exec_info for execution. If no job is -+ * currently executing, then submits it. -+ * -+ * Unlike most GPUs, our hardware only handles one command list at a -+ * time. To queue multiple jobs at once, we'd need to edit the -+ * previous command list to have a jump to the new one at the end, and -+ * then bump the end address. That's a change for a later date, -+ * though. -+ */ -+static void -+vc4_queue_submit(struct drm_device *dev, struct vc4_exec_info *exec) -+{ -+ struct vc4_dev *vc4 = to_vc4_dev(dev); -+ uint64_t seqno = ++vc4->emit_seqno; -+ unsigned long irqflags; -+ -+ exec->seqno = seqno; -+ vc4_update_bo_seqnos(exec, seqno); -+ -+ spin_lock_irqsave(&vc4->job_lock, irqflags); -+ list_add_tail(&exec->head, &vc4->job_list); -+ -+ /* If no job was executing, kick ours off. Otherwise, it'll -+ * get started when the previous job's frame done interrupt -+ * occurs. -+ */ -+ if (vc4_first_job(vc4) == exec) { -+ vc4_submit_next_job(dev); -+ vc4_queue_hangcheck(dev); -+ } -+ -+ spin_unlock_irqrestore(&vc4->job_lock, irqflags); -+} -+ -+/** -+ * Looks up a bunch of GEM handles for BOs and stores the array for -+ * use in the command validator that actually writes relocated -+ * addresses pointing to them. -+ */ -+static int -+vc4_cl_lookup_bos(struct drm_device *dev, -+ struct drm_file *file_priv, -+ struct vc4_exec_info *exec) -+{ -+ struct drm_vc4_submit_cl *args = exec->args; -+ uint32_t *handles; -+ int ret = 0; -+ int i; -+ -+ exec->bo_count = args->bo_handle_count; -+ -+ if (!exec->bo_count) { -+ /* See comment on bo_index for why we have to check -+ * this. -+ */ -+ DRM_ERROR("Rendering requires BOs to validate\n"); -+ return -EINVAL; -+ } -+ -+ exec->bo = kcalloc(exec->bo_count, sizeof(struct vc4_bo_exec_state), -+ GFP_KERNEL); -+ if (!exec->bo) { -+ DRM_ERROR("Failed to allocate validated BO pointers\n"); -+ return -ENOMEM; -+ } -+ -+ handles = drm_malloc_ab(exec->bo_count, sizeof(uint32_t)); -+ if (!handles) { -+ DRM_ERROR("Failed to allocate incoming GEM handles\n"); -+ goto fail; -+ } -+ -+ ret = copy_from_user(handles, -+ (void __user *)(uintptr_t)args->bo_handles, -+ exec->bo_count * sizeof(uint32_t)); -+ if (ret) { -+ DRM_ERROR("Failed to copy in GEM handles\n"); -+ goto fail; -+ } -+ -+ spin_lock(&file_priv->table_lock); -+ for (i = 0; i < exec->bo_count; i++) { -+ struct drm_gem_object *bo = idr_find(&file_priv->object_idr, -+ handles[i]); -+ if (!bo) { -+ DRM_ERROR("Failed to look up GEM BO %d: %d\n", -+ i, handles[i]); -+ ret = -EINVAL; -+ spin_unlock(&file_priv->table_lock); -+ goto fail; -+ } -+ drm_gem_object_reference(bo); -+ exec->bo[i].bo = (struct drm_gem_cma_object *)bo; -+ } -+ spin_unlock(&file_priv->table_lock); -+ -+fail: -+ kfree(handles); -+ return 0; -+} -+ -+static int -+vc4_get_bcl(struct drm_device *dev, struct vc4_exec_info *exec) -+{ -+ struct drm_vc4_submit_cl *args = exec->args; -+ void *temp = NULL; -+ void *bin; -+ int ret = 0; -+ uint32_t bin_offset = 0; -+ uint32_t shader_rec_offset = roundup(bin_offset + args->bin_cl_size, -+ 16); -+ uint32_t uniforms_offset = shader_rec_offset + args->shader_rec_size; -+ uint32_t exec_size = uniforms_offset + args->uniforms_size; -+ uint32_t temp_size = exec_size + (sizeof(struct vc4_shader_state) * -+ args->shader_rec_count); -+ struct vc4_bo *bo; -+ -+ if (uniforms_offset < shader_rec_offset || -+ exec_size < uniforms_offset || -+ args->shader_rec_count >= (UINT_MAX / -+ sizeof(struct vc4_shader_state)) || -+ temp_size < exec_size) { -+ DRM_ERROR("overflow in exec arguments\n"); -+ goto fail; -+ } -+ -+ /* Allocate space where we'll store the copied in user command lists -+ * and shader records. -+ * -+ * We don't just copy directly into the BOs because we need to -+ * read the contents back for validation, and I think the -+ * bo->vaddr is uncached access. -+ */ -+ temp = kmalloc(temp_size, GFP_KERNEL); -+ if (!temp) { -+ DRM_ERROR("Failed to allocate storage for copying " -+ "in bin/render CLs.\n"); -+ ret = -ENOMEM; -+ goto fail; -+ } -+ bin = temp + bin_offset; -+ exec->shader_rec_u = temp + shader_rec_offset; -+ exec->uniforms_u = temp + uniforms_offset; -+ exec->shader_state = temp + exec_size; -+ exec->shader_state_size = args->shader_rec_count; -+ -+ ret = copy_from_user(bin, -+ (void __user *)(uintptr_t)args->bin_cl, -+ args->bin_cl_size); -+ if (ret) { -+ DRM_ERROR("Failed to copy in bin cl\n"); -+ goto fail; -+ } -+ -+ ret = copy_from_user(exec->shader_rec_u, -+ (void __user *)(uintptr_t)args->shader_rec, -+ args->shader_rec_size); -+ if (ret) { -+ DRM_ERROR("Failed to copy in shader recs\n"); -+ goto fail; -+ } -+ -+ ret = copy_from_user(exec->uniforms_u, -+ (void __user *)(uintptr_t)args->uniforms, -+ args->uniforms_size); -+ if (ret) { -+ DRM_ERROR("Failed to copy in uniforms cl\n"); -+ goto fail; -+ } -+ -+ bo = vc4_bo_create(dev, exec_size); -+ if (!bo) { -+ DRM_ERROR("Couldn't allocate BO for binning\n"); -+ ret = PTR_ERR(exec->exec_bo); -+ goto fail; -+ } -+ exec->exec_bo = &bo->base; -+ -+ list_add_tail(&to_vc4_bo(&exec->exec_bo->base)->unref_head, -+ &exec->unref_list); -+ -+ exec->ct0ca = exec->exec_bo->paddr + bin_offset; -+ -+ exec->shader_rec_v = exec->exec_bo->vaddr + shader_rec_offset; -+ exec->shader_rec_p = exec->exec_bo->paddr + shader_rec_offset; -+ exec->shader_rec_size = args->shader_rec_size; -+ -+ exec->uniforms_v = exec->exec_bo->vaddr + uniforms_offset; -+ exec->uniforms_p = exec->exec_bo->paddr + uniforms_offset; -+ exec->uniforms_size = args->uniforms_size; -+ -+ ret = vc4_validate_bin_cl(dev, -+ exec->exec_bo->vaddr + bin_offset, -+ bin, -+ exec); -+ if (ret) -+ goto fail; -+ -+ ret = vc4_validate_shader_recs(dev, exec); -+ -+fail: -+ kfree(temp); -+ return ret; -+} -+ -+static void -+vc4_complete_exec(struct vc4_exec_info *exec) -+{ -+ unsigned i; -+ -+ if (exec->bo) { -+ for (i = 0; i < exec->bo_count; i++) -+ drm_gem_object_unreference(&exec->bo[i].bo->base); -+ kfree(exec->bo); -+ } -+ -+ while (!list_empty(&exec->unref_list)) { -+ struct vc4_bo *bo = list_first_entry(&exec->unref_list, -+ struct vc4_bo, unref_head); -+ list_del(&bo->unref_head); -+ drm_gem_object_unreference(&bo->base.base); -+ } -+ -+ kfree(exec); -+} -+ -+void -+vc4_job_handle_completed(struct vc4_dev *vc4) -+{ -+ unsigned long irqflags; -+ struct vc4_seqno_cb *cb, *cb_temp; -+ -+ spin_lock_irqsave(&vc4->job_lock, irqflags); -+ while (!list_empty(&vc4->job_done_list)) { -+ struct vc4_exec_info *exec = -+ list_first_entry(&vc4->job_done_list, -+ struct vc4_exec_info, head); -+ list_del(&exec->head); -+ -+ spin_unlock_irqrestore(&vc4->job_lock, irqflags); -+ vc4_complete_exec(exec); -+ spin_lock_irqsave(&vc4->job_lock, irqflags); -+ } -+ spin_unlock_irqrestore(&vc4->job_lock, irqflags); -+ -+ list_for_each_entry_safe(cb, cb_temp, &vc4->seqno_cb_list, work.entry) { -+ if (cb->seqno <= vc4->finished_seqno) { -+ list_del_init(&cb->work.entry); -+ schedule_work(&cb->work); -+ } -+ } -+} -+ -+static void vc4_seqno_cb_work(struct work_struct *work) -+{ -+ struct vc4_seqno_cb *cb = container_of(work, struct vc4_seqno_cb, work); -+ cb->func(cb); -+} -+ -+int vc4_queue_seqno_cb(struct drm_device *dev, -+ struct vc4_seqno_cb *cb, uint64_t seqno, -+ void (*func)(struct vc4_seqno_cb *cb)) -+{ -+ struct vc4_dev *vc4 = to_vc4_dev(dev); -+ int ret = 0; + -+ cb->func = func; -+ INIT_WORK(&cb->work, vc4_seqno_cb_work); -+ -+ mutex_lock(&dev->struct_mutex); -+ if (seqno > vc4->finished_seqno) { -+ cb->seqno = seqno; -+ list_add_tail(&cb->work.entry, &vc4->seqno_cb_list); -+ } else { -+ schedule_work(&cb->work); -+ } -+ mutex_unlock(&dev->struct_mutex); -+ -+ return ret; -+} -+ -+/* Scheduled when any job has been completed, this walks the list of -+ * jobs that had completed and unrefs their BOs and frees their exec -+ * structs. -+ */ -+static void -+vc4_job_done_work(struct work_struct *work) -+{ -+ struct vc4_dev *vc4 = -+ container_of(work, struct vc4_dev, job_done_work); -+ struct drm_device *dev = vc4->dev; -+ -+ /* Need the struct lock for drm_gem_object_unreference(). */ -+ mutex_lock(&dev->struct_mutex); -+ vc4_job_handle_completed(vc4); -+ mutex_unlock(&dev->struct_mutex); -+} -+ -+static int -+vc4_wait_for_seqno_ioctl_helper(struct drm_device *dev, -+ uint64_t seqno, -+ uint64_t *timeout_ns) -+{ -+ unsigned long start = jiffies; -+ int ret = vc4_wait_for_seqno(dev, seqno, *timeout_ns, true); -+ -+ if ((ret == -EINTR || ret == -ERESTARTSYS) && *timeout_ns != ~0ull) { -+ uint64_t delta = jiffies_to_nsecs(jiffies - start); -+ if (*timeout_ns >= delta) -+ *timeout_ns -= delta; -+ } -+ -+ return ret; -+} ++#include <sound/soc.h> + -+int -+vc4_wait_seqno_ioctl(struct drm_device *dev, void *data, -+ struct drm_file *file_priv) -+{ -+ struct drm_vc4_wait_seqno *args = data; ++static struct snd_soc_dai_driver pcm5102a_dai = { ++ .name = "pcm5102a-hifi", ++ .playback = { ++ .channels_min = 2, ++ .channels_max = 2, ++ .rates = SNDRV_PCM_RATE_8000_192000, ++ .formats = SNDRV_PCM_FMTBIT_S16_LE | ++ SNDRV_PCM_FMTBIT_S24_LE | ++ SNDRV_PCM_FMTBIT_S32_LE ++ }, ++}; + -+ return vc4_wait_for_seqno_ioctl_helper(dev, args->seqno, -+ &args->timeout_ns); -+} ++static struct snd_soc_codec_driver soc_codec_dev_pcm5102a; + -+int -+vc4_wait_bo_ioctl(struct drm_device *dev, void *data, -+ struct drm_file *file_priv) ++static int pcm5102a_probe(struct platform_device *pdev) +{ -+ int ret; -+ struct drm_vc4_wait_bo *args = data; -+ struct drm_gem_object *gem_obj; -+ struct vc4_bo *bo; -+ -+ gem_obj = drm_gem_object_lookup(dev, file_priv, args->handle); -+ if (!gem_obj) { -+ DRM_ERROR("Failed to look up GEM BO %d\n", args->handle); -+ return -EINVAL; -+ } -+ bo = to_vc4_bo(gem_obj); -+ -+ ret = vc4_wait_for_seqno_ioctl_helper(dev, bo->seqno, &args->timeout_ns); -+ -+ drm_gem_object_unreference(gem_obj); -+ return ret; ++ return snd_soc_register_codec(&pdev->dev, &soc_codec_dev_pcm5102a, ++ &pcm5102a_dai, 1); +} + -+/** -+ * Submits a command list to the VC4. -+ * -+ * This is what is called batchbuffer emitting on other hardware. -+ */ -+int -+vc4_submit_cl_ioctl(struct drm_device *dev, void *data, -+ struct drm_file *file_priv) ++static int pcm5102a_remove(struct platform_device *pdev) +{ -+ struct vc4_dev *vc4 = to_vc4_dev(dev); -+ struct drm_vc4_submit_cl *args = data; -+ struct vc4_exec_info *exec; -+ int ret; -+ -+ if ((args->flags & ~VC4_SUBMIT_CL_USE_CLEAR_COLOR) != 0) { -+ DRM_ERROR("Unknown flags: 0x%02x\n", args->flags); -+ return -EINVAL; -+ } -+ -+ exec = kcalloc(1, sizeof(*exec), GFP_KERNEL); -+ if (!exec) { -+ DRM_ERROR("malloc failure on exec struct\n"); -+ return -ENOMEM; -+ } -+ -+ exec->args = args; -+ INIT_LIST_HEAD(&exec->unref_list); -+ -+ mutex_lock(&dev->struct_mutex); -+ -+ ret = vc4_cl_lookup_bos(dev, file_priv, exec); -+ if (ret) -+ goto fail; -+ -+ if (exec->args->bin_cl_size != 0) { -+ ret = vc4_get_bcl(dev, exec); -+ if (ret) -+ goto fail; -+ } else { -+ exec->ct0ca = exec->ct0ea = 0; -+ } -+ -+ ret = vc4_get_rcl(dev, exec); -+ if (ret) -+ goto fail; -+ -+ /* Clear this out of the struct we'll be putting in the queue, -+ * since it's part of our stack. -+ */ -+ exec->args = NULL; -+ -+ vc4_queue_submit(dev, exec); -+ -+ /* Return the seqno for our job. */ -+ args->seqno = vc4->emit_seqno; -+ -+ mutex_unlock(&dev->struct_mutex); -+ ++ snd_soc_unregister_codec(&pdev->dev); + return 0; -+ -+fail: -+ vc4_complete_exec(exec); -+ -+ mutex_unlock(&dev->struct_mutex); -+ -+ return ret; +} + -+void -+vc4_gem_init(struct drm_device *dev) -+{ -+ struct vc4_dev *vc4 = to_vc4_dev(dev); -+ -+ INIT_LIST_HEAD(&vc4->job_list); -+ INIT_LIST_HEAD(&vc4->job_done_list); -+ INIT_LIST_HEAD(&vc4->seqno_cb_list); -+ spin_lock_init(&vc4->job_lock); -+ -+ INIT_WORK(&vc4->hangcheck.reset_work, vc4_reset_work); -+ setup_timer(&vc4->hangcheck.timer, -+ vc4_hangcheck_elapsed, -+ (unsigned long) dev); ++static const struct of_device_id pcm5102a_of_match[] = { ++ { .compatible = "ti,pcm5102a", }, ++ { } ++}; ++MODULE_DEVICE_TABLE(of, pcm5102a_of_match); + -+ INIT_WORK(&vc4->job_done_work, vc4_job_done_work); -+} ++static struct platform_driver pcm5102a_codec_driver = { ++ .probe = pcm5102a_probe, ++ .remove = pcm5102a_remove, ++ .driver = { ++ .name = "pcm5102a-codec", ++ .owner = THIS_MODULE, ++ .of_match_table = pcm5102a_of_match, ++ }, ++}; + -+void -+vc4_gem_destroy(struct drm_device *dev) -+{ -+ struct vc4_dev *vc4 = to_vc4_dev(dev); ++module_platform_driver(pcm5102a_codec_driver); + -+ /* Waiting for exec to finish would need to be done before -+ * unregistering V3D. -+ */ -+ WARN_ON(vc4->emit_seqno != vc4->finished_seqno); ++MODULE_DESCRIPTION("ASoC PCM5102A codec driver"); ++MODULE_AUTHOR("Florian Meier <florian.meier@koalo.de>"); ++MODULE_LICENSE("GPL v2"); + +From 8963bf5947a58437d86fd18cd2e1a3dacb6c16ae Mon Sep 17 00:00:00 2001 +From: Florian Meier <florian.meier@koalo.de> +Date: Fri, 22 Nov 2013 19:19:08 +0100 +Subject: [PATCH 066/112] ASoC: Add support for HifiBerry DAC + +This adds a machine driver for the HifiBerry DAC. +It is a sound card that can +be stacked onto the Raspberry Pi. + +Signed-off-by: Florian Meier <florian.meier@koalo.de> +--- + sound/soc/bcm/Kconfig | 7 +++ + sound/soc/bcm/Makefile | 4 ++ + sound/soc/bcm/hifiberry_dac.c | 123 ++++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 134 insertions(+) + create mode 100644 sound/soc/bcm/hifiberry_dac.c + +diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig +index c5070ae..ce81f14 100644 +--- a/sound/soc/bcm/Kconfig ++++ b/sound/soc/bcm/Kconfig +@@ -7,3 +7,10 @@ config SND_BCM2835_SOC_I2S + Say Y or M if you want to add support for codecs attached to + the BCM2835 I2S interface. You will also need + to select the audio interfaces to support below. + -+ /* V3D should already have disabled its interrupt and cleared -+ * the overflow allocation registers. Now free the object. -+ */ -+ if (vc4->overflow_mem) { -+ drm_gem_object_unreference_unlocked(&vc4->overflow_mem->base.base); -+ vc4->overflow_mem = NULL; -+ } ++config SND_BCM2708_SOC_HIFIBERRY_DAC ++ tristate "Support for HifiBerry DAC" ++ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S ++ select SND_SOC_PCM5102A ++ help ++ Say Y or M if you want to add support for HifiBerry DAC. +diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile +index bc816b7..b877d38 100644 +--- a/sound/soc/bcm/Makefile ++++ b/sound/soc/bcm/Makefile +@@ -3,3 +3,7 @@ snd-soc-bcm2835-i2s-objs := bcm2835-i2s.o + + obj-$(CONFIG_SND_BCM2835_SOC_I2S) += snd-soc-bcm2835-i2s.o + ++# BCM2708 Machine Support ++snd-soc-hifiberry-dac-objs := hifiberry_dac.o + -+ vc4_bo_cache_destroy(dev); -+} -diff --git a/drivers/gpu/drm/vc4/vc4_irq.c b/drivers/gpu/drm/vc4/vc4_irq.c ++obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o +diff --git a/sound/soc/bcm/hifiberry_dac.c b/sound/soc/bcm/hifiberry_dac.c new file mode 100644 -index 0000000..f29b796 +index 0000000..29ecc08 --- /dev/null -+++ b/drivers/gpu/drm/vc4/vc4_irq.c -@@ -0,0 +1,211 @@ ++++ b/sound/soc/bcm/hifiberry_dac.c +@@ -0,0 +1,123 @@ +/* -+ * Copyright © 2014 Broadcom -+ * -+ * Permission is hereby granted, free of charge, to any person obtaining a -+ * copy of this software and associated documentation files (the "Software"), -+ * to deal in the Software without restriction, including without limitation -+ * the rights to use, copy, modify, merge, publish, distribute, sublicense, -+ * and/or sell copies of the Software, and to permit persons to whom the -+ * Software is furnished to do so, subject to the following conditions: -+ * -+ * The above copyright notice and this permission notice (including the next -+ * paragraph) shall be included in all copies or substantial portions of the -+ * Software. -+ * -+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -+ * IN THE SOFTWARE. -+ */ -+ -+/** DOC: Interrupt management for the V3D engine. ++ * ASoC Driver for HifiBerry DAC + * -+ * We have an interrupt status register (V3D_INTCTL) which reports -+ * interrupts, and where writing 1 bits clears those interrupts. -+ * There are also a pair of interrupt registers -+ * (V3D_INTENA/V3D_INTDIS) where writing a 1 to their bits enables or -+ * disables that specific interrupt, and 0s written are ignored -+ * (reading either one returns the set of enabled interrupts). ++ * Author: Florian Meier <florian.meier@koalo.de> ++ * Copyright 2013 + * -+ * When we take a render frame interrupt, we need to wake the -+ * processes waiting for some frame to be done, and get the next frame -+ * submitted ASAP (so the hardware doesn't sit idle when there's work -+ * to do). ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * version 2 as published by the Free Software Foundation. + * -+ * When we take the binner out of memory interrupt, we need to -+ * allocate some new memory and pass it to the binner so that the -+ * current job can make progress. ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * General Public License for more details. + */ + -+#include "vc4_drv.h" -+#include "vc4_regs.h" -+ -+#define V3D_DRIVER_IRQS (V3D_INT_OUTOMEM | \ -+ V3D_INT_FRDONE) -+ -+DECLARE_WAIT_QUEUE_HEAD(render_wait); -+ -+static void -+vc4_overflow_mem_work(struct work_struct *work) -+{ -+ struct vc4_dev *vc4 = -+ container_of(work, struct vc4_dev, overflow_mem_work); -+ struct drm_device *dev = vc4->dev; -+ struct vc4_bo *bo; -+ -+ bo = vc4_bo_create(dev, 256 * 1024); -+ if (!bo) { -+ DRM_ERROR("Couldn't allocate binner overflow mem\n"); -+ return; -+ } -+ -+ /* If there's a job executing currently, then our previous -+ * overflow allocation is getting used in that job and we need -+ * to queue it to be released when the job is done. But if no -+ * job is executing at all, then we can free the old overflow -+ * object direcctly. -+ * -+ * No lock necessary for this pointer since we're the only -+ * ones that update the pointer, and our workqueue won't -+ * reenter. -+ */ -+ if (vc4->overflow_mem) { -+ struct vc4_exec_info *current_exec; -+ unsigned long irqflags; -+ -+ spin_lock_irqsave(&vc4->job_lock, irqflags); -+ current_exec = vc4_first_job(vc4); -+ if (current_exec) { -+ vc4->overflow_mem->seqno = vc4->finished_seqno + 1; -+ list_add_tail(&vc4->overflow_mem->unref_head, -+ &current_exec->unref_list); -+ vc4->overflow_mem = NULL; -+ } -+ spin_unlock_irqrestore(&vc4->job_lock, irqflags); -+ } -+ -+ if (vc4->overflow_mem) { -+ drm_gem_object_unreference_unlocked(&vc4->overflow_mem->base.base); -+ } -+ vc4->overflow_mem = bo; ++#include <linux/module.h> ++#include <linux/platform_device.h> + -+ V3D_WRITE(V3D_BPOA, bo->base.paddr); -+ V3D_WRITE(V3D_BPOS, bo->base.base.size); -+ V3D_WRITE(V3D_INTCTL, V3D_INT_OUTOMEM); -+ V3D_WRITE(V3D_INTENA, V3D_INT_OUTOMEM); -+} ++#include <sound/core.h> ++#include <sound/pcm.h> ++#include <sound/pcm_params.h> ++#include <sound/soc.h> ++#include <sound/jack.h> + -+static void -+vc4_irq_finish_job(struct drm_device *dev) ++static int snd_rpi_hifiberry_dac_init(struct snd_soc_pcm_runtime *rtd) +{ -+ struct vc4_dev *vc4 = to_vc4_dev(dev); -+ struct vc4_exec_info *exec = vc4_first_job(vc4); -+ -+ if (!exec) -+ return; -+ -+ vc4->finished_seqno++; -+ list_move_tail(&exec->head, &vc4->job_done_list); -+ vc4_submit_next_job(dev); -+ -+ wake_up_all(&vc4->job_wait_queue); -+ schedule_work(&vc4->job_done_work); ++ return 0; +} + -+irqreturn_t -+vc4_irq(int irq, void *arg) ++static int snd_rpi_hifiberry_dac_hw_params(struct snd_pcm_substream *substream, ++ struct snd_pcm_hw_params *params) +{ -+ struct drm_device *dev = arg; -+ struct vc4_dev *vc4 = to_vc4_dev(dev); -+ uint32_t intctl; -+ irqreturn_t status = IRQ_NONE; -+ -+ barrier(); -+ intctl = V3D_READ(V3D_INTCTL); -+ -+ /* Acknowledge the interrupts we're handling here. The render -+ * frame done interrupt will be cleared, while OUTOMEM will -+ * stay high until the underlying cause is cleared. -+ */ -+ V3D_WRITE(V3D_INTCTL, intctl); -+ -+ if (intctl & V3D_INT_OUTOMEM) { -+ /* Disable OUTOMEM until the work is done. */ -+ V3D_WRITE(V3D_INTDIS, V3D_INT_OUTOMEM); -+ schedule_work(&vc4->overflow_mem_work); -+ status = IRQ_HANDLED; -+ } ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; + -+ if (intctl & V3D_INT_FRDONE) { -+ spin_lock(&vc4->job_lock); -+ vc4_irq_finish_job(dev); -+ spin_unlock(&vc4->job_lock); -+ status = IRQ_HANDLED; -+ } ++ unsigned int sample_bits = ++ snd_pcm_format_physical_width(params_format(params)); + -+ return status; ++ return snd_soc_dai_set_bclk_ratio(cpu_dai, sample_bits * 2); +} + -+void -+vc4_irq_preinstall(struct drm_device *dev) -+{ -+ struct vc4_dev *vc4 = to_vc4_dev(dev); -+ -+ init_waitqueue_head(&vc4->job_wait_queue); -+ INIT_WORK(&vc4->overflow_mem_work, vc4_overflow_mem_work); -+ -+ /* Clear any pending interrupts someone might have left around -+ * for us. -+ */ -+ V3D_WRITE(V3D_INTCTL, V3D_DRIVER_IRQS); -+} ++/* machine stream operations */ ++static struct snd_soc_ops snd_rpi_hifiberry_dac_ops = { ++ .hw_params = snd_rpi_hifiberry_dac_hw_params, ++}; + -+int -+vc4_irq_postinstall(struct drm_device *dev) ++static struct snd_soc_dai_link snd_rpi_hifiberry_dac_dai[] = { +{ -+ struct vc4_dev *vc4 = to_vc4_dev(dev); -+ -+ /* Enable both the render done and out of memory interrupts. */ -+ V3D_WRITE(V3D_INTENA, V3D_DRIVER_IRQS); ++ .name = "HifiBerry DAC", ++ .stream_name = "HifiBerry DAC HiFi", ++ .cpu_dai_name = "bcm2708-i2s.0", ++ .codec_dai_name = "pcm5102a-hifi", ++ .platform_name = "bcm2708-i2s.0", ++ .codec_name = "pcm5102a-codec", ++ .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | ++ SND_SOC_DAIFMT_CBS_CFS, ++ .ops = &snd_rpi_hifiberry_dac_ops, ++ .init = snd_rpi_hifiberry_dac_init, ++}, ++}; + -+ return 0; -+} ++/* audio machine driver */ ++static struct snd_soc_card snd_rpi_hifiberry_dac = { ++ .name = "snd_rpi_hifiberry_dac", ++ .owner = THIS_MODULE, ++ .dai_link = snd_rpi_hifiberry_dac_dai, ++ .num_links = ARRAY_SIZE(snd_rpi_hifiberry_dac_dai), ++}; + -+void -+vc4_irq_uninstall(struct drm_device *dev) ++static int snd_rpi_hifiberry_dac_probe(struct platform_device *pdev) +{ -+ struct vc4_dev *vc4 = to_vc4_dev(dev); -+ -+ /* Disable sending interrupts for our driver's IRQs. */ -+ V3D_WRITE(V3D_INTDIS, V3D_DRIVER_IRQS); -+ -+ /* Clear any pending interrupts we might have left. */ -+ V3D_WRITE(V3D_INTCTL, V3D_DRIVER_IRQS); -+ -+ cancel_work_sync(&vc4->overflow_mem_work); -+} ++ int ret = 0; + -+/** Reinitializes interrupt registers when a GPU reset is performed. */ -+void vc4_irq_reset(struct drm_device *dev) -+{ -+ struct vc4_dev *vc4 = to_vc4_dev(dev); -+ unsigned long irqflags; ++ snd_rpi_hifiberry_dac.dev = &pdev->dev; + -+ /* Acknowledge any stale IRQs. */ -+ V3D_WRITE(V3D_INTCTL, V3D_DRIVER_IRQS); ++ if (pdev->dev.of_node) { ++ struct device_node *i2s_node; ++ struct snd_soc_dai_link *dai = &snd_rpi_hifiberry_dac_dai[0]; ++ i2s_node = of_parse_phandle(pdev->dev.of_node, ++ "i2s-controller", 0); + -+ /* -+ * Turn all our interrupts on. Binner out of memory is the -+ * only one we expect to trigger at this point, since we've -+ * just come from poweron and haven't supplied any overflow -+ * memory yet. -+ */ -+ V3D_WRITE(V3D_INTENA, V3D_DRIVER_IRQS); ++ if (i2s_node) { ++ dai->cpu_dai_name = NULL; ++ dai->cpu_of_node = i2s_node; ++ dai->platform_name = NULL; ++ dai->platform_of_node = i2s_node; ++ } ++ } + -+ spin_lock_irqsave(&vc4->job_lock, irqflags); -+ vc4_irq_finish_job(dev); -+ spin_unlock_irqrestore(&vc4->job_lock, irqflags); -+} -diff --git a/drivers/gpu/drm/vc4/vc4_kms.c b/drivers/gpu/drm/vc4/vc4_kms.c -index 2e5597d..c83287a 100644 ---- a/drivers/gpu/drm/vc4/vc4_kms.c -+++ b/drivers/gpu/drm/vc4/vc4_kms.c -@@ -15,6 +15,7 @@ - */ - - #include "drm_crtc.h" -+#include "drm_atomic.h" - #include "drm_atomic_helper.h" - #include "drm_crtc_helper.h" - #include "drm_plane_helper.h" -@@ -29,10 +30,151 @@ static void vc4_output_poll_changed(struct drm_device *dev) - drm_fbdev_cma_hotplug_event(vc4->fbdev); - } - -+struct vc4_commit { -+ struct drm_device *dev; -+ struct drm_atomic_state *state; -+ struct vc4_seqno_cb cb; -+}; ++ ret = snd_soc_register_card(&snd_rpi_hifiberry_dac); ++ if (ret) ++ dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", ret); + -+static void -+vc4_atomic_complete_commit(struct vc4_commit *c) -+{ -+ struct drm_atomic_state *state = c->state; -+ struct drm_device *dev = state->dev; -+ struct vc4_dev *vc4 = to_vc4_dev(dev); ++ return ret; ++} + -+ drm_atomic_helper_commit_modeset_disables(dev, state); ++static int snd_rpi_hifiberry_dac_remove(struct platform_device *pdev) ++{ ++ return snd_soc_unregister_card(&snd_rpi_hifiberry_dac); ++} + -+ drm_atomic_helper_commit_planes(dev, state); ++static const struct of_device_id snd_rpi_hifiberry_dac_of_match[] = { ++ { .compatible = "hifiberry,hifiberry-dac", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, snd_rpi_hifiberry_dac_of_match); + -+ drm_atomic_helper_commit_modeset_enables(dev, state); ++static struct platform_driver snd_rpi_hifiberry_dac_driver = { ++ .driver = { ++ .name = "snd-hifiberry-dac", ++ .owner = THIS_MODULE, ++ .of_match_table = snd_rpi_hifiberry_dac_of_match, ++ }, ++ .probe = snd_rpi_hifiberry_dac_probe, ++ .remove = snd_rpi_hifiberry_dac_remove, ++}; + -+ drm_atomic_helper_wait_for_vblanks(dev, state); ++module_platform_driver(snd_rpi_hifiberry_dac_driver); + -+ drm_atomic_helper_cleanup_planes(dev, state); ++MODULE_AUTHOR("Florian Meier <florian.meier@koalo.de>"); ++MODULE_DESCRIPTION("ASoC Driver for HifiBerry DAC"); ++MODULE_LICENSE("GPL v2"); + +From 133cbdab8d6f90145845d63730736887fbeb3cbe Mon Sep 17 00:00:00 2001 +From: Florian Meier <florian.meier@koalo.de> +Date: Mon, 25 Jan 2016 15:48:59 +0000 +Subject: [PATCH 067/112] ASoC: Add support for Rpi-DAC + +--- + sound/soc/bcm/Kconfig | 7 +++ + sound/soc/bcm/Makefile | 2 + + sound/soc/bcm/rpi-dac.c | 119 ++++++++++++++++++++++++++++++++++++++++++++ + sound/soc/codecs/Kconfig | 9 ++++ + sound/soc/codecs/Makefile | 2 + + sound/soc/codecs/pcm1794a.c | 69 +++++++++++++++++++++++++ + 6 files changed, 208 insertions(+) + create mode 100644 sound/soc/bcm/rpi-dac.c + create mode 100644 sound/soc/codecs/pcm1794a.c + +diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig +index ce81f14..900de22 100644 +--- a/sound/soc/bcm/Kconfig ++++ b/sound/soc/bcm/Kconfig +@@ -14,3 +14,10 @@ config SND_BCM2708_SOC_HIFIBERRY_DAC + select SND_SOC_PCM5102A + help + Say Y or M if you want to add support for HifiBerry DAC. + -+ drm_atomic_state_free(state); ++config SND_BCM2708_SOC_RPI_DAC ++ tristate "Support for RPi-DAC" ++ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S ++ select SND_SOC_PCM1794A ++ help ++ Say Y or M if you want to add support for RPi-DAC. +diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile +index b877d38..99c96b4 100644 +--- a/sound/soc/bcm/Makefile ++++ b/sound/soc/bcm/Makefile +@@ -5,5 +5,7 @@ obj-$(CONFIG_SND_BCM2835_SOC_I2S) += snd-soc-bcm2835-i2s.o + + # BCM2708 Machine Support + snd-soc-hifiberry-dac-objs := hifiberry_dac.o ++snd-soc-rpi-dac-objs := rpi-dac.o + + obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o ++obj-$(CONFIG_SND_BCM2708_SOC_RPI_DAC) += snd-soc-rpi-dac.o +diff --git a/sound/soc/bcm/rpi-dac.c b/sound/soc/bcm/rpi-dac.c +new file mode 100644 +index 0000000..59dc89e +--- /dev/null ++++ b/sound/soc/bcm/rpi-dac.c +@@ -0,0 +1,119 @@ ++/* ++ * ASoC Driver for RPi-DAC. ++ * ++ * Author: Florian Meier <florian.meier@koalo.de> ++ * Copyright 2013 ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * version 2 as published by the Free Software Foundation. ++ * ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * General Public License for more details. ++ */ + -+ up(&vc4->async_modeset); ++#include <linux/module.h> ++#include <linux/platform_device.h> + -+ kfree(c); -+} ++#include <sound/core.h> ++#include <sound/pcm.h> ++#include <sound/pcm_params.h> ++#include <sound/soc.h> ++#include <sound/jack.h> + -+static void -+vc4_atomic_complete_commit_seqno_cb(struct vc4_seqno_cb *cb) ++static int snd_rpi_rpi_dac_init(struct snd_soc_pcm_runtime *rtd) +{ -+ struct vc4_commit *c = container_of(cb, struct vc4_commit, cb); -+ -+ vc4_atomic_complete_commit(c); ++ return 0; +} + -+static struct vc4_commit *commit_init(struct drm_atomic_state *state) ++static int snd_rpi_rpi_dac_hw_params(struct snd_pcm_substream *substream, ++ struct snd_pcm_hw_params *params) +{ -+ struct vc4_commit *c = kzalloc(sizeof(*c), GFP_KERNEL); -+ -+ if (!c) -+ return NULL; -+ c->dev = state->dev; -+ c->state = state; ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; + -+ return c; ++ return snd_soc_dai_set_bclk_ratio(cpu_dai, 32*2); +} + -+/** -+ * vc4_atomic_commit - commit validated state object -+ * @dev: DRM device -+ * @state: the driver state object -+ * @async: asynchronous commit -+ * -+ * This function commits a with drm_atomic_helper_check() pre-validated state -+ * object. This can still fail when e.g. the framebuffer reservation fails. For -+ * now this doesn't implement asynchronous commits. -+ * -+ * RETURNS -+ * Zero for success or -errno. -+ */ -+static int vc4_atomic_commit(struct drm_device *dev, -+ struct drm_atomic_state *state, -+ bool async) -+{ -+ struct vc4_dev *vc4 = to_vc4_dev(dev); -+ int ret; -+ int i; -+ uint64_t wait_seqno = 0; -+ struct vc4_commit *c; -+ -+ c = commit_init(state); -+ if (!c) -+ return -ENOMEM; ++/* machine stream operations */ ++static struct snd_soc_ops snd_rpi_rpi_dac_ops = { ++ .hw_params = snd_rpi_rpi_dac_hw_params, ++}; + -+ /* Make sure that any outstanding modesets have finished. */ -+ ret = down_interruptible(&vc4->async_modeset); -+ if (ret) { -+ kfree(c); -+ return ret; -+ } ++static struct snd_soc_dai_link snd_rpi_rpi_dac_dai[] = { ++{ ++ .name = "RPi-DAC", ++ .stream_name = "RPi-DAC HiFi", ++ .cpu_dai_name = "bcm2708-i2s.0", ++ .codec_dai_name = "pcm1794a-hifi", ++ .platform_name = "bcm2708-i2s.0", ++ .codec_name = "pcm1794a-codec", ++ .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | ++ SND_SOC_DAIFMT_CBS_CFS, ++ .ops = &snd_rpi_rpi_dac_ops, ++ .init = snd_rpi_rpi_dac_init, ++}, ++}; + -+ ret = drm_atomic_helper_prepare_planes(dev, state); -+ if (ret) { -+ kfree(c); -+ up(&vc4->async_modeset); -+ return ret; -+ } ++/* audio machine driver */ ++static struct snd_soc_card snd_rpi_rpi_dac = { ++ .name = "snd_rpi_rpi_dac", ++ .owner = THIS_MODULE, ++ .dai_link = snd_rpi_rpi_dac_dai, ++ .num_links = ARRAY_SIZE(snd_rpi_rpi_dac_dai), ++}; + -+ for (i = 0; i < dev->mode_config.num_total_plane; i++) { -+ struct drm_plane *plane = state->planes[i]; -+ struct drm_plane_state *new_state = state->plane_states[i]; ++static int snd_rpi_rpi_dac_probe(struct platform_device *pdev) ++{ ++ int ret = 0; + -+ if (!plane) -+ continue; ++ snd_rpi_rpi_dac.dev = &pdev->dev; ++ ++ if (pdev->dev.of_node) { ++ struct device_node *i2s_node; ++ struct snd_soc_dai_link *dai = &snd_rpi_rpi_dac_dai[0]; ++ i2s_node = of_parse_phandle(pdev->dev.of_node, "i2s-controller", 0); + -+ if ((plane->state->fb != new_state->fb) && new_state->fb) { -+ struct drm_gem_cma_object *cma_bo = -+ drm_fb_cma_get_gem_obj(new_state->fb, 0); -+ struct vc4_bo *bo = to_vc4_bo(&cma_bo->base); -+ wait_seqno = max(bo->seqno, wait_seqno); ++ if (i2s_node) { ++ dai->cpu_dai_name = NULL; ++ dai->cpu_of_node = i2s_node; ++ dai->platform_name = NULL; ++ dai->platform_of_node = i2s_node; + } + } ++ ++ ret = snd_soc_register_card(&snd_rpi_rpi_dac); ++ if (ret) ++ dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", ret); + -+ /* -+ * This is the point of no return - everything below never fails except -+ * when the hw goes bonghits. Which means we can commit the new state on -+ * the software side now. -+ */ ++ return ret; ++} + -+ drm_atomic_helper_swap_state(dev, state); ++static int snd_rpi_rpi_dac_remove(struct platform_device *pdev) ++{ ++ return snd_soc_unregister_card(&snd_rpi_rpi_dac); ++} + -+ /* -+ * Everything below can be run asynchronously without the need to grab -+ * any modeset locks at all under one condition: It must be guaranteed -+ * that the asynchronous work has either been cancelled (if the driver -+ * supports it, which at least requires that the framebuffers get -+ * cleaned up with drm_atomic_helper_cleanup_planes()) or completed -+ * before the new state gets committed on the software side with -+ * drm_atomic_helper_swap_state(). -+ * -+ * This scheme allows new atomic state updates to be prepared and -+ * checked in parallel to the asynchronous completion of the previous -+ * update. Which is important since compositors need to figure out the -+ * composition of the next frame right after having submitted the -+ * current layout. -+ */ ++static const struct of_device_id snd_rpi_rpi_dac_of_match[] = { ++ { .compatible = "rpi,rpi-dac", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, snd_rpi_rpi_dac_of_match); + -+ if (async) { -+ vc4_queue_seqno_cb(dev, &c->cb, wait_seqno, -+ vc4_atomic_complete_commit_seqno_cb); -+ } else { -+ vc4_wait_for_seqno(dev, wait_seqno, ~0ull, false); -+ vc4_atomic_complete_commit(c); -+ } ++static struct platform_driver snd_rpi_rpi_dac_driver = { ++ .driver = { ++ .name = "snd-rpi-dac", ++ .owner = THIS_MODULE, ++ .of_match_table = snd_rpi_rpi_dac_of_match, ++ }, ++ .probe = snd_rpi_rpi_dac_probe, ++ .remove = snd_rpi_rpi_dac_remove, ++}; + -+ return 0; -+} ++module_platform_driver(snd_rpi_rpi_dac_driver); + - static const struct drm_mode_config_funcs vc4_mode_funcs = { - .output_poll_changed = vc4_output_poll_changed, - .atomic_check = drm_atomic_helper_check, -- .atomic_commit = drm_atomic_helper_commit, -+ .atomic_commit = vc4_atomic_commit, - .fb_create = drm_fb_cma_create, - }; - -@@ -41,6 +183,8 @@ int vc4_kms_load(struct drm_device *dev) - struct vc4_dev *vc4 = to_vc4_dev(dev); - int ret; ++MODULE_AUTHOR("Florian Meier <florian.meier@koalo.de>"); ++MODULE_DESCRIPTION("ASoC Driver for RPi-DAC"); ++MODULE_LICENSE("GPL v2"); +diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig +index 4308f90..513ab55 100644 +--- a/sound/soc/codecs/Kconfig ++++ b/sound/soc/codecs/Kconfig +@@ -101,6 +101,7 @@ config SND_SOC_ALL_CODECS + select SND_SOC_RT5514 if I2C + select SND_SOC_RT5616 if I2C + select SND_SOC_PCM5102A if I2C ++ select SND_SOC_PCM1794A if I2C + select SND_SOC_RT5631 if I2C + select SND_SOC_RT5640 if I2C + select SND_SOC_RT5645 if I2C +@@ -632,6 +633,14 @@ config SND_SOC_RT5616 + tristate "Realtek RT5616 CODEC" + depends on I2C -+ sema_init(&vc4->async_modeset, 1); ++config SND_SOC_RT298 ++ tristate ++ depends on I2C + - ret = drm_vblank_init(dev, dev->mode_config.num_crtc); - if (ret < 0) { - dev_err(dev->dev, "failed to initialize vblank\n"); -@@ -51,6 +195,8 @@ int vc4_kms_load(struct drm_device *dev) - dev->mode_config.max_height = 2048; - dev->mode_config.funcs = &vc4_mode_funcs; - dev->mode_config.preferred_depth = 24; -+ dev->mode_config.async_page_flip = true; ++config SND_SOC_PCM1794A ++ tristate ++ depends on I2C + - dev->vblank_disable_allowed = true; - - drm_mode_config_reset(dev); -diff --git a/drivers/gpu/drm/vc4/vc4_packet.h b/drivers/gpu/drm/vc4/vc4_packet.h + config SND_SOC_PCM5102A + tristate + depends on I2C +diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile +index 7522017..b87e845 100644 +--- a/sound/soc/codecs/Makefile ++++ b/sound/soc/codecs/Makefile +@@ -98,6 +98,7 @@ snd-soc-rt286-objs := rt286.o + snd-soc-rt298-objs := rt298.o + snd-soc-rt5514-objs := rt5514.o + snd-soc-rt5616-objs := rt5616.o ++snd-soc-pcm1794a-objs := pcm1794a.o + snd-soc-pcm5102a-objs := pcm5102a.o + snd-soc-rt5631-objs := rt5631.o + snd-soc-rt5640-objs := rt5640.o +@@ -308,6 +309,7 @@ obj-$(CONFIG_SND_SOC_RT286) += snd-soc-rt286.o + obj-$(CONFIG_SND_SOC_RT298) += snd-soc-rt298.o + obj-$(CONFIG_SND_SOC_RT5514) += snd-soc-rt5514.o + obj-$(CONFIG_SND_SOC_RT5616) += snd-soc-rt5616.o ++obj-$(CONFIG_SND_SOC_PCM1794A) += snd-soc-pcm1794a.o + obj-$(CONFIG_SND_SOC_PCM5102A) += snd-soc-pcm5102a.o + obj-$(CONFIG_SND_SOC_RT5631) += snd-soc-rt5631.o + obj-$(CONFIG_SND_SOC_RT5640) += snd-soc-rt5640.o +diff --git a/sound/soc/codecs/pcm1794a.c b/sound/soc/codecs/pcm1794a.c new file mode 100644 -index 0000000..9757bc8 +index 0000000..afe1b41 --- /dev/null -+++ b/drivers/gpu/drm/vc4/vc4_packet.h -@@ -0,0 +1,384 @@ ++++ b/sound/soc/codecs/pcm1794a.c +@@ -0,0 +1,69 @@ +/* -+ * Copyright © 2014 Broadcom -+ * -+ * Permission is hereby granted, free of charge, to any person obtaining a -+ * copy of this software and associated documentation files (the "Software"), -+ * to deal in the Software without restriction, including without limitation -+ * the rights to use, copy, modify, merge, publish, distribute, sublicense, -+ * and/or sell copies of the Software, and to permit persons to whom the -+ * Software is furnished to do so, subject to the following conditions: -+ * -+ * The above copyright notice and this permission notice (including the next -+ * paragraph) shall be included in all copies or substantial portions of the -+ * Software. -+ * -+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -+ * IN THE SOFTWARE. -+ */ -+ -+#ifndef VC4_PACKET_H -+#define VC4_PACKET_H -+ -+#include "vc4_regs.h" /* for VC4_MASK, VC4_GET_FIELD, VC4_SET_FIELD */ -+ -+enum vc4_packet { -+ VC4_PACKET_HALT = 0, -+ VC4_PACKET_NOP = 1, -+ -+ VC4_PACKET_FLUSH = 4, -+ VC4_PACKET_FLUSH_ALL = 5, -+ VC4_PACKET_START_TILE_BINNING = 6, -+ VC4_PACKET_INCREMENT_SEMAPHORE = 7, -+ VC4_PACKET_WAIT_ON_SEMAPHORE = 8, -+ -+ VC4_PACKET_BRANCH = 16, -+ VC4_PACKET_BRANCH_TO_SUB_LIST = 17, -+ -+ VC4_PACKET_STORE_MS_TILE_BUFFER = 24, -+ VC4_PACKET_STORE_MS_TILE_BUFFER_AND_EOF = 25, -+ VC4_PACKET_STORE_FULL_RES_TILE_BUFFER = 26, -+ VC4_PACKET_LOAD_FULL_RES_TILE_BUFFER = 27, -+ VC4_PACKET_STORE_TILE_BUFFER_GENERAL = 28, -+ VC4_PACKET_LOAD_TILE_BUFFER_GENERAL = 29, -+ -+ VC4_PACKET_GL_INDEXED_PRIMITIVE = 32, -+ VC4_PACKET_GL_ARRAY_PRIMITIVE = 33, -+ -+ VC4_PACKET_COMPRESSED_PRIMITIVE = 48, -+ VC4_PACKET_CLIPPED_COMPRESSED_PRIMITIVE = 49, -+ -+ VC4_PACKET_PRIMITIVE_LIST_FORMAT = 56, -+ -+ VC4_PACKET_GL_SHADER_STATE = 64, -+ VC4_PACKET_NV_SHADER_STATE = 65, -+ VC4_PACKET_VG_SHADER_STATE = 66, -+ -+ VC4_PACKET_CONFIGURATION_BITS = 96, -+ VC4_PACKET_FLAT_SHADE_FLAGS = 97, -+ VC4_PACKET_POINT_SIZE = 98, -+ VC4_PACKET_LINE_WIDTH = 99, -+ VC4_PACKET_RHT_X_BOUNDARY = 100, -+ VC4_PACKET_DEPTH_OFFSET = 101, -+ VC4_PACKET_CLIP_WINDOW = 102, -+ VC4_PACKET_VIEWPORT_OFFSET = 103, -+ VC4_PACKET_Z_CLIPPING = 104, -+ VC4_PACKET_CLIPPER_XY_SCALING = 105, -+ VC4_PACKET_CLIPPER_Z_SCALING = 106, -+ -+ VC4_PACKET_TILE_BINNING_MODE_CONFIG = 112, -+ VC4_PACKET_TILE_RENDERING_MODE_CONFIG = 113, -+ VC4_PACKET_CLEAR_COLORS = 114, -+ VC4_PACKET_TILE_COORDINATES = 115, -+ -+ /* Not an actual hardware packet -- this is what we use to put -+ * references to GEM bos in the command stream, since we need the u32 -+ * int the actual address packet in order to store the offset from the -+ * start of the BO. -+ */ -+ VC4_PACKET_GEM_HANDLES = 254, -+} __attribute__ ((__packed__)); -+ -+#define VC4_PACKET_HALT_SIZE 1 -+#define VC4_PACKET_NOP_SIZE 1 -+#define VC4_PACKET_FLUSH_SIZE 1 -+#define VC4_PACKET_FLUSH_ALL_SIZE 1 -+#define VC4_PACKET_START_TILE_BINNING_SIZE 1 -+#define VC4_PACKET_INCREMENT_SEMAPHORE_SIZE 1 -+#define VC4_PACKET_WAIT_ON_SEMAPHORE_SIZE 1 -+#define VC4_PACKET_BRANCH_SIZE 5 -+#define VC4_PACKET_BRANCH_TO_SUB_LIST_SIZE 5 -+#define VC4_PACKET_STORE_MS_TILE_BUFFER_SIZE 1 -+#define VC4_PACKET_STORE_MS_TILE_BUFFER_AND_EOF_SIZE 1 -+#define VC4_PACKET_STORE_FULL_RES_TILE_BUFFER_SIZE 5 -+#define VC4_PACKET_LOAD_FULL_RES_TILE_BUFFER_SIZE 5 -+#define VC4_PACKET_STORE_TILE_BUFFER_GENERAL_SIZE 7 -+#define VC4_PACKET_LOAD_TILE_BUFFER_GENERAL_SIZE 7 -+#define VC4_PACKET_GL_INDEXED_PRIMITIVE_SIZE 14 -+#define VC4_PACKET_GL_ARRAY_PRIMITIVE_SIZE 10 -+#define VC4_PACKET_COMPRESSED_PRIMITIVE_SIZE 1 -+#define VC4_PACKET_CLIPPED_COMPRESSED_PRIMITIVE_SIZE 1 -+#define VC4_PACKET_PRIMITIVE_LIST_FORMAT_SIZE 2 -+#define VC4_PACKET_GL_SHADER_STATE_SIZE 5 -+#define VC4_PACKET_NV_SHADER_STATE_SIZE 5 -+#define VC4_PACKET_VG_SHADER_STATE_SIZE 5 -+#define VC4_PACKET_CONFIGURATION_BITS_SIZE 4 -+#define VC4_PACKET_FLAT_SHADE_FLAGS_SIZE 5 -+#define VC4_PACKET_POINT_SIZE_SIZE 5 -+#define VC4_PACKET_LINE_WIDTH_SIZE 5 -+#define VC4_PACKET_RHT_X_BOUNDARY_SIZE 3 -+#define VC4_PACKET_DEPTH_OFFSET_SIZE 5 -+#define VC4_PACKET_CLIP_WINDOW_SIZE 9 -+#define VC4_PACKET_VIEWPORT_OFFSET_SIZE 5 -+#define VC4_PACKET_Z_CLIPPING_SIZE 9 -+#define VC4_PACKET_CLIPPER_XY_SCALING_SIZE 9 -+#define VC4_PACKET_CLIPPER_Z_SCALING_SIZE 9 -+#define VC4_PACKET_TILE_BINNING_MODE_CONFIG_SIZE 16 -+#define VC4_PACKET_TILE_RENDERING_MODE_CONFIG_SIZE 11 -+#define VC4_PACKET_CLEAR_COLORS_SIZE 14 -+#define VC4_PACKET_TILE_COORDINATES_SIZE 3 -+#define VC4_PACKET_GEM_HANDLES_SIZE 9 -+ -+/** @{ -+ * Bits used by packets like VC4_PACKET_STORE_TILE_BUFFER_GENERAL and -+ * VC4_PACKET_TILE_RENDERING_MODE_CONFIG. -+*/ -+#define VC4_TILING_FORMAT_LINEAR 0 -+#define VC4_TILING_FORMAT_T 1 -+#define VC4_TILING_FORMAT_LT 2 -+/** @} */ -+ -+/** @{ ++ * Driver for the PCM1794A codec + * -+ * low bits of VC4_PACKET_STORE_FULL_RES_TILE_BUFFER and -+ * VC4_PACKET_LOAD_FULL_RES_TILE_BUFFER. -+ */ -+#define VC4_LOADSTORE_FULL_RES_EOF (1 << 3) -+#define VC4_LOADSTORE_FULL_RES_DISABLE_CLEAR_ALL (1 << 2) -+#define VC4_LOADSTORE_FULL_RES_DISABLE_ZS (1 << 1) -+#define VC4_LOADSTORE_FULL_RES_DISABLE_COLOR (1 << 0) -+ -+/** @{ ++ * Author: Florian Meier <florian.meier@koalo.de> ++ * Copyright 2013 + * -+ * byte 2 of VC4_PACKET_STORE_TILE_BUFFER_GENERAL and -+ * VC4_PACKET_LOAD_TILE_BUFFER_GENERAL (low bits of the address) -+ */ -+ -+#define VC4_LOADSTORE_TILE_BUFFER_EOF (1 << 3) -+#define VC4_LOADSTORE_TILE_BUFFER_DISABLE_FULL_VG_MASK (1 << 2) -+#define VC4_LOADSTORE_TILE_BUFFER_DISABLE_FULL_ZS (1 << 1) -+#define VC4_LOADSTORE_TILE_BUFFER_DISABLE_FULL_COLOR (1 << 0) -+ -+/** @} */ -+ -+/** @{ ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * version 2 as published by the Free Software Foundation. + * -+ * byte 0-1 of VC4_PACKET_STORE_TILE_BUFFER_GENERAL and -+ * VC4_PACKET_LOAD_TILE_BUFFER_GENERAL ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * General Public License for more details. + */ -+#define VC4_STORE_TILE_BUFFER_DISABLE_VG_MASK_CLEAR (1 << 15) -+#define VC4_STORE_TILE_BUFFER_DISABLE_ZS_CLEAR (1 << 14) -+#define VC4_STORE_TILE_BUFFER_DISABLE_COLOR_CLEAR (1 << 13) -+#define VC4_STORE_TILE_BUFFER_DISABLE_SWAP (1 << 12) -+ -+#define VC4_LOADSTORE_TILE_BUFFER_FORMAT_MASK VC4_MASK(9, 8) -+#define VC4_LOADSTORE_TILE_BUFFER_FORMAT_SHIFT 8 -+#define VC4_LOADSTORE_TILE_BUFFER_RGBA8888 0 -+#define VC4_LOADSTORE_TILE_BUFFER_BGR565_DITHER 1 -+#define VC4_LOADSTORE_TILE_BUFFER_BGR565 2 -+/** @} */ + -+/** @{ -+ * -+ * byte 0 of VC4_PACKET_STORE_TILE_BUFFER_GENERAL and -+ * VC4_PACKET_LOAD_TILE_BUFFER_GENERAL -+ */ -+#define VC4_STORE_TILE_BUFFER_MODE_MASK VC4_MASK(7, 6) -+#define VC4_STORE_TILE_BUFFER_MODE_SHIFT 6 -+#define VC4_STORE_TILE_BUFFER_MODE_SAMPLE0 (0 << 6) -+#define VC4_STORE_TILE_BUFFER_MODE_DECIMATE_X4 (1 << 6) -+#define VC4_STORE_TILE_BUFFER_MODE_DECIMATE_X16 (2 << 6) -+ -+/** The values of the field are VC4_TILING_FORMAT_* */ -+#define VC4_LOADSTORE_TILE_BUFFER_TILING_MASK VC4_MASK(5, 4) -+#define VC4_LOADSTORE_TILE_BUFFER_TILING_SHIFT 4 -+ -+#define VC4_LOADSTORE_TILE_BUFFER_BUFFER_MASK VC4_MASK(2, 0) -+#define VC4_LOADSTORE_TILE_BUFFER_BUFFER_SHIFT 0 -+#define VC4_LOADSTORE_TILE_BUFFER_NONE 0 -+#define VC4_LOADSTORE_TILE_BUFFER_COLOR 1 -+#define VC4_LOADSTORE_TILE_BUFFER_ZS 2 -+#define VC4_LOADSTORE_TILE_BUFFER_Z 3 -+#define VC4_LOADSTORE_TILE_BUFFER_VG_MASK 4 -+#define VC4_LOADSTORE_TILE_BUFFER_FULL 5 -+/** @} */ + -+#define VC4_INDEX_BUFFER_U8 (0 << 4) -+#define VC4_INDEX_BUFFER_U16 (1 << 4) ++#include <linux/init.h> ++#include <linux/module.h> ++#include <linux/platform_device.h> + -+/* This flag is only present in NV shader state. */ -+#define VC4_SHADER_FLAG_SHADED_CLIP_COORDS (1 << 3) -+#define VC4_SHADER_FLAG_ENABLE_CLIPPING (1 << 2) -+#define VC4_SHADER_FLAG_VS_POINT_SIZE (1 << 1) -+#define VC4_SHADER_FLAG_FS_SINGLE_THREAD (1 << 0) ++#include <sound/soc.h> + -+/** @{ byte 2 of config bits. */ -+#define VC4_CONFIG_BITS_EARLY_Z_UPDATE (1 << 1) -+#define VC4_CONFIG_BITS_EARLY_Z (1 << 0) -+/** @} */ ++static struct snd_soc_dai_driver pcm1794a_dai = { ++ .name = "pcm1794a-hifi", ++ .playback = { ++ .channels_min = 2, ++ .channels_max = 2, ++ .rates = SNDRV_PCM_RATE_8000_192000, ++ .formats = SNDRV_PCM_FMTBIT_S16_LE | ++ SNDRV_PCM_FMTBIT_S24_LE ++ }, ++}; + -+/** @{ byte 1 of config bits. */ -+#define VC4_CONFIG_BITS_Z_UPDATE (1 << 7) -+/** same values in this 3-bit field as PIPE_FUNC_* */ -+#define VC4_CONFIG_BITS_DEPTH_FUNC_SHIFT 4 -+#define VC4_CONFIG_BITS_COVERAGE_READ_LEAVE (1 << 3) ++static struct snd_soc_codec_driver soc_codec_dev_pcm1794a; + -+#define VC4_CONFIG_BITS_COVERAGE_UPDATE_NONZERO (0 << 1) -+#define VC4_CONFIG_BITS_COVERAGE_UPDATE_ODD (1 << 1) -+#define VC4_CONFIG_BITS_COVERAGE_UPDATE_OR (2 << 1) -+#define VC4_CONFIG_BITS_COVERAGE_UPDATE_ZERO (3 << 1) ++static int pcm1794a_probe(struct platform_device *pdev) ++{ ++ return snd_soc_register_codec(&pdev->dev, &soc_codec_dev_pcm1794a, ++ &pcm1794a_dai, 1); ++} + -+#define VC4_CONFIG_BITS_COVERAGE_PIPE_SELECT (1 << 0) -+/** @} */ ++static int pcm1794a_remove(struct platform_device *pdev) ++{ ++ snd_soc_unregister_codec(&pdev->dev); ++ return 0; ++} + -+/** @{ byte 0 of config bits. */ -+#define VC4_CONFIG_BITS_RASTERIZER_OVERSAMPLE_NONE (0 << 6) -+#define VC4_CONFIG_BITS_RASTERIZER_OVERSAMPLE_4X (1 << 6) -+#define VC4_CONFIG_BITS_RASTERIZER_OVERSAMPLE_16X (2 << 6) ++static const struct of_device_id pcm1794a_of_match[] = { ++ { .compatible = "ti,pcm1794a", }, ++ { } ++}; ++MODULE_DEVICE_TABLE(of, pcm1794a_of_match); + -+#define VC4_CONFIG_BITS_AA_POINTS_AND_LINES (1 << 4) -+#define VC4_CONFIG_BITS_ENABLE_DEPTH_OFFSET (1 << 3) -+#define VC4_CONFIG_BITS_CW_PRIMITIVES (1 << 2) -+#define VC4_CONFIG_BITS_ENABLE_PRIM_BACK (1 << 1) -+#define VC4_CONFIG_BITS_ENABLE_PRIM_FRONT (1 << 0) -+/** @} */ ++static struct platform_driver pcm1794a_codec_driver = { ++ .probe = pcm1794a_probe, ++ .remove = pcm1794a_remove, ++ .driver = { ++ .name = "pcm1794a-codec", ++ .owner = THIS_MODULE, ++ .of_match_table = of_match_ptr(pcm1794a_of_match), ++ }, ++}; + -+/** @{ bits in the last u8 of VC4_PACKET_TILE_BINNING_MODE_CONFIG */ -+#define VC4_BIN_CONFIG_DB_NON_MS (1 << 7) -+ -+#define VC4_BIN_CONFIG_ALLOC_BLOCK_SIZE_MASK VC4_MASK(6, 5) -+#define VC4_BIN_CONFIG_ALLOC_BLOCK_SIZE_SHIFT 5 -+#define VC4_BIN_CONFIG_ALLOC_BLOCK_SIZE_32 0 -+#define VC4_BIN_CONFIG_ALLOC_BLOCK_SIZE_64 1 -+#define VC4_BIN_CONFIG_ALLOC_BLOCK_SIZE_128 2 -+#define VC4_BIN_CONFIG_ALLOC_BLOCK_SIZE_256 3 -+ -+#define VC4_BIN_CONFIG_ALLOC_INIT_BLOCK_SIZE_MASK VC4_MASK(4, 3) -+#define VC4_BIN_CONFIG_ALLOC_INIT_BLOCK_SIZE_SHIFT 3 -+#define VC4_BIN_CONFIG_ALLOC_INIT_BLOCK_SIZE_32 0 -+#define VC4_BIN_CONFIG_ALLOC_INIT_BLOCK_SIZE_64 1 -+#define VC4_BIN_CONFIG_ALLOC_INIT_BLOCK_SIZE_128 2 -+#define VC4_BIN_CONFIG_ALLOC_INIT_BLOCK_SIZE_256 3 -+ -+#define VC4_BIN_CONFIG_AUTO_INIT_TSDA (1 << 2) -+#define VC4_BIN_CONFIG_TILE_BUFFER_64BIT (1 << 1) -+#define VC4_BIN_CONFIG_MS_MODE_4X (1 << 0) -+/** @} */ ++module_platform_driver(pcm1794a_codec_driver); + -+/** @{ bits in the last u16 of VC4_PACKET_TILE_RENDERING_MODE_CONFIG */ -+#define VC4_RENDER_CONFIG_DB_NON_MS (1 << 12) -+#define VC4_RENDER_CONFIG_EARLY_Z_COVERAGE_DISABLE (1 << 11) -+#define VC4_RENDER_CONFIG_EARLY_Z_DIRECTION_G (1 << 10) -+#define VC4_RENDER_CONFIG_COVERAGE_MODE (1 << 9) -+#define VC4_RENDER_CONFIG_ENABLE_VG_MASK (1 << 8) -+ -+/** The values of the field are VC4_TILING_FORMAT_* */ -+#define VC4_RENDER_CONFIG_MEMORY_FORMAT_MASK VC4_MASK(7, 6) -+#define VC4_RENDER_CONFIG_MEMORY_FORMAT_SHIFT 6 -+ -+#define VC4_RENDER_CONFIG_DECIMATE_MODE_1X (0 << 4) -+#define VC4_RENDER_CONFIG_DECIMATE_MODE_4X (1 << 4) -+#define VC4_RENDER_CONFIG_DECIMATE_MODE_16X (2 << 4) -+ -+#define VC4_RENDER_CONFIG_FORMAT_MASK VC4_MASK(3, 2) -+#define VC4_RENDER_CONFIG_FORMAT_SHIFT 2 -+#define VC4_RENDER_CONFIG_FORMAT_BGR565_DITHERED 0 -+#define VC4_RENDER_CONFIG_FORMAT_RGBA8888 1 -+#define VC4_RENDER_CONFIG_FORMAT_BGR565 2 -+ -+#define VC4_RENDER_CONFIG_TILE_BUFFER_64BIT (1 << 1) -+#define VC4_RENDER_CONFIG_MS_MODE_4X (1 << 0) -+ -+#define VC4_PRIMITIVE_LIST_FORMAT_16_INDEX (1 << 4) -+#define VC4_PRIMITIVE_LIST_FORMAT_32_XY (3 << 4) -+#define VC4_PRIMITIVE_LIST_FORMAT_TYPE_POINTS (0 << 0) -+#define VC4_PRIMITIVE_LIST_FORMAT_TYPE_LINES (1 << 0) -+#define VC4_PRIMITIVE_LIST_FORMAT_TYPE_TRIANGLES (2 << 0) -+#define VC4_PRIMITIVE_LIST_FORMAT_TYPE_RHT (3 << 0) -+ -+enum vc4_texture_data_type { -+ VC4_TEXTURE_TYPE_RGBA8888 = 0, -+ VC4_TEXTURE_TYPE_RGBX8888 = 1, -+ VC4_TEXTURE_TYPE_RGBA4444 = 2, -+ VC4_TEXTURE_TYPE_RGBA5551 = 3, -+ VC4_TEXTURE_TYPE_RGB565 = 4, -+ VC4_TEXTURE_TYPE_LUMINANCE = 5, -+ VC4_TEXTURE_TYPE_ALPHA = 6, -+ VC4_TEXTURE_TYPE_LUMALPHA = 7, -+ VC4_TEXTURE_TYPE_ETC1 = 8, -+ VC4_TEXTURE_TYPE_S16F = 9, -+ VC4_TEXTURE_TYPE_S8 = 10, -+ VC4_TEXTURE_TYPE_S16 = 11, -+ VC4_TEXTURE_TYPE_BW1 = 12, -+ VC4_TEXTURE_TYPE_A4 = 13, -+ VC4_TEXTURE_TYPE_A1 = 14, -+ VC4_TEXTURE_TYPE_RGBA64 = 15, -+ VC4_TEXTURE_TYPE_RGBA32R = 16, -+ VC4_TEXTURE_TYPE_YUV422R = 17, -+}; -+ -+#define VC4_TEX_P0_OFFSET_MASK VC4_MASK(31, 12) -+#define VC4_TEX_P0_OFFSET_SHIFT 12 -+#define VC4_TEX_P0_CSWIZ_MASK VC4_MASK(11, 10) -+#define VC4_TEX_P0_CSWIZ_SHIFT 10 -+#define VC4_TEX_P0_CMMODE_MASK VC4_MASK(9, 9) -+#define VC4_TEX_P0_CMMODE_SHIFT 9 -+#define VC4_TEX_P0_FLIPY_MASK VC4_MASK(8, 8) -+#define VC4_TEX_P0_FLIPY_SHIFT 8 -+#define VC4_TEX_P0_TYPE_MASK VC4_MASK(7, 4) -+#define VC4_TEX_P0_TYPE_SHIFT 4 -+#define VC4_TEX_P0_MIPLVLS_MASK VC4_MASK(3, 0) -+#define VC4_TEX_P0_MIPLVLS_SHIFT 0 -+ -+#define VC4_TEX_P1_TYPE4_MASK VC4_MASK(31, 31) -+#define VC4_TEX_P1_TYPE4_SHIFT 31 -+#define VC4_TEX_P1_HEIGHT_MASK VC4_MASK(30, 20) -+#define VC4_TEX_P1_HEIGHT_SHIFT 20 -+#define VC4_TEX_P1_ETCFLIP_MASK VC4_MASK(19, 19) -+#define VC4_TEX_P1_ETCFLIP_SHIFT 19 -+#define VC4_TEX_P1_WIDTH_MASK VC4_MASK(18, 8) -+#define VC4_TEX_P1_WIDTH_SHIFT 8 -+ -+#define VC4_TEX_P1_MAGFILT_MASK VC4_MASK(7, 7) -+#define VC4_TEX_P1_MAGFILT_SHIFT 7 -+# define VC4_TEX_P1_MAGFILT_LINEAR 0 -+# define VC4_TEX_P1_MAGFILT_NEAREST 1 -+ -+#define VC4_TEX_P1_MINFILT_MASK VC4_MASK(6, 4) -+#define VC4_TEX_P1_MINFILT_SHIFT 4 -+# define VC4_TEX_P1_MINFILT_LINEAR 0 -+# define VC4_TEX_P1_MINFILT_NEAREST 1 -+# define VC4_TEX_P1_MINFILT_NEAR_MIP_NEAR 2 -+# define VC4_TEX_P1_MINFILT_NEAR_MIP_LIN 3 -+# define VC4_TEX_P1_MINFILT_LIN_MIP_NEAR 4 -+# define VC4_TEX_P1_MINFILT_LIN_MIP_LIN 5 -+ -+#define VC4_TEX_P1_WRAP_T_MASK VC4_MASK(3, 2) -+#define VC4_TEX_P1_WRAP_T_SHIFT 2 -+#define VC4_TEX_P1_WRAP_S_MASK VC4_MASK(1, 0) -+#define VC4_TEX_P1_WRAP_S_SHIFT 0 -+# define VC4_TEX_P1_WRAP_REPEAT 0 -+# define VC4_TEX_P1_WRAP_CLAMP 1 -+# define VC4_TEX_P1_WRAP_MIRROR 2 -+# define VC4_TEX_P1_WRAP_BORDER 3 -+ -+#define VC4_TEX_P2_PTYPE_MASK VC4_MASK(31, 30) -+#define VC4_TEX_P2_PTYPE_SHIFT 30 -+# define VC4_TEX_P2_PTYPE_IGNORED 0 -+# define VC4_TEX_P2_PTYPE_CUBE_MAP_STRIDE 1 -+# define VC4_TEX_P2_PTYPE_CHILD_IMAGE_DIMENSIONS 2 -+# define VC4_TEX_P2_PTYPE_CHILD_IMAGE_OFFSETS 3 -+ -+/* VC4_TEX_P2_PTYPE_CUBE_MAP_STRIDE bits */ -+#define VC4_TEX_P2_CMST_MASK VC4_MASK(29, 12) -+#define VC4_TEX_P2_CMST_SHIFT 12 -+#define VC4_TEX_P2_BSLOD_MASK VC4_MASK(0, 0) -+#define VC4_TEX_P2_BSLOD_SHIFT 0 -+ -+/* VC4_TEX_P2_PTYPE_CHILD_IMAGE_DIMENSIONS */ -+#define VC4_TEX_P2_CHEIGHT_MASK VC4_MASK(22, 12) -+#define VC4_TEX_P2_CHEIGHT_SHIFT 12 -+#define VC4_TEX_P2_CWIDTH_MASK VC4_MASK(10, 0) -+#define VC4_TEX_P2_CWIDTH_SHIFT 0 -+ -+/* VC4_TEX_P2_PTYPE_CHILD_IMAGE_OFFSETS */ -+#define VC4_TEX_P2_CYOFF_MASK VC4_MASK(22, 12) -+#define VC4_TEX_P2_CYOFF_SHIFT 12 -+#define VC4_TEX_P2_CXOFF_MASK VC4_MASK(10, 0) -+#define VC4_TEX_P2_CXOFF_SHIFT 0 -+ -+#endif /* VC4_PACKET_H */ -diff --git a/drivers/gpu/drm/vc4/vc4_plane.c b/drivers/gpu/drm/vc4/vc4_plane.c -index 887f3ca..65e5455 100644 ---- a/drivers/gpu/drm/vc4/vc4_plane.c -+++ b/drivers/gpu/drm/vc4/vc4_plane.c -@@ -29,6 +29,14 @@ struct vc4_plane_state { - u32 *dlist; - u32 dlist_size; /* Number of dwords in allocated for the display list */ - u32 dlist_count; /* Number of used dwords in the display list. */ -+ -+ /* Offset in the dlist to pointer word 0. */ -+ u32 pw0_offset; -+ -+ /* Offset where the plane's dlist was last stored in the -+ hardware at vc4_crtc_atomic_flush() time. -+ */ -+ u32 *hw_dlist; ++MODULE_DESCRIPTION("ASoC PCM1794A codec driver"); ++MODULE_AUTHOR("Florian Meier <florian.meier@koalo.de>"); ++MODULE_LICENSE("GPL v2"); + +From a8113bd47e56c48df869517ceff8a9e05d61e036 Mon Sep 17 00:00:00 2001 +From: Daniel Matuschek <info@crazy-audio.com> +Date: Wed, 15 Jan 2014 21:41:23 +0100 +Subject: [PATCH 068/112] ASoC: wm8804: Implement MCLK configuration options, + add 32bit support WM8804 can run with PLL frequencies of 256xfs and 128xfs + for most sample rates. At 192kHz only 128xfs is supported. The existing + driver selects 128xfs automatically for some lower samples rates. By using an + additional mclk_div divider, it is now possible to control the behaviour. + This allows using 256xfs PLL frequency on all sample rates up to 96kHz. It + should allow lower jitter and better signal quality. The behavior has to be + controlled by the sound card driver, because some sample frequency share the + same setting. e.g. 192kHz and 96kHz use 24.576MHz master clock. The only + difference is the MCLK divider. + +This also added support for 32bit data. + +Signed-off-by: Daniel Matuschek <daniel@matuschek.net> +--- + sound/soc/codecs/wm8804.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/sound/soc/codecs/wm8804.c b/sound/soc/codecs/wm8804.c +index 8d91470..c846716 100644 +--- a/sound/soc/codecs/wm8804.c ++++ b/sound/soc/codecs/wm8804.c +@@ -304,6 +304,7 @@ static int wm8804_hw_params(struct snd_pcm_substream *substream, + blen = 0x1; + break; + case 24: ++ case 32: + blen = 0x2; + break; + default: +@@ -515,7 +516,7 @@ static const struct snd_soc_dai_ops wm8804_dai_ops = { }; - static inline struct vc4_plane_state * -@@ -207,6 +215,8 @@ static int vc4_plane_mode_set(struct drm_plane *plane, - /* Position Word 3: Context. Written by the HVS. */ - vc4_dlist_write(vc4_state, 0xc0c0c0c0); + #define WM8804_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE | \ +- SNDRV_PCM_FMTBIT_S24_LE) ++ SNDRV_PCM_FMTBIT_S24_3LE | SNDRV_PCM_FMTBIT_S32_LE) -+ vc4_state->pw0_offset = vc4_state->dlist_count; -+ - /* Pointer Word 0: RGB / Y Pointer */ - vc4_dlist_write(vc4_state, bo->paddr + offset); + #define WM8804_RATES (SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 | \ + SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_64000 | \ +@@ -543,7 +544,7 @@ static struct snd_soc_dai_driver wm8804_dai = { + }; -@@ -258,6 +268,8 @@ u32 vc4_plane_write_dlist(struct drm_plane *plane, u32 __iomem *dlist) - struct vc4_plane_state *vc4_state = to_vc4_plane_state(plane->state); - int i; + static const struct snd_soc_codec_driver soc_codec_dev_wm8804 = { +- .idle_bias_off = true, ++ .idle_bias_off = false, -+ vc4_state->hw_dlist = dlist; -+ - /* Can't memcpy_toio() because it needs to be 32-bit writes. */ - for (i = 0; i < vc4_state->dlist_count; i++) - writel(vc4_state->dlist[i], &dlist[i]); -@@ -272,6 +284,34 @@ u32 vc4_plane_dlist_size(struct drm_plane_state *state) - return vc4_state->dlist_count; - } + .dapm_widgets = wm8804_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(wm8804_dapm_widgets), + +From e4119855ee7612fe8032d43fb0cd14e87109d613 Mon Sep 17 00:00:00 2001 +From: Daniel Matuschek <info@crazy-audio.com> +Date: Wed, 15 Jan 2014 21:42:08 +0100 +Subject: [PATCH 069/112] ASoC: BCM:Add support for HiFiBerry Digi. Driver is + based on the patched WM8804 driver. + +Signed-off-by: Daniel Matuschek <daniel@matuschek.net> + +Add a parameter to turn off SPDIF output if no audio is playing + +This patch adds the paramater auto_shutdown_output to the kernel module. +Default behaviour of the module is the same, but when auto_shutdown_output +is set to 1, the SPDIF oputput will shutdown if no stream is playing. + +bugfix for 32kHz sample rate, was missing + +HiFiBerry Digi: set SPDIF status bits for sample rate + +The HiFiBerry Digi driver did not signal the sample rate in the SPDIF status bits. +While this is optional, some DACs and receivers do not accept this signal. This patch +adds the sample rate bits in the SPDIF status block. +--- + sound/soc/bcm/Kconfig | 7 ++ + sound/soc/bcm/Makefile | 2 + + sound/soc/bcm/hifiberry_digi.c | 224 +++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 233 insertions(+) + create mode 100644 sound/soc/bcm/hifiberry_digi.c + +diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig +index 900de22..a34aff2 100644 +--- a/sound/soc/bcm/Kconfig ++++ b/sound/soc/bcm/Kconfig +@@ -15,6 +15,13 @@ config SND_BCM2708_SOC_HIFIBERRY_DAC + help + Say Y or M if you want to add support for HifiBerry DAC. -+/* Updates the plane to immediately (well, once the FIFO needs -+ * refilling) scan out from at a new framebuffer. -+ */ -+void vc4_plane_async_set_fb(struct drm_plane *plane, struct drm_framebuffer *fb) -+{ -+ struct vc4_plane_state *vc4_state = to_vc4_plane_state(plane->state); -+ struct drm_gem_cma_object *bo = drm_fb_cma_get_gem_obj(fb, 0); -+ uint32_t addr; -+ -+ /* We're skipping the address adjustment for negative origin, -+ * because this is only called on the primary plane. -+ */ -+ WARN_ON_ONCE(plane->state->crtc_x < 0 || plane->state->crtc_y < 0); -+ addr = bo->paddr + fb->offsets[0]; -+ -+ /* Write the new address into the hardware immediately. The -+ * scanout will start from this address as soon as the FIFO -+ * needs to refill with pixels. -+ */ -+ writel(addr, &vc4_state->hw_dlist[vc4_state->pw0_offset]); -+ -+ /* Also update the CPU-side dlist copy, so that any later -+ * atomic updates that don't do a new modeset on our plane -+ * also use our updated address. -+ */ -+ vc4_state->dlist[vc4_state->pw0_offset] = addr; -+} ++config SND_BCM2708_SOC_HIFIBERRY_DIGI ++ tristate "Support for HifiBerry Digi" ++ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S ++ select SND_SOC_WM8804 ++ help ++ Say Y or M if you want to add support for HifiBerry Digi S/PDIF output board. + - static const struct drm_plane_helper_funcs vc4_plane_helper_funcs = { - .prepare_fb = NULL, - .cleanup_fb = NULL, -diff --git a/drivers/gpu/drm/vc4/vc4_qpu_defines.h b/drivers/gpu/drm/vc4/vc4_qpu_defines.h -new file mode 100644 -index 0000000..e47c994 ---- /dev/null -+++ b/drivers/gpu/drm/vc4/vc4_qpu_defines.h -@@ -0,0 +1,268 @@ -+/* -+ * Copyright © 2014 Broadcom -+ * -+ * Permission is hereby granted, free of charge, to any person obtaining a -+ * copy of this software and associated documentation files (the "Software"), -+ * to deal in the Software without restriction, including without limitation -+ * the rights to use, copy, modify, merge, publish, distribute, sublicense, -+ * and/or sell copies of the Software, and to permit persons to whom the -+ * Software is furnished to do so, subject to the following conditions: -+ * -+ * The above copyright notice and this permission notice (including the next -+ * paragraph) shall be included in all copies or substantial portions of the -+ * Software. -+ * -+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -+ * IN THE SOFTWARE. -+ */ -+ -+#ifndef VC4_QPU_DEFINES_H -+#define VC4_QPU_DEFINES_H -+ -+enum qpu_op_add { -+ QPU_A_NOP, -+ QPU_A_FADD, -+ QPU_A_FSUB, -+ QPU_A_FMIN, -+ QPU_A_FMAX, -+ QPU_A_FMINABS, -+ QPU_A_FMAXABS, -+ QPU_A_FTOI, -+ QPU_A_ITOF, -+ QPU_A_ADD = 12, -+ QPU_A_SUB, -+ QPU_A_SHR, -+ QPU_A_ASR, -+ QPU_A_ROR, -+ QPU_A_SHL, -+ QPU_A_MIN, -+ QPU_A_MAX, -+ QPU_A_AND, -+ QPU_A_OR, -+ QPU_A_XOR, -+ QPU_A_NOT, -+ QPU_A_CLZ, -+ QPU_A_V8ADDS = 30, -+ QPU_A_V8SUBS = 31, -+}; -+ -+enum qpu_op_mul { -+ QPU_M_NOP, -+ QPU_M_FMUL, -+ QPU_M_MUL24, -+ QPU_M_V8MULD, -+ QPU_M_V8MIN, -+ QPU_M_V8MAX, -+ QPU_M_V8ADDS, -+ QPU_M_V8SUBS, -+}; -+ -+enum qpu_raddr { -+ QPU_R_FRAG_PAYLOAD_ZW = 15, /* W for A file, Z for B file */ -+ /* 0-31 are the plain regfile a or b fields */ -+ QPU_R_UNIF = 32, -+ QPU_R_VARY = 35, -+ QPU_R_ELEM_QPU = 38, -+ QPU_R_NOP, -+ QPU_R_XY_PIXEL_COORD = 41, -+ QPU_R_MS_REV_FLAGS = 41, -+ QPU_R_VPM = 48, -+ QPU_R_VPM_LD_BUSY, -+ QPU_R_VPM_LD_WAIT, -+ QPU_R_MUTEX_ACQUIRE, -+}; -+ -+enum qpu_waddr { -+ /* 0-31 are the plain regfile a or b fields */ -+ QPU_W_ACC0 = 32, /* aka r0 */ -+ QPU_W_ACC1, -+ QPU_W_ACC2, -+ QPU_W_ACC3, -+ QPU_W_TMU_NOSWAP, -+ QPU_W_ACC5, -+ QPU_W_HOST_INT, -+ QPU_W_NOP, -+ QPU_W_UNIFORMS_ADDRESS, -+ QPU_W_QUAD_XY, /* X for regfile a, Y for regfile b */ -+ QPU_W_MS_FLAGS = 42, -+ QPU_W_REV_FLAG = 42, -+ QPU_W_TLB_STENCIL_SETUP = 43, -+ QPU_W_TLB_Z, -+ QPU_W_TLB_COLOR_MS, -+ QPU_W_TLB_COLOR_ALL, -+ QPU_W_TLB_ALPHA_MASK, -+ QPU_W_VPM, -+ QPU_W_VPMVCD_SETUP, /* LD for regfile a, ST for regfile b */ -+ QPU_W_VPM_ADDR, /* LD for regfile a, ST for regfile b */ -+ QPU_W_MUTEX_RELEASE, -+ QPU_W_SFU_RECIP, -+ QPU_W_SFU_RECIPSQRT, -+ QPU_W_SFU_EXP, -+ QPU_W_SFU_LOG, -+ QPU_W_TMU0_S, -+ QPU_W_TMU0_T, -+ QPU_W_TMU0_R, -+ QPU_W_TMU0_B, -+ QPU_W_TMU1_S, -+ QPU_W_TMU1_T, -+ QPU_W_TMU1_R, -+ QPU_W_TMU1_B, -+}; -+ -+enum qpu_sig_bits { -+ QPU_SIG_SW_BREAKPOINT, -+ QPU_SIG_NONE, -+ QPU_SIG_THREAD_SWITCH, -+ QPU_SIG_PROG_END, -+ QPU_SIG_WAIT_FOR_SCOREBOARD, -+ QPU_SIG_SCOREBOARD_UNLOCK, -+ QPU_SIG_LAST_THREAD_SWITCH, -+ QPU_SIG_COVERAGE_LOAD, -+ QPU_SIG_COLOR_LOAD, -+ QPU_SIG_COLOR_LOAD_END, -+ QPU_SIG_LOAD_TMU0, -+ QPU_SIG_LOAD_TMU1, -+ QPU_SIG_ALPHA_MASK_LOAD, -+ QPU_SIG_SMALL_IMM, -+ QPU_SIG_LOAD_IMM, -+ QPU_SIG_BRANCH -+}; -+ -+enum qpu_mux { -+ /* hardware mux values */ -+ QPU_MUX_R0, -+ QPU_MUX_R1, -+ QPU_MUX_R2, -+ QPU_MUX_R3, -+ QPU_MUX_R4, -+ QPU_MUX_R5, -+ QPU_MUX_A, -+ QPU_MUX_B, -+ -+ /* non-hardware mux values */ -+ QPU_MUX_IMM, -+}; -+ -+enum qpu_cond { -+ QPU_COND_NEVER, -+ QPU_COND_ALWAYS, -+ QPU_COND_ZS, -+ QPU_COND_ZC, -+ QPU_COND_NS, -+ QPU_COND_NC, -+ QPU_COND_CS, -+ QPU_COND_CC, -+}; -+ -+enum qpu_pack_mul { -+ QPU_PACK_MUL_NOP, -+ QPU_PACK_MUL_8888 = 3, /* replicated to each 8 bits of the 32-bit dst. */ -+ QPU_PACK_MUL_8A, -+ QPU_PACK_MUL_8B, -+ QPU_PACK_MUL_8C, -+ QPU_PACK_MUL_8D, -+}; -+ -+enum qpu_pack_a { -+ QPU_PACK_A_NOP, -+ /* convert to 16 bit float if float input, or to int16. */ -+ QPU_PACK_A_16A, -+ QPU_PACK_A_16B, -+ /* replicated to each 8 bits of the 32-bit dst. */ -+ QPU_PACK_A_8888, -+ /* Convert to 8-bit unsigned int. */ -+ QPU_PACK_A_8A, -+ QPU_PACK_A_8B, -+ QPU_PACK_A_8C, -+ QPU_PACK_A_8D, -+ -+ /* Saturating variants of the previous instructions. */ -+ QPU_PACK_A_32_SAT, /* int-only */ -+ QPU_PACK_A_16A_SAT, /* int or float */ -+ QPU_PACK_A_16B_SAT, -+ QPU_PACK_A_8888_SAT, -+ QPU_PACK_A_8A_SAT, -+ QPU_PACK_A_8B_SAT, -+ QPU_PACK_A_8C_SAT, -+ QPU_PACK_A_8D_SAT, -+}; -+ -+enum qpu_unpack_r4 { -+ QPU_UNPACK_R4_NOP, -+ QPU_UNPACK_R4_F16A_TO_F32, -+ QPU_UNPACK_R4_F16B_TO_F32, -+ QPU_UNPACK_R4_8D_REP, -+ QPU_UNPACK_R4_8A, -+ QPU_UNPACK_R4_8B, -+ QPU_UNPACK_R4_8C, -+ QPU_UNPACK_R4_8D, -+}; -+ -+#define QPU_MASK(high, low) ((((uint64_t)1<<((high)-(low)+1))-1)<<(low)) -+/* Using the GNU statement expression extension */ -+#define QPU_SET_FIELD(value, field) \ -+ ({ \ -+ uint64_t fieldval = (uint64_t)(value) << field ## _SHIFT; \ -+ assert((fieldval & ~ field ## _MASK) == 0); \ -+ fieldval & field ## _MASK; \ -+ }) -+ -+#define QPU_GET_FIELD(word, field) ((uint32_t)(((word) & field ## _MASK) >> field ## _SHIFT)) -+ -+#define QPU_SIG_SHIFT 60 -+#define QPU_SIG_MASK QPU_MASK(63, 60) -+ -+#define QPU_UNPACK_SHIFT 57 -+#define QPU_UNPACK_MASK QPU_MASK(59, 57) -+ -+/** -+ * If set, the pack field means PACK_MUL or R4 packing, instead of normal -+ * regfile a packing. -+ */ -+#define QPU_PM ((uint64_t)1 << 56) -+ -+#define QPU_PACK_SHIFT 52 -+#define QPU_PACK_MASK QPU_MASK(55, 52) -+ -+#define QPU_COND_ADD_SHIFT 49 -+#define QPU_COND_ADD_MASK QPU_MASK(51, 49) -+#define QPU_COND_MUL_SHIFT 46 -+#define QPU_COND_MUL_MASK QPU_MASK(48, 46) -+ -+#define QPU_SF ((uint64_t)1 << 45) -+ -+#define QPU_WADDR_ADD_SHIFT 38 -+#define QPU_WADDR_ADD_MASK QPU_MASK(43, 38) -+#define QPU_WADDR_MUL_SHIFT 32 -+#define QPU_WADDR_MUL_MASK QPU_MASK(37, 32) -+ -+#define QPU_OP_MUL_SHIFT 29 -+#define QPU_OP_MUL_MASK QPU_MASK(31, 29) -+ -+#define QPU_RADDR_A_SHIFT 18 -+#define QPU_RADDR_A_MASK QPU_MASK(23, 18) -+#define QPU_RADDR_B_SHIFT 12 -+#define QPU_RADDR_B_MASK QPU_MASK(17, 12) -+#define QPU_SMALL_IMM_SHIFT 12 -+#define QPU_SMALL_IMM_MASK QPU_MASK(17, 12) -+ -+#define QPU_ADD_A_SHIFT 9 -+#define QPU_ADD_A_MASK QPU_MASK(11, 9) -+#define QPU_ADD_B_SHIFT 6 -+#define QPU_ADD_B_MASK QPU_MASK(8, 6) -+#define QPU_MUL_A_SHIFT 3 -+#define QPU_MUL_A_MASK QPU_MASK(5, 3) -+#define QPU_MUL_B_SHIFT 0 -+#define QPU_MUL_B_MASK QPU_MASK(2, 0) -+ -+#define QPU_WS ((uint64_t)1 << 44) -+ -+#define QPU_OP_ADD_SHIFT 24 -+#define QPU_OP_ADD_MASK QPU_MASK(28, 24) -+ -+#endif /* VC4_QPU_DEFINES_H */ -diff --git a/drivers/gpu/drm/vc4/vc4_render_cl.c b/drivers/gpu/drm/vc4/vc4_render_cl.c + config SND_BCM2708_SOC_RPI_DAC + tristate "Support for RPi-DAC" + depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S +diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile +index 99c96b4..4d53c58 100644 +--- a/sound/soc/bcm/Makefile ++++ b/sound/soc/bcm/Makefile +@@ -5,7 +5,9 @@ obj-$(CONFIG_SND_BCM2835_SOC_I2S) += snd-soc-bcm2835-i2s.o + + # BCM2708 Machine Support + snd-soc-hifiberry-dac-objs := hifiberry_dac.o ++snd-soc-hifiberry-digi-objs := hifiberry_digi.o + snd-soc-rpi-dac-objs := rpi-dac.o + + obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o ++obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI) += snd-soc-hifiberry-digi.o + obj-$(CONFIG_SND_BCM2708_SOC_RPI_DAC) += snd-soc-rpi-dac.o +diff --git a/sound/soc/bcm/hifiberry_digi.c b/sound/soc/bcm/hifiberry_digi.c new file mode 100644 -index 0000000..0ffac8d +index 0000000..9840e15 --- /dev/null -+++ b/drivers/gpu/drm/vc4/vc4_render_cl.c -@@ -0,0 +1,448 @@ ++++ b/sound/soc/bcm/hifiberry_digi.c +@@ -0,0 +1,224 @@ +/* -+ * Copyright © 2014-2015 Broadcom ++ * ASoC Driver for HifiBerry Digi + * -+ * Permission is hereby granted, free of charge, to any person obtaining a -+ * copy of this software and associated documentation files (the "Software"), -+ * to deal in the Software without restriction, including without limitation -+ * the rights to use, copy, modify, merge, publish, distribute, sublicense, -+ * and/or sell copies of the Software, and to permit persons to whom the -+ * Software is furnished to do so, subject to the following conditions: ++ * Author: Daniel Matuschek <info@crazy-audio.com> ++ * based on the HifiBerry DAC driver by Florian Meier <florian.meier@koalo.de> ++ * Copyright 2013 + * -+ * The above copyright notice and this permission notice (including the next -+ * paragraph) shall be included in all copies or substantial portions of the -+ * Software. ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * version 2 as published by the Free Software Foundation. + * -+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -+ * IN THE SOFTWARE. ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * General Public License for more details. + */ + -+/** -+ * DOC: Render command list generation -+ * -+ * In the VC4 driver, render command list generation is performed by the -+ * kernel instead of userspace. We do this because validating a -+ * user-submitted command list is hard to get right and has high CPU overhead, -+ * while the number of valid configurations for render command lists is -+ * actually fairly low. -+ */ ++#include <linux/module.h> ++#include <linux/platform_device.h> + -+#include "uapi/drm/vc4_drm.h" -+#include "vc4_drv.h" -+#include "vc4_packet.h" ++#include <sound/core.h> ++#include <sound/pcm.h> ++#include <sound/pcm_params.h> ++#include <sound/soc.h> ++#include <sound/jack.h> + -+struct vc4_rcl_setup { -+ struct drm_gem_cma_object *color_read; -+ struct drm_gem_cma_object *color_ms_write; -+ struct drm_gem_cma_object *zs_read; -+ struct drm_gem_cma_object *zs_write; ++#include "../codecs/wm8804.h" + -+ struct drm_gem_cma_object *rcl; -+ u32 next_offset; -+}; ++static short int auto_shutdown_output = 0; ++module_param(auto_shutdown_output, short, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP); ++MODULE_PARM_DESC(auto_shutdown_output, "Shutdown SP/DIF output if playback is stopped"); + -+static inline void rcl_u8(struct vc4_rcl_setup *setup, u8 val) -+{ -+ *(u8 *)(setup->rcl->vaddr + setup->next_offset) = val; -+ setup->next_offset += 1; -+} + -+static inline void rcl_u16(struct vc4_rcl_setup *setup, u16 val) -+{ -+ *(u16 *)(setup->rcl->vaddr + setup->next_offset) = val; -+ setup->next_offset += 2; -+} ++static int samplerate=44100; + -+static inline void rcl_u32(struct vc4_rcl_setup *setup, u32 val) ++static int snd_rpi_hifiberry_digi_init(struct snd_soc_pcm_runtime *rtd) +{ -+ *(u32 *)(setup->rcl->vaddr + setup->next_offset) = val; -+ setup->next_offset += 4; -+} ++ struct snd_soc_codec *codec = rtd->codec; + ++ /* enable TX output */ ++ snd_soc_update_bits(codec, WM8804_PWRDN, 0x4, 0x0); + -+/* -+ * Emits a no-op STORE_TILE_BUFFER_GENERAL. -+ * -+ * If we emit a PACKET_TILE_COORDINATES, it must be followed by a store of -+ * some sort before another load is triggered. -+ */ -+static void vc4_store_before_load(struct vc4_rcl_setup *setup) -+{ -+ rcl_u8(setup, VC4_PACKET_STORE_TILE_BUFFER_GENERAL); -+ rcl_u16(setup, -+ VC4_SET_FIELD(VC4_LOADSTORE_TILE_BUFFER_NONE, -+ VC4_LOADSTORE_TILE_BUFFER_BUFFER) | -+ VC4_STORE_TILE_BUFFER_DISABLE_COLOR_CLEAR | -+ VC4_STORE_TILE_BUFFER_DISABLE_ZS_CLEAR | -+ VC4_STORE_TILE_BUFFER_DISABLE_VG_MASK_CLEAR); -+ rcl_u32(setup, 0); /* no address, since we're in None mode */ ++ return 0; +} + -+/* -+ * Emits a PACKET_TILE_COORDINATES if one isn't already pending. -+ * -+ * The tile coordinates packet triggers a pending load if there is one, are -+ * used for clipping during rendering, and determine where loads/stores happen -+ * relative to their base address. -+ */ -+static void vc4_tile_coordinates(struct vc4_rcl_setup *setup, -+ uint32_t x, uint32_t y) -+{ -+ rcl_u8(setup, VC4_PACKET_TILE_COORDINATES); -+ rcl_u8(setup, x); -+ rcl_u8(setup, y); ++static int snd_rpi_hifiberry_digi_startup(struct snd_pcm_substream *substream) { ++ /* turn on digital output */ ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_codec *codec = rtd->codec; ++ snd_soc_update_bits(codec, WM8804_PWRDN, 0x3c, 0x00); ++ return 0; +} + -+static void emit_tile(struct vc4_exec_info *exec, -+ struct vc4_rcl_setup *setup, -+ uint8_t x, uint8_t y, bool first, bool last) -+{ -+ struct drm_vc4_submit_cl *args = exec->args; -+ bool has_bin = args->bin_cl_size != 0; -+ -+ /* Note that the load doesn't actually occur until the -+ * tile coords packet is processed, and only one load -+ * may be outstanding at a time. -+ */ -+ if (setup->color_read) { -+ rcl_u8(setup, VC4_PACKET_LOAD_TILE_BUFFER_GENERAL); -+ rcl_u16(setup, args->color_read.bits); -+ rcl_u32(setup, -+ setup->color_read->paddr + args->color_read.offset); ++static void snd_rpi_hifiberry_digi_shutdown(struct snd_pcm_substream *substream) { ++ /* turn off output */ ++ if (auto_shutdown_output) { ++ /* turn off output */ ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_codec *codec = rtd->codec; ++ snd_soc_update_bits(codec, WM8804_PWRDN, 0x3c, 0x3c); + } ++} + -+ if (setup->zs_read) { -+ if (setup->color_read) { -+ /* Exec previous load. */ -+ vc4_tile_coordinates(setup, x, y); -+ vc4_store_before_load(setup); -+ } + -+ rcl_u8(setup, VC4_PACKET_LOAD_TILE_BUFFER_GENERAL); -+ rcl_u16(setup, args->zs_read.bits); -+ rcl_u32(setup, setup->zs_read->paddr + args->zs_read.offset); -+ } ++static int snd_rpi_hifiberry_digi_hw_params(struct snd_pcm_substream *substream, ++ struct snd_pcm_hw_params *params) ++{ ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_dai *codec_dai = rtd->codec_dai; ++ struct snd_soc_codec *codec = rtd->codec; ++ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; + -+ /* Clipping depends on tile coordinates having been -+ * emitted, so we always need one here. -+ */ -+ vc4_tile_coordinates(setup, x, y); ++ int sysclk = 27000000; /* This is fixed on this board */ + -+ /* Wait for the binner before jumping to the first -+ * tile's lists. -+ */ -+ if (first && has_bin) -+ rcl_u8(setup, VC4_PACKET_WAIT_ON_SEMAPHORE); ++ long mclk_freq=0; ++ int mclk_div=1; ++ int sampling_freq=1; + -+ if (has_bin) { -+ rcl_u8(setup, VC4_PACKET_BRANCH_TO_SUB_LIST); -+ rcl_u32(setup, (exec->tile_bo->paddr + -+ exec->tile_alloc_offset + -+ (y * exec->bin_tiles_x + x) * 32)); -+ } ++ int ret; ++ ++ samplerate = params_rate(params); + -+ if (setup->zs_write) { -+ rcl_u8(setup, VC4_PACKET_STORE_TILE_BUFFER_GENERAL); -+ rcl_u16(setup, args->zs_write.bits | -+ (setup->color_ms_write ? -+ VC4_STORE_TILE_BUFFER_DISABLE_COLOR_CLEAR : 0)); -+ rcl_u32(setup, -+ (setup->zs_write->paddr + args->zs_write.offset) | -+ ((last && !setup->color_ms_write) ? -+ VC4_LOADSTORE_TILE_BUFFER_EOF : 0)); ++ if (samplerate<=96000) { ++ mclk_freq=samplerate*256; ++ mclk_div=WM8804_MCLKDIV_256FS; ++ } else { ++ mclk_freq=samplerate*128; ++ mclk_div=WM8804_MCLKDIV_128FS; ++ } ++ ++ switch (samplerate) { ++ case 32000: ++ sampling_freq=0x03; ++ break; ++ case 44100: ++ sampling_freq=0x00; ++ break; ++ case 48000: ++ sampling_freq=0x02; ++ break; ++ case 88200: ++ sampling_freq=0x08; ++ break; ++ case 96000: ++ sampling_freq=0x0a; ++ break; ++ case 176400: ++ sampling_freq=0x0c; ++ break; ++ case 192000: ++ sampling_freq=0x0e; ++ break; ++ default: ++ dev_err(codec->dev, ++ "Failed to set WM8804 SYSCLK, unsupported samplerate %d\n", ++ samplerate); + } + -+ if (setup->color_ms_write) { -+ if (setup->zs_write) { -+ /* Reset after previous store */ -+ vc4_tile_coordinates(setup, x, y); -+ } ++ snd_soc_dai_set_clkdiv(codec_dai, WM8804_MCLK_DIV, mclk_div); ++ snd_soc_dai_set_pll(codec_dai, 0, 0, sysclk, mclk_freq); + -+ if (last) -+ rcl_u8(setup, VC4_PACKET_STORE_MS_TILE_BUFFER_AND_EOF); -+ else -+ rcl_u8(setup, VC4_PACKET_STORE_MS_TILE_BUFFER); ++ ret = snd_soc_dai_set_sysclk(codec_dai, WM8804_TX_CLKSRC_PLL, ++ sysclk, SND_SOC_CLOCK_OUT); ++ if (ret < 0) { ++ dev_err(codec->dev, ++ "Failed to set WM8804 SYSCLK: %d\n", ret); ++ return ret; + } -+} + -+static int vc4_create_rcl_bo(struct drm_device *dev, struct vc4_exec_info *exec, -+ struct vc4_rcl_setup *setup) -+{ -+ struct drm_vc4_submit_cl *args = exec->args; -+ bool has_bin = args->bin_cl_size != 0; -+ uint8_t min_x_tile = args->min_x_tile; -+ uint8_t min_y_tile = args->min_y_tile; -+ uint8_t max_x_tile = args->max_x_tile; -+ uint8_t max_y_tile = args->max_y_tile; -+ uint8_t xtiles = max_x_tile - min_x_tile + 1; -+ uint8_t ytiles = max_y_tile - min_y_tile + 1; -+ uint8_t x, y; -+ uint32_t size, loop_body_size; ++ /* Enable TX output */ ++ snd_soc_update_bits(codec, WM8804_PWRDN, 0x4, 0x0); + -+ size = VC4_PACKET_TILE_RENDERING_MODE_CONFIG_SIZE; -+ loop_body_size = VC4_PACKET_TILE_COORDINATES_SIZE; ++ /* Power on */ ++ snd_soc_update_bits(codec, WM8804_PWRDN, 0x9, 0); + -+ if (args->flags & VC4_SUBMIT_CL_USE_CLEAR_COLOR) { -+ size += VC4_PACKET_CLEAR_COLORS_SIZE + -+ VC4_PACKET_TILE_COORDINATES_SIZE + -+ VC4_PACKET_STORE_TILE_BUFFER_GENERAL_SIZE; -+ } ++ /* set sampling frequency status bits */ ++ snd_soc_update_bits(codec, WM8804_SPDTX4, 0x0f, sampling_freq); + -+ if (setup->color_read) { -+ loop_body_size += (VC4_PACKET_LOAD_TILE_BUFFER_GENERAL_SIZE); -+ } -+ if (setup->zs_read) { -+ if (setup->color_read) { -+ loop_body_size += VC4_PACKET_TILE_COORDINATES_SIZE; -+ loop_body_size += VC4_PACKET_STORE_TILE_BUFFER_GENERAL_SIZE; -+ } -+ loop_body_size += VC4_PACKET_LOAD_TILE_BUFFER_GENERAL_SIZE; -+ } ++ return snd_soc_dai_set_bclk_ratio(cpu_dai,64); ++} + -+ if (has_bin) { -+ size += VC4_PACKET_WAIT_ON_SEMAPHORE_SIZE; -+ loop_body_size += VC4_PACKET_BRANCH_TO_SUB_LIST_SIZE; -+ } ++/* machine stream operations */ ++static struct snd_soc_ops snd_rpi_hifiberry_digi_ops = { ++ .hw_params = snd_rpi_hifiberry_digi_hw_params, ++ .startup = snd_rpi_hifiberry_digi_startup, ++ .shutdown = snd_rpi_hifiberry_digi_shutdown, ++}; + -+ if (setup->zs_write) -+ loop_body_size += VC4_PACKET_STORE_TILE_BUFFER_GENERAL_SIZE; -+ if (setup->color_ms_write) { -+ if (setup->zs_write) -+ loop_body_size += VC4_PACKET_TILE_COORDINATES_SIZE; -+ loop_body_size += VC4_PACKET_STORE_MS_TILE_BUFFER_SIZE; -+ } -+ size += xtiles * ytiles * loop_body_size; ++static struct snd_soc_dai_link snd_rpi_hifiberry_digi_dai[] = { ++{ ++ .name = "HifiBerry Digi", ++ .stream_name = "HifiBerry Digi HiFi", ++ .cpu_dai_name = "bcm2708-i2s.0", ++ .codec_dai_name = "wm8804-spdif", ++ .platform_name = "bcm2708-i2s.0", ++ .codec_name = "wm8804.1-003b", ++ .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | ++ SND_SOC_DAIFMT_CBM_CFM, ++ .ops = &snd_rpi_hifiberry_digi_ops, ++ .init = snd_rpi_hifiberry_digi_init, ++}, ++}; + -+ setup->rcl = &vc4_bo_create(dev, size)->base; -+ if (!setup->rcl) -+ return -ENOMEM; -+ list_add_tail(&to_vc4_bo(&setup->rcl->base)->unref_head, -+ &exec->unref_list); -+ -+ rcl_u8(setup, VC4_PACKET_TILE_RENDERING_MODE_CONFIG); -+ rcl_u32(setup, -+ (setup->color_ms_write ? -+ (setup->color_ms_write->paddr + -+ args->color_ms_write.offset) : -+ 0)); -+ rcl_u16(setup, args->width); -+ rcl_u16(setup, args->height); -+ rcl_u16(setup, args->color_ms_write.bits); -+ -+ /* The tile buffer gets cleared when the previous tile is stored. If -+ * the clear values changed between frames, then the tile buffer has -+ * stale clear values in it, so we have to do a store in None mode (no -+ * writes) so that we trigger the tile buffer clear. -+ */ -+ if (args->flags & VC4_SUBMIT_CL_USE_CLEAR_COLOR) { -+ rcl_u8(setup, VC4_PACKET_CLEAR_COLORS); -+ rcl_u32(setup, args->clear_color[0]); -+ rcl_u32(setup, args->clear_color[1]); -+ rcl_u32(setup, args->clear_z); -+ rcl_u8(setup, args->clear_s); ++/* audio machine driver */ ++static struct snd_soc_card snd_rpi_hifiberry_digi = { ++ .name = "snd_rpi_hifiberry_digi", ++ .owner = THIS_MODULE, ++ .dai_link = snd_rpi_hifiberry_digi_dai, ++ .num_links = ARRAY_SIZE(snd_rpi_hifiberry_digi_dai), ++}; + -+ vc4_tile_coordinates(setup, 0, 0); ++static int snd_rpi_hifiberry_digi_probe(struct platform_device *pdev) ++{ ++ int ret = 0; + -+ rcl_u8(setup, VC4_PACKET_STORE_TILE_BUFFER_GENERAL); -+ rcl_u16(setup, VC4_LOADSTORE_TILE_BUFFER_NONE); -+ rcl_u32(setup, 0); /* no address, since we're in None mode */ -+ } ++ snd_rpi_hifiberry_digi.dev = &pdev->dev; + -+ for (y = min_y_tile; y <= max_y_tile; y++) { -+ for (x = min_x_tile; x <= max_x_tile; x++) { -+ bool first = (x == min_x_tile && y == min_y_tile); -+ bool last = (x == max_x_tile && y == max_y_tile); -+ emit_tile(exec, setup, x, y, first, last); -+ } ++ if (pdev->dev.of_node) { ++ struct device_node *i2s_node; ++ struct snd_soc_dai_link *dai = &snd_rpi_hifiberry_digi_dai[0]; ++ i2s_node = of_parse_phandle(pdev->dev.of_node, ++ "i2s-controller", 0); ++ ++ if (i2s_node) { ++ dai->cpu_dai_name = NULL; ++ dai->cpu_of_node = i2s_node; ++ dai->platform_name = NULL; ++ dai->platform_of_node = i2s_node; ++ } + } + -+ BUG_ON(setup->next_offset != size); -+ exec->ct1ca = setup->rcl->paddr; -+ exec->ct1ea = setup->rcl->paddr + setup->next_offset; ++ ret = snd_soc_register_card(&snd_rpi_hifiberry_digi); ++ if (ret) ++ dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", ret); + -+ return 0; ++ return ret; +} + -+static int vc4_rcl_surface_setup(struct vc4_exec_info *exec, -+ struct drm_gem_cma_object **obj, -+ struct drm_vc4_submit_rcl_surface *surf) ++static int snd_rpi_hifiberry_digi_remove(struct platform_device *pdev) +{ -+ uint8_t tiling = VC4_GET_FIELD(surf->bits, -+ VC4_LOADSTORE_TILE_BUFFER_TILING); -+ uint8_t buffer = VC4_GET_FIELD(surf->bits, -+ VC4_LOADSTORE_TILE_BUFFER_BUFFER); -+ uint8_t format = VC4_GET_FIELD(surf->bits, -+ VC4_LOADSTORE_TILE_BUFFER_FORMAT); -+ int cpp; ++ return snd_soc_unregister_card(&snd_rpi_hifiberry_digi); ++} + -+ if (surf->pad != 0) { -+ DRM_ERROR("Padding unset\n"); -+ return -EINVAL; -+ } ++static const struct of_device_id snd_rpi_hifiberry_digi_of_match[] = { ++ { .compatible = "hifiberry,hifiberry-digi", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, snd_rpi_hifiberry_digi_of_match); + -+ if (surf->hindex == ~0) -+ return 0; ++static struct platform_driver snd_rpi_hifiberry_digi_driver = { ++ .driver = { ++ .name = "snd-hifiberry-digi", ++ .owner = THIS_MODULE, ++ .of_match_table = snd_rpi_hifiberry_digi_of_match, ++ }, ++ .probe = snd_rpi_hifiberry_digi_probe, ++ .remove = snd_rpi_hifiberry_digi_remove, ++}; + -+ if (!vc4_use_bo(exec, surf->hindex, VC4_MODE_RENDER, obj)) -+ return -EINVAL; ++module_platform_driver(snd_rpi_hifiberry_digi_driver); + -+ if (surf->bits & ~(VC4_LOADSTORE_TILE_BUFFER_TILING_MASK | -+ VC4_LOADSTORE_TILE_BUFFER_BUFFER_MASK | -+ VC4_LOADSTORE_TILE_BUFFER_FORMAT_MASK)) { -+ DRM_ERROR("Unknown bits in load/store: 0x%04x\n", -+ surf->bits); -+ return -EINVAL; -+ } ++MODULE_AUTHOR("Daniel Matuschek <info@crazy-audio.com>"); ++MODULE_DESCRIPTION("ASoC Driver for HifiBerry Digi"); ++MODULE_LICENSE("GPL v2"); + +From ea72e0251bc9d43b981cf3f5caa807c41475e327 Mon Sep 17 00:00:00 2001 +From: Gordon Garrity <gordon@iqaudio.com> +Date: Sat, 8 Mar 2014 16:56:57 +0000 +Subject: [PATCH 070/112] Add IQaudIO Sound Card support for Raspberry Pi + +Set a limit of 0dB on Digital Volume Control + +The main volume control in the PCM512x DAC has a range up to ++24dB. This is dangerously loud and can potentially cause massive +clipping in the output stages. Therefore this sets a sensible +limit of 0dB for this control. + +Allow up to 24dB digital gain to be applied when using IQAudIO DAC+ + +24db_digital_gain DT param can be used to specify that PCM512x +codec "Digital" volume control should not be limited to 0dB gain, +and if specified will allow the full 24dB gain. + +Modify IQAudIO DAC+ ASoC driver to set card/dai config from dt + +Add the ability to set the card name, dai name and dai stream name, from +dt config. + +Signed-off-by: DigitalDreamtime <clive.messer@digitaldreamtime.co.uk> +--- + sound/soc/bcm/Kconfig | 7 +++ + sound/soc/bcm/Makefile | 2 + + sound/soc/bcm/iqaudio-dac.c | 148 ++++++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 157 insertions(+) + create mode 100644 sound/soc/bcm/iqaudio-dac.c + +diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig +index a34aff2..38dcdd9 100644 +--- a/sound/soc/bcm/Kconfig ++++ b/sound/soc/bcm/Kconfig +@@ -28,3 +28,10 @@ config SND_BCM2708_SOC_RPI_DAC + select SND_SOC_PCM1794A + help + Say Y or M if you want to add support for RPi-DAC. + -+ if (tiling > VC4_TILING_FORMAT_LT) { -+ DRM_ERROR("Bad tiling format\n"); -+ return -EINVAL; -+ } ++config SND_BCM2708_SOC_IQAUDIO_DAC ++ tristate "Support for IQaudIO-DAC" ++ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S ++ select SND_SOC_PCM512x_I2C ++ help ++ Say Y or M if you want to add support for IQaudIO-DAC. +diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile +index 4d53c58..08e4dc5 100644 +--- a/sound/soc/bcm/Makefile ++++ b/sound/soc/bcm/Makefile +@@ -7,7 +7,9 @@ obj-$(CONFIG_SND_BCM2835_SOC_I2S) += snd-soc-bcm2835-i2s.o + snd-soc-hifiberry-dac-objs := hifiberry_dac.o + snd-soc-hifiberry-digi-objs := hifiberry_digi.o + snd-soc-rpi-dac-objs := rpi-dac.o ++snd-soc-iqaudio-dac-objs := iqaudio-dac.o + + obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o + obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI) += snd-soc-hifiberry-digi.o + obj-$(CONFIG_SND_BCM2708_SOC_RPI_DAC) += snd-soc-rpi-dac.o ++obj-$(CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC) += snd-soc-iqaudio-dac.o +diff --git a/sound/soc/bcm/iqaudio-dac.c b/sound/soc/bcm/iqaudio-dac.c +new file mode 100644 +index 0000000..b6b6dcf +--- /dev/null ++++ b/sound/soc/bcm/iqaudio-dac.c +@@ -0,0 +1,148 @@ ++/* ++ * ASoC Driver for IQaudIO DAC ++ * ++ * Author: Florian Meier <florian.meier@koalo.de> ++ * Copyright 2013 ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * version 2 as published by the Free Software Foundation. ++ * ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * General Public License for more details. ++ */ + -+ if (buffer == VC4_LOADSTORE_TILE_BUFFER_ZS) { -+ if (format != 0) { -+ DRM_ERROR("No color format should be set for ZS\n"); -+ return -EINVAL; -+ } -+ cpp = 4; -+ } else if (buffer == VC4_LOADSTORE_TILE_BUFFER_COLOR) { -+ switch (format) { -+ case VC4_LOADSTORE_TILE_BUFFER_BGR565: -+ case VC4_LOADSTORE_TILE_BUFFER_BGR565_DITHER: -+ cpp = 2; -+ break; -+ case VC4_LOADSTORE_TILE_BUFFER_RGBA8888: -+ cpp = 4; -+ break; -+ default: -+ DRM_ERROR("Bad tile buffer format\n"); -+ return -EINVAL; -+ } -+ } else { -+ DRM_ERROR("Bad load/store buffer %d.\n", buffer); -+ return -EINVAL; -+ } ++#include <linux/module.h> ++#include <linux/platform_device.h> + -+ if (surf->offset & 0xf) { -+ DRM_ERROR("load/store buffer must be 16b aligned.\n"); -+ return -EINVAL; -+ } ++#include <sound/core.h> ++#include <sound/pcm.h> ++#include <sound/pcm_params.h> ++#include <sound/soc.h> ++#include <sound/jack.h> + -+ if (!vc4_check_tex_size(exec, *obj, surf->offset, tiling, -+ exec->args->width, exec->args->height, cpp)) { -+ return -EINVAL; ++static bool digital_gain_0db_limit = true; ++ ++static int snd_rpi_iqaudio_dac_init(struct snd_soc_pcm_runtime *rtd) ++{ ++ if (digital_gain_0db_limit) ++ { ++ int ret; ++ struct snd_soc_card *card = rtd->card; ++ ++ ret = snd_soc_limit_volume(card, "Digital Playback Volume", 207); ++ if (ret < 0) ++ dev_warn(card->dev, "Failed to set volume limit: %d\n", ret); + } + + return 0; +} + -+static int -+vc4_rcl_ms_surface_setup(struct vc4_exec_info *exec, -+ struct drm_gem_cma_object **obj, -+ struct drm_vc4_submit_rcl_surface *surf) -+{ -+ uint8_t tiling = VC4_GET_FIELD(surf->bits, -+ VC4_RENDER_CONFIG_MEMORY_FORMAT); -+ uint8_t format = VC4_GET_FIELD(surf->bits, -+ VC4_RENDER_CONFIG_FORMAT); -+ int cpp; -+ -+ if (surf->pad != 0) { -+ DRM_ERROR("Padding unset\n"); -+ return -EINVAL; -+ } ++static int snd_rpi_iqaudio_dac_hw_params(struct snd_pcm_substream *substream, ++ struct snd_pcm_hw_params *params) ++{ ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++// NOT USED struct snd_soc_dai *codec_dai = rtd->codec_dai; ++// NOT USED struct snd_soc_codec *codec = rtd->codec; ++ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; + -+ if (surf->bits & ~(VC4_RENDER_CONFIG_MEMORY_FORMAT_MASK | -+ VC4_RENDER_CONFIG_FORMAT_MASK)) { -+ DRM_ERROR("Unknown bits in render config: 0x%04x\n", -+ surf->bits); -+ return -EINVAL; -+ } ++ unsigned int sample_bits = ++ snd_pcm_format_physical_width(params_format(params)); + -+ if (surf->hindex == ~0) -+ return 0; ++ return snd_soc_dai_set_bclk_ratio(cpu_dai, sample_bits * 2); ++} + -+ if (!vc4_use_bo(exec, surf->hindex, VC4_MODE_RENDER, obj)) -+ return -EINVAL; ++/* machine stream operations */ ++static struct snd_soc_ops snd_rpi_iqaudio_dac_ops = { ++ .hw_params = snd_rpi_iqaudio_dac_hw_params, ++}; + -+ if (tiling > VC4_TILING_FORMAT_LT) { -+ DRM_ERROR("Bad tiling format\n"); -+ return -EINVAL; -+ } ++static struct snd_soc_dai_link snd_rpi_iqaudio_dac_dai[] = { ++{ ++ .cpu_dai_name = "bcm2708-i2s.0", ++ .codec_dai_name = "pcm512x-hifi", ++ .platform_name = "bcm2708-i2s.0", ++ .codec_name = "pcm512x.1-004c", ++ .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | ++ SND_SOC_DAIFMT_CBS_CFS, ++ .ops = &snd_rpi_iqaudio_dac_ops, ++ .init = snd_rpi_iqaudio_dac_init, ++}, ++}; + -+ switch (format) { -+ case VC4_RENDER_CONFIG_FORMAT_BGR565_DITHERED: -+ case VC4_RENDER_CONFIG_FORMAT_BGR565: -+ cpp = 2; -+ break; -+ case VC4_RENDER_CONFIG_FORMAT_RGBA8888: -+ cpp = 4; -+ break; -+ default: -+ DRM_ERROR("Bad tile buffer format\n"); -+ return -EINVAL; -+ } ++/* audio machine driver */ ++static struct snd_soc_card snd_rpi_iqaudio_dac = { ++ .owner = THIS_MODULE, ++ .dai_link = snd_rpi_iqaudio_dac_dai, ++ .num_links = ARRAY_SIZE(snd_rpi_iqaudio_dac_dai), ++}; + -+ if (!vc4_check_tex_size(exec, *obj, surf->offset, tiling, -+ exec->args->width, exec->args->height, cpp)) { -+ return -EINVAL; -+ } ++static int snd_rpi_iqaudio_dac_probe(struct platform_device *pdev) ++{ ++ int ret = 0; + -+ return 0; -+} ++ snd_rpi_iqaudio_dac.dev = &pdev->dev; + -+int vc4_get_rcl(struct drm_device *dev, struct vc4_exec_info *exec) -+{ -+ struct vc4_rcl_setup setup = {0}; -+ struct drm_vc4_submit_cl *args = exec->args; -+ bool has_bin = args->bin_cl_size != 0; -+ int ret; ++ if (pdev->dev.of_node) { ++ struct device_node *i2s_node; ++ struct snd_soc_card *card = &snd_rpi_iqaudio_dac; ++ struct snd_soc_dai_link *dai = &snd_rpi_iqaudio_dac_dai[0]; ++ i2s_node = of_parse_phandle(pdev->dev.of_node, ++ "i2s-controller", 0); + -+ if (args->min_x_tile > args->max_x_tile || -+ args->min_y_tile > args->max_y_tile) { -+ DRM_ERROR("Bad render tile set (%d,%d)-(%d,%d)\n", -+ args->min_x_tile, args->min_y_tile, -+ args->max_x_tile, args->max_y_tile); -+ return -EINVAL; -+ } ++ if (i2s_node) { ++ dai->cpu_dai_name = NULL; ++ dai->cpu_of_node = i2s_node; ++ dai->platform_name = NULL; ++ dai->platform_of_node = i2s_node; ++ } + -+ if (has_bin && -+ (args->max_x_tile > exec->bin_tiles_x || -+ args->max_y_tile > exec->bin_tiles_y)) { -+ DRM_ERROR("Render tiles (%d,%d) outside of bin config (%d,%d)\n", -+ args->max_x_tile, args->max_y_tile, -+ exec->bin_tiles_x, exec->bin_tiles_y); -+ return -EINVAL; ++ digital_gain_0db_limit = !of_property_read_bool(pdev->dev.of_node, ++ "iqaudio,24db_digital_gain"); ++ if (of_property_read_string(pdev->dev.of_node, "card_name", ++ &card->name)) ++ card->name = "IQaudIODAC"; ++ if (of_property_read_string(pdev->dev.of_node, "dai_name", ++ &dai->name)) ++ dai->name = "IQaudIO DAC"; ++ if (of_property_read_string(pdev->dev.of_node, "dai_stream_name", ++ &dai->stream_name)) ++ dai->stream_name = "IQaudIO DAC HiFi"; + } + -+ ret = vc4_rcl_surface_setup(exec, &setup.color_read, &args->color_read); ++ ret = snd_soc_register_card(&snd_rpi_iqaudio_dac); + if (ret) -+ return ret; ++ dev_err(&pdev->dev, ++ "snd_soc_register_card() failed: %d\n", ret); + -+ ret = vc4_rcl_ms_surface_setup(exec, &setup.color_ms_write, -+ &args->color_ms_write); -+ if (ret) -+ return ret; ++ return ret; ++} + -+ ret = vc4_rcl_surface_setup(exec, &setup.zs_read, &args->zs_read); -+ if (ret) -+ return ret; ++static int snd_rpi_iqaudio_dac_remove(struct platform_device *pdev) ++{ ++ return snd_soc_unregister_card(&snd_rpi_iqaudio_dac); ++} + -+ ret = vc4_rcl_surface_setup(exec, &setup.zs_write, &args->zs_write); -+ if (ret) -+ return ret; ++static const struct of_device_id iqaudio_of_match[] = { ++ { .compatible = "iqaudio,iqaudio-dac", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, iqaudio_of_match); + -+ /* We shouldn't even have the job submitted to us if there's no -+ * surface to write out. -+ */ -+ if (!setup.color_ms_write && !setup.zs_write) { -+ DRM_ERROR("RCL requires color or Z/S write\n"); -+ return -EINVAL; -+ } ++static struct platform_driver snd_rpi_iqaudio_dac_driver = { ++ .driver = { ++ .name = "snd-rpi-iqaudio-dac", ++ .owner = THIS_MODULE, ++ .of_match_table = iqaudio_of_match, ++ }, ++ .probe = snd_rpi_iqaudio_dac_probe, ++ .remove = snd_rpi_iqaudio_dac_remove, ++}; + -+ return vc4_create_rcl_bo(dev, exec, &setup); -+} -diff --git a/drivers/gpu/drm/vc4/vc4_trace.h b/drivers/gpu/drm/vc4/vc4_trace.h ++module_platform_driver(snd_rpi_iqaudio_dac_driver); ++ ++MODULE_AUTHOR("Florian Meier <florian.meier@koalo.de>"); ++MODULE_DESCRIPTION("ASoC Driver for IQAudio DAC"); ++MODULE_LICENSE("GPL v2"); + +From 51d3e7110c3e009d1f568a280f7645d0b44592d7 Mon Sep 17 00:00:00 2001 +From: popcornmix <popcornmix@gmail.com> +Date: Mon, 14 Jul 2014 22:02:09 +0100 +Subject: [PATCH 071/112] hid: Reduce default mouse polling interval to 60Hz + +Reduces overhead when using X +--- + drivers/hid/usbhid/hid-core.c | 10 +++++++--- + 1 file changed, 7 insertions(+), 3 deletions(-) + +diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c +index ae83af6..4a7af9d 100644 +--- a/drivers/hid/usbhid/hid-core.c ++++ b/drivers/hid/usbhid/hid-core.c +@@ -49,7 +49,7 @@ + * Module parameters. + */ + +-static unsigned int hid_mousepoll_interval; ++static unsigned int hid_mousepoll_interval = ~0; + module_param_named(mousepoll, hid_mousepoll_interval, uint, 0644); + MODULE_PARM_DESC(mousepoll, "Polling interval of mice"); + +@@ -1083,8 +1083,12 @@ static int usbhid_start(struct hid_device *hid) + } + + /* Change the polling interval of mice. */ +- if (hid->collection->usage == HID_GD_MOUSE && hid_mousepoll_interval > 0) +- interval = hid_mousepoll_interval; ++ if (hid->collection->usage == HID_GD_MOUSE) { ++ if (hid_mousepoll_interval == ~0 && interval < 16) ++ interval = 16; ++ else if (hid_mousepoll_interval != ~0 && hid_mousepoll_interval != 0) ++ interval = hid_mousepoll_interval; ++ } + + ret = -ENOMEM; + if (usb_endpoint_dir_in(endpoint)) { + +From 6b4093df74895715c00c4a7f3d364ef2bc02421d Mon Sep 17 00:00:00 2001 +From: Daniel Matuschek <info@crazy-audio.com> +Date: Mon, 4 Aug 2014 10:06:56 +0200 +Subject: [PATCH 072/112] Added support for HiFiBerry DAC+ + +The driver is based on the HiFiBerry DAC driver. However HiFiBerry DAC+ uses +a different codec chip (PCM5122), therefore a new driver is necessary. + +Add support for the HiFiBerry DAC+ Pro. + +The HiFiBerry DAC+ and DAC+ Pro products both use the existing bcm sound driver with the DAC+ Pro having a special clock device driver representing the two high precision oscillators. + +An addition bug fix is included for the PCM512x codec where by the physical size of the sample frame is used in the calculation of the LRCK divisor as it was found to be wrong when using 24-bit depth sample contained in a little endian 4-byte sample frame. + +Limit PCM512x "Digital" gain to 0dB by default with HiFiBerry DAC+ + +24db_digital_gain DT param can be used to specify that PCM512x +codec "Digital" volume control should not be limited to 0dB gain, +and if specified will allow the full 24dB gain. + +Add dt param to force HiFiBerry DAC+ Pro into slave mode + +"dtoverlay=hifiberry-dacplus,slave" + +Add 'slave' param to use HiFiBerry DAC+ Pro in slave mode, +with Pi as master for bit and frame clock. + +Signed-off-by: DigitalDreamtime <clive.messer@digitaldreamtime.co.uk> +--- + drivers/clk/Makefile | 1 + + drivers/clk/clk-hifiberry-dacpro.c | 160 +++++++++++++++++ + sound/soc/bcm/Kconfig | 7 + + sound/soc/bcm/Makefile | 2 + + sound/soc/bcm/hifiberry_dacplus.c | 358 +++++++++++++++++++++++++++++++++++++ + sound/soc/codecs/pcm512x.c | 3 +- + 6 files changed, 530 insertions(+), 1 deletion(-) + create mode 100644 drivers/clk/clk-hifiberry-dacpro.c + create mode 100644 sound/soc/bcm/hifiberry_dacplus.c + +diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile +index 46869d6..a202e6f 100644 +--- a/drivers/clk/Makefile ++++ b/drivers/clk/Makefile +@@ -25,6 +25,7 @@ obj-$(CONFIG_COMMON_CLK_CS2000_CP) += clk-cs2000-cp.o + obj-$(CONFIG_ARCH_CLPS711X) += clk-clps711x.o + obj-$(CONFIG_ARCH_EFM32) += clk-efm32gg.o + obj-$(CONFIG_ARCH_HIGHBANK) += clk-highbank.o ++obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS) += clk-hifiberry-dacpro.o + obj-$(CONFIG_MACH_LOONGSON32) += clk-ls1x.o + obj-$(CONFIG_COMMON_CLK_MAX_GEN) += clk-max-gen.o + obj-$(CONFIG_COMMON_CLK_MAX77686) += clk-max77686.o +diff --git a/drivers/clk/clk-hifiberry-dacpro.c b/drivers/clk/clk-hifiberry-dacpro.c new file mode 100644 -index 0000000..ad7b1ea +index 0000000..3e35d45 --- /dev/null -+++ b/drivers/gpu/drm/vc4/vc4_trace.h -@@ -0,0 +1,63 @@ ++++ b/drivers/clk/clk-hifiberry-dacpro.c +@@ -0,0 +1,160 @@ +/* -+ * Copyright (C) 2015 Broadcom ++ * Clock Driver for HiFiBerry DAC Pro + * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 as -+ * published by the Free Software Foundation. ++ * Author: Stuart MacLean ++ * Copyright 2015 ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * version 2 as published by the Free Software Foundation. ++ * ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * General Public License for more details. + */ + -+#if !defined(_VC4_TRACE_H_) || defined(TRACE_HEADER_MULTI_READ) -+#define _VC4_TRACE_H_ -+ -+#include <linux/stringify.h> -+#include <linux/types.h> -+#include <linux/tracepoint.h> -+ -+#undef TRACE_SYSTEM -+#define TRACE_SYSTEM vc4 -+#define TRACE_INCLUDE_FILE vc4_trace -+ -+TRACE_EVENT(vc4_wait_for_seqno_begin, -+ TP_PROTO(struct drm_device *dev, uint64_t seqno, uint64_t timeout), -+ TP_ARGS(dev, seqno, timeout), -+ -+ TP_STRUCT__entry( -+ __field(u32, dev) -+ __field(u64, seqno) -+ __field(u64, timeout) -+ ), -+ -+ TP_fast_assign( -+ __entry->dev = dev->primary->index; -+ __entry->seqno = seqno; -+ __entry->timeout = timeout; -+ ), -+ -+ TP_printk("dev=%u, seqno=%llu, timeout=%llu", -+ __entry->dev, __entry->seqno, __entry->timeout) -+); -+ -+TRACE_EVENT(vc4_wait_for_seqno_end, -+ TP_PROTO(struct drm_device *dev, uint64_t seqno), -+ TP_ARGS(dev, seqno), -+ -+ TP_STRUCT__entry( -+ __field(u32, dev) -+ __field(u64, seqno) -+ ), -+ -+ TP_fast_assign( -+ __entry->dev = dev->primary->index; -+ __entry->seqno = seqno; -+ ), -+ -+ TP_printk("dev=%u, seqno=%llu", -+ __entry->dev, __entry->seqno) -+); ++#include <linux/clk-provider.h> ++#include <linux/clkdev.h> ++#include <linux/kernel.h> ++#include <linux/module.h> ++#include <linux/of.h> ++#include <linux/slab.h> ++#include <linux/platform_device.h> + -+#endif /* _VC4_TRACE_H_ */ ++/* Clock rate of CLK44EN attached to GPIO6 pin */ ++#define CLK_44EN_RATE 22579200UL ++/* Clock rate of CLK48EN attached to GPIO3 pin */ ++#define CLK_48EN_RATE 24576000UL + -+/* This part must be outside protection */ -+#undef TRACE_INCLUDE_PATH -+#define TRACE_INCLUDE_PATH . -+#include <trace/define_trace.h> -diff --git a/drivers/gpu/drm/vc4/vc4_trace_points.c b/drivers/gpu/drm/vc4/vc4_trace_points.c -new file mode 100644 -index 0000000..e6278f2 ---- /dev/null -+++ b/drivers/gpu/drm/vc4/vc4_trace_points.c -@@ -0,0 +1,14 @@ -+/* -+ * Copyright (C) 2015 Broadcom -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 as -+ * published by the Free Software Foundation. ++/** ++ * struct hifiberry_dacpro_clk - Common struct to the HiFiBerry DAC Pro ++ * @hw: clk_hw for the common clk framework ++ * @mode: 0 => CLK44EN, 1 => CLK48EN + */ ++struct clk_hifiberry_hw { ++ struct clk_hw hw; ++ uint8_t mode; ++}; + -+#include "vc4_drv.h" ++#define to_hifiberry_clk(_hw) container_of(_hw, struct clk_hifiberry_hw, hw) + -+#ifndef __CHECKER__ -+#define CREATE_TRACE_POINTS -+#include "vc4_trace.h" -+#endif -diff --git a/drivers/gpu/drm/vc4/vc4_v3d.c b/drivers/gpu/drm/vc4/vc4_v3d.c -new file mode 100644 -index 0000000..b9cb7cf ---- /dev/null -+++ b/drivers/gpu/drm/vc4/vc4_v3d.c -@@ -0,0 +1,268 @@ -+/* -+ * Copyright (c) 2014 The Linux Foundation. All rights reserved. -+ * Copyright (C) 2013 Red Hat -+ * Author: Rob Clark <robdclark@gmail.com> -+ * -+ * This program is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License version 2 as published by -+ * the Free Software Foundation. -+ * -+ * This program is distributed in the hope that it will be useful, but WITHOUT -+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -+ * more details. -+ * -+ * You should have received a copy of the GNU General Public License along with -+ * this program. If not, see <http://www.gnu.org/licenses/>. -+ */ ++static const struct of_device_id clk_hifiberry_dacpro_dt_ids[] = { ++ { .compatible = "hifiberry,dacpro-clk",}, ++ { } ++}; ++MODULE_DEVICE_TABLE(of, clk_hifiberry_dacpro_dt_ids); + -+#include "linux/component.h" -+#include "soc/bcm2835/raspberrypi-firmware.h" -+#include "vc4_drv.h" -+#include "vc4_regs.h" ++static unsigned long clk_hifiberry_dacpro_recalc_rate(struct clk_hw *hw, ++ unsigned long parent_rate) ++{ ++ return (to_hifiberry_clk(hw)->mode == 0) ? CLK_44EN_RATE : ++ CLK_48EN_RATE; ++} + -+#ifdef CONFIG_DEBUG_FS -+#define REGDEF(reg) { reg, #reg } -+static const struct { -+ uint32_t reg; -+ const char *name; -+} vc4_reg_defs[] = { -+ REGDEF(V3D_IDENT0), -+ REGDEF(V3D_IDENT1), -+ REGDEF(V3D_IDENT2), -+ REGDEF(V3D_SCRATCH), -+ REGDEF(V3D_L2CACTL), -+ REGDEF(V3D_SLCACTL), -+ REGDEF(V3D_INTCTL), -+ REGDEF(V3D_INTENA), -+ REGDEF(V3D_INTDIS), -+ REGDEF(V3D_CT0CS), -+ REGDEF(V3D_CT1CS), -+ REGDEF(V3D_CT0EA), -+ REGDEF(V3D_CT1EA), -+ REGDEF(V3D_CT0CA), -+ REGDEF(V3D_CT1CA), -+ REGDEF(V3D_CT00RA0), -+ REGDEF(V3D_CT01RA0), -+ REGDEF(V3D_CT0LC), -+ REGDEF(V3D_CT1LC), -+ REGDEF(V3D_CT0PC), -+ REGDEF(V3D_CT1PC), -+ REGDEF(V3D_PCS), -+ REGDEF(V3D_BFC), -+ REGDEF(V3D_RFC), -+ REGDEF(V3D_BPCA), -+ REGDEF(V3D_BPCS), -+ REGDEF(V3D_BPOA), -+ REGDEF(V3D_BPOS), -+ REGDEF(V3D_BXCF), -+ REGDEF(V3D_SQRSV0), -+ REGDEF(V3D_SQRSV1), -+ REGDEF(V3D_SQCNTL), -+ REGDEF(V3D_SRQPC), -+ REGDEF(V3D_SRQUA), -+ REGDEF(V3D_SRQUL), -+ REGDEF(V3D_SRQCS), -+ REGDEF(V3D_VPACNTL), -+ REGDEF(V3D_VPMBASE), -+ REGDEF(V3D_PCTRC), -+ REGDEF(V3D_PCTRE), -+ REGDEF(V3D_PCTR0), -+ REGDEF(V3D_PCTRS0), -+ REGDEF(V3D_PCTR1), -+ REGDEF(V3D_PCTRS1), -+ REGDEF(V3D_PCTR2), -+ REGDEF(V3D_PCTRS2), -+ REGDEF(V3D_PCTR3), -+ REGDEF(V3D_PCTRS3), -+ REGDEF(V3D_PCTR4), -+ REGDEF(V3D_PCTRS4), -+ REGDEF(V3D_PCTR5), -+ REGDEF(V3D_PCTRS5), -+ REGDEF(V3D_PCTR6), -+ REGDEF(V3D_PCTRS6), -+ REGDEF(V3D_PCTR7), -+ REGDEF(V3D_PCTRS7), -+ REGDEF(V3D_PCTR8), -+ REGDEF(V3D_PCTRS8), -+ REGDEF(V3D_PCTR9), -+ REGDEF(V3D_PCTRS9), -+ REGDEF(V3D_PCTR10), -+ REGDEF(V3D_PCTRS10), -+ REGDEF(V3D_PCTR11), -+ REGDEF(V3D_PCTRS11), -+ REGDEF(V3D_PCTR12), -+ REGDEF(V3D_PCTRS12), -+ REGDEF(V3D_PCTR13), -+ REGDEF(V3D_PCTRS13), -+ REGDEF(V3D_PCTR14), -+ REGDEF(V3D_PCTRS14), -+ REGDEF(V3D_PCTR15), -+ REGDEF(V3D_PCTRS15), -+ REGDEF(V3D_BGE), -+ REGDEF(V3D_FDBGO), -+ REGDEF(V3D_FDBGB), -+ REGDEF(V3D_FDBGR), -+ REGDEF(V3D_FDBGS), -+ REGDEF(V3D_ERRSTAT), -+}; -+ -+int vc4_v3d_debugfs_regs(struct seq_file *m, void *unused) -+{ -+ struct drm_info_node *node = (struct drm_info_node *) m->private; -+ struct drm_device *dev = node->minor->dev; -+ struct vc4_dev *vc4 = to_vc4_dev(dev); -+ int i; ++static long clk_hifiberry_dacpro_round_rate(struct clk_hw *hw, ++ unsigned long rate, unsigned long *parent_rate) ++{ ++ long actual_rate; ++ ++ if (rate <= CLK_44EN_RATE) { ++ actual_rate = (long)CLK_44EN_RATE; ++ } else if (rate >= CLK_48EN_RATE) { ++ actual_rate = (long)CLK_48EN_RATE; ++ } else { ++ long diff44Rate = (long)(rate - CLK_44EN_RATE); ++ long diff48Rate = (long)(CLK_48EN_RATE - rate); + -+ for (i = 0; i < ARRAY_SIZE(vc4_reg_defs); i++) { -+ seq_printf(m, "%s (0x%04x): 0x%08x\n", -+ vc4_reg_defs[i].name, vc4_reg_defs[i].reg, -+ V3D_READ(vc4_reg_defs[i].reg)); ++ if (diff44Rate < diff48Rate) ++ actual_rate = (long)CLK_44EN_RATE; ++ else ++ actual_rate = (long)CLK_48EN_RATE; + } -+ -+ return 0; ++ return actual_rate; +} + -+int vc4_v3d_debugfs_ident(struct seq_file *m, void *unused) -+{ -+ struct drm_info_node *node = (struct drm_info_node *) m->private; -+ struct drm_device *dev = node->minor->dev; -+ struct vc4_dev *vc4 = to_vc4_dev(dev); -+ uint32_t ident1 = V3D_READ(V3D_IDENT1); -+ uint32_t nslc = VC4_GET_FIELD(ident1, V3D_IDENT1_NSLC); -+ uint32_t tups = VC4_GET_FIELD(ident1, V3D_IDENT1_TUPS); -+ uint32_t qups = VC4_GET_FIELD(ident1, V3D_IDENT1_QUPS); -+ -+ seq_printf(m, "Revision: %d\n", VC4_GET_FIELD(ident1, V3D_IDENT1_REV)); -+ seq_printf(m, "Slices: %d\n", nslc); -+ seq_printf(m, "TMUs: %d\n", nslc * tups); -+ seq_printf(m, "QPUs: %d\n", nslc * qups); -+ seq_printf(m, "Semaphores: %d\n", VC4_GET_FIELD(ident1, V3D_IDENT1_NSEM)); -+ -+ return 0; -+} -+#endif /* CONFIG_DEBUG_FS */ + -+/* -+ * Asks the firmware to turn on power to the V3D engine. -+ * -+ * This may be doable with just the clocks interface, though this -+ * packet does some other register setup from the firmware, too. -+ */ -+int -+vc4_v3d_set_power(struct vc4_dev *vc4, bool on) ++static int clk_hifiberry_dacpro_set_rate(struct clk_hw *hw, ++ unsigned long rate, unsigned long parent_rate) +{ -+ u32 packet = on; ++ unsigned long actual_rate; ++ struct clk_hifiberry_hw *clk = to_hifiberry_clk(hw); + -+ return rpi_firmware_property(vc4->firmware, -+ RPI_FIRMWARE_SET_ENABLE_QPU, -+ &packet, sizeof(packet)); ++ actual_rate = (unsigned long)clk_hifiberry_dacpro_round_rate(hw, rate, ++ &parent_rate); ++ clk->mode = (actual_rate == CLK_44EN_RATE) ? 0 : 1; ++ return 0; +} + -+static void vc4_v3d_init_hw(struct drm_device *dev) -+{ -+ struct vc4_dev *vc4 = to_vc4_dev(dev); + -+ /* Take all the memory that would have been reserved for user -+ * QPU programs, since we don't have an interface for running -+ * them, anyway. -+ */ -+ V3D_WRITE(V3D_VPMBASE, 0); -+} ++const struct clk_ops clk_hifiberry_dacpro_rate_ops = { ++ .recalc_rate = clk_hifiberry_dacpro_recalc_rate, ++ .round_rate = clk_hifiberry_dacpro_round_rate, ++ .set_rate = clk_hifiberry_dacpro_set_rate, ++}; + -+static int vc4_v3d_bind(struct device *dev, struct device *master, void *data) ++static int clk_hifiberry_dacpro_probe(struct platform_device *pdev) +{ -+ struct platform_device *pdev = to_platform_device(dev); -+ struct drm_device *drm = dev_get_drvdata(master); -+ struct vc4_dev *vc4 = to_vc4_dev(drm); -+ struct vc4_v3d *v3d = NULL; + int ret; ++ struct clk_hifiberry_hw *proclk; ++ struct clk *clk; ++ struct device *dev; ++ struct clk_init_data init; + -+ v3d = devm_kzalloc(&pdev->dev, sizeof(*v3d), GFP_KERNEL); -+ if (!v3d) -+ return -ENOMEM; -+ -+ v3d->pdev = pdev; -+ -+ v3d->regs = vc4_ioremap_regs(pdev, 0); -+ if (IS_ERR(v3d->regs)) -+ return PTR_ERR(v3d->regs); -+ -+ vc4->v3d = v3d; -+ -+ ret = vc4_v3d_set_power(vc4, true); -+ if (ret) -+ return ret; ++ dev = &pdev->dev; + -+ if (V3D_READ(V3D_IDENT0) != V3D_EXPECTED_IDENT0) { -+ DRM_ERROR("V3D_IDENT0 read 0x%08x instead of 0x%08x\n", -+ V3D_READ(V3D_IDENT0), V3D_EXPECTED_IDENT0); -+ return -EINVAL; -+ } ++ proclk = kzalloc(sizeof(struct clk_hifiberry_hw), GFP_KERNEL); ++ if (!proclk) ++ return -ENOMEM; + -+ /* Reset the binner overflow address/size at setup, to be sure -+ * we don't reuse an old one. -+ */ -+ V3D_WRITE(V3D_BPOA, 0); -+ V3D_WRITE(V3D_BPOS, 0); ++ init.name = "clk-hifiberry-dacpro"; ++ init.ops = &clk_hifiberry_dacpro_rate_ops; ++ init.flags = CLK_IS_ROOT | CLK_IS_BASIC; ++ init.parent_names = NULL; ++ init.num_parents = 0; + -+ vc4_v3d_init_hw(drm); ++ proclk->mode = 0; ++ proclk->hw.init = &init; + -+ ret = drm_irq_install(drm, platform_get_irq(pdev, 0)); -+ if (ret) { -+ DRM_ERROR("Failed to install IRQ handler\n"); -+ return ret; ++ clk = devm_clk_register(dev, &proclk->hw); ++ if (!IS_ERR(clk)) { ++ ret = of_clk_add_provider(dev->of_node, of_clk_src_simple_get, ++ clk); ++ } else { ++ dev_err(dev, "Fail to register clock driver\n"); ++ kfree(proclk); ++ ret = PTR_ERR(clk); + } -+ -+ return 0; ++ return ret; +} + -+static void vc4_v3d_unbind(struct device *dev, struct device *master, -+ void *data) ++static int clk_hifiberry_dacpro_remove(struct platform_device *pdev) +{ -+ struct drm_device *drm = dev_get_drvdata(master); -+ struct vc4_dev *vc4 = to_vc4_dev(drm); -+ -+ drm_irq_uninstall(drm); -+ -+ /* Disable the binner's overflow memory address, so the next -+ * driver probe (if any) doesn't try to reuse our old -+ * allocation. -+ */ -+ V3D_WRITE(V3D_BPOA, 0); -+ V3D_WRITE(V3D_BPOS, 0); -+ -+ vc4_v3d_set_power(vc4, false); -+ -+ vc4->v3d = NULL; ++ of_clk_del_provider(pdev->dev.of_node); ++ return 0; +} + -+static const struct component_ops vc4_v3d_ops = { -+ .bind = vc4_v3d_bind, -+ .unbind = vc4_v3d_unbind, ++static struct platform_driver clk_hifiberry_dacpro_driver = { ++ .probe = clk_hifiberry_dacpro_probe, ++ .remove = clk_hifiberry_dacpro_remove, ++ .driver = { ++ .name = "clk-hifiberry-dacpro", ++ .of_match_table = clk_hifiberry_dacpro_dt_ids, ++ }, +}; + -+static int vc4_v3d_dev_probe(struct platform_device *pdev) ++static int __init clk_hifiberry_dacpro_init(void) +{ -+ return component_add(&pdev->dev, &vc4_v3d_ops); ++ return platform_driver_register(&clk_hifiberry_dacpro_driver); +} ++core_initcall(clk_hifiberry_dacpro_init); + -+static int vc4_v3d_dev_remove(struct platform_device *pdev) ++static void __exit clk_hifiberry_dacpro_exit(void) +{ -+ component_del(&pdev->dev, &vc4_v3d_ops); -+ return 0; ++ platform_driver_unregister(&clk_hifiberry_dacpro_driver); +} ++module_exit(clk_hifiberry_dacpro_exit); + -+static const struct of_device_id vc4_v3d_dt_match[] = { -+ { .compatible = "brcm,vc4-v3d" }, -+ {} -+}; ++MODULE_DESCRIPTION("HiFiBerry DAC Pro clock driver"); ++MODULE_LICENSE("GPL v2"); ++MODULE_ALIAS("platform:clk-hifiberry-dacpro"); +diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig +index 38dcdd9..8c338b5 100644 +--- a/sound/soc/bcm/Kconfig ++++ b/sound/soc/bcm/Kconfig +@@ -15,6 +15,13 @@ config SND_BCM2708_SOC_HIFIBERRY_DAC + help + Say Y or M if you want to add support for HifiBerry DAC. + ++config SND_BCM2708_SOC_HIFIBERRY_DACPLUS ++ tristate "Support for HifiBerry DAC+" ++ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S ++ select SND_SOC_PCM512x ++ help ++ Say Y or M if you want to add support for HifiBerry DAC+. + -+struct platform_driver vc4_v3d_driver = { -+ .probe = vc4_v3d_dev_probe, -+ .remove = vc4_v3d_dev_remove, -+ .driver = { -+ .name = "vc4_v3d", -+ .of_match_table = vc4_v3d_dt_match, -+ }, -+}; -diff --git a/drivers/gpu/drm/vc4/vc4_validate.c b/drivers/gpu/drm/vc4/vc4_validate.c + config SND_BCM2708_SOC_HIFIBERRY_DIGI + tristate "Support for HifiBerry Digi" + depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S +diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile +index 08e4dc5..a29538e 100644 +--- a/sound/soc/bcm/Makefile ++++ b/sound/soc/bcm/Makefile +@@ -5,11 +5,13 @@ obj-$(CONFIG_SND_BCM2835_SOC_I2S) += snd-soc-bcm2835-i2s.o + + # BCM2708 Machine Support + snd-soc-hifiberry-dac-objs := hifiberry_dac.o ++snd-soc-hifiberry-dacplus-objs := hifiberry_dacplus.o + snd-soc-hifiberry-digi-objs := hifiberry_digi.o + snd-soc-rpi-dac-objs := rpi-dac.o + snd-soc-iqaudio-dac-objs := iqaudio-dac.o + + obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o ++obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS) += snd-soc-hifiberry-dacplus.o + obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI) += snd-soc-hifiberry-digi.o + obj-$(CONFIG_SND_BCM2708_SOC_RPI_DAC) += snd-soc-rpi-dac.o + obj-$(CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC) += snd-soc-iqaudio-dac.o +diff --git a/sound/soc/bcm/hifiberry_dacplus.c b/sound/soc/bcm/hifiberry_dacplus.c new file mode 100644 -index 0000000..ff3b62f +index 0000000..6560067 --- /dev/null -+++ b/drivers/gpu/drm/vc4/vc4_validate.c -@@ -0,0 +1,958 @@ ++++ b/sound/soc/bcm/hifiberry_dacplus.c +@@ -0,0 +1,358 @@ +/* -+ * Copyright © 2014 Broadcom ++ * ASoC Driver for HiFiBerry DAC+ / DAC Pro + * -+ * Permission is hereby granted, free of charge, to any person obtaining a -+ * copy of this software and associated documentation files (the "Software"), -+ * to deal in the Software without restriction, including without limitation -+ * the rights to use, copy, modify, merge, publish, distribute, sublicense, -+ * and/or sell copies of the Software, and to permit persons to whom the -+ * Software is furnished to do so, subject to the following conditions: ++ * Author: Daniel Matuschek, Stuart MacLean <stuart@hifiberry.com> ++ * Copyright 2014-2015 ++ * based on code by Florian Meier <florian.meier@koalo.de> + * -+ * The above copyright notice and this permission notice (including the next -+ * paragraph) shall be included in all copies or substantial portions of the -+ * Software. ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * version 2 as published by the Free Software Foundation. + * -+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -+ * IN THE SOFTWARE. ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * General Public License for more details. + */ + -+/** -+ * Command list validator for VC4. -+ * -+ * The VC4 has no IOMMU between it and system memory. So, a user with -+ * access to execute command lists could escalate privilege by -+ * overwriting system memory (drawing to it as a framebuffer) or -+ * reading system memory it shouldn't (reading it as a texture, or -+ * uniform data, or vertex data). -+ * -+ * This validates command lists to ensure that all accesses are within -+ * the bounds of the GEM objects referenced. It explicitly whitelists -+ * packets, and looks at the offsets in any address fields to make -+ * sure they're constrained within the BOs they reference. -+ * -+ * Note that because of the validation that's happening anyway, this -+ * is where GEM relocation processing happens. -+ */ ++#include <linux/module.h> ++#include <linux/platform_device.h> ++#include <linux/kernel.h> ++#include <linux/clk.h> ++#include <linux/kernel.h> ++#include <linux/module.h> ++#include <linux/of.h> ++#include <linux/slab.h> ++#include <linux/delay.h> ++ ++#include <sound/core.h> ++#include <sound/pcm.h> ++#include <sound/pcm_params.h> ++#include <sound/soc.h> ++#include <sound/jack.h> + -+#include "uapi/drm/vc4_drm.h" -+#include "vc4_drv.h" -+#include "vc4_packet.h" ++#include "../codecs/pcm512x.h" + -+#define VALIDATE_ARGS \ -+ struct vc4_exec_info *exec, \ -+ void *validated, \ -+ void *untrusted ++#define HIFIBERRY_DACPRO_NOCLOCK 0 ++#define HIFIBERRY_DACPRO_CLK44EN 1 ++#define HIFIBERRY_DACPRO_CLK48EN 2 + ++struct pcm512x_priv { ++ struct regmap *regmap; ++ struct clk *sclk; ++}; + -+/** Return the width in pixels of a 64-byte microtile. */ -+static uint32_t -+utile_width(int cpp) -+{ -+ switch (cpp) { -+ case 1: -+ case 2: -+ return 8; -+ case 4: -+ return 4; -+ case 8: -+ return 2; -+ default: -+ DRM_ERROR("unknown cpp: %d\n", cpp); -+ return 1; -+ } -+} ++/* Clock rate of CLK44EN attached to GPIO6 pin */ ++#define CLK_44EN_RATE 22579200UL ++/* Clock rate of CLK48EN attached to GPIO3 pin */ ++#define CLK_48EN_RATE 24576000UL ++ ++static bool slave; ++static bool snd_rpi_hifiberry_is_dacpro; ++static bool digital_gain_0db_limit = true; + -+/** Return the height in pixels of a 64-byte microtile. */ -+static uint32_t -+utile_height(int cpp) ++static void snd_rpi_hifiberry_dacplus_select_clk(struct snd_soc_codec *codec, ++ int clk_id) +{ -+ switch (cpp) { -+ case 1: -+ return 8; -+ case 2: -+ case 4: -+ case 8: -+ return 4; -+ default: -+ DRM_ERROR("unknown cpp: %d\n", cpp); -+ return 1; ++ switch (clk_id) { ++ case HIFIBERRY_DACPRO_NOCLOCK: ++ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x24, 0x00); ++ break; ++ case HIFIBERRY_DACPRO_CLK44EN: ++ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x24, 0x20); ++ break; ++ case HIFIBERRY_DACPRO_CLK48EN: ++ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x24, 0x04); ++ break; + } +} + -+/** -+ * The texture unit decides what tiling format a particular miplevel is using -+ * this function, so we lay out our miptrees accordingly. -+ */ -+static bool -+size_is_lt(uint32_t width, uint32_t height, int cpp) ++static void snd_rpi_hifiberry_dacplus_clk_gpio(struct snd_soc_codec *codec) +{ -+ return (width <= 4 * utile_width(cpp) || -+ height <= 4 * utile_height(cpp)); ++ snd_soc_update_bits(codec, PCM512x_GPIO_EN, 0x24, 0x24); ++ snd_soc_update_bits(codec, PCM512x_GPIO_OUTPUT_3, 0x0f, 0x02); ++ snd_soc_update_bits(codec, PCM512x_GPIO_OUTPUT_6, 0x0f, 0x02); +} + -+bool -+vc4_use_bo(struct vc4_exec_info *exec, -+ uint32_t hindex, -+ enum vc4_bo_mode mode, -+ struct drm_gem_cma_object **obj) ++static bool snd_rpi_hifiberry_dacplus_is_sclk(struct snd_soc_codec *codec) +{ -+ *obj = NULL; -+ -+ if (hindex >= exec->bo_count) { -+ DRM_ERROR("BO index %d greater than BO count %d\n", -+ hindex, exec->bo_count); -+ return false; -+ } -+ -+ if (exec->bo[hindex].mode != mode) { -+ if (exec->bo[hindex].mode == VC4_MODE_UNDECIDED) { -+ exec->bo[hindex].mode = mode; -+ } else { -+ DRM_ERROR("BO index %d reused with mode %d vs %d\n", -+ hindex, exec->bo[hindex].mode, mode); -+ return false; -+ } -+ } ++ int sck; + -+ *obj = exec->bo[hindex].bo; -+ return true; ++ sck = snd_soc_read(codec, PCM512x_RATE_DET_4); ++ return (!(sck & 0x40)); +} + -+static bool -+vc4_use_handle(struct vc4_exec_info *exec, -+ uint32_t gem_handles_packet_index, -+ enum vc4_bo_mode mode, -+ struct drm_gem_cma_object **obj) ++static bool snd_rpi_hifiberry_dacplus_is_sclk_sleep( ++ struct snd_soc_codec *codec) +{ -+ return vc4_use_bo(exec, exec->bo_index[gem_handles_packet_index], -+ mode, obj); ++ msleep(2); ++ return snd_rpi_hifiberry_dacplus_is_sclk(codec); +} + -+static uint32_t -+gl_shader_rec_size(uint32_t pointer_bits) ++static bool snd_rpi_hifiberry_dacplus_is_pro_card(struct snd_soc_codec *codec) +{ -+ uint32_t attribute_count = pointer_bits & 7; -+ bool extended = pointer_bits & 8; ++ bool isClk44EN, isClk48En, isNoClk; + -+ if (attribute_count == 0) -+ attribute_count = 8; ++ snd_rpi_hifiberry_dacplus_clk_gpio(codec); + -+ if (extended) -+ return 100 + attribute_count * 4; -+ else -+ return 36 + attribute_count * 8; ++ snd_rpi_hifiberry_dacplus_select_clk(codec, HIFIBERRY_DACPRO_CLK44EN); ++ isClk44EN = snd_rpi_hifiberry_dacplus_is_sclk_sleep(codec); ++ ++ snd_rpi_hifiberry_dacplus_select_clk(codec, HIFIBERRY_DACPRO_NOCLOCK); ++ isNoClk = snd_rpi_hifiberry_dacplus_is_sclk_sleep(codec); ++ ++ snd_rpi_hifiberry_dacplus_select_clk(codec, HIFIBERRY_DACPRO_CLK48EN); ++ isClk48En = snd_rpi_hifiberry_dacplus_is_sclk_sleep(codec); ++ ++ return (isClk44EN && isClk48En && !isNoClk); +} + -+bool -+vc4_check_tex_size(struct vc4_exec_info *exec, struct drm_gem_cma_object *fbo, -+ uint32_t offset, uint8_t tiling_format, -+ uint32_t width, uint32_t height, uint8_t cpp) ++static int snd_rpi_hifiberry_dacplus_clk_for_rate(int sample_rate) +{ -+ uint32_t aligned_width, aligned_height, stride, size; -+ uint32_t utile_w = utile_width(cpp); -+ uint32_t utile_h = utile_height(cpp); -+ -+ /* The shaded vertex format stores signed 12.4 fixed point -+ * (-2048,2047) offsets from the viewport center, so we should -+ * never have a render target larger than 4096. The texture -+ * unit can only sample from 2048x2048, so it's even more -+ * restricted. This lets us avoid worrying about overflow in -+ * our math. -+ */ -+ if (width > 4096 || height > 4096) { -+ DRM_ERROR("Surface dimesions (%d,%d) too large", width, height); -+ return false; -+ } ++ int type; + -+ switch (tiling_format) { -+ case VC4_TILING_FORMAT_LINEAR: -+ aligned_width = round_up(width, utile_w); -+ aligned_height = height; -+ break; -+ case VC4_TILING_FORMAT_T: -+ aligned_width = round_up(width, utile_w * 8); -+ aligned_height = round_up(height, utile_h * 8); -+ break; -+ case VC4_TILING_FORMAT_LT: -+ aligned_width = round_up(width, utile_w); -+ aligned_height = round_up(height, utile_h); ++ switch (sample_rate) { ++ case 11025: ++ case 22050: ++ case 44100: ++ case 88200: ++ case 176400: ++ type = HIFIBERRY_DACPRO_CLK44EN; + break; + default: -+ DRM_ERROR("buffer tiling %d unsupported\n", tiling_format); -+ return false; -+ } -+ -+ stride = aligned_width * cpp; -+ size = stride * aligned_height; -+ -+ if (size + offset < size || -+ size + offset > fbo->base.size) { -+ DRM_ERROR("Overflow in %dx%d (%dx%d) fbo size (%d + %d > %d)\n", -+ width, height, -+ aligned_width, aligned_height, -+ size, offset, fbo->base.size); -+ return false; ++ type = HIFIBERRY_DACPRO_CLK48EN; ++ break; + } -+ -+ return true; ++ return type; +} + -+static int -+validate_flush_all(VALIDATE_ARGS) ++static void snd_rpi_hifiberry_dacplus_set_sclk(struct snd_soc_codec *codec, ++ int sample_rate) +{ -+ if (exec->found_increment_semaphore_packet) { -+ DRM_ERROR("VC4_PACKET_FLUSH_ALL after " -+ "VC4_PACKET_INCREMENT_SEMAPHORE\n"); -+ return -EINVAL; -+ } -+ -+ return 0; -+} ++ struct pcm512x_priv *pcm512x = snd_soc_codec_get_drvdata(codec); + -+static int -+validate_start_tile_binning(VALIDATE_ARGS) -+{ -+ if (exec->found_start_tile_binning_packet) { -+ DRM_ERROR("Duplicate VC4_PACKET_START_TILE_BINNING\n"); -+ return -EINVAL; -+ } -+ exec->found_start_tile_binning_packet = true; ++ if (!IS_ERR(pcm512x->sclk)) { ++ int ctype; + -+ if (!exec->found_tile_binning_mode_config_packet) { -+ DRM_ERROR("missing VC4_PACKET_TILE_BINNING_MODE_CONFIG\n"); -+ return -EINVAL; ++ ctype = snd_rpi_hifiberry_dacplus_clk_for_rate(sample_rate); ++ clk_set_rate(pcm512x->sclk, (ctype == HIFIBERRY_DACPRO_CLK44EN) ++ ? CLK_44EN_RATE : CLK_48EN_RATE); ++ snd_rpi_hifiberry_dacplus_select_clk(codec, ctype); + } -+ -+ return 0; +} + -+static int -+validate_increment_semaphore(VALIDATE_ARGS) ++static int snd_rpi_hifiberry_dacplus_init(struct snd_soc_pcm_runtime *rtd) +{ -+ if (exec->found_increment_semaphore_packet) { -+ DRM_ERROR("Duplicate VC4_PACKET_INCREMENT_SEMAPHORE\n"); -+ return -EINVAL; -+ } -+ exec->found_increment_semaphore_packet = true; -+ -+ /* Once we've found the semaphore increment, there should be one FLUSH -+ * then the end of the command list. The FLUSH actually triggers the -+ * increment, so we only need to make sure there -+ */ ++ struct snd_soc_codec *codec = rtd->codec; ++ struct pcm512x_priv *priv; + -+ return 0; -+} ++ if (slave) ++ snd_rpi_hifiberry_is_dacpro = false; ++ else ++ snd_rpi_hifiberry_is_dacpro = ++ snd_rpi_hifiberry_dacplus_is_pro_card(codec); + -+static int -+validate_indexed_prim_list(VALIDATE_ARGS) -+{ -+ struct drm_gem_cma_object *ib; -+ uint32_t length = *(uint32_t *)(untrusted + 1); -+ uint32_t offset = *(uint32_t *)(untrusted + 5); -+ uint32_t max_index = *(uint32_t *)(untrusted + 9); -+ uint32_t index_size = (*(uint8_t *)(untrusted + 0) >> 4) ? 2 : 1; -+ struct vc4_shader_state *shader_state; ++ if (snd_rpi_hifiberry_is_dacpro) { ++ struct snd_soc_dai_link *dai = rtd->dai_link; + -+ if (exec->found_increment_semaphore_packet) { -+ DRM_ERROR("Drawing after VC4_PACKET_INCREMENT_SEMAPHORE\n"); -+ return -EINVAL; -+ } ++ dai->name = "HiFiBerry DAC+ Pro"; ++ dai->stream_name = "HiFiBerry DAC+ Pro HiFi"; ++ dai->dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF ++ | SND_SOC_DAIFMT_CBM_CFM; + -+ /* Check overflow condition */ -+ if (exec->shader_state_count == 0) { -+ DRM_ERROR("shader state must precede primitives\n"); -+ return -EINVAL; ++ snd_soc_update_bits(codec, PCM512x_BCLK_LRCLK_CFG, 0x31, 0x11); ++ snd_soc_update_bits(codec, PCM512x_MASTER_MODE, 0x03, 0x03); ++ snd_soc_update_bits(codec, PCM512x_MASTER_CLKDIV_2, 0x7f, 63); ++ } else { ++ priv = snd_soc_codec_get_drvdata(codec); ++ priv->sclk = ERR_PTR(-ENOENT); + } -+ shader_state = &exec->shader_state[exec->shader_state_count - 1]; + -+ if (max_index > shader_state->max_index) -+ shader_state->max_index = max_index; ++ snd_soc_update_bits(codec, PCM512x_GPIO_EN, 0x08, 0x08); ++ snd_soc_update_bits(codec, PCM512x_GPIO_OUTPUT_4, 0x0f, 0x02); ++ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x08, 0x08); + -+ if (!vc4_use_handle(exec, 0, VC4_MODE_RENDER, &ib)) -+ return -EINVAL; ++ if (digital_gain_0db_limit) ++ { ++ int ret; ++ struct snd_soc_card *card = rtd->card; + -+ if (offset > ib->base.size || -+ (ib->base.size - offset) / index_size < length) { -+ DRM_ERROR("IB access overflow (%d + %d*%d > %d)\n", -+ offset, length, index_size, ib->base.size); -+ return -EINVAL; ++ ret = snd_soc_limit_volume(card, "Digital Playback Volume", 207); ++ if (ret < 0) ++ dev_warn(card->dev, "Failed to set volume limit: %d\n", ret); + } + -+ *(uint32_t *)(validated + 5) = ib->paddr + offset; -+ + return 0; +} + -+static int -+validate_gl_array_primitive(VALIDATE_ARGS) ++static int snd_rpi_hifiberry_dacplus_update_rate_den( ++ struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params) +{ -+ uint32_t length = *(uint32_t *)(untrusted + 1); -+ uint32_t base_index = *(uint32_t *)(untrusted + 5); -+ uint32_t max_index; -+ struct vc4_shader_state *shader_state; ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_codec *codec = rtd->codec; ++ struct pcm512x_priv *pcm512x = snd_soc_codec_get_drvdata(codec); ++ struct snd_ratnum *rats_no_pll; ++ unsigned int num = 0, den = 0; ++ int err; + -+ if (exec->found_increment_semaphore_packet) { -+ DRM_ERROR("Drawing after VC4_PACKET_INCREMENT_SEMAPHORE\n"); -+ return -EINVAL; -+ } ++ rats_no_pll = devm_kzalloc(rtd->dev, sizeof(*rats_no_pll), GFP_KERNEL); ++ if (!rats_no_pll) ++ return -ENOMEM; + -+ /* Check overflow condition */ -+ if (exec->shader_state_count == 0) { -+ DRM_ERROR("shader state must precede primitives\n"); -+ return -EINVAL; -+ } -+ shader_state = &exec->shader_state[exec->shader_state_count - 1]; ++ rats_no_pll->num = clk_get_rate(pcm512x->sclk) / 64; ++ rats_no_pll->den_min = 1; ++ rats_no_pll->den_max = 128; ++ rats_no_pll->den_step = 1; + -+ if (length + base_index < length) { -+ DRM_ERROR("primitive vertex count overflow\n"); -+ return -EINVAL; ++ err = snd_interval_ratnum(hw_param_interval(params, ++ SNDRV_PCM_HW_PARAM_RATE), 1, rats_no_pll, &num, &den); ++ if (err >= 0 && den) { ++ params->rate_num = num; ++ params->rate_den = den; + } -+ max_index = length + base_index - 1; -+ -+ if (max_index > shader_state->max_index) -+ shader_state->max_index = max_index; + ++ devm_kfree(rtd->dev, rats_no_pll); + return 0; +} + -+static int -+validate_gl_shader_state(VALIDATE_ARGS) ++static int snd_rpi_hifiberry_dacplus_set_bclk_ratio_pro( ++ struct snd_soc_dai *cpu_dai, struct snd_pcm_hw_params *params) +{ -+ uint32_t i = exec->shader_state_count++; ++ int bratio = snd_pcm_format_physical_width(params_format(params)) ++ * params_channels(params); ++ return snd_soc_dai_set_bclk_ratio(cpu_dai, bratio); ++} + -+ if (i >= exec->shader_state_size) { -+ DRM_ERROR("More requests for shader states than declared\n"); -+ return -EINVAL; -+ } ++static int snd_rpi_hifiberry_dacplus_hw_params( ++ struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params) ++{ ++ int ret; ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; + -+ exec->shader_state[i].packet = VC4_PACKET_GL_SHADER_STATE; -+ exec->shader_state[i].addr = *(uint32_t *)untrusted; -+ exec->shader_state[i].max_index = 0; ++ if (snd_rpi_hifiberry_is_dacpro) { ++ struct snd_soc_codec *codec = rtd->codec; + -+ if (exec->shader_state[i].addr & ~0xf) { -+ DRM_ERROR("high bits set in GL shader rec reference\n"); -+ return -EINVAL; -+ } ++ snd_rpi_hifiberry_dacplus_set_sclk(codec, ++ params_rate(params)); + -+ *(uint32_t *)validated = (exec->shader_rec_p + -+ exec->shader_state[i].addr); ++ ret = snd_rpi_hifiberry_dacplus_set_bclk_ratio_pro(cpu_dai, ++ params); ++ if (!ret) ++ ret = snd_rpi_hifiberry_dacplus_update_rate_den( ++ substream, params); ++ } else { ++ ret = snd_soc_dai_set_bclk_ratio(cpu_dai, 64); ++ } ++ return ret; ++} + -+ exec->shader_rec_p += -+ roundup(gl_shader_rec_size(exec->shader_state[i].addr), 16); ++static int snd_rpi_hifiberry_dacplus_startup( ++ struct snd_pcm_substream *substream) ++{ ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_codec *codec = rtd->codec; + ++ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x08, 0x08); + return 0; +} + -+static int -+validate_nv_shader_state(VALIDATE_ARGS) ++static void snd_rpi_hifiberry_dacplus_shutdown( ++ struct snd_pcm_substream *substream) +{ -+ uint32_t i = exec->shader_state_count++; -+ -+ if (i >= exec->shader_state_size) { -+ DRM_ERROR("More requests for shader states than declared\n"); -+ return -EINVAL; -+ } ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_codec *codec = rtd->codec; + -+ exec->shader_state[i].packet = VC4_PACKET_NV_SHADER_STATE; -+ exec->shader_state[i].addr = *(uint32_t *)untrusted; ++ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x08, 0x00); ++} + -+ if (exec->shader_state[i].addr & 15) { -+ DRM_ERROR("NV shader state address 0x%08x misaligned\n", -+ exec->shader_state[i].addr); -+ return -EINVAL; -+ } ++/* machine stream operations */ ++static struct snd_soc_ops snd_rpi_hifiberry_dacplus_ops = { ++ .hw_params = snd_rpi_hifiberry_dacplus_hw_params, ++ .startup = snd_rpi_hifiberry_dacplus_startup, ++ .shutdown = snd_rpi_hifiberry_dacplus_shutdown, ++}; + -+ *(uint32_t *)validated = (exec->shader_state[i].addr + -+ exec->shader_rec_p); ++static struct snd_soc_dai_link snd_rpi_hifiberry_dacplus_dai[] = { ++{ ++ .name = "HiFiBerry DAC+", ++ .stream_name = "HiFiBerry DAC+ HiFi", ++ .cpu_dai_name = "bcm2708-i2s.0", ++ .codec_dai_name = "pcm512x-hifi", ++ .platform_name = "bcm2708-i2s.0", ++ .codec_name = "pcm512x.1-004d", ++ .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | ++ SND_SOC_DAIFMT_CBS_CFS, ++ .ops = &snd_rpi_hifiberry_dacplus_ops, ++ .init = snd_rpi_hifiberry_dacplus_init, ++}, ++}; + -+ return 0; -+} ++/* audio machine driver */ ++static struct snd_soc_card snd_rpi_hifiberry_dacplus = { ++ .name = "snd_rpi_hifiberry_dacplus", ++ .owner = THIS_MODULE, ++ .dai_link = snd_rpi_hifiberry_dacplus_dai, ++ .num_links = ARRAY_SIZE(snd_rpi_hifiberry_dacplus_dai), ++}; + -+static int -+validate_tile_binning_config(VALIDATE_ARGS) ++static int snd_rpi_hifiberry_dacplus_probe(struct platform_device *pdev) +{ -+ struct drm_device *dev = exec->exec_bo->base.dev; -+ uint8_t flags; -+ uint32_t tile_state_size, tile_alloc_size; -+ uint32_t tile_count; ++ int ret = 0; + -+ if (exec->found_tile_binning_mode_config_packet) { -+ DRM_ERROR("Duplicate VC4_PACKET_TILE_BINNING_MODE_CONFIG\n"); -+ return -EINVAL; -+ } -+ exec->found_tile_binning_mode_config_packet = true; ++ snd_rpi_hifiberry_dacplus.dev = &pdev->dev; ++ if (pdev->dev.of_node) { ++ struct device_node *i2s_node; ++ struct snd_soc_dai_link *dai; + -+ exec->bin_tiles_x = *(uint8_t *)(untrusted + 12); -+ exec->bin_tiles_y = *(uint8_t *)(untrusted + 13); -+ tile_count = exec->bin_tiles_x * exec->bin_tiles_y; -+ flags = *(uint8_t *)(untrusted + 14); ++ dai = &snd_rpi_hifiberry_dacplus_dai[0]; ++ i2s_node = of_parse_phandle(pdev->dev.of_node, ++ "i2s-controller", 0); + -+ if (exec->bin_tiles_x == 0 || -+ exec->bin_tiles_y == 0) { -+ DRM_ERROR("Tile binning config of %dx%d too small\n", -+ exec->bin_tiles_x, exec->bin_tiles_y); -+ return -EINVAL; -+ } ++ if (i2s_node) { ++ dai->cpu_dai_name = NULL; ++ dai->cpu_of_node = i2s_node; ++ dai->platform_name = NULL; ++ dai->platform_of_node = i2s_node; ++ } + -+ if (flags & (VC4_BIN_CONFIG_DB_NON_MS | -+ VC4_BIN_CONFIG_TILE_BUFFER_64BIT | -+ VC4_BIN_CONFIG_MS_MODE_4X)) { -+ DRM_ERROR("unsupported bining config flags 0x%02x\n", flags); -+ return -EINVAL; ++ digital_gain_0db_limit = !of_property_read_bool( ++ pdev->dev.of_node, "hifiberry,24db_digital_gain"); ++ slave = of_property_read_bool(pdev->dev.of_node, ++ "hifiberry-dacplus,slave"); + } + -+ /* The tile state data array is 48 bytes per tile, and we put it at -+ * the start of a BO containing both it and the tile alloc. -+ */ -+ tile_state_size = 48 * tile_count; ++ ret = snd_soc_register_card(&snd_rpi_hifiberry_dacplus); ++ if (ret) ++ dev_err(&pdev->dev, ++ "snd_soc_register_card() failed: %d\n", ret); + -+ /* Since the tile alloc array will follow us, align. */ -+ exec->tile_alloc_offset = roundup(tile_state_size, 4096); ++ return ret; ++} + -+ *(uint8_t *)(validated + 14) = -+ ((flags & ~(VC4_BIN_CONFIG_ALLOC_INIT_BLOCK_SIZE_MASK | -+ VC4_BIN_CONFIG_ALLOC_BLOCK_SIZE_MASK)) | -+ VC4_BIN_CONFIG_AUTO_INIT_TSDA | -+ VC4_SET_FIELD(VC4_BIN_CONFIG_ALLOC_INIT_BLOCK_SIZE_32, -+ VC4_BIN_CONFIG_ALLOC_INIT_BLOCK_SIZE) | -+ VC4_SET_FIELD(VC4_BIN_CONFIG_ALLOC_BLOCK_SIZE_128, -+ VC4_BIN_CONFIG_ALLOC_BLOCK_SIZE)); ++static int snd_rpi_hifiberry_dacplus_remove(struct platform_device *pdev) ++{ ++ return snd_soc_unregister_card(&snd_rpi_hifiberry_dacplus); ++} + -+ /* Initial block size. */ -+ tile_alloc_size = 32 * tile_count; ++static const struct of_device_id snd_rpi_hifiberry_dacplus_of_match[] = { ++ { .compatible = "hifiberry,hifiberry-dacplus", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, snd_rpi_hifiberry_dacplus_of_match); + -+ /* -+ * The initial allocation gets rounded to the next 256 bytes before -+ * the hardware starts fulfilling further allocations. -+ */ -+ tile_alloc_size = roundup(tile_alloc_size, 256); ++static struct platform_driver snd_rpi_hifiberry_dacplus_driver = { ++ .driver = { ++ .name = "snd-rpi-hifiberry-dacplus", ++ .owner = THIS_MODULE, ++ .of_match_table = snd_rpi_hifiberry_dacplus_of_match, ++ }, ++ .probe = snd_rpi_hifiberry_dacplus_probe, ++ .remove = snd_rpi_hifiberry_dacplus_remove, ++}; + -+ /* Add space for the extra allocations. This is what gets used first, -+ * before overflow memory. It must have at least 4096 bytes, but we -+ * want to avoid overflow memory usage if possible. -+ */ -+ tile_alloc_size += 1024 * 1024; ++module_platform_driver(snd_rpi_hifiberry_dacplus_driver); + -+ exec->tile_bo = &vc4_bo_create(dev, exec->tile_alloc_offset + -+ tile_alloc_size)->base; -+ if (!exec->tile_bo) -+ return -ENOMEM; -+ list_add_tail(&to_vc4_bo(&exec->tile_bo->base)->unref_head, -+ &exec->unref_list); ++MODULE_AUTHOR("Daniel Matuschek <daniel@hifiberry.com>"); ++MODULE_DESCRIPTION("ASoC Driver for HiFiBerry DAC+"); ++MODULE_LICENSE("GPL v2"); +diff --git a/sound/soc/codecs/pcm512x.c b/sound/soc/codecs/pcm512x.c +index 047c489..090fe0e 100644 +--- a/sound/soc/codecs/pcm512x.c ++++ b/sound/soc/codecs/pcm512x.c +@@ -854,7 +854,8 @@ static int pcm512x_set_dividers(struct snd_soc_dai *dai, + int fssp; + int gpio; + +- lrclk_div = snd_soc_params_to_frame_size(params); ++ lrclk_div = snd_pcm_format_physical_width(params_format(params)) ++ * params_channels(params); + if (lrclk_div == 0) { + dev_err(dev, "No LRCLK?\n"); + return -EINVAL; + +From e98480a9bdf2baa680bdd5e92a9cc914c3dea397 Mon Sep 17 00:00:00 2001 +From: Daniel Matuschek <info@crazy-audio.com> +Date: Mon, 4 Aug 2014 11:09:58 +0200 +Subject: [PATCH 073/112] Added driver for HiFiBerry Amp amplifier add-on board + +The driver contains a low-level hardware driver for the TAS5713 and the +drivers for the Raspberry Pi I2S subsystem. + +TAS5713: return error if initialisation fails + +Existing TAS5713 driver logs errors during initialisation, but does not return +an error code. Therefore even if initialisation fails, the driver will still be +loaded, but won't work. This patch fixes this. I2C communication error will now +reported correctly by a non-zero return code. + +HiFiBerry Amp: fix device-tree problems + +Some code to load the driver based on device-tree-overlays was missing. This is added by this patch. +--- + sound/soc/bcm/Kconfig | 7 + + sound/soc/bcm/Makefile | 2 + + sound/soc/bcm/hifiberry_amp.c | 128 +++++++++++++++ + sound/soc/codecs/Kconfig | 4 + + sound/soc/codecs/Makefile | 2 + + sound/soc/codecs/tas5713.c | 369 ++++++++++++++++++++++++++++++++++++++++++ + sound/soc/codecs/tas5713.h | 210 ++++++++++++++++++++++++ + 7 files changed, 722 insertions(+) + create mode 100644 sound/soc/bcm/hifiberry_amp.c + create mode 100644 sound/soc/codecs/tas5713.c + create mode 100644 sound/soc/codecs/tas5713.h + +diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig +index 8c338b5..7677c89 100644 +--- a/sound/soc/bcm/Kconfig ++++ b/sound/soc/bcm/Kconfig +@@ -29,6 +29,13 @@ config SND_BCM2708_SOC_HIFIBERRY_DIGI + help + Say Y or M if you want to add support for HifiBerry Digi S/PDIF output board. + ++config SND_BCM2708_SOC_HIFIBERRY_AMP ++ tristate "Support for the HifiBerry Amp" ++ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S ++ select SND_SOC_TAS5713 ++ help ++ Say Y or M if you want to add support for the HifiBerry Amp amplifier board. ++ + config SND_BCM2708_SOC_RPI_DAC + tristate "Support for RPi-DAC" + depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S +diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile +index a29538e..30db495 100644 +--- a/sound/soc/bcm/Makefile ++++ b/sound/soc/bcm/Makefile +@@ -7,11 +7,13 @@ obj-$(CONFIG_SND_BCM2835_SOC_I2S) += snd-soc-bcm2835-i2s.o + snd-soc-hifiberry-dac-objs := hifiberry_dac.o + snd-soc-hifiberry-dacplus-objs := hifiberry_dacplus.o + snd-soc-hifiberry-digi-objs := hifiberry_digi.o ++snd-soc-hifiberry-amp-objs := hifiberry_amp.o + snd-soc-rpi-dac-objs := rpi-dac.o + snd-soc-iqaudio-dac-objs := iqaudio-dac.o + + obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o + obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS) += snd-soc-hifiberry-dacplus.o + obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI) += snd-soc-hifiberry-digi.o ++obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_AMP) += snd-soc-hifiberry-amp.o + obj-$(CONFIG_SND_BCM2708_SOC_RPI_DAC) += snd-soc-rpi-dac.o + obj-$(CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC) += snd-soc-iqaudio-dac.o +diff --git a/sound/soc/bcm/hifiberry_amp.c b/sound/soc/bcm/hifiberry_amp.c +new file mode 100644 +index 0000000..0bb12e4 +--- /dev/null ++++ b/sound/soc/bcm/hifiberry_amp.c +@@ -0,0 +1,128 @@ ++/* ++ * ASoC Driver for HifiBerry AMP ++ * ++ * Author: Sebastian Eickhoff <basti.eickhoff@googlemail.com> ++ * Copyright 2014 ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * version 2 as published by the Free Software Foundation. ++ * ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * General Public License for more details. ++ */ + -+ /* tile alloc address. */ -+ *(uint32_t *)(validated + 0) = (exec->tile_bo->paddr + -+ exec->tile_alloc_offset); -+ /* tile alloc size. */ -+ *(uint32_t *)(validated + 4) = tile_alloc_size; -+ /* tile state address. */ -+ *(uint32_t *)(validated + 8) = exec->tile_bo->paddr; ++#include <linux/module.h> ++#include <linux/platform_device.h> + -+ return 0; -+} ++#include <sound/core.h> ++#include <sound/pcm.h> ++#include <sound/pcm_params.h> ++#include <sound/soc.h> ++#include <sound/jack.h> + -+static int -+validate_gem_handles(VALIDATE_ARGS) ++static int snd_rpi_hifiberry_amp_init(struct snd_soc_pcm_runtime *rtd) +{ -+ memcpy(exec->bo_index, untrusted, sizeof(exec->bo_index)); ++ // ToDo: init of the dsp-registers. + return 0; +} + -+#define VC4_DEFINE_PACKET(packet, name, func) \ -+ [packet] = { packet ## _SIZE, name, func } -+ -+static const struct cmd_info { -+ uint16_t len; -+ const char *name; -+ int (*func)(struct vc4_exec_info *exec, void *validated, -+ void *untrusted); -+} cmd_info[] = { -+ VC4_DEFINE_PACKET(VC4_PACKET_HALT, "halt", NULL), -+ VC4_DEFINE_PACKET(VC4_PACKET_NOP, "nop", NULL), -+ VC4_DEFINE_PACKET(VC4_PACKET_FLUSH, "flush", NULL), -+ VC4_DEFINE_PACKET(VC4_PACKET_FLUSH_ALL, "flush all state", validate_flush_all), -+ VC4_DEFINE_PACKET(VC4_PACKET_START_TILE_BINNING, "start tile binning", validate_start_tile_binning), -+ VC4_DEFINE_PACKET(VC4_PACKET_INCREMENT_SEMAPHORE, "increment semaphore", validate_increment_semaphore), -+ -+ VC4_DEFINE_PACKET(VC4_PACKET_GL_INDEXED_PRIMITIVE, "Indexed Primitive List", validate_indexed_prim_list), -+ -+ VC4_DEFINE_PACKET(VC4_PACKET_GL_ARRAY_PRIMITIVE, "Vertex Array Primitives", validate_gl_array_primitive), -+ -+ /* This is only used by clipped primitives (packets 48 and 49), which -+ * we don't support parsing yet. -+ */ -+ VC4_DEFINE_PACKET(VC4_PACKET_PRIMITIVE_LIST_FORMAT, "primitive list format", NULL), -+ -+ VC4_DEFINE_PACKET(VC4_PACKET_GL_SHADER_STATE, "GL Shader State", validate_gl_shader_state), -+ VC4_DEFINE_PACKET(VC4_PACKET_NV_SHADER_STATE, "NV Shader State", validate_nv_shader_state), -+ -+ VC4_DEFINE_PACKET(VC4_PACKET_CONFIGURATION_BITS, "configuration bits", NULL), -+ VC4_DEFINE_PACKET(VC4_PACKET_FLAT_SHADE_FLAGS, "flat shade flags", NULL), -+ VC4_DEFINE_PACKET(VC4_PACKET_POINT_SIZE, "point size", NULL), -+ VC4_DEFINE_PACKET(VC4_PACKET_LINE_WIDTH, "line width", NULL), -+ VC4_DEFINE_PACKET(VC4_PACKET_RHT_X_BOUNDARY, "RHT X boundary", NULL), -+ VC4_DEFINE_PACKET(VC4_PACKET_DEPTH_OFFSET, "Depth Offset", NULL), -+ VC4_DEFINE_PACKET(VC4_PACKET_CLIP_WINDOW, "Clip Window", NULL), -+ VC4_DEFINE_PACKET(VC4_PACKET_VIEWPORT_OFFSET, "Viewport Offset", NULL), -+ VC4_DEFINE_PACKET(VC4_PACKET_CLIPPER_XY_SCALING, "Clipper XY Scaling", NULL), -+ /* Note: The docs say this was also 105, but it was 106 in the -+ * initial userland code drop. -+ */ -+ VC4_DEFINE_PACKET(VC4_PACKET_CLIPPER_Z_SCALING, "Clipper Z Scale and Offset", NULL), ++static int snd_rpi_hifiberry_amp_hw_params( struct snd_pcm_substream *substream, ++ struct snd_pcm_hw_params *params ) ++{ ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; + -+ VC4_DEFINE_PACKET(VC4_PACKET_TILE_BINNING_MODE_CONFIG, "tile binning configuration", validate_tile_binning_config), ++ return snd_soc_dai_set_bclk_ratio(cpu_dai, 64); ++} + -+ VC4_DEFINE_PACKET(VC4_PACKET_GEM_HANDLES, "GEM handles", validate_gem_handles), ++static struct snd_soc_ops snd_rpi_hifiberry_amp_ops = { ++ .hw_params = snd_rpi_hifiberry_amp_hw_params, +}; + -+int -+vc4_validate_bin_cl(struct drm_device *dev, -+ void *validated, -+ void *unvalidated, -+ struct vc4_exec_info *exec) -+{ -+ uint32_t len = exec->args->bin_cl_size; -+ uint32_t dst_offset = 0; -+ uint32_t src_offset = 0; -+ -+ while (src_offset < len) { -+ void *dst_pkt = validated + dst_offset; -+ void *src_pkt = unvalidated + src_offset; -+ u8 cmd = *(uint8_t *)src_pkt; -+ const struct cmd_info *info; -+ -+ if (cmd > ARRAY_SIZE(cmd_info)) { -+ DRM_ERROR("0x%08x: packet %d out of bounds\n", -+ src_offset, cmd); -+ return -EINVAL; -+ } ++static struct snd_soc_dai_link snd_rpi_hifiberry_amp_dai[] = { ++ { ++ .name = "HifiBerry AMP", ++ .stream_name = "HifiBerry AMP HiFi", ++ .cpu_dai_name = "bcm2708-i2s.0", ++ .codec_dai_name = "tas5713-hifi", ++ .platform_name = "bcm2708-i2s.0", ++ .codec_name = "tas5713.1-001b", ++ .dai_fmt = SND_SOC_DAIFMT_I2S | ++ SND_SOC_DAIFMT_NB_NF | ++ SND_SOC_DAIFMT_CBS_CFS, ++ .ops = &snd_rpi_hifiberry_amp_ops, ++ .init = snd_rpi_hifiberry_amp_init, ++ }, ++}; + -+ info = &cmd_info[cmd]; -+ if (!info->name) { -+ DRM_ERROR("0x%08x: packet %d invalid\n", -+ src_offset, cmd); -+ return -EINVAL; -+ } + -+#if 0 -+ DRM_INFO("0x%08x: packet %d (%s) size %d processing...\n", -+ src_offset, cmd, info->name, info->len); -+#endif ++static struct snd_soc_card snd_rpi_hifiberry_amp = { ++ .name = "snd_rpi_hifiberry_amp", ++ .owner = THIS_MODULE, ++ .dai_link = snd_rpi_hifiberry_amp_dai, ++ .num_links = ARRAY_SIZE(snd_rpi_hifiberry_amp_dai), ++}; + -+ if (src_offset + info->len > len) { -+ DRM_ERROR("0x%08x: packet %d (%s) length 0x%08x " -+ "exceeds bounds (0x%08x)\n", -+ src_offset, cmd, info->name, info->len, -+ src_offset + len); -+ return -EINVAL; -+ } ++static const struct of_device_id snd_rpi_hifiberry_amp_of_match[] = { ++ { .compatible = "hifiberry,hifiberry-amp", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, snd_rpi_hifiberry_amp_of_match); + -+ if (cmd != VC4_PACKET_GEM_HANDLES) -+ memcpy(dst_pkt, src_pkt, info->len); + -+ if (info->func && info->func(exec, -+ dst_pkt + 1, -+ src_pkt + 1)) { -+ DRM_ERROR("0x%08x: packet %d (%s) failed to " -+ "validate\n", -+ src_offset, cmd, info->name); -+ return -EINVAL; -+ } ++static int snd_rpi_hifiberry_amp_probe(struct platform_device *pdev) ++{ ++ int ret = 0; + -+ src_offset += info->len; -+ /* GEM handle loading doesn't produce HW packets. */ -+ if (cmd != VC4_PACKET_GEM_HANDLES) -+ dst_offset += info->len; ++ snd_rpi_hifiberry_amp.dev = &pdev->dev; + -+ /* When the CL hits halt, it'll stop reading anything else. */ -+ if (cmd == VC4_PACKET_HALT) -+ break; -+ } ++ if (pdev->dev.of_node) { ++ struct device_node *i2s_node; ++ struct snd_soc_dai_link *dai = &snd_rpi_hifiberry_amp_dai[0]; ++ i2s_node = of_parse_phandle(pdev->dev.of_node, ++ "i2s-controller", 0); + -+ exec->ct0ea = exec->ct0ca + dst_offset; ++ if (i2s_node) { ++ dai->cpu_dai_name = NULL; ++ dai->cpu_of_node = i2s_node; ++ dai->platform_name = NULL; ++ dai->platform_of_node = i2s_node; ++ } ++ } + -+ if (!exec->found_start_tile_binning_packet) { -+ DRM_ERROR("Bin CL missing VC4_PACKET_START_TILE_BINNING\n"); -+ return -EINVAL; -+ } ++ ret = snd_soc_register_card(&snd_rpi_hifiberry_amp); + -+ if (!exec->found_increment_semaphore_packet) { -+ DRM_ERROR("Bin CL missing VC4_PACKET_INCREMENT_SEMAPHORE\n"); -+ return -EINVAL; ++ if (ret != 0) { ++ dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", ret); + } + -+ return 0; ++ return ret; +} + -+static bool -+reloc_tex(struct vc4_exec_info *exec, -+ void *uniform_data_u, -+ struct vc4_texture_sample_info *sample, -+ uint32_t texture_handle_index) -+ -+{ -+ struct drm_gem_cma_object *tex; -+ uint32_t p0 = *(uint32_t *)(uniform_data_u + sample->p_offset[0]); -+ uint32_t p1 = *(uint32_t *)(uniform_data_u + sample->p_offset[1]); -+ uint32_t p2 = (sample->p_offset[2] != ~0 ? -+ *(uint32_t *)(uniform_data_u + sample->p_offset[2]) : 0); -+ uint32_t p3 = (sample->p_offset[3] != ~0 ? -+ *(uint32_t *)(uniform_data_u + sample->p_offset[3]) : 0); -+ uint32_t *validated_p0 = exec->uniforms_v + sample->p_offset[0]; -+ uint32_t offset = p0 & VC4_TEX_P0_OFFSET_MASK; -+ uint32_t miplevels = VC4_GET_FIELD(p0, VC4_TEX_P0_MIPLVLS); -+ uint32_t width = VC4_GET_FIELD(p1, VC4_TEX_P1_WIDTH); -+ uint32_t height = VC4_GET_FIELD(p1, VC4_TEX_P1_HEIGHT); -+ uint32_t cpp, tiling_format, utile_w, utile_h; -+ uint32_t i; -+ uint32_t cube_map_stride = 0; -+ enum vc4_texture_data_type type; -+ -+ if (!vc4_use_bo(exec, texture_handle_index, VC4_MODE_RENDER, &tex)) -+ return false; + -+ if (sample->is_direct) { -+ uint32_t remaining_size = tex->base.size - p0; -+ if (p0 > tex->base.size - 4) { -+ DRM_ERROR("UBO offset greater than UBO size\n"); -+ goto fail; -+ } -+ if (p1 > remaining_size - 4) { -+ DRM_ERROR("UBO clamp would allow reads outside of UBO\n"); -+ goto fail; -+ } -+ *validated_p0 = tex->paddr + p0; -+ return true; -+ } ++static int snd_rpi_hifiberry_amp_remove(struct platform_device *pdev) ++{ ++ return snd_soc_unregister_card(&snd_rpi_hifiberry_amp); ++} + -+ if (width == 0) -+ width = 2048; -+ if (height == 0) -+ height = 2048; + -+ if (p0 & VC4_TEX_P0_CMMODE_MASK) { -+ if (VC4_GET_FIELD(p2, VC4_TEX_P2_PTYPE) == -+ VC4_TEX_P2_PTYPE_CUBE_MAP_STRIDE) -+ cube_map_stride = p2 & VC4_TEX_P2_CMST_MASK; -+ if (VC4_GET_FIELD(p3, VC4_TEX_P2_PTYPE) == -+ VC4_TEX_P2_PTYPE_CUBE_MAP_STRIDE) { -+ if (cube_map_stride) { -+ DRM_ERROR("Cube map stride set twice\n"); -+ goto fail; -+ } ++static struct platform_driver snd_rpi_hifiberry_amp_driver = { ++ .driver = { ++ .name = "snd-hifiberry-amp", ++ .owner = THIS_MODULE, ++ .of_match_table = snd_rpi_hifiberry_amp_of_match, ++ }, ++ .probe = snd_rpi_hifiberry_amp_probe, ++ .remove = snd_rpi_hifiberry_amp_remove, ++}; + -+ cube_map_stride = p3 & VC4_TEX_P2_CMST_MASK; -+ } -+ if (!cube_map_stride) { -+ DRM_ERROR("Cube map stride not set\n"); -+ goto fail; -+ } -+ } + -+ type = (VC4_GET_FIELD(p0, VC4_TEX_P0_TYPE) | -+ (VC4_GET_FIELD(p1, VC4_TEX_P1_TYPE4) << 4)); ++module_platform_driver(snd_rpi_hifiberry_amp_driver); + -+ switch (type) { -+ case VC4_TEXTURE_TYPE_RGBA8888: -+ case VC4_TEXTURE_TYPE_RGBX8888: -+ case VC4_TEXTURE_TYPE_RGBA32R: -+ cpp = 4; -+ break; -+ case VC4_TEXTURE_TYPE_RGBA4444: -+ case VC4_TEXTURE_TYPE_RGBA5551: -+ case VC4_TEXTURE_TYPE_RGB565: -+ case VC4_TEXTURE_TYPE_LUMALPHA: -+ case VC4_TEXTURE_TYPE_S16F: -+ case VC4_TEXTURE_TYPE_S16: -+ cpp = 2; -+ break; -+ case VC4_TEXTURE_TYPE_LUMINANCE: -+ case VC4_TEXTURE_TYPE_ALPHA: -+ case VC4_TEXTURE_TYPE_S8: -+ cpp = 1; -+ break; -+ case VC4_TEXTURE_TYPE_ETC1: -+ case VC4_TEXTURE_TYPE_BW1: -+ case VC4_TEXTURE_TYPE_A4: -+ case VC4_TEXTURE_TYPE_A1: -+ case VC4_TEXTURE_TYPE_RGBA64: -+ case VC4_TEXTURE_TYPE_YUV422R: -+ default: -+ DRM_ERROR("Texture format %d unsupported\n", type); -+ goto fail; -+ } -+ utile_w = utile_width(cpp); -+ utile_h = utile_height(cpp); + -+ if (type == VC4_TEXTURE_TYPE_RGBA32R) { -+ tiling_format = VC4_TILING_FORMAT_LINEAR; -+ } else { -+ if (size_is_lt(width, height, cpp)) -+ tiling_format = VC4_TILING_FORMAT_LT; -+ else -+ tiling_format = VC4_TILING_FORMAT_T; -+ } ++MODULE_AUTHOR("Sebastian Eickhoff <basti.eickhoff@googlemail.com>"); ++MODULE_DESCRIPTION("ASoC driver for HiFiBerry-AMP"); ++MODULE_LICENSE("GPL v2"); +diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig +index 513ab55..ebcfbfd 100644 +--- a/sound/soc/codecs/Kconfig ++++ b/sound/soc/codecs/Kconfig +@@ -129,6 +129,7 @@ config SND_SOC_ALL_CODECS + select SND_SOC_TFA9879 if I2C + select SND_SOC_TLV320AIC23_I2C if I2C + select SND_SOC_TLV320AIC23_SPI if SPI_MASTER ++ select SND_SOC_TAS5713 if I2C + select SND_SOC_TLV320AIC26 if SPI_MASTER + select SND_SOC_TLV320AIC31XX if I2C + select SND_SOC_TLV320AIC32X4 if I2C +@@ -759,6 +760,9 @@ config SND_SOC_TFA9879 + tristate "NXP Semiconductors TFA9879 amplifier" + depends on I2C + ++config SND_SOC_TAS5713 ++ tristate + -+ if (!vc4_check_tex_size(exec, tex, offset + cube_map_stride * 5, -+ tiling_format, width, height, cpp)) { -+ goto fail; -+ } + config SND_SOC_TLV320AIC23 + tristate + +diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile +index b87e845..9974a13 100644 +--- a/sound/soc/codecs/Makefile ++++ b/sound/soc/codecs/Makefile +@@ -132,6 +132,7 @@ snd-soc-sti-sas-objs := sti-sas.o + snd-soc-tas5086-objs := tas5086.o + snd-soc-tas571x-objs := tas571x.o + snd-soc-tfa9879-objs := tfa9879.o ++snd-soc-tas5713-objs := tas5713.o + snd-soc-tlv320aic23-objs := tlv320aic23.o + snd-soc-tlv320aic23-i2c-objs := tlv320aic23-i2c.o + snd-soc-tlv320aic23-spi-objs := tlv320aic23-spi.o +@@ -340,6 +341,7 @@ obj-$(CONFIG_SND_SOC_TAS2552) += snd-soc-tas2552.o + obj-$(CONFIG_SND_SOC_TAS5086) += snd-soc-tas5086.o + obj-$(CONFIG_SND_SOC_TAS571X) += snd-soc-tas571x.o + obj-$(CONFIG_SND_SOC_TFA9879) += snd-soc-tfa9879.o ++obj-$(CONFIG_SND_SOC_TAS5713) += snd-soc-tas5713.o + obj-$(CONFIG_SND_SOC_TLV320AIC23) += snd-soc-tlv320aic23.o + obj-$(CONFIG_SND_SOC_TLV320AIC23_I2C) += snd-soc-tlv320aic23-i2c.o + obj-$(CONFIG_SND_SOC_TLV320AIC23_SPI) += snd-soc-tlv320aic23-spi.o +diff --git a/sound/soc/codecs/tas5713.c b/sound/soc/codecs/tas5713.c +new file mode 100644 +index 0000000..9b27138 +--- /dev/null ++++ b/sound/soc/codecs/tas5713.c +@@ -0,0 +1,369 @@ ++/* ++ * ASoC Driver for TAS5713 ++ * ++ * Author: Sebastian Eickhoff <basti.eickhoff@googlemail.com> ++ * Copyright 2014 ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * version 2 as published by the Free Software Foundation. ++ * ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * General Public License for more details. ++ */ + -+ /* The mipmap levels are stored before the base of the texture. Make -+ * sure there is actually space in the BO. -+ */ -+ for (i = 1; i <= miplevels; i++) { -+ uint32_t level_width = max(width >> i, 1u); -+ uint32_t level_height = max(height >> i, 1u); -+ uint32_t aligned_width, aligned_height; -+ uint32_t level_size; -+ -+ /* Once the levels get small enough, they drop from T to LT. */ -+ if (tiling_format == VC4_TILING_FORMAT_T && -+ size_is_lt(level_width, level_height, cpp)) { -+ tiling_format = VC4_TILING_FORMAT_LT; -+ } -+ -+ switch (tiling_format) { -+ case VC4_TILING_FORMAT_T: -+ aligned_width = round_up(level_width, utile_w * 8); -+ aligned_height = round_up(level_height, utile_h * 8); -+ break; -+ case VC4_TILING_FORMAT_LT: -+ aligned_width = round_up(level_width, utile_w); -+ aligned_height = round_up(level_height, utile_h); -+ break; -+ default: -+ aligned_width = round_up(level_width, utile_w); -+ aligned_height = level_height; -+ break; -+ } ++#include <linux/module.h> ++#include <linux/moduleparam.h> ++#include <linux/init.h> ++#include <linux/delay.h> ++#include <linux/pm.h> ++#include <linux/i2c.h> ++#include <linux/of_device.h> ++#include <linux/spi/spi.h> ++#include <linux/regmap.h> ++#include <linux/regulator/consumer.h> ++#include <linux/slab.h> ++#include <sound/core.h> ++#include <sound/pcm.h> ++#include <sound/pcm_params.h> ++#include <sound/soc.h> ++#include <sound/initval.h> ++#include <sound/tlv.h> + -+ level_size = aligned_width * cpp * aligned_height; ++#include <linux/kernel.h> ++#include <linux/string.h> ++#include <linux/fs.h> ++#include <asm/uaccess.h> + -+ if (offset < level_size) { -+ DRM_ERROR("Level %d (%dx%d -> %dx%d) size %db " -+ "overflowed buffer bounds (offset %d)\n", -+ i, level_width, level_height, -+ aligned_width, aligned_height, -+ level_size, offset); -+ goto fail; -+ } ++#include "tas5713.h" + -+ offset -= level_size; -+ } + -+ *validated_p0 = tex->paddr + p0; ++static struct i2c_client *i2c; + -+ return true; -+ fail: -+ DRM_INFO("Texture p0 at %d: 0x%08x\n", sample->p_offset[0], p0); -+ DRM_INFO("Texture p1 at %d: 0x%08x\n", sample->p_offset[1], p1); -+ DRM_INFO("Texture p2 at %d: 0x%08x\n", sample->p_offset[2], p2); -+ DRM_INFO("Texture p3 at %d: 0x%08x\n", sample->p_offset[3], p3); -+ return false; -+} ++struct tas5713_priv { ++ struct regmap *regmap; ++ int mclk_div; ++ struct snd_soc_codec *codec; ++}; + -+static int -+validate_shader_rec(struct drm_device *dev, -+ struct vc4_exec_info *exec, -+ struct vc4_shader_state *state) -+{ -+ uint32_t *src_handles; -+ void *pkt_u, *pkt_v; -+ enum shader_rec_reloc_type { -+ RELOC_CODE, -+ RELOC_VBO, -+ }; -+ struct shader_rec_reloc { -+ enum shader_rec_reloc_type type; -+ uint32_t offset; -+ }; -+ static const struct shader_rec_reloc gl_relocs[] = { -+ { RELOC_CODE, 4 }, /* fs */ -+ { RELOC_CODE, 16 }, /* vs */ -+ { RELOC_CODE, 28 }, /* cs */ -+ }; -+ static const struct shader_rec_reloc nv_relocs[] = { -+ { RELOC_CODE, 4 }, /* fs */ -+ { RELOC_VBO, 12 } -+ }; -+ const struct shader_rec_reloc *relocs; -+ struct drm_gem_cma_object *bo[ARRAY_SIZE(gl_relocs) + 8]; -+ uint32_t nr_attributes = 0, nr_fixed_relocs, nr_relocs, packet_size; -+ int i; -+ struct vc4_validated_shader_info *validated_shader; ++static struct tas5713_priv *priv_data; + -+ if (state->packet == VC4_PACKET_NV_SHADER_STATE) { -+ relocs = nv_relocs; -+ nr_fixed_relocs = ARRAY_SIZE(nv_relocs); + -+ packet_size = 16; -+ } else { -+ relocs = gl_relocs; -+ nr_fixed_relocs = ARRAY_SIZE(gl_relocs); + -+ nr_attributes = state->addr & 0x7; -+ if (nr_attributes == 0) -+ nr_attributes = 8; -+ packet_size = gl_shader_rec_size(state->addr); -+ } -+ nr_relocs = nr_fixed_relocs + nr_attributes; + -+ if (nr_relocs * 4 > exec->shader_rec_size) { -+ DRM_ERROR("overflowed shader recs reading %d handles " -+ "from %d bytes left\n", -+ nr_relocs, exec->shader_rec_size); -+ return -EINVAL; -+ } -+ src_handles = exec->shader_rec_u; -+ exec->shader_rec_u += nr_relocs * 4; -+ exec->shader_rec_size -= nr_relocs * 4; ++/* ++ * _ _ ___ _ ___ _ _ ++ * /_\ | | / __| /_\ / __|___ _ _| |_ _ _ ___| |___ ++ * / _ \| |__\__ \/ _ \ | (__/ _ \ ' \ _| '_/ _ \ (_-< ++ * /_/ \_\____|___/_/ \_\ \___\___/_||_\__|_| \___/_/__/ ++ * ++ */ + -+ if (packet_size > exec->shader_rec_size) { -+ DRM_ERROR("overflowed shader recs copying %db packet " -+ "from %d bytes left\n", -+ packet_size, exec->shader_rec_size); -+ return -EINVAL; -+ } -+ pkt_u = exec->shader_rec_u; -+ pkt_v = exec->shader_rec_v; -+ memcpy(pkt_v, pkt_u, packet_size); -+ exec->shader_rec_u += packet_size; -+ /* Shader recs have to be aligned to 16 bytes (due to the attribute -+ * flags being in the low bytes), so round the next validated shader -+ * rec address up. This should be safe, since we've got so many -+ * relocations in a shader rec packet. -+ */ -+ BUG_ON(roundup(packet_size, 16) - packet_size > nr_relocs * 4); -+ exec->shader_rec_v += roundup(packet_size, 16); -+ exec->shader_rec_size -= packet_size; ++static const DECLARE_TLV_DB_SCALE(tas5713_vol_tlv, -10000, 50, 1); + -+ for (i = 0; i < nr_relocs; i++) { -+ enum vc4_bo_mode mode; + -+ if (i < nr_fixed_relocs && relocs[i].type == RELOC_CODE) -+ mode = VC4_MODE_SHADER; -+ else -+ mode = VC4_MODE_RENDER; ++static const struct snd_kcontrol_new tas5713_snd_controls[] = { ++ SOC_SINGLE_TLV ("Master" , TAS5713_VOL_MASTER, 0, 248, 1, tas5713_vol_tlv), ++ SOC_DOUBLE_R_TLV("Channels" , TAS5713_VOL_CH1, TAS5713_VOL_CH2, 0, 248, 1, tas5713_vol_tlv) ++}; + -+ if (!vc4_use_bo(exec, src_handles[i], mode, &bo[i])) { -+ return false; -+ } -+ } + -+ for (i = 0; i < nr_fixed_relocs; i++) { -+ uint32_t o = relocs[i].offset; -+ uint32_t src_offset = *(uint32_t *)(pkt_u + o); -+ uint32_t *texture_handles_u; -+ void *uniform_data_u; -+ uint32_t tex; + -+ *(uint32_t *)(pkt_v + o) = bo[i]->paddr + src_offset; + -+ switch (relocs[i].type) { -+ case RELOC_CODE: -+ if (src_offset != 0) { -+ DRM_ERROR("Shaders must be at offset 0 of " -+ "the BO.\n"); -+ goto fail; -+ } ++/* ++ * __ __ _ _ ___ _ ++ * | \/ |__ _ __| |_ (_)_ _ ___ | \ _ _(_)_ _____ _ _ ++ * | |\/| / _` / _| ' \| | ' \/ -_) | |) | '_| \ V / -_) '_| ++ * |_| |_\__,_\__|_||_|_|_||_\___| |___/|_| |_|\_/\___|_| ++ * ++ */ + -+ validated_shader = to_vc4_bo(&bo[i]->base)->validated_shader; -+ if (!validated_shader) -+ goto fail; ++static int tas5713_hw_params(struct snd_pcm_substream *substream, ++ struct snd_pcm_hw_params *params, ++ struct snd_soc_dai *dai) ++{ ++ u16 blen = 0x00; + -+ if (validated_shader->uniforms_src_size > -+ exec->uniforms_size) { -+ DRM_ERROR("Uniforms src buffer overflow\n"); -+ goto fail; -+ } ++ struct snd_soc_codec *codec; ++ codec = dai->codec; ++ priv_data->codec = dai->codec; + -+ texture_handles_u = exec->uniforms_u; -+ uniform_data_u = (texture_handles_u + -+ validated_shader->num_texture_samples); ++ switch (params_format(params)) { ++ case SNDRV_PCM_FORMAT_S16_LE: ++ blen = 0x03; ++ break; ++ case SNDRV_PCM_FORMAT_S20_3LE: ++ blen = 0x1; ++ break; ++ case SNDRV_PCM_FORMAT_S24_LE: ++ blen = 0x04; ++ break; ++ case SNDRV_PCM_FORMAT_S32_LE: ++ blen = 0x05; ++ break; ++ default: ++ dev_err(dai->dev, "Unsupported word length: %u\n", ++ params_format(params)); ++ return -EINVAL; ++ } + -+ memcpy(exec->uniforms_v, uniform_data_u, -+ validated_shader->uniforms_size); ++ // set word length ++ snd_soc_update_bits(codec, TAS5713_SERIAL_DATA_INTERFACE, 0x7, blen); + -+ for (tex = 0; -+ tex < validated_shader->num_texture_samples; -+ tex++) { -+ if (!reloc_tex(exec, -+ uniform_data_u, -+ &validated_shader->texture_samples[tex], -+ texture_handles_u[tex])) { -+ goto fail; -+ } -+ } ++ return 0; ++} + -+ *(uint32_t *)(pkt_v + o + 4) = exec->uniforms_p; + -+ exec->uniforms_u += validated_shader->uniforms_src_size; -+ exec->uniforms_v += validated_shader->uniforms_size; -+ exec->uniforms_p += validated_shader->uniforms_size; ++static int tas5713_mute_stream(struct snd_soc_dai *dai, int mute, int stream) ++{ ++ unsigned int val = 0; + -+ break; ++ struct tas5713_priv *tas5713; ++ struct snd_soc_codec *codec = dai->codec; ++ tas5713 = snd_soc_codec_get_drvdata(codec); + -+ case RELOC_VBO: -+ break; -+ } ++ if (mute) { ++ val = TAS5713_SOFT_MUTE_ALL; + } + -+ for (i = 0; i < nr_attributes; i++) { -+ struct drm_gem_cma_object *vbo = bo[nr_fixed_relocs + i]; -+ uint32_t o = 36 + i * 8; -+ uint32_t offset = *(uint32_t *)(pkt_u + o + 0); -+ uint32_t attr_size = *(uint8_t *)(pkt_u + o + 4) + 1; -+ uint32_t stride = *(uint8_t *)(pkt_u + o + 5); -+ uint32_t max_index; -+ -+ if (state->addr & 0x8) -+ stride |= (*(uint32_t *)(pkt_u + 100 + i * 4)) & ~0xff; ++ return regmap_write(tas5713->regmap, TAS5713_SOFT_MUTE, val); ++} + -+ if (vbo->base.size < offset || -+ vbo->base.size - offset < attr_size) { -+ DRM_ERROR("BO offset overflow (%d + %d > %d)\n", -+ offset, attr_size, vbo->base.size); -+ return -EINVAL; -+ } + -+ if (stride != 0) { -+ max_index = ((vbo->base.size - offset - attr_size) / -+ stride); -+ if (state->max_index > max_index) { -+ DRM_ERROR("primitives use index %d out of supplied %d\n", -+ state->max_index, max_index); -+ return -EINVAL; -+ } -+ } ++static const struct snd_soc_dai_ops tas5713_dai_ops = { ++ .hw_params = tas5713_hw_params, ++ .mute_stream = tas5713_mute_stream, ++}; + -+ *(uint32_t *)(pkt_v + o) = vbo->paddr + offset; -+ } + -+ return 0; ++static struct snd_soc_dai_driver tas5713_dai = { ++ .name = "tas5713-hifi", ++ .playback = { ++ .stream_name = "Playback", ++ .channels_min = 2, ++ .channels_max = 2, ++ .rates = SNDRV_PCM_RATE_8000_48000, ++ .formats = (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE ), ++ }, ++ .ops = &tas5713_dai_ops, ++}; + -+fail: -+ return -EINVAL; -+} + -+int -+vc4_validate_shader_recs(struct drm_device *dev, -+ struct vc4_exec_info *exec) -+{ -+ uint32_t i; -+ int ret = 0; + -+ for (i = 0; i < exec->shader_state_count; i++) { -+ ret = validate_shader_rec(dev, exec, &exec->shader_state[i]); -+ if (ret) -+ return ret; -+ } + -+ return ret; -+} -diff --git a/drivers/gpu/drm/vc4/vc4_validate_shaders.c b/drivers/gpu/drm/vc4/vc4_validate_shaders.c -new file mode 100644 -index 0000000..0aab9d7 ---- /dev/null -+++ b/drivers/gpu/drm/vc4/vc4_validate_shaders.c -@@ -0,0 +1,521 @@ +/* -+ * Copyright © 2014 Broadcom -+ * -+ * Permission is hereby granted, free of charge, to any person obtaining a -+ * copy of this software and associated documentation files (the "Software"), -+ * to deal in the Software without restriction, including without limitation -+ * the rights to use, copy, modify, merge, publish, distribute, sublicense, -+ * and/or sell copies of the Software, and to permit persons to whom the -+ * Software is furnished to do so, subject to the following conditions: -+ * -+ * The above copyright notice and this permission notice (including the next -+ * paragraph) shall be included in all copies or substantial portions of the -+ * Software. ++ * ___ _ ___ _ ++ * / __|___ __| |___ __ | \ _ _(_)_ _____ _ _ ++ * | (__/ _ \/ _` / -_) _| | |) | '_| \ V / -_) '_| ++ * \___\___/\__,_\___\__| |___/|_| |_|\_/\___|_| + * -+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -+ * IN THE SOFTWARE. + */ + -+/** -+ * DOC: Shader validator for VC4. -+ * -+ * The VC4 has no IOMMU between it and system memory. So, a user with access -+ * to execute shaders could escalate privilege by overwriting system memory -+ * (using the VPM write address register in the general-purpose DMA mode) or -+ * reading system memory it shouldn't (reading it as a texture, or uniform -+ * data, or vertex data). -+ * -+ * This walks over a shader starting from some offset within a BO, ensuring -+ * that its accesses are appropriately bounded, and recording how many texture -+ * accesses are made and where so that we can do relocations for them in the -+ * uniform stream. -+ * -+ * The kernel API has shaders stored in user-mapped BOs. The BOs will be -+ * forcibly unmapped from the process before validation, and any cache of -+ * validated state will be flushed if the mapping is faulted back in. -+ * -+ * Storing the shaders in BOs means that the validation process will be slow -+ * due to uncached reads, but since shaders are long-lived and shader BOs are -+ * never actually modified, this shouldn't be a problem. -+ */ ++static int tas5713_remove(struct snd_soc_codec *codec) ++{ ++ struct tas5713_priv *tas5713; + -+#include "vc4_drv.h" -+#include "vc4_qpu_defines.h" ++ tas5713 = snd_soc_codec_get_drvdata(codec); + -+struct vc4_shader_validation_state { -+ struct vc4_texture_sample_info tmu_setup[2]; -+ int tmu_write_count[2]; ++ return 0; ++} + -+ /* For registers that were last written to by a MIN instruction with -+ * one argument being a uniform, the address of the uniform. -+ * Otherwise, ~0. -+ * -+ * This is used for the validation of direct address memory reads. -+ */ -+ uint32_t live_min_clamp_offsets[32 + 32 + 4]; -+ bool live_max_clamp_regs[32 + 32 + 4]; -+}; + -+static uint32_t -+waddr_to_live_reg_index(uint32_t waddr, bool is_b) ++static int tas5713_probe(struct snd_soc_codec *codec) +{ -+ if (waddr < 32) { -+ if (is_b) -+ return 32 + waddr; -+ else -+ return waddr; -+ } else if (waddr <= QPU_W_ACC3) { ++ struct tas5713_priv *tas5713; ++ int i, ret; + -+ return 64 + waddr - QPU_W_ACC0; -+ } else { -+ return ~0; -+ } -+} ++ i2c = container_of(codec->dev, struct i2c_client, dev); + -+static uint32_t -+raddr_add_a_to_live_reg_index(uint64_t inst) -+{ -+ uint32_t sig = QPU_GET_FIELD(inst, QPU_SIG); -+ uint32_t add_a = QPU_GET_FIELD(inst, QPU_ADD_A); -+ uint32_t raddr_a = QPU_GET_FIELD(inst, QPU_RADDR_A); -+ uint32_t raddr_b = QPU_GET_FIELD(inst, QPU_RADDR_B); ++ tas5713 = snd_soc_codec_get_drvdata(codec); + -+ if (add_a == QPU_MUX_A) { -+ return raddr_a; -+ } else if (add_a == QPU_MUX_B && sig != QPU_SIG_SMALL_IMM) { -+ return 32 + raddr_b; -+ } else if (add_a <= QPU_MUX_R3) { -+ return 64 + add_a; -+ } else { -+ return ~0; -+ } -+} ++ // Reset error ++ ret = snd_soc_write(codec, TAS5713_ERROR_STATUS, 0x00); ++ if (ret < 0) return ret; + -+static bool -+is_tmu_submit(uint32_t waddr) -+{ -+ return (waddr == QPU_W_TMU0_S || -+ waddr == QPU_W_TMU1_S); -+} ++ // Trim oscillator ++ ret = snd_soc_write(codec, TAS5713_OSC_TRIM, 0x00); ++ if (ret < 0) return ret; ++ msleep(1000); + -+static bool -+is_tmu_write(uint32_t waddr) -+{ -+ return (waddr >= QPU_W_TMU0_S && -+ waddr <= QPU_W_TMU1_B); -+} ++ // Reset error ++ ret = snd_soc_write(codec, TAS5713_ERROR_STATUS, 0x00); ++ if (ret < 0) return ret; + -+static bool -+record_validated_texture_sample(struct vc4_validated_shader_info *validated_shader, -+ struct vc4_shader_validation_state *validation_state, -+ int tmu) -+{ -+ uint32_t s = validated_shader->num_texture_samples; -+ int i; -+ struct vc4_texture_sample_info *temp_samples; ++ // Clock mode: 44/48kHz, MCLK=64xfs ++ ret = snd_soc_write(codec, TAS5713_CLOCK_CTRL, 0x60); ++ if (ret < 0) return ret; + -+ temp_samples = krealloc(validated_shader->texture_samples, -+ (s + 1) * sizeof(*temp_samples), -+ GFP_KERNEL); -+ if (!temp_samples) -+ return false; ++ // I2S 24bit ++ ret = snd_soc_write(codec, TAS5713_SERIAL_DATA_INTERFACE, 0x05); ++ if (ret < 0) return ret; ++ ++ // Unmute ++ ret = snd_soc_write(codec, TAS5713_SYSTEM_CTRL2, 0x00); ++ if (ret < 0) return ret; ++ ret = snd_soc_write(codec, TAS5713_SOFT_MUTE, 0x00); ++ if (ret < 0) return ret; + -+ memcpy(&temp_samples[s], -+ &validation_state->tmu_setup[tmu], -+ sizeof(*temp_samples)); ++ // Set volume to 0db ++ ret = snd_soc_write(codec, TAS5713_VOL_MASTER, 0x00); ++ if (ret < 0) return ret; + -+ validated_shader->num_texture_samples = s + 1; -+ validated_shader->texture_samples = temp_samples; ++ // Now start programming the default initialization sequence ++ for (i = 0; i < ARRAY_SIZE(tas5713_init_sequence); ++i) { ++ ret = i2c_master_send(i2c, ++ tas5713_init_sequence[i].data, ++ tas5713_init_sequence[i].size); ++ if (ret < 0) { ++ printk(KERN_INFO "TAS5713 CODEC PROBE: InitSeq returns: %d\n", ret); ++ } ++ } + -+ for (i = 0; i < 4; i++) -+ validation_state->tmu_setup[tmu].p_offset[i] = ~0; ++ // Unmute ++ ret = snd_soc_write(codec, TAS5713_SYSTEM_CTRL2, 0x00); ++ if (ret < 0) return ret; + -+ return true; ++ return 0; +} + -+static bool -+check_tmu_write(uint64_t inst, -+ struct vc4_validated_shader_info *validated_shader, -+ struct vc4_shader_validation_state *validation_state, -+ bool is_mul) -+{ -+ uint32_t waddr = (is_mul ? -+ QPU_GET_FIELD(inst, QPU_WADDR_MUL) : -+ QPU_GET_FIELD(inst, QPU_WADDR_ADD)); -+ uint32_t raddr_a = QPU_GET_FIELD(inst, QPU_RADDR_A); -+ uint32_t raddr_b = QPU_GET_FIELD(inst, QPU_RADDR_B); -+ int tmu = waddr > QPU_W_TMU0_B; -+ bool submit = is_tmu_submit(waddr); -+ bool is_direct = submit && validation_state->tmu_write_count[tmu] == 0; -+ uint32_t sig = QPU_GET_FIELD(inst, QPU_SIG); -+ -+ if (is_direct) { -+ uint32_t add_b = QPU_GET_FIELD(inst, QPU_ADD_B); -+ uint32_t clamp_reg, clamp_offset; -+ -+ if (sig == QPU_SIG_SMALL_IMM) { -+ DRM_ERROR("direct TMU read used small immediate\n"); -+ return false; -+ } + -+ /* Make sure that this texture load is an add of the base -+ * address of the UBO to a clamped offset within the UBO. -+ */ -+ if (is_mul || -+ QPU_GET_FIELD(inst, QPU_OP_ADD) != QPU_A_ADD) { -+ DRM_ERROR("direct TMU load wasn't an add\n"); -+ return false; -+ } ++static struct snd_soc_codec_driver soc_codec_dev_tas5713 = { ++ .probe = tas5713_probe, ++ .remove = tas5713_remove, ++ .controls = tas5713_snd_controls, ++ .num_controls = ARRAY_SIZE(tas5713_snd_controls), ++}; + -+ /* We assert that the the clamped address is the first -+ * argument, and the UBO base address is the second argument. -+ * This is arbitrary, but simpler than supporting flipping the -+ * two either way. -+ */ -+ clamp_reg = raddr_add_a_to_live_reg_index(inst); -+ if (clamp_reg == ~0) { -+ DRM_ERROR("direct TMU load wasn't clamped\n"); -+ return false; -+ } + -+ clamp_offset = validation_state->live_min_clamp_offsets[clamp_reg]; -+ if (clamp_offset == ~0) { -+ DRM_ERROR("direct TMU load wasn't clamped\n"); -+ return false; -+ } + -+ /* Store the clamp value's offset in p1 (see reloc_tex() in -+ * vc4_validate.c). -+ */ -+ validation_state->tmu_setup[tmu].p_offset[1] = -+ clamp_offset; + -+ if (!(add_b == QPU_MUX_A && raddr_a == QPU_R_UNIF) && -+ !(add_b == QPU_MUX_B && raddr_b == QPU_R_UNIF)) { -+ DRM_ERROR("direct TMU load didn't add to a uniform\n"); -+ return false; -+ } ++/* ++ * ___ ___ ___ ___ _ ++ * |_ _|_ ) __| | \ _ _(_)_ _____ _ _ ++ * | | / / (__ | |) | '_| \ V / -_) '_| ++ * |___/___\___| |___/|_| |_|\_/\___|_| ++ * ++ */ + -+ validation_state->tmu_setup[tmu].is_direct = true; -+ } else { -+ if (raddr_a == QPU_R_UNIF || (sig != QPU_SIG_SMALL_IMM && -+ raddr_b == QPU_R_UNIF)) { -+ DRM_ERROR("uniform read in the same instruction as " -+ "texture setup.\n"); -+ return false; -+ } -+ } ++static const struct reg_default tas5713_reg_defaults[] = { ++ { 0x07 ,0x80 }, // R7 - VOL_MASTER - -40dB ++ { 0x08 , 30 }, // R8 - VOL_CH1 - 0dB ++ { 0x09 , 30 }, // R9 - VOL_CH2 - 0dB ++ { 0x0A ,0x80 }, // R10 - VOL_HEADPHONE - -40dB ++}; + -+ if (validation_state->tmu_write_count[tmu] >= 4) { -+ DRM_ERROR("TMU%d got too many parameters before dispatch\n", -+ tmu); -+ return false; -+ } -+ validation_state->tmu_setup[tmu].p_offset[validation_state->tmu_write_count[tmu]] = -+ validated_shader->uniforms_size; -+ validation_state->tmu_write_count[tmu]++; -+ /* Since direct uses a RADDR uniform reference, it will get counted in -+ * check_instruction_reads() -+ */ -+ if (!is_direct) -+ validated_shader->uniforms_size += 4; + -+ if (submit) { -+ if (!record_validated_texture_sample(validated_shader, -+ validation_state, tmu)) { ++static bool tas5713_reg_volatile(struct device *dev, unsigned int reg) ++{ ++ switch (reg) { ++ case TAS5713_DEVICE_ID: ++ case TAS5713_ERROR_STATUS: ++ return true; ++ default: + return false; -+ } -+ -+ validation_state->tmu_write_count[tmu] = 0; + } -+ -+ return true; +} + -+static bool -+check_register_write(uint64_t inst, -+ struct vc4_validated_shader_info *validated_shader, -+ struct vc4_shader_validation_state *validation_state, -+ bool is_mul) -+{ -+ uint32_t waddr = (is_mul ? -+ QPU_GET_FIELD(inst, QPU_WADDR_MUL) : -+ QPU_GET_FIELD(inst, QPU_WADDR_ADD)); + -+ switch (waddr) { -+ case QPU_W_UNIFORMS_ADDRESS: -+ /* XXX: We'll probably need to support this for reladdr, but -+ * it's definitely a security-related one. -+ */ -+ DRM_ERROR("uniforms address load unsupported\n"); -+ return false; ++static const struct of_device_id tas5713_of_match[] = { ++ { .compatible = "ti,tas5713", }, ++ { } ++}; ++MODULE_DEVICE_TABLE(of, tas5713_of_match); + -+ case QPU_W_TLB_COLOR_MS: -+ case QPU_W_TLB_COLOR_ALL: -+ case QPU_W_TLB_Z: -+ /* These only interact with the tile buffer, not main memory, -+ * so they're safe. -+ */ -+ return true; + -+ case QPU_W_TMU0_S: -+ case QPU_W_TMU0_T: -+ case QPU_W_TMU0_R: -+ case QPU_W_TMU0_B: -+ case QPU_W_TMU1_S: -+ case QPU_W_TMU1_T: -+ case QPU_W_TMU1_R: -+ case QPU_W_TMU1_B: -+ return check_tmu_write(inst, validated_shader, validation_state, -+ is_mul); -+ -+ case QPU_W_HOST_INT: -+ case QPU_W_TMU_NOSWAP: -+ case QPU_W_TLB_ALPHA_MASK: -+ case QPU_W_MUTEX_RELEASE: -+ /* XXX: I haven't thought about these, so don't support them -+ * for now. -+ */ -+ DRM_ERROR("Unsupported waddr %d\n", waddr); -+ return false; ++static struct regmap_config tas5713_regmap_config = { ++ .reg_bits = 8, ++ .val_bits = 8, + -+ case QPU_W_VPM_ADDR: -+ DRM_ERROR("General VPM DMA unsupported\n"); -+ return false; ++ .max_register = TAS5713_MAX_REGISTER, ++ .volatile_reg = tas5713_reg_volatile, + -+ case QPU_W_VPM: -+ case QPU_W_VPMVCD_SETUP: -+ /* We allow VPM setup in general, even including VPM DMA -+ * configuration setup, because the (unsafe) DMA can only be -+ * triggered by QPU_W_VPM_ADDR writes. -+ */ -+ return true; ++ .cache_type = REGCACHE_RBTREE, ++ .reg_defaults = tas5713_reg_defaults, ++ .num_reg_defaults = ARRAY_SIZE(tas5713_reg_defaults), ++}; + -+ case QPU_W_TLB_STENCIL_SETUP: -+ return true; -+ } + -+ return true; -+} ++static int tas5713_i2c_probe(struct i2c_client *i2c, ++ const struct i2c_device_id *id) ++{ ++ int ret; + -+static void -+track_live_clamps(uint64_t inst, -+ struct vc4_validated_shader_info *validated_shader, -+ struct vc4_shader_validation_state *validation_state) -+{ -+ uint32_t op_add = QPU_GET_FIELD(inst, QPU_OP_ADD); -+ uint32_t waddr_add = QPU_GET_FIELD(inst, QPU_WADDR_ADD); -+ uint32_t waddr_mul = QPU_GET_FIELD(inst, QPU_WADDR_MUL); -+ uint32_t cond_add = QPU_GET_FIELD(inst, QPU_COND_ADD); -+ uint32_t add_a = QPU_GET_FIELD(inst, QPU_ADD_A); -+ uint32_t add_b = QPU_GET_FIELD(inst, QPU_ADD_B); -+ uint32_t raddr_a = QPU_GET_FIELD(inst, QPU_RADDR_A); -+ uint32_t raddr_b = QPU_GET_FIELD(inst, QPU_RADDR_B); -+ uint32_t sig = QPU_GET_FIELD(inst, QPU_SIG); -+ bool ws = inst & QPU_WS; -+ uint32_t lri_add_a, lri_add, lri_mul; -+ bool add_a_is_min_0; -+ -+ /* Check whether OP_ADD's A argumennt comes from a live MAX(x, 0), -+ * before we clear previous live state. -+ */ -+ lri_add_a = raddr_add_a_to_live_reg_index(inst); -+ add_a_is_min_0 = (lri_add_a != ~0 && -+ validation_state->live_max_clamp_regs[lri_add_a]); -+ -+ /* Clear live state for registers written by our instruction. */ -+ lri_add = waddr_to_live_reg_index(waddr_add, ws); -+ lri_mul = waddr_to_live_reg_index(waddr_mul, !ws); -+ if (lri_mul != ~0) { -+ validation_state->live_max_clamp_regs[lri_mul] = false; -+ validation_state->live_min_clamp_offsets[lri_mul] = ~0; -+ } -+ if (lri_add != ~0) { -+ validation_state->live_max_clamp_regs[lri_add] = false; -+ validation_state->live_min_clamp_offsets[lri_add] = ~0; -+ } else { -+ /* Nothing further to do for live tracking, since only ADDs -+ * generate new live clamp registers. -+ */ -+ return; ++ priv_data = devm_kzalloc(&i2c->dev, sizeof *priv_data, GFP_KERNEL); ++ if (!priv_data) ++ return -ENOMEM; ++ ++ priv_data->regmap = devm_regmap_init_i2c(i2c, &tas5713_regmap_config); ++ if (IS_ERR(priv_data->regmap)) { ++ ret = PTR_ERR(priv_data->regmap); ++ return ret; + } + -+ /* Now, handle remaining live clamp tracking for the ADD operation. */ ++ i2c_set_clientdata(i2c, priv_data); + -+ if (cond_add != QPU_COND_ALWAYS) -+ return; ++ ret = snd_soc_register_codec(&i2c->dev, ++ &soc_codec_dev_tas5713, &tas5713_dai, 1); + -+ if (op_add == QPU_A_MAX) { -+ /* Track live clamps of a value to a minimum of 0 (in either -+ * arg). -+ */ -+ if (sig != QPU_SIG_SMALL_IMM || raddr_b != 0 || -+ (add_a != QPU_MUX_B && add_b != QPU_MUX_B)) { -+ return; -+ } ++ return ret; ++} + -+ validation_state->live_max_clamp_regs[lri_add] = true; -+ } if (op_add == QPU_A_MIN) { -+ /* Track live clamps of a value clamped to a minimum of 0 and -+ * a maximum of some uniform's offset. -+ */ -+ if (!add_a_is_min_0) -+ return; + -+ if (!(add_b == QPU_MUX_A && raddr_a == QPU_R_UNIF) && -+ !(add_b == QPU_MUX_B && raddr_b == QPU_R_UNIF && -+ sig != QPU_SIG_SMALL_IMM)) { -+ return; -+ } ++static int tas5713_i2c_remove(struct i2c_client *i2c) ++{ ++ snd_soc_unregister_codec(&i2c->dev); ++ i2c_set_clientdata(i2c, NULL); + -+ validation_state->live_min_clamp_offsets[lri_add] = -+ validated_shader->uniforms_size; -+ } ++ kfree(priv_data); ++ ++ return 0; +} + -+static bool -+check_instruction_writes(uint64_t inst, -+ struct vc4_validated_shader_info *validated_shader, -+ struct vc4_shader_validation_state *validation_state) -+{ -+ uint32_t waddr_add = QPU_GET_FIELD(inst, QPU_WADDR_ADD); -+ uint32_t waddr_mul = QPU_GET_FIELD(inst, QPU_WADDR_MUL); -+ bool ok; + -+ if (is_tmu_write(waddr_add) && is_tmu_write(waddr_mul)) { -+ DRM_ERROR("ADD and MUL both set up textures\n"); -+ return false; -+ } ++static const struct i2c_device_id tas5713_i2c_id[] = { ++ { "tas5713", 0 }, ++ { } ++}; + -+ ok = (check_register_write(inst, validated_shader, validation_state, false) && -+ check_register_write(inst, validated_shader, validation_state, true)); ++MODULE_DEVICE_TABLE(i2c, tas5713_i2c_id); + -+ track_live_clamps(inst, validated_shader, validation_state); + -+ return ok; -+} ++static struct i2c_driver tas5713_i2c_driver = { ++ .driver = { ++ .name = "tas5713", ++ .owner = THIS_MODULE, ++ .of_match_table = tas5713_of_match, ++ }, ++ .probe = tas5713_i2c_probe, ++ .remove = tas5713_i2c_remove, ++ .id_table = tas5713_i2c_id ++}; + -+static bool -+check_instruction_reads(uint64_t inst, -+ struct vc4_validated_shader_info *validated_shader) ++ ++static int __init tas5713_modinit(void) +{ -+ uint32_t raddr_a = QPU_GET_FIELD(inst, QPU_RADDR_A); -+ uint32_t raddr_b = QPU_GET_FIELD(inst, QPU_RADDR_B); -+ uint32_t sig = QPU_GET_FIELD(inst, QPU_SIG); ++ int ret = 0; + -+ if (raddr_a == QPU_R_UNIF || -+ (raddr_b == QPU_R_UNIF && sig != QPU_SIG_SMALL_IMM)) { -+ /* This can't overflow the uint32_t, because we're reading 8 -+ * bytes of instruction to increment by 4 here, so we'd -+ * already be OOM. -+ */ -+ validated_shader->uniforms_size += 4; ++ ret = i2c_add_driver(&tas5713_i2c_driver); ++ if (ret) { ++ printk(KERN_ERR "Failed to register tas5713 I2C driver: %d\n", ++ ret); + } + -+ return true; ++ return ret; +} ++module_init(tas5713_modinit); ++ + -+struct vc4_validated_shader_info * -+vc4_validate_shader(struct drm_gem_cma_object *shader_obj) ++static void __exit tas5713_exit(void) +{ -+ bool found_shader_end = false; -+ int shader_end_ip = 0; -+ uint32_t ip, max_ip; -+ uint64_t *shader; -+ struct vc4_validated_shader_info *validated_shader; -+ struct vc4_shader_validation_state validation_state; -+ int i; ++ i2c_del_driver(&tas5713_i2c_driver); ++} ++module_exit(tas5713_exit); + -+ memset(&validation_state, 0, sizeof(validation_state)); + -+ for (i = 0; i < 8; i++) -+ validation_state.tmu_setup[i / 4].p_offset[i % 4] = ~0; -+ for (i = 0; i < ARRAY_SIZE(validation_state.live_min_clamp_offsets); i++) -+ validation_state.live_min_clamp_offsets[i] = ~0; ++MODULE_AUTHOR("Sebastian Eickhoff <basti.eickhoff@googlemail.com>"); ++MODULE_DESCRIPTION("ASoC driver for TAS5713"); ++MODULE_LICENSE("GPL v2"); +diff --git a/sound/soc/codecs/tas5713.h b/sound/soc/codecs/tas5713.h +new file mode 100644 +index 0000000..8f019e0 +--- /dev/null ++++ b/sound/soc/codecs/tas5713.h +@@ -0,0 +1,210 @@ ++/* ++ * ASoC Driver for TAS5713 ++ * ++ * Author: Sebastian Eickhoff <basti.eickhoff@googlemail.com> ++ * Copyright 2014 ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * version 2 as published by the Free Software Foundation. ++ * ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * General Public License for more details. ++ */ + -+ shader = shader_obj->vaddr; -+ max_ip = shader_obj->base.size / sizeof(uint64_t); ++#ifndef _TAS5713_H ++#define _TAS5713_H + -+ validated_shader = kcalloc(sizeof(*validated_shader), 1, GFP_KERNEL); -+ if (!validated_shader) -+ return NULL; + -+ for (ip = 0; ip < max_ip; ip++) { -+ uint64_t inst = shader[ip]; -+ uint32_t sig = QPU_GET_FIELD(inst, QPU_SIG); -+ -+ switch (sig) { -+ case QPU_SIG_NONE: -+ case QPU_SIG_WAIT_FOR_SCOREBOARD: -+ case QPU_SIG_SCOREBOARD_UNLOCK: -+ case QPU_SIG_COLOR_LOAD: -+ case QPU_SIG_LOAD_TMU0: -+ case QPU_SIG_LOAD_TMU1: -+ case QPU_SIG_PROG_END: -+ case QPU_SIG_SMALL_IMM: -+ if (!check_instruction_writes(inst, validated_shader, -+ &validation_state)) { -+ DRM_ERROR("Bad write at ip %d\n", ip); -+ goto fail; -+ } ++// TAS5713 I2C-bus register addresses + -+ if (!check_instruction_reads(inst, validated_shader)) -+ goto fail; ++#define TAS5713_CLOCK_CTRL 0x00 ++#define TAS5713_DEVICE_ID 0x01 ++#define TAS5713_ERROR_STATUS 0x02 ++#define TAS5713_SYSTEM_CTRL1 0x03 ++#define TAS5713_SERIAL_DATA_INTERFACE 0x04 ++#define TAS5713_SYSTEM_CTRL2 0x05 ++#define TAS5713_SOFT_MUTE 0x06 ++#define TAS5713_VOL_MASTER 0x07 ++#define TAS5713_VOL_CH1 0x08 ++#define TAS5713_VOL_CH2 0x09 ++#define TAS5713_VOL_HEADPHONE 0x0A ++#define TAS5713_VOL_CONFIG 0x0E ++#define TAS5713_MODULATION_LIMIT 0x10 ++#define TAS5713_IC_DLY_CH1 0x11 ++#define TAS5713_IC_DLY_CH2 0x12 ++#define TAS5713_IC_DLY_CH3 0x13 ++#define TAS5713_IC_DLY_CH4 0x14 + -+ if (sig == QPU_SIG_PROG_END) { -+ found_shader_end = true; -+ shader_end_ip = ip; -+ } ++#define TAS5713_START_STOP_PERIOD 0x1A ++#define TAS5713_OSC_TRIM 0x1B ++#define TAS5713_BKND_ERR 0x1C + -+ break; ++#define TAS5713_INPUT_MUX 0x20 ++#define TAS5713_SRC_SELECT_CH4 0x21 ++#define TAS5713_PWM_MUX 0x25 + -+ case QPU_SIG_LOAD_IMM: -+ if (!check_instruction_writes(inst, validated_shader, -+ &validation_state)) { -+ DRM_ERROR("Bad LOAD_IMM write at ip %d\n", ip); -+ goto fail; -+ } -+ break; ++#define TAS5713_CH1_BQ0 0x29 ++#define TAS5713_CH1_BQ1 0x2A ++#define TAS5713_CH1_BQ2 0x2B ++#define TAS5713_CH1_BQ3 0x2C ++#define TAS5713_CH1_BQ4 0x2D ++#define TAS5713_CH1_BQ5 0x2E ++#define TAS5713_CH1_BQ6 0x2F ++#define TAS5713_CH1_BQ7 0x58 ++#define TAS5713_CH1_BQ8 0x59 + -+ default: -+ DRM_ERROR("Unsupported QPU signal %d at " -+ "instruction %d\n", sig, ip); -+ goto fail; -+ } ++#define TAS5713_CH2_BQ0 0x30 ++#define TAS5713_CH2_BQ1 0x31 ++#define TAS5713_CH2_BQ2 0x32 ++#define TAS5713_CH2_BQ3 0x33 ++#define TAS5713_CH2_BQ4 0x34 ++#define TAS5713_CH2_BQ5 0x35 ++#define TAS5713_CH2_BQ6 0x36 ++#define TAS5713_CH2_BQ7 0x5C ++#define TAS5713_CH2_BQ8 0x5D + -+ /* There are two delay slots after program end is signaled -+ * that are still executed, then we're finished. -+ */ -+ if (found_shader_end && ip == shader_end_ip + 2) -+ break; -+ } ++#define TAS5713_CH4_BQ0 0x5A ++#define TAS5713_CH4_BQ1 0x5B ++#define TAS5713_CH3_BQ0 0x5E ++#define TAS5713_CH3_BQ1 0x5F + -+ if (ip == max_ip) { -+ DRM_ERROR("shader failed to terminate before " -+ "shader BO end at %d\n", -+ shader_obj->base.size); -+ goto fail; -+ } ++#define TAS5713_DRC1_SOFTENING_FILTER_ALPHA_OMEGA 0x3B ++#define TAS5713_DRC1_ATTACK_RELEASE_RATE 0x3C ++#define TAS5713_DRC2_SOFTENING_FILTER_ALPHA_OMEGA 0x3E ++#define TAS5713_DRC2_ATTACK_RELEASE_RATE 0x3F ++#define TAS5713_DRC1_ATTACK_RELEASE_THRES 0x40 ++#define TAS5713_DRC2_ATTACK_RELEASE_THRES 0x43 ++#define TAS5713_DRC_CTRL 0x46 + -+ /* Again, no chance of integer overflow here because the worst case -+ * scenario is 8 bytes of uniforms plus handles per 8-byte -+ * instruction. -+ */ -+ validated_shader->uniforms_src_size = -+ (validated_shader->uniforms_size + -+ 4 * validated_shader->num_texture_samples); ++#define TAS5713_BANK_SW_CTRL 0x50 ++#define TAS5713_CH1_OUTPUT_MIXER 0x51 ++#define TAS5713_CH2_OUTPUT_MIXER 0x52 ++#define TAS5713_CH1_INPUT_MIXER 0x53 ++#define TAS5713_CH2_INPUT_MIXER 0x54 ++#define TAS5713_OUTPUT_POST_SCALE 0x56 ++#define TAS5713_OUTPUT_PRESCALE 0x57 + -+ return validated_shader; ++#define TAS5713_IDF_POST_SCALE 0x62 + -+fail: -+ if (validated_shader) { -+ kfree(validated_shader->texture_samples); -+ kfree(validated_shader); -+ } -+ return NULL; -+} -diff --git a/include/uapi/drm/vc4_drm.h b/include/uapi/drm/vc4_drm.h -new file mode 100644 -index 0000000..499daae5 ---- /dev/null -+++ b/include/uapi/drm/vc4_drm.h -@@ -0,0 +1,229 @@ -+/* -+ * Copyright © 2014-2015 Broadcom -+ * -+ * Permission is hereby granted, free of charge, to any person obtaining a -+ * copy of this software and associated documentation files (the "Software"), -+ * to deal in the Software without restriction, including without limitation -+ * the rights to use, copy, modify, merge, publish, distribute, sublicense, -+ * and/or sell copies of the Software, and to permit persons to whom the -+ * Software is furnished to do so, subject to the following conditions: -+ * -+ * The above copyright notice and this permission notice (including the next -+ * paragraph) shall be included in all copies or substantial portions of the -+ * Software. -+ * -+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -+ * IN THE SOFTWARE. -+ */ -+ -+#ifndef _UAPI_VC4_DRM_H_ -+#define _UAPI_VC4_DRM_H_ -+ -+#include <drm/drm.h> -+ -+#define DRM_VC4_SUBMIT_CL 0x00 -+#define DRM_VC4_WAIT_SEQNO 0x01 -+#define DRM_VC4_WAIT_BO 0x02 -+#define DRM_VC4_CREATE_BO 0x03 -+#define DRM_VC4_MMAP_BO 0x04 -+#define DRM_VC4_CREATE_SHADER_BO 0x05 -+ -+#define DRM_IOCTL_VC4_SUBMIT_CL DRM_IOWR( DRM_COMMAND_BASE + DRM_VC4_SUBMIT_CL, struct drm_vc4_submit_cl) -+#define DRM_IOCTL_VC4_WAIT_SEQNO DRM_IOWR( DRM_COMMAND_BASE + DRM_VC4_WAIT_SEQNO, struct drm_vc4_wait_seqno) -+#define DRM_IOCTL_VC4_WAIT_BO DRM_IOWR( DRM_COMMAND_BASE + DRM_VC4_WAIT_BO, struct drm_vc4_wait_bo) -+#define DRM_IOCTL_VC4_CREATE_BO DRM_IOWR( DRM_COMMAND_BASE + DRM_VC4_CREATE_BO, struct drm_vc4_create_bo) -+#define DRM_IOCTL_VC4_MMAP_BO DRM_IOWR( DRM_COMMAND_BASE + DRM_VC4_MMAP_BO, struct drm_vc4_mmap_bo) -+#define DRM_IOCTL_VC4_CREATE_SHADER_BO DRM_IOWR( DRM_COMMAND_BASE + DRM_VC4_CREATE_SHADER_BO, struct drm_vc4_create_shader_bo) -+ -+struct drm_vc4_submit_rcl_surface { -+ uint32_t hindex; /* Handle index, or ~0 if not present. */ -+ uint32_t offset; /* Offset to start of buffer. */ -+ /* -+ * Bits for either render config (color_ms_write) or load/store packet. -+ */ -+ uint16_t bits; -+ uint16_t pad; -+}; ++#define TAS5713_CH1_INLINE_MIXER 0x70 ++#define TAS5713_CH1_INLINE_DRC_EN_MIXER 0x71 ++#define TAS5713_CH1_R_CHANNEL_MIXER 0x72 ++#define TAS5713_CH1_L_CHANNEL_MIXER 0x73 ++#define TAS5713_CH2_INLINE_MIXER 0x74 ++#define TAS5713_CH2_INLINE_DRC_EN_MIXER 0x75 ++#define TAS5713_CH2_L_CHANNEL_MIXER 0x76 ++#define TAS5713_CH2_R_CHANNEL_MIXER 0x77 + -+/** -+ * struct drm_vc4_submit_cl - ioctl argument for submitting commands to the 3D -+ * engine. -+ * -+ * Drivers typically use GPU BOs to store batchbuffers / command lists and -+ * their associated state. However, because the VC4 lacks an MMU, we have to -+ * do validation of memory accesses by the GPU commands. If we were to store -+ * our commands in BOs, we'd need to do uncached readback from them to do the -+ * validation process, which is too expensive. Instead, userspace accumulates -+ * commands and associated state in plain memory, then the kernel copies the -+ * data to its own address space, and then validates and stores it in a GPU -+ * BO. -+ */ -+struct drm_vc4_submit_cl { -+ /* Pointer to the binner command list. -+ * -+ * This is the first set of commands executed, which runs the -+ * coordinate shader to determine where primitives land on the screen, -+ * then writes out the state updates and draw calls necessary per tile -+ * to the tile allocation BO. -+ */ -+ uint64_t bin_cl; ++#define TAS5713_UPDATE_DEV_ADDR_KEY 0xF8 ++#define TAS5713_UPDATE_DEV_ADDR_REG 0xF9 + -+ /* Pointer to the shader records. -+ * -+ * Shader records are the structures read by the hardware that contain -+ * pointers to uniforms, shaders, and vertex attributes. The -+ * reference to the shader record has enough information to determine -+ * how many pointers are necessary (fixed number for shaders/uniforms, -+ * and an attribute count), so those BO indices into bo_handles are -+ * just stored as uint32_ts before each shader record passed in. -+ */ -+ uint64_t shader_rec; ++#define TAS5713_REGISTER_COUNT 0x46 ++#define TAS5713_MAX_REGISTER 0xF9 + -+ /* Pointer to uniform data and texture handles for the textures -+ * referenced by the shader. -+ * -+ * For each shader state record, there is a set of uniform data in the -+ * order referenced by the record (FS, VS, then CS). Each set of -+ * uniform data has a uint32_t index into bo_handles per texture -+ * sample operation, in the order the QPU_W_TMUn_S writes appear in -+ * the program. Following the texture BO handle indices is the actual -+ * uniform data. -+ * -+ * The individual uniform state blocks don't have sizes passed in, -+ * because the kernel has to determine the sizes anyway during shader -+ * code validation. -+ */ -+ uint64_t uniforms; -+ uint64_t bo_handles; -+ -+ /* Size in bytes of the binner command list. */ -+ uint32_t bin_cl_size; -+ /* Size in bytes of the set of shader records. */ -+ uint32_t shader_rec_size; -+ /* Number of shader records. -+ * -+ * This could just be computed from the contents of shader_records and -+ * the address bits of references to them from the bin CL, but it -+ * keeps the kernel from having to resize some allocations it makes. -+ */ -+ uint32_t shader_rec_count; -+ /* Size in bytes of the uniform state. */ -+ uint32_t uniforms_size; -+ -+ /* Number of BO handles passed in (size is that times 4). */ -+ uint32_t bo_handle_count; -+ -+ /* RCL setup: */ -+ uint16_t width; -+ uint16_t height; -+ uint8_t min_x_tile; -+ uint8_t min_y_tile; -+ uint8_t max_x_tile; -+ uint8_t max_y_tile; -+ struct drm_vc4_submit_rcl_surface color_read; -+ struct drm_vc4_submit_rcl_surface color_ms_write; -+ struct drm_vc4_submit_rcl_surface zs_read; -+ struct drm_vc4_submit_rcl_surface zs_write; -+ uint32_t clear_color[2]; -+ uint32_t clear_z; -+ uint8_t clear_s; -+ -+ uint32_t pad:24; -+ -+#define VC4_SUBMIT_CL_USE_CLEAR_COLOR (1 << 0) -+ uint32_t flags; + -+ /* Returned value of the seqno of this render job (for the -+ * wait ioctl). -+ */ -+ uint64_t seqno; -+}; ++// Bitmasks for registers ++#define TAS5713_SOFT_MUTE_ALL 0x07 + -+/** -+ * struct drm_vc4_wait_seqno - ioctl argument for waiting for -+ * DRM_VC4_SUBMIT_CL completion using its returned seqno. -+ * -+ * timeout_ns is the timeout in nanoseconds, where "0" means "don't -+ * block, just return the status." -+ */ -+struct drm_vc4_wait_seqno { -+ uint64_t seqno; -+ uint64_t timeout_ns; -+}; + -+/** -+ * struct drm_vc4_wait_bo - ioctl argument for waiting for -+ * completion of the last DRM_VC4_SUBMIT_CL on a BO. -+ * -+ * This is useful for cases where multiple processes might be -+ * rendering to a BO and you want to wait for all rendering to be -+ * completed. -+ */ -+struct drm_vc4_wait_bo { -+ uint32_t handle; -+ uint32_t pad; -+ uint64_t timeout_ns; -+}; + -+/** -+ * struct drm_vc4_create_bo - ioctl argument for creating VC4 BOs. -+ * -+ * There are currently no values for the flags argument, but it may be -+ * used in a future extension. -+ */ -+struct drm_vc4_create_bo { -+ uint32_t size; -+ uint32_t flags; -+ /** Returned GEM handle for the BO. */ -+ uint32_t handle; -+ uint32_t pad; ++struct tas5713_init_command { ++ const int size; ++ const char *const data; +}; + -+/** -+ * struct drm_vc4_create_shader_bo - ioctl argument for creating VC4 -+ * shader BOs. -+ * -+ * Since allowing a shader to be overwritten while it's also being -+ * executed from would allow privlege escalation, shaders must be -+ * created using this ioctl, and they can't be mmapped later. -+ */ -+struct drm_vc4_create_shader_bo { -+ /* Size of the data argument. */ -+ uint32_t size; -+ /* Flags, currently must be 0. */ -+ uint32_t flags; -+ -+ /* Pointer to the data. */ -+ uint64_t data; -+ -+ /** Returned GEM handle for the BO. */ -+ uint32_t handle; -+ /* Pad, must be 0. */ -+ uint32_t pad; -+}; ++static const struct tas5713_init_command tas5713_init_sequence[] = { + -+/** -+ * struct drm_vc4_mmap_bo - ioctl argument for mapping VC4 BOs. -+ * -+ * This doesn't actually perform an mmap. Instead, it returns the -+ * offset you need to use in an mmap on the DRM device node. This -+ * means that tools like valgrind end up knowing about the mapped -+ * memory. -+ * -+ * There are currently no values for the flags argument, but it may be -+ * used in a future extension. -+ */ -+struct drm_vc4_mmap_bo { -+ /** Handle for the object being mapped. */ -+ uint32_t handle; -+ uint32_t flags; -+ /** offset into the drm node to use for subsequent mmap call. */ -+ uint64_t offset; ++ // Trim oscillator ++ { .size = 2, .data = "\x1B\x00" }, ++ // System control register 1 (0x03): block DC ++ { .size = 2, .data = "\x03\x80" }, ++ // Mute everything ++ { .size = 2, .data = "\x05\x40" }, ++ // Modulation limit register (0x10): 97.7% ++ { .size = 2, .data = "\x10\x02" }, ++ // Interchannel delay registers ++ // (0x11, 0x12, 0x13, and 0x14): BD mode ++ { .size = 2, .data = "\x11\xB8" }, ++ { .size = 2, .data = "\x12\x60" }, ++ { .size = 2, .data = "\x13\xA0" }, ++ { .size = 2, .data = "\x14\x48" }, ++ // PWM shutdown group register (0x19): no shutdown ++ { .size = 2, .data = "\x19\x00" }, ++ // Input multiplexer register (0x20): BD mode ++ { .size = 2, .data = "\x20\x00\x89\x77\x72" }, ++ // PWM output mux register (0x25) ++ // Channel 1 --> OUTA, channel 1 neg --> OUTB ++ // Channel 2 --> OUTC, channel 2 neg --> OUTD ++ { .size = 5, .data = "\x25\x01\x02\x13\x45" }, ++ // DRC control (0x46): DRC off ++ { .size = 5, .data = "\x46\x00\x00\x00\x00" }, ++ // BKND_ERR register (0x1C): 299ms reset period ++ { .size = 2, .data = "\x1C\x07" }, ++ // Mute channel 3 ++ { .size = 2, .data = "\x0A\xFF" }, ++ // Volume configuration register (0x0E): volume slew 512 steps ++ { .size = 2, .data = "\x0E\x90" }, ++ // Clock control register (0x00): 44/48kHz, MCLK=64xfs ++ { .size = 2, .data = "\x00\x60" }, ++ // Bank switch and eq control (0x50): no bank switching ++ { .size = 5, .data = "\x50\x00\x00\x00\x00" }, ++ // Volume registers (0x07, 0x08, 0x09, 0x0A) ++ { .size = 2, .data = "\x07\x20" }, ++ { .size = 2, .data = "\x08\x30" }, ++ { .size = 2, .data = "\x09\x30" }, ++ { .size = 2, .data = "\x0A\xFF" }, ++ // 0x72, 0x73, 0x76, 0x77 input mixer: ++ // no intermix between channels ++ { .size = 5, .data = "\x72\x00\x00\x00\x00" }, ++ { .size = 5, .data = "\x73\x00\x80\x00\x00" }, ++ { .size = 5, .data = "\x76\x00\x00\x00\x00" }, ++ { .size = 5, .data = "\x77\x00\x80\x00\x00" }, ++ // 0x70, 0x71, 0x74, 0x75 inline DRC mixer: ++ // no inline DRC inmix ++ { .size = 5, .data = "\x70\x00\x80\x00\x00" }, ++ { .size = 5, .data = "\x71\x00\x00\x00\x00" }, ++ { .size = 5, .data = "\x74\x00\x80\x00\x00" }, ++ { .size = 5, .data = "\x75\x00\x00\x00\x00" }, ++ // 0x56, 0x57 Output scale ++ { .size = 5, .data = "\x56\x00\x80\x00\x00" }, ++ { .size = 5, .data = "\x57\x00\x02\x00\x00" }, ++ // 0x3B, 0x3c ++ { .size = 9, .data = "\x3B\x00\x08\x00\x00\x00\x78\x00\x00" }, ++ { .size = 9, .data = "\x3C\x00\x00\x01\x00\xFF\xFF\xFF\x00" }, ++ { .size = 9, .data = "\x3E\x00\x08\x00\x00\x00\x78\x00\x00" }, ++ { .size = 9, .data = "\x3F\x00\x00\x01\x00\xFF\xFF\xFF\x00" }, ++ { .size = 9, .data = "\x40\x00\x00\x01\x00\xFF\xFF\xFF\x00" }, ++ { .size = 9, .data = "\x43\x00\x00\x01\x00\xFF\xFF\xFF\x00" }, ++ // 0x51, 0x52: output mixer ++ { .size = 9, .data = "\x51\x00\x80\x00\x00\x00\x00\x00\x00" }, ++ { .size = 9, .data = "\x52\x00\x80\x00\x00\x00\x00\x00\x00" }, ++ // PEQ defaults ++ { .size = 21, .data = "\x29\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, ++ { .size = 21, .data = "\x2A\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, ++ { .size = 21, .data = "\x2B\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, ++ { .size = 21, .data = "\x2C\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, ++ { .size = 21, .data = "\x2D\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, ++ { .size = 21, .data = "\x2E\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, ++ { .size = 21, .data = "\x2F\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, ++ { .size = 21, .data = "\x30\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, ++ { .size = 21, .data = "\x31\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, ++ { .size = 21, .data = "\x32\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, ++ { .size = 21, .data = "\x33\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, ++ { .size = 21, .data = "\x34\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, ++ { .size = 21, .data = "\x35\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, ++ { .size = 21, .data = "\x36\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, ++ { .size = 21, .data = "\x58\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, ++ { .size = 21, .data = "\x59\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, ++ { .size = 21, .data = "\x5C\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, ++ { .size = 21, .data = "\x5D\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, ++ { .size = 21, .data = "\x5E\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, ++ { .size = 21, .data = "\x5F\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, ++ { .size = 21, .data = "\x5A\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, ++ { .size = 21, .data = "\x5B\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, +}; + -+#endif /* _UAPI_VC4_DRM_H_ */ - -From aa579c7485e1bae681c50b223e89cd658dd0b2c1 Mon Sep 17 00:00:00 2001 -From: Eric Anholt <eric@anholt.net> -Date: Wed, 14 Oct 2015 11:32:14 -0700 -Subject: [PATCH 092/170] drm/vc4: Force HDMI to connected. - -For some reason on the downstream tree, the HPD GPIO isn't working. - -Signed-off-by: Eric Anholt <eric@anholt.net> ---- - drivers/gpu/drm/vc4/vc4_hdmi.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c -index da9a36d..d15c529 100644 ---- a/drivers/gpu/drm/vc4/vc4_hdmi.c -+++ b/drivers/gpu/drm/vc4/vc4_hdmi.c -@@ -164,6 +164,8 @@ vc4_hdmi_connector_detect(struct drm_connector *connector, bool force) - struct drm_device *dev = connector->dev; - struct vc4_dev *vc4 = to_vc4_dev(dev); - -+ return connector_status_connected; -+ - if (vc4->hdmi->hpd_gpio) { - if (gpio_get_value(vc4->hdmi->hpd_gpio)) - return connector_status_connected; - -From edb828d91374e8fa4f05d68be008c40d4f9a158d Mon Sep 17 00:00:00 2001 -From: Eric Anholt <eric@anholt.net> -Date: Mon, 19 Oct 2015 08:23:18 -0700 -Subject: [PATCH 093/170] drm/vc4: bo cache locking fixes. - -Signed-off-by: Eric Anholt <eric@anholt.net> ---- - drivers/gpu/drm/vc4/vc4_bo.c | 32 ++++++++++++++++++-------------- - drivers/gpu/drm/vc4/vc4_drv.h | 2 +- - 2 files changed, 19 insertions(+), 15 deletions(-) - -diff --git a/drivers/gpu/drm/vc4/vc4_bo.c b/drivers/gpu/drm/vc4/vc4_bo.c -index bfa605f..af0fde6 100644 ---- a/drivers/gpu/drm/vc4/vc4_bo.c -+++ b/drivers/gpu/drm/vc4/vc4_bo.c -@@ -112,14 +112,14 @@ void vc4_bo_cache_purge(struct drm_device *dev) - { - struct vc4_dev *vc4 = to_vc4_dev(dev); - -- spin_lock(&vc4->bo_lock); -+ mutex_lock(&vc4->bo_lock); - while (!list_empty(&vc4->bo_cache.time_list)) { - struct vc4_bo *bo = list_last_entry(&vc4->bo_cache.time_list, - struct vc4_bo, unref_head); - vc4_bo_remove_from_cache(bo); - vc4_bo_destroy(bo); - } -- spin_unlock(&vc4->bo_lock); -+ mutex_unlock(&vc4->bo_lock); - } - - struct vc4_bo *vc4_bo_create(struct drm_device *dev, size_t unaligned_size) -@@ -134,18 +134,18 @@ struct vc4_bo *vc4_bo_create(struct drm_device *dev, size_t unaligned_size) - return NULL; - - /* First, try to get a vc4_bo from the kernel BO cache. */ -- spin_lock(&vc4->bo_lock); -+ mutex_lock(&vc4->bo_lock); - if (page_index < vc4->bo_cache.size_list_size && - !list_empty(&vc4->bo_cache.size_list[page_index])) { - struct vc4_bo *bo = - list_first_entry(&vc4->bo_cache.size_list[page_index], - struct vc4_bo, size_head); - vc4_bo_remove_from_cache(bo); -- spin_unlock(&vc4->bo_lock); -+ mutex_unlock(&vc4->bo_lock); - kref_init(&bo->base.base.refcount); - return bo; - } -- spin_unlock(&vc4->bo_lock); -+ mutex_unlock(&vc4->bo_lock); - - /* Otherwise, make a new BO. */ - for (pass = 0; ; pass++) { -@@ -215,7 +215,7 @@ vc4_bo_cache_free_old(struct drm_device *dev) - struct vc4_dev *vc4 = to_vc4_dev(dev); - unsigned long expire_time = jiffies - msecs_to_jiffies(1000); - -- spin_lock(&vc4->bo_lock); -+ mutex_lock(&vc4->bo_lock); - while (!list_empty(&vc4->bo_cache.time_list)) { - struct vc4_bo *bo = list_last_entry(&vc4->bo_cache.time_list, - struct vc4_bo, unref_head); -@@ -223,14 +223,14 @@ vc4_bo_cache_free_old(struct drm_device *dev) - mod_timer(&vc4->bo_cache.time_timer, - round_jiffies_up(jiffies + - msecs_to_jiffies(1000))); -- spin_unlock(&vc4->bo_lock); -+ mutex_unlock(&vc4->bo_lock); - return; - } - - vc4_bo_remove_from_cache(bo); - vc4_bo_destroy(bo); - } -- spin_unlock(&vc4->bo_lock); -+ mutex_unlock(&vc4->bo_lock); - } - - /* Called on the last userspace/kernel unreference of the BO. Returns -@@ -248,21 +248,25 @@ void vc4_free_object(struct drm_gem_object *gem_bo) - /* If the object references someone else's memory, we can't cache it. - */ - if (gem_bo->import_attach) { -+ mutex_lock(&vc4->bo_lock); - vc4_bo_destroy(bo); -+ mutex_unlock(&vc4->bo_lock); - return; - } - - /* Don't cache if it was publicly named. */ - if (gem_bo->name) { -+ mutex_lock(&vc4->bo_lock); - vc4_bo_destroy(bo); -+ mutex_unlock(&vc4->bo_lock); - return; - } - -- spin_lock(&vc4->bo_lock); -+ mutex_lock(&vc4->bo_lock); - cache_list = vc4_get_cache_list_for_size(dev, gem_bo->size); - if (!cache_list) { - vc4_bo_destroy(bo); -- spin_unlock(&vc4->bo_lock); -+ mutex_unlock(&vc4->bo_lock); - return; - } - -@@ -278,7 +282,7 @@ void vc4_free_object(struct drm_gem_object *gem_bo) - - vc4->bo_stats.num_cached++; - vc4->bo_stats.size_cached += gem_bo->size; -- spin_unlock(&vc4->bo_lock); -+ mutex_unlock(&vc4->bo_lock); - - vc4_bo_cache_free_old(dev); - } -@@ -465,7 +469,7 @@ void vc4_bo_cache_init(struct drm_device *dev) - { - struct vc4_dev *vc4 = to_vc4_dev(dev); - -- spin_lock_init(&vc4->bo_lock); -+ mutex_init(&vc4->bo_lock); - - INIT_LIST_HEAD(&vc4->bo_cache.time_list); - -@@ -498,9 +502,9 @@ int vc4_bo_stats_debugfs(struct seq_file *m, void *unused) - struct vc4_dev *vc4 = to_vc4_dev(dev); - struct vc4_bo_stats stats; - -- spin_lock(&vc4->bo_lock); -+ mutex_lock(&vc4->bo_lock); - stats = vc4->bo_stats; -- spin_unlock(&vc4->bo_lock); -+ mutex_unlock(&vc4->bo_lock); - - seq_printf(m, "num bos allocated: %d\n", stats.num_allocated); - seq_printf(m, "size bos allocated: %dkb\n", stats.size_allocated / 1024); -diff --git a/drivers/gpu/drm/vc4/vc4_drv.h b/drivers/gpu/drm/vc4/vc4_drv.h -index 8cc89d1..c079b82 100644 ---- a/drivers/gpu/drm/vc4/vc4_drv.h -+++ b/drivers/gpu/drm/vc4/vc4_drv.h -@@ -49,7 +49,7 @@ struct vc4_dev { - } bo_stats; - - /* Protects bo_cache and the BO stats. */ -- spinlock_t bo_lock; -+ struct mutex bo_lock; - - /* Sequence number for the last job queued in job_list. - * Starts at 0 (no jobs emitted). - -From eafd7a031a15fb0d51a86b89e42ccde4f23434b4 Mon Sep 17 00:00:00 2001 -From: Eric Anholt <eric@anholt.net> -Date: Mon, 19 Oct 2015 08:29:41 -0700 -Subject: [PATCH 094/170] drm/vc4: bo cache locking cleanup. - -Signed-off-by: Eric Anholt <eric@anholt.net> ---- - drivers/gpu/drm/vc4/vc4_bo.c | 22 +++++++++------------- - 1 file changed, 9 insertions(+), 13 deletions(-) - -diff --git a/drivers/gpu/drm/vc4/vc4_bo.c b/drivers/gpu/drm/vc4/vc4_bo.c -index af0fde6..acd360c 100644 ---- a/drivers/gpu/drm/vc4/vc4_bo.c -+++ b/drivers/gpu/drm/vc4/vc4_bo.c -@@ -215,7 +215,6 @@ vc4_bo_cache_free_old(struct drm_device *dev) - struct vc4_dev *vc4 = to_vc4_dev(dev); - unsigned long expire_time = jiffies - msecs_to_jiffies(1000); - -- mutex_lock(&vc4->bo_lock); - while (!list_empty(&vc4->bo_cache.time_list)) { - struct vc4_bo *bo = list_last_entry(&vc4->bo_cache.time_list, - struct vc4_bo, unref_head); -@@ -223,14 +222,12 @@ vc4_bo_cache_free_old(struct drm_device *dev) - mod_timer(&vc4->bo_cache.time_timer, - round_jiffies_up(jiffies + - msecs_to_jiffies(1000))); -- mutex_unlock(&vc4->bo_lock); - return; - } - - vc4_bo_remove_from_cache(bo); - vc4_bo_destroy(bo); - } -- mutex_unlock(&vc4->bo_lock); - } - - /* Called on the last userspace/kernel unreference of the BO. Returns -@@ -245,29 +242,24 @@ void vc4_free_object(struct drm_gem_object *gem_bo) - struct vc4_bo *bo = to_vc4_bo(gem_bo); - struct list_head *cache_list; - -+ mutex_lock(&vc4->bo_lock); - /* If the object references someone else's memory, we can't cache it. - */ - if (gem_bo->import_attach) { -- mutex_lock(&vc4->bo_lock); - vc4_bo_destroy(bo); -- mutex_unlock(&vc4->bo_lock); -- return; -+ goto out; - } - - /* Don't cache if it was publicly named. */ - if (gem_bo->name) { -- mutex_lock(&vc4->bo_lock); - vc4_bo_destroy(bo); -- mutex_unlock(&vc4->bo_lock); -- return; -+ goto out; - } - -- mutex_lock(&vc4->bo_lock); - cache_list = vc4_get_cache_list_for_size(dev, gem_bo->size); - if (!cache_list) { - vc4_bo_destroy(bo); -- mutex_unlock(&vc4->bo_lock); -- return; -+ goto out; - } - - if (bo->validated_shader) { -@@ -282,9 +274,11 @@ void vc4_free_object(struct drm_gem_object *gem_bo) - - vc4->bo_stats.num_cached++; - vc4->bo_stats.size_cached += gem_bo->size; -- mutex_unlock(&vc4->bo_lock); - - vc4_bo_cache_free_old(dev); -+ -+out: -+ mutex_unlock(&vc4->bo_lock); - } - - static void vc4_bo_cache_time_work(struct work_struct *work) -@@ -293,7 +287,9 @@ static void vc4_bo_cache_time_work(struct work_struct *work) - container_of(work, struct vc4_dev, bo_cache.time_work); - struct drm_device *dev = vc4->dev; - -+ mutex_lock(&vc4->bo_lock); - vc4_bo_cache_free_old(dev); -+ mutex_unlock(&vc4->bo_lock); - } - - static void vc4_bo_cache_time_timer(unsigned long data) - -From 482f2b3e97e919ac0ebc55a6040747495563b9a7 Mon Sep 17 00:00:00 2001 -From: Eric Anholt <eric@anholt.net> -Date: Mon, 19 Oct 2015 08:32:24 -0700 -Subject: [PATCH 095/170] drm/vc4: Use job_lock to protect seqno_cb_list. - -We're (mostly) not supposed to be using struct_mutex in drivers these -days. - -Signed-off-by: Eric Anholt <eric@anholt.net> ---- - drivers/gpu/drm/vc4/vc4_gem.c | 8 +++++--- - 1 file changed, 5 insertions(+), 3 deletions(-) - -diff --git a/drivers/gpu/drm/vc4/vc4_gem.c b/drivers/gpu/drm/vc4/vc4_gem.c -index 361390b..b1853b2 100644 ---- a/drivers/gpu/drm/vc4/vc4_gem.c -+++ b/drivers/gpu/drm/vc4/vc4_gem.c -@@ -474,7 +474,6 @@ vc4_job_handle_completed(struct vc4_dev *vc4) - vc4_complete_exec(exec); - spin_lock_irqsave(&vc4->job_lock, irqflags); - } -- spin_unlock_irqrestore(&vc4->job_lock, irqflags); - - list_for_each_entry_safe(cb, cb_temp, &vc4->seqno_cb_list, work.entry) { - if (cb->seqno <= vc4->finished_seqno) { -@@ -482,6 +481,8 @@ vc4_job_handle_completed(struct vc4_dev *vc4) - schedule_work(&cb->work); - } - } + -+ spin_unlock_irqrestore(&vc4->job_lock, irqflags); - } - - static void vc4_seqno_cb_work(struct work_struct *work) -@@ -496,18 +497,19 @@ int vc4_queue_seqno_cb(struct drm_device *dev, - { - struct vc4_dev *vc4 = to_vc4_dev(dev); - int ret = 0; -+ unsigned long irqflags; - - cb->func = func; - INIT_WORK(&cb->work, vc4_seqno_cb_work); - -- mutex_lock(&dev->struct_mutex); -+ spin_lock_irqsave(&vc4->job_lock, irqflags); - if (seqno > vc4->finished_seqno) { - cb->seqno = seqno; - list_add_tail(&cb->work.entry, &vc4->seqno_cb_list); - } else { - schedule_work(&cb->work); - } -- mutex_unlock(&dev->struct_mutex); -+ spin_unlock_irqrestore(&vc4->job_lock, irqflags); - - return ret; - } - -From 4dc15a296586679d5b014011e44a093cf962123e Mon Sep 17 00:00:00 2001 -From: Eric Anholt <eric@anholt.net> -Date: Mon, 19 Oct 2015 08:44:35 -0700 -Subject: [PATCH 096/170] drm/vc4: Drop struct_mutex around CL validation. - -We were using it so that we could make sure that shader validation -state didn't change while we were validating, but now shader -validation state is immutable. The bcl/rcl generation doesn't do any -other BO dereferencing, and seems to have no other global state -dependency not covered by job_lock / bo_lock. ++#endif /* _TAS5713_H */ -Fixes a lock order reversal between mmap_sem and struct_mutex. +From c3ed64332c5f99c98c467d4640a94a63d8b0554f Mon Sep 17 00:00:00 2001 +From: Ryan Coe <bluemrp9@gmail.com> +Date: Sat, 31 Jan 2015 18:25:49 -0700 +Subject: [PATCH 074/112] Update ds1307 driver for device-tree support -Signed-off-by: Eric Anholt <eric@anholt.net> +Signed-off-by: Ryan Coe <bluemrp9@gmail.com> --- - drivers/gpu/drm/vc4/vc4_gem.c | 12 ++++-------- - 1 file changed, 4 insertions(+), 8 deletions(-) + drivers/rtc/rtc-ds1307.c | 8 ++++++++ + 1 file changed, 8 insertions(+) -diff --git a/drivers/gpu/drm/vc4/vc4_gem.c b/drivers/gpu/drm/vc4/vc4_gem.c -index b1853b2..32f375a 100644 ---- a/drivers/gpu/drm/vc4/vc4_gem.c -+++ b/drivers/gpu/drm/vc4/vc4_gem.c -@@ -244,13 +244,15 @@ static void - vc4_queue_submit(struct drm_device *dev, struct vc4_exec_info *exec) - { - struct vc4_dev *vc4 = to_vc4_dev(dev); -- uint64_t seqno = ++vc4->emit_seqno; -+ uint64_t seqno; - unsigned long irqflags; - -+ spin_lock_irqsave(&vc4->job_lock, irqflags); -+ -+ seqno = ++vc4->emit_seqno; - exec->seqno = seqno; - vc4_update_bo_seqnos(exec, seqno); - -- spin_lock_irqsave(&vc4->job_lock, irqflags); - list_add_tail(&exec->head, &vc4->job_list); - - /* If no job was executing, kick ours off. Otherwise, it'll -@@ -608,8 +610,6 @@ vc4_submit_cl_ioctl(struct drm_device *dev, void *data, - exec->args = args; - INIT_LIST_HEAD(&exec->unref_list); - -- mutex_lock(&dev->struct_mutex); -- - ret = vc4_cl_lookup_bos(dev, file_priv, exec); - if (ret) - goto fail; -@@ -636,15 +636,11 @@ vc4_submit_cl_ioctl(struct drm_device *dev, void *data, - /* Return the seqno for our job. */ - args->seqno = vc4->emit_seqno; - -- mutex_unlock(&dev->struct_mutex); -- +diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c +index e94eb09..f5d93be 100644 +--- a/drivers/rtc/rtc-ds1307.c ++++ b/drivers/rtc/rtc-ds1307.c +@@ -1608,6 +1608,14 @@ static int ds1307_remove(struct i2c_client *client) return 0; - - fail: - vc4_complete_exec(exec); - -- mutex_unlock(&dev->struct_mutex); -- - return ret; } ++#ifdef CONFIG_OF ++static const struct of_device_id ds1307_of_match[] = { ++ { .compatible = "maxim,ds1307" }, ++ { } ++}; ++MODULE_DEVICE_TABLE(of, ds1307_of_match); ++#endif ++ + static struct i2c_driver ds1307_driver = { + .driver = { + .name = "rtc-ds1307", -From f1924e632d16f98eee1fe1be636249b8cee4ee6e Mon Sep 17 00:00:00 2001 -From: Eric Anholt <eric@anholt.net> -Date: Mon, 19 Oct 2015 08:44:35 -0700 -Subject: [PATCH 097/170] drm/vc4: Drop struct_mutex around CL validation. - -We were using it so that we could make sure that shader validation -state didn't change while we were validating, but now shader -validation state is immutable. The bcl/rcl generation doesn't do any -other BO dereferencing, and seems to have no other global state -dependency not covered by job_lock / bo_lock. We only need to hold -struct_mutex for object unreferencing. - -Fixes a lock order reversal between mmap_sem and struct_mutex. +From 0cb5de060ca2b6655d39f5e2368439b5e1f0d8f2 Mon Sep 17 00:00:00 2001 +From: Phil Elwell <phil@raspberrypi.org> +Date: Fri, 27 Feb 2015 15:10:24 +0000 +Subject: [PATCH 075/112] enc28j60: Add device tree compatible string and an + overlay -Signed-off-by: Eric Anholt <eric@anholt.net> --- - drivers/gpu/drm/vc4/vc4_gem.c | 13 ++++++------- - 1 file changed, 6 insertions(+), 7 deletions(-) + drivers/net/ethernet/microchip/enc28j60.c | 7 +++++++ + 1 file changed, 7 insertions(+) -diff --git a/drivers/gpu/drm/vc4/vc4_gem.c b/drivers/gpu/drm/vc4/vc4_gem.c -index 32f375a..55551ea 100644 ---- a/drivers/gpu/drm/vc4/vc4_gem.c -+++ b/drivers/gpu/drm/vc4/vc4_gem.c -@@ -439,10 +439,12 @@ vc4_get_bcl(struct drm_device *dev, struct vc4_exec_info *exec) - } - - static void --vc4_complete_exec(struct vc4_exec_info *exec) -+vc4_complete_exec(struct drm_device *dev, struct vc4_exec_info *exec) - { - unsigned i; - -+ /* Need the struct lock for drm_gem_object_unreference(). */ -+ mutex_lock(&dev->struct_mutex); - if (exec->bo) { - for (i = 0; i < exec->bo_count; i++) - drm_gem_object_unreference(&exec->bo[i].bo->base); -@@ -455,6 +457,7 @@ vc4_complete_exec(struct vc4_exec_info *exec) - list_del(&bo->unref_head); - drm_gem_object_unreference(&bo->base.base); - } -+ mutex_unlock(&dev->struct_mutex); - - kfree(exec); - } -@@ -473,7 +476,7 @@ vc4_job_handle_completed(struct vc4_dev *vc4) - list_del(&exec->head); - - spin_unlock_irqrestore(&vc4->job_lock, irqflags); -- vc4_complete_exec(exec); -+ vc4_complete_exec(vc4->dev, exec); - spin_lock_irqsave(&vc4->job_lock, irqflags); - } - -@@ -525,12 +528,8 @@ vc4_job_done_work(struct work_struct *work) - { - struct vc4_dev *vc4 = - container_of(work, struct vc4_dev, job_done_work); -- struct drm_device *dev = vc4->dev; - -- /* Need the struct lock for drm_gem_object_unreference(). */ -- mutex_lock(&dev->struct_mutex); - vc4_job_handle_completed(vc4); -- mutex_unlock(&dev->struct_mutex); - } - - static int -@@ -639,7 +638,7 @@ vc4_submit_cl_ioctl(struct drm_device *dev, void *data, +diff --git a/drivers/net/ethernet/microchip/enc28j60.c b/drivers/net/ethernet/microchip/enc28j60.c +index 86ea17e..a1b20c1 100644 +--- a/drivers/net/ethernet/microchip/enc28j60.c ++++ b/drivers/net/ethernet/microchip/enc28j60.c +@@ -1630,9 +1630,16 @@ static int enc28j60_remove(struct spi_device *spi) return 0; - - fail: -- vc4_complete_exec(exec); -+ vc4_complete_exec(vc4->dev, exec); - - return ret; } - -From 0193a1e5b931c7363279282b4169c2152af1a621 Mon Sep 17 00:00:00 2001 -From: Eric Anholt <eric@anholt.net> -Date: Tue, 20 Oct 2015 13:59:15 +0100 -Subject: [PATCH 098/170] drm/vc4: Add support for more display plane formats. - -Signed-off-by: Eric Anholt <eric@anholt.net> ---- - drivers/gpu/drm/vc4/vc4_plane.c | 16 ++++++++++++++++ - 1 file changed, 16 insertions(+) - -diff --git a/drivers/gpu/drm/vc4/vc4_plane.c b/drivers/gpu/drm/vc4/vc4_plane.c -index 65e5455..0f85eb5 100644 ---- a/drivers/gpu/drm/vc4/vc4_plane.c -+++ b/drivers/gpu/drm/vc4/vc4_plane.c -@@ -59,6 +59,22 @@ static const struct hvs_format { - .drm = DRM_FORMAT_ARGB8888, .hvs = HVS_PIXEL_FORMAT_RGBA8888, - .pixel_order = HVS_PIXEL_ORDER_ABGR, .has_alpha = true, - }, -+ { -+ .drm = DRM_FORMAT_RGB565, .hvs = HVS_PIXEL_FORMAT_RGB565, -+ .pixel_order = HVS_PIXEL_ORDER_XRGB, .has_alpha = false, -+ }, -+ { -+ .drm = DRM_FORMAT_BGR565, .hvs = HVS_PIXEL_FORMAT_RGB565, -+ .pixel_order = HVS_PIXEL_ORDER_XBGR, .has_alpha = false, -+ }, -+ { -+ .drm = DRM_FORMAT_ARGB1555, .hvs = HVS_PIXEL_FORMAT_RGBA5551, -+ .pixel_order = HVS_PIXEL_ORDER_ABGR, .has_alpha = true, -+ }, -+ { -+ .drm = DRM_FORMAT_XRGB1555, .hvs = HVS_PIXEL_FORMAT_RGBA5551, -+ .pixel_order = HVS_PIXEL_ORDER_ABGR, .has_alpha = false, -+ }, - }; - - static const struct hvs_format *vc4_get_hvs_format(u32 drm_format) - -From 8faa3b83201819d56f997a2b2ecaf8c690080852 Mon Sep 17 00:00:00 2001 -From: Eric Anholt <eric@anholt.net> -Date: Fri, 23 Oct 2015 12:31:56 +0100 -Subject: [PATCH 099/170] drm/vc4: No need to stop the stopped threads. - -This was leftover debug code from the hackdriver. We never submit -unless the thread is already idle. - -Signed-off-by: Eric Anholt <eric@anholt.net> ---- - drivers/gpu/drm/vc4/vc4_gem.c | 4 ---- - 1 file changed, 4 deletions(-) - -diff --git a/drivers/gpu/drm/vc4/vc4_gem.c b/drivers/gpu/drm/vc4/vc4_gem.c -index 55551ea..eeb0925 100644 ---- a/drivers/gpu/drm/vc4/vc4_gem.c -+++ b/drivers/gpu/drm/vc4/vc4_gem.c -@@ -104,10 +104,6 @@ submit_cl(struct drm_device *dev, uint32_t thread, uint32_t start, uint32_t end) - { - struct vc4_dev *vc4 = to_vc4_dev(dev); - -- /* Stop any existing thread and set state to "stopped at halt" */ -- V3D_WRITE(V3D_CTNCS(thread), V3D_CTRUN); -- barrier(); -- - V3D_WRITE(V3D_CTNCA(thread), start); - barrier(); ++static const struct of_device_id enc28j60_of_match[] = { ++ { .compatible = "microchip,enc28j60", }, ++ { /* sentinel */ } ++}; ++MODULE_DEVICE_TABLE(of, enc28j60_of_match); ++ + static struct spi_driver enc28j60_driver = { + .driver = { + .name = DRV_NAME, ++ .of_match_table = enc28j60_of_match, + }, + .probe = enc28j60_probe, + .remove = enc28j60_remove, -From d102d0e145b58bccbea52e89bbe52dcefc044aaa Mon Sep 17 00:00:00 2001 -From: Eric Anholt <eric@anholt.net> -Date: Fri, 23 Oct 2015 12:33:43 +0100 -Subject: [PATCH 100/170] drm/vc4: Remove extra barrier()s aroudn CTnCA/CTnEA - setup. - -The writel() that these expand to already does barriers. - -Signed-off-by: Eric Anholt <eric@anholt.net> ---- - drivers/gpu/drm/vc4/vc4_gem.c | 9 +++------ - 1 file changed, 3 insertions(+), 6 deletions(-) +From b93b87463485525ab8d4a782dda0e04d36d1c1b3 Mon Sep 17 00:00:00 2001 +From: Waldemar Brodkorb <wbrodkorb@conet.de> +Date: Wed, 25 Mar 2015 09:26:17 +0100 +Subject: [PATCH 076/112] Add driver for rpi-proto -diff --git a/drivers/gpu/drm/vc4/vc4_gem.c b/drivers/gpu/drm/vc4/vc4_gem.c -index eeb0925..0cea723 100644 ---- a/drivers/gpu/drm/vc4/vc4_gem.c -+++ b/drivers/gpu/drm/vc4/vc4_gem.c -@@ -104,14 +104,11 @@ submit_cl(struct drm_device *dev, uint32_t thread, uint32_t start, uint32_t end) - { - struct vc4_dev *vc4 = to_vc4_dev(dev); - -- V3D_WRITE(V3D_CTNCA(thread), start); -- barrier(); -- -- /* Set the end address of the control list. Writing this -- * register is what starts the job. -+ /* Set the current and end address of the control list. -+ * Writing the end register is what starts the job. - */ -+ V3D_WRITE(V3D_CTNCA(thread), start); - V3D_WRITE(V3D_CTNEA(thread), end); -- barrier(); - } - - int +Forward port of 3.10.x driver from https://github.com/koalo +We are using a custom board and would like to use rpi 3.18.x +kernel. Patch works fine for our embedded system. -From 0f099b4b1354b0377376b91ae60c6c16d82683a7 Mon Sep 17 00:00:00 2001 -From: Eric Anholt <eric@anholt.net> -Date: Fri, 23 Oct 2015 14:57:22 +0100 -Subject: [PATCH 101/170] drm/vc4: Fix a typo in a V3D debug register. +URL to the audio chip: +http://www.mikroe.com/add-on-boards/audio-voice/audio-codec-proto/ -Signed-off-by: Eric Anholt <eric@anholt.net> ---- - drivers/gpu/drm/vc4/vc4_regs.h | 2 +- - drivers/gpu/drm/vc4/vc4_v3d.c | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/drivers/gpu/drm/vc4/vc4_regs.h b/drivers/gpu/drm/vc4/vc4_regs.h -index 9e4e904..4e52a0a 100644 ---- a/drivers/gpu/drm/vc4/vc4_regs.h -+++ b/drivers/gpu/drm/vc4/vc4_regs.h -@@ -154,7 +154,7 @@ - #define V3D_PCTRS14 0x006f4 - #define V3D_PCTR15 0x006f8 - #define V3D_PCTRS15 0x006fc --#define V3D_BGE 0x00f00 -+#define V3D_DBGE 0x00f00 - #define V3D_FDBGO 0x00f04 - #define V3D_FDBGB 0x00f08 - #define V3D_FDBGR 0x00f0c -diff --git a/drivers/gpu/drm/vc4/vc4_v3d.c b/drivers/gpu/drm/vc4/vc4_v3d.c -index b9cb7cf..cf35f58 100644 ---- a/drivers/gpu/drm/vc4/vc4_v3d.c -+++ b/drivers/gpu/drm/vc4/vc4_v3d.c -@@ -99,7 +99,7 @@ static const struct { - REGDEF(V3D_PCTRS14), - REGDEF(V3D_PCTR15), - REGDEF(V3D_PCTRS15), -- REGDEF(V3D_BGE), -+ REGDEF(V3D_DBGE), - REGDEF(V3D_FDBGO), - REGDEF(V3D_FDBGB), - REGDEF(V3D_FDBGR), - -From 22182768add611b53e33c5dd2e8901acc3d08181 Mon Sep 17 00:00:00 2001 -From: Phil Elwell <phil@raspberrypi.org> -Date: Mon, 2 Nov 2015 17:07:33 +0000 -Subject: [PATCH 102/170] drm/vc4: Enable VC4 modules, and increase CMA size - with overlay +Playback tested with devicetree enabled. -If using the overlay, be careful not to boot to GUI or run startx, -or the Pi will almost hang, reporting stalls in kernel threads. +Signed-off-by: Waldemar Brodkorb <wbrodkorb@conet.de> --- - arch/arm/boot/dts/overlays/README | 8 ++ - arch/arm/boot/dts/overlays/vc4-kms-v3d-overlay.dts | 95 ++++++++++++++++++++++ - arch/arm/configs/bcm2709_defconfig | 2 + - arch/arm/configs/bcmrpi_defconfig | 2 + - 4 files changed, 107 insertions(+) - create mode 100644 arch/arm/boot/dts/overlays/vc4-kms-v3d-overlay.dts + sound/soc/bcm/Kconfig | 7 +++ + sound/soc/bcm/Makefile | 2 + + sound/soc/bcm/rpi-proto.c | 154 ++++++++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 163 insertions(+) + create mode 100644 sound/soc/bcm/rpi-proto.c -diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README -index b819293..f5302b2 100644 ---- a/arch/arm/boot/dts/overlays/README -+++ b/arch/arm/boot/dts/overlays/README -@@ -601,6 +601,14 @@ Params: txd1_pin GPIO pin for TXD1 (14, 32 or 40 - default 14) - rxd1_pin GPIO pin for RXD1 (15, 33 or 41 - default 15) - +diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig +index 7677c89..8669a9a 100644 +--- a/sound/soc/bcm/Kconfig ++++ b/sound/soc/bcm/Kconfig +@@ -43,6 +43,13 @@ config SND_BCM2708_SOC_RPI_DAC + help + Say Y or M if you want to add support for RPi-DAC. -+Name: vc4-kms-v3d -+Info: Enable Eric Anholt's DRM VC4 HDMI/HVS/V3D driver. Running startx or -+ booting to GUI while this overlay is in use will cause interesting -+ lockups. -+Load: dtoverlay=vc4-kms-v3d -+Params: <None> -+ ++config SND_BCM2708_SOC_RPI_PROTO ++ tristate "Support for Rpi-PROTO" ++ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S ++ select SND_SOC_WM8731 ++ help ++ Say Y or M if you want to add support for Audio Codec Board PROTO (WM8731). + - Name: vga666 - Info: Overlay for the Fen Logic VGA666 board - This uses GPIOs 2-21 (so no I2C), and activates the output 2-3 seconds -diff --git a/arch/arm/boot/dts/overlays/vc4-kms-v3d-overlay.dts b/arch/arm/boot/dts/overlays/vc4-kms-v3d-overlay.dts + config SND_BCM2708_SOC_IQAUDIO_DAC + tristate "Support for IQaudIO-DAC" + depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S +diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile +index 30db495..4f5ab1f 100644 +--- a/sound/soc/bcm/Makefile ++++ b/sound/soc/bcm/Makefile +@@ -9,6 +9,7 @@ snd-soc-hifiberry-dacplus-objs := hifiberry_dacplus.o + snd-soc-hifiberry-digi-objs := hifiberry_digi.o + snd-soc-hifiberry-amp-objs := hifiberry_amp.o + snd-soc-rpi-dac-objs := rpi-dac.o ++snd-soc-rpi-proto-objs := rpi-proto.o + snd-soc-iqaudio-dac-objs := iqaudio-dac.o + + obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o +@@ -16,4 +17,5 @@ obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS) += snd-soc-hifiberry-dacplus.o + obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI) += snd-soc-hifiberry-digi.o + obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_AMP) += snd-soc-hifiberry-amp.o + obj-$(CONFIG_SND_BCM2708_SOC_RPI_DAC) += snd-soc-rpi-dac.o ++obj-$(CONFIG_SND_BCM2708_SOC_RPI_PROTO) += snd-soc-rpi-proto.o + obj-$(CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC) += snd-soc-iqaudio-dac.o +diff --git a/sound/soc/bcm/rpi-proto.c b/sound/soc/bcm/rpi-proto.c new file mode 100644 -index 0000000..cf5d5c9 +index 0000000..9db678e --- /dev/null -+++ b/arch/arm/boot/dts/overlays/vc4-kms-v3d-overlay.dts -@@ -0,0 +1,95 @@ ++++ b/sound/soc/bcm/rpi-proto.c +@@ -0,0 +1,154 @@ +/* -+ * vc4-kms-v3d-overlay.dts ++ * ASoC driver for PROTO AudioCODEC (with a WM8731) ++ * connected to a Raspberry Pi ++ * ++ * Author: Florian Meier, <koalo@koalo.de> ++ * Copyright 2013 ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 as ++ * published by the Free Software Foundation. + */ + -+/dts-v1/; -+/plugin/; ++#include <linux/module.h> ++#include <linux/platform_device.h> + -+#include "dt-bindings/clock/bcm2835.h" -+#include "dt-bindings/gpio/gpio.h" ++#include <sound/core.h> ++#include <sound/pcm.h> ++#include <sound/soc.h> ++#include <sound/jack.h> + -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; ++#include "../codecs/wm8731.h" + -+ fragment@0 { -+ target = <&i2c2>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; ++static const unsigned int wm8731_rates_12288000[] = { ++ 8000, 32000, 48000, 96000, ++}; + -+ fragment@1 { -+ target = <&cprman>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; ++static struct snd_pcm_hw_constraint_list wm8731_constraints_12288000 = { ++ .list = wm8731_rates_12288000, ++ .count = ARRAY_SIZE(wm8731_rates_12288000), ++}; + -+ fragment@2 { -+ target = <&fb>; -+ __overlay__ { -+ status = "disabled"; -+ }; -+ }; ++static int snd_rpi_proto_startup(struct snd_pcm_substream *substream) ++{ ++ /* Setup constraints, because there is a 12.288 MHz XTAL on the board */ ++ snd_pcm_hw_constraint_list(substream->runtime, 0, ++ SNDRV_PCM_HW_PARAM_RATE, ++ &wm8731_constraints_12288000); ++ return 0; ++} + -+ fragment@3 { -+ target = <&soc>; -+ __overlay__ { -+ #address-cells = <1>; -+ #size-cells = <1>; ++static int snd_rpi_proto_hw_params(struct snd_pcm_substream *substream, ++ struct snd_pcm_hw_params *params) ++{ ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_codec *codec = rtd->codec; ++ struct snd_soc_dai *codec_dai = rtd->codec_dai; ++ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; ++ int sysclk = 12288000; /* This is fixed on this board */ + -+ pixelvalve@7e206000 { -+ compatible = "brcm,bcm2835-pixelvalve0"; -+ reg = <0x7e206000 0x100>; -+ interrupts = <2 13>; /* pwa0 */ -+ }; ++ /* Set proto bclk */ ++ int ret = snd_soc_dai_set_bclk_ratio(cpu_dai,32*2); ++ if (ret < 0){ ++ dev_err(codec->dev, ++ "Failed to set BCLK ratio %d\n", ret); ++ return ret; ++ } + -+ pixelvalve@7e207000 { -+ compatible = "brcm,bcm2835-pixelvalve1"; -+ reg = <0x7e207000 0x100>; -+ interrupts = <2 14>; /* pwa1 */ -+ }; ++ /* Set proto sysclk */ ++ ret = snd_soc_dai_set_sysclk(codec_dai, WM8731_SYSCLK_XTAL, ++ sysclk, SND_SOC_CLOCK_IN); ++ if (ret < 0) { ++ dev_err(codec->dev, ++ "Failed to set WM8731 SYSCLK: %d\n", ret); ++ return ret; ++ } + -+ hvs@7e400000 { -+ compatible = "brcm,bcm2835-hvs"; -+ reg = <0x7e400000 0x6000>; -+ interrupts = <2 1>; -+ }; ++ return 0; ++} + -+ pixelvalve@7e807000 { -+ compatible = "brcm,bcm2835-pixelvalve2"; -+ reg = <0x7e807000 0x100>; -+ interrupts = <2 10>; /* pixelvalve */ -+ }; ++/* machine stream operations */ ++static struct snd_soc_ops snd_rpi_proto_ops = { ++ .startup = snd_rpi_proto_startup, ++ .hw_params = snd_rpi_proto_hw_params, ++}; + -+ hdmi@7e902000 { -+ compatible = "brcm,bcm2835-hdmi"; -+ reg = <0x7e902000 0x600>, -+ <0x7e808000 0x100>; -+ interrupts = <2 8>, <2 9>; -+ ddc = <&i2c2>; -+ hpd-gpio = <&gpio 46 GPIO_ACTIVE_HIGH>; -+ clocks = <&cprman BCM2835_PLLH_PIX>, -+ <&cprman BCM2835_CLOCK_HSM>; -+ clock-names = "pixel", "hdmi"; -+ }; ++static struct snd_soc_dai_link snd_rpi_proto_dai[] = { ++{ ++ .name = "WM8731", ++ .stream_name = "WM8731 HiFi", ++ .cpu_dai_name = "bcm2708-i2s.0", ++ .codec_dai_name = "wm8731-hifi", ++ .platform_name = "bcm2708-i2s.0", ++ .codec_name = "wm8731.1-001a", ++ .dai_fmt = SND_SOC_DAIFMT_I2S ++ | SND_SOC_DAIFMT_NB_NF ++ | SND_SOC_DAIFMT_CBM_CFM, ++ .ops = &snd_rpi_proto_ops, ++}, ++}; + -+ v3d@7ec00000 { -+ compatible = "brcm,vc4-v3d"; -+ reg = <0x7ec00000 0x1000>; -+ interrupts = <1 10>; -+ }; ++/* audio machine driver */ ++static struct snd_soc_card snd_rpi_proto = { ++ .name = "snd_rpi_proto", ++ .owner = THIS_MODULE, ++ .dai_link = snd_rpi_proto_dai, ++ .num_links = ARRAY_SIZE(snd_rpi_proto_dai), ++}; + -+ gpu@7e4c0000 { -+ compatible = "brcm,bcm2835-vc4"; -+ }; -+ }; -+ }; ++static int snd_rpi_proto_probe(struct platform_device *pdev) ++{ ++ int ret = 0; + -+ fragment@4 { -+ target-path = "/chosen"; -+ __overlay__ { -+ bootargs = "cma=256M@512M"; -+ }; -+ }; ++ snd_rpi_proto.dev = &pdev->dev; ++ ++ if (pdev->dev.of_node) { ++ struct device_node *i2s_node; ++ struct snd_soc_dai_link *dai = &snd_rpi_proto_dai[0]; ++ i2s_node = of_parse_phandle(pdev->dev.of_node, ++ "i2s-controller", 0); ++ ++ if (i2s_node) { ++ dai->cpu_dai_name = NULL; ++ dai->cpu_of_node = i2s_node; ++ dai->platform_name = NULL; ++ dai->platform_of_node = i2s_node; ++ } ++ } ++ ++ ret = snd_soc_register_card(&snd_rpi_proto); ++ if (ret) { ++ dev_err(&pdev->dev, ++ "snd_soc_register_card() failed: %d\n", ret); ++ } ++ ++ return ret; ++} ++ ++ ++static int snd_rpi_proto_remove(struct platform_device *pdev) ++{ ++ return snd_soc_unregister_card(&snd_rpi_proto); ++} ++ ++static const struct of_device_id snd_rpi_proto_of_match[] = { ++ { .compatible = "rpi,rpi-proto", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, snd_rpi_proto_of_match); ++ ++static struct platform_driver snd_rpi_proto_driver = { ++ .driver = { ++ .name = "snd-rpi-proto", ++ .owner = THIS_MODULE, ++ .of_match_table = snd_rpi_proto_of_match, ++ }, ++ .probe = snd_rpi_proto_probe, ++ .remove = snd_rpi_proto_remove, +}; ++ ++module_platform_driver(snd_rpi_proto_driver); ++ ++MODULE_AUTHOR("Florian Meier"); ++MODULE_DESCRIPTION("ASoC Driver for Raspberry Pi connected to PROTO board (WM8731)"); ++MODULE_LICENSE("GPL"); + +From 1bd993b072abd8431882cd24e374c24d3144d206 Mon Sep 17 00:00:00 2001 +From: popcornmix <popcornmix@gmail.com> +Date: Mon, 13 Apr 2015 17:16:29 +0100 +Subject: [PATCH 077/112] config: Add default configs + +--- + arch/arm/configs/bcm2709_defconfig | 1279 +++++++++++++++++++++++++++++++++++ + arch/arm/configs/bcmrpi_defconfig | 1289 ++++++++++++++++++++++++++++++++++++ + 2 files changed, 2568 insertions(+) + create mode 100644 arch/arm/configs/bcm2709_defconfig + create mode 100644 arch/arm/configs/bcmrpi_defconfig + diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig -index 13999af..4e474c7 100644 ---- a/arch/arm/configs/bcm2709_defconfig +new file mode 100644 +index 0000000..f42c5eb +--- /dev/null +++ b/arch/arm/configs/bcm2709_defconfig -@@ -802,6 +802,8 @@ CONFIG_VIDEO_TW9903=m - CONFIG_VIDEO_TW9906=m - CONFIG_VIDEO_OV7640=m - CONFIG_VIDEO_MT9V011=m +@@ -0,0 +1,1279 @@ ++# CONFIG_ARM_PATCH_PHYS_VIRT is not set ++CONFIG_PHYS_OFFSET=0 ++CONFIG_LOCALVERSION="-v7" ++# CONFIG_LOCALVERSION_AUTO is not set ++CONFIG_SYSVIPC=y ++CONFIG_POSIX_MQUEUE=y ++CONFIG_NO_HZ=y ++CONFIG_HIGH_RES_TIMERS=y ++CONFIG_BSD_PROCESS_ACCT=y ++CONFIG_BSD_PROCESS_ACCT_V3=y ++CONFIG_TASKSTATS=y ++CONFIG_TASK_DELAY_ACCT=y ++CONFIG_TASK_XACCT=y ++CONFIG_TASK_IO_ACCOUNTING=y ++CONFIG_IKCONFIG=m ++CONFIG_IKCONFIG_PROC=y ++CONFIG_MEMCG=y ++CONFIG_BLK_CGROUP=y ++CONFIG_CGROUP_FREEZER=y ++CONFIG_CPUSETS=y ++CONFIG_CGROUP_DEVICE=y ++CONFIG_CGROUP_CPUACCT=y ++CONFIG_NAMESPACES=y ++CONFIG_SCHED_AUTOGROUP=y ++CONFIG_BLK_DEV_INITRD=y ++CONFIG_EMBEDDED=y ++# CONFIG_COMPAT_BRK is not set ++CONFIG_PROFILING=y ++CONFIG_OPROFILE=m ++CONFIG_KPROBES=y ++CONFIG_JUMP_LABEL=y ++CONFIG_MODULES=y ++CONFIG_MODULE_UNLOAD=y ++CONFIG_MODVERSIONS=y ++CONFIG_MODULE_SRCVERSION_ALL=y ++CONFIG_BLK_DEV_THROTTLING=y ++CONFIG_PARTITION_ADVANCED=y ++CONFIG_MAC_PARTITION=y ++CONFIG_CFQ_GROUP_IOSCHED=y ++CONFIG_ARCH_BCM2709=y ++# CONFIG_CACHE_L2X0 is not set ++CONFIG_SMP=y ++CONFIG_HAVE_ARM_ARCH_TIMER=y ++CONFIG_VMSPLIT_2G=y ++CONFIG_PREEMPT_VOLUNTARY=y ++CONFIG_AEABI=y ++CONFIG_OABI_COMPAT=y ++# CONFIG_CPU_SW_DOMAIN_PAN is not set ++CONFIG_CLEANCACHE=y ++CONFIG_FRONTSWAP=y ++CONFIG_CMA=y ++CONFIG_ZSMALLOC=m ++CONFIG_PGTABLE_MAPPING=y ++CONFIG_UACCESS_WITH_MEMCPY=y ++CONFIG_SECCOMP=y ++# CONFIG_ATAGS is not set ++CONFIG_ZBOOT_ROM_TEXT=0x0 ++CONFIG_ZBOOT_ROM_BSS=0x0 ++CONFIG_CMDLINE="console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait" ++CONFIG_CPU_FREQ=y ++CONFIG_CPU_FREQ_STAT=m ++CONFIG_CPU_FREQ_STAT_DETAILS=y ++CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE=y ++CONFIG_CPU_FREQ_GOV_PERFORMANCE=y ++CONFIG_CPU_FREQ_GOV_USERSPACE=y ++CONFIG_CPU_FREQ_GOV_ONDEMAND=y ++CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y ++CONFIG_VFP=y ++CONFIG_NEON=y ++CONFIG_KERNEL_MODE_NEON=y ++CONFIG_BINFMT_MISC=m ++# CONFIG_SUSPEND is not set ++CONFIG_PM=y ++CONFIG_NET=y ++CONFIG_PACKET=y ++CONFIG_UNIX=y ++CONFIG_XFRM_USER=y ++CONFIG_NET_KEY=m ++CONFIG_INET=y ++CONFIG_IP_MULTICAST=y ++CONFIG_IP_ADVANCED_ROUTER=y ++CONFIG_IP_MULTIPLE_TABLES=y ++CONFIG_IP_ROUTE_MULTIPATH=y ++CONFIG_IP_ROUTE_VERBOSE=y ++CONFIG_IP_PNP=y ++CONFIG_IP_PNP_DHCP=y ++CONFIG_IP_PNP_RARP=y ++CONFIG_NET_IPIP=m ++CONFIG_NET_IPGRE_DEMUX=m ++CONFIG_NET_IPGRE=m ++CONFIG_IP_MROUTE=y ++CONFIG_IP_MROUTE_MULTIPLE_TABLES=y ++CONFIG_IP_PIMSM_V1=y ++CONFIG_IP_PIMSM_V2=y ++CONFIG_SYN_COOKIES=y ++CONFIG_INET_AH=m ++CONFIG_INET_ESP=m ++CONFIG_INET_IPCOMP=m ++CONFIG_INET_XFRM_MODE_TRANSPORT=m ++CONFIG_INET_XFRM_MODE_TUNNEL=m ++CONFIG_INET_XFRM_MODE_BEET=m ++CONFIG_INET_DIAG=m ++CONFIG_IPV6=m ++CONFIG_IPV6_ROUTER_PREF=y ++CONFIG_INET6_AH=m ++CONFIG_INET6_ESP=m ++CONFIG_INET6_IPCOMP=m ++CONFIG_IPV6_TUNNEL=m ++CONFIG_IPV6_MULTIPLE_TABLES=y ++CONFIG_IPV6_SUBTREES=y ++CONFIG_IPV6_MROUTE=y ++CONFIG_IPV6_MROUTE_MULTIPLE_TABLES=y ++CONFIG_IPV6_PIMSM_V2=y ++CONFIG_NETFILTER=y ++CONFIG_NF_CONNTRACK=m ++CONFIG_NF_CONNTRACK_ZONES=y ++CONFIG_NF_CONNTRACK_EVENTS=y ++CONFIG_NF_CONNTRACK_TIMESTAMP=y ++CONFIG_NF_CT_PROTO_DCCP=m ++CONFIG_NF_CT_PROTO_UDPLITE=m ++CONFIG_NF_CONNTRACK_AMANDA=m ++CONFIG_NF_CONNTRACK_FTP=m ++CONFIG_NF_CONNTRACK_H323=m ++CONFIG_NF_CONNTRACK_IRC=m ++CONFIG_NF_CONNTRACK_NETBIOS_NS=m ++CONFIG_NF_CONNTRACK_SNMP=m ++CONFIG_NF_CONNTRACK_PPTP=m ++CONFIG_NF_CONNTRACK_SANE=m ++CONFIG_NF_CONNTRACK_SIP=m ++CONFIG_NF_CONNTRACK_TFTP=m ++CONFIG_NF_CT_NETLINK=m ++CONFIG_NETFILTER_XT_SET=m ++CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m ++CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m ++CONFIG_NETFILTER_XT_TARGET_CONNMARK=m ++CONFIG_NETFILTER_XT_TARGET_DSCP=m ++CONFIG_NETFILTER_XT_TARGET_HMARK=m ++CONFIG_NETFILTER_XT_TARGET_IDLETIMER=m ++CONFIG_NETFILTER_XT_TARGET_LED=m ++CONFIG_NETFILTER_XT_TARGET_LOG=m ++CONFIG_NETFILTER_XT_TARGET_MARK=m ++CONFIG_NETFILTER_XT_TARGET_NFLOG=m ++CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m ++CONFIG_NETFILTER_XT_TARGET_NOTRACK=m ++CONFIG_NETFILTER_XT_TARGET_TEE=m ++CONFIG_NETFILTER_XT_TARGET_TPROXY=m ++CONFIG_NETFILTER_XT_TARGET_TRACE=m ++CONFIG_NETFILTER_XT_TARGET_TCPMSS=m ++CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP=m ++CONFIG_NETFILTER_XT_MATCH_ADDRTYPE=m ++CONFIG_NETFILTER_XT_MATCH_BPF=m ++CONFIG_NETFILTER_XT_MATCH_CLUSTER=m ++CONFIG_NETFILTER_XT_MATCH_COMMENT=m ++CONFIG_NETFILTER_XT_MATCH_CONNBYTES=m ++CONFIG_NETFILTER_XT_MATCH_CONNLABEL=m ++CONFIG_NETFILTER_XT_MATCH_CONNLIMIT=m ++CONFIG_NETFILTER_XT_MATCH_CONNMARK=m ++CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m ++CONFIG_NETFILTER_XT_MATCH_CPU=m ++CONFIG_NETFILTER_XT_MATCH_DCCP=m ++CONFIG_NETFILTER_XT_MATCH_DEVGROUP=m ++CONFIG_NETFILTER_XT_MATCH_DSCP=m ++CONFIG_NETFILTER_XT_MATCH_ESP=m ++CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=m ++CONFIG_NETFILTER_XT_MATCH_HELPER=m ++CONFIG_NETFILTER_XT_MATCH_IPRANGE=m ++CONFIG_NETFILTER_XT_MATCH_IPVS=m ++CONFIG_NETFILTER_XT_MATCH_LENGTH=m ++CONFIG_NETFILTER_XT_MATCH_LIMIT=m ++CONFIG_NETFILTER_XT_MATCH_MAC=m ++CONFIG_NETFILTER_XT_MATCH_MARK=m ++CONFIG_NETFILTER_XT_MATCH_MULTIPORT=m ++CONFIG_NETFILTER_XT_MATCH_NFACCT=m ++CONFIG_NETFILTER_XT_MATCH_OSF=m ++CONFIG_NETFILTER_XT_MATCH_OWNER=m ++CONFIG_NETFILTER_XT_MATCH_POLICY=m ++CONFIG_NETFILTER_XT_MATCH_PHYSDEV=m ++CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m ++CONFIG_NETFILTER_XT_MATCH_QUOTA=m ++CONFIG_NETFILTER_XT_MATCH_RATEEST=m ++CONFIG_NETFILTER_XT_MATCH_REALM=m ++CONFIG_NETFILTER_XT_MATCH_RECENT=m ++CONFIG_NETFILTER_XT_MATCH_SOCKET=m ++CONFIG_NETFILTER_XT_MATCH_STATE=m ++CONFIG_NETFILTER_XT_MATCH_STATISTIC=m ++CONFIG_NETFILTER_XT_MATCH_STRING=m ++CONFIG_NETFILTER_XT_MATCH_TCPMSS=m ++CONFIG_NETFILTER_XT_MATCH_TIME=m ++CONFIG_NETFILTER_XT_MATCH_U32=m ++CONFIG_IP_SET=m ++CONFIG_IP_SET_BITMAP_IP=m ++CONFIG_IP_SET_BITMAP_IPMAC=m ++CONFIG_IP_SET_BITMAP_PORT=m ++CONFIG_IP_SET_HASH_IP=m ++CONFIG_IP_SET_HASH_IPPORT=m ++CONFIG_IP_SET_HASH_IPPORTIP=m ++CONFIG_IP_SET_HASH_IPPORTNET=m ++CONFIG_IP_SET_HASH_NET=m ++CONFIG_IP_SET_HASH_NETPORT=m ++CONFIG_IP_SET_HASH_NETIFACE=m ++CONFIG_IP_SET_LIST_SET=m ++CONFIG_IP_VS=m ++CONFIG_IP_VS_PROTO_TCP=y ++CONFIG_IP_VS_PROTO_UDP=y ++CONFIG_IP_VS_PROTO_ESP=y ++CONFIG_IP_VS_PROTO_AH=y ++CONFIG_IP_VS_PROTO_SCTP=y ++CONFIG_IP_VS_RR=m ++CONFIG_IP_VS_WRR=m ++CONFIG_IP_VS_LC=m ++CONFIG_IP_VS_WLC=m ++CONFIG_IP_VS_LBLC=m ++CONFIG_IP_VS_LBLCR=m ++CONFIG_IP_VS_DH=m ++CONFIG_IP_VS_SH=m ++CONFIG_IP_VS_SED=m ++CONFIG_IP_VS_NQ=m ++CONFIG_IP_VS_FTP=m ++CONFIG_IP_VS_PE_SIP=m ++CONFIG_NF_CONNTRACK_IPV4=m ++CONFIG_IP_NF_IPTABLES=m ++CONFIG_IP_NF_MATCH_AH=m ++CONFIG_IP_NF_MATCH_ECN=m ++CONFIG_IP_NF_MATCH_RPFILTER=m ++CONFIG_IP_NF_MATCH_TTL=m ++CONFIG_IP_NF_FILTER=m ++CONFIG_IP_NF_TARGET_REJECT=m ++CONFIG_IP_NF_NAT=m ++CONFIG_IP_NF_TARGET_MASQUERADE=m ++CONFIG_IP_NF_TARGET_NETMAP=m ++CONFIG_IP_NF_TARGET_REDIRECT=m ++CONFIG_IP_NF_MANGLE=m ++CONFIG_IP_NF_TARGET_CLUSTERIP=m ++CONFIG_IP_NF_TARGET_ECN=m ++CONFIG_IP_NF_TARGET_TTL=m ++CONFIG_IP_NF_RAW=m ++CONFIG_IP_NF_ARPTABLES=m ++CONFIG_IP_NF_ARPFILTER=m ++CONFIG_IP_NF_ARP_MANGLE=m ++CONFIG_NF_CONNTRACK_IPV6=m ++CONFIG_IP6_NF_IPTABLES=m ++CONFIG_IP6_NF_MATCH_AH=m ++CONFIG_IP6_NF_MATCH_EUI64=m ++CONFIG_IP6_NF_MATCH_FRAG=m ++CONFIG_IP6_NF_MATCH_OPTS=m ++CONFIG_IP6_NF_MATCH_HL=m ++CONFIG_IP6_NF_MATCH_IPV6HEADER=m ++CONFIG_IP6_NF_MATCH_MH=m ++CONFIG_IP6_NF_MATCH_RPFILTER=m ++CONFIG_IP6_NF_MATCH_RT=m ++CONFIG_IP6_NF_TARGET_HL=m ++CONFIG_IP6_NF_FILTER=m ++CONFIG_IP6_NF_TARGET_REJECT=m ++CONFIG_IP6_NF_MANGLE=m ++CONFIG_IP6_NF_RAW=m ++CONFIG_IP6_NF_NAT=m ++CONFIG_IP6_NF_TARGET_MASQUERADE=m ++CONFIG_IP6_NF_TARGET_NPT=m ++CONFIG_BRIDGE_NF_EBTABLES=m ++CONFIG_BRIDGE_EBT_BROUTE=m ++CONFIG_BRIDGE_EBT_T_FILTER=m ++CONFIG_BRIDGE_EBT_T_NAT=m ++CONFIG_BRIDGE_EBT_802_3=m ++CONFIG_BRIDGE_EBT_AMONG=m ++CONFIG_BRIDGE_EBT_ARP=m ++CONFIG_BRIDGE_EBT_IP=m ++CONFIG_BRIDGE_EBT_IP6=m ++CONFIG_BRIDGE_EBT_LIMIT=m ++CONFIG_BRIDGE_EBT_MARK=m ++CONFIG_BRIDGE_EBT_PKTTYPE=m ++CONFIG_BRIDGE_EBT_STP=m ++CONFIG_BRIDGE_EBT_VLAN=m ++CONFIG_BRIDGE_EBT_ARPREPLY=m ++CONFIG_BRIDGE_EBT_DNAT=m ++CONFIG_BRIDGE_EBT_MARK_T=m ++CONFIG_BRIDGE_EBT_REDIRECT=m ++CONFIG_BRIDGE_EBT_SNAT=m ++CONFIG_BRIDGE_EBT_LOG=m ++CONFIG_BRIDGE_EBT_NFLOG=m ++CONFIG_SCTP_COOKIE_HMAC_SHA1=y ++CONFIG_ATM=m ++CONFIG_L2TP=m ++CONFIG_L2TP_V3=y ++CONFIG_L2TP_IP=m ++CONFIG_L2TP_ETH=m ++CONFIG_BRIDGE=m ++CONFIG_VLAN_8021Q=m ++CONFIG_VLAN_8021Q_GVRP=y ++CONFIG_ATALK=m ++CONFIG_6LOWPAN=m ++CONFIG_IEEE802154=m ++CONFIG_IEEE802154_6LOWPAN=m ++CONFIG_MAC802154=m ++CONFIG_NET_SCHED=y ++CONFIG_NET_SCH_CBQ=m ++CONFIG_NET_SCH_HTB=m ++CONFIG_NET_SCH_HFSC=m ++CONFIG_NET_SCH_PRIO=m ++CONFIG_NET_SCH_MULTIQ=m ++CONFIG_NET_SCH_RED=m ++CONFIG_NET_SCH_SFB=m ++CONFIG_NET_SCH_SFQ=m ++CONFIG_NET_SCH_TEQL=m ++CONFIG_NET_SCH_TBF=m ++CONFIG_NET_SCH_GRED=m ++CONFIG_NET_SCH_DSMARK=m ++CONFIG_NET_SCH_NETEM=m ++CONFIG_NET_SCH_DRR=m ++CONFIG_NET_SCH_MQPRIO=m ++CONFIG_NET_SCH_CHOKE=m ++CONFIG_NET_SCH_QFQ=m ++CONFIG_NET_SCH_CODEL=m ++CONFIG_NET_SCH_FQ_CODEL=m ++CONFIG_NET_SCH_INGRESS=m ++CONFIG_NET_SCH_PLUG=m ++CONFIG_NET_CLS_BASIC=m ++CONFIG_NET_CLS_TCINDEX=m ++CONFIG_NET_CLS_ROUTE4=m ++CONFIG_NET_CLS_FW=m ++CONFIG_NET_CLS_U32=m ++CONFIG_CLS_U32_MARK=y ++CONFIG_NET_CLS_RSVP=m ++CONFIG_NET_CLS_RSVP6=m ++CONFIG_NET_CLS_FLOW=m ++CONFIG_NET_CLS_CGROUP=m ++CONFIG_NET_EMATCH=y ++CONFIG_NET_EMATCH_CMP=m ++CONFIG_NET_EMATCH_NBYTE=m ++CONFIG_NET_EMATCH_U32=m ++CONFIG_NET_EMATCH_META=m ++CONFIG_NET_EMATCH_TEXT=m ++CONFIG_NET_EMATCH_IPSET=m ++CONFIG_NET_CLS_ACT=y ++CONFIG_NET_ACT_POLICE=m ++CONFIG_NET_ACT_GACT=m ++CONFIG_GACT_PROB=y ++CONFIG_NET_ACT_MIRRED=m ++CONFIG_NET_ACT_IPT=m ++CONFIG_NET_ACT_NAT=m ++CONFIG_NET_ACT_PEDIT=m ++CONFIG_NET_ACT_SIMP=m ++CONFIG_NET_ACT_SKBEDIT=m ++CONFIG_NET_ACT_CSUM=m ++CONFIG_BATMAN_ADV=m ++CONFIG_OPENVSWITCH=m ++CONFIG_NET_PKTGEN=m ++CONFIG_HAMRADIO=y ++CONFIG_AX25=m ++CONFIG_NETROM=m ++CONFIG_ROSE=m ++CONFIG_MKISS=m ++CONFIG_6PACK=m ++CONFIG_BPQETHER=m ++CONFIG_BAYCOM_SER_FDX=m ++CONFIG_BAYCOM_SER_HDX=m ++CONFIG_YAM=m ++CONFIG_CAN=m ++CONFIG_CAN_VCAN=m ++CONFIG_CAN_MCP251X=m ++CONFIG_IRDA=m ++CONFIG_IRLAN=m ++CONFIG_IRNET=m ++CONFIG_IRCOMM=m ++CONFIG_IRDA_ULTRA=y ++CONFIG_IRDA_CACHE_LAST_LSAP=y ++CONFIG_IRDA_FAST_RR=y ++CONFIG_IRTTY_SIR=m ++CONFIG_KINGSUN_DONGLE=m ++CONFIG_KSDAZZLE_DONGLE=m ++CONFIG_KS959_DONGLE=m ++CONFIG_USB_IRDA=m ++CONFIG_SIGMATEL_FIR=m ++CONFIG_MCS_FIR=m ++CONFIG_BT=m ++CONFIG_BT_RFCOMM=m ++CONFIG_BT_RFCOMM_TTY=y ++CONFIG_BT_BNEP=m ++CONFIG_BT_BNEP_MC_FILTER=y ++CONFIG_BT_BNEP_PROTO_FILTER=y ++CONFIG_BT_HIDP=m ++CONFIG_BT_6LOWPAN=m ++CONFIG_BT_HCIBTUSB=m ++CONFIG_BT_HCIUART=m ++CONFIG_BT_HCIUART_3WIRE=y ++CONFIG_BT_HCIUART_BCM=y ++CONFIG_BT_HCIBCM203X=m ++CONFIG_BT_HCIBPA10X=m ++CONFIG_BT_HCIBFUSB=m ++CONFIG_BT_HCIVHCI=m ++CONFIG_BT_MRVL=m ++CONFIG_BT_MRVL_SDIO=m ++CONFIG_BT_ATH3K=m ++CONFIG_BT_WILINK=m ++CONFIG_MAC80211=m ++CONFIG_MAC80211_MESH=y ++CONFIG_WIMAX=m ++CONFIG_RFKILL=m ++CONFIG_RFKILL_INPUT=y ++CONFIG_NET_9P=m ++CONFIG_NFC=m ++CONFIG_NFC_PN533=m ++CONFIG_DEVTMPFS=y ++CONFIG_DEVTMPFS_MOUNT=y ++CONFIG_DMA_CMA=y ++CONFIG_CMA_SIZE_MBYTES=5 ++CONFIG_MTD=m ++CONFIG_MTD_BLOCK=m ++CONFIG_MTD_NAND=m ++CONFIG_MTD_UBI=m ++CONFIG_OF_CONFIGFS=y ++CONFIG_ZRAM=m ++CONFIG_ZRAM_LZ4_COMPRESS=y ++CONFIG_BLK_DEV_LOOP=y ++CONFIG_BLK_DEV_CRYPTOLOOP=m ++CONFIG_BLK_DEV_DRBD=m ++CONFIG_BLK_DEV_NBD=m ++CONFIG_BLK_DEV_RAM=y ++CONFIG_CDROM_PKTCDVD=m ++CONFIG_ATA_OVER_ETH=m ++CONFIG_EEPROM_AT24=m ++CONFIG_TI_ST=m ++CONFIG_SCSI=y ++# CONFIG_SCSI_PROC_FS is not set ++CONFIG_BLK_DEV_SD=y ++CONFIG_CHR_DEV_ST=m ++CONFIG_CHR_DEV_OSST=m ++CONFIG_BLK_DEV_SR=m ++CONFIG_CHR_DEV_SG=m ++CONFIG_SCSI_ISCSI_ATTRS=y ++CONFIG_ISCSI_TCP=m ++CONFIG_ISCSI_BOOT_SYSFS=m ++CONFIG_MD=y ++CONFIG_MD_LINEAR=m ++CONFIG_MD_RAID0=m ++CONFIG_BLK_DEV_DM=m ++CONFIG_DM_CRYPT=m ++CONFIG_DM_SNAPSHOT=m ++CONFIG_DM_THIN_PROVISIONING=m ++CONFIG_DM_MIRROR=m ++CONFIG_DM_LOG_USERSPACE=m ++CONFIG_DM_RAID=m ++CONFIG_DM_ZERO=m ++CONFIG_DM_DELAY=m ++CONFIG_NETDEVICES=y ++CONFIG_BONDING=m ++CONFIG_DUMMY=m ++CONFIG_IFB=m ++CONFIG_MACVLAN=m ++CONFIG_NETCONSOLE=m ++CONFIG_TUN=m ++CONFIG_VETH=m ++CONFIG_ENC28J60=m ++CONFIG_QCA7000=m ++CONFIG_MDIO_BITBANG=m ++CONFIG_PPP=m ++CONFIG_PPP_BSDCOMP=m ++CONFIG_PPP_DEFLATE=m ++CONFIG_PPP_FILTER=y ++CONFIG_PPP_MPPE=m ++CONFIG_PPP_MULTILINK=y ++CONFIG_PPPOATM=m ++CONFIG_PPPOE=m ++CONFIG_PPPOL2TP=m ++CONFIG_PPP_ASYNC=m ++CONFIG_PPP_SYNC_TTY=m ++CONFIG_SLIP=m ++CONFIG_SLIP_COMPRESSED=y ++CONFIG_SLIP_SMART=y ++CONFIG_USB_CATC=m ++CONFIG_USB_KAWETH=m ++CONFIG_USB_PEGASUS=m ++CONFIG_USB_RTL8150=m ++CONFIG_USB_RTL8152=m ++CONFIG_USB_USBNET=y ++CONFIG_USB_NET_AX8817X=m ++CONFIG_USB_NET_AX88179_178A=m ++CONFIG_USB_NET_CDCETHER=m ++CONFIG_USB_NET_CDC_EEM=m ++CONFIG_USB_NET_CDC_NCM=m ++CONFIG_USB_NET_HUAWEI_CDC_NCM=m ++CONFIG_USB_NET_CDC_MBIM=m ++CONFIG_USB_NET_DM9601=m ++CONFIG_USB_NET_SR9700=m ++CONFIG_USB_NET_SR9800=m ++CONFIG_USB_NET_SMSC75XX=m ++CONFIG_USB_NET_SMSC95XX=y ++CONFIG_USB_NET_GL620A=m ++CONFIG_USB_NET_NET1080=m ++CONFIG_USB_NET_PLUSB=m ++CONFIG_USB_NET_MCS7830=m ++CONFIG_USB_NET_CDC_SUBSET=m ++CONFIG_USB_ALI_M5632=y ++CONFIG_USB_AN2720=y ++CONFIG_USB_EPSON2888=y ++CONFIG_USB_KC2190=y ++CONFIG_USB_NET_ZAURUS=m ++CONFIG_USB_NET_CX82310_ETH=m ++CONFIG_USB_NET_KALMIA=m ++CONFIG_USB_NET_QMI_WWAN=m ++CONFIG_USB_HSO=m ++CONFIG_USB_NET_INT51X1=m ++CONFIG_USB_IPHETH=m ++CONFIG_USB_SIERRA_NET=m ++CONFIG_USB_VL600=m ++CONFIG_ATH9K=m ++CONFIG_ATH9K_HTC=m ++CONFIG_CARL9170=m ++CONFIG_ATH6KL=m ++CONFIG_ATH6KL_USB=m ++CONFIG_AR5523=m ++CONFIG_AT76C50X_USB=m ++CONFIG_B43=m ++# CONFIG_B43_PHY_N is not set ++CONFIG_B43LEGACY=m ++CONFIG_BRCMFMAC=m ++CONFIG_BRCMFMAC_USB=y ++CONFIG_HOSTAP=m ++CONFIG_P54_COMMON=m ++CONFIG_P54_USB=m ++CONFIG_LIBERTAS=m ++CONFIG_LIBERTAS_USB=m ++CONFIG_LIBERTAS_SDIO=m ++CONFIG_LIBERTAS_THINFIRM=m ++CONFIG_LIBERTAS_THINFIRM_USB=m ++CONFIG_MWIFIEX=m ++CONFIG_MWIFIEX_SDIO=m ++CONFIG_MT7601U=m ++CONFIG_RT2X00=m ++CONFIG_RT2500USB=m ++CONFIG_RT73USB=m ++CONFIG_RT2800USB=m ++CONFIG_RT2800USB_RT3573=y ++CONFIG_RT2800USB_RT53XX=y ++CONFIG_RT2800USB_RT55XX=y ++CONFIG_RT2800USB_UNKNOWN=y ++CONFIG_RTL8187=m ++CONFIG_RTL8192CU=m ++CONFIG_USB_ZD1201=m ++CONFIG_ZD1211RW=m ++CONFIG_MAC80211_HWSIM=m ++CONFIG_USB_NET_RNDIS_WLAN=m ++CONFIG_WIMAX_I2400M_USB=m ++CONFIG_IEEE802154_AT86RF230=m ++CONFIG_IEEE802154_MRF24J40=m ++CONFIG_IEEE802154_CC2520=m ++CONFIG_INPUT_POLLDEV=m ++# CONFIG_INPUT_MOUSEDEV_PSAUX is not set ++CONFIG_INPUT_JOYDEV=m ++CONFIG_INPUT_EVDEV=m ++# CONFIG_KEYBOARD_ATKBD is not set ++CONFIG_KEYBOARD_GPIO=m ++# CONFIG_INPUT_MOUSE is not set ++CONFIG_INPUT_JOYSTICK=y ++CONFIG_JOYSTICK_IFORCE=m ++CONFIG_JOYSTICK_IFORCE_USB=y ++CONFIG_JOYSTICK_XPAD=m ++CONFIG_JOYSTICK_XPAD_FF=y ++CONFIG_JOYSTICK_RPISENSE=m ++CONFIG_INPUT_TOUCHSCREEN=y ++CONFIG_TOUCHSCREEN_ADS7846=m ++CONFIG_TOUCHSCREEN_EGALAX=m ++CONFIG_TOUCHSCREEN_FT6236=m ++CONFIG_TOUCHSCREEN_RPI_FT5406=m ++CONFIG_TOUCHSCREEN_USB_COMPOSITE=m ++CONFIG_TOUCHSCREEN_STMPE=m ++CONFIG_INPUT_MISC=y ++CONFIG_INPUT_AD714X=m ++CONFIG_INPUT_ATI_REMOTE2=m ++CONFIG_INPUT_KEYSPAN_REMOTE=m ++CONFIG_INPUT_POWERMATE=m ++CONFIG_INPUT_YEALINK=m ++CONFIG_INPUT_CM109=m ++CONFIG_INPUT_UINPUT=m ++CONFIG_INPUT_GPIO_ROTARY_ENCODER=m ++CONFIG_INPUT_ADXL34X=m ++CONFIG_INPUT_CMA3000=m ++CONFIG_SERIO=m ++CONFIG_SERIO_RAW=m ++CONFIG_GAMEPORT=m ++CONFIG_GAMEPORT_NS558=m ++CONFIG_GAMEPORT_L4=m ++CONFIG_BRCM_CHAR_DRIVERS=y ++CONFIG_BCM_VC_CMA=y ++CONFIG_BCM_VCIO=y ++CONFIG_BCM_VC_SM=y ++CONFIG_DEVPTS_MULTIPLE_INSTANCES=y ++# CONFIG_LEGACY_PTYS is not set ++# CONFIG_DEVKMEM is not set ++CONFIG_SERIAL_8250=y ++# CONFIG_SERIAL_8250_DEPRECATED_OPTIONS is not set ++CONFIG_SERIAL_8250_CONSOLE=y ++# CONFIG_SERIAL_8250_DMA is not set ++CONFIG_SERIAL_8250_NR_UARTS=1 ++CONFIG_SERIAL_8250_RUNTIME_UARTS=0 ++CONFIG_SERIAL_OF_PLATFORM=y ++CONFIG_SERIAL_AMBA_PL011=y ++CONFIG_SERIAL_AMBA_PL011_CONSOLE=y ++CONFIG_TTY_PRINTK=y ++CONFIG_HW_RANDOM=y ++CONFIG_RAW_DRIVER=y ++CONFIG_I2C=y ++CONFIG_I2C_CHARDEV=m ++CONFIG_I2C_MUX_PCA954x=m ++CONFIG_I2C_BCM2708=m ++CONFIG_I2C_GPIO=m ++CONFIG_SPI=y ++CONFIG_SPI_BCM2835=m ++CONFIG_SPI_BCM2835AUX=m ++CONFIG_SPI_SPIDEV=y ++CONFIG_PPS=m ++CONFIG_PPS_CLIENT_LDISC=m ++CONFIG_PPS_CLIENT_GPIO=m ++CONFIG_GPIO_SYSFS=y ++CONFIG_GPIO_BCM_VIRT=y ++CONFIG_GPIO_ARIZONA=m ++CONFIG_GPIO_STMPE=y ++CONFIG_W1=m ++CONFIG_W1_MASTER_DS2490=m ++CONFIG_W1_MASTER_DS2482=m ++CONFIG_W1_MASTER_DS1WM=m ++CONFIG_W1_MASTER_GPIO=m ++CONFIG_W1_SLAVE_THERM=m ++CONFIG_W1_SLAVE_SMEM=m ++CONFIG_W1_SLAVE_DS2408=m ++CONFIG_W1_SLAVE_DS2413=m ++CONFIG_W1_SLAVE_DS2406=m ++CONFIG_W1_SLAVE_DS2423=m ++CONFIG_W1_SLAVE_DS2431=m ++CONFIG_W1_SLAVE_DS2433=m ++CONFIG_W1_SLAVE_DS2760=m ++CONFIG_W1_SLAVE_DS2780=m ++CONFIG_W1_SLAVE_DS2781=m ++CONFIG_W1_SLAVE_DS28E04=m ++CONFIG_W1_SLAVE_BQ27000=m ++CONFIG_BATTERY_DS2760=m ++CONFIG_POWER_RESET=y ++CONFIG_POWER_RESET_GPIO=y ++CONFIG_HWMON=m ++CONFIG_SENSORS_SHT21=m ++CONFIG_SENSORS_SHTC1=m ++CONFIG_THERMAL=y ++CONFIG_THERMAL_BCM2835=y ++CONFIG_WATCHDOG=y ++CONFIG_BCM2835_WDT=m ++CONFIG_UCB1400_CORE=m ++CONFIG_MFD_STMPE=y ++CONFIG_STMPE_SPI=y ++CONFIG_MFD_ARIZONA_I2C=m ++CONFIG_MFD_ARIZONA_SPI=m ++CONFIG_MFD_WM5102=y ++CONFIG_MEDIA_SUPPORT=m ++CONFIG_MEDIA_CAMERA_SUPPORT=y ++CONFIG_MEDIA_ANALOG_TV_SUPPORT=y ++CONFIG_MEDIA_DIGITAL_TV_SUPPORT=y ++CONFIG_MEDIA_RADIO_SUPPORT=y ++CONFIG_MEDIA_RC_SUPPORT=y ++CONFIG_MEDIA_CONTROLLER=y ++CONFIG_LIRC=m ++CONFIG_RC_DEVICES=y ++CONFIG_RC_ATI_REMOTE=m ++CONFIG_IR_IMON=m ++CONFIG_IR_MCEUSB=m ++CONFIG_IR_REDRAT3=m ++CONFIG_IR_STREAMZAP=m ++CONFIG_IR_IGUANA=m ++CONFIG_IR_TTUSBIR=m ++CONFIG_RC_LOOPBACK=m ++CONFIG_IR_GPIO_CIR=m ++CONFIG_MEDIA_USB_SUPPORT=y ++CONFIG_USB_VIDEO_CLASS=m ++CONFIG_USB_M5602=m ++CONFIG_USB_STV06XX=m ++CONFIG_USB_GL860=m ++CONFIG_USB_GSPCA_BENQ=m ++CONFIG_USB_GSPCA_CONEX=m ++CONFIG_USB_GSPCA_CPIA1=m ++CONFIG_USB_GSPCA_DTCS033=m ++CONFIG_USB_GSPCA_ETOMS=m ++CONFIG_USB_GSPCA_FINEPIX=m ++CONFIG_USB_GSPCA_JEILINJ=m ++CONFIG_USB_GSPCA_JL2005BCD=m ++CONFIG_USB_GSPCA_KINECT=m ++CONFIG_USB_GSPCA_KONICA=m ++CONFIG_USB_GSPCA_MARS=m ++CONFIG_USB_GSPCA_MR97310A=m ++CONFIG_USB_GSPCA_NW80X=m ++CONFIG_USB_GSPCA_OV519=m ++CONFIG_USB_GSPCA_OV534=m ++CONFIG_USB_GSPCA_OV534_9=m ++CONFIG_USB_GSPCA_PAC207=m ++CONFIG_USB_GSPCA_PAC7302=m ++CONFIG_USB_GSPCA_PAC7311=m ++CONFIG_USB_GSPCA_SE401=m ++CONFIG_USB_GSPCA_SN9C2028=m ++CONFIG_USB_GSPCA_SN9C20X=m ++CONFIG_USB_GSPCA_SONIXB=m ++CONFIG_USB_GSPCA_SONIXJ=m ++CONFIG_USB_GSPCA_SPCA500=m ++CONFIG_USB_GSPCA_SPCA501=m ++CONFIG_USB_GSPCA_SPCA505=m ++CONFIG_USB_GSPCA_SPCA506=m ++CONFIG_USB_GSPCA_SPCA508=m ++CONFIG_USB_GSPCA_SPCA561=m ++CONFIG_USB_GSPCA_SPCA1528=m ++CONFIG_USB_GSPCA_SQ905=m ++CONFIG_USB_GSPCA_SQ905C=m ++CONFIG_USB_GSPCA_SQ930X=m ++CONFIG_USB_GSPCA_STK014=m ++CONFIG_USB_GSPCA_STK1135=m ++CONFIG_USB_GSPCA_STV0680=m ++CONFIG_USB_GSPCA_SUNPLUS=m ++CONFIG_USB_GSPCA_T613=m ++CONFIG_USB_GSPCA_TOPRO=m ++CONFIG_USB_GSPCA_TV8532=m ++CONFIG_USB_GSPCA_VC032X=m ++CONFIG_USB_GSPCA_VICAM=m ++CONFIG_USB_GSPCA_XIRLINK_CIT=m ++CONFIG_USB_GSPCA_ZC3XX=m ++CONFIG_USB_PWC=m ++CONFIG_VIDEO_CPIA2=m ++CONFIG_USB_ZR364XX=m ++CONFIG_USB_STKWEBCAM=m ++CONFIG_USB_S2255=m ++CONFIG_VIDEO_USBTV=m ++CONFIG_VIDEO_PVRUSB2=m ++CONFIG_VIDEO_HDPVR=m ++CONFIG_VIDEO_USBVISION=m ++CONFIG_VIDEO_STK1160_COMMON=m ++CONFIG_VIDEO_STK1160_AC97=y ++CONFIG_VIDEO_GO7007=m ++CONFIG_VIDEO_GO7007_USB=m ++CONFIG_VIDEO_GO7007_USB_S2250_BOARD=m ++CONFIG_VIDEO_AU0828=m ++CONFIG_VIDEO_AU0828_RC=y ++CONFIG_VIDEO_CX231XX=m ++CONFIG_VIDEO_CX231XX_ALSA=m ++CONFIG_VIDEO_CX231XX_DVB=m ++CONFIG_VIDEO_TM6000=m ++CONFIG_VIDEO_TM6000_ALSA=m ++CONFIG_VIDEO_TM6000_DVB=m ++CONFIG_DVB_USB=m ++CONFIG_DVB_USB_A800=m ++CONFIG_DVB_USB_DIBUSB_MB=m ++CONFIG_DVB_USB_DIBUSB_MB_FAULTY=y ++CONFIG_DVB_USB_DIBUSB_MC=m ++CONFIG_DVB_USB_DIB0700=m ++CONFIG_DVB_USB_UMT_010=m ++CONFIG_DVB_USB_CXUSB=m ++CONFIG_DVB_USB_M920X=m ++CONFIG_DVB_USB_DIGITV=m ++CONFIG_DVB_USB_VP7045=m ++CONFIG_DVB_USB_VP702X=m ++CONFIG_DVB_USB_GP8PSK=m ++CONFIG_DVB_USB_NOVA_T_USB2=m ++CONFIG_DVB_USB_TTUSB2=m ++CONFIG_DVB_USB_DTT200U=m ++CONFIG_DVB_USB_OPERA1=m ++CONFIG_DVB_USB_AF9005=m ++CONFIG_DVB_USB_AF9005_REMOTE=m ++CONFIG_DVB_USB_PCTV452E=m ++CONFIG_DVB_USB_DW2102=m ++CONFIG_DVB_USB_CINERGY_T2=m ++CONFIG_DVB_USB_DTV5100=m ++CONFIG_DVB_USB_FRIIO=m ++CONFIG_DVB_USB_AZ6027=m ++CONFIG_DVB_USB_TECHNISAT_USB2=m ++CONFIG_DVB_USB_V2=m ++CONFIG_DVB_USB_AF9015=m ++CONFIG_DVB_USB_AF9035=m ++CONFIG_DVB_USB_ANYSEE=m ++CONFIG_DVB_USB_AU6610=m ++CONFIG_DVB_USB_AZ6007=m ++CONFIG_DVB_USB_CE6230=m ++CONFIG_DVB_USB_EC168=m ++CONFIG_DVB_USB_GL861=m ++CONFIG_DVB_USB_LME2510=m ++CONFIG_DVB_USB_MXL111SF=m ++CONFIG_DVB_USB_RTL28XXU=m ++CONFIG_DVB_USB_DVBSKY=m ++CONFIG_SMS_USB_DRV=m ++CONFIG_DVB_B2C2_FLEXCOP_USB=m ++CONFIG_DVB_AS102=m ++CONFIG_VIDEO_EM28XX=m ++CONFIG_VIDEO_EM28XX_V4L2=m ++CONFIG_VIDEO_EM28XX_ALSA=m ++CONFIG_VIDEO_EM28XX_DVB=m ++CONFIG_V4L_PLATFORM_DRIVERS=y ++CONFIG_VIDEO_BCM2835=y ++CONFIG_VIDEO_BCM2835_MMAL=m ++CONFIG_RADIO_SI470X=y ++CONFIG_USB_SI470X=m ++CONFIG_I2C_SI470X=m ++CONFIG_RADIO_SI4713=m ++CONFIG_I2C_SI4713=m ++CONFIG_USB_MR800=m ++CONFIG_USB_DSBR=m ++CONFIG_RADIO_SHARK=m ++CONFIG_RADIO_SHARK2=m ++CONFIG_USB_KEENE=m ++CONFIG_USB_MA901=m ++CONFIG_RADIO_TEA5764=m ++CONFIG_RADIO_SAA7706H=m ++CONFIG_RADIO_TEF6862=m ++CONFIG_RADIO_WL1273=m ++CONFIG_RADIO_WL128X=m ++# CONFIG_MEDIA_SUBDRV_AUTOSELECT is not set ++CONFIG_VIDEO_UDA1342=m ++CONFIG_VIDEO_SONY_BTF_MPX=m ++CONFIG_VIDEO_TVP5150=m ++CONFIG_VIDEO_TW2804=m ++CONFIG_VIDEO_TW9903=m ++CONFIG_VIDEO_TW9906=m ++CONFIG_VIDEO_OV7640=m ++CONFIG_VIDEO_MT9V011=m +CONFIG_DRM=m ++CONFIG_DRM_LOAD_EDID_FIRMWARE=y ++CONFIG_DRM_UDL=m +CONFIG_DRM_VC4=m - CONFIG_FB=y - CONFIG_FB_BCM2708=y - CONFIG_FB_UDL=m ++CONFIG_FB=y ++CONFIG_FB_BCM2708=y ++CONFIG_FB_UDL=m ++CONFIG_FB_SSD1307=m ++CONFIG_FB_RPISENSE=m ++# CONFIG_BACKLIGHT_GENERIC is not set ++CONFIG_BACKLIGHT_RPI=m ++CONFIG_BACKLIGHT_GPIO=m ++CONFIG_FRAMEBUFFER_CONSOLE=y ++CONFIG_LOGO=y ++# CONFIG_LOGO_LINUX_MONO is not set ++# CONFIG_LOGO_LINUX_VGA16 is not set ++CONFIG_SOUND=y ++CONFIG_SND=m ++CONFIG_SND_SEQUENCER=m ++CONFIG_SND_SEQ_DUMMY=m ++CONFIG_SND_MIXER_OSS=m ++CONFIG_SND_PCM_OSS=m ++CONFIG_SND_SEQUENCER_OSS=y ++CONFIG_SND_HRTIMER=m ++CONFIG_SND_DUMMY=m ++CONFIG_SND_ALOOP=m ++CONFIG_SND_VIRMIDI=m ++CONFIG_SND_MTPAV=m ++CONFIG_SND_SERIAL_U16550=m ++CONFIG_SND_MPU401=m ++CONFIG_SND_BCM2835=m ++CONFIG_SND_USB_AUDIO=m ++CONFIG_SND_USB_UA101=m ++CONFIG_SND_USB_CAIAQ=m ++CONFIG_SND_USB_CAIAQ_INPUT=y ++CONFIG_SND_USB_6FIRE=m ++CONFIG_SND_SOC=m ++CONFIG_SND_BCM2835_SOC_I2S=m ++CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC=m ++CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS=m ++CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI=m ++CONFIG_SND_BCM2708_SOC_HIFIBERRY_AMP=m ++CONFIG_SND_BCM2708_SOC_RPI_DAC=m ++CONFIG_SND_BCM2708_SOC_RPI_PROTO=m ++CONFIG_SND_BCM2708_SOC_BOOMBERRY_DAC=m ++CONFIG_SND_BCM2708_SOC_BOOMBERRY_DIGI=m ++CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC=m ++CONFIG_SND_BCM2708_SOC_RASPIDAC3=m ++CONFIG_SND_BCM2708_SOC_ADAU1977_ADC=m ++CONFIG_SND_AUDIOINJECTOR_PI_SOUNDCARD=m ++CONFIG_SND_SOC_ADAU1701=m ++CONFIG_SND_SOC_WM8804_I2C=m ++CONFIG_SND_SIMPLE_CARD=m ++CONFIG_SOUND_PRIME=m ++CONFIG_HIDRAW=y ++CONFIG_UHID=m ++CONFIG_HID_A4TECH=m ++CONFIG_HID_ACRUX=m ++CONFIG_HID_APPLE=m ++CONFIG_HID_BELKIN=m ++CONFIG_HID_BETOP_FF=m ++CONFIG_HID_CHERRY=m ++CONFIG_HID_CHICONY=m ++CONFIG_HID_CYPRESS=m ++CONFIG_HID_DRAGONRISE=m ++CONFIG_HID_EMS_FF=m ++CONFIG_HID_ELECOM=m ++CONFIG_HID_ELO=m ++CONFIG_HID_EZKEY=m ++CONFIG_HID_HOLTEK=m ++CONFIG_HID_KEYTOUCH=m ++CONFIG_HID_KYE=m ++CONFIG_HID_UCLOGIC=m ++CONFIG_HID_WALTOP=m ++CONFIG_HID_GYRATION=m ++CONFIG_HID_TWINHAN=m ++CONFIG_HID_KENSINGTON=m ++CONFIG_HID_LCPOWER=m ++CONFIG_HID_LOGITECH=m ++CONFIG_HID_LOGITECH_DJ=m ++CONFIG_LOGITECH_FF=y ++CONFIG_LOGIRUMBLEPAD2_FF=y ++CONFIG_LOGIG940_FF=y ++CONFIG_HID_MAGICMOUSE=m ++CONFIG_HID_MICROSOFT=m ++CONFIG_HID_MONTEREY=m ++CONFIG_HID_MULTITOUCH=m ++CONFIG_HID_NTRIG=m ++CONFIG_HID_ORTEK=m ++CONFIG_HID_PANTHERLORD=m ++CONFIG_HID_PETALYNX=m ++CONFIG_HID_PICOLCD=m ++CONFIG_HID_ROCCAT=m ++CONFIG_HID_SAMSUNG=m ++CONFIG_HID_SONY=m ++CONFIG_HID_SPEEDLINK=m ++CONFIG_HID_SUNPLUS=m ++CONFIG_HID_GREENASIA=m ++CONFIG_HID_SMARTJOYPLUS=m ++CONFIG_HID_TOPSEED=m ++CONFIG_HID_THINGM=m ++CONFIG_HID_THRUSTMASTER=m ++CONFIG_HID_WACOM=m ++CONFIG_HID_WIIMOTE=m ++CONFIG_HID_XINMO=m ++CONFIG_HID_ZEROPLUS=m ++CONFIG_HID_ZYDACRON=m ++CONFIG_HID_PID=y ++CONFIG_USB_HIDDEV=y ++CONFIG_USB=y ++CONFIG_USB_ANNOUNCE_NEW_DEVICES=y ++CONFIG_USB_MON=m ++CONFIG_USB_DWCOTG=y ++CONFIG_USB_PRINTER=m ++CONFIG_USB_STORAGE=y ++CONFIG_USB_STORAGE_REALTEK=m ++CONFIG_USB_STORAGE_DATAFAB=m ++CONFIG_USB_STORAGE_FREECOM=m ++CONFIG_USB_STORAGE_ISD200=m ++CONFIG_USB_STORAGE_USBAT=m ++CONFIG_USB_STORAGE_SDDR09=m ++CONFIG_USB_STORAGE_SDDR55=m ++CONFIG_USB_STORAGE_JUMPSHOT=m ++CONFIG_USB_STORAGE_ALAUDA=m ++CONFIG_USB_STORAGE_ONETOUCH=m ++CONFIG_USB_STORAGE_KARMA=m ++CONFIG_USB_STORAGE_CYPRESS_ATACB=m ++CONFIG_USB_STORAGE_ENE_UB6250=m ++CONFIG_USB_MDC800=m ++CONFIG_USB_MICROTEK=m ++CONFIG_USBIP_CORE=m ++CONFIG_USBIP_VHCI_HCD=m ++CONFIG_USBIP_HOST=m ++CONFIG_USB_SERIAL=m ++CONFIG_USB_SERIAL_GENERIC=y ++CONFIG_USB_SERIAL_AIRCABLE=m ++CONFIG_USB_SERIAL_ARK3116=m ++CONFIG_USB_SERIAL_BELKIN=m ++CONFIG_USB_SERIAL_CH341=m ++CONFIG_USB_SERIAL_WHITEHEAT=m ++CONFIG_USB_SERIAL_DIGI_ACCELEPORT=m ++CONFIG_USB_SERIAL_CP210X=m ++CONFIG_USB_SERIAL_CYPRESS_M8=m ++CONFIG_USB_SERIAL_EMPEG=m ++CONFIG_USB_SERIAL_FTDI_SIO=m ++CONFIG_USB_SERIAL_VISOR=m ++CONFIG_USB_SERIAL_IPAQ=m ++CONFIG_USB_SERIAL_IR=m ++CONFIG_USB_SERIAL_EDGEPORT=m ++CONFIG_USB_SERIAL_EDGEPORT_TI=m ++CONFIG_USB_SERIAL_F81232=m ++CONFIG_USB_SERIAL_GARMIN=m ++CONFIG_USB_SERIAL_IPW=m ++CONFIG_USB_SERIAL_IUU=m ++CONFIG_USB_SERIAL_KEYSPAN_PDA=m ++CONFIG_USB_SERIAL_KEYSPAN=m ++CONFIG_USB_SERIAL_KLSI=m ++CONFIG_USB_SERIAL_KOBIL_SCT=m ++CONFIG_USB_SERIAL_MCT_U232=m ++CONFIG_USB_SERIAL_METRO=m ++CONFIG_USB_SERIAL_MOS7720=m ++CONFIG_USB_SERIAL_MOS7840=m ++CONFIG_USB_SERIAL_NAVMAN=m ++CONFIG_USB_SERIAL_PL2303=m ++CONFIG_USB_SERIAL_OTI6858=m ++CONFIG_USB_SERIAL_QCAUX=m ++CONFIG_USB_SERIAL_QUALCOMM=m ++CONFIG_USB_SERIAL_SPCP8X5=m ++CONFIG_USB_SERIAL_SAFE=m ++CONFIG_USB_SERIAL_SIERRAWIRELESS=m ++CONFIG_USB_SERIAL_SYMBOL=m ++CONFIG_USB_SERIAL_TI=m ++CONFIG_USB_SERIAL_CYBERJACK=m ++CONFIG_USB_SERIAL_XIRCOM=m ++CONFIG_USB_SERIAL_OPTION=m ++CONFIG_USB_SERIAL_OMNINET=m ++CONFIG_USB_SERIAL_OPTICON=m ++CONFIG_USB_SERIAL_XSENS_MT=m ++CONFIG_USB_SERIAL_WISHBONE=m ++CONFIG_USB_SERIAL_SSU100=m ++CONFIG_USB_SERIAL_QT2=m ++CONFIG_USB_SERIAL_DEBUG=m ++CONFIG_USB_EMI62=m ++CONFIG_USB_EMI26=m ++CONFIG_USB_ADUTUX=m ++CONFIG_USB_SEVSEG=m ++CONFIG_USB_RIO500=m ++CONFIG_USB_LEGOTOWER=m ++CONFIG_USB_LCD=m ++CONFIG_USB_LED=m ++CONFIG_USB_CYPRESS_CY7C63=m ++CONFIG_USB_CYTHERM=m ++CONFIG_USB_IDMOUSE=m ++CONFIG_USB_FTDI_ELAN=m ++CONFIG_USB_APPLEDISPLAY=m ++CONFIG_USB_LD=m ++CONFIG_USB_TRANCEVIBRATOR=m ++CONFIG_USB_IOWARRIOR=m ++CONFIG_USB_TEST=m ++CONFIG_USB_ISIGHTFW=m ++CONFIG_USB_YUREX=m ++CONFIG_USB_ATM=m ++CONFIG_USB_SPEEDTOUCH=m ++CONFIG_USB_CXACRU=m ++CONFIG_USB_UEAGLEATM=m ++CONFIG_USB_XUSBATM=m ++CONFIG_MMC=y ++CONFIG_MMC_BLOCK_MINORS=32 ++CONFIG_MMC_BCM2835=y ++CONFIG_MMC_BCM2835_DMA=y ++CONFIG_MMC_BCM2835_SDHOST=y ++CONFIG_MMC_SDHCI=y ++CONFIG_MMC_SDHCI_PLTFM=y ++CONFIG_MMC_SPI=m ++CONFIG_LEDS_CLASS=y ++CONFIG_LEDS_GPIO=y ++CONFIG_LEDS_TRIGGER_TIMER=y ++CONFIG_LEDS_TRIGGER_ONESHOT=y ++CONFIG_LEDS_TRIGGER_HEARTBEAT=y ++CONFIG_LEDS_TRIGGER_BACKLIGHT=y ++CONFIG_LEDS_TRIGGER_CPU=y ++CONFIG_LEDS_TRIGGER_GPIO=y ++CONFIG_LEDS_TRIGGER_DEFAULT_ON=y ++CONFIG_LEDS_TRIGGER_TRANSIENT=m ++CONFIG_LEDS_TRIGGER_CAMERA=m ++CONFIG_LEDS_TRIGGER_INPUT=y ++CONFIG_RTC_CLASS=y ++# CONFIG_RTC_HCTOSYS is not set ++CONFIG_RTC_DRV_DS1307=m ++CONFIG_RTC_DRV_DS1374=m ++CONFIG_RTC_DRV_DS1672=m ++CONFIG_RTC_DRV_MAX6900=m ++CONFIG_RTC_DRV_RS5C372=m ++CONFIG_RTC_DRV_ISL1208=m ++CONFIG_RTC_DRV_ISL12022=m ++CONFIG_RTC_DRV_ISL12057=m ++CONFIG_RTC_DRV_X1205=m ++CONFIG_RTC_DRV_PCF8523=m ++CONFIG_RTC_DRV_PCF8563=m ++CONFIG_RTC_DRV_PCF8583=m ++CONFIG_RTC_DRV_M41T80=m ++CONFIG_RTC_DRV_BQ32K=m ++CONFIG_RTC_DRV_S35390A=m ++CONFIG_RTC_DRV_FM3130=m ++CONFIG_RTC_DRV_RX8581=m ++CONFIG_RTC_DRV_RX8025=m ++CONFIG_RTC_DRV_EM3027=m ++CONFIG_RTC_DRV_RV3029C2=m ++CONFIG_RTC_DRV_M41T93=m ++CONFIG_RTC_DRV_M41T94=m ++CONFIG_RTC_DRV_DS1305=m ++CONFIG_RTC_DRV_DS1390=m ++CONFIG_RTC_DRV_R9701=m ++CONFIG_RTC_DRV_RX4581=m ++CONFIG_RTC_DRV_RS5C348=m ++CONFIG_RTC_DRV_MAX6902=m ++CONFIG_RTC_DRV_PCF2123=m ++CONFIG_RTC_DRV_DS3232=m ++CONFIG_RTC_DRV_PCF2127=m ++CONFIG_DMADEVICES=y ++CONFIG_DMA_BCM2835=y ++CONFIG_DMA_BCM2708=y ++CONFIG_UIO=m ++CONFIG_UIO_PDRV_GENIRQ=m ++CONFIG_STAGING=y ++CONFIG_PRISM2_USB=m ++CONFIG_R8712U=m ++CONFIG_R8188EU=m ++CONFIG_R8723AU=m ++CONFIG_VT6656=m ++CONFIG_SPEAKUP=m ++CONFIG_SPEAKUP_SYNTH_SOFT=m ++CONFIG_STAGING_MEDIA=y ++CONFIG_LIRC_STAGING=y ++CONFIG_LIRC_IMON=m ++CONFIG_LIRC_RPI=m ++CONFIG_LIRC_SASEM=m ++CONFIG_LIRC_SERIAL=m ++CONFIG_FB_TFT=m ++CONFIG_FB_TFT_AGM1264K_FL=m ++CONFIG_FB_TFT_BD663474=m ++CONFIG_FB_TFT_HX8340BN=m ++CONFIG_FB_TFT_HX8347D=m ++CONFIG_FB_TFT_HX8353D=m ++CONFIG_FB_TFT_ILI9163=m ++CONFIG_FB_TFT_ILI9320=m ++CONFIG_FB_TFT_ILI9325=m ++CONFIG_FB_TFT_ILI9340=m ++CONFIG_FB_TFT_ILI9341=m ++CONFIG_FB_TFT_ILI9481=m ++CONFIG_FB_TFT_ILI9486=m ++CONFIG_FB_TFT_PCD8544=m ++CONFIG_FB_TFT_RA8875=m ++CONFIG_FB_TFT_S6D02A1=m ++CONFIG_FB_TFT_S6D1121=m ++CONFIG_FB_TFT_SSD1289=m ++CONFIG_FB_TFT_SSD1306=m ++CONFIG_FB_TFT_SSD1331=m ++CONFIG_FB_TFT_SSD1351=m ++CONFIG_FB_TFT_ST7735R=m ++CONFIG_FB_TFT_TINYLCD=m ++CONFIG_FB_TFT_TLS8204=m ++CONFIG_FB_TFT_UC1701=m ++CONFIG_FB_TFT_UPD161704=m ++CONFIG_FB_TFT_WATTEROTT=m ++CONFIG_FB_FLEX=m ++CONFIG_FB_TFT_FBTFT_DEVICE=m ++CONFIG_MAILBOX=y ++CONFIG_BCM2835_MBOX=y ++# CONFIG_IOMMU_SUPPORT is not set ++CONFIG_RASPBERRYPI_POWER=y ++CONFIG_EXTCON=m ++CONFIG_EXTCON_ARIZONA=m ++CONFIG_IIO=m ++CONFIG_IIO_BUFFER=y ++CONFIG_IIO_BUFFER_CB=m ++CONFIG_IIO_KFIFO_BUF=m ++CONFIG_MCP320X=m ++CONFIG_MCP3422=m ++CONFIG_DHT11=m ++CONFIG_PWM_BCM2835=m ++CONFIG_PWM_PCA9685=m ++CONFIG_RASPBERRYPI_FIRMWARE=y ++CONFIG_EXT4_FS=y ++CONFIG_EXT4_FS_POSIX_ACL=y ++CONFIG_EXT4_FS_SECURITY=y ++CONFIG_REISERFS_FS=m ++CONFIG_REISERFS_FS_XATTR=y ++CONFIG_REISERFS_FS_POSIX_ACL=y ++CONFIG_REISERFS_FS_SECURITY=y ++CONFIG_JFS_FS=m ++CONFIG_JFS_POSIX_ACL=y ++CONFIG_JFS_SECURITY=y ++CONFIG_JFS_STATISTICS=y ++CONFIG_XFS_FS=m ++CONFIG_XFS_QUOTA=y ++CONFIG_XFS_POSIX_ACL=y ++CONFIG_XFS_RT=y ++CONFIG_GFS2_FS=m ++CONFIG_OCFS2_FS=m ++CONFIG_BTRFS_FS=m ++CONFIG_BTRFS_FS_POSIX_ACL=y ++CONFIG_NILFS2_FS=m ++CONFIG_F2FS_FS=y ++CONFIG_FANOTIFY=y ++CONFIG_QFMT_V1=m ++CONFIG_QFMT_V2=m ++CONFIG_AUTOFS4_FS=y ++CONFIG_FUSE_FS=m ++CONFIG_CUSE=m ++CONFIG_OVERLAY_FS=m ++CONFIG_FSCACHE=y ++CONFIG_FSCACHE_STATS=y ++CONFIG_FSCACHE_HISTOGRAM=y ++CONFIG_CACHEFILES=y ++CONFIG_ISO9660_FS=m ++CONFIG_JOLIET=y ++CONFIG_ZISOFS=y ++CONFIG_UDF_FS=m ++CONFIG_MSDOS_FS=y ++CONFIG_VFAT_FS=y ++CONFIG_FAT_DEFAULT_IOCHARSET="ascii" ++CONFIG_NTFS_FS=m ++CONFIG_NTFS_RW=y ++CONFIG_TMPFS=y ++CONFIG_TMPFS_POSIX_ACL=y ++CONFIG_ECRYPT_FS=m ++CONFIG_HFS_FS=m ++CONFIG_HFSPLUS_FS=m ++CONFIG_JFFS2_FS=m ++CONFIG_JFFS2_SUMMARY=y ++CONFIG_UBIFS_FS=m ++CONFIG_SQUASHFS=m ++CONFIG_SQUASHFS_XATTR=y ++CONFIG_SQUASHFS_LZO=y ++CONFIG_SQUASHFS_XZ=y ++CONFIG_NFS_FS=y ++CONFIG_NFS_V3_ACL=y ++CONFIG_NFS_V4=y ++CONFIG_NFS_SWAP=y ++CONFIG_ROOT_NFS=y ++CONFIG_NFS_FSCACHE=y ++CONFIG_NFSD=m ++CONFIG_NFSD_V3_ACL=y ++CONFIG_NFSD_V4=y ++CONFIG_CIFS=m ++CONFIG_CIFS_WEAK_PW_HASH=y ++CONFIG_CIFS_UPCALL=y ++CONFIG_CIFS_XATTR=y ++CONFIG_CIFS_POSIX=y ++CONFIG_CIFS_ACL=y ++CONFIG_CIFS_DFS_UPCALL=y ++CONFIG_CIFS_SMB2=y ++CONFIG_CIFS_FSCACHE=y ++CONFIG_9P_FS=m ++CONFIG_9P_FS_POSIX_ACL=y ++CONFIG_NLS_DEFAULT="utf8" ++CONFIG_NLS_CODEPAGE_437=y ++CONFIG_NLS_CODEPAGE_737=m ++CONFIG_NLS_CODEPAGE_775=m ++CONFIG_NLS_CODEPAGE_850=m ++CONFIG_NLS_CODEPAGE_852=m ++CONFIG_NLS_CODEPAGE_855=m ++CONFIG_NLS_CODEPAGE_857=m ++CONFIG_NLS_CODEPAGE_860=m ++CONFIG_NLS_CODEPAGE_861=m ++CONFIG_NLS_CODEPAGE_862=m ++CONFIG_NLS_CODEPAGE_863=m ++CONFIG_NLS_CODEPAGE_864=m ++CONFIG_NLS_CODEPAGE_865=m ++CONFIG_NLS_CODEPAGE_866=m ++CONFIG_NLS_CODEPAGE_869=m ++CONFIG_NLS_CODEPAGE_936=m ++CONFIG_NLS_CODEPAGE_950=m ++CONFIG_NLS_CODEPAGE_932=m ++CONFIG_NLS_CODEPAGE_949=m ++CONFIG_NLS_CODEPAGE_874=m ++CONFIG_NLS_ISO8859_8=m ++CONFIG_NLS_CODEPAGE_1250=m ++CONFIG_NLS_CODEPAGE_1251=m ++CONFIG_NLS_ASCII=y ++CONFIG_NLS_ISO8859_1=m ++CONFIG_NLS_ISO8859_2=m ++CONFIG_NLS_ISO8859_3=m ++CONFIG_NLS_ISO8859_4=m ++CONFIG_NLS_ISO8859_5=m ++CONFIG_NLS_ISO8859_6=m ++CONFIG_NLS_ISO8859_7=m ++CONFIG_NLS_ISO8859_9=m ++CONFIG_NLS_ISO8859_13=m ++CONFIG_NLS_ISO8859_14=m ++CONFIG_NLS_ISO8859_15=m ++CONFIG_NLS_KOI8_R=m ++CONFIG_NLS_KOI8_U=m ++CONFIG_DLM=m ++CONFIG_PRINTK_TIME=y ++CONFIG_BOOT_PRINTK_DELAY=y ++CONFIG_DEBUG_MEMORY_INIT=y ++CONFIG_DETECT_HUNG_TASK=y ++CONFIG_TIMER_STATS=y ++CONFIG_IRQSOFF_TRACER=y ++CONFIG_SCHED_TRACER=y ++CONFIG_STACK_TRACER=y ++CONFIG_BLK_DEV_IO_TRACE=y ++# CONFIG_KPROBE_EVENT is not set ++CONFIG_FUNCTION_PROFILER=y ++CONFIG_KGDB=y ++CONFIG_KGDB_KDB=y ++CONFIG_KDB_KEYBOARD=y ++CONFIG_CRYPTO_USER=m ++CONFIG_CRYPTO_CBC=y ++CONFIG_CRYPTO_CTS=m ++CONFIG_CRYPTO_XTS=m ++CONFIG_CRYPTO_XCBC=m ++CONFIG_CRYPTO_TGR192=m ++CONFIG_CRYPTO_WP512=m ++CONFIG_CRYPTO_CAST5=m ++CONFIG_CRYPTO_DES=y ++CONFIG_CRYPTO_USER_API_SKCIPHER=m ++# CONFIG_CRYPTO_HW is not set ++CONFIG_ARM_CRYPTO=y ++CONFIG_CRYPTO_SHA1_ARM_NEON=m ++CONFIG_CRYPTO_AES_ARM_BS=m ++CONFIG_CRC_ITU_T=y ++CONFIG_LIBCRC32C=y diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig -index 146add9..d6aa058 100644 ---- a/arch/arm/configs/bcmrpi_defconfig -+++ b/arch/arm/configs/bcmrpi_defconfig -@@ -795,6 +795,8 @@ CONFIG_VIDEO_TW9903=m - CONFIG_VIDEO_TW9906=m - CONFIG_VIDEO_OV7640=m - CONFIG_VIDEO_MT9V011=m -+CONFIG_DRM=m -+CONFIG_DRM_VC4=m - CONFIG_FB=y - CONFIG_FB_BCM2708=y - CONFIG_FB_UDL=m - -From 88315025318218ac04fcc66614083bb1a51f662f Mon Sep 17 00:00:00 2001 -From: popcornmix <popcornmix@gmail.com> -Date: Wed, 18 Nov 2015 18:29:58 +0000 -Subject: [PATCH 103/170] squash: fixups - ---- - drivers/gpu/drm/vc4/Kconfig | 2 +- - drivers/gpu/drm/vc4/vc4_drv.c | 2 +- - drivers/gpu/drm/vc4/vc4_kms.c | 2 +- - 3 files changed, 3 insertions(+), 3 deletions(-) - -diff --git a/drivers/gpu/drm/vc4/Kconfig b/drivers/gpu/drm/vc4/Kconfig -index 2d7d115..71f019f 100644 ---- a/drivers/gpu/drm/vc4/Kconfig -+++ b/drivers/gpu/drm/vc4/Kconfig -@@ -1,6 +1,6 @@ - config DRM_VC4 - tristate "Broadcom VC4 Graphics" -- depends on ARCH_BCM2835 || COMPILE_TEST -+ depends on ARCH_BCM2835 || ARCH_BCM2708 || ARCH_BCM2709 || COMPILE_TEST - depends on DRM && HAVE_DMA_ATTRS - select DRM_KMS_HELPER - select DRM_KMS_CMA_HELPER -diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c -index 3baf1fc..e2a2be2 100644 ---- a/drivers/gpu/drm/vc4/vc4_drv.c -+++ b/drivers/gpu/drm/vc4/vc4_drv.c -@@ -127,7 +127,7 @@ static struct drm_driver vc4_drm_driver = { - .num_ioctls = ARRAY_SIZE(vc4_drm_ioctls), - .fops = &vc4_drm_fops, - -- .gem_obj_size = sizeof(struct vc4_bo), -+ //.gem_obj_size = sizeof(struct vc4_bo), - - .name = DRIVER_NAME, - .desc = DRIVER_DESC, -diff --git a/drivers/gpu/drm/vc4/vc4_kms.c b/drivers/gpu/drm/vc4/vc4_kms.c -index c83287a..2082713 100644 ---- a/drivers/gpu/drm/vc4/vc4_kms.c -+++ b/drivers/gpu/drm/vc4/vc4_kms.c -@@ -45,7 +45,7 @@ vc4_atomic_complete_commit(struct vc4_commit *c) - - drm_atomic_helper_commit_modeset_disables(dev, state); - -- drm_atomic_helper_commit_planes(dev, state); -+ drm_atomic_helper_commit_planes(dev, state, false); - - drm_atomic_helper_commit_modeset_enables(dev, state); - - -From 3fc233b798ac8498b4e24b42ad67fb3499a30f07 Mon Sep 17 00:00:00 2001 -From: popcornmix <popcornmix@gmail.com> -Date: Wed, 18 Nov 2015 20:26:03 +0000 -Subject: [PATCH 104/170] squash: add missing vc4-kms-v3d-overlay.dtb to - makefile - ---- - arch/arm/boot/dts/overlays/Makefile | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/arch/arm/boot/dts/overlays/Makefile b/arch/arm/boot/dts/overlays/Makefile -index fb7ac49..fc09bfb 100644 ---- a/arch/arm/boot/dts/overlays/Makefile -+++ b/arch/arm/boot/dts/overlays/Makefile -@@ -52,6 +52,7 @@ dtb-$(RPI_DT_OVERLAYS) += smi-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += spi-gpio35-39-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += tinylcd35-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += uart1-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += vc4-kms-v3d-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += vga666-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += w1-gpio-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += w1-gpio-pullup-overlay.dtb - -From d9888c76bcee2a7c118ab8ba93a1204fb5ff4e44 Mon Sep 17 00:00:00 2001 -From: Eric Anholt <eric@anholt.net> -Date: Mon, 12 Oct 2015 11:23:34 -0700 -Subject: [PATCH 105/170] clk: bcm2835: Also build the driver for downstream - kernels. - -Signed-off-by: Eric Anholt <eric@anholt.net> ---- - drivers/clk/bcm/Makefile | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/drivers/clk/bcm/Makefile b/drivers/clk/bcm/Makefile -index 3fc9506..a1b4cbc 100644 ---- a/drivers/clk/bcm/Makefile -+++ b/drivers/clk/bcm/Makefile -@@ -3,7 +3,7 @@ obj-$(CONFIG_CLK_BCM_KONA) += clk-kona-setup.o - obj-$(CONFIG_CLK_BCM_KONA) += clk-bcm281xx.o - obj-$(CONFIG_CLK_BCM_KONA) += clk-bcm21664.o - obj-$(CONFIG_COMMON_CLK_IPROC) += clk-iproc-armpll.o clk-iproc-pll.o clk-iproc-asiu.o --obj-$(CONFIG_ARCH_BCM2835) += clk-bcm2835.o -+obj-$(CONFIG_ARCH_BCM2835)$(CONFIG_ARCH_BCM2708)$(CONFIG_ARCH_BCM2709) += clk-bcm2835.o - obj-$(CONFIG_COMMON_CLK_IPROC) += clk-ns2.o - obj-$(CONFIG_ARCH_BCM_CYGNUS) += clk-cygnus.o - obj-$(CONFIG_ARCH_BCM_NSP) += clk-nsp.o - -From 0dbc0fe760a54bbcff587657062df49dc0eaf2b9 Mon Sep 17 00:00:00 2001 -From: Holger Steinhaus <hsteinhaus@gmx.de> -Date: Sat, 14 Nov 2015 18:37:43 +0100 -Subject: [PATCH 106/170] dts: Added overlay for gpio_ir_recv driver - ---- - arch/arm/boot/dts/overlays/Makefile | 1 + - arch/arm/boot/dts/overlays/README | 18 ++++++++++- - arch/arm/boot/dts/overlays/gpio-ir-overlay.dts | 45 ++++++++++++++++++++++++++ - 3 files changed, 63 insertions(+), 1 deletion(-) - create mode 100644 arch/arm/boot/dts/overlays/gpio-ir-overlay.dts - -diff --git a/arch/arm/boot/dts/overlays/Makefile b/arch/arm/boot/dts/overlays/Makefile -index fc09bfb..ebc3354 100644 ---- a/arch/arm/boot/dts/overlays/Makefile -+++ b/arch/arm/boot/dts/overlays/Makefile -@@ -16,6 +16,7 @@ dtb-$(RPI_DT_OVERLAYS) += ads7846-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += bmp085_i2c-sensor-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += dht11-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += enc28j60-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += gpio-ir-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += gpio-poweroff-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += hifiberry-amp-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += hifiberry-dac-overlay.dtb -diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README -index f5302b2..409aee1 100644 ---- a/arch/arm/boot/dts/overlays/README -+++ b/arch/arm/boot/dts/overlays/README -@@ -196,6 +196,22 @@ Params: int_pin GPIO used for INT (default 25) - speed SPI bus speed (default 12000000) - - -+Name: gpio-ir -+Info: Use GPIO pin as rc-core style infrared receiver input. The rc-core- -+ based gpio_ir_recv driver maps received keys directly to a -+ /dev/input/event* device, all decoding is done by the kernel - LIRC is -+ not required! The key mapping and other decoding parameters can be -+ configured by "ir-keytable" tool. -+Load: dtoverlay=gpio-ir,<param>=<val> -+Params: gpio_pin Input pin number. Default is 18. -+ -+ gpio_pull Desired pull-up/down state (off, down, up) -+ Default is "down". -+ -+ rc-map-name Default rc keymap (can also be changed by -+ ir-keytable), defaults to "rc-rc6-mce" -+ -+ - Name: gpio-poweroff - Info: Drives a GPIO high or low on reboot - Load: dtoverlay=gpio-poweroff,<param>=<val> -@@ -308,7 +324,7 @@ Params: <None> - Name: lirc-rpi - Info: Configures lirc-rpi (Linux Infrared Remote Control for Raspberry Pi) - Consult the module documentation for more details. --Load: dtoverlay=lirc-rpi,<param>=<val>,... -+Load: dtoverlay=lirc-rpi,<param>=<val> - Params: gpio_out_pin GPIO for output (default "17") - - gpio_in_pin GPIO for input (default "18") -diff --git a/arch/arm/boot/dts/overlays/gpio-ir-overlay.dts b/arch/arm/boot/dts/overlays/gpio-ir-overlay.dts -new file mode 100644 -index 0000000..a2d6bc7 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/gpio-ir-overlay.dts -@@ -0,0 +1,45 @@ -+// Definitions for ir-gpio module -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target-path = "/"; -+ __overlay__ { -+ gpio_ir: ir-receiver { -+ compatible = "gpio-ir-receiver"; -+ -+ // pin number, high or low -+ gpios = <&gpio 18 1>; -+ -+ // parameter for keymap name -+ linux,rc-map-name = "rc-rc6-mce"; -+ -+ status = "okay"; -+ }; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&gpio>; -+ __overlay__ { -+ gpio_ir_pins: gpio_ir_pins { -+ brcm,pins = <18>; // pin 18 -+ brcm,function = <0>; // in -+ brcm,pull = <1>; // down -+ }; -+ }; -+ }; -+ -+ __overrides__ { -+ // parameters -+ gpio_pin = <&gpio_ir>,"gpios:4", -+ <&gpio_ir_pins>,"brcm,pins:0", -+ <&gpio_ir_pins>,"brcm,pull:0"; // pin number -+ gpio_pull = <&gpio_ir_pins>,"brcm,pull:0"; // pull-up/down state -+ -+ rc-map-name = <&gpio_ir>,"linux,rc-map-name"; // default rc map -+ }; -+}; - -From 938b09ce6c6736d0861c2c9eec3a7e739585b589 Mon Sep 17 00:00:00 2001 -From: Alistair Buxton <a.j.buxton@gmail.com> -Date: Sun, 1 Nov 2015 22:27:56 +0000 -Subject: [PATCH 107/170] Build i2c_gpio module and add a device tree overlay - to configure it. - ---- - arch/arm/boot/dts/overlays/Makefile | 1 + - arch/arm/boot/dts/overlays/README | 13 +++++++++++- - arch/arm/boot/dts/overlays/i2c-gpio-overlay.dts | 28 +++++++++++++++++++++++++ - arch/arm/configs/bcm2709_defconfig | 1 + - arch/arm/configs/bcmrpi_defconfig | 1 + - 5 files changed, 43 insertions(+), 1 deletion(-) - create mode 100644 arch/arm/boot/dts/overlays/i2c-gpio-overlay.dts - -diff --git a/arch/arm/boot/dts/overlays/Makefile b/arch/arm/boot/dts/overlays/Makefile -index ebc3354..e15d55c 100644 ---- a/arch/arm/boot/dts/overlays/Makefile -+++ b/arch/arm/boot/dts/overlays/Makefile -@@ -25,6 +25,7 @@ dtb-$(RPI_DT_OVERLAYS) += hifiberry-digi-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += hy28a-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += hy28b-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += i2c-rtc-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += i2c-gpio-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += i2s-mmap-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += iqaudio-dac-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += iqaudio-dacplus-overlay.dtb -diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README -index 409aee1..d278305 100644 ---- a/arch/arm/boot/dts/overlays/README -+++ b/arch/arm/boot/dts/overlays/README -@@ -287,9 +287,20 @@ Params: speed Display SPI bus speed - ledgpio GPIO used to control backlight - - -+Name: i2c-gpio -+Info: Adds support for software i2c controller on gpio pins -+Load: dtoverlay=i2c-gpio,<param>=<val> -+Params: i2c_gpio_sda GPIO used for I2C data (default "23") -+ -+ i2c_gpio_scl GPIO used for I2C clock (default "24") -+ -+ i2c_gpio_delay_us Clock delay in microseconds -+ (default "2" = ~100kHz) -+ -+ - Name: i2c-rtc - Info: Adds support for a number of I2C Real Time Clock devices --Load: dtoverlay=i2c-rtc,<param> -+Load: dtoverlay=i2c-rtc,<param>=<val> - Params: ds1307 Select the DS1307 device - - ds3231 Select the DS3231 device -diff --git a/arch/arm/boot/dts/overlays/i2c-gpio-overlay.dts b/arch/arm/boot/dts/overlays/i2c-gpio-overlay.dts new file mode 100644 -index 0000000..2a2dc98 +index 0000000..8bd0207 --- /dev/null -+++ b/arch/arm/boot/dts/overlays/i2c-gpio-overlay.dts -@@ -0,0 +1,28 @@ -+// Overlay for i2c_gpio bitbanging host bus. -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target-path = "/"; -+ __overlay__ { -+ i2c_gpio: i2c@0 { -+ compatible = "i2c-gpio"; -+ gpios = <&gpio 23 0 /* sda */ -+ &gpio 24 0 /* scl */ -+ >; -+ i2c-gpio,delay-us = <2>; /* ~100 kHz */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ }; -+ }; -+ }; -+ __overrides__ { -+ i2c_gpio_sda = <&i2c_gpio>,"gpios:4"; -+ i2c_gpio_scl = <&i2c_gpio>,"gpios:16"; -+ i2c_gpio_delay_us = <&i2c_gpio>,"i2c-gpio,delay-us:0"; -+ }; -+}; -+ -diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig -index 4e474c7..fc35254 100644 ---- a/arch/arm/configs/bcm2709_defconfig -+++ b/arch/arm/configs/bcm2709_defconfig -@@ -595,6 +595,7 @@ CONFIG_RAW_DRIVER=y - CONFIG_I2C=y - CONFIG_I2C_CHARDEV=m - CONFIG_I2C_BCM2708=m -+CONFIG_I2C_GPIO=m - CONFIG_SPI=y - CONFIG_SPI_BCM2835=m - CONFIG_SPI_SPIDEV=y -diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig -index d6aa058..51dc019 100644 ---- a/arch/arm/configs/bcmrpi_defconfig +++ b/arch/arm/configs/bcmrpi_defconfig -@@ -588,6 +588,7 @@ CONFIG_RAW_DRIVER=y - CONFIG_I2C=y - CONFIG_I2C_CHARDEV=m - CONFIG_I2C_BCM2708=m -+CONFIG_I2C_GPIO=m - CONFIG_SPI=y - CONFIG_SPI_BCM2835=m - CONFIG_SPI_SPIDEV=y - -From a4b5aa412585674d4a4f2ba7c0d818fd796f51c3 Mon Sep 17 00:00:00 2001 -From: mwilliams03 <mark.mwilliams@gmail.com> -Date: Sun, 18 Oct 2015 17:07:24 -0700 -Subject: [PATCH 108/170] New overlay for PiScreen2r - ---- - arch/arm/boot/dts/overlays/Makefile | 1 + - arch/arm/boot/dts/overlays/README | 14 +++ - arch/arm/boot/dts/overlays/piscreen2r-overlay.dts | 100 ++++++++++++++++++++++ - 3 files changed, 115 insertions(+) - create mode 100644 arch/arm/boot/dts/overlays/piscreen2r-overlay.dts - -diff --git a/arch/arm/boot/dts/overlays/Makefile b/arch/arm/boot/dts/overlays/Makefile -index e15d55c..8595b14 100644 ---- a/arch/arm/boot/dts/overlays/Makefile -+++ b/arch/arm/boot/dts/overlays/Makefile -@@ -35,6 +35,7 @@ dtb-$(RPI_DT_OVERLAYS) += mcp2515-can1-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += mmc-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += mz61581-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += piscreen-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += piscreen2r-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += pitft28-resistive-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += pps-gpio-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += pwm-overlay.dtb -diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README -index d278305..3116d1a 100644 ---- a/arch/arm/boot/dts/overlays/README -+++ b/arch/arm/boot/dts/overlays/README -@@ -425,6 +425,20 @@ Params: speed Display SPI bus speed - xohms Touchpanel sensitivity (X-plate resistance) - - -+Name: piscreen2r -+Info: PiScreen 2 with resistive TP display by OzzMaker.com -+Load: dtoverlay=piscreen2r,<param>=<val> -+Params: speed Display SPI bus speed -+ -+ rotate Display rotation {0,90,180,270} -+ -+ fps Delay between frame updates -+ -+ debug Debug output level {0-7} -+ -+ xohms Touchpanel sensitivity (X-plate resistance) -+ -+ - Name: pitft28-resistive - Info: Adafruit PiTFT 2.8" resistive touch screen - Load: dtoverlay=pitft28-resistive,<param>=<val> -diff --git a/arch/arm/boot/dts/overlays/piscreen2r-overlay.dts b/arch/arm/boot/dts/overlays/piscreen2r-overlay.dts -new file mode 100644 -index 0000000..7c018e0 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/piscreen2r-overlay.dts -@@ -0,0 +1,100 @@ -+ /* -+ * Device Tree overlay for PiScreen2 3.5" TFT with resistive touch by Ozzmaker.com -+ * -+ */ -+ -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; -+ -+ fragment@0 { -+ target = <&spi0>; -+ __overlay__ { -+ status = "okay"; -+ -+ spidev@0{ -+ status = "disabled"; -+ }; -+ -+ spidev@1{ -+ status = "disabled"; -+ }; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&gpio>; -+ __overlay__ { -+ piscreen2_pins: piscreen2_pins { -+ brcm,pins = <17 25 24 22>; -+ brcm,function = <0 1 1 1>; /* in out out out */ -+ }; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&spi0>; -+ __overlay__ { -+ /* needed to avoid dtc warning */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ piscreen2: piscreen2@0{ -+ compatible = "ilitek,ili9486"; -+ reg = <0>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&piscreen2_pins>; -+ bgr; -+ spi-max-frequency = <64000000>; -+ rotate = <90>; -+ fps = <30>; -+ buswidth = <8>; -+ regwidth = <16>; -+ txbuflen = <32768>; -+ reset-gpios = <&gpio 25 0>; -+ dc-gpios = <&gpio 24 0>; -+ led-gpios = <&gpio 22 1>; -+ debug = <0>; -+ -+ init = <0x10000b0 0x00 -+ 0x1000011 -+ 0x20000ff -+ 0x100003a 0x55 -+ 0x1000036 0x28 -+ 0x10000c0 0x11 0x09 -+ 0x10000c1 0x41 -+ 0x10000c5 0x00 0x00 0x00 0x00 -+ 0x10000b6 0x00 0x02 -+ 0x10000f7 0xa9 0x51 0x2c 0x2 -+ 0x10000be 0x00 0x04 -+ 0x10000e9 0x00 -+ 0x1000011 -+ 0x1000029>; -+ -+ }; -+ -+ piscreen2_ts: piscreen2-ts@1 { -+ compatible = "ti,ads7846"; -+ reg = <1>; -+ -+ spi-max-frequency = <2000000>; -+ interrupts = <17 2>; /* high-to-low edge triggered */ -+ interrupt-parent = <&gpio>; -+ pendown-gpio = <&gpio 17 0>; -+ ti,swap-xy; -+ ti,x-plate-ohms = /bits/ 16 <100>; -+ ti,pressure-max = /bits/ 16 <255>; -+ }; -+ }; -+ }; -+ __overrides__ { -+ speed = <&piscreen2>,"spi-max-frequency:0"; -+ rotate = <&piscreen2>,"rotate:0"; -+ fps = <&piscreen2>,"fps:0"; -+ debug = <&piscreen2>,"debug:0"; -+ xohms = <&piscreen2_ts>,"ti,x-plate-ohms;0"; -+ }; -+}; -+ - -From 1a4fac1ea6bb33a963b06406f6f44b527daa3a90 Mon Sep 17 00:00:00 2001 -From: Ondrej Wisniewski <ondrej.wisniewski@gmail.com> -Date: Fri, 6 Nov 2015 15:01:28 +0100 -Subject: [PATCH 109/170] dts: Added overlay for Adafruit PiTFT 2.8" capacitive - touch screen - ---- - arch/arm/boot/dts/overlays/Makefile | 1 + - arch/arm/boot/dts/overlays/README | 22 ++++++ - .../dts/overlays/pitft28-capacitive-overlay.dts | 88 ++++++++++++++++++++++ - 3 files changed, 111 insertions(+) - create mode 100644 arch/arm/boot/dts/overlays/pitft28-capacitive-overlay.dts - -diff --git a/arch/arm/boot/dts/overlays/Makefile b/arch/arm/boot/dts/overlays/Makefile -index 8595b14..7d747bc 100644 ---- a/arch/arm/boot/dts/overlays/Makefile -+++ b/arch/arm/boot/dts/overlays/Makefile -@@ -36,6 +36,7 @@ dtb-$(RPI_DT_OVERLAYS) += mmc-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += mz61581-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += piscreen-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += piscreen2r-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += pitft28-capacitive-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += pitft28-resistive-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += pps-gpio-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += pwm-overlay.dtb -diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README -index 3116d1a..950b6c5 100644 ---- a/arch/arm/boot/dts/overlays/README -+++ b/arch/arm/boot/dts/overlays/README -@@ -439,6 +439,28 @@ Params: speed Display SPI bus speed - xohms Touchpanel sensitivity (X-plate resistance) - - -+Name: pitft28-capacitive -+Info: Adafruit PiTFT 2.8" capacitive touch screen -+Load: dtoverlay=pitft28-capacitive,<param>=<val> -+Params: speed Display SPI bus speed -+ -+ rotate Display rotation {0,90,180,270} -+ -+ fps Delay between frame updates -+ -+ debug Debug output level {0-7} -+ -+ touch-sizex Touchscreen size x (default 240) -+ -+ touch-sizey Touchscreen size y (default 320) -+ -+ touch-invx Touchscreen inverted x axis -+ -+ touch-invy Touchscreen inverted y axis -+ -+ touch-swapxy Touchscreen swapped x y axis -+ -+ - Name: pitft28-resistive - Info: Adafruit PiTFT 2.8" resistive touch screen - Load: dtoverlay=pitft28-resistive,<param>=<val> -diff --git a/arch/arm/boot/dts/overlays/pitft28-capacitive-overlay.dts b/arch/arm/boot/dts/overlays/pitft28-capacitive-overlay.dts -new file mode 100644 -index 0000000..48920e9 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/pitft28-capacitive-overlay.dts -@@ -0,0 +1,88 @@ -+/* -+ * Device Tree overlay for Adafruit PiTFT 2.8" capacitive touch screen -+ * -+ */ -+ -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; -+ -+ fragment@0 { -+ target = <&spi0>; -+ __overlay__ { -+ status = "okay"; -+ -+ spidev@0{ -+ status = "disabled"; -+ }; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&gpio>; -+ __overlay__ { -+ pitft_pins: pitft_pins { -+ brcm,pins = <24 25>; -+ brcm,function = <0 1>; /* in out */ -+ brcm,pull = <2 0>; /* pullup none */ -+ }; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&spi0>; -+ __overlay__ { -+ /* needed to avoid dtc warning */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ pitft: pitft@0{ -+ compatible = "ilitek,ili9340"; -+ reg = <0>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pitft_pins>; -+ -+ spi-max-frequency = <32000000>; -+ rotate = <90>; -+ fps = <25>; -+ bgr; -+ buswidth = <8>; -+ dc-gpios = <&gpio 25 0>; -+ debug = <0>; -+ }; -+ }; -+ }; -+ -+ fragment@3 { -+ target = <&i2c1>; -+ __overlay__ { -+ /* needed to avoid dtc warning */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ ft6236: ft6236@38 { -+ compatible = "focaltech,ft6236"; -+ reg = <0x38>; -+ -+ interrupt-parent = <&gpio>; -+ interrupts = <24 2>; -+ touchscreen-size-x = <240>; -+ touchscreen-size-y = <320>; -+ }; -+ }; -+ }; -+ -+ __overrides__ { -+ speed = <&pitft>,"spi-max-frequency:0"; -+ rotate = <&pitft>,"rotate:0"; -+ fps = <&pitft>,"fps:0"; -+ debug = <&pitft>,"debug:0"; -+ touch-sizex = <&ft6236>,"touchscreen-size-x?"; -+ touch-sizey = <&ft6236>,"touchscreen-size-y?"; -+ touch-invx = <&ft6236>,"touchscreen-inverted-x?"; -+ touch-invy = <&ft6236>,"touchscreen-inverted-y?"; -+ touch-swapxy = <&ft6236>,"touchscreen-swapped-x-y?"; -+ }; -+}; - -From 660ba9173ca14b48d7cd2f69ff45e67ebe4d947a Mon Sep 17 00:00:00 2001 -From: Stuart MacLean <stuart@hifiberry.com> -Date: Fri, 2 Oct 2015 15:12:59 +0100 -Subject: [PATCH 110/170] Add support for the HiFiBerry DAC+ Pro. - -The HiFiBerry DAC+ and DAC+ Pro products both use the existing bcm sound driver with the DAC+ Pro having a special clock device driver representing the two high precision oscillators. - -An addition bug fix is included for the PCM512x codec where by the physical size of the sample frame is used in the calculation of the LRCK divisor as it was found to be wrong when using 24-bit depth sample contained in a little endian 4-byte sample frame. ---- - .../dts/overlays/hifiberry-dacplus-overlay.dts | 15 +- - drivers/clk/Makefile | 1 + - drivers/clk/clk-hifiberry-dacpro.c | 160 ++++++++++++++ - sound/soc/bcm/hifiberry_dacplus.c | 244 +++++++++++++++++++-- - sound/soc/codecs/pcm512x.c | 3 +- - 5 files changed, 396 insertions(+), 27 deletions(-) - create mode 100644 drivers/clk/clk-hifiberry-dacpro.c - -diff --git a/arch/arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts b/arch/arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts -index deb9c625..f923a48 100644 ---- a/arch/arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts -+++ b/arch/arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts -@@ -6,6 +6,16 @@ - compatible = "brcm,bcm2708"; - - fragment@0 { -+ target-path = "/clocks"; -+ __overlay__ { -+ dacpro_osc: dacpro_osc { -+ compatible = "hifiberry,dacpro-clk"; -+ #clock-cells = <0>; -+ }; -+ }; -+ }; -+ -+ fragment@1 { - target = <&sound>; - __overlay__ { - compatible = "hifiberry,hifiberry-dacplus"; -@@ -14,14 +24,14 @@ - }; - }; - -- fragment@1 { -+ fragment@2 { - target = <&i2s>; - __overlay__ { - status = "okay"; - }; - }; - -- fragment@2 { -+ fragment@3 { - target = <&i2c1>; - __overlay__ { - #address-cells = <1>; -@@ -32,6 +42,7 @@ - #sound-dai-cells = <0>; - compatible = "ti,pcm5122"; - reg = <0x4d>; -+ clocks = <&dacpro_osc>; - status = "okay"; - }; - }; -diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile -index 820714c..94ccf038 100644 ---- a/drivers/clk/Makefile -+++ b/drivers/clk/Makefile -@@ -24,6 +24,7 @@ obj-$(CONFIG_COMMON_CLK_CDCE706) += clk-cdce706.o - obj-$(CONFIG_ARCH_CLPS711X) += clk-clps711x.o - obj-$(CONFIG_ARCH_EFM32) += clk-efm32gg.o - obj-$(CONFIG_ARCH_HIGHBANK) += clk-highbank.o -+obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS) += clk-hifiberry-dacpro.o - obj-$(CONFIG_MACH_LOONGSON32) += clk-ls1x.o - obj-$(CONFIG_COMMON_CLK_MAX_GEN) += clk-max-gen.o - obj-$(CONFIG_COMMON_CLK_MAX77686) += clk-max77686.o -diff --git a/drivers/clk/clk-hifiberry-dacpro.c b/drivers/clk/clk-hifiberry-dacpro.c -new file mode 100644 -index 0000000..3e35d45 ---- /dev/null -+++ b/drivers/clk/clk-hifiberry-dacpro.c -@@ -0,0 +1,160 @@ -+/* -+ * Clock Driver for HiFiBerry DAC Pro -+ * -+ * Author: Stuart MacLean -+ * Copyright 2015 -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License -+ * version 2 as published by the Free Software Foundation. -+ * -+ * This program is distributed in the hope that it will be useful, but -+ * WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * General Public License for more details. -+ */ -+ -+#include <linux/clk-provider.h> -+#include <linux/clkdev.h> -+#include <linux/kernel.h> -+#include <linux/module.h> -+#include <linux/of.h> -+#include <linux/slab.h> -+#include <linux/platform_device.h> -+ -+/* Clock rate of CLK44EN attached to GPIO6 pin */ -+#define CLK_44EN_RATE 22579200UL -+/* Clock rate of CLK48EN attached to GPIO3 pin */ -+#define CLK_48EN_RATE 24576000UL -+ -+/** -+ * struct hifiberry_dacpro_clk - Common struct to the HiFiBerry DAC Pro -+ * @hw: clk_hw for the common clk framework -+ * @mode: 0 => CLK44EN, 1 => CLK48EN -+ */ -+struct clk_hifiberry_hw { -+ struct clk_hw hw; -+ uint8_t mode; -+}; -+ -+#define to_hifiberry_clk(_hw) container_of(_hw, struct clk_hifiberry_hw, hw) -+ -+static const struct of_device_id clk_hifiberry_dacpro_dt_ids[] = { -+ { .compatible = "hifiberry,dacpro-clk",}, -+ { } -+}; -+MODULE_DEVICE_TABLE(of, clk_hifiberry_dacpro_dt_ids); -+ -+static unsigned long clk_hifiberry_dacpro_recalc_rate(struct clk_hw *hw, -+ unsigned long parent_rate) -+{ -+ return (to_hifiberry_clk(hw)->mode == 0) ? CLK_44EN_RATE : -+ CLK_48EN_RATE; -+} -+ -+static long clk_hifiberry_dacpro_round_rate(struct clk_hw *hw, -+ unsigned long rate, unsigned long *parent_rate) -+{ -+ long actual_rate; -+ -+ if (rate <= CLK_44EN_RATE) { -+ actual_rate = (long)CLK_44EN_RATE; -+ } else if (rate >= CLK_48EN_RATE) { -+ actual_rate = (long)CLK_48EN_RATE; -+ } else { -+ long diff44Rate = (long)(rate - CLK_44EN_RATE); -+ long diff48Rate = (long)(CLK_48EN_RATE - rate); -+ -+ if (diff44Rate < diff48Rate) -+ actual_rate = (long)CLK_44EN_RATE; -+ else -+ actual_rate = (long)CLK_48EN_RATE; -+ } -+ return actual_rate; -+} -+ -+ -+static int clk_hifiberry_dacpro_set_rate(struct clk_hw *hw, -+ unsigned long rate, unsigned long parent_rate) -+{ -+ unsigned long actual_rate; -+ struct clk_hifiberry_hw *clk = to_hifiberry_clk(hw); -+ -+ actual_rate = (unsigned long)clk_hifiberry_dacpro_round_rate(hw, rate, -+ &parent_rate); -+ clk->mode = (actual_rate == CLK_44EN_RATE) ? 0 : 1; -+ return 0; -+} -+ -+ -+const struct clk_ops clk_hifiberry_dacpro_rate_ops = { -+ .recalc_rate = clk_hifiberry_dacpro_recalc_rate, -+ .round_rate = clk_hifiberry_dacpro_round_rate, -+ .set_rate = clk_hifiberry_dacpro_set_rate, -+}; -+ -+static int clk_hifiberry_dacpro_probe(struct platform_device *pdev) -+{ -+ int ret; -+ struct clk_hifiberry_hw *proclk; -+ struct clk *clk; -+ struct device *dev; -+ struct clk_init_data init; -+ -+ dev = &pdev->dev; -+ -+ proclk = kzalloc(sizeof(struct clk_hifiberry_hw), GFP_KERNEL); -+ if (!proclk) -+ return -ENOMEM; -+ -+ init.name = "clk-hifiberry-dacpro"; -+ init.ops = &clk_hifiberry_dacpro_rate_ops; -+ init.flags = CLK_IS_ROOT | CLK_IS_BASIC; -+ init.parent_names = NULL; -+ init.num_parents = 0; -+ -+ proclk->mode = 0; -+ proclk->hw.init = &init; -+ -+ clk = devm_clk_register(dev, &proclk->hw); -+ if (!IS_ERR(clk)) { -+ ret = of_clk_add_provider(dev->of_node, of_clk_src_simple_get, -+ clk); -+ } else { -+ dev_err(dev, "Fail to register clock driver\n"); -+ kfree(proclk); -+ ret = PTR_ERR(clk); -+ } -+ return ret; -+} -+ -+static int clk_hifiberry_dacpro_remove(struct platform_device *pdev) -+{ -+ of_clk_del_provider(pdev->dev.of_node); -+ return 0; -+} -+ -+static struct platform_driver clk_hifiberry_dacpro_driver = { -+ .probe = clk_hifiberry_dacpro_probe, -+ .remove = clk_hifiberry_dacpro_remove, -+ .driver = { -+ .name = "clk-hifiberry-dacpro", -+ .of_match_table = clk_hifiberry_dacpro_dt_ids, -+ }, -+}; -+ -+static int __init clk_hifiberry_dacpro_init(void) -+{ -+ return platform_driver_register(&clk_hifiberry_dacpro_driver); -+} -+core_initcall(clk_hifiberry_dacpro_init); -+ -+static void __exit clk_hifiberry_dacpro_exit(void) -+{ -+ platform_driver_unregister(&clk_hifiberry_dacpro_driver); -+} -+module_exit(clk_hifiberry_dacpro_exit); -+ -+MODULE_DESCRIPTION("HiFiBerry DAC Pro clock driver"); -+MODULE_LICENSE("GPL v2"); -+MODULE_ALIAS("platform:clk-hifiberry-dacpro"); -diff --git a/sound/soc/bcm/hifiberry_dacplus.c b/sound/soc/bcm/hifiberry_dacplus.c -index 11e4f39..a6b651c 100644 ---- a/sound/soc/bcm/hifiberry_dacplus.c -+++ b/sound/soc/bcm/hifiberry_dacplus.c -@@ -1,8 +1,8 @@ - /* -- * ASoC Driver for HiFiBerry DAC+ -+ * ASoC Driver for HiFiBerry DAC+ / DAC Pro - * -- * Author: Daniel Matuschek -- * Copyright 2014 -+ * Author: Daniel Matuschek, Stuart MacLean <stuart@hifiberry.com> -+ * Copyright 2014-2015 - * based on code by Florian Meier <florian.meier@koalo.de> - * - * This program is free software; you can redistribute it and/or -@@ -17,6 +17,13 @@ - - #include <linux/module.h> - #include <linux/platform_device.h> -+#include <linux/kernel.h> -+#include <linux/clk.h> -+#include <linux/kernel.h> -+#include <linux/module.h> -+#include <linux/of.h> -+#include <linux/slab.h> -+#include <linux/delay.h> - - #include <sound/core.h> - #include <sound/pcm.h> -@@ -26,34 +33,222 @@ - - #include "../codecs/pcm512x.h" +@@ -0,0 +1,1289 @@ ++# CONFIG_ARM_PATCH_PHYS_VIRT is not set ++CONFIG_PHYS_OFFSET=0 ++# CONFIG_LOCALVERSION_AUTO is not set ++CONFIG_SYSVIPC=y ++CONFIG_POSIX_MQUEUE=y ++CONFIG_NO_HZ=y ++CONFIG_HIGH_RES_TIMERS=y ++CONFIG_BSD_PROCESS_ACCT=y ++CONFIG_BSD_PROCESS_ACCT_V3=y ++CONFIG_TASKSTATS=y ++CONFIG_TASK_DELAY_ACCT=y ++CONFIG_TASK_XACCT=y ++CONFIG_TASK_IO_ACCOUNTING=y ++CONFIG_IKCONFIG=m ++CONFIG_IKCONFIG_PROC=y ++CONFIG_MEMCG=y ++CONFIG_BLK_CGROUP=y ++CONFIG_CGROUP_FREEZER=y ++CONFIG_CPUSETS=y ++CONFIG_CGROUP_DEVICE=y ++CONFIG_CGROUP_CPUACCT=y ++CONFIG_NAMESPACES=y ++CONFIG_SCHED_AUTOGROUP=y ++CONFIG_BLK_DEV_INITRD=y ++CONFIG_EMBEDDED=y ++# CONFIG_COMPAT_BRK is not set ++CONFIG_PROFILING=y ++CONFIG_OPROFILE=m ++CONFIG_KPROBES=y ++CONFIG_JUMP_LABEL=y ++CONFIG_MODULES=y ++CONFIG_MODULE_UNLOAD=y ++CONFIG_MODVERSIONS=y ++CONFIG_MODULE_SRCVERSION_ALL=y ++CONFIG_BLK_DEV_THROTTLING=y ++CONFIG_PARTITION_ADVANCED=y ++CONFIG_MAC_PARTITION=y ++CONFIG_CFQ_GROUP_IOSCHED=y ++CONFIG_ARCH_BCM2708=y ++CONFIG_PREEMPT_VOLUNTARY=y ++CONFIG_AEABI=y ++CONFIG_OABI_COMPAT=y ++# CONFIG_CPU_SW_DOMAIN_PAN is not set ++CONFIG_CLEANCACHE=y ++CONFIG_FRONTSWAP=y ++CONFIG_CMA=y ++CONFIG_ZSMALLOC=m ++CONFIG_PGTABLE_MAPPING=y ++CONFIG_UACCESS_WITH_MEMCPY=y ++CONFIG_SECCOMP=y ++# CONFIG_ATAGS is not set ++CONFIG_ZBOOT_ROM_TEXT=0x0 ++CONFIG_ZBOOT_ROM_BSS=0x0 ++CONFIG_CMDLINE="console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait" ++CONFIG_CPU_FREQ=y ++CONFIG_CPU_FREQ_STAT=m ++CONFIG_CPU_FREQ_STAT_DETAILS=y ++CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE=y ++CONFIG_CPU_FREQ_GOV_PERFORMANCE=y ++CONFIG_CPU_FREQ_GOV_USERSPACE=y ++CONFIG_CPU_FREQ_GOV_ONDEMAND=y ++CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y ++CONFIG_VFP=y ++CONFIG_BINFMT_MISC=m ++# CONFIG_SUSPEND is not set ++CONFIG_PM=y ++CONFIG_NET=y ++CONFIG_PACKET=y ++CONFIG_UNIX=y ++CONFIG_XFRM_USER=y ++CONFIG_NET_KEY=m ++CONFIG_INET=y ++CONFIG_IP_MULTICAST=y ++CONFIG_IP_ADVANCED_ROUTER=y ++CONFIG_IP_MULTIPLE_TABLES=y ++CONFIG_IP_ROUTE_MULTIPATH=y ++CONFIG_IP_ROUTE_VERBOSE=y ++CONFIG_IP_PNP=y ++CONFIG_IP_PNP_DHCP=y ++CONFIG_IP_PNP_RARP=y ++CONFIG_NET_IPIP=m ++CONFIG_NET_IPGRE_DEMUX=m ++CONFIG_NET_IPGRE=m ++CONFIG_IP_MROUTE=y ++CONFIG_IP_MROUTE_MULTIPLE_TABLES=y ++CONFIG_IP_PIMSM_V1=y ++CONFIG_IP_PIMSM_V2=y ++CONFIG_SYN_COOKIES=y ++CONFIG_INET_AH=m ++CONFIG_INET_ESP=m ++CONFIG_INET_IPCOMP=m ++CONFIG_INET_XFRM_MODE_TRANSPORT=m ++CONFIG_INET_XFRM_MODE_TUNNEL=m ++CONFIG_INET_XFRM_MODE_BEET=m ++CONFIG_INET_DIAG=m ++CONFIG_IPV6=m ++CONFIG_IPV6_ROUTER_PREF=y ++CONFIG_INET6_AH=m ++CONFIG_INET6_ESP=m ++CONFIG_INET6_IPCOMP=m ++CONFIG_IPV6_TUNNEL=m ++CONFIG_IPV6_MULTIPLE_TABLES=y ++CONFIG_IPV6_SUBTREES=y ++CONFIG_IPV6_MROUTE=y ++CONFIG_IPV6_MROUTE_MULTIPLE_TABLES=y ++CONFIG_IPV6_PIMSM_V2=y ++CONFIG_NETFILTER=y ++CONFIG_NF_CONNTRACK=m ++CONFIG_NF_CONNTRACK_ZONES=y ++CONFIG_NF_CONNTRACK_EVENTS=y ++CONFIG_NF_CONNTRACK_TIMESTAMP=y ++CONFIG_NF_CT_PROTO_DCCP=m ++CONFIG_NF_CT_PROTO_UDPLITE=m ++CONFIG_NF_CONNTRACK_AMANDA=m ++CONFIG_NF_CONNTRACK_FTP=m ++CONFIG_NF_CONNTRACK_H323=m ++CONFIG_NF_CONNTRACK_IRC=m ++CONFIG_NF_CONNTRACK_NETBIOS_NS=m ++CONFIG_NF_CONNTRACK_SNMP=m ++CONFIG_NF_CONNTRACK_PPTP=m ++CONFIG_NF_CONNTRACK_SANE=m ++CONFIG_NF_CONNTRACK_SIP=m ++CONFIG_NF_CONNTRACK_TFTP=m ++CONFIG_NF_CT_NETLINK=m ++CONFIG_NETFILTER_XT_SET=m ++CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m ++CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m ++CONFIG_NETFILTER_XT_TARGET_CONNMARK=m ++CONFIG_NETFILTER_XT_TARGET_DSCP=m ++CONFIG_NETFILTER_XT_TARGET_HMARK=m ++CONFIG_NETFILTER_XT_TARGET_IDLETIMER=m ++CONFIG_NETFILTER_XT_TARGET_LED=m ++CONFIG_NETFILTER_XT_TARGET_LOG=m ++CONFIG_NETFILTER_XT_TARGET_MARK=m ++CONFIG_NETFILTER_XT_TARGET_NFLOG=m ++CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m ++CONFIG_NETFILTER_XT_TARGET_NOTRACK=m ++CONFIG_NETFILTER_XT_TARGET_TEE=m ++CONFIG_NETFILTER_XT_TARGET_TPROXY=m ++CONFIG_NETFILTER_XT_TARGET_TRACE=m ++CONFIG_NETFILTER_XT_TARGET_TCPMSS=m ++CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP=m ++CONFIG_NETFILTER_XT_MATCH_ADDRTYPE=m ++CONFIG_NETFILTER_XT_MATCH_BPF=m ++CONFIG_NETFILTER_XT_MATCH_CLUSTER=m ++CONFIG_NETFILTER_XT_MATCH_COMMENT=m ++CONFIG_NETFILTER_XT_MATCH_CONNBYTES=m ++CONFIG_NETFILTER_XT_MATCH_CONNLABEL=m ++CONFIG_NETFILTER_XT_MATCH_CONNLIMIT=m ++CONFIG_NETFILTER_XT_MATCH_CONNMARK=m ++CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m ++CONFIG_NETFILTER_XT_MATCH_CPU=m ++CONFIG_NETFILTER_XT_MATCH_DCCP=m ++CONFIG_NETFILTER_XT_MATCH_DEVGROUP=m ++CONFIG_NETFILTER_XT_MATCH_DSCP=m ++CONFIG_NETFILTER_XT_MATCH_ESP=m ++CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=m ++CONFIG_NETFILTER_XT_MATCH_HELPER=m ++CONFIG_NETFILTER_XT_MATCH_IPRANGE=m ++CONFIG_NETFILTER_XT_MATCH_IPVS=m ++CONFIG_NETFILTER_XT_MATCH_LENGTH=m ++CONFIG_NETFILTER_XT_MATCH_LIMIT=m ++CONFIG_NETFILTER_XT_MATCH_MAC=m ++CONFIG_NETFILTER_XT_MATCH_MARK=m ++CONFIG_NETFILTER_XT_MATCH_MULTIPORT=m ++CONFIG_NETFILTER_XT_MATCH_NFACCT=m ++CONFIG_NETFILTER_XT_MATCH_OSF=m ++CONFIG_NETFILTER_XT_MATCH_OWNER=m ++CONFIG_NETFILTER_XT_MATCH_POLICY=m ++CONFIG_NETFILTER_XT_MATCH_PHYSDEV=m ++CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m ++CONFIG_NETFILTER_XT_MATCH_QUOTA=m ++CONFIG_NETFILTER_XT_MATCH_RATEEST=m ++CONFIG_NETFILTER_XT_MATCH_REALM=m ++CONFIG_NETFILTER_XT_MATCH_RECENT=m ++CONFIG_NETFILTER_XT_MATCH_SOCKET=m ++CONFIG_NETFILTER_XT_MATCH_STATE=m ++CONFIG_NETFILTER_XT_MATCH_STATISTIC=m ++CONFIG_NETFILTER_XT_MATCH_STRING=m ++CONFIG_NETFILTER_XT_MATCH_TCPMSS=m ++CONFIG_NETFILTER_XT_MATCH_TIME=m ++CONFIG_NETFILTER_XT_MATCH_U32=m ++CONFIG_IP_SET=m ++CONFIG_IP_SET_BITMAP_IP=m ++CONFIG_IP_SET_BITMAP_IPMAC=m ++CONFIG_IP_SET_BITMAP_PORT=m ++CONFIG_IP_SET_HASH_IP=m ++CONFIG_IP_SET_HASH_IPPORT=m ++CONFIG_IP_SET_HASH_IPPORTIP=m ++CONFIG_IP_SET_HASH_IPPORTNET=m ++CONFIG_IP_SET_HASH_NET=m ++CONFIG_IP_SET_HASH_NETPORT=m ++CONFIG_IP_SET_HASH_NETIFACE=m ++CONFIG_IP_SET_LIST_SET=m ++CONFIG_IP_VS=m ++CONFIG_IP_VS_PROTO_TCP=y ++CONFIG_IP_VS_PROTO_UDP=y ++CONFIG_IP_VS_PROTO_ESP=y ++CONFIG_IP_VS_PROTO_AH=y ++CONFIG_IP_VS_PROTO_SCTP=y ++CONFIG_IP_VS_RR=m ++CONFIG_IP_VS_WRR=m ++CONFIG_IP_VS_LC=m ++CONFIG_IP_VS_WLC=m ++CONFIG_IP_VS_LBLC=m ++CONFIG_IP_VS_LBLCR=m ++CONFIG_IP_VS_DH=m ++CONFIG_IP_VS_SH=m ++CONFIG_IP_VS_SED=m ++CONFIG_IP_VS_NQ=m ++CONFIG_IP_VS_FTP=m ++CONFIG_IP_VS_PE_SIP=m ++CONFIG_NF_CONNTRACK_IPV4=m ++CONFIG_IP_NF_IPTABLES=m ++CONFIG_IP_NF_MATCH_AH=m ++CONFIG_IP_NF_MATCH_ECN=m ++CONFIG_IP_NF_MATCH_RPFILTER=m ++CONFIG_IP_NF_MATCH_TTL=m ++CONFIG_IP_NF_FILTER=m ++CONFIG_IP_NF_TARGET_REJECT=m ++CONFIG_IP_NF_NAT=m ++CONFIG_IP_NF_TARGET_MASQUERADE=m ++CONFIG_IP_NF_TARGET_NETMAP=m ++CONFIG_IP_NF_TARGET_REDIRECT=m ++CONFIG_IP_NF_MANGLE=m ++CONFIG_IP_NF_TARGET_CLUSTERIP=m ++CONFIG_IP_NF_TARGET_ECN=m ++CONFIG_IP_NF_TARGET_TTL=m ++CONFIG_IP_NF_RAW=m ++CONFIG_IP_NF_ARPTABLES=m ++CONFIG_IP_NF_ARPFILTER=m ++CONFIG_IP_NF_ARP_MANGLE=m ++CONFIG_NF_CONNTRACK_IPV6=m ++CONFIG_IP6_NF_IPTABLES=m ++CONFIG_IP6_NF_MATCH_AH=m ++CONFIG_IP6_NF_MATCH_EUI64=m ++CONFIG_IP6_NF_MATCH_FRAG=m ++CONFIG_IP6_NF_MATCH_OPTS=m ++CONFIG_IP6_NF_MATCH_HL=m ++CONFIG_IP6_NF_MATCH_IPV6HEADER=m ++CONFIG_IP6_NF_MATCH_MH=m ++CONFIG_IP6_NF_MATCH_RPFILTER=m ++CONFIG_IP6_NF_MATCH_RT=m ++CONFIG_IP6_NF_TARGET_HL=m ++CONFIG_IP6_NF_FILTER=m ++CONFIG_IP6_NF_TARGET_REJECT=m ++CONFIG_IP6_NF_MANGLE=m ++CONFIG_IP6_NF_RAW=m ++CONFIG_IP6_NF_NAT=m ++CONFIG_IP6_NF_TARGET_MASQUERADE=m ++CONFIG_IP6_NF_TARGET_NPT=m ++CONFIG_BRIDGE_NF_EBTABLES=m ++CONFIG_BRIDGE_EBT_BROUTE=m ++CONFIG_BRIDGE_EBT_T_FILTER=m ++CONFIG_BRIDGE_EBT_T_NAT=m ++CONFIG_BRIDGE_EBT_802_3=m ++CONFIG_BRIDGE_EBT_AMONG=m ++CONFIG_BRIDGE_EBT_ARP=m ++CONFIG_BRIDGE_EBT_IP=m ++CONFIG_BRIDGE_EBT_IP6=m ++CONFIG_BRIDGE_EBT_LIMIT=m ++CONFIG_BRIDGE_EBT_MARK=m ++CONFIG_BRIDGE_EBT_PKTTYPE=m ++CONFIG_BRIDGE_EBT_STP=m ++CONFIG_BRIDGE_EBT_VLAN=m ++CONFIG_BRIDGE_EBT_ARPREPLY=m ++CONFIG_BRIDGE_EBT_DNAT=m ++CONFIG_BRIDGE_EBT_MARK_T=m ++CONFIG_BRIDGE_EBT_REDIRECT=m ++CONFIG_BRIDGE_EBT_SNAT=m ++CONFIG_BRIDGE_EBT_LOG=m ++CONFIG_BRIDGE_EBT_NFLOG=m ++CONFIG_SCTP_COOKIE_HMAC_SHA1=y ++CONFIG_ATM=m ++CONFIG_L2TP=m ++CONFIG_L2TP_V3=y ++CONFIG_L2TP_IP=m ++CONFIG_L2TP_ETH=m ++CONFIG_BRIDGE=m ++CONFIG_VLAN_8021Q=m ++CONFIG_VLAN_8021Q_GVRP=y ++CONFIG_ATALK=m ++CONFIG_6LOWPAN=m ++CONFIG_IEEE802154=m ++CONFIG_IEEE802154_6LOWPAN=m ++CONFIG_MAC802154=m ++CONFIG_NET_SCHED=y ++CONFIG_NET_SCH_CBQ=m ++CONFIG_NET_SCH_HTB=m ++CONFIG_NET_SCH_HFSC=m ++CONFIG_NET_SCH_PRIO=m ++CONFIG_NET_SCH_MULTIQ=m ++CONFIG_NET_SCH_RED=m ++CONFIG_NET_SCH_SFB=m ++CONFIG_NET_SCH_SFQ=m ++CONFIG_NET_SCH_TEQL=m ++CONFIG_NET_SCH_TBF=m ++CONFIG_NET_SCH_GRED=m ++CONFIG_NET_SCH_DSMARK=m ++CONFIG_NET_SCH_NETEM=m ++CONFIG_NET_SCH_DRR=m ++CONFIG_NET_SCH_MQPRIO=m ++CONFIG_NET_SCH_CHOKE=m ++CONFIG_NET_SCH_QFQ=m ++CONFIG_NET_SCH_CODEL=m ++CONFIG_NET_SCH_FQ_CODEL=m ++CONFIG_NET_SCH_INGRESS=m ++CONFIG_NET_SCH_PLUG=m ++CONFIG_NET_CLS_BASIC=m ++CONFIG_NET_CLS_TCINDEX=m ++CONFIG_NET_CLS_ROUTE4=m ++CONFIG_NET_CLS_FW=m ++CONFIG_NET_CLS_U32=m ++CONFIG_CLS_U32_MARK=y ++CONFIG_NET_CLS_RSVP=m ++CONFIG_NET_CLS_RSVP6=m ++CONFIG_NET_CLS_FLOW=m ++CONFIG_NET_CLS_CGROUP=m ++CONFIG_NET_EMATCH=y ++CONFIG_NET_EMATCH_CMP=m ++CONFIG_NET_EMATCH_NBYTE=m ++CONFIG_NET_EMATCH_U32=m ++CONFIG_NET_EMATCH_META=m ++CONFIG_NET_EMATCH_TEXT=m ++CONFIG_NET_EMATCH_IPSET=m ++CONFIG_NET_CLS_ACT=y ++CONFIG_NET_ACT_POLICE=m ++CONFIG_NET_ACT_GACT=m ++CONFIG_GACT_PROB=y ++CONFIG_NET_ACT_MIRRED=m ++CONFIG_NET_ACT_IPT=m ++CONFIG_NET_ACT_NAT=m ++CONFIG_NET_ACT_PEDIT=m ++CONFIG_NET_ACT_SIMP=m ++CONFIG_NET_ACT_SKBEDIT=m ++CONFIG_NET_ACT_CSUM=m ++CONFIG_BATMAN_ADV=m ++CONFIG_OPENVSWITCH=m ++CONFIG_NET_PKTGEN=m ++CONFIG_HAMRADIO=y ++CONFIG_AX25=m ++CONFIG_NETROM=m ++CONFIG_ROSE=m ++CONFIG_MKISS=m ++CONFIG_6PACK=m ++CONFIG_BPQETHER=m ++CONFIG_BAYCOM_SER_FDX=m ++CONFIG_BAYCOM_SER_HDX=m ++CONFIG_YAM=m ++CONFIG_CAN=m ++CONFIG_CAN_VCAN=m ++CONFIG_CAN_MCP251X=m ++CONFIG_IRDA=m ++CONFIG_IRLAN=m ++CONFIG_IRNET=m ++CONFIG_IRCOMM=m ++CONFIG_IRDA_ULTRA=y ++CONFIG_IRDA_CACHE_LAST_LSAP=y ++CONFIG_IRDA_FAST_RR=y ++CONFIG_IRTTY_SIR=m ++CONFIG_KINGSUN_DONGLE=m ++CONFIG_KSDAZZLE_DONGLE=m ++CONFIG_KS959_DONGLE=m ++CONFIG_USB_IRDA=m ++CONFIG_SIGMATEL_FIR=m ++CONFIG_MCS_FIR=m ++CONFIG_BT=m ++CONFIG_BT_RFCOMM=m ++CONFIG_BT_RFCOMM_TTY=y ++CONFIG_BT_BNEP=m ++CONFIG_BT_BNEP_MC_FILTER=y ++CONFIG_BT_BNEP_PROTO_FILTER=y ++CONFIG_BT_HIDP=m ++CONFIG_BT_6LOWPAN=m ++CONFIG_BT_HCIBTUSB=m ++CONFIG_BT_HCIUART=m ++CONFIG_BT_HCIUART_3WIRE=y ++CONFIG_BT_HCIUART_BCM=y ++CONFIG_BT_HCIBCM203X=m ++CONFIG_BT_HCIBPA10X=m ++CONFIG_BT_HCIBFUSB=m ++CONFIG_BT_HCIVHCI=m ++CONFIG_BT_MRVL=m ++CONFIG_BT_MRVL_SDIO=m ++CONFIG_BT_ATH3K=m ++CONFIG_BT_WILINK=m ++CONFIG_MAC80211=m ++CONFIG_MAC80211_MESH=y ++CONFIG_WIMAX=m ++CONFIG_RFKILL=m ++CONFIG_RFKILL_INPUT=y ++CONFIG_NET_9P=m ++CONFIG_NFC=m ++CONFIG_NFC_PN533=m ++CONFIG_DEVTMPFS=y ++CONFIG_DEVTMPFS_MOUNT=y ++CONFIG_DMA_CMA=y ++CONFIG_CMA_SIZE_MBYTES=5 ++CONFIG_MTD=m ++CONFIG_MTD_BLOCK=m ++CONFIG_MTD_NAND=m ++CONFIG_MTD_UBI=m ++CONFIG_OF_CONFIGFS=y ++CONFIG_ZRAM=m ++CONFIG_ZRAM_LZ4_COMPRESS=y ++CONFIG_BLK_DEV_LOOP=y ++CONFIG_BLK_DEV_CRYPTOLOOP=m ++CONFIG_BLK_DEV_DRBD=m ++CONFIG_BLK_DEV_NBD=m ++CONFIG_BLK_DEV_RAM=y ++CONFIG_CDROM_PKTCDVD=m ++CONFIG_ATA_OVER_ETH=m ++CONFIG_EEPROM_AT24=m ++CONFIG_TI_ST=m ++CONFIG_SCSI=y ++# CONFIG_SCSI_PROC_FS is not set ++CONFIG_BLK_DEV_SD=y ++CONFIG_CHR_DEV_ST=m ++CONFIG_CHR_DEV_OSST=m ++CONFIG_BLK_DEV_SR=m ++CONFIG_CHR_DEV_SG=m ++CONFIG_SCSI_ISCSI_ATTRS=y ++CONFIG_ISCSI_TCP=m ++CONFIG_ISCSI_BOOT_SYSFS=m ++CONFIG_MD=y ++CONFIG_MD_LINEAR=m ++CONFIG_MD_RAID0=m ++CONFIG_BLK_DEV_DM=m ++CONFIG_DM_CRYPT=m ++CONFIG_DM_SNAPSHOT=m ++CONFIG_DM_THIN_PROVISIONING=m ++CONFIG_DM_MIRROR=m ++CONFIG_DM_LOG_USERSPACE=m ++CONFIG_DM_RAID=m ++CONFIG_DM_ZERO=m ++CONFIG_DM_DELAY=m ++CONFIG_NETDEVICES=y ++CONFIG_BONDING=m ++CONFIG_DUMMY=m ++CONFIG_IFB=m ++CONFIG_MACVLAN=m ++CONFIG_NETCONSOLE=m ++CONFIG_TUN=m ++CONFIG_VETH=m ++CONFIG_ENC28J60=m ++CONFIG_QCA7000=m ++CONFIG_MDIO_BITBANG=m ++CONFIG_PPP=m ++CONFIG_PPP_BSDCOMP=m ++CONFIG_PPP_DEFLATE=m ++CONFIG_PPP_FILTER=y ++CONFIG_PPP_MPPE=m ++CONFIG_PPP_MULTILINK=y ++CONFIG_PPPOATM=m ++CONFIG_PPPOE=m ++CONFIG_PPPOL2TP=m ++CONFIG_PPP_ASYNC=m ++CONFIG_PPP_SYNC_TTY=m ++CONFIG_SLIP=m ++CONFIG_SLIP_COMPRESSED=y ++CONFIG_SLIP_SMART=y ++CONFIG_USB_CATC=m ++CONFIG_USB_KAWETH=m ++CONFIG_USB_PEGASUS=m ++CONFIG_USB_RTL8150=m ++CONFIG_USB_RTL8152=m ++CONFIG_USB_USBNET=y ++CONFIG_USB_NET_AX8817X=m ++CONFIG_USB_NET_AX88179_178A=m ++CONFIG_USB_NET_CDCETHER=m ++CONFIG_USB_NET_CDC_EEM=m ++CONFIG_USB_NET_CDC_NCM=m ++CONFIG_USB_NET_HUAWEI_CDC_NCM=m ++CONFIG_USB_NET_CDC_MBIM=m ++CONFIG_USB_NET_DM9601=m ++CONFIG_USB_NET_SR9700=m ++CONFIG_USB_NET_SR9800=m ++CONFIG_USB_NET_SMSC75XX=m ++CONFIG_USB_NET_SMSC95XX=y ++CONFIG_USB_NET_GL620A=m ++CONFIG_USB_NET_NET1080=m ++CONFIG_USB_NET_PLUSB=m ++CONFIG_USB_NET_MCS7830=m ++CONFIG_USB_NET_CDC_SUBSET=m ++CONFIG_USB_ALI_M5632=y ++CONFIG_USB_AN2720=y ++CONFIG_USB_EPSON2888=y ++CONFIG_USB_KC2190=y ++CONFIG_USB_NET_ZAURUS=m ++CONFIG_USB_NET_CX82310_ETH=m ++CONFIG_USB_NET_KALMIA=m ++CONFIG_USB_NET_QMI_WWAN=m ++CONFIG_USB_HSO=m ++CONFIG_USB_NET_INT51X1=m ++CONFIG_USB_IPHETH=m ++CONFIG_USB_SIERRA_NET=m ++CONFIG_USB_VL600=m ++CONFIG_ATH9K=m ++CONFIG_ATH9K_HTC=m ++CONFIG_CARL9170=m ++CONFIG_ATH6KL=m ++CONFIG_ATH6KL_USB=m ++CONFIG_AR5523=m ++CONFIG_AT76C50X_USB=m ++CONFIG_B43=m ++# CONFIG_B43_PHY_N is not set ++CONFIG_B43LEGACY=m ++CONFIG_BRCMFMAC=m ++CONFIG_BRCMFMAC_USB=y ++CONFIG_HOSTAP=m ++CONFIG_P54_COMMON=m ++CONFIG_P54_USB=m ++CONFIG_LIBERTAS=m ++CONFIG_LIBERTAS_USB=m ++CONFIG_LIBERTAS_SDIO=m ++CONFIG_LIBERTAS_THINFIRM=m ++CONFIG_LIBERTAS_THINFIRM_USB=m ++CONFIG_MWIFIEX=m ++CONFIG_MWIFIEX_SDIO=m ++CONFIG_MT7601U=m ++CONFIG_RT2X00=m ++CONFIG_RT2500USB=m ++CONFIG_RT73USB=m ++CONFIG_RT2800USB=m ++CONFIG_RT2800USB_RT3573=y ++CONFIG_RT2800USB_RT53XX=y ++CONFIG_RT2800USB_RT55XX=y ++CONFIG_RT2800USB_UNKNOWN=y ++CONFIG_RTL8187=m ++CONFIG_RTL8192CU=m ++CONFIG_USB_ZD1201=m ++CONFIG_ZD1211RW=m ++CONFIG_MAC80211_HWSIM=m ++CONFIG_USB_NET_RNDIS_WLAN=m ++CONFIG_WIMAX_I2400M_USB=m ++CONFIG_IEEE802154_AT86RF230=m ++CONFIG_IEEE802154_MRF24J40=m ++CONFIG_IEEE802154_CC2520=m ++CONFIG_INPUT_POLLDEV=m ++# CONFIG_INPUT_MOUSEDEV_PSAUX is not set ++CONFIG_INPUT_JOYDEV=m ++CONFIG_INPUT_EVDEV=m ++# CONFIG_KEYBOARD_ATKBD is not set ++CONFIG_KEYBOARD_GPIO=m ++# CONFIG_INPUT_MOUSE is not set ++CONFIG_INPUT_JOYSTICK=y ++CONFIG_JOYSTICK_IFORCE=m ++CONFIG_JOYSTICK_IFORCE_USB=y ++CONFIG_JOYSTICK_XPAD=m ++CONFIG_JOYSTICK_XPAD_FF=y ++CONFIG_JOYSTICK_RPISENSE=m ++CONFIG_INPUT_TOUCHSCREEN=y ++CONFIG_TOUCHSCREEN_ADS7846=m ++CONFIG_TOUCHSCREEN_EGALAX=m ++CONFIG_TOUCHSCREEN_FT6236=m ++CONFIG_TOUCHSCREEN_RPI_FT5406=m ++CONFIG_TOUCHSCREEN_USB_COMPOSITE=m ++CONFIG_TOUCHSCREEN_STMPE=m ++CONFIG_INPUT_MISC=y ++CONFIG_INPUT_AD714X=m ++CONFIG_INPUT_ATI_REMOTE2=m ++CONFIG_INPUT_KEYSPAN_REMOTE=m ++CONFIG_INPUT_POWERMATE=m ++CONFIG_INPUT_YEALINK=m ++CONFIG_INPUT_CM109=m ++CONFIG_INPUT_UINPUT=m ++CONFIG_INPUT_GPIO_ROTARY_ENCODER=m ++CONFIG_INPUT_ADXL34X=m ++CONFIG_INPUT_CMA3000=m ++CONFIG_SERIO=m ++CONFIG_SERIO_RAW=m ++CONFIG_GAMEPORT=m ++CONFIG_GAMEPORT_NS558=m ++CONFIG_GAMEPORT_L4=m ++CONFIG_BRCM_CHAR_DRIVERS=y ++CONFIG_BCM_VC_CMA=y ++CONFIG_BCM_VCIO=y ++CONFIG_BCM_VC_SM=y ++CONFIG_DEVPTS_MULTIPLE_INSTANCES=y ++# CONFIG_LEGACY_PTYS is not set ++# CONFIG_DEVKMEM is not set ++CONFIG_SERIAL_8250=y ++# CONFIG_SERIAL_8250_DEPRECATED_OPTIONS is not set ++CONFIG_SERIAL_8250_CONSOLE=y ++# CONFIG_SERIAL_8250_DMA is not set ++CONFIG_SERIAL_8250_NR_UARTS=1 ++CONFIG_SERIAL_8250_RUNTIME_UARTS=0 ++CONFIG_SERIAL_OF_PLATFORM=y ++CONFIG_SERIAL_AMBA_PL011=y ++CONFIG_SERIAL_AMBA_PL011_CONSOLE=y ++CONFIG_TTY_PRINTK=y ++CONFIG_HW_RANDOM=y ++CONFIG_RAW_DRIVER=y ++CONFIG_I2C=y ++CONFIG_I2C_CHARDEV=m ++CONFIG_I2C_MUX_PCA954x=m ++CONFIG_I2C_BCM2708=m ++CONFIG_I2C_GPIO=m ++CONFIG_SPI=y ++CONFIG_SPI_BCM2835=m ++CONFIG_SPI_BCM2835AUX=m ++CONFIG_SPI_SPIDEV=y ++CONFIG_PPS=m ++CONFIG_PPS_CLIENT_LDISC=m ++CONFIG_PPS_CLIENT_GPIO=m ++CONFIG_GPIO_SYSFS=y ++CONFIG_GPIO_ARIZONA=m ++CONFIG_GPIO_STMPE=y ++CONFIG_W1=m ++CONFIG_W1_MASTER_DS2490=m ++CONFIG_W1_MASTER_DS2482=m ++CONFIG_W1_MASTER_DS1WM=m ++CONFIG_W1_MASTER_GPIO=m ++CONFIG_W1_SLAVE_THERM=m ++CONFIG_W1_SLAVE_SMEM=m ++CONFIG_W1_SLAVE_DS2408=m ++CONFIG_W1_SLAVE_DS2413=m ++CONFIG_W1_SLAVE_DS2406=m ++CONFIG_W1_SLAVE_DS2423=m ++CONFIG_W1_SLAVE_DS2431=m ++CONFIG_W1_SLAVE_DS2433=m ++CONFIG_W1_SLAVE_DS2760=m ++CONFIG_W1_SLAVE_DS2780=m ++CONFIG_W1_SLAVE_DS2781=m ++CONFIG_W1_SLAVE_DS28E04=m ++CONFIG_W1_SLAVE_BQ27000=m ++CONFIG_BATTERY_DS2760=m ++CONFIG_POWER_RESET=y ++CONFIG_POWER_RESET_GPIO=y ++CONFIG_HWMON=m ++CONFIG_SENSORS_SHT21=m ++CONFIG_SENSORS_SHTC1=m ++CONFIG_THERMAL=y ++CONFIG_THERMAL_BCM2835=y ++CONFIG_WATCHDOG=y ++CONFIG_BCM2835_WDT=m ++CONFIG_UCB1400_CORE=m ++CONFIG_MFD_STMPE=y ++CONFIG_STMPE_SPI=y ++CONFIG_MFD_ARIZONA_I2C=m ++CONFIG_MFD_ARIZONA_SPI=m ++CONFIG_MFD_WM5102=y ++CONFIG_MEDIA_SUPPORT=m ++CONFIG_MEDIA_CAMERA_SUPPORT=y ++CONFIG_MEDIA_ANALOG_TV_SUPPORT=y ++CONFIG_MEDIA_DIGITAL_TV_SUPPORT=y ++CONFIG_MEDIA_RADIO_SUPPORT=y ++CONFIG_MEDIA_RC_SUPPORT=y ++CONFIG_MEDIA_CONTROLLER=y ++CONFIG_LIRC=m ++CONFIG_RC_DEVICES=y ++CONFIG_RC_ATI_REMOTE=m ++CONFIG_IR_IMON=m ++CONFIG_IR_MCEUSB=m ++CONFIG_IR_REDRAT3=m ++CONFIG_IR_STREAMZAP=m ++CONFIG_IR_IGUANA=m ++CONFIG_IR_TTUSBIR=m ++CONFIG_RC_LOOPBACK=m ++CONFIG_IR_GPIO_CIR=m ++CONFIG_MEDIA_USB_SUPPORT=y ++CONFIG_USB_VIDEO_CLASS=m ++CONFIG_USB_M5602=m ++CONFIG_USB_STV06XX=m ++CONFIG_USB_GL860=m ++CONFIG_USB_GSPCA_BENQ=m ++CONFIG_USB_GSPCA_CONEX=m ++CONFIG_USB_GSPCA_CPIA1=m ++CONFIG_USB_GSPCA_DTCS033=m ++CONFIG_USB_GSPCA_ETOMS=m ++CONFIG_USB_GSPCA_FINEPIX=m ++CONFIG_USB_GSPCA_JEILINJ=m ++CONFIG_USB_GSPCA_JL2005BCD=m ++CONFIG_USB_GSPCA_KINECT=m ++CONFIG_USB_GSPCA_KONICA=m ++CONFIG_USB_GSPCA_MARS=m ++CONFIG_USB_GSPCA_MR97310A=m ++CONFIG_USB_GSPCA_NW80X=m ++CONFIG_USB_GSPCA_OV519=m ++CONFIG_USB_GSPCA_OV534=m ++CONFIG_USB_GSPCA_OV534_9=m ++CONFIG_USB_GSPCA_PAC207=m ++CONFIG_USB_GSPCA_PAC7302=m ++CONFIG_USB_GSPCA_PAC7311=m ++CONFIG_USB_GSPCA_SE401=m ++CONFIG_USB_GSPCA_SN9C2028=m ++CONFIG_USB_GSPCA_SN9C20X=m ++CONFIG_USB_GSPCA_SONIXB=m ++CONFIG_USB_GSPCA_SONIXJ=m ++CONFIG_USB_GSPCA_SPCA500=m ++CONFIG_USB_GSPCA_SPCA501=m ++CONFIG_USB_GSPCA_SPCA505=m ++CONFIG_USB_GSPCA_SPCA506=m ++CONFIG_USB_GSPCA_SPCA508=m ++CONFIG_USB_GSPCA_SPCA561=m ++CONFIG_USB_GSPCA_SPCA1528=m ++CONFIG_USB_GSPCA_SQ905=m ++CONFIG_USB_GSPCA_SQ905C=m ++CONFIG_USB_GSPCA_SQ930X=m ++CONFIG_USB_GSPCA_STK014=m ++CONFIG_USB_GSPCA_STK1135=m ++CONFIG_USB_GSPCA_STV0680=m ++CONFIG_USB_GSPCA_SUNPLUS=m ++CONFIG_USB_GSPCA_T613=m ++CONFIG_USB_GSPCA_TOPRO=m ++CONFIG_USB_GSPCA_TV8532=m ++CONFIG_USB_GSPCA_VC032X=m ++CONFIG_USB_GSPCA_VICAM=m ++CONFIG_USB_GSPCA_XIRLINK_CIT=m ++CONFIG_USB_GSPCA_ZC3XX=m ++CONFIG_USB_PWC=m ++CONFIG_VIDEO_CPIA2=m ++CONFIG_USB_ZR364XX=m ++CONFIG_USB_STKWEBCAM=m ++CONFIG_USB_S2255=m ++CONFIG_VIDEO_USBTV=m ++CONFIG_VIDEO_PVRUSB2=m ++CONFIG_VIDEO_HDPVR=m ++CONFIG_VIDEO_USBVISION=m ++CONFIG_VIDEO_STK1160_COMMON=m ++CONFIG_VIDEO_STK1160_AC97=y ++CONFIG_VIDEO_GO7007=m ++CONFIG_VIDEO_GO7007_USB=m ++CONFIG_VIDEO_GO7007_USB_S2250_BOARD=m ++CONFIG_VIDEO_AU0828=m ++CONFIG_VIDEO_AU0828_RC=y ++CONFIG_VIDEO_CX231XX=m ++CONFIG_VIDEO_CX231XX_ALSA=m ++CONFIG_VIDEO_CX231XX_DVB=m ++CONFIG_VIDEO_TM6000=m ++CONFIG_VIDEO_TM6000_ALSA=m ++CONFIG_VIDEO_TM6000_DVB=m ++CONFIG_DVB_USB=m ++CONFIG_DVB_USB_A800=m ++CONFIG_DVB_USB_DIBUSB_MB=m ++CONFIG_DVB_USB_DIBUSB_MB_FAULTY=y ++CONFIG_DVB_USB_DIBUSB_MC=m ++CONFIG_DVB_USB_DIB0700=m ++CONFIG_DVB_USB_UMT_010=m ++CONFIG_DVB_USB_CXUSB=m ++CONFIG_DVB_USB_M920X=m ++CONFIG_DVB_USB_DIGITV=m ++CONFIG_DVB_USB_VP7045=m ++CONFIG_DVB_USB_VP702X=m ++CONFIG_DVB_USB_GP8PSK=m ++CONFIG_DVB_USB_NOVA_T_USB2=m ++CONFIG_DVB_USB_TTUSB2=m ++CONFIG_DVB_USB_DTT200U=m ++CONFIG_DVB_USB_OPERA1=m ++CONFIG_DVB_USB_AF9005=m ++CONFIG_DVB_USB_AF9005_REMOTE=m ++CONFIG_DVB_USB_PCTV452E=m ++CONFIG_DVB_USB_DW2102=m ++CONFIG_DVB_USB_CINERGY_T2=m ++CONFIG_DVB_USB_DTV5100=m ++CONFIG_DVB_USB_FRIIO=m ++CONFIG_DVB_USB_AZ6027=m ++CONFIG_DVB_USB_TECHNISAT_USB2=m ++CONFIG_DVB_USB_V2=m ++CONFIG_DVB_USB_AF9015=m ++CONFIG_DVB_USB_AF9035=m ++CONFIG_DVB_USB_ANYSEE=m ++CONFIG_DVB_USB_AU6610=m ++CONFIG_DVB_USB_AZ6007=m ++CONFIG_DVB_USB_CE6230=m ++CONFIG_DVB_USB_EC168=m ++CONFIG_DVB_USB_GL861=m ++CONFIG_DVB_USB_LME2510=m ++CONFIG_DVB_USB_MXL111SF=m ++CONFIG_DVB_USB_RTL28XXU=m ++CONFIG_DVB_USB_DVBSKY=m ++CONFIG_SMS_USB_DRV=m ++CONFIG_DVB_B2C2_FLEXCOP_USB=m ++CONFIG_DVB_AS102=m ++CONFIG_VIDEO_EM28XX=m ++CONFIG_VIDEO_EM28XX_V4L2=m ++CONFIG_VIDEO_EM28XX_ALSA=m ++CONFIG_VIDEO_EM28XX_DVB=m ++CONFIG_V4L_PLATFORM_DRIVERS=y ++CONFIG_VIDEO_BCM2835=y ++CONFIG_VIDEO_BCM2835_MMAL=m ++CONFIG_RADIO_SI470X=y ++CONFIG_USB_SI470X=m ++CONFIG_I2C_SI470X=m ++CONFIG_RADIO_SI4713=m ++CONFIG_I2C_SI4713=m ++CONFIG_USB_MR800=m ++CONFIG_USB_DSBR=m ++CONFIG_RADIO_SHARK=m ++CONFIG_RADIO_SHARK2=m ++CONFIG_USB_KEENE=m ++CONFIG_USB_MA901=m ++CONFIG_RADIO_TEA5764=m ++CONFIG_RADIO_SAA7706H=m ++CONFIG_RADIO_TEF6862=m ++CONFIG_RADIO_WL1273=m ++CONFIG_RADIO_WL128X=m ++# CONFIG_MEDIA_SUBDRV_AUTOSELECT is not set ++CONFIG_VIDEO_UDA1342=m ++CONFIG_VIDEO_SONY_BTF_MPX=m ++CONFIG_VIDEO_TVP5150=m ++CONFIG_VIDEO_TW2804=m ++CONFIG_VIDEO_TW9903=m ++CONFIG_VIDEO_TW9906=m ++CONFIG_VIDEO_OV7640=m ++CONFIG_VIDEO_MT9V011=m ++CONFIG_DRM=m ++CONFIG_DRM_LOAD_EDID_FIRMWARE=y ++CONFIG_DRM_UDL=m ++CONFIG_DRM_VC4=m ++CONFIG_FB=y ++CONFIG_FB_BCM2708=y ++CONFIG_FB_UDL=m ++CONFIG_FB_SSD1307=m ++CONFIG_FB_RPISENSE=m ++# CONFIG_BACKLIGHT_GENERIC is not set ++CONFIG_BACKLIGHT_RPI=m ++CONFIG_BACKLIGHT_GPIO=m ++CONFIG_FRAMEBUFFER_CONSOLE=y ++CONFIG_LOGO=y ++# CONFIG_LOGO_LINUX_MONO is not set ++# CONFIG_LOGO_LINUX_VGA16 is not set ++CONFIG_SOUND=y ++CONFIG_SND=m ++CONFIG_SND_SEQUENCER=m ++CONFIG_SND_SEQ_DUMMY=m ++CONFIG_SND_MIXER_OSS=m ++CONFIG_SND_PCM_OSS=m ++CONFIG_SND_SEQUENCER_OSS=y ++CONFIG_SND_HRTIMER=m ++CONFIG_SND_DUMMY=m ++CONFIG_SND_ALOOP=m ++CONFIG_SND_VIRMIDI=m ++CONFIG_SND_MTPAV=m ++CONFIG_SND_SERIAL_U16550=m ++CONFIG_SND_MPU401=m ++CONFIG_SND_BCM2835=m ++CONFIG_SND_USB_AUDIO=m ++CONFIG_SND_USB_UA101=m ++CONFIG_SND_USB_CAIAQ=m ++CONFIG_SND_USB_CAIAQ_INPUT=y ++CONFIG_SND_USB_6FIRE=m ++CONFIG_SND_SOC=m ++CONFIG_SND_BCM2835_SOC_I2S=m ++CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC=m ++CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS=m ++CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI=m ++CONFIG_SND_BCM2708_SOC_HIFIBERRY_AMP=m ++CONFIG_SND_BCM2708_SOC_RPI_DAC=m ++CONFIG_SND_BCM2708_SOC_RPI_PROTO=m ++CONFIG_SND_BCM2708_SOC_BOOMBERRY_DAC=m ++CONFIG_SND_BCM2708_SOC_BOOMBERRY_DIGI=m ++CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC=m ++CONFIG_SND_BCM2708_SOC_RASPIDAC3=m ++CONFIG_SND_BCM2708_SOC_ADAU1977_ADC=m ++CONFIG_SND_AUDIOINJECTOR_PI_SOUNDCARD=m ++CONFIG_SND_SOC_ADAU1701=m ++CONFIG_SND_SOC_WM8804_I2C=m ++CONFIG_SND_SIMPLE_CARD=m ++CONFIG_SOUND_PRIME=m ++CONFIG_HIDRAW=y ++CONFIG_UHID=m ++CONFIG_HID_A4TECH=m ++CONFIG_HID_ACRUX=m ++CONFIG_HID_APPLE=m ++CONFIG_HID_BELKIN=m ++CONFIG_HID_BETOP_FF=m ++CONFIG_HID_CHERRY=m ++CONFIG_HID_CHICONY=m ++CONFIG_HID_CYPRESS=m ++CONFIG_HID_DRAGONRISE=m ++CONFIG_HID_EMS_FF=m ++CONFIG_HID_ELECOM=m ++CONFIG_HID_ELO=m ++CONFIG_HID_EZKEY=m ++CONFIG_HID_HOLTEK=m ++CONFIG_HID_KEYTOUCH=m ++CONFIG_HID_KYE=m ++CONFIG_HID_UCLOGIC=m ++CONFIG_HID_WALTOP=m ++CONFIG_HID_GYRATION=m ++CONFIG_HID_TWINHAN=m ++CONFIG_HID_KENSINGTON=m ++CONFIG_HID_LCPOWER=m ++CONFIG_HID_LOGITECH=m ++CONFIG_HID_LOGITECH_DJ=m ++CONFIG_LOGITECH_FF=y ++CONFIG_LOGIRUMBLEPAD2_FF=y ++CONFIG_LOGIG940_FF=y ++CONFIG_HID_MAGICMOUSE=m ++CONFIG_HID_MICROSOFT=m ++CONFIG_HID_MONTEREY=m ++CONFIG_HID_MULTITOUCH=m ++CONFIG_HID_NTRIG=m ++CONFIG_HID_ORTEK=m ++CONFIG_HID_PANTHERLORD=m ++CONFIG_HID_PETALYNX=m ++CONFIG_HID_PICOLCD=m ++CONFIG_HID_ROCCAT=m ++CONFIG_HID_SAMSUNG=m ++CONFIG_HID_SONY=m ++CONFIG_HID_SPEEDLINK=m ++CONFIG_HID_SUNPLUS=m ++CONFIG_HID_GREENASIA=m ++CONFIG_HID_SMARTJOYPLUS=m ++CONFIG_HID_TOPSEED=m ++CONFIG_HID_THINGM=m ++CONFIG_HID_THRUSTMASTER=m ++CONFIG_HID_WACOM=m ++CONFIG_HID_WIIMOTE=m ++CONFIG_HID_XINMO=m ++CONFIG_HID_ZEROPLUS=m ++CONFIG_HID_ZYDACRON=m ++CONFIG_HID_PID=y ++CONFIG_USB_HIDDEV=y ++CONFIG_USB=y ++CONFIG_USB_ANNOUNCE_NEW_DEVICES=y ++CONFIG_USB_MON=m ++CONFIG_USB_DWCOTG=y ++CONFIG_USB_PRINTER=m ++CONFIG_USB_STORAGE=y ++CONFIG_USB_STORAGE_REALTEK=m ++CONFIG_USB_STORAGE_DATAFAB=m ++CONFIG_USB_STORAGE_FREECOM=m ++CONFIG_USB_STORAGE_ISD200=m ++CONFIG_USB_STORAGE_USBAT=m ++CONFIG_USB_STORAGE_SDDR09=m ++CONFIG_USB_STORAGE_SDDR55=m ++CONFIG_USB_STORAGE_JUMPSHOT=m ++CONFIG_USB_STORAGE_ALAUDA=m ++CONFIG_USB_STORAGE_ONETOUCH=m ++CONFIG_USB_STORAGE_KARMA=m ++CONFIG_USB_STORAGE_CYPRESS_ATACB=m ++CONFIG_USB_STORAGE_ENE_UB6250=m ++CONFIG_USB_MDC800=m ++CONFIG_USB_MICROTEK=m ++CONFIG_USBIP_CORE=m ++CONFIG_USBIP_VHCI_HCD=m ++CONFIG_USBIP_HOST=m ++CONFIG_USB_DWC2=m ++CONFIG_USB_SERIAL=m ++CONFIG_USB_SERIAL_GENERIC=y ++CONFIG_USB_SERIAL_AIRCABLE=m ++CONFIG_USB_SERIAL_ARK3116=m ++CONFIG_USB_SERIAL_BELKIN=m ++CONFIG_USB_SERIAL_CH341=m ++CONFIG_USB_SERIAL_WHITEHEAT=m ++CONFIG_USB_SERIAL_DIGI_ACCELEPORT=m ++CONFIG_USB_SERIAL_CP210X=m ++CONFIG_USB_SERIAL_CYPRESS_M8=m ++CONFIG_USB_SERIAL_EMPEG=m ++CONFIG_USB_SERIAL_FTDI_SIO=m ++CONFIG_USB_SERIAL_VISOR=m ++CONFIG_USB_SERIAL_IPAQ=m ++CONFIG_USB_SERIAL_IR=m ++CONFIG_USB_SERIAL_EDGEPORT=m ++CONFIG_USB_SERIAL_EDGEPORT_TI=m ++CONFIG_USB_SERIAL_F81232=m ++CONFIG_USB_SERIAL_GARMIN=m ++CONFIG_USB_SERIAL_IPW=m ++CONFIG_USB_SERIAL_IUU=m ++CONFIG_USB_SERIAL_KEYSPAN_PDA=m ++CONFIG_USB_SERIAL_KEYSPAN=m ++CONFIG_USB_SERIAL_KLSI=m ++CONFIG_USB_SERIAL_KOBIL_SCT=m ++CONFIG_USB_SERIAL_MCT_U232=m ++CONFIG_USB_SERIAL_METRO=m ++CONFIG_USB_SERIAL_MOS7720=m ++CONFIG_USB_SERIAL_MOS7840=m ++CONFIG_USB_SERIAL_NAVMAN=m ++CONFIG_USB_SERIAL_PL2303=m ++CONFIG_USB_SERIAL_OTI6858=m ++CONFIG_USB_SERIAL_QCAUX=m ++CONFIG_USB_SERIAL_QUALCOMM=m ++CONFIG_USB_SERIAL_SPCP8X5=m ++CONFIG_USB_SERIAL_SAFE=m ++CONFIG_USB_SERIAL_SIERRAWIRELESS=m ++CONFIG_USB_SERIAL_SYMBOL=m ++CONFIG_USB_SERIAL_TI=m ++CONFIG_USB_SERIAL_CYBERJACK=m ++CONFIG_USB_SERIAL_XIRCOM=m ++CONFIG_USB_SERIAL_OPTION=m ++CONFIG_USB_SERIAL_OMNINET=m ++CONFIG_USB_SERIAL_OPTICON=m ++CONFIG_USB_SERIAL_XSENS_MT=m ++CONFIG_USB_SERIAL_WISHBONE=m ++CONFIG_USB_SERIAL_SSU100=m ++CONFIG_USB_SERIAL_QT2=m ++CONFIG_USB_SERIAL_DEBUG=m ++CONFIG_USB_EMI62=m ++CONFIG_USB_EMI26=m ++CONFIG_USB_ADUTUX=m ++CONFIG_USB_SEVSEG=m ++CONFIG_USB_RIO500=m ++CONFIG_USB_LEGOTOWER=m ++CONFIG_USB_LCD=m ++CONFIG_USB_LED=m ++CONFIG_USB_CYPRESS_CY7C63=m ++CONFIG_USB_CYTHERM=m ++CONFIG_USB_IDMOUSE=m ++CONFIG_USB_FTDI_ELAN=m ++CONFIG_USB_APPLEDISPLAY=m ++CONFIG_USB_LD=m ++CONFIG_USB_TRANCEVIBRATOR=m ++CONFIG_USB_IOWARRIOR=m ++CONFIG_USB_TEST=m ++CONFIG_USB_ISIGHTFW=m ++CONFIG_USB_YUREX=m ++CONFIG_USB_ATM=m ++CONFIG_USB_SPEEDTOUCH=m ++CONFIG_USB_CXACRU=m ++CONFIG_USB_UEAGLEATM=m ++CONFIG_USB_XUSBATM=m ++CONFIG_USB_GADGET=m ++CONFIG_USB_ZERO=m ++CONFIG_USB_AUDIO=m ++CONFIG_USB_ETH=m ++CONFIG_USB_GADGETFS=m ++CONFIG_USB_MASS_STORAGE=m ++CONFIG_USB_G_SERIAL=m ++CONFIG_USB_MIDI_GADGET=m ++CONFIG_USB_G_PRINTER=m ++CONFIG_USB_CDC_COMPOSITE=m ++CONFIG_USB_G_ACM_MS=m ++CONFIG_USB_G_MULTI=m ++CONFIG_USB_G_HID=m ++CONFIG_USB_G_WEBCAM=m ++CONFIG_MMC=y ++CONFIG_MMC_BLOCK_MINORS=32 ++CONFIG_MMC_BCM2835=y ++CONFIG_MMC_BCM2835_DMA=y ++CONFIG_MMC_BCM2835_SDHOST=y ++CONFIG_MMC_SDHCI=y ++CONFIG_MMC_SDHCI_PLTFM=y ++CONFIG_MMC_SPI=m ++CONFIG_LEDS_CLASS=y ++CONFIG_LEDS_GPIO=y ++CONFIG_LEDS_TRIGGER_TIMER=y ++CONFIG_LEDS_TRIGGER_ONESHOT=y ++CONFIG_LEDS_TRIGGER_HEARTBEAT=y ++CONFIG_LEDS_TRIGGER_BACKLIGHT=y ++CONFIG_LEDS_TRIGGER_CPU=y ++CONFIG_LEDS_TRIGGER_GPIO=y ++CONFIG_LEDS_TRIGGER_DEFAULT_ON=y ++CONFIG_LEDS_TRIGGER_TRANSIENT=m ++CONFIG_LEDS_TRIGGER_CAMERA=m ++CONFIG_LEDS_TRIGGER_INPUT=y ++CONFIG_RTC_CLASS=y ++# CONFIG_RTC_HCTOSYS is not set ++CONFIG_RTC_DRV_DS1307=m ++CONFIG_RTC_DRV_DS1374=m ++CONFIG_RTC_DRV_DS1672=m ++CONFIG_RTC_DRV_MAX6900=m ++CONFIG_RTC_DRV_RS5C372=m ++CONFIG_RTC_DRV_ISL1208=m ++CONFIG_RTC_DRV_ISL12022=m ++CONFIG_RTC_DRV_ISL12057=m ++CONFIG_RTC_DRV_X1205=m ++CONFIG_RTC_DRV_PCF8523=m ++CONFIG_RTC_DRV_PCF8563=m ++CONFIG_RTC_DRV_PCF8583=m ++CONFIG_RTC_DRV_M41T80=m ++CONFIG_RTC_DRV_BQ32K=m ++CONFIG_RTC_DRV_S35390A=m ++CONFIG_RTC_DRV_FM3130=m ++CONFIG_RTC_DRV_RX8581=m ++CONFIG_RTC_DRV_RX8025=m ++CONFIG_RTC_DRV_EM3027=m ++CONFIG_RTC_DRV_RV3029C2=m ++CONFIG_RTC_DRV_M41T93=m ++CONFIG_RTC_DRV_M41T94=m ++CONFIG_RTC_DRV_DS1305=m ++CONFIG_RTC_DRV_DS1390=m ++CONFIG_RTC_DRV_R9701=m ++CONFIG_RTC_DRV_RX4581=m ++CONFIG_RTC_DRV_RS5C348=m ++CONFIG_RTC_DRV_MAX6902=m ++CONFIG_RTC_DRV_PCF2123=m ++CONFIG_RTC_DRV_DS3232=m ++CONFIG_RTC_DRV_PCF2127=m ++CONFIG_DMADEVICES=y ++CONFIG_DMA_BCM2835=y ++CONFIG_DMA_BCM2708=y ++CONFIG_UIO=m ++CONFIG_UIO_PDRV_GENIRQ=m ++CONFIG_STAGING=y ++CONFIG_PRISM2_USB=m ++CONFIG_R8712U=m ++CONFIG_R8188EU=m ++CONFIG_R8723AU=m ++CONFIG_VT6656=m ++CONFIG_SPEAKUP=m ++CONFIG_SPEAKUP_SYNTH_SOFT=m ++CONFIG_STAGING_MEDIA=y ++CONFIG_LIRC_STAGING=y ++CONFIG_LIRC_IMON=m ++CONFIG_LIRC_RPI=m ++CONFIG_LIRC_SASEM=m ++CONFIG_LIRC_SERIAL=m ++CONFIG_FB_TFT=m ++CONFIG_FB_TFT_AGM1264K_FL=m ++CONFIG_FB_TFT_BD663474=m ++CONFIG_FB_TFT_HX8340BN=m ++CONFIG_FB_TFT_HX8347D=m ++CONFIG_FB_TFT_HX8353D=m ++CONFIG_FB_TFT_ILI9163=m ++CONFIG_FB_TFT_ILI9320=m ++CONFIG_FB_TFT_ILI9325=m ++CONFIG_FB_TFT_ILI9340=m ++CONFIG_FB_TFT_ILI9341=m ++CONFIG_FB_TFT_ILI9481=m ++CONFIG_FB_TFT_ILI9486=m ++CONFIG_FB_TFT_PCD8544=m ++CONFIG_FB_TFT_RA8875=m ++CONFIG_FB_TFT_S6D02A1=m ++CONFIG_FB_TFT_S6D1121=m ++CONFIG_FB_TFT_SSD1289=m ++CONFIG_FB_TFT_SSD1306=m ++CONFIG_FB_TFT_SSD1331=m ++CONFIG_FB_TFT_SSD1351=m ++CONFIG_FB_TFT_ST7735R=m ++CONFIG_FB_TFT_TINYLCD=m ++CONFIG_FB_TFT_TLS8204=m ++CONFIG_FB_TFT_UC1701=m ++CONFIG_FB_TFT_UPD161704=m ++CONFIG_FB_TFT_WATTEROTT=m ++CONFIG_FB_FLEX=m ++CONFIG_FB_TFT_FBTFT_DEVICE=m ++CONFIG_MAILBOX=y ++CONFIG_BCM2835_MBOX=y ++# CONFIG_IOMMU_SUPPORT is not set ++CONFIG_RASPBERRYPI_POWER=y ++CONFIG_EXTCON=m ++CONFIG_EXTCON_ARIZONA=m ++CONFIG_IIO=m ++CONFIG_IIO_BUFFER=y ++CONFIG_IIO_BUFFER_CB=m ++CONFIG_IIO_KFIFO_BUF=m ++CONFIG_MCP320X=m ++CONFIG_MCP3422=m ++CONFIG_DHT11=m ++CONFIG_PWM_BCM2835=m ++CONFIG_PWM_PCA9685=m ++CONFIG_RASPBERRYPI_FIRMWARE=y ++CONFIG_EXT4_FS=y ++CONFIG_EXT4_FS_POSIX_ACL=y ++CONFIG_EXT4_FS_SECURITY=y ++CONFIG_REISERFS_FS=m ++CONFIG_REISERFS_FS_XATTR=y ++CONFIG_REISERFS_FS_POSIX_ACL=y ++CONFIG_REISERFS_FS_SECURITY=y ++CONFIG_JFS_FS=m ++CONFIG_JFS_POSIX_ACL=y ++CONFIG_JFS_SECURITY=y ++CONFIG_JFS_STATISTICS=y ++CONFIG_XFS_FS=m ++CONFIG_XFS_QUOTA=y ++CONFIG_XFS_POSIX_ACL=y ++CONFIG_XFS_RT=y ++CONFIG_GFS2_FS=m ++CONFIG_OCFS2_FS=m ++CONFIG_BTRFS_FS=m ++CONFIG_BTRFS_FS_POSIX_ACL=y ++CONFIG_NILFS2_FS=m ++CONFIG_F2FS_FS=y ++CONFIG_FANOTIFY=y ++CONFIG_QFMT_V1=m ++CONFIG_QFMT_V2=m ++CONFIG_AUTOFS4_FS=y ++CONFIG_FUSE_FS=m ++CONFIG_CUSE=m ++CONFIG_OVERLAY_FS=m ++CONFIG_FSCACHE=y ++CONFIG_FSCACHE_STATS=y ++CONFIG_FSCACHE_HISTOGRAM=y ++CONFIG_CACHEFILES=y ++CONFIG_ISO9660_FS=m ++CONFIG_JOLIET=y ++CONFIG_ZISOFS=y ++CONFIG_UDF_FS=m ++CONFIG_MSDOS_FS=y ++CONFIG_VFAT_FS=y ++CONFIG_FAT_DEFAULT_IOCHARSET="ascii" ++CONFIG_NTFS_FS=m ++CONFIG_NTFS_RW=y ++CONFIG_TMPFS=y ++CONFIG_TMPFS_POSIX_ACL=y ++CONFIG_ECRYPT_FS=m ++CONFIG_HFS_FS=m ++CONFIG_HFSPLUS_FS=m ++CONFIG_JFFS2_FS=m ++CONFIG_JFFS2_SUMMARY=y ++CONFIG_UBIFS_FS=m ++CONFIG_SQUASHFS=m ++CONFIG_SQUASHFS_XATTR=y ++CONFIG_SQUASHFS_LZO=y ++CONFIG_SQUASHFS_XZ=y ++CONFIG_NFS_FS=y ++CONFIG_NFS_V3_ACL=y ++CONFIG_NFS_V4=y ++CONFIG_NFS_SWAP=y ++CONFIG_ROOT_NFS=y ++CONFIG_NFS_FSCACHE=y ++CONFIG_NFSD=m ++CONFIG_NFSD_V3_ACL=y ++CONFIG_NFSD_V4=y ++CONFIG_CIFS=m ++CONFIG_CIFS_WEAK_PW_HASH=y ++CONFIG_CIFS_UPCALL=y ++CONFIG_CIFS_XATTR=y ++CONFIG_CIFS_POSIX=y ++CONFIG_CIFS_ACL=y ++CONFIG_CIFS_DFS_UPCALL=y ++CONFIG_CIFS_SMB2=y ++CONFIG_CIFS_FSCACHE=y ++CONFIG_9P_FS=m ++CONFIG_9P_FS_POSIX_ACL=y ++CONFIG_NLS_DEFAULT="utf8" ++CONFIG_NLS_CODEPAGE_437=y ++CONFIG_NLS_CODEPAGE_737=m ++CONFIG_NLS_CODEPAGE_775=m ++CONFIG_NLS_CODEPAGE_850=m ++CONFIG_NLS_CODEPAGE_852=m ++CONFIG_NLS_CODEPAGE_855=m ++CONFIG_NLS_CODEPAGE_857=m ++CONFIG_NLS_CODEPAGE_860=m ++CONFIG_NLS_CODEPAGE_861=m ++CONFIG_NLS_CODEPAGE_862=m ++CONFIG_NLS_CODEPAGE_863=m ++CONFIG_NLS_CODEPAGE_864=m ++CONFIG_NLS_CODEPAGE_865=m ++CONFIG_NLS_CODEPAGE_866=m ++CONFIG_NLS_CODEPAGE_869=m ++CONFIG_NLS_CODEPAGE_936=m ++CONFIG_NLS_CODEPAGE_950=m ++CONFIG_NLS_CODEPAGE_932=m ++CONFIG_NLS_CODEPAGE_949=m ++CONFIG_NLS_CODEPAGE_874=m ++CONFIG_NLS_ISO8859_8=m ++CONFIG_NLS_CODEPAGE_1250=m ++CONFIG_NLS_CODEPAGE_1251=m ++CONFIG_NLS_ASCII=y ++CONFIG_NLS_ISO8859_1=m ++CONFIG_NLS_ISO8859_2=m ++CONFIG_NLS_ISO8859_3=m ++CONFIG_NLS_ISO8859_4=m ++CONFIG_NLS_ISO8859_5=m ++CONFIG_NLS_ISO8859_6=m ++CONFIG_NLS_ISO8859_7=m ++CONFIG_NLS_ISO8859_9=m ++CONFIG_NLS_ISO8859_13=m ++CONFIG_NLS_ISO8859_14=m ++CONFIG_NLS_ISO8859_15=m ++CONFIG_NLS_KOI8_R=m ++CONFIG_NLS_KOI8_U=m ++CONFIG_DLM=m ++CONFIG_PRINTK_TIME=y ++CONFIG_BOOT_PRINTK_DELAY=y ++CONFIG_DEBUG_MEMORY_INIT=y ++CONFIG_DETECT_HUNG_TASK=y ++CONFIG_TIMER_STATS=y ++CONFIG_LATENCYTOP=y ++CONFIG_IRQSOFF_TRACER=y ++CONFIG_SCHED_TRACER=y ++CONFIG_STACK_TRACER=y ++CONFIG_BLK_DEV_IO_TRACE=y ++# CONFIG_KPROBE_EVENT is not set ++CONFIG_FUNCTION_PROFILER=y ++CONFIG_KGDB=y ++CONFIG_KGDB_KDB=y ++CONFIG_KDB_KEYBOARD=y ++CONFIG_CRYPTO_USER=m ++CONFIG_CRYPTO_CRYPTD=m ++CONFIG_CRYPTO_CBC=y ++CONFIG_CRYPTO_CTS=m ++CONFIG_CRYPTO_XTS=m ++CONFIG_CRYPTO_XCBC=m ++CONFIG_CRYPTO_SHA512=m ++CONFIG_CRYPTO_TGR192=m ++CONFIG_CRYPTO_WP512=m ++CONFIG_CRYPTO_CAST5=m ++CONFIG_CRYPTO_DES=y ++CONFIG_CRYPTO_USER_API_SKCIPHER=m ++# CONFIG_CRYPTO_HW is not set ++CONFIG_ARM_CRYPTO=y ++CONFIG_CRYPTO_SHA1_ARM=m ++CONFIG_CRYPTO_AES_ARM=m ++CONFIG_CRC_ITU_T=y ++CONFIG_LIBCRC32C=y + +From 62dcca217ece326d398b5a2ded691690d01014f1 Mon Sep 17 00:00:00 2001 +From: Gordon Hollingworth <gordon@raspberrypi.org> +Date: Tue, 12 May 2015 14:47:56 +0100 +Subject: [PATCH 078/112] rpi-ft5406: Add touchscreen driver for pi LCD display + +Fix driver detection failure Check that the buffer response is non-zero meaning the touchscreen was detected + +rpi-ft5406: Use firmware API +--- + drivers/input/touchscreen/Kconfig | 7 + + drivers/input/touchscreen/Makefile | 1 + + drivers/input/touchscreen/rpi-ft5406.c | 246 +++++++++++++++++++++++++++++++++ + 3 files changed, 254 insertions(+) + create mode 100644 drivers/input/touchscreen/rpi-ft5406.c + +diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig +index 8ecdc38..1e4e7a0 100644 +--- a/drivers/input/touchscreen/Kconfig ++++ b/drivers/input/touchscreen/Kconfig +@@ -630,6 +630,13 @@ config TOUCHSCREEN_EDT_FT5X06 + To compile this driver as a module, choose M here: the + module will be called edt-ft5x06. -+#define HIFIBERRY_DACPRO_NOCLOCK 0 -+#define HIFIBERRY_DACPRO_CLK44EN 1 -+#define HIFIBERRY_DACPRO_CLK48EN 2 -+ -+struct pcm512x_priv { -+ struct regmap *regmap; -+ struct clk *sclk; -+}; ++config TOUCHSCREEN_RPI_FT5406 ++ tristate "Raspberry Pi FT5406 driver" ++ depends on RASPBERRYPI_FIRMWARE ++ help ++ Say Y here to enable the Raspberry Pi memory based FT5406 device + -+/* Clock rate of CLK44EN attached to GPIO6 pin */ -+#define CLK_44EN_RATE 22579200UL -+/* Clock rate of CLK48EN attached to GPIO3 pin */ -+#define CLK_48EN_RATE 24576000UL + -+static bool snd_rpi_hifiberry_is_dacpro; + config TOUCHSCREEN_MIGOR + tristate "Renesas MIGO-R touchscreen" + depends on SH_MIGOR && I2C +diff --git a/drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile +index f42975e..92590b3 100644 +--- a/drivers/input/touchscreen/Makefile ++++ b/drivers/input/touchscreen/Makefile +@@ -29,6 +29,7 @@ obj-$(CONFIG_TOUCHSCREEN_DA9034) += da9034-ts.o + obj-$(CONFIG_TOUCHSCREEN_DA9052) += da9052_tsi.o + obj-$(CONFIG_TOUCHSCREEN_DYNAPRO) += dynapro.o + obj-$(CONFIG_TOUCHSCREEN_EDT_FT5X06) += edt-ft5x06.o ++obj-$(CONFIG_TOUCHSCREEN_RPI_FT5406) += rpi-ft5406.o + obj-$(CONFIG_TOUCHSCREEN_HAMPSHIRE) += hampshire.o + obj-$(CONFIG_TOUCHSCREEN_GUNZE) += gunze.o + obj-$(CONFIG_TOUCHSCREEN_EETI) += eeti_ts.o +diff --git a/drivers/input/touchscreen/rpi-ft5406.c b/drivers/input/touchscreen/rpi-ft5406.c +new file mode 100644 +index 0000000..b27dbee +--- /dev/null ++++ b/drivers/input/touchscreen/rpi-ft5406.c +@@ -0,0 +1,246 @@ ++/* ++ * Driver for memory based ft5406 touchscreen ++ * ++ * Copyright (C) 2015 Raspberry Pi ++ * ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 as ++ * published by the Free Software Foundation. ++ */ + -+static void snd_rpi_hifiberry_dacplus_select_clk(struct snd_soc_codec *codec, -+ int clk_id) -+{ -+ switch (clk_id) { -+ case HIFIBERRY_DACPRO_NOCLOCK: -+ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x24, 0x00); -+ break; -+ case HIFIBERRY_DACPRO_CLK44EN: -+ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x24, 0x20); -+ break; -+ case HIFIBERRY_DACPRO_CLK48EN: -+ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x24, 0x04); -+ break; -+ } -+} + -+static void snd_rpi_hifiberry_dacplus_clk_gpio(struct snd_soc_codec *codec) -+{ -+ snd_soc_update_bits(codec, PCM512x_GPIO_EN, 0x24, 0x24); -+ snd_soc_update_bits(codec, PCM512x_GPIO_OUTPUT_3, 0x0f, 0x02); -+ snd_soc_update_bits(codec, PCM512x_GPIO_OUTPUT_6, 0x0f, 0x02); -+} ++#include <linux/module.h> ++#include <linux/interrupt.h> ++#include <linux/input.h> ++#include <linux/irq.h> ++#include <linux/delay.h> ++#include <linux/slab.h> ++#include <linux/bitops.h> ++#include <linux/input/mt.h> ++#include <linux/kthread.h> ++#include <linux/platform_device.h> ++#include <asm/io.h> ++#include <soc/bcm2835/raspberrypi-firmware.h> + -+static bool snd_rpi_hifiberry_dacplus_is_sclk(struct snd_soc_codec *codec) -+{ -+ int sck; ++#define MAXIMUM_SUPPORTED_POINTS 10 ++struct ft5406_regs { ++ uint8_t device_mode; ++ uint8_t gesture_id; ++ uint8_t num_points; ++ struct ft5406_touch { ++ uint8_t xh; ++ uint8_t xl; ++ uint8_t yh; ++ uint8_t yl; ++ uint8_t res1; ++ uint8_t res2; ++ } point[MAXIMUM_SUPPORTED_POINTS]; ++}; + -+ sck = snd_soc_read(codec, PCM512x_RATE_DET_4); -+ return (!(sck & 0x40)); -+} ++#define SCREEN_WIDTH 800 ++#define SCREEN_HEIGHT 480 + -+static bool snd_rpi_hifiberry_dacplus_is_sclk_sleep( -+ struct snd_soc_codec *codec) -+{ -+ msleep(2); -+ return snd_rpi_hifiberry_dacplus_is_sclk(codec); -+} ++struct ft5406 { ++ struct platform_device * pdev; ++ struct input_dev * input_dev; ++ void __iomem * ts_base; ++ struct ft5406_regs * regs; ++ struct task_struct * thread; ++}; + -+static bool snd_rpi_hifiberry_dacplus_is_pro_card(struct snd_soc_codec *codec) ++/* Thread to poll for touchscreen events ++ * ++ * This thread polls the memory based register copy of the ft5406 registers ++ * using the number of points register to know whether the copy has been ++ * updated (we write 99 to the memory copy, the GPU will write between ++ * 0 - 10 points) ++ */ ++static int ft5406_thread(void *arg) +{ -+ bool isClk44EN, isClk48En, isNoClk; -+ -+ snd_rpi_hifiberry_dacplus_clk_gpio(codec); -+ -+ snd_rpi_hifiberry_dacplus_select_clk(codec, HIFIBERRY_DACPRO_CLK44EN); -+ isClk44EN = snd_rpi_hifiberry_dacplus_is_sclk_sleep(codec); -+ -+ snd_rpi_hifiberry_dacplus_select_clk(codec, HIFIBERRY_DACPRO_NOCLOCK); -+ isNoClk = snd_rpi_hifiberry_dacplus_is_sclk_sleep(codec); ++ struct ft5406 *ts = (struct ft5406 *) arg; ++ struct ft5406_regs regs; ++ int known_ids = 0; ++ ++ while(!kthread_should_stop()) ++ { ++ // 60fps polling ++ msleep_interruptible(17); ++ memcpy_fromio(&regs, ts->regs, sizeof(*ts->regs)); ++ writel(99, &ts->regs->num_points); ++ // Do not output if theres no new information (num_points is 99) ++ // or we have no touch points and don't need to release any ++ if(!(regs.num_points == 99 || (regs.num_points == 0 && known_ids == 0))) ++ { ++ int i; ++ int modified_ids = 0, released_ids; ++ for(i = 0; i < regs.num_points; i++) ++ { ++ int x = (((int) regs.point[i].xh & 0xf) << 8) + regs.point[i].xl; ++ int y = (((int) regs.point[i].yh & 0xf) << 8) + regs.point[i].yl; ++ int touchid = (regs.point[i].yh >> 4) & 0xf; ++ ++ modified_ids |= 1 << touchid; + -+ snd_rpi_hifiberry_dacplus_select_clk(codec, HIFIBERRY_DACPRO_CLK48EN); -+ isClk48En = snd_rpi_hifiberry_dacplus_is_sclk_sleep(codec); ++ if(!((1 << touchid) & known_ids)) ++ dev_dbg(&ts->pdev->dev, "x = %d, y = %d, touchid = %d\n", x, y, touchid); ++ ++ input_mt_slot(ts->input_dev, touchid); ++ input_mt_report_slot_state(ts->input_dev, MT_TOOL_FINGER, 1); + -+ return (isClk44EN && isClk48En && !isNoClk); -+} ++ input_report_abs(ts->input_dev, ABS_MT_POSITION_X, x); ++ input_report_abs(ts->input_dev, ABS_MT_POSITION_Y, y); + -+static int snd_rpi_hifiberry_dacplus_clk_for_rate(int sample_rate) -+{ -+ int type; ++ } + -+ switch (sample_rate) { -+ case 11025: -+ case 22050: -+ case 44100: -+ case 88200: -+ case 176400: -+ type = HIFIBERRY_DACPRO_CLK44EN; -+ break; -+ default: -+ type = HIFIBERRY_DACPRO_CLK48EN; -+ break; ++ released_ids = known_ids & ~modified_ids; ++ for(i = 0; released_ids && i < MAXIMUM_SUPPORTED_POINTS; i++) ++ { ++ if(released_ids & (1<<i)) ++ { ++ dev_dbg(&ts->pdev->dev, "Released %d, known = %x modified = %x\n", i, known_ids, modified_ids); ++ input_mt_slot(ts->input_dev, i); ++ input_mt_report_slot_state(ts->input_dev, MT_TOOL_FINGER, 0); ++ modified_ids &= ~(1 << i); ++ } ++ } ++ known_ids = modified_ids; ++ ++ input_mt_report_pointer_emulation(ts->input_dev, true); ++ input_sync(ts->input_dev); ++ } ++ + } -+ return type; ++ ++ return 0; +} + -+static void snd_rpi_hifiberry_dacplus_set_sclk(struct snd_soc_codec *codec, -+ int sample_rate) ++static int ft5406_probe(struct platform_device *pdev) +{ -+ struct pcm512x_priv *pcm512x = snd_soc_codec_get_drvdata(codec); ++ int ret; ++ struct input_dev * input_dev = input_allocate_device(); ++ struct ft5406 * ts; ++ struct device_node *fw_node; ++ struct rpi_firmware *fw; ++ u32 touchbuf; ++ ++ dev_info(&pdev->dev, "Probing device\n"); ++ ++ fw_node = of_parse_phandle(pdev->dev.of_node, "firmware", 0); ++ if (!fw_node) { ++ dev_err(&pdev->dev, "Missing firmware node\n"); ++ return -ENOENT; ++ } + -+ if (!IS_ERR(pcm512x->sclk)) { -+ int ctype; ++ fw = rpi_firmware_get(fw_node); ++ if (!fw) ++ return -EPROBE_DEFER; + -+ ctype = snd_rpi_hifiberry_dacplus_clk_for_rate(sample_rate); -+ clk_set_rate(pcm512x->sclk, (ctype == HIFIBERRY_DACPRO_CLK44EN) -+ ? CLK_44EN_RATE : CLK_48EN_RATE); -+ snd_rpi_hifiberry_dacplus_select_clk(codec, ctype); ++ ret = rpi_firmware_property(fw, RPI_FIRMWARE_FRAMEBUFFER_GET_TOUCHBUF, ++ &touchbuf, sizeof(touchbuf)); ++ if (ret) { ++ dev_err(&pdev->dev, "Failed to get touch buffer\n"); ++ return ret; + } -+} -+ - static int snd_rpi_hifiberry_dacplus_init(struct snd_soc_pcm_runtime *rtd) - { - struct snd_soc_codec *codec = rtd->codec; -+ struct pcm512x_priv *priv; + -+ snd_rpi_hifiberry_is_dacpro -+ = snd_rpi_hifiberry_dacplus_is_pro_card(codec); ++ if (!touchbuf) { ++ dev_err(&pdev->dev, "Touchscreen not detected\n"); ++ return -ENODEV; ++ } + -+ if (snd_rpi_hifiberry_is_dacpro) { -+ struct snd_soc_dai_link *dai = rtd->dai_link; ++ dev_dbg(&pdev->dev, "Got TS buffer 0x%x\n", touchbuf); + -+ dai->name = "HiFiBerry DAC+ Pro"; -+ dai->stream_name = "HiFiBerry DAC+ Pro HiFi"; -+ dai->dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF -+ | SND_SOC_DAIFMT_CBM_CFM; ++ ts = kzalloc(sizeof(struct ft5406), GFP_KERNEL); + -+ snd_soc_update_bits(codec, PCM512x_BCLK_LRCLK_CFG, 0x31, 0x11); -+ snd_soc_update_bits(codec, PCM512x_MASTER_MODE, 0x03, 0x03); -+ snd_soc_update_bits(codec, PCM512x_MASTER_CLKDIV_2, 0x7f, 63); -+ } else { -+ priv = snd_soc_codec_get_drvdata(codec); -+ priv->sclk = ERR_PTR(-ENOENT); ++ if (!ts || !input_dev) { ++ ret = -ENOMEM; ++ dev_err(&pdev->dev, "Failed to allocate memory\n"); ++ return ret; + } ++ ts->input_dev = input_dev; ++ platform_set_drvdata(pdev, ts); ++ ts->pdev = pdev; ++ ++ input_dev->name = "FT5406 memory based driver"; ++ ++ __set_bit(EV_KEY, input_dev->evbit); ++ __set_bit(EV_SYN, input_dev->evbit); ++ __set_bit(EV_ABS, input_dev->evbit); + - snd_soc_update_bits(codec, PCM512x_GPIO_EN, 0x08, 0x08); -- snd_soc_update_bits(codec, PCM512x_GPIO_OUTPUT_4, 0xf, 0x02); -- snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x08,0x08); -+ snd_soc_update_bits(codec, PCM512x_GPIO_OUTPUT_4, 0x0f, 0x02); -+ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x08, 0x08); -+ -+ return 0; -+} ++ input_set_abs_params(input_dev, ABS_MT_POSITION_X, 0, ++ SCREEN_WIDTH, 0, 0); ++ input_set_abs_params(input_dev, ABS_MT_POSITION_Y, 0, ++ SCREEN_HEIGHT, 0, 0); + -+static int snd_rpi_hifiberry_dacplus_update_rate_den( -+ struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params) -+{ -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_codec *codec = rtd->codec; -+ struct pcm512x_priv *pcm512x = snd_soc_codec_get_drvdata(codec); -+ struct snd_ratnum *rats_no_pll; -+ unsigned int num = 0, den = 0; -+ int err; ++ input_mt_init_slots(input_dev, MAXIMUM_SUPPORTED_POINTS, INPUT_MT_DIRECT); + -+ rats_no_pll = devm_kzalloc(rtd->dev, sizeof(*rats_no_pll), GFP_KERNEL); -+ if (!rats_no_pll) ++ input_set_drvdata(input_dev, ts); ++ ++ ret = input_register_device(input_dev); ++ if (ret) { ++ dev_err(&pdev->dev, "could not register input device, %d\n", ++ ret); ++ return ret; ++ } ++ ++ // mmap the physical memory ++ touchbuf &= ~0xc0000000; ++ ts->ts_base = ioremap(touchbuf, sizeof(*ts->regs)); ++ if(ts->ts_base == NULL) ++ { ++ dev_err(&pdev->dev, "Failed to map physical address\n"); ++ input_unregister_device(input_dev); ++ kzfree(ts); + return -ENOMEM; ++ } ++ ++ ts->regs = (struct ft5406_regs *) ts->ts_base; + -+ rats_no_pll->num = clk_get_rate(pcm512x->sclk) / 64; -+ rats_no_pll->den_min = 1; -+ rats_no_pll->den_max = 128; -+ rats_no_pll->den_step = 1; -+ -+ err = snd_interval_ratnum(hw_param_interval(params, -+ SNDRV_PCM_HW_PARAM_RATE), 1, rats_no_pll, &num, &den); -+ if (err >= 0 && den) { -+ params->rate_num = num; -+ params->rate_den = den; ++ // create thread to poll the touch events ++ ts->thread = kthread_run(ft5406_thread, ts, "ft5406"); ++ if(ts->thread == NULL) ++ { ++ dev_err(&pdev->dev, "Failed to create kernel thread"); ++ iounmap(ts->ts_base); ++ input_unregister_device(input_dev); ++ kzfree(ts); + } + -+ devm_kfree(rtd->dev, rats_no_pll); - return 0; - } - --static int snd_rpi_hifiberry_dacplus_hw_params(struct snd_pcm_substream *substream, -- struct snd_pcm_hw_params *params) -+static int snd_rpi_hifiberry_dacplus_set_bclk_ratio_pro( -+ struct snd_soc_dai *cpu_dai, struct snd_pcm_hw_params *params) - { -+ int bratio = snd_pcm_format_physical_width(params_format(params)) -+ * params_channels(params); -+ return snd_soc_dai_set_bclk_ratio(cpu_dai, bratio); ++ return 0; +} + -+static int snd_rpi_hifiberry_dacplus_hw_params( -+ struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params) -+{ -+ int ret; - struct snd_soc_pcm_runtime *rtd = substream->private_data; - struct snd_soc_dai *cpu_dai = rtd->cpu_dai; -- return snd_soc_dai_set_bclk_ratio(cpu_dai, 64); -+ -+ if (snd_rpi_hifiberry_is_dacpro) { -+ struct snd_soc_codec *codec = rtd->codec; -+ -+ snd_rpi_hifiberry_dacplus_set_sclk(codec, -+ params_rate(params)); -+ -+ ret = snd_rpi_hifiberry_dacplus_set_bclk_ratio_pro(cpu_dai, -+ params); -+ if (!ret) -+ ret = snd_rpi_hifiberry_dacplus_update_rate_den( -+ substream, params); -+ } else { -+ ret = snd_soc_dai_set_bclk_ratio(cpu_dai, 64); -+ } -+ return ret; - } - --static int snd_rpi_hifiberry_dacplus_startup(struct snd_pcm_substream *substream) { -+static int snd_rpi_hifiberry_dacplus_startup( -+ struct snd_pcm_substream *substream) ++static int ft5406_remove(struct platform_device *pdev) +{ - struct snd_soc_pcm_runtime *rtd = substream->private_data; - struct snd_soc_codec *codec = rtd->codec; -- snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x08,0x08); ++ struct ft5406 *ts = (struct ft5406 *) platform_get_drvdata(pdev); ++ ++ dev_info(&pdev->dev, "Removing rpi-ft5406\n"); ++ ++ kthread_stop(ts->thread); ++ iounmap(ts->ts_base); ++ input_unregister_device(ts->input_dev); ++ kzfree(ts); ++ ++ return 0; ++} + -+ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x08, 0x08); - return 0; - } - --static void snd_rpi_hifiberry_dacplus_shutdown(struct snd_pcm_substream *substream) { -+static void snd_rpi_hifiberry_dacplus_shutdown( -+ struct snd_pcm_substream *substream) -+{ - struct snd_soc_pcm_runtime *rtd = substream->private_data; - struct snd_soc_codec *codec = rtd->codec; -- snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x08,0x00); ++static const struct of_device_id ft5406_match[] = { ++ { .compatible = "rpi,rpi-ft5406", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, ft5406_match); + -+ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x08, 0x00); - } - - /* machine stream operations */ -@@ -90,19 +285,20 @@ static int snd_rpi_hifiberry_dacplus_probe(struct platform_device *pdev) - int ret = 0; - - snd_rpi_hifiberry_dacplus.dev = &pdev->dev; -- - if (pdev->dev.of_node) { -- struct device_node *i2s_node; -- struct snd_soc_dai_link *dai = &snd_rpi_hifiberry_dacplus_dai[0]; -- i2s_node = of_parse_phandle(pdev->dev.of_node, -- "i2s-controller", 0); -- -- if (i2s_node) { -- dai->cpu_dai_name = NULL; -- dai->cpu_of_node = i2s_node; -- dai->platform_name = NULL; -- dai->platform_of_node = i2s_node; -- } -+ struct device_node *i2s_node; -+ struct snd_soc_dai_link *dai; ++static struct platform_driver ft5406_driver = { ++ .driver = { ++ .name = "rpi-ft5406", ++ .owner = THIS_MODULE, ++ .of_match_table = ft5406_match, ++ }, ++ .probe = ft5406_probe, ++ .remove = ft5406_remove, ++}; + -+ dai = &snd_rpi_hifiberry_dacplus_dai[0]; -+ i2s_node = of_parse_phandle(pdev->dev.of_node, -+ "i2s-controller", 0); ++module_platform_driver(ft5406_driver); + -+ if (i2s_node) { -+ dai->cpu_dai_name = NULL; -+ dai->cpu_of_node = i2s_node; -+ dai->platform_name = NULL; -+ dai->platform_of_node = i2s_node; -+ } - } - - ret = snd_soc_register_card(&snd_rpi_hifiberry_dacplus); -diff --git a/sound/soc/codecs/pcm512x.c b/sound/soc/codecs/pcm512x.c -index 047c489..090fe0ee 100644 ---- a/sound/soc/codecs/pcm512x.c -+++ b/sound/soc/codecs/pcm512x.c -@@ -854,7 +854,8 @@ static int pcm512x_set_dividers(struct snd_soc_dai *dai, - int fssp; - int gpio; - -- lrclk_div = snd_soc_params_to_frame_size(params); -+ lrclk_div = snd_pcm_format_physical_width(params_format(params)) -+ * params_channels(params); - if (lrclk_div == 0) { - dev_err(dev, "No LRCLK?\n"); - return -EINVAL; ++MODULE_AUTHOR("Gordon Hollingworth"); ++MODULE_DESCRIPTION("Touchscreen driver for memory based FT5406"); ++MODULE_LICENSE("GPL"); -From 14b6c7013e62b3917ce73841dc8e379d011d37a5 Mon Sep 17 00:00:00 2001 +From d3b07af9751b03a6d60b5bcd95df067add313b78 Mon Sep 17 00:00:00 2001 From: Phil Elwell <phil@raspberrypi.org> -Date: Mon, 5 Oct 2015 10:47:45 +0100 -Subject: [PATCH 111/170] BCM270X_DT: Add at86rf233 overlay +Date: Mon, 13 Oct 2014 11:47:53 +0100 +Subject: [PATCH 079/112] Improve __copy_to_user and __copy_from_user + performance + +Provide a __copy_from_user that uses memcpy. On BCM2708, use +optimised memcpy/memmove/memcmp/memset implementations. + +arch/arm: Add mmiocpy/set aliases for memcpy/set + +See: https://github.com/raspberrypi/linux/issues/1082 + +copy_from_user: CPU_SW_DOMAIN_PAN compatibility -Add an overlay to support the Atmel AT86RF233 WPAN transceiver on spi0.0. +The downstream copy_from_user acceleration must also play nice with +CONFIG_CPU_SW_DOMAIN_PAN. -See: https://github.com/raspberrypi/linux/issues/1151 +See: https://github.com/raspberrypi/linux/issues/1381 + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> --- - arch/arm/boot/dts/overlays/Makefile | 1 + - arch/arm/boot/dts/overlays/README | 21 +++++++-- - arch/arm/boot/dts/overlays/at86rf233-overlay.dts | 54 ++++++++++++++++++++++++ - 3 files changed, 72 insertions(+), 4 deletions(-) - create mode 100644 arch/arm/boot/dts/overlays/at86rf233-overlay.dts + arch/arm/include/asm/string.h | 5 + + arch/arm/include/asm/uaccess.h | 3 + + arch/arm/lib/Makefile | 15 +- + arch/arm/lib/arm-mem.h | 159 ++++++++++++ + arch/arm/lib/copy_from_user.S | 4 +- + arch/arm/lib/exports_rpi.c | 37 +++ + arch/arm/lib/memcmp_rpi.S | 285 +++++++++++++++++++++ + arch/arm/lib/memcpy_rpi.S | 61 +++++ + arch/arm/lib/memcpymove.h | 506 +++++++++++++++++++++++++++++++++++++ + arch/arm/lib/memmove_rpi.S | 61 +++++ + arch/arm/lib/memset_rpi.S | 123 +++++++++ + arch/arm/lib/uaccess_with_memcpy.c | 120 ++++++++- + 12 files changed, 1373 insertions(+), 6 deletions(-) + create mode 100644 arch/arm/lib/arm-mem.h + create mode 100644 arch/arm/lib/exports_rpi.c + create mode 100644 arch/arm/lib/memcmp_rpi.S + create mode 100644 arch/arm/lib/memcpy_rpi.S + create mode 100644 arch/arm/lib/memcpymove.h + create mode 100644 arch/arm/lib/memmove_rpi.S + create mode 100644 arch/arm/lib/memset_rpi.S -diff --git a/arch/arm/boot/dts/overlays/Makefile b/arch/arm/boot/dts/overlays/Makefile -index 7d747bc..be9dead 100644 ---- a/arch/arm/boot/dts/overlays/Makefile -+++ b/arch/arm/boot/dts/overlays/Makefile -@@ -13,6 +13,7 @@ ifeq ($(CONFIG_ARCH_BCM2835),y) - endif +diff --git a/arch/arm/include/asm/string.h b/arch/arm/include/asm/string.h +index cf4f3aa..9fe7780 100644 +--- a/arch/arm/include/asm/string.h ++++ b/arch/arm/include/asm/string.h +@@ -24,6 +24,11 @@ extern void * memchr(const void *, int, __kernel_size_t); + #define __HAVE_ARCH_MEMSET + extern void * memset(void *, int, __kernel_size_t); - dtb-$(RPI_DT_OVERLAYS) += ads7846-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += at86rf233-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += bmp085_i2c-sensor-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += dht11-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += enc28j60-overlay.dtb -diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README -index 950b6c5..04e55ce 100644 ---- a/arch/arm/boot/dts/overlays/README -+++ b/arch/arm/boot/dts/overlays/README -@@ -69,13 +69,14 @@ DT parameters: ++#ifdef CONFIG_MACH_BCM2708 ++#define __HAVE_ARCH_MEMCMP ++extern int memcmp(const void *, const void *, size_t); ++#endif ++ + extern void __memzero(void *ptr, __kernel_size_t n); - Parameters always have default values, although in some cases (e.g. "w1-gpio") - it is necessary to provided multiple overlays in order to get the desired --behaviour. See the list of overlays below for a description of the parameters and their defaults. -+behaviour. See the list of overlays below for a description of the parameters -+and their defaults. + #define memset(p,v,n) \ +diff --git a/arch/arm/include/asm/uaccess.h b/arch/arm/include/asm/uaccess.h +index 35c9db8..52d3401 100644 +--- a/arch/arm/include/asm/uaccess.h ++++ b/arch/arm/include/asm/uaccess.h +@@ -493,6 +493,9 @@ do { \ + extern unsigned long __must_check + arm_copy_from_user(void *to, const void __user *from, unsigned long n); - The Overlay and Parameter Reference - =================================== ++extern unsigned long __must_check ++__copy_from_user_std(void *to, const void __user *from, unsigned long n); ++ + static inline unsigned long __must_check + __copy_from_user(void *to, const void __user *from, unsigned long n) + { +diff --git a/arch/arm/lib/Makefile b/arch/arm/lib/Makefile +index d8a7807..9c7dc5b 100644 +--- a/arch/arm/lib/Makefile ++++ b/arch/arm/lib/Makefile +@@ -6,9 +6,8 @@ --N.B. When editing this file, please preserve the indentation levels to make it simple to parse --programmatically. NO HARD TABS. -+N.B. When editing this file, please preserve the indentation levels to make it -+simple to parse programmatically. NO HARD TABS. + lib-y := backtrace.o changebit.o csumipv6.o csumpartial.o \ + csumpartialcopy.o csumpartialcopyuser.o clearbit.o \ +- delay.o delay-loop.o findbit.o memchr.o memcpy.o \ +- memmove.o memset.o memzero.o setbit.o \ +- strchr.o strrchr.o \ ++ delay.o delay-loop.o findbit.o memchr.o memzero.o \ ++ setbit.o strchr.o strrchr.o \ + testchangebit.o testclearbit.o testsetbit.o \ + ashldi3.o ashrdi3.o lshrdi3.o muldi3.o \ + ucmpdi2.o lib1funcs.o div64.o \ +@@ -18,6 +17,16 @@ lib-y := backtrace.o changebit.o csumipv6.o csumpartial.o \ + mmu-y := clear_user.o copy_page.o getuser.o putuser.o \ + copy_from_user.o copy_to_user.o + ++# Choose optimised implementations for Raspberry Pi ++ifeq ($(CONFIG_MACH_BCM2708),y) ++ CFLAGS_uaccess_with_memcpy.o += -DCOPY_FROM_USER_THRESHOLD=1600 ++ CFLAGS_uaccess_with_memcpy.o += -DCOPY_TO_USER_THRESHOLD=672 ++ obj-$(CONFIG_MODULES) += exports_rpi.o ++ lib-y += memcpy_rpi.o memmove_rpi.o memset_rpi.o memcmp_rpi.o ++else ++ lib-y += memcpy.o memmove.o memset.o ++endif ++ + # using lib_ here won't override already available weak symbols + obj-$(CONFIG_UACCESS_WITH_MEMCPY) += uaccess_with_memcpy.o + +diff --git a/arch/arm/lib/arm-mem.h b/arch/arm/lib/arm-mem.h +new file mode 100644 +index 0000000..5d4bda1 +--- /dev/null ++++ b/arch/arm/lib/arm-mem.h +@@ -0,0 +1,159 @@ ++/* ++Copyright (c) 2013, Raspberry Pi Foundation ++Copyright (c) 2013, RISC OS Open Ltd ++All rights reserved. ++ ++Redistribution and use in source and binary forms, with or without ++modification, are permitted provided that the following conditions are met: ++ * Redistributions of source code must retain the above copyright ++ notice, this list of conditions and the following disclaimer. ++ * 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. ++ * Neither the name of the copyright holder nor the ++ names of its contributors may be used to endorse or promote products ++ derived from this software without specific prior written permission. ++ ++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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. ++*/ ++ ++.macro myfunc fname ++ .func fname ++ .global fname ++fname: ++.endm ++ ++.macro preload_leading_step1 backwards, ptr, base ++/* If the destination is already 16-byte aligned, then we need to preload ++ * between 0 and prefetch_distance (inclusive) cache lines ahead so there ++ * are no gaps when the inner loop starts. ++ */ ++ .if backwards ++ sub ptr, base, #1 ++ bic ptr, ptr, #31 ++ .else ++ bic ptr, base, #31 ++ .endif ++ .set OFFSET, 0 ++ .rept prefetch_distance+1 ++ pld [ptr, #OFFSET] ++ .if backwards ++ .set OFFSET, OFFSET-32 ++ .else ++ .set OFFSET, OFFSET+32 ++ .endif ++ .endr ++.endm ++ ++.macro preload_leading_step2 backwards, ptr, base, leading_bytes, tmp ++/* However, if the destination is not 16-byte aligned, we may need to ++ * preload one more cache line than that. The question we need to ask is: ++ * are the leading bytes more than the amount by which the source ++ * pointer will be rounded down for preloading, and if so, by how many ++ * cache lines? ++ */ ++ .if backwards ++/* Here we compare against how many bytes we are into the ++ * cache line, counting down from the highest such address. ++ * Effectively, we want to calculate ++ * leading_bytes = dst&15 ++ * cacheline_offset = 31-((src-leading_bytes-1)&31) ++ * extra_needed = leading_bytes - cacheline_offset ++ * and test if extra_needed is <= 0, or rearranging: ++ * leading_bytes + (src-leading_bytes-1)&31 <= 31 ++ */ ++ mov tmp, base, lsl #32-5 ++ sbc tmp, tmp, leading_bytes, lsl #32-5 ++ adds tmp, tmp, leading_bytes, lsl #32-5 ++ bcc 61f ++ pld [ptr, #-32*(prefetch_distance+1)] ++ .else ++/* Effectively, we want to calculate ++ * leading_bytes = (-dst)&15 ++ * cacheline_offset = (src+leading_bytes)&31 ++ * extra_needed = leading_bytes - cacheline_offset ++ * and test if extra_needed is <= 0. ++ */ ++ mov tmp, base, lsl #32-5 ++ add tmp, tmp, leading_bytes, lsl #32-5 ++ rsbs tmp, tmp, leading_bytes, lsl #32-5 ++ bls 61f ++ pld [ptr, #32*(prefetch_distance+1)] ++ .endif ++61: ++.endm ++ ++.macro preload_trailing backwards, base, remain, tmp ++ /* We need either 0, 1 or 2 extra preloads */ ++ .if backwards ++ rsb tmp, base, #0 ++ mov tmp, tmp, lsl #32-5 ++ .else ++ mov tmp, base, lsl #32-5 ++ .endif ++ adds tmp, tmp, remain, lsl #32-5 ++ adceqs tmp, tmp, #0 ++ /* The instruction above has two effects: ensures Z is only ++ * set if C was clear (so Z indicates that both shifted quantities ++ * were 0), and clears C if Z was set (so C indicates that the sum ++ * of the shifted quantities was greater and not equal to 32) */ ++ beq 82f ++ .if backwards ++ sub tmp, base, #1 ++ bic tmp, tmp, #31 ++ .else ++ bic tmp, base, #31 ++ .endif ++ bcc 81f ++ .if backwards ++ pld [tmp, #-32*(prefetch_distance+1)] ++81: ++ pld [tmp, #-32*prefetch_distance] ++ .else ++ pld [tmp, #32*(prefetch_distance+2)] ++81: ++ pld [tmp, #32*(prefetch_distance+1)] ++ .endif ++82: ++.endm ++ ++.macro preload_all backwards, narrow_case, shift, base, remain, tmp0, tmp1 ++ .if backwards ++ sub tmp0, base, #1 ++ bic tmp0, tmp0, #31 ++ pld [tmp0] ++ sub tmp1, base, remain, lsl #shift ++ .else ++ bic tmp0, base, #31 ++ pld [tmp0] ++ add tmp1, base, remain, lsl #shift ++ sub tmp1, tmp1, #1 ++ .endif ++ bic tmp1, tmp1, #31 ++ cmp tmp1, tmp0 ++ beq 92f ++ .if narrow_case ++ /* In this case, all the data fits in either 1 or 2 cache lines */ ++ pld [tmp1] ++ .else ++91: ++ .if backwards ++ sub tmp0, tmp0, #32 ++ .else ++ add tmp0, tmp0, #32 ++ .endif ++ cmp tmp0, tmp1 ++ pld [tmp0] ++ bne 91b ++ .endif ++92: ++.endm +diff --git a/arch/arm/lib/copy_from_user.S b/arch/arm/lib/copy_from_user.S +index 1512beb..3da60dd 100644 +--- a/arch/arm/lib/copy_from_user.S ++++ b/arch/arm/lib/copy_from_user.S +@@ -89,11 +89,13 @@ + .text - Name: <The base DTB> -@@ -149,7 +150,7 @@ Name: ads7846 - Info: ADS7846 Touch controller - Load: dtoverlay=ads7846,<param>=<val> - Params: cs SPI bus Chip Select (default 1) -- speed SPI bus speed (default 2Mhz, max 3.25MHz) -+ speed SPI bus speed (default 2MHz, max 3.25MHz) - penirq GPIO used for PENIRQ. REQUIRED - penirq_pull Set GPIO pull (default 0=none, 2=pullup) - swapxy Swap x and y axis -@@ -170,6 +171,18 @@ Params: cs SPI bus Chip Select (default 1) - www.kernel.org/doc/Documentation/devicetree/bindings/input/ads7846.txt +-ENTRY(arm_copy_from_user) ++ENTRY(__copy_from_user_std) ++WEAK(arm_copy_from_user) + #include "copy_template.S" -+Name: at86rf233 -+Info: Configures the Atmel AT86RF233 802.15.4 low-power WPAN transceiver, -+ connected to spi0.0 -+Load: dtoverlay=at86rf233,<param>=<val> -+Params: interrupt GPIO used for INT (default 23) -+ reset GPIO used for Reset (default 24) -+ sleep GPIO used for Sleep (default 25) -+ speed SPI bus speed in Hz (default 6000000) -+ trim Fine tuning of the internal capacitance -+ arrays (0=+0pF, 15=+4.5pF, default 15) + ENDPROC(arm_copy_from_user) ++ENDPROC(__copy_from_user_std) + + .pushsection .fixup,"ax" + .align 0 +diff --git a/arch/arm/lib/exports_rpi.c b/arch/arm/lib/exports_rpi.c +new file mode 100644 +index 0000000..1f82604 +--- /dev/null ++++ b/arch/arm/lib/exports_rpi.c +@@ -0,0 +1,37 @@ ++/** ++ * Copyright (c) 2014, Raspberry Pi (Trading) Ltd. ++ * ++ * 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, ++ * without modification. ++ * 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. ++ * 3. The names of the above-listed copyright holders may not be used ++ * to endorse or promote products derived from this software without ++ * specific prior written permission. ++ * ++ * ALTERNATIVELY, this software may be distributed under the terms of the ++ * GNU General Public License ("GPL") version 2, as published by the Free ++ * Software Foundation. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER OR ++ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ++ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, ++ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR ++ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF ++ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING ++ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ */ + ++#include <linux/kernel.h> ++#include <linux/module.h> + - Name: bmp085_i2c-sensor - Info: Configures the BMP085/BMP180 digital barometric pressure and temperature - sensors from Bosch Sensortec -diff --git a/arch/arm/boot/dts/overlays/at86rf233-overlay.dts b/arch/arm/boot/dts/overlays/at86rf233-overlay.dts ++EXPORT_SYMBOL(memcmp); +diff --git a/arch/arm/lib/memcmp_rpi.S b/arch/arm/lib/memcmp_rpi.S new file mode 100644 -index 0000000..0460269 +index 0000000..bf6e4ed --- /dev/null -+++ b/arch/arm/boot/dts/overlays/at86rf233-overlay.dts -@@ -0,0 +1,54 @@ -+/dts-v1/; -+/plugin/; ++++ b/arch/arm/lib/memcmp_rpi.S +@@ -0,0 +1,285 @@ ++/* ++Copyright (c) 2013, Raspberry Pi Foundation ++Copyright (c) 2013, RISC OS Open Ltd ++All rights reserved. + -+/* Overlay for Atmel AT86RF233 IEEE 802.15.4 WPAN transceiver on spi0.0 */ ++Redistribution and use in source and binary forms, with or without ++modification, are permitted provided that the following conditions are met: ++ * Redistributions of source code must retain the above copyright ++ notice, this list of conditions and the following disclaimer. ++ * 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. ++ * Neither the name of the copyright holder nor the ++ names of its contributors may be used to endorse or promote products ++ derived from this software without specific prior written permission. + -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2836", "brcm,bcm2708", "brcm,bcm2709"; ++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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. ++*/ + -+ fragment@0 { -+ target = <&spi0>; -+ __overlay__ { -+ #address-cells = <1>; -+ #size-cells = <0>; ++#include <linux/linkage.h> ++#include "arm-mem.h" + -+ status = "okay"; ++/* Prevent the stack from becoming executable */ ++#if defined(__linux__) && defined(__ELF__) ++.section .note.GNU-stack,"",%progbits ++#endif + -+ spidev@0{ -+ status = "disabled"; -+ }; ++ .text ++ .arch armv6 ++ .object_arch armv4 ++ .arm ++ .altmacro ++ .p2align 2 + -+ lowpan0: at86rf233@0 { -+ compatible = "atmel,at86rf233"; -+ reg = <0>; -+ interrupt-parent = <&gpio>; -+ interrupts = <23 4>; /* active high */ -+ reset-gpio = <&gpio 24 1>; -+ sleep-gpio = <&gpio 25 1>; -+ spi-max-frequency = <6000000>; -+ xtal-trim = /bits/ 8 <0xf>; -+ }; -+ }; -+ }; ++.macro memcmp_process_head unaligned ++ .if unaligned ++ ldr DAT0, [S_1], #4 ++ ldr DAT1, [S_1], #4 ++ ldr DAT2, [S_1], #4 ++ ldr DAT3, [S_1], #4 ++ .else ++ ldmia S_1!, {DAT0, DAT1, DAT2, DAT3} ++ .endif ++ ldmia S_2!, {DAT4, DAT5, DAT6, DAT7} ++.endm + -+ fragment@1 { -+ target = <&gpio>; -+ __overlay__ { -+ lowpan0_pins: lowpan0_pins { -+ brcm,pins = <23 24 25>; -+ brcm,function = <0 1 1>; /* in out out */ -+ }; -+ }; -+ }; ++.macro memcmp_process_tail ++ cmp DAT0, DAT4 ++ cmpeq DAT1, DAT5 ++ cmpeq DAT2, DAT6 ++ cmpeq DAT3, DAT7 ++ bne 200f ++.endm + -+ __overrides__ { -+ interrupt = <&lowpan0>, "interrupts:0", -+ <&lowpan0_pins>, "brcm,pins:0"; -+ reset = <&lowpan0>, "reset-gpio:4", -+ <&lowpan0_pins>, "brcm,pins:4"; -+ sleep = <&lowpan0>, "sleep-gpio:4", -+ <&lowpan0_pins>, "brcm,pins:8"; -+ speed = <&lowpan0>, "spi-max-frequency:0"; -+ trim = <&lowpan0>, "xtal-trim.0"; -+ }; -+}; - -From d33b3717e86cd6aa28c58d465a22e6c11a66bc13 Mon Sep 17 00:00:00 2001 -From: Eric Anholt <eric@anholt.net> -Date: Thu, 18 Dec 2014 16:07:15 -0800 -Subject: [PATCH 112/170] mm: Remove the PFN busy warning - -See commit dae803e165a11bc88ca8dbc07a11077caf97bbcb -- the warning is -expected sometimes when using CMA. However, that commit still spams -my kernel log with these warnings. - -Signed-off-by: Eric Anholt <eric@anholt.net> ---- - mm/page_alloc.c | 2 -- - 1 file changed, 2 deletions(-) - -diff --git a/mm/page_alloc.c b/mm/page_alloc.c -index 9d666df..b682acc 100644 ---- a/mm/page_alloc.c -+++ b/mm/page_alloc.c -@@ -6760,8 +6760,6 @@ int alloc_contig_range(unsigned long start, unsigned long end, - - /* Make sure the range is really isolated. */ - if (test_pages_isolated(outer_start, end, false)) { -- pr_info("%s: [%lx, %lx) PFNs busy\n", -- __func__, outer_start, end); - ret = -EBUSY; - goto done; - } - -From a71d6ebfcbc401e520fa4a5aa185d027dfbe5ce1 Mon Sep 17 00:00:00 2001 -From: Eric Anholt <eric@anholt.net> -Date: Wed, 19 Nov 2014 12:06:38 -0800 -Subject: [PATCH 113/170] drm: Put an optional field in the driver struct for - GEM obj struct size. - -This allows a driver to derive from the CMA object without copying all -of the code. - -Signed-off-by: Eric Anholt <eric@anholt.net> ---- - drivers/gpu/drm/drm_gem_cma_helper.c | 5 ++++- - include/drm/drmP.h | 1 + - 2 files changed, 5 insertions(+), 1 deletion(-) - -diff --git a/drivers/gpu/drm/drm_gem_cma_helper.c b/drivers/gpu/drm/drm_gem_cma_helper.c -index e109b49..1c25500 100644 ---- a/drivers/gpu/drm/drm_gem_cma_helper.c -+++ b/drivers/gpu/drm/drm_gem_cma_helper.c -@@ -58,8 +58,11 @@ __drm_gem_cma_create(struct drm_device *drm, size_t size) - struct drm_gem_cma_object *cma_obj; - struct drm_gem_object *gem_obj; - int ret; -+ size_t obj_size = (drm->driver->gem_obj_size ? -+ drm->driver->gem_obj_size : -+ sizeof(*cma_obj)); - -- cma_obj = kzalloc(sizeof(*cma_obj), GFP_KERNEL); -+ cma_obj = kzalloc(obj_size, GFP_KERNEL); - if (!cma_obj) - return ERR_PTR(-ENOMEM); - -diff --git a/include/drm/drmP.h b/include/drm/drmP.h -index 0a271ca..54f5469 100644 ---- a/include/drm/drmP.h -+++ b/include/drm/drmP.h -@@ -639,6 +639,7 @@ struct drm_driver { - - u32 driver_features; - int dev_priv_size; -+ size_t gem_obj_size; - const struct drm_ioctl_desc *ioctls; - int num_ioctls; - const struct file_operations *fops; - -From 1c343ed1f86866d2625518774536bbef77f7a20a Mon Sep 17 00:00:00 2001 -From: Eric Anholt <eric@anholt.net> -Date: Fri, 30 Oct 2015 10:09:02 -0700 -Subject: [PATCH 114/170] drm/vc4: Add an interface for capturing the GPU state - after a hang. - -This can be parsed with vc4-gpu-tools tools for trying to figure out -what was going on. - -Signed-off-by: Eric Anholt <eric@anholt.net> ---- - drivers/gpu/drm/vc4/vc4_bo.c | 4 +- - drivers/gpu/drm/vc4/vc4_drv.c | 1 + - drivers/gpu/drm/vc4/vc4_drv.h | 4 + - drivers/gpu/drm/vc4/vc4_gem.c | 185 ++++++++++++++++++++++++++++++++++++++++++ - include/uapi/drm/vc4_drm.h | 45 ++++++++++ - 5 files changed, 237 insertions(+), 2 deletions(-) - -diff --git a/drivers/gpu/drm/vc4/vc4_bo.c b/drivers/gpu/drm/vc4/vc4_bo.c -index acd360c..58dcbae 100644 ---- a/drivers/gpu/drm/vc4/vc4_bo.c -+++ b/drivers/gpu/drm/vc4/vc4_bo.c -@@ -415,8 +415,8 @@ int vc4_mmap(struct file *filp, struct vm_area_struct *vma) - gem_obj = vma->vm_private_data; - bo = to_vc4_bo(gem_obj); - -- if (bo->validated_shader) { -- DRM_ERROR("mmaping of shader BOs not allowed.\n"); -+ if (bo->validated_shader && (vma->vm_flags & VM_WRITE)) { -+ DRM_ERROR("mmaping of shader BOs for writing not allowed.\n"); - return -EINVAL; - } - -diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c -index e2a2be2..e8192b4 100644 ---- a/drivers/gpu/drm/vc4/vc4_drv.c -+++ b/drivers/gpu/drm/vc4/vc4_drv.c -@@ -81,6 +81,7 @@ static const struct drm_ioctl_desc vc4_drm_ioctls[] = { - DRM_IOCTL_DEF_DRV(VC4_CREATE_BO, vc4_create_bo_ioctl, 0), - DRM_IOCTL_DEF_DRV(VC4_MMAP_BO, vc4_mmap_bo_ioctl, 0), - DRM_IOCTL_DEF_DRV(VC4_CREATE_SHADER_BO, vc4_create_shader_bo_ioctl, 0), -+ DRM_IOCTL_DEF_DRV(VC4_GET_HANG_STATE, vc4_get_hang_state_ioctl, DRM_ROOT_ONLY), - }; - - static struct drm_driver vc4_drm_driver = { -diff --git a/drivers/gpu/drm/vc4/vc4_drv.h b/drivers/gpu/drm/vc4/vc4_drv.h -index c079b82..24845c1 100644 ---- a/drivers/gpu/drm/vc4/vc4_drv.h -+++ b/drivers/gpu/drm/vc4/vc4_drv.h -@@ -20,6 +20,8 @@ struct vc4_dev { - struct drm_fbdev_cma *fbdev; - struct rpi_firmware *firmware; - -+ struct vc4_hang_state *hang_state; -+ - /* The kernel-space BO cache. Tracks buffers that have been - * unreferenced by all other users (refcounts of 0!) but not - * yet freed, so we can do cheap allocations. -@@ -366,6 +368,8 @@ int vc4_create_shader_bo_ioctl(struct drm_device *dev, void *data, - struct drm_file *file_priv); - int vc4_mmap_bo_ioctl(struct drm_device *dev, void *data, - struct drm_file *file_priv); -+int vc4_get_hang_state_ioctl(struct drm_device *dev, void *data, -+ struct drm_file *file_priv); - int vc4_mmap(struct file *filp, struct vm_area_struct *vma); - int vc4_prime_mmap(struct drm_gem_object *obj, struct vm_area_struct *vma); - void *vc4_prime_vmap(struct drm_gem_object *obj); -diff --git a/drivers/gpu/drm/vc4/vc4_gem.c b/drivers/gpu/drm/vc4/vc4_gem.c -index 0cea723..d90c664 100644 ---- a/drivers/gpu/drm/vc4/vc4_gem.c -+++ b/drivers/gpu/drm/vc4/vc4_gem.c -@@ -40,6 +40,186 @@ vc4_queue_hangcheck(struct drm_device *dev) - round_jiffies_up(jiffies + msecs_to_jiffies(100))); - } - -+struct vc4_hang_state { -+ struct drm_vc4_get_hang_state user_state; ++.macro memcmp_leading_31bytes ++ movs DAT0, OFF, lsl #31 ++ ldrmib DAT0, [S_1], #1 ++ ldrcsh DAT1, [S_1], #2 ++ ldrmib DAT4, [S_2], #1 ++ ldrcsh DAT5, [S_2], #2 ++ movpl DAT0, #0 ++ movcc DAT1, #0 ++ movpl DAT4, #0 ++ movcc DAT5, #0 ++ submi N, N, #1 ++ subcs N, N, #2 ++ cmp DAT0, DAT4 ++ cmpeq DAT1, DAT5 ++ bne 200f ++ movs DAT0, OFF, lsl #29 ++ ldrmi DAT0, [S_1], #4 ++ ldrcs DAT1, [S_1], #4 ++ ldrcs DAT2, [S_1], #4 ++ ldrmi DAT4, [S_2], #4 ++ ldmcsia S_2!, {DAT5, DAT6} ++ movpl DAT0, #0 ++ movcc DAT1, #0 ++ movcc DAT2, #0 ++ movpl DAT4, #0 ++ movcc DAT5, #0 ++ movcc DAT6, #0 ++ submi N, N, #4 ++ subcs N, N, #8 ++ cmp DAT0, DAT4 ++ cmpeq DAT1, DAT5 ++ cmpeq DAT2, DAT6 ++ bne 200f ++ tst OFF, #16 ++ beq 105f ++ memcmp_process_head 1 ++ sub N, N, #16 ++ memcmp_process_tail ++105: ++.endm + -+ u32 bo_count; -+ struct drm_gem_object **bo; -+}; ++.macro memcmp_trailing_15bytes unaligned ++ movs N, N, lsl #29 ++ .if unaligned ++ ldrcs DAT0, [S_1], #4 ++ ldrcs DAT1, [S_1], #4 ++ .else ++ ldmcsia S_1!, {DAT0, DAT1} ++ .endif ++ ldrmi DAT2, [S_1], #4 ++ ldmcsia S_2!, {DAT4, DAT5} ++ ldrmi DAT6, [S_2], #4 ++ movcc DAT0, #0 ++ movcc DAT1, #0 ++ movpl DAT2, #0 ++ movcc DAT4, #0 ++ movcc DAT5, #0 ++ movpl DAT6, #0 ++ cmp DAT0, DAT4 ++ cmpeq DAT1, DAT5 ++ cmpeq DAT2, DAT6 ++ bne 200f ++ movs N, N, lsl #2 ++ ldrcsh DAT0, [S_1], #2 ++ ldrmib DAT1, [S_1] ++ ldrcsh DAT4, [S_2], #2 ++ ldrmib DAT5, [S_2] ++ movcc DAT0, #0 ++ movpl DAT1, #0 ++ movcc DAT4, #0 ++ movpl DAT5, #0 ++ cmp DAT0, DAT4 ++ cmpeq DAT1, DAT5 ++ bne 200f ++.endm ++ ++.macro memcmp_long_inner_loop unaligned ++110: ++ memcmp_process_head unaligned ++ pld [S_2, #prefetch_distance*32 + 16] ++ memcmp_process_tail ++ memcmp_process_head unaligned ++ pld [S_1, OFF] ++ memcmp_process_tail ++ subs N, N, #32 ++ bhs 110b ++ /* Just before the final (prefetch_distance+1) 32-byte blocks, ++ * deal with final preloads */ ++ preload_trailing 0, S_1, N, DAT0 ++ preload_trailing 0, S_2, N, DAT0 ++ add N, N, #(prefetch_distance+2)*32 - 16 ++120: ++ memcmp_process_head unaligned ++ memcmp_process_tail ++ subs N, N, #16 ++ bhs 120b ++ /* Trailing words and bytes */ ++ tst N, #15 ++ beq 199f ++ memcmp_trailing_15bytes unaligned ++199: /* Reached end without detecting a difference */ ++ mov a1, #0 ++ setend le ++ pop {DAT1-DAT6, pc} ++.endm + -+static void -+vc4_free_hang_state(struct drm_device *dev, struct vc4_hang_state *state) -+{ -+ unsigned int i; ++.macro memcmp_short_inner_loop unaligned ++ subs N, N, #16 /* simplifies inner loop termination */ ++ blo 122f ++120: ++ memcmp_process_head unaligned ++ memcmp_process_tail ++ subs N, N, #16 ++ bhs 120b ++122: /* Trailing words and bytes */ ++ tst N, #15 ++ beq 199f ++ memcmp_trailing_15bytes unaligned ++199: /* Reached end without detecting a difference */ ++ mov a1, #0 ++ setend le ++ pop {DAT1-DAT6, pc} ++.endm + -+ mutex_lock(&dev->struct_mutex); -+ for (i = 0; i < state->user_state.bo_count; i++) { -+ drm_gem_object_unreference(state->bo[i]); -+ } -+ mutex_unlock(&dev->struct_mutex); ++/* ++ * int memcmp(const void *s1, const void *s2, size_t n); ++ * On entry: ++ * a1 = pointer to buffer 1 ++ * a2 = pointer to buffer 2 ++ * a3 = number of bytes to compare (as unsigned chars) ++ * On exit: ++ * a1 = >0/=0/<0 if s1 >/=/< s2 ++ */ + -+ kfree(state); -+} ++.set prefetch_distance, 2 + -+int -+vc4_get_hang_state_ioctl(struct drm_device *dev, void *data, -+ struct drm_file *file_priv) -+{ -+ struct drm_vc4_get_hang_state *get_state = data; -+ struct drm_vc4_get_hang_state_bo *bo_state; -+ struct vc4_hang_state *kernel_state; -+ struct drm_vc4_get_hang_state *state; -+ struct vc4_dev *vc4 = to_vc4_dev(dev); -+ unsigned long irqflags; -+ u32 i; -+ int ret; ++ENTRY(memcmp) ++ S_1 .req a1 ++ S_2 .req a2 ++ N .req a3 ++ DAT0 .req a4 ++ DAT1 .req v1 ++ DAT2 .req v2 ++ DAT3 .req v3 ++ DAT4 .req v4 ++ DAT5 .req v5 ++ DAT6 .req v6 ++ DAT7 .req ip ++ OFF .req lr + -+ spin_lock_irqsave(&vc4->job_lock, irqflags); -+ kernel_state = vc4->hang_state; -+ if (!kernel_state) { -+ spin_unlock_irqrestore(&vc4->job_lock, irqflags); -+ return -ENOENT; -+ } -+ state = &kernel_state->user_state; ++ push {DAT1-DAT6, lr} ++ setend be /* lowest-addressed bytes are most significant */ + -+ /* If the user's array isn't big enough, just return the -+ * required array size. -+ */ -+ if (get_state->bo_count < state->bo_count) { -+ get_state->bo_count = state->bo_count; -+ spin_unlock_irqrestore(&vc4->job_lock, irqflags); -+ return 0; -+ } ++ /* To preload ahead as we go, we need at least (prefetch_distance+2) 32-byte blocks */ ++ cmp N, #(prefetch_distance+3)*32 - 1 ++ blo 170f + -+ vc4->hang_state = NULL; -+ spin_unlock_irqrestore(&vc4->job_lock, irqflags); ++ /* Long case */ ++ /* Adjust N so that the decrement instruction can also test for ++ * inner loop termination. We want it to stop when there are ++ * (prefetch_distance+1) complete blocks to go. */ ++ sub N, N, #(prefetch_distance+2)*32 ++ preload_leading_step1 0, DAT0, S_1 ++ preload_leading_step1 0, DAT1, S_2 ++ tst S_2, #31 ++ beq 154f ++ rsb OFF, S_2, #0 /* no need to AND with 15 here */ ++ preload_leading_step2 0, DAT0, S_1, OFF, DAT2 ++ preload_leading_step2 0, DAT1, S_2, OFF, DAT2 ++ memcmp_leading_31bytes ++154: /* Second source now cacheline (32-byte) aligned; we have at ++ * least one prefetch to go. */ ++ /* Prefetch offset is best selected such that it lies in the ++ * first 8 of each 32 bytes - but it's just as easy to aim for ++ * the first one */ ++ and OFF, S_1, #31 ++ rsb OFF, OFF, #32*prefetch_distance ++ tst S_1, #3 ++ bne 140f ++ memcmp_long_inner_loop 0 ++140: memcmp_long_inner_loop 1 + -+ /* Save the user's BO pointer, so we don't stomp it with the memcpy. */ -+ state->bo = get_state->bo; -+ memcpy(get_state, state, sizeof(*state)); ++170: /* Short case */ ++ teq N, #0 ++ beq 199f ++ preload_all 0, 0, 0, S_1, N, DAT0, DAT1 ++ preload_all 0, 0, 0, S_2, N, DAT0, DAT1 ++ tst S_2, #3 ++ beq 174f ++172: subs N, N, #1 ++ blo 199f ++ ldrb DAT0, [S_1], #1 ++ ldrb DAT4, [S_2], #1 ++ cmp DAT0, DAT4 ++ bne 200f ++ tst S_2, #3 ++ bne 172b ++174: /* Second source now 4-byte aligned; we have 0 or more bytes to go */ ++ tst S_1, #3 ++ bne 140f ++ memcmp_short_inner_loop 0 ++140: memcmp_short_inner_loop 1 + -+ bo_state = kcalloc(state->bo_count, sizeof(*bo_state), GFP_KERNEL); -+ if (!bo_state) { -+ ret = -ENOMEM; -+ goto err_free; -+ } ++200: /* Difference found: determine sign. */ ++ movhi a1, #1 ++ movlo a1, #-1 ++ setend le ++ pop {DAT1-DAT6, pc} + -+ for (i = 0; i < state->bo_count; i++) { -+ struct vc4_bo *vc4_bo = to_vc4_bo(kernel_state->bo[i]); -+ u32 handle; -+ ret = drm_gem_handle_create(file_priv, kernel_state->bo[i], -+ &handle); ++ .unreq S_1 ++ .unreq S_2 ++ .unreq N ++ .unreq DAT0 ++ .unreq DAT1 ++ .unreq DAT2 ++ .unreq DAT3 ++ .unreq DAT4 ++ .unreq DAT5 ++ .unreq DAT6 ++ .unreq DAT7 ++ .unreq OFF ++ENDPROC(memcmp) +diff --git a/arch/arm/lib/memcpy_rpi.S b/arch/arm/lib/memcpy_rpi.S +new file mode 100644 +index 0000000..30f8a90 +--- /dev/null ++++ b/arch/arm/lib/memcpy_rpi.S +@@ -0,0 +1,61 @@ ++/* ++Copyright (c) 2013, Raspberry Pi Foundation ++Copyright (c) 2013, RISC OS Open Ltd ++All rights reserved. + -+ if (ret) { -+ state->bo_count = i - 1; -+ goto err; -+ } -+ bo_state[i].handle = handle; -+ bo_state[i].paddr = vc4_bo->base.paddr; -+ bo_state[i].size = vc4_bo->base.base.size; -+ } ++Redistribution and use in source and binary forms, with or without ++modification, are permitted provided that the following conditions are met: ++ * Redistributions of source code must retain the above copyright ++ notice, this list of conditions and the following disclaimer. ++ * 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. ++ * Neither the name of the copyright holder nor the ++ names of its contributors may be used to endorse or promote products ++ derived from this software without specific prior written permission. + -+ ret = copy_to_user((void __user *)(uintptr_t)get_state->bo, -+ bo_state, -+ state->bo_count * sizeof(*bo_state)); -+ kfree(bo_state); ++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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. ++*/ + -+ err_free: ++#include <linux/linkage.h> ++#include "arm-mem.h" ++#include "memcpymove.h" + -+ vc4_free_hang_state(dev, kernel_state); ++/* Prevent the stack from becoming executable */ ++#if defined(__linux__) && defined(__ELF__) ++.section .note.GNU-stack,"",%progbits ++#endif + -+err: -+ return ret; -+} ++ .text ++ .arch armv6 ++ .object_arch armv4 ++ .arm ++ .altmacro ++ .p2align 2 + -+static void -+vc4_save_hang_state(struct drm_device *dev) -+{ -+ struct vc4_dev *vc4 = to_vc4_dev(dev); -+ struct drm_vc4_get_hang_state *state; -+ struct vc4_hang_state *kernel_state; -+ struct vc4_exec_info *exec; -+ struct vc4_bo *bo; -+ unsigned long irqflags; -+ unsigned int i, unref_list_count; -+ -+ kernel_state = kcalloc(1, sizeof(*state), GFP_KERNEL); -+ if (!kernel_state) -+ return; ++/* ++ * void *memcpy(void * restrict s1, const void * restrict s2, size_t n); ++ * On entry: ++ * a1 = pointer to destination ++ * a2 = pointer to source ++ * a3 = number of bytes to copy ++ * On exit: ++ * a1 preserved ++ */ + -+ state = &kernel_state->user_state; ++.set prefetch_distance, 3 + -+ spin_lock_irqsave(&vc4->job_lock, irqflags); -+ exec = vc4_first_job(vc4); -+ if (!exec) { -+ spin_unlock_irqrestore(&vc4->job_lock, irqflags); -+ return; -+ } ++ENTRY(mmiocpy) ++ENTRY(memcpy) ++ memcpy 0 ++ENDPROC(memcpy) ++ENDPROC(mmiocpy) +diff --git a/arch/arm/lib/memcpymove.h b/arch/arm/lib/memcpymove.h +new file mode 100644 +index 0000000..d8be584 +--- /dev/null ++++ b/arch/arm/lib/memcpymove.h +@@ -0,0 +1,506 @@ ++/* ++Copyright (c) 2013, Raspberry Pi Foundation ++Copyright (c) 2013, RISC OS Open Ltd ++All rights reserved. + -+ unref_list_count = 0; -+ list_for_each_entry(bo, &exec->unref_list, unref_head) -+ unref_list_count++; ++Redistribution and use in source and binary forms, with or without ++modification, are permitted provided that the following conditions are met: ++ * Redistributions of source code must retain the above copyright ++ notice, this list of conditions and the following disclaimer. ++ * 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. ++ * Neither the name of the copyright holder nor the ++ names of its contributors may be used to endorse or promote products ++ derived from this software without specific prior written permission. + -+ state->bo_count = exec->bo_count + unref_list_count; -+ kernel_state->bo = kcalloc(state->bo_count, sizeof(*kernel_state->bo), -+ GFP_ATOMIC); -+ if (!kernel_state->bo) { -+ spin_unlock_irqrestore(&vc4->job_lock, irqflags); -+ return; -+ } ++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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. ++*/ + -+ for (i = 0; i < exec->bo_count; i++) { -+ drm_gem_object_reference(&exec->bo[i].bo->base); -+ kernel_state->bo[i] = &exec->bo[i].bo->base; -+ } ++.macro unaligned_words backwards, align, use_pld, words, r0, r1, r2, r3, r4, r5, r6, r7, r8 ++ .if words == 1 ++ .if backwards ++ mov r1, r0, lsl #32-align*8 ++ ldr r0, [S, #-4]! ++ orr r1, r1, r0, lsr #align*8 ++ str r1, [D, #-4]! ++ .else ++ mov r0, r1, lsr #align*8 ++ ldr r1, [S, #4]! ++ orr r0, r0, r1, lsl #32-align*8 ++ str r0, [D], #4 ++ .endif ++ .elseif words == 2 ++ .if backwards ++ ldr r1, [S, #-4]! ++ mov r2, r0, lsl #32-align*8 ++ ldr r0, [S, #-4]! ++ orr r2, r2, r1, lsr #align*8 ++ mov r1, r1, lsl #32-align*8 ++ orr r1, r1, r0, lsr #align*8 ++ stmdb D!, {r1, r2} ++ .else ++ ldr r1, [S, #4]! ++ mov r0, r2, lsr #align*8 ++ ldr r2, [S, #4]! ++ orr r0, r0, r1, lsl #32-align*8 ++ mov r1, r1, lsr #align*8 ++ orr r1, r1, r2, lsl #32-align*8 ++ stmia D!, {r0, r1} ++ .endif ++ .elseif words == 4 ++ .if backwards ++ ldmdb S!, {r2, r3} ++ mov r4, r0, lsl #32-align*8 ++ ldmdb S!, {r0, r1} ++ orr r4, r4, r3, lsr #align*8 ++ mov r3, r3, lsl #32-align*8 ++ orr r3, r3, r2, lsr #align*8 ++ mov r2, r2, lsl #32-align*8 ++ orr r2, r2, r1, lsr #align*8 ++ mov r1, r1, lsl #32-align*8 ++ orr r1, r1, r0, lsr #align*8 ++ stmdb D!, {r1, r2, r3, r4} ++ .else ++ ldmib S!, {r1, r2} ++ mov r0, r4, lsr #align*8 ++ ldmib S!, {r3, r4} ++ orr r0, r0, r1, lsl #32-align*8 ++ mov r1, r1, lsr #align*8 ++ orr r1, r1, r2, lsl #32-align*8 ++ mov r2, r2, lsr #align*8 ++ orr r2, r2, r3, lsl #32-align*8 ++ mov r3, r3, lsr #align*8 ++ orr r3, r3, r4, lsl #32-align*8 ++ stmia D!, {r0, r1, r2, r3} ++ .endif ++ .elseif words == 8 ++ .if backwards ++ ldmdb S!, {r4, r5, r6, r7} ++ mov r8, r0, lsl #32-align*8 ++ ldmdb S!, {r0, r1, r2, r3} ++ .if use_pld ++ pld [S, OFF] ++ .endif ++ orr r8, r8, r7, lsr #align*8 ++ mov r7, r7, lsl #32-align*8 ++ orr r7, r7, r6, lsr #align*8 ++ mov r6, r6, lsl #32-align*8 ++ orr r6, r6, r5, lsr #align*8 ++ mov r5, r5, lsl #32-align*8 ++ orr r5, r5, r4, lsr #align*8 ++ mov r4, r4, lsl #32-align*8 ++ orr r4, r4, r3, lsr #align*8 ++ mov r3, r3, lsl #32-align*8 ++ orr r3, r3, r2, lsr #align*8 ++ mov r2, r2, lsl #32-align*8 ++ orr r2, r2, r1, lsr #align*8 ++ mov r1, r1, lsl #32-align*8 ++ orr r1, r1, r0, lsr #align*8 ++ stmdb D!, {r5, r6, r7, r8} ++ stmdb D!, {r1, r2, r3, r4} ++ .else ++ ldmib S!, {r1, r2, r3, r4} ++ mov r0, r8, lsr #align*8 ++ ldmib S!, {r5, r6, r7, r8} ++ .if use_pld ++ pld [S, OFF] ++ .endif ++ orr r0, r0, r1, lsl #32-align*8 ++ mov r1, r1, lsr #align*8 ++ orr r1, r1, r2, lsl #32-align*8 ++ mov r2, r2, lsr #align*8 ++ orr r2, r2, r3, lsl #32-align*8 ++ mov r3, r3, lsr #align*8 ++ orr r3, r3, r4, lsl #32-align*8 ++ mov r4, r4, lsr #align*8 ++ orr r4, r4, r5, lsl #32-align*8 ++ mov r5, r5, lsr #align*8 ++ orr r5, r5, r6, lsl #32-align*8 ++ mov r6, r6, lsr #align*8 ++ orr r6, r6, r7, lsl #32-align*8 ++ mov r7, r7, lsr #align*8 ++ orr r7, r7, r8, lsl #32-align*8 ++ stmia D!, {r0, r1, r2, r3} ++ stmia D!, {r4, r5, r6, r7} ++ .endif ++ .endif ++.endm + -+ list_for_each_entry(bo, &exec->unref_list, unref_head) { -+ drm_gem_object_reference(&bo->base.base); -+ kernel_state->bo[i] = &bo->base.base; -+ i++; -+ } ++.macro memcpy_leading_15bytes backwards, align ++ movs DAT1, DAT2, lsl #31 ++ sub N, N, DAT2 ++ .if backwards ++ ldrmib DAT0, [S, #-1]! ++ ldrcsh DAT1, [S, #-2]! ++ strmib DAT0, [D, #-1]! ++ strcsh DAT1, [D, #-2]! ++ .else ++ ldrmib DAT0, [S], #1 ++ ldrcsh DAT1, [S], #2 ++ strmib DAT0, [D], #1 ++ strcsh DAT1, [D], #2 ++ .endif ++ movs DAT1, DAT2, lsl #29 ++ .if backwards ++ ldrmi DAT0, [S, #-4]! ++ .if align == 0 ++ ldmcsdb S!, {DAT1, DAT2} ++ .else ++ ldrcs DAT2, [S, #-4]! ++ ldrcs DAT1, [S, #-4]! ++ .endif ++ strmi DAT0, [D, #-4]! ++ stmcsdb D!, {DAT1, DAT2} ++ .else ++ ldrmi DAT0, [S], #4 ++ .if align == 0 ++ ldmcsia S!, {DAT1, DAT2} ++ .else ++ ldrcs DAT1, [S], #4 ++ ldrcs DAT2, [S], #4 ++ .endif ++ strmi DAT0, [D], #4 ++ stmcsia D!, {DAT1, DAT2} ++ .endif ++.endm + -+ state->start_bin = exec->ct0ca; -+ state->start_render = exec->ct1ca; ++.macro memcpy_trailing_15bytes backwards, align ++ movs N, N, lsl #29 ++ .if backwards ++ .if align == 0 ++ ldmcsdb S!, {DAT0, DAT1} ++ .else ++ ldrcs DAT1, [S, #-4]! ++ ldrcs DAT0, [S, #-4]! ++ .endif ++ ldrmi DAT2, [S, #-4]! ++ stmcsdb D!, {DAT0, DAT1} ++ strmi DAT2, [D, #-4]! ++ .else ++ .if align == 0 ++ ldmcsia S!, {DAT0, DAT1} ++ .else ++ ldrcs DAT0, [S], #4 ++ ldrcs DAT1, [S], #4 ++ .endif ++ ldrmi DAT2, [S], #4 ++ stmcsia D!, {DAT0, DAT1} ++ strmi DAT2, [D], #4 ++ .endif ++ movs N, N, lsl #2 ++ .if backwards ++ ldrcsh DAT0, [S, #-2]! ++ ldrmib DAT1, [S, #-1] ++ strcsh DAT0, [D, #-2]! ++ strmib DAT1, [D, #-1] ++ .else ++ ldrcsh DAT0, [S], #2 ++ ldrmib DAT1, [S] ++ strcsh DAT0, [D], #2 ++ strmib DAT1, [D] ++ .endif ++.endm + -+ spin_unlock_irqrestore(&vc4->job_lock, irqflags); ++.macro memcpy_long_inner_loop backwards, align ++ .if align != 0 ++ .if backwards ++ ldr DAT0, [S, #-align]! ++ .else ++ ldr LAST, [S, #-align]! ++ .endif ++ .endif ++110: ++ .if align == 0 ++ .if backwards ++ ldmdb S!, {DAT0, DAT1, DAT2, DAT3, DAT4, DAT5, DAT6, LAST} ++ pld [S, OFF] ++ stmdb D!, {DAT4, DAT5, DAT6, LAST} ++ stmdb D!, {DAT0, DAT1, DAT2, DAT3} ++ .else ++ ldmia S!, {DAT0, DAT1, DAT2, DAT3, DAT4, DAT5, DAT6, LAST} ++ pld [S, OFF] ++ stmia D!, {DAT0, DAT1, DAT2, DAT3} ++ stmia D!, {DAT4, DAT5, DAT6, LAST} ++ .endif ++ .else ++ unaligned_words backwards, align, 1, 8, DAT0, DAT1, DAT2, DAT3, DAT4, DAT5, DAT6, DAT7, LAST ++ .endif ++ subs N, N, #32 ++ bhs 110b ++ /* Just before the final (prefetch_distance+1) 32-byte blocks, deal with final preloads */ ++ preload_trailing backwards, S, N, OFF ++ add N, N, #(prefetch_distance+2)*32 - 32 ++120: ++ .if align == 0 ++ .if backwards ++ ldmdb S!, {DAT0, DAT1, DAT2, DAT3, DAT4, DAT5, DAT6, LAST} ++ stmdb D!, {DAT4, DAT5, DAT6, LAST} ++ stmdb D!, {DAT0, DAT1, DAT2, DAT3} ++ .else ++ ldmia S!, {DAT0, DAT1, DAT2, DAT3, DAT4, DAT5, DAT6, LAST} ++ stmia D!, {DAT0, DAT1, DAT2, DAT3} ++ stmia D!, {DAT4, DAT5, DAT6, LAST} ++ .endif ++ .else ++ unaligned_words backwards, align, 0, 8, DAT0, DAT1, DAT2, DAT3, DAT4, DAT5, DAT6, DAT7, LAST ++ .endif ++ subs N, N, #32 ++ bhs 120b ++ tst N, #16 ++ .if align == 0 ++ .if backwards ++ ldmnedb S!, {DAT0, DAT1, DAT2, LAST} ++ stmnedb D!, {DAT0, DAT1, DAT2, LAST} ++ .else ++ ldmneia S!, {DAT0, DAT1, DAT2, LAST} ++ stmneia D!, {DAT0, DAT1, DAT2, LAST} ++ .endif ++ .else ++ beq 130f ++ unaligned_words backwards, align, 0, 4, DAT0, DAT1, DAT2, DAT3, LAST ++130: ++ .endif ++ /* Trailing words and bytes */ ++ tst N, #15 ++ beq 199f ++ .if align != 0 ++ add S, S, #align ++ .endif ++ memcpy_trailing_15bytes backwards, align ++199: ++ pop {DAT3, DAT4, DAT5, DAT6, DAT7} ++ pop {D, DAT1, DAT2, pc} ++.endm + -+ state->ct0ca = V3D_READ(V3D_CTNCA(0)); -+ state->ct0ea = V3D_READ(V3D_CTNEA(0)); ++.macro memcpy_medium_inner_loop backwards, align ++120: ++ .if backwards ++ .if align == 0 ++ ldmdb S!, {DAT0, DAT1, DAT2, LAST} ++ .else ++ ldr LAST, [S, #-4]! ++ ldr DAT2, [S, #-4]! ++ ldr DAT1, [S, #-4]! ++ ldr DAT0, [S, #-4]! ++ .endif ++ stmdb D!, {DAT0, DAT1, DAT2, LAST} ++ .else ++ .if align == 0 ++ ldmia S!, {DAT0, DAT1, DAT2, LAST} ++ .else ++ ldr DAT0, [S], #4 ++ ldr DAT1, [S], #4 ++ ldr DAT2, [S], #4 ++ ldr LAST, [S], #4 ++ .endif ++ stmia D!, {DAT0, DAT1, DAT2, LAST} ++ .endif ++ subs N, N, #16 ++ bhs 120b ++ /* Trailing words and bytes */ ++ tst N, #15 ++ beq 199f ++ memcpy_trailing_15bytes backwards, align ++199: ++ pop {D, DAT1, DAT2, pc} ++.endm + -+ state->ct1ca = V3D_READ(V3D_CTNCA(1)); -+ state->ct1ea = V3D_READ(V3D_CTNEA(1)); ++.macro memcpy_short_inner_loop backwards, align ++ tst N, #16 ++ .if backwards ++ .if align == 0 ++ ldmnedb S!, {DAT0, DAT1, DAT2, LAST} ++ .else ++ ldrne LAST, [S, #-4]! ++ ldrne DAT2, [S, #-4]! ++ ldrne DAT1, [S, #-4]! ++ ldrne DAT0, [S, #-4]! ++ .endif ++ stmnedb D!, {DAT0, DAT1, DAT2, LAST} ++ .else ++ .if align == 0 ++ ldmneia S!, {DAT0, DAT1, DAT2, LAST} ++ .else ++ ldrne DAT0, [S], #4 ++ ldrne DAT1, [S], #4 ++ ldrne DAT2, [S], #4 ++ ldrne LAST, [S], #4 ++ .endif ++ stmneia D!, {DAT0, DAT1, DAT2, LAST} ++ .endif ++ memcpy_trailing_15bytes backwards, align ++199: ++ pop {D, DAT1, DAT2, pc} ++.endm + -+ state->ct0cs = V3D_READ(V3D_CTNCS(0)); -+ state->ct1cs = V3D_READ(V3D_CTNCS(1)); ++.macro memcpy backwards ++ D .req a1 ++ S .req a2 ++ N .req a3 ++ DAT0 .req a4 ++ DAT1 .req v1 ++ DAT2 .req v2 ++ DAT3 .req v3 ++ DAT4 .req v4 ++ DAT5 .req v5 ++ DAT6 .req v6 ++ DAT7 .req sl ++ LAST .req ip ++ OFF .req lr + -+ state->ct0ra0 = V3D_READ(V3D_CT00RA0); -+ state->ct1ra0 = V3D_READ(V3D_CT01RA0); ++ .cfi_startproc + -+ state->bpca = V3D_READ(V3D_BPCA); -+ state->bpcs = V3D_READ(V3D_BPCS); -+ state->bpoa = V3D_READ(V3D_BPOA); -+ state->bpos = V3D_READ(V3D_BPOS); ++ push {D, DAT1, DAT2, lr} + -+ state->vpmbase = V3D_READ(V3D_VPMBASE); ++ .cfi_def_cfa_offset 16 ++ .cfi_rel_offset D, 0 ++ .cfi_undefined S ++ .cfi_undefined N ++ .cfi_undefined DAT0 ++ .cfi_rel_offset DAT1, 4 ++ .cfi_rel_offset DAT2, 8 ++ .cfi_undefined LAST ++ .cfi_rel_offset lr, 12 + -+ state->dbge = V3D_READ(V3D_DBGE); -+ state->fdbgo = V3D_READ(V3D_FDBGO); -+ state->fdbgb = V3D_READ(V3D_FDBGB); -+ state->fdbgr = V3D_READ(V3D_FDBGR); -+ state->fdbgs = V3D_READ(V3D_FDBGS); -+ state->errstat = V3D_READ(V3D_ERRSTAT); ++ .if backwards ++ add D, D, N ++ add S, S, N ++ .endif + -+ spin_lock_irqsave(&vc4->job_lock, irqflags); -+ if (vc4->hang_state) { -+ spin_unlock_irqrestore(&vc4->job_lock, irqflags); -+ vc4_free_hang_state(dev, kernel_state); -+ } else { -+ vc4->hang_state = kernel_state; -+ spin_unlock_irqrestore(&vc4->job_lock, irqflags); -+ } -+} ++ /* See if we're guaranteed to have at least one 16-byte aligned 16-byte write */ ++ cmp N, #31 ++ blo 170f ++ /* To preload ahead as we go, we need at least (prefetch_distance+2) 32-byte blocks */ ++ cmp N, #(prefetch_distance+3)*32 - 1 ++ blo 160f + - static void - vc4_reset(struct drm_device *dev) - { -@@ -64,6 +244,8 @@ vc4_reset_work(struct work_struct *work) - struct vc4_dev *vc4 = - container_of(work, struct vc4_dev, hangcheck.reset_work); - -+ vc4_save_hang_state(vc4->dev); ++ /* Long case */ ++ push {DAT3, DAT4, DAT5, DAT6, DAT7} + - vc4_reset(vc4->dev); - } - -@@ -673,4 +855,7 @@ vc4_gem_destroy(struct drm_device *dev) - } - - vc4_bo_cache_destroy(dev); ++ .cfi_def_cfa_offset 36 ++ .cfi_rel_offset D, 20 ++ .cfi_rel_offset DAT1, 24 ++ .cfi_rel_offset DAT2, 28 ++ .cfi_rel_offset DAT3, 0 ++ .cfi_rel_offset DAT4, 4 ++ .cfi_rel_offset DAT5, 8 ++ .cfi_rel_offset DAT6, 12 ++ .cfi_rel_offset DAT7, 16 ++ .cfi_rel_offset lr, 32 + -+ if (vc4->hang_state) -+ vc4_free_hang_state(dev, vc4->hang_state); - } -diff --git a/include/uapi/drm/vc4_drm.h b/include/uapi/drm/vc4_drm.h -index 499daae5..4a8d19f 100644 ---- a/include/uapi/drm/vc4_drm.h -+++ b/include/uapi/drm/vc4_drm.h -@@ -32,6 +32,7 @@ - #define DRM_VC4_CREATE_BO 0x03 - #define DRM_VC4_MMAP_BO 0x04 - #define DRM_VC4_CREATE_SHADER_BO 0x05 -+#define DRM_VC4_GET_HANG_STATE 0x06 - - #define DRM_IOCTL_VC4_SUBMIT_CL DRM_IOWR( DRM_COMMAND_BASE + DRM_VC4_SUBMIT_CL, struct drm_vc4_submit_cl) - #define DRM_IOCTL_VC4_WAIT_SEQNO DRM_IOWR( DRM_COMMAND_BASE + DRM_VC4_WAIT_SEQNO, struct drm_vc4_wait_seqno) -@@ -39,6 +40,7 @@ - #define DRM_IOCTL_VC4_CREATE_BO DRM_IOWR( DRM_COMMAND_BASE + DRM_VC4_CREATE_BO, struct drm_vc4_create_bo) - #define DRM_IOCTL_VC4_MMAP_BO DRM_IOWR( DRM_COMMAND_BASE + DRM_VC4_MMAP_BO, struct drm_vc4_mmap_bo) - #define DRM_IOCTL_VC4_CREATE_SHADER_BO DRM_IOWR( DRM_COMMAND_BASE + DRM_VC4_CREATE_SHADER_BO, struct drm_vc4_create_shader_bo) -+#define DRM_IOCTL_VC4_GET_HANG_STATE DRM_IOWR( DRM_COMMAND_BASE + DRM_VC4_GET_HANG_STATE, struct drm_vc4_get_hang_state) - - struct drm_vc4_submit_rcl_surface { - uint32_t hindex; /* Handle index, or ~0 if not present. */ -@@ -226,4 +228,47 @@ struct drm_vc4_mmap_bo { - uint64_t offset; - }; - -+struct drm_vc4_get_hang_state_bo { -+ uint32_t handle; -+ uint32_t paddr; -+ uint32_t size; -+ uint32_t pad; -+}; ++ /* Adjust N so that the decrement instruction can also test for ++ * inner loop termination. We want it to stop when there are ++ * (prefetch_distance+1) complete blocks to go. */ ++ sub N, N, #(prefetch_distance+2)*32 ++ preload_leading_step1 backwards, DAT0, S ++ .if backwards ++ /* Bug in GAS: it accepts, but mis-assembles the instruction ++ * ands DAT2, D, #60, 2 ++ * which sets DAT2 to the number of leading bytes until destination is aligned and also clears C (sets borrow) ++ */ ++ .word 0xE210513C ++ beq 154f ++ .else ++ ands DAT2, D, #15 ++ beq 154f ++ rsb DAT2, DAT2, #16 /* number of leading bytes until destination aligned */ ++ .endif ++ preload_leading_step2 backwards, DAT0, S, DAT2, OFF ++ memcpy_leading_15bytes backwards, 1 ++154: /* Destination now 16-byte aligned; we have at least one prefetch as well as at least one 16-byte output block */ ++ /* Prefetch offset is best selected such that it lies in the first 8 of each 32 bytes - but it's just as easy to aim for the first one */ ++ .if backwards ++ rsb OFF, S, #3 ++ and OFF, OFF, #28 ++ sub OFF, OFF, #32*(prefetch_distance+1) ++ .else ++ and OFF, S, #28 ++ rsb OFF, OFF, #32*prefetch_distance ++ .endif ++ movs DAT0, S, lsl #31 ++ bhi 157f ++ bcs 156f ++ bmi 155f ++ memcpy_long_inner_loop backwards, 0 ++155: memcpy_long_inner_loop backwards, 1 ++156: memcpy_long_inner_loop backwards, 2 ++157: memcpy_long_inner_loop backwards, 3 + -+/** -+ * struct drm_vc4_hang_state - ioctl argument for collecting state -+ * from a GPU hang for analysis. -+*/ -+struct drm_vc4_get_hang_state { -+ /** Pointer to array of struct drm_vc4_get_hang_state_bo. */ -+ uint64_t bo; -+ /** -+ * On input, the size of the bo array. Output is the number -+ * of bos to be returned. -+ */ -+ uint32_t bo_count; ++ .cfi_def_cfa_offset 16 ++ .cfi_rel_offset D, 0 ++ .cfi_rel_offset DAT1, 4 ++ .cfi_rel_offset DAT2, 8 ++ .cfi_same_value DAT3 ++ .cfi_same_value DAT4 ++ .cfi_same_value DAT5 ++ .cfi_same_value DAT6 ++ .cfi_same_value DAT7 ++ .cfi_rel_offset lr, 12 + -+ uint32_t start_bin, start_render; ++160: /* Medium case */ ++ preload_all backwards, 0, 0, S, N, DAT2, OFF ++ sub N, N, #16 /* simplifies inner loop termination */ ++ .if backwards ++ ands DAT2, D, #15 ++ beq 164f ++ .else ++ ands DAT2, D, #15 ++ beq 164f ++ rsb DAT2, DAT2, #16 ++ .endif ++ memcpy_leading_15bytes backwards, align ++164: /* Destination now 16-byte aligned; we have at least one 16-byte output block */ ++ tst S, #3 ++ bne 140f ++ memcpy_medium_inner_loop backwards, 0 ++140: memcpy_medium_inner_loop backwards, 1 + -+ uint32_t ct0ca, ct0ea; -+ uint32_t ct1ca, ct1ea; -+ uint32_t ct0cs, ct1cs; -+ uint32_t ct0ra0, ct1ra0; ++170: /* Short case, less than 31 bytes, so no guarantee of at least one 16-byte block */ ++ teq N, #0 ++ beq 199f ++ preload_all backwards, 1, 0, S, N, DAT2, LAST ++ tst D, #3 ++ beq 174f ++172: subs N, N, #1 ++ blo 199f ++ .if backwards ++ ldrb DAT0, [S, #-1]! ++ strb DAT0, [D, #-1]! ++ .else ++ ldrb DAT0, [S], #1 ++ strb DAT0, [D], #1 ++ .endif ++ tst D, #3 ++ bne 172b ++174: /* Destination now 4-byte aligned; we have 0 or more output bytes to go */ ++ tst S, #3 ++ bne 140f ++ memcpy_short_inner_loop backwards, 0 ++140: memcpy_short_inner_loop backwards, 1 + -+ uint32_t bpca, bpcs; -+ uint32_t bpoa, bpos; ++ .cfi_endproc + -+ uint32_t vpmbase; ++ .unreq D ++ .unreq S ++ .unreq N ++ .unreq DAT0 ++ .unreq DAT1 ++ .unreq DAT2 ++ .unreq DAT3 ++ .unreq DAT4 ++ .unreq DAT5 ++ .unreq DAT6 ++ .unreq DAT7 ++ .unreq LAST ++ .unreq OFF ++.endm +diff --git a/arch/arm/lib/memmove_rpi.S b/arch/arm/lib/memmove_rpi.S +new file mode 100644 +index 0000000..8b0760c +--- /dev/null ++++ b/arch/arm/lib/memmove_rpi.S +@@ -0,0 +1,61 @@ ++/* ++Copyright (c) 2013, Raspberry Pi Foundation ++Copyright (c) 2013, RISC OS Open Ltd ++All rights reserved. + -+ uint32_t dbge; -+ uint32_t fdbgo; -+ uint32_t fdbgb; -+ uint32_t fdbgr; -+ uint32_t fdbgs; -+ uint32_t errstat; ++Redistribution and use in source and binary forms, with or without ++modification, are permitted provided that the following conditions are met: ++ * Redistributions of source code must retain the above copyright ++ notice, this list of conditions and the following disclaimer. ++ * 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. ++ * Neither the name of the copyright holder nor the ++ names of its contributors may be used to endorse or promote products ++ derived from this software without specific prior written permission. + -+ /* Pad that we may save more registers into in the future. */ -+ uint32_t pad[16]; -+}; ++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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. ++*/ + - #endif /* _UAPI_VC4_DRM_H_ */ - -From 431be9af0aa88da94986effdff649330cfde1f5a Mon Sep 17 00:00:00 2001 -From: Eric Anholt <eric@anholt.net> -Date: Fri, 4 Dec 2015 11:35:34 -0800 -Subject: [PATCH 115/170] drm/vc4: Update a bunch of code to match upstream - submission. - -This gets almost everything matching, except for the MSAA support and -using generic PM domains. - -Signed-off-by: Eric Anholt <eric@anholt.net> ---- - drivers/gpu/drm/drm_gem_cma_helper.c | 13 +- - drivers/gpu/drm/vc4/vc4_bo.c | 322 +++++++++++++++++------------ - drivers/gpu/drm/vc4/vc4_crtc.c | 7 +- - drivers/gpu/drm/vc4/vc4_drv.c | 6 +- - drivers/gpu/drm/vc4/vc4_drv.h | 20 +- - drivers/gpu/drm/vc4/vc4_gem.c | 24 ++- - drivers/gpu/drm/vc4/vc4_irq.c | 5 +- - drivers/gpu/drm/vc4/vc4_kms.c | 1 + - drivers/gpu/drm/vc4/vc4_packet.h | 210 +++++++++---------- - drivers/gpu/drm/vc4/vc4_qpu_defines.h | 308 ++++++++++++++------------- - drivers/gpu/drm/vc4/vc4_render_cl.c | 4 +- - drivers/gpu/drm/vc4/vc4_v3d.c | 10 +- - drivers/gpu/drm/vc4/vc4_validate.c | 130 ++++++------ - drivers/gpu/drm/vc4/vc4_validate_shaders.c | 66 +++--- - include/drm/drmP.h | 8 +- - 15 files changed, 598 insertions(+), 536 deletions(-) - -diff --git a/drivers/gpu/drm/drm_gem_cma_helper.c b/drivers/gpu/drm/drm_gem_cma_helper.c -index 1c25500..0f7b00b 100644 ---- a/drivers/gpu/drm/drm_gem_cma_helper.c -+++ b/drivers/gpu/drm/drm_gem_cma_helper.c -@@ -58,15 +58,14 @@ __drm_gem_cma_create(struct drm_device *drm, size_t size) - struct drm_gem_cma_object *cma_obj; - struct drm_gem_object *gem_obj; - int ret; -- size_t obj_size = (drm->driver->gem_obj_size ? -- drm->driver->gem_obj_size : -- sizeof(*cma_obj)); - -- cma_obj = kzalloc(obj_size, GFP_KERNEL); -- if (!cma_obj) -+ if (drm->driver->gem_create_object) -+ gem_obj = drm->driver->gem_create_object(drm, size); -+ else -+ gem_obj = kzalloc(sizeof(*cma_obj), GFP_KERNEL); -+ if (!gem_obj) - return ERR_PTR(-ENOMEM); -- -- gem_obj = &cma_obj->base; -+ cma_obj = container_of(gem_obj, struct drm_gem_cma_object, base); - - ret = drm_gem_object_init(drm, gem_obj, size); - if (ret) -diff --git a/drivers/gpu/drm/vc4/vc4_bo.c b/drivers/gpu/drm/vc4/vc4_bo.c -index 58dcbae..6247ff8 100644 ---- a/drivers/gpu/drm/vc4/vc4_bo.c -+++ b/drivers/gpu/drm/vc4/vc4_bo.c -@@ -12,6 +12,10 @@ - * access to system memory with no MMU in between. To support it, we - * use the GEM CMA helper functions to allocate contiguous ranges of - * physical memory for our BOs. -+ * -+ * Since the CMA allocator is very slow, we keep a cache of recently -+ * freed BOs around so that the kernel's allocation of objects for 3D -+ * rendering can return quickly. - */ - - #include "vc4_drv.h" -@@ -34,6 +38,36 @@ static void vc4_bo_stats_dump(struct vc4_dev *vc4) - vc4->bo_stats.size_cached / 1024); - } - -+#ifdef CONFIG_DEBUG_FS -+int vc4_bo_stats_debugfs(struct seq_file *m, void *unused) -+{ -+ struct drm_info_node *node = (struct drm_info_node *)m->private; -+ struct drm_device *dev = node->minor->dev; -+ struct vc4_dev *vc4 = to_vc4_dev(dev); -+ struct vc4_bo_stats stats; -+ -+ /* Take a snapshot of the current stats with the lock held. */ -+ mutex_lock(&vc4->bo_lock); -+ stats = vc4->bo_stats; -+ mutex_unlock(&vc4->bo_lock); -+ -+ seq_printf(m, "num bos allocated: %d\n", -+ stats.num_allocated); -+ seq_printf(m, "size bos allocated: %dkb\n", -+ stats.size_allocated / 1024); -+ seq_printf(m, "num bos used: %d\n", -+ stats.num_allocated - stats.num_cached); -+ seq_printf(m, "size bos used: %dkb\n", -+ (stats.size_allocated - stats.size_cached) / 1024); -+ seq_printf(m, "num bos cached: %d\n", -+ stats.num_cached); -+ seq_printf(m, "size bos cached: %dkb\n", -+ stats.size_cached / 1024); ++#include <linux/linkage.h> ++#include "arm-mem.h" ++#include "memcpymove.h" + -+ return 0; -+} ++/* Prevent the stack from becoming executable */ ++#if defined(__linux__) && defined(__ELF__) ++.section .note.GNU-stack,"",%progbits +#endif + - static uint32_t bo_page_index(size_t size) - { - return (size / PAGE_SIZE) - 1; -@@ -81,8 +115,8 @@ static struct list_head *vc4_get_cache_list_for_size(struct drm_device *dev, - struct list_head *new_list; - uint32_t i; - -- new_list = kmalloc(new_size * sizeof(struct list_head), -- GFP_KERNEL); -+ new_list = kmalloc_array(new_size, sizeof(struct list_head), -+ GFP_KERNEL); - if (!new_list) - return NULL; - -@@ -90,7 +124,9 @@ static struct list_head *vc4_get_cache_list_for_size(struct drm_device *dev, - * head locations. - */ - for (i = 0; i < vc4->bo_cache.size_list_size; i++) { -- struct list_head *old_list = &vc4->bo_cache.size_list[i]; -+ struct list_head *old_list = -+ &vc4->bo_cache.size_list[i]; -+ - if (list_empty(old_list)) - INIT_LIST_HEAD(&new_list[i]); - else -@@ -122,11 +158,60 @@ void vc4_bo_cache_purge(struct drm_device *dev) - mutex_unlock(&vc4->bo_lock); - } - --struct vc4_bo *vc4_bo_create(struct drm_device *dev, size_t unaligned_size) -+static struct vc4_bo *vc4_bo_get_from_cache(struct drm_device *dev, -+ uint32_t size) - { - struct vc4_dev *vc4 = to_vc4_dev(dev); -- uint32_t size = roundup(unaligned_size, PAGE_SIZE); - uint32_t page_index = bo_page_index(size); -+ struct vc4_bo *bo = NULL; -+ -+ size = roundup(size, PAGE_SIZE); ++ .text ++ .arch armv6 ++ .object_arch armv4 ++ .arm ++ .altmacro ++ .p2align 2 + -+ mutex_lock(&vc4->bo_lock); -+ if (page_index >= vc4->bo_cache.size_list_size) -+ goto out; ++/* ++ * void *memmove(void *s1, const void *s2, size_t n); ++ * On entry: ++ * a1 = pointer to destination ++ * a2 = pointer to source ++ * a3 = number of bytes to copy ++ * On exit: ++ * a1 preserved ++ */ + -+ if (list_empty(&vc4->bo_cache.size_list[page_index])) -+ goto out; ++.set prefetch_distance, 3 + -+ bo = list_first_entry(&vc4->bo_cache.size_list[page_index], -+ struct vc4_bo, size_head); -+ vc4_bo_remove_from_cache(bo); -+ kref_init(&bo->base.base.refcount); ++ENTRY(memmove) ++ cmp a2, a1 ++ bpl memcpy /* pl works even over -1 - 0 and 0x7fffffff - 0x80000000 boundaries */ ++ memcpy 1 ++ENDPROC(memmove) +diff --git a/arch/arm/lib/memset_rpi.S b/arch/arm/lib/memset_rpi.S +new file mode 100644 +index 0000000..7067415 +--- /dev/null ++++ b/arch/arm/lib/memset_rpi.S +@@ -0,0 +1,123 @@ ++/* ++Copyright (c) 2013, Raspberry Pi Foundation ++Copyright (c) 2013, RISC OS Open Ltd ++All rights reserved. + -+out: -+ mutex_unlock(&vc4->bo_lock); -+ return bo; -+} ++Redistribution and use in source and binary forms, with or without ++modification, are permitted provided that the following conditions are met: ++ * Redistributions of source code must retain the above copyright ++ notice, this list of conditions and the following disclaimer. ++ * 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. ++ * Neither the name of the copyright holder nor the ++ names of its contributors may be used to endorse or promote products ++ derived from this software without specific prior written permission. + -+/** -+ * vc4_gem_create_object - Implementation of driver->gem_create_object. -+ * -+ * This lets the CMA helpers allocate object structs for us, and keep -+ * our BO stats correct. -+ */ -+struct drm_gem_object *vc4_create_object(struct drm_device *dev, size_t size) -+{ -+ struct vc4_dev *vc4 = to_vc4_dev(dev); -+ struct vc4_bo *bo; ++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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. ++*/ + -+ bo = kzalloc(sizeof(*bo), GFP_KERNEL); -+ if (!bo) -+ return ERR_PTR(-ENOMEM); ++#include <linux/linkage.h> ++#include "arm-mem.h" + -+ mutex_lock(&vc4->bo_lock); -+ vc4->bo_stats.num_allocated++; -+ vc4->bo_stats.size_allocated += size; -+ mutex_unlock(&vc4->bo_lock); ++/* Prevent the stack from becoming executable */ ++#if defined(__linux__) && defined(__ELF__) ++.section .note.GNU-stack,"",%progbits ++#endif + -+ return &bo->base.base; -+} ++ .text ++ .arch armv6 ++ .object_arch armv4 ++ .arm ++ .altmacro ++ .p2align 2 + -+struct vc4_bo *vc4_bo_create(struct drm_device *dev, size_t unaligned_size, -+ bool from_cache) -+{ -+ size_t size = roundup(unaligned_size, PAGE_SIZE); -+ struct vc4_dev *vc4 = to_vc4_dev(dev); - struct drm_gem_cma_object *cma_obj; - int pass; - -@@ -134,18 +219,12 @@ struct vc4_bo *vc4_bo_create(struct drm_device *dev, size_t unaligned_size) - return NULL; - - /* First, try to get a vc4_bo from the kernel BO cache. */ -- mutex_lock(&vc4->bo_lock); -- if (page_index < vc4->bo_cache.size_list_size && -- !list_empty(&vc4->bo_cache.size_list[page_index])) { -- struct vc4_bo *bo = -- list_first_entry(&vc4->bo_cache.size_list[page_index], -- struct vc4_bo, size_head); -- vc4_bo_remove_from_cache(bo); -- mutex_unlock(&vc4->bo_lock); -- kref_init(&bo->base.base.refcount); -- return bo; -+ if (from_cache) { -+ struct vc4_bo *bo = vc4_bo_get_from_cache(dev, size); -+ -+ if (bo) -+ return bo; - } -- mutex_unlock(&vc4->bo_lock); - - /* Otherwise, make a new BO. */ - for (pass = 0; ; pass++) { -@@ -179,9 +258,6 @@ struct vc4_bo *vc4_bo_create(struct drm_device *dev, size_t unaligned_size) - } - } - -- vc4->bo_stats.num_allocated++; -- vc4->bo_stats.size_allocated += size; -- - return to_vc4_bo(&cma_obj->base); - } - -@@ -199,7 +275,7 @@ int vc4_dumb_create(struct drm_file *file_priv, - if (args->size < args->pitch * args->height) - args->size = args->pitch * args->height; - -- bo = vc4_bo_create(dev, args->size); -+ bo = vc4_bo_create(dev, args->size, false); - if (!bo) - return -ENOMEM; - -@@ -209,8 +285,8 @@ int vc4_dumb_create(struct drm_file *file_priv, - return ret; - } - --static void --vc4_bo_cache_free_old(struct drm_device *dev) -+/* Must be called with bo_lock held. */ -+static void vc4_bo_cache_free_old(struct drm_device *dev) - { - struct vc4_dev *vc4 = to_vc4_dev(dev); - unsigned long expire_time = jiffies - msecs_to_jiffies(1000); -@@ -313,15 +389,77 @@ vc4_prime_export(struct drm_device *dev, struct drm_gem_object *obj, int flags) - return drm_gem_prime_export(dev, obj, flags); - } - --int --vc4_create_bo_ioctl(struct drm_device *dev, void *data, -- struct drm_file *file_priv) -+int vc4_mmap(struct file *filp, struct vm_area_struct *vma) -+{ -+ struct drm_gem_object *gem_obj; -+ struct vc4_bo *bo; -+ int ret; ++/* ++ * void *memset(void *s, int c, size_t n); ++ * On entry: ++ * a1 = pointer to buffer to fill ++ * a2 = byte pattern to fill with (caller-narrowed) ++ * a3 = number of bytes to fill ++ * On exit: ++ * a1 preserved ++ */ ++ENTRY(mmioset) ++ENTRY(memset) ++ S .req a1 ++ DAT0 .req a2 ++ N .req a3 ++ DAT1 .req a4 ++ DAT2 .req ip ++ DAT3 .req lr + -+ ret = drm_gem_mmap(filp, vma); -+ if (ret) -+ return ret; ++ orr DAT0, DAT0, lsl #8 ++ push {S, lr} ++ orr DAT0, DAT0, lsl #16 ++ mov DAT1, DAT0 + -+ gem_obj = vma->vm_private_data; -+ bo = to_vc4_bo(gem_obj); ++ /* See if we're guaranteed to have at least one 16-byte aligned 16-byte write */ ++ cmp N, #31 ++ blo 170f + -+ if (bo->validated_shader && (vma->vm_flags & VM_WRITE)) { -+ DRM_ERROR("mmaping of shader BOs for writing not allowed.\n"); -+ return -EINVAL; -+ } ++161: sub N, N, #16 /* simplifies inner loop termination */ ++ /* Leading words and bytes */ ++ tst S, #15 ++ beq 164f ++ rsb DAT3, S, #0 /* bits 0-3 = number of leading bytes until aligned */ ++ movs DAT2, DAT3, lsl #31 ++ submi N, N, #1 ++ strmib DAT0, [S], #1 ++ subcs N, N, #2 ++ strcsh DAT0, [S], #2 ++ movs DAT2, DAT3, lsl #29 ++ submi N, N, #4 ++ strmi DAT0, [S], #4 ++ subcs N, N, #8 ++ stmcsia S!, {DAT0, DAT1} ++164: /* Delayed set up of DAT2 and DAT3 so we could use them as scratch registers above */ ++ mov DAT2, DAT0 ++ mov DAT3, DAT0 ++ /* Now the inner loop of 16-byte stores */ ++165: stmia S!, {DAT0, DAT1, DAT2, DAT3} ++ subs N, N, #16 ++ bhs 165b ++166: /* Trailing words and bytes */ ++ movs N, N, lsl #29 ++ stmcsia S!, {DAT0, DAT1} ++ strmi DAT0, [S], #4 ++ movs N, N, lsl #2 ++ strcsh DAT0, [S], #2 ++ strmib DAT0, [S] ++199: pop {S, pc} + -+ /* -+ * Clear the VM_PFNMAP flag that was set by drm_gem_mmap(), and set the -+ * vm_pgoff (used as a fake buffer offset by DRM) to 0 as we want to map -+ * the whole buffer. -+ */ -+ vma->vm_flags &= ~VM_PFNMAP; -+ vma->vm_pgoff = 0; ++170: /* Short case */ ++ mov DAT2, DAT0 ++ mov DAT3, DAT0 ++ tst S, #3 ++ beq 174f ++172: subs N, N, #1 ++ blo 199b ++ strb DAT0, [S], #1 ++ tst S, #3 ++ bne 172b ++174: tst N, #16 ++ stmneia S!, {DAT0, DAT1, DAT2, DAT3} ++ b 166b + -+ ret = dma_mmap_writecombine(bo->base.base.dev->dev, vma, -+ bo->base.vaddr, bo->base.paddr, -+ vma->vm_end - vma->vm_start); -+ if (ret) -+ drm_gem_vm_close(vma); ++ .unreq S ++ .unreq DAT0 ++ .unreq N ++ .unreq DAT1 ++ .unreq DAT2 ++ .unreq DAT3 ++ENDPROC(memset) ++ENDPROC(mmioset) +diff --git a/arch/arm/lib/uaccess_with_memcpy.c b/arch/arm/lib/uaccess_with_memcpy.c +index 6bd1089..cd17dd1 100644 +--- a/arch/arm/lib/uaccess_with_memcpy.c ++++ b/arch/arm/lib/uaccess_with_memcpy.c +@@ -22,6 +22,14 @@ + #include <asm/current.h> + #include <asm/page.h> + ++#ifndef COPY_FROM_USER_THRESHOLD ++#define COPY_FROM_USER_THRESHOLD 64 ++#endif + -+ return ret; -+} ++#ifndef COPY_TO_USER_THRESHOLD ++#define COPY_TO_USER_THRESHOLD 64 ++#endif + -+int vc4_prime_mmap(struct drm_gem_object *obj, struct vm_area_struct *vma) + static int + pin_page_for_write(const void __user *_addr, pte_t **ptep, spinlock_t **ptlp) + { +@@ -84,7 +92,44 @@ pin_page_for_write(const void __user *_addr, pte_t **ptep, spinlock_t **ptlp) + return 1; + } + +-static unsigned long noinline ++static int ++pin_page_for_read(const void __user *_addr, pte_t **ptep, spinlock_t **ptlp) +{ -+ struct vc4_bo *bo = to_vc4_bo(obj); ++ unsigned long addr = (unsigned long)_addr; ++ pgd_t *pgd; ++ pmd_t *pmd; ++ pte_t *pte; ++ pud_t *pud; ++ spinlock_t *ptl; + -+ if (bo->validated_shader && (vma->vm_flags & VM_WRITE)) { -+ DRM_ERROR("mmaping of shader BOs for writing not allowed.\n"); -+ return -EINVAL; ++ pgd = pgd_offset(current->mm, addr); ++ if (unlikely(pgd_none(*pgd) || pgd_bad(*pgd))) ++ { ++ return 0; ++ } ++ pud = pud_offset(pgd, addr); ++ if (unlikely(pud_none(*pud) || pud_bad(*pud))) ++ { ++ return 0; + } + -+ return drm_gem_cma_prime_mmap(obj, vma); -+} -+ -+void *vc4_prime_vmap(struct drm_gem_object *obj) -+{ -+ struct vc4_bo *bo = to_vc4_bo(obj); ++ pmd = pmd_offset(pud, addr); ++ if (unlikely(pmd_none(*pmd) || pmd_bad(*pmd))) ++ return 0; + -+ if (bo->validated_shader) { -+ DRM_ERROR("mmaping of shader BOs not allowed.\n"); -+ return ERR_PTR(-EINVAL); ++ pte = pte_offset_map_lock(current->mm, pmd, addr, &ptl); ++ if (unlikely(!pte_present(*pte) || !pte_young(*pte))) { ++ pte_unmap_unlock(pte, ptl); ++ return 0; + } + -+ return drm_gem_cma_prime_vmap(obj); ++ *ptep = pte; ++ *ptlp = ptl; ++ ++ return 1; +} + -+int vc4_create_bo_ioctl(struct drm_device *dev, void *data, -+ struct drm_file *file_priv) ++unsigned long noinline + __copy_to_user_memcpy(void __user *to, const void *from, unsigned long n) { - struct drm_vc4_create_bo *args = data; - struct vc4_bo *bo = NULL; - int ret; - -- bo = vc4_bo_create(dev, args->size); -+ /* -+ * We can't allocate from the BO cache, because the BOs don't -+ * get zeroed, and that might leak data between users. -+ */ -+ bo = vc4_bo_create(dev, args->size, false); - if (!bo) - return -ENOMEM; - -@@ -331,6 +469,25 @@ vc4_create_bo_ioctl(struct drm_device *dev, void *data, - return ret; + unsigned long ua_flags; +@@ -137,6 +182,57 @@ out: + return n; } -+int vc4_mmap_bo_ioctl(struct drm_device *dev, void *data, -+ struct drm_file *file_priv) ++unsigned long noinline ++__copy_from_user_memcpy(void *to, const void __user *from, unsigned long n) +{ -+ struct drm_vc4_mmap_bo *args = data; -+ struct drm_gem_object *gem_obj; ++ unsigned long ua_flags; ++ int atomic; + -+ gem_obj = drm_gem_object_lookup(dev, file_priv, args->handle); -+ if (!gem_obj) { -+ DRM_ERROR("Failed to look up GEM BO %d\n", args->handle); -+ return -EINVAL; ++ if (unlikely(segment_eq(get_fs(), KERNEL_DS))) { ++ memcpy(to, (const void *)from, n); ++ return 0; + } + -+ /* The mmap offset was set up at BO allocation time. */ -+ args->offset = drm_vma_node_offset_addr(&gem_obj->vma_node); ++ /* the mmap semaphore is taken only if not in an atomic context */ ++ atomic = in_atomic(); + -+ drm_gem_object_unreference_unlocked(gem_obj); -+ return 0; -+} ++ if (!atomic) ++ down_read(&current->mm->mmap_sem); ++ while (n) { ++ pte_t *pte; ++ spinlock_t *ptl; ++ int tocopy; + - int - vc4_create_shader_bo_ioctl(struct drm_device *dev, void *data, - struct drm_file *file_priv) -@@ -355,7 +512,7 @@ vc4_create_shader_bo_ioctl(struct drm_device *dev, void *data, - return -EINVAL; - } - -- bo = vc4_bo_create(dev, args->size); -+ bo = vc4_bo_create(dev, args->size, true); - if (!bo) - return -ENOMEM; - -@@ -364,6 +521,11 @@ vc4_create_shader_bo_ioctl(struct drm_device *dev, void *data, - args->size); - if (ret != 0) - goto fail; -+ /* Clear the rest of the memory from allocating from the BO -+ * cache. -+ */ -+ memset(bo->base.vaddr + args->size, 0, -+ bo->base.base.size - args->size); - - bo->validated_shader = vc4_validate_shader(&bo->base); - if (!bo->validated_shader) { -@@ -382,85 +544,6 @@ vc4_create_shader_bo_ioctl(struct drm_device *dev, void *data, - return ret; - } - --int --vc4_mmap_bo_ioctl(struct drm_device *dev, void *data, -- struct drm_file *file_priv) --{ -- struct drm_vc4_mmap_bo *args = data; -- struct drm_gem_object *gem_obj; -- -- gem_obj = drm_gem_object_lookup(dev, file_priv, args->handle); -- if (!gem_obj) { -- DRM_ERROR("Failed to look up GEM BO %d\n", args->handle); -- return -EINVAL; -- } -- -- /* The mmap offset was set up at BO allocation time. */ -- args->offset = drm_vma_node_offset_addr(&gem_obj->vma_node); -- -- drm_gem_object_unreference(gem_obj); -- return 0; --} -- --int vc4_mmap(struct file *filp, struct vm_area_struct *vma) --{ -- struct drm_gem_object *gem_obj; -- struct vc4_bo *bo; -- int ret; -- -- ret = drm_gem_mmap(filp, vma); -- if (ret) -- return ret; -- -- gem_obj = vma->vm_private_data; -- bo = to_vc4_bo(gem_obj); -- -- if (bo->validated_shader && (vma->vm_flags & VM_WRITE)) { -- DRM_ERROR("mmaping of shader BOs for writing not allowed.\n"); -- return -EINVAL; -- } -- -- /* -- * Clear the VM_PFNMAP flag that was set by drm_gem_mmap(), and set the -- * vm_pgoff (used as a fake buffer offset by DRM) to 0 as we want to map -- * the whole buffer. -- */ -- vma->vm_flags &= ~VM_PFNMAP; -- vma->vm_pgoff = 0; -- -- ret = dma_mmap_writecombine(bo->base.base.dev->dev, vma, -- bo->base.vaddr, bo->base.paddr, -- vma->vm_end - vma->vm_start); -- if (ret) -- drm_gem_vm_close(vma); -- -- return ret; --} -- --int vc4_prime_mmap(struct drm_gem_object *obj, struct vm_area_struct *vma) --{ -- struct vc4_bo *bo = to_vc4_bo(obj); -- -- if (bo->validated_shader) { -- DRM_ERROR("mmaping of shader BOs not allowed.\n"); -- return -EINVAL; -- } -- -- return drm_gem_cma_prime_mmap(obj, vma); --} -- --void *vc4_prime_vmap(struct drm_gem_object *obj) --{ -- struct vc4_bo *bo = to_vc4_bo(obj); -- -- if (bo->validated_shader) { -- DRM_ERROR("mmaping of shader BOs not allowed.\n"); -- return ERR_PTR(-EINVAL); -- } -- -- return drm_gem_cma_prime_vmap(obj); --} -- - void vc4_bo_cache_init(struct drm_device *dev) - { - struct vc4_dev *vc4 = to_vc4_dev(dev); -@@ -472,7 +555,7 @@ void vc4_bo_cache_init(struct drm_device *dev) - INIT_WORK(&vc4->bo_cache.time_work, vc4_bo_cache_time_work); - setup_timer(&vc4->bo_cache.time_timer, - vc4_bo_cache_time_timer, -- (unsigned long) dev); -+ (unsigned long)dev); - } - - void vc4_bo_cache_destroy(struct drm_device *dev) -@@ -489,28 +572,3 @@ void vc4_bo_cache_destroy(struct drm_device *dev) - vc4_bo_stats_dump(vc4); - } - } -- --#ifdef CONFIG_DEBUG_FS --int vc4_bo_stats_debugfs(struct seq_file *m, void *unused) --{ -- struct drm_info_node *node = (struct drm_info_node *) m->private; -- struct drm_device *dev = node->minor->dev; -- struct vc4_dev *vc4 = to_vc4_dev(dev); -- struct vc4_bo_stats stats; -- -- mutex_lock(&vc4->bo_lock); -- stats = vc4->bo_stats; -- mutex_unlock(&vc4->bo_lock); -- -- seq_printf(m, "num bos allocated: %d\n", stats.num_allocated); -- seq_printf(m, "size bos allocated: %dkb\n", stats.size_allocated / 1024); -- seq_printf(m, "num bos used: %d\n", (stats.num_allocated - -- stats.num_cached)); -- seq_printf(m, "size bos used: %dkb\n", (stats.size_allocated - -- stats.size_cached) / 1024); -- seq_printf(m, "num bos cached: %d\n", stats.num_cached); -- seq_printf(m, "size bos cached: %dkb\n", stats.size_cached / 1024); -- -- return 0; --} --#endif -diff --git a/drivers/gpu/drm/vc4/vc4_crtc.c b/drivers/gpu/drm/vc4/vc4_crtc.c -index 3be2720..3c67914 100644 ---- a/drivers/gpu/drm/vc4/vc4_crtc.c -+++ b/drivers/gpu/drm/vc4/vc4_crtc.c -@@ -501,6 +501,7 @@ vc4_async_page_flip_complete(struct vc4_seqno_cb *cb) - vc4_plane_async_set_fb(plane, flip_state->fb); - if (flip_state->event) { - unsigned long flags; -+ - spin_lock_irqsave(&dev->event_lock, flags); - drm_crtc_send_vblank_event(crtc, flip_state->event); - spin_unlock_irqrestore(&dev->event_lock, flags); -@@ -562,9 +563,9 @@ static int vc4_async_page_flip(struct drm_crtc *crtc, - } - - static int vc4_page_flip(struct drm_crtc *crtc, -- struct drm_framebuffer *fb, -- struct drm_pending_vblank_event *event, -- uint32_t flags) -+ struct drm_framebuffer *fb, -+ struct drm_pending_vblank_event *event, -+ uint32_t flags) - { - if (flags & DRM_MODE_PAGE_FLIP_ASYNC) - return vc4_async_page_flip(crtc, fb, event, flags); -diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c -index e8192b4..22061ae 100644 ---- a/drivers/gpu/drm/vc4/vc4_drv.c -+++ b/drivers/gpu/drm/vc4/vc4_drv.c -@@ -81,7 +81,8 @@ static const struct drm_ioctl_desc vc4_drm_ioctls[] = { - DRM_IOCTL_DEF_DRV(VC4_CREATE_BO, vc4_create_bo_ioctl, 0), - DRM_IOCTL_DEF_DRV(VC4_MMAP_BO, vc4_mmap_bo_ioctl, 0), - DRM_IOCTL_DEF_DRV(VC4_CREATE_SHADER_BO, vc4_create_shader_bo_ioctl, 0), -- DRM_IOCTL_DEF_DRV(VC4_GET_HANG_STATE, vc4_get_hang_state_ioctl, DRM_ROOT_ONLY), -+ DRM_IOCTL_DEF_DRV(VC4_GET_HANG_STATE, vc4_get_hang_state_ioctl, -+ DRM_ROOT_ONLY), - }; - - static struct drm_driver vc4_drm_driver = { -@@ -107,6 +108,7 @@ static struct drm_driver vc4_drm_driver = { - .debugfs_cleanup = vc4_debugfs_cleanup, - #endif - -+ .gem_create_object = vc4_create_object, - .gem_free_object = vc4_free_object, - .gem_vm_ops = &drm_gem_cma_vm_ops, - -@@ -128,8 +130,6 @@ static struct drm_driver vc4_drm_driver = { - .num_ioctls = ARRAY_SIZE(vc4_drm_ioctls), - .fops = &vc4_drm_fops, - -- //.gem_obj_size = sizeof(struct vc4_bo), -- - .name = DRIVER_NAME, - .desc = DRIVER_DESC, - .date = DRIVER_DATE, -diff --git a/drivers/gpu/drm/vc4/vc4_drv.h b/drivers/gpu/drm/vc4/vc4_drv.h -index 24845c1..53dfa8df 100644 ---- a/drivers/gpu/drm/vc4/vc4_drv.h -+++ b/drivers/gpu/drm/vc4/vc4_drv.h -@@ -72,6 +72,9 @@ struct vc4_dev { - * job_done_work. - */ - struct list_head job_done_list; -+ /* Spinlock used to synchronize the job_list and seqno -+ * accesses between the IRQ handler and GEM ioctls. -+ */ - spinlock_t job_lock; - wait_queue_head_t job_wait_queue; - struct work_struct job_done_work; -@@ -318,8 +321,7 @@ struct vc4_texture_sample_info { - * and validate the shader state record's uniforms that define the texture - * samples. - */ --struct vc4_validated_shader_info --{ -+struct vc4_validated_shader_info { - uint32_t uniforms_size; - uint32_t uniforms_src_size; - uint32_t num_texture_samples; -@@ -355,8 +357,10 @@ struct vc4_validated_shader_info - #define wait_for(COND, MS) _wait_for(COND, MS, 1) - - /* vc4_bo.c */ -+struct drm_gem_object *vc4_create_object(struct drm_device *dev, size_t size); - void vc4_free_object(struct drm_gem_object *gem_obj); --struct vc4_bo *vc4_bo_create(struct drm_device *dev, size_t size); -+struct vc4_bo *vc4_bo_create(struct drm_device *dev, size_t size, -+ bool from_cache); - int vc4_dumb_create(struct drm_file *file_priv, - struct drm_device *dev, - struct drm_mode_create_dumb *args); -@@ -432,7 +436,8 @@ struct drm_plane *vc4_plane_init(struct drm_device *dev, - enum drm_plane_type type); - u32 vc4_plane_write_dlist(struct drm_plane *plane, u32 __iomem *dlist); - u32 vc4_plane_dlist_size(struct drm_plane_state *state); --void vc4_plane_async_set_fb(struct drm_plane *plane, struct drm_framebuffer *fb); -+void vc4_plane_async_set_fb(struct drm_plane *plane, -+ struct drm_framebuffer *fb); - - /* vc4_v3d.c */ - extern struct platform_driver vc4_v3d_driver; -@@ -450,9 +455,6 @@ vc4_validate_bin_cl(struct drm_device *dev, - int - vc4_validate_shader_recs(struct drm_device *dev, struct vc4_exec_info *exec); - --struct vc4_validated_shader_info * --vc4_validate_shader(struct drm_gem_cma_object *shader_obj); -- - bool vc4_use_bo(struct vc4_exec_info *exec, - uint32_t hindex, - enum vc4_bo_mode mode, -@@ -464,3 +466,7 @@ bool vc4_check_tex_size(struct vc4_exec_info *exec, - struct drm_gem_cma_object *fbo, - uint32_t offset, uint8_t tiling_format, - uint32_t width, uint32_t height, uint8_t cpp); -+ -+/* vc4_validate_shader.c */ -+struct vc4_validated_shader_info * -+vc4_validate_shader(struct drm_gem_cma_object *shader_obj); -diff --git a/drivers/gpu/drm/vc4/vc4_gem.c b/drivers/gpu/drm/vc4/vc4_gem.c -index d90c664..fb0b92d 100644 ---- a/drivers/gpu/drm/vc4/vc4_gem.c -+++ b/drivers/gpu/drm/vc4/vc4_gem.c -@@ -53,9 +53,8 @@ vc4_free_hang_state(struct drm_device *dev, struct vc4_hang_state *state) - unsigned int i; - - mutex_lock(&dev->struct_mutex); -- for (i = 0; i < state->user_state.bo_count; i++) { -+ for (i = 0; i < state->user_state.bo_count; i++) - drm_gem_object_unreference(state->bo[i]); -- } - mutex_unlock(&dev->struct_mutex); - - kfree(state); -@@ -65,10 +64,10 @@ int - vc4_get_hang_state_ioctl(struct drm_device *dev, void *data, - struct drm_file *file_priv) - { -- struct drm_vc4_get_hang_state *get_state = data; -+ struct drm_vc4_get_hang_state *get_state = data; - struct drm_vc4_get_hang_state_bo *bo_state; - struct vc4_hang_state *kernel_state; -- struct drm_vc4_get_hang_state *state; -+ struct drm_vc4_get_hang_state *state; - struct vc4_dev *vc4 = to_vc4_dev(dev); - unsigned long irqflags; - u32 i; -@@ -107,6 +106,7 @@ vc4_get_hang_state_ioctl(struct drm_device *dev, void *data, - for (i = 0; i < state->bo_count; i++) { - struct vc4_bo *vc4_bo = to_vc4_bo(kernel_state->bo[i]); - u32 handle; ++ while (!pin_page_for_read(from, &pte, &ptl)) { ++ char temp; ++ if (!atomic) ++ up_read(&current->mm->mmap_sem); ++ if (__get_user(temp, (char __user *)from)) ++ goto out; ++ if (!atomic) ++ down_read(&current->mm->mmap_sem); ++ } + - ret = drm_gem_handle_create(file_priv, kernel_state->bo[i], - &handle); - -@@ -124,7 +124,7 @@ vc4_get_hang_state_ioctl(struct drm_device *dev, void *data, - state->bo_count * sizeof(*bo_state)); - kfree(bo_state); - -- err_free: -+err_free: - - vc4_free_hang_state(dev, kernel_state); - -@@ -578,7 +578,7 @@ vc4_get_bcl(struct drm_device *dev, struct vc4_exec_info *exec) - goto fail; - } - -- bo = vc4_bo_create(dev, exec_size); -+ bo = vc4_bo_create(dev, exec_size, true); - if (!bo) { - DRM_ERROR("Couldn't allocate BO for binning\n"); - ret = PTR_ERR(exec->exec_bo); -@@ -668,6 +668,7 @@ vc4_job_handle_completed(struct vc4_dev *vc4) - static void vc4_seqno_cb_work(struct work_struct *work) - { - struct vc4_seqno_cb *cb = container_of(work, struct vc4_seqno_cb, work); ++ tocopy = (~(unsigned long)from & ~PAGE_MASK) + 1; ++ if (tocopy > n) ++ tocopy = n; + - cb->func(cb); - } - -@@ -717,6 +718,7 @@ vc4_wait_for_seqno_ioctl_helper(struct drm_device *dev, - - if ((ret == -EINTR || ret == -ERESTARTSYS) && *timeout_ns != ~0ull) { - uint64_t delta = jiffies_to_nsecs(jiffies - start); ++ ua_flags = uaccess_save_and_enable(); ++ memcpy(to, (const void *)from, tocopy); ++ uaccess_restore(ua_flags); ++ to += tocopy; ++ from += tocopy; ++ n -= tocopy; + - if (*timeout_ns >= delta) - *timeout_ns -= delta; - } -@@ -750,9 +752,10 @@ vc4_wait_bo_ioctl(struct drm_device *dev, void *data, - } - bo = to_vc4_bo(gem_obj); - -- ret = vc4_wait_for_seqno_ioctl_helper(dev, bo->seqno, &args->timeout_ns); -+ ret = vc4_wait_for_seqno_ioctl_helper(dev, bo->seqno, -+ &args->timeout_ns); - -- drm_gem_object_unreference(gem_obj); -+ drm_gem_object_unreference_unlocked(gem_obj); - return ret; - } - -@@ -793,7 +796,8 @@ vc4_submit_cl_ioctl(struct drm_device *dev, void *data, - if (ret) - goto fail; - } else { -- exec->ct0ca = exec->ct0ea = 0; -+ exec->ct0ca = 0; -+ exec->ct0ea = 0; - } - - ret = vc4_get_rcl(dev, exec); -@@ -831,7 +835,7 @@ vc4_gem_init(struct drm_device *dev) - INIT_WORK(&vc4->hangcheck.reset_work, vc4_reset_work); - setup_timer(&vc4->hangcheck.timer, - vc4_hangcheck_elapsed, -- (unsigned long) dev); -+ (unsigned long)dev); - - INIT_WORK(&vc4->job_done_work, vc4_job_done_work); - } -diff --git a/drivers/gpu/drm/vc4/vc4_irq.c b/drivers/gpu/drm/vc4/vc4_irq.c -index f29b796..b68060e 100644 ---- a/drivers/gpu/drm/vc4/vc4_irq.c -+++ b/drivers/gpu/drm/vc4/vc4_irq.c -@@ -56,7 +56,7 @@ vc4_overflow_mem_work(struct work_struct *work) - struct drm_device *dev = vc4->dev; - struct vc4_bo *bo; - -- bo = vc4_bo_create(dev, 256 * 1024); -+ bo = vc4_bo_create(dev, 256 * 1024, true); - if (!bo) { - DRM_ERROR("Couldn't allocate binner overflow mem\n"); - return; -@@ -87,9 +87,8 @@ vc4_overflow_mem_work(struct work_struct *work) - spin_unlock_irqrestore(&vc4->job_lock, irqflags); - } - -- if (vc4->overflow_mem) { -+ if (vc4->overflow_mem) - drm_gem_object_unreference_unlocked(&vc4->overflow_mem->base.base); -- } - vc4->overflow_mem = bo; - - V3D_WRITE(V3D_BPOA, bo->base.paddr); -diff --git a/drivers/gpu/drm/vc4/vc4_kms.c b/drivers/gpu/drm/vc4/vc4_kms.c -index 2082713..f95f2df 100644 ---- a/drivers/gpu/drm/vc4/vc4_kms.c -+++ b/drivers/gpu/drm/vc4/vc4_kms.c -@@ -132,6 +132,7 @@ static int vc4_atomic_commit(struct drm_device *dev, - struct drm_gem_cma_object *cma_bo = - drm_fb_cma_get_gem_obj(new_state->fb, 0); - struct vc4_bo *bo = to_vc4_bo(&cma_bo->base); -+ - wait_seqno = max(bo->seqno, wait_seqno); - } - } -diff --git a/drivers/gpu/drm/vc4/vc4_packet.h b/drivers/gpu/drm/vc4/vc4_packet.h -index 9757bc8..cee38aad 100644 ---- a/drivers/gpu/drm/vc4/vc4_packet.h -+++ b/drivers/gpu/drm/vc4/vc4_packet.h -@@ -27,60 +27,60 @@ - #include "vc4_regs.h" /* for VC4_MASK, VC4_GET_FIELD, VC4_SET_FIELD */ - - enum vc4_packet { -- VC4_PACKET_HALT = 0, -- VC4_PACKET_NOP = 1, -- -- VC4_PACKET_FLUSH = 4, -- VC4_PACKET_FLUSH_ALL = 5, -- VC4_PACKET_START_TILE_BINNING = 6, -- VC4_PACKET_INCREMENT_SEMAPHORE = 7, -- VC4_PACKET_WAIT_ON_SEMAPHORE = 8, -- -- VC4_PACKET_BRANCH = 16, -- VC4_PACKET_BRANCH_TO_SUB_LIST = 17, -- -- VC4_PACKET_STORE_MS_TILE_BUFFER = 24, -- VC4_PACKET_STORE_MS_TILE_BUFFER_AND_EOF = 25, -- VC4_PACKET_STORE_FULL_RES_TILE_BUFFER = 26, -- VC4_PACKET_LOAD_FULL_RES_TILE_BUFFER = 27, -- VC4_PACKET_STORE_TILE_BUFFER_GENERAL = 28, -- VC4_PACKET_LOAD_TILE_BUFFER_GENERAL = 29, -- -- VC4_PACKET_GL_INDEXED_PRIMITIVE = 32, -- VC4_PACKET_GL_ARRAY_PRIMITIVE = 33, -- -- VC4_PACKET_COMPRESSED_PRIMITIVE = 48, -- VC4_PACKET_CLIPPED_COMPRESSED_PRIMITIVE = 49, -- -- VC4_PACKET_PRIMITIVE_LIST_FORMAT = 56, -- -- VC4_PACKET_GL_SHADER_STATE = 64, -- VC4_PACKET_NV_SHADER_STATE = 65, -- VC4_PACKET_VG_SHADER_STATE = 66, -- -- VC4_PACKET_CONFIGURATION_BITS = 96, -- VC4_PACKET_FLAT_SHADE_FLAGS = 97, -- VC4_PACKET_POINT_SIZE = 98, -- VC4_PACKET_LINE_WIDTH = 99, -- VC4_PACKET_RHT_X_BOUNDARY = 100, -- VC4_PACKET_DEPTH_OFFSET = 101, -- VC4_PACKET_CLIP_WINDOW = 102, -- VC4_PACKET_VIEWPORT_OFFSET = 103, -- VC4_PACKET_Z_CLIPPING = 104, -- VC4_PACKET_CLIPPER_XY_SCALING = 105, -- VC4_PACKET_CLIPPER_Z_SCALING = 106, -- -- VC4_PACKET_TILE_BINNING_MODE_CONFIG = 112, -- VC4_PACKET_TILE_RENDERING_MODE_CONFIG = 113, -- VC4_PACKET_CLEAR_COLORS = 114, -- VC4_PACKET_TILE_COORDINATES = 115, -- -- /* Not an actual hardware packet -- this is what we use to put -- * references to GEM bos in the command stream, since we need the u32 -- * int the actual address packet in order to store the offset from the -- * start of the BO. -- */ -- VC4_PACKET_GEM_HANDLES = 254, -+ VC4_PACKET_HALT = 0, -+ VC4_PACKET_NOP = 1, -+ -+ VC4_PACKET_FLUSH = 4, -+ VC4_PACKET_FLUSH_ALL = 5, -+ VC4_PACKET_START_TILE_BINNING = 6, -+ VC4_PACKET_INCREMENT_SEMAPHORE = 7, -+ VC4_PACKET_WAIT_ON_SEMAPHORE = 8, -+ -+ VC4_PACKET_BRANCH = 16, -+ VC4_PACKET_BRANCH_TO_SUB_LIST = 17, -+ -+ VC4_PACKET_STORE_MS_TILE_BUFFER = 24, -+ VC4_PACKET_STORE_MS_TILE_BUFFER_AND_EOF = 25, -+ VC4_PACKET_STORE_FULL_RES_TILE_BUFFER = 26, -+ VC4_PACKET_LOAD_FULL_RES_TILE_BUFFER = 27, -+ VC4_PACKET_STORE_TILE_BUFFER_GENERAL = 28, -+ VC4_PACKET_LOAD_TILE_BUFFER_GENERAL = 29, -+ -+ VC4_PACKET_GL_INDEXED_PRIMITIVE = 32, -+ VC4_PACKET_GL_ARRAY_PRIMITIVE = 33, -+ -+ VC4_PACKET_COMPRESSED_PRIMITIVE = 48, -+ VC4_PACKET_CLIPPED_COMPRESSED_PRIMITIVE = 49, -+ -+ VC4_PACKET_PRIMITIVE_LIST_FORMAT = 56, -+ -+ VC4_PACKET_GL_SHADER_STATE = 64, -+ VC4_PACKET_NV_SHADER_STATE = 65, -+ VC4_PACKET_VG_SHADER_STATE = 66, -+ -+ VC4_PACKET_CONFIGURATION_BITS = 96, -+ VC4_PACKET_FLAT_SHADE_FLAGS = 97, -+ VC4_PACKET_POINT_SIZE = 98, -+ VC4_PACKET_LINE_WIDTH = 99, -+ VC4_PACKET_RHT_X_BOUNDARY = 100, -+ VC4_PACKET_DEPTH_OFFSET = 101, -+ VC4_PACKET_CLIP_WINDOW = 102, -+ VC4_PACKET_VIEWPORT_OFFSET = 103, -+ VC4_PACKET_Z_CLIPPING = 104, -+ VC4_PACKET_CLIPPER_XY_SCALING = 105, -+ VC4_PACKET_CLIPPER_Z_SCALING = 106, -+ -+ VC4_PACKET_TILE_BINNING_MODE_CONFIG = 112, -+ VC4_PACKET_TILE_RENDERING_MODE_CONFIG = 113, -+ VC4_PACKET_CLEAR_COLORS = 114, -+ VC4_PACKET_TILE_COORDINATES = 115, -+ -+ /* Not an actual hardware packet -- this is what we use to put -+ * references to GEM bos in the command stream, since we need the u32 -+ * int the actual address packet in order to store the offset from the -+ * start of the BO. -+ */ -+ VC4_PACKET_GEM_HANDLES = 254, - } __attribute__ ((__packed__)); - - #define VC4_PACKET_HALT_SIZE 1 -@@ -148,10 +148,10 @@ enum vc4_packet { - * VC4_PACKET_LOAD_TILE_BUFFER_GENERAL (low bits of the address) - */ - --#define VC4_LOADSTORE_TILE_BUFFER_EOF (1 << 3) --#define VC4_LOADSTORE_TILE_BUFFER_DISABLE_FULL_VG_MASK (1 << 2) --#define VC4_LOADSTORE_TILE_BUFFER_DISABLE_FULL_ZS (1 << 1) --#define VC4_LOADSTORE_TILE_BUFFER_DISABLE_FULL_COLOR (1 << 0) -+#define VC4_LOADSTORE_TILE_BUFFER_EOF BIT(3) -+#define VC4_LOADSTORE_TILE_BUFFER_DISABLE_FULL_VG_MASK BIT(2) -+#define VC4_LOADSTORE_TILE_BUFFER_DISABLE_FULL_ZS BIT(1) -+#define VC4_LOADSTORE_TILE_BUFFER_DISABLE_FULL_COLOR BIT(0) - - /** @} */ - -@@ -160,10 +160,10 @@ enum vc4_packet { - * byte 0-1 of VC4_PACKET_STORE_TILE_BUFFER_GENERAL and - * VC4_PACKET_LOAD_TILE_BUFFER_GENERAL - */ --#define VC4_STORE_TILE_BUFFER_DISABLE_VG_MASK_CLEAR (1 << 15) --#define VC4_STORE_TILE_BUFFER_DISABLE_ZS_CLEAR (1 << 14) --#define VC4_STORE_TILE_BUFFER_DISABLE_COLOR_CLEAR (1 << 13) --#define VC4_STORE_TILE_BUFFER_DISABLE_SWAP (1 << 12) -+#define VC4_STORE_TILE_BUFFER_DISABLE_VG_MASK_CLEAR BIT(15) -+#define VC4_STORE_TILE_BUFFER_DISABLE_ZS_CLEAR BIT(14) -+#define VC4_STORE_TILE_BUFFER_DISABLE_COLOR_CLEAR BIT(13) -+#define VC4_STORE_TILE_BUFFER_DISABLE_SWAP BIT(12) - - #define VC4_LOADSTORE_TILE_BUFFER_FORMAT_MASK VC4_MASK(9, 8) - #define VC4_LOADSTORE_TILE_BUFFER_FORMAT_SHIFT 8 -@@ -201,28 +201,28 @@ enum vc4_packet { - #define VC4_INDEX_BUFFER_U16 (1 << 4) - - /* This flag is only present in NV shader state. */ --#define VC4_SHADER_FLAG_SHADED_CLIP_COORDS (1 << 3) --#define VC4_SHADER_FLAG_ENABLE_CLIPPING (1 << 2) --#define VC4_SHADER_FLAG_VS_POINT_SIZE (1 << 1) --#define VC4_SHADER_FLAG_FS_SINGLE_THREAD (1 << 0) -+#define VC4_SHADER_FLAG_SHADED_CLIP_COORDS BIT(3) -+#define VC4_SHADER_FLAG_ENABLE_CLIPPING BIT(2) -+#define VC4_SHADER_FLAG_VS_POINT_SIZE BIT(1) -+#define VC4_SHADER_FLAG_FS_SINGLE_THREAD BIT(0) - - /** @{ byte 2 of config bits. */ --#define VC4_CONFIG_BITS_EARLY_Z_UPDATE (1 << 1) --#define VC4_CONFIG_BITS_EARLY_Z (1 << 0) -+#define VC4_CONFIG_BITS_EARLY_Z_UPDATE BIT(1) -+#define VC4_CONFIG_BITS_EARLY_Z BIT(0) - /** @} */ - - /** @{ byte 1 of config bits. */ --#define VC4_CONFIG_BITS_Z_UPDATE (1 << 7) -+#define VC4_CONFIG_BITS_Z_UPDATE BIT(7) - /** same values in this 3-bit field as PIPE_FUNC_* */ - #define VC4_CONFIG_BITS_DEPTH_FUNC_SHIFT 4 --#define VC4_CONFIG_BITS_COVERAGE_READ_LEAVE (1 << 3) -+#define VC4_CONFIG_BITS_COVERAGE_READ_LEAVE BIT(3) - - #define VC4_CONFIG_BITS_COVERAGE_UPDATE_NONZERO (0 << 1) - #define VC4_CONFIG_BITS_COVERAGE_UPDATE_ODD (1 << 1) - #define VC4_CONFIG_BITS_COVERAGE_UPDATE_OR (2 << 1) - #define VC4_CONFIG_BITS_COVERAGE_UPDATE_ZERO (3 << 1) - --#define VC4_CONFIG_BITS_COVERAGE_PIPE_SELECT (1 << 0) -+#define VC4_CONFIG_BITS_COVERAGE_PIPE_SELECT BIT(0) - /** @} */ - - /** @{ byte 0 of config bits. */ -@@ -230,15 +230,15 @@ enum vc4_packet { - #define VC4_CONFIG_BITS_RASTERIZER_OVERSAMPLE_4X (1 << 6) - #define VC4_CONFIG_BITS_RASTERIZER_OVERSAMPLE_16X (2 << 6) - --#define VC4_CONFIG_BITS_AA_POINTS_AND_LINES (1 << 4) --#define VC4_CONFIG_BITS_ENABLE_DEPTH_OFFSET (1 << 3) --#define VC4_CONFIG_BITS_CW_PRIMITIVES (1 << 2) --#define VC4_CONFIG_BITS_ENABLE_PRIM_BACK (1 << 1) --#define VC4_CONFIG_BITS_ENABLE_PRIM_FRONT (1 << 0) -+#define VC4_CONFIG_BITS_AA_POINTS_AND_LINES BIT(4) -+#define VC4_CONFIG_BITS_ENABLE_DEPTH_OFFSET BIT(3) -+#define VC4_CONFIG_BITS_CW_PRIMITIVES BIT(2) -+#define VC4_CONFIG_BITS_ENABLE_PRIM_BACK BIT(1) -+#define VC4_CONFIG_BITS_ENABLE_PRIM_FRONT BIT(0) - /** @} */ - - /** @{ bits in the last u8 of VC4_PACKET_TILE_BINNING_MODE_CONFIG */ --#define VC4_BIN_CONFIG_DB_NON_MS (1 << 7) -+#define VC4_BIN_CONFIG_DB_NON_MS BIT(7) - - #define VC4_BIN_CONFIG_ALLOC_BLOCK_SIZE_MASK VC4_MASK(6, 5) - #define VC4_BIN_CONFIG_ALLOC_BLOCK_SIZE_SHIFT 5 -@@ -254,17 +254,17 @@ enum vc4_packet { - #define VC4_BIN_CONFIG_ALLOC_INIT_BLOCK_SIZE_128 2 - #define VC4_BIN_CONFIG_ALLOC_INIT_BLOCK_SIZE_256 3 - --#define VC4_BIN_CONFIG_AUTO_INIT_TSDA (1 << 2) --#define VC4_BIN_CONFIG_TILE_BUFFER_64BIT (1 << 1) --#define VC4_BIN_CONFIG_MS_MODE_4X (1 << 0) -+#define VC4_BIN_CONFIG_AUTO_INIT_TSDA BIT(2) -+#define VC4_BIN_CONFIG_TILE_BUFFER_64BIT BIT(1) -+#define VC4_BIN_CONFIG_MS_MODE_4X BIT(0) - /** @} */ - - /** @{ bits in the last u16 of VC4_PACKET_TILE_RENDERING_MODE_CONFIG */ --#define VC4_RENDER_CONFIG_DB_NON_MS (1 << 12) --#define VC4_RENDER_CONFIG_EARLY_Z_COVERAGE_DISABLE (1 << 11) --#define VC4_RENDER_CONFIG_EARLY_Z_DIRECTION_G (1 << 10) --#define VC4_RENDER_CONFIG_COVERAGE_MODE (1 << 9) --#define VC4_RENDER_CONFIG_ENABLE_VG_MASK (1 << 8) -+#define VC4_RENDER_CONFIG_DB_NON_MS BIT(12) -+#define VC4_RENDER_CONFIG_EARLY_Z_COVERAGE_DISABLE BIT(11) -+#define VC4_RENDER_CONFIG_EARLY_Z_DIRECTION_G BIT(10) -+#define VC4_RENDER_CONFIG_COVERAGE_MODE BIT(9) -+#define VC4_RENDER_CONFIG_ENABLE_VG_MASK BIT(8) - - /** The values of the field are VC4_TILING_FORMAT_* */ - #define VC4_RENDER_CONFIG_MEMORY_FORMAT_MASK VC4_MASK(7, 6) -@@ -280,8 +280,8 @@ enum vc4_packet { - #define VC4_RENDER_CONFIG_FORMAT_RGBA8888 1 - #define VC4_RENDER_CONFIG_FORMAT_BGR565 2 - --#define VC4_RENDER_CONFIG_TILE_BUFFER_64BIT (1 << 1) --#define VC4_RENDER_CONFIG_MS_MODE_4X (1 << 0) -+#define VC4_RENDER_CONFIG_TILE_BUFFER_64BIT BIT(1) -+#define VC4_RENDER_CONFIG_MS_MODE_4X BIT(0) - - #define VC4_PRIMITIVE_LIST_FORMAT_16_INDEX (1 << 4) - #define VC4_PRIMITIVE_LIST_FORMAT_32_XY (3 << 4) -@@ -291,24 +291,24 @@ enum vc4_packet { - #define VC4_PRIMITIVE_LIST_FORMAT_TYPE_RHT (3 << 0) - - enum vc4_texture_data_type { -- VC4_TEXTURE_TYPE_RGBA8888 = 0, -- VC4_TEXTURE_TYPE_RGBX8888 = 1, -- VC4_TEXTURE_TYPE_RGBA4444 = 2, -- VC4_TEXTURE_TYPE_RGBA5551 = 3, -- VC4_TEXTURE_TYPE_RGB565 = 4, -- VC4_TEXTURE_TYPE_LUMINANCE = 5, -- VC4_TEXTURE_TYPE_ALPHA = 6, -- VC4_TEXTURE_TYPE_LUMALPHA = 7, -- VC4_TEXTURE_TYPE_ETC1 = 8, -- VC4_TEXTURE_TYPE_S16F = 9, -- VC4_TEXTURE_TYPE_S8 = 10, -- VC4_TEXTURE_TYPE_S16 = 11, -- VC4_TEXTURE_TYPE_BW1 = 12, -- VC4_TEXTURE_TYPE_A4 = 13, -- VC4_TEXTURE_TYPE_A1 = 14, -- VC4_TEXTURE_TYPE_RGBA64 = 15, -- VC4_TEXTURE_TYPE_RGBA32R = 16, -- VC4_TEXTURE_TYPE_YUV422R = 17, -+ VC4_TEXTURE_TYPE_RGBA8888 = 0, -+ VC4_TEXTURE_TYPE_RGBX8888 = 1, -+ VC4_TEXTURE_TYPE_RGBA4444 = 2, -+ VC4_TEXTURE_TYPE_RGBA5551 = 3, -+ VC4_TEXTURE_TYPE_RGB565 = 4, -+ VC4_TEXTURE_TYPE_LUMINANCE = 5, -+ VC4_TEXTURE_TYPE_ALPHA = 6, -+ VC4_TEXTURE_TYPE_LUMALPHA = 7, -+ VC4_TEXTURE_TYPE_ETC1 = 8, -+ VC4_TEXTURE_TYPE_S16F = 9, -+ VC4_TEXTURE_TYPE_S8 = 10, -+ VC4_TEXTURE_TYPE_S16 = 11, -+ VC4_TEXTURE_TYPE_BW1 = 12, -+ VC4_TEXTURE_TYPE_A4 = 13, -+ VC4_TEXTURE_TYPE_A1 = 14, -+ VC4_TEXTURE_TYPE_RGBA64 = 15, -+ VC4_TEXTURE_TYPE_RGBA32R = 16, -+ VC4_TEXTURE_TYPE_YUV422R = 17, - }; - - #define VC4_TEX_P0_OFFSET_MASK VC4_MASK(31, 12) -diff --git a/drivers/gpu/drm/vc4/vc4_qpu_defines.h b/drivers/gpu/drm/vc4/vc4_qpu_defines.h -index e47c994..d5c2f3c 100644 ---- a/drivers/gpu/drm/vc4/vc4_qpu_defines.h -+++ b/drivers/gpu/drm/vc4/vc4_qpu_defines.h -@@ -25,194 +25,190 @@ - #define VC4_QPU_DEFINES_H - - enum qpu_op_add { -- QPU_A_NOP, -- QPU_A_FADD, -- QPU_A_FSUB, -- QPU_A_FMIN, -- QPU_A_FMAX, -- QPU_A_FMINABS, -- QPU_A_FMAXABS, -- QPU_A_FTOI, -- QPU_A_ITOF, -- QPU_A_ADD = 12, -- QPU_A_SUB, -- QPU_A_SHR, -- QPU_A_ASR, -- QPU_A_ROR, -- QPU_A_SHL, -- QPU_A_MIN, -- QPU_A_MAX, -- QPU_A_AND, -- QPU_A_OR, -- QPU_A_XOR, -- QPU_A_NOT, -- QPU_A_CLZ, -- QPU_A_V8ADDS = 30, -- QPU_A_V8SUBS = 31, -+ QPU_A_NOP, -+ QPU_A_FADD, -+ QPU_A_FSUB, -+ QPU_A_FMIN, -+ QPU_A_FMAX, -+ QPU_A_FMINABS, -+ QPU_A_FMAXABS, -+ QPU_A_FTOI, -+ QPU_A_ITOF, -+ QPU_A_ADD = 12, -+ QPU_A_SUB, -+ QPU_A_SHR, -+ QPU_A_ASR, -+ QPU_A_ROR, -+ QPU_A_SHL, -+ QPU_A_MIN, -+ QPU_A_MAX, -+ QPU_A_AND, -+ QPU_A_OR, -+ QPU_A_XOR, -+ QPU_A_NOT, -+ QPU_A_CLZ, -+ QPU_A_V8ADDS = 30, -+ QPU_A_V8SUBS = 31, - }; - - enum qpu_op_mul { -- QPU_M_NOP, -- QPU_M_FMUL, -- QPU_M_MUL24, -- QPU_M_V8MULD, -- QPU_M_V8MIN, -- QPU_M_V8MAX, -- QPU_M_V8ADDS, -- QPU_M_V8SUBS, -+ QPU_M_NOP, -+ QPU_M_FMUL, -+ QPU_M_MUL24, -+ QPU_M_V8MULD, -+ QPU_M_V8MIN, -+ QPU_M_V8MAX, -+ QPU_M_V8ADDS, -+ QPU_M_V8SUBS, - }; - - enum qpu_raddr { -- QPU_R_FRAG_PAYLOAD_ZW = 15, /* W for A file, Z for B file */ -- /* 0-31 are the plain regfile a or b fields */ -- QPU_R_UNIF = 32, -- QPU_R_VARY = 35, -- QPU_R_ELEM_QPU = 38, -- QPU_R_NOP, -- QPU_R_XY_PIXEL_COORD = 41, -- QPU_R_MS_REV_FLAGS = 41, -- QPU_R_VPM = 48, -- QPU_R_VPM_LD_BUSY, -- QPU_R_VPM_LD_WAIT, -- QPU_R_MUTEX_ACQUIRE, -+ QPU_R_FRAG_PAYLOAD_ZW = 15, /* W for A file, Z for B file */ -+ /* 0-31 are the plain regfile a or b fields */ -+ QPU_R_UNIF = 32, -+ QPU_R_VARY = 35, -+ QPU_R_ELEM_QPU = 38, -+ QPU_R_NOP, -+ QPU_R_XY_PIXEL_COORD = 41, -+ QPU_R_MS_REV_FLAGS = 41, -+ QPU_R_VPM = 48, -+ QPU_R_VPM_LD_BUSY, -+ QPU_R_VPM_LD_WAIT, -+ QPU_R_MUTEX_ACQUIRE, - }; - - enum qpu_waddr { -- /* 0-31 are the plain regfile a or b fields */ -- QPU_W_ACC0 = 32, /* aka r0 */ -- QPU_W_ACC1, -- QPU_W_ACC2, -- QPU_W_ACC3, -- QPU_W_TMU_NOSWAP, -- QPU_W_ACC5, -- QPU_W_HOST_INT, -- QPU_W_NOP, -- QPU_W_UNIFORMS_ADDRESS, -- QPU_W_QUAD_XY, /* X for regfile a, Y for regfile b */ -- QPU_W_MS_FLAGS = 42, -- QPU_W_REV_FLAG = 42, -- QPU_W_TLB_STENCIL_SETUP = 43, -- QPU_W_TLB_Z, -- QPU_W_TLB_COLOR_MS, -- QPU_W_TLB_COLOR_ALL, -- QPU_W_TLB_ALPHA_MASK, -- QPU_W_VPM, -- QPU_W_VPMVCD_SETUP, /* LD for regfile a, ST for regfile b */ -- QPU_W_VPM_ADDR, /* LD for regfile a, ST for regfile b */ -- QPU_W_MUTEX_RELEASE, -- QPU_W_SFU_RECIP, -- QPU_W_SFU_RECIPSQRT, -- QPU_W_SFU_EXP, -- QPU_W_SFU_LOG, -- QPU_W_TMU0_S, -- QPU_W_TMU0_T, -- QPU_W_TMU0_R, -- QPU_W_TMU0_B, -- QPU_W_TMU1_S, -- QPU_W_TMU1_T, -- QPU_W_TMU1_R, -- QPU_W_TMU1_B, -+ /* 0-31 are the plain regfile a or b fields */ -+ QPU_W_ACC0 = 32, /* aka r0 */ -+ QPU_W_ACC1, -+ QPU_W_ACC2, -+ QPU_W_ACC3, -+ QPU_W_TMU_NOSWAP, -+ QPU_W_ACC5, -+ QPU_W_HOST_INT, -+ QPU_W_NOP, -+ QPU_W_UNIFORMS_ADDRESS, -+ QPU_W_QUAD_XY, /* X for regfile a, Y for regfile b */ -+ QPU_W_MS_FLAGS = 42, -+ QPU_W_REV_FLAG = 42, -+ QPU_W_TLB_STENCIL_SETUP = 43, -+ QPU_W_TLB_Z, -+ QPU_W_TLB_COLOR_MS, -+ QPU_W_TLB_COLOR_ALL, -+ QPU_W_TLB_ALPHA_MASK, -+ QPU_W_VPM, -+ QPU_W_VPMVCD_SETUP, /* LD for regfile a, ST for regfile b */ -+ QPU_W_VPM_ADDR, /* LD for regfile a, ST for regfile b */ -+ QPU_W_MUTEX_RELEASE, -+ QPU_W_SFU_RECIP, -+ QPU_W_SFU_RECIPSQRT, -+ QPU_W_SFU_EXP, -+ QPU_W_SFU_LOG, -+ QPU_W_TMU0_S, -+ QPU_W_TMU0_T, -+ QPU_W_TMU0_R, -+ QPU_W_TMU0_B, -+ QPU_W_TMU1_S, -+ QPU_W_TMU1_T, -+ QPU_W_TMU1_R, -+ QPU_W_TMU1_B, - }; - - enum qpu_sig_bits { -- QPU_SIG_SW_BREAKPOINT, -- QPU_SIG_NONE, -- QPU_SIG_THREAD_SWITCH, -- QPU_SIG_PROG_END, -- QPU_SIG_WAIT_FOR_SCOREBOARD, -- QPU_SIG_SCOREBOARD_UNLOCK, -- QPU_SIG_LAST_THREAD_SWITCH, -- QPU_SIG_COVERAGE_LOAD, -- QPU_SIG_COLOR_LOAD, -- QPU_SIG_COLOR_LOAD_END, -- QPU_SIG_LOAD_TMU0, -- QPU_SIG_LOAD_TMU1, -- QPU_SIG_ALPHA_MASK_LOAD, -- QPU_SIG_SMALL_IMM, -- QPU_SIG_LOAD_IMM, -- QPU_SIG_BRANCH -+ QPU_SIG_SW_BREAKPOINT, -+ QPU_SIG_NONE, -+ QPU_SIG_THREAD_SWITCH, -+ QPU_SIG_PROG_END, -+ QPU_SIG_WAIT_FOR_SCOREBOARD, -+ QPU_SIG_SCOREBOARD_UNLOCK, -+ QPU_SIG_LAST_THREAD_SWITCH, -+ QPU_SIG_COVERAGE_LOAD, -+ QPU_SIG_COLOR_LOAD, -+ QPU_SIG_COLOR_LOAD_END, -+ QPU_SIG_LOAD_TMU0, -+ QPU_SIG_LOAD_TMU1, -+ QPU_SIG_ALPHA_MASK_LOAD, -+ QPU_SIG_SMALL_IMM, -+ QPU_SIG_LOAD_IMM, -+ QPU_SIG_BRANCH - }; - - enum qpu_mux { -- /* hardware mux values */ -- QPU_MUX_R0, -- QPU_MUX_R1, -- QPU_MUX_R2, -- QPU_MUX_R3, -- QPU_MUX_R4, -- QPU_MUX_R5, -- QPU_MUX_A, -- QPU_MUX_B, -+ /* hardware mux values */ -+ QPU_MUX_R0, -+ QPU_MUX_R1, -+ QPU_MUX_R2, -+ QPU_MUX_R3, -+ QPU_MUX_R4, -+ QPU_MUX_R5, -+ QPU_MUX_A, -+ QPU_MUX_B, - -- /* non-hardware mux values */ -- QPU_MUX_IMM, -+ /* non-hardware mux values */ -+ QPU_MUX_IMM, - }; - - enum qpu_cond { -- QPU_COND_NEVER, -- QPU_COND_ALWAYS, -- QPU_COND_ZS, -- QPU_COND_ZC, -- QPU_COND_NS, -- QPU_COND_NC, -- QPU_COND_CS, -- QPU_COND_CC, -+ QPU_COND_NEVER, -+ QPU_COND_ALWAYS, -+ QPU_COND_ZS, -+ QPU_COND_ZC, -+ QPU_COND_NS, -+ QPU_COND_NC, -+ QPU_COND_CS, -+ QPU_COND_CC, - }; - - enum qpu_pack_mul { -- QPU_PACK_MUL_NOP, -- QPU_PACK_MUL_8888 = 3, /* replicated to each 8 bits of the 32-bit dst. */ -- QPU_PACK_MUL_8A, -- QPU_PACK_MUL_8B, -- QPU_PACK_MUL_8C, -- QPU_PACK_MUL_8D, -+ QPU_PACK_MUL_NOP, -+ /* replicated to each 8 bits of the 32-bit dst. */ -+ QPU_PACK_MUL_8888 = 3, -+ QPU_PACK_MUL_8A, -+ QPU_PACK_MUL_8B, -+ QPU_PACK_MUL_8C, -+ QPU_PACK_MUL_8D, - }; - - enum qpu_pack_a { -- QPU_PACK_A_NOP, -- /* convert to 16 bit float if float input, or to int16. */ -- QPU_PACK_A_16A, -- QPU_PACK_A_16B, -- /* replicated to each 8 bits of the 32-bit dst. */ -- QPU_PACK_A_8888, -- /* Convert to 8-bit unsigned int. */ -- QPU_PACK_A_8A, -- QPU_PACK_A_8B, -- QPU_PACK_A_8C, -- QPU_PACK_A_8D, -+ QPU_PACK_A_NOP, -+ /* convert to 16 bit float if float input, or to int16. */ -+ QPU_PACK_A_16A, -+ QPU_PACK_A_16B, -+ /* replicated to each 8 bits of the 32-bit dst. */ -+ QPU_PACK_A_8888, -+ /* Convert to 8-bit unsigned int. */ -+ QPU_PACK_A_8A, -+ QPU_PACK_A_8B, -+ QPU_PACK_A_8C, -+ QPU_PACK_A_8D, - -- /* Saturating variants of the previous instructions. */ -- QPU_PACK_A_32_SAT, /* int-only */ -- QPU_PACK_A_16A_SAT, /* int or float */ -- QPU_PACK_A_16B_SAT, -- QPU_PACK_A_8888_SAT, -- QPU_PACK_A_8A_SAT, -- QPU_PACK_A_8B_SAT, -- QPU_PACK_A_8C_SAT, -- QPU_PACK_A_8D_SAT, -+ /* Saturating variants of the previous instructions. */ -+ QPU_PACK_A_32_SAT, /* int-only */ -+ QPU_PACK_A_16A_SAT, /* int or float */ -+ QPU_PACK_A_16B_SAT, -+ QPU_PACK_A_8888_SAT, -+ QPU_PACK_A_8A_SAT, -+ QPU_PACK_A_8B_SAT, -+ QPU_PACK_A_8C_SAT, -+ QPU_PACK_A_8D_SAT, - }; - - enum qpu_unpack_r4 { -- QPU_UNPACK_R4_NOP, -- QPU_UNPACK_R4_F16A_TO_F32, -- QPU_UNPACK_R4_F16B_TO_F32, -- QPU_UNPACK_R4_8D_REP, -- QPU_UNPACK_R4_8A, -- QPU_UNPACK_R4_8B, -- QPU_UNPACK_R4_8C, -- QPU_UNPACK_R4_8D, -+ QPU_UNPACK_R4_NOP, -+ QPU_UNPACK_R4_F16A_TO_F32, -+ QPU_UNPACK_R4_F16B_TO_F32, -+ QPU_UNPACK_R4_8D_REP, -+ QPU_UNPACK_R4_8A, -+ QPU_UNPACK_R4_8B, -+ QPU_UNPACK_R4_8C, -+ QPU_UNPACK_R4_8D, - }; - --#define QPU_MASK(high, low) ((((uint64_t)1<<((high)-(low)+1))-1)<<(low)) --/* Using the GNU statement expression extension */ --#define QPU_SET_FIELD(value, field) \ -- ({ \ -- uint64_t fieldval = (uint64_t)(value) << field ## _SHIFT; \ -- assert((fieldval & ~ field ## _MASK) == 0); \ -- fieldval & field ## _MASK; \ -- }) -+#define QPU_MASK(high, low) \ -+ ((((uint64_t)1 << ((high) - (low) + 1)) - 1) << (low)) - --#define QPU_GET_FIELD(word, field) ((uint32_t)(((word) & field ## _MASK) >> field ## _SHIFT)) -+#define QPU_GET_FIELD(word, field) \ -+ ((uint32_t)(((word) & field ## _MASK) >> field ## _SHIFT)) - - #define QPU_SIG_SHIFT 60 - #define QPU_SIG_MASK QPU_MASK(63, 60) -diff --git a/drivers/gpu/drm/vc4/vc4_render_cl.c b/drivers/gpu/drm/vc4/vc4_render_cl.c -index 0ffac8d..3516354 100644 ---- a/drivers/gpu/drm/vc4/vc4_render_cl.c -+++ b/drivers/gpu/drm/vc4/vc4_render_cl.c -@@ -63,7 +63,6 @@ static inline void rcl_u32(struct vc4_rcl_setup *setup, u32 val) - setup->next_offset += 4; - } - -- - /* - * Emits a no-op STORE_TILE_BUFFER_GENERAL. - * -@@ -217,7 +216,7 @@ static int vc4_create_rcl_bo(struct drm_device *dev, struct vc4_exec_info *exec, - } - size += xtiles * ytiles * loop_body_size; - -- setup->rcl = &vc4_bo_create(dev, size)->base; -+ setup->rcl = &vc4_bo_create(dev, size, true)->base; - if (!setup->rcl) - return -ENOMEM; - list_add_tail(&to_vc4_bo(&setup->rcl->base)->unref_head, -@@ -256,6 +255,7 @@ static int vc4_create_rcl_bo(struct drm_device *dev, struct vc4_exec_info *exec, - for (x = min_x_tile; x <= max_x_tile; x++) { - bool first = (x == min_x_tile && y == min_y_tile); - bool last = (x == max_x_tile && y == max_y_tile); ++ pte_unmap_unlock(pte, ptl); ++ } ++ if (!atomic) ++ up_read(&current->mm->mmap_sem); + - emit_tile(exec, setup, x, y, first, last); - } - } -diff --git a/drivers/gpu/drm/vc4/vc4_v3d.c b/drivers/gpu/drm/vc4/vc4_v3d.c -index cf35f58..29a222f 100644 ---- a/drivers/gpu/drm/vc4/vc4_v3d.c -+++ b/drivers/gpu/drm/vc4/vc4_v3d.c -@@ -125,7 +125,7 @@ int vc4_v3d_debugfs_regs(struct seq_file *m, void *unused) - - int vc4_v3d_debugfs_ident(struct seq_file *m, void *unused) - { -- struct drm_info_node *node = (struct drm_info_node *) m->private; -+ struct drm_info_node *node = (struct drm_info_node *)m->private; - struct drm_device *dev = node->minor->dev; - struct vc4_dev *vc4 = to_vc4_dev(dev); - uint32_t ident1 = V3D_READ(V3D_IDENT1); -@@ -133,11 +133,13 @@ int vc4_v3d_debugfs_ident(struct seq_file *m, void *unused) - uint32_t tups = VC4_GET_FIELD(ident1, V3D_IDENT1_TUPS); - uint32_t qups = VC4_GET_FIELD(ident1, V3D_IDENT1_QUPS); - -- seq_printf(m, "Revision: %d\n", VC4_GET_FIELD(ident1, V3D_IDENT1_REV)); -+ seq_printf(m, "Revision: %d\n", -+ VC4_GET_FIELD(ident1, V3D_IDENT1_REV)); - seq_printf(m, "Slices: %d\n", nslc); - seq_printf(m, "TMUs: %d\n", nslc * tups); - seq_printf(m, "QPUs: %d\n", nslc * qups); -- seq_printf(m, "Semaphores: %d\n", VC4_GET_FIELD(ident1, V3D_IDENT1_NSEM)); -+ seq_printf(m, "Semaphores: %d\n", -+ VC4_GET_FIELD(ident1, V3D_IDENT1_NSEM)); - - return 0; - } -@@ -218,7 +220,7 @@ static int vc4_v3d_bind(struct device *dev, struct device *master, void *data) - } - - static void vc4_v3d_unbind(struct device *dev, struct device *master, -- void *data) -+ void *data) - { - struct drm_device *drm = dev_get_drvdata(master); - struct vc4_dev *vc4 = to_vc4_dev(drm); -diff --git a/drivers/gpu/drm/vc4/vc4_validate.c b/drivers/gpu/drm/vc4/vc4_validate.c -index ff3b62f..e44e35539 100644 ---- a/drivers/gpu/drm/vc4/vc4_validate.c -+++ b/drivers/gpu/drm/vc4/vc4_validate.c -@@ -48,7 +48,6 @@ - void *validated, \ - void *untrusted - -- - /** Return the width in pixels of a 64-byte microtile. */ - static uint32_t - utile_width(int cpp) -@@ -192,7 +191,7 @@ vc4_check_tex_size(struct vc4_exec_info *exec, struct drm_gem_cma_object *fbo, - - if (size + offset < size || - size + offset > fbo->base.size) { -- DRM_ERROR("Overflow in %dx%d (%dx%d) fbo size (%d + %d > %d)\n", -+ DRM_ERROR("Overflow in %dx%d (%dx%d) fbo size (%d + %d > %zd)\n", - width, height, - aligned_width, aligned_height, - size, offset, fbo->base.size); -@@ -278,7 +277,7 @@ validate_indexed_prim_list(VALIDATE_ARGS) - - if (offset > ib->base.size || - (ib->base.size - offset) / index_size < length) { -- DRM_ERROR("IB access overflow (%d + %d*%d > %d)\n", -+ DRM_ERROR("IB access overflow (%d + %d*%d > %zd)\n", - offset, length, index_size, ib->base.size); - return -EINVAL; - } -@@ -377,6 +376,7 @@ static int - validate_tile_binning_config(VALIDATE_ARGS) ++out: ++ return n; ++} ++ + unsigned long + arm_copy_to_user(void __user *to, const void *from, unsigned long n) { - struct drm_device *dev = exec->exec_bo->base.dev; -+ struct vc4_bo *tile_bo; - uint8_t flags; - uint32_t tile_state_size, tile_alloc_size; - uint32_t tile_count; -@@ -438,12 +438,12 @@ validate_tile_binning_config(VALIDATE_ARGS) - */ - tile_alloc_size += 1024 * 1024; - -- exec->tile_bo = &vc4_bo_create(dev, exec->tile_alloc_offset + -- tile_alloc_size)->base; -+ tile_bo = vc4_bo_create(dev, exec->tile_alloc_offset + tile_alloc_size, -+ true); -+ exec->tile_bo = &tile_bo->base; - if (!exec->tile_bo) - return -ENOMEM; -- list_add_tail(&to_vc4_bo(&exec->tile_bo->base)->unref_head, -- &exec->unref_list); -+ list_add_tail(&tile_bo->unref_head, &exec->unref_list); - - /* tile alloc address. */ - *(uint32_t *)(validated + 0) = (exec->tile_bo->paddr + -@@ -463,8 +463,8 @@ validate_gem_handles(VALIDATE_ARGS) - return 0; - } - --#define VC4_DEFINE_PACKET(packet, name, func) \ -- [packet] = { packet ## _SIZE, name, func } -+#define VC4_DEFINE_PACKET(packet, func) \ -+ [packet] = { packet ## _SIZE, #packet, func } - - static const struct cmd_info { - uint16_t len; -@@ -472,42 +472,43 @@ static const struct cmd_info { - int (*func)(struct vc4_exec_info *exec, void *validated, - void *untrusted); - } cmd_info[] = { -- VC4_DEFINE_PACKET(VC4_PACKET_HALT, "halt", NULL), -- VC4_DEFINE_PACKET(VC4_PACKET_NOP, "nop", NULL), -- VC4_DEFINE_PACKET(VC4_PACKET_FLUSH, "flush", NULL), -- VC4_DEFINE_PACKET(VC4_PACKET_FLUSH_ALL, "flush all state", validate_flush_all), -- VC4_DEFINE_PACKET(VC4_PACKET_START_TILE_BINNING, "start tile binning", validate_start_tile_binning), -- VC4_DEFINE_PACKET(VC4_PACKET_INCREMENT_SEMAPHORE, "increment semaphore", validate_increment_semaphore), -- -- VC4_DEFINE_PACKET(VC4_PACKET_GL_INDEXED_PRIMITIVE, "Indexed Primitive List", validate_indexed_prim_list), -- -- VC4_DEFINE_PACKET(VC4_PACKET_GL_ARRAY_PRIMITIVE, "Vertex Array Primitives", validate_gl_array_primitive), -- -- /* This is only used by clipped primitives (packets 48 and 49), which -- * we don't support parsing yet. -- */ -- VC4_DEFINE_PACKET(VC4_PACKET_PRIMITIVE_LIST_FORMAT, "primitive list format", NULL), -- -- VC4_DEFINE_PACKET(VC4_PACKET_GL_SHADER_STATE, "GL Shader State", validate_gl_shader_state), -- VC4_DEFINE_PACKET(VC4_PACKET_NV_SHADER_STATE, "NV Shader State", validate_nv_shader_state), -- -- VC4_DEFINE_PACKET(VC4_PACKET_CONFIGURATION_BITS, "configuration bits", NULL), -- VC4_DEFINE_PACKET(VC4_PACKET_FLAT_SHADE_FLAGS, "flat shade flags", NULL), -- VC4_DEFINE_PACKET(VC4_PACKET_POINT_SIZE, "point size", NULL), -- VC4_DEFINE_PACKET(VC4_PACKET_LINE_WIDTH, "line width", NULL), -- VC4_DEFINE_PACKET(VC4_PACKET_RHT_X_BOUNDARY, "RHT X boundary", NULL), -- VC4_DEFINE_PACKET(VC4_PACKET_DEPTH_OFFSET, "Depth Offset", NULL), -- VC4_DEFINE_PACKET(VC4_PACKET_CLIP_WINDOW, "Clip Window", NULL), -- VC4_DEFINE_PACKET(VC4_PACKET_VIEWPORT_OFFSET, "Viewport Offset", NULL), -- VC4_DEFINE_PACKET(VC4_PACKET_CLIPPER_XY_SCALING, "Clipper XY Scaling", NULL), -+ VC4_DEFINE_PACKET(VC4_PACKET_HALT, NULL), -+ VC4_DEFINE_PACKET(VC4_PACKET_NOP, NULL), -+ VC4_DEFINE_PACKET(VC4_PACKET_FLUSH, NULL), -+ VC4_DEFINE_PACKET(VC4_PACKET_FLUSH_ALL, validate_flush_all), -+ VC4_DEFINE_PACKET(VC4_PACKET_START_TILE_BINNING, -+ validate_start_tile_binning), -+ VC4_DEFINE_PACKET(VC4_PACKET_INCREMENT_SEMAPHORE, -+ validate_increment_semaphore), -+ -+ VC4_DEFINE_PACKET(VC4_PACKET_GL_INDEXED_PRIMITIVE, -+ validate_indexed_prim_list), -+ VC4_DEFINE_PACKET(VC4_PACKET_GL_ARRAY_PRIMITIVE, -+ validate_gl_array_primitive), -+ -+ VC4_DEFINE_PACKET(VC4_PACKET_PRIMITIVE_LIST_FORMAT, NULL), -+ -+ VC4_DEFINE_PACKET(VC4_PACKET_GL_SHADER_STATE, validate_gl_shader_state), -+ VC4_DEFINE_PACKET(VC4_PACKET_NV_SHADER_STATE, validate_nv_shader_state), -+ -+ VC4_DEFINE_PACKET(VC4_PACKET_CONFIGURATION_BITS, NULL), -+ VC4_DEFINE_PACKET(VC4_PACKET_FLAT_SHADE_FLAGS, NULL), -+ VC4_DEFINE_PACKET(VC4_PACKET_POINT_SIZE, NULL), -+ VC4_DEFINE_PACKET(VC4_PACKET_LINE_WIDTH, NULL), -+ VC4_DEFINE_PACKET(VC4_PACKET_RHT_X_BOUNDARY, NULL), -+ VC4_DEFINE_PACKET(VC4_PACKET_DEPTH_OFFSET, NULL), -+ VC4_DEFINE_PACKET(VC4_PACKET_CLIP_WINDOW, NULL), -+ VC4_DEFINE_PACKET(VC4_PACKET_VIEWPORT_OFFSET, NULL), -+ VC4_DEFINE_PACKET(VC4_PACKET_CLIPPER_XY_SCALING, NULL), - /* Note: The docs say this was also 105, but it was 106 in the - * initial userland code drop. +@@ -147,7 +243,7 @@ arm_copy_to_user(void __user *to, const void *from, unsigned long n) + * With frame pointer disabled, tail call optimization kicks in + * as well making this test almost invisible. */ -- VC4_DEFINE_PACKET(VC4_PACKET_CLIPPER_Z_SCALING, "Clipper Z Scale and Offset", NULL), -+ VC4_DEFINE_PACKET(VC4_PACKET_CLIPPER_Z_SCALING, NULL), - -- VC4_DEFINE_PACKET(VC4_PACKET_TILE_BINNING_MODE_CONFIG, "tile binning configuration", validate_tile_binning_config), -+ VC4_DEFINE_PACKET(VC4_PACKET_TILE_BINNING_MODE_CONFIG, -+ validate_tile_binning_config), - -- VC4_DEFINE_PACKET(VC4_PACKET_GEM_HANDLES, "GEM handles", validate_gem_handles), -+ VC4_DEFINE_PACKET(VC4_PACKET_GEM_HANDLES, validate_gem_handles), - }; - - int -@@ -526,7 +527,7 @@ vc4_validate_bin_cl(struct drm_device *dev, - u8 cmd = *(uint8_t *)src_pkt; - const struct cmd_info *info; - -- if (cmd > ARRAY_SIZE(cmd_info)) { -+ if (cmd >= ARRAY_SIZE(cmd_info)) { - DRM_ERROR("0x%08x: packet %d out of bounds\n", - src_offset, cmd); - return -EINVAL; -@@ -539,11 +540,6 @@ vc4_validate_bin_cl(struct drm_device *dev, - return -EINVAL; - } - --#if 0 -- DRM_INFO("0x%08x: packet %d (%s) size %d processing...\n", -- src_offset, cmd, info->name, info->len); --#endif -- - if (src_offset + info->len > len) { - DRM_ERROR("0x%08x: packet %d (%s) length 0x%08x " - "exceeds bounds (0x%08x)\n", -@@ -558,8 +554,7 @@ vc4_validate_bin_cl(struct drm_device *dev, - if (info->func && info->func(exec, - dst_pkt + 1, - src_pkt + 1)) { -- DRM_ERROR("0x%08x: packet %d (%s) failed to " -- "validate\n", -+ DRM_ERROR("0x%08x: packet %d (%s) failed to validate\n", - src_offset, cmd, info->name); - return -EINVAL; - } -@@ -618,12 +613,14 @@ reloc_tex(struct vc4_exec_info *exec, - - if (sample->is_direct) { - uint32_t remaining_size = tex->base.size - p0; -+ - if (p0 > tex->base.size - 4) { - DRM_ERROR("UBO offset greater than UBO size\n"); - goto fail; - } - if (p1 > remaining_size - 4) { -- DRM_ERROR("UBO clamp would allow reads outside of UBO\n"); -+ DRM_ERROR("UBO clamp would allow reads " -+ "outside of UBO\n"); - goto fail; - } - *validated_p0 = tex->paddr + p0; -@@ -786,7 +783,7 @@ validate_shader_rec(struct drm_device *dev, - struct drm_gem_cma_object *bo[ARRAY_SIZE(gl_relocs) + 8]; - uint32_t nr_attributes = 0, nr_fixed_relocs, nr_relocs, packet_size; - int i; -- struct vc4_validated_shader_info *validated_shader; -+ struct vc4_validated_shader_info *shader; - - if (state->packet == VC4_PACKET_NV_SHADER_STATE) { - relocs = nv_relocs; -@@ -841,12 +838,12 @@ validate_shader_rec(struct drm_device *dev, - else - mode = VC4_MODE_RENDER; - -- if (!vc4_use_bo(exec, src_handles[i], mode, &bo[i])) { -+ if (!vc4_use_bo(exec, src_handles[i], mode, &bo[i])) - return false; -- } +- if (n < 64) { ++ if (n < COPY_TO_USER_THRESHOLD) { + unsigned long ua_flags = uaccess_save_and_enable(); + n = __copy_to_user_std(to, from, n); + uaccess_restore(ua_flags); +@@ -156,6 +252,26 @@ arm_copy_to_user(void __user *to, const void *from, unsigned long n) } - - for (i = 0; i < nr_fixed_relocs; i++) { -+ struct vc4_bo *vc4_bo; - uint32_t o = relocs[i].offset; - uint32_t src_offset = *(uint32_t *)(pkt_u + o); - uint32_t *texture_handles_u; -@@ -858,34 +855,34 @@ validate_shader_rec(struct drm_device *dev, - switch (relocs[i].type) { - case RELOC_CODE: - if (src_offset != 0) { -- DRM_ERROR("Shaders must be at offset 0 of " -- "the BO.\n"); -+ DRM_ERROR("Shaders must be at offset 0 " -+ "of the BO.\n"); - goto fail; - } - -- validated_shader = to_vc4_bo(&bo[i]->base)->validated_shader; -- if (!validated_shader) -+ vc4_bo = to_vc4_bo(&bo[i]->base); -+ shader = vc4_bo->validated_shader; -+ if (!shader) - goto fail; - -- if (validated_shader->uniforms_src_size > -- exec->uniforms_size) { -+ if (shader->uniforms_src_size > exec->uniforms_size) { - DRM_ERROR("Uniforms src buffer overflow\n"); - goto fail; - } - - texture_handles_u = exec->uniforms_u; - uniform_data_u = (texture_handles_u + -- validated_shader->num_texture_samples); -+ shader->num_texture_samples); - - memcpy(exec->uniforms_v, uniform_data_u, -- validated_shader->uniforms_size); -+ shader->uniforms_size); - - for (tex = 0; -- tex < validated_shader->num_texture_samples; -+ tex < shader->num_texture_samples; - tex++) { - if (!reloc_tex(exec, - uniform_data_u, -- &validated_shader->texture_samples[tex], -+ &shader->texture_samples[tex], - texture_handles_u[tex])) { - goto fail; - } -@@ -893,9 +890,9 @@ validate_shader_rec(struct drm_device *dev, - - *(uint32_t *)(pkt_v + o + 4) = exec->uniforms_p; - -- exec->uniforms_u += validated_shader->uniforms_src_size; -- exec->uniforms_v += validated_shader->uniforms_size; -- exec->uniforms_p += validated_shader->uniforms_size; -+ exec->uniforms_u += shader->uniforms_src_size; -+ exec->uniforms_v += shader->uniforms_size; -+ exec->uniforms_p += shader->uniforms_size; - - break; - -@@ -926,7 +923,8 @@ validate_shader_rec(struct drm_device *dev, - max_index = ((vbo->base.size - offset - attr_size) / - stride); - if (state->max_index > max_index) { -- DRM_ERROR("primitives use index %d out of supplied %d\n", -+ DRM_ERROR("primitives use index %d out of " -+ "supplied %d\n", - state->max_index, max_index); - return -EINVAL; - } -diff --git a/drivers/gpu/drm/vc4/vc4_validate_shaders.c b/drivers/gpu/drm/vc4/vc4_validate_shaders.c -index 0aab9d7..f67124b 100644 ---- a/drivers/gpu/drm/vc4/vc4_validate_shaders.c -+++ b/drivers/gpu/drm/vc4/vc4_validate_shaders.c -@@ -24,24 +24,16 @@ - /** - * DOC: Shader validator for VC4. - * -- * The VC4 has no IOMMU between it and system memory. So, a user with access -- * to execute shaders could escalate privilege by overwriting system memory -- * (using the VPM write address register in the general-purpose DMA mode) or -- * reading system memory it shouldn't (reading it as a texture, or uniform -- * data, or vertex data). -+ * The VC4 has no IOMMU between it and system memory, so a user with -+ * access to execute shaders could escalate privilege by overwriting -+ * system memory (using the VPM write address register in the -+ * general-purpose DMA mode) or reading system memory it shouldn't -+ * (reading it as a texture, or uniform data, or vertex data). - * -- * This walks over a shader starting from some offset within a BO, ensuring -- * that its accesses are appropriately bounded, and recording how many texture -- * accesses are made and where so that we can do relocations for them in the -+ * This walks over a shader BO, ensuring that its accesses are -+ * appropriately bounded, and recording how many texture accesses are -+ * made and where so that we can do relocations for them in the - * uniform stream. -- * -- * The kernel API has shaders stored in user-mapped BOs. The BOs will be -- * forcibly unmapped from the process before validation, and any cache of -- * validated state will be flushed if the mapping is faulted back in. -- * -- * Storing the shaders in BOs means that the validation process will be slow -- * due to uncached reads, but since shaders are long-lived and shader BOs are -- * never actually modified, this shouldn't be a problem. - */ - - #include "vc4_drv.h" -@@ -70,7 +62,6 @@ waddr_to_live_reg_index(uint32_t waddr, bool is_b) - else - return waddr; - } else if (waddr <= QPU_W_ACC3) { -- - return 64 + waddr - QPU_W_ACC0; - } else { - return ~0; -@@ -85,15 +76,14 @@ raddr_add_a_to_live_reg_index(uint64_t inst) - uint32_t raddr_a = QPU_GET_FIELD(inst, QPU_RADDR_A); - uint32_t raddr_b = QPU_GET_FIELD(inst, QPU_RADDR_B); - -- if (add_a == QPU_MUX_A) { -+ if (add_a == QPU_MUX_A) - return raddr_a; -- } else if (add_a == QPU_MUX_B && sig != QPU_SIG_SMALL_IMM) { -+ else if (add_a == QPU_MUX_B && sig != QPU_SIG_SMALL_IMM) - return 32 + raddr_b; -- } else if (add_a <= QPU_MUX_R3) { -+ else if (add_a <= QPU_MUX_R3) - return 64 + add_a; -- } else { -+ else - return ~0; -- } - } - - static bool -@@ -111,9 +101,9 @@ is_tmu_write(uint32_t waddr) - } - - static bool --record_validated_texture_sample(struct vc4_validated_shader_info *validated_shader, -- struct vc4_shader_validation_state *validation_state, -- int tmu) -+record_texture_sample(struct vc4_validated_shader_info *validated_shader, -+ struct vc4_shader_validation_state *validation_state, -+ int tmu) - { - uint32_t s = validated_shader->num_texture_samples; - int i; -@@ -226,8 +216,8 @@ check_tmu_write(uint64_t inst, - validated_shader->uniforms_size += 4; - - if (submit) { -- if (!record_validated_texture_sample(validated_shader, -- validation_state, tmu)) { -+ if (!record_texture_sample(validated_shader, -+ validation_state, tmu)) { - return false; - } - -@@ -238,10 +228,10 @@ check_tmu_write(uint64_t inst, + return n; } - - static bool --check_register_write(uint64_t inst, -- struct vc4_validated_shader_info *validated_shader, -- struct vc4_shader_validation_state *validation_state, -- bool is_mul) -+check_reg_write(uint64_t inst, -+ struct vc4_validated_shader_info *validated_shader, -+ struct vc4_shader_validation_state *validation_state, -+ bool is_mul) - { - uint32_t waddr = (is_mul ? - QPU_GET_FIELD(inst, QPU_WADDR_MUL) : -@@ -297,7 +287,7 @@ check_register_write(uint64_t inst, - return true; - - case QPU_W_TLB_STENCIL_SETUP: -- return true; -+ return true; - } - - return true; -@@ -360,7 +350,7 @@ track_live_clamps(uint64_t inst, - } - - validation_state->live_max_clamp_regs[lri_add] = true; -- } if (op_add == QPU_A_MIN) { -+ } else if (op_add == QPU_A_MIN) { - /* Track live clamps of a value clamped to a minimum of 0 and - * a maximum of some uniform's offset. - */ -@@ -392,8 +382,10 @@ check_instruction_writes(uint64_t inst, - return false; - } - -- ok = (check_register_write(inst, validated_shader, validation_state, false) && -- check_register_write(inst, validated_shader, validation_state, true)); -+ ok = (check_reg_write(inst, validated_shader, validation_state, -+ false) && -+ check_reg_write(inst, validated_shader, validation_state, -+ true)); - - track_live_clamps(inst, validated_shader, validation_state); - -@@ -441,7 +433,7 @@ vc4_validate_shader(struct drm_gem_cma_object *shader_obj) - shader = shader_obj->vaddr; - max_ip = shader_obj->base.size / sizeof(uint64_t); - -- validated_shader = kcalloc(sizeof(*validated_shader), 1, GFP_KERNEL); -+ validated_shader = kcalloc(1, sizeof(*validated_shader), GFP_KERNEL); - if (!validated_shader) - return NULL; - -@@ -497,7 +489,7 @@ vc4_validate_shader(struct drm_gem_cma_object *shader_obj) - - if (ip == max_ip) { - DRM_ERROR("shader failed to terminate before " -- "shader BO end at %d\n", -+ "shader BO end at %zd\n", - shader_obj->base.size); - goto fail; - } -diff --git a/include/drm/drmP.h b/include/drm/drmP.h -index 54f5469..987c25a 100644 ---- a/include/drm/drmP.h -+++ b/include/drm/drmP.h -@@ -585,6 +585,13 @@ struct drm_driver { - int (*gem_open_object) (struct drm_gem_object *, struct drm_file *); - void (*gem_close_object) (struct drm_gem_object *, struct drm_file *); - -+ /** -+ * Hook for allocating the GEM object struct, for use by core -+ * helpers. ++ ++unsigned long __must_check ++arm_copy_from_user(void *to, const void __user *from, unsigned long n) ++{ ++ /* ++ * This test is stubbed out of the main function above to keep ++ * the overhead for small copies low by avoiding a large ++ * register dump on the stack just to reload them right away. ++ * With frame pointer disabled, tail call optimization kicks in ++ * as well making this test almost invisible. + */ -+ struct drm_gem_object *(*gem_create_object)(struct drm_device *dev, -+ size_t size); -+ - /* prime: */ - /* export handle -> fd (see drm_gem_prime_handle_to_fd() helper) */ - int (*prime_handle_to_fd)(struct drm_device *dev, struct drm_file *file_priv, -@@ -639,7 +646,6 @@ struct drm_driver { - - u32 driver_features; - int dev_priv_size; -- size_t gem_obj_size; - const struct drm_ioctl_desc *ioctls; - int num_ioctls; - const struct file_operations *fops; - -From 7d4ed9f40e9484ded3965b13fbb7914a1daf85d7 Mon Sep 17 00:00:00 2001 -From: Eric Anholt <eric@anholt.net> -Date: Fri, 11 Dec 2015 19:45:03 -0800 -Subject: [PATCH 116/170] drm: Use the driver's gem_object_free function from - CMA helpers. ++ if (n < COPY_TO_USER_THRESHOLD) { ++ unsigned long ua_flags = uaccess_save_and_enable(); ++ n = __copy_from_user_std(to, from, n); ++ uaccess_restore(ua_flags); ++ } else { ++ n = __copy_from_user_memcpy(to, from, n); ++ } ++ return n; ++} + + static unsigned long noinline + __clear_user_memset(void __user *addr, unsigned long n) -VC4 wraps the CMA objects in its own structures, so it needs to do its -own teardown (waiting for GPU to finish, updating bo_stats tracking). -The other CMA drivers are using drm_gem_cma_free_object as their -gem_free_object, so this should be a no-op for them. +From d67c5533e1929885c312599acdf853138761f6ed Mon Sep 17 00:00:00 2001 +From: Phil Elwell <phil@raspberrypi.org> +Date: Thu, 25 Jun 2015 12:16:11 +0100 +Subject: [PATCH 080/112] gpio-poweroff: Allow it to work on Raspberry Pi -Signed-off-by: Eric Anholt <eric@anholt.net> +The Raspberry Pi firmware manages the power-down and reboot +process. To do this it installs a pm_power_off handler, causing +the gpio-poweroff module to abort the probe function. + +This patch introduces a "force" DT property that overrides that +behaviour, and also adds a DT overlay to enable and control it. + +Note that running in an active-low configuration (DT parameter +"active_low") requires a custom dt-blob.bin and probably won't +allow a reboot without switching off, so an external inversion +of the trigger signal may be preferable. --- - drivers/gpu/drm/drm_fb_cma_helper.c | 6 +++--- - drivers/gpu/drm/drm_gem_cma_helper.c | 4 ++-- - 2 files changed, 5 insertions(+), 5 deletions(-) - -diff --git a/drivers/gpu/drm/drm_fb_cma_helper.c b/drivers/gpu/drm/drm_fb_cma_helper.c -index c19a625..c1a37d3 100644 ---- a/drivers/gpu/drm/drm_fb_cma_helper.c -+++ b/drivers/gpu/drm/drm_fb_cma_helper.c -@@ -266,7 +266,7 @@ static int drm_fbdev_cma_create(struct drm_fb_helper *helper, - fbi = drm_fb_helper_alloc_fbi(helper); - if (IS_ERR(fbi)) { - ret = PTR_ERR(fbi); -- goto err_drm_gem_cma_free_object; -+ goto err_gem_free_object; - } - - fbdev_cma->fb = drm_fb_cma_alloc(dev, &mode_cmd, &obj, 1); -@@ -299,8 +299,8 @@ static int drm_fbdev_cma_create(struct drm_fb_helper *helper, - - err_fb_info_destroy: - drm_fb_helper_release_fbi(helper); --err_drm_gem_cma_free_object: -- drm_gem_cma_free_object(&obj->base); -+err_gem_free_object: -+ dev->driver->gem_free_object(&obj->base); - return ret; - } - -diff --git a/drivers/gpu/drm/drm_gem_cma_helper.c b/drivers/gpu/drm/drm_gem_cma_helper.c -index 0f7b00b..e5df53b 100644 ---- a/drivers/gpu/drm/drm_gem_cma_helper.c -+++ b/drivers/gpu/drm/drm_gem_cma_helper.c -@@ -121,7 +121,7 @@ struct drm_gem_cma_object *drm_gem_cma_create(struct drm_device *drm, - return cma_obj; - - error: -- drm_gem_cma_free_object(&cma_obj->base); -+ drm->driver->gem_free_object(&cma_obj->base); - return ERR_PTR(ret); - } - EXPORT_SYMBOL_GPL(drm_gem_cma_create); -@@ -171,7 +171,7 @@ drm_gem_cma_create_with_handle(struct drm_file *file_priv, - return cma_obj; - - err_handle_create: -- drm_gem_cma_free_object(gem_obj); -+ drm->driver->gem_free_object(gem_obj); - - return ERR_PTR(ret); - } + drivers/power/reset/gpio-poweroff.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) -From 522e6f9cc4376fe49e8b41b40e7ddb98cf385a9e Mon Sep 17 00:00:00 2001 -From: Eric Anholt <eric@anholt.net> -Date: Fri, 17 Jul 2015 13:15:50 -0700 -Subject: [PATCH 117/170] drm/vc4: Add support for MSAA rendering. +diff --git a/drivers/power/reset/gpio-poweroff.c b/drivers/power/reset/gpio-poweroff.c +index be3d81f..a030ae9 100644 +--- a/drivers/power/reset/gpio-poweroff.c ++++ b/drivers/power/reset/gpio-poweroff.c +@@ -49,9 +49,11 @@ static int gpio_poweroff_probe(struct platform_device *pdev) + { + bool input = false; + enum gpiod_flags flags; ++ bool force = false; + + /* If a pm_power_off function has already been added, leave it alone */ +- if (pm_power_off != NULL) { ++ force = of_property_read_bool(pdev->dev.of_node, "force"); ++ if (!force && (pm_power_off != NULL)) { + dev_err(&pdev->dev, + "%s: pm_power_off function already registered", + __func__); -For MSAA, you set a bit in the binner that halves the size of tiles in -each direction, so you can pack 4 samples per pixel in the tile -buffer. During rendering, you can load and store raw tile buffer -contents (to save the per-sample MSAA contents), or you can load/store -resolved tile buffer contents (loads spam the pixel value to all 4 -samples, and stores either average the 4 color samples, or store the -first sample for Z/S). +From e72f41d909aa46e9bc234f6f2a6301ef9ef23676 Mon Sep 17 00:00:00 2001 +From: Phil Elwell <pelwell@users.noreply.github.com> +Date: Tue, 14 Jul 2015 14:32:47 +0100 +Subject: [PATCH 081/112] mfd: Add Raspberry Pi Sense HAT core driver -Signed-off-by: Eric Anholt <eric@anholt.net> --- - drivers/gpu/drm/vc4/vc4_packet.h | 23 ++- - drivers/gpu/drm/vc4/vc4_render_cl.c | 274 ++++++++++++++++++++++++++++++------ - drivers/gpu/drm/vc4/vc4_validate.c | 5 +- - include/uapi/drm/vc4_drm.h | 11 +- - 4 files changed, 258 insertions(+), 55 deletions(-) - -diff --git a/drivers/gpu/drm/vc4/vc4_packet.h b/drivers/gpu/drm/vc4/vc4_packet.h -index cee38aad..0f31cc0 100644 ---- a/drivers/gpu/drm/vc4/vc4_packet.h -+++ b/drivers/gpu/drm/vc4/vc4_packet.h -@@ -123,6 +123,11 @@ enum vc4_packet { - #define VC4_PACKET_TILE_COORDINATES_SIZE 3 - #define VC4_PACKET_GEM_HANDLES_SIZE 9 - -+/* Number of multisamples supported. */ -+#define VC4_MAX_SAMPLES 4 -+/* Size of a full resolution color or Z tile buffer load/store. */ -+#define VC4_TILE_BUFFER_SIZE (64 * 64 * 4) -+ - /** @{ - * Bits used by packets like VC4_PACKET_STORE_TILE_BUFFER_GENERAL and - * VC4_PACKET_TILE_RENDERING_MODE_CONFIG. -@@ -137,10 +142,20 @@ enum vc4_packet { - * low bits of VC4_PACKET_STORE_FULL_RES_TILE_BUFFER and - * VC4_PACKET_LOAD_FULL_RES_TILE_BUFFER. - */ --#define VC4_LOADSTORE_FULL_RES_EOF (1 << 3) --#define VC4_LOADSTORE_FULL_RES_DISABLE_CLEAR_ALL (1 << 2) --#define VC4_LOADSTORE_FULL_RES_DISABLE_ZS (1 << 1) --#define VC4_LOADSTORE_FULL_RES_DISABLE_COLOR (1 << 0) -+#define VC4_LOADSTORE_FULL_RES_EOF BIT(3) -+#define VC4_LOADSTORE_FULL_RES_DISABLE_CLEAR_ALL BIT(2) -+#define VC4_LOADSTORE_FULL_RES_DISABLE_ZS BIT(1) -+#define VC4_LOADSTORE_FULL_RES_DISABLE_COLOR BIT(0) -+ -+/** @{ -+ * -+ * low bits of VC4_PACKET_STORE_FULL_RES_TILE_BUFFER and -+ * VC4_PACKET_LOAD_FULL_RES_TILE_BUFFER. -+ */ -+#define VC4_LOADSTORE_FULL_RES_EOF BIT(3) -+#define VC4_LOADSTORE_FULL_RES_DISABLE_CLEAR_ALL BIT(2) -+#define VC4_LOADSTORE_FULL_RES_DISABLE_ZS BIT(1) -+#define VC4_LOADSTORE_FULL_RES_DISABLE_COLOR BIT(0) - - /** @{ - * -diff --git a/drivers/gpu/drm/vc4/vc4_render_cl.c b/drivers/gpu/drm/vc4/vc4_render_cl.c -index 3516354..8f2ec57 100644 ---- a/drivers/gpu/drm/vc4/vc4_render_cl.c -+++ b/drivers/gpu/drm/vc4/vc4_render_cl.c -@@ -37,9 +37,11 @@ - - struct vc4_rcl_setup { - struct drm_gem_cma_object *color_read; -- struct drm_gem_cma_object *color_ms_write; -+ struct drm_gem_cma_object *color_write; - struct drm_gem_cma_object *zs_read; - struct drm_gem_cma_object *zs_write; -+ struct drm_gem_cma_object *msaa_color_write; -+ struct drm_gem_cma_object *msaa_zs_write; - - struct drm_gem_cma_object *rcl; - u32 next_offset; -@@ -82,6 +84,22 @@ static void vc4_store_before_load(struct vc4_rcl_setup *setup) - } + drivers/input/joystick/Kconfig | 8 + + drivers/input/joystick/Makefile | 1 + + drivers/input/joystick/rpisense-js.c | 153 ++++++++++++++++ + drivers/mfd/Kconfig | 8 + + drivers/mfd/Makefile | 2 + + drivers/mfd/rpisense-core.c | 157 +++++++++++++++++ + drivers/video/fbdev/Kconfig | 13 ++ + drivers/video/fbdev/Makefile | 1 + + drivers/video/fbdev/rpisense-fb.c | 293 +++++++++++++++++++++++++++++++ + include/linux/mfd/rpisense/core.h | 47 +++++ + include/linux/mfd/rpisense/framebuffer.h | 32 ++++ + include/linux/mfd/rpisense/joystick.h | 35 ++++ + 12 files changed, 750 insertions(+) + create mode 100644 drivers/input/joystick/rpisense-js.c + create mode 100644 drivers/mfd/rpisense-core.c + create mode 100644 drivers/video/fbdev/rpisense-fb.c + create mode 100644 include/linux/mfd/rpisense/core.h + create mode 100644 include/linux/mfd/rpisense/framebuffer.h + create mode 100644 include/linux/mfd/rpisense/joystick.h + +diff --git a/drivers/input/joystick/Kconfig b/drivers/input/joystick/Kconfig +index 4215b53..4364d7c 100644 +--- a/drivers/input/joystick/Kconfig ++++ b/drivers/input/joystick/Kconfig +@@ -330,4 +330,12 @@ config JOYSTICK_MAPLE + To compile this as a module choose M here: the module will be called + maplecontrol. - /* -+ * Calculates the physical address of the start of a tile in a RCL surface. ++config JOYSTICK_RPISENSE ++ tristate "Raspberry Pi Sense HAT joystick" ++ depends on GPIOLIB && INPUT ++ select MFD_RPISENSE_CORE ++ ++ help ++ This is the joystick driver for the Raspberry Pi Sense HAT ++ + endif +diff --git a/drivers/input/joystick/Makefile b/drivers/input/joystick/Makefile +index 92dc0de..1758160 100644 +--- a/drivers/input/joystick/Makefile ++++ b/drivers/input/joystick/Makefile +@@ -32,4 +32,5 @@ obj-$(CONFIG_JOYSTICK_WARRIOR) += warrior.o + obj-$(CONFIG_JOYSTICK_XPAD) += xpad.o + obj-$(CONFIG_JOYSTICK_ZHENHUA) += zhenhua.o + obj-$(CONFIG_JOYSTICK_WALKERA0701) += walkera0701.o ++obj-$(CONFIG_JOYSTICK_RPISENSE) += rpisense-js.o + +diff --git a/drivers/input/joystick/rpisense-js.c b/drivers/input/joystick/rpisense-js.c +new file mode 100644 +index 0000000..6a41676 +--- /dev/null ++++ b/drivers/input/joystick/rpisense-js.c +@@ -0,0 +1,153 @@ ++/* ++ * Raspberry Pi Sense HAT joystick driver ++ * http://raspberrypi.org ++ * ++ * Copyright (C) 2015 Raspberry Pi ++ * ++ * Author: Serge Schneider ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License as published by the ++ * Free Software Foundation; either version 2 of the License, or (at your ++ * option) any later version. + * -+ * Unlike the other load/store packets, -+ * VC4_PACKET_LOAD/STORE_FULL_RES_TILE_BUFFER don't look at the tile -+ * coordinates packet, and instead just store to the address given. + */ -+static uint32_t vc4_full_res_offset(struct vc4_exec_info *exec, -+ struct drm_gem_cma_object *bo, -+ struct drm_vc4_submit_rcl_surface *surf, -+ uint8_t x, uint8_t y) -+{ -+ return bo->paddr + surf->offset + VC4_TILE_BUFFER_SIZE * -+ (DIV_ROUND_UP(exec->args->width, 32) * y + x); -+} + -+/* - * Emits a PACKET_TILE_COORDINATES if one isn't already pending. - * - * The tile coordinates packet triggers a pending load if there is one, are -@@ -108,22 +126,41 @@ static void emit_tile(struct vc4_exec_info *exec, - * may be outstanding at a time. - */ - if (setup->color_read) { -- rcl_u8(setup, VC4_PACKET_LOAD_TILE_BUFFER_GENERAL); -- rcl_u16(setup, args->color_read.bits); -- rcl_u32(setup, -- setup->color_read->paddr + args->color_read.offset); -+ if (args->color_read.flags & -+ VC4_SUBMIT_RCL_SURFACE_READ_IS_FULL_RES) { -+ rcl_u8(setup, VC4_PACKET_LOAD_FULL_RES_TILE_BUFFER); -+ rcl_u32(setup, -+ vc4_full_res_offset(exec, setup->color_read, -+ &args->color_read, x, y) | -+ VC4_LOADSTORE_FULL_RES_DISABLE_ZS); -+ } else { -+ rcl_u8(setup, VC4_PACKET_LOAD_TILE_BUFFER_GENERAL); -+ rcl_u16(setup, args->color_read.bits); -+ rcl_u32(setup, setup->color_read->paddr + -+ args->color_read.offset); -+ } - } - - if (setup->zs_read) { -- if (setup->color_read) { -- /* Exec previous load. */ -- vc4_tile_coordinates(setup, x, y); -- vc4_store_before_load(setup); -+ if (args->zs_read.flags & -+ VC4_SUBMIT_RCL_SURFACE_READ_IS_FULL_RES) { -+ rcl_u8(setup, VC4_PACKET_LOAD_FULL_RES_TILE_BUFFER); -+ rcl_u32(setup, -+ vc4_full_res_offset(exec, setup->zs_read, -+ &args->zs_read, x, y) | -+ VC4_LOADSTORE_FULL_RES_DISABLE_COLOR); -+ } else { -+ if (setup->color_read) { -+ /* Exec previous load. */ -+ vc4_tile_coordinates(setup, x, y); -+ vc4_store_before_load(setup); -+ } ++#include <linux/module.h> + -+ rcl_u8(setup, VC4_PACKET_LOAD_TILE_BUFFER_GENERAL); -+ rcl_u16(setup, args->zs_read.bits); -+ rcl_u32(setup, setup->zs_read->paddr + -+ args->zs_read.offset); - } -- -- rcl_u8(setup, VC4_PACKET_LOAD_TILE_BUFFER_GENERAL); -- rcl_u16(setup, args->zs_read.bits); -- rcl_u32(setup, setup->zs_read->paddr + args->zs_read.offset); - } - - /* Clipping depends on tile coordinates having been -@@ -144,20 +181,60 @@ static void emit_tile(struct vc4_exec_info *exec, - (y * exec->bin_tiles_x + x) * 32)); - } - -+ if (setup->msaa_color_write) { -+ bool last_tile_write = (!setup->msaa_zs_write && -+ !setup->zs_write && -+ !setup->color_write); -+ uint32_t bits = VC4_LOADSTORE_FULL_RES_DISABLE_ZS; -+ -+ if (!last_tile_write) -+ bits |= VC4_LOADSTORE_FULL_RES_DISABLE_CLEAR_ALL; -+ else if (last) -+ bits |= VC4_LOADSTORE_FULL_RES_EOF; -+ rcl_u8(setup, VC4_PACKET_STORE_FULL_RES_TILE_BUFFER); -+ rcl_u32(setup, -+ vc4_full_res_offset(exec, setup->msaa_color_write, -+ &args->msaa_color_write, x, y) | -+ bits); -+ } -+ -+ if (setup->msaa_zs_write) { -+ bool last_tile_write = (!setup->zs_write && -+ !setup->color_write); -+ uint32_t bits = VC4_LOADSTORE_FULL_RES_DISABLE_COLOR; -+ -+ if (setup->msaa_color_write) -+ vc4_tile_coordinates(setup, x, y); -+ if (!last_tile_write) -+ bits |= VC4_LOADSTORE_FULL_RES_DISABLE_CLEAR_ALL; -+ else if (last) -+ bits |= VC4_LOADSTORE_FULL_RES_EOF; -+ rcl_u8(setup, VC4_PACKET_STORE_FULL_RES_TILE_BUFFER); -+ rcl_u32(setup, -+ vc4_full_res_offset(exec, setup->msaa_zs_write, -+ &args->msaa_zs_write, x, y) | -+ bits); -+ } -+ - if (setup->zs_write) { -+ bool last_tile_write = !setup->color_write; -+ -+ if (setup->msaa_color_write || setup->msaa_zs_write) -+ vc4_tile_coordinates(setup, x, y); -+ - rcl_u8(setup, VC4_PACKET_STORE_TILE_BUFFER_GENERAL); - rcl_u16(setup, args->zs_write.bits | -- (setup->color_ms_write ? -- VC4_STORE_TILE_BUFFER_DISABLE_COLOR_CLEAR : 0)); -+ (last_tile_write ? -+ 0 : VC4_STORE_TILE_BUFFER_DISABLE_COLOR_CLEAR)); - rcl_u32(setup, - (setup->zs_write->paddr + args->zs_write.offset) | -- ((last && !setup->color_ms_write) ? -+ ((last && last_tile_write) ? - VC4_LOADSTORE_TILE_BUFFER_EOF : 0)); - } - -- if (setup->color_ms_write) { -- if (setup->zs_write) { -- /* Reset after previous store */ -+ if (setup->color_write) { -+ if (setup->msaa_color_write || setup->msaa_zs_write || -+ setup->zs_write) { - vc4_tile_coordinates(setup, x, y); - } - -@@ -192,14 +269,26 @@ static int vc4_create_rcl_bo(struct drm_device *dev, struct vc4_exec_info *exec, - } - - if (setup->color_read) { -- loop_body_size += (VC4_PACKET_LOAD_TILE_BUFFER_GENERAL_SIZE); -+ if (args->color_read.flags & -+ VC4_SUBMIT_RCL_SURFACE_READ_IS_FULL_RES) { -+ loop_body_size += VC4_PACKET_LOAD_FULL_RES_TILE_BUFFER_SIZE; -+ } else { -+ loop_body_size += VC4_PACKET_LOAD_TILE_BUFFER_GENERAL_SIZE; -+ } - } - if (setup->zs_read) { -- if (setup->color_read) { -- loop_body_size += VC4_PACKET_TILE_COORDINATES_SIZE; -- loop_body_size += VC4_PACKET_STORE_TILE_BUFFER_GENERAL_SIZE; -+ if (args->zs_read.flags & -+ VC4_SUBMIT_RCL_SURFACE_READ_IS_FULL_RES) { -+ loop_body_size += VC4_PACKET_LOAD_FULL_RES_TILE_BUFFER_SIZE; -+ } else { -+ if (setup->color_read && -+ !(args->color_read.flags & -+ VC4_SUBMIT_RCL_SURFACE_READ_IS_FULL_RES)) { -+ loop_body_size += VC4_PACKET_TILE_COORDINATES_SIZE; -+ loop_body_size += VC4_PACKET_STORE_TILE_BUFFER_GENERAL_SIZE; -+ } -+ loop_body_size += VC4_PACKET_LOAD_TILE_BUFFER_GENERAL_SIZE; - } -- loop_body_size += VC4_PACKET_LOAD_TILE_BUFFER_GENERAL_SIZE; - } - - if (has_bin) { -@@ -207,13 +296,23 @@ static int vc4_create_rcl_bo(struct drm_device *dev, struct vc4_exec_info *exec, - loop_body_size += VC4_PACKET_BRANCH_TO_SUB_LIST_SIZE; - } - -+ if (setup->msaa_color_write) -+ loop_body_size += VC4_PACKET_STORE_FULL_RES_TILE_BUFFER_SIZE; -+ if (setup->msaa_zs_write) -+ loop_body_size += VC4_PACKET_STORE_FULL_RES_TILE_BUFFER_SIZE; -+ - if (setup->zs_write) - loop_body_size += VC4_PACKET_STORE_TILE_BUFFER_GENERAL_SIZE; -- if (setup->color_ms_write) { -- if (setup->zs_write) -- loop_body_size += VC4_PACKET_TILE_COORDINATES_SIZE; -+ if (setup->color_write) - loop_body_size += VC4_PACKET_STORE_MS_TILE_BUFFER_SIZE; -- } ++#include <linux/mfd/rpisense/joystick.h> ++#include <linux/mfd/rpisense/core.h> + -+ /* We need a VC4_PACKET_TILE_COORDINATES in between each store. */ -+ loop_body_size += VC4_PACKET_TILE_COORDINATES_SIZE * -+ ((setup->msaa_color_write != NULL) + -+ (setup->msaa_zs_write != NULL) + -+ (setup->color_write != NULL) + -+ (setup->zs_write != NULL) - 1); -+ - size += xtiles * ytiles * loop_body_size; - - setup->rcl = &vc4_bo_create(dev, size, true)->base; -@@ -224,13 +323,12 @@ static int vc4_create_rcl_bo(struct drm_device *dev, struct vc4_exec_info *exec, - - rcl_u8(setup, VC4_PACKET_TILE_RENDERING_MODE_CONFIG); - rcl_u32(setup, -- (setup->color_ms_write ? -- (setup->color_ms_write->paddr + -- args->color_ms_write.offset) : -+ (setup->color_write ? (setup->color_write->paddr + -+ args->color_write.offset) : - 0)); - rcl_u16(setup, args->width); - rcl_u16(setup, args->height); -- rcl_u16(setup, args->color_ms_write.bits); -+ rcl_u16(setup, args->color_write.bits); - - /* The tile buffer gets cleared when the previous tile is stored. If - * the clear values changed between frames, then the tile buffer has -@@ -267,6 +365,56 @@ static int vc4_create_rcl_bo(struct drm_device *dev, struct vc4_exec_info *exec, - return 0; - } - -+static int vc4_full_res_bounds_check(struct vc4_exec_info *exec, -+ struct drm_gem_cma_object *obj, -+ struct drm_vc4_submit_rcl_surface *surf) ++static struct rpisense *rpisense; ++static unsigned char keymap[5] = {KEY_DOWN, KEY_RIGHT, KEY_UP, KEY_ENTER, KEY_LEFT,}; ++ ++static void keys_work_fn(struct work_struct *work) +{ -+ struct drm_vc4_submit_cl *args = exec->args; -+ u32 render_tiles_stride = DIV_ROUND_UP(exec->args->width, 32); ++ int i; ++ static s32 prev_keys; ++ struct rpisense_js *rpisense_js = &rpisense->joystick; ++ s32 keys = rpisense_reg_read(rpisense, RPISENSE_KEYS); ++ s32 changes = keys ^ prev_keys; + -+ if (surf->offset > obj->base.size) { -+ DRM_ERROR("surface offset %d > BO size %zd\n", -+ surf->offset, obj->base.size); -+ return -EINVAL; ++ prev_keys = keys; ++ for (i = 0; i < 5; i++) { ++ if (changes & 1) { ++ input_report_key(rpisense_js->keys_dev, ++ keymap[i], keys & 1); ++ } ++ changes >>= 1; ++ keys >>= 1; + } ++ input_sync(rpisense_js->keys_dev); ++} + -+ if ((obj->base.size - surf->offset) / VC4_TILE_BUFFER_SIZE < -+ render_tiles_stride * args->max_y_tile + args->max_x_tile) { -+ DRM_ERROR("MSAA tile %d, %d out of bounds " -+ "(bo size %zd, offset %d).\n", -+ args->max_x_tile, args->max_y_tile, -+ obj->base.size, -+ surf->offset); -+ return -EINVAL; -+ } ++static irqreturn_t keys_irq_handler(int irq, void *pdev) ++{ ++ struct rpisense_js *rpisense_js = &rpisense->joystick; + -+ return 0; ++ schedule_work(&rpisense_js->keys_work_s); ++ return IRQ_HANDLED; +} + -+static int vc4_rcl_msaa_surface_setup(struct vc4_exec_info *exec, -+ struct drm_gem_cma_object **obj, -+ struct drm_vc4_submit_rcl_surface *surf) ++static int rpisense_js_probe(struct platform_device *pdev) +{ -+ if (surf->flags != 0 || surf->bits != 0) { -+ DRM_ERROR("MSAA surface had nonzero flags/bits\n"); -+ return -EINVAL; -+ } ++ int ret; ++ int i; ++ struct rpisense_js *rpisense_js; + -+ if (surf->hindex == ~0) -+ return 0; ++ rpisense = rpisense_get_dev(); ++ rpisense_js = &rpisense->joystick; + -+ *obj = vc4_use_bo(exec, surf->hindex); -+ if (!*obj) -+ return -EINVAL; ++ INIT_WORK(&rpisense_js->keys_work_s, keys_work_fn); + -+ if (surf->offset & 0xf) { -+ DRM_ERROR("MSAA write must be 16b aligned.\n"); -+ return -EINVAL; ++ rpisense_js->keys_dev = input_allocate_device(); ++ if (!rpisense_js->keys_dev) { ++ dev_err(&pdev->dev, "Could not allocate input device.\n"); ++ return -ENOMEM; + } + -+ return vc4_full_res_bounds_check(exec, *obj, surf); -+} -+ - static int vc4_rcl_surface_setup(struct vc4_exec_info *exec, - struct drm_gem_cma_object **obj, - struct drm_vc4_submit_rcl_surface *surf) -@@ -278,9 +426,10 @@ static int vc4_rcl_surface_setup(struct vc4_exec_info *exec, - uint8_t format = VC4_GET_FIELD(surf->bits, - VC4_LOADSTORE_TILE_BUFFER_FORMAT); - int cpp; -+ int ret; - -- if (surf->pad != 0) { -- DRM_ERROR("Padding unset\n"); -+ if (surf->flags & ~VC4_SUBMIT_RCL_SURFACE_READ_IS_FULL_RES) { -+ DRM_ERROR("Extra flags set\n"); - return -EINVAL; - } - -@@ -290,6 +439,25 @@ static int vc4_rcl_surface_setup(struct vc4_exec_info *exec, - if (!vc4_use_bo(exec, surf->hindex, VC4_MODE_RENDER, obj)) - return -EINVAL; - -+ if (surf->flags & VC4_SUBMIT_RCL_SURFACE_READ_IS_FULL_RES) { -+ if (surf == &exec->args->zs_write) { -+ DRM_ERROR("general zs write may not be a full-res.\n"); -+ return -EINVAL; -+ } -+ -+ if (surf->bits != 0) { -+ DRM_ERROR("load/store general bits set with " -+ "full res load/store.\n"); -+ return -EINVAL; -+ } ++ rpisense_js->keys_dev->evbit[0] = BIT_MASK(EV_KEY); ++ for (i = 0; i < ARRAY_SIZE(keymap); i++) { ++ set_bit(keymap[i], ++ rpisense_js->keys_dev->keybit); ++ } + -+ ret = vc4_full_res_bounds_check(exec, *obj, surf); -+ if (!ret) -+ return ret; ++ rpisense_js->keys_dev->name = "Raspberry Pi Sense HAT Joystick"; ++ rpisense_js->keys_dev->phys = "rpi-sense-joy/input0"; ++ rpisense_js->keys_dev->id.bustype = BUS_I2C; ++ rpisense_js->keys_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP); ++ rpisense_js->keys_dev->keycode = keymap; ++ rpisense_js->keys_dev->keycodesize = sizeof(unsigned char); ++ rpisense_js->keys_dev->keycodemax = ARRAY_SIZE(keymap); + -+ return 0; ++ ret = input_register_device(rpisense_js->keys_dev); ++ if (ret) { ++ dev_err(&pdev->dev, "Could not register input device.\n"); ++ goto err_keys_alloc; + } + - if (surf->bits & ~(VC4_LOADSTORE_TILE_BUFFER_TILING_MASK | - VC4_LOADSTORE_TILE_BUFFER_BUFFER_MASK | - VC4_LOADSTORE_TILE_BUFFER_FORMAT_MASK)) { -@@ -341,9 +509,10 @@ static int vc4_rcl_surface_setup(struct vc4_exec_info *exec, - } - - static int --vc4_rcl_ms_surface_setup(struct vc4_exec_info *exec, -- struct drm_gem_cma_object **obj, -- struct drm_vc4_submit_rcl_surface *surf) -+vc4_rcl_render_config_surface_setup(struct vc4_exec_info *exec, -+ struct vc4_rcl_setup *setup, -+ struct drm_gem_cma_object **obj, -+ struct drm_vc4_submit_rcl_surface *surf) - { - uint8_t tiling = VC4_GET_FIELD(surf->bits, - VC4_RENDER_CONFIG_MEMORY_FORMAT); -@@ -351,13 +520,15 @@ vc4_rcl_ms_surface_setup(struct vc4_exec_info *exec, - VC4_RENDER_CONFIG_FORMAT); - int cpp; - -- if (surf->pad != 0) { -- DRM_ERROR("Padding unset\n"); -+ if (surf->flags != 0) { -+ DRM_ERROR("No flags supported on render config.\n"); - return -EINVAL; - } - - if (surf->bits & ~(VC4_RENDER_CONFIG_MEMORY_FORMAT_MASK | -- VC4_RENDER_CONFIG_FORMAT_MASK)) { -+ VC4_RENDER_CONFIG_FORMAT_MASK | -+ VC4_RENDER_CONFIG_MS_MODE_4X | -+ VC4_RENDER_CONFIG_DECIMATE_MODE_4X)) { - DRM_ERROR("Unknown bits in render config: 0x%04x\n", - surf->bits); - return -EINVAL; -@@ -413,18 +584,20 @@ int vc4_get_rcl(struct drm_device *dev, struct vc4_exec_info *exec) - if (has_bin && - (args->max_x_tile > exec->bin_tiles_x || - args->max_y_tile > exec->bin_tiles_y)) { -- DRM_ERROR("Render tiles (%d,%d) outside of bin config (%d,%d)\n", -+ DRM_ERROR("Render tiles (%d,%d) outside of bin config " -+ "(%d,%d)\n", - args->max_x_tile, args->max_y_tile, - exec->bin_tiles_x, exec->bin_tiles_y); - return -EINVAL; - } - -- ret = vc4_rcl_surface_setup(exec, &setup.color_read, &args->color_read); -+ ret = vc4_rcl_render_config_surface_setup(exec, &setup, -+ &setup.color_write, -+ &args->color_write); - if (ret) - return ret; - -- ret = vc4_rcl_ms_surface_setup(exec, &setup.color_ms_write, -- &args->color_ms_write); -+ ret = vc4_rcl_surface_setup(exec, &setup.color_read, &args->color_read); - if (ret) - return ret; - -@@ -436,10 +609,21 @@ int vc4_get_rcl(struct drm_device *dev, struct vc4_exec_info *exec) - if (ret) - return ret; - -+ ret = vc4_rcl_msaa_surface_setup(exec, &setup.msaa_color_write, -+ &args->msaa_color_write); -+ if (ret) -+ return ret; ++ ret = gpiod_direction_input(rpisense_js->keys_desc); ++ if (ret) { ++ dev_err(&pdev->dev, "Could not set keys-int direction.\n"); ++ goto err_keys_reg; ++ } + -+ ret = vc4_rcl_msaa_surface_setup(exec, &setup.msaa_zs_write, -+ &args->msaa_zs_write); -+ if (ret) -+ return ret; ++ rpisense_js->keys_irq = gpiod_to_irq(rpisense_js->keys_desc); ++ if (rpisense_js->keys_irq < 0) { ++ dev_err(&pdev->dev, "Could not determine keys-int IRQ.\n"); ++ ret = rpisense_js->keys_irq; ++ goto err_keys_reg; ++ } + - /* We shouldn't even have the job submitted to us if there's no - * surface to write out. - */ -- if (!setup.color_ms_write && !setup.zs_write) { -+ if (!setup.color_write && !setup.zs_write && -+ !setup.msaa_color_write && !setup.msaa_zs_write) { - DRM_ERROR("RCL requires color or Z/S write\n"); - return -EINVAL; - } -diff --git a/drivers/gpu/drm/vc4/vc4_validate.c b/drivers/gpu/drm/vc4/vc4_validate.c -index e44e35539..2f22f19 100644 ---- a/drivers/gpu/drm/vc4/vc4_validate.c -+++ b/drivers/gpu/drm/vc4/vc4_validate.c -@@ -400,9 +400,8 @@ validate_tile_binning_config(VALIDATE_ARGS) - } - - if (flags & (VC4_BIN_CONFIG_DB_NON_MS | -- VC4_BIN_CONFIG_TILE_BUFFER_64BIT | -- VC4_BIN_CONFIG_MS_MODE_4X)) { -- DRM_ERROR("unsupported bining config flags 0x%02x\n", flags); -+ VC4_BIN_CONFIG_TILE_BUFFER_64BIT)) { -+ DRM_ERROR("unsupported binning config flags 0x%02x\n", flags); - return -EINVAL; - } - -diff --git a/include/uapi/drm/vc4_drm.h b/include/uapi/drm/vc4_drm.h -index 4a8d19f..49cd992 100644 ---- a/include/uapi/drm/vc4_drm.h -+++ b/include/uapi/drm/vc4_drm.h -@@ -46,10 +46,13 @@ struct drm_vc4_submit_rcl_surface { - uint32_t hindex; /* Handle index, or ~0 if not present. */ - uint32_t offset; /* Offset to start of buffer. */ - /* -- * Bits for either render config (color_ms_write) or load/store packet. -+ * Bits for either render config (color_write) or load/store packet. -+ * Bits should all be 0 for MSAA load/stores. - */ - uint16_t bits; -- uint16_t pad; ++ ret = devm_request_irq(&pdev->dev, rpisense_js->keys_irq, ++ keys_irq_handler, IRQF_TRIGGER_RISING, ++ "keys", &pdev->dev); ++ if (ret) { ++ dev_err(&pdev->dev, "IRQ request failed.\n"); ++ goto err_keys_reg; ++ } ++ return 0; ++err_keys_reg: ++ input_unregister_device(rpisense_js->keys_dev); ++err_keys_alloc: ++ input_free_device(rpisense_js->keys_dev); ++ return ret; ++} + -+#define VC4_SUBMIT_RCL_SURFACE_READ_IS_FULL_RES (1 << 0) -+ uint16_t flags; - }; - - /** -@@ -128,9 +131,11 @@ struct drm_vc4_submit_cl { - uint8_t max_x_tile; - uint8_t max_y_tile; - struct drm_vc4_submit_rcl_surface color_read; -- struct drm_vc4_submit_rcl_surface color_ms_write; -+ struct drm_vc4_submit_rcl_surface color_write; - struct drm_vc4_submit_rcl_surface zs_read; - struct drm_vc4_submit_rcl_surface zs_write; -+ struct drm_vc4_submit_rcl_surface msaa_color_write; -+ struct drm_vc4_submit_rcl_surface msaa_zs_write; - uint32_t clear_color[2]; - uint32_t clear_z; - uint8_t clear_s; - -From 50a1843ffd2e6f408dcb6a64ca0a2ef3b062fd5a Mon Sep 17 00:00:00 2001 -From: Eric Anholt <eric@anholt.net> -Date: Tue, 8 Dec 2015 14:00:43 -0800 -Subject: [PATCH 118/170] drm/vc4: A few more non-functional changes to sync to - upstream. - -At this point all that's left is the force-enable of HDMI connector, -and using direct firmware calls to turn on V3D instead of the generic -power domain support. - -Signed-off-by: Eric Anholt <eric@anholt.net> ---- - drivers/gpu/drm/vc4/vc4_v3d.c | 2 +- - include/uapi/drm/vc4_drm.h | 182 +++++++++++++++++++++--------------------- - 2 files changed, 92 insertions(+), 92 deletions(-) - -diff --git a/drivers/gpu/drm/vc4/vc4_v3d.c b/drivers/gpu/drm/vc4/vc4_v3d.c -index 29a222f..4d103f7f 100644 ---- a/drivers/gpu/drm/vc4/vc4_v3d.c -+++ b/drivers/gpu/drm/vc4/vc4_v3d.c -@@ -109,7 +109,7 @@ static const struct { - - int vc4_v3d_debugfs_regs(struct seq_file *m, void *unused) - { -- struct drm_info_node *node = (struct drm_info_node *) m->private; -+ struct drm_info_node *node = (struct drm_info_node *)m->private; - struct drm_device *dev = node->minor->dev; - struct vc4_dev *vc4 = to_vc4_dev(dev); - int i; -diff --git a/include/uapi/drm/vc4_drm.h b/include/uapi/drm/vc4_drm.h -index 49cd992..eeb37e3 100644 ---- a/include/uapi/drm/vc4_drm.h -+++ b/include/uapi/drm/vc4_drm.h -@@ -24,7 +24,7 @@ - #ifndef _UAPI_VC4_DRM_H_ - #define _UAPI_VC4_DRM_H_ - --#include <drm/drm.h> -+#include "drm.h" - - #define DRM_VC4_SUBMIT_CL 0x00 - #define DRM_VC4_WAIT_SEQNO 0x01 -@@ -34,25 +34,25 @@ - #define DRM_VC4_CREATE_SHADER_BO 0x05 - #define DRM_VC4_GET_HANG_STATE 0x06 - --#define DRM_IOCTL_VC4_SUBMIT_CL DRM_IOWR( DRM_COMMAND_BASE + DRM_VC4_SUBMIT_CL, struct drm_vc4_submit_cl) --#define DRM_IOCTL_VC4_WAIT_SEQNO DRM_IOWR( DRM_COMMAND_BASE + DRM_VC4_WAIT_SEQNO, struct drm_vc4_wait_seqno) --#define DRM_IOCTL_VC4_WAIT_BO DRM_IOWR( DRM_COMMAND_BASE + DRM_VC4_WAIT_BO, struct drm_vc4_wait_bo) --#define DRM_IOCTL_VC4_CREATE_BO DRM_IOWR( DRM_COMMAND_BASE + DRM_VC4_CREATE_BO, struct drm_vc4_create_bo) --#define DRM_IOCTL_VC4_MMAP_BO DRM_IOWR( DRM_COMMAND_BASE + DRM_VC4_MMAP_BO, struct drm_vc4_mmap_bo) --#define DRM_IOCTL_VC4_CREATE_SHADER_BO DRM_IOWR( DRM_COMMAND_BASE + DRM_VC4_CREATE_SHADER_BO, struct drm_vc4_create_shader_bo) --#define DRM_IOCTL_VC4_GET_HANG_STATE DRM_IOWR( DRM_COMMAND_BASE + DRM_VC4_GET_HANG_STATE, struct drm_vc4_get_hang_state) -+#define DRM_IOCTL_VC4_SUBMIT_CL DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_SUBMIT_CL, struct drm_vc4_submit_cl) -+#define DRM_IOCTL_VC4_WAIT_SEQNO DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_WAIT_SEQNO, struct drm_vc4_wait_seqno) -+#define DRM_IOCTL_VC4_WAIT_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_WAIT_BO, struct drm_vc4_wait_bo) -+#define DRM_IOCTL_VC4_CREATE_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_CREATE_BO, struct drm_vc4_create_bo) -+#define DRM_IOCTL_VC4_MMAP_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_MMAP_BO, struct drm_vc4_mmap_bo) -+#define DRM_IOCTL_VC4_CREATE_SHADER_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_CREATE_SHADER_BO, struct drm_vc4_create_shader_bo) -+#define DRM_IOCTL_VC4_GET_HANG_STATE DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_GET_HANG_STATE, struct drm_vc4_get_hang_state) - - struct drm_vc4_submit_rcl_surface { -- uint32_t hindex; /* Handle index, or ~0 if not present. */ -- uint32_t offset; /* Offset to start of buffer. */ -+ __u32 hindex; /* Handle index, or ~0 if not present. */ -+ __u32 offset; /* Offset to start of buffer. */ - /* -- * Bits for either render config (color_write) or load/store packet. -- * Bits should all be 0 for MSAA load/stores. -+ * Bits for either render config (color_write) or load/store packet. -+ * Bits should all be 0 for MSAA load/stores. - */ -- uint16_t bits; -+ __u16 bits; - - #define VC4_SUBMIT_RCL_SURFACE_READ_IS_FULL_RES (1 << 0) -- uint16_t flags; -+ __u16 flags; - }; - - /** -@@ -76,7 +76,7 @@ struct drm_vc4_submit_cl { - * then writes out the state updates and draw calls necessary per tile - * to the tile allocation BO. - */ -- uint64_t bin_cl; -+ __u64 bin_cl; - - /* Pointer to the shader records. - * -@@ -85,16 +85,16 @@ struct drm_vc4_submit_cl { - * reference to the shader record has enough information to determine - * how many pointers are necessary (fixed number for shaders/uniforms, - * and an attribute count), so those BO indices into bo_handles are -- * just stored as uint32_ts before each shader record passed in. -+ * just stored as __u32s before each shader record passed in. - */ -- uint64_t shader_rec; -+ __u64 shader_rec; - - /* Pointer to uniform data and texture handles for the textures - * referenced by the shader. - * - * For each shader state record, there is a set of uniform data in the - * order referenced by the record (FS, VS, then CS). Each set of -- * uniform data has a uint32_t index into bo_handles per texture -+ * uniform data has a __u32 index into bo_handles per texture - * sample operation, in the order the QPU_W_TMUn_S writes appear in - * the program. Following the texture BO handle indices is the actual - * uniform data. -@@ -103,52 +103,52 @@ struct drm_vc4_submit_cl { - * because the kernel has to determine the sizes anyway during shader - * code validation. - */ -- uint64_t uniforms; -- uint64_t bo_handles; -+ __u64 uniforms; -+ __u64 bo_handles; - - /* Size in bytes of the binner command list. */ -- uint32_t bin_cl_size; -+ __u32 bin_cl_size; - /* Size in bytes of the set of shader records. */ -- uint32_t shader_rec_size; -+ __u32 shader_rec_size; - /* Number of shader records. - * - * This could just be computed from the contents of shader_records and - * the address bits of references to them from the bin CL, but it - * keeps the kernel from having to resize some allocations it makes. - */ -- uint32_t shader_rec_count; -+ __u32 shader_rec_count; - /* Size in bytes of the uniform state. */ -- uint32_t uniforms_size; -+ __u32 uniforms_size; - - /* Number of BO handles passed in (size is that times 4). */ -- uint32_t bo_handle_count; -+ __u32 bo_handle_count; - - /* RCL setup: */ -- uint16_t width; -- uint16_t height; -- uint8_t min_x_tile; -- uint8_t min_y_tile; -- uint8_t max_x_tile; -- uint8_t max_y_tile; -+ __u16 width; -+ __u16 height; -+ __u8 min_x_tile; -+ __u8 min_y_tile; -+ __u8 max_x_tile; -+ __u8 max_y_tile; - struct drm_vc4_submit_rcl_surface color_read; - struct drm_vc4_submit_rcl_surface color_write; - struct drm_vc4_submit_rcl_surface zs_read; - struct drm_vc4_submit_rcl_surface zs_write; - struct drm_vc4_submit_rcl_surface msaa_color_write; - struct drm_vc4_submit_rcl_surface msaa_zs_write; -- uint32_t clear_color[2]; -- uint32_t clear_z; -- uint8_t clear_s; -+ __u32 clear_color[2]; -+ __u32 clear_z; -+ __u8 clear_s; - -- uint32_t pad:24; -+ __u32 pad:24; - - #define VC4_SUBMIT_CL_USE_CLEAR_COLOR (1 << 0) -- uint32_t flags; -+ __u32 flags; - - /* Returned value of the seqno of this render job (for the - * wait ioctl). - */ -- uint64_t seqno; -+ __u64 seqno; - }; - - /** -@@ -159,8 +159,8 @@ struct drm_vc4_submit_cl { - * block, just return the status." - */ - struct drm_vc4_wait_seqno { -- uint64_t seqno; -- uint64_t timeout_ns; -+ __u64 seqno; -+ __u64 timeout_ns; - }; - - /** -@@ -172,9 +172,9 @@ struct drm_vc4_wait_seqno { - * completed. - */ - struct drm_vc4_wait_bo { -- uint32_t handle; -- uint32_t pad; -- uint64_t timeout_ns; -+ __u32 handle; -+ __u32 pad; -+ __u64 timeout_ns; - }; - - /** -@@ -184,11 +184,30 @@ struct drm_vc4_wait_bo { - * used in a future extension. - */ - struct drm_vc4_create_bo { -- uint32_t size; -- uint32_t flags; -+ __u32 size; -+ __u32 flags; - /** Returned GEM handle for the BO. */ -- uint32_t handle; -- uint32_t pad; -+ __u32 handle; -+ __u32 pad; -+}; -+ -+/** -+ * struct drm_vc4_mmap_bo - ioctl argument for mapping VC4 BOs. -+ * -+ * This doesn't actually perform an mmap. Instead, it returns the -+ * offset you need to use in an mmap on the DRM device node. This -+ * means that tools like valgrind end up knowing about the mapped -+ * memory. -+ * -+ * There are currently no values for the flags argument, but it may be -+ * used in a future extension. -+ */ -+struct drm_vc4_mmap_bo { -+ /** Handle for the object being mapped. */ -+ __u32 handle; -+ __u32 flags; -+ /** offset into the drm node to use for subsequent mmap call. */ -+ __u64 offset; - }; - - /** -@@ -201,43 +220,24 @@ struct drm_vc4_create_bo { - */ - struct drm_vc4_create_shader_bo { - /* Size of the data argument. */ -- uint32_t size; -+ __u32 size; - /* Flags, currently must be 0. */ -- uint32_t flags; -+ __u32 flags; - - /* Pointer to the data. */ -- uint64_t data; -+ __u64 data; - - /** Returned GEM handle for the BO. */ -- uint32_t handle; -+ __u32 handle; - /* Pad, must be 0. */ -- uint32_t pad; --}; -- --/** -- * struct drm_vc4_mmap_bo - ioctl argument for mapping VC4 BOs. -- * -- * This doesn't actually perform an mmap. Instead, it returns the -- * offset you need to use in an mmap on the DRM device node. This -- * means that tools like valgrind end up knowing about the mapped -- * memory. -- * -- * There are currently no values for the flags argument, but it may be -- * used in a future extension. -- */ --struct drm_vc4_mmap_bo { -- /** Handle for the object being mapped. */ -- uint32_t handle; -- uint32_t flags; -- /** offset into the drm node to use for subsequent mmap call. */ -- uint64_t offset; -+ __u32 pad; - }; - - struct drm_vc4_get_hang_state_bo { -- uint32_t handle; -- uint32_t paddr; -- uint32_t size; -- uint32_t pad; -+ __u32 handle; -+ __u32 paddr; -+ __u32 size; -+ __u32 pad; - }; - - /** -@@ -246,34 +246,34 @@ struct drm_vc4_get_hang_state_bo { - */ - struct drm_vc4_get_hang_state { - /** Pointer to array of struct drm_vc4_get_hang_state_bo. */ -- uint64_t bo; -+ __u64 bo; - /** - * On input, the size of the bo array. Output is the number - * of bos to be returned. - */ -- uint32_t bo_count; -+ __u32 bo_count; - -- uint32_t start_bin, start_render; -+ __u32 start_bin, start_render; - -- uint32_t ct0ca, ct0ea; -- uint32_t ct1ca, ct1ea; -- uint32_t ct0cs, ct1cs; -- uint32_t ct0ra0, ct1ra0; -+ __u32 ct0ca, ct0ea; -+ __u32 ct1ca, ct1ea; -+ __u32 ct0cs, ct1cs; -+ __u32 ct0ra0, ct1ra0; - -- uint32_t bpca, bpcs; -- uint32_t bpoa, bpos; -+ __u32 bpca, bpcs; -+ __u32 bpoa, bpos; - -- uint32_t vpmbase; -+ __u32 vpmbase; - -- uint32_t dbge; -- uint32_t fdbgo; -- uint32_t fdbgb; -- uint32_t fdbgr; -- uint32_t fdbgs; -- uint32_t errstat; -+ __u32 dbge; -+ __u32 fdbgo; -+ __u32 fdbgb; -+ __u32 fdbgr; -+ __u32 fdbgs; -+ __u32 errstat; - - /* Pad that we may save more registers into in the future. */ -- uint32_t pad[16]; -+ __u32 pad[16]; - }; - - #endif /* _UAPI_VC4_DRM_H_ */ - -From 0a373a81664b9e9b8994512fb3d15ed296526e89 Mon Sep 17 00:00:00 2001 -From: Eric Anholt <eric@anholt.net> -Date: Tue, 15 Dec 2015 23:46:32 +0000 -Subject: [PATCH 119/170] drm/vc4: Use "hpd-gpios" for HDMI GPIO, like what - landed upstream. - -Signed-off-by: Eric Anholt <eric@anholt.net> ---- - arch/arm/boot/dts/overlays/vc4-kms-v3d-overlay.dts | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/arch/arm/boot/dts/overlays/vc4-kms-v3d-overlay.dts b/arch/arm/boot/dts/overlays/vc4-kms-v3d-overlay.dts -index cf5d5c9..da37483 100644 ---- a/arch/arm/boot/dts/overlays/vc4-kms-v3d-overlay.dts -+++ b/arch/arm/boot/dts/overlays/vc4-kms-v3d-overlay.dts -@@ -68,7 +68,7 @@ - <0x7e808000 0x100>; - interrupts = <2 8>, <2 9>; - ddc = <&i2c2>; -- hpd-gpio = <&gpio 46 GPIO_ACTIVE_HIGH>; -+ hpd-gpios = <&gpio 46 GPIO_ACTIVE_HIGH>; - clocks = <&cprman BCM2835_PLLH_PIX>, - <&cprman BCM2835_CLOCK_HSM>; - clock-names = "pixel", "hdmi"; - -From f8453aacbe60712c31c57580a126017b798bd339 Mon Sep 17 00:00:00 2001 -From: Eric Anholt <eric@anholt.net> -Date: Mon, 7 Dec 2015 12:35:01 -0800 -Subject: [PATCH 120/170] drm/vc4: Synchronize validation code for v2 - submission upstream. - -Signed-off-by: Eric Anholt <eric@anholt.net> ---- - drivers/gpu/drm/vc4/vc4_drv.h | 24 +-- - drivers/gpu/drm/vc4/vc4_gem.c | 14 +- - drivers/gpu/drm/vc4/vc4_render_cl.c | 6 +- - drivers/gpu/drm/vc4/vc4_validate.c | 287 +++++++++++++++--------------------- - 4 files changed, 135 insertions(+), 196 deletions(-) - -diff --git a/drivers/gpu/drm/vc4/vc4_drv.h b/drivers/gpu/drm/vc4/vc4_drv.h -index 53dfa8df..ed93fa78 100644 ---- a/drivers/gpu/drm/vc4/vc4_drv.h -+++ b/drivers/gpu/drm/vc4/vc4_drv.h -@@ -189,17 +189,6 @@ to_vc4_encoder(struct drm_encoder *encoder) - #define HVS_READ(offset) readl(vc4->hvs->regs + offset) - #define HVS_WRITE(offset, val) writel(val, vc4->hvs->regs + offset) - --enum vc4_bo_mode { -- VC4_MODE_UNDECIDED, -- VC4_MODE_RENDER, -- VC4_MODE_SHADER, --}; -- --struct vc4_bo_exec_state { -- struct drm_gem_cma_object *bo; -- enum vc4_bo_mode mode; --}; -- - struct vc4_exec_info { - /* Sequence number for this bin/render job. */ - uint64_t seqno; -@@ -210,7 +199,7 @@ struct vc4_exec_info { - /* This is the array of BOs that were looked up at the start of exec. - * Command validation will use indices into this array. - */ -- struct vc4_bo_exec_state *bo; -+ struct drm_gem_cma_object **bo; - uint32_t bo_count; - - /* Pointers for our position in vc4->job_list */ -@@ -238,7 +227,6 @@ struct vc4_exec_info { - * command lists. - */ - struct vc4_shader_state { -- uint8_t packet; - uint32_t addr; - /* Maximum vertex index referenced by any primitive using this - * shader state. -@@ -254,6 +242,7 @@ struct vc4_exec_info { - bool found_tile_binning_mode_config_packet; - bool found_start_tile_binning_packet; - bool found_increment_semaphore_packet; -+ bool found_flush; - uint8_t bin_tiles_x, bin_tiles_y; - struct drm_gem_cma_object *tile_bo; - uint32_t tile_alloc_offset; -@@ -265,6 +254,9 @@ struct vc4_exec_info { - uint32_t ct0ca, ct0ea; - uint32_t ct1ca, ct1ea; - -+ /* Pointer to the unvalidated bin CL (if present). */ -+ void *bin_u; -+ - /* Pointers to the shader recs. These paddr gets incremented as CL - * packets are relocated in validate_gl_shader_state, and the vaddrs - * (u and v) get incremented and size decremented as the shader recs -@@ -455,10 +447,8 @@ vc4_validate_bin_cl(struct drm_device *dev, - int - vc4_validate_shader_recs(struct drm_device *dev, struct vc4_exec_info *exec); - --bool vc4_use_bo(struct vc4_exec_info *exec, -- uint32_t hindex, -- enum vc4_bo_mode mode, -- struct drm_gem_cma_object **obj); -+struct drm_gem_cma_object *vc4_use_bo(struct vc4_exec_info *exec, -+ uint32_t hindex); - - int vc4_get_rcl(struct drm_device *dev, struct vc4_exec_info *exec); - -diff --git a/drivers/gpu/drm/vc4/vc4_gem.c b/drivers/gpu/drm/vc4/vc4_gem.c -index fb0b92d..39f29e7 100644 ---- a/drivers/gpu/drm/vc4/vc4_gem.c -+++ b/drivers/gpu/drm/vc4/vc4_gem.c -@@ -169,8 +169,8 @@ vc4_save_hang_state(struct drm_device *dev) - } - - for (i = 0; i < exec->bo_count; i++) { -- drm_gem_object_reference(&exec->bo[i].bo->base); -- kernel_state->bo[i] = &exec->bo[i].bo->base; -+ drm_gem_object_reference(&exec->bo[i]->base); -+ kernel_state->bo[i] = &exec->bo[i]->base; - } - - list_for_each_entry(bo, &exec->unref_list, unref_head) { -@@ -397,7 +397,7 @@ vc4_update_bo_seqnos(struct vc4_exec_info *exec, uint64_t seqno) - unsigned i; - - for (i = 0; i < exec->bo_count; i++) { -- bo = to_vc4_bo(&exec->bo[i].bo->base); -+ bo = to_vc4_bo(&exec->bo[i]->base); - bo->seqno = seqno; - } - -@@ -467,7 +467,7 @@ vc4_cl_lookup_bos(struct drm_device *dev, - return -EINVAL; - } - -- exec->bo = kcalloc(exec->bo_count, sizeof(struct vc4_bo_exec_state), -+ exec->bo = kcalloc(exec->bo_count, sizeof(struct drm_gem_cma_object *), - GFP_KERNEL); - if (!exec->bo) { - DRM_ERROR("Failed to allocate validated BO pointers\n"); -@@ -500,7 +500,7 @@ vc4_cl_lookup_bos(struct drm_device *dev, - goto fail; - } - drm_gem_object_reference(bo); -- exec->bo[i].bo = (struct drm_gem_cma_object *)bo; -+ exec->bo[i] = (struct drm_gem_cma_object *)bo; - } - spin_unlock(&file_priv->table_lock); - -@@ -591,6 +591,8 @@ vc4_get_bcl(struct drm_device *dev, struct vc4_exec_info *exec) - - exec->ct0ca = exec->exec_bo->paddr + bin_offset; - -+ exec->bin_u = bin; ++static int rpisense_js_remove(struct platform_device *pdev) ++{ ++ struct rpisense_js *rpisense_js = &rpisense->joystick; + - exec->shader_rec_v = exec->exec_bo->vaddr + shader_rec_offset; - exec->shader_rec_p = exec->exec_bo->paddr + shader_rec_offset; - exec->shader_rec_size = args->shader_rec_size; -@@ -622,7 +624,7 @@ vc4_complete_exec(struct drm_device *dev, struct vc4_exec_info *exec) - mutex_lock(&dev->struct_mutex); - if (exec->bo) { - for (i = 0; i < exec->bo_count; i++) -- drm_gem_object_unreference(&exec->bo[i].bo->base); -+ drm_gem_object_unreference(&exec->bo[i]->base); - kfree(exec->bo); - } - -diff --git a/drivers/gpu/drm/vc4/vc4_render_cl.c b/drivers/gpu/drm/vc4/vc4_render_cl.c -index 8f2ec57..8a2a312 100644 ---- a/drivers/gpu/drm/vc4/vc4_render_cl.c -+++ b/drivers/gpu/drm/vc4/vc4_render_cl.c -@@ -436,7 +436,8 @@ static int vc4_rcl_surface_setup(struct vc4_exec_info *exec, - if (surf->hindex == ~0) - return 0; - -- if (!vc4_use_bo(exec, surf->hindex, VC4_MODE_RENDER, obj)) -+ *obj = vc4_use_bo(exec, surf->hindex); -+ if (!*obj) - return -EINVAL; - - if (surf->flags & VC4_SUBMIT_RCL_SURFACE_READ_IS_FULL_RES) { -@@ -537,7 +538,8 @@ vc4_rcl_render_config_surface_setup(struct vc4_exec_info *exec, - if (surf->hindex == ~0) - return 0; - -- if (!vc4_use_bo(exec, surf->hindex, VC4_MODE_RENDER, obj)) -+ *obj = vc4_use_bo(exec, surf->hindex); -+ if (!*obj) - return -EINVAL; - - if (tiling > VC4_TILING_FORMAT_LT) { -diff --git a/drivers/gpu/drm/vc4/vc4_validate.c b/drivers/gpu/drm/vc4/vc4_validate.c -index 2f22f19..0fb5b99 100644 ---- a/drivers/gpu/drm/vc4/vc4_validate.c -+++ b/drivers/gpu/drm/vc4/vc4_validate.c -@@ -94,42 +94,42 @@ size_is_lt(uint32_t width, uint32_t height, int cpp) - height <= 4 * utile_height(cpp)); - } - --bool --vc4_use_bo(struct vc4_exec_info *exec, -- uint32_t hindex, -- enum vc4_bo_mode mode, -- struct drm_gem_cma_object **obj) -+struct drm_gem_cma_object * -+vc4_use_bo(struct vc4_exec_info *exec, uint32_t hindex) - { -- *obj = NULL; -+ struct drm_gem_cma_object *obj; -+ struct vc4_bo *bo; - - if (hindex >= exec->bo_count) { - DRM_ERROR("BO index %d greater than BO count %d\n", - hindex, exec->bo_count); -- return false; -+ return NULL; - } -+ obj = exec->bo[hindex]; -+ bo = to_vc4_bo(&obj->base); - -- if (exec->bo[hindex].mode != mode) { -- if (exec->bo[hindex].mode == VC4_MODE_UNDECIDED) { -- exec->bo[hindex].mode = mode; -- } else { -- DRM_ERROR("BO index %d reused with mode %d vs %d\n", -- hindex, exec->bo[hindex].mode, mode); -- return false; -- } -+ if (bo->validated_shader) { -+ DRM_ERROR("Trying to use shader BO as something other than " -+ "a shader\n"); -+ return NULL; - } - -- *obj = exec->bo[hindex].bo; -- return true; -+ return obj; ++ input_unregister_device(rpisense_js->keys_dev); ++ input_free_device(rpisense_js->keys_dev); ++ return 0; +} + -+static struct drm_gem_cma_object * -+vc4_use_handle(struct vc4_exec_info *exec, uint32_t gem_handles_packet_index) -+{ -+ return vc4_use_bo(exec, exec->bo_index[gem_handles_packet_index]); - } - - static bool --vc4_use_handle(struct vc4_exec_info *exec, -- uint32_t gem_handles_packet_index, -- enum vc4_bo_mode mode, -- struct drm_gem_cma_object **obj) -+validate_bin_pos(struct vc4_exec_info *exec, void *untrusted, uint32_t pos) - { -- return vc4_use_bo(exec, exec->bo_index[gem_handles_packet_index], -- mode, obj); -+ /* Note that the untrusted pointer passed to these functions is -+ * incremented past the packet byte. -+ */ -+ return (untrusted - 1 == exec->bin_u + pos); - } - - static uint32_t -@@ -202,13 +202,13 @@ vc4_check_tex_size(struct vc4_exec_info *exec, struct drm_gem_cma_object *fbo, - } - - static int --validate_flush_all(VALIDATE_ARGS) -+validate_flush(VALIDATE_ARGS) - { -- if (exec->found_increment_semaphore_packet) { -- DRM_ERROR("VC4_PACKET_FLUSH_ALL after " -- "VC4_PACKET_INCREMENT_SEMAPHORE\n"); -+ if (!validate_bin_pos(exec, untrusted, exec->args->bin_cl_size - 1)) { -+ DRM_ERROR("Bin CL must end with VC4_PACKET_FLUSH\n"); - return -EINVAL; - } -+ exec->found_flush = true; - - return 0; - } -@@ -233,17 +233,13 @@ validate_start_tile_binning(VALIDATE_ARGS) - static int - validate_increment_semaphore(VALIDATE_ARGS) - { -- if (exec->found_increment_semaphore_packet) { -- DRM_ERROR("Duplicate VC4_PACKET_INCREMENT_SEMAPHORE\n"); -+ if (!validate_bin_pos(exec, untrusted, exec->args->bin_cl_size - 2)) { -+ DRM_ERROR("Bin CL must end with " -+ "VC4_PACKET_INCREMENT_SEMAPHORE\n"); - return -EINVAL; - } - exec->found_increment_semaphore_packet = true; - -- /* Once we've found the semaphore increment, there should be one FLUSH -- * then the end of the command list. The FLUSH actually triggers the -- * increment, so we only need to make sure there -- */ -- - return 0; - } - -@@ -257,11 +253,6 @@ validate_indexed_prim_list(VALIDATE_ARGS) - uint32_t index_size = (*(uint8_t *)(untrusted + 0) >> 4) ? 2 : 1; - struct vc4_shader_state *shader_state; - -- if (exec->found_increment_semaphore_packet) { -- DRM_ERROR("Drawing after VC4_PACKET_INCREMENT_SEMAPHORE\n"); -- return -EINVAL; -- } -- - /* Check overflow condition */ - if (exec->shader_state_count == 0) { - DRM_ERROR("shader state must precede primitives\n"); -@@ -272,7 +263,8 @@ validate_indexed_prim_list(VALIDATE_ARGS) - if (max_index > shader_state->max_index) - shader_state->max_index = max_index; - -- if (!vc4_use_handle(exec, 0, VC4_MODE_RENDER, &ib)) -+ ib = vc4_use_handle(exec, 0); -+ if (!ib) - return -EINVAL; - - if (offset > ib->base.size || -@@ -295,11 +287,6 @@ validate_gl_array_primitive(VALIDATE_ARGS) - uint32_t max_index; - struct vc4_shader_state *shader_state; - -- if (exec->found_increment_semaphore_packet) { -- DRM_ERROR("Drawing after VC4_PACKET_INCREMENT_SEMAPHORE\n"); -- return -EINVAL; -- } -- - /* Check overflow condition */ - if (exec->shader_state_count == 0) { - DRM_ERROR("shader state must precede primitives\n"); -@@ -329,7 +316,6 @@ validate_gl_shader_state(VALIDATE_ARGS) - return -EINVAL; - } - -- exec->shader_state[i].packet = VC4_PACKET_GL_SHADER_STATE; - exec->shader_state[i].addr = *(uint32_t *)untrusted; - exec->shader_state[i].max_index = 0; - -@@ -348,31 +334,6 @@ validate_gl_shader_state(VALIDATE_ARGS) - } - - static int --validate_nv_shader_state(VALIDATE_ARGS) --{ -- uint32_t i = exec->shader_state_count++; -- -- if (i >= exec->shader_state_size) { -- DRM_ERROR("More requests for shader states than declared\n"); -- return -EINVAL; -- } -- -- exec->shader_state[i].packet = VC4_PACKET_NV_SHADER_STATE; -- exec->shader_state[i].addr = *(uint32_t *)untrusted; -- -- if (exec->shader_state[i].addr & 15) { -- DRM_ERROR("NV shader state address 0x%08x misaligned\n", -- exec->shader_state[i].addr); -- return -EINVAL; -- } -- -- *(uint32_t *)validated = (exec->shader_state[i].addr + -- exec->shader_rec_p); -- -- return 0; --} -- --static int - validate_tile_binning_config(VALIDATE_ARGS) - { - struct drm_device *dev = exec->exec_bo->base.dev; -@@ -473,8 +434,8 @@ static const struct cmd_info { - } cmd_info[] = { - VC4_DEFINE_PACKET(VC4_PACKET_HALT, NULL), - VC4_DEFINE_PACKET(VC4_PACKET_NOP, NULL), -- VC4_DEFINE_PACKET(VC4_PACKET_FLUSH, NULL), -- VC4_DEFINE_PACKET(VC4_PACKET_FLUSH_ALL, validate_flush_all), -+ VC4_DEFINE_PACKET(VC4_PACKET_FLUSH, validate_flush), -+ VC4_DEFINE_PACKET(VC4_PACKET_FLUSH_ALL, NULL), - VC4_DEFINE_PACKET(VC4_PACKET_START_TILE_BINNING, - validate_start_tile_binning), - VC4_DEFINE_PACKET(VC4_PACKET_INCREMENT_SEMAPHORE, -@@ -488,7 +449,6 @@ static const struct cmd_info { - VC4_DEFINE_PACKET(VC4_PACKET_PRIMITIVE_LIST_FORMAT, NULL), - - VC4_DEFINE_PACKET(VC4_PACKET_GL_SHADER_STATE, validate_gl_shader_state), -- VC4_DEFINE_PACKET(VC4_PACKET_NV_SHADER_STATE, validate_nv_shader_state), - - VC4_DEFINE_PACKET(VC4_PACKET_CONFIGURATION_BITS, NULL), - VC4_DEFINE_PACKET(VC4_PACKET_FLAT_SHADE_FLAGS, NULL), -@@ -575,8 +535,16 @@ vc4_validate_bin_cl(struct drm_device *dev, - return -EINVAL; - } - -- if (!exec->found_increment_semaphore_packet) { -- DRM_ERROR("Bin CL missing VC4_PACKET_INCREMENT_SEMAPHORE\n"); -+ /* The bin CL must be ended with INCREMENT_SEMAPHORE and FLUSH. The -+ * semaphore is used to trigger the render CL to start up, and the -+ * FLUSH is what caps the bin lists with -+ * VC4_PACKET_RETURN_FROM_SUB_LIST (so they jump back to the main -+ * render CL when they get called to) and actually triggers the queued -+ * semaphore increment. -+ */ -+ if (!exec->found_increment_semaphore_packet || !exec->found_flush) { -+ DRM_ERROR("Bin CL missing VC4_PACKET_INCREMENT_SEMAPHORE + " -+ "VC4_PACKET_FLUSH\n"); - return -EINVAL; - } - -@@ -607,7 +575,8 @@ reloc_tex(struct vc4_exec_info *exec, - uint32_t cube_map_stride = 0; - enum vc4_texture_data_type type; - -- if (!vc4_use_bo(exec, texture_handle_index, VC4_MODE_RENDER, &tex)) -+ tex = vc4_use_bo(exec, texture_handle_index); -+ if (!tex) - return false; - - if (sample->is_direct) { -@@ -755,51 +724,28 @@ reloc_tex(struct vc4_exec_info *exec, - } - - static int --validate_shader_rec(struct drm_device *dev, -- struct vc4_exec_info *exec, -- struct vc4_shader_state *state) -+validate_gl_shader_rec(struct drm_device *dev, -+ struct vc4_exec_info *exec, -+ struct vc4_shader_state *state) - { - uint32_t *src_handles; - void *pkt_u, *pkt_v; -- enum shader_rec_reloc_type { -- RELOC_CODE, -- RELOC_VBO, -- }; -- struct shader_rec_reloc { -- enum shader_rec_reloc_type type; -- uint32_t offset; -- }; -- static const struct shader_rec_reloc gl_relocs[] = { -- { RELOC_CODE, 4 }, /* fs */ -- { RELOC_CODE, 16 }, /* vs */ -- { RELOC_CODE, 28 }, /* cs */ -- }; -- static const struct shader_rec_reloc nv_relocs[] = { -- { RELOC_CODE, 4 }, /* fs */ -- { RELOC_VBO, 12 } -+ static const uint32_t shader_reloc_offsets[] = { -+ 4, /* fs */ -+ 16, /* vs */ -+ 28, /* cs */ - }; -- const struct shader_rec_reloc *relocs; -- struct drm_gem_cma_object *bo[ARRAY_SIZE(gl_relocs) + 8]; -- uint32_t nr_attributes = 0, nr_fixed_relocs, nr_relocs, packet_size; -+ uint32_t shader_reloc_count = ARRAY_SIZE(shader_reloc_offsets); -+ struct drm_gem_cma_object *bo[shader_reloc_count + 8]; -+ uint32_t nr_attributes, nr_relocs, packet_size; - int i; -- struct vc4_validated_shader_info *shader; - -- if (state->packet == VC4_PACKET_NV_SHADER_STATE) { -- relocs = nv_relocs; -- nr_fixed_relocs = ARRAY_SIZE(nv_relocs); -- -- packet_size = 16; -- } else { -- relocs = gl_relocs; -- nr_fixed_relocs = ARRAY_SIZE(gl_relocs); -- -- nr_attributes = state->addr & 0x7; -- if (nr_attributes == 0) -- nr_attributes = 8; -- packet_size = gl_shader_rec_size(state->addr); -- } -- nr_relocs = nr_fixed_relocs + nr_attributes; -+ nr_attributes = state->addr & 0x7; -+ if (nr_attributes == 0) -+ nr_attributes = 8; -+ packet_size = gl_shader_rec_size(state->addr); - -+ nr_relocs = ARRAY_SIZE(shader_reloc_offsets) + nr_attributes; - if (nr_relocs * 4 > exec->shader_rec_size) { - DRM_ERROR("overflowed shader recs reading %d handles " - "from %d bytes left\n", -@@ -829,21 +775,30 @@ validate_shader_rec(struct drm_device *dev, - exec->shader_rec_v += roundup(packet_size, 16); - exec->shader_rec_size -= packet_size; - -- for (i = 0; i < nr_relocs; i++) { -- enum vc4_bo_mode mode; -+ if (!(*(uint16_t *)pkt_u & VC4_SHADER_FLAG_FS_SINGLE_THREAD)) { -+ DRM_ERROR("Multi-threaded fragment shaders not supported.\n"); -+ return -EINVAL; -+ } - -- if (i < nr_fixed_relocs && relocs[i].type == RELOC_CODE) -- mode = VC4_MODE_SHADER; -- else -- mode = VC4_MODE_RENDER; -+ for (i = 0; i < shader_reloc_count; i++) { -+ if (src_handles[i] > exec->bo_count) { -+ DRM_ERROR("Shader handle %d too big\n", src_handles[i]); -+ return -EINVAL; -+ } - -- if (!vc4_use_bo(exec, src_handles[i], mode, &bo[i])) -- return false; -+ bo[i] = exec->bo[src_handles[i]]; -+ if (!bo[i]) -+ return -EINVAL; -+ } -+ for (i = shader_reloc_count; i < nr_relocs; i++) { -+ bo[i] = vc4_use_bo(exec, src_handles[i]); -+ if (!bo[i]) -+ return -EINVAL; - } - -- for (i = 0; i < nr_fixed_relocs; i++) { -- struct vc4_bo *vc4_bo; -- uint32_t o = relocs[i].offset; -+ for (i = 0; i < shader_reloc_count; i++) { -+ struct vc4_validated_shader_info *validated_shader; -+ uint32_t o = shader_reloc_offsets[i]; - uint32_t src_offset = *(uint32_t *)(pkt_u + o); - uint32_t *texture_handles_u; - void *uniform_data_u; -@@ -851,57 +806,50 @@ validate_shader_rec(struct drm_device *dev, - - *(uint32_t *)(pkt_v + o) = bo[i]->paddr + src_offset; - -- switch (relocs[i].type) { -- case RELOC_CODE: -- if (src_offset != 0) { -- DRM_ERROR("Shaders must be at offset 0 " -- "of the BO.\n"); -- goto fail; -- } -+ if (src_offset != 0) { -+ DRM_ERROR("Shaders must be at offset 0 of " -+ "the BO.\n"); -+ return -EINVAL; -+ } - -- vc4_bo = to_vc4_bo(&bo[i]->base); -- shader = vc4_bo->validated_shader; -- if (!shader) -- goto fail; -+ validated_shader = to_vc4_bo(&bo[i]->base)->validated_shader; -+ if (!validated_shader) -+ return -EINVAL; - -- if (shader->uniforms_src_size > exec->uniforms_size) { -- DRM_ERROR("Uniforms src buffer overflow\n"); -- goto fail; -- } -+ if (validated_shader->uniforms_src_size > -+ exec->uniforms_size) { -+ DRM_ERROR("Uniforms src buffer overflow\n"); -+ return -EINVAL; -+ } - -- texture_handles_u = exec->uniforms_u; -- uniform_data_u = (texture_handles_u + -- shader->num_texture_samples); -- -- memcpy(exec->uniforms_v, uniform_data_u, -- shader->uniforms_size); -- -- for (tex = 0; -- tex < shader->num_texture_samples; -- tex++) { -- if (!reloc_tex(exec, -- uniform_data_u, -- &shader->texture_samples[tex], -- texture_handles_u[tex])) { -- goto fail; -- } -- } -+ texture_handles_u = exec->uniforms_u; -+ uniform_data_u = (texture_handles_u + -+ validated_shader->num_texture_samples); - -- *(uint32_t *)(pkt_v + o + 4) = exec->uniforms_p; -+ memcpy(exec->uniforms_v, uniform_data_u, -+ validated_shader->uniforms_size); - -- exec->uniforms_u += shader->uniforms_src_size; -- exec->uniforms_v += shader->uniforms_size; -- exec->uniforms_p += shader->uniforms_size; -+ for (tex = 0; -+ tex < validated_shader->num_texture_samples; -+ tex++) { -+ if (!reloc_tex(exec, -+ uniform_data_u, -+ &validated_shader->texture_samples[tex], -+ texture_handles_u[tex])) { -+ return -EINVAL; -+ } -+ } - -- break; -+ *(uint32_t *)(pkt_v + o + 4) = exec->uniforms_p; - -- case RELOC_VBO: -- break; -- } -+ exec->uniforms_u += validated_shader->uniforms_src_size; -+ exec->uniforms_v += validated_shader->uniforms_size; -+ exec->uniforms_p += validated_shader->uniforms_size; - } - - for (i = 0; i < nr_attributes; i++) { -- struct drm_gem_cma_object *vbo = bo[nr_fixed_relocs + i]; -+ struct drm_gem_cma_object *vbo = -+ bo[ARRAY_SIZE(shader_reloc_offsets) + i]; - uint32_t o = 36 + i * 8; - uint32_t offset = *(uint32_t *)(pkt_u + o + 0); - uint32_t attr_size = *(uint8_t *)(pkt_u + o + 4) + 1; -@@ -933,9 +881,6 @@ validate_shader_rec(struct drm_device *dev, - } - - return 0; -- --fail: -- return -EINVAL; - } - - int -@@ -946,7 +891,7 @@ vc4_validate_shader_recs(struct drm_device *dev, - int ret = 0; - - for (i = 0; i < exec->shader_state_count; i++) { -- ret = validate_shader_rec(dev, exec, &exec->shader_state[i]); -+ ret = validate_gl_shader_rec(dev, exec, &exec->shader_state[i]); - if (ret) - return ret; - } - -From 280bea89916813978b81811c2769411d438eb52f Mon Sep 17 00:00:00 2001 -From: janluca <janluca@zedat.fu-berlin.de> -Date: Sun, 27 Dec 2015 14:34:04 +0100 -Subject: [PATCH 121/170] MMC: Do not use mmc_debug if CONFIG_MMC_BCM2835 is - not set - -If CONFIG_MMC_BCM2835 was not set the compiling of the kernel failed -since mmc_debug was not defined but used in drivers/mmc/core/quirks.c. - -This patch add a ifdef-check for CONFIG_MMC_BCM2835 to the change of -commit 64d395457f793250d2e582eeb38cc3403b1db98c ---- - drivers/mmc/core/quirks.c | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/drivers/mmc/core/quirks.c b/drivers/mmc/core/quirks.c -index 87ae2e9..b79fe14 100644 ---- a/drivers/mmc/core/quirks.c -+++ b/drivers/mmc/core/quirks.c -@@ -53,7 +53,9 @@ static const struct mmc_fixup mmc_fixup_methods[] = { - - void mmc_fixup_device(struct mmc_card *card, const struct mmc_fixup *table) - { -+#ifdef CONFIG_MMC_BCM2835 - extern unsigned mmc_debug; -+#endif - const struct mmc_fixup *f; - u64 rev = cid_rev_card(card); - -@@ -81,7 +83,9 @@ void mmc_fixup_device(struct mmc_card *card, const struct mmc_fixup *table) - /* SDHCI on BCM2708 - bug causes a certain sequence of CMD23 operations to fail. - * Disable this flag for all cards (fall-back to CMD25/CMD18 multi-block transfers). - */ -+#ifdef CONFIG_MMC_BCM2835 - if (mmc_debug & (1<<13)) - card->quirks |= MMC_QUIRK_BLK_NO_CMD23; ++#ifdef CONFIG_OF ++static const struct of_device_id rpisense_js_id[] = { ++ { .compatible = "rpi,rpi-sense-js" }, ++ { }, ++}; ++MODULE_DEVICE_TABLE(of, rpisense_js_id); +#endif - } - EXPORT_SYMBOL(mmc_fixup_device); - -From d0390ae0ff774d8e7b5b4d5f38c33726354996bc Mon Sep 17 00:00:00 2001 -From: Devon Fyson <devonfyson@gmail.com> -Date: Wed, 30 Dec 2015 16:40:47 -0500 -Subject: [PATCH 122/170] Extend clock timeout, fix modprobe baudrate - parameter. - -Set the BSC_CLKT clock streching timeout to 35ms as per SMBus specs.\n- Increase priority of baudrate parameter passed to modprobe (in /etc/modprobe.d/*.conf or command line). Currently custom baudrates don't work because they are overridden by clock-frequency in the platform_device passed to the function. ---- - drivers/i2c/busses/i2c-bcm2708.c | 45 ++++++++++++++++++++++++++-------------- - 1 file changed, 29 insertions(+), 16 deletions(-) - -diff --git a/drivers/i2c/busses/i2c-bcm2708.c b/drivers/i2c/busses/i2c-bcm2708.c -index 85f411c..b152639 100644 ---- a/drivers/i2c/busses/i2c-bcm2708.c -+++ b/drivers/i2c/busses/i2c-bcm2708.c -@@ -71,7 +71,8 @@ - - #define DRV_NAME "bcm2708_i2c" - --static unsigned int baudrate = CONFIG_I2C_BCM2708_BAUDRATE; -+static unsigned int baudrate_default = CONFIG_I2C_BCM2708_BAUDRATE; -+static unsigned int baudrate; - module_param(baudrate, uint, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP); - MODULE_PARM_DESC(baudrate, "The I2C baudrate"); - -@@ -87,6 +88,7 @@ struct bcm2708_i2c { - int irq; - struct clk *clk; - u32 cdiv; -+ u32 clk_tout; - - struct completion done; - -@@ -126,7 +128,7 @@ static inline void bcm2708_bsc_fifo_fill(struct bcm2708_i2c *bi) - - static inline int bcm2708_bsc_setup(struct bcm2708_i2c *bi) - { -- u32 cdiv, s; -+ u32 cdiv, s, clk_tout; - u32 c = BSC_C_I2CEN | BSC_C_INTD | BSC_C_ST | BSC_C_CLEAR_1; - int wait_loops = I2C_WAIT_LOOP_COUNT; - -@@ -134,12 +136,14 @@ static inline int bcm2708_bsc_setup(struct bcm2708_i2c *bi) - * Use the value that we cached in the probe. - */ - cdiv = bi->cdiv; -+ clk_tout = bi->clk_tout; - - if (bi->msg->flags & I2C_M_RD) - c |= BSC_C_INTR | BSC_C_READ; - else - c |= BSC_C_INTT; - -+ bcm2708_wr(bi, BSC_CLKT, clk_tout); - bcm2708_wr(bi, BSC_DIV, cdiv); - bcm2708_wr(bi, BSC_A, bi->msg->addr); - bcm2708_wr(bi, BSC_DLEN, bi->msg->len); -@@ -312,21 +316,24 @@ static int bcm2708_i2c_probe(struct platform_device *pdev) - struct bcm2708_i2c *bi; - struct i2c_adapter *adap; - unsigned long bus_hz; -- u32 cdiv; -- -- if (pdev->dev.of_node) { -- u32 bus_clk_rate; -- pdev->id = of_alias_get_id(pdev->dev.of_node, "i2c"); -- if (pdev->id < 0) { -- dev_err(&pdev->dev, "alias is missing\n"); -- return -EINVAL; -+ u32 cdiv, clk_tout; -+ -+ if (!baudrate) { -+ baudrate = baudrate_default; -+ if (pdev->dev.of_node) { -+ u32 bus_clk_rate; -+ pdev->id = of_alias_get_id(pdev->dev.of_node, "i2c"); -+ if (pdev->id < 0) { -+ dev_err(&pdev->dev, "alias is missing\n"); -+ return -EINVAL; -+ } -+ if (!of_property_read_u32(pdev->dev.of_node, -+ "clock-frequency", &bus_clk_rate)) -+ baudrate = bus_clk_rate; -+ else -+ dev_warn(&pdev->dev, -+ "Could not read clock-frequency property\n"); - } -- if (!of_property_read_u32(pdev->dev.of_node, -- "clock-frequency", &bus_clk_rate)) -- baudrate = bus_clk_rate; -- else -- dev_warn(&pdev->dev, -- "Could not read clock-frequency property\n"); - } - - regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); -@@ -417,7 +424,13 @@ static int bcm2708_i2c_probe(struct platform_device *pdev) - cdiv = 0xffff; - baudrate = bus_hz / cdiv; - } -+ -+ clk_tout = 35/1000*baudrate; //35ms timeout as per SMBus specs. -+ if (clk_tout > 0xffff) -+ clk_tout = 0xffff; -+ - bi->cdiv = cdiv; -+ bi->clk_tout = clk_tout; - - dev_info(&pdev->dev, "BSC%d Controller at 0x%08lx (irq %d) (baudrate %d)\n", - pdev->id, (unsigned long)regs->start, irq, baudrate); - -From 62dca1937fc3acfe4b6471607b7a4d58c34e73b7 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= <noralf@tronnes.org> -Date: Thu, 31 Dec 2015 16:44:58 +0100 -Subject: [PATCH 123/170] bcm270x_dt: Add dwc2 and dwc-otg overlays - ---- - arch/arm/boot/dts/overlays/Makefile | 2 ++ - arch/arm/boot/dts/overlays/README | 21 +++++++++++++++++++ - arch/arm/boot/dts/overlays/dwc-otg-overlay.dts | 20 ++++++++++++++++++ - arch/arm/boot/dts/overlays/dwc2-overlay.dts | 29 ++++++++++++++++++++++++++ - 4 files changed, 72 insertions(+) - create mode 100644 arch/arm/boot/dts/overlays/dwc-otg-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/dwc2-overlay.dts - -diff --git a/arch/arm/boot/dts/overlays/Makefile b/arch/arm/boot/dts/overlays/Makefile -index be9dead..aaa8976 100644 ---- a/arch/arm/boot/dts/overlays/Makefile -+++ b/arch/arm/boot/dts/overlays/Makefile -@@ -15,6 +15,8 @@ endif - dtb-$(RPI_DT_OVERLAYS) += ads7846-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += at86rf233-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += bmp085_i2c-sensor-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += dwc2-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += dwc-otg-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += dht11-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += enc28j60-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += gpio-ir-overlay.dtb -diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README -index 04e55ce..c70c1e59 100644 ---- a/arch/arm/boot/dts/overlays/README -+++ b/arch/arm/boot/dts/overlays/README -@@ -198,6 +198,27 @@ Params: gpiopin GPIO connected to the sensor's DATA output. - (default 4) - ++ ++static struct platform_device_id rpisense_js_device_id[] = { ++ { .name = "rpi-sense-js" }, ++ { }, ++}; ++MODULE_DEVICE_TABLE(platform, rpisense_js_device_id); ++ ++static struct platform_driver rpisense_js_driver = { ++ .probe = rpisense_js_probe, ++ .remove = rpisense_js_remove, ++ .driver = { ++ .name = "rpi-sense-js", ++ .owner = THIS_MODULE, ++ }, ++}; ++ ++module_platform_driver(rpisense_js_driver); ++ ++MODULE_DESCRIPTION("Raspberry Pi Sense HAT joystick driver"); ++MODULE_AUTHOR("Serge Schneider <serge@raspberrypi.org>"); ++MODULE_LICENSE("GPL"); +diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig +index eea61e3..d2c3b72 100644 +--- a/drivers/mfd/Kconfig ++++ b/drivers/mfd/Kconfig +@@ -10,6 +10,14 @@ config MFD_CORE + select IRQ_DOMAIN + default n -+Name: dwc-otg -+Info: Selects the dwc_otg USB controller driver which has fiq support. This -+ is the default on all except the Pi Zero which defaults to dwc2. -+Load: dtoverlay=dwc-otg -+Params: <None> ++config MFD_RPISENSE_CORE ++ tristate "Raspberry Pi Sense HAT core functions" ++ depends on I2C ++ select MFD_CORE ++ help ++ This is the core driver for the Raspberry Pi Sense HAT. This provides ++ the necessary functions to communicate with the hardware. ++ + config MFD_CS5535 + tristate "AMD CS5535 and CS5536 southbridge core functions" + select MFD_CORE +diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile +index 5eaa6465d..8dc2dde 100644 +--- a/drivers/mfd/Makefile ++++ b/drivers/mfd/Makefile +@@ -203,3 +203,5 @@ intel-soc-pmic-objs := intel_soc_pmic_core.o intel_soc_pmic_crc.o + intel-soc-pmic-$(CONFIG_INTEL_PMC_IPC) += intel_soc_pmic_bxtwc.o + obj-$(CONFIG_INTEL_SOC_PMIC) += intel-soc-pmic.o + obj-$(CONFIG_MFD_MT6397) += mt6397-core.o ++ ++obj-$(CONFIG_MFD_RPISENSE_CORE) += rpisense-core.o +diff --git a/drivers/mfd/rpisense-core.c b/drivers/mfd/rpisense-core.c +new file mode 100644 +index 0000000..eea9312 +--- /dev/null ++++ b/drivers/mfd/rpisense-core.c +@@ -0,0 +1,157 @@ ++/* ++ * Raspberry Pi Sense HAT core driver ++ * http://raspberrypi.org ++ * ++ * Copyright (C) 2015 Raspberry Pi ++ * ++ * Author: Serge Schneider ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License as published by the ++ * Free Software Foundation; either version 2 of the License, or (at your ++ * option) any later version. ++ * ++ * This driver is based on wm8350 implementation. ++ */ + ++#include <linux/module.h> ++#include <linux/moduleparam.h> ++#include <linux/err.h> ++#include <linux/init.h> ++#include <linux/i2c.h> ++#include <linux/platform_device.h> ++#include <linux/mfd/rpisense/core.h> ++#include <linux/slab.h> + -+Name: dwc2 -+Info: Selects the dwc2 USB controller driver -+Load: dtoverlay=dwc2,<param>=<val> -+Params: dr_mode Dual role mode: "host", "peripheral" or "otg" ++static struct rpisense *rpisense; + -+ g-rx-fifo-size Size of rx fifo size in gadget mode ++static void rpisense_client_dev_register(struct rpisense *rpisense, ++ const char *name, ++ struct platform_device **pdev) ++{ ++ int ret; + -+ g-np-tx-fifo-size Size of non-periodic tx fifo size in gadget -+ mode ++ *pdev = platform_device_alloc(name, -1); ++ if (*pdev == NULL) { ++ dev_err(rpisense->dev, "Failed to allocate %s\n", name); ++ return; ++ } + -+ g-tx-fifo-size Size of periodic tx fifo per endpoint -+ (except ep0) in gadget mode ++ (*pdev)->dev.parent = rpisense->dev; ++ platform_set_drvdata(*pdev, rpisense); ++ ret = platform_device_add(*pdev); ++ if (ret != 0) { ++ dev_err(rpisense->dev, "Failed to register %s: %d\n", ++ name, ret); ++ platform_device_put(*pdev); ++ *pdev = NULL; ++ } ++} + ++static int rpisense_probe(struct i2c_client *i2c, ++ const struct i2c_device_id *id) ++{ ++ int ret; ++ struct rpisense_js *rpisense_js; + - [ The ds1307-rtc overlay has been deleted. See i2c-rtc. ] - - -diff --git a/arch/arm/boot/dts/overlays/dwc-otg-overlay.dts b/arch/arm/boot/dts/overlays/dwc-otg-overlay.dts -new file mode 100644 -index 0000000..fc48bd1 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/dwc-otg-overlay.dts -@@ -0,0 +1,20 @@ -+/dts-v1/; -+/plugin/; ++ rpisense = devm_kzalloc(&i2c->dev, sizeof(struct rpisense), GFP_KERNEL); ++ if (rpisense == NULL) ++ return -ENOMEM; + -+/{ -+ compatible = "brcm,bcm2708"; ++ i2c_set_clientdata(i2c, rpisense); ++ rpisense->dev = &i2c->dev; ++ rpisense->i2c_client = i2c; + -+ fragment@0 { -+ target = <&usb>; -+ #address-cells = <1>; -+ #size-cells = <1>; -+ __overlay__ { -+ compatible = "brcm,bcm2708-usb"; -+ reg = <0x7e980000 0x10000>, -+ <0x7e006000 0x1000>; -+ interrupts = <2 0>, -+ <1 9>; -+ status = "okay"; -+ }; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/dwc2-overlay.dts b/arch/arm/boot/dts/overlays/dwc2-overlay.dts -new file mode 100644 -index 0000000..90c9811 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/dwc2-overlay.dts -@@ -0,0 +1,29 @@ -+/dts-v1/; -+/plugin/; ++ ret = rpisense_reg_read(rpisense, RPISENSE_WAI); ++ if (ret > 0) { ++ if (ret != 's') ++ return -EINVAL; ++ } else { ++ return ret; ++ } ++ ret = rpisense_reg_read(rpisense, RPISENSE_VER); ++ if (ret < 0) ++ return ret; + -+/{ -+ compatible = "brcm,bcm2708"; ++ dev_info(rpisense->dev, ++ "Raspberry Pi Sense HAT firmware version %i\n", ret); + -+ fragment@0 { -+ target = <&usb>; -+ #address-cells = <1>; -+ #size-cells = <1>; -+ __overlay__ { -+ compatible = "brcm,bcm2835-usb"; -+ reg = <0x7e980000 0x10000>; -+ interrupts = <1 9>; -+ dr_mode = "otg"; -+ g-np-tx-fifo-size = <32>; -+ g-rx-fifo-size = <256>; -+ g-tx-fifo-size = <256 128 128 64 64 64 32>; -+ status = "okay"; -+ }; -+ }; ++ rpisense_js = &rpisense->joystick; ++ rpisense_js->keys_desc = devm_gpiod_get(&i2c->dev, ++ "keys-int", GPIOD_IN); ++ if (IS_ERR(rpisense_js->keys_desc)) { ++ dev_warn(&i2c->dev, "Failed to get keys-int descriptor.\n"); ++ rpisense_js->keys_desc = gpio_to_desc(23); ++ if (rpisense_js->keys_desc == NULL) { ++ dev_err(&i2c->dev, "GPIO23 fallback failed.\n"); ++ return PTR_ERR(rpisense_js->keys_desc); ++ } ++ } ++ rpisense_client_dev_register(rpisense, "rpi-sense-js", ++ &(rpisense->joystick.pdev)); ++ rpisense_client_dev_register(rpisense, "rpi-sense-fb", ++ &(rpisense->framebuffer.pdev)); + -+ __overrides__ { -+ dr_mode = <&usb>, "dr_mode"; -+ g-np-tx-fifo-size = <&usb>,"g-np-tx-fifo-size:0"; -+ g-rx-fifo-size = <&usb>,"g-rx-fifo-size:0"; -+ g-tx-fifo-size = <&usb>,"g-tx-fifo-size:0"; -+ }; ++ return 0; ++} ++ ++static int rpisense_remove(struct i2c_client *i2c) ++{ ++ struct rpisense *rpisense = i2c_get_clientdata(i2c); ++ ++ platform_device_unregister(rpisense->joystick.pdev); ++ return 0; ++} ++ ++struct rpisense *rpisense_get_dev(void) ++{ ++ return rpisense; ++} ++EXPORT_SYMBOL_GPL(rpisense_get_dev); ++ ++s32 rpisense_reg_read(struct rpisense *rpisense, int reg) ++{ ++ int ret = i2c_smbus_read_byte_data(rpisense->i2c_client, reg); ++ ++ if (ret < 0) ++ dev_err(rpisense->dev, "Read from reg %d failed\n", reg); ++ /* Due to the BCM270x I2C clock stretching bug, some values ++ * may have MSB set. Clear it to avoid incorrect values. ++ * */ ++ return ret & 0x7F; ++} ++EXPORT_SYMBOL_GPL(rpisense_reg_read); ++ ++int rpisense_block_write(struct rpisense *rpisense, const char *buf, int count) ++{ ++ int ret = i2c_master_send(rpisense->i2c_client, buf, count); ++ ++ if (ret < 0) ++ dev_err(rpisense->dev, "Block write failed\n"); ++ return ret; ++} ++EXPORT_SYMBOL_GPL(rpisense_block_write); ++ ++static const struct i2c_device_id rpisense_i2c_id[] = { ++ { "rpi-sense", 0 }, ++ { } ++}; ++MODULE_DEVICE_TABLE(i2c, rpisense_i2c_id); ++ ++ ++static struct i2c_driver rpisense_driver = { ++ .driver = { ++ .name = "rpi-sense", ++ .owner = THIS_MODULE, ++ }, ++ .probe = rpisense_probe, ++ .remove = rpisense_remove, ++ .id_table = rpisense_i2c_id, +}; - -From 162dd00041afb2995f90a928ea80aeaa0d141ce5 Mon Sep 17 00:00:00 2001 -From: Phil Elwell <phil@raspberrypi.org> -Date: Mon, 4 Jan 2016 14:42:17 +0000 -Subject: [PATCH 124/170] BCM270X_DT: Add the sdtweak overlay, for tuning - sdhost - -The sdhost overlay declares the sdhost interface and allows parameters -to be set. This is overkill for situations where the user just wants to -tweak the parameters of a pre-declared sdhost interface, so create an -sdtweak overlay that does just that. ---- - arch/arm/boot/dts/overlays/Makefile | 1 + - arch/arm/boot/dts/overlays/README | 14 ++++++++++++++ - arch/arm/boot/dts/overlays/sdtweak-overlay.dts | 21 +++++++++++++++++++++ - 3 files changed, 36 insertions(+) - create mode 100644 arch/arm/boot/dts/overlays/sdtweak-overlay.dts - -diff --git a/arch/arm/boot/dts/overlays/Makefile b/arch/arm/boot/dts/overlays/Makefile -index aaa8976..4d9d640 100644 ---- a/arch/arm/boot/dts/overlays/Makefile -+++ b/arch/arm/boot/dts/overlays/Makefile -@@ -53,6 +53,7 @@ dtb-$(RPI_DT_OVERLAYS) += rpi-proto-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += rpi-sense-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += sdhost-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += sdio-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += sdtweak-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += smi-dev-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += smi-nand-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += smi-overlay.dtb -diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README -index c70c1e59..00f03fc 100644 ---- a/arch/arm/boot/dts/overlays/README -+++ b/arch/arm/boot/dts/overlays/README -@@ -635,6 +635,20 @@ Params: overclock_50 Clock (in MHz) to use when the MMC framework - (default on: polling once at boot-time) - - -+Name: sdtweak -+Info: Tunes the bcm2835-sdhost SD/MMC driver -+Load: dtoverlay=sdtweak,<param>=<val> -+Params: overclock_50 Clock (in MHz) to use when the MMC framework -+ requests 50MHz + -+ force_pio Disable DMA support (default off) ++module_i2c_driver(rpisense_driver); + -+ pio_limit Number of blocks above which to use DMA -+ (default 1) ++MODULE_DESCRIPTION("Raspberry Pi Sense HAT core driver"); ++MODULE_AUTHOR("Serge Schneider <serge@raspberrypi.org>"); ++MODULE_LICENSE("GPL"); + -+ debug Enable debug output (default off) +diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig +index ee72c3a..5be1a31 100644 +--- a/drivers/video/fbdev/Kconfig ++++ b/drivers/video/fbdev/Kconfig +@@ -2502,3 +2502,16 @@ config FB_SM712 + This driver is also available as a module. The module will be + called sm712fb. If you want to compile it as a module, say M + here and read <file:Documentation/kbuild/modules.txt>. + ++config FB_RPISENSE ++ tristate "Raspberry Pi Sense HAT framebuffer" ++ depends on FB ++ select MFD_RPISENSE_CORE ++ select FB_SYS_FOPS ++ select FB_SYS_FILLRECT ++ select FB_SYS_COPYAREA ++ select FB_SYS_IMAGEBLIT ++ select FB_DEFERRED_IO + - Name: smi - Info: Enables the Secondary Memory Interface peripheral. Uses GPIOs 2-25! - Load: dtoverlay=smi -diff --git a/arch/arm/boot/dts/overlays/sdtweak-overlay.dts b/arch/arm/boot/dts/overlays/sdtweak-overlay.dts ++ help ++ This is the framebuffer driver for the Raspberry Pi Sense HAT +diff --git a/drivers/video/fbdev/Makefile b/drivers/video/fbdev/Makefile +index df473d8..474c567 100644 +--- a/drivers/video/fbdev/Makefile ++++ b/drivers/video/fbdev/Makefile +@@ -149,6 +149,7 @@ obj-$(CONFIG_FB_DA8XX) += da8xx-fb.o + obj-$(CONFIG_FB_MXS) += mxsfb.o + obj-$(CONFIG_FB_SSD1307) += ssd1307fb.o + obj-$(CONFIG_FB_SIMPLE) += simplefb.o ++obj-$(CONFIG_FB_RPISENSE) += rpisense-fb.o + + # the test framebuffer is last + obj-$(CONFIG_FB_VIRTUAL) += vfb.o +diff --git a/drivers/video/fbdev/rpisense-fb.c b/drivers/video/fbdev/rpisense-fb.c new file mode 100644 -index 0000000..74c168d +index 0000000..26432a5 --- /dev/null -+++ b/arch/arm/boot/dts/overlays/sdtweak-overlay.dts -@@ -0,0 +1,21 @@ -+/dts-v1/; -+/plugin/; ++++ b/drivers/video/fbdev/rpisense-fb.c +@@ -0,0 +1,293 @@ ++/* ++ * Raspberry Pi Sense HAT framebuffer driver ++ * http://raspberrypi.org ++ * ++ * Copyright (C) 2015 Raspberry Pi ++ * ++ * Author: Serge Schneider ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License as published by the ++ * Free Software Foundation; either version 2 of the License, or (at your ++ * option) any later version. ++ * ++ */ + -+/{ -+ compatible = "brcm,bcm2708"; ++#include <linux/module.h> ++#include <linux/kernel.h> ++#include <linux/errno.h> ++#include <linux/string.h> ++#include <linux/mm.h> ++#include <linux/slab.h> ++#include <linux/uaccess.h> ++#include <linux/delay.h> ++#include <linux/fb.h> ++#include <linux/init.h> + -+ fragment@0 { -+ target = <&sdhost>; -+ frag1: __overlay__ { -+ brcm,overclock-50 = <0>; -+ brcm,pio-limit = <1>; -+ }; -+ }; ++#include <linux/mfd/rpisense/framebuffer.h> ++#include <linux/mfd/rpisense/core.h> + -+ __overrides__ { -+ overclock_50 = <&frag1>,"brcm,overclock-50:0"; -+ force_pio = <&frag1>,"brcm,force-pio?"; -+ pio_limit = <&frag1>,"brcm,pio-limit:0"; -+ debug = <&frag1>,"brcm,debug?"; -+ }; ++static bool lowlight; ++module_param(lowlight, bool, 0); ++MODULE_PARM_DESC(lowlight, "Reduce LED matrix brightness to one third"); ++ ++static struct rpisense *rpisense; ++ ++struct rpisense_fb_param { ++ char __iomem *vmem; ++ u8 *vmem_work; ++ u32 vmemsize; ++ u8 *gamma; +}; - -From b07c427a7732a0fabcf521085e0fd61b0ef9047c Mon Sep 17 00:00:00 2001 -From: Andrew Litt <ajlitt@splunge.net> -Date: Mon, 11 Jan 2016 07:54:21 +0000 -Subject: [PATCH 125/170] bcm2835-mmc: Don't override bus width capabilities - from devicetree - -Take out the force setting of the MMC_CAP_4_BIT_DATA host capability -so that the result read from devicetree via mmc_of_parse() is -preserved. ---- - drivers/mmc/host/bcm2835-mmc.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/drivers/mmc/host/bcm2835-mmc.c b/drivers/mmc/host/bcm2835-mmc.c -index 43aed6e..104f93e 100644 ---- a/drivers/mmc/host/bcm2835-mmc.c -+++ b/drivers/mmc/host/bcm2835-mmc.c -@@ -1305,7 +1305,7 @@ static int bcm2835_mmc_add_host(struct bcm2835_host *host) - /* host controller capabilities */ - mmc->caps |= MMC_CAP_CMD23 | MMC_CAP_ERASE | MMC_CAP_NEEDS_POLL | - MMC_CAP_SDIO_IRQ | MMC_CAP_SD_HIGHSPEED | -- MMC_CAP_MMC_HIGHSPEED | MMC_CAP_4_BIT_DATA; -+ MMC_CAP_MMC_HIGHSPEED; - - mmc->caps2 |= MMC_CAP2_SDIO_IRQ_NOTHREAD; - - -From f74652d026105ecc4a87b581a9c1c89a6e504d2c Mon Sep 17 00:00:00 2001 -From: Andrew Litt <ajlitt@splunge.net> -Date: Mon, 11 Jan 2016 07:55:54 +0000 -Subject: [PATCH 126/170] SDIO-overlay: add bus_width parameter - -Allow setting of the SDIO bus width capability of the bcm2835-mmc -host. This is helpful when only a 1 bit wide bus is connected -between host and device but both host and device advertise 4 bit -mode. ---- - arch/arm/boot/dts/overlays/README | 2 ++ - arch/arm/boot/dts/overlays/sdio-overlay.dts | 2 ++ - 2 files changed, 4 insertions(+) - -diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README -index 00f03fc..aa57078 100644 ---- a/arch/arm/boot/dts/overlays/README -+++ b/arch/arm/boot/dts/overlays/README -@@ -634,6 +634,8 @@ Params: overclock_50 Clock (in MHz) to use when the MMC framework - poll_once Disable SDIO-device polling every second - (default on: polling once at boot-time) - -+ bus_width Set the SDIO host bus width (default 4 bits) + - - Name: sdtweak - Info: Tunes the bcm2835-sdhost SD/MMC driver -diff --git a/arch/arm/boot/dts/overlays/sdio-overlay.dts b/arch/arm/boot/dts/overlays/sdio-overlay.dts -index afc8742..7935e7a 100644 ---- a/arch/arm/boot/dts/overlays/sdio-overlay.dts -+++ b/arch/arm/boot/dts/overlays/sdio-overlay.dts -@@ -11,6 +11,7 @@ - pinctrl-names = "default"; - pinctrl-0 = <&sdio_pins>; - non-removable; -+ bus-width = <4>; - status = "okay"; - }; - }; -@@ -28,5 +29,6 @@ - - __overrides__ { - poll_once = <&sdio_mmc>,"non-removable?"; -+ bus_width = <&sdio_mmc>,"bus-width:0"; - }; - }; - -From 232754cb0ecd1967a8b72d6bd05467843d65a441 Mon Sep 17 00:00:00 2001 -From: Phil Elwell <phil@raspberrypi.org> -Date: Fri, 8 Jan 2016 13:42:06 +0000 -Subject: [PATCH 127/170] FIXUP BCM270X_DT: "random" (HWRNG) dtparam default is - on - ---- - arch/arm/boot/dts/overlays/README | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README -index aa57078..34a1b7f 100644 ---- a/arch/arm/boot/dts/overlays/README -+++ b/arch/arm/boot/dts/overlays/README -@@ -110,7 +110,7 @@ Params: - (default "off") - - random Set to "on" to enable the hardware random -- number generator (default "off") -+ number generator (default "on") - - uart0 Set to "off" to disable uart0 (default "on") - - -From 320bdec200197f074541e3999fa4b87889c5eb18 Mon Sep 17 00:00:00 2001 -From: wm4 <wm4@nowhere> -Date: Wed, 13 Jan 2016 19:41:45 +0100 -Subject: [PATCH 128/170] bcm2835: extend allowed range of channels and - samplerates - -Allow everything the videocore accepts. ---- - sound/arm/bcm2835-pcm.c | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -diff --git a/sound/arm/bcm2835-pcm.c b/sound/arm/bcm2835-pcm.c -index 8c86375..31e3131 100755 ---- a/sound/arm/bcm2835-pcm.c -+++ b/sound/arm/bcm2835-pcm.c -@@ -26,9 +26,9 @@ static struct snd_pcm_hardware snd_bcm2835_playback_hw = { - .formats = SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE, - .rates = SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_8000_48000, - .rate_min = 8000, -- .rate_max = 48000, -+ .rate_max = 192000, - .channels_min = 1, -- .channels_max = 2, -+ .channels_max = 8, - .buffer_bytes_max = 128 * 1024, - .period_bytes_min = 1 * 1024, - .period_bytes_max = 128 * 1024, -@@ -43,9 +43,9 @@ static struct snd_pcm_hardware snd_bcm2835_playback_spdif_hw = { - .rates = SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_44100 | - SNDRV_PCM_RATE_48000, - .rate_min = 44100, -- .rate_max = 48000, -+ .rate_max = 192000, - .channels_min = 2, -- .channels_max = 2, -+ .channels_max = 8, - .buffer_bytes_max = 128 * 1024, - .period_bytes_min = 1 * 1024, - .period_bytes_max = 128 * 1024, - -From 7e634c8f8fe70286e0b8b404494d3143aa7bc3fc Mon Sep 17 00:00:00 2001 -From: wm4 <wm4@nowhere> -Date: Wed, 13 Jan 2016 19:42:18 +0100 -Subject: [PATCH 129/170] bcm2835: restrict channels*rate to 8*960000 - -This is required at least for SPDIF. If the bitrate goes above, -videocore will either resample the audio or corrupt it due to -underruns. Supposedly the hardware isn't designed to output -higher rates, but it can still resample it down to supported -rates. - -Some code is based on ac97_pcm.c. ---- - sound/arm/bcm2835-pcm.c | 41 +++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 41 insertions(+) - -diff --git a/sound/arm/bcm2835-pcm.c b/sound/arm/bcm2835-pcm.c -index 31e3131..b17ed32 100755 ---- a/sound/arm/bcm2835-pcm.c -+++ b/sound/arm/bcm2835-pcm.c -@@ -19,6 +19,9 @@ - - #include "bcm2835.h" - -+/* The hardware can not do much more num_channels*samplerate then this value */ -+#define MAX_COMBINED_RATE 768000 ++static u8 gamma_default[32] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, ++ 0x02, 0x02, 0x03, 0x03, 0x04, 0x05, 0x06, 0x07, ++ 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0E, 0x0F, 0x11, ++ 0x12, 0x14, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F,}; + - /* hardware definition */ - static struct snd_pcm_hardware snd_bcm2835_playback_hw = { - .info = (SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | -@@ -107,6 +110,31 @@ static irqreturn_t bcm2835_playback_fifo_irq(int irq, void *dev_id) - return IRQ_HANDLED; - } - ++static u8 gamma_low[32] = {0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, ++ 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, ++ 0x03, 0x03, 0x03, 0x04, 0x04, 0x05, 0x05, 0x06, ++ 0x06, 0x07, 0x07, 0x08, 0x08, 0x09, 0x0A, 0x0A,}; ++ ++static u8 gamma_user[32]; ++ ++static struct rpisense_fb_param rpisense_fb_param = { ++ .vmem = NULL, ++ .vmemsize = 128, ++ .gamma = gamma_default, ++}; ++ ++static struct fb_deferred_io rpisense_fb_defio; ++ ++static struct fb_fix_screeninfo rpisense_fb_fix = { ++ .id = "RPi-Sense FB", ++ .type = FB_TYPE_PACKED_PIXELS, ++ .visual = FB_VISUAL_TRUECOLOR, ++ .xpanstep = 0, ++ .ypanstep = 0, ++ .ywrapstep = 0, ++ .accel = FB_ACCEL_NONE, ++ .line_length = 16, ++}; + -+static int rate_hw_constraint_rate(struct snd_pcm_hw_params *params, -+ struct snd_pcm_hw_rule *rule) ++static struct fb_var_screeninfo rpisense_fb_var = { ++ .xres = 8, ++ .yres = 8, ++ .xres_virtual = 8, ++ .yres_virtual = 8, ++ .bits_per_pixel = 16, ++ .red = {11, 5, 0}, ++ .green = {5, 6, 0}, ++ .blue = {0, 5, 0}, ++}; ++ ++static ssize_t rpisense_fb_write(struct fb_info *info, ++ const char __user *buf, size_t count, ++ loff_t *ppos) +{ -+ struct snd_interval *channels = hw_param_interval(params, SNDRV_PCM_HW_PARAM_CHANNELS); -+ struct snd_interval rates = { -+ .min = 8000, -+ .max = min(192000u, MAX_COMBINED_RATE / max(channels->min, 1u)), -+ }; -+ struct snd_interval *rate = hw_param_interval(params, SNDRV_PCM_HW_PARAM_RATE); -+ return snd_interval_refine(rate, &rates); ++ ssize_t res = fb_sys_write(info, buf, count, ppos); ++ ++ schedule_delayed_work(&info->deferred_work, rpisense_fb_defio.delay); ++ return res; +} + -+static int rate_hw_constraint_channels(struct snd_pcm_hw_params *params, -+ struct snd_pcm_hw_rule *rule) ++static void rpisense_fb_fillrect(struct fb_info *info, ++ const struct fb_fillrect *rect) +{ -+ struct snd_interval *rate = hw_param_interval(params, SNDRV_PCM_HW_PARAM_RATE); -+ struct snd_interval channels_interval = { -+ .min = 1, -+ .max = min(8u, MAX_COMBINED_RATE / max(rate->min, 1u)), -+ }; -+ struct snd_interval *channels = hw_param_interval(params, SNDRV_PCM_HW_PARAM_CHANNELS); -+ return snd_interval_refine(channels, &channels_interval); ++ sys_fillrect(info, rect); ++ schedule_delayed_work(&info->deferred_work, rpisense_fb_defio.delay); +} + - /* open callback */ - static int snd_bcm2835_playback_open_generic( - struct snd_pcm_substream *substream, int spdif) -@@ -188,6 +216,19 @@ static int snd_bcm2835_playback_open_generic( - snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, - 16); - -+ /* When playing PCM, pretend that we support the full range of channels -+ * and sample rates. The GPU can't output it, but is able to resample -+ * the data to a rate the hardware can handle it. This won't work with -+ * compressed data; the resampler would just destroy it. */ -+ if (spdif) { -+ err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, -+ rate_hw_constraint_rate, NULL, -+ SNDRV_PCM_HW_PARAM_CHANNELS, -1); -+ err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS, -+ rate_hw_constraint_channels, NULL, -+ SNDRV_PCM_HW_PARAM_RATE, -1); -+ } ++static void rpisense_fb_copyarea(struct fb_info *info, ++ const struct fb_copyarea *area) ++{ ++ sys_copyarea(info, area); ++ schedule_delayed_work(&info->deferred_work, rpisense_fb_defio.delay); ++} + - chip->alsa_stream[idx] = alsa_stream; - - chip->opened |= (1 << idx); - -From dcead34f063fc8c37ebfcfc9ab6696060c336bad Mon Sep 17 00:00:00 2001 -From: wm4 <wm4@nowhere> -Date: Wed, 13 Jan 2016 19:42:48 +0100 -Subject: [PATCH 130/170] rpi: update vc_vchi_audioserv_defs.h - -Add audioserv 3 extensions. The changes were taken from the paste -linked here: - -https://github.com/raspberrypi/linux/pull/1166#issuecomment-151917067 ---- - sound/arm/vc_vchi_audioserv_defs.h | 13 +++++++++++-- - 1 file changed, 11 insertions(+), 2 deletions(-) - -diff --git a/sound/arm/vc_vchi_audioserv_defs.h b/sound/arm/vc_vchi_audioserv_defs.h -index af3e6eb..5f4409f 100644 ---- a/sound/arm/vc_vchi_audioserv_defs.h -+++ b/sound/arm/vc_vchi_audioserv_defs.h -@@ -16,7 +16,7 @@ - #define _VC_AUDIO_DEFS_H_ - - #define VC_AUDIOSERV_MIN_VER 1 --#define VC_AUDIOSERV_VER 2 -+#define VC_AUDIOSERV_VER 3 - - // FourCC code used for VCHI connection - #define VC_AUDIO_SERVER_NAME MAKE_FOURCC("AUDS") -@@ -36,6 +36,7 @@ typedef enum { - VC_AUDIO_MSG_TYPE_START, // Configure audio - VC_AUDIO_MSG_TYPE_STOP, // Configure audio - VC_AUDIO_MSG_TYPE_WRITE, // Configure audio -+ VC_AUDIO_MSG_TYPE_LATENCY, // request latency in cycles - VC_AUDIO_MSG_TYPE_MAX - } VC_AUDIO_MSG_TYPE; - -@@ -44,6 +45,7 @@ typedef struct { - uint32_t channels; - uint32_t samplerate; - uint32_t bps; -+ uint32_t channelmap; - - } VC_AUDIO_CONFIG_T; - -@@ -84,6 +86,12 @@ typedef struct { - uint16_t max_packet; - } VC_AUDIO_WRITE_T; - -+// query latency in samples of sink -+typedef struct ++static void rpisense_fb_imageblit(struct fb_info *info, ++ const struct fb_image *image) +{ -+ uint32_t dummy; -+} VC_AUDIO_LATENCY_T; -+ - // Generic result for a request (VC->HOST) - typedef struct { - int32_t success; // Success value -@@ -108,9 +116,10 @@ typedef struct { - VC_AUDIO_START_T start; - VC_AUDIO_STOP_T stop; - VC_AUDIO_WRITE_T write; -+ VC_AUDIO_LATENCY_T latency; - VC_AUDIO_RESULT_T result; - VC_AUDIO_COMPLETE_T complete; - } u; - } VC_AUDIO_MSG_T; - --#endif // _VC_AUDIO_DEFS_H_ -+#endif // _VC_AUDIO_DEFS_H_ -\ No newline at end of file - -From 7c7d2db494fbf1fd0b014dab0bb4c5c740f90442 Mon Sep 17 00:00:00 2001 -From: wm4 <wm4@nowhere> -Date: Wed, 13 Jan 2016 19:43:12 +0100 -Subject: [PATCH 131/170] bcm2835: implement channel map API - -Report all layouts supported by the HDMI protocol to userspace. -Make the videocore set the correct layout according to the -userspace request. - -Some code taken from patch_hdmi.c. In particular, the HDMI channel -layout table was copied without changes - with the idea in mind that -hopefully it can be shared one day. Or at least updating it will be -simpler. - -In my tests, everything appears to work, except when outputting -FL FR RL RR. Then my receiver outputs RL on both the RL and RR -speakers, while RR is never heard. ---- - sound/arm/bcm2835-ctl.c | 276 ++++++++++++++++++++++++++++++++++++++++++++++ - sound/arm/bcm2835-pcm.c | 22 +++- - sound/arm/bcm2835-vchiq.c | 13 +++ - sound/arm/bcm2835.h | 4 + - 4 files changed, 311 insertions(+), 4 deletions(-) - -diff --git a/sound/arm/bcm2835-ctl.c b/sound/arm/bcm2835-ctl.c -index aad905f..92d3f76 100755 ---- a/sound/arm/bcm2835-ctl.c -+++ b/sound/arm/bcm2835-ctl.c -@@ -300,6 +300,281 @@ static struct snd_kcontrol_new snd_bcm2835_spdif[] = { - }, - }; - -+struct cea_channel_speaker_allocation { -+ int ca_index; -+ int speakers[8]; -+}; -+ -+#define FL SNDRV_CHMAP_FL -+#define FR SNDRV_CHMAP_FR -+#define RL SNDRV_CHMAP_RL -+#define RR SNDRV_CHMAP_RR -+#define LFE SNDRV_CHMAP_LFE -+#define FC SNDRV_CHMAP_FC -+#define RLC SNDRV_CHMAP_RLC -+#define RRC SNDRV_CHMAP_RRC -+#define RC SNDRV_CHMAP_RC -+#define FLC SNDRV_CHMAP_FLC -+#define FRC SNDRV_CHMAP_FRC -+#define FLH SNDRV_CHMAP_TFL -+#define FRH SNDRV_CHMAP_TFR -+#define FLW SNDRV_CHMAP_FLW -+#define FRW SNDRV_CHMAP_FRW -+#define TC SNDRV_CHMAP_TC -+#define FCH SNDRV_CHMAP_TFC ++ sys_imageblit(info, image); ++ schedule_delayed_work(&info->deferred_work, rpisense_fb_defio.delay); ++} + -+/* -+ * CEA-861 channel maps -+ * -+ * Stolen from sound/pci/hda/patch_hdmi.c -+ * (unlike the source, this uses SNDRV_* constants directly, as by the -+ * map_tables array in patch_hdmi.c) -+ * Unknown entries use 0, which unfortunately is SNDRV_CHMAP_UNKNOWN instead -+ * of SNDRV_CHMAP_NA. -+ */ -+static struct cea_channel_speaker_allocation channel_allocations[] = { -+/* channel: 7 6 5 4 3 2 1 0 */ -+{ .ca_index = 0x00, .speakers = { 0, 0, 0, 0, 0, 0, FR, FL } }, -+ /* 2.1 */ -+{ .ca_index = 0x01, .speakers = { 0, 0, 0, 0, 0, LFE, FR, FL } }, -+ /* Dolby Surround */ -+{ .ca_index = 0x02, .speakers = { 0, 0, 0, 0, FC, 0, FR, FL } }, -+ /* surround40 */ -+{ .ca_index = 0x08, .speakers = { 0, 0, RR, RL, 0, 0, FR, FL } }, -+ /* surround41 */ -+{ .ca_index = 0x09, .speakers = { 0, 0, RR, RL, 0, LFE, FR, FL } }, -+ /* surround50 */ -+{ .ca_index = 0x0a, .speakers = { 0, 0, RR, RL, FC, 0, FR, FL } }, -+ /* surround51 */ -+{ .ca_index = 0x0b, .speakers = { 0, 0, RR, RL, FC, LFE, FR, FL } }, -+ /* 6.1 */ -+{ .ca_index = 0x0f, .speakers = { 0, RC, RR, RL, FC, LFE, FR, FL } }, -+ /* surround71 */ -+{ .ca_index = 0x13, .speakers = { RRC, RLC, RR, RL, FC, LFE, FR, FL } }, -+ -+{ .ca_index = 0x03, .speakers = { 0, 0, 0, 0, FC, LFE, FR, FL } }, -+{ .ca_index = 0x04, .speakers = { 0, 0, 0, RC, 0, 0, FR, FL } }, -+{ .ca_index = 0x05, .speakers = { 0, 0, 0, RC, 0, LFE, FR, FL } }, -+{ .ca_index = 0x06, .speakers = { 0, 0, 0, RC, FC, 0, FR, FL } }, -+{ .ca_index = 0x07, .speakers = { 0, 0, 0, RC, FC, LFE, FR, FL } }, -+{ .ca_index = 0x0c, .speakers = { 0, RC, RR, RL, 0, 0, FR, FL } }, -+{ .ca_index = 0x0d, .speakers = { 0, RC, RR, RL, 0, LFE, FR, FL } }, -+{ .ca_index = 0x0e, .speakers = { 0, RC, RR, RL, FC, 0, FR, FL } }, -+{ .ca_index = 0x10, .speakers = { RRC, RLC, RR, RL, 0, 0, FR, FL } }, -+{ .ca_index = 0x11, .speakers = { RRC, RLC, RR, RL, 0, LFE, FR, FL } }, -+{ .ca_index = 0x12, .speakers = { RRC, RLC, RR, RL, FC, 0, FR, FL } }, -+{ .ca_index = 0x14, .speakers = { FRC, FLC, 0, 0, 0, 0, FR, FL } }, -+{ .ca_index = 0x15, .speakers = { FRC, FLC, 0, 0, 0, LFE, FR, FL } }, -+{ .ca_index = 0x16, .speakers = { FRC, FLC, 0, 0, FC, 0, FR, FL } }, -+{ .ca_index = 0x17, .speakers = { FRC, FLC, 0, 0, FC, LFE, FR, FL } }, -+{ .ca_index = 0x18, .speakers = { FRC, FLC, 0, RC, 0, 0, FR, FL } }, -+{ .ca_index = 0x19, .speakers = { FRC, FLC, 0, RC, 0, LFE, FR, FL } }, -+{ .ca_index = 0x1a, .speakers = { FRC, FLC, 0, RC, FC, 0, FR, FL } }, -+{ .ca_index = 0x1b, .speakers = { FRC, FLC, 0, RC, FC, LFE, FR, FL } }, -+{ .ca_index = 0x1c, .speakers = { FRC, FLC, RR, RL, 0, 0, FR, FL } }, -+{ .ca_index = 0x1d, .speakers = { FRC, FLC, RR, RL, 0, LFE, FR, FL } }, -+{ .ca_index = 0x1e, .speakers = { FRC, FLC, RR, RL, FC, 0, FR, FL } }, -+{ .ca_index = 0x1f, .speakers = { FRC, FLC, RR, RL, FC, LFE, FR, FL } }, -+{ .ca_index = 0x20, .speakers = { 0, FCH, RR, RL, FC, 0, FR, FL } }, -+{ .ca_index = 0x21, .speakers = { 0, FCH, RR, RL, FC, LFE, FR, FL } }, -+{ .ca_index = 0x22, .speakers = { TC, 0, RR, RL, FC, 0, FR, FL } }, -+{ .ca_index = 0x23, .speakers = { TC, 0, RR, RL, FC, LFE, FR, FL } }, -+{ .ca_index = 0x24, .speakers = { FRH, FLH, RR, RL, 0, 0, FR, FL } }, -+{ .ca_index = 0x25, .speakers = { FRH, FLH, RR, RL, 0, LFE, FR, FL } }, -+{ .ca_index = 0x26, .speakers = { FRW, FLW, RR, RL, 0, 0, FR, FL } }, -+{ .ca_index = 0x27, .speakers = { FRW, FLW, RR, RL, 0, LFE, FR, FL } }, -+{ .ca_index = 0x28, .speakers = { TC, RC, RR, RL, FC, 0, FR, FL } }, -+{ .ca_index = 0x29, .speakers = { TC, RC, RR, RL, FC, LFE, FR, FL } }, -+{ .ca_index = 0x2a, .speakers = { FCH, RC, RR, RL, FC, 0, FR, FL } }, -+{ .ca_index = 0x2b, .speakers = { FCH, RC, RR, RL, FC, LFE, FR, FL } }, -+{ .ca_index = 0x2c, .speakers = { TC, FCH, RR, RL, FC, 0, FR, FL } }, -+{ .ca_index = 0x2d, .speakers = { TC, FCH, RR, RL, FC, LFE, FR, FL } }, -+{ .ca_index = 0x2e, .speakers = { FRH, FLH, RR, RL, FC, 0, FR, FL } }, -+{ .ca_index = 0x2f, .speakers = { FRH, FLH, RR, RL, FC, LFE, FR, FL } }, -+{ .ca_index = 0x30, .speakers = { FRW, FLW, RR, RL, FC, 0, FR, FL } }, -+{ .ca_index = 0x31, .speakers = { FRW, FLW, RR, RL, FC, LFE, FR, FL } }, -+}; -+ -+static int snd_bcm2835_chmap_ctl_tlv(struct snd_kcontrol *kcontrol, int op_flag, -+ unsigned int size, unsigned int __user *tlv) -+{ -+ unsigned int __user *dst; -+ int count = 0; ++static void rpisense_fb_deferred_io(struct fb_info *info, ++ struct list_head *pagelist) ++{ + int i; ++ int j; ++ u8 *vmem_work = rpisense_fb_param.vmem_work; ++ u16 *mem = (u16 *)rpisense_fb_param.vmem; ++ u8 *gamma = rpisense_fb_param.gamma; + -+ if (size < 8) -+ return -ENOMEM; -+ if (put_user(SNDRV_CTL_TLVT_CONTAINER, tlv)) -+ return -EFAULT; -+ size -= 8; -+ dst = tlv + 2; -+ for (i = 0; i < ARRAY_SIZE(channel_allocations); i++) { -+ struct cea_channel_speaker_allocation *ch = &channel_allocations[i]; -+ int num_chs = 0; -+ int chs_bytes; -+ int c; -+ -+ for (c = 0; c < 8; c++) { -+ if (ch->speakers[c]) -+ num_chs++; ++ vmem_work[0] = 0; ++ for (j = 0; j < 8; j++) { ++ for (i = 0; i < 8; i++) { ++ vmem_work[(j * 24) + i + 1] = ++ gamma[(mem[(j * 8) + i] >> 11) & 0x1F]; ++ vmem_work[(j * 24) + (i + 8) + 1] = ++ gamma[(mem[(j * 8) + i] >> 6) & 0x1F]; ++ vmem_work[(j * 24) + (i + 16) + 1] = ++ gamma[(mem[(j * 8) + i]) & 0x1F]; + } ++ } ++ rpisense_block_write(rpisense, vmem_work, 193); ++} + -+ chs_bytes = num_chs * 4; -+ if (size < 8) -+ return -ENOMEM; -+ if (put_user(SNDRV_CTL_TLVT_CHMAP_FIXED, dst) || -+ put_user(chs_bytes, dst + 1)) ++static struct fb_deferred_io rpisense_fb_defio = { ++ .delay = HZ/100, ++ .deferred_io = rpisense_fb_deferred_io, ++}; ++ ++static int rpisense_fb_ioctl(struct fb_info *info, unsigned int cmd, ++ unsigned long arg) ++{ ++ switch (cmd) { ++ case SENSEFB_FBIOGET_GAMMA: ++ if (copy_to_user((void __user *) arg, rpisense_fb_param.gamma, ++ sizeof(u8[32]))) + return -EFAULT; -+ dst += 2; -+ size -= 8; -+ count += 8; -+ if (size < chs_bytes) -+ return -ENOMEM; -+ size -= chs_bytes; -+ count += chs_bytes; -+ for (c = 0; c < 8; c++) { -+ int sp = ch->speakers[7 - c]; -+ if (sp) { -+ if (put_user(sp, dst)) -+ return -EFAULT; -+ dst++; -+ } ++ return 0; ++ case SENSEFB_FBIOSET_GAMMA: ++ if (copy_from_user(gamma_user, (void __user *)arg, ++ sizeof(u8[32]))) ++ return -EFAULT; ++ rpisense_fb_param.gamma = gamma_user; ++ schedule_delayed_work(&info->deferred_work, ++ rpisense_fb_defio.delay); ++ return 0; ++ case SENSEFB_FBIORESET_GAMMA: ++ switch (arg) { ++ case 0: ++ rpisense_fb_param.gamma = gamma_default; ++ break; ++ case 1: ++ rpisense_fb_param.gamma = gamma_low; ++ break; ++ case 2: ++ rpisense_fb_param.gamma = gamma_user; ++ break; ++ default: ++ return -EINVAL; + } ++ schedule_delayed_work(&info->deferred_work, ++ rpisense_fb_defio.delay); ++ break; ++ default: ++ return -EINVAL; + } -+ if (put_user(count, tlv + 1)) -+ return -EFAULT; + return 0; +} + -+static int snd_bcm2835_chmap_ctl_get(struct snd_kcontrol *kcontrol, -+ struct snd_ctl_elem_value *ucontrol) ++static struct fb_ops rpisense_fb_ops = { ++ .owner = THIS_MODULE, ++ .fb_read = fb_sys_read, ++ .fb_write = rpisense_fb_write, ++ .fb_fillrect = rpisense_fb_fillrect, ++ .fb_copyarea = rpisense_fb_copyarea, ++ .fb_imageblit = rpisense_fb_imageblit, ++ .fb_ioctl = rpisense_fb_ioctl, ++}; ++ ++static int rpisense_fb_probe(struct platform_device *pdev) +{ -+ struct snd_pcm_chmap *info = snd_kcontrol_chip(kcontrol); -+ bcm2835_chip_t *chip = info->private_data; -+ unsigned int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); -+ struct snd_pcm_substream *substream = snd_pcm_chmap_substream(info, idx); -+ struct cea_channel_speaker_allocation *ch = NULL; -+ int cur = 0; -+ int i; ++ struct fb_info *info; ++ int ret = -ENOMEM; ++ struct rpisense_fb *rpisense_fb; + -+ if (!substream || !substream->runtime) -+ return -ENODEV; ++ rpisense = rpisense_get_dev(); ++ rpisense_fb = &rpisense->framebuffer; + -+ for (i = 0; i < ARRAY_SIZE(channel_allocations); i++) { -+ if (channel_allocations[i].ca_index == chip->cea_chmap) -+ ch = &channel_allocations[i]; -+ } ++ rpisense_fb_param.vmem = vzalloc(rpisense_fb_param.vmemsize); ++ if (!rpisense_fb_param.vmem) ++ return ret; + -+ /* If no layout was set yet, return a dummy. Apparently the userspace -+ * API will be confused if we don't. */ -+ if (!ch) -+ ch = &channel_allocations[0]; ++ rpisense_fb_param.vmem_work = devm_kmalloc(&pdev->dev, 193, GFP_KERNEL); ++ if (!rpisense_fb_param.vmem_work) ++ goto err_malloc; + -+ for (i = 0; i < 8; i++) { -+ if (ch->speakers[7 - i]) -+ ucontrol->value.integer.value[cur++] = ch->speakers[7 - i]; ++ info = framebuffer_alloc(0, &pdev->dev); ++ if (!info) { ++ dev_err(&pdev->dev, "Could not allocate framebuffer.\n"); ++ goto err_malloc; + } -+ while (cur < 8) -+ ucontrol->value.integer.value[cur++] = SNDRV_CHMAP_NA; -+ return 0; -+} -+ -+static int snd_bcm2835_chmap_ctl_put(struct snd_kcontrol *kcontrol, -+ struct snd_ctl_elem_value *ucontrol) -+{ -+ struct snd_pcm_chmap *info = snd_kcontrol_chip(kcontrol); -+ bcm2835_chip_t *chip = info->private_data; -+ unsigned int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); -+ struct snd_pcm_substream *substream = snd_pcm_chmap_substream(info, idx); -+ int i, prepared = 0, cea_chmap = -1; -+ int remap[8]; ++ rpisense_fb->info = info; + -+ if (!substream || !substream->runtime) -+ return -ENODEV; ++ rpisense_fb_fix.smem_start = (unsigned long)rpisense_fb_param.vmem; ++ rpisense_fb_fix.smem_len = rpisense_fb_param.vmemsize; + -+ switch (substream->runtime->status->state) { -+ case SNDRV_PCM_STATE_OPEN: -+ case SNDRV_PCM_STATE_SETUP: -+ break; -+ case SNDRV_PCM_STATE_PREPARED: -+ prepared = 1; -+ break; -+ default: -+ return -EBUSY; -+ } ++ info->fbops = &rpisense_fb_ops; ++ info->fix = rpisense_fb_fix; ++ info->var = rpisense_fb_var; ++ info->fbdefio = &rpisense_fb_defio; ++ info->flags = FBINFO_FLAG_DEFAULT | FBINFO_VIRTFB; ++ info->screen_base = rpisense_fb_param.vmem; ++ info->screen_size = rpisense_fb_param.vmemsize; + -+ for (i = 0; i < ARRAY_SIZE(channel_allocations); i++) { -+ struct cea_channel_speaker_allocation *ch = &channel_allocations[i]; -+ int matches = 1; -+ int cur = 0; -+ int x; -+ memset(remap, 0, sizeof(remap)); -+ for (x = 0; x < substream->runtime->channels; x++) { -+ int sp = ucontrol->value.integer.value[x]; -+ while (cur < 8 && !ch->speakers[7 - cur]) -+ cur++; -+ if (cur >= 8) { -+ /* user has more channels than ch */ -+ matches = 0; -+ break; -+ } -+ if (ch->speakers[7 - cur] != sp) { -+ matches = 0; -+ break; -+ } -+ remap[x] = cur; -+ cur++; -+ } -+ for (x = cur; x < 8; x++) { -+ if (ch->speakers[7 - x]) { -+ /* ch has more channels than user */ -+ matches = 0; -+ break; -+ } -+ } -+ if (matches) { -+ cea_chmap = ch->ca_index; -+ break; -+ } -+ } ++ if (lowlight) ++ rpisense_fb_param.gamma = gamma_low; + -+ if (cea_chmap < 0) -+ return -EINVAL; ++ fb_deferred_io_init(info); + -+ /* don't change the layout if another substream is active */ -+ if (chip->opened != (1 << substream->number) && chip->cea_chmap != cea_chmap) -+ return -EBUSY; /* unsure whether this is a good error code */ ++ ret = register_framebuffer(info); ++ if (ret < 0) { ++ dev_err(&pdev->dev, "Could not register framebuffer.\n"); ++ goto err_fballoc; ++ } + -+ chip->cea_chmap = cea_chmap; -+ for (i = 0; i < 8; i++) -+ chip->map_channels[i] = remap[i]; -+ if (prepared) -+ snd_bcm2835_pcm_prepare_again(substream); ++ fb_info(info, "%s frame buffer device\n", info->fix.id); ++ schedule_delayed_work(&info->deferred_work, rpisense_fb_defio.delay); + return 0; ++err_fballoc: ++ framebuffer_release(info); ++err_malloc: ++ vfree(rpisense_fb_param.vmem); ++ return ret; +} + -+static int snd_bcm2835_add_chmap_ctl(bcm2835_chip_t * chip) ++static int rpisense_fb_remove(struct platform_device *pdev) +{ -+ struct snd_pcm_chmap *chmap; -+ struct snd_kcontrol *kctl; -+ int err, i; ++ struct rpisense_fb *rpisense_fb = &rpisense->framebuffer; ++ struct fb_info *info = rpisense_fb->info; ++ ++ if (info) { ++ unregister_framebuffer(info); ++ fb_deferred_io_cleanup(info); ++ framebuffer_release(info); ++ vfree(rpisense_fb_param.vmem); ++ } + -+ err = snd_pcm_add_chmap_ctls(chip->pcm, -+ SNDRV_PCM_STREAM_PLAYBACK, -+ NULL, 8, 0, &chmap); -+ if (err < 0) -+ return err; -+ /* override handlers */ -+ chmap->private_data = chip; -+ kctl = chmap->kctl; -+ for (i = 0; i < kctl->count; i++) -+ kctl->vd[i].access |= SNDRV_CTL_ELEM_ACCESS_WRITE; -+ kctl->get = snd_bcm2835_chmap_ctl_get; -+ kctl->put = snd_bcm2835_chmap_ctl_put; -+ kctl->tlv.c = snd_bcm2835_chmap_ctl_tlv; + return 0; +} + - int snd_bcm2835_new_ctl(bcm2835_chip_t * chip) - { - int err; -@@ -313,6 +588,7 @@ int snd_bcm2835_new_ctl(bcm2835_chip_t * chip) - if (err < 0) - return err; - } -+ snd_bcm2835_add_chmap_ctl(chip); - for (idx = 0; idx < ARRAY_SIZE(snd_bcm2835_spdif); idx++) { - err = snd_ctl_add(chip->card, - snd_ctl_new1(&snd_bcm2835_spdif[idx], chip)); -diff --git a/sound/arm/bcm2835-pcm.c b/sound/arm/bcm2835-pcm.c -index b17ed32..1067460 100755 ---- a/sound/arm/bcm2835-pcm.c -+++ b/sound/arm/bcm2835-pcm.c -@@ -231,6 +231,9 @@ static int snd_bcm2835_playback_open_generic( - - chip->alsa_stream[idx] = alsa_stream; - -+ if (!chip->opened) -+ chip->cea_chmap = -1; ++#ifdef CONFIG_OF ++static const struct of_device_id rpisense_fb_id[] = { ++ { .compatible = "rpi,rpi-sense-fb" }, ++ { }, ++}; ++MODULE_DEVICE_TABLE(of, rpisense_fb_id); ++#endif + - chip->opened |= (1 << idx); - alsa_stream->open = 1; - alsa_stream->draining = 1; -@@ -341,8 +344,7 @@ static int snd_bcm2835_pcm_hw_free(struct snd_pcm_substream *substream) - return snd_pcm_lib_free_pages(substream); - } - --/* prepare callback */ --static int snd_bcm2835_pcm_prepare(struct snd_pcm_substream *substream) -+int snd_bcm2835_pcm_prepare_again(struct snd_pcm_substream *substream) - { - bcm2835_chip_t *chip = snd_pcm_substream_chip(substream); - struct snd_pcm_runtime *runtime = substream->runtime; -@@ -350,8 +352,6 @@ static int snd_bcm2835_pcm_prepare(struct snd_pcm_substream *substream) - int channels; - int err; - -- audio_info(" .. IN\n"); -- - /* notify the vchiq that it should enter spdif passthrough mode by - * setting channels=0 (see - * https://github.com/raspberrypi/linux/issues/528) */ -@@ -367,6 +367,20 @@ static int snd_bcm2835_pcm_prepare(struct snd_pcm_substream *substream) - audio_error(" error setting hw params\n"); - } - -+ return err; -+} ++static struct platform_device_id rpisense_fb_device_id[] = { ++ { .name = "rpi-sense-fb" }, ++ { }, ++}; ++MODULE_DEVICE_TABLE(platform, rpisense_fb_device_id); + -+/* prepare callback */ -+static int snd_bcm2835_pcm_prepare(struct snd_pcm_substream *substream) -+{ -+ bcm2835_chip_t *chip = snd_pcm_substream_chip(substream); -+ struct snd_pcm_runtime *runtime = substream->runtime; -+ bcm2835_alsa_stream_t *alsa_stream = runtime->private_data; ++static struct platform_driver rpisense_fb_driver = { ++ .probe = rpisense_fb_probe, ++ .remove = rpisense_fb_remove, ++ .driver = { ++ .name = "rpi-sense-fb", ++ .owner = THIS_MODULE, ++ }, ++}; + -+ audio_info(" .. IN\n"); ++module_platform_driver(rpisense_fb_driver); + -+ snd_bcm2835_pcm_prepare_again(substream); ++MODULE_DESCRIPTION("Raspberry Pi Sense HAT framebuffer driver"); ++MODULE_AUTHOR("Serge Schneider <serge@raspberrypi.org>"); ++MODULE_LICENSE("GPL"); + - bcm2835_audio_setup(alsa_stream); - - /* in preparation of the stream, set the controls (volume level) of the stream */ -diff --git a/sound/arm/bcm2835-vchiq.c b/sound/arm/bcm2835-vchiq.c -index 3de3094..8ecd2d73 100755 ---- a/sound/arm/bcm2835-vchiq.c -+++ b/sound/arm/bcm2835-vchiq.c -@@ -570,6 +570,8 @@ int bcm2835_audio_set_params(bcm2835_alsa_stream_t * alsa_stream, - VC_AUDIO_MSG_T m; - AUDIO_INSTANCE_T *instance = alsa_stream->instance; - int32_t success; -+ uint32_t chmap_value; -+ int i; - int ret; - LOG_DBG(" .. IN\n"); - -@@ -593,10 +595,21 @@ int bcm2835_audio_set_params(bcm2835_alsa_stream_t * alsa_stream, - - instance->result = -1; - -+ if (alsa_stream->chip->cea_chmap >= 0) { -+ chmap_value = (unsigned)alsa_stream->chip->cea_chmap << 24; -+ } else { -+ chmap_value = 0; /* force stereo */ -+ for (i = 0; i < 8; i++) -+ alsa_stream->chip->map_channels[i] = i; -+ } -+ for (i = 0; i < 8; i++) -+ chmap_value |= alsa_stream->chip->map_channels[i] << (i * 3); +diff --git a/include/linux/mfd/rpisense/core.h b/include/linux/mfd/rpisense/core.h +new file mode 100644 +index 0000000..4856aa3 +--- /dev/null ++++ b/include/linux/mfd/rpisense/core.h +@@ -0,0 +1,47 @@ ++/* ++ * Raspberry Pi Sense HAT core driver ++ * http://raspberrypi.org ++ * ++ * Copyright (C) 2015 Raspberry Pi ++ * ++ * Author: Serge Schneider ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License as published by the ++ * Free Software Foundation; either version 2 of the License, or (at your ++ * option) any later version. ++ * ++ */ + - m.type = VC_AUDIO_MSG_TYPE_CONFIG; - m.u.config.channels = channels; - m.u.config.samplerate = samplerate; - m.u.config.bps = bps; -+ m.u.config.channelmap = chmap_value; - - /* Create the message available completion */ - init_completion(&instance->msg_avail_comp); -diff --git a/sound/arm/bcm2835.h b/sound/arm/bcm2835.h -index 0f71c5d..997fb69 100755 ---- a/sound/arm/bcm2835.h -+++ b/sound/arm/bcm2835.h -@@ -107,6 +107,8 @@ typedef struct bcm2835_chip { - int old_volume; /* stores the volume value whist muted */ - int dest; - int mute; -+ int cea_chmap; /* currently requested Audio InfoFrame Data Byte 4 */ -+ int map_channels[8]; - - unsigned int opened; - unsigned int spdif_status; -@@ -149,6 +151,8 @@ int snd_bcm2835_new_ctl(bcm2835_chip_t * chip); - int snd_bcm2835_new_pcm(bcm2835_chip_t * chip); - int snd_bcm2835_new_spdif_pcm(bcm2835_chip_t * chip); - -+int snd_bcm2835_pcm_prepare_again(struct snd_pcm_substream *substream); -+ - int bcm2835_audio_open(bcm2835_alsa_stream_t * alsa_stream); - int bcm2835_audio_close(bcm2835_alsa_stream_t * alsa_stream); - int bcm2835_audio_set_params(bcm2835_alsa_stream_t * alsa_stream, - -From 2a64337156d0f84537e04338b2ebd89eb6ec1f09 Mon Sep 17 00:00:00 2001 -From: wm4 <wm4@nowhere> -Date: Wed, 13 Jan 2016 19:43:35 +0100 -Subject: [PATCH 132/170] bcm2835: access controls under the audio mutex ++#ifndef __LINUX_MFD_RPISENSE_CORE_H_ ++#define __LINUX_MFD_RPISENSE_CORE_H_ ++ ++#include <linux/mfd/rpisense/joystick.h> ++#include <linux/mfd/rpisense/framebuffer.h> ++ ++/* ++ * Register values. ++ */ ++#define RPISENSE_FB 0x00 ++#define RPISENSE_WAI 0xF0 ++#define RPISENSE_VER 0xF1 ++#define RPISENSE_KEYS 0xF2 ++#define RPISENSE_EE_WP 0xF3 ++ ++#define RPISENSE_ID 's' ++ ++struct rpisense { ++ struct device *dev; ++ struct i2c_client *i2c_client; ++ ++ /* Client devices */ ++ struct rpisense_js joystick; ++ struct rpisense_fb framebuffer; ++}; ++ ++struct rpisense *rpisense_get_dev(void); ++s32 rpisense_reg_read(struct rpisense *rpisense, int reg); ++int rpisense_reg_write(struct rpisense *rpisense, int reg, u16 val); ++int rpisense_block_write(struct rpisense *rpisense, const char *buf, int count); ++ ++#endif +diff --git a/include/linux/mfd/rpisense/framebuffer.h b/include/linux/mfd/rpisense/framebuffer.h +new file mode 100644 +index 0000000..2ba95d7 +--- /dev/null ++++ b/include/linux/mfd/rpisense/framebuffer.h +@@ -0,0 +1,32 @@ ++/* ++ * Raspberry Pi Sense HAT framebuffer driver ++ * http://raspberrypi.org ++ * ++ * Copyright (C) 2015 Raspberry Pi ++ * ++ * Author: Serge Schneider ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License as published by the ++ * Free Software Foundation; either version 2 of the License, or (at your ++ * option) any later version. ++ * ++ */ ++ ++#ifndef __LINUX_RPISENSE_FB_H_ ++#define __LINUX_RPISENSE_FB_H_ ++ ++#define SENSEFB_FBIO_IOC_MAGIC 0xF1 ++ ++#define SENSEFB_FBIOGET_GAMMA _IO(SENSEFB_FBIO_IOC_MAGIC, 0) ++#define SENSEFB_FBIOSET_GAMMA _IO(SENSEFB_FBIO_IOC_MAGIC, 1) ++#define SENSEFB_FBIORESET_GAMMA _IO(SENSEFB_FBIO_IOC_MAGIC, 2) ++ ++struct rpisense; ++ ++struct rpisense_fb { ++ struct platform_device *pdev; ++ struct fb_info *info; ++}; ++ ++#endif +diff --git a/include/linux/mfd/rpisense/joystick.h b/include/linux/mfd/rpisense/joystick.h +new file mode 100644 +index 0000000..56196dc +--- /dev/null ++++ b/include/linux/mfd/rpisense/joystick.h +@@ -0,0 +1,35 @@ ++/* ++ * Raspberry Pi Sense HAT joystick driver ++ * http://raspberrypi.org ++ * ++ * Copyright (C) 2015 Raspberry Pi ++ * ++ * Author: Serge Schneider ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License as published by the ++ * Free Software Foundation; either version 2 of the License, or (at your ++ * option) any later version. ++ * ++ */ ++ ++#ifndef __LINUX_RPISENSE_JOYSTICK_H_ ++#define __LINUX_RPISENSE_JOYSTICK_H_ ++ ++#include <linux/input.h> ++#include <linux/interrupt.h> ++#include <linux/gpio/consumer.h> ++#include <linux/platform_device.h> ++ ++struct rpisense; ++ ++struct rpisense_js { ++ struct platform_device *pdev; ++ struct input_dev *keys_dev; ++ struct gpio_desc *keys_desc; ++ struct work_struct keys_work_s; ++ int keys_irq; ++}; ++ ++ ++#endif -I don't think the ALSA framework provides any kind of automatic -synchronization within the control callbacks. We most likely need -to ensure this manually, so add locking around all access to shared -mutable data. In particular, bcm2835_audio_set_ctls() should -probably always be called under our own audio lock. +From 4b70a98f86ebee7fe728cc485ce689ea8f842ab6 Mon Sep 17 00:00:00 2001 +From: Jan Grulich <jan@grulich.eu> +Date: Mon, 24 Aug 2015 16:03:47 +0100 +Subject: [PATCH 082/112] RaspiDAC3 support + +Signed-off-by: Jan Grulich <jan@grulich.eu> + +config: fix RaspiDAC Rev.3x dependencies + +Change depends to SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S +like the other I2S soundcard drivers. + +Signed-off-by: Matthias Reichl <hias@horus.com> --- - sound/arm/bcm2835-ctl.c | 74 +++++++++++++++++++++++++++++++++++++++++-------- - sound/arm/bcm2835-pcm.c | 4 +++ - 2 files changed, 66 insertions(+), 12 deletions(-) + sound/soc/bcm/Kconfig | 8 ++ + sound/soc/bcm/Makefile | 2 + + sound/soc/bcm/raspidac3.c | 192 ++++++++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 202 insertions(+) + create mode 100644 sound/soc/bcm/raspidac3.c -diff --git a/sound/arm/bcm2835-ctl.c b/sound/arm/bcm2835-ctl.c -index 92d3f76..5b8e6bd2 100755 ---- a/sound/arm/bcm2835-ctl.c -+++ b/sound/arm/bcm2835-ctl.c -@@ -94,6 +94,9 @@ static int snd_bcm2835_ctl_get(struct snd_kcontrol *kcontrol, - { - struct bcm2835_chip *chip = snd_kcontrol_chip(kcontrol); - -+ if (mutex_lock_interruptible(&chip->audio_mutex)) -+ return -EINTR; +diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig +index 8669a9a..1a3f826 100644 +--- a/sound/soc/bcm/Kconfig ++++ b/sound/soc/bcm/Kconfig +@@ -56,3 +56,11 @@ config SND_BCM2708_SOC_IQAUDIO_DAC + select SND_SOC_PCM512x_I2C + help + Say Y or M if you want to add support for IQaudIO-DAC. + - BUG_ON(!chip && !(chip->avail_substreams & AVAIL_SUBSTREAMS_MASK)); - - if (kcontrol->private_value == PCM_PLAYBACK_VOLUME) -@@ -103,6 +106,7 @@ static int snd_bcm2835_ctl_get(struct snd_kcontrol *kcontrol, - else if (kcontrol->private_value == PCM_PLAYBACK_DEVICE) - ucontrol->value.integer.value[0] = chip->dest; - -+ mutex_unlock(&chip->audio_mutex); - return 0; - } - -@@ -112,11 +116,15 @@ static int snd_bcm2835_ctl_put(struct snd_kcontrol *kcontrol, - struct bcm2835_chip *chip = snd_kcontrol_chip(kcontrol); - int changed = 0; ++config SND_BCM2708_SOC_RASPIDAC3 ++ tristate "Support for RaspiDAC Rev.3x" ++ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S ++ select SND_SOC_PCM512x_I2C ++ select SND_SOC_TPA6130A2 ++ help ++ Say Y or M if you want to add support for RaspiDAC Rev.3x. +diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile +index 4f5ab1f..b21e11e 100644 +--- a/sound/soc/bcm/Makefile ++++ b/sound/soc/bcm/Makefile +@@ -11,6 +11,7 @@ snd-soc-hifiberry-amp-objs := hifiberry_amp.o + snd-soc-rpi-dac-objs := rpi-dac.o + snd-soc-rpi-proto-objs := rpi-proto.o + snd-soc-iqaudio-dac-objs := iqaudio-dac.o ++snd-soc-raspidac3-objs := raspidac3.o -+ if (mutex_lock_interruptible(&chip->audio_mutex)) -+ return -EINTR; + obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o + obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS) += snd-soc-hifiberry-dacplus.o +@@ -19,3 +20,4 @@ obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_AMP) += snd-soc-hifiberry-amp.o + obj-$(CONFIG_SND_BCM2708_SOC_RPI_DAC) += snd-soc-rpi-dac.o + obj-$(CONFIG_SND_BCM2708_SOC_RPI_PROTO) += snd-soc-rpi-proto.o + obj-$(CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC) += snd-soc-iqaudio-dac.o ++obj-$(CONFIG_SND_BCM2708_SOC_RASPIDAC3) += snd-soc-raspidac3.o +diff --git a/sound/soc/bcm/raspidac3.c b/sound/soc/bcm/raspidac3.c +new file mode 100644 +index 0000000..e7422e2 +--- /dev/null ++++ b/sound/soc/bcm/raspidac3.c +@@ -0,0 +1,192 @@ ++/* ++ * ASoC Driver for RaspiDAC v3 ++ * ++ * Author: Jan Grulich <jan@grulich.eu> ++ * Copyright 2015 ++ * based on code by Daniel Matuschek <daniel@hifiberry.com> ++ * based on code by Florian Meier <florian.meier@koalo.de> ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * version 2 as published by the Free Software Foundation. ++ * ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * General Public License for more details. ++ */ + - if (kcontrol->private_value == PCM_PLAYBACK_VOLUME) { - audio_info("Volume change attempted.. volume = %d new_volume = %d\n", chip->volume, (int)ucontrol->value.integer.value[0]); - if (chip->mute == CTRL_VOL_MUTE) { - /* changed = toggle_mute(chip, CTRL_VOL_UNMUTE); */ -- return 1; /* should return 0 to signify no change but the mixer takes this as the opposite sign (no idea why) */ -+ changed = 1; /* should return 0 to signify no change but the mixer takes this as the opposite sign (no idea why) */ -+ goto unlock; - } - if (changed - || (ucontrol->value.integer.value[0] != chip2alsa(chip->volume))) { -@@ -142,6 +150,8 @@ static int snd_bcm2835_ctl_put(struct snd_kcontrol *kcontrol, - printk(KERN_ERR "Failed to set ALSA controls..\n"); - } - -+unlock: -+ mutex_unlock(&chip->audio_mutex); - return changed; - } - -@@ -198,10 +208,14 @@ static int snd_bcm2835_spdif_default_get(struct snd_kcontrol *kcontrol, - struct bcm2835_chip *chip = snd_kcontrol_chip(kcontrol); - int i; - -+ if (mutex_lock_interruptible(&chip->audio_mutex)) -+ return -EINTR; ++#include <linux/module.h> ++#include <linux/platform_device.h> + - for (i = 0; i < 4; i++) - ucontrol->value.iec958.status[i] = - (chip->spdif_status >> (i * 8)) && 0xff; - -+ mutex_unlock(&chip->audio_mutex); - return 0; - } - -@@ -212,12 +226,16 @@ static int snd_bcm2835_spdif_default_put(struct snd_kcontrol *kcontrol, - unsigned int val = 0; - int i, change; - -+ if (mutex_lock_interruptible(&chip->audio_mutex)) -+ return -EINTR; ++#include <sound/core.h> ++#include <sound/pcm.h> ++#include <sound/pcm_params.h> ++#include <sound/soc.h> ++#include <sound/jack.h> ++#include <sound/soc-dapm.h> + - for (i = 0; i < 4; i++) - val |= (unsigned int)ucontrol->value.iec958.status[i] << (i * 8); - - change = val != chip->spdif_status; - chip->spdif_status = val; - -+ mutex_unlock(&chip->audio_mutex); - return change; - } - -@@ -253,9 +271,14 @@ static int snd_bcm2835_spdif_stream_get(struct snd_kcontrol *kcontrol, - struct bcm2835_chip *chip = snd_kcontrol_chip(kcontrol); - int i; - -+ if (mutex_lock_interruptible(&chip->audio_mutex)) -+ return -EINTR; ++#include "../codecs/pcm512x.h" ++#include "../codecs/tpa6130a2.h" + - for (i = 0; i < 4; i++) - ucontrol->value.iec958.status[i] = - (chip->spdif_status >> (i * 8)) & 0xff; ++/* sound card init */ ++static int snd_rpi_raspidac3_init(struct snd_soc_pcm_runtime *rtd) ++{ ++ int ret; ++ struct snd_soc_card *card = rtd->card; ++ struct snd_soc_codec *codec = rtd->codec; ++ snd_soc_update_bits(codec, PCM512x_GPIO_EN, 0x08, 0x08); ++ snd_soc_update_bits(codec, PCM512x_GPIO_OUTPUT_4, 0xf, 0x02); ++ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x08,0x00); + -+ mutex_unlock(&chip->audio_mutex); - return 0; - } - -@@ -266,11 +289,15 @@ static int snd_bcm2835_spdif_stream_put(struct snd_kcontrol *kcontrol, - unsigned int val = 0; - int i, change; - -+ if (mutex_lock_interruptible(&chip->audio_mutex)) -+ return -EINTR; ++ ret = snd_soc_limit_volume(card, "Digital Playback Volume", 207); ++ if (ret < 0) ++ dev_warn(card->dev, "Failed to set volume limit: %d\n", ret); ++ else { ++ struct snd_kcontrol *kctl; + - for (i = 0; i < 4; i++) - val |= (unsigned int)ucontrol->value.iec958.status[i] << (i * 8); - change = val != chip->spdif_status; - chip->spdif_status = val; - -+ mutex_unlock(&chip->audio_mutex); - return change; - } - -@@ -454,11 +481,17 @@ static int snd_bcm2835_chmap_ctl_get(struct snd_kcontrol *kcontrol, - unsigned int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); - struct snd_pcm_substream *substream = snd_pcm_chmap_substream(info, idx); - struct cea_channel_speaker_allocation *ch = NULL; -+ int res = 0; - int cur = 0; - int i; - -- if (!substream || !substream->runtime) -- return -ENODEV; -+ if (mutex_lock_interruptible(&chip->audio_mutex)) -+ return -EINTR; ++ ret = tpa6130a2_add_controls(codec); ++ if (ret < 0) ++ dev_warn(card->dev, "Failed to add TPA6130A2 controls: %d\n", ++ ret); ++ ret = snd_soc_limit_volume(card, ++ "TPA6130A2 Headphone Playback Volume", ++ 54); ++ if (ret < 0) ++ dev_warn(card->dev, "Failed to set TPA6130A2 volume limit: %d\n", ++ ret); ++ kctl = snd_soc_card_get_kcontrol(card, ++ "TPA6130A2 Headphone Playback Volume"); ++ if (kctl) { ++ strcpy(kctl->id.name, "Headphones Playback Volume"); ++ /* disable the volume dB scale so alsamixer works */ ++ kctl->vd[0].access = SNDRV_CTL_ELEM_ACCESS_READWRITE; ++ } + -+ if (!substream || !substream->runtime) { -+ res = -ENODEV; -+ goto unlock; ++ kctl = snd_soc_card_get_kcontrol(card, ++ "TPA6130A2 Headphone Playback Switch"); ++ if (kctl) ++ strcpy(kctl->id.name, "Headphones Playback Switch"); + } - - for (i = 0; i < ARRAY_SIZE(channel_allocations); i++) { - if (channel_allocations[i].ca_index == chip->cea_chmap) -@@ -476,7 +509,10 @@ static int snd_bcm2835_chmap_ctl_get(struct snd_kcontrol *kcontrol, - } - while (cur < 8) - ucontrol->value.integer.value[cur++] = SNDRV_CHMAP_NA; -- return 0; + -+unlock: -+ mutex_unlock(&chip->audio_mutex); -+ return res; - } - - static int snd_bcm2835_chmap_ctl_put(struct snd_kcontrol *kcontrol, -@@ -487,10 +523,16 @@ static int snd_bcm2835_chmap_ctl_put(struct snd_kcontrol *kcontrol, - unsigned int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); - struct snd_pcm_substream *substream = snd_pcm_chmap_substream(info, idx); - int i, prepared = 0, cea_chmap = -1; -+ int res = 0; - int remap[8]; - -- if (!substream || !substream->runtime) -- return -ENODEV; -+ if (mutex_lock_interruptible(&chip->audio_mutex)) -+ return -EINTR; ++ return 0; ++} ++ ++/* set hw parameters */ ++static int snd_rpi_raspidac3_hw_params(struct snd_pcm_substream *substream, ++ struct snd_pcm_hw_params *params) ++{ ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; ++ ++ unsigned int sample_bits = ++ snd_pcm_format_physical_width(params_format(params)); ++ ++ return snd_soc_dai_set_bclk_ratio(cpu_dai, sample_bits * 2); ++} ++ ++/* startup */ ++static int snd_rpi_raspidac3_startup(struct snd_pcm_substream *substream) { ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_codec *codec = rtd->codec; ++ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x08,0x08); ++ tpa6130a2_stereo_enable(codec, 1); ++ return 0; ++} ++ ++/* shutdown */ ++static void snd_rpi_raspidac3_shutdown(struct snd_pcm_substream *substream) { ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_codec *codec = rtd->codec; ++ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x08,0x00); ++ tpa6130a2_stereo_enable(codec, 0); ++} ++ ++/* machine stream operations */ ++static struct snd_soc_ops snd_rpi_raspidac3_ops = { ++ .hw_params = snd_rpi_raspidac3_hw_params, ++ .startup = snd_rpi_raspidac3_startup, ++ .shutdown = snd_rpi_raspidac3_shutdown, ++}; ++ ++/* interface setup */ ++static struct snd_soc_dai_link snd_rpi_raspidac3_dai[] = { ++{ ++ .name = "RaspiDAC Rev.3x", ++ .stream_name = "RaspiDAC HiFi", ++ .cpu_dai_name = "bcm2708-i2s.0", ++ .codec_dai_name = "pcm512x-hifi", ++ .platform_name = "bcm2708-i2s.0", ++ .codec_name = "pcm512x.1-004c", ++ .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | ++ SND_SOC_DAIFMT_CBS_CFS, ++ .ops = &snd_rpi_raspidac3_ops, ++ .init = snd_rpi_raspidac3_init, ++}, ++}; ++ ++/* audio machine driver */ ++static struct snd_soc_card snd_rpi_raspidac3 = { ++ .name = "RaspiDAC Rev.3x HiFi Audio Card", ++ .owner = THIS_MODULE, ++ .dai_link = snd_rpi_raspidac3_dai, ++ .num_links = ARRAY_SIZE(snd_rpi_raspidac3_dai), ++}; ++ ++/* sound card test */ ++static int snd_rpi_raspidac3_probe(struct platform_device *pdev) ++{ ++ int ret = 0; ++ ++ snd_rpi_raspidac3.dev = &pdev->dev; + -+ if (!substream || !substream->runtime) { -+ res = -ENODEV; -+ goto unlock; -+ } - - switch (substream->runtime->status->state) { - case SNDRV_PCM_STATE_OPEN: -@@ -500,7 +542,8 @@ static int snd_bcm2835_chmap_ctl_put(struct snd_kcontrol *kcontrol, - prepared = 1; - break; - default: -- return -EBUSY; -+ res = -EBUSY; -+ goto unlock; - } - - for (i = 0; i < ARRAY_SIZE(channel_allocations); i++) { -@@ -538,19 +581,26 @@ static int snd_bcm2835_chmap_ctl_put(struct snd_kcontrol *kcontrol, - } - } - -- if (cea_chmap < 0) -- return -EINVAL; -+ if (cea_chmap < 0) { -+ res = -EINVAL; -+ goto unlock; -+ } - - /* don't change the layout if another substream is active */ -- if (chip->opened != (1 << substream->number) && chip->cea_chmap != cea_chmap) -- return -EBUSY; /* unsure whether this is a good error code */ -+ if (chip->opened != (1 << substream->number) && chip->cea_chmap != cea_chmap) { -+ res = -EBUSY; /* unsure whether this is a good error code */ -+ goto unlock; ++ if (pdev->dev.of_node) { ++ struct device_node *i2s_node; ++ struct snd_soc_dai_link *dai = &snd_rpi_raspidac3_dai[0]; ++ i2s_node = of_parse_phandle(pdev->dev.of_node, ++ "i2s-controller", 0); ++ ++ if (i2s_node) { ++ dai->cpu_dai_name = NULL; ++ dai->cpu_of_node = i2s_node; ++ dai->platform_name = NULL; ++ dai->platform_of_node = i2s_node; ++ } + } - - chip->cea_chmap = cea_chmap; - for (i = 0; i < 8; i++) - chip->map_channels[i] = remap[i]; - if (prepared) - snd_bcm2835_pcm_prepare_again(substream); -- return 0; + -+unlock: -+ mutex_unlock(&chip->audio_mutex); -+ return res; - } - - static int snd_bcm2835_add_chmap_ctl(bcm2835_chip_t * chip) -diff --git a/sound/arm/bcm2835-pcm.c b/sound/arm/bcm2835-pcm.c -index 1067460..48da3bb 100755 ---- a/sound/arm/bcm2835-pcm.c -+++ b/sound/arm/bcm2835-pcm.c -@@ -379,6 +379,9 @@ static int snd_bcm2835_pcm_prepare(struct snd_pcm_substream *substream) - - audio_info(" .. IN\n"); - -+ if (mutex_lock_interruptible(&chip->audio_mutex)) -+ return -EINTR; ++ ret = snd_soc_register_card(&snd_rpi_raspidac3); ++ if (ret) ++ dev_err(&pdev->dev, ++ "snd_soc_register_card() failed: %d\n", ret); + - snd_bcm2835_pcm_prepare_again(substream); - - bcm2835_audio_setup(alsa_stream); -@@ -401,6 +404,7 @@ static int snd_bcm2835_pcm_prepare(struct snd_pcm_substream *substream) - alsa_stream->buffer_size, alsa_stream->period_size, - alsa_stream->pos, runtime->frame_bits); - -+ mutex_unlock(&chip->audio_mutex); - audio_info(" .. OUT\n"); - return 0; - } - -From 6e781f631f7e23f7d88256d020d83950c9bf213a Mon Sep 17 00:00:00 2001 -From: wm4 <wm4@nowhere> -Date: Wed, 13 Jan 2016 19:44:03 +0100 -Subject: [PATCH 133/170] bcm2835: always use 2/4/8 channels for multichannel - layouts - -Pad the unused channels with NA. This means userspace needs to write -additional, silent padding channels, which is not ideal, but better -than noise. - -Works around noise at the following channel counts: 3, 5, 6, 7 ---- - sound/arm/bcm2835-ctl.c | 89 +++++++++++++++++++++++++------------------------ - 1 file changed, 45 insertions(+), 44 deletions(-) - -diff --git a/sound/arm/bcm2835-ctl.c b/sound/arm/bcm2835-ctl.c -index 5b8e6bd2..dec052b 100755 ---- a/sound/arm/bcm2835-ctl.c -+++ b/sound/arm/bcm2835-ctl.c -@@ -349,6 +349,7 @@ struct cea_channel_speaker_allocation { - #define FRW SNDRV_CHMAP_FRW - #define TC SNDRV_CHMAP_TC - #define FCH SNDRV_CHMAP_TFC -+#define NA SNDRV_CHMAP_NA - - /* - * CEA-861 channel maps -@@ -356,69 +357,69 @@ struct cea_channel_speaker_allocation { - * Stolen from sound/pci/hda/patch_hdmi.c - * (unlike the source, this uses SNDRV_* constants directly, as by the - * map_tables array in patch_hdmi.c) -- * Unknown entries use 0, which unfortunately is SNDRV_CHMAP_UNKNOWN instead -- * of SNDRV_CHMAP_NA. -+ * Entries which do not have a physical output channel use 0. Entries which -+ * require userspace to output silence use NA (SNDRV_CHMAP_NA). - */ - static struct cea_channel_speaker_allocation channel_allocations[] = { - /* channel: 7 6 5 4 3 2 1 0 */ - { .ca_index = 0x00, .speakers = { 0, 0, 0, 0, 0, 0, FR, FL } }, - /* 2.1 */ --{ .ca_index = 0x01, .speakers = { 0, 0, 0, 0, 0, LFE, FR, FL } }, -+{ .ca_index = 0x01, .speakers = { 0, 0, 0, 0, NA, LFE, FR, FL } }, - /* Dolby Surround */ --{ .ca_index = 0x02, .speakers = { 0, 0, 0, 0, FC, 0, FR, FL } }, -+{ .ca_index = 0x02, .speakers = { 0, 0, 0, 0, FC, NA, FR, FL } }, - /* surround40 */ --{ .ca_index = 0x08, .speakers = { 0, 0, RR, RL, 0, 0, FR, FL } }, -+{ .ca_index = 0x08, .speakers = { NA, NA, RR, RL, NA, NA, FR, FL } }, - /* surround41 */ --{ .ca_index = 0x09, .speakers = { 0, 0, RR, RL, 0, LFE, FR, FL } }, -+{ .ca_index = 0x09, .speakers = { NA, NA, RR, RL, NA, LFE, FR, FL } }, - /* surround50 */ --{ .ca_index = 0x0a, .speakers = { 0, 0, RR, RL, FC, 0, FR, FL } }, -+{ .ca_index = 0x0a, .speakers = { NA, NA, RR, RL, FC, NA, FR, FL } }, - /* surround51 */ --{ .ca_index = 0x0b, .speakers = { 0, 0, RR, RL, FC, LFE, FR, FL } }, -+{ .ca_index = 0x0b, .speakers = { NA, NA, RR, RL, FC, LFE, FR, FL } }, - /* 6.1 */ --{ .ca_index = 0x0f, .speakers = { 0, RC, RR, RL, FC, LFE, FR, FL } }, -+{ .ca_index = 0x0f, .speakers = { NA, RC, RR, RL, FC, LFE, FR, FL } }, - /* surround71 */ - { .ca_index = 0x13, .speakers = { RRC, RLC, RR, RL, FC, LFE, FR, FL } }, - --{ .ca_index = 0x03, .speakers = { 0, 0, 0, 0, FC, LFE, FR, FL } }, --{ .ca_index = 0x04, .speakers = { 0, 0, 0, RC, 0, 0, FR, FL } }, --{ .ca_index = 0x05, .speakers = { 0, 0, 0, RC, 0, LFE, FR, FL } }, --{ .ca_index = 0x06, .speakers = { 0, 0, 0, RC, FC, 0, FR, FL } }, --{ .ca_index = 0x07, .speakers = { 0, 0, 0, RC, FC, LFE, FR, FL } }, --{ .ca_index = 0x0c, .speakers = { 0, RC, RR, RL, 0, 0, FR, FL } }, --{ .ca_index = 0x0d, .speakers = { 0, RC, RR, RL, 0, LFE, FR, FL } }, --{ .ca_index = 0x0e, .speakers = { 0, RC, RR, RL, FC, 0, FR, FL } }, --{ .ca_index = 0x10, .speakers = { RRC, RLC, RR, RL, 0, 0, FR, FL } }, --{ .ca_index = 0x11, .speakers = { RRC, RLC, RR, RL, 0, LFE, FR, FL } }, --{ .ca_index = 0x12, .speakers = { RRC, RLC, RR, RL, FC, 0, FR, FL } }, --{ .ca_index = 0x14, .speakers = { FRC, FLC, 0, 0, 0, 0, FR, FL } }, --{ .ca_index = 0x15, .speakers = { FRC, FLC, 0, 0, 0, LFE, FR, FL } }, --{ .ca_index = 0x16, .speakers = { FRC, FLC, 0, 0, FC, 0, FR, FL } }, --{ .ca_index = 0x17, .speakers = { FRC, FLC, 0, 0, FC, LFE, FR, FL } }, --{ .ca_index = 0x18, .speakers = { FRC, FLC, 0, RC, 0, 0, FR, FL } }, --{ .ca_index = 0x19, .speakers = { FRC, FLC, 0, RC, 0, LFE, FR, FL } }, --{ .ca_index = 0x1a, .speakers = { FRC, FLC, 0, RC, FC, 0, FR, FL } }, --{ .ca_index = 0x1b, .speakers = { FRC, FLC, 0, RC, FC, LFE, FR, FL } }, --{ .ca_index = 0x1c, .speakers = { FRC, FLC, RR, RL, 0, 0, FR, FL } }, --{ .ca_index = 0x1d, .speakers = { FRC, FLC, RR, RL, 0, LFE, FR, FL } }, --{ .ca_index = 0x1e, .speakers = { FRC, FLC, RR, RL, FC, 0, FR, FL } }, -+{ .ca_index = 0x03, .speakers = { NA, NA, NA, NA, FC, LFE, FR, FL } }, -+{ .ca_index = 0x04, .speakers = { NA, NA, NA, RC, NA, NA, FR, FL } }, -+{ .ca_index = 0x05, .speakers = { NA, NA, NA, RC, NA, LFE, FR, FL } }, -+{ .ca_index = 0x06, .speakers = { NA, NA, NA, RC, FC, NA, FR, FL } }, -+{ .ca_index = 0x07, .speakers = { NA, NA, NA, RC, FC, LFE, FR, FL } }, -+{ .ca_index = 0x0c, .speakers = { NA, RC, RR, RL, NA, NA, FR, FL } }, -+{ .ca_index = 0x0d, .speakers = { NA, RC, RR, RL, NA, LFE, FR, FL } }, -+{ .ca_index = 0x0e, .speakers = { NA, RC, RR, RL, FC, NA, FR, FL } }, -+{ .ca_index = 0x10, .speakers = { RRC, RLC, RR, RL, NA, NA, FR, FL } }, -+{ .ca_index = 0x11, .speakers = { RRC, RLC, RR, RL, NA, LFE, FR, FL } }, -+{ .ca_index = 0x12, .speakers = { RRC, RLC, RR, RL, FC, NA, FR, FL } }, -+{ .ca_index = 0x14, .speakers = { FRC, FLC, NA, NA, NA, NA, FR, FL } }, -+{ .ca_index = 0x15, .speakers = { FRC, FLC, NA, NA, NA, LFE, FR, FL } }, -+{ .ca_index = 0x16, .speakers = { FRC, FLC, NA, NA, FC, NA, FR, FL } }, -+{ .ca_index = 0x17, .speakers = { FRC, FLC, NA, NA, FC, LFE, FR, FL } }, -+{ .ca_index = 0x18, .speakers = { FRC, FLC, NA, RC, NA, NA, FR, FL } }, -+{ .ca_index = 0x19, .speakers = { FRC, FLC, NA, RC, NA, LFE, FR, FL } }, -+{ .ca_index = 0x1a, .speakers = { FRC, FLC, NA, RC, FC, NA, FR, FL } }, -+{ .ca_index = 0x1b, .speakers = { FRC, FLC, NA, RC, FC, LFE, FR, FL } }, -+{ .ca_index = 0x1c, .speakers = { FRC, FLC, RR, RL, NA, NA, FR, FL } }, -+{ .ca_index = 0x1d, .speakers = { FRC, FLC, RR, RL, NA, LFE, FR, FL } }, -+{ .ca_index = 0x1e, .speakers = { FRC, FLC, RR, RL, FC, NA, FR, FL } }, - { .ca_index = 0x1f, .speakers = { FRC, FLC, RR, RL, FC, LFE, FR, FL } }, --{ .ca_index = 0x20, .speakers = { 0, FCH, RR, RL, FC, 0, FR, FL } }, --{ .ca_index = 0x21, .speakers = { 0, FCH, RR, RL, FC, LFE, FR, FL } }, --{ .ca_index = 0x22, .speakers = { TC, 0, RR, RL, FC, 0, FR, FL } }, --{ .ca_index = 0x23, .speakers = { TC, 0, RR, RL, FC, LFE, FR, FL } }, --{ .ca_index = 0x24, .speakers = { FRH, FLH, RR, RL, 0, 0, FR, FL } }, --{ .ca_index = 0x25, .speakers = { FRH, FLH, RR, RL, 0, LFE, FR, FL } }, --{ .ca_index = 0x26, .speakers = { FRW, FLW, RR, RL, 0, 0, FR, FL } }, --{ .ca_index = 0x27, .speakers = { FRW, FLW, RR, RL, 0, LFE, FR, FL } }, --{ .ca_index = 0x28, .speakers = { TC, RC, RR, RL, FC, 0, FR, FL } }, -+{ .ca_index = 0x20, .speakers = { NA, FCH, RR, RL, FC, NA, FR, FL } }, -+{ .ca_index = 0x21, .speakers = { NA, FCH, RR, RL, FC, LFE, FR, FL } }, -+{ .ca_index = 0x22, .speakers = { TC, NA, RR, RL, FC, NA, FR, FL } }, -+{ .ca_index = 0x23, .speakers = { TC, NA, RR, RL, FC, LFE, FR, FL } }, -+{ .ca_index = 0x24, .speakers = { FRH, FLH, RR, RL, NA, NA, FR, FL } }, -+{ .ca_index = 0x25, .speakers = { FRH, FLH, RR, RL, NA, LFE, FR, FL } }, -+{ .ca_index = 0x26, .speakers = { FRW, FLW, RR, RL, NA, NA, FR, FL } }, -+{ .ca_index = 0x27, .speakers = { FRW, FLW, RR, RL, NA, LFE, FR, FL } }, -+{ .ca_index = 0x28, .speakers = { TC, RC, RR, RL, FC, NA, FR, FL } }, - { .ca_index = 0x29, .speakers = { TC, RC, RR, RL, FC, LFE, FR, FL } }, --{ .ca_index = 0x2a, .speakers = { FCH, RC, RR, RL, FC, 0, FR, FL } }, -+{ .ca_index = 0x2a, .speakers = { FCH, RC, RR, RL, FC, NA, FR, FL } }, - { .ca_index = 0x2b, .speakers = { FCH, RC, RR, RL, FC, LFE, FR, FL } }, --{ .ca_index = 0x2c, .speakers = { TC, FCH, RR, RL, FC, 0, FR, FL } }, -+{ .ca_index = 0x2c, .speakers = { TC, FCH, RR, RL, FC, NA, FR, FL } }, - { .ca_index = 0x2d, .speakers = { TC, FCH, RR, RL, FC, LFE, FR, FL } }, --{ .ca_index = 0x2e, .speakers = { FRH, FLH, RR, RL, FC, 0, FR, FL } }, -+{ .ca_index = 0x2e, .speakers = { FRH, FLH, RR, RL, FC, NA, FR, FL } }, - { .ca_index = 0x2f, .speakers = { FRH, FLH, RR, RL, FC, LFE, FR, FL } }, --{ .ca_index = 0x30, .speakers = { FRW, FLW, RR, RL, FC, 0, FR, FL } }, -+{ .ca_index = 0x30, .speakers = { FRW, FLW, RR, RL, FC, NA, FR, FL } }, - { .ca_index = 0x31, .speakers = { FRW, FLW, RR, RL, FC, LFE, FR, FL } }, - }; - - -From aaa2a41f44a0fc141b9a983a5f9f30bb8b6dbc8b Mon Sep 17 00:00:00 2001 -From: wm4 <wm4@nowhere> -Date: Wed, 13 Jan 2016 19:44:24 +0100 -Subject: [PATCH 134/170] bcm2835: only allow stereo if analogue jack is - selected - -Sending more than 2 channels to videocore while outputting to analogue -mysteriously outputs heavy artifacts. So just paint it over with a -hack: if analogue is explicitly selected as destination, do not -reporting support for anything other than stereo. - -I'm not sure how to deal with the auto case (destination 0). There's -probably way to retrieve this and even to listen to plug events, but -I didn't find one yet, and it's probably not worth the trouble. Just -don't use this setting, I guess. Unless you like noise. - -Changing the setting while an audio stream is active also doesn't -work properly. We could probably interrupt running streams by -returning ENODEV or using kernel hotplug stuff (maybe), but that -also doesn't seem worth the trouble. ---- - sound/arm/bcm2835-ctl.c | 12 ++++++++++++ - 1 file changed, 12 insertions(+) - -diff --git a/sound/arm/bcm2835-ctl.c b/sound/arm/bcm2835-ctl.c -index dec052b..e930718 100755 ---- a/sound/arm/bcm2835-ctl.c -+++ b/sound/arm/bcm2835-ctl.c -@@ -423,9 +423,16 @@ static struct cea_channel_speaker_allocation channel_allocations[] = { - { .ca_index = 0x31, .speakers = { FRW, FLW, RR, RL, FC, LFE, FR, FL } }, - }; - -+static int uses_analogue(bcm2835_chip_t *chip) ++ return ret; ++} ++ ++/* sound card disconnect */ ++static int snd_rpi_raspidac3_remove(struct platform_device *pdev) +{ -+ return chip->dest == 1; ++ return snd_soc_unregister_card(&snd_rpi_raspidac3); +} + - static int snd_bcm2835_chmap_ctl_tlv(struct snd_kcontrol *kcontrol, int op_flag, - unsigned int size, unsigned int __user *tlv) - { -+ struct snd_pcm_chmap *info = snd_kcontrol_chip(kcontrol); -+ bcm2835_chip_t *chip = info->private_data; - unsigned int __user *dst; - int count = 0; - int i; -@@ -442,6 +449,9 @@ static int snd_bcm2835_chmap_ctl_tlv(struct snd_kcontrol *kcontrol, int op_flag, - int chs_bytes; - int c; - -+ if (i > 0 && uses_analogue(chip)) -+ break; ++static const struct of_device_id raspidac3_of_match[] = { ++ { .compatible = "jg,raspidacv3", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, raspidac3_of_match); + - for (c = 0; c < 8; c++) { - if (ch->speakers[c]) - num_chs++; -@@ -552,6 +562,8 @@ static int snd_bcm2835_chmap_ctl_put(struct snd_kcontrol *kcontrol, - int matches = 1; - int cur = 0; - int x; -+ if (i > 0 && uses_analogue(chip)) -+ break; - memset(remap, 0, sizeof(remap)); - for (x = 0; x < substream->runtime->channels; x++) { - int sp = ucontrol->value.integer.value[x]; - -From 2c967fa0f5b0d10c86c796098574ba09ffe66cd5 Mon Sep 17 00:00:00 2001 -From: wm4 <wm4@nowhere> -Date: Wed, 13 Jan 2016 19:44:47 +0100 -Subject: [PATCH 135/170] bcm2835: interpolate audio delay - -It appears the GPU only sends us a message all 10ms to update -the playback progress. Other than this, the playback position -(what SNDRV_PCM_IOCTL_DELAY will return) is not updated at all. -Userspace will see jitter up to 10ms in the audio position. - -Make this a bit nicer for userspace by interpolating the -position using the CPU clock. - -I'm not sure if setting snd_pcm_runtime.delay is the right -approach for this. Or if there is maybe an already existing -mechanism for position interpolation in the ALSA core. - -I only set SNDRV_PCM_INFO_BATCH because this appears to remove -at least one situation snd_pcm_runtime.delay is used, so I have -to worry less in which place I have to update this field, or -how it interacts with the rest of ALSA. - -In the future, it might be nice to use VC_AUDIO_MSG_TYPE_LATENCY. -One problem is that it requires sending a videocore message, and -waiting for a reply, which could make the implementation much -harder due to locking and synchronization requirements. ---- - sound/arm/bcm2835-pcm.c | 12 +++++++++++- - sound/arm/bcm2835.h | 1 + - 2 files changed, 12 insertions(+), 1 deletion(-) - -diff --git a/sound/arm/bcm2835-pcm.c b/sound/arm/bcm2835-pcm.c -index 48da3bb..f3a4c6d 100755 ---- a/sound/arm/bcm2835-pcm.c -+++ b/sound/arm/bcm2835-pcm.c -@@ -25,7 +25,7 @@ - /* hardware definition */ - static struct snd_pcm_hardware snd_bcm2835_playback_hw = { - .info = (SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | -- SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID), -+ SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID | SNDRV_PCM_INFO_BATCH), - .formats = SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE, - .rates = SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_8000_48000, - .rate_min = 8000, -@@ -99,6 +99,8 @@ static irqreturn_t bcm2835_playback_fifo_irq(int irq, void *dev_id) - alsa_stream->pos %= alsa_stream->buffer_size; - } - -+ alsa_stream->interpolate_start = ktime_get_ns(); ++/* sound card platform driver */ ++static struct platform_driver snd_rpi_raspidac3_driver = { ++ .driver = { ++ .name = "snd-rpi-raspidac3", ++ .owner = THIS_MODULE, ++ .of_match_table = raspidac3_of_match, ++ }, ++ .probe = snd_rpi_raspidac3_probe, ++ .remove = snd_rpi_raspidac3_remove, ++}; + - if (alsa_stream->substream) { - if (new_period) - snd_pcm_period_elapsed(alsa_stream->substream); -@@ -399,6 +401,7 @@ static int snd_bcm2835_pcm_prepare(struct snd_pcm_substream *substream) - alsa_stream->buffer_size = snd_pcm_lib_buffer_bytes(substream); - alsa_stream->period_size = snd_pcm_lib_period_bytes(substream); - alsa_stream->pos = 0; -+ alsa_stream->interpolate_start = ktime_get_ns(); - - audio_debug("buffer_size=%d, period_size=%d pos=%d frame_bits=%d\n", - alsa_stream->buffer_size, alsa_stream->period_size, -@@ -495,6 +498,7 @@ snd_bcm2835_pcm_pointer(struct snd_pcm_substream *substream) - { - struct snd_pcm_runtime *runtime = substream->runtime; - bcm2835_alsa_stream_t *alsa_stream = runtime->private_data; -+ u64 now = ktime_get_ns(); - - audio_info(" .. IN\n"); - -@@ -503,6 +507,12 @@ snd_bcm2835_pcm_pointer(struct snd_pcm_substream *substream) - frames_to_bytes(runtime, runtime->control->appl_ptr), - alsa_stream->pos); - -+ /* Give userspace better delay reporting by interpolating between GPU -+ * notifications, assuming audio speed is close enough to the clock -+ * used for ktime */ -+ if (alsa_stream->interpolate_start && alsa_stream->interpolate_start < now) -+ runtime->delay = -(int)div_u64((now - alsa_stream->interpolate_start) * runtime->rate, 1000000000); ++module_platform_driver(snd_rpi_raspidac3_driver); + - audio_info(" .. OUT\n"); - return snd_pcm_indirect_playback_pointer(substream, - &alsa_stream->pcm_indirect, -diff --git a/sound/arm/bcm2835.h b/sound/arm/bcm2835.h -index 997fb69..20ef108 100755 ---- a/sound/arm/bcm2835.h -+++ b/sound/arm/bcm2835.h -@@ -137,6 +137,7 @@ typedef struct bcm2835_alsa_stream { - unsigned int pos; - unsigned int buffer_size; - unsigned int period_size; -+ u64 interpolate_start; - - uint32_t enable_fifo_irq; - irq_handler_t fifo_irq_handler; ++MODULE_AUTHOR("Jan Grulich <jan@grulich.eu>"); ++MODULE_DESCRIPTION("ASoC Driver for RaspiDAC Rev.3x"); ++MODULE_LICENSE("GPL v2"); -From 205e27a7f94a5531764cc517ce43623361ca466c Mon Sep 17 00:00:00 2001 -From: Phil Elwell <phil@raspberrypi.org> -Date: Tue, 19 Jan 2016 17:16:38 +0000 -Subject: [PATCH 136/170] bcm2835-sdhost: Add workaround for odd behaviour on - some cards +From 5d9f6033f4aa5a9c0430dfec7dae4ff5b5fb1d60 Mon Sep 17 00:00:00 2001 +From: Jan Grulich <jan@grulich.eu> +Date: Mon, 24 Aug 2015 16:02:34 +0100 +Subject: [PATCH 083/112] tpa6130a2: Add headphone switch control -For reasons not understood, the sdhost driver fails when reading -sectors very near the end of some SD cards. The problem could -be related to the similar issue that reading the final sector -of any card as part of a multiple read never completes, and the -workaround is an extension of the mechanism introduced to solve -that problem which ensures those sectors are always read singly. +Signed-off-by: Jan Grulich <jan@grulich.eu> --- - drivers/mmc/host/bcm2835-sdhost.c | 61 +++++++++++++++++++++++++++++++++------ - 1 file changed, 52 insertions(+), 9 deletions(-) + sound/soc/codecs/tpa6130a2.c | 29 ++++++++++++++++++++++++++--- + 1 file changed, 26 insertions(+), 3 deletions(-) -diff --git a/drivers/mmc/host/bcm2835-sdhost.c b/drivers/mmc/host/bcm2835-sdhost.c -index da089985..309633c 100644 ---- a/drivers/mmc/host/bcm2835-sdhost.c -+++ b/drivers/mmc/host/bcm2835-sdhost.c -@@ -173,6 +173,9 @@ struct bcm2835_host { - u32 overclock_50; /* frequency to use when 50MHz is requested (in MHz) */ - u32 overclock; /* Current frequency if overclocked, else zero */ - u32 pio_limit; /* Maximum block count for PIO (0 = always DMA) */ -+ -+ u32 sectors; /* Cached card size in sectors */ -+ u32 single_read_sectors[8]; +diff --git a/sound/soc/codecs/tpa6130a2.c b/sound/soc/codecs/tpa6130a2.c +index 11d85c5..3caaa17 100644 +--- a/sound/soc/codecs/tpa6130a2.c ++++ b/sound/soc/codecs/tpa6130a2.c +@@ -4,6 +4,7 @@ + * Copyright (C) Nokia Corporation + * + * Author: Peter Ujfalusi <peter.ujfalusi@ti.com> ++ * Modified: Jan Grulich <jan@grulich.eu> + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License +@@ -52,6 +53,8 @@ struct tpa6130a2_data { + enum tpa_model id; }; - -@@ -277,6 +280,9 @@ static void bcm2835_sdhost_reset_internal(struct bcm2835_host *host) - { - u32 temp; - -+ if (host->debug) -+ pr_info("%s: reset\n", mmc_hostname(host->mmc)); ++static void tpa6130a2_channel_enable(u8 channel, int enable); + - bcm2835_sdhost_set_power(host, false); - - bcm2835_sdhost_write(host, 0, SDCMD); -@@ -299,6 +305,8 @@ static void bcm2835_sdhost_reset_internal(struct bcm2835_host *host) - bcm2835_sdhost_set_power(host, true); - mdelay(10); - host->clock = 0; -+ host->sectors = 0; -+ host->single_read_sectors[0] = ~0; - bcm2835_sdhost_write(host, host->hcfg, SDHCFG); - bcm2835_sdhost_write(host, host->cdiv, SDCDIV); - mmiowb(); -@@ -309,8 +317,6 @@ static void bcm2835_sdhost_reset(struct mmc_host *mmc) + static int tpa6130a2_i2c_read(int reg) { - struct bcm2835_host *host = mmc_priv(mmc); - unsigned long flags; -- if (host->debug) -- pr_info("%s: reset\n", mmc_hostname(mmc)); - spin_lock_irqsave(&host->lock, flags); - - bcm2835_sdhost_reset_internal(host); -@@ -676,6 +682,32 @@ static void bcm2835_sdhost_prepare_data(struct bcm2835_host *host, struct mmc_co - host->flush_fifo = 0; - host->data->bytes_xfered = 0; - -+ if (!host->sectors && host->mmc->card) -+ { -+ struct mmc_card *card = host->mmc->card; -+ if (!mmc_card_sd(card) && mmc_card_blockaddr(card)) { -+ /* -+ * The EXT_CSD sector count is in number of 512 byte -+ * sectors. -+ */ -+ host->sectors = card->ext_csd.sectors; -+ pr_err("%s: using ext_csd!\n", mmc_hostname(host->mmc)); -+ } else { -+ /* -+ * The CSD capacity field is in units of read_blkbits. -+ * set_capacity takes units of 512 bytes. -+ */ -+ host->sectors = card->csd.capacity << -+ (card->csd.read_blkbits - 9); -+ } -+ host->single_read_sectors[0] = host->sectors - 65; -+ host->single_read_sectors[1] = host->sectors - 64; -+ host->single_read_sectors[2] = host->sectors - 33; -+ host->single_read_sectors[3] = host->sectors - 32; -+ host->single_read_sectors[4] = host->sectors - 1; -+ host->single_read_sectors[5] = ~0; /* Safety net */ -+ } -+ - host->use_dma = host->have_dma && (data->blocks > host->pio_limit); - if (!host->use_dma) { - int flags; -@@ -1246,6 +1278,10 @@ static u32 bcm2835_sdhost_block_irq(struct bcm2835_host *host, u32 intmask) - - bcm2835_sdhost_finish_data(host); - } else { -+ /* Reset the timer */ -+ mod_timer(&host->pio_timer, -+ jiffies + host->pio_timeout); -+ - bcm2835_sdhost_transfer_pio(host); - - /* Reset the timer */ -@@ -1450,8 +1486,8 @@ void bcm2835_sdhost_set_clock(struct bcm2835_host *host, unsigned int clock) - host->cdiv = div; - bcm2835_sdhost_write(host, host->cdiv, SDCDIV); - -- /* Set the timeout to 500ms */ -- bcm2835_sdhost_write(host, host->mmc->actual_clock/2, SDTOUT); -+ /* Set the timeout to 250ms */ -+ bcm2835_sdhost_write(host, host->mmc->actual_clock/4, SDTOUT); - - if (host->debug) - pr_info("%s: clock=%d -> max_clk=%d, cdiv=%x (actual clock %d)\n", -@@ -1566,13 +1602,20 @@ static int bcm2835_sdhost_multi_io_quirk(struct mmc_card *card, - reading the final sector of the card as part of a multiple read - problematic. Detect that case and shorten the read accordingly. - */ -- /* csd.capacity is in weird units - convert to sectors */ -- u32 card_sectors = (card->csd.capacity << (card->csd.read_blkbits - 9)); -+ struct bcm2835_host *host; -+ -+ host = mmc_priv(card->host); - -- if ((direction == MMC_DATA_READ) && -- ((blk_pos + blk_size) == card_sectors)) -- blk_size--; -+ if (direction == MMC_DATA_READ) -+ { -+ int i; -+ int sector; -+ for (i = 0; blk_pos > (sector = host->single_read_sectors[i]); i++) -+ continue; - -+ if ((blk_pos + blk_size) > sector) -+ blk_size = (blk_pos == sector) ? 1 : (sector - blk_pos); -+ } - return blk_size; + struct tpa6130a2_data *data; +@@ -189,7 +192,7 @@ exit: } - -From c5d24cba808118647d01a1869cf1c46d0658d78b Mon Sep 17 00:00:00 2001 -From: Phil Elwell <phil@raspberrypi.org> -Date: Fri, 22 Jan 2016 16:03:24 +0000 -Subject: [PATCH 137/170] bcm2835-sdhost: Add debug_flags dtparam - -Bit zero disables the single-read-sectors map: - -If the default MMC driver is bcm2835-mmc: - dtoverlay=sdhost,debug_flags=1 -If the default MMC driver is bcm2835-sdhost: - dtoverlay=sdtweak,debug_flags=1 -(although the sdhost overlay may also work, sdtweak is -less invasive and will work in more circumstances). - -Also revert the timeout change, just in case. ---- - arch/arm/boot/dts/overlays/sdhost-overlay.dts | 2 ++ - arch/arm/boot/dts/overlays/sdtweak-overlay.dts | 2 ++ - drivers/mmc/host/bcm2835-sdhost.c | 26 +++++++++++++++++++++----- - 3 files changed, 25 insertions(+), 5 deletions(-) - -diff --git a/arch/arm/boot/dts/overlays/sdhost-overlay.dts b/arch/arm/boot/dts/overlays/sdhost-overlay.dts -index 85f0725..dbe6574 100644 ---- a/arch/arm/boot/dts/overlays/sdhost-overlay.dts -+++ b/arch/arm/boot/dts/overlays/sdhost-overlay.dts -@@ -16,6 +16,7 @@ - frag1: __overlay__ { - brcm,overclock-50 = <0>; - brcm,pio-limit = <1>; -+ brcm,debug-flags = <0>; - status = "okay"; - }; - }; -@@ -25,5 +26,6 @@ - force_pio = <&frag1>,"brcm,force-pio?"; - pio_limit = <&frag1>,"brcm,pio-limit:0"; - debug = <&frag1>,"brcm,debug?"; -+ debug_flags = <&frag1>,"brcm,debug-flags:0"; - }; - }; -diff --git a/arch/arm/boot/dts/overlays/sdtweak-overlay.dts b/arch/arm/boot/dts/overlays/sdtweak-overlay.dts -index 74c168d..b0b208c 100644 ---- a/arch/arm/boot/dts/overlays/sdtweak-overlay.dts -+++ b/arch/arm/boot/dts/overlays/sdtweak-overlay.dts -@@ -9,6 +9,7 @@ - frag1: __overlay__ { - brcm,overclock-50 = <0>; - brcm,pio-limit = <1>; -+ brcm,debug-flags = <0>; - }; - }; + static int tpa6130a2_get_volsw(struct snd_kcontrol *kcontrol, +- struct snd_ctl_elem_value *ucontrol) ++ struct snd_ctl_elem_value *ucontrol) + { + struct soc_mixer_control *mc = + (struct soc_mixer_control *)kcontrol->private_value; +@@ -218,7 +221,7 @@ static int tpa6130a2_get_volsw(struct snd_kcontrol *kcontrol, + } -@@ -17,5 +18,6 @@ - force_pio = <&frag1>,"brcm,force-pio?"; - pio_limit = <&frag1>,"brcm,pio-limit:0"; - debug = <&frag1>,"brcm,debug?"; -+ debug_flags = <&frag1>,"brcm,debug-flags:0"; - }; - }; -diff --git a/drivers/mmc/host/bcm2835-sdhost.c b/drivers/mmc/host/bcm2835-sdhost.c -index 309633c..ef9b1e6 100644 ---- a/drivers/mmc/host/bcm2835-sdhost.c -+++ b/drivers/mmc/host/bcm2835-sdhost.c -@@ -174,6 +174,8 @@ struct bcm2835_host { - u32 overclock; /* Current frequency if overclocked, else zero */ - u32 pio_limit; /* Maximum block count for PIO (0 = always DMA) */ + static int tpa6130a2_put_volsw(struct snd_kcontrol *kcontrol, +- struct snd_ctl_elem_value *ucontrol) ++ struct snd_ctl_elem_value *ucontrol) + { + struct soc_mixer_control *mc = + (struct soc_mixer_control *)kcontrol->private_value; +@@ -255,8 +258,22 @@ static int tpa6130a2_put_volsw(struct snd_kcontrol *kcontrol, + return 1; + } -+ u32 debug_flags; ++static int tpa6130a2_put_hp_sw(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol) ++{ ++ int enable = ucontrol->value.integer.value[0]; ++ unsigned int state; + - u32 sectors; /* Cached card size in sectors */ - u32 single_read_sectors[8]; - }; -@@ -682,7 +684,7 @@ static void bcm2835_sdhost_prepare_data(struct bcm2835_host *host, struct mmc_co - host->flush_fifo = 0; - host->data->bytes_xfered = 0; - -- if (!host->sectors && host->mmc->card) -+ if (!host->sectors && host->mmc->card && !(host->debug_flags & 1)) - { - struct mmc_card *card = host->mmc->card; - if (!mmc_card_sd(card) && mmc_card_blockaddr(card)) { -@@ -1486,8 +1488,8 @@ void bcm2835_sdhost_set_clock(struct bcm2835_host *host, unsigned int clock) - host->cdiv = div; - bcm2835_sdhost_write(host, host->cdiv, SDCDIV); - -- /* Set the timeout to 250ms */ -- bcm2835_sdhost_write(host, host->mmc->actual_clock/4, SDTOUT); -+ /* Set the timeout to 500ms */ -+ bcm2835_sdhost_write(host, host->mmc->actual_clock/2, SDTOUT); - - if (host->debug) - pr_info("%s: clock=%d -> max_clk=%d, cdiv=%x (actual clock %d)\n", -@@ -1606,8 +1608,16 @@ static int bcm2835_sdhost_multi_io_quirk(struct mmc_card *card, - - host = mmc_priv(card->host); - -- if (direction == MMC_DATA_READ) -- { -+ if (!host->sectors) { -+ /* csd.capacity is in weird units - convert to sectors */ -+ u32 card_sectors = (card->csd.capacity << (card->csd.read_blkbits - 9)); -+ if ((direction == MMC_DATA_READ) && -+ ((blk_pos + blk_size) == card_sectors)) -+ blk_size--; -+ return blk_size; -+ } -+ -+ if (direction == MMC_DATA_READ) { - int i; - int sector; - for (i = 0; blk_pos > (sector = host->single_read_sectors[i]); i++) -@@ -1838,8 +1848,14 @@ static int bcm2835_sdhost_probe(struct platform_device *pdev) - host->allow_dma = ALLOW_DMA && - !of_property_read_bool(node, "brcm,force-pio"); - host->debug = of_property_read_bool(node, "brcm,debug"); -+ of_property_read_u32(node, -+ "brcm,debug-flags", -+ &host->debug_flags); - } - -+ if (host->debug_flags) -+ dev_err(dev, "debug_flags=%x\n", host->debug_flags); ++ state = (tpa6130a2_read(TPA6130A2_REG_VOL_MUTE) & 0x80) == 0; ++ if (state == enable) ++ return 0; /* No change */ + - if (host->allow_dma) { - if (node) { - host->dma_chan_tx = - -From 1a451a35b70fa9ed32f23a4ba925e5b2c2c3af78 Mon Sep 17 00:00:00 2001 -From: Phil Elwell <phil@raspberrypi.org> -Date: Mon, 25 Jan 2016 09:12:06 +0000 -Subject: [PATCH 138/170] BCM270X_DT: Add sdio_overclock parameter to sdio - overlay - -The sdio_overclock parameter is like the overclock_50 parameter, i.e. -it sets an alternate frequency (in MHz) to use when the MMC framework -requests 50MHz, except that it applies to the SDIO bus. - -Be aware that the actual frequencies achievable are limited to even integer -divisions of 250MHz, and that the driver will round up to include fractions -(e.g. 62 will include 62.5) but then round down to the nearest frequency. -In other words, the chosen frequency is the highest possible that is less than -the parameter value + 1. In practise this means that 62 is the only sensible -value. - -Examples: - 250MHz/4 = 62.5MHz (sdio_overclock=62) - 250MHz/2 = 125MHz (sdio_overclock=125) # Too fast ---- - arch/arm/boot/dts/overlays/README | 9 ++++++--- - arch/arm/boot/dts/overlays/sdio-overlay.dts | 2 ++ - 2 files changed, 8 insertions(+), 3 deletions(-) - -diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README -index 34a1b7f..709d3e4 100644 ---- a/arch/arm/boot/dts/overlays/README -+++ b/arch/arm/boot/dts/overlays/README -@@ -53,8 +53,8 @@ have its contents deleted (or commented out). - Using Overlays - ============== ++ tpa6130a2_channel_enable(TPA6130A2_HP_EN_R | TPA6130A2_HP_EN_L, enable); ++ return 1; /* Changed */ ++} ++ + /* +- * TPA6130 volume. From -59.5 to 4 dB with increasing step size when going ++ * TPA6130 volume. From -59.5 to +4.0 dB with increasing step size when going + * down in gain. + */ + static const DECLARE_TLV_DB_RANGE(tpa6130_tlv, +@@ -277,6 +294,9 @@ static const struct snd_kcontrol_new tpa6130a2_controls[] = { + TPA6130A2_REG_VOL_MUTE, 0, 0x3f, 0, + tpa6130a2_get_volsw, tpa6130a2_put_volsw, + tpa6130_tlv), ++ SOC_SINGLE_EXT("TPA6130A2 Headphone Playback Switch", ++ TPA6130A2_REG_VOL_MUTE, 7, 1, 1, ++ tpa6130a2_get_volsw, tpa6130a2_put_hp_sw), + }; --Overlays are loaded using the "dtoverlay" directive. As an example, consider the --popular lirc-rpi module, the Linux Infrared Remote Control driver. In the -+Overlays are loaded using the "dtoverlay" directive. As an example, consider -+the popular lirc-rpi module, the Linux Infrared Remote Control driver. In the - pre-DT world this would be loaded from /etc/modules, with an explicit - "modprobe lirc-rpi" command, or programmatically by lircd. With DT enabled, - this becomes a line in config.txt: -@@ -621,9 +621,12 @@ Name: sdio - Info: Selects the bcm2835-sdhost SD/MMC driver, optionally with overclock, - and enables SDIO via GPIOs 22-27. - Load: dtoverlay=sdio,<param>=<val> --Params: overclock_50 Clock (in MHz) to use when the MMC framework -+Params: overclock_50 SD Clock (in MHz) to use when the MMC framework - requests 50MHz - -+ sdio_overclock SDIO Clock (in MHz) to use when the MMC -+ framework requests 50MHz -+ - force_pio Disable DMA support (default off) - - pio_limit Number of blocks above which to use DMA -diff --git a/arch/arm/boot/dts/overlays/sdio-overlay.dts b/arch/arm/boot/dts/overlays/sdio-overlay.dts -index 7935e7a..398bd81 100644 ---- a/arch/arm/boot/dts/overlays/sdio-overlay.dts -+++ b/arch/arm/boot/dts/overlays/sdio-overlay.dts -@@ -12,6 +12,7 @@ - pinctrl-0 = <&sdio_pins>; - non-removable; - bus-width = <4>; -+ brcm,overclock-50 = <0>; - status = "okay"; - }; - }; -@@ -30,5 +31,6 @@ - __overrides__ { - poll_once = <&sdio_mmc>,"non-removable?"; - bus_width = <&sdio_mmc>,"bus-width:0"; -+ sdio_overclock = <&sdio_mmc>,"brcm,overclock-50:0"; - }; + static const DECLARE_TLV_DB_RANGE(tpa6140_tlv, +@@ -290,6 +310,9 @@ static const struct snd_kcontrol_new tpa6140a2_controls[] = { + TPA6130A2_REG_VOL_MUTE, 1, 0x1f, 0, + tpa6130a2_get_volsw, tpa6130a2_put_volsw, + tpa6140_tlv), ++ SOC_SINGLE_EXT("TPA6140A2 Headphone Playback Switch", ++ TPA6130A2_REG_VOL_MUTE, 7, 1, 1, ++ tpa6130a2_get_volsw, tpa6130a2_put_hp_sw), }; + + /* -From 49ff16d7af98e6191d6dd60ba75b711612e948ab Mon Sep 17 00:00:00 2001 -From: Michael Lange <linuxstuff@milaw.biz> -Date: Thu, 21 Jan 2016 18:10:16 +0100 -Subject: [PATCH 139/170] rtc: ds1307: add support for the DT property - 'wakeup-source' - -For RTC chips with no IRQ directly connected to the SoC, the RTC chip -can be forced as a wakeup source by stating that explicitly in -the device's .dts file using the "wakeup-source" boolean property. -This will guarantee the 'wakealarm' sysfs entry is available on the -device, if supported by the RTC. - -With these changes to the driver rtc-ds1307 and the necessary entries -in the .dts file, I get an working ds1337 RTC on the Witty Pi extension -board by UUGear for the Raspberry Pi. - -An example for the entry in the .dts file: - - rtc: ds1337@68 { - compatible = "dallas,ds1337"; - reg = <0x68>; - wakeup-source; +From 5859bcaed12501a27b5ac8adb573eccb739bbc7e Mon Sep 17 00:00:00 2001 +From: P33M <P33M@github.com> +Date: Wed, 21 Oct 2015 14:55:21 +0100 +Subject: [PATCH 084/112] rpi_display: add backlight driver and overlay -If the "wakeup-source" property is set, do not request an IRQ. -Set also UIE mode to unsupported, to get a working 'hwclock' binary. +Add a mailbox-driven backlight controller for the Raspberry Pi DSI +touchscreen display. Requires updated GPU firmware to recognise the +mailbox request. -Signed-off-by: Michael Lange <linuxstuff@milaw.biz> -Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com> +Signed-off-by: Gordon Hollingworth <gordon@raspberrypi.org> --- - drivers/rtc/rtc-ds1307.c | 29 +++++++++++++++++++++++++++-- - 1 file changed, 27 insertions(+), 2 deletions(-) + drivers/video/backlight/Kconfig | 6 ++ + drivers/video/backlight/Makefile | 1 + + drivers/video/backlight/rpi_backlight.c | 119 ++++++++++++++++++++++++++++++++ + 3 files changed, 126 insertions(+) + create mode 100644 drivers/video/backlight/rpi_backlight.c -diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c -index 1cb13fee..28ca4bf 100644 ---- a/drivers/rtc/rtc-ds1307.c -+++ b/drivers/rtc/rtc-ds1307.c -@@ -860,6 +860,7 @@ static int ds1307_probe(struct i2c_client *client, - struct chip_desc *chip = &chips[id->driver_data]; - struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent); - bool want_irq = false; -+ bool ds1307_can_wakeup_device = false; - unsigned char *buf; - struct ds1307_platform_data *pdata = dev_get_platdata(&client->dev); - irq_handler_t irq_handler = ds1307_irq; -@@ -907,6 +908,20 @@ static int ds1307_probe(struct i2c_client *client, - ds1307->write_block_data = ds1307_write_block_data; - } - -+#ifdef CONFIG_OF -+/* -+ * For devices with no IRQ directly connected to the SoC, the RTC chip -+ * can be forced as a wakeup source by stating that explicitly in -+ * the device's .dts file using the "wakeup-source" boolean property. -+ * If the "wakeup-source" property is set, don't request an IRQ. -+ * This will guarantee the 'wakealarm' sysfs entry is available on the device, -+ * if supported by the RTC. -+ */ -+ if (of_property_read_bool(client->dev.of_node, "wakeup-source")) { -+ ds1307_can_wakeup_device = true; -+ } -+#endif -+ - switch (ds1307->type) { - case ds_1337: - case ds_1339: -@@ -925,11 +940,13 @@ static int ds1307_probe(struct i2c_client *client, - ds1307->regs[0] &= ~DS1337_BIT_nEOSC; - - /* -- * Using IRQ? Disable the square wave and both alarms. -+ * Using IRQ or defined as wakeup-source? -+ * Disable the square wave and both alarms. - * For some variants, be sure alarms can trigger when we're - * running on Vbackup (BBSQI/BBSQW) - */ -- if (ds1307->client->irq > 0 && chip->alarm) { -+ if (chip->alarm && (ds1307->client->irq > 0 || -+ ds1307_can_wakeup_device)) { - ds1307->regs[0] |= DS1337_BIT_INTCN - | bbsqi_bitpos[ds1307->type]; - ds1307->regs[0] &= ~(DS1337_BIT_A2IE | DS1337_BIT_A1IE); -@@ -1144,6 +1161,14 @@ static int ds1307_probe(struct i2c_client *client, - return PTR_ERR(ds1307->rtc); - } +diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig +index 5ffa4b4..c3023ab 100644 +--- a/drivers/video/backlight/Kconfig ++++ b/drivers/video/backlight/Kconfig +@@ -265,6 +265,12 @@ config BACKLIGHT_PWM + If you have a LCD backlight adjustable by PWM, say Y to enable + this driver. -+ if (ds1307_can_wakeup_device) { -+ /* Disable request for an IRQ */ -+ want_irq = false; -+ dev_info(&client->dev, "'wakeup-source' is set, request for an IRQ is disabled!\n"); -+ /* We cannot support UIE mode if we do not have an IRQ line */ -+ ds1307->rtc->uie_unsupported = 1; -+ } ++config BACKLIGHT_RPI ++ tristate "Raspberry Pi display firmware driven backlight" ++ help ++ If you have the Raspberry Pi DSI touchscreen display, say Y to ++ enable the mailbox-controlled backlight driver. + - if (want_irq) { - err = devm_request_threaded_irq(&client->dev, - client->irq, NULL, irq_handler, - -From e382e888be3f59b0ba3645809ae686947313e0c1 Mon Sep 17 00:00:00 2001 -From: vitalogy <vitalogy_github@milaw.biz> -Date: Tue, 19 Jan 2016 07:02:02 +0100 -Subject: [PATCH 140/170] dt-overlay: add wittypi-overlay.dts - ---- - arch/arm/boot/dts/overlays/wittypi-overlay.dts | 44 ++++++++++++++++++++++++++ - 1 file changed, 44 insertions(+) - create mode 100644 arch/arm/boot/dts/overlays/wittypi-overlay.dts - -diff --git a/arch/arm/boot/dts/overlays/wittypi-overlay.dts b/arch/arm/boot/dts/overlays/wittypi-overlay.dts + config BACKLIGHT_DA903X + tristate "Backlight Driver for DA9030/DA9034 using WLED" + depends on PMIC_DA903X +diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile +index 16ec534..00eff87 100644 +--- a/drivers/video/backlight/Makefile ++++ b/drivers/video/backlight/Makefile +@@ -50,6 +50,7 @@ obj-$(CONFIG_BACKLIGHT_PANDORA) += pandora_bl.o + obj-$(CONFIG_BACKLIGHT_PCF50633) += pcf50633-backlight.o + obj-$(CONFIG_BACKLIGHT_PM8941_WLED) += pm8941-wled.o + obj-$(CONFIG_BACKLIGHT_PWM) += pwm_bl.o ++obj-$(CONFIG_BACKLIGHT_RPI) += rpi_backlight.o + obj-$(CONFIG_BACKLIGHT_SAHARA) += kb3886_bl.o + obj-$(CONFIG_BACKLIGHT_SKY81452) += sky81452-backlight.o + obj-$(CONFIG_BACKLIGHT_TOSA) += tosa_bl.o +diff --git a/drivers/video/backlight/rpi_backlight.c b/drivers/video/backlight/rpi_backlight.c new file mode 100644 -index 0000000..be5987d +index 0000000..14a0d9b --- /dev/null -+++ b/arch/arm/boot/dts/overlays/wittypi-overlay.dts -@@ -0,0 +1,44 @@ ++++ b/drivers/video/backlight/rpi_backlight.c +@@ -0,0 +1,119 @@ +/* -+ * Device Tree overlay for Witty Pi extension board by UUGear ++ * rpi_bl.c - Backlight controller through VPU + * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 as ++ * published by the Free Software Foundation. + */ + -+/dts-v1/; -+/plugin/; ++#include <linux/backlight.h> ++#include <linux/err.h> ++#include <linux/fb.h> ++#include <linux/gpio.h> ++#include <linux/init.h> ++#include <linux/kernel.h> ++#include <linux/module.h> ++#include <linux/of.h> ++#include <linux/of_gpio.h> ++#include <linux/platform_device.h> ++#include <linux/slab.h> ++#include <soc/bcm2835/raspberrypi-firmware.h> + -+/ { ++struct rpi_backlight { ++ struct device *dev; ++ struct device *fbdev; ++ struct rpi_firmware *fw; ++}; + -+ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; ++static int rpi_backlight_update_status(struct backlight_device *bl) ++{ ++ struct rpi_backlight *gbl = bl_get_data(bl); ++ int brightness = bl->props.brightness; ++ int ret; + -+ fragment@0 { -+ target = <&leds>; -+ __overlay__ { -+ compatible = "gpio-leds"; -+ wittypi_led: wittypi_led { -+ label = "wittypi_led"; -+ linux,default-trigger = "default-on"; -+ gpios = <&gpio 17 0>; -+ }; -+ }; -+ }; ++ if (bl->props.power != FB_BLANK_UNBLANK || ++ bl->props.fb_blank != FB_BLANK_UNBLANK || ++ bl->props.state & (BL_CORE_SUSPENDED | BL_CORE_FBBLANK)) ++ brightness = 0; + -+ fragment@1 { -+ target = <&i2c1>; -+ __overlay__ { -+ #address-cells = <1>; -+ #size-cells = <0>; ++ ret = rpi_firmware_property(gbl->fw, ++ RPI_FIRMWARE_FRAMEBUFFER_SET_BACKLIGHT, ++ &brightness, sizeof(brightness)); ++ if (ret) { ++ dev_err(gbl->dev, "Failed to set brightness\n"); ++ return ret; ++ } + -+ rtc: ds1337@68 { -+ compatible = "dallas,ds1337"; -+ reg = <0x68>; -+ wakeup-source; -+ }; -+ }; -+ }; ++ if (brightness < 0) { ++ dev_err(gbl->dev, "Backlight change failed\n"); ++ return -EAGAIN; ++ } + -+ __overrides__ { -+ led_gpio = <&wittypi_led>,"gpios:4"; -+ led_trigger = <&wittypi_led>,"linux,default-trigger"; -+ }; ++ return 0; ++} + ++static const struct backlight_ops rpi_backlight_ops = { ++ .options = BL_CORE_SUSPENDRESUME, ++ .update_status = rpi_backlight_update_status, +}; - -From 6dcfc3daab7c1c459b36261163b4e1dc15a6e965 Mon Sep 17 00:00:00 2001 -From: Phil Elwell <phil@raspberrypi.org> -Date: Wed, 3 Feb 2016 16:12:54 +0000 -Subject: [PATCH 141/170] BCM270X_DT: Disable DMA for bcm2835-sdhost on Pi2 - -This is an interim patch to verify that problems seen with -some cards can be worked around at the expense of an increased -CPU load by forcing PIO mode. - -Although this could have used the brcm,force-pio attribute, that -is a boolean (true if present, false if absent) and attributes -can't be deleted by overlays. Instead, make brcm,pio-limit -unfeasibly high instead to allow DMA to be re-enabled using the -pio_limit parameter of the sdhost or sdtweak overlays. ---- - arch/arm/boot/dts/bcm2709-rpi-2-b.dts | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/arch/arm/boot/dts/bcm2709-rpi-2-b.dts b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts -index 5206ba2..0b68db5 100644 ---- a/arch/arm/boot/dts/bcm2709-rpi-2-b.dts -+++ b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts -@@ -43,6 +43,7 @@ - pinctrl-names = "default"; - pinctrl-0 = <&sdhost_pins>; - bus-width = <4>; -+ brcm,pio-limit = <0x7fffffff>; - status = "okay"; - }; - - -From 7519a79f61a67792e238a118db58600fb5f60ec8 Mon Sep 17 00:00:00 2001 -From: Phil Elwell <phil@raspberrypi.org> -Date: Tue, 19 Jan 2016 16:28:05 +0000 -Subject: [PATCH 142/170] FIXUP i2c_bcm2708: Don't change module baudrate - parameter - -Overwriting the baudrate module parameter creates an apparent -forced baudrate for i2c busses after the first. Not only does this -override the baudrate from DT it also prevents the bus ID from -being initialised. - -Also fix whitespace errors. ---- - drivers/i2c/busses/i2c-bcm2708.c | 48 +++++++++++++++++++++------------------- - 1 file changed, 25 insertions(+), 23 deletions(-) - -diff --git a/drivers/i2c/busses/i2c-bcm2708.c b/drivers/i2c/busses/i2c-bcm2708.c -index b152639..c9b8e5c 100644 ---- a/drivers/i2c/busses/i2c-bcm2708.c -+++ b/drivers/i2c/busses/i2c-bcm2708.c -@@ -71,7 +71,6 @@ - - #define DRV_NAME "bcm2708_i2c" - --static unsigned int baudrate_default = CONFIG_I2C_BCM2708_BAUDRATE; - static unsigned int baudrate; - module_param(baudrate, uint, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP); - MODULE_PARM_DESC(baudrate, "The I2C baudrate"); -@@ -317,25 +316,28 @@ static int bcm2708_i2c_probe(struct platform_device *pdev) - struct i2c_adapter *adap; - unsigned long bus_hz; - u32 cdiv, clk_tout; -- -- if (!baudrate) { -- baudrate = baudrate_default; -- if (pdev->dev.of_node) { -- u32 bus_clk_rate; -- pdev->id = of_alias_get_id(pdev->dev.of_node, "i2c"); -- if (pdev->id < 0) { -- dev_err(&pdev->dev, "alias is missing\n"); -- return -EINVAL; -- } -- if (!of_property_read_u32(pdev->dev.of_node, -- "clock-frequency", &bus_clk_rate)) -- baudrate = bus_clk_rate; -- else -- dev_warn(&pdev->dev, -- "Could not read clock-frequency property\n"); -+ u32 baud; -+ -+ baud = CONFIG_I2C_BCM2708_BAUDRATE; + -+ if (pdev->dev.of_node) { -+ u32 bus_clk_rate; -+ pdev->id = of_alias_get_id(pdev->dev.of_node, "i2c"); -+ if (pdev->id < 0) { -+ dev_err(&pdev->dev, "alias is missing\n"); -+ return -EINVAL; - } -+ if (!of_property_read_u32(pdev->dev.of_node, -+ "clock-frequency", &bus_clk_rate)) -+ baud = bus_clk_rate; -+ else -+ dev_warn(&pdev->dev, -+ "Could not read clock-frequency property\n"); - } - -+ if (baudrate) -+ baud = baudrate; ++static int rpi_backlight_probe(struct platform_device *pdev) ++{ ++ struct backlight_properties props; ++ struct backlight_device *bl; ++ struct rpi_backlight *gbl; ++ struct device_node *fw_node; + - regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!regs) { - dev_err(&pdev->dev, "could not get IO memory\n"); -@@ -419,21 +421,21 @@ static int bcm2708_i2c_probe(struct platform_device *pdev) - } - - bus_hz = clk_get_rate(bi->clk); -- cdiv = bus_hz / baudrate; -+ cdiv = bus_hz / baud; - if (cdiv > 0xffff) { - cdiv = 0xffff; -- baudrate = bus_hz / cdiv; -+ baud = bus_hz / cdiv; - } -- -- clk_tout = 35/1000*baudrate; //35ms timeout as per SMBus specs. -- if (clk_tout > 0xffff) ++ gbl = devm_kzalloc(&pdev->dev, sizeof(*gbl), GFP_KERNEL); ++ if (gbl == NULL) ++ return -ENOMEM; + -+ clk_tout = 35/1000*baud; //35ms timeout as per SMBus specs. -+ if (clk_tout > 0xffff) - clk_tout = 0xffff; - - bi->cdiv = cdiv; - bi->clk_tout = clk_tout; - - dev_info(&pdev->dev, "BSC%d Controller at 0x%08lx (irq %d) (baudrate %d)\n", -- pdev->id, (unsigned long)regs->start, irq, baudrate); -+ pdev->id, (unsigned long)regs->start, irq, baud); - - return 0; - - -From f2d36d57d7e17b9f44ff914824df5b150eb9e3bd Mon Sep 17 00:00:00 2001 -From: Digital Dreamtime <clive.messer@digitaldreamtime.co.uk> -Date: Thu, 4 Feb 2016 14:14:44 +0000 -Subject: [PATCH 143/170] Allow up to 24dB digital gain to be applied when - using IQAudIO DAC+ - -24db_digital_gain DT param can be used to specify that PCM512x -codec "Digital" volume control should not be limited to 0dB gain, -and if specified will allow the full 24dB gain. ---- - arch/arm/boot/dts/overlays/README | 17 +++++++++++++++-- - .../boot/dts/overlays/iqaudio-dacplus-overlay.dts | 6 +++++- - sound/soc/bcm/iqaudio-dac.c | 20 ++++++++++++++------ - 3 files changed, 34 insertions(+), 9 deletions(-) - -diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README -index 709d3e4..3c8436e 100644 ---- a/arch/arm/boot/dts/overlays/README -+++ b/arch/arm/boot/dts/overlays/README -@@ -362,8 +362,21 @@ Params: <None> - - Name: iqaudio-dacplus - Info: Configures the IQaudio DAC+ audio card --Load: dtoverlay=iqaudio-dacplus --Params: <None> -+Load: dtoverlay=iqaudio-dacplus,<param>=<val> -+Params: 24db_digital_gain Allow gain to be applied via the PCM512x codec -+ Digital volume control. Enable with -+ "dtoverlay=iqaudio-dacplus,24db_digital_gain" -+ (The default behaviour is that the Digital -+ volume control is limited to a maximum of -+ 0dB. ie. it can attenuate but not provide -+ gain. For most users, this will be desired -+ as it will prevent clipping. By appending -+ the 24db_digital_gain parameter, the Digital -+ volume control will allow up to 24dB of -+ gain. If this parameter is enabled, it is the -+ responsibility of the user to ensure that -+ the Digital volume control is set to a value -+ that does not result in clipping/distortion!) - - - Name: lirc-rpi -diff --git a/arch/arm/boot/dts/overlays/iqaudio-dacplus-overlay.dts b/arch/arm/boot/dts/overlays/iqaudio-dacplus-overlay.dts -index 735d8ab..e0aaf8f 100644 ---- a/arch/arm/boot/dts/overlays/iqaudio-dacplus-overlay.dts -+++ b/arch/arm/boot/dts/overlays/iqaudio-dacplus-overlay.dts -@@ -7,7 +7,7 @@ - - fragment@0 { - target = <&sound>; -- __overlay__ { -+ frag0: __overlay__ { - compatible = "iqaudio,iqaudio-dac"; - i2s-controller = <&i2s>; - status = "okay"; -@@ -36,4 +36,8 @@ - }; - }; - }; ++ gbl->dev = &pdev->dev; + -+ __overrides__ { -+ 24db_digital_gain = <&frag0>,"iqaudio,24db_digital_gain?"; -+ }; - }; -diff --git a/sound/soc/bcm/iqaudio-dac.c b/sound/soc/bcm/iqaudio-dac.c -index 37038d4..124d7a9 100644 ---- a/sound/soc/bcm/iqaudio-dac.c -+++ b/sound/soc/bcm/iqaudio-dac.c -@@ -23,14 +23,19 @@ - #include <sound/soc.h> - #include <sound/jack.h> - -+static bool digital_gain_0db_limit = true; ++ fw_node = of_parse_phandle(pdev->dev.of_node, "firmware", 0); ++ if (!fw_node) { ++ dev_err(&pdev->dev, "Missing firmware node\n"); ++ return -ENOENT; ++ } + - static int snd_rpi_iqaudio_dac_init(struct snd_soc_pcm_runtime *rtd) - { -- int ret; -- struct snd_soc_card *card = rtd->card; -- -- ret = snd_soc_limit_volume(card, "Digital Playback Volume", 207); -- if (ret < 0) -- dev_warn(card->dev, "Failed to set volume limit: %d\n", ret); -+ if (digital_gain_0db_limit) -+ { -+ int ret; -+ struct snd_soc_card *card = rtd->card; ++ gbl->fw = rpi_firmware_get(fw_node); ++ if (!gbl->fw) ++ return -EPROBE_DEFER; + -+ ret = snd_soc_limit_volume(card, "Digital Playback Volume", 207); -+ if (ret < 0) -+ dev_warn(card->dev, "Failed to set volume limit: %d\n", ret); ++ memset(&props, 0, sizeof(props)); ++ props.type = BACKLIGHT_RAW; ++ props.max_brightness = 255; ++ bl = devm_backlight_device_register(&pdev->dev, dev_name(&pdev->dev), ++ &pdev->dev, gbl, &rpi_backlight_ops, ++ &props); ++ if (IS_ERR(bl)) { ++ dev_err(&pdev->dev, "failed to register backlight\n"); ++ return PTR_ERR(bl); + } - - return 0; - } -@@ -94,6 +99,9 @@ static int snd_rpi_iqaudio_dac_probe(struct platform_device *pdev) - dai->platform_name = NULL; - dai->platform_of_node = i2s_node; - } -+ -+ digital_gain_0db_limit = !of_property_read_bool(pdev->dev.of_node, -+ "iqaudio,24db_digital_gain"); - } - - ret = snd_soc_register_card(&snd_rpi_iqaudio_dac); - -From 8a189f18de820c6facd00ba2db97ba7c4a75156f Mon Sep 17 00:00:00 2001 -From: Digital Dreamtime <clive.messer@digitaldreamtime.co.uk> -Date: Thu, 4 Feb 2016 20:04:00 +0000 -Subject: [PATCH 144/170] Limit PCM512x "Digital" gain to 0dB by default with - HiFiBerry DAC+ - -24db_digital_gain DT param can be used to specify that PCM512x -codec "Digital" volume control should not be limited to 0dB gain, -and if specified will allow the full 24dB gain. ---- - arch/arm/boot/dts/overlays/README | 17 +++++++++++++++-- - .../arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts | 6 +++++- - sound/soc/bcm/hifiberry_dacplus.c | 14 ++++++++++++++ - 3 files changed, 34 insertions(+), 3 deletions(-) - -diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README -index 3c8436e..296184f 100644 ---- a/arch/arm/boot/dts/overlays/README -+++ b/arch/arm/boot/dts/overlays/README -@@ -273,8 +273,21 @@ Params: <None> - - Name: hifiberry-dacplus - Info: Configures the HifiBerry DAC+ audio card --Load: dtoverlay=hifiberry-dacplus --Params: <None> -+Load: dtoverlay=hifiberry-dacplus,<param>=<val> -+Params: 24db_digital_gain Allow gain to be applied via the PCM512x codec -+ Digital volume control. Enable with -+ "dtoverlay=hifiberry-dacplus,24db_digital_gain" -+ (The default behaviour is that the Digital -+ volume control is limited to a maximum of -+ 0dB. ie. it can attenuate but not provide -+ gain. For most users, this will be desired -+ as it will prevent clipping. By appending -+ the 24dB_digital_gain parameter, the Digital -+ volume control will allow up to 24dB of -+ gain. If this parameter is enabled, it is the -+ responsibility of the user to ensure that -+ the Digital volume control is set to a value -+ that does not result in clipping/distortion!) - - - Name: hifiberry-digi -diff --git a/arch/arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts b/arch/arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts -index f923a48..42a0194 100644 ---- a/arch/arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts -+++ b/arch/arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts -@@ -17,7 +17,7 @@ - - fragment@1 { - target = <&sound>; -- __overlay__ { -+ frag1: __overlay__ { - compatible = "hifiberry,hifiberry-dacplus"; - i2s-controller = <&i2s>; - status = "okay"; -@@ -47,4 +47,8 @@ - }; - }; - }; + -+ __overrides__ { -+ 24db_digital_gain = <&frag1>,"hifiberry,24db_digital_gain?"; -+ }; - }; -diff --git a/sound/soc/bcm/hifiberry_dacplus.c b/sound/soc/bcm/hifiberry_dacplus.c -index a6b651c..153dbcd 100644 ---- a/sound/soc/bcm/hifiberry_dacplus.c -+++ b/sound/soc/bcm/hifiberry_dacplus.c -@@ -48,6 +48,7 @@ struct pcm512x_priv { - #define CLK_48EN_RATE 24576000UL - - static bool snd_rpi_hifiberry_is_dacpro; -+static bool digital_gain_0db_limit = true; - - static void snd_rpi_hifiberry_dacplus_select_clk(struct snd_soc_codec *codec, - int clk_id) -@@ -167,6 +168,16 @@ static int snd_rpi_hifiberry_dacplus_init(struct snd_soc_pcm_runtime *rtd) - snd_soc_update_bits(codec, PCM512x_GPIO_OUTPUT_4, 0x0f, 0x02); - snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x08, 0x08); - -+ if (digital_gain_0db_limit) -+ { -+ int ret; -+ struct snd_soc_card *card = rtd->card; ++ bl->props.brightness = 255; ++ backlight_update_status(bl); + -+ ret = snd_soc_limit_volume(card, "Digital Playback Volume", 207); -+ if (ret < 0) -+ dev_warn(card->dev, "Failed to set volume limit: %d\n", ret); -+ } ++ platform_set_drvdata(pdev, bl); ++ return 0; ++} + - return 0; - } - -@@ -299,6 +310,9 @@ static int snd_rpi_hifiberry_dacplus_probe(struct platform_device *pdev) - dai->platform_name = NULL; - dai->platform_of_node = i2s_node; - } ++static const struct of_device_id rpi_backlight_of_match[] = { ++ { .compatible = "raspberrypi,rpi-backlight" }, ++ { /* sentinel */ } ++}; ++MODULE_DEVICE_TABLE(of, rpi_backlight_of_match); + -+ digital_gain_0db_limit = !of_property_read_bool( -+ pdev->dev.of_node, "hifiberry,24db_digital_gain"); - } - - ret = snd_soc_register_card(&snd_rpi_hifiberry_dacplus); - -From 14ba431031afa218c0db43a7c20fe54916f8d357 Mon Sep 17 00:00:00 2001 -From: Phil Elwell <phil@raspberrypi.org> -Date: Mon, 8 Feb 2016 09:46:33 +0000 -Subject: [PATCH 145/170] BCM270X_DT: Adjust overlay README formatting - ---- - arch/arm/boot/dts/overlays/README | 420 +++++++++++++++++++------------------- - 1 file changed, 210 insertions(+), 210 deletions(-) - -diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README -index 296184f..ec1ae91 100644 ---- a/arch/arm/boot/dts/overlays/README -+++ b/arch/arm/boot/dts/overlays/README -@@ -83,58 +83,58 @@ Name: <The base DTB> - Info: Configures the base Raspberry Pi hardware - Load: <loaded automatically> - Params: -- audio Set to "on" to enable the onboard ALSA audio -- interface (default "off") -+ audio Set to "on" to enable the onboard ALSA audio -+ interface (default "off") - -- i2c_arm Set to "on" to enable the ARM's i2c interface -- (default "off") -+ i2c_arm Set to "on" to enable the ARM's i2c interface -+ (default "off") - -- i2c_vc Set to "on" to enable the i2c interface -- usually reserved for the VideoCore processor -- (default "off") -+ i2c_vc Set to "on" to enable the i2c interface -+ usually reserved for the VideoCore processor -+ (default "off") - -- i2c An alias for i2c_arm -+ i2c An alias for i2c_arm - -- i2c_arm_baudrate Set the baudrate of the ARM's i2c interface -- (default "100000") -+ i2c_arm_baudrate Set the baudrate of the ARM's i2c interface -+ (default "100000") - -- i2c_vc_baudrate Set the baudrate of the VideoCore i2c interface -- (default "100000") -+ i2c_vc_baudrate Set the baudrate of the VideoCore i2c interface -+ (default "100000") - -- i2c_baudrate An alias for i2c_arm_baudrate -+ i2c_baudrate An alias for i2c_arm_baudrate - -- i2s Set to "on" to enable the i2s interface -- (default "off") -+ i2s Set to "on" to enable the i2s interface -+ (default "off") - -- spi Set to "on" to enable the spi interfaces -- (default "off") -+ spi Set to "on" to enable the spi interfaces -+ (default "off") - -- random Set to "on" to enable the hardware random -- number generator (default "on") -+ random Set to "on" to enable the hardware random -+ number generator (default "on") - -- uart0 Set to "off" to disable uart0 (default "on") -+ uart0 Set to "off" to disable uart0 (default "on") - -- watchdog Set to "on" to enable the hardware watchdog -- (default "off") -+ watchdog Set to "on" to enable the hardware watchdog -+ (default "off") - -- act_led_trigger Choose which activity the LED tracks. -- Use "heartbeat" for a nice load indicator. -- (default "mmc") -+ act_led_trigger Choose which activity the LED tracks. -+ Use "heartbeat" for a nice load indicator. -+ (default "mmc") - -- act_led_activelow Set to "on" to invert the sense of the LED -- (default "off") -+ act_led_activelow Set to "on" to invert the sense of the LED -+ (default "off") - -- act_led_gpio Set which GPIO to use for the activity LED -- (in case you want to connect it to an external -- device) -- (default "16" on a non-Plus board, "47" on a -- Plus or Pi 2) -+ act_led_gpio Set which GPIO to use for the activity LED -+ (in case you want to connect it to an external -+ device) -+ (default "16" on a non-Plus board, "47" on a -+ Plus or Pi 2) - - pwr_led_trigger - pwr_led_activelow - pwr_led_gpio -- As for act_led_*, but using the PWR LED. -- Not available on Model A/B boards. -+ As for act_led_*, but using the PWR LED. -+ Not available on Model A/B boards. - - N.B. It is recommended to only enable those interfaces that are needed. - Leaving all interfaces enabled can lead to unwanted behaviour (i2c_vc -@@ -149,19 +149,19 @@ Params: - Name: ads7846 - Info: ADS7846 Touch controller - Load: dtoverlay=ads7846,<param>=<val> --Params: cs SPI bus Chip Select (default 1) -- speed SPI bus speed (default 2MHz, max 3.25MHz) -- penirq GPIO used for PENIRQ. REQUIRED -- penirq_pull Set GPIO pull (default 0=none, 2=pullup) -- swapxy Swap x and y axis -- xmin Minimum value on the X axis (default 0) -- ymin Minimum value on the Y axis (default 0) -- xmax Maximum value on the X axis (default 4095) -- ymax Maximum value on the Y axis (default 4095) -- pmin Minimum reported pressure value (default 0) -- pmax Maximum reported pressure value (default 65535) -- xohms Touchpanel sensitivity (X-plate resistance) -- (default 400) -+Params: cs SPI bus Chip Select (default 1) -+ speed SPI bus speed (default 2MHz, max 3.25MHz) -+ penirq GPIO used for PENIRQ. REQUIRED -+ penirq_pull Set GPIO pull (default 0=none, 2=pullup) -+ swapxy Swap x and y axis -+ xmin Minimum value on the X axis (default 0) -+ ymin Minimum value on the Y axis (default 0) -+ xmax Maximum value on the X axis (default 4095) -+ ymax Maximum value on the Y axis (default 4095) -+ pmin Minimum reported pressure value (default 0) -+ pmax Maximum reported pressure value (default 65535) -+ xohms Touchpanel sensitivity (X-plate resistance) -+ (default 400) - - penirq is required and usually xohms (60-100) has to be set as well. - Apart from that, pmax (255) and swapxy are also common. -@@ -175,12 +175,12 @@ Name: at86rf233 - Info: Configures the Atmel AT86RF233 802.15.4 low-power WPAN transceiver, - connected to spi0.0 - Load: dtoverlay=at86rf233,<param>=<val> --Params: interrupt GPIO used for INT (default 23) -- reset GPIO used for Reset (default 24) -- sleep GPIO used for Sleep (default 25) -- speed SPI bus speed in Hz (default 6000000) -- trim Fine tuning of the internal capacitance -- arrays (0=+0pF, 15=+4.5pF, default 15) -+Params: interrupt GPIO used for INT (default 23) -+ reset GPIO used for Reset (default 24) -+ sleep GPIO used for Sleep (default 25) -+ speed SPI bus speed in Hz (default 6000000) -+ trim Fine tuning of the internal capacitance -+ arrays (0=+0pF, 15=+4.5pF, default 15) - - - Name: bmp085_i2c-sensor -@@ -194,8 +194,8 @@ Name: dht11 - Info: Overlay for the DHT11/DHT21/DHT22 humidity/temperature sensors - Also sometimes found with the part number(s) AM230x. - Load: dtoverlay=dht11,<param>=<val> --Params: gpiopin GPIO connected to the sensor's DATA output. -- (default 4) -+Params: gpiopin GPIO connected to the sensor's DATA output. -+ (default 4) - - - Name: dwc-otg -@@ -208,15 +208,15 @@ Params: <None> - Name: dwc2 - Info: Selects the dwc2 USB controller driver - Load: dtoverlay=dwc2,<param>=<val> --Params: dr_mode Dual role mode: "host", "peripheral" or "otg" -+Params: dr_mode Dual role mode: "host", "peripheral" or "otg" - -- g-rx-fifo-size Size of rx fifo size in gadget mode -+ g-rx-fifo-size Size of rx fifo size in gadget mode - -- g-np-tx-fifo-size Size of non-periodic tx fifo size in gadget -- mode -+ g-np-tx-fifo-size Size of non-periodic tx fifo size in gadget -+ mode - -- g-tx-fifo-size Size of periodic tx fifo per endpoint -- (except ep0) in gadget mode -+ g-tx-fifo-size Size of periodic tx fifo per endpoint -+ (except ep0) in gadget mode - - - [ The ds1307-rtc overlay has been deleted. See i2c-rtc. ] -@@ -225,9 +225,9 @@ Params: dr_mode Dual role mode: "host", "peripheral" or "otg" - Name: enc28j60 - Info: Overlay for the Microchip ENC28J60 Ethernet Controller (SPI) - Load: dtoverlay=enc28j60,<param>=<val> --Params: int_pin GPIO used for INT (default 25) -+Params: int_pin GPIO used for INT (default 25) - -- speed SPI bus speed (default 12000000) -+ speed SPI bus speed (default 12000000) - - - Name: gpio-ir -@@ -237,26 +237,26 @@ Info: Use GPIO pin as rc-core style infrared receiver input. The rc-core- - not required! The key mapping and other decoding parameters can be - configured by "ir-keytable" tool. - Load: dtoverlay=gpio-ir,<param>=<val> --Params: gpio_pin Input pin number. Default is 18. -+Params: gpio_pin Input pin number. Default is 18. - -- gpio_pull Desired pull-up/down state (off, down, up) -- Default is "down". -+ gpio_pull Desired pull-up/down state (off, down, up) -+ Default is "down". - -- rc-map-name Default rc keymap (can also be changed by -- ir-keytable), defaults to "rc-rc6-mce" -+ rc-map-name Default rc keymap (can also be changed by -+ ir-keytable), defaults to "rc-rc6-mce" - - - Name: gpio-poweroff - Info: Drives a GPIO high or low on reboot - Load: dtoverlay=gpio-poweroff,<param>=<val> --Params: gpiopin GPIO for signalling (default 26) -+Params: gpiopin GPIO for signalling (default 26) - -- active_low Set if the power control device requires a -- high->low transition to trigger a power-down. -- Note that this will require the support of a -- custom dt-blob.bin to prevent a power-down -- during the boot process, and that a reboot -- will also cause the pin to go low. -+ active_low Set if the power control device requires a -+ high->low transition to trigger a power-down. -+ Note that this will require the support of a -+ custom dt-blob.bin to prevent a power-down -+ during the boot process, and that a reboot -+ will also cause the pin to go low. - - - Name: hifiberry-amp -@@ -300,65 +300,65 @@ Name: hy28a - Info: HY28A - 2.8" TFT LCD Display Module by HAOYU Electronics - Default values match Texy's display shield - Load: dtoverlay=hy28a,<param>=<val> --Params: speed Display SPI bus speed -+Params: speed Display SPI bus speed - -- rotate Display rotation {0,90,180,270} -+ rotate Display rotation {0,90,180,270} - -- fps Delay between frame updates -+ fps Delay between frame updates - -- debug Debug output level {0-7} -+ debug Debug output level {0-7} - -- xohms Touchpanel sensitivity (X-plate resistance) -+ xohms Touchpanel sensitivity (X-plate resistance) - -- resetgpio GPIO used to reset controller -+ resetgpio GPIO used to reset controller - -- ledgpio GPIO used to control backlight -+ ledgpio GPIO used to control backlight - - - Name: hy28b - Info: HY28B - 2.8" TFT LCD Display Module by HAOYU Electronics - Default values match Texy's display shield - Load: dtoverlay=hy28b,<param>=<val> --Params: speed Display SPI bus speed -+Params: speed Display SPI bus speed - -- rotate Display rotation {0,90,180,270} -+ rotate Display rotation {0,90,180,270} - -- fps Delay between frame updates -+ fps Delay between frame updates - -- debug Debug output level {0-7} -+ debug Debug output level {0-7} - -- xohms Touchpanel sensitivity (X-plate resistance) -+ xohms Touchpanel sensitivity (X-plate resistance) - -- resetgpio GPIO used to reset controller -+ resetgpio GPIO used to reset controller - -- ledgpio GPIO used to control backlight -+ ledgpio GPIO used to control backlight - - - Name: i2c-gpio - Info: Adds support for software i2c controller on gpio pins - Load: dtoverlay=i2c-gpio,<param>=<val> --Params: i2c_gpio_sda GPIO used for I2C data (default "23") -+Params: i2c_gpio_sda GPIO used for I2C data (default "23") - -- i2c_gpio_scl GPIO used for I2C clock (default "24") -+ i2c_gpio_scl GPIO used for I2C clock (default "24") - -- i2c_gpio_delay_us Clock delay in microseconds -- (default "2" = ~100kHz) -+ i2c_gpio_delay_us Clock delay in microseconds -+ (default "2" = ~100kHz) - - - Name: i2c-rtc - Info: Adds support for a number of I2C Real Time Clock devices - Load: dtoverlay=i2c-rtc,<param>=<val> --Params: ds1307 Select the DS1307 device -+Params: ds1307 Select the DS1307 device - -- ds3231 Select the DS3231 device -+ ds3231 Select the DS3231 device - -- mcp7941x Select the MCP7941x device -+ mcp7941x Select the MCP7941x device - -- pcf2127 Select the PCF2127 device -+ pcf2127 Select the PCF2127 device - -- pcf8523 Select the PCF8523 device -+ pcf8523 Select the PCF8523 device - -- pcf8563 Select the PCF8563 device -+ pcf8563 Select the PCF8563 device - - - Name: i2s-mmap -@@ -396,70 +396,70 @@ Name: lirc-rpi - Info: Configures lirc-rpi (Linux Infrared Remote Control for Raspberry Pi) - Consult the module documentation for more details. - Load: dtoverlay=lirc-rpi,<param>=<val> --Params: gpio_out_pin GPIO for output (default "17") -+Params: gpio_out_pin GPIO for output (default "17") - -- gpio_in_pin GPIO for input (default "18") -+ gpio_in_pin GPIO for input (default "18") - -- gpio_in_pull Pull up/down/off on the input pin -- (default "down") -+ gpio_in_pull Pull up/down/off on the input pin -+ (default "down") - -- sense Override the IR receive auto-detection logic: -- "0" = force active-high -- "1" = force active-low -- "-1" = use auto-detection -- (default "-1") -+ sense Override the IR receive auto-detection logic: -+ "0" = force active-high -+ "1" = force active-low -+ "-1" = use auto-detection -+ (default "-1") - -- softcarrier Turn the software carrier "on" or "off" -- (default "on") -+ softcarrier Turn the software carrier "on" or "off" -+ (default "on") - -- invert "on" = invert the output pin (default "off") -+ invert "on" = invert the output pin (default "off") - -- debug "on" = enable additional debug messages -- (default "off") -+ debug "on" = enable additional debug messages -+ (default "off") - - - Name: mcp2515-can0 - Info: Configures the MCP2515 CAN controller on spi0.0 - Load: dtoverlay=mcp2515-can0,<param>=<val> --Params: oscillator Clock frequency for the CAN controller (Hz) -+Params: oscillator Clock frequency for the CAN controller (Hz) - -- spimaxfrequency Maximum SPI frequence (Hz) -+ spimaxfrequency Maximum SPI frequence (Hz) - -- interrupt GPIO for interrupt signal -+ interrupt GPIO for interrupt signal - - - Name: mcp2515-can1 - Info: Configures the MCP2515 CAN controller on spi0.1 - Load: dtoverlay=mcp2515-can1,<param>=<val> --Params: oscillator Clock frequency for the CAN controller (Hz) -+Params: oscillator Clock frequency for the CAN controller (Hz) - -- spimaxfrequency Maximum SPI frequence (Hz) -+ spimaxfrequency Maximum SPI frequence (Hz) - -- interrupt GPIO for interrupt signal -+ interrupt GPIO for interrupt signal - - - Name: mmc - Info: Selects the bcm2835-mmc SD/MMC driver, optionally with overclock - Load: dtoverlay=mmc,<param>=<val> --Params: overclock_50 Clock (in MHz) to use when the MMC framework -- requests 50MHz -- force_pio Disable DMA support -+Params: overclock_50 Clock (in MHz) to use when the MMC framework -+ requests 50MHz -+ force_pio Disable DMA support - - - Name: mz61581 - Info: MZ61581 display by Tontec - Load: dtoverlay=mz61581,<param>=<val> --Params: speed Display SPI bus speed -+Params: speed Display SPI bus speed - -- rotate Display rotation {0,90,180,270} -+ rotate Display rotation {0,90,180,270} - -- fps Delay between frame updates -+ fps Delay between frame updates - -- txbuflen Transmit buffer length (default 32768) -+ txbuflen Transmit buffer length (default 32768) - -- debug Debug output level {0-7} -+ debug Debug output level {0-7} - -- xohms Touchpanel sensitivity (X-plate resistance) -+ xohms Touchpanel sensitivity (X-plate resistance) - - - [ The pcf2127-rtc overlay has been deleted. See i2c-rtc. ] -@@ -474,69 +474,69 @@ Params: speed Display SPI bus speed - Name: piscreen - Info: PiScreen display by OzzMaker.com - Load: dtoverlay=piscreen,<param>=<val> --Params: speed Display SPI bus speed -+Params: speed Display SPI bus speed - -- rotate Display rotation {0,90,180,270} -+ rotate Display rotation {0,90,180,270} - -- fps Delay between frame updates -+ fps Delay between frame updates - -- debug Debug output level {0-7} -+ debug Debug output level {0-7} - -- xohms Touchpanel sensitivity (X-plate resistance) -+ xohms Touchpanel sensitivity (X-plate resistance) - - - Name: piscreen2r - Info: PiScreen 2 with resistive TP display by OzzMaker.com - Load: dtoverlay=piscreen2r,<param>=<val> --Params: speed Display SPI bus speed -+Params: speed Display SPI bus speed - -- rotate Display rotation {0,90,180,270} -+ rotate Display rotation {0,90,180,270} - -- fps Delay between frame updates -+ fps Delay between frame updates - -- debug Debug output level {0-7} -+ debug Debug output level {0-7} - -- xohms Touchpanel sensitivity (X-plate resistance) -+ xohms Touchpanel sensitivity (X-plate resistance) - - - Name: pitft28-capacitive - Info: Adafruit PiTFT 2.8" capacitive touch screen - Load: dtoverlay=pitft28-capacitive,<param>=<val> --Params: speed Display SPI bus speed -+Params: speed Display SPI bus speed - -- rotate Display rotation {0,90,180,270} -+ rotate Display rotation {0,90,180,270} - -- fps Delay between frame updates -+ fps Delay between frame updates - -- debug Debug output level {0-7} -+ debug Debug output level {0-7} - -- touch-sizex Touchscreen size x (default 240) -+ touch-sizex Touchscreen size x (default 240) - -- touch-sizey Touchscreen size y (default 320) -+ touch-sizey Touchscreen size y (default 320) - -- touch-invx Touchscreen inverted x axis -+ touch-invx Touchscreen inverted x axis - -- touch-invy Touchscreen inverted y axis -+ touch-invy Touchscreen inverted y axis - -- touch-swapxy Touchscreen swapped x y axis -+ touch-swapxy Touchscreen swapped x y axis - - - Name: pitft28-resistive - Info: Adafruit PiTFT 2.8" resistive touch screen - Load: dtoverlay=pitft28-resistive,<param>=<val> --Params: speed Display SPI bus speed -+Params: speed Display SPI bus speed - -- rotate Display rotation {0,90,180,270} -+ rotate Display rotation {0,90,180,270} - -- fps Delay between frame updates -+ fps Delay between frame updates - -- debug Debug output level {0-7} -+ debug Debug output level {0-7} - - - Name: pps-gpio - Info: Configures the pps-gpio (pulse-per-second time signal via GPIO). - Load: dtoverlay=pps-gpio,<param>=<val> --Params: gpiopin Input GPIO (default "18") -+Params: gpiopin Input GPIO (default "18") - - - Name: pwm -@@ -550,12 +550,12 @@ Info: Configures a single PWM channel - Pins 12 and 13 might be better choices on an A+, B+ or Pi2. - 2) The onboard analogue audio output uses both PWM channels. - 3) So be careful mixing audio and PWM. -- 4) Currently the clock must have been enabled and configured -+ 4) Currently the clockmust have been enabled and configured - by other means. - Load: dtoverlay=pwm,<param>=<val> --Params: pin Output pin (default 18) - see table -- func Pin function (default 2 = Alt5) - see above -- clock PWM clock frequency (informational) -+Params: pin Output pin (default 18) - see table -+ func Pin function (default 2 = Alt5) - see above -+ clock PWM clock frequency (informational) - - - Name: pwm-2chan -@@ -569,14 +569,14 @@ Info: Configures both PWM channels - Pins 12 and 13 might be better choices on an A+, B+ or Pi2. - 2) The onboard analogue audio output uses both PWM channels. - 3) So be careful mixing audio and PWM. -- 4) Currently the clock must have been enabled and configured -+ 4) Currently the clockmust have been enabled and configured - by other means. - Load: dtoverlay=pwm-2chan,<param>=<val> --Params: pin Output pin (default 18) - see table -- pin2 Output pin for other channel (default 19) -- func Pin function (default 2 = Alt5) - see above -- func2 Function for pin2 (default 2 = Alt5) -- clock PWM clock frequency (informational) -+Params: pin Output pin (default 18) - see table -+ pin2 Output pin for other channel (default 19) -+ func Pin function (default 2 = Alt5) - see above -+ func2 Function for pin2 (default 2 = Alt5) -+ clock PWM clock frequency (informational) - - - Name: raspidac3 -@@ -600,15 +600,15 @@ Params: <None> - Name: rpi-display - Info: RPi-Display - 2.8" Touch Display by Watterott - Load: dtoverlay=rpi-display,<param>=<val> --Params: speed Display SPI bus speed -+Params: speed Display SPI bus speed - -- rotate Display rotation {0,90,180,270} -+ rotate Display rotation {0,90,180,270} - -- fps Delay between frame updates -+ fps Delay between frame updates - -- debug Debug output level {0-7} -+ debug Debug output level {0-7} - -- xohms Touchpanel sensitivity (X-plate resistance) -+ xohms Touchpanel sensitivity (X-plate resistance) - - - Name: rpi-ft5406 -@@ -632,52 +632,52 @@ Params: <None> - Name: sdhost - Info: Selects the bcm2835-sdhost SD/MMC driver, optionally with overclock - Load: dtoverlay=sdhost,<param>=<val> --Params: overclock_50 Clock (in MHz) to use when the MMC framework -- requests 50MHz -+Params: overclock_50 Clock (in MHz) to use when the MMC framework -+ requests 50MHz - -- force_pio Disable DMA support (default off) -+ force_pio Disable DMA support (default off) - -- pio_limit Number of blocks above which to use DMA -- (default 1) -+ pio_limit Number of blocks above which to use DMA -+ (default 1) - -- debug Enable debug output (default off) -+ debug Enable debug output (default off) - - - Name: sdio - Info: Selects the bcm2835-sdhost SD/MMC driver, optionally with overclock, - and enables SDIO via GPIOs 22-27. - Load: dtoverlay=sdio,<param>=<val> --Params: overclock_50 SD Clock (in MHz) to use when the MMC framework -- requests 50MHz -+Params: overclock_50 SD Clock (in MHz) to use when the MMC framework -+ requests 50MHz - -- sdio_overclock SDIO Clock (in MHz) to use when the MMC -- framework requests 50MHz -+ sdio_overclock SDIO Clock (in MHz) to use when the MMC -+ framework requests 50MHz - -- force_pio Disable DMA support (default off) -+ force_pio Disable DMA support (default off) - -- pio_limit Number of blocks above which to use DMA -- (default 1) -+ pio_limit Number of blocks above which to use DMA -+ (default 1) - -- debug Enable debug output (default off) -+ debug Enable debug output (default off) - -- poll_once Disable SDIO-device polling every second -- (default on: polling once at boot-time) -+ poll_once Disable SDIO-device polling every second -+ (default on: polling once at boot-time) - -- bus_width Set the SDIO host bus width (default 4 bits) -+ bus_width Set the SDIO host bus width (default 4 bits) - - - Name: sdtweak - Info: Tunes the bcm2835-sdhost SD/MMC driver - Load: dtoverlay=sdtweak,<param>=<val> --Params: overclock_50 Clock (in MHz) to use when the MMC framework -- requests 50MHz -+Params: overclock_50 Clock (in MHz) to use when the MMC framework -+ requests 50MHz - -- force_pio Disable DMA support (default off) -+ force_pio Disable DMA support (default off) - -- pio_limit Number of blocks above which to use DMA -- (default 1) -+ pio_limit Number of blocks above which to use DMA -+ (default 1) - -- debug Enable debug output (default off) -+ debug Enable debug output (default off) - - - Name: smi -@@ -708,25 +708,25 @@ Name: tinylcd35 - Info: 3.5" Color TFT Display by www.tinylcd.com - Options: Touch, RTC, keypad - Load: dtoverlay=tinylcd35,<param>=<val> --Params: speed Display SPI bus speed -+Params: speed Display SPI bus speed - -- rotate Display rotation {0,90,180,270} -+ rotate Display rotation {0,90,180,270} - -- fps Delay between frame updates -+ fps Delay between frame updates - -- debug Debug output level {0-7} -+ debug Debug output level {0-7} - -- touch Enable touch panel -+ touch Enable touch panel - -- touchgpio Touch controller IRQ GPIO -+ touchgpio Touch controller IRQ GPIO - -- xohms Touchpanel: Resistance of X-plate in ohms -+ xohms Touchpanel: Resistance of X-plate in ohms - -- rtc-pcf PCF8563 Real Time Clock -+ rtc-pcf PCF8563 Real Time Clock - -- rtc-ds DS1307 Real Time Clock -+ rtc-ds DS1307 Real Time Clock - -- keypad Enable keypad -+ keypad Enable keypad - - Examples: - Display with touchpanel, PCF8563 RTC and keypad: -@@ -738,9 +738,9 @@ Params: speed Display SPI bus speed - Name: uart1 - Info: Enable uart1 in place of uart0 - Load: dtoverlay=uart1,<param>=<val> --Params: txd1_pin GPIO pin for TXD1 (14, 32 or 40 - default 14) -+Params: txd1_pin GPIO pin for TXD1 (14, 32 or 40 - default 14) - -- rxd1_pin GPIO pin for RXD1 (15, 33 or 41 - default 15) -+ rxd1_pin GPIO pin for RXD1 (15, 33 or 41 - default 15) - - - Name: vc4-kms-v3d -@@ -753,7 +753,7 @@ Params: <None> - - Name: vga666 - Info: Overlay for the Fen Logic VGA666 board -- This uses GPIOs 2-21 (so no I2C), and activates the output 2-3 seconds -+ This uses GPIOs 2-21 (sono I2C), and activates the output 2-3 seconds - after the kernel has started. - Load: dtoverlay=vga666 - Params: <None> -@@ -763,22 +763,22 @@ Name: w1-gpio - Info: Configures the w1-gpio Onewire interface module. - Use this overlay if you *don't* need a GPIO to drive an external pullup. - Load: dtoverlay=w1-gpio,<param>=<val> --Params: gpiopin GPIO for I/O (default "4") -+Params: gpiopin GPIO for I/O (default "4") - -- pullup Non-zero, "on", or "y" to enable the parasitic -- power (2-wire, power-on-data) feature -+ pullup Non-zero, "on", or "y" to enable the parasitic -+ power (2-wire, power-on-data) feature - - - Name: w1-gpio-pullup - Info: Configures the w1-gpio Onewire interface module. - Use this overlay if you *do* need a GPIO to drive an external pullup. - Load: dtoverlay=w1-gpio-pullup,<param>=<val> --Params: gpiopin GPIO for I/O (default "4") -+Params: gpiopin GPIO for I/O (default "4") - -- pullup Non-zero, "on", or "y" to enable the parasitic -- power (2-wire, power-on-data) feature -+ pullup Non-zero, "on", or "y" to enable the parasitic -+ power (2-wire, power-on-data) feature - -- extpullup GPIO for external pullup (default "5") -+ extpullup GPIO for external pullup (default "5") - - - Troubleshooting ++static struct platform_driver rpi_backlight_driver = { ++ .driver = { ++ .name = "rpi-backlight", ++ .of_match_table = of_match_ptr(rpi_backlight_of_match), ++ }, ++ .probe = rpi_backlight_probe, ++}; ++ ++module_platform_driver(rpi_backlight_driver); ++ ++MODULE_AUTHOR("Gordon Hollingworth <gordon@raspberrypi.org>"); ++MODULE_DESCRIPTION("Raspberry Pi mailbox based Backlight Driver"); ++MODULE_LICENSE("GPL"); -From d32795d2be55748552ddacd9b1e47efc61264a98 Mon Sep 17 00:00:00 2001 -From: Phil Elwell <phil@raspberrypi.org> -Date: Mon, 8 Feb 2016 12:53:44 +0000 -Subject: [PATCH 146/170] FIXUP: Overlay README - Restore spaces deleted in - error +From 8b5f29a6c47607b328c57a67aca43a9f46f779c6 Mon Sep 17 00:00:00 2001 +From: popcornmix <popcornmix@gmail.com> +Date: Tue, 23 Feb 2016 19:56:04 +0000 +Subject: [PATCH 085/112] bcm2835-virtgpio: Virtual GPIO driver +Add a virtual GPIO driver that uses the firmware mailbox interface to +request that the VPU toggles LEDs. --- - arch/arm/boot/dts/overlays/README | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) + drivers/gpio/Kconfig | 6 ++ + drivers/gpio/Makefile | 1 + + drivers/gpio/gpio-bcm-virt.c | 179 +++++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 186 insertions(+) + create mode 100644 drivers/gpio/gpio-bcm-virt.c -diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README -index ec1ae91..f987565 100644 ---- a/arch/arm/boot/dts/overlays/README -+++ b/arch/arm/boot/dts/overlays/README -@@ -550,7 +550,7 @@ Info: Configures a single PWM channel - Pins 12 and 13 might be better choices on an A+, B+ or Pi2. - 2) The onboard analogue audio output uses both PWM channels. - 3) So be careful mixing audio and PWM. -- 4) Currently the clockmust have been enabled and configured -+ 4) Currently the clock must have been enabled and configured - by other means. - Load: dtoverlay=pwm,<param>=<val> - Params: pin Output pin (default 18) - see table -@@ -569,7 +569,7 @@ Info: Configures both PWM channels - Pins 12 and 13 might be better choices on an A+, B+ or Pi2. - 2) The onboard analogue audio output uses both PWM channels. - 3) So be careful mixing audio and PWM. -- 4) Currently the clockmust have been enabled and configured -+ 4) Currently the clock must have been enabled and configured - by other means. - Load: dtoverlay=pwm-2chan,<param>=<val> - Params: pin Output pin (default 18) - see table -@@ -753,7 +753,7 @@ Params: <None> - - Name: vga666 - Info: Overlay for the Fen Logic VGA666 board -- This uses GPIOs 2-21 (sono I2C), and activates the output 2-3 seconds -+ This uses GPIOs 2-21 (so no I2C), and activates the output 2-3 seconds - after the kernel has started. - Load: dtoverlay=vga666 - Params: <None> +diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig +index 5f3429f..86cb971 100644 +--- a/drivers/gpio/Kconfig ++++ b/drivers/gpio/Kconfig +@@ -142,6 +142,12 @@ config GPIO_BCM_KONA + help + Turn on GPIO support for Broadcom "Kona" chips. + ++config GPIO_BCM_VIRT ++ bool "Broadcom Virt GPIO" ++ depends on OF_GPIO && RASPBERRYPI_FIRMWARE && (ARCH_BCM2835 || ARCH_BCM2708 || ARCH_BCM2709 || COMPILE_TEST) ++ help ++ Turn on virtual GPIO support for Broadcom BCM283X chips. ++ + config GPIO_BRCMSTB + tristate "BRCMSTB GPIO support" + default y if (ARCH_BRCMSTB || BMIPS_GENERIC) +diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile +index 1e0b74f..908596d 100644 +--- a/drivers/gpio/Makefile ++++ b/drivers/gpio/Makefile +@@ -26,6 +26,7 @@ obj-$(CONFIG_GPIO_AMDPT) += gpio-amdpt.o + obj-$(CONFIG_GPIO_ARIZONA) += gpio-arizona.o + obj-$(CONFIG_GPIO_ATH79) += gpio-ath79.o + obj-$(CONFIG_GPIO_BCM_KONA) += gpio-bcm-kona.o ++obj-$(CONFIG_GPIO_BCM_VIRT) += gpio-bcm-virt.o + obj-$(CONFIG_GPIO_BRCMSTB) += gpio-brcmstb.o + obj-$(CONFIG_GPIO_BT8XX) += gpio-bt8xx.o + obj-$(CONFIG_GPIO_CLPS711X) += gpio-clps711x.o +diff --git a/drivers/gpio/gpio-bcm-virt.c b/drivers/gpio/gpio-bcm-virt.c +new file mode 100644 +index 0000000..f3e0f16 +--- /dev/null ++++ b/drivers/gpio/gpio-bcm-virt.c +@@ -0,0 +1,179 @@ ++/* ++ * brcmvirt GPIO driver ++ * ++ * Copyright (C) 2012,2013 Dom Cobley <popcornmix@gmail.com> ++ * Based on gpio-clps711x.c by Alexander Shiyan <shc_work@mail.ru> ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ */ ++ ++#include <linux/err.h> ++#include <linux/gpio.h> ++#include <linux/module.h> ++#include <linux/platform_device.h> ++#include <soc/bcm2835/raspberrypi-firmware.h> ++ ++#define MODULE_NAME "brcmvirt-gpio" ++#define NUM_GPIO 2 ++ ++struct brcmvirt_gpio { ++ struct gpio_chip gc; ++ u32 __iomem *ts_base; ++ /* two packed 16-bit counts of enabled and disables ++ Allows host to detect a brief enable that was missed */ ++ u32 enables_disables[NUM_GPIO]; ++}; ++ ++static int brcmvirt_gpio_dir_in(struct gpio_chip *gc, unsigned off) ++{ ++ struct brcmvirt_gpio *gpio; ++ gpio = container_of(gc, struct brcmvirt_gpio, gc); ++ return -EINVAL; ++} ++ ++static int brcmvirt_gpio_dir_out(struct gpio_chip *gc, unsigned off, int val) ++{ ++ struct brcmvirt_gpio *gpio; ++ gpio = container_of(gc, struct brcmvirt_gpio, gc); ++ return 0; ++} ++ ++static int brcmvirt_gpio_get(struct gpio_chip *gc, unsigned off) ++{ ++ struct brcmvirt_gpio *gpio; ++ unsigned v; ++ gpio = container_of(gc, struct brcmvirt_gpio, gc); ++ v = readl(gpio->ts_base + off); ++ return (v >> off) & 1; ++} ++ ++static void brcmvirt_gpio_set(struct gpio_chip *gc, unsigned off, int val) ++{ ++ struct brcmvirt_gpio *gpio; ++ u16 enables, disables; ++ s16 diff; ++ bool lit; ++ gpio = container_of(gc, struct brcmvirt_gpio, gc); ++ enables = gpio->enables_disables[off] >> 16; ++ disables = gpio->enables_disables[off] >> 0; ++ diff = (s16)(enables - disables); ++ lit = diff > 0; ++ if ((val && lit) || (!val && !lit)) ++ return; ++ if (val) ++ enables++; ++ else ++ disables++; ++ diff = (s16)(enables - disables); ++ BUG_ON(diff != 0 && diff != 1); ++ gpio->enables_disables[off] = (enables << 16) | (disables << 0); ++ writel(gpio->enables_disables[off], gpio->ts_base + off); ++} ++ ++static int brcmvirt_gpio_probe(struct platform_device *pdev) ++{ ++ struct device *dev = &pdev->dev; ++ struct device_node *np = dev->of_node; ++ struct device_node *fw_node; ++ struct rpi_firmware *fw; ++ struct brcmvirt_gpio *ucb; ++ u32 gpiovirtbuf; ++ int err = 0; ++ ++ fw_node = of_parse_phandle(np, "firmware", 0); ++ if (!fw_node) { ++ dev_err(dev, "Missing firmware node\n"); ++ return -ENOENT; ++ } ++ ++ fw = rpi_firmware_get(fw_node); ++ if (!fw) ++ return -EPROBE_DEFER; ++ ++ err = rpi_firmware_property(fw, RPI_FIRMWARE_FRAMEBUFFER_GET_GPIOVIRTBUF, ++ &gpiovirtbuf, sizeof(gpiovirtbuf)); ++ ++ if (err) { ++ dev_err(dev, "Failed to get gpiovirtbuf\n"); ++ goto err; ++ } ++ ++ if (!gpiovirtbuf) { ++ dev_err(dev, "No virtgpio buffer\n"); ++ err = -ENOENT; ++ goto err; ++ } ++ ++ ucb = devm_kzalloc(dev, sizeof *ucb, GFP_KERNEL); ++ if (!ucb) { ++ err = -EINVAL; ++ goto err; ++ } ++ ++ // mmap the physical memory ++ gpiovirtbuf &= ~0xc0000000; ++ ucb->ts_base = ioremap(gpiovirtbuf, 4096); ++ if (ucb->ts_base == NULL) { ++ dev_err(dev, "Failed to map physical address\n"); ++ err = -ENOENT; ++ goto err; ++ } ++ ++ ucb->gc.label = MODULE_NAME; ++ ucb->gc.owner = THIS_MODULE; ++ //ucb->gc.dev = dev; ++ ucb->gc.of_node = np; ++ ucb->gc.base = 100; ++ ucb->gc.ngpio = NUM_GPIO; ++ ++ ucb->gc.direction_input = brcmvirt_gpio_dir_in; ++ ucb->gc.direction_output = brcmvirt_gpio_dir_out; ++ ucb->gc.get = brcmvirt_gpio_get; ++ ucb->gc.set = brcmvirt_gpio_set; ++ ucb->gc.can_sleep = true; ++ ++ err = gpiochip_add(&ucb->gc); ++ if (err) ++ goto err; ++ ++ platform_set_drvdata(pdev, ucb); ++ ++err: ++ return err; ++ ++} ++ ++static int brcmvirt_gpio_remove(struct platform_device *pdev) ++{ ++ int err = 0; ++ struct brcmvirt_gpio *ucb = platform_get_drvdata(pdev); ++ ++ gpiochip_remove(&ucb->gc); ++ iounmap(ucb->ts_base); ++ return err; ++} ++ ++static const struct of_device_id __maybe_unused brcmvirt_gpio_ids[] = { ++ { .compatible = "brcm,bcm2835-virtgpio" }, ++ { } ++}; ++MODULE_DEVICE_TABLE(of, brcmvirt_gpio_ids); ++ ++static struct platform_driver brcmvirt_gpio_driver = { ++ .driver = { ++ .name = MODULE_NAME, ++ .owner = THIS_MODULE, ++ .of_match_table = of_match_ptr(brcmvirt_gpio_ids), ++ }, ++ .probe = brcmvirt_gpio_probe, ++ .remove = brcmvirt_gpio_remove, ++}; ++module_platform_driver(brcmvirt_gpio_driver); ++ ++MODULE_LICENSE("GPL"); ++MODULE_AUTHOR("Dom Cobley <popcornmix@gmail.com>"); ++MODULE_DESCRIPTION("brcmvirt GPIO driver"); ++MODULE_ALIAS("platform:brcmvirt-gpio"); + +From 4af55e5c7890f15b3ee2953fe66a7af6a35fde5d Mon Sep 17 00:00:00 2001 +From: popcornmix <popcornmix@gmail.com> +Date: Fri, 4 Mar 2016 12:49:09 +0000 +Subject: [PATCH 086/112] DRM_VC4: Allow to be built for ARCH_BCM270x -From be4e718cccf6909072eeab1032b1d9fb6dd92b43 Mon Sep 17 00:00:00 2001 -From: Phil Elwell <phil@raspberrypi.org> -Date: Tue, 9 Feb 2016 09:52:13 +0000 -Subject: [PATCH 147/170] pinctrl-bcm2835: Fix cut-and-paste error in "pull" - parsing - -The DT bindings for pinctrl-bcm2835 allow both the function and pull -to contain either one entry or one per pin. However, an error in the -DT parsing can cause failures if the number of pulls differs from the -number of functions. --- - drivers/pinctrl/bcm/pinctrl-bcm2835.c | 2 +- + drivers/gpu/drm/vc4/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -diff --git a/drivers/pinctrl/bcm/pinctrl-bcm2835.c b/drivers/pinctrl/bcm/pinctrl-bcm2835.c -index 640e3b0..32f779e 100644 ---- a/drivers/pinctrl/bcm/pinctrl-bcm2835.c -+++ b/drivers/pinctrl/bcm/pinctrl-bcm2835.c -@@ -802,7 +802,7 @@ static int bcm2835_pctl_dt_node_to_map(struct pinctrl_dev *pctldev, - } - if (num_pulls) { - err = of_property_read_u32_index(np, "brcm,pull", -- (num_funcs > 1) ? i : 0, &pull); -+ (num_pulls > 1) ? i : 0, &pull); - if (err) - goto out; - err = bcm2835_pctl_dt_node_to_map_pull(pc, np, pin, - -From 14e35b8cca5bf1f6223ebc6cc4d527645076a3a3 Mon Sep 17 00:00:00 2001 -From: popcornmix <popcornmix@gmail.com> -Date: Thu, 11 Feb 2016 17:30:49 +0000 -Subject: [PATCH 148/170] Revert "BCM270X_DT: Disable DMA for bcm2835-sdhost on - Pi2" +diff --git a/drivers/gpu/drm/vc4/Kconfig b/drivers/gpu/drm/vc4/Kconfig +index 5848104..870fea5 100644 +--- a/drivers/gpu/drm/vc4/Kconfig ++++ b/drivers/gpu/drm/vc4/Kconfig +@@ -1,6 +1,6 @@ + config DRM_VC4 + tristate "Broadcom VC4 Graphics" +- depends on ARCH_BCM2835 || COMPILE_TEST ++ depends on ARCH_BCM2835 || ARCH_BCM2708 || ARCH_BCM2709 || COMPILE_TEST + depends on DRM + select DRM_KMS_HELPER + select DRM_KMS_CMA_HELPER + +From 98b2c4aae5e4450f7fe526b36cb22d144d394f5b Mon Sep 17 00:00:00 2001 +From: Phil Elwell <phil@raspberrypi.org> +Date: Tue, 23 Feb 2016 17:26:48 +0000 +Subject: [PATCH 087/112] amba_pl011: Don't use DT aliases for numbering -This reverts commit 9c1adcc07a40f762fd4ac580f07646784de135e1. +The pl011 driver looks for DT aliases of the form "serial<n>", +and if found uses <n> as the device ID. This can cause +/dev/ttyAMA0 to become /dev/ttyAMA1, which is confusing if the +other serial port is provided by the 8250 driver which doesn't +use the same logic. --- - arch/arm/boot/dts/bcm2709-rpi-2-b.dts | 1 - - 1 file changed, 1 deletion(-) + drivers/tty/serial/amba-pl011.c | 5 +++++ + 1 file changed, 5 insertions(+) -diff --git a/arch/arm/boot/dts/bcm2709-rpi-2-b.dts b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts -index 0b68db5..5206ba2 100644 ---- a/arch/arm/boot/dts/bcm2709-rpi-2-b.dts -+++ b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts -@@ -43,7 +43,6 @@ - pinctrl-names = "default"; - pinctrl-0 = <&sdhost_pins>; - bus-width = <4>; -- brcm,pio-limit = <0x7fffffff>; - status = "okay"; - }; +diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c +index 7c198e0..4f9e97b 100644 +--- a/drivers/tty/serial/amba-pl011.c ++++ b/drivers/tty/serial/amba-pl011.c +@@ -2413,7 +2413,12 @@ static int pl011_setup_port(struct device *dev, struct uart_amba_port *uap, + if (IS_ERR(base)) + return PTR_ERR(base); + ++ /* Don't use DT serial<n> aliases - it causes the device to ++ be renumbered to ttyAMA1 if it is the second serial port in the ++ system, even though the other one is ttyS0. The 8250 driver ++ doesn't use this logic, so always remains ttyS0. + index = pl011_probe_dt_alias(index, dev); ++ */ + uap->old_cr = 0; + uap->port.dev = dev; -From 5a117bd925d13a305d94eeb28919dedeaa9be17d Mon Sep 17 00:00:00 2001 -From: Phil Elwell <phil@raspberrypi.org> -Date: Thu, 11 Feb 2016 16:51:01 +0000 -Subject: [PATCH 149/170] bcm2835-sdhost: Major revision +From 74026743feb7e22a4393a00f227736160e146bb2 Mon Sep 17 00:00:00 2001 +From: Pantelis Antoniou <pantelis.antoniou@konsulko.com> +Date: Wed, 3 Dec 2014 13:23:28 +0200 +Subject: [PATCH 088/112] OF: DT-Overlay configfs interface -This is a significant revision of the bcm2835-sdhost driver. It -improves on the original in a number of ways: +This is a port of Pantelis Antoniou's v3 port that makes use of the +new upstreamed configfs support for binary attributes. -1) Through the use of CMD23 for reads it appears to avoid problems - reading some sectors on certain high speed cards. -2) Better atomicity to prevent crashes. -3) Higher performance. -4) Activity logging included, for easier diagnosis in the event - of a problem. +Original commit message: + +Add a runtime interface to using configfs for generic device tree overlay +usage. With it its possible to use device tree overlays without having +to use a per-platform overlay manager. +Please see Documentation/devicetree/configfs-overlays.txt for more info. + +Changes since v2: +- Removed ifdef CONFIG_OF_OVERLAY (since for now it's required) +- Created a documentation entry +- Slight rewording in Kconfig + +Changes since v1: +- of_resolve() -> of_resolve_phandles(). + +Originally-signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com> Signed-off-by: Phil Elwell <phil@raspberrypi.org> ---- - drivers/mmc/host/bcm2835-sdhost.c | 1284 ++++++++++++++++++++----------------- - 1 file changed, 686 insertions(+), 598 deletions(-) -diff --git a/drivers/mmc/host/bcm2835-sdhost.c b/drivers/mmc/host/bcm2835-sdhost.c -index ef9b1e6..262180b 100644 ---- a/drivers/mmc/host/bcm2835-sdhost.c -+++ b/drivers/mmc/host/bcm2835-sdhost.c -@@ -2,7 +2,7 @@ - * BCM2835 SD host driver. - * - * Author: Phil Elwell <phil@raspberrypi.org> -- * Copyright 2015 -+ * Copyright (C) 2015-2016 Raspberry Pi (Trading) Ltd. - * - * Based on - * mmc-bcm2835.c by Gellert Weisz -@@ -24,12 +24,13 @@ - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - --#define SAFE_READ_THRESHOLD 4 --#define SAFE_WRITE_THRESHOLD 4 --#define ALLOW_DMA 1 --#define ALLOW_CMD23 0 --#define ALLOW_FAST 1 --#define USE_BLOCK_IRQ 1 -+#define FIFO_READ_THRESHOLD 4 -+#define FIFO_WRITE_THRESHOLD 4 -+#define ALLOW_CMD23_READ 1 -+#define ALLOW_CMD23_WRITE 0 -+#define ENABLE_LOG 1 -+#define SDDATA_FIFO_PIO_BURST 8 -+#define CMD_DALLY_US 1 - - #include <linux/delay.h> - #include <linux/module.h> -@@ -48,6 +49,7 @@ - #include <linux/dma-mapping.h> - #include <linux/of_dma.h> - #include <linux/time.h> -+#include <linux/workqueue.h> - - #define DRIVER_NAME "sdhost-bcm2835" - -@@ -110,6 +112,28 @@ - #define SDEDM_READ_THRESHOLD_SHIFT 14 - #define SDEDM_THRESHOLD_MASK 0x1f - -+#define SDEDM_FSM_MASK 0xf -+#define SDEDM_FSM_IDENTMODE 0x0 -+#define SDEDM_FSM_DATAMODE 0x1 -+#define SDEDM_FSM_READDATA 0x2 -+#define SDEDM_FSM_WRITEDATA 0x3 -+#define SDEDM_FSM_READWAIT 0x4 -+#define SDEDM_FSM_READCRC 0x5 -+#define SDEDM_FSM_WRITECRC 0x6 -+#define SDEDM_FSM_WRITEWAIT1 0x7 -+#define SDEDM_FSM_POWERDOWN 0x8 -+#define SDEDM_FSM_POWERUP 0x9 -+#define SDEDM_FSM_WRITESTART1 0xa -+#define SDEDM_FSM_WRITESTART2 0xb -+#define SDEDM_FSM_GENPULSES 0xc -+#define SDEDM_FSM_WRITEWAIT2 0xd -+#define SDEDM_FSM_STARTPOWDOWN 0xf +DT configfs: Fix build errors on other platforms + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> + +DT configfs: fix build error + +There is an error when compiling rpi-4.6.y branch: + CC drivers/of/configfs.o +drivers/of/configfs.c:291:21: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types] + .default_groups = of_cfs_def_groups, + ^ +drivers/of/configfs.c:291:21: note: (near initialization for 'of_cfs_subsys.su_group.default_groups.next') + +The .default_groups is linked list since commit +1ae1602de028acaa42a0f6ff18d19756f8e825c6. +This commit uses configfs_add_default_group to fix this problem. + +Signed-off-by: Slawomir Stepien <sst@poczta.fm> +--- + Documentation/devicetree/configfs-overlays.txt | 31 +++ + drivers/of/Kconfig | 7 + + drivers/of/Makefile | 1 + + drivers/of/configfs.c | 311 +++++++++++++++++++++++++ + 4 files changed, 350 insertions(+) + create mode 100644 Documentation/devicetree/configfs-overlays.txt + create mode 100644 drivers/of/configfs.c + +diff --git a/Documentation/devicetree/configfs-overlays.txt b/Documentation/devicetree/configfs-overlays.txt +new file mode 100644 +index 0000000..5fa43e0 +--- /dev/null ++++ b/Documentation/devicetree/configfs-overlays.txt +@@ -0,0 +1,31 @@ ++Howto use the configfs overlay interface. + -+#define SDDATA_FIFO_WORDS 16 ++A device-tree configfs entry is created in /config/device-tree/overlays ++and and it is manipulated using standard file system I/O. ++Note that this is a debug level interface, for use by developers and ++not necessarily something accessed by normal users due to the ++security implications of having direct access to the kernel's device tree. + -+#define USE_CMD23_FLAGS ((ALLOW_CMD23_READ * MMC_DATA_READ) | \ -+ (ALLOW_CMD23_WRITE * MMC_DATA_WRITE)) ++* To create an overlay you mkdir the directory: + - #define MHZ 1000000 - - -@@ -131,15 +155,17 @@ struct bcm2835_host { - - struct tasklet_struct finish_tasklet; /* Tasklet structures */ - -- struct timer_list timer; /* Timer for timeouts */ -+ struct work_struct cmd_wait_wq; /* Workqueue function */ - -- struct timer_list pio_timer; /* PIO error detection timer */ -+ struct timer_list timer; /* Timer for timeouts */ - - struct sg_mapping_iter sg_miter; /* SG state for PIO */ - unsigned int blocks; /* remaining PIO blocks */ - - int irq; /* Device IRQ */ - -+ u32 cmd_quick_poll_retries; -+ u32 ns_per_fifo_word; - - /* cached registers */ - u32 hcfg; -@@ -154,16 +180,21 @@ struct bcm2835_host { - - unsigned int use_busy:1; /* Wait for busy interrupt */ - -- unsigned int debug:1; /* Enable debug output */ -+ unsigned int use_sbc:1; /* Send CMD23 */ - -- u32 thread_isr; -+ unsigned int debug:1; /* Enable debug output */ - - /*DMA part*/ - struct dma_chan *dma_chan_rx; /* DMA channel for reads */ - struct dma_chan *dma_chan_tx; /* DMA channel for writes */ -+ struct dma_chan *dma_chan; /* Channel in used */ -+ struct dma_async_tx_descriptor *dma_desc; -+ u32 dma_dir; -+ u32 drain_words; -+ struct page *drain_page; -+ u32 drain_offset; - - bool allow_dma; -- bool have_dma; - bool use_dma; - /*end of DMA part*/ - -@@ -173,13 +204,98 @@ struct bcm2835_host { - u32 overclock_50; /* frequency to use when 50MHz is requested (in MHz) */ - u32 overclock; /* Current frequency if overclocked, else zero */ - u32 pio_limit; /* Maximum block count for PIO (0 = always DMA) */ -+}; - -- u32 debug_flags; -+#if ENABLE_LOG - -- u32 sectors; /* Cached card size in sectors */ -- u32 single_read_sectors[8]; -+struct log_entry_struct { -+ char event[4]; -+ u32 timestamp; -+ u32 param1; -+ u32 param2; - }; ++ # mkdir /config/device-tree/overlays/foo ++ ++* Either you echo the overlay firmware file to the path property file. ++ ++ # echo foo.dtbo >/config/device-tree/overlays/foo/path ++ ++* Or you cat the contents of the overlay to the dtbo file ++ ++ # cat foo.dtbo >/config/device-tree/overlays/foo/dtbo ++ ++The overlay file will be applied, and devices will be created/destroyed ++as required. ++ ++To remove it simply rmdir the directory. ++ ++ # rmdir /config/device-tree/overlays/foo ++ ++The rationalle of the dual interface (firmware & direct copy) is that each is ++better suited to different use patterns. The firmware interface is what's ++intended to be used by hardware managers in the kernel, while the copy interface ++make sense for developers (since it avoids problems with namespaces). +diff --git a/drivers/of/Kconfig b/drivers/of/Kconfig +index e2a4841..7e5e6c4 100644 +--- a/drivers/of/Kconfig ++++ b/drivers/of/Kconfig +@@ -112,4 +112,11 @@ config OF_OVERLAY + While this option is selected automatically when needed, you can + enable it manually to improve device tree unit test coverage. -+typedef struct log_entry_struct LOG_ENTRY_T; ++config OF_CONFIGFS ++ bool "Device Tree Overlay ConfigFS interface" ++ select CONFIGFS_FS ++ select OF_OVERLAY ++ help ++ Enable a simple user-space driven DT overlay interface. ++ + endif # OF +diff --git a/drivers/of/Makefile b/drivers/of/Makefile +index 156c072..46c8f57 100644 +--- a/drivers/of/Makefile ++++ b/drivers/of/Makefile +@@ -1,4 +1,5 @@ + obj-y = base.o device.o platform.o ++obj-$(CONFIG_OF_CONFIGFS) += configfs.o + obj-$(CONFIG_OF_DYNAMIC) += dynamic.o + obj-$(CONFIG_OF_FLATTREE) += fdt.o + obj-$(CONFIG_OF_EARLY_FLATTREE) += fdt_address.o +diff --git a/drivers/of/configfs.c b/drivers/of/configfs.c +new file mode 100644 +index 0000000..68f889d +--- /dev/null ++++ b/drivers/of/configfs.c +@@ -0,0 +1,311 @@ ++/* ++ * Configfs entries for device-tree ++ * ++ * Copyright (C) 2013 - Pantelis Antoniou <panto@antoniou-consulting.com> ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * as published by the Free Software Foundation; either version ++ * 2 of the License, or (at your option) any later version. ++ */ ++#include <linux/ctype.h> ++#include <linux/cpu.h> ++#include <linux/module.h> ++#include <linux/of.h> ++#include <linux/of_fdt.h> ++#include <linux/spinlock.h> ++#include <linux/slab.h> ++#include <linux/proc_fs.h> ++#include <linux/configfs.h> ++#include <linux/types.h> ++#include <linux/stat.h> ++#include <linux/limits.h> ++#include <linux/file.h> ++#include <linux/vmalloc.h> ++#include <linux/firmware.h> ++#include <linux/sizes.h> + -+LOG_ENTRY_T *sdhost_log_buf; -+dma_addr_t sdhost_log_addr; -+static u32 sdhost_log_idx; -+static spinlock_t log_lock; -+static void __iomem *timer_base; ++#include "of_private.h" + -+#define LOG_ENTRIES (256*1) -+#define LOG_SIZE (sizeof(LOG_ENTRY_T)*LOG_ENTRIES) ++struct cfs_overlay_item { ++ struct config_item item; + -+static void log_init(u32 bus_to_phys) -+{ -+ spin_lock_init(&log_lock); -+ sdhost_log_buf = dma_zalloc_coherent(NULL, LOG_SIZE, &sdhost_log_addr, -+ GFP_KERNEL); -+ if (sdhost_log_buf) { -+ pr_err("sdhost: log_buf @ %p (%x)\n", -+ sdhost_log_buf, sdhost_log_addr); -+ timer_base = ioremap_nocache(bus_to_phys + 0x7e003000, SZ_4K); -+ if (!timer_base) -+ pr_err("sdhost: failed to remap timer\n"); -+ } -+ else -+ pr_err("sdhost: failed to allocate log buf\n"); -+} ++ char path[PATH_MAX]; + -+static void log_event_impl(const char *event, u32 param1, u32 param2) ++ const struct firmware *fw; ++ struct device_node *overlay; ++ int ov_id; ++ ++ void *dtbo; ++ int dtbo_size; ++}; ++ ++static int create_overlay(struct cfs_overlay_item *overlay, void *blob) +{ -+ if (sdhost_log_buf) { -+ LOG_ENTRY_T *entry; -+ unsigned long flags; ++ int err; + -+ spin_lock_irqsave(&log_lock, flags); ++ /* unflatten the tree */ ++ of_fdt_unflatten_tree(blob, &overlay->overlay); ++ if (overlay->overlay == NULL) { ++ pr_err("%s: failed to unflatten tree\n", __func__); ++ err = -EINVAL; ++ goto out_err; ++ } ++ pr_debug("%s: unflattened OK\n", __func__); + -+ entry = sdhost_log_buf + sdhost_log_idx; -+ memcpy(entry->event, event, 4); -+ entry->timestamp = (readl(timer_base + 4) & 0x3fffffff) + -+ (smp_processor_id()<<30); -+ entry->param1 = param1; -+ entry->param2 = param2; -+ sdhost_log_idx = (sdhost_log_idx + 1) % LOG_ENTRIES; ++ /* mark it as detached */ ++ of_node_set_flag(overlay->overlay, OF_DETACHED); + -+ spin_unlock_irqrestore(&log_lock, flags); ++ /* perform resolution */ ++ err = of_resolve_phandles(overlay->overlay); ++ if (err != 0) { ++ pr_err("%s: Failed to resolve tree\n", __func__); ++ goto out_err; ++ } ++ pr_debug("%s: resolved OK\n", __func__); ++ ++ err = of_overlay_create(overlay->overlay); ++ if (err < 0) { ++ pr_err("%s: Failed to create overlay (err=%d)\n", ++ __func__, err); ++ goto out_err; + } ++ overlay->ov_id = err; ++ ++out_err: ++ return err; +} + -+static void log_dump(void) ++static inline struct cfs_overlay_item *to_cfs_overlay_item( ++ struct config_item *item) +{ -+ if (sdhost_log_buf) { -+ LOG_ENTRY_T *entry; -+ unsigned long flags; -+ int idx; ++ return item ? container_of(item, struct cfs_overlay_item, item) : NULL; ++} + -+ spin_lock_irqsave(&log_lock, flags); ++static ssize_t cfs_overlay_item_path_show(struct config_item *item, ++ char *page) ++{ ++ struct cfs_overlay_item *overlay = to_cfs_overlay_item(item); ++ return sprintf(page, "%s\n", overlay->path); ++} + -+ idx = sdhost_log_idx; -+ do { -+ entry = sdhost_log_buf + idx; -+ if (entry->event[0] != '\0') -+ pr_err("[%08x] %.4s %x %x\n", -+ entry->timestamp, -+ entry->event, -+ entry->param1, -+ entry->param2); -+ idx = (idx + 1) % LOG_ENTRIES; -+ } while (idx != sdhost_log_idx); ++static ssize_t cfs_overlay_item_path_store(struct config_item *item, ++ const char *page, size_t count) ++{ ++ struct cfs_overlay_item *overlay = to_cfs_overlay_item(item); ++ const char *p = page; ++ char *s; ++ int err; + -+ spin_unlock_irqrestore(&log_lock, flags); -+ } -+} ++ /* if it's set do not allow changes */ ++ if (overlay->path[0] != '\0' || overlay->dtbo_size > 0) ++ return -EPERM; + -+#define log_event(event, param1, param2) log_event_impl(event, param1, param2) ++ /* copy to path buffer (and make sure it's always zero terminated */ ++ count = snprintf(overlay->path, sizeof(overlay->path) - 1, "%s", p); ++ overlay->path[sizeof(overlay->path) - 1] = '\0'; + -+#else ++ /* strip trailing newlines */ ++ s = overlay->path + strlen(overlay->path); ++ while (s > overlay->path && *--s == '\n') ++ *s = '\0'; + -+#define log_init(x) (void)0 -+#define log_event(event, param1, param2) (void)0 -+#define log_dump() (void)0 ++ pr_debug("%s: path is '%s'\n", __func__, overlay->path); + -+#endif - - static inline void bcm2835_sdhost_write(struct bcm2835_host *host, u32 val, int reg) - { -@@ -201,7 +317,7 @@ static void bcm2835_sdhost_dumpcmd(struct bcm2835_host *host, - const char *label) - { - if (cmd) -- pr_info("%s:%c%s op %d arg 0x%x flags 0x%x - resp %08x %08x %08x %08x, err %d\n", -+ pr_err("%s:%c%s op %d arg 0x%x flags 0x%x - resp %08x %08x %08x %08x, err %d\n", - mmc_hostname(host->mmc), - (cmd == host->cmd) ? '>' : ' ', - label, cmd->opcode, cmd->arg, cmd->flags, -@@ -211,73 +327,74 @@ static void bcm2835_sdhost_dumpcmd(struct bcm2835_host *host, - - static void bcm2835_sdhost_dumpregs(struct bcm2835_host *host) - { -- bcm2835_sdhost_dumpcmd(host, host->mrq->sbc, "sbc"); -- bcm2835_sdhost_dumpcmd(host, host->mrq->cmd, "cmd"); -- if (host->mrq->data) -- pr_err("%s: data blocks %x blksz %x - err %d\n", -- mmc_hostname(host->mmc), -- host->mrq->data->blocks, -- host->mrq->data->blksz, -- host->mrq->data->error); -- bcm2835_sdhost_dumpcmd(host, host->mrq->stop, "stop"); -+ if (host->mrq) -+ { -+ bcm2835_sdhost_dumpcmd(host, host->mrq->sbc, "sbc"); -+ bcm2835_sdhost_dumpcmd(host, host->mrq->cmd, "cmd"); -+ if (host->mrq->data) -+ pr_err("%s: data blocks %x blksz %x - err %d\n", -+ mmc_hostname(host->mmc), -+ host->mrq->data->blocks, -+ host->mrq->data->blksz, -+ host->mrq->data->error); -+ bcm2835_sdhost_dumpcmd(host, host->mrq->stop, "stop"); -+ } - -- pr_info("%s: =========== REGISTER DUMP ===========\n", -+ pr_err("%s: =========== REGISTER DUMP ===========\n", - mmc_hostname(host->mmc)); - -- pr_info("%s: SDCMD 0x%08x\n", -+ pr_err("%s: SDCMD 0x%08x\n", - mmc_hostname(host->mmc), - bcm2835_sdhost_read(host, SDCMD)); -- pr_info("%s: SDARG 0x%08x\n", -+ pr_err("%s: SDARG 0x%08x\n", - mmc_hostname(host->mmc), - bcm2835_sdhost_read(host, SDARG)); -- pr_info("%s: SDTOUT 0x%08x\n", -+ pr_err("%s: SDTOUT 0x%08x\n", - mmc_hostname(host->mmc), - bcm2835_sdhost_read(host, SDTOUT)); -- pr_info("%s: SDCDIV 0x%08x\n", -+ pr_err("%s: SDCDIV 0x%08x\n", - mmc_hostname(host->mmc), - bcm2835_sdhost_read(host, SDCDIV)); -- pr_info("%s: SDRSP0 0x%08x\n", -+ pr_err("%s: SDRSP0 0x%08x\n", - mmc_hostname(host->mmc), - bcm2835_sdhost_read(host, SDRSP0)); -- pr_info("%s: SDRSP1 0x%08x\n", -+ pr_err("%s: SDRSP1 0x%08x\n", - mmc_hostname(host->mmc), - bcm2835_sdhost_read(host, SDRSP1)); -- pr_info("%s: SDRSP2 0x%08x\n", -+ pr_err("%s: SDRSP2 0x%08x\n", - mmc_hostname(host->mmc), - bcm2835_sdhost_read(host, SDRSP2)); -- pr_info("%s: SDRSP3 0x%08x\n", -+ pr_err("%s: SDRSP3 0x%08x\n", - mmc_hostname(host->mmc), - bcm2835_sdhost_read(host, SDRSP3)); -- pr_info("%s: SDHSTS 0x%08x\n", -+ pr_err("%s: SDHSTS 0x%08x\n", - mmc_hostname(host->mmc), - bcm2835_sdhost_read(host, SDHSTS)); -- pr_info("%s: SDVDD 0x%08x\n", -+ pr_err("%s: SDVDD 0x%08x\n", - mmc_hostname(host->mmc), - bcm2835_sdhost_read(host, SDVDD)); -- pr_info("%s: SDEDM 0x%08x\n", -+ pr_err("%s: SDEDM 0x%08x\n", - mmc_hostname(host->mmc), - bcm2835_sdhost_read(host, SDEDM)); -- pr_info("%s: SDHCFG 0x%08x\n", -+ pr_err("%s: SDHCFG 0x%08x\n", - mmc_hostname(host->mmc), - bcm2835_sdhost_read(host, SDHCFG)); -- pr_info("%s: SDHBCT 0x%08x\n", -+ pr_err("%s: SDHBCT 0x%08x\n", - mmc_hostname(host->mmc), - bcm2835_sdhost_read(host, SDHBCT)); -- pr_info("%s: SDHBLC 0x%08x\n", -+ pr_err("%s: SDHBLC 0x%08x\n", - mmc_hostname(host->mmc), - bcm2835_sdhost_read(host, SDHBLC)); - -- pr_info("%s: ===========================================\n", -+ pr_err("%s: ===========================================\n", - mmc_hostname(host->mmc)); - } - -- - static void bcm2835_sdhost_set_power(struct bcm2835_host *host, bool on) - { - bcm2835_sdhost_write(host, on ? 1 : 0, SDVDD); - } - -- - static void bcm2835_sdhost_reset_internal(struct bcm2835_host *host) - { - u32 temp; -@@ -300,26 +417,24 @@ static void bcm2835_sdhost_reset_internal(struct bcm2835_host *host) - temp = bcm2835_sdhost_read(host, SDEDM); - temp &= ~((SDEDM_THRESHOLD_MASK<<SDEDM_READ_THRESHOLD_SHIFT) | - (SDEDM_THRESHOLD_MASK<<SDEDM_WRITE_THRESHOLD_SHIFT)); -- temp |= (SAFE_READ_THRESHOLD << SDEDM_READ_THRESHOLD_SHIFT) | -- (SAFE_WRITE_THRESHOLD << SDEDM_WRITE_THRESHOLD_SHIFT); -+ temp |= (FIFO_READ_THRESHOLD << SDEDM_READ_THRESHOLD_SHIFT) | -+ (FIFO_WRITE_THRESHOLD << SDEDM_WRITE_THRESHOLD_SHIFT); - bcm2835_sdhost_write(host, temp, SDEDM); - mdelay(10); - bcm2835_sdhost_set_power(host, true); - mdelay(10); - host->clock = 0; -- host->sectors = 0; -- host->single_read_sectors[0] = ~0; - bcm2835_sdhost_write(host, host->hcfg, SDHCFG); - bcm2835_sdhost_write(host, host->cdiv, SDCDIV); - mmiowb(); - } - -- - static void bcm2835_sdhost_reset(struct mmc_host *mmc) - { - struct bcm2835_host *host = mmc_priv(mmc); - unsigned long flags; - spin_lock_irqsave(&host->lock, flags); -+ log_event("RST<", 0, 0); - - bcm2835_sdhost_reset_internal(host); - -@@ -344,82 +459,48 @@ static void bcm2835_sdhost_init(struct bcm2835_host *host, int soft) - } - } - --static bool bcm2835_sdhost_is_write_complete(struct bcm2835_host *host) -+static void bcm2835_sdhost_wait_transfer_complete(struct bcm2835_host *host) - { -- bool write_complete = ((bcm2835_sdhost_read(host, SDEDM) & 0xf) == 1); -- -- if (!write_complete) { -- /* Request an IRQ for the last block */ -- host->hcfg |= SDHCFG_BLOCK_IRPT_EN; -- bcm2835_sdhost_write(host, host->hcfg, SDHCFG); -- if ((bcm2835_sdhost_read(host, SDEDM) & 0xf) == 1) { -- /* The write has now completed. Disable the interrupt -- and clear the status flag */ -- host->hcfg &= ~SDHCFG_BLOCK_IRPT_EN; -- bcm2835_sdhost_write(host, host->hcfg, SDHCFG); -- bcm2835_sdhost_write(host, SDHSTS_BLOCK_IRPT, SDHSTS); -- write_complete = true; -- } -- } -+ int timediff; -+ u32 alternate_idle; -+ u32 edm; - -- return write_complete; --} -+ alternate_idle = (host->mrq->data->flags & MMC_DATA_READ) ? -+ SDEDM_FSM_READWAIT : SDEDM_FSM_WRITESTART1; - --static void bcm2835_sdhost_wait_write_complete(struct bcm2835_host *host) --{ -- int timediff; --#ifdef DEBUG -- static struct timeval start_time; -- static int max_stall_time = 0; -- static int total_stall_time = 0; -- struct timeval before, after; -+ edm = bcm2835_sdhost_read(host, SDEDM); - -- do_gettimeofday(&before); -- if (max_stall_time == 0) -- start_time = before; --#endif -+ log_event("WTC<", edm, 0); - - timediff = 0; - - while (1) { -- u32 edm = bcm2835_sdhost_read(host, SDEDM); -- if ((edm & 0xf) == 1) -+ u32 fsm = edm & SDEDM_FSM_MASK; -+ if ((fsm == SDEDM_FSM_IDENTMODE) || -+ (fsm == SDEDM_FSM_DATAMODE)) - break; -- timediff++; -- if (timediff > 5000000) { --#ifdef DEBUG -- do_gettimeofday(&after); -- timediff = (after.tv_sec - before.tv_sec)*1000000 + -- (after.tv_usec - before.tv_usec); -+ if (fsm == alternate_idle) { -+ bcm2835_sdhost_write(host, -+ edm | SDEDM_FORCE_DATA_MODE, -+ SDEDM); -+ break; -+ } - -- pr_err(" wait_write_complete - still waiting after %dus\n", -- timediff); --#else -- pr_err(" wait_write_complete - still waiting after %d retries\n", -+ timediff++; -+ if (timediff == 100000) { -+ pr_err("%s: wait_transfer_complete - still waiting after %d retries\n", -+ mmc_hostname(host->mmc), - timediff); --#endif -+ log_dump(); - bcm2835_sdhost_dumpregs(host); -- host->data->error = -ETIMEDOUT; -+ host->mrq->data->error = -ETIMEDOUT; -+ log_event("WTC!", edm, 0); - return; - } -+ cpu_relax(); -+ edm = bcm2835_sdhost_read(host, SDEDM); - } -- --#ifdef DEBUG -- do_gettimeofday(&after); -- timediff = (after.tv_sec - before.tv_sec)*1000000 + (after.tv_usec - before.tv_usec); -- -- total_stall_time += timediff; -- if (timediff > max_stall_time) -- max_stall_time = timediff; -- -- if ((after.tv_sec - start_time.tv_sec) > 10) { -- pr_debug(" wait_write_complete - max wait %dus, total %dus\n", -- max_stall_time, total_stall_time); -- start_time = after; -- max_stall_time = 0; -- total_stall_time = 0; -- } --#endif -+ log_event("WTC>", edm, 0); - } - - static void bcm2835_sdhost_finish_data(struct bcm2835_host *host); -@@ -427,65 +508,44 @@ static void bcm2835_sdhost_finish_data(struct bcm2835_host *host); - static void bcm2835_sdhost_dma_complete(void *param) - { - struct bcm2835_host *host = param; -- struct dma_chan *dma_chan; -+ struct mmc_data *data = host->data; - unsigned long flags; -- u32 dir_data; - - spin_lock_irqsave(&host->lock, flags); -+ log_event("DMA<", (u32)host->data, bcm2835_sdhost_read(host, SDHSTS)); -+ log_event("DMA ", bcm2835_sdhost_read(host, SDCMD), -+ bcm2835_sdhost_read(host, SDEDM)); - -- if (host->data) { -- bool write_complete; -- if (USE_BLOCK_IRQ) -- write_complete = bcm2835_sdhost_is_write_complete(host); -- else { -- bcm2835_sdhost_wait_write_complete(host); -- write_complete = true; -- } -- pr_debug("dma_complete() - write_complete=%d\n", -- write_complete); -- -- if (write_complete || (host->data->flags & MMC_DATA_READ)) -- { -- if (write_complete) { -- dma_chan = host->dma_chan_tx; -- dir_data = DMA_TO_DEVICE; -- } else { -- dma_chan = host->dma_chan_rx; -- dir_data = DMA_FROM_DEVICE; -- } -- -- dma_unmap_sg(dma_chan->device->dev, -- host->data->sg, host->data->sg_len, -- dir_data); -+ if (host->dma_chan) { -+ dma_unmap_sg(host->dma_chan->device->dev, -+ data->sg, data->sg_len, -+ host->dma_dir); - -- bcm2835_sdhost_finish_data(host); -- } -+ host->dma_chan = NULL; - } - -- spin_unlock_irqrestore(&host->lock, flags); --} -+ if (host->drain_words) { -+ void *page; -+ u32 *buf; - --static bool data_transfer_wait(struct bcm2835_host *host) --{ -- unsigned long timeout = 1000000; -- while (timeout) -- { -- u32 sdhsts = bcm2835_sdhost_read(host, SDHSTS); -- if (sdhsts & SDHSTS_DATA_FLAG) { -- bcm2835_sdhost_write(host, SDHSTS_DATA_FLAG, SDHSTS); -- break; -+ page = kmap_atomic(host->drain_page); -+ buf = page + host->drain_offset; ++ err = request_firmware(&overlay->fw, overlay->path, NULL); ++ if (err != 0) ++ goto out_err; + -+ while (host->drain_words) { -+ u32 edm = bcm2835_sdhost_read(host, SDEDM); -+ if ((edm >> 4) & 0x1f) -+ *(buf++) = bcm2835_sdhost_read(host, -+ SDDATA); -+ host->drain_words--; - } -- timeout--; -- } -- if (timeout == 0) { -- pr_err("%s: Data %s timeout\n", -- mmc_hostname(host->mmc), -- (host->data->flags & MMC_DATA_READ) ? "read" : "write"); -- bcm2835_sdhost_dumpregs(host); -- host->data->error = -ETIMEDOUT; -- return false; ++ err = create_overlay(overlay, (void *)overlay->fw->data); ++ if (err != 0) ++ goto out_err; + -+ kunmap_atomic(page); - } -- return true; ++ return count; + -+ bcm2835_sdhost_finish_data(host); ++out_err: + -+ log_event("DMA>", (u32)host->data, 0); -+ spin_unlock_irqrestore(&host->lock, flags); - } - - static void bcm2835_sdhost_read_block_pio(struct bcm2835_host *host) -@@ -493,32 +553,83 @@ static void bcm2835_sdhost_read_block_pio(struct bcm2835_host *host) - unsigned long flags; - size_t blksize, len; - u32 *buf; -+ unsigned long wait_max; - - blksize = host->data->blksz; - -+ wait_max = jiffies + msecs_to_jiffies(host->pio_timeout); ++ release_firmware(overlay->fw); ++ overlay->fw = NULL; + - local_irq_save(flags); - - while (blksize) { -- if (!sg_miter_next(&host->sg_miter)) -- BUG(); -+ int copy_words; -+ u32 hsts = 0; ++ overlay->path[0] = '\0'; ++ return err; ++} + -+ if (!sg_miter_next(&host->sg_miter)) { -+ host->data->error = -EINVAL; -+ break; -+ } - - len = min(host->sg_miter.length, blksize); -- BUG_ON(len % 4); -+ if (len % 4) { -+ host->data->error = -EINVAL; -+ break; -+ } - - blksize -= len; - host->sg_miter.consumed = len; - - buf = (u32 *)host->sg_miter.addr; - -- while (len) { -- if (!data_transfer_wait(host)) -- break; -+ copy_words = len/4; ++static ssize_t cfs_overlay_item_status_show(struct config_item *item, ++ char *page) ++{ ++ struct cfs_overlay_item *overlay = to_cfs_overlay_item(item); + -+ while (copy_words) { -+ int burst_words, words; -+ u32 edm; ++ return sprintf(page, "%s\n", ++ overlay->ov_id >= 0 ? "applied" : "unapplied"); ++} + -+ burst_words = SDDATA_FIFO_PIO_BURST; -+ if (burst_words > copy_words) -+ burst_words = copy_words; -+ edm = bcm2835_sdhost_read(host, SDEDM); -+ words = ((edm >> 4) & 0x1f); ++CONFIGFS_ATTR(cfs_overlay_item_, path); ++CONFIGFS_ATTR_RO(cfs_overlay_item_, status); + -+ if (words < burst_words) { -+ int fsm_state = (edm & SDEDM_FSM_MASK); -+ if ((fsm_state != SDEDM_FSM_READDATA) && -+ (fsm_state != SDEDM_FSM_READWAIT) && -+ (fsm_state != SDEDM_FSM_READCRC)) { -+ hsts = bcm2835_sdhost_read(host, -+ SDHSTS); -+ pr_err("%s: fsm %x, hsts %x\n", -+ mmc_hostname(host->mmc), -+ fsm_state, hsts); -+ if (hsts & SDHSTS_ERROR_MASK) -+ break; -+ } ++static struct configfs_attribute *cfs_overlay_attrs[] = { ++ &cfs_overlay_item_attr_path, ++ &cfs_overlay_item_attr_status, ++ NULL, ++}; + -+ if (time_after(jiffies, wait_max)) { -+ pr_err("%s: PIO read timeout - EDM %x\n", -+ mmc_hostname(host->mmc), -+ edm); -+ hsts = SDHSTS_REW_TIME_OUT; -+ break; -+ } -+ ndelay((burst_words - words) * -+ host->ns_per_fifo_word); -+ continue; -+ } else if (words > copy_words) { -+ words = copy_words; -+ } ++ssize_t cfs_overlay_item_dtbo_read(struct config_item *item, ++ void *buf, size_t max_count) ++{ ++ struct cfs_overlay_item *overlay = to_cfs_overlay_item(item); + -+ copy_words -= words; - -- *(buf++) = bcm2835_sdhost_read(host, SDDATA); -- len -= 4; -+ while (words) { -+ *(buf++) = bcm2835_sdhost_read(host, SDDATA); -+ words--; -+ } - } - -- if (host->data->error) -+ if (hsts & SDHSTS_ERROR_MASK) - break; - } - -@@ -532,32 +643,83 @@ static void bcm2835_sdhost_write_block_pio(struct bcm2835_host *host) - unsigned long flags; - size_t blksize, len; - u32 *buf; -+ unsigned long wait_max; - - blksize = host->data->blksz; - -+ wait_max = jiffies + msecs_to_jiffies(host->pio_timeout); ++ pr_debug("%s: buf=%p max_count=%zu\n", __func__, ++ buf, max_count); + - local_irq_save(flags); - - while (blksize) { -- if (!sg_miter_next(&host->sg_miter)) -- BUG(); -+ int copy_words; -+ u32 hsts = 0; ++ if (overlay->dtbo == NULL) ++ return 0; + -+ if (!sg_miter_next(&host->sg_miter)) { -+ host->data->error = -EINVAL; -+ break; -+ } - - len = min(host->sg_miter.length, blksize); -- BUG_ON(len % 4); -+ if (len % 4) { -+ host->data->error = -EINVAL; -+ break; -+ } - - blksize -= len; - host->sg_miter.consumed = len; - -- buf = host->sg_miter.addr; -+ buf = (u32 *)host->sg_miter.addr; - -- while (len) { -- if (!data_transfer_wait(host)) -- break; -+ copy_words = len/4; ++ /* copy if buffer provided */ ++ if (buf != NULL) { ++ /* the buffer must be large enough */ ++ if (overlay->dtbo_size > max_count) ++ return -ENOSPC; + -+ while (copy_words) { -+ int burst_words, words; -+ u32 edm; ++ memcpy(buf, overlay->dtbo, overlay->dtbo_size); ++ } + -+ burst_words = SDDATA_FIFO_PIO_BURST; -+ if (burst_words > copy_words) -+ burst_words = copy_words; -+ edm = bcm2835_sdhost_read(host, SDEDM); -+ words = SDDATA_FIFO_WORDS - ((edm >> 4) & 0x1f); ++ return overlay->dtbo_size; ++} + -+ if (words < burst_words) { -+ int fsm_state = (edm & SDEDM_FSM_MASK); -+ if ((fsm_state != SDEDM_FSM_WRITEDATA) && -+ (fsm_state != SDEDM_FSM_WRITESTART1) && -+ (fsm_state != SDEDM_FSM_WRITESTART2)) { -+ hsts = bcm2835_sdhost_read(host, -+ SDHSTS); -+ pr_err("%s: fsm %x, hsts %x\n", -+ mmc_hostname(host->mmc), -+ fsm_state, hsts); -+ if (hsts & SDHSTS_ERROR_MASK) -+ break; -+ } ++ssize_t cfs_overlay_item_dtbo_write(struct config_item *item, ++ const void *buf, size_t count) ++{ ++ struct cfs_overlay_item *overlay = to_cfs_overlay_item(item); ++ int err; + -+ if (time_after(jiffies, wait_max)) { -+ pr_err("%s: PIO write timeout - EDM %x\n", -+ mmc_hostname(host->mmc), -+ edm); -+ hsts = SDHSTS_REW_TIME_OUT; -+ break; -+ } -+ ndelay((burst_words - words) * -+ host->ns_per_fifo_word); -+ continue; -+ } else if (words > copy_words) { -+ words = copy_words; -+ } ++ /* if it's set do not allow changes */ ++ if (overlay->path[0] != '\0' || overlay->dtbo_size > 0) ++ return -EPERM; + -+ copy_words -= words; - -- bcm2835_sdhost_write(host, *(buf++), SDDATA); -- len -= 4; -+ while (words) { -+ bcm2835_sdhost_write(host, *(buf++), SDDATA); -+ words--; -+ } - } - -- if (host->data->error) -+ if (hsts & SDHSTS_ERROR_MASK) - break; - } - -@@ -566,12 +728,12 @@ static void bcm2835_sdhost_write_block_pio(struct bcm2835_host *host) - local_irq_restore(flags); - } - -- - static void bcm2835_sdhost_transfer_pio(struct bcm2835_host *host) - { - u32 sdhsts; - bool is_read; - BUG_ON(!host->data); -+ log_event("XFP<", (u32)host->data, host->blocks); - - is_read = (host->data->flags & MMC_DATA_READ) != 0; - if (is_read) -@@ -595,28 +757,21 @@ static void bcm2835_sdhost_transfer_pio(struct bcm2835_host *host) - is_read ? "read" : "write", - sdhsts); - host->data->error = -ETIMEDOUT; -- } else if (!is_read && !host->data->error) { -- /* Start a timer in case a transfer error occurs because -- there is no error interrupt */ -- mod_timer(&host->pio_timer, jiffies + host->pio_timeout); - } -+ log_event("XFP>", (u32)host->data, host->blocks); - } - -- --static void bcm2835_sdhost_transfer_dma(struct bcm2835_host *host) -+static void bcm2835_sdhost_prepare_dma(struct bcm2835_host *host, -+ struct mmc_data *data) - { -- u32 len, dir_data, dir_slave; -+ int len, dir_data, dir_slave; - struct dma_async_tx_descriptor *desc = NULL; - struct dma_chan *dma_chan; - -- pr_debug("bcm2835_sdhost_transfer_dma()\n"); -- -- WARN_ON(!host->data); -- -- if (!host->data) -- return; -+ log_event("PRD<", (u32)data, 0); -+ pr_debug("bcm2835_sdhost_prepare_dma()\n"); - -- if (host->data->flags & MMC_DATA_READ) { -+ if (data->flags & MMC_DATA_READ) { - dma_chan = host->dma_chan_rx; - dir_data = DMA_FROM_DEVICE; - dir_slave = DMA_DEV_TO_MEM; -@@ -625,35 +780,71 @@ static void bcm2835_sdhost_transfer_dma(struct bcm2835_host *host) - dir_data = DMA_TO_DEVICE; - dir_slave = DMA_MEM_TO_DEV; - } -+ log_event("PRD1", (u32)dma_chan, 0); - - BUG_ON(!dma_chan->device); - BUG_ON(!dma_chan->device->dev); -- BUG_ON(!host->data->sg); -+ BUG_ON(!data->sg); ++ /* copy the contents */ ++ overlay->dtbo = kmemdup(buf, count, GFP_KERNEL); ++ if (overlay->dtbo == NULL) ++ return -ENOMEM; + -+ /* The block doesn't manage the FIFO DREQs properly for multi-block -+ transfers, so don't attempt to DMA the final few words. -+ Unfortunately this requires the final sg entry to be trimmed. -+ N.B. This code demands that the overspill is contained in -+ a single sg entry. -+ */ ++ overlay->dtbo_size = count; + -+ host->drain_words = 0; -+ if ((data->blocks > 1) && (dir_data == DMA_FROM_DEVICE)) { -+ struct scatterlist *sg; -+ u32 len; -+ int i; ++ err = create_overlay(overlay, overlay->dtbo); ++ if (err != 0) ++ goto out_err; + -+ len = min((u32)(FIFO_READ_THRESHOLD - 1) * 4, -+ (u32)data->blocks * data->blksz); - -- len = dma_map_sg(dma_chan->device->dev, host->data->sg, -- host->data->sg_len, dir_data); -- if (len > 0) { -- desc = dmaengine_prep_slave_sg(dma_chan, host->data->sg, -+ for_each_sg(data->sg, sg, data->sg_len, i) { -+ if (sg_is_last(sg)) { -+ BUG_ON(sg->length < len); -+ sg->length -= len; -+ host->drain_page = (struct page *)sg->page_link; -+ host->drain_offset = sg->offset + sg->length; -+ } -+ } -+ host->drain_words = len/4; -+ } ++ return count; + -+ len = dma_map_sg(dma_chan->device->dev, data->sg, data->sg_len, -+ dir_data); ++out_err: ++ kfree(overlay->dtbo); ++ overlay->dtbo = NULL; ++ overlay->dtbo_size = 0; + -+ log_event("PRD2", len, 0); -+ if (len > 0) -+ desc = dmaengine_prep_slave_sg(dma_chan, data->sg, - len, dir_slave, - DMA_PREP_INTERRUPT | DMA_CTRL_ACK); -- } else { -- dev_err(mmc_dev(host->mmc), "dma_map_sg returned zero length\n"); -- } -+ log_event("PRD3", (u32)desc, 0); ++ return err; ++} + - if (desc) { - desc->callback = bcm2835_sdhost_dma_complete; - desc->callback_param = host; -- dmaengine_submit(desc); -- dma_async_issue_pending(dma_chan); -+ host->dma_desc = desc; -+ host->dma_chan = dma_chan; -+ host->dma_dir = dir_data; - } -- -+ log_event("PDM>", (u32)data, 0); - } - -+static void bcm2835_sdhost_start_dma(struct bcm2835_host *host) ++CONFIGFS_BIN_ATTR(cfs_overlay_item_, dtbo, NULL, SZ_1M); ++ ++static struct configfs_bin_attribute *cfs_overlay_bin_attrs[] = { ++ &cfs_overlay_item_attr_dtbo, ++ NULL, ++}; ++ ++static void cfs_overlay_release(struct config_item *item) +{ -+ log_event("SDMA", (u32)host->data, (u32)host->dma_chan); -+ dmaengine_submit(host->dma_desc); -+ dma_async_issue_pending(host->dma_chan); ++ struct cfs_overlay_item *overlay = to_cfs_overlay_item(item); ++ ++ if (overlay->ov_id >= 0) ++ of_overlay_destroy(overlay->ov_id); ++ if (overlay->fw) ++ release_firmware(overlay->fw); ++ /* kfree with NULL is safe */ ++ kfree(overlay->dtbo); ++ kfree(overlay); +} - - static void bcm2835_sdhost_set_transfer_irqs(struct bcm2835_host *host) - { - u32 all_irqs = SDHCFG_DATA_IRPT_EN | SDHCFG_BLOCK_IRPT_EN | - SDHCFG_BUSY_IRPT_EN; -- if (host->use_dma) -+ if (host->dma_desc) - host->hcfg = (host->hcfg & ~all_irqs) | - SDHCFG_BUSY_IRPT_EN; - else -@@ -664,13 +855,13 @@ static void bcm2835_sdhost_set_transfer_irqs(struct bcm2835_host *host) - bcm2835_sdhost_write(host, host->hcfg, SDHCFG); - } - -- - static void bcm2835_sdhost_prepare_data(struct bcm2835_host *host, struct mmc_command *cmd) - { - struct mmc_data *data = cmd->data; - - WARN_ON(host->data); - -+ host->data = data; - if (!data) - return; - -@@ -679,46 +870,19 @@ static void bcm2835_sdhost_prepare_data(struct bcm2835_host *host, struct mmc_co - BUG_ON(data->blksz > host->mmc->max_blk_size); - BUG_ON(data->blocks > 65535); - -- host->data = data; - host->data_complete = 0; - host->flush_fifo = 0; - host->data->bytes_xfered = 0; - -- if (!host->sectors && host->mmc->card && !(host->debug_flags & 1)) -- { -- struct mmc_card *card = host->mmc->card; -- if (!mmc_card_sd(card) && mmc_card_blockaddr(card)) { -- /* -- * The EXT_CSD sector count is in number of 512 byte -- * sectors. -- */ -- host->sectors = card->ext_csd.sectors; -- pr_err("%s: using ext_csd!\n", mmc_hostname(host->mmc)); -- } else { -- /* -- * The CSD capacity field is in units of read_blkbits. -- * set_capacity takes units of 512 bytes. -- */ -- host->sectors = card->csd.capacity << -- (card->csd.read_blkbits - 9); -- } -- host->single_read_sectors[0] = host->sectors - 65; -- host->single_read_sectors[1] = host->sectors - 64; -- host->single_read_sectors[2] = host->sectors - 33; -- host->single_read_sectors[3] = host->sectors - 32; -- host->single_read_sectors[4] = host->sectors - 1; -- host->single_read_sectors[5] = ~0; /* Safety net */ -- } - -- host->use_dma = host->have_dma && (data->blocks > host->pio_limit); -- if (!host->use_dma) { -+ if (!host->dma_desc) { -+ /* Use PIO */ - int flags; - -- flags = SG_MITER_ATOMIC; - if (data->flags & MMC_DATA_READ) -- flags |= SG_MITER_TO_SG; -+ flags = SG_MITER_TO_SG; - else -- flags |= SG_MITER_FROM_SG; -+ flags = SG_MITER_FROM_SG; - sg_miter_start(&host->sg_miter, data->sg, data->sg_len, flags); - host->blocks = data->blocks; - } -@@ -726,19 +890,20 @@ static void bcm2835_sdhost_prepare_data(struct bcm2835_host *host, struct mmc_co - bcm2835_sdhost_set_transfer_irqs(host); - - bcm2835_sdhost_write(host, data->blksz, SDHBCT); -- bcm2835_sdhost_write(host, host->use_dma ? data->blocks : 0, SDHBLC); -+ bcm2835_sdhost_write(host, data->blocks, SDHBLC); - - BUG_ON(!host->data); - } - -- --void bcm2835_sdhost_send_command(struct bcm2835_host *host, struct mmc_command *cmd) -+bool bcm2835_sdhost_send_command(struct bcm2835_host *host, -+ struct mmc_command *cmd) - { - u32 sdcmd, sdhsts; - unsigned long timeout; - int delay; - - WARN_ON(host->cmd); -+ log_event("CMD<", cmd->opcode, cmd->arg); - - if (cmd->data) - pr_debug("%s: send_command %d 0x%x " -@@ -761,9 +926,9 @@ void bcm2835_sdhost_send_command(struct bcm2835_host *host, struct mmc_command * - pr_err("%s: previous command never completed.\n", - mmc_hostname(host->mmc)); - bcm2835_sdhost_dumpregs(host); -- cmd->error = -EIO; -+ cmd->error = -EILSEQ; - tasklet_schedule(&host->finish_tasklet); -- return; -+ return false; - } - timeout--; - udelay(10); -@@ -791,23 +956,24 @@ void bcm2835_sdhost_send_command(struct bcm2835_host *host, struct mmc_command * - if (sdhsts & SDHSTS_ERROR_MASK) - bcm2835_sdhost_write(host, sdhsts, SDHSTS); - -- bcm2835_sdhost_prepare_data(host, cmd); -- -- bcm2835_sdhost_write(host, cmd->arg, SDARG); -- - if ((cmd->flags & MMC_RSP_136) && (cmd->flags & MMC_RSP_BUSY)) { - pr_err("%s: unsupported response type!\n", - mmc_hostname(host->mmc)); - cmd->error = -EINVAL; - tasklet_schedule(&host->finish_tasklet); -- return; -+ return false; - } - -+ bcm2835_sdhost_prepare_data(host, cmd); + -+ bcm2835_sdhost_write(host, cmd->arg, SDARG); ++static struct configfs_item_operations cfs_overlay_item_ops = { ++ .release = cfs_overlay_release, ++}; + - sdcmd = cmd->opcode & SDCMD_CMD_MASK; - -- if (!(cmd->flags & MMC_RSP_PRESENT)) -+ host->use_busy = 0; -+ if (!(cmd->flags & MMC_RSP_PRESENT)) { - sdcmd |= SDCMD_NO_RESPONSE; -- else { -+ } else { - if (cmd->flags & MMC_RSP_136) - sdcmd |= SDCMD_LONG_RESPONSE; - if (cmd->flags & MMC_RSP_BUSY) { -@@ -817,6 +983,7 @@ void bcm2835_sdhost_send_command(struct bcm2835_host *host, struct mmc_command * - } - - if (cmd->data) { -+ log_event("CMDD", cmd->data->blocks, cmd->data->blksz); - if (host->delay_after_stop) { - struct timeval now; - int time_since_stop; -@@ -839,10 +1006,12 @@ void bcm2835_sdhost_send_command(struct bcm2835_host *host, struct mmc_command * - } - - bcm2835_sdhost_write(host, sdcmd | SDCMD_NEW_FLAG, SDCMD); --} - -+ return true; -+} - --static void bcm2835_sdhost_finish_command(struct bcm2835_host *host); -+static void bcm2835_sdhost_finish_command(struct bcm2835_host *host, -+ unsigned long *irq_flags); - static void bcm2835_sdhost_transfer_complete(struct bcm2835_host *host); - - static void bcm2835_sdhost_finish_data(struct bcm2835_host *host) -@@ -852,6 +1021,7 @@ static void bcm2835_sdhost_finish_data(struct bcm2835_host *host) - data = host->data; - BUG_ON(!data); - -+ log_event("FDA<", (u32)host->mrq, (u32)host->cmd); - pr_debug("finish_data(error %d, stop %d, sbc %d)\n", - data->error, data->stop ? 1 : 0, - host->mrq->sbc ? 1 : 0); -@@ -859,10 +1029,7 @@ static void bcm2835_sdhost_finish_data(struct bcm2835_host *host) - host->hcfg &= ~(SDHCFG_DATA_IRPT_EN | SDHCFG_BLOCK_IRPT_EN); - bcm2835_sdhost_write(host, host->hcfg, SDHCFG); - -- if (data->error) { -- data->bytes_xfered = 0; -- } else -- data->bytes_xfered = data->blksz * data->blocks; -+ data->bytes_xfered = data->error ? 0 : (data->blksz * data->blocks); - - host->data_complete = 1; - -@@ -877,9 +1044,9 @@ static void bcm2835_sdhost_finish_data(struct bcm2835_host *host) - } - else - bcm2835_sdhost_transfer_complete(host); -+ log_event("FDA>", (u32)host->mrq, (u32)host->cmd); - } - -- - static void bcm2835_sdhost_transfer_complete(struct bcm2835_host *host) - { - struct mmc_data *data; -@@ -891,6 +1058,7 @@ static void bcm2835_sdhost_transfer_complete(struct bcm2835_host *host) - data = host->data; - host->data = NULL; - -+ log_event("TCM<", (u32)data, data->error); - pr_debug("transfer_complete(error %d, stop %d)\n", - data->error, data->stop ? 1 : 0); - -@@ -899,88 +1067,114 @@ static void bcm2835_sdhost_transfer_complete(struct bcm2835_host *host) - * a) open-ended multiblock transfer (no CMD23) - * b) error in multiblock transfer - */ -- if (data->stop && -- (data->error || -- !host->mrq->sbc)) { -- host->flush_fifo = 1; -- bcm2835_sdhost_send_command(host, data->stop); -- if (host->delay_after_stop) -- do_gettimeofday(&host->stop_time); -- if (!host->use_busy) -- bcm2835_sdhost_finish_command(host); -+ if (host->mrq->stop && (data->error || !host->use_sbc)) { -+ if (bcm2835_sdhost_send_command(host, host->mrq->stop)) { -+ /* No busy, so poll for completion */ -+ if (!host->use_busy) -+ bcm2835_sdhost_finish_command(host, NULL); ++static struct config_item_type cfs_overlay_type = { ++ .ct_item_ops = &cfs_overlay_item_ops, ++ .ct_attrs = cfs_overlay_attrs, ++ .ct_bin_attrs = cfs_overlay_bin_attrs, ++ .ct_owner = THIS_MODULE, ++}; + -+ if (host->delay_after_stop) -+ do_gettimeofday(&host->stop_time); -+ } - } else { -+ bcm2835_sdhost_wait_transfer_complete(host); - tasklet_schedule(&host->finish_tasklet); - } -+ log_event("TCM>", (u32)data, 0); - } - --static void bcm2835_sdhost_finish_command(struct bcm2835_host *host) -+/* If irq_flags is valid, the caller is in a thread context and is allowed -+ to sleep */ -+static void bcm2835_sdhost_finish_command(struct bcm2835_host *host, -+ unsigned long *irq_flags) - { - u32 sdcmd; -- unsigned long timeout; -+ u32 retries; - #ifdef DEBUG - struct timeval before, after; - int timediff = 0; - #endif - -+ log_event("FCM<", (u32)host->mrq, (u32)host->cmd); - pr_debug("finish_command(%x)\n", bcm2835_sdhost_read(host, SDCMD)); - - BUG_ON(!host->cmd || !host->mrq); - --#ifdef DEBUG -- do_gettimeofday(&before); --#endif -- /* Wait max 100 ms */ -- timeout = 10000; -+ /* Poll quickly at first */ ++static struct config_item *cfs_overlay_group_make_item( ++ struct config_group *group, const char *name) ++{ ++ struct cfs_overlay_item *overlay; + -+ retries = host->cmd_quick_poll_retries; -+ if (!retries) { -+ /* Work out how many polls take 1us by timing 10us */ -+ struct timeval start, now; -+ int us_diff; ++ overlay = kzalloc(sizeof(*overlay), GFP_KERNEL); ++ if (!overlay) ++ return ERR_PTR(-ENOMEM); ++ overlay->ov_id = -1; + -+ retries = 1; -+ do { -+ int i; ++ config_item_init_type_name(&overlay->item, name, &cfs_overlay_type); ++ return &overlay->item; ++} + -+ retries *= 2; ++static void cfs_overlay_group_drop_item(struct config_group *group, ++ struct config_item *item) ++{ ++ struct cfs_overlay_item *overlay = to_cfs_overlay_item(item); + -+ do_gettimeofday(&start); ++ config_item_put(&overlay->item); ++} + -+ for (i = 0; i < retries; i++) { -+ cpu_relax(); -+ sdcmd = bcm2835_sdhost_read(host, SDCMD); -+ } ++static struct configfs_group_operations overlays_ops = { ++ .make_item = cfs_overlay_group_make_item, ++ .drop_item = cfs_overlay_group_drop_item, ++}; + -+ do_gettimeofday(&now); -+ us_diff = (now.tv_sec - start.tv_sec) * 1000000 + -+ (now.tv_usec - start.tv_usec); -+ } while (us_diff < 10); ++static struct config_item_type overlays_type = { ++ .ct_group_ops = &overlays_ops, ++ .ct_owner = THIS_MODULE, ++}; + -+ host->cmd_quick_poll_retries = ((retries * us_diff + 9)*CMD_DALLY_US)/10 + 1; -+ retries = 1; // We've already waited long enough this time -+ } ++static struct configfs_group_operations of_cfs_ops = { ++ /* empty - we don't allow anything to be created */ ++}; + -+ retries = host->cmd_quick_poll_retries; - for (sdcmd = bcm2835_sdhost_read(host, SDCMD); -- (sdcmd & SDCMD_NEW_FLAG) && timeout; -- timeout--) { -- if (host->flush_fifo) { -- while (bcm2835_sdhost_read(host, SDHSTS) & -- SDHSTS_DATA_FLAG) -- (void)bcm2835_sdhost_read(host, SDDATA); -- } -- udelay(10); -+ (sdcmd & SDCMD_NEW_FLAG) && !(sdcmd & SDCMD_FAIL_FLAG) && retries; -+ retries--) { -+ cpu_relax(); - sdcmd = bcm2835_sdhost_read(host, SDCMD); - } --#ifdef DEBUG -- do_gettimeofday(&after); -- timediff = (after.tv_sec - before.tv_sec)*1000000 + -- (after.tv_usec - before.tv_usec); - -- pr_debug(" finish_command - waited %dus\n", timediff); --#endif -+ if (!retries) { -+ unsigned long wait_max; ++static struct config_item_type of_cfs_type = { ++ .ct_group_ops = &of_cfs_ops, ++ .ct_owner = THIS_MODULE, ++}; + -+ if (!irq_flags) { -+ /* Schedule the work */ -+ log_event("CWWQ", 0, 0); -+ schedule_work(&host->cmd_wait_wq); -+ return; -+ } ++struct config_group of_cfs_overlay_group; + -+ /* Wait max 100 ms */ -+ wait_max = jiffies + msecs_to_jiffies(100); -+ while (time_before(jiffies, wait_max)) { -+ spin_unlock_irqrestore(&host->lock, *irq_flags); -+ usleep_range(1, 10); -+ spin_lock_irqsave(&host->lock, *irq_flags); -+ sdcmd = bcm2835_sdhost_read(host, SDCMD); -+ if (!(sdcmd & SDCMD_NEW_FLAG) || -+ (sdcmd & SDCMD_FAIL_FLAG)) -+ break; -+ } ++static struct configfs_subsystem of_cfs_subsys = { ++ .su_group = { ++ .cg_item = { ++ .ci_namebuf = "device-tree", ++ .ci_type = &of_cfs_type, ++ }, ++ }, ++ .su_mutex = __MUTEX_INITIALIZER(of_cfs_subsys.su_mutex), ++}; ++ ++static int __init of_cfs_init(void) ++{ ++ int ret; ++ ++ pr_info("%s\n", __func__); ++ ++ config_group_init(&of_cfs_subsys.su_group); ++ config_group_init_type_name(&of_cfs_overlay_group, "overlays", ++ &overlays_type); ++ configfs_add_default_group(&of_cfs_overlay_group, ++ &of_cfs_subsys.su_group); ++ ++ ret = configfs_register_subsystem(&of_cfs_subsys); ++ if (ret != 0) { ++ pr_err("%s: failed to register subsys\n", __func__); ++ goto out; + } ++ pr_info("%s: OK\n", __func__); ++out: ++ return ret; ++} ++late_initcall(of_cfs_init); + +From 84da37731727b20a8b585757ad3b16f09a1d0073 Mon Sep 17 00:00:00 2001 +From: Cheong2K <cheong@redbear.cc> +Date: Fri, 26 Feb 2016 18:20:10 +0800 +Subject: [PATCH 089/112] brcm: adds support for BCM43341 wifi + +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 2 ++ + drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h | 1 + + 2 files changed, 3 insertions(+) + +diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +index 43fd3f4..c3c7c79 100644 +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +@@ -606,6 +606,7 @@ BRCMF_FW_NVRAM_DEF(4329, "brcmfmac4329-sdio.bin", "brcmfmac4329-sdio.txt"); + BRCMF_FW_NVRAM_DEF(4330, "brcmfmac4330-sdio.bin", "brcmfmac4330-sdio.txt"); + BRCMF_FW_NVRAM_DEF(4334, "brcmfmac4334-sdio.bin", "brcmfmac4334-sdio.txt"); + BRCMF_FW_NVRAM_DEF(43340, "brcmfmac43340-sdio.bin", "brcmfmac43340-sdio.txt"); ++BRCMF_FW_NVRAM_DEF(43341, "brcmfmac43341-sdio.bin", "brcmfmac43341-sdio.txt"); + BRCMF_FW_NVRAM_DEF(4335, "brcmfmac4335-sdio.bin", "brcmfmac4335-sdio.txt"); + BRCMF_FW_NVRAM_DEF(43362, "brcmfmac43362-sdio.bin", "brcmfmac43362-sdio.txt"); + BRCMF_FW_NVRAM_DEF(4339, "brcmfmac4339-sdio.bin", "brcmfmac4339-sdio.txt"); +@@ -622,6 +623,7 @@ static struct brcmf_firmware_mapping brcmf_sdio_fwnames[] = { + BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4330_CHIP_ID, 0xFFFFFFFF, 4330), + BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4334_CHIP_ID, 0xFFFFFFFF, 4334), + BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43340_CHIP_ID, 0xFFFFFFFF, 43340), ++ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43341_CHIP_ID, 0xFFFFFFFF, 43341), + BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4335_CHIP_ID, 0xFFFFFFFF, 4335), + BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43362_CHIP_ID, 0xFFFFFFFE, 43362), + BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4339_CHIP_ID, 0xFFFFFFFF, 4339), +diff --git a/drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h b/drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h +index 699f2c2..15598b3 100644 +--- a/drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h ++++ b/drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h +@@ -35,6 +35,7 @@ + #define BRCM_CC_4330_CHIP_ID 0x4330 + #define BRCM_CC_4334_CHIP_ID 0x4334 + #define BRCM_CC_43340_CHIP_ID 43340 ++#define BRCM_CC_43341_CHIP_ID 43341 + #define BRCM_CC_43362_CHIP_ID 43362 + #define BRCM_CC_4335_CHIP_ID 0x4335 + #define BRCM_CC_4339_CHIP_ID 0x4339 + +From 48b27165b0d028e22700c9c760ee28758191e153 Mon Sep 17 00:00:00 2001 +From: Phil Elwell <phil@raspberrypi.org> +Date: Wed, 9 Mar 2016 17:25:59 +0000 +Subject: [PATCH 090/112] brcmfmac: Disable power management + +Disable wireless power saving in the brcmfmac WLAN driver. This is a +temporary measure until the connectivity loss resulting from power +saving is resolved. + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +index d5c2a27..5a08f59 100644 +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +@@ -2623,6 +2623,8 @@ brcmf_cfg80211_set_power_mgmt(struct wiphy *wiphy, struct net_device *ndev, + * preference in cfg struct to apply this to + * FW later while initializing the dongle + */ ++ pr_info("power management disabled\n"); ++ enabled = false; + cfg->pwr_save = enabled; + if (!check_vif_up(ifp->vif)) { -- if (timeout == 0) { -+ /* Check for errors */ -+ if (sdcmd & SDCMD_NEW_FLAG) { - pr_err("%s: command never completed.\n", - mmc_hostname(host->mmc)); - bcm2835_sdhost_dumpregs(host); - host->cmd->error = -EIO; - tasklet_schedule(&host->finish_tasklet); - return; -- } -- -- if (host->flush_fifo) { -- for (timeout = 100; -- (bcm2835_sdhost_read(host, SDHSTS) & SDHSTS_DATA_FLAG) && timeout; -- timeout--) { -- (void)bcm2835_sdhost_read(host, SDDATA); -- } -- host->flush_fifo = 0; -- if (timeout == 0) { -- pr_err("%s: FIFO never drained.\n", -- mmc_hostname(host->mmc)); -- bcm2835_sdhost_dumpregs(host); -- host->cmd->error = -EIO; -- tasklet_schedule(&host->finish_tasklet); -- return; -- } -- } -- -- /* Check for errors */ -- if (sdcmd & SDCMD_FAIL_FLAG) -- { -+ } else if (sdcmd & SDCMD_FAIL_FLAG) { - u32 sdhsts = bcm2835_sdhost_read(host, SDHSTS); + +From cf6845399aab2b43a579bc613a8c2b2f4cda5920 Mon Sep 17 00:00:00 2001 +From: Phil Elwell <phil@raspberrypi.org> +Date: Thu, 28 Apr 2016 17:13:47 +0100 +Subject: [PATCH 091/112] brcmfmac: Use original country code as a fallback + +Commit 73345fd212980d2e28a5c6d83801c903bd773680: + + brcmfmac: Configure country code using device specific settings + +prevents region codes from working on devices that lack a region code +translation table. In the event of an absent table, preserve the old +behaviour of using the provided code as-is. + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> +--- + .../wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 20 +++++++++++++++----- + 1 file changed, 15 insertions(+), 5 deletions(-) + +diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +index 5a08f59..ceba7b6 100644 +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +@@ -6516,12 +6516,18 @@ static s32 brcmf_translate_country_code(struct brcmf_pub *drvr, char alpha2[2], + struct brcmfmac_pd_cc *country_codes; + struct brcmfmac_pd_cc_entry *cc; + s32 found_index; ++ char ccode[BRCMF_COUNTRY_BUF_SZ]; ++ int rev; + int i; -+ /* Clear the errors */ -+ bcm2835_sdhost_write(host, SDHSTS_ERROR_MASK, SDHSTS); ++ memcpy(ccode, alpha2, sizeof(ccode)); ++ rev = -1; + - if (host->debug) - pr_info("%s: error detected - CMD %x, HSTS %03x, EDM %x\n", - mmc_hostname(host->mmc), sdcmd, sdhsts, -@@ -1003,7 +1197,7 @@ static void bcm2835_sdhost_finish_command(struct bcm2835_host *host) - mmc_hostname(host->mmc), - host->cmd->opcode); - bcm2835_sdhost_dumpregs(host); -- host->cmd->error = -EIO; -+ host->cmd->error = -EILSEQ; - } - tasklet_schedule(&host->finish_tasklet); - return; -@@ -1018,31 +1212,31 @@ static void bcm2835_sdhost_finish_command(struct bcm2835_host *host) - pr_debug("%s: finish_command %08x %08x %08x %08x\n", - mmc_hostname(host->mmc), - host->cmd->resp[0], host->cmd->resp[1], host->cmd->resp[2], host->cmd->resp[3]); -+ log_event("RSP ", host->cmd->resp[0], host->cmd->resp[1]); - } else { - host->cmd->resp[0] = bcm2835_sdhost_read(host, SDRSP0); - pr_debug("%s: finish_command %08x\n", - mmc_hostname(host->mmc), - host->cmd->resp[0]); -+ log_event("RSP ", host->cmd->resp[0], 0); - } - } - -- host->cmd->error = 0; -- - if (host->cmd == host->mrq->sbc) { - /* Finished CMD23, now send actual command. */ - host->cmd = NULL; -- bcm2835_sdhost_send_command(host, host->mrq->cmd); -- -- if (host->cmd->data && host->use_dma) -- /* DMA transfer starts now, PIO starts after irq */ -- bcm2835_sdhost_transfer_dma(host); -+ if (bcm2835_sdhost_send_command(host, host->mrq->cmd)) { -+ if (host->data && host->dma_desc) -+ /* DMA transfer starts now, PIO starts after irq */ -+ bcm2835_sdhost_start_dma(host); - -- if (!host->use_busy) -- bcm2835_sdhost_finish_command(host); -- } else if (host->cmd == host->mrq->stop) -+ if (!host->use_busy) -+ bcm2835_sdhost_finish_command(host, NULL); -+ } -+ } else if (host->cmd == host->mrq->stop) { - /* Finished CMD12 */ - tasklet_schedule(&host->finish_tasklet); -- else { -+ } else { - /* Processed actual command. */ - host->cmd = NULL; - if (!host->data) -@@ -1050,6 +1244,7 @@ static void bcm2835_sdhost_finish_command(struct bcm2835_host *host) - else if (host->data_complete) - bcm2835_sdhost_transfer_complete(host); - } -+ log_event("FCM>", (u32)host->mrq, (u32)host->cmd); - } - - static void bcm2835_sdhost_timeout(unsigned long data) -@@ -1060,10 +1255,12 @@ static void bcm2835_sdhost_timeout(unsigned long data) - host = (struct bcm2835_host *)data; - - spin_lock_irqsave(&host->lock, flags); -+ log_event("TIM<", 0, 0); - - if (host->mrq) { - pr_err("%s: timeout waiting for hardware interrupt.\n", - mmc_hostname(host->mmc)); -+ log_dump(); - bcm2835_sdhost_dumpregs(host); - - if (host->data) { -@@ -1084,74 +1281,15 @@ static void bcm2835_sdhost_timeout(unsigned long data) - spin_unlock_irqrestore(&host->lock, flags); - } - --static void bcm2835_sdhost_pio_timeout(unsigned long data) -+static void bcm2835_sdhost_busy_irq(struct bcm2835_host *host, u32 intmask) - { -- struct bcm2835_host *host; -- unsigned long flags; -- -- host = (struct bcm2835_host *)data; -- -- spin_lock_irqsave(&host->lock, flags); -- -- if (host->data) { -- u32 sdhsts = bcm2835_sdhost_read(host, SDHSTS); -- -- if (sdhsts & SDHSTS_REW_TIME_OUT) { -- pr_err("%s: transfer timeout\n", -- mmc_hostname(host->mmc)); -- if (host->debug) -- bcm2835_sdhost_dumpregs(host); -- } else { -- pr_err("%s: unexpected transfer timeout\n", -- mmc_hostname(host->mmc)); -- bcm2835_sdhost_dumpregs(host); -- } -- -- bcm2835_sdhost_write(host, SDHSTS_TRANSFER_ERROR_MASK, -- SDHSTS); -- -- host->data->error = -ETIMEDOUT; -- -- bcm2835_sdhost_finish_data(host); -- } -- -- mmiowb(); -- spin_unlock_irqrestore(&host->lock, flags); --} -- --static void bcm2835_sdhost_enable_sdio_irq_nolock(struct bcm2835_host *host, int enable) --{ -- if (enable) -- host->hcfg |= SDHCFG_SDIO_IRPT_EN; -- else -- host->hcfg &= ~SDHCFG_SDIO_IRPT_EN; -- bcm2835_sdhost_write(host, host->hcfg, SDHCFG); -- mmiowb(); --} -- --static void bcm2835_sdhost_enable_sdio_irq(struct mmc_host *mmc, int enable) --{ -- struct bcm2835_host *host = mmc_priv(mmc); -- unsigned long flags; -- -- pr_debug("%s: enable_sdio_irq(%d)\n", mmc_hostname(mmc), enable); -- spin_lock_irqsave(&host->lock, flags); -- bcm2835_sdhost_enable_sdio_irq_nolock(host, enable); -- spin_unlock_irqrestore(&host->lock, flags); --} -- --static u32 bcm2835_sdhost_busy_irq(struct bcm2835_host *host, u32 intmask) --{ -- const u32 handled = (SDHSTS_REW_TIME_OUT | SDHSTS_CMD_TIME_OUT | -- SDHSTS_CRC16_ERROR | SDHSTS_CRC7_ERROR | -- SDHSTS_FIFO_ERROR); -- -+ log_event("IRQB", (u32)host->cmd, intmask); - if (!host->cmd) { - pr_err("%s: got command busy interrupt 0x%08x even " - "though no command operation was in progress.\n", - mmc_hostname(host->mmc), (unsigned)intmask); - bcm2835_sdhost_dumpregs(host); -- return 0; -+ return; - } - - if (!host->use_busy) { -@@ -1159,7 +1297,7 @@ static u32 bcm2835_sdhost_busy_irq(struct bcm2835_host *host, u32 intmask) - "though not expecting one.\n", - mmc_hostname(host->mmc), (unsigned)intmask); - bcm2835_sdhost_dumpregs(host); -- return 0; -+ return; - } - host->use_busy = 0; - -@@ -1182,28 +1320,23 @@ static u32 bcm2835_sdhost_busy_irq(struct bcm2835_host *host, u32 intmask) - } else if (intmask & SDHSTS_CMD_TIME_OUT) - host->cmd->error = -ETIMEDOUT; - -+ log_dump(); - bcm2835_sdhost_dumpregs(host); -- tasklet_schedule(&host->finish_tasklet); - } - else -- bcm2835_sdhost_finish_command(host); -- -- return handled; -+ bcm2835_sdhost_finish_command(host, NULL); - } - --static u32 bcm2835_sdhost_data_irq(struct bcm2835_host *host, u32 intmask) -+static void bcm2835_sdhost_data_irq(struct bcm2835_host *host, u32 intmask) - { -- const u32 handled = (SDHSTS_REW_TIME_OUT | -- SDHSTS_CRC16_ERROR | -- SDHSTS_FIFO_ERROR); -- - /* There are no dedicated data/space available interrupt - status bits, so it is necessary to use the single shared - data/space available FIFO status bits. It is therefore not - an error to get here when there is no data transfer in - progress. */ -+ log_event("IRQD", (u32)host->data, intmask); - if (!host->data) -- return 0; -+ return; - - if (intmask & (SDHSTS_CRC16_ERROR | - SDHSTS_FIFO_ERROR | -@@ -1214,46 +1347,37 @@ static u32 bcm2835_sdhost_data_irq(struct bcm2835_host *host, u32 intmask) - else - host->data->error = -ETIMEDOUT; - -- bcm2835_sdhost_dumpregs(host); -- tasklet_schedule(&host->finish_tasklet); -- return handled; -+ if (host->debug) { -+ log_dump(); -+ bcm2835_sdhost_dumpregs(host); -+ } - } - -- /* Use the block interrupt for writes after the first block */ -- if (host->data->flags & MMC_DATA_WRITE) { -+ if (host->data->error) { -+ bcm2835_sdhost_finish_data(host); -+ } else if (host->data->flags & MMC_DATA_WRITE) { -+ /* Use the block interrupt for writes after the first block */ - host->hcfg &= ~(SDHCFG_DATA_IRPT_EN); - host->hcfg |= SDHCFG_BLOCK_IRPT_EN; - bcm2835_sdhost_write(host, host->hcfg, SDHCFG); -- if (host->data->error) -- bcm2835_sdhost_finish_data(host); -- else -- bcm2835_sdhost_transfer_pio(host); -+ bcm2835_sdhost_transfer_pio(host); - } else { -- if (!host->data->error) { -- bcm2835_sdhost_transfer_pio(host); -- host->blocks--; -- } -+ bcm2835_sdhost_transfer_pio(host); -+ host->blocks--; - if ((host->blocks == 0) || host->data->error) - bcm2835_sdhost_finish_data(host); - } -- -- return handled; - } - --static u32 bcm2835_sdhost_block_irq(struct bcm2835_host *host, u32 intmask) -+static void bcm2835_sdhost_block_irq(struct bcm2835_host *host, u32 intmask) - { -- struct dma_chan *dma_chan; -- u32 dir_data; -- const u32 handled = (SDHSTS_REW_TIME_OUT | -- SDHSTS_CRC16_ERROR | -- SDHSTS_FIFO_ERROR); -- -+ log_event("IRQK", (u32)host->data, intmask); - if (!host->data) { - pr_err("%s: got block interrupt 0x%08x even " - "though no data operation was in progress.\n", - mmc_hostname(host->mmc), (unsigned)intmask); - bcm2835_sdhost_dumpregs(host); -- return handled; -+ return; - } - - if (intmask & (SDHSTS_CRC16_ERROR | -@@ -1265,149 +1389,69 @@ static u32 bcm2835_sdhost_block_irq(struct bcm2835_host *host, u32 intmask) - else - host->data->error = -ETIMEDOUT; - -- if (host->debug) -+ if (host->debug) { -+ log_dump(); - bcm2835_sdhost_dumpregs(host); -- tasklet_schedule(&host->finish_tasklet); -- return handled; -+ } + country_codes = drvr->settings->country_codes; + if (!country_codes) { +- brcmf_dbg(TRACE, "No country codes configured for device\n"); +- return -EINVAL; ++ brcmf_dbg(TRACE, "No country codes configured for device" ++ " - use requested value\n"); ++ goto use_input_value; } -- if (!host->use_dma) { -+ if (!host->dma_desc) { - BUG_ON(!host->blocks); -- host->blocks--; -- if ((host->blocks == 0) || host->data->error) { -- /* Cancel the timer */ -- del_timer(&host->pio_timer); -- -+ if (host->data->error || (--host->blocks == 0)) { - bcm2835_sdhost_finish_data(host); - } else { -- /* Reset the timer */ -- mod_timer(&host->pio_timer, -- jiffies + host->pio_timeout); -- - bcm2835_sdhost_transfer_pio(host); -- -- /* Reset the timer */ -- mod_timer(&host->pio_timer, -- jiffies + host->pio_timeout); - } - } else if (host->data->flags & MMC_DATA_WRITE) { -- dma_chan = host->dma_chan_tx; -- dir_data = DMA_TO_DEVICE; -- dma_unmap_sg(dma_chan->device->dev, -- host->data->sg, host->data->sg_len, -- dir_data); -- - bcm2835_sdhost_finish_data(host); + if ((alpha2[0] == ccreq->country_abbrev[0]) && +@@ -6545,10 +6551,14 @@ static s32 brcmf_translate_country_code(struct brcmf_pub *drvr, char alpha2[2], + brcmf_dbg(TRACE, "No country code match found\n"); + return -EINVAL; } -- -- return handled; - } - -- - static irqreturn_t bcm2835_sdhost_irq(int irq, void *dev_id) - { - irqreturn_t result = IRQ_NONE; - struct bcm2835_host *host = dev_id; -- u32 unexpected = 0, early = 0; -- int loops = 0; -+ u32 intmask; - - spin_lock(&host->lock); - -- for (loops = 0; loops < 1; loops++) { -- u32 intmask, handled; -- -- intmask = bcm2835_sdhost_read(host, SDHSTS); -- handled = intmask & (SDHSTS_BUSY_IRPT | -- SDHSTS_BLOCK_IRPT | -- SDHSTS_SDIO_IRPT | -- SDHSTS_DATA_FLAG); -- if ((handled == SDHSTS_DATA_FLAG) && -- (loops == 0) && !host->data) { -- pr_err("%s: sdhost_irq data interrupt 0x%08x even " -- "though no data operation was in progress.\n", -- mmc_hostname(host->mmc), -- (unsigned)intmask); -- -- bcm2835_sdhost_dumpregs(host); -- } -- -- if (!handled) -- break; -+ intmask = bcm2835_sdhost_read(host, SDHSTS); -+ log_event("IRQ<", intmask, 0); - -- if (loops) -- early |= handled; -+ bcm2835_sdhost_write(host, -+ SDHSTS_BUSY_IRPT | -+ SDHSTS_BLOCK_IRPT | -+ SDHSTS_SDIO_IRPT | -+ SDHSTS_DATA_FLAG, -+ SDHSTS); - -+ if (intmask & SDHSTS_BLOCK_IRPT) { -+ bcm2835_sdhost_block_irq(host, intmask); - result = IRQ_HANDLED; -+ } - -- /* Clear all interrupts and notifications */ -- bcm2835_sdhost_write(host, intmask, SDHSTS); -- -- if (intmask & SDHSTS_BUSY_IRPT) -- handled |= bcm2835_sdhost_busy_irq(host, intmask); -- -- /* There is no true data interrupt status bit, so it is -- necessary to qualify the data flag with the interrupt -- enable bit */ -- if ((intmask & SDHSTS_DATA_FLAG) && -- (host->hcfg & SDHCFG_DATA_IRPT_EN)) -- handled |= bcm2835_sdhost_data_irq(host, intmask); -- -- if (intmask & SDHSTS_BLOCK_IRPT) -- handled |= bcm2835_sdhost_block_irq(host, intmask); -- -- if (intmask & SDHSTS_SDIO_IRPT) { -- bcm2835_sdhost_enable_sdio_irq_nolock(host, false); -- host->thread_isr |= SDHSTS_SDIO_IRPT; -- result = IRQ_WAKE_THREAD; -- } -+ if (intmask & SDHSTS_BUSY_IRPT) { -+ bcm2835_sdhost_busy_irq(host, intmask); -+ result = IRQ_HANDLED; -+ } - -- unexpected |= (intmask & ~handled); -+ /* There is no true data interrupt status bit, so it is -+ necessary to qualify the data flag with the interrupt -+ enable bit */ -+ if ((intmask & SDHSTS_DATA_FLAG) && -+ (host->hcfg & SDHCFG_DATA_IRPT_EN)) { -+ bcm2835_sdhost_data_irq(host, intmask); -+ result = IRQ_HANDLED; +- memset(ccreq, 0, sizeof(*ccreq)); +- ccreq->rev = cpu_to_le32(country_codes->table[found_index].rev); +- memcpy(ccreq->ccode, country_codes->table[found_index].cc, ++ rev = country_codes->table[found_index].rev; ++ memcpy(ccode, country_codes->table[found_index].cc, + BRCMF_COUNTRY_BUF_SZ); ++ ++use_input_value: ++ memset(ccreq, 0, sizeof(*ccreq)); ++ ccreq->rev = cpu_to_le32(rev); ++ memcpy(ccreq->ccode, ccode, sizeof(ccode)); + ccreq->country_abbrev[0] = alpha2[0]; + ccreq->country_abbrev[1] = alpha2[1]; + ccreq->country_abbrev[2] = 0; + +From 57720f476dafd8ad6d218c75d816df912d572d01 Mon Sep 17 00:00:00 2001 +From: Phil Elwell <phil@raspberrypi.org> +Date: Thu, 19 May 2016 15:36:09 +0100 +Subject: [PATCH 092/112] brcmfmac: Plug memory leak in brcmf_fill_bss_param + +See: https://github.com/raspberrypi/linux/issues/1471 + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +index ceba7b6..afb0154 100644 +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +@@ -2413,7 +2413,7 @@ static void brcmf_fill_bss_param(struct brcmf_if *ifp, struct station_info *si) + WL_BSS_INFO_MAX); + if (err) { + brcmf_err("Failed to get bss info (%d)\n", err); +- return; ++ goto out_err; } - - mmiowb(); - -+ log_event("IRQ>", bcm2835_sdhost_read(host, SDHSTS), 0); - spin_unlock(&host->lock); - -- if (early) -- pr_debug("%s: early %x (loops %d)\n", -- mmc_hostname(host->mmc), early, loops); -- -- if (unexpected) { -- pr_err("%s: unexpected interrupt 0x%08x.\n", -- mmc_hostname(host->mmc), unexpected); -- bcm2835_sdhost_dumpregs(host); -- } -- - return result; + si->filled |= BIT(NL80211_STA_INFO_BSS_PARAM); + si->bss_param.beacon_interval = le16_to_cpu(buf->bss_le.beacon_period); +@@ -2425,6 +2425,9 @@ static void brcmf_fill_bss_param(struct brcmf_if *ifp, struct station_info *si) + si->bss_param.flags |= BSS_PARAM_FLAGS_SHORT_PREAMBLE; + if (capability & WLAN_CAPABILITY_SHORT_SLOT_TIME) + si->bss_param.flags |= BSS_PARAM_FLAGS_SHORT_SLOT_TIME; ++ ++out_err: ++ kfree(buf); } --static irqreturn_t bcm2835_sdhost_thread_irq(int irq, void *dev_id) --{ -- struct bcm2835_host *host = dev_id; -- unsigned long flags; -- u32 isr; -- -- spin_lock_irqsave(&host->lock, flags); -- isr = host->thread_isr; -- host->thread_isr = 0; -- spin_unlock_irqrestore(&host->lock, flags); -- -- if (isr & SDHSTS_SDIO_IRPT) { -- sdio_run_irqs(host->mmc); -- --/* Is this necessary? Why re-enable an interrupt which is enabled? -- spin_lock_irqsave(&host->lock, flags); -- if (host->flags & SDHSTS_SDIO_IRPT_ENABLED) -- bcm2835_sdhost_enable_sdio_irq_nolock(host, true); -- spin_unlock_irqrestore(&host->lock, flags); --*/ -- } -- -- return isr ? IRQ_HANDLED : IRQ_NONE; --} -- -- -- - void bcm2835_sdhost_set_clock(struct bcm2835_host *host, unsigned int clock) - { - int div = 0; /* Initialized for compiler warning */ -@@ -1417,9 +1461,8 @@ void bcm2835_sdhost_set_clock(struct bcm2835_host *host, unsigned int clock) - pr_info("%s: set_clock(%d)\n", mmc_hostname(host->mmc), clock); + static s32 + +From b83945eb624ddcfbf5687cbb64b3e502765b8847 Mon Sep 17 00:00:00 2001 +From: Phil Elwell <phil@raspberrypi.org> +Date: Thu, 17 Dec 2015 13:37:07 +0000 +Subject: [PATCH 093/112] hci_h5: Don't send conf_req when ACTIVE + +Without this patch, a modem and kernel can continuously bombard each +other with conf_req and conf_rsp messages, in a demented game of tag. +--- + drivers/bluetooth/hci_h5.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/bluetooth/hci_h5.c b/drivers/bluetooth/hci_h5.c +index 0879d64..5161ab3 100644 +--- a/drivers/bluetooth/hci_h5.c ++++ b/drivers/bluetooth/hci_h5.c +@@ -310,7 +310,8 @@ static void h5_handle_internal_rx(struct hci_uart *hu) + h5_link_control(hu, conf_req, 3); + } else if (memcmp(data, conf_req, 2) == 0) { + h5_link_control(hu, conf_rsp, 2); +- h5_link_control(hu, conf_req, 3); ++ if (h5->state != H5_ACTIVE) ++ h5_link_control(hu, conf_req, 3); + } else if (memcmp(data, conf_rsp, 2) == 0) { + if (H5_HDR_LEN(hdr) > 2) + h5->tx_win = (data[2] & 0x07); + +From b233a26228b7db2f5ce2dcf40cf27c9461661335 Mon Sep 17 00:00:00 2001 +From: Eric Anholt <eric@anholt.net> +Date: Fri, 22 Jan 2016 13:06:39 -0800 +Subject: [PATCH 094/112] drm/vc4: Add a debugfs node for tracking execution + state. + +Signed-off-by: Eric Anholt <eric@anholt.net> +--- + drivers/gpu/drm/vc4/vc4_debugfs.c | 1 + + drivers/gpu/drm/vc4/vc4_drv.h | 1 + + drivers/gpu/drm/vc4/vc4_gem.c | 14 ++++++++++++++ + 3 files changed, 16 insertions(+) + +diff --git a/drivers/gpu/drm/vc4/vc4_debugfs.c b/drivers/gpu/drm/vc4/vc4_debugfs.c +index d76ad10..a99aa86 100644 +--- a/drivers/gpu/drm/vc4/vc4_debugfs.c ++++ b/drivers/gpu/drm/vc4/vc4_debugfs.c +@@ -17,6 +17,7 @@ - if ((host->overclock_50 > 50) && -- (clock == 50*MHZ)) { -+ (clock == 50*MHZ)) - clock = host->overclock_50 * MHZ + (MHZ - 1); -- } + static const struct drm_info_list vc4_debugfs_list[] = { + {"bo_stats", vc4_bo_stats_debugfs, 0}, ++ {"gem_exec", vc4_gem_exec_debugfs, 0}, + {"hdmi_regs", vc4_hdmi_debugfs_regs, 0}, + {"hvs_regs", vc4_hvs_debugfs_regs, 0}, + {"crtc0_regs", vc4_crtc_debugfs_regs, 0, (void *)(uintptr_t)0}, +diff --git a/drivers/gpu/drm/vc4/vc4_drv.h b/drivers/gpu/drm/vc4/vc4_drv.h +index fa2ad15..f092986 100644 +--- a/drivers/gpu/drm/vc4/vc4_drv.h ++++ b/drivers/gpu/drm/vc4/vc4_drv.h +@@ -440,6 +440,7 @@ void vc4_job_handle_completed(struct vc4_dev *vc4); + int vc4_queue_seqno_cb(struct drm_device *dev, + struct vc4_seqno_cb *cb, uint64_t seqno, + void (*func)(struct vc4_seqno_cb *cb)); ++int vc4_gem_exec_debugfs(struct seq_file *m, void *arg); - /* The SDCDIV register has 11 bits, and holds (div - 2). - But in data mode the max is 50MHz wihout a minimum, and only the -@@ -1466,6 +1509,11 @@ void bcm2835_sdhost_set_clock(struct bcm2835_host *host, unsigned int clock) - clock = host->max_clk / (div + 2); - host->mmc->actual_clock = clock; + /* vc4_hdmi.c */ + extern struct platform_driver vc4_hdmi_driver; +diff --git a/drivers/gpu/drm/vc4/vc4_gem.c b/drivers/gpu/drm/vc4/vc4_gem.c +index 8d4384f..aa4517c 100644 +--- a/drivers/gpu/drm/vc4/vc4_gem.c ++++ b/drivers/gpu/drm/vc4/vc4_gem.c +@@ -32,6 +32,20 @@ + #include "vc4_regs.h" + #include "vc4_trace.h" -+ /* Calibrate some delays */ ++#ifdef CONFIG_DEBUG_FS ++int vc4_gem_exec_debugfs(struct seq_file *m, void *unused) ++{ ++ struct drm_info_node *node = (struct drm_info_node *)m->private; ++ struct drm_device *dev = node->minor->dev; ++ struct vc4_dev *vc4 = to_vc4_dev(dev); + -+ host->ns_per_fifo_word = (1000000000/clock) * -+ ((host->mmc->caps & MMC_CAP_4_BIT_DATA) ? 8 : 32); ++ seq_printf(m, "Emitted seqno: 0x%016llx\n", vc4->emit_seqno); ++ seq_printf(m, "Finished seqno: 0x%016llx\n", vc4->finished_seqno); ++ ++ return 0; ++} ++#endif /* CONFIG_DEBUG_FS */ + - if (clock > input_clock) { - /* Save the closest value, to make it easier - to reduce in the event of error */ -@@ -1501,6 +1549,7 @@ static void bcm2835_sdhost_request(struct mmc_host *mmc, struct mmc_request *mrq + static void + vc4_queue_hangcheck(struct drm_device *dev) { - struct bcm2835_host *host; - unsigned long flags; -+ u32 edm, fsm; - - host = mmc_priv(mmc); + +From 9e309d7f765e380b8e707659ab9ed4b182dc22f6 Mon Sep 17 00:00:00 2001 +From: Eric Anholt <eric@anholt.net> +Date: Mon, 25 Jan 2016 13:03:33 -0800 +Subject: [PATCH 095/112] drm/vc4: Include vc4_drm.h in uapi in downstream + build. + +Signed-off-by: Eric Anholt <eric@anholt.net> +--- + include/uapi/drm/Kbuild | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/include/uapi/drm/Kbuild b/include/uapi/drm/Kbuild +index 9355dd8..68828bf 100644 +--- a/include/uapi/drm/Kbuild ++++ b/include/uapi/drm/Kbuild +@@ -15,6 +15,7 @@ header-y += radeon_drm.h + header-y += savage_drm.h + header-y += sis_drm.h + header-y += tegra_drm.h ++header-y += vc4_drm.h + header-y += via_drm.h + header-y += vmwgfx_drm.h + header-y += msm_drm.h + +From 8ebc53b4f06a2076f30f0ec77153af7dcb5d1edb Mon Sep 17 00:00:00 2001 +From: Phil Elwell <phil@raspberrypi.org> +Date: Wed, 30 Mar 2016 17:23:15 +0100 +Subject: [PATCH 096/112] cpufreq: Temporarily ignore io_is_busy=1 + +To speed testing of the new sdhost driver that adapts to changes in +core_freq, hack the on-demand governor to treat io_is_busy=1 as +io_is_busy=0. The io_is_busy feature can still be forced using +io_is_busy=2. + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> +--- + drivers/cpufreq/cpufreq_ondemand.c | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/drivers/cpufreq/cpufreq_ondemand.c b/drivers/cpufreq/cpufreq_ondemand.c +index acd8027..72c5a4c 100644 +--- a/drivers/cpufreq/cpufreq_ondemand.c ++++ b/drivers/cpufreq/cpufreq_ondemand.c +@@ -216,7 +216,12 @@ static ssize_t store_io_is_busy(struct dbs_data *dbs_data, const char *buf, + ret = sscanf(buf, "%u", &input); + if (ret != 1) + return -EINVAL; +- dbs_data->io_is_busy = !!input; ++ // XXX temporary hack ++ if (input > 1) ++ input = 1; ++ else ++ input = 0; ++ dbs_data->io_is_busy = input; -@@ -1521,6 +1570,8 @@ static void bcm2835_sdhost_request(struct mmc_host *mmc, struct mmc_request *mrq - } + /* we need to re-evaluate prev_cpu_idle */ + gov_update_cpu_data(dbs_data); + +From 29509a4b9e47b129d5032bb7c0fdba0a7f9b66b6 Mon Sep 17 00:00:00 2001 +From: popcornmix <popcornmix@gmail.com> +Date: Wed, 27 Apr 2016 16:59:24 +0100 +Subject: [PATCH 097/112] Revert "ASoC: bcm2835: move to use the clock + framework" + +This reverts commit 517e7a1537ae4663268be5d0c0ec62c563b9fc99. +--- + sound/soc/bcm/bcm2835-i2s.c | 284 ++++++++++++++++++++++++++++++++++---------- + 1 file changed, 220 insertions(+), 64 deletions(-) + +diff --git a/sound/soc/bcm/bcm2835-i2s.c b/sound/soc/bcm/bcm2835-i2s.c +index 1c1f221..3303d5f 100644 +--- a/sound/soc/bcm/bcm2835-i2s.c ++++ b/sound/soc/bcm/bcm2835-i2s.c +@@ -37,7 +37,6 @@ + #include <linux/init.h> + #include <linux/io.h> + #include <linux/module.h> +-#include <linux/of_address.h> + #include <linux/slab.h> - /* Reset the error statuses in case this is a retry */ -+ if (mrq->sbc) -+ mrq->sbc->error = 0; - if (mrq->cmd) - mrq->cmd->error = 0; - if (mrq->data) -@@ -1536,28 +1587,58 @@ static void bcm2835_sdhost_request(struct mmc_host *mmc, struct mmc_request *mrq - return; - } + #include <sound/core.h> +@@ -47,6 +46,55 @@ + #include <sound/pcm_params.h> + #include <sound/soc.h> -+ if (host->use_dma && mrq->data && -+ (mrq->data->blocks > host->pio_limit)) -+ bcm2835_sdhost_prepare_dma(host, mrq->data); ++/* Clock registers */ ++#define BCM2835_CLK_PCMCTL_REG 0x00 ++#define BCM2835_CLK_PCMDIV_REG 0x04 ++ ++/* Clock register settings */ ++#define BCM2835_CLK_PASSWD (0x5a000000) ++#define BCM2835_CLK_PASSWD_MASK (0xff000000) ++#define BCM2835_CLK_MASH(v) ((v) << 9) ++#define BCM2835_CLK_FLIP BIT(8) ++#define BCM2835_CLK_BUSY BIT(7) ++#define BCM2835_CLK_KILL BIT(5) ++#define BCM2835_CLK_ENAB BIT(4) ++#define BCM2835_CLK_SRC(v) (v) ++ ++#define BCM2835_CLK_SHIFT (12) ++#define BCM2835_CLK_DIVI(v) ((v) << BCM2835_CLK_SHIFT) ++#define BCM2835_CLK_DIVF(v) (v) ++#define BCM2835_CLK_DIVF_MASK (0xFFF) + - spin_lock_irqsave(&host->lock, flags); - - WARN_ON(host->mrq != NULL); -- - host->mrq = mrq; - -- if (mrq->sbc) -- bcm2835_sdhost_send_command(host, mrq->sbc); -- else -- bcm2835_sdhost_send_command(host, mrq->cmd); -+ edm = bcm2835_sdhost_read(host, SDEDM); -+ fsm = edm & SDEDM_FSM_MASK; - -- mmiowb(); -- spin_unlock_irqrestore(&host->lock, flags); -+ log_event("REQ<", (u32)mrq, edm); -+ if ((fsm != SDEDM_FSM_IDENTMODE) && -+ (fsm != SDEDM_FSM_DATAMODE)) { -+ pr_err("%s: previous command (%d) not complete (EDM %x)\n", -+ mmc_hostname(host->mmc), -+ bcm2835_sdhost_read(host, SDCMD) & SDCMD_CMD_MASK, -+ edm); -+ log_event("REQ!", (u32)mrq, edm); -+ log_dump(); -+ bcm2835_sdhost_dumpregs(host); -+ mrq->cmd->error = -EILSEQ; -+ tasklet_schedule(&host->finish_tasklet); -+ mmiowb(); -+ spin_unlock_irqrestore(&host->lock, flags); -+ return; -+ } - -- if (!mrq->sbc && mrq->cmd->data && host->use_dma) -- /* DMA transfer starts now, PIO starts after irq */ -- bcm2835_sdhost_transfer_dma(host); -+ host->use_sbc = !!mrq->sbc && -+ (host->mrq->data->flags & USE_CMD23_FLAGS); -+ if (host->use_sbc) { -+ if (bcm2835_sdhost_send_command(host, mrq->sbc)) { -+ if (!host->use_busy) -+ bcm2835_sdhost_finish_command(host, &flags); -+ } -+ } else if (bcm2835_sdhost_send_command(host, mrq->cmd)) { -+ if (host->data && host->dma_desc) -+ /* DMA transfer starts now, PIO starts after irq */ -+ bcm2835_sdhost_start_dma(host); - -- if (!host->use_busy) -- bcm2835_sdhost_finish_command(host); --} -+ if (!host->use_busy) -+ bcm2835_sdhost_finish_command(host, &flags); -+ } ++enum { ++ BCM2835_CLK_MASH_0 = 0, ++ BCM2835_CLK_MASH_1, ++ BCM2835_CLK_MASH_2, ++ BCM2835_CLK_MASH_3, ++}; ++ ++enum { ++ BCM2835_CLK_SRC_GND = 0, ++ BCM2835_CLK_SRC_OSC, ++ BCM2835_CLK_SRC_DBG0, ++ BCM2835_CLK_SRC_DBG1, ++ BCM2835_CLK_SRC_PLLA, ++ BCM2835_CLK_SRC_PLLC, ++ BCM2835_CLK_SRC_PLLD, ++ BCM2835_CLK_SRC_HDMI, ++}; ++ ++/* Most clocks are not useable (freq = 0) */ ++static const unsigned int bcm2835_clk_freq[BCM2835_CLK_SRC_HDMI+1] = { ++ [BCM2835_CLK_SRC_GND] = 0, ++ [BCM2835_CLK_SRC_OSC] = 19200000, ++ [BCM2835_CLK_SRC_DBG0] = 0, ++ [BCM2835_CLK_SRC_DBG1] = 0, ++ [BCM2835_CLK_SRC_PLLA] = 0, ++ [BCM2835_CLK_SRC_PLLC] = 0, ++ [BCM2835_CLK_SRC_PLLD] = 500000000, ++ [BCM2835_CLK_SRC_HDMI] = 0, ++}; ++ + /* I2S registers */ + #define BCM2835_I2S_CS_A_REG 0x00 + #define BCM2835_I2S_FIFO_A_REG 0x04 +@@ -110,6 +158,10 @@ + #define BCM2835_I2S_INT_RXR BIT(1) + #define BCM2835_I2S_INT_TXW BIT(0) -+ log_event("CMD ", (u32)mrq->cmd->opcode, -+ mrq->data ? (u32)mrq->data->blksz : 0); -+ mmiowb(); ++/* I2S DMA interface */ ++/* FIXME: Needs IOMMU support */ ++#define BCM2835_VCMMU_SHIFT (0x7E000000 - 0x20000000) + -+ log_event("REQ>", (u32)mrq, 0); -+ spin_unlock_irqrestore(&host->lock, flags); -+} + /* General device struct */ + struct bcm2835_i2s_dev { + struct device *dev; +@@ -117,23 +169,21 @@ struct bcm2835_i2s_dev { + unsigned int fmt; + unsigned int bclk_ratio; + +- struct regmap *i2s_regmap; +- struct clk *clk; +- bool clk_prepared; ++ struct regmap *i2s_regmap; ++ struct regmap *clk_regmap; + }; - static void bcm2835_sdhost_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) + static void bcm2835_i2s_start_clock(struct bcm2835_i2s_dev *dev) { -@@ -1574,6 +1655,8 @@ static void bcm2835_sdhost_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) ++ /* Start the clock if in master mode */ + unsigned int master = dev->fmt & SND_SOC_DAIFMT_MASTER_MASK; - spin_lock_irqsave(&host->lock, flags); +- if (dev->clk_prepared) +- return; +- + switch (master) { + case SND_SOC_DAIFMT_CBS_CFS: + case SND_SOC_DAIFMT_CBS_CFM: +- clk_prepare_enable(dev->clk); +- dev->clk_prepared = true; ++ regmap_update_bits(dev->clk_regmap, BCM2835_CLK_PCMCTL_REG, ++ BCM2835_CLK_PASSWD_MASK | BCM2835_CLK_ENAB, ++ BCM2835_CLK_PASSWD | BCM2835_CLK_ENAB); + break; + default: + break; +@@ -142,9 +192,28 @@ static void bcm2835_i2s_start_clock(struct bcm2835_i2s_dev *dev) -+ log_event("IOS<", ios->clock, 0); + static void bcm2835_i2s_stop_clock(struct bcm2835_i2s_dev *dev) + { +- if (dev->clk_prepared) +- clk_disable_unprepare(dev->clk); +- dev->clk_prepared = false; ++ uint32_t clkreg; ++ int timeout = 1000; ++ ++ /* Stop clock */ ++ regmap_update_bits(dev->clk_regmap, BCM2835_CLK_PCMCTL_REG, ++ BCM2835_CLK_PASSWD_MASK | BCM2835_CLK_ENAB, ++ BCM2835_CLK_PASSWD); ++ ++ /* Wait for the BUSY flag going down */ ++ while (--timeout) { ++ regmap_read(dev->clk_regmap, BCM2835_CLK_PCMCTL_REG, &clkreg); ++ if (!(clkreg & BCM2835_CLK_BUSY)) ++ break; ++ } + - if (!ios->clock || ios->clock != host->clock) { - bcm2835_sdhost_set_clock(host, ios->clock); - host->clock = ios->clock; -@@ -1596,59 +1679,53 @@ static void bcm2835_sdhost_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) - spin_unlock_irqrestore(&host->lock, flags); ++ if (!timeout) { ++ /* KILL the clock */ ++ dev_err(dev->dev, "I2S clock didn't stop. Kill the clock!\n"); ++ regmap_update_bits(dev->clk_regmap, BCM2835_CLK_PCMCTL_REG, ++ BCM2835_CLK_KILL | BCM2835_CLK_PASSWD_MASK, ++ BCM2835_CLK_KILL | BCM2835_CLK_PASSWD); ++ } } --static int bcm2835_sdhost_multi_io_quirk(struct mmc_card *card, -- unsigned int direction, -- u32 blk_pos, int blk_size) -+static struct mmc_host_ops bcm2835_sdhost_ops = { -+ .request = bcm2835_sdhost_request, -+ .set_ios = bcm2835_sdhost_set_ios, -+ .hw_reset = bcm2835_sdhost_reset, -+}; -+ -+static void bcm2835_sdhost_cmd_wait_work(struct work_struct *work) + static void bcm2835_i2s_clear_fifos(struct bcm2835_i2s_dev *dev, +@@ -154,7 +223,8 @@ static void bcm2835_i2s_clear_fifos(struct bcm2835_i2s_dev *dev, + uint32_t syncval; + uint32_t csreg; + uint32_t i2s_active_state; +- bool clk_was_prepared; ++ uint32_t clkreg; ++ uint32_t clk_active_state; + uint32_t off; + uint32_t clr; + +@@ -168,10 +238,15 @@ static void bcm2835_i2s_clear_fifos(struct bcm2835_i2s_dev *dev, + regmap_read(dev->i2s_regmap, BCM2835_I2S_CS_A_REG, &csreg); + i2s_active_state = csreg & (BCM2835_I2S_RXON | BCM2835_I2S_TXON); + ++ regmap_read(dev->clk_regmap, BCM2835_CLK_PCMCTL_REG, &clkreg); ++ clk_active_state = clkreg & BCM2835_CLK_ENAB; ++ + /* Start clock if not running */ +- clk_was_prepared = dev->clk_prepared; +- if (!clk_was_prepared) +- bcm2835_i2s_start_clock(dev); ++ if (!clk_active_state) { ++ regmap_update_bits(dev->clk_regmap, BCM2835_CLK_PCMCTL_REG, ++ BCM2835_CLK_PASSWD_MASK | BCM2835_CLK_ENAB, ++ BCM2835_CLK_PASSWD | BCM2835_CLK_ENAB); ++ } + + /* Stop I2S module */ + regmap_update_bits(dev->i2s_regmap, BCM2835_I2S_CS_A_REG, off, 0); +@@ -205,7 +280,7 @@ static void bcm2835_i2s_clear_fifos(struct bcm2835_i2s_dev *dev, + dev_err(dev->dev, "I2S SYNC error!\n"); + + /* Stop clock if it was not running before */ +- if (!clk_was_prepared) ++ if (!clk_active_state) + bcm2835_i2s_stop_clock(dev); + + /* Restore I2S state */ +@@ -234,9 +309,19 @@ static int bcm2835_i2s_hw_params(struct snd_pcm_substream *substream, + struct snd_soc_dai *dai) { -- /* There is a bug in the host controller hardware that makes -- reading the final sector of the card as part of a multiple read -- problematic. Detect that case and shorten the read accordingly. -- */ - struct bcm2835_host *host; -+ unsigned long flags; - -- host = mmc_priv(card->host); -+ host = container_of(work, struct bcm2835_host, cmd_wait_wq); - -- if (!host->sectors) { -- /* csd.capacity is in weird units - convert to sectors */ -- u32 card_sectors = (card->csd.capacity << (card->csd.read_blkbits - 9)); -- if ((direction == MMC_DATA_READ) && -- ((blk_pos + blk_size) == card_sectors)) -- blk_size--; -- return blk_size; -- } -+ spin_lock_irqsave(&host->lock, flags); + struct bcm2835_i2s_dev *dev = snd_soc_dai_get_drvdata(dai); ++ + unsigned int sampling_rate = params_rate(params); + unsigned int data_length, data_delay, bclk_ratio; + unsigned int ch1pos, ch2pos, mode, format; ++ unsigned int mash = BCM2835_CLK_MASH_1; ++ unsigned int divi, divf, target_frequency; ++ int clk_src = -1; ++ unsigned int master = dev->fmt & SND_SOC_DAIFMT_MASTER_MASK; ++ bool bit_master = (master == SND_SOC_DAIFMT_CBS_CFS ++ || master == SND_SOC_DAIFMT_CBS_CFM); ++ ++ bool frame_master = (master == SND_SOC_DAIFMT_CBS_CFS ++ || master == SND_SOC_DAIFMT_CBM_CFS); + uint32_t csreg; -- if (direction == MMC_DATA_READ) { -- int i; -- int sector; -- for (i = 0; blk_pos > (sector = host->single_read_sectors[i]); i++) -- continue; -+ log_event("CWK<", (u32)host->cmd, (u32)host->mrq); + /* +@@ -258,9 +343,11 @@ static int bcm2835_i2s_hw_params(struct snd_pcm_substream *substream, + switch (params_format(params)) { + case SNDRV_PCM_FORMAT_S16_LE: + data_length = 16; ++ bclk_ratio = 40; + break; + case SNDRV_PCM_FORMAT_S32_LE: + data_length = 32; ++ bclk_ratio = 80; + break; + default: + return -EINVAL; +@@ -269,12 +356,69 @@ static int bcm2835_i2s_hw_params(struct snd_pcm_substream *substream, + /* If bclk_ratio already set, use that one. */ + if (dev->bclk_ratio) + bclk_ratio = dev->bclk_ratio; +- else +- /* otherwise calculate a fitting block ratio */ +- bclk_ratio = 2 * data_length; -- if ((blk_pos + blk_size) > sector) -- blk_size = (blk_pos == sector) ? 1 : (sector - blk_pos); +- /* set target clock rate*/ +- clk_set_rate(dev->clk, sampling_rate * bclk_ratio); + /* -+ * If this tasklet gets rescheduled while running, it will -+ * be run again afterwards but without any active request. ++ * Clock Settings ++ * ++ * The target frequency of the bit clock is ++ * sampling rate * frame length ++ * ++ * Integer mode: ++ * Sampling rates that are multiples of 8000 kHz ++ * can be driven by the oscillator of 19.2 MHz ++ * with an integer divider as long as the frame length ++ * is an integer divider of 19200000/8000=2400 as set up above. ++ * This is no longer possible if the sampling rate ++ * is too high (e.g. 192 kHz), because the oscillator is too slow. ++ * ++ * MASH mode: ++ * For all other sampling rates, it is not possible to ++ * have an integer divider. Approximate the clock ++ * with the MASH module that induces a slight frequency ++ * variance. To minimize that it is best to have the fastest ++ * clock here. That is PLLD with 500 MHz. + */ -+ if (!host->mrq) { -+ spin_unlock_irqrestore(&host->lock, flags); -+ return; - } -- return blk_size; --} - -+ bcm2835_sdhost_finish_command(host, &flags); - --static struct mmc_host_ops bcm2835_sdhost_ops = { -- .request = bcm2835_sdhost_request, -- .set_ios = bcm2835_sdhost_set_ios, -- .enable_sdio_irq = bcm2835_sdhost_enable_sdio_irq, -- .hw_reset = bcm2835_sdhost_reset, -- .multi_io_quirk = bcm2835_sdhost_multi_io_quirk, --}; -+ mmiowb(); ++ target_frequency = sampling_rate * bclk_ratio; ++ clk_src = BCM2835_CLK_SRC_OSC; ++ mash = BCM2835_CLK_MASH_0; ++ ++ if (bcm2835_clk_freq[clk_src] % target_frequency == 0 ++ && bit_master && frame_master) { ++ divi = bcm2835_clk_freq[clk_src] / target_frequency; ++ divf = 0; ++ } else { ++ uint64_t dividend; + -+ log_event("CWK>", (u32)host->cmd, 0); - -+ spin_unlock_irqrestore(&host->lock, flags); -+} - - static void bcm2835_sdhost_tasklet_finish(unsigned long param) - { - struct bcm2835_host *host; - unsigned long flags; - struct mmc_request *mrq; -+ struct dma_chan *terminate_chan = NULL; - - host = (struct bcm2835_host *)param; - - spin_lock_irqsave(&host->lock, flags); - -+ log_event("TSK<", (u32)host->mrq, 0); - /* - * If this tasklet gets rescheduled while running, it will - * be run again afterwards but without any active request. -@@ -1683,11 +1760,23 @@ static void bcm2835_sdhost_tasklet_finish(unsigned long param) - - mmiowb(); - -+ host->dma_desc = NULL; -+ terminate_chan = host->dma_chan; -+ host->dma_chan = NULL; ++ if (!dev->bclk_ratio) { ++ /* ++ * Overwrite bclk_ratio, because the ++ * above trick is not needed or can ++ * not be used. ++ */ ++ bclk_ratio = 2 * data_length; ++ } + - spin_unlock_irqrestore(&host->lock, flags); -- mmc_request_done(host->mmc, mrq); --} - -+ if (terminate_chan) -+ { -+ int err = dmaengine_terminate_all(terminate_chan); -+ if (err) -+ pr_err("%s: failed to terminate DMA (%d)\n", -+ mmc_hostname(host->mmc), err); ++ target_frequency = sampling_rate * bclk_ratio; ++ ++ clk_src = BCM2835_CLK_SRC_PLLD; ++ mash = BCM2835_CLK_MASH_1; ++ ++ dividend = bcm2835_clk_freq[clk_src]; ++ dividend <<= BCM2835_CLK_SHIFT; ++ do_div(dividend, target_frequency); ++ divi = dividend >> BCM2835_CLK_SHIFT; ++ divf = dividend & BCM2835_CLK_DIVF_MASK; + } - -+ mmc_request_done(host->mmc, mrq); -+ log_event("TSK>", (u32)mrq, 0); -+} - - int bcm2835_sdhost_add_host(struct bcm2835_host *host) - { -@@ -1709,10 +1798,10 @@ int bcm2835_sdhost_add_host(struct bcm2835_host *host) - mmc->f_max, mmc->f_min, mmc->max_busy_timeout); - - /* host controller capabilities */ -- mmc->caps |= /* MMC_CAP_SDIO_IRQ |*/ MMC_CAP_4_BIT_DATA | -+ mmc->caps |= - MMC_CAP_SD_HIGHSPEED | MMC_CAP_MMC_HIGHSPEED | - MMC_CAP_NEEDS_POLL | MMC_CAP_HW_RESET | MMC_CAP_ERASE | -- (ALLOW_CMD23 * MMC_CAP_CMD23); -+ ((ALLOW_CMD23_READ|ALLOW_CMD23_WRITE) * MMC_CAP_CMD23); - - spin_lock_init(&host->lock); - -@@ -1722,9 +1811,9 @@ int bcm2835_sdhost_add_host(struct bcm2835_host *host) - pr_err("%s: unable to initialise DMA channels. " - "Falling back to PIO\n", - mmc_hostname(mmc)); -- host->have_dma = false; -+ host->use_dma = false; - } else { -- host->have_dma = true; -+ host->use_dma = true; - - cfg.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; - cfg.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; -@@ -1741,7 +1830,7 @@ int bcm2835_sdhost_add_host(struct bcm2835_host *host) - ret = dmaengine_slave_config(host->dma_chan_rx, &cfg); - } - } else { -- host->have_dma = false; -+ host->use_dma = false; - } - - mmc->max_segs = 128; -@@ -1756,16 +1845,15 @@ int bcm2835_sdhost_add_host(struct bcm2835_host *host) - tasklet_init(&host->finish_tasklet, - bcm2835_sdhost_tasklet_finish, (unsigned long)host); - -- setup_timer(&host->timer, bcm2835_sdhost_timeout, -- (unsigned long)host); -+ INIT_WORK(&host->cmd_wait_wq, bcm2835_sdhost_cmd_wait_work); - -- setup_timer(&host->pio_timer, bcm2835_sdhost_pio_timeout, -+ setup_timer(&host->timer, bcm2835_sdhost_timeout, - (unsigned long)host); - - bcm2835_sdhost_init(host, 0); -- ret = request_threaded_irq(host->irq, bcm2835_sdhost_irq, -- bcm2835_sdhost_thread_irq, -- IRQF_SHARED, mmc_hostname(mmc), host); + -+ ret = request_irq(host->irq, bcm2835_sdhost_irq, 0 /*IRQF_SHARED*/, -+ mmc_hostname(mmc), host); - if (ret) { - pr_err("%s: failed to request IRQ %d: %d\n", - mmc_hostname(mmc), host->irq, ret); -@@ -1776,11 +1864,11 @@ int bcm2835_sdhost_add_host(struct bcm2835_host *host) - mmc_add_host(mmc); - - pio_limit_string[0] = '\0'; -- if (host->have_dma && (host->pio_limit > 0)) -+ if (host->use_dma && (host->pio_limit > 0)) - sprintf(pio_limit_string, " (>%d)", host->pio_limit); - pr_info("%s: %s loaded - DMA %s%s\n", - mmc_hostname(mmc), DRIVER_NAME, -- host->have_dma ? "enabled" : "disabled", -+ host->use_dma ? "enabled" : "disabled", - pio_limit_string); - - return 0; -@@ -1810,8 +1898,11 @@ static int bcm2835_sdhost_probe(struct platform_device *pdev) - mmc->ops = &bcm2835_sdhost_ops; - host = mmc_priv(mmc); - host->mmc = mmc; -+ host->cmd_quick_poll_retries = 0; - host->pio_timeout = msecs_to_jiffies(500); -+ host->pio_limit = 1; - host->max_delay = 1; /* Warn if over 1ms */ -+ host->allow_dma = 1; - spin_lock_init(&host->lock); - - iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0); -@@ -1827,13 +1918,12 @@ static int bcm2835_sdhost_probe(struct platform_device *pdev) - return -ENODEV; - } - host->bus_addr = be32_to_cpup(addr); -+ log_init(iomem->start - host->bus_addr); - pr_debug(" - ioaddr %lx, iomem->start %lx, bus_addr %lx\n", - (unsigned long)host->ioaddr, - (unsigned long)iomem->start, - (unsigned long)host->bus_addr); - -- host->allow_dma = ALLOW_DMA; -- - if (node) { - /* Read any custom properties */ - of_property_read_u32(node, -@@ -1845,16 +1935,17 @@ static int bcm2835_sdhost_probe(struct platform_device *pdev) - of_property_read_u32(node, - "brcm,pio-limit", - &host->pio_limit); -- host->allow_dma = ALLOW_DMA && -+ host->allow_dma = - !of_property_read_bool(node, "brcm,force-pio"); - host->debug = of_property_read_bool(node, "brcm,debug"); -- of_property_read_u32(node, -- "brcm,debug-flags", -- &host->debug_flags); - } - -- if (host->debug_flags) -- dev_err(dev, "debug_flags=%x\n", host->debug_flags); -+ host->dma_chan = NULL; -+ host->dma_desc = NULL; ++ /* Set clock divider */ ++ regmap_write(dev->clk_regmap, BCM2835_CLK_PCMDIV_REG, BCM2835_CLK_PASSWD ++ | BCM2835_CLK_DIVI(divi) ++ | BCM2835_CLK_DIVF(divf)); + -+ /* Formally recognise the other way of disabling DMA */ -+ if (host->pio_limit == 0x7fffffff) -+ host->allow_dma = false; - - if (host->allow_dma) { - if (node) { -@@ -1940,15 +2031,12 @@ static int bcm2835_sdhost_remove(struct platform_device *pdev) - return 0; - } ++ /* Setup clock, but don't start it yet */ ++ regmap_write(dev->clk_regmap, BCM2835_CLK_PCMCTL_REG, BCM2835_CLK_PASSWD ++ | BCM2835_CLK_MASH(mash) ++ | BCM2835_CLK_SRC(clk_src)); -- - static const struct of_device_id bcm2835_sdhost_match[] = { - { .compatible = "brcm,bcm2835-sdhost" }, - { } + /* Setup the frame format */ + format = BCM2835_I2S_CHEN; +@@ -548,7 +692,7 @@ static const struct snd_soc_dai_ops bcm2835_i2s_dai_ops = { + .trigger = bcm2835_i2s_trigger, + .hw_params = bcm2835_i2s_hw_params, + .set_fmt = bcm2835_i2s_set_dai_fmt, +- .set_bclk_ratio = bcm2835_i2s_set_dai_bclk_ratio, ++ .set_bclk_ratio = bcm2835_i2s_set_dai_bclk_ratio }; - MODULE_DEVICE_TABLE(of, bcm2835_sdhost_match); -- -- - static struct platform_driver bcm2835_sdhost_driver = { - .probe = bcm2835_sdhost_probe, - .remove = bcm2835_sdhost_remove, - -From d15e041e838bd735a7ed3eaa5dbff785213baf6d Mon Sep 17 00:00:00 2001 -From: Phil Elwell <phil@raspberrypi.org> -Date: Fri, 12 Feb 2016 15:38:00 +0000 -Subject: [PATCH 150/170] BCM270X_DT: Add dtparams for the SD interface - -Add new base dtparams sd_overclock, sd_force_pio, sd_pio_limit -and sd_debug. ---- - arch/arm/boot/dts/bcm2708-rpi-b-plus.dts | 4 ++++ - arch/arm/boot/dts/bcm2708-rpi-b.dts | 4 ++++ - arch/arm/boot/dts/bcm2708-rpi-cm.dts | 1 - - arch/arm/boot/dts/bcm2708-rpi-cm.dtsi | 13 +++++++++++++ - arch/arm/boot/dts/bcm2708_common.dtsi | 2 ++ - arch/arm/boot/dts/bcm2709-rpi-2-b.dts | 4 ++++ - arch/arm/boot/dts/overlays/README | 11 ++++++++++- - arch/arm/boot/dts/overlays/mmc-overlay.dts | 1 - - arch/arm/boot/dts/overlays/sdhost-overlay.dts | 27 +++++++++++++------------- - arch/arm/boot/dts/overlays/sdtweak-overlay.dts | 14 ++++++------- - 10 files changed, 58 insertions(+), 23 deletions(-) - -diff --git a/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts b/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts -index 2e4df17..d2d6fa0 100644 ---- a/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts -+++ b/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts -@@ -141,5 +141,9 @@ - audio = <&audio>,"status"; - watchdog = <&watchdog>,"status"; - random = <&random>,"status"; -+ sd_overclock = <&sdhost>,"brcm,overclock-50:0"; -+ sd_force_pio = <&sdhost>,"brcm,force-pio?"; -+ sd_pio_limit = <&sdhost>,"brcm,pio-limit:0"; -+ sd_debug = <&sdhost>,"brcm,debug"; - }; - }; -diff --git a/arch/arm/boot/dts/bcm2708-rpi-b.dts b/arch/arm/boot/dts/bcm2708-rpi-b.dts -index 0445b46..d033ee4 100644 ---- a/arch/arm/boot/dts/bcm2708-rpi-b.dts -+++ b/arch/arm/boot/dts/bcm2708-rpi-b.dts -@@ -131,5 +131,9 @@ - audio = <&audio>,"status"; - watchdog = <&watchdog>,"status"; - random = <&random>,"status"; -+ sd_overclock = <&sdhost>,"brcm,overclock-50:0"; -+ sd_force_pio = <&sdhost>,"brcm,force-pio?"; -+ sd_pio_limit = <&sdhost>,"brcm,pio-limit:0"; -+ sd_debug = <&sdhost>,"brcm,debug"; - }; - }; -diff --git a/arch/arm/boot/dts/bcm2708-rpi-cm.dts b/arch/arm/boot/dts/bcm2708-rpi-cm.dts -index 87c1a54..8bcafb41 100755 ---- a/arch/arm/boot/dts/bcm2708-rpi-cm.dts -+++ b/arch/arm/boot/dts/bcm2708-rpi-cm.dts -@@ -97,6 +97,5 @@ - i2c0_baudrate = <&i2c0>,"clock-frequency:0"; - i2c1_baudrate = <&i2c1>,"clock-frequency:0"; - i2c2_baudrate = <&i2c2>,"clock-frequency:0"; -- core_freq = <&clk_core>,"clock-frequency:0"; - }; - }; -diff --git a/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi b/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi -index 3c8bdde..e09e499 100644 ---- a/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi -+++ b/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi -@@ -7,6 +7,13 @@ + static int bcm2835_i2s_dai_probe(struct snd_soc_dai *dai) +@@ -606,14 +750,34 @@ static bool bcm2835_i2s_precious_reg(struct device *dev, unsigned int reg) }; - }; + } -+&gpio { -+ sdhost_pins: sdhost_pins { -+ brcm,pins = <48 49 50 51 52 53>; -+ brcm,function = <4>; /* alt0 */ +-static const struct regmap_config bcm2835_regmap_config = { +- .reg_bits = 32, +- .reg_stride = 4, +- .val_bits = 32, +- .max_register = BCM2835_I2S_GRAY_REG, +- .precious_reg = bcm2835_i2s_precious_reg, +- .volatile_reg = bcm2835_i2s_volatile_reg, +- .cache_type = REGCACHE_RBTREE, ++static bool bcm2835_clk_volatile_reg(struct device *dev, unsigned int reg) ++{ ++ switch (reg) { ++ case BCM2835_CLK_PCMCTL_REG: ++ return true; ++ default: ++ return false; + }; -+}; -+ - &leds { - act_led: act { - label = "led0"; -@@ -29,6 +36,8 @@ - - / { - __overrides__ { -+ core_freq = <&clk_core>,"clock-frequency:0"; ++} + - act_led_gpio = <&act_led>,"gpios:4"; - act_led_activelow = <&act_led>,"gpios:8"; - act_led_trigger = <&act_led>,"linux,default-trigger"; -@@ -36,5 +45,9 @@ - audio = <&audio>,"status"; - watchdog = <&watchdog>,"status"; - random = <&random>,"status"; -+ sd_overclock = <&sdhost>,"brcm,overclock-50:0"; -+ sd_force_pio = <&sdhost>,"brcm,force-pio?"; -+ sd_pio_limit = <&sdhost>,"brcm,pio-limit:0"; -+ sd_debug = <&sdhost>,"brcm,debug"; - }; - }; -diff --git a/arch/arm/boot/dts/bcm2708_common.dtsi b/arch/arm/boot/dts/bcm2708_common.dtsi -index 75fb4ce..18d3c45 100644 ---- a/arch/arm/boot/dts/bcm2708_common.dtsi -+++ b/arch/arm/boot/dts/bcm2708_common.dtsi -@@ -135,6 +135,7 @@ - dmas = <&dma 13>, - <&dma 13>; - dma-names = "tx", "rx"; -+ brcm,overclock-50 = <0>; - brcm,pio-limit = <1>; - status = "disabled"; - }; -@@ -203,6 +204,7 @@ - dmas = <&dma 11>, - <&dma 11>; - dma-names = "tx", "rx"; -+ brcm,overclock-50 = <0>; - status = "disabled"; - }; - -diff --git a/arch/arm/boot/dts/bcm2709-rpi-2-b.dts b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts -index 5206ba2..aca253f 100644 ---- a/arch/arm/boot/dts/bcm2709-rpi-2-b.dts -+++ b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts -@@ -141,5 +141,9 @@ - audio = <&audio>,"status"; - watchdog = <&watchdog>,"status"; - random = <&random>,"status"; -+ sd_overclock = <&sdhost>,"brcm,overclock-50:0"; -+ sd_force_pio = <&sdhost>,"brcm,force-pio?"; -+ sd_pio_limit = <&sdhost>,"brcm,pio-limit:0"; -+ sd_debug = <&sdhost>,"brcm,debug"; - }; ++static const struct regmap_config bcm2835_regmap_config[] = { ++ { ++ .reg_bits = 32, ++ .reg_stride = 4, ++ .val_bits = 32, ++ .max_register = BCM2835_I2S_GRAY_REG, ++ .precious_reg = bcm2835_i2s_precious_reg, ++ .volatile_reg = bcm2835_i2s_volatile_reg, ++ .cache_type = REGCACHE_RBTREE, ++ }, ++ { ++ .reg_bits = 32, ++ .reg_stride = 4, ++ .val_bits = 32, ++ .max_register = BCM2835_CLK_PCMDIV_REG, ++ .volatile_reg = bcm2835_clk_volatile_reg, ++ .cache_type = REGCACHE_RBTREE, ++ }, }; -diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README -index f987565..0a2df01 100644 ---- a/arch/arm/boot/dts/overlays/README -+++ b/arch/arm/boot/dts/overlays/README -@@ -112,6 +112,16 @@ Params: - random Set to "on" to enable the hardware random - number generator (default "on") -+ sd_overclock Clock (in MHz) to use when the MMC framework -+ requests 50MHz -+ -+ sd_force_pio Disable DMA support for SD driver (default off) + static const struct snd_soc_component_driver bcm2835_i2s_component = { +@@ -623,50 +787,42 @@ static const struct snd_soc_component_driver bcm2835_i2s_component = { + static int bcm2835_i2s_probe(struct platform_device *pdev) + { + struct bcm2835_i2s_dev *dev; ++ int i; + int ret; +- struct resource *mem; +- void __iomem *base; +- const __be32 *addr; +- dma_addr_t dma_base; ++ struct regmap *regmap[2]; ++ struct resource *mem[2]; + -+ sd_pio_limit Number of blocks above which to use DMA for -+ SD card (default 1) ++ /* Request both ioareas */ ++ for (i = 0; i <= 1; i++) { ++ void __iomem *base; + -+ sd_debug Enable debug output from SD driver (default off) ++ mem[i] = platform_get_resource(pdev, IORESOURCE_MEM, i); ++ base = devm_ioremap_resource(&pdev->dev, mem[i]); ++ if (IS_ERR(base)) ++ return PTR_ERR(base); + - uart0 Set to "off" to disable uart0 (default "on") ++ regmap[i] = devm_regmap_init_mmio(&pdev->dev, base, ++ &bcm2835_regmap_config[i]); ++ if (IS_ERR(regmap[i])) ++ return PTR_ERR(regmap[i]); ++ } - watchdog Set to "on" to enable the hardware watchdog -@@ -443,7 +453,6 @@ Info: Selects the bcm2835-mmc SD/MMC driver, optionally with overclock - Load: dtoverlay=mmc,<param>=<val> - Params: overclock_50 Clock (in MHz) to use when the MMC framework - requests 50MHz -- force_pio Disable DMA support + dev = devm_kzalloc(&pdev->dev, sizeof(*dev), + GFP_KERNEL); + if (!dev) + return -ENOMEM; +- /* get the clock */ +- dev->clk_prepared = false; +- dev->clk = devm_clk_get(&pdev->dev, NULL); +- if (IS_ERR(dev->clk)) { +- dev_err(&pdev->dev, "could not get clk: %ld\n", +- PTR_ERR(dev->clk)); +- return PTR_ERR(dev->clk); +- } +- +- /* Request ioarea */ +- mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); +- base = devm_ioremap_resource(&pdev->dev, mem); +- if (IS_ERR(base)) +- return PTR_ERR(base); +- +- dev->i2s_regmap = devm_regmap_init_mmio(&pdev->dev, base, +- &bcm2835_regmap_config); +- if (IS_ERR(dev->i2s_regmap)) +- return PTR_ERR(dev->i2s_regmap); +- +- /* Set the DMA address - we have to parse DT ourselves */ +- addr = of_get_address(pdev->dev.of_node, 0, NULL, NULL); +- if (!addr) { +- dev_err(&pdev->dev, "could not get DMA-register address\n"); +- return -EINVAL; +- } +- dma_base = be32_to_cpup(addr); ++ dev->i2s_regmap = regmap[0]; ++ dev->clk_regmap = regmap[1]; - Name: mz61581 -diff --git a/arch/arm/boot/dts/overlays/mmc-overlay.dts b/arch/arm/boot/dts/overlays/mmc-overlay.dts -index 00a22be..d32b02c 100644 ---- a/arch/arm/boot/dts/overlays/mmc-overlay.dts -+++ b/arch/arm/boot/dts/overlays/mmc-overlay.dts -@@ -34,6 +34,5 @@ ++ /* Set the DMA address */ + dev->dma_data[SNDRV_PCM_STREAM_PLAYBACK].addr = +- dma_base + BCM2835_I2S_FIFO_A_REG; ++ (dma_addr_t)mem[0]->start + BCM2835_I2S_FIFO_A_REG ++ + BCM2835_VCMMU_SHIFT; - __overrides__ { - overclock_50 = <&frag0>,"brcm,overclock-50:0"; -- force_pio = <&frag0>,"brcm,force-pio?"; - }; - }; -diff --git a/arch/arm/boot/dts/overlays/sdhost-overlay.dts b/arch/arm/boot/dts/overlays/sdhost-overlay.dts -index dbe6574..a431177 100644 ---- a/arch/arm/boot/dts/overlays/sdhost-overlay.dts -+++ b/arch/arm/boot/dts/overlays/sdhost-overlay.dts -@@ -1,19 +1,14 @@ - /dts-v1/; - /plugin/; + dev->dma_data[SNDRV_PCM_STREAM_CAPTURE].addr = +- dma_base + BCM2835_I2S_FIFO_A_REG; ++ (dma_addr_t)mem[0]->start + BCM2835_I2S_FIFO_A_REG ++ + BCM2835_VCMMU_SHIFT; -+/* Provide backwards compatible aliases for the old sdhost dtparams. */ -+ - /{ - compatible = "brcm,bcm2708"; + /* Set the bus width */ + dev->dma_data[SNDRV_PCM_STREAM_PLAYBACK].addr_width = + +From d62af4b3c919fa6330797345e0304d1d0d85e98f Mon Sep 17 00:00:00 2001 +From: Matthias Reichl <hias@horus.com> +Date: Sun, 11 Oct 2015 16:44:05 +0200 +Subject: [PATCH 098/112] bcm2835-i2s: get base address for DMA from devicetree + +Code copied from spi-bcm2835. Get physical address from devicetree +instead of using hardcoded constant. + +Signed-off-by: Matthias Reichl <hias@horus.com> +--- + sound/soc/bcm/bcm2835-i2s.c | 20 ++++++++++++-------- + 1 file changed, 12 insertions(+), 8 deletions(-) + +diff --git a/sound/soc/bcm/bcm2835-i2s.c b/sound/soc/bcm/bcm2835-i2s.c +index 3303d5f..0f25db4 100644 +--- a/sound/soc/bcm/bcm2835-i2s.c ++++ b/sound/soc/bcm/bcm2835-i2s.c +@@ -38,6 +38,7 @@ + #include <linux/io.h> + #include <linux/module.h> + #include <linux/slab.h> ++#include <linux/of_address.h> - fragment@0 { -- target = <&mmc>; -- __overlay__ { -- status = "disabled"; -- }; -- }; -- -- fragment@1 { - target = <&sdhost>; -- frag1: __overlay__ { -+ frag0: __overlay__ { - brcm,overclock-50 = <0>; - brcm,pio-limit = <1>; - brcm,debug-flags = <0>; -@@ -21,11 +16,17 @@ - }; - }; + #include <sound/core.h> + #include <sound/dmaengine_pcm.h> +@@ -158,10 +159,6 @@ static const unsigned int bcm2835_clk_freq[BCM2835_CLK_SRC_HDMI+1] = { + #define BCM2835_I2S_INT_RXR BIT(1) + #define BCM2835_I2S_INT_TXW BIT(0) -+ fragment@1 { -+ target = <&mmc>; -+ __overlay__ { -+ status = "disabled"; -+ }; -+ }; +-/* I2S DMA interface */ +-/* FIXME: Needs IOMMU support */ +-#define BCM2835_VCMMU_SHIFT (0x7E000000 - 0x20000000) +- + /* General device struct */ + struct bcm2835_i2s_dev { + struct device *dev; +@@ -791,6 +788,15 @@ static int bcm2835_i2s_probe(struct platform_device *pdev) + int ret; + struct regmap *regmap[2]; + struct resource *mem[2]; ++ const __be32 *addr; ++ dma_addr_t dma_reg_base; + - __overrides__ { -- overclock_50 = <&frag1>,"brcm,overclock-50:0"; -- force_pio = <&frag1>,"brcm,force-pio?"; -- pio_limit = <&frag1>,"brcm,pio-limit:0"; -- debug = <&frag1>,"brcm,debug?"; -- debug_flags = <&frag1>,"brcm,debug-flags:0"; -+ overclock_50 = <&frag0>,"brcm,overclock-50:0"; -+ force_pio = <&frag0>,"brcm,force-pio?"; -+ pio_limit = <&frag0>,"brcm,pio-limit:0"; -+ debug = <&frag0>,"brcm,debug?"; - }; - }; -diff --git a/arch/arm/boot/dts/overlays/sdtweak-overlay.dts b/arch/arm/boot/dts/overlays/sdtweak-overlay.dts -index b0b208c..e4a4677 100644 ---- a/arch/arm/boot/dts/overlays/sdtweak-overlay.dts -+++ b/arch/arm/boot/dts/overlays/sdtweak-overlay.dts -@@ -1,23 +1,23 @@ - /dts-v1/; - /plugin/; ++ addr = of_get_address(pdev->dev.of_node, 0, NULL, NULL); ++ if (!addr) { ++ dev_err(&pdev->dev, "could not get DMA-register address\n"); ++ return -ENODEV; ++ } ++ dma_reg_base = be32_to_cpup(addr); -+/* Provide backwards compatible aliases for the old sdhost dtparams. */ -+ - /{ - compatible = "brcm,bcm2708"; + /* Request both ioareas */ + for (i = 0; i <= 1; i++) { +@@ -817,12 +823,10 @@ static int bcm2835_i2s_probe(struct platform_device *pdev) - fragment@0 { - target = <&sdhost>; -- frag1: __overlay__ { -+ frag0: __overlay__ { - brcm,overclock-50 = <0>; - brcm,pio-limit = <1>; -- brcm,debug-flags = <0>; - }; - }; + /* Set the DMA address */ + dev->dma_data[SNDRV_PCM_STREAM_PLAYBACK].addr = +- (dma_addr_t)mem[0]->start + BCM2835_I2S_FIFO_A_REG +- + BCM2835_VCMMU_SHIFT; ++ dma_reg_base + BCM2835_I2S_FIFO_A_REG; - __overrides__ { -- overclock_50 = <&frag1>,"brcm,overclock-50:0"; -- force_pio = <&frag1>,"brcm,force-pio?"; -- pio_limit = <&frag1>,"brcm,pio-limit:0"; -- debug = <&frag1>,"brcm,debug?"; -- debug_flags = <&frag1>,"brcm,debug-flags:0"; -+ overclock_50 = <&frag0>,"brcm,overclock-50:0"; -+ force_pio = <&frag0>,"brcm,force-pio?"; -+ pio_limit = <&frag0>,"brcm,pio-limit:0"; -+ debug = <&frag0>,"brcm,debug?"; - }; - }; + dev->dma_data[SNDRV_PCM_STREAM_CAPTURE].addr = +- (dma_addr_t)mem[0]->start + BCM2835_I2S_FIFO_A_REG +- + BCM2835_VCMMU_SHIFT; ++ dma_reg_base + BCM2835_I2S_FIFO_A_REG; + + /* Set the bus width */ + dev->dma_data[SNDRV_PCM_STREAM_PLAYBACK].addr_width = -From bc7400cadff6bf33451b124eac2e8bf80ebb0197 Mon Sep 17 00:00:00 2001 -From: popcornmix <popcornmix@gmail.com> -Date: Fri, 12 Feb 2016 14:50:25 +0000 -Subject: [PATCH 151/170] dcw_otg: trim xfer length when buffer larger than - allocated size is received +From 8a02cd06b98460363d598c1df1a92b05b4dc1ad5 Mon Sep 17 00:00:00 2001 +From: Matthias Reichl <hias@horus.com> +Date: Sun, 11 Oct 2015 15:21:16 +0200 +Subject: [PATCH 099/112] bcm2835-i2s: add 24bit support, update bclk_ratio to + more correct values ---- - drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c | 11 +++++++++++ - 1 file changed, 11 insertions(+) +Code ported from bcm2708-i2s driver in Raspberry Pi tree. -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c b/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c -index 8db3dfc..d672a76 100644 ---- a/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c -+++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c -@@ -737,6 +737,11 @@ static int update_urb_state_xfer_comp(dwc_hc_t * hc, - DWC_OTG_HC_XFER_COMPLETE, - &short_read); - -+ if (urb->actual_length + xfer_length > urb->length) { -+ DWC_WARN("%s(): trimming xfer length\n", __func__); -+ xfer_length = urb->length - urb->actual_length; -+ } -+ - /* non DWORD-aligned buffer case handling. */ - if (hc->align_buff && xfer_length && hc->ep_is_in) { - dwc_memcpy(urb->buf + urb->actual_length, hc->qh->dw_align_buf, -@@ -1423,6 +1428,12 @@ static void update_urb_state_xfer_intr(dwc_hc_t * hc, - { - uint32_t bytes_transferred = get_actual_xfer_length(hc, hc_regs, qtd, - halt_status, NULL); -+ -+ if (urb->actual_length + bytes_transferred > urb->length) { -+ DWC_WARN("%s(): trimming xfer length\n", __func__); -+ bytes_transferred = urb->length - urb->actual_length; -+ } -+ - /* non DWORD-aligned buffer case handling. */ - if (hc->align_buff && bytes_transferred && hc->ep_is_in) { - dwc_memcpy(urb->buf + urb->actual_length, hc->qh->dw_align_buf, +RPi commit 62c05a0b5328d9376d39c9e74da10b8a2465c234 ("ASoC: BCM2708: +Add 24 bit support") -From f395ff998f2bde846499b1a0ef84519989dc2d4e Mon Sep 17 00:00:00 2001 -From: Phil Elwell <phil@raspberrypi.org> -Date: Mon, 15 Feb 2016 10:00:27 +0000 -Subject: [PATCH 152/170] bcm2835-sdhost: Restore ATOMIC flag to PIO sg mapping +This adds 24 bit support to the I2S driver of the BCM2708. +Besides enabling the 24 bit flags, it includes two bug fixes: -Allocation problems have been seen in a wireless driver, and -this is the only change which might have been responsible. +MMAP is not supported. Claiming this leads to strange issues +when the format of driver and file do not match. + +The datasheet states that the width extension bit should be set +for widths greater than 24, but greater or equal would be correct. +This follows from the definition of the width field. + +Signed-off-by: Florian Meier <florian.meier@koalo.de> + +RPi commit 3e8c672bc4e92d457aa4654bbb4cfd79a18a2327 ("bcm2708-i2s: +Update bclk_ratio to more correct values") + +Discussion about blck_ratio affecting sound quality: +https://github.com/raspberrypi/linux/issues/681 + +Signed-off-by: Matthias Reichl <hias@horus.com> --- - drivers/mmc/host/bcm2835-sdhost.c | 7 +++---- - 1 file changed, 3 insertions(+), 4 deletions(-) + sound/soc/bcm/bcm2835-i2s.c | 12 +++++++++--- + 1 file changed, 9 insertions(+), 3 deletions(-) -diff --git a/drivers/mmc/host/bcm2835-sdhost.c b/drivers/mmc/host/bcm2835-sdhost.c -index 262180b..d66385c 100644 ---- a/drivers/mmc/host/bcm2835-sdhost.c -+++ b/drivers/mmc/host/bcm2835-sdhost.c -@@ -874,15 +874,14 @@ static void bcm2835_sdhost_prepare_data(struct bcm2835_host *host, struct mmc_co - host->flush_fifo = 0; - host->data->bytes_xfered = 0; +diff --git a/sound/soc/bcm/bcm2835-i2s.c b/sound/soc/bcm/bcm2835-i2s.c +index 0f25db4..0f35d7c 100644 +--- a/sound/soc/bcm/bcm2835-i2s.c ++++ b/sound/soc/bcm/bcm2835-i2s.c +@@ -340,11 +340,15 @@ static int bcm2835_i2s_hw_params(struct snd_pcm_substream *substream, + switch (params_format(params)) { + case SNDRV_PCM_FORMAT_S16_LE: + data_length = 16; +- bclk_ratio = 40; ++ bclk_ratio = 50; ++ break; ++ case SNDRV_PCM_FORMAT_S24_LE: ++ data_length = 24; ++ bclk_ratio = 50; + break; + case SNDRV_PCM_FORMAT_S32_LE: + data_length = 32; +- bclk_ratio = 80; ++ bclk_ratio = 100; + break; + default: + return -EINVAL; +@@ -420,7 +424,7 @@ static int bcm2835_i2s_hw_params(struct snd_pcm_substream *substream, + /* Setup the frame format */ + format = BCM2835_I2S_CHEN; -- - if (!host->dma_desc) { - /* Use PIO */ -- int flags; -+ int flags = SG_MITER_ATOMIC; +- if (data_length > 24) ++ if (data_length >= 24) + format |= BCM2835_I2S_CHWEX; - if (data->flags & MMC_DATA_READ) -- flags = SG_MITER_TO_SG; -+ flags |= SG_MITER_TO_SG; - else -- flags = SG_MITER_FROM_SG; -+ flags |= SG_MITER_FROM_SG; - sg_miter_start(&host->sg_miter, data->sg, data->sg_len, flags); - host->blocks = data->blocks; - } + format |= BCM2835_I2S_CHWID((data_length-8)&0xf); +@@ -711,6 +715,7 @@ static struct snd_soc_dai_driver bcm2835_i2s_dai = { + .channels_max = 2, + .rates = SNDRV_PCM_RATE_8000_192000, + .formats = SNDRV_PCM_FMTBIT_S16_LE ++ | SNDRV_PCM_FMTBIT_S24_LE + | SNDRV_PCM_FMTBIT_S32_LE + }, + .capture = { +@@ -718,6 +723,7 @@ static struct snd_soc_dai_driver bcm2835_i2s_dai = { + .channels_max = 2, + .rates = SNDRV_PCM_RATE_8000_192000, + .formats = SNDRV_PCM_FMTBIT_S16_LE ++ | SNDRV_PCM_FMTBIT_S24_LE + | SNDRV_PCM_FMTBIT_S32_LE + }, + .ops = &bcm2835_i2s_dai_ops, -From d2943c4ee1c52cb2c9802be194ca90442e4fe34f Mon Sep 17 00:00:00 2001 -From: Phil Elwell <phil@raspberrypi.org> -Date: Tue, 16 Feb 2016 08:47:56 +0000 -Subject: [PATCH 153/170] Revert "Add blk_pos parameter to mmc multi_io_quirk - callback" +From c7032249121b5eb95cfeb1812782c204810dc939 Mon Sep 17 00:00:00 2001 +From: Matthias Reichl <hias@horus.com> +Date: Sun, 11 Oct 2015 15:25:51 +0200 +Subject: [PATCH 100/112] bcm2835-i2s: setup clock only if CPU is clock master -This reverts commit aab95f9b10e8c3d32de2bf163b86f220c88214fe. +Code ported from bcm2708-i2s driver in Raspberry Pi tree. + +RPi commit c14827ecdaa36607f6110f9ce8df96e698672191 ("bcm2708: Allow +option card devices to be configured via DT") -The bcm2835-sdhost driver no longer needs this patch. +Original work by Zoltan Szenczi, committed to RPi tree by +Phil Elwell. + +Signed-off-by: Matthias Reichl <hias@horus.com> --- - drivers/mmc/card/block.c | 1 - - drivers/mmc/host/omap_hsmmc.c | 4 +--- - drivers/mmc/host/sh_mobile_sdhi.c | 4 +--- - drivers/mmc/host/tmio_mmc_pio.c | 4 +--- - include/linux/mmc/host.h | 4 +--- - 5 files changed, 4 insertions(+), 13 deletions(-) + sound/soc/bcm/bcm2835-i2s.c | 28 +++++++++++++++++++--------- + 1 file changed, 19 insertions(+), 9 deletions(-) -diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c -index b35f0c4..d848616 100644 ---- a/drivers/mmc/card/block.c -+++ b/drivers/mmc/card/block.c -@@ -1510,7 +1510,6 @@ static void mmc_blk_rw_rq_prep(struct mmc_queue_req *mqrq, - brq->data.blocks = card->host->ops->multi_io_quirk(card, - (rq_data_dir(req) == READ) ? - MMC_DATA_READ : MMC_DATA_WRITE, -- blk_rq_pos(req), - brq->data.blocks); +diff --git a/sound/soc/bcm/bcm2835-i2s.c b/sound/soc/bcm/bcm2835-i2s.c +index 0f35d7c..d5e4123 100644 +--- a/sound/soc/bcm/bcm2835-i2s.c ++++ b/sound/soc/bcm/bcm2835-i2s.c +@@ -411,15 +411,25 @@ static int bcm2835_i2s_hw_params(struct snd_pcm_substream *substream, + divf = dividend & BCM2835_CLK_DIVF_MASK; } -diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c -index 708d0fa..7fb0753 100644 ---- a/drivers/mmc/host/omap_hsmmc.c -+++ b/drivers/mmc/host/omap_hsmmc.c -@@ -1832,9 +1832,7 @@ static void omap_hsmmc_conf_bus_power(struct omap_hsmmc_host *host) - } - - static int omap_hsmmc_multi_io_quirk(struct mmc_card *card, -- unsigned int direction, -- u32 blk_pos, -- int blk_size) -+ unsigned int direction, int blk_size) - { - /* This controller can't do multiblock reads due to hw bugs */ - if (direction == MMC_DATA_READ) -diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c -index 4f1ccf3..354f4f3 100644 ---- a/drivers/mmc/host/sh_mobile_sdhi.c -+++ b/drivers/mmc/host/sh_mobile_sdhi.c -@@ -170,9 +170,7 @@ static int sh_mobile_sdhi_write16_hook(struct tmio_mmc_host *host, int addr) - } - - static int sh_mobile_sdhi_multi_io_quirk(struct mmc_card *card, -- unsigned int direction, -- u32 blk_pos, -- int blk_size) -+ unsigned int direction, int blk_size) - { - /* - * In Renesas controllers, when performing a -diff --git a/drivers/mmc/host/tmio_mmc_pio.c b/drivers/mmc/host/tmio_mmc_pio.c -index 7b730d8..a10fde4 100644 ---- a/drivers/mmc/host/tmio_mmc_pio.c -+++ b/drivers/mmc/host/tmio_mmc_pio.c -@@ -1003,9 +1003,7 @@ static int tmio_mmc_get_ro(struct mmc_host *mmc) - } - - static int tmio_multi_io_quirk(struct mmc_card *card, -- unsigned int direction, -- u32 blk_pos, -- int blk_size) -+ unsigned int direction, int blk_size) - { - struct tmio_mmc_host *host = mmc_priv(card->host); +- /* Set clock divider */ +- regmap_write(dev->clk_regmap, BCM2835_CLK_PCMDIV_REG, BCM2835_CLK_PASSWD +- | BCM2835_CLK_DIVI(divi) +- | BCM2835_CLK_DIVF(divf)); +- +- /* Setup clock, but don't start it yet */ +- regmap_write(dev->clk_regmap, BCM2835_CLK_PCMCTL_REG, BCM2835_CLK_PASSWD +- | BCM2835_CLK_MASH(mash) +- | BCM2835_CLK_SRC(clk_src)); ++ /* Clock should only be set up here if CPU is clock master */ ++ switch (dev->fmt & SND_SOC_DAIFMT_MASTER_MASK) { ++ case SND_SOC_DAIFMT_CBS_CFS: ++ case SND_SOC_DAIFMT_CBS_CFM: ++ /* Set clock divider */ ++ regmap_write(dev->clk_regmap, BCM2835_CLK_PCMDIV_REG, ++ BCM2835_CLK_PASSWD ++ | BCM2835_CLK_DIVI(divi) ++ | BCM2835_CLK_DIVF(divf)); ++ ++ /* Setup clock, but don't start it yet */ ++ regmap_write(dev->clk_regmap, BCM2835_CLK_PCMCTL_REG, ++ BCM2835_CLK_PASSWD ++ | BCM2835_CLK_MASH(mash) ++ | BCM2835_CLK_SRC(clk_src)); ++ break; ++ default: ++ break; ++ } -diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h -index 105b3e6..ad22ebb 100644 ---- a/include/linux/mmc/host.h -+++ b/include/linux/mmc/host.h -@@ -143,9 +143,7 @@ struct mmc_host_ops { - * I/O. Returns the number of supported blocks for the request. - */ - int (*multi_io_quirk)(struct mmc_card *card, -- unsigned int direction, -- u32 blk_pos, -- int blk_size); -+ unsigned int direction, int blk_size); + /* Setup the frame format */ + format = BCM2835_I2S_CHEN; + +From 1fcff3b17e19175b7fc986f868ac4209abc5a71d Mon Sep 17 00:00:00 2001 +From: Matthias Reichl <hias@horus.com> +Date: Sun, 11 Oct 2015 15:49:51 +0200 +Subject: [PATCH 101/112] bcm2835-i2s: Eliminate debugfs directory error + +Code ported from bcm2708-i2s driver in Raspberry Pi tree. + +RPi commit fd7d7a3dbe9262d16971ef81c234ed28c6499dd7 ("bcm2708: +Eliminate i2s debugfs directory error") + +Qualify the two regmap ranges uses by bcm2708-i2s ('-i2s' and '-clk') +to avoid the name clash when registering debugfs entries. + +Signed-off-by: Matthias Reichl <hias@horus.com> +--- + sound/soc/bcm/bcm2835-i2s.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/sound/soc/bcm/bcm2835-i2s.c b/sound/soc/bcm/bcm2835-i2s.c +index d5e4123..2d29050 100644 +--- a/sound/soc/bcm/bcm2835-i2s.c ++++ b/sound/soc/bcm/bcm2835-i2s.c +@@ -782,6 +782,7 @@ static const struct regmap_config bcm2835_regmap_config[] = { + .precious_reg = bcm2835_i2s_precious_reg, + .volatile_reg = bcm2835_i2s_volatile_reg, + .cache_type = REGCACHE_RBTREE, ++ .name = "i2s", + }, + { + .reg_bits = 32, +@@ -790,6 +791,7 @@ static const struct regmap_config bcm2835_regmap_config[] = { + .max_register = BCM2835_CLK_PCMDIV_REG, + .volatile_reg = bcm2835_clk_volatile_reg, + .cache_type = REGCACHE_RBTREE, ++ .name = "clk", + }, }; - struct mmc_card; -From ee83592659ae5dc5ceee63790a8cba57ebfa57b3 Mon Sep 17 00:00:00 2001 -From: Craig Roberts <cjr@craigroberts.net> -Date: Tue, 16 Feb 2016 10:03:42 +0000 -Subject: [PATCH 154/170] Updated smsc95xx driver to check for a valid MAC - address in eeprom before using smsc95xx.macaddr parameter passed on command - line. +From 46931a1a476d1f1deb4dd654305a911e720bda21 Mon Sep 17 00:00:00 2001 +From: Matthias Reichl <hias@horus.com> +Date: Sun, 11 Oct 2015 15:35:20 +0200 +Subject: [PATCH 102/112] bcm2835-i2s: Register PCM device + +Code ported from bcm2708-i2s driver in Raspberry Pi tree. + +RPi commit ba46b4935a23aa2caac1855ead52a035d4776680 ("ASoC: Add +support for BCM2708") + +This driver adds support for digital audio (I2S) +for the BCM2708 SoC that is used by the +Raspberry Pi. External audio codecs can be +connected to the Raspberry Pi via P5 header. + +It relies on cyclic DMA engine support for BCM2708. + +Signed-off-by: Florian Meier <florian.meier@koalo.de> -The built-in RPi adaptor will still get a MAC address based on the parameter passed on the command line as the RPi hardware does not have an eeprom, -however usb->ethernet adaptors using the same driver should have an eeprom with MAC address as part of their hardware and therefore will use this -meaning they don't end up with the same MAC address as the built-in RPi adaptor. +Signed-off-by: Matthias Reichl <hias@horus.com> --- - drivers/net/usb/smsc95xx.c | 10 +++++----- - 1 file changed, 5 insertions(+), 5 deletions(-) + sound/soc/bcm/bcm2835-i2s.c | 23 ++++++++++++++++++++++- + 1 file changed, 22 insertions(+), 1 deletion(-) -diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c -index 3244a90..7483222 100755 ---- a/drivers/net/usb/smsc95xx.c -+++ b/drivers/net/usb/smsc95xx.c -@@ -817,10 +817,6 @@ static int smsc95xx_is_macaddr_param(struct usbnet *dev, u8 *dev_mac) +diff --git a/sound/soc/bcm/bcm2835-i2s.c b/sound/soc/bcm/bcm2835-i2s.c +index 2d29050..ce93ef0 100644 +--- a/sound/soc/bcm/bcm2835-i2s.c ++++ b/sound/soc/bcm/bcm2835-i2s.c +@@ -799,6 +799,25 @@ static const struct snd_soc_component_driver bcm2835_i2s_component = { + .name = "bcm2835-i2s-comp", + }; - static void smsc95xx_init_mac_address(struct usbnet *dev) ++static const struct snd_pcm_hardware bcm2835_pcm_hardware = { ++ .info = SNDRV_PCM_INFO_INTERLEAVED | ++ SNDRV_PCM_INFO_JOINT_DUPLEX, ++ .formats = SNDRV_PCM_FMTBIT_S16_LE | ++ SNDRV_PCM_FMTBIT_S24_LE | ++ SNDRV_PCM_FMTBIT_S32_LE, ++ .period_bytes_min = 32, ++ .period_bytes_max = 64 * PAGE_SIZE, ++ .periods_min = 2, ++ .periods_max = 255, ++ .buffer_bytes_max = 128 * PAGE_SIZE, ++}; ++ ++static const struct snd_dmaengine_pcm_config bcm2835_dmaengine_pcm_config = { ++ .prepare_slave_config = snd_dmaengine_pcm_prepare_slave_config, ++ .pcm_hardware = &bcm2835_pcm_hardware, ++ .prealloc_buffer_size = 256 * PAGE_SIZE, ++}; ++ + static int bcm2835_i2s_probe(struct platform_device *pdev) { -- /* Check module parameters */ -- if (smsc95xx_is_macaddr_param(dev, dev->net->dev_addr)) -- return; -- - /* try reading mac address from EEPROM */ - if (smsc95xx_read_eeprom(dev, EEPROM_MAC_OFFSET, ETH_ALEN, - dev->net->dev_addr) == 0) { -@@ -831,7 +827,11 @@ static void smsc95xx_init_mac_address(struct usbnet *dev) - } + struct bcm2835_i2s_dev *dev; +@@ -870,7 +889,9 @@ static int bcm2835_i2s_probe(struct platform_device *pdev) + return ret; } -- /* no eeprom, or eeprom values are invalid. generate random MAC */ -+ /* Check module parameters */ -+ if (smsc95xx_is_macaddr_param(dev, dev->net->dev_addr)) -+ return; -+ -+ /* no eeprom, or eeprom values are invalid, and no module parameter specified to set MAC. Generate random MAC */ - eth_hw_addr_random(dev->net); - netif_dbg(dev, ifup, dev->net, "MAC address set to eth_random_addr\n"); - } +- ret = devm_snd_dmaengine_pcm_register(&pdev->dev, NULL, 0); ++ ret = devm_snd_dmaengine_pcm_register(&pdev->dev, ++ &bcm2835_dmaengine_pcm_config, ++ SND_DMAENGINE_PCM_FLAG_COMPAT); + if (ret) { + dev_err(&pdev->dev, "Could not register PCM: %d\n", ret); + return ret; -From 1c43ff69763f4537b76b3248850256da2bda211b Mon Sep 17 00:00:00 2001 -From: popcornmix <popcornmix@gmail.com> -Date: Wed, 17 Feb 2016 19:02:31 +0000 -Subject: [PATCH 155/170] dcw_otg: Make trimming messages less noisy +From 04c99807249213d277900d529ad921edad28af25 Mon Sep 17 00:00:00 2001 +From: Matthias Reichl <hias@horus.com> +Date: Sun, 11 Oct 2015 15:55:21 +0200 +Subject: [PATCH 103/112] bcm2835-i2s: Enable MMAP support via a DT property + +Code ported from bcm2708-i2s driver in Raspberry Pi tree. + +RPi commit 7ee829fd77a30127db5d0b3c7d79b8718166e568 ("bcm2708-i2s: +Enable MMAP support via a DT property and overlay") + +The i2s driver used to claim to support MMAP, but that feature was disabled +when some problems were found. Add the ability to enable this feature +through Device Tree, using the i2s-mmap overlay. +See: #1004 + +Signed-off-by: Matthias Reichl <hias@horus.com> --- - drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c | 6 ++++-- - 1 file changed, 4 insertions(+), 2 deletions(-) + sound/soc/bcm/bcm2835-i2s.c | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c b/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c -index d672a76..e6b38ac3 100644 ---- a/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c -+++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c -@@ -738,7 +738,8 @@ static int update_urb_state_xfer_comp(dwc_hc_t * hc, - &short_read); - - if (urb->actual_length + xfer_length > urb->length) { -- DWC_WARN("%s(): trimming xfer length\n", __func__); -+ printk_once(KERN_DEBUG "dwc_otg: DEVICE:%03d : %s:%d:trimming xfer length\n", -+ hc->dev_addr, __func__, __LINE__); - xfer_length = urb->length - urb->actual_length; - } - -@@ -1430,7 +1431,8 @@ static void update_urb_state_xfer_intr(dwc_hc_t * hc, - halt_status, NULL); +diff --git a/sound/soc/bcm/bcm2835-i2s.c b/sound/soc/bcm/bcm2835-i2s.c +index ce93ef0..6f60c2c 100644 +--- a/sound/soc/bcm/bcm2835-i2s.c ++++ b/sound/soc/bcm/bcm2835-i2s.c +@@ -799,7 +799,7 @@ static const struct snd_soc_component_driver bcm2835_i2s_component = { + .name = "bcm2835-i2s-comp", + }; - if (urb->actual_length + bytes_transferred > urb->length) { -- DWC_WARN("%s(): trimming xfer length\n", __func__); -+ printk_once(KERN_DEBUG "dwc_otg: DEVICE:%03d : %s:%d:trimming xfer length\n", -+ hc->dev_addr, __func__, __LINE__); - bytes_transferred = urb->length - urb->actual_length; +-static const struct snd_pcm_hardware bcm2835_pcm_hardware = { ++static struct snd_pcm_hardware bcm2835_pcm_hardware = { + .info = SNDRV_PCM_INFO_INTERLEAVED | + SNDRV_PCM_INFO_JOINT_DUPLEX, + .formats = SNDRV_PCM_FMTBIT_S16_LE | +@@ -835,6 +835,11 @@ static int bcm2835_i2s_probe(struct platform_device *pdev) } + dma_reg_base = be32_to_cpup(addr); ++ if (of_property_read_bool(pdev->dev.of_node, "brcm,enable-mmap")) ++ bcm2835_pcm_hardware.info |= ++ SNDRV_PCM_INFO_MMAP | ++ SNDRV_PCM_INFO_MMAP_VALID; ++ + /* Request both ioareas */ + for (i = 0; i <= 1; i++) { + void __iomem *base; -From 7f9781f9875f2aa638d5afdaa9709fa1ef9bda8d Mon Sep 17 00:00:00 2001 +From 262486d1cc4f3cf204c012100bd7bfd36f446b37 Mon Sep 17 00:00:00 2001 From: Phil Elwell <phil@raspberrypi.org> -Date: Thu, 18 Feb 2016 15:28:14 +0000 -Subject: [PATCH 156/170] BCM270X_DT: at86rf233 overlay - drop to 3MHz +Date: Thu, 21 Apr 2016 15:44:14 +0100 +Subject: [PATCH 104/112] bcm2835-i2s: Reduce the TX DREQ threshold + +TX FIFO overrun is thought to be the cause of channel swapping, so +reducing the DREQ threshold seems reasonable and appears to be +effective. -The consensus is that 6MHz is too fast, but that 3MHz is OK. +See: https://github.com/raspberrypi/linux/issues/1417 -See: https://github.com/raspberrypi/linux/issues/1294 - https://github.com/raspberrypi/linux/issues/1151 +Signed-off-by: Phil Elwell <phil@raspberrypi.org> --- - arch/arm/boot/dts/overlays/README | 2 +- - arch/arm/boot/dts/overlays/at86rf233-overlay.dts | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) + sound/soc/bcm/bcm2835-i2s.c | 21 ++++++++++++++------- + 1 file changed, 14 insertions(+), 7 deletions(-) -diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README -index 0a2df01..4de0b6f 100644 ---- a/arch/arm/boot/dts/overlays/README -+++ b/arch/arm/boot/dts/overlays/README -@@ -188,7 +188,7 @@ Load: dtoverlay=at86rf233,<param>=<val> - Params: interrupt GPIO used for INT (default 23) - reset GPIO used for Reset (default 24) - sleep GPIO used for Sleep (default 25) -- speed SPI bus speed in Hz (default 6000000) -+ speed SPI bus speed in Hz (default 3000000) - trim Fine tuning of the internal capacitance - arrays (0=+0pF, 15=+4.5pF, default 15) - -diff --git a/arch/arm/boot/dts/overlays/at86rf233-overlay.dts b/arch/arm/boot/dts/overlays/at86rf233-overlay.dts -index 0460269..eab4052 100644 ---- a/arch/arm/boot/dts/overlays/at86rf233-overlay.dts -+++ b/arch/arm/boot/dts/overlays/at86rf233-overlay.dts -@@ -25,7 +25,7 @@ - interrupts = <23 4>; /* active high */ - reset-gpio = <&gpio 24 1>; - sleep-gpio = <&gpio 25 1>; -- spi-max-frequency = <6000000>; -+ spi-max-frequency = <3000000>; - xtal-trim = /bits/ 8 <0xf>; - }; - }; +diff --git a/sound/soc/bcm/bcm2835-i2s.c b/sound/soc/bcm/bcm2835-i2s.c +index 6f60c2c..b26f958 100644 +--- a/sound/soc/bcm/bcm2835-i2s.c ++++ b/sound/soc/bcm/bcm2835-i2s.c +@@ -555,15 +555,22 @@ static int bcm2835_i2s_hw_params(struct snd_pcm_substream *substream, + + /* Setup the DMA parameters */ + regmap_update_bits(dev->i2s_regmap, BCM2835_I2S_CS_A_REG, +- BCM2835_I2S_RXTHR(1) +- | BCM2835_I2S_TXTHR(1) +- | BCM2835_I2S_DMAEN, 0xffffffff); ++ BCM2835_I2S_RXTHR(3) ++ | BCM2835_I2S_TXTHR(3) ++ | BCM2835_I2S_DMAEN, ++ BCM2835_I2S_RXTHR(1) ++ | BCM2835_I2S_TXTHR(1) ++ | BCM2835_I2S_DMAEN); + + regmap_update_bits(dev->i2s_regmap, BCM2835_I2S_DREQ_A_REG, +- BCM2835_I2S_TX_PANIC(0x10) +- | BCM2835_I2S_RX_PANIC(0x30) +- | BCM2835_I2S_TX(0x30) +- | BCM2835_I2S_RX(0x20), 0xffffffff); ++ BCM2835_I2S_TX_PANIC(0x7f) ++ | BCM2835_I2S_RX_PANIC(0x7f) ++ | BCM2835_I2S_TX(0x7f) ++ | BCM2835_I2S_RX(0x7f), ++ BCM2835_I2S_TX_PANIC(0x10) ++ | BCM2835_I2S_RX_PANIC(0x30) ++ | BCM2835_I2S_TX(0x20) ++ | BCM2835_I2S_RX(0x20)); + + /* Clear FIFOs */ + bcm2835_i2s_clear_fifos(dev, true, true); + +From de142c7f01c5fea98e0548d564c08e0084cb4706 Mon Sep 17 00:00:00 2001 +From: Eric Anholt <eric@anholt.net> +Date: Wed, 14 Oct 2015 11:32:14 -0700 +Subject: [PATCH 105/112] drm/vc4: Force HDMI to connected. -From 5af831a3f879c89c8c0b39c8f88e7600bdc3a765 Mon Sep 17 00:00:00 2001 -From: Phil Elwell <phil@raspberrypi.org> -Date: Fri, 19 Feb 2016 12:04:48 +0000 -Subject: [PATCH 157/170] bcm2835-sdhost: Downgrade log message status +For some reason on the downstream tree, the HPD GPIO isn't working. +Signed-off-by: Eric Anholt <eric@anholt.net> --- - drivers/mmc/host/bcm2835-sdhost.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) + drivers/gpu/drm/vc4/vc4_hdmi.c | 2 ++ + 1 file changed, 2 insertions(+) -diff --git a/drivers/mmc/host/bcm2835-sdhost.c b/drivers/mmc/host/bcm2835-sdhost.c -index d66385c..4f6cab5 100644 ---- a/drivers/mmc/host/bcm2835-sdhost.c -+++ b/drivers/mmc/host/bcm2835-sdhost.c -@@ -232,8 +232,8 @@ static void log_init(u32 bus_to_phys) - sdhost_log_buf = dma_zalloc_coherent(NULL, LOG_SIZE, &sdhost_log_addr, - GFP_KERNEL); - if (sdhost_log_buf) { -- pr_err("sdhost: log_buf @ %p (%x)\n", -- sdhost_log_buf, sdhost_log_addr); -+ pr_info("sdhost: log_buf @ %p (%x)\n", -+ sdhost_log_buf, sdhost_log_addr); - timer_base = ioremap_nocache(bus_to_phys + 0x7e003000, SZ_4K); - if (!timer_base) - pr_err("sdhost: failed to remap timer\n"); +diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c +index d8b8649..136847e 100644 +--- a/drivers/gpu/drm/vc4/vc4_hdmi.c ++++ b/drivers/gpu/drm/vc4/vc4_hdmi.c +@@ -166,6 +166,8 @@ vc4_hdmi_connector_detect(struct drm_connector *connector, bool force) + struct drm_device *dev = connector->dev; + struct vc4_dev *vc4 = to_vc4_dev(dev); + ++ return connector_status_connected; ++ + if (vc4->hdmi->hpd_gpio) { + if (gpio_get_value_cansleep(vc4->hdmi->hpd_gpio) ^ + vc4->hdmi->hpd_active_low) -From e08f6b3aad073d8130d2ec0f8398f55983c0eac8 Mon Sep 17 00:00:00 2001 -From: Phil Elwell <phil@raspberrypi.org> -Date: Fri, 15 Jan 2016 16:48:27 +0000 -Subject: [PATCH 158/170] config: Enable HCI over UARTs +From 69dd4dd3bef6d673a6b81f115b83238e70c30e7b Mon Sep 17 00:00:00 2001 +From: Aaron Shaw <shawaj@gmail.com> +Date: Thu, 7 Apr 2016 21:26:21 +0100 +Subject: [PATCH 106/112] Add Support for JustBoom Audio boards +justboom-dac: Adjust for ALSA API change + +As of 4.4, snd_soc_limit_volume now takes a struct snd_soc_card * +rather than a struct snd_soc_codec *. + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> --- - arch/arm/configs/bcm2709_defconfig | 3 +++ - arch/arm/configs/bcmrpi_defconfig | 2 ++ - 2 files changed, 5 insertions(+) + arch/arm/configs/bcm2709_defconfig | 4 +- + arch/arm/configs/bcmrpi_defconfig | 4 +- + sound/soc/bcm/Kconfig | 14 +++ + sound/soc/bcm/Makefile | 4 + + sound/soc/bcm/justboom-dac.c | 162 ++++++++++++++++++++++++++++ + sound/soc/bcm/justboom-digi.c | 215 +++++++++++++++++++++++++++++++++++++ + 6 files changed, 399 insertions(+), 4 deletions(-) + create mode 100644 sound/soc/bcm/justboom-dac.c + create mode 100644 sound/soc/bcm/justboom-digi.c diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig -index fc35254..48ecb2e 100644 +index f42c5eb..055ecfc 100644 --- a/arch/arm/configs/bcm2709_defconfig +++ b/arch/arm/configs/bcm2709_defconfig -@@ -376,6 +376,9 @@ CONFIG_BT_BNEP_PROTO_FILTER=y - CONFIG_BT_HIDP=m - CONFIG_BT_6LOWPAN=m - CONFIG_BT_HCIBTUSB=m -+CONFIG_BT_HCIUART=m -+CONFIG_BT_HCIUART_3WIRE=y -+CONFIG_BT_HCIUART_BCM=y - CONFIG_BT_HCIBCM203X=m - CONFIG_BT_HCIBPA10X=m - CONFIG_BT_HCIBFUSB=m +@@ -856,8 +856,8 @@ CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI=m + CONFIG_SND_BCM2708_SOC_HIFIBERRY_AMP=m + CONFIG_SND_BCM2708_SOC_RPI_DAC=m + CONFIG_SND_BCM2708_SOC_RPI_PROTO=m +-CONFIG_SND_BCM2708_SOC_BOOMBERRY_DAC=m +-CONFIG_SND_BCM2708_SOC_BOOMBERRY_DIGI=m ++CONFIG_SND_BCM2708_SOC_JUSTBOOM_DAC=m ++CONFIG_SND_BCM2708_SOC_JUSTBOOM_DIGI=m + CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC=m + CONFIG_SND_BCM2708_SOC_RASPIDAC3=m + CONFIG_SND_BCM2708_SOC_ADAU1977_ADC=m diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig -index 51dc019..4368f0d 100644 +index 8bd0207..8e0b51f 100644 --- a/arch/arm/configs/bcmrpi_defconfig +++ b/arch/arm/configs/bcmrpi_defconfig -@@ -370,6 +370,8 @@ CONFIG_BT_HIDP=m - CONFIG_BT_6LOWPAN=m - CONFIG_BT_HCIBTUSB=m - CONFIG_BT_HCIUART=m -+CONFIG_BT_HCIUART_3WIRE=y -+CONFIG_BT_HCIUART_BCM=y - CONFIG_BT_HCIBCM203X=m - CONFIG_BT_HCIBPA10X=m - CONFIG_BT_HCIBFUSB=m - -From 20c4c47bca3674d746518b1cca1e066e46b52900 Mon Sep 17 00:00:00 2001 -From: Phil Elwell <phil@raspberrypi.org> -Date: Thu, 17 Dec 2015 13:37:07 +0000 -Subject: [PATCH 159/170] hci_h5: Don't send conf_req when ACTIVE - -Without this patch, a modem and kernel can continuously bombard each -other with conf_req and conf_rsp messages, in a demented game of tag. ---- - drivers/bluetooth/hci_h5.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/drivers/bluetooth/hci_h5.c b/drivers/bluetooth/hci_h5.c -index abee221..2825833 100644 ---- a/drivers/bluetooth/hci_h5.c -+++ b/drivers/bluetooth/hci_h5.c -@@ -314,7 +314,8 @@ static void h5_handle_internal_rx(struct hci_uart *hu) - h5_link_control(hu, conf_req, 3); - } else if (memcmp(data, conf_req, 2) == 0) { - h5_link_control(hu, conf_rsp, 2); -- h5_link_control(hu, conf_req, 3); -+ if (h5->state != H5_ACTIVE) -+ h5_link_control(hu, conf_req, 3); - } else if (memcmp(data, conf_rsp, 2) == 0) { - if (H5_HDR_LEN(hdr) > 2) - h5->tx_win = (data[2] & 7); - -From 00dba6ec2ac004fc17075febd4504646eb3dc543 Mon Sep 17 00:00:00 2001 -From: Phil Elwell <phil@raspberrypi.org> -Date: Tue, 23 Feb 2016 17:26:48 +0000 -Subject: [PATCH 160/170] amba_pl011: Don't use DT aliases for numbering - -The pl011 driver looks for DT aliases of the form "serial<n>", -and if found uses <n> as the device ID. This can cause -/dev/ttyAMA0 to become /dev/ttyAMA1, which is confusing if the -other serial port is provided by the 8250 driver which doesn't -use the same logic. ---- - drivers/tty/serial/amba-pl011.c | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c -index 899a771..68b3353 100644 ---- a/drivers/tty/serial/amba-pl011.c -+++ b/drivers/tty/serial/amba-pl011.c -@@ -2313,7 +2313,12 @@ static int pl011_setup_port(struct device *dev, struct uart_amba_port *uap, - if (IS_ERR(base)) - return PTR_ERR(base); - -+ /* Don't use DT serial<n> aliases - it causes the device to -+ be renumbered to ttyAMA1 if it is the second serial port in the -+ system, even though the other one is ttyS0. The 8250 driver -+ doesn't use this logic, so always remains ttyS0. - index = pl011_probe_dt_alias(index, dev); -+ */ +@@ -848,8 +848,8 @@ CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI=m + CONFIG_SND_BCM2708_SOC_HIFIBERRY_AMP=m + CONFIG_SND_BCM2708_SOC_RPI_DAC=m + CONFIG_SND_BCM2708_SOC_RPI_PROTO=m +-CONFIG_SND_BCM2708_SOC_BOOMBERRY_DAC=m +-CONFIG_SND_BCM2708_SOC_BOOMBERRY_DIGI=m ++CONFIG_SND_BCM2708_SOC_JUSTBOOM_DAC=m ++CONFIG_SND_BCM2708_SOC_JUSTBOOM_DIGI=m + CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC=m + CONFIG_SND_BCM2708_SOC_RASPIDAC3=m + CONFIG_SND_BCM2708_SOC_ADAU1977_ADC=m +diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig +index 1a3f826..e2e2782 100644 +--- a/sound/soc/bcm/Kconfig ++++ b/sound/soc/bcm/Kconfig +@@ -50,6 +50,20 @@ config SND_BCM2708_SOC_RPI_PROTO + help + Say Y or M if you want to add support for Audio Codec Board PROTO (WM8731). - uap->old_cr = 0; - uap->port.dev = dev; - -From 95136c932ac4433a6a50d394817812f8eb2cc914 Mon Sep 17 00:00:00 2001 -From: Eric Anholt <eric@anholt.net> -Date: Tue, 15 Dec 2015 15:35:57 -0800 -Subject: [PATCH 161/170] clk: bcm2835: Add bindings for the auxiliary - peripheral clock gates. - -These will be used for enabling UART1, SPI1, and SPI2. - -Signed-off-by: Eric Anholt <eric@anholt.net> -Acked-by: Rob Herring <robh@kernel.org> -Signed-off-by: Michael Turquette <mturquette@baylibre.com> ---- - .../bindings/clock/brcm,bcm2835-aux-clock.txt | 31 ++++++++++++++++++++++ - include/dt-bindings/clock/bcm2835-aux.h | 17 ++++++++++++ - 2 files changed, 48 insertions(+) - create mode 100644 Documentation/devicetree/bindings/clock/brcm,bcm2835-aux-clock.txt - create mode 100644 include/dt-bindings/clock/bcm2835-aux.h - -diff --git a/Documentation/devicetree/bindings/clock/brcm,bcm2835-aux-clock.txt b/Documentation/devicetree/bindings/clock/brcm,bcm2835-aux-clock.txt -new file mode 100644 -index 0000000..7a837d2 ---- /dev/null -+++ b/Documentation/devicetree/bindings/clock/brcm,bcm2835-aux-clock.txt -@@ -0,0 +1,31 @@ -+Broadcom BCM2835 auxiliary peripheral support -+ -+This binding uses the common clock binding: -+ Documentation/devicetree/bindings/clock/clock-bindings.txt -+ -+The auxiliary peripherals (UART, SPI1, and SPI2) have a small register -+area controlling clock gating to the peripherals, and providing an IRQ -+status register. -+ -+Required properties: -+- compatible: Should be "brcm,bcm2835-aux" -+- #clock-cells: Should be <1>. The permitted clock-specifier values can be -+ found in include/dt-bindings/clock/bcm2835-aux.h -+- reg: Specifies base physical address and size of the registers -+- clocks: The parent clock phandle -+ -+Example: ++config SND_BCM2708_SOC_JUSTBOOM_DAC ++ tristate "Support for JustBoom DAC" ++ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S ++ select SND_SOC_PCM512x ++ help ++ Say Y or M if you want to add support for JustBoom DAC. + -+ clocks: cprman@7e101000 { -+ compatible = "brcm,bcm2835-cprman"; -+ #clock-cells = <1>; -+ reg = <0x7e101000 0x2000>; -+ clocks = <&clk_osc>; -+ }; ++config SND_BCM2708_SOC_JUSTBOOM_DIGI ++ tristate "Support for JustBoom Digi" ++ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S ++ select SND_SOC_WM8804 ++ help ++ Say Y or M if you want to add support for JustBoom Digi. + -+ aux: aux@0x7e215004 { -+ compatible = "brcm,bcm2835-aux"; -+ #clock-cells = <1>; -+ reg = <0x7e215000 0x8>; -+ clocks = <&clocks BCM2835_CLOCK_VPU>; -+ }; -diff --git a/include/dt-bindings/clock/bcm2835-aux.h b/include/dt-bindings/clock/bcm2835-aux.h + config SND_BCM2708_SOC_IQAUDIO_DAC + tristate "Support for IQaudIO-DAC" + depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S +diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile +index b21e11e..6c9714c 100644 +--- a/sound/soc/bcm/Makefile ++++ b/sound/soc/bcm/Makefile +@@ -8,6 +8,8 @@ snd-soc-hifiberry-dac-objs := hifiberry_dac.o + snd-soc-hifiberry-dacplus-objs := hifiberry_dacplus.o + snd-soc-hifiberry-digi-objs := hifiberry_digi.o + snd-soc-hifiberry-amp-objs := hifiberry_amp.o ++snd-soc-justboom-dac-objs := justboom-dac.o ++snd-soc-justboom-digi-objs := justboom-digi.o + snd-soc-rpi-dac-objs := rpi-dac.o + snd-soc-rpi-proto-objs := rpi-proto.o + snd-soc-iqaudio-dac-objs := iqaudio-dac.o +@@ -17,6 +19,8 @@ obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o + obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS) += snd-soc-hifiberry-dacplus.o + obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI) += snd-soc-hifiberry-digi.o + obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_AMP) += snd-soc-hifiberry-amp.o ++obj-$(CONFIG_SND_BCM2708_SOC_JUSTBOOM_DAC) += snd-soc-justboom-dac.o ++obj-$(CONFIG_SND_BCM2708_SOC_JUSTBOOM_DIGI) += snd-soc-justboom-digi.o + obj-$(CONFIG_SND_BCM2708_SOC_RPI_DAC) += snd-soc-rpi-dac.o + obj-$(CONFIG_SND_BCM2708_SOC_RPI_PROTO) += snd-soc-rpi-proto.o + obj-$(CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC) += snd-soc-iqaudio-dac.o +diff --git a/sound/soc/bcm/justboom-dac.c b/sound/soc/bcm/justboom-dac.c new file mode 100644 -index 0000000..d91156e +index 0000000..8fd50db --- /dev/null -+++ b/include/dt-bindings/clock/bcm2835-aux.h -@@ -0,0 +1,17 @@ ++++ b/sound/soc/bcm/justboom-dac.c +@@ -0,0 +1,162 @@ +/* -+ * Copyright (C) 2015 Broadcom Corporation -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License as -+ * published by the Free Software Foundation version 2. ++ * ASoC Driver for JustBoom DAC Raspberry Pi HAT Sound Card + * -+ * This program is distributed "as is" WITHOUT ANY WARRANTY of any -+ * kind, whether express or implied; without even the implied warranty -+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ */ -+ -+#define BCM2835_AUX_CLOCK_UART 0 -+#define BCM2835_AUX_CLOCK_SPI1 1 -+#define BCM2835_AUX_CLOCK_SPI2 2 -+#define BCM2835_AUX_CLOCK_COUNT 3 - -From 924276b92ff47f0e778a9405d00637be4ca88736 Mon Sep 17 00:00:00 2001 -From: Eric Anholt <eric@anholt.net> -Date: Tue, 15 Dec 2015 15:35:58 -0800 -Subject: [PATCH 162/170] clk: bcm2835: Add a driver for the auxiliary - peripheral clock gates. - -There are a pair of SPI masters and a mini UART that were last minute -additions. As a result, they didn't get integrated in the same way as -the other gates off of the VPU clock in CPRMAN. - -Signed-off-by: Eric Anholt <eric@anholt.net> -Signed-off-by: Michael Turquette <mturquette@baylibre.com> - -updated Makefile to preserve the rasoberry pi architectures ---- - drivers/clk/bcm/Makefile | 1 + - drivers/clk/bcm/clk-bcm2835-aux.c | 85 +++++++++++++++++++++++++++++++++++++++ - 2 files changed, 86 insertions(+) - create mode 100644 drivers/clk/bcm/clk-bcm2835-aux.c - -diff --git a/drivers/clk/bcm/Makefile b/drivers/clk/bcm/Makefile -index a1b4cbc..84070d51 100644 ---- a/drivers/clk/bcm/Makefile -+++ b/drivers/clk/bcm/Makefile -@@ -4,6 +4,7 @@ obj-$(CONFIG_CLK_BCM_KONA) += clk-bcm281xx.o - obj-$(CONFIG_CLK_BCM_KONA) += clk-bcm21664.o - obj-$(CONFIG_COMMON_CLK_IPROC) += clk-iproc-armpll.o clk-iproc-pll.o clk-iproc-asiu.o - obj-$(CONFIG_ARCH_BCM2835)$(CONFIG_ARCH_BCM2708)$(CONFIG_ARCH_BCM2709) += clk-bcm2835.o -+obj-$(CONFIG_ARCH_BCM2835) += clk-bcm2835-aux.o - obj-$(CONFIG_COMMON_CLK_IPROC) += clk-ns2.o - obj-$(CONFIG_ARCH_BCM_CYGNUS) += clk-cygnus.o - obj-$(CONFIG_ARCH_BCM_NSP) += clk-nsp.o -diff --git a/drivers/clk/bcm/clk-bcm2835-aux.c b/drivers/clk/bcm/clk-bcm2835-aux.c -new file mode 100644 -index 0000000..e4f89e2 ---- /dev/null -+++ b/drivers/clk/bcm/clk-bcm2835-aux.c -@@ -0,0 +1,85 @@ -+/* -+ * Copyright (C) 2015 Broadcom ++ * Author: Milan Neskovic ++ * Copyright 2016 ++ * based on code by Daniel Matuschek <info@crazy-audio.com> ++ * based on code by Florian Meier <florian.meier@koalo.de> + * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2 of the License, or -+ * (at your option) any later version. ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * version 2 as published by the Free Software Foundation. + * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * General Public License for more details. + */ + -+#include <linux/clk.h> -+#include <linux/clk-provider.h> -+#include <linux/clk/bcm2835.h> +#include <linux/module.h> +#include <linux/platform_device.h> -+#include <dt-bindings/clock/bcm2835-aux.h> -+ -+#define BCM2835_AUXIRQ 0x00 -+#define BCM2835_AUXENB 0x04 -+ -+static int bcm2835_aux_clk_probe(struct platform_device *pdev) -+{ -+ struct device *dev = &pdev->dev; -+ struct clk_onecell_data *onecell; -+ const char *parent; -+ struct clk *parent_clk; -+ struct resource *res; -+ void __iomem *reg, *gate; -+ -+ parent_clk = devm_clk_get(dev, NULL); -+ if (IS_ERR(parent_clk)) -+ return PTR_ERR(parent_clk); -+ parent = __clk_get_name(parent_clk); + -+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); -+ reg = devm_ioremap_resource(dev, res); -+ if (!reg) -+ return -ENODEV; ++#include <sound/core.h> ++#include <sound/pcm.h> ++#include <sound/pcm_params.h> ++#include <sound/soc.h> ++#include <sound/jack.h> + -+ onecell = devm_kmalloc(dev, sizeof(*onecell), GFP_KERNEL); -+ if (!onecell) -+ return -ENOMEM; -+ onecell->clk_num = BCM2835_AUX_CLOCK_COUNT; -+ onecell->clks = devm_kcalloc(dev, BCM2835_AUX_CLOCK_COUNT, -+ sizeof(*onecell->clks), GFP_KERNEL); -+ if (!onecell->clks) -+ return -ENOMEM; ++#include "../codecs/pcm512x.h" + -+ gate = reg + BCM2835_AUXENB; -+ onecell->clks[BCM2835_AUX_CLOCK_UART] = -+ clk_register_gate(dev, "aux_uart", parent, 0, gate, 0, 0, NULL); ++static bool digital_gain_0db_limit = true; + -+ onecell->clks[BCM2835_AUX_CLOCK_SPI1] = -+ clk_register_gate(dev, "aux_spi1", parent, 0, gate, 1, 0, NULL); ++static int snd_rpi_justboom_dac_init(struct snd_soc_pcm_runtime *rtd) ++{ ++ struct snd_soc_codec *codec = rtd->codec; ++ snd_soc_update_bits(codec, PCM512x_GPIO_EN, 0x08, 0x08); ++ snd_soc_update_bits(codec, PCM512x_GPIO_OUTPUT_4, 0xf, 0x02); ++ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x08,0x08); + -+ onecell->clks[BCM2835_AUX_CLOCK_SPI2] = -+ clk_register_gate(dev, "aux_spi2", parent, 0, gate, 2, 0, NULL); ++ if (digital_gain_0db_limit) ++ { ++ int ret; ++ struct snd_soc_card *card = rtd->card; + -+ of_clk_add_provider(pdev->dev.of_node, of_clk_src_onecell_get, onecell); ++ ret = snd_soc_limit_volume(card, "Digital Playback Volume", 207); ++ if (ret < 0) ++ dev_warn(card->dev, "Failed to set volume limit: %d\n", ret); ++ } + + return 0; +} + -+static const struct of_device_id bcm2835_aux_clk_of_match[] = { -+ { .compatible = "brcm,bcm2835-aux", }, -+ {}, -+}; -+MODULE_DEVICE_TABLE(of, bcm2835_aux_clk_of_match); -+ -+static struct platform_driver bcm2835_aux_clk_driver = { -+ .driver = { -+ .name = "bcm2835-aux-clk", -+ .of_match_table = bcm2835_aux_clk_of_match, -+ }, -+ .probe = bcm2835_aux_clk_probe, -+}; -+builtin_platform_driver(bcm2835_aux_clk_driver); -+ -+MODULE_AUTHOR("Eric Anholt <eric@anholt.net>"); -+MODULE_DESCRIPTION("BCM2835 auxiliary peripheral clock driver"); -+MODULE_LICENSE("GPL v2"); - -From 43477e669f736f6da34afbd8a96683b239b1fd1f Mon Sep 17 00:00:00 2001 -From: Fraser <github@frasersdev.net> -Date: Tue, 23 Feb 2016 10:04:37 +1100 -Subject: [PATCH 163/170] Aux SPI 1&2 implementation - -Adds aux spi 1 & 2 devices to compatible raspberry PIs. -* Minor config of the driver build environment to ensure they get built -for CONFIG_ARCH_BCM2708 & CONFIG_ARCH_BCM2709 devices. -* Adds the aux spi driver into the defconfigs as a module. -* Adds the auxiliary and spi1/2 devices into the device tree in a -disabled state -* Provides decide tree overlays which enables the devices and gives -users a degree of control over how they are setup. ---- - arch/arm/boot/dts/bcm2708_common.dtsi | 34 ++++++++- - arch/arm/boot/dts/overlays/Makefile | 6 ++ - arch/arm/boot/dts/overlays/README | 99 +++++++++++++++++++++++++ - arch/arm/boot/dts/overlays/spi1-1cs-overlay.dts | 57 ++++++++++++++ - arch/arm/boot/dts/overlays/spi1-2cs-overlay.dts | 69 +++++++++++++++++ - arch/arm/boot/dts/overlays/spi1-3cs-overlay.dts | 81 ++++++++++++++++++++ - arch/arm/boot/dts/overlays/spi2-1cs-overlay.dts | 57 ++++++++++++++ - arch/arm/boot/dts/overlays/spi2-2cs-overlay.dts | 69 +++++++++++++++++ - arch/arm/boot/dts/overlays/spi2-3cs-overlay.dts | 81 ++++++++++++++++++++ - arch/arm/configs/bcm2709_defconfig | 1 + - arch/arm/configs/bcmrpi_defconfig | 1 + - drivers/clk/bcm/Makefile | 2 +- - drivers/spi/Kconfig | 2 +- - 13 files changed, 556 insertions(+), 3 deletions(-) - create mode 100644 arch/arm/boot/dts/overlays/spi1-1cs-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/spi1-2cs-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/spi1-3cs-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/spi2-1cs-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/spi2-2cs-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/spi2-3cs-overlay.dts - -diff --git a/arch/arm/boot/dts/bcm2708_common.dtsi b/arch/arm/boot/dts/bcm2708_common.dtsi -index 18d3c45..4f65203 100644 ---- a/arch/arm/boot/dts/bcm2708_common.dtsi -+++ b/arch/arm/boot/dts/bcm2708_common.dtsi -@@ -1,3 +1,4 @@ -+#include <dt-bindings/clock/bcm2835-aux.h> - #include "skeleton.dtsi" - - / { -@@ -5,6 +6,7 @@ - - aliases { - audio = &audio; -+ aux = &aux; - sound = &sound; - soc = &soc; - dma = &dma; -@@ -19,6 +21,8 @@ - spi0 = &spi0; - i2c0 = &i2c0; - uart1 = &uart1; -+ spi1 = &spi1; -+ spi2 = &spi2; - mmc = &mmc; - i2c1 = &i2c1; - i2c2 = &i2c2; -@@ -186,6 +190,14 @@ - status = "disabled"; - }; - -+ aux: aux@0x7e215004 { -+ compatible = "brcm,bcm2835-aux"; -+ #clock-cells = <1>; -+ reg = <0x7e215000 0x8>; -+ clocks = <&clk_core>; -+ status = "disabled"; -+ }; -+ - uart1: uart@7e215040 { - compatible = "brcm,bcm2835-aux-uart", "ns16550"; - reg = <0x7e215040 0x40>; -@@ -194,7 +206,27 @@ - reg-shift = <2>; - no-loopback-test; - status = "disabled"; -- }; -+ }; -+ -+ spi1: spi@7e215080 { -+ compatible = "brcm,bcm2835-aux-spi"; -+ reg = <0x7e215080 0x40>, <0x7e215000 0x8>; -+ interrupts = <1 29>; -+ clocks = <&aux BCM2835_AUX_CLOCK_SPI1>; -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "disabled"; -+ }; -+ -+ spi2: spi@7e2150C0 { -+ compatible = "brcm,bcm2835-aux-spi"; -+ reg = <0x7e2150C0 0x40>, <0x7e215000 0x8>; -+ interrupts = <1 29>; -+ clocks = <&aux BCM2835_AUX_CLOCK_SPI2>; -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "disabled"; -+ }; - - mmc: mmc@7e300000 { - compatible = "brcm,bcm2835-mmc"; -diff --git a/arch/arm/boot/dts/overlays/Makefile b/arch/arm/boot/dts/overlays/Makefile -index 4d9d640..a787d66 100644 ---- a/arch/arm/boot/dts/overlays/Makefile -+++ b/arch/arm/boot/dts/overlays/Makefile -@@ -57,6 +57,12 @@ dtb-$(RPI_DT_OVERLAYS) += sdtweak-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += smi-dev-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += smi-nand-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += smi-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += spi1-1cs-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += spi1-2cs-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += spi1-3cs-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += spi2-1cs-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += spi2-2cs-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += spi2-3cs-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += spi-gpio35-39-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += tinylcd35-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += uart1-overlay.dtb -diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README -index 4de0b6f..cf5f5be 100644 ---- a/arch/arm/boot/dts/overlays/README -+++ b/arch/arm/boot/dts/overlays/README -@@ -713,6 +713,105 @@ Load: dtoverlay=spi-gpio35-39 - Params: <None> - - -+Name: spi1-1cs -+Info: Enables spi1 with a single chip select (CS) line and associated spidev -+ dev node. The gpio pin number for the CS line and spidev device node -+ creation are configurable. -+ N.B.: spi1 is only accessible on devices with a 40pin header, eg: -+ A+, B+, Zero and PI2 B; as well as the Compute Module. -+Load: dtoverlay=spi1-1cs,<param>=<val> -+Params: cs0_pin GPIO pin for CS0 (default 18 - BCM SPI1_CE0). -+ cs0_spidev Set to 'disabled' to stop the creation of a -+ userspace device node /dev/spidev1.0 (default -+ is 'okay' or enabled). -+ -+ -+Name: spi1-2cs -+Info: Enables spi1 with two chip select (CS) lines and associated spidev -+ dev nodes. The gpio pin numbers for the CS lines and spidev device node -+ creation are configurable. -+ N.B.: spi1 is only accessible on devices with a 40pin header, eg: -+ A+, B+, Zero and PI2 B; as well as the Compute Module. -+Load: dtoverlay=spi1-2cs,<param>=<val> -+Params: cs0_pin GPIO pin for CS0 (default 18 - BCM SPI1_CE0). -+ cs1_pin GPIO pin for CS1 (default 17 - BCM SPI1_CE1). -+ cs0_spidev Set to 'disabled' to stop the creation of a -+ userspace device node /dev/spidev1.0 (default -+ is 'okay' or enabled). -+ cs1_spidev Set to 'disabled' to stop the creation of a -+ userspace device node /dev/spidev1.1 (default -+ is 'okay' or enabled). -+ -+ -+Name: spi1-3cs -+Info: Enables spi1 with three chip select (CS) lines and associated spidev -+ dev nodes. The gpio pin numbers for the CS lines and spidev device node -+ creation are configurable. -+ N.B.: spi1 is only accessible on devices with a 40pin header, eg: -+ A+, B+, Zero and PI2 B; as well as the Compute Module. -+Load: dtoverlay=spi1-3cs,<param>=<val> -+Params: cs0_pin GPIO pin for CS0 (default 18 - BCM SPI1_CE0). -+ cs1_pin GPIO pin for CS1 (default 17 - BCM SPI1_CE1). -+ cs2_pin GPIO pin for CS2 (default 16 - BCM SPI1_CE2). -+ cs0_spidev Set to 'disabled' to stop the creation of a -+ userspace device node /dev/spidev1.0 (default -+ is 'okay' or enabled). -+ cs1_spidev Set to 'disabled' to stop the creation of a -+ userspace device node /dev/spidev1.1 (default -+ is 'okay' or enabled). -+ cs2_spidev Set to 'disabled' to stop the creation of a -+ userspace device node /dev/spidev1.2 (default -+ is 'okay' or enabled). -+ -+ -+Name: spi2-1cs -+Info: Enables spi2 with a single chip select (CS) line and associated spidev -+ dev node. The gpio pin number for the CS line and spidev device node -+ creation are configurable. -+ N.B.: spi2 is only accessible with the Compute Module. -+Load: dtoverlay=spi2-1cs,<param>=<val> -+Params: cs0_pin GPIO pin for CS0 (default 43 - BCM SPI2_CE0). -+ cs0_spidev Set to 'disabled' to stop the creation of a -+ userspace device node /dev/spidev2.0 (default -+ is 'okay' or enabled). -+ -+ -+Name: spi2-2cs -+Info: Enables spi2 with two chip select (CS) lines and associated spidev -+ dev nodes. The gpio pin numbers for the CS lines and spidev device node -+ creation are configurable. -+ N.B.: spi2 is only accessible with the Compute Module. -+Load: dtoverlay=spi2-2cs,<param>=<val> -+Params: cs0_pin GPIO pin for CS0 (default 43 - BCM SPI2_CE0). -+ cs1_pin GPIO pin for CS1 (default 44 - BCM SPI2_CE1). -+ cs0_spidev Set to 'disabled' to stop the creation of a -+ userspace device node /dev/spidev2.0 (default -+ is 'okay' or enabled). -+ cs1_spidev Set to 'disabled' to stop the creation of a -+ userspace device node /dev/spidev2.1 (default -+ is 'okay' or enabled). -+ -+ -+Name: spi2-3cs -+Info: Enables spi2 with three chip select (CS) lines and associated spidev -+ dev nodes. The gpio pin numbers for the CS lines and spidev device node -+ creation are configurable. -+ N.B.: spi2 is only accessible with the Compute Module. -+Load: dtoverlay=spi2-3cs,<param>=<val> -+Params: cs0_pin GPIO pin for CS0 (default 43 - BCM SPI2_CE0). -+ cs1_pin GPIO pin for CS1 (default 44 - BCM SPI2_CE1). -+ cs2_pin GPIO pin for CS2 (default 45 - BCM SPI2_CE2). -+ cs0_spidev Set to 'disabled' to stop the creation of a -+ userspace device node /dev/spidev2.0 (default -+ is 'okay' or enabled). -+ cs1_spidev Set to 'disabled' to stop the creation of a -+ userspace device node /dev/spidev2.1 (default -+ is 'okay' or enabled). -+ cs2_spidev Set to 'disabled' to stop the creation of a -+ userspace device node /dev/spidev2.2 (default -+ is 'okay' or enabled). -+ -+ - Name: tinylcd35 - Info: 3.5" Color TFT Display by www.tinylcd.com - Options: Touch, RTC, keypad -diff --git a/arch/arm/boot/dts/overlays/spi1-1cs-overlay.dts b/arch/arm/boot/dts/overlays/spi1-1cs-overlay.dts -new file mode 100644 -index 0000000..71c2439 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/spi1-1cs-overlay.dts -@@ -0,0 +1,57 @@ -+/dts-v1/; -+/plugin/; -+ -+ -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; -+ -+ fragment@0 { -+ target = <&gpio>; -+ __overlay__ { -+ spi1_pins: spi1_pins { -+ brcm,pins = <19 20 21>; -+ brcm,function = <3>; /* alt4 */ -+ }; -+ -+ spi1_cs_pins: spi1_cs_pins { -+ brcm,pins = <18>; -+ brcm,function = <1>; /* output */ -+ }; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&spi1>; -+ frag1: __overlay__ { -+ /* needed to avoid dtc warning */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&spi1_pins &spi1_cs_pins>; -+ cs-gpios = <&gpio 18 1>; -+ status = "okay"; -+ -+ spidev1_0: spidev@0 { -+ compatible = "spidev"; -+ reg = <0>; /* CE0 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; -+ status = "okay"; -+ }; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&aux>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ __overrides__ { -+ cs0_pin = <&spi1_cs_pins>,"brcm,pins:0", -+ <&frag1>,"cs-gpios:4"; -+ cs0_spidev = <&spidev1_0>,"status"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/spi1-2cs-overlay.dts b/arch/arm/boot/dts/overlays/spi1-2cs-overlay.dts -new file mode 100644 -index 0000000..2ae0885 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/spi1-2cs-overlay.dts -@@ -0,0 +1,69 @@ -+/dts-v1/; -+/plugin/; -+ -+ -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; -+ -+ fragment@0 { -+ target = <&gpio>; -+ __overlay__ { -+ spi1_pins: spi1_pins { -+ brcm,pins = <19 20 21>; -+ brcm,function = <3>; /* alt4 */ -+ }; -+ -+ spi1_cs_pins: spi1_cs_pins { -+ brcm,pins = <18 17>; -+ brcm,function = <1>; /* output */ -+ }; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&spi1>; -+ frag1: __overlay__ { -+ /* needed to avoid dtc warning */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&spi1_pins &spi1_cs_pins>; -+ cs-gpios = <&gpio 18 1>, <&gpio 17 1>; -+ status = "okay"; -+ -+ spidev1_0: spidev@0 { -+ compatible = "spidev"; -+ reg = <0>; /* CE0 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; -+ status = "okay"; -+ }; ++static int snd_rpi_justboom_dac_hw_params(struct snd_pcm_substream *substream, ++ struct snd_pcm_hw_params *params) ++{ ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; ++ /*return snd_soc_dai_set_bclk_ratio(cpu_dai, 64);*/ ++ unsigned int sample_bits = ++ snd_pcm_format_physical_width(params_format(params)); ++ return snd_soc_dai_set_bclk_ratio(cpu_dai, sample_bits * 2); ++} + -+ spidev1_1: spidev@1 { -+ compatible = "spidev"; -+ reg = <1>; /* CE1 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; -+ status = "okay"; -+ }; -+ }; -+ }; ++static int snd_rpi_justboom_dac_startup(struct snd_pcm_substream *substream) { ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_codec *codec = rtd->codec; ++ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x08,0x08); ++ return 0; ++} + -+ fragment@2 { -+ target = <&aux>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; ++static void snd_rpi_justboom_dac_shutdown(struct snd_pcm_substream *substream) { ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_codec *codec = rtd->codec; ++ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x08,0x00); ++} + -+ __overrides__ { -+ cs0_pin = <&spi1_cs_pins>,"brcm,pins:0", -+ <&frag1>,"cs-gpios:4"; -+ cs1_pin = <&spi1_cs_pins>,"brcm,pins:4", -+ <&frag1>,"cs-gpios:16"; -+ cs0_spidev = <&spidev1_0>,"status"; -+ cs1_spidev = <&spidev1_1>,"status"; -+ }; ++/* machine stream operations */ ++static struct snd_soc_ops snd_rpi_justboom_dac_ops = { ++ .hw_params = snd_rpi_justboom_dac_hw_params, ++ .startup = snd_rpi_justboom_dac_startup, ++ .shutdown = snd_rpi_justboom_dac_shutdown, +}; -diff --git a/arch/arm/boot/dts/overlays/spi1-3cs-overlay.dts b/arch/arm/boot/dts/overlays/spi1-3cs-overlay.dts -new file mode 100644 -index 0000000..8f79044 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/spi1-3cs-overlay.dts -@@ -0,0 +1,81 @@ -+/dts-v1/; -+/plugin/; -+ -+ -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; -+ -+ fragment@0 { -+ target = <&gpio>; -+ __overlay__ { -+ spi1_pins: spi1_pins { -+ brcm,pins = <19 20 21>; -+ brcm,function = <3>; /* alt4 */ -+ }; -+ -+ spi1_cs_pins: spi1_cs_pins { -+ brcm,pins = <18 17 16>; -+ brcm,function = <1>; /* output */ -+ }; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&spi1>; -+ frag1: __overlay__ { -+ /* needed to avoid dtc warning */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&spi1_pins &spi1_cs_pins>; -+ cs-gpios = <&gpio 18 1>, <&gpio 17 1>, <&gpio 16 1>; -+ status = "okay"; -+ -+ spidev1_0: spidev@0 { -+ compatible = "spidev"; -+ reg = <0>; /* CE0 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; -+ status = "okay"; -+ }; -+ -+ spidev1_1: spidev@1 { -+ compatible = "spidev"; -+ reg = <1>; /* CE1 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; -+ status = "okay"; -+ }; -+ -+ spidev1_2: spidev@2 { -+ compatible = "spidev"; -+ reg = <2>; /* CE2 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; -+ status = "okay"; -+ }; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&aux>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; + -+ __overrides__ { -+ cs0_pin = <&spi1_cs_pins>,"brcm,pins:0", -+ <&frag1>,"cs-gpios:4"; -+ cs1_pin = <&spi1_cs_pins>,"brcm,pins:4", -+ <&frag1>,"cs-gpios:16"; -+ cs2_pin = <&spi1_cs_pins>,"brcm,pins:8", -+ <&frag1>,"cs-gpios:28"; -+ cs0_spidev = <&spidev1_0>,"status"; -+ cs1_spidev = <&spidev1_1>,"status"; -+ cs2_spidev = <&spidev1_2>,"status"; -+ }; ++static struct snd_soc_dai_link snd_rpi_justboom_dac_dai[] = { ++{ ++ .name = "JustBoom DAC", ++ .stream_name = "JustBoom DAC HiFi", ++ .cpu_dai_name = "bcm2708-i2s.0", ++ .codec_dai_name = "pcm512x-hifi", ++ .platform_name = "bcm2708-i2s.0", ++ .codec_name = "pcm512x.1-004d", ++ .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | ++ SND_SOC_DAIFMT_CBS_CFS, ++ .ops = &snd_rpi_justboom_dac_ops, ++ .init = snd_rpi_justboom_dac_init, ++}, +}; -diff --git a/arch/arm/boot/dts/overlays/spi2-1cs-overlay.dts b/arch/arm/boot/dts/overlays/spi2-1cs-overlay.dts -new file mode 100644 -index 0000000..6f57bc7 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/spi2-1cs-overlay.dts -@@ -0,0 +1,57 @@ -+/dts-v1/; -+/plugin/; + -+ -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; -+ -+ fragment@0 { -+ target = <&gpio>; -+ __overlay__ { -+ spi2_pins: spi2_pins { -+ brcm,pins = <40 41 42>; -+ brcm,function = <3>; /* alt4 */ -+ }; -+ -+ spi2_cs_pins: spi2_cs_pins { -+ brcm,pins = <43>; -+ brcm,function = <1>; /* output */ -+ }; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&spi2>; -+ frag1: __overlay__ { -+ /* needed to avoid dtc warning */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&spi2_pins &spi2_cs_pins>; -+ cs-gpios = <&gpio 43 1>; -+ status = "okay"; -+ -+ spidev2_0: spidev@0 { -+ compatible = "spidev"; -+ reg = <0>; /* CE0 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; -+ status = "okay"; -+ }; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&aux>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ __overrides__ { -+ cs0_pin = <&spi2_cs_pins>,"brcm,pins:0", -+ <&frag1>,"cs-gpios:4"; -+ cs0_spidev = <&spidev2_0>,"status"; -+ }; ++/* audio machine driver */ ++static struct snd_soc_card snd_rpi_justboom_dac = { ++ .name = "snd_rpi_justboom_dac", ++ .owner = THIS_MODULE, ++ .dai_link = snd_rpi_justboom_dac_dai, ++ .num_links = ARRAY_SIZE(snd_rpi_justboom_dac_dai), +}; -diff --git a/arch/arm/boot/dts/overlays/spi2-2cs-overlay.dts b/arch/arm/boot/dts/overlays/spi2-2cs-overlay.dts -new file mode 100644 -index 0000000..d090631 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/spi2-2cs-overlay.dts -@@ -0,0 +1,69 @@ -+/dts-v1/; -+/plugin/; + ++static int snd_rpi_justboom_dac_probe(struct platform_device *pdev) ++{ ++ int ret = 0; + -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; ++ snd_rpi_justboom_dac.dev = &pdev->dev; + -+ fragment@0 { -+ target = <&gpio>; -+ __overlay__ { -+ spi2_pins: spi2_pins { -+ brcm,pins = <40 41 42>; -+ brcm,function = <3>; /* alt4 */ -+ }; ++ if (pdev->dev.of_node) { ++ struct device_node *i2s_node; ++ struct snd_soc_dai_link *dai = &snd_rpi_justboom_dac_dai[0]; ++ i2s_node = of_parse_phandle(pdev->dev.of_node, ++ "i2s-controller", 0); + -+ spi2_cs_pins: spi2_cs_pins { -+ brcm,pins = <43 44>; -+ brcm,function = <1>; /* output */ -+ }; -+ }; -+ }; ++ if (i2s_node) { ++ dai->cpu_dai_name = NULL; ++ dai->cpu_of_node = i2s_node; ++ dai->platform_name = NULL; ++ dai->platform_of_node = i2s_node; ++ } + -+ fragment@1 { -+ target = <&spi2>; -+ frag1: __overlay__ { -+ /* needed to avoid dtc warning */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&spi2_pins &spi2_cs_pins>; -+ cs-gpios = <&gpio 43 1>, <&gpio 44 1>; -+ status = "okay"; ++ digital_gain_0db_limit = !of_property_read_bool( ++ pdev->dev.of_node, "justboom,24db_digital_gain"); ++ } + -+ spidev2_0: spidev@0 { -+ compatible = "spidev"; -+ reg = <0>; /* CE0 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; -+ status = "okay"; -+ }; ++ ret = snd_soc_register_card(&snd_rpi_justboom_dac); ++ if (ret) ++ dev_err(&pdev->dev, ++ "snd_soc_register_card() failed: %d\n", ret); + -+ spidev2_1: spidev@1 { -+ compatible = "spidev"; -+ reg = <1>; /* CE1 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; -+ status = "okay"; -+ }; -+ }; -+ }; ++ return ret; ++} + -+ fragment@2 { -+ target = <&aux>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; ++static int snd_rpi_justboom_dac_remove(struct platform_device *pdev) ++{ ++ return snd_soc_unregister_card(&snd_rpi_justboom_dac); ++} + -+ __overrides__ { -+ cs0_pin = <&spi2_cs_pins>,"brcm,pins:0", -+ <&frag1>,"cs-gpios:4"; -+ cs1_pin = <&spi2_cs_pins>,"brcm,pins:4", -+ <&frag1>,"cs-gpios:16"; -+ cs0_spidev = <&spidev2_0>,"status"; -+ cs1_spidev = <&spidev2_1>,"status"; -+ }; ++static const struct of_device_id snd_rpi_justboom_dac_of_match[] = { ++ { .compatible = "justboom,justboom-dac", }, ++ {}, +}; -diff --git a/arch/arm/boot/dts/overlays/spi2-3cs-overlay.dts b/arch/arm/boot/dts/overlays/spi2-3cs-overlay.dts -new file mode 100644 -index 0000000..e258672 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/spi2-3cs-overlay.dts -@@ -0,0 +1,81 @@ -+/dts-v1/; -+/plugin/; -+ -+ -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; -+ -+ fragment@0 { -+ target = <&gpio>; -+ __overlay__ { -+ spi2_pins: spi2_pins { -+ brcm,pins = <40 41 42>; -+ brcm,function = <3>; /* alt4 */ -+ }; -+ -+ spi2_cs_pins: spi2_cs_pins { -+ brcm,pins = <43 44 45>; -+ brcm,function = <1>; /* output */ -+ }; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&spi2>; -+ frag1: __overlay__ { -+ /* needed to avoid dtc warning */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&spi2_pins &spi2_cs_pins>; -+ cs-gpios = <&gpio 43 1>, <&gpio 44 1>, <&gpio 45 1>; -+ status = "okay"; -+ -+ spidev2_0: spidev@0 { -+ compatible = "spidev"; -+ reg = <0>; /* CE0 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; -+ status = "okay"; -+ }; -+ -+ spidev2_1: spidev@1 { -+ compatible = "spidev"; -+ reg = <1>; /* CE1 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; -+ status = "okay"; -+ }; -+ -+ spidev2_2: spidev@2 { -+ compatible = "spidev"; -+ reg = <2>; /* CE2 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; -+ status = "okay"; -+ }; -+ }; -+ }; ++MODULE_DEVICE_TABLE(of, snd_rpi_justboom_dac_of_match); + -+ fragment@2 { -+ target = <&aux>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ __overrides__ { -+ cs0_pin = <&spi2_cs_pins>,"brcm,pins:0", -+ <&frag1>,"cs-gpios:4"; -+ cs1_pin = <&spi2_cs_pins>,"brcm,pins:4", -+ <&frag1>,"cs-gpios:16"; -+ cs2_pin = <&spi2_cs_pins>,"brcm,pins:8", -+ <&frag1>,"cs-gpios:28"; -+ cs0_spidev = <&spidev2_0>,"status"; -+ cs1_spidev = <&spidev2_1>,"status"; -+ cs2_spidev = <&spidev2_2>,"status"; -+ }; ++static struct platform_driver snd_rpi_justboom_dac_driver = { ++ .driver = { ++ .name = "snd-rpi-justboom-dac", ++ .owner = THIS_MODULE, ++ .of_match_table = snd_rpi_justboom_dac_of_match, ++ }, ++ .probe = snd_rpi_justboom_dac_probe, ++ .remove = snd_rpi_justboom_dac_remove, +}; -diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig -index 48ecb2e..76b3a88 100644 ---- a/arch/arm/configs/bcm2709_defconfig -+++ b/arch/arm/configs/bcm2709_defconfig -@@ -601,6 +601,7 @@ CONFIG_I2C_BCM2708=m - CONFIG_I2C_GPIO=m - CONFIG_SPI=y - CONFIG_SPI_BCM2835=m -+CONFIG_SPI_BCM2835AUX=m - CONFIG_SPI_SPIDEV=y - CONFIG_PPS=m - CONFIG_PPS_CLIENT_LDISC=m -diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig -index 4368f0d..1ca1695 100644 ---- a/arch/arm/configs/bcmrpi_defconfig -+++ b/arch/arm/configs/bcmrpi_defconfig -@@ -593,6 +593,7 @@ CONFIG_I2C_BCM2708=m - CONFIG_I2C_GPIO=m - CONFIG_SPI=y - CONFIG_SPI_BCM2835=m -+CONFIG_SPI_BCM2835AUX=m - CONFIG_SPI_SPIDEV=y - CONFIG_PPS=m - CONFIG_PPS_CLIENT_LDISC=m -diff --git a/drivers/clk/bcm/Makefile b/drivers/clk/bcm/Makefile -index 84070d51..d60fd3f 100644 ---- a/drivers/clk/bcm/Makefile -+++ b/drivers/clk/bcm/Makefile -@@ -4,7 +4,7 @@ obj-$(CONFIG_CLK_BCM_KONA) += clk-bcm281xx.o - obj-$(CONFIG_CLK_BCM_KONA) += clk-bcm21664.o - obj-$(CONFIG_COMMON_CLK_IPROC) += clk-iproc-armpll.o clk-iproc-pll.o clk-iproc-asiu.o - obj-$(CONFIG_ARCH_BCM2835)$(CONFIG_ARCH_BCM2708)$(CONFIG_ARCH_BCM2709) += clk-bcm2835.o --obj-$(CONFIG_ARCH_BCM2835) += clk-bcm2835-aux.o -+obj-$(CONFIG_ARCH_BCM2835)$(CONFIG_ARCH_BCM2708)$(CONFIG_ARCH_BCM2709) += clk-bcm2835-aux.o - obj-$(CONFIG_COMMON_CLK_IPROC) += clk-ns2.o - obj-$(CONFIG_ARCH_BCM_CYGNUS) += clk-cygnus.o - obj-$(CONFIG_ARCH_BCM_NSP) += clk-nsp.o -diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig -index e842e86..c9d1558 100644 ---- a/drivers/spi/Kconfig -+++ b/drivers/spi/Kconfig -@@ -90,7 +90,7 @@ config SPI_BCM2835 - - config SPI_BCM2835AUX - tristate "BCM2835 SPI auxiliary controller" -- depends on ARCH_BCM2835 || COMPILE_TEST -+ depends on ARCH_BCM2835 || ARCH_BCM2708 || ARCH_BCM2709 || COMPILE_TEST - depends on GPIOLIB - help - This selects a driver for the Broadcom BCM2835 SPI aux master. - -From 84c2e063885bb0ae3d5d2ad2e24e7a2bdb5729ae Mon Sep 17 00:00:00 2001 -From: Matthias Reichl <hias@horus.com> -Date: Tue, 23 Feb 2016 17:28:23 +0100 -Subject: [PATCH 164/170] ASoC: bcm: add missing .owner fields in sound card - drivers - -If snd_soc_card.owner is not set the kernel won't do usage refcounting -and one can remove the card driver module while it's in use (eg playback -active) - which leads to a kernel crash. - -The missing owner field also prevents ALSA slot ordering -(options snd slots=module-name1,module-name-2,...) from working with -the I2S cards as it has no module name to match against. - -Fix these issues by setting the .owner field in the snd_soc_card structs. - -Signed-off-by: Matthias Reichl <hias@horus.com> ---- - sound/soc/bcm/hifiberry_amp.c | 1 + - sound/soc/bcm/hifiberry_dac.c | 1 + - sound/soc/bcm/hifiberry_dacplus.c | 1 + - sound/soc/bcm/hifiberry_digi.c | 1 + - sound/soc/bcm/iqaudio-dac.c | 1 + - sound/soc/bcm/raspidac3.c | 1 + - sound/soc/bcm/rpi-dac.c | 1 + - sound/soc/bcm/rpi-proto.c | 1 + - 8 files changed, 8 insertions(+) - -diff --git a/sound/soc/bcm/hifiberry_amp.c b/sound/soc/bcm/hifiberry_amp.c -index 5903915..0bb12e4 100644 ---- a/sound/soc/bcm/hifiberry_amp.c -+++ b/sound/soc/bcm/hifiberry_amp.c -@@ -61,6 +61,7 @@ static struct snd_soc_dai_link snd_rpi_hifiberry_amp_dai[] = { - - static struct snd_soc_card snd_rpi_hifiberry_amp = { - .name = "snd_rpi_hifiberry_amp", -+ .owner = THIS_MODULE, - .dai_link = snd_rpi_hifiberry_amp_dai, - .num_links = ARRAY_SIZE(snd_rpi_hifiberry_amp_dai), - }; -diff --git a/sound/soc/bcm/hifiberry_dac.c b/sound/soc/bcm/hifiberry_dac.c -index 3ab0f47..29ecc08 100644 ---- a/sound/soc/bcm/hifiberry_dac.c -+++ b/sound/soc/bcm/hifiberry_dac.c -@@ -63,6 +63,7 @@ static struct snd_soc_dai_link snd_rpi_hifiberry_dac_dai[] = { - /* audio machine driver */ - static struct snd_soc_card snd_rpi_hifiberry_dac = { - .name = "snd_rpi_hifiberry_dac", -+ .owner = THIS_MODULE, - .dai_link = snd_rpi_hifiberry_dac_dai, - .num_links = ARRAY_SIZE(snd_rpi_hifiberry_dac_dai), - }; -diff --git a/sound/soc/bcm/hifiberry_dacplus.c b/sound/soc/bcm/hifiberry_dacplus.c -index 153dbcd..03d8d2a 100644 ---- a/sound/soc/bcm/hifiberry_dacplus.c -+++ b/sound/soc/bcm/hifiberry_dacplus.c -@@ -287,6 +287,7 @@ static struct snd_soc_dai_link snd_rpi_hifiberry_dacplus_dai[] = { - /* audio machine driver */ - static struct snd_soc_card snd_rpi_hifiberry_dacplus = { - .name = "snd_rpi_hifiberry_dacplus", -+ .owner = THIS_MODULE, - .dai_link = snd_rpi_hifiberry_dacplus_dai, - .num_links = ARRAY_SIZE(snd_rpi_hifiberry_dacplus_dai), - }; -diff --git a/sound/soc/bcm/hifiberry_digi.c b/sound/soc/bcm/hifiberry_digi.c -index 80732b8..9840e15 100644 ---- a/sound/soc/bcm/hifiberry_digi.c -+++ b/sound/soc/bcm/hifiberry_digi.c -@@ -164,6 +164,7 @@ static struct snd_soc_dai_link snd_rpi_hifiberry_digi_dai[] = { - /* audio machine driver */ - static struct snd_soc_card snd_rpi_hifiberry_digi = { - .name = "snd_rpi_hifiberry_digi", -+ .owner = THIS_MODULE, - .dai_link = snd_rpi_hifiberry_digi_dai, - .num_links = ARRAY_SIZE(snd_rpi_hifiberry_digi_dai), - }; -diff --git a/sound/soc/bcm/iqaudio-dac.c b/sound/soc/bcm/iqaudio-dac.c -index 124d7a9..a5eaa9e 100644 ---- a/sound/soc/bcm/iqaudio-dac.c -+++ b/sound/soc/bcm/iqaudio-dac.c -@@ -77,6 +77,7 @@ static struct snd_soc_dai_link snd_rpi_iqaudio_dac_dai[] = { - /* audio machine driver */ - static struct snd_soc_card snd_rpi_iqaudio_dac = { - .name = "IQaudIODAC", -+ .owner = THIS_MODULE, - .dai_link = snd_rpi_iqaudio_dac_dai, - .num_links = ARRAY_SIZE(snd_rpi_iqaudio_dac_dai), - }; -diff --git a/sound/soc/bcm/raspidac3.c b/sound/soc/bcm/raspidac3.c -index 3cabf5b..e7422e2 100644 ---- a/sound/soc/bcm/raspidac3.c -+++ b/sound/soc/bcm/raspidac3.c -@@ -128,6 +128,7 @@ static struct snd_soc_dai_link snd_rpi_raspidac3_dai[] = { - /* audio machine driver */ - static struct snd_soc_card snd_rpi_raspidac3 = { - .name = "RaspiDAC Rev.3x HiFi Audio Card", -+ .owner = THIS_MODULE, - .dai_link = snd_rpi_raspidac3_dai, - .num_links = ARRAY_SIZE(snd_rpi_raspidac3_dai), - }; -diff --git a/sound/soc/bcm/rpi-dac.c b/sound/soc/bcm/rpi-dac.c -index d5fac1b..59dc89e 100644 ---- a/sound/soc/bcm/rpi-dac.c -+++ b/sound/soc/bcm/rpi-dac.c -@@ -60,6 +60,7 @@ static struct snd_soc_dai_link snd_rpi_rpi_dac_dai[] = { - /* audio machine driver */ - static struct snd_soc_card snd_rpi_rpi_dac = { - .name = "snd_rpi_rpi_dac", -+ .owner = THIS_MODULE, - .dai_link = snd_rpi_rpi_dac_dai, - .num_links = ARRAY_SIZE(snd_rpi_rpi_dac_dai), - }; -diff --git a/sound/soc/bcm/rpi-proto.c b/sound/soc/bcm/rpi-proto.c -index c6e45a0..9db678e 100644 ---- a/sound/soc/bcm/rpi-proto.c -+++ b/sound/soc/bcm/rpi-proto.c -@@ -91,6 +91,7 @@ static struct snd_soc_dai_link snd_rpi_proto_dai[] = { - /* audio machine driver */ - static struct snd_soc_card snd_rpi_proto = { - .name = "snd_rpi_proto", -+ .owner = THIS_MODULE, - .dai_link = snd_rpi_proto_dai, - .num_links = ARRAY_SIZE(snd_rpi_proto_dai), - }; - -From 18674a7da1c3d50d9c957a8f88aaea2aa653d223 Mon Sep 17 00:00:00 2001 -From: popcornmix <popcornmix@gmail.com> -Date: Wed, 20 Jan 2016 17:50:09 +0000 -Subject: [PATCH 165/170] smsx95xx: Add option to disable the crimes against - truesize fix - -It may improve iperf numbers on Pi 1, but may generate dmesg warnings and possibly cause network issues -See issue 1248. ---- - drivers/net/usb/smsc95xx.c | 8 ++++++++ - 1 file changed, 8 insertions(+) - mode change 100755 => 100644 drivers/net/usb/smsc95xx.c - -diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c -old mode 100755 -new mode 100644 -index 7483222..a61bd08 ---- a/drivers/net/usb/smsc95xx.c -+++ b/drivers/net/usb/smsc95xx.c -@@ -75,6 +75,10 @@ static bool turbo_mode = false; - module_param(turbo_mode, bool, 0644); - MODULE_PARM_DESC(turbo_mode, "Enable multiple frames per Rx transaction"); - -+static bool truesize_mode = false; -+module_param(truesize_mode, bool, 0644); -+MODULE_PARM_DESC(truesize_mode, "Report larger truesize value"); + - static char *macaddr = ":"; - module_param(macaddr, charp, 0); - MODULE_PARM_DESC(macaddr, "MAC address"); -@@ -1841,6 +1845,8 @@ static int smsc95xx_rx_fixup(struct usbnet *dev, struct sk_buff *skb) - if (dev->net->features & NETIF_F_RXCSUM) - smsc95xx_rx_csum_offload(skb); - skb_trim(skb, skb->len - 4); /* remove fcs */ -+ if (truesize_mode) -+ skb->truesize = size + sizeof(struct sk_buff); - - return 1; - } -@@ -1858,6 +1864,8 @@ static int smsc95xx_rx_fixup(struct usbnet *dev, struct sk_buff *skb) - if (dev->net->features & NETIF_F_RXCSUM) - smsc95xx_rx_csum_offload(ax_skb); - skb_trim(ax_skb, ax_skb->len - 4); /* remove fcs */ -+ if (truesize_mode) -+ ax_skb->truesize = size + sizeof(struct sk_buff); - - usbnet_skb_return(dev, ax_skb); - } - -From 5e3c3e845f998f86c2f22017576cb19e5d7fe9bb Mon Sep 17 00:00:00 2001 -From: popcornmix <popcornmix@gmail.com> -Date: Tue, 23 Feb 2016 19:56:04 +0000 -Subject: [PATCH 166/170] bcm2835-virtgpio: Virtual GPIO driver - -Add a virtual GPIO driver that uses the firmware mailbox interface to -request that the VPU toggles LEDs. ---- - arch/arm/configs/bcm2709_defconfig | 1 + - drivers/gpio/Kconfig | 6 + - drivers/gpio/Makefile | 1 + - drivers/gpio/gpio-bcm-virt.c | 180 +++++++++++++++++++++++++++++ - include/soc/bcm2835/raspberrypi-firmware.h | 1 + - 5 files changed, 189 insertions(+) - create mode 100644 drivers/gpio/gpio-bcm-virt.c - -diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig -index 76b3a88..6d6b519 100644 ---- a/arch/arm/configs/bcm2709_defconfig -+++ b/arch/arm/configs/bcm2709_defconfig -@@ -607,6 +607,7 @@ CONFIG_PPS=m - CONFIG_PPS_CLIENT_LDISC=m - CONFIG_PPS_CLIENT_GPIO=m - CONFIG_GPIO_SYSFS=y -+CONFIG_GPIO_BCM_VIRT=y - CONFIG_GPIO_ARIZONA=m - CONFIG_GPIO_STMPE=y - CONFIG_W1=m -diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig -index b18bea0..a1f4ccee 100644 ---- a/drivers/gpio/Kconfig -+++ b/drivers/gpio/Kconfig -@@ -132,6 +132,12 @@ config GPIO_BCM_KONA - help - Turn on GPIO support for Broadcom "Kona" chips. - -+config GPIO_BCM_VIRT -+ bool "Broadcom Virt GPIO" -+ depends on OF_GPIO && RASPBERRYPI_FIRMWARE && (ARCH_BCM2835 || ARCH_BCM2708 || ARCH_BCM2709 || COMPILE_TEST) -+ help -+ Turn on virtual GPIO support for Broadcom BCM283X chips. ++module_platform_driver(snd_rpi_justboom_dac_driver); + - config GPIO_BRCMSTB - tristate "BRCMSTB GPIO support" - default y if ARCH_BRCMSTB -diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile -index 986dbd8..b2ccc9f 100644 ---- a/drivers/gpio/Makefile -+++ b/drivers/gpio/Makefile -@@ -24,6 +24,7 @@ obj-$(CONFIG_GPIO_AMDPT) += gpio-amdpt.o - obj-$(CONFIG_GPIO_ARIZONA) += gpio-arizona.o - obj-$(CONFIG_ATH79) += gpio-ath79.o - obj-$(CONFIG_GPIO_BCM_KONA) += gpio-bcm-kona.o -+obj-$(CONFIG_GPIO_BCM_VIRT) += gpio-bcm-virt.o - obj-$(CONFIG_GPIO_BRCMSTB) += gpio-brcmstb.o - obj-$(CONFIG_GPIO_BT8XX) += gpio-bt8xx.o - obj-$(CONFIG_GPIO_CLPS711X) += gpio-clps711x.o -diff --git a/drivers/gpio/gpio-bcm-virt.c b/drivers/gpio/gpio-bcm-virt.c ++MODULE_AUTHOR("Milan Neskovic <info@justboom.co>"); ++MODULE_DESCRIPTION("ASoC Driver for JustBoom PI DAC HAT Sound Card"); ++MODULE_LICENSE("GPL v2"); +diff --git a/sound/soc/bcm/justboom-digi.c b/sound/soc/bcm/justboom-digi.c new file mode 100644 -index 0000000..53edcb4 +index 0000000..91acb66 --- /dev/null -+++ b/drivers/gpio/gpio-bcm-virt.c -@@ -0,0 +1,180 @@ ++++ b/sound/soc/bcm/justboom-digi.c +@@ -0,0 +1,215 @@ +/* -+ * brcmvirt GPIO driver ++ * ASoC Driver for JustBoom Raspberry Pi Digi HAT Sound Card + * -+ * Copyright (C) 2012,2013 Dom Cobley <popcornmix@gmail.com> -+ * Based on gpio-clps711x.c by Alexander Shiyan <shc_work@mail.ru> ++ * Author: Milan Neskovic ++ * Copyright 2016 ++ * based on code by Daniel Matuschek <info@crazy-audio.com> ++ * based on code by Florian Meier <florian.meier@koalo.de> + * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2 of the License, or -+ * (at your option) any later version. ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * version 2 as published by the Free Software Foundation. ++ * ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * General Public License for more details. + */ + -+#include <linux/err.h> -+#include <linux/gpio.h> +#include <linux/module.h> -+#include <linux/basic_mmio_gpio.h> +#include <linux/platform_device.h> -+#include <soc/bcm2835/raspberrypi-firmware.h> + -+#define MODULE_NAME "brcmvirt-gpio" -+#define NUM_GPIO 2 ++#include <sound/core.h> ++#include <sound/pcm.h> ++#include <sound/pcm_params.h> ++#include <sound/soc.h> ++#include <sound/jack.h> + -+struct brcmvirt_gpio { -+ struct gpio_chip gc; -+ u32 __iomem *ts_base; -+ /* two packed 16-bit counts of enabled and disables -+ Allows host to detect a brief enable that was missed */ -+ u32 enables_disables[NUM_GPIO]; -+}; ++#include "../codecs/wm8804.h" + -+static int brcmvirt_gpio_dir_in(struct gpio_chip *gc, unsigned off) ++static int snd_rpi_justboom_digi_init(struct snd_soc_pcm_runtime *rtd) +{ -+ struct brcmvirt_gpio *gpio; -+ gpio = container_of(gc, struct brcmvirt_gpio, gc); -+ return -EINVAL; -+} ++ struct snd_soc_codec *codec = rtd->codec; ++ ++ /* enable TX output */ ++ snd_soc_update_bits(codec, WM8804_PWRDN, 0x4, 0x0); + -+static int brcmvirt_gpio_dir_out(struct gpio_chip *gc, unsigned off, int val) -+{ -+ struct brcmvirt_gpio *gpio; -+ gpio = container_of(gc, struct brcmvirt_gpio, gc); + return 0; +} + -+static int brcmvirt_gpio_get(struct gpio_chip *gc, unsigned off) -+{ -+ struct brcmvirt_gpio *gpio; -+ unsigned v; -+ gpio = container_of(gc, struct brcmvirt_gpio, gc); -+ v = readl(gpio->ts_base + off); -+ return (v >> off) & 1; ++static int snd_rpi_justboom_digi_startup(struct snd_pcm_substream *substream) { ++ /* turn on digital output */ ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_codec *codec = rtd->codec; ++ snd_soc_update_bits(codec, WM8804_PWRDN, 0x3c, 0x00); ++ return 0; +} + -+static void brcmvirt_gpio_set(struct gpio_chip *gc, unsigned off, int val) -+{ -+ struct brcmvirt_gpio *gpio; -+ u16 enables, disables; -+ s16 diff; -+ bool lit; -+ gpio = container_of(gc, struct brcmvirt_gpio, gc); -+ enables = gpio->enables_disables[off] >> 16; -+ disables = gpio->enables_disables[off] >> 0; -+ diff = (s16)(enables - disables); -+ lit = diff > 0; -+ if ((val && lit) || (!val && !lit)) -+ return; -+ if (val) -+ enables++; -+ else -+ disables++; -+ diff = (s16)(enables - disables); -+ BUG_ON(diff != 0 && diff != 1); -+ gpio->enables_disables[off] = (enables << 16) | (disables << 0); -+ writel(gpio->enables_disables[off], gpio->ts_base + off); ++static void snd_rpi_justboom_digi_shutdown(struct snd_pcm_substream *substream) { ++ /* turn off output */ ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_codec *codec = rtd->codec; ++ snd_soc_update_bits(codec, WM8804_PWRDN, 0x3c, 0x3c); +} + -+static int brcmvirt_gpio_probe(struct platform_device *pdev) ++static int snd_rpi_justboom_digi_hw_params(struct snd_pcm_substream *substream, ++ struct snd_pcm_hw_params *params) +{ -+ struct device *dev = &pdev->dev; -+ struct device_node *np = dev->of_node; -+ struct device_node *fw_node; -+ struct rpi_firmware *fw; -+ struct brcmvirt_gpio *ucb; -+ u32 gpiovirtbuf; -+ int err = 0; ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_dai *codec_dai = rtd->codec_dai; ++ struct snd_soc_codec *codec = rtd->codec; ++ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; + -+ fw_node = of_parse_phandle(np, "firmware", 0); -+ if (!fw_node) { -+ dev_err(dev, "Missing firmware node\n"); -+ return -ENOENT; -+ } ++ int sysclk = 27000000; /* This is fixed on this board */ + -+ fw = rpi_firmware_get(fw_node); -+ if (!fw) -+ return -EPROBE_DEFER; ++ long mclk_freq=0; ++ int mclk_div=1; ++ int sampling_freq=1; + -+ err = rpi_firmware_property(fw, RPI_FIRMWARE_FRAMEBUFFER_GET_GPIOVIRTBUF, -+ &gpiovirtbuf, sizeof(gpiovirtbuf)); ++ int ret; + -+ if (err) { -+ dev_err(dev, "Failed to get gpiovirtbuf\n"); -+ goto err; -+ } ++ int samplerate = params_rate(params); + -+ if (!gpiovirtbuf) { -+ dev_err(dev, "No virtgpio buffer\n"); -+ err = -ENOENT; -+ goto err; ++ if (samplerate<=96000) { ++ mclk_freq=samplerate*256; ++ mclk_div=WM8804_MCLKDIV_256FS; ++ } else { ++ mclk_freq=samplerate*128; ++ mclk_div=WM8804_MCLKDIV_128FS; + } + -+ ucb = devm_kzalloc(dev, sizeof *ucb, GFP_KERNEL); -+ if (!ucb) { -+ err = -EINVAL; -+ goto err; ++ switch (samplerate) { ++ case 32000: ++ sampling_freq=0x03; ++ break; ++ case 44100: ++ sampling_freq=0x00; ++ break; ++ case 48000: ++ sampling_freq=0x02; ++ break; ++ case 88200: ++ sampling_freq=0x08; ++ break; ++ case 96000: ++ sampling_freq=0x0a; ++ break; ++ case 176400: ++ sampling_freq=0x0c; ++ break; ++ case 192000: ++ sampling_freq=0x0e; ++ break; ++ default: ++ dev_err(codec->dev, ++ "Failed to set WM8804 SYSCLK, unsupported samplerate %d\n", ++ samplerate); + } + -+ // mmap the physical memory -+ gpiovirtbuf &= ~0xc0000000; -+ ucb->ts_base = ioremap(gpiovirtbuf, 4096); -+ if (ucb->ts_base == NULL) { -+ dev_err(dev, "Failed to map physical address\n"); -+ err = -ENOENT; -+ goto err; ++ snd_soc_dai_set_clkdiv(codec_dai, WM8804_MCLK_DIV, mclk_div); ++ snd_soc_dai_set_pll(codec_dai, 0, 0, sysclk, mclk_freq); ++ ++ ret = snd_soc_dai_set_sysclk(codec_dai, WM8804_TX_CLKSRC_PLL, ++ sysclk, SND_SOC_CLOCK_OUT); ++ if (ret < 0) { ++ dev_err(codec->dev, ++ "Failed to set WM8804 SYSCLK: %d\n", ret); ++ return ret; + } + -+ ucb->gc.label = MODULE_NAME; -+ ucb->gc.owner = THIS_MODULE; -+ ucb->gc.dev = dev; -+ ucb->gc.of_node = np; -+ ucb->gc.base = 100; -+ ucb->gc.ngpio = NUM_GPIO; ++ /* Enable TX output */ ++ snd_soc_update_bits(codec, WM8804_PWRDN, 0x4, 0x0); + -+ ucb->gc.direction_input = brcmvirt_gpio_dir_in; -+ ucb->gc.direction_output = brcmvirt_gpio_dir_out; -+ ucb->gc.get = brcmvirt_gpio_get; -+ ucb->gc.set = brcmvirt_gpio_set; -+ ucb->gc.can_sleep = true; ++ /* Power on */ ++ snd_soc_update_bits(codec, WM8804_PWRDN, 0x9, 0); + -+ err = gpiochip_add(&ucb->gc); -+ if (err) -+ goto err; ++ /* set sampling frequency status bits */ ++ snd_soc_update_bits(codec, WM8804_SPDTX4, 0x0f, sampling_freq); + -+ platform_set_drvdata(pdev, ucb); ++ return snd_soc_dai_set_bclk_ratio(cpu_dai,64); ++} + -+err: -+ return err; ++/* machine stream operations */ ++static struct snd_soc_ops snd_rpi_justboom_digi_ops = { ++ .hw_params = snd_rpi_justboom_digi_hw_params, ++ .startup = snd_rpi_justboom_digi_startup, ++ .shutdown = snd_rpi_justboom_digi_shutdown, ++}; + -+} ++static struct snd_soc_dai_link snd_rpi_justboom_digi_dai[] = { ++{ ++ .name = "JustBoom Digi", ++ .stream_name = "JustBoom Digi HiFi", ++ .cpu_dai_name = "bcm2708-i2s.0", ++ .codec_dai_name = "wm8804-spdif", ++ .platform_name = "bcm2708-i2s.0", ++ .codec_name = "wm8804.1-003b", ++ .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | ++ SND_SOC_DAIFMT_CBM_CFM, ++ .ops = &snd_rpi_justboom_digi_ops, ++ .init = snd_rpi_justboom_digi_init, ++}, ++}; + -+static int brcmvirt_gpio_remove(struct platform_device *pdev) ++/* audio machine driver */ ++static struct snd_soc_card snd_rpi_justboom_digi = { ++ .name = "snd_rpi_justboom_digi", ++ .owner = THIS_MODULE, ++ .dai_link = snd_rpi_justboom_digi_dai, ++ .num_links = ARRAY_SIZE(snd_rpi_justboom_digi_dai), ++}; ++ ++static int snd_rpi_justboom_digi_probe(struct platform_device *pdev) +{ -+ int err = 0; -+ struct brcmvirt_gpio *ucb = platform_get_drvdata(pdev); ++ int ret = 0; + -+ gpiochip_remove(&ucb->gc); -+ iounmap(ucb->ts_base); -+ return err; ++ snd_rpi_justboom_digi.dev = &pdev->dev; ++ ++ if (pdev->dev.of_node) { ++ struct device_node *i2s_node; ++ struct snd_soc_dai_link *dai = &snd_rpi_justboom_digi_dai[0]; ++ i2s_node = of_parse_phandle(pdev->dev.of_node, ++ "i2s-controller", 0); ++ ++ if (i2s_node) { ++ dai->cpu_dai_name = NULL; ++ dai->cpu_of_node = i2s_node; ++ dai->platform_name = NULL; ++ dai->platform_of_node = i2s_node; ++ } ++ } ++ ++ ret = snd_soc_register_card(&snd_rpi_justboom_digi); ++ if (ret) ++ dev_err(&pdev->dev, ++ "snd_soc_register_card() failed: %d\n", ret); ++ ++ return ret; +} + -+static const struct of_device_id __maybe_unused brcmvirt_gpio_ids[] = { -+ { .compatible = "brcm,bcm2835-virtgpio" }, -+ { } ++static int snd_rpi_justboom_digi_remove(struct platform_device *pdev) ++{ ++ return snd_soc_unregister_card(&snd_rpi_justboom_digi); ++} ++ ++static const struct of_device_id snd_rpi_justboom_digi_of_match[] = { ++ { .compatible = "justboom,justboom-digi", }, ++ {}, +}; -+MODULE_DEVICE_TABLE(of, brcmvirt_gpio_ids); ++MODULE_DEVICE_TABLE(of, snd_rpi_justboom_digi_of_match); + -+static struct platform_driver brcmvirt_gpio_driver = { -+ .driver = { -+ .name = MODULE_NAME, -+ .owner = THIS_MODULE, -+ .of_match_table = of_match_ptr(brcmvirt_gpio_ids), ++static struct platform_driver snd_rpi_justboom_digi_driver = { ++ .driver = { ++ .name = "snd-rpi-justboom-digi", ++ .owner = THIS_MODULE, ++ .of_match_table = snd_rpi_justboom_digi_of_match, + }, -+ .probe = brcmvirt_gpio_probe, -+ .remove = brcmvirt_gpio_remove, ++ .probe = snd_rpi_justboom_digi_probe, ++ .remove = snd_rpi_justboom_digi_remove, +}; -+module_platform_driver(brcmvirt_gpio_driver); + -+MODULE_LICENSE("GPL"); -+MODULE_AUTHOR("Dom Cobley <popcornmix@gmail.com>"); -+MODULE_DESCRIPTION("brcmvirt GPIO driver"); -+MODULE_ALIAS("platform:brcmvirt-gpio"); -diff --git a/include/soc/bcm2835/raspberrypi-firmware.h b/include/soc/bcm2835/raspberrypi-firmware.h -index b011489..c844968 100644 ---- a/include/soc/bcm2835/raspberrypi-firmware.h -+++ b/include/soc/bcm2835/raspberrypi-firmware.h -@@ -93,6 +93,7 @@ enum rpi_firmware_property_tag { - RPI_FIRMWARE_FRAMEBUFFER_GET_OVERSCAN = 0x0004000a, - RPI_FIRMWARE_FRAMEBUFFER_GET_PALETTE = 0x0004000b, - RPI_FIRMWARE_FRAMEBUFFER_GET_TOUCHBUF = 0x0004000f, -+ RPI_FIRMWARE_FRAMEBUFFER_GET_GPIOVIRTBUF = 0x00040010, - RPI_FIRMWARE_FRAMEBUFFER_RELEASE = 0x00048001, - RPI_FIRMWARE_FRAMEBUFFER_TEST_PHYSICAL_WIDTH_HEIGHT = 0x00044003, - RPI_FIRMWARE_FRAMEBUFFER_TEST_VIRTUAL_WIDTH_HEIGHT = 0x00044004, ++module_platform_driver(snd_rpi_justboom_digi_driver); ++ ++MODULE_AUTHOR("Milan Neskovic <info@justboom.co>"); ++MODULE_DESCRIPTION("ASoC Driver for JustBoom PI Digi HAT Sound Card"); ++MODULE_LICENSE("GPL v2"); -From 6aa2c847f76f21c830544e8c79f9030a170ef475 Mon Sep 17 00:00:00 2001 -From: Phil Elwell <phil@raspberrypi.org> -Date: Thu, 21 Jan 2016 17:57:49 +0000 -Subject: [PATCH 167/170] BCM270X_DT: Add Pi3 support +From 2fc52b7468ac688af8a702978eb688fac59eb97b Mon Sep 17 00:00:00 2001 +From: Eric Anholt <eric@anholt.net> +Date: Tue, 19 Apr 2016 15:55:02 -0700 +Subject: [PATCH 107/112] ARM: bcm2708: Enable building power domain driver. +Signed-off-by: Eric Anholt <eric@anholt.net> --- - arch/arm/boot/dts/Makefile | 1 + - arch/arm/boot/dts/bcm2710-rpi-3-b.dts | 174 ++++++++++++++++++++++++++++++++++ - arch/arm/boot/dts/bcm2710.dtsi | 102 ++++++++++++++++++++ - 3 files changed, 277 insertions(+) - create mode 100644 arch/arm/boot/dts/bcm2710-rpi-3-b.dts - create mode 100644 arch/arm/boot/dts/bcm2710.dtsi + drivers/soc/bcm/Kconfig | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) -diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile -index d583e67..fdc450f4 100644 ---- a/arch/arm/boot/dts/Makefile -+++ b/arch/arm/boot/dts/Makefile -@@ -5,6 +5,7 @@ dtb-$(CONFIG_ARCH_BCM2708) += bcm2708-rpi-b-plus.dtb - dtb-$(CONFIG_ARCH_BCM2708) += bcm2708-rpi-cm.dtb - dtb-$(CONFIG_ARCH_BCM2835) += bcm2835-rpi-cm.dtb - dtb-$(CONFIG_ARCH_BCM2709) += bcm2709-rpi-2-b.dtb -+dtb-$(CONFIG_ARCH_BCM2709) += bcm2710-rpi-3-b.dtb +diff --git a/drivers/soc/bcm/Kconfig b/drivers/soc/bcm/Kconfig +index 3066ede..e235181 100644 +--- a/drivers/soc/bcm/Kconfig ++++ b/drivers/soc/bcm/Kconfig +@@ -1,6 +1,6 @@ + config RASPBERRYPI_POWER + bool "Raspberry Pi power domain driver" +- depends on ARCH_BCM2835 || COMPILE_TEST ++ depends on ARCH_BCM2835 || ARCH_BCM2708 || ARCH_BCM2709 || COMPILE_TEST + depends on RASPBERRYPI_FIRMWARE=y + select PM_GENERIC_DOMAINS if PM + select PM_GENERIC_DOMAINS_OF if PM + +From 1acf838a61e40b5f1a59152810802e6e2db3d273 Mon Sep 17 00:00:00 2001 +From: Andrey Grodzovsky <andrey2805@gmail.com> +Date: Tue, 3 May 2016 22:10:59 -0400 +Subject: [PATCH 108/112] ARM: adau1977-adc: Add basic machine driver for + adau1977 codec driver. + +This commit adds basic support for the codec usage including: Device tree overlay, +binding I2S bus and setting I2S mode, clock source and frequency setting according +to spec. + +Signed-off-by: Andrey Grodzovsky <andrey2805@gmail.com> +--- + sound/soc/bcm/Kconfig | 7 +++ + sound/soc/bcm/Makefile | 2 + + sound/soc/bcm/adau1977-adc.c | 125 +++++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 134 insertions(+) + create mode 100644 sound/soc/bcm/adau1977-adc.c + +diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig +index e2e2782..59890cc 100644 +--- a/sound/soc/bcm/Kconfig ++++ b/sound/soc/bcm/Kconfig +@@ -78,3 +78,10 @@ config SND_BCM2708_SOC_RASPIDAC3 + select SND_SOC_TPA6130A2 + help + Say Y or M if you want to add support for RaspiDAC Rev.3x. ++ ++config SND_BCM2708_SOC_ADAU1977_ADC ++ tristate "Support for ADAU1977 ADC" ++ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S ++ select SND_SOC_ADAU1977_I2C ++ help ++ Say Y or M if you want to add support for ADAU1977 ADC. +diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile +index 6c9714c..d3124f5 100644 +--- a/sound/soc/bcm/Makefile ++++ b/sound/soc/bcm/Makefile +@@ -4,6 +4,7 @@ snd-soc-bcm2835-i2s-objs := bcm2835-i2s.o + obj-$(CONFIG_SND_BCM2835_SOC_I2S) += snd-soc-bcm2835-i2s.o - # Raspberry Pi - ifeq ($(CONFIG_ARCH_BCM2708),y) -diff --git a/arch/arm/boot/dts/bcm2710-rpi-3-b.dts b/arch/arm/boot/dts/bcm2710-rpi-3-b.dts + # BCM2708 Machine Support ++snd-soc-adau1977-adc-objs := adau1977-adc.o + snd-soc-hifiberry-dac-objs := hifiberry_dac.o + snd-soc-hifiberry-dacplus-objs := hifiberry_dacplus.o + snd-soc-hifiberry-digi-objs := hifiberry_digi.o +@@ -15,6 +16,7 @@ snd-soc-rpi-proto-objs := rpi-proto.o + snd-soc-iqaudio-dac-objs := iqaudio-dac.o + snd-soc-raspidac3-objs := raspidac3.o + ++obj-$(CONFIG_SND_BCM2708_SOC_ADAU1977_ADC) += snd-soc-adau1977-adc.o + obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o + obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS) += snd-soc-hifiberry-dacplus.o + obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI) += snd-soc-hifiberry-digi.o +diff --git a/sound/soc/bcm/adau1977-adc.c b/sound/soc/bcm/adau1977-adc.c new file mode 100644 -index 0000000..a6ecb51 +index 0000000..6e2ee02 --- /dev/null -+++ b/arch/arm/boot/dts/bcm2710-rpi-3-b.dts -@@ -0,0 +1,174 @@ -+/dts-v1/; ++++ b/sound/soc/bcm/adau1977-adc.c +@@ -0,0 +1,125 @@ ++/* ++ * ASoC Driver for ADAU1977 ADC ++ * ++ * Author: Andrey Grodzovsky <andrey2805@gmail.com> ++ * Copyright 2016 ++ * ++ * This file is based on hifibery_dac driver by Florian Meier. ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * version 2 as published by the Free Software Foundation. ++ * ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * General Public License for more details. ++ */ + -+#include "bcm2710.dtsi" ++#include <linux/module.h> ++#include <linux/platform_device.h> + -+/ { -+ compatible = "brcm,bcm2710","brcm,bcm2709"; -+ model = "Raspberry Pi 3 Model B"; ++#include <sound/core.h> ++#include <sound/pcm.h> ++#include <sound/pcm_params.h> ++#include <sound/soc.h> ++#include <sound/jack.h> ++ ++enum adau1977_clk_id { ++ ADAU1977_SYSCLK, ++}; ++ ++enum adau1977_sysclk_src { ++ ADAU1977_SYSCLK_SRC_MCLK, ++ ADAU1977_SYSCLK_SRC_LRCLK, +}; + -+&gpio { -+ sdhost_pins: sdhost_pins { -+ brcm,pins = <48 49 50 51 52 53>; -+ brcm,function = <4>; /* alt0 */ -+ }; ++static int eval_adau1977_init(struct snd_soc_pcm_runtime *rtd) ++{ ++ int ret; ++ struct snd_soc_dai *codec_dai = rtd->codec_dai; ++ ++ ret = snd_soc_dai_set_tdm_slot(codec_dai, 0, 0, 0, 0); ++ if (ret < 0) ++ return ret; + -+ spi0_pins: spi0_pins { -+ brcm,pins = <9 10 11>; -+ brcm,function = <4>; /* alt0 */ -+ }; ++ return snd_soc_codec_set_sysclk(rtd->codec, ADAU1977_SYSCLK, ++ ADAU1977_SYSCLK_SRC_MCLK, 11289600, SND_SOC_CLOCK_IN); ++} ++ ++static struct snd_soc_dai_link snd_rpi_adau1977_dai[] = { ++ { ++ .name = "adau1977", ++ .stream_name = "ADAU1977", ++ .cpu_dai_name = "bcm2708-i2s.0", ++ .codec_dai_name = "adau1977-hifi", ++ .platform_name = "bcm2708-i2s.0", ++ .codec_name = "adau1977.1-0011", ++ .init = eval_adau1977_init, ++ .dai_fmt = SND_SOC_DAIFMT_I2S | ++ SND_SOC_DAIFMT_NB_NF | ++ SND_SOC_DAIFMT_CBM_CFM, ++ }, ++}; + -+ spi0_cs_pins: spi0_cs_pins { -+ brcm,pins = <8 7>; -+ brcm,function = <1>; /* output */ -+ }; ++/* audio machine driver */ ++static struct snd_soc_card snd_adau1977_adc = { ++ .name = "snd_rpi_adau1977_adc", ++ .owner = THIS_MODULE, ++ .dai_link = snd_rpi_adau1977_dai, ++ .num_links = ARRAY_SIZE(snd_rpi_adau1977_dai), ++}; + -+ i2c0_pins: i2c0 { -+ brcm,pins = <0 1>; -+ brcm,function = <4>; -+ }; ++static int snd_adau1977_adc_probe(struct platform_device *pdev) ++{ ++ int ret = 0; + -+ i2c1_pins: i2c1 { -+ brcm,pins = <2 3>; -+ brcm,function = <4>; -+ }; ++ snd_adau1977_adc.dev = &pdev->dev; ++ if (pdev->dev.of_node) { ++ struct device_node *i2s_node; ++ struct snd_soc_dai_link *dai = &snd_rpi_adau1977_dai[0]; ++ i2s_node = of_parse_phandle(pdev->dev.of_node, ++ "i2s-controller", 0); + -+ i2s_pins: i2s { -+ brcm,pins = <18 19 20 21>; -+ brcm,function = <4>; /* alt0 */ -+ }; ++ if (i2s_node) { ++ dai->cpu_dai_name = NULL; ++ dai->cpu_of_node = i2s_node; ++ dai->platform_name = NULL; ++ dai->platform_of_node = i2s_node; ++ } ++ } + -+ sdio_pins: sdio_pins { -+ brcm,pins = <34 35 36 37 38 39>; -+ brcm,function = <7>; // alt3 = SD1 -+ brcm,pull = <0 2 2 2 2 2>; -+ }; ++ ret = snd_soc_register_card(&snd_adau1977_adc); ++ if (ret) ++ dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", ret); + -+ bt_pins: bt_pins { -+ brcm,pins = <28 29 30 31 14 15 43>; -+ brcm,function = <6 6 6 6 2 2 4>; -+ // alt2:PCM alt5:UART1 alt0:GPCLK2 -+ brcm,pull = <0 0 0 0 0 2 0>; -+ }; ++ return ret; ++} + -+ uart1_pins: uart1_pins { -+ brcm,pins = <32 33>; -+ brcm,function = <7>; /* alt3=UART0 */ -+ brcm,pull = <0>; -+ }; -+}; ++static int snd_adau1977_adc_remove(struct platform_device *pdev) ++{ ++ return snd_soc_unregister_card(&snd_adau1977_adc); ++} + -+&sdhost { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&sdhost_pins>; -+ bus-width = <4>; -+ status = "okay"; ++static const struct of_device_id snd_adau1977_adc_of_match[] = { ++ { .compatible = "adi,adau1977-adc", }, ++ {}, +}; + -+&mmc { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&sdio_pins>; -+ non-removable; -+ bus-width = <4>; -+ status = "okay"; -+}; ++MODULE_DEVICE_TABLE(of, snd_adau1977_adc_of_match); + -+&fb { -+ status = "okay"; ++static struct platform_driver snd_adau1977_adc_driver = { ++ .driver = { ++ .name = "snd-adau1977-adc", ++ .owner = THIS_MODULE, ++ .of_match_table = snd_adau1977_adc_of_match, ++ }, ++ .probe = snd_adau1977_adc_probe, ++ .remove = snd_adau1977_adc_remove, +}; + -+&uart0 { -+ status = "okay"; -+}; ++module_platform_driver(snd_adau1977_adc_driver); + -+&uart1 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&uart1_pins &bt_pins>; -+ status = "okay"; -+}; ++MODULE_AUTHOR("Andrey Grodzovsky <andrey2805@gmail.com>"); ++MODULE_DESCRIPTION("ASoC Driver for ADAU1977 ADC"); ++MODULE_LICENSE("GPL v2"); + +From ae03e3ad4d50779677d0cf9ca847c8a1b4372e1c Mon Sep 17 00:00:00 2001 +From: Matt Flax <flatmax@flatmax.org> +Date: Mon, 16 May 2016 21:36:31 +1000 +Subject: [PATCH 109/112] New AudioInjector.net Pi soundcard with low jitter + audio in and out. + +Contains the sound/soc/bcm ALSA machine driver and necessary alterations to the Kconfig and Makefile. +Adds the dts overlay and updates the Makefile and README. +Updates the relevant defconfig files to enable building for the Raspberry Pi. +Thanks to Phil Elwell (pelwell) for the review, simple-card concepts and discussion. Thanks to Clive Messer for overlay naming suggestions. +--- + sound/soc/bcm/Kconfig | 7 ++ + sound/soc/bcm/Makefile | 3 + + sound/soc/bcm/audioinjector-pi-soundcard.c | 142 +++++++++++++++++++++++++++++ + 3 files changed, 152 insertions(+) + create mode 100644 sound/soc/bcm/audioinjector-pi-soundcard.c + +diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig +index 59890cc..e2e40ed 100644 +--- a/sound/soc/bcm/Kconfig ++++ b/sound/soc/bcm/Kconfig +@@ -85,3 +85,10 @@ config SND_BCM2708_SOC_ADAU1977_ADC + select SND_SOC_ADAU1977_I2C + help + Say Y or M if you want to add support for ADAU1977 ADC. + -+&spi0 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&spi0_pins &spi0_cs_pins>; -+ cs-gpios = <&gpio 8 1>, <&gpio 7 1>; ++config SND_AUDIOINJECTOR_PI_SOUNDCARD ++ tristate "Support for audioinjector.net Pi add on soundcard" ++ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S ++ select SND_SOC_WM8731 ++ help ++ Say Y or M if you want to add support for audioinjector.net Pi Hat +diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile +index d3124f5..3353192 100644 +--- a/sound/soc/bcm/Makefile ++++ b/sound/soc/bcm/Makefile +@@ -15,6 +15,7 @@ snd-soc-rpi-dac-objs := rpi-dac.o + snd-soc-rpi-proto-objs := rpi-proto.o + snd-soc-iqaudio-dac-objs := iqaudio-dac.o + snd-soc-raspidac3-objs := raspidac3.o ++snd-soc-audioinjector-pi-soundcard-objs := audioinjector-pi-soundcard.o + + obj-$(CONFIG_SND_BCM2708_SOC_ADAU1977_ADC) += snd-soc-adau1977-adc.o + obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o +@@ -27,3 +28,5 @@ obj-$(CONFIG_SND_BCM2708_SOC_RPI_DAC) += snd-soc-rpi-dac.o + obj-$(CONFIG_SND_BCM2708_SOC_RPI_PROTO) += snd-soc-rpi-proto.o + obj-$(CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC) += snd-soc-iqaudio-dac.o + obj-$(CONFIG_SND_BCM2708_SOC_RASPIDAC3) += snd-soc-raspidac3.o ++obj-$(CONFIG_SND_AUDIOINJECTOR_PI_SOUNDCARD) += snd-soc-audioinjector-pi-soundcard.o + -+ spidev@0{ -+ compatible = "spidev"; -+ reg = <0>; /* CE0 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; -+ }; +diff --git a/sound/soc/bcm/audioinjector-pi-soundcard.c b/sound/soc/bcm/audioinjector-pi-soundcard.c +new file mode 100644 +index 0000000..39f29e2 +--- /dev/null ++++ b/sound/soc/bcm/audioinjector-pi-soundcard.c +@@ -0,0 +1,142 @@ ++/* ++ * ASoC Driver for AudioInjector Pi add on soundcard ++ * ++ * Created on: 13-May-2016 ++ * Author: flatmax@flatmax.org ++ * based on code by Cliff Cai <Cliff.Cai@analog.com> for the ssm2602 machine blackfin. ++ * with help from Lars-Peter Clausen for simplifying the original code to use the dai_fmt field. ++ * i2s_node code taken from the other sound/soc/bcm machine drivers. ++ * ++ * Copyright (C) 2016 Flatmax Pty. Ltd. ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * version 2 as published by the Free Software Foundation. ++ * ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * General Public License for more details. ++ */ + -+ spidev@1{ -+ compatible = "spidev"; -+ reg = <1>; /* CE1 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; -+ }; -+}; ++#include <linux/module.h> ++#include <linux/types.h> + -+&i2c0 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&i2c0_pins>; -+ clock-frequency = <100000>; -+}; ++#include <sound/core.h> ++#include <sound/soc.h> ++#include <sound/pcm_params.h> ++#include <sound/control.h> + -+&i2c1 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&i2c1_pins>; -+ clock-frequency = <100000>; -+}; ++#include "../codecs/wm8731.h" + -+&i2c2 { -+ clock-frequency = <100000>; -+}; ++static int audioinjector_pi_soundcard_dai_init(struct snd_soc_pcm_runtime *rtd) ++{ ++ struct snd_soc_dapm_context *dapm = &rtd->card->dapm; + -+&i2s { -+ #sound-dai-cells = <0>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&i2s_pins>; -+}; ++ // not connected ++ snd_soc_dapm_nc_pin(dapm, "Mic Bias"); ++ snd_soc_dapm_nc_pin(dapm, "MICIN"); ++ snd_soc_dapm_nc_pin(dapm, "RHPOUT"); ++ snd_soc_dapm_nc_pin(dapm, "LHPOUT"); + -+&random { -+ status = "okay"; -+}; ++ return snd_soc_dai_set_sysclk(rtd->codec_dai, WM8731_SYSCLK_XTAL, 12000000, SND_SOC_CLOCK_IN); ++} + -+&leds { -+ act_led: act { -+ label = "led0"; -+ linux,default-trigger = "mmc0"; -+ gpios = <&gpio 47 0>; -+ }; ++static struct snd_soc_dai_link audioinjector_pi_soundcard_dai[] = { ++ { ++ .name = "AudioInjector audio", ++ .stream_name = "AudioInjector audio", ++ .cpu_dai_name = "bcm2708-i2s.0", ++ .codec_dai_name = "wm8731-hifi", ++ .platform_name = "bcm2835-i2s.0", ++ .codec_name = "wm8731.1-001a", ++ .init = audioinjector_pi_soundcard_dai_init, ++ .dai_fmt = SND_SOC_DAIFMT_CBM_CFM|SND_SOC_DAIFMT_I2S|SND_SOC_DAIFMT_NB_NF, ++ }, +}; + -+/ { -+ chosen { -+ bootargs = "8250.nr_uarts=1"; -+ }; ++static const struct snd_soc_dapm_widget wm8731_dapm_widgets[] = { ++ SND_SOC_DAPM_SPK("Ext Spk", NULL), ++ SND_SOC_DAPM_LINE("Line In Jacks", NULL), +}; + -+/ { -+ __overrides__ { -+ uart0 = <&uart0>,"status"; -+ uart0_clkrate = <&clk_uart0>,"clock-frequency:0"; -+ i2s = <&i2s>,"status"; -+ spi = <&spi0>,"status"; -+ i2c0 = <&i2c0>,"status"; -+ i2c1 = <&i2c1>,"status"; -+ i2c2_iknowwhatimdoing = <&i2c2>,"status"; -+ i2c0_baudrate = <&i2c0>,"clock-frequency:0"; -+ i2c1_baudrate = <&i2c1>,"clock-frequency:0"; -+ i2c2_baudrate = <&i2c2>,"clock-frequency:0"; -+ core_freq = <&clk_core>,"clock-frequency:0"; -+ -+ act_led_gpio = <&act_led>,"gpios:4"; -+ act_led_activelow = <&act_led>,"gpios:8"; -+ act_led_trigger = <&act_led>,"linux,default-trigger"; ++/* Corgi machine connections to the codec pins */ ++static const struct snd_soc_dapm_route audioinjector_audio_map[] = { ++ /* speaker connected to LOUT, ROUT */ ++ {"Ext Spk", NULL, "ROUT"}, ++ {"Ext Spk", NULL, "LOUT"}, + -+ audio = <&audio>,"status"; -+ watchdog = <&watchdog>,"status"; -+ random = <&random>,"status"; -+ }; ++ /* line inputs */ ++ {"Line In Jacks", NULL, "Line Input"}, +}; -diff --git a/arch/arm/boot/dts/bcm2710.dtsi b/arch/arm/boot/dts/bcm2710.dtsi -new file mode 100644 -index 0000000..1a48686 ---- /dev/null -+++ b/arch/arm/boot/dts/bcm2710.dtsi -@@ -0,0 +1,102 @@ -+#include "bcm2708_common.dtsi" -+ -+/ { -+ compatible = "brcm,bcm2710","brcm,bcm2709"; -+ model = "BCM2710"; -+ -+ chosen { -+ /* No padding required - the boot loader can do that. */ -+ bootargs = ""; -+ }; -+ -+ soc { -+ ranges = <0x7e000000 0x3f000000 0x01000000>, -+ <0x40000000 0x40000000 0x00040000>; -+ -+ local_intc: local_intc { -+ compatible = "brcm,bcm2836-l1-intc"; -+ reg = <0x40000000 0x100>; -+ interrupt-controller; -+ #interrupt-cells = <1>; -+ interrupt-parent = <&local_intc>; -+ }; -+ -+ arm-pmu { -+ compatible = "arm,cortex-a7-pmu"; -+ interrupt-parent = <&local_intc>; -+ interrupts = <9>; -+ }; + -+ gpiomem { -+ compatible = "brcm,bcm2835-gpiomem"; -+ reg = <0x7e200000 0x1000>; -+ status = "okay"; -+ }; ++static struct snd_soc_card snd_soc_audioinjector = { ++ .name = "audioinjector-pi-soundcard", ++ .dai_link = audioinjector_pi_soundcard_dai, ++ .num_links = 1, + -+ timer { -+ compatible = "arm,armv7-timer"; -+ clock-frequency = <19200000>; -+ interrupt-parent = <&local_intc>; -+ interrupts = <0>, // PHYS_SECURE_PPI -+ <1>, // PHYS_NONSECURE_PPI -+ <3>, // VIRT_PPI -+ <2>; // HYP_PPI -+ always-on; -+ }; ++ .dapm_widgets = wm8731_dapm_widgets, ++ .num_dapm_widgets = ARRAY_SIZE(wm8731_dapm_widgets), ++ .dapm_routes = audioinjector_audio_map, ++ .num_dapm_routes = ARRAY_SIZE(audioinjector_audio_map), ++}; + -+ syscon@40000000 { -+ compatible = "brcm,bcm2836-arm-local", "syscon"; -+ reg = <0x40000000 0x100>; -+ }; -+ }; ++static int audioinjector_pi_soundcard_probe(struct platform_device *pdev) ++{ ++ struct snd_soc_card *card = &snd_soc_audioinjector; ++ int ret; ++ ++ card->dev = &pdev->dev; + -+ cpus: cpus { -+ #address-cells = <1>; -+ #size-cells = <0>; ++ if (pdev->dev.of_node) { ++ struct snd_soc_dai_link *dai = &audioinjector_pi_soundcard_dai[0]; ++ struct device_node *i2s_node = of_parse_phandle(pdev->dev.of_node, ++ "i2s-controller", 0); + -+ v7_cpu0: cpu@0 { -+ device_type = "cpu"; -+ compatible = "arm,cortex-a7"; -+ reg = <0x000>; -+ clock-frequency = <800000000>; -+ }; ++ if (i2s_node) { ++ dai->cpu_dai_name = NULL; ++ dai->cpu_of_node = i2s_node; ++ dai->platform_name = NULL; ++ dai->platform_of_node = i2s_node; ++ } else ++ if (!dai->cpu_of_node) { ++ dev_err(&pdev->dev, "Property 'i2s-controller' missing or invalid\n"); ++ return -EINVAL; ++ } ++ } + -+ v7_cpu1: cpu@1 { -+ device_type = "cpu"; -+ compatible = "arm,cortex-a7"; -+ reg = <0x001>; -+ clock-frequency = <800000000>; -+ }; ++ if ((ret = snd_soc_register_card(card))) { ++ dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", ret); ++ } ++ return ret; ++} + -+ v7_cpu2: cpu@2 { -+ device_type = "cpu"; -+ compatible = "arm,cortex-a7"; -+ reg = <0x002>; -+ clock-frequency = <800000000>; -+ }; ++static int audioinjector_pi_soundcard_remove(struct platform_device *pdev) ++{ ++ struct snd_soc_card *card = platform_get_drvdata(pdev); ++ return snd_soc_unregister_card(card); + -+ v7_cpu3: cpu@3 { -+ device_type = "cpu"; -+ compatible = "arm,cortex-a7"; -+ reg = <0x003>; -+ clock-frequency = <800000000>; -+ }; -+ }; ++} + -+ __overrides__ { -+ arm_freq = <&v7_cpu0>, "clock-frequency:0", -+ <&v7_cpu1>, "clock-frequency:0", -+ <&v7_cpu2>, "clock-frequency:0", -+ <&v7_cpu3>, "clock-frequency:0"; -+ }; ++static const struct of_device_id audioinjector_pi_soundcard_of_match[] = { ++ { .compatible = "ai,audioinjector-pi-soundcard", }, ++ {}, +}; ++MODULE_DEVICE_TABLE(of, audioinjector_pi_soundcard_of_match); + -+&watchdog { -+ status = "okay"; ++static struct platform_driver audioinjector_pi_soundcard_driver = { ++ .driver = { ++ .name = "audioinjector-audio", ++ .owner = THIS_MODULE, ++ .of_match_table = audioinjector_pi_soundcard_of_match, ++ }, ++ .probe = audioinjector_pi_soundcard_probe, ++ .remove = audioinjector_pi_soundcard_remove, +}; + -+&intc { -+ compatible = "brcm,bcm2836-armctrl-ic"; -+ interrupt-parent = <&local_intc>; -+ interrupts = <8>; -+}; ++module_platform_driver(audioinjector_pi_soundcard_driver); ++MODULE_AUTHOR("Matt Flax <flatmax@flatmax.org>"); ++MODULE_DESCRIPTION("AudioInjector.net Pi Soundcard"); ++MODULE_LICENSE("GPL v2"); ++MODULE_ALIAS("platform:audioinjector-pi-soundcard"); ++ -From 52015bd5f0bb4d64ca51c5f8539cf2552dfb8a42 Mon Sep 17 00:00:00 2001 -From: Phil Elwell <phil@raspberrypi.org> -Date: Thu, 21 Jan 2016 17:57:49 +0000 -Subject: [PATCH 168/170] FIXUP: BCM270X_DT: Update to latest Pi3 DTS +From aa9aed28809dbf4d95025626cb5de26b7da023d1 Mon Sep 17 00:00:00 2001 +From: Dave Stevenson <6by9@users.noreply.github.com> +Date: Wed, 25 May 2016 23:25:36 +0100 +Subject: [PATCH 110/112] BCM2835-V4L2: Correct handling for BGR24 vs RGB24. +There was a bug in the GPU firmware that had reversed these +two formats. +Detect the old firmware, and reverse the formats if necessary. + +Signed-off-by: Dave Stevenson <6by9@users.noreply.github.com> --- - arch/arm/boot/dts/bcm2710-rpi-3-b.dts | 34 ++++++++++++++++++++++++++-------- - 1 file changed, 26 insertions(+), 8 deletions(-) + drivers/media/platform/bcm2835/bcm2835-camera.c | 69 ++++++++++++++++++------- + drivers/media/platform/bcm2835/bcm2835-camera.h | 1 + + 2 files changed, 52 insertions(+), 18 deletions(-) -diff --git a/arch/arm/boot/dts/bcm2710-rpi-3-b.dts b/arch/arm/boot/dts/bcm2710-rpi-3-b.dts -index a6ecb51..cc060898 100644 ---- a/arch/arm/boot/dts/bcm2710-rpi-3-b.dts -+++ b/arch/arm/boot/dts/bcm2710-rpi-3-b.dts -@@ -45,16 +45,21 @@ - }; +diff --git a/drivers/media/platform/bcm2835/bcm2835-camera.c b/drivers/media/platform/bcm2835/bcm2835-camera.c +index 1b16c63..70f4db2 100644 +--- a/drivers/media/platform/bcm2835/bcm2835-camera.c ++++ b/drivers/media/platform/bcm2835/bcm2835-camera.c +@@ -115,7 +115,7 @@ static struct mmal_fmt formats[] = { + .name = "RGB24 (LE)", + .fourcc = V4L2_PIX_FMT_RGB24, + .flags = 0, +- .mmal = MMAL_ENCODING_BGR24, ++ .mmal = MMAL_ENCODING_RGB24, + .depth = 24, + .mmal_component = MMAL_COMPONENT_CAMERA, + .ybbp = 3, +@@ -187,7 +187,7 @@ static struct mmal_fmt formats[] = { + .name = "RGB24 (BE)", + .fourcc = V4L2_PIX_FMT_BGR24, + .flags = 0, +- .mmal = MMAL_ENCODING_RGB24, ++ .mmal = MMAL_ENCODING_BGR24, + .depth = 24, + .mmal_component = MMAL_COMPONENT_CAMERA, + .ybbp = 3, +@@ -1061,6 +1061,13 @@ static int mmal_setup_components(struct bm2835_mmal_dev *dev, + else + camera_port->format.encoding = mfmt->mmal; - bt_pins: bt_pins { -- brcm,pins = <28 29 30 31 14 15 43>; -- brcm,function = <6 6 6 6 2 2 4>; -- // alt2:PCM alt5:UART1 alt0:GPCLK2 -- brcm,pull = <0 0 0 0 0 2 0>; -+ brcm,pins = <28 29 30 31 43>; -+ brcm,function = <6 6 6 6 4>; /* alt2:PCM alt0:GPCLK2 */ -+ brcm,pull = <0 0 0 0 0>; - }; ++ if (dev->rgb_bgr_swapped) { ++ if (camera_port->format.encoding == MMAL_ENCODING_RGB24) ++ camera_port->format.encoding = MMAL_ENCODING_BGR24; ++ else if (camera_port->format.encoding == MMAL_ENCODING_BGR24) ++ camera_port->format.encoding = MMAL_ENCODING_RGB24; ++ } ++ + camera_port->format.encoding_variant = 0; + camera_port->es.video.width = f->fmt.pix.width; + camera_port->es.video.height = f->fmt.pix.height; +@@ -1571,12 +1578,17 @@ static int set_camera_parameters(struct vchiq_mmal_instance *instance, + return ret; + } -- uart1_pins: uart1_pins { -+ uart0_pins: uart0_pins { - brcm,pins = <32 33>; - brcm,function = <7>; /* alt3=UART0 */ -- brcm,pull = <0>; -+ brcm,pull = <0 0>; -+ }; ++#define MAX_SUPPORTED_ENCODINGS 20 + -+ uart1_pins: uart1_pins { -+ brcm,pins = <14 15>; -+ brcm,function = <2>; /* alt5=UART1 */ -+ brcm,pull = <0 0>; - }; - }; + /* MMAL instance and component init */ + static int __init mmal_init(struct bm2835_mmal_dev *dev) + { + int ret; + struct mmal_es_format *format; + u32 bool_true = 1; ++ u32 supported_encodings[MAX_SUPPORTED_ENCODINGS]; ++ int param_size; ++ struct vchiq_mmal_component *camera; -@@ -71,6 +76,17 @@ - non-removable; - bus-width = <4>; - status = "okay"; -+ brcm,overclock-50 = <0>; -+}; + ret = vchiq_mmal_init(&dev->instance); + if (ret < 0) +@@ -1588,21 +1600,48 @@ static int __init mmal_init(struct bm2835_mmal_dev *dev) + if (ret < 0) + goto unreg_mmal; + +- if (dev->component[MMAL_COMPONENT_CAMERA]->outputs < +- MMAL_CAMERA_PORT_COUNT) { ++ camera = dev->component[MMAL_COMPONENT_CAMERA]; ++ if (camera->outputs < MMAL_CAMERA_PORT_COUNT) { + ret = -EINVAL; + goto unreg_camera; + } + + ret = set_camera_parameters(dev->instance, +- dev->component[MMAL_COMPONENT_CAMERA], ++ camera, + dev); + if (ret < 0) + goto unreg_camera; + +- format = +- &dev->component[MMAL_COMPONENT_CAMERA]-> +- output[MMAL_CAMERA_PORT_PREVIEW].format; ++ /* There was an error in the firmware that meant the camera component ++ * produced BGR instead of RGB. ++ * This is now fixed, but in order to support the old firmwares, we ++ * have to check. ++ */ ++ dev->rgb_bgr_swapped = true; ++ param_size = sizeof(supported_encodings); ++ ret = vchiq_mmal_port_parameter_get(dev->instance, ++ &camera->output[MMAL_CAMERA_PORT_CAPTURE], ++ MMAL_PARAMETER_SUPPORTED_ENCODINGS, ++ &supported_encodings, ++ &param_size); ++ if (ret == 0) { ++ int i; + -+&soc { -+ virtgpio: virtgpio { -+ compatible = "brcm,bcm2835-virtgpio"; -+ gpio-controller; -+ #gpio-cells = <2>; -+ firmware = <&firmware>; -+ status = "okay"; -+ }; - }; ++ for (i = 0; i < param_size/sizeof(u32); i++) { ++ if (supported_encodings[i] == MMAL_ENCODING_BGR24) { ++ /* Found BGR24 first - old firmware. */ ++ break; ++ } ++ if (supported_encodings[i] == MMAL_ENCODING_RGB24) { ++ /* Found RGB24 first ++ * new firmware, so use RGB24. ++ */ ++ dev->rgb_bgr_swapped = false; ++ break; ++ } ++ } ++ } ++ format = &camera->output[MMAL_CAMERA_PORT_PREVIEW].format; - &fb { -@@ -78,12 +94,14 @@ - }; + format->encoding = MMAL_ENCODING_OPAQUE; + format->encoding_variant = MMAL_ENCODING_I420; +@@ -1616,9 +1655,7 @@ static int __init mmal_init(struct bm2835_mmal_dev *dev) + format->es->video.frame_rate.num = 0; /* Rely on fps_range */ + format->es->video.frame_rate.den = 1; - &uart0 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&uart0_pins &bt_pins>; - status = "okay"; - }; +- format = +- &dev->component[MMAL_COMPONENT_CAMERA]-> +- output[MMAL_CAMERA_PORT_VIDEO].format; ++ format = &camera->output[MMAL_CAMERA_PORT_VIDEO].format; - &uart1 { - pinctrl-names = "default"; -- pinctrl-0 = <&uart1_pins &bt_pins>; -+ pinctrl-0 = <&uart1_pins>; - status = "okay"; - }; + format->encoding = MMAL_ENCODING_OPAQUE; + format->encoding_variant = MMAL_ENCODING_I420; +@@ -1633,14 +1670,11 @@ static int __init mmal_init(struct bm2835_mmal_dev *dev) + format->es->video.frame_rate.den = 1; -@@ -139,7 +157,7 @@ - act_led: act { - label = "led0"; - linux,default-trigger = "mmc0"; -- gpios = <&gpio 47 0>; -+ gpios = <&virtgpio 0 0>; - }; + vchiq_mmal_port_parameter_set(dev->instance, +- &dev->component[MMAL_COMPONENT_CAMERA]-> +- output[MMAL_CAMERA_PORT_VIDEO], ++ &camera->output[MMAL_CAMERA_PORT_VIDEO], + MMAL_PARAMETER_NO_IMAGE_PADDING, + &bool_true, sizeof(bool_true)); + +- format = +- &dev->component[MMAL_COMPONENT_CAMERA]-> +- output[MMAL_CAMERA_PORT_CAPTURE].format; ++ format = &camera->output[MMAL_CAMERA_PORT_CAPTURE].format; + + format->encoding = MMAL_ENCODING_OPAQUE; + +@@ -1662,8 +1696,7 @@ static int __init mmal_init(struct bm2835_mmal_dev *dev) + dev->capture.enc_level = V4L2_MPEG_VIDEO_H264_LEVEL_4_0; + + vchiq_mmal_port_parameter_set(dev->instance, +- &dev->component[MMAL_COMPONENT_CAMERA]-> +- output[MMAL_CAMERA_PORT_CAPTURE], ++ &camera->output[MMAL_CAMERA_PORT_CAPTURE], + MMAL_PARAMETER_NO_IMAGE_PADDING, + &bool_true, sizeof(bool_true)); + +diff --git a/drivers/media/platform/bcm2835/bcm2835-camera.h b/drivers/media/platform/bcm2835/bcm2835-camera.h +index 13f426f..e6aeb7e 100644 +--- a/drivers/media/platform/bcm2835/bcm2835-camera.h ++++ b/drivers/media/platform/bcm2835/bcm2835-camera.h +@@ -109,6 +109,7 @@ struct bm2835_mmal_dev { + unsigned int camera_num; + unsigned int max_width; + unsigned int max_height; ++ unsigned int rgb_bgr_swapped; }; + int bm2835_mmal_init_controls( + +From e17217216036509a8711ab042e4808b0b4c59a66 Mon Sep 17 00:00:00 2001 +From: escalator2015 <jmtasende@gmail.com> +Date: Tue, 24 May 2016 16:20:09 +0100 +Subject: [PATCH 111/112] New driver for RRA DigiDAC1 soundcard using WM8741 + + WM8804 -From 310f5af54ca26b68795f0376c67b41e2bb18a0e0 Mon Sep 17 00:00:00 2001 -From: Dave Stevenson <6by9@users.noreply.github.com> -Date: Mon, 8 Feb 2016 23:49:41 +0000 -Subject: [PATCH 169/170] DT: Add overlays to configure I2C pins - -Lifted from -https://www.raspberrypi.org/forums/viewtopic.php?f=107&t=120938&p=825883 -so not claiming this to be my own work. -Adds overlays i2c0-bcm2708 and i2c1-bcm2708 that allow the pin -allocations for i2c-0 and i2c-1 to be changed. --- - arch/arm/boot/dts/overlays/Makefile | 2 ++ - arch/arm/boot/dts/overlays/README | 16 ++++++++++ - .../arm/boot/dts/overlays/i2c0-bcm2708-overlay.dts | 36 +++++++++++++++++++++ - .../arm/boot/dts/overlays/i2c1-bcm2708-overlay.dts | 37 ++++++++++++++++++++++ - 4 files changed, 91 insertions(+) - create mode 100644 arch/arm/boot/dts/overlays/i2c0-bcm2708-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/i2c1-bcm2708-overlay.dts + arch/arm/configs/bcm2709_defconfig | 1 + + arch/arm/configs/bcmrpi_defconfig | 1 + + sound/soc/bcm/Kconfig | 8 + + sound/soc/bcm/Makefile | 2 + + sound/soc/bcm/digidac1-soundcard.c | 422 +++++++++++++++++++++++++++++++++++++ + 5 files changed, 434 insertions(+) + create mode 100644 sound/soc/bcm/digidac1-soundcard.c -diff --git a/arch/arm/boot/dts/overlays/Makefile b/arch/arm/boot/dts/overlays/Makefile -index a787d66..f2bc3ce 100644 ---- a/arch/arm/boot/dts/overlays/Makefile -+++ b/arch/arm/boot/dts/overlays/Makefile -@@ -29,6 +29,8 @@ dtb-$(RPI_DT_OVERLAYS) += hy28a-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += hy28b-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += i2c-rtc-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += i2c-gpio-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += i2c0-bcm2708-overlay.dtb -+dtb-$(RPI_DT_OVERLAYS) += i2c1-bcm2708-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += i2s-mmap-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += iqaudio-dac-overlay.dtb - dtb-$(RPI_DT_OVERLAYS) += iqaudio-dacplus-overlay.dtb -diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README -index cf5f5be..7d7bbb8 100644 ---- a/arch/arm/boot/dts/overlays/README -+++ b/arch/arm/boot/dts/overlays/README -@@ -371,6 +371,22 @@ Params: ds1307 Select the DS1307 device - pcf8563 Select the PCF8563 device +diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig +index 055ecfc..1643dab 100644 +--- a/arch/arm/configs/bcm2709_defconfig ++++ b/arch/arm/configs/bcm2709_defconfig +@@ -862,6 +862,7 @@ CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC=m + CONFIG_SND_BCM2708_SOC_RASPIDAC3=m + CONFIG_SND_BCM2708_SOC_ADAU1977_ADC=m + CONFIG_SND_AUDIOINJECTOR_PI_SOUNDCARD=m ++CONFIG_SND_DIGIDAC1_SOUNDCARD=m + CONFIG_SND_SOC_ADAU1701=m + CONFIG_SND_SOC_WM8804_I2C=m + CONFIG_SND_SIMPLE_CARD=m +diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig +index 8e0b51f..d936b43 100644 +--- a/arch/arm/configs/bcmrpi_defconfig ++++ b/arch/arm/configs/bcmrpi_defconfig +@@ -854,6 +854,7 @@ CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC=m + CONFIG_SND_BCM2708_SOC_RASPIDAC3=m + CONFIG_SND_BCM2708_SOC_ADAU1977_ADC=m + CONFIG_SND_AUDIOINJECTOR_PI_SOUNDCARD=m ++CONFIG_SND_DIGIDAC1_SOUNDCARD=m + CONFIG_SND_SOC_ADAU1701=m + CONFIG_SND_SOC_WM8804_I2C=m + CONFIG_SND_SIMPLE_CARD=m +diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig +index e2e40ed..fa11cd7 100644 +--- a/sound/soc/bcm/Kconfig ++++ b/sound/soc/bcm/Kconfig +@@ -92,3 +92,11 @@ config SND_AUDIOINJECTOR_PI_SOUNDCARD + select SND_SOC_WM8731 + help + Say Y or M if you want to add support for audioinjector.net Pi Hat ++ ++config SND_DIGIDAC1_SOUNDCARD ++ tristate "Support for Red Rocks Audio DigiDAC1" ++ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S ++ select SND_SOC_WM8804 ++ select SND_SOC_WM8741 ++ help ++ Say Y or M if you want to add support for Red Rocks Audio DigiDAC1 board. +diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile +index 3353192..a9448fd 100644 +--- a/sound/soc/bcm/Makefile ++++ b/sound/soc/bcm/Makefile +@@ -16,6 +16,7 @@ snd-soc-rpi-proto-objs := rpi-proto.o + snd-soc-iqaudio-dac-objs := iqaudio-dac.o + snd-soc-raspidac3-objs := raspidac3.o + snd-soc-audioinjector-pi-soundcard-objs := audioinjector-pi-soundcard.o ++snd-soc-digidac1-soundcard-objs := digidac1-soundcard.o + obj-$(CONFIG_SND_BCM2708_SOC_ADAU1977_ADC) += snd-soc-adau1977-adc.o + obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o +@@ -29,4 +30,5 @@ obj-$(CONFIG_SND_BCM2708_SOC_RPI_PROTO) += snd-soc-rpi-proto.o + obj-$(CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC) += snd-soc-iqaudio-dac.o + obj-$(CONFIG_SND_BCM2708_SOC_RASPIDAC3) += snd-soc-raspidac3.o + obj-$(CONFIG_SND_AUDIOINJECTOR_PI_SOUNDCARD) += snd-soc-audioinjector-pi-soundcard.o ++obj-$(CONFIG_SND_DIGIDAC1_SOUNDCARD) += snd-soc-digidac1-soundcard.o -+Name: i2c0-bcm2708 -+Info: Enable the i2c_bcm2708 driver for the i2c0 bus -+Load: dtoverlay=i2c0-bcm2708,<param>=<val> -+Params: sda0_pin GPIO pin for SDA0 (0, 28 [or 44] - default 0) -+ scl0_pin GPIO pin for SCL0 (1, 29 [or 45] - default 1) -+ -+ -+Name: i2c1-bcm2708 -+Info: Enable the i2c_bcm2708 driver for the i2c1 bus -+Load: dtoverlay=i2c1-bcm2708,<param>=<val> -+Params: sda1_pin GPIO pin for SDA1 (2 or 44 - default 2) -+ scl1_pin GPIO pin for SCL1 (3 or 45 - default 3) -+ pin_func Alternative pin function (4 (alt0), 6 (alt2) - -+ default 4) -+ -+ - Name: i2s-mmap - Info: Enables mmap support in the bcm2708-i2s driver - Load: dtoverlay=i2s-mmap -diff --git a/arch/arm/boot/dts/overlays/i2c0-bcm2708-overlay.dts b/arch/arm/boot/dts/overlays/i2c0-bcm2708-overlay.dts +diff --git a/sound/soc/bcm/digidac1-soundcard.c b/sound/soc/bcm/digidac1-soundcard.c new file mode 100644 -index 0000000..5c0e55b +index 0000000..446796e --- /dev/null -+++ b/arch/arm/boot/dts/overlays/i2c0-bcm2708-overlay.dts -@@ -0,0 +1,36 @@ ++++ b/sound/soc/bcm/digidac1-soundcard.c +@@ -0,0 +1,422 @@ +/* -+ * Device tree overlay for i2c_bcm2708, i2c0 bus ++ * ASoC Driver for RRA DigiDAC1 ++ * Copyright 2016 ++ * Author: José M. Tasende <vintage@redrocksaudio.es> ++ * based on the HifiBerry DAC driver by Florian Meier <florian.meier@koalo.de> ++ * and the Wolfson card driver by Nikesh Oswal, <Nikesh.Oswal@wolfsonmicro.com> ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * version 2 as published by the Free Software Foundation. + * -+ * Compile: -+ * dtc -@ -I dts -O dtb -o i2c0-bcm2708-overlay.dtb i2c0-bcm2708-overlay.dts ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * General Public License for more details. + */ + -+/dts-v1/; -+/plugin/; ++#include <linux/module.h> ++#include <linux/platform_device.h> ++#include <linux/i2c.h> ++#include <sound/core.h> ++#include <sound/pcm.h> ++#include <sound/pcm_params.h> ++#include <sound/soc.h> ++#include <sound/jack.h> ++#include <sound/soc-dapm.h> ++#include <sound/tlv.h> ++#include <linux/regulator/consumer.h> + -+/{ -+ compatible = "brcm,bcm2708"; ++#include "../codecs/wm8804.h" ++#include "../codecs/wm8741.h" + -+ fragment@0 { -+ target = <&i2c0>; -+ __overlay__ { -+ pinctrl-0 = <&i2c0_pins>; -+ status = "okay"; -+ }; -+ }; ++#define WM8741_NUM_SUPPLIES 2 + -+ fragment@1 { -+ target = <&gpio>; -+ __overlay__ { -+ i2c0_pins: i2c0 { -+ brcm,pins = <0 1>; -+ brcm,function = <4>; /* alt0 */ -+ }; -+ }; -+ }; ++/* codec private data */ ++struct wm8741_priv { ++ struct wm8741_platform_data pdata; ++ struct regmap *regmap; ++ struct regulator_bulk_data supplies[WM8741_NUM_SUPPLIES]; ++ unsigned int sysclk; ++ const struct snd_pcm_hw_constraint_list *sysclk_constraints; ++}; ++ ++static int samplerate = 44100; ++ ++/* New Alsa Controls not exposed by original wm8741 codec driver */ ++/* in actual driver the att. adjustment is wrong because */ ++/* this DAC has a coarse attenuation register with 4dB steps */ ++/* and a fine level register with 0.125dB steps */ ++/* each register has 32 steps so combining both we have 1024 steps */ ++/* of 0.125 dB. */ ++/* The original level controls from driver are removed at startup */ ++/* and replaced by the corrected ones. */ ++/* The same wm8741 driver can be used for wm8741 and wm8742 devices */ ++ ++static const DECLARE_TLV_DB_SCALE(dac_tlv_fine, 0, 13, 0); ++static const DECLARE_TLV_DB_SCALE(dac_tlv_coarse, -12700, 400, 1); ++static const char *w8741_dither[4] = {"Off", "RPDF", "TPDF", "HPDF"}; ++static const char *w8741_filter[5] = { ++ "Type 1", "Type 2", "Type 3", "Type 4", "Type 5"}; ++static const char *w8741_switch[2] = {"Off", "On"}; ++static const struct soc_enum w8741_enum[] = { ++SOC_ENUM_SINGLE(WM8741_MODE_CONTROL_2, 0, 4, w8741_dither),/* dithering type */ ++SOC_ENUM_SINGLE(WM8741_FILTER_CONTROL, 0, 5, w8741_filter),/* filter type */ ++SOC_ENUM_SINGLE(WM8741_FORMAT_CONTROL, 6, 2, w8741_switch),/* phase invert */ ++SOC_ENUM_SINGLE(WM8741_VOLUME_CONTROL, 0, 2, w8741_switch),/* volume ramp */ ++SOC_ENUM_SINGLE(WM8741_VOLUME_CONTROL, 3, 2, w8741_switch),/* soft mute */ ++}; ++ ++static const struct snd_kcontrol_new w8741_snd_controls_stereo[] = { ++SOC_DOUBLE_R_TLV("DAC Fine Playback Volume", WM8741_DACLLSB_ATTENUATION, ++ WM8741_DACRLSB_ATTENUATION, 0, 31, 1, dac_tlv_fine), ++SOC_DOUBLE_R_TLV("Digital Playback Volume", WM8741_DACLMSB_ATTENUATION, ++ WM8741_DACRMSB_ATTENUATION, 0, 31, 1, dac_tlv_coarse), ++SOC_ENUM("DAC Dither", w8741_enum[0]), ++SOC_ENUM("DAC Digital Filter", w8741_enum[1]), ++SOC_ENUM("DAC Phase Invert", w8741_enum[2]), ++SOC_ENUM("DAC Volume Ramp", w8741_enum[3]), ++SOC_ENUM("DAC Soft Mute", w8741_enum[4]), ++}; ++ ++static const struct snd_kcontrol_new w8741_snd_controls_mono_left[] = { ++SOC_SINGLE_TLV("DAC Fine Playback Volume", WM8741_DACLLSB_ATTENUATION, ++ 0, 31, 0, dac_tlv_fine), ++SOC_SINGLE_TLV("Digital Playback Volume", WM8741_DACLMSB_ATTENUATION, ++ 0, 31, 1, dac_tlv_coarse), ++SOC_ENUM("DAC Dither", w8741_enum[0]), ++SOC_ENUM("DAC Digital Filter", w8741_enum[1]), ++SOC_ENUM("DAC Phase Invert", w8741_enum[2]), ++SOC_ENUM("DAC Volume Ramp", w8741_enum[3]), ++SOC_ENUM("DAC Soft Mute", w8741_enum[4]), ++}; ++ ++static const struct snd_kcontrol_new w8741_snd_controls_mono_right[] = { ++SOC_SINGLE_TLV("DAC Fine Playback Volume", WM8741_DACRLSB_ATTENUATION, ++ 0, 31, 0, dac_tlv_fine), ++SOC_SINGLE_TLV("Digital Playback Volume", WM8741_DACRMSB_ATTENUATION, ++ 0, 31, 1, dac_tlv_coarse), ++SOC_ENUM("DAC Dither", w8741_enum[0]), ++SOC_ENUM("DAC Digital Filter", w8741_enum[1]), ++SOC_ENUM("DAC Phase Invert", w8741_enum[2]), ++SOC_ENUM("DAC Volume Ramp", w8741_enum[3]), ++SOC_ENUM("DAC Soft Mute", w8741_enum[4]), ++}; ++ ++static int w8741_add_controls(struct snd_soc_codec *codec) ++{ ++ struct wm8741_priv *wm8741 = snd_soc_codec_get_drvdata(codec); ++ ++ switch (wm8741->pdata.diff_mode) { ++ case WM8741_DIFF_MODE_STEREO: ++ case WM8741_DIFF_MODE_STEREO_REVERSED: ++ snd_soc_add_codec_controls(codec, ++ w8741_snd_controls_stereo, ++ ARRAY_SIZE(w8741_snd_controls_stereo)); ++ break; ++ case WM8741_DIFF_MODE_MONO_LEFT: ++ snd_soc_add_codec_controls(codec, ++ w8741_snd_controls_mono_left, ++ ARRAY_SIZE(w8741_snd_controls_mono_left)); ++ break; ++ case WM8741_DIFF_MODE_MONO_RIGHT: ++ snd_soc_add_codec_controls(codec, ++ w8741_snd_controls_mono_right, ++ ARRAY_SIZE(w8741_snd_controls_mono_right)); ++ break; ++ default: ++ return -EINVAL; ++ } + -+ __overrides__ { -+ sda0_pin = <&i2c0_pins>,"brcm,pins:0"; -+ scl0_pin = <&i2c0_pins>,"brcm,pins:4"; -+ }; ++ return 0; ++} ++ ++static int digidac1_soundcard_init(struct snd_soc_pcm_runtime *rtd) ++{ ++ struct snd_soc_codec *codec = rtd->codec; ++ struct snd_soc_card *card = rtd->card; ++ struct snd_soc_pcm_runtime *wm8741_rtd; ++ struct snd_soc_codec *wm8741_codec; ++ struct snd_card *sound_card = card->snd_card; ++ struct snd_kcontrol *kctl; ++ int ret; ++ ++ wm8741_rtd = snd_soc_get_pcm_runtime(card, card->dai_link[1].name); ++ if (!wm8741_rtd) { ++ dev_warn(card->dev, "digidac1_soundcard_init: couldn't get wm8741 rtd\n"); ++ return -EFAULT; ++ } ++ wm8741_codec = wm8741_rtd->codec; ++ ret = w8741_add_controls(wm8741_codec); ++ if (ret < 0) ++ dev_warn(card->dev, "Failed to add new wm8741 controls: %d\n", ++ ret); ++ ++ /* enable TX output */ ++ snd_soc_update_bits(codec, WM8804_PWRDN, 0x4, 0x0); ++ ++ kctl = snd_soc_card_get_kcontrol(card, ++ "Playback Volume"); ++ if (kctl) { ++ kctl->vd[0].access = SNDRV_CTL_ELEM_ACCESS_READWRITE; ++ snd_ctl_remove(sound_card, kctl); ++ } ++ kctl = snd_soc_card_get_kcontrol(card, ++ "Fine Playback Volume"); ++ if (kctl) { ++ kctl->vd[0].access = SNDRV_CTL_ELEM_ACCESS_READWRITE; ++ snd_ctl_remove(sound_card, kctl); ++ } ++ return 0; ++} ++ ++static int digidac1_soundcard_startup(struct snd_pcm_substream *substream) ++{ ++ /* turn on wm8804 digital output */ ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_codec *codec = rtd->codec; ++ struct snd_soc_card *card = rtd->card; ++ struct snd_soc_pcm_runtime *wm8741_rtd; ++ struct snd_soc_codec *wm8741_codec; ++ ++ snd_soc_update_bits(codec, WM8804_PWRDN, 0x3c, 0x00); ++ wm8741_rtd = snd_soc_get_pcm_runtime(card, card->dai_link[1].name); ++ if (!wm8741_rtd) { ++ dev_warn(card->dev, "digidac1_soundcard_startup: couldn't get WM8741 rtd\n"); ++ return -EFAULT; ++ } ++ wm8741_codec = wm8741_rtd->codec; ++ ++ /* latch wm8741 level */ ++ snd_soc_update_bits(wm8741_codec, WM8741_DACLLSB_ATTENUATION, ++ WM8741_UPDATELL, WM8741_UPDATELL); ++ snd_soc_update_bits(wm8741_codec, WM8741_DACLMSB_ATTENUATION, ++ WM8741_UPDATELM, WM8741_UPDATELM); ++ snd_soc_update_bits(wm8741_codec, WM8741_DACRLSB_ATTENUATION, ++ WM8741_UPDATERL, WM8741_UPDATERL); ++ snd_soc_update_bits(wm8741_codec, WM8741_DACRMSB_ATTENUATION, ++ WM8741_UPDATERM, WM8741_UPDATERM); ++ ++ return 0; ++} ++ ++static void digidac1_soundcard_shutdown(struct snd_pcm_substream *substream) ++{ ++ /* turn off wm8804 digital output */ ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_codec *codec = rtd->codec; ++ ++ snd_soc_update_bits(codec, WM8804_PWRDN, 0x3c, 0x3c); ++} ++ ++static int digidac1_soundcard_hw_params(struct snd_pcm_substream *substream, ++ struct snd_pcm_hw_params *params) ++{ ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_dai *codec_dai = rtd->codec_dai; ++ struct snd_soc_codec *codec = rtd->codec; ++ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; ++ struct snd_soc_card *card = rtd->card; ++ struct snd_soc_pcm_runtime *wm8741_rtd; ++ struct snd_soc_codec *wm8741_codec; ++ ++ int sysclk = 27000000; ++ long mclk_freq = 0; ++ int mclk_div = 1; ++ int sampling_freq = 1; ++ int ret; ++ ++ wm8741_rtd = snd_soc_get_pcm_runtime(card, card->dai_link[1].name); ++ if (!wm8741_rtd) { ++ dev_warn(card->dev, "digidac1_soundcard_hw_params: couldn't get WM8741 rtd\n"); ++ return -EFAULT; ++ } ++ wm8741_codec = wm8741_rtd->codec; ++ samplerate = params_rate(params); ++ ++ if (samplerate <= 96000) { ++ mclk_freq = samplerate*256; ++ mclk_div = WM8804_MCLKDIV_256FS; ++ } else { ++ mclk_freq = samplerate*128; ++ mclk_div = WM8804_MCLKDIV_128FS; ++ } ++ ++ switch (samplerate) { ++ case 32000: ++ sampling_freq = 0x03; ++ break; ++ case 44100: ++ sampling_freq = 0x00; ++ break; ++ case 48000: ++ sampling_freq = 0x02; ++ break; ++ case 88200: ++ sampling_freq = 0x08; ++ break; ++ case 96000: ++ sampling_freq = 0x0a; ++ break; ++ case 176400: ++ sampling_freq = 0x0c; ++ break; ++ case 192000: ++ sampling_freq = 0x0e; ++ break; ++ default: ++ dev_err(codec->dev, ++ "Failed to set WM8804 SYSCLK, unsupported samplerate %d\n", ++ samplerate); ++ } ++ ++ snd_soc_dai_set_clkdiv(codec_dai, WM8804_MCLK_DIV, mclk_div); ++ snd_soc_dai_set_pll(codec_dai, 0, 0, sysclk, mclk_freq); ++ ++ ret = snd_soc_dai_set_sysclk(codec_dai, WM8804_TX_CLKSRC_PLL, ++ sysclk, SND_SOC_CLOCK_OUT); ++ if (ret < 0) { ++ dev_err(codec->dev, ++ "Failed to set WM8804 SYSCLK: %d\n", ret); ++ return ret; ++ } ++ /* Enable wm8804 TX output */ ++ snd_soc_update_bits(codec, WM8804_PWRDN, 0x4, 0x0); ++ ++ /* wm8804 Power on */ ++ snd_soc_update_bits(codec, WM8804_PWRDN, 0x9, 0); ++ ++ /* wm8804 set sampling frequency status bits */ ++ snd_soc_update_bits(codec, WM8804_SPDTX4, 0x0f, sampling_freq); ++ ++ /* Now update wm8741 registers for the correct oversampling */ ++ if (samplerate <= 48000) ++ snd_soc_update_bits(wm8741_codec, WM8741_MODE_CONTROL_1, ++ WM8741_OSR_MASK, 0x00); ++ else if (samplerate <= 96000) ++ snd_soc_update_bits(wm8741_codec, WM8741_MODE_CONTROL_1, ++ WM8741_OSR_MASK, 0x20); ++ else ++ snd_soc_update_bits(wm8741_codec, WM8741_MODE_CONTROL_1, ++ WM8741_OSR_MASK, 0x40); ++ ++ /* wm8741 bit size */ ++ switch (params_width(params)) { ++ case 16: ++ snd_soc_update_bits(wm8741_codec, WM8741_FORMAT_CONTROL, ++ WM8741_IWL_MASK, 0x00); ++ break; ++ case 20: ++ snd_soc_update_bits(wm8741_codec, WM8741_FORMAT_CONTROL, ++ WM8741_IWL_MASK, 0x01); ++ break; ++ case 24: ++ snd_soc_update_bits(wm8741_codec, WM8741_FORMAT_CONTROL, ++ WM8741_IWL_MASK, 0x02); ++ break; ++ case 32: ++ snd_soc_update_bits(wm8741_codec, WM8741_FORMAT_CONTROL, ++ WM8741_IWL_MASK, 0x03); ++ break; ++ default: ++ dev_dbg(codec->dev, "wm8741_hw_params: Unsupported bit size param = %d", ++ params_width(params)); ++ return -EINVAL; ++ } ++ ++ return snd_soc_dai_set_bclk_ratio(cpu_dai, 64); ++} ++/* machine stream operations */ ++static struct snd_soc_ops digidac1_soundcard_ops = { ++ .hw_params = digidac1_soundcard_hw_params, ++ .startup = digidac1_soundcard_startup, ++ .shutdown = digidac1_soundcard_shutdown, +}; -diff --git a/arch/arm/boot/dts/overlays/i2c1-bcm2708-overlay.dts b/arch/arm/boot/dts/overlays/i2c1-bcm2708-overlay.dts -new file mode 100644 -index 0000000..e303b9c ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/i2c1-bcm2708-overlay.dts -@@ -0,0 +1,37 @@ -+/* -+ * Device tree overlay for i2c_bcm2708, i2c1 bus -+ * -+ * Compile: -+ * dtc -@ -I dts -O dtb -o i2c1-bcm2708-overlay.dtb i2c1-bcm2708-overlay.dts -+ */ + -+/dts-v1/; -+/plugin/; ++static struct snd_soc_dai_link digidac1_soundcard_dai[] = { ++ { ++ .name = "RRA DigiDAC1", ++ .stream_name = "RRA DigiDAC1 HiFi", ++ .cpu_dai_name = "bcm2708-i2s.0", ++ .codec_dai_name = "wm8804-spdif", ++ .platform_name = "bcm2708-i2s.0", ++ .codec_name = "wm8804.1-003b", ++ .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | ++ SND_SOC_DAIFMT_CBM_CFM, ++ .ops = &digidac1_soundcard_ops, ++ .init = digidac1_soundcard_init, ++ }, ++ { ++ .name = "RRA DigiDAC11", ++ .stream_name = "RRA DigiDAC11 HiFi", ++ .cpu_dai_name = "wm8804-spdif", ++ .codec_dai_name = "wm8741", ++ .codec_name = "wm8741.1-001a", ++ .dai_fmt = SND_SOC_DAIFMT_I2S ++ | SND_SOC_DAIFMT_NB_NF ++ | SND_SOC_DAIFMT_CBS_CFS, ++ }, ++}; + -+/{ -+ compatible = "brcm,bcm2708"; ++/* audio machine driver */ ++static struct snd_soc_card digidac1_soundcard = { ++ .name = "digidac1-soundcard", ++ .owner = THIS_MODULE, ++ .dai_link = digidac1_soundcard_dai, ++ .num_links = ARRAY_SIZE(digidac1_soundcard_dai), ++}; + -+ fragment@0 { -+ target = <&i2c1>; -+ __overlay__ { -+ pinctrl-0 = <&i2c1_pins>; -+ status = "okay"; -+ }; -+ }; ++static int digidac1_soundcard_probe(struct platform_device *pdev) ++{ ++ int ret = 0; + -+ fragment@1 { -+ target = <&gpio>; -+ __overlay__ { -+ i2c1_pins: i2c1 { -+ brcm,pins = <2 3>; -+ brcm,function = <4>; /* alt0 */ -+ }; -+ }; -+ }; ++ digidac1_soundcard.dev = &pdev->dev; + -+ __overrides__ { -+ sda1_pin = <&i2c1_pins>,"brcm,pins:0"; -+ scl1_pin = <&i2c1_pins>,"brcm,pins:4"; -+ pin_func = <&i2c1_pins>,"brcm,function:0"; -+ }; ++ if (pdev->dev.of_node) { ++ struct device_node *i2s_node; ++ struct snd_soc_dai_link *dai = &digidac1_soundcard_dai[0]; ++ ++ i2s_node = of_parse_phandle(pdev->dev.of_node, ++ "i2s-controller", 0); ++ ++ if (i2s_node) { ++ dai->cpu_dai_name = NULL; ++ dai->cpu_of_node = i2s_node; ++ dai->platform_name = NULL; ++ dai->platform_of_node = i2s_node; ++ } ++ } ++ ++ ret = snd_soc_register_card(&digidac1_soundcard); ++ if (ret) ++ dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", ++ ret); ++ ++ return ret; ++} ++ ++static int digidac1_soundcard_remove(struct platform_device *pdev) ++{ ++ return snd_soc_unregister_card(&digidac1_soundcard); ++} ++ ++static const struct of_device_id digidac1_soundcard_of_match[] = { ++ { .compatible = "rra,digidac1-soundcard", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, digidac1_soundcard_of_match); ++ ++static struct platform_driver digidac1_soundcard_driver = { ++ .driver = { ++ .name = "digidac1-audio", ++ .owner = THIS_MODULE, ++ .of_match_table = digidac1_soundcard_of_match, ++ }, ++ .probe = digidac1_soundcard_probe, ++ .remove = digidac1_soundcard_remove, +}; ++ ++module_platform_driver(digidac1_soundcard_driver); ++ ++MODULE_AUTHOR("José M. Tasende <vintage@redrocksaudio.es>"); ++MODULE_DESCRIPTION("ASoC Driver for RRA DigiDAC1"); ++MODULE_LICENSE("GPL v2"); -From c5cbb66686e7e289e8a7aff49a954f86893e628d Mon Sep 17 00:00:00 2001 -From: Dhiraj Goel <dhiraj.goel@gmail.com> -Date: Thu, 3 Mar 2016 21:10:50 -0800 -Subject: [PATCH 170/170] bcm2835-camera: fix a bug in computation of frame - timestamp +From 8f1f7957d7684294706126f51dc46e362d7822a4 Mon Sep 17 00:00:00 2001 +From: Phil Elwell <phil@raspberrypi.org> +Date: Fri, 3 Jun 2016 21:56:40 +0100 +Subject: [PATCH 112/112] BCM270X_DT: Fix rpi-dac overlay -Fixes #1318 +The rpi-dac overlay is almost identical to the hifiberry-dac overlay - +the codec used is different but it also doesn't sit on the I2C bus. As +a result, when the overlays were modified for dynamic loading and it +was discovered that the hifiberry-dac overlay didn't work any more, the +the rpi-dac overlay was also broken. + +The failure was caused by the fact that outside a bus, device names are +constructed from the concatenation of the path elements leading to it, +so moving the codec instantiation inside /soc caused the device name +to get a "soc" added, breaking ALSA's naming. + +See: http://forum.kodi.tv/showthread.php?tid=269814&pid=2349776#pid2349776 + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> --- - drivers/media/platform/bcm2835/bcm2835-camera.c | 3 +-- - 1 file changed, 1 insertion(+), 2 deletions(-) + arch/arm/boot/dts/overlays/rpi-dac-overlay.dts | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) -diff --git a/drivers/media/platform/bcm2835/bcm2835-camera.c b/drivers/media/platform/bcm2835/bcm2835-camera.c -index e83334c..98a892e 100644 ---- a/drivers/media/platform/bcm2835/bcm2835-camera.c -+++ b/drivers/media/platform/bcm2835/bcm2835-camera.c -@@ -360,8 +360,7 @@ static void buffer_cb(struct vchiq_mmal_instance *instance, - div = - div_u64_rem(runtime_us, USEC_PER_SEC, &rem); - buf->vb.timestamp.tv_sec = -- dev->capture.kernel_start_ts.tv_sec - 1 + -- div; -+ dev->capture.kernel_start_ts.tv_sec + div; - buf->vb.timestamp.tv_usec = - dev->capture.kernel_start_ts.tv_usec + rem; +diff --git a/arch/arm/boot/dts/overlays/rpi-dac-overlay.dts b/arch/arm/boot/dts/overlays/rpi-dac-overlay.dts +index 1523eae..a442c8f0 100644 +--- a/arch/arm/boot/dts/overlays/rpi-dac-overlay.dts ++++ b/arch/arm/boot/dts/overlays/rpi-dac-overlay.dts +@@ -13,7 +13,7 @@ + }; + fragment@1 { +- target = <&soc>; ++ target-path = "/"; + __overlay__ { + pcm1794a-codec { + #sound-dai-cells = <0>; diff --git a/projects/Slice/filesystem/usr/config/autostart.sh b/projects/Slice/filesystem/usr/config/autostart.sh new file mode 100644 index 00000000000..0b6166972bc --- /dev/null +++ b/projects/Slice/filesystem/usr/config/autostart.sh @@ -0,0 +1,2 @@ +#!/bin/bash +hdparm -S60 /dev/sda diff --git a/projects/Slice/filesystem/usr/config/shutdown.sh b/projects/Slice/filesystem/usr/config/shutdown.sh new file mode 100644 index 00000000000..ebd32374e62 --- /dev/null +++ b/projects/Slice/filesystem/usr/config/shutdown.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +if [ -f /storage/.kodi/media/ledpatterns/shutdown.png ]; then + LEDDIR=/storage/.kodi +else + LEDDIR=/usr/share/kodi +fi + +case "$1" in + halt) + hdparm -y /dev/sda + led_png $LEDDIR/media/ledpatterns/shutdown.png + ;; + poweroff) + hdparm -y /dev/sda + led_png $LEDDIR/media/ledpatterns/shutdown.png + ;; + reboot) + led_png $LEDDIR/media/ledpatterns/shutdown.png + ;; + *) + ;; +esac diff --git a/projects/Slice/filesystem/usr/lib/systemd/system/serial-console.service b/projects/Slice/filesystem/usr/lib/systemd/system/serial-console.service new file mode 100644 index 00000000000..196e8c4a97a --- /dev/null +++ b/projects/Slice/filesystem/usr/lib/systemd/system/serial-console.service @@ -0,0 +1,23 @@ +[Unit] +Description=Debug Shell on /dev/console +DefaultDependencies=no +ConditionKernelCommandLine=console + +[Service] +WorkingDirectory=/storage +Environment="ENV=/etc/profile" +ExecStartPre=/bin/sh -c 'echo -en "\033[?25h"' +ExecStart=/bin/sh +Restart=always +RestartSec=0 +StandardInput=tty +TTYPath=/dev/console +TTYReset=yes +TTYVHangup=yes +KillMode=process +IgnoreSIGPIPE=no +# bash ignores SIGTERM +KillSignal=SIGHUP + +[Install] +WantedBy=sysinit.target diff --git a/tools/mkpkg/mkpkg_adsp.basic b/projects/Slice/initramfs/platform_init old mode 100755 new mode 100644 similarity index 58% rename from tools/mkpkg/mkpkg_adsp.basic rename to projects/Slice/initramfs/platform_init index af119ab2549..e3e2e7d50aa --- a/tools/mkpkg/mkpkg_adsp.basic +++ b/projects/Slice/initramfs/platform_init @@ -1,7 +1,8 @@ #!/bin/sh + ################################################################################ # This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2009-2015 Stephan Raue (stephan@openelec.tv) # # OpenELEC is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -17,25 +18,11 @@ # along with OpenELEC. If not, see <http://www.gnu.org/licenses/>. ################################################################################ -echo "getting sources..." - if [ ! -d adsp.basic.git ]; then - git clone https://github.com/kodi-adsp/adsp.basic.git adsp.basic.git - fi - - cd adsp.basic.git - git pull - GIT_REV=`git log -n1 --format=%h` - cd .. - -echo "copying sources..." - rm -rf adsp.basic-$GIT_REV - cp -R adsp.basic.git adsp.basic-$GIT_REV - -echo "cleaning sources..." - rm -rf adsp.basic-$GIT_REV/.git - -echo "packing sources..." - tar cvJf adsp.basic-$GIT_REV.tar.xz adsp.basic-$GIT_REV +# Enable io_is_busy for improved sdhost performance - essentially, equivalent of force_turbo=1 but for mmc +echo 1 > /sys/devices/system/cpu/cpufreq/ondemand/io_is_busy -echo "remove temporary sourcedir..." - rm -rf adsp.basic-$GIT_REV +# Configure frequency scaling properties - should improve performance a little (turbo, in most cases) +echo ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor +echo 50 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold +echo 100000 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_rate +echo 50 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor diff --git a/projects/Slice/kodi/advancedsettings.xml b/projects/Slice/kodi/advancedsettings.xml new file mode 100644 index 00000000000..45b34cb598e --- /dev/null +++ b/projects/Slice/kodi/advancedsettings.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<advancedsettings> + <showexitbutton>false</showexitbutton> + + <fanartres>720</fanartres> + <imageres>540</imageres> + + <video> + <busydialogdelayms>750</busydialogdelayms> + </video> + + <samba> + <clienttimeout>30</clienttimeout> + </samba> +</advancedsettings> diff --git a/projects/Slice/kodi/guisettings.xml b/projects/Slice/kodi/guisettings.xml new file mode 100644 index 00000000000..ea2cb014e40 --- /dev/null +++ b/projects/Slice/kodi/guisettings.xml @@ -0,0 +1,514 @@ +<settings> + <audiocds> + <autoaction default="true">0</autoaction> + <ejectonrip default="true">true</ejectonrip> + <encoder default="true">audioencoder.xbmc.builtin.wav</encoder> + <recordingpath default="true"></recordingpath> + <trackpathformat default="true">%A/%A - %B/[%N. ][%A - ]%T</trackpathformat> + <usecddb default="true">true</usecddb> + </audiocds> + <audiooutput> + <ac3passthrough default="true">true</ac3passthrough> + <ac3transcode default="true">false</ac3transcode> + <audiodevice default="true">PI:HDMI</audiodevice> + <boostcenter default="true">0</boostcenter> + <channels default="true">1</channels> + <config default="true">2</config> + <dtshdpassthrough default="true">false</dtshdpassthrough> + <dtspassthrough default="true">false</dtspassthrough> + <eac3passthrough default="true">false</eac3passthrough> + <guisoundmode default="true">1</guisoundmode> + <maintainoriginalvolume default="true">true</maintainoriginalvolume> + <passthrough default="true">false</passthrough> + <passthroughdevice default="true">PI:HDMI</passthroughdevice> + <processquality default="true">101</processquality> + <samplerate default="true">48000</samplerate> + <stereoupmix default="true">false</stereoupmix> + <streamsilence default="true">1</streamsilence> + <truehdpassthrough default="true">false</truehdpassthrough> + </audiooutput> + <cache> + <harddisk default="true">256</harddisk> + </cache> + <cacheaudio> + <dvdrom default="true">256</dvdrom> + <internet default="true">256</internet> + <lan default="true">256</lan> + </cacheaudio> + <cachedvd> + <dvdrom default="true">2048</dvdrom> + <lan default="true">2048</lan> + </cachedvd> + <cacheunknown> + <internet default="true">4096</internet> + </cacheunknown> + <cachevideo> + <dvdrom default="true">2048</dvdrom> + <internet default="true">4096</internet> + <lan default="true">2048</lan> + </cachevideo> + <debug> + <extralogging default="true">false</extralogging> + <screenshotpath>/storage/screenshots/</screenshotpath> + <setextraloglevel default="true"></setextraloglevel> + <showloginfo default="true">false</showloginfo> + </debug> + <disc> + <playback default="true">0</playback> + </disc> + <dvds> + <automenu default="true">false</automenu> + <autorun default="true">false</autorun> + <playerregion default="true">0</playerregion> + </dvds> + <epg> + <daystodisplay default="true">3</daystodisplay> + <epgupdate default="true">120</epgupdate> + <hidenoinfoavailable default="true">true</hidenoinfoavailable> + <ignoredbforclient default="true">false</ignoredbforclient> + <preventupdateswhileplayingtv default="true">false</preventupdateswhileplayingtv> + <selectaction default="true">2</selectaction> + </epg> + <filelists> + <allowfiledeletion default="true">false</allowfiledeletion> + <browsearchives default="true">true</browsearchives> + <ignorethewhensorting>false</ignorethewhensorting> + <showaddsourcebuttons default="true">true</showaddsourcebuttons> + <showextensions>false</showextensions> + <showhidden default="true">false</showhidden> + <showparentdiritems>false</showparentdiritems> + </filelists> + <general> + <addonbrokenfilter default="true">true</addonbrokenfilter> + <addonforeignfilter default="true">false</addonforeignfilter> + <addonnotifications default="true">true</addonnotifications> + <addonupdates default="true">0</addonupdates> + <settinglevel>1</settinglevel> + <systemtotaluptime>0</systemtotaluptime> + </general> + <input> + <enablejoystick default="true">true</enablejoystick> + <enablemouse default="true">true</enablemouse> + </input> + <karaoke> + <autopopupselector default="true">false</autopopupselector> + <charset default="true">DEFAULT</charset> + <enabled default="true">false</enabled> + <font default="true">arial.ttf</font> + <fontcolors default="true">0</fontcolors> + <fontheight default="true">36</fontheight> + </karaoke> + <locale> + <audiolanguage>default</audiolanguage> + <charset default="true">DEFAULT</charset> + <country>UK (24h)</country> + <keyboardlayouts default="true">English QWERTY</keyboardlayouts> + <language default="true">English</language> + <subtitlelanguage default="true">original</subtitlelanguage> + <timezone>Europe/London</timezone> + <timezonecountry>Britain (UK)</timezonecountry> + </locale> + <lookandfeel> + <enablerssfeeds>false</enablerssfeeds> + <font default="true">Default</font> + <rssedit default="true"></rssedit> + <skin default="true">skin.estuary</skin> + <skincolors default="true">SKINDEFAULT</skincolors> + <skintheme default="true">SKINDEFAULT</skintheme> + <skinzoom default="true">0</skinzoom> + <soundskin default="true">SKINDEFAULT</soundskin> + <startupwindow default="true">10000</startupwindow> + </lookandfeel> + <masterlock> + <maxretries default="true">3</maxretries> + <startuplock default="true">false</startuplock> + </masterlock> + <musicfiles> + <findremotethumbs default="true">true</findremotethumbs> + <librarytrackformat default="true"></librarytrackformat> + <librarytrackformatright default="true"></librarytrackformatright> + <nowplayingtrackformat default="true"></nowplayingtrackformat> + <nowplayingtrackformatright default="true"></nowplayingtrackformatright> + <trackformat default="true">[%N. ]%A - %T</trackformat> + <trackformatright default="true">%D</trackformatright> + <usetags default="true">true</usetags> + </musicfiles> + <musiclibrary> + <albumsscraper default="true">metadata.album.universal</albumsscraper> + <artistsscraper default="true">metadata.artists.universal</artistsscraper> + <backgroundupdate default="true">false</backgroundupdate> + <downloadinfo default="true">false</downloadinfo> + <enabled default="true">true</enabled> + <overridetags default="true">false</overridetags> + <showcompilationartists default="true">true</showcompilationartists> + <updateonstartup default="true">false</updateonstartup> + </musiclibrary> + <musicplayer> + <autoplaynextitem default="true">true</autoplaynextitem> + <crossfade default="true">0</crossfade> + <crossfadealbumtracks default="true">true</crossfadealbumtracks> + <queuebydefault default="true">false</queuebydefault> + <replaygainavoidclipping default="true">false</replaygainavoidclipping> + <replaygainnogainpreamp default="true">89</replaygainnogainpreamp> + <replaygainpreamp default="true">89</replaygainpreamp> + <replaygaintype default="true">1</replaygaintype> + <visualisation default="true">visualization.glspectrum</visualisation> + </musicplayer> + <mymusic> + <defaultlibview default="true"></defaultlibview> + <songthumbinvis default="true">false</songthumbinvis> + <startwindow default="true">10501</startwindow> + <playlist> + <repeat>false</repeat> + <shuffle>false</shuffle> + </playlist> + <needsupdate>0</needsupdate> + </mymusic> + <myvideos> + <extractflags default="true">false</extractflags> + <extractthumb default="true">false</extractthumb> + <flatten default="true">false</flatten> + <replacelabels default="true">true</replacelabels> + <selectaction>0</selectaction> + <stackvideos default="true">false</stackvideos> + <startwindow>10025</startwindow> + <watchmodemovies>0</watchmodemovies> + <watchmodetvshows>0</watchmodetvshows> + <watchmodemusicvideos>0</watchmodemusicvideos> + <playlist> + <repeat>false</repeat> + <shuffle>false</shuffle> + </playlist> + <needsupdate>0</needsupdate> + </myvideos> + <network> + <bandwidth default="true">0</bandwidth> + <httpproxypassword default="true"></httpproxypassword> + <httpproxyport default="true">8080</httpproxyport> + <httpproxyserver default="true"></httpproxyserver> + <httpproxytype default="true">0</httpproxytype> + <httpproxyusername default="true"></httpproxyusername> + <usehttpproxy default="true">false</usehttpproxy> + </network> + <pictures> + <displayresolution default="true">14</displayresolution> + <generatethumbs default="true">true</generatethumbs> + <showvideos default="true">true</showvideos> + <useexifrotation default="true">true</useexifrotation> + <usetags default="true">true</usetags> + </pictures> + <powermanagement> + <displaysoff default="true">0</displaysoff> + <shutdownstate default="true">1</shutdownstate> + <shutdowntime default="true">0</shutdowntime> + <wakeonaccess default="true">false</wakeonaccess> + </powermanagement> + <pvrmanager> + <backendchannelorder default="true">true</backendchannelorder> + <enabled default="true">false</enabled> + <hideconnectionlostwarning default="true">false</hideconnectionlostwarning> + <syncchannelgroups default="true">true</syncchannelgroups> + <usebackendchannelnumbers default="true">false</usebackendchannelnumbers> + </pvrmanager> + <pvrmenu> + <closechannelosdonswitch default="true">true</closechannelosdonswitch> + <displaychannelinfo default="true">5</displaychannelinfo> + <iconpath default="true"></iconpath> + </pvrmenu> + <pvrparental> + <duration default="true">300</duration> + <enabled default="true">false</enabled> + <pin default="true"></pin> + </pvrparental> + <pvrplayback> + <channelentrytimeout default="true">0</channelentrytimeout> + <confirmchannelswitch default="true">false</confirmchannelswitch> + <playminimized default="true">true</playminimized> + <scantime default="true">10</scantime> + <signalquality default="true">true</signalquality> + <startlast default="true">0</startlast> + </pvrplayback> + <pvrpowermanagement> + <backendidletime default="true">15</backendidletime> + <dailywakeup default="true">false</dailywakeup> + <dailywakeuptime default="true">00:00:00</dailywakeuptime> + <enabled default="true">false</enabled> + <prewakeup default="true">15</prewakeup> + <setwakeupcmd default="true">/usr/bin/setwakeup.sh</setwakeupcmd> + </pvrpowermanagement> + <pvrrecord> + <defaultlifetime default="true">99</defaultlifetime> + <defaultpriority default="true">50</defaultpriority> + <instantrecordtime default="true">120</instantrecordtime> + <marginend default="true">0</marginend> + <marginstart default="true">0</marginstart> + <timernotifications default="true">true</timernotifications> + </pvrrecord> + <scrapers> + <moviesdefault default="true">metadata.themoviedb.org</moviesdefault> + <musicvideosdefault default="true">metadata.musicvideos.theaudiodb.com</musicvideosdefault> + <tvshowsdefault default="true">metadata.tvdb.com</tvshowsdefault> + </scrapers> + <screensaver> + <mode default="true">screensaver.xbmc.builtin.dim</mode> + <time default="true">3</time> + <usedimonpause default="true">true</usedimonpause> + <usemusicvisinstead default="true">true</usemusicvisinstead> + </screensaver> + <services> + <airplay default="true">true</airplay> + <airplayios8compat default="true">true</airplayios8compat> + <airplaypassword default="true"></airplaypassword> + <airplayvolumecontrol default="true">true</airplayvolumecontrol> + <devicename default="true">Kodi</devicename> + <esallinterfaces default="true">false</esallinterfaces> + <escontinuousdelay default="true">25</escontinuousdelay> + <esenabled default="true">true</esenabled> + <esinitialdelay default="true">750</esinitialdelay> + <esmaxclients default="true">20</esmaxclients> + <esport default="true">9777</esport> + <esportrange default="true">10</esportrange> + <upnpannounce default="true">true</upnpannounce> + <upnpcontroller default="true">false</upnpcontroller> + <upnprenderer default="true">false</upnprenderer> + <upnpserver default="true">false</upnpserver> + <useairplaypassword default="true">false</useairplaypassword> + <webserver default="true">true</webserver> + <webserverpassword default="true"></webserverpassword> + <webserverport default="true">80</webserverport> + <webserverusername default="true">kodi</webserverusername> + <webskin default="true">webinterface.default</webskin> + <zeroconf default="true">true</zeroconf> + </services> + <slideshow> + <displayeffects default="true">true</displayeffects> + <shuffle default="true">false</shuffle> + <staytime default="true">5</staytime> + </slideshow> + <smb> + <winsserver default="true">0.0.0.0</winsserver> + <workgroup default="true">WORKGROUP</workgroup> + </smb> + <subtitles> + <align default="true">0</align> + <charset default="true">DEFAULT</charset> + <color default="true">1</color> + <custompath default="true"></custompath> + <downloadfirst default="true">false</downloadfirst> + <font default="true">arial.ttf</font> + <height default="true">28</height> + <languages default="true">English</languages> + <movie default="true">-</movie> + <overrideassfonts default="true">false</overrideassfonts> + <pauseonsearch default="true">true</pauseonsearch> + <stereoscopicdepth default="true">0</stereoscopicdepth> + <storagemode default="true">0</storagemode> + <style default="true">1</style> + <tv default="true">-</tv> + </subtitles> + <system> + <playlistspath>special://profile/playlists/</playlistspath> + </system> + <videolibrary> + <actorthumbs default="true">true</actorthumbs> + <backgroundupdate default="true">false</backgroundupdate> + <enabled default="true">true</enabled> + <flattentvshows default="true">1</flattentvshows> + <groupmoviesets default="true">false</groupmoviesets> + <showunwatchedplots default="true">true</showunwatchedplots> + <updateonstartup default="true">false</updateonstartup> + </videolibrary> + <videoplayer> + <adjustrefreshrate>1</adjustrefreshrate> + <autoplaynextitem default="true">false</autoplaynextitem> + <decodingmethod default="true">1</decodingmethod> + <errorinaspect default="true">0</errorinaspect> + <hqscalers default="true">0</hqscalers> + <limitguiupdate default="true">10</limitguiupdate> + <maxspeedadjust default="true">5</maxspeedadjust> + <pauseafterrefreshchange default="true">0</pauseafterrefreshchange> + <prefervaapirender default="true">true</prefervaapirender> + <quitstereomodeonstop default="true">true</quitstereomodeonstop> + <rendermethod default="true">0</rendermethod> + <stereoscopicplaybackmode default="true">0</stereoscopicplaybackmode> + <stretch43 default="true">0</stretch43> + <synctype default="true">2</synctype> + <teletextenabled default="true">true</teletextenabled> + <teletextscale default="true">true</teletextscale> + <useamcodec default="true">true</useamcodec> + <usedisplayasclock>true</usedisplayasclock> + <usedxva2 default="true">true</usedxva2> + <usemmal default="true">true</usemmal> + <useomx default="true">true</useomx> + <useomxplayer default="true">true</useomxplayer> + <usepbo default="true">true</usepbo> + <usevaapi default="true">true</usevaapi> + <usevaapimpeg2 default="true">true</usevaapimpeg2> + <usevaapimpeg4 default="true">true</usevaapimpeg4> + <usevaapivc1 default="true">false</usevaapivc1> + <usevda default="true">true</usevda> + <usevdpau default="true">true</usevdpau> + <usevdpaumixer default="true">true</usevdpaumixer> + <usevdpaumpeg2 default="true">true</usevdpaumpeg2> + <usevdpaumpeg4 default="true">false</usevdpaumpeg4> + <usevdpauvc1 default="true">true</usevdpauvc1> + <usevideotoolbox default="true">true</usevideotoolbox> + <vdpauUpscalingLevel default="true">false</vdpauUpscalingLevel> + <vdpau_allow_xrandr default="true">false</vdpau_allow_xrandr> + </videoplayer> + <videoscreen> + <blankdisplays default="true">false</blankdisplays> + <fakefullscreen default="true">true</fakefullscreen> + <limitedrange default="true">false</limitedrange> + <limitgui default="true">0</limitgui> + <monitor default="true">Default</monitor> + <preferedstereoscopicmode default="true">100</preferedstereoscopicmode> + <resolution default="true">16</resolution> + <screen default="true">0</screen> + <screenmode default="true">DESKTOP</screenmode> + <stereoscopicmode default="true">0</stereoscopicmode> + <textures32 default="true">false</textures32> + <vsync default="true">2</vsync> + </videoscreen> + <weather> + <addon default="true"></addon> + <currentlocation default="true">1</currentlocation> + </weather> + <window> + <height default="true">480</height> + <width default="true">720</width> + </window> + <skinsettings> + <setting type="bool" name="skin.slice.DebugInfo">false</setting> + <setting type="bool" name="skin.slice.DebugGrid">false</setting> + <setting type="bool" name="skin.slice.LayoutGrid">false</setting> + <setting type="bool" name="skin.slice.AutoScroll">false</setting> + <setting type="bool" name="skin.slice.PVR_Enabled">false</setting> + </skinsettings> + <resolutions /> + <defaultvideosettings> + <deinterlacemode>1</deinterlacemode> + <interlacemethod>1</interlacemethod> + <scalingmethod>1</scalingmethod> + <noisereduction>0.000000</noisereduction> + <postprocess>false</postprocess> + <sharpness>0.000000</sharpness> + <viewmode>0</viewmode> + <zoomamount>1.000000</zoomamount> + <pixelratio>1.000000</pixelratio> + <verticalshift>0.000000</verticalshift> + <volumeamplification>0.000000</volumeamplification> + <outputtoallspeakers>false</outputtoallspeakers> + <showsubtitles>false</showsubtitles> + <brightness>50.000000</brightness> + <contrast>50.000000</contrast> + <gamma>20.000000</gamma> + <audiodelay>0.000000</audiodelay> + <subtitledelay>0.000000</subtitledelay> + <autocrop>false</autocrop> + <nonlinstretch>false</nonlinstretch> + <stereomode>0</stereomode> + </defaultvideosettings> + <viewstates> + <musicfiles> + <viewmode>720896</viewmode> + <sortmethod>1</sortmethod> + <sortorder>1</sortorder> + <sortattributes>0</sortattributes> + </musicfiles> + <musiclastfm> + <viewmode>65536</viewmode> + <sortmethod>1</sortmethod> + <sortorder>1</sortorder> + <sortattributes>0</sortattributes> + </musiclastfm> + <musicnavalbums> + <viewmode>65536</viewmode> + <sortmethod>1</sortmethod> + <sortorder>1</sortorder> + <sortattributes>0</sortattributes> + </musicnavalbums> + <musicnavartists> + <viewmode>65536</viewmode> + <sortmethod>1</sortmethod> + <sortorder>1</sortorder> + <sortattributes>0</sortattributes> + </musicnavartists> + <musicnavsongs> + <viewmode>65536</viewmode> + <sortmethod>1</sortmethod> + <sortorder>1</sortorder> + <sortattributes>0</sortattributes> + </musicnavsongs> + <pictures> + <viewmode>720896</viewmode> + <sortmethod>1</sortmethod> + <sortorder>1</sortorder> + <sortattributes>0</sortattributes> + </pictures> + <programs> + <viewmode>720896</viewmode> + <sortmethod>1</sortmethod> + <sortorder>1</sortorder> + <sortattributes>0</sortattributes> + </programs> + <videofiles> + <viewmode>720896</viewmode> + <sortmethod>1</sortmethod> + <sortorder>1</sortorder> + <sortattributes>0</sortattributes> + </videofiles> + <videonavactors> + <viewmode>65536</viewmode> + <sortmethod>1</sortmethod> + <sortorder>1</sortorder> + <sortattributes>0</sortattributes> + </videonavactors> + <videonavepisodes> + <viewmode>720896</viewmode> + <sortmethod>21</sortmethod> + <sortorder>1</sortorder> + <sortattributes>0</sortattributes> + </videonavepisodes> + <videonavgenres> + <viewmode>65536</viewmode> + <sortmethod>1</sortmethod> + <sortorder>1</sortorder> + <sortattributes>0</sortattributes> + </videonavgenres> + <videonavmusicvideos> + <viewmode>65536</viewmode> + <sortmethod>1</sortmethod> + <sortorder>1</sortorder> + <sortattributes>0</sortattributes> + </videonavmusicvideos> + <videonavseasons> + <viewmode>65536</viewmode> + <sortmethod>1</sortmethod> + <sortorder>1</sortorder> + <sortattributes>0</sortattributes> + </videonavseasons> + <videonavtitles> + <viewmode>65536</viewmode> + <sortmethod>1</sortmethod> + <sortorder>1</sortorder> + <sortattributes>0</sortattributes> + </videonavtitles> + <videonavtvshows> + <viewmode>65536</viewmode> + <sortmethod>1</sortmethod> + <sortorder>1</sortorder> + <sortattributes>0</sortattributes> + </videonavtvshows> + <videonavyears> + <viewmode>65536</viewmode> + <sortmethod>1</sortmethod> + <sortorder>1</sortorder> + <sortattributes>0</sortattributes> + </videonavyears> + </viewstates> + <audio> + <mute>false</mute> + <fvolumelevel>1.000000</fvolumelevel> + </audio> +</settings> diff --git a/projects/Slice/kodi/ledpatterns/ffwd.png b/projects/Slice/kodi/ledpatterns/ffwd.png new file mode 100644 index 00000000000..5bee66fb5cf Binary files /dev/null and b/projects/Slice/kodi/ledpatterns/ffwd.png differ diff --git a/projects/Slice/kodi/ledpatterns/pause.png b/projects/Slice/kodi/ledpatterns/pause.png new file mode 100644 index 00000000000..60a480f1047 Binary files /dev/null and b/projects/Slice/kodi/ledpatterns/pause.png differ diff --git a/projects/Slice/kodi/ledpatterns/play.png b/projects/Slice/kodi/ledpatterns/play.png new file mode 100644 index 00000000000..ae890193286 Binary files /dev/null and b/projects/Slice/kodi/ledpatterns/play.png differ diff --git a/projects/Slice/kodi/ledpatterns/quit.png b/projects/Slice/kodi/ledpatterns/quit.png new file mode 100644 index 00000000000..667ada77e62 Binary files /dev/null and b/projects/Slice/kodi/ledpatterns/quit.png differ diff --git a/projects/Slice/kodi/ledpatterns/rew.png b/projects/Slice/kodi/ledpatterns/rew.png new file mode 100644 index 00000000000..0420bee2905 Binary files /dev/null and b/projects/Slice/kodi/ledpatterns/rew.png differ diff --git a/projects/Slice/kodi/ledpatterns/shutdown.png b/projects/Slice/kodi/ledpatterns/shutdown.png new file mode 100644 index 00000000000..d4fde7ee7bd Binary files /dev/null and b/projects/Slice/kodi/ledpatterns/shutdown.png differ diff --git a/projects/Slice/kodi/ledpatterns/skipf.png b/projects/Slice/kodi/ledpatterns/skipf.png new file mode 100644 index 00000000000..2018e325eb8 Binary files /dev/null and b/projects/Slice/kodi/ledpatterns/skipf.png differ diff --git a/projects/Slice/kodi/ledpatterns/skipr.png b/projects/Slice/kodi/ledpatterns/skipr.png new file mode 100644 index 00000000000..9292082b82f Binary files /dev/null and b/projects/Slice/kodi/ledpatterns/skipr.png differ diff --git a/projects/Slice/kodi/ledpatterns/sleep.png b/projects/Slice/kodi/ledpatterns/sleep.png new file mode 100644 index 00000000000..3cef539d53e Binary files /dev/null and b/projects/Slice/kodi/ledpatterns/sleep.png differ diff --git a/projects/Slice/kodi/ledpatterns/startup.png b/projects/Slice/kodi/ledpatterns/startup.png new file mode 100644 index 00000000000..282954b4a8e Binary files /dev/null and b/projects/Slice/kodi/ledpatterns/startup.png differ diff --git a/projects/Slice/kodi/ledpatterns/stop.png b/projects/Slice/kodi/ledpatterns/stop.png new file mode 100644 index 00000000000..e02589b8136 Binary files /dev/null and b/projects/Slice/kodi/ledpatterns/stop.png differ diff --git a/projects/Slice/kodi/ledpatterns/wake.png b/projects/Slice/kodi/ledpatterns/wake.png new file mode 100644 index 00000000000..31944073b09 Binary files /dev/null and b/projects/Slice/kodi/ledpatterns/wake.png differ diff --git a/projects/Slice/linux/linux.arm.conf b/projects/Slice/linux/linux.arm.conf new file mode 100644 index 00000000000..7a0da03eb4d --- /dev/null +++ b/projects/Slice/linux/linux.arm.conf @@ -0,0 +1,4011 @@ +# +# Automatically generated file; DO NOT EDIT. +# Linux/arm 4.6.0-rc5 Kernel Configuration +# +CONFIG_ARM=y +CONFIG_SYS_SUPPORTS_APM_EMULATION=y +CONFIG_HAVE_PROC_CPU=y +CONFIG_STACKTRACE_SUPPORT=y +CONFIG_LOCKDEP_SUPPORT=y +CONFIG_TRACE_IRQFLAGS_SUPPORT=y +CONFIG_RWSEM_XCHGADD_ALGORITHM=y +CONFIG_FIX_EARLYCON_MEM=y +CONFIG_GENERIC_HWEIGHT=y +CONFIG_GENERIC_CALIBRATE_DELAY=y +CONFIG_NEED_DMA_MAP_STATE=y +CONFIG_ARCH_SUPPORTS_UPROBES=y +CONFIG_FIQ=y +CONFIG_VECTORS_BASE=0xffff0000 +# CONFIG_ARM_PATCH_PHYS_VIRT is not set +CONFIG_NEED_MACH_IO_H=y +CONFIG_NEED_MACH_MEMORY_H=y +CONFIG_PHYS_OFFSET=0x0 +CONFIG_GENERIC_BUG=y +CONFIG_PGTABLE_LEVELS=2 +CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" +CONFIG_IRQ_WORK=y +CONFIG_BUILDTIME_EXTABLE_SORT=y + +# +# General setup +# +CONFIG_BROKEN_ON_SMP=y +CONFIG_INIT_ENV_ARG_LIMIT=32 +CONFIG_CROSS_COMPILE="" +# CONFIG_COMPILE_TEST is not set +CONFIG_LOCALVERSION="" +# CONFIG_LOCALVERSION_AUTO is not set +CONFIG_HAVE_KERNEL_GZIP=y +CONFIG_HAVE_KERNEL_LZMA=y +CONFIG_HAVE_KERNEL_XZ=y +CONFIG_HAVE_KERNEL_LZO=y +CONFIG_HAVE_KERNEL_LZ4=y +CONFIG_KERNEL_GZIP=y +# CONFIG_KERNEL_LZMA is not set +# CONFIG_KERNEL_XZ is not set +# CONFIG_KERNEL_LZO is not set +# CONFIG_KERNEL_LZ4 is not set +CONFIG_DEFAULT_HOSTNAME="@DISTRONAME@" +CONFIG_SWAP=y +CONFIG_SYSVIPC=y +CONFIG_SYSVIPC_SYSCTL=y +CONFIG_POSIX_MQUEUE=y +CONFIG_POSIX_MQUEUE_SYSCTL=y +CONFIG_CROSS_MEMORY_ATTACH=y +CONFIG_FHANDLE=y +# CONFIG_USELIB is not set +# CONFIG_AUDIT is not set +CONFIG_HAVE_ARCH_AUDITSYSCALL=y + +# +# IRQ subsystem +# +CONFIG_GENERIC_IRQ_PROBE=y +CONFIG_GENERIC_IRQ_SHOW=y +CONFIG_GENERIC_IRQ_SHOW_LEVEL=y +CONFIG_HARDIRQS_SW_RESEND=y +CONFIG_IRQ_DOMAIN=y +CONFIG_HANDLE_DOMAIN_IRQ=y +# CONFIG_IRQ_DOMAIN_DEBUG is not set +CONFIG_IRQ_FORCED_THREADING=y +CONFIG_SPARSE_IRQ=y +CONFIG_GENERIC_CLOCKEVENTS=y + +# +# Timers subsystem +# +CONFIG_TICK_ONESHOT=y +CONFIG_NO_HZ_COMMON=y +# CONFIG_HZ_PERIODIC is not set +CONFIG_NO_HZ_IDLE=y +CONFIG_NO_HZ=y +CONFIG_HIGH_RES_TIMERS=y + +# +# CPU/Task time and stats accounting +# +CONFIG_TICK_CPU_ACCOUNTING=y +# CONFIG_VIRT_CPU_ACCOUNTING_GEN is not set +# CONFIG_IRQ_TIME_ACCOUNTING is not set +# CONFIG_BSD_PROCESS_ACCT is not set +# CONFIG_TASKSTATS is not set + +# +# RCU Subsystem +# +CONFIG_TINY_RCU=y +# CONFIG_RCU_EXPERT is not set +CONFIG_SRCU=y +# CONFIG_TASKS_RCU is not set +# CONFIG_RCU_STALL_COMMON is not set +# CONFIG_TREE_RCU_TRACE is not set +# CONFIG_RCU_EXPEDITE_BOOT is not set +CONFIG_BUILD_BIN2C=y +CONFIG_IKCONFIG=m +CONFIG_IKCONFIG_PROC=y +CONFIG_LOG_BUF_SHIFT=17 +CONFIG_GENERIC_SCHED_CLOCK=y +CONFIG_CGROUPS=y +CONFIG_PAGE_COUNTER=y +CONFIG_MEMCG=y +# CONFIG_MEMCG_SWAP is not set +CONFIG_BLK_CGROUP=y +# CONFIG_DEBUG_BLK_CGROUP is not set +CONFIG_CGROUP_WRITEBACK=y +CONFIG_CGROUP_SCHED=y +# CONFIG_FAIR_GROUP_SCHED is not set +# CONFIG_RT_GROUP_SCHED is not set +# CONFIG_CGROUP_PIDS is not set +CONFIG_CGROUP_FREEZER=y +CONFIG_CPUSETS=y +CONFIG_PROC_PID_CPUSET=y +CONFIG_CGROUP_DEVICE=y +CONFIG_CGROUP_CPUACCT=y +# CONFIG_CGROUP_DEBUG is not set +# CONFIG_CHECKPOINT_RESTORE is not set +CONFIG_NAMESPACES=y +CONFIG_UTS_NS=y +CONFIG_IPC_NS=y +# CONFIG_USER_NS is not set +CONFIG_PID_NS=y +CONFIG_NET_NS=y +# CONFIG_SCHED_AUTOGROUP is not set +# CONFIG_SYSFS_DEPRECATED is not set +CONFIG_RELAY=y +CONFIG_BLK_DEV_INITRD=y +CONFIG_INITRAMFS_SOURCE=" " +CONFIG_INITRAMFS_ROOT_UID=0 +CONFIG_INITRAMFS_ROOT_GID=0 +CONFIG_RD_GZIP=y +# CONFIG_RD_BZIP2 is not set +# CONFIG_RD_LZMA is not set +# CONFIG_RD_XZ is not set +# CONFIG_RD_LZO is not set +# CONFIG_RD_LZ4 is not set +# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set +CONFIG_SYSCTL=y +CONFIG_ANON_INODES=y +CONFIG_HAVE_UID16=y +CONFIG_BPF=y +CONFIG_EXPERT=y +# CONFIG_UID16 is not set +CONFIG_MULTIUSER=y +# CONFIG_SGETMASK_SYSCALL is not set +# CONFIG_SYSFS_SYSCALL is not set +CONFIG_SYSCTL_SYSCALL=y +CONFIG_KALLSYMS=y +# CONFIG_KALLSYMS_ALL is not set +# CONFIG_KALLSYMS_ABSOLUTE_PERCPU is not set +CONFIG_KALLSYMS_BASE_RELATIVE=y +CONFIG_PRINTK=y +CONFIG_BUG=y +CONFIG_ELF_CORE=y +CONFIG_BASE_FULL=y +CONFIG_FUTEX=y +CONFIG_EPOLL=y +CONFIG_SIGNALFD=y +CONFIG_TIMERFD=y +CONFIG_EVENTFD=y +# CONFIG_BPF_SYSCALL is not set +CONFIG_SHMEM=y +# CONFIG_AIO is not set +CONFIG_ADVISE_SYSCALLS=y +# CONFIG_USERFAULTFD is not set +CONFIG_MEMBARRIER=y +CONFIG_EMBEDDED=y +CONFIG_HAVE_PERF_EVENTS=y +CONFIG_PERF_USE_VMALLOC=y + +# +# Kernel Performance Events And Counters +# +# CONFIG_PERF_EVENTS is not set +# CONFIG_VM_EVENT_COUNTERS is not set +CONFIG_SLUB_DEBUG=y +# CONFIG_COMPAT_BRK is not set +# CONFIG_SLAB is not set +CONFIG_SLUB=y +# CONFIG_SLOB is not set +# CONFIG_SYSTEM_DATA_VERIFICATION is not set +# CONFIG_PROFILING is not set +CONFIG_HAVE_OPROFILE=y +# CONFIG_KPROBES is not set +CONFIG_JUMP_LABEL=y +# CONFIG_STATIC_KEYS_SELFTEST is not set +# CONFIG_UPROBES is not set +# CONFIG_HAVE_64BIT_ALIGNED_ACCESS is not set +CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y +CONFIG_ARCH_USE_BUILTIN_BSWAP=y +CONFIG_HAVE_KPROBES=y +CONFIG_HAVE_KRETPROBES=y +CONFIG_HAVE_OPTPROBES=y +CONFIG_HAVE_ARCH_TRACEHOOK=y +CONFIG_HAVE_DMA_CONTIGUOUS=y +CONFIG_GENERIC_SMP_IDLE_THREAD=y +CONFIG_GENERIC_IDLE_POLL_SETUP=y +CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y +CONFIG_HAVE_CLK=y +CONFIG_HAVE_DMA_API_DEBUG=y +CONFIG_HAVE_PERF_REGS=y +CONFIG_HAVE_PERF_USER_STACK_DUMP=y +CONFIG_HAVE_ARCH_JUMP_LABEL=y +CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y +CONFIG_HAVE_ARCH_SECCOMP_FILTER=y +CONFIG_HAVE_CC_STACKPROTECTOR=y +# CONFIG_CC_STACKPROTECTOR is not set +CONFIG_CC_STACKPROTECTOR_NONE=y +# CONFIG_CC_STACKPROTECTOR_REGULAR is not set +# CONFIG_CC_STACKPROTECTOR_STRONG is not set +CONFIG_HAVE_CONTEXT_TRACKING=y +CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y +CONFIG_HAVE_IRQ_TIME_ACCOUNTING=y +CONFIG_HAVE_MOD_ARCH_SPECIFIC=y +CONFIG_MODULES_USE_ELF_REL=y +CONFIG_ARCH_HAS_ELF_RANDOMIZE=y +CONFIG_HAVE_ARCH_MMAP_RND_BITS=y +CONFIG_ARCH_MMAP_RND_BITS_MIN=8 +CONFIG_ARCH_MMAP_RND_BITS_MAX=15 +CONFIG_ARCH_MMAP_RND_BITS=8 +CONFIG_CLONE_BACKWARDS=y +CONFIG_OLD_SIGSUSPEND3=y +CONFIG_OLD_SIGACTION=y + +# +# GCOV-based kernel profiling +# +# CONFIG_GCOV_KERNEL is not set +CONFIG_ARCH_HAS_GCOV_PROFILE_ALL=y +CONFIG_HAVE_GENERIC_DMA_COHERENT=y +CONFIG_SLABINFO=y +CONFIG_RT_MUTEXES=y +CONFIG_BASE_SMALL=0 +CONFIG_MODULES=y +# CONFIG_MODULE_FORCE_LOAD is not set +CONFIG_MODULE_UNLOAD=y +# CONFIG_MODULE_FORCE_UNLOAD is not set +# CONFIG_MODVERSIONS is not set +# CONFIG_MODULE_SRCVERSION_ALL is not set +# CONFIG_MODULE_SIG is not set +# CONFIG_MODULE_COMPRESS is not set +CONFIG_BLOCK=y +CONFIG_LBDAF=y +CONFIG_BLK_DEV_BSG=y +CONFIG_BLK_DEV_BSGLIB=y +# CONFIG_BLK_DEV_INTEGRITY is not set +# CONFIG_BLK_DEV_THROTTLING is not set +# CONFIG_BLK_CMDLINE_PARSER is not set + +# +# Partition Types +# +CONFIG_PARTITION_ADVANCED=y +# CONFIG_ACORN_PARTITION is not set +# CONFIG_AIX_PARTITION is not set +# CONFIG_OSF_PARTITION is not set +# CONFIG_AMIGA_PARTITION is not set +# CONFIG_ATARI_PARTITION is not set +CONFIG_MAC_PARTITION=y +CONFIG_MSDOS_PARTITION=y +# CONFIG_BSD_DISKLABEL is not set +# CONFIG_MINIX_SUBPARTITION is not set +# CONFIG_SOLARIS_X86_PARTITION is not set +# CONFIG_UNIXWARE_DISKLABEL is not set +CONFIG_LDM_PARTITION=y +# CONFIG_LDM_DEBUG is not set +# CONFIG_SGI_PARTITION is not set +# CONFIG_ULTRIX_PARTITION is not set +# CONFIG_SUN_PARTITION is not set +# CONFIG_KARMA_PARTITION is not set +CONFIG_EFI_PARTITION=y +# CONFIG_SYSV68_PARTITION is not set +# CONFIG_CMDLINE_PARTITION is not set + +# +# IO Schedulers +# +CONFIG_IOSCHED_NOOP=y +CONFIG_IOSCHED_DEADLINE=y +CONFIG_IOSCHED_CFQ=y +# CONFIG_CFQ_GROUP_IOSCHED is not set +# CONFIG_DEFAULT_DEADLINE is not set +# CONFIG_DEFAULT_CFQ is not set +CONFIG_DEFAULT_NOOP=y +CONFIG_DEFAULT_IOSCHED="noop" +CONFIG_INLINE_SPIN_UNLOCK_IRQ=y +CONFIG_INLINE_READ_UNLOCK=y +CONFIG_INLINE_READ_UNLOCK_IRQ=y +CONFIG_INLINE_WRITE_UNLOCK=y +CONFIG_INLINE_WRITE_UNLOCK_IRQ=y +CONFIG_ARCH_SUPPORTS_ATOMIC_RMW=y +CONFIG_FREEZER=y + +# +# System Type +# +CONFIG_MMU=y +CONFIG_ARCH_BCM2708=y +# CONFIG_ARCH_BCM2709 is not set +# CONFIG_ARCH_MULTIPLATFORM is not set +# CONFIG_ARCH_CLPS711X is not set +# CONFIG_ARCH_GEMINI is not set +# CONFIG_ARCH_EBSA110 is not set +# CONFIG_ARCH_EP93XX is not set +# CONFIG_ARCH_FOOTBRIDGE is not set +# CONFIG_ARCH_NETX is not set +# CONFIG_ARCH_IOP13XX is not set +# CONFIG_ARCH_IOP32X is not set +# CONFIG_ARCH_IOP33X is not set +# CONFIG_ARCH_IXP4XX is not set +# CONFIG_ARCH_DOVE is not set +# CONFIG_ARCH_KS8695 is not set +# CONFIG_ARCH_W90X900 is not set +# CONFIG_ARCH_LPC32XX is not set +# CONFIG_ARCH_PXA is not set +# CONFIG_ARCH_RPC is not set +# CONFIG_ARCH_SA1100 is not set +# CONFIG_ARCH_S3C24XX is not set +# CONFIG_ARCH_DAVINCI is not set +# CONFIG_ARCH_OMAP1 is not set + +# +# Broadcom BCM2708 Implementations +# +CONFIG_MACH_BCM2708=y +# CONFIG_BCM2708_NOL2CACHE is not set + +# +# Processor Type +# +CONFIG_CPU_V6=y +CONFIG_CPU_32v6=y +CONFIG_CPU_ABRT_EV6=y +CONFIG_CPU_PABRT_V6=y +CONFIG_CPU_CACHE_V6=y +CONFIG_CPU_CACHE_VIPT=y +CONFIG_CPU_COPY_V6=y +CONFIG_CPU_TLB_V6=y +CONFIG_CPU_HAS_ASID=y +CONFIG_CPU_CP15=y +CONFIG_CPU_CP15_MMU=y + +# +# Processor Features +# +# CONFIG_ARCH_PHYS_ADDR_T_64BIT is not set +CONFIG_ARM_THUMB=y +# CONFIG_CPU_ICACHE_DISABLE is not set +# CONFIG_CPU_DCACHE_DISABLE is not set +# CONFIG_CPU_BPREDICT_DISABLE is not set +CONFIG_KUSER_HELPERS=y +# CONFIG_CACHE_L2X0 is not set +CONFIG_ARM_L1_CACHE_SHIFT=5 +CONFIG_ARM_DMA_MEM_BUFFERABLE=y +# CONFIG_DEBUG_RODATA is not set +CONFIG_MULTI_IRQ_HANDLER=y +CONFIG_ARM_ERRATA_326103=y +CONFIG_ARM_ERRATA_411920=y +CONFIG_ARM_ERRATA_364296=y + +# +# Bus support +# +# CONFIG_PCI_DOMAINS_GENERIC is not set +# CONFIG_PCI_SYSCALL is not set +# CONFIG_PCCARD is not set + +# +# Kernel Features +# +# CONFIG_VMSPLIT_3G is not set +# CONFIG_VMSPLIT_3G_OPT is not set +CONFIG_VMSPLIT_2G=y +# CONFIG_VMSPLIT_1G is not set +CONFIG_PAGE_OFFSET=0x80000000 +CONFIG_ARCH_NR_GPIO=0 +# CONFIG_PREEMPT_NONE is not set +CONFIG_PREEMPT_VOLUNTARY=y +# CONFIG_PREEMPT is not set +CONFIG_HZ_FIXED=0 +# CONFIG_HZ_100 is not set +# CONFIG_HZ_200 is not set +# CONFIG_HZ_250 is not set +CONFIG_HZ_300=y +# CONFIG_HZ_500 is not set +# CONFIG_HZ_1000 is not set +CONFIG_HZ=300 +CONFIG_SCHED_HRTICK=y +CONFIG_AEABI=y +# CONFIG_OABI_COMPAT is not set +# CONFIG_ARCH_SPARSEMEM_DEFAULT is not set +# CONFIG_ARCH_SELECT_MEMORY_MODEL is not set +CONFIG_HAVE_ARCH_PFN_VALID=y +# CONFIG_HIGHMEM is not set +# CONFIG_CPU_SW_DOMAIN_PAN is not set +CONFIG_ARCH_WANT_GENERAL_HUGETLB=y +# CONFIG_ARM_MODULE_PLTS is not set +CONFIG_FLATMEM=y +CONFIG_FLAT_NODE_MEM_MAP=y +CONFIG_HAVE_MEMBLOCK=y +CONFIG_NO_BOOTMEM=y +CONFIG_MEMORY_ISOLATION=y +# CONFIG_HAVE_BOOTMEM_INFO_NODE is not set +CONFIG_SPLIT_PTLOCK_CPUS=4 +CONFIG_COMPACTION=y +CONFIG_MIGRATION=y +# CONFIG_PHYS_ADDR_T_64BIT is not set +CONFIG_ZONE_DMA_FLAG=0 +# CONFIG_KSM is not set +CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 +CONFIG_NEED_PER_CPU_KM=y +CONFIG_CLEANCACHE=y +CONFIG_FRONTSWAP=y +CONFIG_CMA=y +# CONFIG_CMA_DEBUG is not set +# CONFIG_CMA_DEBUGFS is not set +CONFIG_CMA_AREAS=7 +# CONFIG_ZSWAP is not set +# CONFIG_ZPOOL is not set +# CONFIG_ZBUD is not set +# CONFIG_ZSMALLOC is not set +CONFIG_GENERIC_EARLY_IOREMAP=y +# CONFIG_IDLE_PAGE_TRACKING is not set +CONFIG_FRAME_VECTOR=y +CONFIG_FORCE_MAX_ZONEORDER=11 +CONFIG_ALIGNMENT_TRAP=y +CONFIG_UACCESS_WITH_MEMCPY=y +# CONFIG_SECCOMP is not set +CONFIG_SWIOTLB=y +CONFIG_IOMMU_HELPER=y +# CONFIG_PARAVIRT is not set +# CONFIG_PARAVIRT_TIME_ACCOUNTING is not set + +# +# Boot options +# +CONFIG_USE_OF=y +CONFIG_ATAGS=y +# CONFIG_DEPRECATED_PARAM_STRUCT is not set +CONFIG_ZBOOT_ROM_TEXT=0x0 +CONFIG_ZBOOT_ROM_BSS=0x0 +# CONFIG_ARM_APPENDED_DTB is not set +CONFIG_CMDLINE="root=/dev/ram0 rdinit=/init BOOT_IMAGE=/kernel.img usbcore.autosuspend=-1" +# CONFIG_CMDLINE_FROM_BOOTLOADER is not set +CONFIG_CMDLINE_EXTEND=y +# CONFIG_CMDLINE_FORCE is not set +# CONFIG_XIP_KERNEL is not set +# CONFIG_KEXEC is not set +# CONFIG_CRASH_DUMP is not set +# CONFIG_AUTO_ZRELADDR is not set + +# +# CPU Power Management +# + +# +# CPU Frequency scaling +# +CONFIG_CPU_FREQ=y +CONFIG_CPU_FREQ_GOV_COMMON=y +# CONFIG_CPU_FREQ_STAT is not set +# CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set +# CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE is not set +# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set +CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y +# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set +CONFIG_CPU_FREQ_GOV_PERFORMANCE=y +CONFIG_CPU_FREQ_GOV_POWERSAVE=y +# CONFIG_CPU_FREQ_GOV_USERSPACE is not set +CONFIG_CPU_FREQ_GOV_ONDEMAND=y +# CONFIG_CPU_FREQ_GOV_CONSERVATIVE is not set + +# +# CPU frequency scaling drivers +# +# CONFIG_CPUFREQ_DT is not set +# CONFIG_ARM_KIRKWOOD_CPUFREQ is not set +CONFIG_ARM_BCM2835_CPUFREQ=y +# CONFIG_QORIQ_CPUFREQ is not set + +# +# CPU Idle +# +CONFIG_CPU_IDLE=y +CONFIG_CPU_IDLE_GOV_LADDER=y +CONFIG_CPU_IDLE_GOV_MENU=y + +# +# ARM CPU Idle Drivers +# +# CONFIG_ARM_CPUIDLE is not set +# CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED is not set + +# +# Floating point emulation +# + +# +# At least one emulation must be selected +# +CONFIG_VFP=y + +# +# Userspace binary formats +# +CONFIG_BINFMT_ELF=y +CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS=y +CONFIG_BINFMT_SCRIPT=y +# CONFIG_HAVE_AOUT is not set +# CONFIG_BINFMT_MISC is not set +CONFIG_COREDUMP=y + +# +# Power management options +# +# CONFIG_SUSPEND is not set +# CONFIG_HIBERNATION is not set +# CONFIG_PM is not set +# CONFIG_APM_EMULATION is not set +CONFIG_CPU_PM=y +CONFIG_ARCH_SUSPEND_POSSIBLE=y +# CONFIG_ARM_CPU_SUSPEND is not set +CONFIG_ARCH_HIBERNATION_POSSIBLE=y +CONFIG_NET=y + +# +# Networking options +# +CONFIG_PACKET=y +# CONFIG_PACKET_DIAG is not set +CONFIG_UNIX=y +# CONFIG_UNIX_DIAG is not set +# CONFIG_XFRM_USER is not set +# CONFIG_NET_KEY is not set +CONFIG_INET=y +CONFIG_IP_MULTICAST=y +# CONFIG_IP_ADVANCED_ROUTER is not set +CONFIG_IP_PNP=y +CONFIG_IP_PNP_DHCP=y +CONFIG_IP_PNP_BOOTP=y +# CONFIG_IP_PNP_RARP is not set +# CONFIG_NET_IPIP is not set +# CONFIG_NET_IPGRE_DEMUX is not set +CONFIG_NET_IP_TUNNEL=m +CONFIG_IP_MROUTE=y +# CONFIG_IP_PIMSM_V1 is not set +# CONFIG_IP_PIMSM_V2 is not set +# CONFIG_SYN_COOKIES is not set +# CONFIG_NET_UDP_TUNNEL is not set +# CONFIG_NET_FOU is not set +# CONFIG_NET_FOU_IP_TUNNELS is not set +# CONFIG_INET_AH is not set +# CONFIG_INET_ESP is not set +# CONFIG_INET_IPCOMP is not set +# CONFIG_INET_XFRM_TUNNEL is not set +CONFIG_INET_TUNNEL=m +# CONFIG_INET_XFRM_MODE_TRANSPORT is not set +# CONFIG_INET_XFRM_MODE_TUNNEL is not set +# CONFIG_INET_XFRM_MODE_BEET is not set +# CONFIG_INET_DIAG is not set +# CONFIG_TCP_CONG_ADVANCED is not set +CONFIG_TCP_CONG_CUBIC=y +CONFIG_DEFAULT_TCP_CONG="cubic" +# CONFIG_TCP_MD5SIG is not set +CONFIG_IPV6=y +# CONFIG_IPV6_ROUTER_PREF is not set +# CONFIG_IPV6_OPTIMISTIC_DAD is not set +# CONFIG_INET6_AH is not set +# CONFIG_INET6_ESP is not set +# CONFIG_INET6_IPCOMP is not set +# CONFIG_IPV6_MIP6 is not set +# CONFIG_IPV6_ILA is not set +# CONFIG_INET6_XFRM_TUNNEL is not set +# CONFIG_INET6_TUNNEL is not set +# CONFIG_INET6_XFRM_MODE_TRANSPORT is not set +# CONFIG_INET6_XFRM_MODE_TUNNEL is not set +# CONFIG_INET6_XFRM_MODE_BEET is not set +# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set +CONFIG_IPV6_SIT=m +# CONFIG_IPV6_SIT_6RD is not set +CONFIG_IPV6_NDISC_NODETYPE=y +# CONFIG_IPV6_TUNNEL is not set +# CONFIG_IPV6_GRE is not set +# CONFIG_IPV6_MULTIPLE_TABLES is not set +# CONFIG_IPV6_MROUTE is not set +# CONFIG_NETWORK_SECMARK is not set +# CONFIG_NET_PTP_CLASSIFY is not set +# CONFIG_NETWORK_PHY_TIMESTAMPING is not set +CONFIG_NETFILTER=y +# CONFIG_NETFILTER_DEBUG is not set +CONFIG_NETFILTER_ADVANCED=y +CONFIG_BRIDGE_NETFILTER=m + +# +# Core Netfilter Configuration +# +# CONFIG_NETFILTER_INGRESS is not set +CONFIG_NETFILTER_NETLINK=m +# CONFIG_NETFILTER_NETLINK_ACCT is not set +# CONFIG_NETFILTER_NETLINK_QUEUE is not set +CONFIG_NETFILTER_NETLINK_LOG=m +CONFIG_NF_CONNTRACK=m +# CONFIG_NF_CONNTRACK_MARK is not set +# CONFIG_NF_CONNTRACK_PROCFS is not set +# CONFIG_NF_CONNTRACK_EVENTS is not set +# CONFIG_NF_CONNTRACK_TIMEOUT is not set +# CONFIG_NF_CONNTRACK_TIMESTAMP is not set +# CONFIG_NF_CT_PROTO_DCCP is not set +# CONFIG_NF_CT_PROTO_SCTP is not set +# CONFIG_NF_CT_PROTO_UDPLITE is not set +# CONFIG_NF_CONNTRACK_AMANDA is not set +CONFIG_NF_CONNTRACK_FTP=m +# CONFIG_NF_CONNTRACK_H323 is not set +CONFIG_NF_CONNTRACK_IRC=m +CONFIG_NF_CONNTRACK_BROADCAST=m +CONFIG_NF_CONNTRACK_NETBIOS_NS=m +# CONFIG_NF_CONNTRACK_SNMP is not set +# CONFIG_NF_CONNTRACK_PPTP is not set +# CONFIG_NF_CONNTRACK_SANE is not set +CONFIG_NF_CONNTRACK_SIP=m +# CONFIG_NF_CONNTRACK_TFTP is not set +CONFIG_NF_CT_NETLINK=m +# CONFIG_NF_CT_NETLINK_TIMEOUT is not set +# CONFIG_NETFILTER_NETLINK_GLUE_CT is not set +CONFIG_NF_NAT=m +CONFIG_NF_NAT_NEEDED=y +# CONFIG_NF_NAT_AMANDA is not set +CONFIG_NF_NAT_FTP=m +CONFIG_NF_NAT_IRC=m +CONFIG_NF_NAT_SIP=m +# CONFIG_NF_NAT_TFTP is not set +# CONFIG_NF_NAT_REDIRECT is not set +# CONFIG_NF_TABLES is not set +CONFIG_NETFILTER_XTABLES=m + +# +# Xtables combined modules +# +# CONFIG_NETFILTER_XT_MARK is not set +# CONFIG_NETFILTER_XT_CONNMARK is not set + +# +# Xtables targets +# +# CONFIG_NETFILTER_XT_TARGET_CHECKSUM is not set +# CONFIG_NETFILTER_XT_TARGET_CLASSIFY is not set +# CONFIG_NETFILTER_XT_TARGET_CONNMARK is not set +# CONFIG_NETFILTER_XT_TARGET_DSCP is not set +# CONFIG_NETFILTER_XT_TARGET_HL is not set +# CONFIG_NETFILTER_XT_TARGET_HMARK is not set +# CONFIG_NETFILTER_XT_TARGET_IDLETIMER is not set +# CONFIG_NETFILTER_XT_TARGET_LED is not set +# CONFIG_NETFILTER_XT_TARGET_LOG is not set +# CONFIG_NETFILTER_XT_TARGET_MARK is not set +CONFIG_NETFILTER_XT_NAT=m +# CONFIG_NETFILTER_XT_TARGET_NETMAP is not set +# CONFIG_NETFILTER_XT_TARGET_NFLOG is not set +# CONFIG_NETFILTER_XT_TARGET_NFQUEUE is not set +# CONFIG_NETFILTER_XT_TARGET_RATEEST is not set +# CONFIG_NETFILTER_XT_TARGET_REDIRECT is not set +# CONFIG_NETFILTER_XT_TARGET_TEE is not set +# CONFIG_NETFILTER_XT_TARGET_TPROXY is not set +# CONFIG_NETFILTER_XT_TARGET_TCPMSS is not set +# CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP is not set + +# +# Xtables matches +# +CONFIG_NETFILTER_XT_MATCH_ADDRTYPE=m +# CONFIG_NETFILTER_XT_MATCH_BPF is not set +# CONFIG_NETFILTER_XT_MATCH_CGROUP is not set +# CONFIG_NETFILTER_XT_MATCH_CLUSTER is not set +# CONFIG_NETFILTER_XT_MATCH_COMMENT is not set +# CONFIG_NETFILTER_XT_MATCH_CONNBYTES is not set +# CONFIG_NETFILTER_XT_MATCH_CONNLABEL is not set +# CONFIG_NETFILTER_XT_MATCH_CONNLIMIT is not set +# CONFIG_NETFILTER_XT_MATCH_CONNMARK is not set +CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m +# CONFIG_NETFILTER_XT_MATCH_CPU is not set +# CONFIG_NETFILTER_XT_MATCH_DCCP is not set +# CONFIG_NETFILTER_XT_MATCH_DEVGROUP is not set +# CONFIG_NETFILTER_XT_MATCH_DSCP is not set +# CONFIG_NETFILTER_XT_MATCH_ECN is not set +# CONFIG_NETFILTER_XT_MATCH_ESP is not set +# CONFIG_NETFILTER_XT_MATCH_HASHLIMIT is not set +# CONFIG_NETFILTER_XT_MATCH_HELPER is not set +# CONFIG_NETFILTER_XT_MATCH_HL is not set +# CONFIG_NETFILTER_XT_MATCH_IPCOMP is not set +CONFIG_NETFILTER_XT_MATCH_IPRANGE=m +# CONFIG_NETFILTER_XT_MATCH_L2TP is not set +# CONFIG_NETFILTER_XT_MATCH_LENGTH is not set +# CONFIG_NETFILTER_XT_MATCH_LIMIT is not set +# CONFIG_NETFILTER_XT_MATCH_MAC is not set +# CONFIG_NETFILTER_XT_MATCH_MARK is not set +# CONFIG_NETFILTER_XT_MATCH_MULTIPORT is not set +# CONFIG_NETFILTER_XT_MATCH_NFACCT is not set +# CONFIG_NETFILTER_XT_MATCH_OSF is not set +CONFIG_NETFILTER_XT_MATCH_OWNER=m +# CONFIG_NETFILTER_XT_MATCH_PHYSDEV is not set +# CONFIG_NETFILTER_XT_MATCH_PKTTYPE is not set +# CONFIG_NETFILTER_XT_MATCH_QUOTA is not set +# CONFIG_NETFILTER_XT_MATCH_RATEEST is not set +# CONFIG_NETFILTER_XT_MATCH_REALM is not set +# CONFIG_NETFILTER_XT_MATCH_RECENT is not set +# CONFIG_NETFILTER_XT_MATCH_SCTP is not set +# CONFIG_NETFILTER_XT_MATCH_SOCKET is not set +CONFIG_NETFILTER_XT_MATCH_STATE=m +# CONFIG_NETFILTER_XT_MATCH_STATISTIC is not set +# CONFIG_NETFILTER_XT_MATCH_STRING is not set +# CONFIG_NETFILTER_XT_MATCH_TCPMSS is not set +# CONFIG_NETFILTER_XT_MATCH_TIME is not set +# CONFIG_NETFILTER_XT_MATCH_U32 is not set +# CONFIG_IP_SET is not set +# CONFIG_IP_VS is not set + +# +# IP: Netfilter Configuration +# +CONFIG_NF_DEFRAG_IPV4=m +CONFIG_NF_CONNTRACK_IPV4=m +# CONFIG_NF_DUP_IPV4 is not set +# CONFIG_NF_LOG_ARP is not set +# CONFIG_NF_LOG_IPV4 is not set +CONFIG_NF_REJECT_IPV4=m +CONFIG_NF_NAT_IPV4=m +CONFIG_NF_NAT_MASQUERADE_IPV4=m +# CONFIG_NF_NAT_PPTP is not set +# CONFIG_NF_NAT_H323 is not set +CONFIG_IP_NF_IPTABLES=m +# CONFIG_IP_NF_MATCH_AH is not set +# CONFIG_IP_NF_MATCH_ECN is not set +# CONFIG_IP_NF_MATCH_RPFILTER is not set +# CONFIG_IP_NF_MATCH_TTL is not set +CONFIG_IP_NF_FILTER=m +CONFIG_IP_NF_TARGET_REJECT=m +# CONFIG_IP_NF_TARGET_SYNPROXY is not set +CONFIG_IP_NF_NAT=m +CONFIG_IP_NF_TARGET_MASQUERADE=m +# CONFIG_IP_NF_TARGET_NETMAP is not set +# CONFIG_IP_NF_TARGET_REDIRECT is not set +CONFIG_IP_NF_MANGLE=m +# CONFIG_IP_NF_TARGET_CLUSTERIP is not set +# CONFIG_IP_NF_TARGET_ECN is not set +# CONFIG_IP_NF_TARGET_TTL is not set +# CONFIG_IP_NF_RAW is not set +# CONFIG_IP_NF_ARPTABLES is not set + +# +# IPv6: Netfilter Configuration +# +CONFIG_NF_DEFRAG_IPV6=m +CONFIG_NF_CONNTRACK_IPV6=m +# CONFIG_NF_DUP_IPV6 is not set +CONFIG_NF_REJECT_IPV6=m +# CONFIG_NF_LOG_IPV6 is not set +CONFIG_NF_NAT_IPV6=m +# CONFIG_NF_NAT_MASQUERADE_IPV6 is not set +CONFIG_IP6_NF_IPTABLES=m +# CONFIG_IP6_NF_MATCH_AH is not set +# CONFIG_IP6_NF_MATCH_EUI64 is not set +# CONFIG_IP6_NF_MATCH_FRAG is not set +# CONFIG_IP6_NF_MATCH_OPTS is not set +# CONFIG_IP6_NF_MATCH_HL is not set +# CONFIG_IP6_NF_MATCH_IPV6HEADER is not set +# CONFIG_IP6_NF_MATCH_MH is not set +# CONFIG_IP6_NF_MATCH_RPFILTER is not set +# CONFIG_IP6_NF_MATCH_RT is not set +# CONFIG_IP6_NF_TARGET_HL is not set +CONFIG_IP6_NF_FILTER=m +CONFIG_IP6_NF_TARGET_REJECT=m +# CONFIG_IP6_NF_TARGET_SYNPROXY is not set +CONFIG_IP6_NF_MANGLE=m +# CONFIG_IP6_NF_RAW is not set +CONFIG_IP6_NF_NAT=m +# CONFIG_IP6_NF_TARGET_MASQUERADE is not set +# CONFIG_IP6_NF_TARGET_NPT is not set +# CONFIG_BRIDGE_NF_EBTABLES is not set +# CONFIG_IP_DCCP is not set +# CONFIG_IP_SCTP is not set +# CONFIG_RDS is not set +# CONFIG_TIPC is not set +# CONFIG_ATM is not set +# CONFIG_L2TP is not set +CONFIG_STP=m +CONFIG_BRIDGE=m +CONFIG_BRIDGE_IGMP_SNOOPING=y +# CONFIG_BRIDGE_VLAN_FILTERING is not set +CONFIG_HAVE_NET_DSA=y +CONFIG_VLAN_8021Q=m +# CONFIG_VLAN_8021Q_GVRP is not set +# CONFIG_VLAN_8021Q_MVRP is not set +# CONFIG_DECNET is not set +CONFIG_LLC=m +# CONFIG_LLC2 is not set +# CONFIG_IPX is not set +# CONFIG_ATALK is not set +# CONFIG_X25 is not set +# CONFIG_LAPB is not set +# CONFIG_PHONET is not set +# CONFIG_6LOWPAN is not set +# CONFIG_IEEE802154 is not set +# CONFIG_NET_SCHED is not set +# CONFIG_DCB is not set +CONFIG_DNS_RESOLVER=y +# CONFIG_BATMAN_ADV is not set +# CONFIG_OPENVSWITCH is not set +# CONFIG_VSOCKETS is not set +# CONFIG_NETLINK_DIAG is not set +# CONFIG_MPLS is not set +# CONFIG_HSR is not set +# CONFIG_NET_SWITCHDEV is not set +# CONFIG_NET_L3_MASTER_DEV is not set +# CONFIG_SOCK_CGROUP_DATA is not set +# CONFIG_CGROUP_NET_PRIO is not set +# CONFIG_CGROUP_NET_CLASSID is not set +CONFIG_NET_RX_BUSY_POLL=y +CONFIG_BQL=y +# CONFIG_BPF_JIT is not set + +# +# Network testing +# +# CONFIG_NET_PKTGEN is not set +# CONFIG_HAMRADIO is not set +# CONFIG_CAN is not set +# CONFIG_IRDA is not set +CONFIG_BT=m +CONFIG_BT_BREDR=y +CONFIG_BT_RFCOMM=m +CONFIG_BT_RFCOMM_TTY=y +# CONFIG_BT_BNEP is not set +CONFIG_BT_HIDP=m +CONFIG_BT_HS=y +CONFIG_BT_LE=y +# CONFIG_BT_LEDS is not set +# CONFIG_BT_SELFTEST is not set +# CONFIG_BT_DEBUGFS is not set + +# +# Bluetooth device drivers +# +CONFIG_BT_INTEL=m +CONFIG_BT_BCM=m +CONFIG_BT_RTL=m +CONFIG_BT_HCIBTUSB=m +CONFIG_BT_HCIBTUSB_BCM=y +CONFIG_BT_HCIBTUSB_RTL=y +# CONFIG_BT_HCIBTSDIO is not set +CONFIG_BT_HCIUART=m +CONFIG_BT_HCIUART_H4=y +# CONFIG_BT_HCIUART_BCSP is not set +# CONFIG_BT_HCIUART_ATH3K is not set +# CONFIG_BT_HCIUART_LL is not set +CONFIG_BT_HCIUART_3WIRE=y +# CONFIG_BT_HCIUART_INTEL is not set +CONFIG_BT_HCIUART_BCM=y +# CONFIG_BT_HCIUART_QCA is not set +# CONFIG_BT_HCIUART_AG6XX is not set +CONFIG_BT_HCIBCM203X=m +# CONFIG_BT_HCIBPA10X is not set +CONFIG_BT_HCIBFUSB=m +# CONFIG_BT_HCIVHCI is not set +# CONFIG_BT_MRVL is not set +CONFIG_BT_ATH3K=m +# CONFIG_AF_RXRPC is not set +# CONFIG_AF_KCM is not set +CONFIG_WIRELESS=y +CONFIG_WIRELESS_EXT=y +CONFIG_WEXT_CORE=y +CONFIG_WEXT_PROC=y +CONFIG_WEXT_PRIV=y +CONFIG_CFG80211=m +# CONFIG_NL80211_TESTMODE is not set +# CONFIG_CFG80211_DEVELOPER_WARNINGS is not set +# CONFIG_CFG80211_CERTIFICATION_ONUS is not set +CONFIG_CFG80211_DEFAULT_PS=y +# CONFIG_CFG80211_DEBUGFS is not set +CONFIG_CFG80211_INTERNAL_REGDB=y +# CONFIG_CFG80211_CRDA_SUPPORT is not set +CONFIG_CFG80211_WEXT=y +# CONFIG_LIB80211 is not set +CONFIG_MAC80211=m +CONFIG_MAC80211_HAS_RC=y +CONFIG_MAC80211_RC_MINSTREL=y +CONFIG_MAC80211_RC_MINSTREL_HT=y +CONFIG_MAC80211_RC_MINSTREL_VHT=y +CONFIG_MAC80211_RC_DEFAULT_MINSTREL=y +CONFIG_MAC80211_RC_DEFAULT="minstrel_ht" +# CONFIG_MAC80211_MESH is not set +CONFIG_MAC80211_LEDS=y +# CONFIG_MAC80211_DEBUGFS is not set +# CONFIG_MAC80211_MESSAGE_TRACING is not set +# CONFIG_MAC80211_DEBUG_MENU is not set +CONFIG_MAC80211_STA_HASH_MAX_SIZE=0 +# CONFIG_WIMAX is not set +# CONFIG_RFKILL is not set +# CONFIG_NET_9P is not set +# CONFIG_CAIF is not set +# CONFIG_CEPH_LIB is not set +# CONFIG_NFC is not set +# CONFIG_LWTUNNEL is not set +CONFIG_DST_CACHE=y +# CONFIG_NET_DEVLINK is not set +CONFIG_MAY_USE_DEVLINK=y +CONFIG_HAVE_BPF_JIT=y + +# +# Device Drivers +# +CONFIG_ARM_AMBA=y + +# +# Generic Driver Options +# +# CONFIG_UEVENT_HELPER is not set +CONFIG_DEVTMPFS=y +CONFIG_DEVTMPFS_MOUNT=y +CONFIG_STANDALONE=y +CONFIG_PREVENT_FIRMWARE_BUILD=y +CONFIG_FW_LOADER=y +CONFIG_FIRMWARE_IN_KERNEL=y +CONFIG_EXTRA_FIRMWARE="" +# CONFIG_FW_LOADER_USER_HELPER_FALLBACK is not set +# CONFIG_ALLOW_DEV_COREDUMP is not set +# CONFIG_DEBUG_DRIVER is not set +# CONFIG_DEBUG_DEVRES is not set +# CONFIG_SYS_HYPERVISOR is not set +# CONFIG_GENERIC_CPU_DEVICES is not set +CONFIG_REGMAP=y +CONFIG_REGMAP_I2C=y +CONFIG_REGMAP_SPI=y +CONFIG_REGMAP_MMIO=m +CONFIG_REGMAP_IRQ=y +CONFIG_DMA_SHARED_BUFFER=y +# CONFIG_FENCE_TRACE is not set +CONFIG_DMA_CMA=y + +# +# Default contiguous memory area size: +# +CONFIG_CMA_SIZE_MBYTES=5 +CONFIG_CMA_SIZE_SEL_MBYTES=y +# CONFIG_CMA_SIZE_SEL_PERCENTAGE is not set +# CONFIG_CMA_SIZE_SEL_MIN is not set +# CONFIG_CMA_SIZE_SEL_MAX is not set +CONFIG_CMA_ALIGNMENT=8 + +# +# Bus devices +# +# CONFIG_BRCMSTB_GISB_ARB is not set +# CONFIG_VEXPRESS_CONFIG is not set +# CONFIG_CONNECTOR is not set +# CONFIG_MTD is not set +CONFIG_DTC=y +CONFIG_OF=y +# CONFIG_OF_UNITTEST is not set +CONFIG_OF_FLATTREE=y +CONFIG_OF_EARLY_FLATTREE=y +CONFIG_OF_DYNAMIC=y +CONFIG_OF_ADDRESS=y +CONFIG_OF_IRQ=y +CONFIG_OF_NET=y +CONFIG_OF_MDIO=y +CONFIG_OF_RESERVED_MEM=y +CONFIG_OF_RESOLVE=y +CONFIG_OF_OVERLAY=y +CONFIG_OF_CONFIGFS=y +CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y +# CONFIG_PARPORT is not set +CONFIG_BLK_DEV=y +# CONFIG_BLK_DEV_NULL_BLK is not set +# CONFIG_BLK_DEV_COW_COMMON is not set +CONFIG_BLK_DEV_LOOP=y +CONFIG_BLK_DEV_LOOP_MIN_COUNT=0 +# CONFIG_BLK_DEV_CRYPTOLOOP is not set +# CONFIG_BLK_DEV_DRBD is not set +CONFIG_BLK_DEV_NBD=y +CONFIG_BLK_DEV_RAM=y +CONFIG_BLK_DEV_RAM_COUNT=16 +CONFIG_BLK_DEV_RAM_SIZE=4096 +# CONFIG_CDROM_PKTCDVD is not set +# CONFIG_ATA_OVER_ETH is not set +# CONFIG_MG_DISK is not set +# CONFIG_BLK_DEV_RBD is not set + +# +# Misc devices +# +# CONFIG_SENSORS_LIS3LV02D is not set +CONFIG_BCM2835_SMI=m +# CONFIG_AD525X_DPOT is not set +# CONFIG_DUMMY_IRQ is not set +# CONFIG_ICS932S401 is not set +# CONFIG_ENCLOSURE_SERVICES is not set +# CONFIG_APDS9802ALS is not set +# CONFIG_ISL29003 is not set +# CONFIG_ISL29020 is not set +# CONFIG_SENSORS_TSL2550 is not set +# CONFIG_SENSORS_BH1780 is not set +# CONFIG_SENSORS_BH1770 is not set +# CONFIG_SENSORS_APDS990X is not set +# CONFIG_HMC6352 is not set +# CONFIG_DS1682 is not set +# CONFIG_TI_DAC7512 is not set +# CONFIG_BMP085_I2C is not set +# CONFIG_BMP085_SPI is not set +# CONFIG_USB_SWITCH_FSA9480 is not set +# CONFIG_LATTICE_ECP3_CONFIG is not set +# CONFIG_SRAM is not set +# CONFIG_C2PORT is not set + +# +# EEPROM support +# +# CONFIG_EEPROM_AT24 is not set +# CONFIG_EEPROM_AT25 is not set +# CONFIG_EEPROM_LEGACY is not set +# CONFIG_EEPROM_MAX6875 is not set +CONFIG_EEPROM_93CX6=m +# CONFIG_EEPROM_93XX46 is not set + +# +# Texas Instruments shared transport line discipline +# +# CONFIG_TI_ST is not set +# CONFIG_SENSORS_LIS3_SPI is not set +# CONFIG_SENSORS_LIS3_I2C is not set + +# +# Altera FPGA firmware download module +# +# CONFIG_ALTERA_STAPL is not set +CONFIG_BCM2708_VCHIQ=y + +# +# Intel MIC Bus Driver +# + +# +# SCIF Bus Driver +# + +# +# VOP Bus Driver +# + +# +# Intel MIC Host Driver +# + +# +# Intel MIC Card Driver +# + +# +# SCIF Driver +# + +# +# Intel MIC Coprocessor State Management (COSM) Drivers +# + +# +# VOP Driver +# +# CONFIG_ECHO is not set +# CONFIG_CXL_BASE is not set +# CONFIG_CXL_KERNEL_API is not set +# CONFIG_CXL_EEH is not set + +# +# SCSI device support +# +CONFIG_SCSI_MOD=y +# CONFIG_RAID_ATTRS is not set +CONFIG_SCSI=y +CONFIG_SCSI_DMA=y +# CONFIG_SCSI_NETLINK is not set +# CONFIG_SCSI_MQ_DEFAULT is not set +# CONFIG_SCSI_PROC_FS is not set + +# +# SCSI support type (disk, tape, CD-ROM) +# +CONFIG_BLK_DEV_SD=y +# CONFIG_CHR_DEV_ST is not set +# CONFIG_CHR_DEV_OSST is not set +CONFIG_BLK_DEV_SR=y +# CONFIG_BLK_DEV_SR_VENDOR is not set +# CONFIG_CHR_DEV_SG is not set +# CONFIG_CHR_DEV_SCH is not set +# CONFIG_SCSI_CONSTANTS is not set +# CONFIG_SCSI_LOGGING is not set +# CONFIG_SCSI_SCAN_ASYNC is not set + +# +# SCSI Transports +# +# CONFIG_SCSI_SPI_ATTRS is not set +# CONFIG_SCSI_FC_ATTRS is not set +CONFIG_SCSI_ISCSI_ATTRS=y +# CONFIG_SCSI_SAS_ATTRS is not set +# CONFIG_SCSI_SAS_LIBSAS is not set +# CONFIG_SCSI_SRP_ATTRS is not set +CONFIG_SCSI_LOWLEVEL=y +CONFIG_ISCSI_TCP=y +CONFIG_ISCSI_BOOT_SYSFS=y +# CONFIG_SCSI_UFSHCD is not set +# CONFIG_SCSI_DEBUG is not set +# CONFIG_SCSI_DH is not set +# CONFIG_SCSI_OSD_INITIATOR is not set +# CONFIG_ATA is not set +# CONFIG_MD is not set +# CONFIG_TARGET_CORE is not set +CONFIG_NETDEVICES=y +CONFIG_MII=y +CONFIG_NET_CORE=y +# CONFIG_BONDING is not set +# CONFIG_DUMMY is not set +# CONFIG_EQUALIZER is not set +# CONFIG_NET_TEAM is not set +CONFIG_MACVLAN=m +# CONFIG_MACVTAP is not set +# CONFIG_IPVLAN is not set +# CONFIG_VXLAN is not set +# CONFIG_MACSEC is not set +CONFIG_NETCONSOLE=y +# CONFIG_NETCONSOLE_DYNAMIC is not set +CONFIG_NETPOLL=y +CONFIG_NET_POLL_CONTROLLER=y +CONFIG_TUN=y +# CONFIG_TUN_VNET_CROSS_LE is not set +CONFIG_VETH=m +# CONFIG_NLMON is not set + +# +# CAIF transport drivers +# + +# +# Distributed Switch Architecture drivers +# +# CONFIG_NET_DSA_MV88E6XXX is not set +# CONFIG_NET_DSA_MV88E6XXX_NEED_PPU is not set +# CONFIG_ETHERNET is not set +CONFIG_PHYLIB=y + +# +# MII PHY device drivers +# +# CONFIG_AQUANTIA_PHY is not set +# CONFIG_AT803X_PHY is not set +# CONFIG_AMD_PHY is not set +# CONFIG_MARVELL_PHY is not set +# CONFIG_DAVICOM_PHY is not set +# CONFIG_QSEMI_PHY is not set +# CONFIG_LXT_PHY is not set +# CONFIG_CICADA_PHY is not set +# CONFIG_VITESSE_PHY is not set +# CONFIG_TERANETICS_PHY is not set +# CONFIG_SMSC_PHY is not set +# CONFIG_BROADCOM_PHY is not set +# CONFIG_BCM7XXX_PHY is not set +# CONFIG_BCM87XX_PHY is not set +# CONFIG_ICPLUS_PHY is not set +# CONFIG_REALTEK_PHY is not set +# CONFIG_NATIONAL_PHY is not set +# CONFIG_STE10XP is not set +# CONFIG_LSI_ET1011C_PHY is not set +# CONFIG_MICREL_PHY is not set +# CONFIG_DP83848_PHY is not set +# CONFIG_DP83867_PHY is not set +# CONFIG_MICROCHIP_PHY is not set +# CONFIG_FIXED_PHY is not set +# CONFIG_MDIO_BITBANG is not set +# CONFIG_MDIO_BUS_MUX_GPIO is not set +# CONFIG_MDIO_BUS_MUX_MMIOREG is not set +# CONFIG_MDIO_BCM_UNIMAC is not set +# CONFIG_MICREL_KS8995MA is not set +CONFIG_PPP=m +CONFIG_PPP_BSDCOMP=m +CONFIG_PPP_DEFLATE=m +# CONFIG_PPP_FILTER is not set +CONFIG_PPP_MPPE=m +# CONFIG_PPP_MULTILINK is not set +CONFIG_PPPOE=m +CONFIG_PPP_ASYNC=m +# CONFIG_PPP_SYNC_TTY is not set +# CONFIG_SLIP is not set +CONFIG_SLHC=m +CONFIG_USB_NET_DRIVERS=y +# CONFIG_USB_CATC is not set +# CONFIG_USB_KAWETH is not set +# CONFIG_USB_PEGASUS is not set +# CONFIG_USB_RTL8150 is not set +CONFIG_USB_RTL8152=m +# CONFIG_USB_LAN78XX is not set +CONFIG_USB_USBNET=y +CONFIG_USB_NET_AX8817X=m +CONFIG_USB_NET_AX88179_178A=m +CONFIG_USB_NET_CDCETHER=m +# CONFIG_USB_NET_CDC_EEM is not set +# CONFIG_USB_NET_CDC_NCM is not set +# CONFIG_USB_NET_HUAWEI_CDC_NCM is not set +# CONFIG_USB_NET_CDC_MBIM is not set +CONFIG_USB_NET_DM9601=m +# CONFIG_USB_NET_SR9700 is not set +# CONFIG_USB_NET_SR9800 is not set +CONFIG_USB_NET_SMSC75XX=m +CONFIG_USB_NET_SMSC95XX=y +# CONFIG_USB_NET_GL620A is not set +# CONFIG_USB_NET_NET1080 is not set +# CONFIG_USB_NET_PLUSB is not set +CONFIG_USB_NET_MCS7830=m +CONFIG_USB_NET_RNDIS_HOST=m +# CONFIG_USB_NET_CDC_SUBSET is not set +# CONFIG_USB_NET_ZAURUS is not set +# CONFIG_USB_NET_CX82310_ETH is not set +# CONFIG_USB_NET_KALMIA is not set +# CONFIG_USB_NET_QMI_WWAN is not set +# CONFIG_USB_NET_INT51X1 is not set +CONFIG_USB_IPHETH=m +# CONFIG_USB_SIERRA_NET is not set +# CONFIG_USB_VL600 is not set +# CONFIG_USB_NET_CH9200 is not set +CONFIG_WLAN=y +CONFIG_WLAN_VENDOR_ADMTEK=y +CONFIG_ATH_COMMON=m +CONFIG_WLAN_VENDOR_ATH=y +# CONFIG_ATH_DEBUG is not set +CONFIG_ATH9K_HW=m +CONFIG_ATH9K_COMMON=m +CONFIG_ATH9K_BTCOEX_SUPPORT=y +CONFIG_ATH9K=m +CONFIG_ATH9K_AHB=y +# CONFIG_ATH9K_DEBUGFS is not set +# CONFIG_ATH9K_DYNACK is not set +# CONFIG_ATH9K_CHANNEL_CONTEXT is not set +CONFIG_ATH9K_PCOEM=y +CONFIG_ATH9K_HTC=m +# CONFIG_ATH9K_HTC_DEBUGFS is not set +CONFIG_ATH9K_HWRNG=y +CONFIG_CARL9170=m +CONFIG_CARL9170_LEDS=y +CONFIG_CARL9170_WPC=y +CONFIG_CARL9170_HWRNG=y +CONFIG_ATH6KL=m +# CONFIG_ATH6KL_SDIO is not set +CONFIG_ATH6KL_USB=m +# CONFIG_ATH6KL_DEBUG is not set +CONFIG_AR5523=m +# CONFIG_ATH10K is not set +CONFIG_WCN36XX=m +# CONFIG_WCN36XX_DEBUGFS is not set +CONFIG_WLAN_VENDOR_ATMEL=y +# CONFIG_AT76C50X_USB is not set +CONFIG_WLAN_VENDOR_BROADCOM=y +CONFIG_B43=m +CONFIG_B43_BCMA=y +CONFIG_B43_SSB=y +CONFIG_B43_BUSES_BCMA_AND_SSB=y +# CONFIG_B43_BUSES_BCMA is not set +# CONFIG_B43_BUSES_SSB is not set +# CONFIG_B43_SDIO is not set +CONFIG_B43_BCMA_PIO=y +CONFIG_B43_PIO=y +CONFIG_B43_PHY_G=y +CONFIG_B43_PHY_N=y +CONFIG_B43_PHY_LP=y +CONFIG_B43_PHY_HT=y +CONFIG_B43_LEDS=y +CONFIG_B43_HWRNG=y +# CONFIG_B43_DEBUG is not set +# CONFIG_B43LEGACY is not set +CONFIG_BRCMUTIL=m +# CONFIG_BRCMSMAC is not set +CONFIG_BRCMFMAC=m +CONFIG_BRCMFMAC_PROTO_BCDC=y +CONFIG_BRCMFMAC_SDIO=y +CONFIG_BRCMFMAC_USB=y +# CONFIG_BRCM_TRACING is not set +# CONFIG_BRCMDBG is not set +CONFIG_WLAN_VENDOR_CISCO=y +CONFIG_WLAN_VENDOR_INTEL=y +CONFIG_WLAN_VENDOR_INTERSIL=y +# CONFIG_HOSTAP is not set +CONFIG_P54_COMMON=m +CONFIG_P54_USB=m +# CONFIG_P54_SPI is not set +CONFIG_P54_LEDS=y +CONFIG_WLAN_VENDOR_MARVELL=y +# CONFIG_LIBERTAS is not set +# CONFIG_LIBERTAS_THINFIRM is not set +# CONFIG_MWIFIEX is not set +CONFIG_WLAN_VENDOR_MEDIATEK=y +CONFIG_MT7601U=m +CONFIG_WLAN_VENDOR_RALINK=y +CONFIG_RT2X00=m +CONFIG_RT2500USB=m +CONFIG_RT73USB=m +CONFIG_RT2800USB=m +CONFIG_RT2800USB_RT33XX=y +CONFIG_RT2800USB_RT35XX=y +CONFIG_RT2800USB_RT3573=y +CONFIG_RT2800USB_RT53XX=y +CONFIG_RT2800USB_RT55XX=y +CONFIG_RT2800USB_UNKNOWN=y +CONFIG_RT2800_LIB=m +CONFIG_RT2X00_LIB_USB=m +CONFIG_RT2X00_LIB=m +CONFIG_RT2X00_LIB_FIRMWARE=y +CONFIG_RT2X00_LIB_CRYPTO=y +CONFIG_RT2X00_LIB_LEDS=y +# CONFIG_RT2X00_DEBUG is not set +CONFIG_WLAN_VENDOR_REALTEK=y +CONFIG_RTL8187=m +CONFIG_RTL8187_LEDS=y +CONFIG_RTL_CARDS=m +# CONFIG_RTL8192CU is not set +CONFIG_RTL8XXXU=m +CONFIG_RTL8XXXU_UNTESTED=y +CONFIG_WLAN_VENDOR_RSI=y +# CONFIG_RSI_91X is not set +CONFIG_WLAN_VENDOR_ST=y +# CONFIG_CW1200 is not set +CONFIG_WLAN_VENDOR_TI=y +# CONFIG_WL1251 is not set +# CONFIG_WL12XX is not set +# CONFIG_WL18XX is not set +# CONFIG_WLCORE is not set +CONFIG_WLAN_VENDOR_ZYDAS=y +CONFIG_USB_ZD1201=m +CONFIG_ZD1211RW=m +# CONFIG_ZD1211RW_DEBUG is not set +# CONFIG_MAC80211_HWSIM is not set +CONFIG_USB_NET_RNDIS_WLAN=m + +# +# Enable WiMAX (Networking options) to see the WiMAX drivers +# +# CONFIG_WAN is not set +# CONFIG_ISDN is not set +# CONFIG_NVM is not set + +# +# Input device support +# +CONFIG_INPUT=y +CONFIG_INPUT_LEDS=y +CONFIG_INPUT_FF_MEMLESS=y +# CONFIG_INPUT_POLLDEV is not set +# CONFIG_INPUT_SPARSEKMAP is not set +# CONFIG_INPUT_MATRIXKMAP is not set + +# +# Userland interfaces +# +CONFIG_INPUT_MOUSEDEV=y +# CONFIG_INPUT_MOUSEDEV_PSAUX is not set +CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 +CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 +CONFIG_INPUT_JOYDEV=y +CONFIG_INPUT_EVDEV=y +# CONFIG_INPUT_EVBUG is not set + +# +# Input Device Drivers +# +# CONFIG_INPUT_KEYBOARD is not set +# CONFIG_INPUT_MOUSE is not set +CONFIG_INPUT_JOYSTICK=y +# CONFIG_JOYSTICK_ANALOG is not set +# CONFIG_JOYSTICK_A3D is not set +# CONFIG_JOYSTICK_ADI is not set +# CONFIG_JOYSTICK_COBRA is not set +# CONFIG_JOYSTICK_GF2K is not set +# CONFIG_JOYSTICK_GRIP is not set +# CONFIG_JOYSTICK_GRIP_MP is not set +# CONFIG_JOYSTICK_GUILLEMOT is not set +# CONFIG_JOYSTICK_INTERACT is not set +# CONFIG_JOYSTICK_SIDEWINDER is not set +# CONFIG_JOYSTICK_TMDC is not set +# CONFIG_JOYSTICK_IFORCE is not set +# CONFIG_JOYSTICK_WARRIOR is not set +# CONFIG_JOYSTICK_MAGELLAN is not set +# CONFIG_JOYSTICK_SPACEORB is not set +# CONFIG_JOYSTICK_SPACEBALL is not set +# CONFIG_JOYSTICK_STINGER is not set +# CONFIG_JOYSTICK_TWIDJOY is not set +# CONFIG_JOYSTICK_ZHENHUA is not set +# CONFIG_JOYSTICK_AS5011 is not set +# CONFIG_JOYSTICK_JOYDUMP is not set +CONFIG_JOYSTICK_XPAD=m +CONFIG_JOYSTICK_XPAD_FF=y +CONFIG_JOYSTICK_XPAD_LEDS=y +# CONFIG_JOYSTICK_RPISENSE is not set +# CONFIG_INPUT_TABLET is not set +CONFIG_INPUT_TOUCHSCREEN=y +CONFIG_TOUCHSCREEN_PROPERTIES=y +CONFIG_TOUCHSCREEN_ADS7846=m +# CONFIG_TOUCHSCREEN_AD7877 is not set +# CONFIG_TOUCHSCREEN_AD7879 is not set +# CONFIG_TOUCHSCREEN_AR1021_I2C is not set +# CONFIG_TOUCHSCREEN_ATMEL_MXT is not set +# CONFIG_TOUCHSCREEN_AUO_PIXCIR is not set +# CONFIG_TOUCHSCREEN_BU21013 is not set +# CONFIG_TOUCHSCREEN_CHIPONE_ICN8318 is not set +# CONFIG_TOUCHSCREEN_CY8CTMG110 is not set +# CONFIG_TOUCHSCREEN_CYTTSP_CORE is not set +# CONFIG_TOUCHSCREEN_CYTTSP4_CORE is not set +# CONFIG_TOUCHSCREEN_DYNAPRO is not set +# CONFIG_TOUCHSCREEN_HAMPSHIRE is not set +# CONFIG_TOUCHSCREEN_EETI is not set +CONFIG_TOUCHSCREEN_EGALAX=m +# CONFIG_TOUCHSCREEN_EGALAX_SERIAL is not set +# CONFIG_TOUCHSCREEN_FT6236 is not set +# CONFIG_TOUCHSCREEN_FUJITSU is not set +# CONFIG_TOUCHSCREEN_GOODIX is not set +# CONFIG_TOUCHSCREEN_ILI210X is not set +# CONFIG_TOUCHSCREEN_GUNZE is not set +# CONFIG_TOUCHSCREEN_ELAN is not set +# CONFIG_TOUCHSCREEN_ELO is not set +# CONFIG_TOUCHSCREEN_WACOM_W8001 is not set +# CONFIG_TOUCHSCREEN_WACOM_I2C is not set +# CONFIG_TOUCHSCREEN_MAX11801 is not set +# CONFIG_TOUCHSCREEN_MCS5000 is not set +# CONFIG_TOUCHSCREEN_MMS114 is not set +# CONFIG_TOUCHSCREEN_MELFAS_MIP4 is not set +# CONFIG_TOUCHSCREEN_MTOUCH is not set +# CONFIG_TOUCHSCREEN_IMX6UL_TSC is not set +# CONFIG_TOUCHSCREEN_INEXIO is not set +# CONFIG_TOUCHSCREEN_MK712 is not set +# CONFIG_TOUCHSCREEN_PENMOUNT is not set +# CONFIG_TOUCHSCREEN_EDT_FT5X06 is not set +CONFIG_TOUCHSCREEN_RPI_FT5406=m +# CONFIG_TOUCHSCREEN_TOUCHRIGHT is not set +# CONFIG_TOUCHSCREEN_TOUCHWIN is not set +# CONFIG_TOUCHSCREEN_PIXCIR is not set +# CONFIG_TOUCHSCREEN_WDT87XX_I2C is not set +# CONFIG_TOUCHSCREEN_WM97XX is not set +CONFIG_TOUCHSCREEN_USB_COMPOSITE=m +CONFIG_TOUCHSCREEN_USB_EGALAX=y +# CONFIG_TOUCHSCREEN_USB_PANJIT is not set +CONFIG_TOUCHSCREEN_USB_3M=y +# CONFIG_TOUCHSCREEN_USB_ITM is not set +# CONFIG_TOUCHSCREEN_USB_ETURBO is not set +# CONFIG_TOUCHSCREEN_USB_GUNZE is not set +# CONFIG_TOUCHSCREEN_USB_DMC_TSC10 is not set +# CONFIG_TOUCHSCREEN_USB_IRTOUCH is not set +# CONFIG_TOUCHSCREEN_USB_IDEALTEK is not set +# CONFIG_TOUCHSCREEN_USB_GENERAL_TOUCH is not set +# CONFIG_TOUCHSCREEN_USB_GOTOP is not set +# CONFIG_TOUCHSCREEN_USB_JASTEC is not set +# CONFIG_TOUCHSCREEN_USB_ELO is not set +# CONFIG_TOUCHSCREEN_USB_E2I is not set +# CONFIG_TOUCHSCREEN_USB_ZYTRONIC is not set +# CONFIG_TOUCHSCREEN_USB_ETT_TC45USB is not set +# CONFIG_TOUCHSCREEN_USB_NEXIO is not set +# CONFIG_TOUCHSCREEN_USB_EASYTOUCH is not set +# CONFIG_TOUCHSCREEN_TOUCHIT213 is not set +# CONFIG_TOUCHSCREEN_TSC_SERIO is not set +# CONFIG_TOUCHSCREEN_TSC2004 is not set +# CONFIG_TOUCHSCREEN_TSC2005 is not set +# CONFIG_TOUCHSCREEN_TSC2007 is not set +CONFIG_TOUCHSCREEN_ST1232=m +# CONFIG_TOUCHSCREEN_SUR40 is not set +# CONFIG_TOUCHSCREEN_SX8654 is not set +# CONFIG_TOUCHSCREEN_TPS6507X is not set +# CONFIG_TOUCHSCREEN_ZFORCE is not set +# CONFIG_TOUCHSCREEN_ROHM_BU21023 is not set +CONFIG_INPUT_MISC=y +# CONFIG_INPUT_AD714X is not set +# CONFIG_INPUT_ARIZONA_HAPTICS is not set +# CONFIG_INPUT_BMA150 is not set +# CONFIG_INPUT_E3X0_BUTTON is not set +# CONFIG_INPUT_MMA8450 is not set +# CONFIG_INPUT_MPU3050 is not set +# CONFIG_INPUT_GP2A is not set +# CONFIG_INPUT_GPIO_BEEPER is not set +# CONFIG_INPUT_GPIO_TILT_POLLED is not set +# CONFIG_INPUT_ATI_REMOTE2 is not set +# CONFIG_INPUT_KEYSPAN_REMOTE is not set +# CONFIG_INPUT_KXTJ9 is not set +# CONFIG_INPUT_POWERMATE is not set +# CONFIG_INPUT_YEALINK is not set +# CONFIG_INPUT_CM109 is not set +CONFIG_INPUT_UINPUT=y +# CONFIG_INPUT_PCF8574 is not set +# CONFIG_INPUT_GPIO_ROTARY_ENCODER is not set +# CONFIG_INPUT_ADXL34X is not set +# CONFIG_INPUT_IMS_PCU is not set +# CONFIG_INPUT_CMA3000 is not set +# CONFIG_INPUT_DRV260X_HAPTICS is not set +# CONFIG_INPUT_DRV2665_HAPTICS is not set +# CONFIG_INPUT_DRV2667_HAPTICS is not set +# CONFIG_RMI4_CORE is not set + +# +# Hardware I/O ports +# +# CONFIG_SERIO is not set +# CONFIG_GAMEPORT is not set + +# +# Character devices +# +CONFIG_BRCM_CHAR_DRIVERS=y +CONFIG_BCM_VC_CMA=y +CONFIG_BCM2708_VCMEM=y +CONFIG_BCM_VCIO=y +CONFIG_BCM_VC_SM=y +CONFIG_BCM2835_DEVGPIOMEM=m +CONFIG_BCM2835_SMI_DEV=m +CONFIG_TTY=y +CONFIG_VT=y +CONFIG_CONSOLE_TRANSLATIONS=y +CONFIG_VT_CONSOLE=y +CONFIG_HW_CONSOLE=y +CONFIG_VT_HW_CONSOLE_BINDING=y +CONFIG_UNIX98_PTYS=y +CONFIG_DEVPTS_MULTIPLE_INSTANCES=y +# CONFIG_LEGACY_PTYS is not set +# CONFIG_SERIAL_NONSTANDARD is not set +# CONFIG_N_GSM is not set +# CONFIG_TRACE_SINK is not set +CONFIG_DEVMEM=y +# CONFIG_DEVKMEM is not set + +# +# Serial drivers +# +CONFIG_SERIAL_EARLYCON=y +CONFIG_SERIAL_8250=y +# CONFIG_SERIAL_8250_DEPRECATED_OPTIONS is not set +CONFIG_SERIAL_8250_CONSOLE=y +# CONFIG_SERIAL_8250_DMA is not set +CONFIG_SERIAL_8250_NR_UARTS=1 +CONFIG_SERIAL_8250_RUNTIME_UARTS=0 +# CONFIG_SERIAL_8250_EXTENDED is not set +CONFIG_SERIAL_8250_FSL=y +# CONFIG_SERIAL_8250_DW is not set +# CONFIG_SERIAL_8250_EM is not set +# CONFIG_SERIAL_8250_RT288X is not set +CONFIG_SERIAL_OF_PLATFORM=y + +# +# Non-8250 serial port support +# +# CONFIG_SERIAL_AMBA_PL010 is not set +CONFIG_SERIAL_AMBA_PL011=y +CONFIG_SERIAL_AMBA_PL011_CONSOLE=y +# CONFIG_SERIAL_EARLYCON_ARM_SEMIHOST is not set +# CONFIG_SERIAL_MAX3100 is not set +# CONFIG_SERIAL_MAX310X is not set +# CONFIG_SERIAL_UARTLITE is not set +CONFIG_SERIAL_CORE=y +CONFIG_SERIAL_CORE_CONSOLE=y +# CONFIG_SERIAL_SCCNXP is not set +# CONFIG_SERIAL_SC16IS7XX is not set +# CONFIG_SERIAL_BCM63XX is not set +# CONFIG_SERIAL_ALTERA_JTAGUART is not set +# CONFIG_SERIAL_ALTERA_UART is not set +# CONFIG_SERIAL_IFX6X60 is not set +# CONFIG_SERIAL_XILINX_PS_UART is not set +# CONFIG_SERIAL_ARC is not set +# CONFIG_SERIAL_FSL_LPUART is not set +# CONFIG_SERIAL_CONEXANT_DIGICOLOR is not set +# CONFIG_SERIAL_ST_ASC is not set +# CONFIG_SERIAL_STM32 is not set +# CONFIG_SERIAL_MVEBU_UART is not set +# CONFIG_TTY_PRINTK is not set +# CONFIG_HVC_DCC is not set +# CONFIG_IPMI_HANDLER is not set +CONFIG_HW_RANDOM=y +# CONFIG_HW_RANDOM_TIMERIOMEM is not set +CONFIG_HW_RANDOM_BCM2835=y +# CONFIG_R3964 is not set +# CONFIG_RAW_DRIVER is not set +# CONFIG_TCG_TPM is not set +# CONFIG_XILLYBUS is not set + +# +# I2C support +# +CONFIG_I2C=y +CONFIG_I2C_BOARDINFO=y +# CONFIG_I2C_COMPAT is not set +CONFIG_I2C_CHARDEV=y +CONFIG_I2C_MUX=m + +# +# Multiplexer I2C Chip support +# +# CONFIG_I2C_ARB_GPIO_CHALLENGE is not set +# CONFIG_I2C_MUX_GPIO is not set +# CONFIG_I2C_MUX_PCA9541 is not set +# CONFIG_I2C_MUX_PCA954x is not set +# CONFIG_I2C_MUX_PINCTRL is not set +# CONFIG_I2C_MUX_REG is not set +# CONFIG_I2C_DEMUX_PINCTRL is not set +CONFIG_I2C_HELPER_AUTO=y +CONFIG_I2C_ALGOBIT=y + +# +# I2C Hardware Bus support +# +CONFIG_I2C_BCM2708=y +CONFIG_I2C_BCM2708_BAUDRATE=100000 + +# +# I2C system bus drivers (mostly embedded / system-on-chip) +# +# CONFIG_I2C_BCM2835 is not set +# CONFIG_I2C_CBUS_GPIO is not set +# CONFIG_I2C_DESIGNWARE_PLATFORM is not set +# CONFIG_I2C_EMEV2 is not set +CONFIG_I2C_GPIO=y +# CONFIG_I2C_NOMADIK is not set +# CONFIG_I2C_OCORES is not set +# CONFIG_I2C_PCA_PLATFORM is not set +# CONFIG_I2C_PXA_PCI is not set +# CONFIG_I2C_RK3X is not set +# CONFIG_I2C_SIMTEC is not set +# CONFIG_I2C_XILINX is not set + +# +# External I2C/SMBus adapter drivers +# +# CONFIG_I2C_DIOLAN_U2C is not set +# CONFIG_I2C_PARPORT_LIGHT is not set +# CONFIG_I2C_ROBOTFUZZ_OSIF is not set +# CONFIG_I2C_TAOS_EVM is not set +# CONFIG_I2C_TINY_USB is not set + +# +# Other I2C/SMBus bus drivers +# +# CONFIG_I2C_STUB is not set +# CONFIG_I2C_SLAVE is not set +# CONFIG_I2C_DEBUG_CORE is not set +# CONFIG_I2C_DEBUG_ALGO is not set +# CONFIG_I2C_DEBUG_BUS is not set +CONFIG_SPI=y +# CONFIG_SPI_DEBUG is not set +CONFIG_SPI_MASTER=y + +# +# SPI Master Controller Drivers +# +# CONFIG_SPI_ALTERA is not set +# CONFIG_SPI_AXI_SPI_ENGINE is not set +CONFIG_SPI_BCM2835=m +CONFIG_SPI_BCM2835AUX=m +# CONFIG_SPI_BITBANG is not set +# CONFIG_SPI_CADENCE is not set +# CONFIG_SPI_DESIGNWARE is not set +# CONFIG_SPI_GPIO is not set +# CONFIG_SPI_FSL_SPI is not set +# CONFIG_SPI_OC_TINY is not set +# CONFIG_SPI_PL022 is not set +# CONFIG_SPI_PXA2XX_PCI is not set +# CONFIG_SPI_ROCKCHIP is not set +# CONFIG_SPI_SC18IS602 is not set +# CONFIG_SPI_XCOMM is not set +# CONFIG_SPI_XILINX is not set +# CONFIG_SPI_ZYNQMP_GQSPI is not set + +# +# SPI Protocol Masters +# +CONFIG_SPI_SPIDEV=y +# CONFIG_SPI_LOOPBACK_TEST is not set +# CONFIG_SPI_TLE62X0 is not set +# CONFIG_SPMI is not set +# CONFIG_HSI is not set + +# +# PPS support +# +# CONFIG_PPS is not set + +# +# PPS generators support +# + +# +# PTP clock support +# +# CONFIG_PTP_1588_CLOCK is not set + +# +# Enable PHYLIB and NETWORK_PHY_TIMESTAMPING to see the additional clocks. +# +CONFIG_PINCTRL=y + +# +# Pin controllers +# +CONFIG_PINMUX=y +CONFIG_PINCONF=y +# CONFIG_DEBUG_PINCTRL is not set +# CONFIG_PINCTRL_AMD is not set +# CONFIG_PINCTRL_SINGLE is not set +CONFIG_PINCTRL_BCM2835=y +CONFIG_ARCH_HAVE_CUSTOM_GPIO_H=y +CONFIG_ARCH_REQUIRE_GPIOLIB=y +CONFIG_GPIOLIB=y +CONFIG_GPIO_DEVRES=y +CONFIG_OF_GPIO=y +# CONFIG_DEBUG_GPIO is not set +CONFIG_GPIO_SYSFS=y + +# +# Memory mapped GPIO drivers +# +# CONFIG_GPIO_74XX_MMIO is not set +# CONFIG_GPIO_ALTERA is not set +CONFIG_GPIO_BCM_VIRT=y +# CONFIG_GPIO_DWAPB is not set +# CONFIG_GPIO_EM is not set +# CONFIG_GPIO_GENERIC_PLATFORM is not set +# CONFIG_GPIO_GRGPIO is not set +# CONFIG_GPIO_MPC8XXX is not set +# CONFIG_GPIO_PL061 is not set +# CONFIG_GPIO_XILINX is not set +# CONFIG_GPIO_ZEVIO is not set +# CONFIG_GPIO_ZX is not set + +# +# I2C GPIO expanders +# +# CONFIG_GPIO_ADP5588 is not set +# CONFIG_GPIO_ADNP is not set +# CONFIG_GPIO_MAX7300 is not set +# CONFIG_GPIO_MAX732X is not set +# CONFIG_GPIO_PCA953X is not set +# CONFIG_GPIO_PCF857X is not set +# CONFIG_GPIO_SX150X is not set +# CONFIG_GPIO_TPIC2810 is not set + +# +# MFD GPIO expanders +# +CONFIG_GPIO_ARIZONA=m + +# +# SPI GPIO expanders +# +# CONFIG_GPIO_74X164 is not set +# CONFIG_GPIO_MAX7301 is not set +# CONFIG_GPIO_MC33880 is not set +# CONFIG_GPIO_PISOSR is not set + +# +# SPI or I2C GPIO expanders +# +# CONFIG_GPIO_MCP23S08 is not set + +# +# USB GPIO expanders +# +CONFIG_W1=m + +# +# 1-wire Bus Masters +# +# CONFIG_W1_MASTER_DS2490 is not set +# CONFIG_W1_MASTER_DS2482 is not set +# CONFIG_W1_MASTER_DS1WM is not set +CONFIG_W1_MASTER_GPIO=m + +# +# 1-wire Slaves +# +CONFIG_W1_SLAVE_THERM=m +# CONFIG_W1_SLAVE_SMEM is not set +# CONFIG_W1_SLAVE_DS2408 is not set +# CONFIG_W1_SLAVE_DS2413 is not set +# CONFIG_W1_SLAVE_DS2406 is not set +# CONFIG_W1_SLAVE_DS2423 is not set +# CONFIG_W1_SLAVE_DS2431 is not set +# CONFIG_W1_SLAVE_DS2433 is not set +# CONFIG_W1_SLAVE_DS2760 is not set +# CONFIG_W1_SLAVE_DS2780 is not set +# CONFIG_W1_SLAVE_DS2781 is not set +# CONFIG_W1_SLAVE_DS28E04 is not set +# CONFIG_W1_SLAVE_BQ27000 is not set +CONFIG_POWER_SUPPLY=y +# CONFIG_POWER_SUPPLY_DEBUG is not set +# CONFIG_PDA_POWER is not set +# CONFIG_TEST_POWER is not set +# CONFIG_BATTERY_DS2780 is not set +# CONFIG_BATTERY_DS2781 is not set +# CONFIG_BATTERY_DS2782 is not set +# CONFIG_BATTERY_SBS is not set +# CONFIG_BATTERY_BQ27XXX is not set +# CONFIG_BATTERY_MAX17040 is not set +# CONFIG_BATTERY_MAX17042 is not set +# CONFIG_CHARGER_MAX8903 is not set +# CONFIG_CHARGER_LP8727 is not set +# CONFIG_CHARGER_GPIO is not set +# CONFIG_CHARGER_BQ2415X is not set +# CONFIG_CHARGER_BQ24190 is not set +# CONFIG_CHARGER_BQ24257 is not set +# CONFIG_CHARGER_BQ24735 is not set +# CONFIG_CHARGER_BQ25890 is not set +# CONFIG_CHARGER_SMB347 is not set +# CONFIG_BATTERY_GAUGE_LTC2941 is not set +# CONFIG_CHARGER_RT9455 is not set +CONFIG_POWER_RESET=y +CONFIG_POWER_RESET_GPIO=y +CONFIG_POWER_RESET_GPIO_RESTART=y +# CONFIG_POWER_RESET_LTC2952 is not set +CONFIG_POWER_RESET_RESTART=y +# CONFIG_POWER_RESET_SYSCON is not set +# CONFIG_POWER_RESET_SYSCON_POWEROFF is not set +# CONFIG_POWER_AVS is not set +CONFIG_HWMON=y +# CONFIG_HWMON_VID is not set +# CONFIG_HWMON_DEBUG_CHIP is not set + +# +# Native drivers +# +# CONFIG_SENSORS_AD7314 is not set +# CONFIG_SENSORS_AD7414 is not set +# CONFIG_SENSORS_AD7418 is not set +# CONFIG_SENSORS_ADM1021 is not set +# CONFIG_SENSORS_ADM1025 is not set +# CONFIG_SENSORS_ADM1026 is not set +# CONFIG_SENSORS_ADM1029 is not set +# CONFIG_SENSORS_ADM1031 is not set +# CONFIG_SENSORS_ADM9240 is not set +# CONFIG_SENSORS_ADT7310 is not set +# CONFIG_SENSORS_ADT7410 is not set +# CONFIG_SENSORS_ADT7411 is not set +# CONFIG_SENSORS_ADT7462 is not set +# CONFIG_SENSORS_ADT7470 is not set +# CONFIG_SENSORS_ADT7475 is not set +# CONFIG_SENSORS_ASC7621 is not set +# CONFIG_SENSORS_ATXP1 is not set +# CONFIG_SENSORS_DS620 is not set +# CONFIG_SENSORS_DS1621 is not set +# CONFIG_SENSORS_F71805F is not set +# CONFIG_SENSORS_F71882FG is not set +# CONFIG_SENSORS_F75375S is not set +# CONFIG_SENSORS_GL518SM is not set +# CONFIG_SENSORS_GL520SM is not set +# CONFIG_SENSORS_G760A is not set +# CONFIG_SENSORS_G762 is not set +# CONFIG_SENSORS_GPIO_FAN is not set +# CONFIG_SENSORS_HIH6130 is not set +# CONFIG_SENSORS_IT87 is not set +# CONFIG_SENSORS_JC42 is not set +# CONFIG_SENSORS_POWR1220 is not set +# CONFIG_SENSORS_LINEAGE is not set +# CONFIG_SENSORS_LTC2945 is not set +# CONFIG_SENSORS_LTC2990 is not set +# CONFIG_SENSORS_LTC4151 is not set +# CONFIG_SENSORS_LTC4215 is not set +# CONFIG_SENSORS_LTC4222 is not set +# CONFIG_SENSORS_LTC4245 is not set +# CONFIG_SENSORS_LTC4260 is not set +# CONFIG_SENSORS_LTC4261 is not set +# CONFIG_SENSORS_MAX1111 is not set +# CONFIG_SENSORS_MAX16065 is not set +# CONFIG_SENSORS_MAX1619 is not set +# CONFIG_SENSORS_MAX1668 is not set +# CONFIG_SENSORS_MAX197 is not set +# CONFIG_SENSORS_MAX6639 is not set +# CONFIG_SENSORS_MAX6642 is not set +# CONFIG_SENSORS_MAX6650 is not set +# CONFIG_SENSORS_MAX6697 is not set +# CONFIG_SENSORS_MAX31790 is not set +# CONFIG_SENSORS_MCP3021 is not set +# CONFIG_SENSORS_ADCXX is not set +# CONFIG_SENSORS_LM63 is not set +# CONFIG_SENSORS_LM70 is not set +# CONFIG_SENSORS_LM73 is not set +# CONFIG_SENSORS_LM75 is not set +# CONFIG_SENSORS_LM77 is not set +# CONFIG_SENSORS_LM78 is not set +# CONFIG_SENSORS_LM80 is not set +# CONFIG_SENSORS_LM83 is not set +# CONFIG_SENSORS_LM85 is not set +# CONFIG_SENSORS_LM87 is not set +# CONFIG_SENSORS_LM90 is not set +# CONFIG_SENSORS_LM92 is not set +# CONFIG_SENSORS_LM93 is not set +# CONFIG_SENSORS_LM95234 is not set +# CONFIG_SENSORS_LM95241 is not set +# CONFIG_SENSORS_LM95245 is not set +# CONFIG_SENSORS_PC87360 is not set +# CONFIG_SENSORS_PC87427 is not set +# CONFIG_SENSORS_NTC_THERMISTOR is not set +# CONFIG_SENSORS_NCT6683 is not set +# CONFIG_SENSORS_NCT6775 is not set +# CONFIG_SENSORS_NCT7802 is not set +# CONFIG_SENSORS_NCT7904 is not set +# CONFIG_SENSORS_PCF8591 is not set +# CONFIG_PMBUS is not set +# CONFIG_SENSORS_SHT15 is not set +# CONFIG_SENSORS_SHT21 is not set +# CONFIG_SENSORS_SHTC1 is not set +# CONFIG_SENSORS_DME1737 is not set +# CONFIG_SENSORS_EMC1403 is not set +# CONFIG_SENSORS_EMC2103 is not set +# CONFIG_SENSORS_EMC6W201 is not set +# CONFIG_SENSORS_SMSC47M1 is not set +# CONFIG_SENSORS_SMSC47M192 is not set +# CONFIG_SENSORS_SMSC47B397 is not set +# CONFIG_SENSORS_SCH56XX_COMMON is not set +# CONFIG_SENSORS_SCH5627 is not set +# CONFIG_SENSORS_SCH5636 is not set +# CONFIG_SENSORS_SMM665 is not set +# CONFIG_SENSORS_ADC128D818 is not set +# CONFIG_SENSORS_ADS1015 is not set +# CONFIG_SENSORS_ADS7828 is not set +# CONFIG_SENSORS_ADS7871 is not set +# CONFIG_SENSORS_AMC6821 is not set +# CONFIG_SENSORS_INA209 is not set +# CONFIG_SENSORS_INA2XX is not set +# CONFIG_SENSORS_TC74 is not set +# CONFIG_SENSORS_THMC50 is not set +# CONFIG_SENSORS_TMP102 is not set +# CONFIG_SENSORS_TMP103 is not set +# CONFIG_SENSORS_TMP401 is not set +# CONFIG_SENSORS_TMP421 is not set +# CONFIG_SENSORS_VT1211 is not set +# CONFIG_SENSORS_W83781D is not set +# CONFIG_SENSORS_W83791D is not set +# CONFIG_SENSORS_W83792D is not set +# CONFIG_SENSORS_W83793 is not set +# CONFIG_SENSORS_W83795 is not set +# CONFIG_SENSORS_W83L785TS is not set +# CONFIG_SENSORS_W83L786NG is not set +# CONFIG_SENSORS_W83627HF is not set +# CONFIG_SENSORS_W83627EHF is not set +CONFIG_THERMAL=y +CONFIG_THERMAL_HWMON=y +CONFIG_THERMAL_OF=y +# CONFIG_THERMAL_WRITABLE_TRIPS is not set +CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE=y +# CONFIG_THERMAL_DEFAULT_GOV_FAIR_SHARE is not set +# CONFIG_THERMAL_DEFAULT_GOV_USER_SPACE is not set +# CONFIG_THERMAL_DEFAULT_GOV_POWER_ALLOCATOR is not set +# CONFIG_THERMAL_GOV_FAIR_SHARE is not set +CONFIG_THERMAL_GOV_STEP_WISE=y +# CONFIG_THERMAL_GOV_BANG_BANG is not set +# CONFIG_THERMAL_GOV_USER_SPACE is not set +# CONFIG_THERMAL_GOV_POWER_ALLOCATOR is not set +# CONFIG_CPU_THERMAL is not set +# CONFIG_THERMAL_EMULATION is not set +CONFIG_THERMAL_BCM2835=y +CONFIG_WATCHDOG=y +CONFIG_WATCHDOG_CORE=y +# CONFIG_WATCHDOG_NOWAYOUT is not set +# CONFIG_WATCHDOG_SYSFS is not set + +# +# Watchdog Device Drivers +# +# CONFIG_SOFT_WATCHDOG is not set +# CONFIG_GPIO_WATCHDOG is not set +# CONFIG_XILINX_WATCHDOG is not set +# CONFIG_ZIIRAVE_WATCHDOG is not set +# CONFIG_ARM_SP805_WATCHDOG is not set +# CONFIG_CADENCE_WATCHDOG is not set +# CONFIG_DW_WATCHDOG is not set +# CONFIG_MAX63XX_WATCHDOG is not set +CONFIG_BCM2835_WDT=m +# CONFIG_MEN_A21_WDT is not set + +# +# USB-based Watchdog Cards +# +# CONFIG_USBPCWATCHDOG is not set +CONFIG_SSB_POSSIBLE=y + +# +# Sonics Silicon Backplane +# +CONFIG_SSB=m +CONFIG_SSB_BLOCKIO=y +CONFIG_SSB_SDIOHOST_POSSIBLE=y +# CONFIG_SSB_SDIOHOST is not set +# CONFIG_SSB_SILENT is not set +# CONFIG_SSB_DEBUG is not set +# CONFIG_SSB_DRIVER_GPIO is not set +CONFIG_BCMA_POSSIBLE=y + +# +# Broadcom specific AMBA +# +CONFIG_BCMA=m +CONFIG_BCMA_BLOCKIO=y +# CONFIG_BCMA_HOST_SOC is not set +CONFIG_BCMA_DRIVER_GMAC_CMN=y +# CONFIG_BCMA_DRIVER_GPIO is not set +# CONFIG_BCMA_DEBUG is not set + +# +# Multifunction device drivers +# +CONFIG_MFD_CORE=y +# CONFIG_MFD_RPISENSE_CORE is not set +# CONFIG_MFD_ACT8945A is not set +# CONFIG_MFD_AS3711 is not set +# CONFIG_MFD_AS3722 is not set +# CONFIG_PMIC_ADP5520 is not set +# CONFIG_MFD_AAT2870_CORE is not set +# CONFIG_MFD_ATMEL_FLEXCOM is not set +# CONFIG_MFD_ATMEL_HLCDC is not set +# CONFIG_MFD_BCM590XX is not set +# CONFIG_MFD_AXP20X_I2C is not set +# CONFIG_MFD_CROS_EC is not set +# CONFIG_MFD_ASIC3 is not set +# CONFIG_PMIC_DA903X is not set +# CONFIG_MFD_DA9052_SPI is not set +# CONFIG_MFD_DA9052_I2C is not set +# CONFIG_MFD_DA9055 is not set +# CONFIG_MFD_DA9062 is not set +# CONFIG_MFD_DA9063 is not set +# CONFIG_MFD_DA9150 is not set +# CONFIG_MFD_DLN2 is not set +# CONFIG_MFD_MC13XXX_SPI is not set +# CONFIG_MFD_MC13XXX_I2C is not set +# CONFIG_MFD_HI6421_PMIC is not set +# CONFIG_HTC_EGPIO is not set +# CONFIG_HTC_PASIC3 is not set +# CONFIG_HTC_I2CPLD is not set +# CONFIG_INTEL_SOC_PMIC is not set +# CONFIG_MFD_KEMPLD is not set +# CONFIG_MFD_88PM800 is not set +# CONFIG_MFD_88PM805 is not set +# CONFIG_MFD_88PM860X is not set +# CONFIG_MFD_MAX14577 is not set +# CONFIG_MFD_MAX77686 is not set +# CONFIG_MFD_MAX77693 is not set +# CONFIG_MFD_MAX77843 is not set +# CONFIG_MFD_MAX8907 is not set +# CONFIG_MFD_MAX8925 is not set +# CONFIG_MFD_MAX8997 is not set +# CONFIG_MFD_MAX8998 is not set +# CONFIG_MFD_MT6397 is not set +# CONFIG_MFD_MENF21BMC is not set +# CONFIG_EZX_PCAP is not set +# CONFIG_MFD_VIPERBOARD is not set +# CONFIG_MFD_RETU is not set +# CONFIG_MFD_PCF50633 is not set +# CONFIG_UCB1400_CORE is not set +# CONFIG_MFD_PM8921_CORE is not set +# CONFIG_MFD_RT5033 is not set +CONFIG_MFD_RTSX_USB=y +# CONFIG_MFD_RC5T583 is not set +# CONFIG_MFD_RK808 is not set +# CONFIG_MFD_RN5T618 is not set +# CONFIG_MFD_SEC_CORE is not set +# CONFIG_MFD_SI476X_CORE is not set +# CONFIG_MFD_SM501 is not set +# CONFIG_MFD_SKY81452 is not set +# CONFIG_MFD_SMSC is not set +# CONFIG_ABX500_CORE is not set +# CONFIG_MFD_STMPE is not set +# CONFIG_MFD_SYSCON is not set +# CONFIG_MFD_TI_AM335X_TSCADC is not set +# CONFIG_MFD_LP3943 is not set +# CONFIG_MFD_LP8788 is not set +# CONFIG_MFD_PALMAS is not set +# CONFIG_TPS6105X is not set +# CONFIG_TPS65010 is not set +# CONFIG_TPS6507X is not set +# CONFIG_MFD_TPS65086 is not set +# CONFIG_MFD_TPS65090 is not set +# CONFIG_MFD_TPS65217 is not set +# CONFIG_MFD_TPS65218 is not set +# CONFIG_MFD_TPS6586X is not set +# CONFIG_MFD_TPS65910 is not set +# CONFIG_MFD_TPS65912_I2C is not set +# CONFIG_MFD_TPS65912_SPI is not set +# CONFIG_MFD_TPS80031 is not set +# CONFIG_TWL4030_CORE is not set +# CONFIG_TWL6040_CORE is not set +# CONFIG_MFD_WL1273_CORE is not set +# CONFIG_MFD_LM3533 is not set +# CONFIG_MFD_TC3589X is not set +# CONFIG_MFD_TMIO is not set +# CONFIG_MFD_T7L66XB is not set +# CONFIG_MFD_TC6387XB is not set +# CONFIG_MFD_TC6393XB is not set +CONFIG_MFD_ARIZONA=y +CONFIG_MFD_ARIZONA_I2C=m +CONFIG_MFD_ARIZONA_SPI=m +# CONFIG_MFD_CS47L24 is not set +CONFIG_MFD_WM5102=y +# CONFIG_MFD_WM5110 is not set +# CONFIG_MFD_WM8997 is not set +# CONFIG_MFD_WM8998 is not set +# CONFIG_MFD_WM8400 is not set +# CONFIG_MFD_WM831X_I2C is not set +# CONFIG_MFD_WM831X_SPI is not set +# CONFIG_MFD_WM8350_I2C is not set +# CONFIG_MFD_WM8994 is not set +# CONFIG_REGULATOR is not set +CONFIG_MEDIA_SUPPORT=m + +# +# Multimedia core support +# +CONFIG_MEDIA_CAMERA_SUPPORT=y +CONFIG_MEDIA_ANALOG_TV_SUPPORT=y +CONFIG_MEDIA_DIGITAL_TV_SUPPORT=y +CONFIG_MEDIA_RADIO_SUPPORT=y +# CONFIG_MEDIA_SDR_SUPPORT is not set +CONFIG_MEDIA_RC_SUPPORT=y +# CONFIG_MEDIA_CONTROLLER is not set +CONFIG_VIDEO_DEV=m +CONFIG_VIDEO_V4L2=m +# CONFIG_VIDEO_ADV_DEBUG is not set +# CONFIG_VIDEO_FIXED_MINOR_RANGES is not set +CONFIG_VIDEO_TUNER=m +CONFIG_VIDEOBUF_GEN=m +CONFIG_VIDEOBUF_VMALLOC=m +CONFIG_VIDEOBUF_DVB=m +CONFIG_VIDEOBUF2_CORE=m +CONFIG_VIDEOBUF2_MEMOPS=m +CONFIG_VIDEOBUF2_VMALLOC=m +CONFIG_DVB_CORE=m +CONFIG_DVB_NET=y +CONFIG_TTPCI_EEPROM=m +CONFIG_DVB_MAX_ADAPTERS=8 +# CONFIG_DVB_DYNAMIC_MINORS is not set + +# +# Media drivers +# +CONFIG_RC_CORE=m +CONFIG_RC_MAP=m +CONFIG_RC_DECODERS=y +CONFIG_LIRC=m +CONFIG_IR_LIRC_CODEC=m +CONFIG_IR_NEC_DECODER=m +CONFIG_IR_RC5_DECODER=m +CONFIG_IR_RC6_DECODER=m +CONFIG_IR_JVC_DECODER=m +CONFIG_IR_SONY_DECODER=m +CONFIG_IR_SANYO_DECODER=m +CONFIG_IR_SHARP_DECODER=m +CONFIG_IR_MCE_KBD_DECODER=m +CONFIG_IR_XMP_DECODER=m +CONFIG_RC_DEVICES=y +CONFIG_RC_ATI_REMOTE=m +# CONFIG_IR_HIX5HD2 is not set +CONFIG_IR_IMON=m +CONFIG_IR_MCEUSB=m +CONFIG_IR_REDRAT3=m +CONFIG_IR_STREAMZAP=m +CONFIG_IR_IGORPLUGUSB=m +CONFIG_IR_IGUANA=m +CONFIG_IR_TTUSBIR=m +# CONFIG_RC_LOOPBACK is not set +CONFIG_IR_GPIO_CIR=m +CONFIG_MEDIA_USB_SUPPORT=y + +# +# Webcam devices +# +# CONFIG_USB_VIDEO_CLASS is not set +# CONFIG_USB_GSPCA is not set +# CONFIG_USB_PWC is not set +# CONFIG_VIDEO_CPIA2 is not set +# CONFIG_USB_ZR364XX is not set +# CONFIG_USB_STKWEBCAM is not set +# CONFIG_USB_S2255 is not set +CONFIG_VIDEO_USBTV=m + +# +# Analog TV USB devices +# +CONFIG_VIDEO_PVRUSB2=m +CONFIG_VIDEO_PVRUSB2_SYSFS=y +CONFIG_VIDEO_PVRUSB2_DVB=y +# CONFIG_VIDEO_PVRUSB2_DEBUGIFC is not set +# CONFIG_VIDEO_HDPVR is not set +# CONFIG_VIDEO_USBVISION is not set +CONFIG_VIDEO_STK1160_COMMON=m +# CONFIG_VIDEO_STK1160_AC97 is not set +CONFIG_VIDEO_STK1160=m +# CONFIG_VIDEO_GO7007 is not set + +# +# Analog/digital TV USB devices +# +CONFIG_VIDEO_AU0828=m +CONFIG_VIDEO_AU0828_V4L2=y +CONFIG_VIDEO_AU0828_RC=y +CONFIG_VIDEO_CX231XX=m +CONFIG_VIDEO_CX231XX_RC=y +# CONFIG_VIDEO_CX231XX_ALSA is not set +CONFIG_VIDEO_CX231XX_DVB=m +CONFIG_VIDEO_TM6000=m +# CONFIG_VIDEO_TM6000_ALSA is not set +CONFIG_VIDEO_TM6000_DVB=m + +# +# Digital TV USB devices +# +CONFIG_DVB_USB=m +# CONFIG_DVB_USB_DEBUG is not set +# CONFIG_DVB_USB_A800 is not set +CONFIG_DVB_USB_DIBUSB_MB=m +CONFIG_DVB_USB_DIBUSB_MB_FAULTY=y +CONFIG_DVB_USB_DIBUSB_MC=m +CONFIG_DVB_USB_DIB0700=m +# CONFIG_DVB_USB_UMT_010 is not set +CONFIG_DVB_USB_CXUSB=m +# CONFIG_DVB_USB_M920X is not set +# CONFIG_DVB_USB_DIGITV is not set +CONFIG_DVB_USB_VP7045=m +# CONFIG_DVB_USB_VP702X is not set +# CONFIG_DVB_USB_GP8PSK is not set +CONFIG_DVB_USB_NOVA_T_USB2=m +CONFIG_DVB_USB_TTUSB2=m +CONFIG_DVB_USB_DTT200U=m +CONFIG_DVB_USB_OPERA1=m +CONFIG_DVB_USB_AF9005=m +CONFIG_DVB_USB_AF9005_REMOTE=m +CONFIG_DVB_USB_PCTV452E=m +CONFIG_DVB_USB_DW2102=m +CONFIG_DVB_USB_CINERGY_T2=m +CONFIG_DVB_USB_DTV5100=m +# CONFIG_DVB_USB_FRIIO is not set +CONFIG_DVB_USB_AZ6027=m +CONFIG_DVB_USB_TECHNISAT_USB2=m +CONFIG_DVB_USB_V2=m +CONFIG_DVB_USB_AF9015=m +CONFIG_DVB_USB_AF9035=m +CONFIG_DVB_USB_ANYSEE=m +# CONFIG_DVB_USB_AU6610 is not set +CONFIG_DVB_USB_AZ6007=m +CONFIG_DVB_USB_CE6230=m +CONFIG_DVB_USB_EC168=m +# CONFIG_DVB_USB_GL861 is not set +CONFIG_DVB_USB_LME2510=m +# CONFIG_DVB_USB_MXL111SF is not set +CONFIG_DVB_USB_RTL28XXU=m +CONFIG_DVB_USB_DVBSKY=m +CONFIG_SMS_USB_DRV=m +CONFIG_DVB_B2C2_FLEXCOP_USB=m +# CONFIG_DVB_B2C2_FLEXCOP_USB_DEBUG is not set +CONFIG_DVB_AS102=m + +# +# Webcam, TV (analog/digital) USB devices +# +CONFIG_VIDEO_EM28XX=m +# CONFIG_VIDEO_EM28XX_V4L2 is not set +# CONFIG_VIDEO_EM28XX_ALSA is not set +CONFIG_VIDEO_EM28XX_DVB=m +CONFIG_VIDEO_EM28XX_RC=m +# CONFIG_V4L_PLATFORM_DRIVERS is not set +# CONFIG_V4L_MEM2MEM_DRIVERS is not set +# CONFIG_V4L_TEST_DRIVERS is not set +# CONFIG_DVB_PLATFORM_DRIVERS is not set + +# +# Supported MMC/SDIO adapters +# +CONFIG_SMS_SDIO_DRV=m +# CONFIG_RADIO_ADAPTERS is not set +CONFIG_MEDIA_COMMON_OPTIONS=y + +# +# common driver options +# +CONFIG_VIDEO_CX2341X=m +CONFIG_VIDEO_TVEEPROM=m +CONFIG_CYPRESS_FIRMWARE=m +CONFIG_DVB_B2C2_FLEXCOP=m +CONFIG_SMS_SIANO_MDTV=m +CONFIG_SMS_SIANO_RC=y +# CONFIG_SMS_SIANO_DEBUGFS is not set + +# +# Media ancillary drivers (tuners, sensors, i2c, frontends) +# +CONFIG_MEDIA_SUBDRV_AUTOSELECT=y +CONFIG_MEDIA_ATTACH=y +CONFIG_VIDEO_IR_I2C=m + +# +# Audio decoders, processors and mixers +# +CONFIG_VIDEO_MSP3400=m +CONFIG_VIDEO_CS53L32A=m +CONFIG_VIDEO_WM8775=m + +# +# RDS decoders +# + +# +# Video decoders +# +CONFIG_VIDEO_SAA711X=m + +# +# Video and audio decoders +# +CONFIG_VIDEO_CX25840=m + +# +# Video encoders +# + +# +# Camera sensor devices +# + +# +# Flash devices +# + +# +# Video improvement chips +# + +# +# Audio/Video compression chips +# + +# +# Miscellaneous helper chips +# + +# +# Sensors used on soc_camera driver +# +CONFIG_MEDIA_TUNER=m +CONFIG_MEDIA_TUNER_SIMPLE=m +CONFIG_MEDIA_TUNER_TDA8290=m +CONFIG_MEDIA_TUNER_TDA827X=m +CONFIG_MEDIA_TUNER_TDA18271=m +CONFIG_MEDIA_TUNER_TDA9887=m +CONFIG_MEDIA_TUNER_TEA5761=m +CONFIG_MEDIA_TUNER_TEA5767=m +CONFIG_MEDIA_TUNER_MT20XX=m +CONFIG_MEDIA_TUNER_MT2060=m +CONFIG_MEDIA_TUNER_MT2063=m +CONFIG_MEDIA_TUNER_MT2266=m +CONFIG_MEDIA_TUNER_QT1010=m +CONFIG_MEDIA_TUNER_XC2028=m +CONFIG_MEDIA_TUNER_XC5000=m +CONFIG_MEDIA_TUNER_XC4000=m +CONFIG_MEDIA_TUNER_MXL5005S=m +CONFIG_MEDIA_TUNER_MXL5007T=m +CONFIG_MEDIA_TUNER_MC44S803=m +CONFIG_MEDIA_TUNER_MAX2165=m +CONFIG_MEDIA_TUNER_TDA18218=m +CONFIG_MEDIA_TUNER_FC0011=m +CONFIG_MEDIA_TUNER_FC0012=m +CONFIG_MEDIA_TUNER_FC0013=m +CONFIG_MEDIA_TUNER_TDA18212=m +CONFIG_MEDIA_TUNER_E4000=m +CONFIG_MEDIA_TUNER_FC2580=m +CONFIG_MEDIA_TUNER_TUA9001=m +CONFIG_MEDIA_TUNER_SI2157=m +CONFIG_MEDIA_TUNER_IT913X=m +CONFIG_MEDIA_TUNER_R820T=m + +# +# Multistandard (satellite) frontends +# +CONFIG_DVB_STB0899=m +CONFIG_DVB_STB6100=m +CONFIG_DVB_STV090x=m +CONFIG_DVB_STV6110x=m +CONFIG_DVB_M88DS3103=m + +# +# Multistandard (cable + terrestrial) frontends +# +CONFIG_DVB_DRXK=m +CONFIG_DVB_TDA18271C2DD=m +CONFIG_DVB_SI2165=m + +# +# DVB-S (satellite) frontends +# +CONFIG_DVB_CX24123=m +CONFIG_DVB_MT312=m +CONFIG_DVB_ZL10039=m +CONFIG_DVB_S5H1420=m +CONFIG_DVB_STV0288=m +CONFIG_DVB_STB6000=m +CONFIG_DVB_STV0299=m +CONFIG_DVB_STV6110=m +CONFIG_DVB_STV0900=m +CONFIG_DVB_TDA10086=m +CONFIG_DVB_TUNER_ITD1000=m +CONFIG_DVB_TUNER_CX24113=m +CONFIG_DVB_TDA826X=m +CONFIG_DVB_CX24116=m +CONFIG_DVB_CX24120=m +CONFIG_DVB_SI21XX=m +CONFIG_DVB_TS2020=m +CONFIG_DVB_DS3000=m +CONFIG_DVB_TDA10071=m + +# +# DVB-T (terrestrial) frontends +# +CONFIG_DVB_CX22702=m +CONFIG_DVB_DRXD=m +CONFIG_DVB_MT352=m +CONFIG_DVB_ZL10353=m +CONFIG_DVB_DIB3000MB=m +CONFIG_DVB_DIB3000MC=m +CONFIG_DVB_DIB7000M=m +CONFIG_DVB_DIB7000P=m +CONFIG_DVB_TDA10048=m +CONFIG_DVB_AF9013=m +CONFIG_DVB_EC100=m +CONFIG_DVB_CXD2820R=m +CONFIG_DVB_RTL2830=m +CONFIG_DVB_RTL2832=m +CONFIG_DVB_SI2168=m +CONFIG_DVB_AS102_FE=m + +# +# DVB-C (cable) frontends +# +CONFIG_DVB_TDA10023=m +CONFIG_DVB_STV0297=m + +# +# ATSC (North American/Korean Terrestrial/Cable DTV) frontends +# +CONFIG_DVB_NXT200X=m +CONFIG_DVB_BCM3510=m +CONFIG_DVB_LGDT330X=m +CONFIG_DVB_LGDT3305=m +CONFIG_DVB_LGDT3306A=m +CONFIG_DVB_S5H1409=m +CONFIG_DVB_AU8522=m +CONFIG_DVB_AU8522_DTV=m +CONFIG_DVB_AU8522_V4L=m +CONFIG_DVB_S5H1411=m + +# +# ISDB-T (terrestrial) frontends +# +CONFIG_DVB_S921=m +CONFIG_DVB_DIB8000=m +CONFIG_DVB_MB86A20S=m + +# +# ISDB-S (satellite) & ISDB-T (terrestrial) frontends +# + +# +# Digital terrestrial only tuners/PLL +# +CONFIG_DVB_PLL=m +CONFIG_DVB_TUNER_DIB0070=m +CONFIG_DVB_TUNER_DIB0090=m + +# +# SEC control devices for DVB-S +# +CONFIG_DVB_DRX39XYJ=m +CONFIG_DVB_LNBP21=m +CONFIG_DVB_LNBP22=m +CONFIG_DVB_ISL6421=m +CONFIG_DVB_ISL6423=m +CONFIG_DVB_A8293=m +CONFIG_DVB_SP2=m +CONFIG_DVB_LGS8GXX=m +CONFIG_DVB_ATBM8830=m +CONFIG_DVB_IX2505V=m +CONFIG_DVB_M88RS2000=m +CONFIG_DVB_AF9033=m + +# +# Tools to develop new frontends +# +# CONFIG_DVB_DUMMY_FE is not set + +# +# Graphics support +# +# CONFIG_DRM is not set + +# +# ACP (Audio CoProcessor) Configuration +# +# CONFIG_DRM_AMD_ACP is not set + +# +# Frame buffer Devices +# +CONFIG_FB=y +# CONFIG_FIRMWARE_EDID is not set +CONFIG_FB_CMDLINE=y +CONFIG_FB_NOTIFY=y +# CONFIG_FB_DDC is not set +# CONFIG_FB_BOOT_VESA_SUPPORT is not set +CONFIG_FB_CFB_FILLRECT=y +CONFIG_FB_CFB_COPYAREA=y +CONFIG_FB_CFB_IMAGEBLIT=y +# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set +# CONFIG_FB_SYS_FILLRECT is not set +# CONFIG_FB_SYS_COPYAREA is not set +# CONFIG_FB_SYS_IMAGEBLIT is not set +# CONFIG_FB_FOREIGN_ENDIAN is not set +# CONFIG_FB_SYS_FOPS is not set +# CONFIG_FB_SVGALIB is not set +# CONFIG_FB_MACMODES is not set +# CONFIG_FB_BACKLIGHT is not set +# CONFIG_FB_MODE_HELPERS is not set +# CONFIG_FB_TILEBLITTING is not set + +# +# Frame buffer hardware drivers +# +CONFIG_FB_BCM2708=y +# CONFIG_FB_ARMCLCD is not set +# CONFIG_FB_OPENCORES is not set +# CONFIG_FB_S1D13XXX is not set +# CONFIG_FB_SMSCUFX is not set +# CONFIG_FB_UDL is not set +# CONFIG_FB_IBM_GXT4500 is not set +# CONFIG_FB_VIRTUAL is not set +# CONFIG_FB_METRONOME is not set +# CONFIG_FB_BROADSHEET is not set +# CONFIG_FB_AUO_K190X is not set +# CONFIG_FB_SIMPLE is not set +# CONFIG_FB_SSD1307 is not set +# CONFIG_FB_RPISENSE is not set +CONFIG_BACKLIGHT_LCD_SUPPORT=y +CONFIG_LCD_CLASS_DEVICE=y +# CONFIG_LCD_L4F00242T03 is not set +# CONFIG_LCD_LMS283GF05 is not set +# CONFIG_LCD_LTV350QV is not set +# CONFIG_LCD_ILI922X is not set +# CONFIG_LCD_ILI9320 is not set +# CONFIG_LCD_TDO24M is not set +# CONFIG_LCD_VGG2432A4 is not set +# CONFIG_LCD_PLATFORM is not set +# CONFIG_LCD_S6E63M0 is not set +# CONFIG_LCD_LD9040 is not set +# CONFIG_LCD_AMS369FG06 is not set +# CONFIG_LCD_LMS501KF03 is not set +# CONFIG_LCD_HX8357 is not set +CONFIG_BACKLIGHT_CLASS_DEVICE=y +# CONFIG_BACKLIGHT_GENERIC is not set +CONFIG_BACKLIGHT_RPI=y +# CONFIG_BACKLIGHT_PM8941_WLED is not set +# CONFIG_BACKLIGHT_ADP8860 is not set +# CONFIG_BACKLIGHT_ADP8870 is not set +# CONFIG_BACKLIGHT_LM3639 is not set +CONFIG_BACKLIGHT_GPIO=y +# CONFIG_BACKLIGHT_LV5207LP is not set +# CONFIG_BACKLIGHT_BD6107 is not set +# CONFIG_VGASTATE is not set + +# +# Console display driver support +# +CONFIG_DUMMY_CONSOLE=y +CONFIG_FRAMEBUFFER_CONSOLE=y +# CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set +# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set +# CONFIG_LOGO is not set +CONFIG_SOUND=y +# CONFIG_SOUND_OSS_CORE is not set +CONFIG_SND=m +CONFIG_SND_TIMER=m +CONFIG_SND_PCM=m +CONFIG_SND_DMAENGINE_PCM=m +CONFIG_SND_HWDEP=m +CONFIG_SND_RAWMIDI=m +CONFIG_SND_JACK=y +CONFIG_SND_JACK_INPUT_DEV=y +# CONFIG_SND_SEQUENCER is not set +# CONFIG_SND_MIXER_OSS is not set +# CONFIG_SND_PCM_OSS is not set +CONFIG_SND_PCM_TIMER=y +CONFIG_SND_HRTIMER=m +CONFIG_SND_DYNAMIC_MINORS=y +CONFIG_SND_MAX_CARDS=32 +# CONFIG_SND_SUPPORT_OLD_API is not set +CONFIG_SND_PROC_FS=y +CONFIG_SND_VERBOSE_PROCFS=y +# CONFIG_SND_VERBOSE_PRINTK is not set +# CONFIG_SND_DEBUG is not set +CONFIG_SND_VMASTER=y +# CONFIG_SND_RAWMIDI_SEQ is not set +# CONFIG_SND_OPL3_LIB_SEQ is not set +# CONFIG_SND_OPL4_LIB_SEQ is not set +# CONFIG_SND_SBAWE_SEQ is not set +# CONFIG_SND_EMU10K1_SEQ is not set +CONFIG_SND_AC97_CODEC=m +# CONFIG_SND_DRIVERS is not set + +# +# HD-Audio +# +CONFIG_SND_HDA_PREALLOC_SIZE=2048 +CONFIG_SND_ARM=y +# CONFIG_SND_ARMAACI is not set +CONFIG_SND_BCM2835=m +CONFIG_SND_SPI=y +CONFIG_SND_USB=y +CONFIG_SND_USB_AUDIO=m +CONFIG_SND_USB_UA101=m +CONFIG_SND_USB_CAIAQ=m +CONFIG_SND_USB_CAIAQ_INPUT=y +CONFIG_SND_USB_6FIRE=m +CONFIG_SND_USB_HIFACE=m +CONFIG_SND_BCD2000=m +CONFIG_SND_USB_LINE6=m +CONFIG_SND_USB_POD=m +CONFIG_SND_USB_PODHD=m +CONFIG_SND_USB_TONEPORT=m +CONFIG_SND_USB_VARIAX=m +CONFIG_SND_SOC=m +CONFIG_SND_SOC_GENERIC_DMAENGINE_PCM=y +# CONFIG_SND_SOC_AMD_ACP is not set +# CONFIG_SND_ATMEL_SOC is not set +CONFIG_SND_BCM2835_SOC_I2S=m +CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC=m +CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS=m +CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI=m +CONFIG_SND_BCM2708_SOC_HIFIBERRY_AMP=m +CONFIG_SND_BCM2708_SOC_RPI_DAC=m +CONFIG_SND_BCM2708_SOC_RPI_PROTO=m +CONFIG_SND_BCM2708_SOC_BOOMBERRY_DAC=m +CONFIG_SND_BCM2708_SOC_BOOMBERRY_DIGI=m +CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC=m +CONFIG_SND_BCM2708_SOC_RASPIDAC3=m +# CONFIG_SND_DESIGNWARE_I2S is not set + +# +# SoC Audio for Freescale CPUs +# + +# +# Common SoC Audio options for Freescale CPUs: +# +# CONFIG_SND_SOC_FSL_ASRC is not set +# CONFIG_SND_SOC_FSL_SAI is not set +# CONFIG_SND_SOC_FSL_SSI is not set +# CONFIG_SND_SOC_FSL_SPDIF is not set +# CONFIG_SND_SOC_FSL_ESAI is not set +# CONFIG_SND_SOC_IMX_AUDMUX is not set +# CONFIG_SND_SOC_IMG is not set + +# +# Allwinner SoC Audio support +# +# CONFIG_SND_SUN4I_CODEC is not set +# CONFIG_SND_SUN4I_SPDIF is not set +# CONFIG_SND_SOC_XTFPGA_I2S is not set +CONFIG_SND_SOC_I2C_AND_SPI=m + +# +# CODEC drivers +# +# CONFIG_SND_SOC_AC97_CODEC is not set +# CONFIG_SND_SOC_ADAU1701 is not set +# CONFIG_SND_SOC_AK4104 is not set +# CONFIG_SND_SOC_AK4554 is not set +# CONFIG_SND_SOC_AK4613 is not set +# CONFIG_SND_SOC_AK4642 is not set +# CONFIG_SND_SOC_AK5386 is not set +# CONFIG_SND_SOC_ALC5623 is not set +# CONFIG_SND_SOC_CS35L32 is not set +# CONFIG_SND_SOC_CS42L51_I2C is not set +# CONFIG_SND_SOC_CS42L52 is not set +# CONFIG_SND_SOC_CS42L56 is not set +# CONFIG_SND_SOC_CS42L73 is not set +# CONFIG_SND_SOC_CS4265 is not set +# CONFIG_SND_SOC_CS4270 is not set +# CONFIG_SND_SOC_CS4271_I2C is not set +# CONFIG_SND_SOC_CS4271_SPI is not set +# CONFIG_SND_SOC_CS42XX8_I2C is not set +# CONFIG_SND_SOC_CS4349 is not set +# CONFIG_SND_SOC_ES8328 is not set +# CONFIG_SND_SOC_GTM601 is not set +# CONFIG_SND_SOC_INNO_RK3036 is not set +# CONFIG_SND_SOC_PCM1681 is not set +# CONFIG_SND_SOC_PCM179X_I2C is not set +# CONFIG_SND_SOC_PCM179X_SPI is not set +# CONFIG_SND_SOC_PCM3168A_I2C is not set +# CONFIG_SND_SOC_PCM3168A_SPI is not set +CONFIG_SND_SOC_PCM512x=m +CONFIG_SND_SOC_PCM512x_I2C=m +# CONFIG_SND_SOC_PCM512x_SPI is not set +# CONFIG_SND_SOC_RT5616 is not set +CONFIG_SND_SOC_PCM1794A=m +CONFIG_SND_SOC_PCM5102A=m +# CONFIG_SND_SOC_RT5631 is not set +# CONFIG_SND_SOC_RT5677_SPI is not set +# CONFIG_SND_SOC_SGTL5000 is not set +# CONFIG_SND_SOC_SIRF_AUDIO_CODEC is not set +# CONFIG_SND_SOC_SPDIF is not set +# CONFIG_SND_SOC_SSM2602_SPI is not set +# CONFIG_SND_SOC_SSM2602_I2C is not set +# CONFIG_SND_SOC_SSM4567 is not set +CONFIG_SND_SOC_STA32X=m +# CONFIG_SND_SOC_STA350 is not set +# CONFIG_SND_SOC_STI_SAS is not set +# CONFIG_SND_SOC_TAS2552 is not set +# CONFIG_SND_SOC_TAS5086 is not set +# CONFIG_SND_SOC_TAS571X is not set +# CONFIG_SND_SOC_TFA9879 is not set +CONFIG_SND_SOC_TAS5713=m +# CONFIG_SND_SOC_TLV320AIC23_I2C is not set +# CONFIG_SND_SOC_TLV320AIC23_SPI is not set +# CONFIG_SND_SOC_TLV320AIC31XX is not set +# CONFIG_SND_SOC_TLV320AIC3X is not set +# CONFIG_SND_SOC_TS3A227E is not set +# CONFIG_SND_SOC_WM8510 is not set +# CONFIG_SND_SOC_WM8523 is not set +# CONFIG_SND_SOC_WM8580 is not set +# CONFIG_SND_SOC_WM8711 is not set +# CONFIG_SND_SOC_WM8728 is not set +CONFIG_SND_SOC_WM8731=m +# CONFIG_SND_SOC_WM8737 is not set +# CONFIG_SND_SOC_WM8741 is not set +# CONFIG_SND_SOC_WM8750 is not set +# CONFIG_SND_SOC_WM8753 is not set +# CONFIG_SND_SOC_WM8770 is not set +# CONFIG_SND_SOC_WM8776 is not set +CONFIG_SND_SOC_WM8804=m +CONFIG_SND_SOC_WM8804_I2C=m +# CONFIG_SND_SOC_WM8804_SPI is not set +# CONFIG_SND_SOC_WM8903 is not set +# CONFIG_SND_SOC_WM8962 is not set +# CONFIG_SND_SOC_WM8974 is not set +# CONFIG_SND_SOC_WM8978 is not set +CONFIG_SND_SOC_TPA6130A2=m +# CONFIG_SND_SIMPLE_CARD is not set +# CONFIG_SOUND_PRIME is not set +CONFIG_AC97_BUS=m + +# +# HID support +# +CONFIG_HID=y +# CONFIG_HID_BATTERY_STRENGTH is not set +CONFIG_HIDRAW=y +CONFIG_UHID=y +CONFIG_HID_GENERIC=y + +# +# Special HID drivers +# +CONFIG_HID_A4TECH=y +# CONFIG_HID_ACRUX is not set +CONFIG_HID_APPLE=y +# CONFIG_HID_APPLEIR is not set +CONFIG_HID_AUREAL=y +CONFIG_HID_BELKIN=y +# CONFIG_HID_BETOP_FF is not set +CONFIG_HID_CHERRY=y +CONFIG_HID_CHICONY=y +# CONFIG_HID_CORSAIR is not set +# CONFIG_HID_PRODIKEYS is not set +# CONFIG_HID_CMEDIA is not set +# CONFIG_HID_CP2112 is not set +CONFIG_HID_CYPRESS=y +CONFIG_HID_DRAGONRISE=m +CONFIG_DRAGONRISE_FF=y +# CONFIG_HID_EMS_FF is not set +# CONFIG_HID_ELECOM is not set +# CONFIG_HID_ELO is not set +CONFIG_HID_EZKEY=y +# CONFIG_HID_GEMBIRD is not set +# CONFIG_HID_GFRM is not set +# CONFIG_HID_HOLTEK is not set +# CONFIG_HID_GT683R is not set +# CONFIG_HID_KEYTOUCH is not set +CONFIG_HID_KYE=y +# CONFIG_HID_UCLOGIC is not set +# CONFIG_HID_WALTOP is not set +CONFIG_HID_GYRATION=y +# CONFIG_HID_ICADE is not set +CONFIG_HID_TWINHAN=y +CONFIG_HID_KENSINGTON=y +CONFIG_HID_LCPOWER=y +CONFIG_HID_LENOVO=y +CONFIG_HID_LOGITECH=y +CONFIG_HID_LOGITECH_DJ=y +CONFIG_HID_LOGITECH_HIDPP=y +CONFIG_LOGITECH_FF=y +CONFIG_LOGIRUMBLEPAD2_FF=y +CONFIG_LOGIG940_FF=y +CONFIG_LOGIWHEELS_FF=y +# CONFIG_HID_MAGICMOUSE is not set +CONFIG_HID_MICROSOFT=y +CONFIG_HID_MONTEREY=y +# CONFIG_HID_MULTITOUCH is not set +# CONFIG_HID_NTRIG is not set +CONFIG_HID_ORTEK=y +CONFIG_HID_OUYA=y +CONFIG_HID_PANTHERLORD=y +CONFIG_PANTHERLORD_FF=y +CONFIG_HID_PENMOUNT=y +CONFIG_HID_PETALYNX=y +# CONFIG_HID_PICOLCD is not set +# CONFIG_HID_PLANTRONICS is not set +# CONFIG_HID_PRIMAX is not set +# CONFIG_HID_ROCCAT is not set +# CONFIG_HID_SAITEK is not set +CONFIG_HID_SAMSUNG=y +CONFIG_HID_SONY=y +CONFIG_SONY_FF=y +# CONFIG_HID_SPEEDLINK is not set +# CONFIG_HID_STEELSERIES is not set +CONFIG_HID_SPINELPLUS=y +CONFIG_HID_SUNPLUS=y +CONFIG_HID_RMI=y +# CONFIG_HID_GREENASIA is not set +CONFIG_HID_SMARTJOYPLUS=m +CONFIG_SMARTJOYPLUS_FF=y +CONFIG_HID_TIVO=y +CONFIG_HID_TOPSEED=y +# CONFIG_HID_THINGM is not set +# CONFIG_HID_THRUSTMASTER is not set +# CONFIG_HID_WACOM is not set +CONFIG_HID_WIIMOTE=m +CONFIG_HID_XINMO=y +# CONFIG_HID_ZEROPLUS is not set +CONFIG_HID_ZYDACRON=y +# CONFIG_HID_SENSOR_HUB is not set + +# +# USB HID support +# +CONFIG_USB_HID=y +# CONFIG_HID_PID is not set +CONFIG_USB_HIDDEV=y + +# +# I2C HID support +# +# CONFIG_I2C_HID is not set +CONFIG_USB_OHCI_LITTLE_ENDIAN=y +CONFIG_USB_SUPPORT=y +CONFIG_USB_COMMON=y +CONFIG_USB_ARCH_HAS_HCD=y +CONFIG_USB=y +CONFIG_USB_ANNOUNCE_NEW_DEVICES=y + +# +# Miscellaneous USB options +# +CONFIG_USB_DEFAULT_PERSIST=y +# CONFIG_USB_DYNAMIC_MINORS is not set +# CONFIG_USB_OTG_WHITELIST is not set +# CONFIG_USB_OTG_BLACKLIST_HUB is not set +# CONFIG_USB_ULPI_BUS is not set +CONFIG_USB_MON=m +# CONFIG_USB_WUSB_CBAF is not set + +# +# USB Host Controller Drivers +# +# CONFIG_USB_C67X00_HCD is not set +# CONFIG_USB_XHCI_HCD is not set +# CONFIG_USB_EHCI_HCD is not set +# CONFIG_USB_OXU210HP_HCD is not set +# CONFIG_USB_ISP116X_HCD is not set +# CONFIG_USB_ISP1362_HCD is not set +# CONFIG_USB_FOTG210_HCD is not set +# CONFIG_USB_MAX3421_HCD is not set +# CONFIG_USB_OHCI_HCD is not set +# CONFIG_USB_SL811_HCD is not set +# CONFIG_USB_R8A66597_HCD is not set +CONFIG_USB_DWCOTG=y +# CONFIG_USB_HCD_BCMA is not set +# CONFIG_USB_HCD_SSB is not set +# CONFIG_USB_HCD_TEST_MODE is not set + +# +# USB Device Class drivers +# +CONFIG_USB_ACM=m +# CONFIG_USB_PRINTER is not set +# CONFIG_USB_WDM is not set +# CONFIG_USB_TMC is not set + +# +# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may +# + +# +# also be needed; see USB_STORAGE Help for more info +# +CONFIG_USB_STORAGE=y +# CONFIG_USB_STORAGE_DEBUG is not set +# CONFIG_USB_STORAGE_REALTEK is not set +# CONFIG_USB_STORAGE_DATAFAB is not set +# CONFIG_USB_STORAGE_FREECOM is not set +# CONFIG_USB_STORAGE_ISD200 is not set +# CONFIG_USB_STORAGE_USBAT is not set +# CONFIG_USB_STORAGE_SDDR09 is not set +# CONFIG_USB_STORAGE_SDDR55 is not set +# CONFIG_USB_STORAGE_JUMPSHOT is not set +# CONFIG_USB_STORAGE_ALAUDA is not set +# CONFIG_USB_STORAGE_ONETOUCH is not set +# CONFIG_USB_STORAGE_KARMA is not set +# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set +# CONFIG_USB_STORAGE_ENE_UB6250 is not set +CONFIG_USB_UAS=y + +# +# USB Imaging devices +# +# CONFIG_USB_MDC800 is not set +# CONFIG_USB_MICROTEK is not set +# CONFIG_USBIP_CORE is not set +# CONFIG_USB_MUSB_HDRC is not set +# CONFIG_USB_DWC3 is not set +# CONFIG_USB_DWC2 is not set +# CONFIG_USB_ISP1760 is not set + +# +# USB port drivers +# +CONFIG_USB_SERIAL=m +CONFIG_USB_SERIAL_GENERIC=y +# CONFIG_USB_SERIAL_SIMPLE is not set +# CONFIG_USB_SERIAL_AIRCABLE is not set +# CONFIG_USB_SERIAL_ARK3116 is not set +# CONFIG_USB_SERIAL_BELKIN is not set +CONFIG_USB_SERIAL_CH341=m +# CONFIG_USB_SERIAL_WHITEHEAT is not set +# CONFIG_USB_SERIAL_DIGI_ACCELEPORT is not set +CONFIG_USB_SERIAL_CP210X=m +# CONFIG_USB_SERIAL_CYPRESS_M8 is not set +# CONFIG_USB_SERIAL_EMPEG is not set +CONFIG_USB_SERIAL_FTDI_SIO=m +# CONFIG_USB_SERIAL_VISOR is not set +# CONFIG_USB_SERIAL_IPAQ is not set +# CONFIG_USB_SERIAL_IR is not set +# CONFIG_USB_SERIAL_EDGEPORT is not set +# CONFIG_USB_SERIAL_EDGEPORT_TI is not set +# CONFIG_USB_SERIAL_F81232 is not set +# CONFIG_USB_SERIAL_GARMIN is not set +# CONFIG_USB_SERIAL_IPW is not set +CONFIG_USB_SERIAL_IUU=m +# CONFIG_USB_SERIAL_KEYSPAN_PDA is not set +# CONFIG_USB_SERIAL_KEYSPAN is not set +# CONFIG_USB_SERIAL_KLSI is not set +# CONFIG_USB_SERIAL_KOBIL_SCT is not set +# CONFIG_USB_SERIAL_MCT_U232 is not set +# CONFIG_USB_SERIAL_METRO is not set +# CONFIG_USB_SERIAL_MOS7720 is not set +# CONFIG_USB_SERIAL_MOS7840 is not set +# CONFIG_USB_SERIAL_MXUPORT is not set +# CONFIG_USB_SERIAL_NAVMAN is not set +CONFIG_USB_SERIAL_PL2303=m +# CONFIG_USB_SERIAL_OTI6858 is not set +# CONFIG_USB_SERIAL_QCAUX is not set +# CONFIG_USB_SERIAL_QUALCOMM is not set +# CONFIG_USB_SERIAL_SPCP8X5 is not set +# CONFIG_USB_SERIAL_SAFE is not set +# CONFIG_USB_SERIAL_SIERRAWIRELESS is not set +# CONFIG_USB_SERIAL_SYMBOL is not set +# CONFIG_USB_SERIAL_TI is not set +# CONFIG_USB_SERIAL_CYBERJACK is not set +# CONFIG_USB_SERIAL_XIRCOM is not set +# CONFIG_USB_SERIAL_OPTION is not set +# CONFIG_USB_SERIAL_OMNINET is not set +# CONFIG_USB_SERIAL_OPTICON is not set +# CONFIG_USB_SERIAL_XSENS_MT is not set +# CONFIG_USB_SERIAL_WISHBONE is not set +# CONFIG_USB_SERIAL_SSU100 is not set +# CONFIG_USB_SERIAL_QT2 is not set +# CONFIG_USB_SERIAL_DEBUG is not set + +# +# USB Miscellaneous drivers +# +# CONFIG_USB_EMI62 is not set +# CONFIG_USB_EMI26 is not set +# CONFIG_USB_ADUTUX is not set +# CONFIG_USB_SEVSEG is not set +# CONFIG_USB_RIO500 is not set +# CONFIG_USB_LEGOTOWER is not set +# CONFIG_USB_LCD is not set +# CONFIG_USB_LED is not set +# CONFIG_USB_CYPRESS_CY7C63 is not set +# CONFIG_USB_CYTHERM is not set +# CONFIG_USB_IDMOUSE is not set +# CONFIG_USB_FTDI_ELAN is not set +# CONFIG_USB_APPLEDISPLAY is not set +# CONFIG_USB_LD is not set +# CONFIG_USB_TRANCEVIBRATOR is not set +# CONFIG_USB_IOWARRIOR is not set +# CONFIG_USB_TEST is not set +# CONFIG_USB_EHSET_TEST_FIXTURE is not set +# CONFIG_USB_ISIGHTFW is not set +# CONFIG_USB_YUREX is not set +# CONFIG_USB_EZUSB_FX2 is not set +# CONFIG_USB_HSIC_USB3503 is not set +# CONFIG_USB_LINK_LAYER_TEST is not set +# CONFIG_USB_CHAOSKEY is not set + +# +# USB Physical Layer drivers +# +# CONFIG_USB_PHY is not set +# CONFIG_NOP_USB_XCEIV is not set +# CONFIG_AM335X_PHY_USB is not set +# CONFIG_USB_GPIO_VBUS is not set +# CONFIG_USB_ISP1301 is not set +# CONFIG_USB_ULPI is not set +# CONFIG_USB_GADGET is not set +# CONFIG_USB_LED_TRIG is not set +# CONFIG_UWB is not set +CONFIG_MMC=y +# CONFIG_MMC_DEBUG is not set + +# +# MMC/SD/SDIO Card Drivers +# +CONFIG_MMC_BLOCK=y +CONFIG_MMC_BLOCK_MINORS=32 +CONFIG_MMC_BLOCK_BOUNCE=y +# CONFIG_SDIO_UART is not set +# CONFIG_MMC_TEST is not set + +# +# MMC/SD/SDIO Host Controller Drivers +# +CONFIG_MMC_BCM2835=y +CONFIG_MMC_BCM2835_DMA=y +CONFIG_MMC_BCM2835_PIO_DMA_BARRIER=2 +CONFIG_MMC_BCM2835_SDHOST=y +# CONFIG_MMC_ARMMMCI is not set +CONFIG_MMC_SDHCI=y +CONFIG_MMC_SDHCI_PLTFM=y +# CONFIG_MMC_SDHCI_OF_ARASAN is not set +# CONFIG_MMC_SDHCI_OF_AT91 is not set +# CONFIG_MMC_SDHCI_F_SDH30 is not set +# CONFIG_MMC_SPI is not set +# CONFIG_MMC_DW is not set +# CONFIG_MMC_VUB300 is not set +# CONFIG_MMC_USHC is not set +# CONFIG_MMC_USDHI6ROL0 is not set +CONFIG_MMC_REALTEK_USB=m +# CONFIG_MMC_MTK is not set +# CONFIG_MEMSTICK is not set +CONFIG_NEW_LEDS=y +CONFIG_LEDS_CLASS=y +CONFIG_LEDS_CLASS_FLASH=y + +# +# LED drivers +# +# CONFIG_LEDS_AAT1290 is not set +# CONFIG_LEDS_BCM6328 is not set +# CONFIG_LEDS_BCM6358 is not set +# CONFIG_LEDS_LM3530 is not set +# CONFIG_LEDS_LM3642 is not set +# CONFIG_LEDS_PCA9532 is not set +CONFIG_LEDS_GPIO=y +# CONFIG_LEDS_LP3944 is not set +# CONFIG_LEDS_LP5521 is not set +# CONFIG_LEDS_LP5523 is not set +# CONFIG_LEDS_LP5562 is not set +# CONFIG_LEDS_LP8501 is not set +# CONFIG_LEDS_LP8860 is not set +# CONFIG_LEDS_PCA955X is not set +# CONFIG_LEDS_PCA963X is not set +# CONFIG_LEDS_DAC124S085 is not set +# CONFIG_LEDS_BD2802 is not set +# CONFIG_LEDS_LT3593 is not set +# CONFIG_LEDS_TCA6507 is not set +# CONFIG_LEDS_TLC591XX is not set +# CONFIG_LEDS_LM355x is not set +# CONFIG_LEDS_KTD2692 is not set +# CONFIG_LEDS_IS31FL32XX is not set + +# +# LED driver for blink(1) USB RGB LED is under Special HID drivers (HID_THINGM) +# +# CONFIG_LEDS_BLINKM is not set + +# +# LED Triggers +# +CONFIG_LEDS_TRIGGERS=y +CONFIG_LEDS_TRIGGER_TIMER=y +CONFIG_LEDS_TRIGGER_ONESHOT=y +CONFIG_LEDS_TRIGGER_HEARTBEAT=y +CONFIG_LEDS_TRIGGER_BACKLIGHT=y +CONFIG_LEDS_TRIGGER_CPU=y +CONFIG_LEDS_TRIGGER_GPIO=y +CONFIG_LEDS_TRIGGER_DEFAULT_ON=y + +# +# iptables trigger is under Netfilter config (LED target) +# +CONFIG_LEDS_TRIGGER_TRANSIENT=y +CONFIG_LEDS_TRIGGER_CAMERA=y +CONFIG_LEDS_TRIGGER_INPUT=y +# CONFIG_ACCESSIBILITY is not set +CONFIG_EDAC_ATOMIC_SCRUB=y +CONFIG_EDAC_SUPPORT=y +# CONFIG_EDAC is not set +CONFIG_RTC_LIB=y +CONFIG_RTC_CLASS=y +# CONFIG_RTC_HCTOSYS is not set +CONFIG_RTC_SYSTOHC=y +CONFIG_RTC_SYSTOHC_DEVICE="rtc0" +# CONFIG_RTC_DEBUG is not set + +# +# RTC interfaces +# +CONFIG_RTC_INTF_SYSFS=y +CONFIG_RTC_INTF_PROC=y +CONFIG_RTC_INTF_DEV=y +# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set +# CONFIG_RTC_DRV_TEST is not set + +# +# I2C RTC drivers +# +# CONFIG_RTC_DRV_ABB5ZES3 is not set +# CONFIG_RTC_DRV_ABX80X is not set +CONFIG_RTC_DRV_DS1307=m +CONFIG_RTC_DRV_DS1307_HWMON=y +# CONFIG_RTC_DRV_DS1374 is not set +# CONFIG_RTC_DRV_DS1672 is not set +# CONFIG_RTC_DRV_HYM8563 is not set +# CONFIG_RTC_DRV_MAX6900 is not set +# CONFIG_RTC_DRV_RS5C372 is not set +# CONFIG_RTC_DRV_ISL1208 is not set +# CONFIG_RTC_DRV_ISL12022 is not set +# CONFIG_RTC_DRV_ISL12057 is not set +# CONFIG_RTC_DRV_X1205 is not set +CONFIG_RTC_DRV_PCF8523=m +# CONFIG_RTC_DRV_PCF85063 is not set +CONFIG_RTC_DRV_PCF8563=m +# CONFIG_RTC_DRV_PCF8583 is not set +# CONFIG_RTC_DRV_M41T80 is not set +# CONFIG_RTC_DRV_BQ32K is not set +# CONFIG_RTC_DRV_S35390A is not set +# CONFIG_RTC_DRV_FM3130 is not set +# CONFIG_RTC_DRV_RX8010 is not set +# CONFIG_RTC_DRV_RX8581 is not set +# CONFIG_RTC_DRV_RX8025 is not set +# CONFIG_RTC_DRV_EM3027 is not set +# CONFIG_RTC_DRV_RV3029C2 is not set +# CONFIG_RTC_DRV_RV8803 is not set + +# +# SPI RTC drivers +# +# CONFIG_RTC_DRV_M41T93 is not set +# CONFIG_RTC_DRV_M41T94 is not set +# CONFIG_RTC_DRV_DS1305 is not set +# CONFIG_RTC_DRV_DS1343 is not set +# CONFIG_RTC_DRV_DS1347 is not set +# CONFIG_RTC_DRV_DS1390 is not set +# CONFIG_RTC_DRV_R9701 is not set +# CONFIG_RTC_DRV_RX4581 is not set +# CONFIG_RTC_DRV_RX6110 is not set +# CONFIG_RTC_DRV_RS5C348 is not set +# CONFIG_RTC_DRV_MAX6902 is not set +# CONFIG_RTC_DRV_PCF2123 is not set +# CONFIG_RTC_DRV_MCP795 is not set +CONFIG_RTC_I2C_AND_SPI=y + +# +# SPI and I2C RTC drivers +# +CONFIG_RTC_DRV_DS3232=m +CONFIG_RTC_DRV_PCF2127=m + +# +# Platform RTC drivers +# +# CONFIG_RTC_DRV_CMOS is not set +# CONFIG_RTC_DRV_DS1286 is not set +# CONFIG_RTC_DRV_DS1511 is not set +# CONFIG_RTC_DRV_DS1553 is not set +# CONFIG_RTC_DRV_DS1685_FAMILY is not set +# CONFIG_RTC_DRV_DS1742 is not set +# CONFIG_RTC_DRV_DS2404 is not set +# CONFIG_RTC_DRV_STK17TA8 is not set +# CONFIG_RTC_DRV_M48T86 is not set +# CONFIG_RTC_DRV_M48T35 is not set +# CONFIG_RTC_DRV_M48T59 is not set +# CONFIG_RTC_DRV_MSM6242 is not set +# CONFIG_RTC_DRV_BQ4802 is not set +# CONFIG_RTC_DRV_RP5C01 is not set +# CONFIG_RTC_DRV_V3020 is not set +# CONFIG_RTC_DRV_ZYNQMP is not set + +# +# on-CPU RTC drivers +# +# CONFIG_RTC_DRV_PL030 is not set +# CONFIG_RTC_DRV_PL031 is not set +# CONFIG_RTC_DRV_SNVS is not set + +# +# HID Sensor RTC drivers +# +# CONFIG_RTC_DRV_HID_SENSOR_TIME is not set +CONFIG_DMADEVICES=y +# CONFIG_DMADEVICES_DEBUG is not set + +# +# DMA Devices +# +CONFIG_DMA_ENGINE=y +CONFIG_DMA_VIRTUAL_CHANNELS=y +CONFIG_DMA_OF=y +# CONFIG_AMBA_PL08X is not set +CONFIG_DMA_BCM2835=y +# CONFIG_FSL_EDMA is not set +# CONFIG_INTEL_IDMA64 is not set +# CONFIG_NBPFAXI_DMA is not set +# CONFIG_PL330_DMA is not set +CONFIG_DMA_BCM2708=y +# CONFIG_QCOM_HIDMA_MGMT is not set +# CONFIG_QCOM_HIDMA is not set +# CONFIG_DW_DMAC is not set + +# +# DMA Clients +# +# CONFIG_ASYNC_TX_DMA is not set +# CONFIG_DMATEST is not set +# CONFIG_AUXDISPLAY is not set +# CONFIG_UIO is not set +# CONFIG_VIRT_DRIVERS is not set + +# +# Virtio drivers +# +# CONFIG_VIRTIO_MMIO is not set + +# +# Microsoft Hyper-V guest support +# +CONFIG_STAGING=y +# CONFIG_PRISM2_USB is not set +# CONFIG_COMEDI is not set +# CONFIG_RTLLIB is not set +CONFIG_R8712U=m +# CONFIG_R8188EU is not set +CONFIG_VT6656=m + +# +# Speakup console speech +# +# CONFIG_SPEAKUP is not set +CONFIG_STAGING_MEDIA=y +CONFIG_DVB_MN88472=m +CONFIG_LIRC_STAGING=y +# CONFIG_LIRC_IMON is not set +CONFIG_LIRC_RPI=m +# CONFIG_LIRC_SASEM is not set +# CONFIG_LIRC_SERIAL is not set +# CONFIG_LIRC_SIR is not set +# CONFIG_LIRC_XBOX is not set +# CONFIG_LIRC_ZILOG is not set + +# +# Android +# +# CONFIG_STAGING_BOARD is not set +# CONFIG_LTE_GDM724X is not set +# CONFIG_LNET is not set +# CONFIG_GS_FPGABOOT is not set +# CONFIG_COMMON_CLK_XLNX_CLKWZRD is not set +# CONFIG_FB_TFT is not set +# CONFIG_WILC1000_SDIO is not set +# CONFIG_WILC1000_SPI is not set +# CONFIG_MOST is not set +# CONFIG_GOLDFISH is not set +# CONFIG_CHROME_PLATFORMS is not set +CONFIG_CLKDEV_LOOKUP=y +CONFIG_HAVE_CLK_PREPARE=y +CONFIG_COMMON_CLK=y + +# +# Common Clock Framework +# +# CONFIG_COMMON_CLK_SI5351 is not set +# CONFIG_COMMON_CLK_SI514 is not set +# CONFIG_COMMON_CLK_SI570 is not set +# CONFIG_COMMON_CLK_CDCE706 is not set +# CONFIG_COMMON_CLK_CDCE925 is not set +# CONFIG_COMMON_CLK_CS2000_CP is not set +# CONFIG_CLK_QORIQ is not set +# CONFIG_COMMON_CLK_NXP is not set +# CONFIG_COMMON_CLK_PXA is not set + +# +# Hardware Spinlock drivers +# + +# +# Clock Source drivers +# +CONFIG_CLKSRC_OF=y +CONFIG_CLKSRC_PROBE=y +CONFIG_CLKSRC_MMIO=y +# CONFIG_ARM_TIMER_SP804 is not set +# CONFIG_ATMEL_PIT is not set +# CONFIG_SH_TIMER_CMT is not set +# CONFIG_SH_TIMER_MTU2 is not set +# CONFIG_SH_TIMER_TMU is not set +# CONFIG_EM_TIMER_STI is not set +CONFIG_MAILBOX=y +# CONFIG_ARM_MHU is not set +# CONFIG_PL320_MBOX is not set +# CONFIG_ALTERA_MBOX is not set +CONFIG_BCM2835_MBOX=y +# CONFIG_MAILBOX_TEST is not set +# CONFIG_IOMMU_SUPPORT is not set + +# +# Remoteproc drivers +# +# CONFIG_STE_MODEM_RPROC is not set + +# +# Rpmsg drivers +# + +# +# SOC (System On Chip) specific Drivers +# +# CONFIG_SOC_BRCMSTB is not set +# CONFIG_SUNXI_SRAM is not set +# CONFIG_SOC_TI is not set +# CONFIG_PM_DEVFREQ is not set +CONFIG_EXTCON=m + +# +# Extcon Device Drivers +# +CONFIG_EXTCON_ARIZONA=m +# CONFIG_EXTCON_GPIO is not set +# CONFIG_EXTCON_MAX3355 is not set +# CONFIG_EXTCON_RT8973A is not set +# CONFIG_EXTCON_SM5502 is not set +# CONFIG_EXTCON_USB_GPIO is not set +# CONFIG_MEMORY is not set +# CONFIG_IIO is not set +# CONFIG_PWM is not set +CONFIG_IRQCHIP=y +CONFIG_ARM_GIC_MAX_NR=1 +# CONFIG_IPACK_BUS is not set +# CONFIG_RESET_CONTROLLER is not set +# CONFIG_FMC is not set + +# +# PHY Subsystem +# +# CONFIG_GENERIC_PHY is not set +# CONFIG_PHY_PXA_28NM_HSIC is not set +# CONFIG_PHY_PXA_28NM_USB2 is not set +# CONFIG_BCM_KONA_USB2_PHY is not set +# CONFIG_POWERCAP is not set +# CONFIG_MCB is not set + +# +# Performance monitor support +# +# CONFIG_RAS is not set + +# +# Android +# +# CONFIG_ANDROID is not set +# CONFIG_NVMEM is not set +# CONFIG_STM is not set +# CONFIG_INTEL_TH is not set + +# +# FPGA Configuration Support +# +# CONFIG_FPGA is not set + +# +# Firmware Drivers +# +# CONFIG_FIRMWARE_MEMMAP is not set +CONFIG_RASPBERRYPI_FIRMWARE=y +# CONFIG_FW_CFG_SYSFS is not set + +# +# File systems +# +CONFIG_DCACHE_WORD_ACCESS=y +# CONFIG_EXT2_FS is not set +# CONFIG_EXT3_FS is not set +CONFIG_EXT4_FS=y +CONFIG_EXT4_USE_FOR_EXT2=y +CONFIG_EXT4_FS_POSIX_ACL=y +CONFIG_EXT4_FS_SECURITY=y +# CONFIG_EXT4_ENCRYPTION is not set +# CONFIG_EXT4_DEBUG is not set +CONFIG_JBD2=y +# CONFIG_JBD2_DEBUG is not set +CONFIG_FS_MBCACHE=y +CONFIG_REISERFS_FS=m +# CONFIG_REISERFS_CHECK is not set +# CONFIG_REISERFS_PROC_INFO is not set +# CONFIG_REISERFS_FS_XATTR is not set +CONFIG_JFS_FS=m +# CONFIG_JFS_POSIX_ACL is not set +# CONFIG_JFS_SECURITY is not set +# CONFIG_JFS_DEBUG is not set +# CONFIG_JFS_STATISTICS is not set +CONFIG_XFS_FS=m +# CONFIG_XFS_QUOTA is not set +# CONFIG_XFS_POSIX_ACL is not set +# CONFIG_XFS_RT is not set +# CONFIG_XFS_WARN is not set +# CONFIG_XFS_DEBUG is not set +# CONFIG_GFS2_FS is not set +# CONFIG_OCFS2_FS is not set +CONFIG_BTRFS_FS=m +# CONFIG_BTRFS_FS_POSIX_ACL is not set +# CONFIG_BTRFS_FS_CHECK_INTEGRITY is not set +# CONFIG_BTRFS_FS_RUN_SANITY_TESTS is not set +# CONFIG_BTRFS_DEBUG is not set +# CONFIG_BTRFS_ASSERT is not set +# CONFIG_NILFS2_FS is not set +CONFIG_F2FS_FS=y +CONFIG_F2FS_STAT_FS=y +# CONFIG_F2FS_FS_XATTR is not set +CONFIG_F2FS_CHECK_FS=y +CONFIG_FS_POSIX_ACL=y +CONFIG_EXPORTFS=y +CONFIG_FILE_LOCKING=y +CONFIG_MANDATORY_FILE_LOCKING=y +# CONFIG_FS_ENCRYPTION is not set +CONFIG_FSNOTIFY=y +CONFIG_DNOTIFY=y +CONFIG_INOTIFY_USER=y +CONFIG_FANOTIFY=y +# CONFIG_QUOTA is not set +# CONFIG_QUOTACTL is not set +CONFIG_AUTOFS4_FS=y +CONFIG_FUSE_FS=m +# CONFIG_CUSE is not set +CONFIG_OVERLAY_FS=m + +# +# Caches +# +# CONFIG_FSCACHE is not set + +# +# CD-ROM/DVD Filesystems +# +CONFIG_ISO9660_FS=y +CONFIG_JOLIET=y +CONFIG_ZISOFS=y +CONFIG_UDF_FS=y +CONFIG_UDF_NLS=y + +# +# DOS/FAT/NT Filesystems +# +CONFIG_FAT_FS=y +# CONFIG_MSDOS_FS is not set +CONFIG_VFAT_FS=y +CONFIG_FAT_DEFAULT_CODEPAGE=437 +CONFIG_FAT_DEFAULT_IOCHARSET="ascii" +# CONFIG_FAT_DEFAULT_UTF8 is not set +# CONFIG_NTFS_FS is not set + +# +# Pseudo filesystems +# +CONFIG_PROC_FS=y +CONFIG_PROC_SYSCTL=y +CONFIG_PROC_PAGE_MONITOR=y +# CONFIG_PROC_CHILDREN is not set +CONFIG_KERNFS=y +CONFIG_SYSFS=y +CONFIG_TMPFS=y +CONFIG_TMPFS_POSIX_ACL=y +CONFIG_TMPFS_XATTR=y +# CONFIG_HUGETLB_PAGE is not set +CONFIG_CONFIGFS_FS=y +CONFIG_MISC_FILESYSTEMS=y +# CONFIG_ORANGEFS_FS is not set +# CONFIG_ADFS_FS is not set +# CONFIG_AFFS_FS is not set +# CONFIG_ECRYPT_FS is not set +CONFIG_HFS_FS=y +CONFIG_HFSPLUS_FS=y +# CONFIG_HFSPLUS_FS_POSIX_ACL is not set +# CONFIG_BEFS_FS is not set +# CONFIG_BFS_FS is not set +# CONFIG_EFS_FS is not set +# CONFIG_LOGFS is not set +# CONFIG_CRAMFS is not set +CONFIG_SQUASHFS=y +# CONFIG_SQUASHFS_FILE_CACHE is not set +CONFIG_SQUASHFS_FILE_DIRECT=y +# CONFIG_SQUASHFS_DECOMP_SINGLE is not set +# CONFIG_SQUASHFS_DECOMP_MULTI is not set +CONFIG_SQUASHFS_DECOMP_MULTI_PERCPU=y +# CONFIG_SQUASHFS_XATTR is not set +CONFIG_SQUASHFS_ZLIB=y +CONFIG_SQUASHFS_LZ4=y +CONFIG_SQUASHFS_LZO=y +CONFIG_SQUASHFS_XZ=y +# CONFIG_SQUASHFS_4K_DEVBLK_SIZE is not set +# CONFIG_SQUASHFS_EMBEDDED is not set +CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE=3 +# CONFIG_VXFS_FS is not set +# CONFIG_MINIX_FS is not set +# CONFIG_OMFS_FS is not set +# CONFIG_HPFS_FS is not set +# CONFIG_QNX4FS_FS is not set +# CONFIG_QNX6FS_FS is not set +# CONFIG_ROMFS_FS is not set +# CONFIG_PSTORE is not set +# CONFIG_SYSV_FS is not set +# CONFIG_UFS_FS is not set +CONFIG_NETWORK_FILESYSTEMS=y +CONFIG_NFS_FS=y +CONFIG_NFS_V2=y +CONFIG_NFS_V3=y +# CONFIG_NFS_V3_ACL is not set +CONFIG_NFS_V4=y +CONFIG_NFS_SWAP=y +CONFIG_NFS_V4_1=y +CONFIG_NFS_V4_2=y +CONFIG_PNFS_FILE_LAYOUT=y +CONFIG_PNFS_FLEXFILE_LAYOUT=m +CONFIG_NFS_V4_1_IMPLEMENTATION_ID_DOMAIN="kernel.org" +CONFIG_NFS_V4_1_MIGRATION=y +CONFIG_ROOT_NFS=y +# CONFIG_NFS_USE_LEGACY_DNS is not set +CONFIG_NFS_USE_KERNEL_DNS=y +# CONFIG_NFSD is not set +CONFIG_GRACE_PERIOD=y +CONFIG_LOCKD=y +CONFIG_LOCKD_V4=y +CONFIG_NFS_COMMON=y +CONFIG_SUNRPC=y +CONFIG_SUNRPC_GSS=y +CONFIG_SUNRPC_BACKCHANNEL=y +CONFIG_SUNRPC_SWAP=y +CONFIG_RPCSEC_GSS_KRB5=m +# CONFIG_SUNRPC_DEBUG is not set +# CONFIG_CEPH_FS is not set +CONFIG_CIFS=y +CONFIG_CIFS_STATS=y +CONFIG_CIFS_STATS2=y +# CONFIG_CIFS_WEAK_PW_HASH is not set +# CONFIG_CIFS_UPCALL is not set +# CONFIG_CIFS_XATTR is not set +# CONFIG_CIFS_DEBUG is not set +# CONFIG_CIFS_DFS_UPCALL is not set +# CONFIG_CIFS_SMB2 is not set +# CONFIG_NCP_FS is not set +# CONFIG_CODA_FS is not set +# CONFIG_AFS_FS is not set +CONFIG_NLS=y +CONFIG_NLS_DEFAULT="utf8" +CONFIG_NLS_CODEPAGE_437=y +# CONFIG_NLS_CODEPAGE_737 is not set +# CONFIG_NLS_CODEPAGE_775 is not set +# CONFIG_NLS_CODEPAGE_850 is not set +# CONFIG_NLS_CODEPAGE_852 is not set +# CONFIG_NLS_CODEPAGE_855 is not set +# CONFIG_NLS_CODEPAGE_857 is not set +# CONFIG_NLS_CODEPAGE_860 is not set +# CONFIG_NLS_CODEPAGE_861 is not set +# CONFIG_NLS_CODEPAGE_862 is not set +# CONFIG_NLS_CODEPAGE_863 is not set +# CONFIG_NLS_CODEPAGE_864 is not set +# CONFIG_NLS_CODEPAGE_865 is not set +# CONFIG_NLS_CODEPAGE_866 is not set +# CONFIG_NLS_CODEPAGE_869 is not set +# CONFIG_NLS_CODEPAGE_936 is not set +# CONFIG_NLS_CODEPAGE_950 is not set +# CONFIG_NLS_CODEPAGE_932 is not set +# CONFIG_NLS_CODEPAGE_949 is not set +# CONFIG_NLS_CODEPAGE_874 is not set +# CONFIG_NLS_ISO8859_8 is not set +# CONFIG_NLS_CODEPAGE_1250 is not set +# CONFIG_NLS_CODEPAGE_1251 is not set +CONFIG_NLS_ASCII=y +CONFIG_NLS_ISO8859_1=y +# CONFIG_NLS_ISO8859_2 is not set +# CONFIG_NLS_ISO8859_3 is not set +# CONFIG_NLS_ISO8859_4 is not set +# CONFIG_NLS_ISO8859_5 is not set +# CONFIG_NLS_ISO8859_6 is not set +# CONFIG_NLS_ISO8859_7 is not set +# CONFIG_NLS_ISO8859_9 is not set +# CONFIG_NLS_ISO8859_13 is not set +# CONFIG_NLS_ISO8859_14 is not set +# CONFIG_NLS_ISO8859_15 is not set +# CONFIG_NLS_KOI8_R is not set +# CONFIG_NLS_KOI8_U is not set +# CONFIG_NLS_MAC_ROMAN is not set +# CONFIG_NLS_MAC_CELTIC is not set +# CONFIG_NLS_MAC_CENTEURO is not set +# CONFIG_NLS_MAC_CROATIAN is not set +# CONFIG_NLS_MAC_CYRILLIC is not set +# CONFIG_NLS_MAC_GAELIC is not set +# CONFIG_NLS_MAC_GREEK is not set +# CONFIG_NLS_MAC_ICELAND is not set +# CONFIG_NLS_MAC_INUIT is not set +# CONFIG_NLS_MAC_ROMANIAN is not set +# CONFIG_NLS_MAC_TURKISH is not set +CONFIG_NLS_UTF8=y +# CONFIG_DLM is not set + +# +# Kernel hacking +# + +# +# printk and dmesg options +# +CONFIG_PRINTK_TIME=y +CONFIG_MESSAGE_LOGLEVEL_DEFAULT=4 +# CONFIG_BOOT_PRINTK_DELAY is not set +# CONFIG_DYNAMIC_DEBUG is not set + +# +# Compile-time checks and compiler options +# +# CONFIG_DEBUG_INFO is not set +CONFIG_ENABLE_WARN_DEPRECATED=y +CONFIG_ENABLE_MUST_CHECK=y +CONFIG_FRAME_WARN=1024 +CONFIG_STRIP_ASM_SYMS=y +# CONFIG_READABLE_ASM is not set +# CONFIG_UNUSED_SYMBOLS is not set +# CONFIG_PAGE_OWNER is not set +CONFIG_DEBUG_FS=y +# CONFIG_HEADERS_CHECK is not set +# CONFIG_DEBUG_SECTION_MISMATCH is not set +CONFIG_SECTION_MISMATCH_WARN_ONLY=y +CONFIG_FRAME_POINTER=y +# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set +CONFIG_MAGIC_SYSRQ=y +CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE=0x1 +CONFIG_DEBUG_KERNEL=y + +# +# Memory Debugging +# +# CONFIG_PAGE_EXTENSION is not set +# CONFIG_DEBUG_PAGEALLOC is not set +# CONFIG_PAGE_POISONING is not set +# CONFIG_DEBUG_OBJECTS is not set +# CONFIG_SLUB_DEBUG_ON is not set +# CONFIG_SLUB_STATS is not set +CONFIG_HAVE_DEBUG_KMEMLEAK=y +# CONFIG_DEBUG_KMEMLEAK is not set +# CONFIG_DEBUG_STACK_USAGE is not set +# CONFIG_DEBUG_VM is not set +# CONFIG_DEBUG_MEMORY_INIT is not set +# CONFIG_DEBUG_SHIRQ is not set + +# +# Debug Lockups and Hangs +# +CONFIG_LOCKUP_DETECTOR=y +# CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set +CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0 +# CONFIG_DETECT_HUNG_TASK is not set +# CONFIG_WQ_WATCHDOG is not set +# CONFIG_PANIC_ON_OOPS is not set +CONFIG_PANIC_ON_OOPS_VALUE=0 +CONFIG_PANIC_TIMEOUT=0 +# CONFIG_SCHED_DEBUG is not set +# CONFIG_SCHED_INFO is not set +# CONFIG_SCHEDSTATS is not set +# CONFIG_SCHED_STACK_END_CHECK is not set +# CONFIG_DEBUG_TIMEKEEPING is not set +# CONFIG_TIMER_STATS is not set + +# +# Lock Debugging (spinlocks, mutexes, etc...) +# +# CONFIG_DEBUG_RT_MUTEXES is not set +# CONFIG_DEBUG_SPINLOCK is not set +# CONFIG_DEBUG_MUTEXES is not set +# CONFIG_DEBUG_WW_MUTEX_SLOWPATH is not set +# CONFIG_DEBUG_LOCK_ALLOC is not set +# CONFIG_PROVE_LOCKING is not set +# CONFIG_LOCK_STAT is not set +# CONFIG_DEBUG_ATOMIC_SLEEP is not set +# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set +# CONFIG_LOCK_TORTURE_TEST is not set +# CONFIG_STACKTRACE is not set +# CONFIG_DEBUG_KOBJECT is not set +# CONFIG_DEBUG_BUGVERBOSE is not set +# CONFIG_DEBUG_LIST is not set +# CONFIG_DEBUG_PI_LIST is not set +# CONFIG_DEBUG_SG is not set +# CONFIG_DEBUG_NOTIFIERS is not set +# CONFIG_DEBUG_CREDENTIALS is not set + +# +# RCU Debugging +# +# CONFIG_PROVE_RCU is not set +# CONFIG_SPARSE_RCU_POINTER is not set +# CONFIG_TORTURE_TEST is not set +# CONFIG_RCU_TORTURE_TEST is not set +# CONFIG_RCU_TRACE is not set +# CONFIG_RCU_EQS_DEBUG is not set +# CONFIG_DEBUG_WQ_FORCE_RR_CPU is not set +# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set +# CONFIG_NOTIFIER_ERROR_INJECTION is not set +# CONFIG_FAULT_INJECTION is not set +# CONFIG_LATENCYTOP is not set +CONFIG_HAVE_FUNCTION_TRACER=y +CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y +CONFIG_HAVE_DYNAMIC_FTRACE=y +CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y +CONFIG_HAVE_SYSCALL_TRACEPOINTS=y +CONFIG_HAVE_C_RECORDMCOUNT=y +CONFIG_TRACING_SUPPORT=y +# CONFIG_FTRACE is not set + +# +# Runtime Testing +# +# CONFIG_LKDTM is not set +# CONFIG_TEST_LIST_SORT is not set +# CONFIG_BACKTRACE_SELF_TEST is not set +# CONFIG_RBTREE_TEST is not set +# CONFIG_INTERVAL_TREE_TEST is not set +# CONFIG_PERCPU_TEST is not set +# CONFIG_ATOMIC64_SELFTEST is not set +# CONFIG_TEST_HEXDUMP is not set +# CONFIG_TEST_STRING_HELPERS is not set +# CONFIG_TEST_KSTRTOX is not set +# CONFIG_TEST_PRINTF is not set +# CONFIG_TEST_BITMAP is not set +# CONFIG_TEST_RHASHTABLE is not set +# CONFIG_DMA_API_DEBUG is not set +# CONFIG_TEST_LKM is not set +# CONFIG_TEST_USER_COPY is not set +# CONFIG_TEST_BPF is not set +# CONFIG_TEST_FIRMWARE is not set +# CONFIG_TEST_UDELAY is not set +# CONFIG_MEMTEST is not set +# CONFIG_TEST_STATIC_KEYS is not set +# CONFIG_SAMPLES is not set +CONFIG_HAVE_ARCH_KGDB=y +# CONFIG_KGDB is not set +# CONFIG_UBSAN is not set +CONFIG_ARCH_HAS_DEVMEM_IS_ALLOWED=y +# CONFIG_STRICT_DEVMEM is not set +# CONFIG_ARM_PTDUMP is not set +# CONFIG_ARM_UNWIND is not set +# CONFIG_DEBUG_USER is not set +# CONFIG_DEBUG_LL is not set +CONFIG_DEBUG_LL_INCLUDE="mach/debug-macro.S" +# CONFIG_DEBUG_UART_8250 is not set +CONFIG_UNCOMPRESS_INCLUDE="mach/uncompress.h" +# CONFIG_PID_IN_CONTEXTIDR is not set +# CONFIG_DEBUG_SET_MODULE_RONX is not set +# CONFIG_CORESIGHT is not set + +# +# Security options +# +CONFIG_KEYS=y +# CONFIG_PERSISTENT_KEYRINGS is not set +# CONFIG_BIG_KEYS is not set +# CONFIG_ENCRYPTED_KEYS is not set +# CONFIG_SECURITY_DMESG_RESTRICT is not set +# CONFIG_SECURITY is not set +# CONFIG_SECURITYFS is not set +CONFIG_DEFAULT_SECURITY_DAC=y +CONFIG_DEFAULT_SECURITY="" +CONFIG_XOR_BLOCKS=m +CONFIG_CRYPTO=y + +# +# Crypto core or helper +# +CONFIG_CRYPTO_ALGAPI=y +CONFIG_CRYPTO_ALGAPI2=y +CONFIG_CRYPTO_AEAD=m +CONFIG_CRYPTO_AEAD2=y +CONFIG_CRYPTO_BLKCIPHER=y +CONFIG_CRYPTO_BLKCIPHER2=y +CONFIG_CRYPTO_HASH=y +CONFIG_CRYPTO_HASH2=y +CONFIG_CRYPTO_RNG=m +CONFIG_CRYPTO_RNG2=y +CONFIG_CRYPTO_RNG_DEFAULT=m +CONFIG_CRYPTO_AKCIPHER2=y +# CONFIG_CRYPTO_RSA is not set +CONFIG_CRYPTO_MANAGER=y +CONFIG_CRYPTO_MANAGER2=y +# CONFIG_CRYPTO_USER is not set +CONFIG_CRYPTO_MANAGER_DISABLE_TESTS=y +CONFIG_CRYPTO_GF128MUL=m +CONFIG_CRYPTO_NULL=m +CONFIG_CRYPTO_NULL2=y +CONFIG_CRYPTO_WORKQUEUE=y +# CONFIG_CRYPTO_CRYPTD is not set +# CONFIG_CRYPTO_MCRYPTD is not set +# CONFIG_CRYPTO_AUTHENC is not set +# CONFIG_CRYPTO_TEST is not set + +# +# Authenticated Encryption with Associated Data +# +CONFIG_CRYPTO_CCM=m +CONFIG_CRYPTO_GCM=m +# CONFIG_CRYPTO_CHACHA20POLY1305 is not set +CONFIG_CRYPTO_SEQIV=m +CONFIG_CRYPTO_ECHAINIV=m + +# +# Block modes +# +CONFIG_CRYPTO_CBC=m +CONFIG_CRYPTO_CTR=m +CONFIG_CRYPTO_CTS=m +CONFIG_CRYPTO_ECB=y +# CONFIG_CRYPTO_LRW is not set +# CONFIG_CRYPTO_PCBC is not set +# CONFIG_CRYPTO_XTS is not set +# CONFIG_CRYPTO_KEYWRAP is not set + +# +# Hash modes +# +CONFIG_CRYPTO_CMAC=y +CONFIG_CRYPTO_HMAC=y +# CONFIG_CRYPTO_XCBC is not set +# CONFIG_CRYPTO_VMAC is not set + +# +# Digest +# +CONFIG_CRYPTO_CRC32C=y +CONFIG_CRYPTO_CRC32=y +# CONFIG_CRYPTO_CRCT10DIF is not set +CONFIG_CRYPTO_GHASH=m +# CONFIG_CRYPTO_POLY1305 is not set +CONFIG_CRYPTO_MD4=y +CONFIG_CRYPTO_MD5=y +# CONFIG_CRYPTO_MICHAEL_MIC is not set +# CONFIG_CRYPTO_RMD128 is not set +# CONFIG_CRYPTO_RMD160 is not set +# CONFIG_CRYPTO_RMD256 is not set +# CONFIG_CRYPTO_RMD320 is not set +CONFIG_CRYPTO_SHA1=m +CONFIG_CRYPTO_SHA256=y +# CONFIG_CRYPTO_SHA512 is not set +# CONFIG_CRYPTO_TGR192 is not set +# CONFIG_CRYPTO_WP512 is not set + +# +# Ciphers +# +CONFIG_CRYPTO_AES=y +# CONFIG_CRYPTO_ANUBIS is not set +CONFIG_CRYPTO_ARC4=y +# CONFIG_CRYPTO_BLOWFISH is not set +# CONFIG_CRYPTO_CAMELLIA is not set +# CONFIG_CRYPTO_CAST5 is not set +# CONFIG_CRYPTO_CAST6 is not set +CONFIG_CRYPTO_DES=y +# CONFIG_CRYPTO_FCRYPT is not set +# CONFIG_CRYPTO_KHAZAD is not set +# CONFIG_CRYPTO_SALSA20 is not set +# CONFIG_CRYPTO_CHACHA20 is not set +# CONFIG_CRYPTO_SEED is not set +# CONFIG_CRYPTO_SERPENT is not set +# CONFIG_CRYPTO_TEA is not set +# CONFIG_CRYPTO_TWOFISH is not set + +# +# Compression +# +# CONFIG_CRYPTO_DEFLATE is not set +CONFIG_CRYPTO_LZO=m +# CONFIG_CRYPTO_842 is not set +# CONFIG_CRYPTO_LZ4 is not set +# CONFIG_CRYPTO_LZ4HC is not set + +# +# Random Number Generation +# +# CONFIG_CRYPTO_ANSI_CPRNG is not set +CONFIG_CRYPTO_DRBG_MENU=m +CONFIG_CRYPTO_DRBG_HMAC=y +# CONFIG_CRYPTO_DRBG_HASH is not set +# CONFIG_CRYPTO_DRBG_CTR is not set +CONFIG_CRYPTO_DRBG=m +CONFIG_CRYPTO_JITTERENTROPY=m +# CONFIG_CRYPTO_USER_API_HASH is not set +# CONFIG_CRYPTO_USER_API_SKCIPHER is not set +# CONFIG_CRYPTO_USER_API_RNG is not set +# CONFIG_CRYPTO_USER_API_AEAD is not set +# CONFIG_CRYPTO_HW is not set +# CONFIG_ASYMMETRIC_KEY_TYPE is not set + +# +# Certificates for signature checking +# +# CONFIG_SYSTEM_TRUSTED_KEYRING is not set +CONFIG_ARM_CRYPTO=y +CONFIG_CRYPTO_SHA1_ARM=m +CONFIG_CRYPTO_SHA256_ARM=m +# CONFIG_CRYPTO_SHA512_ARM is not set +CONFIG_CRYPTO_AES_ARM=m +# CONFIG_BINARY_PRINTF is not set + +# +# Library routines +# +CONFIG_RAID6_PQ=m +CONFIG_BITREVERSE=y +# CONFIG_HAVE_ARCH_BITREVERSE is not set +CONFIG_RATIONAL=y +CONFIG_GENERIC_STRNCPY_FROM_USER=y +CONFIG_GENERIC_STRNLEN_USER=y +CONFIG_GENERIC_NET_UTILS=y +CONFIG_GENERIC_PCI_IOMAP=y +CONFIG_GENERIC_IO=y +CONFIG_ARCH_USE_CMPXCHG_LOCKREF=y +CONFIG_CRC_CCITT=m +CONFIG_CRC16=y +# CONFIG_CRC_T10DIF is not set +CONFIG_CRC_ITU_T=y +CONFIG_CRC32=y +# CONFIG_CRC32_SELFTEST is not set +CONFIG_CRC32_SLICEBY8=y +# CONFIG_CRC32_SLICEBY4 is not set +# CONFIG_CRC32_SARWATE is not set +# CONFIG_CRC32_BIT is not set +# CONFIG_CRC7 is not set +CONFIG_LIBCRC32C=m +# CONFIG_CRC8 is not set +# CONFIG_AUDIT_ARCH_COMPAT_GENERIC is not set +# CONFIG_RANDOM32_SELFTEST is not set +CONFIG_ZLIB_INFLATE=y +CONFIG_ZLIB_DEFLATE=m +CONFIG_LZO_COMPRESS=y +CONFIG_LZO_DECOMPRESS=y +CONFIG_LZ4_DECOMPRESS=y +CONFIG_XZ_DEC=y +# CONFIG_XZ_DEC_X86 is not set +# CONFIG_XZ_DEC_POWERPC is not set +# CONFIG_XZ_DEC_IA64 is not set +# CONFIG_XZ_DEC_ARM is not set +# CONFIG_XZ_DEC_ARMTHUMB is not set +# CONFIG_XZ_DEC_SPARC is not set +# CONFIG_XZ_DEC_BCJ is not set +# CONFIG_XZ_DEC_TEST is not set +CONFIG_DECOMPRESS_GZIP=y +CONFIG_GENERIC_ALLOCATOR=y +CONFIG_ASSOCIATIVE_ARRAY=y +CONFIG_HAS_IOMEM=y +CONFIG_HAS_IOPORT_MAP=y +CONFIG_HAS_DMA=y +CONFIG_DQL=y +CONFIG_NLATTR=y +CONFIG_GENERIC_ATOMIC64=y +CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE=y +# CONFIG_CORDIC is not set +# CONFIG_DDR is not set +# CONFIG_IRQ_POLL is not set +CONFIG_LIBFDT=y +CONFIG_OID_REGISTRY=y +CONFIG_FONT_SUPPORT=y +# CONFIG_FONTS is not set +CONFIG_FONT_8x8=y +CONFIG_FONT_8x16=y +# CONFIG_SG_SPLIT is not set +# CONFIG_ARCH_HAS_SG_CHAIN is not set +# CONFIG_VIRTUALIZATION is not set +CONFIG_BCM2835_WS2812=m +CONFIG_SND_BCM2708_SOC_SLICE=m +CONFIG_SND_SOC_CS4265=m diff --git a/projects/Slice/options b/projects/Slice/options new file mode 100644 index 00000000000..e45d32a7f9a --- /dev/null +++ b/projects/Slice/options @@ -0,0 +1,151 @@ +################################################################################ +# setup system defaults +################################################################################ + + # The TARGET_CPU variable controls which processor should be targeted for + # generated code. + case $TARGET_ARCH in + arm) + # TARGET_CPU: + # arm2 arm250 arm3 arm6 arm60 arm600 arm610 arm620 arm7 arm7m arm7d + # arm7dm arm7di arm7dmi arm70 arm700 arm700i arm710 arm710c + # arm7100 arm720 arm7500 arm7500fe arm7tdmi arm7tdmi-s arm710t + # arm720t arm740t strongarm strongarm110 strongarm1100 + # strongarm1110 arm8 arm810 arm9 arm9e arm920 arm920t arm922t + # arm946e-s arm966e-s arm968e-s arm926ej-s arm940t arm9tdmi + # arm10tdmi arm1020t arm1026ej-s arm10e arm1020e arm1022e + # arm1136j-s arm1136jf-s mpcore mpcorenovfp arm1156t2-s + # arm1176jz-s arm1176jzf-s cortex-a8 cortex-a9 cortex-r4 + # cortex-r4f cortex-m3 cortex-m1 xscale iwmmxt iwmmxt2 ep9312. + TARGET_CPU="arm1176jzf-s" + + # TARGET_FLOAT: + # Specifies which floating-point ABI to use. Permissible values are: + # soft softfp hard + TARGET_FLOAT="hard" + + # TARGET_FPU: + # This specifies what floating point hardware (or hardware emulation) is + # available on the target. Permissible names are: + # fpa fpe2 fpe3 maverick vfp vfpv3 vfpv3-fp16 vfpv3-d16 vfpv3-d16-fp16 + # vfpv3xd vfpv3xd-fp16 neon neon-fp16 vfpv4 vfpv4-d16 fpv4-sp-d16 + # neon-vfpv4. + TARGET_FPU="vfp" + ;; + esac + + # Bootloader to use (syslinux / u-boot / bcm2835-bootloader) + BOOTLOADER="bcm2835-bootloader" + + # u-boot version to use (default) + UBOOT_VERSION="default" + + # Configuration for u-boot + UBOOT_CONFIG="" + + # Target Configfile for u-boot + UBOOT_CONFIGFILE="" + + # Kernel target + KERNEL_TARGET="zImage" + + # Kernel extra targets to build + KERNEL_UBOOT_EXTRA_TARGET="" + + # Additional kernel make parameters (for example to specify the u-boot loadaddress) + KERNEL_MAKE_EXTRACMD="dtbs" + + # Kernel to use. values can be: + # default: default mainline kernel + LINUX="default" + + # NOOBS supported hex versions (legacy) + NOOBS_HEX="2,3,4,5,6,7,8,9,d,e,f,10,11,12,14,19,0092,0093" + + # NOOBS supported model versions + NOOBS_SUPPORTED_MODELS='"Pi Model","Pi Compute Module","Pi Zero"' + +################################################################################ +# setup build defaults +################################################################################ + + # Build optimizations (size/normal) + OPTIMIZATIONS="size" + + # Project CFLAGS + PROJECT_CFLAGS="" + + # LTO (Link Time Optimization) support + LTO_SUPPORT="yes" + + # GOLD (Google Linker) support + GOLD_SUPPORT="yes" + + # SquashFS compression method (gzip / lzo / xz) + SQUASHFS_COMPRESSION="lzo" + + +################################################################################ +# setup project defaults +################################################################################ + + # build and install ALSA Audio support (yes / no) + ALSA_SUPPORT="yes" + + # OpenGL(X) implementation to use (no / mesa) + OPENGL="no" + + # OpenGL-ES implementation to use (no / bcm2835-driver / gpu-viv-bin-mx6q) + OPENGLES="bcm2835-driver" + + # include uvesafb support (yes / no) + UVESAFB_SUPPORT="no" + + # Displayserver to use (x11 / no) + DISPLAYSERVER="no" + + # Windowmanager to use (ratpoison / fluxbox / none) + WINDOWMANAGER="none" + + # Xorg Graphic drivers to use (all / i915,i965,r200,r300,r600,nvidia) + # Space separated list is supported, + # e.g. GRAPHIC_DRIVERS="i915 i965 r300 r600 radeonsi nvidia" + GRAPHIC_DRIVERS="" + + # KODI Player implementation to use (default / bcm2835-driver / libfslvpuwrap) + KODIPLAYER_DRIVER="bcm2835-driver" + + # Modules to install in initramfs for early boot + INITRAMFS_MODULES="" + + # additional Firmware to use (dvb-firmware, misc-firmware, wlan-firmware) + # Space separated list is supported, + # e.g. FIRMWARE="dvb-firmware misc-firmware wlan-firmware" + FIRMWARE="misc-firmware wlan-firmware dvb-firmware" + + # build and install ATV IR remote support (yes / no) + ATVCLIENT_SUPPORT="no" + + # build and install IRServer IR/LCD support (yes / no) + IRSERVER_SUPPORT="no" + + # build with swap support (yes / no) + SWAP_SUPPORT="yes" + + # swap support enabled per default (yes / no) + SWAP_ENABLED_DEFAULT="no" + + # swapfile size if SWAP_SUPPORT=yes in MB + SWAPFILESIZE="128" + + # build with installer (yes / no) + INSTALLER_SUPPORT="no" + + # kernel image name + KERNEL_NAME="kernel.img" + + # additional drivers to install: + # for a list of additinoal drivers see packages/linux-drivers + # Space separated list is supported, + # e.g. ADDITIONAL_DRIVERS="DRIVER1 DRIVER2" + ADDITIONAL_DRIVERS="$ADDITIONAL_DRIVERS" diff --git a/projects/Slice/patches/kodi/kodi-003-slice-led.patch b/projects/Slice/patches/kodi/kodi-003-slice-led.patch new file mode 100644 index 00000000000..21ee3ab3b0e --- /dev/null +++ b/projects/Slice/patches/kodi/kodi-003-slice-led.patch @@ -0,0 +1,950 @@ +diff -ruN kodi-16.0-beta5-19fc4fa/xbmc/windows/GUIWindowHome.cpp kodi-16.0-beta5-19fc4fa-new/xbmc/windows/GUIWindowHome.cpp +--- kodi-16.0-beta5-19fc4fa/xbmc/windows/GUIWindowHome.cpp 2015-12-14 23:07:12.000000000 +0000 ++++ kodi-16.0-beta5-19fc4fa-new/xbmc/windows/GUIWindowHome.cpp 2016-01-08 06:51:31.177652775 +0000 +@@ -30,9 +30,243 @@ + #include "guilib/GUIWindowManager.h" + #include "Application.h" + #include "utils/StringUtils.h" ++extern "C" ++{ ++ #include "readpng.h" ++} + + using namespace ANNOUNCEMENT; + ++int g_pattern = 0; ++int g_halt = 0; ++int g_pattern_playing = 0; ++int g_speed = 30000; ++int g_repeat = 0; ++ ++enum pattern_e { ++ PAT_PLAY, PAT_PAUSE, PAT_STOP, PAT_SLEEP, PAT_WAKE, PAT_FFWD, PAT_REW, PAT_SKIPF, PAT_SKIPR, PAT_STARTUP, PAT_NONE ++}; ++#define NUM_PATTERNS 10 ++const char *patterns[NUM_PATTERNS] = { ++ "play" , "pause", "stop", "sleep", "wake", "ffwd", "rew", "skipf", "skipr", "startup" ++}; ++ ++void on_speed_changed(const char *message, const CVariant &data) ++{ ++ int speed = data["player"]["speed"].asInteger(); ++ ++ CLog::Log(LOGDEBUG, "speed changed %d", speed); ++ ++ switch(abs(speed)) ++ { ++ case 1: g_speed = 60000; break; ++ case 2: g_speed = 40000; break; ++ case 4: g_speed = 35000; break; ++ case 8: g_speed = 30000; break; ++ case 16: g_speed = 25000; break; ++ case 32: g_speed = 15000; break; ++ } ++ ++ if(speed > 0) ++ g_pattern = PAT_FFWD; ++ else ++ g_pattern = PAT_REW; ++ ++ if(speed != 1) ++ g_repeat = 1; ++ else ++ { ++ g_repeat = 0; ++ g_pattern = PAT_NONE; ++ } ++} ++ ++void on_seek(const char *message, const CVariant &data) ++{ ++ int seek_time = data["player"]["seekoffset"]["seconds"].asInteger() + ++ data["player"]["seekoffset"]["minutes"].asInteger() * 60; ++ ++ CLog::Log(LOGDEBUG, "Seek offset = %d", seek_time); ++ if(seek_time > 0) ++ { ++ g_pattern = PAT_SKIPF; ++ } ++ else ++ { ++ g_pattern = PAT_SKIPR; ++ } ++ ++ g_repeat = 0; ++} ++ ++enum action_e { ++ ACTION_DO, ACTION_FN ++ }; ++ ++enum led_state_e { ++ LED_STATE_INVALID = 0, ++ LED_STATE_IDLE, ++ LED_STATE_PLAYING, ++ LED_STATE_PAUSED, ++ LED_STATE_SLEEP ++}; ++ ++struct led_action_s { ++ const char * event_name; ++ enum action_e action; ++ enum pattern_e action_data; ++ void (*action_fn)(const char *, const CVariant &); ++ led_state_e action_state; ++} led_actions[] = { ++ { "OnPlay", ACTION_DO, PAT_PLAY, NULL, LED_STATE_PLAYING }, ++ { "OnPause", ACTION_DO, PAT_PAUSE, NULL, LED_STATE_PAUSED }, ++ { "OnStop", ACTION_DO, PAT_STOP, NULL, LED_STATE_IDLE }, ++ { "OnSpeedChanged", ACTION_FN, PAT_NONE, on_speed_changed, LED_STATE_INVALID }, ++ { "OnSeek", ACTION_FN, PAT_NONE, on_seek, LED_STATE_INVALID }, ++ { "OnScreensaverActivated", ACTION_DO, PAT_SLEEP, NULL, LED_STATE_SLEEP }, ++ { "OnScreensaverDeactivated", ACTION_DO, PAT_WAKE, NULL, LED_STATE_IDLE }, ++}; ++ ++int zeroes[25] = { 0,}; ++ ++class CLedPattern : public IRunnable ++{ ++ int m_going; ++ CEvent *m_ev; ++ struct pattern { ++ unsigned long w; ++ unsigned long h; ++ unsigned long rowbytes; ++ unsigned char * img; ++ } m_pattern[NUM_PATTERNS]; ++ ++ void open_patterns() ++ { ++ unsigned int i; ++ for(i = 0; i < sizeof(patterns)/sizeof(patterns[0]); i++) ++ { ++ FILE * fp; ++ char filename[256]; ++ int channels; ++ ++ m_pattern[i].img = NULL; ++ sprintf(filename, "/storage/.kodi/media/ledpatterns/%s.png", patterns[i]); ++ fp = fopen(filename , "rb"); ++ if(fp == NULL) ++ { ++ sprintf(filename, "/usr/share/kodi/media/ledpatterns/%s.png", patterns[i]); ++ fp = fopen(filename, "rb"); ++ if(fp == NULL) ++ { ++ CLog::Log(LOGDEBUG, "Unable to open file %s", filename); ++ goto drop_out; ++ } ++ } ++ ++ if(readpng_init(fp, &m_pattern[i].w, &m_pattern[i].h) != 0) ++ { ++ CLog::Log(LOGERROR, "Unable to parse png files %s", filename); ++ goto drop_out; ++ } ++ ++ m_pattern[i].img = readpng_get_image(1.0, &channels, &m_pattern[i].rowbytes); ++ if(m_pattern[i].img == NULL || channels != 4) ++ { ++ CLog::Log(LOGERROR, "Invalid png %s, width = %lu, height = %lu, channels = %d, rowbytes = %lu", ++ filename, m_pattern[i].w, m_pattern[i].h, channels, m_pattern[i].rowbytes); ++ goto drop_out; ++ } ++ ++ CLog::Log(LOGDEBUG, "Opened %s: (%lu x %lu)", filename, m_pattern[i].w, m_pattern[i].h); ++ ++drop_out: ++ if(fp) ++ fclose(fp); ++ ++ } ++ } ++ ++ void play_pattern(int pat) ++ { ++ int fd = open("/dev/ws2812", O_WRONLY, 0); ++ if(fd < 0) ++ { ++ CLog::Log(LOGERROR, "Unable to open /dev/ws2812"); ++ } ++ else ++ { ++ if(pat < PAT_NONE && m_pattern[pat].img != NULL) ++ { ++ CLog::Log(LOGDEBUG, "playing pattern"); ++ g_pattern_playing = 1; ++ do ++ { ++ unsigned char * p_line = m_pattern[pat].img; ++ unsigned int i; ++ ++ for(i = 0; i < m_pattern[pat].h; i++) ++ { ++ write(fd, p_line, m_pattern[pat].w * 4); ++ if(m_pattern[pat].w == 26) ++ { ++ int *p = (int *) (p_line + (25 * 4)); ++ usleep(*p); ++ } ++ else ++ { ++ usleep(g_speed); ++ } ++ p_line += m_pattern[pat].rowbytes; ++ // If we get the g_halt signal then stop repeating ++ // the pattern ++ if(g_halt) ++ { ++ g_halt = 0; ++ g_repeat = 0; ++ break; ++ } ++ } ++ p_line += m_pattern[pat].rowbytes; ++ } ++ while(g_repeat); ++ g_pattern_playing = 0; ++ ++ write(fd, zeroes, sizeof(zeroes)); ++ } ++ else ++ { ++ CLog::Log(LOGDEBUG, "No img for LED pattern %d", pat); ++ } ++ close(fd); ++ } ++ } ++ ++public: ++ CLedPattern(CEvent *ev) ++ { ++ CLog::Log(LOGDEBUG, "Initialising CLedPattern"); ++ open_patterns(); ++ m_ev = ev; ++ } ++ ++ void Run() ++ { ++ m_going = 1; ++ while(m_going) ++ { ++ m_ev->Wait(); ++ CLog::Log(LOGDEBUG, "Led Pattern %d triggered", g_pattern); ++ play_pattern(g_pattern); ++ } ++ } ++ ++ void Stop() ++ { ++ m_going = 0; ++ m_ev->Set(); ++ } ++}; ++ + CGUIWindowHome::CGUIWindowHome(void) : CGUIWindow(WINDOW_HOME, "Home.xml"), + m_recentlyAddedRunning(false), + m_cumulativeUpdateFlag(0) +@@ -40,6 +274,14 @@ + m_updateRA = (Audio | Video | Totals); + m_loadType = KEEP_IN_MEMORY; + ++ m_ledevent = new CEvent(); ++ m_ledthread = new CThread(new CLedPattern(m_ledevent), "LedThread"); ++ m_ledthread->Create(); ++ g_pattern = PAT_STARTUP; ++ g_speed = 30000; ++ g_repeat = 0; ++ m_ledevent->Set(); ++ + CAnnouncementManager::GetInstance().AddAnnouncer(this); + } + +@@ -75,10 +317,48 @@ + + void CGUIWindowHome::Announce(AnnouncementFlag flag, const char *sender, const char *message, const CVariant &data) + { ++ unsigned int i; + int ra_flag = 0; + + CLog::Log(LOGDEBUG, "GOT ANNOUNCEMENT, type: %i, from %s, message %s",(int)flag, sender, message); + ++ for(i = 0; i < sizeof(led_actions)/sizeof(led_actions[0]); i++) ++ { ++ if(strcmp(message, led_actions[i].event_name) == 0) ++ { ++ switch(led_actions[i].action) { ++ case ACTION_DO: ++ { ++ g_halt = 1; ++ while(g_pattern_playing) ++ usleep(10); ++ g_halt = 0; ++ g_repeat = 0; ++ g_speed = 30000; ++ g_pattern = (int) led_actions[i].action_data; ++ m_ledevent->Set(); ++ break; ++ } ++ case ACTION_FN: ++ { ++ g_halt = 1; ++ while(g_pattern_playing) ++ usleep(10); ++ g_halt = 0; ++ g_repeat = 0; ++ g_speed = 30000; ++ led_actions[i].action_fn(message, data); ++ m_ledevent->Set(); ++ break; ++ } ++ default: ++ { ++ CLog::Log(LOGERROR, "Failed to execute LED action %d for event %s\n", i, led_actions[i].event_name); ++ } ++ } ++ } ++ } ++ + // we are only interested in library changes + if ((flag & (VideoLibrary | AudioLibrary)) == 0) + return; +diff -ruN kodi-16.0-beta5-19fc4fa/xbmc/windows/GUIWindowHome.cpp.orig kodi-16.0-beta5-19fc4fa-new/xbmc/windows/GUIWindowHome.cpp.orig +--- kodi-16.0-beta5-19fc4fa/xbmc/windows/GUIWindowHome.cpp.orig 1970-01-01 00:00:00.000000000 +0000 ++++ kodi-16.0-beta5-19fc4fa-new/xbmc/windows/GUIWindowHome.cpp.orig 2016-01-08 06:49:23.757652775 +0000 +@@ -0,0 +1,182 @@ ++/* ++ * Copyright (C) 2005-2013 Team XBMC ++ * http://xbmc.org ++ * ++ * This Program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2, or (at your option) ++ * any later version. ++ * ++ * This Program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with XBMC; see the file COPYING. If not, see ++ * <http://www.gnu.org/licenses/>. ++ * ++ */ ++ ++#include "GUIWindowHome.h" ++#include "input/Key.h" ++#include "guilib/WindowIDs.h" ++#include "utils/JobManager.h" ++#include "utils/RecentlyAddedJob.h" ++#include "interfaces/AnnouncementManager.h" ++#include "utils/log.h" ++#include "settings/AdvancedSettings.h" ++#include "utils/Variant.h" ++#include "guilib/GUIWindowManager.h" ++#include "Application.h" ++#include "utils/StringUtils.h" ++ ++using namespace ANNOUNCEMENT; ++ ++CGUIWindowHome::CGUIWindowHome(void) : CGUIWindow(WINDOW_HOME, "Home.xml"), ++ m_recentlyAddedRunning(false), ++ m_cumulativeUpdateFlag(0) ++{ ++ m_updateRA = (Audio | Video | Totals); ++ m_loadType = KEEP_IN_MEMORY; ++ ++ CAnnouncementManager::GetInstance().AddAnnouncer(this); ++} ++ ++CGUIWindowHome::~CGUIWindowHome(void) ++{ ++ CAnnouncementManager::GetInstance().RemoveAnnouncer(this); ++} ++ ++bool CGUIWindowHome::OnAction(const CAction &action) ++{ ++ static unsigned int min_hold_time = 1000; ++ if (action.GetID() == ACTION_NAV_BACK && ++ action.GetHoldTime() < min_hold_time && ++ g_application.m_pPlayer->IsPlaying()) ++ { ++ g_application.SwitchToFullScreen(); ++ return true; ++ } ++ return CGUIWindow::OnAction(action); ++} ++ ++void CGUIWindowHome::OnInitWindow() ++{ ++ // for shared databases (ie mysql) always force an update on return to home ++ // this is a temporary solution until remote announcements can be delivered ++ if (StringUtils::EqualsNoCase(g_advancedSettings.m_databaseVideo.type, "mysql") || ++ StringUtils::EqualsNoCase(g_advancedSettings.m_databaseMusic.type, "mysql") ) ++ m_updateRA = (Audio | Video | Totals); ++ AddRecentlyAddedJobs( m_updateRA ); ++ ++ CGUIWindow::OnInitWindow(); ++} ++ ++void CGUIWindowHome::Announce(AnnouncementFlag flag, const char *sender, const char *message, const CVariant &data) ++{ ++ int ra_flag = 0; ++ ++ CLog::Log(LOGDEBUG, "GOT ANNOUNCEMENT, type: %i, from %s, message %s",(int)flag, sender, message); ++ ++ // we are only interested in library changes ++ if ((flag & (VideoLibrary | AudioLibrary)) == 0) ++ return; ++ ++ if (data.isMember("transaction") && data["transaction"].asBoolean()) ++ return; ++ ++ if (strcmp(message, "OnScanStarted") == 0 || ++ strcmp(message, "OnCleanStarted") == 0) ++ return; ++ ++ bool onUpdate = strcmp(message, "OnUpdate") == 0; ++ // always update Totals except on an OnUpdate with no playcount update ++ if (!onUpdate || data.isMember("playcount")) ++ ra_flag |= Totals; ++ ++ // always update the full list except on an OnUpdate ++ if (!onUpdate) ++ { ++ if (flag & VideoLibrary) ++ ra_flag |= Video; ++ else if (flag & AudioLibrary) ++ ra_flag |= Audio; ++ } ++ ++ CGUIMessage reload(GUI_MSG_NOTIFY_ALL, GetID(), 0, GUI_MSG_REFRESH_THUMBS, ra_flag); ++ g_windowManager.SendThreadMessage(reload, GetID()); ++} ++ ++void CGUIWindowHome::AddRecentlyAddedJobs(int flag) ++{ ++ bool getAJob = false; ++ ++ // this block checks to see if another one is running ++ // and keeps track of the flag ++ { ++ CSingleLock lockMe(*this); ++ if (!m_recentlyAddedRunning) ++ { ++ getAJob = true; ++ ++ flag |= m_cumulativeUpdateFlag; // add the flags from previous calls to AddRecentlyAddedJobs ++ ++ m_cumulativeUpdateFlag = 0; // now taken care of in flag. ++ // reset this since we're going to execute a job ++ ++ // we're about to add one so set the indicator ++ if (flag) ++ m_recentlyAddedRunning = true; // this will happen in the if clause below ++ } ++ else ++ // since we're going to skip a job, mark that one came in and ... ++ m_cumulativeUpdateFlag |= flag; // this will be used later ++ } ++ ++ if (flag && getAJob) ++ CJobManager::GetInstance().AddJob(new CRecentlyAddedJob(flag), this); ++ ++ m_updateRA = 0; ++} ++ ++void CGUIWindowHome::OnJobComplete(unsigned int jobID, bool success, CJob *job) ++{ ++ int flag = 0; ++ ++ { ++ CSingleLock lockMe(*this); ++ ++ // the job is finished. ++ // did one come in in the meantime? ++ flag = m_cumulativeUpdateFlag; ++ m_recentlyAddedRunning = false; /// we're done. ++ } ++ ++ if (flag) ++ AddRecentlyAddedJobs(0 /* the flag will be set inside AddRecentlyAddedJobs via m_cumulativeUpdateFlag */ ); ++} ++ ++ ++bool CGUIWindowHome::OnMessage(CGUIMessage& message) ++{ ++ switch ( message.GetMessage() ) ++ { ++ case GUI_MSG_NOTIFY_ALL: ++ if (message.GetParam1() == GUI_MSG_WINDOW_RESET || message.GetParam1() == GUI_MSG_REFRESH_THUMBS) ++ { ++ int updateRA = (message.GetSenderId() == GetID()) ? message.GetParam2() : (Video | Audio | Totals); ++ ++ if (IsActive()) ++ AddRecentlyAddedJobs(updateRA); ++ else ++ m_updateRA |= updateRA; ++ } ++ break; ++ ++ default: ++ break; ++ } ++ ++ return CGUIWindow::OnMessage(message); ++} +diff -ruN kodi-16.0-beta5-19fc4fa/xbmc/windows/GUIWindowHome.h kodi-16.0-beta5-19fc4fa-new/xbmc/windows/GUIWindowHome.h +--- kodi-16.0-beta5-19fc4fa/xbmc/windows/GUIWindowHome.h 2015-12-14 23:07:12.000000000 +0000 ++++ kodi-16.0-beta5-19fc4fa-new/xbmc/windows/GUIWindowHome.h 2016-01-08 06:49:51.049652775 +0000 +@@ -23,6 +23,8 @@ + #include "guilib/GUIWindow.h" + #include "interfaces/IAnnouncer.h" + #include "utils/Job.h" ++#include "threads/Thread.h" ++#include "threads/Event.h" + + class CVariant; + +@@ -47,4 +49,7 @@ + + bool m_recentlyAddedRunning; + int m_cumulativeUpdateFlag; ++ ++ CThread *m_ledthread; ++ CEvent *m_ledevent; + }; +diff -ruN kodi-16.0-beta5-19fc4fa/xbmc/windows/GUIWindowHome.h.orig kodi-16.0-beta5-19fc4fa-new/xbmc/windows/GUIWindowHome.h.orig +--- kodi-16.0-beta5-19fc4fa/xbmc/windows/GUIWindowHome.h.orig 1970-01-01 00:00:00.000000000 +0000 ++++ kodi-16.0-beta5-19fc4fa-new/xbmc/windows/GUIWindowHome.h.orig 2016-01-08 06:49:23.757652775 +0000 +@@ -0,0 +1,50 @@ ++#pragma once ++ ++/* ++ * Copyright (C) 2005-2013 Team XBMC ++ * http://xbmc.org ++ * ++ * This Program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2, or (at your option) ++ * any later version. ++ * ++ * This Program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with XBMC; see the file COPYING. If not, see ++ * <http://www.gnu.org/licenses/>. ++ * ++ */ ++ ++#include "guilib/GUIWindow.h" ++#include "interfaces/IAnnouncer.h" ++#include "utils/Job.h" ++ ++class CVariant; ++ ++class CGUIWindowHome : ++ public CGUIWindow, ++ public ANNOUNCEMENT::IAnnouncer, ++ public IJobCallback ++{ ++public: ++ CGUIWindowHome(void); ++ virtual ~CGUIWindowHome(void); ++ virtual void OnInitWindow(); ++ virtual void Announce(ANNOUNCEMENT::AnnouncementFlag flag, const char *sender, const char *message, const CVariant &data); ++ ++ virtual bool OnMessage(CGUIMessage& message); ++ virtual bool OnAction(const CAction &action); ++ ++ virtual void OnJobComplete(unsigned int jobID, bool success, CJob *job); ++private: ++ int m_updateRA; // flag for which recently added items needs to be queried ++ void AddRecentlyAddedJobs(int flag); ++ ++ bool m_recentlyAddedRunning; ++ int m_cumulativeUpdateFlag; ++}; +diff -ruN kodi-16.0-beta5-19fc4fa/xbmc/windows/Makefile kodi-16.0-beta5-19fc4fa-new/xbmc/windows/Makefile +--- kodi-16.0-beta5-19fc4fa/xbmc/windows/Makefile 2015-12-14 23:07:12.000000000 +0000 ++++ kodi-16.0-beta5-19fc4fa-new/xbmc/windows/Makefile 2016-01-08 06:49:51.049652775 +0000 +@@ -10,6 +10,7 @@ + GUIWindowStartup.cpp \ + GUIWindowSystemInfo.cpp \ + GUIWindowWeather.cpp \ ++ readpng.c + + LIB=windows.a + +diff -ruN kodi-16.0-beta5-19fc4fa/xbmc/windows/Makefile.orig kodi-16.0-beta5-19fc4fa-new/xbmc/windows/Makefile.orig +--- kodi-16.0-beta5-19fc4fa/xbmc/windows/Makefile.orig 1970-01-01 00:00:00.000000000 +0000 ++++ kodi-16.0-beta5-19fc4fa-new/xbmc/windows/Makefile.orig 2016-01-08 06:49:23.757652775 +0000 +@@ -0,0 +1,17 @@ ++SRCS=GUIMediaWindow.cpp \ ++ GUIWindowDebugInfo.cpp \ ++ GUIWindowFileManager.cpp \ ++ GUIWindowHome.cpp \ ++ GUIWindowLoginScreen.cpp \ ++ GUIWindowPointer.cpp \ ++ GUIWindowScreensaver.cpp \ ++ GUIWindowScreensaverDim.cpp \ ++ GUIWindowSplash.cpp \ ++ GUIWindowStartup.cpp \ ++ GUIWindowSystemInfo.cpp \ ++ GUIWindowWeather.cpp \ ++ ++LIB=windows.a ++ ++include ../../Makefile.include ++-include $(patsubst %.cpp,%.P,$(patsubst %.c,%.P,$(SRCS))) +diff -ruN kodi-16.0-beta5-19fc4fa/xbmc/windows/readpng.c kodi-16.0-beta5-19fc4fa-new/xbmc/windows/readpng.c +--- kodi-16.0-beta5-19fc4fa/xbmc/windows/readpng.c 1970-01-01 00:00:00.000000000 +0000 ++++ kodi-16.0-beta5-19fc4fa-new/xbmc/windows/readpng.c 2016-01-08 06:49:51.049652775 +0000 +@@ -0,0 +1,274 @@ ++/*--------------------------------------------------------------------------- ++ ++ rpng - simple PNG display program readpng.c ++ ++ --------------------------------------------------------------------------- ++ ++ Copyright (c) 1998-2000 Greg Roelofs. All rights reserved. ++ ++ This software is provided "as is," without warranty of any kind, ++ express or implied. In no event shall the author or contributors ++ be held liable for any damages arising in any way from the use of ++ this software. ++ ++ Permission is granted to anyone to use this software for any purpose, ++ including commercial applications, and to alter it and redistribute ++ it freely, subject to the following restrictions: ++ ++ 1. Redistributions of source code must retain the above copyright ++ notice, disclaimer, and this list of conditions. ++ 2. Redistributions in binary form must reproduce the above copyright ++ notice, disclaimer, and this list of conditions in the documenta- ++ tion and/or other materials provided with the distribution. ++ 3. All advertising materials mentioning features or use of this ++ software must display the following acknowledgment: ++ ++ This product includes software developed by Greg Roelofs ++ and contributors for the book, "PNG: The Definitive Guide," ++ published by O'Reilly and Associates. ++ ++ ---------------------------------------------------------------------------*/ ++ ++#include <stdio.h> ++#include <stdlib.h> ++ ++#include "png.h" /* libpng header; includes zlib.h */ ++#include "readpng.h" /* typedefs, common macros, public prototypes */ ++ ++ ++static png_structp png_ptr = NULL; ++static png_infop info_ptr = NULL; ++ ++png_uint_32 width, height; ++int bit_depth, color_type; ++uch *image_data = NULL; ++ ++ ++void readpng_version_info(void) ++{ ++ fprintf(stderr, " Compiled with libpng %s; using libpng %s.\n", ++ PNG_LIBPNG_VER_STRING, png_libpng_ver); ++} ++ ++ ++/* return value = 0 for success, 1 for bad sig, 2 for bad IHDR, 4 for no mem */ ++ ++int readpng_init(FILE *infile, ulg *pWidth, ulg *pHeight) ++{ ++ uch sig[8]; ++ ++ ++ /* first do a quick check that the file really is a PNG image; could ++ * have used slightly more general png_sig_cmp() function instead */ ++ ++ fread(sig, 1, 8, infile); ++ if(png_sig_cmp(sig, 0, 8)) ++ return 1; /* bad signature */ ++ ++ ++ /* could pass pointers to user-defined error handlers instead of NULLs: */ ++ ++ png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); ++ if (!png_ptr) ++ return 4; /* out of memory */ ++ ++ info_ptr = png_create_info_struct(png_ptr); ++ if (!info_ptr) { ++ png_destroy_read_struct(&png_ptr, NULL, NULL); ++ return 4; /* out of memory */ ++ } ++ ++ ++ /* we could create a second info struct here (end_info), but it's only ++ * useful if we want to keep pre- and post-IDAT chunk info separated ++ * (mainly for PNG-aware image editors and converters) */ ++ ++ ++ /* setjmp() must be called in every function that calls a PNG-reading ++ * libpng function */ ++ ++ if (setjmp(png_jmpbuf(png_ptr))) { ++ png_destroy_read_struct(&png_ptr, &info_ptr, NULL); ++ return 2; ++ } ++ ++ ++ png_init_io(png_ptr, infile); ++ png_set_sig_bytes(png_ptr, 8); /* we already read the 8 signature bytes */ ++ ++ png_read_info(png_ptr, info_ptr); /* read all PNG info up to image data */ ++ ++ ++ /* alternatively, could make separate calls to png_get_image_width(), ++ * etc., but want bit_depth and color_type for later [don't care about ++ * compression_type and filter_type => NULLs] */ ++ ++ png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, ++ NULL, NULL, NULL); ++ *pWidth = width; ++ *pHeight = height; ++ ++ ++ /* OK, that's all we need for now; return happy */ ++ ++ return 0; ++} ++ ++ ++ ++ ++/* returns 0 if succeeds, 1 if fails due to no bKGD chunk, 2 if libpng error; ++ * scales values to 8-bit if necessary */ ++ ++int readpng_get_bgcolor(uch *red, uch *green, uch *blue) ++{ ++ png_color_16p pBackground; ++ ++ ++ /* setjmp() must be called in every function that calls a PNG-reading ++ * libpng function */ ++ ++ if (setjmp(png_jmpbuf(png_ptr))) { ++ png_destroy_read_struct(&png_ptr, &info_ptr, NULL); ++ return 2; ++ } ++ ++ ++ if (!png_get_valid(png_ptr, info_ptr, PNG_INFO_bKGD)) ++ return 1; ++ ++ /* it is not obvious from the libpng documentation, but this function ++ * takes a pointer to a pointer, and it always returns valid red, green ++ * and blue values, regardless of color_type: */ ++ ++ png_get_bKGD(png_ptr, info_ptr, &pBackground); ++ ++ ++ /* however, it always returns the raw bKGD data, regardless of any ++ * bit-depth transformations, so check depth and adjust if necessary */ ++ ++ if (bit_depth == 16) { ++ *red = pBackground->red >> 8; ++ *green = pBackground->green >> 8; ++ *blue = pBackground->blue >> 8; ++ } else if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8) { ++ if (bit_depth == 1) ++ *red = *green = *blue = pBackground->gray? 255 : 0; ++ else if (bit_depth == 2) ++ *red = *green = *blue = (255/3) * pBackground->gray; ++ else /* bit_depth == 4 */ ++ *red = *green = *blue = (255/15) * pBackground->gray; ++ } else { ++ *red = (uch)pBackground->red; ++ *green = (uch)pBackground->green; ++ *blue = (uch)pBackground->blue; ++ } ++ ++ return 0; ++} ++ ++ ++ ++ ++/* display_exponent == LUT_exponent * CRT_exponent */ ++ ++uch *readpng_get_image(double display_exponent, int *pChannels, ulg *pRowbytes) ++{ ++ double gamma; ++ png_uint_32 i, rowbytes; ++ png_bytepp row_pointers = NULL; ++ ++ ++ /* setjmp() must be called in every function that calls a PNG-reading ++ * libpng function */ ++ ++ if (setjmp(png_jmpbuf(png_ptr))) { ++ png_destroy_read_struct(&png_ptr, &info_ptr, NULL); ++ return NULL; ++ } ++ ++ ++ /* expand palette images to RGB, low-bit-depth grayscale images to 8 bits, ++ * transparency chunks to full alpha channel; strip 16-bit-per-sample ++ * images to 8 bits per sample; and convert grayscale to RGB[A] */ ++ ++ if (color_type == PNG_COLOR_TYPE_PALETTE) ++ png_set_expand(png_ptr); ++ if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8) ++ png_set_expand(png_ptr); ++ if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) ++ png_set_expand(png_ptr); ++ if (bit_depth == 16) ++ png_set_strip_16(png_ptr); ++ if (color_type == PNG_COLOR_TYPE_GRAY || ++ color_type == PNG_COLOR_TYPE_GRAY_ALPHA) ++ png_set_gray_to_rgb(png_ptr); ++ ++ ++ /* unlike the example in the libpng documentation, we have *no* idea where ++ * this file may have come from--so if it doesn't have a file gamma, don't ++ * do any correction ("do no harm") */ ++ ++ if (png_get_gAMA(png_ptr, info_ptr, &gamma)) ++ png_set_gamma(png_ptr, display_exponent, gamma); ++ ++ ++ /* all transformations have been registered; now update info_ptr data, ++ * get rowbytes and channels, and allocate image memory */ ++ ++ png_read_update_info(png_ptr, info_ptr); ++ ++ *pRowbytes = rowbytes = png_get_rowbytes(png_ptr, info_ptr); ++ *pChannels = (int)png_get_channels(png_ptr, info_ptr); ++ ++ if ((image_data = (uch *)malloc(rowbytes*height)) == NULL) { ++ png_destroy_read_struct(&png_ptr, &info_ptr, NULL); ++ return NULL; ++ } ++ if ((row_pointers = (png_bytepp)malloc(height*sizeof(png_bytep))) == NULL) { ++ png_destroy_read_struct(&png_ptr, &info_ptr, NULL); ++ free(image_data); ++ image_data = NULL; ++ return NULL; ++ } ++ ++ Trace((stderr, "readpng_get_image: rowbytes = %ld, height = %ld\n", rowbytes, height)); ++ ++ ++ /* set the individual row_pointers to point at the correct offsets */ ++ ++ for (i = 0; i < height; ++i) ++ row_pointers[i] = image_data + i*rowbytes; ++ ++ ++ /* now we can go ahead and just read the whole image */ ++ ++ png_read_image(png_ptr, row_pointers); ++ ++ ++ /* and we're done! (png_read_end() can be omitted if no processing of ++ * post-IDAT text/time/etc. is desired) */ ++ ++ free(row_pointers); ++ row_pointers = NULL; ++ ++ png_read_end(png_ptr, NULL); ++ ++ return image_data; ++} ++ ++ ++void readpng_cleanup(int free_image_data) ++{ ++ if (free_image_data && image_data) { ++ free(image_data); ++ image_data = NULL; ++ } ++ ++ if (png_ptr && info_ptr) { ++ png_destroy_read_struct(&png_ptr, &info_ptr, NULL); ++ png_ptr = NULL; ++ info_ptr = NULL; ++ } ++} ++ +diff -ruN kodi-16.0-beta5-19fc4fa/xbmc/windows/readpng.h kodi-16.0-beta5-19fc4fa-new/xbmc/windows/readpng.h +--- kodi-16.0-beta5-19fc4fa/xbmc/windows/readpng.h 1970-01-01 00:00:00.000000000 +0000 ++++ kodi-16.0-beta5-19fc4fa-new/xbmc/windows/readpng.h 2016-01-08 06:49:51.049652775 +0000 +@@ -0,0 +1,65 @@ ++/*--------------------------------------------------------------------------- ++ ++ rpng - simple PNG display program readpng.h ++ ++ --------------------------------------------------------------------------- ++ ++ Copyright (c) 1998-2000 Greg Roelofs. All rights reserved. ++ ++ This software is provided "as is," without warranty of any kind, ++ express or implied. In no event shall the author or contributors ++ be held liable for any damages arising in any way from the use of ++ this software. ++ ++ Permission is granted to anyone to use this software for any purpose, ++ including commercial applications, and to alter it and redistribute ++ it freely, subject to the following restrictions: ++ ++ 1. Redistributions of source code must retain the above copyright ++ notice, disclaimer, and this list of conditions. ++ 2. Redistributions in binary form must reproduce the above copyright ++ notice, disclaimer, and this list of conditions in the documenta- ++ tion and/or other materials provided with the distribution. ++ 3. All advertising materials mentioning features or use of this ++ software must display the following acknowledgment: ++ ++ This product includes software developed by Greg Roelofs ++ and contributors for the book, "PNG: The Definitive Guide," ++ published by O'Reilly and Associates. ++ ++ ---------------------------------------------------------------------------*/ ++ ++#ifndef TRUE ++# define TRUE 1 ++# define FALSE 0 ++#endif ++ ++#ifndef MAX ++# define MAX(a,b) ((a) > (b)? (a) : (b)) ++# define MIN(a,b) ((a) < (b)? (a) : (b)) ++#endif ++ ++#ifdef DEBUG ++# define Trace(x) {fprintf x ; fflush(stderr); fflush(stdout);} ++#else ++# define Trace(x) ; ++#endif ++ ++typedef unsigned char uch; ++typedef unsigned short ush; ++typedef unsigned long ulg; ++ ++ ++/* prototypes for public functions in readpng.c */ ++ ++void readpng_version_info(void); ++ ++int readpng_init(FILE *infile, ulg *pWidth, ulg *pHeight); ++ ++int readpng_get_bgcolor(uch *bg_red, uch *bg_green, uch *bg_blue); ++ ++uch *readpng_get_image(double display_exponent, int *pChannels, ++ ulg *pRowbytes); ++ ++void readpng_cleanup(int free_image_data); ++ diff --git a/projects/Slice/patches/kodi/kodi-004-slice-audio.patch b/projects/Slice/patches/kodi/kodi-004-slice-audio.patch new file mode 100644 index 00000000000..37991775943 --- /dev/null +++ b/projects/Slice/patches/kodi/kodi-004-slice-audio.patch @@ -0,0 +1,20 @@ +diff -ur kodi-15.0-rc3-284f66a/xbmc/cores/AudioEngine/Sinks/AESinkPi.cpp kodi-15.0-rc3-284f66a-new/xbmc/cores/AudioEngine/Sinks/AESinkPi.cpp +--- kodi-15.0-rc3-284f66a/xbmc/cores/AudioEngine/Sinks/AESinkPi.cpp 2015-07-18 09:08:17.000000000 +0000 ++++ kodi-15.0-rc3-284f66a-new/xbmc/cores/AudioEngine/Sinks/AESinkPi.cpp 2015-07-23 21:11:39.501652775 +0000 +@@ -520,7 +520,7 @@ + m_info.m_dataFormats.push_back(AE_FMT_EAC3); + + list.push_back(m_info); +- ++#if 0 + m_info.m_channels.Reset(); + m_info.m_dataFormats.clear(); + m_info.m_sampleRates.clear(); +@@ -560,6 +560,7 @@ + m_info.m_dataFormats.push_back(AE_FMT_S16NEP); + + list.push_back(m_info); ++#endif + } + + #endif diff --git a/projects/Slice/patches/kodi/kodi-005-slice-spdif.patch b/projects/Slice/patches/kodi/kodi-005-slice-spdif.patch new file mode 100644 index 00000000000..a799b27fe25 --- /dev/null +++ b/projects/Slice/patches/kodi/kodi-005-slice-spdif.patch @@ -0,0 +1,14 @@ +diff -ru kodi-16.0-beta5-19fc4fa/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp kodi-16.0-beta5-19fc4fa-new/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp +--- kodi-16.0-beta5-19fc4fa/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp 2015-12-14 23:07:12.000000000 +0000 ++++ kodi-16.0-beta5-19fc4fa-new/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp 2016-01-08 07:14:48.313652775 +0000 +@@ -1342,6 +1342,10 @@ + if (snd_card_get_name(cardNr, &cardName) == 0) + info.m_displayName = cardName; + ++ // hack: hifiberry digi doesn't correctly report as iec958 device. Needs fixing in kernel driver ++ //if (info.m_displayName == "snd_rpi_hifiberry_digi") ++ info.m_deviceType = AE_DEVTYPE_IEC958; ++ + if (info.m_deviceType == AE_DEVTYPE_HDMI && info.m_displayName.size() > 5 && + info.m_displayName.substr(info.m_displayName.size()-5) == " HDMI") + { diff --git a/projects/Slice/patches/kodi/kodi-006-simon-pendantic.patch b/projects/Slice/patches/kodi/kodi-006-simon-pendantic.patch new file mode 100644 index 00000000000..ebbf9d7b6b8 --- /dev/null +++ b/projects/Slice/patches/kodi/kodi-006-simon-pendantic.patch @@ -0,0 +1,12 @@ +diff -ru kodi-15.1-f4dda26/addons/resource.language.en_gb/resources/strings.po kodi-15.1-f4dda26-new/addons/resource.language.en_gb/resources/strings.po +--- kodi-15.1-f4dda26/addons/resource.language.en_gb/resources/strings.po 2015-08-17 16:46:17.000000000 +0000 ++++ kodi-15.1-f4dda26-new/addons/resource.language.en_gb/resources/strings.po 2015-09-19 09:13:52.889652775 +0000 +@@ -10594,7 +10594,7 @@ + #: xbmc/dialogs/GUIDialogSmartPlaylistEditor.cpp + #: xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeOverview.cpp + msgctxt "#20343" +-msgid "TV shows" ++msgid "TV Shows" + msgstr "" + + msgctxt "#20344" diff --git a/projects/Slice/patches/kodi/kodi-007-playpause.patch b/projects/Slice/patches/kodi/kodi-007-playpause.patch new file mode 100644 index 00000000000..d60ff89daaf --- /dev/null +++ b/projects/Slice/patches/kodi/kodi-007-playpause.patch @@ -0,0 +1,12 @@ +diff -ru kodi-16.0-beta5-19fc4fa/system/keymaps/keyboard.xml kodi-16.0-beta5-19fc4fa-new/system/keymaps/keyboard.xml +--- kodi-16.0-beta5-19fc4fa/system/keymaps/keyboard.xml 2016-01-08 07:16:35.489652775 +0000 ++++ kodi-16.0-beta5-19fc4fa-new/system/keymaps/keyboard.xml 2016-01-08 07:17:43.713652775 +0000 +@@ -74,7 +74,7 @@ + <menu mod="longpress">Menu</menu> + <c>ContextMenu</c> + <c mod="longpress">Menu</c> +- <space>Pause</space> ++ <space>PlayPause</space> + <x>Stop</x> + <period>SkipNext</period> + <comma>SkipPrevious</comma> diff --git a/projects/Slice/patches/kodi/kodi-008-ledquit.patch b/projects/Slice/patches/kodi/kodi-008-ledquit.patch new file mode 100644 index 00000000000..ff938382216 --- /dev/null +++ b/projects/Slice/patches/kodi/kodi-008-ledquit.patch @@ -0,0 +1,62 @@ +diff -ru kodi-15.2-02e7013/xbmc/windows/GUIWindowHome.cpp kodi-15.2-02e7013-new/xbmc/windows/GUIWindowHome.cpp +--- kodi-15.2-02e7013/xbmc/windows/GUIWindowHome.cpp 2015-11-04 20:19:49.941652775 +0000 ++++ kodi-15.2-02e7013-new/xbmc/windows/GUIWindowHome.cpp 2015-12-09 07:00:38.613652775 +0000 +@@ -44,11 +44,11 @@ + int g_repeat = 0; + + enum pattern_e { +- PAT_PLAY, PAT_PAUSE, PAT_STOP, PAT_SLEEP, PAT_WAKE, PAT_FFWD, PAT_REW, PAT_SKIPF, PAT_SKIPR, PAT_STARTUP, PAT_NONE ++ PAT_PLAY, PAT_PAUSE, PAT_STOP, PAT_SLEEP, PAT_WAKE, PAT_FFWD, PAT_REW, PAT_SKIPF, PAT_SKIPR, PAT_STARTUP, PAT_QUIT, PAT_NONE + }; +-#define NUM_PATTERNS 10 ++#define NUM_PATTERNS 11 + const char *patterns[NUM_PATTERNS] = { +- "play" , "pause", "stop", "sleep", "wake", "ffwd", "rew", "skipf", "skipr", "startup" ++ "play" , "pause", "stop", "sleep", "wake", "ffwd", "rew", "skipf", "skipr", "startup", "quit" + }; + + void on_speed_changed(const char *message, const CVariant &data) +@@ -100,7 +100,7 @@ + } + + enum action_e { +- ACTION_DO, ACTION_FN ++ ACTION_DO, ACTION_REPEAT, ACTION_FN + }; + + enum led_state_e { +@@ -125,6 +125,7 @@ + { "OnSeek", ACTION_FN, PAT_NONE, on_seek, LED_STATE_INVALID }, + { "OnScreensaverActivated", ACTION_DO, PAT_SLEEP, NULL, LED_STATE_SLEEP }, + { "OnScreensaverDeactivated", ACTION_DO, PAT_WAKE, NULL, LED_STATE_IDLE }, ++ { "OnQuit", ACTION_REPEAT, PAT_QUIT, NULL, LED_STATE_IDLE }, + }; + + int zeroes[25] = { 0,}; +@@ -231,7 +232,8 @@ + while(g_repeat); + g_pattern_playing = 0; + +- write(fd, zeroes, sizeof(zeroes)); ++ if(pat != PAT_QUIT) ++ write(fd, zeroes, sizeof(zeroes)); + } + else + { +@@ -327,12 +329,13 @@ + { + switch(led_actions[i].action) { + case ACTION_DO: ++ case ACTION_REPEAT: + { + g_halt = 1; + while(g_pattern_playing) + usleep(10); + g_halt = 0; +- g_repeat = 0; ++ g_repeat = (led_actions[i].action == ACTION_DO) ? 0 : 1; + g_speed = 30000; + g_pattern = (int) led_actions[i].action_data; + m_ledevent->Set(); +Only in kodi-15.2-02e7013-new/xbmc/windows: GUIWindowHome.cpp.orig +Only in kodi-15.2-02e7013-new/xbmc/windows: GUIWindowHome.cpp.rej diff --git a/projects/Slice/patches/linux/linux-01-RPi_support.patch b/projects/Slice/patches/linux/linux-01-RPi_support.patch new file mode 100644 index 00000000000..27eeea44d11 --- /dev/null +++ b/projects/Slice/patches/linux/linux-01-RPi_support.patch @@ -0,0 +1,134274 @@ +From ca75e975f8f57caa637e9cc52b3ff6feb869b74a Mon Sep 17 00:00:00 2001 +From: popcornmix <popcornmix@gmail.com> +Date: Wed, 27 Apr 2016 17:43:28 +0100 +Subject: [PATCH 001/112] Revert "SUNRPC: Make NFS swap work with multipath" + +This reverts commit 15001e5a7e1e207b6bd258cd8f187814cd15b6dc. +--- + net/sunrpc/clnt.c | 66 +++++++++++++++++++++++++++++++++++-------------------- + 1 file changed, 42 insertions(+), 24 deletions(-) + +diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c +index 7e0c9bf..0693685 100644 +--- a/net/sunrpc/clnt.c ++++ b/net/sunrpc/clnt.c +@@ -2683,39 +2683,57 @@ void rpc_show_tasks(struct net *net) + #endif + + #if IS_ENABLED(CONFIG_SUNRPC_SWAP) +-static int +-rpc_clnt_swap_activate_callback(struct rpc_clnt *clnt, +- struct rpc_xprt *xprt, +- void *dummy) +-{ +- return xprt_enable_swap(xprt); +-} +- + int + rpc_clnt_swap_activate(struct rpc_clnt *clnt) + { +- if (atomic_inc_return(&clnt->cl_swapper) == 1) +- return rpc_clnt_iterate_for_each_xprt(clnt, +- rpc_clnt_swap_activate_callback, NULL); +- return 0; +-} +-EXPORT_SYMBOL_GPL(rpc_clnt_swap_activate); ++ int ret = 0; ++ struct rpc_xprt *xprt; + +-static int +-rpc_clnt_swap_deactivate_callback(struct rpc_clnt *clnt, +- struct rpc_xprt *xprt, +- void *dummy) +-{ +- xprt_disable_swap(xprt); +- return 0; ++ if (atomic_inc_return(&clnt->cl_swapper) == 1) { ++retry: ++ rcu_read_lock(); ++ xprt = xprt_get(rcu_dereference(clnt->cl_xprt)); ++ rcu_read_unlock(); ++ if (!xprt) { ++ /* ++ * If we didn't get a reference, then we likely are ++ * racing with a migration event. Wait for a grace ++ * period and try again. ++ */ ++ synchronize_rcu(); ++ goto retry; ++ } ++ ++ ret = xprt_enable_swap(xprt); ++ xprt_put(xprt); ++ } ++ return ret; + } ++EXPORT_SYMBOL_GPL(rpc_clnt_swap_activate); + + void + rpc_clnt_swap_deactivate(struct rpc_clnt *clnt) + { +- if (atomic_dec_if_positive(&clnt->cl_swapper) == 0) +- rpc_clnt_iterate_for_each_xprt(clnt, +- rpc_clnt_swap_deactivate_callback, NULL); ++ struct rpc_xprt *xprt; ++ ++ if (atomic_dec_if_positive(&clnt->cl_swapper) == 0) { ++retry: ++ rcu_read_lock(); ++ xprt = xprt_get(rcu_dereference(clnt->cl_xprt)); ++ rcu_read_unlock(); ++ if (!xprt) { ++ /* ++ * If we didn't get a reference, then we likely are ++ * racing with a migration event. Wait for a grace ++ * period and try again. ++ */ ++ synchronize_rcu(); ++ goto retry; ++ } ++ ++ xprt_disable_swap(xprt); ++ xprt_put(xprt); ++ } + } + EXPORT_SYMBOL_GPL(rpc_clnt_swap_deactivate); + #endif /* CONFIG_SUNRPC_SWAP */ + +From 7ff74cfdea35caefc11486c463819aa0a559d032 Mon Sep 17 00:00:00 2001 +From: Steve Glendinning <steve.glendinning@smsc.com> +Date: Thu, 19 Feb 2015 18:47:12 +0000 +Subject: [PATCH 002/112] smsx95xx: fix crimes against truesize + +smsc95xx is adjusting truesize when it shouldn't, and following a recent patch from Eric this is now triggering warnings. + +This patch stops smsc95xx from changing truesize. + +Signed-off-by: Steve Glendinning <steve.glendinning@smsc.com> +--- + drivers/net/usb/smsc95xx.c | 10 ++++++++-- + 1 file changed, 8 insertions(+), 2 deletions(-) + +diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c +index 2edc2bc..2ce8d2b 100644 +--- a/drivers/net/usb/smsc95xx.c ++++ b/drivers/net/usb/smsc95xx.c +@@ -75,6 +75,10 @@ static bool turbo_mode = true; + module_param(turbo_mode, bool, 0644); + MODULE_PARM_DESC(turbo_mode, "Enable multiple frames per Rx transaction"); + ++static bool truesize_mode = false; ++module_param(truesize_mode, bool, 0644); ++MODULE_PARM_DESC(truesize_mode, "Report larger truesize value"); ++ + static int __must_check __smsc95xx_read_reg(struct usbnet *dev, u32 index, + u32 *data, int in_pm) + { +@@ -1795,7 +1799,8 @@ static int smsc95xx_rx_fixup(struct usbnet *dev, struct sk_buff *skb) + if (dev->net->features & NETIF_F_RXCSUM) + smsc95xx_rx_csum_offload(skb); + skb_trim(skb, skb->len - 4); /* remove fcs */ +- skb->truesize = size + sizeof(struct sk_buff); ++ if (truesize_mode) ++ skb->truesize = size + sizeof(struct sk_buff); + + return 1; + } +@@ -1813,7 +1818,8 @@ static int smsc95xx_rx_fixup(struct usbnet *dev, struct sk_buff *skb) + if (dev->net->features & NETIF_F_RXCSUM) + smsc95xx_rx_csum_offload(ax_skb); + skb_trim(ax_skb, ax_skb->len - 4); /* remove fcs */ +- ax_skb->truesize = size + sizeof(struct sk_buff); ++ if (truesize_mode) ++ ax_skb->truesize = size + sizeof(struct sk_buff); + + usbnet_skb_return(dev, ax_skb); + } + +From 1772115b52b325a46fafc57611663584bc9aef41 Mon Sep 17 00:00:00 2001 +From: popcornmix <popcornmix@gmail.com> +Date: Fri, 17 Apr 2015 16:58:45 +0100 +Subject: [PATCH 003/112] smsc95xx: Disable turbo mode by default + +--- + drivers/net/usb/smsc95xx.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c +index 2ce8d2b..35ebf75 100644 +--- a/drivers/net/usb/smsc95xx.c ++++ b/drivers/net/usb/smsc95xx.c +@@ -71,7 +71,7 @@ struct smsc95xx_priv { + u8 suspend_flags; + }; + +-static bool turbo_mode = true; ++static bool turbo_mode = false; + module_param(turbo_mode, bool, 0644); + MODULE_PARM_DESC(turbo_mode, "Enable multiple frames per Rx transaction"); + + +From 0174c345e5904dd88065c5512082f92e5bac390c Mon Sep 17 00:00:00 2001 +From: Sam Nazarko <email@samnazarko.co.uk> +Date: Fri, 1 Apr 2016 17:27:21 +0100 +Subject: [PATCH 004/112] add smsc95xx packetsize module_param + +Signed-off-by: Sam Nazarko <email@samnazarko.co.uk> +--- + drivers/net/usb/smsc95xx.c | 14 +++++++++----- + 1 file changed, 9 insertions(+), 5 deletions(-) + +diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c +index 35ebf75..3cac3c9 100644 +--- a/drivers/net/usb/smsc95xx.c ++++ b/drivers/net/usb/smsc95xx.c +@@ -79,6 +79,10 @@ static bool truesize_mode = false; + module_param(truesize_mode, bool, 0644); + MODULE_PARM_DESC(truesize_mode, "Report larger truesize value"); + ++static int packetsize = 0; ++module_param(packetsize, int, 0644); ++MODULE_PARM_DESC(packetsize, "Override the RX URB packet size"); ++ + static int __must_check __smsc95xx_read_reg(struct usbnet *dev, u32 index, + u32 *data, int in_pm) + { +@@ -960,13 +964,13 @@ static int smsc95xx_reset(struct usbnet *dev) + + if (!turbo_mode) { + burst_cap = 0; +- dev->rx_urb_size = MAX_SINGLE_PACKET_SIZE; ++ dev->rx_urb_size = packetsize ? packetsize : MAX_SINGLE_PACKET_SIZE; + } else if (dev->udev->speed == USB_SPEED_HIGH) { +- burst_cap = DEFAULT_HS_BURST_CAP_SIZE / HS_USB_PKT_SIZE; +- dev->rx_urb_size = DEFAULT_HS_BURST_CAP_SIZE; ++ dev->rx_urb_size = packetsize ? packetsize : DEFAULT_HS_BURST_CAP_SIZE; ++ burst_cap = dev->rx_urb_size / HS_USB_PKT_SIZE; + } else { +- burst_cap = DEFAULT_FS_BURST_CAP_SIZE / FS_USB_PKT_SIZE; +- dev->rx_urb_size = DEFAULT_FS_BURST_CAP_SIZE; ++ dev->rx_urb_size = packetsize ? packetsize : DEFAULT_FS_BURST_CAP_SIZE; ++ burst_cap = dev->rx_urb_size / FS_USB_PKT_SIZE; + } + + netif_dbg(dev, ifup, dev->net, "rx_urb_size=%ld\n", + +From be730bbaaddeb27448477933ffc1ddf37491c897 Mon Sep 17 00:00:00 2001 +From: popcornmix <popcornmix@gmail.com> +Date: Tue, 26 Mar 2013 17:26:38 +0000 +Subject: [PATCH 005/112] Allow mac address to be set in smsc95xx + +Signed-off-by: popcornmix <popcornmix@gmail.com> +--- + drivers/net/usb/smsc95xx.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 56 insertions(+) + +diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c +index 3cac3c9..d9bdc74 100644 +--- a/drivers/net/usb/smsc95xx.c ++++ b/drivers/net/usb/smsc95xx.c +@@ -60,6 +60,7 @@ + #define SUSPEND_SUSPEND3 (0x08) + #define SUSPEND_ALLMODES (SUSPEND_SUSPEND0 | SUSPEND_SUSPEND1 | \ + SUSPEND_SUSPEND2 | SUSPEND_SUSPEND3) ++#define MAC_ADDR_LEN (6) + + struct smsc95xx_priv { + u32 mac_cr; +@@ -83,6 +84,10 @@ static int packetsize = 0; + module_param(packetsize, int, 0644); + MODULE_PARM_DESC(packetsize, "Override the RX URB packet size"); + ++static char *macaddr = ":"; ++module_param(macaddr, charp, 0); ++MODULE_PARM_DESC(macaddr, "MAC address"); ++ + static int __must_check __smsc95xx_read_reg(struct usbnet *dev, u32 index, + u32 *data, int in_pm) + { +@@ -772,6 +777,53 @@ static int smsc95xx_ioctl(struct net_device *netdev, struct ifreq *rq, int cmd) + return generic_mii_ioctl(&dev->mii, if_mii(rq), cmd, NULL); + } + ++/* Check the macaddr module parameter for a MAC address */ ++static int smsc95xx_is_macaddr_param(struct usbnet *dev, u8 *dev_mac) ++{ ++ int i, j, got_num, num; ++ u8 mtbl[MAC_ADDR_LEN]; ++ ++ if (macaddr[0] == ':') ++ return 0; ++ ++ i = 0; ++ j = 0; ++ num = 0; ++ got_num = 0; ++ while (j < MAC_ADDR_LEN) { ++ if (macaddr[i] && macaddr[i] != ':') { ++ got_num++; ++ if ('0' <= macaddr[i] && macaddr[i] <= '9') ++ num = num * 16 + macaddr[i] - '0'; ++ else if ('A' <= macaddr[i] && macaddr[i] <= 'F') ++ num = num * 16 + 10 + macaddr[i] - 'A'; ++ else if ('a' <= macaddr[i] && macaddr[i] <= 'f') ++ num = num * 16 + 10 + macaddr[i] - 'a'; ++ else ++ break; ++ i++; ++ } else if (got_num == 2) { ++ mtbl[j++] = (u8) num; ++ num = 0; ++ got_num = 0; ++ i++; ++ } else { ++ break; ++ } ++ } ++ ++ if (j == MAC_ADDR_LEN) { ++ netif_dbg(dev, ifup, dev->net, "Overriding MAC address with: " ++ "%02x:%02x:%02x:%02x:%02x:%02x\n", mtbl[0], mtbl[1], mtbl[2], ++ mtbl[3], mtbl[4], mtbl[5]); ++ for (i = 0; i < MAC_ADDR_LEN; i++) ++ dev_mac[i] = mtbl[i]; ++ return 1; ++ } else { ++ return 0; ++ } ++} ++ + static void smsc95xx_init_mac_address(struct usbnet *dev) + { + const u8 *mac_addr; +@@ -793,6 +845,10 @@ static void smsc95xx_init_mac_address(struct usbnet *dev) + } + } + ++ /* Check module parameters */ ++ if (smsc95xx_is_macaddr_param(dev, dev->net->dev_addr)) ++ return; ++ + /* no useful static MAC address found. generate a random one */ + eth_hw_addr_random(dev->net); + netif_dbg(dev, ifup, dev->net, "MAC address set to eth_random_addr\n"); + +From 2f4a1d4938769ec3951b779bb607a841d6abdf7b Mon Sep 17 00:00:00 2001 +From: Nicolas Boullis <nboullis@debian.org> +Date: Sun, 10 Apr 2016 13:23:05 +0200 +Subject: [PATCH 006/112] rtc: ds1307: ensure that any pending alarm is cleared + before a new alarm is enabled +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +If a previously-set alarm was disabled and then triggered, it may still +be pending when a new alarm is configured. + +Then, if the alarm is enabled before the pending alarm is cleared, then +an interrupt is immediately raised. + +Unfortunately, when the alarm is cleared and enabled during the same I²C +block write, the chip (at least the DS1339 I have) considers that the +alarm is enabled before it is cleared, and raises an interrupt. + +This patch ensures that the pending alarm is cleared before the alarm is +enabled. + +Signed-off-by: Nicolas Boullis <nboullis@debian.org> +Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com> +--- + drivers/rtc/rtc-ds1307.c | 13 ++++++++----- + 1 file changed, 8 insertions(+), 5 deletions(-) + +diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c +index ecb7dba..e94eb09 100644 +--- a/drivers/rtc/rtc-ds1307.c ++++ b/drivers/rtc/rtc-ds1307.c +@@ -538,12 +538,8 @@ static int ds1337_set_alarm(struct device *dev, struct rtc_wkalrm *t) + buf[5] = 0; + buf[6] = 0; + +- /* optionally enable ALARM1 */ ++ /* disable alarms */ + buf[7] = control & ~(DS1337_BIT_A1IE | DS1337_BIT_A2IE); +- if (t->enabled) { +- dev_dbg(dev, "alarm IRQ armed\n"); +- buf[7] |= DS1337_BIT_A1IE; /* only ALARM1 is used */ +- } + buf[8] = status & ~(DS1337_BIT_A1I | DS1337_BIT_A2I); + + ret = ds1307->write_block_data(client, +@@ -553,6 +549,13 @@ static int ds1337_set_alarm(struct device *dev, struct rtc_wkalrm *t) + return ret; + } + ++ /* optionally enable ALARM1 */ ++ if (t->enabled) { ++ dev_dbg(dev, "alarm IRQ armed\n"); ++ buf[7] |= DS1337_BIT_A1IE; /* only ALARM1 is used */ ++ i2c_smbus_write_byte_data(client, DS1337_REG_CONTROL, buf[7]); ++ } ++ + return 0; + } + + +From c28f0cf7c000000c6af92915e49b11b3a0b5db55 Mon Sep 17 00:00:00 2001 +From: Phil Elwell <phil@raspberrypi.org> +Date: Wed, 9 Mar 2016 13:28:24 +0000 +Subject: [PATCH 007/112] serial: Take care starting a hung-up tty's port + +tty_port_hangup sets a port's tty field to NULL (holding the port lock), +but uart_tx_stopped, called from __uart_start (with the port lock), +uses the tty field without checking for NULL. + +Change uart_tx_stopped to treat a NULL tty field as another stopped +indication. + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> +--- + include/linux/serial_core.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h +index cbfcf38..96bc15a 100644 +--- a/include/linux/serial_core.h ++++ b/include/linux/serial_core.h +@@ -403,7 +403,7 @@ int uart_resume_port(struct uart_driver *reg, struct uart_port *port); + static inline int uart_tx_stopped(struct uart_port *port) + { + struct tty_struct *tty = port->state->port.tty; +- if (tty->stopped || port->hw_stopped) ++ if (!tty || tty->stopped || port->hw_stopped) + return 1; + return 0; + } + +From c6d7c03c674161544d9cb391acc3bbf18bc3ac95 Mon Sep 17 00:00:00 2001 +From: popcornmix <popcornmix@gmail.com> +Date: Wed, 18 Jun 2014 13:42:01 +0100 +Subject: [PATCH 008/112] vmstat: Workaround for issue where dirty page count + goes negative + +See: +https://github.com/raspberrypi/linux/issues/617 +http://www.spinics.net/lists/linux-mm/msg72236.html +--- + include/linux/vmstat.h | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h +index 73fae8c..5dd1278 100644 +--- a/include/linux/vmstat.h ++++ b/include/linux/vmstat.h +@@ -220,7 +220,11 @@ static inline void __inc_zone_state(struct zone *zone, enum zone_stat_item item) + static inline void __dec_zone_state(struct zone *zone, enum zone_stat_item item) + { + atomic_long_dec(&zone->vm_stat[item]); ++ if (item == NR_FILE_DIRTY && unlikely(atomic_long_read(&zone->vm_stat[item]) < 0)) ++ atomic_long_set(&zone->vm_stat[item], 0); + atomic_long_dec(&vm_stat[item]); ++ if (item == NR_FILE_DIRTY && unlikely(atomic_long_read(&vm_stat[item]) < 0)) ++ atomic_long_set(&vm_stat[item], 0); + } + + static inline void __inc_zone_page_state(struct page *page, + +From 31b90174e46b5e1eb81aa8c29e7f42fdf6c74f2b Mon Sep 17 00:00:00 2001 +From: Phil Elwell <phil@raspberrypi.org> +Date: Fri, 13 Mar 2015 12:43:36 +0000 +Subject: [PATCH 009/112] Protect __release_resource against resources without + parents + +Without this patch, removing a device tree overlay can crash here. + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> +--- + kernel/resource.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/kernel/resource.c b/kernel/resource.c +index 9b5f044..f8a9af6 100644 +--- a/kernel/resource.c ++++ b/kernel/resource.c +@@ -246,6 +246,12 @@ static int __release_resource(struct resource *old, bool release_child) + { + struct resource *tmp, **p, *chd; + ++ if (!old->parent) { ++ WARN(old->sibling, "sibling but no parent"); ++ if (old->sibling) ++ return -EINVAL; ++ return 0; ++ } + p = &old->parent->child; + for (;;) { + tmp = *p; + +From 40f5929ab19a370adb498aa3249ca28942127d9b Mon Sep 17 00:00:00 2001 +From: Eric Anholt <eric@anholt.net> +Date: Thu, 18 Dec 2014 16:07:15 -0800 +Subject: [PATCH 010/112] mm: Remove the PFN busy warning + +See commit dae803e165a11bc88ca8dbc07a11077caf97bbcb -- the warning is +expected sometimes when using CMA. However, that commit still spams +my kernel log with these warnings. + +Signed-off-by: Eric Anholt <eric@anholt.net> +--- + mm/page_alloc.c | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/mm/page_alloc.c b/mm/page_alloc.c +index c1069ef..fe21be6 100644 +--- a/mm/page_alloc.c ++++ b/mm/page_alloc.c +@@ -7101,8 +7101,6 @@ int alloc_contig_range(unsigned long start, unsigned long end, + + /* Make sure the range is really isolated. */ + if (test_pages_isolated(outer_start, end, false)) { +- pr_info("%s: [%lx, %lx) PFNs busy\n", +- __func__, outer_start, end); + ret = -EBUSY; + goto done; + } + +From d7c3a06d1bace2ac531e73c63b5fa08117ed7826 Mon Sep 17 00:00:00 2001 +From: Robert Tiemann <rtie@gmx.de> +Date: Mon, 20 Jul 2015 11:01:25 +0200 +Subject: [PATCH 011/112] BCM2835_DT: Fix I2S register map + +--- + Documentation/devicetree/bindings/dma/brcm,bcm2835-dma.txt | 4 ++-- + Documentation/devicetree/bindings/sound/brcm,bcm2835-i2s.txt | 4 ++-- + 2 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/Documentation/devicetree/bindings/dma/brcm,bcm2835-dma.txt b/Documentation/devicetree/bindings/dma/brcm,bcm2835-dma.txt +index 1396078..2db8294 100644 +--- a/Documentation/devicetree/bindings/dma/brcm,bcm2835-dma.txt ++++ b/Documentation/devicetree/bindings/dma/brcm,bcm2835-dma.txt +@@ -48,8 +48,8 @@ Example: + + bcm2835_i2s: i2s@7e203000 { + compatible = "brcm,bcm2835-i2s"; +- reg = < 0x7e203000 0x20>, +- < 0x7e101098 0x02>; ++ reg = < 0x7e203000 0x24>, ++ < 0x7e101098 0x08>; + + dmas = <&dma 2>, + <&dma 3>; +diff --git a/Documentation/devicetree/bindings/sound/brcm,bcm2835-i2s.txt b/Documentation/devicetree/bindings/sound/brcm,bcm2835-i2s.txt +index 65783de..a89fe42 100644 +--- a/Documentation/devicetree/bindings/sound/brcm,bcm2835-i2s.txt ++++ b/Documentation/devicetree/bindings/sound/brcm,bcm2835-i2s.txt +@@ -16,8 +16,8 @@ Example: + + bcm2835_i2s: i2s@7e203000 { + compatible = "brcm,bcm2835-i2s"; +- reg = <0x7e203000 0x20>, +- <0x7e101098 0x02>; ++ reg = <0x7e203000 0x24>, ++ <0x7e101098 0x08>; + + dmas = <&dma 2>, + <&dma 3>; + +From 4c752b5cd3a5486b9fcba5d591175e5b742cfbef Mon Sep 17 00:00:00 2001 +From: Phil Elwell <phil@raspberrypi.org> +Date: Fri, 4 Dec 2015 17:41:50 +0000 +Subject: [PATCH 012/112] irq-bcm2836: Prevent spurious interrupts, and trap + them early + +The old arch-specific IRQ macros included a dsb to ensure the +write to clear the mailbox interrupt completed before returning +from the interrupt. The BCM2836 irqchip driver needs the same +precaution to avoid spurious interrupts. + +Spurious interrupts are still possible for other reasons, +though, so trap them early. +--- + drivers/irqchip/irq-bcm2836.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/irqchip/irq-bcm2836.c b/drivers/irqchip/irq-bcm2836.c +index b6e950d..bbb92c2 100644 +--- a/drivers/irqchip/irq-bcm2836.c ++++ b/drivers/irqchip/irq-bcm2836.c +@@ -175,6 +175,7 @@ __exception_irq_entry bcm2836_arm_irqchip_handle_irq(struct pt_regs *regs) + u32 ipi = ffs(mbox_val) - 1; + + writel(1 << ipi, mailbox0); ++ dsb(); + handle_IPI(ipi, regs); + #endif + } else if (stat) { + +From 035dd0ae04e88afb2133082dce4c15527f5fb0ca Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= <noralf@tronnes.org> +Date: Fri, 12 Jun 2015 19:01:05 +0200 +Subject: [PATCH 013/112] irqchip: bcm2835: Add FIQ support +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Add a duplicate irq range with an offset on the hwirq's so the +driver can detect that enable_fiq() is used. +Tested with downstream dwc_otg USB controller driver. + +Signed-off-by: Noralf Trønnes <noralf@tronnes.org> +Reviewed-by: Eric Anholt <eric@anholt.net> +Acked-by: Stephen Warren <swarren@wwwdotorg.org> +--- + arch/arm/mach-bcm/Kconfig | 1 + + drivers/irqchip/irq-bcm2835.c | 51 ++++++++++++++++++++++++++++++++++++++----- + 2 files changed, 47 insertions(+), 5 deletions(-) + +diff --git a/arch/arm/mach-bcm/Kconfig b/arch/arm/mach-bcm/Kconfig +index 7ef1214..b1a5a7b 100644 +--- a/arch/arm/mach-bcm/Kconfig ++++ b/arch/arm/mach-bcm/Kconfig +@@ -143,6 +143,7 @@ config ARCH_BCM2835 + select ARM_TIMER_SP804 + select HAVE_ARM_ARCH_TIMER if ARCH_MULTI_V7 + select CLKSRC_OF ++ select FIQ + select PINCTRL + select PINCTRL_BCM2835 + help +diff --git a/drivers/irqchip/irq-bcm2835.c b/drivers/irqchip/irq-bcm2835.c +index bf9cc5f..3f601f9 100644 +--- a/drivers/irqchip/irq-bcm2835.c ++++ b/drivers/irqchip/irq-bcm2835.c +@@ -55,7 +55,7 @@ + #include <asm/mach/irq.h> + + /* Put the bank and irq (32 bits) into the hwirq */ +-#define MAKE_HWIRQ(b, n) ((b << 5) | (n)) ++#define MAKE_HWIRQ(b, n) (((b) << 5) | (n)) + #define HWIRQ_BANK(i) (i >> 5) + #define HWIRQ_BIT(i) BIT(i & 0x1f) + +@@ -71,9 +71,13 @@ + | SHORTCUT1_MASK | SHORTCUT2_MASK) + + #define REG_FIQ_CONTROL 0x0c ++#define REG_FIQ_ENABLE 0x80 ++#define REG_FIQ_DISABLE 0 + + #define NR_BANKS 3 + #define IRQS_PER_BANK 32 ++#define NUMBER_IRQS MAKE_HWIRQ(NR_BANKS, 0) ++#define FIQ_START (NR_IRQS_BANK0 + MAKE_HWIRQ(NR_BANKS - 1, 0)) + + static const int reg_pending[] __initconst = { 0x00, 0x04, 0x08 }; + static const int reg_enable[] __initconst = { 0x18, 0x10, 0x14 }; +@@ -98,14 +102,38 @@ static void __exception_irq_entry bcm2835_handle_irq( + struct pt_regs *regs); + static void bcm2836_chained_handle_irq(struct irq_desc *desc); + ++static inline unsigned int hwirq_to_fiq(unsigned long hwirq) ++{ ++ hwirq -= NUMBER_IRQS; ++ /* ++ * The hwirq numbering used in this driver is: ++ * BASE (0-7) GPU1 (32-63) GPU2 (64-95). ++ * This differ from the one used in the FIQ register: ++ * GPU1 (0-31) GPU2 (32-63) BASE (64-71) ++ */ ++ if (hwirq >= 32) ++ return hwirq - 32; ++ ++ return hwirq + 64; ++} ++ + static void armctrl_mask_irq(struct irq_data *d) + { +- writel_relaxed(HWIRQ_BIT(d->hwirq), intc.disable[HWIRQ_BANK(d->hwirq)]); ++ if (d->hwirq >= NUMBER_IRQS) ++ writel_relaxed(REG_FIQ_DISABLE, intc.base + REG_FIQ_CONTROL); ++ else ++ writel_relaxed(HWIRQ_BIT(d->hwirq), ++ intc.disable[HWIRQ_BANK(d->hwirq)]); + } + + static void armctrl_unmask_irq(struct irq_data *d) + { +- writel_relaxed(HWIRQ_BIT(d->hwirq), intc.enable[HWIRQ_BANK(d->hwirq)]); ++ if (d->hwirq >= NUMBER_IRQS) ++ writel_relaxed(REG_FIQ_ENABLE | hwirq_to_fiq(d->hwirq), ++ intc.base + REG_FIQ_CONTROL); ++ else ++ writel_relaxed(HWIRQ_BIT(d->hwirq), ++ intc.enable[HWIRQ_BANK(d->hwirq)]); + } + + static struct irq_chip armctrl_chip = { +@@ -151,8 +179,9 @@ static int __init armctrl_of_init(struct device_node *node, + panic("%s: unable to map IC registers\n", + node->full_name); + +- intc.domain = irq_domain_add_linear(node, MAKE_HWIRQ(NR_BANKS, 0), +- &armctrl_ops, NULL); ++ intc.base = base; ++ intc.domain = irq_domain_add_linear(node, NUMBER_IRQS * 2, ++ &armctrl_ops, NULL); + if (!intc.domain) + panic("%s: unable to create IRQ domain\n", node->full_name); + +@@ -182,6 +211,18 @@ static int __init armctrl_of_init(struct device_node *node, + set_handle_irq(bcm2835_handle_irq); + } + ++ /* Make a duplicate irq range which is used to enable FIQ */ ++ for (b = 0; b < NR_BANKS; b++) { ++ for (i = 0; i < bank_irqs[b]; i++) { ++ irq = irq_create_mapping(intc.domain, ++ MAKE_HWIRQ(b, i) + NUMBER_IRQS); ++ BUG_ON(irq <= 0); ++ irq_set_chip(irq, &armctrl_chip); ++ set_irq_flags(irq, IRQF_VALID | IRQF_PROBE); ++ } ++ } ++ init_FIQ(FIQ_START); ++ + return 0; + } + + +From bfbf2463f40ebf7f80ce73ad7b15ea4ca2e446a4 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= <noralf@tronnes.org> +Date: Fri, 23 Oct 2015 16:26:55 +0200 +Subject: [PATCH 014/112] irqchip: irq-bcm2835: Add 2836 FIQ support +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Noralf Trønnes <noralf@tronnes.org> +--- + drivers/irqchip/irq-bcm2835.c | 42 ++++++++++++++++++++++++++++++++++++++++-- + 1 file changed, 40 insertions(+), 2 deletions(-) + +diff --git a/drivers/irqchip/irq-bcm2835.c b/drivers/irqchip/irq-bcm2835.c +index 3f601f9..20deb28 100644 +--- a/drivers/irqchip/irq-bcm2835.c ++++ b/drivers/irqchip/irq-bcm2835.c +@@ -50,6 +50,8 @@ + #include <linux/of_irq.h> + #include <linux/irqchip.h> + #include <linux/irqdomain.h> ++#include <linux/mfd/syscon.h> ++#include <linux/regmap.h> + + #include <asm/exception.h> + #include <asm/mach/irq.h> +@@ -70,6 +72,9 @@ + #define BANK0_VALID_MASK (BANK0_HWIRQ_MASK | BANK1_HWIRQ | BANK2_HWIRQ \ + | SHORTCUT1_MASK | SHORTCUT2_MASK) + ++#undef ARM_LOCAL_GPU_INT_ROUTING ++#define ARM_LOCAL_GPU_INT_ROUTING 0x0c ++ + #define REG_FIQ_CONTROL 0x0c + #define REG_FIQ_ENABLE 0x80 + #define REG_FIQ_DISABLE 0 +@@ -95,6 +100,7 @@ struct armctrl_ic { + void __iomem *enable[NR_BANKS]; + void __iomem *disable[NR_BANKS]; + struct irq_domain *domain; ++ struct regmap *local_regmap; + }; + + static struct armctrl_ic intc __read_mostly; +@@ -128,12 +134,35 @@ static void armctrl_mask_irq(struct irq_data *d) + + static void armctrl_unmask_irq(struct irq_data *d) + { +- if (d->hwirq >= NUMBER_IRQS) ++ if (d->hwirq >= NUMBER_IRQS) { ++ if (num_online_cpus() > 1) { ++ unsigned int data; ++ int ret; ++ ++ if (!intc.local_regmap) { ++ pr_err("FIQ is disabled due to missing regmap\n"); ++ return; ++ } ++ ++ ret = regmap_read(intc.local_regmap, ++ ARM_LOCAL_GPU_INT_ROUTING, &data); ++ if (ret) { ++ pr_err("Failed to read int routing %d\n", ret); ++ return; ++ } ++ ++ data &= ~0xc; ++ data |= (1 << 2); ++ regmap_write(intc.local_regmap, ++ ARM_LOCAL_GPU_INT_ROUTING, data); ++ } ++ + writel_relaxed(REG_FIQ_ENABLE | hwirq_to_fiq(d->hwirq), + intc.base + REG_FIQ_CONTROL); +- else ++ } else { + writel_relaxed(HWIRQ_BIT(d->hwirq), + intc.enable[HWIRQ_BANK(d->hwirq)]); ++ } + } + + static struct irq_chip armctrl_chip = { +@@ -211,6 +240,15 @@ static int __init armctrl_of_init(struct device_node *node, + set_handle_irq(bcm2835_handle_irq); + } + ++ if (is_2836) { ++ intc.local_regmap = ++ syscon_regmap_lookup_by_compatible("brcm,bcm2836-arm-local"); ++ if (IS_ERR(intc.local_regmap)) { ++ pr_err("Failed to get local register map. FIQ is disabled for cpus > 1\n"); ++ intc.local_regmap = NULL; ++ } ++ } ++ + /* Make a duplicate irq range which is used to enable FIQ */ + for (b = 0; b < NR_BANKS; b++) { + for (i = 0; i < bank_irqs[b]; i++) { + +From 18707aacc4b3f082193c87f86edfaeaeed90f56a Mon Sep 17 00:00:00 2001 +From: Phil Elwell <phil@raspberrypi.org> +Date: Tue, 14 Jul 2015 10:26:09 +0100 +Subject: [PATCH 015/112] spidev: Add "spidev" compatible string to silence + warning + +See: https://github.com/raspberrypi/linux/issues/1054 +--- + drivers/spi/spidev.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c +index e3c19f3..f4963e3 100644 +--- a/drivers/spi/spidev.c ++++ b/drivers/spi/spidev.c +@@ -695,6 +695,7 @@ static struct class *spidev_class; + static const struct of_device_id spidev_dt_ids[] = { + { .compatible = "rohm,dh2228fv" }, + { .compatible = "lineartechnology,ltc2488" }, ++ { .compatible = "spidev" }, + {}, + }; + MODULE_DEVICE_TABLE(of, spidev_dt_ids); + +From 9a451703f2138a4c8543033879948e3e167a0c26 Mon Sep 17 00:00:00 2001 +From: Phil Elwell <phil@raspberrypi.org> +Date: Tue, 30 Jun 2015 14:12:42 +0100 +Subject: [PATCH 016/112] serial: 8250: Don't crash when nr_uarts is 0 + +--- + drivers/tty/serial/8250/8250_core.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c +index 2f4f5ee..edc1355 100644 +--- a/drivers/tty/serial/8250/8250_core.c ++++ b/drivers/tty/serial/8250/8250_core.c +@@ -509,6 +509,8 @@ static void __init serial8250_isa_init_ports(void) + + if (nr_uarts > UART_NR) + nr_uarts = UART_NR; ++ if (!nr_uarts) ++ return; + + for (i = 0; i < nr_uarts; i++) { + struct uart_8250_port *up = &serial8250_ports[i]; + +From 888e562b188603c0fd16585155bb5393bd1a5704 Mon Sep 17 00:00:00 2001 +From: notro <notro@tronnes.org> +Date: Thu, 10 Jul 2014 13:59:47 +0200 +Subject: [PATCH 017/112] pinctrl-bcm2835: Set base to 0 give expected gpio + numbering + +Signed-off-by: Noralf Tronnes <notro@tronnes.org> +--- + drivers/pinctrl/bcm/pinctrl-bcm2835.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/pinctrl/bcm/pinctrl-bcm2835.c b/drivers/pinctrl/bcm/pinctrl-bcm2835.c +index 08b1d93..0a23c81 100644 +--- a/drivers/pinctrl/bcm/pinctrl-bcm2835.c ++++ b/drivers/pinctrl/bcm/pinctrl-bcm2835.c +@@ -373,7 +373,7 @@ static struct gpio_chip bcm2835_gpio_chip = { + .get = bcm2835_gpio_get, + .set = bcm2835_gpio_set, + .to_irq = bcm2835_gpio_to_irq, +- .base = -1, ++ .base = 0, + .ngpio = BCM2835_NUM_GPIOS, + .can_sleep = false, + }; + +From 44235a003f98fa50a4a03958bc6f224675dd1aea Mon Sep 17 00:00:00 2001 +From: Phil Elwell <phil@raspberrypi.org> +Date: Tue, 24 Feb 2015 13:40:50 +0000 +Subject: [PATCH 018/112] pinctrl-bcm2835: Fix interrupt handling for GPIOs + 28-31 and 46-53 + +Contrary to the documentation, the BCM2835 GPIO controller actually has +four interrupt lines - one each for the three IRQ groups and one common. Rather +confusingly, the GPIO interrupt groups don't correspond directly with the GPIO +control banks. Instead, GPIOs 0-27 generate IRQ GPIO0, 28-45 GPIO1 and +46-53 GPIO2. + +Awkwardly, the GPIOS for IRQ GPIO1 straddle two 32-entry GPIO banks, so it is +cleaner to split out a function to process the interrupts for a single GPIO +bank. + +This bug has only just been observed because GPIOs above 27 can only be +accessed on an old Raspberry Pi with the optional P5 header fitted, where +the pins are often used for I2S instead. +--- + drivers/pinctrl/bcm/pinctrl-bcm2835.c | 51 ++++++++++++++++++++++++++--------- + 1 file changed, 39 insertions(+), 12 deletions(-) + +diff --git a/drivers/pinctrl/bcm/pinctrl-bcm2835.c b/drivers/pinctrl/bcm/pinctrl-bcm2835.c +index 0a23c81..b793bbd 100644 +--- a/drivers/pinctrl/bcm/pinctrl-bcm2835.c ++++ b/drivers/pinctrl/bcm/pinctrl-bcm2835.c +@@ -47,6 +47,7 @@ + #define MODULE_NAME "pinctrl-bcm2835" + #define BCM2835_NUM_GPIOS 54 + #define BCM2835_NUM_BANKS 2 ++#define BCM2835_NUM_IRQS 3 + + #define BCM2835_PIN_BITMAP_SZ \ + DIV_ROUND_UP(BCM2835_NUM_GPIOS, sizeof(unsigned long) * 8) +@@ -88,13 +89,13 @@ enum bcm2835_pinconf_pull { + + struct bcm2835_gpio_irqdata { + struct bcm2835_pinctrl *pc; +- int bank; ++ int irqgroup; + }; + + struct bcm2835_pinctrl { + struct device *dev; + void __iomem *base; +- int irq[BCM2835_NUM_BANKS]; ++ int irq[BCM2835_NUM_IRQS]; + + /* note: locking assumes each bank will have its own unsigned long */ + unsigned long enabled_irq_map[BCM2835_NUM_BANKS]; +@@ -105,7 +106,7 @@ struct bcm2835_pinctrl { + struct gpio_chip gpio_chip; + struct pinctrl_gpio_range gpio_range; + +- struct bcm2835_gpio_irqdata irq_data[BCM2835_NUM_BANKS]; ++ struct bcm2835_gpio_irqdata irq_data[BCM2835_NUM_IRQS]; + spinlock_t irq_lock[BCM2835_NUM_BANKS]; + }; + +@@ -378,17 +379,16 @@ static struct gpio_chip bcm2835_gpio_chip = { + .can_sleep = false, + }; + +-static irqreturn_t bcm2835_gpio_irq_handler(int irq, void *dev_id) ++static int bcm2835_gpio_irq_handle_bank(struct bcm2835_pinctrl *pc, ++ unsigned int bank, u32 mask) + { +- struct bcm2835_gpio_irqdata *irqdata = dev_id; +- struct bcm2835_pinctrl *pc = irqdata->pc; +- int bank = irqdata->bank; + unsigned long events; + unsigned offset; + unsigned gpio; + unsigned int type; + + events = bcm2835_gpio_rd(pc, GPEDS0 + bank * 4); ++ events &= mask; + events &= pc->enabled_irq_map[bank]; + for_each_set_bit(offset, &events, 32) { + gpio = (32 * bank) + offset; +@@ -396,7 +396,30 @@ static irqreturn_t bcm2835_gpio_irq_handler(int irq, void *dev_id) + + generic_handle_irq(irq_linear_revmap(pc->irq_domain, gpio)); + } +- return events ? IRQ_HANDLED : IRQ_NONE; ++ ++ return (events != 0); ++} ++ ++static irqreturn_t bcm2835_gpio_irq_handler(int irq, void *dev_id) ++{ ++ struct bcm2835_gpio_irqdata *irqdata = dev_id; ++ struct bcm2835_pinctrl *pc = irqdata->pc; ++ int handled = 0; ++ ++ switch (irqdata->irqgroup) { ++ case 0: /* IRQ0 covers GPIOs 0-27 */ ++ handled = bcm2835_gpio_irq_handle_bank(pc, 0, 0x0fffffff); ++ break; ++ case 1: /* IRQ1 covers GPIOs 28-45 */ ++ handled = bcm2835_gpio_irq_handle_bank(pc, 0, 0xf0000000) | ++ bcm2835_gpio_irq_handle_bank(pc, 1, 0x00003fff); ++ break; ++ case 2: /* IRQ2 covers GPIOs 46-53 */ ++ handled = bcm2835_gpio_irq_handle_bank(pc, 1, 0x003fc000); ++ break; ++ } ++ ++ return handled ? IRQ_HANDLED : IRQ_NONE; + } + + static inline void __bcm2835_gpio_irq_config(struct bcm2835_pinctrl *pc, +@@ -985,8 +1008,6 @@ static int bcm2835_pinctrl_probe(struct platform_device *pdev) + for (i = 0; i < BCM2835_NUM_BANKS; i++) { + unsigned long events; + unsigned offset; +- int len; +- char *name; + + /* clear event detection flags */ + bcm2835_gpio_wr(pc, GPREN0 + i * 4, 0); +@@ -1001,10 +1022,15 @@ static int bcm2835_pinctrl_probe(struct platform_device *pdev) + for_each_set_bit(offset, &events, 32) + bcm2835_gpio_wr(pc, GPEDS0 + i * 4, BIT(offset)); + ++ spin_lock_init(&pc->irq_lock[i]); ++ } ++ ++ for (i = 0; i < BCM2835_NUM_IRQS; i++) { ++ int len; ++ char *name; + pc->irq[i] = irq_of_parse_and_map(np, i); + pc->irq_data[i].pc = pc; +- pc->irq_data[i].bank = i; +- spin_lock_init(&pc->irq_lock[i]); ++ pc->irq_data[i].irqgroup = i; + + len = strlen(dev_name(pc->dev)) + 16; + name = devm_kzalloc(pc->dev, len, GFP_KERNEL); +@@ -1062,6 +1088,7 @@ static struct platform_driver bcm2835_pinctrl_driver = { + .remove = bcm2835_pinctrl_remove, + .driver = { + .name = MODULE_NAME, ++ .owner = THIS_MODULE, + .of_match_table = bcm2835_pinctrl_match, + }, + }; + +From 338386be825f60aefee3d3613778b6233d3759b3 Mon Sep 17 00:00:00 2001 +From: Phil Elwell <phil@raspberrypi.org> +Date: Thu, 26 Feb 2015 09:58:22 +0000 +Subject: [PATCH 019/112] pinctrl-bcm2835: Only request the interrupts listed + in the DTB + +Although the GPIO controller can generate three interrupts (four counting +the common one), the device tree files currently only specify two. In the +absence of the third, simply don't register that interrupt (as opposed to +registering 0), which has the effect of making it impossible to generate +interrupts for GPIOs 46-53 which, since they share pins with the SD card +interface, is unlikely to be a problem. +--- + drivers/pinctrl/bcm/pinctrl-bcm2835.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/pinctrl/bcm/pinctrl-bcm2835.c b/drivers/pinctrl/bcm/pinctrl-bcm2835.c +index b793bbd..8683a1b 100644 +--- a/drivers/pinctrl/bcm/pinctrl-bcm2835.c ++++ b/drivers/pinctrl/bcm/pinctrl-bcm2835.c +@@ -1029,6 +1029,8 @@ static int bcm2835_pinctrl_probe(struct platform_device *pdev) + int len; + char *name; + pc->irq[i] = irq_of_parse_and_map(np, i); ++ if (pc->irq[i] == 0) ++ break; + pc->irq_data[i].pc = pc; + pc->irq_data[i].irqgroup = i; + + +From 74dbec2e38b6b8b6fb046a161cc86b835eadbde4 Mon Sep 17 00:00:00 2001 +From: Phil Elwell <phil@raspberrypi.org> +Date: Fri, 6 May 2016 12:32:47 +0100 +Subject: [PATCH 020/112] pinctrl-bcm2835: Return pins to inputs when freed + +When dynamically unloading overlays, it is important that freed pins are +restored to being inputs to prevent functions from being enabled in +multiple places at once. + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> +--- + drivers/pinctrl/bcm/pinctrl-bcm2835.c | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/drivers/pinctrl/bcm/pinctrl-bcm2835.c b/drivers/pinctrl/bcm/pinctrl-bcm2835.c +index 8683a1b..6327122 100644 +--- a/drivers/pinctrl/bcm/pinctrl-bcm2835.c ++++ b/drivers/pinctrl/bcm/pinctrl-bcm2835.c +@@ -831,6 +831,16 @@ static const struct pinctrl_ops bcm2835_pctl_ops = { + .dt_free_map = bcm2835_pctl_dt_free_map, + }; + ++static int bcm2835_pmx_free(struct pinctrl_dev *pctldev, ++ unsigned offset) ++{ ++ struct bcm2835_pinctrl *pc = pinctrl_dev_get_drvdata(pctldev); ++ ++ /* disable by setting to GPIO_IN */ ++ bcm2835_pinctrl_fsel_set(pc, offset, BCM2835_FSEL_GPIO_IN); ++ return 0; ++} ++ + static int bcm2835_pmx_get_functions_count(struct pinctrl_dev *pctldev) + { + return BCM2835_FSEL_COUNT; +@@ -890,6 +900,7 @@ static int bcm2835_pmx_gpio_set_direction(struct pinctrl_dev *pctldev, + } + + static const struct pinmux_ops bcm2835_pmx_ops = { ++ .free = bcm2835_pmx_free, + .get_functions_count = bcm2835_pmx_get_functions_count, + .get_function_name = bcm2835_pmx_get_function_name, + .get_function_groups = bcm2835_pmx_get_function_groups, + +From 1dc43cf973493169b270cba5302c4cbbdf940a3f Mon Sep 17 00:00:00 2001 +From: Phil Elwell <phil@raspberrypi.org> +Date: Wed, 24 Jun 2015 14:10:44 +0100 +Subject: [PATCH 021/112] spi-bcm2835: Support pin groups other than 7-11 + +The spi-bcm2835 driver automatically uses GPIO chip-selects due to +some unreliability of the native ones. In doing so it chooses the +same pins as the native chip-selects would use, but the existing +code always uses pins 7 and 8, wherever the SPI function is mapped. + +Search the pinctrl group assigned to the driver for pins that +correspond to native chip-selects, and use those for GPIO chip- +selects. + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> +--- + drivers/spi/spi-bcm2835.c | 45 +++++++++++++++++++++++++++++++++++++-------- + 1 file changed, 37 insertions(+), 8 deletions(-) + +diff --git a/drivers/spi/spi-bcm2835.c b/drivers/spi/spi-bcm2835.c +index f35cc10..5dfe20f 100644 +--- a/drivers/spi/spi-bcm2835.c ++++ b/drivers/spi/spi-bcm2835.c +@@ -688,6 +688,8 @@ static int bcm2835_spi_setup(struct spi_device *spi) + { + int err; + struct gpio_chip *chip; ++ struct device_node *pins; ++ u32 pingroup_index; + /* + * sanity checking the native-chipselects + */ +@@ -704,15 +706,42 @@ static int bcm2835_spi_setup(struct spi_device *spi) + "setup: only two native chip-selects are supported\n"); + return -EINVAL; + } +- /* now translate native cs to GPIO */ +- +- /* get the gpio chip for the base */ +- chip = gpiochip_find("pinctrl-bcm2835", chip_match_name); +- if (!chip) +- return 0; + +- /* and calculate the real CS */ +- spi->cs_gpio = chip->base + 8 - spi->chip_select; ++ /* now translate native cs to GPIO */ ++ /* first look for chip select pins in the devices pin groups */ ++ for (pingroup_index = 0; ++ (pins = of_parse_phandle(spi->master->dev.of_node, ++ "pinctrl-0", ++ pingroup_index)) != 0; ++ pingroup_index++) { ++ u32 pin; ++ u32 pin_index; ++ for (pin_index = 0; ++ of_property_read_u32_index(pins, ++ "brcm,pins", ++ pin_index, ++ &pin) == 0; ++ pin_index++) { ++ if (((spi->chip_select == 0) && ++ ((pin == 8) || (pin == 36) || (pin == 46))) || ++ ((spi->chip_select == 1) && ++ ((pin == 7) || (pin == 35)))) { ++ spi->cs_gpio = pin; ++ break; ++ } ++ } ++ of_node_put(pins); ++ } ++ /* if that fails, assume GPIOs 7-11 are used */ ++ if (!gpio_is_valid(spi->cs_gpio) ) { ++ /* get the gpio chip for the base */ ++ chip = gpiochip_find("pinctrl-bcm2835", chip_match_name); ++ if (!chip) ++ return 0; ++ ++ /* and calculate the real CS */ ++ spi->cs_gpio = chip->base + 8 - spi->chip_select; ++ } + + /* and set up the "mode" and level */ + dev_info(&spi->dev, "setting up native-CS%i as GPIO %i\n", + +From fa44a350bfe28a2ee33e460c4710036241db1054 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= <noralf@tronnes.org> +Date: Wed, 3 Jun 2015 12:26:13 +0200 +Subject: [PATCH 022/112] ARM: bcm2835: Set Serial number and Revision +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +The VideoCore bootloader passes in Serial number and +Revision number through Device Tree. Make these available to +userspace through /proc/cpuinfo. + +Mainline status: + +There is a commit in linux-next that standardize passing the serial +number through Device Tree (string: /serial-number): +ARM: 8355/1: arch: Show the serial number from devicetree in cpuinfo + +There was an attempt to do the same with the revision number, but it +didn't get in: +[PATCH v2 1/2] arm: devtree: Set system_rev from DT revision + +Signed-off-by: Noralf Trønnes <noralf@tronnes.org> +--- + arch/arm/mach-bcm/board_bcm2835.c | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/arch/arm/mach-bcm/board_bcm2835.c b/arch/arm/mach-bcm/board_bcm2835.c +index 834d676..3b68a8d 100644 +--- a/arch/arm/mach-bcm/board_bcm2835.c ++++ b/arch/arm/mach-bcm/board_bcm2835.c +@@ -17,12 +17,16 @@ + #include <linux/of_address.h> + #include <linux/of_platform.h> + #include <linux/clk/bcm2835.h> ++#include <asm/system_info.h> + + #include <asm/mach/arch.h> + #include <asm/mach/map.h> + + static void __init bcm2835_init(void) + { ++ struct device_node *np = of_find_node_by_path("/system"); ++ u32 val; ++ u64 val64; + int ret; + + bcm2835_init_clocks(); +@@ -33,6 +37,11 @@ static void __init bcm2835_init(void) + pr_err("of_platform_populate failed: %d\n", ret); + BUG(); + } ++ ++ if (!of_property_read_u32(np, "linux,revision", &val)) ++ system_rev = val; ++ if (!of_property_read_u64(np, "linux,serial", &val64)) ++ system_serial_low = val64; + } + + static const char * const bcm2835_compat[] = { + +From 52ab2f4e1b211feaf4f5be19022bc08e5cea6ec9 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= <noralf@tronnes.org> +Date: Thu, 9 Apr 2015 12:34:11 +0200 +Subject: [PATCH 023/112] dmaengine: bcm2835: Add slave dma support +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Add slave transfer capability to BCM2835 dmaengine driver. +This patch is pulled from the bcm2708-dmaengine driver in the +Raspberry Pi repo. The work was done by Gellert Weisz. + +Tested using the bcm2835-mmc driver from the same repo. + +Signed-off-by: Noralf Trønnes <noralf@tronnes.org> +--- + drivers/dma/bcm2835-dma.c | 206 ++++++++++++++++++++++++++++++++++++++++++---- + 1 file changed, 192 insertions(+), 14 deletions(-) + +diff --git a/drivers/dma/bcm2835-dma.c b/drivers/dma/bcm2835-dma.c +index 996c4b0..b278c66 100644 +--- a/drivers/dma/bcm2835-dma.c ++++ b/drivers/dma/bcm2835-dma.c +@@ -1,11 +1,10 @@ + /* + * BCM2835 DMA engine support + * +- * This driver only supports cyclic DMA transfers +- * as needed for the I2S module. +- * + * Author: Florian Meier <florian.meier@koalo.de> + * Copyright 2013 ++ * Gellert Weisz <gellert@raspberrypi.org> ++ * Copyright 2013-2014 + * + * Based on + * OMAP DMAengine support by Russell King +@@ -95,6 +94,8 @@ struct bcm2835_desc { + size_t size; + }; + ++#define BCM2835_DMA_WAIT_CYCLES 0 /* Slow down DMA transfers: 0-31 */ ++ + #define BCM2835_DMA_CS 0x00 + #define BCM2835_DMA_ADDR 0x04 + #define BCM2835_DMA_SOURCE_AD 0x0c +@@ -111,12 +112,16 @@ struct bcm2835_desc { + #define BCM2835_DMA_RESET BIT(31) /* WO, self clearing */ + + #define BCM2835_DMA_INT_EN BIT(0) ++#define BCM2835_DMA_WAIT_RESP BIT(3) + #define BCM2835_DMA_D_INC BIT(4) ++#define BCM2835_DMA_D_WIDTH BIT(5) + #define BCM2835_DMA_D_DREQ BIT(6) + #define BCM2835_DMA_S_INC BIT(8) ++#define BCM2835_DMA_S_WIDTH BIT(9) + #define BCM2835_DMA_S_DREQ BIT(10) + + #define BCM2835_DMA_PER_MAP(x) ((x) << 16) ++#define BCM2835_DMA_WAITS(x) (((x) & 0x1f) << 21) + + #define BCM2835_DMA_DATA_TYPE_S8 1 + #define BCM2835_DMA_DATA_TYPE_S16 2 +@@ -130,6 +135,14 @@ struct bcm2835_desc { + #define BCM2835_DMA_CHAN(n) ((n) << 8) /* Base address */ + #define BCM2835_DMA_CHANIO(base, n) ((base) + BCM2835_DMA_CHAN(n)) + ++#define MAX_NORMAL_TRANSFER SZ_1G ++/* ++ * Max length on a Lite channel is 65535 bytes. ++ * DMA handles byte-enables on SDRAM reads and writes even on 128-bit accesses, ++ * but byte-enables don't exist on peripheral addresses, so align to 32-bit. ++ */ ++#define MAX_LITE_TRANSFER (SZ_64K - 4) ++ + static inline struct bcm2835_dmadev *to_bcm2835_dma_dev(struct dma_device *d) + { + return container_of(d, struct bcm2835_dmadev, ddev); +@@ -226,12 +239,18 @@ static irqreturn_t bcm2835_dma_callback(int irq, void *data) + d = c->desc; + + if (d) { +- /* TODO Only works for cyclic DMA */ +- vchan_cyclic_callback(&d->vd); +- } ++ if (c->cyclic) { ++ vchan_cyclic_callback(&d->vd); + +- /* Keep the DMA engine running */ +- writel(BCM2835_DMA_ACTIVE, c->chan_base + BCM2835_DMA_CS); ++ /* Keep the DMA engine running */ ++ writel(BCM2835_DMA_ACTIVE, ++ c->chan_base + BCM2835_DMA_CS); ++ ++ } else { ++ vchan_cookie_complete(&c->desc->vd); ++ bcm2835_dma_start_desc(c); ++ } ++ } + + spin_unlock_irqrestore(&c->vc.lock, flags); + +@@ -339,8 +358,6 @@ static void bcm2835_dma_issue_pending(struct dma_chan *chan) + struct bcm2835_chan *c = to_bcm2835_dma_chan(chan); + unsigned long flags; + +- c->cyclic = true; /* Nothing else is implemented */ +- + spin_lock_irqsave(&c->vc.lock, flags); + if (vchan_issue_pending(&c->vc) && !c->desc) + bcm2835_dma_start_desc(c); +@@ -358,7 +375,7 @@ static struct dma_async_tx_descriptor *bcm2835_dma_prep_dma_cyclic( + struct bcm2835_desc *d; + dma_addr_t dev_addr; + unsigned int es, sync_type; +- unsigned int frame; ++ unsigned int frame, max_size; + int i; + + /* Grab configuration */ +@@ -393,7 +410,12 @@ static struct dma_async_tx_descriptor *bcm2835_dma_prep_dma_cyclic( + + d->c = c; + d->dir = direction; +- d->frames = buf_len / period_len; ++ if (c->ch >= 8) /* LITE channel */ ++ max_size = MAX_LITE_TRANSFER; ++ else ++ max_size = MAX_NORMAL_TRANSFER; ++ period_len = min(period_len, max_size); ++ d->frames = (buf_len - 1) / (period_len + 1); + + d->cb_list = kcalloc(d->frames, sizeof(*d->cb_list), GFP_KERNEL); + if (!d->cb_list) { +@@ -441,17 +463,171 @@ static struct dma_async_tx_descriptor *bcm2835_dma_prep_dma_cyclic( + BCM2835_DMA_PER_MAP(c->dreq); + + /* Length of a frame */ +- control_block->length = period_len; ++ if (frame != d->frames - 1) ++ control_block->length = period_len; ++ else ++ control_block->length = buf_len - (d->frames - 1) * ++ period_len; + d->size += control_block->length; + + /* + * Next block is the next frame. +- * This DMA engine driver currently only supports cyclic DMA. ++ * This function is called on cyclic DMA transfers. + * Therefore, wrap around at number of frames. + */ + control_block->next = d->cb_list[((frame + 1) % d->frames)].paddr; + } + ++ c->cyclic = true; ++ ++ return vchan_tx_prep(&c->vc, &d->vd, flags); ++} ++ ++static struct dma_async_tx_descriptor * ++bcm2835_dma_prep_slave_sg(struct dma_chan *chan, ++ struct scatterlist *sgl, ++ unsigned int sg_len, ++ enum dma_transfer_direction direction, ++ unsigned long flags, void *context) ++{ ++ struct bcm2835_chan *c = to_bcm2835_dma_chan(chan); ++ enum dma_slave_buswidth dev_width; ++ struct bcm2835_desc *d; ++ dma_addr_t dev_addr; ++ struct scatterlist *sgent; ++ unsigned int i, sync_type, split_cnt, max_size; ++ ++ if (!is_slave_direction(direction)) { ++ dev_err(chan->device->dev, "direction not supported\n"); ++ return NULL; ++ } ++ ++ if (direction == DMA_DEV_TO_MEM) { ++ dev_addr = c->cfg.src_addr; ++ dev_width = c->cfg.src_addr_width; ++ sync_type = BCM2835_DMA_S_DREQ; ++ } else { ++ dev_addr = c->cfg.dst_addr; ++ dev_width = c->cfg.dst_addr_width; ++ sync_type = BCM2835_DMA_D_DREQ; ++ } ++ ++ /* Bus width translates to the element size (ES) */ ++ switch (dev_width) { ++ case DMA_SLAVE_BUSWIDTH_4_BYTES: ++ break; ++ default: ++ dev_err(chan->device->dev, "buswidth not supported: %i\n", ++ dev_width); ++ return NULL; ++ } ++ ++ /* Allocate and setup the descriptor. */ ++ d = kzalloc(sizeof(*d), GFP_NOWAIT); ++ if (!d) ++ return NULL; ++ ++ d->dir = direction; ++ ++ if (c->ch >= 8) /* LITE channel */ ++ max_size = MAX_LITE_TRANSFER; ++ else ++ max_size = MAX_NORMAL_TRANSFER; ++ ++ /* ++ * Store the length of the SG list in d->frames ++ * taking care to account for splitting up transfers ++ * too large for a LITE channel ++ */ ++ d->frames = 0; ++ for_each_sg(sgl, sgent, sg_len, i) { ++ unsigned int len = sg_dma_len(sgent); ++ ++ d->frames += len / max_size + 1; ++ } ++ ++ /* Allocate memory for control blocks */ ++ d->control_block_size = d->frames * sizeof(struct bcm2835_dma_cb); ++ d->control_block_base = dma_zalloc_coherent(chan->device->dev, ++ d->control_block_size, &d->control_block_base_phys, ++ GFP_NOWAIT); ++ if (!d->control_block_base) { ++ kfree(d); ++ return NULL; ++ } ++ ++ /* ++ * Iterate over all SG entries, create a control block ++ * for each frame and link them together. ++ * Count the number of times an SG entry had to be split ++ * as a result of using a LITE channel ++ */ ++ split_cnt = 0; ++ ++ for_each_sg(sgl, sgent, sg_len, i) { ++ unsigned int j; ++ dma_addr_t addr = sg_dma_address(sgent); ++ unsigned int len = sg_dma_len(sgent); ++ ++ for (j = 0; j < len; j += max_size) { ++ struct bcm2835_dma_cb *control_block = ++ &d->control_block_base[i + split_cnt]; ++ ++ /* Setup addresses */ ++ if (d->dir == DMA_DEV_TO_MEM) { ++ control_block->info = BCM2835_DMA_D_INC | ++ BCM2835_DMA_D_WIDTH | ++ BCM2835_DMA_S_DREQ; ++ control_block->src = dev_addr; ++ control_block->dst = addr + (dma_addr_t)j; ++ } else { ++ control_block->info = BCM2835_DMA_S_INC | ++ BCM2835_DMA_S_WIDTH | ++ BCM2835_DMA_D_DREQ; ++ control_block->src = addr + (dma_addr_t)j; ++ control_block->dst = dev_addr; ++ } ++ ++ /* Common part */ ++ control_block->info |= ++ BCM2835_DMA_WAITS(BCM2835_DMA_WAIT_CYCLES); ++ control_block->info |= BCM2835_DMA_WAIT_RESP; ++ ++ /* Enable */ ++ if (i == sg_len - 1 && len - j <= max_size) ++ control_block->info |= BCM2835_DMA_INT_EN; ++ ++ /* Setup synchronization */ ++ if (sync_type) ++ control_block->info |= sync_type; ++ ++ /* Setup DREQ channel */ ++ if (c->dreq) ++ control_block->info |= ++ BCM2835_DMA_PER_MAP(c->dreq); ++ ++ /* Length of a frame */ ++ control_block->length = min(len - j, max_size); ++ d->size += control_block->length; ++ ++ if (i < sg_len - 1 || len - j > max_size) { ++ /* Next block is the next frame. */ ++ control_block->next = ++ d->control_block_base_phys + ++ sizeof(struct bcm2835_dma_cb) * ++ (i + split_cnt + 1); ++ } else { ++ /* Next block is empty. */ ++ control_block->next = 0; ++ } ++ ++ if (len - j > max_size) ++ split_cnt++; ++ } ++ } ++ ++ c->cyclic = false; ++ + return vchan_tx_prep(&c->vc, &d->vd, flags); + error_cb: + i--; +@@ -620,6 +796,7 @@ static int bcm2835_dma_probe(struct platform_device *pdev) + od->ddev.device_tx_status = bcm2835_dma_tx_status; + od->ddev.device_issue_pending = bcm2835_dma_issue_pending; + od->ddev.device_prep_dma_cyclic = bcm2835_dma_prep_dma_cyclic; ++ od->ddev.device_prep_slave_sg = bcm2835_dma_prep_slave_sg; + od->ddev.device_config = bcm2835_dma_slave_config; + od->ddev.device_terminate_all = bcm2835_dma_terminate_all; + od->ddev.src_addr_widths = BIT(DMA_SLAVE_BUSWIDTH_4_BYTES); +@@ -708,4 +885,5 @@ module_platform_driver(bcm2835_dma_driver); + MODULE_ALIAS("platform:bcm2835-dma"); + MODULE_DESCRIPTION("BCM2835 DMA engine driver"); + MODULE_AUTHOR("Florian Meier <florian.meier@koalo.de>"); ++MODULE_AUTHOR("Gellert Weisz <gellert@raspberrypi.org>"); + MODULE_LICENSE("GPL v2"); + +From 160840d9d207155501ca02d2bc97eba91747839c Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= <noralf@tronnes.org> +Date: Sat, 3 Oct 2015 15:58:59 +0200 +Subject: [PATCH 024/112] dmaengine: bcm2835: set residue_granularity field +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +bcm2835-dma supports residue reporting at burst level but didn't report +this via the residue_granularity field. + +Without this field set properly we get playback issues with I2S cards. + +[by HiassofT, taken from bcm2708-dmaengine] +Signed-off-by: Noralf Trønnes <noralf@tronnes.org> +--- + drivers/dma/bcm2835-dma.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/dma/bcm2835-dma.c b/drivers/dma/bcm2835-dma.c +index b278c66..696fb30 100644 +--- a/drivers/dma/bcm2835-dma.c ++++ b/drivers/dma/bcm2835-dma.c +@@ -802,6 +802,7 @@ static int bcm2835_dma_probe(struct platform_device *pdev) + od->ddev.src_addr_widths = BIT(DMA_SLAVE_BUSWIDTH_4_BYTES); + od->ddev.dst_addr_widths = BIT(DMA_SLAVE_BUSWIDTH_4_BYTES); + od->ddev.directions = BIT(DMA_DEV_TO_MEM) | BIT(DMA_MEM_TO_DEV); ++ od->ddev.residue_granularity = DMA_RESIDUE_GRANULARITY_BURST; + od->ddev.dev = &pdev->dev; + INIT_LIST_HEAD(&od->ddev.channels); + spin_lock_init(&od->lock); + +From 84ae1b4ea9964f0152d06115b8ed12c30dbb2366 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= <noralf@tronnes.org> +Date: Sat, 3 Oct 2015 22:22:55 +0200 +Subject: [PATCH 025/112] dmaengine: bcm2835: Load driver early and support + legacy API +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Load driver early since at least bcm2708_fb doesn't support deferred +probing and even if it did, we don't want the video driver deferred. +Support the legacy DMA API which is needed by bcm2708_fb. +Don't mask out channel 2. + +Signed-off-by: Noralf Trønnes <noralf@tronnes.org> +--- + drivers/dma/Kconfig | 2 +- + drivers/dma/bcm2835-dma.c | 30 ++++++++++++++++++++++++------ + 2 files changed, 25 insertions(+), 7 deletions(-) + +diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig +index d96d87c..4d0425c 100644 +--- a/drivers/dma/Kconfig ++++ b/drivers/dma/Kconfig +@@ -108,7 +108,7 @@ config COH901318 + + config DMA_BCM2835 + tristate "BCM2835 DMA engine support" +- depends on ARCH_BCM2835 ++ depends on ARCH_BCM2835 || ARCH_BCM2708 || ARCH_BCM2709 + select DMA_ENGINE + select DMA_VIRTUAL_CHANNELS + +diff --git a/drivers/dma/bcm2835-dma.c b/drivers/dma/bcm2835-dma.c +index 696fb30..5db0a95 100644 +--- a/drivers/dma/bcm2835-dma.c ++++ b/drivers/dma/bcm2835-dma.c +@@ -36,6 +36,7 @@ + #include <linux/interrupt.h> + #include <linux/list.h> + #include <linux/module.h> ++#include <linux/platform_data/dma-bcm2708.h> + #include <linux/platform_device.h> + #include <linux/slab.h> + #include <linux/io.h> +@@ -786,6 +787,10 @@ static int bcm2835_dma_probe(struct platform_device *pdev) + if (IS_ERR(base)) + return PTR_ERR(base); + ++ rc = bcm_dmaman_probe(pdev, base, BCM2835_DMA_BULK_MASK); ++ if (rc) ++ dev_err(&pdev->dev, "Failed to initialize the legacy API\n"); ++ + od->base = base; + + dma_cap_set(DMA_SLAVE, od->ddev.cap_mask); +@@ -818,11 +823,8 @@ static int bcm2835_dma_probe(struct platform_device *pdev) + goto err_no_dma; + } + +- /* +- * Do not use the FIQ and BULK channels, +- * because they are used by the GPU. +- */ +- chans_available &= ~(BCM2835_DMA_FIQ_MASK | BCM2835_DMA_BULK_MASK); ++ /* Channel 0 is used by the legacy API */ ++ chans_available &= ~BCM2835_DMA_BULK_MASK; + + for (i = 0; i < pdev->num_resources; i++) { + irq = platform_get_irq(pdev, i); +@@ -866,6 +868,7 @@ static int bcm2835_dma_remove(struct platform_device *pdev) + { + struct bcm2835_dmadev *od = platform_get_drvdata(pdev); + ++ bcm_dmaman_remove(pdev); + dma_async_device_unregister(&od->ddev); + bcm2835_dma_free(od); + +@@ -881,7 +884,22 @@ static struct platform_driver bcm2835_dma_driver = { + }, + }; + +-module_platform_driver(bcm2835_dma_driver); ++static int bcm2835_dma_init(void) ++{ ++ return platform_driver_register(&bcm2835_dma_driver); ++} ++ ++static void bcm2835_dma_exit(void) ++{ ++ platform_driver_unregister(&bcm2835_dma_driver); ++} ++ ++/* ++ * Load after serial driver (arch_initcall) so we see the messages if it fails, ++ * but before drivers (module_init) that need a DMA channel. ++ */ ++subsys_initcall(bcm2835_dma_init); ++module_exit(bcm2835_dma_exit); + + MODULE_ALIAS("platform:bcm2835-dma"); + MODULE_DESCRIPTION("BCM2835 DMA engine driver"); + +From ccc5b14a95ee999444d995c565a7e631cae946dd Mon Sep 17 00:00:00 2001 +From: Matthias Reichl <hias@horus.com> +Date: Sun, 11 Oct 2015 12:28:30 +0200 +Subject: [PATCH 026/112] bcm2835-dma: Limit cyclic transfers on lite channels + to 32k + +Transfers larger than 32k cause repeated clicking with I2S soundcards. +The exact reason is yet unknown, so limit to 32k as bcm2708-dmaengine +did as an intermediate fix. +--- + drivers/dma/bcm2835-dma.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/drivers/dma/bcm2835-dma.c b/drivers/dma/bcm2835-dma.c +index 5db0a95..6b87ce2 100644 +--- a/drivers/dma/bcm2835-dma.c ++++ b/drivers/dma/bcm2835-dma.c +@@ -144,6 +144,12 @@ struct bcm2835_desc { + */ + #define MAX_LITE_TRANSFER (SZ_64K - 4) + ++/* ++ * Transfers larger than 32k cause issues with the bcm2708-i2s driver, ++ * so limit transfer size to 32k as bcm2708-dmaengine did. ++ */ ++#define MAX_CYCLIC_LITE_TRANSFER SZ_32K ++ + static inline struct bcm2835_dmadev *to_bcm2835_dma_dev(struct dma_device *d) + { + return container_of(d, struct bcm2835_dmadev, ddev); +@@ -412,7 +418,7 @@ static struct dma_async_tx_descriptor *bcm2835_dma_prep_dma_cyclic( + d->c = c; + d->dir = direction; + if (c->ch >= 8) /* LITE channel */ +- max_size = MAX_LITE_TRANSFER; ++ max_size = MAX_CYCLIC_LITE_TRANSFER; + else + max_size = MAX_NORMAL_TRANSFER; + period_len = min(period_len, max_size); + +From 7ecbf96abab7daa1e09881d457ea72d4756037ba Mon Sep 17 00:00:00 2001 +From: Matthias Reichl <hias@horus.com> +Date: Mon, 16 Nov 2015 14:05:35 +0000 +Subject: [PATCH 027/112] bcm2835-dma: Fix up convert to DMA pool + +--- + drivers/dma/bcm2835-dma.c | 36 ++++++++++++++++++++++++++---------- + 1 file changed, 26 insertions(+), 10 deletions(-) + +diff --git a/drivers/dma/bcm2835-dma.c b/drivers/dma/bcm2835-dma.c +index 6b87ce2..d26b6bd 100644 +--- a/drivers/dma/bcm2835-dma.c ++++ b/drivers/dma/bcm2835-dma.c +@@ -488,6 +488,17 @@ static struct dma_async_tx_descriptor *bcm2835_dma_prep_dma_cyclic( + c->cyclic = true; + + return vchan_tx_prep(&c->vc, &d->vd, flags); ++error_cb: ++ i--; ++ for (; i >= 0; i--) { ++ struct bcm2835_cb_entry *cb_entry = &d->cb_list[i]; ++ ++ dma_pool_free(c->cb_pool, cb_entry->cb, cb_entry->paddr); ++ } ++ ++ kfree(d->cb_list); ++ kfree(d); ++ return NULL; + } + + static struct dma_async_tx_descriptor * +@@ -534,6 +545,7 @@ bcm2835_dma_prep_slave_sg(struct dma_chan *chan, + if (!d) + return NULL; + ++ d->c = c; + d->dir = direction; + + if (c->ch >= 8) /* LITE channel */ +@@ -553,15 +565,21 @@ bcm2835_dma_prep_slave_sg(struct dma_chan *chan, + d->frames += len / max_size + 1; + } + +- /* Allocate memory for control blocks */ +- d->control_block_size = d->frames * sizeof(struct bcm2835_dma_cb); +- d->control_block_base = dma_zalloc_coherent(chan->device->dev, +- d->control_block_size, &d->control_block_base_phys, +- GFP_NOWAIT); +- if (!d->control_block_base) { ++ d->cb_list = kcalloc(d->frames, sizeof(*d->cb_list), GFP_KERNEL); ++ if (!d->cb_list) { + kfree(d); + return NULL; + } ++ /* Allocate memory for control blocks */ ++ for (i = 0; i < d->frames; i++) { ++ struct bcm2835_cb_entry *cb_entry = &d->cb_list[i]; ++ ++ cb_entry->cb = dma_pool_zalloc(c->cb_pool, GFP_ATOMIC, ++ &cb_entry->paddr); ++ ++ if (!cb_entry->cb) ++ goto error_cb; ++ } + + /* + * Iterate over all SG entries, create a control block +@@ -578,7 +596,7 @@ bcm2835_dma_prep_slave_sg(struct dma_chan *chan, + + for (j = 0; j < len; j += max_size) { + struct bcm2835_dma_cb *control_block = +- &d->control_block_base[i + split_cnt]; ++ d->cb_list[i + split_cnt].cb; + + /* Setup addresses */ + if (d->dir == DMA_DEV_TO_MEM) { +@@ -620,9 +638,7 @@ bcm2835_dma_prep_slave_sg(struct dma_chan *chan, + if (i < sg_len - 1 || len - j > max_size) { + /* Next block is the next frame. */ + control_block->next = +- d->control_block_base_phys + +- sizeof(struct bcm2835_dma_cb) * +- (i + split_cnt + 1); ++ d->cb_list[i + split_cnt + 1].paddr; + } else { + /* Next block is empty. */ + control_block->next = 0; + +From 16a0a53f8ce5f32ac79b204ff05efd91bf770be9 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= <noralf@tronnes.org> +Date: Sat, 15 Aug 2015 20:50:02 +0200 +Subject: [PATCH 028/112] bcm2835: Add support for uart1 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This is a hack until a proper solution is agreed upon. +Martin Sperl is doing some work in this area. + +Signed-off-by: Noralf Trønnes <noralf@tronnes.org> +--- + arch/arm/mach-bcm/board_bcm2835.c | 25 +++++++++++++++++++++++++ + 1 file changed, 25 insertions(+) + +diff --git a/arch/arm/mach-bcm/board_bcm2835.c b/arch/arm/mach-bcm/board_bcm2835.c +index 3b68a8d..e72e522 100644 +--- a/arch/arm/mach-bcm/board_bcm2835.c ++++ b/arch/arm/mach-bcm/board_bcm2835.c +@@ -22,6 +22,29 @@ + #include <asm/mach/arch.h> + #include <asm/mach/map.h> + ++/* Use this hack until a proper solution is agreed upon */ ++static void __init bcm2835_init_uart1(void) ++{ ++ struct device_node *np; ++ ++ np = of_find_compatible_node(NULL, NULL, "brcm,bcm2835-aux-uart"); ++ if (of_device_is_available(np)) { ++ np = of_find_compatible_node(NULL, NULL, ++ "bcrm,bcm2835-aux-enable"); ++ if (np) { ++ void __iomem *base = of_iomap(np, 0); ++ ++ if (!base) { ++ pr_err("bcm2835: Failed enabling Mini UART\n"); ++ return; ++ } ++ ++ writel(1, base); ++ pr_info("bcm2835: Mini UART enabled\n"); ++ } ++ } ++} ++ + static void __init bcm2835_init(void) + { + struct device_node *np = of_find_node_by_path("/system"); +@@ -42,6 +65,8 @@ static void __init bcm2835_init(void) + system_rev = val; + if (!of_property_read_u64(np, "linux,serial", &val64)) + system_serial_low = val64; ++ ++ bcm2835_init_uart1(); + } + + static const char * const bcm2835_compat[] = { + +From 6d0faf9fef879b1ba6ee3796d07a63fac5984151 Mon Sep 17 00:00:00 2001 +From: popcornmix <popcornmix@gmail.com> +Date: Mon, 25 Jan 2016 17:25:12 +0000 +Subject: [PATCH 029/112] firmware: Updated mailbox header + +--- + include/soc/bcm2835/raspberrypi-firmware.h | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/include/soc/bcm2835/raspberrypi-firmware.h b/include/soc/bcm2835/raspberrypi-firmware.h +index 3fb3571..227a107 100644 +--- a/include/soc/bcm2835/raspberrypi-firmware.h ++++ b/include/soc/bcm2835/raspberrypi-firmware.h +@@ -63,6 +63,7 @@ enum rpi_firmware_property_tag { + RPI_FIRMWARE_GET_MIN_VOLTAGE = 0x00030008, + RPI_FIRMWARE_GET_TURBO = 0x00030009, + RPI_FIRMWARE_GET_MAX_TEMPERATURE = 0x0003000a, ++ RPI_FIRMWARE_GET_STC = 0x0003000b, + RPI_FIRMWARE_ALLOCATE_MEMORY = 0x0003000c, + RPI_FIRMWARE_LOCK_MEMORY = 0x0003000d, + RPI_FIRMWARE_UNLOCK_MEMORY = 0x0003000e, +@@ -72,12 +73,15 @@ enum rpi_firmware_property_tag { + RPI_FIRMWARE_SET_ENABLE_QPU = 0x00030012, + RPI_FIRMWARE_GET_DISPMANX_RESOURCE_MEM_HANDLE = 0x00030014, + RPI_FIRMWARE_GET_EDID_BLOCK = 0x00030020, ++ RPI_FIRMWARE_GET_CUSTOMER_OTP = 0x00030021, + RPI_FIRMWARE_GET_DOMAIN_STATE = 0x00030030, + RPI_FIRMWARE_SET_CLOCK_STATE = 0x00038001, + RPI_FIRMWARE_SET_CLOCK_RATE = 0x00038002, + RPI_FIRMWARE_SET_VOLTAGE = 0x00038003, + RPI_FIRMWARE_SET_TURBO = 0x00038009, ++ RPI_FIRMWARE_SET_CUSTOMER_OTP = 0x00038021, + RPI_FIRMWARE_SET_DOMAIN_STATE = 0x00038030, ++ RPI_FIRMWARE_SET_SDHOST_CLOCK = 0x00038042, + + /* Dispmanx TAGS */ + RPI_FIRMWARE_FRAMEBUFFER_ALLOCATE = 0x00040001, +@@ -91,6 +95,8 @@ enum rpi_firmware_property_tag { + RPI_FIRMWARE_FRAMEBUFFER_GET_VIRTUAL_OFFSET = 0x00040009, + RPI_FIRMWARE_FRAMEBUFFER_GET_OVERSCAN = 0x0004000a, + RPI_FIRMWARE_FRAMEBUFFER_GET_PALETTE = 0x0004000b, ++ RPI_FIRMWARE_FRAMEBUFFER_GET_TOUCHBUF = 0x0004000f, ++ RPI_FIRMWARE_FRAMEBUFFER_GET_GPIOVIRTBUF = 0x00040010, + RPI_FIRMWARE_FRAMEBUFFER_RELEASE = 0x00048001, + RPI_FIRMWARE_FRAMEBUFFER_TEST_PHYSICAL_WIDTH_HEIGHT = 0x00044003, + RPI_FIRMWARE_FRAMEBUFFER_TEST_VIRTUAL_WIDTH_HEIGHT = 0x00044004, +@@ -100,6 +106,7 @@ enum rpi_firmware_property_tag { + RPI_FIRMWARE_FRAMEBUFFER_TEST_VIRTUAL_OFFSET = 0x00044009, + RPI_FIRMWARE_FRAMEBUFFER_TEST_OVERSCAN = 0x0004400a, + RPI_FIRMWARE_FRAMEBUFFER_TEST_PALETTE = 0x0004400b, ++ RPI_FIRMWARE_FRAMEBUFFER_TEST_VSYNC = 0x0004400e, + RPI_FIRMWARE_FRAMEBUFFER_SET_PHYSICAL_WIDTH_HEIGHT = 0x00048003, + RPI_FIRMWARE_FRAMEBUFFER_SET_VIRTUAL_WIDTH_HEIGHT = 0x00048004, + RPI_FIRMWARE_FRAMEBUFFER_SET_DEPTH = 0x00048005, +@@ -108,6 +115,10 @@ enum rpi_firmware_property_tag { + RPI_FIRMWARE_FRAMEBUFFER_SET_VIRTUAL_OFFSET = 0x00048009, + RPI_FIRMWARE_FRAMEBUFFER_SET_OVERSCAN = 0x0004800a, + RPI_FIRMWARE_FRAMEBUFFER_SET_PALETTE = 0x0004800b, ++ RPI_FIRMWARE_FRAMEBUFFER_SET_VSYNC = 0x0004800e, ++ RPI_FIRMWARE_FRAMEBUFFER_SET_BACKLIGHT = 0x0004800f, ++ ++ RPI_FIRMWARE_VCHIQ_INIT = 0x00048010, + + RPI_FIRMWARE_GET_COMMAND_LINE = 0x00050001, + RPI_FIRMWARE_GET_DMA_CHANNELS = 0x00060001, + +From a29233f17de884f942e0d232deb042796dcb5788 Mon Sep 17 00:00:00 2001 +From: popcornmix <popcornmix@gmail.com> +Date: Sun, 12 May 2013 12:24:19 +0100 +Subject: [PATCH 030/112] Main bcm2708/bcm2709 linux port +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: popcornmix <popcornmix@gmail.com> +Signed-off-by: Noralf Trønnes <noralf@tronnes.org> +--- + arch/arm/Kconfig | 49 +++ + arch/arm/Kconfig.debug | 8 + + arch/arm/Makefile | 2 + + arch/arm/kernel/head.S | 8 + + arch/arm/kernel/process.c | 10 + + arch/arm/mach-bcm2708/Kconfig | 23 ++ + arch/arm/mach-bcm2708/Makefile | 5 + + arch/arm/mach-bcm2708/Makefile.boot | 3 + + arch/arm/mach-bcm2708/bcm2708.c | 231 ++++++++++++ + arch/arm/mach-bcm2708/include/mach/debug-macro.S | 22 ++ + arch/arm/mach-bcm2708/include/mach/io.h | 27 ++ + arch/arm/mach-bcm2708/include/mach/memory.h | 57 +++ + arch/arm/mach-bcm2708/include/mach/platform.h | 112 ++++++ + arch/arm/mach-bcm2708/include/mach/system.h | 37 ++ + arch/arm/mach-bcm2708/include/mach/uncompress.h | 84 +++++ + arch/arm/mach-bcm2708/include/mach/vmalloc.h | 20 ++ + arch/arm/mach-bcm2709/Kconfig | 16 + + arch/arm/mach-bcm2709/Makefile | 5 + + arch/arm/mach-bcm2709/Makefile.boot | 3 + + arch/arm/mach-bcm2709/bcm2709.c | 380 ++++++++++++++++++++ + arch/arm/mach-bcm2709/include/mach/debug-macro.S | 22 ++ + arch/arm/mach-bcm2709/include/mach/entry-macro.S | 123 +++++++ + arch/arm/mach-bcm2709/include/mach/io.h | 27 ++ + arch/arm/mach-bcm2709/include/mach/memory.h | 57 +++ + arch/arm/mach-bcm2709/include/mach/platform.h | 188 ++++++++++ + arch/arm/mach-bcm2709/include/mach/system.h | 37 ++ + arch/arm/mach-bcm2709/include/mach/uncompress.h | 84 +++++ + arch/arm/mach-bcm2709/include/mach/vc_mem.h | 35 ++ + arch/arm/mach-bcm2709/include/mach/vmalloc.h | 20 ++ + arch/arm/mach-bcm2709/vc_mem.c | 431 +++++++++++++++++++++++ + arch/arm/mm/proc-v6.S | 15 +- + arch/arm/tools/mach-types | 2 + + drivers/clocksource/Makefile | 2 +- + drivers/irqchip/Makefile | 3 + + drivers/irqchip/irq-bcm2835.c | 3 +- + include/linux/mmc/host.h | 1 + + 36 files changed, 2147 insertions(+), 5 deletions(-) + create mode 100644 arch/arm/mach-bcm2708/Kconfig + create mode 100644 arch/arm/mach-bcm2708/Makefile + create mode 100644 arch/arm/mach-bcm2708/Makefile.boot + create mode 100644 arch/arm/mach-bcm2708/bcm2708.c + create mode 100644 arch/arm/mach-bcm2708/include/mach/debug-macro.S + create mode 100644 arch/arm/mach-bcm2708/include/mach/io.h + create mode 100644 arch/arm/mach-bcm2708/include/mach/memory.h + create mode 100644 arch/arm/mach-bcm2708/include/mach/platform.h + create mode 100644 arch/arm/mach-bcm2708/include/mach/system.h + create mode 100644 arch/arm/mach-bcm2708/include/mach/uncompress.h + create mode 100644 arch/arm/mach-bcm2708/include/mach/vmalloc.h + create mode 100644 arch/arm/mach-bcm2709/Kconfig + create mode 100644 arch/arm/mach-bcm2709/Makefile + create mode 100644 arch/arm/mach-bcm2709/Makefile.boot + create mode 100644 arch/arm/mach-bcm2709/bcm2709.c + create mode 100644 arch/arm/mach-bcm2709/include/mach/debug-macro.S + create mode 100644 arch/arm/mach-bcm2709/include/mach/entry-macro.S + create mode 100644 arch/arm/mach-bcm2709/include/mach/io.h + create mode 100644 arch/arm/mach-bcm2709/include/mach/memory.h + create mode 100644 arch/arm/mach-bcm2709/include/mach/platform.h + create mode 100644 arch/arm/mach-bcm2709/include/mach/system.h + create mode 100644 arch/arm/mach-bcm2709/include/mach/uncompress.h + create mode 100644 arch/arm/mach-bcm2709/include/mach/vc_mem.h + create mode 100644 arch/arm/mach-bcm2709/include/mach/vmalloc.h + create mode 100644 arch/arm/mach-bcm2709/vc_mem.c + +diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig +index cdfa6c2..aad7157 100644 +--- a/arch/arm/Kconfig ++++ b/arch/arm/Kconfig +@@ -322,6 +322,52 @@ choice + default ARM_SINGLE_ARMV7M if !MMU + default ARCH_MULTIPLATFORM if MMU + ++config ARCH_BCM2708 ++ bool "Broadcom BCM2708 family" ++ select CPU_V6 ++ select ARM_AMBA ++ select CLKSRC_MMIO ++ select CLKSRC_OF if OF ++ select HAVE_SCHED_CLOCK ++ select NEED_MACH_GPIO_H ++ select NEED_MACH_MEMORY_H ++ select COMMON_CLK ++ select ARCH_HAS_CPUFREQ ++ select GENERIC_CLOCKEVENTS ++ select ARM_ERRATA_411920 ++ select MACH_BCM2708 ++ select MULTI_IRQ_HANDLER ++ select SPARSE_IRQ ++ select VC4 ++ select FIQ ++ help ++ This enables support for Broadcom BCM2708 boards. ++ ++config ARCH_BCM2709 ++ bool "Broadcom BCM2709 family" ++ select CPU_V7 ++ select HAVE_SMP ++ select ARM_AMBA ++ select MIGHT_HAVE_CACHE_L2X0 ++ select HAVE_SCHED_CLOCK ++ select NEED_MACH_MEMORY_H ++ select NEED_MACH_IO_H ++ select COMMON_CLK ++ select ARCH_HAS_CPUFREQ ++ select GENERIC_CLOCKEVENTS ++ select MACH_BCM2709 ++ select MULTI_IRQ_HANDLER ++ select SPARSE_IRQ ++ select MFD_SYSCON ++ select VC4 ++ select FIQ ++ select USE_OF ++ select ARCH_REQUIRE_GPIOLIB ++ select PINCTRL ++ select PINCTRL_BCM2835 ++ help ++ This enables support for Broadcom BCM2709 boards. ++ + config ARCH_MULTIPLATFORM + bool "Allow multiple platforms to be selected" + depends on MMU +@@ -721,6 +767,9 @@ config ARCH_VIRT + # Kconfigs may be included either alphabetically (according to the + # plat- suffix) or along side the corresponding mach-* source. + # ++source "arch/arm/mach-bcm2708/Kconfig" ++source "arch/arm/mach-bcm2709/Kconfig" ++ + source "arch/arm/mach-mvebu/Kconfig" + + source "arch/arm/mach-alpine/Kconfig" +diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug +index 1098e91..e119675 100644 +--- a/arch/arm/Kconfig.debug ++++ b/arch/arm/Kconfig.debug +@@ -1302,6 +1302,14 @@ choice + options; the platform specific options are deprecated + and will be soon removed. + ++ config DEBUG_BCM2708_UART0 ++ bool "Broadcom BCM270X UART0 (PL011)" ++ depends on ARCH_BCM2708 || ARCH_BCM2709 ++ help ++ Say Y here if you want the debug print routines to direct ++ their output to UART 0. The port must have been initialised ++ by the boot-loader before use. ++ + endchoice + + config DEBUG_EXYNOS_UART +diff --git a/arch/arm/Makefile b/arch/arm/Makefile +index 8c3ce2a..c4d7d10 100644 +--- a/arch/arm/Makefile ++++ b/arch/arm/Makefile +@@ -153,6 +153,8 @@ textofs-$(CONFIG_ARCH_AXXIA) := 0x00308000 + + # Machine directory name. This list is sorted alphanumerically + # by CONFIG_* macro name. ++machine-$(CONFIG_ARCH_BCM2708) += bcm2708 ++machine-$(CONFIG_ARCH_BCM2709) += bcm2709 + machine-$(CONFIG_ARCH_ALPINE) += alpine + machine-$(CONFIG_ARCH_ARTPEC) += artpec + machine-$(CONFIG_ARCH_AT91) += at91 +diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S +index 04286fd..ed82628 100644 +--- a/arch/arm/kernel/head.S ++++ b/arch/arm/kernel/head.S +@@ -700,6 +700,14 @@ ARM_BE8(rev16 ip, ip) + ldrcc r7, [r4], #4 @ use branch for delay slot + bcc 1b + ret lr ++ nop ++ nop ++ nop ++ nop ++ nop ++ nop ++ nop ++ nop + #endif + ENDPROC(__fixup_a_pv_table) + +diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c +index 4adfb46..69aad0e 100644 +--- a/arch/arm/kernel/process.c ++++ b/arch/arm/kernel/process.c +@@ -91,6 +91,16 @@ void arch_cpu_idle_exit(void) + ledtrig_cpu(CPU_LED_IDLE_END); + } + ++char bcm2708_reboot_mode = 'h'; ++ ++int __init reboot_setup(char *str) ++{ ++ bcm2708_reboot_mode = str[0]; ++ return 1; ++} ++ ++__setup("reboot=", reboot_setup); ++ + void __show_regs(struct pt_regs *regs) + { + unsigned long flags; +diff --git a/arch/arm/mach-bcm2708/Kconfig b/arch/arm/mach-bcm2708/Kconfig +new file mode 100644 +index 0000000..6eabe84 +--- /dev/null ++++ b/arch/arm/mach-bcm2708/Kconfig +@@ -0,0 +1,23 @@ ++menu "Broadcom BCM2708 Implementations" ++ depends on ARCH_BCM2708 ++ ++config MACH_BCM2708 ++ bool "Broadcom BCM2708 Development Platform" ++ select NEED_MACH_MEMORY_H ++ select NEED_MACH_IO_H ++ select CPU_V6 ++ select USE_OF ++ select ARCH_REQUIRE_GPIOLIB ++ select PINCTRL ++ select PINCTRL_BCM2835 ++ help ++ Include support for the Broadcom(R) BCM2708 platform. ++ ++config BCM2708_NOL2CACHE ++ bool "Videocore L2 cache disable" ++ depends on MACH_BCM2708 ++ default n ++ help ++ Do not allow ARM to use GPU's L2 cache. Requires disable_l2cache in config.txt. ++ ++endmenu +diff --git a/arch/arm/mach-bcm2708/Makefile b/arch/arm/mach-bcm2708/Makefile +new file mode 100644 +index 0000000..3da1a1b +--- /dev/null ++++ b/arch/arm/mach-bcm2708/Makefile +@@ -0,0 +1,5 @@ ++# ++# Makefile for the linux kernel. ++# ++ ++obj-$(CONFIG_MACH_BCM2708) += bcm2708.o +diff --git a/arch/arm/mach-bcm2708/Makefile.boot b/arch/arm/mach-bcm2708/Makefile.boot +new file mode 100644 +index 0000000..67039c3 +--- /dev/null ++++ b/arch/arm/mach-bcm2708/Makefile.boot +@@ -0,0 +1,3 @@ ++ zreladdr-y := 0x00008000 ++params_phys-y := 0x00000100 ++initrd_phys-y := 0x00800000 +diff --git a/arch/arm/mach-bcm2708/bcm2708.c b/arch/arm/mach-bcm2708/bcm2708.c +new file mode 100644 +index 0000000..280628b +--- /dev/null ++++ b/arch/arm/mach-bcm2708/bcm2708.c +@@ -0,0 +1,231 @@ ++/* ++ * linux/arch/arm/mach-bcm2708/bcm2708.c ++ * ++ * Copyright (C) 2010 Broadcom ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ */ ++ ++#include <linux/init.h> ++#include <linux/dma-mapping.h> ++#include <linux/module.h> ++#include <linux/of_platform.h> ++#include <asm/system_info.h> ++#include <asm/mach-types.h> ++#include <asm/mach/arch.h> ++#include <asm/mach/map.h> ++ ++#include <mach/system.h> ++ ++#include <linux/broadcom/vc_cma.h> ++ ++/* Effectively we have an IOMMU (ARM<->VideoCore map) that is set up to ++ * give us IO access only to 64Mbytes of physical memory (26 bits). We could ++ * represent this window by setting our dmamasks to 26 bits but, in fact ++ * we're not going to use addresses outside this range (they're not in real ++ * memory) so we don't bother. ++ * ++ * In the future we might include code to use this IOMMU to remap other ++ * physical addresses onto VideoCore memory then the use of 32-bits would be ++ * more legitimate. ++ */ ++ ++/* command line parameters */ ++static unsigned boardrev, serial; ++static unsigned reboot_part = 0; ++ ++static struct map_desc bcm2708_io_desc[] __initdata = { ++ { ++ .virtual = IO_ADDRESS(ARMCTRL_BASE), ++ .pfn = __phys_to_pfn(ARMCTRL_BASE), ++ .length = SZ_4K, ++ .type = MT_DEVICE}, ++ { ++ .virtual = IO_ADDRESS(UART0_BASE), ++ .pfn = __phys_to_pfn(UART0_BASE), ++ .length = SZ_4K, ++ .type = MT_DEVICE}, ++ { ++ .virtual = IO_ADDRESS(UART1_BASE), ++ .pfn = __phys_to_pfn(UART1_BASE), ++ .length = SZ_4K, ++ .type = MT_DEVICE}, ++ { ++ .virtual = IO_ADDRESS(DMA_BASE), ++ .pfn = __phys_to_pfn(DMA_BASE), ++ .length = SZ_4K, ++ .type = MT_DEVICE}, ++ { ++ .virtual = IO_ADDRESS(MCORE_BASE), ++ .pfn = __phys_to_pfn(MCORE_BASE), ++ .length = SZ_4K, ++ .type = MT_DEVICE}, ++ { ++ .virtual = IO_ADDRESS(ST_BASE), ++ .pfn = __phys_to_pfn(ST_BASE), ++ .length = SZ_4K, ++ .type = MT_DEVICE}, ++ { ++ .virtual = IO_ADDRESS(USB_BASE), ++ .pfn = __phys_to_pfn(USB_BASE), ++ .length = SZ_128K, ++ .type = MT_DEVICE}, ++ { ++ .virtual = IO_ADDRESS(PM_BASE), ++ .pfn = __phys_to_pfn(PM_BASE), ++ .length = SZ_4K, ++ .type = MT_DEVICE}, ++ { ++ .virtual = IO_ADDRESS(GPIO_BASE), ++ .pfn = __phys_to_pfn(GPIO_BASE), ++ .length = SZ_4K, ++ .type = MT_DEVICE} ++}; ++ ++void __init bcm2708_map_io(void) ++{ ++ iotable_init(bcm2708_io_desc, ARRAY_SIZE(bcm2708_io_desc)); ++} ++ ++int calc_rsts(int partition) ++{ ++ return PM_PASSWORD | ++ ((partition & (1 << 0)) << 0) | ++ ((partition & (1 << 1)) << 1) | ++ ((partition & (1 << 2)) << 2) | ++ ((partition & (1 << 3)) << 3) | ++ ((partition & (1 << 4)) << 4) | ++ ((partition & (1 << 5)) << 5); ++} ++ ++static void bcm2708_restart(enum reboot_mode mode, const char *cmd) ++{ ++ extern char bcm2708_reboot_mode; ++ uint32_t pm_rstc, pm_wdog; ++ uint32_t timeout = 10; ++ uint32_t pm_rsts = 0; ++ ++ if(bcm2708_reboot_mode == 'q') ++ { ++ // NOOBS < 1.3 booting with reboot=q ++ pm_rsts = readl(__io_address(PM_RSTS)); ++ pm_rsts = PM_PASSWORD | pm_rsts | PM_RSTS_HADWRQ_SET; ++ } ++ else if(bcm2708_reboot_mode == 'p') ++ { ++ // NOOBS < 1.3 halting ++ pm_rsts = readl(__io_address(PM_RSTS)); ++ pm_rsts = PM_PASSWORD | pm_rsts | PM_RSTS_HADWRH_SET; ++ } ++ else ++ { ++ pm_rsts = calc_rsts(reboot_part); ++ } ++ ++ writel(pm_rsts, __io_address(PM_RSTS)); ++ ++ /* Setup watchdog for reset */ ++ pm_rstc = readl(__io_address(PM_RSTC)); ++ ++ pm_wdog = PM_PASSWORD | (timeout & PM_WDOG_TIME_SET); // watchdog timer = timer clock / 16; need password (31:16) + value (11:0) ++ pm_rstc = PM_PASSWORD | (pm_rstc & PM_RSTC_WRCFG_CLR) | PM_RSTC_WRCFG_FULL_RESET; ++ ++ writel(pm_wdog, __io_address(PM_WDOG)); ++ writel(pm_rstc, __io_address(PM_RSTC)); ++} ++ ++/* We can't really power off, but if we do the normal reset scheme, and indicate to bootcode.bin not to reboot, then most of the chip will be powered off */ ++static void bcm2708_power_off(void) ++{ ++ extern char bcm2708_reboot_mode; ++ if(bcm2708_reboot_mode == 'q') ++ { ++ // NOOBS < v1.3 ++ bcm2708_restart('p', ""); ++ } ++ else ++ { ++ /* partition 63 is special code for HALT the bootloader knows not to boot*/ ++ reboot_part = 63; ++ /* continue with normal reset mechanism */ ++ bcm2708_restart(0, ""); ++ } ++} ++ ++static void __init bcm2708_init_uart1(void) ++{ ++ struct device_node *np; ++ ++ np = of_find_compatible_node(NULL, NULL, "brcm,bcm2835-aux-uart"); ++ if (of_device_is_available(np)) { ++ pr_info("bcm2708: Mini UART enabled\n"); ++ writel(1, __io_address(UART1_BASE + 0x4)); ++ } ++} ++ ++void __init bcm2708_init(void) ++{ ++ int ret; ++ ++ vc_cma_early_init(); ++ ++ pm_power_off = bcm2708_power_off; ++ ++ ret = of_platform_populate(NULL, of_default_bus_match_table, NULL, ++ NULL); ++ if (ret) { ++ pr_err("of_platform_populate failed: %d\n", ret); ++ BUG(); ++ } ++ ++ bcm2708_init_uart1(); ++ ++ system_rev = boardrev; ++ system_serial_low = serial; ++} ++ ++void __init bcm2708_init_early(void) ++{ ++ /* ++ * Some devices allocate their coherent buffers from atomic ++ * context. Increase size of atomic coherent pool to make sure such ++ * the allocations won't fail. ++ */ ++ init_dma_coherent_pool_size(SZ_4M); ++} ++ ++static void __init board_reserve(void) ++{ ++ vc_cma_reserve(); ++} ++ ++static const char * const bcm2708_compat[] = { ++ "brcm,bcm2708", ++ NULL ++}; ++ ++MACHINE_START(BCM2708, "BCM2708") ++ /* Maintainer: Broadcom Europe Ltd. */ ++ .map_io = bcm2708_map_io, ++ .init_machine = bcm2708_init, ++ .init_early = bcm2708_init_early, ++ .reserve = board_reserve, ++ .restart = bcm2708_restart, ++ .dt_compat = bcm2708_compat, ++MACHINE_END ++ ++module_param(boardrev, uint, 0644); ++module_param(serial, uint, 0644); ++module_param(reboot_part, uint, 0644); +diff --git a/arch/arm/mach-bcm2708/include/mach/debug-macro.S b/arch/arm/mach-bcm2708/include/mach/debug-macro.S +new file mode 100644 +index 0000000..b24304a +--- /dev/null ++++ b/arch/arm/mach-bcm2708/include/mach/debug-macro.S +@@ -0,0 +1,22 @@ ++/* arch/arm/mach-bcm2708/include/mach/debug-macro.S ++ * ++ * Debugging macro include header ++ * ++ * Copyright (C) 2010 Broadcom ++ * Copyright (C) 1994-1999 Russell King ++ * Moved from linux/arch/arm/kernel/debug.S by Ben Dooks ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 as ++ * published by the Free Software Foundation. ++ * ++*/ ++ ++#include <mach/platform.h> ++ ++ .macro addruart, rp, rv, tmp ++ ldr \rp, =UART0_BASE ++ ldr \rv, =IO_ADDRESS(UART0_BASE) ++ .endm ++ ++#include <debug/pl01x.S> +diff --git a/arch/arm/mach-bcm2708/include/mach/io.h b/arch/arm/mach-bcm2708/include/mach/io.h +new file mode 100644 +index 0000000..e6eb84d +--- /dev/null ++++ b/arch/arm/mach-bcm2708/include/mach/io.h +@@ -0,0 +1,27 @@ ++/* ++ * arch/arm/mach-bcm2708/include/mach/io.h ++ * ++ * Copyright (C) 2003 ARM Limited ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ */ ++#ifndef __ASM_ARM_ARCH_IO_H ++#define __ASM_ARM_ARCH_IO_H ++ ++#define IO_SPACE_LIMIT 0xffffffff ++ ++#define __io(a) __typesafe_io(a) ++ ++#endif +diff --git a/arch/arm/mach-bcm2708/include/mach/memory.h b/arch/arm/mach-bcm2708/include/mach/memory.h +new file mode 100644 +index 0000000..7548a52 +--- /dev/null ++++ b/arch/arm/mach-bcm2708/include/mach/memory.h +@@ -0,0 +1,57 @@ ++/* ++ * arch/arm/mach-bcm2708/include/mach/memory.h ++ * ++ * Copyright (C) 2010 Broadcom ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ */ ++#ifndef __ASM_ARCH_MEMORY_H ++#define __ASM_ARCH_MEMORY_H ++ ++/* Memory overview: ++ ++ [ARMcore] <--virtual addr--> ++ [ARMmmu] <--physical addr--> ++ [GERTmap] <--bus add--> ++ [VCperiph] ++ ++*/ ++ ++/* ++ * Physical DRAM offset. ++ */ ++#define BCM_PLAT_PHYS_OFFSET UL(0x00000000) ++#define VC_ARMMEM_OFFSET UL(0x00000000) /* offset in VC of ARM memory */ ++ ++#ifdef CONFIG_BCM2708_NOL2CACHE ++ #define _REAL_BUS_OFFSET UL(0xC0000000) /* don't use L1 or L2 caches */ ++#else ++ #define _REAL_BUS_OFFSET UL(0x40000000) /* use L2 cache */ ++#endif ++ ++/* We're using the memory at 64M in the VideoCore for Linux - this adjustment ++ * will provide the offset into this area as well as setting the bits that ++ * stop the L1 and L2 cache from being used ++ * ++ * WARNING: this only works because the ARM is given memory at a fixed location ++ * (ARMMEM_OFFSET) ++ */ ++#define BUS_OFFSET (VC_ARMMEM_OFFSET + _REAL_BUS_OFFSET) ++#define __virt_to_bus(x) ((x) + (BUS_OFFSET - PAGE_OFFSET)) ++#define __bus_to_virt(x) ((x) - (BUS_OFFSET - PAGE_OFFSET)) ++#define __pfn_to_bus(x) (__pfn_to_phys(x) + (BUS_OFFSET - BCM_PLAT_PHYS_OFFSET)) ++#define __bus_to_pfn(x) __phys_to_pfn((x) - (BUS_OFFSET - BCM_PLAT_PHYS_OFFSET)) ++ ++#endif +diff --git a/arch/arm/mach-bcm2708/include/mach/platform.h b/arch/arm/mach-bcm2708/include/mach/platform.h +new file mode 100644 +index 0000000..4fb43cf +--- /dev/null ++++ b/arch/arm/mach-bcm2708/include/mach/platform.h +@@ -0,0 +1,112 @@ ++/* ++ * arch/arm/mach-bcm2708/include/mach/platform.h ++ * ++ * Copyright (C) 2010 Broadcom ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ */ ++ ++#ifndef _BCM2708_PLATFORM_H ++#define _BCM2708_PLATFORM_H ++ ++ ++/* macros to get at IO space when running virtually */ ++#define IO_ADDRESS(x) (((x) & 0x0fffffff) + (((x) >> 4) & 0x0f000000) + 0xf0000000) ++ ++#define __io_address(n) IOMEM(IO_ADDRESS(n)) ++ ++ ++/* ++ * SDRAM ++ */ ++#define BCM2708_SDRAM_BASE 0x00000000 ++ ++/* ++ * Logic expansion modules ++ * ++ */ ++ ++ ++/* ------------------------------------------------------------------------ ++ * BCM2708 ARMCTRL Registers ++ * ------------------------------------------------------------------------ ++ */ ++ ++#define HW_REGISTER_RW(addr) (addr) ++#define HW_REGISTER_RO(addr) (addr) ++ ++/* ++ * Definitions and addresses for the ARM CONTROL logic ++ * This file is manually generated. ++ */ ++ ++#define BCM2708_PERI_BASE 0x20000000 ++#define IC0_BASE (BCM2708_PERI_BASE + 0x2000) ++#define ST_BASE (BCM2708_PERI_BASE + 0x3000) /* System Timer */ ++#define MPHI_BASE (BCM2708_PERI_BASE + 0x6000) /* Message -based Parallel Host Interface */ ++#define DMA_BASE (BCM2708_PERI_BASE + 0x7000) /* DMA controller */ ++#define ARM_BASE (BCM2708_PERI_BASE + 0xB000) /* BCM2708 ARM control block */ ++#define PM_BASE (BCM2708_PERI_BASE + 0x100000) /* Power Management, Reset controller and Watchdog registers */ ++#define PCM_CLOCK_BASE (BCM2708_PERI_BASE + 0x101098) /* PCM Clock */ ++#define RNG_BASE (BCM2708_PERI_BASE + 0x104000) /* Hardware RNG */ ++#define GPIO_BASE (BCM2708_PERI_BASE + 0x200000) /* GPIO */ ++#define UART0_BASE (BCM2708_PERI_BASE + 0x201000) /* Uart 0 */ ++#define MMCI0_BASE (BCM2708_PERI_BASE + 0x202000) /* MMC interface */ ++#define I2S_BASE (BCM2708_PERI_BASE + 0x203000) /* I2S */ ++#define SPI0_BASE (BCM2708_PERI_BASE + 0x204000) /* SPI0 */ ++#define BSC0_BASE (BCM2708_PERI_BASE + 0x205000) /* BSC0 I2C/TWI */ ++#define UART1_BASE (BCM2708_PERI_BASE + 0x215000) /* Uart 1 */ ++#define EMMC_BASE (BCM2708_PERI_BASE + 0x300000) /* eMMC interface */ ++#define SMI_BASE (BCM2708_PERI_BASE + 0x600000) /* SMI */ ++#define BSC1_BASE (BCM2708_PERI_BASE + 0x804000) /* BSC1 I2C/TWI */ ++#define USB_BASE (BCM2708_PERI_BASE + 0x980000) /* DTC_OTG USB controller */ ++#define MCORE_BASE (BCM2708_PERI_BASE + 0x0000) /* Fake frame buffer device (actually the multicore sync block*/ ++ ++#define ARMCTRL_BASE (ARM_BASE + 0x000) ++#define ARMCTRL_IC_BASE (ARM_BASE + 0x200) /* ARM interrupt controller */ ++#define ARMCTRL_TIMER0_1_BASE (ARM_BASE + 0x400) /* Timer 0 and 1 */ ++#define ARMCTRL_0_SBM_BASE (ARM_BASE + 0x800) /* User 0 (ARM)'s Semaphores Doorbells and Mailboxes */ ++ ++/* ++ * Watchdog ++ */ ++#define PM_RSTC (PM_BASE+0x1c) ++#define PM_RSTS (PM_BASE+0x20) ++#define PM_WDOG (PM_BASE+0x24) ++ ++#define PM_WDOG_RESET 0000000000 ++#define PM_PASSWORD 0x5a000000 ++#define PM_WDOG_TIME_SET 0x000fffff ++#define PM_RSTC_WRCFG_CLR 0xffffffcf ++#define PM_RSTC_WRCFG_SET 0x00000030 ++#define PM_RSTC_WRCFG_FULL_RESET 0x00000020 ++#define PM_RSTC_RESET 0x00000102 ++ ++#define PM_RSTS_HADPOR_SET 0x00001000 ++#define PM_RSTS_HADSRH_SET 0x00000400 ++#define PM_RSTS_HADSRF_SET 0x00000200 ++#define PM_RSTS_HADSRQ_SET 0x00000100 ++#define PM_RSTS_HADWRH_SET 0x00000040 ++#define PM_RSTS_HADWRF_SET 0x00000020 ++#define PM_RSTS_HADWRQ_SET 0x00000010 ++#define PM_RSTS_HADDRH_SET 0x00000004 ++#define PM_RSTS_HADDRF_SET 0x00000002 ++#define PM_RSTS_HADDRQ_SET 0x00000001 ++ ++#define UART0_CLOCK 3000000 ++ ++#endif ++ ++/* END */ +diff --git a/arch/arm/mach-bcm2708/include/mach/system.h b/arch/arm/mach-bcm2708/include/mach/system.h +new file mode 100644 +index 0000000..c9a9c9a +--- /dev/null ++++ b/arch/arm/mach-bcm2708/include/mach/system.h +@@ -0,0 +1,37 @@ ++/* ++ * arch/arm/mach-bcm2708/include/mach/system.h ++ * ++ * Copyright (C) 2010 Broadcom ++ * Copyright (C) 2003 ARM Limited ++ * Copyright (C) 2000 Deep Blue Solutions Ltd ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ */ ++#ifndef __ASM_ARCH_SYSTEM_H ++#define __ASM_ARCH_SYSTEM_H ++ ++#include <linux/io.h> ++#include <mach/platform.h> ++ ++static inline void arch_idle(void) ++{ ++ /* ++ * This should do all the clock switching ++ * and wait for interrupt tricks ++ */ ++ cpu_do_idle(); ++} ++ ++#endif +diff --git a/arch/arm/mach-bcm2708/include/mach/uncompress.h b/arch/arm/mach-bcm2708/include/mach/uncompress.h +new file mode 100644 +index 0000000..de7504b +--- /dev/null ++++ b/arch/arm/mach-bcm2708/include/mach/uncompress.h +@@ -0,0 +1,84 @@ ++/* ++ * arch/arm/mach-bcn2708/include/mach/uncompress.h ++ * ++ * Copyright (C) 2010 Broadcom ++ * Copyright (C) 2003 ARM Limited ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ */ ++ ++#include <linux/io.h> ++#include <linux/amba/serial.h> ++#include <mach/platform.h> ++ ++#define UART_BAUD 115200 ++ ++#define BCM2708_UART_DR __io(UART0_BASE + UART01x_DR) ++#define BCM2708_UART_FR __io(UART0_BASE + UART01x_FR) ++#define BCM2708_UART_IBRD __io(UART0_BASE + UART011_IBRD) ++#define BCM2708_UART_FBRD __io(UART0_BASE + UART011_FBRD) ++#define BCM2708_UART_LCRH __io(UART0_BASE + UART011_LCRH) ++#define BCM2708_UART_CR __io(UART0_BASE + UART011_CR) ++ ++/* ++ * This does not append a newline ++ */ ++static inline void putc(int c) ++{ ++ while (__raw_readl(BCM2708_UART_FR) & UART01x_FR_TXFF) ++ barrier(); ++ ++ __raw_writel(c, BCM2708_UART_DR); ++} ++ ++static inline void flush(void) ++{ ++ int fr; ++ ++ do { ++ fr = __raw_readl(BCM2708_UART_FR); ++ barrier(); ++ } while ((fr & (UART011_FR_TXFE | UART01x_FR_BUSY)) != UART011_FR_TXFE); ++} ++ ++static inline void arch_decomp_setup(void) ++{ ++ int temp, div, rem, frac; ++ ++ temp = 16 * UART_BAUD; ++ div = UART0_CLOCK / temp; ++ rem = UART0_CLOCK % temp; ++ temp = (8 * rem) / UART_BAUD; ++ frac = (temp >> 1) + (temp & 1); ++ ++ /* Make sure the UART is disabled before we start */ ++ __raw_writel(0, BCM2708_UART_CR); ++ ++ /* Set the baud rate */ ++ __raw_writel(div, BCM2708_UART_IBRD); ++ __raw_writel(frac, BCM2708_UART_FBRD); ++ ++ /* Set the UART to 8n1, FIFO enabled */ ++ __raw_writel(UART01x_LCRH_WLEN_8 | UART01x_LCRH_FEN, BCM2708_UART_LCRH); ++ ++ /* Enable the UART */ ++ __raw_writel(UART01x_CR_UARTEN | UART011_CR_TXE | UART011_CR_RXE, ++ BCM2708_UART_CR); ++} ++ ++/* ++ * nothing to do ++ */ ++#define arch_decomp_wdog() +diff --git a/arch/arm/mach-bcm2708/include/mach/vmalloc.h b/arch/arm/mach-bcm2708/include/mach/vmalloc.h +new file mode 100644 +index 0000000..502c617 +--- /dev/null ++++ b/arch/arm/mach-bcm2708/include/mach/vmalloc.h +@@ -0,0 +1,20 @@ ++/* ++ * arch/arm/mach-bcm2708/include/mach/vmalloc.h ++ * ++ * Copyright (C) 2010 Broadcom ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ */ ++#define VMALLOC_END (0xe8000000) +diff --git a/arch/arm/mach-bcm2709/Kconfig b/arch/arm/mach-bcm2709/Kconfig +new file mode 100644 +index 0000000..643b4b9 +--- /dev/null ++++ b/arch/arm/mach-bcm2709/Kconfig +@@ -0,0 +1,16 @@ ++menu "Broadcom BCM2709 Implementations" ++ depends on ARCH_BCM2709 ++ ++config MACH_BCM2709 ++ bool "Broadcom BCM2709 Development Platform" ++ help ++ Include support for the Broadcom(R) BCM2709 platform. ++ ++config BCM2708_NOL2CACHE ++ bool "Videocore L2 cache disable" ++ depends on MACH_BCM2709 ++ default y ++ help ++ Do not allow ARM to use GPU's L2 cache. Requires disable_l2cache in config.txt. ++ ++endmenu +diff --git a/arch/arm/mach-bcm2709/Makefile b/arch/arm/mach-bcm2709/Makefile +new file mode 100644 +index 0000000..26cd67d +--- /dev/null ++++ b/arch/arm/mach-bcm2709/Makefile +@@ -0,0 +1,5 @@ ++# ++# Makefile for the linux kernel. ++# ++ ++obj-$(CONFIG_MACH_BCM2709) += bcm2709.o +diff --git a/arch/arm/mach-bcm2709/Makefile.boot b/arch/arm/mach-bcm2709/Makefile.boot +new file mode 100644 +index 0000000..67039c3 +--- /dev/null ++++ b/arch/arm/mach-bcm2709/Makefile.boot +@@ -0,0 +1,3 @@ ++ zreladdr-y := 0x00008000 ++params_phys-y := 0x00000100 ++initrd_phys-y := 0x00800000 +diff --git a/arch/arm/mach-bcm2709/bcm2709.c b/arch/arm/mach-bcm2709/bcm2709.c +new file mode 100644 +index 0000000..90773a3 +--- /dev/null ++++ b/arch/arm/mach-bcm2709/bcm2709.c +@@ -0,0 +1,380 @@ ++/* ++ * linux/arch/arm/mach-bcm2709/bcm2709.c ++ * ++ * Copyright (C) 2010 Broadcom ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ */ ++ ++#include <linux/init.h> ++#include <linux/dma-mapping.h> ++#include <linux/interrupt.h> ++#include <linux/clk-provider.h> ++#include <linux/clocksource.h> ++#include <linux/io.h> ++#include <linux/module.h> ++#include <linux/of_platform.h> ++ ++#include <asm/system_info.h> ++#include <asm/mach-types.h> ++#include <asm/cputype.h> ++ ++#include <asm/mach/arch.h> ++#include <asm/mach/map.h> ++ ++#include <mach/system.h> ++ ++#include <linux/broadcom/vc_cma.h> ++ ++/* Effectively we have an IOMMU (ARM<->VideoCore map) that is set up to ++ * give us IO access only to 64Mbytes of physical memory (26 bits). We could ++ * represent this window by setting our dmamasks to 26 bits but, in fact ++ * we're not going to use addresses outside this range (they're not in real ++ * memory) so we don't bother. ++ * ++ * In the future we might include code to use this IOMMU to remap other ++ * physical addresses onto VideoCore memory then the use of 32-bits would be ++ * more legitimate. ++ */ ++ ++/* command line parameters */ ++static unsigned boardrev, serial; ++static unsigned reboot_part = 0; ++ ++static struct map_desc bcm2709_io_desc[] __initdata = { ++ { ++ .virtual = IO_ADDRESS(ARMCTRL_BASE), ++ .pfn = __phys_to_pfn(ARMCTRL_BASE), ++ .length = SZ_4K, ++ .type = MT_DEVICE}, ++ { ++ .virtual = IO_ADDRESS(UART0_BASE), ++ .pfn = __phys_to_pfn(UART0_BASE), ++ .length = SZ_4K, ++ .type = MT_DEVICE}, ++ { ++ .virtual = IO_ADDRESS(UART1_BASE), ++ .pfn = __phys_to_pfn(UART1_BASE), ++ .length = SZ_4K, ++ .type = MT_DEVICE}, ++ { ++ .virtual = IO_ADDRESS(DMA_BASE), ++ .pfn = __phys_to_pfn(DMA_BASE), ++ .length = SZ_4K, ++ .type = MT_DEVICE}, ++ { ++ .virtual = IO_ADDRESS(MCORE_BASE), ++ .pfn = __phys_to_pfn(MCORE_BASE), ++ .length = SZ_4K, ++ .type = MT_DEVICE}, ++ { ++ .virtual = IO_ADDRESS(ST_BASE), ++ .pfn = __phys_to_pfn(ST_BASE), ++ .length = SZ_4K, ++ .type = MT_DEVICE}, ++ { ++ .virtual = IO_ADDRESS(USB_BASE), ++ .pfn = __phys_to_pfn(USB_BASE), ++ .length = SZ_128K, ++ .type = MT_DEVICE}, ++ { ++ .virtual = IO_ADDRESS(PM_BASE), ++ .pfn = __phys_to_pfn(PM_BASE), ++ .length = SZ_4K, ++ .type = MT_DEVICE}, ++ { ++ .virtual = IO_ADDRESS(GPIO_BASE), ++ .pfn = __phys_to_pfn(GPIO_BASE), ++ .length = SZ_4K, ++ .type = MT_DEVICE}, ++ { ++ .virtual = IO_ADDRESS(ARM_LOCAL_BASE), ++ .pfn = __phys_to_pfn(ARM_LOCAL_BASE), ++ .length = SZ_4K, ++ .type = MT_DEVICE}, ++}; ++ ++void __init bcm2709_map_io(void) ++{ ++ iotable_init(bcm2709_io_desc, ARRAY_SIZE(bcm2709_io_desc)); ++} ++ ++int calc_rsts(int partition) ++{ ++ return PM_PASSWORD | ++ ((partition & (1 << 0)) << 0) | ++ ((partition & (1 << 1)) << 1) | ++ ((partition & (1 << 2)) << 2) | ++ ((partition & (1 << 3)) << 3) | ++ ((partition & (1 << 4)) << 4) | ++ ((partition & (1 << 5)) << 5); ++} ++ ++static void bcm2709_restart(enum reboot_mode mode, const char *cmd) ++{ ++ extern char bcm2708_reboot_mode; ++ uint32_t pm_rstc, pm_wdog; ++ uint32_t timeout = 10; ++ uint32_t pm_rsts = 0; ++ ++ if(bcm2708_reboot_mode == 'q') ++ { ++ // NOOBS < 1.3 booting with reboot=q ++ pm_rsts = readl(__io_address(PM_RSTS)); ++ pm_rsts = PM_PASSWORD | pm_rsts | PM_RSTS_HADWRQ_SET; ++ } ++ else if(bcm2708_reboot_mode == 'p') ++ { ++ // NOOBS < 1.3 halting ++ pm_rsts = readl(__io_address(PM_RSTS)); ++ pm_rsts = PM_PASSWORD | pm_rsts | PM_RSTS_HADWRH_SET; ++ } ++ else ++ { ++ pm_rsts = calc_rsts(reboot_part); ++ } ++ ++ writel(pm_rsts, __io_address(PM_RSTS)); ++ ++ /* Setup watchdog for reset */ ++ pm_rstc = readl(__io_address(PM_RSTC)); ++ ++ pm_wdog = PM_PASSWORD | (timeout & PM_WDOG_TIME_SET); // watchdog timer = timer clock / 16; need password (31:16) + value (11:0) ++ pm_rstc = PM_PASSWORD | (pm_rstc & PM_RSTC_WRCFG_CLR) | PM_RSTC_WRCFG_FULL_RESET; ++ ++ writel(pm_wdog, __io_address(PM_WDOG)); ++ writel(pm_rstc, __io_address(PM_RSTC)); ++} ++ ++/* We can't really power off, but if we do the normal reset scheme, and indicate to bootcode.bin not to reboot, then most of the chip will be powered off */ ++static void bcm2709_power_off(void) ++{ ++ extern char bcm2708_reboot_mode; ++ if(bcm2708_reboot_mode == 'q') ++ { ++ // NOOBS < v1.3 ++ bcm2709_restart('p', ""); ++ } ++ else ++ { ++ /* partition 63 is special code for HALT the bootloader knows not to boot*/ ++ reboot_part = 63; ++ /* continue with normal reset mechanism */ ++ bcm2709_restart(0, ""); ++ } ++} ++ ++static void __init bcm2709_init_uart1(void) ++{ ++ struct device_node *np; ++ ++ np = of_find_compatible_node(NULL, NULL, "brcm,bcm2835-aux-uart"); ++ if (of_device_is_available(np)) { ++ pr_info("bcm2709: Mini UART enabled\n"); ++ writel(1, __io_address(UART1_BASE + 0x4)); ++ } ++} ++ ++void __init bcm2709_init(void) ++{ ++ int ret; ++ ++ vc_cma_early_init(); ++ ++ pm_power_off = bcm2709_power_off; ++ ++ ret = of_platform_populate(NULL, of_default_bus_match_table, NULL, ++ NULL); ++ if (ret) { ++ pr_err("of_platform_populate failed: %d\n", ret); ++ BUG(); ++ } ++ ++ bcm2709_init_uart1(); ++ ++ system_rev = boardrev; ++ system_serial_low = serial; ++} ++ ++static void __init bcm2709_timer_init(void) ++{ ++ // timer control ++ writel(0, __io_address(ARM_LOCAL_CONTROL)); ++ // timer pre_scaler ++ writel(0x80000000, __io_address(ARM_LOCAL_PRESCALER)); // 19.2MHz ++ //writel(0x06AAAAAB, __io_address(ARM_LOCAL_PRESCALER)); // 1MHz ++ ++ of_clk_init(NULL); ++ clocksource_probe(); ++} ++ ++ ++void __init bcm2709_init_early(void) ++{ ++ /* ++ * Some devices allocate their coherent buffers from atomic ++ * context. Increase size of atomic coherent pool to make sure such ++ * the allocations won't fail. ++ */ ++ init_dma_coherent_pool_size(SZ_4M); ++} ++ ++static void __init board_reserve(void) ++{ ++ vc_cma_reserve(); ++} ++ ++ ++#ifdef CONFIG_SMP ++#include <linux/smp.h> ++ ++#include <asm/cacheflush.h> ++#include <asm/smp_plat.h> ++int dc4=0; ++//void dc4_log(unsigned x) { if (dc4) writel((x), __io_address(ST_BASE+10 + raw_smp_processor_id()*4)); } ++void dc4_log_dead(unsigned x) { if (dc4) writel((readl(__io_address(ST_BASE+0x10 + raw_smp_processor_id()*4)) & 0xffff) | ((x)<<16), __io_address(ST_BASE+0x10 + raw_smp_processor_id()*4)); } ++ ++static void bcm2835_send_doorbell(const struct cpumask *mask, unsigned int irq) ++{ ++ int cpu; ++ /* ++ * Ensure that stores to Normal memory are visible to the ++ * other CPUs before issuing the IPI. ++ */ ++ dsb(); ++ ++ /* Convert our logical CPU mask into a physical one. */ ++ for_each_cpu(cpu, mask) ++ { ++ /* submit softirq */ ++ writel(1<<irq, __io_address(ARM_LOCAL_MAILBOX0_SET0 + 0x10 * MPIDR_AFFINITY_LEVEL(cpu_logical_map(cpu), 0))); ++ } ++} ++ ++void __init bcm2709_smp_init_cpus(void) ++{ ++ void secondary_startup(void); ++ unsigned int i, ncores; ++ ++ ncores = 4; // xxx scu_get_core_count(NULL); ++ printk("[%s] enter (%x->%x)\n", __FUNCTION__, (unsigned)virt_to_phys((void *)secondary_startup), (unsigned)__io_address(ST_BASE + 0x10)); ++ printk("[%s] ncores=%d\n", __FUNCTION__, ncores); ++ ++ for (i = 0; i < ncores; i++) { ++ set_cpu_possible(i, true); ++ /* enable IRQ (not FIQ) */ ++ writel(0x1, __io_address(ARM_LOCAL_MAILBOX_INT_CONTROL0 + 0x4 * i)); ++ //writel(0xf, __io_address(ARM_LOCAL_TIMER_INT_CONTROL0 + 0x4 * i)); ++ } ++ set_smp_cross_call(bcm2835_send_doorbell); ++} ++ ++/* ++ * for arch/arm/kernel/smp.c:smp_prepare_cpus(unsigned int max_cpus) ++ */ ++void __init bcm2709_smp_prepare_cpus(unsigned int max_cpus) ++{ ++ //void __iomem *scu_base; ++ ++ printk("[%s] enter\n", __FUNCTION__); ++ //scu_base = scu_base_addr(); ++ //scu_enable(scu_base); ++} ++ ++/* ++ * for linux/arch/arm/kernel/smp.c:secondary_start_kernel(void) ++ */ ++void __init bcm2709_secondary_init(unsigned int cpu) ++{ ++ printk("[%s] enter cpu:%d\n", __FUNCTION__, cpu); ++ //gic_secondary_init(0); ++} ++ ++/* ++ * for linux/arch/arm/kernel/smp.c:__cpu_up(..) ++ */ ++int __init bcm2709_boot_secondary(unsigned int cpu, struct task_struct *idle) ++{ ++ void secondary_startup(void); ++ void *mbox_set = __io_address(ARM_LOCAL_MAILBOX3_SET0 + 0x10 * MPIDR_AFFINITY_LEVEL(cpu_logical_map(cpu), 0)); ++ void *mbox_clr = __io_address(ARM_LOCAL_MAILBOX3_CLR0 + 0x10 * MPIDR_AFFINITY_LEVEL(cpu_logical_map(cpu), 0)); ++ unsigned secondary_boot = (unsigned)virt_to_phys((void *)secondary_startup); ++ int timeout=20; ++ unsigned t = -1; ++ //printk("[%s] enter cpu:%d (%x->%p) %x\n", __FUNCTION__, cpu, secondary_boot, wake, readl(wake)); ++ ++ dsb(); ++ BUG_ON(readl(mbox_clr) != 0); ++ writel(secondary_boot, mbox_set); ++ ++ while (--timeout > 0) { ++ t = readl(mbox_clr); ++ if (t == 0) break; ++ cpu_relax(); ++ } ++ if (timeout==0) ++ printk("[%s] cpu:%d failed to start (%x)\n", __FUNCTION__, cpu, t); ++ else ++ printk("[%s] cpu:%d started (%x) %d\n", __FUNCTION__, cpu, t, timeout); ++ ++ return 0; ++} ++ ++ ++struct smp_operations bcm2709_smp_ops __initdata = { ++ .smp_init_cpus = bcm2709_smp_init_cpus, ++ .smp_prepare_cpus = bcm2709_smp_prepare_cpus, ++ .smp_secondary_init = bcm2709_secondary_init, ++ .smp_boot_secondary = bcm2709_boot_secondary, ++}; ++#endif ++ ++static const char * const bcm2709_compat[] = { ++ "brcm,bcm2709", ++ "brcm,bcm2708", /* Could use bcm2708 in a pinch */ ++ NULL ++}; ++ ++MACHINE_START(BCM2709, "BCM2709") ++ /* Maintainer: Broadcom Europe Ltd. */ ++#ifdef CONFIG_SMP ++ .smp = smp_ops(bcm2709_smp_ops), ++#endif ++ .map_io = bcm2709_map_io, ++ .init_time = bcm2709_timer_init, ++ .init_machine = bcm2709_init, ++ .init_early = bcm2709_init_early, ++ .reserve = board_reserve, ++ .restart = bcm2709_restart, ++ .dt_compat = bcm2709_compat, ++MACHINE_END ++ ++MACHINE_START(BCM2708, "BCM2709") ++ /* Maintainer: Broadcom Europe Ltd. */ ++#ifdef CONFIG_SMP ++ .smp = smp_ops(bcm2709_smp_ops), ++#endif ++ .map_io = bcm2709_map_io, ++ .init_time = bcm2709_timer_init, ++ .init_machine = bcm2709_init, ++ .init_early = bcm2709_init_early, ++ .reserve = board_reserve, ++ .restart = bcm2709_restart, ++ .dt_compat = bcm2709_compat, ++MACHINE_END ++ ++module_param(boardrev, uint, 0644); ++module_param(serial, uint, 0644); ++module_param(reboot_part, uint, 0644); +diff --git a/arch/arm/mach-bcm2709/include/mach/debug-macro.S b/arch/arm/mach-bcm2709/include/mach/debug-macro.S +new file mode 100644 +index 0000000..b24304a +--- /dev/null ++++ b/arch/arm/mach-bcm2709/include/mach/debug-macro.S +@@ -0,0 +1,22 @@ ++/* arch/arm/mach-bcm2708/include/mach/debug-macro.S ++ * ++ * Debugging macro include header ++ * ++ * Copyright (C) 2010 Broadcom ++ * Copyright (C) 1994-1999 Russell King ++ * Moved from linux/arch/arm/kernel/debug.S by Ben Dooks ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 as ++ * published by the Free Software Foundation. ++ * ++*/ ++ ++#include <mach/platform.h> ++ ++ .macro addruart, rp, rv, tmp ++ ldr \rp, =UART0_BASE ++ ldr \rv, =IO_ADDRESS(UART0_BASE) ++ .endm ++ ++#include <debug/pl01x.S> +diff --git a/arch/arm/mach-bcm2709/include/mach/entry-macro.S b/arch/arm/mach-bcm2709/include/mach/entry-macro.S +new file mode 100644 +index 0000000..d08591b +--- /dev/null ++++ b/arch/arm/mach-bcm2709/include/mach/entry-macro.S +@@ -0,0 +1,123 @@ ++/* ++ * arch/arm/mach-bcm2708/include/mach/entry-macro.S ++ * ++ * Low-level IRQ helper macros for BCM2708 platforms ++ * ++ * Copyright (C) 2010 Broadcom ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ */ ++#include <mach/hardware.h> ++#include <mach/irqs.h> ++ ++ .macro disable_fiq ++ .endm ++ ++ .macro get_irqnr_preamble, base, tmp ++ ldr \base, =IO_ADDRESS(ARMCTRL_IC_BASE) ++ .endm ++ ++ .macro arch_ret_to_user, tmp1, tmp2 ++ .endm ++ ++ .macro get_irqnr_and_base, irqnr, irqstat, base, tmp ++ /* get core number */ ++ mrc p15, 0, \tmp, c0, c0, 5 ++ ubfx \tmp, \tmp, #0, #2 ++ ++ /* get core's local interrupt controller */ ++ ldr \irqstat, = __io_address(ARM_LOCAL_IRQ_PENDING0) @ local interrupt source ++ add \irqstat, \irqstat, \tmp, lsl #2 ++ ldr \tmp, [\irqstat] ++ /* ignore gpu interrupt */ ++ bic \tmp, #0x100 ++ /* ignore mailbox interrupts */ ++ bics \tmp, #0xf0 ++ beq 1005f ++ ++ @ For non-zero x, LSB(x) = 31 - CLZ(x^(x-1)) ++ @ N.B. CLZ is an ARM5 instruction. ++ mov \irqnr, #(ARM_IRQ_LOCAL_BASE + 31) ++ sub \irqstat, \tmp, #1 ++ eor \irqstat, \irqstat, \tmp ++ clz \tmp, \irqstat ++ sub \irqnr, \tmp ++ b 1020f ++1005: ++ /* get core number */ ++ mrc p15, 0, \tmp, c0, c0, 5 ++ ubfx \tmp, \tmp, #0, #2 ++ ++ cmp \tmp, #1 ++ beq 1020f ++ cmp \tmp, #2 ++ beq 1020f ++ cmp \tmp, #3 ++ beq 1020f ++ ++ /* get masked status */ ++ ldr \irqstat, [\base, #(ARM_IRQ_PEND0 - ARMCTRL_IC_BASE)] ++ mov \irqnr, #(ARM_IRQ0_BASE + 31) ++ and \tmp, \irqstat, #0x300 @ save bits 8 and 9 ++ /* clear bits 8 and 9, and test */ ++ bics \irqstat, \irqstat, #0x300 ++ bne 1010f ++ ++ tst \tmp, #0x100 ++ ldrne \irqstat, [\base, #(ARM_IRQ_PEND1 - ARMCTRL_IC_BASE)] ++ movne \irqnr, #(ARM_IRQ1_BASE + 31) ++ @ Mask out the interrupts also present in PEND0 - see SW-5809 ++ bicne \irqstat, #((1<<7) | (1<<9) | (1<<10)) ++ bicne \irqstat, #((1<<18) | (1<<19)) ++ bne 1010f ++ ++ tst \tmp, #0x200 ++ ldrne \irqstat, [\base, #(ARM_IRQ_PEND2 - ARMCTRL_IC_BASE)] ++ movne \irqnr, #(ARM_IRQ2_BASE + 31) ++ @ Mask out the interrupts also present in PEND0 - see SW-5809 ++ bicne \irqstat, #((1<<21) | (1<<22) | (1<<23) | (1<<24) | (1<<25)) ++ bicne \irqstat, #((1<<30)) ++ beq 1020f ++ ++1010: ++ @ For non-zero x, LSB(x) = 31 - CLZ(x^(x-1)) ++ @ N.B. CLZ is an ARM5 instruction. ++ sub \tmp, \irqstat, #1 ++ eor \irqstat, \irqstat, \tmp ++ clz \tmp, \irqstat ++ sub \irqnr, \tmp ++ ++1020: @ EQ will be set if no irqs pending ++ ++ .endm ++ ++ .macro test_for_ipi, irqnr, irqstat, base, tmp ++ /* get core number */ ++ mrc p15, 0, \tmp, c0, c0, 5 ++ ubfx \tmp, \tmp, #0, #2 ++ /* get core's mailbox interrupt control */ ++ ldr \irqstat, = __io_address(ARM_LOCAL_MAILBOX0_CLR0) @ mbox_clr ++ add \irqstat, \irqstat, \tmp, lsl #4 ++ ldr \tmp, [\irqstat] ++ cmp \tmp, #0 ++ beq 1030f ++ clz \tmp, \tmp ++ rsb \irqnr, \tmp, #31 ++ mov \tmp, #1 ++ lsl \tmp, \irqnr ++ str \tmp, [\irqstat] @ clear interrupt source ++ dsb ++1030: @ EQ will be set if no irqs pending ++ .endm +diff --git a/arch/arm/mach-bcm2709/include/mach/io.h b/arch/arm/mach-bcm2709/include/mach/io.h +new file mode 100644 +index 0000000..e6eb84d +--- /dev/null ++++ b/arch/arm/mach-bcm2709/include/mach/io.h +@@ -0,0 +1,27 @@ ++/* ++ * arch/arm/mach-bcm2708/include/mach/io.h ++ * ++ * Copyright (C) 2003 ARM Limited ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ */ ++#ifndef __ASM_ARM_ARCH_IO_H ++#define __ASM_ARM_ARCH_IO_H ++ ++#define IO_SPACE_LIMIT 0xffffffff ++ ++#define __io(a) __typesafe_io(a) ++ ++#endif +diff --git a/arch/arm/mach-bcm2709/include/mach/memory.h b/arch/arm/mach-bcm2709/include/mach/memory.h +new file mode 100644 +index 0000000..7548a52 +--- /dev/null ++++ b/arch/arm/mach-bcm2709/include/mach/memory.h +@@ -0,0 +1,57 @@ ++/* ++ * arch/arm/mach-bcm2708/include/mach/memory.h ++ * ++ * Copyright (C) 2010 Broadcom ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ */ ++#ifndef __ASM_ARCH_MEMORY_H ++#define __ASM_ARCH_MEMORY_H ++ ++/* Memory overview: ++ ++ [ARMcore] <--virtual addr--> ++ [ARMmmu] <--physical addr--> ++ [GERTmap] <--bus add--> ++ [VCperiph] ++ ++*/ ++ ++/* ++ * Physical DRAM offset. ++ */ ++#define BCM_PLAT_PHYS_OFFSET UL(0x00000000) ++#define VC_ARMMEM_OFFSET UL(0x00000000) /* offset in VC of ARM memory */ ++ ++#ifdef CONFIG_BCM2708_NOL2CACHE ++ #define _REAL_BUS_OFFSET UL(0xC0000000) /* don't use L1 or L2 caches */ ++#else ++ #define _REAL_BUS_OFFSET UL(0x40000000) /* use L2 cache */ ++#endif ++ ++/* We're using the memory at 64M in the VideoCore for Linux - this adjustment ++ * will provide the offset into this area as well as setting the bits that ++ * stop the L1 and L2 cache from being used ++ * ++ * WARNING: this only works because the ARM is given memory at a fixed location ++ * (ARMMEM_OFFSET) ++ */ ++#define BUS_OFFSET (VC_ARMMEM_OFFSET + _REAL_BUS_OFFSET) ++#define __virt_to_bus(x) ((x) + (BUS_OFFSET - PAGE_OFFSET)) ++#define __bus_to_virt(x) ((x) - (BUS_OFFSET - PAGE_OFFSET)) ++#define __pfn_to_bus(x) (__pfn_to_phys(x) + (BUS_OFFSET - BCM_PLAT_PHYS_OFFSET)) ++#define __bus_to_pfn(x) __phys_to_pfn((x) - (BUS_OFFSET - BCM_PLAT_PHYS_OFFSET)) ++ ++#endif +diff --git a/arch/arm/mach-bcm2709/include/mach/platform.h b/arch/arm/mach-bcm2709/include/mach/platform.h +new file mode 100644 +index 0000000..311b9f2 +--- /dev/null ++++ b/arch/arm/mach-bcm2709/include/mach/platform.h +@@ -0,0 +1,188 @@ ++/* ++ * arch/arm/mach-bcm2708/include/mach/platform.h ++ * ++ * Copyright (C) 2010 Broadcom ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ */ ++ ++#ifndef _BCM2708_PLATFORM_H ++#define _BCM2708_PLATFORM_H ++ ++ ++/* macros to get at IO space when running virtually */ ++#define IO_ADDRESS(x) (((x) & 0x00ffffff) + (((x) >> 4) & 0x0f000000) + 0xf0000000) ++ ++#define __io_address(n) IOMEM(IO_ADDRESS(n)) ++ ++ ++/* ++ * SDRAM ++ */ ++#define BCM2708_SDRAM_BASE 0x00000000 ++ ++/* ++ * Logic expansion modules ++ * ++ */ ++ ++ ++/* ------------------------------------------------------------------------ ++ * BCM2708 ARMCTRL Registers ++ * ------------------------------------------------------------------------ ++ */ ++ ++#define HW_REGISTER_RW(addr) (addr) ++#define HW_REGISTER_RO(addr) (addr) ++ ++/* ++ * Definitions and addresses for the ARM CONTROL logic ++ * This file is manually generated. ++ */ ++ ++#define BCM2708_PERI_BASE 0x3F000000 ++#define IC0_BASE (BCM2708_PERI_BASE + 0x2000) ++#define ST_BASE (BCM2708_PERI_BASE + 0x3000) /* System Timer */ ++#define MPHI_BASE (BCM2708_PERI_BASE + 0x6000) /* Message -based Parallel Host Interface */ ++#define DMA_BASE (BCM2708_PERI_BASE + 0x7000) /* DMA controller */ ++#define ARM_BASE (BCM2708_PERI_BASE + 0xB000) /* BCM2708 ARM control block */ ++#define PM_BASE (BCM2708_PERI_BASE + 0x100000) /* Power Management, Reset controller and Watchdog registers */ ++#define PCM_CLOCK_BASE (BCM2708_PERI_BASE + 0x101098) /* PCM Clock */ ++#define RNG_BASE (BCM2708_PERI_BASE + 0x104000) /* Hardware RNG */ ++#define GPIO_BASE (BCM2708_PERI_BASE + 0x200000) /* GPIO */ ++#define UART0_BASE (BCM2708_PERI_BASE + 0x201000) /* Uart 0 */ ++#define MMCI0_BASE (BCM2708_PERI_BASE + 0x202000) /* MMC interface */ ++#define I2S_BASE (BCM2708_PERI_BASE + 0x203000) /* I2S */ ++#define SPI0_BASE (BCM2708_PERI_BASE + 0x204000) /* SPI0 */ ++#define BSC0_BASE (BCM2708_PERI_BASE + 0x205000) /* BSC0 I2C/TWI */ ++#define UART1_BASE (BCM2708_PERI_BASE + 0x215000) /* Uart 1 */ ++#define EMMC_BASE (BCM2708_PERI_BASE + 0x300000) /* eMMC interface */ ++#define SMI_BASE (BCM2708_PERI_BASE + 0x600000) /* SMI */ ++#define BSC1_BASE (BCM2708_PERI_BASE + 0x804000) /* BSC1 I2C/TWI */ ++#define USB_BASE (BCM2708_PERI_BASE + 0x980000) /* DTC_OTG USB controller */ ++#define MCORE_BASE (BCM2708_PERI_BASE + 0x0000) /* Fake frame buffer device (actually the multicore sync block*/ ++ ++#define ARMCTRL_BASE (ARM_BASE + 0x000) ++#define ARMCTRL_IC_BASE (ARM_BASE + 0x200) /* ARM interrupt controller */ ++#define ARMCTRL_TIMER0_1_BASE (ARM_BASE + 0x400) /* Timer 0 and 1 */ ++#define ARMCTRL_0_SBM_BASE (ARM_BASE + 0x800) /* User 0 (ARM)'s Semaphores Doorbells and Mailboxes */ ++ ++/* ++ * Watchdog ++ */ ++#define PM_RSTC (PM_BASE+0x1c) ++#define PM_RSTS (PM_BASE+0x20) ++#define PM_WDOG (PM_BASE+0x24) ++ ++#define PM_WDOG_RESET 0000000000 ++#define PM_PASSWORD 0x5a000000 ++#define PM_WDOG_TIME_SET 0x000fffff ++#define PM_RSTC_WRCFG_CLR 0xffffffcf ++#define PM_RSTC_WRCFG_SET 0x00000030 ++#define PM_RSTC_WRCFG_FULL_RESET 0x00000020 ++#define PM_RSTC_RESET 0x00000102 ++ ++#define PM_RSTS_HADPOR_SET 0x00001000 ++#define PM_RSTS_HADSRH_SET 0x00000400 ++#define PM_RSTS_HADSRF_SET 0x00000200 ++#define PM_RSTS_HADSRQ_SET 0x00000100 ++#define PM_RSTS_HADWRH_SET 0x00000040 ++#define PM_RSTS_HADWRF_SET 0x00000020 ++#define PM_RSTS_HADWRQ_SET 0x00000010 ++#define PM_RSTS_HADDRH_SET 0x00000004 ++#define PM_RSTS_HADDRF_SET 0x00000002 ++#define PM_RSTS_HADDRQ_SET 0x00000001 ++ ++#define UART0_CLOCK 3000000 ++ ++#define ARM_LOCAL_BASE 0x40000000 ++#define ARM_LOCAL_CONTROL HW_REGISTER_RW(ARM_LOCAL_BASE+0x000) ++ ++#define ARM_LOCAL_CONTROL HW_REGISTER_RW(ARM_LOCAL_BASE+0x000) ++#define ARM_LOCAL_PRESCALER HW_REGISTER_RW(ARM_LOCAL_BASE+0x008) ++#define ARM_LOCAL_GPU_INT_ROUTING HW_REGISTER_RW(ARM_LOCAL_BASE+0x00C) ++#define ARM_LOCAL_PM_ROUTING_SET HW_REGISTER_RW(ARM_LOCAL_BASE+0x010) ++#define ARM_LOCAL_PM_ROUTING_CLR HW_REGISTER_RW(ARM_LOCAL_BASE+0x014) ++#define ARM_LOCAL_TIMER_LS HW_REGISTER_RW(ARM_LOCAL_BASE+0x01C) ++#define ARM_LOCAL_TIMER_MS HW_REGISTER_RW(ARM_LOCAL_BASE+0x020) ++#define ARM_LOCAL_INT_ROUTING HW_REGISTER_RW(ARM_LOCAL_BASE+0x024) ++#define ARM_LOCAL_AXI_COUNT HW_REGISTER_RW(ARM_LOCAL_BASE+0x02C) ++#define ARM_LOCAL_AXI_IRQ HW_REGISTER_RW(ARM_LOCAL_BASE+0x030) ++#define ARM_LOCAL_TIMER_CONTROL HW_REGISTER_RW(ARM_LOCAL_BASE+0x034) ++#define ARM_LOCAL_TIMER_WRITE HW_REGISTER_RW(ARM_LOCAL_BASE+0x038) ++ ++#define ARM_LOCAL_TIMER_INT_CONTROL0 HW_REGISTER_RW(ARM_LOCAL_BASE+0x040) ++#define ARM_LOCAL_TIMER_INT_CONTROL1 HW_REGISTER_RW(ARM_LOCAL_BASE+0x044) ++#define ARM_LOCAL_TIMER_INT_CONTROL2 HW_REGISTER_RW(ARM_LOCAL_BASE+0x048) ++#define ARM_LOCAL_TIMER_INT_CONTROL3 HW_REGISTER_RW(ARM_LOCAL_BASE+0x04C) ++ ++#define ARM_LOCAL_MAILBOX_INT_CONTROL0 HW_REGISTER_RW(ARM_LOCAL_BASE+0x050) ++#define ARM_LOCAL_MAILBOX_INT_CONTROL1 HW_REGISTER_RW(ARM_LOCAL_BASE+0x054) ++#define ARM_LOCAL_MAILBOX_INT_CONTROL2 HW_REGISTER_RW(ARM_LOCAL_BASE+0x058) ++#define ARM_LOCAL_MAILBOX_INT_CONTROL3 HW_REGISTER_RW(ARM_LOCAL_BASE+0x05C) ++ ++#define ARM_LOCAL_IRQ_PENDING0 HW_REGISTER_RW(ARM_LOCAL_BASE+0x060) ++#define ARM_LOCAL_IRQ_PENDING1 HW_REGISTER_RW(ARM_LOCAL_BASE+0x064) ++#define ARM_LOCAL_IRQ_PENDING2 HW_REGISTER_RW(ARM_LOCAL_BASE+0x068) ++#define ARM_LOCAL_IRQ_PENDING3 HW_REGISTER_RW(ARM_LOCAL_BASE+0x06C) ++ ++#define ARM_LOCAL_FIQ_PENDING0 HW_REGISTER_RW(ARM_LOCAL_BASE+0x070) ++#define ARM_LOCAL_FIQ_PENDING1 HW_REGISTER_RW(ARM_LOCAL_BASE+0x074) ++#define ARM_LOCAL_FIQ_PENDING2 HW_REGISTER_RW(ARM_LOCAL_BASE+0x078) ++#define ARM_LOCAL_FIQ_PENDING3 HW_REGISTER_RW(ARM_LOCAL_BASE+0x07C) ++ ++#define ARM_LOCAL_MAILBOX0_SET0 HW_REGISTER_RW(ARM_LOCAL_BASE+0x080) ++#define ARM_LOCAL_MAILBOX1_SET0 HW_REGISTER_RW(ARM_LOCAL_BASE+0x084) ++#define ARM_LOCAL_MAILBOX2_SET0 HW_REGISTER_RW(ARM_LOCAL_BASE+0x088) ++#define ARM_LOCAL_MAILBOX3_SET0 HW_REGISTER_RW(ARM_LOCAL_BASE+0x08C) ++ ++#define ARM_LOCAL_MAILBOX0_SET1 HW_REGISTER_RW(ARM_LOCAL_BASE+0x090) ++#define ARM_LOCAL_MAILBOX1_SET1 HW_REGISTER_RW(ARM_LOCAL_BASE+0x094) ++#define ARM_LOCAL_MAILBOX2_SET1 HW_REGISTER_RW(ARM_LOCAL_BASE+0x098) ++#define ARM_LOCAL_MAILBOX3_SET1 HW_REGISTER_RW(ARM_LOCAL_BASE+0x09C) ++ ++#define ARM_LOCAL_MAILBOX0_SET2 HW_REGISTER_RW(ARM_LOCAL_BASE+0x0A0) ++#define ARM_LOCAL_MAILBOX1_SET2 HW_REGISTER_RW(ARM_LOCAL_BASE+0x0A4) ++#define ARM_LOCAL_MAILBOX2_SET2 HW_REGISTER_RW(ARM_LOCAL_BASE+0x0A8) ++#define ARM_LOCAL_MAILBOX3_SET2 HW_REGISTER_RW(ARM_LOCAL_BASE+0x0AC) ++ ++#define ARM_LOCAL_MAILBOX0_SET3 HW_REGISTER_RW(ARM_LOCAL_BASE+0x0B0) ++#define ARM_LOCAL_MAILBOX1_SET3 HW_REGISTER_RW(ARM_LOCAL_BASE+0x0B4) ++#define ARM_LOCAL_MAILBOX2_SET3 HW_REGISTER_RW(ARM_LOCAL_BASE+0x0B8) ++#define ARM_LOCAL_MAILBOX3_SET3 HW_REGISTER_RW(ARM_LOCAL_BASE+0x0BC) ++ ++#define ARM_LOCAL_MAILBOX0_CLR0 HW_REGISTER_RW(ARM_LOCAL_BASE+0x0C0) ++#define ARM_LOCAL_MAILBOX1_CLR0 HW_REGISTER_RW(ARM_LOCAL_BASE+0x0C4) ++#define ARM_LOCAL_MAILBOX2_CLR0 HW_REGISTER_RW(ARM_LOCAL_BASE+0x0C8) ++#define ARM_LOCAL_MAILBOX3_CLR0 HW_REGISTER_RW(ARM_LOCAL_BASE+0x0CC) ++ ++#define ARM_LOCAL_MAILBOX0_CLR1 HW_REGISTER_RW(ARM_LOCAL_BASE+0x0D0) ++#define ARM_LOCAL_MAILBOX1_CLR1 HW_REGISTER_RW(ARM_LOCAL_BASE+0x0D4) ++#define ARM_LOCAL_MAILBOX2_CLR1 HW_REGISTER_RW(ARM_LOCAL_BASE+0x0D8) ++#define ARM_LOCAL_MAILBOX3_CLR1 HW_REGISTER_RW(ARM_LOCAL_BASE+0x0DC) ++ ++#define ARM_LOCAL_MAILBOX0_CLR2 HW_REGISTER_RW(ARM_LOCAL_BASE+0x0E0) ++#define ARM_LOCAL_MAILBOX1_CLR2 HW_REGISTER_RW(ARM_LOCAL_BASE+0x0E4) ++#define ARM_LOCAL_MAILBOX2_CLR2 HW_REGISTER_RW(ARM_LOCAL_BASE+0x0E8) ++#define ARM_LOCAL_MAILBOX3_CLR2 HW_REGISTER_RW(ARM_LOCAL_BASE+0x0EC) ++ ++#define ARM_LOCAL_MAILBOX0_CLR3 HW_REGISTER_RW(ARM_LOCAL_BASE+0x0F0) ++#define ARM_LOCAL_MAILBOX1_CLR3 HW_REGISTER_RW(ARM_LOCAL_BASE+0x0F4) ++#define ARM_LOCAL_MAILBOX2_CLR3 HW_REGISTER_RW(ARM_LOCAL_BASE+0x0F8) ++#define ARM_LOCAL_MAILBOX3_CLR3 HW_REGISTER_RW(ARM_LOCAL_BASE+0x0FC) ++ ++#endif ++ ++/* END */ +diff --git a/arch/arm/mach-bcm2709/include/mach/system.h b/arch/arm/mach-bcm2709/include/mach/system.h +new file mode 100644 +index 0000000..c9a9c9a +--- /dev/null ++++ b/arch/arm/mach-bcm2709/include/mach/system.h +@@ -0,0 +1,37 @@ ++/* ++ * arch/arm/mach-bcm2708/include/mach/system.h ++ * ++ * Copyright (C) 2010 Broadcom ++ * Copyright (C) 2003 ARM Limited ++ * Copyright (C) 2000 Deep Blue Solutions Ltd ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ */ ++#ifndef __ASM_ARCH_SYSTEM_H ++#define __ASM_ARCH_SYSTEM_H ++ ++#include <linux/io.h> ++#include <mach/platform.h> ++ ++static inline void arch_idle(void) ++{ ++ /* ++ * This should do all the clock switching ++ * and wait for interrupt tricks ++ */ ++ cpu_do_idle(); ++} ++ ++#endif +diff --git a/arch/arm/mach-bcm2709/include/mach/uncompress.h b/arch/arm/mach-bcm2709/include/mach/uncompress.h +new file mode 100644 +index 0000000..de7504b +--- /dev/null ++++ b/arch/arm/mach-bcm2709/include/mach/uncompress.h +@@ -0,0 +1,84 @@ ++/* ++ * arch/arm/mach-bcn2708/include/mach/uncompress.h ++ * ++ * Copyright (C) 2010 Broadcom ++ * Copyright (C) 2003 ARM Limited ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ */ ++ ++#include <linux/io.h> ++#include <linux/amba/serial.h> ++#include <mach/platform.h> ++ ++#define UART_BAUD 115200 ++ ++#define BCM2708_UART_DR __io(UART0_BASE + UART01x_DR) ++#define BCM2708_UART_FR __io(UART0_BASE + UART01x_FR) ++#define BCM2708_UART_IBRD __io(UART0_BASE + UART011_IBRD) ++#define BCM2708_UART_FBRD __io(UART0_BASE + UART011_FBRD) ++#define BCM2708_UART_LCRH __io(UART0_BASE + UART011_LCRH) ++#define BCM2708_UART_CR __io(UART0_BASE + UART011_CR) ++ ++/* ++ * This does not append a newline ++ */ ++static inline void putc(int c) ++{ ++ while (__raw_readl(BCM2708_UART_FR) & UART01x_FR_TXFF) ++ barrier(); ++ ++ __raw_writel(c, BCM2708_UART_DR); ++} ++ ++static inline void flush(void) ++{ ++ int fr; ++ ++ do { ++ fr = __raw_readl(BCM2708_UART_FR); ++ barrier(); ++ } while ((fr & (UART011_FR_TXFE | UART01x_FR_BUSY)) != UART011_FR_TXFE); ++} ++ ++static inline void arch_decomp_setup(void) ++{ ++ int temp, div, rem, frac; ++ ++ temp = 16 * UART_BAUD; ++ div = UART0_CLOCK / temp; ++ rem = UART0_CLOCK % temp; ++ temp = (8 * rem) / UART_BAUD; ++ frac = (temp >> 1) + (temp & 1); ++ ++ /* Make sure the UART is disabled before we start */ ++ __raw_writel(0, BCM2708_UART_CR); ++ ++ /* Set the baud rate */ ++ __raw_writel(div, BCM2708_UART_IBRD); ++ __raw_writel(frac, BCM2708_UART_FBRD); ++ ++ /* Set the UART to 8n1, FIFO enabled */ ++ __raw_writel(UART01x_LCRH_WLEN_8 | UART01x_LCRH_FEN, BCM2708_UART_LCRH); ++ ++ /* Enable the UART */ ++ __raw_writel(UART01x_CR_UARTEN | UART011_CR_TXE | UART011_CR_RXE, ++ BCM2708_UART_CR); ++} ++ ++/* ++ * nothing to do ++ */ ++#define arch_decomp_wdog() +diff --git a/arch/arm/mach-bcm2709/include/mach/vc_mem.h b/arch/arm/mach-bcm2709/include/mach/vc_mem.h +new file mode 100644 +index 0000000..4a4a338 +--- /dev/null ++++ b/arch/arm/mach-bcm2709/include/mach/vc_mem.h +@@ -0,0 +1,35 @@ ++/***************************************************************************** ++* Copyright 2010 - 2011 Broadcom Corporation. All rights reserved. ++* ++* Unless you and Broadcom execute a separate written software license ++* agreement governing use of this software, this software is licensed to you ++* under the terms of the GNU General Public License version 2, available at ++* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). ++* ++* Notwithstanding the above, under no circumstances may you combine this ++* software in any way with any other Broadcom software provided under a ++* license other than the GPL, without Broadcom's express prior written ++* consent. ++*****************************************************************************/ ++ ++#if !defined( VC_MEM_H ) ++#define VC_MEM_H ++ ++#include <linux/ioctl.h> ++ ++#define VC_MEM_IOC_MAGIC 'v' ++ ++#define VC_MEM_IOC_MEM_PHYS_ADDR _IOR( VC_MEM_IOC_MAGIC, 0, unsigned long ) ++#define VC_MEM_IOC_MEM_SIZE _IOR( VC_MEM_IOC_MAGIC, 1, unsigned int ) ++#define VC_MEM_IOC_MEM_BASE _IOR( VC_MEM_IOC_MAGIC, 2, unsigned int ) ++#define VC_MEM_IOC_MEM_LOAD _IOR( VC_MEM_IOC_MAGIC, 3, unsigned int ) ++ ++#if defined( __KERNEL__ ) ++#define VC_MEM_TO_ARM_ADDR_MASK 0x3FFFFFFF ++ ++extern unsigned long mm_vc_mem_phys_addr; ++extern unsigned int mm_vc_mem_size; ++extern int vc_mem_get_current_size( void ); ++#endif ++ ++#endif /* VC_MEM_H */ +diff --git a/arch/arm/mach-bcm2709/include/mach/vmalloc.h b/arch/arm/mach-bcm2709/include/mach/vmalloc.h +new file mode 100644 +index 0000000..6aa6826 +--- /dev/null ++++ b/arch/arm/mach-bcm2709/include/mach/vmalloc.h +@@ -0,0 +1,20 @@ ++/* ++ * arch/arm/mach-bcm2708/include/mach/vmalloc.h ++ * ++ * Copyright (C) 2010 Broadcom ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ */ ++#define VMALLOC_END (0xff000000) +diff --git a/arch/arm/mach-bcm2709/vc_mem.c b/arch/arm/mach-bcm2709/vc_mem.c +new file mode 100644 +index 0000000..d2adfd1 +--- /dev/null ++++ b/arch/arm/mach-bcm2709/vc_mem.c +@@ -0,0 +1,431 @@ ++/***************************************************************************** ++* Copyright 2010 - 2011 Broadcom Corporation. All rights reserved. ++* ++* Unless you and Broadcom execute a separate written software license ++* agreement governing use of this software, this software is licensed to you ++* under the terms of the GNU General Public License version 2, available at ++* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). ++* ++* Notwithstanding the above, under no circumstances may you combine this ++* software in any way with any other Broadcom software provided under a ++* license other than the GPL, without Broadcom's express prior written ++* consent. ++*****************************************************************************/ ++ ++#include <linux/kernel.h> ++#include <linux/module.h> ++#include <linux/fs.h> ++#include <linux/device.h> ++#include <linux/cdev.h> ++#include <linux/mm.h> ++#include <linux/slab.h> ++#include <linux/debugfs.h> ++#include <asm/uaccess.h> ++#include <linux/dma-mapping.h> ++#include <linux/platform_data/mailbox-bcm2708.h> ++ ++#ifdef CONFIG_ARCH_KONA ++#include <chal/chal_ipc.h> ++#elif defined(CONFIG_ARCH_BCM2708) || defined(CONFIG_ARCH_BCM2709) ++#else ++#include <csp/chal_ipc.h> ++#endif ++ ++#include "mach/vc_mem.h" ++ ++#define DRIVER_NAME "vc-mem" ++ ++// Device (/dev) related variables ++static dev_t vc_mem_devnum = 0; ++static struct class *vc_mem_class = NULL; ++static struct cdev vc_mem_cdev; ++static int vc_mem_inited = 0; ++ ++#ifdef CONFIG_DEBUG_FS ++static struct dentry *vc_mem_debugfs_entry; ++#endif ++ ++/* ++ * Videocore memory addresses and size ++ * ++ * Drivers that wish to know the videocore memory addresses and sizes should ++ * use these variables instead of the MM_IO_BASE and MM_ADDR_IO defines in ++ * headers. This allows the other drivers to not be tied down to a a certain ++ * address/size at compile time. ++ * ++ * In the future, the goal is to have the videocore memory virtual address and ++ * size be calculated at boot time rather than at compile time. The decision of ++ * where the videocore memory resides and its size would be in the hands of the ++ * bootloader (and/or kernel). When that happens, the values of these variables ++ * would be calculated and assigned in the init function. ++ */ ++// in the 2835 VC in mapped above ARM, but ARM has full access to VC space ++unsigned long mm_vc_mem_phys_addr = 0x00000000; ++unsigned int mm_vc_mem_size = 0; ++unsigned int mm_vc_mem_base = 0; ++ ++EXPORT_SYMBOL(mm_vc_mem_phys_addr); ++EXPORT_SYMBOL(mm_vc_mem_size); ++EXPORT_SYMBOL(mm_vc_mem_base); ++ ++static uint phys_addr = 0; ++static uint mem_size = 0; ++static uint mem_base = 0; ++ ++ ++/**************************************************************************** ++* ++* vc_mem_open ++* ++***************************************************************************/ ++ ++static int ++vc_mem_open(struct inode *inode, struct file *file) ++{ ++ (void) inode; ++ (void) file; ++ ++ pr_debug("%s: called file = 0x%p\n", __func__, file); ++ ++ return 0; ++} ++ ++/**************************************************************************** ++* ++* vc_mem_release ++* ++***************************************************************************/ ++ ++static int ++vc_mem_release(struct inode *inode, struct file *file) ++{ ++ (void) inode; ++ (void) file; ++ ++ pr_debug("%s: called file = 0x%p\n", __func__, file); ++ ++ return 0; ++} ++ ++/**************************************************************************** ++* ++* vc_mem_get_size ++* ++***************************************************************************/ ++ ++static void ++vc_mem_get_size(void) ++{ ++} ++ ++/**************************************************************************** ++* ++* vc_mem_get_base ++* ++***************************************************************************/ ++ ++static void ++vc_mem_get_base(void) ++{ ++} ++ ++/**************************************************************************** ++* ++* vc_mem_get_current_size ++* ++***************************************************************************/ ++ ++int ++vc_mem_get_current_size(void) ++{ ++ return mm_vc_mem_size; ++} ++ ++EXPORT_SYMBOL_GPL(vc_mem_get_current_size); ++ ++/**************************************************************************** ++* ++* vc_mem_ioctl ++* ++***************************************************************************/ ++ ++static long ++vc_mem_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ++{ ++ int rc = 0; ++ ++ (void) cmd; ++ (void) arg; ++ ++ pr_debug("%s: called file = 0x%p\n", __func__, file); ++ ++ switch (cmd) { ++ case VC_MEM_IOC_MEM_PHYS_ADDR: ++ { ++ pr_debug("%s: VC_MEM_IOC_MEM_PHYS_ADDR=0x%p\n", ++ __func__, (void *) mm_vc_mem_phys_addr); ++ ++ if (copy_to_user((void *) arg, &mm_vc_mem_phys_addr, ++ sizeof (mm_vc_mem_phys_addr)) != 0) { ++ rc = -EFAULT; ++ } ++ break; ++ } ++ case VC_MEM_IOC_MEM_SIZE: ++ { ++ // Get the videocore memory size first ++ vc_mem_get_size(); ++ ++ pr_debug("%s: VC_MEM_IOC_MEM_SIZE=%u\n", __func__, ++ mm_vc_mem_size); ++ ++ if (copy_to_user((void *) arg, &mm_vc_mem_size, ++ sizeof (mm_vc_mem_size)) != 0) { ++ rc = -EFAULT; ++ } ++ break; ++ } ++ case VC_MEM_IOC_MEM_BASE: ++ { ++ // Get the videocore memory base ++ vc_mem_get_base(); ++ ++ pr_debug("%s: VC_MEM_IOC_MEM_BASE=%u\n", __func__, ++ mm_vc_mem_base); ++ ++ if (copy_to_user((void *) arg, &mm_vc_mem_base, ++ sizeof (mm_vc_mem_base)) != 0) { ++ rc = -EFAULT; ++ } ++ break; ++ } ++ case VC_MEM_IOC_MEM_LOAD: ++ { ++ // Get the videocore memory base ++ vc_mem_get_base(); ++ ++ pr_debug("%s: VC_MEM_IOC_MEM_LOAD=%u\n", __func__, ++ mm_vc_mem_base); ++ ++ if (copy_to_user((void *) arg, &mm_vc_mem_base, ++ sizeof (mm_vc_mem_base)) != 0) { ++ rc = -EFAULT; ++ } ++ break; ++ } ++ default: ++ { ++ return -ENOTTY; ++ } ++ } ++ pr_debug("%s: file = 0x%p returning %d\n", __func__, file, rc); ++ ++ return rc; ++} ++ ++/**************************************************************************** ++* ++* vc_mem_mmap ++* ++***************************************************************************/ ++ ++static int ++vc_mem_mmap(struct file *filp, struct vm_area_struct *vma) ++{ ++ int rc = 0; ++ unsigned long length = vma->vm_end - vma->vm_start; ++ unsigned long offset = vma->vm_pgoff << PAGE_SHIFT; ++ ++ pr_debug("%s: vm_start = 0x%08lx vm_end = 0x%08lx vm_pgoff = 0x%08lx\n", ++ __func__, (long) vma->vm_start, (long) vma->vm_end, ++ (long) vma->vm_pgoff); ++ ++ if (offset + length > mm_vc_mem_size) { ++ pr_err("%s: length %ld is too big\n", __func__, length); ++ return -EINVAL; ++ } ++ // Do not cache the memory map ++ vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); ++ ++ rc = remap_pfn_range(vma, vma->vm_start, ++ (mm_vc_mem_phys_addr >> PAGE_SHIFT) + ++ vma->vm_pgoff, length, vma->vm_page_prot); ++ if (rc != 0) { ++ pr_err("%s: remap_pfn_range failed (rc=%d)\n", __func__, rc); ++ } ++ ++ return rc; ++} ++ ++/**************************************************************************** ++* ++* File Operations for the driver. ++* ++***************************************************************************/ ++ ++static const struct file_operations vc_mem_fops = { ++ .owner = THIS_MODULE, ++ .open = vc_mem_open, ++ .release = vc_mem_release, ++ .unlocked_ioctl = vc_mem_ioctl, ++ .mmap = vc_mem_mmap, ++}; ++ ++#ifdef CONFIG_DEBUG_FS ++static void vc_mem_debugfs_deinit(void) ++{ ++ debugfs_remove_recursive(vc_mem_debugfs_entry); ++ vc_mem_debugfs_entry = NULL; ++} ++ ++ ++static int vc_mem_debugfs_init( ++ struct device *dev) ++{ ++ vc_mem_debugfs_entry = debugfs_create_dir(DRIVER_NAME, NULL); ++ if (!vc_mem_debugfs_entry) { ++ dev_warn(dev, "could not create debugfs entry\n"); ++ return -EFAULT; ++ } ++ ++ if (!debugfs_create_x32("vc_mem_phys_addr", ++ 0444, ++ vc_mem_debugfs_entry, ++ (u32 *)&mm_vc_mem_phys_addr)) { ++ dev_warn(dev, "%s:could not create vc_mem_phys entry\n", ++ __func__); ++ goto fail; ++ } ++ ++ if (!debugfs_create_x32("vc_mem_size", ++ 0444, ++ vc_mem_debugfs_entry, ++ (u32 *)&mm_vc_mem_size)) { ++ dev_warn(dev, "%s:could not create vc_mem_size entry\n", ++ __func__); ++ goto fail; ++ } ++ ++ if (!debugfs_create_x32("vc_mem_base", ++ 0444, ++ vc_mem_debugfs_entry, ++ (u32 *)&mm_vc_mem_base)) { ++ dev_warn(dev, "%s:could not create vc_mem_base entry\n", ++ __func__); ++ goto fail; ++ } ++ ++ return 0; ++ ++fail: ++ vc_mem_debugfs_deinit(); ++ return -EFAULT; ++} ++ ++#endif /* CONFIG_DEBUG_FS */ ++ ++ ++/**************************************************************************** ++* ++* vc_mem_init ++* ++***************************************************************************/ ++ ++static int __init ++vc_mem_init(void) ++{ ++ int rc = -EFAULT; ++ struct device *dev; ++ ++ pr_debug("%s: called\n", __func__); ++ ++ mm_vc_mem_phys_addr = phys_addr; ++ mm_vc_mem_size = mem_size; ++ mm_vc_mem_base = mem_base; ++ ++ vc_mem_get_size(); ++ ++ pr_info("vc-mem: phys_addr:0x%08lx mem_base=0x%08x mem_size:0x%08x(%u MiB)\n", ++ mm_vc_mem_phys_addr, mm_vc_mem_base, mm_vc_mem_size, mm_vc_mem_size / (1024 * 1024)); ++ ++ if ((rc = alloc_chrdev_region(&vc_mem_devnum, 0, 1, DRIVER_NAME)) < 0) { ++ pr_err("%s: alloc_chrdev_region failed (rc=%d)\n", ++ __func__, rc); ++ goto out_err; ++ } ++ ++ cdev_init(&vc_mem_cdev, &vc_mem_fops); ++ if ((rc = cdev_add(&vc_mem_cdev, vc_mem_devnum, 1)) != 0) { ++ pr_err("%s: cdev_add failed (rc=%d)\n", __func__, rc); ++ goto out_unregister; ++ } ++ ++ vc_mem_class = class_create(THIS_MODULE, DRIVER_NAME); ++ if (IS_ERR(vc_mem_class)) { ++ rc = PTR_ERR(vc_mem_class); ++ pr_err("%s: class_create failed (rc=%d)\n", __func__, rc); ++ goto out_cdev_del; ++ } ++ ++ dev = device_create(vc_mem_class, NULL, vc_mem_devnum, NULL, ++ DRIVER_NAME); ++ if (IS_ERR(dev)) { ++ rc = PTR_ERR(dev); ++ pr_err("%s: device_create failed (rc=%d)\n", __func__, rc); ++ goto out_class_destroy; ++ } ++ ++#ifdef CONFIG_DEBUG_FS ++ /* don't fail if the debug entries cannot be created */ ++ vc_mem_debugfs_init(dev); ++#endif ++ ++ vc_mem_inited = 1; ++ return 0; ++ ++ device_destroy(vc_mem_class, vc_mem_devnum); ++ ++ out_class_destroy: ++ class_destroy(vc_mem_class); ++ vc_mem_class = NULL; ++ ++ out_cdev_del: ++ cdev_del(&vc_mem_cdev); ++ ++ out_unregister: ++ unregister_chrdev_region(vc_mem_devnum, 1); ++ ++ out_err: ++ return -1; ++} ++ ++/**************************************************************************** ++* ++* vc_mem_exit ++* ++***************************************************************************/ ++ ++static void __exit ++vc_mem_exit(void) ++{ ++ pr_debug("%s: called\n", __func__); ++ ++ if (vc_mem_inited) { ++#if CONFIG_DEBUG_FS ++ vc_mem_debugfs_deinit(); ++#endif ++ device_destroy(vc_mem_class, vc_mem_devnum); ++ class_destroy(vc_mem_class); ++ cdev_del(&vc_mem_cdev); ++ unregister_chrdev_region(vc_mem_devnum, 1); ++ } ++} ++ ++module_init(vc_mem_init); ++module_exit(vc_mem_exit); ++MODULE_LICENSE("GPL"); ++MODULE_AUTHOR("Broadcom Corporation"); ++ ++module_param(phys_addr, uint, 0644); ++module_param(mem_size, uint, 0644); ++module_param(mem_base, uint, 0644); +diff --git a/arch/arm/mm/proc-v6.S b/arch/arm/mm/proc-v6.S +index 06d890a..30d96e8 100644 +--- a/arch/arm/mm/proc-v6.S ++++ b/arch/arm/mm/proc-v6.S +@@ -73,10 +73,19 @@ ENDPROC(cpu_v6_reset) + * + * IRQs are already disabled. + */ ++ ++/* See jira SW-5991 for details of this workaround */ + ENTRY(cpu_v6_do_idle) +- mov r1, #0 +- mcr p15, 0, r1, c7, c10, 4 @ DWB - WFI may enter a low-power mode +- mcr p15, 0, r1, c7, c0, 4 @ wait for interrupt ++ .align 5 ++ mov r1, #2 ++1: subs r1, #1 ++ nop ++ mcreq p15, 0, r1, c7, c10, 4 @ DWB - WFI may enter a low-power mode ++ mcreq p15, 0, r1, c7, c0, 4 @ wait for interrupt ++ nop ++ nop ++ nop ++ bne 1b + ret lr + + ENTRY(cpu_v6_dcache_clean_area) +diff --git a/arch/arm/tools/mach-types b/arch/arm/tools/mach-types +index 2ed1b8a..b52d949 100644 +--- a/arch/arm/tools/mach-types ++++ b/arch/arm/tools/mach-types +@@ -522,6 +522,8 @@ torbreck MACH_TORBRECK TORBRECK 3090 + prima2_evb MACH_PRIMA2_EVB PRIMA2_EVB 3103 + paz00 MACH_PAZ00 PAZ00 3128 + acmenetusfoxg20 MACH_ACMENETUSFOXG20 ACMENETUSFOXG20 3129 ++bcm2708 MACH_BCM2708 BCM2708 3138 ++bcm2709 MACH_BCM2709 BCM2709 3139 + ag5evm MACH_AG5EVM AG5EVM 3189 + ics_if_voip MACH_ICS_IF_VOIP ICS_IF_VOIP 3206 + wlf_cragg_6410 MACH_WLF_CRAGG_6410 WLF_CRAGG_6410 3207 +diff --git a/drivers/clocksource/Makefile b/drivers/clocksource/Makefile +index dc2b899..c38fb1a 100644 +--- a/drivers/clocksource/Makefile ++++ b/drivers/clocksource/Makefile +@@ -19,7 +19,7 @@ obj-$(CONFIG_CLKSRC_NOMADIK_MTU) += nomadik-mtu.o + obj-$(CONFIG_CLKSRC_DBX500_PRCMU) += clksrc-dbx500-prcmu.o + obj-$(CONFIG_ARMADA_370_XP_TIMER) += time-armada-370-xp.o + obj-$(CONFIG_ORION_TIMER) += time-orion.o +-obj-$(CONFIG_ARCH_BCM2835) += bcm2835_timer.o ++obj-$(CONFIG_ARCH_BCM2835)$(CONFIG_ARCH_BCM2708) += bcm2835_timer.o + obj-$(CONFIG_ARCH_CLPS711X) += clps711x-timer.o + obj-$(CONFIG_ARCH_ATLAS7) += timer-atlas7.o + obj-$(CONFIG_ARCH_MOXART) += moxart_timer.o +diff --git a/drivers/irqchip/Makefile b/drivers/irqchip/Makefile +index b03cfcb..70cad6b 100644 +--- a/drivers/irqchip/Makefile ++++ b/drivers/irqchip/Makefile +@@ -5,6 +5,9 @@ obj-$(CONFIG_ATH79) += irq-ath79-cpu.o + obj-$(CONFIG_ATH79) += irq-ath79-misc.o + obj-$(CONFIG_ARCH_BCM2835) += irq-bcm2835.o + obj-$(CONFIG_ARCH_BCM2835) += irq-bcm2836.o ++obj-$(CONFIG_ARCH_BCM2708) += irq-bcm2835.o ++obj-$(CONFIG_ARCH_BCM2709) += irq-bcm2835.o ++obj-$(CONFIG_ARCH_BCM2709) += irq-bcm2836.o + obj-$(CONFIG_ARCH_EXYNOS) += exynos-combiner.o + obj-$(CONFIG_ARCH_HIP04) += irq-hip04.o + obj-$(CONFIG_ARCH_MMP) += irq-mmp.o +diff --git a/drivers/irqchip/irq-bcm2835.c b/drivers/irqchip/irq-bcm2835.c +index 20deb28..c02bf8a 100644 +--- a/drivers/irqchip/irq-bcm2835.c ++++ b/drivers/irqchip/irq-bcm2835.c +@@ -82,6 +82,7 @@ + #define NR_BANKS 3 + #define IRQS_PER_BANK 32 + #define NUMBER_IRQS MAKE_HWIRQ(NR_BANKS, 0) ++#undef FIQ_START + #define FIQ_START (NR_IRQS_BANK0 + MAKE_HWIRQ(NR_BANKS - 1, 0)) + + static const int reg_pending[] __initconst = { 0x00, 0x04, 0x08 }; +@@ -256,7 +257,7 @@ static int __init armctrl_of_init(struct device_node *node, + MAKE_HWIRQ(b, i) + NUMBER_IRQS); + BUG_ON(irq <= 0); + irq_set_chip(irq, &armctrl_chip); +- set_irq_flags(irq, IRQF_VALID | IRQF_PROBE); ++ irq_set_probe(irq); + } + } + init_FIQ(FIQ_START); +diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h +index 8dd4d29..f7fe8bd 100644 +--- a/include/linux/mmc/host.h ++++ b/include/linux/mmc/host.h +@@ -291,6 +291,7 @@ struct mmc_host { + #define MMC_CAP2_SDIO_IRQ_NOTHREAD (1 << 17) + #define MMC_CAP2_NO_WRITE_PROTECT (1 << 18) /* No physical write protect pin, assume that card is always read-write */ + #define MMC_CAP2_NO_SDIO (1 << 19) /* Do not send SDIO commands during initialization */ ++#define MMC_CAP2_FORCE_MULTIBLOCK (1 << 31) /* Always use multiblock transfers */ + + mmc_pm_flag_t pm_caps; /* supported pm features */ + + +From 3d28cd3bfb43f8c4a9b722532c63f54823ae6136 Mon Sep 17 00:00:00 2001 +From: popcornmix <popcornmix@gmail.com> +Date: Tue, 5 Apr 2016 19:40:12 +0100 +Subject: [PATCH 031/112] reboot: Use power off rather than busy spinning when + halt is requested + +--- + arch/arm/kernel/reboot.c | 6 +----- + 1 file changed, 1 insertion(+), 5 deletions(-) + +diff --git a/arch/arm/kernel/reboot.c b/arch/arm/kernel/reboot.c +index 71a2ff9..812c15e 100644 +--- a/arch/arm/kernel/reboot.c ++++ b/arch/arm/kernel/reboot.c +@@ -102,11 +102,7 @@ void machine_shutdown(void) + */ + void machine_halt(void) + { +- local_irq_disable(); +- smp_send_stop(); +- +- local_irq_disable(); +- while (1); ++ machine_power_off(); + } + + /* + +From 9a84e16b5bda0ca0a5c55ea67e923f13fa63a172 Mon Sep 17 00:00:00 2001 +From: popcornmix <popcornmix@gmail.com> +Date: Wed, 11 Nov 2015 21:01:15 +0000 +Subject: [PATCH 032/112] squash: include ARCH_BCM2708 / ARCH_BCM2709 + +--- + drivers/char/hw_random/Kconfig | 2 +- + drivers/clk/bcm/Makefile | 4 ++-- + drivers/mailbox/Kconfig | 2 +- + drivers/mailbox/bcm2835-mailbox.c | 18 ++++++++++++++++-- + drivers/pinctrl/Makefile | 1 + + drivers/pwm/Kconfig | 2 +- + drivers/spi/Kconfig | 4 ++-- + drivers/watchdog/Kconfig | 2 +- + sound/soc/bcm/Kconfig | 2 +- + 9 files changed, 26 insertions(+), 11 deletions(-) + +diff --git a/drivers/char/hw_random/Kconfig b/drivers/char/hw_random/Kconfig +index 67ee8b0..b3ca2ee 100644 +--- a/drivers/char/hw_random/Kconfig ++++ b/drivers/char/hw_random/Kconfig +@@ -90,7 +90,7 @@ config HW_RANDOM_BCM63XX + + config HW_RANDOM_BCM2835 + tristate "Broadcom BCM2835 Random Number Generator support" +- depends on ARCH_BCM2835 ++ depends on ARCH_BCM2835 || ARCH_BCM2708 || ARCH_BCM2709 + default HW_RANDOM + ---help--- + This driver provides kernel-side support for the Random Number +diff --git a/drivers/clk/bcm/Makefile b/drivers/clk/bcm/Makefile +index 1d79bd2..fcf1bb5 100644 +--- a/drivers/clk/bcm/Makefile ++++ b/drivers/clk/bcm/Makefile +@@ -4,8 +4,8 @@ obj-$(CONFIG_CLK_BCM_KONA) += clk-kona-setup.o + obj-$(CONFIG_CLK_BCM_KONA) += clk-bcm281xx.o + obj-$(CONFIG_CLK_BCM_KONA) += clk-bcm21664.o + obj-$(CONFIG_COMMON_CLK_IPROC) += clk-iproc-armpll.o clk-iproc-pll.o clk-iproc-asiu.o +-obj-$(CONFIG_ARCH_BCM2835) += clk-bcm2835.o +-obj-$(CONFIG_ARCH_BCM2835) += clk-bcm2835-aux.o ++obj-$(CONFIG_ARCH_BCM2835)$(CONFIG_ARCH_BCM2708)$(CONFIG_ARCH_BCM2709) += clk-bcm2835.o ++obj-$(CONFIG_ARCH_BCM2835)$(CONFIG_ARCH_BCM2708)$(CONFIG_ARCH_BCM2709) += clk-bcm2835-aux.o + obj-$(CONFIG_COMMON_CLK_IPROC) += clk-ns2.o + obj-$(CONFIG_ARCH_BCM_CYGNUS) += clk-cygnus.o + obj-$(CONFIG_ARCH_BCM_NSP) += clk-nsp.o +diff --git a/drivers/mailbox/Kconfig b/drivers/mailbox/Kconfig +index 5305923..3de0dcb 100644 +--- a/drivers/mailbox/Kconfig ++++ b/drivers/mailbox/Kconfig +@@ -74,7 +74,7 @@ config ALTERA_MBOX + + config BCM2835_MBOX + tristate "BCM2835 Mailbox" +- depends on ARCH_BCM2835 ++ depends on ARCH_BCM2835 || ARCH_BCM2708 || ARCH_BCM2709 + help + An implementation of the BCM2385 Mailbox. It is used to invoke + the services of the Videocore. Say Y here if you want to use the +diff --git a/drivers/mailbox/bcm2835-mailbox.c b/drivers/mailbox/bcm2835-mailbox.c +index cfb4b44..d9c6c21 100644 +--- a/drivers/mailbox/bcm2835-mailbox.c ++++ b/drivers/mailbox/bcm2835-mailbox.c +@@ -51,12 +51,15 @@ + #define MAIL1_WRT (ARM_0_MAIL1 + 0x00) + #define MAIL1_STA (ARM_0_MAIL1 + 0x18) + ++/* On ARCH_BCM270x these come through <linux/interrupt.h> (arm_control.h ) */ ++#ifndef ARM_MS_FULL + /* Status register: FIFO state. */ + #define ARM_MS_FULL BIT(31) + #define ARM_MS_EMPTY BIT(30) + + /* Configuration register: Enable interrupts. */ + #define ARM_MC_IHAVEDATAIRQEN BIT(0) ++#endif + + struct bcm2835_mbox { + void __iomem *regs; +@@ -151,7 +154,7 @@ static int bcm2835_mbox_probe(struct platform_device *pdev) + return -ENOMEM; + spin_lock_init(&mbox->lock); + +- ret = devm_request_irq(dev, irq_of_parse_and_map(dev->of_node, 0), ++ ret = devm_request_irq(dev, platform_get_irq(pdev, 0), + bcm2835_mbox_irq, 0, dev_name(dev), mbox); + if (ret) { + dev_err(dev, "Failed to register a mailbox IRQ handler: %d\n", +@@ -209,7 +212,18 @@ static struct platform_driver bcm2835_mbox_driver = { + .probe = bcm2835_mbox_probe, + .remove = bcm2835_mbox_remove, + }; +-module_platform_driver(bcm2835_mbox_driver); ++ ++static int __init bcm2835_mbox_init(void) ++{ ++ return platform_driver_register(&bcm2835_mbox_driver); ++} ++arch_initcall(bcm2835_mbox_init); ++ ++static void __init bcm2835_mbox_exit(void) ++{ ++ platform_driver_unregister(&bcm2835_mbox_driver); ++} ++module_exit(bcm2835_mbox_exit); + + MODULE_AUTHOR("Lubomir Rintel <lkundrak@v3.sk>"); + MODULE_DESCRIPTION("BCM2835 mailbox IPC driver"); +diff --git a/drivers/pinctrl/Makefile b/drivers/pinctrl/Makefile +index e4bc115..d996fe7 100644 +--- a/drivers/pinctrl/Makefile ++++ b/drivers/pinctrl/Makefile +@@ -35,6 +35,7 @@ obj-$(CONFIG_PINCTRL_TB10X) += pinctrl-tb10x.o + obj-$(CONFIG_PINCTRL_ST) += pinctrl-st.o + obj-$(CONFIG_PINCTRL_ZYNQ) += pinctrl-zynq.o + ++obj-$(CONFIG_ARCH_BCM2708)$(CONFIG_ARCH_BCM2709) += bcm/ + obj-$(CONFIG_ARCH_BCM) += bcm/ + obj-$(CONFIG_PINCTRL_BERLIN) += berlin/ + obj-y += freescale/ +diff --git a/drivers/pwm/Kconfig b/drivers/pwm/Kconfig +index c182efc..fe0f845 100644 +--- a/drivers/pwm/Kconfig ++++ b/drivers/pwm/Kconfig +@@ -85,7 +85,7 @@ config PWM_BCM_KONA + + config PWM_BCM2835 + tristate "BCM2835 PWM support" +- depends on ARCH_BCM2835 ++ depends on ARCH_BCM2835 || ARCH_BCM2708 || ARCH_BCM2709 + help + PWM framework driver for BCM2835 controller (Raspberry Pi) + +diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig +index 9d8c84b..2a27a37 100644 +--- a/drivers/spi/Kconfig ++++ b/drivers/spi/Kconfig +@@ -94,7 +94,7 @@ config SPI_AXI_SPI_ENGINE + config SPI_BCM2835 + tristate "BCM2835 SPI controller" + depends on GPIOLIB +- depends on ARCH_BCM2835 || COMPILE_TEST ++ depends on ARCH_BCM2835 || ARCH_BCM2708 || ARCH_BCM2709 || COMPILE_TEST + help + This selects a driver for the Broadcom BCM2835 SPI master. + +@@ -105,7 +105,7 @@ config SPI_BCM2835 + + config SPI_BCM2835AUX + tristate "BCM2835 SPI auxiliary controller" +- depends on (ARCH_BCM2835 && GPIOLIB) || COMPILE_TEST ++ depends on ((ARCH_BCM2835 || ARCH_BCM2708 || ARCH_BCM2709) && GPIOLIB) || COMPILE_TEST + help + This selects a driver for the Broadcom BCM2835 SPI aux master. + +diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig +index fb94765..8b2de7f 100644 +--- a/drivers/watchdog/Kconfig ++++ b/drivers/watchdog/Kconfig +@@ -1401,7 +1401,7 @@ config BCM63XX_WDT + + config BCM2835_WDT + tristate "Broadcom BCM2835 hardware watchdog" +- depends on ARCH_BCM2835 ++ depends on ARCH_BCM2835 || ARCH_BCM2708 || ARCH_BCM2709 + select WATCHDOG_CORE + help + Watchdog driver for the built in watchdog hardware in Broadcom +diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig +index 6a834e1..c5070ae 100644 +--- a/sound/soc/bcm/Kconfig ++++ b/sound/soc/bcm/Kconfig +@@ -1,6 +1,6 @@ + config SND_BCM2835_SOC_I2S + tristate "SoC Audio support for the Broadcom BCM2835 I2S module" +- depends on ARCH_BCM2835 || COMPILE_TEST ++ depends on ARCH_BCM2835 || MACH_BCM2708 || MACH_BCM2709 || COMPILE_TEST + select SND_SOC_GENERIC_DMAENGINE_PCM + select REGMAP_MMIO + help + +From 153b5f0f1f31e246cfc43ff80c07df63ca16cd31 Mon Sep 17 00:00:00 2001 +From: popcornmix <popcornmix@gmail.com> +Date: Wed, 1 May 2013 19:46:17 +0100 +Subject: [PATCH 033/112] Add dwc_otg driver +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: popcornmix <popcornmix@gmail.com> + +usb: dwc: fix lockdep false positive + +Signed-off-by: Kari Suvanto <karis79@gmail.com> + +usb: dwc: fix inconsistent lock state + +Signed-off-by: Kari Suvanto <karis79@gmail.com> + +Add FIQ patch to dwc_otg driver. Enable with dwc_otg.fiq_fix_enable=1. Should give about 10% more ARM performance. +Thanks to Gordon and Costas + +Avoid dynamic memory allocation for channel lock in USB driver. Thanks ddv2005. + +Add NAK holdoff scheme. Enabled by default, disable with dwc_otg.nak_holdoff_enable=0. Thanks gsh + +Make sure we wait for the reset to finish + +dwc_otg: fix bug in dwc_otg_hcd.c resulting in silent kernel + memory corruption, escalating to OOPS under high USB load. + +dwc_otg: Fix unsafe access of QTD during URB enqueue + +In dwc_otg_hcd_urb_enqueue during qtd creation, it was possible that the +transaction could complete almost immediately after the qtd was assigned +to a host channel during URB enqueue, which meant the qtd pointer was no +longer valid having been completed and removed. Usually, this resulted in +an OOPS during URB submission. By predetermining whether transactions +need to be queued or not, this unsafe pointer access is avoided. + +This bug was only evident on the Pi model A where a device was attached +that had no periodic endpoints (e.g. USB pendrive or some wlan devices). + +dwc_otg: Fix incorrect URB allocation error handling + +If the memory allocation for a dwc_otg_urb failed, the kernel would OOPS +because for some reason a member of the *unallocated* struct was set to +zero. Error handling changed to fail correctly. + +dwc_otg: fix potential use-after-free case in interrupt handler + +If a transaction had previously aborted, certain interrupts are +enabled to track error counts and reset where necessary. On IN +endpoints the host generates an ACK interrupt near-simultaneously +with completion of transfer. In the case where this transfer had +previously had an error, this results in a use-after-free on +the QTD memory space with a 1-byte length being overwritten to +0x00. + +dwc_otg: add handling of SPLIT transaction data toggle errors + +Previously a data toggle error on packets from a USB1.1 device behind +a TT would result in the Pi locking up as the driver never handled +the associated interrupt. Patch adds basic retry mechanism and +interrupt acknowledgement to cater for either a chance toggle error or +for devices that have a broken initial toggle state (FT8U232/FT232BM). + +dwc_otg: implement tasklet for returning URBs to usbcore hcd layer + +The dwc_otg driver interrupt handler for transfer completion will spend +a very long time with interrupts disabled when a URB is completed - +this is because usb_hcd_giveback_urb is called from within the handler +which for a USB device driver with complicated processing (e.g. webcam) +will take an exorbitant amount of time to complete. This results in +missed completion interrupts for other USB packets which lead to them +being dropped due to microframe overruns. + +This patch splits returning the URB to the usb hcd layer into a +high-priority tasklet. This will have most benefit for isochronous IN +transfers but will also have incidental benefit where multiple periodic +devices are active at once. + +dwc_otg: fix NAK holdoff and allow on split transactions only + +This corrects a bug where if a single active non-periodic endpoint +had at least one transaction in its qh, on frnum == MAX_FRNUM the qh +would get skipped and never get queued again. This would result in +a silent device until error detection (automatic or otherwise) would +either reset the device or flush and requeue the URBs. + +Additionally the NAK holdoff was enabled for all transactions - this +would potentially stall a HS endpoint for 1ms if a previous error state +enabled this interrupt and the next response was a NAK. Fix so that +only split transactions get held off. + +dwc_otg: Call usb_hcd_unlink_urb_from_ep with lock held in completion handler + +usb_hcd_unlink_urb_from_ep must be called with the HCD lock held. Calling it +asynchronously in the tasklet was not safe (regression in +c4564d4a1a0a9b10d4419e48239f5d99e88d2667). + +This change unlinks it from the endpoint prior to queueing it for handling in +the tasklet, and also adds a check to ensure the urb is OK to be unlinked +before doing so. + +NULL pointer dereference kernel oopses had been observed in usb_hcd_giveback_urb +when a USB device was unplugged/replugged during data transfer. This effect +was reproduced using automated USB port power control, hundreds of replug +events were performed during active transfers to confirm that the problem was +eliminated. + +USB fix using a FIQ to implement split transactions + +This commit adds a FIQ implementaion that schedules +the split transactions using a FIQ so we don't get +held off by the interrupt latency of Linux + +dwc_otg: fix device attributes and avoid kernel warnings on boot + +dcw_otg: avoid logging function that can cause panics + +See: https://github.com/raspberrypi/firmware/issues/21 +Thanks to cleverca22 for fix + +dwc_otg: mask correct interrupts after transaction error recovery + +The dwc_otg driver will unmask certain interrupts on a transaction +that previously halted in the error state in order to reset the +QTD error count. The various fine-grained interrupt handlers do not +consider that other interrupts besides themselves were unmasked. + +By disabling the two other interrupts only ever enabled in DMA mode +for this purpose, we can avoid unnecessary function calls in the +IRQ handler. This will also prevent an unneccesary FIQ interrupt +from being generated if the FIQ is enabled. + +dwc_otg: fiq: prevent FIQ thrash and incorrect state passing to IRQ + +In the case of a transaction to a device that had previously aborted +due to an error, several interrupts are enabled to reset the error +count when a device responds. This has the side-effect of making the +FIQ thrash because the hardware will generate multiple instances of +a NAK on an IN bulk/interrupt endpoint and multiple instances of ACK +on an OUT bulk/interrupt endpoint. Make the FIQ mask and clear the +associated interrupts. + +Additionally, on non-split transactions make sure that only unmasked +interrupts are cleared. This caused a hard-to-trigger but serious +race condition when you had the combination of an endpoint awaiting +error recovery and a transaction completed on an endpoint - due to +the sequencing and timing of interrupts generated by the dwc_otg core, +it was possible to confuse the IRQ handler. + +Fix function tracing + +dwc_otg: whitespace cleanup in dwc_otg_urb_enqueue + +dwc_otg: prevent OOPSes during device disconnects + +The dwc_otg_urb_enqueue function is thread-unsafe. In particular the +access of urb->hcpriv, usb_hcd_link_urb_to_ep, dwc_otg_urb->qtd and +friends does not occur within a critical section and so if a device +was unplugged during activity there was a high chance that the +usbcore hub_thread would try to disable the endpoint with partially- +formed entries in the URB queue. This would result in BUG() or null +pointer dereferences. + +Fix so that access of urb->hcpriv, enqueuing to the hardware and +adding to usbcore endpoint URB lists is contained within a single +critical section. + +dwc_otg: prevent BUG() in TT allocation if hub address is > 16 + +A fixed-size array is used to track TT allocation. This was +previously set to 16 which caused a crash because +dwc_otg_hcd_allocate_port would read past the end of the array. + +This was hit if a hub was plugged in which enumerated as addr > 16, +due to previous device resets or unplugs. + +Also add #ifdef FIQ_DEBUG around hcd->hub_port_alloc[], which grows +to a large size if 128 hub addresses are supported. This field is +for debug only for tracking which frame an allocate happened in. + +dwc_otg: make channel halts with unknown state less damaging + +If the IRQ received a channel halt interrupt through the FIQ +with no other bits set, the IRQ would not release the host +channel and never complete the URB. + +Add catchall handling to treat as a transaction error and retry. + +dwc_otg: fiq_split: use TTs with more granularity + +This fixes certain issues with split transaction scheduling. + +- Isochronous multi-packet OUT transactions now hog the TT until + they are completed - this prevents hubs aborting transactions + if they get a periodic start-split out-of-order +- Don't perform TT allocation on non-periodic endpoints - this + allows simultaneous use of the TT's bulk/control and periodic + transaction buffers + +This commit will mainly affect USB audio playback. + +dwc_otg: fix potential sleep while atomic during urb enqueue + +Fixes a regression introduced with eb1b482a. Kmalloc called from +dwc_otg_hcd_qtd_add / dwc_otg_hcd_qtd_create did not always have +the GPF_ATOMIC flag set. Force this flag when inside the larger +critical section. + +dwc_otg: make fiq_split_enable imply fiq_fix_enable + +Failing to set up the FIQ correctly would result in +"IRQ 32: nobody cared" errors in dmesg. + +dwc_otg: prevent crashes on host port disconnects + +Fix several issues resulting in crashes or inconsistent state +if a Model A root port was disconnected. + +- Clean up queue heads properly in kill_urbs_in_qh_list by + removing the empty QHs from the schedule lists +- Set the halt status properly to prevent IRQ handlers from + using freed memory +- Add fiq_split related cleanup for saved registers +- Make microframe scheduling reclaim host channels if + active during a disconnect +- Abort URBs with -ESHUTDOWN status response, informing + device drivers so they respond in a more correct fashion + and don't try to resubmit URBs +- Prevent IRQ handlers from attempting to handle channel + interrupts if the associated URB was dequeued (and the + driver state was cleared) + +dwc_otg: prevent leaking URBs during enqueue + +A dwc_otg_urb would get leaked if the HCD enqueue function +failed for any reason. Free the URB at the appropriate points. + +dwc_otg: Enable NAK holdoff for control split transactions + +Certain low-speed devices take a very long time to complete a +data or status stage of a control transaction, producing NAK +responses until they complete internal processing - the USB2.0 +spec limit is up to 500mS. This causes the same type of interrupt +storm as seen with USB-serial dongles prior to c8edb238. + +In certain circumstances, usually while booting, this interrupt +storm could cause SD card timeouts. + +dwc_otg: Fix for occasional lockup on boot when doing a USB reset + +dwc_otg: Don't issue traffic to LS devices in FS mode + +Issuing low-speed packets when the root port is in full-speed mode +causes the root port to stop responding. Explicitly fail when +enqueuing URBs to a LS endpoint on a FS bus. + +Fix ARM architecture issue with local_irq_restore() + +If local_fiq_enable() is called before a local_irq_restore(flags) where +the flags variable has the F bit set, the FIQ will be erroneously disabled. + +Fixup arch_local_irq_restore to avoid trampling the F bit in CPSR. + +Also fix some of the hacks previously implemented for previous dwc_otg +incarnations. + +dwc_otg: fiq_fsm: Base commit for driver rewrite + +This commit removes the previous FIQ fixes entirely and adds fiq_fsm. + +This rewrite features much more complete support for split transactions +and takes into account several OTG hardware bugs. High-speed +isochronous transactions are also capable of being performed by fiq_fsm. + +All driver options have been removed and replaced with: + - dwc_otg.fiq_enable (bool) + - dwc_otg.fiq_fsm_enable (bool) + - dwc_otg.fiq_fsm_mask (bitmask) + - dwc_otg.nak_holdoff (unsigned int) + +Defaults are specified such that fiq_fsm behaves similarly to the +previously implemented FIQ fixes. + +fiq_fsm: Push error recovery into the FIQ when fiq_fsm is used + +If the transfer associated with a QTD failed due to a bus error, the HCD +would retry the transfer up to 3 times (implementing the USB2.0 +three-strikes retry in software). + +Due to the masking mechanism used by fiq_fsm, it is only possible to pass +a single interrupt through to the HCD per-transfer. + +In this instance host channels would fall off the radar because the error +reset would function, but the subsequent channel halt would be lost. + +Push the error count reset into the FIQ handler. + +fiq_fsm: Implement timeout mechanism + +For full-speed endpoints with a large packet size, interrupt latency +runs the risk of the FIQ starting a transaction too late in a full-speed +frame. If the device is still transmitting data when EOF2 for the +downstream frame occurs, the hub will disable the port. This change is +not reflected in the hub status endpoint and the device becomes +unresponsive. + +Prevent high-bandwidth transactions from being started too late in a +frame. The mechanism is not guaranteed: a combination of bit stuffing +and hub latency may still result in a device overrunning. + +fiq_fsm: fix bounce buffer utilisation for Isochronous OUT + +Multi-packet isochronous OUT transactions were subject to a few bounday +bugs. Fix them. + +Audio playback is now much more robust: however, an issue stands with +devices that have adaptive sinks - ALSA plays samples too fast. + +dwc_otg: Return full-speed frame numbers in HS mode + +The frame counter increments on every *microframe* in high-speed mode. +Most device drivers expect this number to be in full-speed frames - this +caused considerable confusion to e.g. snd_usb_audio which uses the +frame counter to estimate the number of samples played. + +fiq_fsm: save PID on completion of interrupt OUT transfers + +Also add edge case handling for interrupt transports. + +Note that for periodic split IN, data toggles are unimplemented in the +OTG host hardware - it unconditionally accepts any PID. + +fiq_fsm: add missing case for fiq_fsm_tt_in_use() + +Certain combinations of bitrate and endpoint activity could +result in a periodic transaction erroneously getting started +while the previous Isochronous OUT was still active. + +fiq_fsm: clear hcintmsk for aborted transactions + +Prevents the FIQ from erroneously handling interrupts +on a timed out channel. + +fiq_fsm: enable by default + +fiq_fsm: fix dequeues for non-periodic split transactions + +If a dequeue happened between the SSPLIT and CSPLIT phases of the +transaction, the HCD would never receive an interrupt. + +fiq_fsm: Disable by default + +fiq_fsm: Handle HC babble errors + +The HCTSIZ transfer size field raises a babble interrupt if +the counter wraps. Handle the resulting interrupt in this case. + +dwc_otg: fix interrupt registration for fiq_enable=0 + +Additionally make the module parameter conditional for wherever +hcd->fiq_state is touched. + +fiq_fsm: Enable by default + +dwc_otg: Fix various issues with root port and transaction errors + +Process the host port interrupts correctly (and don't trample them). +Root port hotplug now functional again. + +Fix a few thinkos with the transaction error passthrough for fiq_fsm. + +fiq_fsm: Implement hack for Split Interrupt transactions + +Hubs aren't too picky about which endpoint we send Control type split +transactions to. By treating Interrupt transfers as Control, it is +possible to use the non-periodic queue in the OTG core as well as the +non-periodic FIFOs in the hub itself. This massively reduces the +microframe exclusivity/contention that periodic split transactions +otherwise have to enforce. + +It goes without saying that this is a fairly egregious USB specification +violation, but it works. + +Original idea by Hans Petter Selasky @ FreeBSD.org. + +dwc_otg: FIQ support on SMP. Set up FIQ stack and handler on Core 0 only. + +dwc_otg: introduce fiq_fsm_spin(un|)lock() + +SMP safety for the FIQ relies on register read-modify write cycles being +completed in the correct order. Several places in the DWC code modify +registers also touched by the FIQ. Protect these by a bare-bones lock +mechanism. + +This also makes it possible to run the FIQ and IRQ handlers on different +cores. + +fiq_fsm: fix build on bcm2708 and bcm2709 platforms + +dwc_otg: put some barriers back where they should be for UP + +bcm2709/dwc_otg: Setup FIQ on core 1 if >1 core active + +dwc_otg: fixup read-modify-write in critical paths + +Be more careful about read-modify-write on registers that the FIQ +also touches. + +Guard fiq_fsm_spin_lock with fiq_enable check + +fiq_fsm: Falling out of the state machine isn't fatal + +This edge case can be hit if the port is disabled while the FIQ is +in the middle of a transaction. Make the effects less severe. + +Also get rid of the useless return value. + +squash: dwc_otg: Allow to build without SMP + +usb: core: make overcurrent messages more prominent + +Hub overcurrent messages are more serious than "debug". Increase loglevel. + +usb: dwc_otg: Don't use dma_to_virt() + +Commit 6ce0d20 changes dma_to_virt() which breaks this driver. +Open code the old dma_to_virt() implementation to work around this. + +Limit the use of __bus_to_virt() to cases where transfer_buffer_length +is set and transfer_buffer is not set. This is done to increase the +chance that this driver will also work on ARCH_BCM2835. + +transfer_buffer should not be NULL if the length is set, but the +comment in the code indicates that there are situations where this +might happen. drivers/usb/isp1760/isp1760-hcd.c also has a similar +comment pointing to a possible: 'usb storage / SCSI bug'. + +Signed-off-by: Noralf Trønnes <noralf@tronnes.org> + +dwc_otg: Fix crash when fiq_enable=0 + +dwc_otg: fiq_fsm: Make high-speed isochronous strided transfers work properly + +Certain low-bandwidth high-speed USB devices (specialist audio devices, +compressed-frame webcams) have packet intervals > 1 microframe. + +Stride these transfers in the FIQ by using the start-of-frame interrupt +to restart the channel at the right time. + +dwc_otg: Force host mode to fix incorrect compute module boards + +dwc_otg: Add ARCH_BCM2835 support + +Signed-off-by: Noralf Trønnes <noralf@tronnes.org> + +dwc_otg: Simplify FIQ irq number code + +Dropping ATAGS means we can simplify the FIQ irq number code. +Also add error checking on the returned irq number. + +Signed-off-by: Noralf Trønnes <noralf@tronnes.org> + +dwc_otg: Remove duplicate gadget probe/unregister function + +dwc_otg: Properly set the HFIR + +Douglas Anderson reported: + +According to the most up to date version of the dwc2 databook, the FRINT +field of the HFIR register should be programmed to: +* 125 us * (PHY clock freq for HS) - 1 +* 1000 us * (PHY clock freq for FS/LS) - 1 + +This is opposed to older versions of the doc that claimed it should be: +* 125 us * (PHY clock freq for HS) +* 1000 us * (PHY clock freq for FS/LS) + +and reported lower timing jitter on a USB analyser + +dcw_otg: trim xfer length when buffer larger than allocated size is received + +dwc_otg: Don't free qh align buffers in atomic context + +dwc_otg: Enable the hack for Split Interrupt transactions by default + +dwc_otg.fiq_fsm_mask=0xF has long been a suggestion for users with audio stutters or other USB bandwidth issues. +So far we are aware of many success stories but no failure caused by this setting. +Make it a default to learn more. + +See: https://www.raspberrypi.org/forums/viewtopic.php?f=28&t=70437 + +Signed-off-by: popcornmix <popcornmix@gmail.com> +--- + arch/arm/include/asm/irqflags.h | 16 +- + arch/arm/kernel/fiqasm.S | 4 + + drivers/usb/Makefile | 1 + + drivers/usb/core/generic.c | 1 + + drivers/usb/core/hub.c | 2 +- + drivers/usb/core/message.c | 79 + + drivers/usb/core/otg_whitelist.h | 114 +- + drivers/usb/gadget/file_storage.c | 3676 ++++++++++ + drivers/usb/host/Kconfig | 13 + + drivers/usb/host/Makefile | 2 + + drivers/usb/host/dwc_common_port/Makefile | 58 + + drivers/usb/host/dwc_common_port/Makefile.fbsd | 17 + + drivers/usb/host/dwc_common_port/Makefile.linux | 49 + + drivers/usb/host/dwc_common_port/changes.txt | 174 + + drivers/usb/host/dwc_common_port/doc/doxygen.cfg | 270 + + drivers/usb/host/dwc_common_port/dwc_cc.c | 532 ++ + drivers/usb/host/dwc_common_port/dwc_cc.h | 224 + + drivers/usb/host/dwc_common_port/dwc_common_fbsd.c | 1308 ++++ + .../usb/host/dwc_common_port/dwc_common_linux.c | 1433 ++++ + drivers/usb/host/dwc_common_port/dwc_common_nbsd.c | 1275 ++++ + drivers/usb/host/dwc_common_port/dwc_crypto.c | 308 + + drivers/usb/host/dwc_common_port/dwc_crypto.h | 111 + + drivers/usb/host/dwc_common_port/dwc_dh.c | 291 + + drivers/usb/host/dwc_common_port/dwc_dh.h | 106 + + drivers/usb/host/dwc_common_port/dwc_list.h | 594 ++ + drivers/usb/host/dwc_common_port/dwc_mem.c | 245 + + drivers/usb/host/dwc_common_port/dwc_modpow.c | 636 ++ + drivers/usb/host/dwc_common_port/dwc_modpow.h | 34 + + drivers/usb/host/dwc_common_port/dwc_notifier.c | 319 + + drivers/usb/host/dwc_common_port/dwc_notifier.h | 122 + + drivers/usb/host/dwc_common_port/dwc_os.h | 1276 ++++ + drivers/usb/host/dwc_common_port/usb.h | 946 +++ + drivers/usb/host/dwc_otg/Makefile | 82 + + drivers/usb/host/dwc_otg/doc/doxygen.cfg | 224 + + drivers/usb/host/dwc_otg/dummy_audio.c | 1575 +++++ + drivers/usb/host/dwc_otg/dwc_cfi_common.h | 142 + + drivers/usb/host/dwc_otg/dwc_otg_adp.c | 854 +++ + drivers/usb/host/dwc_otg/dwc_otg_adp.h | 80 + + drivers/usb/host/dwc_otg/dwc_otg_attr.c | 1210 ++++ + drivers/usb/host/dwc_otg/dwc_otg_attr.h | 89 + + drivers/usb/host/dwc_otg/dwc_otg_cfi.c | 1876 +++++ + drivers/usb/host/dwc_otg/dwc_otg_cfi.h | 320 + + drivers/usb/host/dwc_otg/dwc_otg_cil.c | 7141 ++++++++++++++++++++ + drivers/usb/host/dwc_otg/dwc_otg_cil.h | 1464 ++++ + drivers/usb/host/dwc_otg/dwc_otg_cil_intr.c | 1594 +++++ + drivers/usb/host/dwc_otg/dwc_otg_core_if.h | 705 ++ + drivers/usb/host/dwc_otg/dwc_otg_dbg.h | 117 + + drivers/usb/host/dwc_otg/dwc_otg_driver.c | 1757 +++++ + drivers/usb/host/dwc_otg/dwc_otg_driver.h | 86 + + drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c | 1355 ++++ + drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.h | 370 + + drivers/usb/host/dwc_otg/dwc_otg_fiq_stub.S | 80 + + drivers/usb/host/dwc_otg/dwc_otg_hcd.c | 4257 ++++++++++++ + drivers/usb/host/dwc_otg/dwc_otg_hcd.h | 862 +++ + drivers/usb/host/dwc_otg/dwc_otg_hcd_ddma.c | 1132 ++++ + drivers/usb/host/dwc_otg/dwc_otg_hcd_if.h | 417 ++ + drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c | 2727 ++++++++ + drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c | 1005 +++ + drivers/usb/host/dwc_otg/dwc_otg_hcd_queue.c | 962 +++ + drivers/usb/host/dwc_otg/dwc_otg_os_dep.h | 188 + + drivers/usb/host/dwc_otg/dwc_otg_pcd.c | 2712 ++++++++ + drivers/usb/host/dwc_otg/dwc_otg_pcd.h | 266 + + drivers/usb/host/dwc_otg/dwc_otg_pcd_if.h | 360 + + drivers/usb/host/dwc_otg/dwc_otg_pcd_intr.c | 5147 ++++++++++++++ + drivers/usb/host/dwc_otg/dwc_otg_pcd_linux.c | 1280 ++++ + drivers/usb/host/dwc_otg/dwc_otg_regs.h | 2550 +++++++ + drivers/usb/host/dwc_otg/test/Makefile | 16 + + drivers/usb/host/dwc_otg/test/dwc_otg_test.pm | 337 + + drivers/usb/host/dwc_otg/test/test_mod_param.pl | 133 + + drivers/usb/host/dwc_otg/test/test_sysfs.pl | 193 + + 70 files changed, 59885 insertions(+), 16 deletions(-) + create mode 100644 drivers/usb/gadget/file_storage.c + create mode 100644 drivers/usb/host/dwc_common_port/Makefile + create mode 100644 drivers/usb/host/dwc_common_port/Makefile.fbsd + create mode 100644 drivers/usb/host/dwc_common_port/Makefile.linux + create mode 100644 drivers/usb/host/dwc_common_port/changes.txt + create mode 100644 drivers/usb/host/dwc_common_port/doc/doxygen.cfg + create mode 100644 drivers/usb/host/dwc_common_port/dwc_cc.c + create mode 100644 drivers/usb/host/dwc_common_port/dwc_cc.h + create mode 100644 drivers/usb/host/dwc_common_port/dwc_common_fbsd.c + create mode 100644 drivers/usb/host/dwc_common_port/dwc_common_linux.c + create mode 100644 drivers/usb/host/dwc_common_port/dwc_common_nbsd.c + create mode 100644 drivers/usb/host/dwc_common_port/dwc_crypto.c + create mode 100644 drivers/usb/host/dwc_common_port/dwc_crypto.h + create mode 100644 drivers/usb/host/dwc_common_port/dwc_dh.c + create mode 100644 drivers/usb/host/dwc_common_port/dwc_dh.h + create mode 100644 drivers/usb/host/dwc_common_port/dwc_list.h + create mode 100644 drivers/usb/host/dwc_common_port/dwc_mem.c + create mode 100644 drivers/usb/host/dwc_common_port/dwc_modpow.c + create mode 100644 drivers/usb/host/dwc_common_port/dwc_modpow.h + create mode 100644 drivers/usb/host/dwc_common_port/dwc_notifier.c + create mode 100644 drivers/usb/host/dwc_common_port/dwc_notifier.h + create mode 100644 drivers/usb/host/dwc_common_port/dwc_os.h + create mode 100644 drivers/usb/host/dwc_common_port/usb.h + create mode 100644 drivers/usb/host/dwc_otg/Makefile + create mode 100644 drivers/usb/host/dwc_otg/doc/doxygen.cfg + create mode 100644 drivers/usb/host/dwc_otg/dummy_audio.c + create mode 100644 drivers/usb/host/dwc_otg/dwc_cfi_common.h + create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_adp.c + create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_adp.h + create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_attr.c + create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_attr.h + create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_cfi.c + create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_cfi.h + create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_cil.c + create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_cil.h + create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_cil_intr.c + create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_core_if.h + create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_dbg.h + create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_driver.c + create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_driver.h + create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c + create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.h + create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_fiq_stub.S + create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_hcd.c + create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_hcd.h + create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_hcd_ddma.c + create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_hcd_if.h + create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c + create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c + create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_hcd_queue.c + create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_os_dep.h + create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_pcd.c + create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_pcd.h + create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_pcd_if.h + create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_pcd_intr.c + create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_pcd_linux.c + create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_regs.h + create mode 100644 drivers/usb/host/dwc_otg/test/Makefile + create mode 100644 drivers/usb/host/dwc_otg/test/dwc_otg_test.pm + create mode 100644 drivers/usb/host/dwc_otg/test/test_mod_param.pl + create mode 100644 drivers/usb/host/dwc_otg/test/test_sysfs.pl + +diff --git a/arch/arm/include/asm/irqflags.h b/arch/arm/include/asm/irqflags.h +index e6b70d9..a48ccf7 100644 +--- a/arch/arm/include/asm/irqflags.h ++++ b/arch/arm/include/asm/irqflags.h +@@ -162,13 +162,23 @@ static inline unsigned long arch_local_save_flags(void) + } + + /* +- * restore saved IRQ & FIQ state ++ * restore saved IRQ state + */ + #define arch_local_irq_restore arch_local_irq_restore + static inline void arch_local_irq_restore(unsigned long flags) + { +- asm volatile( +- " msr " IRQMASK_REG_NAME_W ", %0 @ local_irq_restore" ++ unsigned long temp = 0; ++ flags &= ~(1 << 6); ++ asm volatile ( ++ " mrs %0, cpsr" ++ : "=r" (temp) ++ : ++ : "memory", "cc"); ++ /* Preserve FIQ bit */ ++ temp &= (1 << 6); ++ flags = flags | temp; ++ asm volatile ( ++ " msr cpsr_c, %0 @ local_irq_restore" + : + : "r" (flags) + : "memory", "cc"); +diff --git a/arch/arm/kernel/fiqasm.S b/arch/arm/kernel/fiqasm.S +index 8dd26e1..eef4847 100644 +--- a/arch/arm/kernel/fiqasm.S ++++ b/arch/arm/kernel/fiqasm.S +@@ -47,3 +47,7 @@ ENTRY(__get_fiq_regs) + mov r0, r0 @ avoid hazard prior to ARMv4 + ret lr + ENDPROC(__get_fiq_regs) ++ ++ENTRY(__FIQ_Branch) ++ mov pc, r8 ++ENDPROC(__FIQ_Branch) +diff --git a/drivers/usb/Makefile b/drivers/usb/Makefile +index dca7856..5c467de 100644 +--- a/drivers/usb/Makefile ++++ b/drivers/usb/Makefile +@@ -7,6 +7,7 @@ + obj-$(CONFIG_USB) += core/ + obj-$(CONFIG_USB_SUPPORT) += phy/ + ++obj-$(CONFIG_USB_DWCOTG) += host/ + obj-$(CONFIG_USB_DWC3) += dwc3/ + obj-$(CONFIG_USB_DWC2) += dwc2/ + obj-$(CONFIG_USB_ISP1760) += isp1760/ +diff --git a/drivers/usb/core/generic.c b/drivers/usb/core/generic.c +index 358ca8d..abaac7c 100644 +--- a/drivers/usb/core/generic.c ++++ b/drivers/usb/core/generic.c +@@ -152,6 +152,7 @@ int usb_choose_configuration(struct usb_device *udev) + dev_warn(&udev->dev, + "no configuration chosen from %d choice%s\n", + num_configs, plural(num_configs)); ++ dev_warn(&udev->dev, "No support over %dmA\n", udev->bus_mA); + } + return i; + } +diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c +index 1ab42bf..292a26c 100644 +--- a/drivers/usb/core/hub.c ++++ b/drivers/usb/core/hub.c +@@ -5044,7 +5044,7 @@ static void port_event(struct usb_hub *hub, int port1) + if (portchange & USB_PORT_STAT_C_OVERCURRENT) { + u16 status = 0, unused; + +- dev_dbg(&port_dev->dev, "over-current change\n"); ++ dev_notice(&port_dev->dev, "over-current change\n"); + usb_clear_port_feature(hdev, port1, + USB_PORT_FEAT_C_OVER_CURRENT); + msleep(100); /* Cool down */ +diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c +index 8e641b5..de3ed7d 100644 +--- a/drivers/usb/core/message.c ++++ b/drivers/usb/core/message.c +@@ -1909,6 +1909,85 @@ free_interfaces: + if (cp->string == NULL && + !(dev->quirks & USB_QUIRK_CONFIG_INTF_STRINGS)) + cp->string = usb_cache_string(dev, cp->desc.iConfiguration); ++/* Uncomment this define to enable the HS Electrical Test support */ ++#define DWC_HS_ELECT_TST 1 ++#ifdef DWC_HS_ELECT_TST ++ /* Here we implement the HS Electrical Test support. The ++ * tester uses a vendor ID of 0x1A0A to indicate we should ++ * run a special test sequence. The product ID tells us ++ * which sequence to run. We invoke the test sequence by ++ * sending a non-standard SetFeature command to our root ++ * hub port. Our dwc_otg_hcd_hub_control() routine will ++ * recognize the command and perform the desired test ++ * sequence. ++ */ ++ if (dev->descriptor.idVendor == 0x1A0A) { ++ /* HSOTG Electrical Test */ ++ dev_warn(&dev->dev, "VID from HSOTG Electrical Test Fixture\n"); ++ ++ if (dev->bus && dev->bus->root_hub) { ++ struct usb_device *hdev = dev->bus->root_hub; ++ dev_warn(&dev->dev, "Got PID 0x%x\n", dev->descriptor.idProduct); ++ ++ switch (dev->descriptor.idProduct) { ++ case 0x0101: /* TEST_SE0_NAK */ ++ dev_warn(&dev->dev, "TEST_SE0_NAK\n"); ++ usb_control_msg(hdev, usb_sndctrlpipe(hdev, 0), ++ USB_REQ_SET_FEATURE, USB_RT_PORT, ++ USB_PORT_FEAT_TEST, 0x300, NULL, 0, HZ); ++ break; ++ ++ case 0x0102: /* TEST_J */ ++ dev_warn(&dev->dev, "TEST_J\n"); ++ usb_control_msg(hdev, usb_sndctrlpipe(hdev, 0), ++ USB_REQ_SET_FEATURE, USB_RT_PORT, ++ USB_PORT_FEAT_TEST, 0x100, NULL, 0, HZ); ++ break; ++ ++ case 0x0103: /* TEST_K */ ++ dev_warn(&dev->dev, "TEST_K\n"); ++ usb_control_msg(hdev, usb_sndctrlpipe(hdev, 0), ++ USB_REQ_SET_FEATURE, USB_RT_PORT, ++ USB_PORT_FEAT_TEST, 0x200, NULL, 0, HZ); ++ break; ++ ++ case 0x0104: /* TEST_PACKET */ ++ dev_warn(&dev->dev, "TEST_PACKET\n"); ++ usb_control_msg(hdev, usb_sndctrlpipe(hdev, 0), ++ USB_REQ_SET_FEATURE, USB_RT_PORT, ++ USB_PORT_FEAT_TEST, 0x400, NULL, 0, HZ); ++ break; ++ ++ case 0x0105: /* TEST_FORCE_ENABLE */ ++ dev_warn(&dev->dev, "TEST_FORCE_ENABLE\n"); ++ usb_control_msg(hdev, usb_sndctrlpipe(hdev, 0), ++ USB_REQ_SET_FEATURE, USB_RT_PORT, ++ USB_PORT_FEAT_TEST, 0x500, NULL, 0, HZ); ++ break; ++ ++ case 0x0106: /* HS_HOST_PORT_SUSPEND_RESUME */ ++ dev_warn(&dev->dev, "HS_HOST_PORT_SUSPEND_RESUME\n"); ++ usb_control_msg(hdev, usb_sndctrlpipe(hdev, 0), ++ USB_REQ_SET_FEATURE, USB_RT_PORT, ++ USB_PORT_FEAT_TEST, 0x600, NULL, 0, 40 * HZ); ++ break; ++ ++ case 0x0107: /* SINGLE_STEP_GET_DEVICE_DESCRIPTOR setup */ ++ dev_warn(&dev->dev, "SINGLE_STEP_GET_DEVICE_DESCRIPTOR setup\n"); ++ usb_control_msg(hdev, usb_sndctrlpipe(hdev, 0), ++ USB_REQ_SET_FEATURE, USB_RT_PORT, ++ USB_PORT_FEAT_TEST, 0x700, NULL, 0, 40 * HZ); ++ break; ++ ++ case 0x0108: /* SINGLE_STEP_GET_DEVICE_DESCRIPTOR execute */ ++ dev_warn(&dev->dev, "SINGLE_STEP_GET_DEVICE_DESCRIPTOR execute\n"); ++ usb_control_msg(hdev, usb_sndctrlpipe(hdev, 0), ++ USB_REQ_SET_FEATURE, USB_RT_PORT, ++ USB_PORT_FEAT_TEST, 0x800, NULL, 0, 40 * HZ); ++ } ++ } ++ } ++#endif /* DWC_HS_ELECT_TST */ + + /* Now that the interfaces are installed, re-enable LPM. */ + usb_unlocked_enable_lpm(dev); +diff --git a/drivers/usb/core/otg_whitelist.h b/drivers/usb/core/otg_whitelist.h +index a95b0c9..17b605f 100644 +--- a/drivers/usb/core/otg_whitelist.h ++++ b/drivers/usb/core/otg_whitelist.h +@@ -19,33 +19,82 @@ + static struct usb_device_id whitelist_table[] = { + + /* hubs are optional in OTG, but very handy ... */ ++#define CERT_WITHOUT_HUBS ++#if defined(CERT_WITHOUT_HUBS) ++{ USB_DEVICE( 0x0000, 0x0000 ), }, /* Root HUB Only*/ ++#else + { USB_DEVICE_INFO(USB_CLASS_HUB, 0, 0), }, + { USB_DEVICE_INFO(USB_CLASS_HUB, 0, 1), }, ++{ USB_DEVICE_INFO(USB_CLASS_HUB, 0, 2), }, ++#endif + + #ifdef CONFIG_USB_PRINTER /* ignoring nonstatic linkage! */ + /* FIXME actually, printers are NOT supposed to use device classes; + * they're supposed to use interface classes... + */ +-{ USB_DEVICE_INFO(7, 1, 1) }, +-{ USB_DEVICE_INFO(7, 1, 2) }, +-{ USB_DEVICE_INFO(7, 1, 3) }, ++//{ USB_DEVICE_INFO(7, 1, 1) }, ++//{ USB_DEVICE_INFO(7, 1, 2) }, ++//{ USB_DEVICE_INFO(7, 1, 3) }, + #endif + + #ifdef CONFIG_USB_NET_CDCETHER + /* Linux-USB CDC Ethernet gadget */ +-{ USB_DEVICE(0x0525, 0xa4a1), }, ++//{ USB_DEVICE(0x0525, 0xa4a1), }, + /* Linux-USB CDC Ethernet + RNDIS gadget */ +-{ USB_DEVICE(0x0525, 0xa4a2), }, ++//{ USB_DEVICE(0x0525, 0xa4a2), }, + #endif + + #if defined(CONFIG_USB_TEST) || defined(CONFIG_USB_TEST_MODULE) + /* gadget zero, for testing */ +-{ USB_DEVICE(0x0525, 0xa4a0), }, ++//{ USB_DEVICE(0x0525, 0xa4a0), }, + #endif + ++/* OPT Tester */ ++{ USB_DEVICE( 0x1a0a, 0x0101 ), }, /* TEST_SE0_NAK */ ++{ USB_DEVICE( 0x1a0a, 0x0102 ), }, /* Test_J */ ++{ USB_DEVICE( 0x1a0a, 0x0103 ), }, /* Test_K */ ++{ USB_DEVICE( 0x1a0a, 0x0104 ), }, /* Test_PACKET */ ++{ USB_DEVICE( 0x1a0a, 0x0105 ), }, /* Test_FORCE_ENABLE */ ++{ USB_DEVICE( 0x1a0a, 0x0106 ), }, /* HS_PORT_SUSPEND_RESUME */ ++{ USB_DEVICE( 0x1a0a, 0x0107 ), }, /* SINGLE_STEP_GET_DESCRIPTOR setup */ ++{ USB_DEVICE( 0x1a0a, 0x0108 ), }, /* SINGLE_STEP_GET_DESCRIPTOR execute */ ++ ++/* Sony cameras */ ++{ USB_DEVICE_VER(0x054c,0x0010,0x0410, 0x0500), }, ++ ++/* Memory Devices */ ++//{ USB_DEVICE( 0x0781, 0x5150 ), }, /* SanDisk */ ++//{ USB_DEVICE( 0x05DC, 0x0080 ), }, /* Lexar */ ++//{ USB_DEVICE( 0x4146, 0x9281 ), }, /* IOMEGA */ ++//{ USB_DEVICE( 0x067b, 0x2507 ), }, /* Hammer 20GB External HD */ ++{ USB_DEVICE( 0x0EA0, 0x2168 ), }, /* Ours Technology Inc. (BUFFALO ClipDrive)*/ ++//{ USB_DEVICE( 0x0457, 0x0150 ), }, /* Silicon Integrated Systems Corp. */ ++ ++/* HP Printers */ ++//{ USB_DEVICE( 0x03F0, 0x1102 ), }, /* HP Photosmart 245 */ ++//{ USB_DEVICE( 0x03F0, 0x1302 ), }, /* HP Photosmart 370 Series */ ++ ++/* Speakers */ ++//{ USB_DEVICE( 0x0499, 0x3002 ), }, /* YAMAHA YST-MS35D USB Speakers */ ++//{ USB_DEVICE( 0x0672, 0x1041 ), }, /* Labtec USB Headset */ ++ + { } /* Terminating entry */ + }; + ++static inline void report_errors(struct usb_device *dev) ++{ ++ /* OTG MESSAGE: report errors here, customize to match your product */ ++ dev_info(&dev->dev, "device Vendor:%04x Product:%04x is not supported\n", ++ le16_to_cpu(dev->descriptor.idVendor), ++ le16_to_cpu(dev->descriptor.idProduct)); ++ if (USB_CLASS_HUB == dev->descriptor.bDeviceClass){ ++ dev_printk(KERN_CRIT, &dev->dev, "Unsupported Hub Topology\n"); ++ } else { ++ dev_printk(KERN_CRIT, &dev->dev, "Attached Device is not Supported\n"); ++ } ++} ++ ++ + static int is_targeted(struct usb_device *dev) + { + struct usb_device_id *id = whitelist_table; +@@ -95,16 +144,57 @@ static int is_targeted(struct usb_device *dev) + continue; + + return 1; +- } ++ /* NOTE: can't use usb_match_id() since interface caches ++ * aren't set up yet. this is cut/paste from that code. ++ */ ++ for (id = whitelist_table; id->match_flags; id++) { ++#ifdef DEBUG ++ dev_dbg(&dev->dev, ++ "ID: V:%04x P:%04x DC:%04x SC:%04x PR:%04x \n", ++ id->idVendor, ++ id->idProduct, ++ id->bDeviceClass, ++ id->bDeviceSubClass, ++ id->bDeviceProtocol); ++#endif + +- /* add other match criteria here ... */ ++ if ((id->match_flags & USB_DEVICE_ID_MATCH_VENDOR) && ++ id->idVendor != le16_to_cpu(dev->descriptor.idVendor)) ++ continue; + ++ if ((id->match_flags & USB_DEVICE_ID_MATCH_PRODUCT) && ++ id->idProduct != le16_to_cpu(dev->descriptor.idProduct)) ++ continue; + +- /* OTG MESSAGE: report errors here, customize to match your product */ +- dev_err(&dev->dev, "device v%04x p%04x is not supported\n", +- le16_to_cpu(dev->descriptor.idVendor), +- le16_to_cpu(dev->descriptor.idProduct)); ++ /* No need to test id->bcdDevice_lo != 0, since 0 is never ++ greater than any unsigned number. */ ++ if ((id->match_flags & USB_DEVICE_ID_MATCH_DEV_LO) && ++ (id->bcdDevice_lo > le16_to_cpu(dev->descriptor.bcdDevice))) ++ continue; ++ ++ if ((id->match_flags & USB_DEVICE_ID_MATCH_DEV_HI) && ++ (id->bcdDevice_hi < le16_to_cpu(dev->descriptor.bcdDevice))) ++ continue; ++ ++ if ((id->match_flags & USB_DEVICE_ID_MATCH_DEV_CLASS) && ++ (id->bDeviceClass != dev->descriptor.bDeviceClass)) ++ continue; ++ ++ if ((id->match_flags & USB_DEVICE_ID_MATCH_DEV_SUBCLASS) && ++ (id->bDeviceSubClass != dev->descriptor.bDeviceSubClass)) ++ continue; ++ ++ if ((id->match_flags & USB_DEVICE_ID_MATCH_DEV_PROTOCOL) && ++ (id->bDeviceProtocol != dev->descriptor.bDeviceProtocol)) ++ continue; ++ ++ return 1; ++ } ++ } ++ ++ /* add other match criteria here ... */ + ++ report_errors(dev); + return 0; + } + +diff --git a/drivers/usb/gadget/file_storage.c b/drivers/usb/gadget/file_storage.c +new file mode 100644 +index 0000000..a896d73 +--- /dev/null ++++ b/drivers/usb/gadget/file_storage.c +@@ -0,0 +1,3676 @@ ++/* ++ * file_storage.c -- File-backed USB Storage Gadget, for USB development ++ * ++ * Copyright (C) 2003-2008 Alan Stern ++ * 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, ++ * without modification. ++ * 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. ++ * 3. The names of the above-listed copyright holders may not be used ++ * to endorse or promote products derived from this software without ++ * specific prior written permission. ++ * ++ * ALTERNATIVELY, this software may be distributed under the terms of the ++ * GNU General Public License ("GPL") as published by the Free Software ++ * Foundation, either version 2 of that License or (at your option) any ++ * later version. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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. ++ */ ++ ++ ++/* ++ * The File-backed Storage Gadget acts as a USB Mass Storage device, ++ * appearing to the host as a disk drive or as a CD-ROM drive. In addition ++ * to providing an example of a genuinely useful gadget driver for a USB ++ * device, it also illustrates a technique of double-buffering for increased ++ * throughput. Last but not least, it gives an easy way to probe the ++ * behavior of the Mass Storage drivers in a USB host. ++ * ++ * Backing storage is provided by a regular file or a block device, specified ++ * by the "file" module parameter. Access can be limited to read-only by ++ * setting the optional "ro" module parameter. (For CD-ROM emulation, ++ * access is always read-only.) The gadget will indicate that it has ++ * removable media if the optional "removable" module parameter is set. ++ * ++ * The gadget supports the Control-Bulk (CB), Control-Bulk-Interrupt (CBI), ++ * and Bulk-Only (also known as Bulk-Bulk-Bulk or BBB) transports, selected ++ * by the optional "transport" module parameter. It also supports the ++ * following protocols: RBC (0x01), ATAPI or SFF-8020i (0x02), QIC-157 (0c03), ++ * UFI (0x04), SFF-8070i (0x05), and transparent SCSI (0x06), selected by ++ * the optional "protocol" module parameter. In addition, the default ++ * Vendor ID, Product ID, release number and serial number can be overridden. ++ * ++ * There is support for multiple logical units (LUNs), each of which has ++ * its own backing file. The number of LUNs can be set using the optional ++ * "luns" module parameter (anywhere from 1 to 8), and the corresponding ++ * files are specified using comma-separated lists for "file" and "ro". ++ * The default number of LUNs is taken from the number of "file" elements; ++ * it is 1 if "file" is not given. If "removable" is not set then a backing ++ * file must be specified for each LUN. If it is set, then an unspecified ++ * or empty backing filename means the LUN's medium is not loaded. Ideally ++ * each LUN would be settable independently as a disk drive or a CD-ROM ++ * drive, but currently all LUNs have to be the same type. The CD-ROM ++ * emulation includes a single data track and no audio tracks; hence there ++ * need be only one backing file per LUN. ++ * ++ * Requirements are modest; only a bulk-in and a bulk-out endpoint are ++ * needed (an interrupt-out endpoint is also needed for CBI). The memory ++ * requirement amounts to two 16K buffers, size configurable by a parameter. ++ * Support is included for both full-speed and high-speed operation. ++ * ++ * Note that the driver is slightly non-portable in that it assumes a ++ * single memory/DMA buffer will be useable for bulk-in, bulk-out, and ++ * interrupt-in endpoints. With most device controllers this isn't an ++ * issue, but there may be some with hardware restrictions that prevent ++ * a buffer from being used by more than one endpoint. ++ * ++ * Module options: ++ * ++ * file=filename[,filename...] ++ * Required if "removable" is not set, names of ++ * the files or block devices used for ++ * backing storage ++ * serial=HHHH... Required serial number (string of hex chars) ++ * ro=b[,b...] Default false, booleans for read-only access ++ * removable Default false, boolean for removable media ++ * luns=N Default N = number of filenames, number of ++ * LUNs to support ++ * nofua=b[,b...] Default false, booleans for ignore FUA flag ++ * in SCSI WRITE(10,12) commands ++ * stall Default determined according to the type of ++ * USB device controller (usually true), ++ * boolean to permit the driver to halt ++ * bulk endpoints ++ * cdrom Default false, boolean for whether to emulate ++ * a CD-ROM drive ++ * transport=XXX Default BBB, transport name (CB, CBI, or BBB) ++ * protocol=YYY Default SCSI, protocol name (RBC, 8020 or ++ * ATAPI, QIC, UFI, 8070, or SCSI; ++ * also 1 - 6) ++ * vendor=0xVVVV Default 0x0525 (NetChip), USB Vendor ID ++ * product=0xPPPP Default 0xa4a5 (FSG), USB Product ID ++ * release=0xRRRR Override the USB release number (bcdDevice) ++ * buflen=N Default N=16384, buffer size used (will be ++ * rounded down to a multiple of ++ * PAGE_CACHE_SIZE) ++ * ++ * If CONFIG_USB_FILE_STORAGE_TEST is not set, only the "file", "serial", "ro", ++ * "removable", "luns", "nofua", "stall", and "cdrom" options are available; ++ * default values are used for everything else. ++ * ++ * The pathnames of the backing files and the ro settings are available in ++ * the attribute files "file", "nofua", and "ro" in the lun<n> subdirectory of ++ * the gadget's sysfs directory. If the "removable" option is set, writing to ++ * these files will simulate ejecting/loading the medium (writing an empty ++ * line means eject) and adjusting a write-enable tab. Changes to the ro ++ * setting are not allowed when the medium is loaded or if CD-ROM emulation ++ * is being used. ++ * ++ * This gadget driver is heavily based on "Gadget Zero" by David Brownell. ++ * The driver's SCSI command interface was based on the "Information ++ * technology - Small Computer System Interface - 2" document from ++ * X3T9.2 Project 375D, Revision 10L, 7-SEP-93, available at ++ * <http://www.t10.org/ftp/t10/drafts/s2/s2-r10l.pdf>. The single exception ++ * is opcode 0x23 (READ FORMAT CAPACITIES), which was based on the ++ * "Universal Serial Bus Mass Storage Class UFI Command Specification" ++ * document, Revision 1.0, December 14, 1998, available at ++ * <http://www.usb.org/developers/devclass_docs/usbmass-ufi10.pdf>. ++ */ ++ ++ ++/* ++ * Driver Design ++ * ++ * The FSG driver is fairly straightforward. There is a main kernel ++ * thread that handles most of the work. Interrupt routines field ++ * callbacks from the controller driver: bulk- and interrupt-request ++ * completion notifications, endpoint-0 events, and disconnect events. ++ * Completion events are passed to the main thread by wakeup calls. Many ++ * ep0 requests are handled at interrupt time, but SetInterface, ++ * SetConfiguration, and device reset requests are forwarded to the ++ * thread in the form of "exceptions" using SIGUSR1 signals (since they ++ * should interrupt any ongoing file I/O operations). ++ * ++ * The thread's main routine implements the standard command/data/status ++ * parts of a SCSI interaction. It and its subroutines are full of tests ++ * for pending signals/exceptions -- all this polling is necessary since ++ * the kernel has no setjmp/longjmp equivalents. (Maybe this is an ++ * indication that the driver really wants to be running in userspace.) ++ * An important point is that so long as the thread is alive it keeps an ++ * open reference to the backing file. This will prevent unmounting ++ * the backing file's underlying filesystem and could cause problems ++ * during system shutdown, for example. To prevent such problems, the ++ * thread catches INT, TERM, and KILL signals and converts them into ++ * an EXIT exception. ++ * ++ * In normal operation the main thread is started during the gadget's ++ * fsg_bind() callback and stopped during fsg_unbind(). But it can also ++ * exit when it receives a signal, and there's no point leaving the ++ * gadget running when the thread is dead. So just before the thread ++ * exits, it deregisters the gadget driver. This makes things a little ++ * tricky: The driver is deregistered at two places, and the exiting ++ * thread can indirectly call fsg_unbind() which in turn can tell the ++ * thread to exit. The first problem is resolved through the use of the ++ * REGISTERED atomic bitflag; the driver will only be deregistered once. ++ * The second problem is resolved by having fsg_unbind() check ++ * fsg->state; it won't try to stop the thread if the state is already ++ * FSG_STATE_TERMINATED. ++ * ++ * To provide maximum throughput, the driver uses a circular pipeline of ++ * buffer heads (struct fsg_buffhd). In principle the pipeline can be ++ * arbitrarily long; in practice the benefits don't justify having more ++ * than 2 stages (i.e., double buffering). But it helps to think of the ++ * pipeline as being a long one. Each buffer head contains a bulk-in and ++ * a bulk-out request pointer (since the buffer can be used for both ++ * output and input -- directions always are given from the host's ++ * point of view) as well as a pointer to the buffer and various state ++ * variables. ++ * ++ * Use of the pipeline follows a simple protocol. There is a variable ++ * (fsg->next_buffhd_to_fill) that points to the next buffer head to use. ++ * At any time that buffer head may still be in use from an earlier ++ * request, so each buffer head has a state variable indicating whether ++ * it is EMPTY, FULL, or BUSY. Typical use involves waiting for the ++ * buffer head to be EMPTY, filling the buffer either by file I/O or by ++ * USB I/O (during which the buffer head is BUSY), and marking the buffer ++ * head FULL when the I/O is complete. Then the buffer will be emptied ++ * (again possibly by USB I/O, during which it is marked BUSY) and ++ * finally marked EMPTY again (possibly by a completion routine). ++ * ++ * A module parameter tells the driver to avoid stalling the bulk ++ * endpoints wherever the transport specification allows. This is ++ * necessary for some UDCs like the SuperH, which cannot reliably clear a ++ * halt on a bulk endpoint. However, under certain circumstances the ++ * Bulk-only specification requires a stall. In such cases the driver ++ * will halt the endpoint and set a flag indicating that it should clear ++ * the halt in software during the next device reset. Hopefully this ++ * will permit everything to work correctly. Furthermore, although the ++ * specification allows the bulk-out endpoint to halt when the host sends ++ * too much data, implementing this would cause an unavoidable race. ++ * The driver will always use the "no-stall" approach for OUT transfers. ++ * ++ * One subtle point concerns sending status-stage responses for ep0 ++ * requests. Some of these requests, such as device reset, can involve ++ * interrupting an ongoing file I/O operation, which might take an ++ * arbitrarily long time. During that delay the host might give up on ++ * the original ep0 request and issue a new one. When that happens the ++ * driver should not notify the host about completion of the original ++ * request, as the host will no longer be waiting for it. So the driver ++ * assigns to each ep0 request a unique tag, and it keeps track of the ++ * tag value of the request associated with a long-running exception ++ * (device-reset, interface-change, or configuration-change). When the ++ * exception handler is finished, the status-stage response is submitted ++ * only if the current ep0 request tag is equal to the exception request ++ * tag. Thus only the most recently received ep0 request will get a ++ * status-stage response. ++ * ++ * Warning: This driver source file is too long. It ought to be split up ++ * into a header file plus about 3 separate .c files, to handle the details ++ * of the Gadget, USB Mass Storage, and SCSI protocols. ++ */ ++ ++ ++/* #define VERBOSE_DEBUG */ ++/* #define DUMP_MSGS */ ++ ++ ++#include <linux/blkdev.h> ++#include <linux/completion.h> ++#include <linux/dcache.h> ++#include <linux/delay.h> ++#include <linux/device.h> ++#include <linux/fcntl.h> ++#include <linux/file.h> ++#include <linux/fs.h> ++#include <linux/kref.h> ++#include <linux/kthread.h> ++#include <linux/limits.h> ++#include <linux/module.h> ++#include <linux/rwsem.h> ++#include <linux/slab.h> ++#include <linux/spinlock.h> ++#include <linux/string.h> ++#include <linux/freezer.h> ++#include <linux/utsname.h> ++ ++#include <linux/usb/ch9.h> ++#include <linux/usb/gadget.h> ++ ++#include "gadget_chips.h" ++ ++ ++ ++/* ++ * Kbuild is not very cooperative with respect to linking separately ++ * compiled library objects into one module. So for now we won't use ++ * separate compilation ... ensuring init/exit sections work to shrink ++ * the runtime footprint, and giving us at least some parts of what ++ * a "gcc --combine ... part1.c part2.c part3.c ... " build would. ++ */ ++#include "usbstring.c" ++#include "config.c" ++#include "epautoconf.c" ++ ++/*-------------------------------------------------------------------------*/ ++ ++#define DRIVER_DESC "File-backed Storage Gadget" ++#define DRIVER_NAME "g_file_storage" ++#define DRIVER_VERSION "1 September 2010" ++ ++static char fsg_string_manufacturer[64]; ++static const char fsg_string_product[] = DRIVER_DESC; ++static const char fsg_string_config[] = "Self-powered"; ++static const char fsg_string_interface[] = "Mass Storage"; ++ ++ ++#include "storage_common.c" ++ ++ ++MODULE_DESCRIPTION(DRIVER_DESC); ++MODULE_AUTHOR("Alan Stern"); ++MODULE_LICENSE("Dual BSD/GPL"); ++ ++/* ++ * This driver assumes self-powered hardware and has no way for users to ++ * trigger remote wakeup. It uses autoconfiguration to select endpoints ++ * and endpoint addresses. ++ */ ++ ++ ++/*-------------------------------------------------------------------------*/ ++ ++ ++/* Encapsulate the module parameter settings */ ++ ++static struct { ++ char *file[FSG_MAX_LUNS]; ++ char *serial; ++ bool ro[FSG_MAX_LUNS]; ++ bool nofua[FSG_MAX_LUNS]; ++ unsigned int num_filenames; ++ unsigned int num_ros; ++ unsigned int num_nofuas; ++ unsigned int nluns; ++ ++ bool removable; ++ bool can_stall; ++ bool cdrom; ++ ++ char *transport_parm; ++ char *protocol_parm; ++ unsigned short vendor; ++ unsigned short product; ++ unsigned short release; ++ unsigned int buflen; ++ ++ int transport_type; ++ char *transport_name; ++ int protocol_type; ++ char *protocol_name; ++ ++} mod_data = { // Default values ++ .transport_parm = "BBB", ++ .protocol_parm = "SCSI", ++ .removable = 0, ++ .can_stall = 1, ++ .cdrom = 0, ++ .vendor = FSG_VENDOR_ID, ++ .product = FSG_PRODUCT_ID, ++ .release = 0xffff, // Use controller chip type ++ .buflen = 16384, ++ }; ++ ++ ++module_param_array_named(file, mod_data.file, charp, &mod_data.num_filenames, ++ S_IRUGO); ++MODULE_PARM_DESC(file, "names of backing files or devices"); ++ ++module_param_named(serial, mod_data.serial, charp, S_IRUGO); ++MODULE_PARM_DESC(serial, "USB serial number"); ++ ++module_param_array_named(ro, mod_data.ro, bool, &mod_data.num_ros, S_IRUGO); ++MODULE_PARM_DESC(ro, "true to force read-only"); ++ ++module_param_array_named(nofua, mod_data.nofua, bool, &mod_data.num_nofuas, ++ S_IRUGO); ++MODULE_PARM_DESC(nofua, "true to ignore SCSI WRITE(10,12) FUA bit"); ++ ++module_param_named(luns, mod_data.nluns, uint, S_IRUGO); ++MODULE_PARM_DESC(luns, "number of LUNs"); ++ ++module_param_named(removable, mod_data.removable, bool, S_IRUGO); ++MODULE_PARM_DESC(removable, "true to simulate removable media"); ++ ++module_param_named(stall, mod_data.can_stall, bool, S_IRUGO); ++MODULE_PARM_DESC(stall, "false to prevent bulk stalls"); ++ ++module_param_named(cdrom, mod_data.cdrom, bool, S_IRUGO); ++MODULE_PARM_DESC(cdrom, "true to emulate cdrom instead of disk"); ++ ++/* In the non-TEST version, only the module parameters listed above ++ * are available. */ ++#ifdef CONFIG_USB_FILE_STORAGE_TEST ++ ++module_param_named(transport, mod_data.transport_parm, charp, S_IRUGO); ++MODULE_PARM_DESC(transport, "type of transport (BBB, CBI, or CB)"); ++ ++module_param_named(protocol, mod_data.protocol_parm, charp, S_IRUGO); ++MODULE_PARM_DESC(protocol, "type of protocol (RBC, 8020, QIC, UFI, " ++ "8070, or SCSI)"); ++ ++module_param_named(vendor, mod_data.vendor, ushort, S_IRUGO); ++MODULE_PARM_DESC(vendor, "USB Vendor ID"); ++ ++module_param_named(product, mod_data.product, ushort, S_IRUGO); ++MODULE_PARM_DESC(product, "USB Product ID"); ++ ++module_param_named(release, mod_data.release, ushort, S_IRUGO); ++MODULE_PARM_DESC(release, "USB release number"); ++ ++module_param_named(buflen, mod_data.buflen, uint, S_IRUGO); ++MODULE_PARM_DESC(buflen, "I/O buffer size"); ++ ++#endif /* CONFIG_USB_FILE_STORAGE_TEST */ ++ ++ ++/* ++ * These definitions will permit the compiler to avoid generating code for ++ * parts of the driver that aren't used in the non-TEST version. Even gcc ++ * can recognize when a test of a constant expression yields a dead code ++ * path. ++ */ ++ ++#ifdef CONFIG_USB_FILE_STORAGE_TEST ++ ++#define transport_is_bbb() (mod_data.transport_type == USB_PR_BULK) ++#define transport_is_cbi() (mod_data.transport_type == USB_PR_CBI) ++#define protocol_is_scsi() (mod_data.protocol_type == USB_SC_SCSI) ++ ++#else ++ ++#define transport_is_bbb() 1 ++#define transport_is_cbi() 0 ++#define protocol_is_scsi() 1 ++ ++#endif /* CONFIG_USB_FILE_STORAGE_TEST */ ++ ++ ++/*-------------------------------------------------------------------------*/ ++ ++ ++struct fsg_dev { ++ /* lock protects: state, all the req_busy's, and cbbuf_cmnd */ ++ spinlock_t lock; ++ struct usb_gadget *gadget; ++ ++ /* filesem protects: backing files in use */ ++ struct rw_semaphore filesem; ++ ++ /* reference counting: wait until all LUNs are released */ ++ struct kref ref; ++ ++ struct usb_ep *ep0; // Handy copy of gadget->ep0 ++ struct usb_request *ep0req; // For control responses ++ unsigned int ep0_req_tag; ++ const char *ep0req_name; ++ ++ struct usb_request *intreq; // For interrupt responses ++ int intreq_busy; ++ struct fsg_buffhd *intr_buffhd; ++ ++ unsigned int bulk_out_maxpacket; ++ enum fsg_state state; // For exception handling ++ unsigned int exception_req_tag; ++ ++ u8 config, new_config; ++ ++ unsigned int running : 1; ++ unsigned int bulk_in_enabled : 1; ++ unsigned int bulk_out_enabled : 1; ++ unsigned int intr_in_enabled : 1; ++ unsigned int phase_error : 1; ++ unsigned int short_packet_received : 1; ++ unsigned int bad_lun_okay : 1; ++ ++ unsigned long atomic_bitflags; ++#define REGISTERED 0 ++#define IGNORE_BULK_OUT 1 ++#define SUSPENDED 2 ++ ++ struct usb_ep *bulk_in; ++ struct usb_ep *bulk_out; ++ struct usb_ep *intr_in; ++ ++ struct fsg_buffhd *next_buffhd_to_fill; ++ struct fsg_buffhd *next_buffhd_to_drain; ++ ++ int thread_wakeup_needed; ++ struct completion thread_notifier; ++ struct task_struct *thread_task; ++ ++ int cmnd_size; ++ u8 cmnd[MAX_COMMAND_SIZE]; ++ enum data_direction data_dir; ++ u32 data_size; ++ u32 data_size_from_cmnd; ++ u32 tag; ++ unsigned int lun; ++ u32 residue; ++ u32 usb_amount_left; ++ ++ /* The CB protocol offers no way for a host to know when a command ++ * has completed. As a result the next command may arrive early, ++ * and we will still have to handle it. For that reason we need ++ * a buffer to store new commands when using CB (or CBI, which ++ * does not oblige a host to wait for command completion either). */ ++ int cbbuf_cmnd_size; ++ u8 cbbuf_cmnd[MAX_COMMAND_SIZE]; ++ ++ unsigned int nluns; ++ struct fsg_lun *luns; ++ struct fsg_lun *curlun; ++ /* Must be the last entry */ ++ struct fsg_buffhd buffhds[]; ++}; ++ ++typedef void (*fsg_routine_t)(struct fsg_dev *); ++ ++static int exception_in_progress(struct fsg_dev *fsg) ++{ ++ return (fsg->state > FSG_STATE_IDLE); ++} ++ ++/* Make bulk-out requests be divisible by the maxpacket size */ ++static void set_bulk_out_req_length(struct fsg_dev *fsg, ++ struct fsg_buffhd *bh, unsigned int length) ++{ ++ unsigned int rem; ++ ++ bh->bulk_out_intended_length = length; ++ rem = length % fsg->bulk_out_maxpacket; ++ if (rem > 0) ++ length += fsg->bulk_out_maxpacket - rem; ++ bh->outreq->length = length; ++} ++ ++static struct fsg_dev *the_fsg; ++static struct usb_gadget_driver fsg_driver; ++ ++ ++/*-------------------------------------------------------------------------*/ ++ ++static int fsg_set_halt(struct fsg_dev *fsg, struct usb_ep *ep) ++{ ++ const char *name; ++ ++ if (ep == fsg->bulk_in) ++ name = "bulk-in"; ++ else if (ep == fsg->bulk_out) ++ name = "bulk-out"; ++ else ++ name = ep->name; ++ DBG(fsg, "%s set halt\n", name); ++ return usb_ep_set_halt(ep); ++} ++ ++ ++/*-------------------------------------------------------------------------*/ ++ ++/* ++ * DESCRIPTORS ... most are static, but strings and (full) configuration ++ * descriptors are built on demand. Also the (static) config and interface ++ * descriptors are adjusted during fsg_bind(). ++ */ ++ ++/* There is only one configuration. */ ++#define CONFIG_VALUE 1 ++ ++static struct usb_device_descriptor ++device_desc = { ++ .bLength = sizeof device_desc, ++ .bDescriptorType = USB_DT_DEVICE, ++ ++ .bcdUSB = cpu_to_le16(0x0200), ++ .bDeviceClass = USB_CLASS_PER_INTERFACE, ++ ++ /* The next three values can be overridden by module parameters */ ++ .idVendor = cpu_to_le16(FSG_VENDOR_ID), ++ .idProduct = cpu_to_le16(FSG_PRODUCT_ID), ++ .bcdDevice = cpu_to_le16(0xffff), ++ ++ .iManufacturer = FSG_STRING_MANUFACTURER, ++ .iProduct = FSG_STRING_PRODUCT, ++ .iSerialNumber = FSG_STRING_SERIAL, ++ .bNumConfigurations = 1, ++}; ++ ++static struct usb_config_descriptor ++config_desc = { ++ .bLength = sizeof config_desc, ++ .bDescriptorType = USB_DT_CONFIG, ++ ++ /* wTotalLength computed by usb_gadget_config_buf() */ ++ .bNumInterfaces = 1, ++ .bConfigurationValue = CONFIG_VALUE, ++ .iConfiguration = FSG_STRING_CONFIG, ++ .bmAttributes = USB_CONFIG_ATT_ONE | USB_CONFIG_ATT_SELFPOWER, ++ .bMaxPower = CONFIG_USB_GADGET_VBUS_DRAW / 2, ++}; ++ ++ ++static struct usb_qualifier_descriptor ++dev_qualifier = { ++ .bLength = sizeof dev_qualifier, ++ .bDescriptorType = USB_DT_DEVICE_QUALIFIER, ++ ++ .bcdUSB = cpu_to_le16(0x0200), ++ .bDeviceClass = USB_CLASS_PER_INTERFACE, ++ ++ .bNumConfigurations = 1, ++}; ++ ++static int populate_bos(struct fsg_dev *fsg, u8 *buf) ++{ ++ memcpy(buf, &fsg_bos_desc, USB_DT_BOS_SIZE); ++ buf += USB_DT_BOS_SIZE; ++ ++ memcpy(buf, &fsg_ext_cap_desc, USB_DT_USB_EXT_CAP_SIZE); ++ buf += USB_DT_USB_EXT_CAP_SIZE; ++ ++ memcpy(buf, &fsg_ss_cap_desc, USB_DT_USB_SS_CAP_SIZE); ++ ++ return USB_DT_BOS_SIZE + USB_DT_USB_SS_CAP_SIZE ++ + USB_DT_USB_EXT_CAP_SIZE; ++} ++ ++/* ++ * Config descriptors must agree with the code that sets configurations ++ * and with code managing interfaces and their altsettings. They must ++ * also handle different speeds and other-speed requests. ++ */ ++static int populate_config_buf(struct usb_gadget *gadget, ++ u8 *buf, u8 type, unsigned index) ++{ ++ enum usb_device_speed speed = gadget->speed; ++ int len; ++ const struct usb_descriptor_header **function; ++ ++ if (index > 0) ++ return -EINVAL; ++ ++ if (gadget_is_dualspeed(gadget) && type == USB_DT_OTHER_SPEED_CONFIG) ++ speed = (USB_SPEED_FULL + USB_SPEED_HIGH) - speed; ++ function = gadget_is_dualspeed(gadget) && speed == USB_SPEED_HIGH ++ ? (const struct usb_descriptor_header **)fsg_hs_function ++ : (const struct usb_descriptor_header **)fsg_fs_function; ++ ++ /* for now, don't advertise srp-only devices */ ++ if (!gadget_is_otg(gadget)) ++ function++; ++ ++ len = usb_gadget_config_buf(&config_desc, buf, EP0_BUFSIZE, function); ++ ((struct usb_config_descriptor *) buf)->bDescriptorType = type; ++ return len; ++} ++ ++ ++/*-------------------------------------------------------------------------*/ ++ ++/* These routines may be called in process context or in_irq */ ++ ++/* Caller must hold fsg->lock */ ++static void wakeup_thread(struct fsg_dev *fsg) ++{ ++ /* Tell the main thread that something has happened */ ++ fsg->thread_wakeup_needed = 1; ++ if (fsg->thread_task) ++ wake_up_process(fsg->thread_task); ++} ++ ++ ++static void raise_exception(struct fsg_dev *fsg, enum fsg_state new_state) ++{ ++ unsigned long flags; ++ ++ /* Do nothing if a higher-priority exception is already in progress. ++ * If a lower-or-equal priority exception is in progress, preempt it ++ * and notify the main thread by sending it a signal. */ ++ spin_lock_irqsave(&fsg->lock, flags); ++ if (fsg->state <= new_state) { ++ fsg->exception_req_tag = fsg->ep0_req_tag; ++ fsg->state = new_state; ++ if (fsg->thread_task) ++ send_sig_info(SIGUSR1, SEND_SIG_FORCED, ++ fsg->thread_task); ++ } ++ spin_unlock_irqrestore(&fsg->lock, flags); ++} ++ ++ ++/*-------------------------------------------------------------------------*/ ++ ++/* The disconnect callback and ep0 routines. These always run in_irq, ++ * except that ep0_queue() is called in the main thread to acknowledge ++ * completion of various requests: set config, set interface, and ++ * Bulk-only device reset. */ ++ ++static void fsg_disconnect(struct usb_gadget *gadget) ++{ ++ struct fsg_dev *fsg = get_gadget_data(gadget); ++ ++ DBG(fsg, "disconnect or port reset\n"); ++ raise_exception(fsg, FSG_STATE_DISCONNECT); ++} ++ ++ ++static int ep0_queue(struct fsg_dev *fsg) ++{ ++ int rc; ++ ++ rc = usb_ep_queue(fsg->ep0, fsg->ep0req, GFP_ATOMIC); ++ if (rc != 0 && rc != -ESHUTDOWN) { ++ ++ /* We can't do much more than wait for a reset */ ++ WARNING(fsg, "error in submission: %s --> %d\n", ++ fsg->ep0->name, rc); ++ } ++ return rc; ++} ++ ++static void ep0_complete(struct usb_ep *ep, struct usb_request *req) ++{ ++ struct fsg_dev *fsg = ep->driver_data; ++ ++ if (req->actual > 0) ++ dump_msg(fsg, fsg->ep0req_name, req->buf, req->actual); ++ if (req->status || req->actual != req->length) ++ DBG(fsg, "%s --> %d, %u/%u\n", __func__, ++ req->status, req->actual, req->length); ++ if (req->status == -ECONNRESET) // Request was cancelled ++ usb_ep_fifo_flush(ep); ++ ++ if (req->status == 0 && req->context) ++ ((fsg_routine_t) (req->context))(fsg); ++} ++ ++ ++/*-------------------------------------------------------------------------*/ ++ ++/* Bulk and interrupt endpoint completion handlers. ++ * These always run in_irq. */ ++ ++static void bulk_in_complete(struct usb_ep *ep, struct usb_request *req) ++{ ++ struct fsg_dev *fsg = ep->driver_data; ++ struct fsg_buffhd *bh = req->context; ++ ++ if (req->status || req->actual != req->length) ++ DBG(fsg, "%s --> %d, %u/%u\n", __func__, ++ req->status, req->actual, req->length); ++ if (req->status == -ECONNRESET) // Request was cancelled ++ usb_ep_fifo_flush(ep); ++ ++ /* Hold the lock while we update the request and buffer states */ ++ smp_wmb(); ++ spin_lock(&fsg->lock); ++ bh->inreq_busy = 0; ++ bh->state = BUF_STATE_EMPTY; ++ wakeup_thread(fsg); ++ spin_unlock(&fsg->lock); ++} ++ ++static void bulk_out_complete(struct usb_ep *ep, struct usb_request *req) ++{ ++ struct fsg_dev *fsg = ep->driver_data; ++ struct fsg_buffhd *bh = req->context; ++ ++ dump_msg(fsg, "bulk-out", req->buf, req->actual); ++ if (req->status || req->actual != bh->bulk_out_intended_length) ++ DBG(fsg, "%s --> %d, %u/%u\n", __func__, ++ req->status, req->actual, ++ bh->bulk_out_intended_length); ++ if (req->status == -ECONNRESET) // Request was cancelled ++ usb_ep_fifo_flush(ep); ++ ++ /* Hold the lock while we update the request and buffer states */ ++ smp_wmb(); ++ spin_lock(&fsg->lock); ++ bh->outreq_busy = 0; ++ bh->state = BUF_STATE_FULL; ++ wakeup_thread(fsg); ++ spin_unlock(&fsg->lock); ++} ++ ++ ++#ifdef CONFIG_USB_FILE_STORAGE_TEST ++static void intr_in_complete(struct usb_ep *ep, struct usb_request *req) ++{ ++ struct fsg_dev *fsg = ep->driver_data; ++ struct fsg_buffhd *bh = req->context; ++ ++ if (req->status || req->actual != req->length) ++ DBG(fsg, "%s --> %d, %u/%u\n", __func__, ++ req->status, req->actual, req->length); ++ if (req->status == -ECONNRESET) // Request was cancelled ++ usb_ep_fifo_flush(ep); ++ ++ /* Hold the lock while we update the request and buffer states */ ++ smp_wmb(); ++ spin_lock(&fsg->lock); ++ fsg->intreq_busy = 0; ++ bh->state = BUF_STATE_EMPTY; ++ wakeup_thread(fsg); ++ spin_unlock(&fsg->lock); ++} ++ ++#else ++static void intr_in_complete(struct usb_ep *ep, struct usb_request *req) ++{} ++#endif /* CONFIG_USB_FILE_STORAGE_TEST */ ++ ++ ++/*-------------------------------------------------------------------------*/ ++ ++/* Ep0 class-specific handlers. These always run in_irq. */ ++ ++#ifdef CONFIG_USB_FILE_STORAGE_TEST ++static void received_cbi_adsc(struct fsg_dev *fsg, struct fsg_buffhd *bh) ++{ ++ struct usb_request *req = fsg->ep0req; ++ static u8 cbi_reset_cmnd[6] = { ++ SEND_DIAGNOSTIC, 4, 0xff, 0xff, 0xff, 0xff}; ++ ++ /* Error in command transfer? */ ++ if (req->status || req->length != req->actual || ++ req->actual < 6 || req->actual > MAX_COMMAND_SIZE) { ++ ++ /* Not all controllers allow a protocol stall after ++ * receiving control-out data, but we'll try anyway. */ ++ fsg_set_halt(fsg, fsg->ep0); ++ return; // Wait for reset ++ } ++ ++ /* Is it the special reset command? */ ++ if (req->actual >= sizeof cbi_reset_cmnd && ++ memcmp(req->buf, cbi_reset_cmnd, ++ sizeof cbi_reset_cmnd) == 0) { ++ ++ /* Raise an exception to stop the current operation ++ * and reinitialize our state. */ ++ DBG(fsg, "cbi reset request\n"); ++ raise_exception(fsg, FSG_STATE_RESET); ++ return; ++ } ++ ++ VDBG(fsg, "CB[I] accept device-specific command\n"); ++ spin_lock(&fsg->lock); ++ ++ /* Save the command for later */ ++ if (fsg->cbbuf_cmnd_size) ++ WARNING(fsg, "CB[I] overwriting previous command\n"); ++ fsg->cbbuf_cmnd_size = req->actual; ++ memcpy(fsg->cbbuf_cmnd, req->buf, fsg->cbbuf_cmnd_size); ++ ++ wakeup_thread(fsg); ++ spin_unlock(&fsg->lock); ++} ++ ++#else ++static void received_cbi_adsc(struct fsg_dev *fsg, struct fsg_buffhd *bh) ++{} ++#endif /* CONFIG_USB_FILE_STORAGE_TEST */ ++ ++ ++static int class_setup_req(struct fsg_dev *fsg, ++ const struct usb_ctrlrequest *ctrl) ++{ ++ struct usb_request *req = fsg->ep0req; ++ int value = -EOPNOTSUPP; ++ u16 w_index = le16_to_cpu(ctrl->wIndex); ++ u16 w_value = le16_to_cpu(ctrl->wValue); ++ u16 w_length = le16_to_cpu(ctrl->wLength); ++ ++ if (!fsg->config) ++ return value; ++ ++ /* Handle Bulk-only class-specific requests */ ++ if (transport_is_bbb()) { ++ switch (ctrl->bRequest) { ++ ++ case US_BULK_RESET_REQUEST: ++ if (ctrl->bRequestType != (USB_DIR_OUT | ++ USB_TYPE_CLASS | USB_RECIP_INTERFACE)) ++ break; ++ if (w_index != 0 || w_value != 0 || w_length != 0) { ++ value = -EDOM; ++ break; ++ } ++ ++ /* Raise an exception to stop the current operation ++ * and reinitialize our state. */ ++ DBG(fsg, "bulk reset request\n"); ++ raise_exception(fsg, FSG_STATE_RESET); ++ value = DELAYED_STATUS; ++ break; ++ ++ case US_BULK_GET_MAX_LUN: ++ if (ctrl->bRequestType != (USB_DIR_IN | ++ USB_TYPE_CLASS | USB_RECIP_INTERFACE)) ++ break; ++ if (w_index != 0 || w_value != 0 || w_length != 1) { ++ value = -EDOM; ++ break; ++ } ++ VDBG(fsg, "get max LUN\n"); ++ *(u8 *) req->buf = fsg->nluns - 1; ++ value = 1; ++ break; ++ } ++ } ++ ++ /* Handle CBI class-specific requests */ ++ else { ++ switch (ctrl->bRequest) { ++ ++ case USB_CBI_ADSC_REQUEST: ++ if (ctrl->bRequestType != (USB_DIR_OUT | ++ USB_TYPE_CLASS | USB_RECIP_INTERFACE)) ++ break; ++ if (w_index != 0 || w_value != 0) { ++ value = -EDOM; ++ break; ++ } ++ if (w_length > MAX_COMMAND_SIZE) { ++ value = -EOVERFLOW; ++ break; ++ } ++ value = w_length; ++ fsg->ep0req->context = received_cbi_adsc; ++ break; ++ } ++ } ++ ++ if (value == -EOPNOTSUPP) ++ VDBG(fsg, ++ "unknown class-specific control req " ++ "%02x.%02x v%04x i%04x l%u\n", ++ ctrl->bRequestType, ctrl->bRequest, ++ le16_to_cpu(ctrl->wValue), w_index, w_length); ++ return value; ++} ++ ++ ++/*-------------------------------------------------------------------------*/ ++ ++/* Ep0 standard request handlers. These always run in_irq. */ ++ ++static int standard_setup_req(struct fsg_dev *fsg, ++ const struct usb_ctrlrequest *ctrl) ++{ ++ struct usb_request *req = fsg->ep0req; ++ int value = -EOPNOTSUPP; ++ u16 w_index = le16_to_cpu(ctrl->wIndex); ++ u16 w_value = le16_to_cpu(ctrl->wValue); ++ ++ /* Usually this just stores reply data in the pre-allocated ep0 buffer, ++ * but config change events will also reconfigure hardware. */ ++ switch (ctrl->bRequest) { ++ ++ case USB_REQ_GET_DESCRIPTOR: ++ if (ctrl->bRequestType != (USB_DIR_IN | USB_TYPE_STANDARD | ++ USB_RECIP_DEVICE)) ++ break; ++ switch (w_value >> 8) { ++ ++ case USB_DT_DEVICE: ++ VDBG(fsg, "get device descriptor\n"); ++ device_desc.bMaxPacketSize0 = fsg->ep0->maxpacket; ++ value = sizeof device_desc; ++ memcpy(req->buf, &device_desc, value); ++ break; ++ case USB_DT_DEVICE_QUALIFIER: ++ VDBG(fsg, "get device qualifier\n"); ++ if (!gadget_is_dualspeed(fsg->gadget) || ++ fsg->gadget->speed == USB_SPEED_SUPER) ++ break; ++ /* ++ * Assume ep0 uses the same maxpacket value for both ++ * speeds ++ */ ++ dev_qualifier.bMaxPacketSize0 = fsg->ep0->maxpacket; ++ value = sizeof dev_qualifier; ++ memcpy(req->buf, &dev_qualifier, value); ++ break; ++ ++ case USB_DT_OTHER_SPEED_CONFIG: ++ VDBG(fsg, "get other-speed config descriptor\n"); ++ if (!gadget_is_dualspeed(fsg->gadget) || ++ fsg->gadget->speed == USB_SPEED_SUPER) ++ break; ++ goto get_config; ++ case USB_DT_CONFIG: ++ VDBG(fsg, "get configuration descriptor\n"); ++get_config: ++ value = populate_config_buf(fsg->gadget, ++ req->buf, ++ w_value >> 8, ++ w_value & 0xff); ++ break; ++ ++ case USB_DT_STRING: ++ VDBG(fsg, "get string descriptor\n"); ++ ++ /* wIndex == language code */ ++ value = usb_gadget_get_string(&fsg_stringtab, ++ w_value & 0xff, req->buf); ++ break; ++ ++ case USB_DT_BOS: ++ VDBG(fsg, "get bos descriptor\n"); ++ ++ if (gadget_is_superspeed(fsg->gadget)) ++ value = populate_bos(fsg, req->buf); ++ break; ++ } ++ ++ break; ++ ++ /* One config, two speeds */ ++ case USB_REQ_SET_CONFIGURATION: ++ if (ctrl->bRequestType != (USB_DIR_OUT | USB_TYPE_STANDARD | ++ USB_RECIP_DEVICE)) ++ break; ++ VDBG(fsg, "set configuration\n"); ++ if (w_value == CONFIG_VALUE || w_value == 0) { ++ fsg->new_config = w_value; ++ ++ /* Raise an exception to wipe out previous transaction ++ * state (queued bufs, etc) and set the new config. */ ++ raise_exception(fsg, FSG_STATE_CONFIG_CHANGE); ++ value = DELAYED_STATUS; ++ } ++ break; ++ case USB_REQ_GET_CONFIGURATION: ++ if (ctrl->bRequestType != (USB_DIR_IN | USB_TYPE_STANDARD | ++ USB_RECIP_DEVICE)) ++ break; ++ VDBG(fsg, "get configuration\n"); ++ *(u8 *) req->buf = fsg->config; ++ value = 1; ++ break; ++ ++ case USB_REQ_SET_INTERFACE: ++ if (ctrl->bRequestType != (USB_DIR_OUT| USB_TYPE_STANDARD | ++ USB_RECIP_INTERFACE)) ++ break; ++ if (fsg->config && w_index == 0) { ++ ++ /* Raise an exception to wipe out previous transaction ++ * state (queued bufs, etc) and install the new ++ * interface altsetting. */ ++ raise_exception(fsg, FSG_STATE_INTERFACE_CHANGE); ++ value = DELAYED_STATUS; ++ } ++ break; ++ case USB_REQ_GET_INTERFACE: ++ if (ctrl->bRequestType != (USB_DIR_IN | USB_TYPE_STANDARD | ++ USB_RECIP_INTERFACE)) ++ break; ++ if (!fsg->config) ++ break; ++ if (w_index != 0) { ++ value = -EDOM; ++ break; ++ } ++ VDBG(fsg, "get interface\n"); ++ *(u8 *) req->buf = 0; ++ value = 1; ++ break; ++ ++ default: ++ VDBG(fsg, ++ "unknown control req %02x.%02x v%04x i%04x l%u\n", ++ ctrl->bRequestType, ctrl->bRequest, ++ w_value, w_index, le16_to_cpu(ctrl->wLength)); ++ } ++ ++ return value; ++} ++ ++ ++static int fsg_setup(struct usb_gadget *gadget, ++ const struct usb_ctrlrequest *ctrl) ++{ ++ struct fsg_dev *fsg = get_gadget_data(gadget); ++ int rc; ++ int w_length = le16_to_cpu(ctrl->wLength); ++ ++ ++fsg->ep0_req_tag; // Record arrival of a new request ++ fsg->ep0req->context = NULL; ++ fsg->ep0req->length = 0; ++ dump_msg(fsg, "ep0-setup", (u8 *) ctrl, sizeof(*ctrl)); ++ ++ if ((ctrl->bRequestType & USB_TYPE_MASK) == USB_TYPE_CLASS) ++ rc = class_setup_req(fsg, ctrl); ++ else ++ rc = standard_setup_req(fsg, ctrl); ++ ++ /* Respond with data/status or defer until later? */ ++ if (rc >= 0 && rc != DELAYED_STATUS) { ++ rc = min(rc, w_length); ++ fsg->ep0req->length = rc; ++ fsg->ep0req->zero = rc < w_length; ++ fsg->ep0req_name = (ctrl->bRequestType & USB_DIR_IN ? ++ "ep0-in" : "ep0-out"); ++ rc = ep0_queue(fsg); ++ } ++ ++ /* Device either stalls (rc < 0) or reports success */ ++ return rc; ++} ++ ++ ++/*-------------------------------------------------------------------------*/ ++ ++/* All the following routines run in process context */ ++ ++ ++/* Use this for bulk or interrupt transfers, not ep0 */ ++static void start_transfer(struct fsg_dev *fsg, struct usb_ep *ep, ++ struct usb_request *req, int *pbusy, ++ enum fsg_buffer_state *state) ++{ ++ int rc; ++ ++ if (ep == fsg->bulk_in) ++ dump_msg(fsg, "bulk-in", req->buf, req->length); ++ else if (ep == fsg->intr_in) ++ dump_msg(fsg, "intr-in", req->buf, req->length); ++ ++ spin_lock_irq(&fsg->lock); ++ *pbusy = 1; ++ *state = BUF_STATE_BUSY; ++ spin_unlock_irq(&fsg->lock); ++ rc = usb_ep_queue(ep, req, GFP_KERNEL); ++ if (rc != 0) { ++ *pbusy = 0; ++ *state = BUF_STATE_EMPTY; ++ ++ /* We can't do much more than wait for a reset */ ++ ++ /* Note: currently the net2280 driver fails zero-length ++ * submissions if DMA is enabled. */ ++ if (rc != -ESHUTDOWN && !(rc == -EOPNOTSUPP && ++ req->length == 0)) ++ WARNING(fsg, "error in submission: %s --> %d\n", ++ ep->name, rc); ++ } ++} ++ ++ ++static int sleep_thread(struct fsg_dev *fsg) ++{ ++ int rc = 0; ++ ++ /* Wait until a signal arrives or we are woken up */ ++ for (;;) { ++ try_to_freeze(); ++ set_current_state(TASK_INTERRUPTIBLE); ++ if (signal_pending(current)) { ++ rc = -EINTR; ++ break; ++ } ++ if (fsg->thread_wakeup_needed) ++ break; ++ schedule(); ++ } ++ __set_current_state(TASK_RUNNING); ++ fsg->thread_wakeup_needed = 0; ++ return rc; ++} ++ ++ ++/*-------------------------------------------------------------------------*/ ++ ++static int do_read(struct fsg_dev *fsg) ++{ ++ struct fsg_lun *curlun = fsg->curlun; ++ u32 lba; ++ struct fsg_buffhd *bh; ++ int rc; ++ u32 amount_left; ++ loff_t file_offset, file_offset_tmp; ++ unsigned int amount; ++ ssize_t nread; ++ ++ /* Get the starting Logical Block Address and check that it's ++ * not too big */ ++ if (fsg->cmnd[0] == READ_6) ++ lba = get_unaligned_be24(&fsg->cmnd[1]); ++ else { ++ lba = get_unaligned_be32(&fsg->cmnd[2]); ++ ++ /* We allow DPO (Disable Page Out = don't save data in the ++ * cache) and FUA (Force Unit Access = don't read from the ++ * cache), but we don't implement them. */ ++ if ((fsg->cmnd[1] & ~0x18) != 0) { ++ curlun->sense_data = SS_INVALID_FIELD_IN_CDB; ++ return -EINVAL; ++ } ++ } ++ if (lba >= curlun->num_sectors) { ++ curlun->sense_data = SS_LOGICAL_BLOCK_ADDRESS_OUT_OF_RANGE; ++ return -EINVAL; ++ } ++ file_offset = ((loff_t) lba) << curlun->blkbits; ++ ++ /* Carry out the file reads */ ++ amount_left = fsg->data_size_from_cmnd; ++ if (unlikely(amount_left == 0)) ++ return -EIO; // No default reply ++ ++ for (;;) { ++ ++ /* Figure out how much we need to read: ++ * Try to read the remaining amount. ++ * But don't read more than the buffer size. ++ * And don't try to read past the end of the file. ++ */ ++ amount = min((unsigned int) amount_left, mod_data.buflen); ++ amount = min((loff_t) amount, ++ curlun->file_length - file_offset); ++ ++ /* Wait for the next buffer to become available */ ++ bh = fsg->next_buffhd_to_fill; ++ while (bh->state != BUF_STATE_EMPTY) { ++ rc = sleep_thread(fsg); ++ if (rc) ++ return rc; ++ } ++ ++ /* If we were asked to read past the end of file, ++ * end with an empty buffer. */ ++ if (amount == 0) { ++ curlun->sense_data = ++ SS_LOGICAL_BLOCK_ADDRESS_OUT_OF_RANGE; ++ curlun->sense_data_info = file_offset >> curlun->blkbits; ++ curlun->info_valid = 1; ++ bh->inreq->length = 0; ++ bh->state = BUF_STATE_FULL; ++ break; ++ } ++ ++ /* Perform the read */ ++ file_offset_tmp = file_offset; ++ nread = vfs_read(curlun->filp, ++ (char __user *) bh->buf, ++ amount, &file_offset_tmp); ++ VLDBG(curlun, "file read %u @ %llu -> %d\n", amount, ++ (unsigned long long) file_offset, ++ (int) nread); ++ if (signal_pending(current)) ++ return -EINTR; ++ ++ if (nread < 0) { ++ LDBG(curlun, "error in file read: %d\n", ++ (int) nread); ++ nread = 0; ++ } else if (nread < amount) { ++ LDBG(curlun, "partial file read: %d/%u\n", ++ (int) nread, amount); ++ nread = round_down(nread, curlun->blksize); ++ } ++ file_offset += nread; ++ amount_left -= nread; ++ fsg->residue -= nread; ++ ++ /* Except at the end of the transfer, nread will be ++ * equal to the buffer size, which is divisible by the ++ * bulk-in maxpacket size. ++ */ ++ bh->inreq->length = nread; ++ bh->state = BUF_STATE_FULL; ++ ++ /* If an error occurred, report it and its position */ ++ if (nread < amount) { ++ curlun->sense_data = SS_UNRECOVERED_READ_ERROR; ++ curlun->sense_data_info = file_offset >> curlun->blkbits; ++ curlun->info_valid = 1; ++ break; ++ } ++ ++ if (amount_left == 0) ++ break; // No more left to read ++ ++ /* Send this buffer and go read some more */ ++ bh->inreq->zero = 0; ++ start_transfer(fsg, fsg->bulk_in, bh->inreq, ++ &bh->inreq_busy, &bh->state); ++ fsg->next_buffhd_to_fill = bh->next; ++ } ++ ++ return -EIO; // No default reply ++} ++ ++ ++/*-------------------------------------------------------------------------*/ ++ ++static int do_write(struct fsg_dev *fsg) ++{ ++ struct fsg_lun *curlun = fsg->curlun; ++ u32 lba; ++ struct fsg_buffhd *bh; ++ int get_some_more; ++ u32 amount_left_to_req, amount_left_to_write; ++ loff_t usb_offset, file_offset, file_offset_tmp; ++ unsigned int amount; ++ ssize_t nwritten; ++ int rc; ++ ++ if (curlun->ro) { ++ curlun->sense_data = SS_WRITE_PROTECTED; ++ return -EINVAL; ++ } ++ spin_lock(&curlun->filp->f_lock); ++ curlun->filp->f_flags &= ~O_SYNC; // Default is not to wait ++ spin_unlock(&curlun->filp->f_lock); ++ ++ /* Get the starting Logical Block Address and check that it's ++ * not too big */ ++ if (fsg->cmnd[0] == WRITE_6) ++ lba = get_unaligned_be24(&fsg->cmnd[1]); ++ else { ++ lba = get_unaligned_be32(&fsg->cmnd[2]); ++ ++ /* We allow DPO (Disable Page Out = don't save data in the ++ * cache) and FUA (Force Unit Access = write directly to the ++ * medium). We don't implement DPO; we implement FUA by ++ * performing synchronous output. */ ++ if ((fsg->cmnd[1] & ~0x18) != 0) { ++ curlun->sense_data = SS_INVALID_FIELD_IN_CDB; ++ return -EINVAL; ++ } ++ /* FUA */ ++ if (!curlun->nofua && (fsg->cmnd[1] & 0x08)) { ++ spin_lock(&curlun->filp->f_lock); ++ curlun->filp->f_flags |= O_DSYNC; ++ spin_unlock(&curlun->filp->f_lock); ++ } ++ } ++ if (lba >= curlun->num_sectors) { ++ curlun->sense_data = SS_LOGICAL_BLOCK_ADDRESS_OUT_OF_RANGE; ++ return -EINVAL; ++ } ++ ++ /* Carry out the file writes */ ++ get_some_more = 1; ++ file_offset = usb_offset = ((loff_t) lba) << curlun->blkbits; ++ amount_left_to_req = amount_left_to_write = fsg->data_size_from_cmnd; ++ ++ while (amount_left_to_write > 0) { ++ ++ /* Queue a request for more data from the host */ ++ bh = fsg->next_buffhd_to_fill; ++ if (bh->state == BUF_STATE_EMPTY && get_some_more) { ++ ++ /* Figure out how much we want to get: ++ * Try to get the remaining amount, ++ * but not more than the buffer size. ++ */ ++ amount = min(amount_left_to_req, mod_data.buflen); ++ ++ /* Beyond the end of the backing file? */ ++ if (usb_offset >= curlun->file_length) { ++ get_some_more = 0; ++ curlun->sense_data = ++ SS_LOGICAL_BLOCK_ADDRESS_OUT_OF_RANGE; ++ curlun->sense_data_info = usb_offset >> curlun->blkbits; ++ curlun->info_valid = 1; ++ continue; ++ } ++ ++ /* Get the next buffer */ ++ usb_offset += amount; ++ fsg->usb_amount_left -= amount; ++ amount_left_to_req -= amount; ++ if (amount_left_to_req == 0) ++ get_some_more = 0; ++ ++ /* Except at the end of the transfer, amount will be ++ * equal to the buffer size, which is divisible by ++ * the bulk-out maxpacket size. ++ */ ++ set_bulk_out_req_length(fsg, bh, amount); ++ start_transfer(fsg, fsg->bulk_out, bh->outreq, ++ &bh->outreq_busy, &bh->state); ++ fsg->next_buffhd_to_fill = bh->next; ++ continue; ++ } ++ ++ /* Write the received data to the backing file */ ++ bh = fsg->next_buffhd_to_drain; ++ if (bh->state == BUF_STATE_EMPTY && !get_some_more) ++ break; // We stopped early ++ if (bh->state == BUF_STATE_FULL) { ++ smp_rmb(); ++ fsg->next_buffhd_to_drain = bh->next; ++ bh->state = BUF_STATE_EMPTY; ++ ++ /* Did something go wrong with the transfer? */ ++ if (bh->outreq->status != 0) { ++ curlun->sense_data = SS_COMMUNICATION_FAILURE; ++ curlun->sense_data_info = file_offset >> curlun->blkbits; ++ curlun->info_valid = 1; ++ break; ++ } ++ ++ amount = bh->outreq->actual; ++ if (curlun->file_length - file_offset < amount) { ++ LERROR(curlun, ++ "write %u @ %llu beyond end %llu\n", ++ amount, (unsigned long long) file_offset, ++ (unsigned long long) curlun->file_length); ++ amount = curlun->file_length - file_offset; ++ } ++ ++ /* Don't accept excess data. The spec doesn't say ++ * what to do in this case. We'll ignore the error. ++ */ ++ amount = min(amount, bh->bulk_out_intended_length); ++ ++ /* Don't write a partial block */ ++ amount = round_down(amount, curlun->blksize); ++ if (amount == 0) ++ goto empty_write; ++ ++ /* Perform the write */ ++ file_offset_tmp = file_offset; ++ nwritten = vfs_write(curlun->filp, ++ (char __user *) bh->buf, ++ amount, &file_offset_tmp); ++ VLDBG(curlun, "file write %u @ %llu -> %d\n", amount, ++ (unsigned long long) file_offset, ++ (int) nwritten); ++ if (signal_pending(current)) ++ return -EINTR; // Interrupted! ++ ++ if (nwritten < 0) { ++ LDBG(curlun, "error in file write: %d\n", ++ (int) nwritten); ++ nwritten = 0; ++ } else if (nwritten < amount) { ++ LDBG(curlun, "partial file write: %d/%u\n", ++ (int) nwritten, amount); ++ nwritten = round_down(nwritten, curlun->blksize); ++ } ++ file_offset += nwritten; ++ amount_left_to_write -= nwritten; ++ fsg->residue -= nwritten; ++ ++ /* If an error occurred, report it and its position */ ++ if (nwritten < amount) { ++ curlun->sense_data = SS_WRITE_ERROR; ++ curlun->sense_data_info = file_offset >> curlun->blkbits; ++ curlun->info_valid = 1; ++ break; ++ } ++ ++ empty_write: ++ /* Did the host decide to stop early? */ ++ if (bh->outreq->actual < bh->bulk_out_intended_length) { ++ fsg->short_packet_received = 1; ++ break; ++ } ++ continue; ++ } ++ ++ /* Wait for something to happen */ ++ rc = sleep_thread(fsg); ++ if (rc) ++ return rc; ++ } ++ ++ return -EIO; // No default reply ++} ++ ++ ++/*-------------------------------------------------------------------------*/ ++ ++static int do_synchronize_cache(struct fsg_dev *fsg) ++{ ++ struct fsg_lun *curlun = fsg->curlun; ++ int rc; ++ ++ /* We ignore the requested LBA and write out all file's ++ * dirty data buffers. */ ++ rc = fsg_lun_fsync_sub(curlun); ++ if (rc) ++ curlun->sense_data = SS_WRITE_ERROR; ++ return 0; ++} ++ ++ ++/*-------------------------------------------------------------------------*/ ++ ++static void invalidate_sub(struct fsg_lun *curlun) ++{ ++ struct file *filp = curlun->filp; ++ struct inode *inode = filp->f_path.dentry->d_inode; ++ unsigned long rc; ++ ++ rc = invalidate_mapping_pages(inode->i_mapping, 0, -1); ++ VLDBG(curlun, "invalidate_mapping_pages -> %ld\n", rc); ++} ++ ++static int do_verify(struct fsg_dev *fsg) ++{ ++ struct fsg_lun *curlun = fsg->curlun; ++ u32 lba; ++ u32 verification_length; ++ struct fsg_buffhd *bh = fsg->next_buffhd_to_fill; ++ loff_t file_offset, file_offset_tmp; ++ u32 amount_left; ++ unsigned int amount; ++ ssize_t nread; ++ ++ /* Get the starting Logical Block Address and check that it's ++ * not too big */ ++ lba = get_unaligned_be32(&fsg->cmnd[2]); ++ if (lba >= curlun->num_sectors) { ++ curlun->sense_data = SS_LOGICAL_BLOCK_ADDRESS_OUT_OF_RANGE; ++ return -EINVAL; ++ } ++ ++ /* We allow DPO (Disable Page Out = don't save data in the ++ * cache) but we don't implement it. */ ++ if ((fsg->cmnd[1] & ~0x10) != 0) { ++ curlun->sense_data = SS_INVALID_FIELD_IN_CDB; ++ return -EINVAL; ++ } ++ ++ verification_length = get_unaligned_be16(&fsg->cmnd[7]); ++ if (unlikely(verification_length == 0)) ++ return -EIO; // No default reply ++ ++ /* Prepare to carry out the file verify */ ++ amount_left = verification_length << curlun->blkbits; ++ file_offset = ((loff_t) lba) << curlun->blkbits; ++ ++ /* Write out all the dirty buffers before invalidating them */ ++ fsg_lun_fsync_sub(curlun); ++ if (signal_pending(current)) ++ return -EINTR; ++ ++ invalidate_sub(curlun); ++ if (signal_pending(current)) ++ return -EINTR; ++ ++ /* Just try to read the requested blocks */ ++ while (amount_left > 0) { ++ ++ /* Figure out how much we need to read: ++ * Try to read the remaining amount, but not more than ++ * the buffer size. ++ * And don't try to read past the end of the file. ++ */ ++ amount = min((unsigned int) amount_left, mod_data.buflen); ++ amount = min((loff_t) amount, ++ curlun->file_length - file_offset); ++ if (amount == 0) { ++ curlun->sense_data = ++ SS_LOGICAL_BLOCK_ADDRESS_OUT_OF_RANGE; ++ curlun->sense_data_info = file_offset >> curlun->blkbits; ++ curlun->info_valid = 1; ++ break; ++ } ++ ++ /* Perform the read */ ++ file_offset_tmp = file_offset; ++ nread = vfs_read(curlun->filp, ++ (char __user *) bh->buf, ++ amount, &file_offset_tmp); ++ VLDBG(curlun, "file read %u @ %llu -> %d\n", amount, ++ (unsigned long long) file_offset, ++ (int) nread); ++ if (signal_pending(current)) ++ return -EINTR; ++ ++ if (nread < 0) { ++ LDBG(curlun, "error in file verify: %d\n", ++ (int) nread); ++ nread = 0; ++ } else if (nread < amount) { ++ LDBG(curlun, "partial file verify: %d/%u\n", ++ (int) nread, amount); ++ nread = round_down(nread, curlun->blksize); ++ } ++ if (nread == 0) { ++ curlun->sense_data = SS_UNRECOVERED_READ_ERROR; ++ curlun->sense_data_info = file_offset >> curlun->blkbits; ++ curlun->info_valid = 1; ++ break; ++ } ++ file_offset += nread; ++ amount_left -= nread; ++ } ++ return 0; ++} ++ ++ ++/*-------------------------------------------------------------------------*/ ++ ++static int do_inquiry(struct fsg_dev *fsg, struct fsg_buffhd *bh) ++{ ++ u8 *buf = (u8 *) bh->buf; ++ ++ static char vendor_id[] = "Linux "; ++ static char product_disk_id[] = "File-Stor Gadget"; ++ static char product_cdrom_id[] = "File-CD Gadget "; ++ ++ if (!fsg->curlun) { // Unsupported LUNs are okay ++ fsg->bad_lun_okay = 1; ++ memset(buf, 0, 36); ++ buf[0] = 0x7f; // Unsupported, no device-type ++ buf[4] = 31; // Additional length ++ return 36; ++ } ++ ++ memset(buf, 0, 8); ++ buf[0] = (mod_data.cdrom ? TYPE_ROM : TYPE_DISK); ++ if (mod_data.removable) ++ buf[1] = 0x80; ++ buf[2] = 2; // ANSI SCSI level 2 ++ buf[3] = 2; // SCSI-2 INQUIRY data format ++ buf[4] = 31; // Additional length ++ // No special options ++ sprintf(buf + 8, "%-8s%-16s%04x", vendor_id, ++ (mod_data.cdrom ? product_cdrom_id : ++ product_disk_id), ++ mod_data.release); ++ return 36; ++} ++ ++ ++static int do_request_sense(struct fsg_dev *fsg, struct fsg_buffhd *bh) ++{ ++ struct fsg_lun *curlun = fsg->curlun; ++ u8 *buf = (u8 *) bh->buf; ++ u32 sd, sdinfo; ++ int valid; ++ ++ /* ++ * From the SCSI-2 spec., section 7.9 (Unit attention condition): ++ * ++ * If a REQUEST SENSE command is received from an initiator ++ * with a pending unit attention condition (before the target ++ * generates the contingent allegiance condition), then the ++ * target shall either: ++ * a) report any pending sense data and preserve the unit ++ * attention condition on the logical unit, or, ++ * b) report the unit attention condition, may discard any ++ * pending sense data, and clear the unit attention ++ * condition on the logical unit for that initiator. ++ * ++ * FSG normally uses option a); enable this code to use option b). ++ */ ++#if 0 ++ if (curlun && curlun->unit_attention_data != SS_NO_SENSE) { ++ curlun->sense_data = curlun->unit_attention_data; ++ curlun->unit_attention_data = SS_NO_SENSE; ++ } ++#endif ++ ++ if (!curlun) { // Unsupported LUNs are okay ++ fsg->bad_lun_okay = 1; ++ sd = SS_LOGICAL_UNIT_NOT_SUPPORTED; ++ sdinfo = 0; ++ valid = 0; ++ } else { ++ sd = curlun->sense_data; ++ sdinfo = curlun->sense_data_info; ++ valid = curlun->info_valid << 7; ++ curlun->sense_data = SS_NO_SENSE; ++ curlun->sense_data_info = 0; ++ curlun->info_valid = 0; ++ } ++ ++ memset(buf, 0, 18); ++ buf[0] = valid | 0x70; // Valid, current error ++ buf[2] = SK(sd); ++ put_unaligned_be32(sdinfo, &buf[3]); /* Sense information */ ++ buf[7] = 18 - 8; // Additional sense length ++ buf[12] = ASC(sd); ++ buf[13] = ASCQ(sd); ++ return 18; ++} ++ ++ ++static int do_read_capacity(struct fsg_dev *fsg, struct fsg_buffhd *bh) ++{ ++ struct fsg_lun *curlun = fsg->curlun; ++ u32 lba = get_unaligned_be32(&fsg->cmnd[2]); ++ int pmi = fsg->cmnd[8]; ++ u8 *buf = (u8 *) bh->buf; ++ ++ /* Check the PMI and LBA fields */ ++ if (pmi > 1 || (pmi == 0 && lba != 0)) { ++ curlun->sense_data = SS_INVALID_FIELD_IN_CDB; ++ return -EINVAL; ++ } ++ ++ put_unaligned_be32(curlun->num_sectors - 1, &buf[0]); ++ /* Max logical block */ ++ put_unaligned_be32(curlun->blksize, &buf[4]); /* Block length */ ++ return 8; ++} ++ ++ ++static int do_read_header(struct fsg_dev *fsg, struct fsg_buffhd *bh) ++{ ++ struct fsg_lun *curlun = fsg->curlun; ++ int msf = fsg->cmnd[1] & 0x02; ++ u32 lba = get_unaligned_be32(&fsg->cmnd[2]); ++ u8 *buf = (u8 *) bh->buf; ++ ++ if ((fsg->cmnd[1] & ~0x02) != 0) { /* Mask away MSF */ ++ curlun->sense_data = SS_INVALID_FIELD_IN_CDB; ++ return -EINVAL; ++ } ++ if (lba >= curlun->num_sectors) { ++ curlun->sense_data = SS_LOGICAL_BLOCK_ADDRESS_OUT_OF_RANGE; ++ return -EINVAL; ++ } ++ ++ memset(buf, 0, 8); ++ buf[0] = 0x01; /* 2048 bytes of user data, rest is EC */ ++ store_cdrom_address(&buf[4], msf, lba); ++ return 8; ++} ++ ++ ++static int do_read_toc(struct fsg_dev *fsg, struct fsg_buffhd *bh) ++{ ++ struct fsg_lun *curlun = fsg->curlun; ++ int msf = fsg->cmnd[1] & 0x02; ++ int start_track = fsg->cmnd[6]; ++ u8 *buf = (u8 *) bh->buf; ++ ++ if ((fsg->cmnd[1] & ~0x02) != 0 || /* Mask away MSF */ ++ start_track > 1) { ++ curlun->sense_data = SS_INVALID_FIELD_IN_CDB; ++ return -EINVAL; ++ } ++ ++ memset(buf, 0, 20); ++ buf[1] = (20-2); /* TOC data length */ ++ buf[2] = 1; /* First track number */ ++ buf[3] = 1; /* Last track number */ ++ buf[5] = 0x16; /* Data track, copying allowed */ ++ buf[6] = 0x01; /* Only track is number 1 */ ++ store_cdrom_address(&buf[8], msf, 0); ++ ++ buf[13] = 0x16; /* Lead-out track is data */ ++ buf[14] = 0xAA; /* Lead-out track number */ ++ store_cdrom_address(&buf[16], msf, curlun->num_sectors); ++ return 20; ++} ++ ++ ++static int do_mode_sense(struct fsg_dev *fsg, struct fsg_buffhd *bh) ++{ ++ struct fsg_lun *curlun = fsg->curlun; ++ int mscmnd = fsg->cmnd[0]; ++ u8 *buf = (u8 *) bh->buf; ++ u8 *buf0 = buf; ++ int pc, page_code; ++ int changeable_values, all_pages; ++ int valid_page = 0; ++ int len, limit; ++ ++ if ((fsg->cmnd[1] & ~0x08) != 0) { // Mask away DBD ++ curlun->sense_data = SS_INVALID_FIELD_IN_CDB; ++ return -EINVAL; ++ } ++ pc = fsg->cmnd[2] >> 6; ++ page_code = fsg->cmnd[2] & 0x3f; ++ if (pc == 3) { ++ curlun->sense_data = SS_SAVING_PARAMETERS_NOT_SUPPORTED; ++ return -EINVAL; ++ } ++ changeable_values = (pc == 1); ++ all_pages = (page_code == 0x3f); ++ ++ /* Write the mode parameter header. Fixed values are: default ++ * medium type, no cache control (DPOFUA), and no block descriptors. ++ * The only variable value is the WriteProtect bit. We will fill in ++ * the mode data length later. */ ++ memset(buf, 0, 8); ++ if (mscmnd == MODE_SENSE) { ++ buf[2] = (curlun->ro ? 0x80 : 0x00); // WP, DPOFUA ++ buf += 4; ++ limit = 255; ++ } else { // MODE_SENSE_10 ++ buf[3] = (curlun->ro ? 0x80 : 0x00); // WP, DPOFUA ++ buf += 8; ++ limit = 65535; // Should really be mod_data.buflen ++ } ++ ++ /* No block descriptors */ ++ ++ /* The mode pages, in numerical order. The only page we support ++ * is the Caching page. */ ++ if (page_code == 0x08 || all_pages) { ++ valid_page = 1; ++ buf[0] = 0x08; // Page code ++ buf[1] = 10; // Page length ++ memset(buf+2, 0, 10); // None of the fields are changeable ++ ++ if (!changeable_values) { ++ buf[2] = 0x04; // Write cache enable, ++ // Read cache not disabled ++ // No cache retention priorities ++ put_unaligned_be16(0xffff, &buf[4]); ++ /* Don't disable prefetch */ ++ /* Minimum prefetch = 0 */ ++ put_unaligned_be16(0xffff, &buf[8]); ++ /* Maximum prefetch */ ++ put_unaligned_be16(0xffff, &buf[10]); ++ /* Maximum prefetch ceiling */ ++ } ++ buf += 12; ++ } ++ ++ /* Check that a valid page was requested and the mode data length ++ * isn't too long. */ ++ len = buf - buf0; ++ if (!valid_page || len > limit) { ++ curlun->sense_data = SS_INVALID_FIELD_IN_CDB; ++ return -EINVAL; ++ } ++ ++ /* Store the mode data length */ ++ if (mscmnd == MODE_SENSE) ++ buf0[0] = len - 1; ++ else ++ put_unaligned_be16(len - 2, buf0); ++ return len; ++} ++ ++ ++static int do_start_stop(struct fsg_dev *fsg) ++{ ++ struct fsg_lun *curlun = fsg->curlun; ++ int loej, start; ++ ++ if (!mod_data.removable) { ++ curlun->sense_data = SS_INVALID_COMMAND; ++ return -EINVAL; ++ } ++ ++ // int immed = fsg->cmnd[1] & 0x01; ++ loej = fsg->cmnd[4] & 0x02; ++ start = fsg->cmnd[4] & 0x01; ++ ++#ifdef CONFIG_USB_FILE_STORAGE_TEST ++ if ((fsg->cmnd[1] & ~0x01) != 0 || // Mask away Immed ++ (fsg->cmnd[4] & ~0x03) != 0) { // Mask LoEj, Start ++ curlun->sense_data = SS_INVALID_FIELD_IN_CDB; ++ return -EINVAL; ++ } ++ ++ if (!start) { ++ ++ /* Are we allowed to unload the media? */ ++ if (curlun->prevent_medium_removal) { ++ LDBG(curlun, "unload attempt prevented\n"); ++ curlun->sense_data = SS_MEDIUM_REMOVAL_PREVENTED; ++ return -EINVAL; ++ } ++ if (loej) { // Simulate an unload/eject ++ up_read(&fsg->filesem); ++ down_write(&fsg->filesem); ++ fsg_lun_close(curlun); ++ up_write(&fsg->filesem); ++ down_read(&fsg->filesem); ++ } ++ } else { ++ ++ /* Our emulation doesn't support mounting; the medium is ++ * available for use as soon as it is loaded. */ ++ if (!fsg_lun_is_open(curlun)) { ++ curlun->sense_data = SS_MEDIUM_NOT_PRESENT; ++ return -EINVAL; ++ } ++ } ++#endif ++ return 0; ++} ++ ++ ++static int do_prevent_allow(struct fsg_dev *fsg) ++{ ++ struct fsg_lun *curlun = fsg->curlun; ++ int prevent; ++ ++ if (!mod_data.removable) { ++ curlun->sense_data = SS_INVALID_COMMAND; ++ return -EINVAL; ++ } ++ ++ prevent = fsg->cmnd[4] & 0x01; ++ if ((fsg->cmnd[4] & ~0x01) != 0) { // Mask away Prevent ++ curlun->sense_data = SS_INVALID_FIELD_IN_CDB; ++ return -EINVAL; ++ } ++ ++ if (curlun->prevent_medium_removal && !prevent) ++ fsg_lun_fsync_sub(curlun); ++ curlun->prevent_medium_removal = prevent; ++ return 0; ++} ++ ++ ++static int do_read_format_capacities(struct fsg_dev *fsg, ++ struct fsg_buffhd *bh) ++{ ++ struct fsg_lun *curlun = fsg->curlun; ++ u8 *buf = (u8 *) bh->buf; ++ ++ buf[0] = buf[1] = buf[2] = 0; ++ buf[3] = 8; // Only the Current/Maximum Capacity Descriptor ++ buf += 4; ++ ++ put_unaligned_be32(curlun->num_sectors, &buf[0]); ++ /* Number of blocks */ ++ put_unaligned_be32(curlun->blksize, &buf[4]); /* Block length */ ++ buf[4] = 0x02; /* Current capacity */ ++ return 12; ++} ++ ++ ++static int do_mode_select(struct fsg_dev *fsg, struct fsg_buffhd *bh) ++{ ++ struct fsg_lun *curlun = fsg->curlun; ++ ++ /* We don't support MODE SELECT */ ++ curlun->sense_data = SS_INVALID_COMMAND; ++ return -EINVAL; ++} ++ ++ ++/*-------------------------------------------------------------------------*/ ++ ++static int halt_bulk_in_endpoint(struct fsg_dev *fsg) ++{ ++ int rc; ++ ++ rc = fsg_set_halt(fsg, fsg->bulk_in); ++ if (rc == -EAGAIN) ++ VDBG(fsg, "delayed bulk-in endpoint halt\n"); ++ while (rc != 0) { ++ if (rc != -EAGAIN) { ++ WARNING(fsg, "usb_ep_set_halt -> %d\n", rc); ++ rc = 0; ++ break; ++ } ++ ++ /* Wait for a short time and then try again */ ++ if (msleep_interruptible(100) != 0) ++ return -EINTR; ++ rc = usb_ep_set_halt(fsg->bulk_in); ++ } ++ return rc; ++} ++ ++static int wedge_bulk_in_endpoint(struct fsg_dev *fsg) ++{ ++ int rc; ++ ++ DBG(fsg, "bulk-in set wedge\n"); ++ rc = usb_ep_set_wedge(fsg->bulk_in); ++ if (rc == -EAGAIN) ++ VDBG(fsg, "delayed bulk-in endpoint wedge\n"); ++ while (rc != 0) { ++ if (rc != -EAGAIN) { ++ WARNING(fsg, "usb_ep_set_wedge -> %d\n", rc); ++ rc = 0; ++ break; ++ } ++ ++ /* Wait for a short time and then try again */ ++ if (msleep_interruptible(100) != 0) ++ return -EINTR; ++ rc = usb_ep_set_wedge(fsg->bulk_in); ++ } ++ return rc; ++} ++ ++static int throw_away_data(struct fsg_dev *fsg) ++{ ++ struct fsg_buffhd *bh; ++ u32 amount; ++ int rc; ++ ++ while ((bh = fsg->next_buffhd_to_drain)->state != BUF_STATE_EMPTY || ++ fsg->usb_amount_left > 0) { ++ ++ /* Throw away the data in a filled buffer */ ++ if (bh->state == BUF_STATE_FULL) { ++ smp_rmb(); ++ bh->state = BUF_STATE_EMPTY; ++ fsg->next_buffhd_to_drain = bh->next; ++ ++ /* A short packet or an error ends everything */ ++ if (bh->outreq->actual < bh->bulk_out_intended_length || ++ bh->outreq->status != 0) { ++ raise_exception(fsg, FSG_STATE_ABORT_BULK_OUT); ++ return -EINTR; ++ } ++ continue; ++ } ++ ++ /* Try to submit another request if we need one */ ++ bh = fsg->next_buffhd_to_fill; ++ if (bh->state == BUF_STATE_EMPTY && fsg->usb_amount_left > 0) { ++ amount = min(fsg->usb_amount_left, ++ (u32) mod_data.buflen); ++ ++ /* Except at the end of the transfer, amount will be ++ * equal to the buffer size, which is divisible by ++ * the bulk-out maxpacket size. ++ */ ++ set_bulk_out_req_length(fsg, bh, amount); ++ start_transfer(fsg, fsg->bulk_out, bh->outreq, ++ &bh->outreq_busy, &bh->state); ++ fsg->next_buffhd_to_fill = bh->next; ++ fsg->usb_amount_left -= amount; ++ continue; ++ } ++ ++ /* Otherwise wait for something to happen */ ++ rc = sleep_thread(fsg); ++ if (rc) ++ return rc; ++ } ++ return 0; ++} ++ ++ ++static int finish_reply(struct fsg_dev *fsg) ++{ ++ struct fsg_buffhd *bh = fsg->next_buffhd_to_fill; ++ int rc = 0; ++ ++ switch (fsg->data_dir) { ++ case DATA_DIR_NONE: ++ break; // Nothing to send ++ ++ /* If we don't know whether the host wants to read or write, ++ * this must be CB or CBI with an unknown command. We mustn't ++ * try to send or receive any data. So stall both bulk pipes ++ * if we can and wait for a reset. */ ++ case DATA_DIR_UNKNOWN: ++ if (mod_data.can_stall) { ++ fsg_set_halt(fsg, fsg->bulk_out); ++ rc = halt_bulk_in_endpoint(fsg); ++ } ++ break; ++ ++ /* All but the last buffer of data must have already been sent */ ++ case DATA_DIR_TO_HOST: ++ if (fsg->data_size == 0) ++ ; // Nothing to send ++ ++ /* If there's no residue, simply send the last buffer */ ++ else if (fsg->residue == 0) { ++ bh->inreq->zero = 0; ++ start_transfer(fsg, fsg->bulk_in, bh->inreq, ++ &bh->inreq_busy, &bh->state); ++ fsg->next_buffhd_to_fill = bh->next; ++ } ++ ++ /* There is a residue. For CB and CBI, simply mark the end ++ * of the data with a short packet. However, if we are ++ * allowed to stall, there was no data at all (residue == ++ * data_size), and the command failed (invalid LUN or ++ * sense data is set), then halt the bulk-in endpoint ++ * instead. */ ++ else if (!transport_is_bbb()) { ++ if (mod_data.can_stall && ++ fsg->residue == fsg->data_size && ++ (!fsg->curlun || fsg->curlun->sense_data != SS_NO_SENSE)) { ++ bh->state = BUF_STATE_EMPTY; ++ rc = halt_bulk_in_endpoint(fsg); ++ } else { ++ bh->inreq->zero = 1; ++ start_transfer(fsg, fsg->bulk_in, bh->inreq, ++ &bh->inreq_busy, &bh->state); ++ fsg->next_buffhd_to_fill = bh->next; ++ } ++ } ++ ++ /* ++ * For Bulk-only, mark the end of the data with a short ++ * packet. If we are allowed to stall, halt the bulk-in ++ * endpoint. (Note: This violates the Bulk-Only Transport ++ * specification, which requires us to pad the data if we ++ * don't halt the endpoint. Presumably nobody will mind.) ++ */ ++ else { ++ bh->inreq->zero = 1; ++ start_transfer(fsg, fsg->bulk_in, bh->inreq, ++ &bh->inreq_busy, &bh->state); ++ fsg->next_buffhd_to_fill = bh->next; ++ if (mod_data.can_stall) ++ rc = halt_bulk_in_endpoint(fsg); ++ } ++ break; ++ ++ /* We have processed all we want from the data the host has sent. ++ * There may still be outstanding bulk-out requests. */ ++ case DATA_DIR_FROM_HOST: ++ if (fsg->residue == 0) ++ ; // Nothing to receive ++ ++ /* Did the host stop sending unexpectedly early? */ ++ else if (fsg->short_packet_received) { ++ raise_exception(fsg, FSG_STATE_ABORT_BULK_OUT); ++ rc = -EINTR; ++ } ++ ++ /* We haven't processed all the incoming data. Even though ++ * we may be allowed to stall, doing so would cause a race. ++ * The controller may already have ACK'ed all the remaining ++ * bulk-out packets, in which case the host wouldn't see a ++ * STALL. Not realizing the endpoint was halted, it wouldn't ++ * clear the halt -- leading to problems later on. */ ++#if 0 ++ else if (mod_data.can_stall) { ++ fsg_set_halt(fsg, fsg->bulk_out); ++ raise_exception(fsg, FSG_STATE_ABORT_BULK_OUT); ++ rc = -EINTR; ++ } ++#endif ++ ++ /* We can't stall. Read in the excess data and throw it ++ * all away. */ ++ else ++ rc = throw_away_data(fsg); ++ break; ++ } ++ return rc; ++} ++ ++ ++static int send_status(struct fsg_dev *fsg) ++{ ++ struct fsg_lun *curlun = fsg->curlun; ++ struct fsg_buffhd *bh; ++ int rc; ++ u8 status = US_BULK_STAT_OK; ++ u32 sd, sdinfo = 0; ++ ++ /* Wait for the next buffer to become available */ ++ bh = fsg->next_buffhd_to_fill; ++ while (bh->state != BUF_STATE_EMPTY) { ++ rc = sleep_thread(fsg); ++ if (rc) ++ return rc; ++ } ++ ++ if (curlun) { ++ sd = curlun->sense_data; ++ sdinfo = curlun->sense_data_info; ++ } else if (fsg->bad_lun_okay) ++ sd = SS_NO_SENSE; ++ else ++ sd = SS_LOGICAL_UNIT_NOT_SUPPORTED; ++ ++ if (fsg->phase_error) { ++ DBG(fsg, "sending phase-error status\n"); ++ status = US_BULK_STAT_PHASE; ++ sd = SS_INVALID_COMMAND; ++ } else if (sd != SS_NO_SENSE) { ++ DBG(fsg, "sending command-failure status\n"); ++ status = US_BULK_STAT_FAIL; ++ VDBG(fsg, " sense data: SK x%02x, ASC x%02x, ASCQ x%02x;" ++ " info x%x\n", ++ SK(sd), ASC(sd), ASCQ(sd), sdinfo); ++ } ++ ++ if (transport_is_bbb()) { ++ struct bulk_cs_wrap *csw = bh->buf; ++ ++ /* Store and send the Bulk-only CSW */ ++ csw->Signature = cpu_to_le32(US_BULK_CS_SIGN); ++ csw->Tag = fsg->tag; ++ csw->Residue = cpu_to_le32(fsg->residue); ++ csw->Status = status; ++ ++ bh->inreq->length = US_BULK_CS_WRAP_LEN; ++ bh->inreq->zero = 0; ++ start_transfer(fsg, fsg->bulk_in, bh->inreq, ++ &bh->inreq_busy, &bh->state); ++ ++ } else if (mod_data.transport_type == USB_PR_CB) { ++ ++ /* Control-Bulk transport has no status phase! */ ++ return 0; ++ ++ } else { // USB_PR_CBI ++ struct interrupt_data *buf = bh->buf; ++ ++ /* Store and send the Interrupt data. UFI sends the ASC ++ * and ASCQ bytes. Everything else sends a Type (which ++ * is always 0) and the status Value. */ ++ if (mod_data.protocol_type == USB_SC_UFI) { ++ buf->bType = ASC(sd); ++ buf->bValue = ASCQ(sd); ++ } else { ++ buf->bType = 0; ++ buf->bValue = status; ++ } ++ fsg->intreq->length = CBI_INTERRUPT_DATA_LEN; ++ ++ fsg->intr_buffhd = bh; // Point to the right buffhd ++ fsg->intreq->buf = bh->inreq->buf; ++ fsg->intreq->context = bh; ++ start_transfer(fsg, fsg->intr_in, fsg->intreq, ++ &fsg->intreq_busy, &bh->state); ++ } ++ ++ fsg->next_buffhd_to_fill = bh->next; ++ return 0; ++} ++ ++ ++/*-------------------------------------------------------------------------*/ ++ ++/* Check whether the command is properly formed and whether its data size ++ * and direction agree with the values we already have. */ ++static int check_command(struct fsg_dev *fsg, int cmnd_size, ++ enum data_direction data_dir, unsigned int mask, ++ int needs_medium, const char *name) ++{ ++ int i; ++ int lun = fsg->cmnd[1] >> 5; ++ static const char dirletter[4] = {'u', 'o', 'i', 'n'}; ++ char hdlen[20]; ++ struct fsg_lun *curlun; ++ ++ /* Adjust the expected cmnd_size for protocol encapsulation padding. ++ * Transparent SCSI doesn't pad. */ ++ if (protocol_is_scsi()) ++ ; ++ ++ /* There's some disagreement as to whether RBC pads commands or not. ++ * We'll play it safe and accept either form. */ ++ else if (mod_data.protocol_type == USB_SC_RBC) { ++ if (fsg->cmnd_size == 12) ++ cmnd_size = 12; ++ ++ /* All the other protocols pad to 12 bytes */ ++ } else ++ cmnd_size = 12; ++ ++ hdlen[0] = 0; ++ if (fsg->data_dir != DATA_DIR_UNKNOWN) ++ sprintf(hdlen, ", H%c=%u", dirletter[(int) fsg->data_dir], ++ fsg->data_size); ++ VDBG(fsg, "SCSI command: %s; Dc=%d, D%c=%u; Hc=%d%s\n", ++ name, cmnd_size, dirletter[(int) data_dir], ++ fsg->data_size_from_cmnd, fsg->cmnd_size, hdlen); ++ ++ /* We can't reply at all until we know the correct data direction ++ * and size. */ ++ if (fsg->data_size_from_cmnd == 0) ++ data_dir = DATA_DIR_NONE; ++ if (fsg->data_dir == DATA_DIR_UNKNOWN) { // CB or CBI ++ fsg->data_dir = data_dir; ++ fsg->data_size = fsg->data_size_from_cmnd; ++ ++ } else { // Bulk-only ++ if (fsg->data_size < fsg->data_size_from_cmnd) { ++ ++ /* Host data size < Device data size is a phase error. ++ * Carry out the command, but only transfer as much ++ * as we are allowed. */ ++ fsg->data_size_from_cmnd = fsg->data_size; ++ fsg->phase_error = 1; ++ } ++ } ++ fsg->residue = fsg->usb_amount_left = fsg->data_size; ++ ++ /* Conflicting data directions is a phase error */ ++ if (fsg->data_dir != data_dir && fsg->data_size_from_cmnd > 0) { ++ fsg->phase_error = 1; ++ return -EINVAL; ++ } ++ ++ /* Verify the length of the command itself */ ++ if (cmnd_size != fsg->cmnd_size) { ++ ++ /* Special case workaround: There are plenty of buggy SCSI ++ * implementations. Many have issues with cbw->Length ++ * field passing a wrong command size. For those cases we ++ * always try to work around the problem by using the length ++ * sent by the host side provided it is at least as large ++ * as the correct command length. ++ * Examples of such cases would be MS-Windows, which issues ++ * REQUEST SENSE with cbw->Length == 12 where it should ++ * be 6, and xbox360 issuing INQUIRY, TEST UNIT READY and ++ * REQUEST SENSE with cbw->Length == 10 where it should ++ * be 6 as well. ++ */ ++ if (cmnd_size <= fsg->cmnd_size) { ++ DBG(fsg, "%s is buggy! Expected length %d " ++ "but we got %d\n", name, ++ cmnd_size, fsg->cmnd_size); ++ cmnd_size = fsg->cmnd_size; ++ } else { ++ fsg->phase_error = 1; ++ return -EINVAL; ++ } ++ } ++ ++ /* Check that the LUN values are consistent */ ++ if (transport_is_bbb()) { ++ if (fsg->lun != lun) ++ DBG(fsg, "using LUN %d from CBW, " ++ "not LUN %d from CDB\n", ++ fsg->lun, lun); ++ } ++ ++ /* Check the LUN */ ++ curlun = fsg->curlun; ++ if (curlun) { ++ if (fsg->cmnd[0] != REQUEST_SENSE) { ++ curlun->sense_data = SS_NO_SENSE; ++ curlun->sense_data_info = 0; ++ curlun->info_valid = 0; ++ } ++ } else { ++ fsg->bad_lun_okay = 0; ++ ++ /* INQUIRY and REQUEST SENSE commands are explicitly allowed ++ * to use unsupported LUNs; all others may not. */ ++ if (fsg->cmnd[0] != INQUIRY && ++ fsg->cmnd[0] != REQUEST_SENSE) { ++ DBG(fsg, "unsupported LUN %d\n", fsg->lun); ++ return -EINVAL; ++ } ++ } ++ ++ /* If a unit attention condition exists, only INQUIRY and ++ * REQUEST SENSE commands are allowed; anything else must fail. */ ++ if (curlun && curlun->unit_attention_data != SS_NO_SENSE && ++ fsg->cmnd[0] != INQUIRY && ++ fsg->cmnd[0] != REQUEST_SENSE) { ++ curlun->sense_data = curlun->unit_attention_data; ++ curlun->unit_attention_data = SS_NO_SENSE; ++ return -EINVAL; ++ } ++ ++ /* Check that only command bytes listed in the mask are non-zero */ ++ fsg->cmnd[1] &= 0x1f; // Mask away the LUN ++ for (i = 1; i < cmnd_size; ++i) { ++ if (fsg->cmnd[i] && !(mask & (1 << i))) { ++ if (curlun) ++ curlun->sense_data = SS_INVALID_FIELD_IN_CDB; ++ return -EINVAL; ++ } ++ } ++ ++ /* If the medium isn't mounted and the command needs to access ++ * it, return an error. */ ++ if (curlun && !fsg_lun_is_open(curlun) && needs_medium) { ++ curlun->sense_data = SS_MEDIUM_NOT_PRESENT; ++ return -EINVAL; ++ } ++ ++ return 0; ++} ++ ++/* wrapper of check_command for data size in blocks handling */ ++static int check_command_size_in_blocks(struct fsg_dev *fsg, int cmnd_size, ++ enum data_direction data_dir, unsigned int mask, ++ int needs_medium, const char *name) ++{ ++ if (fsg->curlun) ++ fsg->data_size_from_cmnd <<= fsg->curlun->blkbits; ++ return check_command(fsg, cmnd_size, data_dir, ++ mask, needs_medium, name); ++} ++ ++static int do_scsi_command(struct fsg_dev *fsg) ++{ ++ struct fsg_buffhd *bh; ++ int rc; ++ int reply = -EINVAL; ++ int i; ++ static char unknown[16]; ++ ++ dump_cdb(fsg); ++ ++ /* Wait for the next buffer to become available for data or status */ ++ bh = fsg->next_buffhd_to_drain = fsg->next_buffhd_to_fill; ++ while (bh->state != BUF_STATE_EMPTY) { ++ rc = sleep_thread(fsg); ++ if (rc) ++ return rc; ++ } ++ fsg->phase_error = 0; ++ fsg->short_packet_received = 0; ++ ++ down_read(&fsg->filesem); // We're using the backing file ++ switch (fsg->cmnd[0]) { ++ ++ case INQUIRY: ++ fsg->data_size_from_cmnd = fsg->cmnd[4]; ++ if ((reply = check_command(fsg, 6, DATA_DIR_TO_HOST, ++ (1<<4), 0, ++ "INQUIRY")) == 0) ++ reply = do_inquiry(fsg, bh); ++ break; ++ ++ case MODE_SELECT: ++ fsg->data_size_from_cmnd = fsg->cmnd[4]; ++ if ((reply = check_command(fsg, 6, DATA_DIR_FROM_HOST, ++ (1<<1) | (1<<4), 0, ++ "MODE SELECT(6)")) == 0) ++ reply = do_mode_select(fsg, bh); ++ break; ++ ++ case MODE_SELECT_10: ++ fsg->data_size_from_cmnd = get_unaligned_be16(&fsg->cmnd[7]); ++ if ((reply = check_command(fsg, 10, DATA_DIR_FROM_HOST, ++ (1<<1) | (3<<7), 0, ++ "MODE SELECT(10)")) == 0) ++ reply = do_mode_select(fsg, bh); ++ break; ++ ++ case MODE_SENSE: ++ fsg->data_size_from_cmnd = fsg->cmnd[4]; ++ if ((reply = check_command(fsg, 6, DATA_DIR_TO_HOST, ++ (1<<1) | (1<<2) | (1<<4), 0, ++ "MODE SENSE(6)")) == 0) ++ reply = do_mode_sense(fsg, bh); ++ break; ++ ++ case MODE_SENSE_10: ++ fsg->data_size_from_cmnd = get_unaligned_be16(&fsg->cmnd[7]); ++ if ((reply = check_command(fsg, 10, DATA_DIR_TO_HOST, ++ (1<<1) | (1<<2) | (3<<7), 0, ++ "MODE SENSE(10)")) == 0) ++ reply = do_mode_sense(fsg, bh); ++ break; ++ ++ case ALLOW_MEDIUM_REMOVAL: ++ fsg->data_size_from_cmnd = 0; ++ if ((reply = check_command(fsg, 6, DATA_DIR_NONE, ++ (1<<4), 0, ++ "PREVENT-ALLOW MEDIUM REMOVAL")) == 0) ++ reply = do_prevent_allow(fsg); ++ break; ++ ++ case READ_6: ++ i = fsg->cmnd[4]; ++ fsg->data_size_from_cmnd = (i == 0) ? 256 : i; ++ if ((reply = check_command_size_in_blocks(fsg, 6, ++ DATA_DIR_TO_HOST, ++ (7<<1) | (1<<4), 1, ++ "READ(6)")) == 0) ++ reply = do_read(fsg); ++ break; ++ ++ case READ_10: ++ fsg->data_size_from_cmnd = get_unaligned_be16(&fsg->cmnd[7]); ++ if ((reply = check_command_size_in_blocks(fsg, 10, ++ DATA_DIR_TO_HOST, ++ (1<<1) | (0xf<<2) | (3<<7), 1, ++ "READ(10)")) == 0) ++ reply = do_read(fsg); ++ break; ++ ++ case READ_12: ++ fsg->data_size_from_cmnd = get_unaligned_be32(&fsg->cmnd[6]); ++ if ((reply = check_command_size_in_blocks(fsg, 12, ++ DATA_DIR_TO_HOST, ++ (1<<1) | (0xf<<2) | (0xf<<6), 1, ++ "READ(12)")) == 0) ++ reply = do_read(fsg); ++ break; ++ ++ case READ_CAPACITY: ++ fsg->data_size_from_cmnd = 8; ++ if ((reply = check_command(fsg, 10, DATA_DIR_TO_HOST, ++ (0xf<<2) | (1<<8), 1, ++ "READ CAPACITY")) == 0) ++ reply = do_read_capacity(fsg, bh); ++ break; ++ ++ case READ_HEADER: ++ if (!mod_data.cdrom) ++ goto unknown_cmnd; ++ fsg->data_size_from_cmnd = get_unaligned_be16(&fsg->cmnd[7]); ++ if ((reply = check_command(fsg, 10, DATA_DIR_TO_HOST, ++ (3<<7) | (0x1f<<1), 1, ++ "READ HEADER")) == 0) ++ reply = do_read_header(fsg, bh); ++ break; ++ ++ case READ_TOC: ++ if (!mod_data.cdrom) ++ goto unknown_cmnd; ++ fsg->data_size_from_cmnd = get_unaligned_be16(&fsg->cmnd[7]); ++ if ((reply = check_command(fsg, 10, DATA_DIR_TO_HOST, ++ (7<<6) | (1<<1), 1, ++ "READ TOC")) == 0) ++ reply = do_read_toc(fsg, bh); ++ break; ++ ++ case READ_FORMAT_CAPACITIES: ++ fsg->data_size_from_cmnd = get_unaligned_be16(&fsg->cmnd[7]); ++ if ((reply = check_command(fsg, 10, DATA_DIR_TO_HOST, ++ (3<<7), 1, ++ "READ FORMAT CAPACITIES")) == 0) ++ reply = do_read_format_capacities(fsg, bh); ++ break; ++ ++ case REQUEST_SENSE: ++ fsg->data_size_from_cmnd = fsg->cmnd[4]; ++ if ((reply = check_command(fsg, 6, DATA_DIR_TO_HOST, ++ (1<<4), 0, ++ "REQUEST SENSE")) == 0) ++ reply = do_request_sense(fsg, bh); ++ break; ++ ++ case START_STOP: ++ fsg->data_size_from_cmnd = 0; ++ if ((reply = check_command(fsg, 6, DATA_DIR_NONE, ++ (1<<1) | (1<<4), 0, ++ "START-STOP UNIT")) == 0) ++ reply = do_start_stop(fsg); ++ break; ++ ++ case SYNCHRONIZE_CACHE: ++ fsg->data_size_from_cmnd = 0; ++ if ((reply = check_command(fsg, 10, DATA_DIR_NONE, ++ (0xf<<2) | (3<<7), 1, ++ "SYNCHRONIZE CACHE")) == 0) ++ reply = do_synchronize_cache(fsg); ++ break; ++ ++ case TEST_UNIT_READY: ++ fsg->data_size_from_cmnd = 0; ++ reply = check_command(fsg, 6, DATA_DIR_NONE, ++ 0, 1, ++ "TEST UNIT READY"); ++ break; ++ ++ /* Although optional, this command is used by MS-Windows. We ++ * support a minimal version: BytChk must be 0. */ ++ case VERIFY: ++ fsg->data_size_from_cmnd = 0; ++ if ((reply = check_command(fsg, 10, DATA_DIR_NONE, ++ (1<<1) | (0xf<<2) | (3<<7), 1, ++ "VERIFY")) == 0) ++ reply = do_verify(fsg); ++ break; ++ ++ case WRITE_6: ++ i = fsg->cmnd[4]; ++ fsg->data_size_from_cmnd = (i == 0) ? 256 : i; ++ if ((reply = check_command_size_in_blocks(fsg, 6, ++ DATA_DIR_FROM_HOST, ++ (7<<1) | (1<<4), 1, ++ "WRITE(6)")) == 0) ++ reply = do_write(fsg); ++ break; ++ ++ case WRITE_10: ++ fsg->data_size_from_cmnd = get_unaligned_be16(&fsg->cmnd[7]); ++ if ((reply = check_command_size_in_blocks(fsg, 10, ++ DATA_DIR_FROM_HOST, ++ (1<<1) | (0xf<<2) | (3<<7), 1, ++ "WRITE(10)")) == 0) ++ reply = do_write(fsg); ++ break; ++ ++ case WRITE_12: ++ fsg->data_size_from_cmnd = get_unaligned_be32(&fsg->cmnd[6]); ++ if ((reply = check_command_size_in_blocks(fsg, 12, ++ DATA_DIR_FROM_HOST, ++ (1<<1) | (0xf<<2) | (0xf<<6), 1, ++ "WRITE(12)")) == 0) ++ reply = do_write(fsg); ++ break; ++ ++ /* Some mandatory commands that we recognize but don't implement. ++ * They don't mean much in this setting. It's left as an exercise ++ * for anyone interested to implement RESERVE and RELEASE in terms ++ * of Posix locks. */ ++ case FORMAT_UNIT: ++ case RELEASE: ++ case RESERVE: ++ case SEND_DIAGNOSTIC: ++ // Fall through ++ ++ default: ++ unknown_cmnd: ++ fsg->data_size_from_cmnd = 0; ++ sprintf(unknown, "Unknown x%02x", fsg->cmnd[0]); ++ if ((reply = check_command(fsg, fsg->cmnd_size, ++ DATA_DIR_UNKNOWN, ~0, 0, unknown)) == 0) { ++ fsg->curlun->sense_data = SS_INVALID_COMMAND; ++ reply = -EINVAL; ++ } ++ break; ++ } ++ up_read(&fsg->filesem); ++ ++ if (reply == -EINTR || signal_pending(current)) ++ return -EINTR; ++ ++ /* Set up the single reply buffer for finish_reply() */ ++ if (reply == -EINVAL) ++ reply = 0; // Error reply length ++ if (reply >= 0 && fsg->data_dir == DATA_DIR_TO_HOST) { ++ reply = min((u32) reply, fsg->data_size_from_cmnd); ++ bh->inreq->length = reply; ++ bh->state = BUF_STATE_FULL; ++ fsg->residue -= reply; ++ } // Otherwise it's already set ++ ++ return 0; ++} ++ ++ ++/*-------------------------------------------------------------------------*/ ++ ++static int received_cbw(struct fsg_dev *fsg, struct fsg_buffhd *bh) ++{ ++ struct usb_request *req = bh->outreq; ++ struct bulk_cb_wrap *cbw = req->buf; ++ ++ /* Was this a real packet? Should it be ignored? */ ++ if (req->status || test_bit(IGNORE_BULK_OUT, &fsg->atomic_bitflags)) ++ return -EINVAL; ++ ++ /* Is the CBW valid? */ ++ if (req->actual != US_BULK_CB_WRAP_LEN || ++ cbw->Signature != cpu_to_le32( ++ US_BULK_CB_SIGN)) { ++ DBG(fsg, "invalid CBW: len %u sig 0x%x\n", ++ req->actual, ++ le32_to_cpu(cbw->Signature)); ++ ++ /* The Bulk-only spec says we MUST stall the IN endpoint ++ * (6.6.1), so it's unavoidable. It also says we must ++ * retain this state until the next reset, but there's ++ * no way to tell the controller driver it should ignore ++ * Clear-Feature(HALT) requests. ++ * ++ * We aren't required to halt the OUT endpoint; instead ++ * we can simply accept and discard any data received ++ * until the next reset. */ ++ wedge_bulk_in_endpoint(fsg); ++ set_bit(IGNORE_BULK_OUT, &fsg->atomic_bitflags); ++ return -EINVAL; ++ } ++ ++ /* Is the CBW meaningful? */ ++ if (cbw->Lun >= FSG_MAX_LUNS || cbw->Flags & ~US_BULK_FLAG_IN || ++ cbw->Length <= 0 || cbw->Length > MAX_COMMAND_SIZE) { ++ DBG(fsg, "non-meaningful CBW: lun = %u, flags = 0x%x, " ++ "cmdlen %u\n", ++ cbw->Lun, cbw->Flags, cbw->Length); ++ ++ /* We can do anything we want here, so let's stall the ++ * bulk pipes if we are allowed to. */ ++ if (mod_data.can_stall) { ++ fsg_set_halt(fsg, fsg->bulk_out); ++ halt_bulk_in_endpoint(fsg); ++ } ++ return -EINVAL; ++ } ++ ++ /* Save the command for later */ ++ fsg->cmnd_size = cbw->Length; ++ memcpy(fsg->cmnd, cbw->CDB, fsg->cmnd_size); ++ if (cbw->Flags & US_BULK_FLAG_IN) ++ fsg->data_dir = DATA_DIR_TO_HOST; ++ else ++ fsg->data_dir = DATA_DIR_FROM_HOST; ++ fsg->data_size = le32_to_cpu(cbw->DataTransferLength); ++ if (fsg->data_size == 0) ++ fsg->data_dir = DATA_DIR_NONE; ++ fsg->lun = cbw->Lun; ++ fsg->tag = cbw->Tag; ++ return 0; ++} ++ ++ ++static int get_next_command(struct fsg_dev *fsg) ++{ ++ struct fsg_buffhd *bh; ++ int rc = 0; ++ ++ if (transport_is_bbb()) { ++ ++ /* Wait for the next buffer to become available */ ++ bh = fsg->next_buffhd_to_fill; ++ while (bh->state != BUF_STATE_EMPTY) { ++ rc = sleep_thread(fsg); ++ if (rc) ++ return rc; ++ } ++ ++ /* Queue a request to read a Bulk-only CBW */ ++ set_bulk_out_req_length(fsg, bh, US_BULK_CB_WRAP_LEN); ++ start_transfer(fsg, fsg->bulk_out, bh->outreq, ++ &bh->outreq_busy, &bh->state); ++ ++ /* We will drain the buffer in software, which means we ++ * can reuse it for the next filling. No need to advance ++ * next_buffhd_to_fill. */ ++ ++ /* Wait for the CBW to arrive */ ++ while (bh->state != BUF_STATE_FULL) { ++ rc = sleep_thread(fsg); ++ if (rc) ++ return rc; ++ } ++ smp_rmb(); ++ rc = received_cbw(fsg, bh); ++ bh->state = BUF_STATE_EMPTY; ++ ++ } else { // USB_PR_CB or USB_PR_CBI ++ ++ /* Wait for the next command to arrive */ ++ while (fsg->cbbuf_cmnd_size == 0) { ++ rc = sleep_thread(fsg); ++ if (rc) ++ return rc; ++ } ++ ++ /* Is the previous status interrupt request still busy? ++ * The host is allowed to skip reading the status, ++ * so we must cancel it. */ ++ if (fsg->intreq_busy) ++ usb_ep_dequeue(fsg->intr_in, fsg->intreq); ++ ++ /* Copy the command and mark the buffer empty */ ++ fsg->data_dir = DATA_DIR_UNKNOWN; ++ spin_lock_irq(&fsg->lock); ++ fsg->cmnd_size = fsg->cbbuf_cmnd_size; ++ memcpy(fsg->cmnd, fsg->cbbuf_cmnd, fsg->cmnd_size); ++ fsg->cbbuf_cmnd_size = 0; ++ spin_unlock_irq(&fsg->lock); ++ ++ /* Use LUN from the command */ ++ fsg->lun = fsg->cmnd[1] >> 5; ++ } ++ ++ /* Update current lun */ ++ if (fsg->lun >= 0 && fsg->lun < fsg->nluns) ++ fsg->curlun = &fsg->luns[fsg->lun]; ++ else ++ fsg->curlun = NULL; ++ ++ return rc; ++} ++ ++ ++/*-------------------------------------------------------------------------*/ ++ ++static int enable_endpoint(struct fsg_dev *fsg, struct usb_ep *ep, ++ const struct usb_endpoint_descriptor *d) ++{ ++ int rc; ++ ++ ep->driver_data = fsg; ++ ep->desc = d; ++ rc = usb_ep_enable(ep); ++ if (rc) ++ ERROR(fsg, "can't enable %s, result %d\n", ep->name, rc); ++ return rc; ++} ++ ++static int alloc_request(struct fsg_dev *fsg, struct usb_ep *ep, ++ struct usb_request **preq) ++{ ++ *preq = usb_ep_alloc_request(ep, GFP_ATOMIC); ++ if (*preq) ++ return 0; ++ ERROR(fsg, "can't allocate request for %s\n", ep->name); ++ return -ENOMEM; ++} ++ ++/* ++ * Reset interface setting and re-init endpoint state (toggle etc). ++ * Call with altsetting < 0 to disable the interface. The only other ++ * available altsetting is 0, which enables the interface. ++ */ ++static int do_set_interface(struct fsg_dev *fsg, int altsetting) ++{ ++ int rc = 0; ++ int i; ++ const struct usb_endpoint_descriptor *d; ++ ++ if (fsg->running) ++ DBG(fsg, "reset interface\n"); ++ ++reset: ++ /* Deallocate the requests */ ++ for (i = 0; i < fsg_num_buffers; ++i) { ++ struct fsg_buffhd *bh = &fsg->buffhds[i]; ++ ++ if (bh->inreq) { ++ usb_ep_free_request(fsg->bulk_in, bh->inreq); ++ bh->inreq = NULL; ++ } ++ if (bh->outreq) { ++ usb_ep_free_request(fsg->bulk_out, bh->outreq); ++ bh->outreq = NULL; ++ } ++ } ++ if (fsg->intreq) { ++ usb_ep_free_request(fsg->intr_in, fsg->intreq); ++ fsg->intreq = NULL; ++ } ++ ++ /* Disable the endpoints */ ++ if (fsg->bulk_in_enabled) { ++ usb_ep_disable(fsg->bulk_in); ++ fsg->bulk_in_enabled = 0; ++ } ++ if (fsg->bulk_out_enabled) { ++ usb_ep_disable(fsg->bulk_out); ++ fsg->bulk_out_enabled = 0; ++ } ++ if (fsg->intr_in_enabled) { ++ usb_ep_disable(fsg->intr_in); ++ fsg->intr_in_enabled = 0; ++ } ++ ++ fsg->running = 0; ++ if (altsetting < 0 || rc != 0) ++ return rc; ++ ++ DBG(fsg, "set interface %d\n", altsetting); ++ ++ /* Enable the endpoints */ ++ d = fsg_ep_desc(fsg->gadget, ++ &fsg_fs_bulk_in_desc, &fsg_hs_bulk_in_desc, ++ &fsg_ss_bulk_in_desc); ++ if ((rc = enable_endpoint(fsg, fsg->bulk_in, d)) != 0) ++ goto reset; ++ fsg->bulk_in_enabled = 1; ++ ++ d = fsg_ep_desc(fsg->gadget, ++ &fsg_fs_bulk_out_desc, &fsg_hs_bulk_out_desc, ++ &fsg_ss_bulk_out_desc); ++ if ((rc = enable_endpoint(fsg, fsg->bulk_out, d)) != 0) ++ goto reset; ++ fsg->bulk_out_enabled = 1; ++ fsg->bulk_out_maxpacket = usb_endpoint_maxp(d); ++ clear_bit(IGNORE_BULK_OUT, &fsg->atomic_bitflags); ++ ++ if (transport_is_cbi()) { ++ d = fsg_ep_desc(fsg->gadget, ++ &fsg_fs_intr_in_desc, &fsg_hs_intr_in_desc, ++ &fsg_ss_intr_in_desc); ++ if ((rc = enable_endpoint(fsg, fsg->intr_in, d)) != 0) ++ goto reset; ++ fsg->intr_in_enabled = 1; ++ } ++ ++ /* Allocate the requests */ ++ for (i = 0; i < fsg_num_buffers; ++i) { ++ struct fsg_buffhd *bh = &fsg->buffhds[i]; ++ ++ if ((rc = alloc_request(fsg, fsg->bulk_in, &bh->inreq)) != 0) ++ goto reset; ++ if ((rc = alloc_request(fsg, fsg->bulk_out, &bh->outreq)) != 0) ++ goto reset; ++ bh->inreq->buf = bh->outreq->buf = bh->buf; ++ bh->inreq->context = bh->outreq->context = bh; ++ bh->inreq->complete = bulk_in_complete; ++ bh->outreq->complete = bulk_out_complete; ++ } ++ if (transport_is_cbi()) { ++ if ((rc = alloc_request(fsg, fsg->intr_in, &fsg->intreq)) != 0) ++ goto reset; ++ fsg->intreq->complete = intr_in_complete; ++ } ++ ++ fsg->running = 1; ++ for (i = 0; i < fsg->nluns; ++i) ++ fsg->luns[i].unit_attention_data = SS_RESET_OCCURRED; ++ return rc; ++} ++ ++ ++/* ++ * Change our operational configuration. This code must agree with the code ++ * that returns config descriptors, and with interface altsetting code. ++ * ++ * It's also responsible for power management interactions. Some ++ * configurations might not work with our current power sources. ++ * For now we just assume the gadget is always self-powered. ++ */ ++static int do_set_config(struct fsg_dev *fsg, u8 new_config) ++{ ++ int rc = 0; ++ ++ /* Disable the single interface */ ++ if (fsg->config != 0) { ++ DBG(fsg, "reset config\n"); ++ fsg->config = 0; ++ rc = do_set_interface(fsg, -1); ++ } ++ ++ /* Enable the interface */ ++ if (new_config != 0) { ++ fsg->config = new_config; ++ if ((rc = do_set_interface(fsg, 0)) != 0) ++ fsg->config = 0; // Reset on errors ++ else ++ INFO(fsg, "%s config #%d\n", ++ usb_speed_string(fsg->gadget->speed), ++ fsg->config); ++ } ++ return rc; ++} ++ ++ ++/*-------------------------------------------------------------------------*/ ++ ++static void handle_exception(struct fsg_dev *fsg) ++{ ++ siginfo_t info; ++ int sig; ++ int i; ++ int num_active; ++ struct fsg_buffhd *bh; ++ enum fsg_state old_state; ++ u8 new_config; ++ struct fsg_lun *curlun; ++ unsigned int exception_req_tag; ++ int rc; ++ ++ /* Clear the existing signals. Anything but SIGUSR1 is converted ++ * into a high-priority EXIT exception. */ ++ for (;;) { ++ sig = dequeue_signal_lock(current, &current->blocked, &info); ++ if (!sig) ++ break; ++ if (sig != SIGUSR1) { ++ if (fsg->state < FSG_STATE_EXIT) ++ DBG(fsg, "Main thread exiting on signal\n"); ++ raise_exception(fsg, FSG_STATE_EXIT); ++ } ++ } ++ ++ /* Cancel all the pending transfers */ ++ if (fsg->intreq_busy) ++ usb_ep_dequeue(fsg->intr_in, fsg->intreq); ++ for (i = 0; i < fsg_num_buffers; ++i) { ++ bh = &fsg->buffhds[i]; ++ if (bh->inreq_busy) ++ usb_ep_dequeue(fsg->bulk_in, bh->inreq); ++ if (bh->outreq_busy) ++ usb_ep_dequeue(fsg->bulk_out, bh->outreq); ++ } ++ ++ /* Wait until everything is idle */ ++ for (;;) { ++ num_active = fsg->intreq_busy; ++ for (i = 0; i < fsg_num_buffers; ++i) { ++ bh = &fsg->buffhds[i]; ++ num_active += bh->inreq_busy + bh->outreq_busy; ++ } ++ if (num_active == 0) ++ break; ++ if (sleep_thread(fsg)) ++ return; ++ } ++ ++ /* Clear out the controller's fifos */ ++ if (fsg->bulk_in_enabled) ++ usb_ep_fifo_flush(fsg->bulk_in); ++ if (fsg->bulk_out_enabled) ++ usb_ep_fifo_flush(fsg->bulk_out); ++ if (fsg->intr_in_enabled) ++ usb_ep_fifo_flush(fsg->intr_in); ++ ++ /* Reset the I/O buffer states and pointers, the SCSI ++ * state, and the exception. Then invoke the handler. */ ++ spin_lock_irq(&fsg->lock); ++ ++ for (i = 0; i < fsg_num_buffers; ++i) { ++ bh = &fsg->buffhds[i]; ++ bh->state = BUF_STATE_EMPTY; ++ } ++ fsg->next_buffhd_to_fill = fsg->next_buffhd_to_drain = ++ &fsg->buffhds[0]; ++ ++ exception_req_tag = fsg->exception_req_tag; ++ new_config = fsg->new_config; ++ old_state = fsg->state; ++ ++ if (old_state == FSG_STATE_ABORT_BULK_OUT) ++ fsg->state = FSG_STATE_STATUS_PHASE; ++ else { ++ for (i = 0; i < fsg->nluns; ++i) { ++ curlun = &fsg->luns[i]; ++ curlun->prevent_medium_removal = 0; ++ curlun->sense_data = curlun->unit_attention_data = ++ SS_NO_SENSE; ++ curlun->sense_data_info = 0; ++ curlun->info_valid = 0; ++ } ++ fsg->state = FSG_STATE_IDLE; ++ } ++ spin_unlock_irq(&fsg->lock); ++ ++ /* Carry out any extra actions required for the exception */ ++ switch (old_state) { ++ default: ++ break; ++ ++ case FSG_STATE_ABORT_BULK_OUT: ++ send_status(fsg); ++ spin_lock_irq(&fsg->lock); ++ if (fsg->state == FSG_STATE_STATUS_PHASE) ++ fsg->state = FSG_STATE_IDLE; ++ spin_unlock_irq(&fsg->lock); ++ break; ++ ++ case FSG_STATE_RESET: ++ /* In case we were forced against our will to halt a ++ * bulk endpoint, clear the halt now. (The SuperH UDC ++ * requires this.) */ ++ if (test_and_clear_bit(IGNORE_BULK_OUT, &fsg->atomic_bitflags)) ++ usb_ep_clear_halt(fsg->bulk_in); ++ ++ if (transport_is_bbb()) { ++ if (fsg->ep0_req_tag == exception_req_tag) ++ ep0_queue(fsg); // Complete the status stage ++ ++ } else if (transport_is_cbi()) ++ send_status(fsg); // Status by interrupt pipe ++ ++ /* Technically this should go here, but it would only be ++ * a waste of time. Ditto for the INTERFACE_CHANGE and ++ * CONFIG_CHANGE cases. */ ++ // for (i = 0; i < fsg->nluns; ++i) ++ // fsg->luns[i].unit_attention_data = SS_RESET_OCCURRED; ++ break; ++ ++ case FSG_STATE_INTERFACE_CHANGE: ++ rc = do_set_interface(fsg, 0); ++ if (fsg->ep0_req_tag != exception_req_tag) ++ break; ++ if (rc != 0) // STALL on errors ++ fsg_set_halt(fsg, fsg->ep0); ++ else // Complete the status stage ++ ep0_queue(fsg); ++ break; ++ ++ case FSG_STATE_CONFIG_CHANGE: ++ rc = do_set_config(fsg, new_config); ++ if (fsg->ep0_req_tag != exception_req_tag) ++ break; ++ if (rc != 0) // STALL on errors ++ fsg_set_halt(fsg, fsg->ep0); ++ else // Complete the status stage ++ ep0_queue(fsg); ++ break; ++ ++ case FSG_STATE_DISCONNECT: ++ for (i = 0; i < fsg->nluns; ++i) ++ fsg_lun_fsync_sub(fsg->luns + i); ++ do_set_config(fsg, 0); // Unconfigured state ++ break; ++ ++ case FSG_STATE_EXIT: ++ case FSG_STATE_TERMINATED: ++ do_set_config(fsg, 0); // Free resources ++ spin_lock_irq(&fsg->lock); ++ fsg->state = FSG_STATE_TERMINATED; // Stop the thread ++ spin_unlock_irq(&fsg->lock); ++ break; ++ } ++} ++ ++ ++/*-------------------------------------------------------------------------*/ ++ ++static int fsg_main_thread(void *fsg_) ++{ ++ struct fsg_dev *fsg = fsg_; ++ ++ /* Allow the thread to be killed by a signal, but set the signal mask ++ * to block everything but INT, TERM, KILL, and USR1. */ ++ allow_signal(SIGINT); ++ allow_signal(SIGTERM); ++ allow_signal(SIGKILL); ++ allow_signal(SIGUSR1); ++ ++ /* Allow the thread to be frozen */ ++ set_freezable(); ++ ++ /* Arrange for userspace references to be interpreted as kernel ++ * pointers. That way we can pass a kernel pointer to a routine ++ * that expects a __user pointer and it will work okay. */ ++ set_fs(get_ds()); ++ ++ /* The main loop */ ++ while (fsg->state != FSG_STATE_TERMINATED) { ++ if (exception_in_progress(fsg) || signal_pending(current)) { ++ handle_exception(fsg); ++ continue; ++ } ++ ++ if (!fsg->running) { ++ sleep_thread(fsg); ++ continue; ++ } ++ ++ if (get_next_command(fsg)) ++ continue; ++ ++ spin_lock_irq(&fsg->lock); ++ if (!exception_in_progress(fsg)) ++ fsg->state = FSG_STATE_DATA_PHASE; ++ spin_unlock_irq(&fsg->lock); ++ ++ if (do_scsi_command(fsg) || finish_reply(fsg)) ++ continue; ++ ++ spin_lock_irq(&fsg->lock); ++ if (!exception_in_progress(fsg)) ++ fsg->state = FSG_STATE_STATUS_PHASE; ++ spin_unlock_irq(&fsg->lock); ++ ++ if (send_status(fsg)) ++ continue; ++ ++ spin_lock_irq(&fsg->lock); ++ if (!exception_in_progress(fsg)) ++ fsg->state = FSG_STATE_IDLE; ++ spin_unlock_irq(&fsg->lock); ++ } ++ ++ spin_lock_irq(&fsg->lock); ++ fsg->thread_task = NULL; ++ spin_unlock_irq(&fsg->lock); ++ ++ /* If we are exiting because of a signal, unregister the ++ * gadget driver. */ ++ if (test_and_clear_bit(REGISTERED, &fsg->atomic_bitflags)) ++ usb_gadget_unregister_driver(&fsg_driver); ++ ++ /* Let the unbind and cleanup routines know the thread has exited */ ++ complete_and_exit(&fsg->thread_notifier, 0); ++} ++ ++ ++/*-------------------------------------------------------------------------*/ ++ ++ ++/* The write permissions and store_xxx pointers are set in fsg_bind() */ ++static DEVICE_ATTR(ro, 0444, fsg_show_ro, NULL); ++static DEVICE_ATTR(nofua, 0644, fsg_show_nofua, NULL); ++static DEVICE_ATTR(file, 0444, fsg_show_file, NULL); ++ ++ ++/*-------------------------------------------------------------------------*/ ++ ++static void fsg_release(struct kref *ref) ++{ ++ struct fsg_dev *fsg = container_of(ref, struct fsg_dev, ref); ++ ++ kfree(fsg->luns); ++ kfree(fsg); ++} ++ ++static void lun_release(struct device *dev) ++{ ++ struct rw_semaphore *filesem = dev_get_drvdata(dev); ++ struct fsg_dev *fsg = ++ container_of(filesem, struct fsg_dev, filesem); ++ ++ kref_put(&fsg->ref, fsg_release); ++} ++ ++static void /* __init_or_exit */ fsg_unbind(struct usb_gadget *gadget) ++{ ++ struct fsg_dev *fsg = get_gadget_data(gadget); ++ int i; ++ struct fsg_lun *curlun; ++ struct usb_request *req = fsg->ep0req; ++ ++ DBG(fsg, "unbind\n"); ++ clear_bit(REGISTERED, &fsg->atomic_bitflags); ++ ++ /* If the thread isn't already dead, tell it to exit now */ ++ if (fsg->state != FSG_STATE_TERMINATED) { ++ raise_exception(fsg, FSG_STATE_EXIT); ++ wait_for_completion(&fsg->thread_notifier); ++ ++ /* The cleanup routine waits for this completion also */ ++ complete(&fsg->thread_notifier); ++ } ++ ++ /* Unregister the sysfs attribute files and the LUNs */ ++ for (i = 0; i < fsg->nluns; ++i) { ++ curlun = &fsg->luns[i]; ++ if (curlun->registered) { ++ device_remove_file(&curlun->dev, &dev_attr_nofua); ++ device_remove_file(&curlun->dev, &dev_attr_ro); ++ device_remove_file(&curlun->dev, &dev_attr_file); ++ fsg_lun_close(curlun); ++ device_unregister(&curlun->dev); ++ curlun->registered = 0; ++ } ++ } ++ ++ /* Free the data buffers */ ++ for (i = 0; i < fsg_num_buffers; ++i) ++ kfree(fsg->buffhds[i].buf); ++ ++ /* Free the request and buffer for endpoint 0 */ ++ if (req) { ++ kfree(req->buf); ++ usb_ep_free_request(fsg->ep0, req); ++ } ++ ++ set_gadget_data(gadget, NULL); ++} ++ ++ ++static int __init check_parameters(struct fsg_dev *fsg) ++{ ++ int prot; ++ int gcnum; ++ ++ /* Store the default values */ ++ mod_data.transport_type = USB_PR_BULK; ++ mod_data.transport_name = "Bulk-only"; ++ mod_data.protocol_type = USB_SC_SCSI; ++ mod_data.protocol_name = "Transparent SCSI"; ++ ++ /* Some peripheral controllers are known not to be able to ++ * halt bulk endpoints correctly. If one of them is present, ++ * disable stalls. ++ */ ++ if (gadget_is_at91(fsg->gadget)) ++ mod_data.can_stall = 0; ++ ++ if (mod_data.release == 0xffff) { // Parameter wasn't set ++ gcnum = usb_gadget_controller_number(fsg->gadget); ++ if (gcnum >= 0) ++ mod_data.release = 0x0300 + gcnum; ++ else { ++ WARNING(fsg, "controller '%s' not recognized\n", ++ fsg->gadget->name); ++ mod_data.release = 0x0399; ++ } ++ } ++ ++ prot = simple_strtol(mod_data.protocol_parm, NULL, 0); ++ ++#ifdef CONFIG_USB_FILE_STORAGE_TEST ++ if (strnicmp(mod_data.transport_parm, "BBB", 10) == 0) { ++ ; // Use default setting ++ } else if (strnicmp(mod_data.transport_parm, "CB", 10) == 0) { ++ mod_data.transport_type = USB_PR_CB; ++ mod_data.transport_name = "Control-Bulk"; ++ } else if (strnicmp(mod_data.transport_parm, "CBI", 10) == 0) { ++ mod_data.transport_type = USB_PR_CBI; ++ mod_data.transport_name = "Control-Bulk-Interrupt"; ++ } else { ++ ERROR(fsg, "invalid transport: %s\n", mod_data.transport_parm); ++ return -EINVAL; ++ } ++ ++ if (strnicmp(mod_data.protocol_parm, "SCSI", 10) == 0 || ++ prot == USB_SC_SCSI) { ++ ; // Use default setting ++ } else if (strnicmp(mod_data.protocol_parm, "RBC", 10) == 0 || ++ prot == USB_SC_RBC) { ++ mod_data.protocol_type = USB_SC_RBC; ++ mod_data.protocol_name = "RBC"; ++ } else if (strnicmp(mod_data.protocol_parm, "8020", 4) == 0 || ++ strnicmp(mod_data.protocol_parm, "ATAPI", 10) == 0 || ++ prot == USB_SC_8020) { ++ mod_data.protocol_type = USB_SC_8020; ++ mod_data.protocol_name = "8020i (ATAPI)"; ++ } else if (strnicmp(mod_data.protocol_parm, "QIC", 3) == 0 || ++ prot == USB_SC_QIC) { ++ mod_data.protocol_type = USB_SC_QIC; ++ mod_data.protocol_name = "QIC-157"; ++ } else if (strnicmp(mod_data.protocol_parm, "UFI", 10) == 0 || ++ prot == USB_SC_UFI) { ++ mod_data.protocol_type = USB_SC_UFI; ++ mod_data.protocol_name = "UFI"; ++ } else if (strnicmp(mod_data.protocol_parm, "8070", 4) == 0 || ++ prot == USB_SC_8070) { ++ mod_data.protocol_type = USB_SC_8070; ++ mod_data.protocol_name = "8070i"; ++ } else { ++ ERROR(fsg, "invalid protocol: %s\n", mod_data.protocol_parm); ++ return -EINVAL; ++ } ++ ++ mod_data.buflen &= PAGE_CACHE_MASK; ++ if (mod_data.buflen <= 0) { ++ ERROR(fsg, "invalid buflen\n"); ++ return -ETOOSMALL; ++ } ++ ++#endif /* CONFIG_USB_FILE_STORAGE_TEST */ ++ ++ /* Serial string handling. ++ * On a real device, the serial string would be loaded ++ * from permanent storage. */ ++ if (mod_data.serial) { ++ const char *ch; ++ unsigned len = 0; ++ ++ /* Sanity check : ++ * The CB[I] specification limits the serial string to ++ * 12 uppercase hexadecimal characters. ++ * BBB need at least 12 uppercase hexadecimal characters, ++ * with a maximum of 126. */ ++ for (ch = mod_data.serial; *ch; ++ch) { ++ ++len; ++ if ((*ch < '0' || *ch > '9') && ++ (*ch < 'A' || *ch > 'F')) { /* not uppercase hex */ ++ WARNING(fsg, ++ "Invalid serial string character: %c\n", ++ *ch); ++ goto no_serial; ++ } ++ } ++ if (len > 126 || ++ (mod_data.transport_type == USB_PR_BULK && len < 12) || ++ (mod_data.transport_type != USB_PR_BULK && len > 12)) { ++ WARNING(fsg, "Invalid serial string length!\n"); ++ goto no_serial; ++ } ++ fsg_strings[FSG_STRING_SERIAL - 1].s = mod_data.serial; ++ } else { ++ WARNING(fsg, "No serial-number string provided!\n"); ++ no_serial: ++ device_desc.iSerialNumber = 0; ++ } ++ ++ return 0; ++} ++ ++ ++static int __init fsg_bind(struct usb_gadget *gadget) ++{ ++ struct fsg_dev *fsg = the_fsg; ++ int rc; ++ int i; ++ struct fsg_lun *curlun; ++ struct usb_ep *ep; ++ struct usb_request *req; ++ char *pathbuf, *p; ++ ++ fsg->gadget = gadget; ++ set_gadget_data(gadget, fsg); ++ fsg->ep0 = gadget->ep0; ++ fsg->ep0->driver_data = fsg; ++ ++ if ((rc = check_parameters(fsg)) != 0) ++ goto out; ++ ++ if (mod_data.removable) { // Enable the store_xxx attributes ++ dev_attr_file.attr.mode = 0644; ++ dev_attr_file.store = fsg_store_file; ++ if (!mod_data.cdrom) { ++ dev_attr_ro.attr.mode = 0644; ++ dev_attr_ro.store = fsg_store_ro; ++ } ++ } ++ ++ /* Only for removable media? */ ++ dev_attr_nofua.attr.mode = 0644; ++ dev_attr_nofua.store = fsg_store_nofua; ++ ++ /* Find out how many LUNs there should be */ ++ i = mod_data.nluns; ++ if (i == 0) ++ i = max(mod_data.num_filenames, 1u); ++ if (i > FSG_MAX_LUNS) { ++ ERROR(fsg, "invalid number of LUNs: %d\n", i); ++ rc = -EINVAL; ++ goto out; ++ } ++ ++ /* Create the LUNs, open their backing files, and register the ++ * LUN devices in sysfs. */ ++ fsg->luns = kzalloc(i * sizeof(struct fsg_lun), GFP_KERNEL); ++ if (!fsg->luns) { ++ rc = -ENOMEM; ++ goto out; ++ } ++ fsg->nluns = i; ++ ++ for (i = 0; i < fsg->nluns; ++i) { ++ curlun = &fsg->luns[i]; ++ curlun->cdrom = !!mod_data.cdrom; ++ curlun->ro = mod_data.cdrom || mod_data.ro[i]; ++ curlun->initially_ro = curlun->ro; ++ curlun->removable = mod_data.removable; ++ curlun->nofua = mod_data.nofua[i]; ++ curlun->dev.release = lun_release; ++ curlun->dev.parent = &gadget->dev; ++ curlun->dev.driver = &fsg_driver.driver; ++ dev_set_drvdata(&curlun->dev, &fsg->filesem); ++ dev_set_name(&curlun->dev,"%s-lun%d", ++ dev_name(&gadget->dev), i); ++ ++ kref_get(&fsg->ref); ++ rc = device_register(&curlun->dev); ++ if (rc) { ++ INFO(fsg, "failed to register LUN%d: %d\n", i, rc); ++ put_device(&curlun->dev); ++ goto out; ++ } ++ curlun->registered = 1; ++ ++ rc = device_create_file(&curlun->dev, &dev_attr_ro); ++ if (rc) ++ goto out; ++ rc = device_create_file(&curlun->dev, &dev_attr_nofua); ++ if (rc) ++ goto out; ++ rc = device_create_file(&curlun->dev, &dev_attr_file); ++ if (rc) ++ goto out; ++ ++ if (mod_data.file[i] && *mod_data.file[i]) { ++ rc = fsg_lun_open(curlun, mod_data.file[i]); ++ if (rc) ++ goto out; ++ } else if (!mod_data.removable) { ++ ERROR(fsg, "no file given for LUN%d\n", i); ++ rc = -EINVAL; ++ goto out; ++ } ++ } ++ ++ /* Find all the endpoints we will use */ ++ usb_ep_autoconfig_reset(gadget); ++ ep = usb_ep_autoconfig(gadget, &fsg_fs_bulk_in_desc); ++ if (!ep) ++ goto autoconf_fail; ++ ep->driver_data = fsg; // claim the endpoint ++ fsg->bulk_in = ep; ++ ++ ep = usb_ep_autoconfig(gadget, &fsg_fs_bulk_out_desc); ++ if (!ep) ++ goto autoconf_fail; ++ ep->driver_data = fsg; // claim the endpoint ++ fsg->bulk_out = ep; ++ ++ if (transport_is_cbi()) { ++ ep = usb_ep_autoconfig(gadget, &fsg_fs_intr_in_desc); ++ if (!ep) ++ goto autoconf_fail; ++ ep->driver_data = fsg; // claim the endpoint ++ fsg->intr_in = ep; ++ } ++ ++ /* Fix up the descriptors */ ++ device_desc.idVendor = cpu_to_le16(mod_data.vendor); ++ device_desc.idProduct = cpu_to_le16(mod_data.product); ++ device_desc.bcdDevice = cpu_to_le16(mod_data.release); ++ ++ i = (transport_is_cbi() ? 3 : 2); // Number of endpoints ++ fsg_intf_desc.bNumEndpoints = i; ++ fsg_intf_desc.bInterfaceSubClass = mod_data.protocol_type; ++ fsg_intf_desc.bInterfaceProtocol = mod_data.transport_type; ++ fsg_fs_function[i + FSG_FS_FUNCTION_PRE_EP_ENTRIES] = NULL; ++ ++ if (gadget_is_dualspeed(gadget)) { ++ fsg_hs_function[i + FSG_HS_FUNCTION_PRE_EP_ENTRIES] = NULL; ++ ++ /* Assume endpoint addresses are the same for both speeds */ ++ fsg_hs_bulk_in_desc.bEndpointAddress = ++ fsg_fs_bulk_in_desc.bEndpointAddress; ++ fsg_hs_bulk_out_desc.bEndpointAddress = ++ fsg_fs_bulk_out_desc.bEndpointAddress; ++ fsg_hs_intr_in_desc.bEndpointAddress = ++ fsg_fs_intr_in_desc.bEndpointAddress; ++ } ++ ++ if (gadget_is_superspeed(gadget)) { ++ unsigned max_burst; ++ ++ fsg_ss_function[i + FSG_SS_FUNCTION_PRE_EP_ENTRIES] = NULL; ++ ++ /* Calculate bMaxBurst, we know packet size is 1024 */ ++ max_burst = min_t(unsigned, mod_data.buflen / 1024, 15); ++ ++ /* Assume endpoint addresses are the same for both speeds */ ++ fsg_ss_bulk_in_desc.bEndpointAddress = ++ fsg_fs_bulk_in_desc.bEndpointAddress; ++ fsg_ss_bulk_in_comp_desc.bMaxBurst = max_burst; ++ ++ fsg_ss_bulk_out_desc.bEndpointAddress = ++ fsg_fs_bulk_out_desc.bEndpointAddress; ++ fsg_ss_bulk_out_comp_desc.bMaxBurst = max_burst; ++ } ++ ++ if (gadget_is_otg(gadget)) ++ fsg_otg_desc.bmAttributes |= USB_OTG_HNP; ++ ++ rc = -ENOMEM; ++ ++ /* Allocate the request and buffer for endpoint 0 */ ++ fsg->ep0req = req = usb_ep_alloc_request(fsg->ep0, GFP_KERNEL); ++ if (!req) ++ goto out; ++ req->buf = kmalloc(EP0_BUFSIZE, GFP_KERNEL); ++ if (!req->buf) ++ goto out; ++ req->complete = ep0_complete; ++ ++ /* Allocate the data buffers */ ++ for (i = 0; i < fsg_num_buffers; ++i) { ++ struct fsg_buffhd *bh = &fsg->buffhds[i]; ++ ++ /* Allocate for the bulk-in endpoint. We assume that ++ * the buffer will also work with the bulk-out (and ++ * interrupt-in) endpoint. */ ++ bh->buf = kmalloc(mod_data.buflen, GFP_KERNEL); ++ if (!bh->buf) ++ goto out; ++ bh->next = bh + 1; ++ } ++ fsg->buffhds[fsg_num_buffers - 1].next = &fsg->buffhds[0]; ++ ++ /* This should reflect the actual gadget power source */ ++ usb_gadget_set_selfpowered(gadget); ++ ++ snprintf(fsg_string_manufacturer, sizeof fsg_string_manufacturer, ++ "%s %s with %s", ++ init_utsname()->sysname, init_utsname()->release, ++ gadget->name); ++ ++ fsg->thread_task = kthread_create(fsg_main_thread, fsg, ++ "file-storage-gadget"); ++ if (IS_ERR(fsg->thread_task)) { ++ rc = PTR_ERR(fsg->thread_task); ++ goto out; ++ } ++ ++ INFO(fsg, DRIVER_DESC ", version: " DRIVER_VERSION "\n"); ++ INFO(fsg, "NOTE: This driver is deprecated. " ++ "Consider using g_mass_storage instead.\n"); ++ INFO(fsg, "Number of LUNs=%d\n", fsg->nluns); ++ ++ pathbuf = kmalloc(PATH_MAX, GFP_KERNEL); ++ for (i = 0; i < fsg->nluns; ++i) { ++ curlun = &fsg->luns[i]; ++ if (fsg_lun_is_open(curlun)) { ++ p = NULL; ++ if (pathbuf) { ++ p = d_path(&curlun->filp->f_path, ++ pathbuf, PATH_MAX); ++ if (IS_ERR(p)) ++ p = NULL; ++ } ++ LINFO(curlun, "ro=%d, nofua=%d, file: %s\n", ++ curlun->ro, curlun->nofua, (p ? p : "(error)")); ++ } ++ } ++ kfree(pathbuf); ++ ++ DBG(fsg, "transport=%s (x%02x)\n", ++ mod_data.transport_name, mod_data.transport_type); ++ DBG(fsg, "protocol=%s (x%02x)\n", ++ mod_data.protocol_name, mod_data.protocol_type); ++ DBG(fsg, "VendorID=x%04x, ProductID=x%04x, Release=x%04x\n", ++ mod_data.vendor, mod_data.product, mod_data.release); ++ DBG(fsg, "removable=%d, stall=%d, cdrom=%d, buflen=%u\n", ++ mod_data.removable, mod_data.can_stall, ++ mod_data.cdrom, mod_data.buflen); ++ DBG(fsg, "I/O thread pid: %d\n", task_pid_nr(fsg->thread_task)); ++ ++ set_bit(REGISTERED, &fsg->atomic_bitflags); ++ ++ /* Tell the thread to start working */ ++ wake_up_process(fsg->thread_task); ++ return 0; ++ ++autoconf_fail: ++ ERROR(fsg, "unable to autoconfigure all endpoints\n"); ++ rc = -ENOTSUPP; ++ ++out: ++ fsg->state = FSG_STATE_TERMINATED; // The thread is dead ++ fsg_unbind(gadget); ++ complete(&fsg->thread_notifier); ++ return rc; ++} ++ ++ ++/*-------------------------------------------------------------------------*/ ++ ++static void fsg_suspend(struct usb_gadget *gadget) ++{ ++ struct fsg_dev *fsg = get_gadget_data(gadget); ++ ++ DBG(fsg, "suspend\n"); ++ set_bit(SUSPENDED, &fsg->atomic_bitflags); ++} ++ ++static void fsg_resume(struct usb_gadget *gadget) ++{ ++ struct fsg_dev *fsg = get_gadget_data(gadget); ++ ++ DBG(fsg, "resume\n"); ++ clear_bit(SUSPENDED, &fsg->atomic_bitflags); ++} ++ ++ ++/*-------------------------------------------------------------------------*/ ++ ++static struct usb_gadget_driver fsg_driver = { ++ .max_speed = USB_SPEED_SUPER, ++ .function = (char *) fsg_string_product, ++ .unbind = fsg_unbind, ++ .disconnect = fsg_disconnect, ++ .setup = fsg_setup, ++ .suspend = fsg_suspend, ++ .resume = fsg_resume, ++ ++ .driver = { ++ .name = DRIVER_NAME, ++ .owner = THIS_MODULE, ++ // .release = ... ++ // .suspend = ... ++ // .resume = ... ++ }, ++}; ++ ++ ++static int __init fsg_alloc(void) ++{ ++ struct fsg_dev *fsg; ++ ++ fsg = kzalloc(sizeof *fsg + ++ fsg_num_buffers * sizeof *(fsg->buffhds), GFP_KERNEL); ++ ++ if (!fsg) ++ return -ENOMEM; ++ spin_lock_init(&fsg->lock); ++ init_rwsem(&fsg->filesem); ++ kref_init(&fsg->ref); ++ init_completion(&fsg->thread_notifier); ++ ++ the_fsg = fsg; ++ return 0; ++} ++ ++ ++static int __init fsg_init(void) ++{ ++ int rc; ++ struct fsg_dev *fsg; ++ ++ rc = fsg_num_buffers_validate(); ++ if (rc != 0) ++ return rc; ++ ++ if ((rc = fsg_alloc()) != 0) ++ return rc; ++ fsg = the_fsg; ++ if ((rc = usb_gadget_probe_driver(&fsg_driver, fsg_bind)) != 0) ++ kref_put(&fsg->ref, fsg_release); ++ return rc; ++} ++module_init(fsg_init); ++ ++ ++static void __exit fsg_cleanup(void) ++{ ++ struct fsg_dev *fsg = the_fsg; ++ ++ /* Unregister the driver iff the thread hasn't already done so */ ++ if (test_and_clear_bit(REGISTERED, &fsg->atomic_bitflags)) ++ usb_gadget_unregister_driver(&fsg_driver); ++ ++ /* Wait for the thread to finish up */ ++ wait_for_completion(&fsg->thread_notifier); ++ ++ kref_put(&fsg->ref, fsg_release); ++} ++module_exit(fsg_cleanup); +diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig +index e9d4dde..867dc98 100644 +--- a/drivers/usb/host/Kconfig ++++ b/drivers/usb/host/Kconfig +@@ -753,6 +753,19 @@ config USB_HWA_HCD + To compile this driver a module, choose M here: the module + will be called "hwa-hc". + ++config USB_DWCOTG ++ tristate "Synopsis DWC host support" ++ depends on USB ++ help ++ The Synopsis DWC controller is a dual-role ++ host/peripheral/OTG ("On The Go") USB controllers. ++ ++ Enable this option to support this IP in host controller mode. ++ If unsure, say N. ++ ++ To compile this driver as a module, choose M here: the ++ modules built will be called dwc_otg and dwc_common_port. ++ + config USB_IMX21_HCD + tristate "i.MX21 HCD support" + depends on ARM && ARCH_MXC +diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile +index a9ddd3c..11d7761 100644 +--- a/drivers/usb/host/Makefile ++++ b/drivers/usb/host/Makefile +@@ -73,6 +73,8 @@ obj-$(CONFIG_USB_SL811_CS) += sl811_cs.o + obj-$(CONFIG_USB_U132_HCD) += u132-hcd.o + obj-$(CONFIG_USB_R8A66597_HCD) += r8a66597-hcd.o + obj-$(CONFIG_USB_HWA_HCD) += hwa-hc.o ++ ++obj-$(CONFIG_USB_DWCOTG) += dwc_otg/ dwc_common_port/ + obj-$(CONFIG_USB_IMX21_HCD) += imx21-hcd.o + obj-$(CONFIG_USB_FSL_USB2) += fsl-mph-dr-of.o + obj-$(CONFIG_USB_EHCI_FSL) += fsl-mph-dr-of.o +diff --git a/drivers/usb/host/dwc_common_port/Makefile b/drivers/usb/host/dwc_common_port/Makefile +new file mode 100644 +index 0000000..f10d466 +--- /dev/null ++++ b/drivers/usb/host/dwc_common_port/Makefile +@@ -0,0 +1,58 @@ ++# ++# Makefile for DWC_common library ++# ++ ++ifneq ($(KERNELRELEASE),) ++ ++ccflags-y += -DDWC_LINUX ++#ccflags-y += -DDEBUG ++#ccflags-y += -DDWC_DEBUG_REGS ++#ccflags-y += -DDWC_DEBUG_MEMORY ++ ++ccflags-y += -DDWC_LIBMODULE ++ccflags-y += -DDWC_CCLIB ++#ccflags-y += -DDWC_CRYPTOLIB ++ccflags-y += -DDWC_NOTIFYLIB ++ccflags-y += -DDWC_UTFLIB ++ ++obj-$(CONFIG_USB_DWCOTG) += dwc_common_port_lib.o ++dwc_common_port_lib-objs := dwc_cc.o dwc_modpow.o dwc_dh.o \ ++ dwc_crypto.o dwc_notifier.o \ ++ dwc_common_linux.o dwc_mem.o ++ ++kernrelwd := $(subst ., ,$(KERNELRELEASE)) ++kernrel3 := $(word 1,$(kernrelwd)).$(word 2,$(kernrelwd)).$(word 3,$(kernrelwd)) ++ ++ifneq ($(kernrel3),2.6.20) ++# grayg - I only know that we use ccflags-y in 2.6.31 actually ++ccflags-y += $(CPPFLAGS) ++endif ++ ++else ++ ++#ifeq ($(KDIR),) ++#$(error Must give "KDIR=/path/to/kernel/source" on command line or in environment) ++#endif ++ ++ifeq ($(ARCH),) ++$(error Must give "ARCH=<arch>" on command line or in environment. Also, if \ ++ cross-compiling, must give "CROSS_COMPILE=/path/to/compiler/plus/tool-prefix-") ++endif ++ ++ifeq ($(DOXYGEN),) ++DOXYGEN := doxygen ++endif ++ ++default: ++ $(MAKE) -C$(KDIR) M=$(PWD) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) modules ++ ++docs: $(wildcard *.[hc]) doc/doxygen.cfg ++ $(DOXYGEN) doc/doxygen.cfg ++ ++tags: $(wildcard *.[hc]) ++ $(CTAGS) -e $(wildcard *.[hc]) $(wildcard linux/*.[hc]) $(wildcard $(KDIR)/include/linux/usb*.h) ++ ++endif ++ ++clean: ++ rm -rf *.o *.ko .*.cmd *.mod.c .*.o.d .*.o.tmp modules.order Module.markers Module.symvers .tmp_versions/ +diff --git a/drivers/usb/host/dwc_common_port/Makefile.fbsd b/drivers/usb/host/dwc_common_port/Makefile.fbsd +new file mode 100644 +index 0000000..45db991 +--- /dev/null ++++ b/drivers/usb/host/dwc_common_port/Makefile.fbsd +@@ -0,0 +1,17 @@ ++CFLAGS += -I/sys/i386/compile/GENERIC -I/sys/i386/include -I/usr/include ++CFLAGS += -DDWC_FREEBSD ++CFLAGS += -DDEBUG ++#CFLAGS += -DDWC_DEBUG_REGS ++#CFLAGS += -DDWC_DEBUG_MEMORY ++ ++#CFLAGS += -DDWC_LIBMODULE ++#CFLAGS += -DDWC_CCLIB ++#CFLAGS += -DDWC_CRYPTOLIB ++#CFLAGS += -DDWC_NOTIFYLIB ++#CFLAGS += -DDWC_UTFLIB ++ ++KMOD = dwc_common_port_lib ++SRCS = dwc_cc.c dwc_modpow.c dwc_dh.c dwc_crypto.c dwc_notifier.c \ ++ dwc_common_fbsd.c dwc_mem.c ++ ++.include <bsd.kmod.mk> +diff --git a/drivers/usb/host/dwc_common_port/Makefile.linux b/drivers/usb/host/dwc_common_port/Makefile.linux +new file mode 100644 +index 0000000..0cef7b4 +--- /dev/null ++++ b/drivers/usb/host/dwc_common_port/Makefile.linux +@@ -0,0 +1,49 @@ ++# ++# Makefile for DWC_common library ++# ++ifneq ($(KERNELRELEASE),) ++ ++ccflags-y += -DDWC_LINUX ++#ccflags-y += -DDEBUG ++#ccflags-y += -DDWC_DEBUG_REGS ++#ccflags-y += -DDWC_DEBUG_MEMORY ++ ++ccflags-y += -DDWC_LIBMODULE ++ccflags-y += -DDWC_CCLIB ++ccflags-y += -DDWC_CRYPTOLIB ++ccflags-y += -DDWC_NOTIFYLIB ++ccflags-y += -DDWC_UTFLIB ++ ++obj-m := dwc_common_port_lib.o ++dwc_common_port_lib-objs := dwc_cc.o dwc_modpow.o dwc_dh.o \ ++ dwc_crypto.o dwc_notifier.o \ ++ dwc_common_linux.o dwc_mem.o ++ ++else ++ ++ifeq ($(KDIR),) ++$(error Must give "KDIR=/path/to/kernel/source" on command line or in environment) ++endif ++ ++ifeq ($(ARCH),) ++$(error Must give "ARCH=<arch>" on command line or in environment. Also, if \ ++ cross-compiling, must give "CROSS_COMPILE=/path/to/compiler/plus/tool-prefix-") ++endif ++ ++ifeq ($(DOXYGEN),) ++DOXYGEN := doxygen ++endif ++ ++default: ++ $(MAKE) -C$(KDIR) M=$(PWD) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) modules ++ ++docs: $(wildcard *.[hc]) doc/doxygen.cfg ++ $(DOXYGEN) doc/doxygen.cfg ++ ++tags: $(wildcard *.[hc]) ++ $(CTAGS) -e $(wildcard *.[hc]) $(wildcard linux/*.[hc]) $(wildcard $(KDIR)/include/linux/usb*.h) ++ ++endif ++ ++clean: ++ rm -rf *.o *.ko .*.cmd *.mod.c .*.o.d .*.o.tmp modules.order Module.markers Module.symvers .tmp_versions/ +diff --git a/drivers/usb/host/dwc_common_port/changes.txt b/drivers/usb/host/dwc_common_port/changes.txt +new file mode 100644 +index 0000000..f6839f9 +--- /dev/null ++++ b/drivers/usb/host/dwc_common_port/changes.txt +@@ -0,0 +1,174 @@ ++ ++dwc_read_reg32() and friends now take an additional parameter, a pointer to an ++IO context struct. The IO context struct should live in an os-dependent struct ++in your driver. As an example, the dwc_usb3 driver has an os-dependent struct ++named 'os_dep' embedded in the main device struct. So there these calls look ++like this: ++ ++ dwc_read_reg32(&usb3_dev->os_dep.ioctx, &pcd->dev_global_regs->dcfg); ++ ++ dwc_write_reg32(&usb3_dev->os_dep.ioctx, ++ &pcd->dev_global_regs->dcfg, 0); ++ ++Note that for the existing Linux driver ports, it is not necessary to actually ++define the 'ioctx' member in the os-dependent struct. Since Linux does not ++require an IO context, its macros for dwc_read_reg32() and friends do not ++use the context pointer, so it is optimized away by the compiler. But it is ++necessary to add the pointer parameter to all of the call sites, to be ready ++for any future ports (such as FreeBSD) which do require an IO context. ++ ++ ++Similarly, dwc_alloc(), dwc_alloc_atomic(), dwc_strdup(), and dwc_free() now ++take an additional parameter, a pointer to a memory context. Examples: ++ ++ addr = dwc_alloc(&usb3_dev->os_dep.memctx, size); ++ ++ dwc_free(&usb3_dev->os_dep.memctx, addr); ++ ++Again, for the Linux ports, it is not necessary to actually define the memctx ++member, but it is necessary to add the pointer parameter to all of the call ++sites. ++ ++ ++Same for dwc_dma_alloc() and dwc_dma_free(). Examples: ++ ++ virt_addr = dwc_dma_alloc(&usb3_dev->os_dep.dmactx, size, &phys_addr); ++ ++ dwc_dma_free(&usb3_dev->os_dep.dmactx, size, virt_addr, phys_addr); ++ ++ ++Same for dwc_mutex_alloc() and dwc_mutex_free(). Examples: ++ ++ mutex = dwc_mutex_alloc(&usb3_dev->os_dep.mtxctx); ++ ++ dwc_mutex_free(&usb3_dev->os_dep.mtxctx, mutex); ++ ++ ++Same for dwc_spinlock_alloc() and dwc_spinlock_free(). Examples: ++ ++ lock = dwc_spinlock_alloc(&usb3_dev->osdep.splctx); ++ ++ dwc_spinlock_free(&usb3_dev->osdep.splctx, lock); ++ ++ ++Same for dwc_timer_alloc(). Example: ++ ++ timer = dwc_timer_alloc(&usb3_dev->os_dep.tmrctx, "dwc_usb3_tmr1", ++ cb_func, cb_data); ++ ++ ++Same for dwc_waitq_alloc(). Example: ++ ++ waitq = dwc_waitq_alloc(&usb3_dev->os_dep.wtqctx); ++ ++ ++Same for dwc_thread_run(). Example: ++ ++ thread = dwc_thread_run(&usb3_dev->os_dep.thdctx, func, ++ "dwc_usb3_thd1", data); ++ ++ ++Same for dwc_workq_alloc(). Example: ++ ++ workq = dwc_workq_alloc(&usb3_dev->osdep.wkqctx, "dwc_usb3_wkq1"); ++ ++ ++Same for dwc_task_alloc(). Example: ++ ++ task = dwc_task_alloc(&usb3_dev->os_dep.tskctx, "dwc_usb3_tsk1", ++ cb_func, cb_data); ++ ++ ++In addition to the context pointer additions, a few core functions have had ++other changes made to their parameters: ++ ++The 'flags' parameter to dwc_spinlock_irqsave() and dwc_spinunlock_irqrestore() ++has been changed from a uint64_t to a dwc_irqflags_t. ++ ++dwc_thread_should_stop() now takes a 'dwc_thread_t *' parameter, because the ++FreeBSD equivalent of that function requires it. ++ ++And, in addition to the context pointer, dwc_task_alloc() also adds a ++'char *name' parameter, to be consistent with dwc_thread_run() and ++dwc_workq_alloc(), and because the FreeBSD equivalent of that function ++requires a unique name. ++ ++ ++Here is a complete list of the core functions that now take a pointer to a ++context as their first parameter: ++ ++ dwc_read_reg32 ++ dwc_read_reg64 ++ dwc_write_reg32 ++ dwc_write_reg64 ++ dwc_modify_reg32 ++ dwc_modify_reg64 ++ dwc_alloc ++ dwc_alloc_atomic ++ dwc_strdup ++ dwc_free ++ dwc_dma_alloc ++ dwc_dma_free ++ dwc_mutex_alloc ++ dwc_mutex_free ++ dwc_spinlock_alloc ++ dwc_spinlock_free ++ dwc_timer_alloc ++ dwc_waitq_alloc ++ dwc_thread_run ++ dwc_workq_alloc ++ dwc_task_alloc Also adds a 'char *name' as its 2nd parameter ++ ++And here are the core functions that have other changes to their parameters: ++ ++ dwc_spinlock_irqsave 'flags' param is now a 'dwc_irqflags_t *' ++ dwc_spinunlock_irqrestore 'flags' param is now a 'dwc_irqflags_t' ++ dwc_thread_should_stop Adds a 'dwc_thread_t *' parameter ++ ++ ++ ++The changes to the core functions also require some of the other library ++functions to change: ++ ++ dwc_cc_if_alloc() and dwc_cc_if_free() now take a 'void *memctx' ++ (for memory allocation) as the 1st param and a 'void *mtxctx' ++ (for mutex allocation) as the 2nd param. ++ ++ dwc_cc_clear(), dwc_cc_add(), dwc_cc_change(), dwc_cc_remove(), ++ dwc_cc_data_for_save(), and dwc_cc_restore_from_data() now take a ++ 'void *memctx' as the 1st param. ++ ++ dwc_dh_modpow(), dwc_dh_pk(), and dwc_dh_derive_keys() now take a ++ 'void *memctx' as the 1st param. ++ ++ dwc_modpow() now takes a 'void *memctx' as the 1st param. ++ ++ dwc_alloc_notification_manager() now takes a 'void *memctx' as the ++ 1st param and a 'void *wkqctx' (for work queue allocation) as the 2nd ++ param, and also now returns an integer value that is non-zero if ++ allocation of its data structures or work queue fails. ++ ++ dwc_register_notifier() now takes a 'void *memctx' as the 1st param. ++ ++ dwc_memory_debug_start() now takes a 'void *mem_ctx' as the first ++ param, and also now returns an integer value that is non-zero if ++ allocation of its data structures fails. ++ ++ ++ ++Other miscellaneous changes: ++ ++The DEBUG_MEMORY and DEBUG_REGS #define's have been renamed to ++DWC_DEBUG_MEMORY and DWC_DEBUG_REGS. ++ ++The following #define's have been added to allow selectively compiling library ++features: ++ ++ DWC_CCLIB ++ DWC_CRYPTOLIB ++ DWC_NOTIFYLIB ++ DWC_UTFLIB ++ ++A DWC_LIBMODULE #define has also been added. If this is not defined, then the ++module code in dwc_common_linux.c is not compiled in. This allows linking the ++library code directly into a driver module, instead of as a standalone module. +diff --git a/drivers/usb/host/dwc_common_port/doc/doxygen.cfg b/drivers/usb/host/dwc_common_port/doc/doxygen.cfg +new file mode 100644 +index 0000000..89aa887 +--- /dev/null ++++ b/drivers/usb/host/dwc_common_port/doc/doxygen.cfg +@@ -0,0 +1,270 @@ ++# Doxyfile 1.4.5 ++ ++#--------------------------------------------------------------------------- ++# Project related configuration options ++#--------------------------------------------------------------------------- ++PROJECT_NAME = "Synopsys DWC Portability and Common Library for UWB" ++PROJECT_NUMBER = ++OUTPUT_DIRECTORY = doc ++CREATE_SUBDIRS = NO ++OUTPUT_LANGUAGE = English ++BRIEF_MEMBER_DESC = YES ++REPEAT_BRIEF = YES ++ABBREVIATE_BRIEF = "The $name class" \ ++ "The $name widget" \ ++ "The $name file" \ ++ is \ ++ provides \ ++ specifies \ ++ contains \ ++ represents \ ++ a \ ++ an \ ++ the ++ALWAYS_DETAILED_SEC = YES ++INLINE_INHERITED_MEMB = NO ++FULL_PATH_NAMES = NO ++STRIP_FROM_PATH = .. ++STRIP_FROM_INC_PATH = ++SHORT_NAMES = NO ++JAVADOC_AUTOBRIEF = YES ++MULTILINE_CPP_IS_BRIEF = NO ++DETAILS_AT_TOP = YES ++INHERIT_DOCS = YES ++SEPARATE_MEMBER_PAGES = NO ++TAB_SIZE = 8 ++ALIASES = ++OPTIMIZE_OUTPUT_FOR_C = YES ++OPTIMIZE_OUTPUT_JAVA = NO ++BUILTIN_STL_SUPPORT = NO ++DISTRIBUTE_GROUP_DOC = NO ++SUBGROUPING = NO ++#--------------------------------------------------------------------------- ++# Build related configuration options ++#--------------------------------------------------------------------------- ++EXTRACT_ALL = NO ++EXTRACT_PRIVATE = NO ++EXTRACT_STATIC = YES ++EXTRACT_LOCAL_CLASSES = NO ++EXTRACT_LOCAL_METHODS = NO ++HIDE_UNDOC_MEMBERS = NO ++HIDE_UNDOC_CLASSES = NO ++HIDE_FRIEND_COMPOUNDS = NO ++HIDE_IN_BODY_DOCS = NO ++INTERNAL_DOCS = NO ++CASE_SENSE_NAMES = YES ++HIDE_SCOPE_NAMES = NO ++SHOW_INCLUDE_FILES = NO ++INLINE_INFO = YES ++SORT_MEMBER_DOCS = NO ++SORT_BRIEF_DOCS = NO ++SORT_BY_SCOPE_NAME = NO ++GENERATE_TODOLIST = YES ++GENERATE_TESTLIST = YES ++GENERATE_BUGLIST = YES ++GENERATE_DEPRECATEDLIST= YES ++ENABLED_SECTIONS = ++MAX_INITIALIZER_LINES = 30 ++SHOW_USED_FILES = YES ++SHOW_DIRECTORIES = YES ++FILE_VERSION_FILTER = ++#--------------------------------------------------------------------------- ++# configuration options related to warning and progress messages ++#--------------------------------------------------------------------------- ++QUIET = YES ++WARNINGS = YES ++WARN_IF_UNDOCUMENTED = NO ++WARN_IF_DOC_ERROR = YES ++WARN_NO_PARAMDOC = YES ++WARN_FORMAT = "$file:$line: $text" ++WARN_LOGFILE = ++#--------------------------------------------------------------------------- ++# configuration options related to the input files ++#--------------------------------------------------------------------------- ++INPUT = . ++FILE_PATTERNS = *.c \ ++ *.cc \ ++ *.cxx \ ++ *.cpp \ ++ *.c++ \ ++ *.d \ ++ *.java \ ++ *.ii \ ++ *.ixx \ ++ *.ipp \ ++ *.i++ \ ++ *.inl \ ++ *.h \ ++ *.hh \ ++ *.hxx \ ++ *.hpp \ ++ *.h++ \ ++ *.idl \ ++ *.odl \ ++ *.cs \ ++ *.php \ ++ *.php3 \ ++ *.inc \ ++ *.m \ ++ *.mm \ ++ *.dox \ ++ *.py \ ++ *.C \ ++ *.CC \ ++ *.C++ \ ++ *.II \ ++ *.I++ \ ++ *.H \ ++ *.HH \ ++ *.H++ \ ++ *.CS \ ++ *.PHP \ ++ *.PHP3 \ ++ *.M \ ++ *.MM \ ++ *.PY ++RECURSIVE = NO ++EXCLUDE = ++EXCLUDE_SYMLINKS = NO ++EXCLUDE_PATTERNS = ++EXAMPLE_PATH = ++EXAMPLE_PATTERNS = * ++EXAMPLE_RECURSIVE = NO ++IMAGE_PATH = ++INPUT_FILTER = ++FILTER_PATTERNS = ++FILTER_SOURCE_FILES = NO ++#--------------------------------------------------------------------------- ++# configuration options related to source browsing ++#--------------------------------------------------------------------------- ++SOURCE_BROWSER = NO ++INLINE_SOURCES = NO ++STRIP_CODE_COMMENTS = YES ++REFERENCED_BY_RELATION = YES ++REFERENCES_RELATION = YES ++USE_HTAGS = NO ++VERBATIM_HEADERS = NO ++#--------------------------------------------------------------------------- ++# configuration options related to the alphabetical class index ++#--------------------------------------------------------------------------- ++ALPHABETICAL_INDEX = NO ++COLS_IN_ALPHA_INDEX = 5 ++IGNORE_PREFIX = ++#--------------------------------------------------------------------------- ++# configuration options related to the HTML output ++#--------------------------------------------------------------------------- ++GENERATE_HTML = YES ++HTML_OUTPUT = html ++HTML_FILE_EXTENSION = .html ++HTML_HEADER = ++HTML_FOOTER = ++HTML_STYLESHEET = ++HTML_ALIGN_MEMBERS = YES ++GENERATE_HTMLHELP = NO ++CHM_FILE = ++HHC_LOCATION = ++GENERATE_CHI = NO ++BINARY_TOC = NO ++TOC_EXPAND = NO ++DISABLE_INDEX = NO ++ENUM_VALUES_PER_LINE = 4 ++GENERATE_TREEVIEW = YES ++TREEVIEW_WIDTH = 250 ++#--------------------------------------------------------------------------- ++# configuration options related to the LaTeX output ++#--------------------------------------------------------------------------- ++GENERATE_LATEX = NO ++LATEX_OUTPUT = latex ++LATEX_CMD_NAME = latex ++MAKEINDEX_CMD_NAME = makeindex ++COMPACT_LATEX = NO ++PAPER_TYPE = a4wide ++EXTRA_PACKAGES = ++LATEX_HEADER = ++PDF_HYPERLINKS = NO ++USE_PDFLATEX = NO ++LATEX_BATCHMODE = NO ++LATEX_HIDE_INDICES = NO ++#--------------------------------------------------------------------------- ++# configuration options related to the RTF output ++#--------------------------------------------------------------------------- ++GENERATE_RTF = NO ++RTF_OUTPUT = rtf ++COMPACT_RTF = NO ++RTF_HYPERLINKS = NO ++RTF_STYLESHEET_FILE = ++RTF_EXTENSIONS_FILE = ++#--------------------------------------------------------------------------- ++# configuration options related to the man page output ++#--------------------------------------------------------------------------- ++GENERATE_MAN = NO ++MAN_OUTPUT = man ++MAN_EXTENSION = .3 ++MAN_LINKS = NO ++#--------------------------------------------------------------------------- ++# configuration options related to the XML output ++#--------------------------------------------------------------------------- ++GENERATE_XML = NO ++XML_OUTPUT = xml ++XML_SCHEMA = ++XML_DTD = ++XML_PROGRAMLISTING = YES ++#--------------------------------------------------------------------------- ++# configuration options for the AutoGen Definitions output ++#--------------------------------------------------------------------------- ++GENERATE_AUTOGEN_DEF = NO ++#--------------------------------------------------------------------------- ++# configuration options related to the Perl module output ++#--------------------------------------------------------------------------- ++GENERATE_PERLMOD = NO ++PERLMOD_LATEX = NO ++PERLMOD_PRETTY = YES ++PERLMOD_MAKEVAR_PREFIX = ++#--------------------------------------------------------------------------- ++# Configuration options related to the preprocessor ++#--------------------------------------------------------------------------- ++ENABLE_PREPROCESSING = YES ++MACRO_EXPANSION = NO ++EXPAND_ONLY_PREDEF = NO ++SEARCH_INCLUDES = YES ++INCLUDE_PATH = ++INCLUDE_FILE_PATTERNS = ++PREDEFINED = DEBUG DEBUG_MEMORY ++EXPAND_AS_DEFINED = ++SKIP_FUNCTION_MACROS = YES ++#--------------------------------------------------------------------------- ++# Configuration::additions related to external references ++#--------------------------------------------------------------------------- ++TAGFILES = ++GENERATE_TAGFILE = ++ALLEXTERNALS = NO ++EXTERNAL_GROUPS = YES ++PERL_PATH = /usr/bin/perl ++#--------------------------------------------------------------------------- ++# Configuration options related to the dot tool ++#--------------------------------------------------------------------------- ++CLASS_DIAGRAMS = YES ++HIDE_UNDOC_RELATIONS = YES ++HAVE_DOT = NO ++CLASS_GRAPH = YES ++COLLABORATION_GRAPH = YES ++GROUP_GRAPHS = YES ++UML_LOOK = NO ++TEMPLATE_RELATIONS = NO ++INCLUDE_GRAPH = NO ++INCLUDED_BY_GRAPH = YES ++CALL_GRAPH = NO ++GRAPHICAL_HIERARCHY = YES ++DIRECTORY_GRAPH = YES ++DOT_IMAGE_FORMAT = png ++DOT_PATH = ++DOTFILE_DIRS = ++MAX_DOT_GRAPH_DEPTH = 1000 ++DOT_TRANSPARENT = NO ++DOT_MULTI_TARGETS = NO ++GENERATE_LEGEND = YES ++DOT_CLEANUP = YES ++#--------------------------------------------------------------------------- ++# Configuration::additions related to the search engine ++#--------------------------------------------------------------------------- ++SEARCHENGINE = NO +diff --git a/drivers/usb/host/dwc_common_port/dwc_cc.c b/drivers/usb/host/dwc_common_port/dwc_cc.c +new file mode 100644 +index 0000000..5ec2ae2 +--- /dev/null ++++ b/drivers/usb/host/dwc_common_port/dwc_cc.c +@@ -0,0 +1,532 @@ ++/* ========================================================================= ++ * $File: //dwh/usb_iip/dev/software/dwc_common_port_2/dwc_cc.c $ ++ * $Revision: #4 $ ++ * $Date: 2010/11/04 $ ++ * $Change: 1621692 $ ++ * ++ * Synopsys Portability Library Software and documentation ++ * (hereinafter, "Software") is an Unsupported proprietary work of ++ * Synopsys, Inc. unless otherwise expressly agreed to in writing ++ * between Synopsys and you. ++ * ++ * The Software IS NOT an item of Licensed Software or Licensed Product ++ * under any End User Software License Agreement or Agreement for ++ * Licensed Product with Synopsys or any supplement thereto. You are ++ * permitted to use and redistribute this Software in source and binary ++ * forms, with or without modification, provided that redistributions ++ * of source code must retain this notice. You may not view, use, ++ * disclose, copy or distribute this file or any information contained ++ * herein except pursuant to this license grant from Synopsys. If you ++ * do not agree with this notice, including the disclaimer below, then ++ * you are not authorized to use the Software. ++ * ++ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" ++ * BASIS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ++ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS ++ * FOR A PARTICULAR PURPOSE ARE HEREBY DISCLAIMED. IN NO EVENT SHALL ++ * SYNOPSYS 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. ++ * ========================================================================= */ ++#ifdef DWC_CCLIB ++ ++#include "dwc_cc.h" ++ ++typedef struct dwc_cc ++{ ++ uint32_t uid; ++ uint8_t chid[16]; ++ uint8_t cdid[16]; ++ uint8_t ck[16]; ++ uint8_t *name; ++ uint8_t length; ++ DWC_CIRCLEQ_ENTRY(dwc_cc) list_entry; ++} dwc_cc_t; ++ ++DWC_CIRCLEQ_HEAD(context_list, dwc_cc); ++ ++/** The main structure for CC management. */ ++struct dwc_cc_if ++{ ++ dwc_mutex_t *mutex; ++ char *filename; ++ ++ unsigned is_host:1; ++ ++ dwc_notifier_t *notifier; ++ ++ struct context_list list; ++}; ++ ++#ifdef DEBUG ++static inline void dump_bytes(char *name, uint8_t *bytes, int len) ++{ ++ int i; ++ DWC_PRINTF("%s: ", name); ++ for (i=0; i<len; i++) { ++ DWC_PRINTF("%02x ", bytes[i]); ++ } ++ DWC_PRINTF("\n"); ++} ++#else ++#define dump_bytes(x...) ++#endif ++ ++static dwc_cc_t *alloc_cc(void *mem_ctx, uint8_t *name, uint32_t length) ++{ ++ dwc_cc_t *cc = dwc_alloc(mem_ctx, sizeof(dwc_cc_t)); ++ if (!cc) { ++ return NULL; ++ } ++ DWC_MEMSET(cc, 0, sizeof(dwc_cc_t)); ++ ++ if (name) { ++ cc->length = length; ++ cc->name = dwc_alloc(mem_ctx, length); ++ if (!cc->name) { ++ dwc_free(mem_ctx, cc); ++ return NULL; ++ } ++ ++ DWC_MEMCPY(cc->name, name, length); ++ } ++ ++ return cc; ++} ++ ++static void free_cc(void *mem_ctx, dwc_cc_t *cc) ++{ ++ if (cc->name) { ++ dwc_free(mem_ctx, cc->name); ++ } ++ dwc_free(mem_ctx, cc); ++} ++ ++static uint32_t next_uid(dwc_cc_if_t *cc_if) ++{ ++ uint32_t uid = 0; ++ dwc_cc_t *cc; ++ DWC_CIRCLEQ_FOREACH(cc, &cc_if->list, list_entry) { ++ if (cc->uid > uid) { ++ uid = cc->uid; ++ } ++ } ++ ++ if (uid == 0) { ++ uid = 255; ++ } ++ ++ return uid + 1; ++} ++ ++static dwc_cc_t *cc_find(dwc_cc_if_t *cc_if, uint32_t uid) ++{ ++ dwc_cc_t *cc; ++ DWC_CIRCLEQ_FOREACH(cc, &cc_if->list, list_entry) { ++ if (cc->uid == uid) { ++ return cc; ++ } ++ } ++ return NULL; ++} ++ ++static unsigned int cc_data_size(dwc_cc_if_t *cc_if) ++{ ++ unsigned int size = 0; ++ dwc_cc_t *cc; ++ DWC_CIRCLEQ_FOREACH(cc, &cc_if->list, list_entry) { ++ size += (48 + 1); ++ if (cc->name) { ++ size += cc->length; ++ } ++ } ++ return size; ++} ++ ++static uint32_t cc_match_chid(dwc_cc_if_t *cc_if, uint8_t *chid) ++{ ++ uint32_t uid = 0; ++ dwc_cc_t *cc; ++ ++ DWC_CIRCLEQ_FOREACH(cc, &cc_if->list, list_entry) { ++ if (DWC_MEMCMP(cc->chid, chid, 16) == 0) { ++ uid = cc->uid; ++ break; ++ } ++ } ++ return uid; ++} ++static uint32_t cc_match_cdid(dwc_cc_if_t *cc_if, uint8_t *cdid) ++{ ++ uint32_t uid = 0; ++ dwc_cc_t *cc; ++ ++ DWC_CIRCLEQ_FOREACH(cc, &cc_if->list, list_entry) { ++ if (DWC_MEMCMP(cc->cdid, cdid, 16) == 0) { ++ uid = cc->uid; ++ break; ++ } ++ } ++ return uid; ++} ++ ++/* Internal cc_add */ ++static int32_t cc_add(void *mem_ctx, dwc_cc_if_t *cc_if, uint8_t *chid, ++ uint8_t *cdid, uint8_t *ck, uint8_t *name, uint8_t length) ++{ ++ dwc_cc_t *cc; ++ uint32_t uid; ++ ++ if (cc_if->is_host) { ++ uid = cc_match_cdid(cc_if, cdid); ++ } ++ else { ++ uid = cc_match_chid(cc_if, chid); ++ } ++ ++ if (uid) { ++ DWC_DEBUGC("Replacing previous connection context id=%d name=%p name_len=%d", uid, name, length); ++ cc = cc_find(cc_if, uid); ++ } ++ else { ++ cc = alloc_cc(mem_ctx, name, length); ++ cc->uid = next_uid(cc_if); ++ DWC_CIRCLEQ_INSERT_TAIL(&cc_if->list, cc, list_entry); ++ } ++ ++ DWC_MEMCPY(&(cc->chid[0]), chid, 16); ++ DWC_MEMCPY(&(cc->cdid[0]), cdid, 16); ++ DWC_MEMCPY(&(cc->ck[0]), ck, 16); ++ ++ DWC_DEBUGC("Added connection context id=%d name=%p name_len=%d", cc->uid, name, length); ++ dump_bytes("CHID", cc->chid, 16); ++ dump_bytes("CDID", cc->cdid, 16); ++ dump_bytes("CK", cc->ck, 16); ++ return cc->uid; ++} ++ ++/* Internal cc_clear */ ++static void cc_clear(void *mem_ctx, dwc_cc_if_t *cc_if) ++{ ++ while (!DWC_CIRCLEQ_EMPTY(&cc_if->list)) { ++ dwc_cc_t *cc = DWC_CIRCLEQ_FIRST(&cc_if->list); ++ DWC_CIRCLEQ_REMOVE_INIT(&cc_if->list, cc, list_entry); ++ free_cc(mem_ctx, cc); ++ } ++} ++ ++dwc_cc_if_t *dwc_cc_if_alloc(void *mem_ctx, void *mtx_ctx, ++ dwc_notifier_t *notifier, unsigned is_host) ++{ ++ dwc_cc_if_t *cc_if = NULL; ++ ++ /* Allocate a common_cc_if structure */ ++ cc_if = dwc_alloc(mem_ctx, sizeof(dwc_cc_if_t)); ++ ++ if (!cc_if) ++ return NULL; ++ ++#if (defined(DWC_LINUX) && defined(CONFIG_DEBUG_MUTEXES)) ++ DWC_MUTEX_ALLOC_LINUX_DEBUG(cc_if->mutex); ++#else ++ cc_if->mutex = dwc_mutex_alloc(mtx_ctx); ++#endif ++ if (!cc_if->mutex) { ++ dwc_free(mem_ctx, cc_if); ++ return NULL; ++ } ++ ++ DWC_CIRCLEQ_INIT(&cc_if->list); ++ cc_if->is_host = is_host; ++ cc_if->notifier = notifier; ++ return cc_if; ++} ++ ++void dwc_cc_if_free(void *mem_ctx, void *mtx_ctx, dwc_cc_if_t *cc_if) ++{ ++#if (defined(DWC_LINUX) && defined(CONFIG_DEBUG_MUTEXES)) ++ DWC_MUTEX_FREE(cc_if->mutex); ++#else ++ dwc_mutex_free(mtx_ctx, cc_if->mutex); ++#endif ++ cc_clear(mem_ctx, cc_if); ++ dwc_free(mem_ctx, cc_if); ++} ++ ++static void cc_changed(dwc_cc_if_t *cc_if) ++{ ++ if (cc_if->notifier) { ++ dwc_notify(cc_if->notifier, DWC_CC_LIST_CHANGED_NOTIFICATION, cc_if); ++ } ++} ++ ++void dwc_cc_clear(void *mem_ctx, dwc_cc_if_t *cc_if) ++{ ++ DWC_MUTEX_LOCK(cc_if->mutex); ++ cc_clear(mem_ctx, cc_if); ++ DWC_MUTEX_UNLOCK(cc_if->mutex); ++ cc_changed(cc_if); ++} ++ ++int32_t dwc_cc_add(void *mem_ctx, dwc_cc_if_t *cc_if, uint8_t *chid, ++ uint8_t *cdid, uint8_t *ck, uint8_t *name, uint8_t length) ++{ ++ uint32_t uid; ++ ++ DWC_MUTEX_LOCK(cc_if->mutex); ++ uid = cc_add(mem_ctx, cc_if, chid, cdid, ck, name, length); ++ DWC_MUTEX_UNLOCK(cc_if->mutex); ++ cc_changed(cc_if); ++ ++ return uid; ++} ++ ++void dwc_cc_change(void *mem_ctx, dwc_cc_if_t *cc_if, int32_t id, uint8_t *chid, ++ uint8_t *cdid, uint8_t *ck, uint8_t *name, uint8_t length) ++{ ++ dwc_cc_t* cc; ++ ++ DWC_DEBUGC("Change connection context %d", id); ++ ++ DWC_MUTEX_LOCK(cc_if->mutex); ++ cc = cc_find(cc_if, id); ++ if (!cc) { ++ DWC_ERROR("Uid %d not found in cc list\n", id); ++ DWC_MUTEX_UNLOCK(cc_if->mutex); ++ return; ++ } ++ ++ if (chid) { ++ DWC_MEMCPY(&(cc->chid[0]), chid, 16); ++ } ++ if (cdid) { ++ DWC_MEMCPY(&(cc->cdid[0]), cdid, 16); ++ } ++ if (ck) { ++ DWC_MEMCPY(&(cc->ck[0]), ck, 16); ++ } ++ ++ if (name) { ++ if (cc->name) { ++ dwc_free(mem_ctx, cc->name); ++ } ++ cc->name = dwc_alloc(mem_ctx, length); ++ if (!cc->name) { ++ DWC_ERROR("Out of memory in dwc_cc_change()\n"); ++ DWC_MUTEX_UNLOCK(cc_if->mutex); ++ return; ++ } ++ cc->length = length; ++ DWC_MEMCPY(cc->name, name, length); ++ } ++ ++ DWC_MUTEX_UNLOCK(cc_if->mutex); ++ ++ cc_changed(cc_if); ++ ++ DWC_DEBUGC("Changed connection context id=%d\n", id); ++ dump_bytes("New CHID", cc->chid, 16); ++ dump_bytes("New CDID", cc->cdid, 16); ++ dump_bytes("New CK", cc->ck, 16); ++} ++ ++void dwc_cc_remove(void *mem_ctx, dwc_cc_if_t *cc_if, int32_t id) ++{ ++ dwc_cc_t *cc; ++ ++ DWC_DEBUGC("Removing connection context %d", id); ++ ++ DWC_MUTEX_LOCK(cc_if->mutex); ++ cc = cc_find(cc_if, id); ++ if (!cc) { ++ DWC_ERROR("Uid %d not found in cc list\n", id); ++ DWC_MUTEX_UNLOCK(cc_if->mutex); ++ return; ++ } ++ ++ DWC_CIRCLEQ_REMOVE_INIT(&cc_if->list, cc, list_entry); ++ DWC_MUTEX_UNLOCK(cc_if->mutex); ++ free_cc(mem_ctx, cc); ++ ++ cc_changed(cc_if); ++} ++ ++uint8_t *dwc_cc_data_for_save(void *mem_ctx, dwc_cc_if_t *cc_if, unsigned int *length) ++{ ++ uint8_t *buf, *x; ++ uint8_t zero = 0; ++ dwc_cc_t *cc; ++ ++ DWC_MUTEX_LOCK(cc_if->mutex); ++ *length = cc_data_size(cc_if); ++ if (!(*length)) { ++ DWC_MUTEX_UNLOCK(cc_if->mutex); ++ return NULL; ++ } ++ ++ DWC_DEBUGC("Creating data for saving (length=%d)", *length); ++ ++ buf = dwc_alloc(mem_ctx, *length); ++ if (!buf) { ++ *length = 0; ++ DWC_MUTEX_UNLOCK(cc_if->mutex); ++ return NULL; ++ } ++ ++ x = buf; ++ DWC_CIRCLEQ_FOREACH(cc, &cc_if->list, list_entry) { ++ DWC_MEMCPY(x, cc->chid, 16); ++ x += 16; ++ DWC_MEMCPY(x, cc->cdid, 16); ++ x += 16; ++ DWC_MEMCPY(x, cc->ck, 16); ++ x += 16; ++ if (cc->name) { ++ DWC_MEMCPY(x, &cc->length, 1); ++ x += 1; ++ DWC_MEMCPY(x, cc->name, cc->length); ++ x += cc->length; ++ } ++ else { ++ DWC_MEMCPY(x, &zero, 1); ++ x += 1; ++ } ++ } ++ DWC_MUTEX_UNLOCK(cc_if->mutex); ++ ++ return buf; ++} ++ ++void dwc_cc_restore_from_data(void *mem_ctx, dwc_cc_if_t *cc_if, uint8_t *data, uint32_t length) ++{ ++ uint8_t name_length; ++ uint8_t *name; ++ uint8_t *chid; ++ uint8_t *cdid; ++ uint8_t *ck; ++ uint32_t i = 0; ++ ++ DWC_MUTEX_LOCK(cc_if->mutex); ++ cc_clear(mem_ctx, cc_if); ++ ++ while (i < length) { ++ chid = &data[i]; ++ i += 16; ++ cdid = &data[i]; ++ i += 16; ++ ck = &data[i]; ++ i += 16; ++ ++ name_length = data[i]; ++ i ++; ++ ++ if (name_length) { ++ name = &data[i]; ++ i += name_length; ++ } ++ else { ++ name = NULL; ++ } ++ ++ /* check to see if we haven't overflown the buffer */ ++ if (i > length) { ++ DWC_ERROR("Data format error while attempting to load CCs " ++ "(nlen=%d, iter=%d, buflen=%d).\n", name_length, i, length); ++ break; ++ } ++ ++ cc_add(mem_ctx, cc_if, chid, cdid, ck, name, name_length); ++ } ++ DWC_MUTEX_UNLOCK(cc_if->mutex); ++ ++ cc_changed(cc_if); ++} ++ ++uint32_t dwc_cc_match_chid(dwc_cc_if_t *cc_if, uint8_t *chid) ++{ ++ uint32_t uid = 0; ++ ++ DWC_MUTEX_LOCK(cc_if->mutex); ++ uid = cc_match_chid(cc_if, chid); ++ DWC_MUTEX_UNLOCK(cc_if->mutex); ++ return uid; ++} ++uint32_t dwc_cc_match_cdid(dwc_cc_if_t *cc_if, uint8_t *cdid) ++{ ++ uint32_t uid = 0; ++ ++ DWC_MUTEX_LOCK(cc_if->mutex); ++ uid = cc_match_cdid(cc_if, cdid); ++ DWC_MUTEX_UNLOCK(cc_if->mutex); ++ return uid; ++} ++ ++uint8_t *dwc_cc_ck(dwc_cc_if_t *cc_if, int32_t id) ++{ ++ uint8_t *ck = NULL; ++ dwc_cc_t *cc; ++ ++ DWC_MUTEX_LOCK(cc_if->mutex); ++ cc = cc_find(cc_if, id); ++ if (cc) { ++ ck = cc->ck; ++ } ++ DWC_MUTEX_UNLOCK(cc_if->mutex); ++ ++ return ck; ++ ++} ++ ++uint8_t *dwc_cc_chid(dwc_cc_if_t *cc_if, int32_t id) ++{ ++ uint8_t *retval = NULL; ++ dwc_cc_t *cc; ++ ++ DWC_MUTEX_LOCK(cc_if->mutex); ++ cc = cc_find(cc_if, id); ++ if (cc) { ++ retval = cc->chid; ++ } ++ DWC_MUTEX_UNLOCK(cc_if->mutex); ++ ++ return retval; ++} ++ ++uint8_t *dwc_cc_cdid(dwc_cc_if_t *cc_if, int32_t id) ++{ ++ uint8_t *retval = NULL; ++ dwc_cc_t *cc; ++ ++ DWC_MUTEX_LOCK(cc_if->mutex); ++ cc = cc_find(cc_if, id); ++ if (cc) { ++ retval = cc->cdid; ++ } ++ DWC_MUTEX_UNLOCK(cc_if->mutex); ++ ++ return retval; ++} ++ ++uint8_t *dwc_cc_name(dwc_cc_if_t *cc_if, int32_t id, uint8_t *length) ++{ ++ uint8_t *retval = NULL; ++ dwc_cc_t *cc; ++ ++ DWC_MUTEX_LOCK(cc_if->mutex); ++ *length = 0; ++ cc = cc_find(cc_if, id); ++ if (cc) { ++ *length = cc->length; ++ retval = cc->name; ++ } ++ DWC_MUTEX_UNLOCK(cc_if->mutex); ++ ++ return retval; ++} ++ ++#endif /* DWC_CCLIB */ +diff --git a/drivers/usb/host/dwc_common_port/dwc_cc.h b/drivers/usb/host/dwc_common_port/dwc_cc.h +new file mode 100644 +index 0000000..f86e6f2 +--- /dev/null ++++ b/drivers/usb/host/dwc_common_port/dwc_cc.h +@@ -0,0 +1,224 @@ ++/* ========================================================================= ++ * $File: //dwh/usb_iip/dev/software/dwc_common_port_2/dwc_cc.h $ ++ * $Revision: #4 $ ++ * $Date: 2010/09/28 $ ++ * $Change: 1596182 $ ++ * ++ * Synopsys Portability Library Software and documentation ++ * (hereinafter, "Software") is an Unsupported proprietary work of ++ * Synopsys, Inc. unless otherwise expressly agreed to in writing ++ * between Synopsys and you. ++ * ++ * The Software IS NOT an item of Licensed Software or Licensed Product ++ * under any End User Software License Agreement or Agreement for ++ * Licensed Product with Synopsys or any supplement thereto. You are ++ * permitted to use and redistribute this Software in source and binary ++ * forms, with or without modification, provided that redistributions ++ * of source code must retain this notice. You may not view, use, ++ * disclose, copy or distribute this file or any information contained ++ * herein except pursuant to this license grant from Synopsys. If you ++ * do not agree with this notice, including the disclaimer below, then ++ * you are not authorized to use the Software. ++ * ++ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" ++ * BASIS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ++ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS ++ * FOR A PARTICULAR PURPOSE ARE HEREBY DISCLAIMED. IN NO EVENT SHALL ++ * SYNOPSYS 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. ++ * ========================================================================= */ ++#ifndef _DWC_CC_H_ ++#define _DWC_CC_H_ ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++/** @file ++ * ++ * This file defines the Context Context library. ++ * ++ * The main data structure is dwc_cc_if_t which is returned by either the ++ * dwc_cc_if_alloc function or returned by the module to the user via a provided ++ * function. The data structure is opaque and should only be manipulated via the ++ * functions provied in this API. ++ * ++ * It manages a list of connection contexts and operations can be performed to ++ * add, remove, query, search, and change, those contexts. Additionally, ++ * a dwc_notifier_t object can be requested from the manager so that ++ * the user can be notified whenever the context list has changed. ++ */ ++ ++#include "dwc_os.h" ++#include "dwc_list.h" ++#include "dwc_notifier.h" ++ ++ ++/* Notifications */ ++#define DWC_CC_LIST_CHANGED_NOTIFICATION "DWC_CC_LIST_CHANGED_NOTIFICATION" ++ ++struct dwc_cc_if; ++typedef struct dwc_cc_if dwc_cc_if_t; ++ ++ ++/** @name Connection Context Operations */ ++/** @{ */ ++ ++/** This function allocates memory for a dwc_cc_if_t structure, initializes ++ * fields to default values, and returns a pointer to the structure or NULL on ++ * error. */ ++extern dwc_cc_if_t *dwc_cc_if_alloc(void *mem_ctx, void *mtx_ctx, ++ dwc_notifier_t *notifier, unsigned is_host); ++ ++/** Frees the memory for the specified CC structure allocated from ++ * dwc_cc_if_alloc(). */ ++extern void dwc_cc_if_free(void *mem_ctx, void *mtx_ctx, dwc_cc_if_t *cc_if); ++ ++/** Removes all contexts from the connection context list */ ++extern void dwc_cc_clear(void *mem_ctx, dwc_cc_if_t *cc_if); ++ ++/** Adds a connection context (CHID, CK, CDID, Name) to the connection context list. ++ * If a CHID already exists, the CK and name are overwritten. Statistics are ++ * not overwritten. ++ * ++ * @param cc_if The cc_if structure. ++ * @param chid A pointer to the 16-byte CHID. This value will be copied. ++ * @param ck A pointer to the 16-byte CK. This value will be copied. ++ * @param cdid A pointer to the 16-byte CDID. This value will be copied. ++ * @param name An optional host friendly name as defined in the association model ++ * spec. Must be a UTF16-LE unicode string. Can be NULL to indicated no name. ++ * @param length The length othe unicode string. ++ * @return A unique identifier used to refer to this context that is valid for ++ * as long as this context is still in the list. */ ++extern int32_t dwc_cc_add(void *mem_ctx, dwc_cc_if_t *cc_if, uint8_t *chid, ++ uint8_t *cdid, uint8_t *ck, uint8_t *name, ++ uint8_t length); ++ ++/** Changes the CHID, CK, CDID, or Name values of a connection context in the ++ * list, preserving any accumulated statistics. This would typically be called ++ * if the host decideds to change the context with a SET_CONNECTION request. ++ * ++ * @param cc_if The cc_if structure. ++ * @param id The identifier of the connection context. ++ * @param chid A pointer to the 16-byte CHID. This value will be copied. NULL ++ * indicates no change. ++ * @param cdid A pointer to the 16-byte CDID. This value will be copied. NULL ++ * indicates no change. ++ * @param ck A pointer to the 16-byte CK. This value will be copied. NULL ++ * indicates no change. ++ * @param name Host friendly name UTF16-LE. NULL indicates no change. ++ * @param length Length of name. */ ++extern void dwc_cc_change(void *mem_ctx, dwc_cc_if_t *cc_if, int32_t id, ++ uint8_t *chid, uint8_t *cdid, uint8_t *ck, ++ uint8_t *name, uint8_t length); ++ ++/** Remove the specified connection context. ++ * @param cc_if The cc_if structure. ++ * @param id The identifier of the connection context to remove. */ ++extern void dwc_cc_remove(void *mem_ctx, dwc_cc_if_t *cc_if, int32_t id); ++ ++/** Get a binary block of data for the connection context list and attributes. ++ * This data can be used by the OS specific driver to save the connection ++ * context list into non-volatile memory. ++ * ++ * @param cc_if The cc_if structure. ++ * @param length Return the length of the data buffer. ++ * @return A pointer to the data buffer. The memory for this buffer should be ++ * freed with DWC_FREE() after use. */ ++extern uint8_t *dwc_cc_data_for_save(void *mem_ctx, dwc_cc_if_t *cc_if, ++ unsigned int *length); ++ ++/** Restore the connection context list from the binary data that was previously ++ * returned from a call to dwc_cc_data_for_save. This can be used by the OS specific ++ * driver to load a connection context list from non-volatile memory. ++ * ++ * @param cc_if The cc_if structure. ++ * @param data The data bytes as returned from dwc_cc_data_for_save. ++ * @param length The length of the data. */ ++extern void dwc_cc_restore_from_data(void *mem_ctx, dwc_cc_if_t *cc_if, ++ uint8_t *data, unsigned int length); ++ ++/** Find the connection context from the specified CHID. ++ * ++ * @param cc_if The cc_if structure. ++ * @param chid A pointer to the CHID data. ++ * @return A non-zero identifier of the connection context if the CHID matches. ++ * Otherwise returns 0. */ ++extern uint32_t dwc_cc_match_chid(dwc_cc_if_t *cc_if, uint8_t *chid); ++ ++/** Find the connection context from the specified CDID. ++ * ++ * @param cc_if The cc_if structure. ++ * @param cdid A pointer to the CDID data. ++ * @return A non-zero identifier of the connection context if the CHID matches. ++ * Otherwise returns 0. */ ++extern uint32_t dwc_cc_match_cdid(dwc_cc_if_t *cc_if, uint8_t *cdid); ++ ++/** Retrieve the CK from the specified connection context. ++ * ++ * @param cc_if The cc_if structure. ++ * @param id The identifier of the connection context. ++ * @return A pointer to the CK data. The memory does not need to be freed. */ ++extern uint8_t *dwc_cc_ck(dwc_cc_if_t *cc_if, int32_t id); ++ ++/** Retrieve the CHID from the specified connection context. ++ * ++ * @param cc_if The cc_if structure. ++ * @param id The identifier of the connection context. ++ * @return A pointer to the CHID data. The memory does not need to be freed. */ ++extern uint8_t *dwc_cc_chid(dwc_cc_if_t *cc_if, int32_t id); ++ ++/** Retrieve the CDID from the specified connection context. ++ * ++ * @param cc_if The cc_if structure. ++ * @param id The identifier of the connection context. ++ * @return A pointer to the CDID data. The memory does not need to be freed. */ ++extern uint8_t *dwc_cc_cdid(dwc_cc_if_t *cc_if, int32_t id); ++ ++extern uint8_t *dwc_cc_name(dwc_cc_if_t *cc_if, int32_t id, uint8_t *length); ++ ++/** Checks a buffer for non-zero. ++ * @param id A pointer to a 16 byte buffer. ++ * @return true if the 16 byte value is non-zero. */ ++static inline unsigned dwc_assoc_is_not_zero_id(uint8_t *id) { ++ int i; ++ for (i=0; i<16; i++) { ++ if (id[i]) return 1; ++ } ++ return 0; ++} ++ ++/** Checks a buffer for zero. ++ * @param id A pointer to a 16 byte buffer. ++ * @return true if the 16 byte value is zero. */ ++static inline unsigned dwc_assoc_is_zero_id(uint8_t *id) { ++ return !dwc_assoc_is_not_zero_id(id); ++} ++ ++/** Prints an ASCII representation for the 16-byte chid, cdid, or ck, into ++ * buffer. */ ++static inline int dwc_print_id_string(char *buffer, uint8_t *id) { ++ char *ptr = buffer; ++ int i; ++ for (i=0; i<16; i++) { ++ ptr += DWC_SPRINTF(ptr, "%02x", id[i]); ++ if (i < 15) { ++ ptr += DWC_SPRINTF(ptr, " "); ++ } ++ } ++ return ptr - buffer; ++} ++ ++/** @} */ ++ ++#ifdef __cplusplus ++} ++#endif ++ ++#endif /* _DWC_CC_H_ */ +diff --git a/drivers/usb/host/dwc_common_port/dwc_common_fbsd.c b/drivers/usb/host/dwc_common_port/dwc_common_fbsd.c +new file mode 100644 +index 0000000..6dd04b5 +--- /dev/null ++++ b/drivers/usb/host/dwc_common_port/dwc_common_fbsd.c +@@ -0,0 +1,1308 @@ ++#include "dwc_os.h" ++#include "dwc_list.h" ++ ++#ifdef DWC_CCLIB ++# include "dwc_cc.h" ++#endif ++ ++#ifdef DWC_CRYPTOLIB ++# include "dwc_modpow.h" ++# include "dwc_dh.h" ++# include "dwc_crypto.h" ++#endif ++ ++#ifdef DWC_NOTIFYLIB ++# include "dwc_notifier.h" ++#endif ++ ++/* OS-Level Implementations */ ++ ++/* This is the FreeBSD 7.0 kernel implementation of the DWC platform library. */ ++ ++ ++/* MISC */ ++ ++void *DWC_MEMSET(void *dest, uint8_t byte, uint32_t size) ++{ ++ return memset(dest, byte, size); ++} ++ ++void *DWC_MEMCPY(void *dest, void const *src, uint32_t size) ++{ ++ return memcpy(dest, src, size); ++} ++ ++void *DWC_MEMMOVE(void *dest, void *src, uint32_t size) ++{ ++ bcopy(src, dest, size); ++ return dest; ++} ++ ++int DWC_MEMCMP(void *m1, void *m2, uint32_t size) ++{ ++ return memcmp(m1, m2, size); ++} ++ ++int DWC_STRNCMP(void *s1, void *s2, uint32_t size) ++{ ++ return strncmp(s1, s2, size); ++} ++ ++int DWC_STRCMP(void *s1, void *s2) ++{ ++ return strcmp(s1, s2); ++} ++ ++int DWC_STRLEN(char const *str) ++{ ++ return strlen(str); ++} ++ ++char *DWC_STRCPY(char *to, char const *from) ++{ ++ return strcpy(to, from); ++} ++ ++char *DWC_STRDUP(char const *str) ++{ ++ int len = DWC_STRLEN(str) + 1; ++ char *new = DWC_ALLOC_ATOMIC(len); ++ ++ if (!new) { ++ return NULL; ++ } ++ ++ DWC_MEMCPY(new, str, len); ++ return new; ++} ++ ++int DWC_ATOI(char *str, int32_t *value) ++{ ++ char *end = NULL; ++ ++ *value = strtol(str, &end, 0); ++ if (*end == '\0') { ++ return 0; ++ } ++ ++ return -1; ++} ++ ++int DWC_ATOUI(char *str, uint32_t *value) ++{ ++ char *end = NULL; ++ ++ *value = strtoul(str, &end, 0); ++ if (*end == '\0') { ++ return 0; ++ } ++ ++ return -1; ++} ++ ++ ++#ifdef DWC_UTFLIB ++/* From usbstring.c */ ++ ++int DWC_UTF8_TO_UTF16LE(uint8_t const *s, uint16_t *cp, unsigned len) ++{ ++ int count = 0; ++ u8 c; ++ u16 uchar; ++ ++ /* this insists on correct encodings, though not minimal ones. ++ * BUT it currently rejects legit 4-byte UTF-8 code points, ++ * which need surrogate pairs. (Unicode 3.1 can use them.) ++ */ ++ while (len != 0 && (c = (u8) *s++) != 0) { ++ if (unlikely(c & 0x80)) { ++ // 2-byte sequence: ++ // 00000yyyyyxxxxxx = 110yyyyy 10xxxxxx ++ if ((c & 0xe0) == 0xc0) { ++ uchar = (c & 0x1f) << 6; ++ ++ c = (u8) *s++; ++ if ((c & 0xc0) != 0xc0) ++ goto fail; ++ c &= 0x3f; ++ uchar |= c; ++ ++ // 3-byte sequence (most CJKV characters): ++ // zzzzyyyyyyxxxxxx = 1110zzzz 10yyyyyy 10xxxxxx ++ } else if ((c & 0xf0) == 0xe0) { ++ uchar = (c & 0x0f) << 12; ++ ++ c = (u8) *s++; ++ if ((c & 0xc0) != 0xc0) ++ goto fail; ++ c &= 0x3f; ++ uchar |= c << 6; ++ ++ c = (u8) *s++; ++ if ((c & 0xc0) != 0xc0) ++ goto fail; ++ c &= 0x3f; ++ uchar |= c; ++ ++ /* no bogus surrogates */ ++ if (0xd800 <= uchar && uchar <= 0xdfff) ++ goto fail; ++ ++ // 4-byte sequence (surrogate pairs, currently rare): ++ // 11101110wwwwzzzzyy + 110111yyyyxxxxxx ++ // = 11110uuu 10uuzzzz 10yyyyyy 10xxxxxx ++ // (uuuuu = wwww + 1) ++ // FIXME accept the surrogate code points (only) ++ } else ++ goto fail; ++ } else ++ uchar = c; ++ put_unaligned (cpu_to_le16 (uchar), cp++); ++ count++; ++ len--; ++ } ++ return count; ++fail: ++ return -1; ++} ++ ++#endif /* DWC_UTFLIB */ ++ ++ ++/* dwc_debug.h */ ++ ++dwc_bool_t DWC_IN_IRQ(void) ++{ ++// return in_irq(); ++ return 0; ++} ++ ++dwc_bool_t DWC_IN_BH(void) ++{ ++// return in_softirq(); ++ return 0; ++} ++ ++void DWC_VPRINTF(char *format, va_list args) ++{ ++ vprintf(format, args); ++} ++ ++int DWC_VSNPRINTF(char *str, int size, char *format, va_list args) ++{ ++ return vsnprintf(str, size, format, args); ++} ++ ++void DWC_PRINTF(char *format, ...) ++{ ++ va_list args; ++ ++ va_start(args, format); ++ DWC_VPRINTF(format, args); ++ va_end(args); ++} ++ ++int DWC_SPRINTF(char *buffer, char *format, ...) ++{ ++ int retval; ++ va_list args; ++ ++ va_start(args, format); ++ retval = vsprintf(buffer, format, args); ++ va_end(args); ++ return retval; ++} ++ ++int DWC_SNPRINTF(char *buffer, int size, char *format, ...) ++{ ++ int retval; ++ va_list args; ++ ++ va_start(args, format); ++ retval = vsnprintf(buffer, size, format, args); ++ va_end(args); ++ return retval; ++} ++ ++void __DWC_WARN(char *format, ...) ++{ ++ va_list args; ++ ++ va_start(args, format); ++ DWC_VPRINTF(format, args); ++ va_end(args); ++} ++ ++void __DWC_ERROR(char *format, ...) ++{ ++ va_list args; ++ ++ va_start(args, format); ++ DWC_VPRINTF(format, args); ++ va_end(args); ++} ++ ++void DWC_EXCEPTION(char *format, ...) ++{ ++ va_list args; ++ ++ va_start(args, format); ++ DWC_VPRINTF(format, args); ++ va_end(args); ++// BUG_ON(1); ??? ++} ++ ++#ifdef DEBUG ++void __DWC_DEBUG(char *format, ...) ++{ ++ va_list args; ++ ++ va_start(args, format); ++ DWC_VPRINTF(format, args); ++ va_end(args); ++} ++#endif ++ ++ ++/* dwc_mem.h */ ++ ++#if 0 ++dwc_pool_t *DWC_DMA_POOL_CREATE(uint32_t size, ++ uint32_t align, ++ uint32_t alloc) ++{ ++ struct dma_pool *pool = dma_pool_create("Pool", NULL, ++ size, align, alloc); ++ return (dwc_pool_t *)pool; ++} ++ ++void DWC_DMA_POOL_DESTROY(dwc_pool_t *pool) ++{ ++ dma_pool_destroy((struct dma_pool *)pool); ++} ++ ++void *DWC_DMA_POOL_ALLOC(dwc_pool_t *pool, uint64_t *dma_addr) ++{ ++// return dma_pool_alloc((struct dma_pool *)pool, GFP_KERNEL, dma_addr); ++ return dma_pool_alloc((struct dma_pool *)pool, M_WAITOK, dma_addr); ++} ++ ++void *DWC_DMA_POOL_ZALLOC(dwc_pool_t *pool, uint64_t *dma_addr) ++{ ++ void *vaddr = DWC_DMA_POOL_ALLOC(pool, dma_addr); ++ memset(..); ++} ++ ++void DWC_DMA_POOL_FREE(dwc_pool_t *pool, void *vaddr, void *daddr) ++{ ++ dma_pool_free(pool, vaddr, daddr); ++} ++#endif ++ ++static void dmamap_cb(void *arg, bus_dma_segment_t *segs, int nseg, int error) ++{ ++ if (error) ++ return; ++ *(bus_addr_t *)arg = segs[0].ds_addr; ++} ++ ++void *__DWC_DMA_ALLOC(void *dma_ctx, uint32_t size, dwc_dma_t *dma_addr) ++{ ++ dwc_dmactx_t *dma = (dwc_dmactx_t *)dma_ctx; ++ int error; ++ ++ error = bus_dma_tag_create( ++#if __FreeBSD_version >= 700000 ++ bus_get_dma_tag(dma->dev), /* parent */ ++#else ++ NULL, /* parent */ ++#endif ++ 4, 0, /* alignment, bounds */ ++ BUS_SPACE_MAXADDR_32BIT, /* lowaddr */ ++ BUS_SPACE_MAXADDR, /* highaddr */ ++ NULL, NULL, /* filter, filterarg */ ++ size, /* maxsize */ ++ 1, /* nsegments */ ++ size, /* maxsegsize */ ++ 0, /* flags */ ++ NULL, /* lockfunc */ ++ NULL, /* lockarg */ ++ &dma->dma_tag); ++ if (error) { ++ device_printf(dma->dev, "%s: bus_dma_tag_create failed: %d\n", ++ __func__, error); ++ goto fail_0; ++ } ++ ++ error = bus_dmamem_alloc(dma->dma_tag, &dma->dma_vaddr, ++ BUS_DMA_NOWAIT | BUS_DMA_COHERENT, &dma->dma_map); ++ if (error) { ++ device_printf(dma->dev, "%s: bus_dmamem_alloc(%ju) failed: %d\n", ++ __func__, (uintmax_t)size, error); ++ goto fail_1; ++ } ++ ++ dma->dma_paddr = 0; ++ error = bus_dmamap_load(dma->dma_tag, dma->dma_map, dma->dma_vaddr, size, ++ dmamap_cb, &dma->dma_paddr, BUS_DMA_NOWAIT); ++ if (error || dma->dma_paddr == 0) { ++ device_printf(dma->dev, "%s: bus_dmamap_load failed: %d\n", ++ __func__, error); ++ goto fail_2; ++ } ++ ++ *dma_addr = dma->dma_paddr; ++ return dma->dma_vaddr; ++ ++fail_2: ++ bus_dmamap_unload(dma->dma_tag, dma->dma_map); ++fail_1: ++ bus_dmamem_free(dma->dma_tag, dma->dma_vaddr, dma->dma_map); ++ bus_dma_tag_destroy(dma->dma_tag); ++fail_0: ++ dma->dma_map = NULL; ++ dma->dma_tag = NULL; ++ ++ return NULL; ++} ++ ++void __DWC_DMA_FREE(void *dma_ctx, uint32_t size, void *virt_addr, dwc_dma_t dma_addr) ++{ ++ dwc_dmactx_t *dma = (dwc_dmactx_t *)dma_ctx; ++ ++ if (dma->dma_tag == NULL) ++ return; ++ if (dma->dma_map != NULL) { ++ bus_dmamap_sync(dma->dma_tag, dma->dma_map, ++ BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); ++ bus_dmamap_unload(dma->dma_tag, dma->dma_map); ++ bus_dmamem_free(dma->dma_tag, dma->dma_vaddr, dma->dma_map); ++ dma->dma_map = NULL; ++ } ++ ++ bus_dma_tag_destroy(dma->dma_tag); ++ dma->dma_tag = NULL; ++} ++ ++void *__DWC_ALLOC(void *mem_ctx, uint32_t size) ++{ ++ return malloc(size, M_DEVBUF, M_WAITOK | M_ZERO); ++} ++ ++void *__DWC_ALLOC_ATOMIC(void *mem_ctx, uint32_t size) ++{ ++ return malloc(size, M_DEVBUF, M_NOWAIT | M_ZERO); ++} ++ ++void __DWC_FREE(void *mem_ctx, void *addr) ++{ ++ free(addr, M_DEVBUF); ++} ++ ++ ++#ifdef DWC_CRYPTOLIB ++/* dwc_crypto.h */ ++ ++void DWC_RANDOM_BYTES(uint8_t *buffer, uint32_t length) ++{ ++ get_random_bytes(buffer, length); ++} ++ ++int DWC_AES_CBC(uint8_t *message, uint32_t messagelen, uint8_t *key, uint32_t keylen, uint8_t iv[16], uint8_t *out) ++{ ++ struct crypto_blkcipher *tfm; ++ struct blkcipher_desc desc; ++ struct scatterlist sgd; ++ struct scatterlist sgs; ++ ++ tfm = crypto_alloc_blkcipher("cbc(aes)", 0, CRYPTO_ALG_ASYNC); ++ if (tfm == NULL) { ++ printk("failed to load transform for aes CBC\n"); ++ return -1; ++ } ++ ++ crypto_blkcipher_setkey(tfm, key, keylen); ++ crypto_blkcipher_set_iv(tfm, iv, 16); ++ ++ sg_init_one(&sgd, out, messagelen); ++ sg_init_one(&sgs, message, messagelen); ++ ++ desc.tfm = tfm; ++ desc.flags = 0; ++ ++ if (crypto_blkcipher_encrypt(&desc, &sgd, &sgs, messagelen)) { ++ crypto_free_blkcipher(tfm); ++ DWC_ERROR("AES CBC encryption failed"); ++ return -1; ++ } ++ ++ crypto_free_blkcipher(tfm); ++ return 0; ++} ++ ++int DWC_SHA256(uint8_t *message, uint32_t len, uint8_t *out) ++{ ++ struct crypto_hash *tfm; ++ struct hash_desc desc; ++ struct scatterlist sg; ++ ++ tfm = crypto_alloc_hash("sha256", 0, CRYPTO_ALG_ASYNC); ++ if (IS_ERR(tfm)) { ++ DWC_ERROR("Failed to load transform for sha256: %ld", PTR_ERR(tfm)); ++ return 0; ++ } ++ desc.tfm = tfm; ++ desc.flags = 0; ++ ++ sg_init_one(&sg, message, len); ++ crypto_hash_digest(&desc, &sg, len, out); ++ crypto_free_hash(tfm); ++ ++ return 1; ++} ++ ++int DWC_HMAC_SHA256(uint8_t *message, uint32_t messagelen, ++ uint8_t *key, uint32_t keylen, uint8_t *out) ++{ ++ struct crypto_hash *tfm; ++ struct hash_desc desc; ++ struct scatterlist sg; ++ ++ tfm = crypto_alloc_hash("hmac(sha256)", 0, CRYPTO_ALG_ASYNC); ++ if (IS_ERR(tfm)) { ++ DWC_ERROR("Failed to load transform for hmac(sha256): %ld", PTR_ERR(tfm)); ++ return 0; ++ } ++ desc.tfm = tfm; ++ desc.flags = 0; ++ ++ sg_init_one(&sg, message, messagelen); ++ crypto_hash_setkey(tfm, key, keylen); ++ crypto_hash_digest(&desc, &sg, messagelen, out); ++ crypto_free_hash(tfm); ++ ++ return 1; ++} ++ ++#endif /* DWC_CRYPTOLIB */ ++ ++ ++/* Byte Ordering Conversions */ ++ ++uint32_t DWC_CPU_TO_LE32(uint32_t *p) ++{ ++#ifdef __LITTLE_ENDIAN ++ return *p; ++#else ++ uint8_t *u_p = (uint8_t *)p; ++ ++ return (u_p[3] | (u_p[2] << 8) | (u_p[1] << 16) | (u_p[0] << 24)); ++#endif ++} ++ ++uint32_t DWC_CPU_TO_BE32(uint32_t *p) ++{ ++#ifdef __BIG_ENDIAN ++ return *p; ++#else ++ uint8_t *u_p = (uint8_t *)p; ++ ++ return (u_p[3] | (u_p[2] << 8) | (u_p[1] << 16) | (u_p[0] << 24)); ++#endif ++} ++ ++uint32_t DWC_LE32_TO_CPU(uint32_t *p) ++{ ++#ifdef __LITTLE_ENDIAN ++ return *p; ++#else ++ uint8_t *u_p = (uint8_t *)p; ++ ++ return (u_p[3] | (u_p[2] << 8) | (u_p[1] << 16) | (u_p[0] << 24)); ++#endif ++} ++ ++uint32_t DWC_BE32_TO_CPU(uint32_t *p) ++{ ++#ifdef __BIG_ENDIAN ++ return *p; ++#else ++ uint8_t *u_p = (uint8_t *)p; ++ ++ return (u_p[3] | (u_p[2] << 8) | (u_p[1] << 16) | (u_p[0] << 24)); ++#endif ++} ++ ++uint16_t DWC_CPU_TO_LE16(uint16_t *p) ++{ ++#ifdef __LITTLE_ENDIAN ++ return *p; ++#else ++ uint8_t *u_p = (uint8_t *)p; ++ return (u_p[1] | (u_p[0] << 8)); ++#endif ++} ++ ++uint16_t DWC_CPU_TO_BE16(uint16_t *p) ++{ ++#ifdef __BIG_ENDIAN ++ return *p; ++#else ++ uint8_t *u_p = (uint8_t *)p; ++ return (u_p[1] | (u_p[0] << 8)); ++#endif ++} ++ ++uint16_t DWC_LE16_TO_CPU(uint16_t *p) ++{ ++#ifdef __LITTLE_ENDIAN ++ return *p; ++#else ++ uint8_t *u_p = (uint8_t *)p; ++ return (u_p[1] | (u_p[0] << 8)); ++#endif ++} ++ ++uint16_t DWC_BE16_TO_CPU(uint16_t *p) ++{ ++#ifdef __BIG_ENDIAN ++ return *p; ++#else ++ uint8_t *u_p = (uint8_t *)p; ++ return (u_p[1] | (u_p[0] << 8)); ++#endif ++} ++ ++ ++/* Registers */ ++ ++uint32_t DWC_READ_REG32(void *io_ctx, uint32_t volatile *reg) ++{ ++ dwc_ioctx_t *io = (dwc_ioctx_t *)io_ctx; ++ bus_size_t ior = (bus_size_t)reg; ++ ++ return bus_space_read_4(io->iot, io->ioh, ior); ++} ++ ++#if 0 ++uint64_t DWC_READ_REG64(void *io_ctx, uint64_t volatile *reg) ++{ ++ dwc_ioctx_t *io = (dwc_ioctx_t *)io_ctx; ++ bus_size_t ior = (bus_size_t)reg; ++ ++ return bus_space_read_8(io->iot, io->ioh, ior); ++} ++#endif ++ ++void DWC_WRITE_REG32(void *io_ctx, uint32_t volatile *reg, uint32_t value) ++{ ++ dwc_ioctx_t *io = (dwc_ioctx_t *)io_ctx; ++ bus_size_t ior = (bus_size_t)reg; ++ ++ bus_space_write_4(io->iot, io->ioh, ior, value); ++} ++ ++#if 0 ++void DWC_WRITE_REG64(void *io_ctx, uint64_t volatile *reg, uint64_t value) ++{ ++ dwc_ioctx_t *io = (dwc_ioctx_t *)io_ctx; ++ bus_size_t ior = (bus_size_t)reg; ++ ++ bus_space_write_8(io->iot, io->ioh, ior, value); ++} ++#endif ++ ++void DWC_MODIFY_REG32(void *io_ctx, uint32_t volatile *reg, uint32_t clear_mask, ++ uint32_t set_mask) ++{ ++ dwc_ioctx_t *io = (dwc_ioctx_t *)io_ctx; ++ bus_size_t ior = (bus_size_t)reg; ++ ++ bus_space_write_4(io->iot, io->ioh, ior, ++ (bus_space_read_4(io->iot, io->ioh, ior) & ++ ~clear_mask) | set_mask); ++} ++ ++#if 0 ++void DWC_MODIFY_REG64(void *io_ctx, uint64_t volatile *reg, uint64_t clear_mask, ++ uint64_t set_mask) ++{ ++ dwc_ioctx_t *io = (dwc_ioctx_t *)io_ctx; ++ bus_size_t ior = (bus_size_t)reg; ++ ++ bus_space_write_8(io->iot, io->ioh, ior, ++ (bus_space_read_8(io->iot, io->ioh, ior) & ++ ~clear_mask) | set_mask); ++} ++#endif ++ ++ ++/* Locking */ ++ ++dwc_spinlock_t *DWC_SPINLOCK_ALLOC(void) ++{ ++ struct mtx *sl = DWC_ALLOC(sizeof(*sl)); ++ ++ if (!sl) { ++ DWC_ERROR("Cannot allocate memory for spinlock"); ++ return NULL; ++ } ++ ++ mtx_init(sl, "dw3spn", NULL, MTX_SPIN); ++ return (dwc_spinlock_t *)sl; ++} ++ ++void DWC_SPINLOCK_FREE(dwc_spinlock_t *lock) ++{ ++ struct mtx *sl = (struct mtx *)lock; ++ ++ mtx_destroy(sl); ++ DWC_FREE(sl); ++} ++ ++void DWC_SPINLOCK(dwc_spinlock_t *lock) ++{ ++ mtx_lock_spin((struct mtx *)lock); // ??? ++} ++ ++void DWC_SPINUNLOCK(dwc_spinlock_t *lock) ++{ ++ mtx_unlock_spin((struct mtx *)lock); // ??? ++} ++ ++void DWC_SPINLOCK_IRQSAVE(dwc_spinlock_t *lock, dwc_irqflags_t *flags) ++{ ++ mtx_lock_spin((struct mtx *)lock); ++} ++ ++void DWC_SPINUNLOCK_IRQRESTORE(dwc_spinlock_t *lock, dwc_irqflags_t flags) ++{ ++ mtx_unlock_spin((struct mtx *)lock); ++} ++ ++dwc_mutex_t *DWC_MUTEX_ALLOC(void) ++{ ++ struct mtx *m; ++ dwc_mutex_t *mutex = (dwc_mutex_t *)DWC_ALLOC(sizeof(struct mtx)); ++ ++ if (!mutex) { ++ DWC_ERROR("Cannot allocate memory for mutex"); ++ return NULL; ++ } ++ ++ m = (struct mtx *)mutex; ++ mtx_init(m, "dw3mtx", NULL, MTX_DEF); ++ return mutex; ++} ++ ++#if (defined(DWC_LINUX) && defined(CONFIG_DEBUG_MUTEXES)) ++#else ++void DWC_MUTEX_FREE(dwc_mutex_t *mutex) ++{ ++ mtx_destroy((struct mtx *)mutex); ++ DWC_FREE(mutex); ++} ++#endif ++ ++void DWC_MUTEX_LOCK(dwc_mutex_t *mutex) ++{ ++ struct mtx *m = (struct mtx *)mutex; ++ ++ mtx_lock(m); ++} ++ ++int DWC_MUTEX_TRYLOCK(dwc_mutex_t *mutex) ++{ ++ struct mtx *m = (struct mtx *)mutex; ++ ++ return mtx_trylock(m); ++} ++ ++void DWC_MUTEX_UNLOCK(dwc_mutex_t *mutex) ++{ ++ struct mtx *m = (struct mtx *)mutex; ++ ++ mtx_unlock(m); ++} ++ ++ ++/* Timing */ ++ ++void DWC_UDELAY(uint32_t usecs) ++{ ++ DELAY(usecs); ++} ++ ++void DWC_MDELAY(uint32_t msecs) ++{ ++ do { ++ DELAY(1000); ++ } while (--msecs); ++} ++ ++void DWC_MSLEEP(uint32_t msecs) ++{ ++ struct timeval tv; ++ ++ tv.tv_sec = msecs / 1000; ++ tv.tv_usec = (msecs - tv.tv_sec * 1000) * 1000; ++ pause("dw3slp", tvtohz(&tv)); ++} ++ ++uint32_t DWC_TIME(void) ++{ ++ struct timeval tv; ++ ++ microuptime(&tv); // or getmicrouptime? (less precise, but faster) ++ return tv.tv_sec * 1000 + tv.tv_usec / 1000; ++} ++ ++ ++/* Timers */ ++ ++struct dwc_timer { ++ struct callout t; ++ char *name; ++ dwc_spinlock_t *lock; ++ dwc_timer_callback_t cb; ++ void *data; ++}; ++ ++dwc_timer_t *DWC_TIMER_ALLOC(char *name, dwc_timer_callback_t cb, void *data) ++{ ++ dwc_timer_t *t = DWC_ALLOC(sizeof(*t)); ++ ++ if (!t) { ++ DWC_ERROR("Cannot allocate memory for timer"); ++ return NULL; ++ } ++ ++ callout_init(&t->t, 1); ++ ++ t->name = DWC_STRDUP(name); ++ if (!t->name) { ++ DWC_ERROR("Cannot allocate memory for timer->name"); ++ goto no_name; ++ } ++ ++ t->lock = DWC_SPINLOCK_ALLOC(); ++ if (!t->lock) { ++ DWC_ERROR("Cannot allocate memory for lock"); ++ goto no_lock; ++ } ++ ++ t->cb = cb; ++ t->data = data; ++ ++ return t; ++ ++ no_lock: ++ DWC_FREE(t->name); ++ no_name: ++ DWC_FREE(t); ++ ++ return NULL; ++} ++ ++void DWC_TIMER_FREE(dwc_timer_t *timer) ++{ ++ callout_stop(&timer->t); ++ DWC_SPINLOCK_FREE(timer->lock); ++ DWC_FREE(timer->name); ++ DWC_FREE(timer); ++} ++ ++void DWC_TIMER_SCHEDULE(dwc_timer_t *timer, uint32_t time) ++{ ++ struct timeval tv; ++ ++ tv.tv_sec = time / 1000; ++ tv.tv_usec = (time - tv.tv_sec * 1000) * 1000; ++ callout_reset(&timer->t, tvtohz(&tv), timer->cb, timer->data); ++} ++ ++void DWC_TIMER_CANCEL(dwc_timer_t *timer) ++{ ++ callout_stop(&timer->t); ++} ++ ++ ++/* Wait Queues */ ++ ++struct dwc_waitq { ++ struct mtx lock; ++ int abort; ++}; ++ ++dwc_waitq_t *DWC_WAITQ_ALLOC(void) ++{ ++ dwc_waitq_t *wq = DWC_ALLOC(sizeof(*wq)); ++ ++ if (!wq) { ++ DWC_ERROR("Cannot allocate memory for waitqueue"); ++ return NULL; ++ } ++ ++ mtx_init(&wq->lock, "dw3wtq", NULL, MTX_DEF); ++ wq->abort = 0; ++ ++ return wq; ++} ++ ++void DWC_WAITQ_FREE(dwc_waitq_t *wq) ++{ ++ mtx_destroy(&wq->lock); ++ DWC_FREE(wq); ++} ++ ++int32_t DWC_WAITQ_WAIT(dwc_waitq_t *wq, dwc_waitq_condition_t cond, void *data) ++{ ++// intrmask_t ipl; ++ int result = 0; ++ ++ mtx_lock(&wq->lock); ++// ipl = splbio(); ++ ++ /* Skip the sleep if already aborted or triggered */ ++ if (!wq->abort && !cond(data)) { ++// splx(ipl); ++ result = msleep(wq, &wq->lock, PCATCH, "dw3wat", 0); // infinite timeout ++// ipl = splbio(); ++ } ++ ++ if (result == ERESTART) { // signaled - restart ++ result = -DWC_E_RESTART; ++ ++ } else if (result == EINTR) { // signaled - interrupt ++ result = -DWC_E_ABORT; ++ ++ } else if (wq->abort) { ++ result = -DWC_E_ABORT; ++ ++ } else { ++ result = 0; ++ } ++ ++ wq->abort = 0; ++// splx(ipl); ++ mtx_unlock(&wq->lock); ++ return result; ++} ++ ++int32_t DWC_WAITQ_WAIT_TIMEOUT(dwc_waitq_t *wq, dwc_waitq_condition_t cond, ++ void *data, int32_t msecs) ++{ ++ struct timeval tv, tv1, tv2; ++// intrmask_t ipl; ++ int result = 0; ++ ++ tv.tv_sec = msecs / 1000; ++ tv.tv_usec = (msecs - tv.tv_sec * 1000) * 1000; ++ ++ mtx_lock(&wq->lock); ++// ipl = splbio(); ++ ++ /* Skip the sleep if already aborted or triggered */ ++ if (!wq->abort && !cond(data)) { ++// splx(ipl); ++ getmicrouptime(&tv1); ++ result = msleep(wq, &wq->lock, PCATCH, "dw3wto", tvtohz(&tv)); ++ getmicrouptime(&tv2); ++// ipl = splbio(); ++ } ++ ++ if (result == 0) { // awoken ++ if (wq->abort) { ++ result = -DWC_E_ABORT; ++ } else { ++ tv2.tv_usec -= tv1.tv_usec; ++ if (tv2.tv_usec < 0) { ++ tv2.tv_usec += 1000000; ++ tv2.tv_sec--; ++ } ++ ++ tv2.tv_sec -= tv1.tv_sec; ++ result = tv2.tv_sec * 1000 + tv2.tv_usec / 1000; ++ result = msecs - result; ++ if (result <= 0) ++ result = 1; ++ } ++ } else if (result == ERESTART) { // signaled - restart ++ result = -DWC_E_RESTART; ++ ++ } else if (result == EINTR) { // signaled - interrupt ++ result = -DWC_E_ABORT; ++ ++ } else { // timed out ++ result = -DWC_E_TIMEOUT; ++ } ++ ++ wq->abort = 0; ++// splx(ipl); ++ mtx_unlock(&wq->lock); ++ return result; ++} ++ ++void DWC_WAITQ_TRIGGER(dwc_waitq_t *wq) ++{ ++ wakeup(wq); ++} ++ ++void DWC_WAITQ_ABORT(dwc_waitq_t *wq) ++{ ++// intrmask_t ipl; ++ ++ mtx_lock(&wq->lock); ++// ipl = splbio(); ++ wq->abort = 1; ++ wakeup(wq); ++// splx(ipl); ++ mtx_unlock(&wq->lock); ++} ++ ++ ++/* Threading */ ++ ++struct dwc_thread { ++ struct proc *proc; ++ int abort; ++}; ++ ++dwc_thread_t *DWC_THREAD_RUN(dwc_thread_function_t func, char *name, void *data) ++{ ++ int retval; ++ dwc_thread_t *thread = DWC_ALLOC(sizeof(*thread)); ++ ++ if (!thread) { ++ return NULL; ++ } ++ ++ thread->abort = 0; ++ retval = kthread_create((void (*)(void *))func, data, &thread->proc, ++ RFPROC | RFNOWAIT, 0, "%s", name); ++ if (retval) { ++ DWC_FREE(thread); ++ return NULL; ++ } ++ ++ return thread; ++} ++ ++int DWC_THREAD_STOP(dwc_thread_t *thread) ++{ ++ int retval; ++ ++ thread->abort = 1; ++ retval = tsleep(&thread->abort, 0, "dw3stp", 60 * hz); ++ ++ if (retval == 0) { ++ /* DWC_THREAD_EXIT() will free the thread struct */ ++ return 0; ++ } ++ ++ /* NOTE: We leak the thread struct if thread doesn't die */ ++ ++ if (retval == EWOULDBLOCK) { ++ return -DWC_E_TIMEOUT; ++ } ++ ++ return -DWC_E_UNKNOWN; ++} ++ ++dwc_bool_t DWC_THREAD_SHOULD_STOP(dwc_thread_t *thread) ++{ ++ return thread->abort; ++} ++ ++void DWC_THREAD_EXIT(dwc_thread_t *thread) ++{ ++ wakeup(&thread->abort); ++ DWC_FREE(thread); ++ kthread_exit(0); ++} ++ ++ ++/* tasklets ++ - Runs in interrupt context (cannot sleep) ++ - Each tasklet runs on a single CPU [ How can we ensure this on FreeBSD? Does it matter? ] ++ - Different tasklets can be running simultaneously on different CPUs [ shouldn't matter ] ++ */ ++struct dwc_tasklet { ++ struct task t; ++ dwc_tasklet_callback_t cb; ++ void *data; ++}; ++ ++static void tasklet_callback(void *data, int pending) // what to do with pending ??? ++{ ++ dwc_tasklet_t *task = (dwc_tasklet_t *)data; ++ ++ task->cb(task->data); ++} ++ ++dwc_tasklet_t *DWC_TASK_ALLOC(char *name, dwc_tasklet_callback_t cb, void *data) ++{ ++ dwc_tasklet_t *task = DWC_ALLOC(sizeof(*task)); ++ ++ if (task) { ++ task->cb = cb; ++ task->data = data; ++ TASK_INIT(&task->t, 0, tasklet_callback, task); ++ } else { ++ DWC_ERROR("Cannot allocate memory for tasklet"); ++ } ++ ++ return task; ++} ++ ++void DWC_TASK_FREE(dwc_tasklet_t *task) ++{ ++ taskqueue_drain(taskqueue_fast, &task->t); // ??? ++ DWC_FREE(task); ++} ++ ++void DWC_TASK_SCHEDULE(dwc_tasklet_t *task) ++{ ++ /* Uses predefined system queue */ ++ taskqueue_enqueue_fast(taskqueue_fast, &task->t); ++} ++ ++ ++/* workqueues ++ - Runs in process context (can sleep) ++ */ ++typedef struct work_container { ++ dwc_work_callback_t cb; ++ void *data; ++ dwc_workq_t *wq; ++ char *name; ++ int hz; ++ ++#ifdef DEBUG ++ DWC_CIRCLEQ_ENTRY(work_container) entry; ++#endif ++ struct task task; ++} work_container_t; ++ ++#ifdef DEBUG ++DWC_CIRCLEQ_HEAD(work_container_queue, work_container); ++#endif ++ ++struct dwc_workq { ++ struct taskqueue *taskq; ++ dwc_spinlock_t *lock; ++ dwc_waitq_t *waitq; ++ int pending; ++ ++#ifdef DEBUG ++ struct work_container_queue entries; ++#endif ++}; ++ ++static void do_work(void *data, int pending) // what to do with pending ??? ++{ ++ work_container_t *container = (work_container_t *)data; ++ dwc_workq_t *wq = container->wq; ++ dwc_irqflags_t flags; ++ ++ if (container->hz) { ++ pause("dw3wrk", container->hz); ++ } ++ ++ container->cb(container->data); ++ DWC_DEBUG("Work done: %s, container=%p", container->name, container); ++ ++ DWC_SPINLOCK_IRQSAVE(wq->lock, &flags); ++ ++#ifdef DEBUG ++ DWC_CIRCLEQ_REMOVE(&wq->entries, container, entry); ++#endif ++ if (container->name) ++ DWC_FREE(container->name); ++ DWC_FREE(container); ++ wq->pending--; ++ DWC_SPINUNLOCK_IRQRESTORE(wq->lock, flags); ++ DWC_WAITQ_TRIGGER(wq->waitq); ++} ++ ++static int work_done(void *data) ++{ ++ dwc_workq_t *workq = (dwc_workq_t *)data; ++ ++ return workq->pending == 0; ++} ++ ++int DWC_WORKQ_WAIT_WORK_DONE(dwc_workq_t *workq, int timeout) ++{ ++ return DWC_WAITQ_WAIT_TIMEOUT(workq->waitq, work_done, workq, timeout); ++} ++ ++dwc_workq_t *DWC_WORKQ_ALLOC(char *name) ++{ ++ dwc_workq_t *wq = DWC_ALLOC(sizeof(*wq)); ++ ++ if (!wq) { ++ DWC_ERROR("Cannot allocate memory for workqueue"); ++ return NULL; ++ } ++ ++ wq->taskq = taskqueue_create(name, M_NOWAIT, taskqueue_thread_enqueue, &wq->taskq); ++ if (!wq->taskq) { ++ DWC_ERROR("Cannot allocate memory for taskqueue"); ++ goto no_taskq; ++ } ++ ++ wq->pending = 0; ++ ++ wq->lock = DWC_SPINLOCK_ALLOC(); ++ if (!wq->lock) { ++ DWC_ERROR("Cannot allocate memory for spinlock"); ++ goto no_lock; ++ } ++ ++ wq->waitq = DWC_WAITQ_ALLOC(); ++ if (!wq->waitq) { ++ DWC_ERROR("Cannot allocate memory for waitqueue"); ++ goto no_waitq; ++ } ++ ++ taskqueue_start_threads(&wq->taskq, 1, PWAIT, "%s taskq", "dw3tsk"); ++ ++#ifdef DEBUG ++ DWC_CIRCLEQ_INIT(&wq->entries); ++#endif ++ return wq; ++ ++ no_waitq: ++ DWC_SPINLOCK_FREE(wq->lock); ++ no_lock: ++ taskqueue_free(wq->taskq); ++ no_taskq: ++ DWC_FREE(wq); ++ ++ return NULL; ++} ++ ++void DWC_WORKQ_FREE(dwc_workq_t *wq) ++{ ++#ifdef DEBUG ++ dwc_irqflags_t flags; ++ ++ DWC_SPINLOCK_IRQSAVE(wq->lock, &flags); ++ ++ if (wq->pending != 0) { ++ struct work_container *container; ++ ++ DWC_ERROR("Destroying work queue with pending work"); ++ ++ DWC_CIRCLEQ_FOREACH(container, &wq->entries, entry) { ++ DWC_ERROR("Work %s still pending", container->name); ++ } ++ } ++ ++ DWC_SPINUNLOCK_IRQRESTORE(wq->lock, flags); ++#endif ++ DWC_WAITQ_FREE(wq->waitq); ++ DWC_SPINLOCK_FREE(wq->lock); ++ taskqueue_free(wq->taskq); ++ DWC_FREE(wq); ++} ++ ++void DWC_WORKQ_SCHEDULE(dwc_workq_t *wq, dwc_work_callback_t cb, void *data, ++ char *format, ...) ++{ ++ dwc_irqflags_t flags; ++ work_container_t *container; ++ static char name[128]; ++ va_list args; ++ ++ va_start(args, format); ++ DWC_VSNPRINTF(name, 128, format, args); ++ va_end(args); ++ ++ DWC_SPINLOCK_IRQSAVE(wq->lock, &flags); ++ wq->pending++; ++ DWC_SPINUNLOCK_IRQRESTORE(wq->lock, flags); ++ DWC_WAITQ_TRIGGER(wq->waitq); ++ ++ container = DWC_ALLOC_ATOMIC(sizeof(*container)); ++ if (!container) { ++ DWC_ERROR("Cannot allocate memory for container"); ++ return; ++ } ++ ++ container->name = DWC_STRDUP(name); ++ if (!container->name) { ++ DWC_ERROR("Cannot allocate memory for container->name"); ++ DWC_FREE(container); ++ return; ++ } ++ ++ container->cb = cb; ++ container->data = data; ++ container->wq = wq; ++ container->hz = 0; ++ ++ DWC_DEBUG("Queueing work: %s, container=%p", container->name, container); ++ ++ TASK_INIT(&container->task, 0, do_work, container); ++ ++#ifdef DEBUG ++ DWC_CIRCLEQ_INSERT_TAIL(&wq->entries, container, entry); ++#endif ++ taskqueue_enqueue_fast(wq->taskq, &container->task); ++} ++ ++void DWC_WORKQ_SCHEDULE_DELAYED(dwc_workq_t *wq, dwc_work_callback_t cb, ++ void *data, uint32_t time, char *format, ...) ++{ ++ dwc_irqflags_t flags; ++ work_container_t *container; ++ static char name[128]; ++ struct timeval tv; ++ va_list args; ++ ++ va_start(args, format); ++ DWC_VSNPRINTF(name, 128, format, args); ++ va_end(args); ++ ++ DWC_SPINLOCK_IRQSAVE(wq->lock, &flags); ++ wq->pending++; ++ DWC_SPINUNLOCK_IRQRESTORE(wq->lock, flags); ++ DWC_WAITQ_TRIGGER(wq->waitq); ++ ++ container = DWC_ALLOC_ATOMIC(sizeof(*container)); ++ if (!container) { ++ DWC_ERROR("Cannot allocate memory for container"); ++ return; ++ } ++ ++ container->name = DWC_STRDUP(name); ++ if (!container->name) { ++ DWC_ERROR("Cannot allocate memory for container->name"); ++ DWC_FREE(container); ++ return; ++ } ++ ++ container->cb = cb; ++ container->data = data; ++ container->wq = wq; ++ ++ tv.tv_sec = time / 1000; ++ tv.tv_usec = (time - tv.tv_sec * 1000) * 1000; ++ container->hz = tvtohz(&tv); ++ ++ DWC_DEBUG("Queueing work: %s, container=%p", container->name, container); ++ ++ TASK_INIT(&container->task, 0, do_work, container); ++ ++#ifdef DEBUG ++ DWC_CIRCLEQ_INSERT_TAIL(&wq->entries, container, entry); ++#endif ++ taskqueue_enqueue_fast(wq->taskq, &container->task); ++} ++ ++int DWC_WORKQ_PENDING(dwc_workq_t *wq) ++{ ++ return wq->pending; ++} +diff --git a/drivers/usb/host/dwc_common_port/dwc_common_linux.c b/drivers/usb/host/dwc_common_port/dwc_common_linux.c +new file mode 100644 +index 0000000..4664684 +--- /dev/null ++++ b/drivers/usb/host/dwc_common_port/dwc_common_linux.c +@@ -0,0 +1,1433 @@ ++#include <linux/kernel.h> ++#include <linux/init.h> ++#include <linux/module.h> ++#include <linux/kthread.h> ++ ++#ifdef DWC_CCLIB ++# include "dwc_cc.h" ++#endif ++ ++#ifdef DWC_CRYPTOLIB ++# include "dwc_modpow.h" ++# include "dwc_dh.h" ++# include "dwc_crypto.h" ++#endif ++ ++#ifdef DWC_NOTIFYLIB ++# include "dwc_notifier.h" ++#endif ++ ++/* OS-Level Implementations */ ++ ++/* This is the Linux kernel implementation of the DWC platform library. */ ++#include <linux/moduleparam.h> ++#include <linux/ctype.h> ++#include <linux/crypto.h> ++#include <linux/delay.h> ++#include <linux/device.h> ++#include <linux/dma-mapping.h> ++#include <linux/cdev.h> ++#include <linux/errno.h> ++#include <linux/interrupt.h> ++#include <linux/jiffies.h> ++#include <linux/list.h> ++#include <linux/pci.h> ++#include <linux/random.h> ++#include <linux/scatterlist.h> ++#include <linux/slab.h> ++#include <linux/stat.h> ++#include <linux/string.h> ++#include <linux/timer.h> ++#include <linux/usb.h> ++ ++#include <linux/version.h> ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24) ++# include <linux/usb/gadget.h> ++#else ++# include <linux/usb_gadget.h> ++#endif ++ ++#include <asm/io.h> ++#include <asm/page.h> ++#include <asm/uaccess.h> ++#include <asm/unaligned.h> ++ ++#include "dwc_os.h" ++#include "dwc_list.h" ++ ++ ++/* MISC */ ++ ++void *DWC_MEMSET(void *dest, uint8_t byte, uint32_t size) ++{ ++ return memset(dest, byte, size); ++} ++ ++void *DWC_MEMCPY(void *dest, void const *src, uint32_t size) ++{ ++ return memcpy(dest, src, size); ++} ++ ++void *DWC_MEMMOVE(void *dest, void *src, uint32_t size) ++{ ++ return memmove(dest, src, size); ++} ++ ++int DWC_MEMCMP(void *m1, void *m2, uint32_t size) ++{ ++ return memcmp(m1, m2, size); ++} ++ ++int DWC_STRNCMP(void *s1, void *s2, uint32_t size) ++{ ++ return strncmp(s1, s2, size); ++} ++ ++int DWC_STRCMP(void *s1, void *s2) ++{ ++ return strcmp(s1, s2); ++} ++ ++int DWC_STRLEN(char const *str) ++{ ++ return strlen(str); ++} ++ ++char *DWC_STRCPY(char *to, char const *from) ++{ ++ return strcpy(to, from); ++} ++ ++char *DWC_STRDUP(char const *str) ++{ ++ int len = DWC_STRLEN(str) + 1; ++ char *new = DWC_ALLOC_ATOMIC(len); ++ ++ if (!new) { ++ return NULL; ++ } ++ ++ DWC_MEMCPY(new, str, len); ++ return new; ++} ++ ++int DWC_ATOI(const char *str, int32_t *value) ++{ ++ char *end = NULL; ++ ++ *value = simple_strtol(str, &end, 0); ++ if (*end == '\0') { ++ return 0; ++ } ++ ++ return -1; ++} ++ ++int DWC_ATOUI(const char *str, uint32_t *value) ++{ ++ char *end = NULL; ++ ++ *value = simple_strtoul(str, &end, 0); ++ if (*end == '\0') { ++ return 0; ++ } ++ ++ return -1; ++} ++ ++ ++#ifdef DWC_UTFLIB ++/* From usbstring.c */ ++ ++int DWC_UTF8_TO_UTF16LE(uint8_t const *s, uint16_t *cp, unsigned len) ++{ ++ int count = 0; ++ u8 c; ++ u16 uchar; ++ ++ /* this insists on correct encodings, though not minimal ones. ++ * BUT it currently rejects legit 4-byte UTF-8 code points, ++ * which need surrogate pairs. (Unicode 3.1 can use them.) ++ */ ++ while (len != 0 && (c = (u8) *s++) != 0) { ++ if (unlikely(c & 0x80)) { ++ // 2-byte sequence: ++ // 00000yyyyyxxxxxx = 110yyyyy 10xxxxxx ++ if ((c & 0xe0) == 0xc0) { ++ uchar = (c & 0x1f) << 6; ++ ++ c = (u8) *s++; ++ if ((c & 0xc0) != 0xc0) ++ goto fail; ++ c &= 0x3f; ++ uchar |= c; ++ ++ // 3-byte sequence (most CJKV characters): ++ // zzzzyyyyyyxxxxxx = 1110zzzz 10yyyyyy 10xxxxxx ++ } else if ((c & 0xf0) == 0xe0) { ++ uchar = (c & 0x0f) << 12; ++ ++ c = (u8) *s++; ++ if ((c & 0xc0) != 0xc0) ++ goto fail; ++ c &= 0x3f; ++ uchar |= c << 6; ++ ++ c = (u8) *s++; ++ if ((c & 0xc0) != 0xc0) ++ goto fail; ++ c &= 0x3f; ++ uchar |= c; ++ ++ /* no bogus surrogates */ ++ if (0xd800 <= uchar && uchar <= 0xdfff) ++ goto fail; ++ ++ // 4-byte sequence (surrogate pairs, currently rare): ++ // 11101110wwwwzzzzyy + 110111yyyyxxxxxx ++ // = 11110uuu 10uuzzzz 10yyyyyy 10xxxxxx ++ // (uuuuu = wwww + 1) ++ // FIXME accept the surrogate code points (only) ++ } else ++ goto fail; ++ } else ++ uchar = c; ++ put_unaligned (cpu_to_le16 (uchar), cp++); ++ count++; ++ len--; ++ } ++ return count; ++fail: ++ return -1; ++} ++#endif /* DWC_UTFLIB */ ++ ++ ++/* dwc_debug.h */ ++ ++dwc_bool_t DWC_IN_IRQ(void) ++{ ++ return in_irq(); ++} ++ ++dwc_bool_t DWC_IN_BH(void) ++{ ++ return in_softirq(); ++} ++ ++void DWC_VPRINTF(char *format, va_list args) ++{ ++ vprintk(format, args); ++} ++ ++int DWC_VSNPRINTF(char *str, int size, char *format, va_list args) ++{ ++ return vsnprintf(str, size, format, args); ++} ++ ++void DWC_PRINTF(char *format, ...) ++{ ++ va_list args; ++ ++ va_start(args, format); ++ DWC_VPRINTF(format, args); ++ va_end(args); ++} ++ ++int DWC_SPRINTF(char *buffer, char *format, ...) ++{ ++ int retval; ++ va_list args; ++ ++ va_start(args, format); ++ retval = vsprintf(buffer, format, args); ++ va_end(args); ++ return retval; ++} ++ ++int DWC_SNPRINTF(char *buffer, int size, char *format, ...) ++{ ++ int retval; ++ va_list args; ++ ++ va_start(args, format); ++ retval = vsnprintf(buffer, size, format, args); ++ va_end(args); ++ return retval; ++} ++ ++void __DWC_WARN(char *format, ...) ++{ ++ va_list args; ++ ++ va_start(args, format); ++ DWC_PRINTF(KERN_WARNING); ++ DWC_VPRINTF(format, args); ++ va_end(args); ++} ++ ++void __DWC_ERROR(char *format, ...) ++{ ++ va_list args; ++ ++ va_start(args, format); ++ DWC_PRINTF(KERN_ERR); ++ DWC_VPRINTF(format, args); ++ va_end(args); ++} ++ ++void DWC_EXCEPTION(char *format, ...) ++{ ++ va_list args; ++ ++ va_start(args, format); ++ DWC_PRINTF(KERN_ERR); ++ DWC_VPRINTF(format, args); ++ va_end(args); ++ BUG_ON(1); ++} ++ ++#ifdef DEBUG ++void __DWC_DEBUG(char *format, ...) ++{ ++ va_list args; ++ ++ va_start(args, format); ++ DWC_PRINTF(KERN_DEBUG); ++ DWC_VPRINTF(format, args); ++ va_end(args); ++} ++#endif ++ ++ ++/* dwc_mem.h */ ++ ++#if 0 ++dwc_pool_t *DWC_DMA_POOL_CREATE(uint32_t size, ++ uint32_t align, ++ uint32_t alloc) ++{ ++ struct dma_pool *pool = dma_pool_create("Pool", NULL, ++ size, align, alloc); ++ return (dwc_pool_t *)pool; ++} ++ ++void DWC_DMA_POOL_DESTROY(dwc_pool_t *pool) ++{ ++ dma_pool_destroy((struct dma_pool *)pool); ++} ++ ++void *DWC_DMA_POOL_ALLOC(dwc_pool_t *pool, uint64_t *dma_addr) ++{ ++ return dma_pool_alloc((struct dma_pool *)pool, GFP_KERNEL, dma_addr); ++} ++ ++void *DWC_DMA_POOL_ZALLOC(dwc_pool_t *pool, uint64_t *dma_addr) ++{ ++ void *vaddr = DWC_DMA_POOL_ALLOC(pool, dma_addr); ++ memset(..); ++} ++ ++void DWC_DMA_POOL_FREE(dwc_pool_t *pool, void *vaddr, void *daddr) ++{ ++ dma_pool_free(pool, vaddr, daddr); ++} ++#endif ++ ++void *__DWC_DMA_ALLOC(void *dma_ctx, uint32_t size, dwc_dma_t *dma_addr) ++{ ++#ifdef xxCOSIM /* Only works for 32-bit cosim */ ++ void *buf = dma_alloc_coherent(dma_ctx, (size_t)size, dma_addr, GFP_KERNEL); ++#else ++ void *buf = dma_alloc_coherent(dma_ctx, (size_t)size, dma_addr, GFP_KERNEL | GFP_DMA32); ++#endif ++ if (!buf) { ++ return NULL; ++ } ++ ++ memset(buf, 0, (size_t)size); ++ return buf; ++} ++ ++void *__DWC_DMA_ALLOC_ATOMIC(void *dma_ctx, uint32_t size, dwc_dma_t *dma_addr) ++{ ++ void *buf = dma_alloc_coherent(NULL, (size_t)size, dma_addr, GFP_ATOMIC); ++ if (!buf) { ++ return NULL; ++ } ++ memset(buf, 0, (size_t)size); ++ return buf; ++} ++ ++void __DWC_DMA_FREE(void *dma_ctx, uint32_t size, void *virt_addr, dwc_dma_t dma_addr) ++{ ++ dma_free_coherent(dma_ctx, size, virt_addr, dma_addr); ++} ++ ++void *__DWC_ALLOC(void *mem_ctx, uint32_t size) ++{ ++ return kzalloc(size, GFP_KERNEL); ++} ++ ++void *__DWC_ALLOC_ATOMIC(void *mem_ctx, uint32_t size) ++{ ++ return kzalloc(size, GFP_ATOMIC); ++} ++ ++void __DWC_FREE(void *mem_ctx, void *addr) ++{ ++ kfree(addr); ++} ++ ++ ++#ifdef DWC_CRYPTOLIB ++/* dwc_crypto.h */ ++ ++void DWC_RANDOM_BYTES(uint8_t *buffer, uint32_t length) ++{ ++ get_random_bytes(buffer, length); ++} ++ ++int DWC_AES_CBC(uint8_t *message, uint32_t messagelen, uint8_t *key, uint32_t keylen, uint8_t iv[16], uint8_t *out) ++{ ++ struct crypto_blkcipher *tfm; ++ struct blkcipher_desc desc; ++ struct scatterlist sgd; ++ struct scatterlist sgs; ++ ++ tfm = crypto_alloc_blkcipher("cbc(aes)", 0, CRYPTO_ALG_ASYNC); ++ if (tfm == NULL) { ++ printk("failed to load transform for aes CBC\n"); ++ return -1; ++ } ++ ++ crypto_blkcipher_setkey(tfm, key, keylen); ++ crypto_blkcipher_set_iv(tfm, iv, 16); ++ ++ sg_init_one(&sgd, out, messagelen); ++ sg_init_one(&sgs, message, messagelen); ++ ++ desc.tfm = tfm; ++ desc.flags = 0; ++ ++ if (crypto_blkcipher_encrypt(&desc, &sgd, &sgs, messagelen)) { ++ crypto_free_blkcipher(tfm); ++ DWC_ERROR("AES CBC encryption failed"); ++ return -1; ++ } ++ ++ crypto_free_blkcipher(tfm); ++ return 0; ++} ++ ++int DWC_SHA256(uint8_t *message, uint32_t len, uint8_t *out) ++{ ++ struct crypto_hash *tfm; ++ struct hash_desc desc; ++ struct scatterlist sg; ++ ++ tfm = crypto_alloc_hash("sha256", 0, CRYPTO_ALG_ASYNC); ++ if (IS_ERR(tfm)) { ++ DWC_ERROR("Failed to load transform for sha256: %ld\n", PTR_ERR(tfm)); ++ return 0; ++ } ++ desc.tfm = tfm; ++ desc.flags = 0; ++ ++ sg_init_one(&sg, message, len); ++ crypto_hash_digest(&desc, &sg, len, out); ++ crypto_free_hash(tfm); ++ ++ return 1; ++} ++ ++int DWC_HMAC_SHA256(uint8_t *message, uint32_t messagelen, ++ uint8_t *key, uint32_t keylen, uint8_t *out) ++{ ++ struct crypto_hash *tfm; ++ struct hash_desc desc; ++ struct scatterlist sg; ++ ++ tfm = crypto_alloc_hash("hmac(sha256)", 0, CRYPTO_ALG_ASYNC); ++ if (IS_ERR(tfm)) { ++ DWC_ERROR("Failed to load transform for hmac(sha256): %ld\n", PTR_ERR(tfm)); ++ return 0; ++ } ++ desc.tfm = tfm; ++ desc.flags = 0; ++ ++ sg_init_one(&sg, message, messagelen); ++ crypto_hash_setkey(tfm, key, keylen); ++ crypto_hash_digest(&desc, &sg, messagelen, out); ++ crypto_free_hash(tfm); ++ ++ return 1; ++} ++#endif /* DWC_CRYPTOLIB */ ++ ++ ++/* Byte Ordering Conversions */ ++ ++uint32_t DWC_CPU_TO_LE32(uint32_t *p) ++{ ++#ifdef __LITTLE_ENDIAN ++ return *p; ++#else ++ uint8_t *u_p = (uint8_t *)p; ++ ++ return (u_p[3] | (u_p[2] << 8) | (u_p[1] << 16) | (u_p[0] << 24)); ++#endif ++} ++ ++uint32_t DWC_CPU_TO_BE32(uint32_t *p) ++{ ++#ifdef __BIG_ENDIAN ++ return *p; ++#else ++ uint8_t *u_p = (uint8_t *)p; ++ ++ return (u_p[3] | (u_p[2] << 8) | (u_p[1] << 16) | (u_p[0] << 24)); ++#endif ++} ++ ++uint32_t DWC_LE32_TO_CPU(uint32_t *p) ++{ ++#ifdef __LITTLE_ENDIAN ++ return *p; ++#else ++ uint8_t *u_p = (uint8_t *)p; ++ ++ return (u_p[3] | (u_p[2] << 8) | (u_p[1] << 16) | (u_p[0] << 24)); ++#endif ++} ++ ++uint32_t DWC_BE32_TO_CPU(uint32_t *p) ++{ ++#ifdef __BIG_ENDIAN ++ return *p; ++#else ++ uint8_t *u_p = (uint8_t *)p; ++ ++ return (u_p[3] | (u_p[2] << 8) | (u_p[1] << 16) | (u_p[0] << 24)); ++#endif ++} ++ ++uint16_t DWC_CPU_TO_LE16(uint16_t *p) ++{ ++#ifdef __LITTLE_ENDIAN ++ return *p; ++#else ++ uint8_t *u_p = (uint8_t *)p; ++ return (u_p[1] | (u_p[0] << 8)); ++#endif ++} ++ ++uint16_t DWC_CPU_TO_BE16(uint16_t *p) ++{ ++#ifdef __BIG_ENDIAN ++ return *p; ++#else ++ uint8_t *u_p = (uint8_t *)p; ++ return (u_p[1] | (u_p[0] << 8)); ++#endif ++} ++ ++uint16_t DWC_LE16_TO_CPU(uint16_t *p) ++{ ++#ifdef __LITTLE_ENDIAN ++ return *p; ++#else ++ uint8_t *u_p = (uint8_t *)p; ++ return (u_p[1] | (u_p[0] << 8)); ++#endif ++} ++ ++uint16_t DWC_BE16_TO_CPU(uint16_t *p) ++{ ++#ifdef __BIG_ENDIAN ++ return *p; ++#else ++ uint8_t *u_p = (uint8_t *)p; ++ return (u_p[1] | (u_p[0] << 8)); ++#endif ++} ++ ++ ++/* Registers */ ++ ++uint32_t DWC_READ_REG32(uint32_t volatile *reg) ++{ ++ return readl(reg); ++} ++ ++#if 0 ++uint64_t DWC_READ_REG64(uint64_t volatile *reg) ++{ ++} ++#endif ++ ++void DWC_WRITE_REG32(uint32_t volatile *reg, uint32_t value) ++{ ++ writel(value, reg); ++} ++ ++#if 0 ++void DWC_WRITE_REG64(uint64_t volatile *reg, uint64_t value) ++{ ++} ++#endif ++ ++void DWC_MODIFY_REG32(uint32_t volatile *reg, uint32_t clear_mask, uint32_t set_mask) ++{ ++ writel((readl(reg) & ~clear_mask) | set_mask, reg); ++} ++ ++#if 0 ++void DWC_MODIFY_REG64(uint64_t volatile *reg, uint64_t clear_mask, uint64_t set_mask) ++{ ++} ++#endif ++ ++ ++/* Locking */ ++ ++dwc_spinlock_t *DWC_SPINLOCK_ALLOC(void) ++{ ++ spinlock_t *sl = (spinlock_t *)1; ++ ++#if defined(CONFIG_PREEMPT) || defined(CONFIG_SMP) ++ sl = DWC_ALLOC(sizeof(*sl)); ++ if (!sl) { ++ DWC_ERROR("Cannot allocate memory for spinlock\n"); ++ return NULL; ++ } ++ ++ spin_lock_init(sl); ++#endif ++ return (dwc_spinlock_t *)sl; ++} ++ ++void DWC_SPINLOCK_FREE(dwc_spinlock_t *lock) ++{ ++#if defined(CONFIG_PREEMPT) || defined(CONFIG_SMP) ++ DWC_FREE(lock); ++#endif ++} ++ ++void DWC_SPINLOCK(dwc_spinlock_t *lock) ++{ ++#if defined(CONFIG_PREEMPT) || defined(CONFIG_SMP) ++ spin_lock((spinlock_t *)lock); ++#endif ++} ++ ++void DWC_SPINUNLOCK(dwc_spinlock_t *lock) ++{ ++#if defined(CONFIG_PREEMPT) || defined(CONFIG_SMP) ++ spin_unlock((spinlock_t *)lock); ++#endif ++} ++ ++void DWC_SPINLOCK_IRQSAVE(dwc_spinlock_t *lock, dwc_irqflags_t *flags) ++{ ++ dwc_irqflags_t f; ++ ++#if defined(CONFIG_PREEMPT) || defined(CONFIG_SMP) ++ spin_lock_irqsave((spinlock_t *)lock, f); ++#else ++ local_irq_save(f); ++#endif ++ *flags = f; ++} ++ ++void DWC_SPINUNLOCK_IRQRESTORE(dwc_spinlock_t *lock, dwc_irqflags_t flags) ++{ ++#if defined(CONFIG_PREEMPT) || defined(CONFIG_SMP) ++ spin_unlock_irqrestore((spinlock_t *)lock, flags); ++#else ++ local_irq_restore(flags); ++#endif ++} ++ ++dwc_mutex_t *DWC_MUTEX_ALLOC(void) ++{ ++ struct mutex *m; ++ dwc_mutex_t *mutex = (dwc_mutex_t *)DWC_ALLOC(sizeof(struct mutex)); ++ ++ if (!mutex) { ++ DWC_ERROR("Cannot allocate memory for mutex\n"); ++ return NULL; ++ } ++ ++ m = (struct mutex *)mutex; ++ mutex_init(m); ++ return mutex; ++} ++ ++#if (defined(DWC_LINUX) && defined(CONFIG_DEBUG_MUTEXES)) ++#else ++void DWC_MUTEX_FREE(dwc_mutex_t *mutex) ++{ ++ mutex_destroy((struct mutex *)mutex); ++ DWC_FREE(mutex); ++} ++#endif ++ ++void DWC_MUTEX_LOCK(dwc_mutex_t *mutex) ++{ ++ struct mutex *m = (struct mutex *)mutex; ++ mutex_lock(m); ++} ++ ++int DWC_MUTEX_TRYLOCK(dwc_mutex_t *mutex) ++{ ++ struct mutex *m = (struct mutex *)mutex; ++ return mutex_trylock(m); ++} ++ ++void DWC_MUTEX_UNLOCK(dwc_mutex_t *mutex) ++{ ++ struct mutex *m = (struct mutex *)mutex; ++ mutex_unlock(m); ++} ++ ++ ++/* Timing */ ++ ++void DWC_UDELAY(uint32_t usecs) ++{ ++ udelay(usecs); ++} ++ ++void DWC_MDELAY(uint32_t msecs) ++{ ++ mdelay(msecs); ++} ++ ++void DWC_MSLEEP(uint32_t msecs) ++{ ++ msleep(msecs); ++} ++ ++uint32_t DWC_TIME(void) ++{ ++ return jiffies_to_msecs(jiffies); ++} ++ ++ ++/* Timers */ ++ ++struct dwc_timer { ++ struct timer_list *t; ++ char *name; ++ dwc_timer_callback_t cb; ++ void *data; ++ uint8_t scheduled; ++ dwc_spinlock_t *lock; ++}; ++ ++static void timer_callback(unsigned long data) ++{ ++ dwc_timer_t *timer = (dwc_timer_t *)data; ++ dwc_irqflags_t flags; ++ ++ DWC_SPINLOCK_IRQSAVE(timer->lock, &flags); ++ timer->scheduled = 0; ++ DWC_SPINUNLOCK_IRQRESTORE(timer->lock, flags); ++ DWC_DEBUGC("Timer %s callback", timer->name); ++ timer->cb(timer->data); ++} ++ ++dwc_timer_t *DWC_TIMER_ALLOC(char *name, dwc_timer_callback_t cb, void *data) ++{ ++ dwc_timer_t *t = DWC_ALLOC(sizeof(*t)); ++ ++ if (!t) { ++ DWC_ERROR("Cannot allocate memory for timer"); ++ return NULL; ++ } ++ ++ t->t = DWC_ALLOC(sizeof(*t->t)); ++ if (!t->t) { ++ DWC_ERROR("Cannot allocate memory for timer->t"); ++ goto no_timer; ++ } ++ ++ t->name = DWC_STRDUP(name); ++ if (!t->name) { ++ DWC_ERROR("Cannot allocate memory for timer->name"); ++ goto no_name; ++ } ++ ++#if (defined(DWC_LINUX) && defined(CONFIG_DEBUG_SPINLOCK)) ++ DWC_SPINLOCK_ALLOC_LINUX_DEBUG(t->lock); ++#else ++ t->lock = DWC_SPINLOCK_ALLOC(); ++#endif ++ if (!t->lock) { ++ DWC_ERROR("Cannot allocate memory for lock"); ++ goto no_lock; ++ } ++ ++ t->scheduled = 0; ++ t->t->expires = jiffies; ++ setup_timer(t->t, timer_callback, (unsigned long)t); ++ ++ t->cb = cb; ++ t->data = data; ++ ++ return t; ++ ++ no_lock: ++ DWC_FREE(t->name); ++ no_name: ++ DWC_FREE(t->t); ++ no_timer: ++ DWC_FREE(t); ++ return NULL; ++} ++ ++void DWC_TIMER_FREE(dwc_timer_t *timer) ++{ ++ dwc_irqflags_t flags; ++ ++ DWC_SPINLOCK_IRQSAVE(timer->lock, &flags); ++ ++ if (timer->scheduled) { ++ del_timer(timer->t); ++ timer->scheduled = 0; ++ } ++ ++ DWC_SPINUNLOCK_IRQRESTORE(timer->lock, flags); ++ DWC_SPINLOCK_FREE(timer->lock); ++ DWC_FREE(timer->t); ++ DWC_FREE(timer->name); ++ DWC_FREE(timer); ++} ++ ++void DWC_TIMER_SCHEDULE(dwc_timer_t *timer, uint32_t time) ++{ ++ dwc_irqflags_t flags; ++ ++ DWC_SPINLOCK_IRQSAVE(timer->lock, &flags); ++ ++ if (!timer->scheduled) { ++ timer->scheduled = 1; ++ DWC_DEBUGC("Scheduling timer %s to expire in +%d msec", timer->name, time); ++ timer->t->expires = jiffies + msecs_to_jiffies(time); ++ add_timer(timer->t); ++ } else { ++ DWC_DEBUGC("Modifying timer %s to expire in +%d msec", timer->name, time); ++ mod_timer(timer->t, jiffies + msecs_to_jiffies(time)); ++ } ++ ++ DWC_SPINUNLOCK_IRQRESTORE(timer->lock, flags); ++} ++ ++void DWC_TIMER_CANCEL(dwc_timer_t *timer) ++{ ++ del_timer(timer->t); ++} ++ ++ ++/* Wait Queues */ ++ ++struct dwc_waitq { ++ wait_queue_head_t queue; ++ int abort; ++}; ++ ++dwc_waitq_t *DWC_WAITQ_ALLOC(void) ++{ ++ dwc_waitq_t *wq = DWC_ALLOC(sizeof(*wq)); ++ ++ if (!wq) { ++ DWC_ERROR("Cannot allocate memory for waitqueue\n"); ++ return NULL; ++ } ++ ++ init_waitqueue_head(&wq->queue); ++ wq->abort = 0; ++ return wq; ++} ++ ++void DWC_WAITQ_FREE(dwc_waitq_t *wq) ++{ ++ DWC_FREE(wq); ++} ++ ++int32_t DWC_WAITQ_WAIT(dwc_waitq_t *wq, dwc_waitq_condition_t cond, void *data) ++{ ++ int result = wait_event_interruptible(wq->queue, ++ cond(data) || wq->abort); ++ if (result == -ERESTARTSYS) { ++ wq->abort = 0; ++ return -DWC_E_RESTART; ++ } ++ ++ if (wq->abort == 1) { ++ wq->abort = 0; ++ return -DWC_E_ABORT; ++ } ++ ++ wq->abort = 0; ++ ++ if (result == 0) { ++ return 0; ++ } ++ ++ return -DWC_E_UNKNOWN; ++} ++ ++int32_t DWC_WAITQ_WAIT_TIMEOUT(dwc_waitq_t *wq, dwc_waitq_condition_t cond, ++ void *data, int32_t msecs) ++{ ++ int32_t tmsecs; ++ int result = wait_event_interruptible_timeout(wq->queue, ++ cond(data) || wq->abort, ++ msecs_to_jiffies(msecs)); ++ if (result == -ERESTARTSYS) { ++ wq->abort = 0; ++ return -DWC_E_RESTART; ++ } ++ ++ if (wq->abort == 1) { ++ wq->abort = 0; ++ return -DWC_E_ABORT; ++ } ++ ++ wq->abort = 0; ++ ++ if (result > 0) { ++ tmsecs = jiffies_to_msecs(result); ++ if (!tmsecs) { ++ return 1; ++ } ++ ++ return tmsecs; ++ } ++ ++ if (result == 0) { ++ return -DWC_E_TIMEOUT; ++ } ++ ++ return -DWC_E_UNKNOWN; ++} ++ ++void DWC_WAITQ_TRIGGER(dwc_waitq_t *wq) ++{ ++ wq->abort = 0; ++ wake_up_interruptible(&wq->queue); ++} ++ ++void DWC_WAITQ_ABORT(dwc_waitq_t *wq) ++{ ++ wq->abort = 1; ++ wake_up_interruptible(&wq->queue); ++} ++ ++ ++/* Threading */ ++ ++dwc_thread_t *DWC_THREAD_RUN(dwc_thread_function_t func, char *name, void *data) ++{ ++ struct task_struct *thread = kthread_run(func, data, name); ++ ++ if (thread == ERR_PTR(-ENOMEM)) { ++ return NULL; ++ } ++ ++ return (dwc_thread_t *)thread; ++} ++ ++int DWC_THREAD_STOP(dwc_thread_t *thread) ++{ ++ return kthread_stop((struct task_struct *)thread); ++} ++ ++dwc_bool_t DWC_THREAD_SHOULD_STOP(void) ++{ ++ return kthread_should_stop(); ++} ++ ++ ++/* tasklets ++ - run in interrupt context (cannot sleep) ++ - each tasklet runs on a single CPU ++ - different tasklets can be running simultaneously on different CPUs ++ */ ++struct dwc_tasklet { ++ struct tasklet_struct t; ++ dwc_tasklet_callback_t cb; ++ void *data; ++}; ++ ++static void tasklet_callback(unsigned long data) ++{ ++ dwc_tasklet_t *t = (dwc_tasklet_t *)data; ++ t->cb(t->data); ++} ++ ++dwc_tasklet_t *DWC_TASK_ALLOC(char *name, dwc_tasklet_callback_t cb, void *data) ++{ ++ dwc_tasklet_t *t = DWC_ALLOC(sizeof(*t)); ++ ++ if (t) { ++ t->cb = cb; ++ t->data = data; ++ tasklet_init(&t->t, tasklet_callback, (unsigned long)t); ++ } else { ++ DWC_ERROR("Cannot allocate memory for tasklet\n"); ++ } ++ ++ return t; ++} ++ ++void DWC_TASK_FREE(dwc_tasklet_t *task) ++{ ++ DWC_FREE(task); ++} ++ ++void DWC_TASK_SCHEDULE(dwc_tasklet_t *task) ++{ ++ tasklet_schedule(&task->t); ++} ++ ++void DWC_TASK_HI_SCHEDULE(dwc_tasklet_t *task) ++{ ++ tasklet_hi_schedule(&task->t); ++} ++ ++ ++/* workqueues ++ - run in process context (can sleep) ++ */ ++typedef struct work_container { ++ dwc_work_callback_t cb; ++ void *data; ++ dwc_workq_t *wq; ++ char *name; ++ ++#ifdef DEBUG ++ DWC_CIRCLEQ_ENTRY(work_container) entry; ++#endif ++ struct delayed_work work; ++} work_container_t; ++ ++#ifdef DEBUG ++DWC_CIRCLEQ_HEAD(work_container_queue, work_container); ++#endif ++ ++struct dwc_workq { ++ struct workqueue_struct *wq; ++ dwc_spinlock_t *lock; ++ dwc_waitq_t *waitq; ++ int pending; ++ ++#ifdef DEBUG ++ struct work_container_queue entries; ++#endif ++}; ++ ++static void do_work(struct work_struct *work) ++{ ++ dwc_irqflags_t flags; ++ struct delayed_work *dw = container_of(work, struct delayed_work, work); ++ work_container_t *container = container_of(dw, struct work_container, work); ++ dwc_workq_t *wq = container->wq; ++ ++ container->cb(container->data); ++ ++#ifdef DEBUG ++ DWC_CIRCLEQ_REMOVE(&wq->entries, container, entry); ++#endif ++ DWC_DEBUGC("Work done: %s, container=%p", container->name, container); ++ if (container->name) { ++ DWC_FREE(container->name); ++ } ++ DWC_FREE(container); ++ ++ DWC_SPINLOCK_IRQSAVE(wq->lock, &flags); ++ wq->pending--; ++ DWC_SPINUNLOCK_IRQRESTORE(wq->lock, flags); ++ DWC_WAITQ_TRIGGER(wq->waitq); ++} ++ ++static int work_done(void *data) ++{ ++ dwc_workq_t *workq = (dwc_workq_t *)data; ++ return workq->pending == 0; ++} ++ ++int DWC_WORKQ_WAIT_WORK_DONE(dwc_workq_t *workq, int timeout) ++{ ++ return DWC_WAITQ_WAIT_TIMEOUT(workq->waitq, work_done, workq, timeout); ++} ++ ++dwc_workq_t *DWC_WORKQ_ALLOC(char *name) ++{ ++ dwc_workq_t *wq = DWC_ALLOC(sizeof(*wq)); ++ ++ if (!wq) { ++ return NULL; ++ } ++ ++ wq->wq = create_singlethread_workqueue(name); ++ if (!wq->wq) { ++ goto no_wq; ++ } ++ ++ wq->pending = 0; ++ ++#if (defined(DWC_LINUX) && defined(CONFIG_DEBUG_SPINLOCK)) ++ DWC_SPINLOCK_ALLOC_LINUX_DEBUG(wq->lock); ++#else ++ wq->lock = DWC_SPINLOCK_ALLOC(); ++#endif ++ if (!wq->lock) { ++ goto no_lock; ++ } ++ ++ wq->waitq = DWC_WAITQ_ALLOC(); ++ if (!wq->waitq) { ++ goto no_waitq; ++ } ++ ++#ifdef DEBUG ++ DWC_CIRCLEQ_INIT(&wq->entries); ++#endif ++ return wq; ++ ++ no_waitq: ++ DWC_SPINLOCK_FREE(wq->lock); ++ no_lock: ++ destroy_workqueue(wq->wq); ++ no_wq: ++ DWC_FREE(wq); ++ ++ return NULL; ++} ++ ++void DWC_WORKQ_FREE(dwc_workq_t *wq) ++{ ++#ifdef DEBUG ++ if (wq->pending != 0) { ++ struct work_container *wc; ++ DWC_ERROR("Destroying work queue with pending work"); ++ DWC_CIRCLEQ_FOREACH(wc, &wq->entries, entry) { ++ DWC_ERROR("Work %s still pending", wc->name); ++ } ++ } ++#endif ++ destroy_workqueue(wq->wq); ++ DWC_SPINLOCK_FREE(wq->lock); ++ DWC_WAITQ_FREE(wq->waitq); ++ DWC_FREE(wq); ++} ++ ++void DWC_WORKQ_SCHEDULE(dwc_workq_t *wq, dwc_work_callback_t cb, void *data, ++ char *format, ...) ++{ ++ dwc_irqflags_t flags; ++ work_container_t *container; ++ static char name[128]; ++ va_list args; ++ ++ va_start(args, format); ++ DWC_VSNPRINTF(name, 128, format, args); ++ va_end(args); ++ ++ DWC_SPINLOCK_IRQSAVE(wq->lock, &flags); ++ wq->pending++; ++ DWC_SPINUNLOCK_IRQRESTORE(wq->lock, flags); ++ DWC_WAITQ_TRIGGER(wq->waitq); ++ ++ container = DWC_ALLOC_ATOMIC(sizeof(*container)); ++ if (!container) { ++ DWC_ERROR("Cannot allocate memory for container\n"); ++ return; ++ } ++ ++ container->name = DWC_STRDUP(name); ++ if (!container->name) { ++ DWC_ERROR("Cannot allocate memory for container->name\n"); ++ DWC_FREE(container); ++ return; ++ } ++ ++ container->cb = cb; ++ container->data = data; ++ container->wq = wq; ++ DWC_DEBUGC("Queueing work: %s, container=%p", container->name, container); ++ INIT_WORK(&container->work.work, do_work); ++ ++#ifdef DEBUG ++ DWC_CIRCLEQ_INSERT_TAIL(&wq->entries, container, entry); ++#endif ++ queue_work(wq->wq, &container->work.work); ++} ++ ++void DWC_WORKQ_SCHEDULE_DELAYED(dwc_workq_t *wq, dwc_work_callback_t cb, ++ void *data, uint32_t time, char *format, ...) ++{ ++ dwc_irqflags_t flags; ++ work_container_t *container; ++ static char name[128]; ++ va_list args; ++ ++ va_start(args, format); ++ DWC_VSNPRINTF(name, 128, format, args); ++ va_end(args); ++ ++ DWC_SPINLOCK_IRQSAVE(wq->lock, &flags); ++ wq->pending++; ++ DWC_SPINUNLOCK_IRQRESTORE(wq->lock, flags); ++ DWC_WAITQ_TRIGGER(wq->waitq); ++ ++ container = DWC_ALLOC_ATOMIC(sizeof(*container)); ++ if (!container) { ++ DWC_ERROR("Cannot allocate memory for container\n"); ++ return; ++ } ++ ++ container->name = DWC_STRDUP(name); ++ if (!container->name) { ++ DWC_ERROR("Cannot allocate memory for container->name\n"); ++ DWC_FREE(container); ++ return; ++ } ++ ++ container->cb = cb; ++ container->data = data; ++ container->wq = wq; ++ DWC_DEBUGC("Queueing work: %s, container=%p", container->name, container); ++ INIT_DELAYED_WORK(&container->work, do_work); ++ ++#ifdef DEBUG ++ DWC_CIRCLEQ_INSERT_TAIL(&wq->entries, container, entry); ++#endif ++ queue_delayed_work(wq->wq, &container->work, msecs_to_jiffies(time)); ++} ++ ++int DWC_WORKQ_PENDING(dwc_workq_t *wq) ++{ ++ return wq->pending; ++} ++ ++ ++#ifdef DWC_LIBMODULE ++ ++#ifdef DWC_CCLIB ++/* CC */ ++EXPORT_SYMBOL(dwc_cc_if_alloc); ++EXPORT_SYMBOL(dwc_cc_if_free); ++EXPORT_SYMBOL(dwc_cc_clear); ++EXPORT_SYMBOL(dwc_cc_add); ++EXPORT_SYMBOL(dwc_cc_remove); ++EXPORT_SYMBOL(dwc_cc_change); ++EXPORT_SYMBOL(dwc_cc_data_for_save); ++EXPORT_SYMBOL(dwc_cc_restore_from_data); ++EXPORT_SYMBOL(dwc_cc_match_chid); ++EXPORT_SYMBOL(dwc_cc_match_cdid); ++EXPORT_SYMBOL(dwc_cc_ck); ++EXPORT_SYMBOL(dwc_cc_chid); ++EXPORT_SYMBOL(dwc_cc_cdid); ++EXPORT_SYMBOL(dwc_cc_name); ++#endif /* DWC_CCLIB */ ++ ++#ifdef DWC_CRYPTOLIB ++# ifndef CONFIG_MACH_IPMATE ++/* Modpow */ ++EXPORT_SYMBOL(dwc_modpow); ++ ++/* DH */ ++EXPORT_SYMBOL(dwc_dh_modpow); ++EXPORT_SYMBOL(dwc_dh_derive_keys); ++EXPORT_SYMBOL(dwc_dh_pk); ++# endif /* CONFIG_MACH_IPMATE */ ++ ++/* Crypto */ ++EXPORT_SYMBOL(dwc_wusb_aes_encrypt); ++EXPORT_SYMBOL(dwc_wusb_cmf); ++EXPORT_SYMBOL(dwc_wusb_prf); ++EXPORT_SYMBOL(dwc_wusb_fill_ccm_nonce); ++EXPORT_SYMBOL(dwc_wusb_gen_nonce); ++EXPORT_SYMBOL(dwc_wusb_gen_key); ++EXPORT_SYMBOL(dwc_wusb_gen_mic); ++#endif /* DWC_CRYPTOLIB */ ++ ++/* Notification */ ++#ifdef DWC_NOTIFYLIB ++EXPORT_SYMBOL(dwc_alloc_notification_manager); ++EXPORT_SYMBOL(dwc_free_notification_manager); ++EXPORT_SYMBOL(dwc_register_notifier); ++EXPORT_SYMBOL(dwc_unregister_notifier); ++EXPORT_SYMBOL(dwc_add_observer); ++EXPORT_SYMBOL(dwc_remove_observer); ++EXPORT_SYMBOL(dwc_notify); ++#endif ++ ++/* Memory Debugging Routines */ ++#ifdef DWC_DEBUG_MEMORY ++EXPORT_SYMBOL(dwc_alloc_debug); ++EXPORT_SYMBOL(dwc_alloc_atomic_debug); ++EXPORT_SYMBOL(dwc_free_debug); ++EXPORT_SYMBOL(dwc_dma_alloc_debug); ++EXPORT_SYMBOL(dwc_dma_free_debug); ++#endif ++ ++EXPORT_SYMBOL(DWC_MEMSET); ++EXPORT_SYMBOL(DWC_MEMCPY); ++EXPORT_SYMBOL(DWC_MEMMOVE); ++EXPORT_SYMBOL(DWC_MEMCMP); ++EXPORT_SYMBOL(DWC_STRNCMP); ++EXPORT_SYMBOL(DWC_STRCMP); ++EXPORT_SYMBOL(DWC_STRLEN); ++EXPORT_SYMBOL(DWC_STRCPY); ++EXPORT_SYMBOL(DWC_STRDUP); ++EXPORT_SYMBOL(DWC_ATOI); ++EXPORT_SYMBOL(DWC_ATOUI); ++ ++#ifdef DWC_UTFLIB ++EXPORT_SYMBOL(DWC_UTF8_TO_UTF16LE); ++#endif /* DWC_UTFLIB */ ++ ++EXPORT_SYMBOL(DWC_IN_IRQ); ++EXPORT_SYMBOL(DWC_IN_BH); ++EXPORT_SYMBOL(DWC_VPRINTF); ++EXPORT_SYMBOL(DWC_VSNPRINTF); ++EXPORT_SYMBOL(DWC_PRINTF); ++EXPORT_SYMBOL(DWC_SPRINTF); ++EXPORT_SYMBOL(DWC_SNPRINTF); ++EXPORT_SYMBOL(__DWC_WARN); ++EXPORT_SYMBOL(__DWC_ERROR); ++EXPORT_SYMBOL(DWC_EXCEPTION); ++ ++#ifdef DEBUG ++EXPORT_SYMBOL(__DWC_DEBUG); ++#endif ++ ++EXPORT_SYMBOL(__DWC_DMA_ALLOC); ++EXPORT_SYMBOL(__DWC_DMA_ALLOC_ATOMIC); ++EXPORT_SYMBOL(__DWC_DMA_FREE); ++EXPORT_SYMBOL(__DWC_ALLOC); ++EXPORT_SYMBOL(__DWC_ALLOC_ATOMIC); ++EXPORT_SYMBOL(__DWC_FREE); ++ ++#ifdef DWC_CRYPTOLIB ++EXPORT_SYMBOL(DWC_RANDOM_BYTES); ++EXPORT_SYMBOL(DWC_AES_CBC); ++EXPORT_SYMBOL(DWC_SHA256); ++EXPORT_SYMBOL(DWC_HMAC_SHA256); ++#endif ++ ++EXPORT_SYMBOL(DWC_CPU_TO_LE32); ++EXPORT_SYMBOL(DWC_CPU_TO_BE32); ++EXPORT_SYMBOL(DWC_LE32_TO_CPU); ++EXPORT_SYMBOL(DWC_BE32_TO_CPU); ++EXPORT_SYMBOL(DWC_CPU_TO_LE16); ++EXPORT_SYMBOL(DWC_CPU_TO_BE16); ++EXPORT_SYMBOL(DWC_LE16_TO_CPU); ++EXPORT_SYMBOL(DWC_BE16_TO_CPU); ++EXPORT_SYMBOL(DWC_READ_REG32); ++EXPORT_SYMBOL(DWC_WRITE_REG32); ++EXPORT_SYMBOL(DWC_MODIFY_REG32); ++ ++#if 0 ++EXPORT_SYMBOL(DWC_READ_REG64); ++EXPORT_SYMBOL(DWC_WRITE_REG64); ++EXPORT_SYMBOL(DWC_MODIFY_REG64); ++#endif ++ ++EXPORT_SYMBOL(DWC_SPINLOCK_ALLOC); ++EXPORT_SYMBOL(DWC_SPINLOCK_FREE); ++EXPORT_SYMBOL(DWC_SPINLOCK); ++EXPORT_SYMBOL(DWC_SPINUNLOCK); ++EXPORT_SYMBOL(DWC_SPINLOCK_IRQSAVE); ++EXPORT_SYMBOL(DWC_SPINUNLOCK_IRQRESTORE); ++EXPORT_SYMBOL(DWC_MUTEX_ALLOC); ++ ++#if (!defined(DWC_LINUX) || !defined(CONFIG_DEBUG_MUTEXES)) ++EXPORT_SYMBOL(DWC_MUTEX_FREE); ++#endif ++ ++EXPORT_SYMBOL(DWC_MUTEX_LOCK); ++EXPORT_SYMBOL(DWC_MUTEX_TRYLOCK); ++EXPORT_SYMBOL(DWC_MUTEX_UNLOCK); ++EXPORT_SYMBOL(DWC_UDELAY); ++EXPORT_SYMBOL(DWC_MDELAY); ++EXPORT_SYMBOL(DWC_MSLEEP); ++EXPORT_SYMBOL(DWC_TIME); ++EXPORT_SYMBOL(DWC_TIMER_ALLOC); ++EXPORT_SYMBOL(DWC_TIMER_FREE); ++EXPORT_SYMBOL(DWC_TIMER_SCHEDULE); ++EXPORT_SYMBOL(DWC_TIMER_CANCEL); ++EXPORT_SYMBOL(DWC_WAITQ_ALLOC); ++EXPORT_SYMBOL(DWC_WAITQ_FREE); ++EXPORT_SYMBOL(DWC_WAITQ_WAIT); ++EXPORT_SYMBOL(DWC_WAITQ_WAIT_TIMEOUT); ++EXPORT_SYMBOL(DWC_WAITQ_TRIGGER); ++EXPORT_SYMBOL(DWC_WAITQ_ABORT); ++EXPORT_SYMBOL(DWC_THREAD_RUN); ++EXPORT_SYMBOL(DWC_THREAD_STOP); ++EXPORT_SYMBOL(DWC_THREAD_SHOULD_STOP); ++EXPORT_SYMBOL(DWC_TASK_ALLOC); ++EXPORT_SYMBOL(DWC_TASK_FREE); ++EXPORT_SYMBOL(DWC_TASK_SCHEDULE); ++EXPORT_SYMBOL(DWC_WORKQ_WAIT_WORK_DONE); ++EXPORT_SYMBOL(DWC_WORKQ_ALLOC); ++EXPORT_SYMBOL(DWC_WORKQ_FREE); ++EXPORT_SYMBOL(DWC_WORKQ_SCHEDULE); ++EXPORT_SYMBOL(DWC_WORKQ_SCHEDULE_DELAYED); ++EXPORT_SYMBOL(DWC_WORKQ_PENDING); ++ ++static int dwc_common_port_init_module(void) ++{ ++ int result = 0; ++ ++ printk(KERN_DEBUG "Module dwc_common_port init\n" ); ++ ++#ifdef DWC_DEBUG_MEMORY ++ result = dwc_memory_debug_start(NULL); ++ if (result) { ++ printk(KERN_ERR ++ "dwc_memory_debug_start() failed with error %d\n", ++ result); ++ return result; ++ } ++#endif ++ ++#ifdef DWC_NOTIFYLIB ++ result = dwc_alloc_notification_manager(NULL, NULL); ++ if (result) { ++ printk(KERN_ERR ++ "dwc_alloc_notification_manager() failed with error %d\n", ++ result); ++ return result; ++ } ++#endif ++ return result; ++} ++ ++static void dwc_common_port_exit_module(void) ++{ ++ printk(KERN_DEBUG "Module dwc_common_port exit\n" ); ++ ++#ifdef DWC_NOTIFYLIB ++ dwc_free_notification_manager(); ++#endif ++ ++#ifdef DWC_DEBUG_MEMORY ++ dwc_memory_debug_stop(); ++#endif ++} ++ ++module_init(dwc_common_port_init_module); ++module_exit(dwc_common_port_exit_module); ++ ++MODULE_DESCRIPTION("DWC Common Library - Portable version"); ++MODULE_AUTHOR("Synopsys Inc."); ++MODULE_LICENSE ("GPL"); ++ ++#endif /* DWC_LIBMODULE */ +diff --git a/drivers/usb/host/dwc_common_port/dwc_common_nbsd.c b/drivers/usb/host/dwc_common_port/dwc_common_nbsd.c +new file mode 100644 +index 0000000..49b07e1 +--- /dev/null ++++ b/drivers/usb/host/dwc_common_port/dwc_common_nbsd.c +@@ -0,0 +1,1275 @@ ++#include "dwc_os.h" ++#include "dwc_list.h" ++ ++#ifdef DWC_CCLIB ++# include "dwc_cc.h" ++#endif ++ ++#ifdef DWC_CRYPTOLIB ++# include "dwc_modpow.h" ++# include "dwc_dh.h" ++# include "dwc_crypto.h" ++#endif ++ ++#ifdef DWC_NOTIFYLIB ++# include "dwc_notifier.h" ++#endif ++ ++/* OS-Level Implementations */ ++ ++/* This is the NetBSD 4.0.1 kernel implementation of the DWC platform library. */ ++ ++ ++/* MISC */ ++ ++void *DWC_MEMSET(void *dest, uint8_t byte, uint32_t size) ++{ ++ return memset(dest, byte, size); ++} ++ ++void *DWC_MEMCPY(void *dest, void const *src, uint32_t size) ++{ ++ return memcpy(dest, src, size); ++} ++ ++void *DWC_MEMMOVE(void *dest, void *src, uint32_t size) ++{ ++ bcopy(src, dest, size); ++ return dest; ++} ++ ++int DWC_MEMCMP(void *m1, void *m2, uint32_t size) ++{ ++ return memcmp(m1, m2, size); ++} ++ ++int DWC_STRNCMP(void *s1, void *s2, uint32_t size) ++{ ++ return strncmp(s1, s2, size); ++} ++ ++int DWC_STRCMP(void *s1, void *s2) ++{ ++ return strcmp(s1, s2); ++} ++ ++int DWC_STRLEN(char const *str) ++{ ++ return strlen(str); ++} ++ ++char *DWC_STRCPY(char *to, char const *from) ++{ ++ return strcpy(to, from); ++} ++ ++char *DWC_STRDUP(char const *str) ++{ ++ int len = DWC_STRLEN(str) + 1; ++ char *new = DWC_ALLOC_ATOMIC(len); ++ ++ if (!new) { ++ return NULL; ++ } ++ ++ DWC_MEMCPY(new, str, len); ++ return new; ++} ++ ++int DWC_ATOI(char *str, int32_t *value) ++{ ++ char *end = NULL; ++ ++ /* NetBSD doesn't have 'strtol' in the kernel, but 'strtoul' ++ * should be equivalent on 2's complement machines ++ */ ++ *value = strtoul(str, &end, 0); ++ if (*end == '\0') { ++ return 0; ++ } ++ ++ return -1; ++} ++ ++int DWC_ATOUI(char *str, uint32_t *value) ++{ ++ char *end = NULL; ++ ++ *value = strtoul(str, &end, 0); ++ if (*end == '\0') { ++ return 0; ++ } ++ ++ return -1; ++} ++ ++ ++#ifdef DWC_UTFLIB ++/* From usbstring.c */ ++ ++int DWC_UTF8_TO_UTF16LE(uint8_t const *s, uint16_t *cp, unsigned len) ++{ ++ int count = 0; ++ u8 c; ++ u16 uchar; ++ ++ /* this insists on correct encodings, though not minimal ones. ++ * BUT it currently rejects legit 4-byte UTF-8 code points, ++ * which need surrogate pairs. (Unicode 3.1 can use them.) ++ */ ++ while (len != 0 && (c = (u8) *s++) != 0) { ++ if (unlikely(c & 0x80)) { ++ // 2-byte sequence: ++ // 00000yyyyyxxxxxx = 110yyyyy 10xxxxxx ++ if ((c & 0xe0) == 0xc0) { ++ uchar = (c & 0x1f) << 6; ++ ++ c = (u8) *s++; ++ if ((c & 0xc0) != 0xc0) ++ goto fail; ++ c &= 0x3f; ++ uchar |= c; ++ ++ // 3-byte sequence (most CJKV characters): ++ // zzzzyyyyyyxxxxxx = 1110zzzz 10yyyyyy 10xxxxxx ++ } else if ((c & 0xf0) == 0xe0) { ++ uchar = (c & 0x0f) << 12; ++ ++ c = (u8) *s++; ++ if ((c & 0xc0) != 0xc0) ++ goto fail; ++ c &= 0x3f; ++ uchar |= c << 6; ++ ++ c = (u8) *s++; ++ if ((c & 0xc0) != 0xc0) ++ goto fail; ++ c &= 0x3f; ++ uchar |= c; ++ ++ /* no bogus surrogates */ ++ if (0xd800 <= uchar && uchar <= 0xdfff) ++ goto fail; ++ ++ // 4-byte sequence (surrogate pairs, currently rare): ++ // 11101110wwwwzzzzyy + 110111yyyyxxxxxx ++ // = 11110uuu 10uuzzzz 10yyyyyy 10xxxxxx ++ // (uuuuu = wwww + 1) ++ // FIXME accept the surrogate code points (only) ++ } else ++ goto fail; ++ } else ++ uchar = c; ++ put_unaligned (cpu_to_le16 (uchar), cp++); ++ count++; ++ len--; ++ } ++ return count; ++fail: ++ return -1; ++} ++ ++#endif /* DWC_UTFLIB */ ++ ++ ++/* dwc_debug.h */ ++ ++dwc_bool_t DWC_IN_IRQ(void) ++{ ++// return in_irq(); ++ return 0; ++} ++ ++dwc_bool_t DWC_IN_BH(void) ++{ ++// return in_softirq(); ++ return 0; ++} ++ ++void DWC_VPRINTF(char *format, va_list args) ++{ ++ vprintf(format, args); ++} ++ ++int DWC_VSNPRINTF(char *str, int size, char *format, va_list args) ++{ ++ return vsnprintf(str, size, format, args); ++} ++ ++void DWC_PRINTF(char *format, ...) ++{ ++ va_list args; ++ ++ va_start(args, format); ++ DWC_VPRINTF(format, args); ++ va_end(args); ++} ++ ++int DWC_SPRINTF(char *buffer, char *format, ...) ++{ ++ int retval; ++ va_list args; ++ ++ va_start(args, format); ++ retval = vsprintf(buffer, format, args); ++ va_end(args); ++ return retval; ++} ++ ++int DWC_SNPRINTF(char *buffer, int size, char *format, ...) ++{ ++ int retval; ++ va_list args; ++ ++ va_start(args, format); ++ retval = vsnprintf(buffer, size, format, args); ++ va_end(args); ++ return retval; ++} ++ ++void __DWC_WARN(char *format, ...) ++{ ++ va_list args; ++ ++ va_start(args, format); ++ DWC_VPRINTF(format, args); ++ va_end(args); ++} ++ ++void __DWC_ERROR(char *format, ...) ++{ ++ va_list args; ++ ++ va_start(args, format); ++ DWC_VPRINTF(format, args); ++ va_end(args); ++} ++ ++void DWC_EXCEPTION(char *format, ...) ++{ ++ va_list args; ++ ++ va_start(args, format); ++ DWC_VPRINTF(format, args); ++ va_end(args); ++// BUG_ON(1); ??? ++} ++ ++#ifdef DEBUG ++void __DWC_DEBUG(char *format, ...) ++{ ++ va_list args; ++ ++ va_start(args, format); ++ DWC_VPRINTF(format, args); ++ va_end(args); ++} ++#endif ++ ++ ++/* dwc_mem.h */ ++ ++#if 0 ++dwc_pool_t *DWC_DMA_POOL_CREATE(uint32_t size, ++ uint32_t align, ++ uint32_t alloc) ++{ ++ struct dma_pool *pool = dma_pool_create("Pool", NULL, ++ size, align, alloc); ++ return (dwc_pool_t *)pool; ++} ++ ++void DWC_DMA_POOL_DESTROY(dwc_pool_t *pool) ++{ ++ dma_pool_destroy((struct dma_pool *)pool); ++} ++ ++void *DWC_DMA_POOL_ALLOC(dwc_pool_t *pool, uint64_t *dma_addr) ++{ ++// return dma_pool_alloc((struct dma_pool *)pool, GFP_KERNEL, dma_addr); ++ return dma_pool_alloc((struct dma_pool *)pool, M_WAITOK, dma_addr); ++} ++ ++void *DWC_DMA_POOL_ZALLOC(dwc_pool_t *pool, uint64_t *dma_addr) ++{ ++ void *vaddr = DWC_DMA_POOL_ALLOC(pool, dma_addr); ++ memset(..); ++} ++ ++void DWC_DMA_POOL_FREE(dwc_pool_t *pool, void *vaddr, void *daddr) ++{ ++ dma_pool_free(pool, vaddr, daddr); ++} ++#endif ++ ++void *__DWC_DMA_ALLOC(void *dma_ctx, uint32_t size, dwc_dma_t *dma_addr) ++{ ++ dwc_dmactx_t *dma = (dwc_dmactx_t *)dma_ctx; ++ int error; ++ ++ error = bus_dmamem_alloc(dma->dma_tag, size, 1, size, dma->segs, ++ sizeof(dma->segs) / sizeof(dma->segs[0]), ++ &dma->nsegs, BUS_DMA_NOWAIT); ++ if (error) { ++ printf("%s: bus_dmamem_alloc(%ju) failed: %d\n", __func__, ++ (uintmax_t)size, error); ++ goto fail_0; ++ } ++ ++ error = bus_dmamem_map(dma->dma_tag, dma->segs, dma->nsegs, size, ++ (caddr_t *)&dma->dma_vaddr, ++ BUS_DMA_NOWAIT | BUS_DMA_COHERENT); ++ if (error) { ++ printf("%s: bus_dmamem_map failed: %d\n", __func__, error); ++ goto fail_1; ++ } ++ ++ error = bus_dmamap_create(dma->dma_tag, size, 1, size, 0, ++ BUS_DMA_NOWAIT, &dma->dma_map); ++ if (error) { ++ printf("%s: bus_dmamap_create failed: %d\n", __func__, error); ++ goto fail_2; ++ } ++ ++ error = bus_dmamap_load(dma->dma_tag, dma->dma_map, dma->dma_vaddr, ++ size, NULL, BUS_DMA_NOWAIT); ++ if (error) { ++ printf("%s: bus_dmamap_load failed: %d\n", __func__, error); ++ goto fail_3; ++ } ++ ++ dma->dma_paddr = (bus_addr_t)dma->segs[0].ds_addr; ++ *dma_addr = dma->dma_paddr; ++ return dma->dma_vaddr; ++ ++fail_3: ++ bus_dmamap_destroy(dma->dma_tag, dma->dma_map); ++fail_2: ++ bus_dmamem_unmap(dma->dma_tag, dma->dma_vaddr, size); ++fail_1: ++ bus_dmamem_free(dma->dma_tag, dma->segs, dma->nsegs); ++fail_0: ++ dma->dma_map = NULL; ++ dma->dma_vaddr = NULL; ++ dma->nsegs = 0; ++ ++ return NULL; ++} ++ ++void __DWC_DMA_FREE(void *dma_ctx, uint32_t size, void *virt_addr, dwc_dma_t dma_addr) ++{ ++ dwc_dmactx_t *dma = (dwc_dmactx_t *)dma_ctx; ++ ++ if (dma->dma_map != NULL) { ++ bus_dmamap_sync(dma->dma_tag, dma->dma_map, 0, size, ++ BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); ++ bus_dmamap_unload(dma->dma_tag, dma->dma_map); ++ bus_dmamap_destroy(dma->dma_tag, dma->dma_map); ++ bus_dmamem_unmap(dma->dma_tag, dma->dma_vaddr, size); ++ bus_dmamem_free(dma->dma_tag, dma->segs, dma->nsegs); ++ dma->dma_paddr = 0; ++ dma->dma_map = NULL; ++ dma->dma_vaddr = NULL; ++ dma->nsegs = 0; ++ } ++} ++ ++void *__DWC_ALLOC(void *mem_ctx, uint32_t size) ++{ ++ return malloc(size, M_DEVBUF, M_WAITOK | M_ZERO); ++} ++ ++void *__DWC_ALLOC_ATOMIC(void *mem_ctx, uint32_t size) ++{ ++ return malloc(size, M_DEVBUF, M_NOWAIT | M_ZERO); ++} ++ ++void __DWC_FREE(void *mem_ctx, void *addr) ++{ ++ free(addr, M_DEVBUF); ++} ++ ++ ++#ifdef DWC_CRYPTOLIB ++/* dwc_crypto.h */ ++ ++void DWC_RANDOM_BYTES(uint8_t *buffer, uint32_t length) ++{ ++ get_random_bytes(buffer, length); ++} ++ ++int DWC_AES_CBC(uint8_t *message, uint32_t messagelen, uint8_t *key, uint32_t keylen, uint8_t iv[16], uint8_t *out) ++{ ++ struct crypto_blkcipher *tfm; ++ struct blkcipher_desc desc; ++ struct scatterlist sgd; ++ struct scatterlist sgs; ++ ++ tfm = crypto_alloc_blkcipher("cbc(aes)", 0, CRYPTO_ALG_ASYNC); ++ if (tfm == NULL) { ++ printk("failed to load transform for aes CBC\n"); ++ return -1; ++ } ++ ++ crypto_blkcipher_setkey(tfm, key, keylen); ++ crypto_blkcipher_set_iv(tfm, iv, 16); ++ ++ sg_init_one(&sgd, out, messagelen); ++ sg_init_one(&sgs, message, messagelen); ++ ++ desc.tfm = tfm; ++ desc.flags = 0; ++ ++ if (crypto_blkcipher_encrypt(&desc, &sgd, &sgs, messagelen)) { ++ crypto_free_blkcipher(tfm); ++ DWC_ERROR("AES CBC encryption failed"); ++ return -1; ++ } ++ ++ crypto_free_blkcipher(tfm); ++ return 0; ++} ++ ++int DWC_SHA256(uint8_t *message, uint32_t len, uint8_t *out) ++{ ++ struct crypto_hash *tfm; ++ struct hash_desc desc; ++ struct scatterlist sg; ++ ++ tfm = crypto_alloc_hash("sha256", 0, CRYPTO_ALG_ASYNC); ++ if (IS_ERR(tfm)) { ++ DWC_ERROR("Failed to load transform for sha256: %ld", PTR_ERR(tfm)); ++ return 0; ++ } ++ desc.tfm = tfm; ++ desc.flags = 0; ++ ++ sg_init_one(&sg, message, len); ++ crypto_hash_digest(&desc, &sg, len, out); ++ crypto_free_hash(tfm); ++ ++ return 1; ++} ++ ++int DWC_HMAC_SHA256(uint8_t *message, uint32_t messagelen, ++ uint8_t *key, uint32_t keylen, uint8_t *out) ++{ ++ struct crypto_hash *tfm; ++ struct hash_desc desc; ++ struct scatterlist sg; ++ ++ tfm = crypto_alloc_hash("hmac(sha256)", 0, CRYPTO_ALG_ASYNC); ++ if (IS_ERR(tfm)) { ++ DWC_ERROR("Failed to load transform for hmac(sha256): %ld", PTR_ERR(tfm)); ++ return 0; ++ } ++ desc.tfm = tfm; ++ desc.flags = 0; ++ ++ sg_init_one(&sg, message, messagelen); ++ crypto_hash_setkey(tfm, key, keylen); ++ crypto_hash_digest(&desc, &sg, messagelen, out); ++ crypto_free_hash(tfm); ++ ++ return 1; ++} ++ ++#endif /* DWC_CRYPTOLIB */ ++ ++ ++/* Byte Ordering Conversions */ ++ ++uint32_t DWC_CPU_TO_LE32(uint32_t *p) ++{ ++#ifdef __LITTLE_ENDIAN ++ return *p; ++#else ++ uint8_t *u_p = (uint8_t *)p; ++ ++ return (u_p[3] | (u_p[2] << 8) | (u_p[1] << 16) | (u_p[0] << 24)); ++#endif ++} ++ ++uint32_t DWC_CPU_TO_BE32(uint32_t *p) ++{ ++#ifdef __BIG_ENDIAN ++ return *p; ++#else ++ uint8_t *u_p = (uint8_t *)p; ++ ++ return (u_p[3] | (u_p[2] << 8) | (u_p[1] << 16) | (u_p[0] << 24)); ++#endif ++} ++ ++uint32_t DWC_LE32_TO_CPU(uint32_t *p) ++{ ++#ifdef __LITTLE_ENDIAN ++ return *p; ++#else ++ uint8_t *u_p = (uint8_t *)p; ++ ++ return (u_p[3] | (u_p[2] << 8) | (u_p[1] << 16) | (u_p[0] << 24)); ++#endif ++} ++ ++uint32_t DWC_BE32_TO_CPU(uint32_t *p) ++{ ++#ifdef __BIG_ENDIAN ++ return *p; ++#else ++ uint8_t *u_p = (uint8_t *)p; ++ ++ return (u_p[3] | (u_p[2] << 8) | (u_p[1] << 16) | (u_p[0] << 24)); ++#endif ++} ++ ++uint16_t DWC_CPU_TO_LE16(uint16_t *p) ++{ ++#ifdef __LITTLE_ENDIAN ++ return *p; ++#else ++ uint8_t *u_p = (uint8_t *)p; ++ return (u_p[1] | (u_p[0] << 8)); ++#endif ++} ++ ++uint16_t DWC_CPU_TO_BE16(uint16_t *p) ++{ ++#ifdef __BIG_ENDIAN ++ return *p; ++#else ++ uint8_t *u_p = (uint8_t *)p; ++ return (u_p[1] | (u_p[0] << 8)); ++#endif ++} ++ ++uint16_t DWC_LE16_TO_CPU(uint16_t *p) ++{ ++#ifdef __LITTLE_ENDIAN ++ return *p; ++#else ++ uint8_t *u_p = (uint8_t *)p; ++ return (u_p[1] | (u_p[0] << 8)); ++#endif ++} ++ ++uint16_t DWC_BE16_TO_CPU(uint16_t *p) ++{ ++#ifdef __BIG_ENDIAN ++ return *p; ++#else ++ uint8_t *u_p = (uint8_t *)p; ++ return (u_p[1] | (u_p[0] << 8)); ++#endif ++} ++ ++ ++/* Registers */ ++ ++uint32_t DWC_READ_REG32(void *io_ctx, uint32_t volatile *reg) ++{ ++ dwc_ioctx_t *io = (dwc_ioctx_t *)io_ctx; ++ bus_size_t ior = (bus_size_t)reg; ++ ++ return bus_space_read_4(io->iot, io->ioh, ior); ++} ++ ++#if 0 ++uint64_t DWC_READ_REG64(void *io_ctx, uint64_t volatile *reg) ++{ ++ dwc_ioctx_t *io = (dwc_ioctx_t *)io_ctx; ++ bus_size_t ior = (bus_size_t)reg; ++ ++ return bus_space_read_8(io->iot, io->ioh, ior); ++} ++#endif ++ ++void DWC_WRITE_REG32(void *io_ctx, uint32_t volatile *reg, uint32_t value) ++{ ++ dwc_ioctx_t *io = (dwc_ioctx_t *)io_ctx; ++ bus_size_t ior = (bus_size_t)reg; ++ ++ bus_space_write_4(io->iot, io->ioh, ior, value); ++} ++ ++#if 0 ++void DWC_WRITE_REG64(void *io_ctx, uint64_t volatile *reg, uint64_t value) ++{ ++ dwc_ioctx_t *io = (dwc_ioctx_t *)io_ctx; ++ bus_size_t ior = (bus_size_t)reg; ++ ++ bus_space_write_8(io->iot, io->ioh, ior, value); ++} ++#endif ++ ++void DWC_MODIFY_REG32(void *io_ctx, uint32_t volatile *reg, uint32_t clear_mask, ++ uint32_t set_mask) ++{ ++ dwc_ioctx_t *io = (dwc_ioctx_t *)io_ctx; ++ bus_size_t ior = (bus_size_t)reg; ++ ++ bus_space_write_4(io->iot, io->ioh, ior, ++ (bus_space_read_4(io->iot, io->ioh, ior) & ++ ~clear_mask) | set_mask); ++} ++ ++#if 0 ++void DWC_MODIFY_REG64(void *io_ctx, uint64_t volatile *reg, uint64_t clear_mask, ++ uint64_t set_mask) ++{ ++ dwc_ioctx_t *io = (dwc_ioctx_t *)io_ctx; ++ bus_size_t ior = (bus_size_t)reg; ++ ++ bus_space_write_8(io->iot, io->ioh, ior, ++ (bus_space_read_8(io->iot, io->ioh, ior) & ++ ~clear_mask) | set_mask); ++} ++#endif ++ ++ ++/* Locking */ ++ ++dwc_spinlock_t *DWC_SPINLOCK_ALLOC(void) ++{ ++ struct simplelock *sl = DWC_ALLOC(sizeof(*sl)); ++ ++ if (!sl) { ++ DWC_ERROR("Cannot allocate memory for spinlock"); ++ return NULL; ++ } ++ ++ simple_lock_init(sl); ++ return (dwc_spinlock_t *)sl; ++} ++ ++void DWC_SPINLOCK_FREE(dwc_spinlock_t *lock) ++{ ++ struct simplelock *sl = (struct simplelock *)lock; ++ ++ DWC_FREE(sl); ++} ++ ++void DWC_SPINLOCK(dwc_spinlock_t *lock) ++{ ++ simple_lock((struct simplelock *)lock); ++} ++ ++void DWC_SPINUNLOCK(dwc_spinlock_t *lock) ++{ ++ simple_unlock((struct simplelock *)lock); ++} ++ ++void DWC_SPINLOCK_IRQSAVE(dwc_spinlock_t *lock, dwc_irqflags_t *flags) ++{ ++ simple_lock((struct simplelock *)lock); ++ *flags = splbio(); ++} ++ ++void DWC_SPINUNLOCK_IRQRESTORE(dwc_spinlock_t *lock, dwc_irqflags_t flags) ++{ ++ splx(flags); ++ simple_unlock((struct simplelock *)lock); ++} ++ ++dwc_mutex_t *DWC_MUTEX_ALLOC(void) ++{ ++ dwc_mutex_t *mutex = DWC_ALLOC(sizeof(struct lock)); ++ ++ if (!mutex) { ++ DWC_ERROR("Cannot allocate memory for mutex"); ++ return NULL; ++ } ++ ++ lockinit((struct lock *)mutex, 0, "dw3mtx", 0, 0); ++ return mutex; ++} ++ ++#if (defined(DWC_LINUX) && defined(CONFIG_DEBUG_MUTEXES)) ++#else ++void DWC_MUTEX_FREE(dwc_mutex_t *mutex) ++{ ++ DWC_FREE(mutex); ++} ++#endif ++ ++void DWC_MUTEX_LOCK(dwc_mutex_t *mutex) ++{ ++ lockmgr((struct lock *)mutex, LK_EXCLUSIVE, NULL); ++} ++ ++int DWC_MUTEX_TRYLOCK(dwc_mutex_t *mutex) ++{ ++ int status; ++ ++ status = lockmgr((struct lock *)mutex, LK_EXCLUSIVE | LK_NOWAIT, NULL); ++ return status == 0; ++} ++ ++void DWC_MUTEX_UNLOCK(dwc_mutex_t *mutex) ++{ ++ lockmgr((struct lock *)mutex, LK_RELEASE, NULL); ++} ++ ++ ++/* Timing */ ++ ++void DWC_UDELAY(uint32_t usecs) ++{ ++ DELAY(usecs); ++} ++ ++void DWC_MDELAY(uint32_t msecs) ++{ ++ do { ++ DELAY(1000); ++ } while (--msecs); ++} ++ ++void DWC_MSLEEP(uint32_t msecs) ++{ ++ struct timeval tv; ++ ++ tv.tv_sec = msecs / 1000; ++ tv.tv_usec = (msecs - tv.tv_sec * 1000) * 1000; ++ tsleep(&tv, 0, "dw3slp", tvtohz(&tv)); ++} ++ ++uint32_t DWC_TIME(void) ++{ ++ struct timeval tv; ++ ++ microuptime(&tv); // or getmicrouptime? (less precise, but faster) ++ return tv.tv_sec * 1000 + tv.tv_usec / 1000; ++} ++ ++ ++/* Timers */ ++ ++struct dwc_timer { ++ struct callout t; ++ char *name; ++ dwc_spinlock_t *lock; ++ dwc_timer_callback_t cb; ++ void *data; ++}; ++ ++dwc_timer_t *DWC_TIMER_ALLOC(char *name, dwc_timer_callback_t cb, void *data) ++{ ++ dwc_timer_t *t = DWC_ALLOC(sizeof(*t)); ++ ++ if (!t) { ++ DWC_ERROR("Cannot allocate memory for timer"); ++ return NULL; ++ } ++ ++ callout_init(&t->t); ++ ++ t->name = DWC_STRDUP(name); ++ if (!t->name) { ++ DWC_ERROR("Cannot allocate memory for timer->name"); ++ goto no_name; ++ } ++ ++ t->lock = DWC_SPINLOCK_ALLOC(); ++ if (!t->lock) { ++ DWC_ERROR("Cannot allocate memory for timer->lock"); ++ goto no_lock; ++ } ++ ++ t->cb = cb; ++ t->data = data; ++ ++ return t; ++ ++ no_lock: ++ DWC_FREE(t->name); ++ no_name: ++ DWC_FREE(t); ++ ++ return NULL; ++} ++ ++void DWC_TIMER_FREE(dwc_timer_t *timer) ++{ ++ callout_stop(&timer->t); ++ DWC_SPINLOCK_FREE(timer->lock); ++ DWC_FREE(timer->name); ++ DWC_FREE(timer); ++} ++ ++void DWC_TIMER_SCHEDULE(dwc_timer_t *timer, uint32_t time) ++{ ++ struct timeval tv; ++ ++ tv.tv_sec = time / 1000; ++ tv.tv_usec = (time - tv.tv_sec * 1000) * 1000; ++ callout_reset(&timer->t, tvtohz(&tv), timer->cb, timer->data); ++} ++ ++void DWC_TIMER_CANCEL(dwc_timer_t *timer) ++{ ++ callout_stop(&timer->t); ++} ++ ++ ++/* Wait Queues */ ++ ++struct dwc_waitq { ++ struct simplelock lock; ++ int abort; ++}; ++ ++dwc_waitq_t *DWC_WAITQ_ALLOC(void) ++{ ++ dwc_waitq_t *wq = DWC_ALLOC(sizeof(*wq)); ++ ++ if (!wq) { ++ DWC_ERROR("Cannot allocate memory for waitqueue"); ++ return NULL; ++ } ++ ++ simple_lock_init(&wq->lock); ++ wq->abort = 0; ++ ++ return wq; ++} ++ ++void DWC_WAITQ_FREE(dwc_waitq_t *wq) ++{ ++ DWC_FREE(wq); ++} ++ ++int32_t DWC_WAITQ_WAIT(dwc_waitq_t *wq, dwc_waitq_condition_t cond, void *data) ++{ ++ int ipl; ++ int result = 0; ++ ++ simple_lock(&wq->lock); ++ ipl = splbio(); ++ ++ /* Skip the sleep if already aborted or triggered */ ++ if (!wq->abort && !cond(data)) { ++ splx(ipl); ++ result = ltsleep(wq, PCATCH, "dw3wat", 0, &wq->lock); // infinite timeout ++ ipl = splbio(); ++ } ++ ++ if (result == 0) { // awoken ++ if (wq->abort) { ++ wq->abort = 0; ++ result = -DWC_E_ABORT; ++ } else { ++ result = 0; ++ } ++ ++ splx(ipl); ++ simple_unlock(&wq->lock); ++ } else { ++ wq->abort = 0; ++ splx(ipl); ++ simple_unlock(&wq->lock); ++ ++ if (result == ERESTART) { // signaled - restart ++ result = -DWC_E_RESTART; ++ } else { // signaled - must be EINTR ++ result = -DWC_E_ABORT; ++ } ++ } ++ ++ return result; ++} ++ ++int32_t DWC_WAITQ_WAIT_TIMEOUT(dwc_waitq_t *wq, dwc_waitq_condition_t cond, ++ void *data, int32_t msecs) ++{ ++ struct timeval tv, tv1, tv2; ++ int ipl; ++ int result = 0; ++ ++ tv.tv_sec = msecs / 1000; ++ tv.tv_usec = (msecs - tv.tv_sec * 1000) * 1000; ++ ++ simple_lock(&wq->lock); ++ ipl = splbio(); ++ ++ /* Skip the sleep if already aborted or triggered */ ++ if (!wq->abort && !cond(data)) { ++ splx(ipl); ++ getmicrouptime(&tv1); ++ result = ltsleep(wq, PCATCH, "dw3wto", tvtohz(&tv), &wq->lock); ++ getmicrouptime(&tv2); ++ ipl = splbio(); ++ } ++ ++ if (result == 0) { // awoken ++ if (wq->abort) { ++ wq->abort = 0; ++ splx(ipl); ++ simple_unlock(&wq->lock); ++ result = -DWC_E_ABORT; ++ } else { ++ splx(ipl); ++ simple_unlock(&wq->lock); ++ ++ tv2.tv_usec -= tv1.tv_usec; ++ if (tv2.tv_usec < 0) { ++ tv2.tv_usec += 1000000; ++ tv2.tv_sec--; ++ } ++ ++ tv2.tv_sec -= tv1.tv_sec; ++ result = tv2.tv_sec * 1000 + tv2.tv_usec / 1000; ++ result = msecs - result; ++ if (result <= 0) ++ result = 1; ++ } ++ } else { ++ wq->abort = 0; ++ splx(ipl); ++ simple_unlock(&wq->lock); ++ ++ if (result == ERESTART) { // signaled - restart ++ result = -DWC_E_RESTART; ++ ++ } else if (result == EINTR) { // signaled - interrupt ++ result = -DWC_E_ABORT; ++ ++ } else { // timed out ++ result = -DWC_E_TIMEOUT; ++ } ++ } ++ ++ return result; ++} ++ ++void DWC_WAITQ_TRIGGER(dwc_waitq_t *wq) ++{ ++ wakeup(wq); ++} ++ ++void DWC_WAITQ_ABORT(dwc_waitq_t *wq) ++{ ++ int ipl; ++ ++ simple_lock(&wq->lock); ++ ipl = splbio(); ++ wq->abort = 1; ++ wakeup(wq); ++ splx(ipl); ++ simple_unlock(&wq->lock); ++} ++ ++ ++/* Threading */ ++ ++struct dwc_thread { ++ struct proc *proc; ++ int abort; ++}; ++ ++dwc_thread_t *DWC_THREAD_RUN(dwc_thread_function_t func, char *name, void *data) ++{ ++ int retval; ++ dwc_thread_t *thread = DWC_ALLOC(sizeof(*thread)); ++ ++ if (!thread) { ++ return NULL; ++ } ++ ++ thread->abort = 0; ++ retval = kthread_create1((void (*)(void *))func, data, &thread->proc, ++ "%s", name); ++ if (retval) { ++ DWC_FREE(thread); ++ return NULL; ++ } ++ ++ return thread; ++} ++ ++int DWC_THREAD_STOP(dwc_thread_t *thread) ++{ ++ int retval; ++ ++ thread->abort = 1; ++ retval = tsleep(&thread->abort, 0, "dw3stp", 60 * hz); ++ ++ if (retval == 0) { ++ /* DWC_THREAD_EXIT() will free the thread struct */ ++ return 0; ++ } ++ ++ /* NOTE: We leak the thread struct if thread doesn't die */ ++ ++ if (retval == EWOULDBLOCK) { ++ return -DWC_E_TIMEOUT; ++ } ++ ++ return -DWC_E_UNKNOWN; ++} ++ ++dwc_bool_t DWC_THREAD_SHOULD_STOP(dwc_thread_t *thread) ++{ ++ return thread->abort; ++} ++ ++void DWC_THREAD_EXIT(dwc_thread_t *thread) ++{ ++ wakeup(&thread->abort); ++ DWC_FREE(thread); ++ kthread_exit(0); ++} ++ ++/* tasklets ++ - Runs in interrupt context (cannot sleep) ++ - Each tasklet runs on a single CPU ++ - Different tasklets can be running simultaneously on different CPUs ++ [ On NetBSD there is no corresponding mechanism, drivers don't have bottom- ++ halves. So we just call the callback directly from DWC_TASK_SCHEDULE() ] ++ */ ++struct dwc_tasklet { ++ dwc_tasklet_callback_t cb; ++ void *data; ++}; ++ ++static void tasklet_callback(void *data) ++{ ++ dwc_tasklet_t *task = (dwc_tasklet_t *)data; ++ ++ task->cb(task->data); ++} ++ ++dwc_tasklet_t *DWC_TASK_ALLOC(char *name, dwc_tasklet_callback_t cb, void *data) ++{ ++ dwc_tasklet_t *task = DWC_ALLOC(sizeof(*task)); ++ ++ if (task) { ++ task->cb = cb; ++ task->data = data; ++ } else { ++ DWC_ERROR("Cannot allocate memory for tasklet"); ++ } ++ ++ return task; ++} ++ ++void DWC_TASK_FREE(dwc_tasklet_t *task) ++{ ++ DWC_FREE(task); ++} ++ ++void DWC_TASK_SCHEDULE(dwc_tasklet_t *task) ++{ ++ tasklet_callback(task); ++} ++ ++ ++/* workqueues ++ - Runs in process context (can sleep) ++ */ ++typedef struct work_container { ++ dwc_work_callback_t cb; ++ void *data; ++ dwc_workq_t *wq; ++ char *name; ++ int hz; ++ struct work task; ++} work_container_t; ++ ++struct dwc_workq { ++ struct workqueue *taskq; ++ dwc_spinlock_t *lock; ++ dwc_waitq_t *waitq; ++ int pending; ++ struct work_container *container; ++}; ++ ++static void do_work(struct work *task, void *data) ++{ ++ dwc_workq_t *wq = (dwc_workq_t *)data; ++ work_container_t *container = wq->container; ++ dwc_irqflags_t flags; ++ ++ if (container->hz) { ++ tsleep(container, 0, "dw3wrk", container->hz); ++ } ++ ++ container->cb(container->data); ++ DWC_DEBUG("Work done: %s, container=%p", container->name, container); ++ ++ DWC_SPINLOCK_IRQSAVE(wq->lock, &flags); ++ if (container->name) ++ DWC_FREE(container->name); ++ DWC_FREE(container); ++ wq->pending--; ++ DWC_SPINUNLOCK_IRQRESTORE(wq->lock, flags); ++ DWC_WAITQ_TRIGGER(wq->waitq); ++} ++ ++static int work_done(void *data) ++{ ++ dwc_workq_t *workq = (dwc_workq_t *)data; ++ ++ return workq->pending == 0; ++} ++ ++int DWC_WORKQ_WAIT_WORK_DONE(dwc_workq_t *workq, int timeout) ++{ ++ return DWC_WAITQ_WAIT_TIMEOUT(workq->waitq, work_done, workq, timeout); ++} ++ ++dwc_workq_t *DWC_WORKQ_ALLOC(char *name) ++{ ++ int result; ++ dwc_workq_t *wq = DWC_ALLOC(sizeof(*wq)); ++ ++ if (!wq) { ++ DWC_ERROR("Cannot allocate memory for workqueue"); ++ return NULL; ++ } ++ ++ result = workqueue_create(&wq->taskq, name, do_work, wq, 0 /*PWAIT*/, ++ IPL_BIO, 0); ++ if (result) { ++ DWC_ERROR("Cannot create workqueue"); ++ goto no_taskq; ++ } ++ ++ wq->pending = 0; ++ ++ wq->lock = DWC_SPINLOCK_ALLOC(); ++ if (!wq->lock) { ++ DWC_ERROR("Cannot allocate memory for spinlock"); ++ goto no_lock; ++ } ++ ++ wq->waitq = DWC_WAITQ_ALLOC(); ++ if (!wq->waitq) { ++ DWC_ERROR("Cannot allocate memory for waitqueue"); ++ goto no_waitq; ++ } ++ ++ return wq; ++ ++ no_waitq: ++ DWC_SPINLOCK_FREE(wq->lock); ++ no_lock: ++ workqueue_destroy(wq->taskq); ++ no_taskq: ++ DWC_FREE(wq); ++ ++ return NULL; ++} ++ ++void DWC_WORKQ_FREE(dwc_workq_t *wq) ++{ ++#ifdef DEBUG ++ dwc_irqflags_t flags; ++ ++ DWC_SPINLOCK_IRQSAVE(wq->lock, &flags); ++ ++ if (wq->pending != 0) { ++ struct work_container *container = wq->container; ++ ++ DWC_ERROR("Destroying work queue with pending work"); ++ ++ if (container && container->name) { ++ DWC_ERROR("Work %s still pending", container->name); ++ } ++ } ++ ++ DWC_SPINUNLOCK_IRQRESTORE(wq->lock, flags); ++#endif ++ DWC_WAITQ_FREE(wq->waitq); ++ DWC_SPINLOCK_FREE(wq->lock); ++ workqueue_destroy(wq->taskq); ++ DWC_FREE(wq); ++} ++ ++void DWC_WORKQ_SCHEDULE(dwc_workq_t *wq, dwc_work_callback_t cb, void *data, ++ char *format, ...) ++{ ++ dwc_irqflags_t flags; ++ work_container_t *container; ++ static char name[128]; ++ va_list args; ++ ++ va_start(args, format); ++ DWC_VSNPRINTF(name, 128, format, args); ++ va_end(args); ++ ++ DWC_SPINLOCK_IRQSAVE(wq->lock, &flags); ++ wq->pending++; ++ DWC_SPINUNLOCK_IRQRESTORE(wq->lock, flags); ++ DWC_WAITQ_TRIGGER(wq->waitq); ++ ++ container = DWC_ALLOC_ATOMIC(sizeof(*container)); ++ if (!container) { ++ DWC_ERROR("Cannot allocate memory for container"); ++ return; ++ } ++ ++ container->name = DWC_STRDUP(name); ++ if (!container->name) { ++ DWC_ERROR("Cannot allocate memory for container->name"); ++ DWC_FREE(container); ++ return; ++ } ++ ++ container->cb = cb; ++ container->data = data; ++ container->wq = wq; ++ container->hz = 0; ++ wq->container = container; ++ ++ DWC_DEBUG("Queueing work: %s, container=%p", container->name, container); ++ workqueue_enqueue(wq->taskq, &container->task); ++} ++ ++void DWC_WORKQ_SCHEDULE_DELAYED(dwc_workq_t *wq, dwc_work_callback_t cb, ++ void *data, uint32_t time, char *format, ...) ++{ ++ dwc_irqflags_t flags; ++ work_container_t *container; ++ static char name[128]; ++ struct timeval tv; ++ va_list args; ++ ++ va_start(args, format); ++ DWC_VSNPRINTF(name, 128, format, args); ++ va_end(args); ++ ++ DWC_SPINLOCK_IRQSAVE(wq->lock, &flags); ++ wq->pending++; ++ DWC_SPINUNLOCK_IRQRESTORE(wq->lock, flags); ++ DWC_WAITQ_TRIGGER(wq->waitq); ++ ++ container = DWC_ALLOC_ATOMIC(sizeof(*container)); ++ if (!container) { ++ DWC_ERROR("Cannot allocate memory for container"); ++ return; ++ } ++ ++ container->name = DWC_STRDUP(name); ++ if (!container->name) { ++ DWC_ERROR("Cannot allocate memory for container->name"); ++ DWC_FREE(container); ++ return; ++ } ++ ++ container->cb = cb; ++ container->data = data; ++ container->wq = wq; ++ tv.tv_sec = time / 1000; ++ tv.tv_usec = (time - tv.tv_sec * 1000) * 1000; ++ container->hz = tvtohz(&tv); ++ wq->container = container; ++ ++ DWC_DEBUG("Queueing work: %s, container=%p", container->name, container); ++ workqueue_enqueue(wq->taskq, &container->task); ++} ++ ++int DWC_WORKQ_PENDING(dwc_workq_t *wq) ++{ ++ return wq->pending; ++} +diff --git a/drivers/usb/host/dwc_common_port/dwc_crypto.c b/drivers/usb/host/dwc_common_port/dwc_crypto.c +new file mode 100644 +index 0000000..3b03532 +--- /dev/null ++++ b/drivers/usb/host/dwc_common_port/dwc_crypto.c +@@ -0,0 +1,308 @@ ++/* ========================================================================= ++ * $File: //dwh/usb_iip/dev/software/dwc_common_port_2/dwc_crypto.c $ ++ * $Revision: #5 $ ++ * $Date: 2010/09/28 $ ++ * $Change: 1596182 $ ++ * ++ * Synopsys Portability Library Software and documentation ++ * (hereinafter, "Software") is an Unsupported proprietary work of ++ * Synopsys, Inc. unless otherwise expressly agreed to in writing ++ * between Synopsys and you. ++ * ++ * The Software IS NOT an item of Licensed Software or Licensed Product ++ * under any End User Software License Agreement or Agreement for ++ * Licensed Product with Synopsys or any supplement thereto. You are ++ * permitted to use and redistribute this Software in source and binary ++ * forms, with or without modification, provided that redistributions ++ * of source code must retain this notice. You may not view, use, ++ * disclose, copy or distribute this file or any information contained ++ * herein except pursuant to this license grant from Synopsys. If you ++ * do not agree with this notice, including the disclaimer below, then ++ * you are not authorized to use the Software. ++ * ++ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" ++ * BASIS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ++ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS ++ * FOR A PARTICULAR PURPOSE ARE HEREBY DISCLAIMED. IN NO EVENT SHALL ++ * SYNOPSYS 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. ++ * ========================================================================= */ ++ ++/** @file ++ * This file contains the WUSB cryptographic routines. ++ */ ++ ++#ifdef DWC_CRYPTOLIB ++ ++#include "dwc_crypto.h" ++#include "usb.h" ++ ++#ifdef DEBUG ++static inline void dump_bytes(char *name, uint8_t *bytes, int len) ++{ ++ int i; ++ DWC_PRINTF("%s: ", name); ++ for (i=0; i<len; i++) { ++ DWC_PRINTF("%02x ", bytes[i]); ++ } ++ DWC_PRINTF("\n"); ++} ++#else ++#define dump_bytes(x...) ++#endif ++ ++/* Display a block */ ++void show_block(const u8 *blk, const char *prefix, const char *suffix, int a) ++{ ++#ifdef DWC_DEBUG_CRYPTO ++ int i, blksize = 16; ++ ++ DWC_DEBUG("%s", prefix); ++ ++ if (suffix == NULL) { ++ suffix = "\n"; ++ blksize = a; ++ } ++ ++ for (i = 0; i < blksize; i++) ++ DWC_PRINT("%02x%s", *blk++, ((i & 3) == 3) ? " " : " "); ++ DWC_PRINT(suffix); ++#endif ++} ++ ++/** ++ * Encrypts an array of bytes using the AES encryption engine. ++ * If <code>dst</code> == <code>src</code>, then the bytes will be encrypted ++ * in-place. ++ * ++ * @return 0 on success, negative error code on error. ++ */ ++int dwc_wusb_aes_encrypt(u8 *src, u8 *key, u8 *dst) ++{ ++ u8 block_t[16]; ++ DWC_MEMSET(block_t, 0, 16); ++ ++ return DWC_AES_CBC(src, 16, key, 16, block_t, dst); ++} ++ ++/** ++ * The CCM-MAC-FUNCTION described in section 6.5 of the WUSB spec. ++ * This function takes a data string and returns the encrypted CBC ++ * Counter-mode MIC. ++ * ++ * @param key The 128-bit symmetric key. ++ * @param nonce The CCM nonce. ++ * @param label The unique 14-byte ASCII text label. ++ * @param bytes The byte array to be encrypted. ++ * @param len Length of the byte array. ++ * @param result Byte array to receive the 8-byte encrypted MIC. ++ */ ++void dwc_wusb_cmf(u8 *key, u8 *nonce, ++ char *label, u8 *bytes, int len, u8 *result) ++{ ++ u8 block_m[16]; ++ u8 block_x[16]; ++ u8 block_t[8]; ++ int idx, blkNum; ++ u16 la = (u16)(len + 14); ++ ++ /* Set the AES-128 key */ ++ //dwc_aes_setkey(tfm, key, 16); ++ ++ /* Fill block B0 from flags = 0x59, N, and l(m) = 0 */ ++ block_m[0] = 0x59; ++ for (idx = 0; idx < 13; idx++) ++ block_m[idx + 1] = nonce[idx]; ++ block_m[14] = 0; ++ block_m[15] = 0; ++ ++ /* Produce the CBC IV */ ++ dwc_wusb_aes_encrypt(block_m, key, block_x); ++ show_block(block_m, "CBC IV in: ", "\n", 0); ++ show_block(block_x, "CBC IV out:", "\n", 0); ++ ++ /* Fill block B1 from l(a) = Blen + 14, and A */ ++ block_x[0] ^= (u8)(la >> 8); ++ block_x[1] ^= (u8)la; ++ for (idx = 0; idx < 14; idx++) ++ block_x[idx + 2] ^= label[idx]; ++ show_block(block_x, "After xor: ", "b1\n", 16); ++ ++ dwc_wusb_aes_encrypt(block_x, key, block_x); ++ show_block(block_x, "After AES: ", "b1\n", 16); ++ ++ idx = 0; ++ blkNum = 0; ++ ++ /* Fill remaining blocks with B */ ++ while (len-- > 0) { ++ block_x[idx] ^= *bytes++; ++ if (++idx >= 16) { ++ idx = 0; ++ show_block(block_x, "After xor: ", "\n", blkNum); ++ dwc_wusb_aes_encrypt(block_x, key, block_x); ++ show_block(block_x, "After AES: ", "\n", blkNum); ++ blkNum++; ++ } ++ } ++ ++ /* Handle partial last block */ ++ if (idx > 0) { ++ show_block(block_x, "After xor: ", "\n", blkNum); ++ dwc_wusb_aes_encrypt(block_x, key, block_x); ++ show_block(block_x, "After AES: ", "\n", blkNum); ++ } ++ ++ /* Save the MIC tag */ ++ DWC_MEMCPY(block_t, block_x, 8); ++ show_block(block_t, "MIC tag : ", NULL, 8); ++ ++ /* Fill block A0 from flags = 0x01, N, and counter = 0 */ ++ block_m[0] = 0x01; ++ block_m[14] = 0; ++ block_m[15] = 0; ++ ++ /* Encrypt the counter */ ++ dwc_wusb_aes_encrypt(block_m, key, block_x); ++ show_block(block_x, "CTR[MIC] : ", NULL, 8); ++ ++ /* XOR with MIC tag */ ++ for (idx = 0; idx < 8; idx++) { ++ block_t[idx] ^= block_x[idx]; ++ } ++ ++ /* Return result to caller */ ++ DWC_MEMCPY(result, block_t, 8); ++ show_block(result, "CCM-MIC : ", NULL, 8); ++ ++} ++ ++/** ++ * The PRF function described in section 6.5 of the WUSB spec. This function ++ * concatenates MIC values returned from dwc_cmf() to create a value of ++ * the requested length. ++ * ++ * @param prf_len Length of the PRF function in bits (64, 128, or 256). ++ * @param key, nonce, label, bytes, len Same as for dwc_cmf(). ++ * @param result Byte array to receive the result. ++ */ ++void dwc_wusb_prf(int prf_len, u8 *key, ++ u8 *nonce, char *label, u8 *bytes, int len, u8 *result) ++{ ++ int i; ++ ++ nonce[0] = 0; ++ for (i = 0; i < prf_len >> 6; i++, nonce[0]++) { ++ dwc_wusb_cmf(key, nonce, label, bytes, len, result); ++ result += 8; ++ } ++} ++ ++/** ++ * Fills in CCM Nonce per the WUSB spec. ++ * ++ * @param[in] haddr Host address. ++ * @param[in] daddr Device address. ++ * @param[in] tkid Session Key(PTK) identifier. ++ * @param[out] nonce Pointer to where the CCM Nonce output is to be written. ++ */ ++void dwc_wusb_fill_ccm_nonce(uint16_t haddr, uint16_t daddr, uint8_t *tkid, ++ uint8_t *nonce) ++{ ++ ++ DWC_DEBUG("%s %x %x\n", __func__, daddr, haddr); ++ ++ DWC_MEMSET(&nonce[0], 0, 16); ++ ++ DWC_MEMCPY(&nonce[6], tkid, 3); ++ nonce[9] = daddr & 0xFF; ++ nonce[10] = (daddr >> 8) & 0xFF; ++ nonce[11] = haddr & 0xFF; ++ nonce[12] = (haddr >> 8) & 0xFF; ++ ++ dump_bytes("CCM nonce", nonce, 16); ++} ++ ++/** ++ * Generates a 16-byte cryptographic-grade random number for the Host/Device ++ * Nonce. ++ */ ++void dwc_wusb_gen_nonce(uint16_t addr, uint8_t *nonce) ++{ ++ uint8_t inonce[16]; ++ uint32_t temp[4]; ++ ++ /* Fill in the Nonce */ ++ DWC_MEMSET(&inonce[0], 0, sizeof(inonce)); ++ inonce[9] = addr & 0xFF; ++ inonce[10] = (addr >> 8) & 0xFF; ++ inonce[11] = inonce[9]; ++ inonce[12] = inonce[10]; ++ ++ /* Collect "randomness samples" */ ++ DWC_RANDOM_BYTES((uint8_t *)temp, 16); ++ ++ dwc_wusb_prf_128((uint8_t *)temp, nonce, ++ "Random Numbers", (uint8_t *)temp, sizeof(temp), ++ nonce); ++} ++ ++/** ++ * Generates the Session Key (PTK) and Key Confirmation Key (KCK) per the ++ * WUSB spec. ++ * ++ * @param[in] ccm_nonce Pointer to CCM Nonce. ++ * @param[in] mk Master Key to derive the session from ++ * @param[in] hnonce Pointer to Host Nonce. ++ * @param[in] dnonce Pointer to Device Nonce. ++ * @param[out] kck Pointer to where the KCK output is to be written. ++ * @param[out] ptk Pointer to where the PTK output is to be written. ++ */ ++void dwc_wusb_gen_key(uint8_t *ccm_nonce, uint8_t *mk, uint8_t *hnonce, ++ uint8_t *dnonce, uint8_t *kck, uint8_t *ptk) ++{ ++ uint8_t idata[32]; ++ uint8_t odata[32]; ++ ++ dump_bytes("ck", mk, 16); ++ dump_bytes("hnonce", hnonce, 16); ++ dump_bytes("dnonce", dnonce, 16); ++ ++ /* The data is the HNonce and DNonce concatenated */ ++ DWC_MEMCPY(&idata[0], hnonce, 16); ++ DWC_MEMCPY(&idata[16], dnonce, 16); ++ ++ dwc_wusb_prf_256(mk, ccm_nonce, "Pair-wise keys", idata, 32, odata); ++ ++ /* Low 16 bytes of the result is the KCK, high 16 is the PTK */ ++ DWC_MEMCPY(kck, &odata[0], 16); ++ DWC_MEMCPY(ptk, &odata[16], 16); ++ ++ dump_bytes("kck", kck, 16); ++ dump_bytes("ptk", ptk, 16); ++} ++ ++/** ++ * Generates the Message Integrity Code over the Handshake data per the ++ * WUSB spec. ++ * ++ * @param ccm_nonce Pointer to CCM Nonce. ++ * @param kck Pointer to Key Confirmation Key. ++ * @param data Pointer to Handshake data to be checked. ++ * @param mic Pointer to where the MIC output is to be written. ++ */ ++void dwc_wusb_gen_mic(uint8_t *ccm_nonce, uint8_t *kck, ++ uint8_t *data, uint8_t *mic) ++{ ++ ++ dwc_wusb_prf_64(kck, ccm_nonce, "out-of-bandMIC", ++ data, WUSB_HANDSHAKE_LEN_FOR_MIC, mic); ++} ++ ++#endif /* DWC_CRYPTOLIB */ +diff --git a/drivers/usb/host/dwc_common_port/dwc_crypto.h b/drivers/usb/host/dwc_common_port/dwc_crypto.h +new file mode 100644 +index 0000000..26fcddc +--- /dev/null ++++ b/drivers/usb/host/dwc_common_port/dwc_crypto.h +@@ -0,0 +1,111 @@ ++/* ========================================================================= ++ * $File: //dwh/usb_iip/dev/software/dwc_common_port_2/dwc_crypto.h $ ++ * $Revision: #3 $ ++ * $Date: 2010/09/28 $ ++ * $Change: 1596182 $ ++ * ++ * Synopsys Portability Library Software and documentation ++ * (hereinafter, "Software") is an Unsupported proprietary work of ++ * Synopsys, Inc. unless otherwise expressly agreed to in writing ++ * between Synopsys and you. ++ * ++ * The Software IS NOT an item of Licensed Software or Licensed Product ++ * under any End User Software License Agreement or Agreement for ++ * Licensed Product with Synopsys or any supplement thereto. You are ++ * permitted to use and redistribute this Software in source and binary ++ * forms, with or without modification, provided that redistributions ++ * of source code must retain this notice. You may not view, use, ++ * disclose, copy or distribute this file or any information contained ++ * herein except pursuant to this license grant from Synopsys. If you ++ * do not agree with this notice, including the disclaimer below, then ++ * you are not authorized to use the Software. ++ * ++ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" ++ * BASIS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ++ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS ++ * FOR A PARTICULAR PURPOSE ARE HEREBY DISCLAIMED. IN NO EVENT SHALL ++ * SYNOPSYS 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. ++ * ========================================================================= */ ++ ++#ifndef _DWC_CRYPTO_H_ ++#define _DWC_CRYPTO_H_ ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++/** @file ++ * ++ * This file contains declarations for the WUSB Cryptographic routines as ++ * defined in the WUSB spec. They are only to be used internally by the DWC UWB ++ * modules. ++ */ ++ ++#include "dwc_os.h" ++ ++int dwc_wusb_aes_encrypt(u8 *src, u8 *key, u8 *dst); ++ ++void dwc_wusb_cmf(u8 *key, u8 *nonce, ++ char *label, u8 *bytes, int len, u8 *result); ++void dwc_wusb_prf(int prf_len, u8 *key, ++ u8 *nonce, char *label, u8 *bytes, int len, u8 *result); ++ ++/** ++ * The PRF-64 function described in section 6.5 of the WUSB spec. ++ * ++ * @param key, nonce, label, bytes, len, result Same as for dwc_prf(). ++ */ ++static inline void dwc_wusb_prf_64(u8 *key, u8 *nonce, ++ char *label, u8 *bytes, int len, u8 *result) ++{ ++ dwc_wusb_prf(64, key, nonce, label, bytes, len, result); ++} ++ ++/** ++ * The PRF-128 function described in section 6.5 of the WUSB spec. ++ * ++ * @param key, nonce, label, bytes, len, result Same as for dwc_prf(). ++ */ ++static inline void dwc_wusb_prf_128(u8 *key, u8 *nonce, ++ char *label, u8 *bytes, int len, u8 *result) ++{ ++ dwc_wusb_prf(128, key, nonce, label, bytes, len, result); ++} ++ ++/** ++ * The PRF-256 function described in section 6.5 of the WUSB spec. ++ * ++ * @param key, nonce, label, bytes, len, result Same as for dwc_prf(). ++ */ ++static inline void dwc_wusb_prf_256(u8 *key, u8 *nonce, ++ char *label, u8 *bytes, int len, u8 *result) ++{ ++ dwc_wusb_prf(256, key, nonce, label, bytes, len, result); ++} ++ ++ ++void dwc_wusb_fill_ccm_nonce(uint16_t haddr, uint16_t daddr, uint8_t *tkid, ++ uint8_t *nonce); ++void dwc_wusb_gen_nonce(uint16_t addr, ++ uint8_t *nonce); ++ ++void dwc_wusb_gen_key(uint8_t *ccm_nonce, uint8_t *mk, ++ uint8_t *hnonce, uint8_t *dnonce, ++ uint8_t *kck, uint8_t *ptk); ++ ++ ++void dwc_wusb_gen_mic(uint8_t *ccm_nonce, uint8_t ++ *kck, uint8_t *data, uint8_t *mic); ++ ++#ifdef __cplusplus ++} ++#endif ++ ++#endif /* _DWC_CRYPTO_H_ */ +diff --git a/drivers/usb/host/dwc_common_port/dwc_dh.c b/drivers/usb/host/dwc_common_port/dwc_dh.c +new file mode 100644 +index 0000000..2b429a3 +--- /dev/null ++++ b/drivers/usb/host/dwc_common_port/dwc_dh.c +@@ -0,0 +1,291 @@ ++/* ========================================================================= ++ * $File: //dwh/usb_iip/dev/software/dwc_common_port_2/dwc_dh.c $ ++ * $Revision: #3 $ ++ * $Date: 2010/09/28 $ ++ * $Change: 1596182 $ ++ * ++ * Synopsys Portability Library Software and documentation ++ * (hereinafter, "Software") is an Unsupported proprietary work of ++ * Synopsys, Inc. unless otherwise expressly agreed to in writing ++ * between Synopsys and you. ++ * ++ * The Software IS NOT an item of Licensed Software or Licensed Product ++ * under any End User Software License Agreement or Agreement for ++ * Licensed Product with Synopsys or any supplement thereto. You are ++ * permitted to use and redistribute this Software in source and binary ++ * forms, with or without modification, provided that redistributions ++ * of source code must retain this notice. You may not view, use, ++ * disclose, copy or distribute this file or any information contained ++ * herein except pursuant to this license grant from Synopsys. If you ++ * do not agree with this notice, including the disclaimer below, then ++ * you are not authorized to use the Software. ++ * ++ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" ++ * BASIS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ++ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS ++ * FOR A PARTICULAR PURPOSE ARE HEREBY DISCLAIMED. IN NO EVENT SHALL ++ * SYNOPSYS 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. ++ * ========================================================================= */ ++#ifdef DWC_CRYPTOLIB ++ ++#ifndef CONFIG_MACH_IPMATE ++ ++#include "dwc_dh.h" ++#include "dwc_modpow.h" ++ ++#ifdef DEBUG ++/* This function prints out a buffer in the format described in the Association ++ * Model specification. */ ++static void dh_dump(char *str, void *_num, int len) ++{ ++ uint8_t *num = _num; ++ int i; ++ DWC_PRINTF("%s\n", str); ++ for (i = 0; i < len; i ++) { ++ DWC_PRINTF("%02x", num[i]); ++ if (((i + 1) % 2) == 0) DWC_PRINTF(" "); ++ if (((i + 1) % 26) == 0) DWC_PRINTF("\n"); ++ } ++ ++ DWC_PRINTF("\n"); ++} ++#else ++#define dh_dump(_x...) do {; } while(0) ++#endif ++ ++/* Constant g value */ ++static __u32 dh_g[] = { ++ 0x02000000, ++}; ++ ++/* Constant p value */ ++static __u32 dh_p[] = { ++ 0xFFFFFFFF, 0xFFFFFFFF, 0xA2DA0FC9, 0x34C26821, 0x8B62C6C4, 0xD11CDC80, 0x084E0229, 0x74CC678A, ++ 0xA6BE0B02, 0x229B133B, 0x79084A51, 0xDD04348E, 0xB31995EF, 0x1B433ACD, 0x6D0A2B30, 0x37145FF2, ++ 0x6D35E14F, 0x45C2516D, 0x76B585E4, 0xC67E5E62, 0xE9424CF4, 0x6BED37A6, 0xB65CFF0B, 0xEDB706F4, ++ 0xFB6B38EE, 0xA59F895A, 0x11249FAE, 0xE61F4B7C, 0x51662849, 0x3D5BE4EC, 0xB87C00C2, 0x05BF63A1, ++ 0x3648DA98, 0x9AD3551C, 0xA83F1669, 0x5FCF24FD, 0x235D6583, 0x96ADA3DC, 0x56F3621C, 0xBB528520, ++ 0x0729D59E, 0x6D969670, 0x4E350C67, 0x0498BC4A, 0x086C74F1, 0x7C2118CA, 0x465E9032, 0x3BCE362E, ++ 0x2C779EE3, 0x03860E18, 0xA283279B, 0x8FA207EC, 0xF05DC5B5, 0xC9524C6F, 0xF6CB2BDE, 0x18175895, ++ 0x7C499539, 0xE56A95EA, 0x1826D215, 0x1005FA98, 0x5A8E7215, 0x2DC4AA8A, 0x0D1733AD, 0x337A5004, ++ 0xAB2155A8, 0x64BA1CDF, 0x0485FBEC, 0x0AEFDB58, 0x5771EA8A, 0x7D0C065D, 0x850F97B3, 0xC7E4E1A6, ++ 0x8CAEF5AB, 0xD73309DB, 0xE0948C1E, 0x9D61254A, 0x26D2E3CE, 0x6BEED21A, 0x06FA2FF1, 0x64088AD9, ++ 0x730276D8, 0x646AC83E, 0x182B1F52, 0x0C207B17, 0x5717E1BB, 0x6C5D617A, 0xC0880977, 0xE246D9BA, ++ 0xA04FE208, 0x31ABE574, 0xFC5BDB43, 0x8E10FDE0, 0x20D1824B, 0xCAD23AA9, 0xFFFFFFFF, 0xFFFFFFFF, ++}; ++ ++static void dh_swap_bytes(void *_in, void *_out, uint32_t len) ++{ ++ uint8_t *in = _in; ++ uint8_t *out = _out; ++ int i; ++ for (i=0; i<len; i++) { ++ out[i] = in[len-1-i]; ++ } ++} ++ ++/* Computes the modular exponentiation (num^exp % mod). num, exp, and mod are ++ * big endian numbers of size len, in bytes. Each len value must be a multiple ++ * of 4. */ ++int dwc_dh_modpow(void *mem_ctx, void *num, uint32_t num_len, ++ void *exp, uint32_t exp_len, ++ void *mod, uint32_t mod_len, ++ void *out) ++{ ++ /* modpow() takes little endian numbers. AM uses big-endian. This ++ * function swaps bytes of numbers before passing onto modpow. */ ++ ++ int retval = 0; ++ uint32_t *result; ++ ++ uint32_t *bignum_num = dwc_alloc(mem_ctx, num_len + 4); ++ uint32_t *bignum_exp = dwc_alloc(mem_ctx, exp_len + 4); ++ uint32_t *bignum_mod = dwc_alloc(mem_ctx, mod_len + 4); ++ ++ dh_swap_bytes(num, &bignum_num[1], num_len); ++ bignum_num[0] = num_len / 4; ++ ++ dh_swap_bytes(exp, &bignum_exp[1], exp_len); ++ bignum_exp[0] = exp_len / 4; ++ ++ dh_swap_bytes(mod, &bignum_mod[1], mod_len); ++ bignum_mod[0] = mod_len / 4; ++ ++ result = dwc_modpow(mem_ctx, bignum_num, bignum_exp, bignum_mod); ++ if (!result) { ++ retval = -1; ++ goto dh_modpow_nomem; ++ } ++ ++ dh_swap_bytes(&result[1], out, result[0] * 4); ++ dwc_free(mem_ctx, result); ++ ++ dh_modpow_nomem: ++ dwc_free(mem_ctx, bignum_num); ++ dwc_free(mem_ctx, bignum_exp); ++ dwc_free(mem_ctx, bignum_mod); ++ return retval; ++} ++ ++ ++int dwc_dh_pk(void *mem_ctx, uint8_t nd, uint8_t *exp, uint8_t *pk, uint8_t *hash) ++{ ++ int retval; ++ uint8_t m3[385]; ++ ++#ifndef DH_TEST_VECTORS ++ DWC_RANDOM_BYTES(exp, 32); ++#endif ++ ++ /* Compute the pkd */ ++ if ((retval = dwc_dh_modpow(mem_ctx, dh_g, 4, ++ exp, 32, ++ dh_p, 384, pk))) { ++ return retval; ++ } ++ ++ m3[384] = nd; ++ DWC_MEMCPY(&m3[0], pk, 384); ++ DWC_SHA256(m3, 385, hash); ++ ++ dh_dump("PK", pk, 384); ++ dh_dump("SHA-256(M3)", hash, 32); ++ return 0; ++} ++ ++int dwc_dh_derive_keys(void *mem_ctx, uint8_t nd, uint8_t *pkh, uint8_t *pkd, ++ uint8_t *exp, int is_host, ++ char *dd, uint8_t *ck, uint8_t *kdk) ++{ ++ int retval; ++ uint8_t mv[784]; ++ uint8_t sha_result[32]; ++ uint8_t dhkey[384]; ++ uint8_t shared_secret[384]; ++ char *message; ++ uint32_t vd; ++ ++ uint8_t *pk; ++ ++ if (is_host) { ++ pk = pkd; ++ } ++ else { ++ pk = pkh; ++ } ++ ++ if ((retval = dwc_dh_modpow(mem_ctx, pk, 384, ++ exp, 32, ++ dh_p, 384, shared_secret))) { ++ return retval; ++ } ++ dh_dump("Shared Secret", shared_secret, 384); ++ ++ DWC_SHA256(shared_secret, 384, dhkey); ++ dh_dump("DHKEY", dhkey, 384); ++ ++ DWC_MEMCPY(&mv[0], pkd, 384); ++ DWC_MEMCPY(&mv[384], pkh, 384); ++ DWC_MEMCPY(&mv[768], "displayed digest", 16); ++ dh_dump("MV", mv, 784); ++ ++ DWC_SHA256(mv, 784, sha_result); ++ dh_dump("SHA-256(MV)", sha_result, 32); ++ dh_dump("First 32-bits of SHA-256(MV)", sha_result, 4); ++ ++ dh_swap_bytes(sha_result, &vd, 4); ++#ifdef DEBUG ++ DWC_PRINTF("Vd (decimal) = %d\n", vd); ++#endif ++ ++ switch (nd) { ++ case 2: ++ vd = vd % 100; ++ DWC_SPRINTF(dd, "%02d", vd); ++ break; ++ case 3: ++ vd = vd % 1000; ++ DWC_SPRINTF(dd, "%03d", vd); ++ break; ++ case 4: ++ vd = vd % 10000; ++ DWC_SPRINTF(dd, "%04d", vd); ++ break; ++ } ++#ifdef DEBUG ++ DWC_PRINTF("Display Digits: %s\n", dd); ++#endif ++ ++ message = "connection key"; ++ DWC_HMAC_SHA256(message, DWC_STRLEN(message), dhkey, 32, sha_result); ++ dh_dump("HMAC(SHA-256, DHKey, connection key)", sha_result, 32); ++ DWC_MEMCPY(ck, sha_result, 16); ++ ++ message = "key derivation key"; ++ DWC_HMAC_SHA256(message, DWC_STRLEN(message), dhkey, 32, sha_result); ++ dh_dump("HMAC(SHA-256, DHKey, key derivation key)", sha_result, 32); ++ DWC_MEMCPY(kdk, sha_result, 32); ++ ++ return 0; ++} ++ ++ ++#ifdef DH_TEST_VECTORS ++ ++static __u8 dh_a[] = { ++ 0x44, 0x00, 0x51, 0xd6, ++ 0xf0, 0xb5, 0x5e, 0xa9, ++ 0x67, 0xab, 0x31, 0xc6, ++ 0x8a, 0x8b, 0x5e, 0x37, ++ 0xd9, 0x10, 0xda, 0xe0, ++ 0xe2, 0xd4, 0x59, 0xa4, ++ 0x86, 0x45, 0x9c, 0xaa, ++ 0xdf, 0x36, 0x75, 0x16, ++}; ++ ++static __u8 dh_b[] = { ++ 0x5d, 0xae, 0xc7, 0x86, ++ 0x79, 0x80, 0xa3, 0x24, ++ 0x8c, 0xe3, 0x57, 0x8f, ++ 0xc7, 0x5f, 0x1b, 0x0f, ++ 0x2d, 0xf8, 0x9d, 0x30, ++ 0x6f, 0xa4, 0x52, 0xcd, ++ 0xe0, 0x7a, 0x04, 0x8a, ++ 0xde, 0xd9, 0x26, 0x56, ++}; ++ ++void dwc_run_dh_test_vectors(void *mem_ctx) ++{ ++ uint8_t pkd[384]; ++ uint8_t pkh[384]; ++ uint8_t hashd[32]; ++ uint8_t hashh[32]; ++ uint8_t ck[16]; ++ uint8_t kdk[32]; ++ char dd[5]; ++ ++ DWC_PRINTF("\n\n\nDH_TEST_VECTORS\n\n"); ++ ++ /* compute the PKd and SHA-256(PKd || Nd) */ ++ DWC_PRINTF("Computing PKd\n"); ++ dwc_dh_pk(mem_ctx, 2, dh_a, pkd, hashd); ++ ++ /* compute the PKd and SHA-256(PKh || Nd) */ ++ DWC_PRINTF("Computing PKh\n"); ++ dwc_dh_pk(mem_ctx, 2, dh_b, pkh, hashh); ++ ++ /* compute the dhkey */ ++ dwc_dh_derive_keys(mem_ctx, 2, pkh, pkd, dh_a, 0, dd, ck, kdk); ++} ++#endif /* DH_TEST_VECTORS */ ++ ++#endif /* !CONFIG_MACH_IPMATE */ ++ ++#endif /* DWC_CRYPTOLIB */ +diff --git a/drivers/usb/host/dwc_common_port/dwc_dh.h b/drivers/usb/host/dwc_common_port/dwc_dh.h +new file mode 100644 +index 0000000..25c1cc0 +--- /dev/null ++++ b/drivers/usb/host/dwc_common_port/dwc_dh.h +@@ -0,0 +1,106 @@ ++/* ========================================================================= ++ * $File: //dwh/usb_iip/dev/software/dwc_common_port_2/dwc_dh.h $ ++ * $Revision: #4 $ ++ * $Date: 2010/09/28 $ ++ * $Change: 1596182 $ ++ * ++ * Synopsys Portability Library Software and documentation ++ * (hereinafter, "Software") is an Unsupported proprietary work of ++ * Synopsys, Inc. unless otherwise expressly agreed to in writing ++ * between Synopsys and you. ++ * ++ * The Software IS NOT an item of Licensed Software or Licensed Product ++ * under any End User Software License Agreement or Agreement for ++ * Licensed Product with Synopsys or any supplement thereto. You are ++ * permitted to use and redistribute this Software in source and binary ++ * forms, with or without modification, provided that redistributions ++ * of source code must retain this notice. You may not view, use, ++ * disclose, copy or distribute this file or any information contained ++ * herein except pursuant to this license grant from Synopsys. If you ++ * do not agree with this notice, including the disclaimer below, then ++ * you are not authorized to use the Software. ++ * ++ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" ++ * BASIS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ++ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS ++ * FOR A PARTICULAR PURPOSE ARE HEREBY DISCLAIMED. IN NO EVENT SHALL ++ * SYNOPSYS 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. ++ * ========================================================================= */ ++#ifndef _DWC_DH_H_ ++#define _DWC_DH_H_ ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++#include "dwc_os.h" ++ ++/** @file ++ * ++ * This file defines the common functions on device and host for performing ++ * numeric association as defined in the WUSB spec. They are only to be ++ * used internally by the DWC UWB modules. */ ++ ++extern int dwc_dh_sha256(uint8_t *message, uint32_t len, uint8_t *out); ++extern int dwc_dh_hmac_sha256(uint8_t *message, uint32_t messagelen, ++ uint8_t *key, uint32_t keylen, ++ uint8_t *out); ++extern int dwc_dh_modpow(void *mem_ctx, void *num, uint32_t num_len, ++ void *exp, uint32_t exp_len, ++ void *mod, uint32_t mod_len, ++ void *out); ++ ++/** Computes PKD or PKH, and SHA-256(PKd || Nd) ++ * ++ * PK = g^exp mod p. ++ * ++ * Input: ++ * Nd = Number of digits on the device. ++ * ++ * Output: ++ * exp = A 32-byte buffer to be filled with a randomly generated number. ++ * used as either A or B. ++ * pk = A 384-byte buffer to be filled with the PKH or PKD. ++ * hash = A 32-byte buffer to be filled with SHA-256(PK || ND). ++ */ ++extern int dwc_dh_pk(void *mem_ctx, uint8_t nd, uint8_t *exp, uint8_t *pkd, uint8_t *hash); ++ ++/** Computes the DHKEY, and VD. ++ * ++ * If called from host, then it will comput DHKEY=PKD^exp % p. ++ * If called from device, then it will comput DHKEY=PKH^exp % p. ++ * ++ * Input: ++ * pkd = The PKD value. ++ * pkh = The PKH value. ++ * exp = The A value (if device) or B value (if host) generated in dwc_wudev_dh_pk. ++ * is_host = Set to non zero if a WUSB host is calling this function. ++ * ++ * Output: ++ ++ * dd = A pointer to an buffer to be set to the displayed digits string to be shown ++ * to the user. This buffer should be at 5 bytes long to hold 4 digits plus a ++ * null termination character. This buffer can be used directly for display. ++ * ck = A 16-byte buffer to be filled with the CK. ++ * kdk = A 32-byte buffer to be filled with the KDK. ++ */ ++extern int dwc_dh_derive_keys(void *mem_ctx, uint8_t nd, uint8_t *pkh, uint8_t *pkd, ++ uint8_t *exp, int is_host, ++ char *dd, uint8_t *ck, uint8_t *kdk); ++ ++#ifdef DH_TEST_VECTORS ++extern void dwc_run_dh_test_vectors(void); ++#endif ++ ++#ifdef __cplusplus ++} ++#endif ++ ++#endif /* _DWC_DH_H_ */ +diff --git a/drivers/usb/host/dwc_common_port/dwc_list.h b/drivers/usb/host/dwc_common_port/dwc_list.h +new file mode 100644 +index 0000000..4ce560d +--- /dev/null ++++ b/drivers/usb/host/dwc_common_port/dwc_list.h +@@ -0,0 +1,594 @@ ++/* $OpenBSD: queue.h,v 1.26 2004/05/04 16:59:32 grange Exp $ */ ++/* $NetBSD: queue.h,v 1.11 1996/05/16 05:17:14 mycroft Exp $ */ ++ ++/* ++ * Copyright (c) 1991, 1993 ++ * The Regents of the University of California. 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. ++ * 3. Neither the name of the University nor the names of its contributors ++ * may be used to endorse or promote products derived from this software ++ * without specific prior written permission. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. ++ * ++ * @(#)queue.h 8.5 (Berkeley) 8/20/94 ++ */ ++ ++#ifndef _DWC_LIST_H_ ++#define _DWC_LIST_H_ ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++/** @file ++ * ++ * This file defines linked list operations. It is derived from BSD with ++ * only the MACRO names being prefixed with DWC_. This is because a few of ++ * these names conflict with those on Linux. For documentation on use, see the ++ * inline comments in the source code. The original license for this source ++ * code applies and is preserved in the dwc_list.h source file. ++ */ ++ ++/* ++ * This file defines five types of data structures: singly-linked lists, ++ * lists, simple queues, tail queues, and circular queues. ++ * ++ * ++ * A singly-linked list is headed by a single forward pointer. The elements ++ * are singly linked for minimum space and pointer manipulation overhead at ++ * the expense of O(n) removal for arbitrary elements. New elements can be ++ * added to the list after an existing element or at the head of the list. ++ * Elements being removed from the head of the list should use the explicit ++ * macro for this purpose for optimum efficiency. A singly-linked list may ++ * only be traversed in the forward direction. Singly-linked lists are ideal ++ * for applications with large datasets and few or no removals or for ++ * implementing a LIFO queue. ++ * ++ * A list is headed by a single forward pointer (or an array of forward ++ * pointers for a hash table header). The elements are doubly linked ++ * so that an arbitrary element can be removed without a need to ++ * traverse the list. New elements can be added to the list before ++ * or after an existing element or at the head of the list. A list ++ * may only be traversed in the forward direction. ++ * ++ * A simple queue is headed by a pair of pointers, one the head of the ++ * list and the other to the tail of the list. The elements are singly ++ * linked to save space, so elements can only be removed from the ++ * head of the list. New elements can be added to the list before or after ++ * an existing element, at the head of the list, or at the end of the ++ * list. A simple queue may only be traversed in the forward direction. ++ * ++ * A tail queue is headed by a pair of pointers, one to the head of the ++ * list and the other to the tail of the list. The elements are doubly ++ * linked so that an arbitrary element can be removed without a need to ++ * traverse the list. New elements can be added to the list before or ++ * after an existing element, at the head of the list, or at the end of ++ * the list. A tail queue may be traversed in either direction. ++ * ++ * A circle queue is headed by a pair of pointers, one to the head of the ++ * list and the other to the tail of the list. The elements are doubly ++ * linked so that an arbitrary element can be removed without a need to ++ * traverse the list. New elements can be added to the list before or after ++ * an existing element, at the head of the list, or at the end of the list. ++ * A circle queue may be traversed in either direction, but has a more ++ * complex end of list detection. ++ * ++ * For details on the use of these macros, see the queue(3) manual page. ++ */ ++ ++/* ++ * Double-linked List. ++ */ ++ ++typedef struct dwc_list_link { ++ struct dwc_list_link *next; ++ struct dwc_list_link *prev; ++} dwc_list_link_t; ++ ++#define DWC_LIST_INIT(link) do { \ ++ (link)->next = (link); \ ++ (link)->prev = (link); \ ++} while (0) ++ ++#define DWC_LIST_FIRST(link) ((link)->next) ++#define DWC_LIST_LAST(link) ((link)->prev) ++#define DWC_LIST_END(link) (link) ++#define DWC_LIST_NEXT(link) ((link)->next) ++#define DWC_LIST_PREV(link) ((link)->prev) ++#define DWC_LIST_EMPTY(link) \ ++ (DWC_LIST_FIRST(link) == DWC_LIST_END(link)) ++#define DWC_LIST_ENTRY(link, type, field) \ ++ (type *)((uint8_t *)(link) - (size_t)(&((type *)0)->field)) ++ ++#if 0 ++#define DWC_LIST_INSERT_HEAD(list, link) do { \ ++ (link)->next = (list)->next; \ ++ (link)->prev = (list); \ ++ (list)->next->prev = (link); \ ++ (list)->next = (link); \ ++} while (0) ++ ++#define DWC_LIST_INSERT_TAIL(list, link) do { \ ++ (link)->next = (list); \ ++ (link)->prev = (list)->prev; \ ++ (list)->prev->next = (link); \ ++ (list)->prev = (link); \ ++} while (0) ++#else ++#define DWC_LIST_INSERT_HEAD(list, link) do { \ ++ dwc_list_link_t *__next__ = (list)->next; \ ++ __next__->prev = (link); \ ++ (link)->next = __next__; \ ++ (link)->prev = (list); \ ++ (list)->next = (link); \ ++} while (0) ++ ++#define DWC_LIST_INSERT_TAIL(list, link) do { \ ++ dwc_list_link_t *__prev__ = (list)->prev; \ ++ (list)->prev = (link); \ ++ (link)->next = (list); \ ++ (link)->prev = __prev__; \ ++ __prev__->next = (link); \ ++} while (0) ++#endif ++ ++#if 0 ++static inline void __list_add(struct list_head *new, ++ struct list_head *prev, ++ struct list_head *next) ++{ ++ next->prev = new; ++ new->next = next; ++ new->prev = prev; ++ prev->next = new; ++} ++ ++static inline void list_add(struct list_head *new, struct list_head *head) ++{ ++ __list_add(new, head, head->next); ++} ++ ++static inline void list_add_tail(struct list_head *new, struct list_head *head) ++{ ++ __list_add(new, head->prev, head); ++} ++ ++static inline void __list_del(struct list_head * prev, struct list_head * next) ++{ ++ next->prev = prev; ++ prev->next = next; ++} ++ ++static inline void list_del(struct list_head *entry) ++{ ++ __list_del(entry->prev, entry->next); ++ entry->next = LIST_POISON1; ++ entry->prev = LIST_POISON2; ++} ++#endif ++ ++#define DWC_LIST_REMOVE(link) do { \ ++ (link)->next->prev = (link)->prev; \ ++ (link)->prev->next = (link)->next; \ ++} while (0) ++ ++#define DWC_LIST_REMOVE_INIT(link) do { \ ++ DWC_LIST_REMOVE(link); \ ++ DWC_LIST_INIT(link); \ ++} while (0) ++ ++#define DWC_LIST_MOVE_HEAD(list, link) do { \ ++ DWC_LIST_REMOVE(link); \ ++ DWC_LIST_INSERT_HEAD(list, link); \ ++} while (0) ++ ++#define DWC_LIST_MOVE_TAIL(list, link) do { \ ++ DWC_LIST_REMOVE(link); \ ++ DWC_LIST_INSERT_TAIL(list, link); \ ++} while (0) ++ ++#define DWC_LIST_FOREACH(var, list) \ ++ for((var) = DWC_LIST_FIRST(list); \ ++ (var) != DWC_LIST_END(list); \ ++ (var) = DWC_LIST_NEXT(var)) ++ ++#define DWC_LIST_FOREACH_SAFE(var, var2, list) \ ++ for((var) = DWC_LIST_FIRST(list), (var2) = DWC_LIST_NEXT(var); \ ++ (var) != DWC_LIST_END(list); \ ++ (var) = (var2), (var2) = DWC_LIST_NEXT(var2)) ++ ++#define DWC_LIST_FOREACH_REVERSE(var, list) \ ++ for((var) = DWC_LIST_LAST(list); \ ++ (var) != DWC_LIST_END(list); \ ++ (var) = DWC_LIST_PREV(var)) ++ ++/* ++ * Singly-linked List definitions. ++ */ ++#define DWC_SLIST_HEAD(name, type) \ ++struct name { \ ++ struct type *slh_first; /* first element */ \ ++} ++ ++#define DWC_SLIST_HEAD_INITIALIZER(head) \ ++ { NULL } ++ ++#define DWC_SLIST_ENTRY(type) \ ++struct { \ ++ struct type *sle_next; /* next element */ \ ++} ++ ++/* ++ * Singly-linked List access methods. ++ */ ++#define DWC_SLIST_FIRST(head) ((head)->slh_first) ++#define DWC_SLIST_END(head) NULL ++#define DWC_SLIST_EMPTY(head) (SLIST_FIRST(head) == SLIST_END(head)) ++#define DWC_SLIST_NEXT(elm, field) ((elm)->field.sle_next) ++ ++#define DWC_SLIST_FOREACH(var, head, field) \ ++ for((var) = SLIST_FIRST(head); \ ++ (var) != SLIST_END(head); \ ++ (var) = SLIST_NEXT(var, field)) ++ ++#define DWC_SLIST_FOREACH_PREVPTR(var, varp, head, field) \ ++ for((varp) = &SLIST_FIRST((head)); \ ++ ((var) = *(varp)) != SLIST_END(head); \ ++ (varp) = &SLIST_NEXT((var), field)) ++ ++/* ++ * Singly-linked List functions. ++ */ ++#define DWC_SLIST_INIT(head) { \ ++ SLIST_FIRST(head) = SLIST_END(head); \ ++} ++ ++#define DWC_SLIST_INSERT_AFTER(slistelm, elm, field) do { \ ++ (elm)->field.sle_next = (slistelm)->field.sle_next; \ ++ (slistelm)->field.sle_next = (elm); \ ++} while (0) ++ ++#define DWC_SLIST_INSERT_HEAD(head, elm, field) do { \ ++ (elm)->field.sle_next = (head)->slh_first; \ ++ (head)->slh_first = (elm); \ ++} while (0) ++ ++#define DWC_SLIST_REMOVE_NEXT(head, elm, field) do { \ ++ (elm)->field.sle_next = (elm)->field.sle_next->field.sle_next; \ ++} while (0) ++ ++#define DWC_SLIST_REMOVE_HEAD(head, field) do { \ ++ (head)->slh_first = (head)->slh_first->field.sle_next; \ ++} while (0) ++ ++#define DWC_SLIST_REMOVE(head, elm, type, field) do { \ ++ if ((head)->slh_first == (elm)) { \ ++ SLIST_REMOVE_HEAD((head), field); \ ++ } \ ++ else { \ ++ struct type *curelm = (head)->slh_first; \ ++ while( curelm->field.sle_next != (elm) ) \ ++ curelm = curelm->field.sle_next; \ ++ curelm->field.sle_next = \ ++ curelm->field.sle_next->field.sle_next; \ ++ } \ ++} while (0) ++ ++/* ++ * Simple queue definitions. ++ */ ++#define DWC_SIMPLEQ_HEAD(name, type) \ ++struct name { \ ++ struct type *sqh_first; /* first element */ \ ++ struct type **sqh_last; /* addr of last next element */ \ ++} ++ ++#define DWC_SIMPLEQ_HEAD_INITIALIZER(head) \ ++ { NULL, &(head).sqh_first } ++ ++#define DWC_SIMPLEQ_ENTRY(type) \ ++struct { \ ++ struct type *sqe_next; /* next element */ \ ++} ++ ++/* ++ * Simple queue access methods. ++ */ ++#define DWC_SIMPLEQ_FIRST(head) ((head)->sqh_first) ++#define DWC_SIMPLEQ_END(head) NULL ++#define DWC_SIMPLEQ_EMPTY(head) (SIMPLEQ_FIRST(head) == SIMPLEQ_END(head)) ++#define DWC_SIMPLEQ_NEXT(elm, field) ((elm)->field.sqe_next) ++ ++#define DWC_SIMPLEQ_FOREACH(var, head, field) \ ++ for((var) = SIMPLEQ_FIRST(head); \ ++ (var) != SIMPLEQ_END(head); \ ++ (var) = SIMPLEQ_NEXT(var, field)) ++ ++/* ++ * Simple queue functions. ++ */ ++#define DWC_SIMPLEQ_INIT(head) do { \ ++ (head)->sqh_first = NULL; \ ++ (head)->sqh_last = &(head)->sqh_first; \ ++} while (0) ++ ++#define DWC_SIMPLEQ_INSERT_HEAD(head, elm, field) do { \ ++ if (((elm)->field.sqe_next = (head)->sqh_first) == NULL) \ ++ (head)->sqh_last = &(elm)->field.sqe_next; \ ++ (head)->sqh_first = (elm); \ ++} while (0) ++ ++#define DWC_SIMPLEQ_INSERT_TAIL(head, elm, field) do { \ ++ (elm)->field.sqe_next = NULL; \ ++ *(head)->sqh_last = (elm); \ ++ (head)->sqh_last = &(elm)->field.sqe_next; \ ++} while (0) ++ ++#define DWC_SIMPLEQ_INSERT_AFTER(head, listelm, elm, field) do { \ ++ if (((elm)->field.sqe_next = (listelm)->field.sqe_next) == NULL)\ ++ (head)->sqh_last = &(elm)->field.sqe_next; \ ++ (listelm)->field.sqe_next = (elm); \ ++} while (0) ++ ++#define DWC_SIMPLEQ_REMOVE_HEAD(head, field) do { \ ++ if (((head)->sqh_first = (head)->sqh_first->field.sqe_next) == NULL) \ ++ (head)->sqh_last = &(head)->sqh_first; \ ++} while (0) ++ ++/* ++ * Tail queue definitions. ++ */ ++#define DWC_TAILQ_HEAD(name, type) \ ++struct name { \ ++ struct type *tqh_first; /* first element */ \ ++ struct type **tqh_last; /* addr of last next element */ \ ++} ++ ++#define DWC_TAILQ_HEAD_INITIALIZER(head) \ ++ { NULL, &(head).tqh_first } ++ ++#define DWC_TAILQ_ENTRY(type) \ ++struct { \ ++ struct type *tqe_next; /* next element */ \ ++ struct type **tqe_prev; /* address of previous next element */ \ ++} ++ ++/* ++ * tail queue access methods ++ */ ++#define DWC_TAILQ_FIRST(head) ((head)->tqh_first) ++#define DWC_TAILQ_END(head) NULL ++#define DWC_TAILQ_NEXT(elm, field) ((elm)->field.tqe_next) ++#define DWC_TAILQ_LAST(head, headname) \ ++ (*(((struct headname *)((head)->tqh_last))->tqh_last)) ++/* XXX */ ++#define DWC_TAILQ_PREV(elm, headname, field) \ ++ (*(((struct headname *)((elm)->field.tqe_prev))->tqh_last)) ++#define DWC_TAILQ_EMPTY(head) \ ++ (DWC_TAILQ_FIRST(head) == DWC_TAILQ_END(head)) ++ ++#define DWC_TAILQ_FOREACH(var, head, field) \ ++ for ((var) = DWC_TAILQ_FIRST(head); \ ++ (var) != DWC_TAILQ_END(head); \ ++ (var) = DWC_TAILQ_NEXT(var, field)) ++ ++#define DWC_TAILQ_FOREACH_REVERSE(var, head, headname, field) \ ++ for ((var) = DWC_TAILQ_LAST(head, headname); \ ++ (var) != DWC_TAILQ_END(head); \ ++ (var) = DWC_TAILQ_PREV(var, headname, field)) ++ ++/* ++ * Tail queue functions. ++ */ ++#define DWC_TAILQ_INIT(head) do { \ ++ (head)->tqh_first = NULL; \ ++ (head)->tqh_last = &(head)->tqh_first; \ ++} while (0) ++ ++#define DWC_TAILQ_INSERT_HEAD(head, elm, field) do { \ ++ if (((elm)->field.tqe_next = (head)->tqh_first) != NULL) \ ++ (head)->tqh_first->field.tqe_prev = \ ++ &(elm)->field.tqe_next; \ ++ else \ ++ (head)->tqh_last = &(elm)->field.tqe_next; \ ++ (head)->tqh_first = (elm); \ ++ (elm)->field.tqe_prev = &(head)->tqh_first; \ ++} while (0) ++ ++#define DWC_TAILQ_INSERT_TAIL(head, elm, field) do { \ ++ (elm)->field.tqe_next = NULL; \ ++ (elm)->field.tqe_prev = (head)->tqh_last; \ ++ *(head)->tqh_last = (elm); \ ++ (head)->tqh_last = &(elm)->field.tqe_next; \ ++} while (0) ++ ++#define DWC_TAILQ_INSERT_AFTER(head, listelm, elm, field) do { \ ++ if (((elm)->field.tqe_next = (listelm)->field.tqe_next) != NULL)\ ++ (elm)->field.tqe_next->field.tqe_prev = \ ++ &(elm)->field.tqe_next; \ ++ else \ ++ (head)->tqh_last = &(elm)->field.tqe_next; \ ++ (listelm)->field.tqe_next = (elm); \ ++ (elm)->field.tqe_prev = &(listelm)->field.tqe_next; \ ++} while (0) ++ ++#define DWC_TAILQ_INSERT_BEFORE(listelm, elm, field) do { \ ++ (elm)->field.tqe_prev = (listelm)->field.tqe_prev; \ ++ (elm)->field.tqe_next = (listelm); \ ++ *(listelm)->field.tqe_prev = (elm); \ ++ (listelm)->field.tqe_prev = &(elm)->field.tqe_next; \ ++} while (0) ++ ++#define DWC_TAILQ_REMOVE(head, elm, field) do { \ ++ if (((elm)->field.tqe_next) != NULL) \ ++ (elm)->field.tqe_next->field.tqe_prev = \ ++ (elm)->field.tqe_prev; \ ++ else \ ++ (head)->tqh_last = (elm)->field.tqe_prev; \ ++ *(elm)->field.tqe_prev = (elm)->field.tqe_next; \ ++} while (0) ++ ++#define DWC_TAILQ_REPLACE(head, elm, elm2, field) do { \ ++ if (((elm2)->field.tqe_next = (elm)->field.tqe_next) != NULL) \ ++ (elm2)->field.tqe_next->field.tqe_prev = \ ++ &(elm2)->field.tqe_next; \ ++ else \ ++ (head)->tqh_last = &(elm2)->field.tqe_next; \ ++ (elm2)->field.tqe_prev = (elm)->field.tqe_prev; \ ++ *(elm2)->field.tqe_prev = (elm2); \ ++} while (0) ++ ++/* ++ * Circular queue definitions. ++ */ ++#define DWC_CIRCLEQ_HEAD(name, type) \ ++struct name { \ ++ struct type *cqh_first; /* first element */ \ ++ struct type *cqh_last; /* last element */ \ ++} ++ ++#define DWC_CIRCLEQ_HEAD_INITIALIZER(head) \ ++ { DWC_CIRCLEQ_END(&head), DWC_CIRCLEQ_END(&head) } ++ ++#define DWC_CIRCLEQ_ENTRY(type) \ ++struct { \ ++ struct type *cqe_next; /* next element */ \ ++ struct type *cqe_prev; /* previous element */ \ ++} ++ ++/* ++ * Circular queue access methods ++ */ ++#define DWC_CIRCLEQ_FIRST(head) ((head)->cqh_first) ++#define DWC_CIRCLEQ_LAST(head) ((head)->cqh_last) ++#define DWC_CIRCLEQ_END(head) ((void *)(head)) ++#define DWC_CIRCLEQ_NEXT(elm, field) ((elm)->field.cqe_next) ++#define DWC_CIRCLEQ_PREV(elm, field) ((elm)->field.cqe_prev) ++#define DWC_CIRCLEQ_EMPTY(head) \ ++ (DWC_CIRCLEQ_FIRST(head) == DWC_CIRCLEQ_END(head)) ++ ++#define DWC_CIRCLEQ_EMPTY_ENTRY(elm, field) (((elm)->field.cqe_next == NULL) && ((elm)->field.cqe_prev == NULL)) ++ ++#define DWC_CIRCLEQ_FOREACH(var, head, field) \ ++ for((var) = DWC_CIRCLEQ_FIRST(head); \ ++ (var) != DWC_CIRCLEQ_END(head); \ ++ (var) = DWC_CIRCLEQ_NEXT(var, field)) ++ ++#define DWC_CIRCLEQ_FOREACH_SAFE(var, var2, head, field) \ ++ for((var) = DWC_CIRCLEQ_FIRST(head), var2 = DWC_CIRCLEQ_NEXT(var, field); \ ++ (var) != DWC_CIRCLEQ_END(head); \ ++ (var) = var2, var2 = DWC_CIRCLEQ_NEXT(var, field)) ++ ++#define DWC_CIRCLEQ_FOREACH_REVERSE(var, head, field) \ ++ for((var) = DWC_CIRCLEQ_LAST(head); \ ++ (var) != DWC_CIRCLEQ_END(head); \ ++ (var) = DWC_CIRCLEQ_PREV(var, field)) ++ ++/* ++ * Circular queue functions. ++ */ ++#define DWC_CIRCLEQ_INIT(head) do { \ ++ (head)->cqh_first = DWC_CIRCLEQ_END(head); \ ++ (head)->cqh_last = DWC_CIRCLEQ_END(head); \ ++} while (0) ++ ++#define DWC_CIRCLEQ_INIT_ENTRY(elm, field) do { \ ++ (elm)->field.cqe_next = NULL; \ ++ (elm)->field.cqe_prev = NULL; \ ++} while (0) ++ ++#define DWC_CIRCLEQ_INSERT_AFTER(head, listelm, elm, field) do { \ ++ (elm)->field.cqe_next = (listelm)->field.cqe_next; \ ++ (elm)->field.cqe_prev = (listelm); \ ++ if ((listelm)->field.cqe_next == DWC_CIRCLEQ_END(head)) \ ++ (head)->cqh_last = (elm); \ ++ else \ ++ (listelm)->field.cqe_next->field.cqe_prev = (elm); \ ++ (listelm)->field.cqe_next = (elm); \ ++} while (0) ++ ++#define DWC_CIRCLEQ_INSERT_BEFORE(head, listelm, elm, field) do { \ ++ (elm)->field.cqe_next = (listelm); \ ++ (elm)->field.cqe_prev = (listelm)->field.cqe_prev; \ ++ if ((listelm)->field.cqe_prev == DWC_CIRCLEQ_END(head)) \ ++ (head)->cqh_first = (elm); \ ++ else \ ++ (listelm)->field.cqe_prev->field.cqe_next = (elm); \ ++ (listelm)->field.cqe_prev = (elm); \ ++} while (0) ++ ++#define DWC_CIRCLEQ_INSERT_HEAD(head, elm, field) do { \ ++ (elm)->field.cqe_next = (head)->cqh_first; \ ++ (elm)->field.cqe_prev = DWC_CIRCLEQ_END(head); \ ++ if ((head)->cqh_last == DWC_CIRCLEQ_END(head)) \ ++ (head)->cqh_last = (elm); \ ++ else \ ++ (head)->cqh_first->field.cqe_prev = (elm); \ ++ (head)->cqh_first = (elm); \ ++} while (0) ++ ++#define DWC_CIRCLEQ_INSERT_TAIL(head, elm, field) do { \ ++ (elm)->field.cqe_next = DWC_CIRCLEQ_END(head); \ ++ (elm)->field.cqe_prev = (head)->cqh_last; \ ++ if ((head)->cqh_first == DWC_CIRCLEQ_END(head)) \ ++ (head)->cqh_first = (elm); \ ++ else \ ++ (head)->cqh_last->field.cqe_next = (elm); \ ++ (head)->cqh_last = (elm); \ ++} while (0) ++ ++#define DWC_CIRCLEQ_REMOVE(head, elm, field) do { \ ++ if ((elm)->field.cqe_next == DWC_CIRCLEQ_END(head)) \ ++ (head)->cqh_last = (elm)->field.cqe_prev; \ ++ else \ ++ (elm)->field.cqe_next->field.cqe_prev = \ ++ (elm)->field.cqe_prev; \ ++ if ((elm)->field.cqe_prev == DWC_CIRCLEQ_END(head)) \ ++ (head)->cqh_first = (elm)->field.cqe_next; \ ++ else \ ++ (elm)->field.cqe_prev->field.cqe_next = \ ++ (elm)->field.cqe_next; \ ++} while (0) ++ ++#define DWC_CIRCLEQ_REMOVE_INIT(head, elm, field) do { \ ++ DWC_CIRCLEQ_REMOVE(head, elm, field); \ ++ DWC_CIRCLEQ_INIT_ENTRY(elm, field); \ ++} while (0) ++ ++#define DWC_CIRCLEQ_REPLACE(head, elm, elm2, field) do { \ ++ if (((elm2)->field.cqe_next = (elm)->field.cqe_next) == \ ++ DWC_CIRCLEQ_END(head)) \ ++ (head).cqh_last = (elm2); \ ++ else \ ++ (elm2)->field.cqe_next->field.cqe_prev = (elm2); \ ++ if (((elm2)->field.cqe_prev = (elm)->field.cqe_prev) == \ ++ DWC_CIRCLEQ_END(head)) \ ++ (head).cqh_first = (elm2); \ ++ else \ ++ (elm2)->field.cqe_prev->field.cqe_next = (elm2); \ ++} while (0) ++ ++#ifdef __cplusplus ++} ++#endif ++ ++#endif /* _DWC_LIST_H_ */ +diff --git a/drivers/usb/host/dwc_common_port/dwc_mem.c b/drivers/usb/host/dwc_common_port/dwc_mem.c +new file mode 100644 +index 0000000..ad645ff +--- /dev/null ++++ b/drivers/usb/host/dwc_common_port/dwc_mem.c +@@ -0,0 +1,245 @@ ++/* Memory Debugging */ ++#ifdef DWC_DEBUG_MEMORY ++ ++#include "dwc_os.h" ++#include "dwc_list.h" ++ ++struct allocation { ++ void *addr; ++ void *ctx; ++ char *func; ++ int line; ++ uint32_t size; ++ int dma; ++ DWC_CIRCLEQ_ENTRY(allocation) entry; ++}; ++ ++DWC_CIRCLEQ_HEAD(allocation_queue, allocation); ++ ++struct allocation_manager { ++ void *mem_ctx; ++ struct allocation_queue allocations; ++ ++ /* statistics */ ++ int num; ++ int num_freed; ++ int num_active; ++ uint32_t total; ++ uint32_t cur; ++ uint32_t max; ++}; ++ ++static struct allocation_manager *manager = NULL; ++ ++static int add_allocation(void *ctx, uint32_t size, char const *func, int line, void *addr, ++ int dma) ++{ ++ struct allocation *a; ++ ++ DWC_ASSERT(manager != NULL, "manager not allocated"); ++ ++ a = __DWC_ALLOC_ATOMIC(manager->mem_ctx, sizeof(*a)); ++ if (!a) { ++ return -DWC_E_NO_MEMORY; ++ } ++ ++ a->func = __DWC_ALLOC_ATOMIC(manager->mem_ctx, DWC_STRLEN(func) + 1); ++ if (!a->func) { ++ __DWC_FREE(manager->mem_ctx, a); ++ return -DWC_E_NO_MEMORY; ++ } ++ ++ DWC_MEMCPY(a->func, func, DWC_STRLEN(func) + 1); ++ a->addr = addr; ++ a->ctx = ctx; ++ a->line = line; ++ a->size = size; ++ a->dma = dma; ++ DWC_CIRCLEQ_INSERT_TAIL(&manager->allocations, a, entry); ++ ++ /* Update stats */ ++ manager->num++; ++ manager->num_active++; ++ manager->total += size; ++ manager->cur += size; ++ ++ if (manager->max < manager->cur) { ++ manager->max = manager->cur; ++ } ++ ++ return 0; ++} ++ ++static struct allocation *find_allocation(void *ctx, void *addr) ++{ ++ struct allocation *a; ++ ++ DWC_CIRCLEQ_FOREACH(a, &manager->allocations, entry) { ++ if (a->ctx == ctx && a->addr == addr) { ++ return a; ++ } ++ } ++ ++ return NULL; ++} ++ ++static void free_allocation(void *ctx, void *addr, char const *func, int line) ++{ ++ struct allocation *a = find_allocation(ctx, addr); ++ ++ if (!a) { ++ DWC_ASSERT(0, ++ "Free of address %p that was never allocated or already freed %s:%d", ++ addr, func, line); ++ return; ++ } ++ ++ DWC_CIRCLEQ_REMOVE(&manager->allocations, a, entry); ++ ++ manager->num_active--; ++ manager->num_freed++; ++ manager->cur -= a->size; ++ __DWC_FREE(manager->mem_ctx, a->func); ++ __DWC_FREE(manager->mem_ctx, a); ++} ++ ++int dwc_memory_debug_start(void *mem_ctx) ++{ ++ DWC_ASSERT(manager == NULL, "Memory debugging has already started\n"); ++ ++ if (manager) { ++ return -DWC_E_BUSY; ++ } ++ ++ manager = __DWC_ALLOC(mem_ctx, sizeof(*manager)); ++ if (!manager) { ++ return -DWC_E_NO_MEMORY; ++ } ++ ++ DWC_CIRCLEQ_INIT(&manager->allocations); ++ manager->mem_ctx = mem_ctx; ++ manager->num = 0; ++ manager->num_freed = 0; ++ manager->num_active = 0; ++ manager->total = 0; ++ manager->cur = 0; ++ manager->max = 0; ++ ++ return 0; ++} ++ ++void dwc_memory_debug_stop(void) ++{ ++ struct allocation *a; ++ ++ dwc_memory_debug_report(); ++ ++ DWC_CIRCLEQ_FOREACH(a, &manager->allocations, entry) { ++ DWC_ERROR("Memory leaked from %s:%d\n", a->func, a->line); ++ free_allocation(a->ctx, a->addr, NULL, -1); ++ } ++ ++ __DWC_FREE(manager->mem_ctx, manager); ++} ++ ++void dwc_memory_debug_report(void) ++{ ++ struct allocation *a; ++ ++ DWC_PRINTF("\n\n\n----------------- Memory Debugging Report -----------------\n\n"); ++ DWC_PRINTF("Num Allocations = %d\n", manager->num); ++ DWC_PRINTF("Freed = %d\n", manager->num_freed); ++ DWC_PRINTF("Active = %d\n", manager->num_active); ++ DWC_PRINTF("Current Memory Used = %d\n", manager->cur); ++ DWC_PRINTF("Total Memory Used = %d\n", manager->total); ++ DWC_PRINTF("Maximum Memory Used at Once = %d\n", manager->max); ++ DWC_PRINTF("Unfreed allocations:\n"); ++ ++ DWC_CIRCLEQ_FOREACH(a, &manager->allocations, entry) { ++ DWC_PRINTF(" addr=%p, size=%d from %s:%d, DMA=%d\n", ++ a->addr, a->size, a->func, a->line, a->dma); ++ } ++} ++ ++/* The replacement functions */ ++void *dwc_alloc_debug(void *mem_ctx, uint32_t size, char const *func, int line) ++{ ++ void *addr = __DWC_ALLOC(mem_ctx, size); ++ ++ if (!addr) { ++ return NULL; ++ } ++ ++ if (add_allocation(mem_ctx, size, func, line, addr, 0)) { ++ __DWC_FREE(mem_ctx, addr); ++ return NULL; ++ } ++ ++ return addr; ++} ++ ++void *dwc_alloc_atomic_debug(void *mem_ctx, uint32_t size, char const *func, ++ int line) ++{ ++ void *addr = __DWC_ALLOC_ATOMIC(mem_ctx, size); ++ ++ if (!addr) { ++ return NULL; ++ } ++ ++ if (add_allocation(mem_ctx, size, func, line, addr, 0)) { ++ __DWC_FREE(mem_ctx, addr); ++ return NULL; ++ } ++ ++ return addr; ++} ++ ++void dwc_free_debug(void *mem_ctx, void *addr, char const *func, int line) ++{ ++ free_allocation(mem_ctx, addr, func, line); ++ __DWC_FREE(mem_ctx, addr); ++} ++ ++void *dwc_dma_alloc_debug(void *dma_ctx, uint32_t size, dwc_dma_t *dma_addr, ++ char const *func, int line) ++{ ++ void *addr = __DWC_DMA_ALLOC(dma_ctx, size, dma_addr); ++ ++ if (!addr) { ++ return NULL; ++ } ++ ++ if (add_allocation(dma_ctx, size, func, line, addr, 1)) { ++ __DWC_DMA_FREE(dma_ctx, size, addr, *dma_addr); ++ return NULL; ++ } ++ ++ return addr; ++} ++ ++void *dwc_dma_alloc_atomic_debug(void *dma_ctx, uint32_t size, ++ dwc_dma_t *dma_addr, char const *func, int line) ++{ ++ void *addr = __DWC_DMA_ALLOC_ATOMIC(dma_ctx, size, dma_addr); ++ ++ if (!addr) { ++ return NULL; ++ } ++ ++ if (add_allocation(dma_ctx, size, func, line, addr, 1)) { ++ __DWC_DMA_FREE(dma_ctx, size, addr, *dma_addr); ++ return NULL; ++ } ++ ++ return addr; ++} ++ ++void dwc_dma_free_debug(void *dma_ctx, uint32_t size, void *virt_addr, ++ dwc_dma_t dma_addr, char const *func, int line) ++{ ++ free_allocation(dma_ctx, virt_addr, func, line); ++ __DWC_DMA_FREE(dma_ctx, size, virt_addr, dma_addr); ++} ++ ++#endif /* DWC_DEBUG_MEMORY */ +diff --git a/drivers/usb/host/dwc_common_port/dwc_modpow.c b/drivers/usb/host/dwc_common_port/dwc_modpow.c +new file mode 100644 +index 0000000..2004538 +--- /dev/null ++++ b/drivers/usb/host/dwc_common_port/dwc_modpow.c +@@ -0,0 +1,636 @@ ++/* Bignum routines adapted from PUTTY sources. PuTTY copyright notice follows. ++ * ++ * PuTTY is copyright 1997-2007 Simon Tatham. ++ * ++ * Portions copyright Robert de Bath, Joris van Rantwijk, Delian ++ * Delchev, Andreas Schultz, Jeroen Massar, Wez Furlong, Nicolas Barry, ++ * Justin Bradford, Ben Harris, Malcolm Smith, Ahmad Khalifa, Markus ++ * Kuhn, and CORE SDI S.A. ++ * ++ * Permission is hereby granted, free of charge, to any person ++ * obtaining a copy of this software and associated documentation files ++ * (the "Software"), to deal in the Software without restriction, ++ * including without limitation the rights to use, copy, modify, merge, ++ * publish, distribute, sublicense, and/or sell copies of the Software, ++ * and to permit persons to whom the Software is furnished to do so, ++ * subject to the following conditions: ++ * ++ * The above copyright notice and this permission notice shall be ++ * included in all copies or substantial portions of the Software. ++ ++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ++ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF ++ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND ++ * NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE ++ * FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF ++ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION ++ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ++ * ++ */ ++#ifdef DWC_CRYPTOLIB ++ ++#ifndef CONFIG_MACH_IPMATE ++ ++#include "dwc_modpow.h" ++ ++#define BIGNUM_INT_MASK 0xFFFFFFFFUL ++#define BIGNUM_TOP_BIT 0x80000000UL ++#define BIGNUM_INT_BITS 32 ++ ++ ++static void *snmalloc(void *mem_ctx, size_t n, size_t size) ++{ ++ void *p; ++ size *= n; ++ if (size == 0) size = 1; ++ p = dwc_alloc(mem_ctx, size); ++ return p; ++} ++ ++#define snewn(ctx, n, type) ((type *)snmalloc((ctx), (n), sizeof(type))) ++#define sfree dwc_free ++ ++/* ++ * Usage notes: ++ * * Do not call the DIVMOD_WORD macro with expressions such as array ++ * subscripts, as some implementations object to this (see below). ++ * * Note that none of the division methods below will cope if the ++ * quotient won't fit into BIGNUM_INT_BITS. Callers should be careful ++ * to avoid this case. ++ * If this condition occurs, in the case of the x86 DIV instruction, ++ * an overflow exception will occur, which (according to a correspondent) ++ * will manifest on Windows as something like ++ * 0xC0000095: Integer overflow ++ * The C variant won't give the right answer, either. ++ */ ++ ++#define MUL_WORD(w1, w2) ((BignumDblInt)w1 * w2) ++ ++#if defined __GNUC__ && defined __i386__ ++#define DIVMOD_WORD(q, r, hi, lo, w) \ ++ __asm__("div %2" : \ ++ "=d" (r), "=a" (q) : \ ++ "r" (w), "d" (hi), "a" (lo)) ++#else ++#define DIVMOD_WORD(q, r, hi, lo, w) do { \ ++ BignumDblInt n = (((BignumDblInt)hi) << BIGNUM_INT_BITS) | lo; \ ++ q = n / w; \ ++ r = n % w; \ ++} while (0) ++#endif ++ ++// q = n / w; ++// r = n % w; ++ ++#define BIGNUM_INT_BYTES (BIGNUM_INT_BITS / 8) ++ ++#define BIGNUM_INTERNAL ++ ++static Bignum newbn(void *mem_ctx, int length) ++{ ++ Bignum b = snewn(mem_ctx, length + 1, BignumInt); ++ //if (!b) ++ //abort(); /* FIXME */ ++ DWC_MEMSET(b, 0, (length + 1) * sizeof(*b)); ++ b[0] = length; ++ return b; ++} ++ ++void freebn(void *mem_ctx, Bignum b) ++{ ++ /* ++ * Burn the evidence, just in case. ++ */ ++ DWC_MEMSET(b, 0, sizeof(b[0]) * (b[0] + 1)); ++ sfree(mem_ctx, b); ++} ++ ++/* ++ * Compute c = a * b. ++ * Input is in the first len words of a and b. ++ * Result is returned in the first 2*len words of c. ++ */ ++static void internal_mul(BignumInt *a, BignumInt *b, ++ BignumInt *c, int len) ++{ ++ int i, j; ++ BignumDblInt t; ++ ++ for (j = 0; j < 2 * len; j++) ++ c[j] = 0; ++ ++ for (i = len - 1; i >= 0; i--) { ++ t = 0; ++ for (j = len - 1; j >= 0; j--) { ++ t += MUL_WORD(a[i], (BignumDblInt) b[j]); ++ t += (BignumDblInt) c[i + j + 1]; ++ c[i + j + 1] = (BignumInt) t; ++ t = t >> BIGNUM_INT_BITS; ++ } ++ c[i] = (BignumInt) t; ++ } ++} ++ ++static void internal_add_shifted(BignumInt *number, ++ unsigned n, int shift) ++{ ++ int word = 1 + (shift / BIGNUM_INT_BITS); ++ int bshift = shift % BIGNUM_INT_BITS; ++ BignumDblInt addend; ++ ++ addend = (BignumDblInt)n << bshift; ++ ++ while (addend) { ++ addend += number[word]; ++ number[word] = (BignumInt) addend & BIGNUM_INT_MASK; ++ addend >>= BIGNUM_INT_BITS; ++ word++; ++ } ++} ++ ++/* ++ * Compute a = a % m. ++ * Input in first alen words of a and first mlen words of m. ++ * Output in first alen words of a ++ * (of which first alen-mlen words will be zero). ++ * The MSW of m MUST have its high bit set. ++ * Quotient is accumulated in the `quotient' array, which is a Bignum ++ * rather than the internal bigendian format. Quotient parts are shifted ++ * left by `qshift' before adding into quot. ++ */ ++static void internal_mod(BignumInt *a, int alen, ++ BignumInt *m, int mlen, ++ BignumInt *quot, int qshift) ++{ ++ BignumInt m0, m1; ++ unsigned int h; ++ int i, k; ++ ++ m0 = m[0]; ++ if (mlen > 1) ++ m1 = m[1]; ++ else ++ m1 = 0; ++ ++ for (i = 0; i <= alen - mlen; i++) { ++ BignumDblInt t; ++ unsigned int q, r, c, ai1; ++ ++ if (i == 0) { ++ h = 0; ++ } else { ++ h = a[i - 1]; ++ a[i - 1] = 0; ++ } ++ ++ if (i == alen - 1) ++ ai1 = 0; ++ else ++ ai1 = a[i + 1]; ++ ++ /* Find q = h:a[i] / m0 */ ++ if (h >= m0) { ++ /* ++ * Special case. ++ * ++ * To illustrate it, suppose a BignumInt is 8 bits, and ++ * we are dividing (say) A1:23:45:67 by A1:B2:C3. Then ++ * our initial division will be 0xA123 / 0xA1, which ++ * will give a quotient of 0x100 and a divide overflow. ++ * However, the invariants in this division algorithm ++ * are not violated, since the full number A1:23:... is ++ * _less_ than the quotient prefix A1:B2:... and so the ++ * following correction loop would have sorted it out. ++ * ++ * In this situation we set q to be the largest ++ * quotient we _can_ stomach (0xFF, of course). ++ */ ++ q = BIGNUM_INT_MASK; ++ } else { ++ /* Macro doesn't want an array subscript expression passed ++ * into it (see definition), so use a temporary. */ ++ BignumInt tmplo = a[i]; ++ DIVMOD_WORD(q, r, h, tmplo, m0); ++ ++ /* Refine our estimate of q by looking at ++ h:a[i]:a[i+1] / m0:m1 */ ++ t = MUL_WORD(m1, q); ++ if (t > ((BignumDblInt) r << BIGNUM_INT_BITS) + ai1) { ++ q--; ++ t -= m1; ++ r = (r + m0) & BIGNUM_INT_MASK; /* overflow? */ ++ if (r >= (BignumDblInt) m0 && ++ t > ((BignumDblInt) r << BIGNUM_INT_BITS) + ai1) q--; ++ } ++ } ++ ++ /* Subtract q * m from a[i...] */ ++ c = 0; ++ for (k = mlen - 1; k >= 0; k--) { ++ t = MUL_WORD(q, m[k]); ++ t += c; ++ c = (unsigned)(t >> BIGNUM_INT_BITS); ++ if ((BignumInt) t > a[i + k]) ++ c++; ++ a[i + k] -= (BignumInt) t; ++ } ++ ++ /* Add back m in case of borrow */ ++ if (c != h) { ++ t = 0; ++ for (k = mlen - 1; k >= 0; k--) { ++ t += m[k]; ++ t += a[i + k]; ++ a[i + k] = (BignumInt) t; ++ t = t >> BIGNUM_INT_BITS; ++ } ++ q--; ++ } ++ if (quot) ++ internal_add_shifted(quot, q, qshift + BIGNUM_INT_BITS * (alen - mlen - i)); ++ } ++} ++ ++/* ++ * Compute p % mod. ++ * The most significant word of mod MUST be non-zero. ++ * We assume that the result array is the same size as the mod array. ++ * We optionally write out a quotient if `quotient' is non-NULL. ++ * We can avoid writing out the result if `result' is NULL. ++ */ ++void bigdivmod(void *mem_ctx, Bignum p, Bignum mod, Bignum result, Bignum quotient) ++{ ++ BignumInt *n, *m; ++ int mshift; ++ int plen, mlen, i, j; ++ ++ /* Allocate m of size mlen, copy mod to m */ ++ /* We use big endian internally */ ++ mlen = mod[0]; ++ m = snewn(mem_ctx, mlen, BignumInt); ++ //if (!m) ++ //abort(); /* FIXME */ ++ for (j = 0; j < mlen; j++) ++ m[j] = mod[mod[0] - j]; ++ ++ /* Shift m left to make msb bit set */ ++ for (mshift = 0; mshift < BIGNUM_INT_BITS-1; mshift++) ++ if ((m[0] << mshift) & BIGNUM_TOP_BIT) ++ break; ++ if (mshift) { ++ for (i = 0; i < mlen - 1; i++) ++ m[i] = (m[i] << mshift) | (m[i + 1] >> (BIGNUM_INT_BITS - mshift)); ++ m[mlen - 1] = m[mlen - 1] << mshift; ++ } ++ ++ plen = p[0]; ++ /* Ensure plen > mlen */ ++ if (plen <= mlen) ++ plen = mlen + 1; ++ ++ /* Allocate n of size plen, copy p to n */ ++ n = snewn(mem_ctx, plen, BignumInt); ++ //if (!n) ++ //abort(); /* FIXME */ ++ for (j = 0; j < plen; j++) ++ n[j] = 0; ++ for (j = 1; j <= (int)p[0]; j++) ++ n[plen - j] = p[j]; ++ ++ /* Main computation */ ++ internal_mod(n, plen, m, mlen, quotient, mshift); ++ ++ /* Fixup result in case the modulus was shifted */ ++ if (mshift) { ++ for (i = plen - mlen - 1; i < plen - 1; i++) ++ n[i] = (n[i] << mshift) | (n[i + 1] >> (BIGNUM_INT_BITS - mshift)); ++ n[plen - 1] = n[plen - 1] << mshift; ++ internal_mod(n, plen, m, mlen, quotient, 0); ++ for (i = plen - 1; i >= plen - mlen; i--) ++ n[i] = (n[i] >> mshift) | (n[i - 1] << (BIGNUM_INT_BITS - mshift)); ++ } ++ ++ /* Copy result to buffer */ ++ if (result) { ++ for (i = 1; i <= (int)result[0]; i++) { ++ int j = plen - i; ++ result[i] = j >= 0 ? n[j] : 0; ++ } ++ } ++ ++ /* Free temporary arrays */ ++ for (i = 0; i < mlen; i++) ++ m[i] = 0; ++ sfree(mem_ctx, m); ++ for (i = 0; i < plen; i++) ++ n[i] = 0; ++ sfree(mem_ctx, n); ++} ++ ++/* ++ * Simple remainder. ++ */ ++Bignum bigmod(void *mem_ctx, Bignum a, Bignum b) ++{ ++ Bignum r = newbn(mem_ctx, b[0]); ++ bigdivmod(mem_ctx, a, b, r, NULL); ++ return r; ++} ++ ++/* ++ * Compute (base ^ exp) % mod. ++ */ ++Bignum dwc_modpow(void *mem_ctx, Bignum base_in, Bignum exp, Bignum mod) ++{ ++ BignumInt *a, *b, *n, *m; ++ int mshift; ++ int mlen, i, j; ++ Bignum base, result; ++ ++ /* ++ * The most significant word of mod needs to be non-zero. It ++ * should already be, but let's make sure. ++ */ ++ //assert(mod[mod[0]] != 0); ++ ++ /* ++ * Make sure the base is smaller than the modulus, by reducing ++ * it modulo the modulus if not. ++ */ ++ base = bigmod(mem_ctx, base_in, mod); ++ ++ /* Allocate m of size mlen, copy mod to m */ ++ /* We use big endian internally */ ++ mlen = mod[0]; ++ m = snewn(mem_ctx, mlen, BignumInt); ++ //if (!m) ++ //abort(); /* FIXME */ ++ for (j = 0; j < mlen; j++) ++ m[j] = mod[mod[0] - j]; ++ ++ /* Shift m left to make msb bit set */ ++ for (mshift = 0; mshift < BIGNUM_INT_BITS - 1; mshift++) ++ if ((m[0] << mshift) & BIGNUM_TOP_BIT) ++ break; ++ if (mshift) { ++ for (i = 0; i < mlen - 1; i++) ++ m[i] = ++ (m[i] << mshift) | (m[i + 1] >> ++ (BIGNUM_INT_BITS - mshift)); ++ m[mlen - 1] = m[mlen - 1] << mshift; ++ } ++ ++ /* Allocate n of size mlen, copy base to n */ ++ n = snewn(mem_ctx, mlen, BignumInt); ++ //if (!n) ++ //abort(); /* FIXME */ ++ i = mlen - base[0]; ++ for (j = 0; j < i; j++) ++ n[j] = 0; ++ for (j = 0; j < base[0]; j++) ++ n[i + j] = base[base[0] - j]; ++ ++ /* Allocate a and b of size 2*mlen. Set a = 1 */ ++ a = snewn(mem_ctx, 2 * mlen, BignumInt); ++ //if (!a) ++ //abort(); /* FIXME */ ++ b = snewn(mem_ctx, 2 * mlen, BignumInt); ++ //if (!b) ++ //abort(); /* FIXME */ ++ for (i = 0; i < 2 * mlen; i++) ++ a[i] = 0; ++ a[2 * mlen - 1] = 1; ++ ++ /* Skip leading zero bits of exp. */ ++ i = 0; ++ j = BIGNUM_INT_BITS - 1; ++ while (i < exp[0] && (exp[exp[0] - i] & (1 << j)) == 0) { ++ j--; ++ if (j < 0) { ++ i++; ++ j = BIGNUM_INT_BITS - 1; ++ } ++ } ++ ++ /* Main computation */ ++ while (i < exp[0]) { ++ while (j >= 0) { ++ internal_mul(a + mlen, a + mlen, b, mlen); ++ internal_mod(b, mlen * 2, m, mlen, NULL, 0); ++ if ((exp[exp[0] - i] & (1 << j)) != 0) { ++ internal_mul(b + mlen, n, a, mlen); ++ internal_mod(a, mlen * 2, m, mlen, NULL, 0); ++ } else { ++ BignumInt *t; ++ t = a; ++ a = b; ++ b = t; ++ } ++ j--; ++ } ++ i++; ++ j = BIGNUM_INT_BITS - 1; ++ } ++ ++ /* Fixup result in case the modulus was shifted */ ++ if (mshift) { ++ for (i = mlen - 1; i < 2 * mlen - 1; i++) ++ a[i] = ++ (a[i] << mshift) | (a[i + 1] >> ++ (BIGNUM_INT_BITS - mshift)); ++ a[2 * mlen - 1] = a[2 * mlen - 1] << mshift; ++ internal_mod(a, mlen * 2, m, mlen, NULL, 0); ++ for (i = 2 * mlen - 1; i >= mlen; i--) ++ a[i] = ++ (a[i] >> mshift) | (a[i - 1] << ++ (BIGNUM_INT_BITS - mshift)); ++ } ++ ++ /* Copy result to buffer */ ++ result = newbn(mem_ctx, mod[0]); ++ for (i = 0; i < mlen; i++) ++ result[result[0] - i] = a[i + mlen]; ++ while (result[0] > 1 && result[result[0]] == 0) ++ result[0]--; ++ ++ /* Free temporary arrays */ ++ for (i = 0; i < 2 * mlen; i++) ++ a[i] = 0; ++ sfree(mem_ctx, a); ++ for (i = 0; i < 2 * mlen; i++) ++ b[i] = 0; ++ sfree(mem_ctx, b); ++ for (i = 0; i < mlen; i++) ++ m[i] = 0; ++ sfree(mem_ctx, m); ++ for (i = 0; i < mlen; i++) ++ n[i] = 0; ++ sfree(mem_ctx, n); ++ ++ freebn(mem_ctx, base); ++ ++ return result; ++} ++ ++ ++#ifdef UNITTEST ++ ++static __u32 dh_p[] = { ++ 96, ++ 0xFFFFFFFF, ++ 0xFFFFFFFF, ++ 0xA93AD2CA, ++ 0x4B82D120, ++ 0xE0FD108E, ++ 0x43DB5BFC, ++ 0x74E5AB31, ++ 0x08E24FA0, ++ 0xBAD946E2, ++ 0x770988C0, ++ 0x7A615D6C, ++ 0xBBE11757, ++ 0x177B200C, ++ 0x521F2B18, ++ 0x3EC86A64, ++ 0xD8760273, ++ 0xD98A0864, ++ 0xF12FFA06, ++ 0x1AD2EE6B, ++ 0xCEE3D226, ++ 0x4A25619D, ++ 0x1E8C94E0, ++ 0xDB0933D7, ++ 0xABF5AE8C, ++ 0xA6E1E4C7, ++ 0xB3970F85, ++ 0x5D060C7D, ++ 0x8AEA7157, ++ 0x58DBEF0A, ++ 0xECFB8504, ++ 0xDF1CBA64, ++ 0xA85521AB, ++ 0x04507A33, ++ 0xAD33170D, ++ 0x8AAAC42D, ++ 0x15728E5A, ++ 0x98FA0510, ++ 0x15D22618, ++ 0xEA956AE5, ++ 0x3995497C, ++ 0x95581718, ++ 0xDE2BCBF6, ++ 0x6F4C52C9, ++ 0xB5C55DF0, ++ 0xEC07A28F, ++ 0x9B2783A2, ++ 0x180E8603, ++ 0xE39E772C, ++ 0x2E36CE3B, ++ 0x32905E46, ++ 0xCA18217C, ++ 0xF1746C08, ++ 0x4ABC9804, ++ 0x670C354E, ++ 0x7096966D, ++ 0x9ED52907, ++ 0x208552BB, ++ 0x1C62F356, ++ 0xDCA3AD96, ++ 0x83655D23, ++ 0xFD24CF5F, ++ 0x69163FA8, ++ 0x1C55D39A, ++ 0x98DA4836, ++ 0xA163BF05, ++ 0xC2007CB8, ++ 0xECE45B3D, ++ 0x49286651, ++ 0x7C4B1FE6, ++ 0xAE9F2411, ++ 0x5A899FA5, ++ 0xEE386BFB, ++ 0xF406B7ED, ++ 0x0BFF5CB6, ++ 0xA637ED6B, ++ 0xF44C42E9, ++ 0x625E7EC6, ++ 0xE485B576, ++ 0x6D51C245, ++ 0x4FE1356D, ++ 0xF25F1437, ++ 0x302B0A6D, ++ 0xCD3A431B, ++ 0xEF9519B3, ++ 0x8E3404DD, ++ 0x514A0879, ++ 0x3B139B22, ++ 0x020BBEA6, ++ 0x8A67CC74, ++ 0x29024E08, ++ 0x80DC1CD1, ++ 0xC4C6628B, ++ 0x2168C234, ++ 0xC90FDAA2, ++ 0xFFFFFFFF, ++ 0xFFFFFFFF, ++}; ++ ++static __u32 dh_a[] = { ++ 8, ++ 0xdf367516, ++ 0x86459caa, ++ 0xe2d459a4, ++ 0xd910dae0, ++ 0x8a8b5e37, ++ 0x67ab31c6, ++ 0xf0b55ea9, ++ 0x440051d6, ++}; ++ ++static __u32 dh_b[] = { ++ 8, ++ 0xded92656, ++ 0xe07a048a, ++ 0x6fa452cd, ++ 0x2df89d30, ++ 0xc75f1b0f, ++ 0x8ce3578f, ++ 0x7980a324, ++ 0x5daec786, ++}; ++ ++static __u32 dh_g[] = { ++ 1, ++ 2, ++}; ++ ++int main(void) ++{ ++ int i; ++ __u32 *k; ++ k = dwc_modpow(NULL, dh_g, dh_a, dh_p); ++ ++ printf("\n\n"); ++ for (i=0; i<k[0]; i++) { ++ __u32 word32 = k[k[0] - i]; ++ __u16 l = word32 & 0xffff; ++ __u16 m = (word32 & 0xffff0000) >> 16; ++ printf("%04x %04x ", m, l); ++ if (!((i + 1)%13)) printf("\n"); ++ } ++ printf("\n\n"); ++ ++ if ((k[0] == 0x60) && (k[1] == 0x28e490e5) && (k[0x60] == 0x5a0d3d4e)) { ++ printf("PASS\n\n"); ++ } ++ else { ++ printf("FAIL\n\n"); ++ } ++ ++} ++ ++#endif /* UNITTEST */ ++ ++#endif /* CONFIG_MACH_IPMATE */ ++ ++#endif /*DWC_CRYPTOLIB */ +diff --git a/drivers/usb/host/dwc_common_port/dwc_modpow.h b/drivers/usb/host/dwc_common_port/dwc_modpow.h +new file mode 100644 +index 0000000..64f00c2 +--- /dev/null ++++ b/drivers/usb/host/dwc_common_port/dwc_modpow.h +@@ -0,0 +1,34 @@ ++/* ++ * dwc_modpow.h ++ * See dwc_modpow.c for license and changes ++ */ ++#ifndef _DWC_MODPOW_H ++#define _DWC_MODPOW_H ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++#include "dwc_os.h" ++ ++/** @file ++ * ++ * This file defines the module exponentiation function which is only used ++ * internally by the DWC UWB modules for calculation of PKs during numeric ++ * association. The routine is taken from the PUTTY, an open source terminal ++ * emulator. The PUTTY License is preserved in the dwc_modpow.c file. ++ * ++ */ ++ ++typedef uint32_t BignumInt; ++typedef uint64_t BignumDblInt; ++typedef BignumInt *Bignum; ++ ++/* Compute modular exponentiaion */ ++extern Bignum dwc_modpow(void *mem_ctx, Bignum base_in, Bignum exp, Bignum mod); ++ ++#ifdef __cplusplus ++} ++#endif ++ ++#endif /* _LINUX_BIGNUM_H */ +diff --git a/drivers/usb/host/dwc_common_port/dwc_notifier.c b/drivers/usb/host/dwc_common_port/dwc_notifier.c +new file mode 100644 +index 0000000..8b3772a +--- /dev/null ++++ b/drivers/usb/host/dwc_common_port/dwc_notifier.c +@@ -0,0 +1,319 @@ ++#ifdef DWC_NOTIFYLIB ++ ++#include "dwc_notifier.h" ++#include "dwc_list.h" ++ ++typedef struct dwc_observer { ++ void *observer; ++ dwc_notifier_callback_t callback; ++ void *data; ++ char *notification; ++ DWC_CIRCLEQ_ENTRY(dwc_observer) list_entry; ++} observer_t; ++ ++DWC_CIRCLEQ_HEAD(observer_queue, dwc_observer); ++ ++typedef struct dwc_notifier { ++ void *mem_ctx; ++ void *object; ++ struct observer_queue observers; ++ DWC_CIRCLEQ_ENTRY(dwc_notifier) list_entry; ++} notifier_t; ++ ++DWC_CIRCLEQ_HEAD(notifier_queue, dwc_notifier); ++ ++typedef struct manager { ++ void *mem_ctx; ++ void *wkq_ctx; ++ dwc_workq_t *wq; ++// dwc_mutex_t *mutex; ++ struct notifier_queue notifiers; ++} manager_t; ++ ++static manager_t *manager = NULL; ++ ++static int create_manager(void *mem_ctx, void *wkq_ctx) ++{ ++ manager = dwc_alloc(mem_ctx, sizeof(manager_t)); ++ if (!manager) { ++ return -DWC_E_NO_MEMORY; ++ } ++ ++ DWC_CIRCLEQ_INIT(&manager->notifiers); ++ ++ manager->wq = dwc_workq_alloc(wkq_ctx, "DWC Notification WorkQ"); ++ if (!manager->wq) { ++ return -DWC_E_NO_MEMORY; ++ } ++ ++ return 0; ++} ++ ++static void free_manager(void) ++{ ++ dwc_workq_free(manager->wq); ++ ++ /* All notifiers must have unregistered themselves before this module ++ * can be removed. Hitting this assertion indicates a programmer ++ * error. */ ++ DWC_ASSERT(DWC_CIRCLEQ_EMPTY(&manager->notifiers), ++ "Notification manager being freed before all notifiers have been removed"); ++ dwc_free(manager->mem_ctx, manager); ++} ++ ++#ifdef DEBUG ++static void dump_manager(void) ++{ ++ notifier_t *n; ++ observer_t *o; ++ ++ DWC_ASSERT(manager, "Notification manager not found"); ++ ++ DWC_DEBUG("List of all notifiers and observers:\n"); ++ DWC_CIRCLEQ_FOREACH(n, &manager->notifiers, list_entry) { ++ DWC_DEBUG("Notifier %p has observers:\n", n->object); ++ DWC_CIRCLEQ_FOREACH(o, &n->observers, list_entry) { ++ DWC_DEBUG(" %p watching %s\n", o->observer, o->notification); ++ } ++ } ++} ++#else ++#define dump_manager(...) ++#endif ++ ++static observer_t *alloc_observer(void *mem_ctx, void *observer, char *notification, ++ dwc_notifier_callback_t callback, void *data) ++{ ++ observer_t *new_observer = dwc_alloc(mem_ctx, sizeof(observer_t)); ++ ++ if (!new_observer) { ++ return NULL; ++ } ++ ++ DWC_CIRCLEQ_INIT_ENTRY(new_observer, list_entry); ++ new_observer->observer = observer; ++ new_observer->notification = notification; ++ new_observer->callback = callback; ++ new_observer->data = data; ++ return new_observer; ++} ++ ++static void free_observer(void *mem_ctx, observer_t *observer) ++{ ++ dwc_free(mem_ctx, observer); ++} ++ ++static notifier_t *alloc_notifier(void *mem_ctx, void *object) ++{ ++ notifier_t *notifier; ++ ++ if (!object) { ++ return NULL; ++ } ++ ++ notifier = dwc_alloc(mem_ctx, sizeof(notifier_t)); ++ if (!notifier) { ++ return NULL; ++ } ++ ++ DWC_CIRCLEQ_INIT(&notifier->observers); ++ DWC_CIRCLEQ_INIT_ENTRY(notifier, list_entry); ++ ++ notifier->mem_ctx = mem_ctx; ++ notifier->object = object; ++ return notifier; ++} ++ ++static void free_notifier(notifier_t *notifier) ++{ ++ observer_t *observer; ++ ++ DWC_CIRCLEQ_FOREACH(observer, &notifier->observers, list_entry) { ++ free_observer(notifier->mem_ctx, observer); ++ } ++ ++ dwc_free(notifier->mem_ctx, notifier); ++} ++ ++static notifier_t *find_notifier(void *object) ++{ ++ notifier_t *notifier; ++ ++ DWC_ASSERT(manager, "Notification manager not found"); ++ ++ if (!object) { ++ return NULL; ++ } ++ ++ DWC_CIRCLEQ_FOREACH(notifier, &manager->notifiers, list_entry) { ++ if (notifier->object == object) { ++ return notifier; ++ } ++ } ++ ++ return NULL; ++} ++ ++int dwc_alloc_notification_manager(void *mem_ctx, void *wkq_ctx) ++{ ++ return create_manager(mem_ctx, wkq_ctx); ++} ++ ++void dwc_free_notification_manager(void) ++{ ++ free_manager(); ++} ++ ++dwc_notifier_t *dwc_register_notifier(void *mem_ctx, void *object) ++{ ++ notifier_t *notifier; ++ ++ DWC_ASSERT(manager, "Notification manager not found"); ++ ++ notifier = find_notifier(object); ++ if (notifier) { ++ DWC_ERROR("Notifier %p is already registered\n", object); ++ return NULL; ++ } ++ ++ notifier = alloc_notifier(mem_ctx, object); ++ if (!notifier) { ++ return NULL; ++ } ++ ++ DWC_CIRCLEQ_INSERT_TAIL(&manager->notifiers, notifier, list_entry); ++ ++ DWC_INFO("Notifier %p registered", object); ++ dump_manager(); ++ ++ return notifier; ++} ++ ++void dwc_unregister_notifier(dwc_notifier_t *notifier) ++{ ++ DWC_ASSERT(manager, "Notification manager not found"); ++ ++ if (!DWC_CIRCLEQ_EMPTY(&notifier->observers)) { ++ observer_t *o; ++ ++ DWC_ERROR("Notifier %p has active observers when removing\n", notifier->object); ++ DWC_CIRCLEQ_FOREACH(o, &notifier->observers, list_entry) { ++ DWC_DEBUGC(" %p watching %s\n", o->observer, o->notification); ++ } ++ ++ DWC_ASSERT(DWC_CIRCLEQ_EMPTY(&notifier->observers), ++ "Notifier %p has active observers when removing", notifier); ++ } ++ ++ DWC_CIRCLEQ_REMOVE_INIT(&manager->notifiers, notifier, list_entry); ++ free_notifier(notifier); ++ ++ DWC_INFO("Notifier unregistered"); ++ dump_manager(); ++} ++ ++/* Add an observer to observe the notifier for a particular state, event, or notification. */ ++int dwc_add_observer(void *observer, void *object, char *notification, ++ dwc_notifier_callback_t callback, void *data) ++{ ++ notifier_t *notifier = find_notifier(object); ++ observer_t *new_observer; ++ ++ if (!notifier) { ++ DWC_ERROR("Notifier %p is not found when adding observer\n", object); ++ return -DWC_E_INVALID; ++ } ++ ++ new_observer = alloc_observer(notifier->mem_ctx, observer, notification, callback, data); ++ if (!new_observer) { ++ return -DWC_E_NO_MEMORY; ++ } ++ ++ DWC_CIRCLEQ_INSERT_TAIL(&notifier->observers, new_observer, list_entry); ++ ++ DWC_INFO("Added observer %p to notifier %p observing notification %s, callback=%p, data=%p", ++ observer, object, notification, callback, data); ++ ++ dump_manager(); ++ return 0; ++} ++ ++int dwc_remove_observer(void *observer) ++{ ++ notifier_t *n; ++ ++ DWC_ASSERT(manager, "Notification manager not found"); ++ ++ DWC_CIRCLEQ_FOREACH(n, &manager->notifiers, list_entry) { ++ observer_t *o; ++ observer_t *o2; ++ ++ DWC_CIRCLEQ_FOREACH_SAFE(o, o2, &n->observers, list_entry) { ++ if (o->observer == observer) { ++ DWC_CIRCLEQ_REMOVE_INIT(&n->observers, o, list_entry); ++ DWC_INFO("Removing observer %p from notifier %p watching notification %s:", ++ o->observer, n->object, o->notification); ++ free_observer(n->mem_ctx, o); ++ } ++ } ++ } ++ ++ dump_manager(); ++ return 0; ++} ++ ++typedef struct callback_data { ++ void *mem_ctx; ++ dwc_notifier_callback_t cb; ++ void *observer; ++ void *data; ++ void *object; ++ char *notification; ++ void *notification_data; ++} cb_data_t; ++ ++static void cb_task(void *data) ++{ ++ cb_data_t *cb = (cb_data_t *)data; ++ ++ cb->cb(cb->object, cb->notification, cb->observer, cb->notification_data, cb->data); ++ dwc_free(cb->mem_ctx, cb); ++} ++ ++void dwc_notify(dwc_notifier_t *notifier, char *notification, void *notification_data) ++{ ++ observer_t *o; ++ ++ DWC_ASSERT(manager, "Notification manager not found"); ++ ++ DWC_CIRCLEQ_FOREACH(o, &notifier->observers, list_entry) { ++ int len = DWC_STRLEN(notification); ++ ++ if (DWC_STRLEN(o->notification) != len) { ++ continue; ++ } ++ ++ if (DWC_STRNCMP(o->notification, notification, len) == 0) { ++ cb_data_t *cb_data = dwc_alloc(notifier->mem_ctx, sizeof(cb_data_t)); ++ ++ if (!cb_data) { ++ DWC_ERROR("Failed to allocate callback data\n"); ++ return; ++ } ++ ++ cb_data->mem_ctx = notifier->mem_ctx; ++ cb_data->cb = o->callback; ++ cb_data->observer = o->observer; ++ cb_data->data = o->data; ++ cb_data->object = notifier->object; ++ cb_data->notification = notification; ++ cb_data->notification_data = notification_data; ++ DWC_DEBUGC("Observer found %p for notification %s\n", o->observer, notification); ++ DWC_WORKQ_SCHEDULE(manager->wq, cb_task, cb_data, ++ "Notify callback from %p for Notification %s, to observer %p", ++ cb_data->object, notification, cb_data->observer); ++ } ++ } ++} ++ ++#endif /* DWC_NOTIFYLIB */ +diff --git a/drivers/usb/host/dwc_common_port/dwc_notifier.h b/drivers/usb/host/dwc_common_port/dwc_notifier.h +new file mode 100644 +index 0000000..4a8cdfe +--- /dev/null ++++ b/drivers/usb/host/dwc_common_port/dwc_notifier.h +@@ -0,0 +1,122 @@ ++ ++#ifndef __DWC_NOTIFIER_H__ ++#define __DWC_NOTIFIER_H__ ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++#include "dwc_os.h" ++ ++/** @file ++ * ++ * A simple implementation of the Observer pattern. Any "module" can ++ * register as an observer or notifier. The notion of "module" is abstract and ++ * can mean anything used to identify either an observer or notifier. Usually ++ * it will be a pointer to a data structure which contains some state, ie an ++ * object. ++ * ++ * Before any notifiers can be added, the global notification manager must be ++ * brought up with dwc_alloc_notification_manager(). ++ * dwc_free_notification_manager() will bring it down and free all resources. ++ * These would typically be called upon module load and unload. The ++ * notification manager is a single global instance that handles all registered ++ * observable modules and observers so this should be done only once. ++ * ++ * A module can be observable by using Notifications to publicize some general ++ * information about it's state or operation. It does not care who listens, or ++ * even if anyone listens, or what they do with the information. The observable ++ * modules do not need to know any information about it's observers or their ++ * interface, or their state or data. ++ * ++ * Any module can register to emit Notifications. It should publish a list of ++ * notifications that it can emit and their behavior, such as when they will get ++ * triggered, and what information will be provided to the observer. Then it ++ * should register itself as an observable module. See dwc_register_notifier(). ++ * ++ * Any module can observe any observable, registered module, provided it has a ++ * handle to the other module and knows what notifications to observe. See ++ * dwc_add_observer(). ++ * ++ * A function of type dwc_notifier_callback_t is called whenever a notification ++ * is triggered with one or more observers observing it. This function is ++ * called in it's own process so it may sleep or block if needed. It is ++ * guaranteed to be called sometime after the notification has occurred and will ++ * be called once per each time the notification is triggered. It will NOT be ++ * called in the same process context used to trigger the notification. ++ * ++ * @section Limitiations ++ * ++ * Keep in mind that Notifications that can be triggered in rapid sucession may ++ * schedule too many processes too handle. Be aware of this limitation when ++ * designing to use notifications, and only add notifications for appropriate ++ * observable information. ++ * ++ * Also Notification callbacks are not synchronous. If you need to synchronize ++ * the behavior between module/observer you must use other means. And perhaps ++ * that will mean Notifications are not the proper solution. ++ */ ++ ++struct dwc_notifier; ++typedef struct dwc_notifier dwc_notifier_t; ++ ++/** The callback function must be of this type. ++ * ++ * @param object This is the object that is being observed. ++ * @param notification This is the notification that was triggered. ++ * @param observer This is the observer ++ * @param notification_data This is notification-specific data that the notifier ++ * has included in this notification. The value of this should be published in ++ * the documentation of the observable module with the notifications. ++ * @param user_data This is any custom data that the observer provided when ++ * adding itself as an observer to the notification. */ ++typedef void (*dwc_notifier_callback_t)(void *object, char *notification, void *observer, ++ void *notification_data, void *user_data); ++ ++/** Brings up the notification manager. */ ++extern int dwc_alloc_notification_manager(void *mem_ctx, void *wkq_ctx); ++/** Brings down the notification manager. */ ++extern void dwc_free_notification_manager(void); ++ ++/** This function registers an observable module. A dwc_notifier_t object is ++ * returned to the observable module. This is an opaque object that is used by ++ * the observable module to trigger notifications. This object should only be ++ * accessible to functions that are authorized to trigger notifications for this ++ * module. Observers do not need this object. */ ++extern dwc_notifier_t *dwc_register_notifier(void *mem_ctx, void *object); ++ ++/** This function unregisters an observable module. All observers have to be ++ * removed prior to unregistration. */ ++extern void dwc_unregister_notifier(dwc_notifier_t *notifier); ++ ++/** Add a module as an observer to the observable module. The observable module ++ * needs to have previously registered with the notification manager. ++ * ++ * @param observer The observer module ++ * @param object The module to observe ++ * @param notification The notification to observe ++ * @param callback The callback function to call ++ * @param user_data Any additional user data to pass into the callback function */ ++extern int dwc_add_observer(void *observer, void *object, char *notification, ++ dwc_notifier_callback_t callback, void *user_data); ++ ++/** Removes the specified observer from all notifications that it is currently ++ * observing. */ ++extern int dwc_remove_observer(void *observer); ++ ++/** This function triggers a Notification. It should be called by the ++ * observable module, or any module or library which the observable module ++ * allows to trigger notification on it's behalf. Such as the dwc_cc_t. ++ * ++ * dwc_notify is a non-blocking function. Callbacks are scheduled called in ++ * their own process context for each trigger. Callbacks can be blocking. ++ * dwc_notify can be called from interrupt context if needed. ++ * ++ */ ++void dwc_notify(dwc_notifier_t *notifier, char *notification, void *notification_data); ++ ++#ifdef __cplusplus ++} ++#endif ++ ++#endif /* __DWC_NOTIFIER_H__ */ +diff --git a/drivers/usb/host/dwc_common_port/dwc_os.h b/drivers/usb/host/dwc_common_port/dwc_os.h +new file mode 100644 +index 0000000..a2bbe23 +--- /dev/null ++++ b/drivers/usb/host/dwc_common_port/dwc_os.h +@@ -0,0 +1,1276 @@ ++/* ========================================================================= ++ * $File: //dwh/usb_iip/dev/software/dwc_common_port_2/dwc_os.h $ ++ * $Revision: #14 $ ++ * $Date: 2010/11/04 $ ++ * $Change: 1621695 $ ++ * ++ * Synopsys Portability Library Software and documentation ++ * (hereinafter, "Software") is an Unsupported proprietary work of ++ * Synopsys, Inc. unless otherwise expressly agreed to in writing ++ * between Synopsys and you. ++ * ++ * The Software IS NOT an item of Licensed Software or Licensed Product ++ * under any End User Software License Agreement or Agreement for ++ * Licensed Product with Synopsys or any supplement thereto. You are ++ * permitted to use and redistribute this Software in source and binary ++ * forms, with or without modification, provided that redistributions ++ * of source code must retain this notice. You may not view, use, ++ * disclose, copy or distribute this file or any information contained ++ * herein except pursuant to this license grant from Synopsys. If you ++ * do not agree with this notice, including the disclaimer below, then ++ * you are not authorized to use the Software. ++ * ++ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" ++ * BASIS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ++ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS ++ * FOR A PARTICULAR PURPOSE ARE HEREBY DISCLAIMED. IN NO EVENT SHALL ++ * SYNOPSYS 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. ++ * ========================================================================= */ ++#ifndef _DWC_OS_H_ ++#define _DWC_OS_H_ ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++/** @file ++ * ++ * DWC portability library, low level os-wrapper functions ++ * ++ */ ++ ++/* These basic types need to be defined by some OS header file or custom header ++ * file for your specific target architecture. ++ * ++ * uint8_t, int8_t, uint16_t, int16_t, uint32_t, int32_t, uint64_t, int64_t ++ * ++ * Any custom or alternate header file must be added and enabled here. ++ */ ++ ++#ifdef DWC_LINUX ++# include <linux/types.h> ++# ifdef CONFIG_DEBUG_MUTEXES ++# include <linux/mutex.h> ++# endif ++# include <linux/spinlock.h> ++# include <linux/errno.h> ++# include <stdarg.h> ++#endif ++ ++#if defined(DWC_FREEBSD) || defined(DWC_NETBSD) ++# include <os_dep.h> ++#endif ++ ++ ++/** @name Primitive Types and Values */ ++ ++/** We define a boolean type for consistency. Can be either YES or NO */ ++typedef uint8_t dwc_bool_t; ++#define YES 1 ++#define NO 0 ++ ++#ifdef DWC_LINUX ++ ++/** @name Error Codes */ ++#define DWC_E_INVALID EINVAL ++#define DWC_E_NO_MEMORY ENOMEM ++#define DWC_E_NO_DEVICE ENODEV ++#define DWC_E_NOT_SUPPORTED EOPNOTSUPP ++#define DWC_E_TIMEOUT ETIMEDOUT ++#define DWC_E_BUSY EBUSY ++#define DWC_E_AGAIN EAGAIN ++#define DWC_E_RESTART ERESTART ++#define DWC_E_ABORT ECONNABORTED ++#define DWC_E_SHUTDOWN ESHUTDOWN ++#define DWC_E_NO_DATA ENODATA ++#define DWC_E_DISCONNECT ECONNRESET ++#define DWC_E_UNKNOWN EINVAL ++#define DWC_E_NO_STREAM_RES ENOSR ++#define DWC_E_COMMUNICATION ECOMM ++#define DWC_E_OVERFLOW EOVERFLOW ++#define DWC_E_PROTOCOL EPROTO ++#define DWC_E_IN_PROGRESS EINPROGRESS ++#define DWC_E_PIPE EPIPE ++#define DWC_E_IO EIO ++#define DWC_E_NO_SPACE ENOSPC ++ ++#else ++ ++/** @name Error Codes */ ++#define DWC_E_INVALID 1001 ++#define DWC_E_NO_MEMORY 1002 ++#define DWC_E_NO_DEVICE 1003 ++#define DWC_E_NOT_SUPPORTED 1004 ++#define DWC_E_TIMEOUT 1005 ++#define DWC_E_BUSY 1006 ++#define DWC_E_AGAIN 1007 ++#define DWC_E_RESTART 1008 ++#define DWC_E_ABORT 1009 ++#define DWC_E_SHUTDOWN 1010 ++#define DWC_E_NO_DATA 1011 ++#define DWC_E_DISCONNECT 2000 ++#define DWC_E_UNKNOWN 3000 ++#define DWC_E_NO_STREAM_RES 4001 ++#define DWC_E_COMMUNICATION 4002 ++#define DWC_E_OVERFLOW 4003 ++#define DWC_E_PROTOCOL 4004 ++#define DWC_E_IN_PROGRESS 4005 ++#define DWC_E_PIPE 4006 ++#define DWC_E_IO 4007 ++#define DWC_E_NO_SPACE 4008 ++ ++#endif ++ ++ ++/** @name Tracing/Logging Functions ++ * ++ * These function provide the capability to add tracing, debugging, and error ++ * messages, as well exceptions as assertions. The WUDEV uses these ++ * extensively. These could be logged to the main console, the serial port, an ++ * internal buffer, etc. These functions could also be no-op if they are too ++ * expensive on your system. By default undefining the DEBUG macro already ++ * no-ops some of these functions. */ ++ ++/** Returns non-zero if in interrupt context. */ ++extern dwc_bool_t DWC_IN_IRQ(void); ++#define dwc_in_irq DWC_IN_IRQ ++ ++/** Returns "IRQ" if DWC_IN_IRQ is true. */ ++static inline char *dwc_irq(void) { ++ return DWC_IN_IRQ() ? "IRQ" : ""; ++} ++ ++/** Returns non-zero if in bottom-half context. */ ++extern dwc_bool_t DWC_IN_BH(void); ++#define dwc_in_bh DWC_IN_BH ++ ++/** Returns "BH" if DWC_IN_BH is true. */ ++static inline char *dwc_bh(void) { ++ return DWC_IN_BH() ? "BH" : ""; ++} ++ ++/** ++ * A vprintf() clone. Just call vprintf if you've got it. ++ */ ++extern void DWC_VPRINTF(char *format, va_list args); ++#define dwc_vprintf DWC_VPRINTF ++ ++/** ++ * A vsnprintf() clone. Just call vprintf if you've got it. ++ */ ++extern int DWC_VSNPRINTF(char *str, int size, char *format, va_list args); ++#define dwc_vsnprintf DWC_VSNPRINTF ++ ++/** ++ * printf() clone. Just call printf if you've go it. ++ */ ++extern void DWC_PRINTF(char *format, ...) ++/* This provides compiler level static checking of the parameters if you're ++ * using GCC. */ ++#ifdef __GNUC__ ++ __attribute__ ((format(printf, 1, 2))); ++#else ++ ; ++#endif ++#define dwc_printf DWC_PRINTF ++ ++/** ++ * sprintf() clone. Just call sprintf if you've got it. ++ */ ++extern int DWC_SPRINTF(char *string, char *format, ...) ++#ifdef __GNUC__ ++ __attribute__ ((format(printf, 2, 3))); ++#else ++ ; ++#endif ++#define dwc_sprintf DWC_SPRINTF ++ ++/** ++ * snprintf() clone. Just call snprintf if you've got it. ++ */ ++extern int DWC_SNPRINTF(char *string, int size, char *format, ...) ++#ifdef __GNUC__ ++ __attribute__ ((format(printf, 3, 4))); ++#else ++ ; ++#endif ++#define dwc_snprintf DWC_SNPRINTF ++ ++/** ++ * Prints a WARNING message. On systems that don't differentiate between ++ * warnings and regular log messages, just print it. Indicates that something ++ * may be wrong with the driver. Works like printf(). ++ * ++ * Use the DWC_WARN macro to call this function. ++ */ ++extern void __DWC_WARN(char *format, ...) ++#ifdef __GNUC__ ++ __attribute__ ((format(printf, 1, 2))); ++#else ++ ; ++#endif ++ ++/** ++ * Prints an error message. On systems that don't differentiate between errors ++ * and regular log messages, just print it. Indicates that something went wrong ++ * with the driver. Works like printf(). ++ * ++ * Use the DWC_ERROR macro to call this function. ++ */ ++extern void __DWC_ERROR(char *format, ...) ++#ifdef __GNUC__ ++ __attribute__ ((format(printf, 1, 2))); ++#else ++ ; ++#endif ++ ++/** ++ * Prints an exception error message and takes some user-defined action such as ++ * print out a backtrace or trigger a breakpoint. Indicates that something went ++ * abnormally wrong with the driver such as programmer error, or other ++ * exceptional condition. It should not be ignored so even on systems without ++ * printing capability, some action should be taken to notify the developer of ++ * it. Works like printf(). ++ */ ++extern void DWC_EXCEPTION(char *format, ...) ++#ifdef __GNUC__ ++ __attribute__ ((format(printf, 1, 2))); ++#else ++ ; ++#endif ++#define dwc_exception DWC_EXCEPTION ++ ++#ifndef DWC_OTG_DEBUG_LEV ++#define DWC_OTG_DEBUG_LEV 0 ++#endif ++ ++#ifdef DEBUG ++/** ++ * Prints out a debug message. Used for logging/trace messages. ++ * ++ * Use the DWC_DEBUG macro to call this function ++ */ ++extern void __DWC_DEBUG(char *format, ...) ++#ifdef __GNUC__ ++ __attribute__ ((format(printf, 1, 2))); ++#else ++ ; ++#endif ++#else ++#define __DWC_DEBUG printk ++#endif ++ ++/** ++ * Prints out a Debug message. ++ */ ++#define DWC_DEBUG(_format, _args...) __DWC_DEBUG("DEBUG:%s:%s: " _format "\n", \ ++ __func__, dwc_irq(), ## _args) ++#define dwc_debug DWC_DEBUG ++/** ++ * Prints out a Debug message if enabled at compile time. ++ */ ++#if DWC_OTG_DEBUG_LEV > 0 ++#define DWC_DEBUGC(_format, _args...) DWC_DEBUG(_format, ##_args ) ++#else ++#define DWC_DEBUGC(_format, _args...) ++#endif ++#define dwc_debugc DWC_DEBUGC ++/** ++ * Prints out an informative message. ++ */ ++#define DWC_INFO(_format, _args...) DWC_PRINTF("INFO:%s: " _format "\n", \ ++ dwc_irq(), ## _args) ++#define dwc_info DWC_INFO ++/** ++ * Prints out an informative message if enabled at compile time. ++ */ ++#if DWC_OTG_DEBUG_LEV > 1 ++#define DWC_INFOC(_format, _args...) DWC_INFO(_format, ##_args ) ++#else ++#define DWC_INFOC(_format, _args...) ++#endif ++#define dwc_infoc DWC_INFOC ++/** ++ * Prints out a warning message. ++ */ ++#define DWC_WARN(_format, _args...) __DWC_WARN("WARN:%s:%s:%d: " _format "\n", \ ++ dwc_irq(), __func__, __LINE__, ## _args) ++#define dwc_warn DWC_WARN ++/** ++ * Prints out an error message. ++ */ ++#define DWC_ERROR(_format, _args...) __DWC_ERROR("ERROR:%s:%s:%d: " _format "\n", \ ++ dwc_irq(), __func__, __LINE__, ## _args) ++#define dwc_error DWC_ERROR ++ ++#define DWC_PROTO_ERROR(_format, _args...) __DWC_WARN("ERROR:%s:%s:%d: " _format "\n", \ ++ dwc_irq(), __func__, __LINE__, ## _args) ++#define dwc_proto_error DWC_PROTO_ERROR ++ ++#ifdef DEBUG ++/** Prints out a exception error message if the _expr expression fails. Disabled ++ * if DEBUG is not enabled. */ ++#define DWC_ASSERT(_expr, _format, _args...) do { \ ++ if (!(_expr)) { DWC_EXCEPTION("%s:%s:%d: " _format "\n", dwc_irq(), \ ++ __FILE__, __LINE__, ## _args); } \ ++ } while (0) ++#else ++#define DWC_ASSERT(_x...) ++#endif ++#define dwc_assert DWC_ASSERT ++ ++ ++/** @name Byte Ordering ++ * The following functions are for conversions between processor's byte ordering ++ * and specific ordering you want. ++ */ ++ ++/** Converts 32 bit data in CPU byte ordering to little endian. */ ++extern uint32_t DWC_CPU_TO_LE32(uint32_t *p); ++#define dwc_cpu_to_le32 DWC_CPU_TO_LE32 ++ ++/** Converts 32 bit data in CPU byte orderint to big endian. */ ++extern uint32_t DWC_CPU_TO_BE32(uint32_t *p); ++#define dwc_cpu_to_be32 DWC_CPU_TO_BE32 ++ ++/** Converts 32 bit little endian data to CPU byte ordering. */ ++extern uint32_t DWC_LE32_TO_CPU(uint32_t *p); ++#define dwc_le32_to_cpu DWC_LE32_TO_CPU ++ ++/** Converts 32 bit big endian data to CPU byte ordering. */ ++extern uint32_t DWC_BE32_TO_CPU(uint32_t *p); ++#define dwc_be32_to_cpu DWC_BE32_TO_CPU ++ ++/** Converts 16 bit data in CPU byte ordering to little endian. */ ++extern uint16_t DWC_CPU_TO_LE16(uint16_t *p); ++#define dwc_cpu_to_le16 DWC_CPU_TO_LE16 ++ ++/** Converts 16 bit data in CPU byte orderint to big endian. */ ++extern uint16_t DWC_CPU_TO_BE16(uint16_t *p); ++#define dwc_cpu_to_be16 DWC_CPU_TO_BE16 ++ ++/** Converts 16 bit little endian data to CPU byte ordering. */ ++extern uint16_t DWC_LE16_TO_CPU(uint16_t *p); ++#define dwc_le16_to_cpu DWC_LE16_TO_CPU ++ ++/** Converts 16 bit bi endian data to CPU byte ordering. */ ++extern uint16_t DWC_BE16_TO_CPU(uint16_t *p); ++#define dwc_be16_to_cpu DWC_BE16_TO_CPU ++ ++ ++/** @name Register Read/Write ++ * ++ * The following six functions should be implemented to read/write registers of ++ * 32-bit and 64-bit sizes. All modules use this to read/write register values. ++ * The reg value is a pointer to the register calculated from the void *base ++ * variable passed into the driver when it is started. */ ++ ++#ifdef DWC_LINUX ++/* Linux doesn't need any extra parameters for register read/write, so we ++ * just throw away the IO context parameter. ++ */ ++/** Reads the content of a 32-bit register. */ ++extern uint32_t DWC_READ_REG32(uint32_t volatile *reg); ++#define dwc_read_reg32(_ctx_,_reg_) DWC_READ_REG32(_reg_) ++ ++/** Reads the content of a 64-bit register. */ ++extern uint64_t DWC_READ_REG64(uint64_t volatile *reg); ++#define dwc_read_reg64(_ctx_,_reg_) DWC_READ_REG64(_reg_) ++ ++/** Writes to a 32-bit register. */ ++extern void DWC_WRITE_REG32(uint32_t volatile *reg, uint32_t value); ++#define dwc_write_reg32(_ctx_,_reg_,_val_) DWC_WRITE_REG32(_reg_, _val_) ++ ++/** Writes to a 64-bit register. */ ++extern void DWC_WRITE_REG64(uint64_t volatile *reg, uint64_t value); ++#define dwc_write_reg64(_ctx_,_reg_,_val_) DWC_WRITE_REG64(_reg_, _val_) ++ ++/** ++ * Modify bit values in a register. Using the ++ * algorithm: (reg_contents & ~clear_mask) | set_mask. ++ */ ++extern void DWC_MODIFY_REG32(uint32_t volatile *reg, uint32_t clear_mask, uint32_t set_mask); ++#define dwc_modify_reg32(_ctx_,_reg_,_cmsk_,_smsk_) DWC_MODIFY_REG32(_reg_,_cmsk_,_smsk_) ++extern void DWC_MODIFY_REG64(uint64_t volatile *reg, uint64_t clear_mask, uint64_t set_mask); ++#define dwc_modify_reg64(_ctx_,_reg_,_cmsk_,_smsk_) DWC_MODIFY_REG64(_reg_,_cmsk_,_smsk_) ++ ++#endif /* DWC_LINUX */ ++ ++#if defined(DWC_FREEBSD) || defined(DWC_NETBSD) ++typedef struct dwc_ioctx { ++ struct device *dev; ++ bus_space_tag_t iot; ++ bus_space_handle_t ioh; ++} dwc_ioctx_t; ++ ++/** BSD needs two extra parameters for register read/write, so we pass ++ * them in using the IO context parameter. ++ */ ++/** Reads the content of a 32-bit register. */ ++extern uint32_t DWC_READ_REG32(void *io_ctx, uint32_t volatile *reg); ++#define dwc_read_reg32 DWC_READ_REG32 ++ ++/** Reads the content of a 64-bit register. */ ++extern uint64_t DWC_READ_REG64(void *io_ctx, uint64_t volatile *reg); ++#define dwc_read_reg64 DWC_READ_REG64 ++ ++/** Writes to a 32-bit register. */ ++extern void DWC_WRITE_REG32(void *io_ctx, uint32_t volatile *reg, uint32_t value); ++#define dwc_write_reg32 DWC_WRITE_REG32 ++ ++/** Writes to a 64-bit register. */ ++extern void DWC_WRITE_REG64(void *io_ctx, uint64_t volatile *reg, uint64_t value); ++#define dwc_write_reg64 DWC_WRITE_REG64 ++ ++/** ++ * Modify bit values in a register. Using the ++ * algorithm: (reg_contents & ~clear_mask) | set_mask. ++ */ ++extern void DWC_MODIFY_REG32(void *io_ctx, uint32_t volatile *reg, uint32_t clear_mask, uint32_t set_mask); ++#define dwc_modify_reg32 DWC_MODIFY_REG32 ++extern void DWC_MODIFY_REG64(void *io_ctx, uint64_t volatile *reg, uint64_t clear_mask, uint64_t set_mask); ++#define dwc_modify_reg64 DWC_MODIFY_REG64 ++ ++#endif /* DWC_FREEBSD || DWC_NETBSD */ ++ ++/** @cond */ ++ ++/** @name Some convenience MACROS used internally. Define DWC_DEBUG_REGS to log the ++ * register writes. */ ++ ++#ifdef DWC_LINUX ++ ++# ifdef DWC_DEBUG_REGS ++ ++#define dwc_define_read_write_reg_n(_reg,_container_type) \ ++static inline uint32_t dwc_read_##_reg##_n(_container_type *container, int num) { \ ++ return DWC_READ_REG32(&container->regs->_reg[num]); \ ++} \ ++static inline void dwc_write_##_reg##_n(_container_type *container, int num, uint32_t data) { \ ++ DWC_DEBUG("WRITING %8s[%d]: %p: %08x", #_reg, num, \ ++ &(((uint32_t*)container->regs->_reg)[num]), data); \ ++ DWC_WRITE_REG32(&(((uint32_t*)container->regs->_reg)[num]), data); \ ++} ++ ++#define dwc_define_read_write_reg(_reg,_container_type) \ ++static inline uint32_t dwc_read_##_reg(_container_type *container) { \ ++ return DWC_READ_REG32(&container->regs->_reg); \ ++} \ ++static inline void dwc_write_##_reg(_container_type *container, uint32_t data) { \ ++ DWC_DEBUG("WRITING %11s: %p: %08x", #_reg, &container->regs->_reg, data); \ ++ DWC_WRITE_REG32(&container->regs->_reg, data); \ ++} ++ ++# else /* DWC_DEBUG_REGS */ ++ ++#define dwc_define_read_write_reg_n(_reg,_container_type) \ ++static inline uint32_t dwc_read_##_reg##_n(_container_type *container, int num) { \ ++ return DWC_READ_REG32(&container->regs->_reg[num]); \ ++} \ ++static inline void dwc_write_##_reg##_n(_container_type *container, int num, uint32_t data) { \ ++ DWC_WRITE_REG32(&(((uint32_t*)container->regs->_reg)[num]), data); \ ++} ++ ++#define dwc_define_read_write_reg(_reg,_container_type) \ ++static inline uint32_t dwc_read_##_reg(_container_type *container) { \ ++ return DWC_READ_REG32(&container->regs->_reg); \ ++} \ ++static inline void dwc_write_##_reg(_container_type *container, uint32_t data) { \ ++ DWC_WRITE_REG32(&container->regs->_reg, data); \ ++} ++ ++# endif /* DWC_DEBUG_REGS */ ++ ++#endif /* DWC_LINUX */ ++ ++#if defined(DWC_FREEBSD) || defined(DWC_NETBSD) ++ ++# ifdef DWC_DEBUG_REGS ++ ++#define dwc_define_read_write_reg_n(_reg,_container_type) \ ++static inline uint32_t dwc_read_##_reg##_n(void *io_ctx, _container_type *container, int num) { \ ++ return DWC_READ_REG32(io_ctx, &container->regs->_reg[num]); \ ++} \ ++static inline void dwc_write_##_reg##_n(void *io_ctx, _container_type *container, int num, uint32_t data) { \ ++ DWC_DEBUG("WRITING %8s[%d]: %p: %08x", #_reg, num, \ ++ &(((uint32_t*)container->regs->_reg)[num]), data); \ ++ DWC_WRITE_REG32(io_ctx, &(((uint32_t*)container->regs->_reg)[num]), data); \ ++} ++ ++#define dwc_define_read_write_reg(_reg,_container_type) \ ++static inline uint32_t dwc_read_##_reg(void *io_ctx, _container_type *container) { \ ++ return DWC_READ_REG32(io_ctx, &container->regs->_reg); \ ++} \ ++static inline void dwc_write_##_reg(void *io_ctx, _container_type *container, uint32_t data) { \ ++ DWC_DEBUG("WRITING %11s: %p: %08x", #_reg, &container->regs->_reg, data); \ ++ DWC_WRITE_REG32(io_ctx, &container->regs->_reg, data); \ ++} ++ ++# else /* DWC_DEBUG_REGS */ ++ ++#define dwc_define_read_write_reg_n(_reg,_container_type) \ ++static inline uint32_t dwc_read_##_reg##_n(void *io_ctx, _container_type *container, int num) { \ ++ return DWC_READ_REG32(io_ctx, &container->regs->_reg[num]); \ ++} \ ++static inline void dwc_write_##_reg##_n(void *io_ctx, _container_type *container, int num, uint32_t data) { \ ++ DWC_WRITE_REG32(io_ctx, &(((uint32_t*)container->regs->_reg)[num]), data); \ ++} ++ ++#define dwc_define_read_write_reg(_reg,_container_type) \ ++static inline uint32_t dwc_read_##_reg(void *io_ctx, _container_type *container) { \ ++ return DWC_READ_REG32(io_ctx, &container->regs->_reg); \ ++} \ ++static inline void dwc_write_##_reg(void *io_ctx, _container_type *container, uint32_t data) { \ ++ DWC_WRITE_REG32(io_ctx, &container->regs->_reg, data); \ ++} ++ ++# endif /* DWC_DEBUG_REGS */ ++ ++#endif /* DWC_FREEBSD || DWC_NETBSD */ ++ ++/** @endcond */ ++ ++ ++#ifdef DWC_CRYPTOLIB ++/** @name Crypto Functions ++ * ++ * These are the low-level cryptographic functions used by the driver. */ ++ ++/** Perform AES CBC */ ++extern int DWC_AES_CBC(uint8_t *message, uint32_t messagelen, uint8_t *key, uint32_t keylen, uint8_t iv[16], uint8_t *out); ++#define dwc_aes_cbc DWC_AES_CBC ++ ++/** Fill the provided buffer with random bytes. These should be cryptographic grade random numbers. */ ++extern void DWC_RANDOM_BYTES(uint8_t *buffer, uint32_t length); ++#define dwc_random_bytes DWC_RANDOM_BYTES ++ ++/** Perform the SHA-256 hash function */ ++extern int DWC_SHA256(uint8_t *message, uint32_t len, uint8_t *out); ++#define dwc_sha256 DWC_SHA256 ++ ++/** Calculated the HMAC-SHA256 */ ++extern int DWC_HMAC_SHA256(uint8_t *message, uint32_t messagelen, uint8_t *key, uint32_t keylen, uint8_t *out); ++#define dwc_hmac_sha256 DWC_HMAC_SHA256 ++ ++#endif /* DWC_CRYPTOLIB */ ++ ++ ++/** @name Memory Allocation ++ * ++ * These function provide access to memory allocation. There are only 2 DMA ++ * functions and 3 Regular memory functions that need to be implemented. None ++ * of the memory debugging routines need to be implemented. The allocation ++ * routines all ZERO the contents of the memory. ++ * ++ * Defining DWC_DEBUG_MEMORY turns on memory debugging and statistic gathering. ++ * This checks for memory leaks, keeping track of alloc/free pairs. It also ++ * keeps track of how much memory the driver is using at any given time. */ ++ ++#define DWC_PAGE_SIZE 4096 ++#define DWC_PAGE_OFFSET(addr) (((uint32_t)addr) & 0xfff) ++#define DWC_PAGE_ALIGNED(addr) ((((uint32_t)addr) & 0xfff) == 0) ++ ++#define DWC_INVALID_DMA_ADDR 0x0 ++ ++#ifdef DWC_LINUX ++/** Type for a DMA address */ ++typedef dma_addr_t dwc_dma_t; ++#endif ++ ++#if defined(DWC_FREEBSD) || defined(DWC_NETBSD) ++typedef bus_addr_t dwc_dma_t; ++#endif ++ ++#ifdef DWC_FREEBSD ++typedef struct dwc_dmactx { ++ struct device *dev; ++ bus_dma_tag_t dma_tag; ++ bus_dmamap_t dma_map; ++ bus_addr_t dma_paddr; ++ void *dma_vaddr; ++} dwc_dmactx_t; ++#endif ++ ++#ifdef DWC_NETBSD ++typedef struct dwc_dmactx { ++ struct device *dev; ++ bus_dma_tag_t dma_tag; ++ bus_dmamap_t dma_map; ++ bus_dma_segment_t segs[1]; ++ int nsegs; ++ bus_addr_t dma_paddr; ++ void *dma_vaddr; ++} dwc_dmactx_t; ++#endif ++ ++/* @todo these functions will be added in the future */ ++#if 0 ++/** ++ * Creates a DMA pool from which you can allocate DMA buffers. Buffers ++ * allocated from this pool will be guaranteed to meet the size, alignment, and ++ * boundary requirements specified. ++ * ++ * @param[in] size Specifies the size of the buffers that will be allocated from ++ * this pool. ++ * @param[in] align Specifies the byte alignment requirements of the buffers ++ * allocated from this pool. Must be a power of 2. ++ * @param[in] boundary Specifies the N-byte boundary that buffers allocated from ++ * this pool must not cross. ++ * ++ * @returns A pointer to an internal opaque structure which is not to be ++ * accessed outside of these library functions. Use this handle to specify ++ * which pools to allocate/free DMA buffers from and also to destroy the pool, ++ * when you are done with it. ++ */ ++extern dwc_pool_t *DWC_DMA_POOL_CREATE(uint32_t size, uint32_t align, uint32_t boundary); ++ ++/** ++ * Destroy a DMA pool. All buffers allocated from that pool must be freed first. ++ */ ++extern void DWC_DMA_POOL_DESTROY(dwc_pool_t *pool); ++ ++/** ++ * Allocate a buffer from the specified DMA pool and zeros its contents. ++ */ ++extern void *DWC_DMA_POOL_ALLOC(dwc_pool_t *pool, uint64_t *dma_addr); ++ ++/** ++ * Free a previously allocated buffer from the DMA pool. ++ */ ++extern void DWC_DMA_POOL_FREE(dwc_pool_t *pool, void *vaddr, void *daddr); ++#endif ++ ++/** Allocates a DMA capable buffer and zeroes its contents. */ ++extern void *__DWC_DMA_ALLOC(void *dma_ctx, uint32_t size, dwc_dma_t *dma_addr); ++ ++/** Allocates a DMA capable buffer and zeroes its contents in atomic contest */ ++extern void *__DWC_DMA_ALLOC_ATOMIC(void *dma_ctx, uint32_t size, dwc_dma_t *dma_addr); ++ ++/** Frees a previously allocated buffer. */ ++extern void __DWC_DMA_FREE(void *dma_ctx, uint32_t size, void *virt_addr, dwc_dma_t dma_addr); ++ ++/** Allocates a block of memory and zeroes its contents. */ ++extern void *__DWC_ALLOC(void *mem_ctx, uint32_t size); ++ ++/** Allocates a block of memory and zeroes its contents, in an atomic manner ++ * which can be used inside interrupt context. The size should be sufficiently ++ * small, a few KB at most, such that failures are not likely to occur. Can just call ++ * __DWC_ALLOC if it is atomic. */ ++extern void *__DWC_ALLOC_ATOMIC(void *mem_ctx, uint32_t size); ++ ++/** Frees a previously allocated buffer. */ ++extern void __DWC_FREE(void *mem_ctx, void *addr); ++ ++#ifndef DWC_DEBUG_MEMORY ++ ++#define DWC_ALLOC(_size_) __DWC_ALLOC(NULL, _size_) ++#define DWC_ALLOC_ATOMIC(_size_) __DWC_ALLOC_ATOMIC(NULL, _size_) ++#define DWC_FREE(_addr_) __DWC_FREE(NULL, _addr_) ++ ++# ifdef DWC_LINUX ++#define DWC_DMA_ALLOC(_size_,_dma_) __DWC_DMA_ALLOC(NULL, _size_, _dma_) ++#define DWC_DMA_ALLOC_ATOMIC(_size_,_dma_) __DWC_DMA_ALLOC_ATOMIC(NULL, _size_,_dma_) ++#define DWC_DMA_FREE(_size_,_virt_,_dma_) __DWC_DMA_FREE(NULL, _size_, _virt_, _dma_) ++# endif ++ ++# if defined(DWC_FREEBSD) || defined(DWC_NETBSD) ++#define DWC_DMA_ALLOC __DWC_DMA_ALLOC ++#define DWC_DMA_FREE __DWC_DMA_FREE ++# endif ++extern void *dwc_dma_alloc_atomic_debug(uint32_t size, dwc_dma_t *dma_addr, char const *func, int line); ++ ++#else /* DWC_DEBUG_MEMORY */ ++ ++extern void *dwc_alloc_debug(void *mem_ctx, uint32_t size, char const *func, int line); ++extern void *dwc_alloc_atomic_debug(void *mem_ctx, uint32_t size, char const *func, int line); ++extern void dwc_free_debug(void *mem_ctx, void *addr, char const *func, int line); ++extern void *dwc_dma_alloc_debug(void *dma_ctx, uint32_t size, dwc_dma_t *dma_addr, ++ char const *func, int line); ++extern void *dwc_dma_alloc_atomic_debug(void *dma_ctx, uint32_t size, dwc_dma_t *dma_addr, ++ char const *func, int line); ++extern void dwc_dma_free_debug(void *dma_ctx, uint32_t size, void *virt_addr, ++ dwc_dma_t dma_addr, char const *func, int line); ++ ++extern int dwc_memory_debug_start(void *mem_ctx); ++extern void dwc_memory_debug_stop(void); ++extern void dwc_memory_debug_report(void); ++ ++#define DWC_ALLOC(_size_) dwc_alloc_debug(NULL, _size_, __func__, __LINE__) ++#define DWC_ALLOC_ATOMIC(_size_) dwc_alloc_atomic_debug(NULL, _size_, \ ++ __func__, __LINE__) ++#define DWC_FREE(_addr_) dwc_free_debug(NULL, _addr_, __func__, __LINE__) ++ ++# ifdef DWC_LINUX ++#define DWC_DMA_ALLOC(_size_,_dma_) dwc_dma_alloc_debug(NULL, _size_, \ ++ _dma_, __func__, __LINE__) ++#define DWC_DMA_ALLOC_ATOMIC(_size_,_dma_) dwc_dma_alloc_atomic_debug(NULL, _size_, \ ++ _dma_, __func__, __LINE__) ++#define DWC_DMA_FREE(_size_,_virt_,_dma_) dwc_dma_free_debug(NULL, _size_, \ ++ _virt_, _dma_, __func__, __LINE__) ++# endif ++ ++# if defined(DWC_FREEBSD) || defined(DWC_NETBSD) ++#define DWC_DMA_ALLOC(_ctx_,_size_,_dma_) dwc_dma_alloc_debug(_ctx_, _size_, \ ++ _dma_, __func__, __LINE__) ++#define DWC_DMA_FREE(_ctx_,_size_,_virt_,_dma_) dwc_dma_free_debug(_ctx_, _size_, \ ++ _virt_, _dma_, __func__, __LINE__) ++# endif ++ ++#endif /* DWC_DEBUG_MEMORY */ ++ ++#define dwc_alloc(_ctx_,_size_) DWC_ALLOC(_size_) ++#define dwc_alloc_atomic(_ctx_,_size_) DWC_ALLOC_ATOMIC(_size_) ++#define dwc_free(_ctx_,_addr_) DWC_FREE(_addr_) ++ ++#ifdef DWC_LINUX ++/* Linux doesn't need any extra parameters for DMA buffer allocation, so we ++ * just throw away the DMA context parameter. ++ */ ++#define dwc_dma_alloc(_ctx_,_size_,_dma_) DWC_DMA_ALLOC(_size_, _dma_) ++#define dwc_dma_alloc_atomic(_ctx_,_size_,_dma_) DWC_DMA_ALLOC_ATOMIC(_size_, _dma_) ++#define dwc_dma_free(_ctx_,_size_,_virt_,_dma_) DWC_DMA_FREE(_size_, _virt_, _dma_) ++#endif ++ ++#if defined(DWC_FREEBSD) || defined(DWC_NETBSD) ++/** BSD needs several extra parameters for DMA buffer allocation, so we pass ++ * them in using the DMA context parameter. ++ */ ++#define dwc_dma_alloc DWC_DMA_ALLOC ++#define dwc_dma_free DWC_DMA_FREE ++#endif ++ ++ ++/** @name Memory and String Processing */ ++ ++/** memset() clone */ ++extern void *DWC_MEMSET(void *dest, uint8_t byte, uint32_t size); ++#define dwc_memset DWC_MEMSET ++ ++/** memcpy() clone */ ++extern void *DWC_MEMCPY(void *dest, void const *src, uint32_t size); ++#define dwc_memcpy DWC_MEMCPY ++ ++/** memmove() clone */ ++extern void *DWC_MEMMOVE(void *dest, void *src, uint32_t size); ++#define dwc_memmove DWC_MEMMOVE ++ ++/** memcmp() clone */ ++extern int DWC_MEMCMP(void *m1, void *m2, uint32_t size); ++#define dwc_memcmp DWC_MEMCMP ++ ++/** strcmp() clone */ ++extern int DWC_STRCMP(void *s1, void *s2); ++#define dwc_strcmp DWC_STRCMP ++ ++/** strncmp() clone */ ++extern int DWC_STRNCMP(void *s1, void *s2, uint32_t size); ++#define dwc_strncmp DWC_STRNCMP ++ ++/** strlen() clone, for NULL terminated ASCII strings */ ++extern int DWC_STRLEN(char const *str); ++#define dwc_strlen DWC_STRLEN ++ ++/** strcpy() clone, for NULL terminated ASCII strings */ ++extern char *DWC_STRCPY(char *to, const char *from); ++#define dwc_strcpy DWC_STRCPY ++ ++/** strdup() clone. If you wish to use memory allocation debugging, this ++ * implementation of strdup should use the DWC_* memory routines instead of ++ * calling a predefined strdup. Otherwise the memory allocated by this routine ++ * will not be seen by the debugging routines. */ ++extern char *DWC_STRDUP(char const *str); ++#define dwc_strdup(_ctx_,_str_) DWC_STRDUP(_str_) ++ ++/** NOT an atoi() clone. Read the description carefully. Returns an integer ++ * converted from the string str in base 10 unless the string begins with a "0x" ++ * in which case it is base 16. String must be a NULL terminated sequence of ++ * ASCII characters and may optionally begin with whitespace, a + or -, and a ++ * "0x" prefix if base 16. The remaining characters must be valid digits for ++ * the number and end with a NULL character. If any invalid characters are ++ * encountered or it returns with a negative error code and the results of the ++ * conversion are undefined. On sucess it returns 0. Overflow conditions are ++ * undefined. An example implementation using atoi() can be referenced from the ++ * Linux implementation. */ ++extern int DWC_ATOI(const char *str, int32_t *value); ++#define dwc_atoi DWC_ATOI ++ ++/** Same as above but for unsigned. */ ++extern int DWC_ATOUI(const char *str, uint32_t *value); ++#define dwc_atoui DWC_ATOUI ++ ++#ifdef DWC_UTFLIB ++/** This routine returns a UTF16LE unicode encoded string from a UTF8 string. */ ++extern int DWC_UTF8_TO_UTF16LE(uint8_t const *utf8string, uint16_t *utf16string, unsigned len); ++#define dwc_utf8_to_utf16le DWC_UTF8_TO_UTF16LE ++#endif ++ ++ ++/** @name Wait queues ++ * ++ * Wait queues provide a means of synchronizing between threads or processes. A ++ * process can block on a waitq if some condition is not true, waiting for it to ++ * become true. When the waitq is triggered all waiting process will get ++ * unblocked and the condition will be check again. Waitqs should be triggered ++ * every time a condition can potentially change.*/ ++struct dwc_waitq; ++ ++/** Type for a waitq */ ++typedef struct dwc_waitq dwc_waitq_t; ++ ++/** The type of waitq condition callback function. This is called every time ++ * condition is evaluated. */ ++typedef int (*dwc_waitq_condition_t)(void *data); ++ ++/** Allocate a waitq */ ++extern dwc_waitq_t *DWC_WAITQ_ALLOC(void); ++#define dwc_waitq_alloc(_ctx_) DWC_WAITQ_ALLOC() ++ ++/** Free a waitq */ ++extern void DWC_WAITQ_FREE(dwc_waitq_t *wq); ++#define dwc_waitq_free DWC_WAITQ_FREE ++ ++/** Check the condition and if it is false, block on the waitq. When unblocked, check the ++ * condition again. The function returns when the condition becomes true. The return value ++ * is 0 on condition true, DWC_WAITQ_ABORTED on abort or killed, or DWC_WAITQ_UNKNOWN on error. */ ++extern int32_t DWC_WAITQ_WAIT(dwc_waitq_t *wq, dwc_waitq_condition_t cond, void *data); ++#define dwc_waitq_wait DWC_WAITQ_WAIT ++ ++/** Check the condition and if it is false, block on the waitq. When unblocked, ++ * check the condition again. The function returns when the condition become ++ * true or the timeout has passed. The return value is 0 on condition true or ++ * DWC_TIMED_OUT on timeout, or DWC_WAITQ_ABORTED, or DWC_WAITQ_UNKNOWN on ++ * error. */ ++extern int32_t DWC_WAITQ_WAIT_TIMEOUT(dwc_waitq_t *wq, dwc_waitq_condition_t cond, ++ void *data, int32_t msecs); ++#define dwc_waitq_wait_timeout DWC_WAITQ_WAIT_TIMEOUT ++ ++/** Trigger a waitq, unblocking all processes. This should be called whenever a condition ++ * has potentially changed. */ ++extern void DWC_WAITQ_TRIGGER(dwc_waitq_t *wq); ++#define dwc_waitq_trigger DWC_WAITQ_TRIGGER ++ ++/** Unblock all processes waiting on the waitq with an ABORTED result. */ ++extern void DWC_WAITQ_ABORT(dwc_waitq_t *wq); ++#define dwc_waitq_abort DWC_WAITQ_ABORT ++ ++ ++/** @name Threads ++ * ++ * A thread must be explicitly stopped. It must check DWC_THREAD_SHOULD_STOP ++ * whenever it is woken up, and then return. The DWC_THREAD_STOP function ++ * returns the value from the thread. ++ */ ++ ++struct dwc_thread; ++ ++/** Type for a thread */ ++typedef struct dwc_thread dwc_thread_t; ++ ++/** The thread function */ ++typedef int (*dwc_thread_function_t)(void *data); ++ ++/** Create a thread and start it running the thread_function. Returns a handle ++ * to the thread */ ++extern dwc_thread_t *DWC_THREAD_RUN(dwc_thread_function_t func, char *name, void *data); ++#define dwc_thread_run(_ctx_,_func_,_name_,_data_) DWC_THREAD_RUN(_func_, _name_, _data_) ++ ++/** Stops a thread. Return the value returned by the thread. Or will return ++ * DWC_ABORT if the thread never started. */ ++extern int DWC_THREAD_STOP(dwc_thread_t *thread); ++#define dwc_thread_stop DWC_THREAD_STOP ++ ++/** Signifies to the thread that it must stop. */ ++#ifdef DWC_LINUX ++/* Linux doesn't need any parameters for kthread_should_stop() */ ++extern dwc_bool_t DWC_THREAD_SHOULD_STOP(void); ++#define dwc_thread_should_stop(_thrd_) DWC_THREAD_SHOULD_STOP() ++ ++/* No thread_exit function in Linux */ ++#define dwc_thread_exit(_thrd_) ++#endif ++ ++#if defined(DWC_FREEBSD) || defined(DWC_NETBSD) ++/** BSD needs the thread pointer for kthread_suspend_check() */ ++extern dwc_bool_t DWC_THREAD_SHOULD_STOP(dwc_thread_t *thread); ++#define dwc_thread_should_stop DWC_THREAD_SHOULD_STOP ++ ++/** The thread must call this to exit. */ ++extern void DWC_THREAD_EXIT(dwc_thread_t *thread); ++#define dwc_thread_exit DWC_THREAD_EXIT ++#endif ++ ++ ++/** @name Work queues ++ * ++ * Workqs are used to queue a callback function to be called at some later time, ++ * in another thread. */ ++struct dwc_workq; ++ ++/** Type for a workq */ ++typedef struct dwc_workq dwc_workq_t; ++ ++/** The type of the callback function to be called. */ ++typedef void (*dwc_work_callback_t)(void *data); ++ ++/** Allocate a workq */ ++extern dwc_workq_t *DWC_WORKQ_ALLOC(char *name); ++#define dwc_workq_alloc(_ctx_,_name_) DWC_WORKQ_ALLOC(_name_) ++ ++/** Free a workq. All work must be completed before being freed. */ ++extern void DWC_WORKQ_FREE(dwc_workq_t *workq); ++#define dwc_workq_free DWC_WORKQ_FREE ++ ++/** Schedule a callback on the workq, passing in data. The function will be ++ * scheduled at some later time. */ ++extern void DWC_WORKQ_SCHEDULE(dwc_workq_t *workq, dwc_work_callback_t cb, ++ void *data, char *format, ...) ++#ifdef __GNUC__ ++ __attribute__ ((format(printf, 4, 5))); ++#else ++ ; ++#endif ++#define dwc_workq_schedule DWC_WORKQ_SCHEDULE ++ ++/** Schedule a callback on the workq, that will be called until at least ++ * given number miliseconds have passed. */ ++extern void DWC_WORKQ_SCHEDULE_DELAYED(dwc_workq_t *workq, dwc_work_callback_t cb, ++ void *data, uint32_t time, char *format, ...) ++#ifdef __GNUC__ ++ __attribute__ ((format(printf, 5, 6))); ++#else ++ ; ++#endif ++#define dwc_workq_schedule_delayed DWC_WORKQ_SCHEDULE_DELAYED ++ ++/** The number of processes in the workq */ ++extern int DWC_WORKQ_PENDING(dwc_workq_t *workq); ++#define dwc_workq_pending DWC_WORKQ_PENDING ++ ++/** Blocks until all the work in the workq is complete or timed out. Returns < ++ * 0 on timeout. */ ++extern int DWC_WORKQ_WAIT_WORK_DONE(dwc_workq_t *workq, int timeout); ++#define dwc_workq_wait_work_done DWC_WORKQ_WAIT_WORK_DONE ++ ++ ++/** @name Tasklets ++ * ++ */ ++struct dwc_tasklet; ++ ++/** Type for a tasklet */ ++typedef struct dwc_tasklet dwc_tasklet_t; ++ ++/** The type of the callback function to be called */ ++typedef void (*dwc_tasklet_callback_t)(void *data); ++ ++/** Allocates a tasklet */ ++extern dwc_tasklet_t *DWC_TASK_ALLOC(char *name, dwc_tasklet_callback_t cb, void *data); ++#define dwc_task_alloc(_ctx_,_name_,_cb_,_data_) DWC_TASK_ALLOC(_name_, _cb_, _data_) ++ ++/** Frees a tasklet */ ++extern void DWC_TASK_FREE(dwc_tasklet_t *task); ++#define dwc_task_free DWC_TASK_FREE ++ ++/** Schedules a tasklet to run */ ++extern void DWC_TASK_SCHEDULE(dwc_tasklet_t *task); ++#define dwc_task_schedule DWC_TASK_SCHEDULE ++ ++extern void DWC_TASK_HI_SCHEDULE(dwc_tasklet_t *task); ++#define dwc_task_hi_schedule DWC_TASK_HI_SCHEDULE ++ ++/** @name Timer ++ * ++ * Callbacks must be small and atomic. ++ */ ++struct dwc_timer; ++ ++/** Type for a timer */ ++typedef struct dwc_timer dwc_timer_t; ++ ++/** The type of the callback function to be called */ ++typedef void (*dwc_timer_callback_t)(void *data); ++ ++/** Allocates a timer */ ++extern dwc_timer_t *DWC_TIMER_ALLOC(char *name, dwc_timer_callback_t cb, void *data); ++#define dwc_timer_alloc(_ctx_,_name_,_cb_,_data_) DWC_TIMER_ALLOC(_name_,_cb_,_data_) ++ ++/** Frees a timer */ ++extern void DWC_TIMER_FREE(dwc_timer_t *timer); ++#define dwc_timer_free DWC_TIMER_FREE ++ ++/** Schedules the timer to run at time ms from now. And will repeat at every ++ * repeat_interval msec therafter ++ * ++ * Modifies a timer that is still awaiting execution to a new expiration time. ++ * The mod_time is added to the old time. */ ++extern void DWC_TIMER_SCHEDULE(dwc_timer_t *timer, uint32_t time); ++#define dwc_timer_schedule DWC_TIMER_SCHEDULE ++ ++/** Disables the timer from execution. */ ++extern void DWC_TIMER_CANCEL(dwc_timer_t *timer); ++#define dwc_timer_cancel DWC_TIMER_CANCEL ++ ++ ++/** @name Spinlocks ++ * ++ * These locks are used when the work between the lock/unlock is atomic and ++ * short. Interrupts are also disabled during the lock/unlock and thus they are ++ * suitable to lock between interrupt/non-interrupt context. They also lock ++ * between processes if you have multiple CPUs or Preemption. If you don't have ++ * multiple CPUS or Preemption, then the you can simply implement the ++ * DWC_SPINLOCK and DWC_SPINUNLOCK to disable and enable interrupts. Because ++ * the work between the lock/unlock is atomic, the process context will never ++ * change, and so you never have to lock between processes. */ ++ ++struct dwc_spinlock; ++ ++/** Type for a spinlock */ ++typedef struct dwc_spinlock dwc_spinlock_t; ++ ++/** Type for the 'flags' argument to spinlock funtions */ ++typedef unsigned long dwc_irqflags_t; ++ ++/** Returns an initialized lock variable. This function should allocate and ++ * initialize the OS-specific data structure used for locking. This data ++ * structure is to be used for the DWC_LOCK and DWC_UNLOCK functions and should ++ * be freed by the DWC_FREE_LOCK when it is no longer used. ++ * ++ * For Linux Spinlock Debugging make it macro because the debugging routines use ++ * the symbol name to determine recursive locking. Using a wrapper function ++ * makes it falsely think recursive locking occurs. */ ++#if defined(DWC_LINUX) && defined(CONFIG_DEBUG_SPINLOCK) ++#define DWC_SPINLOCK_ALLOC_LINUX_DEBUG(lock) ({ \ ++ lock = DWC_ALLOC(sizeof(spinlock_t)); \ ++ if (lock) { \ ++ spin_lock_init((spinlock_t *)lock); \ ++ } \ ++}) ++#else ++extern dwc_spinlock_t *DWC_SPINLOCK_ALLOC(void); ++#define dwc_spinlock_alloc(_ctx_) DWC_SPINLOCK_ALLOC() ++#endif ++ ++/** Frees an initialized lock variable. */ ++extern void DWC_SPINLOCK_FREE(dwc_spinlock_t *lock); ++#define dwc_spinlock_free(_ctx_,_lock_) DWC_SPINLOCK_FREE(_lock_) ++ ++/** Disables interrupts and blocks until it acquires the lock. ++ * ++ * @param lock Pointer to the spinlock. ++ * @param flags Unsigned long for irq flags storage. ++ */ ++extern void DWC_SPINLOCK_IRQSAVE(dwc_spinlock_t *lock, dwc_irqflags_t *flags); ++#define dwc_spinlock_irqsave DWC_SPINLOCK_IRQSAVE ++ ++/** Re-enables the interrupt and releases the lock. ++ * ++ * @param lock Pointer to the spinlock. ++ * @param flags Unsigned long for irq flags storage. Must be the same as was ++ * passed into DWC_LOCK. ++ */ ++extern void DWC_SPINUNLOCK_IRQRESTORE(dwc_spinlock_t *lock, dwc_irqflags_t flags); ++#define dwc_spinunlock_irqrestore DWC_SPINUNLOCK_IRQRESTORE ++ ++/** Blocks until it acquires the lock. ++ * ++ * @param lock Pointer to the spinlock. ++ */ ++extern void DWC_SPINLOCK(dwc_spinlock_t *lock); ++#define dwc_spinlock DWC_SPINLOCK ++ ++/** Releases the lock. ++ * ++ * @param lock Pointer to the spinlock. ++ */ ++extern void DWC_SPINUNLOCK(dwc_spinlock_t *lock); ++#define dwc_spinunlock DWC_SPINUNLOCK ++ ++ ++/** @name Mutexes ++ * ++ * Unlike spinlocks Mutexes lock only between processes and the work between the ++ * lock/unlock CAN block, therefore it CANNOT be called from interrupt context. ++ */ ++ ++struct dwc_mutex; ++ ++/** Type for a mutex */ ++typedef struct dwc_mutex dwc_mutex_t; ++ ++/* For Linux Mutex Debugging make it inline because the debugging routines use ++ * the symbol to determine recursive locking. This makes it falsely think ++ * recursive locking occurs. */ ++#if defined(DWC_LINUX) && defined(CONFIG_DEBUG_MUTEXES) ++#define DWC_MUTEX_ALLOC_LINUX_DEBUG(__mutexp) ({ \ ++ __mutexp = (dwc_mutex_t *)DWC_ALLOC(sizeof(struct mutex)); \ ++ mutex_init((struct mutex *)__mutexp); \ ++}) ++#endif ++ ++/** Allocate a mutex */ ++extern dwc_mutex_t *DWC_MUTEX_ALLOC(void); ++#define dwc_mutex_alloc(_ctx_) DWC_MUTEX_ALLOC() ++ ++/* For memory leak debugging when using Linux Mutex Debugging */ ++#if defined(DWC_LINUX) && defined(CONFIG_DEBUG_MUTEXES) ++#define DWC_MUTEX_FREE(__mutexp) do { \ ++ mutex_destroy((struct mutex *)__mutexp); \ ++ DWC_FREE(__mutexp); \ ++} while(0) ++#else ++/** Free a mutex */ ++extern void DWC_MUTEX_FREE(dwc_mutex_t *mutex); ++#define dwc_mutex_free(_ctx_,_mutex_) DWC_MUTEX_FREE(_mutex_) ++#endif ++ ++/** Lock a mutex */ ++extern void DWC_MUTEX_LOCK(dwc_mutex_t *mutex); ++#define dwc_mutex_lock DWC_MUTEX_LOCK ++ ++/** Non-blocking lock returns 1 on successful lock. */ ++extern int DWC_MUTEX_TRYLOCK(dwc_mutex_t *mutex); ++#define dwc_mutex_trylock DWC_MUTEX_TRYLOCK ++ ++/** Unlock a mutex */ ++extern void DWC_MUTEX_UNLOCK(dwc_mutex_t *mutex); ++#define dwc_mutex_unlock DWC_MUTEX_UNLOCK ++ ++ ++/** @name Time */ ++ ++/** Microsecond delay. ++ * ++ * @param usecs Microseconds to delay. ++ */ ++extern void DWC_UDELAY(uint32_t usecs); ++#define dwc_udelay DWC_UDELAY ++ ++/** Millisecond delay. ++ * ++ * @param msecs Milliseconds to delay. ++ */ ++extern void DWC_MDELAY(uint32_t msecs); ++#define dwc_mdelay DWC_MDELAY ++ ++/** Non-busy waiting. ++ * Sleeps for specified number of milliseconds. ++ * ++ * @param msecs Milliseconds to sleep. ++ */ ++extern void DWC_MSLEEP(uint32_t msecs); ++#define dwc_msleep DWC_MSLEEP ++ ++/** ++ * Returns number of milliseconds since boot. ++ */ ++extern uint32_t DWC_TIME(void); ++#define dwc_time DWC_TIME ++ ++ ++ ++ ++/* @mainpage DWC Portability and Common Library ++ * ++ * This is the documentation for the DWC Portability and Common Library. ++ * ++ * @section intro Introduction ++ * ++ * The DWC Portability library consists of wrapper calls and data structures to ++ * all low-level functions which are typically provided by the OS. The WUDEV ++ * driver uses only these functions. In order to port the WUDEV driver, only ++ * the functions in this library need to be re-implemented, with the same ++ * behavior as documented here. ++ * ++ * The Common library consists of higher level functions, which rely only on ++ * calling the functions from the DWC Portability library. These common ++ * routines are shared across modules. Some of the common libraries need to be ++ * used directly by the driver programmer when porting WUDEV. Such as the ++ * parameter and notification libraries. ++ * ++ * @section low Portability Library OS Wrapper Functions ++ * ++ * Any function starting with DWC and in all CAPS is a low-level OS-wrapper that ++ * needs to be implemented when porting, for example DWC_MUTEX_ALLOC(). All of ++ * these functions are included in the dwc_os.h file. ++ * ++ * There are many functions here covering a wide array of OS services. Please ++ * see dwc_os.h for details, and implementation notes for each function. ++ * ++ * @section common Common Library Functions ++ * ++ * Any function starting with dwc and in all lowercase is a common library ++ * routine. These functions have a portable implementation and do not need to ++ * be reimplemented when porting. The common routines can be used by any ++ * driver, and some must be used by the end user to control the drivers. For ++ * example, you must use the Parameter common library in order to set the ++ * parameters in the WUDEV module. ++ * ++ * The common libraries consist of the following: ++ * ++ * - Connection Contexts - Used internally and can be used by end-user. See dwc_cc.h ++ * - Parameters - Used internally and can be used by end-user. See dwc_params.h ++ * - Notifications - Used internally and can be used by end-user. See dwc_notifier.h ++ * - Lists - Used internally and can be used by end-user. See dwc_list.h ++ * - Memory Debugging - Used internally and can be used by end-user. See dwc_os.h ++ * - Modpow - Used internally only. See dwc_modpow.h ++ * - DH - Used internally only. See dwc_dh.h ++ * - Crypto - Used internally only. See dwc_crypto.h ++ * ++ * ++ * @section prereq Prerequistes For dwc_os.h ++ * @subsection types Data Types ++ * ++ * The dwc_os.h file assumes that several low-level data types are pre defined for the ++ * compilation environment. These data types are: ++ * ++ * - uint8_t - unsigned 8-bit data type ++ * - int8_t - signed 8-bit data type ++ * - uint16_t - unsigned 16-bit data type ++ * - int16_t - signed 16-bit data type ++ * - uint32_t - unsigned 32-bit data type ++ * - int32_t - signed 32-bit data type ++ * - uint64_t - unsigned 64-bit data type ++ * - int64_t - signed 64-bit data type ++ * ++ * Ensure that these are defined before using dwc_os.h. The easiest way to do ++ * that is to modify the top of the file to include the appropriate header. ++ * This is already done for the Linux environment. If the DWC_LINUX macro is ++ * defined, the correct header will be added. A standard header <stdint.h> is ++ * also used for environments where standard C headers are available. ++ * ++ * @subsection stdarg Variable Arguments ++ * ++ * Variable arguments are provided by a standard C header <stdarg.h>. it is ++ * available in Both the Linux and ANSI C enviornment. An equivalent must be ++ * provided in your enviornment in order to use dwc_os.h with the debug and ++ * tracing message functionality. ++ * ++ * @subsection thread Threading ++ * ++ * WUDEV Core must be run on an operating system that provides for multiple ++ * threads/processes. Threading can be implemented in many ways, even in ++ * embedded systems without an operating system. At the bare minimum, the ++ * system should be able to start any number of processes at any time to handle ++ * special work. It need not be a pre-emptive system. Process context can ++ * change upon a call to a blocking function. The hardware interrupt context ++ * that calls the module's ISR() function must be differentiable from process ++ * context, even if your processes are impemented via a hardware interrupt. ++ * Further locking mechanism between process must exist (or be implemented), and ++ * process context must have a way to disable interrupts for a period of time to ++ * lock them out. If all of this exists, the functions in dwc_os.h related to ++ * threading should be able to be implemented with the defined behavior. ++ * ++ */ ++ ++#ifdef __cplusplus ++} ++#endif ++ ++#endif /* _DWC_OS_H_ */ +diff --git a/drivers/usb/host/dwc_common_port/usb.h b/drivers/usb/host/dwc_common_port/usb.h +new file mode 100644 +index 0000000..27bda82 +--- /dev/null ++++ b/drivers/usb/host/dwc_common_port/usb.h +@@ -0,0 +1,946 @@ ++/* ++ * Copyright (c) 1998 The NetBSD Foundation, Inc. ++ * All rights reserved. ++ * ++ * This code is derived from software contributed to The NetBSD Foundation ++ * by Lennart Augustsson (lennart@augustsson.net) at ++ * Carlstedt Research & Technology. ++ * ++ * 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. ++ * 3. All advertising materials mentioning features or use of this software ++ * must display the following acknowledgement: ++ * This product includes software developed by the NetBSD ++ * Foundation, Inc. and its contributors. ++ * 4. Neither the name of The NetBSD Foundation nor the names of its ++ * contributors may be used to endorse or promote products derived ++ * from this software without specific prior written permission. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS ++ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED ++ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR ++ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS ++ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR ++ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF ++ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS ++ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN ++ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ++ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ++ * POSSIBILITY OF SUCH DAMAGE. ++ */ ++ ++/* Modified by Synopsys, Inc, 12/12/2007 */ ++ ++ ++#ifndef _USB_H_ ++#define _USB_H_ ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++/* ++ * The USB records contain some unaligned little-endian word ++ * components. The U[SG]ETW macros take care of both the alignment ++ * and endian problem and should always be used to access non-byte ++ * values. ++ */ ++typedef u_int8_t uByte; ++typedef u_int8_t uWord[2]; ++typedef u_int8_t uDWord[4]; ++ ++#define USETW2(w,h,l) ((w)[0] = (u_int8_t)(l), (w)[1] = (u_int8_t)(h)) ++#define UCONSTW(x) { (x) & 0xff, ((x) >> 8) & 0xff } ++#define UCONSTDW(x) { (x) & 0xff, ((x) >> 8) & 0xff, \ ++ ((x) >> 16) & 0xff, ((x) >> 24) & 0xff } ++ ++#if 1 ++#define UGETW(w) ((w)[0] | ((w)[1] << 8)) ++#define USETW(w,v) ((w)[0] = (u_int8_t)(v), (w)[1] = (u_int8_t)((v) >> 8)) ++#define UGETDW(w) ((w)[0] | ((w)[1] << 8) | ((w)[2] << 16) | ((w)[3] << 24)) ++#define USETDW(w,v) ((w)[0] = (u_int8_t)(v), \ ++ (w)[1] = (u_int8_t)((v) >> 8), \ ++ (w)[2] = (u_int8_t)((v) >> 16), \ ++ (w)[3] = (u_int8_t)((v) >> 24)) ++#else ++/* ++ * On little-endian machines that can handle unanliged accesses ++ * (e.g. i386) these macros can be replaced by the following. ++ */ ++#define UGETW(w) (*(u_int16_t *)(w)) ++#define USETW(w,v) (*(u_int16_t *)(w) = (v)) ++#define UGETDW(w) (*(u_int32_t *)(w)) ++#define USETDW(w,v) (*(u_int32_t *)(w) = (v)) ++#endif ++ ++/* ++ * Macros for accessing UAS IU fields, which are big-endian ++ */ ++#define IUSETW2(w,h,l) ((w)[0] = (u_int8_t)(h), (w)[1] = (u_int8_t)(l)) ++#define IUCONSTW(x) { ((x) >> 8) & 0xff, (x) & 0xff } ++#define IUCONSTDW(x) { ((x) >> 24) & 0xff, ((x) >> 16) & 0xff, \ ++ ((x) >> 8) & 0xff, (x) & 0xff } ++#define IUGETW(w) (((w)[0] << 8) | (w)[1]) ++#define IUSETW(w,v) ((w)[0] = (u_int8_t)((v) >> 8), (w)[1] = (u_int8_t)(v)) ++#define IUGETDW(w) (((w)[0] << 24) | ((w)[1] << 16) | ((w)[2] << 8) | (w)[3]) ++#define IUSETDW(w,v) ((w)[0] = (u_int8_t)((v) >> 24), \ ++ (w)[1] = (u_int8_t)((v) >> 16), \ ++ (w)[2] = (u_int8_t)((v) >> 8), \ ++ (w)[3] = (u_int8_t)(v)) ++ ++#define UPACKED __attribute__((__packed__)) ++ ++typedef struct { ++ uByte bmRequestType; ++ uByte bRequest; ++ uWord wValue; ++ uWord wIndex; ++ uWord wLength; ++} UPACKED usb_device_request_t; ++ ++#define UT_GET_DIR(a) ((a) & 0x80) ++#define UT_WRITE 0x00 ++#define UT_READ 0x80 ++ ++#define UT_GET_TYPE(a) ((a) & 0x60) ++#define UT_STANDARD 0x00 ++#define UT_CLASS 0x20 ++#define UT_VENDOR 0x40 ++ ++#define UT_GET_RECIPIENT(a) ((a) & 0x1f) ++#define UT_DEVICE 0x00 ++#define UT_INTERFACE 0x01 ++#define UT_ENDPOINT 0x02 ++#define UT_OTHER 0x03 ++ ++#define UT_READ_DEVICE (UT_READ | UT_STANDARD | UT_DEVICE) ++#define UT_READ_INTERFACE (UT_READ | UT_STANDARD | UT_INTERFACE) ++#define UT_READ_ENDPOINT (UT_READ | UT_STANDARD | UT_ENDPOINT) ++#define UT_WRITE_DEVICE (UT_WRITE | UT_STANDARD | UT_DEVICE) ++#define UT_WRITE_INTERFACE (UT_WRITE | UT_STANDARD | UT_INTERFACE) ++#define UT_WRITE_ENDPOINT (UT_WRITE | UT_STANDARD | UT_ENDPOINT) ++#define UT_READ_CLASS_DEVICE (UT_READ | UT_CLASS | UT_DEVICE) ++#define UT_READ_CLASS_INTERFACE (UT_READ | UT_CLASS | UT_INTERFACE) ++#define UT_READ_CLASS_OTHER (UT_READ | UT_CLASS | UT_OTHER) ++#define UT_READ_CLASS_ENDPOINT (UT_READ | UT_CLASS | UT_ENDPOINT) ++#define UT_WRITE_CLASS_DEVICE (UT_WRITE | UT_CLASS | UT_DEVICE) ++#define UT_WRITE_CLASS_INTERFACE (UT_WRITE | UT_CLASS | UT_INTERFACE) ++#define UT_WRITE_CLASS_OTHER (UT_WRITE | UT_CLASS | UT_OTHER) ++#define UT_WRITE_CLASS_ENDPOINT (UT_WRITE | UT_CLASS | UT_ENDPOINT) ++#define UT_READ_VENDOR_DEVICE (UT_READ | UT_VENDOR | UT_DEVICE) ++#define UT_READ_VENDOR_INTERFACE (UT_READ | UT_VENDOR | UT_INTERFACE) ++#define UT_READ_VENDOR_OTHER (UT_READ | UT_VENDOR | UT_OTHER) ++#define UT_READ_VENDOR_ENDPOINT (UT_READ | UT_VENDOR | UT_ENDPOINT) ++#define UT_WRITE_VENDOR_DEVICE (UT_WRITE | UT_VENDOR | UT_DEVICE) ++#define UT_WRITE_VENDOR_INTERFACE (UT_WRITE | UT_VENDOR | UT_INTERFACE) ++#define UT_WRITE_VENDOR_OTHER (UT_WRITE | UT_VENDOR | UT_OTHER) ++#define UT_WRITE_VENDOR_ENDPOINT (UT_WRITE | UT_VENDOR | UT_ENDPOINT) ++ ++/* Requests */ ++#define UR_GET_STATUS 0x00 ++#define USTAT_STANDARD_STATUS 0x00 ++#define WUSTAT_WUSB_FEATURE 0x01 ++#define WUSTAT_CHANNEL_INFO 0x02 ++#define WUSTAT_RECEIVED_DATA 0x03 ++#define WUSTAT_MAS_AVAILABILITY 0x04 ++#define WUSTAT_CURRENT_TRANSMIT_POWER 0x05 ++#define UR_CLEAR_FEATURE 0x01 ++#define UR_SET_FEATURE 0x03 ++#define UR_SET_AND_TEST_FEATURE 0x0c ++#define UR_SET_ADDRESS 0x05 ++#define UR_GET_DESCRIPTOR 0x06 ++#define UDESC_DEVICE 0x01 ++#define UDESC_CONFIG 0x02 ++#define UDESC_STRING 0x03 ++#define UDESC_INTERFACE 0x04 ++#define UDESC_ENDPOINT 0x05 ++#define UDESC_SS_USB_COMPANION 0x30 ++#define UDESC_DEVICE_QUALIFIER 0x06 ++#define UDESC_OTHER_SPEED_CONFIGURATION 0x07 ++#define UDESC_INTERFACE_POWER 0x08 ++#define UDESC_OTG 0x09 ++#define WUDESC_SECURITY 0x0c ++#define WUDESC_KEY 0x0d ++#define WUD_GET_KEY_INDEX(_wValue_) ((_wValue_) & 0xf) ++#define WUD_GET_KEY_TYPE(_wValue_) (((_wValue_) & 0x30) >> 4) ++#define WUD_KEY_TYPE_ASSOC 0x01 ++#define WUD_KEY_TYPE_GTK 0x02 ++#define WUD_GET_KEY_ORIGIN(_wValue_) (((_wValue_) & 0x40) >> 6) ++#define WUD_KEY_ORIGIN_HOST 0x00 ++#define WUD_KEY_ORIGIN_DEVICE 0x01 ++#define WUDESC_ENCRYPTION_TYPE 0x0e ++#define WUDESC_BOS 0x0f ++#define WUDESC_DEVICE_CAPABILITY 0x10 ++#define WUDESC_WIRELESS_ENDPOINT_COMPANION 0x11 ++#define UDESC_BOS 0x0f ++#define UDESC_DEVICE_CAPABILITY 0x10 ++#define UDESC_CS_DEVICE 0x21 /* class specific */ ++#define UDESC_CS_CONFIG 0x22 ++#define UDESC_CS_STRING 0x23 ++#define UDESC_CS_INTERFACE 0x24 ++#define UDESC_CS_ENDPOINT 0x25 ++#define UDESC_HUB 0x29 ++#define UR_SET_DESCRIPTOR 0x07 ++#define UR_GET_CONFIG 0x08 ++#define UR_SET_CONFIG 0x09 ++#define UR_GET_INTERFACE 0x0a ++#define UR_SET_INTERFACE 0x0b ++#define UR_SYNCH_FRAME 0x0c ++#define WUR_SET_ENCRYPTION 0x0d ++#define WUR_GET_ENCRYPTION 0x0e ++#define WUR_SET_HANDSHAKE 0x0f ++#define WUR_GET_HANDSHAKE 0x10 ++#define WUR_SET_CONNECTION 0x11 ++#define WUR_SET_SECURITY_DATA 0x12 ++#define WUR_GET_SECURITY_DATA 0x13 ++#define WUR_SET_WUSB_DATA 0x14 ++#define WUDATA_DRPIE_INFO 0x01 ++#define WUDATA_TRANSMIT_DATA 0x02 ++#define WUDATA_TRANSMIT_PARAMS 0x03 ++#define WUDATA_RECEIVE_PARAMS 0x04 ++#define WUDATA_TRANSMIT_POWER 0x05 ++#define WUR_LOOPBACK_DATA_WRITE 0x15 ++#define WUR_LOOPBACK_DATA_READ 0x16 ++#define WUR_SET_INTERFACE_DS 0x17 ++ ++/* Feature numbers */ ++#define UF_ENDPOINT_HALT 0 ++#define UF_DEVICE_REMOTE_WAKEUP 1 ++#define UF_TEST_MODE 2 ++#define UF_DEVICE_B_HNP_ENABLE 3 ++#define UF_DEVICE_A_HNP_SUPPORT 4 ++#define UF_DEVICE_A_ALT_HNP_SUPPORT 5 ++#define WUF_WUSB 3 ++#define WUF_TX_DRPIE 0x0 ++#define WUF_DEV_XMIT_PACKET 0x1 ++#define WUF_COUNT_PACKETS 0x2 ++#define WUF_CAPTURE_PACKETS 0x3 ++#define UF_FUNCTION_SUSPEND 0 ++#define UF_U1_ENABLE 48 ++#define UF_U2_ENABLE 49 ++#define UF_LTM_ENABLE 50 ++ ++/* Class requests from the USB 2.0 hub spec, table 11-15 */ ++#define UCR_CLEAR_HUB_FEATURE (0x2000 | UR_CLEAR_FEATURE) ++#define UCR_CLEAR_PORT_FEATURE (0x2300 | UR_CLEAR_FEATURE) ++#define UCR_GET_HUB_DESCRIPTOR (0xa000 | UR_GET_DESCRIPTOR) ++#define UCR_GET_HUB_STATUS (0xa000 | UR_GET_STATUS) ++#define UCR_GET_PORT_STATUS (0xa300 | UR_GET_STATUS) ++#define UCR_SET_HUB_FEATURE (0x2000 | UR_SET_FEATURE) ++#define UCR_SET_PORT_FEATURE (0x2300 | UR_SET_FEATURE) ++#define UCR_SET_AND_TEST_PORT_FEATURE (0xa300 | UR_SET_AND_TEST_FEATURE) ++ ++#ifdef _MSC_VER ++#include <pshpack1.h> ++#endif ++ ++typedef struct { ++ uByte bLength; ++ uByte bDescriptorType; ++ uByte bDescriptorSubtype; ++} UPACKED usb_descriptor_t; ++ ++typedef struct { ++ uByte bLength; ++ uByte bDescriptorType; ++} UPACKED usb_descriptor_header_t; ++ ++typedef struct { ++ uByte bLength; ++ uByte bDescriptorType; ++ uWord bcdUSB; ++#define UD_USB_2_0 0x0200 ++#define UD_IS_USB2(d) (UGETW((d)->bcdUSB) >= UD_USB_2_0) ++ uByte bDeviceClass; ++ uByte bDeviceSubClass; ++ uByte bDeviceProtocol; ++ uByte bMaxPacketSize; ++ /* The fields below are not part of the initial descriptor. */ ++ uWord idVendor; ++ uWord idProduct; ++ uWord bcdDevice; ++ uByte iManufacturer; ++ uByte iProduct; ++ uByte iSerialNumber; ++ uByte bNumConfigurations; ++} UPACKED usb_device_descriptor_t; ++#define USB_DEVICE_DESCRIPTOR_SIZE 18 ++ ++typedef struct { ++ uByte bLength; ++ uByte bDescriptorType; ++ uWord wTotalLength; ++ uByte bNumInterface; ++ uByte bConfigurationValue; ++ uByte iConfiguration; ++#define UC_ATT_ONE (1 << 7) /* must be set */ ++#define UC_ATT_SELFPOWER (1 << 6) /* self powered */ ++#define UC_ATT_WAKEUP (1 << 5) /* can wakeup */ ++#define UC_ATT_BATTERY (1 << 4) /* battery powered */ ++ uByte bmAttributes; ++#define UC_BUS_POWERED 0x80 ++#define UC_SELF_POWERED 0x40 ++#define UC_REMOTE_WAKEUP 0x20 ++ uByte bMaxPower; /* max current in 2 mA units */ ++#define UC_POWER_FACTOR 2 ++} UPACKED usb_config_descriptor_t; ++#define USB_CONFIG_DESCRIPTOR_SIZE 9 ++ ++typedef struct { ++ uByte bLength; ++ uByte bDescriptorType; ++ uByte bInterfaceNumber; ++ uByte bAlternateSetting; ++ uByte bNumEndpoints; ++ uByte bInterfaceClass; ++ uByte bInterfaceSubClass; ++ uByte bInterfaceProtocol; ++ uByte iInterface; ++} UPACKED usb_interface_descriptor_t; ++#define USB_INTERFACE_DESCRIPTOR_SIZE 9 ++ ++typedef struct { ++ uByte bLength; ++ uByte bDescriptorType; ++ uByte bEndpointAddress; ++#define UE_GET_DIR(a) ((a) & 0x80) ++#define UE_SET_DIR(a,d) ((a) | (((d)&1) << 7)) ++#define UE_DIR_IN 0x80 ++#define UE_DIR_OUT 0x00 ++#define UE_ADDR 0x0f ++#define UE_GET_ADDR(a) ((a) & UE_ADDR) ++ uByte bmAttributes; ++#define UE_XFERTYPE 0x03 ++#define UE_CONTROL 0x00 ++#define UE_ISOCHRONOUS 0x01 ++#define UE_BULK 0x02 ++#define UE_INTERRUPT 0x03 ++#define UE_GET_XFERTYPE(a) ((a) & UE_XFERTYPE) ++#define UE_ISO_TYPE 0x0c ++#define UE_ISO_ASYNC 0x04 ++#define UE_ISO_ADAPT 0x08 ++#define UE_ISO_SYNC 0x0c ++#define UE_GET_ISO_TYPE(a) ((a) & UE_ISO_TYPE) ++ uWord wMaxPacketSize; ++ uByte bInterval; ++} UPACKED usb_endpoint_descriptor_t; ++#define USB_ENDPOINT_DESCRIPTOR_SIZE 7 ++ ++typedef struct ss_endpoint_companion_descriptor { ++ uByte bLength; ++ uByte bDescriptorType; ++ uByte bMaxBurst; ++#define USSE_GET_MAX_STREAMS(a) ((a) & 0x1f) ++#define USSE_SET_MAX_STREAMS(a, b) ((a) | ((b) & 0x1f)) ++#define USSE_GET_MAX_PACKET_NUM(a) ((a) & 0x03) ++#define USSE_SET_MAX_PACKET_NUM(a, b) ((a) | ((b) & 0x03)) ++ uByte bmAttributes; ++ uWord wBytesPerInterval; ++} UPACKED ss_endpoint_companion_descriptor_t; ++#define USB_SS_ENDPOINT_COMPANION_DESCRIPTOR_SIZE 6 ++ ++typedef struct { ++ uByte bLength; ++ uByte bDescriptorType; ++ uWord bString[127]; ++} UPACKED usb_string_descriptor_t; ++#define USB_MAX_STRING_LEN 128 ++#define USB_LANGUAGE_TABLE 0 /* # of the string language id table */ ++ ++/* Hub specific request */ ++#define UR_GET_BUS_STATE 0x02 ++#define UR_CLEAR_TT_BUFFER 0x08 ++#define UR_RESET_TT 0x09 ++#define UR_GET_TT_STATE 0x0a ++#define UR_STOP_TT 0x0b ++ ++/* Hub features */ ++#define UHF_C_HUB_LOCAL_POWER 0 ++#define UHF_C_HUB_OVER_CURRENT 1 ++#define UHF_PORT_CONNECTION 0 ++#define UHF_PORT_ENABLE 1 ++#define UHF_PORT_SUSPEND 2 ++#define UHF_PORT_OVER_CURRENT 3 ++#define UHF_PORT_RESET 4 ++#define UHF_PORT_L1 5 ++#define UHF_PORT_POWER 8 ++#define UHF_PORT_LOW_SPEED 9 ++#define UHF_PORT_HIGH_SPEED 10 ++#define UHF_C_PORT_CONNECTION 16 ++#define UHF_C_PORT_ENABLE 17 ++#define UHF_C_PORT_SUSPEND 18 ++#define UHF_C_PORT_OVER_CURRENT 19 ++#define UHF_C_PORT_RESET 20 ++#define UHF_C_PORT_L1 23 ++#define UHF_PORT_TEST 21 ++#define UHF_PORT_INDICATOR 22 ++ ++typedef struct { ++ uByte bDescLength; ++ uByte bDescriptorType; ++ uByte bNbrPorts; ++ uWord wHubCharacteristics; ++#define UHD_PWR 0x0003 ++#define UHD_PWR_GANGED 0x0000 ++#define UHD_PWR_INDIVIDUAL 0x0001 ++#define UHD_PWR_NO_SWITCH 0x0002 ++#define UHD_COMPOUND 0x0004 ++#define UHD_OC 0x0018 ++#define UHD_OC_GLOBAL 0x0000 ++#define UHD_OC_INDIVIDUAL 0x0008 ++#define UHD_OC_NONE 0x0010 ++#define UHD_TT_THINK 0x0060 ++#define UHD_TT_THINK_8 0x0000 ++#define UHD_TT_THINK_16 0x0020 ++#define UHD_TT_THINK_24 0x0040 ++#define UHD_TT_THINK_32 0x0060 ++#define UHD_PORT_IND 0x0080 ++ uByte bPwrOn2PwrGood; /* delay in 2 ms units */ ++#define UHD_PWRON_FACTOR 2 ++ uByte bHubContrCurrent; ++ uByte DeviceRemovable[32]; /* max 255 ports */ ++#define UHD_NOT_REMOV(desc, i) \ ++ (((desc)->DeviceRemovable[(i)/8] >> ((i) % 8)) & 1) ++ /* deprecated */ uByte PortPowerCtrlMask[1]; ++} UPACKED usb_hub_descriptor_t; ++#define USB_HUB_DESCRIPTOR_SIZE 9 /* includes deprecated PortPowerCtrlMask */ ++ ++typedef struct { ++ uByte bLength; ++ uByte bDescriptorType; ++ uWord bcdUSB; ++ uByte bDeviceClass; ++ uByte bDeviceSubClass; ++ uByte bDeviceProtocol; ++ uByte bMaxPacketSize0; ++ uByte bNumConfigurations; ++ uByte bReserved; ++} UPACKED usb_device_qualifier_t; ++#define USB_DEVICE_QUALIFIER_SIZE 10 ++ ++typedef struct { ++ uByte bLength; ++ uByte bDescriptorType; ++ uByte bmAttributes; ++#define UOTG_SRP 0x01 ++#define UOTG_HNP 0x02 ++} UPACKED usb_otg_descriptor_t; ++ ++/* OTG feature selectors */ ++#define UOTG_B_HNP_ENABLE 3 ++#define UOTG_A_HNP_SUPPORT 4 ++#define UOTG_A_ALT_HNP_SUPPORT 5 ++ ++typedef struct { ++ uWord wStatus; ++/* Device status flags */ ++#define UDS_SELF_POWERED 0x0001 ++#define UDS_REMOTE_WAKEUP 0x0002 ++/* Endpoint status flags */ ++#define UES_HALT 0x0001 ++} UPACKED usb_status_t; ++ ++typedef struct { ++ uWord wHubStatus; ++#define UHS_LOCAL_POWER 0x0001 ++#define UHS_OVER_CURRENT 0x0002 ++ uWord wHubChange; ++} UPACKED usb_hub_status_t; ++ ++typedef struct { ++ uWord wPortStatus; ++#define UPS_CURRENT_CONNECT_STATUS 0x0001 ++#define UPS_PORT_ENABLED 0x0002 ++#define UPS_SUSPEND 0x0004 ++#define UPS_OVERCURRENT_INDICATOR 0x0008 ++#define UPS_RESET 0x0010 ++#define UPS_PORT_POWER 0x0100 ++#define UPS_LOW_SPEED 0x0200 ++#define UPS_HIGH_SPEED 0x0400 ++#define UPS_PORT_TEST 0x0800 ++#define UPS_PORT_INDICATOR 0x1000 ++ uWord wPortChange; ++#define UPS_C_CONNECT_STATUS 0x0001 ++#define UPS_C_PORT_ENABLED 0x0002 ++#define UPS_C_SUSPEND 0x0004 ++#define UPS_C_OVERCURRENT_INDICATOR 0x0008 ++#define UPS_C_PORT_RESET 0x0010 ++} UPACKED usb_port_status_t; ++ ++#ifdef _MSC_VER ++#include <poppack.h> ++#endif ++ ++/* Device class codes */ ++#define UDCLASS_IN_INTERFACE 0x00 ++#define UDCLASS_COMM 0x02 ++#define UDCLASS_HUB 0x09 ++#define UDSUBCLASS_HUB 0x00 ++#define UDPROTO_FSHUB 0x00 ++#define UDPROTO_HSHUBSTT 0x01 ++#define UDPROTO_HSHUBMTT 0x02 ++#define UDCLASS_DIAGNOSTIC 0xdc ++#define UDCLASS_WIRELESS 0xe0 ++#define UDSUBCLASS_RF 0x01 ++#define UDPROTO_BLUETOOTH 0x01 ++#define UDCLASS_VENDOR 0xff ++ ++/* Interface class codes */ ++#define UICLASS_UNSPEC 0x00 ++ ++#define UICLASS_AUDIO 0x01 ++#define UISUBCLASS_AUDIOCONTROL 1 ++#define UISUBCLASS_AUDIOSTREAM 2 ++#define UISUBCLASS_MIDISTREAM 3 ++ ++#define UICLASS_CDC 0x02 /* communication */ ++#define UISUBCLASS_DIRECT_LINE_CONTROL_MODEL 1 ++#define UISUBCLASS_ABSTRACT_CONTROL_MODEL 2 ++#define UISUBCLASS_TELEPHONE_CONTROL_MODEL 3 ++#define UISUBCLASS_MULTICHANNEL_CONTROL_MODEL 4 ++#define UISUBCLASS_CAPI_CONTROLMODEL 5 ++#define UISUBCLASS_ETHERNET_NETWORKING_CONTROL_MODEL 6 ++#define UISUBCLASS_ATM_NETWORKING_CONTROL_MODEL 7 ++#define UIPROTO_CDC_AT 1 ++ ++#define UICLASS_HID 0x03 ++#define UISUBCLASS_BOOT 1 ++#define UIPROTO_BOOT_KEYBOARD 1 ++ ++#define UICLASS_PHYSICAL 0x05 ++ ++#define UICLASS_IMAGE 0x06 ++ ++#define UICLASS_PRINTER 0x07 ++#define UISUBCLASS_PRINTER 1 ++#define UIPROTO_PRINTER_UNI 1 ++#define UIPROTO_PRINTER_BI 2 ++#define UIPROTO_PRINTER_1284 3 ++ ++#define UICLASS_MASS 0x08 ++#define UISUBCLASS_RBC 1 ++#define UISUBCLASS_SFF8020I 2 ++#define UISUBCLASS_QIC157 3 ++#define UISUBCLASS_UFI 4 ++#define UISUBCLASS_SFF8070I 5 ++#define UISUBCLASS_SCSI 6 ++#define UIPROTO_MASS_CBI_I 0 ++#define UIPROTO_MASS_CBI 1 ++#define UIPROTO_MASS_BBB_OLD 2 /* Not in the spec anymore */ ++#define UIPROTO_MASS_BBB 80 /* 'P' for the Iomega Zip drive */ ++ ++#define UICLASS_HUB 0x09 ++#define UISUBCLASS_HUB 0 ++#define UIPROTO_FSHUB 0 ++#define UIPROTO_HSHUBSTT 0 /* Yes, same as previous */ ++#define UIPROTO_HSHUBMTT 1 ++ ++#define UICLASS_CDC_DATA 0x0a ++#define UISUBCLASS_DATA 0 ++#define UIPROTO_DATA_ISDNBRI 0x30 /* Physical iface */ ++#define UIPROTO_DATA_HDLC 0x31 /* HDLC */ ++#define UIPROTO_DATA_TRANSPARENT 0x32 /* Transparent */ ++#define UIPROTO_DATA_Q921M 0x50 /* Management for Q921 */ ++#define UIPROTO_DATA_Q921 0x51 /* Data for Q921 */ ++#define UIPROTO_DATA_Q921TM 0x52 /* TEI multiplexer for Q921 */ ++#define UIPROTO_DATA_V42BIS 0x90 /* Data compression */ ++#define UIPROTO_DATA_Q931 0x91 /* Euro-ISDN */ ++#define UIPROTO_DATA_V120 0x92 /* V.24 rate adaption */ ++#define UIPROTO_DATA_CAPI 0x93 /* CAPI 2.0 commands */ ++#define UIPROTO_DATA_HOST_BASED 0xfd /* Host based driver */ ++#define UIPROTO_DATA_PUF 0xfe /* see Prot. Unit Func. Desc.*/ ++#define UIPROTO_DATA_VENDOR 0xff /* Vendor specific */ ++ ++#define UICLASS_SMARTCARD 0x0b ++ ++/*#define UICLASS_FIRM_UPD 0x0c*/ ++ ++#define UICLASS_SECURITY 0x0d ++ ++#define UICLASS_DIAGNOSTIC 0xdc ++ ++#define UICLASS_WIRELESS 0xe0 ++#define UISUBCLASS_RF 0x01 ++#define UIPROTO_BLUETOOTH 0x01 ++ ++#define UICLASS_APPL_SPEC 0xfe ++#define UISUBCLASS_FIRMWARE_DOWNLOAD 1 ++#define UISUBCLASS_IRDA 2 ++#define UIPROTO_IRDA 0 ++ ++#define UICLASS_VENDOR 0xff ++ ++#define USB_HUB_MAX_DEPTH 5 ++ ++/* ++ * Minimum time a device needs to be powered down to go through ++ * a power cycle. XXX Are these time in the spec? ++ */ ++#define USB_POWER_DOWN_TIME 200 /* ms */ ++#define USB_PORT_POWER_DOWN_TIME 100 /* ms */ ++ ++#if 0 ++/* These are the values from the spec. */ ++#define USB_PORT_RESET_DELAY 10 /* ms */ ++#define USB_PORT_ROOT_RESET_DELAY 50 /* ms */ ++#define USB_PORT_RESET_RECOVERY 10 /* ms */ ++#define USB_PORT_POWERUP_DELAY 100 /* ms */ ++#define USB_SET_ADDRESS_SETTLE 2 /* ms */ ++#define USB_RESUME_DELAY (20*5) /* ms */ ++#define USB_RESUME_WAIT 10 /* ms */ ++#define USB_RESUME_RECOVERY 10 /* ms */ ++#define USB_EXTRA_POWER_UP_TIME 0 /* ms */ ++#else ++/* Allow for marginal (i.e. non-conforming) devices. */ ++#define USB_PORT_RESET_DELAY 50 /* ms */ ++#define USB_PORT_ROOT_RESET_DELAY 250 /* ms */ ++#define USB_PORT_RESET_RECOVERY 250 /* ms */ ++#define USB_PORT_POWERUP_DELAY 300 /* ms */ ++#define USB_SET_ADDRESS_SETTLE 10 /* ms */ ++#define USB_RESUME_DELAY (50*5) /* ms */ ++#define USB_RESUME_WAIT 50 /* ms */ ++#define USB_RESUME_RECOVERY 50 /* ms */ ++#define USB_EXTRA_POWER_UP_TIME 20 /* ms */ ++#endif ++ ++#define USB_MIN_POWER 100 /* mA */ ++#define USB_MAX_POWER 500 /* mA */ ++ ++#define USB_BUS_RESET_DELAY 100 /* ms XXX?*/ ++ ++#define USB_UNCONFIG_NO 0 ++#define USB_UNCONFIG_INDEX (-1) ++ ++/*** ioctl() related stuff ***/ ++ ++struct usb_ctl_request { ++ int ucr_addr; ++ usb_device_request_t ucr_request; ++ void *ucr_data; ++ int ucr_flags; ++#define USBD_SHORT_XFER_OK 0x04 /* allow short reads */ ++ int ucr_actlen; /* actual length transferred */ ++}; ++ ++struct usb_alt_interface { ++ int uai_config_index; ++ int uai_interface_index; ++ int uai_alt_no; ++}; ++ ++#define USB_CURRENT_CONFIG_INDEX (-1) ++#define USB_CURRENT_ALT_INDEX (-1) ++ ++struct usb_config_desc { ++ int ucd_config_index; ++ usb_config_descriptor_t ucd_desc; ++}; ++ ++struct usb_interface_desc { ++ int uid_config_index; ++ int uid_interface_index; ++ int uid_alt_index; ++ usb_interface_descriptor_t uid_desc; ++}; ++ ++struct usb_endpoint_desc { ++ int ued_config_index; ++ int ued_interface_index; ++ int ued_alt_index; ++ int ued_endpoint_index; ++ usb_endpoint_descriptor_t ued_desc; ++}; ++ ++struct usb_full_desc { ++ int ufd_config_index; ++ u_int ufd_size; ++ u_char *ufd_data; ++}; ++ ++struct usb_string_desc { ++ int usd_string_index; ++ int usd_language_id; ++ usb_string_descriptor_t usd_desc; ++}; ++ ++struct usb_ctl_report_desc { ++ int ucrd_size; ++ u_char ucrd_data[1024]; /* filled data size will vary */ ++}; ++ ++typedef struct { u_int32_t cookie; } usb_event_cookie_t; ++ ++#define USB_MAX_DEVNAMES 4 ++#define USB_MAX_DEVNAMELEN 16 ++struct usb_device_info { ++ u_int8_t udi_bus; ++ u_int8_t udi_addr; /* device address */ ++ usb_event_cookie_t udi_cookie; ++ char udi_product[USB_MAX_STRING_LEN]; ++ char udi_vendor[USB_MAX_STRING_LEN]; ++ char udi_release[8]; ++ u_int16_t udi_productNo; ++ u_int16_t udi_vendorNo; ++ u_int16_t udi_releaseNo; ++ u_int8_t udi_class; ++ u_int8_t udi_subclass; ++ u_int8_t udi_protocol; ++ u_int8_t udi_config; ++ u_int8_t udi_speed; ++#define USB_SPEED_UNKNOWN 0 ++#define USB_SPEED_LOW 1 ++#define USB_SPEED_FULL 2 ++#define USB_SPEED_HIGH 3 ++#define USB_SPEED_VARIABLE 4 ++#define USB_SPEED_SUPER 5 ++ int udi_power; /* power consumption in mA, 0 if selfpowered */ ++ int udi_nports; ++ char udi_devnames[USB_MAX_DEVNAMES][USB_MAX_DEVNAMELEN]; ++ u_int8_t udi_ports[16];/* hub only: addresses of devices on ports */ ++#define USB_PORT_ENABLED 0xff ++#define USB_PORT_SUSPENDED 0xfe ++#define USB_PORT_POWERED 0xfd ++#define USB_PORT_DISABLED 0xfc ++}; ++ ++struct usb_ctl_report { ++ int ucr_report; ++ u_char ucr_data[1024]; /* filled data size will vary */ ++}; ++ ++struct usb_device_stats { ++ u_long uds_requests[4]; /* indexed by transfer type UE_* */ ++}; ++ ++#define WUSB_MIN_IE 0x80 ++#define WUSB_WCTA_IE 0x80 ++#define WUSB_WCONNECTACK_IE 0x81 ++#define WUSB_WHOSTINFO_IE 0x82 ++#define WUHI_GET_CA(_bmAttributes_) ((_bmAttributes_) & 0x3) ++#define WUHI_CA_RECONN 0x00 ++#define WUHI_CA_LIMITED 0x01 ++#define WUHI_CA_ALL 0x03 ++#define WUHI_GET_MLSI(_bmAttributes_) (((_bmAttributes_) & 0x38) >> 3) ++#define WUSB_WCHCHANGEANNOUNCE_IE 0x83 ++#define WUSB_WDEV_DISCONNECT_IE 0x84 ++#define WUSB_WHOST_DISCONNECT_IE 0x85 ++#define WUSB_WRELEASE_CHANNEL_IE 0x86 ++#define WUSB_WWORK_IE 0x87 ++#define WUSB_WCHANNEL_STOP_IE 0x88 ++#define WUSB_WDEV_KEEPALIVE_IE 0x89 ++#define WUSB_WISOCH_DISCARD_IE 0x8A ++#define WUSB_WRESETDEVICE_IE 0x8B ++#define WUSB_WXMIT_PACKET_ADJUST_IE 0x8C ++#define WUSB_MAX_IE 0x8C ++ ++/* Device Notification Types */ ++ ++#define WUSB_DN_MIN 0x01 ++#define WUSB_DN_CONNECT 0x01 ++# define WUSB_DA_OLDCONN 0x00 ++# define WUSB_DA_NEWCONN 0x01 ++# define WUSB_DA_SELF_BEACON 0x02 ++# define WUSB_DA_DIR_BEACON 0x04 ++# define WUSB_DA_NO_BEACON 0x06 ++#define WUSB_DN_DISCONNECT 0x02 ++#define WUSB_DN_EPRDY 0x03 ++#define WUSB_DN_MASAVAILCHANGED 0x04 ++#define WUSB_DN_REMOTEWAKEUP 0x05 ++#define WUSB_DN_SLEEP 0x06 ++#define WUSB_DN_ALIVE 0x07 ++#define WUSB_DN_MAX 0x07 ++ ++#ifdef _MSC_VER ++#include <pshpack1.h> ++#endif ++ ++/* WUSB Handshake Data. Used during the SET/GET HANDSHAKE requests */ ++typedef struct wusb_hndshk_data { ++ uByte bMessageNumber; ++ uByte bStatus; ++ uByte tTKID[3]; ++ uByte bReserved; ++ uByte CDID[16]; ++ uByte Nonce[16]; ++ uByte MIC[8]; ++} UPACKED wusb_hndshk_data_t; ++#define WUSB_HANDSHAKE_LEN_FOR_MIC 38 ++ ++/* WUSB Connection Context */ ++typedef struct wusb_conn_context { ++ uByte CHID [16]; ++ uByte CDID [16]; ++ uByte CK [16]; ++} UPACKED wusb_conn_context_t; ++ ++/* WUSB Security Descriptor */ ++typedef struct wusb_security_desc { ++ uByte bLength; ++ uByte bDescriptorType; ++ uWord wTotalLength; ++ uByte bNumEncryptionTypes; ++} UPACKED wusb_security_desc_t; ++ ++/* WUSB Encryption Type Descriptor */ ++typedef struct wusb_encrypt_type_desc { ++ uByte bLength; ++ uByte bDescriptorType; ++ ++ uByte bEncryptionType; ++#define WUETD_UNSECURE 0 ++#define WUETD_WIRED 1 ++#define WUETD_CCM_1 2 ++#define WUETD_RSA_1 3 ++ ++ uByte bEncryptionValue; ++ uByte bAuthKeyIndex; ++} UPACKED wusb_encrypt_type_desc_t; ++ ++/* WUSB Key Descriptor */ ++typedef struct wusb_key_desc { ++ uByte bLength; ++ uByte bDescriptorType; ++ uByte tTKID[3]; ++ uByte bReserved; ++ uByte KeyData[1]; /* variable length */ ++} UPACKED wusb_key_desc_t; ++ ++/* WUSB BOS Descriptor (Binary device Object Store) */ ++typedef struct wusb_bos_desc { ++ uByte bLength; ++ uByte bDescriptorType; ++ uWord wTotalLength; ++ uByte bNumDeviceCaps; ++} UPACKED wusb_bos_desc_t; ++ ++#define USB_DEVICE_CAPABILITY_20_EXTENSION 0x02 ++typedef struct usb_dev_cap_20_ext_desc { ++ uByte bLength; ++ uByte bDescriptorType; ++ uByte bDevCapabilityType; ++#define USB_20_EXT_LPM 0x02 ++ uDWord bmAttributes; ++} UPACKED usb_dev_cap_20_ext_desc_t; ++ ++#define USB_DEVICE_CAPABILITY_SS_USB 0x03 ++typedef struct usb_dev_cap_ss_usb { ++ uByte bLength; ++ uByte bDescriptorType; ++ uByte bDevCapabilityType; ++#define USB_DC_SS_USB_LTM_CAPABLE 0x02 ++ uByte bmAttributes; ++#define USB_DC_SS_USB_SPEED_SUPPORT_LOW 0x01 ++#define USB_DC_SS_USB_SPEED_SUPPORT_FULL 0x02 ++#define USB_DC_SS_USB_SPEED_SUPPORT_HIGH 0x04 ++#define USB_DC_SS_USB_SPEED_SUPPORT_SS 0x08 ++ uWord wSpeedsSupported; ++ uByte bFunctionalitySupport; ++ uByte bU1DevExitLat; ++ uWord wU2DevExitLat; ++} UPACKED usb_dev_cap_ss_usb_t; ++ ++#define USB_DEVICE_CAPABILITY_CONTAINER_ID 0x04 ++typedef struct usb_dev_cap_container_id { ++ uByte bLength; ++ uByte bDescriptorType; ++ uByte bDevCapabilityType; ++ uByte bReserved; ++ uByte containerID[16]; ++} UPACKED usb_dev_cap_container_id_t; ++ ++/* Device Capability Type Codes */ ++#define WUSB_DEVICE_CAPABILITY_WIRELESS_USB 0x01 ++ ++/* Device Capability Descriptor */ ++typedef struct wusb_dev_cap_desc { ++ uByte bLength; ++ uByte bDescriptorType; ++ uByte bDevCapabilityType; ++ uByte caps[1]; /* Variable length */ ++} UPACKED wusb_dev_cap_desc_t; ++ ++/* Device Capability Descriptor */ ++typedef struct wusb_dev_cap_uwb_desc { ++ uByte bLength; ++ uByte bDescriptorType; ++ uByte bDevCapabilityType; ++ uByte bmAttributes; ++ uWord wPHYRates; /* Bitmap */ ++ uByte bmTFITXPowerInfo; ++ uByte bmFFITXPowerInfo; ++ uWord bmBandGroup; ++ uByte bReserved; ++} UPACKED wusb_dev_cap_uwb_desc_t; ++ ++/* Wireless USB Endpoint Companion Descriptor */ ++typedef struct wusb_endpoint_companion_desc { ++ uByte bLength; ++ uByte bDescriptorType; ++ uByte bMaxBurst; ++ uByte bMaxSequence; ++ uWord wMaxStreamDelay; ++ uWord wOverTheAirPacketSize; ++ uByte bOverTheAirInterval; ++ uByte bmCompAttributes; ++} UPACKED wusb_endpoint_companion_desc_t; ++ ++/* Wireless USB Numeric Association M1 Data Structure */ ++typedef struct wusb_m1_data { ++ uByte version; ++ uWord langId; ++ uByte deviceFriendlyNameLength; ++ uByte sha_256_m3[32]; ++ uByte deviceFriendlyName[256]; ++} UPACKED wusb_m1_data_t; ++ ++typedef struct wusb_m2_data { ++ uByte version; ++ uWord langId; ++ uByte hostFriendlyNameLength; ++ uByte pkh[384]; ++ uByte hostFriendlyName[256]; ++} UPACKED wusb_m2_data_t; ++ ++typedef struct wusb_m3_data { ++ uByte pkd[384]; ++ uByte nd; ++} UPACKED wusb_m3_data_t; ++ ++typedef struct wusb_m4_data { ++ uDWord _attributeTypeIdAndLength_1; ++ uWord associationTypeId; ++ ++ uDWord _attributeTypeIdAndLength_2; ++ uWord associationSubTypeId; ++ ++ uDWord _attributeTypeIdAndLength_3; ++ uDWord length; ++ ++ uDWord _attributeTypeIdAndLength_4; ++ uDWord associationStatus; ++ ++ uDWord _attributeTypeIdAndLength_5; ++ uByte chid[16]; ++ ++ uDWord _attributeTypeIdAndLength_6; ++ uByte cdid[16]; ++ ++ uDWord _attributeTypeIdAndLength_7; ++ uByte bandGroups[2]; ++} UPACKED wusb_m4_data_t; ++ ++#ifdef _MSC_VER ++#include <poppack.h> ++#endif ++ ++#ifdef __cplusplus ++} ++#endif ++ ++#endif /* _USB_H_ */ +diff --git a/drivers/usb/host/dwc_otg/Makefile b/drivers/usb/host/dwc_otg/Makefile +new file mode 100644 +index 0000000..e7bdd12 +--- /dev/null ++++ b/drivers/usb/host/dwc_otg/Makefile +@@ -0,0 +1,82 @@ ++# ++# Makefile for DWC_otg Highspeed USB controller driver ++# ++ ++ifneq ($(KERNELRELEASE),) ++ ++# Use the BUS_INTERFACE variable to compile the software for either ++# PCI(PCI_INTERFACE) or LM(LM_INTERFACE) bus. ++ifeq ($(BUS_INTERFACE),) ++# BUS_INTERFACE = -DPCI_INTERFACE ++# BUS_INTERFACE = -DLM_INTERFACE ++ BUS_INTERFACE = -DPLATFORM_INTERFACE ++endif ++ ++#ccflags-y += -DDEBUG ++#ccflags-y += -DDWC_OTG_DEBUGLEV=1 # reduce common debug msgs ++ ++# Use one of the following flags to compile the software in host-only or ++# device-only mode. ++#ccflags-y += -DDWC_HOST_ONLY ++#ccflags-y += -DDWC_DEVICE_ONLY ++ ++ccflags-y += -Dlinux -DDWC_HS_ELECT_TST ++#ccflags-y += -DDWC_EN_ISOC ++ccflags-y += -I$(obj)/../dwc_common_port ++#ccflags-y += -I$(PORTLIB) ++ccflags-y += -DDWC_LINUX ++ccflags-y += $(CFI) ++ccflags-y += $(BUS_INTERFACE) ++#ccflags-y += -DDWC_DEV_SRPCAP ++ ++obj-$(CONFIG_USB_DWCOTG) += dwc_otg.o ++ ++dwc_otg-objs := dwc_otg_driver.o dwc_otg_attr.o ++dwc_otg-objs += dwc_otg_cil.o dwc_otg_cil_intr.o ++dwc_otg-objs += dwc_otg_pcd_linux.o dwc_otg_pcd.o dwc_otg_pcd_intr.o ++dwc_otg-objs += dwc_otg_hcd.o dwc_otg_hcd_linux.o dwc_otg_hcd_intr.o dwc_otg_hcd_queue.o dwc_otg_hcd_ddma.o ++dwc_otg-objs += dwc_otg_adp.o ++dwc_otg-objs += dwc_otg_fiq_fsm.o ++dwc_otg-objs += dwc_otg_fiq_stub.o ++ifneq ($(CFI),) ++dwc_otg-objs += dwc_otg_cfi.o ++endif ++ ++kernrelwd := $(subst ., ,$(KERNELRELEASE)) ++kernrel3 := $(word 1,$(kernrelwd)).$(word 2,$(kernrelwd)).$(word 3,$(kernrelwd)) ++ ++ifneq ($(kernrel3),2.6.20) ++ccflags-y += $(CPPFLAGS) ++endif ++ ++else ++ ++PWD := $(shell pwd) ++PORTLIB := $(PWD)/../dwc_common_port ++ ++# Command paths ++CTAGS := $(CTAGS) ++DOXYGEN := $(DOXYGEN) ++ ++default: portlib ++ $(MAKE) -C$(KDIR) M=$(PWD) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) modules ++ ++install: default ++ $(MAKE) -C$(KDIR) M=$(PORTLIB) modules_install ++ $(MAKE) -C$(KDIR) M=$(PWD) modules_install ++ ++portlib: ++ $(MAKE) -C$(KDIR) M=$(PORTLIB) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) modules ++ cp $(PORTLIB)/Module.symvers $(PWD)/ ++ ++docs: $(wildcard *.[hc]) doc/doxygen.cfg ++ $(DOXYGEN) doc/doxygen.cfg ++ ++tags: $(wildcard *.[hc]) ++ $(CTAGS) -e $(wildcard *.[hc]) $(wildcard linux/*.[hc]) $(wildcard $(KDIR)/include/linux/usb*.h) ++ ++ ++clean: ++ rm -rf *.o *.ko .*cmd *.mod.c .tmp_versions Module.symvers ++ ++endif +diff --git a/drivers/usb/host/dwc_otg/doc/doxygen.cfg b/drivers/usb/host/dwc_otg/doc/doxygen.cfg +new file mode 100644 +index 0000000..712b057 +--- /dev/null ++++ b/drivers/usb/host/dwc_otg/doc/doxygen.cfg +@@ -0,0 +1,224 @@ ++# Doxyfile 1.3.9.1 ++ ++#--------------------------------------------------------------------------- ++# Project related configuration options ++#--------------------------------------------------------------------------- ++PROJECT_NAME = "DesignWare USB 2.0 OTG Controller (DWC_otg) Device Driver" ++PROJECT_NUMBER = v3.00a ++OUTPUT_DIRECTORY = ./doc/ ++CREATE_SUBDIRS = NO ++OUTPUT_LANGUAGE = English ++BRIEF_MEMBER_DESC = YES ++REPEAT_BRIEF = YES ++ABBREVIATE_BRIEF = "The $name class" \ ++ "The $name widget" \ ++ "The $name file" \ ++ is \ ++ provides \ ++ specifies \ ++ contains \ ++ represents \ ++ a \ ++ an \ ++ the ++ALWAYS_DETAILED_SEC = NO ++INLINE_INHERITED_MEMB = NO ++FULL_PATH_NAMES = NO ++STRIP_FROM_PATH = ++STRIP_FROM_INC_PATH = ++SHORT_NAMES = NO ++JAVADOC_AUTOBRIEF = YES ++MULTILINE_CPP_IS_BRIEF = NO ++INHERIT_DOCS = YES ++DISTRIBUTE_GROUP_DOC = NO ++TAB_SIZE = 8 ++ALIASES = ++OPTIMIZE_OUTPUT_FOR_C = YES ++OPTIMIZE_OUTPUT_JAVA = NO ++SUBGROUPING = YES ++#--------------------------------------------------------------------------- ++# Build related configuration options ++#--------------------------------------------------------------------------- ++EXTRACT_ALL = NO ++EXTRACT_PRIVATE = YES ++EXTRACT_STATIC = YES ++EXTRACT_LOCAL_CLASSES = YES ++EXTRACT_LOCAL_METHODS = NO ++HIDE_UNDOC_MEMBERS = NO ++HIDE_UNDOC_CLASSES = NO ++HIDE_FRIEND_COMPOUNDS = NO ++HIDE_IN_BODY_DOCS = NO ++INTERNAL_DOCS = NO ++CASE_SENSE_NAMES = NO ++HIDE_SCOPE_NAMES = NO ++SHOW_INCLUDE_FILES = YES ++INLINE_INFO = YES ++SORT_MEMBER_DOCS = NO ++SORT_BRIEF_DOCS = NO ++SORT_BY_SCOPE_NAME = NO ++GENERATE_TODOLIST = YES ++GENERATE_TESTLIST = YES ++GENERATE_BUGLIST = YES ++GENERATE_DEPRECATEDLIST= YES ++ENABLED_SECTIONS = ++MAX_INITIALIZER_LINES = 30 ++SHOW_USED_FILES = YES ++SHOW_DIRECTORIES = YES ++#--------------------------------------------------------------------------- ++# configuration options related to warning and progress messages ++#--------------------------------------------------------------------------- ++QUIET = YES ++WARNINGS = YES ++WARN_IF_UNDOCUMENTED = NO ++WARN_IF_DOC_ERROR = YES ++WARN_FORMAT = "$file:$line: $text" ++WARN_LOGFILE = ++#--------------------------------------------------------------------------- ++# configuration options related to the input files ++#--------------------------------------------------------------------------- ++INPUT = . ++FILE_PATTERNS = *.c \ ++ *.h \ ++ ./linux/*.c \ ++ ./linux/*.h ++RECURSIVE = NO ++EXCLUDE = ./test/ \ ++ ./dwc_otg/.AppleDouble/ ++EXCLUDE_SYMLINKS = YES ++EXCLUDE_PATTERNS = *.mod.* ++EXAMPLE_PATH = ++EXAMPLE_PATTERNS = * ++EXAMPLE_RECURSIVE = NO ++IMAGE_PATH = ++INPUT_FILTER = ++FILTER_PATTERNS = ++FILTER_SOURCE_FILES = NO ++#--------------------------------------------------------------------------- ++# configuration options related to source browsing ++#--------------------------------------------------------------------------- ++SOURCE_BROWSER = YES ++INLINE_SOURCES = NO ++STRIP_CODE_COMMENTS = YES ++REFERENCED_BY_RELATION = NO ++REFERENCES_RELATION = NO ++VERBATIM_HEADERS = NO ++#--------------------------------------------------------------------------- ++# configuration options related to the alphabetical class index ++#--------------------------------------------------------------------------- ++ALPHABETICAL_INDEX = NO ++COLS_IN_ALPHA_INDEX = 5 ++IGNORE_PREFIX = ++#--------------------------------------------------------------------------- ++# configuration options related to the HTML output ++#--------------------------------------------------------------------------- ++GENERATE_HTML = YES ++HTML_OUTPUT = html ++HTML_FILE_EXTENSION = .html ++HTML_HEADER = ++HTML_FOOTER = ++HTML_STYLESHEET = ++HTML_ALIGN_MEMBERS = YES ++GENERATE_HTMLHELP = NO ++CHM_FILE = ++HHC_LOCATION = ++GENERATE_CHI = NO ++BINARY_TOC = NO ++TOC_EXPAND = NO ++DISABLE_INDEX = NO ++ENUM_VALUES_PER_LINE = 4 ++GENERATE_TREEVIEW = YES ++TREEVIEW_WIDTH = 250 ++#--------------------------------------------------------------------------- ++# configuration options related to the LaTeX output ++#--------------------------------------------------------------------------- ++GENERATE_LATEX = NO ++LATEX_OUTPUT = latex ++LATEX_CMD_NAME = latex ++MAKEINDEX_CMD_NAME = makeindex ++COMPACT_LATEX = NO ++PAPER_TYPE = a4wide ++EXTRA_PACKAGES = ++LATEX_HEADER = ++PDF_HYPERLINKS = NO ++USE_PDFLATEX = NO ++LATEX_BATCHMODE = NO ++LATEX_HIDE_INDICES = NO ++#--------------------------------------------------------------------------- ++# configuration options related to the RTF output ++#--------------------------------------------------------------------------- ++GENERATE_RTF = NO ++RTF_OUTPUT = rtf ++COMPACT_RTF = NO ++RTF_HYPERLINKS = NO ++RTF_STYLESHEET_FILE = ++RTF_EXTENSIONS_FILE = ++#--------------------------------------------------------------------------- ++# configuration options related to the man page output ++#--------------------------------------------------------------------------- ++GENERATE_MAN = NO ++MAN_OUTPUT = man ++MAN_EXTENSION = .3 ++MAN_LINKS = NO ++#--------------------------------------------------------------------------- ++# configuration options related to the XML output ++#--------------------------------------------------------------------------- ++GENERATE_XML = NO ++XML_OUTPUT = xml ++XML_SCHEMA = ++XML_DTD = ++XML_PROGRAMLISTING = YES ++#--------------------------------------------------------------------------- ++# configuration options for the AutoGen Definitions output ++#--------------------------------------------------------------------------- ++GENERATE_AUTOGEN_DEF = NO ++#--------------------------------------------------------------------------- ++# configuration options related to the Perl module output ++#--------------------------------------------------------------------------- ++GENERATE_PERLMOD = NO ++PERLMOD_LATEX = NO ++PERLMOD_PRETTY = YES ++PERLMOD_MAKEVAR_PREFIX = ++#--------------------------------------------------------------------------- ++# Configuration options related to the preprocessor ++#--------------------------------------------------------------------------- ++ENABLE_PREPROCESSING = YES ++MACRO_EXPANSION = YES ++EXPAND_ONLY_PREDEF = YES ++SEARCH_INCLUDES = YES ++INCLUDE_PATH = ++INCLUDE_FILE_PATTERNS = ++PREDEFINED = DEVICE_ATTR DWC_EN_ISOC ++EXPAND_AS_DEFINED = DWC_OTG_DEVICE_ATTR_BITFIELD_SHOW DWC_OTG_DEVICE_ATTR_BITFIELD_STORE DWC_OTG_DEVICE_ATTR_BITFIELD_RW DWC_OTG_DEVICE_ATTR_BITFIELD_RO DWC_OTG_DEVICE_ATTR_REG_SHOW DWC_OTG_DEVICE_ATTR_REG_STORE DWC_OTG_DEVICE_ATTR_REG32_RW DWC_OTG_DEVICE_ATTR_REG32_RO DWC_EN_ISOC ++SKIP_FUNCTION_MACROS = NO ++#--------------------------------------------------------------------------- ++# Configuration::additions related to external references ++#--------------------------------------------------------------------------- ++TAGFILES = ++GENERATE_TAGFILE = ++ALLEXTERNALS = NO ++EXTERNAL_GROUPS = YES ++PERL_PATH = /usr/bin/perl ++#--------------------------------------------------------------------------- ++# Configuration options related to the dot tool ++#--------------------------------------------------------------------------- ++CLASS_DIAGRAMS = YES ++HIDE_UNDOC_RELATIONS = YES ++HAVE_DOT = NO ++CLASS_GRAPH = YES ++COLLABORATION_GRAPH = YES ++UML_LOOK = NO ++TEMPLATE_RELATIONS = NO ++INCLUDE_GRAPH = YES ++INCLUDED_BY_GRAPH = YES ++CALL_GRAPH = NO ++GRAPHICAL_HIERARCHY = YES ++DOT_IMAGE_FORMAT = png ++DOT_PATH = ++DOTFILE_DIRS = ++MAX_DOT_GRAPH_DEPTH = 1000 ++GENERATE_LEGEND = YES ++DOT_CLEANUP = YES ++#--------------------------------------------------------------------------- ++# Configuration::additions related to the search engine ++#--------------------------------------------------------------------------- ++SEARCHENGINE = NO +diff --git a/drivers/usb/host/dwc_otg/dummy_audio.c b/drivers/usb/host/dwc_otg/dummy_audio.c +new file mode 100644 +index 0000000..225decf +--- /dev/null ++++ b/drivers/usb/host/dwc_otg/dummy_audio.c +@@ -0,0 +1,1575 @@ ++/* ++ * zero.c -- Gadget Zero, for USB development ++ * ++ * Copyright (C) 2003-2004 David Brownell ++ * 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, ++ * without modification. ++ * 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. ++ * 3. The names of the above-listed copyright holders may not be used ++ * to endorse or promote products derived from this software without ++ * specific prior written permission. ++ * ++ * ALTERNATIVELY, this software may be distributed under the terms of the ++ * GNU General Public License ("GPL") as published by the Free Software ++ * Foundation, either version 2 of that License or (at your option) any ++ * later version. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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. ++ */ ++ ++ ++/* ++ * Gadget Zero only needs two bulk endpoints, and is an example of how you ++ * can write a hardware-agnostic gadget driver running inside a USB device. ++ * ++ * Hardware details are visible (see CONFIG_USB_ZERO_* below) but don't ++ * affect most of the driver. ++ * ++ * Use it with the Linux host/master side "usbtest" driver to get a basic ++ * functional test of your device-side usb stack, or with "usb-skeleton". ++ * ++ * It supports two similar configurations. One sinks whatever the usb host ++ * writes, and in return sources zeroes. The other loops whatever the host ++ * writes back, so the host can read it. Module options include: ++ * ++ * buflen=N default N=4096, buffer size used ++ * qlen=N default N=32, how many buffers in the loopback queue ++ * loopdefault default false, list loopback config first ++ * ++ * Many drivers will only have one configuration, letting them be much ++ * simpler if they also don't support high speed operation (like this ++ * driver does). ++ */ ++ ++#include <linux/config.h> ++#include <linux/module.h> ++#include <linux/kernel.h> ++#include <linux/delay.h> ++#include <linux/ioport.h> ++#include <linux/sched.h> ++#include <linux/slab.h> ++#include <linux/smp_lock.h> ++#include <linux/errno.h> ++#include <linux/init.h> ++#include <linux/timer.h> ++#include <linux/list.h> ++#include <linux/interrupt.h> ++#include <linux/uts.h> ++#include <linux/version.h> ++#include <linux/device.h> ++#include <linux/moduleparam.h> ++#include <linux/proc_fs.h> ++ ++#include <asm/byteorder.h> ++#include <asm/io.h> ++#include <asm/irq.h> ++#include <asm/system.h> ++#include <asm/unaligned.h> ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21) ++# include <linux/usb/ch9.h> ++#else ++# include <linux/usb_ch9.h> ++#endif ++ ++#include <linux/usb_gadget.h> ++ ++ ++/*-------------------------------------------------------------------------*/ ++/*-------------------------------------------------------------------------*/ ++ ++ ++static int utf8_to_utf16le(const char *s, u16 *cp, unsigned len) ++{ ++ int count = 0; ++ u8 c; ++ u16 uchar; ++ ++ /* this insists on correct encodings, though not minimal ones. ++ * BUT it currently rejects legit 4-byte UTF-8 code points, ++ * which need surrogate pairs. (Unicode 3.1 can use them.) ++ */ ++ while (len != 0 && (c = (u8) *s++) != 0) { ++ if (unlikely(c & 0x80)) { ++ // 2-byte sequence: ++ // 00000yyyyyxxxxxx = 110yyyyy 10xxxxxx ++ if ((c & 0xe0) == 0xc0) { ++ uchar = (c & 0x1f) << 6; ++ ++ c = (u8) *s++; ++ if ((c & 0xc0) != 0xc0) ++ goto fail; ++ c &= 0x3f; ++ uchar |= c; ++ ++ // 3-byte sequence (most CJKV characters): ++ // zzzzyyyyyyxxxxxx = 1110zzzz 10yyyyyy 10xxxxxx ++ } else if ((c & 0xf0) == 0xe0) { ++ uchar = (c & 0x0f) << 12; ++ ++ c = (u8) *s++; ++ if ((c & 0xc0) != 0xc0) ++ goto fail; ++ c &= 0x3f; ++ uchar |= c << 6; ++ ++ c = (u8) *s++; ++ if ((c & 0xc0) != 0xc0) ++ goto fail; ++ c &= 0x3f; ++ uchar |= c; ++ ++ /* no bogus surrogates */ ++ if (0xd800 <= uchar && uchar <= 0xdfff) ++ goto fail; ++ ++ // 4-byte sequence (surrogate pairs, currently rare): ++ // 11101110wwwwzzzzyy + 110111yyyyxxxxxx ++ // = 11110uuu 10uuzzzz 10yyyyyy 10xxxxxx ++ // (uuuuu = wwww + 1) ++ // FIXME accept the surrogate code points (only) ++ ++ } else ++ goto fail; ++ } else ++ uchar = c; ++ put_unaligned (cpu_to_le16 (uchar), cp++); ++ count++; ++ len--; ++ } ++ return count; ++fail: ++ return -1; ++} ++ ++ ++/** ++ * usb_gadget_get_string - fill out a string descriptor ++ * @table: of c strings encoded using UTF-8 ++ * @id: string id, from low byte of wValue in get string descriptor ++ * @buf: at least 256 bytes ++ * ++ * Finds the UTF-8 string matching the ID, and converts it into a ++ * string descriptor in utf16-le. ++ * Returns length of descriptor (always even) or negative errno ++ * ++ * If your driver needs stings in multiple languages, you'll probably ++ * "switch (wIndex) { ... }" in your ep0 string descriptor logic, ++ * using this routine after choosing which set of UTF-8 strings to use. ++ * Note that US-ASCII is a strict subset of UTF-8; any string bytes with ++ * the eighth bit set will be multibyte UTF-8 characters, not ISO-8859/1 ++ * characters (which are also widely used in C strings). ++ */ ++int ++usb_gadget_get_string (struct usb_gadget_strings *table, int id, u8 *buf) ++{ ++ struct usb_string *s; ++ int len; ++ ++ /* descriptor 0 has the language id */ ++ if (id == 0) { ++ buf [0] = 4; ++ buf [1] = USB_DT_STRING; ++ buf [2] = (u8) table->language; ++ buf [3] = (u8) (table->language >> 8); ++ return 4; ++ } ++ for (s = table->strings; s && s->s; s++) ++ if (s->id == id) ++ break; ++ ++ /* unrecognized: stall. */ ++ if (!s || !s->s) ++ return -EINVAL; ++ ++ /* string descriptors have length, tag, then UTF16-LE text */ ++ len = min ((size_t) 126, strlen (s->s)); ++ memset (buf + 2, 0, 2 * len); /* zero all the bytes */ ++ len = utf8_to_utf16le(s->s, (u16 *)&buf[2], len); ++ if (len < 0) ++ return -EINVAL; ++ buf [0] = (len + 1) * 2; ++ buf [1] = USB_DT_STRING; ++ return buf [0]; ++} ++ ++ ++/*-------------------------------------------------------------------------*/ ++/*-------------------------------------------------------------------------*/ ++ ++ ++/** ++ * usb_descriptor_fillbuf - fill buffer with descriptors ++ * @buf: Buffer to be filled ++ * @buflen: Size of buf ++ * @src: Array of descriptor pointers, terminated by null pointer. ++ * ++ * Copies descriptors into the buffer, returning the length or a ++ * negative error code if they can't all be copied. Useful when ++ * assembling descriptors for an associated set of interfaces used ++ * as part of configuring a composite device; or in other cases where ++ * sets of descriptors need to be marshaled. ++ */ ++int ++usb_descriptor_fillbuf(void *buf, unsigned buflen, ++ const struct usb_descriptor_header **src) ++{ ++ u8 *dest = buf; ++ ++ if (!src) ++ return -EINVAL; ++ ++ /* fill buffer from src[] until null descriptor ptr */ ++ for (; 0 != *src; src++) { ++ unsigned len = (*src)->bLength; ++ ++ if (len > buflen) ++ return -EINVAL; ++ memcpy(dest, *src, len); ++ buflen -= len; ++ dest += len; ++ } ++ return dest - (u8 *)buf; ++} ++ ++ ++/** ++ * usb_gadget_config_buf - builts a complete configuration descriptor ++ * @config: Header for the descriptor, including characteristics such ++ * as power requirements and number of interfaces. ++ * @desc: Null-terminated vector of pointers to the descriptors (interface, ++ * endpoint, etc) defining all functions in this device configuration. ++ * @buf: Buffer for the resulting configuration descriptor. ++ * @length: Length of buffer. If this is not big enough to hold the ++ * entire configuration descriptor, an error code will be returned. ++ * ++ * This copies descriptors into the response buffer, building a descriptor ++ * for that configuration. It returns the buffer length or a negative ++ * status code. The config.wTotalLength field is set to match the length ++ * of the result, but other descriptor fields (including power usage and ++ * interface count) must be set by the caller. ++ * ++ * Gadget drivers could use this when constructing a config descriptor ++ * in response to USB_REQ_GET_DESCRIPTOR. They will need to patch the ++ * resulting bDescriptorType value if USB_DT_OTHER_SPEED_CONFIG is needed. ++ */ ++int usb_gadget_config_buf( ++ const struct usb_config_descriptor *config, ++ void *buf, ++ unsigned length, ++ const struct usb_descriptor_header **desc ++) ++{ ++ struct usb_config_descriptor *cp = buf; ++ int len; ++ ++ /* config descriptor first */ ++ if (length < USB_DT_CONFIG_SIZE || !desc) ++ return -EINVAL; ++ *cp = *config; ++ ++ /* then interface/endpoint/class/vendor/... */ ++ len = usb_descriptor_fillbuf(USB_DT_CONFIG_SIZE + (u8*)buf, ++ length - USB_DT_CONFIG_SIZE, desc); ++ if (len < 0) ++ return len; ++ len += USB_DT_CONFIG_SIZE; ++ if (len > 0xffff) ++ return -EINVAL; ++ ++ /* patch up the config descriptor */ ++ cp->bLength = USB_DT_CONFIG_SIZE; ++ cp->bDescriptorType = USB_DT_CONFIG; ++ cp->wTotalLength = cpu_to_le16(len); ++ cp->bmAttributes |= USB_CONFIG_ATT_ONE; ++ return len; ++} ++ ++/*-------------------------------------------------------------------------*/ ++/*-------------------------------------------------------------------------*/ ++ ++ ++#define RBUF_LEN (1024*1024) ++static int rbuf_start; ++static int rbuf_len; ++static __u8 rbuf[RBUF_LEN]; ++ ++/*-------------------------------------------------------------------------*/ ++ ++#define DRIVER_VERSION "St Patrick's Day 2004" ++ ++static const char shortname [] = "zero"; ++static const char longname [] = "YAMAHA YST-MS35D USB Speaker "; ++ ++static const char source_sink [] = "source and sink data"; ++static const char loopback [] = "loop input to output"; ++ ++/*-------------------------------------------------------------------------*/ ++ ++/* ++ * driver assumes self-powered hardware, and ++ * has no way for users to trigger remote wakeup. ++ * ++ * this version autoconfigures as much as possible, ++ * which is reasonable for most "bulk-only" drivers. ++ */ ++static const char *EP_IN_NAME; /* source */ ++static const char *EP_OUT_NAME; /* sink */ ++ ++/*-------------------------------------------------------------------------*/ ++ ++/* big enough to hold our biggest descriptor */ ++#define USB_BUFSIZ 512 ++ ++struct zero_dev { ++ spinlock_t lock; ++ struct usb_gadget *gadget; ++ struct usb_request *req; /* for control responses */ ++ ++ /* when configured, we have one of two configs: ++ * - source data (in to host) and sink it (out from host) ++ * - or loop it back (out from host back in to host) ++ */ ++ u8 config; ++ struct usb_ep *in_ep, *out_ep; ++ ++ /* autoresume timer */ ++ struct timer_list resume; ++}; ++ ++#define xprintk(d,level,fmt,args...) \ ++ dev_printk(level , &(d)->gadget->dev , fmt , ## args) ++ ++#ifdef DEBUG ++#define DBG(dev,fmt,args...) \ ++ xprintk(dev , KERN_DEBUG , fmt , ## args) ++#else ++#define DBG(dev,fmt,args...) \ ++ do { } while (0) ++#endif /* DEBUG */ ++ ++#ifdef VERBOSE ++#define VDBG DBG ++#else ++#define VDBG(dev,fmt,args...) \ ++ do { } while (0) ++#endif /* VERBOSE */ ++ ++#define ERROR(dev,fmt,args...) \ ++ xprintk(dev , KERN_ERR , fmt , ## args) ++#define WARN(dev,fmt,args...) \ ++ xprintk(dev , KERN_WARNING , fmt , ## args) ++#define INFO(dev,fmt,args...) \ ++ xprintk(dev , KERN_INFO , fmt , ## args) ++ ++/*-------------------------------------------------------------------------*/ ++ ++static unsigned buflen = 4096; ++static unsigned qlen = 32; ++static unsigned pattern = 0; ++ ++module_param (buflen, uint, S_IRUGO|S_IWUSR); ++module_param (qlen, uint, S_IRUGO|S_IWUSR); ++module_param (pattern, uint, S_IRUGO|S_IWUSR); ++ ++/* ++ * if it's nonzero, autoresume says how many seconds to wait ++ * before trying to wake up the host after suspend. ++ */ ++static unsigned autoresume = 0; ++module_param (autoresume, uint, 0); ++ ++/* ++ * Normally the "loopback" configuration is second (index 1) so ++ * it's not the default. Here's where to change that order, to ++ * work better with hosts where config changes are problematic. ++ * Or controllers (like superh) that only support one config. ++ */ ++static int loopdefault = 0; ++ ++module_param (loopdefault, bool, S_IRUGO|S_IWUSR); ++ ++/*-------------------------------------------------------------------------*/ ++ ++/* Thanks to NetChip Technologies for donating this product ID. ++ * ++ * DO NOT REUSE THESE IDs with a protocol-incompatible driver!! Ever!! ++ * Instead: allocate your own, using normal USB-IF procedures. ++ */ ++#ifndef CONFIG_USB_ZERO_HNPTEST ++#define DRIVER_VENDOR_NUM 0x0525 /* NetChip */ ++#define DRIVER_PRODUCT_NUM 0xa4a0 /* Linux-USB "Gadget Zero" */ ++#else ++#define DRIVER_VENDOR_NUM 0x1a0a /* OTG test device IDs */ ++#define DRIVER_PRODUCT_NUM 0xbadd ++#endif ++ ++/*-------------------------------------------------------------------------*/ ++ ++/* ++ * DESCRIPTORS ... most are static, but strings and (full) ++ * configuration descriptors are built on demand. ++ */ ++ ++/* ++#define STRING_MANUFACTURER 25 ++#define STRING_PRODUCT 42 ++#define STRING_SERIAL 101 ++*/ ++#define STRING_MANUFACTURER 1 ++#define STRING_PRODUCT 2 ++#define STRING_SERIAL 3 ++ ++#define STRING_SOURCE_SINK 250 ++#define STRING_LOOPBACK 251 ++ ++/* ++ * This device advertises two configurations; these numbers work ++ * on a pxa250 as well as more flexible hardware. ++ */ ++#define CONFIG_SOURCE_SINK 3 ++#define CONFIG_LOOPBACK 2 ++ ++/* ++static struct usb_device_descriptor ++device_desc = { ++ .bLength = sizeof device_desc, ++ .bDescriptorType = USB_DT_DEVICE, ++ ++ .bcdUSB = __constant_cpu_to_le16 (0x0200), ++ .bDeviceClass = USB_CLASS_VENDOR_SPEC, ++ ++ .idVendor = __constant_cpu_to_le16 (DRIVER_VENDOR_NUM), ++ .idProduct = __constant_cpu_to_le16 (DRIVER_PRODUCT_NUM), ++ .iManufacturer = STRING_MANUFACTURER, ++ .iProduct = STRING_PRODUCT, ++ .iSerialNumber = STRING_SERIAL, ++ .bNumConfigurations = 2, ++}; ++*/ ++static struct usb_device_descriptor ++device_desc = { ++ .bLength = sizeof device_desc, ++ .bDescriptorType = USB_DT_DEVICE, ++ .bcdUSB = __constant_cpu_to_le16 (0x0100), ++ .bDeviceClass = USB_CLASS_PER_INTERFACE, ++ .bDeviceSubClass = 0, ++ .bDeviceProtocol = 0, ++ .bMaxPacketSize0 = 64, ++ .bcdDevice = __constant_cpu_to_le16 (0x0100), ++ .idVendor = __constant_cpu_to_le16 (0x0499), ++ .idProduct = __constant_cpu_to_le16 (0x3002), ++ .iManufacturer = STRING_MANUFACTURER, ++ .iProduct = STRING_PRODUCT, ++ .iSerialNumber = STRING_SERIAL, ++ .bNumConfigurations = 1, ++}; ++ ++static struct usb_config_descriptor ++z_config = { ++ .bLength = sizeof z_config, ++ .bDescriptorType = USB_DT_CONFIG, ++ ++ /* compute wTotalLength on the fly */ ++ .bNumInterfaces = 2, ++ .bConfigurationValue = 1, ++ .iConfiguration = 0, ++ .bmAttributes = 0x40, ++ .bMaxPower = 0, /* self-powered */ ++}; ++ ++ ++static struct usb_otg_descriptor ++otg_descriptor = { ++ .bLength = sizeof otg_descriptor, ++ .bDescriptorType = USB_DT_OTG, ++ ++ .bmAttributes = USB_OTG_SRP, ++}; ++ ++/* one interface in each configuration */ ++#ifdef CONFIG_USB_GADGET_DUALSPEED ++ ++/* ++ * usb 2.0 devices need to expose both high speed and full speed ++ * descriptors, unless they only run at full speed. ++ * ++ * that means alternate endpoint descriptors (bigger packets) ++ * and a "device qualifier" ... plus more construction options ++ * for the config descriptor. ++ */ ++ ++static struct usb_qualifier_descriptor ++dev_qualifier = { ++ .bLength = sizeof dev_qualifier, ++ .bDescriptorType = USB_DT_DEVICE_QUALIFIER, ++ ++ .bcdUSB = __constant_cpu_to_le16 (0x0200), ++ .bDeviceClass = USB_CLASS_VENDOR_SPEC, ++ ++ .bNumConfigurations = 2, ++}; ++ ++ ++struct usb_cs_as_general_descriptor { ++ __u8 bLength; ++ __u8 bDescriptorType; ++ ++ __u8 bDescriptorSubType; ++ __u8 bTerminalLink; ++ __u8 bDelay; ++ __u16 wFormatTag; ++} __attribute__ ((packed)); ++ ++struct usb_cs_as_format_descriptor { ++ __u8 bLength; ++ __u8 bDescriptorType; ++ ++ __u8 bDescriptorSubType; ++ __u8 bFormatType; ++ __u8 bNrChannels; ++ __u8 bSubframeSize; ++ __u8 bBitResolution; ++ __u8 bSamfreqType; ++ __u8 tLowerSamFreq[3]; ++ __u8 tUpperSamFreq[3]; ++} __attribute__ ((packed)); ++ ++static const struct usb_interface_descriptor ++z_audio_control_if_desc = { ++ .bLength = sizeof z_audio_control_if_desc, ++ .bDescriptorType = USB_DT_INTERFACE, ++ .bInterfaceNumber = 0, ++ .bAlternateSetting = 0, ++ .bNumEndpoints = 0, ++ .bInterfaceClass = USB_CLASS_AUDIO, ++ .bInterfaceSubClass = 0x1, ++ .bInterfaceProtocol = 0, ++ .iInterface = 0, ++}; ++ ++static const struct usb_interface_descriptor ++z_audio_if_desc = { ++ .bLength = sizeof z_audio_if_desc, ++ .bDescriptorType = USB_DT_INTERFACE, ++ .bInterfaceNumber = 1, ++ .bAlternateSetting = 0, ++ .bNumEndpoints = 0, ++ .bInterfaceClass = USB_CLASS_AUDIO, ++ .bInterfaceSubClass = 0x2, ++ .bInterfaceProtocol = 0, ++ .iInterface = 0, ++}; ++ ++static const struct usb_interface_descriptor ++z_audio_if_desc2 = { ++ .bLength = sizeof z_audio_if_desc, ++ .bDescriptorType = USB_DT_INTERFACE, ++ .bInterfaceNumber = 1, ++ .bAlternateSetting = 1, ++ .bNumEndpoints = 1, ++ .bInterfaceClass = USB_CLASS_AUDIO, ++ .bInterfaceSubClass = 0x2, ++ .bInterfaceProtocol = 0, ++ .iInterface = 0, ++}; ++ ++static const struct usb_cs_as_general_descriptor ++z_audio_cs_as_if_desc = { ++ .bLength = 7, ++ .bDescriptorType = 0x24, ++ ++ .bDescriptorSubType = 0x01, ++ .bTerminalLink = 0x01, ++ .bDelay = 0x0, ++ .wFormatTag = __constant_cpu_to_le16 (0x0001) ++}; ++ ++ ++static const struct usb_cs_as_format_descriptor ++z_audio_cs_as_format_desc = { ++ .bLength = 0xe, ++ .bDescriptorType = 0x24, ++ ++ .bDescriptorSubType = 2, ++ .bFormatType = 1, ++ .bNrChannels = 1, ++ .bSubframeSize = 1, ++ .bBitResolution = 8, ++ .bSamfreqType = 0, ++ .tLowerSamFreq = {0x7e, 0x13, 0x00}, ++ .tUpperSamFreq = {0xe2, 0xd6, 0x00}, ++}; ++ ++static const struct usb_endpoint_descriptor ++z_iso_ep = { ++ .bLength = 0x09, ++ .bDescriptorType = 0x05, ++ .bEndpointAddress = 0x04, ++ .bmAttributes = 0x09, ++ .wMaxPacketSize = 0x0038, ++ .bInterval = 0x01, ++ .bRefresh = 0x00, ++ .bSynchAddress = 0x00, ++}; ++ ++static char z_iso_ep2[] = {0x07, 0x25, 0x01, 0x00, 0x02, 0x00, 0x02}; ++ ++// 9 bytes ++static char z_ac_interface_header_desc[] = ++{ 0x09, 0x24, 0x01, 0x00, 0x01, 0x2b, 0x00, 0x01, 0x01 }; ++ ++// 12 bytes ++static char z_0[] = {0x0c, 0x24, 0x02, 0x01, 0x01, 0x01, 0x00, 0x02, ++ 0x03, 0x00, 0x00, 0x00}; ++// 13 bytes ++static char z_1[] = {0x0d, 0x24, 0x06, 0x02, 0x01, 0x02, 0x15, 0x00, ++ 0x02, 0x00, 0x02, 0x00, 0x00}; ++// 9 bytes ++static char z_2[] = {0x09, 0x24, 0x03, 0x03, 0x01, 0x03, 0x00, 0x02, ++ 0x00}; ++ ++static char za_0[] = {0x09, 0x04, 0x01, 0x02, 0x01, 0x01, 0x02, 0x00, ++ 0x00}; ++ ++static char za_1[] = {0x07, 0x24, 0x01, 0x01, 0x00, 0x01, 0x00}; ++ ++static char za_2[] = {0x0e, 0x24, 0x02, 0x01, 0x02, 0x01, 0x08, 0x00, ++ 0x7e, 0x13, 0x00, 0xe2, 0xd6, 0x00}; ++ ++static char za_3[] = {0x09, 0x05, 0x04, 0x09, 0x70, 0x00, 0x01, 0x00, ++ 0x00}; ++ ++static char za_4[] = {0x07, 0x25, 0x01, 0x00, 0x02, 0x00, 0x02}; ++ ++static char za_5[] = {0x09, 0x04, 0x01, 0x03, 0x01, 0x01, 0x02, 0x00, ++ 0x00}; ++ ++static char za_6[] = {0x07, 0x24, 0x01, 0x01, 0x00, 0x01, 0x00}; ++ ++static char za_7[] = {0x0e, 0x24, 0x02, 0x01, 0x01, 0x02, 0x10, 0x00, ++ 0x7e, 0x13, 0x00, 0xe2, 0xd6, 0x00}; ++ ++static char za_8[] = {0x09, 0x05, 0x04, 0x09, 0x70, 0x00, 0x01, 0x00, ++ 0x00}; ++ ++static char za_9[] = {0x07, 0x25, 0x01, 0x00, 0x02, 0x00, 0x02}; ++ ++static char za_10[] = {0x09, 0x04, 0x01, 0x04, 0x01, 0x01, 0x02, 0x00, ++ 0x00}; ++ ++static char za_11[] = {0x07, 0x24, 0x01, 0x01, 0x00, 0x01, 0x00}; ++ ++static char za_12[] = {0x0e, 0x24, 0x02, 0x01, 0x02, 0x02, 0x10, 0x00, ++ 0x73, 0x13, 0x00, 0xe2, 0xd6, 0x00}; ++ ++static char za_13[] = {0x09, 0x05, 0x04, 0x09, 0xe0, 0x00, 0x01, 0x00, ++ 0x00}; ++ ++static char za_14[] = {0x07, 0x25, 0x01, 0x00, 0x02, 0x00, 0x02}; ++ ++static char za_15[] = {0x09, 0x04, 0x01, 0x05, 0x01, 0x01, 0x02, 0x00, ++ 0x00}; ++ ++static char za_16[] = {0x07, 0x24, 0x01, 0x01, 0x00, 0x01, 0x00}; ++ ++static char za_17[] = {0x0e, 0x24, 0x02, 0x01, 0x01, 0x03, 0x14, 0x00, ++ 0x7e, 0x13, 0x00, 0xe2, 0xd6, 0x00}; ++ ++static char za_18[] = {0x09, 0x05, 0x04, 0x09, 0xa8, 0x00, 0x01, 0x00, ++ 0x00}; ++ ++static char za_19[] = {0x07, 0x25, 0x01, 0x00, 0x02, 0x00, 0x02}; ++ ++static char za_20[] = {0x09, 0x04, 0x01, 0x06, 0x01, 0x01, 0x02, 0x00, ++ 0x00}; ++ ++static char za_21[] = {0x07, 0x24, 0x01, 0x01, 0x00, 0x01, 0x00}; ++ ++static char za_22[] = {0x0e, 0x24, 0x02, 0x01, 0x02, 0x03, 0x14, 0x00, ++ 0x7e, 0x13, 0x00, 0xe2, 0xd6, 0x00}; ++ ++static char za_23[] = {0x09, 0x05, 0x04, 0x09, 0x50, 0x01, 0x01, 0x00, ++ 0x00}; ++ ++static char za_24[] = {0x07, 0x25, 0x01, 0x00, 0x02, 0x00, 0x02}; ++ ++ ++ ++static const struct usb_descriptor_header *z_function [] = { ++ (struct usb_descriptor_header *) &z_audio_control_if_desc, ++ (struct usb_descriptor_header *) &z_ac_interface_header_desc, ++ (struct usb_descriptor_header *) &z_0, ++ (struct usb_descriptor_header *) &z_1, ++ (struct usb_descriptor_header *) &z_2, ++ (struct usb_descriptor_header *) &z_audio_if_desc, ++ (struct usb_descriptor_header *) &z_audio_if_desc2, ++ (struct usb_descriptor_header *) &z_audio_cs_as_if_desc, ++ (struct usb_descriptor_header *) &z_audio_cs_as_format_desc, ++ (struct usb_descriptor_header *) &z_iso_ep, ++ (struct usb_descriptor_header *) &z_iso_ep2, ++ (struct usb_descriptor_header *) &za_0, ++ (struct usb_descriptor_header *) &za_1, ++ (struct usb_descriptor_header *) &za_2, ++ (struct usb_descriptor_header *) &za_3, ++ (struct usb_descriptor_header *) &za_4, ++ (struct usb_descriptor_header *) &za_5, ++ (struct usb_descriptor_header *) &za_6, ++ (struct usb_descriptor_header *) &za_7, ++ (struct usb_descriptor_header *) &za_8, ++ (struct usb_descriptor_header *) &za_9, ++ (struct usb_descriptor_header *) &za_10, ++ (struct usb_descriptor_header *) &za_11, ++ (struct usb_descriptor_header *) &za_12, ++ (struct usb_descriptor_header *) &za_13, ++ (struct usb_descriptor_header *) &za_14, ++ (struct usb_descriptor_header *) &za_15, ++ (struct usb_descriptor_header *) &za_16, ++ (struct usb_descriptor_header *) &za_17, ++ (struct usb_descriptor_header *) &za_18, ++ (struct usb_descriptor_header *) &za_19, ++ (struct usb_descriptor_header *) &za_20, ++ (struct usb_descriptor_header *) &za_21, ++ (struct usb_descriptor_header *) &za_22, ++ (struct usb_descriptor_header *) &za_23, ++ (struct usb_descriptor_header *) &za_24, ++ NULL, ++}; ++ ++/* maxpacket and other transfer characteristics vary by speed. */ ++#define ep_desc(g,hs,fs) (((g)->speed==USB_SPEED_HIGH)?(hs):(fs)) ++ ++#else ++ ++/* if there's no high speed support, maxpacket doesn't change. */ ++#define ep_desc(g,hs,fs) fs ++ ++#endif /* !CONFIG_USB_GADGET_DUALSPEED */ ++ ++static char manufacturer [40]; ++//static char serial [40]; ++static char serial [] = "Ser 00 em"; ++ ++/* static strings, in UTF-8 */ ++static struct usb_string strings [] = { ++ { STRING_MANUFACTURER, manufacturer, }, ++ { STRING_PRODUCT, longname, }, ++ { STRING_SERIAL, serial, }, ++ { STRING_LOOPBACK, loopback, }, ++ { STRING_SOURCE_SINK, source_sink, }, ++ { } /* end of list */ ++}; ++ ++static struct usb_gadget_strings stringtab = { ++ .language = 0x0409, /* en-us */ ++ .strings = strings, ++}; ++ ++/* ++ * config descriptors are also handcrafted. these must agree with code ++ * that sets configurations, and with code managing interfaces and their ++ * altsettings. other complexity may come from: ++ * ++ * - high speed support, including "other speed config" rules ++ * - multiple configurations ++ * - interfaces with alternate settings ++ * - embedded class or vendor-specific descriptors ++ * ++ * this handles high speed, and has a second config that could as easily ++ * have been an alternate interface setting (on most hardware). ++ * ++ * NOTE: to demonstrate (and test) more USB capabilities, this driver ++ * should include an altsetting to test interrupt transfers, including ++ * high bandwidth modes at high speed. (Maybe work like Intel's test ++ * device?) ++ */ ++static int ++config_buf (struct usb_gadget *gadget, u8 *buf, u8 type, unsigned index) ++{ ++ int len; ++ const struct usb_descriptor_header **function; ++ ++ function = z_function; ++ len = usb_gadget_config_buf (&z_config, buf, USB_BUFSIZ, function); ++ if (len < 0) ++ return len; ++ ((struct usb_config_descriptor *) buf)->bDescriptorType = type; ++ return len; ++} ++ ++/*-------------------------------------------------------------------------*/ ++ ++static struct usb_request * ++alloc_ep_req (struct usb_ep *ep, unsigned length) ++{ ++ struct usb_request *req; ++ ++ req = usb_ep_alloc_request (ep, GFP_ATOMIC); ++ if (req) { ++ req->length = length; ++ req->buf = usb_ep_alloc_buffer (ep, length, ++ &req->dma, GFP_ATOMIC); ++ if (!req->buf) { ++ usb_ep_free_request (ep, req); ++ req = NULL; ++ } ++ } ++ return req; ++} ++ ++static void free_ep_req (struct usb_ep *ep, struct usb_request *req) ++{ ++ if (req->buf) ++ usb_ep_free_buffer (ep, req->buf, req->dma, req->length); ++ usb_ep_free_request (ep, req); ++} ++ ++/*-------------------------------------------------------------------------*/ ++ ++/* optionally require specific source/sink data patterns */ ++ ++static int ++check_read_data ( ++ struct zero_dev *dev, ++ struct usb_ep *ep, ++ struct usb_request *req ++) ++{ ++ unsigned i; ++ u8 *buf = req->buf; ++ ++ for (i = 0; i < req->actual; i++, buf++) { ++ switch (pattern) { ++ /* all-zeroes has no synchronization issues */ ++ case 0: ++ if (*buf == 0) ++ continue; ++ break; ++ /* mod63 stays in sync with short-terminated transfers, ++ * or otherwise when host and gadget agree on how large ++ * each usb transfer request should be. resync is done ++ * with set_interface or set_config. ++ */ ++ case 1: ++ if (*buf == (u8)(i % 63)) ++ continue; ++ break; ++ } ++ ERROR (dev, "bad OUT byte, buf [%d] = %d\n", i, *buf); ++ usb_ep_set_halt (ep); ++ return -EINVAL; ++ } ++ return 0; ++} ++ ++/*-------------------------------------------------------------------------*/ ++ ++static void zero_reset_config (struct zero_dev *dev) ++{ ++ if (dev->config == 0) ++ return; ++ ++ DBG (dev, "reset config\n"); ++ ++ /* just disable endpoints, forcing completion of pending i/o. ++ * all our completion handlers free their requests in this case. ++ */ ++ if (dev->in_ep) { ++ usb_ep_disable (dev->in_ep); ++ dev->in_ep = NULL; ++ } ++ if (dev->out_ep) { ++ usb_ep_disable (dev->out_ep); ++ dev->out_ep = NULL; ++ } ++ dev->config = 0; ++ del_timer (&dev->resume); ++} ++ ++#define _write(f, buf, sz) (f->f_op->write(f, buf, sz, &f->f_pos)) ++ ++static void ++zero_isoc_complete (struct usb_ep *ep, struct usb_request *req) ++{ ++ struct zero_dev *dev = ep->driver_data; ++ int status = req->status; ++ int i, j; ++ ++ switch (status) { ++ ++ case 0: /* normal completion? */ ++ //printk ("\nzero ---------------> isoc normal completion %d bytes\n", req->actual); ++ for (i=0, j=rbuf_start; i<req->actual; i++) { ++ //printk ("%02x ", ((__u8*)req->buf)[i]); ++ rbuf[j] = ((__u8*)req->buf)[i]; ++ j++; ++ if (j >= RBUF_LEN) j=0; ++ } ++ rbuf_start = j; ++ //printk ("\n\n"); ++ ++ if (rbuf_len < RBUF_LEN) { ++ rbuf_len += req->actual; ++ if (rbuf_len > RBUF_LEN) { ++ rbuf_len = RBUF_LEN; ++ } ++ } ++ ++ break; ++ ++ /* this endpoint is normally active while we're configured */ ++ case -ECONNABORTED: /* hardware forced ep reset */ ++ case -ECONNRESET: /* request dequeued */ ++ case -ESHUTDOWN: /* disconnect from host */ ++ VDBG (dev, "%s gone (%d), %d/%d\n", ep->name, status, ++ req->actual, req->length); ++ if (ep == dev->out_ep) ++ check_read_data (dev, ep, req); ++ free_ep_req (ep, req); ++ return; ++ ++ case -EOVERFLOW: /* buffer overrun on read means that ++ * we didn't provide a big enough ++ * buffer. ++ */ ++ default: ++#if 1 ++ DBG (dev, "%s complete --> %d, %d/%d\n", ep->name, ++ status, req->actual, req->length); ++#endif ++ case -EREMOTEIO: /* short read */ ++ break; ++ } ++ ++ status = usb_ep_queue (ep, req, GFP_ATOMIC); ++ if (status) { ++ ERROR (dev, "kill %s: resubmit %d bytes --> %d\n", ++ ep->name, req->length, status); ++ usb_ep_set_halt (ep); ++ /* FIXME recover later ... somehow */ ++ } ++} ++ ++static struct usb_request * ++zero_start_isoc_ep (struct usb_ep *ep, int gfp_flags) ++{ ++ struct usb_request *req; ++ int status; ++ ++ req = alloc_ep_req (ep, 512); ++ if (!req) ++ return NULL; ++ ++ req->complete = zero_isoc_complete; ++ ++ status = usb_ep_queue (ep, req, gfp_flags); ++ if (status) { ++ struct zero_dev *dev = ep->driver_data; ++ ++ ERROR (dev, "start %s --> %d\n", ep->name, status); ++ free_ep_req (ep, req); ++ req = NULL; ++ } ++ ++ return req; ++} ++ ++/* change our operational config. this code must agree with the code ++ * that returns config descriptors, and altsetting code. ++ * ++ * it's also responsible for power management interactions. some ++ * configurations might not work with our current power sources. ++ * ++ * note that some device controller hardware will constrain what this ++ * code can do, perhaps by disallowing more than one configuration or ++ * by limiting configuration choices (like the pxa2xx). ++ */ ++static int ++zero_set_config (struct zero_dev *dev, unsigned number, int gfp_flags) ++{ ++ int result = 0; ++ struct usb_gadget *gadget = dev->gadget; ++ const struct usb_endpoint_descriptor *d; ++ struct usb_ep *ep; ++ ++ if (number == dev->config) ++ return 0; ++ ++ zero_reset_config (dev); ++ ++ gadget_for_each_ep (ep, gadget) { ++ ++ if (strcmp (ep->name, "ep4") == 0) { ++ ++ d = (struct usb_endpoint_descripter *)&za_23; // isoc ep desc for audio i/f alt setting 6 ++ result = usb_ep_enable (ep, d); ++ ++ if (result == 0) { ++ ep->driver_data = dev; ++ dev->in_ep = ep; ++ ++ if (zero_start_isoc_ep (ep, gfp_flags) != 0) { ++ ++ dev->in_ep = ep; ++ continue; ++ } ++ ++ usb_ep_disable (ep); ++ result = -EIO; ++ } ++ } ++ ++ } ++ ++ dev->config = number; ++ return result; ++} ++ ++/*-------------------------------------------------------------------------*/ ++ ++static void zero_setup_complete (struct usb_ep *ep, struct usb_request *req) ++{ ++ if (req->status || req->actual != req->length) ++ DBG ((struct zero_dev *) ep->driver_data, ++ "setup complete --> %d, %d/%d\n", ++ req->status, req->actual, req->length); ++} ++ ++/* ++ * The setup() callback implements all the ep0 functionality that's ++ * not handled lower down, in hardware or the hardware driver (like ++ * device and endpoint feature flags, and their status). It's all ++ * housekeeping for the gadget function we're implementing. Most of ++ * the work is in config-specific setup. ++ */ ++static int ++zero_setup (struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl) ++{ ++ struct zero_dev *dev = get_gadget_data (gadget); ++ struct usb_request *req = dev->req; ++ int value = -EOPNOTSUPP; ++ ++ /* usually this stores reply data in the pre-allocated ep0 buffer, ++ * but config change events will reconfigure hardware. ++ */ ++ req->zero = 0; ++ switch (ctrl->bRequest) { ++ ++ case USB_REQ_GET_DESCRIPTOR: ++ ++ switch (ctrl->wValue >> 8) { ++ ++ case USB_DT_DEVICE: ++ value = min (ctrl->wLength, (u16) sizeof device_desc); ++ memcpy (req->buf, &device_desc, value); ++ break; ++#ifdef CONFIG_USB_GADGET_DUALSPEED ++ case USB_DT_DEVICE_QUALIFIER: ++ if (!gadget->is_dualspeed) ++ break; ++ value = min (ctrl->wLength, (u16) sizeof dev_qualifier); ++ memcpy (req->buf, &dev_qualifier, value); ++ break; ++ ++ case USB_DT_OTHER_SPEED_CONFIG: ++ if (!gadget->is_dualspeed) ++ break; ++ // FALLTHROUGH ++#endif /* CONFIG_USB_GADGET_DUALSPEED */ ++ case USB_DT_CONFIG: ++ value = config_buf (gadget, req->buf, ++ ctrl->wValue >> 8, ++ ctrl->wValue & 0xff); ++ if (value >= 0) ++ value = min (ctrl->wLength, (u16) value); ++ break; ++ ++ case USB_DT_STRING: ++ /* wIndex == language code. ++ * this driver only handles one language, you can ++ * add string tables for other languages, using ++ * any UTF-8 characters ++ */ ++ value = usb_gadget_get_string (&stringtab, ++ ctrl->wValue & 0xff, req->buf); ++ if (value >= 0) { ++ value = min (ctrl->wLength, (u16) value); ++ } ++ break; ++ } ++ break; ++ ++ /* currently two configs, two speeds */ ++ case USB_REQ_SET_CONFIGURATION: ++ if (ctrl->bRequestType != 0) ++ goto unknown; ++ ++ spin_lock (&dev->lock); ++ value = zero_set_config (dev, ctrl->wValue, GFP_ATOMIC); ++ spin_unlock (&dev->lock); ++ break; ++ case USB_REQ_GET_CONFIGURATION: ++ if (ctrl->bRequestType != USB_DIR_IN) ++ goto unknown; ++ *(u8 *)req->buf = dev->config; ++ value = min (ctrl->wLength, (u16) 1); ++ break; ++ ++ /* until we add altsetting support, or other interfaces, ++ * only 0/0 are possible. pxa2xx only supports 0/0 (poorly) ++ * and already killed pending endpoint I/O. ++ */ ++ case USB_REQ_SET_INTERFACE: ++ ++ if (ctrl->bRequestType != USB_RECIP_INTERFACE) ++ goto unknown; ++ spin_lock (&dev->lock); ++ if (dev->config) { ++ u8 config = dev->config; ++ ++ /* resets interface configuration, forgets about ++ * previous transaction state (queued bufs, etc) ++ * and re-inits endpoint state (toggle etc) ++ * no response queued, just zero status == success. ++ * if we had more than one interface we couldn't ++ * use this "reset the config" shortcut. ++ */ ++ zero_reset_config (dev); ++ zero_set_config (dev, config, GFP_ATOMIC); ++ value = 0; ++ } ++ spin_unlock (&dev->lock); ++ break; ++ case USB_REQ_GET_INTERFACE: ++ if ((ctrl->bRequestType == 0x21) && (ctrl->wIndex == 0x02)) { ++ value = ctrl->wLength; ++ break; ++ } ++ else { ++ if (ctrl->bRequestType != (USB_DIR_IN|USB_RECIP_INTERFACE)) ++ goto unknown; ++ if (!dev->config) ++ break; ++ if (ctrl->wIndex != 0) { ++ value = -EDOM; ++ break; ++ } ++ *(u8 *)req->buf = 0; ++ value = min (ctrl->wLength, (u16) 1); ++ } ++ break; ++ ++ /* ++ * These are the same vendor-specific requests supported by ++ * Intel's USB 2.0 compliance test devices. We exceed that ++ * device spec by allowing multiple-packet requests. ++ */ ++ case 0x5b: /* control WRITE test -- fill the buffer */ ++ if (ctrl->bRequestType != (USB_DIR_OUT|USB_TYPE_VENDOR)) ++ goto unknown; ++ if (ctrl->wValue || ctrl->wIndex) ++ break; ++ /* just read that many bytes into the buffer */ ++ if (ctrl->wLength > USB_BUFSIZ) ++ break; ++ value = ctrl->wLength; ++ break; ++ case 0x5c: /* control READ test -- return the buffer */ ++ if (ctrl->bRequestType != (USB_DIR_IN|USB_TYPE_VENDOR)) ++ goto unknown; ++ if (ctrl->wValue || ctrl->wIndex) ++ break; ++ /* expect those bytes are still in the buffer; send back */ ++ if (ctrl->wLength > USB_BUFSIZ ++ || ctrl->wLength != req->length) ++ break; ++ value = ctrl->wLength; ++ break; ++ ++ case 0x01: // SET_CUR ++ case 0x02: ++ case 0x03: ++ case 0x04: ++ case 0x05: ++ value = ctrl->wLength; ++ break; ++ case 0x81: ++ switch (ctrl->wValue) { ++ case 0x0201: ++ case 0x0202: ++ ((u8*)req->buf)[0] = 0x00; ++ ((u8*)req->buf)[1] = 0xe3; ++ break; ++ case 0x0300: ++ case 0x0500: ++ ((u8*)req->buf)[0] = 0x00; ++ break; ++ } ++ //((u8*)req->buf)[0] = 0x81; ++ //((u8*)req->buf)[1] = 0x81; ++ value = ctrl->wLength; ++ break; ++ case 0x82: ++ switch (ctrl->wValue) { ++ case 0x0201: ++ case 0x0202: ++ ((u8*)req->buf)[0] = 0x00; ++ ((u8*)req->buf)[1] = 0xc3; ++ break; ++ case 0x0300: ++ case 0x0500: ++ ((u8*)req->buf)[0] = 0x00; ++ break; ++ } ++ //((u8*)req->buf)[0] = 0x82; ++ //((u8*)req->buf)[1] = 0x82; ++ value = ctrl->wLength; ++ break; ++ case 0x83: ++ switch (ctrl->wValue) { ++ case 0x0201: ++ case 0x0202: ++ ((u8*)req->buf)[0] = 0x00; ++ ((u8*)req->buf)[1] = 0x00; ++ break; ++ case 0x0300: ++ ((u8*)req->buf)[0] = 0x60; ++ break; ++ case 0x0500: ++ ((u8*)req->buf)[0] = 0x18; ++ break; ++ } ++ //((u8*)req->buf)[0] = 0x83; ++ //((u8*)req->buf)[1] = 0x83; ++ value = ctrl->wLength; ++ break; ++ case 0x84: ++ switch (ctrl->wValue) { ++ case 0x0201: ++ case 0x0202: ++ ((u8*)req->buf)[0] = 0x00; ++ ((u8*)req->buf)[1] = 0x01; ++ break; ++ case 0x0300: ++ case 0x0500: ++ ((u8*)req->buf)[0] = 0x08; ++ break; ++ } ++ //((u8*)req->buf)[0] = 0x84; ++ //((u8*)req->buf)[1] = 0x84; ++ value = ctrl->wLength; ++ break; ++ case 0x85: ++ ((u8*)req->buf)[0] = 0x85; ++ ((u8*)req->buf)[1] = 0x85; ++ value = ctrl->wLength; ++ break; ++ ++ ++ default: ++unknown: ++ printk("unknown control req%02x.%02x v%04x i%04x l%d\n", ++ ctrl->bRequestType, ctrl->bRequest, ++ ctrl->wValue, ctrl->wIndex, ctrl->wLength); ++ } ++ ++ /* respond with data transfer before status phase? */ ++ if (value >= 0) { ++ req->length = value; ++ req->zero = value < ctrl->wLength ++ && (value % gadget->ep0->maxpacket) == 0; ++ value = usb_ep_queue (gadget->ep0, req, GFP_ATOMIC); ++ if (value < 0) { ++ DBG (dev, "ep_queue < 0 --> %d\n", value); ++ req->status = 0; ++ zero_setup_complete (gadget->ep0, req); ++ } ++ } ++ ++ /* device either stalls (value < 0) or reports success */ ++ return value; ++} ++ ++static void ++zero_disconnect (struct usb_gadget *gadget) ++{ ++ struct zero_dev *dev = get_gadget_data (gadget); ++ unsigned long flags; ++ ++ spin_lock_irqsave (&dev->lock, flags); ++ zero_reset_config (dev); ++ ++ /* a more significant application might have some non-usb ++ * activities to quiesce here, saving resources like power ++ * or pushing the notification up a network stack. ++ */ ++ spin_unlock_irqrestore (&dev->lock, flags); ++ ++ /* next we may get setup() calls to enumerate new connections; ++ * or an unbind() during shutdown (including removing module). ++ */ ++} ++ ++static void ++zero_autoresume (unsigned long _dev) ++{ ++ struct zero_dev *dev = (struct zero_dev *) _dev; ++ int status; ++ ++ /* normally the host would be woken up for something ++ * more significant than just a timer firing... ++ */ ++ if (dev->gadget->speed != USB_SPEED_UNKNOWN) { ++ status = usb_gadget_wakeup (dev->gadget); ++ DBG (dev, "wakeup --> %d\n", status); ++ } ++} ++ ++/*-------------------------------------------------------------------------*/ ++ ++static void ++zero_unbind (struct usb_gadget *gadget) ++{ ++ struct zero_dev *dev = get_gadget_data (gadget); ++ ++ DBG (dev, "unbind\n"); ++ ++ /* we've already been disconnected ... no i/o is active */ ++ if (dev->req) ++ free_ep_req (gadget->ep0, dev->req); ++ del_timer_sync (&dev->resume); ++ kfree (dev); ++ set_gadget_data (gadget, NULL); ++} ++ ++static int ++zero_bind (struct usb_gadget *gadget) ++{ ++ struct zero_dev *dev; ++ //struct usb_ep *ep; ++ ++ printk("binding\n"); ++ /* ++ * DRIVER POLICY CHOICE: you may want to do this differently. ++ * One thing to avoid is reusing a bcdDevice revision code ++ * with different host-visible configurations or behavior ++ * restrictions -- using ep1in/ep2out vs ep1out/ep3in, etc ++ */ ++ //device_desc.bcdDevice = __constant_cpu_to_le16 (0x0201); ++ ++ ++ /* ok, we made sense of the hardware ... */ ++ dev = kmalloc (sizeof *dev, SLAB_KERNEL); ++ if (!dev) ++ return -ENOMEM; ++ memset (dev, 0, sizeof *dev); ++ spin_lock_init (&dev->lock); ++ dev->gadget = gadget; ++ set_gadget_data (gadget, dev); ++ ++ /* preallocate control response and buffer */ ++ dev->req = usb_ep_alloc_request (gadget->ep0, GFP_KERNEL); ++ if (!dev->req) ++ goto enomem; ++ dev->req->buf = usb_ep_alloc_buffer (gadget->ep0, USB_BUFSIZ, ++ &dev->req->dma, GFP_KERNEL); ++ if (!dev->req->buf) ++ goto enomem; ++ ++ dev->req->complete = zero_setup_complete; ++ ++ device_desc.bMaxPacketSize0 = gadget->ep0->maxpacket; ++ ++#ifdef CONFIG_USB_GADGET_DUALSPEED ++ /* assume ep0 uses the same value for both speeds ... */ ++ dev_qualifier.bMaxPacketSize0 = device_desc.bMaxPacketSize0; ++ ++ /* and that all endpoints are dual-speed */ ++ //hs_source_desc.bEndpointAddress = fs_source_desc.bEndpointAddress; ++ //hs_sink_desc.bEndpointAddress = fs_sink_desc.bEndpointAddress; ++#endif ++ ++ usb_gadget_set_selfpowered (gadget); ++ ++ init_timer (&dev->resume); ++ dev->resume.function = zero_autoresume; ++ dev->resume.data = (unsigned long) dev; ++ ++ gadget->ep0->driver_data = dev; ++ ++ INFO (dev, "%s, version: " DRIVER_VERSION "\n", longname); ++ INFO (dev, "using %s, OUT %s IN %s\n", gadget->name, ++ EP_OUT_NAME, EP_IN_NAME); ++ ++ snprintf (manufacturer, sizeof manufacturer, ++ UTS_SYSNAME " " UTS_RELEASE " with %s", ++ gadget->name); ++ ++ return 0; ++ ++enomem: ++ zero_unbind (gadget); ++ return -ENOMEM; ++} ++ ++/*-------------------------------------------------------------------------*/ ++ ++static void ++zero_suspend (struct usb_gadget *gadget) ++{ ++ struct zero_dev *dev = get_gadget_data (gadget); ++ ++ if (gadget->speed == USB_SPEED_UNKNOWN) ++ return; ++ ++ if (autoresume) { ++ mod_timer (&dev->resume, jiffies + (HZ * autoresume)); ++ DBG (dev, "suspend, wakeup in %d seconds\n", autoresume); ++ } else ++ DBG (dev, "suspend\n"); ++} ++ ++static void ++zero_resume (struct usb_gadget *gadget) ++{ ++ struct zero_dev *dev = get_gadget_data (gadget); ++ ++ DBG (dev, "resume\n"); ++ del_timer (&dev->resume); ++} ++ ++ ++/*-------------------------------------------------------------------------*/ ++ ++static struct usb_gadget_driver zero_driver = { ++#ifdef CONFIG_USB_GADGET_DUALSPEED ++ .speed = USB_SPEED_HIGH, ++#else ++ .speed = USB_SPEED_FULL, ++#endif ++ .function = (char *) longname, ++ .bind = zero_bind, ++ .unbind = zero_unbind, ++ ++ .setup = zero_setup, ++ .disconnect = zero_disconnect, ++ ++ .suspend = zero_suspend, ++ .resume = zero_resume, ++ ++ .driver = { ++ .name = (char *) shortname, ++ // .shutdown = ... ++ // .suspend = ... ++ // .resume = ... ++ }, ++}; ++ ++MODULE_AUTHOR ("David Brownell"); ++MODULE_LICENSE ("Dual BSD/GPL"); ++ ++static struct proc_dir_entry *pdir, *pfile; ++ ++static int isoc_read_data (char *page, char **start, ++ off_t off, int count, ++ int *eof, void *data) ++{ ++ int i; ++ static int c = 0; ++ static int done = 0; ++ static int s = 0; ++ ++/* ++ printk ("\ncount: %d\n", count); ++ printk ("rbuf_start: %d\n", rbuf_start); ++ printk ("rbuf_len: %d\n", rbuf_len); ++ printk ("off: %d\n", off); ++ printk ("start: %p\n\n", *start); ++*/ ++ if (done) { ++ c = 0; ++ done = 0; ++ *eof = 1; ++ return 0; ++ } ++ ++ if (c == 0) { ++ if (rbuf_len == RBUF_LEN) ++ s = rbuf_start; ++ else s = 0; ++ } ++ ++ for (i=0; i<count && c<rbuf_len; i++, c++) { ++ page[i] = rbuf[(c+s) % RBUF_LEN]; ++ } ++ *start = page; ++ ++ if (c >= rbuf_len) { ++ *eof = 1; ++ done = 1; ++ } ++ ++ ++ return i; ++} ++ ++static int __init init (void) ++{ ++ ++ int retval = 0; ++ ++ pdir = proc_mkdir("isoc_test", NULL); ++ if(pdir == NULL) { ++ retval = -ENOMEM; ++ printk("Error creating dir\n"); ++ goto done; ++ } ++ pdir->owner = THIS_MODULE; ++ ++ pfile = create_proc_read_entry("isoc_data", ++ 0444, pdir, ++ isoc_read_data, ++ NULL); ++ if (pfile == NULL) { ++ retval = -ENOMEM; ++ printk("Error creating file\n"); ++ goto no_file; ++ } ++ pfile->owner = THIS_MODULE; ++ ++ return usb_gadget_register_driver (&zero_driver); ++ ++ no_file: ++ remove_proc_entry("isoc_data", NULL); ++ done: ++ return retval; ++} ++module_init (init); ++ ++static void __exit cleanup (void) ++{ ++ ++ usb_gadget_unregister_driver (&zero_driver); ++ ++ remove_proc_entry("isoc_data", pdir); ++ remove_proc_entry("isoc_test", NULL); ++} ++module_exit (cleanup); +diff --git a/drivers/usb/host/dwc_otg/dwc_cfi_common.h b/drivers/usb/host/dwc_otg/dwc_cfi_common.h +new file mode 100644 +index 0000000..7770e20 +--- /dev/null ++++ b/drivers/usb/host/dwc_otg/dwc_cfi_common.h +@@ -0,0 +1,142 @@ ++/* ========================================================================== ++ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, ++ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless ++ * otherwise expressly agreed to in writing between Synopsys and you. ++ * ++ * The Software IS NOT an item of Licensed Software or Licensed Product under ++ * any End User Software License Agreement or Agreement for Licensed Product ++ * with Synopsys or any supplement thereto. You are permitted to use and ++ * redistribute this Software in source and binary forms, with or without ++ * modification, provided that redistributions of source code must retain this ++ * notice. You may not view, use, disclose, copy or distribute this file or ++ * any information contained herein except pursuant to this license grant from ++ * Synopsys. If you do not agree with this notice, including the disclaimer ++ * below, then you are not authorized to use the Software. ++ * ++ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS ++ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS 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. ++ * ========================================================================== */ ++ ++#if !defined(__DWC_CFI_COMMON_H__) ++#define __DWC_CFI_COMMON_H__ ++ ++//#include <linux/types.h> ++ ++/** ++ * @file ++ * ++ * This file contains the CFI specific common constants, interfaces ++ * (functions and macros) and structures for Linux. No PCD specific ++ * data structure or definition is to be included in this file. ++ * ++ */ ++ ++/** This is a request for all Core Features */ ++#define VEN_CORE_GET_FEATURES 0xB1 ++ ++/** This is a request to get the value of a specific Core Feature */ ++#define VEN_CORE_GET_FEATURE 0xB2 ++ ++/** This command allows the host to set the value of a specific Core Feature */ ++#define VEN_CORE_SET_FEATURE 0xB3 ++ ++/** This command allows the host to set the default values of ++ * either all or any specific Core Feature ++ */ ++#define VEN_CORE_RESET_FEATURES 0xB4 ++ ++/** This command forces the PCD to write the deferred values of a Core Features */ ++#define VEN_CORE_ACTIVATE_FEATURES 0xB5 ++ ++/** This request reads a DWORD value from a register at the specified offset */ ++#define VEN_CORE_READ_REGISTER 0xB6 ++ ++/** This request writes a DWORD value into a register at the specified offset */ ++#define VEN_CORE_WRITE_REGISTER 0xB7 ++ ++/** This structure is the header of the Core Features dataset returned to ++ * the Host ++ */ ++struct cfi_all_features_header { ++/** The features header structure length is */ ++#define CFI_ALL_FEATURES_HDR_LEN 8 ++ /** ++ * The total length of the features dataset returned to the Host ++ */ ++ uint16_t wTotalLen; ++ ++ /** ++ * CFI version number inBinary-Coded Decimal (i.e., 1.00 is 100H). ++ * This field identifies the version of the CFI Specification with which ++ * the device is compliant. ++ */ ++ uint16_t wVersion; ++ ++ /** The ID of the Core */ ++ uint16_t wCoreID; ++#define CFI_CORE_ID_UDC 1 ++#define CFI_CORE_ID_OTG 2 ++#define CFI_CORE_ID_WUDEV 3 ++ ++ /** Number of features returned by VEN_CORE_GET_FEATURES request */ ++ uint16_t wNumFeatures; ++} UPACKED; ++ ++typedef struct cfi_all_features_header cfi_all_features_header_t; ++ ++/** This structure is a header of the Core Feature descriptor dataset returned to ++ * the Host after the VEN_CORE_GET_FEATURES request ++ */ ++struct cfi_feature_desc_header { ++#define CFI_FEATURE_DESC_HDR_LEN 8 ++ ++ /** The feature ID */ ++ uint16_t wFeatureID; ++ ++ /** Length of this feature descriptor in bytes - including the ++ * length of the feature name string ++ */ ++ uint16_t wLength; ++ ++ /** The data length of this feature in bytes */ ++ uint16_t wDataLength; ++ ++ /** ++ * Attributes of this features ++ * D0: Access rights ++ * 0 - Read/Write ++ * 1 - Read only ++ */ ++ uint8_t bmAttributes; ++#define CFI_FEATURE_ATTR_RO 1 ++#define CFI_FEATURE_ATTR_RW 0 ++ ++ /** Length of the feature name in bytes */ ++ uint8_t bNameLen; ++ ++ /** The feature name buffer */ ++ //uint8_t *name; ++} UPACKED; ++ ++typedef struct cfi_feature_desc_header cfi_feature_desc_header_t; ++ ++/** ++ * This structure describes a NULL terminated string referenced by its id field. ++ * It is very similar to usb_string structure but has the id field type set to 16-bit. ++ */ ++struct cfi_string { ++ uint16_t id; ++ const uint8_t *s; ++}; ++typedef struct cfi_string cfi_string_t; ++ ++#endif +diff --git a/drivers/usb/host/dwc_otg/dwc_otg_adp.c b/drivers/usb/host/dwc_otg/dwc_otg_adp.c +new file mode 100644 +index 0000000..ce0618d +--- /dev/null ++++ b/drivers/usb/host/dwc_otg/dwc_otg_adp.c +@@ -0,0 +1,854 @@ ++/* ========================================================================== ++ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_adp.c $ ++ * $Revision: #12 $ ++ * $Date: 2011/10/26 $ ++ * $Change: 1873028 $ ++ * ++ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, ++ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless ++ * otherwise expressly agreed to in writing between Synopsys and you. ++ * ++ * The Software IS NOT an item of Licensed Software or Licensed Product under ++ * any End User Software License Agreement or Agreement for Licensed Product ++ * with Synopsys or any supplement thereto. You are permitted to use and ++ * redistribute this Software in source and binary forms, with or without ++ * modification, provided that redistributions of source code must retain this ++ * notice. You may not view, use, disclose, copy or distribute this file or ++ * any information contained herein except pursuant to this license grant from ++ * Synopsys. If you do not agree with this notice, including the disclaimer ++ * below, then you are not authorized to use the Software. ++ * ++ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS ++ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS BE LIABLE FOR ANY DIRECT, ++ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ++ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR ++ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER ++ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT ++ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY ++ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH ++ * DAMAGE. ++ * ========================================================================== */ ++ ++#include "dwc_os.h" ++#include "dwc_otg_regs.h" ++#include "dwc_otg_cil.h" ++#include "dwc_otg_adp.h" ++ ++/** @file ++ * ++ * This file contains the most of the Attach Detect Protocol implementation for ++ * the driver to support OTG Rev2.0. ++ * ++ */ ++ ++void dwc_otg_adp_write_reg(dwc_otg_core_if_t * core_if, uint32_t value) ++{ ++ adpctl_data_t adpctl; ++ ++ adpctl.d32 = value; ++ adpctl.b.ar = 0x2; ++ ++ DWC_WRITE_REG32(&core_if->core_global_regs->adpctl, adpctl.d32); ++ ++ while (adpctl.b.ar) { ++ adpctl.d32 = DWC_READ_REG32(&core_if->core_global_regs->adpctl); ++ } ++ ++} ++ ++/** ++ * Function is called to read ADP registers ++ */ ++uint32_t dwc_otg_adp_read_reg(dwc_otg_core_if_t * core_if) ++{ ++ adpctl_data_t adpctl; ++ ++ adpctl.d32 = 0; ++ adpctl.b.ar = 0x1; ++ ++ DWC_WRITE_REG32(&core_if->core_global_regs->adpctl, adpctl.d32); ++ ++ while (adpctl.b.ar) { ++ adpctl.d32 = DWC_READ_REG32(&core_if->core_global_regs->adpctl); ++ } ++ ++ return adpctl.d32; ++} ++ ++/** ++ * Function is called to read ADPCTL register and filter Write-clear bits ++ */ ++uint32_t dwc_otg_adp_read_reg_filter(dwc_otg_core_if_t * core_if) ++{ ++ adpctl_data_t adpctl; ++ ++ adpctl.d32 = dwc_otg_adp_read_reg(core_if); ++ adpctl.b.adp_tmout_int = 0; ++ adpctl.b.adp_prb_int = 0; ++ adpctl.b.adp_tmout_int = 0; ++ ++ return adpctl.d32; ++} ++ ++/** ++ * Function is called to write ADP registers ++ */ ++void dwc_otg_adp_modify_reg(dwc_otg_core_if_t * core_if, uint32_t clr, ++ uint32_t set) ++{ ++ dwc_otg_adp_write_reg(core_if, ++ (dwc_otg_adp_read_reg(core_if) & (~clr)) | set); ++} ++ ++static void adp_sense_timeout(void *ptr) ++{ ++ dwc_otg_core_if_t *core_if = (dwc_otg_core_if_t *) ptr; ++ core_if->adp.sense_timer_started = 0; ++ DWC_PRINTF("ADP SENSE TIMEOUT\n"); ++ if (core_if->adp_enable) { ++ dwc_otg_adp_sense_stop(core_if); ++ dwc_otg_adp_probe_start(core_if); ++ } ++} ++ ++/** ++ * This function is called when the ADP vbus timer expires. Timeout is 1.1s. ++ */ ++static void adp_vbuson_timeout(void *ptr) ++{ ++ gpwrdn_data_t gpwrdn; ++ dwc_otg_core_if_t *core_if = (dwc_otg_core_if_t *) ptr; ++ hprt0_data_t hprt0 = {.d32 = 0 }; ++ pcgcctl_data_t pcgcctl = {.d32 = 0 }; ++ DWC_PRINTF("%s: 1.1 seconds expire after turning on VBUS\n",__FUNCTION__); ++ if (core_if) { ++ core_if->adp.vbuson_timer_started = 0; ++ /* Turn off vbus */ ++ hprt0.b.prtpwr = 1; ++ DWC_MODIFY_REG32(core_if->host_if->hprt0, hprt0.d32, 0); ++ gpwrdn.d32 = 0; ++ ++ /* Power off the core */ ++ if (core_if->power_down == 2) { ++ /* Enable Wakeup Logic */ ++// gpwrdn.b.wkupactiv = 1; ++ gpwrdn.b.pmuactv = 0; ++ gpwrdn.b.pwrdnrstn = 1; ++ gpwrdn.b.pwrdnclmp = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, 0, ++ gpwrdn.d32); ++ ++ /* Suspend the Phy Clock */ ++ pcgcctl.b.stoppclk = 1; ++ DWC_MODIFY_REG32(core_if->pcgcctl, 0, pcgcctl.d32); ++ ++ /* Switch on VDD */ ++// gpwrdn.b.wkupactiv = 1; ++ gpwrdn.b.pmuactv = 1; ++ gpwrdn.b.pwrdnrstn = 1; ++ gpwrdn.b.pwrdnclmp = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, 0, ++ gpwrdn.d32); ++ } else { ++ /* Enable Power Down Logic */ ++ gpwrdn.b.pmuintsel = 1; ++ gpwrdn.b.pmuactv = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, 0, gpwrdn.d32); ++ } ++ ++ /* Power off the core */ ++ if (core_if->power_down == 2) { ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pwrdnswtch = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, ++ gpwrdn.d32, 0); ++ } ++ ++ /* Unmask SRP detected interrupt from Power Down Logic */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.srp_det_msk = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, 0, gpwrdn.d32); ++ ++ dwc_otg_adp_probe_start(core_if); ++ dwc_otg_dump_global_registers(core_if); ++ dwc_otg_dump_host_registers(core_if); ++ } ++ ++} ++ ++/** ++ * Start the ADP Initial Probe timer to detect if Port Connected interrupt is ++ * not asserted within 1.1 seconds. ++ * ++ * @param core_if the pointer to core_if strucure. ++ */ ++void dwc_otg_adp_vbuson_timer_start(dwc_otg_core_if_t * core_if) ++{ ++ core_if->adp.vbuson_timer_started = 1; ++ if (core_if->adp.vbuson_timer) ++ { ++ DWC_PRINTF("SCHEDULING VBUSON TIMER\n"); ++ /* 1.1 secs + 60ms necessary for cil_hcd_start*/ ++ DWC_TIMER_SCHEDULE(core_if->adp.vbuson_timer, 1160); ++ } else { ++ DWC_WARN("VBUSON_TIMER = %p\n",core_if->adp.vbuson_timer); ++ } ++} ++ ++#if 0 ++/** ++ * Masks all DWC OTG core interrupts ++ * ++ */ ++static void mask_all_interrupts(dwc_otg_core_if_t * core_if) ++{ ++ int i; ++ gahbcfg_data_t ahbcfg = {.d32 = 0 }; ++ ++ /* Mask Host Interrupts */ ++ ++ /* Clear and disable HCINTs */ ++ for (i = 0; i < core_if->core_params->host_channels; i++) { ++ DWC_WRITE_REG32(&core_if->host_if->hc_regs[i]->hcintmsk, 0); ++ DWC_WRITE_REG32(&core_if->host_if->hc_regs[i]->hcint, 0xFFFFFFFF); ++ ++ } ++ ++ /* Clear and disable HAINT */ ++ DWC_WRITE_REG32(&core_if->host_if->host_global_regs->haintmsk, 0x0000); ++ DWC_WRITE_REG32(&core_if->host_if->host_global_regs->haint, 0xFFFFFFFF); ++ ++ /* Mask Device Interrupts */ ++ if (!core_if->multiproc_int_enable) { ++ /* Clear and disable IN Endpoint interrupts */ ++ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->diepmsk, 0); ++ for (i = 0; i <= core_if->dev_if->num_in_eps; i++) { ++ DWC_WRITE_REG32(&core_if->dev_if->in_ep_regs[i]-> ++ diepint, 0xFFFFFFFF); ++ } ++ ++ /* Clear and disable OUT Endpoint interrupts */ ++ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->doepmsk, 0); ++ for (i = 0; i <= core_if->dev_if->num_out_eps; i++) { ++ DWC_WRITE_REG32(&core_if->dev_if->out_ep_regs[i]-> ++ doepint, 0xFFFFFFFF); ++ } ++ ++ /* Clear and disable DAINT */ ++ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->daint, ++ 0xFFFFFFFF); ++ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->daintmsk, 0); ++ } else { ++ for (i = 0; i < core_if->dev_if->num_in_eps; ++i) { ++ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs-> ++ diepeachintmsk[i], 0); ++ DWC_WRITE_REG32(&core_if->dev_if->in_ep_regs[i]-> ++ diepint, 0xFFFFFFFF); ++ } ++ ++ for (i = 0; i < core_if->dev_if->num_out_eps; ++i) { ++ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs-> ++ doepeachintmsk[i], 0); ++ DWC_WRITE_REG32(&core_if->dev_if->out_ep_regs[i]-> ++ doepint, 0xFFFFFFFF); ++ } ++ ++ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->deachintmsk, ++ 0); ++ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->deachint, ++ 0xFFFFFFFF); ++ ++ } ++ ++ /* Disable interrupts */ ++ ahbcfg.b.glblintrmsk = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gahbcfg, ahbcfg.d32, 0); ++ ++ /* Disable all interrupts. */ ++ DWC_WRITE_REG32(&core_if->core_global_regs->gintmsk, 0); ++ ++ /* Clear any pending interrupts */ ++ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, 0xFFFFFFFF); ++ ++ /* Clear any pending OTG Interrupts */ ++ DWC_WRITE_REG32(&core_if->core_global_regs->gotgint, 0xFFFFFFFF); ++} ++ ++/** ++ * Unmask Port Connection Detected interrupt ++ * ++ */ ++static void unmask_conn_det_intr(dwc_otg_core_if_t * core_if) ++{ ++ gintmsk_data_t gintmsk = {.d32 = 0,.b.portintr = 1 }; ++ ++ DWC_WRITE_REG32(&core_if->core_global_regs->gintmsk, gintmsk.d32); ++} ++#endif ++ ++/** ++ * Starts the ADP Probing ++ * ++ * @param core_if the pointer to core_if structure. ++ */ ++uint32_t dwc_otg_adp_probe_start(dwc_otg_core_if_t * core_if) ++{ ++ ++ adpctl_data_t adpctl = {.d32 = 0}; ++ gpwrdn_data_t gpwrdn; ++#if 0 ++ adpctl_data_t adpctl_int = {.d32 = 0, .b.adp_prb_int = 1, ++ .b.adp_sns_int = 1, b.adp_tmout_int}; ++#endif ++ dwc_otg_disable_global_interrupts(core_if); ++ DWC_PRINTF("ADP Probe Start\n"); ++ core_if->adp.probe_enabled = 1; ++ ++ adpctl.b.adpres = 1; ++ dwc_otg_adp_write_reg(core_if, adpctl.d32); ++ ++ while (adpctl.b.adpres) { ++ adpctl.d32 = dwc_otg_adp_read_reg(core_if); ++ } ++ ++ adpctl.d32 = 0; ++ gpwrdn.d32 = DWC_READ_REG32(&core_if->core_global_regs->gpwrdn); ++ ++ /* In Host mode unmask SRP detected interrupt */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.sts_chngint_msk = 1; ++ if (!gpwrdn.b.idsts) { ++ gpwrdn.b.srp_det_msk = 1; ++ } ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, 0, gpwrdn.d32); ++ ++ adpctl.b.adp_tmout_int_msk = 1; ++ adpctl.b.adp_prb_int_msk = 1; ++ adpctl.b.prb_dschg = 1; ++ adpctl.b.prb_delta = 1; ++ adpctl.b.prb_per = 1; ++ adpctl.b.adpen = 1; ++ adpctl.b.enaprb = 1; ++ ++ dwc_otg_adp_write_reg(core_if, adpctl.d32); ++ DWC_PRINTF("ADP Probe Finish\n"); ++ return 0; ++} ++ ++/** ++ * Starts the ADP Sense timer to detect if ADP Sense interrupt is not asserted ++ * within 3 seconds. ++ * ++ * @param core_if the pointer to core_if strucure. ++ */ ++void dwc_otg_adp_sense_timer_start(dwc_otg_core_if_t * core_if) ++{ ++ core_if->adp.sense_timer_started = 1; ++ DWC_TIMER_SCHEDULE(core_if->adp.sense_timer, 3000 /* 3 secs */ ); ++} ++ ++/** ++ * Starts the ADP Sense ++ * ++ * @param core_if the pointer to core_if strucure. ++ */ ++uint32_t dwc_otg_adp_sense_start(dwc_otg_core_if_t * core_if) ++{ ++ adpctl_data_t adpctl; ++ ++ DWC_PRINTF("ADP Sense Start\n"); ++ ++ /* Unmask ADP sense interrupt and mask all other from the core */ ++ adpctl.d32 = dwc_otg_adp_read_reg_filter(core_if); ++ adpctl.b.adp_sns_int_msk = 1; ++ dwc_otg_adp_write_reg(core_if, adpctl.d32); ++ dwc_otg_disable_global_interrupts(core_if); // vahrama ++ ++ /* Set ADP reset bit*/ ++ adpctl.d32 = dwc_otg_adp_read_reg_filter(core_if); ++ adpctl.b.adpres = 1; ++ dwc_otg_adp_write_reg(core_if, adpctl.d32); ++ ++ while (adpctl.b.adpres) { ++ adpctl.d32 = dwc_otg_adp_read_reg(core_if); ++ } ++ ++ adpctl.b.adpres = 0; ++ adpctl.b.adpen = 1; ++ adpctl.b.enasns = 1; ++ dwc_otg_adp_write_reg(core_if, adpctl.d32); ++ ++ dwc_otg_adp_sense_timer_start(core_if); ++ ++ return 0; ++} ++ ++/** ++ * Stops the ADP Probing ++ * ++ * @param core_if the pointer to core_if strucure. ++ */ ++uint32_t dwc_otg_adp_probe_stop(dwc_otg_core_if_t * core_if) ++{ ++ ++ adpctl_data_t adpctl; ++ DWC_PRINTF("Stop ADP probe\n"); ++ core_if->adp.probe_enabled = 0; ++ core_if->adp.probe_counter = 0; ++ adpctl.d32 = dwc_otg_adp_read_reg(core_if); ++ ++ adpctl.b.adpen = 0; ++ adpctl.b.adp_prb_int = 1; ++ adpctl.b.adp_tmout_int = 1; ++ adpctl.b.adp_sns_int = 1; ++ dwc_otg_adp_write_reg(core_if, adpctl.d32); ++ ++ return 0; ++} ++ ++/** ++ * Stops the ADP Sensing ++ * ++ * @param core_if the pointer to core_if strucure. ++ */ ++uint32_t dwc_otg_adp_sense_stop(dwc_otg_core_if_t * core_if) ++{ ++ adpctl_data_t adpctl; ++ ++ core_if->adp.sense_enabled = 0; ++ ++ adpctl.d32 = dwc_otg_adp_read_reg_filter(core_if); ++ adpctl.b.enasns = 0; ++ adpctl.b.adp_sns_int = 1; ++ dwc_otg_adp_write_reg(core_if, adpctl.d32); ++ ++ return 0; ++} ++ ++/** ++ * Called to turn on the VBUS after initial ADP probe in host mode. ++ * If port power was already enabled in cil_hcd_start function then ++ * only schedule a timer. ++ * ++ * @param core_if the pointer to core_if structure. ++ */ ++void dwc_otg_adp_turnon_vbus(dwc_otg_core_if_t * core_if) ++{ ++ hprt0_data_t hprt0 = {.d32 = 0 }; ++ hprt0.d32 = dwc_otg_read_hprt0(core_if); ++ DWC_PRINTF("Turn on VBUS for 1.1s, port power is %d\n", hprt0.b.prtpwr); ++ ++ if (hprt0.b.prtpwr == 0) { ++ hprt0.b.prtpwr = 1; ++ //DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); ++ } ++ ++ dwc_otg_adp_vbuson_timer_start(core_if); ++} ++ ++/** ++ * Called right after driver is loaded ++ * to perform initial actions for ADP ++ * ++ * @param core_if the pointer to core_if structure. ++ * @param is_host - flag for current mode of operation either from GINTSTS or GPWRDN ++ */ ++void dwc_otg_adp_start(dwc_otg_core_if_t * core_if, uint8_t is_host) ++{ ++ gpwrdn_data_t gpwrdn; ++ ++ DWC_PRINTF("ADP Initial Start\n"); ++ core_if->adp.adp_started = 1; ++ ++ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, 0xFFFFFFFF); ++ dwc_otg_disable_global_interrupts(core_if); ++ if (is_host) { ++ DWC_PRINTF("HOST MODE\n"); ++ /* Enable Power Down Logic Interrupt*/ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pmuintsel = 1; ++ gpwrdn.b.pmuactv = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, 0, gpwrdn.d32); ++ /* Initialize first ADP probe to obtain Ramp Time value */ ++ core_if->adp.initial_probe = 1; ++ dwc_otg_adp_probe_start(core_if); ++ } else { ++ gotgctl_data_t gotgctl; ++ gotgctl.d32 = DWC_READ_REG32(&core_if->core_global_regs->gotgctl); ++ DWC_PRINTF("DEVICE MODE\n"); ++ if (gotgctl.b.bsesvld == 0) { ++ /* Enable Power Down Logic Interrupt*/ ++ gpwrdn.d32 = 0; ++ DWC_PRINTF("VBUS is not valid - start ADP probe\n"); ++ gpwrdn.b.pmuintsel = 1; ++ gpwrdn.b.pmuactv = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, 0, gpwrdn.d32); ++ core_if->adp.initial_probe = 1; ++ dwc_otg_adp_probe_start(core_if); ++ } else { ++ DWC_PRINTF("VBUS is valid - initialize core as a Device\n"); ++ core_if->op_state = B_PERIPHERAL; ++ dwc_otg_core_init(core_if); ++ dwc_otg_enable_global_interrupts(core_if); ++ cil_pcd_start(core_if); ++ dwc_otg_dump_global_registers(core_if); ++ dwc_otg_dump_dev_registers(core_if); ++ } ++ } ++} ++ ++void dwc_otg_adp_init(dwc_otg_core_if_t * core_if) ++{ ++ core_if->adp.adp_started = 0; ++ core_if->adp.initial_probe = 0; ++ core_if->adp.probe_timer_values[0] = -1; ++ core_if->adp.probe_timer_values[1] = -1; ++ core_if->adp.probe_enabled = 0; ++ core_if->adp.sense_enabled = 0; ++ core_if->adp.sense_timer_started = 0; ++ core_if->adp.vbuson_timer_started = 0; ++ core_if->adp.probe_counter = 0; ++ core_if->adp.gpwrdn = 0; ++ core_if->adp.attached = DWC_OTG_ADP_UNKOWN; ++ /* Initialize timers */ ++ core_if->adp.sense_timer = ++ DWC_TIMER_ALLOC("ADP SENSE TIMER", adp_sense_timeout, core_if); ++ core_if->adp.vbuson_timer = ++ DWC_TIMER_ALLOC("ADP VBUS ON TIMER", adp_vbuson_timeout, core_if); ++ if (!core_if->adp.sense_timer || !core_if->adp.vbuson_timer) ++ { ++ DWC_ERROR("Could not allocate memory for ADP timers\n"); ++ } ++} ++ ++void dwc_otg_adp_remove(dwc_otg_core_if_t * core_if) ++{ ++ gpwrdn_data_t gpwrdn = { .d32 = 0 }; ++ gpwrdn.b.pmuintsel = 1; ++ gpwrdn.b.pmuactv = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ ++ if (core_if->adp.probe_enabled) ++ dwc_otg_adp_probe_stop(core_if); ++ if (core_if->adp.sense_enabled) ++ dwc_otg_adp_sense_stop(core_if); ++ if (core_if->adp.sense_timer_started) ++ DWC_TIMER_CANCEL(core_if->adp.sense_timer); ++ if (core_if->adp.vbuson_timer_started) ++ DWC_TIMER_CANCEL(core_if->adp.vbuson_timer); ++ DWC_TIMER_FREE(core_if->adp.sense_timer); ++ DWC_TIMER_FREE(core_if->adp.vbuson_timer); ++} ++ ++///////////////////////////////////////////////////////////////////// ++////////////// ADP Interrupt Handlers /////////////////////////////// ++///////////////////////////////////////////////////////////////////// ++/** ++ * This function sets Ramp Timer values ++ */ ++static uint32_t set_timer_value(dwc_otg_core_if_t * core_if, uint32_t val) ++{ ++ if (core_if->adp.probe_timer_values[0] == -1) { ++ core_if->adp.probe_timer_values[0] = val; ++ core_if->adp.probe_timer_values[1] = -1; ++ return 1; ++ } else { ++ core_if->adp.probe_timer_values[1] = ++ core_if->adp.probe_timer_values[0]; ++ core_if->adp.probe_timer_values[0] = val; ++ return 0; ++ } ++} ++ ++/** ++ * This function compares Ramp Timer values ++ */ ++static uint32_t compare_timer_values(dwc_otg_core_if_t * core_if) ++{ ++ uint32_t diff; ++ if (core_if->adp.probe_timer_values[0]>=core_if->adp.probe_timer_values[1]) ++ diff = core_if->adp.probe_timer_values[0]-core_if->adp.probe_timer_values[1]; ++ else ++ diff = core_if->adp.probe_timer_values[1]-core_if->adp.probe_timer_values[0]; ++ if(diff < 2) { ++ return 0; ++ } else { ++ return 1; ++ } ++} ++ ++/** ++ * This function handles ADP Probe Interrupts ++ */ ++static int32_t dwc_otg_adp_handle_prb_intr(dwc_otg_core_if_t * core_if, ++ uint32_t val) ++{ ++ adpctl_data_t adpctl = {.d32 = 0 }; ++ gpwrdn_data_t gpwrdn, temp; ++ adpctl.d32 = val; ++ ++ temp.d32 = DWC_READ_REG32(&core_if->core_global_regs->gpwrdn); ++ core_if->adp.probe_counter++; ++ core_if->adp.gpwrdn = DWC_READ_REG32(&core_if->core_global_regs->gpwrdn); ++ if (adpctl.b.rtim == 0 && !temp.b.idsts){ ++ DWC_PRINTF("RTIM value is 0\n"); ++ goto exit; ++ } ++ if (set_timer_value(core_if, adpctl.b.rtim) && ++ core_if->adp.initial_probe) { ++ core_if->adp.initial_probe = 0; ++ dwc_otg_adp_probe_stop(core_if); ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pmuactv = 1; ++ gpwrdn.b.pmuintsel = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, 0xFFFFFFFF); ++ ++ /* check which value is for device mode and which for Host mode */ ++ if (!temp.b.idsts) { /* considered host mode value is 0 */ ++ /* ++ * Turn on VBUS after initial ADP probe. ++ */ ++ core_if->op_state = A_HOST; ++ dwc_otg_enable_global_interrupts(core_if); ++ DWC_SPINUNLOCK(core_if->lock); ++ cil_hcd_start(core_if); ++ dwc_otg_adp_turnon_vbus(core_if); ++ DWC_SPINLOCK(core_if->lock); ++ } else { ++ /* ++ * Initiate SRP after initial ADP probe. ++ */ ++ dwc_otg_enable_global_interrupts(core_if); ++ dwc_otg_initiate_srp(core_if); ++ } ++ } else if (core_if->adp.probe_counter > 2){ ++ gpwrdn.d32 = DWC_READ_REG32(&core_if->core_global_regs->gpwrdn); ++ if (compare_timer_values(core_if)) { ++ DWC_PRINTF("Difference in timer values !!! \n"); ++// core_if->adp.attached = DWC_OTG_ADP_ATTACHED; ++ dwc_otg_adp_probe_stop(core_if); ++ ++ /* Power on the core */ ++ if (core_if->power_down == 2) { ++ gpwrdn.b.pwrdnswtch = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs-> ++ gpwrdn, 0, gpwrdn.d32); ++ } ++ ++ /* check which value is for device mode and which for Host mode */ ++ if (!temp.b.idsts) { /* considered host mode value is 0 */ ++ /* Disable Interrupt from Power Down Logic */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pmuintsel = 1; ++ gpwrdn.b.pmuactv = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs-> ++ gpwrdn, gpwrdn.d32, 0); ++ ++ /* ++ * Initialize the Core for Host mode. ++ */ ++ core_if->op_state = A_HOST; ++ dwc_otg_core_init(core_if); ++ dwc_otg_enable_global_interrupts(core_if); ++ cil_hcd_start(core_if); ++ } else { ++ gotgctl_data_t gotgctl; ++ /* Mask SRP detected interrupt from Power Down Logic */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.srp_det_msk = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs-> ++ gpwrdn, gpwrdn.d32, 0); ++ ++ /* Disable Power Down Logic */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pmuintsel = 1; ++ gpwrdn.b.pmuactv = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs-> ++ gpwrdn, gpwrdn.d32, 0); ++ ++ /* ++ * Initialize the Core for Device mode. ++ */ ++ core_if->op_state = B_PERIPHERAL; ++ dwc_otg_core_init(core_if); ++ dwc_otg_enable_global_interrupts(core_if); ++ cil_pcd_start(core_if); ++ ++ gotgctl.d32 = DWC_READ_REG32(&core_if->core_global_regs->gotgctl); ++ if (!gotgctl.b.bsesvld) { ++ dwc_otg_initiate_srp(core_if); ++ } ++ } ++ } ++ if (core_if->power_down == 2) { ++ if (gpwrdn.b.bsessvld) { ++ /* Mask SRP detected interrupt from Power Down Logic */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.srp_det_msk = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ ++ /* Disable Power Down Logic */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pmuactv = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ ++ /* ++ * Initialize the Core for Device mode. ++ */ ++ core_if->op_state = B_PERIPHERAL; ++ dwc_otg_core_init(core_if); ++ dwc_otg_enable_global_interrupts(core_if); ++ cil_pcd_start(core_if); ++ } ++ } ++ } ++exit: ++ /* Clear interrupt */ ++ adpctl.d32 = dwc_otg_adp_read_reg(core_if); ++ adpctl.b.adp_prb_int = 1; ++ dwc_otg_adp_write_reg(core_if, adpctl.d32); ++ ++ return 0; ++} ++ ++/** ++ * This function hadles ADP Sense Interrupt ++ */ ++static int32_t dwc_otg_adp_handle_sns_intr(dwc_otg_core_if_t * core_if) ++{ ++ adpctl_data_t adpctl; ++ /* Stop ADP Sense timer */ ++ DWC_TIMER_CANCEL(core_if->adp.sense_timer); ++ ++ /* Restart ADP Sense timer */ ++ dwc_otg_adp_sense_timer_start(core_if); ++ ++ /* Clear interrupt */ ++ adpctl.d32 = dwc_otg_adp_read_reg(core_if); ++ adpctl.b.adp_sns_int = 1; ++ dwc_otg_adp_write_reg(core_if, adpctl.d32); ++ ++ return 0; ++} ++ ++/** ++ * This function handles ADP Probe Interrupts ++ */ ++static int32_t dwc_otg_adp_handle_prb_tmout_intr(dwc_otg_core_if_t * core_if, ++ uint32_t val) ++{ ++ adpctl_data_t adpctl = {.d32 = 0 }; ++ adpctl.d32 = val; ++ set_timer_value(core_if, adpctl.b.rtim); ++ ++ /* Clear interrupt */ ++ adpctl.d32 = dwc_otg_adp_read_reg(core_if); ++ adpctl.b.adp_tmout_int = 1; ++ dwc_otg_adp_write_reg(core_if, adpctl.d32); ++ ++ return 0; ++} ++ ++/** ++ * ADP Interrupt handler. ++ * ++ */ ++int32_t dwc_otg_adp_handle_intr(dwc_otg_core_if_t * core_if) ++{ ++ int retval = 0; ++ adpctl_data_t adpctl = {.d32 = 0}; ++ ++ adpctl.d32 = dwc_otg_adp_read_reg(core_if); ++ DWC_PRINTF("ADPCTL = %08x\n",adpctl.d32); ++ ++ if (adpctl.b.adp_sns_int & adpctl.b.adp_sns_int_msk) { ++ DWC_PRINTF("ADP Sense interrupt\n"); ++ retval |= dwc_otg_adp_handle_sns_intr(core_if); ++ } ++ if (adpctl.b.adp_tmout_int & adpctl.b.adp_tmout_int_msk) { ++ DWC_PRINTF("ADP timeout interrupt\n"); ++ retval |= dwc_otg_adp_handle_prb_tmout_intr(core_if, adpctl.d32); ++ } ++ if (adpctl.b.adp_prb_int & adpctl.b.adp_prb_int_msk) { ++ DWC_PRINTF("ADP Probe interrupt\n"); ++ adpctl.b.adp_prb_int = 1; ++ retval |= dwc_otg_adp_handle_prb_intr(core_if, adpctl.d32); ++ } ++ ++// dwc_otg_adp_modify_reg(core_if, adpctl.d32, 0); ++ //dwc_otg_adp_write_reg(core_if, adpctl.d32); ++ DWC_PRINTF("RETURN FROM ADP ISR\n"); ++ ++ return retval; ++} ++ ++/** ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ */ ++int32_t dwc_otg_adp_handle_srp_intr(dwc_otg_core_if_t * core_if) ++{ ++ ++#ifndef DWC_HOST_ONLY ++ hprt0_data_t hprt0; ++ gpwrdn_data_t gpwrdn; ++ DWC_DEBUGPL(DBG_ANY, "++ Power Down Logic Session Request Interrupt++\n"); ++ ++ gpwrdn.d32 = DWC_READ_REG32(&core_if->core_global_regs->gpwrdn); ++ /* check which value is for device mode and which for Host mode */ ++ if (!gpwrdn.b.idsts) { /* considered host mode value is 0 */ ++ DWC_PRINTF("SRP: Host mode\n"); ++ ++ if (core_if->adp_enable) { ++ dwc_otg_adp_probe_stop(core_if); ++ ++ /* Power on the core */ ++ if (core_if->power_down == 2) { ++ gpwrdn.b.pwrdnswtch = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs-> ++ gpwrdn, 0, gpwrdn.d32); ++ } ++ ++ core_if->op_state = A_HOST; ++ dwc_otg_core_init(core_if); ++ dwc_otg_enable_global_interrupts(core_if); ++ cil_hcd_start(core_if); ++ } ++ ++ /* Turn on the port power bit. */ ++ hprt0.d32 = dwc_otg_read_hprt0(core_if); ++ hprt0.b.prtpwr = 1; ++ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); ++ ++ /* Start the Connection timer. So a message can be displayed ++ * if connect does not occur within 10 seconds. */ ++ cil_hcd_session_start(core_if); ++ } else { ++ DWC_PRINTF("SRP: Device mode %s\n", __FUNCTION__); ++ if (core_if->adp_enable) { ++ dwc_otg_adp_probe_stop(core_if); ++ ++ /* Power on the core */ ++ if (core_if->power_down == 2) { ++ gpwrdn.b.pwrdnswtch = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs-> ++ gpwrdn, 0, gpwrdn.d32); ++ } ++ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pmuactv = 0; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, 0, ++ gpwrdn.d32); ++ ++ core_if->op_state = B_PERIPHERAL; ++ dwc_otg_core_init(core_if); ++ dwc_otg_enable_global_interrupts(core_if); ++ cil_pcd_start(core_if); ++ } ++ } ++#endif ++ return 1; ++} +diff --git a/drivers/usb/host/dwc_otg/dwc_otg_adp.h b/drivers/usb/host/dwc_otg/dwc_otg_adp.h +new file mode 100644 +index 0000000..4110b25 +--- /dev/null ++++ b/drivers/usb/host/dwc_otg/dwc_otg_adp.h +@@ -0,0 +1,80 @@ ++/* ========================================================================== ++ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_adp.h $ ++ * $Revision: #7 $ ++ * $Date: 2011/10/24 $ ++ * $Change: 1871159 $ ++ * ++ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, ++ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless ++ * otherwise expressly agreed to in writing between Synopsys and you. ++ * ++ * The Software IS NOT an item of Licensed Software or Licensed Product under ++ * any End User Software License Agreement or Agreement for Licensed Product ++ * with Synopsys or any supplement thereto. You are permitted to use and ++ * redistribute this Software in source and binary forms, with or without ++ * modification, provided that redistributions of source code must retain this ++ * notice. You may not view, use, disclose, copy or distribute this file or ++ * any information contained herein except pursuant to this license grant from ++ * Synopsys. If you do not agree with this notice, including the disclaimer ++ * below, then you are not authorized to use the Software. ++ * ++ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS ++ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS 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. ++ * ========================================================================== */ ++ ++#ifndef __DWC_OTG_ADP_H__ ++#define __DWC_OTG_ADP_H__ ++ ++/** ++ * @file ++ * ++ * This file contains the Attach Detect Protocol interfaces and defines ++ * (functions) and structures for Linux. ++ * ++ */ ++ ++#define DWC_OTG_ADP_UNATTACHED 0 ++#define DWC_OTG_ADP_ATTACHED 1 ++#define DWC_OTG_ADP_UNKOWN 2 ++ ++typedef struct dwc_otg_adp { ++ uint32_t adp_started; ++ uint32_t initial_probe; ++ int32_t probe_timer_values[2]; ++ uint32_t probe_enabled; ++ uint32_t sense_enabled; ++ dwc_timer_t *sense_timer; ++ uint32_t sense_timer_started; ++ dwc_timer_t *vbuson_timer; ++ uint32_t vbuson_timer_started; ++ uint32_t attached; ++ uint32_t probe_counter; ++ uint32_t gpwrdn; ++} dwc_otg_adp_t; ++ ++/** ++ * Attach Detect Protocol functions ++ */ ++ ++extern void dwc_otg_adp_write_reg(dwc_otg_core_if_t * core_if, uint32_t value); ++extern uint32_t dwc_otg_adp_read_reg(dwc_otg_core_if_t * core_if); ++extern uint32_t dwc_otg_adp_probe_start(dwc_otg_core_if_t * core_if); ++extern uint32_t dwc_otg_adp_sense_start(dwc_otg_core_if_t * core_if); ++extern uint32_t dwc_otg_adp_probe_stop(dwc_otg_core_if_t * core_if); ++extern uint32_t dwc_otg_adp_sense_stop(dwc_otg_core_if_t * core_if); ++extern void dwc_otg_adp_start(dwc_otg_core_if_t * core_if, uint8_t is_host); ++extern void dwc_otg_adp_init(dwc_otg_core_if_t * core_if); ++extern void dwc_otg_adp_remove(dwc_otg_core_if_t * core_if); ++extern int32_t dwc_otg_adp_handle_intr(dwc_otg_core_if_t * core_if); ++extern int32_t dwc_otg_adp_handle_srp_intr(dwc_otg_core_if_t * core_if); ++ ++#endif //__DWC_OTG_ADP_H__ +diff --git a/drivers/usb/host/dwc_otg/dwc_otg_attr.c b/drivers/usb/host/dwc_otg/dwc_otg_attr.c +new file mode 100644 +index 0000000..9da0c92 +--- /dev/null ++++ b/drivers/usb/host/dwc_otg/dwc_otg_attr.c +@@ -0,0 +1,1210 @@ ++/* ========================================================================== ++ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_attr.c $ ++ * $Revision: #44 $ ++ * $Date: 2010/11/29 $ ++ * $Change: 1636033 $ ++ * ++ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, ++ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless ++ * otherwise expressly agreed to in writing between Synopsys and you. ++ * ++ * The Software IS NOT an item of Licensed Software or Licensed Product under ++ * any End User Software License Agreement or Agreement for Licensed Product ++ * with Synopsys or any supplement thereto. You are permitted to use and ++ * redistribute this Software in source and binary forms, with or without ++ * modification, provided that redistributions of source code must retain this ++ * notice. You may not view, use, disclose, copy or distribute this file or ++ * any information contained herein except pursuant to this license grant from ++ * Synopsys. If you do not agree with this notice, including the disclaimer ++ * below, then you are not authorized to use the Software. ++ * ++ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS ++ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS 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. ++ * ========================================================================== */ ++ ++/** @file ++ * ++ * The diagnostic interface will provide access to the controller for ++ * bringing up the hardware and testing. The Linux driver attributes ++ * feature will be used to provide the Linux Diagnostic ++ * Interface. These attributes are accessed through sysfs. ++ */ ++ ++/** @page "Linux Module Attributes" ++ * ++ * The Linux module attributes feature is used to provide the Linux ++ * Diagnostic Interface. These attributes are accessed through sysfs. ++ * The diagnostic interface will provide access to the controller for ++ * bringing up the hardware and testing. ++ ++ The following table shows the attributes. ++ <table> ++ <tr> ++ <td><b> Name</b></td> ++ <td><b> Description</b></td> ++ <td><b> Access</b></td> ++ </tr> ++ ++ <tr> ++ <td> mode </td> ++ <td> Returns the current mode: 0 for device mode, 1 for host mode</td> ++ <td> Read</td> ++ </tr> ++ ++ <tr> ++ <td> hnpcapable </td> ++ <td> Gets or sets the "HNP-capable" bit in the Core USB Configuraton Register. ++ Read returns the current value.</td> ++ <td> Read/Write</td> ++ </tr> ++ ++ <tr> ++ <td> srpcapable </td> ++ <td> Gets or sets the "SRP-capable" bit in the Core USB Configuraton Register. ++ Read returns the current value.</td> ++ <td> Read/Write</td> ++ </tr> ++ ++ <tr> ++ <td> hsic_connect </td> ++ <td> Gets or sets the "HSIC-Connect" bit in the GLPMCFG Register. ++ Read returns the current value.</td> ++ <td> Read/Write</td> ++ </tr> ++ ++ <tr> ++ <td> inv_sel_hsic </td> ++ <td> Gets or sets the "Invert Select HSIC" bit in the GLPMFG Register. ++ Read returns the current value.</td> ++ <td> Read/Write</td> ++ </tr> ++ ++ <tr> ++ <td> hnp </td> ++ <td> Initiates the Host Negotiation Protocol. Read returns the status.</td> ++ <td> Read/Write</td> ++ </tr> ++ ++ <tr> ++ <td> srp </td> ++ <td> Initiates the Session Request Protocol. Read returns the status.</td> ++ <td> Read/Write</td> ++ </tr> ++ ++ <tr> ++ <td> buspower </td> ++ <td> Gets or sets the Power State of the bus (0 - Off or 1 - On)</td> ++ <td> Read/Write</td> ++ </tr> ++ ++ <tr> ++ <td> bussuspend </td> ++ <td> Suspends the USB bus.</td> ++ <td> Read/Write</td> ++ </tr> ++ ++ <tr> ++ <td> busconnected </td> ++ <td> Gets the connection status of the bus</td> ++ <td> Read</td> ++ </tr> ++ ++ <tr> ++ <td> gotgctl </td> ++ <td> Gets or sets the Core Control Status Register.</td> ++ <td> Read/Write</td> ++ </tr> ++ ++ <tr> ++ <td> gusbcfg </td> ++ <td> Gets or sets the Core USB Configuration Register</td> ++ <td> Read/Write</td> ++ </tr> ++ ++ <tr> ++ <td> grxfsiz </td> ++ <td> Gets or sets the Receive FIFO Size Register</td> ++ <td> Read/Write</td> ++ </tr> ++ ++ <tr> ++ <td> gnptxfsiz </td> ++ <td> Gets or sets the non-periodic Transmit Size Register</td> ++ <td> Read/Write</td> ++ </tr> ++ ++ <tr> ++ <td> gpvndctl </td> ++ <td> Gets or sets the PHY Vendor Control Register</td> ++ <td> Read/Write</td> ++ </tr> ++ ++ <tr> ++ <td> ggpio </td> ++ <td> Gets the value in the lower 16-bits of the General Purpose IO Register ++ or sets the upper 16 bits.</td> ++ <td> Read/Write</td> ++ </tr> ++ ++ <tr> ++ <td> guid </td> ++ <td> Gets or sets the value of the User ID Register</td> ++ <td> Read/Write</td> ++ </tr> ++ ++ <tr> ++ <td> gsnpsid </td> ++ <td> Gets the value of the Synopsys ID Regester</td> ++ <td> Read</td> ++ </tr> ++ ++ <tr> ++ <td> devspeed </td> ++ <td> Gets or sets the device speed setting in the DCFG register</td> ++ <td> Read/Write</td> ++ </tr> ++ ++ <tr> ++ <td> enumspeed </td> ++ <td> Gets the device enumeration Speed.</td> ++ <td> Read</td> ++ </tr> ++ ++ <tr> ++ <td> hptxfsiz </td> ++ <td> Gets the value of the Host Periodic Transmit FIFO</td> ++ <td> Read</td> ++ </tr> ++ ++ <tr> ++ <td> hprt0 </td> ++ <td> Gets or sets the value in the Host Port Control and Status Register</td> ++ <td> Read/Write</td> ++ </tr> ++ ++ <tr> ++ <td> regoffset </td> ++ <td> Sets the register offset for the next Register Access</td> ++ <td> Read/Write</td> ++ </tr> ++ ++ <tr> ++ <td> regvalue </td> ++ <td> Gets or sets the value of the register at the offset in the regoffset attribute.</td> ++ <td> Read/Write</td> ++ </tr> ++ ++ <tr> ++ <td> remote_wakeup </td> ++ <td> On read, shows the status of Remote Wakeup. On write, initiates a remote ++ wakeup of the host. When bit 0 is 1 and Remote Wakeup is enabled, the Remote ++ Wakeup signalling bit in the Device Control Register is set for 1 ++ milli-second.</td> ++ <td> Read/Write</td> ++ </tr> ++ ++ <tr> ++ <td> rem_wakeup_pwrdn </td> ++ <td> On read, shows the status core - hibernated or not. On write, initiates ++ a remote wakeup of the device from Hibernation. </td> ++ <td> Read/Write</td> ++ </tr> ++ ++ <tr> ++ <td> mode_ch_tim_en </td> ++ <td> This bit is used to enable or disable the host core to wait for 200 PHY ++ clock cycles at the end of Resume to change the opmode signal to the PHY to 00 ++ after Suspend or LPM. </td> ++ <td> Read/Write</td> ++ </tr> ++ ++ <tr> ++ <td> fr_interval </td> ++ <td> On read, shows the value of HFIR Frame Interval. On write, dynamically ++ reload HFIR register during runtime. The application can write a value to this ++ register only after the Port Enable bit of the Host Port Control and Status ++ register (HPRT.PrtEnaPort) has been set </td> ++ <td> Read/Write</td> ++ </tr> ++ ++ <tr> ++ <td> disconnect_us </td> ++ <td> On read, shows the status of disconnect_device_us. On write, sets disconnect_us ++ which causes soft disconnect for 100us. Applicable only for device mode of operation.</td> ++ <td> Read/Write</td> ++ </tr> ++ ++ <tr> ++ <td> regdump </td> ++ <td> Dumps the contents of core registers.</td> ++ <td> Read</td> ++ </tr> ++ ++ <tr> ++ <td> spramdump </td> ++ <td> Dumps the contents of core registers.</td> ++ <td> Read</td> ++ </tr> ++ ++ <tr> ++ <td> hcddump </td> ++ <td> Dumps the current HCD state.</td> ++ <td> Read</td> ++ </tr> ++ ++ <tr> ++ <td> hcd_frrem </td> ++ <td> Shows the average value of the Frame Remaining ++ field in the Host Frame Number/Frame Remaining register when an SOF interrupt ++ occurs. This can be used to determine the average interrupt latency. Also ++ shows the average Frame Remaining value for start_transfer and the "a" and ++ "b" sample points. The "a" and "b" sample points may be used during debugging ++ bto determine how long it takes to execute a section of the HCD code.</td> ++ <td> Read</td> ++ </tr> ++ ++ <tr> ++ <td> rd_reg_test </td> ++ <td> Displays the time required to read the GNPTXFSIZ register many times ++ (the output shows the number of times the register is read). ++ <td> Read</td> ++ </tr> ++ ++ <tr> ++ <td> wr_reg_test </td> ++ <td> Displays the time required to write the GNPTXFSIZ register many times ++ (the output shows the number of times the register is written). ++ <td> Read</td> ++ </tr> ++ ++ <tr> ++ <td> lpm_response </td> ++ <td> Gets or sets lpm_response mode. Applicable only in device mode. ++ <td> Write</td> ++ </tr> ++ ++ <tr> ++ <td> sleep_status </td> ++ <td> Shows sleep status of device. ++ <td> Read</td> ++ </tr> ++ ++ </table> ++ ++ Example usage: ++ To get the current mode: ++ cat /sys/devices/lm0/mode ++ ++ To power down the USB: ++ echo 0 > /sys/devices/lm0/buspower ++ */ ++ ++#include "dwc_otg_os_dep.h" ++#include "dwc_os.h" ++#include "dwc_otg_driver.h" ++#include "dwc_otg_attr.h" ++#include "dwc_otg_core_if.h" ++#include "dwc_otg_pcd_if.h" ++#include "dwc_otg_hcd_if.h" ++ ++/* ++ * MACROs for defining sysfs attribute ++ */ ++#ifdef LM_INTERFACE ++ ++#define DWC_OTG_DEVICE_ATTR_BITFIELD_SHOW(_otg_attr_name_,_string_) \ ++static ssize_t _otg_attr_name_##_show (struct device *_dev, struct device_attribute *attr, char *buf) \ ++{ \ ++ struct lm_device *lm_dev = container_of(_dev, struct lm_device, dev); \ ++ dwc_otg_device_t *otg_dev = lm_get_drvdata(lm_dev); \ ++ uint32_t val; \ ++ val = dwc_otg_get_##_otg_attr_name_ (otg_dev->core_if); \ ++ return sprintf (buf, "%s = 0x%x\n", _string_, val); \ ++} ++#define DWC_OTG_DEVICE_ATTR_BITFIELD_STORE(_otg_attr_name_,_string_) \ ++static ssize_t _otg_attr_name_##_store (struct device *_dev, struct device_attribute *attr, \ ++ const char *buf, size_t count) \ ++{ \ ++ struct lm_device *lm_dev = container_of(_dev, struct lm_device, dev); \ ++ dwc_otg_device_t *otg_dev = lm_get_drvdata(lm_dev); \ ++ uint32_t set = simple_strtoul(buf, NULL, 16); \ ++ dwc_otg_set_##_otg_attr_name_(otg_dev->core_if, set);\ ++ return count; \ ++} ++ ++#elif defined(PCI_INTERFACE) ++ ++#define DWC_OTG_DEVICE_ATTR_BITFIELD_SHOW(_otg_attr_name_,_string_) \ ++static ssize_t _otg_attr_name_##_show (struct device *_dev, struct device_attribute *attr, char *buf) \ ++{ \ ++ dwc_otg_device_t *otg_dev = dev_get_drvdata(_dev); \ ++ uint32_t val; \ ++ val = dwc_otg_get_##_otg_attr_name_ (otg_dev->core_if); \ ++ return sprintf (buf, "%s = 0x%x\n", _string_, val); \ ++} ++#define DWC_OTG_DEVICE_ATTR_BITFIELD_STORE(_otg_attr_name_,_string_) \ ++static ssize_t _otg_attr_name_##_store (struct device *_dev, struct device_attribute *attr, \ ++ const char *buf, size_t count) \ ++{ \ ++ dwc_otg_device_t *otg_dev = dev_get_drvdata(_dev); \ ++ uint32_t set = simple_strtoul(buf, NULL, 16); \ ++ dwc_otg_set_##_otg_attr_name_(otg_dev->core_if, set);\ ++ return count; \ ++} ++ ++#elif defined(PLATFORM_INTERFACE) ++ ++#define DWC_OTG_DEVICE_ATTR_BITFIELD_SHOW(_otg_attr_name_,_string_) \ ++static ssize_t _otg_attr_name_##_show (struct device *_dev, struct device_attribute *attr, char *buf) \ ++{ \ ++ struct platform_device *platform_dev = \ ++ container_of(_dev, struct platform_device, dev); \ ++ dwc_otg_device_t *otg_dev = platform_get_drvdata(platform_dev); \ ++ uint32_t val; \ ++ DWC_PRINTF("%s(%p) -> platform_dev %p, otg_dev %p\n", \ ++ __func__, _dev, platform_dev, otg_dev); \ ++ val = dwc_otg_get_##_otg_attr_name_ (otg_dev->core_if); \ ++ return sprintf (buf, "%s = 0x%x\n", _string_, val); \ ++} ++#define DWC_OTG_DEVICE_ATTR_BITFIELD_STORE(_otg_attr_name_,_string_) \ ++static ssize_t _otg_attr_name_##_store (struct device *_dev, struct device_attribute *attr, \ ++ const char *buf, size_t count) \ ++{ \ ++ struct platform_device *platform_dev = container_of(_dev, struct platform_device, dev); \ ++ dwc_otg_device_t *otg_dev = platform_get_drvdata(platform_dev); \ ++ uint32_t set = simple_strtoul(buf, NULL, 16); \ ++ dwc_otg_set_##_otg_attr_name_(otg_dev->core_if, set);\ ++ return count; \ ++} ++#endif ++ ++/* ++ * MACROs for defining sysfs attribute for 32-bit registers ++ */ ++#ifdef LM_INTERFACE ++#define DWC_OTG_DEVICE_ATTR_REG_SHOW(_otg_attr_name_,_string_) \ ++static ssize_t _otg_attr_name_##_show (struct device *_dev, struct device_attribute *attr, char *buf) \ ++{ \ ++ struct lm_device *lm_dev = container_of(_dev, struct lm_device, dev); \ ++ dwc_otg_device_t *otg_dev = lm_get_drvdata(lm_dev); \ ++ uint32_t val; \ ++ val = dwc_otg_get_##_otg_attr_name_ (otg_dev->core_if); \ ++ return sprintf (buf, "%s = 0x%08x\n", _string_, val); \ ++} ++#define DWC_OTG_DEVICE_ATTR_REG_STORE(_otg_attr_name_,_string_) \ ++static ssize_t _otg_attr_name_##_store (struct device *_dev, struct device_attribute *attr, \ ++ const char *buf, size_t count) \ ++{ \ ++ struct lm_device *lm_dev = container_of(_dev, struct lm_device, dev); \ ++ dwc_otg_device_t *otg_dev = lm_get_drvdata(lm_dev); \ ++ uint32_t val = simple_strtoul(buf, NULL, 16); \ ++ dwc_otg_set_##_otg_attr_name_ (otg_dev->core_if, val); \ ++ return count; \ ++} ++#elif defined(PCI_INTERFACE) ++#define DWC_OTG_DEVICE_ATTR_REG_SHOW(_otg_attr_name_,_string_) \ ++static ssize_t _otg_attr_name_##_show (struct device *_dev, struct device_attribute *attr, char *buf) \ ++{ \ ++ dwc_otg_device_t *otg_dev = dev_get_drvdata(_dev); \ ++ uint32_t val; \ ++ val = dwc_otg_get_##_otg_attr_name_ (otg_dev->core_if); \ ++ return sprintf (buf, "%s = 0x%08x\n", _string_, val); \ ++} ++#define DWC_OTG_DEVICE_ATTR_REG_STORE(_otg_attr_name_,_string_) \ ++static ssize_t _otg_attr_name_##_store (struct device *_dev, struct device_attribute *attr, \ ++ const char *buf, size_t count) \ ++{ \ ++ dwc_otg_device_t *otg_dev = dev_get_drvdata(_dev); \ ++ uint32_t val = simple_strtoul(buf, NULL, 16); \ ++ dwc_otg_set_##_otg_attr_name_ (otg_dev->core_if, val); \ ++ return count; \ ++} ++ ++#elif defined(PLATFORM_INTERFACE) ++#include "dwc_otg_dbg.h" ++#define DWC_OTG_DEVICE_ATTR_REG_SHOW(_otg_attr_name_,_string_) \ ++static ssize_t _otg_attr_name_##_show (struct device *_dev, struct device_attribute *attr, char *buf) \ ++{ \ ++ struct platform_device *platform_dev = container_of(_dev, struct platform_device, dev); \ ++ dwc_otg_device_t *otg_dev = platform_get_drvdata(platform_dev); \ ++ uint32_t val; \ ++ DWC_PRINTF("%s(%p) -> platform_dev %p, otg_dev %p\n", \ ++ __func__, _dev, platform_dev, otg_dev); \ ++ val = dwc_otg_get_##_otg_attr_name_ (otg_dev->core_if); \ ++ return sprintf (buf, "%s = 0x%08x\n", _string_, val); \ ++} ++#define DWC_OTG_DEVICE_ATTR_REG_STORE(_otg_attr_name_,_string_) \ ++static ssize_t _otg_attr_name_##_store (struct device *_dev, struct device_attribute *attr, \ ++ const char *buf, size_t count) \ ++{ \ ++ struct platform_device *platform_dev = container_of(_dev, struct platform_device, dev); \ ++ dwc_otg_device_t *otg_dev = platform_get_drvdata(platform_dev); \ ++ uint32_t val = simple_strtoul(buf, NULL, 16); \ ++ dwc_otg_set_##_otg_attr_name_ (otg_dev->core_if, val); \ ++ return count; \ ++} ++ ++#endif ++ ++#define DWC_OTG_DEVICE_ATTR_BITFIELD_RW(_otg_attr_name_,_string_) \ ++DWC_OTG_DEVICE_ATTR_BITFIELD_SHOW(_otg_attr_name_,_string_) \ ++DWC_OTG_DEVICE_ATTR_BITFIELD_STORE(_otg_attr_name_,_string_) \ ++DEVICE_ATTR(_otg_attr_name_,0644,_otg_attr_name_##_show,_otg_attr_name_##_store); ++ ++#define DWC_OTG_DEVICE_ATTR_BITFIELD_RO(_otg_attr_name_,_string_) \ ++DWC_OTG_DEVICE_ATTR_BITFIELD_SHOW(_otg_attr_name_,_string_) \ ++DEVICE_ATTR(_otg_attr_name_,0444,_otg_attr_name_##_show,NULL); ++ ++#define DWC_OTG_DEVICE_ATTR_REG32_RW(_otg_attr_name_,_addr_,_string_) \ ++DWC_OTG_DEVICE_ATTR_REG_SHOW(_otg_attr_name_,_string_) \ ++DWC_OTG_DEVICE_ATTR_REG_STORE(_otg_attr_name_,_string_) \ ++DEVICE_ATTR(_otg_attr_name_,0644,_otg_attr_name_##_show,_otg_attr_name_##_store); ++ ++#define DWC_OTG_DEVICE_ATTR_REG32_RO(_otg_attr_name_,_addr_,_string_) \ ++DWC_OTG_DEVICE_ATTR_REG_SHOW(_otg_attr_name_,_string_) \ ++DEVICE_ATTR(_otg_attr_name_,0444,_otg_attr_name_##_show,NULL); ++ ++/** @name Functions for Show/Store of Attributes */ ++/**@{*/ ++ ++/** ++ * Helper function returning the otg_device structure of the given device ++ */ ++static dwc_otg_device_t *dwc_otg_drvdev(struct device *_dev) ++{ ++ dwc_otg_device_t *otg_dev; ++ DWC_OTG_GETDRVDEV(otg_dev, _dev); ++ return otg_dev; ++} ++ ++/** ++ * Show the register offset of the Register Access. ++ */ ++static ssize_t regoffset_show(struct device *_dev, ++ struct device_attribute *attr, char *buf) ++{ ++ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); ++ return snprintf(buf, sizeof("0xFFFFFFFF\n") + 1, "0x%08x\n", ++ otg_dev->os_dep.reg_offset); ++} ++ ++/** ++ * Set the register offset for the next Register Access Read/Write ++ */ ++static ssize_t regoffset_store(struct device *_dev, ++ struct device_attribute *attr, ++ const char *buf, size_t count) ++{ ++ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); ++ uint32_t offset = simple_strtoul(buf, NULL, 16); ++#if defined(LM_INTERFACE) || defined(PLATFORM_INTERFACE) ++ if (offset < SZ_256K) { ++#elif defined(PCI_INTERFACE) ++ if (offset < 0x00040000) { ++#endif ++ otg_dev->os_dep.reg_offset = offset; ++ } else { ++ dev_err(_dev, "invalid offset\n"); ++ } ++ ++ return count; ++} ++ ++DEVICE_ATTR(regoffset, S_IRUGO | S_IWUSR, regoffset_show, regoffset_store); ++ ++/** ++ * Show the value of the register at the offset in the reg_offset ++ * attribute. ++ */ ++static ssize_t regvalue_show(struct device *_dev, ++ struct device_attribute *attr, char *buf) ++{ ++ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); ++ uint32_t val; ++ volatile uint32_t *addr; ++ ++ if (otg_dev->os_dep.reg_offset != 0xFFFFFFFF && 0 != otg_dev->os_dep.base) { ++ /* Calculate the address */ ++ addr = (uint32_t *) (otg_dev->os_dep.reg_offset + ++ (uint8_t *) otg_dev->os_dep.base); ++ val = DWC_READ_REG32(addr); ++ return snprintf(buf, ++ sizeof("Reg@0xFFFFFFFF = 0xFFFFFFFF\n") + 1, ++ "Reg@0x%06x = 0x%08x\n", otg_dev->os_dep.reg_offset, ++ val); ++ } else { ++ dev_err(_dev, "Invalid offset (0x%0x)\n", otg_dev->os_dep.reg_offset); ++ return sprintf(buf, "invalid offset\n"); ++ } ++} ++ ++/** ++ * Store the value in the register at the offset in the reg_offset ++ * attribute. ++ * ++ */ ++static ssize_t regvalue_store(struct device *_dev, ++ struct device_attribute *attr, ++ const char *buf, size_t count) ++{ ++ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); ++ volatile uint32_t *addr; ++ uint32_t val = simple_strtoul(buf, NULL, 16); ++ //dev_dbg(_dev, "Offset=0x%08x Val=0x%08x\n", otg_dev->reg_offset, val); ++ if (otg_dev->os_dep.reg_offset != 0xFFFFFFFF && 0 != otg_dev->os_dep.base) { ++ /* Calculate the address */ ++ addr = (uint32_t *) (otg_dev->os_dep.reg_offset + ++ (uint8_t *) otg_dev->os_dep.base); ++ DWC_WRITE_REG32(addr, val); ++ } else { ++ dev_err(_dev, "Invalid Register Offset (0x%08x)\n", ++ otg_dev->os_dep.reg_offset); ++ } ++ return count; ++} ++ ++DEVICE_ATTR(regvalue, S_IRUGO | S_IWUSR, regvalue_show, regvalue_store); ++ ++/* ++ * Attributes ++ */ ++DWC_OTG_DEVICE_ATTR_BITFIELD_RO(mode, "Mode"); ++DWC_OTG_DEVICE_ATTR_BITFIELD_RW(hnpcapable, "HNPCapable"); ++DWC_OTG_DEVICE_ATTR_BITFIELD_RW(srpcapable, "SRPCapable"); ++DWC_OTG_DEVICE_ATTR_BITFIELD_RW(hsic_connect, "HSIC Connect"); ++DWC_OTG_DEVICE_ATTR_BITFIELD_RW(inv_sel_hsic, "Invert Select HSIC"); ++ ++//DWC_OTG_DEVICE_ATTR_BITFIELD_RW(buspower,&(otg_dev->core_if->core_global_regs->gotgctl),(1<<8),8,"Mode"); ++//DWC_OTG_DEVICE_ATTR_BITFIELD_RW(bussuspend,&(otg_dev->core_if->core_global_regs->gotgctl),(1<<8),8,"Mode"); ++DWC_OTG_DEVICE_ATTR_BITFIELD_RO(busconnected, "Bus Connected"); ++ ++DWC_OTG_DEVICE_ATTR_REG32_RW(gotgctl, 0, "GOTGCTL"); ++DWC_OTG_DEVICE_ATTR_REG32_RW(gusbcfg, ++ &(otg_dev->core_if->core_global_regs->gusbcfg), ++ "GUSBCFG"); ++DWC_OTG_DEVICE_ATTR_REG32_RW(grxfsiz, ++ &(otg_dev->core_if->core_global_regs->grxfsiz), ++ "GRXFSIZ"); ++DWC_OTG_DEVICE_ATTR_REG32_RW(gnptxfsiz, ++ &(otg_dev->core_if->core_global_regs->gnptxfsiz), ++ "GNPTXFSIZ"); ++DWC_OTG_DEVICE_ATTR_REG32_RW(gpvndctl, ++ &(otg_dev->core_if->core_global_regs->gpvndctl), ++ "GPVNDCTL"); ++DWC_OTG_DEVICE_ATTR_REG32_RW(ggpio, ++ &(otg_dev->core_if->core_global_regs->ggpio), ++ "GGPIO"); ++DWC_OTG_DEVICE_ATTR_REG32_RW(guid, &(otg_dev->core_if->core_global_regs->guid), ++ "GUID"); ++DWC_OTG_DEVICE_ATTR_REG32_RO(gsnpsid, ++ &(otg_dev->core_if->core_global_regs->gsnpsid), ++ "GSNPSID"); ++DWC_OTG_DEVICE_ATTR_BITFIELD_RW(devspeed, "Device Speed"); ++DWC_OTG_DEVICE_ATTR_BITFIELD_RO(enumspeed, "Device Enumeration Speed"); ++ ++DWC_OTG_DEVICE_ATTR_REG32_RO(hptxfsiz, ++ &(otg_dev->core_if->core_global_regs->hptxfsiz), ++ "HPTXFSIZ"); ++DWC_OTG_DEVICE_ATTR_REG32_RW(hprt0, otg_dev->core_if->host_if->hprt0, "HPRT0"); ++ ++/** ++ * @todo Add code to initiate the HNP. ++ */ ++/** ++ * Show the HNP status bit ++ */ ++static ssize_t hnp_show(struct device *_dev, ++ struct device_attribute *attr, char *buf) ++{ ++ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); ++ return sprintf(buf, "HstNegScs = 0x%x\n", ++ dwc_otg_get_hnpstatus(otg_dev->core_if)); ++} ++ ++/** ++ * Set the HNP Request bit ++ */ ++static ssize_t hnp_store(struct device *_dev, ++ struct device_attribute *attr, ++ const char *buf, size_t count) ++{ ++ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); ++ uint32_t in = simple_strtoul(buf, NULL, 16); ++ dwc_otg_set_hnpreq(otg_dev->core_if, in); ++ return count; ++} ++ ++DEVICE_ATTR(hnp, 0644, hnp_show, hnp_store); ++ ++/** ++ * @todo Add code to initiate the SRP. ++ */ ++/** ++ * Show the SRP status bit ++ */ ++static ssize_t srp_show(struct device *_dev, ++ struct device_attribute *attr, char *buf) ++{ ++#ifndef DWC_HOST_ONLY ++ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); ++ return sprintf(buf, "SesReqScs = 0x%x\n", ++ dwc_otg_get_srpstatus(otg_dev->core_if)); ++#else ++ return sprintf(buf, "Host Only Mode!\n"); ++#endif ++} ++ ++/** ++ * Set the SRP Request bit ++ */ ++static ssize_t srp_store(struct device *_dev, ++ struct device_attribute *attr, ++ const char *buf, size_t count) ++{ ++#ifndef DWC_HOST_ONLY ++ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); ++ dwc_otg_pcd_initiate_srp(otg_dev->pcd); ++#endif ++ return count; ++} ++ ++DEVICE_ATTR(srp, 0644, srp_show, srp_store); ++ ++/** ++ * @todo Need to do more for power on/off? ++ */ ++/** ++ * Show the Bus Power status ++ */ ++static ssize_t buspower_show(struct device *_dev, ++ struct device_attribute *attr, char *buf) ++{ ++ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); ++ return sprintf(buf, "Bus Power = 0x%x\n", ++ dwc_otg_get_prtpower(otg_dev->core_if)); ++} ++ ++/** ++ * Set the Bus Power status ++ */ ++static ssize_t buspower_store(struct device *_dev, ++ struct device_attribute *attr, ++ const char *buf, size_t count) ++{ ++ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); ++ uint32_t on = simple_strtoul(buf, NULL, 16); ++ dwc_otg_set_prtpower(otg_dev->core_if, on); ++ return count; ++} ++ ++DEVICE_ATTR(buspower, 0644, buspower_show, buspower_store); ++ ++/** ++ * @todo Need to do more for suspend? ++ */ ++/** ++ * Show the Bus Suspend status ++ */ ++static ssize_t bussuspend_show(struct device *_dev, ++ struct device_attribute *attr, char *buf) ++{ ++ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); ++ return sprintf(buf, "Bus Suspend = 0x%x\n", ++ dwc_otg_get_prtsuspend(otg_dev->core_if)); ++} ++ ++/** ++ * Set the Bus Suspend status ++ */ ++static ssize_t bussuspend_store(struct device *_dev, ++ struct device_attribute *attr, ++ const char *buf, size_t count) ++{ ++ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); ++ uint32_t in = simple_strtoul(buf, NULL, 16); ++ dwc_otg_set_prtsuspend(otg_dev->core_if, in); ++ return count; ++} ++ ++DEVICE_ATTR(bussuspend, 0644, bussuspend_show, bussuspend_store); ++ ++/** ++ * Show the Mode Change Ready Timer status ++ */ ++static ssize_t mode_ch_tim_en_show(struct device *_dev, ++ struct device_attribute *attr, char *buf) ++{ ++ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); ++ return sprintf(buf, "Mode Change Ready Timer Enable = 0x%x\n", ++ dwc_otg_get_mode_ch_tim(otg_dev->core_if)); ++} ++ ++/** ++ * Set the Mode Change Ready Timer status ++ */ ++static ssize_t mode_ch_tim_en_store(struct device *_dev, ++ struct device_attribute *attr, ++ const char *buf, size_t count) ++{ ++ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); ++ uint32_t in = simple_strtoul(buf, NULL, 16); ++ dwc_otg_set_mode_ch_tim(otg_dev->core_if, in); ++ return count; ++} ++ ++DEVICE_ATTR(mode_ch_tim_en, 0644, mode_ch_tim_en_show, mode_ch_tim_en_store); ++ ++/** ++ * Show the value of HFIR Frame Interval bitfield ++ */ ++static ssize_t fr_interval_show(struct device *_dev, ++ struct device_attribute *attr, char *buf) ++{ ++ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); ++ return sprintf(buf, "Frame Interval = 0x%x\n", ++ dwc_otg_get_fr_interval(otg_dev->core_if)); ++} ++ ++/** ++ * Set the HFIR Frame Interval value ++ */ ++static ssize_t fr_interval_store(struct device *_dev, ++ struct device_attribute *attr, ++ const char *buf, size_t count) ++{ ++ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); ++ uint32_t in = simple_strtoul(buf, NULL, 10); ++ dwc_otg_set_fr_interval(otg_dev->core_if, in); ++ return count; ++} ++ ++DEVICE_ATTR(fr_interval, 0644, fr_interval_show, fr_interval_store); ++ ++/** ++ * Show the status of Remote Wakeup. ++ */ ++static ssize_t remote_wakeup_show(struct device *_dev, ++ struct device_attribute *attr, char *buf) ++{ ++#ifndef DWC_HOST_ONLY ++ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); ++ ++ return sprintf(buf, ++ "Remote Wakeup Sig = %d Enabled = %d LPM Remote Wakeup = %d\n", ++ dwc_otg_get_remotewakesig(otg_dev->core_if), ++ dwc_otg_pcd_get_rmwkup_enable(otg_dev->pcd), ++ dwc_otg_get_lpm_remotewakeenabled(otg_dev->core_if)); ++#else ++ return sprintf(buf, "Host Only Mode!\n"); ++#endif /* DWC_HOST_ONLY */ ++} ++ ++/** ++ * Initiate a remote wakeup of the host. The Device control register ++ * Remote Wakeup Signal bit is written if the PCD Remote wakeup enable ++ * flag is set. ++ * ++ */ ++static ssize_t remote_wakeup_store(struct device *_dev, ++ struct device_attribute *attr, ++ const char *buf, size_t count) ++{ ++#ifndef DWC_HOST_ONLY ++ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); ++ uint32_t val = simple_strtoul(buf, NULL, 16); ++ ++ if (val & 1) { ++ dwc_otg_pcd_remote_wakeup(otg_dev->pcd, 1); ++ } else { ++ dwc_otg_pcd_remote_wakeup(otg_dev->pcd, 0); ++ } ++#endif /* DWC_HOST_ONLY */ ++ return count; ++} ++ ++DEVICE_ATTR(remote_wakeup, S_IRUGO | S_IWUSR, remote_wakeup_show, ++ remote_wakeup_store); ++ ++/** ++ * Show the whether core is hibernated or not. ++ */ ++static ssize_t rem_wakeup_pwrdn_show(struct device *_dev, ++ struct device_attribute *attr, char *buf) ++{ ++#ifndef DWC_HOST_ONLY ++ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); ++ ++ if (dwc_otg_get_core_state(otg_dev->core_if)) { ++ DWC_PRINTF("Core is in hibernation\n"); ++ } else { ++ DWC_PRINTF("Core is not in hibernation\n"); ++ } ++#endif /* DWC_HOST_ONLY */ ++ return 0; ++} ++ ++extern int dwc_otg_device_hibernation_restore(dwc_otg_core_if_t * core_if, ++ int rem_wakeup, int reset); ++ ++/** ++ * Initiate a remote wakeup of the device to exit from hibernation. ++ */ ++static ssize_t rem_wakeup_pwrdn_store(struct device *_dev, ++ struct device_attribute *attr, ++ const char *buf, size_t count) ++{ ++#ifndef DWC_HOST_ONLY ++ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); ++ dwc_otg_device_hibernation_restore(otg_dev->core_if, 1, 0); ++#endif ++ return count; ++} ++ ++DEVICE_ATTR(rem_wakeup_pwrdn, S_IRUGO | S_IWUSR, rem_wakeup_pwrdn_show, ++ rem_wakeup_pwrdn_store); ++ ++static ssize_t disconnect_us(struct device *_dev, ++ struct device_attribute *attr, ++ const char *buf, size_t count) ++{ ++ ++#ifndef DWC_HOST_ONLY ++ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); ++ uint32_t val = simple_strtoul(buf, NULL, 16); ++ DWC_PRINTF("The Passed value is %04x\n", val); ++ ++ dwc_otg_pcd_disconnect_us(otg_dev->pcd, 50); ++ ++#endif /* DWC_HOST_ONLY */ ++ return count; ++} ++ ++DEVICE_ATTR(disconnect_us, S_IWUSR, 0, disconnect_us); ++ ++/** ++ * Dump global registers and either host or device registers (depending on the ++ * current mode of the core). ++ */ ++static ssize_t regdump_show(struct device *_dev, ++ struct device_attribute *attr, char *buf) ++{ ++ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); ++ ++ dwc_otg_dump_global_registers(otg_dev->core_if); ++ if (dwc_otg_is_host_mode(otg_dev->core_if)) { ++ dwc_otg_dump_host_registers(otg_dev->core_if); ++ } else { ++ dwc_otg_dump_dev_registers(otg_dev->core_if); ++ ++ } ++ return sprintf(buf, "Register Dump\n"); ++} ++ ++DEVICE_ATTR(regdump, S_IRUGO, regdump_show, 0); ++ ++/** ++ * Dump global registers and either host or device registers (depending on the ++ * current mode of the core). ++ */ ++static ssize_t spramdump_show(struct device *_dev, ++ struct device_attribute *attr, char *buf) ++{ ++ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); ++ ++ //dwc_otg_dump_spram(otg_dev->core_if); ++ ++ return sprintf(buf, "SPRAM Dump\n"); ++} ++ ++DEVICE_ATTR(spramdump, S_IRUGO, spramdump_show, 0); ++ ++/** ++ * Dump the current hcd state. ++ */ ++static ssize_t hcddump_show(struct device *_dev, ++ struct device_attribute *attr, char *buf) ++{ ++#ifndef DWC_DEVICE_ONLY ++ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); ++ dwc_otg_hcd_dump_state(otg_dev->hcd); ++#endif /* DWC_DEVICE_ONLY */ ++ return sprintf(buf, "HCD Dump\n"); ++} ++ ++DEVICE_ATTR(hcddump, S_IRUGO, hcddump_show, 0); ++ ++/** ++ * Dump the average frame remaining at SOF. This can be used to ++ * determine average interrupt latency. Frame remaining is also shown for ++ * start transfer and two additional sample points. ++ */ ++static ssize_t hcd_frrem_show(struct device *_dev, ++ struct device_attribute *attr, char *buf) ++{ ++#ifndef DWC_DEVICE_ONLY ++ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); ++ ++ dwc_otg_hcd_dump_frrem(otg_dev->hcd); ++#endif /* DWC_DEVICE_ONLY */ ++ return sprintf(buf, "HCD Dump Frame Remaining\n"); ++} ++ ++DEVICE_ATTR(hcd_frrem, S_IRUGO, hcd_frrem_show, 0); ++ ++/** ++ * Displays the time required to read the GNPTXFSIZ register many times (the ++ * output shows the number of times the register is read). ++ */ ++#define RW_REG_COUNT 10000000 ++#define MSEC_PER_JIFFIE 1000/HZ ++static ssize_t rd_reg_test_show(struct device *_dev, ++ struct device_attribute *attr, char *buf) ++{ ++ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); ++ int i; ++ int time; ++ int start_jiffies; ++ ++ printk("HZ %d, MSEC_PER_JIFFIE %d, loops_per_jiffy %lu\n", ++ HZ, MSEC_PER_JIFFIE, loops_per_jiffy); ++ start_jiffies = jiffies; ++ for (i = 0; i < RW_REG_COUNT; i++) { ++ dwc_otg_get_gnptxfsiz(otg_dev->core_if); ++ } ++ time = jiffies - start_jiffies; ++ return sprintf(buf, ++ "Time to read GNPTXFSIZ reg %d times: %d msecs (%d jiffies)\n", ++ RW_REG_COUNT, time * MSEC_PER_JIFFIE, time); ++} ++ ++DEVICE_ATTR(rd_reg_test, S_IRUGO, rd_reg_test_show, 0); ++ ++/** ++ * Displays the time required to write the GNPTXFSIZ register many times (the ++ * output shows the number of times the register is written). ++ */ ++static ssize_t wr_reg_test_show(struct device *_dev, ++ struct device_attribute *attr, char *buf) ++{ ++ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); ++ uint32_t reg_val; ++ int i; ++ int time; ++ int start_jiffies; ++ ++ printk("HZ %d, MSEC_PER_JIFFIE %d, loops_per_jiffy %lu\n", ++ HZ, MSEC_PER_JIFFIE, loops_per_jiffy); ++ reg_val = dwc_otg_get_gnptxfsiz(otg_dev->core_if); ++ start_jiffies = jiffies; ++ for (i = 0; i < RW_REG_COUNT; i++) { ++ dwc_otg_set_gnptxfsiz(otg_dev->core_if, reg_val); ++ } ++ time = jiffies - start_jiffies; ++ return sprintf(buf, ++ "Time to write GNPTXFSIZ reg %d times: %d msecs (%d jiffies)\n", ++ RW_REG_COUNT, time * MSEC_PER_JIFFIE, time); ++} ++ ++DEVICE_ATTR(wr_reg_test, S_IRUGO, wr_reg_test_show, 0); ++ ++#ifdef CONFIG_USB_DWC_OTG_LPM ++ ++/** ++* Show the lpm_response attribute. ++*/ ++static ssize_t lpmresp_show(struct device *_dev, ++ struct device_attribute *attr, char *buf) ++{ ++ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); ++ ++ if (!dwc_otg_get_param_lpm_enable(otg_dev->core_if)) ++ return sprintf(buf, "** LPM is DISABLED **\n"); ++ ++ if (!dwc_otg_is_device_mode(otg_dev->core_if)) { ++ return sprintf(buf, "** Current mode is not device mode\n"); ++ } ++ return sprintf(buf, "lpm_response = %d\n", ++ dwc_otg_get_lpmresponse(otg_dev->core_if)); ++} ++ ++/** ++* Store the lpm_response attribute. ++*/ ++static ssize_t lpmresp_store(struct device *_dev, ++ struct device_attribute *attr, ++ const char *buf, size_t count) ++{ ++ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); ++ uint32_t val = simple_strtoul(buf, NULL, 16); ++ ++ if (!dwc_otg_get_param_lpm_enable(otg_dev->core_if)) { ++ return 0; ++ } ++ ++ if (!dwc_otg_is_device_mode(otg_dev->core_if)) { ++ return 0; ++ } ++ ++ dwc_otg_set_lpmresponse(otg_dev->core_if, val); ++ return count; ++} ++ ++DEVICE_ATTR(lpm_response, S_IRUGO | S_IWUSR, lpmresp_show, lpmresp_store); ++ ++/** ++* Show the sleep_status attribute. ++*/ ++static ssize_t sleepstatus_show(struct device *_dev, ++ struct device_attribute *attr, char *buf) ++{ ++ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); ++ return sprintf(buf, "Sleep Status = %d\n", ++ dwc_otg_get_lpm_portsleepstatus(otg_dev->core_if)); ++} ++ ++/** ++ * Store the sleep_status attribure. ++ */ ++static ssize_t sleepstatus_store(struct device *_dev, ++ struct device_attribute *attr, ++ const char *buf, size_t count) ++{ ++ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); ++ dwc_otg_core_if_t *core_if = otg_dev->core_if; ++ ++ if (dwc_otg_get_lpm_portsleepstatus(otg_dev->core_if)) { ++ if (dwc_otg_is_host_mode(core_if)) { ++ ++ DWC_PRINTF("Host initiated resume\n"); ++ dwc_otg_set_prtresume(otg_dev->core_if, 1); ++ } ++ } ++ ++ return count; ++} ++ ++DEVICE_ATTR(sleep_status, S_IRUGO | S_IWUSR, sleepstatus_show, ++ sleepstatus_store); ++ ++#endif /* CONFIG_USB_DWC_OTG_LPM_ENABLE */ ++ ++/**@}*/ ++ ++/** ++ * Create the device files ++ */ ++void dwc_otg_attr_create( ++#ifdef LM_INTERFACE ++ struct lm_device *dev ++#elif defined(PCI_INTERFACE) ++ struct pci_dev *dev ++#elif defined(PLATFORM_INTERFACE) ++ struct platform_device *dev ++#endif ++ ) ++{ ++ int error; ++ ++ error = device_create_file(&dev->dev, &dev_attr_regoffset); ++ error = device_create_file(&dev->dev, &dev_attr_regvalue); ++ error = device_create_file(&dev->dev, &dev_attr_mode); ++ error = device_create_file(&dev->dev, &dev_attr_hnpcapable); ++ error = device_create_file(&dev->dev, &dev_attr_srpcapable); ++ error = device_create_file(&dev->dev, &dev_attr_hsic_connect); ++ error = device_create_file(&dev->dev, &dev_attr_inv_sel_hsic); ++ error = device_create_file(&dev->dev, &dev_attr_hnp); ++ error = device_create_file(&dev->dev, &dev_attr_srp); ++ error = device_create_file(&dev->dev, &dev_attr_buspower); ++ error = device_create_file(&dev->dev, &dev_attr_bussuspend); ++ error = device_create_file(&dev->dev, &dev_attr_mode_ch_tim_en); ++ error = device_create_file(&dev->dev, &dev_attr_fr_interval); ++ error = device_create_file(&dev->dev, &dev_attr_busconnected); ++ error = device_create_file(&dev->dev, &dev_attr_gotgctl); ++ error = device_create_file(&dev->dev, &dev_attr_gusbcfg); ++ error = device_create_file(&dev->dev, &dev_attr_grxfsiz); ++ error = device_create_file(&dev->dev, &dev_attr_gnptxfsiz); ++ error = device_create_file(&dev->dev, &dev_attr_gpvndctl); ++ error = device_create_file(&dev->dev, &dev_attr_ggpio); ++ error = device_create_file(&dev->dev, &dev_attr_guid); ++ error = device_create_file(&dev->dev, &dev_attr_gsnpsid); ++ error = device_create_file(&dev->dev, &dev_attr_devspeed); ++ error = device_create_file(&dev->dev, &dev_attr_enumspeed); ++ error = device_create_file(&dev->dev, &dev_attr_hptxfsiz); ++ error = device_create_file(&dev->dev, &dev_attr_hprt0); ++ error = device_create_file(&dev->dev, &dev_attr_remote_wakeup); ++ error = device_create_file(&dev->dev, &dev_attr_rem_wakeup_pwrdn); ++ error = device_create_file(&dev->dev, &dev_attr_disconnect_us); ++ error = device_create_file(&dev->dev, &dev_attr_regdump); ++ error = device_create_file(&dev->dev, &dev_attr_spramdump); ++ error = device_create_file(&dev->dev, &dev_attr_hcddump); ++ error = device_create_file(&dev->dev, &dev_attr_hcd_frrem); ++ error = device_create_file(&dev->dev, &dev_attr_rd_reg_test); ++ error = device_create_file(&dev->dev, &dev_attr_wr_reg_test); ++#ifdef CONFIG_USB_DWC_OTG_LPM ++ error = device_create_file(&dev->dev, &dev_attr_lpm_response); ++ error = device_create_file(&dev->dev, &dev_attr_sleep_status); ++#endif ++} ++ ++/** ++ * Remove the device files ++ */ ++void dwc_otg_attr_remove( ++#ifdef LM_INTERFACE ++ struct lm_device *dev ++#elif defined(PCI_INTERFACE) ++ struct pci_dev *dev ++#elif defined(PLATFORM_INTERFACE) ++ struct platform_device *dev ++#endif ++ ) ++{ ++ device_remove_file(&dev->dev, &dev_attr_regoffset); ++ device_remove_file(&dev->dev, &dev_attr_regvalue); ++ device_remove_file(&dev->dev, &dev_attr_mode); ++ device_remove_file(&dev->dev, &dev_attr_hnpcapable); ++ device_remove_file(&dev->dev, &dev_attr_srpcapable); ++ device_remove_file(&dev->dev, &dev_attr_hsic_connect); ++ device_remove_file(&dev->dev, &dev_attr_inv_sel_hsic); ++ device_remove_file(&dev->dev, &dev_attr_hnp); ++ device_remove_file(&dev->dev, &dev_attr_srp); ++ device_remove_file(&dev->dev, &dev_attr_buspower); ++ device_remove_file(&dev->dev, &dev_attr_bussuspend); ++ device_remove_file(&dev->dev, &dev_attr_mode_ch_tim_en); ++ device_remove_file(&dev->dev, &dev_attr_fr_interval); ++ device_remove_file(&dev->dev, &dev_attr_busconnected); ++ device_remove_file(&dev->dev, &dev_attr_gotgctl); ++ device_remove_file(&dev->dev, &dev_attr_gusbcfg); ++ device_remove_file(&dev->dev, &dev_attr_grxfsiz); ++ device_remove_file(&dev->dev, &dev_attr_gnptxfsiz); ++ device_remove_file(&dev->dev, &dev_attr_gpvndctl); ++ device_remove_file(&dev->dev, &dev_attr_ggpio); ++ device_remove_file(&dev->dev, &dev_attr_guid); ++ device_remove_file(&dev->dev, &dev_attr_gsnpsid); ++ device_remove_file(&dev->dev, &dev_attr_devspeed); ++ device_remove_file(&dev->dev, &dev_attr_enumspeed); ++ device_remove_file(&dev->dev, &dev_attr_hptxfsiz); ++ device_remove_file(&dev->dev, &dev_attr_hprt0); ++ device_remove_file(&dev->dev, &dev_attr_remote_wakeup); ++ device_remove_file(&dev->dev, &dev_attr_rem_wakeup_pwrdn); ++ device_remove_file(&dev->dev, &dev_attr_disconnect_us); ++ device_remove_file(&dev->dev, &dev_attr_regdump); ++ device_remove_file(&dev->dev, &dev_attr_spramdump); ++ device_remove_file(&dev->dev, &dev_attr_hcddump); ++ device_remove_file(&dev->dev, &dev_attr_hcd_frrem); ++ device_remove_file(&dev->dev, &dev_attr_rd_reg_test); ++ device_remove_file(&dev->dev, &dev_attr_wr_reg_test); ++#ifdef CONFIG_USB_DWC_OTG_LPM ++ device_remove_file(&dev->dev, &dev_attr_lpm_response); ++ device_remove_file(&dev->dev, &dev_attr_sleep_status); ++#endif ++} +diff --git a/drivers/usb/host/dwc_otg/dwc_otg_attr.h b/drivers/usb/host/dwc_otg/dwc_otg_attr.h +new file mode 100644 +index 0000000..e10b67f +--- /dev/null ++++ b/drivers/usb/host/dwc_otg/dwc_otg_attr.h +@@ -0,0 +1,89 @@ ++/* ========================================================================== ++ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_attr.h $ ++ * $Revision: #13 $ ++ * $Date: 2010/06/21 $ ++ * $Change: 1532021 $ ++ * ++ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, ++ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless ++ * otherwise expressly agreed to in writing between Synopsys and you. ++ * ++ * The Software IS NOT an item of Licensed Software or Licensed Product under ++ * any End User Software License Agreement or Agreement for Licensed Product ++ * with Synopsys or any supplement thereto. You are permitted to use and ++ * redistribute this Software in source and binary forms, with or without ++ * modification, provided that redistributions of source code must retain this ++ * notice. You may not view, use, disclose, copy or distribute this file or ++ * any information contained herein except pursuant to this license grant from ++ * Synopsys. If you do not agree with this notice, including the disclaimer ++ * below, then you are not authorized to use the Software. ++ * ++ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS ++ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS 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. ++ * ========================================================================== */ ++ ++#if !defined(__DWC_OTG_ATTR_H__) ++#define __DWC_OTG_ATTR_H__ ++ ++/** @file ++ * This file contains the interface to the Linux device attributes. ++ */ ++extern struct device_attribute dev_attr_regoffset; ++extern struct device_attribute dev_attr_regvalue; ++ ++extern struct device_attribute dev_attr_mode; ++extern struct device_attribute dev_attr_hnpcapable; ++extern struct device_attribute dev_attr_srpcapable; ++extern struct device_attribute dev_attr_hnp; ++extern struct device_attribute dev_attr_srp; ++extern struct device_attribute dev_attr_buspower; ++extern struct device_attribute dev_attr_bussuspend; ++extern struct device_attribute dev_attr_mode_ch_tim_en; ++extern struct device_attribute dev_attr_fr_interval; ++extern struct device_attribute dev_attr_busconnected; ++extern struct device_attribute dev_attr_gotgctl; ++extern struct device_attribute dev_attr_gusbcfg; ++extern struct device_attribute dev_attr_grxfsiz; ++extern struct device_attribute dev_attr_gnptxfsiz; ++extern struct device_attribute dev_attr_gpvndctl; ++extern struct device_attribute dev_attr_ggpio; ++extern struct device_attribute dev_attr_guid; ++extern struct device_attribute dev_attr_gsnpsid; ++extern struct device_attribute dev_attr_devspeed; ++extern struct device_attribute dev_attr_enumspeed; ++extern struct device_attribute dev_attr_hptxfsiz; ++extern struct device_attribute dev_attr_hprt0; ++#ifdef CONFIG_USB_DWC_OTG_LPM ++extern struct device_attribute dev_attr_lpm_response; ++extern struct device_attribute devi_attr_sleep_status; ++#endif ++ ++void dwc_otg_attr_create( ++#ifdef LM_INTERFACE ++ struct lm_device *dev ++#elif defined(PCI_INTERFACE) ++ struct pci_dev *dev ++#elif defined(PLATFORM_INTERFACE) ++ struct platform_device *dev ++#endif ++ ); ++ ++void dwc_otg_attr_remove( ++#ifdef LM_INTERFACE ++ struct lm_device *dev ++#elif defined(PCI_INTERFACE) ++ struct pci_dev *dev ++#elif defined(PLATFORM_INTERFACE) ++ struct platform_device *dev ++#endif ++ ); ++#endif +diff --git a/drivers/usb/host/dwc_otg/dwc_otg_cfi.c b/drivers/usb/host/dwc_otg/dwc_otg_cfi.c +new file mode 100644 +index 0000000..bbb3d32 +--- /dev/null ++++ b/drivers/usb/host/dwc_otg/dwc_otg_cfi.c +@@ -0,0 +1,1876 @@ ++/* ========================================================================== ++ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, ++ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless ++ * otherwise expressly agreed to in writing between Synopsys and you. ++ * ++ * The Software IS NOT an item of Licensed Software or Licensed Product under ++ * any End User Software License Agreement or Agreement for Licensed Product ++ * with Synopsys or any supplement thereto. You are permitted to use and ++ * redistribute this Software in source and binary forms, with or without ++ * modification, provided that redistributions of source code must retain this ++ * notice. You may not view, use, disclose, copy or distribute this file or ++ * any information contained herein except pursuant to this license grant from ++ * Synopsys. If you do not agree with this notice, including the disclaimer ++ * below, then you are not authorized to use the Software. ++ * ++ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS ++ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS 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. ++ * ========================================================================== */ ++ ++/** @file ++ * ++ * This file contains the most of the CFI(Core Feature Interface) ++ * implementation for the OTG. ++ */ ++ ++#ifdef DWC_UTE_CFI ++ ++#include "dwc_otg_pcd.h" ++#include "dwc_otg_cfi.h" ++ ++/** This definition should actually migrate to the Portability Library */ ++#define DWC_CONSTANT_CPU_TO_LE16(x) (x) ++ ++extern dwc_otg_pcd_ep_t *get_ep_by_addr(dwc_otg_pcd_t * pcd, u16 wIndex); ++ ++static int cfi_core_features_buf(uint8_t * buf, uint16_t buflen); ++static int cfi_get_feature_value(uint8_t * buf, uint16_t buflen, ++ struct dwc_otg_pcd *pcd, ++ struct cfi_usb_ctrlrequest *ctrl_req); ++static int cfi_set_feature_value(struct dwc_otg_pcd *pcd); ++static int cfi_ep_get_sg_val(uint8_t * buf, struct dwc_otg_pcd *pcd, ++ struct cfi_usb_ctrlrequest *req); ++static int cfi_ep_get_concat_val(uint8_t * buf, struct dwc_otg_pcd *pcd, ++ struct cfi_usb_ctrlrequest *req); ++static int cfi_ep_get_align_val(uint8_t * buf, struct dwc_otg_pcd *pcd, ++ struct cfi_usb_ctrlrequest *req); ++static int cfi_preproc_reset(struct dwc_otg_pcd *pcd, ++ struct cfi_usb_ctrlrequest *req); ++static void cfi_free_ep_bs_dyn_data(cfi_ep_t * cfiep); ++ ++static uint16_t get_dfifo_size(dwc_otg_core_if_t * core_if); ++static int32_t get_rxfifo_size(dwc_otg_core_if_t * core_if, uint16_t wValue); ++static int32_t get_txfifo_size(struct dwc_otg_pcd *pcd, uint16_t wValue); ++ ++static uint8_t resize_fifos(dwc_otg_core_if_t * core_if); ++ ++/** This is the header of the all features descriptor */ ++static cfi_all_features_header_t all_props_desc_header = { ++ .wVersion = DWC_CONSTANT_CPU_TO_LE16(0x100), ++ .wCoreID = DWC_CONSTANT_CPU_TO_LE16(CFI_CORE_ID_OTG), ++ .wNumFeatures = DWC_CONSTANT_CPU_TO_LE16(9), ++}; ++ ++/** This is an array of statically allocated feature descriptors */ ++static cfi_feature_desc_header_t prop_descs[] = { ++ ++ /* FT_ID_DMA_MODE */ ++ { ++ .wFeatureID = DWC_CONSTANT_CPU_TO_LE16(FT_ID_DMA_MODE), ++ .bmAttributes = CFI_FEATURE_ATTR_RW, ++ .wDataLength = DWC_CONSTANT_CPU_TO_LE16(1), ++ }, ++ ++ /* FT_ID_DMA_BUFFER_SETUP */ ++ { ++ .wFeatureID = DWC_CONSTANT_CPU_TO_LE16(FT_ID_DMA_BUFFER_SETUP), ++ .bmAttributes = CFI_FEATURE_ATTR_RW, ++ .wDataLength = DWC_CONSTANT_CPU_TO_LE16(6), ++ }, ++ ++ /* FT_ID_DMA_BUFF_ALIGN */ ++ { ++ .wFeatureID = DWC_CONSTANT_CPU_TO_LE16(FT_ID_DMA_BUFF_ALIGN), ++ .bmAttributes = CFI_FEATURE_ATTR_RW, ++ .wDataLength = DWC_CONSTANT_CPU_TO_LE16(2), ++ }, ++ ++ /* FT_ID_DMA_CONCAT_SETUP */ ++ { ++ .wFeatureID = DWC_CONSTANT_CPU_TO_LE16(FT_ID_DMA_CONCAT_SETUP), ++ .bmAttributes = CFI_FEATURE_ATTR_RW, ++ //.wDataLength = DWC_CONSTANT_CPU_TO_LE16(6), ++ }, ++ ++ /* FT_ID_DMA_CIRCULAR */ ++ { ++ .wFeatureID = DWC_CONSTANT_CPU_TO_LE16(FT_ID_DMA_CIRCULAR), ++ .bmAttributes = CFI_FEATURE_ATTR_RW, ++ .wDataLength = DWC_CONSTANT_CPU_TO_LE16(6), ++ }, ++ ++ /* FT_ID_THRESHOLD_SETUP */ ++ { ++ .wFeatureID = DWC_CONSTANT_CPU_TO_LE16(FT_ID_THRESHOLD_SETUP), ++ .bmAttributes = CFI_FEATURE_ATTR_RW, ++ .wDataLength = DWC_CONSTANT_CPU_TO_LE16(6), ++ }, ++ ++ /* FT_ID_DFIFO_DEPTH */ ++ { ++ .wFeatureID = DWC_CONSTANT_CPU_TO_LE16(FT_ID_DFIFO_DEPTH), ++ .bmAttributes = CFI_FEATURE_ATTR_RO, ++ .wDataLength = DWC_CONSTANT_CPU_TO_LE16(2), ++ }, ++ ++ /* FT_ID_TX_FIFO_DEPTH */ ++ { ++ .wFeatureID = DWC_CONSTANT_CPU_TO_LE16(FT_ID_TX_FIFO_DEPTH), ++ .bmAttributes = CFI_FEATURE_ATTR_RW, ++ .wDataLength = DWC_CONSTANT_CPU_TO_LE16(2), ++ }, ++ ++ /* FT_ID_RX_FIFO_DEPTH */ ++ { ++ .wFeatureID = DWC_CONSTANT_CPU_TO_LE16(FT_ID_RX_FIFO_DEPTH), ++ .bmAttributes = CFI_FEATURE_ATTR_RW, ++ .wDataLength = DWC_CONSTANT_CPU_TO_LE16(2), ++ } ++}; ++ ++/** The table of feature names */ ++cfi_string_t prop_name_table[] = { ++ {FT_ID_DMA_MODE, "dma_mode"}, ++ {FT_ID_DMA_BUFFER_SETUP, "buffer_setup"}, ++ {FT_ID_DMA_BUFF_ALIGN, "buffer_align"}, ++ {FT_ID_DMA_CONCAT_SETUP, "concat_setup"}, ++ {FT_ID_DMA_CIRCULAR, "buffer_circular"}, ++ {FT_ID_THRESHOLD_SETUP, "threshold_setup"}, ++ {FT_ID_DFIFO_DEPTH, "dfifo_depth"}, ++ {FT_ID_TX_FIFO_DEPTH, "txfifo_depth"}, ++ {FT_ID_RX_FIFO_DEPTH, "rxfifo_depth"}, ++ {} ++}; ++ ++/************************************************************************/ ++ ++/** ++ * Returns the name of the feature by its ID ++ * or NULL if no featute ID matches. ++ * ++ */ ++const uint8_t *get_prop_name(uint16_t prop_id, int *len) ++{ ++ cfi_string_t *pstr; ++ *len = 0; ++ ++ for (pstr = prop_name_table; pstr && pstr->s; pstr++) { ++ if (pstr->id == prop_id) { ++ *len = DWC_STRLEN(pstr->s); ++ return pstr->s; ++ } ++ } ++ return NULL; ++} ++ ++/** ++ * This function handles all CFI specific control requests. ++ * ++ * Return a negative value to stall the DCE. ++ */ ++int cfi_setup(struct dwc_otg_pcd *pcd, struct cfi_usb_ctrlrequest *ctrl) ++{ ++ int retval = 0; ++ dwc_otg_pcd_ep_t *ep = NULL; ++ cfiobject_t *cfi = pcd->cfi; ++ struct dwc_otg_core_if *coreif = GET_CORE_IF(pcd); ++ uint16_t wLen = DWC_LE16_TO_CPU(&ctrl->wLength); ++ uint16_t wValue = DWC_LE16_TO_CPU(&ctrl->wValue); ++ uint16_t wIndex = DWC_LE16_TO_CPU(&ctrl->wIndex); ++ uint32_t regaddr = 0; ++ uint32_t regval = 0; ++ ++ /* Save this Control Request in the CFI object. ++ * The data field will be assigned in the data stage completion CB function. ++ */ ++ cfi->ctrl_req = *ctrl; ++ cfi->ctrl_req.data = NULL; ++ ++ cfi->need_gadget_att = 0; ++ cfi->need_status_in_complete = 0; ++ ++ switch (ctrl->bRequest) { ++ case VEN_CORE_GET_FEATURES: ++ retval = cfi_core_features_buf(cfi->buf_in.buf, CFI_IN_BUF_LEN); ++ if (retval >= 0) { ++ //dump_msg(cfi->buf_in.buf, retval); ++ ep = &pcd->ep0; ++ ++ retval = min((uint16_t) retval, wLen); ++ /* Transfer this buffer to the host through the EP0-IN EP */ ++ ep->dwc_ep.dma_addr = cfi->buf_in.addr; ++ ep->dwc_ep.start_xfer_buff = cfi->buf_in.buf; ++ ep->dwc_ep.xfer_buff = cfi->buf_in.buf; ++ ep->dwc_ep.xfer_len = retval; ++ ep->dwc_ep.xfer_count = 0; ++ ep->dwc_ep.sent_zlp = 0; ++ ep->dwc_ep.total_len = ep->dwc_ep.xfer_len; ++ ++ pcd->ep0_pending = 1; ++ dwc_otg_ep0_start_transfer(coreif, &ep->dwc_ep); ++ } ++ retval = 0; ++ break; ++ ++ case VEN_CORE_GET_FEATURE: ++ CFI_INFO("VEN_CORE_GET_FEATURE\n"); ++ retval = cfi_get_feature_value(cfi->buf_in.buf, CFI_IN_BUF_LEN, ++ pcd, ctrl); ++ if (retval >= 0) { ++ ep = &pcd->ep0; ++ ++ retval = min((uint16_t) retval, wLen); ++ /* Transfer this buffer to the host through the EP0-IN EP */ ++ ep->dwc_ep.dma_addr = cfi->buf_in.addr; ++ ep->dwc_ep.start_xfer_buff = cfi->buf_in.buf; ++ ep->dwc_ep.xfer_buff = cfi->buf_in.buf; ++ ep->dwc_ep.xfer_len = retval; ++ ep->dwc_ep.xfer_count = 0; ++ ep->dwc_ep.sent_zlp = 0; ++ ep->dwc_ep.total_len = ep->dwc_ep.xfer_len; ++ ++ pcd->ep0_pending = 1; ++ dwc_otg_ep0_start_transfer(coreif, &ep->dwc_ep); ++ } ++ CFI_INFO("VEN_CORE_GET_FEATURE=%d\n", retval); ++ dump_msg(cfi->buf_in.buf, retval); ++ break; ++ ++ case VEN_CORE_SET_FEATURE: ++ CFI_INFO("VEN_CORE_SET_FEATURE\n"); ++ /* Set up an XFER to get the data stage of the control request, ++ * which is the new value of the feature to be modified. ++ */ ++ ep = &pcd->ep0; ++ ep->dwc_ep.is_in = 0; ++ ep->dwc_ep.dma_addr = cfi->buf_out.addr; ++ ep->dwc_ep.start_xfer_buff = cfi->buf_out.buf; ++ ep->dwc_ep.xfer_buff = cfi->buf_out.buf; ++ ep->dwc_ep.xfer_len = wLen; ++ ep->dwc_ep.xfer_count = 0; ++ ep->dwc_ep.sent_zlp = 0; ++ ep->dwc_ep.total_len = ep->dwc_ep.xfer_len; ++ ++ pcd->ep0_pending = 1; ++ /* Read the control write's data stage */ ++ dwc_otg_ep0_start_transfer(coreif, &ep->dwc_ep); ++ retval = 0; ++ break; ++ ++ case VEN_CORE_RESET_FEATURES: ++ CFI_INFO("VEN_CORE_RESET_FEATURES\n"); ++ cfi->need_gadget_att = 1; ++ cfi->need_status_in_complete = 1; ++ retval = cfi_preproc_reset(pcd, ctrl); ++ CFI_INFO("VEN_CORE_RESET_FEATURES = (%d)\n", retval); ++ break; ++ ++ case VEN_CORE_ACTIVATE_FEATURES: ++ CFI_INFO("VEN_CORE_ACTIVATE_FEATURES\n"); ++ break; ++ ++ case VEN_CORE_READ_REGISTER: ++ CFI_INFO("VEN_CORE_READ_REGISTER\n"); ++ /* wValue optionally contains the HI WORD of the register offset and ++ * wIndex contains the LOW WORD of the register offset ++ */ ++ if (wValue == 0) { ++ /* @TODO - MAS - fix the access to the base field */ ++ regaddr = 0; ++ //regaddr = (uint32_t) pcd->otg_dev->os_dep.base; ++ //GET_CORE_IF(pcd)->co ++ regaddr |= wIndex; ++ } else { ++ regaddr = (wValue << 16) | wIndex; ++ } ++ ++ /* Read a 32-bit value of the memory at the regaddr */ ++ regval = DWC_READ_REG32((uint32_t *) regaddr); ++ ++ ep = &pcd->ep0; ++ dwc_memcpy(cfi->buf_in.buf, &regval, sizeof(uint32_t)); ++ ep->dwc_ep.is_in = 1; ++ ep->dwc_ep.dma_addr = cfi->buf_in.addr; ++ ep->dwc_ep.start_xfer_buff = cfi->buf_in.buf; ++ ep->dwc_ep.xfer_buff = cfi->buf_in.buf; ++ ep->dwc_ep.xfer_len = wLen; ++ ep->dwc_ep.xfer_count = 0; ++ ep->dwc_ep.sent_zlp = 0; ++ ep->dwc_ep.total_len = ep->dwc_ep.xfer_len; ++ ++ pcd->ep0_pending = 1; ++ dwc_otg_ep0_start_transfer(coreif, &ep->dwc_ep); ++ cfi->need_gadget_att = 0; ++ retval = 0; ++ break; ++ ++ case VEN_CORE_WRITE_REGISTER: ++ CFI_INFO("VEN_CORE_WRITE_REGISTER\n"); ++ /* Set up an XFER to get the data stage of the control request, ++ * which is the new value of the register to be modified. ++ */ ++ ep = &pcd->ep0; ++ ep->dwc_ep.is_in = 0; ++ ep->dwc_ep.dma_addr = cfi->buf_out.addr; ++ ep->dwc_ep.start_xfer_buff = cfi->buf_out.buf; ++ ep->dwc_ep.xfer_buff = cfi->buf_out.buf; ++ ep->dwc_ep.xfer_len = wLen; ++ ep->dwc_ep.xfer_count = 0; ++ ep->dwc_ep.sent_zlp = 0; ++ ep->dwc_ep.total_len = ep->dwc_ep.xfer_len; ++ ++ pcd->ep0_pending = 1; ++ /* Read the control write's data stage */ ++ dwc_otg_ep0_start_transfer(coreif, &ep->dwc_ep); ++ retval = 0; ++ break; ++ ++ default: ++ retval = -DWC_E_NOT_SUPPORTED; ++ break; ++ } ++ ++ return retval; ++} ++ ++/** ++ * This function prepares the core features descriptors and copies its ++ * raw representation into the buffer <buf>. ++ * ++ * The buffer structure is as follows: ++ * all_features_header (8 bytes) ++ * features_#1 (8 bytes + feature name string length) ++ * features_#2 (8 bytes + feature name string length) ++ * ..... ++ * features_#n - where n=the total count of feature descriptors ++ */ ++static int cfi_core_features_buf(uint8_t * buf, uint16_t buflen) ++{ ++ cfi_feature_desc_header_t *prop_hdr = prop_descs; ++ cfi_feature_desc_header_t *prop; ++ cfi_all_features_header_t *all_props_hdr = &all_props_desc_header; ++ cfi_all_features_header_t *tmp; ++ uint8_t *tmpbuf = buf; ++ const uint8_t *pname = NULL; ++ int i, j, namelen = 0, totlen; ++ ++ /* Prepare and copy the core features into the buffer */ ++ CFI_INFO("%s:\n", __func__); ++ ++ tmp = (cfi_all_features_header_t *) tmpbuf; ++ *tmp = *all_props_hdr; ++ tmpbuf += CFI_ALL_FEATURES_HDR_LEN; ++ ++ j = sizeof(prop_descs) / sizeof(cfi_all_features_header_t); ++ for (i = 0; i < j; i++, prop_hdr++) { ++ pname = get_prop_name(prop_hdr->wFeatureID, &namelen); ++ prop = (cfi_feature_desc_header_t *) tmpbuf; ++ *prop = *prop_hdr; ++ ++ prop->bNameLen = namelen; ++ prop->wLength = ++ DWC_CONSTANT_CPU_TO_LE16(CFI_FEATURE_DESC_HDR_LEN + ++ namelen); ++ ++ tmpbuf += CFI_FEATURE_DESC_HDR_LEN; ++ dwc_memcpy(tmpbuf, pname, namelen); ++ tmpbuf += namelen; ++ } ++ ++ totlen = tmpbuf - buf; ++ ++ if (totlen > 0) { ++ tmp = (cfi_all_features_header_t *) buf; ++ tmp->wTotalLen = DWC_CONSTANT_CPU_TO_LE16(totlen); ++ } ++ ++ return totlen; ++} ++ ++/** ++ * This function releases all the dynamic memory in the CFI object. ++ */ ++static void cfi_release(cfiobject_t * cfiobj) ++{ ++ cfi_ep_t *cfiep; ++ dwc_list_link_t *tmp; ++ ++ CFI_INFO("%s\n", __func__); ++ ++ if (cfiobj->buf_in.buf) { ++ DWC_DMA_FREE(CFI_IN_BUF_LEN, cfiobj->buf_in.buf, ++ cfiobj->buf_in.addr); ++ cfiobj->buf_in.buf = NULL; ++ } ++ ++ if (cfiobj->buf_out.buf) { ++ DWC_DMA_FREE(CFI_OUT_BUF_LEN, cfiobj->buf_out.buf, ++ cfiobj->buf_out.addr); ++ cfiobj->buf_out.buf = NULL; ++ } ++ ++ /* Free the Buffer Setup values for each EP */ ++ //list_for_each_entry(cfiep, &cfiobj->active_eps, lh) { ++ DWC_LIST_FOREACH(tmp, &cfiobj->active_eps) { ++ cfiep = DWC_LIST_ENTRY(tmp, struct cfi_ep, lh); ++ cfi_free_ep_bs_dyn_data(cfiep); ++ } ++} ++ ++/** ++ * This function frees the dynamically allocated EP buffer setup data. ++ */ ++static void cfi_free_ep_bs_dyn_data(cfi_ep_t * cfiep) ++{ ++ if (cfiep->bm_sg) { ++ DWC_FREE(cfiep->bm_sg); ++ cfiep->bm_sg = NULL; ++ } ++ ++ if (cfiep->bm_align) { ++ DWC_FREE(cfiep->bm_align); ++ cfiep->bm_align = NULL; ++ } ++ ++ if (cfiep->bm_concat) { ++ if (NULL != cfiep->bm_concat->wTxBytes) { ++ DWC_FREE(cfiep->bm_concat->wTxBytes); ++ cfiep->bm_concat->wTxBytes = NULL; ++ } ++ DWC_FREE(cfiep->bm_concat); ++ cfiep->bm_concat = NULL; ++ } ++} ++ ++/** ++ * This function initializes the default values of the features ++ * for a specific endpoint and should be called only once when ++ * the EP is enabled first time. ++ */ ++static int cfi_ep_init_defaults(struct dwc_otg_pcd *pcd, cfi_ep_t * cfiep) ++{ ++ int retval = 0; ++ ++ cfiep->bm_sg = DWC_ALLOC(sizeof(ddma_sg_buffer_setup_t)); ++ if (NULL == cfiep->bm_sg) { ++ CFI_INFO("Failed to allocate memory for SG feature value\n"); ++ return -DWC_E_NO_MEMORY; ++ } ++ dwc_memset(cfiep->bm_sg, 0, sizeof(ddma_sg_buffer_setup_t)); ++ ++ /* For the Concatenation feature's default value we do not allocate ++ * memory for the wTxBytes field - it will be done in the set_feature_value ++ * request handler. ++ */ ++ cfiep->bm_concat = DWC_ALLOC(sizeof(ddma_concat_buffer_setup_t)); ++ if (NULL == cfiep->bm_concat) { ++ CFI_INFO ++ ("Failed to allocate memory for CONCATENATION feature value\n"); ++ DWC_FREE(cfiep->bm_sg); ++ return -DWC_E_NO_MEMORY; ++ } ++ dwc_memset(cfiep->bm_concat, 0, sizeof(ddma_concat_buffer_setup_t)); ++ ++ cfiep->bm_align = DWC_ALLOC(sizeof(ddma_align_buffer_setup_t)); ++ if (NULL == cfiep->bm_align) { ++ CFI_INFO ++ ("Failed to allocate memory for Alignment feature value\n"); ++ DWC_FREE(cfiep->bm_sg); ++ DWC_FREE(cfiep->bm_concat); ++ return -DWC_E_NO_MEMORY; ++ } ++ dwc_memset(cfiep->bm_align, 0, sizeof(ddma_align_buffer_setup_t)); ++ ++ return retval; ++} ++ ++/** ++ * The callback function that notifies the CFI on the activation of ++ * an endpoint in the PCD. The following steps are done in this function: ++ * ++ * Create a dynamically allocated cfi_ep_t object (a CFI wrapper to the PCD's ++ * active endpoint) ++ * Create MAX_DMA_DESCS_PER_EP count DMA Descriptors for the EP ++ * Set the Buffer Mode to standard ++ * Initialize the default values for all EP modes (SG, Circular, Concat, Align) ++ * Add the cfi_ep_t object to the list of active endpoints in the CFI object ++ */ ++static int cfi_ep_enable(struct cfiobject *cfi, struct dwc_otg_pcd *pcd, ++ struct dwc_otg_pcd_ep *ep) ++{ ++ cfi_ep_t *cfiep; ++ int retval = -DWC_E_NOT_SUPPORTED; ++ ++ CFI_INFO("%s: epname=%s; epnum=0x%02x\n", __func__, ++ "EP_" /*ep->ep.name */ , ep->desc->bEndpointAddress); ++ /* MAS - Check whether this endpoint already is in the list */ ++ cfiep = get_cfi_ep_by_pcd_ep(cfi, ep); ++ ++ if (NULL == cfiep) { ++ /* Allocate a cfi_ep_t object */ ++ cfiep = DWC_ALLOC(sizeof(cfi_ep_t)); ++ if (NULL == cfiep) { ++ CFI_INFO ++ ("Unable to allocate memory for <cfiep> in function %s\n", ++ __func__); ++ return -DWC_E_NO_MEMORY; ++ } ++ dwc_memset(cfiep, 0, sizeof(cfi_ep_t)); ++ ++ /* Save the dwc_otg_pcd_ep pointer in the cfiep object */ ++ cfiep->ep = ep; ++ ++ /* Allocate the DMA Descriptors chain of MAX_DMA_DESCS_PER_EP count */ ++ ep->dwc_ep.descs = ++ DWC_DMA_ALLOC(MAX_DMA_DESCS_PER_EP * ++ sizeof(dwc_otg_dma_desc_t), ++ &ep->dwc_ep.descs_dma_addr); ++ ++ if (NULL == ep->dwc_ep.descs) { ++ DWC_FREE(cfiep); ++ return -DWC_E_NO_MEMORY; ++ } ++ ++ DWC_LIST_INIT(&cfiep->lh); ++ ++ /* Set the buffer mode to BM_STANDARD. It will be modified ++ * when building descriptors for a specific buffer mode */ ++ ep->dwc_ep.buff_mode = BM_STANDARD; ++ ++ /* Create and initialize the default values for this EP's Buffer modes */ ++ if ((retval = cfi_ep_init_defaults(pcd, cfiep)) < 0) ++ return retval; ++ ++ /* Add the cfi_ep_t object to the CFI object's list of active endpoints */ ++ DWC_LIST_INSERT_TAIL(&cfi->active_eps, &cfiep->lh); ++ retval = 0; ++ } else { /* The sought EP already is in the list */ ++ CFI_INFO("%s: The sought EP already is in the list\n", ++ __func__); ++ } ++ ++ return retval; ++} ++ ++/** ++ * This function is called when the data stage of a 3-stage Control Write request ++ * is complete. ++ * ++ */ ++static int cfi_ctrl_write_complete(struct cfiobject *cfi, ++ struct dwc_otg_pcd *pcd) ++{ ++ uint32_t addr, reg_value; ++ uint16_t wIndex, wValue; ++ uint8_t bRequest; ++ uint8_t *buf = cfi->buf_out.buf; ++ //struct usb_ctrlrequest *ctrl_req = &cfi->ctrl_req_saved; ++ struct cfi_usb_ctrlrequest *ctrl_req = &cfi->ctrl_req; ++ int retval = -DWC_E_NOT_SUPPORTED; ++ ++ CFI_INFO("%s\n", __func__); ++ ++ bRequest = ctrl_req->bRequest; ++ wIndex = DWC_CONSTANT_CPU_TO_LE16(ctrl_req->wIndex); ++ wValue = DWC_CONSTANT_CPU_TO_LE16(ctrl_req->wValue); ++ ++ /* ++ * Save the pointer to the data stage in the ctrl_req's <data> field. ++ * The request should be already saved in the command stage by now. ++ */ ++ ctrl_req->data = cfi->buf_out.buf; ++ cfi->need_status_in_complete = 0; ++ cfi->need_gadget_att = 0; ++ ++ switch (bRequest) { ++ case VEN_CORE_WRITE_REGISTER: ++ /* The buffer contains raw data of the new value for the register */ ++ reg_value = *((uint32_t *) buf); ++ if (wValue == 0) { ++ addr = 0; ++ //addr = (uint32_t) pcd->otg_dev->os_dep.base; ++ addr += wIndex; ++ } else { ++ addr = (wValue << 16) | wIndex; ++ } ++ ++ //writel(reg_value, addr); ++ ++ retval = 0; ++ cfi->need_status_in_complete = 1; ++ break; ++ ++ case VEN_CORE_SET_FEATURE: ++ /* The buffer contains raw data of the new value of the feature */ ++ retval = cfi_set_feature_value(pcd); ++ if (retval < 0) ++ return retval; ++ ++ cfi->need_status_in_complete = 1; ++ break; ++ ++ default: ++ break; ++ } ++ ++ return retval; ++} ++ ++/** ++ * This function builds the DMA descriptors for the SG buffer mode. ++ */ ++static void cfi_build_sg_descs(struct cfiobject *cfi, cfi_ep_t * cfiep, ++ dwc_otg_pcd_request_t * req) ++{ ++ struct dwc_otg_pcd_ep *ep = cfiep->ep; ++ ddma_sg_buffer_setup_t *sgval = cfiep->bm_sg; ++ struct dwc_otg_dma_desc *desc = cfiep->ep->dwc_ep.descs; ++ struct dwc_otg_dma_desc *desc_last = cfiep->ep->dwc_ep.descs; ++ dma_addr_t buff_addr = req->dma; ++ int i; ++ uint32_t txsize, off; ++ ++ txsize = sgval->wSize; ++ off = sgval->bOffset; ++ ++// CFI_INFO("%s: %s TXSIZE=0x%08x; OFFSET=0x%08x\n", ++// __func__, cfiep->ep->ep.name, txsize, off); ++ ++ for (i = 0; i < sgval->bCount; i++) { ++ desc->status.b.bs = BS_HOST_BUSY; ++ desc->buf = buff_addr; ++ desc->status.b.l = 0; ++ desc->status.b.ioc = 0; ++ desc->status.b.sp = 0; ++ desc->status.b.bytes = txsize; ++ desc->status.b.bs = BS_HOST_READY; ++ ++ /* Set the next address of the buffer */ ++ buff_addr += txsize + off; ++ desc_last = desc; ++ desc++; ++ } ++ ++ /* Set the last, ioc and sp bits on the Last DMA Descriptor */ ++ desc_last->status.b.l = 1; ++ desc_last->status.b.ioc = 1; ++ desc_last->status.b.sp = ep->dwc_ep.sent_zlp; ++ /* Save the last DMA descriptor pointer */ ++ cfiep->dma_desc_last = desc_last; ++ cfiep->desc_count = sgval->bCount; ++} ++ ++/** ++ * This function builds the DMA descriptors for the Concatenation buffer mode. ++ */ ++static void cfi_build_concat_descs(struct cfiobject *cfi, cfi_ep_t * cfiep, ++ dwc_otg_pcd_request_t * req) ++{ ++ struct dwc_otg_pcd_ep *ep = cfiep->ep; ++ ddma_concat_buffer_setup_t *concatval = cfiep->bm_concat; ++ struct dwc_otg_dma_desc *desc = cfiep->ep->dwc_ep.descs; ++ struct dwc_otg_dma_desc *desc_last = cfiep->ep->dwc_ep.descs; ++ dma_addr_t buff_addr = req->dma; ++ int i; ++ uint16_t *txsize; ++ ++ txsize = concatval->wTxBytes; ++ ++ for (i = 0; i < concatval->hdr.bDescCount; i++) { ++ desc->buf = buff_addr; ++ desc->status.b.bs = BS_HOST_BUSY; ++ desc->status.b.l = 0; ++ desc->status.b.ioc = 0; ++ desc->status.b.sp = 0; ++ desc->status.b.bytes = *txsize; ++ desc->status.b.bs = BS_HOST_READY; ++ ++ txsize++; ++ /* Set the next address of the buffer */ ++ buff_addr += UGETW(ep->desc->wMaxPacketSize); ++ desc_last = desc; ++ desc++; ++ } ++ ++ /* Set the last, ioc and sp bits on the Last DMA Descriptor */ ++ desc_last->status.b.l = 1; ++ desc_last->status.b.ioc = 1; ++ desc_last->status.b.sp = ep->dwc_ep.sent_zlp; ++ cfiep->dma_desc_last = desc_last; ++ cfiep->desc_count = concatval->hdr.bDescCount; ++} ++ ++/** ++ * This function builds the DMA descriptors for the Circular buffer mode ++ */ ++static void cfi_build_circ_descs(struct cfiobject *cfi, cfi_ep_t * cfiep, ++ dwc_otg_pcd_request_t * req) ++{ ++ /* @todo: MAS - add implementation when this feature needs to be tested */ ++} ++ ++/** ++ * This function builds the DMA descriptors for the Alignment buffer mode ++ */ ++static void cfi_build_align_descs(struct cfiobject *cfi, cfi_ep_t * cfiep, ++ dwc_otg_pcd_request_t * req) ++{ ++ struct dwc_otg_pcd_ep *ep = cfiep->ep; ++ ddma_align_buffer_setup_t *alignval = cfiep->bm_align; ++ struct dwc_otg_dma_desc *desc = cfiep->ep->dwc_ep.descs; ++ dma_addr_t buff_addr = req->dma; ++ ++ desc->status.b.bs = BS_HOST_BUSY; ++ desc->status.b.l = 1; ++ desc->status.b.ioc = 1; ++ desc->status.b.sp = ep->dwc_ep.sent_zlp; ++ desc->status.b.bytes = req->length; ++ /* Adjust the buffer alignment */ ++ desc->buf = (buff_addr + alignval->bAlign); ++ desc->status.b.bs = BS_HOST_READY; ++ cfiep->dma_desc_last = desc; ++ cfiep->desc_count = 1; ++} ++ ++/** ++ * This function builds the DMA descriptors chain for different modes of the ++ * buffer setup of an endpoint. ++ */ ++static void cfi_build_descriptors(struct cfiobject *cfi, ++ struct dwc_otg_pcd *pcd, ++ struct dwc_otg_pcd_ep *ep, ++ dwc_otg_pcd_request_t * req) ++{ ++ cfi_ep_t *cfiep; ++ ++ /* Get the cfiep by the dwc_otg_pcd_ep */ ++ cfiep = get_cfi_ep_by_pcd_ep(cfi, ep); ++ if (NULL == cfiep) { ++ CFI_INFO("%s: Unable to find a matching active endpoint\n", ++ __func__); ++ return; ++ } ++ ++ cfiep->xfer_len = req->length; ++ ++ /* Iterate through all the DMA descriptors */ ++ switch (cfiep->ep->dwc_ep.buff_mode) { ++ case BM_SG: ++ cfi_build_sg_descs(cfi, cfiep, req); ++ break; ++ ++ case BM_CONCAT: ++ cfi_build_concat_descs(cfi, cfiep, req); ++ break; ++ ++ case BM_CIRCULAR: ++ cfi_build_circ_descs(cfi, cfiep, req); ++ break; ++ ++ case BM_ALIGN: ++ cfi_build_align_descs(cfi, cfiep, req); ++ break; ++ ++ default: ++ break; ++ } ++} ++ ++/** ++ * Allocate DMA buffer for different Buffer modes. ++ */ ++static void *cfi_ep_alloc_buf(struct cfiobject *cfi, struct dwc_otg_pcd *pcd, ++ struct dwc_otg_pcd_ep *ep, dma_addr_t * dma, ++ unsigned size, gfp_t flags) ++{ ++ return DWC_DMA_ALLOC(size, dma); ++} ++ ++/** ++ * This function initializes the CFI object. ++ */ ++int init_cfi(cfiobject_t * cfiobj) ++{ ++ CFI_INFO("%s\n", __func__); ++ ++ /* Allocate a buffer for IN XFERs */ ++ cfiobj->buf_in.buf = ++ DWC_DMA_ALLOC(CFI_IN_BUF_LEN, &cfiobj->buf_in.addr); ++ if (NULL == cfiobj->buf_in.buf) { ++ CFI_INFO("Unable to allocate buffer for INs\n"); ++ return -DWC_E_NO_MEMORY; ++ } ++ ++ /* Allocate a buffer for OUT XFERs */ ++ cfiobj->buf_out.buf = ++ DWC_DMA_ALLOC(CFI_OUT_BUF_LEN, &cfiobj->buf_out.addr); ++ if (NULL == cfiobj->buf_out.buf) { ++ CFI_INFO("Unable to allocate buffer for OUT\n"); ++ return -DWC_E_NO_MEMORY; ++ } ++ ++ /* Initialize the callback function pointers */ ++ cfiobj->ops.release = cfi_release; ++ cfiobj->ops.ep_enable = cfi_ep_enable; ++ cfiobj->ops.ctrl_write_complete = cfi_ctrl_write_complete; ++ cfiobj->ops.build_descriptors = cfi_build_descriptors; ++ cfiobj->ops.ep_alloc_buf = cfi_ep_alloc_buf; ++ ++ /* Initialize the list of active endpoints in the CFI object */ ++ DWC_LIST_INIT(&cfiobj->active_eps); ++ ++ return 0; ++} ++ ++/** ++ * This function reads the required feature's current value into the buffer ++ * ++ * @retval: Returns negative as error, or the data length of the feature ++ */ ++static int cfi_get_feature_value(uint8_t * buf, uint16_t buflen, ++ struct dwc_otg_pcd *pcd, ++ struct cfi_usb_ctrlrequest *ctrl_req) ++{ ++ int retval = -DWC_E_NOT_SUPPORTED; ++ struct dwc_otg_core_if *coreif = GET_CORE_IF(pcd); ++ uint16_t dfifo, rxfifo, txfifo; ++ ++ switch (ctrl_req->wIndex) { ++ /* Whether the DDMA is enabled or not */ ++ case FT_ID_DMA_MODE: ++ *buf = (coreif->dma_enable && coreif->dma_desc_enable) ? 1 : 0; ++ retval = 1; ++ break; ++ ++ case FT_ID_DMA_BUFFER_SETUP: ++ retval = cfi_ep_get_sg_val(buf, pcd, ctrl_req); ++ break; ++ ++ case FT_ID_DMA_BUFF_ALIGN: ++ retval = cfi_ep_get_align_val(buf, pcd, ctrl_req); ++ break; ++ ++ case FT_ID_DMA_CONCAT_SETUP: ++ retval = cfi_ep_get_concat_val(buf, pcd, ctrl_req); ++ break; ++ ++ case FT_ID_DMA_CIRCULAR: ++ CFI_INFO("GetFeature value (FT_ID_DMA_CIRCULAR)\n"); ++ break; ++ ++ case FT_ID_THRESHOLD_SETUP: ++ CFI_INFO("GetFeature value (FT_ID_THRESHOLD_SETUP)\n"); ++ break; ++ ++ case FT_ID_DFIFO_DEPTH: ++ dfifo = get_dfifo_size(coreif); ++ *((uint16_t *) buf) = dfifo; ++ retval = sizeof(uint16_t); ++ break; ++ ++ case FT_ID_TX_FIFO_DEPTH: ++ retval = get_txfifo_size(pcd, ctrl_req->wValue); ++ if (retval >= 0) { ++ txfifo = retval; ++ *((uint16_t *) buf) = txfifo; ++ retval = sizeof(uint16_t); ++ } ++ break; ++ ++ case FT_ID_RX_FIFO_DEPTH: ++ retval = get_rxfifo_size(coreif, ctrl_req->wValue); ++ if (retval >= 0) { ++ rxfifo = retval; ++ *((uint16_t *) buf) = rxfifo; ++ retval = sizeof(uint16_t); ++ } ++ break; ++ } ++ ++ return retval; ++} ++ ++/** ++ * This function resets the SG for the specified EP to its default value ++ */ ++static int cfi_reset_sg_val(cfi_ep_t * cfiep) ++{ ++ dwc_memset(cfiep->bm_sg, 0, sizeof(ddma_sg_buffer_setup_t)); ++ return 0; ++} ++ ++/** ++ * This function resets the Alignment for the specified EP to its default value ++ */ ++static int cfi_reset_align_val(cfi_ep_t * cfiep) ++{ ++ dwc_memset(cfiep->bm_sg, 0, sizeof(ddma_sg_buffer_setup_t)); ++ return 0; ++} ++ ++/** ++ * This function resets the Concatenation for the specified EP to its default value ++ * This function will also set the value of the wTxBytes field to NULL after ++ * freeing the memory previously allocated for this field. ++ */ ++static int cfi_reset_concat_val(cfi_ep_t * cfiep) ++{ ++ /* First we need to free the wTxBytes field */ ++ if (cfiep->bm_concat->wTxBytes) { ++ DWC_FREE(cfiep->bm_concat->wTxBytes); ++ cfiep->bm_concat->wTxBytes = NULL; ++ } ++ ++ dwc_memset(cfiep->bm_concat, 0, sizeof(ddma_concat_buffer_setup_t)); ++ return 0; ++} ++ ++/** ++ * This function resets all the buffer setups of the specified endpoint ++ */ ++static int cfi_ep_reset_all_setup_vals(cfi_ep_t * cfiep) ++{ ++ cfi_reset_sg_val(cfiep); ++ cfi_reset_align_val(cfiep); ++ cfi_reset_concat_val(cfiep); ++ return 0; ++} ++ ++static int cfi_handle_reset_fifo_val(struct dwc_otg_pcd *pcd, uint8_t ep_addr, ++ uint8_t rx_rst, uint8_t tx_rst) ++{ ++ int retval = -DWC_E_INVALID; ++ uint16_t tx_siz[15]; ++ uint16_t rx_siz = 0; ++ dwc_otg_pcd_ep_t *ep = NULL; ++ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); ++ dwc_otg_core_params_t *params = GET_CORE_IF(pcd)->core_params; ++ ++ if (rx_rst) { ++ rx_siz = params->dev_rx_fifo_size; ++ params->dev_rx_fifo_size = GET_CORE_IF(pcd)->init_rxfsiz; ++ } ++ ++ if (tx_rst) { ++ if (ep_addr == 0) { ++ int i; ++ ++ for (i = 0; i < core_if->hwcfg4.b.num_in_eps; i++) { ++ tx_siz[i] = ++ core_if->core_params->dev_tx_fifo_size[i]; ++ core_if->core_params->dev_tx_fifo_size[i] = ++ core_if->init_txfsiz[i]; ++ } ++ } else { ++ ++ ep = get_ep_by_addr(pcd, ep_addr); ++ ++ if (NULL == ep) { ++ CFI_INFO ++ ("%s: Unable to get the endpoint addr=0x%02x\n", ++ __func__, ep_addr); ++ return -DWC_E_INVALID; ++ } ++ ++ tx_siz[0] = ++ params->dev_tx_fifo_size[ep->dwc_ep.tx_fifo_num - ++ 1]; ++ params->dev_tx_fifo_size[ep->dwc_ep.tx_fifo_num - 1] = ++ GET_CORE_IF(pcd)->init_txfsiz[ep-> ++ dwc_ep.tx_fifo_num - ++ 1]; ++ } ++ } ++ ++ if (resize_fifos(GET_CORE_IF(pcd))) { ++ retval = 0; ++ } else { ++ CFI_INFO ++ ("%s: Error resetting the feature Reset All(FIFO size)\n", ++ __func__); ++ if (rx_rst) { ++ params->dev_rx_fifo_size = rx_siz; ++ } ++ ++ if (tx_rst) { ++ if (ep_addr == 0) { ++ int i; ++ for (i = 0; i < core_if->hwcfg4.b.num_in_eps; ++ i++) { ++ core_if-> ++ core_params->dev_tx_fifo_size[i] = ++ tx_siz[i]; ++ } ++ } else { ++ params->dev_tx_fifo_size[ep-> ++ dwc_ep.tx_fifo_num - ++ 1] = tx_siz[0]; ++ } ++ } ++ retval = -DWC_E_INVALID; ++ } ++ return retval; ++} ++ ++static int cfi_handle_reset_all(struct dwc_otg_pcd *pcd, uint8_t addr) ++{ ++ int retval = 0; ++ cfi_ep_t *cfiep; ++ cfiobject_t *cfi = pcd->cfi; ++ dwc_list_link_t *tmp; ++ ++ retval = cfi_handle_reset_fifo_val(pcd, addr, 1, 1); ++ if (retval < 0) { ++ return retval; ++ } ++ ++ /* If the EP address is known then reset the features for only that EP */ ++ if (addr) { ++ cfiep = get_cfi_ep_by_addr(pcd->cfi, addr); ++ if (NULL == cfiep) { ++ CFI_INFO("%s: Error getting the EP address 0x%02x\n", ++ __func__, addr); ++ return -DWC_E_INVALID; ++ } ++ retval = cfi_ep_reset_all_setup_vals(cfiep); ++ cfiep->ep->dwc_ep.buff_mode = BM_STANDARD; ++ } ++ /* Otherwise (wValue == 0), reset all features of all EP's */ ++ else { ++ /* Traverse all the active EP's and reset the feature(s) value(s) */ ++ //list_for_each_entry(cfiep, &cfi->active_eps, lh) { ++ DWC_LIST_FOREACH(tmp, &cfi->active_eps) { ++ cfiep = DWC_LIST_ENTRY(tmp, struct cfi_ep, lh); ++ retval = cfi_ep_reset_all_setup_vals(cfiep); ++ cfiep->ep->dwc_ep.buff_mode = BM_STANDARD; ++ if (retval < 0) { ++ CFI_INFO ++ ("%s: Error resetting the feature Reset All\n", ++ __func__); ++ return retval; ++ } ++ } ++ } ++ return retval; ++} ++ ++static int cfi_handle_reset_dma_buff_setup(struct dwc_otg_pcd *pcd, ++ uint8_t addr) ++{ ++ int retval = 0; ++ cfi_ep_t *cfiep; ++ cfiobject_t *cfi = pcd->cfi; ++ dwc_list_link_t *tmp; ++ ++ /* If the EP address is known then reset the features for only that EP */ ++ if (addr) { ++ cfiep = get_cfi_ep_by_addr(pcd->cfi, addr); ++ if (NULL == cfiep) { ++ CFI_INFO("%s: Error getting the EP address 0x%02x\n", ++ __func__, addr); ++ return -DWC_E_INVALID; ++ } ++ retval = cfi_reset_sg_val(cfiep); ++ } ++ /* Otherwise (wValue == 0), reset all features of all EP's */ ++ else { ++ /* Traverse all the active EP's and reset the feature(s) value(s) */ ++ //list_for_each_entry(cfiep, &cfi->active_eps, lh) { ++ DWC_LIST_FOREACH(tmp, &cfi->active_eps) { ++ cfiep = DWC_LIST_ENTRY(tmp, struct cfi_ep, lh); ++ retval = cfi_reset_sg_val(cfiep); ++ if (retval < 0) { ++ CFI_INFO ++ ("%s: Error resetting the feature Buffer Setup\n", ++ __func__); ++ return retval; ++ } ++ } ++ } ++ return retval; ++} ++ ++static int cfi_handle_reset_concat_val(struct dwc_otg_pcd *pcd, uint8_t addr) ++{ ++ int retval = 0; ++ cfi_ep_t *cfiep; ++ cfiobject_t *cfi = pcd->cfi; ++ dwc_list_link_t *tmp; ++ ++ /* If the EP address is known then reset the features for only that EP */ ++ if (addr) { ++ cfiep = get_cfi_ep_by_addr(pcd->cfi, addr); ++ if (NULL == cfiep) { ++ CFI_INFO("%s: Error getting the EP address 0x%02x\n", ++ __func__, addr); ++ return -DWC_E_INVALID; ++ } ++ retval = cfi_reset_concat_val(cfiep); ++ } ++ /* Otherwise (wValue == 0), reset all features of all EP's */ ++ else { ++ /* Traverse all the active EP's and reset the feature(s) value(s) */ ++ //list_for_each_entry(cfiep, &cfi->active_eps, lh) { ++ DWC_LIST_FOREACH(tmp, &cfi->active_eps) { ++ cfiep = DWC_LIST_ENTRY(tmp, struct cfi_ep, lh); ++ retval = cfi_reset_concat_val(cfiep); ++ if (retval < 0) { ++ CFI_INFO ++ ("%s: Error resetting the feature Concatenation Value\n", ++ __func__); ++ return retval; ++ } ++ } ++ } ++ return retval; ++} ++ ++static int cfi_handle_reset_align_val(struct dwc_otg_pcd *pcd, uint8_t addr) ++{ ++ int retval = 0; ++ cfi_ep_t *cfiep; ++ cfiobject_t *cfi = pcd->cfi; ++ dwc_list_link_t *tmp; ++ ++ /* If the EP address is known then reset the features for only that EP */ ++ if (addr) { ++ cfiep = get_cfi_ep_by_addr(pcd->cfi, addr); ++ if (NULL == cfiep) { ++ CFI_INFO("%s: Error getting the EP address 0x%02x\n", ++ __func__, addr); ++ return -DWC_E_INVALID; ++ } ++ retval = cfi_reset_align_val(cfiep); ++ } ++ /* Otherwise (wValue == 0), reset all features of all EP's */ ++ else { ++ /* Traverse all the active EP's and reset the feature(s) value(s) */ ++ //list_for_each_entry(cfiep, &cfi->active_eps, lh) { ++ DWC_LIST_FOREACH(tmp, &cfi->active_eps) { ++ cfiep = DWC_LIST_ENTRY(tmp, struct cfi_ep, lh); ++ retval = cfi_reset_align_val(cfiep); ++ if (retval < 0) { ++ CFI_INFO ++ ("%s: Error resetting the feature Aliignment Value\n", ++ __func__); ++ return retval; ++ } ++ } ++ } ++ return retval; ++ ++} ++ ++static int cfi_preproc_reset(struct dwc_otg_pcd *pcd, ++ struct cfi_usb_ctrlrequest *req) ++{ ++ int retval = 0; ++ ++ switch (req->wIndex) { ++ case 0: ++ /* Reset all features */ ++ retval = cfi_handle_reset_all(pcd, req->wValue & 0xff); ++ break; ++ ++ case FT_ID_DMA_BUFFER_SETUP: ++ /* Reset the SG buffer setup */ ++ retval = ++ cfi_handle_reset_dma_buff_setup(pcd, req->wValue & 0xff); ++ break; ++ ++ case FT_ID_DMA_CONCAT_SETUP: ++ /* Reset the Concatenation buffer setup */ ++ retval = cfi_handle_reset_concat_val(pcd, req->wValue & 0xff); ++ break; ++ ++ case FT_ID_DMA_BUFF_ALIGN: ++ /* Reset the Alignment buffer setup */ ++ retval = cfi_handle_reset_align_val(pcd, req->wValue & 0xff); ++ break; ++ ++ case FT_ID_TX_FIFO_DEPTH: ++ retval = ++ cfi_handle_reset_fifo_val(pcd, req->wValue & 0xff, 0, 1); ++ pcd->cfi->need_gadget_att = 0; ++ break; ++ ++ case FT_ID_RX_FIFO_DEPTH: ++ retval = cfi_handle_reset_fifo_val(pcd, 0, 1, 0); ++ pcd->cfi->need_gadget_att = 0; ++ break; ++ default: ++ break; ++ } ++ return retval; ++} ++ ++/** ++ * This function sets a new value for the SG buffer setup. ++ */ ++static int cfi_ep_set_sg_val(uint8_t * buf, struct dwc_otg_pcd *pcd) ++{ ++ uint8_t inaddr, outaddr; ++ cfi_ep_t *epin, *epout; ++ ddma_sg_buffer_setup_t *psgval; ++ uint32_t desccount, size; ++ ++ CFI_INFO("%s\n", __func__); ++ ++ psgval = (ddma_sg_buffer_setup_t *) buf; ++ desccount = (uint32_t) psgval->bCount; ++ size = (uint32_t) psgval->wSize; ++ ++ /* Check the DMA descriptor count */ ++ if ((desccount > MAX_DMA_DESCS_PER_EP) || (desccount == 0)) { ++ CFI_INFO ++ ("%s: The count of DMA Descriptors should be between 1 and %d\n", ++ __func__, MAX_DMA_DESCS_PER_EP); ++ return -DWC_E_INVALID; ++ } ++ ++ /* Check the DMA descriptor count */ ++ ++ if (size == 0) { ++ ++ CFI_INFO("%s: The transfer size should be at least 1 byte\n", ++ __func__); ++ ++ return -DWC_E_INVALID; ++ ++ } ++ ++ inaddr = psgval->bInEndpointAddress; ++ outaddr = psgval->bOutEndpointAddress; ++ ++ epin = get_cfi_ep_by_addr(pcd->cfi, inaddr); ++ epout = get_cfi_ep_by_addr(pcd->cfi, outaddr); ++ ++ if (NULL == epin || NULL == epout) { ++ CFI_INFO ++ ("%s: Unable to get the endpoints inaddr=0x%02x outaddr=0x%02x\n", ++ __func__, inaddr, outaddr); ++ return -DWC_E_INVALID; ++ } ++ ++ epin->ep->dwc_ep.buff_mode = BM_SG; ++ dwc_memcpy(epin->bm_sg, psgval, sizeof(ddma_sg_buffer_setup_t)); ++ ++ epout->ep->dwc_ep.buff_mode = BM_SG; ++ dwc_memcpy(epout->bm_sg, psgval, sizeof(ddma_sg_buffer_setup_t)); ++ ++ return 0; ++} ++ ++/** ++ * This function sets a new value for the buffer Alignment setup. ++ */ ++static int cfi_ep_set_alignment_val(uint8_t * buf, struct dwc_otg_pcd *pcd) ++{ ++ cfi_ep_t *ep; ++ uint8_t addr; ++ ddma_align_buffer_setup_t *palignval; ++ ++ palignval = (ddma_align_buffer_setup_t *) buf; ++ addr = palignval->bEndpointAddress; ++ ++ ep = get_cfi_ep_by_addr(pcd->cfi, addr); ++ ++ if (NULL == ep) { ++ CFI_INFO("%s: Unable to get the endpoint addr=0x%02x\n", ++ __func__, addr); ++ return -DWC_E_INVALID; ++ } ++ ++ ep->ep->dwc_ep.buff_mode = BM_ALIGN; ++ dwc_memcpy(ep->bm_align, palignval, sizeof(ddma_align_buffer_setup_t)); ++ ++ return 0; ++} ++ ++/** ++ * This function sets a new value for the Concatenation buffer setup. ++ */ ++static int cfi_ep_set_concat_val(uint8_t * buf, struct dwc_otg_pcd *pcd) ++{ ++ uint8_t addr; ++ cfi_ep_t *ep; ++ struct _ddma_concat_buffer_setup_hdr *pConcatValHdr; ++ uint16_t *pVals; ++ uint32_t desccount; ++ int i; ++ uint16_t mps; ++ ++ pConcatValHdr = (struct _ddma_concat_buffer_setup_hdr *)buf; ++ desccount = (uint32_t) pConcatValHdr->bDescCount; ++ pVals = (uint16_t *) (buf + BS_CONCAT_VAL_HDR_LEN); ++ ++ /* Check the DMA descriptor count */ ++ if (desccount > MAX_DMA_DESCS_PER_EP) { ++ CFI_INFO("%s: Maximum DMA Descriptor count should be %d\n", ++ __func__, MAX_DMA_DESCS_PER_EP); ++ return -DWC_E_INVALID; ++ } ++ ++ addr = pConcatValHdr->bEndpointAddress; ++ ep = get_cfi_ep_by_addr(pcd->cfi, addr); ++ if (NULL == ep) { ++ CFI_INFO("%s: Unable to get the endpoint addr=0x%02x\n", ++ __func__, addr); ++ return -DWC_E_INVALID; ++ } ++ ++ mps = UGETW(ep->ep->desc->wMaxPacketSize); ++ ++#if 0 ++ for (i = 0; i < desccount; i++) { ++ CFI_INFO("%s: wTxSize[%d]=0x%04x\n", __func__, i, pVals[i]); ++ } ++ CFI_INFO("%s: epname=%s; mps=%d\n", __func__, ep->ep->ep.name, mps); ++#endif ++ ++ /* Check the wTxSizes to be less than or equal to the mps */ ++ for (i = 0; i < desccount; i++) { ++ if (pVals[i] > mps) { ++ CFI_INFO ++ ("%s: ERROR - the wTxSize[%d] should be <= MPS (wTxSize=%d)\n", ++ __func__, i, pVals[i]); ++ return -DWC_E_INVALID; ++ } ++ } ++ ++ ep->ep->dwc_ep.buff_mode = BM_CONCAT; ++ dwc_memcpy(ep->bm_concat, pConcatValHdr, BS_CONCAT_VAL_HDR_LEN); ++ ++ /* Free the previously allocated storage for the wTxBytes */ ++ if (ep->bm_concat->wTxBytes) { ++ DWC_FREE(ep->bm_concat->wTxBytes); ++ } ++ ++ /* Allocate a new storage for the wTxBytes field */ ++ ep->bm_concat->wTxBytes = ++ DWC_ALLOC(sizeof(uint16_t) * pConcatValHdr->bDescCount); ++ if (NULL == ep->bm_concat->wTxBytes) { ++ CFI_INFO("%s: Unable to allocate memory\n", __func__); ++ return -DWC_E_NO_MEMORY; ++ } ++ ++ /* Copy the new values into the wTxBytes filed */ ++ dwc_memcpy(ep->bm_concat->wTxBytes, buf + BS_CONCAT_VAL_HDR_LEN, ++ sizeof(uint16_t) * pConcatValHdr->bDescCount); ++ ++ return 0; ++} ++ ++/** ++ * This function calculates the total of all FIFO sizes ++ * ++ * @param core_if Programming view of DWC_otg controller ++ * ++ * @return The total of data FIFO sizes. ++ * ++ */ ++static uint16_t get_dfifo_size(dwc_otg_core_if_t * core_if) ++{ ++ dwc_otg_core_params_t *params = core_if->core_params; ++ uint16_t dfifo_total = 0; ++ int i; ++ ++ /* The shared RxFIFO size */ ++ dfifo_total = ++ params->dev_rx_fifo_size + params->dev_nperio_tx_fifo_size; ++ ++ /* Add up each TxFIFO size to the total */ ++ for (i = 0; i < core_if->hwcfg4.b.num_in_eps; i++) { ++ dfifo_total += params->dev_tx_fifo_size[i]; ++ } ++ ++ return dfifo_total; ++} ++ ++/** ++ * This function returns Rx FIFO size ++ * ++ * @param core_if Programming view of DWC_otg controller ++ * ++ * @return The total of data FIFO sizes. ++ * ++ */ ++static int32_t get_rxfifo_size(dwc_otg_core_if_t * core_if, uint16_t wValue) ++{ ++ switch (wValue >> 8) { ++ case 0: ++ return (core_if->pwron_rxfsiz < ++ 32768) ? core_if->pwron_rxfsiz : 32768; ++ break; ++ case 1: ++ return core_if->core_params->dev_rx_fifo_size; ++ break; ++ default: ++ return -DWC_E_INVALID; ++ break; ++ } ++} ++ ++/** ++ * This function returns Tx FIFO size for IN EP ++ * ++ * @param core_if Programming view of DWC_otg controller ++ * ++ * @return The total of data FIFO sizes. ++ * ++ */ ++static int32_t get_txfifo_size(struct dwc_otg_pcd *pcd, uint16_t wValue) ++{ ++ dwc_otg_pcd_ep_t *ep; ++ ++ ep = get_ep_by_addr(pcd, wValue & 0xff); ++ ++ if (NULL == ep) { ++ CFI_INFO("%s: Unable to get the endpoint addr=0x%02x\n", ++ __func__, wValue & 0xff); ++ return -DWC_E_INVALID; ++ } ++ ++ if (!ep->dwc_ep.is_in) { ++ CFI_INFO ++ ("%s: No Tx FIFO assingned to the Out endpoint addr=0x%02x\n", ++ __func__, wValue & 0xff); ++ return -DWC_E_INVALID; ++ } ++ ++ switch (wValue >> 8) { ++ case 0: ++ return (GET_CORE_IF(pcd)->pwron_txfsiz ++ [ep->dwc_ep.tx_fifo_num - 1] < ++ 768) ? GET_CORE_IF(pcd)->pwron_txfsiz[ep-> ++ dwc_ep.tx_fifo_num ++ - 1] : 32768; ++ break; ++ case 1: ++ return GET_CORE_IF(pcd)->core_params-> ++ dev_tx_fifo_size[ep->dwc_ep.num - 1]; ++ break; ++ default: ++ return -DWC_E_INVALID; ++ break; ++ } ++} ++ ++/** ++ * This function checks if the submitted combination of ++ * device mode FIFO sizes is possible or not. ++ * ++ * @param core_if Programming view of DWC_otg controller ++ * ++ * @return 1 if possible, 0 otherwise. ++ * ++ */ ++static uint8_t check_fifo_sizes(dwc_otg_core_if_t * core_if) ++{ ++ uint16_t dfifo_actual = 0; ++ dwc_otg_core_params_t *params = core_if->core_params; ++ uint16_t start_addr = 0; ++ int i; ++ ++ dfifo_actual = ++ params->dev_rx_fifo_size + params->dev_nperio_tx_fifo_size; ++ ++ for (i = 0; i < core_if->hwcfg4.b.num_in_eps; i++) { ++ dfifo_actual += params->dev_tx_fifo_size[i]; ++ } ++ ++ if (dfifo_actual > core_if->total_fifo_size) { ++ return 0; ++ } ++ ++ if (params->dev_rx_fifo_size > 32768 || params->dev_rx_fifo_size < 16) ++ return 0; ++ ++ if (params->dev_nperio_tx_fifo_size > 32768 ++ || params->dev_nperio_tx_fifo_size < 16) ++ return 0; ++ ++ for (i = 0; i < core_if->hwcfg4.b.num_in_eps; i++) { ++ ++ if (params->dev_tx_fifo_size[i] > 768 ++ || params->dev_tx_fifo_size[i] < 4) ++ return 0; ++ } ++ ++ if (params->dev_rx_fifo_size > core_if->pwron_rxfsiz) ++ return 0; ++ start_addr = params->dev_rx_fifo_size; ++ ++ if (params->dev_nperio_tx_fifo_size > core_if->pwron_gnptxfsiz) ++ return 0; ++ start_addr += params->dev_nperio_tx_fifo_size; ++ ++ for (i = 0; i < core_if->hwcfg4.b.num_in_eps; i++) { ++ ++ if (params->dev_tx_fifo_size[i] > core_if->pwron_txfsiz[i]) ++ return 0; ++ start_addr += params->dev_tx_fifo_size[i]; ++ } ++ ++ return 1; ++} ++ ++/** ++ * This function resizes Device mode FIFOs ++ * ++ * @param core_if Programming view of DWC_otg controller ++ * ++ * @return 1 if successful, 0 otherwise ++ * ++ */ ++static uint8_t resize_fifos(dwc_otg_core_if_t * core_if) ++{ ++ int i = 0; ++ dwc_otg_core_global_regs_t *global_regs = core_if->core_global_regs; ++ dwc_otg_core_params_t *params = core_if->core_params; ++ uint32_t rx_fifo_size; ++ fifosize_data_t nptxfifosize; ++ fifosize_data_t txfifosize[15]; ++ ++ uint32_t rx_fsz_bak; ++ uint32_t nptxfsz_bak; ++ uint32_t txfsz_bak[15]; ++ ++ uint16_t start_address; ++ uint8_t retval = 1; ++ ++ if (!check_fifo_sizes(core_if)) { ++ return 0; ++ } ++ ++ /* Configure data FIFO sizes */ ++ if (core_if->hwcfg2.b.dynamic_fifo && params->enable_dynamic_fifo) { ++ rx_fsz_bak = DWC_READ_REG32(&global_regs->grxfsiz); ++ rx_fifo_size = params->dev_rx_fifo_size; ++ DWC_WRITE_REG32(&global_regs->grxfsiz, rx_fifo_size); ++ ++ /* ++ * Tx FIFOs These FIFOs are numbered from 1 to 15. ++ * Indexes of the FIFO size module parameters in the ++ * dev_tx_fifo_size array and the FIFO size registers in ++ * the dtxfsiz array run from 0 to 14. ++ */ ++ ++ /* Non-periodic Tx FIFO */ ++ nptxfsz_bak = DWC_READ_REG32(&global_regs->gnptxfsiz); ++ nptxfifosize.b.depth = params->dev_nperio_tx_fifo_size; ++ start_address = params->dev_rx_fifo_size; ++ nptxfifosize.b.startaddr = start_address; ++ ++ DWC_WRITE_REG32(&global_regs->gnptxfsiz, nptxfifosize.d32); ++ ++ start_address += nptxfifosize.b.depth; ++ ++ for (i = 0; i < core_if->hwcfg4.b.num_in_eps; i++) { ++ txfsz_bak[i] = DWC_READ_REG32(&global_regs->dtxfsiz[i]); ++ ++ txfifosize[i].b.depth = params->dev_tx_fifo_size[i]; ++ txfifosize[i].b.startaddr = start_address; ++ DWC_WRITE_REG32(&global_regs->dtxfsiz[i], ++ txfifosize[i].d32); ++ ++ start_address += txfifosize[i].b.depth; ++ } ++ ++ /** Check if register values are set correctly */ ++ if (rx_fifo_size != DWC_READ_REG32(&global_regs->grxfsiz)) { ++ retval = 0; ++ } ++ ++ if (nptxfifosize.d32 != DWC_READ_REG32(&global_regs->gnptxfsiz)) { ++ retval = 0; ++ } ++ ++ for (i = 0; i < core_if->hwcfg4.b.num_in_eps; i++) { ++ if (txfifosize[i].d32 != ++ DWC_READ_REG32(&global_regs->dtxfsiz[i])) { ++ retval = 0; ++ } ++ } ++ ++ /** If register values are not set correctly, reset old values */ ++ if (retval == 0) { ++ DWC_WRITE_REG32(&global_regs->grxfsiz, rx_fsz_bak); ++ ++ /* Non-periodic Tx FIFO */ ++ DWC_WRITE_REG32(&global_regs->gnptxfsiz, nptxfsz_bak); ++ ++ for (i = 0; i < core_if->hwcfg4.b.num_in_eps; i++) { ++ DWC_WRITE_REG32(&global_regs->dtxfsiz[i], ++ txfsz_bak[i]); ++ } ++ } ++ } else { ++ return 0; ++ } ++ ++ /* Flush the FIFOs */ ++ dwc_otg_flush_tx_fifo(core_if, 0x10); /* all Tx FIFOs */ ++ dwc_otg_flush_rx_fifo(core_if); ++ ++ return retval; ++} ++ ++/** ++ * This function sets a new value for the buffer Alignment setup. ++ */ ++static int cfi_ep_set_tx_fifo_val(uint8_t * buf, dwc_otg_pcd_t * pcd) ++{ ++ int retval; ++ uint32_t fsiz; ++ uint16_t size; ++ uint16_t ep_addr; ++ dwc_otg_pcd_ep_t *ep; ++ dwc_otg_core_params_t *params = GET_CORE_IF(pcd)->core_params; ++ tx_fifo_size_setup_t *ptxfifoval; ++ ++ ptxfifoval = (tx_fifo_size_setup_t *) buf; ++ ep_addr = ptxfifoval->bEndpointAddress; ++ size = ptxfifoval->wDepth; ++ ++ ep = get_ep_by_addr(pcd, ep_addr); ++ ++ CFI_INFO ++ ("%s: Set Tx FIFO size: endpoint addr=0x%02x, depth=%d, FIFO Num=%d\n", ++ __func__, ep_addr, size, ep->dwc_ep.tx_fifo_num); ++ ++ if (NULL == ep) { ++ CFI_INFO("%s: Unable to get the endpoint addr=0x%02x\n", ++ __func__, ep_addr); ++ return -DWC_E_INVALID; ++ } ++ ++ fsiz = params->dev_tx_fifo_size[ep->dwc_ep.tx_fifo_num - 1]; ++ params->dev_tx_fifo_size[ep->dwc_ep.tx_fifo_num - 1] = size; ++ ++ if (resize_fifos(GET_CORE_IF(pcd))) { ++ retval = 0; ++ } else { ++ CFI_INFO ++ ("%s: Error setting the feature Tx FIFO Size for EP%d\n", ++ __func__, ep_addr); ++ params->dev_tx_fifo_size[ep->dwc_ep.tx_fifo_num - 1] = fsiz; ++ retval = -DWC_E_INVALID; ++ } ++ ++ return retval; ++} ++ ++/** ++ * This function sets a new value for the buffer Alignment setup. ++ */ ++static int cfi_set_rx_fifo_val(uint8_t * buf, dwc_otg_pcd_t * pcd) ++{ ++ int retval; ++ uint32_t fsiz; ++ uint16_t size; ++ dwc_otg_core_params_t *params = GET_CORE_IF(pcd)->core_params; ++ rx_fifo_size_setup_t *prxfifoval; ++ ++ prxfifoval = (rx_fifo_size_setup_t *) buf; ++ size = prxfifoval->wDepth; ++ ++ fsiz = params->dev_rx_fifo_size; ++ params->dev_rx_fifo_size = size; ++ ++ if (resize_fifos(GET_CORE_IF(pcd))) { ++ retval = 0; ++ } else { ++ CFI_INFO("%s: Error setting the feature Rx FIFO Size\n", ++ __func__); ++ params->dev_rx_fifo_size = fsiz; ++ retval = -DWC_E_INVALID; ++ } ++ ++ return retval; ++} ++ ++/** ++ * This function reads the SG of an EP's buffer setup into the buffer buf ++ */ ++static int cfi_ep_get_sg_val(uint8_t * buf, struct dwc_otg_pcd *pcd, ++ struct cfi_usb_ctrlrequest *req) ++{ ++ int retval = -DWC_E_INVALID; ++ uint8_t addr; ++ cfi_ep_t *ep; ++ ++ /* The Low Byte of the wValue contains a non-zero address of the endpoint */ ++ addr = req->wValue & 0xFF; ++ if (addr == 0) /* The address should be non-zero */ ++ return retval; ++ ++ ep = get_cfi_ep_by_addr(pcd->cfi, addr); ++ if (NULL == ep) { ++ CFI_INFO("%s: Unable to get the endpoint address(0x%02x)\n", ++ __func__, addr); ++ return retval; ++ } ++ ++ dwc_memcpy(buf, ep->bm_sg, BS_SG_VAL_DESC_LEN); ++ retval = BS_SG_VAL_DESC_LEN; ++ return retval; ++} ++ ++/** ++ * This function reads the Concatenation value of an EP's buffer mode into ++ * the buffer buf ++ */ ++static int cfi_ep_get_concat_val(uint8_t * buf, struct dwc_otg_pcd *pcd, ++ struct cfi_usb_ctrlrequest *req) ++{ ++ int retval = -DWC_E_INVALID; ++ uint8_t addr; ++ cfi_ep_t *ep; ++ uint8_t desc_count; ++ ++ /* The Low Byte of the wValue contains a non-zero address of the endpoint */ ++ addr = req->wValue & 0xFF; ++ if (addr == 0) /* The address should be non-zero */ ++ return retval; ++ ++ ep = get_cfi_ep_by_addr(pcd->cfi, addr); ++ if (NULL == ep) { ++ CFI_INFO("%s: Unable to get the endpoint address(0x%02x)\n", ++ __func__, addr); ++ return retval; ++ } ++ ++ /* Copy the header to the buffer */ ++ dwc_memcpy(buf, ep->bm_concat, BS_CONCAT_VAL_HDR_LEN); ++ /* Advance the buffer pointer by the header size */ ++ buf += BS_CONCAT_VAL_HDR_LEN; ++ ++ desc_count = ep->bm_concat->hdr.bDescCount; ++ /* Copy alll the wTxBytes to the buffer */ ++ dwc_memcpy(buf, ep->bm_concat->wTxBytes, sizeof(uid16_t) * desc_count); ++ ++ retval = BS_CONCAT_VAL_HDR_LEN + sizeof(uid16_t) * desc_count; ++ return retval; ++} ++ ++/** ++ * This function reads the buffer Alignment value of an EP's buffer mode into ++ * the buffer buf ++ * ++ * @return The total number of bytes copied to the buffer or negative error code. ++ */ ++static int cfi_ep_get_align_val(uint8_t * buf, struct dwc_otg_pcd *pcd, ++ struct cfi_usb_ctrlrequest *req) ++{ ++ int retval = -DWC_E_INVALID; ++ uint8_t addr; ++ cfi_ep_t *ep; ++ ++ /* The Low Byte of the wValue contains a non-zero address of the endpoint */ ++ addr = req->wValue & 0xFF; ++ if (addr == 0) /* The address should be non-zero */ ++ return retval; ++ ++ ep = get_cfi_ep_by_addr(pcd->cfi, addr); ++ if (NULL == ep) { ++ CFI_INFO("%s: Unable to get the endpoint address(0x%02x)\n", ++ __func__, addr); ++ return retval; ++ } ++ ++ dwc_memcpy(buf, ep->bm_align, BS_ALIGN_VAL_HDR_LEN); ++ retval = BS_ALIGN_VAL_HDR_LEN; ++ ++ return retval; ++} ++ ++/** ++ * This function sets a new value for the specified feature ++ * ++ * @param pcd A pointer to the PCD object ++ * ++ * @return 0 if successful, negative error code otherwise to stall the DCE. ++ */ ++static int cfi_set_feature_value(struct dwc_otg_pcd *pcd) ++{ ++ int retval = -DWC_E_NOT_SUPPORTED; ++ uint16_t wIndex, wValue; ++ uint8_t bRequest; ++ struct dwc_otg_core_if *coreif; ++ cfiobject_t *cfi = pcd->cfi; ++ struct cfi_usb_ctrlrequest *ctrl_req; ++ uint8_t *buf; ++ ctrl_req = &cfi->ctrl_req; ++ ++ buf = pcd->cfi->ctrl_req.data; ++ ++ coreif = GET_CORE_IF(pcd); ++ bRequest = ctrl_req->bRequest; ++ wIndex = DWC_CONSTANT_CPU_TO_LE16(ctrl_req->wIndex); ++ wValue = DWC_CONSTANT_CPU_TO_LE16(ctrl_req->wValue); ++ ++ /* See which feature is to be modified */ ++ switch (wIndex) { ++ case FT_ID_DMA_BUFFER_SETUP: ++ /* Modify the feature */ ++ if ((retval = cfi_ep_set_sg_val(buf, pcd)) < 0) ++ return retval; ++ ++ /* And send this request to the gadget */ ++ cfi->need_gadget_att = 1; ++ break; ++ ++ case FT_ID_DMA_BUFF_ALIGN: ++ if ((retval = cfi_ep_set_alignment_val(buf, pcd)) < 0) ++ return retval; ++ cfi->need_gadget_att = 1; ++ break; ++ ++ case FT_ID_DMA_CONCAT_SETUP: ++ /* Modify the feature */ ++ if ((retval = cfi_ep_set_concat_val(buf, pcd)) < 0) ++ return retval; ++ cfi->need_gadget_att = 1; ++ break; ++ ++ case FT_ID_DMA_CIRCULAR: ++ CFI_INFO("FT_ID_DMA_CIRCULAR\n"); ++ break; ++ ++ case FT_ID_THRESHOLD_SETUP: ++ CFI_INFO("FT_ID_THRESHOLD_SETUP\n"); ++ break; ++ ++ case FT_ID_DFIFO_DEPTH: ++ CFI_INFO("FT_ID_DFIFO_DEPTH\n"); ++ break; ++ ++ case FT_ID_TX_FIFO_DEPTH: ++ CFI_INFO("FT_ID_TX_FIFO_DEPTH\n"); ++ if ((retval = cfi_ep_set_tx_fifo_val(buf, pcd)) < 0) ++ return retval; ++ cfi->need_gadget_att = 0; ++ break; ++ ++ case FT_ID_RX_FIFO_DEPTH: ++ CFI_INFO("FT_ID_RX_FIFO_DEPTH\n"); ++ if ((retval = cfi_set_rx_fifo_val(buf, pcd)) < 0) ++ return retval; ++ cfi->need_gadget_att = 0; ++ break; ++ } ++ ++ return retval; ++} ++ ++#endif //DWC_UTE_CFI +diff --git a/drivers/usb/host/dwc_otg/dwc_otg_cfi.h b/drivers/usb/host/dwc_otg/dwc_otg_cfi.h +new file mode 100644 +index 0000000..55fd337 +--- /dev/null ++++ b/drivers/usb/host/dwc_otg/dwc_otg_cfi.h +@@ -0,0 +1,320 @@ ++/* ========================================================================== ++ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, ++ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless ++ * otherwise expressly agreed to in writing between Synopsys and you. ++ * ++ * The Software IS NOT an item of Licensed Software or Licensed Product under ++ * any End User Software License Agreement or Agreement for Licensed Product ++ * with Synopsys or any supplement thereto. You are permitted to use and ++ * redistribute this Software in source and binary forms, with or without ++ * modification, provided that redistributions of source code must retain this ++ * notice. You may not view, use, disclose, copy or distribute this file or ++ * any information contained herein except pursuant to this license grant from ++ * Synopsys. If you do not agree with this notice, including the disclaimer ++ * below, then you are not authorized to use the Software. ++ * ++ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS ++ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS 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. ++ * ========================================================================== */ ++ ++#if !defined(__DWC_OTG_CFI_H__) ++#define __DWC_OTG_CFI_H__ ++ ++#include "dwc_otg_pcd.h" ++#include "dwc_cfi_common.h" ++ ++/** ++ * @file ++ * This file contains the CFI related OTG PCD specific common constants, ++ * interfaces(functions and macros) and data structures.The CFI Protocol is an ++ * optional interface for internal testing purposes that a DUT may implement to ++ * support testing of configurable features. ++ * ++ */ ++ ++struct dwc_otg_pcd; ++struct dwc_otg_pcd_ep; ++ ++/** OTG CFI Features (properties) ID constants */ ++/** This is a request for all Core Features */ ++#define FT_ID_DMA_MODE 0x0001 ++#define FT_ID_DMA_BUFFER_SETUP 0x0002 ++#define FT_ID_DMA_BUFF_ALIGN 0x0003 ++#define FT_ID_DMA_CONCAT_SETUP 0x0004 ++#define FT_ID_DMA_CIRCULAR 0x0005 ++#define FT_ID_THRESHOLD_SETUP 0x0006 ++#define FT_ID_DFIFO_DEPTH 0x0007 ++#define FT_ID_TX_FIFO_DEPTH 0x0008 ++#define FT_ID_RX_FIFO_DEPTH 0x0009 ++ ++/**********************************************************/ ++#define CFI_INFO_DEF ++ ++#ifdef CFI_INFO_DEF ++#define CFI_INFO(fmt...) DWC_PRINTF("CFI: " fmt); ++#else ++#define CFI_INFO(fmt...) ++#endif ++ ++#define min(x,y) ({ \ ++ x < y ? x : y; }) ++ ++#define max(x,y) ({ \ ++ x > y ? x : y; }) ++ ++/** ++ * Descriptor DMA SG Buffer setup structure (SG buffer). This structure is ++ * also used for setting up a buffer for Circular DDMA. ++ */ ++struct _ddma_sg_buffer_setup { ++#define BS_SG_VAL_DESC_LEN 6 ++ /* The OUT EP address */ ++ uint8_t bOutEndpointAddress; ++ /* The IN EP address */ ++ uint8_t bInEndpointAddress; ++ /* Number of bytes to put between transfer segments (must be DWORD boundaries) */ ++ uint8_t bOffset; ++ /* The number of transfer segments (a DMA descriptors per each segment) */ ++ uint8_t bCount; ++ /* Size (in byte) of each transfer segment */ ++ uint16_t wSize; ++} __attribute__ ((packed)); ++typedef struct _ddma_sg_buffer_setup ddma_sg_buffer_setup_t; ++ ++/** Descriptor DMA Concatenation Buffer setup structure */ ++struct _ddma_concat_buffer_setup_hdr { ++#define BS_CONCAT_VAL_HDR_LEN 4 ++ /* The endpoint for which the buffer is to be set up */ ++ uint8_t bEndpointAddress; ++ /* The count of descriptors to be used */ ++ uint8_t bDescCount; ++ /* The total size of the transfer */ ++ uint16_t wSize; ++} __attribute__ ((packed)); ++typedef struct _ddma_concat_buffer_setup_hdr ddma_concat_buffer_setup_hdr_t; ++ ++/** Descriptor DMA Concatenation Buffer setup structure */ ++struct _ddma_concat_buffer_setup { ++ /* The SG header */ ++ ddma_concat_buffer_setup_hdr_t hdr; ++ ++ /* The XFER sizes pointer (allocated dynamically) */ ++ uint16_t *wTxBytes; ++} __attribute__ ((packed)); ++typedef struct _ddma_concat_buffer_setup ddma_concat_buffer_setup_t; ++ ++/** Descriptor DMA Alignment Buffer setup structure */ ++struct _ddma_align_buffer_setup { ++#define BS_ALIGN_VAL_HDR_LEN 2 ++ uint8_t bEndpointAddress; ++ uint8_t bAlign; ++} __attribute__ ((packed)); ++typedef struct _ddma_align_buffer_setup ddma_align_buffer_setup_t; ++ ++/** Transmit FIFO Size setup structure */ ++struct _tx_fifo_size_setup { ++ uint8_t bEndpointAddress; ++ uint16_t wDepth; ++} __attribute__ ((packed)); ++typedef struct _tx_fifo_size_setup tx_fifo_size_setup_t; ++ ++/** Transmit FIFO Size setup structure */ ++struct _rx_fifo_size_setup { ++ uint16_t wDepth; ++} __attribute__ ((packed)); ++typedef struct _rx_fifo_size_setup rx_fifo_size_setup_t; ++ ++/** ++ * struct cfi_usb_ctrlrequest - the CFI implementation of the struct usb_ctrlrequest ++ * This structure encapsulates the standard usb_ctrlrequest and adds a pointer ++ * to the data returned in the data stage of a 3-stage Control Write requests. ++ */ ++struct cfi_usb_ctrlrequest { ++ uint8_t bRequestType; ++ uint8_t bRequest; ++ uint16_t wValue; ++ uint16_t wIndex; ++ uint16_t wLength; ++ uint8_t *data; ++} UPACKED; ++ ++/*---------------------------------------------------------------------------*/ ++ ++/** ++ * The CFI wrapper of the enabled and activated dwc_otg_pcd_ep structures. ++ * This structure is used to store the buffer setup data for any ++ * enabled endpoint in the PCD. ++ */ ++struct cfi_ep { ++ /* Entry for the list container */ ++ dwc_list_link_t lh; ++ /* Pointer to the active PCD endpoint structure */ ++ struct dwc_otg_pcd_ep *ep; ++ /* The last descriptor in the chain of DMA descriptors of the endpoint */ ++ struct dwc_otg_dma_desc *dma_desc_last; ++ /* The SG feature value */ ++ ddma_sg_buffer_setup_t *bm_sg; ++ /* The Circular feature value */ ++ ddma_sg_buffer_setup_t *bm_circ; ++ /* The Concatenation feature value */ ++ ddma_concat_buffer_setup_t *bm_concat; ++ /* The Alignment feature value */ ++ ddma_align_buffer_setup_t *bm_align; ++ /* XFER length */ ++ uint32_t xfer_len; ++ /* ++ * Count of DMA descriptors currently used. ++ * The total should not exceed the MAX_DMA_DESCS_PER_EP value ++ * defined in the dwc_otg_cil.h ++ */ ++ uint32_t desc_count; ++}; ++typedef struct cfi_ep cfi_ep_t; ++ ++typedef struct cfi_dma_buff { ++#define CFI_IN_BUF_LEN 1024 ++#define CFI_OUT_BUF_LEN 1024 ++ dma_addr_t addr; ++ uint8_t *buf; ++} cfi_dma_buff_t; ++ ++struct cfiobject; ++ ++/** ++ * This is the interface for the CFI operations. ++ * ++ * @param ep_enable Called when any endpoint is enabled and activated. ++ * @param release Called when the CFI object is released and it needs to correctly ++ * deallocate the dynamic memory ++ * @param ctrl_write_complete Called when the data stage of the request is complete ++ */ ++typedef struct cfi_ops { ++ int (*ep_enable) (struct cfiobject * cfi, struct dwc_otg_pcd * pcd, ++ struct dwc_otg_pcd_ep * ep); ++ void *(*ep_alloc_buf) (struct cfiobject * cfi, struct dwc_otg_pcd * pcd, ++ struct dwc_otg_pcd_ep * ep, dma_addr_t * dma, ++ unsigned size, gfp_t flags); ++ void (*release) (struct cfiobject * cfi); ++ int (*ctrl_write_complete) (struct cfiobject * cfi, ++ struct dwc_otg_pcd * pcd); ++ void (*build_descriptors) (struct cfiobject * cfi, ++ struct dwc_otg_pcd * pcd, ++ struct dwc_otg_pcd_ep * ep, ++ dwc_otg_pcd_request_t * req); ++} cfi_ops_t; ++ ++struct cfiobject { ++ cfi_ops_t ops; ++ struct dwc_otg_pcd *pcd; ++ struct usb_gadget *gadget; ++ ++ /* Buffers used to send/receive CFI-related request data */ ++ cfi_dma_buff_t buf_in; ++ cfi_dma_buff_t buf_out; ++ ++ /* CFI specific Control request wrapper */ ++ struct cfi_usb_ctrlrequest ctrl_req; ++ ++ /* The list of active EP's in the PCD of type cfi_ep_t */ ++ dwc_list_link_t active_eps; ++ ++ /* This flag shall control the propagation of a specific request ++ * to the gadget's processing routines. ++ * 0 - no gadget handling ++ * 1 - the gadget needs to know about this request (w/o completing a status ++ * phase - just return a 0 to the _setup callback) ++ */ ++ uint8_t need_gadget_att; ++ ++ /* Flag indicating whether the status IN phase needs to be ++ * completed by the PCD ++ */ ++ uint8_t need_status_in_complete; ++}; ++typedef struct cfiobject cfiobject_t; ++ ++#define DUMP_MSG ++ ++#if defined(DUMP_MSG) ++static inline void dump_msg(const u8 * buf, unsigned int length) ++{ ++ unsigned int start, num, i; ++ char line[52], *p; ++ ++ if (length >= 512) ++ return; ++ ++ start = 0; ++ while (length > 0) { ++ num = min(length, 16u); ++ p = line; ++ for (i = 0; i < num; ++i) { ++ if (i == 8) ++ *p++ = ' '; ++ DWC_SPRINTF(p, " %02x", buf[i]); ++ p += 3; ++ } ++ *p = 0; ++ DWC_DEBUG("%6x: %s\n", start, line); ++ buf += num; ++ start += num; ++ length -= num; ++ } ++} ++#else ++static inline void dump_msg(const u8 * buf, unsigned int length) ++{ ++} ++#endif ++ ++/** ++ * This function returns a pointer to cfi_ep_t object with the addr address. ++ */ ++static inline struct cfi_ep *get_cfi_ep_by_addr(struct cfiobject *cfi, ++ uint8_t addr) ++{ ++ struct cfi_ep *pcfiep; ++ dwc_list_link_t *tmp; ++ ++ DWC_LIST_FOREACH(tmp, &cfi->active_eps) { ++ pcfiep = DWC_LIST_ENTRY(tmp, struct cfi_ep, lh); ++ ++ if (pcfiep->ep->desc->bEndpointAddress == addr) { ++ return pcfiep; ++ } ++ } ++ ++ return NULL; ++} ++ ++/** ++ * This function returns a pointer to cfi_ep_t object that matches ++ * the dwc_otg_pcd_ep object. ++ */ ++static inline struct cfi_ep *get_cfi_ep_by_pcd_ep(struct cfiobject *cfi, ++ struct dwc_otg_pcd_ep *ep) ++{ ++ struct cfi_ep *pcfiep = NULL; ++ dwc_list_link_t *tmp; ++ ++ DWC_LIST_FOREACH(tmp, &cfi->active_eps) { ++ pcfiep = DWC_LIST_ENTRY(tmp, struct cfi_ep, lh); ++ if (pcfiep->ep == ep) { ++ return pcfiep; ++ } ++ } ++ return NULL; ++} ++ ++int cfi_setup(struct dwc_otg_pcd *pcd, struct cfi_usb_ctrlrequest *ctrl); ++ ++#endif /* (__DWC_OTG_CFI_H__) */ +diff --git a/drivers/usb/host/dwc_otg/dwc_otg_cil.c b/drivers/usb/host/dwc_otg/dwc_otg_cil.c +new file mode 100644 +index 0000000..38abd0b +--- /dev/null ++++ b/drivers/usb/host/dwc_otg/dwc_otg_cil.c +@@ -0,0 +1,7141 @@ ++/* ========================================================================== ++ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_cil.c $ ++ * $Revision: #191 $ ++ * $Date: 2012/08/10 $ ++ * $Change: 2047372 $ ++ * ++ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, ++ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless ++ * otherwise expressly agreed to in writing between Synopsys and you. ++ * ++ * The Software IS NOT an item of Licensed Software or Licensed Product under ++ * any End User Software License Agreement or Agreement for Licensed Product ++ * with Synopsys or any supplement thereto. You are permitted to use and ++ * redistribute this Software in source and binary forms, with or without ++ * modification, provided that redistributions of source code must retain this ++ * notice. You may not view, use, disclose, copy or distribute this file or ++ * any information contained herein except pursuant to this license grant from ++ * Synopsys. If you do not agree with this notice, including the disclaimer ++ * below, then you are not authorized to use the Software. ++ * ++ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS ++ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS 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. ++ * ========================================================================== */ ++ ++/** @file ++ * ++ * The Core Interface Layer provides basic services for accessing and ++ * managing the DWC_otg hardware. These services are used by both the ++ * Host Controller Driver and the Peripheral Controller Driver. ++ * ++ * The CIL manages the memory map for the core so that the HCD and PCD ++ * don't have to do this separately. It also handles basic tasks like ++ * reading/writing the registers and data FIFOs in the controller. ++ * Some of the data access functions provide encapsulation of several ++ * operations required to perform a task, such as writing multiple ++ * registers to start a transfer. Finally, the CIL performs basic ++ * services that are not specific to either the host or device modes ++ * of operation. These services include management of the OTG Host ++ * Negotiation Protocol (HNP) and Session Request Protocol (SRP). A ++ * Diagnostic API is also provided to allow testing of the controller ++ * hardware. ++ * ++ * The Core Interface Layer has the following requirements: ++ * - Provides basic controller operations. ++ * - Minimal use of OS services. ++ * - The OS services used will be abstracted by using inline functions ++ * or macros. ++ * ++ */ ++ ++#include "dwc_os.h" ++#include "dwc_otg_regs.h" ++#include "dwc_otg_cil.h" ++ ++static int dwc_otg_setup_params(dwc_otg_core_if_t * core_if); ++ ++/** ++ * This function is called to initialize the DWC_otg CSR data ++ * structures. The register addresses in the device and host ++ * structures are initialized from the base address supplied by the ++ * caller. The calling function must make the OS calls to get the ++ * base address of the DWC_otg controller registers. The core_params ++ * argument holds the parameters that specify how the core should be ++ * configured. ++ * ++ * @param reg_base_addr Base address of DWC_otg core registers ++ * ++ */ ++dwc_otg_core_if_t *dwc_otg_cil_init(const uint32_t * reg_base_addr) ++{ ++ dwc_otg_core_if_t *core_if = 0; ++ dwc_otg_dev_if_t *dev_if = 0; ++ dwc_otg_host_if_t *host_if = 0; ++ uint8_t *reg_base = (uint8_t *) reg_base_addr; ++ int i = 0; ++ ++ DWC_DEBUGPL(DBG_CILV, "%s(%p)\n", __func__, reg_base_addr); ++ ++ core_if = DWC_ALLOC(sizeof(dwc_otg_core_if_t)); ++ ++ if (core_if == NULL) { ++ DWC_DEBUGPL(DBG_CIL, ++ "Allocation of dwc_otg_core_if_t failed\n"); ++ return 0; ++ } ++ core_if->core_global_regs = (dwc_otg_core_global_regs_t *) reg_base; ++ ++ /* ++ * Allocate the Device Mode structures. ++ */ ++ dev_if = DWC_ALLOC(sizeof(dwc_otg_dev_if_t)); ++ ++ if (dev_if == NULL) { ++ DWC_DEBUGPL(DBG_CIL, "Allocation of dwc_otg_dev_if_t failed\n"); ++ DWC_FREE(core_if); ++ return 0; ++ } ++ ++ dev_if->dev_global_regs = ++ (dwc_otg_device_global_regs_t *) (reg_base + ++ DWC_DEV_GLOBAL_REG_OFFSET); ++ ++ for (i = 0; i < MAX_EPS_CHANNELS; i++) { ++ dev_if->in_ep_regs[i] = (dwc_otg_dev_in_ep_regs_t *) ++ (reg_base + DWC_DEV_IN_EP_REG_OFFSET + ++ (i * DWC_EP_REG_OFFSET)); ++ ++ dev_if->out_ep_regs[i] = (dwc_otg_dev_out_ep_regs_t *) ++ (reg_base + DWC_DEV_OUT_EP_REG_OFFSET + ++ (i * DWC_EP_REG_OFFSET)); ++ DWC_DEBUGPL(DBG_CILV, "in_ep_regs[%d]->diepctl=%p\n", ++ i, &dev_if->in_ep_regs[i]->diepctl); ++ DWC_DEBUGPL(DBG_CILV, "out_ep_regs[%d]->doepctl=%p\n", ++ i, &dev_if->out_ep_regs[i]->doepctl); ++ } ++ ++ dev_if->speed = 0; // unknown ++ ++ core_if->dev_if = dev_if; ++ ++ /* ++ * Allocate the Host Mode structures. ++ */ ++ host_if = DWC_ALLOC(sizeof(dwc_otg_host_if_t)); ++ ++ if (host_if == NULL) { ++ DWC_DEBUGPL(DBG_CIL, ++ "Allocation of dwc_otg_host_if_t failed\n"); ++ DWC_FREE(dev_if); ++ DWC_FREE(core_if); ++ return 0; ++ } ++ ++ host_if->host_global_regs = (dwc_otg_host_global_regs_t *) ++ (reg_base + DWC_OTG_HOST_GLOBAL_REG_OFFSET); ++ ++ host_if->hprt0 = ++ (uint32_t *) (reg_base + DWC_OTG_HOST_PORT_REGS_OFFSET); ++ ++ for (i = 0; i < MAX_EPS_CHANNELS; i++) { ++ host_if->hc_regs[i] = (dwc_otg_hc_regs_t *) ++ (reg_base + DWC_OTG_HOST_CHAN_REGS_OFFSET + ++ (i * DWC_OTG_CHAN_REGS_OFFSET)); ++ DWC_DEBUGPL(DBG_CILV, "hc_reg[%d]->hcchar=%p\n", ++ i, &host_if->hc_regs[i]->hcchar); ++ } ++ ++ host_if->num_host_channels = MAX_EPS_CHANNELS; ++ core_if->host_if = host_if; ++ ++ for (i = 0; i < MAX_EPS_CHANNELS; i++) { ++ core_if->data_fifo[i] = ++ (uint32_t *) (reg_base + DWC_OTG_DATA_FIFO_OFFSET + ++ (i * DWC_OTG_DATA_FIFO_SIZE)); ++ DWC_DEBUGPL(DBG_CILV, "data_fifo[%d]=0x%08lx\n", ++ i, (unsigned long)core_if->data_fifo[i]); ++ } ++ ++ core_if->pcgcctl = (uint32_t *) (reg_base + DWC_OTG_PCGCCTL_OFFSET); ++ ++ /* Initiate lx_state to L3 disconnected state */ ++ core_if->lx_state = DWC_OTG_L3; ++ /* ++ * Store the contents of the hardware configuration registers here for ++ * easy access later. ++ */ ++ core_if->hwcfg1.d32 = ++ DWC_READ_REG32(&core_if->core_global_regs->ghwcfg1); ++ core_if->hwcfg2.d32 = ++ DWC_READ_REG32(&core_if->core_global_regs->ghwcfg2); ++ core_if->hwcfg3.d32 = ++ DWC_READ_REG32(&core_if->core_global_regs->ghwcfg3); ++ core_if->hwcfg4.d32 = ++ DWC_READ_REG32(&core_if->core_global_regs->ghwcfg4); ++ ++ /* Force host mode to get HPTXFSIZ exact power on value */ ++ { ++ gusbcfg_data_t gusbcfg = {.d32 = 0 }; ++ gusbcfg.d32 = DWC_READ_REG32(&core_if->core_global_regs->gusbcfg); ++ gusbcfg.b.force_host_mode = 1; ++ DWC_WRITE_REG32(&core_if->core_global_regs->gusbcfg, gusbcfg.d32); ++ dwc_mdelay(100); ++ core_if->hptxfsiz.d32 = ++ DWC_READ_REG32(&core_if->core_global_regs->hptxfsiz); ++ gusbcfg.d32 = DWC_READ_REG32(&core_if->core_global_regs->gusbcfg); ++ gusbcfg.b.force_host_mode = 1; ++ DWC_WRITE_REG32(&core_if->core_global_regs->gusbcfg, gusbcfg.d32); ++ dwc_mdelay(100); ++ } ++ ++ DWC_DEBUGPL(DBG_CILV, "hwcfg1=%08x\n", core_if->hwcfg1.d32); ++ DWC_DEBUGPL(DBG_CILV, "hwcfg2=%08x\n", core_if->hwcfg2.d32); ++ DWC_DEBUGPL(DBG_CILV, "hwcfg3=%08x\n", core_if->hwcfg3.d32); ++ DWC_DEBUGPL(DBG_CILV, "hwcfg4=%08x\n", core_if->hwcfg4.d32); ++ ++ core_if->hcfg.d32 = ++ DWC_READ_REG32(&core_if->host_if->host_global_regs->hcfg); ++ core_if->dcfg.d32 = ++ DWC_READ_REG32(&core_if->dev_if->dev_global_regs->dcfg); ++ ++ DWC_DEBUGPL(DBG_CILV, "hcfg=%08x\n", core_if->hcfg.d32); ++ DWC_DEBUGPL(DBG_CILV, "dcfg=%08x\n", core_if->dcfg.d32); ++ ++ DWC_DEBUGPL(DBG_CILV, "op_mode=%0x\n", core_if->hwcfg2.b.op_mode); ++ DWC_DEBUGPL(DBG_CILV, "arch=%0x\n", core_if->hwcfg2.b.architecture); ++ DWC_DEBUGPL(DBG_CILV, "num_dev_ep=%d\n", core_if->hwcfg2.b.num_dev_ep); ++ DWC_DEBUGPL(DBG_CILV, "num_host_chan=%d\n", ++ core_if->hwcfg2.b.num_host_chan); ++ DWC_DEBUGPL(DBG_CILV, "nonperio_tx_q_depth=0x%0x\n", ++ core_if->hwcfg2.b.nonperio_tx_q_depth); ++ DWC_DEBUGPL(DBG_CILV, "host_perio_tx_q_depth=0x%0x\n", ++ core_if->hwcfg2.b.host_perio_tx_q_depth); ++ DWC_DEBUGPL(DBG_CILV, "dev_token_q_depth=0x%0x\n", ++ core_if->hwcfg2.b.dev_token_q_depth); ++ ++ DWC_DEBUGPL(DBG_CILV, "Total FIFO SZ=%d\n", ++ core_if->hwcfg3.b.dfifo_depth); ++ DWC_DEBUGPL(DBG_CILV, "xfer_size_cntr_width=%0x\n", ++ core_if->hwcfg3.b.xfer_size_cntr_width); ++ ++ /* ++ * Set the SRP sucess bit for FS-I2c ++ */ ++ core_if->srp_success = 0; ++ core_if->srp_timer_started = 0; ++ ++ /* ++ * Create new workqueue and init works ++ */ ++ core_if->wq_otg = DWC_WORKQ_ALLOC("dwc_otg"); ++ if (core_if->wq_otg == 0) { ++ DWC_WARN("DWC_WORKQ_ALLOC failed\n"); ++ DWC_FREE(host_if); ++ DWC_FREE(dev_if); ++ DWC_FREE(core_if); ++ return 0; ++ } ++ ++ core_if->snpsid = DWC_READ_REG32(&core_if->core_global_regs->gsnpsid); ++ ++ DWC_PRINTF("Core Release: %x.%x%x%x\n", ++ (core_if->snpsid >> 12 & 0xF), ++ (core_if->snpsid >> 8 & 0xF), ++ (core_if->snpsid >> 4 & 0xF), (core_if->snpsid & 0xF)); ++ ++ core_if->wkp_timer = DWC_TIMER_ALLOC("Wake Up Timer", ++ w_wakeup_detected, core_if); ++ if (core_if->wkp_timer == 0) { ++ DWC_WARN("DWC_TIMER_ALLOC failed\n"); ++ DWC_FREE(host_if); ++ DWC_FREE(dev_if); ++ DWC_WORKQ_FREE(core_if->wq_otg); ++ DWC_FREE(core_if); ++ return 0; ++ } ++ ++ if (dwc_otg_setup_params(core_if)) { ++ DWC_WARN("Error while setting core params\n"); ++ } ++ ++ core_if->hibernation_suspend = 0; ++ ++ /** ADP initialization */ ++ dwc_otg_adp_init(core_if); ++ ++ return core_if; ++} ++ ++/** ++ * This function frees the structures allocated by dwc_otg_cil_init(). ++ * ++ * @param core_if The core interface pointer returned from ++ * dwc_otg_cil_init(). ++ * ++ */ ++void dwc_otg_cil_remove(dwc_otg_core_if_t * core_if) ++{ ++ dctl_data_t dctl = {.d32 = 0 }; ++ DWC_DEBUGPL(DBG_CILV, "%s(%p)\n", __func__, core_if); ++ ++ /* Disable all interrupts */ ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gahbcfg, 1, 0); ++ DWC_WRITE_REG32(&core_if->core_global_regs->gintmsk, 0); ++ ++ dctl.b.sftdiscon = 1; ++ if (core_if->snpsid >= OTG_CORE_REV_3_00a) { ++ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs->dctl, 0, ++ dctl.d32); ++ } ++ ++ if (core_if->wq_otg) { ++ DWC_WORKQ_WAIT_WORK_DONE(core_if->wq_otg, 500); ++ DWC_WORKQ_FREE(core_if->wq_otg); ++ } ++ if (core_if->dev_if) { ++ DWC_FREE(core_if->dev_if); ++ } ++ if (core_if->host_if) { ++ DWC_FREE(core_if->host_if); ++ } ++ ++ /** Remove ADP Stuff */ ++ dwc_otg_adp_remove(core_if); ++ if (core_if->core_params) { ++ DWC_FREE(core_if->core_params); ++ } ++ if (core_if->wkp_timer) { ++ DWC_TIMER_FREE(core_if->wkp_timer); ++ } ++ if (core_if->srp_timer) { ++ DWC_TIMER_FREE(core_if->srp_timer); ++ } ++ DWC_FREE(core_if); ++} ++ ++/** ++ * This function enables the controller's Global Interrupt in the AHB Config ++ * register. ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ */ ++void dwc_otg_enable_global_interrupts(dwc_otg_core_if_t * core_if) ++{ ++ gahbcfg_data_t ahbcfg = {.d32 = 0 }; ++ ahbcfg.b.glblintrmsk = 1; /* Enable interrupts */ ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gahbcfg, 0, ahbcfg.d32); ++} ++ ++/** ++ * This function disables the controller's Global Interrupt in the AHB Config ++ * register. ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ */ ++void dwc_otg_disable_global_interrupts(dwc_otg_core_if_t * core_if) ++{ ++ gahbcfg_data_t ahbcfg = {.d32 = 0 }; ++ ahbcfg.b.glblintrmsk = 1; /* Disable interrupts */ ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gahbcfg, ahbcfg.d32, 0); ++} ++ ++/** ++ * This function initializes the commmon interrupts, used in both ++ * device and host modes. ++ * ++ * @param core_if Programming view of the DWC_otg controller ++ * ++ */ ++static void dwc_otg_enable_common_interrupts(dwc_otg_core_if_t * core_if) ++{ ++ dwc_otg_core_global_regs_t *global_regs = core_if->core_global_regs; ++ gintmsk_data_t intr_mask = {.d32 = 0 }; ++ ++ /* Clear any pending OTG Interrupts */ ++ DWC_WRITE_REG32(&global_regs->gotgint, 0xFFFFFFFF); ++ ++ /* Clear any pending interrupts */ ++ DWC_WRITE_REG32(&global_regs->gintsts, 0xFFFFFFFF); ++ ++ /* ++ * Enable the interrupts in the GINTMSK. ++ */ ++ intr_mask.b.modemismatch = 1; ++ intr_mask.b.otgintr = 1; ++ ++ if (!core_if->dma_enable) { ++ intr_mask.b.rxstsqlvl = 1; ++ } ++ ++ intr_mask.b.conidstschng = 1; ++ intr_mask.b.wkupintr = 1; ++ intr_mask.b.disconnect = 0; ++ intr_mask.b.usbsuspend = 1; ++ intr_mask.b.sessreqintr = 1; ++#ifdef CONFIG_USB_DWC_OTG_LPM ++ if (core_if->core_params->lpm_enable) { ++ intr_mask.b.lpmtranrcvd = 1; ++ } ++#endif ++ DWC_WRITE_REG32(&global_regs->gintmsk, intr_mask.d32); ++} ++ ++/* ++ * The restore operation is modified to support Synopsys Emulated Powerdown and ++ * Hibernation. This function is for exiting from Device mode hibernation by ++ * Host Initiated Resume/Reset and Device Initiated Remote-Wakeup. ++ * @param core_if Programming view of DWC_otg controller. ++ * @param rem_wakeup - indicates whether resume is initiated by Device or Host. ++ * @param reset - indicates whether resume is initiated by Reset. ++ */ ++int dwc_otg_device_hibernation_restore(dwc_otg_core_if_t * core_if, ++ int rem_wakeup, int reset) ++{ ++ gpwrdn_data_t gpwrdn = {.d32 = 0 }; ++ pcgcctl_data_t pcgcctl = {.d32 = 0 }; ++ dctl_data_t dctl = {.d32 = 0 }; ++ ++ int timeout = 2000; ++ ++ if (!core_if->hibernation_suspend) { ++ DWC_PRINTF("Already exited from Hibernation\n"); ++ return 1; ++ } ++ ++ DWC_DEBUGPL(DBG_PCD, "%s called\n", __FUNCTION__); ++ /* Switch-on voltage to the core */ ++ gpwrdn.b.pwrdnswtch = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ dwc_udelay(10); ++ ++ /* Reset core */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pwrdnrstn = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ dwc_udelay(10); ++ ++ /* Assert Restore signal */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.restore = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, 0, gpwrdn.d32); ++ dwc_udelay(10); ++ ++ /* Disable power clamps */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pwrdnclmp = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ ++ if (rem_wakeup) { ++ dwc_udelay(70); ++ } ++ ++ /* Deassert Reset core */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pwrdnrstn = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, 0, gpwrdn.d32); ++ dwc_udelay(10); ++ ++ /* Disable PMU interrupt */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pmuintsel = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ ++ /* Mask interrupts from gpwrdn */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.connect_det_msk = 1; ++ gpwrdn.b.srp_det_msk = 1; ++ gpwrdn.b.disconn_det_msk = 1; ++ gpwrdn.b.rst_det_msk = 1; ++ gpwrdn.b.lnstchng_msk = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ ++ /* Indicates that we are going out from hibernation */ ++ core_if->hibernation_suspend = 0; ++ ++ /* ++ * Set Restore Essential Regs bit in PCGCCTL register, restore_mode = 1 ++ * indicates restore from remote_wakeup ++ */ ++ restore_essential_regs(core_if, rem_wakeup, 0); ++ ++ /* ++ * Wait a little for seeing new value of variable hibernation_suspend if ++ * Restore done interrupt received before polling ++ */ ++ dwc_udelay(10); ++ ++ if (core_if->hibernation_suspend == 0) { ++ /* ++ * Wait For Restore_done Interrupt. This mechanism of polling the ++ * interrupt is introduced to avoid any possible race conditions ++ */ ++ do { ++ gintsts_data_t gintsts; ++ gintsts.d32 = ++ DWC_READ_REG32(&core_if->core_global_regs->gintsts); ++ if (gintsts.b.restoredone) { ++ gintsts.d32 = 0; ++ gintsts.b.restoredone = 1; ++ DWC_WRITE_REG32(&core_if->core_global_regs-> ++ gintsts, gintsts.d32); ++ DWC_PRINTF("Restore Done Interrupt seen\n"); ++ break; ++ } ++ dwc_udelay(10); ++ } while (--timeout); ++ if (!timeout) { ++ DWC_PRINTF("Restore Done interrupt wasn't generated here\n"); ++ } ++ } ++ /* Clear all pending interupts */ ++ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, 0xFFFFFFFF); ++ ++ /* De-assert Restore */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.restore = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ dwc_udelay(10); ++ ++ if (!rem_wakeup) { ++ pcgcctl.d32 = 0; ++ pcgcctl.b.rstpdwnmodule = 1; ++ DWC_MODIFY_REG32(core_if->pcgcctl, pcgcctl.d32, 0); ++ } ++ ++ /* Restore GUSBCFG and DCFG */ ++ DWC_WRITE_REG32(&core_if->core_global_regs->gusbcfg, ++ core_if->gr_backup->gusbcfg_local); ++ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->dcfg, ++ core_if->dr_backup->dcfg); ++ ++ /* De-assert Wakeup Logic */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pmuactv = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ dwc_udelay(10); ++ ++ if (!rem_wakeup) { ++ /* Set Device programming done bit */ ++ dctl.b.pwronprgdone = 1; ++ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs->dctl, 0, dctl.d32); ++ } else { ++ /* Start Remote Wakeup Signaling */ ++ dctl.d32 = core_if->dr_backup->dctl; ++ dctl.b.rmtwkupsig = 1; ++ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->dctl, dctl.d32); ++ } ++ ++ dwc_mdelay(2); ++ /* Clear all pending interupts */ ++ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, 0xFFFFFFFF); ++ ++ /* Restore global registers */ ++ dwc_otg_restore_global_regs(core_if); ++ /* Restore device global registers */ ++ dwc_otg_restore_dev_regs(core_if, rem_wakeup); ++ ++ if (rem_wakeup) { ++ dwc_mdelay(7); ++ dctl.d32 = 0; ++ dctl.b.rmtwkupsig = 1; ++ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs->dctl, dctl.d32, 0); ++ } ++ ++ core_if->hibernation_suspend = 0; ++ /* The core will be in ON STATE */ ++ core_if->lx_state = DWC_OTG_L0; ++ DWC_PRINTF("Hibernation recovery completes here\n"); ++ ++ return 1; ++} ++ ++/* ++ * The restore operation is modified to support Synopsys Emulated Powerdown and ++ * Hibernation. This function is for exiting from Host mode hibernation by ++ * Host Initiated Resume/Reset and Device Initiated Remote-Wakeup. ++ * @param core_if Programming view of DWC_otg controller. ++ * @param rem_wakeup - indicates whether resume is initiated by Device or Host. ++ * @param reset - indicates whether resume is initiated by Reset. ++ */ ++int dwc_otg_host_hibernation_restore(dwc_otg_core_if_t * core_if, ++ int rem_wakeup, int reset) ++{ ++ gpwrdn_data_t gpwrdn = {.d32 = 0 }; ++ hprt0_data_t hprt0 = {.d32 = 0 }; ++ ++ int timeout = 2000; ++ ++ DWC_DEBUGPL(DBG_HCD, "%s called\n", __FUNCTION__); ++ /* Switch-on voltage to the core */ ++ gpwrdn.b.pwrdnswtch = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ dwc_udelay(10); ++ ++ /* Reset core */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pwrdnrstn = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ dwc_udelay(10); ++ ++ /* Assert Restore signal */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.restore = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, 0, gpwrdn.d32); ++ dwc_udelay(10); ++ ++ /* Disable power clamps */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pwrdnclmp = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ ++ if (!rem_wakeup) { ++ dwc_udelay(50); ++ } ++ ++ /* Deassert Reset core */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pwrdnrstn = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, 0, gpwrdn.d32); ++ dwc_udelay(10); ++ ++ /* Disable PMU interrupt */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pmuintsel = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.connect_det_msk = 1; ++ gpwrdn.b.srp_det_msk = 1; ++ gpwrdn.b.disconn_det_msk = 1; ++ gpwrdn.b.rst_det_msk = 1; ++ gpwrdn.b.lnstchng_msk = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ ++ /* Indicates that we are going out from hibernation */ ++ core_if->hibernation_suspend = 0; ++ ++ /* Set Restore Essential Regs bit in PCGCCTL register */ ++ restore_essential_regs(core_if, rem_wakeup, 1); ++ ++ /* Wait a little for seeing new value of variable hibernation_suspend if ++ * Restore done interrupt received before polling */ ++ dwc_udelay(10); ++ ++ if (core_if->hibernation_suspend == 0) { ++ /* Wait For Restore_done Interrupt. This mechanism of polling the ++ * interrupt is introduced to avoid any possible race conditions ++ */ ++ do { ++ gintsts_data_t gintsts; ++ gintsts.d32 = DWC_READ_REG32(&core_if->core_global_regs->gintsts); ++ if (gintsts.b.restoredone) { ++ gintsts.d32 = 0; ++ gintsts.b.restoredone = 1; ++ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, gintsts.d32); ++ DWC_DEBUGPL(DBG_HCD,"Restore Done Interrupt seen\n"); ++ break; ++ } ++ dwc_udelay(10); ++ } while (--timeout); ++ if (!timeout) { ++ DWC_WARN("Restore Done interrupt wasn't generated\n"); ++ } ++ } ++ ++ /* Set the flag's value to 0 again after receiving restore done interrupt */ ++ core_if->hibernation_suspend = 0; ++ ++ /* This step is not described in functional spec but if not wait for this ++ * delay, mismatch interrupts occurred because just after restore core is ++ * in Device mode(gintsts.curmode == 0) */ ++ dwc_mdelay(100); ++ ++ /* Clear all pending interrupts */ ++ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, 0xFFFFFFFF); ++ ++ /* De-assert Restore */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.restore = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ dwc_udelay(10); ++ ++ /* Restore GUSBCFG and HCFG */ ++ DWC_WRITE_REG32(&core_if->core_global_regs->gusbcfg, ++ core_if->gr_backup->gusbcfg_local); ++ DWC_WRITE_REG32(&core_if->host_if->host_global_regs->hcfg, ++ core_if->hr_backup->hcfg_local); ++ ++ /* De-assert Wakeup Logic */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pmuactv = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ dwc_udelay(10); ++ ++ /* Start the Resume operation by programming HPRT0 */ ++ hprt0.d32 = core_if->hr_backup->hprt0_local; ++ hprt0.b.prtpwr = 1; ++ hprt0.b.prtena = 0; ++ hprt0.b.prtsusp = 0; ++ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); ++ ++ DWC_PRINTF("Resume Starts Now\n"); ++ if (!reset) { // Indicates it is Resume Operation ++ hprt0.d32 = core_if->hr_backup->hprt0_local; ++ hprt0.b.prtres = 1; ++ hprt0.b.prtpwr = 1; ++ hprt0.b.prtena = 0; ++ hprt0.b.prtsusp = 0; ++ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); ++ ++ if (!rem_wakeup) ++ hprt0.b.prtres = 0; ++ /* Wait for Resume time and then program HPRT again */ ++ dwc_mdelay(100); ++ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); ++ ++ } else { // Indicates it is Reset Operation ++ hprt0.d32 = core_if->hr_backup->hprt0_local; ++ hprt0.b.prtrst = 1; ++ hprt0.b.prtpwr = 1; ++ hprt0.b.prtena = 0; ++ hprt0.b.prtsusp = 0; ++ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); ++ /* Wait for Reset time and then program HPRT again */ ++ dwc_mdelay(60); ++ hprt0.b.prtrst = 0; ++ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); ++ } ++ /* Clear all interrupt status */ ++ hprt0.d32 = dwc_otg_read_hprt0(core_if); ++ hprt0.b.prtconndet = 1; ++ hprt0.b.prtenchng = 1; ++ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); ++ ++ /* Clear all pending interupts */ ++ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, 0xFFFFFFFF); ++ ++ /* Restore global registers */ ++ dwc_otg_restore_global_regs(core_if); ++ /* Restore host global registers */ ++ dwc_otg_restore_host_regs(core_if, reset); ++ ++ /* The core will be in ON STATE */ ++ core_if->lx_state = DWC_OTG_L0; ++ DWC_PRINTF("Hibernation recovery is complete here\n"); ++ return 0; ++} ++ ++/** Saves some register values into system memory. */ ++int dwc_otg_save_global_regs(dwc_otg_core_if_t * core_if) ++{ ++ struct dwc_otg_global_regs_backup *gr; ++ int i; ++ ++ gr = core_if->gr_backup; ++ if (!gr) { ++ gr = DWC_ALLOC(sizeof(*gr)); ++ if (!gr) { ++ return -DWC_E_NO_MEMORY; ++ } ++ core_if->gr_backup = gr; ++ } ++ ++ gr->gotgctl_local = DWC_READ_REG32(&core_if->core_global_regs->gotgctl); ++ gr->gintmsk_local = DWC_READ_REG32(&core_if->core_global_regs->gintmsk); ++ gr->gahbcfg_local = DWC_READ_REG32(&core_if->core_global_regs->gahbcfg); ++ gr->gusbcfg_local = DWC_READ_REG32(&core_if->core_global_regs->gusbcfg); ++ gr->grxfsiz_local = DWC_READ_REG32(&core_if->core_global_regs->grxfsiz); ++ gr->gnptxfsiz_local = DWC_READ_REG32(&core_if->core_global_regs->gnptxfsiz); ++ gr->hptxfsiz_local = DWC_READ_REG32(&core_if->core_global_regs->hptxfsiz); ++#ifdef CONFIG_USB_DWC_OTG_LPM ++ gr->glpmcfg_local = DWC_READ_REG32(&core_if->core_global_regs->glpmcfg); ++#endif ++ gr->gi2cctl_local = DWC_READ_REG32(&core_if->core_global_regs->gi2cctl); ++ gr->pcgcctl_local = DWC_READ_REG32(core_if->pcgcctl); ++ gr->gdfifocfg_local = ++ DWC_READ_REG32(&core_if->core_global_regs->gdfifocfg); ++ for (i = 0; i < MAX_EPS_CHANNELS; i++) { ++ gr->dtxfsiz_local[i] = ++ DWC_READ_REG32(&(core_if->core_global_regs->dtxfsiz[i])); ++ } ++ ++ DWC_DEBUGPL(DBG_ANY, "===========Backing Global registers==========\n"); ++ DWC_DEBUGPL(DBG_ANY, "Backed up gotgctl = %08x\n", gr->gotgctl_local); ++ DWC_DEBUGPL(DBG_ANY, "Backed up gintmsk = %08x\n", gr->gintmsk_local); ++ DWC_DEBUGPL(DBG_ANY, "Backed up gahbcfg = %08x\n", gr->gahbcfg_local); ++ DWC_DEBUGPL(DBG_ANY, "Backed up gusbcfg = %08x\n", gr->gusbcfg_local); ++ DWC_DEBUGPL(DBG_ANY, "Backed up grxfsiz = %08x\n", gr->grxfsiz_local); ++ DWC_DEBUGPL(DBG_ANY, "Backed up gnptxfsiz = %08x\n", ++ gr->gnptxfsiz_local); ++ DWC_DEBUGPL(DBG_ANY, "Backed up hptxfsiz = %08x\n", ++ gr->hptxfsiz_local); ++#ifdef CONFIG_USB_DWC_OTG_LPM ++ DWC_DEBUGPL(DBG_ANY, "Backed up glpmcfg = %08x\n", gr->glpmcfg_local); ++#endif ++ DWC_DEBUGPL(DBG_ANY, "Backed up gi2cctl = %08x\n", gr->gi2cctl_local); ++ DWC_DEBUGPL(DBG_ANY, "Backed up pcgcctl = %08x\n", gr->pcgcctl_local); ++ DWC_DEBUGPL(DBG_ANY,"Backed up gdfifocfg = %08x\n",gr->gdfifocfg_local); ++ ++ return 0; ++} ++ ++/** Saves GINTMSK register before setting the msk bits. */ ++int dwc_otg_save_gintmsk_reg(dwc_otg_core_if_t * core_if) ++{ ++ struct dwc_otg_global_regs_backup *gr; ++ ++ gr = core_if->gr_backup; ++ if (!gr) { ++ gr = DWC_ALLOC(sizeof(*gr)); ++ if (!gr) { ++ return -DWC_E_NO_MEMORY; ++ } ++ core_if->gr_backup = gr; ++ } ++ ++ gr->gintmsk_local = DWC_READ_REG32(&core_if->core_global_regs->gintmsk); ++ ++ DWC_DEBUGPL(DBG_ANY,"=============Backing GINTMSK registers============\n"); ++ DWC_DEBUGPL(DBG_ANY, "Backed up gintmsk = %08x\n", gr->gintmsk_local); ++ ++ return 0; ++} ++ ++int dwc_otg_save_dev_regs(dwc_otg_core_if_t * core_if) ++{ ++ struct dwc_otg_dev_regs_backup *dr; ++ int i; ++ ++ dr = core_if->dr_backup; ++ if (!dr) { ++ dr = DWC_ALLOC(sizeof(*dr)); ++ if (!dr) { ++ return -DWC_E_NO_MEMORY; ++ } ++ core_if->dr_backup = dr; ++ } ++ ++ dr->dcfg = DWC_READ_REG32(&core_if->dev_if->dev_global_regs->dcfg); ++ dr->dctl = DWC_READ_REG32(&core_if->dev_if->dev_global_regs->dctl); ++ dr->daintmsk = ++ DWC_READ_REG32(&core_if->dev_if->dev_global_regs->daintmsk); ++ dr->diepmsk = ++ DWC_READ_REG32(&core_if->dev_if->dev_global_regs->diepmsk); ++ dr->doepmsk = ++ DWC_READ_REG32(&core_if->dev_if->dev_global_regs->doepmsk); ++ ++ for (i = 0; i < core_if->dev_if->num_in_eps; ++i) { ++ dr->diepctl[i] = ++ DWC_READ_REG32(&core_if->dev_if->in_ep_regs[i]->diepctl); ++ dr->dieptsiz[i] = ++ DWC_READ_REG32(&core_if->dev_if->in_ep_regs[i]->dieptsiz); ++ dr->diepdma[i] = ++ DWC_READ_REG32(&core_if->dev_if->in_ep_regs[i]->diepdma); ++ } ++ ++ DWC_DEBUGPL(DBG_ANY, ++ "=============Backing Host registers==============\n"); ++ DWC_DEBUGPL(DBG_ANY, "Backed up dcfg = %08x\n", dr->dcfg); ++ DWC_DEBUGPL(DBG_ANY, "Backed up dctl = %08x\n", dr->dctl); ++ DWC_DEBUGPL(DBG_ANY, "Backed up daintmsk = %08x\n", ++ dr->daintmsk); ++ DWC_DEBUGPL(DBG_ANY, "Backed up diepmsk = %08x\n", dr->diepmsk); ++ DWC_DEBUGPL(DBG_ANY, "Backed up doepmsk = %08x\n", dr->doepmsk); ++ for (i = 0; i < core_if->dev_if->num_in_eps; ++i) { ++ DWC_DEBUGPL(DBG_ANY, "Backed up diepctl[%d] = %08x\n", i, ++ dr->diepctl[i]); ++ DWC_DEBUGPL(DBG_ANY, "Backed up dieptsiz[%d] = %08x\n", ++ i, dr->dieptsiz[i]); ++ DWC_DEBUGPL(DBG_ANY, "Backed up diepdma[%d] = %08x\n", i, ++ dr->diepdma[i]); ++ } ++ ++ return 0; ++} ++ ++int dwc_otg_save_host_regs(dwc_otg_core_if_t * core_if) ++{ ++ struct dwc_otg_host_regs_backup *hr; ++ int i; ++ ++ hr = core_if->hr_backup; ++ if (!hr) { ++ hr = DWC_ALLOC(sizeof(*hr)); ++ if (!hr) { ++ return -DWC_E_NO_MEMORY; ++ } ++ core_if->hr_backup = hr; ++ } ++ ++ hr->hcfg_local = ++ DWC_READ_REG32(&core_if->host_if->host_global_regs->hcfg); ++ hr->haintmsk_local = ++ DWC_READ_REG32(&core_if->host_if->host_global_regs->haintmsk); ++ for (i = 0; i < dwc_otg_get_param_host_channels(core_if); ++i) { ++ hr->hcintmsk_local[i] = ++ DWC_READ_REG32(&core_if->host_if->hc_regs[i]->hcintmsk); ++ } ++ hr->hprt0_local = DWC_READ_REG32(core_if->host_if->hprt0); ++ hr->hfir_local = ++ DWC_READ_REG32(&core_if->host_if->host_global_regs->hfir); ++ ++ DWC_DEBUGPL(DBG_ANY, ++ "=============Backing Host registers===============\n"); ++ DWC_DEBUGPL(DBG_ANY, "Backed up hcfg = %08x\n", ++ hr->hcfg_local); ++ DWC_DEBUGPL(DBG_ANY, "Backed up haintmsk = %08x\n", hr->haintmsk_local); ++ for (i = 0; i < dwc_otg_get_param_host_channels(core_if); ++i) { ++ DWC_DEBUGPL(DBG_ANY, "Backed up hcintmsk[%02d]=%08x\n", i, ++ hr->hcintmsk_local[i]); ++ } ++ DWC_DEBUGPL(DBG_ANY, "Backed up hprt0 = %08x\n", ++ hr->hprt0_local); ++ DWC_DEBUGPL(DBG_ANY, "Backed up hfir = %08x\n", ++ hr->hfir_local); ++ ++ return 0; ++} ++ ++int dwc_otg_restore_global_regs(dwc_otg_core_if_t *core_if) ++{ ++ struct dwc_otg_global_regs_backup *gr; ++ int i; ++ ++ gr = core_if->gr_backup; ++ if (!gr) { ++ return -DWC_E_INVALID; ++ } ++ ++ DWC_WRITE_REG32(&core_if->core_global_regs->gotgctl, gr->gotgctl_local); ++ DWC_WRITE_REG32(&core_if->core_global_regs->gintmsk, gr->gintmsk_local); ++ DWC_WRITE_REG32(&core_if->core_global_regs->gusbcfg, gr->gusbcfg_local); ++ DWC_WRITE_REG32(&core_if->core_global_regs->gahbcfg, gr->gahbcfg_local); ++ DWC_WRITE_REG32(&core_if->core_global_regs->grxfsiz, gr->grxfsiz_local); ++ DWC_WRITE_REG32(&core_if->core_global_regs->gnptxfsiz, ++ gr->gnptxfsiz_local); ++ DWC_WRITE_REG32(&core_if->core_global_regs->hptxfsiz, ++ gr->hptxfsiz_local); ++ DWC_WRITE_REG32(&core_if->core_global_regs->gdfifocfg, ++ gr->gdfifocfg_local); ++ for (i = 0; i < MAX_EPS_CHANNELS; i++) { ++ DWC_WRITE_REG32(&core_if->core_global_regs->dtxfsiz[i], ++ gr->dtxfsiz_local[i]); ++ } ++ ++ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, 0xFFFFFFFF); ++ DWC_WRITE_REG32(core_if->host_if->hprt0, 0x0000100A); ++ DWC_WRITE_REG32(&core_if->core_global_regs->gahbcfg, ++ (gr->gahbcfg_local)); ++ return 0; ++} ++ ++int dwc_otg_restore_dev_regs(dwc_otg_core_if_t * core_if, int rem_wakeup) ++{ ++ struct dwc_otg_dev_regs_backup *dr; ++ int i; ++ ++ dr = core_if->dr_backup; ++ ++ if (!dr) { ++ return -DWC_E_INVALID; ++ } ++ ++ if (!rem_wakeup) { ++ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->dctl, ++ dr->dctl); ++ } ++ ++ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->daintmsk, dr->daintmsk); ++ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->diepmsk, dr->diepmsk); ++ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->doepmsk, dr->doepmsk); ++ ++ for (i = 0; i < core_if->dev_if->num_in_eps; ++i) { ++ DWC_WRITE_REG32(&core_if->dev_if->in_ep_regs[i]->dieptsiz, dr->dieptsiz[i]); ++ DWC_WRITE_REG32(&core_if->dev_if->in_ep_regs[i]->diepdma, dr->diepdma[i]); ++ DWC_WRITE_REG32(&core_if->dev_if->in_ep_regs[i]->diepctl, dr->diepctl[i]); ++ } ++ ++ return 0; ++} ++ ++int dwc_otg_restore_host_regs(dwc_otg_core_if_t * core_if, int reset) ++{ ++ struct dwc_otg_host_regs_backup *hr; ++ int i; ++ hr = core_if->hr_backup; ++ ++ if (!hr) { ++ return -DWC_E_INVALID; ++ } ++ ++ DWC_WRITE_REG32(&core_if->host_if->host_global_regs->hcfg, hr->hcfg_local); ++ //if (!reset) ++ //{ ++ // DWC_WRITE_REG32(&core_if->host_if->host_global_regs->hfir, hr->hfir_local); ++ //} ++ ++ DWC_WRITE_REG32(&core_if->host_if->host_global_regs->haintmsk, ++ hr->haintmsk_local); ++ for (i = 0; i < dwc_otg_get_param_host_channels(core_if); ++i) { ++ DWC_WRITE_REG32(&core_if->host_if->hc_regs[i]->hcintmsk, ++ hr->hcintmsk_local[i]); ++ } ++ ++ return 0; ++} ++ ++int restore_lpm_i2c_regs(dwc_otg_core_if_t * core_if) ++{ ++ struct dwc_otg_global_regs_backup *gr; ++ ++ gr = core_if->gr_backup; ++ ++ /* Restore values for LPM and I2C */ ++#ifdef CONFIG_USB_DWC_OTG_LPM ++ DWC_WRITE_REG32(&core_if->core_global_regs->glpmcfg, gr->glpmcfg_local); ++#endif ++ DWC_WRITE_REG32(&core_if->core_global_regs->gi2cctl, gr->gi2cctl_local); ++ ++ return 0; ++} ++ ++int restore_essential_regs(dwc_otg_core_if_t * core_if, int rmode, int is_host) ++{ ++ struct dwc_otg_global_regs_backup *gr; ++ pcgcctl_data_t pcgcctl = {.d32 = 0 }; ++ gahbcfg_data_t gahbcfg = {.d32 = 0 }; ++ gusbcfg_data_t gusbcfg = {.d32 = 0 }; ++ gintmsk_data_t gintmsk = {.d32 = 0 }; ++ ++ /* Restore LPM and I2C registers */ ++ restore_lpm_i2c_regs(core_if); ++ ++ /* Set PCGCCTL to 0 */ ++ DWC_WRITE_REG32(core_if->pcgcctl, 0x00000000); ++ ++ gr = core_if->gr_backup; ++ /* Load restore values for [31:14] bits */ ++ DWC_WRITE_REG32(core_if->pcgcctl, ++ ((gr->pcgcctl_local & 0xffffc000) | 0x00020000)); ++ ++ /* Umnask global Interrupt in GAHBCFG and restore it */ ++ gahbcfg.d32 = gr->gahbcfg_local; ++ gahbcfg.b.glblintrmsk = 1; ++ DWC_WRITE_REG32(&core_if->core_global_regs->gahbcfg, gahbcfg.d32); ++ ++ /* Clear all pending interupts */ ++ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, 0xFFFFFFFF); ++ ++ /* Unmask restore done interrupt */ ++ gintmsk.b.restoredone = 1; ++ DWC_WRITE_REG32(&core_if->core_global_regs->gintmsk, gintmsk.d32); ++ ++ /* Restore GUSBCFG and HCFG/DCFG */ ++ gusbcfg.d32 = core_if->gr_backup->gusbcfg_local; ++ DWC_WRITE_REG32(&core_if->core_global_regs->gusbcfg, gusbcfg.d32); ++ ++ if (is_host) { ++ hcfg_data_t hcfg = {.d32 = 0 }; ++ hcfg.d32 = core_if->hr_backup->hcfg_local; ++ DWC_WRITE_REG32(&core_if->host_if->host_global_regs->hcfg, ++ hcfg.d32); ++ ++ /* Load restore values for [31:14] bits */ ++ pcgcctl.d32 = gr->pcgcctl_local & 0xffffc000; ++ pcgcctl.d32 = gr->pcgcctl_local | 0x00020000; ++ ++ if (rmode) ++ pcgcctl.b.restoremode = 1; ++ DWC_WRITE_REG32(core_if->pcgcctl, pcgcctl.d32); ++ dwc_udelay(10); ++ ++ /* Load restore values for [31:14] bits and set EssRegRestored bit */ ++ pcgcctl.d32 = gr->pcgcctl_local | 0xffffc000; ++ pcgcctl.d32 = gr->pcgcctl_local & 0xffffc000; ++ pcgcctl.b.ess_reg_restored = 1; ++ if (rmode) ++ pcgcctl.b.restoremode = 1; ++ DWC_WRITE_REG32(core_if->pcgcctl, pcgcctl.d32); ++ } else { ++ dcfg_data_t dcfg = {.d32 = 0 }; ++ dcfg.d32 = core_if->dr_backup->dcfg; ++ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->dcfg, dcfg.d32); ++ ++ /* Load restore values for [31:14] bits */ ++ pcgcctl.d32 = gr->pcgcctl_local & 0xffffc000; ++ pcgcctl.d32 = gr->pcgcctl_local | 0x00020000; ++ if (!rmode) { ++ pcgcctl.d32 |= 0x208; ++ } ++ DWC_WRITE_REG32(core_if->pcgcctl, pcgcctl.d32); ++ dwc_udelay(10); ++ ++ /* Load restore values for [31:14] bits */ ++ pcgcctl.d32 = gr->pcgcctl_local & 0xffffc000; ++ pcgcctl.d32 = gr->pcgcctl_local | 0x00020000; ++ pcgcctl.b.ess_reg_restored = 1; ++ if (!rmode) ++ pcgcctl.d32 |= 0x208; ++ DWC_WRITE_REG32(core_if->pcgcctl, pcgcctl.d32); ++ } ++ ++ return 0; ++} ++ ++/** ++ * Initializes the FSLSPClkSel field of the HCFG register depending on the PHY ++ * type. ++ */ ++static void init_fslspclksel(dwc_otg_core_if_t * core_if) ++{ ++ uint32_t val; ++ hcfg_data_t hcfg; ++ ++ if (((core_if->hwcfg2.b.hs_phy_type == 2) && ++ (core_if->hwcfg2.b.fs_phy_type == 1) && ++ (core_if->core_params->ulpi_fs_ls)) || ++ (core_if->core_params->phy_type == DWC_PHY_TYPE_PARAM_FS)) { ++ /* Full speed PHY */ ++ val = DWC_HCFG_48_MHZ; ++ } else { ++ /* High speed PHY running at full speed or high speed */ ++ val = DWC_HCFG_30_60_MHZ; ++ } ++ ++ DWC_DEBUGPL(DBG_CIL, "Initializing HCFG.FSLSPClkSel to 0x%1x\n", val); ++ hcfg.d32 = DWC_READ_REG32(&core_if->host_if->host_global_regs->hcfg); ++ hcfg.b.fslspclksel = val; ++ DWC_WRITE_REG32(&core_if->host_if->host_global_regs->hcfg, hcfg.d32); ++} ++ ++/** ++ * Initializes the DevSpd field of the DCFG register depending on the PHY type ++ * and the enumeration speed of the device. ++ */ ++static void init_devspd(dwc_otg_core_if_t * core_if) ++{ ++ uint32_t val; ++ dcfg_data_t dcfg; ++ ++ if (((core_if->hwcfg2.b.hs_phy_type == 2) && ++ (core_if->hwcfg2.b.fs_phy_type == 1) && ++ (core_if->core_params->ulpi_fs_ls)) || ++ (core_if->core_params->phy_type == DWC_PHY_TYPE_PARAM_FS)) { ++ /* Full speed PHY */ ++ val = 0x3; ++ } else if (core_if->core_params->speed == DWC_SPEED_PARAM_FULL) { ++ /* High speed PHY running at full speed */ ++ val = 0x1; ++ } else { ++ /* High speed PHY running at high speed */ ++ val = 0x0; ++ } ++ ++ DWC_DEBUGPL(DBG_CIL, "Initializing DCFG.DevSpd to 0x%1x\n", val); ++ ++ dcfg.d32 = DWC_READ_REG32(&core_if->dev_if->dev_global_regs->dcfg); ++ dcfg.b.devspd = val; ++ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->dcfg, dcfg.d32); ++} ++ ++/** ++ * This function calculates the number of IN EPS ++ * using GHWCFG1 and GHWCFG2 registers values ++ * ++ * @param core_if Programming view of the DWC_otg controller ++ */ ++static uint32_t calc_num_in_eps(dwc_otg_core_if_t * core_if) ++{ ++ uint32_t num_in_eps = 0; ++ uint32_t num_eps = core_if->hwcfg2.b.num_dev_ep; ++ uint32_t hwcfg1 = core_if->hwcfg1.d32 >> 3; ++ uint32_t num_tx_fifos = core_if->hwcfg4.b.num_in_eps; ++ int i; ++ ++ for (i = 0; i < num_eps; ++i) { ++ if (!(hwcfg1 & 0x1)) ++ num_in_eps++; ++ ++ hwcfg1 >>= 2; ++ } ++ ++ if (core_if->hwcfg4.b.ded_fifo_en) { ++ num_in_eps = ++ (num_in_eps > num_tx_fifos) ? num_tx_fifos : num_in_eps; ++ } ++ ++ return num_in_eps; ++} ++ ++/** ++ * This function calculates the number of OUT EPS ++ * using GHWCFG1 and GHWCFG2 registers values ++ * ++ * @param core_if Programming view of the DWC_otg controller ++ */ ++static uint32_t calc_num_out_eps(dwc_otg_core_if_t * core_if) ++{ ++ uint32_t num_out_eps = 0; ++ uint32_t num_eps = core_if->hwcfg2.b.num_dev_ep; ++ uint32_t hwcfg1 = core_if->hwcfg1.d32 >> 2; ++ int i; ++ ++ for (i = 0; i < num_eps; ++i) { ++ if (!(hwcfg1 & 0x1)) ++ num_out_eps++; ++ ++ hwcfg1 >>= 2; ++ } ++ return num_out_eps; ++} ++ ++/** ++ * This function initializes the DWC_otg controller registers and ++ * prepares the core for device mode or host mode operation. ++ * ++ * @param core_if Programming view of the DWC_otg controller ++ * ++ */ ++void dwc_otg_core_init(dwc_otg_core_if_t * core_if) ++{ ++ int i = 0; ++ dwc_otg_core_global_regs_t *global_regs = core_if->core_global_regs; ++ dwc_otg_dev_if_t *dev_if = core_if->dev_if; ++ gahbcfg_data_t ahbcfg = {.d32 = 0 }; ++ gusbcfg_data_t usbcfg = {.d32 = 0 }; ++ gi2cctl_data_t i2cctl = {.d32 = 0 }; ++ ++ DWC_DEBUGPL(DBG_CILV, "dwc_otg_core_init(%p) regs at %p\n", ++ core_if, global_regs); ++ ++ /* Common Initialization */ ++ usbcfg.d32 = DWC_READ_REG32(&global_regs->gusbcfg); ++ ++ /* Program the ULPI External VBUS bit if needed */ ++ usbcfg.b.ulpi_ext_vbus_drv = ++ (core_if->core_params->phy_ulpi_ext_vbus == ++ DWC_PHY_ULPI_EXTERNAL_VBUS) ? 1 : 0; ++ ++ /* Set external TS Dline pulsing */ ++ usbcfg.b.term_sel_dl_pulse = ++ (core_if->core_params->ts_dline == 1) ? 1 : 0; ++ DWC_WRITE_REG32(&global_regs->gusbcfg, usbcfg.d32); ++ ++ /* Reset the Controller */ ++ dwc_otg_core_reset(core_if); ++ ++ core_if->adp_enable = core_if->core_params->adp_supp_enable; ++ core_if->power_down = core_if->core_params->power_down; ++ core_if->otg_sts = 0; ++ ++ /* Initialize parameters from Hardware configuration registers. */ ++ dev_if->num_in_eps = calc_num_in_eps(core_if); ++ dev_if->num_out_eps = calc_num_out_eps(core_if); ++ ++ DWC_DEBUGPL(DBG_CIL, "num_dev_perio_in_ep=%d\n", ++ core_if->hwcfg4.b.num_dev_perio_in_ep); ++ ++ for (i = 0; i < core_if->hwcfg4.b.num_dev_perio_in_ep; i++) { ++ dev_if->perio_tx_fifo_size[i] = ++ DWC_READ_REG32(&global_regs->dtxfsiz[i]) >> 16; ++ DWC_DEBUGPL(DBG_CIL, "Periodic Tx FIFO SZ #%d=0x%0x\n", ++ i, dev_if->perio_tx_fifo_size[i]); ++ } ++ ++ for (i = 0; i < core_if->hwcfg4.b.num_in_eps; i++) { ++ dev_if->tx_fifo_size[i] = ++ DWC_READ_REG32(&global_regs->dtxfsiz[i]) >> 16; ++ DWC_DEBUGPL(DBG_CIL, "Tx FIFO SZ #%d=0x%0x\n", ++ i, dev_if->tx_fifo_size[i]); ++ } ++ ++ core_if->total_fifo_size = core_if->hwcfg3.b.dfifo_depth; ++ core_if->rx_fifo_size = DWC_READ_REG32(&global_regs->grxfsiz); ++ core_if->nperio_tx_fifo_size = ++ DWC_READ_REG32(&global_regs->gnptxfsiz) >> 16; ++ ++ DWC_DEBUGPL(DBG_CIL, "Total FIFO SZ=%d\n", core_if->total_fifo_size); ++ DWC_DEBUGPL(DBG_CIL, "Rx FIFO SZ=%d\n", core_if->rx_fifo_size); ++ DWC_DEBUGPL(DBG_CIL, "NP Tx FIFO SZ=%d\n", ++ core_if->nperio_tx_fifo_size); ++ ++ /* This programming sequence needs to happen in FS mode before any other ++ * programming occurs */ ++ if ((core_if->core_params->speed == DWC_SPEED_PARAM_FULL) && ++ (core_if->core_params->phy_type == DWC_PHY_TYPE_PARAM_FS)) { ++ /* If FS mode with FS PHY */ ++ ++ /* core_init() is now called on every switch so only call the ++ * following for the first time through. */ ++ if (!core_if->phy_init_done) { ++ core_if->phy_init_done = 1; ++ DWC_DEBUGPL(DBG_CIL, "FS_PHY detected\n"); ++ usbcfg.d32 = DWC_READ_REG32(&global_regs->gusbcfg); ++ usbcfg.b.physel = 1; ++ DWC_WRITE_REG32(&global_regs->gusbcfg, usbcfg.d32); ++ ++ /* Reset after a PHY select */ ++ dwc_otg_core_reset(core_if); ++ } ++ ++ /* Program DCFG.DevSpd or HCFG.FSLSPclkSel to 48Mhz in FS. Also ++ * do this on HNP Dev/Host mode switches (done in dev_init and ++ * host_init). */ ++ if (dwc_otg_is_host_mode(core_if)) { ++ init_fslspclksel(core_if); ++ } else { ++ init_devspd(core_if); ++ } ++ ++ if (core_if->core_params->i2c_enable) { ++ DWC_DEBUGPL(DBG_CIL, "FS_PHY Enabling I2c\n"); ++ /* Program GUSBCFG.OtgUtmifsSel to I2C */ ++ usbcfg.d32 = DWC_READ_REG32(&global_regs->gusbcfg); ++ usbcfg.b.otgutmifssel = 1; ++ DWC_WRITE_REG32(&global_regs->gusbcfg, usbcfg.d32); ++ ++ /* Program GI2CCTL.I2CEn */ ++ i2cctl.d32 = DWC_READ_REG32(&global_regs->gi2cctl); ++ i2cctl.b.i2cdevaddr = 1; ++ i2cctl.b.i2cen = 0; ++ DWC_WRITE_REG32(&global_regs->gi2cctl, i2cctl.d32); ++ i2cctl.b.i2cen = 1; ++ DWC_WRITE_REG32(&global_regs->gi2cctl, i2cctl.d32); ++ } ++ ++ } /* endif speed == DWC_SPEED_PARAM_FULL */ ++ else { ++ /* High speed PHY. */ ++ if (!core_if->phy_init_done) { ++ core_if->phy_init_done = 1; ++ /* HS PHY parameters. These parameters are preserved ++ * during soft reset so only program the first time. Do ++ * a soft reset immediately after setting phyif. */ ++ ++ if (core_if->core_params->phy_type == 2) { ++ /* ULPI interface */ ++ usbcfg.b.ulpi_utmi_sel = 1; ++ usbcfg.b.phyif = 0; ++ usbcfg.b.ddrsel = ++ core_if->core_params->phy_ulpi_ddr; ++ } else if (core_if->core_params->phy_type == 1) { ++ /* UTMI+ interface */ ++ usbcfg.b.ulpi_utmi_sel = 0; ++ if (core_if->core_params->phy_utmi_width == 16) { ++ usbcfg.b.phyif = 1; ++ ++ } else { ++ usbcfg.b.phyif = 0; ++ } ++ } else { ++ DWC_ERROR("FS PHY TYPE\n"); ++ } ++ DWC_WRITE_REG32(&global_regs->gusbcfg, usbcfg.d32); ++ /* Reset after setting the PHY parameters */ ++ dwc_otg_core_reset(core_if); ++ } ++ } ++ ++ if ((core_if->hwcfg2.b.hs_phy_type == 2) && ++ (core_if->hwcfg2.b.fs_phy_type == 1) && ++ (core_if->core_params->ulpi_fs_ls)) { ++ DWC_DEBUGPL(DBG_CIL, "Setting ULPI FSLS\n"); ++ usbcfg.d32 = DWC_READ_REG32(&global_regs->gusbcfg); ++ usbcfg.b.ulpi_fsls = 1; ++ usbcfg.b.ulpi_clk_sus_m = 1; ++ DWC_WRITE_REG32(&global_regs->gusbcfg, usbcfg.d32); ++ } else { ++ usbcfg.d32 = DWC_READ_REG32(&global_regs->gusbcfg); ++ usbcfg.b.ulpi_fsls = 0; ++ usbcfg.b.ulpi_clk_sus_m = 0; ++ DWC_WRITE_REG32(&global_regs->gusbcfg, usbcfg.d32); ++ } ++ ++ /* Program the GAHBCFG Register. */ ++ switch (core_if->hwcfg2.b.architecture) { ++ ++ case DWC_SLAVE_ONLY_ARCH: ++ DWC_DEBUGPL(DBG_CIL, "Slave Only Mode\n"); ++ ahbcfg.b.nptxfemplvl_txfemplvl = ++ DWC_GAHBCFG_TXFEMPTYLVL_HALFEMPTY; ++ ahbcfg.b.ptxfemplvl = DWC_GAHBCFG_TXFEMPTYLVL_HALFEMPTY; ++ core_if->dma_enable = 0; ++ core_if->dma_desc_enable = 0; ++ break; ++ ++ case DWC_EXT_DMA_ARCH: ++ DWC_DEBUGPL(DBG_CIL, "External DMA Mode\n"); ++ { ++ uint8_t brst_sz = core_if->core_params->dma_burst_size; ++ ahbcfg.b.hburstlen = 0; ++ while (brst_sz > 1) { ++ ahbcfg.b.hburstlen++; ++ brst_sz >>= 1; ++ } ++ } ++ core_if->dma_enable = (core_if->core_params->dma_enable != 0); ++ core_if->dma_desc_enable = ++ (core_if->core_params->dma_desc_enable != 0); ++ break; ++ ++ case DWC_INT_DMA_ARCH: ++ DWC_DEBUGPL(DBG_CIL, "Internal DMA Mode\n"); ++ /* Old value was DWC_GAHBCFG_INT_DMA_BURST_INCR - done for ++ Host mode ISOC in issue fix - vahrama */ ++ /* Broadcom had altered to (1<<3)|(0<<0) - WRESP=1, max 4 beats */ ++ ahbcfg.b.hburstlen = (1<<3)|(0<<0);//DWC_GAHBCFG_INT_DMA_BURST_INCR4; ++ core_if->dma_enable = (core_if->core_params->dma_enable != 0); ++ core_if->dma_desc_enable = ++ (core_if->core_params->dma_desc_enable != 0); ++ break; ++ ++ } ++ if (core_if->dma_enable) { ++ if (core_if->dma_desc_enable) { ++ DWC_PRINTF("Using Descriptor DMA mode\n"); ++ } else { ++ DWC_PRINTF("Using Buffer DMA mode\n"); ++ ++ } ++ } else { ++ DWC_PRINTF("Using Slave mode\n"); ++ core_if->dma_desc_enable = 0; ++ } ++ ++ if (core_if->core_params->ahb_single) { ++ ahbcfg.b.ahbsingle = 1; ++ } ++ ++ ahbcfg.b.dmaenable = core_if->dma_enable; ++ DWC_WRITE_REG32(&global_regs->gahbcfg, ahbcfg.d32); ++ ++ core_if->en_multiple_tx_fifo = core_if->hwcfg4.b.ded_fifo_en; ++ ++ core_if->pti_enh_enable = core_if->core_params->pti_enable != 0; ++ core_if->multiproc_int_enable = core_if->core_params->mpi_enable; ++ DWC_PRINTF("Periodic Transfer Interrupt Enhancement - %s\n", ++ ((core_if->pti_enh_enable) ? "enabled" : "disabled")); ++ DWC_PRINTF("Multiprocessor Interrupt Enhancement - %s\n", ++ ((core_if->multiproc_int_enable) ? "enabled" : "disabled")); ++ ++ /* ++ * Program the GUSBCFG register. ++ */ ++ usbcfg.d32 = DWC_READ_REG32(&global_regs->gusbcfg); ++ ++ switch (core_if->hwcfg2.b.op_mode) { ++ case DWC_MODE_HNP_SRP_CAPABLE: ++ usbcfg.b.hnpcap = (core_if->core_params->otg_cap == ++ DWC_OTG_CAP_PARAM_HNP_SRP_CAPABLE); ++ usbcfg.b.srpcap = (core_if->core_params->otg_cap != ++ DWC_OTG_CAP_PARAM_NO_HNP_SRP_CAPABLE); ++ break; ++ ++ case DWC_MODE_SRP_ONLY_CAPABLE: ++ usbcfg.b.hnpcap = 0; ++ usbcfg.b.srpcap = (core_if->core_params->otg_cap != ++ DWC_OTG_CAP_PARAM_NO_HNP_SRP_CAPABLE); ++ break; ++ ++ case DWC_MODE_NO_HNP_SRP_CAPABLE: ++ usbcfg.b.hnpcap = 0; ++ usbcfg.b.srpcap = 0; ++ break; ++ ++ case DWC_MODE_SRP_CAPABLE_DEVICE: ++ usbcfg.b.hnpcap = 0; ++ usbcfg.b.srpcap = (core_if->core_params->otg_cap != ++ DWC_OTG_CAP_PARAM_NO_HNP_SRP_CAPABLE); ++ break; ++ ++ case DWC_MODE_NO_SRP_CAPABLE_DEVICE: ++ usbcfg.b.hnpcap = 0; ++ usbcfg.b.srpcap = 0; ++ break; ++ ++ case DWC_MODE_SRP_CAPABLE_HOST: ++ usbcfg.b.hnpcap = 0; ++ usbcfg.b.srpcap = (core_if->core_params->otg_cap != ++ DWC_OTG_CAP_PARAM_NO_HNP_SRP_CAPABLE); ++ break; ++ ++ case DWC_MODE_NO_SRP_CAPABLE_HOST: ++ usbcfg.b.hnpcap = 0; ++ usbcfg.b.srpcap = 0; ++ break; ++ } ++ ++ DWC_WRITE_REG32(&global_regs->gusbcfg, usbcfg.d32); ++ ++#ifdef CONFIG_USB_DWC_OTG_LPM ++ if (core_if->core_params->lpm_enable) { ++ glpmcfg_data_t lpmcfg = {.d32 = 0 }; ++ ++ /* To enable LPM support set lpm_cap_en bit */ ++ lpmcfg.b.lpm_cap_en = 1; ++ ++ /* Make AppL1Res ACK */ ++ lpmcfg.b.appl_resp = 1; ++ ++ /* Retry 3 times */ ++ lpmcfg.b.retry_count = 3; ++ ++ DWC_MODIFY_REG32(&core_if->core_global_regs->glpmcfg, ++ 0, lpmcfg.d32); ++ ++ } ++#endif ++ if (core_if->core_params->ic_usb_cap) { ++ gusbcfg_data_t gusbcfg = {.d32 = 0 }; ++ gusbcfg.b.ic_usb_cap = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gusbcfg, ++ 0, gusbcfg.d32); ++ } ++ { ++ gotgctl_data_t gotgctl = {.d32 = 0 }; ++ gotgctl.b.otgver = core_if->core_params->otg_ver; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gotgctl, 0, ++ gotgctl.d32); ++ /* Set OTG version supported */ ++ core_if->otg_ver = core_if->core_params->otg_ver; ++ DWC_PRINTF("OTG VER PARAM: %d, OTG VER FLAG: %d\n", ++ core_if->core_params->otg_ver, core_if->otg_ver); ++ } ++ ++ ++ /* Enable common interrupts */ ++ dwc_otg_enable_common_interrupts(core_if); ++ ++ /* Do device or host intialization based on mode during PCD ++ * and HCD initialization */ ++ if (dwc_otg_is_host_mode(core_if)) { ++ DWC_DEBUGPL(DBG_ANY, "Host Mode\n"); ++ core_if->op_state = A_HOST; ++ } else { ++ DWC_DEBUGPL(DBG_ANY, "Device Mode\n"); ++ core_if->op_state = B_PERIPHERAL; ++#ifdef DWC_DEVICE_ONLY ++ dwc_otg_core_dev_init(core_if); ++#endif ++ } ++} ++ ++/** ++ * This function enables the Device mode interrupts. ++ * ++ * @param core_if Programming view of DWC_otg controller ++ */ ++void dwc_otg_enable_device_interrupts(dwc_otg_core_if_t * core_if) ++{ ++ gintmsk_data_t intr_mask = {.d32 = 0 }; ++ dwc_otg_core_global_regs_t *global_regs = core_if->core_global_regs; ++ ++ DWC_DEBUGPL(DBG_CIL, "%s()\n", __func__); ++ ++ /* Disable all interrupts. */ ++ DWC_WRITE_REG32(&global_regs->gintmsk, 0); ++ ++ /* Clear any pending interrupts */ ++ DWC_WRITE_REG32(&global_regs->gintsts, 0xFFFFFFFF); ++ ++ /* Enable the common interrupts */ ++ dwc_otg_enable_common_interrupts(core_if); ++ ++ /* Enable interrupts */ ++ intr_mask.b.usbreset = 1; ++ intr_mask.b.enumdone = 1; ++ /* Disable Disconnect interrupt in Device mode */ ++ intr_mask.b.disconnect = 0; ++ ++ if (!core_if->multiproc_int_enable) { ++ intr_mask.b.inepintr = 1; ++ intr_mask.b.outepintr = 1; ++ } ++ ++ intr_mask.b.erlysuspend = 1; ++ ++ if (core_if->en_multiple_tx_fifo == 0) { ++ intr_mask.b.epmismatch = 1; ++ } ++ ++ //intr_mask.b.incomplisoout = 1; ++ intr_mask.b.incomplisoin = 1; ++ ++/* Enable the ignore frame number for ISOC xfers - MAS */ ++/* Disable to support high bandwith ISOC transfers - manukz */ ++#if 0 ++#ifdef DWC_UTE_PER_IO ++ if (core_if->dma_enable) { ++ if (core_if->dma_desc_enable) { ++ dctl_data_t dctl1 = {.d32 = 0 }; ++ dctl1.b.ifrmnum = 1; ++ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs-> ++ dctl, 0, dctl1.d32); ++ DWC_DEBUG("----Enabled Ignore frame number (0x%08x)", ++ DWC_READ_REG32(&core_if->dev_if-> ++ dev_global_regs->dctl)); ++ } ++ } ++#endif ++#endif ++#ifdef DWC_EN_ISOC ++ if (core_if->dma_enable) { ++ if (core_if->dma_desc_enable == 0) { ++ if (core_if->pti_enh_enable) { ++ dctl_data_t dctl = {.d32 = 0 }; ++ dctl.b.ifrmnum = 1; ++ DWC_MODIFY_REG32(&core_if-> ++ dev_if->dev_global_regs->dctl, ++ 0, dctl.d32); ++ } else { ++ intr_mask.b.incomplisoin = 1; ++ intr_mask.b.incomplisoout = 1; ++ } ++ } ++ } else { ++ intr_mask.b.incomplisoin = 1; ++ intr_mask.b.incomplisoout = 1; ++ } ++#endif /* DWC_EN_ISOC */ ++ ++ /** @todo NGS: Should this be a module parameter? */ ++#ifdef USE_PERIODIC_EP ++ intr_mask.b.isooutdrop = 1; ++ intr_mask.b.eopframe = 1; ++ intr_mask.b.incomplisoin = 1; ++ intr_mask.b.incomplisoout = 1; ++#endif ++ ++ DWC_MODIFY_REG32(&global_regs->gintmsk, intr_mask.d32, intr_mask.d32); ++ ++ DWC_DEBUGPL(DBG_CIL, "%s() gintmsk=%0x\n", __func__, ++ DWC_READ_REG32(&global_regs->gintmsk)); ++} ++ ++/** ++ * This function initializes the DWC_otg controller registers for ++ * device mode. ++ * ++ * @param core_if Programming view of DWC_otg controller ++ * ++ */ ++void dwc_otg_core_dev_init(dwc_otg_core_if_t * core_if) ++{ ++ int i; ++ dwc_otg_core_global_regs_t *global_regs = core_if->core_global_regs; ++ dwc_otg_dev_if_t *dev_if = core_if->dev_if; ++ dwc_otg_core_params_t *params = core_if->core_params; ++ dcfg_data_t dcfg = {.d32 = 0 }; ++ depctl_data_t diepctl = {.d32 = 0 }; ++ grstctl_t resetctl = {.d32 = 0 }; ++ uint32_t rx_fifo_size; ++ fifosize_data_t nptxfifosize; ++ fifosize_data_t txfifosize; ++ dthrctl_data_t dthrctl; ++ fifosize_data_t ptxfifosize; ++ uint16_t rxfsiz, nptxfsiz; ++ gdfifocfg_data_t gdfifocfg = {.d32 = 0 }; ++ hwcfg3_data_t hwcfg3 = {.d32 = 0 }; ++ ++ /* Restart the Phy Clock */ ++ DWC_WRITE_REG32(core_if->pcgcctl, 0); ++ ++ /* Device configuration register */ ++ init_devspd(core_if); ++ dcfg.d32 = DWC_READ_REG32(&dev_if->dev_global_regs->dcfg); ++ dcfg.b.descdma = (core_if->dma_desc_enable) ? 1 : 0; ++ dcfg.b.perfrint = DWC_DCFG_FRAME_INTERVAL_80; ++ /* Enable Device OUT NAK in case of DDMA mode*/ ++ if (core_if->core_params->dev_out_nak) { ++ dcfg.b.endevoutnak = 1; ++ } ++ ++ if (core_if->core_params->cont_on_bna) { ++ dctl_data_t dctl = {.d32 = 0 }; ++ dctl.b.encontonbna = 1; ++ DWC_MODIFY_REG32(&dev_if->dev_global_regs->dctl, 0, dctl.d32); ++ } ++ ++ ++ DWC_WRITE_REG32(&dev_if->dev_global_regs->dcfg, dcfg.d32); ++ ++ /* Configure data FIFO sizes */ ++ if (core_if->hwcfg2.b.dynamic_fifo && params->enable_dynamic_fifo) { ++ DWC_DEBUGPL(DBG_CIL, "Total FIFO Size=%d\n", ++ core_if->total_fifo_size); ++ DWC_DEBUGPL(DBG_CIL, "Rx FIFO Size=%d\n", ++ params->dev_rx_fifo_size); ++ DWC_DEBUGPL(DBG_CIL, "NP Tx FIFO Size=%d\n", ++ params->dev_nperio_tx_fifo_size); ++ ++ /* Rx FIFO */ ++ DWC_DEBUGPL(DBG_CIL, "initial grxfsiz=%08x\n", ++ DWC_READ_REG32(&global_regs->grxfsiz)); ++ ++#ifdef DWC_UTE_CFI ++ core_if->pwron_rxfsiz = DWC_READ_REG32(&global_regs->grxfsiz); ++ core_if->init_rxfsiz = params->dev_rx_fifo_size; ++#endif ++ rx_fifo_size = params->dev_rx_fifo_size; ++ DWC_WRITE_REG32(&global_regs->grxfsiz, rx_fifo_size); ++ ++ DWC_DEBUGPL(DBG_CIL, "new grxfsiz=%08x\n", ++ DWC_READ_REG32(&global_regs->grxfsiz)); ++ ++ /** Set Periodic Tx FIFO Mask all bits 0 */ ++ core_if->p_tx_msk = 0; ++ ++ /** Set Tx FIFO Mask all bits 0 */ ++ core_if->tx_msk = 0; ++ ++ if (core_if->en_multiple_tx_fifo == 0) { ++ /* Non-periodic Tx FIFO */ ++ DWC_DEBUGPL(DBG_CIL, "initial gnptxfsiz=%08x\n", ++ DWC_READ_REG32(&global_regs->gnptxfsiz)); ++ ++ nptxfifosize.b.depth = params->dev_nperio_tx_fifo_size; ++ nptxfifosize.b.startaddr = params->dev_rx_fifo_size; ++ ++ DWC_WRITE_REG32(&global_regs->gnptxfsiz, ++ nptxfifosize.d32); ++ ++ DWC_DEBUGPL(DBG_CIL, "new gnptxfsiz=%08x\n", ++ DWC_READ_REG32(&global_regs->gnptxfsiz)); ++ ++ /**@todo NGS: Fix Periodic FIFO Sizing! */ ++ /* ++ * Periodic Tx FIFOs These FIFOs are numbered from 1 to 15. ++ * Indexes of the FIFO size module parameters in the ++ * dev_perio_tx_fifo_size array and the FIFO size registers in ++ * the dptxfsiz array run from 0 to 14. ++ */ ++ /** @todo Finish debug of this */ ++ ptxfifosize.b.startaddr = ++ nptxfifosize.b.startaddr + nptxfifosize.b.depth; ++ for (i = 0; i < core_if->hwcfg4.b.num_dev_perio_in_ep; i++) { ++ ptxfifosize.b.depth = ++ params->dev_perio_tx_fifo_size[i]; ++ DWC_DEBUGPL(DBG_CIL, ++ "initial dtxfsiz[%d]=%08x\n", i, ++ DWC_READ_REG32(&global_regs->dtxfsiz ++ [i])); ++ DWC_WRITE_REG32(&global_regs->dtxfsiz[i], ++ ptxfifosize.d32); ++ DWC_DEBUGPL(DBG_CIL, "new dtxfsiz[%d]=%08x\n", ++ i, ++ DWC_READ_REG32(&global_regs->dtxfsiz ++ [i])); ++ ptxfifosize.b.startaddr += ptxfifosize.b.depth; ++ } ++ } else { ++ /* ++ * Tx FIFOs These FIFOs are numbered from 1 to 15. ++ * Indexes of the FIFO size module parameters in the ++ * dev_tx_fifo_size array and the FIFO size registers in ++ * the dtxfsiz array run from 0 to 14. ++ */ ++ ++ /* Non-periodic Tx FIFO */ ++ DWC_DEBUGPL(DBG_CIL, "initial gnptxfsiz=%08x\n", ++ DWC_READ_REG32(&global_regs->gnptxfsiz)); ++ ++#ifdef DWC_UTE_CFI ++ core_if->pwron_gnptxfsiz = ++ (DWC_READ_REG32(&global_regs->gnptxfsiz) >> 16); ++ core_if->init_gnptxfsiz = ++ params->dev_nperio_tx_fifo_size; ++#endif ++ nptxfifosize.b.depth = params->dev_nperio_tx_fifo_size; ++ nptxfifosize.b.startaddr = params->dev_rx_fifo_size; ++ ++ DWC_WRITE_REG32(&global_regs->gnptxfsiz, ++ nptxfifosize.d32); ++ ++ DWC_DEBUGPL(DBG_CIL, "new gnptxfsiz=%08x\n", ++ DWC_READ_REG32(&global_regs->gnptxfsiz)); ++ ++ txfifosize.b.startaddr = ++ nptxfifosize.b.startaddr + nptxfifosize.b.depth; ++ ++ for (i = 0; i < core_if->hwcfg4.b.num_in_eps; i++) { ++ ++ txfifosize.b.depth = ++ params->dev_tx_fifo_size[i]; ++ ++ DWC_DEBUGPL(DBG_CIL, ++ "initial dtxfsiz[%d]=%08x\n", ++ i, ++ DWC_READ_REG32(&global_regs->dtxfsiz ++ [i])); ++ ++#ifdef DWC_UTE_CFI ++ core_if->pwron_txfsiz[i] = ++ (DWC_READ_REG32 ++ (&global_regs->dtxfsiz[i]) >> 16); ++ core_if->init_txfsiz[i] = ++ params->dev_tx_fifo_size[i]; ++#endif ++ DWC_WRITE_REG32(&global_regs->dtxfsiz[i], ++ txfifosize.d32); ++ ++ DWC_DEBUGPL(DBG_CIL, ++ "new dtxfsiz[%d]=%08x\n", ++ i, ++ DWC_READ_REG32(&global_regs->dtxfsiz ++ [i])); ++ ++ txfifosize.b.startaddr += txfifosize.b.depth; ++ } ++ if (core_if->snpsid <= OTG_CORE_REV_2_94a) { ++ /* Calculating DFIFOCFG for Device mode to include RxFIFO and NPTXFIFO */ ++ gdfifocfg.d32 = DWC_READ_REG32(&global_regs->gdfifocfg); ++ hwcfg3.d32 = DWC_READ_REG32(&global_regs->ghwcfg3); ++ gdfifocfg.b.gdfifocfg = (DWC_READ_REG32(&global_regs->ghwcfg3) >> 16); ++ DWC_WRITE_REG32(&global_regs->gdfifocfg, gdfifocfg.d32); ++ rxfsiz = (DWC_READ_REG32(&global_regs->grxfsiz) & 0x0000ffff); ++ nptxfsiz = (DWC_READ_REG32(&global_regs->gnptxfsiz) >> 16); ++ gdfifocfg.b.epinfobase = rxfsiz + nptxfsiz; ++ DWC_WRITE_REG32(&global_regs->gdfifocfg, gdfifocfg.d32); ++ } ++ } ++ ++ /* Flush the FIFOs */ ++ dwc_otg_flush_tx_fifo(core_if, 0x10); /* all Tx FIFOs */ ++ dwc_otg_flush_rx_fifo(core_if); ++ ++ /* Flush the Learning Queue. */ ++ resetctl.b.intknqflsh = 1; ++ DWC_WRITE_REG32(&core_if->core_global_regs->grstctl, resetctl.d32); ++ ++ if (!core_if->core_params->en_multiple_tx_fifo && core_if->dma_enable) { ++ core_if->start_predict = 0; ++ for (i = 0; i<= core_if->dev_if->num_in_eps; ++i) { ++ core_if->nextep_seq[i] = 0xff; // 0xff - EP not active ++ } ++ core_if->nextep_seq[0] = 0; ++ core_if->first_in_nextep_seq = 0; ++ diepctl.d32 = DWC_READ_REG32(&dev_if->in_ep_regs[0]->diepctl); ++ diepctl.b.nextep = 0; ++ DWC_WRITE_REG32(&dev_if->in_ep_regs[0]->diepctl, diepctl.d32); ++ ++ /* Update IN Endpoint Mismatch Count by active IN NP EP count + 1 */ ++ dcfg.d32 = DWC_READ_REG32(&dev_if->dev_global_regs->dcfg); ++ dcfg.b.epmscnt = 2; ++ DWC_WRITE_REG32(&dev_if->dev_global_regs->dcfg, dcfg.d32); ++ ++ DWC_DEBUGPL(DBG_CILV,"%s first_in_nextep_seq= %2d; nextep_seq[]:\n", ++ __func__, core_if->first_in_nextep_seq); ++ for (i=0; i <= core_if->dev_if->num_in_eps; i++) { ++ DWC_DEBUGPL(DBG_CILV, "%2d ", core_if->nextep_seq[i]); ++ } ++ DWC_DEBUGPL(DBG_CILV,"\n"); ++ } ++ ++ /* Clear all pending Device Interrupts */ ++ /** @todo - if the condition needed to be checked ++ * or in any case all pending interrutps should be cleared? ++ */ ++ if (core_if->multiproc_int_enable) { ++ for (i = 0; i < core_if->dev_if->num_in_eps; ++i) { ++ DWC_WRITE_REG32(&dev_if-> ++ dev_global_regs->diepeachintmsk[i], 0); ++ } ++ } ++ ++ for (i = 0; i < core_if->dev_if->num_out_eps; ++i) { ++ DWC_WRITE_REG32(&dev_if-> ++ dev_global_regs->doepeachintmsk[i], 0); ++ } ++ ++ DWC_WRITE_REG32(&dev_if->dev_global_regs->deachint, 0xFFFFFFFF); ++ DWC_WRITE_REG32(&dev_if->dev_global_regs->deachintmsk, 0); ++ } else { ++ DWC_WRITE_REG32(&dev_if->dev_global_regs->diepmsk, 0); ++ DWC_WRITE_REG32(&dev_if->dev_global_regs->doepmsk, 0); ++ DWC_WRITE_REG32(&dev_if->dev_global_regs->daint, 0xFFFFFFFF); ++ DWC_WRITE_REG32(&dev_if->dev_global_regs->daintmsk, 0); ++ } ++ ++ for (i = 0; i <= dev_if->num_in_eps; i++) { ++ depctl_data_t depctl; ++ depctl.d32 = DWC_READ_REG32(&dev_if->in_ep_regs[i]->diepctl); ++ if (depctl.b.epena) { ++ depctl.d32 = 0; ++ depctl.b.epdis = 1; ++ depctl.b.snak = 1; ++ } else { ++ depctl.d32 = 0; ++ } ++ ++ DWC_WRITE_REG32(&dev_if->in_ep_regs[i]->diepctl, depctl.d32); ++ ++ DWC_WRITE_REG32(&dev_if->in_ep_regs[i]->dieptsiz, 0); ++ DWC_WRITE_REG32(&dev_if->in_ep_regs[i]->diepdma, 0); ++ DWC_WRITE_REG32(&dev_if->in_ep_regs[i]->diepint, 0xFF); ++ } ++ ++ for (i = 0; i <= dev_if->num_out_eps; i++) { ++ depctl_data_t depctl; ++ depctl.d32 = DWC_READ_REG32(&dev_if->out_ep_regs[i]->doepctl); ++ if (depctl.b.epena) { ++ dctl_data_t dctl = {.d32 = 0 }; ++ gintmsk_data_t gintsts = {.d32 = 0 }; ++ doepint_data_t doepint = {.d32 = 0 }; ++ dctl.b.sgoutnak = 1; ++ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs->dctl, 0, dctl.d32); ++ do { ++ dwc_udelay(10); ++ gintsts.d32 = DWC_READ_REG32(&core_if->core_global_regs->gintsts); ++ } while (!gintsts.b.goutnakeff); ++ gintsts.d32 = 0; ++ gintsts.b.goutnakeff = 1; ++ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, gintsts.d32); ++ ++ depctl.d32 = 0; ++ depctl.b.epdis = 1; ++ depctl.b.snak = 1; ++ DWC_WRITE_REG32(&core_if->dev_if->out_ep_regs[i]->doepctl, depctl.d32); ++ do { ++ dwc_udelay(10); ++ doepint.d32 = DWC_READ_REG32(&core_if->dev_if-> ++ out_ep_regs[i]->doepint); ++ } while (!doepint.b.epdisabled); ++ ++ doepint.b.epdisabled = 1; ++ DWC_WRITE_REG32(&core_if->dev_if->out_ep_regs[i]->doepint, doepint.d32); ++ ++ dctl.d32 = 0; ++ dctl.b.cgoutnak = 1; ++ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs->dctl, 0, dctl.d32); ++ } else { ++ depctl.d32 = 0; ++ } ++ ++ DWC_WRITE_REG32(&dev_if->out_ep_regs[i]->doepctl, depctl.d32); ++ ++ DWC_WRITE_REG32(&dev_if->out_ep_regs[i]->doeptsiz, 0); ++ DWC_WRITE_REG32(&dev_if->out_ep_regs[i]->doepdma, 0); ++ DWC_WRITE_REG32(&dev_if->out_ep_regs[i]->doepint, 0xFF); ++ } ++ ++ if (core_if->en_multiple_tx_fifo && core_if->dma_enable) { ++ dev_if->non_iso_tx_thr_en = params->thr_ctl & 0x1; ++ dev_if->iso_tx_thr_en = (params->thr_ctl >> 1) & 0x1; ++ dev_if->rx_thr_en = (params->thr_ctl >> 2) & 0x1; ++ ++ dev_if->rx_thr_length = params->rx_thr_length; ++ dev_if->tx_thr_length = params->tx_thr_length; ++ ++ dev_if->setup_desc_index = 0; ++ ++ dthrctl.d32 = 0; ++ dthrctl.b.non_iso_thr_en = dev_if->non_iso_tx_thr_en; ++ dthrctl.b.iso_thr_en = dev_if->iso_tx_thr_en; ++ dthrctl.b.tx_thr_len = dev_if->tx_thr_length; ++ dthrctl.b.rx_thr_en = dev_if->rx_thr_en; ++ dthrctl.b.rx_thr_len = dev_if->rx_thr_length; ++ dthrctl.b.ahb_thr_ratio = params->ahb_thr_ratio; ++ ++ DWC_WRITE_REG32(&dev_if->dev_global_regs->dtknqr3_dthrctl, ++ dthrctl.d32); ++ ++ DWC_DEBUGPL(DBG_CIL, ++ "Non ISO Tx Thr - %d\nISO Tx Thr - %d\nRx Thr - %d\nTx Thr Len - %d\nRx Thr Len - %d\n", ++ dthrctl.b.non_iso_thr_en, dthrctl.b.iso_thr_en, ++ dthrctl.b.rx_thr_en, dthrctl.b.tx_thr_len, ++ dthrctl.b.rx_thr_len); ++ ++ } ++ ++ dwc_otg_enable_device_interrupts(core_if); ++ ++ { ++ diepmsk_data_t msk = {.d32 = 0 }; ++ msk.b.txfifoundrn = 1; ++ if (core_if->multiproc_int_enable) { ++ DWC_MODIFY_REG32(&dev_if->dev_global_regs-> ++ diepeachintmsk[0], msk.d32, msk.d32); ++ } else { ++ DWC_MODIFY_REG32(&dev_if->dev_global_regs->diepmsk, ++ msk.d32, msk.d32); ++ } ++ } ++ ++ if (core_if->multiproc_int_enable) { ++ /* Set NAK on Babble */ ++ dctl_data_t dctl = {.d32 = 0 }; ++ dctl.b.nakonbble = 1; ++ DWC_MODIFY_REG32(&dev_if->dev_global_regs->dctl, 0, dctl.d32); ++ } ++ ++ if (core_if->snpsid >= OTG_CORE_REV_2_94a) { ++ dctl_data_t dctl = {.d32 = 0 }; ++ dctl.d32 = DWC_READ_REG32(&dev_if->dev_global_regs->dctl); ++ dctl.b.sftdiscon = 0; ++ DWC_WRITE_REG32(&dev_if->dev_global_regs->dctl, dctl.d32); ++ } ++} ++ ++/** ++ * This function enables the Host mode interrupts. ++ * ++ * @param core_if Programming view of DWC_otg controller ++ */ ++void dwc_otg_enable_host_interrupts(dwc_otg_core_if_t * core_if) ++{ ++ dwc_otg_core_global_regs_t *global_regs = core_if->core_global_regs; ++ gintmsk_data_t intr_mask = {.d32 = 0 }; ++ ++ DWC_DEBUGPL(DBG_CIL, "%s(%p)\n", __func__, core_if); ++ ++ /* Disable all interrupts. */ ++ DWC_WRITE_REG32(&global_regs->gintmsk, 0); ++ ++ /* Clear any pending interrupts. */ ++ DWC_WRITE_REG32(&global_regs->gintsts, 0xFFFFFFFF); ++ ++ /* Enable the common interrupts */ ++ dwc_otg_enable_common_interrupts(core_if); ++ ++ /* ++ * Enable host mode interrupts without disturbing common ++ * interrupts. ++ */ ++ ++ intr_mask.b.disconnect = 1; ++ intr_mask.b.portintr = 1; ++ intr_mask.b.hcintr = 1; ++ ++ DWC_MODIFY_REG32(&global_regs->gintmsk, intr_mask.d32, intr_mask.d32); ++} ++ ++/** ++ * This function disables the Host Mode interrupts. ++ * ++ * @param core_if Programming view of DWC_otg controller ++ */ ++void dwc_otg_disable_host_interrupts(dwc_otg_core_if_t * core_if) ++{ ++ dwc_otg_core_global_regs_t *global_regs = core_if->core_global_regs; ++ gintmsk_data_t intr_mask = {.d32 = 0 }; ++ ++ DWC_DEBUGPL(DBG_CILV, "%s()\n", __func__); ++ ++ /* ++ * Disable host mode interrupts without disturbing common ++ * interrupts. ++ */ ++ intr_mask.b.sofintr = 1; ++ intr_mask.b.portintr = 1; ++ intr_mask.b.hcintr = 1; ++ intr_mask.b.ptxfempty = 1; ++ intr_mask.b.nptxfempty = 1; ++ ++ DWC_MODIFY_REG32(&global_regs->gintmsk, intr_mask.d32, 0); ++} ++ ++/** ++ * This function initializes the DWC_otg controller registers for ++ * host mode. ++ * ++ * This function flushes the Tx and Rx FIFOs and it flushes any entries in the ++ * request queues. Host channels are reset to ensure that they are ready for ++ * performing transfers. ++ * ++ * @param core_if Programming view of DWC_otg controller ++ * ++ */ ++void dwc_otg_core_host_init(dwc_otg_core_if_t * core_if) ++{ ++ dwc_otg_core_global_regs_t *global_regs = core_if->core_global_regs; ++ dwc_otg_host_if_t *host_if = core_if->host_if; ++ dwc_otg_core_params_t *params = core_if->core_params; ++ hprt0_data_t hprt0 = {.d32 = 0 }; ++ fifosize_data_t nptxfifosize; ++ fifosize_data_t ptxfifosize; ++ uint16_t rxfsiz, nptxfsiz, hptxfsiz; ++ gdfifocfg_data_t gdfifocfg = {.d32 = 0 }; ++ int i; ++ hcchar_data_t hcchar; ++ hcfg_data_t hcfg; ++ hfir_data_t hfir; ++ dwc_otg_hc_regs_t *hc_regs; ++ int num_channels; ++ gotgctl_data_t gotgctl = {.d32 = 0 }; ++ ++ DWC_DEBUGPL(DBG_CILV, "%s(%p)\n", __func__, core_if); ++ ++ /* Restart the Phy Clock */ ++ DWC_WRITE_REG32(core_if->pcgcctl, 0); ++ ++ /* Initialize Host Configuration Register */ ++ init_fslspclksel(core_if); ++ if (core_if->core_params->speed == DWC_SPEED_PARAM_FULL) { ++ hcfg.d32 = DWC_READ_REG32(&host_if->host_global_regs->hcfg); ++ hcfg.b.fslssupp = 1; ++ DWC_WRITE_REG32(&host_if->host_global_regs->hcfg, hcfg.d32); ++ ++ } ++ ++ /* This bit allows dynamic reloading of the HFIR register ++ * during runtime. This bit needs to be programmed during ++ * initial configuration and its value must not be changed ++ * during runtime.*/ ++ if (core_if->core_params->reload_ctl == 1) { ++ hfir.d32 = DWC_READ_REG32(&host_if->host_global_regs->hfir); ++ hfir.b.hfirrldctrl = 1; ++ DWC_WRITE_REG32(&host_if->host_global_regs->hfir, hfir.d32); ++ } ++ ++ if (core_if->core_params->dma_desc_enable) { ++ uint8_t op_mode = core_if->hwcfg2.b.op_mode; ++ if (! ++ (core_if->hwcfg4.b.desc_dma ++ && (core_if->snpsid >= OTG_CORE_REV_2_90a) ++ && ((op_mode == DWC_HWCFG2_OP_MODE_HNP_SRP_CAPABLE_OTG) ++ || (op_mode == DWC_HWCFG2_OP_MODE_SRP_ONLY_CAPABLE_OTG) ++ || (op_mode == ++ DWC_HWCFG2_OP_MODE_NO_HNP_SRP_CAPABLE_OTG) ++ || (op_mode == DWC_HWCFG2_OP_MODE_SRP_CAPABLE_HOST) ++ || (op_mode == ++ DWC_HWCFG2_OP_MODE_NO_SRP_CAPABLE_HOST)))) { ++ ++ DWC_ERROR("Host can't operate in Descriptor DMA mode.\n" ++ "Either core version is below 2.90a or " ++ "GHWCFG2, GHWCFG4 registers' values do not allow Descriptor DMA in host mode.\n" ++ "To run the driver in Buffer DMA host mode set dma_desc_enable " ++ "module parameter to 0.\n"); ++ return; ++ } ++ hcfg.d32 = DWC_READ_REG32(&host_if->host_global_regs->hcfg); ++ hcfg.b.descdma = 1; ++ DWC_WRITE_REG32(&host_if->host_global_regs->hcfg, hcfg.d32); ++ } ++ ++ /* Configure data FIFO sizes */ ++ if (core_if->hwcfg2.b.dynamic_fifo && params->enable_dynamic_fifo) { ++ DWC_DEBUGPL(DBG_CIL, "Total FIFO Size=%d\n", ++ core_if->total_fifo_size); ++ DWC_DEBUGPL(DBG_CIL, "Rx FIFO Size=%d\n", ++ params->host_rx_fifo_size); ++ DWC_DEBUGPL(DBG_CIL, "NP Tx FIFO Size=%d\n", ++ params->host_nperio_tx_fifo_size); ++ DWC_DEBUGPL(DBG_CIL, "P Tx FIFO Size=%d\n", ++ params->host_perio_tx_fifo_size); ++ ++ /* Rx FIFO */ ++ DWC_DEBUGPL(DBG_CIL, "initial grxfsiz=%08x\n", ++ DWC_READ_REG32(&global_regs->grxfsiz)); ++ DWC_WRITE_REG32(&global_regs->grxfsiz, ++ params->host_rx_fifo_size); ++ DWC_DEBUGPL(DBG_CIL, "new grxfsiz=%08x\n", ++ DWC_READ_REG32(&global_regs->grxfsiz)); ++ ++ /* Non-periodic Tx FIFO */ ++ DWC_DEBUGPL(DBG_CIL, "initial gnptxfsiz=%08x\n", ++ DWC_READ_REG32(&global_regs->gnptxfsiz)); ++ nptxfifosize.b.depth = params->host_nperio_tx_fifo_size; ++ nptxfifosize.b.startaddr = params->host_rx_fifo_size; ++ DWC_WRITE_REG32(&global_regs->gnptxfsiz, nptxfifosize.d32); ++ DWC_DEBUGPL(DBG_CIL, "new gnptxfsiz=%08x\n", ++ DWC_READ_REG32(&global_regs->gnptxfsiz)); ++ ++ /* Periodic Tx FIFO */ ++ DWC_DEBUGPL(DBG_CIL, "initial hptxfsiz=%08x\n", ++ DWC_READ_REG32(&global_regs->hptxfsiz)); ++ ptxfifosize.b.depth = params->host_perio_tx_fifo_size; ++ ptxfifosize.b.startaddr = ++ nptxfifosize.b.startaddr + nptxfifosize.b.depth; ++ DWC_WRITE_REG32(&global_regs->hptxfsiz, ptxfifosize.d32); ++ DWC_DEBUGPL(DBG_CIL, "new hptxfsiz=%08x\n", ++ DWC_READ_REG32(&global_regs->hptxfsiz)); ++ ++ if (core_if->en_multiple_tx_fifo ++ && core_if->snpsid <= OTG_CORE_REV_2_94a) { ++ /* Global DFIFOCFG calculation for Host mode - include RxFIFO, NPTXFIFO and HPTXFIFO */ ++ gdfifocfg.d32 = DWC_READ_REG32(&global_regs->gdfifocfg); ++ rxfsiz = (DWC_READ_REG32(&global_regs->grxfsiz) & 0x0000ffff); ++ nptxfsiz = (DWC_READ_REG32(&global_regs->gnptxfsiz) >> 16); ++ hptxfsiz = (DWC_READ_REG32(&global_regs->hptxfsiz) >> 16); ++ gdfifocfg.b.epinfobase = rxfsiz + nptxfsiz + hptxfsiz; ++ DWC_WRITE_REG32(&global_regs->gdfifocfg, gdfifocfg.d32); ++ } ++ } ++ ++ /* TODO - check this */ ++ /* Clear Host Set HNP Enable in the OTG Control Register */ ++ gotgctl.b.hstsethnpen = 1; ++ DWC_MODIFY_REG32(&global_regs->gotgctl, gotgctl.d32, 0); ++ /* Make sure the FIFOs are flushed. */ ++ dwc_otg_flush_tx_fifo(core_if, 0x10 /* all TX FIFOs */ ); ++ dwc_otg_flush_rx_fifo(core_if); ++ ++ /* Clear Host Set HNP Enable in the OTG Control Register */ ++ gotgctl.b.hstsethnpen = 1; ++ DWC_MODIFY_REG32(&global_regs->gotgctl, gotgctl.d32, 0); ++ ++ if (!core_if->core_params->dma_desc_enable) { ++ /* Flush out any leftover queued requests. */ ++ num_channels = core_if->core_params->host_channels; ++ ++ for (i = 0; i < num_channels; i++) { ++ hc_regs = core_if->host_if->hc_regs[i]; ++ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); ++ hcchar.b.chen = 0; ++ hcchar.b.chdis = 1; ++ hcchar.b.epdir = 0; ++ DWC_WRITE_REG32(&hc_regs->hcchar, hcchar.d32); ++ } ++ ++ /* Halt all channels to put them into a known state. */ ++ for (i = 0; i < num_channels; i++) { ++ int count = 0; ++ hc_regs = core_if->host_if->hc_regs[i]; ++ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); ++ hcchar.b.chen = 1; ++ hcchar.b.chdis = 1; ++ hcchar.b.epdir = 0; ++ DWC_WRITE_REG32(&hc_regs->hcchar, hcchar.d32); ++ DWC_DEBUGPL(DBG_HCDV, "%s: Halt channel %d regs %p\n", __func__, i, hc_regs); ++ do { ++ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); ++ if (++count > 1000) { ++ DWC_ERROR ++ ("%s: Unable to clear halt on channel %d (timeout HCCHAR 0x%X @%p)\n", ++ __func__, i, hcchar.d32, &hc_regs->hcchar); ++ break; ++ } ++ dwc_udelay(1); ++ } while (hcchar.b.chen); ++ } ++ } ++ ++ /* Turn on the vbus power. */ ++ DWC_PRINTF("Init: Port Power? op_state=%d\n", core_if->op_state); ++ if (core_if->op_state == A_HOST) { ++ hprt0.d32 = dwc_otg_read_hprt0(core_if); ++ DWC_PRINTF("Init: Power Port (%d)\n", hprt0.b.prtpwr); ++ if (hprt0.b.prtpwr == 0) { ++ hprt0.b.prtpwr = 1; ++ DWC_WRITE_REG32(host_if->hprt0, hprt0.d32); ++ } ++ } ++ ++ dwc_otg_enable_host_interrupts(core_if); ++} ++ ++/** ++ * Prepares a host channel for transferring packets to/from a specific ++ * endpoint. The HCCHARn register is set up with the characteristics specified ++ * in _hc. Host channel interrupts that may need to be serviced while this ++ * transfer is in progress are enabled. ++ * ++ * @param core_if Programming view of DWC_otg controller ++ * @param hc Information needed to initialize the host channel ++ */ ++void dwc_otg_hc_init(dwc_otg_core_if_t * core_if, dwc_hc_t * hc) ++{ ++ hcintmsk_data_t hc_intr_mask; ++ hcchar_data_t hcchar; ++ hcsplt_data_t hcsplt; ++ ++ uint8_t hc_num = hc->hc_num; ++ dwc_otg_host_if_t *host_if = core_if->host_if; ++ dwc_otg_hc_regs_t *hc_regs = host_if->hc_regs[hc_num]; ++ ++ /* Clear old interrupt conditions for this host channel. */ ++ hc_intr_mask.d32 = 0xFFFFFFFF; ++ hc_intr_mask.b.reserved14_31 = 0; ++ DWC_WRITE_REG32(&hc_regs->hcint, hc_intr_mask.d32); ++ ++ /* Enable channel interrupts required for this transfer. */ ++ hc_intr_mask.d32 = 0; ++ hc_intr_mask.b.chhltd = 1; ++ if (core_if->dma_enable) { ++ /* For Descriptor DMA mode core halts the channel on AHB error. Interrupt is not required */ ++ if (!core_if->dma_desc_enable) ++ hc_intr_mask.b.ahberr = 1; ++ else { ++ if (hc->ep_type == DWC_OTG_EP_TYPE_ISOC) ++ hc_intr_mask.b.xfercompl = 1; ++ } ++ ++ if (hc->error_state && !hc->do_split && ++ hc->ep_type != DWC_OTG_EP_TYPE_ISOC) { ++ hc_intr_mask.b.ack = 1; ++ if (hc->ep_is_in) { ++ hc_intr_mask.b.datatglerr = 1; ++ if (hc->ep_type != DWC_OTG_EP_TYPE_INTR) { ++ hc_intr_mask.b.nak = 1; ++ } ++ } ++ } ++ } else { ++ switch (hc->ep_type) { ++ case DWC_OTG_EP_TYPE_CONTROL: ++ case DWC_OTG_EP_TYPE_BULK: ++ hc_intr_mask.b.xfercompl = 1; ++ hc_intr_mask.b.stall = 1; ++ hc_intr_mask.b.xacterr = 1; ++ hc_intr_mask.b.datatglerr = 1; ++ if (hc->ep_is_in) { ++ hc_intr_mask.b.bblerr = 1; ++ } else { ++ hc_intr_mask.b.nak = 1; ++ hc_intr_mask.b.nyet = 1; ++ if (hc->do_ping) { ++ hc_intr_mask.b.ack = 1; ++ } ++ } ++ ++ if (hc->do_split) { ++ hc_intr_mask.b.nak = 1; ++ if (hc->complete_split) { ++ hc_intr_mask.b.nyet = 1; ++ } else { ++ hc_intr_mask.b.ack = 1; ++ } ++ } ++ ++ if (hc->error_state) { ++ hc_intr_mask.b.ack = 1; ++ } ++ break; ++ case DWC_OTG_EP_TYPE_INTR: ++ hc_intr_mask.b.xfercompl = 1; ++ hc_intr_mask.b.nak = 1; ++ hc_intr_mask.b.stall = 1; ++ hc_intr_mask.b.xacterr = 1; ++ hc_intr_mask.b.datatglerr = 1; ++ hc_intr_mask.b.frmovrun = 1; ++ ++ if (hc->ep_is_in) { ++ hc_intr_mask.b.bblerr = 1; ++ } ++ if (hc->error_state) { ++ hc_intr_mask.b.ack = 1; ++ } ++ if (hc->do_split) { ++ if (hc->complete_split) { ++ hc_intr_mask.b.nyet = 1; ++ } else { ++ hc_intr_mask.b.ack = 1; ++ } ++ } ++ break; ++ case DWC_OTG_EP_TYPE_ISOC: ++ hc_intr_mask.b.xfercompl = 1; ++ hc_intr_mask.b.frmovrun = 1; ++ hc_intr_mask.b.ack = 1; ++ ++ if (hc->ep_is_in) { ++ hc_intr_mask.b.xacterr = 1; ++ hc_intr_mask.b.bblerr = 1; ++ } ++ break; ++ } ++ } ++ DWC_WRITE_REG32(&hc_regs->hcintmsk, hc_intr_mask.d32); ++ ++ /* ++ * Program the HCCHARn register with the endpoint characteristics for ++ * the current transfer. ++ */ ++ hcchar.d32 = 0; ++ hcchar.b.devaddr = hc->dev_addr; ++ hcchar.b.epnum = hc->ep_num; ++ hcchar.b.epdir = hc->ep_is_in; ++ hcchar.b.lspddev = (hc->speed == DWC_OTG_EP_SPEED_LOW); ++ hcchar.b.eptype = hc->ep_type; ++ hcchar.b.mps = hc->max_packet; ++ ++ DWC_WRITE_REG32(&host_if->hc_regs[hc_num]->hcchar, hcchar.d32); ++ ++ DWC_DEBUGPL(DBG_HCDV, "%s: Channel %d, Dev Addr %d, EP #%d\n", ++ __func__, hc->hc_num, hcchar.b.devaddr, hcchar.b.epnum); ++ DWC_DEBUGPL(DBG_HCDV, " Is In %d, Is Low Speed %d, EP Type %d, " ++ "Max Pkt %d, Multi Cnt %d\n", ++ hcchar.b.epdir, hcchar.b.lspddev, hcchar.b.eptype, ++ hcchar.b.mps, hcchar.b.multicnt); ++ ++ /* ++ * Program the HCSPLIT register for SPLITs ++ */ ++ hcsplt.d32 = 0; ++ if (hc->do_split) { ++ DWC_DEBUGPL(DBG_HCDV, "Programming HC %d with split --> %s\n", ++ hc->hc_num, ++ hc->complete_split ? "CSPLIT" : "SSPLIT"); ++ hcsplt.b.compsplt = hc->complete_split; ++ hcsplt.b.xactpos = hc->xact_pos; ++ hcsplt.b.hubaddr = hc->hub_addr; ++ hcsplt.b.prtaddr = hc->port_addr; ++ DWC_DEBUGPL(DBG_HCDV, "\t comp split %d\n", hc->complete_split); ++ DWC_DEBUGPL(DBG_HCDV, "\t xact pos %d\n", hc->xact_pos); ++ DWC_DEBUGPL(DBG_HCDV, "\t hub addr %d\n", hc->hub_addr); ++ DWC_DEBUGPL(DBG_HCDV, "\t port addr %d\n", hc->port_addr); ++ DWC_DEBUGPL(DBG_HCDV, "\t is_in %d\n", hc->ep_is_in); ++ DWC_DEBUGPL(DBG_HCDV, "\t Max Pkt: %d\n", hcchar.b.mps); ++ DWC_DEBUGPL(DBG_HCDV, "\t xferlen: %d\n", hc->xfer_len); ++ } ++ DWC_WRITE_REG32(&host_if->hc_regs[hc_num]->hcsplt, hcsplt.d32); ++ ++} ++ ++/** ++ * Attempts to halt a host channel. This function should only be called in ++ * Slave mode or to abort a transfer in either Slave mode or DMA mode. Under ++ * normal circumstances in DMA mode, the controller halts the channel when the ++ * transfer is complete or a condition occurs that requires application ++ * intervention. ++ * ++ * In slave mode, checks for a free request queue entry, then sets the Channel ++ * Enable and Channel Disable bits of the Host Channel Characteristics ++ * register of the specified channel to intiate the halt. If there is no free ++ * request queue entry, sets only the Channel Disable bit of the HCCHARn ++ * register to flush requests for this channel. In the latter case, sets a ++ * flag to indicate that the host channel needs to be halted when a request ++ * queue slot is open. ++ * ++ * In DMA mode, always sets the Channel Enable and Channel Disable bits of the ++ * HCCHARn register. The controller ensures there is space in the request ++ * queue before submitting the halt request. ++ * ++ * Some time may elapse before the core flushes any posted requests for this ++ * host channel and halts. The Channel Halted interrupt handler completes the ++ * deactivation of the host channel. ++ * ++ * @param core_if Controller register interface. ++ * @param hc Host channel to halt. ++ * @param halt_status Reason for halting the channel. ++ */ ++void dwc_otg_hc_halt(dwc_otg_core_if_t * core_if, ++ dwc_hc_t * hc, dwc_otg_halt_status_e halt_status) ++{ ++ gnptxsts_data_t nptxsts; ++ hptxsts_data_t hptxsts; ++ hcchar_data_t hcchar; ++ dwc_otg_hc_regs_t *hc_regs; ++ dwc_otg_core_global_regs_t *global_regs; ++ dwc_otg_host_global_regs_t *host_global_regs; ++ ++ hc_regs = core_if->host_if->hc_regs[hc->hc_num]; ++ global_regs = core_if->core_global_regs; ++ host_global_regs = core_if->host_if->host_global_regs; ++ ++ DWC_ASSERT(!(halt_status == DWC_OTG_HC_XFER_NO_HALT_STATUS), ++ "halt_status = %d\n", halt_status); ++ ++ if (halt_status == DWC_OTG_HC_XFER_URB_DEQUEUE || ++ halt_status == DWC_OTG_HC_XFER_AHB_ERR) { ++ /* ++ * Disable all channel interrupts except Ch Halted. The QTD ++ * and QH state associated with this transfer has been cleared ++ * (in the case of URB_DEQUEUE), so the channel needs to be ++ * shut down carefully to prevent crashes. ++ */ ++ hcintmsk_data_t hcintmsk; ++ hcintmsk.d32 = 0; ++ hcintmsk.b.chhltd = 1; ++ DWC_WRITE_REG32(&hc_regs->hcintmsk, hcintmsk.d32); ++ ++ /* ++ * Make sure no other interrupts besides halt are currently ++ * pending. Handling another interrupt could cause a crash due ++ * to the QTD and QH state. ++ */ ++ DWC_WRITE_REG32(&hc_regs->hcint, ~hcintmsk.d32); ++ ++ /* ++ * Make sure the halt status is set to URB_DEQUEUE or AHB_ERR ++ * even if the channel was already halted for some other ++ * reason. ++ */ ++ hc->halt_status = halt_status; ++ ++ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); ++ if (hcchar.b.chen == 0) { ++ /* ++ * The channel is either already halted or it hasn't ++ * started yet. In DMA mode, the transfer may halt if ++ * it finishes normally or a condition occurs that ++ * requires driver intervention. Don't want to halt ++ * the channel again. In either Slave or DMA mode, ++ * it's possible that the transfer has been assigned ++ * to a channel, but not started yet when an URB is ++ * dequeued. Don't want to halt a channel that hasn't ++ * started yet. ++ */ ++ return; ++ } ++ } ++ if (hc->halt_pending) { ++ /* ++ * A halt has already been issued for this channel. This might ++ * happen when a transfer is aborted by a higher level in ++ * the stack. ++ */ ++#ifdef DEBUG ++ DWC_PRINTF ++ ("*** %s: Channel %d, _hc->halt_pending already set ***\n", ++ __func__, hc->hc_num); ++ ++#endif ++ return; ++ } ++ ++ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); ++ ++ /* No need to set the bit in DDMA for disabling the channel */ ++ //TODO check it everywhere channel is disabled ++ if (!core_if->core_params->dma_desc_enable) ++ hcchar.b.chen = 1; ++ hcchar.b.chdis = 1; ++ ++ if (!core_if->dma_enable) { ++ /* Check for space in the request queue to issue the halt. */ ++ if (hc->ep_type == DWC_OTG_EP_TYPE_CONTROL || ++ hc->ep_type == DWC_OTG_EP_TYPE_BULK) { ++ nptxsts.d32 = DWC_READ_REG32(&global_regs->gnptxsts); ++ if (nptxsts.b.nptxqspcavail == 0) { ++ hcchar.b.chen = 0; ++ } ++ } else { ++ hptxsts.d32 = ++ DWC_READ_REG32(&host_global_regs->hptxsts); ++ if ((hptxsts.b.ptxqspcavail == 0) ++ || (core_if->queuing_high_bandwidth)) { ++ hcchar.b.chen = 0; ++ } ++ } ++ } ++ DWC_WRITE_REG32(&hc_regs->hcchar, hcchar.d32); ++ ++ hc->halt_status = halt_status; ++ ++ if (hcchar.b.chen) { ++ hc->halt_pending = 1; ++ hc->halt_on_queue = 0; ++ } else { ++ hc->halt_on_queue = 1; ++ } ++ ++ DWC_DEBUGPL(DBG_HCDV, "%s: Channel %d\n", __func__, hc->hc_num); ++ DWC_DEBUGPL(DBG_HCDV, " hcchar: 0x%08x\n", hcchar.d32); ++ DWC_DEBUGPL(DBG_HCDV, " halt_pending: %d\n", hc->halt_pending); ++ DWC_DEBUGPL(DBG_HCDV, " halt_on_queue: %d\n", hc->halt_on_queue); ++ DWC_DEBUGPL(DBG_HCDV, " halt_status: %d\n", hc->halt_status); ++ ++ return; ++} ++ ++/** ++ * Clears the transfer state for a host channel. This function is normally ++ * called after a transfer is done and the host channel is being released. ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ * @param hc Identifies the host channel to clean up. ++ */ ++void dwc_otg_hc_cleanup(dwc_otg_core_if_t * core_if, dwc_hc_t * hc) ++{ ++ dwc_otg_hc_regs_t *hc_regs; ++ ++ hc->xfer_started = 0; ++ ++ /* ++ * Clear channel interrupt enables and any unhandled channel interrupt ++ * conditions. ++ */ ++ hc_regs = core_if->host_if->hc_regs[hc->hc_num]; ++ DWC_WRITE_REG32(&hc_regs->hcintmsk, 0); ++ DWC_WRITE_REG32(&hc_regs->hcint, 0xFFFFFFFF); ++#ifdef DEBUG ++ DWC_TIMER_CANCEL(core_if->hc_xfer_timer[hc->hc_num]); ++#endif ++} ++ ++/** ++ * Sets the channel property that indicates in which frame a periodic transfer ++ * should occur. This is always set to the _next_ frame. This function has no ++ * effect on non-periodic transfers. ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ * @param hc Identifies the host channel to set up and its properties. ++ * @param hcchar Current value of the HCCHAR register for the specified host ++ * channel. ++ */ ++static inline void hc_set_even_odd_frame(dwc_otg_core_if_t * core_if, ++ dwc_hc_t * hc, hcchar_data_t * hcchar) ++{ ++ if (hc->ep_type == DWC_OTG_EP_TYPE_INTR || ++ hc->ep_type == DWC_OTG_EP_TYPE_ISOC) { ++ hfnum_data_t hfnum; ++ hfnum.d32 = ++ DWC_READ_REG32(&core_if->host_if->host_global_regs->hfnum); ++ ++ /* 1 if _next_ frame is odd, 0 if it's even */ ++ hcchar->b.oddfrm = (hfnum.b.frnum & 0x1) ? 0 : 1; ++#ifdef DEBUG ++ if (hc->ep_type == DWC_OTG_EP_TYPE_INTR && hc->do_split ++ && !hc->complete_split) { ++ switch (hfnum.b.frnum & 0x7) { ++ case 7: ++ core_if->hfnum_7_samples++; ++ core_if->hfnum_7_frrem_accum += hfnum.b.frrem; ++ break; ++ case 0: ++ core_if->hfnum_0_samples++; ++ core_if->hfnum_0_frrem_accum += hfnum.b.frrem; ++ break; ++ default: ++ core_if->hfnum_other_samples++; ++ core_if->hfnum_other_frrem_accum += ++ hfnum.b.frrem; ++ break; ++ } ++ } ++#endif ++ } ++} ++ ++#ifdef DEBUG ++void hc_xfer_timeout(void *ptr) ++{ ++ hc_xfer_info_t *xfer_info = NULL; ++ int hc_num = 0; ++ ++ if (ptr) ++ xfer_info = (hc_xfer_info_t *) ptr; ++ ++ if (!xfer_info->hc) { ++ DWC_ERROR("xfer_info->hc = %p\n", xfer_info->hc); ++ return; ++ } ++ ++ hc_num = xfer_info->hc->hc_num; ++ DWC_WARN("%s: timeout on channel %d\n", __func__, hc_num); ++ DWC_WARN(" start_hcchar_val 0x%08x\n", ++ xfer_info->core_if->start_hcchar_val[hc_num]); ++} ++#endif ++ ++void ep_xfer_timeout(void *ptr) ++{ ++ ep_xfer_info_t *xfer_info = NULL; ++ int ep_num = 0; ++ dctl_data_t dctl = {.d32 = 0 }; ++ gintsts_data_t gintsts = {.d32 = 0 }; ++ gintmsk_data_t gintmsk = {.d32 = 0 }; ++ ++ if (ptr) ++ xfer_info = (ep_xfer_info_t *) ptr; ++ ++ if (!xfer_info->ep) { ++ DWC_ERROR("xfer_info->ep = %p\n", xfer_info->ep); ++ return; ++ } ++ ++ ep_num = xfer_info->ep->num; ++ DWC_WARN("%s: timeout on endpoit %d\n", __func__, ep_num); ++ /* Put the sate to 2 as it was time outed */ ++ xfer_info->state = 2; ++ ++ dctl.d32 = ++ DWC_READ_REG32(&xfer_info->core_if->dev_if->dev_global_regs->dctl); ++ gintsts.d32 = ++ DWC_READ_REG32(&xfer_info->core_if->core_global_regs->gintsts); ++ gintmsk.d32 = ++ DWC_READ_REG32(&xfer_info->core_if->core_global_regs->gintmsk); ++ ++ if (!gintmsk.b.goutnakeff) { ++ /* Unmask it */ ++ gintmsk.b.goutnakeff = 1; ++ DWC_WRITE_REG32(&xfer_info->core_if->core_global_regs->gintmsk, ++ gintmsk.d32); ++ ++ } ++ ++ if (!gintsts.b.goutnakeff) { ++ dctl.b.sgoutnak = 1; ++ } ++ DWC_WRITE_REG32(&xfer_info->core_if->dev_if->dev_global_regs->dctl, ++ dctl.d32); ++ ++} ++ ++void set_pid_isoc(dwc_hc_t * hc) ++{ ++ /* Set up the initial PID for the transfer. */ ++ if (hc->speed == DWC_OTG_EP_SPEED_HIGH) { ++ if (hc->ep_is_in) { ++ if (hc->multi_count == 1) { ++ hc->data_pid_start = DWC_OTG_HC_PID_DATA0; ++ } else if (hc->multi_count == 2) { ++ hc->data_pid_start = DWC_OTG_HC_PID_DATA1; ++ } else { ++ hc->data_pid_start = DWC_OTG_HC_PID_DATA2; ++ } ++ } else { ++ if (hc->multi_count == 1) { ++ hc->data_pid_start = DWC_OTG_HC_PID_DATA0; ++ } else { ++ hc->data_pid_start = DWC_OTG_HC_PID_MDATA; ++ } ++ } ++ } else { ++ hc->data_pid_start = DWC_OTG_HC_PID_DATA0; ++ } ++} ++ ++/** ++ * This function does the setup for a data transfer for a host channel and ++ * starts the transfer. May be called in either Slave mode or DMA mode. In ++ * Slave mode, the caller must ensure that there is sufficient space in the ++ * request queue and Tx Data FIFO. ++ * ++ * For an OUT transfer in Slave mode, it loads a data packet into the ++ * appropriate FIFO. If necessary, additional data packets will be loaded in ++ * the Host ISR. ++ * ++ * For an IN transfer in Slave mode, a data packet is requested. The data ++ * packets are unloaded from the Rx FIFO in the Host ISR. If necessary, ++ * additional data packets are requested in the Host ISR. ++ * ++ * For a PING transfer in Slave mode, the Do Ping bit is set in the HCTSIZ ++ * register along with a packet count of 1 and the channel is enabled. This ++ * causes a single PING transaction to occur. Other fields in HCTSIZ are ++ * simply set to 0 since no data transfer occurs in this case. ++ * ++ * For a PING transfer in DMA mode, the HCTSIZ register is initialized with ++ * all the information required to perform the subsequent data transfer. In ++ * addition, the Do Ping bit is set in the HCTSIZ register. In this case, the ++ * controller performs the entire PING protocol, then starts the data ++ * transfer. ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ * @param hc Information needed to initialize the host channel. The xfer_len ++ * value may be reduced to accommodate the max widths of the XferSize and ++ * PktCnt fields in the HCTSIZn register. The multi_count value may be changed ++ * to reflect the final xfer_len value. ++ */ ++void dwc_otg_hc_start_transfer(dwc_otg_core_if_t * core_if, dwc_hc_t * hc) ++{ ++ hcchar_data_t hcchar; ++ hctsiz_data_t hctsiz; ++ uint16_t num_packets; ++ uint32_t max_hc_xfer_size = core_if->core_params->max_transfer_size; ++ uint16_t max_hc_pkt_count = core_if->core_params->max_packet_count; ++ dwc_otg_hc_regs_t *hc_regs = core_if->host_if->hc_regs[hc->hc_num]; ++ ++ hctsiz.d32 = 0; ++ ++ if (hc->do_ping) { ++ if (!core_if->dma_enable) { ++ dwc_otg_hc_do_ping(core_if, hc); ++ hc->xfer_started = 1; ++ return; ++ } else { ++ hctsiz.b.dopng = 1; ++ } ++ } ++ ++ if (hc->do_split) { ++ num_packets = 1; ++ ++ if (hc->complete_split && !hc->ep_is_in) { ++ /* For CSPLIT OUT Transfer, set the size to 0 so the ++ * core doesn't expect any data written to the FIFO */ ++ hc->xfer_len = 0; ++ } else if (hc->ep_is_in || (hc->xfer_len > hc->max_packet)) { ++ hc->xfer_len = hc->max_packet; ++ } else if (!hc->ep_is_in && (hc->xfer_len > 188)) { ++ hc->xfer_len = 188; ++ } ++ ++ hctsiz.b.xfersize = hc->xfer_len; ++ } else { ++ /* ++ * Ensure that the transfer length and packet count will fit ++ * in the widths allocated for them in the HCTSIZn register. ++ */ ++ if (hc->ep_type == DWC_OTG_EP_TYPE_INTR || ++ hc->ep_type == DWC_OTG_EP_TYPE_ISOC) { ++ /* ++ * Make sure the transfer size is no larger than one ++ * (micro)frame's worth of data. (A check was done ++ * when the periodic transfer was accepted to ensure ++ * that a (micro)frame's worth of data can be ++ * programmed into a channel.) ++ */ ++ uint32_t max_periodic_len = ++ hc->multi_count * hc->max_packet; ++ if (hc->xfer_len > max_periodic_len) { ++ hc->xfer_len = max_periodic_len; ++ } else { ++ } ++ } else if (hc->xfer_len > max_hc_xfer_size) { ++ /* Make sure that xfer_len is a multiple of max packet size. */ ++ hc->xfer_len = max_hc_xfer_size - hc->max_packet + 1; ++ } ++ ++ if (hc->xfer_len > 0) { ++ num_packets = ++ (hc->xfer_len + hc->max_packet - ++ 1) / hc->max_packet; ++ if (num_packets > max_hc_pkt_count) { ++ num_packets = max_hc_pkt_count; ++ hc->xfer_len = num_packets * hc->max_packet; ++ } ++ } else { ++ /* Need 1 packet for transfer length of 0. */ ++ num_packets = 1; ++ } ++ ++ if (hc->ep_is_in) { ++ /* Always program an integral # of max packets for IN transfers. */ ++ hc->xfer_len = num_packets * hc->max_packet; ++ } ++ ++ if (hc->ep_type == DWC_OTG_EP_TYPE_INTR || ++ hc->ep_type == DWC_OTG_EP_TYPE_ISOC) { ++ /* ++ * Make sure that the multi_count field matches the ++ * actual transfer length. ++ */ ++ hc->multi_count = num_packets; ++ } ++ ++ if (hc->ep_type == DWC_OTG_EP_TYPE_ISOC) ++ set_pid_isoc(hc); ++ ++ hctsiz.b.xfersize = hc->xfer_len; ++ } ++ ++ hc->start_pkt_count = num_packets; ++ hctsiz.b.pktcnt = num_packets; ++ hctsiz.b.pid = hc->data_pid_start; ++ DWC_WRITE_REG32(&hc_regs->hctsiz, hctsiz.d32); ++ ++ DWC_DEBUGPL(DBG_HCDV, "%s: Channel %d\n", __func__, hc->hc_num); ++ DWC_DEBUGPL(DBG_HCDV, " Xfer Size: %d\n", hctsiz.b.xfersize); ++ DWC_DEBUGPL(DBG_HCDV, " Num Pkts: %d\n", hctsiz.b.pktcnt); ++ DWC_DEBUGPL(DBG_HCDV, " Start PID: %d\n", hctsiz.b.pid); ++ ++ if (core_if->dma_enable) { ++ dwc_dma_t dma_addr; ++ if (hc->align_buff) { ++ dma_addr = hc->align_buff; ++ } else { ++ dma_addr = ((unsigned long)hc->xfer_buff & 0xffffffff); ++ } ++ DWC_WRITE_REG32(&hc_regs->hcdma, dma_addr); ++ } ++ ++ /* Start the split */ ++ if (hc->do_split) { ++ hcsplt_data_t hcsplt; ++ hcsplt.d32 = DWC_READ_REG32(&hc_regs->hcsplt); ++ hcsplt.b.spltena = 1; ++ DWC_WRITE_REG32(&hc_regs->hcsplt, hcsplt.d32); ++ } ++ ++ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); ++ hcchar.b.multicnt = hc->multi_count; ++ hc_set_even_odd_frame(core_if, hc, &hcchar); ++#ifdef DEBUG ++ core_if->start_hcchar_val[hc->hc_num] = hcchar.d32; ++ if (hcchar.b.chdis) { ++ DWC_WARN("%s: chdis set, channel %d, hcchar 0x%08x\n", ++ __func__, hc->hc_num, hcchar.d32); ++ } ++#endif ++ ++ /* Set host channel enable after all other setup is complete. */ ++ hcchar.b.chen = 1; ++ hcchar.b.chdis = 0; ++ DWC_WRITE_REG32(&hc_regs->hcchar, hcchar.d32); ++ ++ hc->xfer_started = 1; ++ hc->requests++; ++ ++ if (!core_if->dma_enable && !hc->ep_is_in && hc->xfer_len > 0) { ++ /* Load OUT packet into the appropriate Tx FIFO. */ ++ dwc_otg_hc_write_packet(core_if, hc); ++ } ++#ifdef DEBUG ++ if (hc->ep_type != DWC_OTG_EP_TYPE_INTR) { ++ DWC_DEBUGPL(DBG_HCDV, "transfer %d from core_if %p\n", ++ hc->hc_num, core_if);//GRAYG ++ core_if->hc_xfer_info[hc->hc_num].core_if = core_if; ++ core_if->hc_xfer_info[hc->hc_num].hc = hc; ++ ++ /* Start a timer for this transfer. */ ++ DWC_TIMER_SCHEDULE(core_if->hc_xfer_timer[hc->hc_num], 10000); ++ } ++#endif ++} ++ ++/** ++ * This function does the setup for a data transfer for a host channel ++ * and starts the transfer in Descriptor DMA mode. ++ * ++ * Initializes HCTSIZ register. For a PING transfer the Do Ping bit is set. ++ * Sets PID and NTD values. For periodic transfers ++ * initializes SCHED_INFO field with micro-frame bitmap. ++ * ++ * Initializes HCDMA register with descriptor list address and CTD value ++ * then starts the transfer via enabling the channel. ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ * @param hc Information needed to initialize the host channel. ++ */ ++void dwc_otg_hc_start_transfer_ddma(dwc_otg_core_if_t * core_if, dwc_hc_t * hc) ++{ ++ dwc_otg_hc_regs_t *hc_regs = core_if->host_if->hc_regs[hc->hc_num]; ++ hcchar_data_t hcchar; ++ hctsiz_data_t hctsiz; ++ hcdma_data_t hcdma; ++ ++ hctsiz.d32 = 0; ++ ++ if (hc->do_ping) ++ hctsiz.b_ddma.dopng = 1; ++ ++ if (hc->ep_type == DWC_OTG_EP_TYPE_ISOC) ++ set_pid_isoc(hc); ++ ++ /* Packet Count and Xfer Size are not used in Descriptor DMA mode */ ++ hctsiz.b_ddma.pid = hc->data_pid_start; ++ hctsiz.b_ddma.ntd = hc->ntd - 1; /* 0 - 1 descriptor, 1 - 2 descriptors, etc. */ ++ hctsiz.b_ddma.schinfo = hc->schinfo; /* Non-zero only for high-speed interrupt endpoints */ ++ ++ DWC_DEBUGPL(DBG_HCDV, "%s: Channel %d\n", __func__, hc->hc_num); ++ DWC_DEBUGPL(DBG_HCDV, " Start PID: %d\n", hctsiz.b.pid); ++ DWC_DEBUGPL(DBG_HCDV, " NTD: %d\n", hctsiz.b_ddma.ntd); ++ ++ DWC_WRITE_REG32(&hc_regs->hctsiz, hctsiz.d32); ++ ++ hcdma.d32 = 0; ++ hcdma.b.dma_addr = ((uint32_t) hc->desc_list_addr) >> 11; ++ ++ /* Always start from first descriptor. */ ++ hcdma.b.ctd = 0; ++ DWC_WRITE_REG32(&hc_regs->hcdma, hcdma.d32); ++ ++ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); ++ hcchar.b.multicnt = hc->multi_count; ++ ++#ifdef DEBUG ++ core_if->start_hcchar_val[hc->hc_num] = hcchar.d32; ++ if (hcchar.b.chdis) { ++ DWC_WARN("%s: chdis set, channel %d, hcchar 0x%08x\n", ++ __func__, hc->hc_num, hcchar.d32); ++ } ++#endif ++ ++ /* Set host channel enable after all other setup is complete. */ ++ hcchar.b.chen = 1; ++ hcchar.b.chdis = 0; ++ ++ DWC_WRITE_REG32(&hc_regs->hcchar, hcchar.d32); ++ ++ hc->xfer_started = 1; ++ hc->requests++; ++ ++#ifdef DEBUG ++ if ((hc->ep_type != DWC_OTG_EP_TYPE_INTR) ++ && (hc->ep_type != DWC_OTG_EP_TYPE_ISOC)) { ++ DWC_DEBUGPL(DBG_HCDV, "DMA transfer %d from core_if %p\n", ++ hc->hc_num, core_if);//GRAYG ++ core_if->hc_xfer_info[hc->hc_num].core_if = core_if; ++ core_if->hc_xfer_info[hc->hc_num].hc = hc; ++ /* Start a timer for this transfer. */ ++ DWC_TIMER_SCHEDULE(core_if->hc_xfer_timer[hc->hc_num], 10000); ++ } ++#endif ++ ++} ++ ++/** ++ * This function continues a data transfer that was started by previous call ++ * to <code>dwc_otg_hc_start_transfer</code>. The caller must ensure there is ++ * sufficient space in the request queue and Tx Data FIFO. This function ++ * should only be called in Slave mode. In DMA mode, the controller acts ++ * autonomously to complete transfers programmed to a host channel. ++ * ++ * For an OUT transfer, a new data packet is loaded into the appropriate FIFO ++ * if there is any data remaining to be queued. For an IN transfer, another ++ * data packet is always requested. For the SETUP phase of a control transfer, ++ * this function does nothing. ++ * ++ * @return 1 if a new request is queued, 0 if no more requests are required ++ * for this transfer. ++ */ ++int dwc_otg_hc_continue_transfer(dwc_otg_core_if_t * core_if, dwc_hc_t * hc) ++{ ++ DWC_DEBUGPL(DBG_HCDV, "%s: Channel %d\n", __func__, hc->hc_num); ++ ++ if (hc->do_split) { ++ /* SPLITs always queue just once per channel */ ++ return 0; ++ } else if (hc->data_pid_start == DWC_OTG_HC_PID_SETUP) { ++ /* SETUPs are queued only once since they can't be NAKed. */ ++ return 0; ++ } else if (hc->ep_is_in) { ++ /* ++ * Always queue another request for other IN transfers. If ++ * back-to-back INs are issued and NAKs are received for both, ++ * the driver may still be processing the first NAK when the ++ * second NAK is received. When the interrupt handler clears ++ * the NAK interrupt for the first NAK, the second NAK will ++ * not be seen. So we can't depend on the NAK interrupt ++ * handler to requeue a NAKed request. Instead, IN requests ++ * are issued each time this function is called. When the ++ * transfer completes, the extra requests for the channel will ++ * be flushed. ++ */ ++ hcchar_data_t hcchar; ++ dwc_otg_hc_regs_t *hc_regs = ++ core_if->host_if->hc_regs[hc->hc_num]; ++ ++ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); ++ hc_set_even_odd_frame(core_if, hc, &hcchar); ++ hcchar.b.chen = 1; ++ hcchar.b.chdis = 0; ++ DWC_DEBUGPL(DBG_HCDV, " IN xfer: hcchar = 0x%08x\n", ++ hcchar.d32); ++ DWC_WRITE_REG32(&hc_regs->hcchar, hcchar.d32); ++ hc->requests++; ++ return 1; ++ } else { ++ /* OUT transfers. */ ++ if (hc->xfer_count < hc->xfer_len) { ++ if (hc->ep_type == DWC_OTG_EP_TYPE_INTR || ++ hc->ep_type == DWC_OTG_EP_TYPE_ISOC) { ++ hcchar_data_t hcchar; ++ dwc_otg_hc_regs_t *hc_regs; ++ hc_regs = core_if->host_if->hc_regs[hc->hc_num]; ++ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); ++ hc_set_even_odd_frame(core_if, hc, &hcchar); ++ } ++ ++ /* Load OUT packet into the appropriate Tx FIFO. */ ++ dwc_otg_hc_write_packet(core_if, hc); ++ hc->requests++; ++ return 1; ++ } else { ++ return 0; ++ } ++ } ++} ++ ++/** ++ * Starts a PING transfer. This function should only be called in Slave mode. ++ * The Do Ping bit is set in the HCTSIZ register, then the channel is enabled. ++ */ ++void dwc_otg_hc_do_ping(dwc_otg_core_if_t * core_if, dwc_hc_t * hc) ++{ ++ hcchar_data_t hcchar; ++ hctsiz_data_t hctsiz; ++ dwc_otg_hc_regs_t *hc_regs = core_if->host_if->hc_regs[hc->hc_num]; ++ ++ DWC_DEBUGPL(DBG_HCDV, "%s: Channel %d\n", __func__, hc->hc_num); ++ ++ hctsiz.d32 = 0; ++ hctsiz.b.dopng = 1; ++ hctsiz.b.pktcnt = 1; ++ DWC_WRITE_REG32(&hc_regs->hctsiz, hctsiz.d32); ++ ++ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); ++ hcchar.b.chen = 1; ++ hcchar.b.chdis = 0; ++ DWC_WRITE_REG32(&hc_regs->hcchar, hcchar.d32); ++} ++ ++/* ++ * This function writes a packet into the Tx FIFO associated with the Host ++ * Channel. For a channel associated with a non-periodic EP, the non-periodic ++ * Tx FIFO is written. For a channel associated with a periodic EP, the ++ * periodic Tx FIFO is written. This function should only be called in Slave ++ * mode. ++ * ++ * Upon return the xfer_buff and xfer_count fields in _hc are incremented by ++ * then number of bytes written to the Tx FIFO. ++ */ ++void dwc_otg_hc_write_packet(dwc_otg_core_if_t * core_if, dwc_hc_t * hc) ++{ ++ uint32_t i; ++ uint32_t remaining_count; ++ uint32_t byte_count; ++ uint32_t dword_count; ++ ++ uint32_t *data_buff = (uint32_t *) (hc->xfer_buff); ++ uint32_t *data_fifo = core_if->data_fifo[hc->hc_num]; ++ ++ remaining_count = hc->xfer_len - hc->xfer_count; ++ if (remaining_count > hc->max_packet) { ++ byte_count = hc->max_packet; ++ } else { ++ byte_count = remaining_count; ++ } ++ ++ dword_count = (byte_count + 3) / 4; ++ ++ if ((((unsigned long)data_buff) & 0x3) == 0) { ++ /* xfer_buff is DWORD aligned. */ ++ for (i = 0; i < dword_count; i++, data_buff++) { ++ DWC_WRITE_REG32(data_fifo, *data_buff); ++ } ++ } else { ++ /* xfer_buff is not DWORD aligned. */ ++ for (i = 0; i < dword_count; i++, data_buff++) { ++ uint32_t data; ++ data = ++ (data_buff[0] | data_buff[1] << 8 | data_buff[2] << ++ 16 | data_buff[3] << 24); ++ DWC_WRITE_REG32(data_fifo, data); ++ } ++ } ++ ++ hc->xfer_count += byte_count; ++ hc->xfer_buff += byte_count; ++} ++ ++/** ++ * Gets the current USB frame number. This is the frame number from the last ++ * SOF packet. ++ */ ++uint32_t dwc_otg_get_frame_number(dwc_otg_core_if_t * core_if) ++{ ++ dsts_data_t dsts; ++ dsts.d32 = DWC_READ_REG32(&core_if->dev_if->dev_global_regs->dsts); ++ ++ /* read current frame/microframe number from DSTS register */ ++ return dsts.b.soffn; ++} ++ ++/** ++ * Calculates and gets the frame Interval value of HFIR register according PHY ++ * type and speed.The application can modify a value of HFIR register only after ++ * the Port Enable bit of the Host Port Control and Status register ++ * (HPRT.PrtEnaPort) has been set. ++*/ ++ ++uint32_t calc_frame_interval(dwc_otg_core_if_t * core_if) ++{ ++ gusbcfg_data_t usbcfg; ++ hwcfg2_data_t hwcfg2; ++ hprt0_data_t hprt0; ++ int clock = 60; // default value ++ usbcfg.d32 = DWC_READ_REG32(&core_if->core_global_regs->gusbcfg); ++ hwcfg2.d32 = DWC_READ_REG32(&core_if->core_global_regs->ghwcfg2); ++ hprt0.d32 = DWC_READ_REG32(core_if->host_if->hprt0); ++ if (!usbcfg.b.physel && usbcfg.b.ulpi_utmi_sel && !usbcfg.b.phyif) ++ clock = 60; ++ if (usbcfg.b.physel && hwcfg2.b.fs_phy_type == 3) ++ clock = 48; ++ if (!usbcfg.b.phylpwrclksel && !usbcfg.b.physel && ++ !usbcfg.b.ulpi_utmi_sel && usbcfg.b.phyif) ++ clock = 30; ++ if (!usbcfg.b.phylpwrclksel && !usbcfg.b.physel && ++ !usbcfg.b.ulpi_utmi_sel && !usbcfg.b.phyif) ++ clock = 60; ++ if (usbcfg.b.phylpwrclksel && !usbcfg.b.physel && ++ !usbcfg.b.ulpi_utmi_sel && usbcfg.b.phyif) ++ clock = 48; ++ if (usbcfg.b.physel && !usbcfg.b.phyif && hwcfg2.b.fs_phy_type == 2) ++ clock = 48; ++ if (usbcfg.b.physel && hwcfg2.b.fs_phy_type == 1) ++ clock = 48; ++ if (hprt0.b.prtspd == 0) ++ /* High speed case */ ++ return 125 * clock - 1; ++ else ++ /* FS/LS case */ ++ return 1000 * clock - 1; ++} ++ ++/** ++ * This function reads a setup packet from the Rx FIFO into the destination ++ * buffer. This function is called from the Rx Status Queue Level (RxStsQLvl) ++ * Interrupt routine when a SETUP packet has been received in Slave mode. ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ * @param dest Destination buffer for packet data. ++ */ ++void dwc_otg_read_setup_packet(dwc_otg_core_if_t * core_if, uint32_t * dest) ++{ ++ device_grxsts_data_t status; ++ /* Get the 8 bytes of a setup transaction data */ ++ ++ /* Pop 2 DWORDS off the receive data FIFO into memory */ ++ dest[0] = DWC_READ_REG32(core_if->data_fifo[0]); ++ dest[1] = DWC_READ_REG32(core_if->data_fifo[0]); ++ if (core_if->snpsid >= OTG_CORE_REV_3_00a) { ++ status.d32 = ++ DWC_READ_REG32(&core_if->core_global_regs->grxstsp); ++ DWC_DEBUGPL(DBG_ANY, ++ "EP:%d BCnt:%d " "pktsts:%x Frame:%d(0x%0x)\n", ++ status.b.epnum, status.b.bcnt, status.b.pktsts, ++ status.b.fn, status.b.fn); ++ } ++} ++ ++/** ++ * This function enables EP0 OUT to receive SETUP packets and configures EP0 ++ * IN for transmitting packets. It is normally called when the ++ * "Enumeration Done" interrupt occurs. ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ * @param ep The EP0 data. ++ */ ++void dwc_otg_ep0_activate(dwc_otg_core_if_t * core_if, dwc_ep_t * ep) ++{ ++ dwc_otg_dev_if_t *dev_if = core_if->dev_if; ++ dsts_data_t dsts; ++ depctl_data_t diepctl; ++ depctl_data_t doepctl; ++ dctl_data_t dctl = {.d32 = 0 }; ++ ++ ep->stp_rollover = 0; ++ /* Read the Device Status and Endpoint 0 Control registers */ ++ dsts.d32 = DWC_READ_REG32(&dev_if->dev_global_regs->dsts); ++ diepctl.d32 = DWC_READ_REG32(&dev_if->in_ep_regs[0]->diepctl); ++ doepctl.d32 = DWC_READ_REG32(&dev_if->out_ep_regs[0]->doepctl); ++ ++ /* Set the MPS of the IN EP based on the enumeration speed */ ++ switch (dsts.b.enumspd) { ++ case DWC_DSTS_ENUMSPD_HS_PHY_30MHZ_OR_60MHZ: ++ case DWC_DSTS_ENUMSPD_FS_PHY_30MHZ_OR_60MHZ: ++ case DWC_DSTS_ENUMSPD_FS_PHY_48MHZ: ++ diepctl.b.mps = DWC_DEP0CTL_MPS_64; ++ break; ++ case DWC_DSTS_ENUMSPD_LS_PHY_6MHZ: ++ diepctl.b.mps = DWC_DEP0CTL_MPS_8; ++ break; ++ } ++ ++ DWC_WRITE_REG32(&dev_if->in_ep_regs[0]->diepctl, diepctl.d32); ++ ++ /* Enable OUT EP for receive */ ++ if (core_if->snpsid <= OTG_CORE_REV_2_94a) { ++ doepctl.b.epena = 1; ++ DWC_WRITE_REG32(&dev_if->out_ep_regs[0]->doepctl, doepctl.d32); ++ } ++#ifdef VERBOSE ++ DWC_DEBUGPL(DBG_PCDV, "doepctl0=%0x\n", ++ DWC_READ_REG32(&dev_if->out_ep_regs[0]->doepctl)); ++ DWC_DEBUGPL(DBG_PCDV, "diepctl0=%0x\n", ++ DWC_READ_REG32(&dev_if->in_ep_regs[0]->diepctl)); ++#endif ++ dctl.b.cgnpinnak = 1; ++ ++ DWC_MODIFY_REG32(&dev_if->dev_global_regs->dctl, dctl.d32, dctl.d32); ++ DWC_DEBUGPL(DBG_PCDV, "dctl=%0x\n", ++ DWC_READ_REG32(&dev_if->dev_global_regs->dctl)); ++ ++} ++ ++/** ++ * This function activates an EP. The Device EP control register for ++ * the EP is configured as defined in the ep structure. Note: This ++ * function is not used for EP0. ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ * @param ep The EP to activate. ++ */ ++void dwc_otg_ep_activate(dwc_otg_core_if_t * core_if, dwc_ep_t * ep) ++{ ++ dwc_otg_dev_if_t *dev_if = core_if->dev_if; ++ depctl_data_t depctl; ++ volatile uint32_t *addr; ++ daint_data_t daintmsk = {.d32 = 0 }; ++ dcfg_data_t dcfg; ++ uint8_t i; ++ ++ DWC_DEBUGPL(DBG_PCDV, "%s() EP%d-%s\n", __func__, ep->num, ++ (ep->is_in ? "IN" : "OUT")); ++ ++#ifdef DWC_UTE_PER_IO ++ ep->xiso_frame_num = 0xFFFFFFFF; ++ ep->xiso_active_xfers = 0; ++ ep->xiso_queued_xfers = 0; ++#endif ++ /* Read DEPCTLn register */ ++ if (ep->is_in == 1) { ++ addr = &dev_if->in_ep_regs[ep->num]->diepctl; ++ daintmsk.ep.in = 1 << ep->num; ++ } else { ++ addr = &dev_if->out_ep_regs[ep->num]->doepctl; ++ daintmsk.ep.out = 1 << ep->num; ++ } ++ ++ /* If the EP is already active don't change the EP Control ++ * register. */ ++ depctl.d32 = DWC_READ_REG32(addr); ++ if (!depctl.b.usbactep) { ++ depctl.b.mps = ep->maxpacket; ++ depctl.b.eptype = ep->type; ++ depctl.b.txfnum = ep->tx_fifo_num; ++ ++ if (ep->type == DWC_OTG_EP_TYPE_ISOC) { ++ depctl.b.setd0pid = 1; // ??? ++ } else { ++ depctl.b.setd0pid = 1; ++ } ++ depctl.b.usbactep = 1; ++ ++ /* Update nextep_seq array and EPMSCNT in DCFG*/ ++ if (!(depctl.b.eptype & 1) && (ep->is_in == 1)) { // NP IN EP ++ for (i = 0; i <= core_if->dev_if->num_in_eps; i++) { ++ if (core_if->nextep_seq[i] == core_if->first_in_nextep_seq) ++ break; ++ } ++ core_if->nextep_seq[i] = ep->num; ++ core_if->nextep_seq[ep->num] = core_if->first_in_nextep_seq; ++ depctl.b.nextep = core_if->nextep_seq[ep->num]; ++ dcfg.d32 = DWC_READ_REG32(&dev_if->dev_global_regs->dcfg); ++ dcfg.b.epmscnt++; ++ DWC_WRITE_REG32(&dev_if->dev_global_regs->dcfg, dcfg.d32); ++ ++ DWC_DEBUGPL(DBG_PCDV, ++ "%s first_in_nextep_seq= %2d; nextep_seq[]:\n", ++ __func__, core_if->first_in_nextep_seq); ++ for (i=0; i <= core_if->dev_if->num_in_eps; i++) { ++ DWC_DEBUGPL(DBG_PCDV, "%2d\n", ++ core_if->nextep_seq[i]); ++ } ++ ++ } ++ ++ ++ DWC_WRITE_REG32(addr, depctl.d32); ++ DWC_DEBUGPL(DBG_PCDV, "DEPCTL=%08x\n", DWC_READ_REG32(addr)); ++ } ++ ++ /* Enable the Interrupt for this EP */ ++ if (core_if->multiproc_int_enable) { ++ if (ep->is_in == 1) { ++ diepmsk_data_t diepmsk = {.d32 = 0 }; ++ diepmsk.b.xfercompl = 1; ++ diepmsk.b.timeout = 1; ++ diepmsk.b.epdisabled = 1; ++ diepmsk.b.ahberr = 1; ++ diepmsk.b.intknepmis = 1; ++ if (!core_if->en_multiple_tx_fifo && core_if->dma_enable) ++ diepmsk.b.intknepmis = 0; ++ diepmsk.b.txfifoundrn = 1; //????? ++ if (ep->type == DWC_OTG_EP_TYPE_ISOC) { ++ diepmsk.b.nak = 1; ++ } ++ ++ ++ ++/* ++ if (core_if->dma_desc_enable) { ++ diepmsk.b.bna = 1; ++ } ++*/ ++/* ++ if (core_if->dma_enable) { ++ doepmsk.b.nak = 1; ++ } ++*/ ++ DWC_WRITE_REG32(&dev_if->dev_global_regs-> ++ diepeachintmsk[ep->num], diepmsk.d32); ++ ++ } else { ++ doepmsk_data_t doepmsk = {.d32 = 0 }; ++ doepmsk.b.xfercompl = 1; ++ doepmsk.b.ahberr = 1; ++ doepmsk.b.epdisabled = 1; ++ if (ep->type == DWC_OTG_EP_TYPE_ISOC) ++ doepmsk.b.outtknepdis = 1; ++ ++/* ++ ++ if (core_if->dma_desc_enable) { ++ doepmsk.b.bna = 1; ++ } ++*/ ++/* ++ doepmsk.b.babble = 1; ++ doepmsk.b.nyet = 1; ++ doepmsk.b.nak = 1; ++*/ ++ DWC_WRITE_REG32(&dev_if->dev_global_regs-> ++ doepeachintmsk[ep->num], doepmsk.d32); ++ } ++ DWC_MODIFY_REG32(&dev_if->dev_global_regs->deachintmsk, ++ 0, daintmsk.d32); ++ } else { ++ if (ep->type == DWC_OTG_EP_TYPE_ISOC) { ++ if (ep->is_in) { ++ diepmsk_data_t diepmsk = {.d32 = 0 }; ++ diepmsk.b.nak = 1; ++ DWC_MODIFY_REG32(&dev_if->dev_global_regs->diepmsk, 0, diepmsk.d32); ++ } else { ++ doepmsk_data_t doepmsk = {.d32 = 0 }; ++ doepmsk.b.outtknepdis = 1; ++ DWC_MODIFY_REG32(&dev_if->dev_global_regs->doepmsk, 0, doepmsk.d32); ++ } ++ } ++ DWC_MODIFY_REG32(&dev_if->dev_global_regs->daintmsk, ++ 0, daintmsk.d32); ++ } ++ ++ DWC_DEBUGPL(DBG_PCDV, "DAINTMSK=%0x\n", ++ DWC_READ_REG32(&dev_if->dev_global_regs->daintmsk)); ++ ++ ep->stall_clear_flag = 0; ++ ++ return; ++} ++ ++/** ++ * This function deactivates an EP. This is done by clearing the USB Active ++ * EP bit in the Device EP control register. Note: This function is not used ++ * for EP0. EP0 cannot be deactivated. ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ * @param ep The EP to deactivate. ++ */ ++void dwc_otg_ep_deactivate(dwc_otg_core_if_t * core_if, dwc_ep_t * ep) ++{ ++ depctl_data_t depctl = {.d32 = 0 }; ++ volatile uint32_t *addr; ++ daint_data_t daintmsk = {.d32 = 0 }; ++ dcfg_data_t dcfg; ++ uint8_t i = 0; ++ ++#ifdef DWC_UTE_PER_IO ++ ep->xiso_frame_num = 0xFFFFFFFF; ++ ep->xiso_active_xfers = 0; ++ ep->xiso_queued_xfers = 0; ++#endif ++ ++ /* Read DEPCTLn register */ ++ if (ep->is_in == 1) { ++ addr = &core_if->dev_if->in_ep_regs[ep->num]->diepctl; ++ daintmsk.ep.in = 1 << ep->num; ++ } else { ++ addr = &core_if->dev_if->out_ep_regs[ep->num]->doepctl; ++ daintmsk.ep.out = 1 << ep->num; ++ } ++ ++ depctl.d32 = DWC_READ_REG32(addr); ++ ++ depctl.b.usbactep = 0; ++ ++ /* Update nextep_seq array and EPMSCNT in DCFG*/ ++ if (!(depctl.b.eptype & 1) && ep->is_in == 1) { // NP EP IN ++ for (i = 0; i <= core_if->dev_if->num_in_eps; i++) { ++ if (core_if->nextep_seq[i] == ep->num) ++ break; ++ } ++ core_if->nextep_seq[i] = core_if->nextep_seq[ep->num]; ++ if (core_if->first_in_nextep_seq == ep->num) ++ core_if->first_in_nextep_seq = i; ++ core_if->nextep_seq[ep->num] = 0xff; ++ depctl.b.nextep = 0; ++ dcfg.d32 = ++ DWC_READ_REG32(&core_if->dev_if->dev_global_regs->dcfg); ++ dcfg.b.epmscnt--; ++ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->dcfg, ++ dcfg.d32); ++ ++ DWC_DEBUGPL(DBG_PCDV, ++ "%s first_in_nextep_seq= %2d; nextep_seq[]:\n", ++ __func__, core_if->first_in_nextep_seq); ++ for (i=0; i <= core_if->dev_if->num_in_eps; i++) { ++ DWC_DEBUGPL(DBG_PCDV, "%2d\n", core_if->nextep_seq[i]); ++ } ++ } ++ ++ if (ep->is_in == 1) ++ depctl.b.txfnum = 0; ++ ++ if (core_if->dma_desc_enable) ++ depctl.b.epdis = 1; ++ ++ DWC_WRITE_REG32(addr, depctl.d32); ++ depctl.d32 = DWC_READ_REG32(addr); ++ if (core_if->dma_enable && ep->type == DWC_OTG_EP_TYPE_ISOC ++ && depctl.b.epena) { ++ depctl_data_t depctl = {.d32 = 0}; ++ if (ep->is_in) { ++ diepint_data_t diepint = {.d32 = 0}; ++ ++ depctl.b.snak = 1; ++ DWC_WRITE_REG32(&core_if->dev_if->in_ep_regs[ep->num]-> ++ diepctl, depctl.d32); ++ do { ++ dwc_udelay(10); ++ diepint.d32 = ++ DWC_READ_REG32(&core_if-> ++ dev_if->in_ep_regs[ep->num]-> ++ diepint); ++ } while (!diepint.b.inepnakeff); ++ diepint.b.inepnakeff = 1; ++ DWC_WRITE_REG32(&core_if->dev_if->in_ep_regs[ep->num]-> ++ diepint, diepint.d32); ++ depctl.d32 = 0; ++ depctl.b.epdis = 1; ++ DWC_WRITE_REG32(&core_if->dev_if->in_ep_regs[ep->num]-> ++ diepctl, depctl.d32); ++ do { ++ dwc_udelay(10); ++ diepint.d32 = ++ DWC_READ_REG32(&core_if-> ++ dev_if->in_ep_regs[ep->num]-> ++ diepint); ++ } while (!diepint.b.epdisabled); ++ diepint.b.epdisabled = 1; ++ DWC_WRITE_REG32(&core_if->dev_if->in_ep_regs[ep->num]-> ++ diepint, diepint.d32); ++ } else { ++ dctl_data_t dctl = {.d32 = 0}; ++ gintmsk_data_t gintsts = {.d32 = 0}; ++ doepint_data_t doepint = {.d32 = 0}; ++ dctl.b.sgoutnak = 1; ++ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs-> ++ dctl, 0, dctl.d32); ++ do { ++ dwc_udelay(10); ++ gintsts.d32 = DWC_READ_REG32(&core_if->core_global_regs->gintsts); ++ } while (!gintsts.b.goutnakeff); ++ gintsts.d32 = 0; ++ gintsts.b.goutnakeff = 1; ++ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, gintsts.d32); ++ ++ depctl.d32 = 0; ++ depctl.b.epdis = 1; ++ depctl.b.snak = 1; ++ DWC_WRITE_REG32(&core_if->dev_if->out_ep_regs[ep->num]->doepctl, depctl.d32); ++ do ++ { ++ dwc_udelay(10); ++ doepint.d32 = DWC_READ_REG32(&core_if->dev_if-> ++ out_ep_regs[ep->num]->doepint); ++ } while (!doepint.b.epdisabled); ++ ++ doepint.b.epdisabled = 1; ++ DWC_WRITE_REG32(&core_if->dev_if->out_ep_regs[ep->num]->doepint, doepint.d32); ++ ++ dctl.d32 = 0; ++ dctl.b.cgoutnak = 1; ++ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs->dctl, 0, dctl.d32); ++ } ++ } ++ ++ /* Disable the Interrupt for this EP */ ++ if (core_if->multiproc_int_enable) { ++ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs->deachintmsk, ++ daintmsk.d32, 0); ++ ++ if (ep->is_in == 1) { ++ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs-> ++ diepeachintmsk[ep->num], 0); ++ } else { ++ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs-> ++ doepeachintmsk[ep->num], 0); ++ } ++ } else { ++ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs->daintmsk, ++ daintmsk.d32, 0); ++ } ++ ++} ++ ++/** ++ * This function initializes dma descriptor chain. ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ * @param ep The EP to start the transfer on. ++ */ ++static void init_dma_desc_chain(dwc_otg_core_if_t * core_if, dwc_ep_t * ep) ++{ ++ dwc_otg_dev_dma_desc_t *dma_desc; ++ uint32_t offset; ++ uint32_t xfer_est; ++ int i; ++ unsigned maxxfer_local, total_len; ++ ++ if (!ep->is_in && ep->type == DWC_OTG_EP_TYPE_INTR && ++ (ep->maxpacket%4)) { ++ maxxfer_local = ep->maxpacket; ++ total_len = ep->xfer_len; ++ } else { ++ maxxfer_local = ep->maxxfer; ++ total_len = ep->total_len; ++ } ++ ++ ep->desc_cnt = (total_len / maxxfer_local) + ++ ((total_len % maxxfer_local) ? 1 : 0); ++ ++ if (!ep->desc_cnt) ++ ep->desc_cnt = 1; ++ ++ if (ep->desc_cnt > MAX_DMA_DESC_CNT) ++ ep->desc_cnt = MAX_DMA_DESC_CNT; ++ ++ dma_desc = ep->desc_addr; ++ if (maxxfer_local == ep->maxpacket) { ++ if ((total_len % maxxfer_local) && ++ (total_len/maxxfer_local < MAX_DMA_DESC_CNT)) { ++ xfer_est = (ep->desc_cnt - 1) * maxxfer_local + ++ (total_len % maxxfer_local); ++ } else ++ xfer_est = ep->desc_cnt * maxxfer_local; ++ } else ++ xfer_est = total_len; ++ offset = 0; ++ for (i = 0; i < ep->desc_cnt; ++i) { ++ /** DMA Descriptor Setup */ ++ if (xfer_est > maxxfer_local) { ++ dma_desc->status.b.bs = BS_HOST_BUSY; ++ dma_desc->status.b.l = 0; ++ dma_desc->status.b.ioc = 0; ++ dma_desc->status.b.sp = 0; ++ dma_desc->status.b.bytes = maxxfer_local; ++ dma_desc->buf = ep->dma_addr + offset; ++ dma_desc->status.b.sts = 0; ++ dma_desc->status.b.bs = BS_HOST_READY; ++ ++ xfer_est -= maxxfer_local; ++ offset += maxxfer_local; ++ } else { ++ dma_desc->status.b.bs = BS_HOST_BUSY; ++ dma_desc->status.b.l = 1; ++ dma_desc->status.b.ioc = 1; ++ if (ep->is_in) { ++ dma_desc->status.b.sp = ++ (xfer_est % ++ ep->maxpacket) ? 1 : ((ep-> ++ sent_zlp) ? 1 : 0); ++ dma_desc->status.b.bytes = xfer_est; ++ } else { ++ if (maxxfer_local == ep->maxpacket) ++ dma_desc->status.b.bytes = xfer_est; ++ else ++ dma_desc->status.b.bytes = ++ xfer_est + ((4 - (xfer_est & 0x3)) & 0x3); ++ } ++ ++ dma_desc->buf = ep->dma_addr + offset; ++ dma_desc->status.b.sts = 0; ++ dma_desc->status.b.bs = BS_HOST_READY; ++ } ++ dma_desc++; ++ } ++} ++/** ++ * This function is called when to write ISOC data into appropriate dedicated ++ * periodic FIFO. ++ */ ++static int32_t write_isoc_tx_fifo(dwc_otg_core_if_t * core_if, dwc_ep_t * dwc_ep) ++{ ++ dwc_otg_dev_if_t *dev_if = core_if->dev_if; ++ dwc_otg_dev_in_ep_regs_t *ep_regs; ++ dtxfsts_data_t txstatus = {.d32 = 0 }; ++ uint32_t len = 0; ++ int epnum = dwc_ep->num; ++ int dwords; ++ ++ DWC_DEBUGPL(DBG_PCD, "Dedicated TxFifo Empty: %d \n", epnum); ++ ++ ep_regs = core_if->dev_if->in_ep_regs[epnum]; ++ ++ len = dwc_ep->xfer_len - dwc_ep->xfer_count; ++ ++ if (len > dwc_ep->maxpacket) { ++ len = dwc_ep->maxpacket; ++ } ++ ++ dwords = (len + 3) / 4; ++ ++ /* While there is space in the queue and space in the FIFO and ++ * More data to tranfer, Write packets to the Tx FIFO */ ++ txstatus.d32 = DWC_READ_REG32(&dev_if->in_ep_regs[epnum]->dtxfsts); ++ DWC_DEBUGPL(DBG_PCDV, "b4 dtxfsts[%d]=0x%08x\n", epnum, txstatus.d32); ++ ++ while (txstatus.b.txfspcavail > dwords && ++ dwc_ep->xfer_count < dwc_ep->xfer_len && dwc_ep->xfer_len != 0) { ++ /* Write the FIFO */ ++ dwc_otg_ep_write_packet(core_if, dwc_ep, 0); ++ ++ len = dwc_ep->xfer_len - dwc_ep->xfer_count; ++ if (len > dwc_ep->maxpacket) { ++ len = dwc_ep->maxpacket; ++ } ++ ++ dwords = (len + 3) / 4; ++ txstatus.d32 = ++ DWC_READ_REG32(&dev_if->in_ep_regs[epnum]->dtxfsts); ++ DWC_DEBUGPL(DBG_PCDV, "dtxfsts[%d]=0x%08x\n", epnum, ++ txstatus.d32); ++ } ++ ++ DWC_DEBUGPL(DBG_PCDV, "b4 dtxfsts[%d]=0x%08x\n", epnum, ++ DWC_READ_REG32(&dev_if->in_ep_regs[epnum]->dtxfsts)); ++ ++ return 1; ++} ++/** ++ * This function does the setup for a data transfer for an EP and ++ * starts the transfer. For an IN transfer, the packets will be ++ * loaded into the appropriate Tx FIFO in the ISR. For OUT transfers, ++ * the packets are unloaded from the Rx FIFO in the ISR. the ISR. ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ * @param ep The EP to start the transfer on. ++ */ ++ ++void dwc_otg_ep_start_transfer(dwc_otg_core_if_t * core_if, dwc_ep_t * ep) ++{ ++ depctl_data_t depctl; ++ deptsiz_data_t deptsiz; ++ gintmsk_data_t intr_mask = {.d32 = 0 }; ++ ++ DWC_DEBUGPL((DBG_PCDV | DBG_CILV), "%s()\n", __func__); ++ DWC_DEBUGPL(DBG_PCD, "ep%d-%s xfer_len=%d xfer_cnt=%d " ++ "xfer_buff=%p start_xfer_buff=%p, total_len = %d\n", ++ ep->num, (ep->is_in ? "IN" : "OUT"), ep->xfer_len, ++ ep->xfer_count, ep->xfer_buff, ep->start_xfer_buff, ++ ep->total_len); ++ /* IN endpoint */ ++ if (ep->is_in == 1) { ++ dwc_otg_dev_in_ep_regs_t *in_regs = ++ core_if->dev_if->in_ep_regs[ep->num]; ++ ++ gnptxsts_data_t gtxstatus; ++ ++ gtxstatus.d32 = ++ DWC_READ_REG32(&core_if->core_global_regs->gnptxsts); ++ ++ if (core_if->en_multiple_tx_fifo == 0 ++ && gtxstatus.b.nptxqspcavail == 0 && !core_if->dma_enable) { ++#ifdef DEBUG ++ DWC_PRINTF("TX Queue Full (0x%0x)\n", gtxstatus.d32); ++#endif ++ return; ++ } ++ ++ depctl.d32 = DWC_READ_REG32(&(in_regs->diepctl)); ++ deptsiz.d32 = DWC_READ_REG32(&(in_regs->dieptsiz)); ++ ++ if (ep->maxpacket > ep->maxxfer / MAX_PKT_CNT) ++ ep->xfer_len += (ep->maxxfer < (ep->total_len - ep->xfer_len)) ? ++ ep->maxxfer : (ep->total_len - ep->xfer_len); ++ else ++ ep->xfer_len += (MAX_PKT_CNT * ep->maxpacket < (ep->total_len - ep->xfer_len)) ? ++ MAX_PKT_CNT * ep->maxpacket : (ep->total_len - ep->xfer_len); ++ ++ ++ /* Zero Length Packet? */ ++ if ((ep->xfer_len - ep->xfer_count) == 0) { ++ deptsiz.b.xfersize = 0; ++ deptsiz.b.pktcnt = 1; ++ } else { ++ /* Program the transfer size and packet count ++ * as follows: xfersize = N * maxpacket + ++ * short_packet pktcnt = N + (short_packet ++ * exist ? 1 : 0) ++ */ ++ deptsiz.b.xfersize = ep->xfer_len - ep->xfer_count; ++ deptsiz.b.pktcnt = ++ (ep->xfer_len - ep->xfer_count - 1 + ++ ep->maxpacket) / ep->maxpacket; ++ if (deptsiz.b.pktcnt > MAX_PKT_CNT) { ++ deptsiz.b.pktcnt = MAX_PKT_CNT; ++ deptsiz.b.xfersize = deptsiz.b.pktcnt * ep->maxpacket; ++ } ++ if (ep->type == DWC_OTG_EP_TYPE_ISOC) ++ deptsiz.b.mc = deptsiz.b.pktcnt; ++ } ++ ++ /* Write the DMA register */ ++ if (core_if->dma_enable) { ++ if (core_if->dma_desc_enable == 0) { ++ if (ep->type != DWC_OTG_EP_TYPE_ISOC) ++ deptsiz.b.mc = 1; ++ DWC_WRITE_REG32(&in_regs->dieptsiz, ++ deptsiz.d32); ++ DWC_WRITE_REG32(&(in_regs->diepdma), ++ (uint32_t) ep->dma_addr); ++ } else { ++#ifdef DWC_UTE_CFI ++ /* The descriptor chain should be already initialized by now */ ++ if (ep->buff_mode != BM_STANDARD) { ++ DWC_WRITE_REG32(&in_regs->diepdma, ++ ep->descs_dma_addr); ++ } else { ++#endif ++ init_dma_desc_chain(core_if, ep); ++ /** DIEPDMAn Register write */ ++ DWC_WRITE_REG32(&in_regs->diepdma, ++ ep->dma_desc_addr); ++#ifdef DWC_UTE_CFI ++ } ++#endif ++ } ++ } else { ++ DWC_WRITE_REG32(&in_regs->dieptsiz, deptsiz.d32); ++ if (ep->type != DWC_OTG_EP_TYPE_ISOC) { ++ /** ++ * Enable the Non-Periodic Tx FIFO empty interrupt, ++ * or the Tx FIFO epmty interrupt in dedicated Tx FIFO mode, ++ * the data will be written into the fifo by the ISR. ++ */ ++ if (core_if->en_multiple_tx_fifo == 0) { ++ intr_mask.b.nptxfempty = 1; ++ DWC_MODIFY_REG32 ++ (&core_if->core_global_regs->gintmsk, ++ intr_mask.d32, intr_mask.d32); ++ } else { ++ /* Enable the Tx FIFO Empty Interrupt for this EP */ ++ if (ep->xfer_len > 0) { ++ uint32_t fifoemptymsk = 0; ++ fifoemptymsk = 1 << ep->num; ++ DWC_MODIFY_REG32 ++ (&core_if->dev_if->dev_global_regs->dtknqr4_fifoemptymsk, ++ 0, fifoemptymsk); ++ ++ } ++ } ++ } else { ++ write_isoc_tx_fifo(core_if, ep); ++ } ++ } ++ if (!core_if->core_params->en_multiple_tx_fifo && core_if->dma_enable) ++ depctl.b.nextep = core_if->nextep_seq[ep->num]; ++ ++ if (ep->type == DWC_OTG_EP_TYPE_ISOC) { ++ dsts_data_t dsts = {.d32 = 0}; ++ if (ep->bInterval == 1) { ++ dsts.d32 = ++ DWC_READ_REG32(&core_if->dev_if-> ++ dev_global_regs->dsts); ++ ep->frame_num = dsts.b.soffn + ep->bInterval; ++ if (ep->frame_num > 0x3FFF) { ++ ep->frm_overrun = 1; ++ ep->frame_num &= 0x3FFF; ++ } else ++ ep->frm_overrun = 0; ++ if (ep->frame_num & 0x1) { ++ depctl.b.setd1pid = 1; ++ } else { ++ depctl.b.setd0pid = 1; ++ } ++ } ++ } ++ /* EP enable, IN data in FIFO */ ++ depctl.b.cnak = 1; ++ depctl.b.epena = 1; ++ DWC_WRITE_REG32(&in_regs->diepctl, depctl.d32); ++ ++ } else { ++ /* OUT endpoint */ ++ dwc_otg_dev_out_ep_regs_t *out_regs = ++ core_if->dev_if->out_ep_regs[ep->num]; ++ ++ depctl.d32 = DWC_READ_REG32(&(out_regs->doepctl)); ++ deptsiz.d32 = DWC_READ_REG32(&(out_regs->doeptsiz)); ++ ++ if (!core_if->dma_desc_enable) { ++ if (ep->maxpacket > ep->maxxfer / MAX_PKT_CNT) ++ ep->xfer_len += (ep->maxxfer < (ep->total_len - ep->xfer_len)) ? ++ ep->maxxfer : (ep->total_len - ep->xfer_len); ++ else ++ ep->xfer_len += (MAX_PKT_CNT * ep->maxpacket < (ep->total_len ++ - ep->xfer_len)) ? MAX_PKT_CNT * ep->maxpacket : (ep->total_len - ep->xfer_len); ++ } ++ ++ /* Program the transfer size and packet count as follows: ++ * ++ * pktcnt = N ++ * xfersize = N * maxpacket ++ */ ++ if ((ep->xfer_len - ep->xfer_count) == 0) { ++ /* Zero Length Packet */ ++ deptsiz.b.xfersize = ep->maxpacket; ++ deptsiz.b.pktcnt = 1; ++ } else { ++ deptsiz.b.pktcnt = ++ (ep->xfer_len - ep->xfer_count + ++ (ep->maxpacket - 1)) / ep->maxpacket; ++ if (deptsiz.b.pktcnt > MAX_PKT_CNT) { ++ deptsiz.b.pktcnt = MAX_PKT_CNT; ++ } ++ if (!core_if->dma_desc_enable) { ++ ep->xfer_len = ++ deptsiz.b.pktcnt * ep->maxpacket + ep->xfer_count; ++ } ++ deptsiz.b.xfersize = ep->xfer_len - ep->xfer_count; ++ } ++ ++ DWC_DEBUGPL(DBG_PCDV, "ep%d xfersize=%d pktcnt=%d\n", ++ ep->num, deptsiz.b.xfersize, deptsiz.b.pktcnt); ++ ++ if (core_if->dma_enable) { ++ if (!core_if->dma_desc_enable) { ++ DWC_WRITE_REG32(&out_regs->doeptsiz, ++ deptsiz.d32); ++ ++ DWC_WRITE_REG32(&(out_regs->doepdma), ++ (uint32_t) ep->dma_addr); ++ } else { ++#ifdef DWC_UTE_CFI ++ /* The descriptor chain should be already initialized by now */ ++ if (ep->buff_mode != BM_STANDARD) { ++ DWC_WRITE_REG32(&out_regs->doepdma, ++ ep->descs_dma_addr); ++ } else { ++#endif ++ /** This is used for interrupt out transfers*/ ++ if (!ep->xfer_len) ++ ep->xfer_len = ep->total_len; ++ init_dma_desc_chain(core_if, ep); ++ ++ if (core_if->core_params->dev_out_nak) { ++ if (ep->type == DWC_OTG_EP_TYPE_BULK) { ++ deptsiz.b.pktcnt = (ep->total_len + ++ (ep->maxpacket - 1)) / ep->maxpacket; ++ deptsiz.b.xfersize = ep->total_len; ++ /* Remember initial value of doeptsiz */ ++ core_if->start_doeptsiz_val[ep->num] = deptsiz.d32; ++ DWC_WRITE_REG32(&out_regs->doeptsiz, ++ deptsiz.d32); ++ } ++ } ++ /** DOEPDMAn Register write */ ++ DWC_WRITE_REG32(&out_regs->doepdma, ++ ep->dma_desc_addr); ++#ifdef DWC_UTE_CFI ++ } ++#endif ++ } ++ } else { ++ DWC_WRITE_REG32(&out_regs->doeptsiz, deptsiz.d32); ++ } ++ ++ if (ep->type == DWC_OTG_EP_TYPE_ISOC) { ++ dsts_data_t dsts = {.d32 = 0}; ++ if (ep->bInterval == 1) { ++ dsts.d32 = ++ DWC_READ_REG32(&core_if->dev_if-> ++ dev_global_regs->dsts); ++ ep->frame_num = dsts.b.soffn + ep->bInterval; ++ if (ep->frame_num > 0x3FFF) { ++ ep->frm_overrun = 1; ++ ep->frame_num &= 0x3FFF; ++ } else ++ ep->frm_overrun = 0; ++ ++ if (ep->frame_num & 0x1) { ++ depctl.b.setd1pid = 1; ++ } else { ++ depctl.b.setd0pid = 1; ++ } ++ } ++ } ++ ++ /* EP enable */ ++ depctl.b.cnak = 1; ++ depctl.b.epena = 1; ++ ++ DWC_WRITE_REG32(&out_regs->doepctl, depctl.d32); ++ ++ DWC_DEBUGPL(DBG_PCD, "DOEPCTL=%08x DOEPTSIZ=%08x\n", ++ DWC_READ_REG32(&out_regs->doepctl), ++ DWC_READ_REG32(&out_regs->doeptsiz)); ++ DWC_DEBUGPL(DBG_PCD, "DAINTMSK=%08x GINTMSK=%08x\n", ++ DWC_READ_REG32(&core_if->dev_if->dev_global_regs-> ++ daintmsk), ++ DWC_READ_REG32(&core_if->core_global_regs-> ++ gintmsk)); ++ ++ /* Timer is scheduling only for out bulk transfers for ++ * "Device DDMA OUT NAK Enhancement" feature to inform user ++ * about received data payload in case of timeout ++ */ ++ if (core_if->core_params->dev_out_nak) { ++ if (ep->type == DWC_OTG_EP_TYPE_BULK) { ++ core_if->ep_xfer_info[ep->num].core_if = core_if; ++ core_if->ep_xfer_info[ep->num].ep = ep; ++ core_if->ep_xfer_info[ep->num].state = 1; ++ ++ /* Start a timer for this transfer. */ ++ DWC_TIMER_SCHEDULE(core_if->ep_xfer_timer[ep->num], 10000); ++ } ++ } ++ } ++} ++ ++/** ++ * This function setup a zero length transfer in Buffer DMA and ++ * Slave modes for usb requests with zero field set ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ * @param ep The EP to start the transfer on. ++ * ++ */ ++void dwc_otg_ep_start_zl_transfer(dwc_otg_core_if_t * core_if, dwc_ep_t * ep) ++{ ++ ++ depctl_data_t depctl; ++ deptsiz_data_t deptsiz; ++ gintmsk_data_t intr_mask = {.d32 = 0 }; ++ ++ DWC_DEBUGPL((DBG_PCDV | DBG_CILV), "%s()\n", __func__); ++ DWC_PRINTF("zero length transfer is called\n"); ++ ++ /* IN endpoint */ ++ if (ep->is_in == 1) { ++ dwc_otg_dev_in_ep_regs_t *in_regs = ++ core_if->dev_if->in_ep_regs[ep->num]; ++ ++ depctl.d32 = DWC_READ_REG32(&(in_regs->diepctl)); ++ deptsiz.d32 = DWC_READ_REG32(&(in_regs->dieptsiz)); ++ ++ deptsiz.b.xfersize = 0; ++ deptsiz.b.pktcnt = 1; ++ ++ /* Write the DMA register */ ++ if (core_if->dma_enable) { ++ if (core_if->dma_desc_enable == 0) { ++ deptsiz.b.mc = 1; ++ DWC_WRITE_REG32(&in_regs->dieptsiz, ++ deptsiz.d32); ++ DWC_WRITE_REG32(&(in_regs->diepdma), ++ (uint32_t) ep->dma_addr); ++ } ++ } else { ++ DWC_WRITE_REG32(&in_regs->dieptsiz, deptsiz.d32); ++ /** ++ * Enable the Non-Periodic Tx FIFO empty interrupt, ++ * or the Tx FIFO epmty interrupt in dedicated Tx FIFO mode, ++ * the data will be written into the fifo by the ISR. ++ */ ++ if (core_if->en_multiple_tx_fifo == 0) { ++ intr_mask.b.nptxfempty = 1; ++ DWC_MODIFY_REG32(&core_if-> ++ core_global_regs->gintmsk, ++ intr_mask.d32, intr_mask.d32); ++ } else { ++ /* Enable the Tx FIFO Empty Interrupt for this EP */ ++ if (ep->xfer_len > 0) { ++ uint32_t fifoemptymsk = 0; ++ fifoemptymsk = 1 << ep->num; ++ DWC_MODIFY_REG32(&core_if-> ++ dev_if->dev_global_regs->dtknqr4_fifoemptymsk, ++ 0, fifoemptymsk); ++ } ++ } ++ } ++ ++ if (!core_if->core_params->en_multiple_tx_fifo && core_if->dma_enable) ++ depctl.b.nextep = core_if->nextep_seq[ep->num]; ++ /* EP enable, IN data in FIFO */ ++ depctl.b.cnak = 1; ++ depctl.b.epena = 1; ++ DWC_WRITE_REG32(&in_regs->diepctl, depctl.d32); ++ ++ } else { ++ /* OUT endpoint */ ++ dwc_otg_dev_out_ep_regs_t *out_regs = ++ core_if->dev_if->out_ep_regs[ep->num]; ++ ++ depctl.d32 = DWC_READ_REG32(&(out_regs->doepctl)); ++ deptsiz.d32 = DWC_READ_REG32(&(out_regs->doeptsiz)); ++ ++ /* Zero Length Packet */ ++ deptsiz.b.xfersize = ep->maxpacket; ++ deptsiz.b.pktcnt = 1; ++ ++ if (core_if->dma_enable) { ++ if (!core_if->dma_desc_enable) { ++ DWC_WRITE_REG32(&out_regs->doeptsiz, ++ deptsiz.d32); ++ ++ DWC_WRITE_REG32(&(out_regs->doepdma), ++ (uint32_t) ep->dma_addr); ++ } ++ } else { ++ DWC_WRITE_REG32(&out_regs->doeptsiz, deptsiz.d32); ++ } ++ ++ /* EP enable */ ++ depctl.b.cnak = 1; ++ depctl.b.epena = 1; ++ ++ DWC_WRITE_REG32(&out_regs->doepctl, depctl.d32); ++ ++ } ++} ++ ++/** ++ * This function does the setup for a data transfer for EP0 and starts ++ * the transfer. For an IN transfer, the packets will be loaded into ++ * the appropriate Tx FIFO in the ISR. For OUT transfers, the packets are ++ * unloaded from the Rx FIFO in the ISR. ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ * @param ep The EP0 data. ++ */ ++void dwc_otg_ep0_start_transfer(dwc_otg_core_if_t * core_if, dwc_ep_t * ep) ++{ ++ depctl_data_t depctl; ++ deptsiz0_data_t deptsiz; ++ gintmsk_data_t intr_mask = {.d32 = 0 }; ++ dwc_otg_dev_dma_desc_t *dma_desc; ++ ++ DWC_DEBUGPL(DBG_PCD, "ep%d-%s xfer_len=%d xfer_cnt=%d " ++ "xfer_buff=%p start_xfer_buff=%p \n", ++ ep->num, (ep->is_in ? "IN" : "OUT"), ep->xfer_len, ++ ep->xfer_count, ep->xfer_buff, ep->start_xfer_buff); ++ ++ ep->total_len = ep->xfer_len; ++ ++ /* IN endpoint */ ++ if (ep->is_in == 1) { ++ dwc_otg_dev_in_ep_regs_t *in_regs = ++ core_if->dev_if->in_ep_regs[0]; ++ ++ gnptxsts_data_t gtxstatus; ++ ++ if (core_if->snpsid >= OTG_CORE_REV_3_00a) { ++ depctl.d32 = DWC_READ_REG32(&in_regs->diepctl); ++ if (depctl.b.epena) ++ return; ++ } ++ ++ gtxstatus.d32 = ++ DWC_READ_REG32(&core_if->core_global_regs->gnptxsts); ++ ++ /* If dedicated FIFO every time flush fifo before enable ep*/ ++ if (core_if->en_multiple_tx_fifo && core_if->snpsid >= OTG_CORE_REV_3_00a) ++ dwc_otg_flush_tx_fifo(core_if, ep->tx_fifo_num); ++ ++ if (core_if->en_multiple_tx_fifo == 0 ++ && gtxstatus.b.nptxqspcavail == 0 ++ && !core_if->dma_enable) { ++#ifdef DEBUG ++ deptsiz.d32 = DWC_READ_REG32(&in_regs->dieptsiz); ++ DWC_DEBUGPL(DBG_PCD, "DIEPCTL0=%0x\n", ++ DWC_READ_REG32(&in_regs->diepctl)); ++ DWC_DEBUGPL(DBG_PCD, "DIEPTSIZ0=%0x (sz=%d, pcnt=%d)\n", ++ deptsiz.d32, ++ deptsiz.b.xfersize, deptsiz.b.pktcnt); ++ DWC_PRINTF("TX Queue or FIFO Full (0x%0x)\n", ++ gtxstatus.d32); ++#endif ++ return; ++ } ++ ++ depctl.d32 = DWC_READ_REG32(&in_regs->diepctl); ++ deptsiz.d32 = DWC_READ_REG32(&in_regs->dieptsiz); ++ ++ /* Zero Length Packet? */ ++ if (ep->xfer_len == 0) { ++ deptsiz.b.xfersize = 0; ++ deptsiz.b.pktcnt = 1; ++ } else { ++ /* Program the transfer size and packet count ++ * as follows: xfersize = N * maxpacket + ++ * short_packet pktcnt = N + (short_packet ++ * exist ? 1 : 0) ++ */ ++ if (ep->xfer_len > ep->maxpacket) { ++ ep->xfer_len = ep->maxpacket; ++ deptsiz.b.xfersize = ep->maxpacket; ++ } else { ++ deptsiz.b.xfersize = ep->xfer_len; ++ } ++ deptsiz.b.pktcnt = 1; ++ ++ } ++ DWC_DEBUGPL(DBG_PCDV, ++ "IN len=%d xfersize=%d pktcnt=%d [%08x]\n", ++ ep->xfer_len, deptsiz.b.xfersize, deptsiz.b.pktcnt, ++ deptsiz.d32); ++ ++ /* Write the DMA register */ ++ if (core_if->dma_enable) { ++ if (core_if->dma_desc_enable == 0) { ++ DWC_WRITE_REG32(&in_regs->dieptsiz, ++ deptsiz.d32); ++ ++ DWC_WRITE_REG32(&(in_regs->diepdma), ++ (uint32_t) ep->dma_addr); ++ } else { ++ dma_desc = core_if->dev_if->in_desc_addr; ++ ++ /** DMA Descriptor Setup */ ++ dma_desc->status.b.bs = BS_HOST_BUSY; ++ dma_desc->status.b.l = 1; ++ dma_desc->status.b.ioc = 1; ++ dma_desc->status.b.sp = ++ (ep->xfer_len == ep->maxpacket) ? 0 : 1; ++ dma_desc->status.b.bytes = ep->xfer_len; ++ dma_desc->buf = ep->dma_addr; ++ dma_desc->status.b.sts = 0; ++ dma_desc->status.b.bs = BS_HOST_READY; ++ ++ /** DIEPDMA0 Register write */ ++ DWC_WRITE_REG32(&in_regs->diepdma, ++ core_if-> ++ dev_if->dma_in_desc_addr); ++ } ++ } else { ++ DWC_WRITE_REG32(&in_regs->dieptsiz, deptsiz.d32); ++ } ++ ++ if (!core_if->core_params->en_multiple_tx_fifo && core_if->dma_enable) ++ depctl.b.nextep = core_if->nextep_seq[ep->num]; ++ /* EP enable, IN data in FIFO */ ++ depctl.b.cnak = 1; ++ depctl.b.epena = 1; ++ DWC_WRITE_REG32(&in_regs->diepctl, depctl.d32); ++ ++ /** ++ * Enable the Non-Periodic Tx FIFO empty interrupt, the ++ * data will be written into the fifo by the ISR. ++ */ ++ if (!core_if->dma_enable) { ++ if (core_if->en_multiple_tx_fifo == 0) { ++ intr_mask.b.nptxfempty = 1; ++ DWC_MODIFY_REG32(&core_if-> ++ core_global_regs->gintmsk, ++ intr_mask.d32, intr_mask.d32); ++ } else { ++ /* Enable the Tx FIFO Empty Interrupt for this EP */ ++ if (ep->xfer_len > 0) { ++ uint32_t fifoemptymsk = 0; ++ fifoemptymsk |= 1 << ep->num; ++ DWC_MODIFY_REG32(&core_if-> ++ dev_if->dev_global_regs->dtknqr4_fifoemptymsk, ++ 0, fifoemptymsk); ++ } ++ } ++ } ++ } else { ++ /* OUT endpoint */ ++ dwc_otg_dev_out_ep_regs_t *out_regs = ++ core_if->dev_if->out_ep_regs[0]; ++ ++ depctl.d32 = DWC_READ_REG32(&out_regs->doepctl); ++ deptsiz.d32 = DWC_READ_REG32(&out_regs->doeptsiz); ++ ++ /* Program the transfer size and packet count as follows: ++ * xfersize = N * (maxpacket + 4 - (maxpacket % 4)) ++ * pktcnt = N */ ++ /* Zero Length Packet */ ++ deptsiz.b.xfersize = ep->maxpacket; ++ deptsiz.b.pktcnt = 1; ++ if (core_if->snpsid >= OTG_CORE_REV_3_00a) ++ deptsiz.b.supcnt = 3; ++ ++ DWC_DEBUGPL(DBG_PCDV, "len=%d xfersize=%d pktcnt=%d\n", ++ ep->xfer_len, deptsiz.b.xfersize, deptsiz.b.pktcnt); ++ ++ if (core_if->dma_enable) { ++ if (!core_if->dma_desc_enable) { ++ DWC_WRITE_REG32(&out_regs->doeptsiz, ++ deptsiz.d32); ++ ++ DWC_WRITE_REG32(&(out_regs->doepdma), ++ (uint32_t) ep->dma_addr); ++ } else { ++ dma_desc = core_if->dev_if->out_desc_addr; ++ ++ /** DMA Descriptor Setup */ ++ dma_desc->status.b.bs = BS_HOST_BUSY; ++ if (core_if->snpsid >= OTG_CORE_REV_3_00a) { ++ dma_desc->status.b.mtrf = 0; ++ dma_desc->status.b.sr = 0; ++ } ++ dma_desc->status.b.l = 1; ++ dma_desc->status.b.ioc = 1; ++ dma_desc->status.b.bytes = ep->maxpacket; ++ dma_desc->buf = ep->dma_addr; ++ dma_desc->status.b.sts = 0; ++ dma_desc->status.b.bs = BS_HOST_READY; ++ ++ /** DOEPDMA0 Register write */ ++ DWC_WRITE_REG32(&out_regs->doepdma, ++ core_if->dev_if-> ++ dma_out_desc_addr); ++ } ++ } else { ++ DWC_WRITE_REG32(&out_regs->doeptsiz, deptsiz.d32); ++ } ++ ++ /* EP enable */ ++ depctl.b.cnak = 1; ++ depctl.b.epena = 1; ++ DWC_WRITE_REG32(&(out_regs->doepctl), depctl.d32); ++ } ++} ++ ++/** ++ * This function continues control IN transfers started by ++ * dwc_otg_ep0_start_transfer, when the transfer does not fit in a ++ * single packet. NOTE: The DIEPCTL0/DOEPCTL0 registers only have one ++ * bit for the packet count. ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ * @param ep The EP0 data. ++ */ ++void dwc_otg_ep0_continue_transfer(dwc_otg_core_if_t * core_if, dwc_ep_t * ep) ++{ ++ depctl_data_t depctl; ++ deptsiz0_data_t deptsiz; ++ gintmsk_data_t intr_mask = {.d32 = 0 }; ++ dwc_otg_dev_dma_desc_t *dma_desc; ++ ++ if (ep->is_in == 1) { ++ dwc_otg_dev_in_ep_regs_t *in_regs = ++ core_if->dev_if->in_ep_regs[0]; ++ gnptxsts_data_t tx_status = {.d32 = 0 }; ++ ++ tx_status.d32 = ++ DWC_READ_REG32(&core_if->core_global_regs->gnptxsts); ++ /** @todo Should there be check for room in the Tx ++ * Status Queue. If not remove the code above this comment. */ ++ ++ depctl.d32 = DWC_READ_REG32(&in_regs->diepctl); ++ deptsiz.d32 = DWC_READ_REG32(&in_regs->dieptsiz); ++ ++ /* Program the transfer size and packet count ++ * as follows: xfersize = N * maxpacket + ++ * short_packet pktcnt = N + (short_packet ++ * exist ? 1 : 0) ++ */ ++ ++ if (core_if->dma_desc_enable == 0) { ++ deptsiz.b.xfersize = ++ (ep->total_len - ep->xfer_count) > ++ ep->maxpacket ? ep->maxpacket : (ep->total_len - ++ ep->xfer_count); ++ deptsiz.b.pktcnt = 1; ++ if (core_if->dma_enable == 0) { ++ ep->xfer_len += deptsiz.b.xfersize; ++ } else { ++ ep->xfer_len = deptsiz.b.xfersize; ++ } ++ DWC_WRITE_REG32(&in_regs->dieptsiz, deptsiz.d32); ++ } else { ++ ep->xfer_len = ++ (ep->total_len - ep->xfer_count) > ++ ep->maxpacket ? ep->maxpacket : (ep->total_len - ++ ep->xfer_count); ++ ++ dma_desc = core_if->dev_if->in_desc_addr; ++ ++ /** DMA Descriptor Setup */ ++ dma_desc->status.b.bs = BS_HOST_BUSY; ++ dma_desc->status.b.l = 1; ++ dma_desc->status.b.ioc = 1; ++ dma_desc->status.b.sp = ++ (ep->xfer_len == ep->maxpacket) ? 0 : 1; ++ dma_desc->status.b.bytes = ep->xfer_len; ++ dma_desc->buf = ep->dma_addr; ++ dma_desc->status.b.sts = 0; ++ dma_desc->status.b.bs = BS_HOST_READY; ++ ++ /** DIEPDMA0 Register write */ ++ DWC_WRITE_REG32(&in_regs->diepdma, ++ core_if->dev_if->dma_in_desc_addr); ++ } ++ ++ DWC_DEBUGPL(DBG_PCDV, ++ "IN len=%d xfersize=%d pktcnt=%d [%08x]\n", ++ ep->xfer_len, deptsiz.b.xfersize, deptsiz.b.pktcnt, ++ deptsiz.d32); ++ ++ /* Write the DMA register */ ++ if (core_if->hwcfg2.b.architecture == DWC_INT_DMA_ARCH) { ++ if (core_if->dma_desc_enable == 0) ++ DWC_WRITE_REG32(&(in_regs->diepdma), ++ (uint32_t) ep->dma_addr); ++ } ++ if (!core_if->core_params->en_multiple_tx_fifo && core_if->dma_enable) ++ depctl.b.nextep = core_if->nextep_seq[ep->num]; ++ /* EP enable, IN data in FIFO */ ++ depctl.b.cnak = 1; ++ depctl.b.epena = 1; ++ DWC_WRITE_REG32(&in_regs->diepctl, depctl.d32); ++ ++ /** ++ * Enable the Non-Periodic Tx FIFO empty interrupt, the ++ * data will be written into the fifo by the ISR. ++ */ ++ if (!core_if->dma_enable) { ++ if (core_if->en_multiple_tx_fifo == 0) { ++ /* First clear it from GINTSTS */ ++ intr_mask.b.nptxfempty = 1; ++ DWC_MODIFY_REG32(&core_if-> ++ core_global_regs->gintmsk, ++ intr_mask.d32, intr_mask.d32); ++ ++ } else { ++ /* Enable the Tx FIFO Empty Interrupt for this EP */ ++ if (ep->xfer_len > 0) { ++ uint32_t fifoemptymsk = 0; ++ fifoemptymsk |= 1 << ep->num; ++ DWC_MODIFY_REG32(&core_if-> ++ dev_if->dev_global_regs->dtknqr4_fifoemptymsk, ++ 0, fifoemptymsk); ++ } ++ } ++ } ++ } else { ++ dwc_otg_dev_out_ep_regs_t *out_regs = ++ core_if->dev_if->out_ep_regs[0]; ++ ++ depctl.d32 = DWC_READ_REG32(&out_regs->doepctl); ++ deptsiz.d32 = DWC_READ_REG32(&out_regs->doeptsiz); ++ ++ /* Program the transfer size and packet count ++ * as follows: xfersize = N * maxpacket + ++ * short_packet pktcnt = N + (short_packet ++ * exist ? 1 : 0) ++ */ ++ deptsiz.b.xfersize = ep->maxpacket; ++ deptsiz.b.pktcnt = 1; ++ ++ if (core_if->dma_desc_enable == 0) { ++ DWC_WRITE_REG32(&out_regs->doeptsiz, deptsiz.d32); ++ } else { ++ dma_desc = core_if->dev_if->out_desc_addr; ++ ++ /** DMA Descriptor Setup */ ++ dma_desc->status.b.bs = BS_HOST_BUSY; ++ dma_desc->status.b.l = 1; ++ dma_desc->status.b.ioc = 1; ++ dma_desc->status.b.bytes = ep->maxpacket; ++ dma_desc->buf = ep->dma_addr; ++ dma_desc->status.b.sts = 0; ++ dma_desc->status.b.bs = BS_HOST_READY; ++ ++ /** DOEPDMA0 Register write */ ++ DWC_WRITE_REG32(&out_regs->doepdma, ++ core_if->dev_if->dma_out_desc_addr); ++ } ++ ++ DWC_DEBUGPL(DBG_PCDV, ++ "IN len=%d xfersize=%d pktcnt=%d [%08x]\n", ++ ep->xfer_len, deptsiz.b.xfersize, deptsiz.b.pktcnt, ++ deptsiz.d32); ++ ++ /* Write the DMA register */ ++ if (core_if->hwcfg2.b.architecture == DWC_INT_DMA_ARCH) { ++ if (core_if->dma_desc_enable == 0) ++ DWC_WRITE_REG32(&(out_regs->doepdma), ++ (uint32_t) ep->dma_addr); ++ ++ } ++ ++ /* EP enable, IN data in FIFO */ ++ depctl.b.cnak = 1; ++ depctl.b.epena = 1; ++ DWC_WRITE_REG32(&out_regs->doepctl, depctl.d32); ++ ++ } ++} ++ ++#ifdef DEBUG ++void dump_msg(const u8 * buf, unsigned int length) ++{ ++ unsigned int start, num, i; ++ char line[52], *p; ++ ++ if (length >= 512) ++ return; ++ start = 0; ++ while (length > 0) { ++ num = length < 16u ? length : 16u; ++ p = line; ++ for (i = 0; i < num; ++i) { ++ if (i == 8) ++ *p++ = ' '; ++ DWC_SPRINTF(p, " %02x", buf[i]); ++ p += 3; ++ } ++ *p = 0; ++ DWC_PRINTF("%6x: %s\n", start, line); ++ buf += num; ++ start += num; ++ length -= num; ++ } ++} ++#else ++static inline void dump_msg(const u8 * buf, unsigned int length) ++{ ++} ++#endif ++ ++/** ++ * This function writes a packet into the Tx FIFO associated with the ++ * EP. For non-periodic EPs the non-periodic Tx FIFO is written. For ++ * periodic EPs the periodic Tx FIFO associated with the EP is written ++ * with all packets for the next micro-frame. ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ * @param ep The EP to write packet for. ++ * @param dma Indicates if DMA is being used. ++ */ ++void dwc_otg_ep_write_packet(dwc_otg_core_if_t * core_if, dwc_ep_t * ep, ++ int dma) ++{ ++ /** ++ * The buffer is padded to DWORD on a per packet basis in ++ * slave/dma mode if the MPS is not DWORD aligned. The last ++ * packet, if short, is also padded to a multiple of DWORD. ++ * ++ * ep->xfer_buff always starts DWORD aligned in memory and is a ++ * multiple of DWORD in length ++ * ++ * ep->xfer_len can be any number of bytes ++ * ++ * ep->xfer_count is a multiple of ep->maxpacket until the last ++ * packet ++ * ++ * FIFO access is DWORD */ ++ ++ uint32_t i; ++ uint32_t byte_count; ++ uint32_t dword_count; ++ uint32_t *fifo; ++ uint32_t *data_buff = (uint32_t *) ep->xfer_buff; ++ ++ DWC_DEBUGPL((DBG_PCDV | DBG_CILV), "%s(%p,%p)\n", __func__, core_if, ++ ep); ++ if (ep->xfer_count >= ep->xfer_len) { ++ DWC_WARN("%s() No data for EP%d!!!\n", __func__, ep->num); ++ return; ++ } ++ ++ /* Find the byte length of the packet either short packet or MPS */ ++ if ((ep->xfer_len - ep->xfer_count) < ep->maxpacket) { ++ byte_count = ep->xfer_len - ep->xfer_count; ++ } else { ++ byte_count = ep->maxpacket; ++ } ++ ++ /* Find the DWORD length, padded by extra bytes as neccessary if MPS ++ * is not a multiple of DWORD */ ++ dword_count = (byte_count + 3) / 4; ++ ++#ifdef VERBOSE ++ dump_msg(ep->xfer_buff, byte_count); ++#endif ++ ++ /**@todo NGS Where are the Periodic Tx FIFO addresses ++ * intialized? What should this be? */ ++ ++ fifo = core_if->data_fifo[ep->num]; ++ ++ DWC_DEBUGPL((DBG_PCDV | DBG_CILV), "fifo=%p buff=%p *p=%08x bc=%d\n", ++ fifo, data_buff, *data_buff, byte_count); ++ ++ if (!dma) { ++ for (i = 0; i < dword_count; i++, data_buff++) { ++ DWC_WRITE_REG32(fifo, *data_buff); ++ } ++ } ++ ++ ep->xfer_count += byte_count; ++ ep->xfer_buff += byte_count; ++ ep->dma_addr += byte_count; ++} ++ ++/** ++ * Set the EP STALL. ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ * @param ep The EP to set the stall on. ++ */ ++void dwc_otg_ep_set_stall(dwc_otg_core_if_t * core_if, dwc_ep_t * ep) ++{ ++ depctl_data_t depctl; ++ volatile uint32_t *depctl_addr; ++ ++ DWC_DEBUGPL(DBG_PCD, "%s ep%d-%s\n", __func__, ep->num, ++ (ep->is_in ? "IN" : "OUT")); ++ ++ if (ep->is_in == 1) { ++ depctl_addr = &(core_if->dev_if->in_ep_regs[ep->num]->diepctl); ++ depctl.d32 = DWC_READ_REG32(depctl_addr); ++ ++ /* set the disable and stall bits */ ++ if (depctl.b.epena) { ++ depctl.b.epdis = 1; ++ } ++ depctl.b.stall = 1; ++ DWC_WRITE_REG32(depctl_addr, depctl.d32); ++ } else { ++ depctl_addr = &(core_if->dev_if->out_ep_regs[ep->num]->doepctl); ++ depctl.d32 = DWC_READ_REG32(depctl_addr); ++ ++ /* set the stall bit */ ++ depctl.b.stall = 1; ++ DWC_WRITE_REG32(depctl_addr, depctl.d32); ++ } ++ ++ DWC_DEBUGPL(DBG_PCD, "DEPCTL=%0x\n", DWC_READ_REG32(depctl_addr)); ++ ++ return; ++} ++ ++/** ++ * Clear the EP STALL. ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ * @param ep The EP to clear stall from. ++ */ ++void dwc_otg_ep_clear_stall(dwc_otg_core_if_t * core_if, dwc_ep_t * ep) ++{ ++ depctl_data_t depctl; ++ volatile uint32_t *depctl_addr; ++ ++ DWC_DEBUGPL(DBG_PCD, "%s ep%d-%s\n", __func__, ep->num, ++ (ep->is_in ? "IN" : "OUT")); ++ ++ if (ep->is_in == 1) { ++ depctl_addr = &(core_if->dev_if->in_ep_regs[ep->num]->diepctl); ++ } else { ++ depctl_addr = &(core_if->dev_if->out_ep_regs[ep->num]->doepctl); ++ } ++ ++ depctl.d32 = DWC_READ_REG32(depctl_addr); ++ ++ /* clear the stall bits */ ++ depctl.b.stall = 0; ++ ++ /* ++ * USB Spec 9.4.5: For endpoints using data toggle, regardless ++ * of whether an endpoint has the Halt feature set, a ++ * ClearFeature(ENDPOINT_HALT) request always results in the ++ * data toggle being reinitialized to DATA0. ++ */ ++ if (ep->type == DWC_OTG_EP_TYPE_INTR || ++ ep->type == DWC_OTG_EP_TYPE_BULK) { ++ depctl.b.setd0pid = 1; /* DATA0 */ ++ } ++ ++ DWC_WRITE_REG32(depctl_addr, depctl.d32); ++ DWC_DEBUGPL(DBG_PCD, "DEPCTL=%0x\n", DWC_READ_REG32(depctl_addr)); ++ return; ++} ++ ++/** ++ * This function reads a packet from the Rx FIFO into the destination ++ * buffer. To read SETUP data use dwc_otg_read_setup_packet. ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ * @param dest Destination buffer for the packet. ++ * @param bytes Number of bytes to copy to the destination. ++ */ ++void dwc_otg_read_packet(dwc_otg_core_if_t * core_if, ++ uint8_t * dest, uint16_t bytes) ++{ ++ int i; ++ int word_count = (bytes + 3) / 4; ++ ++ volatile uint32_t *fifo = core_if->data_fifo[0]; ++ uint32_t *data_buff = (uint32_t *) dest; ++ ++ /** ++ * @todo Account for the case where _dest is not dword aligned. This ++ * requires reading data from the FIFO into a uint32_t temp buffer, ++ * then moving it into the data buffer. ++ */ ++ ++ DWC_DEBUGPL((DBG_PCDV | DBG_CILV), "%s(%p,%p,%d)\n", __func__, ++ core_if, dest, bytes); ++ ++ for (i = 0; i < word_count; i++, data_buff++) { ++ *data_buff = DWC_READ_REG32(fifo); ++ } ++ ++ return; ++} ++ ++/** ++ * This functions reads the device registers and prints them ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ */ ++void dwc_otg_dump_dev_registers(dwc_otg_core_if_t * core_if) ++{ ++ int i; ++ volatile uint32_t *addr; ++ ++ DWC_PRINTF("Device Global Registers\n"); ++ addr = &core_if->dev_if->dev_global_regs->dcfg; ++ DWC_PRINTF("DCFG @0x%08lX : 0x%08X\n", ++ (unsigned long)addr, DWC_READ_REG32(addr)); ++ addr = &core_if->dev_if->dev_global_regs->dctl; ++ DWC_PRINTF("DCTL @0x%08lX : 0x%08X\n", ++ (unsigned long)addr, DWC_READ_REG32(addr)); ++ addr = &core_if->dev_if->dev_global_regs->dsts; ++ DWC_PRINTF("DSTS @0x%08lX : 0x%08X\n", ++ (unsigned long)addr, DWC_READ_REG32(addr)); ++ addr = &core_if->dev_if->dev_global_regs->diepmsk; ++ DWC_PRINTF("DIEPMSK @0x%08lX : 0x%08X\n", (unsigned long)addr, ++ DWC_READ_REG32(addr)); ++ addr = &core_if->dev_if->dev_global_regs->doepmsk; ++ DWC_PRINTF("DOEPMSK @0x%08lX : 0x%08X\n", (unsigned long)addr, ++ DWC_READ_REG32(addr)); ++ addr = &core_if->dev_if->dev_global_regs->daint; ++ DWC_PRINTF("DAINT @0x%08lX : 0x%08X\n", (unsigned long)addr, ++ DWC_READ_REG32(addr)); ++ addr = &core_if->dev_if->dev_global_regs->daintmsk; ++ DWC_PRINTF("DAINTMSK @0x%08lX : 0x%08X\n", (unsigned long)addr, ++ DWC_READ_REG32(addr)); ++ addr = &core_if->dev_if->dev_global_regs->dtknqr1; ++ DWC_PRINTF("DTKNQR1 @0x%08lX : 0x%08X\n", (unsigned long)addr, ++ DWC_READ_REG32(addr)); ++ if (core_if->hwcfg2.b.dev_token_q_depth > 6) { ++ addr = &core_if->dev_if->dev_global_regs->dtknqr2; ++ DWC_PRINTF("DTKNQR2 @0x%08lX : 0x%08X\n", ++ (unsigned long)addr, DWC_READ_REG32(addr)); ++ } ++ ++ addr = &core_if->dev_if->dev_global_regs->dvbusdis; ++ DWC_PRINTF("DVBUSID @0x%08lX : 0x%08X\n", (unsigned long)addr, ++ DWC_READ_REG32(addr)); ++ ++ addr = &core_if->dev_if->dev_global_regs->dvbuspulse; ++ DWC_PRINTF("DVBUSPULSE @0x%08lX : 0x%08X\n", ++ (unsigned long)addr, DWC_READ_REG32(addr)); ++ ++ addr = &core_if->dev_if->dev_global_regs->dtknqr3_dthrctl; ++ DWC_PRINTF("DTKNQR3_DTHRCTL @0x%08lX : 0x%08X\n", ++ (unsigned long)addr, DWC_READ_REG32(addr)); ++ ++ if (core_if->hwcfg2.b.dev_token_q_depth > 22) { ++ addr = &core_if->dev_if->dev_global_regs->dtknqr4_fifoemptymsk; ++ DWC_PRINTF("DTKNQR4 @0x%08lX : 0x%08X\n", ++ (unsigned long)addr, DWC_READ_REG32(addr)); ++ } ++ ++ addr = &core_if->dev_if->dev_global_regs->dtknqr4_fifoemptymsk; ++ DWC_PRINTF("FIFOEMPMSK @0x%08lX : 0x%08X\n", (unsigned long)addr, ++ DWC_READ_REG32(addr)); ++ ++ if (core_if->hwcfg2.b.multi_proc_int) { ++ ++ addr = &core_if->dev_if->dev_global_regs->deachint; ++ DWC_PRINTF("DEACHINT @0x%08lX : 0x%08X\n", ++ (unsigned long)addr, DWC_READ_REG32(addr)); ++ addr = &core_if->dev_if->dev_global_regs->deachintmsk; ++ DWC_PRINTF("DEACHINTMSK @0x%08lX : 0x%08X\n", ++ (unsigned long)addr, DWC_READ_REG32(addr)); ++ ++ for (i = 0; i <= core_if->dev_if->num_in_eps; i++) { ++ addr = ++ &core_if->dev_if-> ++ dev_global_regs->diepeachintmsk[i]; ++ DWC_PRINTF("DIEPEACHINTMSK[%d] @0x%08lX : 0x%08X\n", ++ i, (unsigned long)addr, ++ DWC_READ_REG32(addr)); ++ } ++ ++ for (i = 0; i <= core_if->dev_if->num_out_eps; i++) { ++ addr = ++ &core_if->dev_if-> ++ dev_global_regs->doepeachintmsk[i]; ++ DWC_PRINTF("DOEPEACHINTMSK[%d] @0x%08lX : 0x%08X\n", ++ i, (unsigned long)addr, ++ DWC_READ_REG32(addr)); ++ } ++ } ++ ++ for (i = 0; i <= core_if->dev_if->num_in_eps; i++) { ++ DWC_PRINTF("Device IN EP %d Registers\n", i); ++ addr = &core_if->dev_if->in_ep_regs[i]->diepctl; ++ DWC_PRINTF("DIEPCTL @0x%08lX : 0x%08X\n", ++ (unsigned long)addr, DWC_READ_REG32(addr)); ++ addr = &core_if->dev_if->in_ep_regs[i]->diepint; ++ DWC_PRINTF("DIEPINT @0x%08lX : 0x%08X\n", ++ (unsigned long)addr, DWC_READ_REG32(addr)); ++ addr = &core_if->dev_if->in_ep_regs[i]->dieptsiz; ++ DWC_PRINTF("DIETSIZ @0x%08lX : 0x%08X\n", ++ (unsigned long)addr, DWC_READ_REG32(addr)); ++ addr = &core_if->dev_if->in_ep_regs[i]->diepdma; ++ DWC_PRINTF("DIEPDMA @0x%08lX : 0x%08X\n", ++ (unsigned long)addr, DWC_READ_REG32(addr)); ++ addr = &core_if->dev_if->in_ep_regs[i]->dtxfsts; ++ DWC_PRINTF("DTXFSTS @0x%08lX : 0x%08X\n", ++ (unsigned long)addr, DWC_READ_REG32(addr)); ++ addr = &core_if->dev_if->in_ep_regs[i]->diepdmab; ++ DWC_PRINTF("DIEPDMAB @0x%08lX : 0x%08X\n", ++ (unsigned long)addr, 0 /*DWC_READ_REG32(addr) */ ); ++ } ++ ++ for (i = 0; i <= core_if->dev_if->num_out_eps; i++) { ++ DWC_PRINTF("Device OUT EP %d Registers\n", i); ++ addr = &core_if->dev_if->out_ep_regs[i]->doepctl; ++ DWC_PRINTF("DOEPCTL @0x%08lX : 0x%08X\n", ++ (unsigned long)addr, DWC_READ_REG32(addr)); ++ addr = &core_if->dev_if->out_ep_regs[i]->doepint; ++ DWC_PRINTF("DOEPINT @0x%08lX : 0x%08X\n", ++ (unsigned long)addr, DWC_READ_REG32(addr)); ++ addr = &core_if->dev_if->out_ep_regs[i]->doeptsiz; ++ DWC_PRINTF("DOETSIZ @0x%08lX : 0x%08X\n", ++ (unsigned long)addr, DWC_READ_REG32(addr)); ++ addr = &core_if->dev_if->out_ep_regs[i]->doepdma; ++ DWC_PRINTF("DOEPDMA @0x%08lX : 0x%08X\n", ++ (unsigned long)addr, DWC_READ_REG32(addr)); ++ if (core_if->dma_enable) { /* Don't access this register in SLAVE mode */ ++ addr = &core_if->dev_if->out_ep_regs[i]->doepdmab; ++ DWC_PRINTF("DOEPDMAB @0x%08lX : 0x%08X\n", ++ (unsigned long)addr, DWC_READ_REG32(addr)); ++ } ++ ++ } ++} ++ ++/** ++ * This functions reads the SPRAM and prints its content ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ */ ++void dwc_otg_dump_spram(dwc_otg_core_if_t * core_if) ++{ ++ volatile uint8_t *addr, *start_addr, *end_addr; ++ ++ DWC_PRINTF("SPRAM Data:\n"); ++ start_addr = (void *)core_if->core_global_regs; ++ DWC_PRINTF("Base Address: 0x%8lX\n", (unsigned long)start_addr); ++ start_addr += 0x00028000; ++ end_addr = (void *)core_if->core_global_regs; ++ end_addr += 0x000280e0; ++ ++ for (addr = start_addr; addr < end_addr; addr += 16) { ++ DWC_PRINTF ++ ("0x%8lX:\t%2X %2X %2X %2X %2X %2X %2X %2X %2X %2X %2X %2X %2X %2X %2X %2X\n", ++ (unsigned long)addr, addr[0], addr[1], addr[2], addr[3], ++ addr[4], addr[5], addr[6], addr[7], addr[8], addr[9], ++ addr[10], addr[11], addr[12], addr[13], addr[14], addr[15] ++ ); ++ } ++ ++ return; ++} ++ ++/** ++ * This function reads the host registers and prints them ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ */ ++void dwc_otg_dump_host_registers(dwc_otg_core_if_t * core_if) ++{ ++ int i; ++ volatile uint32_t *addr; ++ ++ DWC_PRINTF("Host Global Registers\n"); ++ addr = &core_if->host_if->host_global_regs->hcfg; ++ DWC_PRINTF("HCFG @0x%08lX : 0x%08X\n", ++ (unsigned long)addr, DWC_READ_REG32(addr)); ++ addr = &core_if->host_if->host_global_regs->hfir; ++ DWC_PRINTF("HFIR @0x%08lX : 0x%08X\n", ++ (unsigned long)addr, DWC_READ_REG32(addr)); ++ addr = &core_if->host_if->host_global_regs->hfnum; ++ DWC_PRINTF("HFNUM @0x%08lX : 0x%08X\n", (unsigned long)addr, ++ DWC_READ_REG32(addr)); ++ addr = &core_if->host_if->host_global_regs->hptxsts; ++ DWC_PRINTF("HPTXSTS @0x%08lX : 0x%08X\n", (unsigned long)addr, ++ DWC_READ_REG32(addr)); ++ addr = &core_if->host_if->host_global_regs->haint; ++ DWC_PRINTF("HAINT @0x%08lX : 0x%08X\n", (unsigned long)addr, ++ DWC_READ_REG32(addr)); ++ addr = &core_if->host_if->host_global_regs->haintmsk; ++ DWC_PRINTF("HAINTMSK @0x%08lX : 0x%08X\n", (unsigned long)addr, ++ DWC_READ_REG32(addr)); ++ if (core_if->dma_desc_enable) { ++ addr = &core_if->host_if->host_global_regs->hflbaddr; ++ DWC_PRINTF("HFLBADDR @0x%08lX : 0x%08X\n", ++ (unsigned long)addr, DWC_READ_REG32(addr)); ++ } ++ ++ addr = core_if->host_if->hprt0; ++ DWC_PRINTF("HPRT0 @0x%08lX : 0x%08X\n", (unsigned long)addr, ++ DWC_READ_REG32(addr)); ++ ++ for (i = 0; i < core_if->core_params->host_channels; i++) { ++ DWC_PRINTF("Host Channel %d Specific Registers\n", i); ++ addr = &core_if->host_if->hc_regs[i]->hcchar; ++ DWC_PRINTF("HCCHAR @0x%08lX : 0x%08X\n", ++ (unsigned long)addr, DWC_READ_REG32(addr)); ++ addr = &core_if->host_if->hc_regs[i]->hcsplt; ++ DWC_PRINTF("HCSPLT @0x%08lX : 0x%08X\n", ++ (unsigned long)addr, DWC_READ_REG32(addr)); ++ addr = &core_if->host_if->hc_regs[i]->hcint; ++ DWC_PRINTF("HCINT @0x%08lX : 0x%08X\n", ++ (unsigned long)addr, DWC_READ_REG32(addr)); ++ addr = &core_if->host_if->hc_regs[i]->hcintmsk; ++ DWC_PRINTF("HCINTMSK @0x%08lX : 0x%08X\n", ++ (unsigned long)addr, DWC_READ_REG32(addr)); ++ addr = &core_if->host_if->hc_regs[i]->hctsiz; ++ DWC_PRINTF("HCTSIZ @0x%08lX : 0x%08X\n", ++ (unsigned long)addr, DWC_READ_REG32(addr)); ++ addr = &core_if->host_if->hc_regs[i]->hcdma; ++ DWC_PRINTF("HCDMA @0x%08lX : 0x%08X\n", ++ (unsigned long)addr, DWC_READ_REG32(addr)); ++ if (core_if->dma_desc_enable) { ++ addr = &core_if->host_if->hc_regs[i]->hcdmab; ++ DWC_PRINTF("HCDMAB @0x%08lX : 0x%08X\n", ++ (unsigned long)addr, DWC_READ_REG32(addr)); ++ } ++ ++ } ++ return; ++} ++ ++/** ++ * This function reads the core global registers and prints them ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ */ ++void dwc_otg_dump_global_registers(dwc_otg_core_if_t * core_if) ++{ ++ int i, ep_num; ++ volatile uint32_t *addr; ++ char *txfsiz; ++ ++ DWC_PRINTF("Core Global Registers\n"); ++ addr = &core_if->core_global_regs->gotgctl; ++ DWC_PRINTF("GOTGCTL @0x%08lX : 0x%08X\n", (unsigned long)addr, ++ DWC_READ_REG32(addr)); ++ addr = &core_if->core_global_regs->gotgint; ++ DWC_PRINTF("GOTGINT @0x%08lX : 0x%08X\n", (unsigned long)addr, ++ DWC_READ_REG32(addr)); ++ addr = &core_if->core_global_regs->gahbcfg; ++ DWC_PRINTF("GAHBCFG @0x%08lX : 0x%08X\n", (unsigned long)addr, ++ DWC_READ_REG32(addr)); ++ addr = &core_if->core_global_regs->gusbcfg; ++ DWC_PRINTF("GUSBCFG @0x%08lX : 0x%08X\n", (unsigned long)addr, ++ DWC_READ_REG32(addr)); ++ addr = &core_if->core_global_regs->grstctl; ++ DWC_PRINTF("GRSTCTL @0x%08lX : 0x%08X\n", (unsigned long)addr, ++ DWC_READ_REG32(addr)); ++ addr = &core_if->core_global_regs->gintsts; ++ DWC_PRINTF("GINTSTS @0x%08lX : 0x%08X\n", (unsigned long)addr, ++ DWC_READ_REG32(addr)); ++ addr = &core_if->core_global_regs->gintmsk; ++ DWC_PRINTF("GINTMSK @0x%08lX : 0x%08X\n", (unsigned long)addr, ++ DWC_READ_REG32(addr)); ++ addr = &core_if->core_global_regs->grxstsr; ++ DWC_PRINTF("GRXSTSR @0x%08lX : 0x%08X\n", (unsigned long)addr, ++ DWC_READ_REG32(addr)); ++ addr = &core_if->core_global_regs->grxfsiz; ++ DWC_PRINTF("GRXFSIZ @0x%08lX : 0x%08X\n", (unsigned long)addr, ++ DWC_READ_REG32(addr)); ++ addr = &core_if->core_global_regs->gnptxfsiz; ++ DWC_PRINTF("GNPTXFSIZ @0x%08lX : 0x%08X\n", (unsigned long)addr, ++ DWC_READ_REG32(addr)); ++ addr = &core_if->core_global_regs->gnptxsts; ++ DWC_PRINTF("GNPTXSTS @0x%08lX : 0x%08X\n", (unsigned long)addr, ++ DWC_READ_REG32(addr)); ++ addr = &core_if->core_global_regs->gi2cctl; ++ DWC_PRINTF("GI2CCTL @0x%08lX : 0x%08X\n", (unsigned long)addr, ++ DWC_READ_REG32(addr)); ++ addr = &core_if->core_global_regs->gpvndctl; ++ DWC_PRINTF("GPVNDCTL @0x%08lX : 0x%08X\n", (unsigned long)addr, ++ DWC_READ_REG32(addr)); ++ addr = &core_if->core_global_regs->ggpio; ++ DWC_PRINTF("GGPIO @0x%08lX : 0x%08X\n", (unsigned long)addr, ++ DWC_READ_REG32(addr)); ++ addr = &core_if->core_global_regs->guid; ++ DWC_PRINTF("GUID @0x%08lX : 0x%08X\n", ++ (unsigned long)addr, DWC_READ_REG32(addr)); ++ addr = &core_if->core_global_regs->gsnpsid; ++ DWC_PRINTF("GSNPSID @0x%08lX : 0x%08X\n", (unsigned long)addr, ++ DWC_READ_REG32(addr)); ++ addr = &core_if->core_global_regs->ghwcfg1; ++ DWC_PRINTF("GHWCFG1 @0x%08lX : 0x%08X\n", (unsigned long)addr, ++ DWC_READ_REG32(addr)); ++ addr = &core_if->core_global_regs->ghwcfg2; ++ DWC_PRINTF("GHWCFG2 @0x%08lX : 0x%08X\n", (unsigned long)addr, ++ DWC_READ_REG32(addr)); ++ addr = &core_if->core_global_regs->ghwcfg3; ++ DWC_PRINTF("GHWCFG3 @0x%08lX : 0x%08X\n", (unsigned long)addr, ++ DWC_READ_REG32(addr)); ++ addr = &core_if->core_global_regs->ghwcfg4; ++ DWC_PRINTF("GHWCFG4 @0x%08lX : 0x%08X\n", (unsigned long)addr, ++ DWC_READ_REG32(addr)); ++ addr = &core_if->core_global_regs->glpmcfg; ++ DWC_PRINTF("GLPMCFG @0x%08lX : 0x%08X\n", (unsigned long)addr, ++ DWC_READ_REG32(addr)); ++ addr = &core_if->core_global_regs->gpwrdn; ++ DWC_PRINTF("GPWRDN @0x%08lX : 0x%08X\n", (unsigned long)addr, ++ DWC_READ_REG32(addr)); ++ addr = &core_if->core_global_regs->gdfifocfg; ++ DWC_PRINTF("GDFIFOCFG @0x%08lX : 0x%08X\n", (unsigned long)addr, ++ DWC_READ_REG32(addr)); ++ addr = &core_if->core_global_regs->adpctl; ++ DWC_PRINTF("ADPCTL @0x%08lX : 0x%08X\n", (unsigned long)addr, ++ dwc_otg_adp_read_reg(core_if)); ++ addr = &core_if->core_global_regs->hptxfsiz; ++ DWC_PRINTF("HPTXFSIZ @0x%08lX : 0x%08X\n", (unsigned long)addr, ++ DWC_READ_REG32(addr)); ++ ++ if (core_if->en_multiple_tx_fifo == 0) { ++ ep_num = core_if->hwcfg4.b.num_dev_perio_in_ep; ++ txfsiz = "DPTXFSIZ"; ++ } else { ++ ep_num = core_if->hwcfg4.b.num_in_eps; ++ txfsiz = "DIENPTXF"; ++ } ++ for (i = 0; i < ep_num; i++) { ++ addr = &core_if->core_global_regs->dtxfsiz[i]; ++ DWC_PRINTF("%s[%d] @0x%08lX : 0x%08X\n", txfsiz, i + 1, ++ (unsigned long)addr, DWC_READ_REG32(addr)); ++ } ++ addr = core_if->pcgcctl; ++ DWC_PRINTF("PCGCCTL @0x%08lX : 0x%08X\n", (unsigned long)addr, ++ DWC_READ_REG32(addr)); ++} ++ ++/** ++ * Flush a Tx FIFO. ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ * @param num Tx FIFO to flush. ++ */ ++void dwc_otg_flush_tx_fifo(dwc_otg_core_if_t * core_if, const int num) ++{ ++ dwc_otg_core_global_regs_t *global_regs = core_if->core_global_regs; ++ volatile grstctl_t greset = {.d32 = 0 }; ++ int count = 0; ++ ++ DWC_DEBUGPL((DBG_CIL | DBG_PCDV), "Flush Tx FIFO %d\n", num); ++ ++ greset.b.txfflsh = 1; ++ greset.b.txfnum = num; ++ DWC_WRITE_REG32(&global_regs->grstctl, greset.d32); ++ ++ do { ++ greset.d32 = DWC_READ_REG32(&global_regs->grstctl); ++ if (++count > 10000) { ++ DWC_WARN("%s() HANG! GRSTCTL=%0x GNPTXSTS=0x%08x\n", ++ __func__, greset.d32, ++ DWC_READ_REG32(&global_regs->gnptxsts)); ++ break; ++ } ++ dwc_udelay(1); ++ } while (greset.b.txfflsh == 1); ++ ++ /* Wait for 3 PHY Clocks */ ++ dwc_udelay(1); ++} ++ ++/** ++ * Flush Rx FIFO. ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ */ ++void dwc_otg_flush_rx_fifo(dwc_otg_core_if_t * core_if) ++{ ++ dwc_otg_core_global_regs_t *global_regs = core_if->core_global_regs; ++ volatile grstctl_t greset = {.d32 = 0 }; ++ int count = 0; ++ ++ DWC_DEBUGPL((DBG_CIL | DBG_PCDV), "%s\n", __func__); ++ /* ++ * ++ */ ++ greset.b.rxfflsh = 1; ++ DWC_WRITE_REG32(&global_regs->grstctl, greset.d32); ++ ++ do { ++ greset.d32 = DWC_READ_REG32(&global_regs->grstctl); ++ if (++count > 10000) { ++ DWC_WARN("%s() HANG! GRSTCTL=%0x\n", __func__, ++ greset.d32); ++ break; ++ } ++ dwc_udelay(1); ++ } while (greset.b.rxfflsh == 1); ++ ++ /* Wait for 3 PHY Clocks */ ++ dwc_udelay(1); ++} ++ ++/** ++ * Do core a soft reset of the core. Be careful with this because it ++ * resets all the internal state machines of the core. ++ */ ++void dwc_otg_core_reset(dwc_otg_core_if_t * core_if) ++{ ++ dwc_otg_core_global_regs_t *global_regs = core_if->core_global_regs; ++ volatile grstctl_t greset = {.d32 = 0 }; ++ int count = 0; ++ ++ DWC_DEBUGPL(DBG_CILV, "%s\n", __func__); ++ /* Wait for AHB master IDLE state. */ ++ do { ++ dwc_udelay(10); ++ greset.d32 = DWC_READ_REG32(&global_regs->grstctl); ++ if (++count > 100000) { ++ DWC_WARN("%s() HANG! AHB Idle GRSTCTL=%0x\n", __func__, ++ greset.d32); ++ return; ++ } ++ } ++ while (greset.b.ahbidle == 0); ++ ++ /* Core Soft Reset */ ++ count = 0; ++ greset.b.csftrst = 1; ++ DWC_WRITE_REG32(&global_regs->grstctl, greset.d32); ++ do { ++ greset.d32 = DWC_READ_REG32(&global_regs->grstctl); ++ if (++count > 10000) { ++ DWC_WARN("%s() HANG! Soft Reset GRSTCTL=%0x\n", ++ __func__, greset.d32); ++ break; ++ } ++ dwc_udelay(1); ++ } ++ while (greset.b.csftrst == 1); ++ ++ /* Wait for 3 PHY Clocks */ ++ dwc_mdelay(100); ++} ++ ++uint8_t dwc_otg_is_device_mode(dwc_otg_core_if_t * _core_if) ++{ ++ return (dwc_otg_mode(_core_if) != DWC_HOST_MODE); ++} ++ ++uint8_t dwc_otg_is_host_mode(dwc_otg_core_if_t * _core_if) ++{ ++ return (dwc_otg_mode(_core_if) == DWC_HOST_MODE); ++} ++ ++/** ++ * Register HCD callbacks. The callbacks are used to start and stop ++ * the HCD for interrupt processing. ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ * @param cb the HCD callback structure. ++ * @param p pointer to be passed to callback function (usb_hcd*). ++ */ ++void dwc_otg_cil_register_hcd_callbacks(dwc_otg_core_if_t * core_if, ++ dwc_otg_cil_callbacks_t * cb, void *p) ++{ ++ core_if->hcd_cb = cb; ++ cb->p = p; ++} ++ ++/** ++ * Register PCD callbacks. The callbacks are used to start and stop ++ * the PCD for interrupt processing. ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ * @param cb the PCD callback structure. ++ * @param p pointer to be passed to callback function (pcd*). ++ */ ++void dwc_otg_cil_register_pcd_callbacks(dwc_otg_core_if_t * core_if, ++ dwc_otg_cil_callbacks_t * cb, void *p) ++{ ++ core_if->pcd_cb = cb; ++ cb->p = p; ++} ++ ++#ifdef DWC_EN_ISOC ++ ++/** ++ * This function writes isoc data per 1 (micro)frame into tx fifo ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ * @param ep The EP to start the transfer on. ++ * ++ */ ++void write_isoc_frame_data(dwc_otg_core_if_t * core_if, dwc_ep_t * ep) ++{ ++ dwc_otg_dev_in_ep_regs_t *ep_regs; ++ dtxfsts_data_t txstatus = {.d32 = 0 }; ++ uint32_t len = 0; ++ uint32_t dwords; ++ ++ ep->xfer_len = ep->data_per_frame; ++ ep->xfer_count = 0; ++ ++ ep_regs = core_if->dev_if->in_ep_regs[ep->num]; ++ ++ len = ep->xfer_len - ep->xfer_count; ++ ++ if (len > ep->maxpacket) { ++ len = ep->maxpacket; ++ } ++ ++ dwords = (len + 3) / 4; ++ ++ /* While there is space in the queue and space in the FIFO and ++ * More data to tranfer, Write packets to the Tx FIFO */ ++ txstatus.d32 = ++ DWC_READ_REG32(&core_if->dev_if->in_ep_regs[ep->num]->dtxfsts); ++ DWC_DEBUGPL(DBG_PCDV, "b4 dtxfsts[%d]=0x%08x\n", ep->num, txstatus.d32); ++ ++ while (txstatus.b.txfspcavail > dwords && ++ ep->xfer_count < ep->xfer_len && ep->xfer_len != 0) { ++ /* Write the FIFO */ ++ dwc_otg_ep_write_packet(core_if, ep, 0); ++ ++ len = ep->xfer_len - ep->xfer_count; ++ if (len > ep->maxpacket) { ++ len = ep->maxpacket; ++ } ++ ++ dwords = (len + 3) / 4; ++ txstatus.d32 = ++ DWC_READ_REG32(&core_if->dev_if->in_ep_regs[ep->num]-> ++ dtxfsts); ++ DWC_DEBUGPL(DBG_PCDV, "dtxfsts[%d]=0x%08x\n", ep->num, ++ txstatus.d32); ++ } ++} ++ ++/** ++ * This function initializes a descriptor chain for Isochronous transfer ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ * @param ep The EP to start the transfer on. ++ * ++ */ ++void dwc_otg_iso_ep_start_frm_transfer(dwc_otg_core_if_t * core_if, ++ dwc_ep_t * ep) ++{ ++ deptsiz_data_t deptsiz = {.d32 = 0 }; ++ depctl_data_t depctl = {.d32 = 0 }; ++ dsts_data_t dsts = {.d32 = 0 }; ++ volatile uint32_t *addr; ++ ++ if (ep->is_in) { ++ addr = &core_if->dev_if->in_ep_regs[ep->num]->diepctl; ++ } else { ++ addr = &core_if->dev_if->out_ep_regs[ep->num]->doepctl; ++ } ++ ++ ep->xfer_len = ep->data_per_frame; ++ ep->xfer_count = 0; ++ ep->xfer_buff = ep->cur_pkt_addr; ++ ep->dma_addr = ep->cur_pkt_dma_addr; ++ ++ if (ep->is_in) { ++ /* Program the transfer size and packet count ++ * as follows: xfersize = N * maxpacket + ++ * short_packet pktcnt = N + (short_packet ++ * exist ? 1 : 0) ++ */ ++ deptsiz.b.xfersize = ep->xfer_len; ++ deptsiz.b.pktcnt = ++ (ep->xfer_len - 1 + ep->maxpacket) / ep->maxpacket; ++ deptsiz.b.mc = deptsiz.b.pktcnt; ++ DWC_WRITE_REG32(&core_if->dev_if->in_ep_regs[ep->num]->dieptsiz, ++ deptsiz.d32); ++ ++ /* Write the DMA register */ ++ if (core_if->dma_enable) { ++ DWC_WRITE_REG32(& ++ (core_if->dev_if->in_ep_regs[ep->num]-> ++ diepdma), (uint32_t) ep->dma_addr); ++ } ++ } else { ++ deptsiz.b.pktcnt = ++ (ep->xfer_len + (ep->maxpacket - 1)) / ep->maxpacket; ++ deptsiz.b.xfersize = deptsiz.b.pktcnt * ep->maxpacket; ++ ++ DWC_WRITE_REG32(&core_if->dev_if-> ++ out_ep_regs[ep->num]->doeptsiz, deptsiz.d32); ++ ++ if (core_if->dma_enable) { ++ DWC_WRITE_REG32(& ++ (core_if->dev_if-> ++ out_ep_regs[ep->num]->doepdma), ++ (uint32_t) ep->dma_addr); ++ } ++ } ++ ++ /** Enable endpoint, clear nak */ ++ ++ depctl.d32 = 0; ++ if (ep->bInterval == 1) { ++ dsts.d32 = ++ DWC_READ_REG32(&core_if->dev_if->dev_global_regs->dsts); ++ ep->next_frame = dsts.b.soffn + ep->bInterval; ++ ++ if (ep->next_frame & 0x1) { ++ depctl.b.setd1pid = 1; ++ } else { ++ depctl.b.setd0pid = 1; ++ } ++ } else { ++ ep->next_frame += ep->bInterval; ++ ++ if (ep->next_frame & 0x1) { ++ depctl.b.setd1pid = 1; ++ } else { ++ depctl.b.setd0pid = 1; ++ } ++ } ++ depctl.b.epena = 1; ++ depctl.b.cnak = 1; ++ ++ DWC_MODIFY_REG32(addr, 0, depctl.d32); ++ depctl.d32 = DWC_READ_REG32(addr); ++ ++ if (ep->is_in && core_if->dma_enable == 0) { ++ write_isoc_frame_data(core_if, ep); ++ } ++ ++} ++#endif /* DWC_EN_ISOC */ ++ ++static void dwc_otg_set_uninitialized(int32_t * p, int size) ++{ ++ int i; ++ for (i = 0; i < size; i++) { ++ p[i] = -1; ++ } ++} ++ ++static int dwc_otg_param_initialized(int32_t val) ++{ ++ return val != -1; ++} ++ ++static int dwc_otg_setup_params(dwc_otg_core_if_t * core_if) ++{ ++ int i; ++ core_if->core_params = DWC_ALLOC(sizeof(*core_if->core_params)); ++ if (!core_if->core_params) { ++ return -DWC_E_NO_MEMORY; ++ } ++ dwc_otg_set_uninitialized((int32_t *) core_if->core_params, ++ sizeof(*core_if->core_params) / ++ sizeof(int32_t)); ++ DWC_PRINTF("Setting default values for core params\n"); ++ dwc_otg_set_param_otg_cap(core_if, dwc_param_otg_cap_default); ++ dwc_otg_set_param_dma_enable(core_if, dwc_param_dma_enable_default); ++ dwc_otg_set_param_dma_desc_enable(core_if, ++ dwc_param_dma_desc_enable_default); ++ dwc_otg_set_param_opt(core_if, dwc_param_opt_default); ++ dwc_otg_set_param_dma_burst_size(core_if, ++ dwc_param_dma_burst_size_default); ++ dwc_otg_set_param_host_support_fs_ls_low_power(core_if, ++ dwc_param_host_support_fs_ls_low_power_default); ++ dwc_otg_set_param_enable_dynamic_fifo(core_if, ++ dwc_param_enable_dynamic_fifo_default); ++ dwc_otg_set_param_data_fifo_size(core_if, ++ dwc_param_data_fifo_size_default); ++ dwc_otg_set_param_dev_rx_fifo_size(core_if, ++ dwc_param_dev_rx_fifo_size_default); ++ dwc_otg_set_param_dev_nperio_tx_fifo_size(core_if, ++ dwc_param_dev_nperio_tx_fifo_size_default); ++ dwc_otg_set_param_host_rx_fifo_size(core_if, ++ dwc_param_host_rx_fifo_size_default); ++ dwc_otg_set_param_host_nperio_tx_fifo_size(core_if, ++ dwc_param_host_nperio_tx_fifo_size_default); ++ dwc_otg_set_param_host_perio_tx_fifo_size(core_if, ++ dwc_param_host_perio_tx_fifo_size_default); ++ dwc_otg_set_param_max_transfer_size(core_if, ++ dwc_param_max_transfer_size_default); ++ dwc_otg_set_param_max_packet_count(core_if, ++ dwc_param_max_packet_count_default); ++ dwc_otg_set_param_host_channels(core_if, ++ dwc_param_host_channels_default); ++ dwc_otg_set_param_dev_endpoints(core_if, ++ dwc_param_dev_endpoints_default); ++ dwc_otg_set_param_phy_type(core_if, dwc_param_phy_type_default); ++ dwc_otg_set_param_speed(core_if, dwc_param_speed_default); ++ dwc_otg_set_param_host_ls_low_power_phy_clk(core_if, ++ dwc_param_host_ls_low_power_phy_clk_default); ++ dwc_otg_set_param_phy_ulpi_ddr(core_if, dwc_param_phy_ulpi_ddr_default); ++ dwc_otg_set_param_phy_ulpi_ext_vbus(core_if, ++ dwc_param_phy_ulpi_ext_vbus_default); ++ dwc_otg_set_param_phy_utmi_width(core_if, ++ dwc_param_phy_utmi_width_default); ++ dwc_otg_set_param_ts_dline(core_if, dwc_param_ts_dline_default); ++ dwc_otg_set_param_i2c_enable(core_if, dwc_param_i2c_enable_default); ++ dwc_otg_set_param_ulpi_fs_ls(core_if, dwc_param_ulpi_fs_ls_default); ++ dwc_otg_set_param_en_multiple_tx_fifo(core_if, ++ dwc_param_en_multiple_tx_fifo_default); ++ for (i = 0; i < 15; i++) { ++ dwc_otg_set_param_dev_perio_tx_fifo_size(core_if, ++ dwc_param_dev_perio_tx_fifo_size_default, ++ i); ++ } ++ ++ for (i = 0; i < 15; i++) { ++ dwc_otg_set_param_dev_tx_fifo_size(core_if, ++ dwc_param_dev_tx_fifo_size_default, ++ i); ++ } ++ dwc_otg_set_param_thr_ctl(core_if, dwc_param_thr_ctl_default); ++ dwc_otg_set_param_mpi_enable(core_if, dwc_param_mpi_enable_default); ++ dwc_otg_set_param_pti_enable(core_if, dwc_param_pti_enable_default); ++ dwc_otg_set_param_lpm_enable(core_if, dwc_param_lpm_enable_default); ++ dwc_otg_set_param_ic_usb_cap(core_if, dwc_param_ic_usb_cap_default); ++ dwc_otg_set_param_tx_thr_length(core_if, ++ dwc_param_tx_thr_length_default); ++ dwc_otg_set_param_rx_thr_length(core_if, ++ dwc_param_rx_thr_length_default); ++ dwc_otg_set_param_ahb_thr_ratio(core_if, ++ dwc_param_ahb_thr_ratio_default); ++ dwc_otg_set_param_power_down(core_if, dwc_param_power_down_default); ++ dwc_otg_set_param_reload_ctl(core_if, dwc_param_reload_ctl_default); ++ dwc_otg_set_param_dev_out_nak(core_if, dwc_param_dev_out_nak_default); ++ dwc_otg_set_param_cont_on_bna(core_if, dwc_param_cont_on_bna_default); ++ dwc_otg_set_param_ahb_single(core_if, dwc_param_ahb_single_default); ++ dwc_otg_set_param_otg_ver(core_if, dwc_param_otg_ver_default); ++ dwc_otg_set_param_adp_enable(core_if, dwc_param_adp_enable_default); ++ DWC_PRINTF("Finished setting default values for core params\n"); ++ ++ return 0; ++} ++ ++uint8_t dwc_otg_is_dma_enable(dwc_otg_core_if_t * core_if) ++{ ++ return core_if->dma_enable; ++} ++ ++/* Checks if the parameter is outside of its valid range of values */ ++#define DWC_OTG_PARAM_TEST(_param_, _low_, _high_) \ ++ (((_param_) < (_low_)) || \ ++ ((_param_) > (_high_))) ++ ++/* Parameter access functions */ ++int dwc_otg_set_param_otg_cap(dwc_otg_core_if_t * core_if, int32_t val) ++{ ++ int valid; ++ int retval = 0; ++ if (DWC_OTG_PARAM_TEST(val, 0, 2)) { ++ DWC_WARN("Wrong value for otg_cap parameter\n"); ++ DWC_WARN("otg_cap parameter must be 0,1 or 2\n"); ++ retval = -DWC_E_INVALID; ++ goto out; ++ } ++ ++ valid = 1; ++ switch (val) { ++ case DWC_OTG_CAP_PARAM_HNP_SRP_CAPABLE: ++ if (core_if->hwcfg2.b.op_mode != ++ DWC_HWCFG2_OP_MODE_HNP_SRP_CAPABLE_OTG) ++ valid = 0; ++ break; ++ case DWC_OTG_CAP_PARAM_SRP_ONLY_CAPABLE: ++ if ((core_if->hwcfg2.b.op_mode != ++ DWC_HWCFG2_OP_MODE_HNP_SRP_CAPABLE_OTG) ++ && (core_if->hwcfg2.b.op_mode != ++ DWC_HWCFG2_OP_MODE_SRP_ONLY_CAPABLE_OTG) ++ && (core_if->hwcfg2.b.op_mode != ++ DWC_HWCFG2_OP_MODE_SRP_CAPABLE_DEVICE) ++ && (core_if->hwcfg2.b.op_mode != ++ DWC_HWCFG2_OP_MODE_SRP_CAPABLE_HOST)) { ++ valid = 0; ++ } ++ break; ++ case DWC_OTG_CAP_PARAM_NO_HNP_SRP_CAPABLE: ++ /* always valid */ ++ break; ++ } ++ if (!valid) { ++ if (dwc_otg_param_initialized(core_if->core_params->otg_cap)) { ++ DWC_ERROR ++ ("%d invalid for otg_cap paremter. Check HW configuration.\n", ++ val); ++ } ++ val = ++ (((core_if->hwcfg2.b.op_mode == ++ DWC_HWCFG2_OP_MODE_HNP_SRP_CAPABLE_OTG) ++ || (core_if->hwcfg2.b.op_mode == ++ DWC_HWCFG2_OP_MODE_SRP_ONLY_CAPABLE_OTG) ++ || (core_if->hwcfg2.b.op_mode == ++ DWC_HWCFG2_OP_MODE_SRP_CAPABLE_DEVICE) ++ || (core_if->hwcfg2.b.op_mode == ++ DWC_HWCFG2_OP_MODE_SRP_CAPABLE_HOST)) ? ++ DWC_OTG_CAP_PARAM_SRP_ONLY_CAPABLE : ++ DWC_OTG_CAP_PARAM_NO_HNP_SRP_CAPABLE); ++ retval = -DWC_E_INVALID; ++ } ++ ++ core_if->core_params->otg_cap = val; ++out: ++ return retval; ++} ++ ++int32_t dwc_otg_get_param_otg_cap(dwc_otg_core_if_t * core_if) ++{ ++ return core_if->core_params->otg_cap; ++} ++ ++int dwc_otg_set_param_opt(dwc_otg_core_if_t * core_if, int32_t val) ++{ ++ if (DWC_OTG_PARAM_TEST(val, 0, 1)) { ++ DWC_WARN("Wrong value for opt parameter\n"); ++ return -DWC_E_INVALID; ++ } ++ core_if->core_params->opt = val; ++ return 0; ++} ++ ++int32_t dwc_otg_get_param_opt(dwc_otg_core_if_t * core_if) ++{ ++ return core_if->core_params->opt; ++} ++ ++int dwc_otg_set_param_dma_enable(dwc_otg_core_if_t * core_if, int32_t val) ++{ ++ int retval = 0; ++ if (DWC_OTG_PARAM_TEST(val, 0, 1)) { ++ DWC_WARN("Wrong value for dma enable\n"); ++ return -DWC_E_INVALID; ++ } ++ ++ if ((val == 1) && (core_if->hwcfg2.b.architecture == 0)) { ++ if (dwc_otg_param_initialized(core_if->core_params->dma_enable)) { ++ DWC_ERROR ++ ("%d invalid for dma_enable paremter. Check HW configuration.\n", ++ val); ++ } ++ val = 0; ++ retval = -DWC_E_INVALID; ++ } ++ ++ core_if->core_params->dma_enable = val; ++ if (val == 0) { ++ dwc_otg_set_param_dma_desc_enable(core_if, 0); ++ } ++ return retval; ++} ++ ++int32_t dwc_otg_get_param_dma_enable(dwc_otg_core_if_t * core_if) ++{ ++ return core_if->core_params->dma_enable; ++} ++ ++int dwc_otg_set_param_dma_desc_enable(dwc_otg_core_if_t * core_if, int32_t val) ++{ ++ int retval = 0; ++ if (DWC_OTG_PARAM_TEST(val, 0, 1)) { ++ DWC_WARN("Wrong value for dma_enable\n"); ++ DWC_WARN("dma_desc_enable must be 0 or 1\n"); ++ return -DWC_E_INVALID; ++ } ++ ++ if ((val == 1) ++ && ((dwc_otg_get_param_dma_enable(core_if) == 0) ++ || (core_if->hwcfg4.b.desc_dma == 0))) { ++ if (dwc_otg_param_initialized ++ (core_if->core_params->dma_desc_enable)) { ++ DWC_ERROR ++ ("%d invalid for dma_desc_enable paremter. Check HW configuration.\n", ++ val); ++ } ++ val = 0; ++ retval = -DWC_E_INVALID; ++ } ++ core_if->core_params->dma_desc_enable = val; ++ return retval; ++} ++ ++int32_t dwc_otg_get_param_dma_desc_enable(dwc_otg_core_if_t * core_if) ++{ ++ return core_if->core_params->dma_desc_enable; ++} ++ ++int dwc_otg_set_param_host_support_fs_ls_low_power(dwc_otg_core_if_t * core_if, ++ int32_t val) ++{ ++ if (DWC_OTG_PARAM_TEST(val, 0, 1)) { ++ DWC_WARN("Wrong value for host_support_fs_low_power\n"); ++ DWC_WARN("host_support_fs_low_power must be 0 or 1\n"); ++ return -DWC_E_INVALID; ++ } ++ core_if->core_params->host_support_fs_ls_low_power = val; ++ return 0; ++} ++ ++int32_t dwc_otg_get_param_host_support_fs_ls_low_power(dwc_otg_core_if_t * ++ core_if) ++{ ++ return core_if->core_params->host_support_fs_ls_low_power; ++} ++ ++int dwc_otg_set_param_enable_dynamic_fifo(dwc_otg_core_if_t * core_if, ++ int32_t val) ++{ ++ int retval = 0; ++ if (DWC_OTG_PARAM_TEST(val, 0, 1)) { ++ DWC_WARN("Wrong value for enable_dynamic_fifo\n"); ++ DWC_WARN("enable_dynamic_fifo must be 0 or 1\n"); ++ return -DWC_E_INVALID; ++ } ++ ++ if ((val == 1) && (core_if->hwcfg2.b.dynamic_fifo == 0)) { ++ if (dwc_otg_param_initialized ++ (core_if->core_params->enable_dynamic_fifo)) { ++ DWC_ERROR ++ ("%d invalid for enable_dynamic_fifo paremter. Check HW configuration.\n", ++ val); ++ } ++ val = 0; ++ retval = -DWC_E_INVALID; ++ } ++ core_if->core_params->enable_dynamic_fifo = val; ++ return retval; ++} ++ ++int32_t dwc_otg_get_param_enable_dynamic_fifo(dwc_otg_core_if_t * core_if) ++{ ++ return core_if->core_params->enable_dynamic_fifo; ++} ++ ++int dwc_otg_set_param_data_fifo_size(dwc_otg_core_if_t * core_if, int32_t val) ++{ ++ int retval = 0; ++ if (DWC_OTG_PARAM_TEST(val, 32, 32768)) { ++ DWC_WARN("Wrong value for data_fifo_size\n"); ++ DWC_WARN("data_fifo_size must be 32-32768\n"); ++ return -DWC_E_INVALID; ++ } ++ ++ if (val > core_if->hwcfg3.b.dfifo_depth) { ++ if (dwc_otg_param_initialized ++ (core_if->core_params->data_fifo_size)) { ++ DWC_ERROR ++ ("%d invalid for data_fifo_size parameter. Check HW configuration.\n", ++ val); ++ } ++ val = core_if->hwcfg3.b.dfifo_depth; ++ retval = -DWC_E_INVALID; ++ } ++ ++ core_if->core_params->data_fifo_size = val; ++ return retval; ++} ++ ++int32_t dwc_otg_get_param_data_fifo_size(dwc_otg_core_if_t * core_if) ++{ ++ return core_if->core_params->data_fifo_size; ++} ++ ++int dwc_otg_set_param_dev_rx_fifo_size(dwc_otg_core_if_t * core_if, int32_t val) ++{ ++ int retval = 0; ++ if (DWC_OTG_PARAM_TEST(val, 16, 32768)) { ++ DWC_WARN("Wrong value for dev_rx_fifo_size\n"); ++ DWC_WARN("dev_rx_fifo_size must be 16-32768\n"); ++ return -DWC_E_INVALID; ++ } ++ ++ if (val > DWC_READ_REG32(&core_if->core_global_regs->grxfsiz)) { ++ if (dwc_otg_param_initialized(core_if->core_params->dev_rx_fifo_size)) { ++ DWC_WARN("%d invalid for dev_rx_fifo_size parameter\n", val); ++ } ++ val = DWC_READ_REG32(&core_if->core_global_regs->grxfsiz); ++ retval = -DWC_E_INVALID; ++ } ++ ++ core_if->core_params->dev_rx_fifo_size = val; ++ return retval; ++} ++ ++int32_t dwc_otg_get_param_dev_rx_fifo_size(dwc_otg_core_if_t * core_if) ++{ ++ return core_if->core_params->dev_rx_fifo_size; ++} ++ ++int dwc_otg_set_param_dev_nperio_tx_fifo_size(dwc_otg_core_if_t * core_if, ++ int32_t val) ++{ ++ int retval = 0; ++ ++ if (DWC_OTG_PARAM_TEST(val, 16, 32768)) { ++ DWC_WARN("Wrong value for dev_nperio_tx_fifo\n"); ++ DWC_WARN("dev_nperio_tx_fifo must be 16-32768\n"); ++ return -DWC_E_INVALID; ++ } ++ ++ if (val > (DWC_READ_REG32(&core_if->core_global_regs->gnptxfsiz) >> 16)) { ++ if (dwc_otg_param_initialized ++ (core_if->core_params->dev_nperio_tx_fifo_size)) { ++ DWC_ERROR ++ ("%d invalid for dev_nperio_tx_fifo_size. Check HW configuration.\n", ++ val); ++ } ++ val = ++ (DWC_READ_REG32(&core_if->core_global_regs->gnptxfsiz) >> ++ 16); ++ retval = -DWC_E_INVALID; ++ } ++ ++ core_if->core_params->dev_nperio_tx_fifo_size = val; ++ return retval; ++} ++ ++int32_t dwc_otg_get_param_dev_nperio_tx_fifo_size(dwc_otg_core_if_t * core_if) ++{ ++ return core_if->core_params->dev_nperio_tx_fifo_size; ++} ++ ++int dwc_otg_set_param_host_rx_fifo_size(dwc_otg_core_if_t * core_if, ++ int32_t val) ++{ ++ int retval = 0; ++ ++ if (DWC_OTG_PARAM_TEST(val, 16, 32768)) { ++ DWC_WARN("Wrong value for host_rx_fifo_size\n"); ++ DWC_WARN("host_rx_fifo_size must be 16-32768\n"); ++ return -DWC_E_INVALID; ++ } ++ ++ if (val > DWC_READ_REG32(&core_if->core_global_regs->grxfsiz)) { ++ if (dwc_otg_param_initialized ++ (core_if->core_params->host_rx_fifo_size)) { ++ DWC_ERROR ++ ("%d invalid for host_rx_fifo_size. Check HW configuration.\n", ++ val); ++ } ++ val = DWC_READ_REG32(&core_if->core_global_regs->grxfsiz); ++ retval = -DWC_E_INVALID; ++ } ++ ++ core_if->core_params->host_rx_fifo_size = val; ++ return retval; ++ ++} ++ ++int32_t dwc_otg_get_param_host_rx_fifo_size(dwc_otg_core_if_t * core_if) ++{ ++ return core_if->core_params->host_rx_fifo_size; ++} ++ ++int dwc_otg_set_param_host_nperio_tx_fifo_size(dwc_otg_core_if_t * core_if, ++ int32_t val) ++{ ++ int retval = 0; ++ ++ if (DWC_OTG_PARAM_TEST(val, 16, 32768)) { ++ DWC_WARN("Wrong value for host_nperio_tx_fifo_size\n"); ++ DWC_WARN("host_nperio_tx_fifo_size must be 16-32768\n"); ++ return -DWC_E_INVALID; ++ } ++ ++ if (val > (DWC_READ_REG32(&core_if->core_global_regs->gnptxfsiz) >> 16)) { ++ if (dwc_otg_param_initialized ++ (core_if->core_params->host_nperio_tx_fifo_size)) { ++ DWC_ERROR ++ ("%d invalid for host_nperio_tx_fifo_size. Check HW configuration.\n", ++ val); ++ } ++ val = ++ (DWC_READ_REG32(&core_if->core_global_regs->gnptxfsiz) >> ++ 16); ++ retval = -DWC_E_INVALID; ++ } ++ ++ core_if->core_params->host_nperio_tx_fifo_size = val; ++ return retval; ++} ++ ++int32_t dwc_otg_get_param_host_nperio_tx_fifo_size(dwc_otg_core_if_t * core_if) ++{ ++ return core_if->core_params->host_nperio_tx_fifo_size; ++} ++ ++int dwc_otg_set_param_host_perio_tx_fifo_size(dwc_otg_core_if_t * core_if, ++ int32_t val) ++{ ++ int retval = 0; ++ if (DWC_OTG_PARAM_TEST(val, 16, 32768)) { ++ DWC_WARN("Wrong value for host_perio_tx_fifo_size\n"); ++ DWC_WARN("host_perio_tx_fifo_size must be 16-32768\n"); ++ return -DWC_E_INVALID; ++ } ++ ++ if (val > ((core_if->hptxfsiz.d32) >> 16)) { ++ if (dwc_otg_param_initialized ++ (core_if->core_params->host_perio_tx_fifo_size)) { ++ DWC_ERROR ++ ("%d invalid for host_perio_tx_fifo_size. Check HW configuration.\n", ++ val); ++ } ++ val = (core_if->hptxfsiz.d32) >> 16; ++ retval = -DWC_E_INVALID; ++ } ++ ++ core_if->core_params->host_perio_tx_fifo_size = val; ++ return retval; ++} ++ ++int32_t dwc_otg_get_param_host_perio_tx_fifo_size(dwc_otg_core_if_t * core_if) ++{ ++ return core_if->core_params->host_perio_tx_fifo_size; ++} ++ ++int dwc_otg_set_param_max_transfer_size(dwc_otg_core_if_t * core_if, ++ int32_t val) ++{ ++ int retval = 0; ++ ++ if (DWC_OTG_PARAM_TEST(val, 2047, 524288)) { ++ DWC_WARN("Wrong value for max_transfer_size\n"); ++ DWC_WARN("max_transfer_size must be 2047-524288\n"); ++ return -DWC_E_INVALID; ++ } ++ ++ if (val >= (1 << (core_if->hwcfg3.b.xfer_size_cntr_width + 11))) { ++ if (dwc_otg_param_initialized ++ (core_if->core_params->max_transfer_size)) { ++ DWC_ERROR ++ ("%d invalid for max_transfer_size. Check HW configuration.\n", ++ val); ++ } ++ val = ++ ((1 << (core_if->hwcfg3.b.packet_size_cntr_width + 11)) - ++ 1); ++ retval = -DWC_E_INVALID; ++ } ++ ++ core_if->core_params->max_transfer_size = val; ++ return retval; ++} ++ ++int32_t dwc_otg_get_param_max_transfer_size(dwc_otg_core_if_t * core_if) ++{ ++ return core_if->core_params->max_transfer_size; ++} ++ ++int dwc_otg_set_param_max_packet_count(dwc_otg_core_if_t * core_if, int32_t val) ++{ ++ int retval = 0; ++ ++ if (DWC_OTG_PARAM_TEST(val, 15, 511)) { ++ DWC_WARN("Wrong value for max_packet_count\n"); ++ DWC_WARN("max_packet_count must be 15-511\n"); ++ return -DWC_E_INVALID; ++ } ++ ++ if (val > (1 << (core_if->hwcfg3.b.packet_size_cntr_width + 4))) { ++ if (dwc_otg_param_initialized ++ (core_if->core_params->max_packet_count)) { ++ DWC_ERROR ++ ("%d invalid for max_packet_count. Check HW configuration.\n", ++ val); ++ } ++ val = ++ ((1 << (core_if->hwcfg3.b.packet_size_cntr_width + 4)) - 1); ++ retval = -DWC_E_INVALID; ++ } ++ ++ core_if->core_params->max_packet_count = val; ++ return retval; ++} ++ ++int32_t dwc_otg_get_param_max_packet_count(dwc_otg_core_if_t * core_if) ++{ ++ return core_if->core_params->max_packet_count; ++} ++ ++int dwc_otg_set_param_host_channels(dwc_otg_core_if_t * core_if, int32_t val) ++{ ++ int retval = 0; ++ ++ if (DWC_OTG_PARAM_TEST(val, 1, 16)) { ++ DWC_WARN("Wrong value for host_channels\n"); ++ DWC_WARN("host_channels must be 1-16\n"); ++ return -DWC_E_INVALID; ++ } ++ ++ if (val > (core_if->hwcfg2.b.num_host_chan + 1)) { ++ if (dwc_otg_param_initialized ++ (core_if->core_params->host_channels)) { ++ DWC_ERROR ++ ("%d invalid for host_channels. Check HW configurations.\n", ++ val); ++ } ++ val = (core_if->hwcfg2.b.num_host_chan + 1); ++ retval = -DWC_E_INVALID; ++ } ++ ++ core_if->core_params->host_channels = val; ++ return retval; ++} ++ ++int32_t dwc_otg_get_param_host_channels(dwc_otg_core_if_t * core_if) ++{ ++ return core_if->core_params->host_channels; ++} ++ ++int dwc_otg_set_param_dev_endpoints(dwc_otg_core_if_t * core_if, int32_t val) ++{ ++ int retval = 0; ++ ++ if (DWC_OTG_PARAM_TEST(val, 1, 15)) { ++ DWC_WARN("Wrong value for dev_endpoints\n"); ++ DWC_WARN("dev_endpoints must be 1-15\n"); ++ return -DWC_E_INVALID; ++ } ++ ++ if (val > (core_if->hwcfg2.b.num_dev_ep)) { ++ if (dwc_otg_param_initialized ++ (core_if->core_params->dev_endpoints)) { ++ DWC_ERROR ++ ("%d invalid for dev_endpoints. Check HW configurations.\n", ++ val); ++ } ++ val = core_if->hwcfg2.b.num_dev_ep; ++ retval = -DWC_E_INVALID; ++ } ++ ++ core_if->core_params->dev_endpoints = val; ++ return retval; ++} ++ ++int32_t dwc_otg_get_param_dev_endpoints(dwc_otg_core_if_t * core_if) ++{ ++ return core_if->core_params->dev_endpoints; ++} ++ ++int dwc_otg_set_param_phy_type(dwc_otg_core_if_t * core_if, int32_t val) ++{ ++ int retval = 0; ++ int valid = 0; ++ ++ if (DWC_OTG_PARAM_TEST(val, 0, 2)) { ++ DWC_WARN("Wrong value for phy_type\n"); ++ DWC_WARN("phy_type must be 0,1 or 2\n"); ++ return -DWC_E_INVALID; ++ } ++#ifndef NO_FS_PHY_HW_CHECKS ++ if ((val == DWC_PHY_TYPE_PARAM_UTMI) && ++ ((core_if->hwcfg2.b.hs_phy_type == 1) || ++ (core_if->hwcfg2.b.hs_phy_type == 3))) { ++ valid = 1; ++ } else if ((val == DWC_PHY_TYPE_PARAM_ULPI) && ++ ((core_if->hwcfg2.b.hs_phy_type == 2) || ++ (core_if->hwcfg2.b.hs_phy_type == 3))) { ++ valid = 1; ++ } else if ((val == DWC_PHY_TYPE_PARAM_FS) && ++ (core_if->hwcfg2.b.fs_phy_type == 1)) { ++ valid = 1; ++ } ++ if (!valid) { ++ if (dwc_otg_param_initialized(core_if->core_params->phy_type)) { ++ DWC_ERROR ++ ("%d invalid for phy_type. Check HW configurations.\n", ++ val); ++ } ++ if (core_if->hwcfg2.b.hs_phy_type) { ++ if ((core_if->hwcfg2.b.hs_phy_type == 3) || ++ (core_if->hwcfg2.b.hs_phy_type == 1)) { ++ val = DWC_PHY_TYPE_PARAM_UTMI; ++ } else { ++ val = DWC_PHY_TYPE_PARAM_ULPI; ++ } ++ } ++ retval = -DWC_E_INVALID; ++ } ++#endif ++ core_if->core_params->phy_type = val; ++ return retval; ++} ++ ++int32_t dwc_otg_get_param_phy_type(dwc_otg_core_if_t * core_if) ++{ ++ return core_if->core_params->phy_type; ++} ++ ++int dwc_otg_set_param_speed(dwc_otg_core_if_t * core_if, int32_t val) ++{ ++ int retval = 0; ++ if (DWC_OTG_PARAM_TEST(val, 0, 1)) { ++ DWC_WARN("Wrong value for speed parameter\n"); ++ DWC_WARN("max_speed parameter must be 0 or 1\n"); ++ return -DWC_E_INVALID; ++ } ++ if ((val == 0) ++ && dwc_otg_get_param_phy_type(core_if) == DWC_PHY_TYPE_PARAM_FS) { ++ if (dwc_otg_param_initialized(core_if->core_params->speed)) { ++ DWC_ERROR ++ ("%d invalid for speed paremter. Check HW configuration.\n", ++ val); ++ } ++ val = ++ (dwc_otg_get_param_phy_type(core_if) == ++ DWC_PHY_TYPE_PARAM_FS ? 1 : 0); ++ retval = -DWC_E_INVALID; ++ } ++ core_if->core_params->speed = val; ++ return retval; ++} ++ ++int32_t dwc_otg_get_param_speed(dwc_otg_core_if_t * core_if) ++{ ++ return core_if->core_params->speed; ++} ++ ++int dwc_otg_set_param_host_ls_low_power_phy_clk(dwc_otg_core_if_t * core_if, ++ int32_t val) ++{ ++ int retval = 0; ++ ++ if (DWC_OTG_PARAM_TEST(val, 0, 1)) { ++ DWC_WARN ++ ("Wrong value for host_ls_low_power_phy_clk parameter\n"); ++ DWC_WARN("host_ls_low_power_phy_clk must be 0 or 1\n"); ++ return -DWC_E_INVALID; ++ } ++ ++ if ((val == DWC_HOST_LS_LOW_POWER_PHY_CLK_PARAM_48MHZ) ++ && (dwc_otg_get_param_phy_type(core_if) == DWC_PHY_TYPE_PARAM_FS)) { ++ if (dwc_otg_param_initialized ++ (core_if->core_params->host_ls_low_power_phy_clk)) { ++ DWC_ERROR ++ ("%d invalid for host_ls_low_power_phy_clk. Check HW configuration.\n", ++ val); ++ } ++ val = ++ (dwc_otg_get_param_phy_type(core_if) == ++ DWC_PHY_TYPE_PARAM_FS) ? ++ DWC_HOST_LS_LOW_POWER_PHY_CLK_PARAM_6MHZ : ++ DWC_HOST_LS_LOW_POWER_PHY_CLK_PARAM_48MHZ; ++ retval = -DWC_E_INVALID; ++ } ++ ++ core_if->core_params->host_ls_low_power_phy_clk = val; ++ return retval; ++} ++ ++int32_t dwc_otg_get_param_host_ls_low_power_phy_clk(dwc_otg_core_if_t * core_if) ++{ ++ return core_if->core_params->host_ls_low_power_phy_clk; ++} ++ ++int dwc_otg_set_param_phy_ulpi_ddr(dwc_otg_core_if_t * core_if, int32_t val) ++{ ++ if (DWC_OTG_PARAM_TEST(val, 0, 1)) { ++ DWC_WARN("Wrong value for phy_ulpi_ddr\n"); ++ DWC_WARN("phy_upli_ddr must be 0 or 1\n"); ++ return -DWC_E_INVALID; ++ } ++ ++ core_if->core_params->phy_ulpi_ddr = val; ++ return 0; ++} ++ ++int32_t dwc_otg_get_param_phy_ulpi_ddr(dwc_otg_core_if_t * core_if) ++{ ++ return core_if->core_params->phy_ulpi_ddr; ++} ++ ++int dwc_otg_set_param_phy_ulpi_ext_vbus(dwc_otg_core_if_t * core_if, ++ int32_t val) ++{ ++ if (DWC_OTG_PARAM_TEST(val, 0, 1)) { ++ DWC_WARN("Wrong valaue for phy_ulpi_ext_vbus\n"); ++ DWC_WARN("phy_ulpi_ext_vbus must be 0 or 1\n"); ++ return -DWC_E_INVALID; ++ } ++ ++ core_if->core_params->phy_ulpi_ext_vbus = val; ++ return 0; ++} ++ ++int32_t dwc_otg_get_param_phy_ulpi_ext_vbus(dwc_otg_core_if_t * core_if) ++{ ++ return core_if->core_params->phy_ulpi_ext_vbus; ++} ++ ++int dwc_otg_set_param_phy_utmi_width(dwc_otg_core_if_t * core_if, int32_t val) ++{ ++ if (DWC_OTG_PARAM_TEST(val, 8, 8) && DWC_OTG_PARAM_TEST(val, 16, 16)) { ++ DWC_WARN("Wrong valaue for phy_utmi_width\n"); ++ DWC_WARN("phy_utmi_width must be 8 or 16\n"); ++ return -DWC_E_INVALID; ++ } ++ ++ core_if->core_params->phy_utmi_width = val; ++ return 0; ++} ++ ++int32_t dwc_otg_get_param_phy_utmi_width(dwc_otg_core_if_t * core_if) ++{ ++ return core_if->core_params->phy_utmi_width; ++} ++ ++int dwc_otg_set_param_ulpi_fs_ls(dwc_otg_core_if_t * core_if, int32_t val) ++{ ++ if (DWC_OTG_PARAM_TEST(val, 0, 1)) { ++ DWC_WARN("Wrong valaue for ulpi_fs_ls\n"); ++ DWC_WARN("ulpi_fs_ls must be 0 or 1\n"); ++ return -DWC_E_INVALID; ++ } ++ ++ core_if->core_params->ulpi_fs_ls = val; ++ return 0; ++} ++ ++int32_t dwc_otg_get_param_ulpi_fs_ls(dwc_otg_core_if_t * core_if) ++{ ++ return core_if->core_params->ulpi_fs_ls; ++} ++ ++int dwc_otg_set_param_ts_dline(dwc_otg_core_if_t * core_if, int32_t val) ++{ ++ if (DWC_OTG_PARAM_TEST(val, 0, 1)) { ++ DWC_WARN("Wrong valaue for ts_dline\n"); ++ DWC_WARN("ts_dline must be 0 or 1\n"); ++ return -DWC_E_INVALID; ++ } ++ ++ core_if->core_params->ts_dline = val; ++ return 0; ++} ++ ++int32_t dwc_otg_get_param_ts_dline(dwc_otg_core_if_t * core_if) ++{ ++ return core_if->core_params->ts_dline; ++} ++ ++int dwc_otg_set_param_i2c_enable(dwc_otg_core_if_t * core_if, int32_t val) ++{ ++ int retval = 0; ++ if (DWC_OTG_PARAM_TEST(val, 0, 1)) { ++ DWC_WARN("Wrong valaue for i2c_enable\n"); ++ DWC_WARN("i2c_enable must be 0 or 1\n"); ++ return -DWC_E_INVALID; ++ } ++#ifndef NO_FS_PHY_HW_CHECK ++ if (val == 1 && core_if->hwcfg3.b.i2c == 0) { ++ if (dwc_otg_param_initialized(core_if->core_params->i2c_enable)) { ++ DWC_ERROR ++ ("%d invalid for i2c_enable. Check HW configuration.\n", ++ val); ++ } ++ val = 0; ++ retval = -DWC_E_INVALID; ++ } ++#endif ++ ++ core_if->core_params->i2c_enable = val; ++ return retval; ++} ++ ++int32_t dwc_otg_get_param_i2c_enable(dwc_otg_core_if_t * core_if) ++{ ++ return core_if->core_params->i2c_enable; ++} ++ ++int dwc_otg_set_param_dev_perio_tx_fifo_size(dwc_otg_core_if_t * core_if, ++ int32_t val, int fifo_num) ++{ ++ int retval = 0; ++ ++ if (DWC_OTG_PARAM_TEST(val, 4, 768)) { ++ DWC_WARN("Wrong value for dev_perio_tx_fifo_size\n"); ++ DWC_WARN("dev_perio_tx_fifo_size must be 4-768\n"); ++ return -DWC_E_INVALID; ++ } ++ ++ if (val > ++ (DWC_READ_REG32(&core_if->core_global_regs->dtxfsiz[fifo_num]))) { ++ if (dwc_otg_param_initialized ++ (core_if->core_params->dev_perio_tx_fifo_size[fifo_num])) { ++ DWC_ERROR ++ ("`%d' invalid for parameter `dev_perio_fifo_size_%d'. Check HW configuration.\n", ++ val, fifo_num); ++ } ++ val = (DWC_READ_REG32(&core_if->core_global_regs->dtxfsiz[fifo_num])); ++ retval = -DWC_E_INVALID; ++ } ++ ++ core_if->core_params->dev_perio_tx_fifo_size[fifo_num] = val; ++ return retval; ++} ++ ++int32_t dwc_otg_get_param_dev_perio_tx_fifo_size(dwc_otg_core_if_t * core_if, ++ int fifo_num) ++{ ++ return core_if->core_params->dev_perio_tx_fifo_size[fifo_num]; ++} ++ ++int dwc_otg_set_param_en_multiple_tx_fifo(dwc_otg_core_if_t * core_if, ++ int32_t val) ++{ ++ int retval = 0; ++ if (DWC_OTG_PARAM_TEST(val, 0, 1)) { ++ DWC_WARN("Wrong valaue for en_multiple_tx_fifo,\n"); ++ DWC_WARN("en_multiple_tx_fifo must be 0 or 1\n"); ++ return -DWC_E_INVALID; ++ } ++ ++ if (val == 1 && core_if->hwcfg4.b.ded_fifo_en == 0) { ++ if (dwc_otg_param_initialized ++ (core_if->core_params->en_multiple_tx_fifo)) { ++ DWC_ERROR ++ ("%d invalid for parameter en_multiple_tx_fifo. Check HW configuration.\n", ++ val); ++ } ++ val = 0; ++ retval = -DWC_E_INVALID; ++ } ++ ++ core_if->core_params->en_multiple_tx_fifo = val; ++ return retval; ++} ++ ++int32_t dwc_otg_get_param_en_multiple_tx_fifo(dwc_otg_core_if_t * core_if) ++{ ++ return core_if->core_params->en_multiple_tx_fifo; ++} ++ ++int dwc_otg_set_param_dev_tx_fifo_size(dwc_otg_core_if_t * core_if, int32_t val, ++ int fifo_num) ++{ ++ int retval = 0; ++ ++ if (DWC_OTG_PARAM_TEST(val, 4, 768)) { ++ DWC_WARN("Wrong value for dev_tx_fifo_size\n"); ++ DWC_WARN("dev_tx_fifo_size must be 4-768\n"); ++ return -DWC_E_INVALID; ++ } ++ ++ if (val > ++ (DWC_READ_REG32(&core_if->core_global_regs->dtxfsiz[fifo_num]))) { ++ if (dwc_otg_param_initialized ++ (core_if->core_params->dev_tx_fifo_size[fifo_num])) { ++ DWC_ERROR ++ ("`%d' invalid for parameter `dev_tx_fifo_size_%d'. Check HW configuration.\n", ++ val, fifo_num); ++ } ++ val = (DWC_READ_REG32(&core_if->core_global_regs->dtxfsiz[fifo_num])); ++ retval = -DWC_E_INVALID; ++ } ++ ++ core_if->core_params->dev_tx_fifo_size[fifo_num] = val; ++ return retval; ++} ++ ++int32_t dwc_otg_get_param_dev_tx_fifo_size(dwc_otg_core_if_t * core_if, ++ int fifo_num) ++{ ++ return core_if->core_params->dev_tx_fifo_size[fifo_num]; ++} ++ ++int dwc_otg_set_param_thr_ctl(dwc_otg_core_if_t * core_if, int32_t val) ++{ ++ int retval = 0; ++ ++ if (DWC_OTG_PARAM_TEST(val, 0, 7)) { ++ DWC_WARN("Wrong value for thr_ctl\n"); ++ DWC_WARN("thr_ctl must be 0-7\n"); ++ return -DWC_E_INVALID; ++ } ++ ++ if ((val != 0) && ++ (!dwc_otg_get_param_dma_enable(core_if) || ++ !core_if->hwcfg4.b.ded_fifo_en)) { ++ if (dwc_otg_param_initialized(core_if->core_params->thr_ctl)) { ++ DWC_ERROR ++ ("%d invalid for parameter thr_ctl. Check HW configuration.\n", ++ val); ++ } ++ val = 0; ++ retval = -DWC_E_INVALID; ++ } ++ ++ core_if->core_params->thr_ctl = val; ++ return retval; ++} ++ ++int32_t dwc_otg_get_param_thr_ctl(dwc_otg_core_if_t * core_if) ++{ ++ return core_if->core_params->thr_ctl; ++} ++ ++int dwc_otg_set_param_lpm_enable(dwc_otg_core_if_t * core_if, int32_t val) ++{ ++ int retval = 0; ++ ++ if (DWC_OTG_PARAM_TEST(val, 0, 1)) { ++ DWC_WARN("Wrong value for lpm_enable\n"); ++ DWC_WARN("lpm_enable must be 0 or 1\n"); ++ return -DWC_E_INVALID; ++ } ++ ++ if (val && !core_if->hwcfg3.b.otg_lpm_en) { ++ if (dwc_otg_param_initialized(core_if->core_params->lpm_enable)) { ++ DWC_ERROR ++ ("%d invalid for parameter lpm_enable. Check HW configuration.\n", ++ val); ++ } ++ val = 0; ++ retval = -DWC_E_INVALID; ++ } ++ ++ core_if->core_params->lpm_enable = val; ++ return retval; ++} ++ ++int32_t dwc_otg_get_param_lpm_enable(dwc_otg_core_if_t * core_if) ++{ ++ return core_if->core_params->lpm_enable; ++} ++ ++int dwc_otg_set_param_tx_thr_length(dwc_otg_core_if_t * core_if, int32_t val) ++{ ++ if (DWC_OTG_PARAM_TEST(val, 8, 128)) { ++ DWC_WARN("Wrong valaue for tx_thr_length\n"); ++ DWC_WARN("tx_thr_length must be 8 - 128\n"); ++ return -DWC_E_INVALID; ++ } ++ ++ core_if->core_params->tx_thr_length = val; ++ return 0; ++} ++ ++int32_t dwc_otg_get_param_tx_thr_length(dwc_otg_core_if_t * core_if) ++{ ++ return core_if->core_params->tx_thr_length; ++} ++ ++int dwc_otg_set_param_rx_thr_length(dwc_otg_core_if_t * core_if, int32_t val) ++{ ++ if (DWC_OTG_PARAM_TEST(val, 8, 128)) { ++ DWC_WARN("Wrong valaue for rx_thr_length\n"); ++ DWC_WARN("rx_thr_length must be 8 - 128\n"); ++ return -DWC_E_INVALID; ++ } ++ ++ core_if->core_params->rx_thr_length = val; ++ return 0; ++} ++ ++int32_t dwc_otg_get_param_rx_thr_length(dwc_otg_core_if_t * core_if) ++{ ++ return core_if->core_params->rx_thr_length; ++} ++ ++int dwc_otg_set_param_dma_burst_size(dwc_otg_core_if_t * core_if, int32_t val) ++{ ++ if (DWC_OTG_PARAM_TEST(val, 1, 1) && ++ DWC_OTG_PARAM_TEST(val, 4, 4) && ++ DWC_OTG_PARAM_TEST(val, 8, 8) && ++ DWC_OTG_PARAM_TEST(val, 16, 16) && ++ DWC_OTG_PARAM_TEST(val, 32, 32) && ++ DWC_OTG_PARAM_TEST(val, 64, 64) && ++ DWC_OTG_PARAM_TEST(val, 128, 128) && ++ DWC_OTG_PARAM_TEST(val, 256, 256)) { ++ DWC_WARN("`%d' invalid for parameter `dma_burst_size'\n", val); ++ return -DWC_E_INVALID; ++ } ++ core_if->core_params->dma_burst_size = val; ++ return 0; ++} ++ ++int32_t dwc_otg_get_param_dma_burst_size(dwc_otg_core_if_t * core_if) ++{ ++ return core_if->core_params->dma_burst_size; ++} ++ ++int dwc_otg_set_param_pti_enable(dwc_otg_core_if_t * core_if, int32_t val) ++{ ++ int retval = 0; ++ if (DWC_OTG_PARAM_TEST(val, 0, 1)) { ++ DWC_WARN("`%d' invalid for parameter `pti_enable'\n", val); ++ return -DWC_E_INVALID; ++ } ++ if (val && (core_if->snpsid < OTG_CORE_REV_2_72a)) { ++ if (dwc_otg_param_initialized(core_if->core_params->pti_enable)) { ++ DWC_ERROR ++ ("%d invalid for parameter pti_enable. Check HW configuration.\n", ++ val); ++ } ++ retval = -DWC_E_INVALID; ++ val = 0; ++ } ++ core_if->core_params->pti_enable = val; ++ return retval; ++} ++ ++int32_t dwc_otg_get_param_pti_enable(dwc_otg_core_if_t * core_if) ++{ ++ return core_if->core_params->pti_enable; ++} ++ ++int dwc_otg_set_param_mpi_enable(dwc_otg_core_if_t * core_if, int32_t val) ++{ ++ int retval = 0; ++ if (DWC_OTG_PARAM_TEST(val, 0, 1)) { ++ DWC_WARN("`%d' invalid for parameter `mpi_enable'\n", val); ++ return -DWC_E_INVALID; ++ } ++ if (val && (core_if->hwcfg2.b.multi_proc_int == 0)) { ++ if (dwc_otg_param_initialized(core_if->core_params->mpi_enable)) { ++ DWC_ERROR ++ ("%d invalid for parameter mpi_enable. Check HW configuration.\n", ++ val); ++ } ++ retval = -DWC_E_INVALID; ++ val = 0; ++ } ++ core_if->core_params->mpi_enable = val; ++ return retval; ++} ++ ++int32_t dwc_otg_get_param_mpi_enable(dwc_otg_core_if_t * core_if) ++{ ++ return core_if->core_params->mpi_enable; ++} ++ ++int dwc_otg_set_param_adp_enable(dwc_otg_core_if_t * core_if, int32_t val) ++{ ++ int retval = 0; ++ if (DWC_OTG_PARAM_TEST(val, 0, 1)) { ++ DWC_WARN("`%d' invalid for parameter `adp_enable'\n", val); ++ return -DWC_E_INVALID; ++ } ++ if (val && (core_if->hwcfg3.b.adp_supp == 0)) { ++ if (dwc_otg_param_initialized ++ (core_if->core_params->adp_supp_enable)) { ++ DWC_ERROR ++ ("%d invalid for parameter adp_enable. Check HW configuration.\n", ++ val); ++ } ++ retval = -DWC_E_INVALID; ++ val = 0; ++ } ++ core_if->core_params->adp_supp_enable = val; ++ /*Set OTG version 2.0 in case of enabling ADP*/ ++ if (val) ++ dwc_otg_set_param_otg_ver(core_if, 1); ++ ++ return retval; ++} ++ ++int32_t dwc_otg_get_param_adp_enable(dwc_otg_core_if_t * core_if) ++{ ++ return core_if->core_params->adp_supp_enable; ++} ++ ++int dwc_otg_set_param_ic_usb_cap(dwc_otg_core_if_t * core_if, int32_t val) ++{ ++ int retval = 0; ++ if (DWC_OTG_PARAM_TEST(val, 0, 1)) { ++ DWC_WARN("`%d' invalid for parameter `ic_usb_cap'\n", val); ++ DWC_WARN("ic_usb_cap must be 0 or 1\n"); ++ return -DWC_E_INVALID; ++ } ++ ++ if (val && (core_if->hwcfg2.b.otg_enable_ic_usb == 0)) { ++ if (dwc_otg_param_initialized(core_if->core_params->ic_usb_cap)) { ++ DWC_ERROR ++ ("%d invalid for parameter ic_usb_cap. Check HW configuration.\n", ++ val); ++ } ++ retval = -DWC_E_INVALID; ++ val = 0; ++ } ++ core_if->core_params->ic_usb_cap = val; ++ return retval; ++} ++ ++int32_t dwc_otg_get_param_ic_usb_cap(dwc_otg_core_if_t * core_if) ++{ ++ return core_if->core_params->ic_usb_cap; ++} ++ ++int dwc_otg_set_param_ahb_thr_ratio(dwc_otg_core_if_t * core_if, int32_t val) ++{ ++ int retval = 0; ++ int valid = 1; ++ ++ if (DWC_OTG_PARAM_TEST(val, 0, 3)) { ++ DWC_WARN("`%d' invalid for parameter `ahb_thr_ratio'\n", val); ++ DWC_WARN("ahb_thr_ratio must be 0 - 3\n"); ++ return -DWC_E_INVALID; ++ } ++ ++ if (val ++ && (core_if->snpsid < OTG_CORE_REV_2_81a ++ || !dwc_otg_get_param_thr_ctl(core_if))) { ++ valid = 0; ++ } else if (val ++ && ((dwc_otg_get_param_tx_thr_length(core_if) / (1 << val)) < ++ 4)) { ++ valid = 0; ++ } ++ if (valid == 0) { ++ if (dwc_otg_param_initialized ++ (core_if->core_params->ahb_thr_ratio)) { ++ DWC_ERROR ++ ("%d invalid for parameter ahb_thr_ratio. Check HW configuration.\n", ++ val); ++ } ++ retval = -DWC_E_INVALID; ++ val = 0; ++ } ++ ++ core_if->core_params->ahb_thr_ratio = val; ++ return retval; ++} ++ ++int32_t dwc_otg_get_param_ahb_thr_ratio(dwc_otg_core_if_t * core_if) ++{ ++ return core_if->core_params->ahb_thr_ratio; ++} ++ ++int dwc_otg_set_param_power_down(dwc_otg_core_if_t * core_if, int32_t val) ++{ ++ int retval = 0; ++ int valid = 1; ++ hwcfg4_data_t hwcfg4 = {.d32 = 0 }; ++ hwcfg4.d32 = DWC_READ_REG32(&core_if->core_global_regs->ghwcfg4); ++ ++ if (DWC_OTG_PARAM_TEST(val, 0, 3)) { ++ DWC_WARN("`%d' invalid for parameter `power_down'\n", val); ++ DWC_WARN("power_down must be 0 - 2\n"); ++ return -DWC_E_INVALID; ++ } ++ ++ if ((val == 2) && (core_if->snpsid < OTG_CORE_REV_2_91a)) { ++ valid = 0; ++ } ++ if ((val == 3) ++ && ((core_if->snpsid < OTG_CORE_REV_3_00a) ++ || (hwcfg4.b.xhiber == 0))) { ++ valid = 0; ++ } ++ if (valid == 0) { ++ if (dwc_otg_param_initialized(core_if->core_params->power_down)) { ++ DWC_ERROR ++ ("%d invalid for parameter power_down. Check HW configuration.\n", ++ val); ++ } ++ retval = -DWC_E_INVALID; ++ val = 0; ++ } ++ core_if->core_params->power_down = val; ++ return retval; ++} ++ ++int32_t dwc_otg_get_param_power_down(dwc_otg_core_if_t * core_if) ++{ ++ return core_if->core_params->power_down; ++} ++ ++int dwc_otg_set_param_reload_ctl(dwc_otg_core_if_t * core_if, int32_t val) ++{ ++ int retval = 0; ++ int valid = 1; ++ ++ if (DWC_OTG_PARAM_TEST(val, 0, 1)) { ++ DWC_WARN("`%d' invalid for parameter `reload_ctl'\n", val); ++ DWC_WARN("reload_ctl must be 0 or 1\n"); ++ return -DWC_E_INVALID; ++ } ++ ++ if ((val == 1) && (core_if->snpsid < OTG_CORE_REV_2_92a)) { ++ valid = 0; ++ } ++ if (valid == 0) { ++ if (dwc_otg_param_initialized(core_if->core_params->reload_ctl)) { ++ DWC_ERROR("%d invalid for parameter reload_ctl." ++ "Check HW configuration.\n", val); ++ } ++ retval = -DWC_E_INVALID; ++ val = 0; ++ } ++ core_if->core_params->reload_ctl = val; ++ return retval; ++} ++ ++int32_t dwc_otg_get_param_reload_ctl(dwc_otg_core_if_t * core_if) ++{ ++ return core_if->core_params->reload_ctl; ++} ++ ++int dwc_otg_set_param_dev_out_nak(dwc_otg_core_if_t * core_if, int32_t val) ++{ ++ int retval = 0; ++ int valid = 1; ++ ++ if (DWC_OTG_PARAM_TEST(val, 0, 1)) { ++ DWC_WARN("`%d' invalid for parameter `dev_out_nak'\n", val); ++ DWC_WARN("dev_out_nak must be 0 or 1\n"); ++ return -DWC_E_INVALID; ++ } ++ ++ if ((val == 1) && ((core_if->snpsid < OTG_CORE_REV_2_93a) || ++ !(core_if->core_params->dma_desc_enable))) { ++ valid = 0; ++ } ++ if (valid == 0) { ++ if (dwc_otg_param_initialized(core_if->core_params->dev_out_nak)) { ++ DWC_ERROR("%d invalid for parameter dev_out_nak." ++ "Check HW configuration.\n", val); ++ } ++ retval = -DWC_E_INVALID; ++ val = 0; ++ } ++ core_if->core_params->dev_out_nak = val; ++ return retval; ++} ++ ++int32_t dwc_otg_get_param_dev_out_nak(dwc_otg_core_if_t * core_if) ++{ ++ return core_if->core_params->dev_out_nak; ++} ++ ++int dwc_otg_set_param_cont_on_bna(dwc_otg_core_if_t * core_if, int32_t val) ++{ ++ int retval = 0; ++ int valid = 1; ++ ++ if (DWC_OTG_PARAM_TEST(val, 0, 1)) { ++ DWC_WARN("`%d' invalid for parameter `cont_on_bna'\n", val); ++ DWC_WARN("cont_on_bna must be 0 or 1\n"); ++ return -DWC_E_INVALID; ++ } ++ ++ if ((val == 1) && ((core_if->snpsid < OTG_CORE_REV_2_94a) || ++ !(core_if->core_params->dma_desc_enable))) { ++ valid = 0; ++ } ++ if (valid == 0) { ++ if (dwc_otg_param_initialized(core_if->core_params->cont_on_bna)) { ++ DWC_ERROR("%d invalid for parameter cont_on_bna." ++ "Check HW configuration.\n", val); ++ } ++ retval = -DWC_E_INVALID; ++ val = 0; ++ } ++ core_if->core_params->cont_on_bna = val; ++ return retval; ++} ++ ++int32_t dwc_otg_get_param_cont_on_bna(dwc_otg_core_if_t * core_if) ++{ ++ return core_if->core_params->cont_on_bna; ++} ++ ++int dwc_otg_set_param_ahb_single(dwc_otg_core_if_t * core_if, int32_t val) ++{ ++ int retval = 0; ++ int valid = 1; ++ ++ if (DWC_OTG_PARAM_TEST(val, 0, 1)) { ++ DWC_WARN("`%d' invalid for parameter `ahb_single'\n", val); ++ DWC_WARN("ahb_single must be 0 or 1\n"); ++ return -DWC_E_INVALID; ++ } ++ ++ if ((val == 1) && (core_if->snpsid < OTG_CORE_REV_2_94a)) { ++ valid = 0; ++ } ++ if (valid == 0) { ++ if (dwc_otg_param_initialized(core_if->core_params->ahb_single)) { ++ DWC_ERROR("%d invalid for parameter ahb_single." ++ "Check HW configuration.\n", val); ++ } ++ retval = -DWC_E_INVALID; ++ val = 0; ++ } ++ core_if->core_params->ahb_single = val; ++ return retval; ++} ++ ++int32_t dwc_otg_get_param_ahb_single(dwc_otg_core_if_t * core_if) ++{ ++ return core_if->core_params->ahb_single; ++} ++ ++int dwc_otg_set_param_otg_ver(dwc_otg_core_if_t * core_if, int32_t val) ++{ ++ int retval = 0; ++ ++ if (DWC_OTG_PARAM_TEST(val, 0, 1)) { ++ DWC_WARN("`%d' invalid for parameter `otg_ver'\n", val); ++ DWC_WARN ++ ("otg_ver must be 0(for OTG 1.3 support) or 1(for OTG 2.0 support)\n"); ++ return -DWC_E_INVALID; ++ } ++ ++ core_if->core_params->otg_ver = val; ++ return retval; ++} ++ ++int32_t dwc_otg_get_param_otg_ver(dwc_otg_core_if_t * core_if) ++{ ++ return core_if->core_params->otg_ver; ++} ++ ++uint32_t dwc_otg_get_hnpstatus(dwc_otg_core_if_t * core_if) ++{ ++ gotgctl_data_t otgctl; ++ otgctl.d32 = DWC_READ_REG32(&core_if->core_global_regs->gotgctl); ++ return otgctl.b.hstnegscs; ++} ++ ++uint32_t dwc_otg_get_srpstatus(dwc_otg_core_if_t * core_if) ++{ ++ gotgctl_data_t otgctl; ++ otgctl.d32 = DWC_READ_REG32(&core_if->core_global_regs->gotgctl); ++ return otgctl.b.sesreqscs; ++} ++ ++void dwc_otg_set_hnpreq(dwc_otg_core_if_t * core_if, uint32_t val) ++{ ++ if(core_if->otg_ver == 0) { ++ gotgctl_data_t otgctl; ++ otgctl.d32 = DWC_READ_REG32(&core_if->core_global_regs->gotgctl); ++ otgctl.b.hnpreq = val; ++ DWC_WRITE_REG32(&core_if->core_global_regs->gotgctl, otgctl.d32); ++ } else { ++ core_if->otg_sts = val; ++ } ++} ++ ++uint32_t dwc_otg_get_gsnpsid(dwc_otg_core_if_t * core_if) ++{ ++ return core_if->snpsid; ++} ++ ++uint32_t dwc_otg_get_mode(dwc_otg_core_if_t * core_if) ++{ ++ gintsts_data_t gintsts; ++ gintsts.d32 = DWC_READ_REG32(&core_if->core_global_regs->gintsts); ++ return gintsts.b.curmode; ++} ++ ++uint32_t dwc_otg_get_hnpcapable(dwc_otg_core_if_t * core_if) ++{ ++ gusbcfg_data_t usbcfg; ++ usbcfg.d32 = DWC_READ_REG32(&core_if->core_global_regs->gusbcfg); ++ return usbcfg.b.hnpcap; ++} ++ ++void dwc_otg_set_hnpcapable(dwc_otg_core_if_t * core_if, uint32_t val) ++{ ++ gusbcfg_data_t usbcfg; ++ usbcfg.d32 = DWC_READ_REG32(&core_if->core_global_regs->gusbcfg); ++ usbcfg.b.hnpcap = val; ++ DWC_WRITE_REG32(&core_if->core_global_regs->gusbcfg, usbcfg.d32); ++} ++ ++uint32_t dwc_otg_get_srpcapable(dwc_otg_core_if_t * core_if) ++{ ++ gusbcfg_data_t usbcfg; ++ usbcfg.d32 = DWC_READ_REG32(&core_if->core_global_regs->gusbcfg); ++ return usbcfg.b.srpcap; ++} ++ ++void dwc_otg_set_srpcapable(dwc_otg_core_if_t * core_if, uint32_t val) ++{ ++ gusbcfg_data_t usbcfg; ++ usbcfg.d32 = DWC_READ_REG32(&core_if->core_global_regs->gusbcfg); ++ usbcfg.b.srpcap = val; ++ DWC_WRITE_REG32(&core_if->core_global_regs->gusbcfg, usbcfg.d32); ++} ++ ++uint32_t dwc_otg_get_devspeed(dwc_otg_core_if_t * core_if) ++{ ++ dcfg_data_t dcfg; ++ /* originally: dcfg.d32 = DWC_READ_REG32(&core_if->dev_if->dev_global_regs->dcfg); */ ++ ++ dcfg.d32 = -1; //GRAYG ++ DWC_DEBUGPL(DBG_CILV, "%s - core_if(%p)\n", __func__, core_if); ++ if (NULL == core_if) ++ DWC_ERROR("reg request with NULL core_if\n"); ++ DWC_DEBUGPL(DBG_CILV, "%s - core_if(%p)->dev_if(%p)\n", __func__, ++ core_if, core_if->dev_if); ++ if (NULL == core_if->dev_if) ++ DWC_ERROR("reg request with NULL dev_if\n"); ++ DWC_DEBUGPL(DBG_CILV, "%s - core_if(%p)->dev_if(%p)->" ++ "dev_global_regs(%p)\n", __func__, ++ core_if, core_if->dev_if, ++ core_if->dev_if->dev_global_regs); ++ if (NULL == core_if->dev_if->dev_global_regs) ++ DWC_ERROR("reg request with NULL dev_global_regs\n"); ++ else { ++ DWC_DEBUGPL(DBG_CILV, "%s - &core_if(%p)->dev_if(%p)->" ++ "dev_global_regs(%p)->dcfg = %p\n", __func__, ++ core_if, core_if->dev_if, ++ core_if->dev_if->dev_global_regs, ++ &core_if->dev_if->dev_global_regs->dcfg); ++ dcfg.d32 = DWC_READ_REG32(&core_if->dev_if->dev_global_regs->dcfg); ++ } ++ return dcfg.b.devspd; ++} ++ ++void dwc_otg_set_devspeed(dwc_otg_core_if_t * core_if, uint32_t val) ++{ ++ dcfg_data_t dcfg; ++ dcfg.d32 = DWC_READ_REG32(&core_if->dev_if->dev_global_regs->dcfg); ++ dcfg.b.devspd = val; ++ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->dcfg, dcfg.d32); ++} ++ ++uint32_t dwc_otg_get_busconnected(dwc_otg_core_if_t * core_if) ++{ ++ hprt0_data_t hprt0; ++ hprt0.d32 = DWC_READ_REG32(core_if->host_if->hprt0); ++ return hprt0.b.prtconnsts; ++} ++ ++uint32_t dwc_otg_get_enumspeed(dwc_otg_core_if_t * core_if) ++{ ++ dsts_data_t dsts; ++ dsts.d32 = DWC_READ_REG32(&core_if->dev_if->dev_global_regs->dsts); ++ return dsts.b.enumspd; ++} ++ ++uint32_t dwc_otg_get_prtpower(dwc_otg_core_if_t * core_if) ++{ ++ hprt0_data_t hprt0; ++ hprt0.d32 = DWC_READ_REG32(core_if->host_if->hprt0); ++ return hprt0.b.prtpwr; ++ ++} ++ ++uint32_t dwc_otg_get_core_state(dwc_otg_core_if_t * core_if) ++{ ++ return core_if->hibernation_suspend; ++} ++ ++void dwc_otg_set_prtpower(dwc_otg_core_if_t * core_if, uint32_t val) ++{ ++ hprt0_data_t hprt0; ++ hprt0.d32 = dwc_otg_read_hprt0(core_if); ++ hprt0.b.prtpwr = val; ++ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); ++} ++ ++uint32_t dwc_otg_get_prtsuspend(dwc_otg_core_if_t * core_if) ++{ ++ hprt0_data_t hprt0; ++ hprt0.d32 = DWC_READ_REG32(core_if->host_if->hprt0); ++ return hprt0.b.prtsusp; ++ ++} ++ ++void dwc_otg_set_prtsuspend(dwc_otg_core_if_t * core_if, uint32_t val) ++{ ++ hprt0_data_t hprt0; ++ hprt0.d32 = dwc_otg_read_hprt0(core_if); ++ hprt0.b.prtsusp = val; ++ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); ++} ++ ++uint32_t dwc_otg_get_fr_interval(dwc_otg_core_if_t * core_if) ++{ ++ hfir_data_t hfir; ++ hfir.d32 = DWC_READ_REG32(&core_if->host_if->host_global_regs->hfir); ++ return hfir.b.frint; ++ ++} ++ ++void dwc_otg_set_fr_interval(dwc_otg_core_if_t * core_if, uint32_t val) ++{ ++ hfir_data_t hfir; ++ uint32_t fram_int; ++ fram_int = calc_frame_interval(core_if); ++ hfir.d32 = DWC_READ_REG32(&core_if->host_if->host_global_regs->hfir); ++ if (!core_if->core_params->reload_ctl) { ++ DWC_WARN("\nCannot reload HFIR register.HFIR.HFIRRldCtrl bit is" ++ "not set to 1.\nShould load driver with reload_ctl=1" ++ " module parameter\n"); ++ return; ++ } ++ switch (fram_int) { ++ case 3750: ++ if ((val < 3350) || (val > 4150)) { ++ DWC_WARN("HFIR interval for HS core and 30 MHz" ++ "clock freq should be from 3350 to 4150\n"); ++ return; ++ } ++ break; ++ case 30000: ++ if ((val < 26820) || (val > 33180)) { ++ DWC_WARN("HFIR interval for FS/LS core and 30 MHz" ++ "clock freq should be from 26820 to 33180\n"); ++ return; ++ } ++ break; ++ case 6000: ++ if ((val < 5360) || (val > 6640)) { ++ DWC_WARN("HFIR interval for HS core and 48 MHz" ++ "clock freq should be from 5360 to 6640\n"); ++ return; ++ } ++ break; ++ case 48000: ++ if ((val < 42912) || (val > 53088)) { ++ DWC_WARN("HFIR interval for FS/LS core and 48 MHz" ++ "clock freq should be from 42912 to 53088\n"); ++ return; ++ } ++ break; ++ case 7500: ++ if ((val < 6700) || (val > 8300)) { ++ DWC_WARN("HFIR interval for HS core and 60 MHz" ++ "clock freq should be from 6700 to 8300\n"); ++ return; ++ } ++ break; ++ case 60000: ++ if ((val < 53640) || (val > 65536)) { ++ DWC_WARN("HFIR interval for FS/LS core and 60 MHz" ++ "clock freq should be from 53640 to 65536\n"); ++ return; ++ } ++ break; ++ default: ++ DWC_WARN("Unknown frame interval\n"); ++ return; ++ break; ++ ++ } ++ hfir.b.frint = val; ++ DWC_WRITE_REG32(&core_if->host_if->host_global_regs->hfir, hfir.d32); ++} ++ ++uint32_t dwc_otg_get_mode_ch_tim(dwc_otg_core_if_t * core_if) ++{ ++ hcfg_data_t hcfg; ++ hcfg.d32 = DWC_READ_REG32(&core_if->host_if->host_global_regs->hcfg); ++ return hcfg.b.modechtimen; ++ ++} ++ ++void dwc_otg_set_mode_ch_tim(dwc_otg_core_if_t * core_if, uint32_t val) ++{ ++ hcfg_data_t hcfg; ++ hcfg.d32 = DWC_READ_REG32(&core_if->host_if->host_global_regs->hcfg); ++ hcfg.b.modechtimen = val; ++ DWC_WRITE_REG32(&core_if->host_if->host_global_regs->hcfg, hcfg.d32); ++} ++ ++void dwc_otg_set_prtresume(dwc_otg_core_if_t * core_if, uint32_t val) ++{ ++ hprt0_data_t hprt0; ++ hprt0.d32 = dwc_otg_read_hprt0(core_if); ++ hprt0.b.prtres = val; ++ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); ++} ++ ++uint32_t dwc_otg_get_remotewakesig(dwc_otg_core_if_t * core_if) ++{ ++ dctl_data_t dctl; ++ dctl.d32 = DWC_READ_REG32(&core_if->dev_if->dev_global_regs->dctl); ++ return dctl.b.rmtwkupsig; ++} ++ ++uint32_t dwc_otg_get_lpm_portsleepstatus(dwc_otg_core_if_t * core_if) ++{ ++ glpmcfg_data_t lpmcfg; ++ lpmcfg.d32 = DWC_READ_REG32(&core_if->core_global_regs->glpmcfg); ++ ++ DWC_ASSERT(! ++ ((core_if->lx_state == DWC_OTG_L1) ^ lpmcfg.b.prt_sleep_sts), ++ "lx_state = %d, lmpcfg.prt_sleep_sts = %d\n", ++ core_if->lx_state, lpmcfg.b.prt_sleep_sts); ++ ++ return lpmcfg.b.prt_sleep_sts; ++} ++ ++uint32_t dwc_otg_get_lpm_remotewakeenabled(dwc_otg_core_if_t * core_if) ++{ ++ glpmcfg_data_t lpmcfg; ++ lpmcfg.d32 = DWC_READ_REG32(&core_if->core_global_regs->glpmcfg); ++ return lpmcfg.b.rem_wkup_en; ++} ++ ++uint32_t dwc_otg_get_lpmresponse(dwc_otg_core_if_t * core_if) ++{ ++ glpmcfg_data_t lpmcfg; ++ lpmcfg.d32 = DWC_READ_REG32(&core_if->core_global_regs->glpmcfg); ++ return lpmcfg.b.appl_resp; ++} ++ ++void dwc_otg_set_lpmresponse(dwc_otg_core_if_t * core_if, uint32_t val) ++{ ++ glpmcfg_data_t lpmcfg; ++ lpmcfg.d32 = DWC_READ_REG32(&core_if->core_global_regs->glpmcfg); ++ lpmcfg.b.appl_resp = val; ++ DWC_WRITE_REG32(&core_if->core_global_regs->glpmcfg, lpmcfg.d32); ++} ++ ++uint32_t dwc_otg_get_hsic_connect(dwc_otg_core_if_t * core_if) ++{ ++ glpmcfg_data_t lpmcfg; ++ lpmcfg.d32 = DWC_READ_REG32(&core_if->core_global_regs->glpmcfg); ++ return lpmcfg.b.hsic_connect; ++} ++ ++void dwc_otg_set_hsic_connect(dwc_otg_core_if_t * core_if, uint32_t val) ++{ ++ glpmcfg_data_t lpmcfg; ++ lpmcfg.d32 = DWC_READ_REG32(&core_if->core_global_regs->glpmcfg); ++ lpmcfg.b.hsic_connect = val; ++ DWC_WRITE_REG32(&core_if->core_global_regs->glpmcfg, lpmcfg.d32); ++} ++ ++uint32_t dwc_otg_get_inv_sel_hsic(dwc_otg_core_if_t * core_if) ++{ ++ glpmcfg_data_t lpmcfg; ++ lpmcfg.d32 = DWC_READ_REG32(&core_if->core_global_regs->glpmcfg); ++ return lpmcfg.b.inv_sel_hsic; ++ ++} ++ ++void dwc_otg_set_inv_sel_hsic(dwc_otg_core_if_t * core_if, uint32_t val) ++{ ++ glpmcfg_data_t lpmcfg; ++ lpmcfg.d32 = DWC_READ_REG32(&core_if->core_global_regs->glpmcfg); ++ lpmcfg.b.inv_sel_hsic = val; ++ DWC_WRITE_REG32(&core_if->core_global_regs->glpmcfg, lpmcfg.d32); ++} ++ ++uint32_t dwc_otg_get_gotgctl(dwc_otg_core_if_t * core_if) ++{ ++ return DWC_READ_REG32(&core_if->core_global_regs->gotgctl); ++} ++ ++void dwc_otg_set_gotgctl(dwc_otg_core_if_t * core_if, uint32_t val) ++{ ++ DWC_WRITE_REG32(&core_if->core_global_regs->gotgctl, val); ++} ++ ++uint32_t dwc_otg_get_gusbcfg(dwc_otg_core_if_t * core_if) ++{ ++ return DWC_READ_REG32(&core_if->core_global_regs->gusbcfg); ++} ++ ++void dwc_otg_set_gusbcfg(dwc_otg_core_if_t * core_if, uint32_t val) ++{ ++ DWC_WRITE_REG32(&core_if->core_global_regs->gusbcfg, val); ++} ++ ++uint32_t dwc_otg_get_grxfsiz(dwc_otg_core_if_t * core_if) ++{ ++ return DWC_READ_REG32(&core_if->core_global_regs->grxfsiz); ++} ++ ++void dwc_otg_set_grxfsiz(dwc_otg_core_if_t * core_if, uint32_t val) ++{ ++ DWC_WRITE_REG32(&core_if->core_global_regs->grxfsiz, val); ++} ++ ++uint32_t dwc_otg_get_gnptxfsiz(dwc_otg_core_if_t * core_if) ++{ ++ return DWC_READ_REG32(&core_if->core_global_regs->gnptxfsiz); ++} ++ ++void dwc_otg_set_gnptxfsiz(dwc_otg_core_if_t * core_if, uint32_t val) ++{ ++ DWC_WRITE_REG32(&core_if->core_global_regs->gnptxfsiz, val); ++} ++ ++uint32_t dwc_otg_get_gpvndctl(dwc_otg_core_if_t * core_if) ++{ ++ return DWC_READ_REG32(&core_if->core_global_regs->gpvndctl); ++} ++ ++void dwc_otg_set_gpvndctl(dwc_otg_core_if_t * core_if, uint32_t val) ++{ ++ DWC_WRITE_REG32(&core_if->core_global_regs->gpvndctl, val); ++} ++ ++uint32_t dwc_otg_get_ggpio(dwc_otg_core_if_t * core_if) ++{ ++ return DWC_READ_REG32(&core_if->core_global_regs->ggpio); ++} ++ ++void dwc_otg_set_ggpio(dwc_otg_core_if_t * core_if, uint32_t val) ++{ ++ DWC_WRITE_REG32(&core_if->core_global_regs->ggpio, val); ++} ++ ++uint32_t dwc_otg_get_hprt0(dwc_otg_core_if_t * core_if) ++{ ++ return DWC_READ_REG32(core_if->host_if->hprt0); ++ ++} ++ ++void dwc_otg_set_hprt0(dwc_otg_core_if_t * core_if, uint32_t val) ++{ ++ DWC_WRITE_REG32(core_if->host_if->hprt0, val); ++} ++ ++uint32_t dwc_otg_get_guid(dwc_otg_core_if_t * core_if) ++{ ++ return DWC_READ_REG32(&core_if->core_global_regs->guid); ++} ++ ++void dwc_otg_set_guid(dwc_otg_core_if_t * core_if, uint32_t val) ++{ ++ DWC_WRITE_REG32(&core_if->core_global_regs->guid, val); ++} ++ ++uint32_t dwc_otg_get_hptxfsiz(dwc_otg_core_if_t * core_if) ++{ ++ return DWC_READ_REG32(&core_if->core_global_regs->hptxfsiz); ++} ++ ++uint16_t dwc_otg_get_otg_version(dwc_otg_core_if_t * core_if) ++{ ++ return ((core_if->otg_ver == 1) ? (uint16_t)0x0200 : (uint16_t)0x0103); ++} ++ ++/** ++ * Start the SRP timer to detect when the SRP does not complete within ++ * 6 seconds. ++ * ++ * @param core_if the pointer to core_if strucure. ++ */ ++void dwc_otg_pcd_start_srp_timer(dwc_otg_core_if_t * core_if) ++{ ++ core_if->srp_timer_started = 1; ++ DWC_TIMER_SCHEDULE(core_if->srp_timer, 6000 /* 6 secs */ ); ++} ++ ++void dwc_otg_initiate_srp(dwc_otg_core_if_t * core_if) ++{ ++ uint32_t *addr = (uint32_t *) & (core_if->core_global_regs->gotgctl); ++ gotgctl_data_t mem; ++ gotgctl_data_t val; ++ ++ val.d32 = DWC_READ_REG32(addr); ++ if (val.b.sesreq) { ++ DWC_ERROR("Session Request Already active!\n"); ++ return; ++ } ++ ++ DWC_INFO("Session Request Initated\n"); //NOTICE ++ mem.d32 = DWC_READ_REG32(addr); ++ mem.b.sesreq = 1; ++ DWC_WRITE_REG32(addr, mem.d32); ++ ++ /* Start the SRP timer */ ++ dwc_otg_pcd_start_srp_timer(core_if); ++ return; ++} +diff --git a/drivers/usb/host/dwc_otg/dwc_otg_cil.h b/drivers/usb/host/dwc_otg/dwc_otg_cil.h +new file mode 100644 +index 0000000..79dbf83 +--- /dev/null ++++ b/drivers/usb/host/dwc_otg/dwc_otg_cil.h +@@ -0,0 +1,1464 @@ ++/* ========================================================================== ++ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_cil.h $ ++ * $Revision: #123 $ ++ * $Date: 2012/08/10 $ ++ * $Change: 2047372 $ ++ * ++ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, ++ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless ++ * otherwise expressly agreed to in writing between Synopsys and you. ++ * ++ * The Software IS NOT an item of Licensed Software or Licensed Product under ++ * any End User Software License Agreement or Agreement for Licensed Product ++ * with Synopsys or any supplement thereto. You are permitted to use and ++ * redistribute this Software in source and binary forms, with or without ++ * modification, provided that redistributions of source code must retain this ++ * notice. You may not view, use, disclose, copy or distribute this file or ++ * any information contained herein except pursuant to this license grant from ++ * Synopsys. If you do not agree with this notice, including the disclaimer ++ * below, then you are not authorized to use the Software. ++ * ++ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS ++ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS 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. ++ * ========================================================================== */ ++ ++#if !defined(__DWC_CIL_H__) ++#define __DWC_CIL_H__ ++ ++#include "dwc_list.h" ++#include "dwc_otg_dbg.h" ++#include "dwc_otg_regs.h" ++ ++#include "dwc_otg_core_if.h" ++#include "dwc_otg_adp.h" ++ ++/** ++ * @file ++ * This file contains the interface to the Core Interface Layer. ++ */ ++ ++#ifdef DWC_UTE_CFI ++ ++#define MAX_DMA_DESCS_PER_EP 256 ++ ++/** ++ * Enumeration for the data buffer mode ++ */ ++typedef enum _data_buffer_mode { ++ BM_STANDARD = 0, /* data buffer is in normal mode */ ++ BM_SG = 1, /* data buffer uses the scatter/gather mode */ ++ BM_CONCAT = 2, /* data buffer uses the concatenation mode */ ++ BM_CIRCULAR = 3, /* data buffer uses the circular DMA mode */ ++ BM_ALIGN = 4 /* data buffer is in buffer alignment mode */ ++} data_buffer_mode_e; ++#endif //DWC_UTE_CFI ++ ++/** Macros defined for DWC OTG HW Release version */ ++ ++#define OTG_CORE_REV_2_60a 0x4F54260A ++#define OTG_CORE_REV_2_71a 0x4F54271A ++#define OTG_CORE_REV_2_72a 0x4F54272A ++#define OTG_CORE_REV_2_80a 0x4F54280A ++#define OTG_CORE_REV_2_81a 0x4F54281A ++#define OTG_CORE_REV_2_90a 0x4F54290A ++#define OTG_CORE_REV_2_91a 0x4F54291A ++#define OTG_CORE_REV_2_92a 0x4F54292A ++#define OTG_CORE_REV_2_93a 0x4F54293A ++#define OTG_CORE_REV_2_94a 0x4F54294A ++#define OTG_CORE_REV_3_00a 0x4F54300A ++ ++/** ++ * Information for each ISOC packet. ++ */ ++typedef struct iso_pkt_info { ++ uint32_t offset; ++ uint32_t length; ++ int32_t status; ++} iso_pkt_info_t; ++ ++/** ++ * The <code>dwc_ep</code> structure represents the state of a single ++ * endpoint when acting in device mode. It contains the data items ++ * needed for an endpoint to be activated and transfer packets. ++ */ ++typedef struct dwc_ep { ++ /** EP number used for register address lookup */ ++ uint8_t num; ++ /** EP direction 0 = OUT */ ++ unsigned is_in:1; ++ /** EP active. */ ++ unsigned active:1; ++ ++ /** ++ * Periodic Tx FIFO # for IN EPs For INTR EP set to 0 to use non-periodic ++ * Tx FIFO. If dedicated Tx FIFOs are enabled Tx FIFO # FOR IN EPs*/ ++ unsigned tx_fifo_num:4; ++ /** EP type: 0 - Control, 1 - ISOC, 2 - BULK, 3 - INTR */ ++ unsigned type:2; ++#define DWC_OTG_EP_TYPE_CONTROL 0 ++#define DWC_OTG_EP_TYPE_ISOC 1 ++#define DWC_OTG_EP_TYPE_BULK 2 ++#define DWC_OTG_EP_TYPE_INTR 3 ++ ++ /** DATA start PID for INTR and BULK EP */ ++ unsigned data_pid_start:1; ++ /** Frame (even/odd) for ISOC EP */ ++ unsigned even_odd_frame:1; ++ /** Max Packet bytes */ ++ unsigned maxpacket:11; ++ ++ /** Max Transfer size */ ++ uint32_t maxxfer; ++ ++ /** @name Transfer state */ ++ /** @{ */ ++ ++ /** ++ * Pointer to the beginning of the transfer buffer -- do not modify ++ * during transfer. ++ */ ++ ++ dwc_dma_t dma_addr; ++ ++ dwc_dma_t dma_desc_addr; ++ dwc_otg_dev_dma_desc_t *desc_addr; ++ ++ uint8_t *start_xfer_buff; ++ /** pointer to the transfer buffer */ ++ uint8_t *xfer_buff; ++ /** Number of bytes to transfer */ ++ unsigned xfer_len:19; ++ /** Number of bytes transferred. */ ++ unsigned xfer_count:19; ++ /** Sent ZLP */ ++ unsigned sent_zlp:1; ++ /** Total len for control transfer */ ++ unsigned total_len:19; ++ ++ /** stall clear flag */ ++ unsigned stall_clear_flag:1; ++ ++ /** SETUP pkt cnt rollover flag for EP0 out*/ ++ unsigned stp_rollover; ++ ++#ifdef DWC_UTE_CFI ++ /* The buffer mode */ ++ data_buffer_mode_e buff_mode; ++ ++ /* The chain of DMA descriptors. ++ * MAX_DMA_DESCS_PER_EP will be allocated for each active EP. ++ */ ++ dwc_otg_dma_desc_t *descs; ++ ++ /* The DMA address of the descriptors chain start */ ++ dma_addr_t descs_dma_addr; ++ /** This variable stores the length of the last enqueued request */ ++ uint32_t cfi_req_len; ++#endif //DWC_UTE_CFI ++ ++/** Max DMA Descriptor count for any EP */ ++#define MAX_DMA_DESC_CNT 256 ++ /** Allocated DMA Desc count */ ++ uint32_t desc_cnt; ++ ++ /** bInterval */ ++ uint32_t bInterval; ++ /** Next frame num to setup next ISOC transfer */ ++ uint32_t frame_num; ++ /** Indicates SOF number overrun in DSTS */ ++ uint8_t frm_overrun; ++ ++#ifdef DWC_UTE_PER_IO ++ /** Next frame num for which will be setup DMA Desc */ ++ uint32_t xiso_frame_num; ++ /** bInterval */ ++ uint32_t xiso_bInterval; ++ /** Count of currently active transfers - shall be either 0 or 1 */ ++ int xiso_active_xfers; ++ int xiso_queued_xfers; ++#endif ++#ifdef DWC_EN_ISOC ++ /** ++ * Variables specific for ISOC EPs ++ * ++ */ ++ /** DMA addresses of ISOC buffers */ ++ dwc_dma_t dma_addr0; ++ dwc_dma_t dma_addr1; ++ ++ dwc_dma_t iso_dma_desc_addr; ++ dwc_otg_dev_dma_desc_t *iso_desc_addr; ++ ++ /** pointer to the transfer buffers */ ++ uint8_t *xfer_buff0; ++ uint8_t *xfer_buff1; ++ ++ /** number of ISOC Buffer is processing */ ++ uint32_t proc_buf_num; ++ /** Interval of ISOC Buffer processing */ ++ uint32_t buf_proc_intrvl; ++ /** Data size for regular frame */ ++ uint32_t data_per_frame; ++ ++ /* todo - pattern data support is to be implemented in the future */ ++ /** Data size for pattern frame */ ++ uint32_t data_pattern_frame; ++ /** Frame number of pattern data */ ++ uint32_t sync_frame; ++ ++ /** bInterval */ ++ uint32_t bInterval; ++ /** ISO Packet number per frame */ ++ uint32_t pkt_per_frm; ++ /** Next frame num for which will be setup DMA Desc */ ++ uint32_t next_frame; ++ /** Number of packets per buffer processing */ ++ uint32_t pkt_cnt; ++ /** Info for all isoc packets */ ++ iso_pkt_info_t *pkt_info; ++ /** current pkt number */ ++ uint32_t cur_pkt; ++ /** current pkt number */ ++ uint8_t *cur_pkt_addr; ++ /** current pkt number */ ++ uint32_t cur_pkt_dma_addr; ++#endif /* DWC_EN_ISOC */ ++ ++/** @} */ ++} dwc_ep_t; ++ ++/* ++ * Reasons for halting a host channel. ++ */ ++typedef enum dwc_otg_halt_status { ++ DWC_OTG_HC_XFER_NO_HALT_STATUS, ++ DWC_OTG_HC_XFER_COMPLETE, ++ DWC_OTG_HC_XFER_URB_COMPLETE, ++ DWC_OTG_HC_XFER_ACK, ++ DWC_OTG_HC_XFER_NAK, ++ DWC_OTG_HC_XFER_NYET, ++ DWC_OTG_HC_XFER_STALL, ++ DWC_OTG_HC_XFER_XACT_ERR, ++ DWC_OTG_HC_XFER_FRAME_OVERRUN, ++ DWC_OTG_HC_XFER_BABBLE_ERR, ++ DWC_OTG_HC_XFER_DATA_TOGGLE_ERR, ++ DWC_OTG_HC_XFER_AHB_ERR, ++ DWC_OTG_HC_XFER_PERIODIC_INCOMPLETE, ++ DWC_OTG_HC_XFER_URB_DEQUEUE ++} dwc_otg_halt_status_e; ++ ++/** ++ * Host channel descriptor. This structure represents the state of a single ++ * host channel when acting in host mode. It contains the data items needed to ++ * transfer packets to an endpoint via a host channel. ++ */ ++typedef struct dwc_hc { ++ /** Host channel number used for register address lookup */ ++ uint8_t hc_num; ++ ++ /** Device to access */ ++ unsigned dev_addr:7; ++ ++ /** EP to access */ ++ unsigned ep_num:4; ++ ++ /** EP direction. 0: OUT, 1: IN */ ++ unsigned ep_is_in:1; ++ ++ /** ++ * EP speed. ++ * One of the following values: ++ * - DWC_OTG_EP_SPEED_LOW ++ * - DWC_OTG_EP_SPEED_FULL ++ * - DWC_OTG_EP_SPEED_HIGH ++ */ ++ unsigned speed:2; ++#define DWC_OTG_EP_SPEED_LOW 0 ++#define DWC_OTG_EP_SPEED_FULL 1 ++#define DWC_OTG_EP_SPEED_HIGH 2 ++ ++ /** ++ * Endpoint type. ++ * One of the following values: ++ * - DWC_OTG_EP_TYPE_CONTROL: 0 ++ * - DWC_OTG_EP_TYPE_ISOC: 1 ++ * - DWC_OTG_EP_TYPE_BULK: 2 ++ * - DWC_OTG_EP_TYPE_INTR: 3 ++ */ ++ unsigned ep_type:2; ++ ++ /** Max packet size in bytes */ ++ unsigned max_packet:11; ++ ++ /** ++ * PID for initial transaction. ++ * 0: DATA0,<br> ++ * 1: DATA2,<br> ++ * 2: DATA1,<br> ++ * 3: MDATA (non-Control EP), ++ * SETUP (Control EP) ++ */ ++ unsigned data_pid_start:2; ++#define DWC_OTG_HC_PID_DATA0 0 ++#define DWC_OTG_HC_PID_DATA2 1 ++#define DWC_OTG_HC_PID_DATA1 2 ++#define DWC_OTG_HC_PID_MDATA 3 ++#define DWC_OTG_HC_PID_SETUP 3 ++ ++ /** Number of periodic transactions per (micro)frame */ ++ unsigned multi_count:2; ++ ++ /** @name Transfer State */ ++ /** @{ */ ++ ++ /** Pointer to the current transfer buffer position. */ ++ uint8_t *xfer_buff; ++ /** ++ * In Buffer DMA mode this buffer will be used ++ * if xfer_buff is not DWORD aligned. ++ */ ++ dwc_dma_t align_buff; ++ /** Total number of bytes to transfer. */ ++ uint32_t xfer_len; ++ /** Number of bytes transferred so far. */ ++ uint32_t xfer_count; ++ /** Packet count at start of transfer.*/ ++ uint16_t start_pkt_count; ++ ++ /** ++ * Flag to indicate whether the transfer has been started. Set to 1 if ++ * it has been started, 0 otherwise. ++ */ ++ uint8_t xfer_started; ++ ++ /** ++ * Set to 1 to indicate that a PING request should be issued on this ++ * channel. If 0, process normally. ++ */ ++ uint8_t do_ping; ++ ++ /** ++ * Set to 1 to indicate that the error count for this transaction is ++ * non-zero. Set to 0 if the error count is 0. ++ */ ++ uint8_t error_state; ++ ++ /** ++ * Set to 1 to indicate that this channel should be halted the next ++ * time a request is queued for the channel. This is necessary in ++ * slave mode if no request queue space is available when an attempt ++ * is made to halt the channel. ++ */ ++ uint8_t halt_on_queue; ++ ++ /** ++ * Set to 1 if the host channel has been halted, but the core is not ++ * finished flushing queued requests. Otherwise 0. ++ */ ++ uint8_t halt_pending; ++ ++ /** ++ * Reason for halting the host channel. ++ */ ++ dwc_otg_halt_status_e halt_status; ++ ++ /* ++ * Split settings for the host channel ++ */ ++ uint8_t do_split; /**< Enable split for the channel */ ++ uint8_t complete_split; /**< Enable complete split */ ++ uint8_t hub_addr; /**< Address of high speed hub */ ++ ++ uint8_t port_addr; /**< Port of the low/full speed device */ ++ /** Split transaction position ++ * One of the following values: ++ * - DWC_HCSPLIT_XACTPOS_MID ++ * - DWC_HCSPLIT_XACTPOS_BEGIN ++ * - DWC_HCSPLIT_XACTPOS_END ++ * - DWC_HCSPLIT_XACTPOS_ALL */ ++ uint8_t xact_pos; ++ ++ /** Set when the host channel does a short read. */ ++ uint8_t short_read; ++ ++ /** ++ * Number of requests issued for this channel since it was assigned to ++ * the current transfer (not counting PINGs). ++ */ ++ uint8_t requests; ++ ++ /** ++ * Queue Head for the transfer being processed by this channel. ++ */ ++ struct dwc_otg_qh *qh; ++ ++ /** @} */ ++ ++ /** Entry in list of host channels. */ ++ DWC_CIRCLEQ_ENTRY(dwc_hc) hc_list_entry; ++ ++ /** @name Descriptor DMA support */ ++ /** @{ */ ++ ++ /** Number of Transfer Descriptors */ ++ uint16_t ntd; ++ ++ /** Descriptor List DMA address */ ++ dwc_dma_t desc_list_addr; ++ ++ /** Scheduling micro-frame bitmap. */ ++ uint8_t schinfo; ++ ++ /** @} */ ++} dwc_hc_t; ++ ++/** ++ * The following parameters may be specified when starting the module. These ++ * parameters define how the DWC_otg controller should be configured. ++ */ ++typedef struct dwc_otg_core_params { ++ int32_t opt; ++ ++ /** ++ * Specifies the OTG capabilities. The driver will automatically ++ * detect the value for this parameter if none is specified. ++ * 0 - HNP and SRP capable (default) ++ * 1 - SRP Only capable ++ * 2 - No HNP/SRP capable ++ */ ++ int32_t otg_cap; ++ ++ /** ++ * Specifies whether to use slave or DMA mode for accessing the data ++ * FIFOs. The driver will automatically detect the value for this ++ * parameter if none is specified. ++ * 0 - Slave ++ * 1 - DMA (default, if available) ++ */ ++ int32_t dma_enable; ++ ++ /** ++ * When DMA mode is enabled specifies whether to use address DMA or DMA ++ * Descriptor mode for accessing the data FIFOs in device mode. The driver ++ * will automatically detect the value for this if none is specified. ++ * 0 - address DMA ++ * 1 - DMA Descriptor(default, if available) ++ */ ++ int32_t dma_desc_enable; ++ /** The DMA Burst size (applicable only for External DMA ++ * Mode). 1, 4, 8 16, 32, 64, 128, 256 (default 32) ++ */ ++ int32_t dma_burst_size; /* Translate this to GAHBCFG values */ ++ ++ /** ++ * Specifies the maximum speed of operation in host and device mode. ++ * The actual speed depends on the speed of the attached device and ++ * the value of phy_type. The actual speed depends on the speed of the ++ * attached device. ++ * 0 - High Speed (default) ++ * 1 - Full Speed ++ */ ++ int32_t speed; ++ /** Specifies whether low power mode is supported when attached ++ * to a Full Speed or Low Speed device in host mode. ++ * 0 - Don't support low power mode (default) ++ * 1 - Support low power mode ++ */ ++ int32_t host_support_fs_ls_low_power; ++ ++ /** Specifies the PHY clock rate in low power mode when connected to a ++ * Low Speed device in host mode. This parameter is applicable only if ++ * HOST_SUPPORT_FS_LS_LOW_POWER is enabled. If PHY_TYPE is set to FS ++ * then defaults to 6 MHZ otherwise 48 MHZ. ++ * ++ * 0 - 48 MHz ++ * 1 - 6 MHz ++ */ ++ int32_t host_ls_low_power_phy_clk; ++ ++ /** ++ * 0 - Use cC FIFO size parameters ++ * 1 - Allow dynamic FIFO sizing (default) ++ */ ++ int32_t enable_dynamic_fifo; ++ ++ /** Total number of 4-byte words in the data FIFO memory. This ++ * memory includes the Rx FIFO, non-periodic Tx FIFO, and periodic ++ * Tx FIFOs. ++ * 32 to 32768 (default 8192) ++ * Note: The total FIFO memory depth in the FPGA configuration is 8192. ++ */ ++ int32_t data_fifo_size; ++ ++ /** Number of 4-byte words in the Rx FIFO in device mode when dynamic ++ * FIFO sizing is enabled. ++ * 16 to 32768 (default 1064) ++ */ ++ int32_t dev_rx_fifo_size; ++ ++ /** Number of 4-byte words in the non-periodic Tx FIFO in device mode ++ * when dynamic FIFO sizing is enabled. ++ * 16 to 32768 (default 1024) ++ */ ++ int32_t dev_nperio_tx_fifo_size; ++ ++ /** Number of 4-byte words in each of the periodic Tx FIFOs in device ++ * mode when dynamic FIFO sizing is enabled. ++ * 4 to 768 (default 256) ++ */ ++ uint32_t dev_perio_tx_fifo_size[MAX_PERIO_FIFOS]; ++ ++ /** Number of 4-byte words in the Rx FIFO in host mode when dynamic ++ * FIFO sizing is enabled. ++ * 16 to 32768 (default 1024) ++ */ ++ int32_t host_rx_fifo_size; ++ ++ /** Number of 4-byte words in the non-periodic Tx FIFO in host mode ++ * when Dynamic FIFO sizing is enabled in the core. ++ * 16 to 32768 (default 1024) ++ */ ++ int32_t host_nperio_tx_fifo_size; ++ ++ /** Number of 4-byte words in the host periodic Tx FIFO when dynamic ++ * FIFO sizing is enabled. ++ * 16 to 32768 (default 1024) ++ */ ++ int32_t host_perio_tx_fifo_size; ++ ++ /** The maximum transfer size supported in bytes. ++ * 2047 to 65,535 (default 65,535) ++ */ ++ int32_t max_transfer_size; ++ ++ /** The maximum number of packets in a transfer. ++ * 15 to 511 (default 511) ++ */ ++ int32_t max_packet_count; ++ ++ /** The number of host channel registers to use. ++ * 1 to 16 (default 12) ++ * Note: The FPGA configuration supports a maximum of 12 host channels. ++ */ ++ int32_t host_channels; ++ ++ /** The number of endpoints in addition to EP0 available for device ++ * mode operations. ++ * 1 to 15 (default 6 IN and OUT) ++ * Note: The FPGA configuration supports a maximum of 6 IN and OUT ++ * endpoints in addition to EP0. ++ */ ++ int32_t dev_endpoints; ++ ++ /** ++ * Specifies the type of PHY interface to use. By default, the driver ++ * will automatically detect the phy_type. ++ * ++ * 0 - Full Speed PHY ++ * 1 - UTMI+ (default) ++ * 2 - ULPI ++ */ ++ int32_t phy_type; ++ ++ /** ++ * Specifies the UTMI+ Data Width. This parameter is ++ * applicable for a PHY_TYPE of UTMI+ or ULPI. (For a ULPI ++ * PHY_TYPE, this parameter indicates the data width between ++ * the MAC and the ULPI Wrapper.) Also, this parameter is ++ * applicable only if the OTG_HSPHY_WIDTH cC parameter was set ++ * to "8 and 16 bits", meaning that the core has been ++ * configured to work at either data path width. ++ * ++ * 8 or 16 bits (default 16) ++ */ ++ int32_t phy_utmi_width; ++ ++ /** ++ * Specifies whether the ULPI operates at double or single ++ * data rate. This parameter is only applicable if PHY_TYPE is ++ * ULPI. ++ * ++ * 0 - single data rate ULPI interface with 8 bit wide data ++ * bus (default) ++ * 1 - double data rate ULPI interface with 4 bit wide data ++ * bus ++ */ ++ int32_t phy_ulpi_ddr; ++ ++ /** ++ * Specifies whether to use the internal or external supply to ++ * drive the vbus with a ULPI phy. ++ */ ++ int32_t phy_ulpi_ext_vbus; ++ ++ /** ++ * Specifies whether to use the I2Cinterface for full speed PHY. This ++ * parameter is only applicable if PHY_TYPE is FS. ++ * 0 - No (default) ++ * 1 - Yes ++ */ ++ int32_t i2c_enable; ++ ++ int32_t ulpi_fs_ls; ++ ++ int32_t ts_dline; ++ ++ /** ++ * Specifies whether dedicated transmit FIFOs are ++ * enabled for non periodic IN endpoints in device mode ++ * 0 - No ++ * 1 - Yes ++ */ ++ int32_t en_multiple_tx_fifo; ++ ++ /** Number of 4-byte words in each of the Tx FIFOs in device ++ * mode when dynamic FIFO sizing is enabled. ++ * 4 to 768 (default 256) ++ */ ++ uint32_t dev_tx_fifo_size[MAX_TX_FIFOS]; ++ ++ /** Thresholding enable flag- ++ * bit 0 - enable non-ISO Tx thresholding ++ * bit 1 - enable ISO Tx thresholding ++ * bit 2 - enable Rx thresholding ++ */ ++ uint32_t thr_ctl; ++ ++ /** Thresholding length for Tx ++ * FIFOs in 32 bit DWORDs ++ */ ++ uint32_t tx_thr_length; ++ ++ /** Thresholding length for Rx ++ * FIFOs in 32 bit DWORDs ++ */ ++ uint32_t rx_thr_length; ++ ++ /** ++ * Specifies whether LPM (Link Power Management) support is enabled ++ */ ++ int32_t lpm_enable; ++ ++ /** Per Transfer Interrupt ++ * mode enable flag ++ * 1 - Enabled ++ * 0 - Disabled ++ */ ++ int32_t pti_enable; ++ ++ /** Multi Processor Interrupt ++ * mode enable flag ++ * 1 - Enabled ++ * 0 - Disabled ++ */ ++ int32_t mpi_enable; ++ ++ /** IS_USB Capability ++ * 1 - Enabled ++ * 0 - Disabled ++ */ ++ int32_t ic_usb_cap; ++ ++ /** AHB Threshold Ratio ++ * 2'b00 AHB Threshold = MAC Threshold ++ * 2'b01 AHB Threshold = 1/2 MAC Threshold ++ * 2'b10 AHB Threshold = 1/4 MAC Threshold ++ * 2'b11 AHB Threshold = 1/8 MAC Threshold ++ */ ++ int32_t ahb_thr_ratio; ++ ++ /** ADP Support ++ * 1 - Enabled ++ * 0 - Disabled ++ */ ++ int32_t adp_supp_enable; ++ ++ /** HFIR Reload Control ++ * 0 - The HFIR cannot be reloaded dynamically. ++ * 1 - Allow dynamic reloading of the HFIR register during runtime. ++ */ ++ int32_t reload_ctl; ++ ++ /** DCFG: Enable device Out NAK ++ * 0 - The core does not set NAK after Bulk Out transfer complete. ++ * 1 - The core sets NAK after Bulk OUT transfer complete. ++ */ ++ int32_t dev_out_nak; ++ ++ /** DCFG: Enable Continue on BNA ++ * After receiving BNA interrupt the core disables the endpoint,when the ++ * endpoint is re-enabled by the application the core starts processing ++ * 0 - from the DOEPDMA descriptor ++ * 1 - from the descriptor which received the BNA. ++ */ ++ int32_t cont_on_bna; ++ ++ /** GAHBCFG: AHB Single Support ++ * This bit when programmed supports SINGLE transfers for remainder ++ * data in a transfer for DMA mode of operation. ++ * 0 - in this case the remainder data will be sent using INCR burst size. ++ * 1 - in this case the remainder data will be sent using SINGLE burst size. ++ */ ++ int32_t ahb_single; ++ ++ /** Core Power down mode ++ * 0 - No Power Down is enabled ++ * 1 - Reserved ++ * 2 - Complete Power Down (Hibernation) ++ */ ++ int32_t power_down; ++ ++ /** OTG revision supported ++ * 0 - OTG 1.3 revision ++ * 1 - OTG 2.0 revision ++ */ ++ int32_t otg_ver; ++ ++} dwc_otg_core_params_t; ++ ++#ifdef DEBUG ++struct dwc_otg_core_if; ++typedef struct hc_xfer_info { ++ struct dwc_otg_core_if *core_if; ++ dwc_hc_t *hc; ++} hc_xfer_info_t; ++#endif ++ ++typedef struct ep_xfer_info { ++ struct dwc_otg_core_if *core_if; ++ dwc_ep_t *ep; ++ uint8_t state; ++} ep_xfer_info_t; ++/* ++ * Device States ++ */ ++typedef enum dwc_otg_lx_state { ++ /** On state */ ++ DWC_OTG_L0, ++ /** LPM sleep state*/ ++ DWC_OTG_L1, ++ /** USB suspend state*/ ++ DWC_OTG_L2, ++ /** Off state*/ ++ DWC_OTG_L3 ++} dwc_otg_lx_state_e; ++ ++struct dwc_otg_global_regs_backup { ++ uint32_t gotgctl_local; ++ uint32_t gintmsk_local; ++ uint32_t gahbcfg_local; ++ uint32_t gusbcfg_local; ++ uint32_t grxfsiz_local; ++ uint32_t gnptxfsiz_local; ++#ifdef CONFIG_USB_DWC_OTG_LPM ++ uint32_t glpmcfg_local; ++#endif ++ uint32_t gi2cctl_local; ++ uint32_t hptxfsiz_local; ++ uint32_t pcgcctl_local; ++ uint32_t gdfifocfg_local; ++ uint32_t dtxfsiz_local[MAX_EPS_CHANNELS]; ++ uint32_t gpwrdn_local; ++ uint32_t xhib_pcgcctl; ++ uint32_t xhib_gpwrdn; ++}; ++ ++struct dwc_otg_host_regs_backup { ++ uint32_t hcfg_local; ++ uint32_t haintmsk_local; ++ uint32_t hcintmsk_local[MAX_EPS_CHANNELS]; ++ uint32_t hprt0_local; ++ uint32_t hfir_local; ++}; ++ ++struct dwc_otg_dev_regs_backup { ++ uint32_t dcfg; ++ uint32_t dctl; ++ uint32_t daintmsk; ++ uint32_t diepmsk; ++ uint32_t doepmsk; ++ uint32_t diepctl[MAX_EPS_CHANNELS]; ++ uint32_t dieptsiz[MAX_EPS_CHANNELS]; ++ uint32_t diepdma[MAX_EPS_CHANNELS]; ++}; ++/** ++ * The <code>dwc_otg_core_if</code> structure contains information needed to manage ++ * the DWC_otg controller acting in either host or device mode. It ++ * represents the programming view of the controller as a whole. ++ */ ++struct dwc_otg_core_if { ++ /** Parameters that define how the core should be configured.*/ ++ dwc_otg_core_params_t *core_params; ++ ++ /** Core Global registers starting at offset 000h. */ ++ dwc_otg_core_global_regs_t *core_global_regs; ++ ++ /** Device-specific information */ ++ dwc_otg_dev_if_t *dev_if; ++ /** Host-specific information */ ++ dwc_otg_host_if_t *host_if; ++ ++ /** Value from SNPSID register */ ++ uint32_t snpsid; ++ ++ /* ++ * Set to 1 if the core PHY interface bits in USBCFG have been ++ * initialized. ++ */ ++ uint8_t phy_init_done; ++ ++ /* ++ * SRP Success flag, set by srp success interrupt in FS I2C mode ++ */ ++ uint8_t srp_success; ++ uint8_t srp_timer_started; ++ /** Timer for SRP. If it expires before SRP is successful ++ * clear the SRP. */ ++ dwc_timer_t *srp_timer; ++ ++#ifdef DWC_DEV_SRPCAP ++ /* This timer is needed to power on the hibernated host core if SRP is not ++ * initiated on connected SRP capable device for limited period of time ++ */ ++ uint8_t pwron_timer_started; ++ dwc_timer_t *pwron_timer; ++#endif ++ /* Common configuration information */ ++ /** Power and Clock Gating Control Register */ ++ volatile uint32_t *pcgcctl; ++#define DWC_OTG_PCGCCTL_OFFSET 0xE00 ++ ++ /** Push/pop addresses for endpoints or host channels.*/ ++ uint32_t *data_fifo[MAX_EPS_CHANNELS]; ++#define DWC_OTG_DATA_FIFO_OFFSET 0x1000 ++#define DWC_OTG_DATA_FIFO_SIZE 0x1000 ++ ++ /** Total RAM for FIFOs (Bytes) */ ++ uint16_t total_fifo_size; ++ /** Size of Rx FIFO (Bytes) */ ++ uint16_t rx_fifo_size; ++ /** Size of Non-periodic Tx FIFO (Bytes) */ ++ uint16_t nperio_tx_fifo_size; ++ ++ /** 1 if DMA is enabled, 0 otherwise. */ ++ uint8_t dma_enable; ++ ++ /** 1 if DMA descriptor is enabled, 0 otherwise. */ ++ uint8_t dma_desc_enable; ++ ++ /** 1 if PTI Enhancement mode is enabled, 0 otherwise. */ ++ uint8_t pti_enh_enable; ++ ++ /** 1 if MPI Enhancement mode is enabled, 0 otherwise. */ ++ uint8_t multiproc_int_enable; ++ ++ /** 1 if dedicated Tx FIFOs are enabled, 0 otherwise. */ ++ uint8_t en_multiple_tx_fifo; ++ ++ /** Set to 1 if multiple packets of a high-bandwidth transfer is in ++ * process of being queued */ ++ uint8_t queuing_high_bandwidth; ++ ++ /** Hardware Configuration -- stored here for convenience.*/ ++ hwcfg1_data_t hwcfg1; ++ hwcfg2_data_t hwcfg2; ++ hwcfg3_data_t hwcfg3; ++ hwcfg4_data_t hwcfg4; ++ fifosize_data_t hptxfsiz; ++ ++ /** Host and Device Configuration -- stored here for convenience.*/ ++ hcfg_data_t hcfg; ++ dcfg_data_t dcfg; ++ ++ /** The operational State, during transations ++ * (a_host>>a_peripherial and b_device=>b_host) this may not ++ * match the core but allows the software to determine ++ * transitions. ++ */ ++ uint8_t op_state; ++ ++ /** ++ * Set to 1 if the HCD needs to be restarted on a session request ++ * interrupt. This is required if no connector ID status change has ++ * occurred since the HCD was last disconnected. ++ */ ++ uint8_t restart_hcd_on_session_req; ++ ++ /** HCD callbacks */ ++ /** A-Device is a_host */ ++#define A_HOST (1) ++ /** A-Device is a_suspend */ ++#define A_SUSPEND (2) ++ /** A-Device is a_peripherial */ ++#define A_PERIPHERAL (3) ++ /** B-Device is operating as a Peripheral. */ ++#define B_PERIPHERAL (4) ++ /** B-Device is operating as a Host. */ ++#define B_HOST (5) ++ ++ /** HCD callbacks */ ++ struct dwc_otg_cil_callbacks *hcd_cb; ++ /** PCD callbacks */ ++ struct dwc_otg_cil_callbacks *pcd_cb; ++ ++ /** Device mode Periodic Tx FIFO Mask */ ++ uint32_t p_tx_msk; ++ /** Device mode Periodic Tx FIFO Mask */ ++ uint32_t tx_msk; ++ ++ /** Workqueue object used for handling several interrupts */ ++ dwc_workq_t *wq_otg; ++ ++ /** Timer object used for handling "Wakeup Detected" Interrupt */ ++ dwc_timer_t *wkp_timer; ++ /** This arrays used for debug purposes for DEV OUT NAK enhancement */ ++ uint32_t start_doeptsiz_val[MAX_EPS_CHANNELS]; ++ ep_xfer_info_t ep_xfer_info[MAX_EPS_CHANNELS]; ++ dwc_timer_t *ep_xfer_timer[MAX_EPS_CHANNELS]; ++#ifdef DEBUG ++ uint32_t start_hcchar_val[MAX_EPS_CHANNELS]; ++ ++ hc_xfer_info_t hc_xfer_info[MAX_EPS_CHANNELS]; ++ dwc_timer_t *hc_xfer_timer[MAX_EPS_CHANNELS]; ++ ++ uint32_t hfnum_7_samples; ++ uint64_t hfnum_7_frrem_accum; ++ uint32_t hfnum_0_samples; ++ uint64_t hfnum_0_frrem_accum; ++ uint32_t hfnum_other_samples; ++ uint64_t hfnum_other_frrem_accum; ++#endif ++ ++#ifdef DWC_UTE_CFI ++ uint16_t pwron_rxfsiz; ++ uint16_t pwron_gnptxfsiz; ++ uint16_t pwron_txfsiz[15]; ++ ++ uint16_t init_rxfsiz; ++ uint16_t init_gnptxfsiz; ++ uint16_t init_txfsiz[15]; ++#endif ++ ++ /** Lx state of device */ ++ dwc_otg_lx_state_e lx_state; ++ ++ /** Saved Core Global registers */ ++ struct dwc_otg_global_regs_backup *gr_backup; ++ /** Saved Host registers */ ++ struct dwc_otg_host_regs_backup *hr_backup; ++ /** Saved Device registers */ ++ struct dwc_otg_dev_regs_backup *dr_backup; ++ ++ /** Power Down Enable */ ++ uint32_t power_down; ++ ++ /** ADP support Enable */ ++ uint32_t adp_enable; ++ ++ /** ADP structure object */ ++ dwc_otg_adp_t adp; ++ ++ /** hibernation/suspend flag */ ++ int hibernation_suspend; ++ ++ /** Device mode extended hibernation flag */ ++ int xhib; ++ ++ /** OTG revision supported */ ++ uint32_t otg_ver; ++ ++ /** OTG status flag used for HNP polling */ ++ uint8_t otg_sts; ++ ++ /** Pointer to either hcd->lock or pcd->lock */ ++ dwc_spinlock_t *lock; ++ ++ /** Start predict NextEP based on Learning Queue if equal 1, ++ * also used as counter of disabled NP IN EP's */ ++ uint8_t start_predict; ++ ++ /** NextEp sequence, including EP0: nextep_seq[] = EP if non-periodic and ++ * active, 0xff otherwise */ ++ uint8_t nextep_seq[MAX_EPS_CHANNELS]; ++ ++ /** Index of fisrt EP in nextep_seq array which should be re-enabled **/ ++ uint8_t first_in_nextep_seq; ++ ++ /** Frame number while entering to ISR - needed for ISOCs **/ ++ uint32_t frame_num; ++ ++}; ++ ++#ifdef DEBUG ++/* ++ * This function is called when transfer is timed out. ++ */ ++extern void hc_xfer_timeout(void *ptr); ++#endif ++ ++/* ++ * This function is called when transfer is timed out on endpoint. ++ */ ++extern void ep_xfer_timeout(void *ptr); ++ ++/* ++ * The following functions are functions for works ++ * using during handling some interrupts ++ */ ++extern void w_conn_id_status_change(void *p); ++ ++extern void w_wakeup_detected(void *p); ++ ++/** Saves global register values into system memory. */ ++extern int dwc_otg_save_global_regs(dwc_otg_core_if_t * core_if); ++/** Saves device register values into system memory. */ ++extern int dwc_otg_save_dev_regs(dwc_otg_core_if_t * core_if); ++/** Saves host register values into system memory. */ ++extern int dwc_otg_save_host_regs(dwc_otg_core_if_t * core_if); ++/** Restore global register values. */ ++extern int dwc_otg_restore_global_regs(dwc_otg_core_if_t * core_if); ++/** Restore host register values. */ ++extern int dwc_otg_restore_host_regs(dwc_otg_core_if_t * core_if, int reset); ++/** Restore device register values. */ ++extern int dwc_otg_restore_dev_regs(dwc_otg_core_if_t * core_if, ++ int rem_wakeup); ++extern int restore_lpm_i2c_regs(dwc_otg_core_if_t * core_if); ++extern int restore_essential_regs(dwc_otg_core_if_t * core_if, int rmode, ++ int is_host); ++ ++extern int dwc_otg_host_hibernation_restore(dwc_otg_core_if_t * core_if, ++ int restore_mode, int reset); ++extern int dwc_otg_device_hibernation_restore(dwc_otg_core_if_t * core_if, ++ int rem_wakeup, int reset); ++ ++/* ++ * The following functions support initialization of the CIL driver component ++ * and the DWC_otg controller. ++ */ ++extern void dwc_otg_core_host_init(dwc_otg_core_if_t * _core_if); ++extern void dwc_otg_core_dev_init(dwc_otg_core_if_t * _core_if); ++ ++/** @name Device CIL Functions ++ * The following functions support managing the DWC_otg controller in device ++ * mode. ++ */ ++/**@{*/ ++extern void dwc_otg_wakeup(dwc_otg_core_if_t * _core_if); ++extern void dwc_otg_read_setup_packet(dwc_otg_core_if_t * _core_if, ++ uint32_t * _dest); ++extern uint32_t dwc_otg_get_frame_number(dwc_otg_core_if_t * _core_if); ++extern void dwc_otg_ep0_activate(dwc_otg_core_if_t * _core_if, dwc_ep_t * _ep); ++extern void dwc_otg_ep_activate(dwc_otg_core_if_t * _core_if, dwc_ep_t * _ep); ++extern void dwc_otg_ep_deactivate(dwc_otg_core_if_t * _core_if, dwc_ep_t * _ep); ++extern void dwc_otg_ep_start_transfer(dwc_otg_core_if_t * _core_if, ++ dwc_ep_t * _ep); ++extern void dwc_otg_ep_start_zl_transfer(dwc_otg_core_if_t * _core_if, ++ dwc_ep_t * _ep); ++extern void dwc_otg_ep0_start_transfer(dwc_otg_core_if_t * _core_if, ++ dwc_ep_t * _ep); ++extern void dwc_otg_ep0_continue_transfer(dwc_otg_core_if_t * _core_if, ++ dwc_ep_t * _ep); ++extern void dwc_otg_ep_write_packet(dwc_otg_core_if_t * _core_if, ++ dwc_ep_t * _ep, int _dma); ++extern void dwc_otg_ep_set_stall(dwc_otg_core_if_t * _core_if, dwc_ep_t * _ep); ++extern void dwc_otg_ep_clear_stall(dwc_otg_core_if_t * _core_if, ++ dwc_ep_t * _ep); ++extern void dwc_otg_enable_device_interrupts(dwc_otg_core_if_t * _core_if); ++ ++#ifdef DWC_EN_ISOC ++extern void dwc_otg_iso_ep_start_frm_transfer(dwc_otg_core_if_t * core_if, ++ dwc_ep_t * ep); ++extern void dwc_otg_iso_ep_start_buf_transfer(dwc_otg_core_if_t * core_if, ++ dwc_ep_t * ep); ++#endif /* DWC_EN_ISOC */ ++/**@}*/ ++ ++/** @name Host CIL Functions ++ * The following functions support managing the DWC_otg controller in host ++ * mode. ++ */ ++/**@{*/ ++extern void dwc_otg_hc_init(dwc_otg_core_if_t * _core_if, dwc_hc_t * _hc); ++extern void dwc_otg_hc_halt(dwc_otg_core_if_t * _core_if, ++ dwc_hc_t * _hc, dwc_otg_halt_status_e _halt_status); ++extern void dwc_otg_hc_cleanup(dwc_otg_core_if_t * _core_if, dwc_hc_t * _hc); ++extern void dwc_otg_hc_start_transfer(dwc_otg_core_if_t * _core_if, ++ dwc_hc_t * _hc); ++extern int dwc_otg_hc_continue_transfer(dwc_otg_core_if_t * _core_if, ++ dwc_hc_t * _hc); ++extern void dwc_otg_hc_do_ping(dwc_otg_core_if_t * _core_if, dwc_hc_t * _hc); ++extern void dwc_otg_hc_write_packet(dwc_otg_core_if_t * _core_if, ++ dwc_hc_t * _hc); ++extern void dwc_otg_enable_host_interrupts(dwc_otg_core_if_t * _core_if); ++extern void dwc_otg_disable_host_interrupts(dwc_otg_core_if_t * _core_if); ++ ++extern void dwc_otg_hc_start_transfer_ddma(dwc_otg_core_if_t * core_if, ++ dwc_hc_t * hc); ++ ++extern uint32_t calc_frame_interval(dwc_otg_core_if_t * core_if); ++ ++/* Macro used to clear one channel interrupt */ ++#define clear_hc_int(_hc_regs_, _intr_) \ ++do { \ ++ hcint_data_t hcint_clear = {.d32 = 0}; \ ++ hcint_clear.b._intr_ = 1; \ ++ DWC_WRITE_REG32(&(_hc_regs_)->hcint, hcint_clear.d32); \ ++} while (0) ++ ++/* ++ * Macro used to disable one channel interrupt. Channel interrupts are ++ * disabled when the channel is halted or released by the interrupt handler. ++ * There is no need to handle further interrupts of that type until the ++ * channel is re-assigned. In fact, subsequent handling may cause crashes ++ * because the channel structures are cleaned up when the channel is released. ++ */ ++#define disable_hc_int(_hc_regs_, _intr_) \ ++do { \ ++ hcintmsk_data_t hcintmsk = {.d32 = 0}; \ ++ hcintmsk.b._intr_ = 1; \ ++ DWC_MODIFY_REG32(&(_hc_regs_)->hcintmsk, hcintmsk.d32, 0); \ ++} while (0) ++ ++/** ++ * This function Reads HPRT0 in preparation to modify. It keeps the ++ * WC bits 0 so that if they are read as 1, they won't clear when you ++ * write it back ++ */ ++static inline uint32_t dwc_otg_read_hprt0(dwc_otg_core_if_t * _core_if) ++{ ++ hprt0_data_t hprt0; ++ hprt0.d32 = DWC_READ_REG32(_core_if->host_if->hprt0); ++ hprt0.b.prtena = 0; ++ hprt0.b.prtconndet = 0; ++ hprt0.b.prtenchng = 0; ++ hprt0.b.prtovrcurrchng = 0; ++ return hprt0.d32; ++} ++ ++/**@}*/ ++ ++/** @name Common CIL Functions ++ * The following functions support managing the DWC_otg controller in either ++ * device or host mode. ++ */ ++/**@{*/ ++ ++extern void dwc_otg_read_packet(dwc_otg_core_if_t * core_if, ++ uint8_t * dest, uint16_t bytes); ++ ++extern void dwc_otg_flush_tx_fifo(dwc_otg_core_if_t * _core_if, const int _num); ++extern void dwc_otg_flush_rx_fifo(dwc_otg_core_if_t * _core_if); ++extern void dwc_otg_core_reset(dwc_otg_core_if_t * _core_if); ++ ++/** ++ * This function returns the Core Interrupt register. ++ */ ++static inline uint32_t dwc_otg_read_core_intr(dwc_otg_core_if_t * core_if) ++{ ++ return (DWC_READ_REG32(&core_if->core_global_regs->gintsts) & ++ DWC_READ_REG32(&core_if->core_global_regs->gintmsk)); ++} ++ ++/** ++ * This function returns the OTG Interrupt register. ++ */ ++static inline uint32_t dwc_otg_read_otg_intr(dwc_otg_core_if_t * core_if) ++{ ++ return (DWC_READ_REG32(&core_if->core_global_regs->gotgint)); ++} ++ ++/** ++ * This function reads the Device All Endpoints Interrupt register and ++ * returns the IN endpoint interrupt bits. ++ */ ++static inline uint32_t dwc_otg_read_dev_all_in_ep_intr(dwc_otg_core_if_t * ++ core_if) ++{ ++ ++ uint32_t v; ++ ++ if (core_if->multiproc_int_enable) { ++ v = DWC_READ_REG32(&core_if->dev_if-> ++ dev_global_regs->deachint) & ++ DWC_READ_REG32(&core_if-> ++ dev_if->dev_global_regs->deachintmsk); ++ } else { ++ v = DWC_READ_REG32(&core_if->dev_if->dev_global_regs->daint) & ++ DWC_READ_REG32(&core_if->dev_if->dev_global_regs->daintmsk); ++ } ++ return (v & 0xffff); ++} ++ ++/** ++ * This function reads the Device All Endpoints Interrupt register and ++ * returns the OUT endpoint interrupt bits. ++ */ ++static inline uint32_t dwc_otg_read_dev_all_out_ep_intr(dwc_otg_core_if_t * ++ core_if) ++{ ++ uint32_t v; ++ ++ if (core_if->multiproc_int_enable) { ++ v = DWC_READ_REG32(&core_if->dev_if-> ++ dev_global_regs->deachint) & ++ DWC_READ_REG32(&core_if-> ++ dev_if->dev_global_regs->deachintmsk); ++ } else { ++ v = DWC_READ_REG32(&core_if->dev_if->dev_global_regs->daint) & ++ DWC_READ_REG32(&core_if->dev_if->dev_global_regs->daintmsk); ++ } ++ ++ return ((v & 0xffff0000) >> 16); ++} ++ ++/** ++ * This function returns the Device IN EP Interrupt register ++ */ ++static inline uint32_t dwc_otg_read_dev_in_ep_intr(dwc_otg_core_if_t * core_if, ++ dwc_ep_t * ep) ++{ ++ dwc_otg_dev_if_t *dev_if = core_if->dev_if; ++ uint32_t v, msk, emp; ++ ++ if (core_if->multiproc_int_enable) { ++ msk = ++ DWC_READ_REG32(&dev_if-> ++ dev_global_regs->diepeachintmsk[ep->num]); ++ emp = ++ DWC_READ_REG32(&dev_if-> ++ dev_global_regs->dtknqr4_fifoemptymsk); ++ msk |= ((emp >> ep->num) & 0x1) << 7; ++ v = DWC_READ_REG32(&dev_if->in_ep_regs[ep->num]->diepint) & msk; ++ } else { ++ msk = DWC_READ_REG32(&dev_if->dev_global_regs->diepmsk); ++ emp = ++ DWC_READ_REG32(&dev_if-> ++ dev_global_regs->dtknqr4_fifoemptymsk); ++ msk |= ((emp >> ep->num) & 0x1) << 7; ++ v = DWC_READ_REG32(&dev_if->in_ep_regs[ep->num]->diepint) & msk; ++ } ++ ++ return v; ++} ++ ++/** ++ * This function returns the Device OUT EP Interrupt register ++ */ ++static inline uint32_t dwc_otg_read_dev_out_ep_intr(dwc_otg_core_if_t * ++ _core_if, dwc_ep_t * _ep) ++{ ++ dwc_otg_dev_if_t *dev_if = _core_if->dev_if; ++ uint32_t v; ++ doepmsk_data_t msk = {.d32 = 0 }; ++ ++ if (_core_if->multiproc_int_enable) { ++ msk.d32 = ++ DWC_READ_REG32(&dev_if-> ++ dev_global_regs->doepeachintmsk[_ep->num]); ++ if (_core_if->pti_enh_enable) { ++ msk.b.pktdrpsts = 1; ++ } ++ v = DWC_READ_REG32(&dev_if-> ++ out_ep_regs[_ep->num]->doepint) & msk.d32; ++ } else { ++ msk.d32 = DWC_READ_REG32(&dev_if->dev_global_regs->doepmsk); ++ if (_core_if->pti_enh_enable) { ++ msk.b.pktdrpsts = 1; ++ } ++ v = DWC_READ_REG32(&dev_if-> ++ out_ep_regs[_ep->num]->doepint) & msk.d32; ++ } ++ return v; ++} ++ ++/** ++ * This function returns the Host All Channel Interrupt register ++ */ ++static inline uint32_t dwc_otg_read_host_all_channels_intr(dwc_otg_core_if_t * ++ _core_if) ++{ ++ return (DWC_READ_REG32(&_core_if->host_if->host_global_regs->haint)); ++} ++ ++static inline uint32_t dwc_otg_read_host_channel_intr(dwc_otg_core_if_t * ++ _core_if, dwc_hc_t * _hc) ++{ ++ return (DWC_READ_REG32 ++ (&_core_if->host_if->hc_regs[_hc->hc_num]->hcint)); ++} ++ ++/** ++ * This function returns the mode of the operation, host or device. ++ * ++ * @return 0 - Device Mode, 1 - Host Mode ++ */ ++static inline uint32_t dwc_otg_mode(dwc_otg_core_if_t * _core_if) ++{ ++ return (DWC_READ_REG32(&_core_if->core_global_regs->gintsts) & 0x1); ++} ++ ++/**@}*/ ++ ++/** ++ * DWC_otg CIL callback structure. This structure allows the HCD and ++ * PCD to register functions used for starting and stopping the PCD ++ * and HCD for role change on for a DRD. ++ */ ++typedef struct dwc_otg_cil_callbacks { ++ /** Start function for role change */ ++ int (*start) (void *_p); ++ /** Stop Function for role change */ ++ int (*stop) (void *_p); ++ /** Disconnect Function for role change */ ++ int (*disconnect) (void *_p); ++ /** Resume/Remote wakeup Function */ ++ int (*resume_wakeup) (void *_p); ++ /** Suspend function */ ++ int (*suspend) (void *_p); ++ /** Session Start (SRP) */ ++ int (*session_start) (void *_p); ++#ifdef CONFIG_USB_DWC_OTG_LPM ++ /** Sleep (switch to L0 state) */ ++ int (*sleep) (void *_p); ++#endif ++ /** Pointer passed to start() and stop() */ ++ void *p; ++} dwc_otg_cil_callbacks_t; ++ ++extern void dwc_otg_cil_register_pcd_callbacks(dwc_otg_core_if_t * _core_if, ++ dwc_otg_cil_callbacks_t * _cb, ++ void *_p); ++extern void dwc_otg_cil_register_hcd_callbacks(dwc_otg_core_if_t * _core_if, ++ dwc_otg_cil_callbacks_t * _cb, ++ void *_p); ++ ++void dwc_otg_initiate_srp(dwc_otg_core_if_t * core_if); ++ ++////////////////////////////////////////////////////////////////////// ++/** Start the HCD. Helper function for using the HCD callbacks. ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ */ ++static inline void cil_hcd_start(dwc_otg_core_if_t * core_if) ++{ ++ if (core_if->hcd_cb && core_if->hcd_cb->start) { ++ core_if->hcd_cb->start(core_if->hcd_cb->p); ++ } ++} ++ ++/** Stop the HCD. Helper function for using the HCD callbacks. ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ */ ++static inline void cil_hcd_stop(dwc_otg_core_if_t * core_if) ++{ ++ if (core_if->hcd_cb && core_if->hcd_cb->stop) { ++ core_if->hcd_cb->stop(core_if->hcd_cb->p); ++ } ++} ++ ++/** Disconnect the HCD. Helper function for using the HCD callbacks. ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ */ ++static inline void cil_hcd_disconnect(dwc_otg_core_if_t * core_if) ++{ ++ if (core_if->hcd_cb && core_if->hcd_cb->disconnect) { ++ core_if->hcd_cb->disconnect(core_if->hcd_cb->p); ++ } ++} ++ ++/** Inform the HCD the a New Session has begun. Helper function for ++ * using the HCD callbacks. ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ */ ++static inline void cil_hcd_session_start(dwc_otg_core_if_t * core_if) ++{ ++ if (core_if->hcd_cb && core_if->hcd_cb->session_start) { ++ core_if->hcd_cb->session_start(core_if->hcd_cb->p); ++ } ++} ++ ++#ifdef CONFIG_USB_DWC_OTG_LPM ++/** ++ * Inform the HCD about LPM sleep. ++ * Helper function for using the HCD callbacks. ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ */ ++static inline void cil_hcd_sleep(dwc_otg_core_if_t * core_if) ++{ ++ if (core_if->hcd_cb && core_if->hcd_cb->sleep) { ++ core_if->hcd_cb->sleep(core_if->hcd_cb->p); ++ } ++} ++#endif ++ ++/** Resume the HCD. Helper function for using the HCD callbacks. ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ */ ++static inline void cil_hcd_resume(dwc_otg_core_if_t * core_if) ++{ ++ if (core_if->hcd_cb && core_if->hcd_cb->resume_wakeup) { ++ core_if->hcd_cb->resume_wakeup(core_if->hcd_cb->p); ++ } ++} ++ ++/** Start the PCD. Helper function for using the PCD callbacks. ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ */ ++static inline void cil_pcd_start(dwc_otg_core_if_t * core_if) ++{ ++ if (core_if->pcd_cb && core_if->pcd_cb->start) { ++ core_if->pcd_cb->start(core_if->pcd_cb->p); ++ } ++} ++ ++/** Stop the PCD. Helper function for using the PCD callbacks. ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ */ ++static inline void cil_pcd_stop(dwc_otg_core_if_t * core_if) ++{ ++ if (core_if->pcd_cb && core_if->pcd_cb->stop) { ++ core_if->pcd_cb->stop(core_if->pcd_cb->p); ++ } ++} ++ ++/** Suspend the PCD. Helper function for using the PCD callbacks. ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ */ ++static inline void cil_pcd_suspend(dwc_otg_core_if_t * core_if) ++{ ++ if (core_if->pcd_cb && core_if->pcd_cb->suspend) { ++ core_if->pcd_cb->suspend(core_if->pcd_cb->p); ++ } ++} ++ ++/** Resume the PCD. Helper function for using the PCD callbacks. ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ */ ++static inline void cil_pcd_resume(dwc_otg_core_if_t * core_if) ++{ ++ if (core_if->pcd_cb && core_if->pcd_cb->resume_wakeup) { ++ core_if->pcd_cb->resume_wakeup(core_if->pcd_cb->p); ++ } ++} ++ ++////////////////////////////////////////////////////////////////////// ++ ++#endif +diff --git a/drivers/usb/host/dwc_otg/dwc_otg_cil_intr.c b/drivers/usb/host/dwc_otg/dwc_otg_cil_intr.c +new file mode 100644 +index 0000000..96c76e3 +--- /dev/null ++++ b/drivers/usb/host/dwc_otg/dwc_otg_cil_intr.c +@@ -0,0 +1,1594 @@ ++/* ========================================================================== ++ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_cil_intr.c $ ++ * $Revision: #32 $ ++ * $Date: 2012/08/10 $ ++ * $Change: 2047372 $ ++ * ++ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, ++ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless ++ * otherwise expressly agreed to in writing between Synopsys and you. ++ * ++ * The Software IS NOT an item of Licensed Software or Licensed Product under ++ * any End User Software License Agreement or Agreement for Licensed Product ++ * with Synopsys or any supplement thereto. You are permitted to use and ++ * redistribute this Software in source and binary forms, with or without ++ * modification, provided that redistributions of source code must retain this ++ * notice. You may not view, use, disclose, copy or distribute this file or ++ * any information contained herein except pursuant to this license grant from ++ * Synopsys. If you do not agree with this notice, including the disclaimer ++ * below, then you are not authorized to use the Software. ++ * ++ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS ++ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS 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. ++ * ========================================================================== */ ++ ++/** @file ++ * ++ * The Core Interface Layer provides basic services for accessing and ++ * managing the DWC_otg hardware. These services are used by both the ++ * Host Controller Driver and the Peripheral Controller Driver. ++ * ++ * This file contains the Common Interrupt handlers. ++ */ ++#include "dwc_os.h" ++#include "dwc_otg_regs.h" ++#include "dwc_otg_cil.h" ++#include "dwc_otg_driver.h" ++#include "dwc_otg_pcd.h" ++#include "dwc_otg_hcd.h" ++ ++#ifdef DEBUG ++inline const char *op_state_str(dwc_otg_core_if_t * core_if) ++{ ++ return (core_if->op_state == A_HOST ? "a_host" : ++ (core_if->op_state == A_SUSPEND ? "a_suspend" : ++ (core_if->op_state == A_PERIPHERAL ? "a_peripheral" : ++ (core_if->op_state == B_PERIPHERAL ? "b_peripheral" : ++ (core_if->op_state == B_HOST ? "b_host" : "unknown"))))); ++} ++#endif ++ ++/** This function will log a debug message ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ */ ++int32_t dwc_otg_handle_mode_mismatch_intr(dwc_otg_core_if_t * core_if) ++{ ++ gintsts_data_t gintsts; ++ DWC_WARN("Mode Mismatch Interrupt: currently in %s mode\n", ++ dwc_otg_mode(core_if) ? "Host" : "Device"); ++ ++ /* Clear interrupt */ ++ gintsts.d32 = 0; ++ gintsts.b.modemismatch = 1; ++ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, gintsts.d32); ++ return 1; ++} ++ ++/** ++ * This function handles the OTG Interrupts. It reads the OTG ++ * Interrupt Register (GOTGINT) to determine what interrupt has ++ * occurred. ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ */ ++int32_t dwc_otg_handle_otg_intr(dwc_otg_core_if_t * core_if) ++{ ++ dwc_otg_core_global_regs_t *global_regs = core_if->core_global_regs; ++ gotgint_data_t gotgint; ++ gotgctl_data_t gotgctl; ++ gintmsk_data_t gintmsk; ++ gpwrdn_data_t gpwrdn; ++ ++ gotgint.d32 = DWC_READ_REG32(&global_regs->gotgint); ++ gotgctl.d32 = DWC_READ_REG32(&global_regs->gotgctl); ++ DWC_DEBUGPL(DBG_CIL, "++OTG Interrupt gotgint=%0x [%s]\n", gotgint.d32, ++ op_state_str(core_if)); ++ ++ if (gotgint.b.sesenddet) { ++ DWC_DEBUGPL(DBG_ANY, " ++OTG Interrupt: " ++ "Session End Detected++ (%s)\n", ++ op_state_str(core_if)); ++ gotgctl.d32 = DWC_READ_REG32(&global_regs->gotgctl); ++ ++ if (core_if->op_state == B_HOST) { ++ cil_pcd_start(core_if); ++ core_if->op_state = B_PERIPHERAL; ++ } else { ++ /* If not B_HOST and Device HNP still set. HNP ++ * Did not succeed!*/ ++ if (gotgctl.b.devhnpen) { ++ DWC_DEBUGPL(DBG_ANY, "Session End Detected\n"); ++ __DWC_ERROR("Device Not Connected/Responding!\n"); ++ } ++ ++ /* If Session End Detected the B-Cable has ++ * been disconnected. */ ++ /* Reset PCD and Gadget driver to a ++ * clean state. */ ++ core_if->lx_state = DWC_OTG_L0; ++ DWC_SPINUNLOCK(core_if->lock); ++ cil_pcd_stop(core_if); ++ DWC_SPINLOCK(core_if->lock); ++ ++ if (core_if->adp_enable) { ++ if (core_if->power_down == 2) { ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pwrdnswtch = 1; ++ DWC_MODIFY_REG32(&core_if-> ++ core_global_regs-> ++ gpwrdn, gpwrdn.d32, 0); ++ } ++ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pmuintsel = 1; ++ gpwrdn.b.pmuactv = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs-> ++ gpwrdn, 0, gpwrdn.d32); ++ ++ dwc_otg_adp_sense_start(core_if); ++ } ++ } ++ ++ gotgctl.d32 = 0; ++ gotgctl.b.devhnpen = 1; ++ DWC_MODIFY_REG32(&global_regs->gotgctl, gotgctl.d32, 0); ++ } ++ if (gotgint.b.sesreqsucstschng) { ++ DWC_DEBUGPL(DBG_ANY, " ++OTG Interrupt: " ++ "Session Reqeust Success Status Change++\n"); ++ gotgctl.d32 = DWC_READ_REG32(&global_regs->gotgctl); ++ if (gotgctl.b.sesreqscs) { ++ ++ if ((core_if->core_params->phy_type == ++ DWC_PHY_TYPE_PARAM_FS) && (core_if->core_params->i2c_enable)) { ++ core_if->srp_success = 1; ++ } else { ++ DWC_SPINUNLOCK(core_if->lock); ++ cil_pcd_resume(core_if); ++ DWC_SPINLOCK(core_if->lock); ++ /* Clear Session Request */ ++ gotgctl.d32 = 0; ++ gotgctl.b.sesreq = 1; ++ DWC_MODIFY_REG32(&global_regs->gotgctl, ++ gotgctl.d32, 0); ++ } ++ } ++ } ++ if (gotgint.b.hstnegsucstschng) { ++ /* Print statements during the HNP interrupt handling ++ * can cause it to fail.*/ ++ gotgctl.d32 = DWC_READ_REG32(&global_regs->gotgctl); ++ /* WA for 3.00a- HW is not setting cur_mode, even sometimes ++ * this does not help*/ ++ if (core_if->snpsid >= OTG_CORE_REV_3_00a) ++ dwc_udelay(100); ++ if (gotgctl.b.hstnegscs) { ++ if (dwc_otg_is_host_mode(core_if)) { ++ core_if->op_state = B_HOST; ++ /* ++ * Need to disable SOF interrupt immediately. ++ * When switching from device to host, the PCD ++ * interrupt handler won't handle the ++ * interrupt if host mode is already set. The ++ * HCD interrupt handler won't get called if ++ * the HCD state is HALT. This means that the ++ * interrupt does not get handled and Linux ++ * complains loudly. ++ */ ++ gintmsk.d32 = 0; ++ gintmsk.b.sofintr = 1; ++ DWC_MODIFY_REG32(&global_regs->gintmsk, ++ gintmsk.d32, 0); ++ /* Call callback function with spin lock released */ ++ DWC_SPINUNLOCK(core_if->lock); ++ cil_pcd_stop(core_if); ++ /* ++ * Initialize the Core for Host mode. ++ */ ++ cil_hcd_start(core_if); ++ DWC_SPINLOCK(core_if->lock); ++ core_if->op_state = B_HOST; ++ } ++ } else { ++ gotgctl.d32 = 0; ++ gotgctl.b.hnpreq = 1; ++ gotgctl.b.devhnpen = 1; ++ DWC_MODIFY_REG32(&global_regs->gotgctl, gotgctl.d32, 0); ++ DWC_DEBUGPL(DBG_ANY, "HNP Failed\n"); ++ __DWC_ERROR("Device Not Connected/Responding\n"); ++ } ++ } ++ if (gotgint.b.hstnegdet) { ++ /* The disconnect interrupt is set at the same time as ++ * Host Negotiation Detected. During the mode ++ * switch all interrupts are cleared so the disconnect ++ * interrupt handler will not get executed. ++ */ ++ DWC_DEBUGPL(DBG_ANY, " ++OTG Interrupt: " ++ "Host Negotiation Detected++ (%s)\n", ++ (dwc_otg_is_host_mode(core_if) ? "Host" : ++ "Device")); ++ if (dwc_otg_is_device_mode(core_if)) { ++ DWC_DEBUGPL(DBG_ANY, "a_suspend->a_peripheral (%d)\n", ++ core_if->op_state); ++ DWC_SPINUNLOCK(core_if->lock); ++ cil_hcd_disconnect(core_if); ++ cil_pcd_start(core_if); ++ DWC_SPINLOCK(core_if->lock); ++ core_if->op_state = A_PERIPHERAL; ++ } else { ++ /* ++ * Need to disable SOF interrupt immediately. When ++ * switching from device to host, the PCD interrupt ++ * handler won't handle the interrupt if host mode is ++ * already set. The HCD interrupt handler won't get ++ * called if the HCD state is HALT. This means that ++ * the interrupt does not get handled and Linux ++ * complains loudly. ++ */ ++ gintmsk.d32 = 0; ++ gintmsk.b.sofintr = 1; ++ DWC_MODIFY_REG32(&global_regs->gintmsk, gintmsk.d32, 0); ++ DWC_SPINUNLOCK(core_if->lock); ++ cil_pcd_stop(core_if); ++ cil_hcd_start(core_if); ++ DWC_SPINLOCK(core_if->lock); ++ core_if->op_state = A_HOST; ++ } ++ } ++ if (gotgint.b.adevtoutchng) { ++ DWC_DEBUGPL(DBG_ANY, " ++OTG Interrupt: " ++ "A-Device Timeout Change++\n"); ++ } ++ if (gotgint.b.debdone) { ++ DWC_DEBUGPL(DBG_ANY, " ++OTG Interrupt: " "Debounce Done++\n"); ++ } ++ ++ /* Clear GOTGINT */ ++ DWC_WRITE_REG32(&core_if->core_global_regs->gotgint, gotgint.d32); ++ ++ return 1; ++} ++ ++void w_conn_id_status_change(void *p) ++{ ++ dwc_otg_core_if_t *core_if = p; ++ uint32_t count = 0; ++ gotgctl_data_t gotgctl = {.d32 = 0 }; ++ ++ gotgctl.d32 = DWC_READ_REG32(&core_if->core_global_regs->gotgctl); ++ DWC_DEBUGPL(DBG_CIL, "gotgctl=%0x\n", gotgctl.d32); ++ DWC_DEBUGPL(DBG_CIL, "gotgctl.b.conidsts=%d\n", gotgctl.b.conidsts); ++ ++ /* B-Device connector (Device Mode) */ ++ if (gotgctl.b.conidsts) { ++ /* Wait for switch to device mode. */ ++ while (!dwc_otg_is_device_mode(core_if)) { ++ DWC_PRINTF("Waiting for Peripheral Mode, Mode=%s\n", ++ (dwc_otg_is_host_mode(core_if) ? "Host" : ++ "Peripheral")); ++ dwc_mdelay(100); ++ if (++count > 10000) ++ break; ++ } ++ DWC_ASSERT(++count < 10000, ++ "Connection id status change timed out"); ++ core_if->op_state = B_PERIPHERAL; ++ dwc_otg_core_init(core_if); ++ dwc_otg_enable_global_interrupts(core_if); ++ cil_pcd_start(core_if); ++ } else { ++ /* A-Device connector (Host Mode) */ ++ while (!dwc_otg_is_host_mode(core_if)) { ++ DWC_PRINTF("Waiting for Host Mode, Mode=%s\n", ++ (dwc_otg_is_host_mode(core_if) ? "Host" : ++ "Peripheral")); ++ dwc_mdelay(100); ++ if (++count > 10000) ++ break; ++ } ++ DWC_ASSERT(++count < 10000, ++ "Connection id status change timed out"); ++ core_if->op_state = A_HOST; ++ /* ++ * Initialize the Core for Host mode. ++ */ ++ dwc_otg_core_init(core_if); ++ dwc_otg_enable_global_interrupts(core_if); ++ cil_hcd_start(core_if); ++ } ++} ++ ++/** ++ * This function handles the Connector ID Status Change Interrupt. It ++ * reads the OTG Interrupt Register (GOTCTL) to determine whether this ++ * is a Device to Host Mode transition or a Host Mode to Device ++ * Transition. ++ * ++ * This only occurs when the cable is connected/removed from the PHY ++ * connector. ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ */ ++int32_t dwc_otg_handle_conn_id_status_change_intr(dwc_otg_core_if_t * core_if) ++{ ++ ++ /* ++ * Need to disable SOF interrupt immediately. If switching from device ++ * to host, the PCD interrupt handler won't handle the interrupt if ++ * host mode is already set. The HCD interrupt handler won't get ++ * called if the HCD state is HALT. This means that the interrupt does ++ * not get handled and Linux complains loudly. ++ */ ++ gintmsk_data_t gintmsk = {.d32 = 0 }; ++ gintsts_data_t gintsts = {.d32 = 0 }; ++ ++ gintmsk.b.sofintr = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gintmsk, gintmsk.d32, 0); ++ ++ DWC_DEBUGPL(DBG_CIL, ++ " ++Connector ID Status Change Interrupt++ (%s)\n", ++ (dwc_otg_is_host_mode(core_if) ? "Host" : "Device")); ++ ++ DWC_SPINUNLOCK(core_if->lock); ++ ++ /* ++ * Need to schedule a work, as there are possible DELAY function calls ++ * Release lock before scheduling workq as it holds spinlock during scheduling ++ */ ++ ++ DWC_WORKQ_SCHEDULE(core_if->wq_otg, w_conn_id_status_change, ++ core_if, "connection id status change"); ++ DWC_SPINLOCK(core_if->lock); ++ ++ /* Set flag and clear interrupt */ ++ gintsts.b.conidstschng = 1; ++ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, gintsts.d32); ++ ++ return 1; ++} ++ ++/** ++ * This interrupt indicates that a device is initiating the Session ++ * Request Protocol to request the host to turn on bus power so a new ++ * session can begin. The handler responds by turning on bus power. If ++ * the DWC_otg controller is in low power mode, the handler brings the ++ * controller out of low power mode before turning on bus power. ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ */ ++int32_t dwc_otg_handle_session_req_intr(dwc_otg_core_if_t * core_if) ++{ ++ gintsts_data_t gintsts; ++ ++#ifndef DWC_HOST_ONLY ++ DWC_DEBUGPL(DBG_ANY, "++Session Request Interrupt++\n"); ++ ++ if (dwc_otg_is_device_mode(core_if)) { ++ DWC_PRINTF("SRP: Device mode\n"); ++ } else { ++ hprt0_data_t hprt0; ++ DWC_PRINTF("SRP: Host mode\n"); ++ ++ /* Turn on the port power bit. */ ++ hprt0.d32 = dwc_otg_read_hprt0(core_if); ++ hprt0.b.prtpwr = 1; ++ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); ++ ++ /* Start the Connection timer. So a message can be displayed ++ * if connect does not occur within 10 seconds. */ ++ cil_hcd_session_start(core_if); ++ } ++#endif ++ ++ /* Clear interrupt */ ++ gintsts.d32 = 0; ++ gintsts.b.sessreqintr = 1; ++ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, gintsts.d32); ++ ++ return 1; ++} ++ ++void w_wakeup_detected(void *p) ++{ ++ dwc_otg_core_if_t *core_if = (dwc_otg_core_if_t *) p; ++ /* ++ * Clear the Resume after 70ms. (Need 20 ms minimum. Use 70 ms ++ * so that OPT tests pass with all PHYs). ++ */ ++ hprt0_data_t hprt0 = {.d32 = 0 }; ++#if 0 ++ pcgcctl_data_t pcgcctl = {.d32 = 0 }; ++ /* Restart the Phy Clock */ ++ pcgcctl.b.stoppclk = 1; ++ DWC_MODIFY_REG32(core_if->pcgcctl, pcgcctl.d32, 0); ++ dwc_udelay(10); ++#endif //0 ++ hprt0.d32 = dwc_otg_read_hprt0(core_if); ++ DWC_DEBUGPL(DBG_ANY, "Resume: HPRT0=%0x\n", hprt0.d32); ++// dwc_mdelay(70); ++ hprt0.b.prtres = 0; /* Resume */ ++ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); ++ DWC_DEBUGPL(DBG_ANY, "Clear Resume: HPRT0=%0x\n", ++ DWC_READ_REG32(core_if->host_if->hprt0)); ++ ++ cil_hcd_resume(core_if); ++ ++ /** Change to L0 state*/ ++ core_if->lx_state = DWC_OTG_L0; ++} ++ ++/** ++ * This interrupt indicates that the DWC_otg controller has detected a ++ * resume or remote wakeup sequence. If the DWC_otg controller is in ++ * low power mode, the handler must brings the controller out of low ++ * power mode. The controller automatically begins resume ++ * signaling. The handler schedules a time to stop resume signaling. ++ */ ++int32_t dwc_otg_handle_wakeup_detected_intr(dwc_otg_core_if_t * core_if) ++{ ++ gintsts_data_t gintsts; ++ ++ DWC_DEBUGPL(DBG_ANY, ++ "++Resume and Remote Wakeup Detected Interrupt++\n"); ++ ++ DWC_PRINTF("%s lxstate = %d\n", __func__, core_if->lx_state); ++ ++ if (dwc_otg_is_device_mode(core_if)) { ++ dctl_data_t dctl = {.d32 = 0 }; ++ DWC_DEBUGPL(DBG_PCD, "DSTS=0x%0x\n", ++ DWC_READ_REG32(&core_if->dev_if->dev_global_regs-> ++ dsts)); ++ if (core_if->lx_state == DWC_OTG_L2) { ++#ifdef PARTIAL_POWER_DOWN ++ if (core_if->hwcfg4.b.power_optimiz) { ++ pcgcctl_data_t power = {.d32 = 0 }; ++ ++ power.d32 = DWC_READ_REG32(core_if->pcgcctl); ++ DWC_DEBUGPL(DBG_CIL, "PCGCCTL=%0x\n", ++ power.d32); ++ ++ power.b.stoppclk = 0; ++ DWC_WRITE_REG32(core_if->pcgcctl, power.d32); ++ ++ power.b.pwrclmp = 0; ++ DWC_WRITE_REG32(core_if->pcgcctl, power.d32); ++ ++ power.b.rstpdwnmodule = 0; ++ DWC_WRITE_REG32(core_if->pcgcctl, power.d32); ++ } ++#endif ++ /* Clear the Remote Wakeup Signaling */ ++ dctl.b.rmtwkupsig = 1; ++ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs-> ++ dctl, dctl.d32, 0); ++ ++ DWC_SPINUNLOCK(core_if->lock); ++ if (core_if->pcd_cb && core_if->pcd_cb->resume_wakeup) { ++ core_if->pcd_cb->resume_wakeup(core_if->pcd_cb->p); ++ } ++ DWC_SPINLOCK(core_if->lock); ++ } else { ++ glpmcfg_data_t lpmcfg; ++ lpmcfg.d32 = ++ DWC_READ_REG32(&core_if->core_global_regs->glpmcfg); ++ lpmcfg.b.hird_thres &= (~(1 << 4)); ++ DWC_WRITE_REG32(&core_if->core_global_regs->glpmcfg, ++ lpmcfg.d32); ++ } ++ /** Change to L0 state*/ ++ core_if->lx_state = DWC_OTG_L0; ++ } else { ++ if (core_if->lx_state != DWC_OTG_L1) { ++ pcgcctl_data_t pcgcctl = {.d32 = 0 }; ++ ++ /* Restart the Phy Clock */ ++ pcgcctl.b.stoppclk = 1; ++ DWC_MODIFY_REG32(core_if->pcgcctl, pcgcctl.d32, 0); ++ DWC_TIMER_SCHEDULE(core_if->wkp_timer, 71); ++ } else { ++ /** Change to L0 state*/ ++ core_if->lx_state = DWC_OTG_L0; ++ } ++ } ++ ++ /* Clear interrupt */ ++ gintsts.d32 = 0; ++ gintsts.b.wkupintr = 1; ++ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, gintsts.d32); ++ ++ return 1; ++} ++ ++/** ++ * This interrupt indicates that the Wakeup Logic has detected a ++ * Device disconnect. ++ */ ++static int32_t dwc_otg_handle_pwrdn_disconnect_intr(dwc_otg_core_if_t *core_if) ++{ ++ gpwrdn_data_t gpwrdn = { .d32 = 0 }; ++ gpwrdn_data_t gpwrdn_temp = { .d32 = 0 }; ++ gpwrdn_temp.d32 = DWC_READ_REG32(&core_if->core_global_regs->gpwrdn); ++ ++ DWC_PRINTF("%s called\n", __FUNCTION__); ++ ++ if (!core_if->hibernation_suspend) { ++ DWC_PRINTF("Already exited from Hibernation\n"); ++ return 1; ++ } ++ ++ /* Switch on the voltage to the core */ ++ gpwrdn.b.pwrdnswtch = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ dwc_udelay(10); ++ ++ /* Reset the core */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pwrdnrstn = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ dwc_udelay(10); ++ ++ /* Disable power clamps*/ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pwrdnclmp = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ ++ /* Remove reset the core signal */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pwrdnrstn = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, 0, gpwrdn.d32); ++ dwc_udelay(10); ++ ++ /* Disable PMU interrupt */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pmuintsel = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ ++ core_if->hibernation_suspend = 0; ++ ++ /* Disable PMU */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pmuactv = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ dwc_udelay(10); ++ ++ if (gpwrdn_temp.b.idsts) { ++ core_if->op_state = B_PERIPHERAL; ++ dwc_otg_core_init(core_if); ++ dwc_otg_enable_global_interrupts(core_if); ++ cil_pcd_start(core_if); ++ } else { ++ core_if->op_state = A_HOST; ++ dwc_otg_core_init(core_if); ++ dwc_otg_enable_global_interrupts(core_if); ++ cil_hcd_start(core_if); ++ } ++ ++ return 1; ++} ++ ++/** ++ * This interrupt indicates that the Wakeup Logic has detected a ++ * remote wakeup sequence. ++ */ ++static int32_t dwc_otg_handle_pwrdn_wakeup_detected_intr(dwc_otg_core_if_t * core_if) ++{ ++ gpwrdn_data_t gpwrdn = {.d32 = 0 }; ++ DWC_DEBUGPL(DBG_ANY, ++ "++Powerdown Remote Wakeup Detected Interrupt++\n"); ++ ++ if (!core_if->hibernation_suspend) { ++ DWC_PRINTF("Already exited from Hibernation\n"); ++ return 1; ++ } ++ ++ gpwrdn.d32 = DWC_READ_REG32(&core_if->core_global_regs->gpwrdn); ++ if (gpwrdn.b.idsts) { // Device Mode ++ if ((core_if->power_down == 2) ++ && (core_if->hibernation_suspend == 1)) { ++ dwc_otg_device_hibernation_restore(core_if, 0, 0); ++ } ++ } else { ++ if ((core_if->power_down == 2) ++ && (core_if->hibernation_suspend == 1)) { ++ dwc_otg_host_hibernation_restore(core_if, 1, 0); ++ } ++ } ++ return 1; ++} ++ ++static int32_t dwc_otg_handle_pwrdn_idsts_change(dwc_otg_device_t *otg_dev) ++{ ++ gpwrdn_data_t gpwrdn = {.d32 = 0 }; ++ gpwrdn_data_t gpwrdn_temp = {.d32 = 0 }; ++ dwc_otg_core_if_t *core_if = otg_dev->core_if; ++ ++ DWC_DEBUGPL(DBG_ANY, "%s called\n", __FUNCTION__); ++ gpwrdn_temp.d32 = DWC_READ_REG32(&core_if->core_global_regs->gpwrdn); ++ if (core_if->power_down == 2) { ++ if (!core_if->hibernation_suspend) { ++ DWC_PRINTF("Already exited from Hibernation\n"); ++ return 1; ++ } ++ DWC_DEBUGPL(DBG_ANY, "Exit from hibernation on ID sts change\n"); ++ /* Switch on the voltage to the core */ ++ gpwrdn.b.pwrdnswtch = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ dwc_udelay(10); ++ ++ /* Reset the core */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pwrdnrstn = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ dwc_udelay(10); ++ ++ /* Disable power clamps */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pwrdnclmp = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ ++ /* Remove reset the core signal */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pwrdnrstn = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, 0, gpwrdn.d32); ++ dwc_udelay(10); ++ ++ /* Disable PMU interrupt */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pmuintsel = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ ++ /*Indicates that we are exiting from hibernation */ ++ core_if->hibernation_suspend = 0; ++ ++ /* Disable PMU */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pmuactv = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ dwc_udelay(10); ++ ++ gpwrdn.d32 = core_if->gr_backup->gpwrdn_local; ++ if (gpwrdn.b.dis_vbus == 1) { ++ gpwrdn.d32 = 0; ++ gpwrdn.b.dis_vbus = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ } ++ ++ if (gpwrdn_temp.b.idsts) { ++ core_if->op_state = B_PERIPHERAL; ++ dwc_otg_core_init(core_if); ++ dwc_otg_enable_global_interrupts(core_if); ++ cil_pcd_start(core_if); ++ } else { ++ core_if->op_state = A_HOST; ++ dwc_otg_core_init(core_if); ++ dwc_otg_enable_global_interrupts(core_if); ++ cil_hcd_start(core_if); ++ } ++ } ++ ++ if (core_if->adp_enable) { ++ uint8_t is_host = 0; ++ DWC_SPINUNLOCK(core_if->lock); ++ /* Change the core_if's lock to hcd/pcd lock depend on mode? */ ++#ifndef DWC_HOST_ONLY ++ if (gpwrdn_temp.b.idsts) ++ core_if->lock = otg_dev->pcd->lock; ++#endif ++#ifndef DWC_DEVICE_ONLY ++ if (!gpwrdn_temp.b.idsts) { ++ core_if->lock = otg_dev->hcd->lock; ++ is_host = 1; ++ } ++#endif ++ DWC_PRINTF("RESTART ADP\n"); ++ if (core_if->adp.probe_enabled) ++ dwc_otg_adp_probe_stop(core_if); ++ if (core_if->adp.sense_enabled) ++ dwc_otg_adp_sense_stop(core_if); ++ if (core_if->adp.sense_timer_started) ++ DWC_TIMER_CANCEL(core_if->adp.sense_timer); ++ if (core_if->adp.vbuson_timer_started) ++ DWC_TIMER_CANCEL(core_if->adp.vbuson_timer); ++ core_if->adp.probe_timer_values[0] = -1; ++ core_if->adp.probe_timer_values[1] = -1; ++ core_if->adp.sense_timer_started = 0; ++ core_if->adp.vbuson_timer_started = 0; ++ core_if->adp.probe_counter = 0; ++ core_if->adp.gpwrdn = 0; ++ ++ /* Disable PMU and restart ADP */ ++ gpwrdn_temp.d32 = 0; ++ gpwrdn_temp.b.pmuactv = 1; ++ gpwrdn_temp.b.pmuintsel = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ DWC_PRINTF("Check point 1\n"); ++ dwc_mdelay(110); ++ dwc_otg_adp_start(core_if, is_host); ++ DWC_SPINLOCK(core_if->lock); ++ } ++ ++ ++ return 1; ++} ++ ++static int32_t dwc_otg_handle_pwrdn_session_change(dwc_otg_core_if_t * core_if) ++{ ++ gpwrdn_data_t gpwrdn = {.d32 = 0 }; ++ int32_t otg_cap_param = core_if->core_params->otg_cap; ++ DWC_DEBUGPL(DBG_ANY, "%s called\n", __FUNCTION__); ++ ++ gpwrdn.d32 = DWC_READ_REG32(&core_if->core_global_regs->gpwrdn); ++ if (core_if->power_down == 2) { ++ if (!core_if->hibernation_suspend) { ++ DWC_PRINTF("Already exited from Hibernation\n"); ++ return 1; ++ } ++ ++ if ((otg_cap_param != DWC_OTG_CAP_PARAM_HNP_SRP_CAPABLE || ++ otg_cap_param != DWC_OTG_CAP_PARAM_SRP_ONLY_CAPABLE) && ++ gpwrdn.b.bsessvld == 0) { ++ /* Save gpwrdn register for further usage if stschng interrupt */ ++ core_if->gr_backup->gpwrdn_local = ++ DWC_READ_REG32(&core_if->core_global_regs->gpwrdn); ++ /*Exit from ISR and wait for stschng interrupt with bsessvld = 1 */ ++ return 1; ++ } ++ ++ /* Switch on the voltage to the core */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pwrdnswtch = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ dwc_udelay(10); ++ ++ /* Reset the core */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pwrdnrstn = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ dwc_udelay(10); ++ ++ /* Disable power clamps */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pwrdnclmp = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ ++ /* Remove reset the core signal */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pwrdnrstn = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, 0, gpwrdn.d32); ++ dwc_udelay(10); ++ ++ /* Disable PMU interrupt */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pmuintsel = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ dwc_udelay(10); ++ ++ /*Indicates that we are exiting from hibernation */ ++ core_if->hibernation_suspend = 0; ++ ++ /* Disable PMU */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pmuactv = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ dwc_udelay(10); ++ ++ core_if->op_state = B_PERIPHERAL; ++ dwc_otg_core_init(core_if); ++ dwc_otg_enable_global_interrupts(core_if); ++ cil_pcd_start(core_if); ++ ++ if (otg_cap_param == DWC_OTG_CAP_PARAM_HNP_SRP_CAPABLE || ++ otg_cap_param == DWC_OTG_CAP_PARAM_SRP_ONLY_CAPABLE) { ++ /* ++ * Initiate SRP after initial ADP probe. ++ */ ++ dwc_otg_initiate_srp(core_if); ++ } ++ } ++ ++ return 1; ++} ++/** ++ * This interrupt indicates that the Wakeup Logic has detected a ++ * status change either on IDDIG or BSessVld. ++ */ ++static uint32_t dwc_otg_handle_pwrdn_stschng_intr(dwc_otg_device_t *otg_dev) ++{ ++ int retval; ++ gpwrdn_data_t gpwrdn = {.d32 = 0 }; ++ gpwrdn_data_t gpwrdn_temp = {.d32 = 0 }; ++ dwc_otg_core_if_t *core_if = otg_dev->core_if; ++ ++ DWC_PRINTF("%s called\n", __FUNCTION__); ++ ++ if (core_if->power_down == 2) { ++ if (core_if->hibernation_suspend <= 0) { ++ DWC_PRINTF("Already exited from Hibernation\n"); ++ return 1; ++ } else ++ gpwrdn_temp.d32 = core_if->gr_backup->gpwrdn_local; ++ ++ } else { ++ gpwrdn_temp.d32 = core_if->adp.gpwrdn; ++ } ++ ++ gpwrdn.d32 = DWC_READ_REG32(&core_if->core_global_regs->gpwrdn); ++ ++ if (gpwrdn.b.idsts ^ gpwrdn_temp.b.idsts) { ++ retval = dwc_otg_handle_pwrdn_idsts_change(otg_dev); ++ } else if (gpwrdn.b.bsessvld ^ gpwrdn_temp.b.bsessvld) { ++ retval = dwc_otg_handle_pwrdn_session_change(core_if); ++ } ++ ++ return retval; ++} ++ ++/** ++ * This interrupt indicates that the Wakeup Logic has detected a ++ * SRP. ++ */ ++static int32_t dwc_otg_handle_pwrdn_srp_intr(dwc_otg_core_if_t * core_if) ++{ ++ gpwrdn_data_t gpwrdn = {.d32 = 0 }; ++ ++ DWC_PRINTF("%s called\n", __FUNCTION__); ++ ++ if (!core_if->hibernation_suspend) { ++ DWC_PRINTF("Already exited from Hibernation\n"); ++ return 1; ++ } ++#ifdef DWC_DEV_SRPCAP ++ if (core_if->pwron_timer_started) { ++ core_if->pwron_timer_started = 0; ++ DWC_TIMER_CANCEL(core_if->pwron_timer); ++ } ++#endif ++ ++ /* Switch on the voltage to the core */ ++ gpwrdn.b.pwrdnswtch = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ dwc_udelay(10); ++ ++ /* Reset the core */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pwrdnrstn = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ dwc_udelay(10); ++ ++ /* Disable power clamps */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pwrdnclmp = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ ++ /* Remove reset the core signal */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pwrdnrstn = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, 0, gpwrdn.d32); ++ dwc_udelay(10); ++ ++ /* Disable PMU interrupt */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pmuintsel = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ ++ /* Indicates that we are exiting from hibernation */ ++ core_if->hibernation_suspend = 0; ++ ++ /* Disable PMU */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pmuactv = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ dwc_udelay(10); ++ ++ /* Programm Disable VBUS to 0 */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.dis_vbus = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ ++ /*Initialize the core as Host */ ++ core_if->op_state = A_HOST; ++ dwc_otg_core_init(core_if); ++ dwc_otg_enable_global_interrupts(core_if); ++ cil_hcd_start(core_if); ++ ++ return 1; ++} ++ ++/** This interrupt indicates that restore command after Hibernation ++ * was completed by the core. */ ++int32_t dwc_otg_handle_restore_done_intr(dwc_otg_core_if_t * core_if) ++{ ++ pcgcctl_data_t pcgcctl; ++ DWC_DEBUGPL(DBG_ANY, "++Restore Done Interrupt++\n"); ++ ++ //TODO De-assert restore signal. 8.a ++ pcgcctl.d32 = DWC_READ_REG32(core_if->pcgcctl); ++ if (pcgcctl.b.restoremode == 1) { ++ gintmsk_data_t gintmsk = {.d32 = 0 }; ++ /* ++ * If restore mode is Remote Wakeup, ++ * unmask Remote Wakeup interrupt. ++ */ ++ gintmsk.b.wkupintr = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gintmsk, ++ 0, gintmsk.d32); ++ } ++ ++ return 1; ++} ++ ++/** ++ * This interrupt indicates that a device has been disconnected from ++ * the root port. ++ */ ++int32_t dwc_otg_handle_disconnect_intr(dwc_otg_core_if_t * core_if) ++{ ++ gintsts_data_t gintsts; ++ ++ DWC_DEBUGPL(DBG_ANY, "++Disconnect Detected Interrupt++ (%s) %s\n", ++ (dwc_otg_is_host_mode(core_if) ? "Host" : "Device"), ++ op_state_str(core_if)); ++ ++/** @todo Consolidate this if statement. */ ++#ifndef DWC_HOST_ONLY ++ if (core_if->op_state == B_HOST) { ++ /* If in device mode Disconnect and stop the HCD, then ++ * start the PCD. */ ++ DWC_SPINUNLOCK(core_if->lock); ++ cil_hcd_disconnect(core_if); ++ cil_pcd_start(core_if); ++ DWC_SPINLOCK(core_if->lock); ++ core_if->op_state = B_PERIPHERAL; ++ } else if (dwc_otg_is_device_mode(core_if)) { ++ gotgctl_data_t gotgctl = {.d32 = 0 }; ++ gotgctl.d32 = ++ DWC_READ_REG32(&core_if->core_global_regs->gotgctl); ++ if (gotgctl.b.hstsethnpen == 1) { ++ /* Do nothing, if HNP in process the OTG ++ * interrupt "Host Negotiation Detected" ++ * interrupt will do the mode switch. ++ */ ++ } else if (gotgctl.b.devhnpen == 0) { ++ /* If in device mode Disconnect and stop the HCD, then ++ * start the PCD. */ ++ DWC_SPINUNLOCK(core_if->lock); ++ cil_hcd_disconnect(core_if); ++ cil_pcd_start(core_if); ++ DWC_SPINLOCK(core_if->lock); ++ core_if->op_state = B_PERIPHERAL; ++ } else { ++ DWC_DEBUGPL(DBG_ANY, "!a_peripheral && !devhnpen\n"); ++ } ++ } else { ++ if (core_if->op_state == A_HOST) { ++ /* A-Cable still connected but device disconnected. */ ++ cil_hcd_disconnect(core_if); ++ if (core_if->adp_enable) { ++ gpwrdn_data_t gpwrdn = { .d32 = 0 }; ++ cil_hcd_stop(core_if); ++ /* Enable Power Down Logic */ ++ gpwrdn.b.pmuintsel = 1; ++ gpwrdn.b.pmuactv = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs-> ++ gpwrdn, 0, gpwrdn.d32); ++ dwc_otg_adp_probe_start(core_if); ++ ++ /* Power off the core */ ++ if (core_if->power_down == 2) { ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pwrdnswtch = 1; ++ DWC_MODIFY_REG32 ++ (&core_if->core_global_regs->gpwrdn, ++ gpwrdn.d32, 0); ++ } ++ } ++ } ++ } ++#endif ++ /* Change to L3(OFF) state */ ++ core_if->lx_state = DWC_OTG_L3; ++ ++ gintsts.d32 = 0; ++ gintsts.b.disconnect = 1; ++ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, gintsts.d32); ++ return 1; ++} ++ ++/** ++ * This interrupt indicates that SUSPEND state has been detected on ++ * the USB. ++ * ++ * For HNP the USB Suspend interrupt signals the change from ++ * "a_peripheral" to "a_host". ++ * ++ * When power management is enabled the core will be put in low power ++ * mode. ++ */ ++int32_t dwc_otg_handle_usb_suspend_intr(dwc_otg_core_if_t * core_if) ++{ ++ dsts_data_t dsts; ++ gintsts_data_t gintsts; ++ dcfg_data_t dcfg; ++ ++ DWC_DEBUGPL(DBG_ANY, "USB SUSPEND\n"); ++ ++ if (dwc_otg_is_device_mode(core_if)) { ++ /* Check the Device status register to determine if the Suspend ++ * state is active. */ ++ dsts.d32 = ++ DWC_READ_REG32(&core_if->dev_if->dev_global_regs->dsts); ++ DWC_DEBUGPL(DBG_PCD, "DSTS=0x%0x\n", dsts.d32); ++ DWC_DEBUGPL(DBG_PCD, "DSTS.Suspend Status=%d " ++ "HWCFG4.power Optimize=%d\n", ++ dsts.b.suspsts, core_if->hwcfg4.b.power_optimiz); ++ ++#ifdef PARTIAL_POWER_DOWN ++/** @todo Add a module parameter for power management. */ ++ ++ if (dsts.b.suspsts && core_if->hwcfg4.b.power_optimiz) { ++ pcgcctl_data_t power = {.d32 = 0 }; ++ DWC_DEBUGPL(DBG_CIL, "suspend\n"); ++ ++ power.b.pwrclmp = 1; ++ DWC_WRITE_REG32(core_if->pcgcctl, power.d32); ++ ++ power.b.rstpdwnmodule = 1; ++ DWC_MODIFY_REG32(core_if->pcgcctl, 0, power.d32); ++ ++ power.b.stoppclk = 1; ++ DWC_MODIFY_REG32(core_if->pcgcctl, 0, power.d32); ++ ++ } else { ++ DWC_DEBUGPL(DBG_ANY, "disconnect?\n"); ++ } ++#endif ++ /* PCD callback for suspend. Release the lock inside of callback function */ ++ cil_pcd_suspend(core_if); ++ if (core_if->power_down == 2) ++ { ++ dcfg.d32 = DWC_READ_REG32(&core_if->dev_if->dev_global_regs->dcfg); ++ DWC_DEBUGPL(DBG_ANY,"lx_state = %08x\n",core_if->lx_state); ++ DWC_DEBUGPL(DBG_ANY," device address = %08d\n",dcfg.b.devaddr); ++ ++ if (core_if->lx_state != DWC_OTG_L3 && dcfg.b.devaddr) { ++ pcgcctl_data_t pcgcctl = {.d32 = 0 }; ++ gpwrdn_data_t gpwrdn = {.d32 = 0 }; ++ gusbcfg_data_t gusbcfg = {.d32 = 0 }; ++ ++ /* Change to L2(suspend) state */ ++ core_if->lx_state = DWC_OTG_L2; ++ ++ /* Clear interrupt in gintsts */ ++ gintsts.d32 = 0; ++ gintsts.b.usbsuspend = 1; ++ DWC_WRITE_REG32(&core_if->core_global_regs-> ++ gintsts, gintsts.d32); ++ DWC_PRINTF("Start of hibernation completed\n"); ++ dwc_otg_save_global_regs(core_if); ++ dwc_otg_save_dev_regs(core_if); ++ ++ gusbcfg.d32 = ++ DWC_READ_REG32(&core_if->core_global_regs-> ++ gusbcfg); ++ if (gusbcfg.b.ulpi_utmi_sel == 1) { ++ /* ULPI interface */ ++ /* Suspend the Phy Clock */ ++ pcgcctl.d32 = 0; ++ pcgcctl.b.stoppclk = 1; ++ DWC_MODIFY_REG32(core_if->pcgcctl, 0, ++ pcgcctl.d32); ++ dwc_udelay(10); ++ gpwrdn.b.pmuactv = 1; ++ DWC_MODIFY_REG32(&core_if-> ++ core_global_regs-> ++ gpwrdn, 0, gpwrdn.d32); ++ } else { ++ /* UTMI+ Interface */ ++ gpwrdn.b.pmuactv = 1; ++ DWC_MODIFY_REG32(&core_if-> ++ core_global_regs-> ++ gpwrdn, 0, gpwrdn.d32); ++ dwc_udelay(10); ++ pcgcctl.b.stoppclk = 1; ++ DWC_MODIFY_REG32(core_if->pcgcctl, 0, ++ pcgcctl.d32); ++ dwc_udelay(10); ++ } ++ ++ /* Set flag to indicate that we are in hibernation */ ++ core_if->hibernation_suspend = 1; ++ /* Enable interrupts from wake up logic */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pmuintsel = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs-> ++ gpwrdn, 0, gpwrdn.d32); ++ dwc_udelay(10); ++ ++ /* Unmask device mode interrupts in GPWRDN */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.rst_det_msk = 1; ++ gpwrdn.b.lnstchng_msk = 1; ++ gpwrdn.b.sts_chngint_msk = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs-> ++ gpwrdn, 0, gpwrdn.d32); ++ dwc_udelay(10); ++ ++ /* Enable Power Down Clamp */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pwrdnclmp = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs-> ++ gpwrdn, 0, gpwrdn.d32); ++ dwc_udelay(10); ++ ++ /* Switch off VDD */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pwrdnswtch = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs-> ++ gpwrdn, 0, gpwrdn.d32); ++ ++ /* Save gpwrdn register for further usage if stschng interrupt */ ++ core_if->gr_backup->gpwrdn_local = ++ DWC_READ_REG32(&core_if->core_global_regs->gpwrdn); ++ DWC_PRINTF("Hibernation completed\n"); ++ ++ return 1; ++ } ++ } else if (core_if->power_down == 3) { ++ pcgcctl_data_t pcgcctl = {.d32 = 0 }; ++ dcfg.d32 = DWC_READ_REG32(&core_if->dev_if->dev_global_regs->dcfg); ++ DWC_DEBUGPL(DBG_ANY, "lx_state = %08x\n",core_if->lx_state); ++ DWC_DEBUGPL(DBG_ANY, " device address = %08d\n",dcfg.b.devaddr); ++ ++ if (core_if->lx_state != DWC_OTG_L3 && dcfg.b.devaddr) { ++ DWC_DEBUGPL(DBG_ANY, "Start entering to extended hibernation\n"); ++ core_if->xhib = 1; ++ ++ /* Clear interrupt in gintsts */ ++ gintsts.d32 = 0; ++ gintsts.b.usbsuspend = 1; ++ DWC_WRITE_REG32(&core_if->core_global_regs-> ++ gintsts, gintsts.d32); ++ ++ dwc_otg_save_global_regs(core_if); ++ dwc_otg_save_dev_regs(core_if); ++ ++ /* Wait for 10 PHY clocks */ ++ dwc_udelay(10); ++ ++ /* Program GPIO register while entering to xHib */ ++ DWC_WRITE_REG32(&core_if->core_global_regs->ggpio, 0x1); ++ ++ pcgcctl.b.enbl_extnd_hiber = 1; ++ DWC_MODIFY_REG32(core_if->pcgcctl, 0, pcgcctl.d32); ++ DWC_MODIFY_REG32(core_if->pcgcctl, 0, pcgcctl.d32); ++ ++ pcgcctl.d32 = 0; ++ pcgcctl.b.extnd_hiber_pwrclmp = 1; ++ DWC_MODIFY_REG32(core_if->pcgcctl, 0, pcgcctl.d32); ++ ++ pcgcctl.d32 = 0; ++ pcgcctl.b.extnd_hiber_switch = 1; ++ core_if->gr_backup->xhib_gpwrdn = DWC_READ_REG32(&core_if->core_global_regs->gpwrdn); ++ core_if->gr_backup->xhib_pcgcctl = DWC_READ_REG32(core_if->pcgcctl) | pcgcctl.d32; ++ DWC_MODIFY_REG32(core_if->pcgcctl, 0, pcgcctl.d32); ++ ++ DWC_DEBUGPL(DBG_ANY, "Finished entering to extended hibernation\n"); ++ ++ return 1; ++ } ++ } ++ } else { ++ if (core_if->op_state == A_PERIPHERAL) { ++ DWC_DEBUGPL(DBG_ANY, "a_peripheral->a_host\n"); ++ /* Clear the a_peripheral flag, back to a_host. */ ++ DWC_SPINUNLOCK(core_if->lock); ++ cil_pcd_stop(core_if); ++ cil_hcd_start(core_if); ++ DWC_SPINLOCK(core_if->lock); ++ core_if->op_state = A_HOST; ++ } ++ } ++ ++ /* Change to L2(suspend) state */ ++ core_if->lx_state = DWC_OTG_L2; ++ ++ /* Clear interrupt */ ++ gintsts.d32 = 0; ++ gintsts.b.usbsuspend = 1; ++ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, gintsts.d32); ++ ++ return 1; ++} ++ ++static int32_t dwc_otg_handle_xhib_exit_intr(dwc_otg_core_if_t * core_if) ++{ ++ gpwrdn_data_t gpwrdn = {.d32 = 0 }; ++ pcgcctl_data_t pcgcctl = {.d32 = 0 }; ++ gahbcfg_data_t gahbcfg = {.d32 = 0 }; ++ ++ dwc_udelay(10); ++ ++ /* Program GPIO register while entering to xHib */ ++ DWC_WRITE_REG32(&core_if->core_global_regs->ggpio, 0x0); ++ ++ pcgcctl.d32 = core_if->gr_backup->xhib_pcgcctl; ++ pcgcctl.b.extnd_hiber_pwrclmp = 0; ++ DWC_WRITE_REG32(core_if->pcgcctl, pcgcctl.d32); ++ dwc_udelay(10); ++ ++ gpwrdn.d32 = core_if->gr_backup->xhib_gpwrdn; ++ gpwrdn.b.restore = 1; ++ DWC_WRITE_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32); ++ dwc_udelay(10); ++ ++ restore_lpm_i2c_regs(core_if); ++ ++ pcgcctl.d32 = core_if->gr_backup->pcgcctl_local & (0x3FFFF << 14); ++ pcgcctl.b.max_xcvrselect = 1; ++ pcgcctl.b.ess_reg_restored = 0; ++ pcgcctl.b.extnd_hiber_switch = 0; ++ pcgcctl.b.extnd_hiber_pwrclmp = 0; ++ pcgcctl.b.enbl_extnd_hiber = 1; ++ DWC_WRITE_REG32(core_if->pcgcctl, pcgcctl.d32); ++ ++ gahbcfg.d32 = core_if->gr_backup->gahbcfg_local; ++ gahbcfg.b.glblintrmsk = 1; ++ DWC_WRITE_REG32(&core_if->core_global_regs->gahbcfg, gahbcfg.d32); ++ ++ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, 0xFFFFFFFF); ++ DWC_WRITE_REG32(&core_if->core_global_regs->gintmsk, 0x1 << 16); ++ ++ DWC_WRITE_REG32(&core_if->core_global_regs->gusbcfg, ++ core_if->gr_backup->gusbcfg_local); ++ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->dcfg, ++ core_if->dr_backup->dcfg); ++ ++ pcgcctl.d32 = 0; ++ pcgcctl.d32 = core_if->gr_backup->pcgcctl_local & (0x3FFFF << 14); ++ pcgcctl.b.max_xcvrselect = 1; ++ pcgcctl.d32 |= 0x608; ++ DWC_WRITE_REG32(core_if->pcgcctl, pcgcctl.d32); ++ dwc_udelay(10); ++ ++ pcgcctl.d32 = 0; ++ pcgcctl.d32 = core_if->gr_backup->pcgcctl_local & (0x3FFFF << 14); ++ pcgcctl.b.max_xcvrselect = 1; ++ pcgcctl.b.ess_reg_restored = 1; ++ pcgcctl.b.enbl_extnd_hiber = 1; ++ pcgcctl.b.rstpdwnmodule = 1; ++ pcgcctl.b.restoremode = 1; ++ DWC_WRITE_REG32(core_if->pcgcctl, pcgcctl.d32); ++ ++ DWC_DEBUGPL(DBG_ANY, "%s called\n", __FUNCTION__); ++ ++ return 1; ++} ++ ++#ifdef CONFIG_USB_DWC_OTG_LPM ++/** ++ * This function hadles LPM transaction received interrupt. ++ */ ++static int32_t dwc_otg_handle_lpm_intr(dwc_otg_core_if_t * core_if) ++{ ++ glpmcfg_data_t lpmcfg; ++ gintsts_data_t gintsts; ++ ++ if (!core_if->core_params->lpm_enable) { ++ DWC_PRINTF("Unexpected LPM interrupt\n"); ++ } ++ ++ lpmcfg.d32 = DWC_READ_REG32(&core_if->core_global_regs->glpmcfg); ++ DWC_PRINTF("LPM config register = 0x%08x\n", lpmcfg.d32); ++ ++ if (dwc_otg_is_host_mode(core_if)) { ++ cil_hcd_sleep(core_if); ++ } else { ++ lpmcfg.b.hird_thres |= (1 << 4); ++ DWC_WRITE_REG32(&core_if->core_global_regs->glpmcfg, ++ lpmcfg.d32); ++ } ++ ++ /* Examine prt_sleep_sts after TL1TokenTetry period max (10 us) */ ++ dwc_udelay(10); ++ lpmcfg.d32 = DWC_READ_REG32(&core_if->core_global_regs->glpmcfg); ++ if (lpmcfg.b.prt_sleep_sts) { ++ /* Save the current state */ ++ core_if->lx_state = DWC_OTG_L1; ++ } ++ ++ /* Clear interrupt */ ++ gintsts.d32 = 0; ++ gintsts.b.lpmtranrcvd = 1; ++ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, gintsts.d32); ++ return 1; ++} ++#endif /* CONFIG_USB_DWC_OTG_LPM */ ++ ++/** ++ * This function returns the Core Interrupt register. ++ */ ++static inline uint32_t dwc_otg_read_common_intr(dwc_otg_core_if_t * core_if, gintmsk_data_t *reenable_gintmsk, dwc_otg_hcd_t *hcd) ++{ ++ gahbcfg_data_t gahbcfg = {.d32 = 0 }; ++ gintsts_data_t gintsts; ++ gintmsk_data_t gintmsk; ++ gintmsk_data_t gintmsk_common = {.d32 = 0 }; ++ gintmsk_common.b.wkupintr = 1; ++ gintmsk_common.b.sessreqintr = 1; ++ gintmsk_common.b.conidstschng = 1; ++ gintmsk_common.b.otgintr = 1; ++ gintmsk_common.b.modemismatch = 1; ++ gintmsk_common.b.disconnect = 1; ++ gintmsk_common.b.usbsuspend = 1; ++#ifdef CONFIG_USB_DWC_OTG_LPM ++ gintmsk_common.b.lpmtranrcvd = 1; ++#endif ++ gintmsk_common.b.restoredone = 1; ++ if(dwc_otg_is_device_mode(core_if)) ++ { ++ /** @todo: The port interrupt occurs while in device ++ * mode. Added code to CIL to clear the interrupt for now! ++ */ ++ gintmsk_common.b.portintr = 1; ++ } ++ gintsts.d32 = DWC_READ_REG32(&core_if->core_global_regs->gintsts); ++ gintmsk.d32 = DWC_READ_REG32(&core_if->core_global_regs->gintmsk); ++ if(fiq_enable) { ++ local_fiq_disable(); ++ /* Pull in the interrupts that the FIQ has masked */ ++ gintmsk.d32 |= ~(hcd->fiq_state->gintmsk_saved.d32); ++ gintmsk.d32 |= gintmsk_common.d32; ++ /* for the upstairs function to reenable - have to read it here in case FIQ triggers again */ ++ reenable_gintmsk->d32 = gintmsk.d32; ++ local_fiq_enable(); ++ } ++ ++ gahbcfg.d32 = DWC_READ_REG32(&core_if->core_global_regs->gahbcfg); ++ ++#ifdef DEBUG ++ /* if any common interrupts set */ ++ if (gintsts.d32 & gintmsk_common.d32) { ++ DWC_DEBUGPL(DBG_ANY, "common_intr: gintsts=%08x gintmsk=%08x\n", ++ gintsts.d32, gintmsk.d32); ++ } ++#endif ++ if (!fiq_enable){ ++ if (gahbcfg.b.glblintrmsk) ++ return ((gintsts.d32 & gintmsk.d32) & gintmsk_common.d32); ++ else ++ return 0; ++ } else { ++ /* Our IRQ kicker is no longer the USB hardware, it's the MPHI interface. ++ * Can't trust the global interrupt mask bit in this case. ++ */ ++ return ((gintsts.d32 & gintmsk.d32) & gintmsk_common.d32); ++ } ++ ++} ++ ++/* MACRO for clearing interupt bits in GPWRDN register */ ++#define CLEAR_GPWRDN_INTR(__core_if,__intr) \ ++do { \ ++ gpwrdn_data_t gpwrdn = {.d32=0}; \ ++ gpwrdn.b.__intr = 1; \ ++ DWC_MODIFY_REG32(&__core_if->core_global_regs->gpwrdn, \ ++ 0, gpwrdn.d32); \ ++} while (0) ++ ++/** ++ * Common interrupt handler. ++ * ++ * The common interrupts are those that occur in both Host and Device mode. ++ * This handler handles the following interrupts: ++ * - Mode Mismatch Interrupt ++ * - Disconnect Interrupt ++ * - OTG Interrupt ++ * - Connector ID Status Change Interrupt ++ * - Session Request Interrupt. ++ * - Resume / Remote Wakeup Detected Interrupt. ++ * - LPM Transaction Received Interrupt ++ * - ADP Transaction Received Interrupt ++ * ++ */ ++int32_t dwc_otg_handle_common_intr(void *dev) ++{ ++ int retval = 0; ++ gintsts_data_t gintsts; ++ gintmsk_data_t gintmsk_reenable = { .d32 = 0 }; ++ gpwrdn_data_t gpwrdn = {.d32 = 0 }; ++ dwc_otg_device_t *otg_dev = dev; ++ dwc_otg_core_if_t *core_if = otg_dev->core_if; ++ gpwrdn.d32 = DWC_READ_REG32(&core_if->core_global_regs->gpwrdn); ++ if (dwc_otg_is_device_mode(core_if)) ++ core_if->frame_num = dwc_otg_get_frame_number(core_if); ++ ++ if (core_if->lock) ++ DWC_SPINLOCK(core_if->lock); ++ ++ if (core_if->power_down == 3 && core_if->xhib == 1) { ++ DWC_DEBUGPL(DBG_ANY, "Exiting from xHIB state\n"); ++ retval |= dwc_otg_handle_xhib_exit_intr(core_if); ++ core_if->xhib = 2; ++ if (core_if->lock) ++ DWC_SPINUNLOCK(core_if->lock); ++ ++ return retval; ++ } ++ ++ if (core_if->hibernation_suspend <= 0) { ++ /* read_common will have to poke the FIQ's saved mask. We must then clear this mask at the end ++ * of this handler - god only knows why it's done like this ++ */ ++ gintsts.d32 = dwc_otg_read_common_intr(core_if, &gintmsk_reenable, otg_dev->hcd); ++ ++ if (gintsts.b.modemismatch) { ++ retval |= dwc_otg_handle_mode_mismatch_intr(core_if); ++ } ++ if (gintsts.b.otgintr) { ++ retval |= dwc_otg_handle_otg_intr(core_if); ++ } ++ if (gintsts.b.conidstschng) { ++ retval |= ++ dwc_otg_handle_conn_id_status_change_intr(core_if); ++ } ++ if (gintsts.b.disconnect) { ++ retval |= dwc_otg_handle_disconnect_intr(core_if); ++ } ++ if (gintsts.b.sessreqintr) { ++ retval |= dwc_otg_handle_session_req_intr(core_if); ++ } ++ if (gintsts.b.wkupintr) { ++ retval |= dwc_otg_handle_wakeup_detected_intr(core_if); ++ } ++ if (gintsts.b.usbsuspend) { ++ retval |= dwc_otg_handle_usb_suspend_intr(core_if); ++ } ++#ifdef CONFIG_USB_DWC_OTG_LPM ++ if (gintsts.b.lpmtranrcvd) { ++ retval |= dwc_otg_handle_lpm_intr(core_if); ++ } ++#endif ++ if (gintsts.b.restoredone) { ++ gintsts.d32 = 0; ++ if (core_if->power_down == 2) ++ core_if->hibernation_suspend = -1; ++ else if (core_if->power_down == 3 && core_if->xhib == 2) { ++ gpwrdn_data_t gpwrdn = {.d32 = 0 }; ++ pcgcctl_data_t pcgcctl = {.d32 = 0 }; ++ dctl_data_t dctl = {.d32 = 0 }; ++ ++ DWC_WRITE_REG32(&core_if->core_global_regs-> ++ gintsts, 0xFFFFFFFF); ++ ++ DWC_DEBUGPL(DBG_ANY, ++ "RESTORE DONE generated\n"); ++ ++ gpwrdn.b.restore = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ dwc_udelay(10); ++ ++ pcgcctl.b.rstpdwnmodule = 1; ++ DWC_MODIFY_REG32(core_if->pcgcctl, pcgcctl.d32, 0); ++ ++ DWC_WRITE_REG32(&core_if->core_global_regs->gusbcfg, core_if->gr_backup->gusbcfg_local); ++ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->dcfg, core_if->dr_backup->dcfg); ++ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->dctl, core_if->dr_backup->dctl); ++ dwc_udelay(50); ++ ++ dctl.b.pwronprgdone = 1; ++ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs->dctl, 0, dctl.d32); ++ dwc_udelay(10); ++ ++ dwc_otg_restore_global_regs(core_if); ++ dwc_otg_restore_dev_regs(core_if, 0); ++ ++ dctl.d32 = 0; ++ dctl.b.pwronprgdone = 1; ++ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs->dctl, dctl.d32, 0); ++ dwc_udelay(10); ++ ++ pcgcctl.d32 = 0; ++ pcgcctl.b.enbl_extnd_hiber = 1; ++ DWC_MODIFY_REG32(core_if->pcgcctl, pcgcctl.d32, 0); ++ ++ /* The core will be in ON STATE */ ++ core_if->lx_state = DWC_OTG_L0; ++ core_if->xhib = 0; ++ ++ DWC_SPINUNLOCK(core_if->lock); ++ if (core_if->pcd_cb && core_if->pcd_cb->resume_wakeup) { ++ core_if->pcd_cb->resume_wakeup(core_if->pcd_cb->p); ++ } ++ DWC_SPINLOCK(core_if->lock); ++ ++ } ++ ++ gintsts.b.restoredone = 1; ++ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts,gintsts.d32); ++ DWC_PRINTF(" --Restore done interrupt received-- \n"); ++ retval |= 1; ++ } ++ if (gintsts.b.portintr && dwc_otg_is_device_mode(core_if)) { ++ /* The port interrupt occurs while in device mode with HPRT0 ++ * Port Enable/Disable. ++ */ ++ gintsts.d32 = 0; ++ gintsts.b.portintr = 1; ++ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts,gintsts.d32); ++ retval |= 1; ++ gintmsk_reenable.b.portintr = 1; ++ ++ } ++ /* Did we actually handle anything? if so, unmask the interrupt */ ++// fiq_print(FIQDBG_INT, otg_dev->hcd->fiq_state, "CILOUT %1d", retval); ++// fiq_print(FIQDBG_INT, otg_dev->hcd->fiq_state, "%08x", gintsts.d32); ++// fiq_print(FIQDBG_INT, otg_dev->hcd->fiq_state, "%08x", gintmsk_reenable.d32); ++ if (retval && fiq_enable) { ++ DWC_WRITE_REG32(&core_if->core_global_regs->gintmsk, gintmsk_reenable.d32); ++ } ++ ++ } else { ++ DWC_DEBUGPL(DBG_ANY, "gpwrdn=%08x\n", gpwrdn.d32); ++ ++ if (gpwrdn.b.disconn_det && gpwrdn.b.disconn_det_msk) { ++ CLEAR_GPWRDN_INTR(core_if, disconn_det); ++ if (gpwrdn.b.linestate == 0) { ++ dwc_otg_handle_pwrdn_disconnect_intr(core_if); ++ } else { ++ DWC_PRINTF("Disconnect detected while linestate is not 0\n"); ++ } ++ ++ retval |= 1; ++ } ++ if (gpwrdn.b.lnstschng && gpwrdn.b.lnstchng_msk) { ++ CLEAR_GPWRDN_INTR(core_if, lnstschng); ++ /* remote wakeup from hibernation */ ++ if (gpwrdn.b.linestate == 2 || gpwrdn.b.linestate == 1) { ++ dwc_otg_handle_pwrdn_wakeup_detected_intr(core_if); ++ } else { ++ DWC_PRINTF("gpwrdn.linestate = %d\n", gpwrdn.b.linestate); ++ } ++ retval |= 1; ++ } ++ if (gpwrdn.b.rst_det && gpwrdn.b.rst_det_msk) { ++ CLEAR_GPWRDN_INTR(core_if, rst_det); ++ if (gpwrdn.b.linestate == 0) { ++ DWC_PRINTF("Reset detected\n"); ++ retval |= dwc_otg_device_hibernation_restore(core_if, 0, 1); ++ } ++ } ++ if (gpwrdn.b.srp_det && gpwrdn.b.srp_det_msk) { ++ CLEAR_GPWRDN_INTR(core_if, srp_det); ++ dwc_otg_handle_pwrdn_srp_intr(core_if); ++ retval |= 1; ++ } ++ } ++ /* Handle ADP interrupt here */ ++ if (gpwrdn.b.adp_int) { ++ DWC_PRINTF("ADP interrupt\n"); ++ CLEAR_GPWRDN_INTR(core_if, adp_int); ++ dwc_otg_adp_handle_intr(core_if); ++ retval |= 1; ++ } ++ if (gpwrdn.b.sts_chngint && gpwrdn.b.sts_chngint_msk) { ++ DWC_PRINTF("STS CHNG interrupt asserted\n"); ++ CLEAR_GPWRDN_INTR(core_if, sts_chngint); ++ dwc_otg_handle_pwrdn_stschng_intr(otg_dev); ++ ++ retval |= 1; ++ } ++ if (core_if->lock) ++ DWC_SPINUNLOCK(core_if->lock); ++ return retval; ++} +diff --git a/drivers/usb/host/dwc_otg/dwc_otg_core_if.h b/drivers/usb/host/dwc_otg/dwc_otg_core_if.h +new file mode 100644 +index 0000000..4138fd1 +--- /dev/null ++++ b/drivers/usb/host/dwc_otg/dwc_otg_core_if.h +@@ -0,0 +1,705 @@ ++/* ========================================================================== ++ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_core_if.h $ ++ * $Revision: #13 $ ++ * $Date: 2012/08/10 $ ++ * $Change: 2047372 $ ++ * ++ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, ++ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless ++ * otherwise expressly agreed to in writing between Synopsys and you. ++ * ++ * The Software IS NOT an item of Licensed Software or Licensed Product under ++ * any End User Software License Agreement or Agreement for Licensed Product ++ * with Synopsys or any supplement thereto. You are permitted to use and ++ * redistribute this Software in source and binary forms, with or without ++ * modification, provided that redistributions of source code must retain this ++ * notice. You may not view, use, disclose, copy or distribute this file or ++ * any information contained herein except pursuant to this license grant from ++ * Synopsys. If you do not agree with this notice, including the disclaimer ++ * below, then you are not authorized to use the Software. ++ * ++ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS ++ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS 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. ++ * ========================================================================== */ ++#if !defined(__DWC_CORE_IF_H__) ++#define __DWC_CORE_IF_H__ ++ ++#include "dwc_os.h" ++ ++/** @file ++ * This file defines DWC_OTG Core API ++ */ ++ ++struct dwc_otg_core_if; ++typedef struct dwc_otg_core_if dwc_otg_core_if_t; ++ ++/** Maximum number of Periodic FIFOs */ ++#define MAX_PERIO_FIFOS 15 ++/** Maximum number of Periodic FIFOs */ ++#define MAX_TX_FIFOS 15 ++ ++/** Maximum number of Endpoints/HostChannels */ ++#define MAX_EPS_CHANNELS 16 ++ ++extern dwc_otg_core_if_t *dwc_otg_cil_init(const uint32_t * _reg_base_addr); ++extern void dwc_otg_core_init(dwc_otg_core_if_t * _core_if); ++extern void dwc_otg_cil_remove(dwc_otg_core_if_t * _core_if); ++ ++extern void dwc_otg_enable_global_interrupts(dwc_otg_core_if_t * _core_if); ++extern void dwc_otg_disable_global_interrupts(dwc_otg_core_if_t * _core_if); ++ ++extern uint8_t dwc_otg_is_device_mode(dwc_otg_core_if_t * _core_if); ++extern uint8_t dwc_otg_is_host_mode(dwc_otg_core_if_t * _core_if); ++ ++extern uint8_t dwc_otg_is_dma_enable(dwc_otg_core_if_t * core_if); ++ ++/** This function should be called on every hardware interrupt. */ ++extern int32_t dwc_otg_handle_common_intr(void *otg_dev); ++ ++/** @name OTG Core Parameters */ ++/** @{ */ ++ ++/** ++ * Specifies the OTG capabilities. The driver will automatically ++ * detect the value for this parameter if none is specified. ++ * 0 - HNP and SRP capable (default) ++ * 1 - SRP Only capable ++ * 2 - No HNP/SRP capable ++ */ ++extern int dwc_otg_set_param_otg_cap(dwc_otg_core_if_t * core_if, int32_t val); ++extern int32_t dwc_otg_get_param_otg_cap(dwc_otg_core_if_t * core_if); ++#define DWC_OTG_CAP_PARAM_HNP_SRP_CAPABLE 0 ++#define DWC_OTG_CAP_PARAM_SRP_ONLY_CAPABLE 1 ++#define DWC_OTG_CAP_PARAM_NO_HNP_SRP_CAPABLE 2 ++#define dwc_param_otg_cap_default DWC_OTG_CAP_PARAM_HNP_SRP_CAPABLE ++ ++extern int dwc_otg_set_param_opt(dwc_otg_core_if_t * core_if, int32_t val); ++extern int32_t dwc_otg_get_param_opt(dwc_otg_core_if_t * core_if); ++#define dwc_param_opt_default 1 ++ ++/** ++ * Specifies whether to use slave or DMA mode for accessing the data ++ * FIFOs. The driver will automatically detect the value for this ++ * parameter if none is specified. ++ * 0 - Slave ++ * 1 - DMA (default, if available) ++ */ ++extern int dwc_otg_set_param_dma_enable(dwc_otg_core_if_t * core_if, ++ int32_t val); ++extern int32_t dwc_otg_get_param_dma_enable(dwc_otg_core_if_t * core_if); ++#define dwc_param_dma_enable_default 1 ++ ++/** ++ * When DMA mode is enabled specifies whether to use ++ * address DMA or DMA Descritor mode for accessing the data ++ * FIFOs in device mode. The driver will automatically detect ++ * the value for this parameter if none is specified. ++ * 0 - address DMA ++ * 1 - DMA Descriptor(default, if available) ++ */ ++extern int dwc_otg_set_param_dma_desc_enable(dwc_otg_core_if_t * core_if, ++ int32_t val); ++extern int32_t dwc_otg_get_param_dma_desc_enable(dwc_otg_core_if_t * core_if); ++//#define dwc_param_dma_desc_enable_default 1 ++#define dwc_param_dma_desc_enable_default 0 // Broadcom BCM2708 ++ ++/** The DMA Burst size (applicable only for External DMA ++ * Mode). 1, 4, 8 16, 32, 64, 128, 256 (default 32) ++ */ ++extern int dwc_otg_set_param_dma_burst_size(dwc_otg_core_if_t * core_if, ++ int32_t val); ++extern int32_t dwc_otg_get_param_dma_burst_size(dwc_otg_core_if_t * core_if); ++#define dwc_param_dma_burst_size_default 32 ++ ++/** ++ * Specifies the maximum speed of operation in host and device mode. ++ * The actual speed depends on the speed of the attached device and ++ * the value of phy_type. The actual speed depends on the speed of the ++ * attached device. ++ * 0 - High Speed (default) ++ * 1 - Full Speed ++ */ ++extern int dwc_otg_set_param_speed(dwc_otg_core_if_t * core_if, int32_t val); ++extern int32_t dwc_otg_get_param_speed(dwc_otg_core_if_t * core_if); ++#define dwc_param_speed_default 0 ++#define DWC_SPEED_PARAM_HIGH 0 ++#define DWC_SPEED_PARAM_FULL 1 ++ ++/** Specifies whether low power mode is supported when attached ++ * to a Full Speed or Low Speed device in host mode. ++ * 0 - Don't support low power mode (default) ++ * 1 - Support low power mode ++ */ ++extern int dwc_otg_set_param_host_support_fs_ls_low_power(dwc_otg_core_if_t * ++ core_if, int32_t val); ++extern int32_t dwc_otg_get_param_host_support_fs_ls_low_power(dwc_otg_core_if_t ++ * core_if); ++#define dwc_param_host_support_fs_ls_low_power_default 0 ++ ++/** Specifies the PHY clock rate in low power mode when connected to a ++ * Low Speed device in host mode. This parameter is applicable only if ++ * HOST_SUPPORT_FS_LS_LOW_POWER is enabled. If PHY_TYPE is set to FS ++ * then defaults to 6 MHZ otherwise 48 MHZ. ++ * ++ * 0 - 48 MHz ++ * 1 - 6 MHz ++ */ ++extern int dwc_otg_set_param_host_ls_low_power_phy_clk(dwc_otg_core_if_t * ++ core_if, int32_t val); ++extern int32_t dwc_otg_get_param_host_ls_low_power_phy_clk(dwc_otg_core_if_t * ++ core_if); ++#define dwc_param_host_ls_low_power_phy_clk_default 0 ++#define DWC_HOST_LS_LOW_POWER_PHY_CLK_PARAM_48MHZ 0 ++#define DWC_HOST_LS_LOW_POWER_PHY_CLK_PARAM_6MHZ 1 ++ ++/** ++ * 0 - Use cC FIFO size parameters ++ * 1 - Allow dynamic FIFO sizing (default) ++ */ ++extern int dwc_otg_set_param_enable_dynamic_fifo(dwc_otg_core_if_t * core_if, ++ int32_t val); ++extern int32_t dwc_otg_get_param_enable_dynamic_fifo(dwc_otg_core_if_t * ++ core_if); ++#define dwc_param_enable_dynamic_fifo_default 1 ++ ++/** Total number of 4-byte words in the data FIFO memory. This ++ * memory includes the Rx FIFO, non-periodic Tx FIFO, and periodic ++ * Tx FIFOs. ++ * 32 to 32768 (default 8192) ++ * Note: The total FIFO memory depth in the FPGA configuration is 8192. ++ */ ++extern int dwc_otg_set_param_data_fifo_size(dwc_otg_core_if_t * core_if, ++ int32_t val); ++extern int32_t dwc_otg_get_param_data_fifo_size(dwc_otg_core_if_t * core_if); ++//#define dwc_param_data_fifo_size_default 8192 ++#define dwc_param_data_fifo_size_default 0xFF0 // Broadcom BCM2708 ++ ++/** Number of 4-byte words in the Rx FIFO in device mode when dynamic ++ * FIFO sizing is enabled. ++ * 16 to 32768 (default 1064) ++ */ ++extern int dwc_otg_set_param_dev_rx_fifo_size(dwc_otg_core_if_t * core_if, ++ int32_t val); ++extern int32_t dwc_otg_get_param_dev_rx_fifo_size(dwc_otg_core_if_t * core_if); ++#define dwc_param_dev_rx_fifo_size_default 1064 ++ ++/** Number of 4-byte words in the non-periodic Tx FIFO in device mode ++ * when dynamic FIFO sizing is enabled. ++ * 16 to 32768 (default 1024) ++ */ ++extern int dwc_otg_set_param_dev_nperio_tx_fifo_size(dwc_otg_core_if_t * ++ core_if, int32_t val); ++extern int32_t dwc_otg_get_param_dev_nperio_tx_fifo_size(dwc_otg_core_if_t * ++ core_if); ++#define dwc_param_dev_nperio_tx_fifo_size_default 1024 ++ ++/** Number of 4-byte words in each of the periodic Tx FIFOs in device ++ * mode when dynamic FIFO sizing is enabled. ++ * 4 to 768 (default 256) ++ */ ++extern int dwc_otg_set_param_dev_perio_tx_fifo_size(dwc_otg_core_if_t * core_if, ++ int32_t val, int fifo_num); ++extern int32_t dwc_otg_get_param_dev_perio_tx_fifo_size(dwc_otg_core_if_t * ++ core_if, int fifo_num); ++#define dwc_param_dev_perio_tx_fifo_size_default 256 ++ ++/** Number of 4-byte words in the Rx FIFO in host mode when dynamic ++ * FIFO sizing is enabled. ++ * 16 to 32768 (default 1024) ++ */ ++extern int dwc_otg_set_param_host_rx_fifo_size(dwc_otg_core_if_t * core_if, ++ int32_t val); ++extern int32_t dwc_otg_get_param_host_rx_fifo_size(dwc_otg_core_if_t * core_if); ++//#define dwc_param_host_rx_fifo_size_default 1024 ++#define dwc_param_host_rx_fifo_size_default 774 // Broadcom BCM2708 ++ ++/** Number of 4-byte words in the non-periodic Tx FIFO in host mode ++ * when Dynamic FIFO sizing is enabled in the core. ++ * 16 to 32768 (default 1024) ++ */ ++extern int dwc_otg_set_param_host_nperio_tx_fifo_size(dwc_otg_core_if_t * ++ core_if, int32_t val); ++extern int32_t dwc_otg_get_param_host_nperio_tx_fifo_size(dwc_otg_core_if_t * ++ core_if); ++//#define dwc_param_host_nperio_tx_fifo_size_default 1024 ++#define dwc_param_host_nperio_tx_fifo_size_default 0x100 // Broadcom BCM2708 ++ ++/** Number of 4-byte words in the host periodic Tx FIFO when dynamic ++ * FIFO sizing is enabled. ++ * 16 to 32768 (default 1024) ++ */ ++extern int dwc_otg_set_param_host_perio_tx_fifo_size(dwc_otg_core_if_t * ++ core_if, int32_t val); ++extern int32_t dwc_otg_get_param_host_perio_tx_fifo_size(dwc_otg_core_if_t * ++ core_if); ++//#define dwc_param_host_perio_tx_fifo_size_default 1024 ++#define dwc_param_host_perio_tx_fifo_size_default 0x200 // Broadcom BCM2708 ++ ++/** The maximum transfer size supported in bytes. ++ * 2047 to 65,535 (default 65,535) ++ */ ++extern int dwc_otg_set_param_max_transfer_size(dwc_otg_core_if_t * core_if, ++ int32_t val); ++extern int32_t dwc_otg_get_param_max_transfer_size(dwc_otg_core_if_t * core_if); ++#define dwc_param_max_transfer_size_default 65535 ++ ++/** The maximum number of packets in a transfer. ++ * 15 to 511 (default 511) ++ */ ++extern int dwc_otg_set_param_max_packet_count(dwc_otg_core_if_t * core_if, ++ int32_t val); ++extern int32_t dwc_otg_get_param_max_packet_count(dwc_otg_core_if_t * core_if); ++#define dwc_param_max_packet_count_default 511 ++ ++/** The number of host channel registers to use. ++ * 1 to 16 (default 12) ++ * Note: The FPGA configuration supports a maximum of 12 host channels. ++ */ ++extern int dwc_otg_set_param_host_channels(dwc_otg_core_if_t * core_if, ++ int32_t val); ++extern int32_t dwc_otg_get_param_host_channels(dwc_otg_core_if_t * core_if); ++//#define dwc_param_host_channels_default 12 ++#define dwc_param_host_channels_default 8 // Broadcom BCM2708 ++ ++/** The number of endpoints in addition to EP0 available for device ++ * mode operations. ++ * 1 to 15 (default 6 IN and OUT) ++ * Note: The FPGA configuration supports a maximum of 6 IN and OUT ++ * endpoints in addition to EP0. ++ */ ++extern int dwc_otg_set_param_dev_endpoints(dwc_otg_core_if_t * core_if, ++ int32_t val); ++extern int32_t dwc_otg_get_param_dev_endpoints(dwc_otg_core_if_t * core_if); ++#define dwc_param_dev_endpoints_default 6 ++ ++/** ++ * Specifies the type of PHY interface to use. By default, the driver ++ * will automatically detect the phy_type. ++ * ++ * 0 - Full Speed PHY ++ * 1 - UTMI+ (default) ++ * 2 - ULPI ++ */ ++extern int dwc_otg_set_param_phy_type(dwc_otg_core_if_t * core_if, int32_t val); ++extern int32_t dwc_otg_get_param_phy_type(dwc_otg_core_if_t * core_if); ++#define DWC_PHY_TYPE_PARAM_FS 0 ++#define DWC_PHY_TYPE_PARAM_UTMI 1 ++#define DWC_PHY_TYPE_PARAM_ULPI 2 ++#define dwc_param_phy_type_default DWC_PHY_TYPE_PARAM_UTMI ++ ++/** ++ * Specifies the UTMI+ Data Width. This parameter is ++ * applicable for a PHY_TYPE of UTMI+ or ULPI. (For a ULPI ++ * PHY_TYPE, this parameter indicates the data width between ++ * the MAC and the ULPI Wrapper.) Also, this parameter is ++ * applicable only if the OTG_HSPHY_WIDTH cC parameter was set ++ * to "8 and 16 bits", meaning that the core has been ++ * configured to work at either data path width. ++ * ++ * 8 or 16 bits (default 16) ++ */ ++extern int dwc_otg_set_param_phy_utmi_width(dwc_otg_core_if_t * core_if, ++ int32_t val); ++extern int32_t dwc_otg_get_param_phy_utmi_width(dwc_otg_core_if_t * core_if); ++//#define dwc_param_phy_utmi_width_default 16 ++#define dwc_param_phy_utmi_width_default 8 // Broadcom BCM2708 ++ ++/** ++ * Specifies whether the ULPI operates at double or single ++ * data rate. This parameter is only applicable if PHY_TYPE is ++ * ULPI. ++ * ++ * 0 - single data rate ULPI interface with 8 bit wide data ++ * bus (default) ++ * 1 - double data rate ULPI interface with 4 bit wide data ++ * bus ++ */ ++extern int dwc_otg_set_param_phy_ulpi_ddr(dwc_otg_core_if_t * core_if, ++ int32_t val); ++extern int32_t dwc_otg_get_param_phy_ulpi_ddr(dwc_otg_core_if_t * core_if); ++#define dwc_param_phy_ulpi_ddr_default 0 ++ ++/** ++ * Specifies whether to use the internal or external supply to ++ * drive the vbus with a ULPI phy. ++ */ ++extern int dwc_otg_set_param_phy_ulpi_ext_vbus(dwc_otg_core_if_t * core_if, ++ int32_t val); ++extern int32_t dwc_otg_get_param_phy_ulpi_ext_vbus(dwc_otg_core_if_t * core_if); ++#define DWC_PHY_ULPI_INTERNAL_VBUS 0 ++#define DWC_PHY_ULPI_EXTERNAL_VBUS 1 ++#define dwc_param_phy_ulpi_ext_vbus_default DWC_PHY_ULPI_INTERNAL_VBUS ++ ++/** ++ * Specifies whether to use the I2Cinterface for full speed PHY. This ++ * parameter is only applicable if PHY_TYPE is FS. ++ * 0 - No (default) ++ * 1 - Yes ++ */ ++extern int dwc_otg_set_param_i2c_enable(dwc_otg_core_if_t * core_if, ++ int32_t val); ++extern int32_t dwc_otg_get_param_i2c_enable(dwc_otg_core_if_t * core_if); ++#define dwc_param_i2c_enable_default 0 ++ ++extern int dwc_otg_set_param_ulpi_fs_ls(dwc_otg_core_if_t * core_if, ++ int32_t val); ++extern int32_t dwc_otg_get_param_ulpi_fs_ls(dwc_otg_core_if_t * core_if); ++#define dwc_param_ulpi_fs_ls_default 0 ++ ++extern int dwc_otg_set_param_ts_dline(dwc_otg_core_if_t * core_if, int32_t val); ++extern int32_t dwc_otg_get_param_ts_dline(dwc_otg_core_if_t * core_if); ++#define dwc_param_ts_dline_default 0 ++ ++/** ++ * Specifies whether dedicated transmit FIFOs are ++ * enabled for non periodic IN endpoints in device mode ++ * 0 - No ++ * 1 - Yes ++ */ ++extern int dwc_otg_set_param_en_multiple_tx_fifo(dwc_otg_core_if_t * core_if, ++ int32_t val); ++extern int32_t dwc_otg_get_param_en_multiple_tx_fifo(dwc_otg_core_if_t * ++ core_if); ++#define dwc_param_en_multiple_tx_fifo_default 1 ++ ++/** Number of 4-byte words in each of the Tx FIFOs in device ++ * mode when dynamic FIFO sizing is enabled. ++ * 4 to 768 (default 256) ++ */ ++extern int dwc_otg_set_param_dev_tx_fifo_size(dwc_otg_core_if_t * core_if, ++ int fifo_num, int32_t val); ++extern int32_t dwc_otg_get_param_dev_tx_fifo_size(dwc_otg_core_if_t * core_if, ++ int fifo_num); ++#define dwc_param_dev_tx_fifo_size_default 768 ++ ++/** Thresholding enable flag- ++ * bit 0 - enable non-ISO Tx thresholding ++ * bit 1 - enable ISO Tx thresholding ++ * bit 2 - enable Rx thresholding ++ */ ++extern int dwc_otg_set_param_thr_ctl(dwc_otg_core_if_t * core_if, int32_t val); ++extern int32_t dwc_otg_get_thr_ctl(dwc_otg_core_if_t * core_if, int fifo_num); ++#define dwc_param_thr_ctl_default 0 ++ ++/** Thresholding length for Tx ++ * FIFOs in 32 bit DWORDs ++ */ ++extern int dwc_otg_set_param_tx_thr_length(dwc_otg_core_if_t * core_if, ++ int32_t val); ++extern int32_t dwc_otg_get_tx_thr_length(dwc_otg_core_if_t * core_if); ++#define dwc_param_tx_thr_length_default 64 ++ ++/** Thresholding length for Rx ++ * FIFOs in 32 bit DWORDs ++ */ ++extern int dwc_otg_set_param_rx_thr_length(dwc_otg_core_if_t * core_if, ++ int32_t val); ++extern int32_t dwc_otg_get_rx_thr_length(dwc_otg_core_if_t * core_if); ++#define dwc_param_rx_thr_length_default 64 ++ ++/** ++ * Specifies whether LPM (Link Power Management) support is enabled ++ */ ++extern int dwc_otg_set_param_lpm_enable(dwc_otg_core_if_t * core_if, ++ int32_t val); ++extern int32_t dwc_otg_get_param_lpm_enable(dwc_otg_core_if_t * core_if); ++#define dwc_param_lpm_enable_default 1 ++ ++/** ++ * Specifies whether PTI enhancement is enabled ++ */ ++extern int dwc_otg_set_param_pti_enable(dwc_otg_core_if_t * core_if, ++ int32_t val); ++extern int32_t dwc_otg_get_param_pti_enable(dwc_otg_core_if_t * core_if); ++#define dwc_param_pti_enable_default 0 ++ ++/** ++ * Specifies whether MPI enhancement is enabled ++ */ ++extern int dwc_otg_set_param_mpi_enable(dwc_otg_core_if_t * core_if, ++ int32_t val); ++extern int32_t dwc_otg_get_param_mpi_enable(dwc_otg_core_if_t * core_if); ++#define dwc_param_mpi_enable_default 0 ++ ++/** ++ * Specifies whether ADP capability is enabled ++ */ ++extern int dwc_otg_set_param_adp_enable(dwc_otg_core_if_t * core_if, ++ int32_t val); ++extern int32_t dwc_otg_get_param_adp_enable(dwc_otg_core_if_t * core_if); ++#define dwc_param_adp_enable_default 0 ++ ++/** ++ * Specifies whether IC_USB capability is enabled ++ */ ++ ++extern int dwc_otg_set_param_ic_usb_cap(dwc_otg_core_if_t * core_if, ++ int32_t val); ++extern int32_t dwc_otg_get_param_ic_usb_cap(dwc_otg_core_if_t * core_if); ++#define dwc_param_ic_usb_cap_default 0 ++ ++extern int dwc_otg_set_param_ahb_thr_ratio(dwc_otg_core_if_t * core_if, ++ int32_t val); ++extern int32_t dwc_otg_get_param_ahb_thr_ratio(dwc_otg_core_if_t * core_if); ++#define dwc_param_ahb_thr_ratio_default 0 ++ ++extern int dwc_otg_set_param_power_down(dwc_otg_core_if_t * core_if, ++ int32_t val); ++extern int32_t dwc_otg_get_param_power_down(dwc_otg_core_if_t * core_if); ++#define dwc_param_power_down_default 0 ++ ++extern int dwc_otg_set_param_reload_ctl(dwc_otg_core_if_t * core_if, ++ int32_t val); ++extern int32_t dwc_otg_get_param_reload_ctl(dwc_otg_core_if_t * core_if); ++#define dwc_param_reload_ctl_default 0 ++ ++extern int dwc_otg_set_param_dev_out_nak(dwc_otg_core_if_t * core_if, ++ int32_t val); ++extern int32_t dwc_otg_get_param_dev_out_nak(dwc_otg_core_if_t * core_if); ++#define dwc_param_dev_out_nak_default 0 ++ ++extern int dwc_otg_set_param_cont_on_bna(dwc_otg_core_if_t * core_if, ++ int32_t val); ++extern int32_t dwc_otg_get_param_cont_on_bna(dwc_otg_core_if_t * core_if); ++#define dwc_param_cont_on_bna_default 0 ++ ++extern int dwc_otg_set_param_ahb_single(dwc_otg_core_if_t * core_if, ++ int32_t val); ++extern int32_t dwc_otg_get_param_ahb_single(dwc_otg_core_if_t * core_if); ++#define dwc_param_ahb_single_default 0 ++ ++extern int dwc_otg_set_param_otg_ver(dwc_otg_core_if_t * core_if, int32_t val); ++extern int32_t dwc_otg_get_param_otg_ver(dwc_otg_core_if_t * core_if); ++#define dwc_param_otg_ver_default 0 ++ ++/** @} */ ++ ++/** @name Access to registers and bit-fields */ ++ ++/** ++ * Dump core registers and SPRAM ++ */ ++extern void dwc_otg_dump_dev_registers(dwc_otg_core_if_t * _core_if); ++extern void dwc_otg_dump_spram(dwc_otg_core_if_t * _core_if); ++extern void dwc_otg_dump_host_registers(dwc_otg_core_if_t * _core_if); ++extern void dwc_otg_dump_global_registers(dwc_otg_core_if_t * _core_if); ++ ++/** ++ * Get host negotiation status. ++ */ ++extern uint32_t dwc_otg_get_hnpstatus(dwc_otg_core_if_t * core_if); ++ ++/** ++ * Get srp status ++ */ ++extern uint32_t dwc_otg_get_srpstatus(dwc_otg_core_if_t * core_if); ++ ++/** ++ * Set hnpreq bit in the GOTGCTL register. ++ */ ++extern void dwc_otg_set_hnpreq(dwc_otg_core_if_t * core_if, uint32_t val); ++ ++/** ++ * Get Content of SNPSID register. ++ */ ++extern uint32_t dwc_otg_get_gsnpsid(dwc_otg_core_if_t * core_if); ++ ++/** ++ * Get current mode. ++ * Returns 0 if in device mode, and 1 if in host mode. ++ */ ++extern uint32_t dwc_otg_get_mode(dwc_otg_core_if_t * core_if); ++ ++/** ++ * Get value of hnpcapable field in the GUSBCFG register ++ */ ++extern uint32_t dwc_otg_get_hnpcapable(dwc_otg_core_if_t * core_if); ++/** ++ * Set value of hnpcapable field in the GUSBCFG register ++ */ ++extern void dwc_otg_set_hnpcapable(dwc_otg_core_if_t * core_if, uint32_t val); ++ ++/** ++ * Get value of srpcapable field in the GUSBCFG register ++ */ ++extern uint32_t dwc_otg_get_srpcapable(dwc_otg_core_if_t * core_if); ++/** ++ * Set value of srpcapable field in the GUSBCFG register ++ */ ++extern void dwc_otg_set_srpcapable(dwc_otg_core_if_t * core_if, uint32_t val); ++ ++/** ++ * Get value of devspeed field in the DCFG register ++ */ ++extern uint32_t dwc_otg_get_devspeed(dwc_otg_core_if_t * core_if); ++/** ++ * Set value of devspeed field in the DCFG register ++ */ ++extern void dwc_otg_set_devspeed(dwc_otg_core_if_t * core_if, uint32_t val); ++ ++/** ++ * Get the value of busconnected field from the HPRT0 register ++ */ ++extern uint32_t dwc_otg_get_busconnected(dwc_otg_core_if_t * core_if); ++ ++/** ++ * Gets the device enumeration Speed. ++ */ ++extern uint32_t dwc_otg_get_enumspeed(dwc_otg_core_if_t * core_if); ++ ++/** ++ * Get value of prtpwr field from the HPRT0 register ++ */ ++extern uint32_t dwc_otg_get_prtpower(dwc_otg_core_if_t * core_if); ++ ++/** ++ * Get value of flag indicating core state - hibernated or not ++ */ ++extern uint32_t dwc_otg_get_core_state(dwc_otg_core_if_t * core_if); ++ ++/** ++ * Set value of prtpwr field from the HPRT0 register ++ */ ++extern void dwc_otg_set_prtpower(dwc_otg_core_if_t * core_if, uint32_t val); ++ ++/** ++ * Get value of prtsusp field from the HPRT0 regsiter ++ */ ++extern uint32_t dwc_otg_get_prtsuspend(dwc_otg_core_if_t * core_if); ++/** ++ * Set value of prtpwr field from the HPRT0 register ++ */ ++extern void dwc_otg_set_prtsuspend(dwc_otg_core_if_t * core_if, uint32_t val); ++ ++/** ++ * Get value of ModeChTimEn field from the HCFG regsiter ++ */ ++extern uint32_t dwc_otg_get_mode_ch_tim(dwc_otg_core_if_t * core_if); ++/** ++ * Set value of ModeChTimEn field from the HCFG regsiter ++ */ ++extern void dwc_otg_set_mode_ch_tim(dwc_otg_core_if_t * core_if, uint32_t val); ++ ++/** ++ * Get value of Fram Interval field from the HFIR regsiter ++ */ ++extern uint32_t dwc_otg_get_fr_interval(dwc_otg_core_if_t * core_if); ++/** ++ * Set value of Frame Interval field from the HFIR regsiter ++ */ ++extern void dwc_otg_set_fr_interval(dwc_otg_core_if_t * core_if, uint32_t val); ++ ++/** ++ * Set value of prtres field from the HPRT0 register ++ *FIXME Remove? ++ */ ++extern void dwc_otg_set_prtresume(dwc_otg_core_if_t * core_if, uint32_t val); ++ ++/** ++ * Get value of rmtwkupsig bit in DCTL register ++ */ ++extern uint32_t dwc_otg_get_remotewakesig(dwc_otg_core_if_t * core_if); ++ ++/** ++ * Get value of prt_sleep_sts field from the GLPMCFG register ++ */ ++extern uint32_t dwc_otg_get_lpm_portsleepstatus(dwc_otg_core_if_t * core_if); ++ ++/** ++ * Get value of rem_wkup_en field from the GLPMCFG register ++ */ ++extern uint32_t dwc_otg_get_lpm_remotewakeenabled(dwc_otg_core_if_t * core_if); ++ ++/** ++ * Get value of appl_resp field from the GLPMCFG register ++ */ ++extern uint32_t dwc_otg_get_lpmresponse(dwc_otg_core_if_t * core_if); ++/** ++ * Set value of appl_resp field from the GLPMCFG register ++ */ ++extern void dwc_otg_set_lpmresponse(dwc_otg_core_if_t * core_if, uint32_t val); ++ ++/** ++ * Get value of hsic_connect field from the GLPMCFG register ++ */ ++extern uint32_t dwc_otg_get_hsic_connect(dwc_otg_core_if_t * core_if); ++/** ++ * Set value of hsic_connect field from the GLPMCFG register ++ */ ++extern void dwc_otg_set_hsic_connect(dwc_otg_core_if_t * core_if, uint32_t val); ++ ++/** ++ * Get value of inv_sel_hsic field from the GLPMCFG register. ++ */ ++extern uint32_t dwc_otg_get_inv_sel_hsic(dwc_otg_core_if_t * core_if); ++/** ++ * Set value of inv_sel_hsic field from the GLPMFG register. ++ */ ++extern void dwc_otg_set_inv_sel_hsic(dwc_otg_core_if_t * core_if, uint32_t val); ++ ++/* ++ * Some functions for accessing registers ++ */ ++ ++/** ++ * GOTGCTL register ++ */ ++extern uint32_t dwc_otg_get_gotgctl(dwc_otg_core_if_t * core_if); ++extern void dwc_otg_set_gotgctl(dwc_otg_core_if_t * core_if, uint32_t val); ++ ++/** ++ * GUSBCFG register ++ */ ++extern uint32_t dwc_otg_get_gusbcfg(dwc_otg_core_if_t * core_if); ++extern void dwc_otg_set_gusbcfg(dwc_otg_core_if_t * core_if, uint32_t val); ++ ++/** ++ * GRXFSIZ register ++ */ ++extern uint32_t dwc_otg_get_grxfsiz(dwc_otg_core_if_t * core_if); ++extern void dwc_otg_set_grxfsiz(dwc_otg_core_if_t * core_if, uint32_t val); ++ ++/** ++ * GNPTXFSIZ register ++ */ ++extern uint32_t dwc_otg_get_gnptxfsiz(dwc_otg_core_if_t * core_if); ++extern void dwc_otg_set_gnptxfsiz(dwc_otg_core_if_t * core_if, uint32_t val); ++ ++extern uint32_t dwc_otg_get_gpvndctl(dwc_otg_core_if_t * core_if); ++extern void dwc_otg_set_gpvndctl(dwc_otg_core_if_t * core_if, uint32_t val); ++ ++/** ++ * GGPIO register ++ */ ++extern uint32_t dwc_otg_get_ggpio(dwc_otg_core_if_t * core_if); ++extern void dwc_otg_set_ggpio(dwc_otg_core_if_t * core_if, uint32_t val); ++ ++/** ++ * GUID register ++ */ ++extern uint32_t dwc_otg_get_guid(dwc_otg_core_if_t * core_if); ++extern void dwc_otg_set_guid(dwc_otg_core_if_t * core_if, uint32_t val); ++ ++/** ++ * HPRT0 register ++ */ ++extern uint32_t dwc_otg_get_hprt0(dwc_otg_core_if_t * core_if); ++extern void dwc_otg_set_hprt0(dwc_otg_core_if_t * core_if, uint32_t val); ++ ++/** ++ * GHPTXFSIZE ++ */ ++extern uint32_t dwc_otg_get_hptxfsiz(dwc_otg_core_if_t * core_if); ++ ++/** @} */ ++ ++#endif /* __DWC_CORE_IF_H__ */ +diff --git a/drivers/usb/host/dwc_otg/dwc_otg_dbg.h b/drivers/usb/host/dwc_otg/dwc_otg_dbg.h +new file mode 100644 +index 0000000..ccc24e0 +--- /dev/null ++++ b/drivers/usb/host/dwc_otg/dwc_otg_dbg.h +@@ -0,0 +1,117 @@ ++/* ========================================================================== ++ * ++ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, ++ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless ++ * otherwise expressly agreed to in writing between Synopsys and you. ++ * ++ * The Software IS NOT an item of Licensed Software or Licensed Product under ++ * any End User Software License Agreement or Agreement for Licensed Product ++ * with Synopsys or any supplement thereto. You are permitted to use and ++ * redistribute this Software in source and binary forms, with or without ++ * modification, provided that redistributions of source code must retain this ++ * notice. You may not view, use, disclose, copy or distribute this file or ++ * any information contained herein except pursuant to this license grant from ++ * Synopsys. If you do not agree with this notice, including the disclaimer ++ * below, then you are not authorized to use the Software. ++ * ++ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS ++ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS 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. ++ * ========================================================================== */ ++ ++#ifndef __DWC_OTG_DBG_H__ ++#define __DWC_OTG_DBG_H__ ++ ++/** @file ++ * This file defines debug levels. ++ * Debugging support vanishes in non-debug builds. ++ */ ++ ++/** ++ * The Debug Level bit-mask variable. ++ */ ++extern uint32_t g_dbg_lvl; ++/** ++ * Set the Debug Level variable. ++ */ ++static inline uint32_t SET_DEBUG_LEVEL(const uint32_t new) ++{ ++ uint32_t old = g_dbg_lvl; ++ g_dbg_lvl = new; ++ return old; ++} ++ ++#define DBG_USER (0x1) ++/** When debug level has the DBG_CIL bit set, display CIL Debug messages. */ ++#define DBG_CIL (0x2) ++/** When debug level has the DBG_CILV bit set, display CIL Verbose debug ++ * messages */ ++#define DBG_CILV (0x20) ++/** When debug level has the DBG_PCD bit set, display PCD (Device) debug ++ * messages */ ++#define DBG_PCD (0x4) ++/** When debug level has the DBG_PCDV set, display PCD (Device) Verbose debug ++ * messages */ ++#define DBG_PCDV (0x40) ++/** When debug level has the DBG_HCD bit set, display Host debug messages */ ++#define DBG_HCD (0x8) ++/** When debug level has the DBG_HCDV bit set, display Verbose Host debug ++ * messages */ ++#define DBG_HCDV (0x80) ++/** When debug level has the DBG_HCD_URB bit set, display enqueued URBs in host ++ * mode. */ ++#define DBG_HCD_URB (0x800) ++/** When debug level has the DBG_HCDI bit set, display host interrupt ++ * messages. */ ++#define DBG_HCDI (0x1000) ++ ++/** When debug level has any bit set, display debug messages */ ++#define DBG_ANY (0xFF) ++ ++/** All debug messages off */ ++#define DBG_OFF 0 ++ ++/** Prefix string for DWC_DEBUG print macros. */ ++#define USB_DWC "DWC_otg: " ++ ++/** ++ * Print a debug message when the Global debug level variable contains ++ * the bit defined in <code>lvl</code>. ++ * ++ * @param[in] lvl - Debug level, use one of the DBG_ constants above. ++ * @param[in] x - like printf ++ * ++ * Example:<p> ++ * <code> ++ * DWC_DEBUGPL( DBG_ANY, "%s(%p)\n", __func__, _reg_base_addr); ++ * </code> ++ * <br> ++ * results in:<br> ++ * <code> ++ * usb-DWC_otg: dwc_otg_cil_init(ca867000) ++ * </code> ++ */ ++#ifdef DEBUG ++ ++# define DWC_DEBUGPL(lvl, x...) do{ if ((lvl)&g_dbg_lvl)__DWC_DEBUG(USB_DWC x ); }while(0) ++# define DWC_DEBUGP(x...) DWC_DEBUGPL(DBG_ANY, x ) ++ ++# define CHK_DEBUG_LEVEL(level) ((level) & g_dbg_lvl) ++ ++#else ++ ++# define DWC_DEBUGPL(lvl, x...) do{}while(0) ++# define DWC_DEBUGP(x...) ++ ++# define CHK_DEBUG_LEVEL(level) (0) ++ ++#endif /*DEBUG*/ ++#endif +diff --git a/drivers/usb/host/dwc_otg/dwc_otg_driver.c b/drivers/usb/host/dwc_otg/dwc_otg_driver.c +new file mode 100644 +index 0000000..cb060a7 +--- /dev/null ++++ b/drivers/usb/host/dwc_otg/dwc_otg_driver.c +@@ -0,0 +1,1757 @@ ++/* ========================================================================== ++ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_driver.c $ ++ * $Revision: #92 $ ++ * $Date: 2012/08/10 $ ++ * $Change: 2047372 $ ++ * ++ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, ++ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless ++ * otherwise expressly agreed to in writing between Synopsys and you. ++ * ++ * The Software IS NOT an item of Licensed Software or Licensed Product under ++ * any End User Software License Agreement or Agreement for Licensed Product ++ * with Synopsys or any supplement thereto. You are permitted to use and ++ * redistribute this Software in source and binary forms, with or without ++ * modification, provided that redistributions of source code must retain this ++ * notice. You may not view, use, disclose, copy or distribute this file or ++ * any information contained herein except pursuant to this license grant from ++ * Synopsys. If you do not agree with this notice, including the disclaimer ++ * below, then you are not authorized to use the Software. ++ * ++ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS ++ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS 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. ++ * ========================================================================== */ ++ ++/** @file ++ * The dwc_otg_driver module provides the initialization and cleanup entry ++ * points for the DWC_otg driver. This module will be dynamically installed ++ * after Linux is booted using the insmod command. When the module is ++ * installed, the dwc_otg_driver_init function is called. When the module is ++ * removed (using rmmod), the dwc_otg_driver_cleanup function is called. ++ * ++ * This module also defines a data structure for the dwc_otg_driver, which is ++ * used in conjunction with the standard ARM lm_device structure. These ++ * structures allow the OTG driver to comply with the standard Linux driver ++ * model in which devices and drivers are registered with a bus driver. This ++ * has the benefit that Linux can expose attributes of the driver and device ++ * in its special sysfs file system. Users can then read or write files in ++ * this file system to perform diagnostics on the driver components or the ++ * device. ++ */ ++ ++#include "dwc_otg_os_dep.h" ++#include "dwc_os.h" ++#include "dwc_otg_dbg.h" ++#include "dwc_otg_driver.h" ++#include "dwc_otg_attr.h" ++#include "dwc_otg_core_if.h" ++#include "dwc_otg_pcd_if.h" ++#include "dwc_otg_hcd_if.h" ++#include "dwc_otg_fiq_fsm.h" ++ ++#define DWC_DRIVER_VERSION "3.00a 10-AUG-2012" ++#define DWC_DRIVER_DESC "HS OTG USB Controller driver" ++ ++bool microframe_schedule=true; ++ ++static const char dwc_driver_name[] = "dwc_otg"; ++ ++ ++extern int pcd_init( ++#ifdef LM_INTERFACE ++ struct lm_device *_dev ++#elif defined(PCI_INTERFACE) ++ struct pci_dev *_dev ++#elif defined(PLATFORM_INTERFACE) ++ struct platform_device *dev ++#endif ++ ); ++extern int hcd_init( ++#ifdef LM_INTERFACE ++ struct lm_device *_dev ++#elif defined(PCI_INTERFACE) ++ struct pci_dev *_dev ++#elif defined(PLATFORM_INTERFACE) ++ struct platform_device *dev ++#endif ++ ); ++ ++extern int pcd_remove( ++#ifdef LM_INTERFACE ++ struct lm_device *_dev ++#elif defined(PCI_INTERFACE) ++ struct pci_dev *_dev ++#elif defined(PLATFORM_INTERFACE) ++ struct platform_device *_dev ++#endif ++ ); ++ ++extern void hcd_remove( ++#ifdef LM_INTERFACE ++ struct lm_device *_dev ++#elif defined(PCI_INTERFACE) ++ struct pci_dev *_dev ++#elif defined(PLATFORM_INTERFACE) ++ struct platform_device *_dev ++#endif ++ ); ++ ++extern void dwc_otg_adp_start(dwc_otg_core_if_t * core_if, uint8_t is_host); ++ ++/*-------------------------------------------------------------------------*/ ++/* Encapsulate the module parameter settings */ ++ ++struct dwc_otg_driver_module_params { ++ int32_t opt; ++ int32_t otg_cap; ++ int32_t dma_enable; ++ int32_t dma_desc_enable; ++ int32_t dma_burst_size; ++ int32_t speed; ++ int32_t host_support_fs_ls_low_power; ++ int32_t host_ls_low_power_phy_clk; ++ int32_t enable_dynamic_fifo; ++ int32_t data_fifo_size; ++ int32_t dev_rx_fifo_size; ++ int32_t dev_nperio_tx_fifo_size; ++ uint32_t dev_perio_tx_fifo_size[MAX_PERIO_FIFOS]; ++ int32_t host_rx_fifo_size; ++ int32_t host_nperio_tx_fifo_size; ++ int32_t host_perio_tx_fifo_size; ++ int32_t max_transfer_size; ++ int32_t max_packet_count; ++ int32_t host_channels; ++ int32_t dev_endpoints; ++ int32_t phy_type; ++ int32_t phy_utmi_width; ++ int32_t phy_ulpi_ddr; ++ int32_t phy_ulpi_ext_vbus; ++ int32_t i2c_enable; ++ int32_t ulpi_fs_ls; ++ int32_t ts_dline; ++ int32_t en_multiple_tx_fifo; ++ uint32_t dev_tx_fifo_size[MAX_TX_FIFOS]; ++ uint32_t thr_ctl; ++ uint32_t tx_thr_length; ++ uint32_t rx_thr_length; ++ int32_t pti_enable; ++ int32_t mpi_enable; ++ int32_t lpm_enable; ++ int32_t ic_usb_cap; ++ int32_t ahb_thr_ratio; ++ int32_t power_down; ++ int32_t reload_ctl; ++ int32_t dev_out_nak; ++ int32_t cont_on_bna; ++ int32_t ahb_single; ++ int32_t otg_ver; ++ int32_t adp_enable; ++}; ++ ++static struct dwc_otg_driver_module_params dwc_otg_module_params = { ++ .opt = -1, ++ .otg_cap = -1, ++ .dma_enable = -1, ++ .dma_desc_enable = -1, ++ .dma_burst_size = -1, ++ .speed = -1, ++ .host_support_fs_ls_low_power = -1, ++ .host_ls_low_power_phy_clk = -1, ++ .enable_dynamic_fifo = -1, ++ .data_fifo_size = -1, ++ .dev_rx_fifo_size = -1, ++ .dev_nperio_tx_fifo_size = -1, ++ .dev_perio_tx_fifo_size = { ++ /* dev_perio_tx_fifo_size_1 */ ++ -1, ++ -1, ++ -1, ++ -1, ++ -1, ++ -1, ++ -1, ++ -1, ++ -1, ++ -1, ++ -1, ++ -1, ++ -1, ++ -1, ++ -1 ++ /* 15 */ ++ }, ++ .host_rx_fifo_size = -1, ++ .host_nperio_tx_fifo_size = -1, ++ .host_perio_tx_fifo_size = -1, ++ .max_transfer_size = -1, ++ .max_packet_count = -1, ++ .host_channels = -1, ++ .dev_endpoints = -1, ++ .phy_type = -1, ++ .phy_utmi_width = -1, ++ .phy_ulpi_ddr = -1, ++ .phy_ulpi_ext_vbus = -1, ++ .i2c_enable = -1, ++ .ulpi_fs_ls = -1, ++ .ts_dline = -1, ++ .en_multiple_tx_fifo = -1, ++ .dev_tx_fifo_size = { ++ /* dev_tx_fifo_size */ ++ -1, ++ -1, ++ -1, ++ -1, ++ -1, ++ -1, ++ -1, ++ -1, ++ -1, ++ -1, ++ -1, ++ -1, ++ -1, ++ -1, ++ -1 ++ /* 15 */ ++ }, ++ .thr_ctl = -1, ++ .tx_thr_length = -1, ++ .rx_thr_length = -1, ++ .pti_enable = -1, ++ .mpi_enable = -1, ++ .lpm_enable = 0, ++ .ic_usb_cap = -1, ++ .ahb_thr_ratio = -1, ++ .power_down = -1, ++ .reload_ctl = -1, ++ .dev_out_nak = -1, ++ .cont_on_bna = -1, ++ .ahb_single = -1, ++ .otg_ver = -1, ++ .adp_enable = -1, ++}; ++ ++//Global variable to switch the fiq fix on or off ++bool fiq_enable = 1; ++// Global variable to enable the split transaction fix ++bool fiq_fsm_enable = true; ++//Bulk split-transaction NAK holdoff in microframes ++uint16_t nak_holdoff = 8; ++ ++unsigned short fiq_fsm_mask = 0x0F; ++ ++/** ++ * This function shows the Driver Version. ++ */ ++static ssize_t version_show(struct device_driver *dev, char *buf) ++{ ++ return snprintf(buf, sizeof(DWC_DRIVER_VERSION) + 2, "%s\n", ++ DWC_DRIVER_VERSION); ++} ++ ++static DRIVER_ATTR(version, S_IRUGO, version_show, NULL); ++ ++/** ++ * Global Debug Level Mask. ++ */ ++uint32_t g_dbg_lvl = 0; /* OFF */ ++ ++/** ++ * This function shows the driver Debug Level. ++ */ ++static ssize_t dbg_level_show(struct device_driver *drv, char *buf) ++{ ++ return sprintf(buf, "0x%0x\n", g_dbg_lvl); ++} ++ ++/** ++ * This function stores the driver Debug Level. ++ */ ++static ssize_t dbg_level_store(struct device_driver *drv, const char *buf, ++ size_t count) ++{ ++ g_dbg_lvl = simple_strtoul(buf, NULL, 16); ++ return count; ++} ++ ++static DRIVER_ATTR(debuglevel, S_IRUGO | S_IWUSR, dbg_level_show, ++ dbg_level_store); ++ ++/** ++ * This function is called during module intialization ++ * to pass module parameters to the DWC_OTG CORE. ++ */ ++static int set_parameters(dwc_otg_core_if_t * core_if) ++{ ++ int retval = 0; ++ int i; ++ ++ if (dwc_otg_module_params.otg_cap != -1) { ++ retval += ++ dwc_otg_set_param_otg_cap(core_if, ++ dwc_otg_module_params.otg_cap); ++ } ++ if (dwc_otg_module_params.dma_enable != -1) { ++ retval += ++ dwc_otg_set_param_dma_enable(core_if, ++ dwc_otg_module_params. ++ dma_enable); ++ } ++ if (dwc_otg_module_params.dma_desc_enable != -1) { ++ retval += ++ dwc_otg_set_param_dma_desc_enable(core_if, ++ dwc_otg_module_params. ++ dma_desc_enable); ++ } ++ if (dwc_otg_module_params.opt != -1) { ++ retval += ++ dwc_otg_set_param_opt(core_if, dwc_otg_module_params.opt); ++ } ++ if (dwc_otg_module_params.dma_burst_size != -1) { ++ retval += ++ dwc_otg_set_param_dma_burst_size(core_if, ++ dwc_otg_module_params. ++ dma_burst_size); ++ } ++ if (dwc_otg_module_params.host_support_fs_ls_low_power != -1) { ++ retval += ++ dwc_otg_set_param_host_support_fs_ls_low_power(core_if, ++ dwc_otg_module_params. ++ host_support_fs_ls_low_power); ++ } ++ if (dwc_otg_module_params.enable_dynamic_fifo != -1) { ++ retval += ++ dwc_otg_set_param_enable_dynamic_fifo(core_if, ++ dwc_otg_module_params. ++ enable_dynamic_fifo); ++ } ++ if (dwc_otg_module_params.data_fifo_size != -1) { ++ retval += ++ dwc_otg_set_param_data_fifo_size(core_if, ++ dwc_otg_module_params. ++ data_fifo_size); ++ } ++ if (dwc_otg_module_params.dev_rx_fifo_size != -1) { ++ retval += ++ dwc_otg_set_param_dev_rx_fifo_size(core_if, ++ dwc_otg_module_params. ++ dev_rx_fifo_size); ++ } ++ if (dwc_otg_module_params.dev_nperio_tx_fifo_size != -1) { ++ retval += ++ dwc_otg_set_param_dev_nperio_tx_fifo_size(core_if, ++ dwc_otg_module_params. ++ dev_nperio_tx_fifo_size); ++ } ++ if (dwc_otg_module_params.host_rx_fifo_size != -1) { ++ retval += ++ dwc_otg_set_param_host_rx_fifo_size(core_if, ++ dwc_otg_module_params.host_rx_fifo_size); ++ } ++ if (dwc_otg_module_params.host_nperio_tx_fifo_size != -1) { ++ retval += ++ dwc_otg_set_param_host_nperio_tx_fifo_size(core_if, ++ dwc_otg_module_params. ++ host_nperio_tx_fifo_size); ++ } ++ if (dwc_otg_module_params.host_perio_tx_fifo_size != -1) { ++ retval += ++ dwc_otg_set_param_host_perio_tx_fifo_size(core_if, ++ dwc_otg_module_params. ++ host_perio_tx_fifo_size); ++ } ++ if (dwc_otg_module_params.max_transfer_size != -1) { ++ retval += ++ dwc_otg_set_param_max_transfer_size(core_if, ++ dwc_otg_module_params. ++ max_transfer_size); ++ } ++ if (dwc_otg_module_params.max_packet_count != -1) { ++ retval += ++ dwc_otg_set_param_max_packet_count(core_if, ++ dwc_otg_module_params. ++ max_packet_count); ++ } ++ if (dwc_otg_module_params.host_channels != -1) { ++ retval += ++ dwc_otg_set_param_host_channels(core_if, ++ dwc_otg_module_params. ++ host_channels); ++ } ++ if (dwc_otg_module_params.dev_endpoints != -1) { ++ retval += ++ dwc_otg_set_param_dev_endpoints(core_if, ++ dwc_otg_module_params. ++ dev_endpoints); ++ } ++ if (dwc_otg_module_params.phy_type != -1) { ++ retval += ++ dwc_otg_set_param_phy_type(core_if, ++ dwc_otg_module_params.phy_type); ++ } ++ if (dwc_otg_module_params.speed != -1) { ++ retval += ++ dwc_otg_set_param_speed(core_if, ++ dwc_otg_module_params.speed); ++ } ++ if (dwc_otg_module_params.host_ls_low_power_phy_clk != -1) { ++ retval += ++ dwc_otg_set_param_host_ls_low_power_phy_clk(core_if, ++ dwc_otg_module_params. ++ host_ls_low_power_phy_clk); ++ } ++ if (dwc_otg_module_params.phy_ulpi_ddr != -1) { ++ retval += ++ dwc_otg_set_param_phy_ulpi_ddr(core_if, ++ dwc_otg_module_params. ++ phy_ulpi_ddr); ++ } ++ if (dwc_otg_module_params.phy_ulpi_ext_vbus != -1) { ++ retval += ++ dwc_otg_set_param_phy_ulpi_ext_vbus(core_if, ++ dwc_otg_module_params. ++ phy_ulpi_ext_vbus); ++ } ++ if (dwc_otg_module_params.phy_utmi_width != -1) { ++ retval += ++ dwc_otg_set_param_phy_utmi_width(core_if, ++ dwc_otg_module_params. ++ phy_utmi_width); ++ } ++ if (dwc_otg_module_params.ulpi_fs_ls != -1) { ++ retval += ++ dwc_otg_set_param_ulpi_fs_ls(core_if, ++ dwc_otg_module_params.ulpi_fs_ls); ++ } ++ if (dwc_otg_module_params.ts_dline != -1) { ++ retval += ++ dwc_otg_set_param_ts_dline(core_if, ++ dwc_otg_module_params.ts_dline); ++ } ++ if (dwc_otg_module_params.i2c_enable != -1) { ++ retval += ++ dwc_otg_set_param_i2c_enable(core_if, ++ dwc_otg_module_params. ++ i2c_enable); ++ } ++ if (dwc_otg_module_params.en_multiple_tx_fifo != -1) { ++ retval += ++ dwc_otg_set_param_en_multiple_tx_fifo(core_if, ++ dwc_otg_module_params. ++ en_multiple_tx_fifo); ++ } ++ for (i = 0; i < 15; i++) { ++ if (dwc_otg_module_params.dev_perio_tx_fifo_size[i] != -1) { ++ retval += ++ dwc_otg_set_param_dev_perio_tx_fifo_size(core_if, ++ dwc_otg_module_params. ++ dev_perio_tx_fifo_size ++ [i], i); ++ } ++ } ++ ++ for (i = 0; i < 15; i++) { ++ if (dwc_otg_module_params.dev_tx_fifo_size[i] != -1) { ++ retval += dwc_otg_set_param_dev_tx_fifo_size(core_if, ++ dwc_otg_module_params. ++ dev_tx_fifo_size ++ [i], i); ++ } ++ } ++ if (dwc_otg_module_params.thr_ctl != -1) { ++ retval += ++ dwc_otg_set_param_thr_ctl(core_if, ++ dwc_otg_module_params.thr_ctl); ++ } ++ if (dwc_otg_module_params.mpi_enable != -1) { ++ retval += ++ dwc_otg_set_param_mpi_enable(core_if, ++ dwc_otg_module_params. ++ mpi_enable); ++ } ++ if (dwc_otg_module_params.pti_enable != -1) { ++ retval += ++ dwc_otg_set_param_pti_enable(core_if, ++ dwc_otg_module_params. ++ pti_enable); ++ } ++ if (dwc_otg_module_params.lpm_enable != -1) { ++ retval += ++ dwc_otg_set_param_lpm_enable(core_if, ++ dwc_otg_module_params. ++ lpm_enable); ++ } ++ if (dwc_otg_module_params.ic_usb_cap != -1) { ++ retval += ++ dwc_otg_set_param_ic_usb_cap(core_if, ++ dwc_otg_module_params. ++ ic_usb_cap); ++ } ++ if (dwc_otg_module_params.tx_thr_length != -1) { ++ retval += ++ dwc_otg_set_param_tx_thr_length(core_if, ++ dwc_otg_module_params.tx_thr_length); ++ } ++ if (dwc_otg_module_params.rx_thr_length != -1) { ++ retval += ++ dwc_otg_set_param_rx_thr_length(core_if, ++ dwc_otg_module_params. ++ rx_thr_length); ++ } ++ if (dwc_otg_module_params.ahb_thr_ratio != -1) { ++ retval += ++ dwc_otg_set_param_ahb_thr_ratio(core_if, ++ dwc_otg_module_params.ahb_thr_ratio); ++ } ++ if (dwc_otg_module_params.power_down != -1) { ++ retval += ++ dwc_otg_set_param_power_down(core_if, ++ dwc_otg_module_params.power_down); ++ } ++ if (dwc_otg_module_params.reload_ctl != -1) { ++ retval += ++ dwc_otg_set_param_reload_ctl(core_if, ++ dwc_otg_module_params.reload_ctl); ++ } ++ ++ if (dwc_otg_module_params.dev_out_nak != -1) { ++ retval += ++ dwc_otg_set_param_dev_out_nak(core_if, ++ dwc_otg_module_params.dev_out_nak); ++ } ++ ++ if (dwc_otg_module_params.cont_on_bna != -1) { ++ retval += ++ dwc_otg_set_param_cont_on_bna(core_if, ++ dwc_otg_module_params.cont_on_bna); ++ } ++ ++ if (dwc_otg_module_params.ahb_single != -1) { ++ retval += ++ dwc_otg_set_param_ahb_single(core_if, ++ dwc_otg_module_params.ahb_single); ++ } ++ ++ if (dwc_otg_module_params.otg_ver != -1) { ++ retval += ++ dwc_otg_set_param_otg_ver(core_if, ++ dwc_otg_module_params.otg_ver); ++ } ++ if (dwc_otg_module_params.adp_enable != -1) { ++ retval += ++ dwc_otg_set_param_adp_enable(core_if, ++ dwc_otg_module_params. ++ adp_enable); ++ } ++ return retval; ++} ++ ++/** ++ * This function is the top level interrupt handler for the Common ++ * (Device and host modes) interrupts. ++ */ ++static irqreturn_t dwc_otg_common_irq(int irq, void *dev) ++{ ++ int32_t retval = IRQ_NONE; ++ ++ retval = dwc_otg_handle_common_intr(dev); ++ if (retval != 0) { ++ S3C2410X_CLEAR_EINTPEND(); ++ } ++ return IRQ_RETVAL(retval); ++} ++ ++/** ++ * This function is called when a lm_device is unregistered with the ++ * dwc_otg_driver. This happens, for example, when the rmmod command is ++ * executed. The device may or may not be electrically present. If it is ++ * present, the driver stops device processing. Any resources used on behalf ++ * of this device are freed. ++ * ++ * @param _dev ++ */ ++#ifdef LM_INTERFACE ++#define REM_RETVAL(n) ++static void dwc_otg_driver_remove( struct lm_device *_dev ) ++{ dwc_otg_device_t *otg_dev = lm_get_drvdata(_dev); ++#elif defined(PCI_INTERFACE) ++#define REM_RETVAL(n) ++static void dwc_otg_driver_remove( struct pci_dev *_dev ) ++{ dwc_otg_device_t *otg_dev = pci_get_drvdata(_dev); ++#elif defined(PLATFORM_INTERFACE) ++#define REM_RETVAL(n) n ++static int dwc_otg_driver_remove( struct platform_device *_dev ) ++{ dwc_otg_device_t *otg_dev = platform_get_drvdata(_dev); ++#endif ++ ++ DWC_DEBUGPL(DBG_ANY, "%s(%p) otg_dev %p\n", __func__, _dev, otg_dev); ++ ++ if (!otg_dev) { ++ /* Memory allocation for the dwc_otg_device failed. */ ++ DWC_DEBUGPL(DBG_ANY, "%s: otg_dev NULL!\n", __func__); ++ return REM_RETVAL(-ENOMEM); ++ } ++#ifndef DWC_DEVICE_ONLY ++ if (otg_dev->hcd) { ++ hcd_remove(_dev); ++ } else { ++ DWC_DEBUGPL(DBG_ANY, "%s: otg_dev->hcd NULL!\n", __func__); ++ return REM_RETVAL(-EINVAL); ++ } ++#endif ++ ++#ifndef DWC_HOST_ONLY ++ if (otg_dev->pcd) { ++ pcd_remove(_dev); ++ } else { ++ DWC_DEBUGPL(DBG_ANY, "%s: otg_dev->pcd NULL!\n", __func__); ++ return REM_RETVAL(-EINVAL); ++ } ++#endif ++ /* ++ * Free the IRQ ++ */ ++ if (otg_dev->common_irq_installed) { ++#ifdef PLATFORM_INTERFACE ++ free_irq(platform_get_irq(_dev, 0), otg_dev); ++#else ++ free_irq(_dev->irq, otg_dev); ++#endif ++ } else { ++ DWC_DEBUGPL(DBG_ANY, "%s: There is no installed irq!\n", __func__); ++ return REM_RETVAL(-ENXIO); ++ } ++ ++ if (otg_dev->core_if) { ++ dwc_otg_cil_remove(otg_dev->core_if); ++ } else { ++ DWC_DEBUGPL(DBG_ANY, "%s: otg_dev->core_if NULL!\n", __func__); ++ return REM_RETVAL(-ENXIO); ++ } ++ ++ /* ++ * Remove the device attributes ++ */ ++ dwc_otg_attr_remove(_dev); ++ ++ /* ++ * Return the memory. ++ */ ++ if (otg_dev->os_dep.base) { ++ iounmap(otg_dev->os_dep.base); ++ } ++ DWC_FREE(otg_dev); ++ ++ /* ++ * Clear the drvdata pointer. ++ */ ++#ifdef LM_INTERFACE ++ lm_set_drvdata(_dev, 0); ++#elif defined(PCI_INTERFACE) ++ release_mem_region(otg_dev->os_dep.rsrc_start, ++ otg_dev->os_dep.rsrc_len); ++ pci_set_drvdata(_dev, 0); ++#elif defined(PLATFORM_INTERFACE) ++ platform_set_drvdata(_dev, 0); ++#endif ++ return REM_RETVAL(0); ++} ++ ++/** ++ * This function is called when an lm_device is bound to a ++ * dwc_otg_driver. It creates the driver components required to ++ * control the device (CIL, HCD, and PCD) and it initializes the ++ * device. The driver components are stored in a dwc_otg_device ++ * structure. A reference to the dwc_otg_device is saved in the ++ * lm_device. This allows the driver to access the dwc_otg_device ++ * structure on subsequent calls to driver methods for this device. ++ * ++ * @param _dev Bus device ++ */ ++static int dwc_otg_driver_probe( ++#ifdef LM_INTERFACE ++ struct lm_device *_dev ++#elif defined(PCI_INTERFACE) ++ struct pci_dev *_dev, ++ const struct pci_device_id *id ++#elif defined(PLATFORM_INTERFACE) ++ struct platform_device *_dev ++#endif ++ ) ++{ ++ int retval = 0; ++ dwc_otg_device_t *dwc_otg_device; ++ int devirq; ++ ++ dev_dbg(&_dev->dev, "dwc_otg_driver_probe(%p)\n", _dev); ++#ifdef LM_INTERFACE ++ dev_dbg(&_dev->dev, "start=0x%08x\n", (unsigned)_dev->resource.start); ++#elif defined(PCI_INTERFACE) ++ if (!id) { ++ DWC_ERROR("Invalid pci_device_id %p", id); ++ return -EINVAL; ++ } ++ ++ if (!_dev || (pci_enable_device(_dev) < 0)) { ++ DWC_ERROR("Invalid pci_device %p", _dev); ++ return -ENODEV; ++ } ++ dev_dbg(&_dev->dev, "start=0x%08x\n", (unsigned)pci_resource_start(_dev,0)); ++ /* other stuff needed as well? */ ++ ++#elif defined(PLATFORM_INTERFACE) ++ dev_dbg(&_dev->dev, "start=0x%08x (len 0x%x)\n", ++ (unsigned)_dev->resource->start, ++ (unsigned)(_dev->resource->end - _dev->resource->start)); ++#endif ++ ++ dwc_otg_device = DWC_ALLOC(sizeof(dwc_otg_device_t)); ++ ++ if (!dwc_otg_device) { ++ dev_err(&_dev->dev, "kmalloc of dwc_otg_device failed\n"); ++ return -ENOMEM; ++ } ++ ++ memset(dwc_otg_device, 0, sizeof(*dwc_otg_device)); ++ dwc_otg_device->os_dep.reg_offset = 0xFFFFFFFF; ++ dwc_otg_device->os_dep.platformdev = _dev; ++ ++ /* ++ * Map the DWC_otg Core memory into virtual address space. ++ */ ++#ifdef LM_INTERFACE ++ dwc_otg_device->os_dep.base = ioremap(_dev->resource.start, SZ_256K); ++ ++ if (!dwc_otg_device->os_dep.base) { ++ dev_err(&_dev->dev, "ioremap() failed\n"); ++ DWC_FREE(dwc_otg_device); ++ return -ENOMEM; ++ } ++ dev_dbg(&_dev->dev, "base=0x%08x\n", ++ (unsigned)dwc_otg_device->os_dep.base); ++#elif defined(PCI_INTERFACE) ++ _dev->current_state = PCI_D0; ++ _dev->dev.power.power_state = PMSG_ON; ++ ++ if (!_dev->irq) { ++ DWC_ERROR("Found HC with no IRQ. Check BIOS/PCI %s setup!", ++ pci_name(_dev)); ++ iounmap(dwc_otg_device->os_dep.base); ++ DWC_FREE(dwc_otg_device); ++ return -ENODEV; ++ } ++ ++ dwc_otg_device->os_dep.rsrc_start = pci_resource_start(_dev, 0); ++ dwc_otg_device->os_dep.rsrc_len = pci_resource_len(_dev, 0); ++ DWC_DEBUGPL(DBG_ANY, "PCI resource: start=%08x, len=%08x\n", ++ (unsigned)dwc_otg_device->os_dep.rsrc_start, ++ (unsigned)dwc_otg_device->os_dep.rsrc_len); ++ if (!request_mem_region ++ (dwc_otg_device->os_dep.rsrc_start, dwc_otg_device->os_dep.rsrc_len, ++ "dwc_otg")) { ++ dev_dbg(&_dev->dev, "error requesting memory\n"); ++ iounmap(dwc_otg_device->os_dep.base); ++ DWC_FREE(dwc_otg_device); ++ return -EFAULT; ++ } ++ ++ dwc_otg_device->os_dep.base = ++ ioremap_nocache(dwc_otg_device->os_dep.rsrc_start, ++ dwc_otg_device->os_dep.rsrc_len); ++ if (dwc_otg_device->os_dep.base == NULL) { ++ dev_dbg(&_dev->dev, "error mapping memory\n"); ++ release_mem_region(dwc_otg_device->os_dep.rsrc_start, ++ dwc_otg_device->os_dep.rsrc_len); ++ iounmap(dwc_otg_device->os_dep.base); ++ DWC_FREE(dwc_otg_device); ++ return -EFAULT; ++ } ++ dev_dbg(&_dev->dev, "base=0x%p (before adjust) \n", ++ dwc_otg_device->os_dep.base); ++ dwc_otg_device->os_dep.base = (char *)dwc_otg_device->os_dep.base; ++ dev_dbg(&_dev->dev, "base=0x%p (after adjust) \n", ++ dwc_otg_device->os_dep.base); ++ dev_dbg(&_dev->dev, "%s: mapped PA 0x%x to VA 0x%p\n", __func__, ++ (unsigned)dwc_otg_device->os_dep.rsrc_start, ++ dwc_otg_device->os_dep.base); ++ ++ pci_set_master(_dev); ++ pci_set_drvdata(_dev, dwc_otg_device); ++#elif defined(PLATFORM_INTERFACE) ++ DWC_DEBUGPL(DBG_ANY,"Platform resource: start=%08x, len=%08x\n", ++ _dev->resource->start, ++ _dev->resource->end - _dev->resource->start + 1); ++#if 1 ++ if (!request_mem_region(_dev->resource[0].start, ++ _dev->resource[0].end - _dev->resource[0].start + 1, ++ "dwc_otg")) { ++ dev_dbg(&_dev->dev, "error reserving mapped memory\n"); ++ retval = -EFAULT; ++ goto fail; ++ } ++ ++ dwc_otg_device->os_dep.base = ioremap_nocache(_dev->resource[0].start, ++ _dev->resource[0].end - ++ _dev->resource[0].start+1); ++ if (fiq_enable) ++ { ++ if (!request_mem_region(_dev->resource[1].start, ++ _dev->resource[1].end - _dev->resource[1].start + 1, ++ "dwc_otg")) { ++ dev_dbg(&_dev->dev, "error reserving mapped memory\n"); ++ retval = -EFAULT; ++ goto fail; ++ } ++ ++ dwc_otg_device->os_dep.mphi_base = ioremap_nocache(_dev->resource[1].start, ++ _dev->resource[1].end - ++ _dev->resource[1].start + 1); ++ } ++ ++#else ++ { ++ struct map_desc desc = { ++ .virtual = IO_ADDRESS((unsigned)_dev->resource->start), ++ .pfn = __phys_to_pfn((unsigned)_dev->resource->start), ++ .length = SZ_128K, ++ .type = MT_DEVICE ++ }; ++ iotable_init(&desc, 1); ++ dwc_otg_device->os_dep.base = (void *)desc.virtual; ++ } ++#endif ++ if (!dwc_otg_device->os_dep.base) { ++ dev_err(&_dev->dev, "ioremap() failed\n"); ++ retval = -ENOMEM; ++ goto fail; ++ } ++ dev_dbg(&_dev->dev, "base=0x%08x\n", ++ (unsigned)dwc_otg_device->os_dep.base); ++#endif ++ ++ /* ++ * Initialize driver data to point to the global DWC_otg ++ * Device structure. ++ */ ++#ifdef LM_INTERFACE ++ lm_set_drvdata(_dev, dwc_otg_device); ++#elif defined(PLATFORM_INTERFACE) ++ platform_set_drvdata(_dev, dwc_otg_device); ++#endif ++ dev_dbg(&_dev->dev, "dwc_otg_device=0x%p\n", dwc_otg_device); ++ ++ dwc_otg_device->core_if = dwc_otg_cil_init(dwc_otg_device->os_dep.base); ++ DWC_DEBUGPL(DBG_HCDV, "probe of device %p given core_if %p\n", ++ dwc_otg_device, dwc_otg_device->core_if);//GRAYG ++ ++ if (!dwc_otg_device->core_if) { ++ dev_err(&_dev->dev, "CIL initialization failed!\n"); ++ retval = -ENOMEM; ++ goto fail; ++ } ++ ++ dev_dbg(&_dev->dev, "Calling get_gsnpsid\n"); ++ /* ++ * Attempt to ensure this device is really a DWC_otg Controller. ++ * Read and verify the SNPSID register contents. The value should be ++ * 0x45F42XXX or 0x45F42XXX, which corresponds to either "OT2" or "OTG3", ++ * as in "OTG version 2.XX" or "OTG version 3.XX". ++ */ ++ ++ if (((dwc_otg_get_gsnpsid(dwc_otg_device->core_if) & 0xFFFFF000) != 0x4F542000) && ++ ((dwc_otg_get_gsnpsid(dwc_otg_device->core_if) & 0xFFFFF000) != 0x4F543000)) { ++ dev_err(&_dev->dev, "Bad value for SNPSID: 0x%08x\n", ++ dwc_otg_get_gsnpsid(dwc_otg_device->core_if)); ++ retval = -EINVAL; ++ goto fail; ++ } ++ ++ /* ++ * Validate parameter values. ++ */ ++ dev_dbg(&_dev->dev, "Calling set_parameters\n"); ++ if (set_parameters(dwc_otg_device->core_if)) { ++ retval = -EINVAL; ++ goto fail; ++ } ++ ++ /* ++ * Create Device Attributes in sysfs ++ */ ++ dev_dbg(&_dev->dev, "Calling attr_create\n"); ++ dwc_otg_attr_create(_dev); ++ ++ /* ++ * Disable the global interrupt until all the interrupt ++ * handlers are installed. ++ */ ++ dev_dbg(&_dev->dev, "Calling disable_global_interrupts\n"); ++ dwc_otg_disable_global_interrupts(dwc_otg_device->core_if); ++ ++ /* ++ * Install the interrupt handler for the common interrupts before ++ * enabling common interrupts in core_init below. ++ */ ++ ++#if defined(PLATFORM_INTERFACE) ++ devirq = platform_get_irq(_dev, fiq_enable ? 0 : 1); ++#else ++ devirq = _dev->irq; ++#endif ++ DWC_DEBUGPL(DBG_CIL, "registering (common) handler for irq%d\n", ++ devirq); ++ dev_dbg(&_dev->dev, "Calling request_irq(%d)\n", devirq); ++ retval = request_irq(devirq, dwc_otg_common_irq, ++ IRQF_SHARED, ++ "dwc_otg", dwc_otg_device); ++ if (retval) { ++ DWC_ERROR("request of irq%d failed\n", devirq); ++ retval = -EBUSY; ++ goto fail; ++ } else { ++ dwc_otg_device->common_irq_installed = 1; ++ } ++ ++#ifndef IRQF_TRIGGER_LOW ++#if defined(LM_INTERFACE) || defined(PLATFORM_INTERFACE) ++ dev_dbg(&_dev->dev, "Calling set_irq_type\n"); ++ set_irq_type(devirq, ++#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30)) ++ IRQT_LOW ++#else ++ IRQ_TYPE_LEVEL_LOW ++#endif ++ ); ++#endif ++#endif /*IRQF_TRIGGER_LOW*/ ++ ++ /* ++ * Initialize the DWC_otg core. ++ */ ++ dev_dbg(&_dev->dev, "Calling dwc_otg_core_init\n"); ++ dwc_otg_core_init(dwc_otg_device->core_if); ++ ++#ifndef DWC_HOST_ONLY ++ /* ++ * Initialize the PCD ++ */ ++ dev_dbg(&_dev->dev, "Calling pcd_init\n"); ++ retval = pcd_init(_dev); ++ if (retval != 0) { ++ DWC_ERROR("pcd_init failed\n"); ++ dwc_otg_device->pcd = NULL; ++ goto fail; ++ } ++#endif ++#ifndef DWC_DEVICE_ONLY ++ /* ++ * Initialize the HCD ++ */ ++ dev_dbg(&_dev->dev, "Calling hcd_init\n"); ++ retval = hcd_init(_dev); ++ if (retval != 0) { ++ DWC_ERROR("hcd_init failed\n"); ++ dwc_otg_device->hcd = NULL; ++ goto fail; ++ } ++#endif ++ /* Recover from drvdata having been overwritten by hcd_init() */ ++#ifdef LM_INTERFACE ++ lm_set_drvdata(_dev, dwc_otg_device); ++#elif defined(PLATFORM_INTERFACE) ++ platform_set_drvdata(_dev, dwc_otg_device); ++#elif defined(PCI_INTERFACE) ++ pci_set_drvdata(_dev, dwc_otg_device); ++ dwc_otg_device->os_dep.pcidev = _dev; ++#endif ++ ++ /* ++ * Enable the global interrupt after all the interrupt ++ * handlers are installed if there is no ADP support else ++ * perform initial actions required for Internal ADP logic. ++ */ ++ if (!dwc_otg_get_param_adp_enable(dwc_otg_device->core_if)) { ++ dev_dbg(&_dev->dev, "Calling enable_global_interrupts\n"); ++ dwc_otg_enable_global_interrupts(dwc_otg_device->core_if); ++ dev_dbg(&_dev->dev, "Done\n"); ++ } else ++ dwc_otg_adp_start(dwc_otg_device->core_if, ++ dwc_otg_is_host_mode(dwc_otg_device->core_if)); ++ ++ return 0; ++ ++fail: ++ dwc_otg_driver_remove(_dev); ++ return retval; ++} ++ ++/** ++ * This structure defines the methods to be called by a bus driver ++ * during the lifecycle of a device on that bus. Both drivers and ++ * devices are registered with a bus driver. The bus driver matches ++ * devices to drivers based on information in the device and driver ++ * structures. ++ * ++ * The probe function is called when the bus driver matches a device ++ * to this driver. The remove function is called when a device is ++ * unregistered with the bus driver. ++ */ ++#ifdef LM_INTERFACE ++static struct lm_driver dwc_otg_driver = { ++ .drv = {.name = (char *)dwc_driver_name,}, ++ .probe = dwc_otg_driver_probe, ++ .remove = dwc_otg_driver_remove, ++ // 'suspend' and 'resume' absent ++}; ++#elif defined(PCI_INTERFACE) ++static const struct pci_device_id pci_ids[] = { { ++ PCI_DEVICE(0x16c3, 0xabcd), ++ .driver_data = ++ (unsigned long)0xdeadbeef, ++ }, { /* end: all zeroes */ } ++}; ++ ++MODULE_DEVICE_TABLE(pci, pci_ids); ++ ++/* pci driver glue; this is a "new style" PCI driver module */ ++static struct pci_driver dwc_otg_driver = { ++ .name = "dwc_otg", ++ .id_table = pci_ids, ++ ++ .probe = dwc_otg_driver_probe, ++ .remove = dwc_otg_driver_remove, ++ ++ .driver = { ++ .name = (char *)dwc_driver_name, ++ }, ++}; ++#elif defined(PLATFORM_INTERFACE) ++static struct platform_device_id platform_ids[] = { ++ { ++ .name = "bcm2708_usb", ++ .driver_data = (kernel_ulong_t) 0xdeadbeef, ++ }, ++ { /* end: all zeroes */ } ++}; ++MODULE_DEVICE_TABLE(platform, platform_ids); ++ ++static const struct of_device_id dwc_otg_of_match_table[] = { ++ { .compatible = "brcm,bcm2708-usb", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, dwc_otg_of_match_table); ++ ++static struct platform_driver dwc_otg_driver = { ++ .driver = { ++ .name = (char *)dwc_driver_name, ++ .of_match_table = dwc_otg_of_match_table, ++ }, ++ .id_table = platform_ids, ++ ++ .probe = dwc_otg_driver_probe, ++ .remove = dwc_otg_driver_remove, ++ // no 'shutdown', 'suspend', 'resume', 'suspend_late' or 'resume_early' ++}; ++#endif ++ ++/** ++ * This function is called when the dwc_otg_driver is installed with the ++ * insmod command. It registers the dwc_otg_driver structure with the ++ * appropriate bus driver. This will cause the dwc_otg_driver_probe function ++ * to be called. In addition, the bus driver will automatically expose ++ * attributes defined for the device and driver in the special sysfs file ++ * system. ++ * ++ * @return ++ */ ++static int __init dwc_otg_driver_init(void) ++{ ++ int retval = 0; ++ int error; ++ struct device_driver *drv; ++ ++ if(fiq_fsm_enable && !fiq_enable) { ++ printk(KERN_WARNING "dwc_otg: fiq_fsm_enable was set without fiq_enable! Correcting.\n"); ++ fiq_enable = 1; ++ } ++ ++ printk(KERN_INFO "%s: version %s (%s bus)\n", dwc_driver_name, ++ DWC_DRIVER_VERSION, ++#ifdef LM_INTERFACE ++ "logicmodule"); ++ retval = lm_driver_register(&dwc_otg_driver); ++ drv = &dwc_otg_driver.drv; ++#elif defined(PCI_INTERFACE) ++ "pci"); ++ retval = pci_register_driver(&dwc_otg_driver); ++ drv = &dwc_otg_driver.driver; ++#elif defined(PLATFORM_INTERFACE) ++ "platform"); ++ retval = platform_driver_register(&dwc_otg_driver); ++ drv = &dwc_otg_driver.driver; ++#endif ++ if (retval < 0) { ++ printk(KERN_ERR "%s retval=%d\n", __func__, retval); ++ return retval; ++ } ++ printk(KERN_DEBUG "dwc_otg: FIQ %s\n", fiq_enable ? "enabled":"disabled"); ++ printk(KERN_DEBUG "dwc_otg: NAK holdoff %s\n", nak_holdoff ? "enabled":"disabled"); ++ printk(KERN_DEBUG "dwc_otg: FIQ split-transaction FSM %s\n", fiq_fsm_enable ? "enabled":"disabled"); ++ ++ error = driver_create_file(drv, &driver_attr_version); ++#ifdef DEBUG ++ error = driver_create_file(drv, &driver_attr_debuglevel); ++#endif ++ return retval; ++} ++ ++module_init(dwc_otg_driver_init); ++ ++/** ++ * This function is called when the driver is removed from the kernel ++ * with the rmmod command. The driver unregisters itself with its bus ++ * driver. ++ * ++ */ ++static void __exit dwc_otg_driver_cleanup(void) ++{ ++ printk(KERN_DEBUG "dwc_otg_driver_cleanup()\n"); ++ ++#ifdef LM_INTERFACE ++ driver_remove_file(&dwc_otg_driver.drv, &driver_attr_debuglevel); ++ driver_remove_file(&dwc_otg_driver.drv, &driver_attr_version); ++ lm_driver_unregister(&dwc_otg_driver); ++#elif defined(PCI_INTERFACE) ++ driver_remove_file(&dwc_otg_driver.driver, &driver_attr_debuglevel); ++ driver_remove_file(&dwc_otg_driver.driver, &driver_attr_version); ++ pci_unregister_driver(&dwc_otg_driver); ++#elif defined(PLATFORM_INTERFACE) ++ driver_remove_file(&dwc_otg_driver.driver, &driver_attr_debuglevel); ++ driver_remove_file(&dwc_otg_driver.driver, &driver_attr_version); ++ platform_driver_unregister(&dwc_otg_driver); ++#endif ++ ++ printk(KERN_INFO "%s module removed\n", dwc_driver_name); ++} ++ ++module_exit(dwc_otg_driver_cleanup); ++ ++MODULE_DESCRIPTION(DWC_DRIVER_DESC); ++MODULE_AUTHOR("Synopsys Inc."); ++MODULE_LICENSE("GPL"); ++ ++module_param_named(otg_cap, dwc_otg_module_params.otg_cap, int, 0444); ++MODULE_PARM_DESC(otg_cap, "OTG Capabilities 0=HNP&SRP 1=SRP Only 2=None"); ++module_param_named(opt, dwc_otg_module_params.opt, int, 0444); ++MODULE_PARM_DESC(opt, "OPT Mode"); ++module_param_named(dma_enable, dwc_otg_module_params.dma_enable, int, 0444); ++MODULE_PARM_DESC(dma_enable, "DMA Mode 0=Slave 1=DMA enabled"); ++ ++module_param_named(dma_desc_enable, dwc_otg_module_params.dma_desc_enable, int, ++ 0444); ++MODULE_PARM_DESC(dma_desc_enable, ++ "DMA Desc Mode 0=Address DMA 1=DMA Descriptor enabled"); ++ ++module_param_named(dma_burst_size, dwc_otg_module_params.dma_burst_size, int, ++ 0444); ++MODULE_PARM_DESC(dma_burst_size, ++ "DMA Burst Size 1, 4, 8, 16, 32, 64, 128, 256"); ++module_param_named(speed, dwc_otg_module_params.speed, int, 0444); ++MODULE_PARM_DESC(speed, "Speed 0=High Speed 1=Full Speed"); ++module_param_named(host_support_fs_ls_low_power, ++ dwc_otg_module_params.host_support_fs_ls_low_power, int, ++ 0444); ++MODULE_PARM_DESC(host_support_fs_ls_low_power, ++ "Support Low Power w/FS or LS 0=Support 1=Don't Support"); ++module_param_named(host_ls_low_power_phy_clk, ++ dwc_otg_module_params.host_ls_low_power_phy_clk, int, 0444); ++MODULE_PARM_DESC(host_ls_low_power_phy_clk, ++ "Low Speed Low Power Clock 0=48Mhz 1=6Mhz"); ++module_param_named(enable_dynamic_fifo, ++ dwc_otg_module_params.enable_dynamic_fifo, int, 0444); ++MODULE_PARM_DESC(enable_dynamic_fifo, "0=cC Setting 1=Allow Dynamic Sizing"); ++module_param_named(data_fifo_size, dwc_otg_module_params.data_fifo_size, int, ++ 0444); ++MODULE_PARM_DESC(data_fifo_size, ++ "Total number of words in the data FIFO memory 32-32768"); ++module_param_named(dev_rx_fifo_size, dwc_otg_module_params.dev_rx_fifo_size, ++ int, 0444); ++MODULE_PARM_DESC(dev_rx_fifo_size, "Number of words in the Rx FIFO 16-32768"); ++module_param_named(dev_nperio_tx_fifo_size, ++ dwc_otg_module_params.dev_nperio_tx_fifo_size, int, 0444); ++MODULE_PARM_DESC(dev_nperio_tx_fifo_size, ++ "Number of words in the non-periodic Tx FIFO 16-32768"); ++module_param_named(dev_perio_tx_fifo_size_1, ++ dwc_otg_module_params.dev_perio_tx_fifo_size[0], int, 0444); ++MODULE_PARM_DESC(dev_perio_tx_fifo_size_1, ++ "Number of words in the periodic Tx FIFO 4-768"); ++module_param_named(dev_perio_tx_fifo_size_2, ++ dwc_otg_module_params.dev_perio_tx_fifo_size[1], int, 0444); ++MODULE_PARM_DESC(dev_perio_tx_fifo_size_2, ++ "Number of words in the periodic Tx FIFO 4-768"); ++module_param_named(dev_perio_tx_fifo_size_3, ++ dwc_otg_module_params.dev_perio_tx_fifo_size[2], int, 0444); ++MODULE_PARM_DESC(dev_perio_tx_fifo_size_3, ++ "Number of words in the periodic Tx FIFO 4-768"); ++module_param_named(dev_perio_tx_fifo_size_4, ++ dwc_otg_module_params.dev_perio_tx_fifo_size[3], int, 0444); ++MODULE_PARM_DESC(dev_perio_tx_fifo_size_4, ++ "Number of words in the periodic Tx FIFO 4-768"); ++module_param_named(dev_perio_tx_fifo_size_5, ++ dwc_otg_module_params.dev_perio_tx_fifo_size[4], int, 0444); ++MODULE_PARM_DESC(dev_perio_tx_fifo_size_5, ++ "Number of words in the periodic Tx FIFO 4-768"); ++module_param_named(dev_perio_tx_fifo_size_6, ++ dwc_otg_module_params.dev_perio_tx_fifo_size[5], int, 0444); ++MODULE_PARM_DESC(dev_perio_tx_fifo_size_6, ++ "Number of words in the periodic Tx FIFO 4-768"); ++module_param_named(dev_perio_tx_fifo_size_7, ++ dwc_otg_module_params.dev_perio_tx_fifo_size[6], int, 0444); ++MODULE_PARM_DESC(dev_perio_tx_fifo_size_7, ++ "Number of words in the periodic Tx FIFO 4-768"); ++module_param_named(dev_perio_tx_fifo_size_8, ++ dwc_otg_module_params.dev_perio_tx_fifo_size[7], int, 0444); ++MODULE_PARM_DESC(dev_perio_tx_fifo_size_8, ++ "Number of words in the periodic Tx FIFO 4-768"); ++module_param_named(dev_perio_tx_fifo_size_9, ++ dwc_otg_module_params.dev_perio_tx_fifo_size[8], int, 0444); ++MODULE_PARM_DESC(dev_perio_tx_fifo_size_9, ++ "Number of words in the periodic Tx FIFO 4-768"); ++module_param_named(dev_perio_tx_fifo_size_10, ++ dwc_otg_module_params.dev_perio_tx_fifo_size[9], int, 0444); ++MODULE_PARM_DESC(dev_perio_tx_fifo_size_10, ++ "Number of words in the periodic Tx FIFO 4-768"); ++module_param_named(dev_perio_tx_fifo_size_11, ++ dwc_otg_module_params.dev_perio_tx_fifo_size[10], int, 0444); ++MODULE_PARM_DESC(dev_perio_tx_fifo_size_11, ++ "Number of words in the periodic Tx FIFO 4-768"); ++module_param_named(dev_perio_tx_fifo_size_12, ++ dwc_otg_module_params.dev_perio_tx_fifo_size[11], int, 0444); ++MODULE_PARM_DESC(dev_perio_tx_fifo_size_12, ++ "Number of words in the periodic Tx FIFO 4-768"); ++module_param_named(dev_perio_tx_fifo_size_13, ++ dwc_otg_module_params.dev_perio_tx_fifo_size[12], int, 0444); ++MODULE_PARM_DESC(dev_perio_tx_fifo_size_13, ++ "Number of words in the periodic Tx FIFO 4-768"); ++module_param_named(dev_perio_tx_fifo_size_14, ++ dwc_otg_module_params.dev_perio_tx_fifo_size[13], int, 0444); ++MODULE_PARM_DESC(dev_perio_tx_fifo_size_14, ++ "Number of words in the periodic Tx FIFO 4-768"); ++module_param_named(dev_perio_tx_fifo_size_15, ++ dwc_otg_module_params.dev_perio_tx_fifo_size[14], int, 0444); ++MODULE_PARM_DESC(dev_perio_tx_fifo_size_15, ++ "Number of words in the periodic Tx FIFO 4-768"); ++module_param_named(host_rx_fifo_size, dwc_otg_module_params.host_rx_fifo_size, ++ int, 0444); ++MODULE_PARM_DESC(host_rx_fifo_size, "Number of words in the Rx FIFO 16-32768"); ++module_param_named(host_nperio_tx_fifo_size, ++ dwc_otg_module_params.host_nperio_tx_fifo_size, int, 0444); ++MODULE_PARM_DESC(host_nperio_tx_fifo_size, ++ "Number of words in the non-periodic Tx FIFO 16-32768"); ++module_param_named(host_perio_tx_fifo_size, ++ dwc_otg_module_params.host_perio_tx_fifo_size, int, 0444); ++MODULE_PARM_DESC(host_perio_tx_fifo_size, ++ "Number of words in the host periodic Tx FIFO 16-32768"); ++module_param_named(max_transfer_size, dwc_otg_module_params.max_transfer_size, ++ int, 0444); ++/** @todo Set the max to 512K, modify checks */ ++MODULE_PARM_DESC(max_transfer_size, ++ "The maximum transfer size supported in bytes 2047-65535"); ++module_param_named(max_packet_count, dwc_otg_module_params.max_packet_count, ++ int, 0444); ++MODULE_PARM_DESC(max_packet_count, ++ "The maximum number of packets in a transfer 15-511"); ++module_param_named(host_channels, dwc_otg_module_params.host_channels, int, ++ 0444); ++MODULE_PARM_DESC(host_channels, ++ "The number of host channel registers to use 1-16"); ++module_param_named(dev_endpoints, dwc_otg_module_params.dev_endpoints, int, ++ 0444); ++MODULE_PARM_DESC(dev_endpoints, ++ "The number of endpoints in addition to EP0 available for device mode 1-15"); ++module_param_named(phy_type, dwc_otg_module_params.phy_type, int, 0444); ++MODULE_PARM_DESC(phy_type, "0=Reserved 1=UTMI+ 2=ULPI"); ++module_param_named(phy_utmi_width, dwc_otg_module_params.phy_utmi_width, int, ++ 0444); ++MODULE_PARM_DESC(phy_utmi_width, "Specifies the UTMI+ Data Width 8 or 16 bits"); ++module_param_named(phy_ulpi_ddr, dwc_otg_module_params.phy_ulpi_ddr, int, 0444); ++MODULE_PARM_DESC(phy_ulpi_ddr, ++ "ULPI at double or single data rate 0=Single 1=Double"); ++module_param_named(phy_ulpi_ext_vbus, dwc_otg_module_params.phy_ulpi_ext_vbus, ++ int, 0444); ++MODULE_PARM_DESC(phy_ulpi_ext_vbus, ++ "ULPI PHY using internal or external vbus 0=Internal"); ++module_param_named(i2c_enable, dwc_otg_module_params.i2c_enable, int, 0444); ++MODULE_PARM_DESC(i2c_enable, "FS PHY Interface"); ++module_param_named(ulpi_fs_ls, dwc_otg_module_params.ulpi_fs_ls, int, 0444); ++MODULE_PARM_DESC(ulpi_fs_ls, "ULPI PHY FS/LS mode only"); ++module_param_named(ts_dline, dwc_otg_module_params.ts_dline, int, 0444); ++MODULE_PARM_DESC(ts_dline, "Term select Dline pulsing for all PHYs"); ++module_param_named(debug, g_dbg_lvl, int, 0444); ++MODULE_PARM_DESC(debug, ""); ++ ++module_param_named(en_multiple_tx_fifo, ++ dwc_otg_module_params.en_multiple_tx_fifo, int, 0444); ++MODULE_PARM_DESC(en_multiple_tx_fifo, ++ "Dedicated Non Periodic Tx FIFOs 0=disabled 1=enabled"); ++module_param_named(dev_tx_fifo_size_1, ++ dwc_otg_module_params.dev_tx_fifo_size[0], int, 0444); ++MODULE_PARM_DESC(dev_tx_fifo_size_1, "Number of words in the Tx FIFO 4-768"); ++module_param_named(dev_tx_fifo_size_2, ++ dwc_otg_module_params.dev_tx_fifo_size[1], int, 0444); ++MODULE_PARM_DESC(dev_tx_fifo_size_2, "Number of words in the Tx FIFO 4-768"); ++module_param_named(dev_tx_fifo_size_3, ++ dwc_otg_module_params.dev_tx_fifo_size[2], int, 0444); ++MODULE_PARM_DESC(dev_tx_fifo_size_3, "Number of words in the Tx FIFO 4-768"); ++module_param_named(dev_tx_fifo_size_4, ++ dwc_otg_module_params.dev_tx_fifo_size[3], int, 0444); ++MODULE_PARM_DESC(dev_tx_fifo_size_4, "Number of words in the Tx FIFO 4-768"); ++module_param_named(dev_tx_fifo_size_5, ++ dwc_otg_module_params.dev_tx_fifo_size[4], int, 0444); ++MODULE_PARM_DESC(dev_tx_fifo_size_5, "Number of words in the Tx FIFO 4-768"); ++module_param_named(dev_tx_fifo_size_6, ++ dwc_otg_module_params.dev_tx_fifo_size[5], int, 0444); ++MODULE_PARM_DESC(dev_tx_fifo_size_6, "Number of words in the Tx FIFO 4-768"); ++module_param_named(dev_tx_fifo_size_7, ++ dwc_otg_module_params.dev_tx_fifo_size[6], int, 0444); ++MODULE_PARM_DESC(dev_tx_fifo_size_7, "Number of words in the Tx FIFO 4-768"); ++module_param_named(dev_tx_fifo_size_8, ++ dwc_otg_module_params.dev_tx_fifo_size[7], int, 0444); ++MODULE_PARM_DESC(dev_tx_fifo_size_8, "Number of words in the Tx FIFO 4-768"); ++module_param_named(dev_tx_fifo_size_9, ++ dwc_otg_module_params.dev_tx_fifo_size[8], int, 0444); ++MODULE_PARM_DESC(dev_tx_fifo_size_9, "Number of words in the Tx FIFO 4-768"); ++module_param_named(dev_tx_fifo_size_10, ++ dwc_otg_module_params.dev_tx_fifo_size[9], int, 0444); ++MODULE_PARM_DESC(dev_tx_fifo_size_10, "Number of words in the Tx FIFO 4-768"); ++module_param_named(dev_tx_fifo_size_11, ++ dwc_otg_module_params.dev_tx_fifo_size[10], int, 0444); ++MODULE_PARM_DESC(dev_tx_fifo_size_11, "Number of words in the Tx FIFO 4-768"); ++module_param_named(dev_tx_fifo_size_12, ++ dwc_otg_module_params.dev_tx_fifo_size[11], int, 0444); ++MODULE_PARM_DESC(dev_tx_fifo_size_12, "Number of words in the Tx FIFO 4-768"); ++module_param_named(dev_tx_fifo_size_13, ++ dwc_otg_module_params.dev_tx_fifo_size[12], int, 0444); ++MODULE_PARM_DESC(dev_tx_fifo_size_13, "Number of words in the Tx FIFO 4-768"); ++module_param_named(dev_tx_fifo_size_14, ++ dwc_otg_module_params.dev_tx_fifo_size[13], int, 0444); ++MODULE_PARM_DESC(dev_tx_fifo_size_14, "Number of words in the Tx FIFO 4-768"); ++module_param_named(dev_tx_fifo_size_15, ++ dwc_otg_module_params.dev_tx_fifo_size[14], int, 0444); ++MODULE_PARM_DESC(dev_tx_fifo_size_15, "Number of words in the Tx FIFO 4-768"); ++ ++module_param_named(thr_ctl, dwc_otg_module_params.thr_ctl, int, 0444); ++MODULE_PARM_DESC(thr_ctl, ++ "Thresholding enable flag bit 0 - non ISO Tx thr., 1 - ISO Tx thr., 2 - Rx thr.- bit 0=disabled 1=enabled"); ++module_param_named(tx_thr_length, dwc_otg_module_params.tx_thr_length, int, ++ 0444); ++MODULE_PARM_DESC(tx_thr_length, "Tx Threshold length in 32 bit DWORDs"); ++module_param_named(rx_thr_length, dwc_otg_module_params.rx_thr_length, int, ++ 0444); ++MODULE_PARM_DESC(rx_thr_length, "Rx Threshold length in 32 bit DWORDs"); ++ ++module_param_named(pti_enable, dwc_otg_module_params.pti_enable, int, 0444); ++module_param_named(mpi_enable, dwc_otg_module_params.mpi_enable, int, 0444); ++module_param_named(lpm_enable, dwc_otg_module_params.lpm_enable, int, 0444); ++MODULE_PARM_DESC(lpm_enable, "LPM Enable 0=LPM Disabled 1=LPM Enabled"); ++module_param_named(ic_usb_cap, dwc_otg_module_params.ic_usb_cap, int, 0444); ++MODULE_PARM_DESC(ic_usb_cap, ++ "IC_USB Capability 0=IC_USB Disabled 1=IC_USB Enabled"); ++module_param_named(ahb_thr_ratio, dwc_otg_module_params.ahb_thr_ratio, int, ++ 0444); ++MODULE_PARM_DESC(ahb_thr_ratio, "AHB Threshold Ratio"); ++module_param_named(power_down, dwc_otg_module_params.power_down, int, 0444); ++MODULE_PARM_DESC(power_down, "Power Down Mode"); ++module_param_named(reload_ctl, dwc_otg_module_params.reload_ctl, int, 0444); ++MODULE_PARM_DESC(reload_ctl, "HFIR Reload Control"); ++module_param_named(dev_out_nak, dwc_otg_module_params.dev_out_nak, int, 0444); ++MODULE_PARM_DESC(dev_out_nak, "Enable Device OUT NAK"); ++module_param_named(cont_on_bna, dwc_otg_module_params.cont_on_bna, int, 0444); ++MODULE_PARM_DESC(cont_on_bna, "Enable Enable Continue on BNA"); ++module_param_named(ahb_single, dwc_otg_module_params.ahb_single, int, 0444); ++MODULE_PARM_DESC(ahb_single, "Enable AHB Single Support"); ++module_param_named(adp_enable, dwc_otg_module_params.adp_enable, int, 0444); ++MODULE_PARM_DESC(adp_enable, "ADP Enable 0=ADP Disabled 1=ADP Enabled"); ++module_param_named(otg_ver, dwc_otg_module_params.otg_ver, int, 0444); ++MODULE_PARM_DESC(otg_ver, "OTG revision supported 0=OTG 1.3 1=OTG 2.0"); ++module_param(microframe_schedule, bool, 0444); ++MODULE_PARM_DESC(microframe_schedule, "Enable the microframe scheduler"); ++ ++module_param(fiq_enable, bool, 0444); ++MODULE_PARM_DESC(fiq_enable, "Enable the FIQ"); ++module_param(nak_holdoff, ushort, 0644); ++MODULE_PARM_DESC(nak_holdoff, "Throttle duration for bulk split-transaction endpoints on a NAK. Default 8"); ++module_param(fiq_fsm_enable, bool, 0444); ++MODULE_PARM_DESC(fiq_fsm_enable, "Enable the FIQ to perform split transactions as defined by fiq_fsm_mask"); ++module_param(fiq_fsm_mask, ushort, 0444); ++MODULE_PARM_DESC(fiq_fsm_mask, "Bitmask of transactions to perform in the FIQ.\n" ++ "Bit 0 : Non-periodic split transactions\n" ++ "Bit 1 : Periodic split transactions\n" ++ "Bit 2 : High-speed multi-transfer isochronous\n" ++ "All other bits should be set 0."); ++ ++ ++/** @page "Module Parameters" ++ * ++ * The following parameters may be specified when starting the module. ++ * These parameters define how the DWC_otg controller should be ++ * configured. Parameter values are passed to the CIL initialization ++ * function dwc_otg_cil_init ++ * ++ * Example: <code>modprobe dwc_otg speed=1 otg_cap=1</code> ++ * ++ ++ <table> ++ <tr><td>Parameter Name</td><td>Meaning</td></tr> ++ ++ <tr> ++ <td>otg_cap</td> ++ <td>Specifies the OTG capabilities. The driver will automatically detect the ++ value for this parameter if none is specified. ++ - 0: HNP and SRP capable (default, if available) ++ - 1: SRP Only capable ++ - 2: No HNP/SRP capable ++ </td></tr> ++ ++ <tr> ++ <td>dma_enable</td> ++ <td>Specifies whether to use slave or DMA mode for accessing the data FIFOs. ++ The driver will automatically detect the value for this parameter if none is ++ specified. ++ - 0: Slave ++ - 1: DMA (default, if available) ++ </td></tr> ++ ++ <tr> ++ <td>dma_burst_size</td> ++ <td>The DMA Burst size (applicable only for External DMA Mode). ++ - Values: 1, 4, 8 16, 32, 64, 128, 256 (default 32) ++ </td></tr> ++ ++ <tr> ++ <td>speed</td> ++ <td>Specifies the maximum speed of operation in host and device mode. The ++ actual speed depends on the speed of the attached device and the value of ++ phy_type. ++ - 0: High Speed (default) ++ - 1: Full Speed ++ </td></tr> ++ ++ <tr> ++ <td>host_support_fs_ls_low_power</td> ++ <td>Specifies whether low power mode is supported when attached to a Full ++ Speed or Low Speed device in host mode. ++ - 0: Don't support low power mode (default) ++ - 1: Support low power mode ++ </td></tr> ++ ++ <tr> ++ <td>host_ls_low_power_phy_clk</td> ++ <td>Specifies the PHY clock rate in low power mode when connected to a Low ++ Speed device in host mode. This parameter is applicable only if ++ HOST_SUPPORT_FS_LS_LOW_POWER is enabled. ++ - 0: 48 MHz (default) ++ - 1: 6 MHz ++ </td></tr> ++ ++ <tr> ++ <td>enable_dynamic_fifo</td> ++ <td> Specifies whether FIFOs may be resized by the driver software. ++ - 0: Use cC FIFO size parameters ++ - 1: Allow dynamic FIFO sizing (default) ++ </td></tr> ++ ++ <tr> ++ <td>data_fifo_size</td> ++ <td>Total number of 4-byte words in the data FIFO memory. This memory ++ includes the Rx FIFO, non-periodic Tx FIFO, and periodic Tx FIFOs. ++ - Values: 32 to 32768 (default 8192) ++ ++ Note: The total FIFO memory depth in the FPGA configuration is 8192. ++ </td></tr> ++ ++ <tr> ++ <td>dev_rx_fifo_size</td> ++ <td>Number of 4-byte words in the Rx FIFO in device mode when dynamic ++ FIFO sizing is enabled. ++ - Values: 16 to 32768 (default 1064) ++ </td></tr> ++ ++ <tr> ++ <td>dev_nperio_tx_fifo_size</td> ++ <td>Number of 4-byte words in the non-periodic Tx FIFO in device mode when ++ dynamic FIFO sizing is enabled. ++ - Values: 16 to 32768 (default 1024) ++ </td></tr> ++ ++ <tr> ++ <td>dev_perio_tx_fifo_size_n (n = 1 to 15)</td> ++ <td>Number of 4-byte words in each of the periodic Tx FIFOs in device mode ++ when dynamic FIFO sizing is enabled. ++ - Values: 4 to 768 (default 256) ++ </td></tr> ++ ++ <tr> ++ <td>host_rx_fifo_size</td> ++ <td>Number of 4-byte words in the Rx FIFO in host mode when dynamic FIFO ++ sizing is enabled. ++ - Values: 16 to 32768 (default 1024) ++ </td></tr> ++ ++ <tr> ++ <td>host_nperio_tx_fifo_size</td> ++ <td>Number of 4-byte words in the non-periodic Tx FIFO in host mode when ++ dynamic FIFO sizing is enabled in the core. ++ - Values: 16 to 32768 (default 1024) ++ </td></tr> ++ ++ <tr> ++ <td>host_perio_tx_fifo_size</td> ++ <td>Number of 4-byte words in the host periodic Tx FIFO when dynamic FIFO ++ sizing is enabled. ++ - Values: 16 to 32768 (default 1024) ++ </td></tr> ++ ++ <tr> ++ <td>max_transfer_size</td> ++ <td>The maximum transfer size supported in bytes. ++ - Values: 2047 to 65,535 (default 65,535) ++ </td></tr> ++ ++ <tr> ++ <td>max_packet_count</td> ++ <td>The maximum number of packets in a transfer. ++ - Values: 15 to 511 (default 511) ++ </td></tr> ++ ++ <tr> ++ <td>host_channels</td> ++ <td>The number of host channel registers to use. ++ - Values: 1 to 16 (default 12) ++ ++ Note: The FPGA configuration supports a maximum of 12 host channels. ++ </td></tr> ++ ++ <tr> ++ <td>dev_endpoints</td> ++ <td>The number of endpoints in addition to EP0 available for device mode ++ operations. ++ - Values: 1 to 15 (default 6 IN and OUT) ++ ++ Note: The FPGA configuration supports a maximum of 6 IN and OUT endpoints in ++ addition to EP0. ++ </td></tr> ++ ++ <tr> ++ <td>phy_type</td> ++ <td>Specifies the type of PHY interface to use. By default, the driver will ++ automatically detect the phy_type. ++ - 0: Full Speed ++ - 1: UTMI+ (default, if available) ++ - 2: ULPI ++ </td></tr> ++ ++ <tr> ++ <td>phy_utmi_width</td> ++ <td>Specifies the UTMI+ Data Width. This parameter is applicable for a ++ phy_type of UTMI+. Also, this parameter is applicable only if the ++ OTG_HSPHY_WIDTH cC parameter was set to "8 and 16 bits", meaning that the ++ core has been configured to work at either data path width. ++ - Values: 8 or 16 bits (default 16) ++ </td></tr> ++ ++ <tr> ++ <td>phy_ulpi_ddr</td> ++ <td>Specifies whether the ULPI operates at double or single data rate. This ++ parameter is only applicable if phy_type is ULPI. ++ - 0: single data rate ULPI interface with 8 bit wide data bus (default) ++ - 1: double data rate ULPI interface with 4 bit wide data bus ++ </td></tr> ++ ++ <tr> ++ <td>i2c_enable</td> ++ <td>Specifies whether to use the I2C interface for full speed PHY. This ++ parameter is only applicable if PHY_TYPE is FS. ++ - 0: Disabled (default) ++ - 1: Enabled ++ </td></tr> ++ ++ <tr> ++ <td>ulpi_fs_ls</td> ++ <td>Specifies whether to use ULPI FS/LS mode only. ++ - 0: Disabled (default) ++ - 1: Enabled ++ </td></tr> ++ ++ <tr> ++ <td>ts_dline</td> ++ <td>Specifies whether term select D-Line pulsing for all PHYs is enabled. ++ - 0: Disabled (default) ++ - 1: Enabled ++ </td></tr> ++ ++ <tr> ++ <td>en_multiple_tx_fifo</td> ++ <td>Specifies whether dedicatedto tx fifos are enabled for non periodic IN EPs. ++ The driver will automatically detect the value for this parameter if none is ++ specified. ++ - 0: Disabled ++ - 1: Enabled (default, if available) ++ </td></tr> ++ ++ <tr> ++ <td>dev_tx_fifo_size_n (n = 1 to 15)</td> ++ <td>Number of 4-byte words in each of the Tx FIFOs in device mode ++ when dynamic FIFO sizing is enabled. ++ - Values: 4 to 768 (default 256) ++ </td></tr> ++ ++ <tr> ++ <td>tx_thr_length</td> ++ <td>Transmit Threshold length in 32 bit double words ++ - Values: 8 to 128 (default 64) ++ </td></tr> ++ ++ <tr> ++ <td>rx_thr_length</td> ++ <td>Receive Threshold length in 32 bit double words ++ - Values: 8 to 128 (default 64) ++ </td></tr> ++ ++<tr> ++ <td>thr_ctl</td> ++ <td>Specifies whether to enable Thresholding for Device mode. Bits 0, 1, 2 of ++ this parmater specifies if thresholding is enabled for non-Iso Tx, Iso Tx and ++ Rx transfers accordingly. ++ The driver will automatically detect the value for this parameter if none is ++ specified. ++ - Values: 0 to 7 (default 0) ++ Bit values indicate: ++ - 0: Thresholding disabled ++ - 1: Thresholding enabled ++ </td></tr> ++ ++<tr> ++ <td>dma_desc_enable</td> ++ <td>Specifies whether to enable Descriptor DMA mode. ++ The driver will automatically detect the value for this parameter if none is ++ specified. ++ - 0: Descriptor DMA disabled ++ - 1: Descriptor DMA (default, if available) ++ </td></tr> ++ ++<tr> ++ <td>mpi_enable</td> ++ <td>Specifies whether to enable MPI enhancement mode. ++ The driver will automatically detect the value for this parameter if none is ++ specified. ++ - 0: MPI disabled (default) ++ - 1: MPI enable ++ </td></tr> ++ ++<tr> ++ <td>pti_enable</td> ++ <td>Specifies whether to enable PTI enhancement support. ++ The driver will automatically detect the value for this parameter if none is ++ specified. ++ - 0: PTI disabled (default) ++ - 1: PTI enable ++ </td></tr> ++ ++<tr> ++ <td>lpm_enable</td> ++ <td>Specifies whether to enable LPM support. ++ The driver will automatically detect the value for this parameter if none is ++ specified. ++ - 0: LPM disabled ++ - 1: LPM enable (default, if available) ++ </td></tr> ++ ++<tr> ++ <td>ic_usb_cap</td> ++ <td>Specifies whether to enable IC_USB capability. ++ The driver will automatically detect the value for this parameter if none is ++ specified. ++ - 0: IC_USB disabled (default, if available) ++ - 1: IC_USB enable ++ </td></tr> ++ ++<tr> ++ <td>ahb_thr_ratio</td> ++ <td>Specifies AHB Threshold ratio. ++ - Values: 0 to 3 (default 0) ++ </td></tr> ++ ++<tr> ++ <td>power_down</td> ++ <td>Specifies Power Down(Hibernation) Mode. ++ The driver will automatically detect the value for this parameter if none is ++ specified. ++ - 0: Power Down disabled (default) ++ - 2: Power Down enabled ++ </td></tr> ++ ++ <tr> ++ <td>reload_ctl</td> ++ <td>Specifies whether dynamic reloading of the HFIR register is allowed during ++ run time. The driver will automatically detect the value for this parameter if ++ none is specified. In case the HFIR value is reloaded when HFIR.RldCtrl == 1'b0 ++ the core might misbehave. ++ - 0: Reload Control disabled (default) ++ - 1: Reload Control enabled ++ </td></tr> ++ ++ <tr> ++ <td>dev_out_nak</td> ++ <td>Specifies whether Device OUT NAK enhancement enabled or no. ++ The driver will automatically detect the value for this parameter if ++ none is specified. This parameter is valid only when OTG_EN_DESC_DMA == 1b1. ++ - 0: The core does not set NAK after Bulk OUT transfer complete (default) ++ - 1: The core sets NAK after Bulk OUT transfer complete ++ </td></tr> ++ ++ <tr> ++ <td>cont_on_bna</td> ++ <td>Specifies whether Enable Continue on BNA enabled or no. ++ After receiving BNA interrupt the core disables the endpoint,when the ++ endpoint is re-enabled by the application the ++ - 0: Core starts processing from the DOEPDMA descriptor (default) ++ - 1: Core starts processing from the descriptor which received the BNA. ++ This parameter is valid only when OTG_EN_DESC_DMA == 1b1. ++ </td></tr> ++ ++ <tr> ++ <td>ahb_single</td> ++ <td>This bit when programmed supports SINGLE transfers for remainder data ++ in a transfer for DMA mode of operation. ++ - 0: The remainder data will be sent using INCR burst size (default) ++ - 1: The remainder data will be sent using SINGLE burst size. ++ </td></tr> ++ ++<tr> ++ <td>adp_enable</td> ++ <td>Specifies whether ADP feature is enabled. ++ The driver will automatically detect the value for this parameter if none is ++ specified. ++ - 0: ADP feature disabled (default) ++ - 1: ADP feature enabled ++ </td></tr> ++ ++ <tr> ++ <td>otg_ver</td> ++ <td>Specifies whether OTG is performing as USB OTG Revision 2.0 or Revision 1.3 ++ USB OTG device. ++ - 0: OTG 2.0 support disabled (default) ++ - 1: OTG 2.0 support enabled ++ </td></tr> ++ ++*/ +diff --git a/drivers/usb/host/dwc_otg/dwc_otg_driver.h b/drivers/usb/host/dwc_otg/dwc_otg_driver.h +new file mode 100644 +index 0000000..6a8be63 +--- /dev/null ++++ b/drivers/usb/host/dwc_otg/dwc_otg_driver.h +@@ -0,0 +1,86 @@ ++/* ========================================================================== ++ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_driver.h $ ++ * $Revision: #19 $ ++ * $Date: 2010/11/15 $ ++ * $Change: 1627671 $ ++ * ++ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, ++ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless ++ * otherwise expressly agreed to in writing between Synopsys and you. ++ * ++ * The Software IS NOT an item of Licensed Software or Licensed Product under ++ * any End User Software License Agreement or Agreement for Licensed Product ++ * with Synopsys or any supplement thereto. You are permitted to use and ++ * redistribute this Software in source and binary forms, with or without ++ * modification, provided that redistributions of source code must retain this ++ * notice. You may not view, use, disclose, copy or distribute this file or ++ * any information contained herein except pursuant to this license grant from ++ * Synopsys. If you do not agree with this notice, including the disclaimer ++ * below, then you are not authorized to use the Software. ++ * ++ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS ++ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS 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. ++ * ========================================================================== */ ++ ++#ifndef __DWC_OTG_DRIVER_H__ ++#define __DWC_OTG_DRIVER_H__ ++ ++/** @file ++ * This file contains the interface to the Linux driver. ++ */ ++#include "dwc_otg_os_dep.h" ++#include "dwc_otg_core_if.h" ++ ++/* Type declarations */ ++struct dwc_otg_pcd; ++struct dwc_otg_hcd; ++ ++/** ++ * This structure is a wrapper that encapsulates the driver components used to ++ * manage a single DWC_otg controller. ++ */ ++typedef struct dwc_otg_device { ++ /** Structure containing OS-dependent stuff. KEEP THIS STRUCT AT THE ++ * VERY BEGINNING OF THE DEVICE STRUCT. OSes such as FreeBSD and NetBSD ++ * require this. */ ++ struct os_dependent os_dep; ++ ++ /** Pointer to the core interface structure. */ ++ dwc_otg_core_if_t *core_if; ++ ++ /** Pointer to the PCD structure. */ ++ struct dwc_otg_pcd *pcd; ++ ++ /** Pointer to the HCD structure. */ ++ struct dwc_otg_hcd *hcd; ++ ++ /** Flag to indicate whether the common IRQ handler is installed. */ ++ uint8_t common_irq_installed; ++ ++} dwc_otg_device_t; ++ ++/*We must clear S3C24XX_EINTPEND external interrupt register ++ * because after clearing in this register trigerred IRQ from ++ * H/W core in kernel interrupt can be occured again before OTG ++ * handlers clear all IRQ sources of Core registers because of ++ * timing latencies and Low Level IRQ Type. ++ */ ++#ifdef CONFIG_MACH_IPMATE ++#define S3C2410X_CLEAR_EINTPEND() \ ++do { \ ++ __raw_writel(1UL << 11,S3C24XX_EINTPEND); \ ++} while (0) ++#else ++#define S3C2410X_CLEAR_EINTPEND() do { } while (0) ++#endif ++ ++#endif +diff --git a/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c b/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c +new file mode 100644 +index 0000000..85d82f3 +--- /dev/null ++++ b/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c +@@ -0,0 +1,1355 @@ ++/* ++ * dwc_otg_fiq_fsm.c - The finite state machine FIQ ++ * ++ * Copyright (c) 2013 Raspberry Pi Foundation ++ * ++ * Author: Jonathan Bell <jonathan@raspberrypi.org> ++ * All rights reserved. ++ * ++ * Redistribution and use in source and binary forms, with or without ++ * modification, are permitted provided that the following conditions are met: ++ * * Redistributions of source code must retain the above copyright ++ * notice, this list of conditions and the following disclaimer. ++ * * 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. ++ * * Neither the name of Raspberry Pi nor the ++ * names of its contributors may be used to endorse or promote products ++ * derived from this software without specific prior written permission. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 <COPYRIGHT HOLDER> 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. ++ * ++ * This FIQ implements functionality that performs split transactions on ++ * the dwc_otg hardware without any outside intervention. A split transaction ++ * is "queued" by nominating a specific host channel to perform the entirety ++ * of a split transaction. This FIQ will then perform the microframe-precise ++ * scheduling required in each phase of the transaction until completion. ++ * ++ * The FIQ functionality is glued into the Synopsys driver via the entry point ++ * in the FSM enqueue function, and at the exit point in handling a HC interrupt ++ * for a FSM-enabled channel. ++ * ++ * NB: Large parts of this implementation have architecture-specific code. ++ * For porting this functionality to other ARM machines, the minimum is required: ++ * - An interrupt controller allowing the top-level dwc USB interrupt to be routed ++ * to the FIQ ++ * - A method of forcing a software generated interrupt from FIQ mode that then ++ * triggers an IRQ entry (with the dwc USB handler called by this IRQ number) ++ * - Guaranteed interrupt routing such that both the FIQ and SGI occur on the same ++ * processor core - there is no locking between the FIQ and IRQ (aside from ++ * local_fiq_disable) ++ * ++ */ ++ ++#include "dwc_otg_fiq_fsm.h" ++ ++ ++char buffer[1000*16]; ++int wptr; ++void notrace _fiq_print(enum fiq_debug_level dbg_lvl, volatile struct fiq_state *state, char *fmt, ...) ++{ ++ enum fiq_debug_level dbg_lvl_req = FIQDBG_ERR; ++ va_list args; ++ char text[17]; ++ hfnum_data_t hfnum = { .d32 = FIQ_READ(state->dwc_regs_base + 0x408) }; ++ ++ if((dbg_lvl & dbg_lvl_req) || dbg_lvl == FIQDBG_ERR) ++ { ++ snprintf(text, 9, " %4d:%1u ", hfnum.b.frnum/8, hfnum.b.frnum & 7); ++ va_start(args, fmt); ++ vsnprintf(text+8, 9, fmt, args); ++ va_end(args); ++ ++ memcpy(buffer + wptr, text, 16); ++ wptr = (wptr + 16) % sizeof(buffer); ++ } ++} ++ ++/** ++ * fiq_fsm_spin_lock() - ARMv6+ bare bones spinlock ++ * Must be called with local interrupts and FIQ disabled. ++ */ ++#if defined(CONFIG_ARCH_BCM2709) && defined(CONFIG_SMP) ++inline void fiq_fsm_spin_lock(fiq_lock_t *lock) ++{ ++ unsigned long tmp; ++ uint32_t newval; ++ fiq_lock_t lockval; ++ smp_mb__before_spinlock(); ++ /* Nested locking, yay. If we are on the same CPU as the fiq, then the disable ++ * will be sufficient. If we are on a different CPU, then the lock protects us. */ ++ prefetchw(&lock->slock); ++ asm volatile ( ++ "1: ldrex %0, [%3]\n" ++ " add %1, %0, %4\n" ++ " strex %2, %1, [%3]\n" ++ " teq %2, #0\n" ++ " bne 1b" ++ : "=&r" (lockval), "=&r" (newval), "=&r" (tmp) ++ : "r" (&lock->slock), "I" (1 << 16) ++ : "cc"); ++ ++ while (lockval.tickets.next != lockval.tickets.owner) { ++ wfe(); ++ lockval.tickets.owner = ACCESS_ONCE(lock->tickets.owner); ++ } ++ smp_mb(); ++} ++#else ++inline void fiq_fsm_spin_lock(fiq_lock_t *lock) { } ++#endif ++ ++/** ++ * fiq_fsm_spin_unlock() - ARMv6+ bare bones spinunlock ++ */ ++#if defined(CONFIG_ARCH_BCM2709) && defined(CONFIG_SMP) ++inline void fiq_fsm_spin_unlock(fiq_lock_t *lock) ++{ ++ smp_mb(); ++ lock->tickets.owner++; ++ dsb_sev(); ++} ++#else ++inline void fiq_fsm_spin_unlock(fiq_lock_t *lock) { } ++#endif ++ ++/** ++ * fiq_fsm_restart_channel() - Poke channel enable bit for a split transaction ++ * @channel: channel to re-enable ++ */ ++static void fiq_fsm_restart_channel(struct fiq_state *st, int n, int force) ++{ ++ hcchar_data_t hcchar = { .d32 = FIQ_READ(st->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCCHAR) }; ++ ++ hcchar.b.chen = 0; ++ if (st->channel[n].hcchar_copy.b.eptype & 0x1) { ++ hfnum_data_t hfnum = { .d32 = FIQ_READ(st->dwc_regs_base + HFNUM) }; ++ /* Hardware bug workaround: update the ssplit index */ ++ if (st->channel[n].hcsplt_copy.b.spltena) ++ st->channel[n].expected_uframe = (hfnum.b.frnum + 1) & 0x3FFF; ++ ++ hcchar.b.oddfrm = (hfnum.b.frnum & 0x1) ? 0 : 1; ++ } ++ ++ FIQ_WRITE(st->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCCHAR, hcchar.d32); ++ hcchar.d32 = FIQ_READ(st->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCCHAR); ++ hcchar.b.chen = 1; ++ ++ FIQ_WRITE(st->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCCHAR, hcchar.d32); ++ fiq_print(FIQDBG_INT, st, "HCGO %01d %01d", n, force); ++} ++ ++/** ++ * fiq_fsm_setup_csplit() - Prepare a host channel for a CSplit transaction stage ++ * @st: Pointer to the channel's state ++ * @n : channel number ++ * ++ * Change host channel registers to perform a complete-split transaction. Being mindful of the ++ * endpoint direction, set control regs up correctly. ++ */ ++static void notrace fiq_fsm_setup_csplit(struct fiq_state *st, int n) ++{ ++ hcsplt_data_t hcsplt = { .d32 = FIQ_READ(st->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCSPLT) }; ++ hctsiz_data_t hctsiz = { .d32 = FIQ_READ(st->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCTSIZ) }; ++ ++ hcsplt.b.compsplt = 1; ++ if (st->channel[n].hcchar_copy.b.epdir == 1) { ++ // If IN, the CSPLIT result contains the data or a hub handshake. hctsiz = maxpacket. ++ hctsiz.b.xfersize = st->channel[n].hctsiz_copy.b.xfersize; ++ } else { ++ // If OUT, the CSPLIT result contains handshake only. ++ hctsiz.b.xfersize = 0; ++ } ++ FIQ_WRITE(st->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCSPLT, hcsplt.d32); ++ FIQ_WRITE(st->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCTSIZ, hctsiz.d32); ++ mb(); ++} ++ ++static inline int notrace fiq_get_xfer_len(struct fiq_state *st, int n) ++{ ++ /* The xfersize register is a bit wonky. For IN transfers, it decrements by the packet size. */ ++ hctsiz_data_t hctsiz = { .d32 = FIQ_READ(st->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCTSIZ) }; ++ ++ if (st->channel[n].hcchar_copy.b.epdir == 0) { ++ return st->channel[n].hctsiz_copy.b.xfersize; ++ } else { ++ return st->channel[n].hctsiz_copy.b.xfersize - hctsiz.b.xfersize; ++ } ++ ++} ++ ++ ++/** ++ * fiq_increment_dma_buf() - update DMA address for bounce buffers after a CSPLIT ++ * ++ * Of use only for IN periodic transfers. ++ */ ++static int notrace fiq_increment_dma_buf(struct fiq_state *st, int num_channels, int n) ++{ ++ hcdma_data_t hcdma; ++ int i = st->channel[n].dma_info.index; ++ int len; ++ struct fiq_dma_blob *blob = (struct fiq_dma_blob *) st->dma_base; ++ ++ len = fiq_get_xfer_len(st, n); ++ fiq_print(FIQDBG_INT, st, "LEN: %03d", len); ++ st->channel[n].dma_info.slot_len[i] = len; ++ i++; ++ if (i > 6) ++ BUG(); ++ ++ hcdma.d32 = (dma_addr_t) &blob->channel[n].index[i].buf[0]; ++ FIQ_WRITE(st->dwc_regs_base + HC_DMA + (HC_OFFSET * n), hcdma.d32); ++ st->channel[n].dma_info.index = i; ++ return 0; ++} ++ ++/** ++ * fiq_reload_hctsiz() - for IN transactions, reset HCTSIZ ++ */ ++static void notrace fiq_fsm_reload_hctsiz(struct fiq_state *st, int n) ++{ ++ hctsiz_data_t hctsiz = { .d32 = FIQ_READ(st->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCTSIZ) }; ++ hctsiz.b.xfersize = st->channel[n].hctsiz_copy.b.xfersize; ++ hctsiz.b.pktcnt = 1; ++ FIQ_WRITE(st->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCTSIZ, hctsiz.d32); ++} ++ ++/** ++ * fiq_iso_out_advance() - update DMA address and split position bits ++ * for isochronous OUT transactions. ++ * ++ * Returns 1 if this is the last packet queued, 0 otherwise. Split-ALL and ++ * Split-BEGIN states are not handled - this is done when the transaction was queued. ++ * ++ * This function must only be called from the FIQ_ISO_OUT_ACTIVE state. ++ */ ++static int notrace fiq_iso_out_advance(struct fiq_state *st, int num_channels, int n) ++{ ++ hcsplt_data_t hcsplt; ++ hctsiz_data_t hctsiz; ++ hcdma_data_t hcdma; ++ struct fiq_dma_blob *blob = (struct fiq_dma_blob *) st->dma_base; ++ int last = 0; ++ int i = st->channel[n].dma_info.index; ++ ++ fiq_print(FIQDBG_INT, st, "ADV %01d %01d ", n, i); ++ i++; ++ if (i == 4) ++ last = 1; ++ if (st->channel[n].dma_info.slot_len[i+1] == 255) ++ last = 1; ++ ++ /* New DMA address - address of bounce buffer referred to in index */ ++ hcdma.d32 = (uint32_t) &blob->channel[n].index[i].buf[0]; ++ //hcdma.d32 = FIQ_READ(st->dwc_regs_base + HC_DMA + (HC_OFFSET * n)); ++ //hcdma.d32 += st->channel[n].dma_info.slot_len[i]; ++ fiq_print(FIQDBG_INT, st, "LAST: %01d ", last); ++ fiq_print(FIQDBG_INT, st, "LEN: %03d", st->channel[n].dma_info.slot_len[i]); ++ hcsplt.d32 = FIQ_READ(st->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCSPLT); ++ hctsiz.d32 = FIQ_READ(st->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCTSIZ); ++ hcsplt.b.xactpos = (last) ? ISOC_XACTPOS_END : ISOC_XACTPOS_MID; ++ /* Set up new packet length */ ++ hctsiz.b.pktcnt = 1; ++ hctsiz.b.xfersize = st->channel[n].dma_info.slot_len[i]; ++ fiq_print(FIQDBG_INT, st, "%08x", hctsiz.d32); ++ ++ st->channel[n].dma_info.index++; ++ FIQ_WRITE(st->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCSPLT, hcsplt.d32); ++ FIQ_WRITE(st->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCTSIZ, hctsiz.d32); ++ FIQ_WRITE(st->dwc_regs_base + HC_DMA + (HC_OFFSET * n), hcdma.d32); ++ return last; ++} ++ ++/** ++ * fiq_fsm_tt_next_isoc() - queue next pending isochronous out start-split on a TT ++ * ++ * Despite the limitations of the DWC core, we can force a microframe pipeline of ++ * isochronous OUT start-split transactions while waiting for a corresponding other-type ++ * of endpoint to finish its CSPLITs. TTs have big periodic buffers therefore it ++ * is very unlikely that filling the start-split FIFO will cause data loss. ++ * This allows much better interleaving of transactions in an order-independent way- ++ * there is no requirement to prioritise isochronous, just a state-space search has ++ * to be performed on each periodic start-split complete interrupt. ++ */ ++static int notrace fiq_fsm_tt_next_isoc(struct fiq_state *st, int num_channels, int n) ++{ ++ int hub_addr = st->channel[n].hub_addr; ++ int port_addr = st->channel[n].port_addr; ++ int i, poked = 0; ++ for (i = 0; i < num_channels; i++) { ++ if (i == n || st->channel[i].fsm == FIQ_PASSTHROUGH) ++ continue; ++ if (st->channel[i].hub_addr == hub_addr && ++ st->channel[i].port_addr == port_addr) { ++ switch (st->channel[i].fsm) { ++ case FIQ_PER_ISO_OUT_PENDING: ++ if (st->channel[i].nrpackets == 1) { ++ st->channel[i].fsm = FIQ_PER_ISO_OUT_LAST; ++ } else { ++ st->channel[i].fsm = FIQ_PER_ISO_OUT_ACTIVE; ++ } ++ fiq_fsm_restart_channel(st, i, 0); ++ poked = 1; ++ break; ++ ++ default: ++ break; ++ } ++ } ++ if (poked) ++ break; ++ } ++ return poked; ++} ++ ++/** ++ * fiq_fsm_tt_in_use() - search for host channels using this TT ++ * @n: Channel to use as reference ++ * ++ */ ++int notrace noinline fiq_fsm_tt_in_use(struct fiq_state *st, int num_channels, int n) ++{ ++ int hub_addr = st->channel[n].hub_addr; ++ int port_addr = st->channel[n].port_addr; ++ int i, in_use = 0; ++ for (i = 0; i < num_channels; i++) { ++ if (i == n || st->channel[i].fsm == FIQ_PASSTHROUGH) ++ continue; ++ switch (st->channel[i].fsm) { ++ /* TT is reserved for channels that are in the middle of a periodic ++ * split transaction. ++ */ ++ case FIQ_PER_SSPLIT_STARTED: ++ case FIQ_PER_CSPLIT_WAIT: ++ case FIQ_PER_CSPLIT_NYET1: ++ //case FIQ_PER_CSPLIT_POLL: ++ case FIQ_PER_ISO_OUT_ACTIVE: ++ case FIQ_PER_ISO_OUT_LAST: ++ if (st->channel[i].hub_addr == hub_addr && ++ st->channel[i].port_addr == port_addr) { ++ in_use = 1; ++ } ++ break; ++ default: ++ break; ++ } ++ if (in_use) ++ break; ++ } ++ return in_use; ++} ++ ++/** ++ * fiq_fsm_more_csplits() - determine whether additional CSPLITs need ++ * to be issued for this IN transaction. ++ * ++ * We cannot tell the inbound PID of a data packet due to hardware limitations. ++ * we need to make an educated guess as to whether we need to queue another CSPLIT ++ * or not. A no-brainer is when we have received enough data to fill the endpoint ++ * size, but for endpoints that give variable-length data then we have to resort ++ * to heuristics. ++ * ++ * We also return whether this is the last CSPLIT to be queued, again based on ++ * heuristics. This is to allow a 1-uframe overlap of periodic split transactions. ++ * Note: requires at least 1 CSPLIT to have been performed prior to being called. ++ */ ++ ++/* ++ * We need some way of guaranteeing if a returned periodic packet of size X ++ * has a DATA0 PID. ++ * The heuristic value of 144 bytes assumes that the received data has maximal ++ * bit-stuffing and the clock frequency of the transmitting device is at the lowest ++ * permissible limit. If the transfer length results in a final packet size ++ * 144 < p <= 188, then an erroneous CSPLIT will be issued. ++ * Also used to ensure that an endpoint will nominally only return a single ++ * complete-split worth of data. ++ */ ++#define DATA0_PID_HEURISTIC 144 ++ ++static int notrace noinline fiq_fsm_more_csplits(struct fiq_state *state, int n, int *probably_last) ++{ ++ ++ int i; ++ int total_len = 0; ++ int more_needed = 1; ++ struct fiq_channel_state *st = &state->channel[n]; ++ ++ for (i = 0; i < st->dma_info.index; i++) { ++ total_len += st->dma_info.slot_len[i]; ++ } ++ ++ *probably_last = 0; ++ ++ if (st->hcchar_copy.b.eptype == 0x3) { ++ /* ++ * An interrupt endpoint will take max 2 CSPLITs. if we are receiving data ++ * then this is definitely the last CSPLIT. ++ */ ++ *probably_last = 1; ++ } else { ++ /* Isoc IN. This is a bit risky if we are the first transaction: ++ * we may have been held off slightly. */ ++ if (i > 1 && st->dma_info.slot_len[st->dma_info.index-1] <= DATA0_PID_HEURISTIC) { ++ more_needed = 0; ++ } ++ /* If in the next uframe we will receive enough data to fill the endpoint, ++ * then only issue 1 more csplit. ++ */ ++ if (st->hctsiz_copy.b.xfersize - total_len <= DATA0_PID_HEURISTIC) ++ *probably_last = 1; ++ } ++ ++ if (total_len >= st->hctsiz_copy.b.xfersize || ++ i == 6 || total_len == 0) ++ /* Note: due to bit stuffing it is possible to have > 6 CSPLITs for ++ * a single endpoint. Accepting more would completely break our scheduling mechanism though ++ * - in these extreme cases we will pass through a truncated packet. ++ */ ++ more_needed = 0; ++ ++ return more_needed; ++} ++ ++/** ++ * fiq_fsm_too_late() - Test transaction for lateness ++ * ++ * If a SSPLIT for a large IN transaction is issued too late in a frame, ++ * the hub will disable the port to the device and respond with ERR handshakes. ++ * The hub status endpoint will not reflect this change. ++ * Returns 1 if we will issue a SSPLIT that will result in a device babble. ++ */ ++int notrace fiq_fsm_too_late(struct fiq_state *st, int n) ++{ ++ int uframe; ++ hfnum_data_t hfnum = { .d32 = FIQ_READ(st->dwc_regs_base + HFNUM) }; ++ uframe = hfnum.b.frnum & 0x7; ++ if ((uframe < 6) && (st->channel[n].nrpackets + 1 + uframe > 7)) { ++ return 1; ++ } else { ++ return 0; ++ } ++} ++ ++ ++/** ++ * fiq_fsm_start_next_periodic() - A half-arsed attempt at a microframe pipeline ++ * ++ * Search pending transactions in the start-split pending state and queue them. ++ * Don't queue packets in uframe .5 (comes out in .6) (USB2.0 11.18.4). ++ * Note: we specifically don't do isochronous OUT transactions first because better ++ * use of the TT's start-split fifo can be achieved by pipelining an IN before an OUT. ++ */ ++static void notrace noinline fiq_fsm_start_next_periodic(struct fiq_state *st, int num_channels) ++{ ++ int n; ++ hfnum_data_t hfnum = { .d32 = FIQ_READ(st->dwc_regs_base + HFNUM) }; ++ if ((hfnum.b.frnum & 0x7) == 5) ++ return; ++ for (n = 0; n < num_channels; n++) { ++ if (st->channel[n].fsm == FIQ_PER_SSPLIT_QUEUED) { ++ /* Check to see if any other transactions are using this TT */ ++ if(!fiq_fsm_tt_in_use(st, num_channels, n)) { ++ if (!fiq_fsm_too_late(st, n)) { ++ st->channel[n].fsm = FIQ_PER_SSPLIT_STARTED; ++ fiq_print(FIQDBG_INT, st, "NEXTPER "); ++ fiq_fsm_restart_channel(st, n, 0); ++ } else { ++ st->channel[n].fsm = FIQ_PER_SPLIT_TIMEOUT; ++ } ++ break; ++ } ++ } ++ } ++ for (n = 0; n < num_channels; n++) { ++ if (st->channel[n].fsm == FIQ_PER_ISO_OUT_PENDING) { ++ if (!fiq_fsm_tt_in_use(st, num_channels, n)) { ++ fiq_print(FIQDBG_INT, st, "NEXTISO "); ++ st->channel[n].fsm = FIQ_PER_ISO_OUT_ACTIVE; ++ fiq_fsm_restart_channel(st, n, 0); ++ break; ++ } ++ } ++ } ++} ++ ++/** ++ * fiq_fsm_update_hs_isoc() - update isochronous frame and transfer data ++ * @state: Pointer to fiq_state ++ * @n: Channel transaction is active on ++ * @hcint: Copy of host channel interrupt register ++ * ++ * Returns 0 if there are no more transactions for this HC to do, 1 ++ * otherwise. ++ */ ++static int notrace noinline fiq_fsm_update_hs_isoc(struct fiq_state *state, int n, hcint_data_t hcint) ++{ ++ struct fiq_channel_state *st = &state->channel[n]; ++ int xfer_len = 0, nrpackets = 0; ++ hcdma_data_t hcdma; ++ fiq_print(FIQDBG_INT, state, "HSISO %02d", n); ++ ++ xfer_len = fiq_get_xfer_len(state, n); ++ st->hs_isoc_info.iso_desc[st->hs_isoc_info.index].actual_length = xfer_len; ++ ++ st->hs_isoc_info.iso_desc[st->hs_isoc_info.index].status = hcint.d32; ++ ++ st->hs_isoc_info.index++; ++ if (st->hs_isoc_info.index == st->hs_isoc_info.nrframes) { ++ return 0; ++ } ++ ++ /* grab the next DMA address offset from the array */ ++ hcdma.d32 = st->hcdma_copy.d32 + st->hs_isoc_info.iso_desc[st->hs_isoc_info.index].offset; ++ FIQ_WRITE(state->dwc_regs_base + HC_DMA + (HC_OFFSET * n), hcdma.d32); ++ ++ /* We need to set multi_count. This is a bit tricky - has to be set per-transaction as ++ * the core needs to be told to send the correct number. Caution: for IN transfers, ++ * this is always set to the maximum size of the endpoint. */ ++ xfer_len = st->hs_isoc_info.iso_desc[st->hs_isoc_info.index].length; ++ /* Integer divide in a FIQ: fun. FIXME: make this not suck */ ++ nrpackets = (xfer_len + st->hcchar_copy.b.mps - 1) / st->hcchar_copy.b.mps; ++ if (nrpackets == 0) ++ nrpackets = 1; ++ st->hcchar_copy.b.multicnt = nrpackets; ++ st->hctsiz_copy.b.pktcnt = nrpackets; ++ ++ /* Initial PID also needs to be set */ ++ if (st->hcchar_copy.b.epdir == 0) { ++ st->hctsiz_copy.b.xfersize = xfer_len; ++ switch (st->hcchar_copy.b.multicnt) { ++ case 1: ++ st->hctsiz_copy.b.pid = DWC_PID_DATA0; ++ break; ++ case 2: ++ case 3: ++ st->hctsiz_copy.b.pid = DWC_PID_MDATA; ++ break; ++ } ++ ++ } else { ++ switch (st->hcchar_copy.b.multicnt) { ++ st->hctsiz_copy.b.xfersize = nrpackets * st->hcchar_copy.b.mps; ++ case 1: ++ st->hctsiz_copy.b.pid = DWC_PID_DATA0; ++ break; ++ case 2: ++ st->hctsiz_copy.b.pid = DWC_PID_DATA1; ++ break; ++ case 3: ++ st->hctsiz_copy.b.pid = DWC_PID_DATA2; ++ break; ++ } ++ } ++ FIQ_WRITE(state->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCTSIZ, st->hctsiz_copy.d32); ++ FIQ_WRITE(state->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCCHAR, st->hcchar_copy.d32); ++ /* Channel is enabled on hcint handler exit */ ++ fiq_print(FIQDBG_INT, state, "HSISOOUT"); ++ return 1; ++} ++ ++ ++/** ++ * fiq_fsm_do_sof() - FSM start-of-frame interrupt handler ++ * @state: Pointer to the state struct passed from banked FIQ mode registers. ++ * @num_channels: set according to the DWC hardware configuration ++ * ++ * The SOF handler in FSM mode has two functions ++ * 1. Hold off SOF from causing schedule advancement in IRQ context if there's ++ * nothing to do ++ * 2. Advance certain FSM states that require either a microframe delay, or a microframe ++ * of holdoff. ++ * ++ * The second part is architecture-specific to mach-bcm2835 - ++ * a sane interrupt controller would have a mask register for ARM interrupt sources ++ * to be promoted to the nFIQ line, but it doesn't. Instead a single interrupt ++ * number (USB) can be enabled. This means that certain parts of the USB specification ++ * that require "wait a little while, then issue another packet" cannot be fulfilled with ++ * the timing granularity required to achieve optimal throughout. The workaround is to use ++ * the SOF "timer" (125uS) to perform this task. ++ */ ++static int notrace noinline fiq_fsm_do_sof(struct fiq_state *state, int num_channels) ++{ ++ hfnum_data_t hfnum = { .d32 = FIQ_READ(state->dwc_regs_base + HFNUM) }; ++ int n; ++ int kick_irq = 0; ++ ++ if ((hfnum.b.frnum & 0x7) == 1) { ++ /* We cannot issue csplits for transactions in the last frame past (n+1).1 ++ * Check to see if there are any transactions that are stale. ++ * Boot them out. ++ */ ++ for (n = 0; n < num_channels; n++) { ++ switch (state->channel[n].fsm) { ++ case FIQ_PER_CSPLIT_WAIT: ++ case FIQ_PER_CSPLIT_NYET1: ++ case FIQ_PER_CSPLIT_POLL: ++ case FIQ_PER_CSPLIT_LAST: ++ /* Check if we are no longer in the same full-speed frame. */ ++ if (((state->channel[n].expected_uframe & 0x3FFF) & ~0x7) < ++ (hfnum.b.frnum & ~0x7)) ++ state->channel[n].fsm = FIQ_PER_SPLIT_TIMEOUT; ++ break; ++ default: ++ break; ++ } ++ } ++ } ++ ++ for (n = 0; n < num_channels; n++) { ++ switch (state->channel[n].fsm) { ++ ++ case FIQ_NP_SSPLIT_RETRY: ++ case FIQ_NP_IN_CSPLIT_RETRY: ++ case FIQ_NP_OUT_CSPLIT_RETRY: ++ fiq_fsm_restart_channel(state, n, 0); ++ break; ++ ++ case FIQ_HS_ISOC_SLEEPING: ++ /* Is it time to wake this channel yet? */ ++ if (--state->channel[n].uframe_sleeps == 0) { ++ state->channel[n].fsm = FIQ_HS_ISOC_TURBO; ++ fiq_fsm_restart_channel(state, n, 0); ++ } ++ break; ++ ++ case FIQ_PER_SSPLIT_QUEUED: ++ if ((hfnum.b.frnum & 0x7) == 5) ++ break; ++ if(!fiq_fsm_tt_in_use(state, num_channels, n)) { ++ if (!fiq_fsm_too_late(state, n)) { ++ fiq_print(FIQDBG_INT, state, "SOF GO %01d", n); ++ fiq_fsm_restart_channel(state, n, 0); ++ state->channel[n].fsm = FIQ_PER_SSPLIT_STARTED; ++ } else { ++ /* Transaction cannot be started without risking a device babble error */ ++ state->channel[n].fsm = FIQ_PER_SPLIT_TIMEOUT; ++ state->haintmsk_saved.b2.chint &= ~(1 << n); ++ FIQ_WRITE(state->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCINTMSK, 0); ++ kick_irq |= 1; ++ } ++ } ++ break; ++ ++ case FIQ_PER_ISO_OUT_PENDING: ++ /* Ordinarily, this should be poked after the SSPLIT ++ * complete interrupt for a competing transfer on the same ++ * TT. Doesn't happen for aborted transactions though. ++ */ ++ if ((hfnum.b.frnum & 0x7) >= 5) ++ break; ++ if (!fiq_fsm_tt_in_use(state, num_channels, n)) { ++ /* Hardware bug. SOF can sometimes occur after the channel halt interrupt ++ * that caused this. ++ */ ++ fiq_fsm_restart_channel(state, n, 0); ++ fiq_print(FIQDBG_INT, state, "SOF ISOC"); ++ if (state->channel[n].nrpackets == 1) { ++ state->channel[n].fsm = FIQ_PER_ISO_OUT_LAST; ++ } else { ++ state->channel[n].fsm = FIQ_PER_ISO_OUT_ACTIVE; ++ } ++ } ++ break; ++ ++ case FIQ_PER_CSPLIT_WAIT: ++ /* we are guaranteed to be in this state if and only if the SSPLIT interrupt ++ * occurred when the bus transaction occurred. The SOF interrupt reversal bug ++ * will utterly bugger this up though. ++ */ ++ if (hfnum.b.frnum != state->channel[n].expected_uframe) { ++ fiq_print(FIQDBG_INT, state, "SOFCS %d ", n); ++ state->channel[n].fsm = FIQ_PER_CSPLIT_POLL; ++ fiq_fsm_restart_channel(state, n, 0); ++ fiq_fsm_start_next_periodic(state, num_channels); ++ ++ } ++ break; ++ ++ case FIQ_PER_SPLIT_TIMEOUT: ++ case FIQ_DEQUEUE_ISSUED: ++ /* Ugly: we have to force a HCD interrupt. ++ * Poke the mask for the channel in question. ++ * We will take a fake SOF because of this, but ++ * that's OK. ++ */ ++ state->haintmsk_saved.b2.chint &= ~(1 << n); ++ FIQ_WRITE(state->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCINTMSK, 0); ++ kick_irq |= 1; ++ break; ++ ++ default: ++ break; ++ } ++ } ++ ++ if (state->kick_np_queues || ++ dwc_frame_num_le(state->next_sched_frame, hfnum.b.frnum)) ++ kick_irq |= 1; ++ ++ return !kick_irq; ++} ++ ++ ++/** ++ * fiq_fsm_do_hcintr() - FSM host channel interrupt handler ++ * @state: Pointer to the FIQ state struct ++ * @num_channels: Number of channels as per hardware config ++ * @n: channel for which HAINT(i) was raised ++ * ++ * An important property is that only the CHHLT interrupt is unmasked. Unfortunately, AHBerr is as well. ++ */ ++static int notrace noinline fiq_fsm_do_hcintr(struct fiq_state *state, int num_channels, int n) ++{ ++ hcint_data_t hcint; ++ hcintmsk_data_t hcintmsk; ++ hcint_data_t hcint_probe; ++ hcchar_data_t hcchar; ++ int handled = 0; ++ int restart = 0; ++ int last_csplit = 0; ++ int start_next_periodic = 0; ++ struct fiq_channel_state *st = &state->channel[n]; ++ hfnum_data_t hfnum; ++ ++ hcint.d32 = FIQ_READ(state->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCINT); ++ hcintmsk.d32 = FIQ_READ(state->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCINTMSK); ++ hcint_probe.d32 = hcint.d32 & hcintmsk.d32; ++ ++ if (st->fsm != FIQ_PASSTHROUGH) { ++ fiq_print(FIQDBG_INT, state, "HC%01d ST%02d", n, st->fsm); ++ fiq_print(FIQDBG_INT, state, "%08x", hcint.d32); ++ } ++ ++ switch (st->fsm) { ++ ++ case FIQ_PASSTHROUGH: ++ case FIQ_DEQUEUE_ISSUED: ++ /* doesn't belong to us, kick it upstairs */ ++ break; ++ ++ case FIQ_PASSTHROUGH_ERRORSTATE: ++ /* We are here to emulate the error recovery mechanism of the dwc HCD. ++ * Several interrupts are unmasked if a previous transaction failed - it's ++ * death for the FIQ to attempt to handle them as the channel isn't halted. ++ * Emulate what the HCD does in this situation: mask and continue. ++ * The FSM has no other state setup so this has to be handled out-of-band. ++ */ ++ fiq_print(FIQDBG_ERR, state, "ERRST %02d", n); ++ if (hcint_probe.b.nak || hcint_probe.b.ack || hcint_probe.b.datatglerr) { ++ fiq_print(FIQDBG_ERR, state, "RESET %02d", n); ++ /* In some random cases we can get a NAK interrupt coincident with a Xacterr ++ * interrupt, after the device has disappeared. ++ */ ++ if (!hcint.b.xacterr) ++ st->nr_errors = 0; ++ hcintmsk.b.nak = 0; ++ hcintmsk.b.ack = 0; ++ hcintmsk.b.datatglerr = 0; ++ FIQ_WRITE(state->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCINTMSK, hcintmsk.d32); ++ return 1; ++ } ++ if (hcint_probe.b.chhltd) { ++ fiq_print(FIQDBG_ERR, state, "CHHLT %02d", n); ++ fiq_print(FIQDBG_ERR, state, "%08x", hcint.d32); ++ return 0; ++ } ++ break; ++ ++ /* Non-periodic state groups */ ++ case FIQ_NP_SSPLIT_STARTED: ++ case FIQ_NP_SSPLIT_RETRY: ++ /* Got a HCINT for a NP SSPLIT. Expected ACK / NAK / fail */ ++ if (hcint.b.ack) { ++ /* SSPLIT complete. For OUT, the data has been sent. For IN, the LS transaction ++ * will start shortly. SOF needs to kick the transaction to prevent a NYET flood. ++ */ ++ if(st->hcchar_copy.b.epdir == 1) ++ st->fsm = FIQ_NP_IN_CSPLIT_RETRY; ++ else ++ st->fsm = FIQ_NP_OUT_CSPLIT_RETRY; ++ st->nr_errors = 0; ++ handled = 1; ++ fiq_fsm_setup_csplit(state, n); ++ } else if (hcint.b.nak) { ++ // No buffer space in TT. Retry on a uframe boundary. ++ st->fsm = FIQ_NP_SSPLIT_RETRY; ++ handled = 1; ++ } else if (hcint.b.xacterr) { ++ // The only other one we care about is xacterr. This implies HS bus error - retry. ++ st->nr_errors++; ++ st->fsm = FIQ_NP_SSPLIT_RETRY; ++ if (st->nr_errors >= 3) { ++ st->fsm = FIQ_NP_SPLIT_HS_ABORTED; ++ } else { ++ handled = 1; ++ restart = 1; ++ } ++ } else { ++ st->fsm = FIQ_NP_SPLIT_LS_ABORTED; ++ handled = 0; ++ restart = 0; ++ } ++ break; ++ ++ case FIQ_NP_IN_CSPLIT_RETRY: ++ /* Received a CSPLIT done interrupt. ++ * Expected Data/NAK/STALL/NYET for IN. ++ */ ++ if (hcint.b.xfercomp) { ++ /* For IN, data is present. */ ++ st->fsm = FIQ_NP_SPLIT_DONE; ++ } else if (hcint.b.nak) { ++ /* no endpoint data. Punt it upstairs */ ++ st->fsm = FIQ_NP_SPLIT_DONE; ++ } else if (hcint.b.nyet) { ++ /* CSPLIT NYET - retry on a uframe boundary. */ ++ handled = 1; ++ st->nr_errors = 0; ++ } else if (hcint.b.datatglerr) { ++ /* data toggle errors do not set the xfercomp bit. */ ++ st->fsm = FIQ_NP_SPLIT_LS_ABORTED; ++ } else if (hcint.b.xacterr) { ++ /* HS error. Retry immediate */ ++ st->fsm = FIQ_NP_IN_CSPLIT_RETRY; ++ st->nr_errors++; ++ if (st->nr_errors >= 3) { ++ st->fsm = FIQ_NP_SPLIT_HS_ABORTED; ++ } else { ++ handled = 1; ++ restart = 1; ++ } ++ } else if (hcint.b.stall || hcint.b.bblerr) { ++ /* A STALL implies either a LS bus error or a genuine STALL. */ ++ st->fsm = FIQ_NP_SPLIT_LS_ABORTED; ++ } else { ++ /* Hardware bug. It's possible in some cases to ++ * get a channel halt with nothing else set when ++ * the response was a NYET. Treat as local 3-strikes retry. ++ */ ++ hcint_data_t hcint_test = hcint; ++ hcint_test.b.chhltd = 0; ++ if (!hcint_test.d32) { ++ st->nr_errors++; ++ if (st->nr_errors >= 3) { ++ st->fsm = FIQ_NP_SPLIT_HS_ABORTED; ++ } else { ++ handled = 1; ++ } ++ } else { ++ /* Bail out if something unexpected happened */ ++ st->fsm = FIQ_NP_SPLIT_HS_ABORTED; ++ } ++ } ++ break; ++ ++ case FIQ_NP_OUT_CSPLIT_RETRY: ++ /* Received a CSPLIT done interrupt. ++ * Expected ACK/NAK/STALL/NYET/XFERCOMP for OUT.*/ ++ if (hcint.b.xfercomp) { ++ st->fsm = FIQ_NP_SPLIT_DONE; ++ } else if (hcint.b.nak) { ++ // The HCD will implement the holdoff on frame boundaries. ++ st->fsm = FIQ_NP_SPLIT_DONE; ++ } else if (hcint.b.nyet) { ++ // Hub still processing. ++ st->fsm = FIQ_NP_OUT_CSPLIT_RETRY; ++ handled = 1; ++ st->nr_errors = 0; ++ //restart = 1; ++ } else if (hcint.b.xacterr) { ++ /* HS error. retry immediate */ ++ st->fsm = FIQ_NP_OUT_CSPLIT_RETRY; ++ st->nr_errors++; ++ if (st->nr_errors >= 3) { ++ st->fsm = FIQ_NP_SPLIT_HS_ABORTED; ++ } else { ++ handled = 1; ++ restart = 1; ++ } ++ } else if (hcint.b.stall) { ++ /* LS bus error or genuine stall */ ++ st->fsm = FIQ_NP_SPLIT_LS_ABORTED; ++ } else { ++ /* ++ * Hardware bug. It's possible in some cases to get a ++ * channel halt with nothing else set when the response was a NYET. ++ * Treat as local 3-strikes retry. ++ */ ++ hcint_data_t hcint_test = hcint; ++ hcint_test.b.chhltd = 0; ++ if (!hcint_test.d32) { ++ st->nr_errors++; ++ if (st->nr_errors >= 3) { ++ st->fsm = FIQ_NP_SPLIT_HS_ABORTED; ++ } else { ++ handled = 1; ++ } ++ } else { ++ // Something unexpected happened. AHBerror or babble perhaps. Let the IRQ deal with it. ++ st->fsm = FIQ_NP_SPLIT_HS_ABORTED; ++ } ++ } ++ break; ++ ++ /* Periodic split states (except isoc out) */ ++ case FIQ_PER_SSPLIT_STARTED: ++ /* Expect an ACK or failure for SSPLIT */ ++ if (hcint.b.ack) { ++ /* ++ * SSPLIT transfer complete interrupt - the generation of this interrupt is fraught with bugs. ++ * For a packet queued in microframe n-3 to appear in n-2, if the channel is enabled near the EOF1 ++ * point for microframe n-3, the packet will not appear on the bus until microframe n. ++ * Additionally, the generation of the actual interrupt is dodgy. For a packet appearing on the bus ++ * in microframe n, sometimes the interrupt is generated immediately. Sometimes, it appears in n+1 ++ * coincident with SOF for n+1. ++ * SOF is also buggy. It can sometimes be raised AFTER the first bus transaction has taken place. ++ * These appear to be caused by timing/clock crossing bugs within the core itself. ++ * State machine workaround. ++ */ ++ hfnum.d32 = FIQ_READ(state->dwc_regs_base + HFNUM); ++ hcchar.d32 = FIQ_READ(state->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCCHAR); ++ fiq_fsm_setup_csplit(state, n); ++ /* Poke the oddfrm bit. If we are equivalent, we received the interrupt at the correct ++ * time. If not, then we're in the next SOF. ++ */ ++ if ((hfnum.b.frnum & 0x1) == hcchar.b.oddfrm) { ++ fiq_print(FIQDBG_INT, state, "CSWAIT %01d", n); ++ st->expected_uframe = hfnum.b.frnum; ++ st->fsm = FIQ_PER_CSPLIT_WAIT; ++ } else { ++ fiq_print(FIQDBG_INT, state, "CSPOL %01d", n); ++ /* For isochronous IN endpoints, ++ * we need to hold off if we are expecting a lot of data */ ++ if (st->hcchar_copy.b.mps < DATA0_PID_HEURISTIC) { ++ start_next_periodic = 1; ++ } ++ /* Danger will robinson: we are in a broken state. If our first interrupt after ++ * this is a NYET, it will be delayed by 1 uframe and result in an unrecoverable ++ * lag. Unmask the NYET interrupt. ++ */ ++ st->expected_uframe = (hfnum.b.frnum + 1) & 0x3FFF; ++ st->fsm = FIQ_PER_CSPLIT_BROKEN_NYET1; ++ restart = 1; ++ } ++ handled = 1; ++ } else if (hcint.b.xacterr) { ++ /* 3-strikes retry is enabled, we have hit our max nr_errors */ ++ st->fsm = FIQ_PER_SPLIT_HS_ABORTED; ++ start_next_periodic = 1; ++ } else { ++ st->fsm = FIQ_PER_SPLIT_HS_ABORTED; ++ start_next_periodic = 1; ++ } ++ /* We can now queue the next isochronous OUT transaction, if one is pending. */ ++ if(fiq_fsm_tt_next_isoc(state, num_channels, n)) { ++ fiq_print(FIQDBG_INT, state, "NEXTISO "); ++ } ++ break; ++ ++ case FIQ_PER_CSPLIT_NYET1: ++ /* First CSPLIT attempt was a NYET. If we get a subsequent NYET, ++ * we are too late and the TT has dropped its CSPLIT fifo. ++ */ ++ hfnum.d32 = FIQ_READ(state->dwc_regs_base + HFNUM); ++ hcchar.d32 = FIQ_READ(state->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCCHAR); ++ start_next_periodic = 1; ++ if (hcint.b.nak) { ++ st->fsm = FIQ_PER_SPLIT_DONE; ++ } else if (hcint.b.xfercomp) { ++ fiq_increment_dma_buf(state, num_channels, n); ++ st->fsm = FIQ_PER_CSPLIT_POLL; ++ st->nr_errors = 0; ++ if (fiq_fsm_more_csplits(state, n, &last_csplit)) { ++ handled = 1; ++ restart = 1; ++ if (!last_csplit) ++ start_next_periodic = 0; ++ } else { ++ st->fsm = FIQ_PER_SPLIT_DONE; ++ } ++ } else if (hcint.b.nyet) { ++ /* Doh. Data lost. */ ++ st->fsm = FIQ_PER_SPLIT_NYET_ABORTED; ++ } else if (hcint.b.xacterr || hcint.b.stall || hcint.b.bblerr) { ++ st->fsm = FIQ_PER_SPLIT_LS_ABORTED; ++ } else { ++ st->fsm = FIQ_PER_SPLIT_HS_ABORTED; ++ } ++ break; ++ ++ case FIQ_PER_CSPLIT_BROKEN_NYET1: ++ /* ++ * we got here because our host channel is in the delayed-interrupt ++ * state and we cannot take a NYET interrupt any later than when it ++ * occurred. Disable then re-enable the channel if this happens to force ++ * CSPLITs to occur at the right time. ++ */ ++ hfnum.d32 = FIQ_READ(state->dwc_regs_base + HFNUM); ++ hcchar.d32 = FIQ_READ(state->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCCHAR); ++ fiq_print(FIQDBG_INT, state, "BROK: %01d ", n); ++ if (hcint.b.nak) { ++ st->fsm = FIQ_PER_SPLIT_DONE; ++ start_next_periodic = 1; ++ } else if (hcint.b.xfercomp) { ++ fiq_increment_dma_buf(state, num_channels, n); ++ if (fiq_fsm_more_csplits(state, n, &last_csplit)) { ++ st->fsm = FIQ_PER_CSPLIT_POLL; ++ handled = 1; ++ restart = 1; ++ start_next_periodic = 1; ++ /* Reload HCTSIZ for the next transfer */ ++ fiq_fsm_reload_hctsiz(state, n); ++ if (!last_csplit) ++ start_next_periodic = 0; ++ } else { ++ st->fsm = FIQ_PER_SPLIT_DONE; ++ } ++ } else if (hcint.b.nyet) { ++ st->fsm = FIQ_PER_SPLIT_NYET_ABORTED; ++ start_next_periodic = 1; ++ } else if (hcint.b.xacterr || hcint.b.stall || hcint.b.bblerr) { ++ /* Local 3-strikes retry is handled by the core. This is a ERR response.*/ ++ st->fsm = FIQ_PER_SPLIT_LS_ABORTED; ++ } else { ++ st->fsm = FIQ_PER_SPLIT_HS_ABORTED; ++ } ++ break; ++ ++ case FIQ_PER_CSPLIT_POLL: ++ hfnum.d32 = FIQ_READ(state->dwc_regs_base + HFNUM); ++ hcchar.d32 = FIQ_READ(state->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCCHAR); ++ start_next_periodic = 1; ++ if (hcint.b.nak) { ++ st->fsm = FIQ_PER_SPLIT_DONE; ++ } else if (hcint.b.xfercomp) { ++ fiq_increment_dma_buf(state, num_channels, n); ++ if (fiq_fsm_more_csplits(state, n, &last_csplit)) { ++ handled = 1; ++ restart = 1; ++ /* Reload HCTSIZ for the next transfer */ ++ fiq_fsm_reload_hctsiz(state, n); ++ if (!last_csplit) ++ start_next_periodic = 0; ++ } else { ++ st->fsm = FIQ_PER_SPLIT_DONE; ++ } ++ } else if (hcint.b.nyet) { ++ /* Are we a NYET after the first data packet? */ ++ if (st->nrpackets == 0) { ++ st->fsm = FIQ_PER_CSPLIT_NYET1; ++ handled = 1; ++ restart = 1; ++ } else { ++ /* We got a NYET when polling CSPLITs. Can happen ++ * if our heuristic fails, or if someone disables us ++ * for any significant length of time. ++ */ ++ if (st->nr_errors >= 3) { ++ st->fsm = FIQ_PER_SPLIT_NYET_ABORTED; ++ } else { ++ st->fsm = FIQ_PER_SPLIT_DONE; ++ } ++ } ++ } else if (hcint.b.xacterr || hcint.b.stall || hcint.b.bblerr) { ++ /* For xacterr, Local 3-strikes retry is handled by the core. This is a ERR response.*/ ++ st->fsm = FIQ_PER_SPLIT_LS_ABORTED; ++ } else { ++ st->fsm = FIQ_PER_SPLIT_HS_ABORTED; ++ } ++ break; ++ ++ case FIQ_HS_ISOC_TURBO: ++ if (fiq_fsm_update_hs_isoc(state, n, hcint)) { ++ /* more transactions to come */ ++ handled = 1; ++ fiq_print(FIQDBG_INT, state, "HSISO M "); ++ /* For strided transfers, put ourselves to sleep */ ++ if (st->hs_isoc_info.stride > 1) { ++ st->uframe_sleeps = st->hs_isoc_info.stride - 1; ++ st->fsm = FIQ_HS_ISOC_SLEEPING; ++ } else { ++ restart = 1; ++ } ++ } else { ++ st->fsm = FIQ_HS_ISOC_DONE; ++ fiq_print(FIQDBG_INT, state, "HSISO F "); ++ } ++ break; ++ ++ case FIQ_HS_ISOC_ABORTED: ++ /* This abort is called by the driver rewriting the state mid-transaction ++ * which allows the dequeue mechanism to work more effectively. ++ */ ++ break; ++ ++ case FIQ_PER_ISO_OUT_ACTIVE: ++ if (hcint.b.ack) { ++ if(fiq_iso_out_advance(state, num_channels, n)) { ++ /* last OUT transfer */ ++ st->fsm = FIQ_PER_ISO_OUT_LAST; ++ /* ++ * Assuming the periodic FIFO in the dwc core ++ * actually does its job properly, we can queue ++ * the next ssplit now and in theory, the wire ++ * transactions will be in-order. ++ */ ++ // No it doesn't. It appears to process requests in host channel order. ++ //start_next_periodic = 1; ++ } ++ handled = 1; ++ restart = 1; ++ } else { ++ /* ++ * Isochronous transactions carry on regardless. Log the error ++ * and continue. ++ */ ++ //explode += 1; ++ st->nr_errors++; ++ if(fiq_iso_out_advance(state, num_channels, n)) { ++ st->fsm = FIQ_PER_ISO_OUT_LAST; ++ //start_next_periodic = 1; ++ } ++ handled = 1; ++ restart = 1; ++ } ++ break; ++ ++ case FIQ_PER_ISO_OUT_LAST: ++ if (hcint.b.ack) { ++ /* All done here */ ++ st->fsm = FIQ_PER_ISO_OUT_DONE; ++ } else { ++ st->fsm = FIQ_PER_ISO_OUT_DONE; ++ st->nr_errors++; ++ } ++ start_next_periodic = 1; ++ break; ++ ++ case FIQ_PER_SPLIT_TIMEOUT: ++ /* SOF kicked us because we overran. */ ++ start_next_periodic = 1; ++ break; ++ ++ default: ++ break; ++ } ++ ++ if (handled) { ++ FIQ_WRITE(state->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCINT, hcint.d32); ++ } else { ++ /* Copy the regs into the state so the IRQ knows what to do */ ++ st->hcint_copy.d32 = hcint.d32; ++ } ++ ++ if (restart) { ++ /* Restart always implies handled. */ ++ if (restart == 2) { ++ /* For complete-split INs, the show must go on. ++ * Force a channel restart */ ++ fiq_fsm_restart_channel(state, n, 1); ++ } else { ++ fiq_fsm_restart_channel(state, n, 0); ++ } ++ } ++ if (start_next_periodic) { ++ fiq_fsm_start_next_periodic(state, num_channels); ++ } ++ if (st->fsm != FIQ_PASSTHROUGH) ++ fiq_print(FIQDBG_INT, state, "FSMOUT%02d", st->fsm); ++ ++ return handled; ++} ++ ++ ++/** ++ * dwc_otg_fiq_fsm() - Flying State Machine (monster) FIQ ++ * @state: pointer to state struct passed from the banked FIQ mode registers. ++ * @num_channels: set according to the DWC hardware configuration ++ * @dma: pointer to DMA bounce buffers for split transaction slots ++ * ++ * The FSM FIQ performs the low-level tasks that normally would be performed by the microcode ++ * inside an EHCI or similar host controller regarding split transactions. The DWC core ++ * interrupts each and every time a split transaction packet is received or sent successfully. ++ * This results in either an interrupt storm when everything is working "properly", or ++ * the interrupt latency of the system in general breaks time-sensitive periodic split ++ * transactions. Pushing the low-level, but relatively easy state machine work into the FIQ ++ * solves these problems. ++ * ++ * Return: void ++ */ ++void notrace dwc_otg_fiq_fsm(struct fiq_state *state, int num_channels) ++{ ++ gintsts_data_t gintsts, gintsts_handled; ++ gintmsk_data_t gintmsk; ++ //hfnum_data_t hfnum; ++ haint_data_t haint, haint_handled; ++ haintmsk_data_t haintmsk; ++ int kick_irq = 0; ++ ++ gintsts_handled.d32 = 0; ++ haint_handled.d32 = 0; ++ ++ fiq_fsm_spin_lock(&state->lock); ++ gintsts.d32 = FIQ_READ(state->dwc_regs_base + GINTSTS); ++ gintmsk.d32 = FIQ_READ(state->dwc_regs_base + GINTMSK); ++ gintsts.d32 &= gintmsk.d32; ++ ++ if (gintsts.b.sofintr) { ++ /* For FSM mode, SOF is required to keep the state machine advance for ++ * certain stages of the periodic pipeline. It's death to mask this ++ * interrupt in that case. ++ */ ++ ++ if (!fiq_fsm_do_sof(state, num_channels)) { ++ /* Kick IRQ once. Queue advancement means that all pending transactions ++ * will get serviced when the IRQ finally executes. ++ */ ++ if (state->gintmsk_saved.b.sofintr == 1) ++ kick_irq |= 1; ++ state->gintmsk_saved.b.sofintr = 0; ++ } ++ gintsts_handled.b.sofintr = 1; ++ } ++ ++ if (gintsts.b.hcintr) { ++ int i; ++ haint.d32 = FIQ_READ(state->dwc_regs_base + HAINT); ++ haintmsk.d32 = FIQ_READ(state->dwc_regs_base + HAINTMSK); ++ haint.d32 &= haintmsk.d32; ++ haint_handled.d32 = 0; ++ for (i=0; i<num_channels; i++) { ++ if (haint.b2.chint & (1 << i)) { ++ if(!fiq_fsm_do_hcintr(state, num_channels, i)) { ++ /* HCINT was not handled in FIQ ++ * HAINT is level-sensitive, leading to level-sensitive ginststs.b.hcint bit. ++ * Mask HAINT(i) but keep top-level hcint unmasked. ++ */ ++ state->haintmsk_saved.b2.chint &= ~(1 << i); ++ } else { ++ /* do_hcintr cleaned up after itself, but clear haint */ ++ haint_handled.b2.chint |= (1 << i); ++ } ++ } ++ } ++ ++ if (haint_handled.b2.chint) { ++ FIQ_WRITE(state->dwc_regs_base + HAINT, haint_handled.d32); ++ } ++ ++ if (haintmsk.d32 != (haintmsk.d32 & state->haintmsk_saved.d32)) { ++ /* ++ * This is necessary to avoid multiple retriggers of the MPHI in the case ++ * where interrupts are held off and HCINTs start to pile up. ++ * Only wake up the IRQ if a new interrupt came in, was not handled and was ++ * masked. ++ */ ++ haintmsk.d32 &= state->haintmsk_saved.d32; ++ FIQ_WRITE(state->dwc_regs_base + HAINTMSK, haintmsk.d32); ++ kick_irq |= 1; ++ } ++ /* Top-Level interrupt - always handled because it's level-sensitive */ ++ gintsts_handled.b.hcintr = 1; ++ } ++ ++ ++ /* Clear the bits in the saved register that were not handled but were triggered. */ ++ state->gintmsk_saved.d32 &= ~(gintsts.d32 & ~gintsts_handled.d32); ++ ++ /* FIQ didn't handle something - mask has changed - write new mask */ ++ if (gintmsk.d32 != (gintmsk.d32 & state->gintmsk_saved.d32)) { ++ gintmsk.d32 &= state->gintmsk_saved.d32; ++ gintmsk.b.sofintr = 1; ++ FIQ_WRITE(state->dwc_regs_base + GINTMSK, gintmsk.d32); ++// fiq_print(FIQDBG_INT, state, "KICKGINT"); ++// fiq_print(FIQDBG_INT, state, "%08x", gintmsk.d32); ++// fiq_print(FIQDBG_INT, state, "%08x", state->gintmsk_saved.d32); ++ kick_irq |= 1; ++ } ++ ++ if (gintsts_handled.d32) { ++ /* Only applies to edge-sensitive bits in GINTSTS */ ++ FIQ_WRITE(state->dwc_regs_base + GINTSTS, gintsts_handled.d32); ++ } ++ ++ /* We got an interrupt, didn't handle it. */ ++ if (kick_irq) { ++ state->mphi_int_count++; ++ FIQ_WRITE(state->mphi_regs.outdda, (int) state->dummy_send); ++ FIQ_WRITE(state->mphi_regs.outddb, (1<<29)); ++ ++ } ++ state->fiq_done++; ++ mb(); ++ fiq_fsm_spin_unlock(&state->lock); ++} ++ ++ ++/** ++ * dwc_otg_fiq_nop() - FIQ "lite" ++ * @state: pointer to state struct passed from the banked FIQ mode registers. ++ * ++ * The "nop" handler does not intervene on any interrupts other than SOF. ++ * It is limited in scope to deciding at each SOF if the IRQ SOF handler (which deals ++ * with non-periodic/periodic queues) needs to be kicked. ++ * ++ * This is done to hold off the SOF interrupt, which occurs at a rate of 8000 per second. ++ * ++ * Return: void ++ */ ++void notrace dwc_otg_fiq_nop(struct fiq_state *state) ++{ ++ gintsts_data_t gintsts, gintsts_handled; ++ gintmsk_data_t gintmsk; ++ hfnum_data_t hfnum; ++ ++ fiq_fsm_spin_lock(&state->lock); ++ hfnum.d32 = FIQ_READ(state->dwc_regs_base + HFNUM); ++ gintsts.d32 = FIQ_READ(state->dwc_regs_base + GINTSTS); ++ gintmsk.d32 = FIQ_READ(state->dwc_regs_base + GINTMSK); ++ gintsts.d32 &= gintmsk.d32; ++ gintsts_handled.d32 = 0; ++ ++ if (gintsts.b.sofintr) { ++ if (!state->kick_np_queues && ++ dwc_frame_num_gt(state->next_sched_frame, hfnum.b.frnum)) { ++ /* SOF handled, no work to do, just ACK interrupt */ ++ gintsts_handled.b.sofintr = 1; ++ } else { ++ /* Kick IRQ */ ++ state->gintmsk_saved.b.sofintr = 0; ++ } ++ } ++ ++ /* Reset handled interrupts */ ++ if(gintsts_handled.d32) { ++ FIQ_WRITE(state->dwc_regs_base + GINTSTS, gintsts_handled.d32); ++ } ++ ++ /* Clear the bits in the saved register that were not handled but were triggered. */ ++ state->gintmsk_saved.d32 &= ~(gintsts.d32 & ~gintsts_handled.d32); ++ ++ /* We got an interrupt, didn't handle it and want to mask it */ ++ if (~(state->gintmsk_saved.d32)) { ++ state->mphi_int_count++; ++ gintmsk.d32 &= state->gintmsk_saved.d32; ++ FIQ_WRITE(state->dwc_regs_base + GINTMSK, gintmsk.d32); ++ /* Force a clear before another dummy send */ ++ FIQ_WRITE(state->mphi_regs.intstat, (1<<29)); ++ FIQ_WRITE(state->mphi_regs.outdda, (int) state->dummy_send); ++ FIQ_WRITE(state->mphi_regs.outddb, (1<<29)); ++ ++ } ++ state->fiq_done++; ++ mb(); ++ fiq_fsm_spin_unlock(&state->lock); ++} +diff --git a/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.h b/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.h +new file mode 100644 +index 0000000..f9fddfb +--- /dev/null ++++ b/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.h +@@ -0,0 +1,370 @@ ++/* ++ * dwc_otg_fiq_fsm.h - Finite state machine FIQ header definitions ++ * ++ * Copyright (c) 2013 Raspberry Pi Foundation ++ * ++ * Author: Jonathan Bell <jonathan@raspberrypi.org> ++ * All rights reserved. ++ * ++ * Redistribution and use in source and binary forms, with or without ++ * modification, are permitted provided that the following conditions are met: ++ * * Redistributions of source code must retain the above copyright ++ * notice, this list of conditions and the following disclaimer. ++ * * 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. ++ * * Neither the name of Raspberry Pi nor the ++ * names of its contributors may be used to endorse or promote products ++ * derived from this software without specific prior written permission. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 <COPYRIGHT HOLDER> 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. ++ * ++ * This FIQ implements functionality that performs split transactions on ++ * the dwc_otg hardware without any outside intervention. A split transaction ++ * is "queued" by nominating a specific host channel to perform the entirety ++ * of a split transaction. This FIQ will then perform the microframe-precise ++ * scheduling required in each phase of the transaction until completion. ++ * ++ * The FIQ functionality has been surgically implanted into the Synopsys ++ * vendor-provided driver. ++ * ++ */ ++ ++#ifndef DWC_OTG_FIQ_FSM_H_ ++#define DWC_OTG_FIQ_FSM_H_ ++ ++#include "dwc_otg_regs.h" ++#include "dwc_otg_cil.h" ++#include "dwc_otg_hcd.h" ++#include <linux/kernel.h> ++#include <linux/irqflags.h> ++#include <linux/string.h> ++#include <asm/barrier.h> ++ ++#if 0 ++#define FLAME_ON(x) \ ++do { \ ++ int gpioreg; \ ++ \ ++ gpioreg = readl(__io_address(0x20200000+0x8)); \ ++ gpioreg &= ~(7 << (x-20)*3); \ ++ gpioreg |= 0x1 << (x-20)*3; \ ++ writel(gpioreg, __io_address(0x20200000+0x8)); \ ++ \ ++ writel(1<<x, __io_address(0x20200000+(0x1C))); \ ++} while (0) ++ ++#define FLAME_OFF(x) \ ++do { \ ++ writel(1<<x, __io_address(0x20200000+(0x28))); \ ++} while (0) ++#else ++#define FLAME_ON(x) do { } while (0) ++#define FLAME_OFF(X) do { } while (0) ++#endif ++ ++/* This is a quick-and-dirty arch-specific register read/write. We know that ++ * writes to a peripheral on BCM2835 will always arrive in-order, also that ++ * reads and writes are executed in-order therefore the need for memory barriers ++ * is obviated if we're only talking to USB. ++ */ ++#define FIQ_WRITE(_addr_,_data_) (*(volatile unsigned int *) (_addr_) = (_data_)) ++#define FIQ_READ(_addr_) (*(volatile unsigned int *) (_addr_)) ++ ++/* FIQ-ified register definitions. Offsets are from dwc_regs_base. */ ++#define GINTSTS 0x014 ++#define GINTMSK 0x018 ++/* Debug register. Poll the top of the received packets FIFO. */ ++#define GRXSTSR 0x01C ++#define HFNUM 0x408 ++#define HAINT 0x414 ++#define HAINTMSK 0x418 ++#define HPRT0 0x440 ++ ++/* HC_regs start from an offset of 0x500 */ ++#define HC_START 0x500 ++#define HC_OFFSET 0x020 ++ ++#define HC_DMA 0x514 ++ ++#define HCCHAR 0x00 ++#define HCSPLT 0x04 ++#define HCINT 0x08 ++#define HCINTMSK 0x0C ++#define HCTSIZ 0x10 ++ ++#define ISOC_XACTPOS_ALL 0b11 ++#define ISOC_XACTPOS_BEGIN 0b10 ++#define ISOC_XACTPOS_MID 0b00 ++#define ISOC_XACTPOS_END 0b01 ++ ++#define DWC_PID_DATA2 0b01 ++#define DWC_PID_MDATA 0b11 ++#define DWC_PID_DATA1 0b10 ++#define DWC_PID_DATA0 0b00 ++ ++typedef struct { ++ volatile void* base; ++ volatile void* ctrl; ++ volatile void* outdda; ++ volatile void* outddb; ++ volatile void* intstat; ++} mphi_regs_t; ++ ++enum fiq_debug_level { ++ FIQDBG_SCHED = (1 << 0), ++ FIQDBG_INT = (1 << 1), ++ FIQDBG_ERR = (1 << 2), ++ FIQDBG_PORTHUB = (1 << 3), ++}; ++ ++typedef struct { ++ union { ++ uint32_t slock; ++ struct _tickets { ++ uint16_t owner; ++ uint16_t next; ++ } tickets; ++ }; ++} fiq_lock_t; ++ ++struct fiq_state; ++ ++extern void _fiq_print (enum fiq_debug_level dbg_lvl, volatile struct fiq_state *state, char *fmt, ...); ++#if 0 ++#define fiq_print _fiq_print ++#else ++#define fiq_print(x, y, ...) ++#endif ++ ++extern bool fiq_enable, fiq_fsm_enable; ++extern ushort nak_holdoff; ++ ++/** ++ * enum fiq_fsm_state - The FIQ FSM states. ++ * ++ * This is the "core" of the FIQ FSM. Broadly, the FSM states follow the ++ * USB2.0 specification for host responses to various transaction states. ++ * There are modifications to this host state machine because of a variety of ++ * quirks and limitations in the dwc_otg hardware. ++ * ++ * The fsm state is also used to communicate back to the driver on completion of ++ * a split transaction. The end states are used in conjunction with the interrupts ++ * raised by the final transaction. ++ */ ++enum fiq_fsm_state { ++ /* FIQ isn't enabled for this host channel */ ++ FIQ_PASSTHROUGH = 0, ++ /* For the first interrupt received for this channel, ++ * the FIQ has to ack any interrupts indicating success. */ ++ FIQ_PASSTHROUGH_ERRORSTATE = 31, ++ /* Nonperiodic state groups */ ++ FIQ_NP_SSPLIT_STARTED = 1, ++ FIQ_NP_SSPLIT_RETRY = 2, ++ FIQ_NP_OUT_CSPLIT_RETRY = 3, ++ FIQ_NP_IN_CSPLIT_RETRY = 4, ++ FIQ_NP_SPLIT_DONE = 5, ++ FIQ_NP_SPLIT_LS_ABORTED = 6, ++ /* This differentiates a HS transaction error from a LS one ++ * (handling the hub state is different) */ ++ FIQ_NP_SPLIT_HS_ABORTED = 7, ++ ++ /* Periodic state groups */ ++ /* Periodic transactions are either started directly by the IRQ handler ++ * or deferred if the TT is already in use. ++ */ ++ FIQ_PER_SSPLIT_QUEUED = 8, ++ FIQ_PER_SSPLIT_STARTED = 9, ++ FIQ_PER_SSPLIT_LAST = 10, ++ ++ ++ FIQ_PER_ISO_OUT_PENDING = 11, ++ FIQ_PER_ISO_OUT_ACTIVE = 12, ++ FIQ_PER_ISO_OUT_LAST = 13, ++ FIQ_PER_ISO_OUT_DONE = 27, ++ ++ FIQ_PER_CSPLIT_WAIT = 14, ++ FIQ_PER_CSPLIT_NYET1 = 15, ++ FIQ_PER_CSPLIT_BROKEN_NYET1 = 28, ++ FIQ_PER_CSPLIT_NYET_FAFF = 29, ++ /* For multiple CSPLITs (large isoc IN, or delayed interrupt) */ ++ FIQ_PER_CSPLIT_POLL = 16, ++ /* The last CSPLIT for a transaction has been issued, differentiates ++ * for the state machine to queue the next packet. ++ */ ++ FIQ_PER_CSPLIT_LAST = 17, ++ ++ FIQ_PER_SPLIT_DONE = 18, ++ FIQ_PER_SPLIT_LS_ABORTED = 19, ++ FIQ_PER_SPLIT_HS_ABORTED = 20, ++ FIQ_PER_SPLIT_NYET_ABORTED = 21, ++ /* Frame rollover has occurred without the transaction finishing. */ ++ FIQ_PER_SPLIT_TIMEOUT = 22, ++ ++ /* FIQ-accelerated HS Isochronous state groups */ ++ FIQ_HS_ISOC_TURBO = 23, ++ /* For interval > 1, SOF wakes up the isochronous FSM */ ++ FIQ_HS_ISOC_SLEEPING = 24, ++ FIQ_HS_ISOC_DONE = 25, ++ FIQ_HS_ISOC_ABORTED = 26, ++ FIQ_DEQUEUE_ISSUED = 30, ++ FIQ_TEST = 32, ++}; ++ ++struct fiq_stack { ++ int magic1; ++ uint8_t stack[2048]; ++ int magic2; ++}; ++ ++ ++/** ++ * struct fiq_dma_info - DMA bounce buffer utilisation information (per-channel) ++ * @index: Number of slots reported used for IN transactions / number of slots ++ * transmitted for an OUT transaction ++ * @slot_len[6]: Number of actual transfer bytes in each slot (255 if unused) ++ * ++ * Split transaction transfers can have variable length depending on other bus ++ * traffic. The OTG core DMA engine requires 4-byte aligned addresses therefore ++ * each transaction needs a guaranteed aligned address. A maximum of 6 split transfers ++ * can happen per-frame. ++ */ ++struct fiq_dma_info { ++ u8 index; ++ u8 slot_len[6]; ++}; ++ ++struct __attribute__((packed)) fiq_split_dma_slot { ++ u8 buf[188]; ++}; ++ ++struct fiq_dma_channel { ++ struct __attribute__((packed)) fiq_split_dma_slot index[6]; ++}; ++ ++struct fiq_dma_blob { ++ struct __attribute__((packed)) fiq_dma_channel channel[0]; ++}; ++ ++/** ++ * struct fiq_hs_isoc_info - USB2.0 isochronous data ++ * @iso_frame: Pointer to the array of OTG URB iso_frame_descs. ++ * @nrframes: Total length of iso_frame_desc array ++ * @index: Current index (FIQ-maintained) ++ * @stride: Interval in uframes between HS isoc transactions ++ */ ++struct fiq_hs_isoc_info { ++ struct dwc_otg_hcd_iso_packet_desc *iso_desc; ++ unsigned int nrframes; ++ unsigned int index; ++ unsigned int stride; ++}; ++ ++/** ++ * struct fiq_channel_state - FIQ state machine storage ++ * @fsm: Current state of the channel as understood by the FIQ ++ * @nr_errors: Number of transaction errors on this split-transaction ++ * @hub_addr: SSPLIT/CSPLIT destination hub ++ * @port_addr: SSPLIT/CSPLIT destination port - always 1 if single TT hub ++ * @nrpackets: For isoc OUT, the number of split-OUT packets to transmit. For ++ * split-IN, number of CSPLIT data packets that were received. ++ * @hcchar_copy: ++ * @hcsplt_copy: ++ * @hcintmsk_copy: ++ * @hctsiz_copy: Copies of the host channel registers. ++ * For use as scratch, or for returning state. ++ * ++ * The fiq_channel_state is state storage between interrupts for a host channel. The ++ * FSM state is stored here. Members of this structure must only be set up by the ++ * driver prior to enabling the FIQ for this host channel, and not touched until the FIQ ++ * has updated the state to either a COMPLETE state group or ABORT state group. ++ */ ++ ++struct fiq_channel_state { ++ enum fiq_fsm_state fsm; ++ unsigned int nr_errors; ++ unsigned int hub_addr; ++ unsigned int port_addr; ++ /* Hardware bug workaround: sometimes channel halt interrupts are ++ * delayed until the next SOF. Keep track of when we expected to get interrupted. */ ++ unsigned int expected_uframe; ++ /* number of uframes remaining (for interval > 1 HS isoc transfers) before next transfer */ ++ unsigned int uframe_sleeps; ++ /* in/out for communicating number of dma buffers used, or number of ISOC to do */ ++ unsigned int nrpackets; ++ struct fiq_dma_info dma_info; ++ struct fiq_hs_isoc_info hs_isoc_info; ++ /* Copies of HC registers - in/out communication from/to IRQ handler ++ * and for ease of channel setup. A bit of mungeing is performed - for ++ * example the hctsiz.b.maxp is _always_ the max packet size of the endpoint. ++ */ ++ hcchar_data_t hcchar_copy; ++ hcsplt_data_t hcsplt_copy; ++ hcint_data_t hcint_copy; ++ hcintmsk_data_t hcintmsk_copy; ++ hctsiz_data_t hctsiz_copy; ++ hcdma_data_t hcdma_copy; ++}; ++ ++/** ++ * struct fiq_state - top-level FIQ state machine storage ++ * @mphi_regs: virtual address of the MPHI peripheral register file ++ * @dwc_regs_base: virtual address of the base of the DWC core register file ++ * @dma_base: physical address for the base of the DMA bounce buffers ++ * @dummy_send: Scratch area for sending a fake message to the MPHI peripheral ++ * @gintmsk_saved: Top-level mask of interrupts that the FIQ has not handled. ++ * Used for determining which interrupts fired to set off the IRQ handler. ++ * @haintmsk_saved: Mask of interrupts from host channels that the FIQ did not handle internally. ++ * @np_count: Non-periodic transactions in the active queue ++ * @np_sent: Count of non-periodic transactions that have completed ++ * @next_sched_frame: For periodic transactions handled by the driver's SOF-driven queuing mechanism, ++ * this is the next frame on which a SOF interrupt is required. Used to hold off ++ * passing SOF through to the driver until necessary. ++ * @channel[n]: Per-channel FIQ state. Allocated during init depending on the number of host ++ * channels configured into the core logic. ++ * ++ * This is passed as the first argument to the dwc_otg_fiq_fsm top-level FIQ handler from the asm stub. ++ * It contains top-level state information. ++ */ ++struct fiq_state { ++ fiq_lock_t lock; ++ mphi_regs_t mphi_regs; ++ void *dwc_regs_base; ++ dma_addr_t dma_base; ++ struct fiq_dma_blob *fiq_dmab; ++ void *dummy_send; ++ gintmsk_data_t gintmsk_saved; ++ haintmsk_data_t haintmsk_saved; ++ int mphi_int_count; ++ unsigned int fiq_done; ++ unsigned int kick_np_queues; ++ unsigned int next_sched_frame; ++#ifdef FIQ_DEBUG ++ char * buffer; ++ unsigned int bufsiz; ++#endif ++ struct fiq_channel_state channel[0]; ++}; ++ ++extern void fiq_fsm_spin_lock(fiq_lock_t *lock); ++ ++extern void fiq_fsm_spin_unlock(fiq_lock_t *lock); ++ ++extern int fiq_fsm_too_late(struct fiq_state *st, int n); ++ ++extern int fiq_fsm_tt_in_use(struct fiq_state *st, int num_channels, int n); ++ ++extern void dwc_otg_fiq_fsm(struct fiq_state *state, int num_channels); ++ ++extern void dwc_otg_fiq_nop(struct fiq_state *state); ++ ++#endif /* DWC_OTG_FIQ_FSM_H_ */ +diff --git a/drivers/usb/host/dwc_otg/dwc_otg_fiq_stub.S b/drivers/usb/host/dwc_otg/dwc_otg_fiq_stub.S +new file mode 100644 +index 0000000..ffa8d21 +--- /dev/null ++++ b/drivers/usb/host/dwc_otg/dwc_otg_fiq_stub.S +@@ -0,0 +1,80 @@ ++/* ++ * dwc_otg_fiq_fsm.S - assembly stub for the FSM FIQ ++ * ++ * Copyright (c) 2013 Raspberry Pi Foundation ++ * ++ * Author: Jonathan Bell <jonathan@raspberrypi.org> ++ * All rights reserved. ++ * ++ * Redistribution and use in source and binary forms, with or without ++ * modification, are permitted provided that the following conditions are met: ++ * * Redistributions of source code must retain the above copyright ++ * notice, this list of conditions and the following disclaimer. ++ * * 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. ++ * * Neither the name of Raspberry Pi nor the ++ * names of its contributors may be used to endorse or promote products ++ * derived from this software without specific prior written permission. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 <COPYRIGHT HOLDER> BE LIABLE FOR ANY ++ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ++ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; ++ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ++ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ++ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ */ ++ ++ ++#include <asm/assembler.h> ++#include <linux/linkage.h> ++ ++ ++.text ++ ++.global _dwc_otg_fiq_stub_end; ++ ++/** ++ * _dwc_otg_fiq_stub() - entry copied to the FIQ vector page to allow ++ * a C-style function call with arguments from the FIQ banked registers. ++ * r0 = &hcd->fiq_state ++ * r1 = &hcd->num_channels ++ * r2 = &hcd->dma_buffers ++ * Tramples: r0, r1, r2, r4, fp, ip ++ */ ++ ++ENTRY(_dwc_otg_fiq_stub) ++ /* Stash unbanked regs - SP will have been set up for us */ ++ mov ip, sp; ++ stmdb sp!, {r0-r12, lr}; ++#ifdef FIQ_DEBUG ++ // Cycle profiling - read cycle counter at start ++ mrc p15, 0, r5, c15, c12, 1; ++#endif ++ /* r11 = fp, don't trample it */ ++ mov r4, fp; ++ /* set EABI frame size */ ++ sub fp, ip, #512; ++ ++ /* for fiq NOP mode - just need state */ ++ mov r0, r8; ++ /* r9 = num_channels */ ++ mov r1, r9; ++ /* r10 = struct *dma_bufs */ ++// mov r2, r10; ++ ++ /* r4 = &fiq_c_function */ ++ blx r4; ++#ifdef FIQ_DEBUG ++ mrc p15, 0, r4, c15, c12, 1; ++ subs r5, r5, r4; ++ // r5 is now the cycle count time for executing the FIQ. Store it somewhere? ++#endif ++ ldmia sp!, {r0-r12, lr}; ++ subs pc, lr, #4; ++_dwc_otg_fiq_stub_end: ++END(_dwc_otg_fiq_stub) +diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd.c b/drivers/usb/host/dwc_otg/dwc_otg_hcd.c +new file mode 100644 +index 0000000..135b611 +--- /dev/null ++++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd.c +@@ -0,0 +1,4257 @@ ++ ++/* ========================================================================== ++ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_hcd.c $ ++ * $Revision: #104 $ ++ * $Date: 2011/10/24 $ ++ * $Change: 1871159 $ ++ * ++ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, ++ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless ++ * otherwise expressly agreed to in writing between Synopsys and you. ++ * ++ * The Software IS NOT an item of Licensed Software or Licensed Product under ++ * any End User Software License Agreement or Agreement for Licensed Product ++ * with Synopsys or any supplement thereto. You are permitted to use and ++ * redistribute this Software in source and binary forms, with or without ++ * modification, provided that redistributions of source code must retain this ++ * notice. You may not view, use, disclose, copy or distribute this file or ++ * any information contained herein except pursuant to this license grant from ++ * Synopsys. If you do not agree with this notice, including the disclaimer ++ * below, then you are not authorized to use the Software. ++ * ++ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS ++ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS 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. ++ * ========================================================================== */ ++#ifndef DWC_DEVICE_ONLY ++ ++/** @file ++ * This file implements HCD Core. All code in this file is portable and doesn't ++ * use any OS specific functions. ++ * Interface provided by HCD Core is defined in <code><hcd_if.h></code> ++ * header file. ++ */ ++ ++#include <linux/usb.h> ++#include <linux/usb/hcd.h> ++ ++#include "dwc_otg_hcd.h" ++#include "dwc_otg_regs.h" ++#include "dwc_otg_fiq_fsm.h" ++ ++extern bool microframe_schedule; ++extern uint16_t fiq_fsm_mask, nak_holdoff; ++ ++//#define DEBUG_HOST_CHANNELS ++#ifdef DEBUG_HOST_CHANNELS ++static int last_sel_trans_num_per_scheduled = 0; ++static int last_sel_trans_num_nonper_scheduled = 0; ++static int last_sel_trans_num_avail_hc_at_start = 0; ++static int last_sel_trans_num_avail_hc_at_end = 0; ++#endif /* DEBUG_HOST_CHANNELS */ ++ ++ ++dwc_otg_hcd_t *dwc_otg_hcd_alloc_hcd(void) ++{ ++ return DWC_ALLOC(sizeof(dwc_otg_hcd_t)); ++} ++ ++/** ++ * Connection timeout function. An OTG host is required to display a ++ * message if the device does not connect within 10 seconds. ++ */ ++void dwc_otg_hcd_connect_timeout(void *ptr) ++{ ++ DWC_DEBUGPL(DBG_HCDV, "%s(%p)\n", __func__, ptr); ++ DWC_PRINTF("Connect Timeout\n"); ++ __DWC_ERROR("Device Not Connected/Responding\n"); ++} ++ ++#if defined(DEBUG) ++static void dump_channel_info(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh) ++{ ++ if (qh->channel != NULL) { ++ dwc_hc_t *hc = qh->channel; ++ dwc_list_link_t *item; ++ dwc_otg_qh_t *qh_item; ++ int num_channels = hcd->core_if->core_params->host_channels; ++ int i; ++ ++ dwc_otg_hc_regs_t *hc_regs; ++ hcchar_data_t hcchar; ++ hcsplt_data_t hcsplt; ++ hctsiz_data_t hctsiz; ++ uint32_t hcdma; ++ ++ hc_regs = hcd->core_if->host_if->hc_regs[hc->hc_num]; ++ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); ++ hcsplt.d32 = DWC_READ_REG32(&hc_regs->hcsplt); ++ hctsiz.d32 = DWC_READ_REG32(&hc_regs->hctsiz); ++ hcdma = DWC_READ_REG32(&hc_regs->hcdma); ++ ++ DWC_PRINTF(" Assigned to channel %p:\n", hc); ++ DWC_PRINTF(" hcchar 0x%08x, hcsplt 0x%08x\n", hcchar.d32, ++ hcsplt.d32); ++ DWC_PRINTF(" hctsiz 0x%08x, hcdma 0x%08x\n", hctsiz.d32, ++ hcdma); ++ DWC_PRINTF(" dev_addr: %d, ep_num: %d, ep_is_in: %d\n", ++ hc->dev_addr, hc->ep_num, hc->ep_is_in); ++ DWC_PRINTF(" ep_type: %d\n", hc->ep_type); ++ DWC_PRINTF(" max_packet: %d\n", hc->max_packet); ++ DWC_PRINTF(" data_pid_start: %d\n", hc->data_pid_start); ++ DWC_PRINTF(" xfer_started: %d\n", hc->xfer_started); ++ DWC_PRINTF(" halt_status: %d\n", hc->halt_status); ++ DWC_PRINTF(" xfer_buff: %p\n", hc->xfer_buff); ++ DWC_PRINTF(" xfer_len: %d\n", hc->xfer_len); ++ DWC_PRINTF(" qh: %p\n", hc->qh); ++ DWC_PRINTF(" NP inactive sched:\n"); ++ DWC_LIST_FOREACH(item, &hcd->non_periodic_sched_inactive) { ++ qh_item = ++ DWC_LIST_ENTRY(item, dwc_otg_qh_t, qh_list_entry); ++ DWC_PRINTF(" %p\n", qh_item); ++ } ++ DWC_PRINTF(" NP active sched:\n"); ++ DWC_LIST_FOREACH(item, &hcd->non_periodic_sched_active) { ++ qh_item = ++ DWC_LIST_ENTRY(item, dwc_otg_qh_t, qh_list_entry); ++ DWC_PRINTF(" %p\n", qh_item); ++ } ++ DWC_PRINTF(" Channels: \n"); ++ for (i = 0; i < num_channels; i++) { ++ dwc_hc_t *hc = hcd->hc_ptr_array[i]; ++ DWC_PRINTF(" %2d: %p\n", i, hc); ++ } ++ } ++} ++#else ++#define dump_channel_info(hcd, qh) ++#endif /* DEBUG */ ++ ++/** ++ * Work queue function for starting the HCD when A-Cable is connected. ++ * The hcd_start() must be called in a process context. ++ */ ++static void hcd_start_func(void *_vp) ++{ ++ dwc_otg_hcd_t *hcd = (dwc_otg_hcd_t *) _vp; ++ ++ DWC_DEBUGPL(DBG_HCDV, "%s() %p\n", __func__, hcd); ++ if (hcd) { ++ hcd->fops->start(hcd); ++ } ++} ++ ++static void del_xfer_timers(dwc_otg_hcd_t * hcd) ++{ ++#ifdef DEBUG ++ int i; ++ int num_channels = hcd->core_if->core_params->host_channels; ++ for (i = 0; i < num_channels; i++) { ++ DWC_TIMER_CANCEL(hcd->core_if->hc_xfer_timer[i]); ++ } ++#endif ++} ++ ++static void del_timers(dwc_otg_hcd_t * hcd) ++{ ++ del_xfer_timers(hcd); ++ DWC_TIMER_CANCEL(hcd->conn_timer); ++} ++ ++/** ++ * Processes all the URBs in a single list of QHs. Completes them with ++ * -ESHUTDOWN and frees the QTD. ++ */ ++static void kill_urbs_in_qh_list(dwc_otg_hcd_t * hcd, dwc_list_link_t * qh_list) ++{ ++ dwc_list_link_t *qh_item, *qh_tmp; ++ dwc_otg_qh_t *qh; ++ dwc_otg_qtd_t *qtd, *qtd_tmp; ++ ++ DWC_LIST_FOREACH_SAFE(qh_item, qh_tmp, qh_list) { ++ qh = DWC_LIST_ENTRY(qh_item, dwc_otg_qh_t, qh_list_entry); ++ DWC_CIRCLEQ_FOREACH_SAFE(qtd, qtd_tmp, ++ &qh->qtd_list, qtd_list_entry) { ++ qtd = DWC_CIRCLEQ_FIRST(&qh->qtd_list); ++ if (qtd->urb != NULL) { ++ hcd->fops->complete(hcd, qtd->urb->priv, ++ qtd->urb, -DWC_E_SHUTDOWN); ++ dwc_otg_hcd_qtd_remove_and_free(hcd, qtd, qh); ++ } ++ ++ } ++ if(qh->channel) { ++ /* Using hcchar.chen == 1 is not a reliable test. ++ * It is possible that the channel has already halted ++ * but not yet been through the IRQ handler. ++ */ ++ dwc_otg_hc_halt(hcd->core_if, qh->channel, ++ DWC_OTG_HC_XFER_URB_DEQUEUE); ++ if(microframe_schedule) ++ hcd->available_host_channels++; ++ qh->channel = NULL; ++ } ++ dwc_otg_hcd_qh_remove(hcd, qh); ++ } ++} ++ ++/** ++ * Responds with an error status of ESHUTDOWN to all URBs in the non-periodic ++ * and periodic schedules. The QTD associated with each URB is removed from ++ * the schedule and freed. This function may be called when a disconnect is ++ * detected or when the HCD is being stopped. ++ */ ++static void kill_all_urbs(dwc_otg_hcd_t * hcd) ++{ ++ kill_urbs_in_qh_list(hcd, &hcd->non_periodic_sched_inactive); ++ kill_urbs_in_qh_list(hcd, &hcd->non_periodic_sched_active); ++ kill_urbs_in_qh_list(hcd, &hcd->periodic_sched_inactive); ++ kill_urbs_in_qh_list(hcd, &hcd->periodic_sched_ready); ++ kill_urbs_in_qh_list(hcd, &hcd->periodic_sched_assigned); ++ kill_urbs_in_qh_list(hcd, &hcd->periodic_sched_queued); ++} ++ ++/** ++ * Start the connection timer. An OTG host is required to display a ++ * message if the device does not connect within 10 seconds. The ++ * timer is deleted if a port connect interrupt occurs before the ++ * timer expires. ++ */ ++static void dwc_otg_hcd_start_connect_timer(dwc_otg_hcd_t * hcd) ++{ ++ DWC_TIMER_SCHEDULE(hcd->conn_timer, 10000 /* 10 secs */ ); ++} ++ ++/** ++ * HCD Callback function for disconnect of the HCD. ++ * ++ * @param p void pointer to the <code>struct usb_hcd</code> ++ */ ++static int32_t dwc_otg_hcd_session_start_cb(void *p) ++{ ++ dwc_otg_hcd_t *dwc_otg_hcd; ++ DWC_DEBUGPL(DBG_HCDV, "%s(%p)\n", __func__, p); ++ dwc_otg_hcd = p; ++ dwc_otg_hcd_start_connect_timer(dwc_otg_hcd); ++ return 1; ++} ++ ++/** ++ * HCD Callback function for starting the HCD when A-Cable is ++ * connected. ++ * ++ * @param p void pointer to the <code>struct usb_hcd</code> ++ */ ++static int32_t dwc_otg_hcd_start_cb(void *p) ++{ ++ dwc_otg_hcd_t *dwc_otg_hcd = p; ++ dwc_otg_core_if_t *core_if; ++ hprt0_data_t hprt0; ++ ++ core_if = dwc_otg_hcd->core_if; ++ ++ if (core_if->op_state == B_HOST) { ++ /* ++ * Reset the port. During a HNP mode switch the reset ++ * needs to occur within 1ms and have a duration of at ++ * least 50ms. ++ */ ++ hprt0.d32 = dwc_otg_read_hprt0(core_if); ++ hprt0.b.prtrst = 1; ++ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); ++ } ++ DWC_WORKQ_SCHEDULE_DELAYED(core_if->wq_otg, ++ hcd_start_func, dwc_otg_hcd, 50, ++ "start hcd"); ++ ++ return 1; ++} ++ ++/** ++ * HCD Callback function for disconnect of the HCD. ++ * ++ * @param p void pointer to the <code>struct usb_hcd</code> ++ */ ++static int32_t dwc_otg_hcd_disconnect_cb(void *p) ++{ ++ gintsts_data_t intr; ++ dwc_otg_hcd_t *dwc_otg_hcd = p; ++ ++ /* ++ * Set status flags for the hub driver. ++ */ ++ dwc_otg_hcd->flags.b.port_connect_status_change = 1; ++ dwc_otg_hcd->flags.b.port_connect_status = 0; ++ if(fiq_enable) ++ local_fiq_disable(); ++ /* ++ * Shutdown any transfers in process by clearing the Tx FIFO Empty ++ * interrupt mask and status bits and disabling subsequent host ++ * channel interrupts. ++ */ ++ intr.d32 = 0; ++ intr.b.nptxfempty = 1; ++ intr.b.ptxfempty = 1; ++ intr.b.hcintr = 1; ++ DWC_MODIFY_REG32(&dwc_otg_hcd->core_if->core_global_regs->gintmsk, ++ intr.d32, 0); ++ DWC_MODIFY_REG32(&dwc_otg_hcd->core_if->core_global_regs->gintsts, ++ intr.d32, 0); ++ ++ del_timers(dwc_otg_hcd); ++ ++ /* ++ * Turn off the vbus power only if the core has transitioned to device ++ * mode. If still in host mode, need to keep power on to detect a ++ * reconnection. ++ */ ++ if (dwc_otg_is_device_mode(dwc_otg_hcd->core_if)) { ++ if (dwc_otg_hcd->core_if->op_state != A_SUSPEND) { ++ hprt0_data_t hprt0 = {.d32 = 0 }; ++ DWC_PRINTF("Disconnect: PortPower off\n"); ++ hprt0.b.prtpwr = 0; ++ DWC_WRITE_REG32(dwc_otg_hcd->core_if->host_if->hprt0, ++ hprt0.d32); ++ } ++ ++ dwc_otg_disable_host_interrupts(dwc_otg_hcd->core_if); ++ } ++ ++ /* Respond with an error status to all URBs in the schedule. */ ++ kill_all_urbs(dwc_otg_hcd); ++ ++ if (dwc_otg_is_host_mode(dwc_otg_hcd->core_if)) { ++ /* Clean up any host channels that were in use. */ ++ int num_channels; ++ int i; ++ dwc_hc_t *channel; ++ dwc_otg_hc_regs_t *hc_regs; ++ hcchar_data_t hcchar; ++ ++ num_channels = dwc_otg_hcd->core_if->core_params->host_channels; ++ ++ if (!dwc_otg_hcd->core_if->dma_enable) { ++ /* Flush out any channel requests in slave mode. */ ++ for (i = 0; i < num_channels; i++) { ++ channel = dwc_otg_hcd->hc_ptr_array[i]; ++ if (DWC_CIRCLEQ_EMPTY_ENTRY ++ (channel, hc_list_entry)) { ++ hc_regs = ++ dwc_otg_hcd->core_if-> ++ host_if->hc_regs[i]; ++ hcchar.d32 = ++ DWC_READ_REG32(&hc_regs->hcchar); ++ if (hcchar.b.chen) { ++ hcchar.b.chen = 0; ++ hcchar.b.chdis = 1; ++ hcchar.b.epdir = 0; ++ DWC_WRITE_REG32 ++ (&hc_regs->hcchar, ++ hcchar.d32); ++ } ++ } ++ } ++ } ++ ++ for (i = 0; i < num_channels; i++) { ++ channel = dwc_otg_hcd->hc_ptr_array[i]; ++ if (DWC_CIRCLEQ_EMPTY_ENTRY(channel, hc_list_entry)) { ++ hc_regs = ++ dwc_otg_hcd->core_if->host_if->hc_regs[i]; ++ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); ++ if (hcchar.b.chen) { ++ /* Halt the channel. */ ++ hcchar.b.chdis = 1; ++ DWC_WRITE_REG32(&hc_regs->hcchar, ++ hcchar.d32); ++ } ++ ++ dwc_otg_hc_cleanup(dwc_otg_hcd->core_if, ++ channel); ++ DWC_CIRCLEQ_INSERT_TAIL ++ (&dwc_otg_hcd->free_hc_list, channel, ++ hc_list_entry); ++ /* ++ * Added for Descriptor DMA to prevent channel double cleanup ++ * in release_channel_ddma(). Which called from ep_disable ++ * when device disconnect. ++ */ ++ channel->qh = NULL; ++ } ++ } ++ if(fiq_fsm_enable) { ++ for(i=0; i < 128; i++) { ++ dwc_otg_hcd->hub_port[i] = 0; ++ } ++ } ++ ++ } ++ ++ if(fiq_enable) ++ local_fiq_enable(); ++ ++ if (dwc_otg_hcd->fops->disconnect) { ++ dwc_otg_hcd->fops->disconnect(dwc_otg_hcd); ++ } ++ ++ return 1; ++} ++ ++/** ++ * HCD Callback function for stopping the HCD. ++ * ++ * @param p void pointer to the <code>struct usb_hcd</code> ++ */ ++static int32_t dwc_otg_hcd_stop_cb(void *p) ++{ ++ dwc_otg_hcd_t *dwc_otg_hcd = p; ++ ++ DWC_DEBUGPL(DBG_HCDV, "%s(%p)\n", __func__, p); ++ dwc_otg_hcd_stop(dwc_otg_hcd); ++ return 1; ++} ++ ++#ifdef CONFIG_USB_DWC_OTG_LPM ++/** ++ * HCD Callback function for sleep of HCD. ++ * ++ * @param p void pointer to the <code>struct usb_hcd</code> ++ */ ++static int dwc_otg_hcd_sleep_cb(void *p) ++{ ++ dwc_otg_hcd_t *hcd = p; ++ ++ dwc_otg_hcd_free_hc_from_lpm(hcd); ++ ++ return 0; ++} ++#endif ++ ++ ++/** ++ * HCD Callback function for Remote Wakeup. ++ * ++ * @param p void pointer to the <code>struct usb_hcd</code> ++ */ ++static int dwc_otg_hcd_rem_wakeup_cb(void *p) ++{ ++ dwc_otg_hcd_t *hcd = p; ++ ++ if (hcd->core_if->lx_state == DWC_OTG_L2) { ++ hcd->flags.b.port_suspend_change = 1; ++ } ++#ifdef CONFIG_USB_DWC_OTG_LPM ++ else { ++ hcd->flags.b.port_l1_change = 1; ++ } ++#endif ++ return 0; ++} ++ ++/** ++ * Halts the DWC_otg host mode operations in a clean manner. USB transfers are ++ * stopped. ++ */ ++void dwc_otg_hcd_stop(dwc_otg_hcd_t * hcd) ++{ ++ hprt0_data_t hprt0 = {.d32 = 0 }; ++ ++ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD STOP\n"); ++ ++ /* ++ * The root hub should be disconnected before this function is called. ++ * The disconnect will clear the QTD lists (via ..._hcd_urb_dequeue) ++ * and the QH lists (via ..._hcd_endpoint_disable). ++ */ ++ ++ /* Turn off all host-specific interrupts. */ ++ dwc_otg_disable_host_interrupts(hcd->core_if); ++ ++ /* Turn off the vbus power */ ++ DWC_PRINTF("PortPower off\n"); ++ hprt0.b.prtpwr = 0; ++ DWC_WRITE_REG32(hcd->core_if->host_if->hprt0, hprt0.d32); ++ dwc_mdelay(1); ++} ++ ++int dwc_otg_hcd_urb_enqueue(dwc_otg_hcd_t * hcd, ++ dwc_otg_hcd_urb_t * dwc_otg_urb, void **ep_handle, ++ int atomic_alloc) ++{ ++ int retval = 0; ++ uint8_t needs_scheduling = 0; ++ dwc_otg_transaction_type_e tr_type; ++ dwc_otg_qtd_t *qtd; ++ gintmsk_data_t intr_mask = {.d32 = 0 }; ++ hprt0_data_t hprt0 = { .d32 = 0 }; ++ ++#ifdef DEBUG /* integrity checks (Broadcom) */ ++ if (NULL == hcd->core_if) { ++ DWC_ERROR("**** DWC OTG HCD URB Enqueue - HCD has NULL core_if\n"); ++ /* No longer connected. */ ++ return -DWC_E_INVALID; ++ } ++#endif ++ if (!hcd->flags.b.port_connect_status) { ++ /* No longer connected. */ ++ DWC_ERROR("Not connected\n"); ++ return -DWC_E_NO_DEVICE; ++ } ++ ++ /* Some core configurations cannot support LS traffic on a FS root port */ ++ if ((hcd->fops->speed(hcd, dwc_otg_urb->priv) == USB_SPEED_LOW) && ++ (hcd->core_if->hwcfg2.b.fs_phy_type == 1) && ++ (hcd->core_if->hwcfg2.b.hs_phy_type == 1)) { ++ hprt0.d32 = DWC_READ_REG32(hcd->core_if->host_if->hprt0); ++ if (hprt0.b.prtspd == DWC_HPRT0_PRTSPD_FULL_SPEED) { ++ return -DWC_E_NO_DEVICE; ++ } ++ } ++ ++ qtd = dwc_otg_hcd_qtd_create(dwc_otg_urb, atomic_alloc); ++ if (qtd == NULL) { ++ DWC_ERROR("DWC OTG HCD URB Enqueue failed creating QTD\n"); ++ return -DWC_E_NO_MEMORY; ++ } ++#ifdef DEBUG /* integrity checks (Broadcom) */ ++ if (qtd->urb == NULL) { ++ DWC_ERROR("**** DWC OTG HCD URB Enqueue created QTD with no URBs\n"); ++ return -DWC_E_NO_MEMORY; ++ } ++ if (qtd->urb->priv == NULL) { ++ DWC_ERROR("**** DWC OTG HCD URB Enqueue created QTD URB with no URB handle\n"); ++ return -DWC_E_NO_MEMORY; ++ } ++#endif ++ intr_mask.d32 = DWC_READ_REG32(&hcd->core_if->core_global_regs->gintmsk); ++ if(!intr_mask.b.sofintr || fiq_enable) needs_scheduling = 1; ++ if((((dwc_otg_qh_t *)ep_handle)->ep_type == UE_BULK) && !(qtd->urb->flags & URB_GIVEBACK_ASAP)) ++ /* Do not schedule SG transactions until qtd has URB_GIVEBACK_ASAP set */ ++ needs_scheduling = 0; ++ ++ retval = dwc_otg_hcd_qtd_add(qtd, hcd, (dwc_otg_qh_t **) ep_handle, atomic_alloc); ++ // creates a new queue in ep_handle if it doesn't exist already ++ if (retval < 0) { ++ DWC_ERROR("DWC OTG HCD URB Enqueue failed adding QTD. " ++ "Error status %d\n", retval); ++ dwc_otg_hcd_qtd_free(qtd); ++ return retval; ++ } ++ ++ if(needs_scheduling) { ++ tr_type = dwc_otg_hcd_select_transactions(hcd); ++ if (tr_type != DWC_OTG_TRANSACTION_NONE) { ++ dwc_otg_hcd_queue_transactions(hcd, tr_type); ++ } ++ } ++ return retval; ++} ++ ++int dwc_otg_hcd_urb_dequeue(dwc_otg_hcd_t * hcd, ++ dwc_otg_hcd_urb_t * dwc_otg_urb) ++{ ++ dwc_otg_qh_t *qh; ++ dwc_otg_qtd_t *urb_qtd; ++ BUG_ON(!hcd); ++ BUG_ON(!dwc_otg_urb); ++ ++#ifdef DEBUG /* integrity checks (Broadcom) */ ++ ++ if (hcd == NULL) { ++ DWC_ERROR("**** DWC OTG HCD URB Dequeue has NULL HCD\n"); ++ return -DWC_E_INVALID; ++ } ++ if (dwc_otg_urb == NULL) { ++ DWC_ERROR("**** DWC OTG HCD URB Dequeue has NULL URB\n"); ++ return -DWC_E_INVALID; ++ } ++ if (dwc_otg_urb->qtd == NULL) { ++ DWC_ERROR("**** DWC OTG HCD URB Dequeue with NULL QTD\n"); ++ return -DWC_E_INVALID; ++ } ++ urb_qtd = dwc_otg_urb->qtd; ++ BUG_ON(!urb_qtd); ++ if (urb_qtd->qh == NULL) { ++ DWC_ERROR("**** DWC OTG HCD URB Dequeue with QTD with NULL Q handler\n"); ++ return -DWC_E_INVALID; ++ } ++#else ++ urb_qtd = dwc_otg_urb->qtd; ++ BUG_ON(!urb_qtd); ++#endif ++ qh = urb_qtd->qh; ++ BUG_ON(!qh); ++ if (CHK_DEBUG_LEVEL(DBG_HCDV | DBG_HCD_URB)) { ++ if (urb_qtd->in_process) { ++ dump_channel_info(hcd, qh); ++ } ++ } ++#ifdef DEBUG /* integrity checks (Broadcom) */ ++ if (hcd->core_if == NULL) { ++ DWC_ERROR("**** DWC OTG HCD URB Dequeue HCD has NULL core_if\n"); ++ return -DWC_E_INVALID; ++ } ++#endif ++ if (urb_qtd->in_process && qh->channel) { ++ /* The QTD is in process (it has been assigned to a channel). */ ++ if (hcd->flags.b.port_connect_status) { ++ int n = qh->channel->hc_num; ++ /* ++ * If still connected (i.e. in host mode), halt the ++ * channel so it can be used for other transfers. If ++ * no longer connected, the host registers can't be ++ * written to halt the channel since the core is in ++ * device mode. ++ */ ++ /* In FIQ FSM mode, we need to shut down carefully. ++ * The FIQ may attempt to restart a disabled channel */ ++ if (fiq_fsm_enable && (hcd->fiq_state->channel[n].fsm != FIQ_PASSTHROUGH)) { ++ qh->channel->halt_status = DWC_OTG_HC_XFER_URB_DEQUEUE; ++ qh->channel->halt_pending = 1; ++ hcd->fiq_state->channel[n].fsm = FIQ_DEQUEUE_ISSUED; ++ } else { ++ dwc_otg_hc_halt(hcd->core_if, qh->channel, ++ DWC_OTG_HC_XFER_URB_DEQUEUE); ++ } ++ } ++ } ++ ++ /* ++ * Free the QTD and clean up the associated QH. Leave the QH in the ++ * schedule if it has any remaining QTDs. ++ */ ++ ++ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD URB Dequeue - " ++ "delete %sQueue handler\n", ++ hcd->core_if->dma_desc_enable?"DMA ":""); ++ if (!hcd->core_if->dma_desc_enable) { ++ uint8_t b = urb_qtd->in_process; ++ dwc_otg_hcd_qtd_remove_and_free(hcd, urb_qtd, qh); ++ if (b) { ++ dwc_otg_hcd_qh_deactivate(hcd, qh, 0); ++ qh->channel = NULL; ++ } else if (DWC_CIRCLEQ_EMPTY(&qh->qtd_list)) { ++ dwc_otg_hcd_qh_remove(hcd, qh); ++ } ++ } else { ++ dwc_otg_hcd_qtd_remove_and_free(hcd, urb_qtd, qh); ++ } ++ return 0; ++} ++ ++int dwc_otg_hcd_endpoint_disable(dwc_otg_hcd_t * hcd, void *ep_handle, ++ int retry) ++{ ++ dwc_otg_qh_t *qh = (dwc_otg_qh_t *) ep_handle; ++ int retval = 0; ++ dwc_irqflags_t flags; ++ ++ if (retry < 0) { ++ retval = -DWC_E_INVALID; ++ goto done; ++ } ++ ++ if (!qh) { ++ retval = -DWC_E_INVALID; ++ goto done; ++ } ++ ++ DWC_SPINLOCK_IRQSAVE(hcd->lock, &flags); ++ ++ while (!DWC_CIRCLEQ_EMPTY(&qh->qtd_list) && retry) { ++ DWC_SPINUNLOCK_IRQRESTORE(hcd->lock, flags); ++ retry--; ++ dwc_msleep(5); ++ DWC_SPINLOCK_IRQSAVE(hcd->lock, &flags); ++ } ++ ++ dwc_otg_hcd_qh_remove(hcd, qh); ++ ++ DWC_SPINUNLOCK_IRQRESTORE(hcd->lock, flags); ++ /* ++ * Split dwc_otg_hcd_qh_remove_and_free() into qh_remove ++ * and qh_free to prevent stack dump on DWC_DMA_FREE() with ++ * irq_disabled (spinlock_irqsave) in dwc_otg_hcd_desc_list_free() ++ * and dwc_otg_hcd_frame_list_alloc(). ++ */ ++ dwc_otg_hcd_qh_free(hcd, qh); ++ ++done: ++ return retval; ++} ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,30) ++int dwc_otg_hcd_endpoint_reset(dwc_otg_hcd_t * hcd, void *ep_handle) ++{ ++ int retval = 0; ++ dwc_otg_qh_t *qh = (dwc_otg_qh_t *) ep_handle; ++ if (!qh) ++ return -DWC_E_INVALID; ++ ++ qh->data_toggle = DWC_OTG_HC_PID_DATA0; ++ return retval; ++} ++#endif ++ ++/** ++ * HCD Callback structure for handling mode switching. ++ */ ++static dwc_otg_cil_callbacks_t hcd_cil_callbacks = { ++ .start = dwc_otg_hcd_start_cb, ++ .stop = dwc_otg_hcd_stop_cb, ++ .disconnect = dwc_otg_hcd_disconnect_cb, ++ .session_start = dwc_otg_hcd_session_start_cb, ++ .resume_wakeup = dwc_otg_hcd_rem_wakeup_cb, ++#ifdef CONFIG_USB_DWC_OTG_LPM ++ .sleep = dwc_otg_hcd_sleep_cb, ++#endif ++ .p = 0, ++}; ++ ++/** ++ * Reset tasklet function ++ */ ++static void reset_tasklet_func(void *data) ++{ ++ dwc_otg_hcd_t *dwc_otg_hcd = (dwc_otg_hcd_t *) data; ++ dwc_otg_core_if_t *core_if = dwc_otg_hcd->core_if; ++ hprt0_data_t hprt0; ++ ++ DWC_DEBUGPL(DBG_HCDV, "USB RESET tasklet called\n"); ++ ++ hprt0.d32 = dwc_otg_read_hprt0(core_if); ++ hprt0.b.prtrst = 1; ++ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); ++ dwc_mdelay(60); ++ ++ hprt0.b.prtrst = 0; ++ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); ++ dwc_otg_hcd->flags.b.port_reset_change = 1; ++} ++ ++static void completion_tasklet_func(void *ptr) ++{ ++ dwc_otg_hcd_t *hcd = (dwc_otg_hcd_t *) ptr; ++ struct urb *urb; ++ urb_tq_entry_t *item; ++ dwc_irqflags_t flags; ++ ++ /* This could just be spin_lock_irq */ ++ DWC_SPINLOCK_IRQSAVE(hcd->lock, &flags); ++ while (!DWC_TAILQ_EMPTY(&hcd->completed_urb_list)) { ++ item = DWC_TAILQ_FIRST(&hcd->completed_urb_list); ++ urb = item->urb; ++ DWC_TAILQ_REMOVE(&hcd->completed_urb_list, item, ++ urb_tq_entries); ++ DWC_SPINUNLOCK_IRQRESTORE(hcd->lock, flags); ++ DWC_FREE(item); ++ ++ usb_hcd_giveback_urb(hcd->priv, urb, urb->status); ++ ++ ++ DWC_SPINLOCK_IRQSAVE(hcd->lock, &flags); ++ } ++ DWC_SPINUNLOCK_IRQRESTORE(hcd->lock, flags); ++ return; ++} ++ ++static void qh_list_free(dwc_otg_hcd_t * hcd, dwc_list_link_t * qh_list) ++{ ++ dwc_list_link_t *item; ++ dwc_otg_qh_t *qh; ++ dwc_irqflags_t flags; ++ ++ if (!qh_list->next) { ++ /* The list hasn't been initialized yet. */ ++ return; ++ } ++ /* ++ * Hold spinlock here. Not needed in that case if bellow ++ * function is being called from ISR ++ */ ++ DWC_SPINLOCK_IRQSAVE(hcd->lock, &flags); ++ /* Ensure there are no QTDs or URBs left. */ ++ kill_urbs_in_qh_list(hcd, qh_list); ++ DWC_SPINUNLOCK_IRQRESTORE(hcd->lock, flags); ++ ++ DWC_LIST_FOREACH(item, qh_list) { ++ qh = DWC_LIST_ENTRY(item, dwc_otg_qh_t, qh_list_entry); ++ dwc_otg_hcd_qh_remove_and_free(hcd, qh); ++ } ++} ++ ++/** ++ * Exit from Hibernation if Host did not detect SRP from connected SRP capable ++ * Device during SRP time by host power up. ++ */ ++void dwc_otg_hcd_power_up(void *ptr) ++{ ++ gpwrdn_data_t gpwrdn = {.d32 = 0 }; ++ dwc_otg_core_if_t *core_if = (dwc_otg_core_if_t *) ptr; ++ ++ DWC_PRINTF("%s called\n", __FUNCTION__); ++ ++ if (!core_if->hibernation_suspend) { ++ DWC_PRINTF("Already exited from Hibernation\n"); ++ return; ++ } ++ ++ /* Switch on the voltage to the core */ ++ gpwrdn.b.pwrdnswtch = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ dwc_udelay(10); ++ ++ /* Reset the core */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pwrdnrstn = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ dwc_udelay(10); ++ ++ /* Disable power clamps */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pwrdnclmp = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ ++ /* Remove reset the core signal */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pwrdnrstn = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, 0, gpwrdn.d32); ++ dwc_udelay(10); ++ ++ /* Disable PMU interrupt */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pmuintsel = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ ++ core_if->hibernation_suspend = 0; ++ ++ /* Disable PMU */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pmuactv = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ dwc_udelay(10); ++ ++ /* Enable VBUS */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.dis_vbus = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ ++ core_if->op_state = A_HOST; ++ dwc_otg_core_init(core_if); ++ dwc_otg_enable_global_interrupts(core_if); ++ cil_hcd_start(core_if); ++} ++ ++void dwc_otg_cleanup_fiq_channel(dwc_otg_hcd_t *hcd, uint32_t num) ++{ ++ struct fiq_channel_state *st = &hcd->fiq_state->channel[num]; ++ struct fiq_dma_blob *blob = hcd->fiq_dmab; ++ int i; ++ ++ st->fsm = FIQ_PASSTHROUGH; ++ st->hcchar_copy.d32 = 0; ++ st->hcsplt_copy.d32 = 0; ++ st->hcint_copy.d32 = 0; ++ st->hcintmsk_copy.d32 = 0; ++ st->hctsiz_copy.d32 = 0; ++ st->hcdma_copy.d32 = 0; ++ st->nr_errors = 0; ++ st->hub_addr = 0; ++ st->port_addr = 0; ++ st->expected_uframe = 0; ++ st->nrpackets = 0; ++ st->dma_info.index = 0; ++ for (i = 0; i < 6; i++) ++ st->dma_info.slot_len[i] = 255; ++ st->hs_isoc_info.index = 0; ++ st->hs_isoc_info.iso_desc = NULL; ++ st->hs_isoc_info.nrframes = 0; ++ ++ DWC_MEMSET(&blob->channel[num].index[0], 0x6b, 1128); ++} ++ ++/** ++ * Frees secondary storage associated with the dwc_otg_hcd structure contained ++ * in the struct usb_hcd field. ++ */ ++static void dwc_otg_hcd_free(dwc_otg_hcd_t * dwc_otg_hcd) ++{ ++ int i; ++ ++ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD FREE\n"); ++ ++ del_timers(dwc_otg_hcd); ++ ++ /* Free memory for QH/QTD lists */ ++ qh_list_free(dwc_otg_hcd, &dwc_otg_hcd->non_periodic_sched_inactive); ++ qh_list_free(dwc_otg_hcd, &dwc_otg_hcd->non_periodic_sched_active); ++ qh_list_free(dwc_otg_hcd, &dwc_otg_hcd->periodic_sched_inactive); ++ qh_list_free(dwc_otg_hcd, &dwc_otg_hcd->periodic_sched_ready); ++ qh_list_free(dwc_otg_hcd, &dwc_otg_hcd->periodic_sched_assigned); ++ qh_list_free(dwc_otg_hcd, &dwc_otg_hcd->periodic_sched_queued); ++ ++ /* Free memory for the host channels. */ ++ for (i = 0; i < MAX_EPS_CHANNELS; i++) { ++ dwc_hc_t *hc = dwc_otg_hcd->hc_ptr_array[i]; ++ ++#ifdef DEBUG ++ if (dwc_otg_hcd->core_if->hc_xfer_timer[i]) { ++ DWC_TIMER_FREE(dwc_otg_hcd->core_if->hc_xfer_timer[i]); ++ } ++#endif ++ if (hc != NULL) { ++ DWC_DEBUGPL(DBG_HCDV, "HCD Free channel #%i, hc=%p\n", ++ i, hc); ++ DWC_FREE(hc); ++ } ++ } ++ ++ if (dwc_otg_hcd->core_if->dma_enable) { ++ if (dwc_otg_hcd->status_buf_dma) { ++ DWC_DMA_FREE(DWC_OTG_HCD_STATUS_BUF_SIZE, ++ dwc_otg_hcd->status_buf, ++ dwc_otg_hcd->status_buf_dma); ++ } ++ } else if (dwc_otg_hcd->status_buf != NULL) { ++ DWC_FREE(dwc_otg_hcd->status_buf); ++ } ++ DWC_SPINLOCK_FREE(dwc_otg_hcd->channel_lock); ++ DWC_SPINLOCK_FREE(dwc_otg_hcd->lock); ++ /* Set core_if's lock pointer to NULL */ ++ dwc_otg_hcd->core_if->lock = NULL; ++ ++ DWC_TIMER_FREE(dwc_otg_hcd->conn_timer); ++ DWC_TASK_FREE(dwc_otg_hcd->reset_tasklet); ++ DWC_TASK_FREE(dwc_otg_hcd->completion_tasklet); ++ DWC_FREE(dwc_otg_hcd->fiq_state); ++ ++#ifdef DWC_DEV_SRPCAP ++ if (dwc_otg_hcd->core_if->power_down == 2 && ++ dwc_otg_hcd->core_if->pwron_timer) { ++ DWC_TIMER_FREE(dwc_otg_hcd->core_if->pwron_timer); ++ } ++#endif ++ DWC_FREE(dwc_otg_hcd); ++} ++ ++int init_hcd_usecs(dwc_otg_hcd_t *_hcd); ++ ++int dwc_otg_hcd_init(dwc_otg_hcd_t * hcd, dwc_otg_core_if_t * core_if) ++{ ++ int retval = 0; ++ int num_channels; ++ int i; ++ dwc_hc_t *channel; ++ ++#if (defined(DWC_LINUX) && defined(CONFIG_DEBUG_SPINLOCK)) ++ DWC_SPINLOCK_ALLOC_LINUX_DEBUG(hcd->lock); ++ DWC_SPINLOCK_ALLOC_LINUX_DEBUG(hcd->channel_lock); ++#else ++ hcd->lock = DWC_SPINLOCK_ALLOC(); ++ hcd->channel_lock = DWC_SPINLOCK_ALLOC(); ++#endif ++ DWC_DEBUGPL(DBG_HCDV, "init of HCD %p given core_if %p\n", ++ hcd, core_if); ++ if (!hcd->lock) { ++ DWC_ERROR("Could not allocate lock for pcd"); ++ DWC_FREE(hcd); ++ retval = -DWC_E_NO_MEMORY; ++ goto out; ++ } ++ hcd->core_if = core_if; ++ ++ /* Register the HCD CIL Callbacks */ ++ dwc_otg_cil_register_hcd_callbacks(hcd->core_if, ++ &hcd_cil_callbacks, hcd); ++ ++ /* Initialize the non-periodic schedule. */ ++ DWC_LIST_INIT(&hcd->non_periodic_sched_inactive); ++ DWC_LIST_INIT(&hcd->non_periodic_sched_active); ++ ++ /* Initialize the periodic schedule. */ ++ DWC_LIST_INIT(&hcd->periodic_sched_inactive); ++ DWC_LIST_INIT(&hcd->periodic_sched_ready); ++ DWC_LIST_INIT(&hcd->periodic_sched_assigned); ++ DWC_LIST_INIT(&hcd->periodic_sched_queued); ++ DWC_TAILQ_INIT(&hcd->completed_urb_list); ++ /* ++ * Create a host channel descriptor for each host channel implemented ++ * in the controller. Initialize the channel descriptor array. ++ */ ++ DWC_CIRCLEQ_INIT(&hcd->free_hc_list); ++ num_channels = hcd->core_if->core_params->host_channels; ++ DWC_MEMSET(hcd->hc_ptr_array, 0, sizeof(hcd->hc_ptr_array)); ++ for (i = 0; i < num_channels; i++) { ++ channel = DWC_ALLOC(sizeof(dwc_hc_t)); ++ if (channel == NULL) { ++ retval = -DWC_E_NO_MEMORY; ++ DWC_ERROR("%s: host channel allocation failed\n", ++ __func__); ++ dwc_otg_hcd_free(hcd); ++ goto out; ++ } ++ channel->hc_num = i; ++ hcd->hc_ptr_array[i] = channel; ++#ifdef DEBUG ++ hcd->core_if->hc_xfer_timer[i] = ++ DWC_TIMER_ALLOC("hc timer", hc_xfer_timeout, ++ &hcd->core_if->hc_xfer_info[i]); ++#endif ++ DWC_DEBUGPL(DBG_HCDV, "HCD Added channel #%d, hc=%p\n", i, ++ channel); ++ } ++ ++ if (fiq_enable) { ++ hcd->fiq_state = DWC_ALLOC(sizeof(struct fiq_state) + (sizeof(struct fiq_channel_state) * num_channels)); ++ if (!hcd->fiq_state) { ++ retval = -DWC_E_NO_MEMORY; ++ DWC_ERROR("%s: cannot allocate fiq_state structure\n", __func__); ++ dwc_otg_hcd_free(hcd); ++ goto out; ++ } ++ DWC_MEMSET(hcd->fiq_state, 0, (sizeof(struct fiq_state) + (sizeof(struct fiq_channel_state) * num_channels))); ++ ++ for (i = 0; i < num_channels; i++) { ++ hcd->fiq_state->channel[i].fsm = FIQ_PASSTHROUGH; ++ } ++ hcd->fiq_state->dummy_send = DWC_ALLOC_ATOMIC(16); ++ ++ hcd->fiq_stack = DWC_ALLOC(sizeof(struct fiq_stack)); ++ if (!hcd->fiq_stack) { ++ retval = -DWC_E_NO_MEMORY; ++ DWC_ERROR("%s: cannot allocate fiq_stack structure\n", __func__); ++ dwc_otg_hcd_free(hcd); ++ goto out; ++ } ++ hcd->fiq_stack->magic1 = 0xDEADBEEF; ++ hcd->fiq_stack->magic2 = 0xD00DFEED; ++ hcd->fiq_state->gintmsk_saved.d32 = ~0; ++ hcd->fiq_state->haintmsk_saved.b2.chint = ~0; ++ ++ /* This bit is terrible and uses no API, but necessary. The FIQ has no concept of DMA pools ++ * (and if it did, would be a lot slower). This allocates a chunk of memory (~9kiB for 8 host channels) ++ * for use as transaction bounce buffers in a 2-D array. Our access into this chunk is done by some ++ * moderately readable array casts. ++ */ ++ hcd->fiq_dmab = DWC_DMA_ALLOC((sizeof(struct fiq_dma_channel) * num_channels), &hcd->fiq_state->dma_base); ++ DWC_WARN("FIQ DMA bounce buffers: virt = 0x%08x dma = 0x%08x len=%d", ++ (unsigned int)hcd->fiq_dmab, (unsigned int)hcd->fiq_state->dma_base, ++ sizeof(struct fiq_dma_channel) * num_channels); ++ ++ DWC_MEMSET(hcd->fiq_dmab, 0x6b, 9024); ++ ++ /* pointer for debug in fiq_print */ ++ hcd->fiq_state->fiq_dmab = hcd->fiq_dmab; ++ if (fiq_fsm_enable) { ++ int i; ++ for (i=0; i < hcd->core_if->core_params->host_channels; i++) { ++ dwc_otg_cleanup_fiq_channel(hcd, i); ++ } ++ DWC_PRINTF("FIQ FSM acceleration enabled for :\n%s%s%s%s", ++ (fiq_fsm_mask & 0x1) ? "Non-periodic Split Transactions\n" : "", ++ (fiq_fsm_mask & 0x2) ? "Periodic Split Transactions\n" : "", ++ (fiq_fsm_mask & 0x4) ? "High-Speed Isochronous Endpoints\n" : "", ++ (fiq_fsm_mask & 0x8) ? "Interrupt/Control Split Transaction hack enabled\n" : ""); ++ } ++ } ++ ++ /* Initialize the Connection timeout timer. */ ++ hcd->conn_timer = DWC_TIMER_ALLOC("Connection timer", ++ dwc_otg_hcd_connect_timeout, 0); ++ ++ printk(KERN_DEBUG "dwc_otg: Microframe scheduler %s\n", microframe_schedule ? "enabled":"disabled"); ++ if (microframe_schedule) ++ init_hcd_usecs(hcd); ++ ++ /* Initialize reset tasklet. */ ++ hcd->reset_tasklet = DWC_TASK_ALLOC("reset_tasklet", reset_tasklet_func, hcd); ++ ++ hcd->completion_tasklet = DWC_TASK_ALLOC("completion_tasklet", ++ completion_tasklet_func, hcd); ++#ifdef DWC_DEV_SRPCAP ++ if (hcd->core_if->power_down == 2) { ++ /* Initialize Power on timer for Host power up in case hibernation */ ++ hcd->core_if->pwron_timer = DWC_TIMER_ALLOC("PWRON TIMER", ++ dwc_otg_hcd_power_up, core_if); ++ } ++#endif ++ ++ /* ++ * Allocate space for storing data on status transactions. Normally no ++ * data is sent, but this space acts as a bit bucket. This must be ++ * done after usb_add_hcd since that function allocates the DMA buffer ++ * pool. ++ */ ++ if (hcd->core_if->dma_enable) { ++ hcd->status_buf = ++ DWC_DMA_ALLOC(DWC_OTG_HCD_STATUS_BUF_SIZE, ++ &hcd->status_buf_dma); ++ } else { ++ hcd->status_buf = DWC_ALLOC(DWC_OTG_HCD_STATUS_BUF_SIZE); ++ } ++ if (!hcd->status_buf) { ++ retval = -DWC_E_NO_MEMORY; ++ DWC_ERROR("%s: status_buf allocation failed\n", __func__); ++ dwc_otg_hcd_free(hcd); ++ goto out; ++ } ++ ++ hcd->otg_port = 1; ++ hcd->frame_list = NULL; ++ hcd->frame_list_dma = 0; ++ hcd->periodic_qh_count = 0; ++ ++ DWC_MEMSET(hcd->hub_port, 0, sizeof(hcd->hub_port)); ++#ifdef FIQ_DEBUG ++ DWC_MEMSET(hcd->hub_port_alloc, -1, sizeof(hcd->hub_port_alloc)); ++#endif ++ ++out: ++ return retval; ++} ++ ++void dwc_otg_hcd_remove(dwc_otg_hcd_t * hcd) ++{ ++ /* Turn off all host-specific interrupts. */ ++ dwc_otg_disable_host_interrupts(hcd->core_if); ++ ++ dwc_otg_hcd_free(hcd); ++} ++ ++/** ++ * Initializes dynamic portions of the DWC_otg HCD state. ++ */ ++static void dwc_otg_hcd_reinit(dwc_otg_hcd_t * hcd) ++{ ++ int num_channels; ++ int i; ++ dwc_hc_t *channel; ++ dwc_hc_t *channel_tmp; ++ ++ hcd->flags.d32 = 0; ++ ++ hcd->non_periodic_qh_ptr = &hcd->non_periodic_sched_active; ++ if (!microframe_schedule) { ++ hcd->non_periodic_channels = 0; ++ hcd->periodic_channels = 0; ++ } else { ++ hcd->available_host_channels = hcd->core_if->core_params->host_channels; ++ } ++ /* ++ * Put all channels in the free channel list and clean up channel ++ * states. ++ */ ++ DWC_CIRCLEQ_FOREACH_SAFE(channel, channel_tmp, ++ &hcd->free_hc_list, hc_list_entry) { ++ DWC_CIRCLEQ_REMOVE(&hcd->free_hc_list, channel, hc_list_entry); ++ } ++ ++ num_channels = hcd->core_if->core_params->host_channels; ++ for (i = 0; i < num_channels; i++) { ++ channel = hcd->hc_ptr_array[i]; ++ DWC_CIRCLEQ_INSERT_TAIL(&hcd->free_hc_list, channel, ++ hc_list_entry); ++ dwc_otg_hc_cleanup(hcd->core_if, channel); ++ } ++ ++ /* Initialize the DWC core for host mode operation. */ ++ dwc_otg_core_host_init(hcd->core_if); ++ ++ /* Set core_if's lock pointer to the hcd->lock */ ++ hcd->core_if->lock = hcd->lock; ++} ++ ++/** ++ * Assigns transactions from a QTD to a free host channel and initializes the ++ * host channel to perform the transactions. The host channel is removed from ++ * the free list. ++ * ++ * @param hcd The HCD state structure. ++ * @param qh Transactions from the first QTD for this QH are selected and ++ * assigned to a free host channel. ++ */ ++static void assign_and_init_hc(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh) ++{ ++ dwc_hc_t *hc; ++ dwc_otg_qtd_t *qtd; ++ dwc_otg_hcd_urb_t *urb; ++ void* ptr = NULL; ++ uint32_t intr_enable; ++ unsigned long flags; ++ gintmsk_data_t gintmsk = { .d32 = 0, }; ++ ++ qtd = DWC_CIRCLEQ_FIRST(&qh->qtd_list); ++ ++ urb = qtd->urb; ++ ++ DWC_DEBUGPL(DBG_HCDV, "%s(%p,%p) - urb %x, actual_length %d\n", __func__, hcd, qh, (unsigned int)urb, urb->actual_length); ++ ++ if (((urb->actual_length < 0) || (urb->actual_length > urb->length)) && !dwc_otg_hcd_is_pipe_in(&urb->pipe_info)) ++ urb->actual_length = urb->length; ++ ++ ++ hc = DWC_CIRCLEQ_FIRST(&hcd->free_hc_list); ++ ++ /* Remove the host channel from the free list. */ ++ DWC_CIRCLEQ_REMOVE_INIT(&hcd->free_hc_list, hc, hc_list_entry); ++ ++ qh->channel = hc; ++ ++ qtd->in_process = 1; ++ ++ /* ++ * Use usb_pipedevice to determine device address. This address is ++ * 0 before the SET_ADDRESS command and the correct address afterward. ++ */ ++ hc->dev_addr = dwc_otg_hcd_get_dev_addr(&urb->pipe_info); ++ hc->ep_num = dwc_otg_hcd_get_ep_num(&urb->pipe_info); ++ hc->speed = qh->dev_speed; ++ hc->max_packet = dwc_max_packet(qh->maxp); ++ ++ hc->xfer_started = 0; ++ hc->halt_status = DWC_OTG_HC_XFER_NO_HALT_STATUS; ++ hc->error_state = (qtd->error_count > 0); ++ hc->halt_on_queue = 0; ++ hc->halt_pending = 0; ++ hc->requests = 0; ++ ++ /* ++ * The following values may be modified in the transfer type section ++ * below. The xfer_len value may be reduced when the transfer is ++ * started to accommodate the max widths of the XferSize and PktCnt ++ * fields in the HCTSIZn register. ++ */ ++ ++ hc->ep_is_in = (dwc_otg_hcd_is_pipe_in(&urb->pipe_info) != 0); ++ if (hc->ep_is_in) { ++ hc->do_ping = 0; ++ } else { ++ hc->do_ping = qh->ping_state; ++ } ++ ++ hc->data_pid_start = qh->data_toggle; ++ hc->multi_count = 1; ++ ++ if (hcd->core_if->dma_enable) { ++ hc->xfer_buff = (uint8_t *) urb->dma + urb->actual_length; ++ ++ /* For non-dword aligned case */ ++ if (((unsigned long)hc->xfer_buff & 0x3) ++ && !hcd->core_if->dma_desc_enable) { ++ ptr = (uint8_t *) urb->buf + urb->actual_length; ++ } ++ } else { ++ hc->xfer_buff = (uint8_t *) urb->buf + urb->actual_length; ++ } ++ hc->xfer_len = urb->length - urb->actual_length; ++ hc->xfer_count = 0; ++ ++ /* ++ * Set the split attributes ++ */ ++ hc->do_split = 0; ++ if (qh->do_split) { ++ uint32_t hub_addr, port_addr; ++ hc->do_split = 1; ++ hc->xact_pos = qtd->isoc_split_pos; ++ /* We don't need to do complete splits anymore */ ++// if(fiq_fsm_enable) ++ if (0) ++ hc->complete_split = qtd->complete_split = 0; ++ else ++ hc->complete_split = qtd->complete_split; ++ ++ hcd->fops->hub_info(hcd, urb->priv, &hub_addr, &port_addr); ++ hc->hub_addr = (uint8_t) hub_addr; ++ hc->port_addr = (uint8_t) port_addr; ++ } ++ ++ switch (dwc_otg_hcd_get_pipe_type(&urb->pipe_info)) { ++ case UE_CONTROL: ++ hc->ep_type = DWC_OTG_EP_TYPE_CONTROL; ++ switch (qtd->control_phase) { ++ case DWC_OTG_CONTROL_SETUP: ++ DWC_DEBUGPL(DBG_HCDV, " Control setup transaction\n"); ++ hc->do_ping = 0; ++ hc->ep_is_in = 0; ++ hc->data_pid_start = DWC_OTG_HC_PID_SETUP; ++ if (hcd->core_if->dma_enable) { ++ hc->xfer_buff = (uint8_t *) urb->setup_dma; ++ } else { ++ hc->xfer_buff = (uint8_t *) urb->setup_packet; ++ } ++ hc->xfer_len = 8; ++ ptr = NULL; ++ break; ++ case DWC_OTG_CONTROL_DATA: ++ DWC_DEBUGPL(DBG_HCDV, " Control data transaction\n"); ++ hc->data_pid_start = qtd->data_toggle; ++ break; ++ case DWC_OTG_CONTROL_STATUS: ++ /* ++ * Direction is opposite of data direction or IN if no ++ * data. ++ */ ++ DWC_DEBUGPL(DBG_HCDV, " Control status transaction\n"); ++ if (urb->length == 0) { ++ hc->ep_is_in = 1; ++ } else { ++ hc->ep_is_in = ++ dwc_otg_hcd_is_pipe_out(&urb->pipe_info); ++ } ++ if (hc->ep_is_in) { ++ hc->do_ping = 0; ++ } ++ ++ hc->data_pid_start = DWC_OTG_HC_PID_DATA1; ++ ++ hc->xfer_len = 0; ++ if (hcd->core_if->dma_enable) { ++ hc->xfer_buff = (uint8_t *) hcd->status_buf_dma; ++ } else { ++ hc->xfer_buff = (uint8_t *) hcd->status_buf; ++ } ++ ptr = NULL; ++ break; ++ } ++ break; ++ case UE_BULK: ++ hc->ep_type = DWC_OTG_EP_TYPE_BULK; ++ break; ++ case UE_INTERRUPT: ++ hc->ep_type = DWC_OTG_EP_TYPE_INTR; ++ break; ++ case UE_ISOCHRONOUS: ++ { ++ struct dwc_otg_hcd_iso_packet_desc *frame_desc; ++ ++ hc->ep_type = DWC_OTG_EP_TYPE_ISOC; ++ ++ if (hcd->core_if->dma_desc_enable) ++ break; ++ ++ frame_desc = &urb->iso_descs[qtd->isoc_frame_index]; ++ ++ frame_desc->status = 0; ++ ++ if (hcd->core_if->dma_enable) { ++ hc->xfer_buff = (uint8_t *) urb->dma; ++ } else { ++ hc->xfer_buff = (uint8_t *) urb->buf; ++ } ++ hc->xfer_buff += ++ frame_desc->offset + qtd->isoc_split_offset; ++ hc->xfer_len = ++ frame_desc->length - qtd->isoc_split_offset; ++ ++ /* For non-dword aligned buffers */ ++ if (((unsigned long)hc->xfer_buff & 0x3) ++ && hcd->core_if->dma_enable) { ++ ptr = ++ (uint8_t *) urb->buf + frame_desc->offset + ++ qtd->isoc_split_offset; ++ } else ++ ptr = NULL; ++ ++ if (hc->xact_pos == DWC_HCSPLIT_XACTPOS_ALL) { ++ if (hc->xfer_len <= 188) { ++ hc->xact_pos = DWC_HCSPLIT_XACTPOS_ALL; ++ } else { ++ hc->xact_pos = ++ DWC_HCSPLIT_XACTPOS_BEGIN; ++ } ++ } ++ } ++ break; ++ } ++ /* non DWORD-aligned buffer case */ ++ if (ptr) { ++ uint32_t buf_size; ++ if (hc->ep_type != DWC_OTG_EP_TYPE_ISOC) { ++ buf_size = hcd->core_if->core_params->max_transfer_size; ++ } else { ++ buf_size = 4096; ++ } ++ if (!qh->dw_align_buf) { ++ qh->dw_align_buf = DWC_DMA_ALLOC_ATOMIC(buf_size, ++ &qh->dw_align_buf_dma); ++ if (!qh->dw_align_buf) { ++ DWC_ERROR ++ ("%s: Failed to allocate memory to handle " ++ "non-dword aligned buffer case\n", ++ __func__); ++ return; ++ } ++ } ++ if (!hc->ep_is_in) { ++ dwc_memcpy(qh->dw_align_buf, ptr, hc->xfer_len); ++ } ++ hc->align_buff = qh->dw_align_buf_dma; ++ } else { ++ hc->align_buff = 0; ++ } ++ ++ if (hc->ep_type == DWC_OTG_EP_TYPE_INTR || ++ hc->ep_type == DWC_OTG_EP_TYPE_ISOC) { ++ /* ++ * This value may be modified when the transfer is started to ++ * reflect the actual transfer length. ++ */ ++ hc->multi_count = dwc_hb_mult(qh->maxp); ++ } ++ ++ if (hcd->core_if->dma_desc_enable) ++ hc->desc_list_addr = qh->desc_list_dma; ++ ++ dwc_otg_hc_init(hcd->core_if, hc); ++ ++ local_irq_save(flags); ++ ++ if (fiq_enable) { ++ local_fiq_disable(); ++ fiq_fsm_spin_lock(&hcd->fiq_state->lock); ++ } ++ ++ /* Enable the top level host channel interrupt. */ ++ intr_enable = (1 << hc->hc_num); ++ DWC_MODIFY_REG32(&hcd->core_if->host_if->host_global_regs->haintmsk, 0, intr_enable); ++ ++ /* Make sure host channel interrupts are enabled. */ ++ gintmsk.b.hcintr = 1; ++ DWC_MODIFY_REG32(&hcd->core_if->core_global_regs->gintmsk, 0, gintmsk.d32); ++ ++ if (fiq_enable) { ++ fiq_fsm_spin_unlock(&hcd->fiq_state->lock); ++ local_fiq_enable(); ++ } ++ ++ local_irq_restore(flags); ++ hc->qh = qh; ++} ++ ++ ++/** ++ * fiq_fsm_transaction_suitable() - Test a QH for compatibility with the FIQ ++ * @qh: pointer to the endpoint's queue head ++ * ++ * Transaction start/end control flow is grafted onto the existing dwc_otg ++ * mechanisms, to avoid spaghettifying the functions more than they already are. ++ * This function's eligibility check is altered by debug parameter. ++ * ++ * Returns: 0 for unsuitable, 1 implies the FIQ can be enabled for this transaction. ++ */ ++ ++int fiq_fsm_transaction_suitable(dwc_otg_qh_t *qh) ++{ ++ if (qh->do_split) { ++ switch (qh->ep_type) { ++ case UE_CONTROL: ++ case UE_BULK: ++ if (fiq_fsm_mask & (1 << 0)) ++ return 1; ++ break; ++ case UE_INTERRUPT: ++ case UE_ISOCHRONOUS: ++ if (fiq_fsm_mask & (1 << 1)) ++ return 1; ++ break; ++ default: ++ break; ++ } ++ } else if (qh->ep_type == UE_ISOCHRONOUS) { ++ if (fiq_fsm_mask & (1 << 2)) { ++ /* HS ISOCH support. We test for compatibility: ++ * - DWORD aligned buffers ++ * - Must be at least 2 transfers (otherwise pointless to use the FIQ) ++ * If yes, then the fsm enqueue function will handle the state machine setup. ++ */ ++ dwc_otg_qtd_t *qtd = DWC_CIRCLEQ_FIRST(&qh->qtd_list); ++ dwc_otg_hcd_urb_t *urb = qtd->urb; ++ struct dwc_otg_hcd_iso_packet_desc (*iso_descs)[0] = &urb->iso_descs; ++ int nr_iso_frames = urb->packet_count; ++ int i; ++ uint32_t ptr; ++ ++ if (nr_iso_frames < 2) ++ return 0; ++ for (i = 0; i < nr_iso_frames; i++) { ++ ptr = urb->dma + iso_descs[i]->offset; ++ if (ptr & 0x3) { ++ printk_ratelimited("%s: Non-Dword aligned isochronous frame offset." ++ " Cannot queue FIQ-accelerated transfer to device %d endpoint %d\n", ++ __FUNCTION__, qh->channel->dev_addr, qh->channel->ep_num); ++ return 0; ++ } ++ } ++ return 1; ++ } ++ } ++ return 0; ++} ++ ++/** ++ * fiq_fsm_setup_periodic_dma() - Set up DMA bounce buffers ++ * @hcd: Pointer to the dwc_otg_hcd struct ++ * @qh: Pointer to the endpoint's queue head ++ * ++ * Periodic split transactions are transmitted modulo 188 bytes. ++ * This necessitates slicing data up into buckets for isochronous out ++ * and fixing up the DMA address for all IN transfers. ++ * ++ * Returns 1 if the DMA bounce buffers have been used, 0 if the default ++ * HC buffer has been used. ++ */ ++int fiq_fsm_setup_periodic_dma(dwc_otg_hcd_t *hcd, struct fiq_channel_state *st, dwc_otg_qh_t *qh) ++ { ++ int frame_length, i = 0; ++ uint8_t *ptr = NULL; ++ dwc_hc_t *hc = qh->channel; ++ struct fiq_dma_blob *blob; ++ struct dwc_otg_hcd_iso_packet_desc *frame_desc; ++ ++ for (i = 0; i < 6; i++) { ++ st->dma_info.slot_len[i] = 255; ++ } ++ st->dma_info.index = 0; ++ i = 0; ++ if (hc->ep_is_in) { ++ /* ++ * Set dma_regs to bounce buffer. FIQ will update the ++ * state depending on transaction progress. ++ */ ++ blob = (struct fiq_dma_blob *) hcd->fiq_state->dma_base; ++ st->hcdma_copy.d32 = (uint32_t) &blob->channel[hc->hc_num].index[0].buf[0]; ++ /* Calculate the max number of CSPLITS such that the FIQ can time out ++ * a transaction if it fails. ++ */ ++ frame_length = st->hcchar_copy.b.mps; ++ do { ++ i++; ++ frame_length -= 188; ++ } while (frame_length >= 0); ++ st->nrpackets = i; ++ return 1; ++ } else { ++ if (qh->ep_type == UE_ISOCHRONOUS) { ++ ++ dwc_otg_qtd_t *qtd = DWC_CIRCLEQ_FIRST(&qh->qtd_list); ++ ++ frame_desc = &qtd->urb->iso_descs[qtd->isoc_frame_index]; ++ frame_length = frame_desc->length; ++ ++ /* Virtual address for bounce buffers */ ++ blob = hcd->fiq_dmab; ++ ++ ptr = qtd->urb->buf + frame_desc->offset; ++ if (frame_length == 0) { ++ /* ++ * for isochronous transactions, we must still transmit a packet ++ * even if the length is zero. ++ */ ++ st->dma_info.slot_len[0] = 0; ++ st->nrpackets = 1; ++ } else { ++ do { ++ if (frame_length <= 188) { ++ dwc_memcpy(&blob->channel[hc->hc_num].index[i].buf[0], ptr, frame_length); ++ st->dma_info.slot_len[i] = frame_length; ++ ptr += frame_length; ++ } else { ++ dwc_memcpy(&blob->channel[hc->hc_num].index[i].buf[0], ptr, 188); ++ st->dma_info.slot_len[i] = 188; ++ ptr += 188; ++ } ++ i++; ++ frame_length -= 188; ++ } while (frame_length > 0); ++ st->nrpackets = i; ++ } ++ ptr = qtd->urb->buf + frame_desc->offset; ++ /* Point the HC at the DMA address of the bounce buffers */ ++ blob = (struct fiq_dma_blob *) hcd->fiq_state->dma_base; ++ st->hcdma_copy.d32 = (uint32_t) &blob->channel[hc->hc_num].index[0].buf[0]; ++ ++ /* fixup xfersize to the actual packet size */ ++ st->hctsiz_copy.b.pid = 0; ++ st->hctsiz_copy.b.xfersize = st->dma_info.slot_len[0]; ++ return 1; ++ } else { ++ /* For interrupt, single OUT packet required, goes in the SSPLIT from hc_buff. */ ++ return 0; ++ } ++ } ++} ++ ++/* ++ * Pushing a periodic request into the queue near the EOF1 point ++ * in a microframe causes erroneous behaviour (frmovrun) interrupt. ++ * Usually, the request goes out on the bus causing a transfer but ++ * the core does not transfer the data to memory. ++ * This guard interval (in number of 60MHz clocks) is required which ++ * must cater for CPU latency between reading the value and enabling ++ * the channel. ++ */ ++#define PERIODIC_FRREM_BACKOFF 1000 ++ ++int fiq_fsm_queue_isoc_transaction(dwc_otg_hcd_t *hcd, dwc_otg_qh_t *qh) ++{ ++ dwc_hc_t *hc = qh->channel; ++ dwc_otg_hc_regs_t *hc_regs = hcd->core_if->host_if->hc_regs[hc->hc_num]; ++ dwc_otg_qtd_t *qtd = DWC_CIRCLEQ_FIRST(&qh->qtd_list); ++ int frame; ++ struct fiq_channel_state *st = &hcd->fiq_state->channel[hc->hc_num]; ++ int xfer_len, nrpackets; ++ hcdma_data_t hcdma; ++ hfnum_data_t hfnum; ++ ++ if (st->fsm != FIQ_PASSTHROUGH) ++ return 0; ++ ++ st->nr_errors = 0; ++ ++ st->hcchar_copy.d32 = 0; ++ st->hcchar_copy.b.mps = hc->max_packet; ++ st->hcchar_copy.b.epdir = hc->ep_is_in; ++ st->hcchar_copy.b.devaddr = hc->dev_addr; ++ st->hcchar_copy.b.epnum = hc->ep_num; ++ st->hcchar_copy.b.eptype = hc->ep_type; ++ ++ st->hcintmsk_copy.b.chhltd = 1; ++ ++ frame = dwc_otg_hcd_get_frame_number(hcd); ++ st->hcchar_copy.b.oddfrm = (frame & 0x1) ? 0 : 1; ++ ++ st->hcchar_copy.b.lspddev = 0; ++ /* Enable the channel later as a final register write. */ ++ ++ st->hcsplt_copy.d32 = 0; ++ ++ st->hs_isoc_info.iso_desc = (struct dwc_otg_hcd_iso_packet_desc *) &qtd->urb->iso_descs; ++ st->hs_isoc_info.nrframes = qtd->urb->packet_count; ++ /* grab the next DMA address offset from the array */ ++ st->hcdma_copy.d32 = qtd->urb->dma; ++ hcdma.d32 = st->hcdma_copy.d32 + st->hs_isoc_info.iso_desc[0].offset; ++ ++ /* We need to set multi_count. This is a bit tricky - has to be set per-transaction as ++ * the core needs to be told to send the correct number. Caution: for IN transfers, ++ * this is always set to the maximum size of the endpoint. */ ++ xfer_len = st->hs_isoc_info.iso_desc[0].length; ++ nrpackets = (xfer_len + st->hcchar_copy.b.mps - 1) / st->hcchar_copy.b.mps; ++ if (nrpackets == 0) ++ nrpackets = 1; ++ st->hcchar_copy.b.multicnt = nrpackets; ++ st->hctsiz_copy.b.pktcnt = nrpackets; ++ ++ /* Initial PID also needs to be set */ ++ if (st->hcchar_copy.b.epdir == 0) { ++ st->hctsiz_copy.b.xfersize = xfer_len; ++ switch (st->hcchar_copy.b.multicnt) { ++ case 1: ++ st->hctsiz_copy.b.pid = DWC_PID_DATA0; ++ break; ++ case 2: ++ case 3: ++ st->hctsiz_copy.b.pid = DWC_PID_MDATA; ++ break; ++ } ++ ++ } else { ++ st->hctsiz_copy.b.xfersize = nrpackets * st->hcchar_copy.b.mps; ++ switch (st->hcchar_copy.b.multicnt) { ++ case 1: ++ st->hctsiz_copy.b.pid = DWC_PID_DATA0; ++ break; ++ case 2: ++ st->hctsiz_copy.b.pid = DWC_PID_DATA1; ++ break; ++ case 3: ++ st->hctsiz_copy.b.pid = DWC_PID_DATA2; ++ break; ++ } ++ } ++ ++ st->hs_isoc_info.stride = qh->interval; ++ st->uframe_sleeps = 0; ++ ++ fiq_print(FIQDBG_INT, hcd->fiq_state, "FSMQ %01d ", hc->hc_num); ++ fiq_print(FIQDBG_INT, hcd->fiq_state, "%08x", st->hcchar_copy.d32); ++ fiq_print(FIQDBG_INT, hcd->fiq_state, "%08x", st->hctsiz_copy.d32); ++ fiq_print(FIQDBG_INT, hcd->fiq_state, "%08x", st->hcdma_copy.d32); ++ hfnum.d32 = DWC_READ_REG32(&hcd->core_if->host_if->host_global_regs->hfnum); ++ local_fiq_disable(); ++ fiq_fsm_spin_lock(&hcd->fiq_state->lock); ++ DWC_WRITE_REG32(&hc_regs->hctsiz, st->hctsiz_copy.d32); ++ DWC_WRITE_REG32(&hc_regs->hcsplt, st->hcsplt_copy.d32); ++ DWC_WRITE_REG32(&hc_regs->hcdma, st->hcdma_copy.d32); ++ DWC_WRITE_REG32(&hc_regs->hcchar, st->hcchar_copy.d32); ++ DWC_WRITE_REG32(&hc_regs->hcintmsk, st->hcintmsk_copy.d32); ++ if (hfnum.b.frrem < PERIODIC_FRREM_BACKOFF) { ++ /* Prevent queueing near EOF1. Bad things happen if a periodic ++ * split transaction is queued very close to EOF. SOF interrupt handler ++ * will wake this channel at the next interrupt. ++ */ ++ st->fsm = FIQ_HS_ISOC_SLEEPING; ++ st->uframe_sleeps = 1; ++ } else { ++ st->fsm = FIQ_HS_ISOC_TURBO; ++ st->hcchar_copy.b.chen = 1; ++ DWC_WRITE_REG32(&hc_regs->hcchar, st->hcchar_copy.d32); ++ } ++ mb(); ++ st->hcchar_copy.b.chen = 0; ++ fiq_fsm_spin_unlock(&hcd->fiq_state->lock); ++ local_fiq_enable(); ++ return 0; ++} ++ ++ ++/** ++ * fiq_fsm_queue_split_transaction() - Set up a host channel and FIQ state ++ * @hcd: Pointer to the dwc_otg_hcd struct ++ * @qh: Pointer to the endpoint's queue head ++ * ++ * This overrides the dwc_otg driver's normal method of queueing a transaction. ++ * Called from dwc_otg_hcd_queue_transactions(), this performs specific setup ++ * for the nominated host channel. ++ * ++ * For periodic transfers, it also peeks at the FIQ state to see if an immediate ++ * start is possible. If not, then the FIQ is left to start the transfer. ++ */ ++int fiq_fsm_queue_split_transaction(dwc_otg_hcd_t *hcd, dwc_otg_qh_t *qh) ++{ ++ int start_immediate = 1, i; ++ hfnum_data_t hfnum; ++ dwc_hc_t *hc = qh->channel; ++ dwc_otg_hc_regs_t *hc_regs = hcd->core_if->host_if->hc_regs[hc->hc_num]; ++ /* Program HC registers, setup FIQ_state, examine FIQ if periodic, start transfer (not if uframe 5) */ ++ int hub_addr, port_addr, frame, uframe; ++ struct fiq_channel_state *st = &hcd->fiq_state->channel[hc->hc_num]; ++ ++ if (st->fsm != FIQ_PASSTHROUGH) ++ return 0; ++ st->nr_errors = 0; ++ ++ st->hcchar_copy.d32 = 0; ++ st->hcchar_copy.b.mps = hc->max_packet; ++ st->hcchar_copy.b.epdir = hc->ep_is_in; ++ st->hcchar_copy.b.devaddr = hc->dev_addr; ++ st->hcchar_copy.b.epnum = hc->ep_num; ++ st->hcchar_copy.b.eptype = hc->ep_type; ++ if (hc->ep_type & 0x1) { ++ if (hc->ep_is_in) ++ st->hcchar_copy.b.multicnt = 3; ++ else ++ /* Docs say set this to 1, but driver sets to 0! */ ++ st->hcchar_copy.b.multicnt = 0; ++ } else { ++ st->hcchar_copy.b.multicnt = 1; ++ st->hcchar_copy.b.oddfrm = 0; ++ } ++ st->hcchar_copy.b.lspddev = (hc->speed == DWC_OTG_EP_SPEED_LOW) ? 1 : 0; ++ /* Enable the channel later as a final register write. */ ++ ++ st->hcsplt_copy.d32 = 0; ++ if(qh->do_split) { ++ hcd->fops->hub_info(hcd, DWC_CIRCLEQ_FIRST(&qh->qtd_list)->urb->priv, &hub_addr, &port_addr); ++ st->hcsplt_copy.b.compsplt = 0; ++ st->hcsplt_copy.b.spltena = 1; ++ // XACTPOS is for isoc-out only but needs initialising anyway. ++ st->hcsplt_copy.b.xactpos = ISOC_XACTPOS_ALL; ++ if((qh->ep_type == DWC_OTG_EP_TYPE_ISOC) && (!qh->ep_is_in)) { ++ /* For packetsize 0 < L < 188, ISOC_XACTPOS_ALL. ++ * for longer than this, ISOC_XACTPOS_BEGIN and the FIQ ++ * will update as necessary. ++ */ ++ if (hc->xfer_len > 188) { ++ st->hcsplt_copy.b.xactpos = ISOC_XACTPOS_BEGIN; ++ } ++ } ++ st->hcsplt_copy.b.hubaddr = (uint8_t) hub_addr; ++ st->hcsplt_copy.b.prtaddr = (uint8_t) port_addr; ++ st->hub_addr = hub_addr; ++ st->port_addr = port_addr; ++ } ++ ++ st->hctsiz_copy.d32 = 0; ++ st->hctsiz_copy.b.dopng = 0; ++ st->hctsiz_copy.b.pid = hc->data_pid_start; ++ ++ if (hc->ep_is_in || (hc->xfer_len > hc->max_packet)) { ++ hc->xfer_len = hc->max_packet; ++ } else if (!hc->ep_is_in && (hc->xfer_len > 188)) { ++ hc->xfer_len = 188; ++ } ++ st->hctsiz_copy.b.xfersize = hc->xfer_len; ++ ++ st->hctsiz_copy.b.pktcnt = 1; ++ ++ if (hc->ep_type & 0x1) { ++ /* ++ * For potentially multi-packet transfers, must use the DMA bounce buffers. For IN transfers, ++ * the DMA address is the address of the first 188byte slot buffer in the bounce buffer array. ++ * For multi-packet OUT transfers, we need to copy the data into the bounce buffer array so the FIQ can punt ++ * the right address out as necessary. hc->xfer_buff and hc->xfer_len have already been set ++ * in assign_and_init_hc(), but this is for the eventual transaction completion only. The FIQ ++ * must not touch internal driver state. ++ */ ++ if(!fiq_fsm_setup_periodic_dma(hcd, st, qh)) { ++ if (hc->align_buff) { ++ st->hcdma_copy.d32 = hc->align_buff; ++ } else { ++ st->hcdma_copy.d32 = ((unsigned long) hc->xfer_buff & 0xFFFFFFFF); ++ } ++ } ++ } else { ++ if (hc->align_buff) { ++ st->hcdma_copy.d32 = hc->align_buff; ++ } else { ++ st->hcdma_copy.d32 = ((unsigned long) hc->xfer_buff & 0xFFFFFFFF); ++ } ++ } ++ /* The FIQ depends upon no other interrupts being enabled except channel halt. ++ * Fixup channel interrupt mask. */ ++ st->hcintmsk_copy.d32 = 0; ++ st->hcintmsk_copy.b.chhltd = 1; ++ st->hcintmsk_copy.b.ahberr = 1; ++ ++ /* Hack courtesy of FreeBSD: apparently forcing Interrupt Split transactions ++ * as Control puts the transfer into the non-periodic request queue and the ++ * non-periodic handler in the hub. Makes things lots easier. ++ */ ++ if ((fiq_fsm_mask & 0x8) && hc->ep_type == UE_INTERRUPT) { ++ st->hcchar_copy.b.multicnt = 0; ++ st->hcchar_copy.b.oddfrm = 0; ++ st->hcchar_copy.b.eptype = UE_CONTROL; ++ if (hc->align_buff) { ++ st->hcdma_copy.d32 = hc->align_buff; ++ } else { ++ st->hcdma_copy.d32 = ((unsigned long) hc->xfer_buff & 0xFFFFFFFF); ++ } ++ } ++ DWC_WRITE_REG32(&hc_regs->hcdma, st->hcdma_copy.d32); ++ DWC_WRITE_REG32(&hc_regs->hctsiz, st->hctsiz_copy.d32); ++ DWC_WRITE_REG32(&hc_regs->hcsplt, st->hcsplt_copy.d32); ++ DWC_WRITE_REG32(&hc_regs->hcchar, st->hcchar_copy.d32); ++ DWC_WRITE_REG32(&hc_regs->hcintmsk, st->hcintmsk_copy.d32); ++ ++ local_fiq_disable(); ++ fiq_fsm_spin_lock(&hcd->fiq_state->lock); ++ ++ if (hc->ep_type & 0x1) { ++ hfnum.d32 = DWC_READ_REG32(&hcd->core_if->host_if->host_global_regs->hfnum); ++ frame = (hfnum.b.frnum & ~0x7) >> 3; ++ uframe = hfnum.b.frnum & 0x7; ++ if (hfnum.b.frrem < PERIODIC_FRREM_BACKOFF) { ++ /* Prevent queueing near EOF1. Bad things happen if a periodic ++ * split transaction is queued very close to EOF. ++ */ ++ start_immediate = 0; ++ } else if (uframe == 5) { ++ start_immediate = 0; ++ } else if (hc->ep_type == UE_ISOCHRONOUS && !hc->ep_is_in) { ++ start_immediate = 0; ++ } else if (hc->ep_is_in && fiq_fsm_too_late(hcd->fiq_state, hc->hc_num)) { ++ start_immediate = 0; ++ } else { ++ /* Search through all host channels to determine if a transaction ++ * is currently in progress */ ++ for (i = 0; i < hcd->core_if->core_params->host_channels; i++) { ++ if (i == hc->hc_num || hcd->fiq_state->channel[i].fsm == FIQ_PASSTHROUGH) ++ continue; ++ switch (hcd->fiq_state->channel[i].fsm) { ++ /* TT is reserved for channels that are in the middle of a periodic ++ * split transaction. ++ */ ++ case FIQ_PER_SSPLIT_STARTED: ++ case FIQ_PER_CSPLIT_WAIT: ++ case FIQ_PER_CSPLIT_NYET1: ++ case FIQ_PER_CSPLIT_POLL: ++ case FIQ_PER_ISO_OUT_ACTIVE: ++ case FIQ_PER_ISO_OUT_LAST: ++ if (hcd->fiq_state->channel[i].hub_addr == hub_addr && ++ hcd->fiq_state->channel[i].port_addr == port_addr) { ++ start_immediate = 0; ++ } ++ break; ++ default: ++ break; ++ } ++ if (!start_immediate) ++ break; ++ } ++ } ++ } ++ if ((fiq_fsm_mask & 0x8) && hc->ep_type == UE_INTERRUPT) ++ start_immediate = 1; ++ ++ fiq_print(FIQDBG_INT, hcd->fiq_state, "FSMQ %01d %01d", hc->hc_num, start_immediate); ++ fiq_print(FIQDBG_INT, hcd->fiq_state, "%08d", hfnum.b.frrem); ++ //fiq_print(FIQDBG_INT, hcd->fiq_state, "H:%02dP:%02d", hub_addr, port_addr); ++ //fiq_print(FIQDBG_INT, hcd->fiq_state, "%08x", st->hctsiz_copy.d32); ++ //fiq_print(FIQDBG_INT, hcd->fiq_state, "%08x", st->hcdma_copy.d32); ++ switch (hc->ep_type) { ++ case UE_CONTROL: ++ case UE_BULK: ++ st->fsm = FIQ_NP_SSPLIT_STARTED; ++ break; ++ case UE_ISOCHRONOUS: ++ if (hc->ep_is_in) { ++ if (start_immediate) { ++ st->fsm = FIQ_PER_SSPLIT_STARTED; ++ } else { ++ st->fsm = FIQ_PER_SSPLIT_QUEUED; ++ } ++ } else { ++ if (start_immediate) { ++ /* Single-isoc OUT packets don't require FIQ involvement */ ++ if (st->nrpackets == 1) { ++ st->fsm = FIQ_PER_ISO_OUT_LAST; ++ } else { ++ st->fsm = FIQ_PER_ISO_OUT_ACTIVE; ++ } ++ } else { ++ st->fsm = FIQ_PER_ISO_OUT_PENDING; ++ } ++ } ++ break; ++ case UE_INTERRUPT: ++ if (fiq_fsm_mask & 0x8) { ++ st->fsm = FIQ_NP_SSPLIT_STARTED; ++ } else if (start_immediate) { ++ st->fsm = FIQ_PER_SSPLIT_STARTED; ++ } else { ++ st->fsm = FIQ_PER_SSPLIT_QUEUED; ++ } ++ default: ++ break; ++ } ++ if (start_immediate) { ++ /* Set the oddfrm bit as close as possible to actual queueing */ ++ frame = dwc_otg_hcd_get_frame_number(hcd); ++ st->expected_uframe = (frame + 1) & 0x3FFF; ++ st->hcchar_copy.b.oddfrm = (frame & 0x1) ? 0 : 1; ++ st->hcchar_copy.b.chen = 1; ++ DWC_WRITE_REG32(&hc_regs->hcchar, st->hcchar_copy.d32); ++ } ++ mb(); ++ fiq_fsm_spin_unlock(&hcd->fiq_state->lock); ++ local_fiq_enable(); ++ return 0; ++} ++ ++ ++/** ++ * This function selects transactions from the HCD transfer schedule and ++ * assigns them to available host channels. It is called from HCD interrupt ++ * handler functions. ++ * ++ * @param hcd The HCD state structure. ++ * ++ * @return The types of new transactions that were assigned to host channels. ++ */ ++dwc_otg_transaction_type_e dwc_otg_hcd_select_transactions(dwc_otg_hcd_t * hcd) ++{ ++ dwc_list_link_t *qh_ptr; ++ dwc_otg_qh_t *qh; ++ int num_channels; ++ dwc_irqflags_t flags; ++ dwc_spinlock_t *channel_lock = hcd->channel_lock; ++ dwc_otg_transaction_type_e ret_val = DWC_OTG_TRANSACTION_NONE; ++ ++#ifdef DEBUG_HOST_CHANNELS ++ last_sel_trans_num_per_scheduled = 0; ++ last_sel_trans_num_nonper_scheduled = 0; ++ last_sel_trans_num_avail_hc_at_start = hcd->available_host_channels; ++#endif /* DEBUG_HOST_CHANNELS */ ++ ++ /* Process entries in the periodic ready list. */ ++ qh_ptr = DWC_LIST_FIRST(&hcd->periodic_sched_ready); ++ ++ while (qh_ptr != &hcd->periodic_sched_ready && ++ !DWC_CIRCLEQ_EMPTY(&hcd->free_hc_list)) { ++ ++ qh = DWC_LIST_ENTRY(qh_ptr, dwc_otg_qh_t, qh_list_entry); ++ ++ if (microframe_schedule) { ++ // Make sure we leave one channel for non periodic transactions. ++ DWC_SPINLOCK_IRQSAVE(channel_lock, &flags); ++ if (hcd->available_host_channels <= 1) { ++ DWC_SPINUNLOCK_IRQRESTORE(channel_lock, flags); ++ break; ++ } ++ hcd->available_host_channels--; ++ DWC_SPINUNLOCK_IRQRESTORE(channel_lock, flags); ++#ifdef DEBUG_HOST_CHANNELS ++ last_sel_trans_num_per_scheduled++; ++#endif /* DEBUG_HOST_CHANNELS */ ++ } ++ qh = DWC_LIST_ENTRY(qh_ptr, dwc_otg_qh_t, qh_list_entry); ++ assign_and_init_hc(hcd, qh); ++ ++ /* ++ * Move the QH from the periodic ready schedule to the ++ * periodic assigned schedule. ++ */ ++ qh_ptr = DWC_LIST_NEXT(qh_ptr); ++ DWC_SPINLOCK_IRQSAVE(channel_lock, &flags); ++ DWC_LIST_MOVE_HEAD(&hcd->periodic_sched_assigned, ++ &qh->qh_list_entry); ++ DWC_SPINUNLOCK_IRQRESTORE(channel_lock, flags); ++ } ++ ++ /* ++ * Process entries in the inactive portion of the non-periodic ++ * schedule. Some free host channels may not be used if they are ++ * reserved for periodic transfers. ++ */ ++ qh_ptr = hcd->non_periodic_sched_inactive.next; ++ num_channels = hcd->core_if->core_params->host_channels; ++ while (qh_ptr != &hcd->non_periodic_sched_inactive && ++ (microframe_schedule || hcd->non_periodic_channels < ++ num_channels - hcd->periodic_channels) && ++ !DWC_CIRCLEQ_EMPTY(&hcd->free_hc_list)) { ++ ++ qh = DWC_LIST_ENTRY(qh_ptr, dwc_otg_qh_t, qh_list_entry); ++ /* ++ * Check to see if this is a NAK'd retransmit, in which case ignore for retransmission ++ * we hold off on bulk retransmissions to reduce NAK interrupt overhead for full-speed ++ * cheeky devices that just hold off using NAKs ++ */ ++ if (fiq_enable && nak_holdoff && qh->do_split) { ++ if (qh->nak_frame != 0xffff) { ++ uint16_t next_frame = dwc_frame_num_inc(qh->nak_frame, (qh->ep_type == UE_BULK) ? nak_holdoff : 8); ++ uint16_t frame = dwc_otg_hcd_get_frame_number(hcd); ++ if (dwc_frame_num_le(frame, next_frame)) { ++ if(dwc_frame_num_le(next_frame, hcd->fiq_state->next_sched_frame)) { ++ hcd->fiq_state->next_sched_frame = next_frame; ++ } ++ qh_ptr = DWC_LIST_NEXT(qh_ptr); ++ continue; ++ } else { ++ qh->nak_frame = 0xFFFF; ++ } ++ } ++ } ++ ++ if (microframe_schedule) { ++ DWC_SPINLOCK_IRQSAVE(channel_lock, &flags); ++ if (hcd->available_host_channels < 1) { ++ DWC_SPINUNLOCK_IRQRESTORE(channel_lock, flags); ++ break; ++ } ++ hcd->available_host_channels--; ++ DWC_SPINUNLOCK_IRQRESTORE(channel_lock, flags); ++#ifdef DEBUG_HOST_CHANNELS ++ last_sel_trans_num_nonper_scheduled++; ++#endif /* DEBUG_HOST_CHANNELS */ ++ } ++ ++ assign_and_init_hc(hcd, qh); ++ ++ /* ++ * Move the QH from the non-periodic inactive schedule to the ++ * non-periodic active schedule. ++ */ ++ qh_ptr = DWC_LIST_NEXT(qh_ptr); ++ DWC_SPINLOCK_IRQSAVE(channel_lock, &flags); ++ DWC_LIST_MOVE_HEAD(&hcd->non_periodic_sched_active, ++ &qh->qh_list_entry); ++ DWC_SPINUNLOCK_IRQRESTORE(channel_lock, flags); ++ ++ ++ if (!microframe_schedule) ++ hcd->non_periodic_channels++; ++ } ++ /* we moved a non-periodic QH to the active schedule. If the inactive queue is empty, ++ * stop the FIQ from kicking us. We could potentially still have elements here if we ++ * ran out of host channels. ++ */ ++ if (fiq_enable) { ++ if (DWC_LIST_EMPTY(&hcd->non_periodic_sched_inactive)) { ++ hcd->fiq_state->kick_np_queues = 0; ++ } else { ++ /* For each entry remaining in the NP inactive queue, ++ * if this a NAK'd retransmit then don't set the kick flag. ++ */ ++ if(nak_holdoff) { ++ DWC_LIST_FOREACH(qh_ptr, &hcd->non_periodic_sched_inactive) { ++ qh = DWC_LIST_ENTRY(qh_ptr, dwc_otg_qh_t, qh_list_entry); ++ if (qh->nak_frame == 0xFFFF) { ++ hcd->fiq_state->kick_np_queues = 1; ++ } ++ } ++ } ++ } ++ } ++ if(!DWC_LIST_EMPTY(&hcd->periodic_sched_assigned)) ++ ret_val |= DWC_OTG_TRANSACTION_PERIODIC; ++ ++ if(!DWC_LIST_EMPTY(&hcd->non_periodic_sched_active)) ++ ret_val |= DWC_OTG_TRANSACTION_NON_PERIODIC; ++ ++ ++#ifdef DEBUG_HOST_CHANNELS ++ last_sel_trans_num_avail_hc_at_end = hcd->available_host_channels; ++#endif /* DEBUG_HOST_CHANNELS */ ++ return ret_val; ++} ++ ++/** ++ * Attempts to queue a single transaction request for a host channel ++ * associated with either a periodic or non-periodic transfer. This function ++ * assumes that there is space available in the appropriate request queue. For ++ * an OUT transfer or SETUP transaction in Slave mode, it checks whether space ++ * is available in the appropriate Tx FIFO. ++ * ++ * @param hcd The HCD state structure. ++ * @param hc Host channel descriptor associated with either a periodic or ++ * non-periodic transfer. ++ * @param fifo_dwords_avail Number of DWORDs available in the periodic Tx ++ * FIFO for periodic transfers or the non-periodic Tx FIFO for non-periodic ++ * transfers. ++ * ++ * @return 1 if a request is queued and more requests may be needed to ++ * complete the transfer, 0 if no more requests are required for this ++ * transfer, -1 if there is insufficient space in the Tx FIFO. ++ */ ++static int queue_transaction(dwc_otg_hcd_t * hcd, ++ dwc_hc_t * hc, uint16_t fifo_dwords_avail) ++{ ++ int retval; ++ ++ if (hcd->core_if->dma_enable) { ++ if (hcd->core_if->dma_desc_enable) { ++ if (!hc->xfer_started ++ || (hc->ep_type == DWC_OTG_EP_TYPE_ISOC)) { ++ dwc_otg_hcd_start_xfer_ddma(hcd, hc->qh); ++ hc->qh->ping_state = 0; ++ } ++ } else if (!hc->xfer_started) { ++ if (fiq_fsm_enable && hc->error_state) { ++ hcd->fiq_state->channel[hc->hc_num].nr_errors = ++ DWC_CIRCLEQ_FIRST(&hc->qh->qtd_list)->error_count; ++ hcd->fiq_state->channel[hc->hc_num].fsm = ++ FIQ_PASSTHROUGH_ERRORSTATE; ++ } ++ dwc_otg_hc_start_transfer(hcd->core_if, hc); ++ hc->qh->ping_state = 0; ++ } ++ retval = 0; ++ } else if (hc->halt_pending) { ++ /* Don't queue a request if the channel has been halted. */ ++ retval = 0; ++ } else if (hc->halt_on_queue) { ++ dwc_otg_hc_halt(hcd->core_if, hc, hc->halt_status); ++ retval = 0; ++ } else if (hc->do_ping) { ++ if (!hc->xfer_started) { ++ dwc_otg_hc_start_transfer(hcd->core_if, hc); ++ } ++ retval = 0; ++ } else if (!hc->ep_is_in || hc->data_pid_start == DWC_OTG_HC_PID_SETUP) { ++ if ((fifo_dwords_avail * 4) >= hc->max_packet) { ++ if (!hc->xfer_started) { ++ dwc_otg_hc_start_transfer(hcd->core_if, hc); ++ retval = 1; ++ } else { ++ retval = ++ dwc_otg_hc_continue_transfer(hcd->core_if, ++ hc); ++ } ++ } else { ++ retval = -1; ++ } ++ } else { ++ if (!hc->xfer_started) { ++ dwc_otg_hc_start_transfer(hcd->core_if, hc); ++ retval = 1; ++ } else { ++ retval = dwc_otg_hc_continue_transfer(hcd->core_if, hc); ++ } ++ } ++ ++ return retval; ++} ++ ++/** ++ * Processes periodic channels for the next frame and queues transactions for ++ * these channels to the DWC_otg controller. After queueing transactions, the ++ * Periodic Tx FIFO Empty interrupt is enabled if there are more transactions ++ * to queue as Periodic Tx FIFO or request queue space becomes available. ++ * Otherwise, the Periodic Tx FIFO Empty interrupt is disabled. ++ */ ++static void process_periodic_channels(dwc_otg_hcd_t * hcd) ++{ ++ hptxsts_data_t tx_status; ++ dwc_list_link_t *qh_ptr; ++ dwc_otg_qh_t *qh; ++ int status = 0; ++ int no_queue_space = 0; ++ int no_fifo_space = 0; ++ ++ dwc_otg_host_global_regs_t *host_regs; ++ host_regs = hcd->core_if->host_if->host_global_regs; ++ ++ DWC_DEBUGPL(DBG_HCDV, "Queue periodic transactions\n"); ++#ifdef DEBUG ++ tx_status.d32 = DWC_READ_REG32(&host_regs->hptxsts); ++ DWC_DEBUGPL(DBG_HCDV, ++ " P Tx Req Queue Space Avail (before queue): %d\n", ++ tx_status.b.ptxqspcavail); ++ DWC_DEBUGPL(DBG_HCDV, " P Tx FIFO Space Avail (before queue): %d\n", ++ tx_status.b.ptxfspcavail); ++#endif ++ ++ qh_ptr = hcd->periodic_sched_assigned.next; ++ while (qh_ptr != &hcd->periodic_sched_assigned) { ++ tx_status.d32 = DWC_READ_REG32(&host_regs->hptxsts); ++ if (tx_status.b.ptxqspcavail == 0) { ++ no_queue_space = 1; ++ break; ++ } ++ ++ qh = DWC_LIST_ENTRY(qh_ptr, dwc_otg_qh_t, qh_list_entry); ++ ++ // Do not send a split start transaction any later than frame .6 ++ // Note, we have to schedule a periodic in .5 to make it go in .6 ++ if(fiq_fsm_enable && qh->do_split && ((dwc_otg_hcd_get_frame_number(hcd) + 1) & 7) > 6) ++ { ++ qh_ptr = qh_ptr->next; ++ hcd->fiq_state->next_sched_frame = dwc_otg_hcd_get_frame_number(hcd) | 7; ++ continue; ++ } ++ ++ if (fiq_fsm_enable && fiq_fsm_transaction_suitable(qh)) { ++ if (qh->do_split) ++ fiq_fsm_queue_split_transaction(hcd, qh); ++ else ++ fiq_fsm_queue_isoc_transaction(hcd, qh); ++ } else { ++ ++ /* ++ * Set a flag if we're queueing high-bandwidth in slave mode. ++ * The flag prevents any halts to get into the request queue in ++ * the middle of multiple high-bandwidth packets getting queued. ++ */ ++ if (!hcd->core_if->dma_enable && qh->channel->multi_count > 1) { ++ hcd->core_if->queuing_high_bandwidth = 1; ++ } ++ status = queue_transaction(hcd, qh->channel, ++ tx_status.b.ptxfspcavail); ++ if (status < 0) { ++ no_fifo_space = 1; ++ break; ++ } ++ } ++ ++ /* ++ * In Slave mode, stay on the current transfer until there is ++ * nothing more to do or the high-bandwidth request count is ++ * reached. In DMA mode, only need to queue one request. The ++ * controller automatically handles multiple packets for ++ * high-bandwidth transfers. ++ */ ++ if (hcd->core_if->dma_enable || status == 0 || ++ qh->channel->requests == qh->channel->multi_count) { ++ qh_ptr = qh_ptr->next; ++ /* ++ * Move the QH from the periodic assigned schedule to ++ * the periodic queued schedule. ++ */ ++ DWC_LIST_MOVE_HEAD(&hcd->periodic_sched_queued, ++ &qh->qh_list_entry); ++ ++ /* done queuing high bandwidth */ ++ hcd->core_if->queuing_high_bandwidth = 0; ++ } ++ } ++ ++ if (!hcd->core_if->dma_enable) { ++ dwc_otg_core_global_regs_t *global_regs; ++ gintmsk_data_t intr_mask = {.d32 = 0 }; ++ ++ global_regs = hcd->core_if->core_global_regs; ++ intr_mask.b.ptxfempty = 1; ++#ifdef DEBUG ++ tx_status.d32 = DWC_READ_REG32(&host_regs->hptxsts); ++ DWC_DEBUGPL(DBG_HCDV, ++ " P Tx Req Queue Space Avail (after queue): %d\n", ++ tx_status.b.ptxqspcavail); ++ DWC_DEBUGPL(DBG_HCDV, ++ " P Tx FIFO Space Avail (after queue): %d\n", ++ tx_status.b.ptxfspcavail); ++#endif ++ if (!DWC_LIST_EMPTY(&hcd->periodic_sched_assigned) || ++ no_queue_space || no_fifo_space) { ++ /* ++ * May need to queue more transactions as the request ++ * queue or Tx FIFO empties. Enable the periodic Tx ++ * FIFO empty interrupt. (Always use the half-empty ++ * level to ensure that new requests are loaded as ++ * soon as possible.) ++ */ ++ DWC_MODIFY_REG32(&global_regs->gintmsk, 0, ++ intr_mask.d32); ++ } else { ++ /* ++ * Disable the Tx FIFO empty interrupt since there are ++ * no more transactions that need to be queued right ++ * now. This function is called from interrupt ++ * handlers to queue more transactions as transfer ++ * states change. ++ */ ++ DWC_MODIFY_REG32(&global_regs->gintmsk, intr_mask.d32, ++ 0); ++ } ++ } ++} ++ ++/** ++ * Processes active non-periodic channels and queues transactions for these ++ * channels to the DWC_otg controller. After queueing transactions, the NP Tx ++ * FIFO Empty interrupt is enabled if there are more transactions to queue as ++ * NP Tx FIFO or request queue space becomes available. Otherwise, the NP Tx ++ * FIFO Empty interrupt is disabled. ++ */ ++static void process_non_periodic_channels(dwc_otg_hcd_t * hcd) ++{ ++ gnptxsts_data_t tx_status; ++ dwc_list_link_t *orig_qh_ptr; ++ dwc_otg_qh_t *qh; ++ int status; ++ int no_queue_space = 0; ++ int no_fifo_space = 0; ++ int more_to_do = 0; ++ ++ dwc_otg_core_global_regs_t *global_regs = ++ hcd->core_if->core_global_regs; ++ ++ DWC_DEBUGPL(DBG_HCDV, "Queue non-periodic transactions\n"); ++#ifdef DEBUG ++ tx_status.d32 = DWC_READ_REG32(&global_regs->gnptxsts); ++ DWC_DEBUGPL(DBG_HCDV, ++ " NP Tx Req Queue Space Avail (before queue): %d\n", ++ tx_status.b.nptxqspcavail); ++ DWC_DEBUGPL(DBG_HCDV, " NP Tx FIFO Space Avail (before queue): %d\n", ++ tx_status.b.nptxfspcavail); ++#endif ++ /* ++ * Keep track of the starting point. Skip over the start-of-list ++ * entry. ++ */ ++ if (hcd->non_periodic_qh_ptr == &hcd->non_periodic_sched_active) { ++ hcd->non_periodic_qh_ptr = hcd->non_periodic_qh_ptr->next; ++ } ++ orig_qh_ptr = hcd->non_periodic_qh_ptr; ++ ++ /* ++ * Process once through the active list or until no more space is ++ * available in the request queue or the Tx FIFO. ++ */ ++ do { ++ tx_status.d32 = DWC_READ_REG32(&global_regs->gnptxsts); ++ if (!hcd->core_if->dma_enable && tx_status.b.nptxqspcavail == 0) { ++ no_queue_space = 1; ++ break; ++ } ++ ++ qh = DWC_LIST_ENTRY(hcd->non_periodic_qh_ptr, dwc_otg_qh_t, ++ qh_list_entry); ++ ++ if(fiq_fsm_enable && fiq_fsm_transaction_suitable(qh)) { ++ fiq_fsm_queue_split_transaction(hcd, qh); ++ } else { ++ status = queue_transaction(hcd, qh->channel, ++ tx_status.b.nptxfspcavail); ++ ++ if (status > 0) { ++ more_to_do = 1; ++ } else if (status < 0) { ++ no_fifo_space = 1; ++ break; ++ } ++ } ++ /* Advance to next QH, skipping start-of-list entry. */ ++ hcd->non_periodic_qh_ptr = hcd->non_periodic_qh_ptr->next; ++ if (hcd->non_periodic_qh_ptr == &hcd->non_periodic_sched_active) { ++ hcd->non_periodic_qh_ptr = ++ hcd->non_periodic_qh_ptr->next; ++ } ++ ++ } while (hcd->non_periodic_qh_ptr != orig_qh_ptr); ++ ++ if (!hcd->core_if->dma_enable) { ++ gintmsk_data_t intr_mask = {.d32 = 0 }; ++ intr_mask.b.nptxfempty = 1; ++ ++#ifdef DEBUG ++ tx_status.d32 = DWC_READ_REG32(&global_regs->gnptxsts); ++ DWC_DEBUGPL(DBG_HCDV, ++ " NP Tx Req Queue Space Avail (after queue): %d\n", ++ tx_status.b.nptxqspcavail); ++ DWC_DEBUGPL(DBG_HCDV, ++ " NP Tx FIFO Space Avail (after queue): %d\n", ++ tx_status.b.nptxfspcavail); ++#endif ++ if (more_to_do || no_queue_space || no_fifo_space) { ++ /* ++ * May need to queue more transactions as the request ++ * queue or Tx FIFO empties. Enable the non-periodic ++ * Tx FIFO empty interrupt. (Always use the half-empty ++ * level to ensure that new requests are loaded as ++ * soon as possible.) ++ */ ++ DWC_MODIFY_REG32(&global_regs->gintmsk, 0, ++ intr_mask.d32); ++ } else { ++ /* ++ * Disable the Tx FIFO empty interrupt since there are ++ * no more transactions that need to be queued right ++ * now. This function is called from interrupt ++ * handlers to queue more transactions as transfer ++ * states change. ++ */ ++ DWC_MODIFY_REG32(&global_regs->gintmsk, intr_mask.d32, ++ 0); ++ } ++ } ++} ++ ++/** ++ * This function processes the currently active host channels and queues ++ * transactions for these channels to the DWC_otg controller. It is called ++ * from HCD interrupt handler functions. ++ * ++ * @param hcd The HCD state structure. ++ * @param tr_type The type(s) of transactions to queue (non-periodic, ++ * periodic, or both). ++ */ ++void dwc_otg_hcd_queue_transactions(dwc_otg_hcd_t * hcd, ++ dwc_otg_transaction_type_e tr_type) ++{ ++#ifdef DEBUG_SOF ++ DWC_DEBUGPL(DBG_HCD, "Queue Transactions\n"); ++#endif ++ /* Process host channels associated with periodic transfers. */ ++ if ((tr_type == DWC_OTG_TRANSACTION_PERIODIC || ++ tr_type == DWC_OTG_TRANSACTION_ALL) && ++ !DWC_LIST_EMPTY(&hcd->periodic_sched_assigned)) { ++ ++ process_periodic_channels(hcd); ++ } ++ ++ /* Process host channels associated with non-periodic transfers. */ ++ if (tr_type == DWC_OTG_TRANSACTION_NON_PERIODIC || ++ tr_type == DWC_OTG_TRANSACTION_ALL) { ++ if (!DWC_LIST_EMPTY(&hcd->non_periodic_sched_active)) { ++ process_non_periodic_channels(hcd); ++ } else { ++ /* ++ * Ensure NP Tx FIFO empty interrupt is disabled when ++ * there are no non-periodic transfers to process. ++ */ ++ gintmsk_data_t gintmsk = {.d32 = 0 }; ++ gintmsk.b.nptxfempty = 1; ++ ++ if (fiq_enable) { ++ local_fiq_disable(); ++ fiq_fsm_spin_lock(&hcd->fiq_state->lock); ++ DWC_MODIFY_REG32(&hcd->core_if->core_global_regs->gintmsk, gintmsk.d32, 0); ++ fiq_fsm_spin_unlock(&hcd->fiq_state->lock); ++ local_fiq_enable(); ++ } else { ++ DWC_MODIFY_REG32(&hcd->core_if->core_global_regs->gintmsk, gintmsk.d32, 0); ++ } ++ } ++ } ++} ++ ++#ifdef DWC_HS_ELECT_TST ++/* ++ * Quick and dirty hack to implement the HS Electrical Test ++ * SINGLE_STEP_GET_DEVICE_DESCRIPTOR feature. ++ * ++ * This code was copied from our userspace app "hset". It sends a ++ * Get Device Descriptor control sequence in two parts, first the ++ * Setup packet by itself, followed some time later by the In and ++ * Ack packets. Rather than trying to figure out how to add this ++ * functionality to the normal driver code, we just hijack the ++ * hardware, using these two function to drive the hardware ++ * directly. ++ */ ++ ++static dwc_otg_core_global_regs_t *global_regs; ++static dwc_otg_host_global_regs_t *hc_global_regs; ++static dwc_otg_hc_regs_t *hc_regs; ++static uint32_t *data_fifo; ++ ++static void do_setup(void) ++{ ++ gintsts_data_t gintsts; ++ hctsiz_data_t hctsiz; ++ hcchar_data_t hcchar; ++ haint_data_t haint; ++ hcint_data_t hcint; ++ ++ /* Enable HAINTs */ ++ DWC_WRITE_REG32(&hc_global_regs->haintmsk, 0x0001); ++ ++ /* Enable HCINTs */ ++ DWC_WRITE_REG32(&hc_regs->hcintmsk, 0x04a3); ++ ++ /* Read GINTSTS */ ++ gintsts.d32 = DWC_READ_REG32(&global_regs->gintsts); ++ ++ /* Read HAINT */ ++ haint.d32 = DWC_READ_REG32(&hc_global_regs->haint); ++ ++ /* Read HCINT */ ++ hcint.d32 = DWC_READ_REG32(&hc_regs->hcint); ++ ++ /* Read HCCHAR */ ++ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); ++ ++ /* Clear HCINT */ ++ DWC_WRITE_REG32(&hc_regs->hcint, hcint.d32); ++ ++ /* Clear HAINT */ ++ DWC_WRITE_REG32(&hc_global_regs->haint, haint.d32); ++ ++ /* Clear GINTSTS */ ++ DWC_WRITE_REG32(&global_regs->gintsts, gintsts.d32); ++ ++ /* Read GINTSTS */ ++ gintsts.d32 = DWC_READ_REG32(&global_regs->gintsts); ++ ++ /* ++ * Send Setup packet (Get Device Descriptor) ++ */ ++ ++ /* Make sure channel is disabled */ ++ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); ++ if (hcchar.b.chen) { ++ hcchar.b.chdis = 1; ++// hcchar.b.chen = 1; ++ DWC_WRITE_REG32(&hc_regs->hcchar, hcchar.d32); ++ //sleep(1); ++ dwc_mdelay(1000); ++ ++ /* Read GINTSTS */ ++ gintsts.d32 = DWC_READ_REG32(&global_regs->gintsts); ++ ++ /* Read HAINT */ ++ haint.d32 = DWC_READ_REG32(&hc_global_regs->haint); ++ ++ /* Read HCINT */ ++ hcint.d32 = DWC_READ_REG32(&hc_regs->hcint); ++ ++ /* Read HCCHAR */ ++ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); ++ ++ /* Clear HCINT */ ++ DWC_WRITE_REG32(&hc_regs->hcint, hcint.d32); ++ ++ /* Clear HAINT */ ++ DWC_WRITE_REG32(&hc_global_regs->haint, haint.d32); ++ ++ /* Clear GINTSTS */ ++ DWC_WRITE_REG32(&global_regs->gintsts, gintsts.d32); ++ ++ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); ++ } ++ ++ /* Set HCTSIZ */ ++ hctsiz.d32 = 0; ++ hctsiz.b.xfersize = 8; ++ hctsiz.b.pktcnt = 1; ++ hctsiz.b.pid = DWC_OTG_HC_PID_SETUP; ++ DWC_WRITE_REG32(&hc_regs->hctsiz, hctsiz.d32); ++ ++ /* Set HCCHAR */ ++ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); ++ hcchar.b.eptype = DWC_OTG_EP_TYPE_CONTROL; ++ hcchar.b.epdir = 0; ++ hcchar.b.epnum = 0; ++ hcchar.b.mps = 8; ++ hcchar.b.chen = 1; ++ DWC_WRITE_REG32(&hc_regs->hcchar, hcchar.d32); ++ ++ /* Fill FIFO with Setup data for Get Device Descriptor */ ++ data_fifo = (uint32_t *) ((char *)global_regs + 0x1000); ++ DWC_WRITE_REG32(data_fifo++, 0x01000680); ++ DWC_WRITE_REG32(data_fifo++, 0x00080000); ++ ++ gintsts.d32 = DWC_READ_REG32(&global_regs->gintsts); ++ ++ /* Wait for host channel interrupt */ ++ do { ++ gintsts.d32 = DWC_READ_REG32(&global_regs->gintsts); ++ } while (gintsts.b.hcintr == 0); ++ ++ /* Disable HCINTs */ ++ DWC_WRITE_REG32(&hc_regs->hcintmsk, 0x0000); ++ ++ /* Disable HAINTs */ ++ DWC_WRITE_REG32(&hc_global_regs->haintmsk, 0x0000); ++ ++ /* Read HAINT */ ++ haint.d32 = DWC_READ_REG32(&hc_global_regs->haint); ++ ++ /* Read HCINT */ ++ hcint.d32 = DWC_READ_REG32(&hc_regs->hcint); ++ ++ /* Read HCCHAR */ ++ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); ++ ++ /* Clear HCINT */ ++ DWC_WRITE_REG32(&hc_regs->hcint, hcint.d32); ++ ++ /* Clear HAINT */ ++ DWC_WRITE_REG32(&hc_global_regs->haint, haint.d32); ++ ++ /* Clear GINTSTS */ ++ DWC_WRITE_REG32(&global_regs->gintsts, gintsts.d32); ++ ++ /* Read GINTSTS */ ++ gintsts.d32 = DWC_READ_REG32(&global_regs->gintsts); ++} ++ ++static void do_in_ack(void) ++{ ++ gintsts_data_t gintsts; ++ hctsiz_data_t hctsiz; ++ hcchar_data_t hcchar; ++ haint_data_t haint; ++ hcint_data_t hcint; ++ host_grxsts_data_t grxsts; ++ ++ /* Enable HAINTs */ ++ DWC_WRITE_REG32(&hc_global_regs->haintmsk, 0x0001); ++ ++ /* Enable HCINTs */ ++ DWC_WRITE_REG32(&hc_regs->hcintmsk, 0x04a3); ++ ++ /* Read GINTSTS */ ++ gintsts.d32 = DWC_READ_REG32(&global_regs->gintsts); ++ ++ /* Read HAINT */ ++ haint.d32 = DWC_READ_REG32(&hc_global_regs->haint); ++ ++ /* Read HCINT */ ++ hcint.d32 = DWC_READ_REG32(&hc_regs->hcint); ++ ++ /* Read HCCHAR */ ++ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); ++ ++ /* Clear HCINT */ ++ DWC_WRITE_REG32(&hc_regs->hcint, hcint.d32); ++ ++ /* Clear HAINT */ ++ DWC_WRITE_REG32(&hc_global_regs->haint, haint.d32); ++ ++ /* Clear GINTSTS */ ++ DWC_WRITE_REG32(&global_regs->gintsts, gintsts.d32); ++ ++ /* Read GINTSTS */ ++ gintsts.d32 = DWC_READ_REG32(&global_regs->gintsts); ++ ++ /* ++ * Receive Control In packet ++ */ ++ ++ /* Make sure channel is disabled */ ++ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); ++ if (hcchar.b.chen) { ++ hcchar.b.chdis = 1; ++ hcchar.b.chen = 1; ++ DWC_WRITE_REG32(&hc_regs->hcchar, hcchar.d32); ++ //sleep(1); ++ dwc_mdelay(1000); ++ ++ /* Read GINTSTS */ ++ gintsts.d32 = DWC_READ_REG32(&global_regs->gintsts); ++ ++ /* Read HAINT */ ++ haint.d32 = DWC_READ_REG32(&hc_global_regs->haint); ++ ++ /* Read HCINT */ ++ hcint.d32 = DWC_READ_REG32(&hc_regs->hcint); ++ ++ /* Read HCCHAR */ ++ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); ++ ++ /* Clear HCINT */ ++ DWC_WRITE_REG32(&hc_regs->hcint, hcint.d32); ++ ++ /* Clear HAINT */ ++ DWC_WRITE_REG32(&hc_global_regs->haint, haint.d32); ++ ++ /* Clear GINTSTS */ ++ DWC_WRITE_REG32(&global_regs->gintsts, gintsts.d32); ++ ++ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); ++ } ++ ++ /* Set HCTSIZ */ ++ hctsiz.d32 = 0; ++ hctsiz.b.xfersize = 8; ++ hctsiz.b.pktcnt = 1; ++ hctsiz.b.pid = DWC_OTG_HC_PID_DATA1; ++ DWC_WRITE_REG32(&hc_regs->hctsiz, hctsiz.d32); ++ ++ /* Set HCCHAR */ ++ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); ++ hcchar.b.eptype = DWC_OTG_EP_TYPE_CONTROL; ++ hcchar.b.epdir = 1; ++ hcchar.b.epnum = 0; ++ hcchar.b.mps = 8; ++ hcchar.b.chen = 1; ++ DWC_WRITE_REG32(&hc_regs->hcchar, hcchar.d32); ++ ++ gintsts.d32 = DWC_READ_REG32(&global_regs->gintsts); ++ ++ /* Wait for receive status queue interrupt */ ++ do { ++ gintsts.d32 = DWC_READ_REG32(&global_regs->gintsts); ++ } while (gintsts.b.rxstsqlvl == 0); ++ ++ /* Read RXSTS */ ++ grxsts.d32 = DWC_READ_REG32(&global_regs->grxstsp); ++ ++ /* Clear RXSTSQLVL in GINTSTS */ ++ gintsts.d32 = 0; ++ gintsts.b.rxstsqlvl = 1; ++ DWC_WRITE_REG32(&global_regs->gintsts, gintsts.d32); ++ ++ switch (grxsts.b.pktsts) { ++ case DWC_GRXSTS_PKTSTS_IN: ++ /* Read the data into the host buffer */ ++ if (grxsts.b.bcnt > 0) { ++ int i; ++ int word_count = (grxsts.b.bcnt + 3) / 4; ++ ++ data_fifo = (uint32_t *) ((char *)global_regs + 0x1000); ++ ++ for (i = 0; i < word_count; i++) { ++ (void)DWC_READ_REG32(data_fifo++); ++ } ++ } ++ break; ++ ++ default: ++ break; ++ } ++ ++ gintsts.d32 = DWC_READ_REG32(&global_regs->gintsts); ++ ++ /* Wait for receive status queue interrupt */ ++ do { ++ gintsts.d32 = DWC_READ_REG32(&global_regs->gintsts); ++ } while (gintsts.b.rxstsqlvl == 0); ++ ++ /* Read RXSTS */ ++ grxsts.d32 = DWC_READ_REG32(&global_regs->grxstsp); ++ ++ /* Clear RXSTSQLVL in GINTSTS */ ++ gintsts.d32 = 0; ++ gintsts.b.rxstsqlvl = 1; ++ DWC_WRITE_REG32(&global_regs->gintsts, gintsts.d32); ++ ++ switch (grxsts.b.pktsts) { ++ case DWC_GRXSTS_PKTSTS_IN_XFER_COMP: ++ break; ++ ++ default: ++ break; ++ } ++ ++ gintsts.d32 = DWC_READ_REG32(&global_regs->gintsts); ++ ++ /* Wait for host channel interrupt */ ++ do { ++ gintsts.d32 = DWC_READ_REG32(&global_regs->gintsts); ++ } while (gintsts.b.hcintr == 0); ++ ++ /* Read HAINT */ ++ haint.d32 = DWC_READ_REG32(&hc_global_regs->haint); ++ ++ /* Read HCINT */ ++ hcint.d32 = DWC_READ_REG32(&hc_regs->hcint); ++ ++ /* Read HCCHAR */ ++ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); ++ ++ /* Clear HCINT */ ++ DWC_WRITE_REG32(&hc_regs->hcint, hcint.d32); ++ ++ /* Clear HAINT */ ++ DWC_WRITE_REG32(&hc_global_regs->haint, haint.d32); ++ ++ /* Clear GINTSTS */ ++ DWC_WRITE_REG32(&global_regs->gintsts, gintsts.d32); ++ ++ /* Read GINTSTS */ ++ gintsts.d32 = DWC_READ_REG32(&global_regs->gintsts); ++ ++// usleep(100000); ++// mdelay(100); ++ dwc_mdelay(1); ++ ++ /* ++ * Send handshake packet ++ */ ++ ++ /* Read HAINT */ ++ haint.d32 = DWC_READ_REG32(&hc_global_regs->haint); ++ ++ /* Read HCINT */ ++ hcint.d32 = DWC_READ_REG32(&hc_regs->hcint); ++ ++ /* Read HCCHAR */ ++ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); ++ ++ /* Clear HCINT */ ++ DWC_WRITE_REG32(&hc_regs->hcint, hcint.d32); ++ ++ /* Clear HAINT */ ++ DWC_WRITE_REG32(&hc_global_regs->haint, haint.d32); ++ ++ /* Clear GINTSTS */ ++ DWC_WRITE_REG32(&global_regs->gintsts, gintsts.d32); ++ ++ /* Read GINTSTS */ ++ gintsts.d32 = DWC_READ_REG32(&global_regs->gintsts); ++ ++ /* Make sure channel is disabled */ ++ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); ++ if (hcchar.b.chen) { ++ hcchar.b.chdis = 1; ++ hcchar.b.chen = 1; ++ DWC_WRITE_REG32(&hc_regs->hcchar, hcchar.d32); ++ //sleep(1); ++ dwc_mdelay(1000); ++ ++ /* Read GINTSTS */ ++ gintsts.d32 = DWC_READ_REG32(&global_regs->gintsts); ++ ++ /* Read HAINT */ ++ haint.d32 = DWC_READ_REG32(&hc_global_regs->haint); ++ ++ /* Read HCINT */ ++ hcint.d32 = DWC_READ_REG32(&hc_regs->hcint); ++ ++ /* Read HCCHAR */ ++ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); ++ ++ /* Clear HCINT */ ++ DWC_WRITE_REG32(&hc_regs->hcint, hcint.d32); ++ ++ /* Clear HAINT */ ++ DWC_WRITE_REG32(&hc_global_regs->haint, haint.d32); ++ ++ /* Clear GINTSTS */ ++ DWC_WRITE_REG32(&global_regs->gintsts, gintsts.d32); ++ ++ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); ++ } ++ ++ /* Set HCTSIZ */ ++ hctsiz.d32 = 0; ++ hctsiz.b.xfersize = 0; ++ hctsiz.b.pktcnt = 1; ++ hctsiz.b.pid = DWC_OTG_HC_PID_DATA1; ++ DWC_WRITE_REG32(&hc_regs->hctsiz, hctsiz.d32); ++ ++ /* Set HCCHAR */ ++ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); ++ hcchar.b.eptype = DWC_OTG_EP_TYPE_CONTROL; ++ hcchar.b.epdir = 0; ++ hcchar.b.epnum = 0; ++ hcchar.b.mps = 8; ++ hcchar.b.chen = 1; ++ DWC_WRITE_REG32(&hc_regs->hcchar, hcchar.d32); ++ ++ gintsts.d32 = DWC_READ_REG32(&global_regs->gintsts); ++ ++ /* Wait for host channel interrupt */ ++ do { ++ gintsts.d32 = DWC_READ_REG32(&global_regs->gintsts); ++ } while (gintsts.b.hcintr == 0); ++ ++ /* Disable HCINTs */ ++ DWC_WRITE_REG32(&hc_regs->hcintmsk, 0x0000); ++ ++ /* Disable HAINTs */ ++ DWC_WRITE_REG32(&hc_global_regs->haintmsk, 0x0000); ++ ++ /* Read HAINT */ ++ haint.d32 = DWC_READ_REG32(&hc_global_regs->haint); ++ ++ /* Read HCINT */ ++ hcint.d32 = DWC_READ_REG32(&hc_regs->hcint); ++ ++ /* Read HCCHAR */ ++ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); ++ ++ /* Clear HCINT */ ++ DWC_WRITE_REG32(&hc_regs->hcint, hcint.d32); ++ ++ /* Clear HAINT */ ++ DWC_WRITE_REG32(&hc_global_regs->haint, haint.d32); ++ ++ /* Clear GINTSTS */ ++ DWC_WRITE_REG32(&global_regs->gintsts, gintsts.d32); ++ ++ /* Read GINTSTS */ ++ gintsts.d32 = DWC_READ_REG32(&global_regs->gintsts); ++} ++#endif ++ ++/** Handles hub class-specific requests. */ ++int dwc_otg_hcd_hub_control(dwc_otg_hcd_t * dwc_otg_hcd, ++ uint16_t typeReq, ++ uint16_t wValue, ++ uint16_t wIndex, uint8_t * buf, uint16_t wLength) ++{ ++ int retval = 0; ++ ++ dwc_otg_core_if_t *core_if = dwc_otg_hcd->core_if; ++ usb_hub_descriptor_t *hub_desc; ++ hprt0_data_t hprt0 = {.d32 = 0 }; ++ ++ uint32_t port_status; ++ ++ switch (typeReq) { ++ case UCR_CLEAR_HUB_FEATURE: ++ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD HUB CONTROL - " ++ "ClearHubFeature 0x%x\n", wValue); ++ switch (wValue) { ++ case UHF_C_HUB_LOCAL_POWER: ++ case UHF_C_HUB_OVER_CURRENT: ++ /* Nothing required here */ ++ break; ++ default: ++ retval = -DWC_E_INVALID; ++ DWC_ERROR("DWC OTG HCD - " ++ "ClearHubFeature request %xh unknown\n", ++ wValue); ++ } ++ break; ++ case UCR_CLEAR_PORT_FEATURE: ++#ifdef CONFIG_USB_DWC_OTG_LPM ++ if (wValue != UHF_PORT_L1) ++#endif ++ if (!wIndex || wIndex > 1) ++ goto error; ++ ++ switch (wValue) { ++ case UHF_PORT_ENABLE: ++ DWC_DEBUGPL(DBG_ANY, "DWC OTG HCD HUB CONTROL - " ++ "ClearPortFeature USB_PORT_FEAT_ENABLE\n"); ++ hprt0.d32 = dwc_otg_read_hprt0(core_if); ++ hprt0.b.prtena = 1; ++ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); ++ break; ++ case UHF_PORT_SUSPEND: ++ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD HUB CONTROL - " ++ "ClearPortFeature USB_PORT_FEAT_SUSPEND\n"); ++ ++ if (core_if->power_down == 2) { ++ dwc_otg_host_hibernation_restore(core_if, 0, 0); ++ } else { ++ DWC_WRITE_REG32(core_if->pcgcctl, 0); ++ dwc_mdelay(5); ++ ++ hprt0.d32 = dwc_otg_read_hprt0(core_if); ++ hprt0.b.prtres = 1; ++ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); ++ hprt0.b.prtsusp = 0; ++ /* Clear Resume bit */ ++ dwc_mdelay(100); ++ hprt0.b.prtres = 0; ++ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); ++ } ++ break; ++#ifdef CONFIG_USB_DWC_OTG_LPM ++ case UHF_PORT_L1: ++ { ++ pcgcctl_data_t pcgcctl = {.d32 = 0 }; ++ glpmcfg_data_t lpmcfg = {.d32 = 0 }; ++ ++ lpmcfg.d32 = ++ DWC_READ_REG32(&core_if-> ++ core_global_regs->glpmcfg); ++ lpmcfg.b.en_utmi_sleep = 0; ++ lpmcfg.b.hird_thres &= (~(1 << 4)); ++ lpmcfg.b.prt_sleep_sts = 1; ++ DWC_WRITE_REG32(&core_if-> ++ core_global_regs->glpmcfg, ++ lpmcfg.d32); ++ ++ /* Clear Enbl_L1Gating bit. */ ++ pcgcctl.b.enbl_sleep_gating = 1; ++ DWC_MODIFY_REG32(core_if->pcgcctl, pcgcctl.d32, ++ 0); ++ ++ dwc_mdelay(5); ++ ++ hprt0.d32 = dwc_otg_read_hprt0(core_if); ++ hprt0.b.prtres = 1; ++ DWC_WRITE_REG32(core_if->host_if->hprt0, ++ hprt0.d32); ++ /* This bit will be cleared in wakeup interrupt handle */ ++ break; ++ } ++#endif ++ case UHF_PORT_POWER: ++ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD HUB CONTROL - " ++ "ClearPortFeature USB_PORT_FEAT_POWER\n"); ++ hprt0.d32 = dwc_otg_read_hprt0(core_if); ++ hprt0.b.prtpwr = 0; ++ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); ++ break; ++ case UHF_PORT_INDICATOR: ++ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD HUB CONTROL - " ++ "ClearPortFeature USB_PORT_FEAT_INDICATOR\n"); ++ /* Port inidicator not supported */ ++ break; ++ case UHF_C_PORT_CONNECTION: ++ /* Clears drivers internal connect status change ++ * flag */ ++ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD HUB CONTROL - " ++ "ClearPortFeature USB_PORT_FEAT_C_CONNECTION\n"); ++ dwc_otg_hcd->flags.b.port_connect_status_change = 0; ++ break; ++ case UHF_C_PORT_RESET: ++ /* Clears the driver's internal Port Reset Change ++ * flag */ ++ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD HUB CONTROL - " ++ "ClearPortFeature USB_PORT_FEAT_C_RESET\n"); ++ dwc_otg_hcd->flags.b.port_reset_change = 0; ++ break; ++ case UHF_C_PORT_ENABLE: ++ /* Clears the driver's internal Port ++ * Enable/Disable Change flag */ ++ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD HUB CONTROL - " ++ "ClearPortFeature USB_PORT_FEAT_C_ENABLE\n"); ++ dwc_otg_hcd->flags.b.port_enable_change = 0; ++ break; ++ case UHF_C_PORT_SUSPEND: ++ /* Clears the driver's internal Port Suspend ++ * Change flag, which is set when resume signaling on ++ * the host port is complete */ ++ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD HUB CONTROL - " ++ "ClearPortFeature USB_PORT_FEAT_C_SUSPEND\n"); ++ dwc_otg_hcd->flags.b.port_suspend_change = 0; ++ break; ++#ifdef CONFIG_USB_DWC_OTG_LPM ++ case UHF_C_PORT_L1: ++ dwc_otg_hcd->flags.b.port_l1_change = 0; ++ break; ++#endif ++ case UHF_C_PORT_OVER_CURRENT: ++ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD HUB CONTROL - " ++ "ClearPortFeature USB_PORT_FEAT_C_OVER_CURRENT\n"); ++ dwc_otg_hcd->flags.b.port_over_current_change = 0; ++ break; ++ default: ++ retval = -DWC_E_INVALID; ++ DWC_ERROR("DWC OTG HCD - " ++ "ClearPortFeature request %xh " ++ "unknown or unsupported\n", wValue); ++ } ++ break; ++ case UCR_GET_HUB_DESCRIPTOR: ++ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD HUB CONTROL - " ++ "GetHubDescriptor\n"); ++ hub_desc = (usb_hub_descriptor_t *) buf; ++ hub_desc->bDescLength = 9; ++ hub_desc->bDescriptorType = 0x29; ++ hub_desc->bNbrPorts = 1; ++ USETW(hub_desc->wHubCharacteristics, 0x08); ++ hub_desc->bPwrOn2PwrGood = 1; ++ hub_desc->bHubContrCurrent = 0; ++ hub_desc->DeviceRemovable[0] = 0; ++ hub_desc->DeviceRemovable[1] = 0xff; ++ break; ++ case UCR_GET_HUB_STATUS: ++ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD HUB CONTROL - " ++ "GetHubStatus\n"); ++ DWC_MEMSET(buf, 0, 4); ++ break; ++ case UCR_GET_PORT_STATUS: ++ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD HUB CONTROL - " ++ "GetPortStatus wIndex = 0x%04x FLAGS=0x%08x\n", ++ wIndex, dwc_otg_hcd->flags.d32); ++ if (!wIndex || wIndex > 1) ++ goto error; ++ ++ port_status = 0; ++ ++ if (dwc_otg_hcd->flags.b.port_connect_status_change) ++ port_status |= (1 << UHF_C_PORT_CONNECTION); ++ ++ if (dwc_otg_hcd->flags.b.port_enable_change) ++ port_status |= (1 << UHF_C_PORT_ENABLE); ++ ++ if (dwc_otg_hcd->flags.b.port_suspend_change) ++ port_status |= (1 << UHF_C_PORT_SUSPEND); ++ ++ if (dwc_otg_hcd->flags.b.port_l1_change) ++ port_status |= (1 << UHF_C_PORT_L1); ++ ++ if (dwc_otg_hcd->flags.b.port_reset_change) { ++ port_status |= (1 << UHF_C_PORT_RESET); ++ } ++ ++ if (dwc_otg_hcd->flags.b.port_over_current_change) { ++ DWC_WARN("Overcurrent change detected\n"); ++ port_status |= (1 << UHF_C_PORT_OVER_CURRENT); ++ } ++ ++ if (!dwc_otg_hcd->flags.b.port_connect_status) { ++ /* ++ * The port is disconnected, which means the core is ++ * either in device mode or it soon will be. Just ++ * return 0's for the remainder of the port status ++ * since the port register can't be read if the core ++ * is in device mode. ++ */ ++ *((__le32 *) buf) = dwc_cpu_to_le32(&port_status); ++ break; ++ } ++ ++ hprt0.d32 = DWC_READ_REG32(core_if->host_if->hprt0); ++ DWC_DEBUGPL(DBG_HCDV, " HPRT0: 0x%08x\n", hprt0.d32); ++ ++ if (hprt0.b.prtconnsts) ++ port_status |= (1 << UHF_PORT_CONNECTION); ++ ++ if (hprt0.b.prtena) ++ port_status |= (1 << UHF_PORT_ENABLE); ++ ++ if (hprt0.b.prtsusp) ++ port_status |= (1 << UHF_PORT_SUSPEND); ++ ++ if (hprt0.b.prtovrcurract) ++ port_status |= (1 << UHF_PORT_OVER_CURRENT); ++ ++ if (hprt0.b.prtrst) ++ port_status |= (1 << UHF_PORT_RESET); ++ ++ if (hprt0.b.prtpwr) ++ port_status |= (1 << UHF_PORT_POWER); ++ ++ if (hprt0.b.prtspd == DWC_HPRT0_PRTSPD_HIGH_SPEED) ++ port_status |= (1 << UHF_PORT_HIGH_SPEED); ++ else if (hprt0.b.prtspd == DWC_HPRT0_PRTSPD_LOW_SPEED) ++ port_status |= (1 << UHF_PORT_LOW_SPEED); ++ ++ if (hprt0.b.prttstctl) ++ port_status |= (1 << UHF_PORT_TEST); ++ if (dwc_otg_get_lpm_portsleepstatus(dwc_otg_hcd->core_if)) { ++ port_status |= (1 << UHF_PORT_L1); ++ } ++ /* ++ For Synopsys HW emulation of Power down wkup_control asserts the ++ hreset_n and prst_n on suspned. This causes the HPRT0 to be zero. ++ We intentionally tell the software that port is in L2Suspend state. ++ Only for STE. ++ */ ++ if ((core_if->power_down == 2) ++ && (core_if->hibernation_suspend == 1)) { ++ port_status |= (1 << UHF_PORT_SUSPEND); ++ } ++ /* USB_PORT_FEAT_INDICATOR unsupported always 0 */ ++ ++ *((__le32 *) buf) = dwc_cpu_to_le32(&port_status); ++ ++ break; ++ case UCR_SET_HUB_FEATURE: ++ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD HUB CONTROL - " ++ "SetHubFeature\n"); ++ /* No HUB features supported */ ++ break; ++ case UCR_SET_PORT_FEATURE: ++ if (wValue != UHF_PORT_TEST && (!wIndex || wIndex > 1)) ++ goto error; ++ ++ if (!dwc_otg_hcd->flags.b.port_connect_status) { ++ /* ++ * The port is disconnected, which means the core is ++ * either in device mode or it soon will be. Just ++ * return without doing anything since the port ++ * register can't be written if the core is in device ++ * mode. ++ */ ++ break; ++ } ++ ++ switch (wValue) { ++ case UHF_PORT_SUSPEND: ++ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD HUB CONTROL - " ++ "SetPortFeature - USB_PORT_FEAT_SUSPEND\n"); ++ if (dwc_otg_hcd_otg_port(dwc_otg_hcd) != wIndex) { ++ goto error; ++ } ++ if (core_if->power_down == 2) { ++ int timeout = 300; ++ dwc_irqflags_t flags; ++ pcgcctl_data_t pcgcctl = {.d32 = 0 }; ++ gpwrdn_data_t gpwrdn = {.d32 = 0 }; ++ gusbcfg_data_t gusbcfg = {.d32 = 0 }; ++#ifdef DWC_DEV_SRPCAP ++ int32_t otg_cap_param = core_if->core_params->otg_cap; ++#endif ++ DWC_PRINTF("Preparing for complete power-off\n"); ++ ++ /* Save registers before hibernation */ ++ dwc_otg_save_global_regs(core_if); ++ dwc_otg_save_host_regs(core_if); ++ ++ hprt0.d32 = dwc_otg_read_hprt0(core_if); ++ hprt0.b.prtsusp = 1; ++ hprt0.b.prtena = 0; ++ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); ++ /* Spin hprt0.b.prtsusp to became 1 */ ++ do { ++ hprt0.d32 = dwc_otg_read_hprt0(core_if); ++ if (hprt0.b.prtsusp) { ++ break; ++ } ++ dwc_mdelay(1); ++ } while (--timeout); ++ if (!timeout) { ++ DWC_WARN("Suspend wasn't genereted\n"); ++ } ++ dwc_udelay(10); ++ ++ /* ++ * We need to disable interrupts to prevent servicing of any IRQ ++ * during going to hibernation ++ */ ++ DWC_SPINLOCK_IRQSAVE(dwc_otg_hcd->lock, &flags); ++ core_if->lx_state = DWC_OTG_L2; ++#ifdef DWC_DEV_SRPCAP ++ hprt0.d32 = dwc_otg_read_hprt0(core_if); ++ hprt0.b.prtpwr = 0; ++ hprt0.b.prtena = 0; ++ DWC_WRITE_REG32(core_if->host_if->hprt0, ++ hprt0.d32); ++#endif ++ gusbcfg.d32 = ++ DWC_READ_REG32(&core_if->core_global_regs-> ++ gusbcfg); ++ if (gusbcfg.b.ulpi_utmi_sel == 1) { ++ /* ULPI interface */ ++ /* Suspend the Phy Clock */ ++ pcgcctl.d32 = 0; ++ pcgcctl.b.stoppclk = 1; ++ DWC_MODIFY_REG32(core_if->pcgcctl, 0, ++ pcgcctl.d32); ++ dwc_udelay(10); ++ gpwrdn.b.pmuactv = 1; ++ DWC_MODIFY_REG32(&core_if-> ++ core_global_regs-> ++ gpwrdn, 0, gpwrdn.d32); ++ } else { ++ /* UTMI+ Interface */ ++ gpwrdn.b.pmuactv = 1; ++ DWC_MODIFY_REG32(&core_if-> ++ core_global_regs-> ++ gpwrdn, 0, gpwrdn.d32); ++ dwc_udelay(10); ++ pcgcctl.b.stoppclk = 1; ++ DWC_MODIFY_REG32(core_if->pcgcctl, 0, pcgcctl.d32); ++ dwc_udelay(10); ++ } ++#ifdef DWC_DEV_SRPCAP ++ gpwrdn.d32 = 0; ++ gpwrdn.b.dis_vbus = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs-> ++ gpwrdn, 0, gpwrdn.d32); ++#endif ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pmuintsel = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs-> ++ gpwrdn, 0, gpwrdn.d32); ++ dwc_udelay(10); ++ ++ gpwrdn.d32 = 0; ++#ifdef DWC_DEV_SRPCAP ++ gpwrdn.b.srp_det_msk = 1; ++#endif ++ gpwrdn.b.disconn_det_msk = 1; ++ gpwrdn.b.lnstchng_msk = 1; ++ gpwrdn.b.sts_chngint_msk = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs-> ++ gpwrdn, 0, gpwrdn.d32); ++ dwc_udelay(10); ++ ++ /* Enable Power Down Clamp and all interrupts in GPWRDN */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pwrdnclmp = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs-> ++ gpwrdn, 0, gpwrdn.d32); ++ dwc_udelay(10); ++ ++ /* Switch off VDD */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pwrdnswtch = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs-> ++ gpwrdn, 0, gpwrdn.d32); ++ ++#ifdef DWC_DEV_SRPCAP ++ if (otg_cap_param == DWC_OTG_CAP_PARAM_HNP_SRP_CAPABLE) ++ { ++ core_if->pwron_timer_started = 1; ++ DWC_TIMER_SCHEDULE(core_if->pwron_timer, 6000 /* 6 secs */ ); ++ } ++#endif ++ /* Save gpwrdn register for further usage if stschng interrupt */ ++ core_if->gr_backup->gpwrdn_local = ++ DWC_READ_REG32(&core_if->core_global_regs->gpwrdn); ++ ++ /* Set flag to indicate that we are in hibernation */ ++ core_if->hibernation_suspend = 1; ++ DWC_SPINUNLOCK_IRQRESTORE(dwc_otg_hcd->lock,flags); ++ ++ DWC_PRINTF("Host hibernation completed\n"); ++ // Exit from case statement ++ break; ++ ++ } ++ if (dwc_otg_hcd_otg_port(dwc_otg_hcd) == wIndex && ++ dwc_otg_hcd->fops->get_b_hnp_enable(dwc_otg_hcd)) { ++ gotgctl_data_t gotgctl = {.d32 = 0 }; ++ gotgctl.b.hstsethnpen = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs-> ++ gotgctl, 0, gotgctl.d32); ++ core_if->op_state = A_SUSPEND; ++ } ++ hprt0.d32 = dwc_otg_read_hprt0(core_if); ++ hprt0.b.prtsusp = 1; ++ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); ++ { ++ dwc_irqflags_t flags; ++ /* Update lx_state */ ++ DWC_SPINLOCK_IRQSAVE(dwc_otg_hcd->lock, &flags); ++ core_if->lx_state = DWC_OTG_L2; ++ DWC_SPINUNLOCK_IRQRESTORE(dwc_otg_hcd->lock, flags); ++ } ++ /* Suspend the Phy Clock */ ++ { ++ pcgcctl_data_t pcgcctl = {.d32 = 0 }; ++ pcgcctl.b.stoppclk = 1; ++ DWC_MODIFY_REG32(core_if->pcgcctl, 0, ++ pcgcctl.d32); ++ dwc_udelay(10); ++ } ++ ++ /* For HNP the bus must be suspended for at least 200ms. */ ++ if (dwc_otg_hcd->fops->get_b_hnp_enable(dwc_otg_hcd)) { ++ pcgcctl_data_t pcgcctl = {.d32 = 0 }; ++ pcgcctl.b.stoppclk = 1; ++ DWC_MODIFY_REG32(core_if->pcgcctl, pcgcctl.d32, 0); ++ dwc_mdelay(200); ++ } ++ ++ /** @todo - check how sw can wait for 1 sec to check asesvld??? */ ++#if 0 //vahrama !!!!!!!!!!!!!!!!!! ++ if (core_if->adp_enable) { ++ gotgctl_data_t gotgctl = {.d32 = 0 }; ++ gpwrdn_data_t gpwrdn; ++ ++ while (gotgctl.b.asesvld == 1) { ++ gotgctl.d32 = ++ DWC_READ_REG32(&core_if-> ++ core_global_regs-> ++ gotgctl); ++ dwc_mdelay(100); ++ } ++ ++ /* Enable Power Down Logic */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pmuactv = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs-> ++ gpwrdn, 0, gpwrdn.d32); ++ ++ /* Unmask SRP detected interrupt from Power Down Logic */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.srp_det_msk = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs-> ++ gpwrdn, 0, gpwrdn.d32); ++ ++ dwc_otg_adp_probe_start(core_if); ++ } ++#endif ++ break; ++ case UHF_PORT_POWER: ++ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD HUB CONTROL - " ++ "SetPortFeature - USB_PORT_FEAT_POWER\n"); ++ hprt0.d32 = dwc_otg_read_hprt0(core_if); ++ hprt0.b.prtpwr = 1; ++ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); ++ break; ++ case UHF_PORT_RESET: ++ if ((core_if->power_down == 2) ++ && (core_if->hibernation_suspend == 1)) { ++ /* If we are going to exit from Hibernated ++ * state via USB RESET. ++ */ ++ dwc_otg_host_hibernation_restore(core_if, 0, 1); ++ } else { ++ hprt0.d32 = dwc_otg_read_hprt0(core_if); ++ ++ DWC_DEBUGPL(DBG_HCD, ++ "DWC OTG HCD HUB CONTROL - " ++ "SetPortFeature - USB_PORT_FEAT_RESET\n"); ++ { ++ pcgcctl_data_t pcgcctl = {.d32 = 0 }; ++ pcgcctl.b.enbl_sleep_gating = 1; ++ pcgcctl.b.stoppclk = 1; ++ DWC_MODIFY_REG32(core_if->pcgcctl, pcgcctl.d32, 0); ++ DWC_WRITE_REG32(core_if->pcgcctl, 0); ++ } ++#ifdef CONFIG_USB_DWC_OTG_LPM ++ { ++ glpmcfg_data_t lpmcfg; ++ lpmcfg.d32 = ++ DWC_READ_REG32(&core_if->core_global_regs->glpmcfg); ++ if (lpmcfg.b.prt_sleep_sts) { ++ lpmcfg.b.en_utmi_sleep = 0; ++ lpmcfg.b.hird_thres &= (~(1 << 4)); ++ DWC_WRITE_REG32 ++ (&core_if->core_global_regs->glpmcfg, ++ lpmcfg.d32); ++ dwc_mdelay(1); ++ } ++ } ++#endif ++ hprt0.d32 = dwc_otg_read_hprt0(core_if); ++ /* Clear suspend bit if resetting from suspended state. */ ++ hprt0.b.prtsusp = 0; ++ /* When B-Host the Port reset bit is set in ++ * the Start HCD Callback function, so that ++ * the reset is started within 1ms of the HNP ++ * success interrupt. */ ++ if (!dwc_otg_hcd_is_b_host(dwc_otg_hcd)) { ++ hprt0.b.prtpwr = 1; ++ hprt0.b.prtrst = 1; ++ DWC_PRINTF("Indeed it is in host mode hprt0 = %08x\n",hprt0.d32); ++ DWC_WRITE_REG32(core_if->host_if->hprt0, ++ hprt0.d32); ++ } ++ /* Clear reset bit in 10ms (FS/LS) or 50ms (HS) */ ++ dwc_mdelay(60); ++ hprt0.b.prtrst = 0; ++ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); ++ core_if->lx_state = DWC_OTG_L0; /* Now back to the on state */ ++ } ++ break; ++#ifdef DWC_HS_ELECT_TST ++ case UHF_PORT_TEST: ++ { ++ uint32_t t; ++ gintmsk_data_t gintmsk; ++ ++ t = (wIndex >> 8); /* MSB wIndex USB */ ++ DWC_DEBUGPL(DBG_HCD, ++ "DWC OTG HCD HUB CONTROL - " ++ "SetPortFeature - USB_PORT_FEAT_TEST %d\n", ++ t); ++ DWC_WARN("USB_PORT_FEAT_TEST %d\n", t); ++ if (t < 6) { ++ hprt0.d32 = dwc_otg_read_hprt0(core_if); ++ hprt0.b.prttstctl = t; ++ DWC_WRITE_REG32(core_if->host_if->hprt0, ++ hprt0.d32); ++ } else { ++ /* Setup global vars with reg addresses (quick and ++ * dirty hack, should be cleaned up) ++ */ ++ global_regs = core_if->core_global_regs; ++ hc_global_regs = ++ core_if->host_if->host_global_regs; ++ hc_regs = ++ (dwc_otg_hc_regs_t *) ((char *) ++ global_regs + ++ 0x500); ++ data_fifo = ++ (uint32_t *) ((char *)global_regs + ++ 0x1000); ++ ++ if (t == 6) { /* HS_HOST_PORT_SUSPEND_RESUME */ ++ /* Save current interrupt mask */ ++ gintmsk.d32 = ++ DWC_READ_REG32 ++ (&global_regs->gintmsk); ++ ++ /* Disable all interrupts while we muck with ++ * the hardware directly ++ */ ++ DWC_WRITE_REG32(&global_regs->gintmsk, 0); ++ ++ /* 15 second delay per the test spec */ ++ dwc_mdelay(15000); ++ ++ /* Drive suspend on the root port */ ++ hprt0.d32 = ++ dwc_otg_read_hprt0(core_if); ++ hprt0.b.prtsusp = 1; ++ hprt0.b.prtres = 0; ++ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); ++ ++ /* 15 second delay per the test spec */ ++ dwc_mdelay(15000); ++ ++ /* Drive resume on the root port */ ++ hprt0.d32 = ++ dwc_otg_read_hprt0(core_if); ++ hprt0.b.prtsusp = 0; ++ hprt0.b.prtres = 1; ++ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); ++ dwc_mdelay(100); ++ ++ /* Clear the resume bit */ ++ hprt0.b.prtres = 0; ++ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); ++ ++ /* Restore interrupts */ ++ DWC_WRITE_REG32(&global_regs->gintmsk, gintmsk.d32); ++ } else if (t == 7) { /* SINGLE_STEP_GET_DEVICE_DESCRIPTOR setup */ ++ /* Save current interrupt mask */ ++ gintmsk.d32 = ++ DWC_READ_REG32 ++ (&global_regs->gintmsk); ++ ++ /* Disable all interrupts while we muck with ++ * the hardware directly ++ */ ++ DWC_WRITE_REG32(&global_regs->gintmsk, 0); ++ ++ /* 15 second delay per the test spec */ ++ dwc_mdelay(15000); ++ ++ /* Send the Setup packet */ ++ do_setup(); ++ ++ /* 15 second delay so nothing else happens for awhile */ ++ dwc_mdelay(15000); ++ ++ /* Restore interrupts */ ++ DWC_WRITE_REG32(&global_regs->gintmsk, gintmsk.d32); ++ } else if (t == 8) { /* SINGLE_STEP_GET_DEVICE_DESCRIPTOR execute */ ++ /* Save current interrupt mask */ ++ gintmsk.d32 = ++ DWC_READ_REG32 ++ (&global_regs->gintmsk); ++ ++ /* Disable all interrupts while we muck with ++ * the hardware directly ++ */ ++ DWC_WRITE_REG32(&global_regs->gintmsk, 0); ++ ++ /* Send the Setup packet */ ++ do_setup(); ++ ++ /* 15 second delay so nothing else happens for awhile */ ++ dwc_mdelay(15000); ++ ++ /* Send the In and Ack packets */ ++ do_in_ack(); ++ ++ /* 15 second delay so nothing else happens for awhile */ ++ dwc_mdelay(15000); ++ ++ /* Restore interrupts */ ++ DWC_WRITE_REG32(&global_regs->gintmsk, gintmsk.d32); ++ } ++ } ++ break; ++ } ++#endif /* DWC_HS_ELECT_TST */ ++ ++ case UHF_PORT_INDICATOR: ++ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD HUB CONTROL - " ++ "SetPortFeature - USB_PORT_FEAT_INDICATOR\n"); ++ /* Not supported */ ++ break; ++ default: ++ retval = -DWC_E_INVALID; ++ DWC_ERROR("DWC OTG HCD - " ++ "SetPortFeature request %xh " ++ "unknown or unsupported\n", wValue); ++ break; ++ } ++ break; ++#ifdef CONFIG_USB_DWC_OTG_LPM ++ case UCR_SET_AND_TEST_PORT_FEATURE: ++ if (wValue != UHF_PORT_L1) { ++ goto error; ++ } ++ { ++ int portnum, hird, devaddr, remwake; ++ glpmcfg_data_t lpmcfg; ++ uint32_t time_usecs; ++ gintsts_data_t gintsts; ++ gintmsk_data_t gintmsk; ++ ++ if (!dwc_otg_get_param_lpm_enable(core_if)) { ++ goto error; ++ } ++ if (wValue != UHF_PORT_L1 || wLength != 1) { ++ goto error; ++ } ++ /* Check if the port currently is in SLEEP state */ ++ lpmcfg.d32 = ++ DWC_READ_REG32(&core_if->core_global_regs->glpmcfg); ++ if (lpmcfg.b.prt_sleep_sts) { ++ DWC_INFO("Port is already in sleep mode\n"); ++ buf[0] = 0; /* Return success */ ++ break; ++ } ++ ++ portnum = wIndex & 0xf; ++ hird = (wIndex >> 4) & 0xf; ++ devaddr = (wIndex >> 8) & 0x7f; ++ remwake = (wIndex >> 15); ++ ++ if (portnum != 1) { ++ retval = -DWC_E_INVALID; ++ DWC_WARN ++ ("Wrong port number(%d) in SetandTestPortFeature request\n", ++ portnum); ++ break; ++ } ++ ++ DWC_PRINTF ++ ("SetandTestPortFeature request: portnum = %d, hird = %d, devaddr = %d, rewake = %d\n", ++ portnum, hird, devaddr, remwake); ++ /* Disable LPM interrupt */ ++ gintmsk.d32 = 0; ++ gintmsk.b.lpmtranrcvd = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gintmsk, ++ gintmsk.d32, 0); ++ ++ if (dwc_otg_hcd_send_lpm ++ (dwc_otg_hcd, devaddr, hird, remwake)) { ++ retval = -DWC_E_INVALID; ++ break; ++ } ++ ++ time_usecs = 10 * (lpmcfg.b.retry_count + 1); ++ /* We will consider timeout if time_usecs microseconds pass, ++ * and we don't receive LPM transaction status. ++ * After receiving non-error responce(ACK/NYET/STALL) from device, ++ * core will set lpmtranrcvd bit. ++ */ ++ do { ++ gintsts.d32 = ++ DWC_READ_REG32(&core_if->core_global_regs->gintsts); ++ if (gintsts.b.lpmtranrcvd) { ++ break; ++ } ++ dwc_udelay(1); ++ } while (--time_usecs); ++ /* lpm_int bit will be cleared in LPM interrupt handler */ ++ ++ /* Now fill status ++ * 0x00 - Success ++ * 0x10 - NYET ++ * 0x11 - Timeout ++ */ ++ if (!gintsts.b.lpmtranrcvd) { ++ buf[0] = 0x3; /* Completion code is Timeout */ ++ dwc_otg_hcd_free_hc_from_lpm(dwc_otg_hcd); ++ } else { ++ lpmcfg.d32 = ++ DWC_READ_REG32(&core_if->core_global_regs->glpmcfg); ++ if (lpmcfg.b.lpm_resp == 0x3) { ++ /* ACK responce from the device */ ++ buf[0] = 0x00; /* Success */ ++ } else if (lpmcfg.b.lpm_resp == 0x2) { ++ /* NYET responce from the device */ ++ buf[0] = 0x2; ++ } else { ++ /* Otherwise responce with Timeout */ ++ buf[0] = 0x3; ++ } ++ } ++ DWC_PRINTF("Device responce to LPM trans is %x\n", ++ lpmcfg.b.lpm_resp); ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gintmsk, 0, ++ gintmsk.d32); ++ ++ break; ++ } ++#endif /* CONFIG_USB_DWC_OTG_LPM */ ++ default: ++error: ++ retval = -DWC_E_INVALID; ++ DWC_WARN("DWC OTG HCD - " ++ "Unknown hub control request type or invalid typeReq: %xh wIndex: %xh wValue: %xh\n", ++ typeReq, wIndex, wValue); ++ break; ++ } ++ ++ return retval; ++} ++ ++#ifdef CONFIG_USB_DWC_OTG_LPM ++/** Returns index of host channel to perform LPM transaction. */ ++int dwc_otg_hcd_get_hc_for_lpm_tran(dwc_otg_hcd_t * hcd, uint8_t devaddr) ++{ ++ dwc_otg_core_if_t *core_if = hcd->core_if; ++ dwc_hc_t *hc; ++ hcchar_data_t hcchar; ++ gintmsk_data_t gintmsk = {.d32 = 0 }; ++ ++ if (DWC_CIRCLEQ_EMPTY(&hcd->free_hc_list)) { ++ DWC_PRINTF("No free channel to select for LPM transaction\n"); ++ return -1; ++ } ++ ++ hc = DWC_CIRCLEQ_FIRST(&hcd->free_hc_list); ++ ++ /* Mask host channel interrupts. */ ++ gintmsk.b.hcintr = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gintmsk, gintmsk.d32, 0); ++ ++ /* Fill fields that core needs for LPM transaction */ ++ hcchar.b.devaddr = devaddr; ++ hcchar.b.epnum = 0; ++ hcchar.b.eptype = DWC_OTG_EP_TYPE_CONTROL; ++ hcchar.b.mps = 64; ++ hcchar.b.lspddev = (hc->speed == DWC_OTG_EP_SPEED_LOW); ++ hcchar.b.epdir = 0; /* OUT */ ++ DWC_WRITE_REG32(&core_if->host_if->hc_regs[hc->hc_num]->hcchar, ++ hcchar.d32); ++ ++ /* Remove the host channel from the free list. */ ++ DWC_CIRCLEQ_REMOVE_INIT(&hcd->free_hc_list, hc, hc_list_entry); ++ ++ DWC_PRINTF("hcnum = %d devaddr = %d\n", hc->hc_num, devaddr); ++ ++ return hc->hc_num; ++} ++ ++/** Release hc after performing LPM transaction */ ++void dwc_otg_hcd_free_hc_from_lpm(dwc_otg_hcd_t * hcd) ++{ ++ dwc_hc_t *hc; ++ glpmcfg_data_t lpmcfg; ++ uint8_t hc_num; ++ ++ lpmcfg.d32 = DWC_READ_REG32(&hcd->core_if->core_global_regs->glpmcfg); ++ hc_num = lpmcfg.b.lpm_chan_index; ++ ++ hc = hcd->hc_ptr_array[hc_num]; ++ ++ DWC_PRINTF("Freeing channel %d after LPM\n", hc_num); ++ /* Return host channel to free list */ ++ DWC_CIRCLEQ_INSERT_TAIL(&hcd->free_hc_list, hc, hc_list_entry); ++} ++ ++int dwc_otg_hcd_send_lpm(dwc_otg_hcd_t * hcd, uint8_t devaddr, uint8_t hird, ++ uint8_t bRemoteWake) ++{ ++ glpmcfg_data_t lpmcfg; ++ pcgcctl_data_t pcgcctl = {.d32 = 0 }; ++ int channel; ++ ++ channel = dwc_otg_hcd_get_hc_for_lpm_tran(hcd, devaddr); ++ if (channel < 0) { ++ return channel; ++ } ++ ++ pcgcctl.b.enbl_sleep_gating = 1; ++ DWC_MODIFY_REG32(hcd->core_if->pcgcctl, 0, pcgcctl.d32); ++ ++ /* Read LPM config register */ ++ lpmcfg.d32 = DWC_READ_REG32(&hcd->core_if->core_global_regs->glpmcfg); ++ ++ /* Program LPM transaction fields */ ++ lpmcfg.b.rem_wkup_en = bRemoteWake; ++ lpmcfg.b.hird = hird; ++ lpmcfg.b.hird_thres = 0x1c; ++ lpmcfg.b.lpm_chan_index = channel; ++ lpmcfg.b.en_utmi_sleep = 1; ++ /* Program LPM config register */ ++ DWC_WRITE_REG32(&hcd->core_if->core_global_regs->glpmcfg, lpmcfg.d32); ++ ++ /* Send LPM transaction */ ++ lpmcfg.b.send_lpm = 1; ++ DWC_WRITE_REG32(&hcd->core_if->core_global_regs->glpmcfg, lpmcfg.d32); ++ ++ return 0; ++} ++ ++#endif /* CONFIG_USB_DWC_OTG_LPM */ ++ ++int dwc_otg_hcd_is_status_changed(dwc_otg_hcd_t * hcd, int port) ++{ ++ int retval; ++ ++ if (port != 1) { ++ return -DWC_E_INVALID; ++ } ++ ++ retval = (hcd->flags.b.port_connect_status_change || ++ hcd->flags.b.port_reset_change || ++ hcd->flags.b.port_enable_change || ++ hcd->flags.b.port_suspend_change || ++ hcd->flags.b.port_over_current_change); ++#ifdef DEBUG ++ if (retval) { ++ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD HUB STATUS DATA:" ++ " Root port status changed\n"); ++ DWC_DEBUGPL(DBG_HCDV, " port_connect_status_change: %d\n", ++ hcd->flags.b.port_connect_status_change); ++ DWC_DEBUGPL(DBG_HCDV, " port_reset_change: %d\n", ++ hcd->flags.b.port_reset_change); ++ DWC_DEBUGPL(DBG_HCDV, " port_enable_change: %d\n", ++ hcd->flags.b.port_enable_change); ++ DWC_DEBUGPL(DBG_HCDV, " port_suspend_change: %d\n", ++ hcd->flags.b.port_suspend_change); ++ DWC_DEBUGPL(DBG_HCDV, " port_over_current_change: %d\n", ++ hcd->flags.b.port_over_current_change); ++ } ++#endif ++ return retval; ++} ++ ++int dwc_otg_hcd_get_frame_number(dwc_otg_hcd_t * dwc_otg_hcd) ++{ ++ hfnum_data_t hfnum; ++ hfnum.d32 = ++ DWC_READ_REG32(&dwc_otg_hcd->core_if->host_if->host_global_regs-> ++ hfnum); ++ ++#ifdef DEBUG_SOF ++ DWC_DEBUGPL(DBG_HCDV, "DWC OTG HCD GET FRAME NUMBER %d\n", ++ hfnum.b.frnum); ++#endif ++ return hfnum.b.frnum; ++} ++ ++int dwc_otg_hcd_start(dwc_otg_hcd_t * hcd, ++ struct dwc_otg_hcd_function_ops *fops) ++{ ++ int retval = 0; ++ ++ hcd->fops = fops; ++ if (!dwc_otg_is_device_mode(hcd->core_if) && ++ (!hcd->core_if->adp_enable || hcd->core_if->adp.adp_started)) { ++ dwc_otg_hcd_reinit(hcd); ++ } else { ++ retval = -DWC_E_NO_DEVICE; ++ } ++ ++ return retval; ++} ++ ++void *dwc_otg_hcd_get_priv_data(dwc_otg_hcd_t * hcd) ++{ ++ return hcd->priv; ++} ++ ++void dwc_otg_hcd_set_priv_data(dwc_otg_hcd_t * hcd, void *priv_data) ++{ ++ hcd->priv = priv_data; ++} ++ ++uint32_t dwc_otg_hcd_otg_port(dwc_otg_hcd_t * hcd) ++{ ++ return hcd->otg_port; ++} ++ ++uint32_t dwc_otg_hcd_is_b_host(dwc_otg_hcd_t * hcd) ++{ ++ uint32_t is_b_host; ++ if (hcd->core_if->op_state == B_HOST) { ++ is_b_host = 1; ++ } else { ++ is_b_host = 0; ++ } ++ ++ return is_b_host; ++} ++ ++dwc_otg_hcd_urb_t *dwc_otg_hcd_urb_alloc(dwc_otg_hcd_t * hcd, ++ int iso_desc_count, int atomic_alloc) ++{ ++ dwc_otg_hcd_urb_t *dwc_otg_urb; ++ uint32_t size; ++ ++ size = ++ sizeof(*dwc_otg_urb) + ++ iso_desc_count * sizeof(struct dwc_otg_hcd_iso_packet_desc); ++ if (atomic_alloc) ++ dwc_otg_urb = DWC_ALLOC_ATOMIC(size); ++ else ++ dwc_otg_urb = DWC_ALLOC(size); ++ ++ if (dwc_otg_urb) ++ dwc_otg_urb->packet_count = iso_desc_count; ++ else { ++ DWC_ERROR("**** DWC OTG HCD URB alloc - " ++ "%salloc of %db failed\n", ++ atomic_alloc?"atomic ":"", size); ++ } ++ return dwc_otg_urb; ++} ++ ++void dwc_otg_hcd_urb_set_pipeinfo(dwc_otg_hcd_urb_t * dwc_otg_urb, ++ uint8_t dev_addr, uint8_t ep_num, ++ uint8_t ep_type, uint8_t ep_dir, uint16_t mps) ++{ ++ dwc_otg_hcd_fill_pipe(&dwc_otg_urb->pipe_info, dev_addr, ep_num, ++ ep_type, ep_dir, mps); ++#if 0 ++ DWC_PRINTF ++ ("addr = %d, ep_num = %d, ep_dir = 0x%x, ep_type = 0x%x, mps = %d\n", ++ dev_addr, ep_num, ep_dir, ep_type, mps); ++#endif ++} ++ ++void dwc_otg_hcd_urb_set_params(dwc_otg_hcd_urb_t * dwc_otg_urb, ++ void *urb_handle, void *buf, dwc_dma_t dma, ++ uint32_t buflen, void *setup_packet, ++ dwc_dma_t setup_dma, uint32_t flags, ++ uint16_t interval) ++{ ++ dwc_otg_urb->priv = urb_handle; ++ dwc_otg_urb->buf = buf; ++ dwc_otg_urb->dma = dma; ++ dwc_otg_urb->length = buflen; ++ dwc_otg_urb->setup_packet = setup_packet; ++ dwc_otg_urb->setup_dma = setup_dma; ++ dwc_otg_urb->flags = flags; ++ dwc_otg_urb->interval = interval; ++ dwc_otg_urb->status = -DWC_E_IN_PROGRESS; ++} ++ ++uint32_t dwc_otg_hcd_urb_get_status(dwc_otg_hcd_urb_t * dwc_otg_urb) ++{ ++ return dwc_otg_urb->status; ++} ++ ++uint32_t dwc_otg_hcd_urb_get_actual_length(dwc_otg_hcd_urb_t * dwc_otg_urb) ++{ ++ return dwc_otg_urb->actual_length; ++} ++ ++uint32_t dwc_otg_hcd_urb_get_error_count(dwc_otg_hcd_urb_t * dwc_otg_urb) ++{ ++ return dwc_otg_urb->error_count; ++} ++ ++void dwc_otg_hcd_urb_set_iso_desc_params(dwc_otg_hcd_urb_t * dwc_otg_urb, ++ int desc_num, uint32_t offset, ++ uint32_t length) ++{ ++ dwc_otg_urb->iso_descs[desc_num].offset = offset; ++ dwc_otg_urb->iso_descs[desc_num].length = length; ++} ++ ++uint32_t dwc_otg_hcd_urb_get_iso_desc_status(dwc_otg_hcd_urb_t * dwc_otg_urb, ++ int desc_num) ++{ ++ return dwc_otg_urb->iso_descs[desc_num].status; ++} ++ ++uint32_t dwc_otg_hcd_urb_get_iso_desc_actual_length(dwc_otg_hcd_urb_t * ++ dwc_otg_urb, int desc_num) ++{ ++ return dwc_otg_urb->iso_descs[desc_num].actual_length; ++} ++ ++int dwc_otg_hcd_is_bandwidth_allocated(dwc_otg_hcd_t * hcd, void *ep_handle) ++{ ++ int allocated = 0; ++ dwc_otg_qh_t *qh = (dwc_otg_qh_t *) ep_handle; ++ ++ if (qh) { ++ if (!DWC_LIST_EMPTY(&qh->qh_list_entry)) { ++ allocated = 1; ++ } ++ } ++ return allocated; ++} ++ ++int dwc_otg_hcd_is_bandwidth_freed(dwc_otg_hcd_t * hcd, void *ep_handle) ++{ ++ dwc_otg_qh_t *qh = (dwc_otg_qh_t *) ep_handle; ++ int freed = 0; ++ DWC_ASSERT(qh, "qh is not allocated\n"); ++ ++ if (DWC_LIST_EMPTY(&qh->qh_list_entry)) { ++ freed = 1; ++ } ++ ++ return freed; ++} ++ ++uint8_t dwc_otg_hcd_get_ep_bandwidth(dwc_otg_hcd_t * hcd, void *ep_handle) ++{ ++ dwc_otg_qh_t *qh = (dwc_otg_qh_t *) ep_handle; ++ DWC_ASSERT(qh, "qh is not allocated\n"); ++ return qh->usecs; ++} ++ ++void dwc_otg_hcd_dump_state(dwc_otg_hcd_t * hcd) ++{ ++#ifdef DEBUG ++ int num_channels; ++ int i; ++ gnptxsts_data_t np_tx_status; ++ hptxsts_data_t p_tx_status; ++ ++ num_channels = hcd->core_if->core_params->host_channels; ++ DWC_PRINTF("\n"); ++ DWC_PRINTF ++ ("************************************************************\n"); ++ DWC_PRINTF("HCD State:\n"); ++ DWC_PRINTF(" Num channels: %d\n", num_channels); ++ for (i = 0; i < num_channels; i++) { ++ dwc_hc_t *hc = hcd->hc_ptr_array[i]; ++ DWC_PRINTF(" Channel %d:\n", i); ++ DWC_PRINTF(" dev_addr: %d, ep_num: %d, ep_is_in: %d\n", ++ hc->dev_addr, hc->ep_num, hc->ep_is_in); ++ DWC_PRINTF(" speed: %d\n", hc->speed); ++ DWC_PRINTF(" ep_type: %d\n", hc->ep_type); ++ DWC_PRINTF(" max_packet: %d\n", hc->max_packet); ++ DWC_PRINTF(" data_pid_start: %d\n", hc->data_pid_start); ++ DWC_PRINTF(" multi_count: %d\n", hc->multi_count); ++ DWC_PRINTF(" xfer_started: %d\n", hc->xfer_started); ++ DWC_PRINTF(" xfer_buff: %p\n", hc->xfer_buff); ++ DWC_PRINTF(" xfer_len: %d\n", hc->xfer_len); ++ DWC_PRINTF(" xfer_count: %d\n", hc->xfer_count); ++ DWC_PRINTF(" halt_on_queue: %d\n", hc->halt_on_queue); ++ DWC_PRINTF(" halt_pending: %d\n", hc->halt_pending); ++ DWC_PRINTF(" halt_status: %d\n", hc->halt_status); ++ DWC_PRINTF(" do_split: %d\n", hc->do_split); ++ DWC_PRINTF(" complete_split: %d\n", hc->complete_split); ++ DWC_PRINTF(" hub_addr: %d\n", hc->hub_addr); ++ DWC_PRINTF(" port_addr: %d\n", hc->port_addr); ++ DWC_PRINTF(" xact_pos: %d\n", hc->xact_pos); ++ DWC_PRINTF(" requests: %d\n", hc->requests); ++ DWC_PRINTF(" qh: %p\n", hc->qh); ++ if (hc->xfer_started) { ++ hfnum_data_t hfnum; ++ hcchar_data_t hcchar; ++ hctsiz_data_t hctsiz; ++ hcint_data_t hcint; ++ hcintmsk_data_t hcintmsk; ++ hfnum.d32 = ++ DWC_READ_REG32(&hcd->core_if-> ++ host_if->host_global_regs->hfnum); ++ hcchar.d32 = ++ DWC_READ_REG32(&hcd->core_if->host_if-> ++ hc_regs[i]->hcchar); ++ hctsiz.d32 = ++ DWC_READ_REG32(&hcd->core_if->host_if-> ++ hc_regs[i]->hctsiz); ++ hcint.d32 = ++ DWC_READ_REG32(&hcd->core_if->host_if-> ++ hc_regs[i]->hcint); ++ hcintmsk.d32 = ++ DWC_READ_REG32(&hcd->core_if->host_if-> ++ hc_regs[i]->hcintmsk); ++ DWC_PRINTF(" hfnum: 0x%08x\n", hfnum.d32); ++ DWC_PRINTF(" hcchar: 0x%08x\n", hcchar.d32); ++ DWC_PRINTF(" hctsiz: 0x%08x\n", hctsiz.d32); ++ DWC_PRINTF(" hcint: 0x%08x\n", hcint.d32); ++ DWC_PRINTF(" hcintmsk: 0x%08x\n", hcintmsk.d32); ++ } ++ if (hc->xfer_started && hc->qh) { ++ dwc_otg_qtd_t *qtd; ++ dwc_otg_hcd_urb_t *urb; ++ ++ DWC_CIRCLEQ_FOREACH(qtd, &hc->qh->qtd_list, qtd_list_entry) { ++ if (!qtd->in_process) ++ break; ++ ++ urb = qtd->urb; ++ DWC_PRINTF(" URB Info:\n"); ++ DWC_PRINTF(" qtd: %p, urb: %p\n", qtd, urb); ++ if (urb) { ++ DWC_PRINTF(" Dev: %d, EP: %d %s\n", ++ dwc_otg_hcd_get_dev_addr(&urb-> ++ pipe_info), ++ dwc_otg_hcd_get_ep_num(&urb-> ++ pipe_info), ++ dwc_otg_hcd_is_pipe_in(&urb-> ++ pipe_info) ? ++ "IN" : "OUT"); ++ DWC_PRINTF(" Max packet size: %d\n", ++ dwc_otg_hcd_get_mps(&urb-> ++ pipe_info)); ++ DWC_PRINTF(" transfer_buffer: %p\n", ++ urb->buf); ++ DWC_PRINTF(" transfer_dma: %p\n", ++ (void *)urb->dma); ++ DWC_PRINTF(" transfer_buffer_length: %d\n", ++ urb->length); ++ DWC_PRINTF(" actual_length: %d\n", ++ urb->actual_length); ++ } ++ } ++ } ++ } ++ DWC_PRINTF(" non_periodic_channels: %d\n", hcd->non_periodic_channels); ++ DWC_PRINTF(" periodic_channels: %d\n", hcd->periodic_channels); ++ DWC_PRINTF(" periodic_usecs: %d\n", hcd->periodic_usecs); ++ np_tx_status.d32 = ++ DWC_READ_REG32(&hcd->core_if->core_global_regs->gnptxsts); ++ DWC_PRINTF(" NP Tx Req Queue Space Avail: %d\n", ++ np_tx_status.b.nptxqspcavail); ++ DWC_PRINTF(" NP Tx FIFO Space Avail: %d\n", ++ np_tx_status.b.nptxfspcavail); ++ p_tx_status.d32 = ++ DWC_READ_REG32(&hcd->core_if->host_if->host_global_regs->hptxsts); ++ DWC_PRINTF(" P Tx Req Queue Space Avail: %d\n", ++ p_tx_status.b.ptxqspcavail); ++ DWC_PRINTF(" P Tx FIFO Space Avail: %d\n", p_tx_status.b.ptxfspcavail); ++ dwc_otg_hcd_dump_frrem(hcd); ++ dwc_otg_dump_global_registers(hcd->core_if); ++ dwc_otg_dump_host_registers(hcd->core_if); ++ DWC_PRINTF ++ ("************************************************************\n"); ++ DWC_PRINTF("\n"); ++#endif ++} ++ ++#ifdef DEBUG ++void dwc_print_setup_data(uint8_t * setup) ++{ ++ int i; ++ if (CHK_DEBUG_LEVEL(DBG_HCD)) { ++ DWC_PRINTF("Setup Data = MSB "); ++ for (i = 7; i >= 0; i--) ++ DWC_PRINTF("%02x ", setup[i]); ++ DWC_PRINTF("\n"); ++ DWC_PRINTF(" bmRequestType Tranfer = %s\n", ++ (setup[0] & 0x80) ? "Device-to-Host" : ++ "Host-to-Device"); ++ DWC_PRINTF(" bmRequestType Type = "); ++ switch ((setup[0] & 0x60) >> 5) { ++ case 0: ++ DWC_PRINTF("Standard\n"); ++ break; ++ case 1: ++ DWC_PRINTF("Class\n"); ++ break; ++ case 2: ++ DWC_PRINTF("Vendor\n"); ++ break; ++ case 3: ++ DWC_PRINTF("Reserved\n"); ++ break; ++ } ++ DWC_PRINTF(" bmRequestType Recipient = "); ++ switch (setup[0] & 0x1f) { ++ case 0: ++ DWC_PRINTF("Device\n"); ++ break; ++ case 1: ++ DWC_PRINTF("Interface\n"); ++ break; ++ case 2: ++ DWC_PRINTF("Endpoint\n"); ++ break; ++ case 3: ++ DWC_PRINTF("Other\n"); ++ break; ++ default: ++ DWC_PRINTF("Reserved\n"); ++ break; ++ } ++ DWC_PRINTF(" bRequest = 0x%0x\n", setup[1]); ++ DWC_PRINTF(" wValue = 0x%0x\n", *((uint16_t *) & setup[2])); ++ DWC_PRINTF(" wIndex = 0x%0x\n", *((uint16_t *) & setup[4])); ++ DWC_PRINTF(" wLength = 0x%0x\n\n", *((uint16_t *) & setup[6])); ++ } ++} ++#endif ++ ++void dwc_otg_hcd_dump_frrem(dwc_otg_hcd_t * hcd) ++{ ++#if 0 ++ DWC_PRINTF("Frame remaining at SOF:\n"); ++ DWC_PRINTF(" samples %u, accum %llu, avg %llu\n", ++ hcd->frrem_samples, hcd->frrem_accum, ++ (hcd->frrem_samples > 0) ? ++ hcd->frrem_accum / hcd->frrem_samples : 0); ++ ++ DWC_PRINTF("\n"); ++ DWC_PRINTF("Frame remaining at start_transfer (uframe 7):\n"); ++ DWC_PRINTF(" samples %u, accum %llu, avg %llu\n", ++ hcd->core_if->hfnum_7_samples, ++ hcd->core_if->hfnum_7_frrem_accum, ++ (hcd->core_if->hfnum_7_samples > ++ 0) ? hcd->core_if->hfnum_7_frrem_accum / ++ hcd->core_if->hfnum_7_samples : 0); ++ DWC_PRINTF("Frame remaining at start_transfer (uframe 0):\n"); ++ DWC_PRINTF(" samples %u, accum %llu, avg %llu\n", ++ hcd->core_if->hfnum_0_samples, ++ hcd->core_if->hfnum_0_frrem_accum, ++ (hcd->core_if->hfnum_0_samples > ++ 0) ? hcd->core_if->hfnum_0_frrem_accum / ++ hcd->core_if->hfnum_0_samples : 0); ++ DWC_PRINTF("Frame remaining at start_transfer (uframe 1-6):\n"); ++ DWC_PRINTF(" samples %u, accum %llu, avg %llu\n", ++ hcd->core_if->hfnum_other_samples, ++ hcd->core_if->hfnum_other_frrem_accum, ++ (hcd->core_if->hfnum_other_samples > ++ 0) ? hcd->core_if->hfnum_other_frrem_accum / ++ hcd->core_if->hfnum_other_samples : 0); ++ ++ DWC_PRINTF("\n"); ++ DWC_PRINTF("Frame remaining at sample point A (uframe 7):\n"); ++ DWC_PRINTF(" samples %u, accum %llu, avg %llu\n", ++ hcd->hfnum_7_samples_a, hcd->hfnum_7_frrem_accum_a, ++ (hcd->hfnum_7_samples_a > 0) ? ++ hcd->hfnum_7_frrem_accum_a / hcd->hfnum_7_samples_a : 0); ++ DWC_PRINTF("Frame remaining at sample point A (uframe 0):\n"); ++ DWC_PRINTF(" samples %u, accum %llu, avg %llu\n", ++ hcd->hfnum_0_samples_a, hcd->hfnum_0_frrem_accum_a, ++ (hcd->hfnum_0_samples_a > 0) ? ++ hcd->hfnum_0_frrem_accum_a / hcd->hfnum_0_samples_a : 0); ++ DWC_PRINTF("Frame remaining at sample point A (uframe 1-6):\n"); ++ DWC_PRINTF(" samples %u, accum %llu, avg %llu\n", ++ hcd->hfnum_other_samples_a, hcd->hfnum_other_frrem_accum_a, ++ (hcd->hfnum_other_samples_a > 0) ? ++ hcd->hfnum_other_frrem_accum_a / ++ hcd->hfnum_other_samples_a : 0); ++ ++ DWC_PRINTF("\n"); ++ DWC_PRINTF("Frame remaining at sample point B (uframe 7):\n"); ++ DWC_PRINTF(" samples %u, accum %llu, avg %llu\n", ++ hcd->hfnum_7_samples_b, hcd->hfnum_7_frrem_accum_b, ++ (hcd->hfnum_7_samples_b > 0) ? ++ hcd->hfnum_7_frrem_accum_b / hcd->hfnum_7_samples_b : 0); ++ DWC_PRINTF("Frame remaining at sample point B (uframe 0):\n"); ++ DWC_PRINTF(" samples %u, accum %llu, avg %llu\n", ++ hcd->hfnum_0_samples_b, hcd->hfnum_0_frrem_accum_b, ++ (hcd->hfnum_0_samples_b > 0) ? ++ hcd->hfnum_0_frrem_accum_b / hcd->hfnum_0_samples_b : 0); ++ DWC_PRINTF("Frame remaining at sample point B (uframe 1-6):\n"); ++ DWC_PRINTF(" samples %u, accum %llu, avg %llu\n", ++ hcd->hfnum_other_samples_b, hcd->hfnum_other_frrem_accum_b, ++ (hcd->hfnum_other_samples_b > 0) ? ++ hcd->hfnum_other_frrem_accum_b / ++ hcd->hfnum_other_samples_b : 0); ++#endif ++} ++ ++#endif /* DWC_DEVICE_ONLY */ +diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd.h b/drivers/usb/host/dwc_otg/dwc_otg_hcd.h +new file mode 100644 +index 0000000..43dbed9 +--- /dev/null ++++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd.h +@@ -0,0 +1,862 @@ ++/* ========================================================================== ++ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_hcd.h $ ++ * $Revision: #58 $ ++ * $Date: 2011/09/15 $ ++ * $Change: 1846647 $ ++ * ++ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, ++ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless ++ * otherwise expressly agreed to in writing between Synopsys and you. ++ * ++ * The Software IS NOT an item of Licensed Software or Licensed Product under ++ * any End User Software License Agreement or Agreement for Licensed Product ++ * with Synopsys or any supplement thereto. You are permitted to use and ++ * redistribute this Software in source and binary forms, with or without ++ * modification, provided that redistributions of source code must retain this ++ * notice. You may not view, use, disclose, copy or distribute this file or ++ * any information contained herein except pursuant to this license grant from ++ * Synopsys. If you do not agree with this notice, including the disclaimer ++ * below, then you are not authorized to use the Software. ++ * ++ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS ++ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS 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. ++ * ========================================================================== */ ++#ifndef DWC_DEVICE_ONLY ++#ifndef __DWC_HCD_H__ ++#define __DWC_HCD_H__ ++ ++#include "dwc_otg_os_dep.h" ++#include "usb.h" ++#include "dwc_otg_hcd_if.h" ++#include "dwc_otg_core_if.h" ++#include "dwc_list.h" ++#include "dwc_otg_cil.h" ++#include "dwc_otg_fiq_fsm.h" ++ ++ ++/** ++ * @file ++ * ++ * This file contains the structures, constants, and interfaces for ++ * the Host Contoller Driver (HCD). ++ * ++ * The Host Controller Driver (HCD) is responsible for translating requests ++ * from the USB Driver into the appropriate actions on the DWC_otg controller. ++ * It isolates the USBD from the specifics of the controller by providing an ++ * API to the USBD. ++ */ ++ ++struct dwc_otg_hcd_pipe_info { ++ uint8_t dev_addr; ++ uint8_t ep_num; ++ uint8_t pipe_type; ++ uint8_t pipe_dir; ++ uint16_t mps; ++}; ++ ++struct dwc_otg_hcd_iso_packet_desc { ++ uint32_t offset; ++ uint32_t length; ++ uint32_t actual_length; ++ uint32_t status; ++}; ++ ++struct dwc_otg_qtd; ++ ++struct dwc_otg_hcd_urb { ++ void *priv; ++ struct dwc_otg_qtd *qtd; ++ void *buf; ++ dwc_dma_t dma; ++ void *setup_packet; ++ dwc_dma_t setup_dma; ++ uint32_t length; ++ uint32_t actual_length; ++ uint32_t status; ++ uint32_t error_count; ++ uint32_t packet_count; ++ uint32_t flags; ++ uint16_t interval; ++ struct dwc_otg_hcd_pipe_info pipe_info; ++ struct dwc_otg_hcd_iso_packet_desc iso_descs[0]; ++}; ++ ++static inline uint8_t dwc_otg_hcd_get_ep_num(struct dwc_otg_hcd_pipe_info *pipe) ++{ ++ return pipe->ep_num; ++} ++ ++static inline uint8_t dwc_otg_hcd_get_pipe_type(struct dwc_otg_hcd_pipe_info ++ *pipe) ++{ ++ return pipe->pipe_type; ++} ++ ++static inline uint16_t dwc_otg_hcd_get_mps(struct dwc_otg_hcd_pipe_info *pipe) ++{ ++ return pipe->mps; ++} ++ ++static inline uint8_t dwc_otg_hcd_get_dev_addr(struct dwc_otg_hcd_pipe_info ++ *pipe) ++{ ++ return pipe->dev_addr; ++} ++ ++static inline uint8_t dwc_otg_hcd_is_pipe_isoc(struct dwc_otg_hcd_pipe_info ++ *pipe) ++{ ++ return (pipe->pipe_type == UE_ISOCHRONOUS); ++} ++ ++static inline uint8_t dwc_otg_hcd_is_pipe_int(struct dwc_otg_hcd_pipe_info ++ *pipe) ++{ ++ return (pipe->pipe_type == UE_INTERRUPT); ++} ++ ++static inline uint8_t dwc_otg_hcd_is_pipe_bulk(struct dwc_otg_hcd_pipe_info ++ *pipe) ++{ ++ return (pipe->pipe_type == UE_BULK); ++} ++ ++static inline uint8_t dwc_otg_hcd_is_pipe_control(struct dwc_otg_hcd_pipe_info ++ *pipe) ++{ ++ return (pipe->pipe_type == UE_CONTROL); ++} ++ ++static inline uint8_t dwc_otg_hcd_is_pipe_in(struct dwc_otg_hcd_pipe_info *pipe) ++{ ++ return (pipe->pipe_dir == UE_DIR_IN); ++} ++ ++static inline uint8_t dwc_otg_hcd_is_pipe_out(struct dwc_otg_hcd_pipe_info ++ *pipe) ++{ ++ return (!dwc_otg_hcd_is_pipe_in(pipe)); ++} ++ ++static inline void dwc_otg_hcd_fill_pipe(struct dwc_otg_hcd_pipe_info *pipe, ++ uint8_t devaddr, uint8_t ep_num, ++ uint8_t pipe_type, uint8_t pipe_dir, ++ uint16_t mps) ++{ ++ pipe->dev_addr = devaddr; ++ pipe->ep_num = ep_num; ++ pipe->pipe_type = pipe_type; ++ pipe->pipe_dir = pipe_dir; ++ pipe->mps = mps; ++} ++ ++/** ++ * Phases for control transfers. ++ */ ++typedef enum dwc_otg_control_phase { ++ DWC_OTG_CONTROL_SETUP, ++ DWC_OTG_CONTROL_DATA, ++ DWC_OTG_CONTROL_STATUS ++} dwc_otg_control_phase_e; ++ ++/** Transaction types. */ ++typedef enum dwc_otg_transaction_type { ++ DWC_OTG_TRANSACTION_NONE = 0, ++ DWC_OTG_TRANSACTION_PERIODIC = 1, ++ DWC_OTG_TRANSACTION_NON_PERIODIC = 2, ++ DWC_OTG_TRANSACTION_ALL = DWC_OTG_TRANSACTION_PERIODIC + DWC_OTG_TRANSACTION_NON_PERIODIC ++} dwc_otg_transaction_type_e; ++ ++struct dwc_otg_qh; ++ ++/** ++ * A Queue Transfer Descriptor (QTD) holds the state of a bulk, control, ++ * interrupt, or isochronous transfer. A single QTD is created for each URB ++ * (of one of these types) submitted to the HCD. The transfer associated with ++ * a QTD may require one or multiple transactions. ++ * ++ * A QTD is linked to a Queue Head, which is entered in either the ++ * non-periodic or periodic schedule for execution. When a QTD is chosen for ++ * execution, some or all of its transactions may be executed. After ++ * execution, the state of the QTD is updated. The QTD may be retired if all ++ * its transactions are complete or if an error occurred. Otherwise, it ++ * remains in the schedule so more transactions can be executed later. ++ */ ++typedef struct dwc_otg_qtd { ++ /** ++ * Determines the PID of the next data packet for the data phase of ++ * control transfers. Ignored for other transfer types.<br> ++ * One of the following values: ++ * - DWC_OTG_HC_PID_DATA0 ++ * - DWC_OTG_HC_PID_DATA1 ++ */ ++ uint8_t data_toggle; ++ ++ /** Current phase for control transfers (Setup, Data, or Status). */ ++ dwc_otg_control_phase_e control_phase; ++ ++ /** Keep track of the current split type ++ * for FS/LS endpoints on a HS Hub */ ++ uint8_t complete_split; ++ ++ /** How many bytes transferred during SSPLIT OUT */ ++ uint32_t ssplit_out_xfer_count; ++ ++ /** ++ * Holds the number of bus errors that have occurred for a transaction ++ * within this transfer. ++ */ ++ uint8_t error_count; ++ ++ /** ++ * Index of the next frame descriptor for an isochronous transfer. A ++ * frame descriptor describes the buffer position and length of the ++ * data to be transferred in the next scheduled (micro)frame of an ++ * isochronous transfer. It also holds status for that transaction. ++ * The frame index starts at 0. ++ */ ++ uint16_t isoc_frame_index; ++ ++ /** Position of the ISOC split on full/low speed */ ++ uint8_t isoc_split_pos; ++ ++ /** Position of the ISOC split in the buffer for the current frame */ ++ uint16_t isoc_split_offset; ++ ++ /** URB for this transfer */ ++ struct dwc_otg_hcd_urb *urb; ++ ++ struct dwc_otg_qh *qh; ++ ++ /** This list of QTDs */ ++ DWC_CIRCLEQ_ENTRY(dwc_otg_qtd) qtd_list_entry; ++ ++ /** Indicates if this QTD is currently processed by HW. */ ++ uint8_t in_process; ++ ++ /** Number of DMA descriptors for this QTD */ ++ uint8_t n_desc; ++ ++ /** ++ * Last activated frame(packet) index. ++ * Used in Descriptor DMA mode only. ++ */ ++ uint16_t isoc_frame_index_last; ++ ++} dwc_otg_qtd_t; ++ ++DWC_CIRCLEQ_HEAD(dwc_otg_qtd_list, dwc_otg_qtd); ++ ++/** ++ * A Queue Head (QH) holds the static characteristics of an endpoint and ++ * maintains a list of transfers (QTDs) for that endpoint. A QH structure may ++ * be entered in either the non-periodic or periodic schedule. ++ */ ++typedef struct dwc_otg_qh { ++ /** ++ * Endpoint type. ++ * One of the following values: ++ * - UE_CONTROL ++ * - UE_BULK ++ * - UE_INTERRUPT ++ * - UE_ISOCHRONOUS ++ */ ++ uint8_t ep_type; ++ uint8_t ep_is_in; ++ ++ /** wMaxPacketSize Field of Endpoint Descriptor. */ ++ uint16_t maxp; ++ ++ /** ++ * Device speed. ++ * One of the following values: ++ * - DWC_OTG_EP_SPEED_LOW ++ * - DWC_OTG_EP_SPEED_FULL ++ * - DWC_OTG_EP_SPEED_HIGH ++ */ ++ uint8_t dev_speed; ++ ++ /** ++ * Determines the PID of the next data packet for non-control ++ * transfers. Ignored for control transfers.<br> ++ * One of the following values: ++ * - DWC_OTG_HC_PID_DATA0 ++ * - DWC_OTG_HC_PID_DATA1 ++ */ ++ uint8_t data_toggle; ++ ++ /** Ping state if 1. */ ++ uint8_t ping_state; ++ ++ /** ++ * List of QTDs for this QH. ++ */ ++ struct dwc_otg_qtd_list qtd_list; ++ ++ /** Host channel currently processing transfers for this QH. */ ++ struct dwc_hc *channel; ++ ++ /** Full/low speed endpoint on high-speed hub requires split. */ ++ uint8_t do_split; ++ ++ /** @name Periodic schedule information */ ++ /** @{ */ ++ ++ /** Bandwidth in microseconds per (micro)frame. */ ++ uint16_t usecs; ++ ++ /** Interval between transfers in (micro)frames. */ ++ uint16_t interval; ++ ++ /** ++ * (micro)frame to initialize a periodic transfer. The transfer ++ * executes in the following (micro)frame. ++ */ ++ uint16_t sched_frame; ++ ++ /* ++ ** Frame a NAK was received on this queue head, used to minimise NAK retransmission ++ */ ++ uint16_t nak_frame; ++ ++ /** (micro)frame at which last start split was initialized. */ ++ uint16_t start_split_frame; ++ ++ /** @} */ ++ ++ /** ++ * Used instead of original buffer if ++ * it(physical address) is not dword-aligned. ++ */ ++ uint8_t *dw_align_buf; ++ dwc_dma_t dw_align_buf_dma; ++ ++ /** Entry for QH in either the periodic or non-periodic schedule. */ ++ dwc_list_link_t qh_list_entry; ++ ++ /** @name Descriptor DMA support */ ++ /** @{ */ ++ ++ /** Descriptor List. */ ++ dwc_otg_host_dma_desc_t *desc_list; ++ ++ /** Descriptor List physical address. */ ++ dwc_dma_t desc_list_dma; ++ ++ /** ++ * Xfer Bytes array. ++ * Each element corresponds to a descriptor and indicates ++ * original XferSize size value for the descriptor. ++ */ ++ uint32_t *n_bytes; ++ ++ /** Actual number of transfer descriptors in a list. */ ++ uint16_t ntd; ++ ++ /** First activated isochronous transfer descriptor index. */ ++ uint8_t td_first; ++ /** Last activated isochronous transfer descriptor index. */ ++ uint8_t td_last; ++ ++ /** @} */ ++ ++ ++ uint16_t speed; ++ uint16_t frame_usecs[8]; ++ ++ uint32_t skip_count; ++} dwc_otg_qh_t; ++ ++DWC_CIRCLEQ_HEAD(hc_list, dwc_hc); ++ ++typedef struct urb_tq_entry { ++ struct urb *urb; ++ DWC_TAILQ_ENTRY(urb_tq_entry) urb_tq_entries; ++} urb_tq_entry_t; ++ ++DWC_TAILQ_HEAD(urb_list, urb_tq_entry); ++ ++/** ++ * This structure holds the state of the HCD, including the non-periodic and ++ * periodic schedules. ++ */ ++struct dwc_otg_hcd { ++ /** The DWC otg device pointer */ ++ struct dwc_otg_device *otg_dev; ++ /** DWC OTG Core Interface Layer */ ++ dwc_otg_core_if_t *core_if; ++ ++ /** Function HCD driver callbacks */ ++ struct dwc_otg_hcd_function_ops *fops; ++ ++ /** Internal DWC HCD Flags */ ++ volatile union dwc_otg_hcd_internal_flags { ++ uint32_t d32; ++ struct { ++ unsigned port_connect_status_change:1; ++ unsigned port_connect_status:1; ++ unsigned port_reset_change:1; ++ unsigned port_enable_change:1; ++ unsigned port_suspend_change:1; ++ unsigned port_over_current_change:1; ++ unsigned port_l1_change:1; ++ unsigned reserved:26; ++ } b; ++ } flags; ++ ++ /** ++ * Inactive items in the non-periodic schedule. This is a list of ++ * Queue Heads. Transfers associated with these Queue Heads are not ++ * currently assigned to a host channel. ++ */ ++ dwc_list_link_t non_periodic_sched_inactive; ++ ++ /** ++ * Active items in the non-periodic schedule. This is a list of ++ * Queue Heads. Transfers associated with these Queue Heads are ++ * currently assigned to a host channel. ++ */ ++ dwc_list_link_t non_periodic_sched_active; ++ ++ /** ++ * Pointer to the next Queue Head to process in the active ++ * non-periodic schedule. ++ */ ++ dwc_list_link_t *non_periodic_qh_ptr; ++ ++ /** ++ * Inactive items in the periodic schedule. This is a list of QHs for ++ * periodic transfers that are _not_ scheduled for the next frame. ++ * Each QH in the list has an interval counter that determines when it ++ * needs to be scheduled for execution. This scheduling mechanism ++ * allows only a simple calculation for periodic bandwidth used (i.e. ++ * must assume that all periodic transfers may need to execute in the ++ * same frame). However, it greatly simplifies scheduling and should ++ * be sufficient for the vast majority of OTG hosts, which need to ++ * connect to a small number of peripherals at one time. ++ * ++ * Items move from this list to periodic_sched_ready when the QH ++ * interval counter is 0 at SOF. ++ */ ++ dwc_list_link_t periodic_sched_inactive; ++ ++ /** ++ * List of periodic QHs that are ready for execution in the next ++ * frame, but have not yet been assigned to host channels. ++ * ++ * Items move from this list to periodic_sched_assigned as host ++ * channels become available during the current frame. ++ */ ++ dwc_list_link_t periodic_sched_ready; ++ ++ /** ++ * List of periodic QHs to be executed in the next frame that are ++ * assigned to host channels. ++ * ++ * Items move from this list to periodic_sched_queued as the ++ * transactions for the QH are queued to the DWC_otg controller. ++ */ ++ dwc_list_link_t periodic_sched_assigned; ++ ++ /** ++ * List of periodic QHs that have been queued for execution. ++ * ++ * Items move from this list to either periodic_sched_inactive or ++ * periodic_sched_ready when the channel associated with the transfer ++ * is released. If the interval for the QH is 1, the item moves to ++ * periodic_sched_ready because it must be rescheduled for the next ++ * frame. Otherwise, the item moves to periodic_sched_inactive. ++ */ ++ dwc_list_link_t periodic_sched_queued; ++ ++ /** ++ * Total bandwidth claimed so far for periodic transfers. This value ++ * is in microseconds per (micro)frame. The assumption is that all ++ * periodic transfers may occur in the same (micro)frame. ++ */ ++ uint16_t periodic_usecs; ++ ++ /** ++ * Total bandwidth claimed so far for all periodic transfers ++ * in a frame. ++ * This will include a mixture of HS and FS transfers. ++ * Units are microseconds per (micro)frame. ++ * We have a budget per frame and have to schedule ++ * transactions accordingly. ++ * Watch out for the fact that things are actually scheduled for the ++ * "next frame". ++ */ ++ uint16_t frame_usecs[8]; ++ ++ ++ /** ++ * Frame number read from the core at SOF. The value ranges from 0 to ++ * DWC_HFNUM_MAX_FRNUM. ++ */ ++ uint16_t frame_number; ++ ++ /** ++ * Count of periodic QHs, if using several eps. For SOF enable/disable. ++ */ ++ uint16_t periodic_qh_count; ++ ++ /** ++ * Free host channels in the controller. This is a list of ++ * dwc_hc_t items. ++ */ ++ struct hc_list free_hc_list; ++ /** ++ * Number of host channels assigned to periodic transfers. Currently ++ * assuming that there is a dedicated host channel for each periodic ++ * transaction and at least one host channel available for ++ * non-periodic transactions. ++ */ ++ int periodic_channels; /* microframe_schedule==0 */ ++ ++ /** ++ * Number of host channels assigned to non-periodic transfers. ++ */ ++ int non_periodic_channels; /* microframe_schedule==0 */ ++ ++ /** ++ * Number of host channels assigned to non-periodic transfers. ++ */ ++ int available_host_channels; ++ ++ /** ++ * Array of pointers to the host channel descriptors. Allows accessing ++ * a host channel descriptor given the host channel number. This is ++ * useful in interrupt handlers. ++ */ ++ struct dwc_hc *hc_ptr_array[MAX_EPS_CHANNELS]; ++ ++ /** ++ * Buffer to use for any data received during the status phase of a ++ * control transfer. Normally no data is transferred during the status ++ * phase. This buffer is used as a bit bucket. ++ */ ++ uint8_t *status_buf; ++ ++ /** ++ * DMA address for status_buf. ++ */ ++ dma_addr_t status_buf_dma; ++#define DWC_OTG_HCD_STATUS_BUF_SIZE 64 ++ ++ /** ++ * Connection timer. An OTG host must display a message if the device ++ * does not connect. Started when the VBus power is turned on via ++ * sysfs attribute "buspower". ++ */ ++ dwc_timer_t *conn_timer; ++ ++ /* Tasket to do a reset */ ++ dwc_tasklet_t *reset_tasklet; ++ ++ dwc_tasklet_t *completion_tasklet; ++ struct urb_list completed_urb_list; ++ ++ /* */ ++ dwc_spinlock_t *lock; ++ dwc_spinlock_t *channel_lock; ++ /** ++ * Private data that could be used by OS wrapper. ++ */ ++ void *priv; ++ ++ uint8_t otg_port; ++ ++ /** Frame List */ ++ uint32_t *frame_list; ++ ++ /** Hub - Port assignment */ ++ int hub_port[128]; ++#ifdef FIQ_DEBUG ++ int hub_port_alloc[2048]; ++#endif ++ ++ /** Frame List DMA address */ ++ dma_addr_t frame_list_dma; ++ ++ struct fiq_stack *fiq_stack; ++ struct fiq_state *fiq_state; ++ ++ /** Virtual address for split transaction DMA bounce buffers */ ++ struct fiq_dma_blob *fiq_dmab; ++ ++#ifdef DEBUG ++ uint32_t frrem_samples; ++ uint64_t frrem_accum; ++ ++ uint32_t hfnum_7_samples_a; ++ uint64_t hfnum_7_frrem_accum_a; ++ uint32_t hfnum_0_samples_a; ++ uint64_t hfnum_0_frrem_accum_a; ++ uint32_t hfnum_other_samples_a; ++ uint64_t hfnum_other_frrem_accum_a; ++ ++ uint32_t hfnum_7_samples_b; ++ uint64_t hfnum_7_frrem_accum_b; ++ uint32_t hfnum_0_samples_b; ++ uint64_t hfnum_0_frrem_accum_b; ++ uint32_t hfnum_other_samples_b; ++ uint64_t hfnum_other_frrem_accum_b; ++#endif ++}; ++ ++/** @name Transaction Execution Functions */ ++/** @{ */ ++extern dwc_otg_transaction_type_e dwc_otg_hcd_select_transactions(dwc_otg_hcd_t ++ * hcd); ++extern void dwc_otg_hcd_queue_transactions(dwc_otg_hcd_t * hcd, ++ dwc_otg_transaction_type_e tr_type); ++ ++int dwc_otg_hcd_allocate_port(dwc_otg_hcd_t * hcd, dwc_otg_qh_t *qh); ++void dwc_otg_hcd_release_port(dwc_otg_hcd_t * dwc_otg_hcd, dwc_otg_qh_t *qh); ++ ++extern int fiq_fsm_queue_transaction(dwc_otg_hcd_t *hcd, dwc_otg_qh_t *qh); ++extern int fiq_fsm_transaction_suitable(dwc_otg_qh_t *qh); ++extern void dwc_otg_cleanup_fiq_channel(dwc_otg_hcd_t *hcd, uint32_t num); ++ ++/** @} */ ++ ++/** @name Interrupt Handler Functions */ ++/** @{ */ ++extern int32_t dwc_otg_hcd_handle_intr(dwc_otg_hcd_t * dwc_otg_hcd); ++extern int32_t dwc_otg_hcd_handle_sof_intr(dwc_otg_hcd_t * dwc_otg_hcd); ++extern int32_t dwc_otg_hcd_handle_rx_status_q_level_intr(dwc_otg_hcd_t * ++ dwc_otg_hcd); ++extern int32_t dwc_otg_hcd_handle_np_tx_fifo_empty_intr(dwc_otg_hcd_t * ++ dwc_otg_hcd); ++extern int32_t dwc_otg_hcd_handle_perio_tx_fifo_empty_intr(dwc_otg_hcd_t * ++ dwc_otg_hcd); ++extern int32_t dwc_otg_hcd_handle_incomplete_periodic_intr(dwc_otg_hcd_t * ++ dwc_otg_hcd); ++extern int32_t dwc_otg_hcd_handle_port_intr(dwc_otg_hcd_t * dwc_otg_hcd); ++extern int32_t dwc_otg_hcd_handle_conn_id_status_change_intr(dwc_otg_hcd_t * ++ dwc_otg_hcd); ++extern int32_t dwc_otg_hcd_handle_disconnect_intr(dwc_otg_hcd_t * dwc_otg_hcd); ++extern int32_t dwc_otg_hcd_handle_hc_intr(dwc_otg_hcd_t * dwc_otg_hcd); ++extern int32_t dwc_otg_hcd_handle_hc_n_intr(dwc_otg_hcd_t * dwc_otg_hcd, ++ uint32_t num); ++extern int32_t dwc_otg_hcd_handle_session_req_intr(dwc_otg_hcd_t * dwc_otg_hcd); ++extern int32_t dwc_otg_hcd_handle_wakeup_detected_intr(dwc_otg_hcd_t * ++ dwc_otg_hcd); ++/** @} */ ++ ++/** @name Schedule Queue Functions */ ++/** @{ */ ++ ++/* Implemented in dwc_otg_hcd_queue.c */ ++extern dwc_otg_qh_t *dwc_otg_hcd_qh_create(dwc_otg_hcd_t * hcd, ++ dwc_otg_hcd_urb_t * urb, int atomic_alloc); ++extern void dwc_otg_hcd_qh_free(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh); ++extern int dwc_otg_hcd_qh_add(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh); ++extern void dwc_otg_hcd_qh_remove(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh); ++extern void dwc_otg_hcd_qh_deactivate(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh, ++ int sched_csplit); ++ ++/** Remove and free a QH */ ++static inline void dwc_otg_hcd_qh_remove_and_free(dwc_otg_hcd_t * hcd, ++ dwc_otg_qh_t * qh) ++{ ++ dwc_irqflags_t flags; ++ DWC_SPINLOCK_IRQSAVE(hcd->lock, &flags); ++ dwc_otg_hcd_qh_remove(hcd, qh); ++ DWC_SPINUNLOCK_IRQRESTORE(hcd->lock, flags); ++ dwc_otg_hcd_qh_free(hcd, qh); ++} ++ ++/** Allocates memory for a QH structure. ++ * @return Returns the memory allocate or NULL on error. */ ++static inline dwc_otg_qh_t *dwc_otg_hcd_qh_alloc(int atomic_alloc) ++{ ++ if (atomic_alloc) ++ return (dwc_otg_qh_t *) DWC_ALLOC_ATOMIC(sizeof(dwc_otg_qh_t)); ++ else ++ return (dwc_otg_qh_t *) DWC_ALLOC(sizeof(dwc_otg_qh_t)); ++} ++ ++extern dwc_otg_qtd_t *dwc_otg_hcd_qtd_create(dwc_otg_hcd_urb_t * urb, ++ int atomic_alloc); ++extern void dwc_otg_hcd_qtd_init(dwc_otg_qtd_t * qtd, dwc_otg_hcd_urb_t * urb); ++extern int dwc_otg_hcd_qtd_add(dwc_otg_qtd_t * qtd, dwc_otg_hcd_t * dwc_otg_hcd, ++ dwc_otg_qh_t ** qh, int atomic_alloc); ++ ++/** Allocates memory for a QTD structure. ++ * @return Returns the memory allocate or NULL on error. */ ++static inline dwc_otg_qtd_t *dwc_otg_hcd_qtd_alloc(int atomic_alloc) ++{ ++ if (atomic_alloc) ++ return (dwc_otg_qtd_t *) DWC_ALLOC_ATOMIC(sizeof(dwc_otg_qtd_t)); ++ else ++ return (dwc_otg_qtd_t *) DWC_ALLOC(sizeof(dwc_otg_qtd_t)); ++} ++ ++/** Frees the memory for a QTD structure. QTD should already be removed from ++ * list. ++ * @param qtd QTD to free.*/ ++static inline void dwc_otg_hcd_qtd_free(dwc_otg_qtd_t * qtd) ++{ ++ DWC_FREE(qtd); ++} ++ ++/** Removes a QTD from list. ++ * @param hcd HCD instance. ++ * @param qtd QTD to remove from list. ++ * @param qh QTD belongs to. ++ */ ++static inline void dwc_otg_hcd_qtd_remove(dwc_otg_hcd_t * hcd, ++ dwc_otg_qtd_t * qtd, ++ dwc_otg_qh_t * qh) ++{ ++ DWC_CIRCLEQ_REMOVE(&qh->qtd_list, qtd, qtd_list_entry); ++} ++ ++/** Remove and free a QTD ++ * Need to disable IRQ and hold hcd lock while calling this function out of ++ * interrupt servicing chain */ ++static inline void dwc_otg_hcd_qtd_remove_and_free(dwc_otg_hcd_t * hcd, ++ dwc_otg_qtd_t * qtd, ++ dwc_otg_qh_t * qh) ++{ ++ dwc_otg_hcd_qtd_remove(hcd, qtd, qh); ++ dwc_otg_hcd_qtd_free(qtd); ++} ++ ++/** @} */ ++ ++/** @name Descriptor DMA Supporting Functions */ ++/** @{ */ ++ ++extern void dwc_otg_hcd_start_xfer_ddma(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh); ++extern void dwc_otg_hcd_complete_xfer_ddma(dwc_otg_hcd_t * hcd, ++ dwc_hc_t * hc, ++ dwc_otg_hc_regs_t * hc_regs, ++ dwc_otg_halt_status_e halt_status); ++ ++extern int dwc_otg_hcd_qh_init_ddma(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh); ++extern void dwc_otg_hcd_qh_free_ddma(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh); ++ ++/** @} */ ++ ++/** @name Internal Functions */ ++/** @{ */ ++dwc_otg_qh_t *dwc_urb_to_qh(dwc_otg_hcd_urb_t * urb); ++/** @} */ ++ ++#ifdef CONFIG_USB_DWC_OTG_LPM ++extern int dwc_otg_hcd_get_hc_for_lpm_tran(dwc_otg_hcd_t * hcd, ++ uint8_t devaddr); ++extern void dwc_otg_hcd_free_hc_from_lpm(dwc_otg_hcd_t * hcd); ++#endif ++ ++/** Gets the QH that contains the list_head */ ++#define dwc_list_to_qh(_list_head_ptr_) container_of(_list_head_ptr_, dwc_otg_qh_t, qh_list_entry) ++ ++/** Gets the QTD that contains the list_head */ ++#define dwc_list_to_qtd(_list_head_ptr_) container_of(_list_head_ptr_, dwc_otg_qtd_t, qtd_list_entry) ++ ++/** Check if QH is non-periodic */ ++#define dwc_qh_is_non_per(_qh_ptr_) ((_qh_ptr_->ep_type == UE_BULK) || \ ++ (_qh_ptr_->ep_type == UE_CONTROL)) ++ ++/** High bandwidth multiplier as encoded in highspeed endpoint descriptors */ ++#define dwc_hb_mult(wMaxPacketSize) (1 + (((wMaxPacketSize) >> 11) & 0x03)) ++ ++/** Packet size for any kind of endpoint descriptor */ ++#define dwc_max_packet(wMaxPacketSize) ((wMaxPacketSize) & 0x07ff) ++ ++/** ++ * Returns true if _frame1 is less than or equal to _frame2. The comparison is ++ * done modulo DWC_HFNUM_MAX_FRNUM. This accounts for the rollover of the ++ * frame number when the max frame number is reached. ++ */ ++static inline int dwc_frame_num_le(uint16_t frame1, uint16_t frame2) ++{ ++ return ((frame2 - frame1) & DWC_HFNUM_MAX_FRNUM) <= ++ (DWC_HFNUM_MAX_FRNUM >> 1); ++} ++ ++/** ++ * Returns true if _frame1 is greater than _frame2. The comparison is done ++ * modulo DWC_HFNUM_MAX_FRNUM. This accounts for the rollover of the frame ++ * number when the max frame number is reached. ++ */ ++static inline int dwc_frame_num_gt(uint16_t frame1, uint16_t frame2) ++{ ++ return (frame1 != frame2) && ++ (((frame1 - frame2) & DWC_HFNUM_MAX_FRNUM) < ++ (DWC_HFNUM_MAX_FRNUM >> 1)); ++} ++ ++/** ++ * Increments _frame by the amount specified by _inc. The addition is done ++ * modulo DWC_HFNUM_MAX_FRNUM. Returns the incremented value. ++ */ ++static inline uint16_t dwc_frame_num_inc(uint16_t frame, uint16_t inc) ++{ ++ return (frame + inc) & DWC_HFNUM_MAX_FRNUM; ++} ++ ++static inline uint16_t dwc_full_frame_num(uint16_t frame) ++{ ++ return (frame & DWC_HFNUM_MAX_FRNUM) >> 3; ++} ++ ++static inline uint16_t dwc_micro_frame_num(uint16_t frame) ++{ ++ return frame & 0x7; ++} ++ ++void dwc_otg_hcd_save_data_toggle(dwc_hc_t * hc, ++ dwc_otg_hc_regs_t * hc_regs, ++ dwc_otg_qtd_t * qtd); ++ ++#ifdef DEBUG ++/** ++ * Macro to sample the remaining PHY clocks left in the current frame. This ++ * may be used during debugging to determine the average time it takes to ++ * execute sections of code. There are two possible sample points, "a" and ++ * "b", so the _letter argument must be one of these values. ++ * ++ * To dump the average sample times, read the "hcd_frrem" sysfs attribute. For ++ * example, "cat /sys/devices/lm0/hcd_frrem". ++ */ ++#define dwc_sample_frrem(_hcd, _qh, _letter) \ ++{ \ ++ hfnum_data_t hfnum; \ ++ dwc_otg_qtd_t *qtd; \ ++ qtd = list_entry(_qh->qtd_list.next, dwc_otg_qtd_t, qtd_list_entry); \ ++ if (usb_pipeint(qtd->urb->pipe) && _qh->start_split_frame != 0 && !qtd->complete_split) { \ ++ hfnum.d32 = DWC_READ_REG32(&_hcd->core_if->host_if->host_global_regs->hfnum); \ ++ switch (hfnum.b.frnum & 0x7) { \ ++ case 7: \ ++ _hcd->hfnum_7_samples_##_letter++; \ ++ _hcd->hfnum_7_frrem_accum_##_letter += hfnum.b.frrem; \ ++ break; \ ++ case 0: \ ++ _hcd->hfnum_0_samples_##_letter++; \ ++ _hcd->hfnum_0_frrem_accum_##_letter += hfnum.b.frrem; \ ++ break; \ ++ default: \ ++ _hcd->hfnum_other_samples_##_letter++; \ ++ _hcd->hfnum_other_frrem_accum_##_letter += hfnum.b.frrem; \ ++ break; \ ++ } \ ++ } \ ++} ++#else ++#define dwc_sample_frrem(_hcd, _qh, _letter) ++#endif ++#endif ++#endif /* DWC_DEVICE_ONLY */ +diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd_ddma.c b/drivers/usb/host/dwc_otg/dwc_otg_hcd_ddma.c +new file mode 100644 +index 0000000..ee920c4 +--- /dev/null ++++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd_ddma.c +@@ -0,0 +1,1132 @@ ++/*========================================================================== ++ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_hcd_ddma.c $ ++ * $Revision: #10 $ ++ * $Date: 2011/10/20 $ ++ * $Change: 1869464 $ ++ * ++ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, ++ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless ++ * otherwise expressly agreed to in writing between Synopsys and you. ++ * ++ * The Software IS NOT an item of Licensed Software or Licensed Product under ++ * any End User Software License Agreement or Agreement for Licensed Product ++ * with Synopsys or any supplement thereto. You are permitted to use and ++ * redistribute this Software in source and binary forms, with or without ++ * modification, provided that redistributions of source code must retain this ++ * notice. You may not view, use, disclose, copy or distribute this file or ++ * any information contained herein except pursuant to this license grant from ++ * Synopsys. If you do not agree with this notice, including the disclaimer ++ * below, then you are not authorized to use the Software. ++ * ++ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS ++ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS 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. ++ * ========================================================================== */ ++#ifndef DWC_DEVICE_ONLY ++ ++/** @file ++ * This file contains Descriptor DMA support implementation for host mode. ++ */ ++ ++#include "dwc_otg_hcd.h" ++#include "dwc_otg_regs.h" ++ ++extern bool microframe_schedule; ++ ++static inline uint8_t frame_list_idx(uint16_t frame) ++{ ++ return (frame & (MAX_FRLIST_EN_NUM - 1)); ++} ++ ++static inline uint16_t desclist_idx_inc(uint16_t idx, uint16_t inc, uint8_t speed) ++{ ++ return (idx + inc) & ++ (((speed == ++ DWC_OTG_EP_SPEED_HIGH) ? MAX_DMA_DESC_NUM_HS_ISOC : ++ MAX_DMA_DESC_NUM_GENERIC) - 1); ++} ++ ++static inline uint16_t desclist_idx_dec(uint16_t idx, uint16_t inc, uint8_t speed) ++{ ++ return (idx - inc) & ++ (((speed == ++ DWC_OTG_EP_SPEED_HIGH) ? MAX_DMA_DESC_NUM_HS_ISOC : ++ MAX_DMA_DESC_NUM_GENERIC) - 1); ++} ++ ++static inline uint16_t max_desc_num(dwc_otg_qh_t * qh) ++{ ++ return (((qh->ep_type == UE_ISOCHRONOUS) ++ && (qh->dev_speed == DWC_OTG_EP_SPEED_HIGH)) ++ ? MAX_DMA_DESC_NUM_HS_ISOC : MAX_DMA_DESC_NUM_GENERIC); ++} ++static inline uint16_t frame_incr_val(dwc_otg_qh_t * qh) ++{ ++ return ((qh->dev_speed == DWC_OTG_EP_SPEED_HIGH) ++ ? ((qh->interval + 8 - 1) / 8) ++ : qh->interval); ++} ++ ++static int desc_list_alloc(dwc_otg_qh_t * qh) ++{ ++ int retval = 0; ++ ++ qh->desc_list = (dwc_otg_host_dma_desc_t *) ++ DWC_DMA_ALLOC(sizeof(dwc_otg_host_dma_desc_t) * max_desc_num(qh), ++ &qh->desc_list_dma); ++ ++ if (!qh->desc_list) { ++ retval = -DWC_E_NO_MEMORY; ++ DWC_ERROR("%s: DMA descriptor list allocation failed\n", __func__); ++ ++ } ++ ++ dwc_memset(qh->desc_list, 0x00, ++ sizeof(dwc_otg_host_dma_desc_t) * max_desc_num(qh)); ++ ++ qh->n_bytes = ++ (uint32_t *) DWC_ALLOC(sizeof(uint32_t) * max_desc_num(qh)); ++ ++ if (!qh->n_bytes) { ++ retval = -DWC_E_NO_MEMORY; ++ DWC_ERROR ++ ("%s: Failed to allocate array for descriptors' size actual values\n", ++ __func__); ++ ++ } ++ return retval; ++ ++} ++ ++static void desc_list_free(dwc_otg_qh_t * qh) ++{ ++ if (qh->desc_list) { ++ DWC_DMA_FREE(max_desc_num(qh), qh->desc_list, ++ qh->desc_list_dma); ++ qh->desc_list = NULL; ++ } ++ ++ if (qh->n_bytes) { ++ DWC_FREE(qh->n_bytes); ++ qh->n_bytes = NULL; ++ } ++} ++ ++static int frame_list_alloc(dwc_otg_hcd_t * hcd) ++{ ++ int retval = 0; ++ if (hcd->frame_list) ++ return 0; ++ ++ hcd->frame_list = DWC_DMA_ALLOC(4 * MAX_FRLIST_EN_NUM, ++ &hcd->frame_list_dma); ++ if (!hcd->frame_list) { ++ retval = -DWC_E_NO_MEMORY; ++ DWC_ERROR("%s: Frame List allocation failed\n", __func__); ++ } ++ ++ dwc_memset(hcd->frame_list, 0x00, 4 * MAX_FRLIST_EN_NUM); ++ ++ return retval; ++} ++ ++static void frame_list_free(dwc_otg_hcd_t * hcd) ++{ ++ if (!hcd->frame_list) ++ return; ++ ++ DWC_DMA_FREE(4 * MAX_FRLIST_EN_NUM, hcd->frame_list, hcd->frame_list_dma); ++ hcd->frame_list = NULL; ++} ++ ++static void per_sched_enable(dwc_otg_hcd_t * hcd, uint16_t fr_list_en) ++{ ++ ++ hcfg_data_t hcfg; ++ ++ hcfg.d32 = DWC_READ_REG32(&hcd->core_if->host_if->host_global_regs->hcfg); ++ ++ if (hcfg.b.perschedena) { ++ /* already enabled */ ++ return; ++ } ++ ++ DWC_WRITE_REG32(&hcd->core_if->host_if->host_global_regs->hflbaddr, ++ hcd->frame_list_dma); ++ ++ switch (fr_list_en) { ++ case 64: ++ hcfg.b.frlisten = 3; ++ break; ++ case 32: ++ hcfg.b.frlisten = 2; ++ break; ++ case 16: ++ hcfg.b.frlisten = 1; ++ break; ++ case 8: ++ hcfg.b.frlisten = 0; ++ break; ++ default: ++ break; ++ } ++ ++ hcfg.b.perschedena = 1; ++ ++ DWC_DEBUGPL(DBG_HCD, "Enabling Periodic schedule\n"); ++ DWC_WRITE_REG32(&hcd->core_if->host_if->host_global_regs->hcfg, hcfg.d32); ++ ++} ++ ++static void per_sched_disable(dwc_otg_hcd_t * hcd) ++{ ++ hcfg_data_t hcfg; ++ ++ hcfg.d32 = DWC_READ_REG32(&hcd->core_if->host_if->host_global_regs->hcfg); ++ ++ if (!hcfg.b.perschedena) { ++ /* already disabled */ ++ return; ++ } ++ hcfg.b.perschedena = 0; ++ ++ DWC_DEBUGPL(DBG_HCD, "Disabling Periodic schedule\n"); ++ DWC_WRITE_REG32(&hcd->core_if->host_if->host_global_regs->hcfg, hcfg.d32); ++} ++ ++/* ++ * Activates/Deactivates FrameList entries for the channel ++ * based on endpoint servicing period. ++ */ ++void update_frame_list(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh, uint8_t enable) ++{ ++ uint16_t i, j, inc; ++ dwc_hc_t *hc = NULL; ++ ++ if (!qh->channel) { ++ DWC_ERROR("qh->channel = %p", qh->channel); ++ return; ++ } ++ ++ if (!hcd) { ++ DWC_ERROR("------hcd = %p", hcd); ++ return; ++ } ++ ++ if (!hcd->frame_list) { ++ DWC_ERROR("-------hcd->frame_list = %p", hcd->frame_list); ++ return; ++ } ++ ++ hc = qh->channel; ++ inc = frame_incr_val(qh); ++ if (qh->ep_type == UE_ISOCHRONOUS) ++ i = frame_list_idx(qh->sched_frame); ++ else ++ i = 0; ++ ++ j = i; ++ do { ++ if (enable) ++ hcd->frame_list[j] |= (1 << hc->hc_num); ++ else ++ hcd->frame_list[j] &= ~(1 << hc->hc_num); ++ j = (j + inc) & (MAX_FRLIST_EN_NUM - 1); ++ } ++ while (j != i); ++ if (!enable) ++ return; ++ hc->schinfo = 0; ++ if (qh->channel->speed == DWC_OTG_EP_SPEED_HIGH) { ++ j = 1; ++ /* TODO - check this */ ++ inc = (8 + qh->interval - 1) / qh->interval; ++ for (i = 0; i < inc; i++) { ++ hc->schinfo |= j; ++ j = j << qh->interval; ++ } ++ } else { ++ hc->schinfo = 0xff; ++ } ++} ++ ++#if 1 ++void dump_frame_list(dwc_otg_hcd_t * hcd) ++{ ++ int i = 0; ++ DWC_PRINTF("--FRAME LIST (hex) --\n"); ++ for (i = 0; i < MAX_FRLIST_EN_NUM; i++) { ++ DWC_PRINTF("%x\t", hcd->frame_list[i]); ++ if (!(i % 8) && i) ++ DWC_PRINTF("\n"); ++ } ++ DWC_PRINTF("\n----\n"); ++ ++} ++#endif ++ ++static void release_channel_ddma(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh) ++{ ++ dwc_irqflags_t flags; ++ dwc_spinlock_t *channel_lock = hcd->channel_lock; ++ ++ dwc_hc_t *hc = qh->channel; ++ if (dwc_qh_is_non_per(qh)) { ++ DWC_SPINLOCK_IRQSAVE(channel_lock, &flags); ++ if (!microframe_schedule) ++ hcd->non_periodic_channels--; ++ else ++ hcd->available_host_channels++; ++ DWC_SPINUNLOCK_IRQRESTORE(channel_lock, flags); ++ } else ++ update_frame_list(hcd, qh, 0); ++ ++ /* ++ * The condition is added to prevent double cleanup try in case of device ++ * disconnect. See channel cleanup in dwc_otg_hcd_disconnect_cb(). ++ */ ++ if (hc->qh) { ++ dwc_otg_hc_cleanup(hcd->core_if, hc); ++ DWC_CIRCLEQ_INSERT_TAIL(&hcd->free_hc_list, hc, hc_list_entry); ++ hc->qh = NULL; ++ } ++ ++ qh->channel = NULL; ++ qh->ntd = 0; ++ ++ if (qh->desc_list) { ++ dwc_memset(qh->desc_list, 0x00, ++ sizeof(dwc_otg_host_dma_desc_t) * max_desc_num(qh)); ++ } ++} ++ ++/** ++ * Initializes a QH structure's Descriptor DMA related members. ++ * Allocates memory for descriptor list. ++ * On first periodic QH, allocates memory for FrameList ++ * and enables periodic scheduling. ++ * ++ * @param hcd The HCD state structure for the DWC OTG controller. ++ * @param qh The QH to init. ++ * ++ * @return 0 if successful, negative error code otherwise. ++ */ ++int dwc_otg_hcd_qh_init_ddma(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh) ++{ ++ int retval = 0; ++ ++ if (qh->do_split) { ++ DWC_ERROR("SPLIT Transfers are not supported in Descriptor DMA.\n"); ++ return -1; ++ } ++ ++ retval = desc_list_alloc(qh); ++ ++ if ((retval == 0) ++ && (qh->ep_type == UE_ISOCHRONOUS || qh->ep_type == UE_INTERRUPT)) { ++ if (!hcd->frame_list) { ++ retval = frame_list_alloc(hcd); ++ /* Enable periodic schedule on first periodic QH */ ++ if (retval == 0) ++ per_sched_enable(hcd, MAX_FRLIST_EN_NUM); ++ } ++ } ++ ++ qh->ntd = 0; ++ ++ return retval; ++} ++ ++/** ++ * Frees descriptor list memory associated with the QH. ++ * If QH is periodic and the last, frees FrameList memory ++ * and disables periodic scheduling. ++ * ++ * @param hcd The HCD state structure for the DWC OTG controller. ++ * @param qh The QH to init. ++ */ ++void dwc_otg_hcd_qh_free_ddma(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh) ++{ ++ desc_list_free(qh); ++ ++ /* ++ * Channel still assigned due to some reasons. ++ * Seen on Isoc URB dequeue. Channel halted but no subsequent ++ * ChHalted interrupt to release the channel. Afterwards ++ * when it comes here from endpoint disable routine ++ * channel remains assigned. ++ */ ++ if (qh->channel) ++ release_channel_ddma(hcd, qh); ++ ++ if ((qh->ep_type == UE_ISOCHRONOUS || qh->ep_type == UE_INTERRUPT) ++ && (microframe_schedule || !hcd->periodic_channels) && hcd->frame_list) { ++ ++ per_sched_disable(hcd); ++ frame_list_free(hcd); ++ } ++} ++ ++static uint8_t frame_to_desc_idx(dwc_otg_qh_t * qh, uint16_t frame_idx) ++{ ++ if (qh->dev_speed == DWC_OTG_EP_SPEED_HIGH) { ++ /* ++ * Descriptor set(8 descriptors) index ++ * which is 8-aligned. ++ */ ++ return (frame_idx & ((MAX_DMA_DESC_NUM_HS_ISOC / 8) - 1)) * 8; ++ } else { ++ return (frame_idx & (MAX_DMA_DESC_NUM_GENERIC - 1)); ++ } ++} ++ ++/* ++ * Determine starting frame for Isochronous transfer. ++ * Few frames skipped to prevent race condition with HC. ++ */ ++static uint8_t calc_starting_frame(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh, ++ uint8_t * skip_frames) ++{ ++ uint16_t frame = 0; ++ hcd->frame_number = dwc_otg_hcd_get_frame_number(hcd); ++ ++ /* sched_frame is always frame number(not uFrame) both in FS and HS !! */ ++ ++ /* ++ * skip_frames is used to limit activated descriptors number ++ * to avoid the situation when HC services the last activated ++ * descriptor firstly. ++ * Example for FS: ++ * Current frame is 1, scheduled frame is 3. Since HC always fetches the descriptor ++ * corresponding to curr_frame+1, the descriptor corresponding to frame 2 ++ * will be fetched. If the number of descriptors is max=64 (or greather) the ++ * list will be fully programmed with Active descriptors and it is possible ++ * case(rare) that the latest descriptor(considering rollback) corresponding ++ * to frame 2 will be serviced first. HS case is more probable because, in fact, ++ * up to 11 uframes(16 in the code) may be skipped. ++ */ ++ if (qh->dev_speed == DWC_OTG_EP_SPEED_HIGH) { ++ /* ++ * Consider uframe counter also, to start xfer asap. ++ * If half of the frame elapsed skip 2 frames otherwise ++ * just 1 frame. ++ * Starting descriptor index must be 8-aligned, so ++ * if the current frame is near to complete the next one ++ * is skipped as well. ++ */ ++ ++ if (dwc_micro_frame_num(hcd->frame_number) >= 5) { ++ *skip_frames = 2 * 8; ++ frame = dwc_frame_num_inc(hcd->frame_number, *skip_frames); ++ } else { ++ *skip_frames = 1 * 8; ++ frame = dwc_frame_num_inc(hcd->frame_number, *skip_frames); ++ } ++ ++ frame = dwc_full_frame_num(frame); ++ } else { ++ /* ++ * Two frames are skipped for FS - the current and the next. ++ * But for descriptor programming, 1 frame(descriptor) is enough, ++ * see example above. ++ */ ++ *skip_frames = 1; ++ frame = dwc_frame_num_inc(hcd->frame_number, 2); ++ } ++ ++ return frame; ++} ++ ++/* ++ * Calculate initial descriptor index for isochronous transfer ++ * based on scheduled frame. ++ */ ++static uint8_t recalc_initial_desc_idx(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh) ++{ ++ uint16_t frame = 0, fr_idx, fr_idx_tmp; ++ uint8_t skip_frames = 0; ++ /* ++ * With current ISOC processing algorithm the channel is being ++ * released when no more QTDs in the list(qh->ntd == 0). ++ * Thus this function is called only when qh->ntd == 0 and qh->channel == 0. ++ * ++ * So qh->channel != NULL branch is not used and just not removed from the ++ * source file. It is required for another possible approach which is, ++ * do not disable and release the channel when ISOC session completed, ++ * just move QH to inactive schedule until new QTD arrives. ++ * On new QTD, the QH moved back to 'ready' schedule, ++ * starting frame and therefore starting desc_index are recalculated. ++ * In this case channel is released only on ep_disable. ++ */ ++ ++ /* Calculate starting descriptor index. For INTERRUPT endpoint it is always 0. */ ++ if (qh->channel) { ++ frame = calc_starting_frame(hcd, qh, &skip_frames); ++ /* ++ * Calculate initial descriptor index based on FrameList current bitmap ++ * and servicing period. ++ */ ++ fr_idx_tmp = frame_list_idx(frame); ++ fr_idx = ++ (MAX_FRLIST_EN_NUM + frame_list_idx(qh->sched_frame) - ++ fr_idx_tmp) ++ % frame_incr_val(qh); ++ fr_idx = (fr_idx + fr_idx_tmp) % MAX_FRLIST_EN_NUM; ++ } else { ++ qh->sched_frame = calc_starting_frame(hcd, qh, &skip_frames); ++ fr_idx = frame_list_idx(qh->sched_frame); ++ } ++ ++ qh->td_first = qh->td_last = frame_to_desc_idx(qh, fr_idx); ++ ++ return skip_frames; ++} ++ ++#define ISOC_URB_GIVEBACK_ASAP ++ ++#define MAX_ISOC_XFER_SIZE_FS 1023 ++#define MAX_ISOC_XFER_SIZE_HS 3072 ++#define DESCNUM_THRESHOLD 4 ++ ++static void init_isoc_dma_desc(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh, ++ uint8_t skip_frames) ++{ ++ struct dwc_otg_hcd_iso_packet_desc *frame_desc; ++ dwc_otg_qtd_t *qtd; ++ dwc_otg_host_dma_desc_t *dma_desc; ++ uint16_t idx, inc, n_desc, ntd_max, max_xfer_size; ++ ++ idx = qh->td_last; ++ inc = qh->interval; ++ n_desc = 0; ++ ++ ntd_max = (max_desc_num(qh) + qh->interval - 1) / qh->interval; ++ if (skip_frames && !qh->channel) ++ ntd_max = ntd_max - skip_frames / qh->interval; ++ ++ max_xfer_size = ++ (qh->dev_speed == ++ DWC_OTG_EP_SPEED_HIGH) ? MAX_ISOC_XFER_SIZE_HS : ++ MAX_ISOC_XFER_SIZE_FS; ++ ++ DWC_CIRCLEQ_FOREACH(qtd, &qh->qtd_list, qtd_list_entry) { ++ while ((qh->ntd < ntd_max) ++ && (qtd->isoc_frame_index_last < ++ qtd->urb->packet_count)) { ++ ++ dma_desc = &qh->desc_list[idx]; ++ dwc_memset(dma_desc, 0x00, sizeof(dwc_otg_host_dma_desc_t)); ++ ++ frame_desc = &qtd->urb->iso_descs[qtd->isoc_frame_index_last]; ++ ++ if (frame_desc->length > max_xfer_size) ++ qh->n_bytes[idx] = max_xfer_size; ++ else ++ qh->n_bytes[idx] = frame_desc->length; ++ dma_desc->status.b_isoc.n_bytes = qh->n_bytes[idx]; ++ dma_desc->status.b_isoc.a = 1; ++ dma_desc->status.b_isoc.sts = 0; ++ ++ dma_desc->buf = qtd->urb->dma + frame_desc->offset; ++ ++ qh->ntd++; ++ ++ qtd->isoc_frame_index_last++; ++ ++#ifdef ISOC_URB_GIVEBACK_ASAP ++ /* ++ * Set IOC for each descriptor corresponding to the ++ * last frame of the URB. ++ */ ++ if (qtd->isoc_frame_index_last == ++ qtd->urb->packet_count) ++ dma_desc->status.b_isoc.ioc = 1; ++ ++#endif ++ idx = desclist_idx_inc(idx, inc, qh->dev_speed); ++ n_desc++; ++ ++ } ++ qtd->in_process = 1; ++ } ++ ++ qh->td_last = idx; ++ ++#ifdef ISOC_URB_GIVEBACK_ASAP ++ /* Set IOC for the last descriptor if descriptor list is full */ ++ if (qh->ntd == ntd_max) { ++ idx = desclist_idx_dec(qh->td_last, inc, qh->dev_speed); ++ qh->desc_list[idx].status.b_isoc.ioc = 1; ++ } ++#else ++ /* ++ * Set IOC bit only for one descriptor. ++ * Always try to be ahead of HW processing, ++ * i.e. on IOC generation driver activates next descriptors but ++ * core continues to process descriptors followed the one with IOC set. ++ */ ++ ++ if (n_desc > DESCNUM_THRESHOLD) { ++ /* ++ * Move IOC "up". Required even if there is only one QTD ++ * in the list, cause QTDs migth continue to be queued, ++ * but during the activation it was only one queued. ++ * Actually more than one QTD might be in the list if this function called ++ * from XferCompletion - QTDs was queued during HW processing of the previous ++ * descriptor chunk. ++ */ ++ idx = dwc_desclist_idx_dec(idx, inc * ((qh->ntd + 1) / 2), qh->dev_speed); ++ } else { ++ /* ++ * Set the IOC for the latest descriptor ++ * if either number of descriptor is not greather than threshold ++ * or no more new descriptors activated. ++ */ ++ idx = dwc_desclist_idx_dec(qh->td_last, inc, qh->dev_speed); ++ } ++ ++ qh->desc_list[idx].status.b_isoc.ioc = 1; ++#endif ++} ++ ++static void init_non_isoc_dma_desc(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh) ++{ ++ ++ dwc_hc_t *hc; ++ dwc_otg_host_dma_desc_t *dma_desc; ++ dwc_otg_qtd_t *qtd; ++ int num_packets, len, n_desc = 0; ++ ++ hc = qh->channel; ++ ++ /* ++ * Start with hc->xfer_buff initialized in ++ * assign_and_init_hc(), then if SG transfer consists of multiple URBs, ++ * this pointer re-assigned to the buffer of the currently processed QTD. ++ * For non-SG request there is always one QTD active. ++ */ ++ ++ DWC_CIRCLEQ_FOREACH(qtd, &qh->qtd_list, qtd_list_entry) { ++ ++ if (n_desc) { ++ /* SG request - more than 1 QTDs */ ++ hc->xfer_buff = (uint8_t *)qtd->urb->dma + qtd->urb->actual_length; ++ hc->xfer_len = qtd->urb->length - qtd->urb->actual_length; ++ } ++ ++ qtd->n_desc = 0; ++ ++ do { ++ dma_desc = &qh->desc_list[n_desc]; ++ len = hc->xfer_len; ++ ++ if (len > MAX_DMA_DESC_SIZE) ++ len = MAX_DMA_DESC_SIZE - hc->max_packet + 1; ++ ++ if (hc->ep_is_in) { ++ if (len > 0) { ++ num_packets = (len + hc->max_packet - 1) / hc->max_packet; ++ } else { ++ /* Need 1 packet for transfer length of 0. */ ++ num_packets = 1; ++ } ++ /* Always program an integral # of max packets for IN transfers. */ ++ len = num_packets * hc->max_packet; ++ } ++ ++ dma_desc->status.b.n_bytes = len; ++ ++ qh->n_bytes[n_desc] = len; ++ ++ if ((qh->ep_type == UE_CONTROL) ++ && (qtd->control_phase == DWC_OTG_CONTROL_SETUP)) ++ dma_desc->status.b.sup = 1; /* Setup Packet */ ++ ++ dma_desc->status.b.a = 1; /* Active descriptor */ ++ dma_desc->status.b.sts = 0; ++ ++ dma_desc->buf = ++ ((unsigned long)hc->xfer_buff & 0xffffffff); ++ ++ /* ++ * Last descriptor(or single) of IN transfer ++ * with actual size less than MaxPacket. ++ */ ++ if (len > hc->xfer_len) { ++ hc->xfer_len = 0; ++ } else { ++ hc->xfer_buff += len; ++ hc->xfer_len -= len; ++ } ++ ++ qtd->n_desc++; ++ n_desc++; ++ } ++ while ((hc->xfer_len > 0) && (n_desc != MAX_DMA_DESC_NUM_GENERIC)); ++ ++ ++ qtd->in_process = 1; ++ ++ if (qh->ep_type == UE_CONTROL) ++ break; ++ ++ if (n_desc == MAX_DMA_DESC_NUM_GENERIC) ++ break; ++ } ++ ++ if (n_desc) { ++ /* Request Transfer Complete interrupt for the last descriptor */ ++ qh->desc_list[n_desc - 1].status.b.ioc = 1; ++ /* End of List indicator */ ++ qh->desc_list[n_desc - 1].status.b.eol = 1; ++ ++ hc->ntd = n_desc; ++ } ++} ++ ++/** ++ * For Control and Bulk endpoints initializes descriptor list ++ * and starts the transfer. ++ * ++ * For Interrupt and Isochronous endpoints initializes descriptor list ++ * then updates FrameList, marking appropriate entries as active. ++ * In case of Isochronous, the starting descriptor index is calculated based ++ * on the scheduled frame, but only on the first transfer descriptor within a session. ++ * Then starts the transfer via enabling the channel. ++ * For Isochronous endpoint the channel is not halted on XferComplete ++ * interrupt so remains assigned to the endpoint(QH) until session is done. ++ * ++ * @param hcd The HCD state structure for the DWC OTG controller. ++ * @param qh The QH to init. ++ * ++ * @return 0 if successful, negative error code otherwise. ++ */ ++void dwc_otg_hcd_start_xfer_ddma(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh) ++{ ++ /* Channel is already assigned */ ++ dwc_hc_t *hc = qh->channel; ++ uint8_t skip_frames = 0; ++ ++ switch (hc->ep_type) { ++ case DWC_OTG_EP_TYPE_CONTROL: ++ case DWC_OTG_EP_TYPE_BULK: ++ init_non_isoc_dma_desc(hcd, qh); ++ ++ dwc_otg_hc_start_transfer_ddma(hcd->core_if, hc); ++ break; ++ case DWC_OTG_EP_TYPE_INTR: ++ init_non_isoc_dma_desc(hcd, qh); ++ ++ update_frame_list(hcd, qh, 1); ++ ++ dwc_otg_hc_start_transfer_ddma(hcd->core_if, hc); ++ break; ++ case DWC_OTG_EP_TYPE_ISOC: ++ ++ if (!qh->ntd) ++ skip_frames = recalc_initial_desc_idx(hcd, qh); ++ ++ init_isoc_dma_desc(hcd, qh, skip_frames); ++ ++ if (!hc->xfer_started) { ++ ++ update_frame_list(hcd, qh, 1); ++ ++ /* ++ * Always set to max, instead of actual size. ++ * Otherwise ntd will be changed with ++ * channel being enabled. Not recommended. ++ * ++ */ ++ hc->ntd = max_desc_num(qh); ++ /* Enable channel only once for ISOC */ ++ dwc_otg_hc_start_transfer_ddma(hcd->core_if, hc); ++ } ++ ++ break; ++ default: ++ ++ break; ++ } ++} ++ ++static void complete_isoc_xfer_ddma(dwc_otg_hcd_t * hcd, ++ dwc_hc_t * hc, ++ dwc_otg_hc_regs_t * hc_regs, ++ dwc_otg_halt_status_e halt_status) ++{ ++ struct dwc_otg_hcd_iso_packet_desc *frame_desc; ++ dwc_otg_qtd_t *qtd, *qtd_tmp; ++ dwc_otg_qh_t *qh; ++ dwc_otg_host_dma_desc_t *dma_desc; ++ uint16_t idx, remain; ++ uint8_t urb_compl; ++ ++ qh = hc->qh; ++ idx = qh->td_first; ++ ++ if (hc->halt_status == DWC_OTG_HC_XFER_URB_DEQUEUE) { ++ DWC_CIRCLEQ_FOREACH_SAFE(qtd, qtd_tmp, &hc->qh->qtd_list, qtd_list_entry) ++ qtd->in_process = 0; ++ return; ++ } else if ((halt_status == DWC_OTG_HC_XFER_AHB_ERR) || ++ (halt_status == DWC_OTG_HC_XFER_BABBLE_ERR)) { ++ /* ++ * Channel is halted in these error cases. ++ * Considered as serious issues. ++ * Complete all URBs marking all frames as failed, ++ * irrespective whether some of the descriptors(frames) succeeded or no. ++ * Pass error code to completion routine as well, to ++ * update urb->status, some of class drivers might use it to stop ++ * queing transfer requests. ++ */ ++ int err = (halt_status == DWC_OTG_HC_XFER_AHB_ERR) ++ ? (-DWC_E_IO) ++ : (-DWC_E_OVERFLOW); ++ ++ DWC_CIRCLEQ_FOREACH_SAFE(qtd, qtd_tmp, &hc->qh->qtd_list, qtd_list_entry) { ++ for (idx = 0; idx < qtd->urb->packet_count; idx++) { ++ frame_desc = &qtd->urb->iso_descs[idx]; ++ frame_desc->status = err; ++ } ++ hcd->fops->complete(hcd, qtd->urb->priv, qtd->urb, err); ++ dwc_otg_hcd_qtd_remove_and_free(hcd, qtd, qh); ++ } ++ return; ++ } ++ ++ DWC_CIRCLEQ_FOREACH_SAFE(qtd, qtd_tmp, &hc->qh->qtd_list, qtd_list_entry) { ++ ++ if (!qtd->in_process) ++ break; ++ ++ urb_compl = 0; ++ ++ do { ++ ++ dma_desc = &qh->desc_list[idx]; ++ ++ frame_desc = &qtd->urb->iso_descs[qtd->isoc_frame_index]; ++ remain = hc->ep_is_in ? dma_desc->status.b_isoc.n_bytes : 0; ++ ++ if (dma_desc->status.b_isoc.sts == DMA_DESC_STS_PKTERR) { ++ /* ++ * XactError or, unable to complete all the transactions ++ * in the scheduled micro-frame/frame, ++ * both indicated by DMA_DESC_STS_PKTERR. ++ */ ++ qtd->urb->error_count++; ++ frame_desc->actual_length = qh->n_bytes[idx] - remain; ++ frame_desc->status = -DWC_E_PROTOCOL; ++ } else { ++ /* Success */ ++ ++ frame_desc->actual_length = qh->n_bytes[idx] - remain; ++ frame_desc->status = 0; ++ } ++ ++ if (++qtd->isoc_frame_index == qtd->urb->packet_count) { ++ /* ++ * urb->status is not used for isoc transfers here. ++ * The individual frame_desc status are used instead. ++ */ ++ ++ hcd->fops->complete(hcd, qtd->urb->priv, qtd->urb, 0); ++ dwc_otg_hcd_qtd_remove_and_free(hcd, qtd, qh); ++ ++ /* ++ * This check is necessary because urb_dequeue can be called ++ * from urb complete callback(sound driver example). ++ * All pending URBs are dequeued there, so no need for ++ * further processing. ++ */ ++ if (hc->halt_status == DWC_OTG_HC_XFER_URB_DEQUEUE) { ++ return; ++ } ++ ++ urb_compl = 1; ++ ++ } ++ ++ qh->ntd--; ++ ++ /* Stop if IOC requested descriptor reached */ ++ if (dma_desc->status.b_isoc.ioc) { ++ idx = desclist_idx_inc(idx, qh->interval, hc->speed); ++ goto stop_scan; ++ } ++ ++ idx = desclist_idx_inc(idx, qh->interval, hc->speed); ++ ++ if (urb_compl) ++ break; ++ } ++ while (idx != qh->td_first); ++ } ++stop_scan: ++ qh->td_first = idx; ++} ++ ++uint8_t update_non_isoc_urb_state_ddma(dwc_otg_hcd_t * hcd, ++ dwc_hc_t * hc, ++ dwc_otg_qtd_t * qtd, ++ dwc_otg_host_dma_desc_t * dma_desc, ++ dwc_otg_halt_status_e halt_status, ++ uint32_t n_bytes, uint8_t * xfer_done) ++{ ++ ++ uint16_t remain = hc->ep_is_in ? dma_desc->status.b.n_bytes : 0; ++ dwc_otg_hcd_urb_t *urb = qtd->urb; ++ ++ if (halt_status == DWC_OTG_HC_XFER_AHB_ERR) { ++ urb->status = -DWC_E_IO; ++ return 1; ++ } ++ if (dma_desc->status.b.sts == DMA_DESC_STS_PKTERR) { ++ switch (halt_status) { ++ case DWC_OTG_HC_XFER_STALL: ++ urb->status = -DWC_E_PIPE; ++ break; ++ case DWC_OTG_HC_XFER_BABBLE_ERR: ++ urb->status = -DWC_E_OVERFLOW; ++ break; ++ case DWC_OTG_HC_XFER_XACT_ERR: ++ urb->status = -DWC_E_PROTOCOL; ++ break; ++ default: ++ DWC_ERROR("%s: Unhandled descriptor error status (%d)\n", __func__, ++ halt_status); ++ break; ++ } ++ return 1; ++ } ++ ++ if (dma_desc->status.b.a == 1) { ++ DWC_DEBUGPL(DBG_HCDV, ++ "Active descriptor encountered on channel %d\n", ++ hc->hc_num); ++ return 0; ++ } ++ ++ if (hc->ep_type == DWC_OTG_EP_TYPE_CONTROL) { ++ if (qtd->control_phase == DWC_OTG_CONTROL_DATA) { ++ urb->actual_length += n_bytes - remain; ++ if (remain || urb->actual_length == urb->length) { ++ /* ++ * For Control Data stage do not set urb->status=0 to prevent ++ * URB callback. Set it when Status phase done. See below. ++ */ ++ *xfer_done = 1; ++ } ++ ++ } else if (qtd->control_phase == DWC_OTG_CONTROL_STATUS) { ++ urb->status = 0; ++ *xfer_done = 1; ++ } ++ /* No handling for SETUP stage */ ++ } else { ++ /* BULK and INTR */ ++ urb->actual_length += n_bytes - remain; ++ if (remain || urb->actual_length == urb->length) { ++ urb->status = 0; ++ *xfer_done = 1; ++ } ++ } ++ ++ return 0; ++} ++ ++static void complete_non_isoc_xfer_ddma(dwc_otg_hcd_t * hcd, ++ dwc_hc_t * hc, ++ dwc_otg_hc_regs_t * hc_regs, ++ dwc_otg_halt_status_e halt_status) ++{ ++ dwc_otg_hcd_urb_t *urb = NULL; ++ dwc_otg_qtd_t *qtd, *qtd_tmp; ++ dwc_otg_qh_t *qh; ++ dwc_otg_host_dma_desc_t *dma_desc; ++ uint32_t n_bytes, n_desc, i; ++ uint8_t failed = 0, xfer_done; ++ ++ n_desc = 0; ++ ++ qh = hc->qh; ++ ++ if (hc->halt_status == DWC_OTG_HC_XFER_URB_DEQUEUE) { ++ DWC_CIRCLEQ_FOREACH_SAFE(qtd, qtd_tmp, &hc->qh->qtd_list, qtd_list_entry) { ++ qtd->in_process = 0; ++ } ++ return; ++ } ++ ++ DWC_CIRCLEQ_FOREACH_SAFE(qtd, qtd_tmp, &qh->qtd_list, qtd_list_entry) { ++ ++ urb = qtd->urb; ++ ++ n_bytes = 0; ++ xfer_done = 0; ++ ++ for (i = 0; i < qtd->n_desc; i++) { ++ dma_desc = &qh->desc_list[n_desc]; ++ ++ n_bytes = qh->n_bytes[n_desc]; ++ ++ failed = ++ update_non_isoc_urb_state_ddma(hcd, hc, qtd, ++ dma_desc, ++ halt_status, n_bytes, ++ &xfer_done); ++ ++ if (failed ++ || (xfer_done ++ && (urb->status != -DWC_E_IN_PROGRESS))) { ++ ++ hcd->fops->complete(hcd, urb->priv, urb, ++ urb->status); ++ dwc_otg_hcd_qtd_remove_and_free(hcd, qtd, qh); ++ ++ if (failed) ++ goto stop_scan; ++ } else if (qh->ep_type == UE_CONTROL) { ++ if (qtd->control_phase == DWC_OTG_CONTROL_SETUP) { ++ if (urb->length > 0) { ++ qtd->control_phase = DWC_OTG_CONTROL_DATA; ++ } else { ++ qtd->control_phase = DWC_OTG_CONTROL_STATUS; ++ } ++ DWC_DEBUGPL(DBG_HCDV, " Control setup transaction done\n"); ++ } else if (qtd->control_phase == DWC_OTG_CONTROL_DATA) { ++ if (xfer_done) { ++ qtd->control_phase = DWC_OTG_CONTROL_STATUS; ++ DWC_DEBUGPL(DBG_HCDV, " Control data transfer done\n"); ++ } else if (i + 1 == qtd->n_desc) { ++ /* ++ * Last descriptor for Control data stage which is ++ * not completed yet. ++ */ ++ dwc_otg_hcd_save_data_toggle(hc, hc_regs, qtd); ++ } ++ } ++ } ++ ++ n_desc++; ++ } ++ ++ } ++ ++stop_scan: ++ ++ if (qh->ep_type != UE_CONTROL) { ++ /* ++ * Resetting the data toggle for bulk ++ * and interrupt endpoints in case of stall. See handle_hc_stall_intr() ++ */ ++ if (halt_status == DWC_OTG_HC_XFER_STALL) ++ qh->data_toggle = DWC_OTG_HC_PID_DATA0; ++ else ++ dwc_otg_hcd_save_data_toggle(hc, hc_regs, qtd); ++ } ++ ++ if (halt_status == DWC_OTG_HC_XFER_COMPLETE) { ++ hcint_data_t hcint; ++ hcint.d32 = DWC_READ_REG32(&hc_regs->hcint); ++ if (hcint.b.nyet) { ++ /* ++ * Got a NYET on the last transaction of the transfer. It ++ * means that the endpoint should be in the PING state at the ++ * beginning of the next transfer. ++ */ ++ qh->ping_state = 1; ++ clear_hc_int(hc_regs, nyet); ++ } ++ ++ } ++ ++} ++ ++/** ++ * This function is called from interrupt handlers. ++ * Scans the descriptor list, updates URB's status and ++ * calls completion routine for the URB if it's done. ++ * Releases the channel to be used by other transfers. ++ * In case of Isochronous endpoint the channel is not halted until ++ * the end of the session, i.e. QTD list is empty. ++ * If periodic channel released the FrameList is updated accordingly. ++ * ++ * Calls transaction selection routines to activate pending transfers. ++ * ++ * @param hcd The HCD state structure for the DWC OTG controller. ++ * @param hc Host channel, the transfer is completed on. ++ * @param hc_regs Host channel registers. ++ * @param halt_status Reason the channel is being halted, ++ * or just XferComplete for isochronous transfer ++ */ ++void dwc_otg_hcd_complete_xfer_ddma(dwc_otg_hcd_t * hcd, ++ dwc_hc_t * hc, ++ dwc_otg_hc_regs_t * hc_regs, ++ dwc_otg_halt_status_e halt_status) ++{ ++ uint8_t continue_isoc_xfer = 0; ++ dwc_otg_transaction_type_e tr_type; ++ dwc_otg_qh_t *qh = hc->qh; ++ ++ if (hc->ep_type == DWC_OTG_EP_TYPE_ISOC) { ++ ++ complete_isoc_xfer_ddma(hcd, hc, hc_regs, halt_status); ++ ++ /* Release the channel if halted or session completed */ ++ if (halt_status != DWC_OTG_HC_XFER_COMPLETE || ++ DWC_CIRCLEQ_EMPTY(&qh->qtd_list)) { ++ ++ /* Halt the channel if session completed */ ++ if (halt_status == DWC_OTG_HC_XFER_COMPLETE) { ++ dwc_otg_hc_halt(hcd->core_if, hc, halt_status); ++ } ++ ++ release_channel_ddma(hcd, qh); ++ dwc_otg_hcd_qh_remove(hcd, qh); ++ } else { ++ /* Keep in assigned schedule to continue transfer */ ++ DWC_LIST_MOVE_HEAD(&hcd->periodic_sched_assigned, ++ &qh->qh_list_entry); ++ continue_isoc_xfer = 1; ++ ++ } ++ /** @todo Consider the case when period exceeds FrameList size. ++ * Frame Rollover interrupt should be used. ++ */ ++ } else { ++ /* Scan descriptor list to complete the URB(s), then release the channel */ ++ complete_non_isoc_xfer_ddma(hcd, hc, hc_regs, halt_status); ++ ++ release_channel_ddma(hcd, qh); ++ dwc_otg_hcd_qh_remove(hcd, qh); ++ ++ if (!DWC_CIRCLEQ_EMPTY(&qh->qtd_list)) { ++ /* Add back to inactive non-periodic schedule on normal completion */ ++ dwc_otg_hcd_qh_add(hcd, qh); ++ } ++ ++ } ++ tr_type = dwc_otg_hcd_select_transactions(hcd); ++ if (tr_type != DWC_OTG_TRANSACTION_NONE || continue_isoc_xfer) { ++ if (continue_isoc_xfer) { ++ if (tr_type == DWC_OTG_TRANSACTION_NONE) { ++ tr_type = DWC_OTG_TRANSACTION_PERIODIC; ++ } else if (tr_type == DWC_OTG_TRANSACTION_NON_PERIODIC) { ++ tr_type = DWC_OTG_TRANSACTION_ALL; ++ } ++ } ++ dwc_otg_hcd_queue_transactions(hcd, tr_type); ++ } ++} ++ ++#endif /* DWC_DEVICE_ONLY */ +diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd_if.h b/drivers/usb/host/dwc_otg/dwc_otg_hcd_if.h +new file mode 100644 +index 0000000..fb57db0 +--- /dev/null ++++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd_if.h +@@ -0,0 +1,417 @@ ++/* ========================================================================== ++ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_hcd_if.h $ ++ * $Revision: #12 $ ++ * $Date: 2011/10/26 $ ++ * $Change: 1873028 $ ++ * ++ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, ++ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless ++ * otherwise expressly agreed to in writing between Synopsys and you. ++ * ++ * The Software IS NOT an item of Licensed Software or Licensed Product under ++ * any End User Software License Agreement or Agreement for Licensed Product ++ * with Synopsys or any supplement thereto. You are permitted to use and ++ * redistribute this Software in source and binary forms, with or without ++ * modification, provided that redistributions of source code must retain this ++ * notice. You may not view, use, disclose, copy or distribute this file or ++ * any information contained herein except pursuant to this license grant from ++ * Synopsys. If you do not agree with this notice, including the disclaimer ++ * below, then you are not authorized to use the Software. ++ * ++ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS ++ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS 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. ++ * ========================================================================== */ ++#ifndef DWC_DEVICE_ONLY ++#ifndef __DWC_HCD_IF_H__ ++#define __DWC_HCD_IF_H__ ++ ++#include "dwc_otg_core_if.h" ++ ++/** @file ++ * This file defines DWC_OTG HCD Core API. ++ */ ++ ++struct dwc_otg_hcd; ++typedef struct dwc_otg_hcd dwc_otg_hcd_t; ++ ++struct dwc_otg_hcd_urb; ++typedef struct dwc_otg_hcd_urb dwc_otg_hcd_urb_t; ++ ++/** @name HCD Function Driver Callbacks */ ++/** @{ */ ++ ++/** This function is called whenever core switches to host mode. */ ++typedef int (*dwc_otg_hcd_start_cb_t) (dwc_otg_hcd_t * hcd); ++ ++/** This function is called when device has been disconnected */ ++typedef int (*dwc_otg_hcd_disconnect_cb_t) (dwc_otg_hcd_t * hcd); ++ ++/** Wrapper provides this function to HCD to core, so it can get hub information to which device is connected */ ++typedef int (*dwc_otg_hcd_hub_info_from_urb_cb_t) (dwc_otg_hcd_t * hcd, ++ void *urb_handle, ++ uint32_t * hub_addr, ++ uint32_t * port_addr); ++/** Via this function HCD core gets device speed */ ++typedef int (*dwc_otg_hcd_speed_from_urb_cb_t) (dwc_otg_hcd_t * hcd, ++ void *urb_handle); ++ ++/** This function is called when urb is completed */ ++typedef int (*dwc_otg_hcd_complete_urb_cb_t) (dwc_otg_hcd_t * hcd, ++ void *urb_handle, ++ dwc_otg_hcd_urb_t * dwc_otg_urb, ++ int32_t status); ++ ++/** Via this function HCD core gets b_hnp_enable parameter */ ++typedef int (*dwc_otg_hcd_get_b_hnp_enable) (dwc_otg_hcd_t * hcd); ++ ++struct dwc_otg_hcd_function_ops { ++ dwc_otg_hcd_start_cb_t start; ++ dwc_otg_hcd_disconnect_cb_t disconnect; ++ dwc_otg_hcd_hub_info_from_urb_cb_t hub_info; ++ dwc_otg_hcd_speed_from_urb_cb_t speed; ++ dwc_otg_hcd_complete_urb_cb_t complete; ++ dwc_otg_hcd_get_b_hnp_enable get_b_hnp_enable; ++}; ++/** @} */ ++ ++/** @name HCD Core API */ ++/** @{ */ ++/** This function allocates dwc_otg_hcd structure and returns pointer on it. */ ++extern dwc_otg_hcd_t *dwc_otg_hcd_alloc_hcd(void); ++ ++/** This function should be called to initiate HCD Core. ++ * ++ * @param hcd The HCD ++ * @param core_if The DWC_OTG Core ++ * ++ * Returns -DWC_E_NO_MEMORY if no enough memory. ++ * Returns 0 on success ++ */ ++extern int dwc_otg_hcd_init(dwc_otg_hcd_t * hcd, dwc_otg_core_if_t * core_if); ++ ++/** Frees HCD ++ * ++ * @param hcd The HCD ++ */ ++extern void dwc_otg_hcd_remove(dwc_otg_hcd_t * hcd); ++ ++/** This function should be called on every hardware interrupt. ++ * ++ * @param dwc_otg_hcd The HCD ++ * ++ * Returns non zero if interrupt is handled ++ * Return 0 if interrupt is not handled ++ */ ++extern int32_t dwc_otg_hcd_handle_intr(dwc_otg_hcd_t * dwc_otg_hcd); ++ ++/** This function is used to handle the fast interrupt ++ * ++ */ ++extern void __attribute__ ((naked)) dwc_otg_hcd_handle_fiq(void); ++ ++/** ++ * Returns private data set by ++ * dwc_otg_hcd_set_priv_data function. ++ * ++ * @param hcd The HCD ++ */ ++extern void *dwc_otg_hcd_get_priv_data(dwc_otg_hcd_t * hcd); ++ ++/** ++ * Set private data. ++ * ++ * @param hcd The HCD ++ * @param priv_data pointer to be stored in private data ++ */ ++extern void dwc_otg_hcd_set_priv_data(dwc_otg_hcd_t * hcd, void *priv_data); ++ ++/** ++ * This function initializes the HCD Core. ++ * ++ * @param hcd The HCD ++ * @param fops The Function Driver Operations data structure containing pointers to all callbacks. ++ * ++ * Returns -DWC_E_NO_DEVICE if Core is currently is in device mode. ++ * Returns 0 on success ++ */ ++extern int dwc_otg_hcd_start(dwc_otg_hcd_t * hcd, ++ struct dwc_otg_hcd_function_ops *fops); ++ ++/** ++ * Halts the DWC_otg host mode operations in a clean manner. USB transfers are ++ * stopped. ++ * ++ * @param hcd The HCD ++ */ ++extern void dwc_otg_hcd_stop(dwc_otg_hcd_t * hcd); ++ ++/** ++ * Handles hub class-specific requests. ++ * ++ * @param dwc_otg_hcd The HCD ++ * @param typeReq Request Type ++ * @param wValue wValue from control request ++ * @param wIndex wIndex from control request ++ * @param buf data buffer ++ * @param wLength data buffer length ++ * ++ * Returns -DWC_E_INVALID if invalid argument is passed ++ * Returns 0 on success ++ */ ++extern int dwc_otg_hcd_hub_control(dwc_otg_hcd_t * dwc_otg_hcd, ++ uint16_t typeReq, uint16_t wValue, ++ uint16_t wIndex, uint8_t * buf, ++ uint16_t wLength); ++ ++/** ++ * Returns otg port number. ++ * ++ * @param hcd The HCD ++ */ ++extern uint32_t dwc_otg_hcd_otg_port(dwc_otg_hcd_t * hcd); ++ ++/** ++ * Returns OTG version - either 1.3 or 2.0. ++ * ++ * @param core_if The core_if structure pointer ++ */ ++extern uint16_t dwc_otg_get_otg_version(dwc_otg_core_if_t * core_if); ++ ++/** ++ * Returns 1 if currently core is acting as B host, and 0 otherwise. ++ * ++ * @param hcd The HCD ++ */ ++extern uint32_t dwc_otg_hcd_is_b_host(dwc_otg_hcd_t * hcd); ++ ++/** ++ * Returns current frame number. ++ * ++ * @param hcd The HCD ++ */ ++extern int dwc_otg_hcd_get_frame_number(dwc_otg_hcd_t * hcd); ++ ++/** ++ * Dumps hcd state. ++ * ++ * @param hcd The HCD ++ */ ++extern void dwc_otg_hcd_dump_state(dwc_otg_hcd_t * hcd); ++ ++/** ++ * Dump the average frame remaining at SOF. This can be used to ++ * determine average interrupt latency. Frame remaining is also shown for ++ * start transfer and two additional sample points. ++ * Currently this function is not implemented. ++ * ++ * @param hcd The HCD ++ */ ++extern void dwc_otg_hcd_dump_frrem(dwc_otg_hcd_t * hcd); ++ ++/** ++ * Sends LPM transaction to the local device. ++ * ++ * @param hcd The HCD ++ * @param devaddr Device Address ++ * @param hird Host initiated resume duration ++ * @param bRemoteWake Value of bRemoteWake field in LPM transaction ++ * ++ * Returns negative value if sending LPM transaction was not succeeded. ++ * Returns 0 on success. ++ */ ++extern int dwc_otg_hcd_send_lpm(dwc_otg_hcd_t * hcd, uint8_t devaddr, ++ uint8_t hird, uint8_t bRemoteWake); ++ ++/* URB interface */ ++ ++/** ++ * Allocates memory for dwc_otg_hcd_urb structure. ++ * Allocated memory should be freed by call of DWC_FREE. ++ * ++ * @param hcd The HCD ++ * @param iso_desc_count Count of ISOC descriptors ++ * @param atomic_alloc Specefies whether to perform atomic allocation. ++ */ ++extern dwc_otg_hcd_urb_t *dwc_otg_hcd_urb_alloc(dwc_otg_hcd_t * hcd, ++ int iso_desc_count, ++ int atomic_alloc); ++ ++/** ++ * Set pipe information in URB. ++ * ++ * @param hcd_urb DWC_OTG URB ++ * @param devaddr Device Address ++ * @param ep_num Endpoint Number ++ * @param ep_type Endpoint Type ++ * @param ep_dir Endpoint Direction ++ * @param mps Max Packet Size ++ */ ++extern void dwc_otg_hcd_urb_set_pipeinfo(dwc_otg_hcd_urb_t * hcd_urb, ++ uint8_t devaddr, uint8_t ep_num, ++ uint8_t ep_type, uint8_t ep_dir, ++ uint16_t mps); ++ ++/* Transfer flags */ ++#define URB_GIVEBACK_ASAP 0x1 ++#define URB_SEND_ZERO_PACKET 0x2 ++ ++/** ++ * Sets dwc_otg_hcd_urb parameters. ++ * ++ * @param urb DWC_OTG URB allocated by dwc_otg_hcd_urb_alloc function. ++ * @param urb_handle Unique handle for request, this will be passed back ++ * to function driver in completion callback. ++ * @param buf The buffer for the data ++ * @param dma The DMA buffer for the data ++ * @param buflen Transfer length ++ * @param sp Buffer for setup data ++ * @param sp_dma DMA address of setup data buffer ++ * @param flags Transfer flags ++ * @param interval Polling interval for interrupt or isochronous transfers. ++ */ ++extern void dwc_otg_hcd_urb_set_params(dwc_otg_hcd_urb_t * urb, ++ void *urb_handle, void *buf, ++ dwc_dma_t dma, uint32_t buflen, void *sp, ++ dwc_dma_t sp_dma, uint32_t flags, ++ uint16_t interval); ++ ++/** Gets status from dwc_otg_hcd_urb ++ * ++ * @param dwc_otg_urb DWC_OTG URB ++ */ ++extern uint32_t dwc_otg_hcd_urb_get_status(dwc_otg_hcd_urb_t * dwc_otg_urb); ++ ++/** Gets actual length from dwc_otg_hcd_urb ++ * ++ * @param dwc_otg_urb DWC_OTG URB ++ */ ++extern uint32_t dwc_otg_hcd_urb_get_actual_length(dwc_otg_hcd_urb_t * ++ dwc_otg_urb); ++ ++/** Gets error count from dwc_otg_hcd_urb. Only for ISOC URBs ++ * ++ * @param dwc_otg_urb DWC_OTG URB ++ */ ++extern uint32_t dwc_otg_hcd_urb_get_error_count(dwc_otg_hcd_urb_t * ++ dwc_otg_urb); ++ ++/** Set ISOC descriptor offset and length ++ * ++ * @param dwc_otg_urb DWC_OTG URB ++ * @param desc_num ISOC descriptor number ++ * @param offset Offset from beginig of buffer. ++ * @param length Transaction length ++ */ ++extern void dwc_otg_hcd_urb_set_iso_desc_params(dwc_otg_hcd_urb_t * dwc_otg_urb, ++ int desc_num, uint32_t offset, ++ uint32_t length); ++ ++/** Get status of ISOC descriptor, specified by desc_num ++ * ++ * @param dwc_otg_urb DWC_OTG URB ++ * @param desc_num ISOC descriptor number ++ */ ++extern uint32_t dwc_otg_hcd_urb_get_iso_desc_status(dwc_otg_hcd_urb_t * ++ dwc_otg_urb, int desc_num); ++ ++/** Get actual length of ISOC descriptor, specified by desc_num ++ * ++ * @param dwc_otg_urb DWC_OTG URB ++ * @param desc_num ISOC descriptor number ++ */ ++extern uint32_t dwc_otg_hcd_urb_get_iso_desc_actual_length(dwc_otg_hcd_urb_t * ++ dwc_otg_urb, ++ int desc_num); ++ ++/** Queue URB. After transfer is completes, the complete callback will be called with the URB status ++ * ++ * @param dwc_otg_hcd The HCD ++ * @param dwc_otg_urb DWC_OTG URB ++ * @param ep_handle Out parameter for returning endpoint handle ++ * @param atomic_alloc Flag to do atomic allocation if needed ++ * ++ * Returns -DWC_E_NO_DEVICE if no device is connected. ++ * Returns -DWC_E_NO_MEMORY if there is no enough memory. ++ * Returns 0 on success. ++ */ ++extern int dwc_otg_hcd_urb_enqueue(dwc_otg_hcd_t * dwc_otg_hcd, ++ dwc_otg_hcd_urb_t * dwc_otg_urb, ++ void **ep_handle, int atomic_alloc); ++ ++/** De-queue the specified URB ++ * ++ * @param dwc_otg_hcd The HCD ++ * @param dwc_otg_urb DWC_OTG URB ++ */ ++extern int dwc_otg_hcd_urb_dequeue(dwc_otg_hcd_t * dwc_otg_hcd, ++ dwc_otg_hcd_urb_t * dwc_otg_urb); ++ ++/** Frees resources in the DWC_otg controller related to a given endpoint. ++ * Any URBs for the endpoint must already be dequeued. ++ * ++ * @param hcd The HCD ++ * @param ep_handle Endpoint handle, returned by dwc_otg_hcd_urb_enqueue function ++ * @param retry Number of retries if there are queued transfers. ++ * ++ * Returns -DWC_E_INVALID if invalid arguments are passed. ++ * Returns 0 on success ++ */ ++extern int dwc_otg_hcd_endpoint_disable(dwc_otg_hcd_t * hcd, void *ep_handle, ++ int retry); ++ ++/* Resets the data toggle in qh structure. This function can be called from ++ * usb_clear_halt routine. ++ * ++ * @param hcd The HCD ++ * @param ep_handle Endpoint handle, returned by dwc_otg_hcd_urb_enqueue function ++ * ++ * Returns -DWC_E_INVALID if invalid arguments are passed. ++ * Returns 0 on success ++ */ ++extern int dwc_otg_hcd_endpoint_reset(dwc_otg_hcd_t * hcd, void *ep_handle); ++ ++/** Returns 1 if status of specified port is changed and 0 otherwise. ++ * ++ * @param hcd The HCD ++ * @param port Port number ++ */ ++extern int dwc_otg_hcd_is_status_changed(dwc_otg_hcd_t * hcd, int port); ++ ++/** Call this function to check if bandwidth was allocated for specified endpoint. ++ * Only for ISOC and INTERRUPT endpoints. ++ * ++ * @param hcd The HCD ++ * @param ep_handle Endpoint handle ++ */ ++extern int dwc_otg_hcd_is_bandwidth_allocated(dwc_otg_hcd_t * hcd, ++ void *ep_handle); ++ ++/** Call this function to check if bandwidth was freed for specified endpoint. ++ * ++ * @param hcd The HCD ++ * @param ep_handle Endpoint handle ++ */ ++extern int dwc_otg_hcd_is_bandwidth_freed(dwc_otg_hcd_t * hcd, void *ep_handle); ++ ++/** Returns bandwidth allocated for specified endpoint in microseconds. ++ * Only for ISOC and INTERRUPT endpoints. ++ * ++ * @param hcd The HCD ++ * @param ep_handle Endpoint handle ++ */ ++extern uint8_t dwc_otg_hcd_get_ep_bandwidth(dwc_otg_hcd_t * hcd, ++ void *ep_handle); ++ ++/** @} */ ++ ++#endif /* __DWC_HCD_IF_H__ */ ++#endif /* DWC_DEVICE_ONLY */ +diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c b/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c +new file mode 100644 +index 0000000..e6b38ac +--- /dev/null ++++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c +@@ -0,0 +1,2727 @@ ++/* ========================================================================== ++ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_hcd_intr.c $ ++ * $Revision: #89 $ ++ * $Date: 2011/10/20 $ ++ * $Change: 1869487 $ ++ * ++ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, ++ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless ++ * otherwise expressly agreed to in writing between Synopsys and you. ++ * ++ * The Software IS NOT an item of Licensed Software or Licensed Product under ++ * any End User Software License Agreement or Agreement for Licensed Product ++ * with Synopsys or any supplement thereto. You are permitted to use and ++ * redistribute this Software in source and binary forms, with or without ++ * modification, provided that redistributions of source code must retain this ++ * notice. You may not view, use, disclose, copy or distribute this file or ++ * any information contained herein except pursuant to this license grant from ++ * Synopsys. If you do not agree with this notice, including the disclaimer ++ * below, then you are not authorized to use the Software. ++ * ++ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS ++ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS 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. ++ * ========================================================================== */ ++#ifndef DWC_DEVICE_ONLY ++ ++#include "dwc_otg_hcd.h" ++#include "dwc_otg_regs.h" ++ ++#include <linux/jiffies.h> ++#include <asm/fiq.h> ++ ++ ++extern bool microframe_schedule; ++ ++/** @file ++ * This file contains the implementation of the HCD Interrupt handlers. ++ */ ++ ++int fiq_done, int_done; ++ ++#ifdef FIQ_DEBUG ++char buffer[1000*16]; ++int wptr; ++void notrace _fiq_print(FIQDBG_T dbg_lvl, char *fmt, ...) ++{ ++ FIQDBG_T dbg_lvl_req = FIQDBG_PORTHUB; ++ va_list args; ++ char text[17]; ++ hfnum_data_t hfnum = { .d32 = FIQ_READ(dwc_regs_base + 0x408) }; ++ ++ if(dbg_lvl & dbg_lvl_req || dbg_lvl == FIQDBG_ERR) ++ { ++ local_fiq_disable(); ++ snprintf(text, 9, "%4d%d:%d ", hfnum.b.frnum/8, hfnum.b.frnum%8, 8 - hfnum.b.frrem/937); ++ va_start(args, fmt); ++ vsnprintf(text+8, 9, fmt, args); ++ va_end(args); ++ ++ memcpy(buffer + wptr, text, 16); ++ wptr = (wptr + 16) % sizeof(buffer); ++ local_fiq_enable(); ++ } ++} ++#endif ++ ++/** This function handles interrupts for the HCD. */ ++int32_t dwc_otg_hcd_handle_intr(dwc_otg_hcd_t * dwc_otg_hcd) ++{ ++ int retval = 0; ++ static int last_time; ++ dwc_otg_core_if_t *core_if = dwc_otg_hcd->core_if; ++ gintsts_data_t gintsts; ++ gintmsk_data_t gintmsk; ++ hfnum_data_t hfnum; ++ haintmsk_data_t haintmsk; ++ ++#ifdef DEBUG ++ dwc_otg_core_global_regs_t *global_regs = core_if->core_global_regs; ++ ++#endif ++ ++ gintsts.d32 = DWC_READ_REG32(&core_if->core_global_regs->gintsts); ++ gintmsk.d32 = DWC_READ_REG32(&core_if->core_global_regs->gintmsk); ++ ++ /* Exit from ISR if core is hibernated */ ++ if (core_if->hibernation_suspend == 1) { ++ goto exit_handler_routine; ++ } ++ DWC_SPINLOCK(dwc_otg_hcd->lock); ++ /* Check if HOST Mode */ ++ if (dwc_otg_is_host_mode(core_if)) { ++ if (fiq_enable) { ++ local_fiq_disable(); ++ fiq_fsm_spin_lock(&dwc_otg_hcd->fiq_state->lock); ++ /* Pull in from the FIQ's disabled mask */ ++ gintmsk.d32 = gintmsk.d32 | ~(dwc_otg_hcd->fiq_state->gintmsk_saved.d32); ++ dwc_otg_hcd->fiq_state->gintmsk_saved.d32 = ~0; ++ } ++ ++ if (fiq_fsm_enable && ( 0x0000FFFF & ~(dwc_otg_hcd->fiq_state->haintmsk_saved.b2.chint))) { ++ gintsts.b.hcintr = 1; ++ } ++ ++ /* Danger will robinson: fake a SOF if necessary */ ++ if (fiq_fsm_enable && (dwc_otg_hcd->fiq_state->gintmsk_saved.b.sofintr == 1)) { ++ gintsts.b.sofintr = 1; ++ } ++ gintsts.d32 &= gintmsk.d32; ++ ++ if (fiq_enable) { ++ fiq_fsm_spin_unlock(&dwc_otg_hcd->fiq_state->lock); ++ local_fiq_enable(); ++ } ++ ++ if (!gintsts.d32) { ++ goto exit_handler_routine; ++ } ++ ++#ifdef DEBUG ++ // We should be OK doing this because the common interrupts should already have been serviced ++ /* Don't print debug message in the interrupt handler on SOF */ ++#ifndef DEBUG_SOF ++ if (gintsts.d32 != DWC_SOF_INTR_MASK) ++#endif ++ DWC_DEBUGPL(DBG_HCDI, "\n"); ++#endif ++ ++#ifdef DEBUG ++#ifndef DEBUG_SOF ++ if (gintsts.d32 != DWC_SOF_INTR_MASK) ++#endif ++ DWC_DEBUGPL(DBG_HCDI, ++ "DWC OTG HCD Interrupt Detected gintsts&gintmsk=0x%08x core_if=%p\n", ++ gintsts.d32, core_if); ++#endif ++ hfnum.d32 = DWC_READ_REG32(&dwc_otg_hcd->core_if->host_if->host_global_regs->hfnum); ++ if (gintsts.b.sofintr) { ++ retval |= dwc_otg_hcd_handle_sof_intr(dwc_otg_hcd); ++ } ++ ++ if (gintsts.b.rxstsqlvl) { ++ retval |= ++ dwc_otg_hcd_handle_rx_status_q_level_intr ++ (dwc_otg_hcd); ++ } ++ if (gintsts.b.nptxfempty) { ++ retval |= ++ dwc_otg_hcd_handle_np_tx_fifo_empty_intr ++ (dwc_otg_hcd); ++ } ++ if (gintsts.b.i2cintr) { ++ /** @todo Implement i2cintr handler. */ ++ } ++ if (gintsts.b.portintr) { ++ ++ gintmsk_data_t gintmsk = { .b.portintr = 1}; ++ retval |= dwc_otg_hcd_handle_port_intr(dwc_otg_hcd); ++ if (fiq_enable) { ++ local_fiq_disable(); ++ fiq_fsm_spin_lock(&dwc_otg_hcd->fiq_state->lock); ++ DWC_MODIFY_REG32(&dwc_otg_hcd->core_if->core_global_regs->gintmsk, 0, gintmsk.d32); ++ fiq_fsm_spin_unlock(&dwc_otg_hcd->fiq_state->lock); ++ local_fiq_enable(); ++ } else { ++ DWC_MODIFY_REG32(&dwc_otg_hcd->core_if->core_global_regs->gintmsk, 0, gintmsk.d32); ++ } ++ } ++ if (gintsts.b.hcintr) { ++ retval |= dwc_otg_hcd_handle_hc_intr(dwc_otg_hcd); ++ } ++ if (gintsts.b.ptxfempty) { ++ retval |= ++ dwc_otg_hcd_handle_perio_tx_fifo_empty_intr ++ (dwc_otg_hcd); ++ } ++#ifdef DEBUG ++#ifndef DEBUG_SOF ++ if (gintsts.d32 != DWC_SOF_INTR_MASK) ++#endif ++ { ++ DWC_DEBUGPL(DBG_HCDI, ++ "DWC OTG HCD Finished Servicing Interrupts\n"); ++ DWC_DEBUGPL(DBG_HCDV, "DWC OTG HCD gintsts=0x%08x\n", ++ DWC_READ_REG32(&global_regs->gintsts)); ++ DWC_DEBUGPL(DBG_HCDV, "DWC OTG HCD gintmsk=0x%08x\n", ++ DWC_READ_REG32(&global_regs->gintmsk)); ++ } ++#endif ++ ++#ifdef DEBUG ++#ifndef DEBUG_SOF ++ if (gintsts.d32 != DWC_SOF_INTR_MASK) ++#endif ++ DWC_DEBUGPL(DBG_HCDI, "\n"); ++#endif ++ ++ } ++ ++exit_handler_routine: ++ if (fiq_enable) { ++ gintmsk_data_t gintmsk_new; ++ haintmsk_data_t haintmsk_new; ++ local_fiq_disable(); ++ fiq_fsm_spin_lock(&dwc_otg_hcd->fiq_state->lock); ++ gintmsk_new.d32 = *(volatile uint32_t *)&dwc_otg_hcd->fiq_state->gintmsk_saved.d32; ++ if(fiq_fsm_enable) ++ haintmsk_new.d32 = *(volatile uint32_t *)&dwc_otg_hcd->fiq_state->haintmsk_saved.d32; ++ else ++ haintmsk_new.d32 = 0x0000FFFF; ++ ++ /* The FIQ could have sneaked another interrupt in. If so, don't clear MPHI */ ++ if ((gintmsk_new.d32 == ~0) && (haintmsk_new.d32 == 0x0000FFFF)) { ++ DWC_WRITE_REG32(dwc_otg_hcd->fiq_state->mphi_regs.intstat, (1<<16)); ++ if (dwc_otg_hcd->fiq_state->mphi_int_count >= 50) { ++ fiq_print(FIQDBG_INT, dwc_otg_hcd->fiq_state, "MPHI CLR"); ++ DWC_WRITE_REG32(dwc_otg_hcd->fiq_state->mphi_regs.ctrl, ((1<<31) + (1<<16))); ++ while (!(DWC_READ_REG32(dwc_otg_hcd->fiq_state->mphi_regs.ctrl) & (1 << 17))) ++ ; ++ DWC_WRITE_REG32(dwc_otg_hcd->fiq_state->mphi_regs.ctrl, (1<<31)); ++ dwc_otg_hcd->fiq_state->mphi_int_count = 0; ++ } ++ int_done++; ++ } ++ haintmsk.d32 = DWC_READ_REG32(&core_if->host_if->host_global_regs->haintmsk); ++ /* Re-enable interrupts that the FIQ masked (first time round) */ ++ FIQ_WRITE(dwc_otg_hcd->fiq_state->dwc_regs_base + GINTMSK, gintmsk.d32); ++ fiq_fsm_spin_unlock(&dwc_otg_hcd->fiq_state->lock); ++ local_fiq_enable(); ++ ++ if ((jiffies / HZ) > last_time) { ++ //dwc_otg_qh_t *qh; ++ //dwc_list_link_t *cur; ++ /* Once a second output the fiq and irq numbers, useful for debug */ ++ last_time = jiffies / HZ; ++ // DWC_WARN("np_kick=%d AHC=%d sched_frame=%d cur_frame=%d int_done=%d fiq_done=%d", ++ // dwc_otg_hcd->fiq_state->kick_np_queues, dwc_otg_hcd->available_host_channels, ++ // dwc_otg_hcd->fiq_state->next_sched_frame, hfnum.b.frnum, int_done, dwc_otg_hcd->fiq_state->fiq_done); ++ //printk(KERN_WARNING "Periodic queues:\n"); ++ } ++ } ++ ++ DWC_SPINUNLOCK(dwc_otg_hcd->lock); ++ return retval; ++} ++ ++#ifdef DWC_TRACK_MISSED_SOFS ++ ++#warning Compiling code to track missed SOFs ++#define FRAME_NUM_ARRAY_SIZE 1000 ++/** ++ * This function is for debug only. ++ */ ++static inline void track_missed_sofs(uint16_t curr_frame_number) ++{ ++ static uint16_t frame_num_array[FRAME_NUM_ARRAY_SIZE]; ++ static uint16_t last_frame_num_array[FRAME_NUM_ARRAY_SIZE]; ++ static int frame_num_idx = 0; ++ static uint16_t last_frame_num = DWC_HFNUM_MAX_FRNUM; ++ static int dumped_frame_num_array = 0; ++ ++ if (frame_num_idx < FRAME_NUM_ARRAY_SIZE) { ++ if (((last_frame_num + 1) & DWC_HFNUM_MAX_FRNUM) != ++ curr_frame_number) { ++ frame_num_array[frame_num_idx] = curr_frame_number; ++ last_frame_num_array[frame_num_idx++] = last_frame_num; ++ } ++ } else if (!dumped_frame_num_array) { ++ int i; ++ DWC_PRINTF("Frame Last Frame\n"); ++ DWC_PRINTF("----- ----------\n"); ++ for (i = 0; i < FRAME_NUM_ARRAY_SIZE; i++) { ++ DWC_PRINTF("0x%04x 0x%04x\n", ++ frame_num_array[i], last_frame_num_array[i]); ++ } ++ dumped_frame_num_array = 1; ++ } ++ last_frame_num = curr_frame_number; ++} ++#endif ++ ++/** ++ * Handles the start-of-frame interrupt in host mode. Non-periodic ++ * transactions may be queued to the DWC_otg controller for the current ++ * (micro)frame. Periodic transactions may be queued to the controller for the ++ * next (micro)frame. ++ */ ++int32_t dwc_otg_hcd_handle_sof_intr(dwc_otg_hcd_t * hcd) ++{ ++ hfnum_data_t hfnum; ++ gintsts_data_t gintsts = { .d32 = 0 }; ++ dwc_list_link_t *qh_entry; ++ dwc_otg_qh_t *qh; ++ dwc_otg_transaction_type_e tr_type; ++ int did_something = 0; ++ int32_t next_sched_frame = -1; ++ ++ hfnum.d32 = ++ DWC_READ_REG32(&hcd->core_if->host_if->host_global_regs->hfnum); ++ ++#ifdef DEBUG_SOF ++ DWC_DEBUGPL(DBG_HCD, "--Start of Frame Interrupt--\n"); ++#endif ++ hcd->frame_number = hfnum.b.frnum; ++ ++#ifdef DEBUG ++ hcd->frrem_accum += hfnum.b.frrem; ++ hcd->frrem_samples++; ++#endif ++ ++#ifdef DWC_TRACK_MISSED_SOFS ++ track_missed_sofs(hcd->frame_number); ++#endif ++ /* Determine whether any periodic QHs should be executed. */ ++ qh_entry = DWC_LIST_FIRST(&hcd->periodic_sched_inactive); ++ while (qh_entry != &hcd->periodic_sched_inactive) { ++ qh = DWC_LIST_ENTRY(qh_entry, dwc_otg_qh_t, qh_list_entry); ++ qh_entry = qh_entry->next; ++ if (dwc_frame_num_le(qh->sched_frame, hcd->frame_number)) { ++ ++ /* ++ * Move QH to the ready list to be executed next ++ * (micro)frame. ++ */ ++ DWC_LIST_MOVE_HEAD(&hcd->periodic_sched_ready, ++ &qh->qh_list_entry); ++ ++ did_something = 1; ++ } ++ else ++ { ++ if(next_sched_frame < 0 || dwc_frame_num_le(qh->sched_frame, next_sched_frame)) ++ { ++ next_sched_frame = qh->sched_frame; ++ } ++ } ++ } ++ if (fiq_enable) ++ hcd->fiq_state->next_sched_frame = next_sched_frame; ++ ++ tr_type = dwc_otg_hcd_select_transactions(hcd); ++ if (tr_type != DWC_OTG_TRANSACTION_NONE) { ++ dwc_otg_hcd_queue_transactions(hcd, tr_type); ++ did_something = 1; ++ } ++ ++ /* Clear interrupt - but do not trample on the FIQ sof */ ++ if (!fiq_fsm_enable) { ++ gintsts.b.sofintr = 1; ++ DWC_WRITE_REG32(&hcd->core_if->core_global_regs->gintsts, gintsts.d32); ++ } ++ return 1; ++} ++ ++/** Handles the Rx Status Queue Level Interrupt, which indicates that there is at ++ * least one packet in the Rx FIFO. The packets are moved from the FIFO to ++ * memory if the DWC_otg controller is operating in Slave mode. */ ++int32_t dwc_otg_hcd_handle_rx_status_q_level_intr(dwc_otg_hcd_t * dwc_otg_hcd) ++{ ++ host_grxsts_data_t grxsts; ++ dwc_hc_t *hc = NULL; ++ ++ DWC_DEBUGPL(DBG_HCD, "--RxStsQ Level Interrupt--\n"); ++ ++ grxsts.d32 = ++ DWC_READ_REG32(&dwc_otg_hcd->core_if->core_global_regs->grxstsp); ++ ++ hc = dwc_otg_hcd->hc_ptr_array[grxsts.b.chnum]; ++ if (!hc) { ++ DWC_ERROR("Unable to get corresponding channel\n"); ++ return 0; ++ } ++ ++ /* Packet Status */ ++ DWC_DEBUGPL(DBG_HCDV, " Ch num = %d\n", grxsts.b.chnum); ++ DWC_DEBUGPL(DBG_HCDV, " Count = %d\n", grxsts.b.bcnt); ++ DWC_DEBUGPL(DBG_HCDV, " DPID = %d, hc.dpid = %d\n", grxsts.b.dpid, ++ hc->data_pid_start); ++ DWC_DEBUGPL(DBG_HCDV, " PStatus = %d\n", grxsts.b.pktsts); ++ ++ switch (grxsts.b.pktsts) { ++ case DWC_GRXSTS_PKTSTS_IN: ++ /* Read the data into the host buffer. */ ++ if (grxsts.b.bcnt > 0) { ++ dwc_otg_read_packet(dwc_otg_hcd->core_if, ++ hc->xfer_buff, grxsts.b.bcnt); ++ ++ /* Update the HC fields for the next packet received. */ ++ hc->xfer_count += grxsts.b.bcnt; ++ hc->xfer_buff += grxsts.b.bcnt; ++ } ++ ++ case DWC_GRXSTS_PKTSTS_IN_XFER_COMP: ++ case DWC_GRXSTS_PKTSTS_DATA_TOGGLE_ERR: ++ case DWC_GRXSTS_PKTSTS_CH_HALTED: ++ /* Handled in interrupt, just ignore data */ ++ break; ++ default: ++ DWC_ERROR("RX_STS_Q Interrupt: Unknown status %d\n", ++ grxsts.b.pktsts); ++ break; ++ } ++ ++ return 1; ++} ++ ++/** This interrupt occurs when the non-periodic Tx FIFO is half-empty. More ++ * data packets may be written to the FIFO for OUT transfers. More requests ++ * may be written to the non-periodic request queue for IN transfers. This ++ * interrupt is enabled only in Slave mode. */ ++int32_t dwc_otg_hcd_handle_np_tx_fifo_empty_intr(dwc_otg_hcd_t * dwc_otg_hcd) ++{ ++ DWC_DEBUGPL(DBG_HCD, "--Non-Periodic TxFIFO Empty Interrupt--\n"); ++ dwc_otg_hcd_queue_transactions(dwc_otg_hcd, ++ DWC_OTG_TRANSACTION_NON_PERIODIC); ++ return 1; ++} ++ ++/** This interrupt occurs when the periodic Tx FIFO is half-empty. More data ++ * packets may be written to the FIFO for OUT transfers. More requests may be ++ * written to the periodic request queue for IN transfers. This interrupt is ++ * enabled only in Slave mode. */ ++int32_t dwc_otg_hcd_handle_perio_tx_fifo_empty_intr(dwc_otg_hcd_t * dwc_otg_hcd) ++{ ++ DWC_DEBUGPL(DBG_HCD, "--Periodic TxFIFO Empty Interrupt--\n"); ++ dwc_otg_hcd_queue_transactions(dwc_otg_hcd, ++ DWC_OTG_TRANSACTION_PERIODIC); ++ return 1; ++} ++ ++/** There are multiple conditions that can cause a port interrupt. This function ++ * determines which interrupt conditions have occurred and handles them ++ * appropriately. */ ++int32_t dwc_otg_hcd_handle_port_intr(dwc_otg_hcd_t * dwc_otg_hcd) ++{ ++ int retval = 0; ++ hprt0_data_t hprt0; ++ hprt0_data_t hprt0_modify; ++ ++ hprt0.d32 = DWC_READ_REG32(dwc_otg_hcd->core_if->host_if->hprt0); ++ hprt0_modify.d32 = DWC_READ_REG32(dwc_otg_hcd->core_if->host_if->hprt0); ++ ++ /* Clear appropriate bits in HPRT0 to clear the interrupt bit in ++ * GINTSTS */ ++ ++ hprt0_modify.b.prtena = 0; ++ hprt0_modify.b.prtconndet = 0; ++ hprt0_modify.b.prtenchng = 0; ++ hprt0_modify.b.prtovrcurrchng = 0; ++ ++ /* Port Connect Detected ++ * Set flag and clear if detected */ ++ if (dwc_otg_hcd->core_if->hibernation_suspend == 1) { ++ // Dont modify port status if we are in hibernation state ++ hprt0_modify.b.prtconndet = 1; ++ hprt0_modify.b.prtenchng = 1; ++ DWC_WRITE_REG32(dwc_otg_hcd->core_if->host_if->hprt0, hprt0_modify.d32); ++ hprt0.d32 = DWC_READ_REG32(dwc_otg_hcd->core_if->host_if->hprt0); ++ return retval; ++ } ++ ++ if (hprt0.b.prtconndet) { ++ /** @todo - check if steps performed in 'else' block should be perfromed regardles adp */ ++ if (dwc_otg_hcd->core_if->adp_enable && ++ dwc_otg_hcd->core_if->adp.vbuson_timer_started == 1) { ++ DWC_PRINTF("PORT CONNECT DETECTED ----------------\n"); ++ DWC_TIMER_CANCEL(dwc_otg_hcd->core_if->adp.vbuson_timer); ++ dwc_otg_hcd->core_if->adp.vbuson_timer_started = 0; ++ /* TODO - check if this is required, as ++ * host initialization was already performed ++ * after initial ADP probing ++ */ ++ /*dwc_otg_hcd->core_if->adp.vbuson_timer_started = 0; ++ dwc_otg_core_init(dwc_otg_hcd->core_if); ++ dwc_otg_enable_global_interrupts(dwc_otg_hcd->core_if); ++ cil_hcd_start(dwc_otg_hcd->core_if);*/ ++ } else { ++ ++ DWC_DEBUGPL(DBG_HCD, "--Port Interrupt HPRT0=0x%08x " ++ "Port Connect Detected--\n", hprt0.d32); ++ dwc_otg_hcd->flags.b.port_connect_status_change = 1; ++ dwc_otg_hcd->flags.b.port_connect_status = 1; ++ hprt0_modify.b.prtconndet = 1; ++ ++ /* B-Device has connected, Delete the connection timer. */ ++ DWC_TIMER_CANCEL(dwc_otg_hcd->conn_timer); ++ } ++ /* The Hub driver asserts a reset when it sees port connect ++ * status change flag */ ++ retval |= 1; ++ } ++ ++ /* Port Enable Changed ++ * Clear if detected - Set internal flag if disabled */ ++ if (hprt0.b.prtenchng) { ++ DWC_DEBUGPL(DBG_HCD, " --Port Interrupt HPRT0=0x%08x " ++ "Port Enable Changed--\n", hprt0.d32); ++ hprt0_modify.b.prtenchng = 1; ++ if (hprt0.b.prtena == 1) { ++ hfir_data_t hfir; ++ int do_reset = 0; ++ dwc_otg_core_params_t *params = ++ dwc_otg_hcd->core_if->core_params; ++ dwc_otg_core_global_regs_t *global_regs = ++ dwc_otg_hcd->core_if->core_global_regs; ++ dwc_otg_host_if_t *host_if = ++ dwc_otg_hcd->core_if->host_if; ++ ++ /* Every time when port enables calculate ++ * HFIR.FrInterval ++ */ ++ hfir.d32 = DWC_READ_REG32(&host_if->host_global_regs->hfir); ++ hfir.b.frint = calc_frame_interval(dwc_otg_hcd->core_if); ++ DWC_WRITE_REG32(&host_if->host_global_regs->hfir, hfir.d32); ++ ++ /* Check if we need to adjust the PHY clock speed for ++ * low power and adjust it */ ++ if (params->host_support_fs_ls_low_power) { ++ gusbcfg_data_t usbcfg; ++ ++ usbcfg.d32 = ++ DWC_READ_REG32(&global_regs->gusbcfg); ++ ++ if (hprt0.b.prtspd == DWC_HPRT0_PRTSPD_LOW_SPEED ++ || hprt0.b.prtspd == ++ DWC_HPRT0_PRTSPD_FULL_SPEED) { ++ /* ++ * Low power ++ */ ++ hcfg_data_t hcfg; ++ if (usbcfg.b.phylpwrclksel == 0) { ++ /* Set PHY low power clock select for FS/LS devices */ ++ usbcfg.b.phylpwrclksel = 1; ++ DWC_WRITE_REG32 ++ (&global_regs->gusbcfg, ++ usbcfg.d32); ++ do_reset = 1; ++ } ++ ++ hcfg.d32 = ++ DWC_READ_REG32 ++ (&host_if->host_global_regs->hcfg); ++ ++ if (hprt0.b.prtspd == ++ DWC_HPRT0_PRTSPD_LOW_SPEED ++ && params->host_ls_low_power_phy_clk ++ == ++ DWC_HOST_LS_LOW_POWER_PHY_CLK_PARAM_6MHZ) ++ { ++ /* 6 MHZ */ ++ DWC_DEBUGPL(DBG_CIL, ++ "FS_PHY programming HCFG to 6 MHz (Low Power)\n"); ++ if (hcfg.b.fslspclksel != ++ DWC_HCFG_6_MHZ) { ++ hcfg.b.fslspclksel = ++ DWC_HCFG_6_MHZ; ++ DWC_WRITE_REG32 ++ (&host_if->host_global_regs->hcfg, ++ hcfg.d32); ++ do_reset = 1; ++ } ++ } else { ++ /* 48 MHZ */ ++ DWC_DEBUGPL(DBG_CIL, ++ "FS_PHY programming HCFG to 48 MHz ()\n"); ++ if (hcfg.b.fslspclksel != ++ DWC_HCFG_48_MHZ) { ++ hcfg.b.fslspclksel = ++ DWC_HCFG_48_MHZ; ++ DWC_WRITE_REG32 ++ (&host_if->host_global_regs->hcfg, ++ hcfg.d32); ++ do_reset = 1; ++ } ++ } ++ } else { ++ /* ++ * Not low power ++ */ ++ if (usbcfg.b.phylpwrclksel == 1) { ++ usbcfg.b.phylpwrclksel = 0; ++ DWC_WRITE_REG32 ++ (&global_regs->gusbcfg, ++ usbcfg.d32); ++ do_reset = 1; ++ } ++ } ++ ++ if (do_reset) { ++ DWC_TASK_SCHEDULE(dwc_otg_hcd->reset_tasklet); ++ } ++ } ++ ++ if (!do_reset) { ++ /* Port has been enabled set the reset change flag */ ++ dwc_otg_hcd->flags.b.port_reset_change = 1; ++ } ++ } else { ++ dwc_otg_hcd->flags.b.port_enable_change = 1; ++ } ++ retval |= 1; ++ } ++ ++ /** Overcurrent Change Interrupt */ ++ if (hprt0.b.prtovrcurrchng) { ++ DWC_DEBUGPL(DBG_HCD, " --Port Interrupt HPRT0=0x%08x " ++ "Port Overcurrent Changed--\n", hprt0.d32); ++ dwc_otg_hcd->flags.b.port_over_current_change = 1; ++ hprt0_modify.b.prtovrcurrchng = 1; ++ retval |= 1; ++ } ++ ++ /* Clear Port Interrupts */ ++ DWC_WRITE_REG32(dwc_otg_hcd->core_if->host_if->hprt0, hprt0_modify.d32); ++ ++ return retval; ++} ++ ++/** This interrupt indicates that one or more host channels has a pending ++ * interrupt. There are multiple conditions that can cause each host channel ++ * interrupt. This function determines which conditions have occurred for each ++ * host channel interrupt and handles them appropriately. */ ++int32_t dwc_otg_hcd_handle_hc_intr(dwc_otg_hcd_t * dwc_otg_hcd) ++{ ++ int i; ++ int retval = 0; ++ haint_data_t haint = { .d32 = 0 } ; ++ ++ /* Clear appropriate bits in HCINTn to clear the interrupt bit in ++ * GINTSTS */ ++ ++ if (!fiq_fsm_enable) ++ haint.d32 = dwc_otg_read_host_all_channels_intr(dwc_otg_hcd->core_if); ++ ++ // Overwrite with saved interrupts from fiq handler ++ if(fiq_fsm_enable) ++ { ++ /* check the mask? */ ++ local_fiq_disable(); ++ fiq_fsm_spin_lock(&dwc_otg_hcd->fiq_state->lock); ++ haint.b2.chint |= ~(dwc_otg_hcd->fiq_state->haintmsk_saved.b2.chint); ++ dwc_otg_hcd->fiq_state->haintmsk_saved.b2.chint = ~0; ++ fiq_fsm_spin_unlock(&dwc_otg_hcd->fiq_state->lock); ++ local_fiq_enable(); ++ } ++ ++ for (i = 0; i < dwc_otg_hcd->core_if->core_params->host_channels; i++) { ++ if (haint.b2.chint & (1 << i)) { ++ retval |= dwc_otg_hcd_handle_hc_n_intr(dwc_otg_hcd, i); ++ } ++ } ++ ++ return retval; ++} ++ ++/** ++ * Gets the actual length of a transfer after the transfer halts. _halt_status ++ * holds the reason for the halt. ++ * ++ * For IN transfers where halt_status is DWC_OTG_HC_XFER_COMPLETE, ++ * *short_read is set to 1 upon return if less than the requested ++ * number of bytes were transferred. Otherwise, *short_read is set to 0 upon ++ * return. short_read may also be NULL on entry, in which case it remains ++ * unchanged. ++ */ ++static uint32_t get_actual_xfer_length(dwc_hc_t * hc, ++ dwc_otg_hc_regs_t * hc_regs, ++ dwc_otg_qtd_t * qtd, ++ dwc_otg_halt_status_e halt_status, ++ int *short_read) ++{ ++ hctsiz_data_t hctsiz; ++ uint32_t length; ++ ++ if (short_read != NULL) { ++ *short_read = 0; ++ } ++ hctsiz.d32 = DWC_READ_REG32(&hc_regs->hctsiz); ++ ++ if (halt_status == DWC_OTG_HC_XFER_COMPLETE) { ++ if (hc->ep_is_in) { ++ length = hc->xfer_len - hctsiz.b.xfersize; ++ if (short_read != NULL) { ++ *short_read = (hctsiz.b.xfersize != 0); ++ } ++ } else if (hc->qh->do_split) { ++ //length = split_out_xfersize[hc->hc_num]; ++ length = qtd->ssplit_out_xfer_count; ++ } else { ++ length = hc->xfer_len; ++ } ++ } else { ++ /* ++ * Must use the hctsiz.pktcnt field to determine how much data ++ * has been transferred. This field reflects the number of ++ * packets that have been transferred via the USB. This is ++ * always an integral number of packets if the transfer was ++ * halted before its normal completion. (Can't use the ++ * hctsiz.xfersize field because that reflects the number of ++ * bytes transferred via the AHB, not the USB). ++ */ ++ length = ++ (hc->start_pkt_count - hctsiz.b.pktcnt) * hc->max_packet; ++ } ++ ++ return length; ++} ++ ++/** ++ * Updates the state of the URB after a Transfer Complete interrupt on the ++ * host channel. Updates the actual_length field of the URB based on the ++ * number of bytes transferred via the host channel. Sets the URB status ++ * if the data transfer is finished. ++ * ++ * @return 1 if the data transfer specified by the URB is completely finished, ++ * 0 otherwise. ++ */ ++static int update_urb_state_xfer_comp(dwc_hc_t * hc, ++ dwc_otg_hc_regs_t * hc_regs, ++ dwc_otg_hcd_urb_t * urb, ++ dwc_otg_qtd_t * qtd) ++{ ++ int xfer_done = 0; ++ int short_read = 0; ++ ++ int xfer_length; ++ ++ xfer_length = get_actual_xfer_length(hc, hc_regs, qtd, ++ DWC_OTG_HC_XFER_COMPLETE, ++ &short_read); ++ ++ if (urb->actual_length + xfer_length > urb->length) { ++ printk_once(KERN_DEBUG "dwc_otg: DEVICE:%03d : %s:%d:trimming xfer length\n", ++ hc->dev_addr, __func__, __LINE__); ++ xfer_length = urb->length - urb->actual_length; ++ } ++ ++ /* non DWORD-aligned buffer case handling. */ ++ if (hc->align_buff && xfer_length && hc->ep_is_in) { ++ dwc_memcpy(urb->buf + urb->actual_length, hc->qh->dw_align_buf, ++ xfer_length); ++ } ++ ++ urb->actual_length += xfer_length; ++ ++ if (xfer_length && (hc->ep_type == DWC_OTG_EP_TYPE_BULK) && ++ (urb->flags & URB_SEND_ZERO_PACKET) ++ && (urb->actual_length == urb->length) ++ && !(urb->length % hc->max_packet)) { ++ xfer_done = 0; ++ } else if (short_read || urb->actual_length >= urb->length) { ++ xfer_done = 1; ++ urb->status = 0; ++ } ++ ++#ifdef DEBUG ++ { ++ hctsiz_data_t hctsiz; ++ hctsiz.d32 = DWC_READ_REG32(&hc_regs->hctsiz); ++ DWC_DEBUGPL(DBG_HCDV, "DWC_otg: %s: %s, channel %d\n", ++ __func__, (hc->ep_is_in ? "IN" : "OUT"), ++ hc->hc_num); ++ DWC_DEBUGPL(DBG_HCDV, " hc->xfer_len %d\n", hc->xfer_len); ++ DWC_DEBUGPL(DBG_HCDV, " hctsiz.xfersize %d\n", ++ hctsiz.b.xfersize); ++ DWC_DEBUGPL(DBG_HCDV, " urb->transfer_buffer_length %d\n", ++ urb->length); ++ DWC_DEBUGPL(DBG_HCDV, " urb->actual_length %d\n", ++ urb->actual_length); ++ DWC_DEBUGPL(DBG_HCDV, " short_read %d, xfer_done %d\n", ++ short_read, xfer_done); ++ } ++#endif ++ ++ return xfer_done; ++} ++ ++/* ++ * Save the starting data toggle for the next transfer. The data toggle is ++ * saved in the QH for non-control transfers and it's saved in the QTD for ++ * control transfers. ++ */ ++void dwc_otg_hcd_save_data_toggle(dwc_hc_t * hc, ++ dwc_otg_hc_regs_t * hc_regs, dwc_otg_qtd_t * qtd) ++{ ++ hctsiz_data_t hctsiz; ++ hctsiz.d32 = DWC_READ_REG32(&hc_regs->hctsiz); ++ ++ if (hc->ep_type != DWC_OTG_EP_TYPE_CONTROL) { ++ dwc_otg_qh_t *qh = hc->qh; ++ if (hctsiz.b.pid == DWC_HCTSIZ_DATA0) { ++ qh->data_toggle = DWC_OTG_HC_PID_DATA0; ++ } else { ++ qh->data_toggle = DWC_OTG_HC_PID_DATA1; ++ } ++ } else { ++ if (hctsiz.b.pid == DWC_HCTSIZ_DATA0) { ++ qtd->data_toggle = DWC_OTG_HC_PID_DATA0; ++ } else { ++ qtd->data_toggle = DWC_OTG_HC_PID_DATA1; ++ } ++ } ++} ++ ++/** ++ * Updates the state of an Isochronous URB when the transfer is stopped for ++ * any reason. The fields of the current entry in the frame descriptor array ++ * are set based on the transfer state and the input _halt_status. Completes ++ * the Isochronous URB if all the URB frames have been completed. ++ * ++ * @return DWC_OTG_HC_XFER_COMPLETE if there are more frames remaining to be ++ * transferred in the URB. Otherwise return DWC_OTG_HC_XFER_URB_COMPLETE. ++ */ ++static dwc_otg_halt_status_e ++update_isoc_urb_state(dwc_otg_hcd_t * hcd, ++ dwc_hc_t * hc, ++ dwc_otg_hc_regs_t * hc_regs, ++ dwc_otg_qtd_t * qtd, dwc_otg_halt_status_e halt_status) ++{ ++ dwc_otg_hcd_urb_t *urb = qtd->urb; ++ dwc_otg_halt_status_e ret_val = halt_status; ++ struct dwc_otg_hcd_iso_packet_desc *frame_desc; ++ ++ frame_desc = &urb->iso_descs[qtd->isoc_frame_index]; ++ switch (halt_status) { ++ case DWC_OTG_HC_XFER_COMPLETE: ++ frame_desc->status = 0; ++ frame_desc->actual_length = ++ get_actual_xfer_length(hc, hc_regs, qtd, halt_status, NULL); ++ ++ /* non DWORD-aligned buffer case handling. */ ++ if (hc->align_buff && frame_desc->actual_length && hc->ep_is_in) { ++ dwc_memcpy(urb->buf + frame_desc->offset + qtd->isoc_split_offset, ++ hc->qh->dw_align_buf, frame_desc->actual_length); ++ } ++ ++ break; ++ case DWC_OTG_HC_XFER_FRAME_OVERRUN: ++ urb->error_count++; ++ if (hc->ep_is_in) { ++ frame_desc->status = -DWC_E_NO_STREAM_RES; ++ } else { ++ frame_desc->status = -DWC_E_COMMUNICATION; ++ } ++ frame_desc->actual_length = 0; ++ break; ++ case DWC_OTG_HC_XFER_BABBLE_ERR: ++ urb->error_count++; ++ frame_desc->status = -DWC_E_OVERFLOW; ++ /* Don't need to update actual_length in this case. */ ++ break; ++ case DWC_OTG_HC_XFER_XACT_ERR: ++ urb->error_count++; ++ frame_desc->status = -DWC_E_PROTOCOL; ++ frame_desc->actual_length = ++ get_actual_xfer_length(hc, hc_regs, qtd, halt_status, NULL); ++ ++ /* non DWORD-aligned buffer case handling. */ ++ if (hc->align_buff && frame_desc->actual_length && hc->ep_is_in) { ++ dwc_memcpy(urb->buf + frame_desc->offset + qtd->isoc_split_offset, ++ hc->qh->dw_align_buf, frame_desc->actual_length); ++ } ++ /* Skip whole frame */ ++ if (hc->qh->do_split && (hc->ep_type == DWC_OTG_EP_TYPE_ISOC) && ++ hc->ep_is_in && hcd->core_if->dma_enable) { ++ qtd->complete_split = 0; ++ qtd->isoc_split_offset = 0; ++ } ++ ++ break; ++ default: ++ DWC_ASSERT(1, "Unhandled _halt_status (%d)\n", halt_status); ++ break; ++ } ++ if (++qtd->isoc_frame_index == urb->packet_count) { ++ /* ++ * urb->status is not used for isoc transfers. ++ * The individual frame_desc statuses are used instead. ++ */ ++ hcd->fops->complete(hcd, urb->priv, urb, 0); ++ ret_val = DWC_OTG_HC_XFER_URB_COMPLETE; ++ } else { ++ ret_val = DWC_OTG_HC_XFER_COMPLETE; ++ } ++ return ret_val; ++} ++ ++/** ++ * Frees the first QTD in the QH's list if free_qtd is 1. For non-periodic ++ * QHs, removes the QH from the active non-periodic schedule. If any QTDs are ++ * still linked to the QH, the QH is added to the end of the inactive ++ * non-periodic schedule. For periodic QHs, removes the QH from the periodic ++ * schedule if no more QTDs are linked to the QH. ++ */ ++static void deactivate_qh(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh, int free_qtd) ++{ ++ int continue_split = 0; ++ dwc_otg_qtd_t *qtd; ++ ++ DWC_DEBUGPL(DBG_HCDV, " %s(%p,%p,%d)\n", __func__, hcd, qh, free_qtd); ++ ++ qtd = DWC_CIRCLEQ_FIRST(&qh->qtd_list); ++ ++ if (qtd->complete_split) { ++ continue_split = 1; ++ } else if (qtd->isoc_split_pos == DWC_HCSPLIT_XACTPOS_MID || ++ qtd->isoc_split_pos == DWC_HCSPLIT_XACTPOS_END) { ++ continue_split = 1; ++ } ++ ++ if (free_qtd) { ++ dwc_otg_hcd_qtd_remove_and_free(hcd, qtd, qh); ++ continue_split = 0; ++ } ++ ++ qh->channel = NULL; ++ dwc_otg_hcd_qh_deactivate(hcd, qh, continue_split); ++} ++ ++/** ++ * Releases a host channel for use by other transfers. Attempts to select and ++ * queue more transactions since at least one host channel is available. ++ * ++ * @param hcd The HCD state structure. ++ * @param hc The host channel to release. ++ * @param qtd The QTD associated with the host channel. This QTD may be freed ++ * if the transfer is complete or an error has occurred. ++ * @param halt_status Reason the channel is being released. This status ++ * determines the actions taken by this function. ++ */ ++static void release_channel(dwc_otg_hcd_t * hcd, ++ dwc_hc_t * hc, ++ dwc_otg_qtd_t * qtd, ++ dwc_otg_halt_status_e halt_status) ++{ ++ dwc_otg_transaction_type_e tr_type; ++ int free_qtd; ++ dwc_irqflags_t flags; ++ dwc_spinlock_t *channel_lock = hcd->channel_lock; ++ ++ int hog_port = 0; ++ ++ DWC_DEBUGPL(DBG_HCDV, " %s: channel %d, halt_status %d, xfer_len %d\n", ++ __func__, hc->hc_num, halt_status, hc->xfer_len); ++ ++ if(fiq_fsm_enable && hc->do_split) { ++ if(!hc->ep_is_in && hc->ep_type == UE_ISOCHRONOUS) { ++ if(hc->xact_pos == DWC_HCSPLIT_XACTPOS_MID || ++ hc->xact_pos == DWC_HCSPLIT_XACTPOS_BEGIN) { ++ hog_port = 0; ++ } ++ } ++ } ++ ++ switch (halt_status) { ++ case DWC_OTG_HC_XFER_URB_COMPLETE: ++ free_qtd = 1; ++ break; ++ case DWC_OTG_HC_XFER_AHB_ERR: ++ case DWC_OTG_HC_XFER_STALL: ++ case DWC_OTG_HC_XFER_BABBLE_ERR: ++ free_qtd = 1; ++ break; ++ case DWC_OTG_HC_XFER_XACT_ERR: ++ if (qtd->error_count >= 3) { ++ DWC_DEBUGPL(DBG_HCDV, ++ " Complete URB with transaction error\n"); ++ free_qtd = 1; ++ qtd->urb->status = -DWC_E_PROTOCOL; ++ hcd->fops->complete(hcd, qtd->urb->priv, ++ qtd->urb, -DWC_E_PROTOCOL); ++ } else { ++ free_qtd = 0; ++ } ++ break; ++ case DWC_OTG_HC_XFER_URB_DEQUEUE: ++ /* ++ * The QTD has already been removed and the QH has been ++ * deactivated. Don't want to do anything except release the ++ * host channel and try to queue more transfers. ++ */ ++ goto cleanup; ++ case DWC_OTG_HC_XFER_NO_HALT_STATUS: ++ free_qtd = 0; ++ break; ++ case DWC_OTG_HC_XFER_PERIODIC_INCOMPLETE: ++ DWC_DEBUGPL(DBG_HCDV, ++ " Complete URB with I/O error\n"); ++ free_qtd = 1; ++ qtd->urb->status = -DWC_E_IO; ++ hcd->fops->complete(hcd, qtd->urb->priv, ++ qtd->urb, -DWC_E_IO); ++ break; ++ default: ++ free_qtd = 0; ++ break; ++ } ++ ++ deactivate_qh(hcd, hc->qh, free_qtd); ++ ++cleanup: ++ /* ++ * Release the host channel for use by other transfers. The cleanup ++ * function clears the channel interrupt enables and conditions, so ++ * there's no need to clear the Channel Halted interrupt separately. ++ */ ++ if (fiq_fsm_enable && hcd->fiq_state->channel[hc->hc_num].fsm != FIQ_PASSTHROUGH) ++ dwc_otg_cleanup_fiq_channel(hcd, hc->hc_num); ++ dwc_otg_hc_cleanup(hcd->core_if, hc); ++ DWC_CIRCLEQ_INSERT_TAIL(&hcd->free_hc_list, hc, hc_list_entry); ++ ++ if (!microframe_schedule) { ++ switch (hc->ep_type) { ++ case DWC_OTG_EP_TYPE_CONTROL: ++ case DWC_OTG_EP_TYPE_BULK: ++ hcd->non_periodic_channels--; ++ break; ++ ++ default: ++ /* ++ * Don't release reservations for periodic channels here. ++ * That's done when a periodic transfer is descheduled (i.e. ++ * when the QH is removed from the periodic schedule). ++ */ ++ break; ++ } ++ } else { ++ ++ DWC_SPINLOCK_IRQSAVE(channel_lock, &flags); ++ hcd->available_host_channels++; ++ fiq_print(FIQDBG_INT, hcd->fiq_state, "AHC = %d ", hcd->available_host_channels); ++ DWC_SPINUNLOCK_IRQRESTORE(channel_lock, flags); ++ } ++ ++ /* Try to queue more transfers now that there's a free channel. */ ++ tr_type = dwc_otg_hcd_select_transactions(hcd); ++ if (tr_type != DWC_OTG_TRANSACTION_NONE) { ++ dwc_otg_hcd_queue_transactions(hcd, tr_type); ++ } ++} ++ ++/** ++ * Halts a host channel. If the channel cannot be halted immediately because ++ * the request queue is full, this function ensures that the FIFO empty ++ * interrupt for the appropriate queue is enabled so that the halt request can ++ * be queued when there is space in the request queue. ++ * ++ * This function may also be called in DMA mode. In that case, the channel is ++ * simply released since the core always halts the channel automatically in ++ * DMA mode. ++ */ ++static void halt_channel(dwc_otg_hcd_t * hcd, ++ dwc_hc_t * hc, ++ dwc_otg_qtd_t * qtd, dwc_otg_halt_status_e halt_status) ++{ ++ if (hcd->core_if->dma_enable) { ++ release_channel(hcd, hc, qtd, halt_status); ++ return; ++ } ++ ++ /* Slave mode processing... */ ++ dwc_otg_hc_halt(hcd->core_if, hc, halt_status); ++ ++ if (hc->halt_on_queue) { ++ gintmsk_data_t gintmsk = {.d32 = 0 }; ++ dwc_otg_core_global_regs_t *global_regs; ++ global_regs = hcd->core_if->core_global_regs; ++ ++ if (hc->ep_type == DWC_OTG_EP_TYPE_CONTROL || ++ hc->ep_type == DWC_OTG_EP_TYPE_BULK) { ++ /* ++ * Make sure the Non-periodic Tx FIFO empty interrupt ++ * is enabled so that the non-periodic schedule will ++ * be processed. ++ */ ++ gintmsk.b.nptxfempty = 1; ++ if (fiq_enable) { ++ local_fiq_disable(); ++ fiq_fsm_spin_lock(&hcd->fiq_state->lock); ++ DWC_MODIFY_REG32(&global_regs->gintmsk, 0, gintmsk.d32); ++ fiq_fsm_spin_unlock(&hcd->fiq_state->lock); ++ local_fiq_enable(); ++ } else { ++ DWC_MODIFY_REG32(&global_regs->gintmsk, 0, gintmsk.d32); ++ } ++ } else { ++ /* ++ * Move the QH from the periodic queued schedule to ++ * the periodic assigned schedule. This allows the ++ * halt to be queued when the periodic schedule is ++ * processed. ++ */ ++ DWC_LIST_MOVE_HEAD(&hcd->periodic_sched_assigned, ++ &hc->qh->qh_list_entry); ++ ++ /* ++ * Make sure the Periodic Tx FIFO Empty interrupt is ++ * enabled so that the periodic schedule will be ++ * processed. ++ */ ++ gintmsk.b.ptxfempty = 1; ++ if (fiq_enable) { ++ local_fiq_disable(); ++ fiq_fsm_spin_lock(&hcd->fiq_state->lock); ++ DWC_MODIFY_REG32(&global_regs->gintmsk, 0, gintmsk.d32); ++ fiq_fsm_spin_unlock(&hcd->fiq_state->lock); ++ local_fiq_enable(); ++ } else { ++ DWC_MODIFY_REG32(&global_regs->gintmsk, 0, gintmsk.d32); ++ } ++ } ++ } ++} ++ ++/** ++ * Performs common cleanup for non-periodic transfers after a Transfer ++ * Complete interrupt. This function should be called after any endpoint type ++ * specific handling is finished to release the host channel. ++ */ ++static void complete_non_periodic_xfer(dwc_otg_hcd_t * hcd, ++ dwc_hc_t * hc, ++ dwc_otg_hc_regs_t * hc_regs, ++ dwc_otg_qtd_t * qtd, ++ dwc_otg_halt_status_e halt_status) ++{ ++ hcint_data_t hcint; ++ ++ qtd->error_count = 0; ++ ++ hcint.d32 = DWC_READ_REG32(&hc_regs->hcint); ++ if (hcint.b.nyet) { ++ /* ++ * Got a NYET on the last transaction of the transfer. This ++ * means that the endpoint should be in the PING state at the ++ * beginning of the next transfer. ++ */ ++ hc->qh->ping_state = 1; ++ clear_hc_int(hc_regs, nyet); ++ } ++ ++ /* ++ * Always halt and release the host channel to make it available for ++ * more transfers. There may still be more phases for a control ++ * transfer or more data packets for a bulk transfer at this point, ++ * but the host channel is still halted. A channel will be reassigned ++ * to the transfer when the non-periodic schedule is processed after ++ * the channel is released. This allows transactions to be queued ++ * properly via dwc_otg_hcd_queue_transactions, which also enables the ++ * Tx FIFO Empty interrupt if necessary. ++ */ ++ if (hc->ep_is_in) { ++ /* ++ * IN transfers in Slave mode require an explicit disable to ++ * halt the channel. (In DMA mode, this call simply releases ++ * the channel.) ++ */ ++ halt_channel(hcd, hc, qtd, halt_status); ++ } else { ++ /* ++ * The channel is automatically disabled by the core for OUT ++ * transfers in Slave mode. ++ */ ++ release_channel(hcd, hc, qtd, halt_status); ++ } ++} ++ ++/** ++ * Performs common cleanup for periodic transfers after a Transfer Complete ++ * interrupt. This function should be called after any endpoint type specific ++ * handling is finished to release the host channel. ++ */ ++static void complete_periodic_xfer(dwc_otg_hcd_t * hcd, ++ dwc_hc_t * hc, ++ dwc_otg_hc_regs_t * hc_regs, ++ dwc_otg_qtd_t * qtd, ++ dwc_otg_halt_status_e halt_status) ++{ ++ hctsiz_data_t hctsiz; ++ qtd->error_count = 0; ++ ++ hctsiz.d32 = DWC_READ_REG32(&hc_regs->hctsiz); ++ if (!hc->ep_is_in || hctsiz.b.pktcnt == 0) { ++ /* Core halts channel in these cases. */ ++ release_channel(hcd, hc, qtd, halt_status); ++ } else { ++ /* Flush any outstanding requests from the Tx queue. */ ++ halt_channel(hcd, hc, qtd, halt_status); ++ } ++} ++ ++static int32_t handle_xfercomp_isoc_split_in(dwc_otg_hcd_t * hcd, ++ dwc_hc_t * hc, ++ dwc_otg_hc_regs_t * hc_regs, ++ dwc_otg_qtd_t * qtd) ++{ ++ uint32_t len; ++ struct dwc_otg_hcd_iso_packet_desc *frame_desc; ++ frame_desc = &qtd->urb->iso_descs[qtd->isoc_frame_index]; ++ ++ len = get_actual_xfer_length(hc, hc_regs, qtd, ++ DWC_OTG_HC_XFER_COMPLETE, NULL); ++ ++ if (!len) { ++ qtd->complete_split = 0; ++ qtd->isoc_split_offset = 0; ++ return 0; ++ } ++ frame_desc->actual_length += len; ++ ++ if (hc->align_buff && len) ++ dwc_memcpy(qtd->urb->buf + frame_desc->offset + ++ qtd->isoc_split_offset, hc->qh->dw_align_buf, len); ++ qtd->isoc_split_offset += len; ++ ++ if (frame_desc->length == frame_desc->actual_length) { ++ frame_desc->status = 0; ++ qtd->isoc_frame_index++; ++ qtd->complete_split = 0; ++ qtd->isoc_split_offset = 0; ++ } ++ ++ if (qtd->isoc_frame_index == qtd->urb->packet_count) { ++ hcd->fops->complete(hcd, qtd->urb->priv, qtd->urb, 0); ++ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_URB_COMPLETE); ++ } else { ++ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_NO_HALT_STATUS); ++ } ++ ++ return 1; /* Indicates that channel released */ ++} ++ ++/** ++ * Handles a host channel Transfer Complete interrupt. This handler may be ++ * called in either DMA mode or Slave mode. ++ */ ++static int32_t handle_hc_xfercomp_intr(dwc_otg_hcd_t * hcd, ++ dwc_hc_t * hc, ++ dwc_otg_hc_regs_t * hc_regs, ++ dwc_otg_qtd_t * qtd) ++{ ++ int urb_xfer_done; ++ dwc_otg_halt_status_e halt_status = DWC_OTG_HC_XFER_COMPLETE; ++ dwc_otg_hcd_urb_t *urb = qtd->urb; ++ int pipe_type = dwc_otg_hcd_get_pipe_type(&urb->pipe_info); ++ ++ DWC_DEBUGPL(DBG_HCDI, "--Host Channel %d Interrupt: " ++ "Transfer Complete--\n", hc->hc_num); ++ ++ if (hcd->core_if->dma_desc_enable) { ++ dwc_otg_hcd_complete_xfer_ddma(hcd, hc, hc_regs, halt_status); ++ if (pipe_type == UE_ISOCHRONOUS) { ++ /* Do not disable the interrupt, just clear it */ ++ clear_hc_int(hc_regs, xfercomp); ++ return 1; ++ } ++ goto handle_xfercomp_done; ++ } ++ ++ /* ++ * Handle xfer complete on CSPLIT. ++ */ ++ ++ if (hc->qh->do_split) { ++ if ((hc->ep_type == DWC_OTG_EP_TYPE_ISOC) && hc->ep_is_in ++ && hcd->core_if->dma_enable) { ++ if (qtd->complete_split ++ && handle_xfercomp_isoc_split_in(hcd, hc, hc_regs, ++ qtd)) ++ goto handle_xfercomp_done; ++ } else { ++ qtd->complete_split = 0; ++ } ++ } ++ ++ /* Update the QTD and URB states. */ ++ switch (pipe_type) { ++ case UE_CONTROL: ++ switch (qtd->control_phase) { ++ case DWC_OTG_CONTROL_SETUP: ++ if (urb->length > 0) { ++ qtd->control_phase = DWC_OTG_CONTROL_DATA; ++ } else { ++ qtd->control_phase = DWC_OTG_CONTROL_STATUS; ++ } ++ DWC_DEBUGPL(DBG_HCDV, ++ " Control setup transaction done\n"); ++ halt_status = DWC_OTG_HC_XFER_COMPLETE; ++ break; ++ case DWC_OTG_CONTROL_DATA:{ ++ urb_xfer_done = ++ update_urb_state_xfer_comp(hc, hc_regs, urb, ++ qtd); ++ if (urb_xfer_done) { ++ qtd->control_phase = ++ DWC_OTG_CONTROL_STATUS; ++ DWC_DEBUGPL(DBG_HCDV, ++ " Control data transfer done\n"); ++ } else { ++ dwc_otg_hcd_save_data_toggle(hc, hc_regs, qtd); ++ } ++ halt_status = DWC_OTG_HC_XFER_COMPLETE; ++ break; ++ } ++ case DWC_OTG_CONTROL_STATUS: ++ DWC_DEBUGPL(DBG_HCDV, " Control transfer complete\n"); ++ if (urb->status == -DWC_E_IN_PROGRESS) { ++ urb->status = 0; ++ } ++ hcd->fops->complete(hcd, urb->priv, urb, urb->status); ++ halt_status = DWC_OTG_HC_XFER_URB_COMPLETE; ++ break; ++ } ++ ++ complete_non_periodic_xfer(hcd, hc, hc_regs, qtd, halt_status); ++ break; ++ case UE_BULK: ++ DWC_DEBUGPL(DBG_HCDV, " Bulk transfer complete\n"); ++ urb_xfer_done = ++ update_urb_state_xfer_comp(hc, hc_regs, urb, qtd); ++ if (urb_xfer_done) { ++ hcd->fops->complete(hcd, urb->priv, urb, urb->status); ++ halt_status = DWC_OTG_HC_XFER_URB_COMPLETE; ++ } else { ++ halt_status = DWC_OTG_HC_XFER_COMPLETE; ++ } ++ ++ dwc_otg_hcd_save_data_toggle(hc, hc_regs, qtd); ++ complete_non_periodic_xfer(hcd, hc, hc_regs, qtd, halt_status); ++ break; ++ case UE_INTERRUPT: ++ DWC_DEBUGPL(DBG_HCDV, " Interrupt transfer complete\n"); ++ urb_xfer_done = ++ update_urb_state_xfer_comp(hc, hc_regs, urb, qtd); ++ ++ /* ++ * Interrupt URB is done on the first transfer complete ++ * interrupt. ++ */ ++ if (urb_xfer_done) { ++ hcd->fops->complete(hcd, urb->priv, urb, urb->status); ++ halt_status = DWC_OTG_HC_XFER_URB_COMPLETE; ++ } else { ++ halt_status = DWC_OTG_HC_XFER_COMPLETE; ++ } ++ ++ dwc_otg_hcd_save_data_toggle(hc, hc_regs, qtd); ++ complete_periodic_xfer(hcd, hc, hc_regs, qtd, halt_status); ++ break; ++ case UE_ISOCHRONOUS: ++ DWC_DEBUGPL(DBG_HCDV, " Isochronous transfer complete\n"); ++ if (qtd->isoc_split_pos == DWC_HCSPLIT_XACTPOS_ALL) { ++ halt_status = ++ update_isoc_urb_state(hcd, hc, hc_regs, qtd, ++ DWC_OTG_HC_XFER_COMPLETE); ++ } ++ complete_periodic_xfer(hcd, hc, hc_regs, qtd, halt_status); ++ break; ++ } ++ ++handle_xfercomp_done: ++ disable_hc_int(hc_regs, xfercompl); ++ ++ return 1; ++} ++ ++/** ++ * Handles a host channel STALL interrupt. This handler may be called in ++ * either DMA mode or Slave mode. ++ */ ++static int32_t handle_hc_stall_intr(dwc_otg_hcd_t * hcd, ++ dwc_hc_t * hc, ++ dwc_otg_hc_regs_t * hc_regs, ++ dwc_otg_qtd_t * qtd) ++{ ++ dwc_otg_hcd_urb_t *urb = qtd->urb; ++ int pipe_type = dwc_otg_hcd_get_pipe_type(&urb->pipe_info); ++ ++ DWC_DEBUGPL(DBG_HCD, "--Host Channel %d Interrupt: " ++ "STALL Received--\n", hc->hc_num); ++ ++ if (hcd->core_if->dma_desc_enable) { ++ dwc_otg_hcd_complete_xfer_ddma(hcd, hc, hc_regs, DWC_OTG_HC_XFER_STALL); ++ goto handle_stall_done; ++ } ++ ++ if (pipe_type == UE_CONTROL) { ++ hcd->fops->complete(hcd, urb->priv, urb, -DWC_E_PIPE); ++ } ++ ++ if (pipe_type == UE_BULK || pipe_type == UE_INTERRUPT) { ++ hcd->fops->complete(hcd, urb->priv, urb, -DWC_E_PIPE); ++ /* ++ * USB protocol requires resetting the data toggle for bulk ++ * and interrupt endpoints when a CLEAR_FEATURE(ENDPOINT_HALT) ++ * setup command is issued to the endpoint. Anticipate the ++ * CLEAR_FEATURE command since a STALL has occurred and reset ++ * the data toggle now. ++ */ ++ hc->qh->data_toggle = 0; ++ } ++ ++ halt_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_STALL); ++ ++handle_stall_done: ++ disable_hc_int(hc_regs, stall); ++ ++ return 1; ++} ++ ++/* ++ * Updates the state of the URB when a transfer has been stopped due to an ++ * abnormal condition before the transfer completes. Modifies the ++ * actual_length field of the URB to reflect the number of bytes that have ++ * actually been transferred via the host channel. ++ */ ++static void update_urb_state_xfer_intr(dwc_hc_t * hc, ++ dwc_otg_hc_regs_t * hc_regs, ++ dwc_otg_hcd_urb_t * urb, ++ dwc_otg_qtd_t * qtd, ++ dwc_otg_halt_status_e halt_status) ++{ ++ uint32_t bytes_transferred = get_actual_xfer_length(hc, hc_regs, qtd, ++ halt_status, NULL); ++ ++ if (urb->actual_length + bytes_transferred > urb->length) { ++ printk_once(KERN_DEBUG "dwc_otg: DEVICE:%03d : %s:%d:trimming xfer length\n", ++ hc->dev_addr, __func__, __LINE__); ++ bytes_transferred = urb->length - urb->actual_length; ++ } ++ ++ /* non DWORD-aligned buffer case handling. */ ++ if (hc->align_buff && bytes_transferred && hc->ep_is_in) { ++ dwc_memcpy(urb->buf + urb->actual_length, hc->qh->dw_align_buf, ++ bytes_transferred); ++ } ++ ++ urb->actual_length += bytes_transferred; ++ ++#ifdef DEBUG ++ { ++ hctsiz_data_t hctsiz; ++ hctsiz.d32 = DWC_READ_REG32(&hc_regs->hctsiz); ++ DWC_DEBUGPL(DBG_HCDV, "DWC_otg: %s: %s, channel %d\n", ++ __func__, (hc->ep_is_in ? "IN" : "OUT"), ++ hc->hc_num); ++ DWC_DEBUGPL(DBG_HCDV, " hc->start_pkt_count %d\n", ++ hc->start_pkt_count); ++ DWC_DEBUGPL(DBG_HCDV, " hctsiz.pktcnt %d\n", hctsiz.b.pktcnt); ++ DWC_DEBUGPL(DBG_HCDV, " hc->max_packet %d\n", hc->max_packet); ++ DWC_DEBUGPL(DBG_HCDV, " bytes_transferred %d\n", ++ bytes_transferred); ++ DWC_DEBUGPL(DBG_HCDV, " urb->actual_length %d\n", ++ urb->actual_length); ++ DWC_DEBUGPL(DBG_HCDV, " urb->transfer_buffer_length %d\n", ++ urb->length); ++ } ++#endif ++} ++ ++/** ++ * Handles a host channel NAK interrupt. This handler may be called in either ++ * DMA mode or Slave mode. ++ */ ++static int32_t handle_hc_nak_intr(dwc_otg_hcd_t * hcd, ++ dwc_hc_t * hc, ++ dwc_otg_hc_regs_t * hc_regs, ++ dwc_otg_qtd_t * qtd) ++{ ++ DWC_DEBUGPL(DBG_HCDI, "--Host Channel %d Interrupt: " ++ "NAK Received--\n", hc->hc_num); ++ ++ /* ++ * When we get bulk NAKs then remember this so we holdoff on this qh until ++ * the beginning of the next frame ++ */ ++ switch(dwc_otg_hcd_get_pipe_type(&qtd->urb->pipe_info)) { ++ case UE_BULK: ++ case UE_CONTROL: ++ if (nak_holdoff && qtd->qh->do_split) ++ hc->qh->nak_frame = dwc_otg_hcd_get_frame_number(hcd); ++ } ++ ++ /* ++ * Handle NAK for IN/OUT SSPLIT/CSPLIT transfers, bulk, control, and ++ * interrupt. Re-start the SSPLIT transfer. ++ */ ++ if (hc->do_split) { ++ if (hc->complete_split) { ++ qtd->error_count = 0; ++ } ++ qtd->complete_split = 0; ++ halt_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_NAK); ++ goto handle_nak_done; ++ } ++ ++ switch (dwc_otg_hcd_get_pipe_type(&qtd->urb->pipe_info)) { ++ case UE_CONTROL: ++ case UE_BULK: ++ if (hcd->core_if->dma_enable && hc->ep_is_in) { ++ /* ++ * NAK interrupts are enabled on bulk/control IN ++ * transfers in DMA mode for the sole purpose of ++ * resetting the error count after a transaction error ++ * occurs. The core will continue transferring data. ++ * Disable other interrupts unmasked for the same ++ * reason. ++ */ ++ disable_hc_int(hc_regs, datatglerr); ++ disable_hc_int(hc_regs, ack); ++ qtd->error_count = 0; ++ goto handle_nak_done; ++ } ++ ++ /* ++ * NAK interrupts normally occur during OUT transfers in DMA ++ * or Slave mode. For IN transfers, more requests will be ++ * queued as request queue space is available. ++ */ ++ qtd->error_count = 0; ++ ++ if (!hc->qh->ping_state) { ++ update_urb_state_xfer_intr(hc, hc_regs, ++ qtd->urb, qtd, ++ DWC_OTG_HC_XFER_NAK); ++ dwc_otg_hcd_save_data_toggle(hc, hc_regs, qtd); ++ ++ if (hc->speed == DWC_OTG_EP_SPEED_HIGH) ++ hc->qh->ping_state = 1; ++ } ++ ++ /* ++ * Halt the channel so the transfer can be re-started from ++ * the appropriate point or the PING protocol will ++ * start/continue. ++ */ ++ halt_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_NAK); ++ break; ++ case UE_INTERRUPT: ++ qtd->error_count = 0; ++ halt_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_NAK); ++ break; ++ case UE_ISOCHRONOUS: ++ /* Should never get called for isochronous transfers. */ ++ DWC_ASSERT(1, "NACK interrupt for ISOC transfer\n"); ++ break; ++ } ++ ++handle_nak_done: ++ disable_hc_int(hc_regs, nak); ++ ++ return 1; ++} ++ ++/** ++ * Handles a host channel ACK interrupt. This interrupt is enabled when ++ * performing the PING protocol in Slave mode, when errors occur during ++ * either Slave mode or DMA mode, and during Start Split transactions. ++ */ ++static int32_t handle_hc_ack_intr(dwc_otg_hcd_t * hcd, ++ dwc_hc_t * hc, ++ dwc_otg_hc_regs_t * hc_regs, ++ dwc_otg_qtd_t * qtd) ++{ ++ DWC_DEBUGPL(DBG_HCDI, "--Host Channel %d Interrupt: " ++ "ACK Received--\n", hc->hc_num); ++ ++ if (hc->do_split) { ++ /* ++ * Handle ACK on SSPLIT. ++ * ACK should not occur in CSPLIT. ++ */ ++ if (!hc->ep_is_in && hc->data_pid_start != DWC_OTG_HC_PID_SETUP) { ++ qtd->ssplit_out_xfer_count = hc->xfer_len; ++ } ++ if (!(hc->ep_type == DWC_OTG_EP_TYPE_ISOC && !hc->ep_is_in)) { ++ /* Don't need complete for isochronous out transfers. */ ++ qtd->complete_split = 1; ++ } ++ ++ /* ISOC OUT */ ++ if (hc->ep_type == DWC_OTG_EP_TYPE_ISOC && !hc->ep_is_in) { ++ switch (hc->xact_pos) { ++ case DWC_HCSPLIT_XACTPOS_ALL: ++ break; ++ case DWC_HCSPLIT_XACTPOS_END: ++ qtd->isoc_split_pos = DWC_HCSPLIT_XACTPOS_ALL; ++ qtd->isoc_split_offset = 0; ++ break; ++ case DWC_HCSPLIT_XACTPOS_BEGIN: ++ case DWC_HCSPLIT_XACTPOS_MID: ++ /* ++ * For BEGIN or MID, calculate the length for ++ * the next microframe to determine the correct ++ * SSPLIT token, either MID or END. ++ */ ++ { ++ struct dwc_otg_hcd_iso_packet_desc ++ *frame_desc; ++ ++ frame_desc = ++ &qtd->urb-> ++ iso_descs[qtd->isoc_frame_index]; ++ qtd->isoc_split_offset += 188; ++ ++ if ((frame_desc->length - ++ qtd->isoc_split_offset) <= 188) { ++ qtd->isoc_split_pos = ++ DWC_HCSPLIT_XACTPOS_END; ++ } else { ++ qtd->isoc_split_pos = ++ DWC_HCSPLIT_XACTPOS_MID; ++ } ++ ++ } ++ break; ++ } ++ } else { ++ halt_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_ACK); ++ } ++ } else { ++ /* ++ * An unmasked ACK on a non-split DMA transaction is ++ * for the sole purpose of resetting error counts. Disable other ++ * interrupts unmasked for the same reason. ++ */ ++ if(hcd->core_if->dma_enable) { ++ disable_hc_int(hc_regs, datatglerr); ++ disable_hc_int(hc_regs, nak); ++ } ++ qtd->error_count = 0; ++ ++ if (hc->qh->ping_state) { ++ hc->qh->ping_state = 0; ++ /* ++ * Halt the channel so the transfer can be re-started ++ * from the appropriate point. This only happens in ++ * Slave mode. In DMA mode, the ping_state is cleared ++ * when the transfer is started because the core ++ * automatically executes the PING, then the transfer. ++ */ ++ halt_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_ACK); ++ } ++ } ++ ++ /* ++ * If the ACK occurred when _not_ in the PING state, let the channel ++ * continue transferring data after clearing the error count. ++ */ ++ ++ disable_hc_int(hc_regs, ack); ++ ++ return 1; ++} ++ ++/** ++ * Handles a host channel NYET interrupt. This interrupt should only occur on ++ * Bulk and Control OUT endpoints and for complete split transactions. If a ++ * NYET occurs at the same time as a Transfer Complete interrupt, it is ++ * handled in the xfercomp interrupt handler, not here. This handler may be ++ * called in either DMA mode or Slave mode. ++ */ ++static int32_t handle_hc_nyet_intr(dwc_otg_hcd_t * hcd, ++ dwc_hc_t * hc, ++ dwc_otg_hc_regs_t * hc_regs, ++ dwc_otg_qtd_t * qtd) ++{ ++ DWC_DEBUGPL(DBG_HCDI, "--Host Channel %d Interrupt: " ++ "NYET Received--\n", hc->hc_num); ++ ++ /* ++ * NYET on CSPLIT ++ * re-do the CSPLIT immediately on non-periodic ++ */ ++ if (hc->do_split && hc->complete_split) { ++ if (hc->ep_is_in && (hc->ep_type == DWC_OTG_EP_TYPE_ISOC) ++ && hcd->core_if->dma_enable) { ++ qtd->complete_split = 0; ++ qtd->isoc_split_offset = 0; ++ if (++qtd->isoc_frame_index == qtd->urb->packet_count) { ++ hcd->fops->complete(hcd, qtd->urb->priv, qtd->urb, 0); ++ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_URB_COMPLETE); ++ } ++ else ++ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_NO_HALT_STATUS); ++ goto handle_nyet_done; ++ } ++ ++ if (hc->ep_type == DWC_OTG_EP_TYPE_INTR || ++ hc->ep_type == DWC_OTG_EP_TYPE_ISOC) { ++ int frnum = dwc_otg_hcd_get_frame_number(hcd); ++ ++ // With the FIQ running we only ever see the failed NYET ++ if (dwc_full_frame_num(frnum) != ++ dwc_full_frame_num(hc->qh->sched_frame) || ++ fiq_fsm_enable) { ++ /* ++ * No longer in the same full speed frame. ++ * Treat this as a transaction error. ++ */ ++#if 0 ++ /** @todo Fix system performance so this can ++ * be treated as an error. Right now complete ++ * splits cannot be scheduled precisely enough ++ * due to other system activity, so this error ++ * occurs regularly in Slave mode. ++ */ ++ qtd->error_count++; ++#endif ++ qtd->complete_split = 0; ++ halt_channel(hcd, hc, qtd, ++ DWC_OTG_HC_XFER_XACT_ERR); ++ /** @todo add support for isoc release */ ++ goto handle_nyet_done; ++ } ++ } ++ ++ halt_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_NYET); ++ goto handle_nyet_done; ++ } ++ ++ hc->qh->ping_state = 1; ++ qtd->error_count = 0; ++ ++ update_urb_state_xfer_intr(hc, hc_regs, qtd->urb, qtd, ++ DWC_OTG_HC_XFER_NYET); ++ dwc_otg_hcd_save_data_toggle(hc, hc_regs, qtd); ++ ++ /* ++ * Halt the channel and re-start the transfer so the PING ++ * protocol will start. ++ */ ++ halt_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_NYET); ++ ++handle_nyet_done: ++ disable_hc_int(hc_regs, nyet); ++ return 1; ++} ++ ++/** ++ * Handles a host channel babble interrupt. This handler may be called in ++ * either DMA mode or Slave mode. ++ */ ++static int32_t handle_hc_babble_intr(dwc_otg_hcd_t * hcd, ++ dwc_hc_t * hc, ++ dwc_otg_hc_regs_t * hc_regs, ++ dwc_otg_qtd_t * qtd) ++{ ++ DWC_DEBUGPL(DBG_HCDI, "--Host Channel %d Interrupt: " ++ "Babble Error--\n", hc->hc_num); ++ ++ if (hcd->core_if->dma_desc_enable) { ++ dwc_otg_hcd_complete_xfer_ddma(hcd, hc, hc_regs, ++ DWC_OTG_HC_XFER_BABBLE_ERR); ++ goto handle_babble_done; ++ } ++ ++ if (hc->ep_type != DWC_OTG_EP_TYPE_ISOC) { ++ hcd->fops->complete(hcd, qtd->urb->priv, ++ qtd->urb, -DWC_E_OVERFLOW); ++ halt_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_BABBLE_ERR); ++ } else { ++ dwc_otg_halt_status_e halt_status; ++ halt_status = update_isoc_urb_state(hcd, hc, hc_regs, qtd, ++ DWC_OTG_HC_XFER_BABBLE_ERR); ++ halt_channel(hcd, hc, qtd, halt_status); ++ } ++ ++handle_babble_done: ++ disable_hc_int(hc_regs, bblerr); ++ return 1; ++} ++ ++/** ++ * Handles a host channel AHB error interrupt. This handler is only called in ++ * DMA mode. ++ */ ++static int32_t handle_hc_ahberr_intr(dwc_otg_hcd_t * hcd, ++ dwc_hc_t * hc, ++ dwc_otg_hc_regs_t * hc_regs, ++ dwc_otg_qtd_t * qtd) ++{ ++ hcchar_data_t hcchar; ++ hcsplt_data_t hcsplt; ++ hctsiz_data_t hctsiz; ++ uint32_t hcdma; ++ char *pipetype, *speed; ++ ++ dwc_otg_hcd_urb_t *urb = qtd->urb; ++ ++ DWC_DEBUGPL(DBG_HCDI, "--Host Channel %d Interrupt: " ++ "AHB Error--\n", hc->hc_num); ++ ++ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); ++ hcsplt.d32 = DWC_READ_REG32(&hc_regs->hcsplt); ++ hctsiz.d32 = DWC_READ_REG32(&hc_regs->hctsiz); ++ hcdma = DWC_READ_REG32(&hc_regs->hcdma); ++ ++ DWC_ERROR("AHB ERROR, Channel %d\n", hc->hc_num); ++ DWC_ERROR(" hcchar 0x%08x, hcsplt 0x%08x\n", hcchar.d32, hcsplt.d32); ++ DWC_ERROR(" hctsiz 0x%08x, hcdma 0x%08x\n", hctsiz.d32, hcdma); ++ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD URB Enqueue\n"); ++ DWC_ERROR(" Device address: %d\n", ++ dwc_otg_hcd_get_dev_addr(&urb->pipe_info)); ++ DWC_ERROR(" Endpoint: %d, %s\n", ++ dwc_otg_hcd_get_ep_num(&urb->pipe_info), ++ (dwc_otg_hcd_is_pipe_in(&urb->pipe_info) ? "IN" : "OUT")); ++ ++ switch (dwc_otg_hcd_get_pipe_type(&urb->pipe_info)) { ++ case UE_CONTROL: ++ pipetype = "CONTROL"; ++ break; ++ case UE_BULK: ++ pipetype = "BULK"; ++ break; ++ case UE_INTERRUPT: ++ pipetype = "INTERRUPT"; ++ break; ++ case UE_ISOCHRONOUS: ++ pipetype = "ISOCHRONOUS"; ++ break; ++ default: ++ pipetype = "UNKNOWN"; ++ break; ++ } ++ ++ DWC_ERROR(" Endpoint type: %s\n", pipetype); ++ ++ switch (hc->speed) { ++ case DWC_OTG_EP_SPEED_HIGH: ++ speed = "HIGH"; ++ break; ++ case DWC_OTG_EP_SPEED_FULL: ++ speed = "FULL"; ++ break; ++ case DWC_OTG_EP_SPEED_LOW: ++ speed = "LOW"; ++ break; ++ default: ++ speed = "UNKNOWN"; ++ break; ++ }; ++ ++ DWC_ERROR(" Speed: %s\n", speed); ++ ++ DWC_ERROR(" Max packet size: %d\n", ++ dwc_otg_hcd_get_mps(&urb->pipe_info)); ++ DWC_ERROR(" Data buffer length: %d\n", urb->length); ++ DWC_ERROR(" Transfer buffer: %p, Transfer DMA: %p\n", ++ urb->buf, (void *)urb->dma); ++ DWC_ERROR(" Setup buffer: %p, Setup DMA: %p\n", ++ urb->setup_packet, (void *)urb->setup_dma); ++ DWC_ERROR(" Interval: %d\n", urb->interval); ++ ++ /* Core haltes the channel for Descriptor DMA mode */ ++ if (hcd->core_if->dma_desc_enable) { ++ dwc_otg_hcd_complete_xfer_ddma(hcd, hc, hc_regs, ++ DWC_OTG_HC_XFER_AHB_ERR); ++ goto handle_ahberr_done; ++ } ++ ++ hcd->fops->complete(hcd, urb->priv, urb, -DWC_E_IO); ++ ++ /* ++ * Force a channel halt. Don't call halt_channel because that won't ++ * write to the HCCHARn register in DMA mode to force the halt. ++ */ ++ dwc_otg_hc_halt(hcd->core_if, hc, DWC_OTG_HC_XFER_AHB_ERR); ++handle_ahberr_done: ++ disable_hc_int(hc_regs, ahberr); ++ return 1; ++} ++ ++/** ++ * Handles a host channel transaction error interrupt. This handler may be ++ * called in either DMA mode or Slave mode. ++ */ ++static int32_t handle_hc_xacterr_intr(dwc_otg_hcd_t * hcd, ++ dwc_hc_t * hc, ++ dwc_otg_hc_regs_t * hc_regs, ++ dwc_otg_qtd_t * qtd) ++{ ++ DWC_DEBUGPL(DBG_HCDI, "--Host Channel %d Interrupt: " ++ "Transaction Error--\n", hc->hc_num); ++ ++ if (hcd->core_if->dma_desc_enable) { ++ dwc_otg_hcd_complete_xfer_ddma(hcd, hc, hc_regs, ++ DWC_OTG_HC_XFER_XACT_ERR); ++ goto handle_xacterr_done; ++ } ++ ++ switch (dwc_otg_hcd_get_pipe_type(&qtd->urb->pipe_info)) { ++ case UE_CONTROL: ++ case UE_BULK: ++ qtd->error_count++; ++ if (!hc->qh->ping_state) { ++ ++ update_urb_state_xfer_intr(hc, hc_regs, ++ qtd->urb, qtd, ++ DWC_OTG_HC_XFER_XACT_ERR); ++ dwc_otg_hcd_save_data_toggle(hc, hc_regs, qtd); ++ if (!hc->ep_is_in && hc->speed == DWC_OTG_EP_SPEED_HIGH) { ++ hc->qh->ping_state = 1; ++ } ++ } ++ ++ /* ++ * Halt the channel so the transfer can be re-started from ++ * the appropriate point or the PING protocol will start. ++ */ ++ halt_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_XACT_ERR); ++ break; ++ case UE_INTERRUPT: ++ qtd->error_count++; ++ if (hc->do_split && hc->complete_split) { ++ qtd->complete_split = 0; ++ } ++ halt_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_XACT_ERR); ++ break; ++ case UE_ISOCHRONOUS: ++ { ++ dwc_otg_halt_status_e halt_status; ++ halt_status = ++ update_isoc_urb_state(hcd, hc, hc_regs, qtd, ++ DWC_OTG_HC_XFER_XACT_ERR); ++ ++ halt_channel(hcd, hc, qtd, halt_status); ++ } ++ break; ++ } ++handle_xacterr_done: ++ disable_hc_int(hc_regs, xacterr); ++ ++ return 1; ++} ++ ++/** ++ * Handles a host channel frame overrun interrupt. This handler may be called ++ * in either DMA mode or Slave mode. ++ */ ++static int32_t handle_hc_frmovrun_intr(dwc_otg_hcd_t * hcd, ++ dwc_hc_t * hc, ++ dwc_otg_hc_regs_t * hc_regs, ++ dwc_otg_qtd_t * qtd) ++{ ++ DWC_DEBUGPL(DBG_HCDI, "--Host Channel %d Interrupt: " ++ "Frame Overrun--\n", hc->hc_num); ++ ++ switch (dwc_otg_hcd_get_pipe_type(&qtd->urb->pipe_info)) { ++ case UE_CONTROL: ++ case UE_BULK: ++ break; ++ case UE_INTERRUPT: ++ halt_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_FRAME_OVERRUN); ++ break; ++ case UE_ISOCHRONOUS: ++ { ++ dwc_otg_halt_status_e halt_status; ++ halt_status = ++ update_isoc_urb_state(hcd, hc, hc_regs, qtd, ++ DWC_OTG_HC_XFER_FRAME_OVERRUN); ++ ++ halt_channel(hcd, hc, qtd, halt_status); ++ } ++ break; ++ } ++ ++ disable_hc_int(hc_regs, frmovrun); ++ ++ return 1; ++} ++ ++/** ++ * Handles a host channel data toggle error interrupt. This handler may be ++ * called in either DMA mode or Slave mode. ++ */ ++static int32_t handle_hc_datatglerr_intr(dwc_otg_hcd_t * hcd, ++ dwc_hc_t * hc, ++ dwc_otg_hc_regs_t * hc_regs, ++ dwc_otg_qtd_t * qtd) ++{ ++ DWC_DEBUGPL(DBG_HCDI, "--Host Channel %d Interrupt: " ++ "Data Toggle Error on %s transfer--\n", ++ hc->hc_num, (hc->ep_is_in ? "IN" : "OUT")); ++ ++ /* Data toggles on split transactions cause the hc to halt. ++ * restart transfer */ ++ if(hc->qh->do_split) ++ { ++ qtd->error_count++; ++ dwc_otg_hcd_save_data_toggle(hc, hc_regs, qtd); ++ update_urb_state_xfer_intr(hc, hc_regs, ++ qtd->urb, qtd, DWC_OTG_HC_XFER_XACT_ERR); ++ halt_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_XACT_ERR); ++ } else if (hc->ep_is_in) { ++ /* An unmasked data toggle error on a non-split DMA transaction is ++ * for the sole purpose of resetting error counts. Disable other ++ * interrupts unmasked for the same reason. ++ */ ++ if(hcd->core_if->dma_enable) { ++ disable_hc_int(hc_regs, ack); ++ disable_hc_int(hc_regs, nak); ++ } ++ qtd->error_count = 0; ++ } ++ ++ disable_hc_int(hc_regs, datatglerr); ++ ++ return 1; ++} ++ ++#ifdef DEBUG ++/** ++ * This function is for debug only. It checks that a valid halt status is set ++ * and that HCCHARn.chdis is clear. If there's a problem, corrective action is ++ * taken and a warning is issued. ++ * @return 1 if halt status is ok, 0 otherwise. ++ */ ++static inline int halt_status_ok(dwc_otg_hcd_t * hcd, ++ dwc_hc_t * hc, ++ dwc_otg_hc_regs_t * hc_regs, ++ dwc_otg_qtd_t * qtd) ++{ ++ hcchar_data_t hcchar; ++ hctsiz_data_t hctsiz; ++ hcint_data_t hcint; ++ hcintmsk_data_t hcintmsk; ++ hcsplt_data_t hcsplt; ++ ++ if (hc->halt_status == DWC_OTG_HC_XFER_NO_HALT_STATUS) { ++ /* ++ * This code is here only as a check. This condition should ++ * never happen. Ignore the halt if it does occur. ++ */ ++ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); ++ hctsiz.d32 = DWC_READ_REG32(&hc_regs->hctsiz); ++ hcint.d32 = DWC_READ_REG32(&hc_regs->hcint); ++ hcintmsk.d32 = DWC_READ_REG32(&hc_regs->hcintmsk); ++ hcsplt.d32 = DWC_READ_REG32(&hc_regs->hcsplt); ++ DWC_WARN ++ ("%s: hc->halt_status == DWC_OTG_HC_XFER_NO_HALT_STATUS, " ++ "channel %d, hcchar 0x%08x, hctsiz 0x%08x, " ++ "hcint 0x%08x, hcintmsk 0x%08x, " ++ "hcsplt 0x%08x, qtd->complete_split %d\n", __func__, ++ hc->hc_num, hcchar.d32, hctsiz.d32, hcint.d32, ++ hcintmsk.d32, hcsplt.d32, qtd->complete_split); ++ ++ DWC_WARN("%s: no halt status, channel %d, ignoring interrupt\n", ++ __func__, hc->hc_num); ++ DWC_WARN("\n"); ++ clear_hc_int(hc_regs, chhltd); ++ return 0; ++ } ++ ++ /* ++ * This code is here only as a check. hcchar.chdis should ++ * never be set when the halt interrupt occurs. Halt the ++ * channel again if it does occur. ++ */ ++ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); ++ if (hcchar.b.chdis) { ++ DWC_WARN("%s: hcchar.chdis set unexpectedly, " ++ "hcchar 0x%08x, trying to halt again\n", ++ __func__, hcchar.d32); ++ clear_hc_int(hc_regs, chhltd); ++ hc->halt_pending = 0; ++ halt_channel(hcd, hc, qtd, hc->halt_status); ++ return 0; ++ } ++ ++ return 1; ++} ++#endif ++ ++/** ++ * Handles a host Channel Halted interrupt in DMA mode. This handler ++ * determines the reason the channel halted and proceeds accordingly. ++ */ ++static void handle_hc_chhltd_intr_dma(dwc_otg_hcd_t * hcd, ++ dwc_hc_t * hc, ++ dwc_otg_hc_regs_t * hc_regs, ++ dwc_otg_qtd_t * qtd) ++{ ++ int out_nak_enh = 0; ++ hcint_data_t hcint; ++ hcintmsk_data_t hcintmsk; ++ /* For core with OUT NAK enhancement, the flow for high- ++ * speed CONTROL/BULK OUT is handled a little differently. ++ */ ++ if (hcd->core_if->snpsid >= OTG_CORE_REV_2_71a) { ++ if (hc->speed == DWC_OTG_EP_SPEED_HIGH && !hc->ep_is_in && ++ (hc->ep_type == DWC_OTG_EP_TYPE_CONTROL || ++ hc->ep_type == DWC_OTG_EP_TYPE_BULK)) { ++ out_nak_enh = 1; ++ } ++ } ++ ++ if (hc->halt_status == DWC_OTG_HC_XFER_URB_DEQUEUE || ++ (hc->halt_status == DWC_OTG_HC_XFER_AHB_ERR ++ && !hcd->core_if->dma_desc_enable)) { ++ /* ++ * Just release the channel. A dequeue can happen on a ++ * transfer timeout. In the case of an AHB Error, the channel ++ * was forced to halt because there's no way to gracefully ++ * recover. ++ */ ++ if (hcd->core_if->dma_desc_enable) ++ dwc_otg_hcd_complete_xfer_ddma(hcd, hc, hc_regs, ++ hc->halt_status); ++ else ++ release_channel(hcd, hc, qtd, hc->halt_status); ++ return; ++ } ++ ++ /* Read the HCINTn register to determine the cause for the halt. */ ++ ++ hcint.d32 = DWC_READ_REG32(&hc_regs->hcint); ++ hcintmsk.d32 = DWC_READ_REG32(&hc_regs->hcintmsk); ++ ++ if (hcint.b.xfercomp) { ++ /** @todo This is here because of a possible hardware bug. Spec ++ * says that on SPLIT-ISOC OUT transfers in DMA mode that a HALT ++ * interrupt w/ACK bit set should occur, but I only see the ++ * XFERCOMP bit, even with it masked out. This is a workaround ++ * for that behavior. Should fix this when hardware is fixed. ++ */ ++ if (hc->ep_type == DWC_OTG_EP_TYPE_ISOC && !hc->ep_is_in) { ++ handle_hc_ack_intr(hcd, hc, hc_regs, qtd); ++ } ++ handle_hc_xfercomp_intr(hcd, hc, hc_regs, qtd); ++ } else if (hcint.b.stall) { ++ handle_hc_stall_intr(hcd, hc, hc_regs, qtd); ++ } else if (hcint.b.xacterr && !hcd->core_if->dma_desc_enable) { ++ if (out_nak_enh) { ++ if (hcint.b.nyet || hcint.b.nak || hcint.b.ack) { ++ DWC_DEBUGPL(DBG_HCD, "XactErr with NYET/NAK/ACK\n"); ++ qtd->error_count = 0; ++ } else { ++ DWC_DEBUGPL(DBG_HCD, "XactErr without NYET/NAK/ACK\n"); ++ } ++ } ++ ++ /* ++ * Must handle xacterr before nak or ack. Could get a xacterr ++ * at the same time as either of these on a BULK/CONTROL OUT ++ * that started with a PING. The xacterr takes precedence. ++ */ ++ handle_hc_xacterr_intr(hcd, hc, hc_regs, qtd); ++ } else if (hcint.b.xcs_xact && hcd->core_if->dma_desc_enable) { ++ handle_hc_xacterr_intr(hcd, hc, hc_regs, qtd); ++ } else if (hcint.b.ahberr && hcd->core_if->dma_desc_enable) { ++ handle_hc_ahberr_intr(hcd, hc, hc_regs, qtd); ++ } else if (hcint.b.bblerr) { ++ handle_hc_babble_intr(hcd, hc, hc_regs, qtd); ++ } else if (hcint.b.frmovrun) { ++ handle_hc_frmovrun_intr(hcd, hc, hc_regs, qtd); ++ } else if (hcint.b.datatglerr) { ++ handle_hc_datatglerr_intr(hcd, hc, hc_regs, qtd); ++ } else if (!out_nak_enh) { ++ if (hcint.b.nyet) { ++ /* ++ * Must handle nyet before nak or ack. Could get a nyet at the ++ * same time as either of those on a BULK/CONTROL OUT that ++ * started with a PING. The nyet takes precedence. ++ */ ++ handle_hc_nyet_intr(hcd, hc, hc_regs, qtd); ++ } else if (hcint.b.nak && !hcintmsk.b.nak) { ++ /* ++ * If nak is not masked, it's because a non-split IN transfer ++ * is in an error state. In that case, the nak is handled by ++ * the nak interrupt handler, not here. Handle nak here for ++ * BULK/CONTROL OUT transfers, which halt on a NAK to allow ++ * rewinding the buffer pointer. ++ */ ++ handle_hc_nak_intr(hcd, hc, hc_regs, qtd); ++ } else if (hcint.b.ack && !hcintmsk.b.ack) { ++ /* ++ * If ack is not masked, it's because a non-split IN transfer ++ * is in an error state. In that case, the ack is handled by ++ * the ack interrupt handler, not here. Handle ack here for ++ * split transfers. Start splits halt on ACK. ++ */ ++ handle_hc_ack_intr(hcd, hc, hc_regs, qtd); ++ } else { ++ if (hc->ep_type == DWC_OTG_EP_TYPE_INTR || ++ hc->ep_type == DWC_OTG_EP_TYPE_ISOC) { ++ /* ++ * A periodic transfer halted with no other channel ++ * interrupts set. Assume it was halted by the core ++ * because it could not be completed in its scheduled ++ * (micro)frame. ++ */ ++#ifdef DEBUG ++ DWC_PRINTF ++ ("%s: Halt channel %d (assume incomplete periodic transfer)\n", ++ __func__, hc->hc_num); ++#endif ++ halt_channel(hcd, hc, qtd, ++ DWC_OTG_HC_XFER_PERIODIC_INCOMPLETE); ++ } else { ++ DWC_ERROR ++ ("%s: Channel %d, DMA Mode -- ChHltd set, but reason " ++ "for halting is unknown, hcint 0x%08x, intsts 0x%08x\n", ++ __func__, hc->hc_num, hcint.d32, ++ DWC_READ_REG32(&hcd-> ++ core_if->core_global_regs-> ++ gintsts)); ++ /* Failthrough: use 3-strikes rule */ ++ qtd->error_count++; ++ dwc_otg_hcd_save_data_toggle(hc, hc_regs, qtd); ++ update_urb_state_xfer_intr(hc, hc_regs, ++ qtd->urb, qtd, DWC_OTG_HC_XFER_XACT_ERR); ++ halt_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_XACT_ERR); ++ } ++ ++ } ++ } else { ++ DWC_PRINTF("NYET/NAK/ACK/other in non-error case, 0x%08x\n", ++ hcint.d32); ++ /* Failthrough: use 3-strikes rule */ ++ qtd->error_count++; ++ dwc_otg_hcd_save_data_toggle(hc, hc_regs, qtd); ++ update_urb_state_xfer_intr(hc, hc_regs, ++ qtd->urb, qtd, DWC_OTG_HC_XFER_XACT_ERR); ++ halt_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_XACT_ERR); ++ } ++} ++ ++/** ++ * Handles a host channel Channel Halted interrupt. ++ * ++ * In slave mode, this handler is called only when the driver specifically ++ * requests a halt. This occurs during handling other host channel interrupts ++ * (e.g. nak, xacterr, stall, nyet, etc.). ++ * ++ * In DMA mode, this is the interrupt that occurs when the core has finished ++ * processing a transfer on a channel. Other host channel interrupts (except ++ * ahberr) are disabled in DMA mode. ++ */ ++static int32_t handle_hc_chhltd_intr(dwc_otg_hcd_t * hcd, ++ dwc_hc_t * hc, ++ dwc_otg_hc_regs_t * hc_regs, ++ dwc_otg_qtd_t * qtd) ++{ ++ DWC_DEBUGPL(DBG_HCDI, "--Host Channel %d Interrupt: " ++ "Channel Halted--\n", hc->hc_num); ++ ++ if (hcd->core_if->dma_enable) { ++ handle_hc_chhltd_intr_dma(hcd, hc, hc_regs, qtd); ++ } else { ++#ifdef DEBUG ++ if (!halt_status_ok(hcd, hc, hc_regs, qtd)) { ++ return 1; ++ } ++#endif ++ release_channel(hcd, hc, qtd, hc->halt_status); ++ } ++ ++ return 1; ++} ++ ++ ++/** ++ * dwc_otg_fiq_unmangle_isoc() - Update the iso_frame_desc structure on ++ * FIQ transfer completion ++ * @hcd: Pointer to dwc_otg_hcd struct ++ * @num: Host channel number ++ * ++ * 1. Un-mangle the status as recorded in each iso_frame_desc status ++ * 2. Copy it from the dwc_otg_urb into the real URB ++ */ ++void dwc_otg_fiq_unmangle_isoc(dwc_otg_hcd_t *hcd, dwc_otg_qh_t *qh, dwc_otg_qtd_t *qtd, uint32_t num) ++{ ++ struct dwc_otg_hcd_urb *dwc_urb = qtd->urb; ++ int nr_frames = dwc_urb->packet_count; ++ int i; ++ hcint_data_t frame_hcint; ++ ++ for (i = 0; i < nr_frames; i++) { ++ frame_hcint.d32 = dwc_urb->iso_descs[i].status; ++ if (frame_hcint.b.xfercomp) { ++ dwc_urb->iso_descs[i].status = 0; ++ dwc_urb->actual_length += dwc_urb->iso_descs[i].actual_length; ++ } else if (frame_hcint.b.frmovrun) { ++ if (qh->ep_is_in) ++ dwc_urb->iso_descs[i].status = -DWC_E_NO_STREAM_RES; ++ else ++ dwc_urb->iso_descs[i].status = -DWC_E_COMMUNICATION; ++ dwc_urb->error_count++; ++ dwc_urb->iso_descs[i].actual_length = 0; ++ } else if (frame_hcint.b.xacterr) { ++ dwc_urb->iso_descs[i].status = -DWC_E_PROTOCOL; ++ dwc_urb->error_count++; ++ dwc_urb->iso_descs[i].actual_length = 0; ++ } else if (frame_hcint.b.bblerr) { ++ dwc_urb->iso_descs[i].status = -DWC_E_OVERFLOW; ++ dwc_urb->error_count++; ++ dwc_urb->iso_descs[i].actual_length = 0; ++ } else { ++ /* Something went wrong */ ++ dwc_urb->iso_descs[i].status = -1; ++ dwc_urb->iso_descs[i].actual_length = 0; ++ dwc_urb->error_count++; ++ } ++ } ++ qh->sched_frame = dwc_frame_num_inc(qh->sched_frame, qh->interval * (nr_frames - 1)); ++ ++ //printk_ratelimited(KERN_INFO "%s: HS isochronous of %d/%d frames with %d errors complete\n", ++ // __FUNCTION__, i, dwc_urb->packet_count, dwc_urb->error_count); ++} ++ ++/** ++ * dwc_otg_fiq_unsetup_per_dma() - Remove data from bounce buffers for split transactions ++ * @hcd: Pointer to dwc_otg_hcd struct ++ * @num: Host channel number ++ * ++ * Copies data from the FIQ bounce buffers into the URB's transfer buffer. Does not modify URB state. ++ * Returns total length of data or -1 if the buffers were not used. ++ * ++ */ ++int dwc_otg_fiq_unsetup_per_dma(dwc_otg_hcd_t *hcd, dwc_otg_qh_t *qh, dwc_otg_qtd_t *qtd, uint32_t num) ++{ ++ dwc_hc_t *hc = qh->channel; ++ struct fiq_dma_blob *blob = hcd->fiq_dmab; ++ struct fiq_channel_state *st = &hcd->fiq_state->channel[num]; ++ uint8_t *ptr = NULL; ++ int index = 0, len = 0; ++ int i = 0; ++ if (hc->ep_is_in) { ++ /* Copy data out of the DMA bounce buffers to the URB's buffer. ++ * The align_buf is ignored as this is ignored on FSM enqueue. */ ++ ptr = qtd->urb->buf; ++ if (qh->ep_type == UE_ISOCHRONOUS) { ++ /* Isoc IN transactions - grab the offset of the iso_frame_desc into the URB transfer buffer */ ++ index = qtd->isoc_frame_index; ++ ptr += qtd->urb->iso_descs[index].offset; ++ } else { ++ /* Need to increment by actual_length for interrupt IN */ ++ ptr += qtd->urb->actual_length; ++ } ++ ++ for (i = 0; i < st->dma_info.index; i++) { ++ len += st->dma_info.slot_len[i]; ++ dwc_memcpy(ptr, &blob->channel[num].index[i].buf[0], st->dma_info.slot_len[i]); ++ ptr += st->dma_info.slot_len[i]; ++ } ++ return len; ++ } else { ++ /* OUT endpoints - nothing to do. */ ++ return -1; ++ } ++ ++} ++/** ++ * dwc_otg_hcd_handle_hc_fsm() - handle an unmasked channel interrupt ++ * from a channel handled in the FIQ ++ * @hcd: Pointer to dwc_otg_hcd struct ++ * @num: Host channel number ++ * ++ * If a host channel interrupt was received by the IRQ and this was a channel ++ * used by the FIQ, the execution flow for transfer completion is substantially ++ * different from the normal (messy) path. This function and its friends handles ++ * channel cleanup and transaction completion from a FIQ transaction. ++ */ ++void dwc_otg_hcd_handle_hc_fsm(dwc_otg_hcd_t *hcd, uint32_t num) ++{ ++ struct fiq_channel_state *st = &hcd->fiq_state->channel[num]; ++ dwc_hc_t *hc = hcd->hc_ptr_array[num]; ++ dwc_otg_qtd_t *qtd = DWC_CIRCLEQ_FIRST(&hc->qh->qtd_list); ++ dwc_otg_qh_t *qh = hc->qh; ++ dwc_otg_hc_regs_t *hc_regs = hcd->core_if->host_if->hc_regs[num]; ++ hcint_data_t hcint = hcd->fiq_state->channel[num].hcint_copy; ++ int hostchannels = 0; ++ fiq_print(FIQDBG_INT, hcd->fiq_state, "OUT %01d %01d ", num , st->fsm); ++ ++ hostchannels = hcd->available_host_channels; ++ switch (st->fsm) { ++ case FIQ_TEST: ++ break; ++ ++ case FIQ_DEQUEUE_ISSUED: ++ /* hc_halt was called. QTD no longer exists. */ ++ /* TODO: for a nonperiodic split transaction, need to issue a ++ * CLEAR_TT_BUFFER hub command if we were in the start-split phase. ++ */ ++ release_channel(hcd, hc, NULL, hc->halt_status); ++ break; ++ ++ case FIQ_NP_SPLIT_DONE: ++ /* Nonperiodic transaction complete. */ ++ if (!hc->ep_is_in) { ++ qtd->ssplit_out_xfer_count = hc->xfer_len; ++ } ++ if (hcint.b.xfercomp) { ++ handle_hc_xfercomp_intr(hcd, hc, hc_regs, qtd); ++ } else if (hcint.b.nak) { ++ handle_hc_nak_intr(hcd, hc, hc_regs, qtd); ++ } ++ break; ++ ++ case FIQ_NP_SPLIT_HS_ABORTED: ++ /* A HS abort is a 3-strikes on the HS bus at any point in the transaction. ++ * Normally a CLEAR_TT_BUFFER hub command would be required: we can't do that ++ * because there's no guarantee which order a non-periodic split happened in. ++ * We could end up clearing a perfectly good transaction out of the buffer. ++ */ ++ if (hcint.b.xacterr) { ++ qtd->error_count += st->nr_errors; ++ handle_hc_xacterr_intr(hcd, hc, hc_regs, qtd); ++ } else if (hcint.b.ahberr) { ++ handle_hc_ahberr_intr(hcd, hc, hc_regs, qtd); ++ } else { ++ local_fiq_disable(); ++ BUG(); ++ } ++ break; ++ ++ case FIQ_NP_SPLIT_LS_ABORTED: ++ /* A few cases can cause this - either an unknown state on a SSPLIT or ++ * STALL/data toggle error response on a CSPLIT */ ++ if (hcint.b.stall) { ++ handle_hc_stall_intr(hcd, hc, hc_regs, qtd); ++ } else if (hcint.b.datatglerr) { ++ handle_hc_datatglerr_intr(hcd, hc, hc_regs, qtd); ++ } else if (hcint.b.bblerr) { ++ handle_hc_babble_intr(hcd, hc, hc_regs, qtd); ++ } else if (hcint.b.ahberr) { ++ handle_hc_ahberr_intr(hcd, hc, hc_regs, qtd); ++ } else { ++ local_fiq_disable(); ++ BUG(); ++ } ++ break; ++ ++ case FIQ_PER_SPLIT_DONE: ++ /* Isoc IN or Interrupt IN/OUT */ ++ ++ /* Flow control here is different from the normal execution by the driver. ++ * We need to completely ignore most of the driver's method of handling ++ * split transactions and do it ourselves. ++ */ ++ if (hc->ep_type == UE_INTERRUPT) { ++ if (hcint.b.nak) { ++ handle_hc_nak_intr(hcd, hc, hc_regs, qtd); ++ } else if (hc->ep_is_in) { ++ int len; ++ len = dwc_otg_fiq_unsetup_per_dma(hcd, hc->qh, qtd, num); ++ //printk(KERN_NOTICE "FIQ Transaction: hc=%d len=%d urb_len = %d\n", num, len, qtd->urb->length); ++ qtd->urb->actual_length += len; ++ if (qtd->urb->actual_length >= qtd->urb->length) { ++ qtd->urb->status = 0; ++ hcd->fops->complete(hcd, qtd->urb->priv, qtd->urb, qtd->urb->status); ++ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_URB_COMPLETE); ++ } else { ++ /* Interrupt transfer not complete yet - is it a short read? */ ++ if (len < hc->max_packet) { ++ /* Interrupt transaction complete */ ++ qtd->urb->status = 0; ++ hcd->fops->complete(hcd, qtd->urb->priv, qtd->urb, qtd->urb->status); ++ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_URB_COMPLETE); ++ } else { ++ /* Further transactions required */ ++ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_COMPLETE); ++ } ++ } ++ } else { ++ /* Interrupt OUT complete. */ ++ dwc_otg_hcd_save_data_toggle(hc, hc_regs, qtd); ++ qtd->urb->actual_length += hc->xfer_len; ++ if (qtd->urb->actual_length >= qtd->urb->length) { ++ qtd->urb->status = 0; ++ hcd->fops->complete(hcd, qtd->urb->priv, qtd->urb, qtd->urb->status); ++ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_URB_COMPLETE); ++ } else { ++ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_COMPLETE); ++ } ++ } ++ } else { ++ /* ISOC IN complete. */ ++ struct dwc_otg_hcd_iso_packet_desc *frame_desc = &qtd->urb->iso_descs[qtd->isoc_frame_index]; ++ int len = 0; ++ /* Record errors, update qtd. */ ++ if (st->nr_errors) { ++ frame_desc->actual_length = 0; ++ frame_desc->status = -DWC_E_PROTOCOL; ++ } else { ++ frame_desc->status = 0; ++ /* Unswizzle dma */ ++ len = dwc_otg_fiq_unsetup_per_dma(hcd, qh, qtd, num); ++ frame_desc->actual_length = len; ++ } ++ qtd->isoc_frame_index++; ++ if (qtd->isoc_frame_index == qtd->urb->packet_count) { ++ hcd->fops->complete(hcd, qtd->urb->priv, qtd->urb, 0); ++ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_URB_COMPLETE); ++ } else { ++ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_COMPLETE); ++ } ++ } ++ break; ++ ++ case FIQ_PER_ISO_OUT_DONE: { ++ struct dwc_otg_hcd_iso_packet_desc *frame_desc = &qtd->urb->iso_descs[qtd->isoc_frame_index]; ++ /* Record errors, update qtd. */ ++ if (st->nr_errors) { ++ frame_desc->actual_length = 0; ++ frame_desc->status = -DWC_E_PROTOCOL; ++ } else { ++ frame_desc->status = 0; ++ frame_desc->actual_length = frame_desc->length; ++ } ++ qtd->isoc_frame_index++; ++ qtd->isoc_split_offset = 0; ++ if (qtd->isoc_frame_index == qtd->urb->packet_count) { ++ hcd->fops->complete(hcd, qtd->urb->priv, qtd->urb, 0); ++ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_URB_COMPLETE); ++ } else { ++ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_COMPLETE); ++ } ++ } ++ break; ++ ++ case FIQ_PER_SPLIT_NYET_ABORTED: ++ /* Doh. lost the data. */ ++ printk_ratelimited(KERN_INFO "Transfer to device %d endpoint 0x%x frame %d failed " ++ "- FIQ reported NYET. Data may have been lost.\n", ++ hc->dev_addr, hc->ep_num, dwc_otg_hcd_get_frame_number(hcd) >> 3); ++ if (hc->ep_type == UE_ISOCHRONOUS) { ++ struct dwc_otg_hcd_iso_packet_desc *frame_desc = &qtd->urb->iso_descs[qtd->isoc_frame_index]; ++ /* Record errors, update qtd. */ ++ frame_desc->actual_length = 0; ++ frame_desc->status = -DWC_E_PROTOCOL; ++ qtd->isoc_frame_index++; ++ qtd->isoc_split_offset = 0; ++ if (qtd->isoc_frame_index == qtd->urb->packet_count) { ++ hcd->fops->complete(hcd, qtd->urb->priv, qtd->urb, 0); ++ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_URB_COMPLETE); ++ } else { ++ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_COMPLETE); ++ } ++ } else { ++ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_NO_HALT_STATUS); ++ } ++ break; ++ ++ case FIQ_HS_ISOC_DONE: ++ /* The FIQ has performed a whole pile of isochronous transactions. ++ * The status is recorded as the interrupt state should the transaction ++ * fail. ++ */ ++ dwc_otg_fiq_unmangle_isoc(hcd, qh, qtd, num); ++ hcd->fops->complete(hcd, qtd->urb->priv, qtd->urb, 0); ++ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_URB_COMPLETE); ++ break; ++ ++ case FIQ_PER_SPLIT_LS_ABORTED: ++ if (hcint.b.xacterr) { ++ /* Hub has responded with an ERR packet. Device ++ * has been unplugged or the port has been disabled. ++ * TODO: need to issue a reset to the hub port. */ ++ qtd->error_count += 3; ++ handle_hc_xacterr_intr(hcd, hc, hc_regs, qtd); ++ } else if (hcint.b.stall) { ++ handle_hc_stall_intr(hcd, hc, hc_regs, qtd); ++ } else if (hcint.b.bblerr) { ++ handle_hc_babble_intr(hcd, hc, hc_regs, qtd); ++ } else { ++ printk_ratelimited(KERN_INFO "Transfer to device %d endpoint 0x%x failed " ++ "- FIQ reported FSM=%d. Data may have been lost.\n", ++ st->fsm, hc->dev_addr, hc->ep_num); ++ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_NO_HALT_STATUS); ++ } ++ break; ++ ++ case FIQ_PER_SPLIT_HS_ABORTED: ++ /* Either the SSPLIT phase suffered transaction errors or something ++ * unexpected happened. ++ */ ++ qtd->error_count += 3; ++ handle_hc_xacterr_intr(hcd, hc, hc_regs, qtd); ++ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_NO_HALT_STATUS); ++ break; ++ ++ case FIQ_PER_SPLIT_TIMEOUT: ++ /* Couldn't complete in the nominated frame */ ++ printk(KERN_INFO "Transfer to device %d endpoint 0x%x frame %d failed " ++ "- FIQ timed out. Data may have been lost.\n", ++ hc->dev_addr, hc->ep_num, dwc_otg_hcd_get_frame_number(hcd) >> 3); ++ if (hc->ep_type == UE_ISOCHRONOUS) { ++ struct dwc_otg_hcd_iso_packet_desc *frame_desc = &qtd->urb->iso_descs[qtd->isoc_frame_index]; ++ /* Record errors, update qtd. */ ++ frame_desc->actual_length = 0; ++ if (hc->ep_is_in) { ++ frame_desc->status = -DWC_E_NO_STREAM_RES; ++ } else { ++ frame_desc->status = -DWC_E_COMMUNICATION; ++ } ++ qtd->isoc_frame_index++; ++ if (qtd->isoc_frame_index == qtd->urb->packet_count) { ++ hcd->fops->complete(hcd, qtd->urb->priv, qtd->urb, 0); ++ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_URB_COMPLETE); ++ } else { ++ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_COMPLETE); ++ } ++ } else { ++ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_NO_HALT_STATUS); ++ } ++ break; ++ ++ default: ++ DWC_WARN("Unexpected state received on hc=%d fsm=%d on transfer to device %d ep 0x%x", ++ hc->hc_num, st->fsm, hc->dev_addr, hc->ep_num); ++ qtd->error_count++; ++ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_NO_HALT_STATUS); ++ } ++ return; ++} ++ ++/** Handles interrupt for a specific Host Channel */ ++int32_t dwc_otg_hcd_handle_hc_n_intr(dwc_otg_hcd_t * dwc_otg_hcd, uint32_t num) ++{ ++ int retval = 0; ++ hcint_data_t hcint; ++ hcintmsk_data_t hcintmsk; ++ dwc_hc_t *hc; ++ dwc_otg_hc_regs_t *hc_regs; ++ dwc_otg_qtd_t *qtd; ++ ++ DWC_DEBUGPL(DBG_HCDV, "--Host Channel Interrupt--, Channel %d\n", num); ++ ++ hc = dwc_otg_hcd->hc_ptr_array[num]; ++ hc_regs = dwc_otg_hcd->core_if->host_if->hc_regs[num]; ++ if(hc->halt_status == DWC_OTG_HC_XFER_URB_DEQUEUE) { ++ /* We are responding to a channel disable. Driver ++ * state is cleared - our qtd has gone away. ++ */ ++ release_channel(dwc_otg_hcd, hc, NULL, hc->halt_status); ++ return 1; ++ } ++ qtd = DWC_CIRCLEQ_FIRST(&hc->qh->qtd_list); ++ ++ /* ++ * FSM mode: Check to see if this is a HC interrupt from a channel handled by the FIQ. ++ * Execution path is fundamentally different for the channels after a FIQ has completed ++ * a split transaction. ++ */ ++ if (fiq_fsm_enable) { ++ switch (dwc_otg_hcd->fiq_state->channel[num].fsm) { ++ case FIQ_PASSTHROUGH: ++ break; ++ case FIQ_PASSTHROUGH_ERRORSTATE: ++ /* Hook into the error count */ ++ fiq_print(FIQDBG_ERR, dwc_otg_hcd->fiq_state, "HCDERR%02d", num); ++ if (!dwc_otg_hcd->fiq_state->channel[num].nr_errors) { ++ qtd->error_count = 0; ++ fiq_print(FIQDBG_ERR, dwc_otg_hcd->fiq_state, "RESET "); ++ } ++ break; ++ default: ++ dwc_otg_hcd_handle_hc_fsm(dwc_otg_hcd, num); ++ return 1; ++ } ++ } ++ ++ hcint.d32 = DWC_READ_REG32(&hc_regs->hcint); ++ hcintmsk.d32 = DWC_READ_REG32(&hc_regs->hcintmsk); ++ hcint.d32 = hcint.d32 & hcintmsk.d32; ++ if (!dwc_otg_hcd->core_if->dma_enable) { ++ if (hcint.b.chhltd && hcint.d32 != 0x2) { ++ hcint.b.chhltd = 0; ++ } ++ } ++ ++ if (hcint.b.xfercomp) { ++ retval |= ++ handle_hc_xfercomp_intr(dwc_otg_hcd, hc, hc_regs, qtd); ++ /* ++ * If NYET occurred at same time as Xfer Complete, the NYET is ++ * handled by the Xfer Complete interrupt handler. Don't want ++ * to call the NYET interrupt handler in this case. ++ */ ++ hcint.b.nyet = 0; ++ } ++ if (hcint.b.chhltd) { ++ retval |= handle_hc_chhltd_intr(dwc_otg_hcd, hc, hc_regs, qtd); ++ } ++ if (hcint.b.ahberr) { ++ retval |= handle_hc_ahberr_intr(dwc_otg_hcd, hc, hc_regs, qtd); ++ } ++ if (hcint.b.stall) { ++ retval |= handle_hc_stall_intr(dwc_otg_hcd, hc, hc_regs, qtd); ++ } ++ if (hcint.b.nak) { ++ retval |= handle_hc_nak_intr(dwc_otg_hcd, hc, hc_regs, qtd); ++ } ++ if (hcint.b.ack) { ++ if(!hcint.b.chhltd) ++ retval |= handle_hc_ack_intr(dwc_otg_hcd, hc, hc_regs, qtd); ++ } ++ if (hcint.b.nyet) { ++ retval |= handle_hc_nyet_intr(dwc_otg_hcd, hc, hc_regs, qtd); ++ } ++ if (hcint.b.xacterr) { ++ retval |= handle_hc_xacterr_intr(dwc_otg_hcd, hc, hc_regs, qtd); ++ } ++ if (hcint.b.bblerr) { ++ retval |= handle_hc_babble_intr(dwc_otg_hcd, hc, hc_regs, qtd); ++ } ++ if (hcint.b.frmovrun) { ++ retval |= ++ handle_hc_frmovrun_intr(dwc_otg_hcd, hc, hc_regs, qtd); ++ } ++ if (hcint.b.datatglerr) { ++ retval |= ++ handle_hc_datatglerr_intr(dwc_otg_hcd, hc, hc_regs, qtd); ++ } ++ ++ return retval; ++} ++#endif /* DWC_DEVICE_ONLY */ +diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c b/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c +new file mode 100644 +index 0000000..2ceed42 +--- /dev/null ++++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c +@@ -0,0 +1,1005 @@ ++ ++/* ========================================================================== ++ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_hcd_linux.c $ ++ * $Revision: #20 $ ++ * $Date: 2011/10/26 $ ++ * $Change: 1872981 $ ++ * ++ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, ++ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless ++ * otherwise expressly agreed to in writing between Synopsys and you. ++ * ++ * The Software IS NOT an item of Licensed Software or Licensed Product under ++ * any End User Software License Agreement or Agreement for Licensed Product ++ * with Synopsys or any supplement thereto. You are permitted to use and ++ * redistribute this Software in source and binary forms, with or without ++ * modification, provided that redistributions of source code must retain this ++ * notice. You may not view, use, disclose, copy or distribute this file or ++ * any information contained herein except pursuant to this license grant from ++ * Synopsys. If you do not agree with this notice, including the disclaimer ++ * below, then you are not authorized to use the Software. ++ * ++ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS ++ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS 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. ++ * ========================================================================== */ ++#ifndef DWC_DEVICE_ONLY ++ ++/** ++ * @file ++ * ++ * This file contains the implementation of the HCD. In Linux, the HCD ++ * implements the hc_driver API. ++ */ ++#include <linux/kernel.h> ++#include <linux/module.h> ++#include <linux/moduleparam.h> ++#include <linux/init.h> ++#include <linux/device.h> ++#include <linux/errno.h> ++#include <linux/list.h> ++#include <linux/interrupt.h> ++#include <linux/string.h> ++#include <linux/dma-mapping.h> ++#include <linux/version.h> ++#include <asm/io.h> ++#include <asm/fiq.h> ++#include <linux/usb.h> ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35) ++#include <../drivers/usb/core/hcd.h> ++#else ++#include <linux/usb/hcd.h> ++#endif ++#include <asm/bug.h> ++ ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,30)) ++#define USB_URB_EP_LINKING 1 ++#else ++#define USB_URB_EP_LINKING 0 ++#endif ++ ++#include "dwc_otg_hcd_if.h" ++#include "dwc_otg_dbg.h" ++#include "dwc_otg_driver.h" ++#include "dwc_otg_hcd.h" ++ ++extern unsigned char _dwc_otg_fiq_stub, _dwc_otg_fiq_stub_end; ++ ++/** ++ * Gets the endpoint number from a _bEndpointAddress argument. The endpoint is ++ * qualified with its direction (possible 32 endpoints per device). ++ */ ++#define dwc_ep_addr_to_endpoint(_bEndpointAddress_) ((_bEndpointAddress_ & USB_ENDPOINT_NUMBER_MASK) | \ ++ ((_bEndpointAddress_ & USB_DIR_IN) != 0) << 4) ++ ++static const char dwc_otg_hcd_name[] = "dwc_otg_hcd"; ++ ++extern bool fiq_enable; ++ ++/** @name Linux HC Driver API Functions */ ++/** @{ */ ++/* manage i/o requests, device state */ ++static int dwc_otg_urb_enqueue(struct usb_hcd *hcd, ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) ++ struct usb_host_endpoint *ep, ++#endif ++ struct urb *urb, gfp_t mem_flags); ++ ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30) ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) ++static int dwc_otg_urb_dequeue(struct usb_hcd *hcd, struct urb *urb); ++#endif ++#else /* kernels at or post 2.6.30 */ ++static int dwc_otg_urb_dequeue(struct usb_hcd *hcd, ++ struct urb *urb, int status); ++#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30) */ ++ ++static void endpoint_disable(struct usb_hcd *hcd, struct usb_host_endpoint *ep); ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,30) ++static void endpoint_reset(struct usb_hcd *hcd, struct usb_host_endpoint *ep); ++#endif ++static irqreturn_t dwc_otg_hcd_irq(struct usb_hcd *hcd); ++extern int hcd_start(struct usb_hcd *hcd); ++extern void hcd_stop(struct usb_hcd *hcd); ++static int get_frame_number(struct usb_hcd *hcd); ++extern int hub_status_data(struct usb_hcd *hcd, char *buf); ++extern int hub_control(struct usb_hcd *hcd, ++ u16 typeReq, ++ u16 wValue, u16 wIndex, char *buf, u16 wLength); ++ ++struct wrapper_priv_data { ++ dwc_otg_hcd_t *dwc_otg_hcd; ++}; ++ ++/** @} */ ++ ++static struct hc_driver dwc_otg_hc_driver = { ++ ++ .description = dwc_otg_hcd_name, ++ .product_desc = "DWC OTG Controller", ++ .hcd_priv_size = sizeof(struct wrapper_priv_data), ++ ++ .irq = dwc_otg_hcd_irq, ++ ++ .flags = HCD_MEMORY | HCD_USB2, ++ ++ //.reset = ++ .start = hcd_start, ++ //.suspend = ++ //.resume = ++ .stop = hcd_stop, ++ ++ .urb_enqueue = dwc_otg_urb_enqueue, ++ .urb_dequeue = dwc_otg_urb_dequeue, ++ .endpoint_disable = endpoint_disable, ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,30) ++ .endpoint_reset = endpoint_reset, ++#endif ++ .get_frame_number = get_frame_number, ++ ++ .hub_status_data = hub_status_data, ++ .hub_control = hub_control, ++ //.bus_suspend = ++ //.bus_resume = ++}; ++ ++/** Gets the dwc_otg_hcd from a struct usb_hcd */ ++static inline dwc_otg_hcd_t *hcd_to_dwc_otg_hcd(struct usb_hcd *hcd) ++{ ++ struct wrapper_priv_data *p; ++ p = (struct wrapper_priv_data *)(hcd->hcd_priv); ++ return p->dwc_otg_hcd; ++} ++ ++/** Gets the struct usb_hcd that contains a dwc_otg_hcd_t. */ ++static inline struct usb_hcd *dwc_otg_hcd_to_hcd(dwc_otg_hcd_t * dwc_otg_hcd) ++{ ++ return dwc_otg_hcd_get_priv_data(dwc_otg_hcd); ++} ++ ++/** Gets the usb_host_endpoint associated with an URB. */ ++inline struct usb_host_endpoint *dwc_urb_to_endpoint(struct urb *urb) ++{ ++ struct usb_device *dev = urb->dev; ++ int ep_num = usb_pipeendpoint(urb->pipe); ++ ++ if (usb_pipein(urb->pipe)) ++ return dev->ep_in[ep_num]; ++ else ++ return dev->ep_out[ep_num]; ++} ++ ++static int _disconnect(dwc_otg_hcd_t * hcd) ++{ ++ struct usb_hcd *usb_hcd = dwc_otg_hcd_to_hcd(hcd); ++ ++ usb_hcd->self.is_b_host = 0; ++ return 0; ++} ++ ++static int _start(dwc_otg_hcd_t * hcd) ++{ ++ struct usb_hcd *usb_hcd = dwc_otg_hcd_to_hcd(hcd); ++ ++ usb_hcd->self.is_b_host = dwc_otg_hcd_is_b_host(hcd); ++ hcd_start(usb_hcd); ++ ++ return 0; ++} ++ ++static int _hub_info(dwc_otg_hcd_t * hcd, void *urb_handle, uint32_t * hub_addr, ++ uint32_t * port_addr) ++{ ++ struct urb *urb = (struct urb *)urb_handle; ++ struct usb_bus *bus; ++#if 1 //GRAYG - temporary ++ if (NULL == urb_handle) ++ DWC_ERROR("**** %s - NULL URB handle\n", __func__);//GRAYG ++ if (NULL == urb->dev) ++ DWC_ERROR("**** %s - URB has no device\n", __func__);//GRAYG ++ if (NULL == port_addr) ++ DWC_ERROR("**** %s - NULL port_address\n", __func__);//GRAYG ++#endif ++ if (urb->dev->tt) { ++ if (NULL == urb->dev->tt->hub) { ++ DWC_ERROR("**** %s - (URB's transactor has no TT - giving no hub)\n", ++ __func__); //GRAYG ++ //*hub_addr = (u8)usb_pipedevice(urb->pipe); //GRAYG ++ *hub_addr = 0; //GRAYG ++ // we probably shouldn't have a transaction translator if ++ // there's no associated hub? ++ } else { ++ bus = hcd_to_bus(dwc_otg_hcd_to_hcd(hcd)); ++ if (urb->dev->tt->hub == bus->root_hub) ++ *hub_addr = 0; ++ else ++ *hub_addr = urb->dev->tt->hub->devnum; ++ } ++ *port_addr = urb->dev->tt->multi ? urb->dev->ttport : 1; ++ } else { ++ *hub_addr = 0; ++ *port_addr = urb->dev->ttport; ++ } ++ return 0; ++} ++ ++static int _speed(dwc_otg_hcd_t * hcd, void *urb_handle) ++{ ++ struct urb *urb = (struct urb *)urb_handle; ++ return urb->dev->speed; ++} ++ ++static int _get_b_hnp_enable(dwc_otg_hcd_t * hcd) ++{ ++ struct usb_hcd *usb_hcd = dwc_otg_hcd_to_hcd(hcd); ++ return usb_hcd->self.b_hnp_enable; ++} ++ ++static void allocate_bus_bandwidth(struct usb_hcd *hcd, uint32_t bw, ++ struct urb *urb) ++{ ++ hcd_to_bus(hcd)->bandwidth_allocated += bw / urb->interval; ++ if (usb_pipetype(urb->pipe) == PIPE_ISOCHRONOUS) { ++ hcd_to_bus(hcd)->bandwidth_isoc_reqs++; ++ } else { ++ hcd_to_bus(hcd)->bandwidth_int_reqs++; ++ } ++} ++ ++static void free_bus_bandwidth(struct usb_hcd *hcd, uint32_t bw, ++ struct urb *urb) ++{ ++ hcd_to_bus(hcd)->bandwidth_allocated -= bw / urb->interval; ++ if (usb_pipetype(urb->pipe) == PIPE_ISOCHRONOUS) { ++ hcd_to_bus(hcd)->bandwidth_isoc_reqs--; ++ } else { ++ hcd_to_bus(hcd)->bandwidth_int_reqs--; ++ } ++} ++ ++/** ++ * Sets the final status of an URB and returns it to the device driver. Any ++ * required cleanup of the URB is performed. The HCD lock should be held on ++ * entry. ++ */ ++static int _complete(dwc_otg_hcd_t * hcd, void *urb_handle, ++ dwc_otg_hcd_urb_t * dwc_otg_urb, int32_t status) ++{ ++ struct urb *urb = (struct urb *)urb_handle; ++ urb_tq_entry_t *new_entry; ++ int rc = 0; ++ if (CHK_DEBUG_LEVEL(DBG_HCDV | DBG_HCD_URB)) { ++ DWC_PRINTF("%s: urb %p, device %d, ep %d %s, status=%d\n", ++ __func__, urb, usb_pipedevice(urb->pipe), ++ usb_pipeendpoint(urb->pipe), ++ usb_pipein(urb->pipe) ? "IN" : "OUT", status); ++ if (usb_pipetype(urb->pipe) == PIPE_ISOCHRONOUS) { ++ int i; ++ for (i = 0; i < urb->number_of_packets; i++) { ++ DWC_PRINTF(" ISO Desc %d status: %d\n", ++ i, urb->iso_frame_desc[i].status); ++ } ++ } ++ } ++ new_entry = DWC_ALLOC_ATOMIC(sizeof(urb_tq_entry_t)); ++ urb->actual_length = dwc_otg_hcd_urb_get_actual_length(dwc_otg_urb); ++ /* Convert status value. */ ++ switch (status) { ++ case -DWC_E_PROTOCOL: ++ status = -EPROTO; ++ break; ++ case -DWC_E_IN_PROGRESS: ++ status = -EINPROGRESS; ++ break; ++ case -DWC_E_PIPE: ++ status = -EPIPE; ++ break; ++ case -DWC_E_IO: ++ status = -EIO; ++ break; ++ case -DWC_E_TIMEOUT: ++ status = -ETIMEDOUT; ++ break; ++ case -DWC_E_OVERFLOW: ++ status = -EOVERFLOW; ++ break; ++ case -DWC_E_SHUTDOWN: ++ status = -ESHUTDOWN; ++ break; ++ default: ++ if (status) { ++ DWC_PRINTF("Uknown urb status %d\n", status); ++ ++ } ++ } ++ ++ if (usb_pipetype(urb->pipe) == PIPE_ISOCHRONOUS) { ++ int i; ++ ++ urb->error_count = dwc_otg_hcd_urb_get_error_count(dwc_otg_urb); ++ for (i = 0; i < urb->number_of_packets; ++i) { ++ urb->iso_frame_desc[i].actual_length = ++ dwc_otg_hcd_urb_get_iso_desc_actual_length ++ (dwc_otg_urb, i); ++ urb->iso_frame_desc[i].status = ++ dwc_otg_hcd_urb_get_iso_desc_status(dwc_otg_urb, i); ++ } ++ } ++ ++ urb->status = status; ++ urb->hcpriv = NULL; ++ if (!status) { ++ if ((urb->transfer_flags & URB_SHORT_NOT_OK) && ++ (urb->actual_length < urb->transfer_buffer_length)) { ++ urb->status = -EREMOTEIO; ++ } ++ } ++ ++ if ((usb_pipetype(urb->pipe) == PIPE_ISOCHRONOUS) || ++ (usb_pipetype(urb->pipe) == PIPE_INTERRUPT)) { ++ struct usb_host_endpoint *ep = dwc_urb_to_endpoint(urb); ++ if (ep) { ++ free_bus_bandwidth(dwc_otg_hcd_to_hcd(hcd), ++ dwc_otg_hcd_get_ep_bandwidth(hcd, ++ ep->hcpriv), ++ urb); ++ } ++ } ++ DWC_FREE(dwc_otg_urb); ++ if (!new_entry) { ++ DWC_ERROR("dwc_otg_hcd: complete: cannot allocate URB TQ entry\n"); ++ urb->status = -EPROTO; ++ /* don't schedule the tasklet - ++ * directly return the packet here with error. */ ++#if USB_URB_EP_LINKING ++ usb_hcd_unlink_urb_from_ep(dwc_otg_hcd_to_hcd(hcd), urb); ++#endif ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) ++ usb_hcd_giveback_urb(dwc_otg_hcd_to_hcd(hcd), urb); ++#else ++ usb_hcd_giveback_urb(dwc_otg_hcd_to_hcd(hcd), urb, urb->status); ++#endif ++ } else { ++ new_entry->urb = urb; ++#if USB_URB_EP_LINKING ++ rc = usb_hcd_check_unlink_urb(dwc_otg_hcd_to_hcd(hcd), urb, urb->status); ++ if(0 == rc) { ++ usb_hcd_unlink_urb_from_ep(dwc_otg_hcd_to_hcd(hcd), urb); ++ } ++#endif ++ if(0 == rc) { ++ DWC_TAILQ_INSERT_TAIL(&hcd->completed_urb_list, new_entry, ++ urb_tq_entries); ++ DWC_TASK_HI_SCHEDULE(hcd->completion_tasklet); ++ } ++ } ++ return 0; ++} ++ ++static struct dwc_otg_hcd_function_ops hcd_fops = { ++ .start = _start, ++ .disconnect = _disconnect, ++ .hub_info = _hub_info, ++ .speed = _speed, ++ .complete = _complete, ++ .get_b_hnp_enable = _get_b_hnp_enable, ++}; ++ ++static struct fiq_handler fh = { ++ .name = "usb_fiq", ++}; ++ ++static void hcd_init_fiq(void *cookie) ++{ ++ dwc_otg_device_t *otg_dev = cookie; ++ dwc_otg_hcd_t *dwc_otg_hcd = otg_dev->hcd; ++ struct pt_regs regs; ++ int irq; ++ ++ if (claim_fiq(&fh)) { ++ DWC_ERROR("Can't claim FIQ"); ++ BUG(); ++ } ++ DWC_WARN("FIQ on core %d at 0x%08x", ++ smp_processor_id(), ++ (fiq_fsm_enable ? (int)&dwc_otg_fiq_fsm : (int)&dwc_otg_fiq_nop)); ++ DWC_WARN("FIQ ASM at 0x%08x length %d", (int)&_dwc_otg_fiq_stub, (int)(&_dwc_otg_fiq_stub_end - &_dwc_otg_fiq_stub)); ++ set_fiq_handler((void *) &_dwc_otg_fiq_stub, &_dwc_otg_fiq_stub_end - &_dwc_otg_fiq_stub); ++ memset(&regs,0,sizeof(regs)); ++ ++ regs.ARM_r8 = (long) dwc_otg_hcd->fiq_state; ++ if (fiq_fsm_enable) { ++ regs.ARM_r9 = dwc_otg_hcd->core_if->core_params->host_channels; ++ //regs.ARM_r10 = dwc_otg_hcd->dma; ++ regs.ARM_fp = (long) dwc_otg_fiq_fsm; ++ } else { ++ regs.ARM_fp = (long) dwc_otg_fiq_nop; ++ } ++ ++ regs.ARM_sp = (long) dwc_otg_hcd->fiq_stack + (sizeof(struct fiq_stack) - 4); ++ ++// __show_regs(&regs); ++ set_fiq_regs(&regs); ++ ++ //Set the mphi periph to the required registers ++ dwc_otg_hcd->fiq_state->mphi_regs.base = otg_dev->os_dep.mphi_base; ++ dwc_otg_hcd->fiq_state->mphi_regs.ctrl = otg_dev->os_dep.mphi_base + 0x4c; ++ dwc_otg_hcd->fiq_state->mphi_regs.outdda = otg_dev->os_dep.mphi_base + 0x28; ++ dwc_otg_hcd->fiq_state->mphi_regs.outddb = otg_dev->os_dep.mphi_base + 0x2c; ++ dwc_otg_hcd->fiq_state->mphi_regs.intstat = otg_dev->os_dep.mphi_base + 0x50; ++ dwc_otg_hcd->fiq_state->dwc_regs_base = otg_dev->os_dep.base; ++ DWC_WARN("MPHI regs_base at 0x%08x", (int)dwc_otg_hcd->fiq_state->mphi_regs.base); ++ //Enable mphi peripheral ++ writel((1<<31),dwc_otg_hcd->fiq_state->mphi_regs.ctrl); ++#ifdef DEBUG ++ if (readl(dwc_otg_hcd->fiq_state->mphi_regs.ctrl) & 0x80000000) ++ DWC_WARN("MPHI periph has been enabled"); ++ else ++ DWC_WARN("MPHI periph has NOT been enabled"); ++#endif ++ // Enable FIQ interrupt from USB peripheral ++#ifdef CONFIG_MULTI_IRQ_HANDLER ++ irq = platform_get_irq(otg_dev->os_dep.platformdev, 1); ++#else ++ irq = INTERRUPT_VC_USB; ++#endif ++ if (irq < 0) { ++ DWC_ERROR("Can't get FIQ irq"); ++ return; ++ } ++ enable_fiq(irq); ++ local_fiq_enable(); ++} ++ ++/** ++ * Initializes the HCD. This function allocates memory for and initializes the ++ * static parts of the usb_hcd and dwc_otg_hcd structures. It also registers the ++ * USB bus with the core and calls the hc_driver->start() function. It returns ++ * a negative error on failure. ++ */ ++int hcd_init(dwc_bus_dev_t *_dev) ++{ ++ struct usb_hcd *hcd = NULL; ++ dwc_otg_hcd_t *dwc_otg_hcd = NULL; ++ dwc_otg_device_t *otg_dev = DWC_OTG_BUSDRVDATA(_dev); ++ int retval = 0; ++ u64 dmamask; ++ ++ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD INIT otg_dev=%p\n", otg_dev); ++ ++ /* Set device flags indicating whether the HCD supports DMA. */ ++ if (dwc_otg_is_dma_enable(otg_dev->core_if)) ++ dmamask = DMA_BIT_MASK(32); ++ else ++ dmamask = 0; ++ ++#if defined(LM_INTERFACE) || defined(PLATFORM_INTERFACE) ++ dma_set_mask(&_dev->dev, dmamask); ++ dma_set_coherent_mask(&_dev->dev, dmamask); ++#elif defined(PCI_INTERFACE) ++ pci_set_dma_mask(_dev, dmamask); ++ pci_set_consistent_dma_mask(_dev, dmamask); ++#endif ++ ++ /* ++ * Allocate memory for the base HCD plus the DWC OTG HCD. ++ * Initialize the base HCD. ++ */ ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30) ++ hcd = usb_create_hcd(&dwc_otg_hc_driver, &_dev->dev, _dev->dev.bus_id); ++#else ++ hcd = usb_create_hcd(&dwc_otg_hc_driver, &_dev->dev, dev_name(&_dev->dev)); ++ hcd->has_tt = 1; ++// hcd->uses_new_polling = 1; ++// hcd->poll_rh = 0; ++#endif ++ if (!hcd) { ++ retval = -ENOMEM; ++ goto error1; ++ } ++ ++ hcd->regs = otg_dev->os_dep.base; ++ ++ ++ /* Initialize the DWC OTG HCD. */ ++ dwc_otg_hcd = dwc_otg_hcd_alloc_hcd(); ++ if (!dwc_otg_hcd) { ++ goto error2; ++ } ++ ((struct wrapper_priv_data *)(hcd->hcd_priv))->dwc_otg_hcd = ++ dwc_otg_hcd; ++ otg_dev->hcd = dwc_otg_hcd; ++ ++ if (dwc_otg_hcd_init(dwc_otg_hcd, otg_dev->core_if)) { ++ goto error2; ++ } ++ ++ if (fiq_enable) { ++ if (num_online_cpus() > 1) { ++ /* bcm2709: can run the FIQ on a separate core to IRQs */ ++ smp_call_function_single(1, hcd_init_fiq, otg_dev, 1); ++ } else { ++ smp_call_function_single(0, hcd_init_fiq, otg_dev, 1); ++ } ++ } ++ ++ otg_dev->hcd->otg_dev = otg_dev; ++ hcd->self.otg_port = dwc_otg_hcd_otg_port(dwc_otg_hcd); ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33) //don't support for LM(with 2.6.20.1 kernel) ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35) //version field absent later ++ hcd->self.otg_version = dwc_otg_get_otg_version(otg_dev->core_if); ++#endif ++ /* Don't support SG list at this point */ ++ hcd->self.sg_tablesize = 0; ++#endif ++ /* ++ * Finish generic HCD initialization and start the HCD. This function ++ * allocates the DMA buffer pool, registers the USB bus, requests the ++ * IRQ line, and calls hcd_start method. ++ */ ++#ifdef PLATFORM_INTERFACE ++ retval = usb_add_hcd(hcd, platform_get_irq(_dev, fiq_enable ? 0 : 1), IRQF_SHARED); ++#else ++ retval = usb_add_hcd(hcd, _dev->irq, IRQF_SHARED); ++#endif ++ if (retval < 0) { ++ goto error2; ++ } ++ ++ dwc_otg_hcd_set_priv_data(dwc_otg_hcd, hcd); ++ return 0; ++ ++error2: ++ usb_put_hcd(hcd); ++error1: ++ return retval; ++} ++ ++/** ++ * Removes the HCD. ++ * Frees memory and resources associated with the HCD and deregisters the bus. ++ */ ++void hcd_remove(dwc_bus_dev_t *_dev) ++{ ++ dwc_otg_device_t *otg_dev = DWC_OTG_BUSDRVDATA(_dev); ++ dwc_otg_hcd_t *dwc_otg_hcd; ++ struct usb_hcd *hcd; ++ ++ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD REMOVE otg_dev=%p\n", otg_dev); ++ ++ if (!otg_dev) { ++ DWC_DEBUGPL(DBG_ANY, "%s: otg_dev NULL!\n", __func__); ++ return; ++ } ++ ++ dwc_otg_hcd = otg_dev->hcd; ++ ++ if (!dwc_otg_hcd) { ++ DWC_DEBUGPL(DBG_ANY, "%s: otg_dev->hcd NULL!\n", __func__); ++ return; ++ } ++ ++ hcd = dwc_otg_hcd_to_hcd(dwc_otg_hcd); ++ ++ if (!hcd) { ++ DWC_DEBUGPL(DBG_ANY, ++ "%s: dwc_otg_hcd_to_hcd(dwc_otg_hcd) NULL!\n", ++ __func__); ++ return; ++ } ++ usb_remove_hcd(hcd); ++ dwc_otg_hcd_set_priv_data(dwc_otg_hcd, NULL); ++ dwc_otg_hcd_remove(dwc_otg_hcd); ++ usb_put_hcd(hcd); ++} ++ ++/* ========================================================================= ++ * Linux HC Driver Functions ++ * ========================================================================= */ ++ ++/** Initializes the DWC_otg controller and its root hub and prepares it for host ++ * mode operation. Activates the root port. Returns 0 on success and a negative ++ * error code on failure. */ ++int hcd_start(struct usb_hcd *hcd) ++{ ++ dwc_otg_hcd_t *dwc_otg_hcd = hcd_to_dwc_otg_hcd(hcd); ++ struct usb_bus *bus; ++ ++ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD START\n"); ++ bus = hcd_to_bus(hcd); ++ ++ hcd->state = HC_STATE_RUNNING; ++ if (dwc_otg_hcd_start(dwc_otg_hcd, &hcd_fops)) { ++ return 0; ++ } ++ ++ /* Initialize and connect root hub if one is not already attached */ ++ if (bus->root_hub) { ++ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD Has Root Hub\n"); ++ /* Inform the HUB driver to resume. */ ++ usb_hcd_resume_root_hub(hcd); ++ } ++ ++ return 0; ++} ++ ++/** ++ * Halts the DWC_otg host mode operations in a clean manner. USB transfers are ++ * stopped. ++ */ ++void hcd_stop(struct usb_hcd *hcd) ++{ ++ dwc_otg_hcd_t *dwc_otg_hcd = hcd_to_dwc_otg_hcd(hcd); ++ ++ dwc_otg_hcd_stop(dwc_otg_hcd); ++} ++ ++/** Returns the current frame number. */ ++static int get_frame_number(struct usb_hcd *hcd) ++{ ++ hprt0_data_t hprt0; ++ dwc_otg_hcd_t *dwc_otg_hcd = hcd_to_dwc_otg_hcd(hcd); ++ hprt0.d32 = DWC_READ_REG32(dwc_otg_hcd->core_if->host_if->hprt0); ++ if (hprt0.b.prtspd == DWC_HPRT0_PRTSPD_HIGH_SPEED) ++ return dwc_otg_hcd_get_frame_number(dwc_otg_hcd) >> 3; ++ else ++ return dwc_otg_hcd_get_frame_number(dwc_otg_hcd); ++} ++ ++#ifdef DEBUG ++static void dump_urb_info(struct urb *urb, char *fn_name) ++{ ++ DWC_PRINTF("%s, urb %p\n", fn_name, urb); ++ DWC_PRINTF(" Device address: %d\n", usb_pipedevice(urb->pipe)); ++ DWC_PRINTF(" Endpoint: %d, %s\n", usb_pipeendpoint(urb->pipe), ++ (usb_pipein(urb->pipe) ? "IN" : "OUT")); ++ DWC_PRINTF(" Endpoint type: %s\n", ( { ++ char *pipetype; ++ switch (usb_pipetype(urb->pipe)) { ++case PIPE_CONTROL: ++pipetype = "CONTROL"; break; case PIPE_BULK: ++pipetype = "BULK"; break; case PIPE_INTERRUPT: ++pipetype = "INTERRUPT"; break; case PIPE_ISOCHRONOUS: ++pipetype = "ISOCHRONOUS"; break; default: ++ pipetype = "UNKNOWN"; break;}; ++ pipetype;} ++ )) ; ++ DWC_PRINTF(" Speed: %s\n", ( { ++ char *speed; switch (urb->dev->speed) { ++case USB_SPEED_HIGH: ++speed = "HIGH"; break; case USB_SPEED_FULL: ++speed = "FULL"; break; case USB_SPEED_LOW: ++speed = "LOW"; break; default: ++ speed = "UNKNOWN"; break;}; ++ speed;} ++ )) ; ++ DWC_PRINTF(" Max packet size: %d\n", ++ usb_maxpacket(urb->dev, urb->pipe, usb_pipeout(urb->pipe))); ++ DWC_PRINTF(" Data buffer length: %d\n", urb->transfer_buffer_length); ++ DWC_PRINTF(" Transfer buffer: %p, Transfer DMA: %p\n", ++ urb->transfer_buffer, (void *)urb->transfer_dma); ++ DWC_PRINTF(" Setup buffer: %p, Setup DMA: %p\n", ++ urb->setup_packet, (void *)urb->setup_dma); ++ DWC_PRINTF(" Interval: %d\n", urb->interval); ++ if (usb_pipetype(urb->pipe) == PIPE_ISOCHRONOUS) { ++ int i; ++ for (i = 0; i < urb->number_of_packets; i++) { ++ DWC_PRINTF(" ISO Desc %d:\n", i); ++ DWC_PRINTF(" offset: %d, length %d\n", ++ urb->iso_frame_desc[i].offset, ++ urb->iso_frame_desc[i].length); ++ } ++ } ++} ++#endif ++ ++/** Starts processing a USB transfer request specified by a USB Request Block ++ * (URB). mem_flags indicates the type of memory allocation to use while ++ * processing this URB. */ ++static int dwc_otg_urb_enqueue(struct usb_hcd *hcd, ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) ++ struct usb_host_endpoint *ep, ++#endif ++ struct urb *urb, gfp_t mem_flags) ++{ ++ int retval = 0; ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28) ++ struct usb_host_endpoint *ep = urb->ep; ++#endif ++ dwc_irqflags_t irqflags; ++ void **ref_ep_hcpriv = &ep->hcpriv; ++ dwc_otg_hcd_t *dwc_otg_hcd = hcd_to_dwc_otg_hcd(hcd); ++ dwc_otg_hcd_urb_t *dwc_otg_urb; ++ int i; ++ int alloc_bandwidth = 0; ++ uint8_t ep_type = 0; ++ uint32_t flags = 0; ++ void *buf; ++ ++#ifdef DEBUG ++ if (CHK_DEBUG_LEVEL(DBG_HCDV | DBG_HCD_URB)) { ++ dump_urb_info(urb, "dwc_otg_urb_enqueue"); ++ } ++#endif ++ ++ if (!urb->transfer_buffer && urb->transfer_buffer_length) ++ return -EINVAL; ++ ++ if ((usb_pipetype(urb->pipe) == PIPE_ISOCHRONOUS) ++ || (usb_pipetype(urb->pipe) == PIPE_INTERRUPT)) { ++ if (!dwc_otg_hcd_is_bandwidth_allocated ++ (dwc_otg_hcd, ref_ep_hcpriv)) { ++ alloc_bandwidth = 1; ++ } ++ } ++ ++ switch (usb_pipetype(urb->pipe)) { ++ case PIPE_CONTROL: ++ ep_type = USB_ENDPOINT_XFER_CONTROL; ++ break; ++ case PIPE_ISOCHRONOUS: ++ ep_type = USB_ENDPOINT_XFER_ISOC; ++ break; ++ case PIPE_BULK: ++ ep_type = USB_ENDPOINT_XFER_BULK; ++ break; ++ case PIPE_INTERRUPT: ++ ep_type = USB_ENDPOINT_XFER_INT; ++ break; ++ default: ++ DWC_WARN("Wrong EP type - %d\n", usb_pipetype(urb->pipe)); ++ } ++ ++ /* # of packets is often 0 - do we really need to call this then? */ ++ dwc_otg_urb = dwc_otg_hcd_urb_alloc(dwc_otg_hcd, ++ urb->number_of_packets, ++ mem_flags == GFP_ATOMIC ? 1 : 0); ++ ++ if(dwc_otg_urb == NULL) ++ return -ENOMEM; ++ ++ if (!dwc_otg_urb && urb->number_of_packets) ++ return -ENOMEM; ++ ++ dwc_otg_hcd_urb_set_pipeinfo(dwc_otg_urb, usb_pipedevice(urb->pipe), ++ usb_pipeendpoint(urb->pipe), ep_type, ++ usb_pipein(urb->pipe), ++ usb_maxpacket(urb->dev, urb->pipe, ++ !(usb_pipein(urb->pipe)))); ++ ++ buf = urb->transfer_buffer; ++ if (hcd->self.uses_dma && !buf && urb->transfer_buffer_length) { ++ /* ++ * Calculate virtual address from physical address, ++ * because some class driver may not fill transfer_buffer. ++ * In Buffer DMA mode virual address is used, ++ * when handling non DWORD aligned buffers. ++ */ ++ buf = (void *)__bus_to_virt((unsigned long)urb->transfer_dma); ++ dev_warn_once(&urb->dev->dev, ++ "USB transfer_buffer was NULL, will use __bus_to_virt(%pad)=%p\n", ++ &urb->transfer_dma, buf); ++ } ++ ++ if (!(urb->transfer_flags & URB_NO_INTERRUPT)) ++ flags |= URB_GIVEBACK_ASAP; ++ if (urb->transfer_flags & URB_ZERO_PACKET) ++ flags |= URB_SEND_ZERO_PACKET; ++ ++ dwc_otg_hcd_urb_set_params(dwc_otg_urb, urb, buf, ++ urb->transfer_dma, ++ urb->transfer_buffer_length, ++ urb->setup_packet, ++ urb->setup_dma, flags, urb->interval); ++ ++ for (i = 0; i < urb->number_of_packets; ++i) { ++ dwc_otg_hcd_urb_set_iso_desc_params(dwc_otg_urb, i, ++ urb-> ++ iso_frame_desc[i].offset, ++ urb-> ++ iso_frame_desc[i].length); ++ } ++ ++ DWC_SPINLOCK_IRQSAVE(dwc_otg_hcd->lock, &irqflags); ++ urb->hcpriv = dwc_otg_urb; ++#if USB_URB_EP_LINKING ++ retval = usb_hcd_link_urb_to_ep(hcd, urb); ++ if (0 == retval) ++#endif ++ { ++ retval = dwc_otg_hcd_urb_enqueue(dwc_otg_hcd, dwc_otg_urb, ++ /*(dwc_otg_qh_t **)*/ ++ ref_ep_hcpriv, 1); ++ if (0 == retval) { ++ if (alloc_bandwidth) { ++ allocate_bus_bandwidth(hcd, ++ dwc_otg_hcd_get_ep_bandwidth( ++ dwc_otg_hcd, *ref_ep_hcpriv), ++ urb); ++ } ++ } else { ++ DWC_DEBUGPL(DBG_HCD, "DWC OTG dwc_otg_hcd_urb_enqueue failed rc %d\n", retval); ++#if USB_URB_EP_LINKING ++ usb_hcd_unlink_urb_from_ep(hcd, urb); ++#endif ++ DWC_FREE(dwc_otg_urb); ++ urb->hcpriv = NULL; ++ if (retval == -DWC_E_NO_DEVICE) ++ retval = -ENODEV; ++ } ++ } ++#if USB_URB_EP_LINKING ++ else ++ { ++ DWC_FREE(dwc_otg_urb); ++ urb->hcpriv = NULL; ++ } ++#endif ++ DWC_SPINUNLOCK_IRQRESTORE(dwc_otg_hcd->lock, irqflags); ++ return retval; ++} ++ ++/** Aborts/cancels a USB transfer request. Always returns 0 to indicate ++ * success. */ ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) ++static int dwc_otg_urb_dequeue(struct usb_hcd *hcd, struct urb *urb) ++#else ++static int dwc_otg_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status) ++#endif ++{ ++ dwc_irqflags_t flags; ++ dwc_otg_hcd_t *dwc_otg_hcd; ++ int rc; ++ ++ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD URB Dequeue\n"); ++ ++ dwc_otg_hcd = hcd_to_dwc_otg_hcd(hcd); ++ ++#ifdef DEBUG ++ if (CHK_DEBUG_LEVEL(DBG_HCDV | DBG_HCD_URB)) { ++ dump_urb_info(urb, "dwc_otg_urb_dequeue"); ++ } ++#endif ++ ++ DWC_SPINLOCK_IRQSAVE(dwc_otg_hcd->lock, &flags); ++ rc = usb_hcd_check_unlink_urb(hcd, urb, status); ++ if (0 == rc) { ++ if(urb->hcpriv != NULL) { ++ dwc_otg_hcd_urb_dequeue(dwc_otg_hcd, ++ (dwc_otg_hcd_urb_t *)urb->hcpriv); ++ ++ DWC_FREE(urb->hcpriv); ++ urb->hcpriv = NULL; ++ } ++ } ++ ++ if (0 == rc) { ++ /* Higher layer software sets URB status. */ ++#if USB_URB_EP_LINKING ++ usb_hcd_unlink_urb_from_ep(hcd, urb); ++#endif ++ DWC_SPINUNLOCK_IRQRESTORE(dwc_otg_hcd->lock, flags); ++ ++ ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) ++ usb_hcd_giveback_urb(hcd, urb); ++#else ++ usb_hcd_giveback_urb(hcd, urb, status); ++#endif ++ if (CHK_DEBUG_LEVEL(DBG_HCDV | DBG_HCD_URB)) { ++ DWC_PRINTF("Called usb_hcd_giveback_urb() \n"); ++ DWC_PRINTF(" 1urb->status = %d\n", urb->status); ++ } ++ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD URB Dequeue OK\n"); ++ } else { ++ DWC_SPINUNLOCK_IRQRESTORE(dwc_otg_hcd->lock, flags); ++ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD URB Dequeue failed - rc %d\n", ++ rc); ++ } ++ ++ return rc; ++} ++ ++/* Frees resources in the DWC_otg controller related to a given endpoint. Also ++ * clears state in the HCD related to the endpoint. Any URBs for the endpoint ++ * must already be dequeued. */ ++static void endpoint_disable(struct usb_hcd *hcd, struct usb_host_endpoint *ep) ++{ ++ dwc_otg_hcd_t *dwc_otg_hcd = hcd_to_dwc_otg_hcd(hcd); ++ ++ DWC_DEBUGPL(DBG_HCD, ++ "DWC OTG HCD EP DISABLE: _bEndpointAddress=0x%02x, " ++ "endpoint=%d\n", ep->desc.bEndpointAddress, ++ dwc_ep_addr_to_endpoint(ep->desc.bEndpointAddress)); ++ dwc_otg_hcd_endpoint_disable(dwc_otg_hcd, ep->hcpriv, 250); ++ ep->hcpriv = NULL; ++} ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,30) ++/* Resets endpoint specific parameter values, in current version used to reset ++ * the data toggle(as a WA). This function can be called from usb_clear_halt routine */ ++static void endpoint_reset(struct usb_hcd *hcd, struct usb_host_endpoint *ep) ++{ ++ dwc_irqflags_t flags; ++ struct usb_device *udev = NULL; ++ int epnum = usb_endpoint_num(&ep->desc); ++ int is_out = usb_endpoint_dir_out(&ep->desc); ++ int is_control = usb_endpoint_xfer_control(&ep->desc); ++ dwc_otg_hcd_t *dwc_otg_hcd = hcd_to_dwc_otg_hcd(hcd); ++ struct device *dev = DWC_OTG_OS_GETDEV(dwc_otg_hcd->otg_dev->os_dep); ++ ++ if (dev) ++ udev = to_usb_device(dev); ++ else ++ return; ++ ++ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD EP RESET: Endpoint Num=0x%02d\n", epnum); ++ ++ DWC_SPINLOCK_IRQSAVE(dwc_otg_hcd->lock, &flags); ++ usb_settoggle(udev, epnum, is_out, 0); ++ if (is_control) ++ usb_settoggle(udev, epnum, !is_out, 0); ++ ++ if (ep->hcpriv) { ++ dwc_otg_hcd_endpoint_reset(dwc_otg_hcd, ep->hcpriv); ++ } ++ DWC_SPINUNLOCK_IRQRESTORE(dwc_otg_hcd->lock, flags); ++} ++#endif ++ ++/** Handles host mode interrupts for the DWC_otg controller. Returns IRQ_NONE if ++ * there was no interrupt to handle. Returns IRQ_HANDLED if there was a valid ++ * interrupt. ++ * ++ * This function is called by the USB core when an interrupt occurs */ ++static irqreturn_t dwc_otg_hcd_irq(struct usb_hcd *hcd) ++{ ++ dwc_otg_hcd_t *dwc_otg_hcd = hcd_to_dwc_otg_hcd(hcd); ++ int32_t retval = dwc_otg_hcd_handle_intr(dwc_otg_hcd); ++ if (retval != 0) { ++ S3C2410X_CLEAR_EINTPEND(); ++ } ++ return IRQ_RETVAL(retval); ++} ++ ++/** Creates Status Change bitmap for the root hub and root port. The bitmap is ++ * returned in buf. Bit 0 is the status change indicator for the root hub. Bit 1 ++ * is the status change indicator for the single root port. Returns 1 if either ++ * change indicator is 1, otherwise returns 0. */ ++int hub_status_data(struct usb_hcd *hcd, char *buf) ++{ ++ dwc_otg_hcd_t *dwc_otg_hcd = hcd_to_dwc_otg_hcd(hcd); ++ ++ buf[0] = 0; ++ buf[0] |= (dwc_otg_hcd_is_status_changed(dwc_otg_hcd, 1)) << 1; ++ ++ return (buf[0] != 0); ++} ++ ++/** Handles hub class-specific requests. */ ++int hub_control(struct usb_hcd *hcd, ++ u16 typeReq, u16 wValue, u16 wIndex, char *buf, u16 wLength) ++{ ++ int retval; ++ ++ retval = dwc_otg_hcd_hub_control(hcd_to_dwc_otg_hcd(hcd), ++ typeReq, wValue, wIndex, buf, wLength); ++ ++ switch (retval) { ++ case -DWC_E_INVALID: ++ retval = -EINVAL; ++ break; ++ } ++ ++ return retval; ++} ++ ++#endif /* DWC_DEVICE_ONLY */ +diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd_queue.c b/drivers/usb/host/dwc_otg/dwc_otg_hcd_queue.c +new file mode 100644 +index 0000000..3b2a607 +--- /dev/null ++++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd_queue.c +@@ -0,0 +1,962 @@ ++/* ========================================================================== ++ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_hcd_queue.c $ ++ * $Revision: #44 $ ++ * $Date: 2011/10/26 $ ++ * $Change: 1873028 $ ++ * ++ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, ++ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless ++ * otherwise expressly agreed to in writing between Synopsys and you. ++ * ++ * The Software IS NOT an item of Licensed Software or Licensed Product under ++ * any End User Software License Agreement or Agreement for Licensed Product ++ * with Synopsys or any supplement thereto. You are permitted to use and ++ * redistribute this Software in source and binary forms, with or without ++ * modification, provided that redistributions of source code must retain this ++ * notice. You may not view, use, disclose, copy or distribute this file or ++ * any information contained herein except pursuant to this license grant from ++ * Synopsys. If you do not agree with this notice, including the disclaimer ++ * below, then you are not authorized to use the Software. ++ * ++ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS ++ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS 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. ++ * ========================================================================== */ ++#ifndef DWC_DEVICE_ONLY ++ ++/** ++ * @file ++ * ++ * This file contains the functions to manage Queue Heads and Queue ++ * Transfer Descriptors. ++ */ ++ ++#include "dwc_otg_hcd.h" ++#include "dwc_otg_regs.h" ++ ++extern bool microframe_schedule; ++ ++/** ++ * Free each QTD in the QH's QTD-list then free the QH. QH should already be ++ * removed from a list. QTD list should already be empty if called from URB ++ * Dequeue. ++ * ++ * @param hcd HCD instance. ++ * @param qh The QH to free. ++ */ ++void dwc_otg_hcd_qh_free(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh) ++{ ++ dwc_otg_qtd_t *qtd, *qtd_tmp; ++ dwc_irqflags_t flags; ++ uint32_t buf_size = 0; ++ uint8_t *align_buf_virt = NULL; ++ dwc_dma_t align_buf_dma; ++ ++ /* Free each QTD in the QTD list */ ++ DWC_SPINLOCK_IRQSAVE(hcd->lock, &flags); ++ DWC_CIRCLEQ_FOREACH_SAFE(qtd, qtd_tmp, &qh->qtd_list, qtd_list_entry) { ++ DWC_CIRCLEQ_REMOVE(&qh->qtd_list, qtd, qtd_list_entry); ++ dwc_otg_hcd_qtd_free(qtd); ++ } ++ ++ if (hcd->core_if->dma_desc_enable) { ++ dwc_otg_hcd_qh_free_ddma(hcd, qh); ++ } else if (qh->dw_align_buf) { ++ if (qh->ep_type == UE_ISOCHRONOUS) { ++ buf_size = 4096; ++ } else { ++ buf_size = hcd->core_if->core_params->max_transfer_size; ++ } ++ align_buf_virt = qh->dw_align_buf; ++ align_buf_dma = qh->dw_align_buf_dma; ++ } ++ ++ DWC_FREE(qh); ++ DWC_SPINUNLOCK_IRQRESTORE(hcd->lock, flags); ++ if (align_buf_virt) ++ DWC_DMA_FREE(buf_size, align_buf_virt, align_buf_dma); ++ return; ++} ++ ++#define BitStuffTime(bytecount) ((8 * 7* bytecount) / 6) ++#define HS_HOST_DELAY 5 /* nanoseconds */ ++#define FS_LS_HOST_DELAY 1000 /* nanoseconds */ ++#define HUB_LS_SETUP 333 /* nanoseconds */ ++#define NS_TO_US(ns) ((ns + 500) / 1000) ++ /* convert & round nanoseconds to microseconds */ ++ ++static uint32_t calc_bus_time(int speed, int is_in, int is_isoc, int bytecount) ++{ ++ unsigned long retval; ++ ++ switch (speed) { ++ case USB_SPEED_HIGH: ++ if (is_isoc) { ++ retval = ++ ((38 * 8 * 2083) + ++ (2083 * (3 + BitStuffTime(bytecount)))) / 1000 + ++ HS_HOST_DELAY; ++ } else { ++ retval = ++ ((55 * 8 * 2083) + ++ (2083 * (3 + BitStuffTime(bytecount)))) / 1000 + ++ HS_HOST_DELAY; ++ } ++ break; ++ case USB_SPEED_FULL: ++ if (is_isoc) { ++ retval = ++ (8354 * (31 + 10 * BitStuffTime(bytecount))) / 1000; ++ if (is_in) { ++ retval = 7268 + FS_LS_HOST_DELAY + retval; ++ } else { ++ retval = 6265 + FS_LS_HOST_DELAY + retval; ++ } ++ } else { ++ retval = ++ (8354 * (31 + 10 * BitStuffTime(bytecount))) / 1000; ++ retval = 9107 + FS_LS_HOST_DELAY + retval; ++ } ++ break; ++ case USB_SPEED_LOW: ++ if (is_in) { ++ retval = ++ (67667 * (31 + 10 * BitStuffTime(bytecount))) / ++ 1000; ++ retval = ++ 64060 + (2 * HUB_LS_SETUP) + FS_LS_HOST_DELAY + ++ retval; ++ } else { ++ retval = ++ (66700 * (31 + 10 * BitStuffTime(bytecount))) / ++ 1000; ++ retval = ++ 64107 + (2 * HUB_LS_SETUP) + FS_LS_HOST_DELAY + ++ retval; ++ } ++ break; ++ default: ++ DWC_WARN("Unknown device speed\n"); ++ retval = -1; ++ } ++ ++ return NS_TO_US(retval); ++} ++ ++/** ++ * Initializes a QH structure. ++ * ++ * @param hcd The HCD state structure for the DWC OTG controller. ++ * @param qh The QH to init. ++ * @param urb Holds the information about the device/endpoint that we need ++ * to initialize the QH. ++ */ ++#define SCHEDULE_SLOP 10 ++void qh_init(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh, dwc_otg_hcd_urb_t * urb) ++{ ++ char *speed, *type; ++ int dev_speed; ++ uint32_t hub_addr, hub_port; ++ ++ dwc_memset(qh, 0, sizeof(dwc_otg_qh_t)); ++ ++ /* Initialize QH */ ++ qh->ep_type = dwc_otg_hcd_get_pipe_type(&urb->pipe_info); ++ qh->ep_is_in = dwc_otg_hcd_is_pipe_in(&urb->pipe_info) ? 1 : 0; ++ ++ qh->data_toggle = DWC_OTG_HC_PID_DATA0; ++ qh->maxp = dwc_otg_hcd_get_mps(&urb->pipe_info); ++ DWC_CIRCLEQ_INIT(&qh->qtd_list); ++ DWC_LIST_INIT(&qh->qh_list_entry); ++ qh->channel = NULL; ++ ++ /* FS/LS Enpoint on HS Hub ++ * NOT virtual root hub */ ++ dev_speed = hcd->fops->speed(hcd, urb->priv); ++ ++ hcd->fops->hub_info(hcd, urb->priv, &hub_addr, &hub_port); ++ qh->do_split = 0; ++ if (microframe_schedule) ++ qh->speed = dev_speed; ++ ++ qh->nak_frame = 0xffff; ++ ++ if (((dev_speed == USB_SPEED_LOW) || ++ (dev_speed == USB_SPEED_FULL)) && ++ (hub_addr != 0 && hub_addr != 1)) { ++ DWC_DEBUGPL(DBG_HCD, ++ "QH init: EP %d: TT found at hub addr %d, for port %d\n", ++ dwc_otg_hcd_get_ep_num(&urb->pipe_info), hub_addr, ++ hub_port); ++ qh->do_split = 1; ++ qh->skip_count = 0; ++ } ++ ++ if (qh->ep_type == UE_INTERRUPT || qh->ep_type == UE_ISOCHRONOUS) { ++ /* Compute scheduling parameters once and save them. */ ++ hprt0_data_t hprt; ++ ++ /** @todo Account for split transfers in the bus time. */ ++ int bytecount = ++ dwc_hb_mult(qh->maxp) * dwc_max_packet(qh->maxp); ++ ++ qh->usecs = ++ calc_bus_time((qh->do_split ? USB_SPEED_HIGH : dev_speed), ++ qh->ep_is_in, (qh->ep_type == UE_ISOCHRONOUS), ++ bytecount); ++ /* Start in a slightly future (micro)frame. */ ++ qh->sched_frame = dwc_frame_num_inc(hcd->frame_number, ++ SCHEDULE_SLOP); ++ qh->interval = urb->interval; ++ ++#if 0 ++ /* Increase interrupt polling rate for debugging. */ ++ if (qh->ep_type == UE_INTERRUPT) { ++ qh->interval = 8; ++ } ++#endif ++ hprt.d32 = DWC_READ_REG32(hcd->core_if->host_if->hprt0); ++ if ((hprt.b.prtspd == DWC_HPRT0_PRTSPD_HIGH_SPEED) && ++ ((dev_speed == USB_SPEED_LOW) || ++ (dev_speed == USB_SPEED_FULL))) { ++ qh->interval *= 8; ++ qh->sched_frame |= 0x7; ++ qh->start_split_frame = qh->sched_frame; ++ } ++ ++ } ++ ++ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD QH Initialized\n"); ++ DWC_DEBUGPL(DBG_HCDV, "DWC OTG HCD QH - qh = %p\n", qh); ++ DWC_DEBUGPL(DBG_HCDV, "DWC OTG HCD QH - Device Address = %d\n", ++ dwc_otg_hcd_get_dev_addr(&urb->pipe_info)); ++ DWC_DEBUGPL(DBG_HCDV, "DWC OTG HCD QH - Endpoint %d, %s\n", ++ dwc_otg_hcd_get_ep_num(&urb->pipe_info), ++ dwc_otg_hcd_is_pipe_in(&urb->pipe_info) ? "IN" : "OUT"); ++ switch (dev_speed) { ++ case USB_SPEED_LOW: ++ qh->dev_speed = DWC_OTG_EP_SPEED_LOW; ++ speed = "low"; ++ break; ++ case USB_SPEED_FULL: ++ qh->dev_speed = DWC_OTG_EP_SPEED_FULL; ++ speed = "full"; ++ break; ++ case USB_SPEED_HIGH: ++ qh->dev_speed = DWC_OTG_EP_SPEED_HIGH; ++ speed = "high"; ++ break; ++ default: ++ speed = "?"; ++ break; ++ } ++ DWC_DEBUGPL(DBG_HCDV, "DWC OTG HCD QH - Speed = %s\n", speed); ++ ++ switch (qh->ep_type) { ++ case UE_ISOCHRONOUS: ++ type = "isochronous"; ++ break; ++ case UE_INTERRUPT: ++ type = "interrupt"; ++ break; ++ case UE_CONTROL: ++ type = "control"; ++ break; ++ case UE_BULK: ++ type = "bulk"; ++ break; ++ default: ++ type = "?"; ++ break; ++ } ++ ++ DWC_DEBUGPL(DBG_HCDV, "DWC OTG HCD QH - Type = %s\n", type); ++ ++#ifdef DEBUG ++ if (qh->ep_type == UE_INTERRUPT) { ++ DWC_DEBUGPL(DBG_HCDV, "DWC OTG HCD QH - usecs = %d\n", ++ qh->usecs); ++ DWC_DEBUGPL(DBG_HCDV, "DWC OTG HCD QH - interval = %d\n", ++ qh->interval); ++ } ++#endif ++ ++} ++ ++/** ++ * This function allocates and initializes a QH. ++ * ++ * @param hcd The HCD state structure for the DWC OTG controller. ++ * @param urb Holds the information about the device/endpoint that we need ++ * to initialize the QH. ++ * @param atomic_alloc Flag to do atomic allocation if needed ++ * ++ * @return Returns pointer to the newly allocated QH, or NULL on error. */ ++dwc_otg_qh_t *dwc_otg_hcd_qh_create(dwc_otg_hcd_t * hcd, ++ dwc_otg_hcd_urb_t * urb, int atomic_alloc) ++{ ++ dwc_otg_qh_t *qh; ++ ++ /* Allocate memory */ ++ /** @todo add memflags argument */ ++ qh = dwc_otg_hcd_qh_alloc(atomic_alloc); ++ if (qh == NULL) { ++ DWC_ERROR("qh allocation failed"); ++ return NULL; ++ } ++ ++ qh_init(hcd, qh, urb); ++ ++ if (hcd->core_if->dma_desc_enable ++ && (dwc_otg_hcd_qh_init_ddma(hcd, qh) < 0)) { ++ dwc_otg_hcd_qh_free(hcd, qh); ++ return NULL; ++ } ++ ++ return qh; ++} ++ ++/* microframe_schedule=0 start */ ++ ++/** ++ * Checks that a channel is available for a periodic transfer. ++ * ++ * @return 0 if successful, negative error code otherise. ++ */ ++static int periodic_channel_available(dwc_otg_hcd_t * hcd) ++{ ++ /* ++ * Currently assuming that there is a dedicated host channnel for each ++ * periodic transaction plus at least one host channel for ++ * non-periodic transactions. ++ */ ++ int status; ++ int num_channels; ++ ++ num_channels = hcd->core_if->core_params->host_channels; ++ if ((hcd->periodic_channels + hcd->non_periodic_channels < num_channels) ++ && (hcd->periodic_channels < num_channels - 1)) { ++ status = 0; ++ } else { ++ DWC_INFO("%s: Total channels: %d, Periodic: %d, Non-periodic: %d\n", ++ __func__, num_channels, hcd->periodic_channels, hcd->non_periodic_channels); //NOTICE ++ status = -DWC_E_NO_SPACE; ++ } ++ ++ return status; ++} ++ ++/** ++ * Checks that there is sufficient bandwidth for the specified QH in the ++ * periodic schedule. For simplicity, this calculation assumes that all the ++ * transfers in the periodic schedule may occur in the same (micro)frame. ++ * ++ * @param hcd The HCD state structure for the DWC OTG controller. ++ * @param qh QH containing periodic bandwidth required. ++ * ++ * @return 0 if successful, negative error code otherwise. ++ */ ++static int check_periodic_bandwidth(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh) ++{ ++ int status; ++ int16_t max_claimed_usecs; ++ ++ status = 0; ++ ++ if ((qh->dev_speed == DWC_OTG_EP_SPEED_HIGH) || qh->do_split) { ++ /* ++ * High speed mode. ++ * Max periodic usecs is 80% x 125 usec = 100 usec. ++ */ ++ ++ max_claimed_usecs = 100 - qh->usecs; ++ } else { ++ /* ++ * Full speed mode. ++ * Max periodic usecs is 90% x 1000 usec = 900 usec. ++ */ ++ max_claimed_usecs = 900 - qh->usecs; ++ } ++ ++ if (hcd->periodic_usecs > max_claimed_usecs) { ++ DWC_INFO("%s: already claimed usecs %d, required usecs %d\n", __func__, hcd->periodic_usecs, qh->usecs); //NOTICE ++ status = -DWC_E_NO_SPACE; ++ } ++ ++ return status; ++} ++ ++/* microframe_schedule=0 end */ ++ ++/** ++ * Microframe scheduler ++ * track the total use in hcd->frame_usecs ++ * keep each qh use in qh->frame_usecs ++ * when surrendering the qh then donate the time back ++ */ ++const unsigned short max_uframe_usecs[]={ 100, 100, 100, 100, 100, 100, 30, 0 }; ++ ++/* ++ * called from dwc_otg_hcd.c:dwc_otg_hcd_init ++ */ ++int init_hcd_usecs(dwc_otg_hcd_t *_hcd) ++{ ++ int i; ++ for (i=0; i<8; i++) { ++ _hcd->frame_usecs[i] = max_uframe_usecs[i]; ++ } ++ return 0; ++} ++ ++static int find_single_uframe(dwc_otg_hcd_t * _hcd, dwc_otg_qh_t * _qh) ++{ ++ int i; ++ unsigned short utime; ++ int t_left; ++ int ret; ++ int done; ++ ++ ret = -1; ++ utime = _qh->usecs; ++ t_left = utime; ++ i = 0; ++ done = 0; ++ while (done == 0) { ++ /* At the start _hcd->frame_usecs[i] = max_uframe_usecs[i]; */ ++ if (utime <= _hcd->frame_usecs[i]) { ++ _hcd->frame_usecs[i] -= utime; ++ _qh->frame_usecs[i] += utime; ++ t_left -= utime; ++ ret = i; ++ done = 1; ++ return ret; ++ } else { ++ i++; ++ if (i == 8) { ++ done = 1; ++ ret = -1; ++ } ++ } ++ } ++ return ret; ++ } ++ ++/* ++ * use this for FS apps that can span multiple uframes ++ */ ++static int find_multi_uframe(dwc_otg_hcd_t * _hcd, dwc_otg_qh_t * _qh) ++{ ++ int i; ++ int j; ++ unsigned short utime; ++ int t_left; ++ int ret; ++ int done; ++ unsigned short xtime; ++ ++ ret = -1; ++ utime = _qh->usecs; ++ t_left = utime; ++ i = 0; ++ done = 0; ++loop: ++ while (done == 0) { ++ if(_hcd->frame_usecs[i] <= 0) { ++ i++; ++ if (i == 8) { ++ done = 1; ++ ret = -1; ++ } ++ goto loop; ++ } ++ ++ /* ++ * we need n consecutive slots ++ * so use j as a start slot j plus j+1 must be enough time (for now) ++ */ ++ xtime= _hcd->frame_usecs[i]; ++ for (j = i+1 ; j < 8 ; j++ ) { ++ /* ++ * if we add this frame remaining time to xtime we may ++ * be OK, if not we need to test j for a complete frame ++ */ ++ if ((xtime+_hcd->frame_usecs[j]) < utime) { ++ if (_hcd->frame_usecs[j] < max_uframe_usecs[j]) { ++ j = 8; ++ ret = -1; ++ continue; ++ } ++ } ++ if (xtime >= utime) { ++ ret = i; ++ j = 8; /* stop loop with a good value ret */ ++ continue; ++ } ++ /* add the frame time to x time */ ++ xtime += _hcd->frame_usecs[j]; ++ /* we must have a fully available next frame or break */ ++ if ((xtime < utime) ++ && (_hcd->frame_usecs[j] == max_uframe_usecs[j])) { ++ ret = -1; ++ j = 8; /* stop loop with a bad value ret */ ++ continue; ++ } ++ } ++ if (ret >= 0) { ++ t_left = utime; ++ for (j = i; (t_left>0) && (j < 8); j++ ) { ++ t_left -= _hcd->frame_usecs[j]; ++ if ( t_left <= 0 ) { ++ _qh->frame_usecs[j] += _hcd->frame_usecs[j] + t_left; ++ _hcd->frame_usecs[j]= -t_left; ++ ret = i; ++ done = 1; ++ } else { ++ _qh->frame_usecs[j] += _hcd->frame_usecs[j]; ++ _hcd->frame_usecs[j] = 0; ++ } ++ } ++ } else { ++ i++; ++ if (i == 8) { ++ done = 1; ++ ret = -1; ++ } ++ } ++ } ++ return ret; ++} ++ ++static int find_uframe(dwc_otg_hcd_t * _hcd, dwc_otg_qh_t * _qh) ++{ ++ int ret; ++ ret = -1; ++ ++ if (_qh->speed == USB_SPEED_HIGH) { ++ /* if this is a hs transaction we need a full frame */ ++ ret = find_single_uframe(_hcd, _qh); ++ } else { ++ /* if this is a fs transaction we may need a sequence of frames */ ++ ret = find_multi_uframe(_hcd, _qh); ++ } ++ return ret; ++} ++ ++/** ++ * Checks that the max transfer size allowed in a host channel is large enough ++ * to handle the maximum data transfer in a single (micro)frame for a periodic ++ * transfer. ++ * ++ * @param hcd The HCD state structure for the DWC OTG controller. ++ * @param qh QH for a periodic endpoint. ++ * ++ * @return 0 if successful, negative error code otherwise. ++ */ ++static int check_max_xfer_size(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh) ++{ ++ int status; ++ uint32_t max_xfer_size; ++ uint32_t max_channel_xfer_size; ++ ++ status = 0; ++ ++ max_xfer_size = dwc_max_packet(qh->maxp) * dwc_hb_mult(qh->maxp); ++ max_channel_xfer_size = hcd->core_if->core_params->max_transfer_size; ++ ++ if (max_xfer_size > max_channel_xfer_size) { ++ DWC_INFO("%s: Periodic xfer length %d > " "max xfer length for channel %d\n", ++ __func__, max_xfer_size, max_channel_xfer_size); //NOTICE ++ status = -DWC_E_NO_SPACE; ++ } ++ ++ return status; ++} ++ ++ ++ ++/** ++ * Schedules an interrupt or isochronous transfer in the periodic schedule. ++ * ++ * @param hcd The HCD state structure for the DWC OTG controller. ++ * @param qh QH for the periodic transfer. The QH should already contain the ++ * scheduling information. ++ * ++ * @return 0 if successful, negative error code otherwise. ++ */ ++static int schedule_periodic(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh) ++{ ++ int status = 0; ++ ++ if (microframe_schedule) { ++ int frame; ++ status = find_uframe(hcd, qh); ++ frame = -1; ++ if (status == 0) { ++ frame = 7; ++ } else { ++ if (status > 0 ) ++ frame = status-1; ++ } ++ ++ /* Set the new frame up */ ++ if (frame > -1) { ++ qh->sched_frame &= ~0x7; ++ qh->sched_frame |= (frame & 7); ++ } ++ ++ if (status != -1) ++ status = 0; ++ } else { ++ status = periodic_channel_available(hcd); ++ if (status) { ++ DWC_INFO("%s: No host channel available for periodic " "transfer.\n", __func__); //NOTICE ++ return status; ++ } ++ ++ status = check_periodic_bandwidth(hcd, qh); ++ } ++ if (status) { ++ DWC_INFO("%s: Insufficient periodic bandwidth for " ++ "periodic transfer.\n", __func__); ++ return status; ++ } ++ status = check_max_xfer_size(hcd, qh); ++ if (status) { ++ DWC_INFO("%s: Channel max transfer size too small " ++ "for periodic transfer.\n", __func__); ++ return status; ++ } ++ ++ if (hcd->core_if->dma_desc_enable) { ++ /* Don't rely on SOF and start in ready schedule */ ++ DWC_LIST_INSERT_TAIL(&hcd->periodic_sched_ready, &qh->qh_list_entry); ++ } ++ else { ++ if(fiq_enable && (DWC_LIST_EMPTY(&hcd->periodic_sched_inactive) || dwc_frame_num_le(qh->sched_frame, hcd->fiq_state->next_sched_frame))) ++ { ++ hcd->fiq_state->next_sched_frame = qh->sched_frame; ++ ++ } ++ /* Always start in the inactive schedule. */ ++ DWC_LIST_INSERT_TAIL(&hcd->periodic_sched_inactive, &qh->qh_list_entry); ++ } ++ ++ if (!microframe_schedule) { ++ /* Reserve the periodic channel. */ ++ hcd->periodic_channels++; ++ } ++ ++ /* Update claimed usecs per (micro)frame. */ ++ hcd->periodic_usecs += qh->usecs; ++ ++ return status; ++} ++ ++ ++/** ++ * This function adds a QH to either the non periodic or periodic schedule if ++ * it is not already in the schedule. If the QH is already in the schedule, no ++ * action is taken. ++ * ++ * @return 0 if successful, negative error code otherwise. ++ */ ++int dwc_otg_hcd_qh_add(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh) ++{ ++ int status = 0; ++ gintmsk_data_t intr_mask = {.d32 = 0 }; ++ ++ if (!DWC_LIST_EMPTY(&qh->qh_list_entry)) { ++ /* QH already in a schedule. */ ++ return status; ++ } ++ ++ /* Add the new QH to the appropriate schedule */ ++ if (dwc_qh_is_non_per(qh)) { ++ /* Always start in the inactive schedule. */ ++ DWC_LIST_INSERT_TAIL(&hcd->non_periodic_sched_inactive, ++ &qh->qh_list_entry); ++ //hcd->fiq_state->kick_np_queues = 1; ++ } else { ++ status = schedule_periodic(hcd, qh); ++ if ( !hcd->periodic_qh_count ) { ++ intr_mask.b.sofintr = 1; ++ if (fiq_enable) { ++ local_fiq_disable(); ++ fiq_fsm_spin_lock(&hcd->fiq_state->lock); ++ DWC_MODIFY_REG32(&hcd->core_if->core_global_regs->gintmsk, intr_mask.d32, intr_mask.d32); ++ fiq_fsm_spin_unlock(&hcd->fiq_state->lock); ++ local_fiq_enable(); ++ } else { ++ DWC_MODIFY_REG32(&hcd->core_if->core_global_regs->gintmsk, intr_mask.d32, intr_mask.d32); ++ } ++ } ++ hcd->periodic_qh_count++; ++ } ++ ++ return status; ++} ++ ++/** ++ * Removes an interrupt or isochronous transfer from the periodic schedule. ++ * ++ * @param hcd The HCD state structure for the DWC OTG controller. ++ * @param qh QH for the periodic transfer. ++ */ ++static void deschedule_periodic(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh) ++{ ++ int i; ++ DWC_LIST_REMOVE_INIT(&qh->qh_list_entry); ++ ++ /* Update claimed usecs per (micro)frame. */ ++ hcd->periodic_usecs -= qh->usecs; ++ ++ if (!microframe_schedule) { ++ /* Release the periodic channel reservation. */ ++ hcd->periodic_channels--; ++ } else { ++ for (i = 0; i < 8; i++) { ++ hcd->frame_usecs[i] += qh->frame_usecs[i]; ++ qh->frame_usecs[i] = 0; ++ } ++ } ++} ++ ++/** ++ * Removes a QH from either the non-periodic or periodic schedule. Memory is ++ * not freed. ++ * ++ * @param hcd The HCD state structure. ++ * @param qh QH to remove from schedule. */ ++void dwc_otg_hcd_qh_remove(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh) ++{ ++ gintmsk_data_t intr_mask = {.d32 = 0 }; ++ ++ if (DWC_LIST_EMPTY(&qh->qh_list_entry)) { ++ /* QH is not in a schedule. */ ++ return; ++ } ++ ++ if (dwc_qh_is_non_per(qh)) { ++ if (hcd->non_periodic_qh_ptr == &qh->qh_list_entry) { ++ hcd->non_periodic_qh_ptr = ++ hcd->non_periodic_qh_ptr->next; ++ } ++ DWC_LIST_REMOVE_INIT(&qh->qh_list_entry); ++ //if (!DWC_LIST_EMPTY(&hcd->non_periodic_sched_inactive)) ++ // hcd->fiq_state->kick_np_queues = 1; ++ } else { ++ deschedule_periodic(hcd, qh); ++ hcd->periodic_qh_count--; ++ if( !hcd->periodic_qh_count && !fiq_fsm_enable ) { ++ intr_mask.b.sofintr = 1; ++ if (fiq_enable) { ++ local_fiq_disable(); ++ fiq_fsm_spin_lock(&hcd->fiq_state->lock); ++ DWC_MODIFY_REG32(&hcd->core_if->core_global_regs->gintmsk, intr_mask.d32, 0); ++ fiq_fsm_spin_unlock(&hcd->fiq_state->lock); ++ local_fiq_enable(); ++ } else { ++ DWC_MODIFY_REG32(&hcd->core_if->core_global_regs->gintmsk, intr_mask.d32, 0); ++ } ++ } ++ } ++} ++ ++/** ++ * Deactivates a QH. For non-periodic QHs, removes the QH from the active ++ * non-periodic schedule. The QH is added to the inactive non-periodic ++ * schedule if any QTDs are still attached to the QH. ++ * ++ * For periodic QHs, the QH is removed from the periodic queued schedule. If ++ * there are any QTDs still attached to the QH, the QH is added to either the ++ * periodic inactive schedule or the periodic ready schedule and its next ++ * scheduled frame is calculated. The QH is placed in the ready schedule if ++ * the scheduled frame has been reached already. Otherwise it's placed in the ++ * inactive schedule. If there are no QTDs attached to the QH, the QH is ++ * completely removed from the periodic schedule. ++ */ ++void dwc_otg_hcd_qh_deactivate(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh, ++ int sched_next_periodic_split) ++{ ++ if (dwc_qh_is_non_per(qh)) { ++ dwc_otg_hcd_qh_remove(hcd, qh); ++ if (!DWC_CIRCLEQ_EMPTY(&qh->qtd_list)) { ++ /* Add back to inactive non-periodic schedule. */ ++ dwc_otg_hcd_qh_add(hcd, qh); ++ //hcd->fiq_state->kick_np_queues = 1; ++ } ++ } else { ++ uint16_t frame_number = dwc_otg_hcd_get_frame_number(hcd); ++ ++ if (qh->do_split) { ++ /* Schedule the next continuing periodic split transfer */ ++ if (sched_next_periodic_split) { ++ ++ qh->sched_frame = frame_number; ++ ++ if (dwc_frame_num_le(frame_number, ++ dwc_frame_num_inc ++ (qh->start_split_frame, ++ 1))) { ++ /* ++ * Allow one frame to elapse after start ++ * split microframe before scheduling ++ * complete split, but DONT if we are ++ * doing the next start split in the ++ * same frame for an ISOC out. ++ */ ++ if ((qh->ep_type != UE_ISOCHRONOUS) || ++ (qh->ep_is_in != 0)) { ++ qh->sched_frame = ++ dwc_frame_num_inc(qh->sched_frame, 1); ++ } ++ } ++ } else { ++ qh->sched_frame = ++ dwc_frame_num_inc(qh->start_split_frame, ++ qh->interval); ++ if (dwc_frame_num_le ++ (qh->sched_frame, frame_number)) { ++ qh->sched_frame = frame_number; ++ } ++ qh->sched_frame |= 0x7; ++ qh->start_split_frame = qh->sched_frame; ++ } ++ } else { ++ qh->sched_frame = ++ dwc_frame_num_inc(qh->sched_frame, qh->interval); ++ if (dwc_frame_num_le(qh->sched_frame, frame_number)) { ++ qh->sched_frame = frame_number; ++ } ++ } ++ ++ if (DWC_CIRCLEQ_EMPTY(&qh->qtd_list)) { ++ dwc_otg_hcd_qh_remove(hcd, qh); ++ } else { ++ /* ++ * Remove from periodic_sched_queued and move to ++ * appropriate queue. ++ */ ++ if ((microframe_schedule && dwc_frame_num_le(qh->sched_frame, frame_number)) || ++ (!microframe_schedule && qh->sched_frame == frame_number)) { ++ DWC_LIST_MOVE_HEAD(&hcd->periodic_sched_ready, ++ &qh->qh_list_entry); ++ } else { ++ if(fiq_enable && !dwc_frame_num_le(hcd->fiq_state->next_sched_frame, qh->sched_frame)) ++ { ++ hcd->fiq_state->next_sched_frame = qh->sched_frame; ++ } ++ ++ DWC_LIST_MOVE_HEAD ++ (&hcd->periodic_sched_inactive, ++ &qh->qh_list_entry); ++ } ++ } ++ } ++} ++ ++/** ++ * This function allocates and initializes a QTD. ++ * ++ * @param urb The URB to create a QTD from. Each URB-QTD pair will end up ++ * pointing to each other so each pair should have a unique correlation. ++ * @param atomic_alloc Flag to do atomic alloc if needed ++ * ++ * @return Returns pointer to the newly allocated QTD, or NULL on error. */ ++dwc_otg_qtd_t *dwc_otg_hcd_qtd_create(dwc_otg_hcd_urb_t * urb, int atomic_alloc) ++{ ++ dwc_otg_qtd_t *qtd; ++ ++ qtd = dwc_otg_hcd_qtd_alloc(atomic_alloc); ++ if (qtd == NULL) { ++ return NULL; ++ } ++ ++ dwc_otg_hcd_qtd_init(qtd, urb); ++ return qtd; ++} ++ ++/** ++ * Initializes a QTD structure. ++ * ++ * @param qtd The QTD to initialize. ++ * @param urb The URB to use for initialization. */ ++void dwc_otg_hcd_qtd_init(dwc_otg_qtd_t * qtd, dwc_otg_hcd_urb_t * urb) ++{ ++ dwc_memset(qtd, 0, sizeof(dwc_otg_qtd_t)); ++ qtd->urb = urb; ++ if (dwc_otg_hcd_get_pipe_type(&urb->pipe_info) == UE_CONTROL) { ++ /* ++ * The only time the QTD data toggle is used is on the data ++ * phase of control transfers. This phase always starts with ++ * DATA1. ++ */ ++ qtd->data_toggle = DWC_OTG_HC_PID_DATA1; ++ qtd->control_phase = DWC_OTG_CONTROL_SETUP; ++ } ++ ++ /* start split */ ++ qtd->complete_split = 0; ++ qtd->isoc_split_pos = DWC_HCSPLIT_XACTPOS_ALL; ++ qtd->isoc_split_offset = 0; ++ qtd->in_process = 0; ++ ++ /* Store the qtd ptr in the urb to reference what QTD. */ ++ urb->qtd = qtd; ++ return; ++} ++ ++/** ++ * This function adds a QTD to the QTD-list of a QH. It will find the correct ++ * QH to place the QTD into. If it does not find a QH, then it will create a ++ * new QH. If the QH to which the QTD is added is not currently scheduled, it ++ * is placed into the proper schedule based on its EP type. ++ * HCD lock must be held and interrupts must be disabled on entry ++ * ++ * @param[in] qtd The QTD to add ++ * @param[in] hcd The DWC HCD structure ++ * @param[out] qh out parameter to return queue head ++ * @param atomic_alloc Flag to do atomic alloc if needed ++ * ++ * @return 0 if successful, negative error code otherwise. ++ */ ++int dwc_otg_hcd_qtd_add(dwc_otg_qtd_t * qtd, ++ dwc_otg_hcd_t * hcd, dwc_otg_qh_t ** qh, int atomic_alloc) ++{ ++ int retval = 0; ++ dwc_otg_hcd_urb_t *urb = qtd->urb; ++ ++ /* ++ * Get the QH which holds the QTD-list to insert to. Create QH if it ++ * doesn't exist. ++ */ ++ if (*qh == NULL) { ++ *qh = dwc_otg_hcd_qh_create(hcd, urb, atomic_alloc); ++ if (*qh == NULL) { ++ retval = -DWC_E_NO_MEMORY; ++ goto done; ++ } else { ++ if (fiq_enable) ++ hcd->fiq_state->kick_np_queues = 1; ++ } ++ } ++ retval = dwc_otg_hcd_qh_add(hcd, *qh); ++ if (retval == 0) { ++ DWC_CIRCLEQ_INSERT_TAIL(&((*qh)->qtd_list), qtd, ++ qtd_list_entry); ++ qtd->qh = *qh; ++ } ++done: ++ ++ return retval; ++} ++ ++#endif /* DWC_DEVICE_ONLY */ +diff --git a/drivers/usb/host/dwc_otg/dwc_otg_os_dep.h b/drivers/usb/host/dwc_otg/dwc_otg_os_dep.h +new file mode 100644 +index 0000000..6b2c7d0 +--- /dev/null ++++ b/drivers/usb/host/dwc_otg/dwc_otg_os_dep.h +@@ -0,0 +1,188 @@ ++#ifndef _DWC_OS_DEP_H_ ++#define _DWC_OS_DEP_H_ ++ ++/** ++ * @file ++ * ++ * This file contains OS dependent structures. ++ * ++ */ ++ ++#include <linux/kernel.h> ++#include <linux/module.h> ++#include <linux/moduleparam.h> ++#include <linux/init.h> ++#include <linux/device.h> ++#include <linux/errno.h> ++#include <linux/types.h> ++#include <linux/slab.h> ++#include <linux/list.h> ++#include <linux/interrupt.h> ++#include <linux/ctype.h> ++#include <linux/string.h> ++#include <linux/dma-mapping.h> ++#include <linux/jiffies.h> ++#include <linux/delay.h> ++#include <linux/timer.h> ++#include <linux/workqueue.h> ++#include <linux/stat.h> ++#include <linux/pci.h> ++ ++#include <linux/version.h> ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) ++# include <linux/irq.h> ++#endif ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21) ++# include <linux/usb/ch9.h> ++#else ++# include <linux/usb_ch9.h> ++#endif ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24) ++# include <linux/usb/gadget.h> ++#else ++# include <linux/usb_gadget.h> ++#endif ++ ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) ++# include <asm/irq.h> ++#endif ++ ++#ifdef PCI_INTERFACE ++# include <asm/io.h> ++#endif ++ ++#ifdef LM_INTERFACE ++# include <asm/unaligned.h> ++# include <asm/sizes.h> ++# include <asm/param.h> ++# include <asm/io.h> ++# if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30)) ++# include <asm/arch/hardware.h> ++# include <asm/arch/lm.h> ++# include <asm/arch/irqs.h> ++# include <asm/arch/regs-irq.h> ++# else ++/* in 2.6.31, at least, we seem to have lost the generic LM infrastructure - ++ here we assume that the machine architecture provides definitions ++ in its own header ++*/ ++# include <mach/lm.h> ++# include <mach/hardware.h> ++# endif ++#endif ++ ++#ifdef PLATFORM_INTERFACE ++#include <linux/platform_device.h> ++#include <asm/mach/map.h> ++#endif ++ ++/** The OS page size */ ++#define DWC_OS_PAGE_SIZE PAGE_SIZE ++ ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14) ++typedef int gfp_t; ++#endif ++ ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18) ++# define IRQF_SHARED SA_SHIRQ ++#endif ++ ++typedef struct os_dependent { ++ /** Base address returned from ioremap() */ ++ void *base; ++ ++ /** Register offset for Diagnostic API */ ++ uint32_t reg_offset; ++ ++ /** Base address for MPHI peripheral */ ++ void *mphi_base; ++ ++#ifdef LM_INTERFACE ++ struct lm_device *lmdev; ++#elif defined(PCI_INTERFACE) ++ struct pci_dev *pcidev; ++ ++ /** Start address of a PCI region */ ++ resource_size_t rsrc_start; ++ ++ /** Length address of a PCI region */ ++ resource_size_t rsrc_len; ++#elif defined(PLATFORM_INTERFACE) ++ struct platform_device *platformdev; ++#endif ++ ++} os_dependent_t; ++ ++#ifdef __cplusplus ++} ++#endif ++ ++ ++ ++/* Type for the our device on the chosen bus */ ++#if defined(LM_INTERFACE) ++typedef struct lm_device dwc_bus_dev_t; ++#elif defined(PCI_INTERFACE) ++typedef struct pci_dev dwc_bus_dev_t; ++#elif defined(PLATFORM_INTERFACE) ++typedef struct platform_device dwc_bus_dev_t; ++#endif ++ ++/* Helper macro to retrieve drvdata from the device on the chosen bus */ ++#if defined(LM_INTERFACE) ++#define DWC_OTG_BUSDRVDATA(_dev) lm_get_drvdata(_dev) ++#elif defined(PCI_INTERFACE) ++#define DWC_OTG_BUSDRVDATA(_dev) pci_get_drvdata(_dev) ++#elif defined(PLATFORM_INTERFACE) ++#define DWC_OTG_BUSDRVDATA(_dev) platform_get_drvdata(_dev) ++#endif ++ ++/** ++ * Helper macro returning the otg_device structure of a given struct device ++ * ++ * c.f. static dwc_otg_device_t *dwc_otg_drvdev(struct device *_dev) ++ */ ++#ifdef LM_INTERFACE ++#define DWC_OTG_GETDRVDEV(_var, _dev) do { \ ++ struct lm_device *lm_dev = \ ++ container_of(_dev, struct lm_device, dev); \ ++ _var = lm_get_drvdata(lm_dev); \ ++ } while (0) ++ ++#elif defined(PCI_INTERFACE) ++#define DWC_OTG_GETDRVDEV(_var, _dev) do { \ ++ _var = dev_get_drvdata(_dev); \ ++ } while (0) ++ ++#elif defined(PLATFORM_INTERFACE) ++#define DWC_OTG_GETDRVDEV(_var, _dev) do { \ ++ struct platform_device *platform_dev = \ ++ container_of(_dev, struct platform_device, dev); \ ++ _var = platform_get_drvdata(platform_dev); \ ++ } while (0) ++#endif ++ ++ ++/** ++ * Helper macro returning the struct dev of the given struct os_dependent ++ * ++ * c.f. static struct device *dwc_otg_getdev(struct os_dependent *osdep) ++ */ ++#ifdef LM_INTERFACE ++#define DWC_OTG_OS_GETDEV(_osdep) \ ++ ((_osdep).lmdev == NULL? NULL: &(_osdep).lmdev->dev) ++#elif defined(PCI_INTERFACE) ++#define DWC_OTG_OS_GETDEV(_osdep) \ ++ ((_osdep).pci_dev == NULL? NULL: &(_osdep).pci_dev->dev) ++#elif defined(PLATFORM_INTERFACE) ++#define DWC_OTG_OS_GETDEV(_osdep) \ ++ ((_osdep).platformdev == NULL? NULL: &(_osdep).platformdev->dev) ++#endif ++ ++ ++ ++ ++#endif /* _DWC_OS_DEP_H_ */ +diff --git a/drivers/usb/host/dwc_otg/dwc_otg_pcd.c b/drivers/usb/host/dwc_otg/dwc_otg_pcd.c +new file mode 100644 +index 0000000..ae0c72d +--- /dev/null ++++ b/drivers/usb/host/dwc_otg/dwc_otg_pcd.c +@@ -0,0 +1,2712 @@ ++/* ========================================================================== ++ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_pcd.c $ ++ * $Revision: #101 $ ++ * $Date: 2012/08/10 $ ++ * $Change: 2047372 $ ++ * ++ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, ++ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless ++ * otherwise expressly agreed to in writing between Synopsys and you. ++ * ++ * The Software IS NOT an item of Licensed Software or Licensed Product under ++ * any End User Software License Agreement or Agreement for Licensed Product ++ * with Synopsys or any supplement thereto. You are permitted to use and ++ * redistribute this Software in source and binary forms, with or without ++ * modification, provided that redistributions of source code must retain this ++ * notice. You may not view, use, disclose, copy or distribute this file or ++ * any information contained herein except pursuant to this license grant from ++ * Synopsys. If you do not agree with this notice, including the disclaimer ++ * below, then you are not authorized to use the Software. ++ * ++ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS ++ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS 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. ++ * ========================================================================== */ ++#ifndef DWC_HOST_ONLY ++ ++/** @file ++ * This file implements PCD Core. All code in this file is portable and doesn't ++ * use any OS specific functions. ++ * PCD Core provides Interface, defined in <code><dwc_otg_pcd_if.h></code> ++ * header file, which can be used to implement OS specific PCD interface. ++ * ++ * An important function of the PCD is managing interrupts generated ++ * by the DWC_otg controller. The implementation of the DWC_otg device ++ * mode interrupt service routines is in dwc_otg_pcd_intr.c. ++ * ++ * @todo Add Device Mode test modes (Test J mode, Test K mode, etc). ++ * @todo Does it work when the request size is greater than DEPTSIZ ++ * transfer size ++ * ++ */ ++ ++#include "dwc_otg_pcd.h" ++ ++#ifdef DWC_UTE_CFI ++#include "dwc_otg_cfi.h" ++ ++extern int init_cfi(cfiobject_t * cfiobj); ++#endif ++ ++/** ++ * Choose endpoint from ep arrays using usb_ep structure. ++ */ ++static dwc_otg_pcd_ep_t *get_ep_from_handle(dwc_otg_pcd_t * pcd, void *handle) ++{ ++ int i; ++ if (pcd->ep0.priv == handle) { ++ return &pcd->ep0; ++ } ++ for (i = 0; i < MAX_EPS_CHANNELS - 1; i++) { ++ if (pcd->in_ep[i].priv == handle) ++ return &pcd->in_ep[i]; ++ if (pcd->out_ep[i].priv == handle) ++ return &pcd->out_ep[i]; ++ } ++ ++ return NULL; ++} ++ ++/** ++ * This function completes a request. It call's the request call back. ++ */ ++void dwc_otg_request_done(dwc_otg_pcd_ep_t * ep, dwc_otg_pcd_request_t * req, ++ int32_t status) ++{ ++ unsigned stopped = ep->stopped; ++ ++ DWC_DEBUGPL(DBG_PCDV, "%s(ep %p req %p)\n", __func__, ep, req); ++ DWC_CIRCLEQ_REMOVE_INIT(&ep->queue, req, queue_entry); ++ ++ /* don't modify queue heads during completion callback */ ++ ep->stopped = 1; ++ /* spin_unlock/spin_lock now done in fops->complete() */ ++ ep->pcd->fops->complete(ep->pcd, ep->priv, req->priv, status, ++ req->actual); ++ ++ if (ep->pcd->request_pending > 0) { ++ --ep->pcd->request_pending; ++ } ++ ++ ep->stopped = stopped; ++ DWC_FREE(req); ++} ++ ++/** ++ * This function terminates all the requsts in the EP request queue. ++ */ ++void dwc_otg_request_nuke(dwc_otg_pcd_ep_t * ep) ++{ ++ dwc_otg_pcd_request_t *req; ++ ++ ep->stopped = 1; ++ ++ /* called with irqs blocked?? */ ++ while (!DWC_CIRCLEQ_EMPTY(&ep->queue)) { ++ req = DWC_CIRCLEQ_FIRST(&ep->queue); ++ dwc_otg_request_done(ep, req, -DWC_E_SHUTDOWN); ++ } ++} ++ ++void dwc_otg_pcd_start(dwc_otg_pcd_t * pcd, ++ const struct dwc_otg_pcd_function_ops *fops) ++{ ++ pcd->fops = fops; ++} ++ ++/** ++ * PCD Callback function for initializing the PCD when switching to ++ * device mode. ++ * ++ * @param p void pointer to the <code>dwc_otg_pcd_t</code> ++ */ ++static int32_t dwc_otg_pcd_start_cb(void *p) ++{ ++ dwc_otg_pcd_t *pcd = (dwc_otg_pcd_t *) p; ++ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); ++ ++ /* ++ * Initialized the Core for Device mode. ++ */ ++ if (dwc_otg_is_device_mode(core_if)) { ++ dwc_otg_core_dev_init(core_if); ++ /* Set core_if's lock pointer to the pcd->lock */ ++ core_if->lock = pcd->lock; ++ } ++ return 1; ++} ++ ++/** CFI-specific buffer allocation function for EP */ ++#ifdef DWC_UTE_CFI ++uint8_t *cfiw_ep_alloc_buffer(dwc_otg_pcd_t * pcd, void *pep, dwc_dma_t * addr, ++ size_t buflen, int flags) ++{ ++ dwc_otg_pcd_ep_t *ep; ++ ep = get_ep_from_handle(pcd, pep); ++ if (!ep) { ++ DWC_WARN("bad ep\n"); ++ return -DWC_E_INVALID; ++ } ++ ++ return pcd->cfi->ops.ep_alloc_buf(pcd->cfi, pcd, ep, addr, buflen, ++ flags); ++} ++#else ++uint8_t *cfiw_ep_alloc_buffer(dwc_otg_pcd_t * pcd, void *pep, dwc_dma_t * addr, ++ size_t buflen, int flags); ++#endif ++ ++/** ++ * PCD Callback function for notifying the PCD when resuming from ++ * suspend. ++ * ++ * @param p void pointer to the <code>dwc_otg_pcd_t</code> ++ */ ++static int32_t dwc_otg_pcd_resume_cb(void *p) ++{ ++ dwc_otg_pcd_t *pcd = (dwc_otg_pcd_t *) p; ++ ++ if (pcd->fops->resume) { ++ pcd->fops->resume(pcd); ++ } ++ ++ /* Stop the SRP timeout timer. */ ++ if ((GET_CORE_IF(pcd)->core_params->phy_type != DWC_PHY_TYPE_PARAM_FS) ++ || (!GET_CORE_IF(pcd)->core_params->i2c_enable)) { ++ if (GET_CORE_IF(pcd)->srp_timer_started) { ++ GET_CORE_IF(pcd)->srp_timer_started = 0; ++ DWC_TIMER_CANCEL(GET_CORE_IF(pcd)->srp_timer); ++ } ++ } ++ return 1; ++} ++ ++/** ++ * PCD Callback function for notifying the PCD device is suspended. ++ * ++ * @param p void pointer to the <code>dwc_otg_pcd_t</code> ++ */ ++static int32_t dwc_otg_pcd_suspend_cb(void *p) ++{ ++ dwc_otg_pcd_t *pcd = (dwc_otg_pcd_t *) p; ++ ++ if (pcd->fops->suspend) { ++ DWC_SPINUNLOCK(pcd->lock); ++ pcd->fops->suspend(pcd); ++ DWC_SPINLOCK(pcd->lock); ++ } ++ ++ return 1; ++} ++ ++/** ++ * PCD Callback function for stopping the PCD when switching to Host ++ * mode. ++ * ++ * @param p void pointer to the <code>dwc_otg_pcd_t</code> ++ */ ++static int32_t dwc_otg_pcd_stop_cb(void *p) ++{ ++ dwc_otg_pcd_t *pcd = (dwc_otg_pcd_t *) p; ++ extern void dwc_otg_pcd_stop(dwc_otg_pcd_t * _pcd); ++ ++ dwc_otg_pcd_stop(pcd); ++ return 1; ++} ++ ++/** ++ * PCD Callback structure for handling mode switching. ++ */ ++static dwc_otg_cil_callbacks_t pcd_callbacks = { ++ .start = dwc_otg_pcd_start_cb, ++ .stop = dwc_otg_pcd_stop_cb, ++ .suspend = dwc_otg_pcd_suspend_cb, ++ .resume_wakeup = dwc_otg_pcd_resume_cb, ++ .p = 0, /* Set at registration */ ++}; ++ ++/** ++ * This function allocates a DMA Descriptor chain for the Endpoint ++ * buffer to be used for a transfer to/from the specified endpoint. ++ */ ++dwc_otg_dev_dma_desc_t *dwc_otg_ep_alloc_desc_chain(dwc_dma_t * dma_desc_addr, ++ uint32_t count) ++{ ++ return DWC_DMA_ALLOC_ATOMIC(count * sizeof(dwc_otg_dev_dma_desc_t), ++ dma_desc_addr); ++} ++ ++/** ++ * This function frees a DMA Descriptor chain that was allocated by ep_alloc_desc. ++ */ ++void dwc_otg_ep_free_desc_chain(dwc_otg_dev_dma_desc_t * desc_addr, ++ uint32_t dma_desc_addr, uint32_t count) ++{ ++ DWC_DMA_FREE(count * sizeof(dwc_otg_dev_dma_desc_t), desc_addr, ++ dma_desc_addr); ++} ++ ++#ifdef DWC_EN_ISOC ++ ++/** ++ * This function initializes a descriptor chain for Isochronous transfer ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ * @param dwc_ep The EP to start the transfer on. ++ * ++ */ ++void dwc_otg_iso_ep_start_ddma_transfer(dwc_otg_core_if_t * core_if, ++ dwc_ep_t * dwc_ep) ++{ ++ ++ dsts_data_t dsts = {.d32 = 0 }; ++ depctl_data_t depctl = {.d32 = 0 }; ++ volatile uint32_t *addr; ++ int i, j; ++ uint32_t len; ++ ++ if (dwc_ep->is_in) ++ dwc_ep->desc_cnt = dwc_ep->buf_proc_intrvl / dwc_ep->bInterval; ++ else ++ dwc_ep->desc_cnt = ++ dwc_ep->buf_proc_intrvl * dwc_ep->pkt_per_frm / ++ dwc_ep->bInterval; ++ ++ /** Allocate descriptors for double buffering */ ++ dwc_ep->iso_desc_addr = ++ dwc_otg_ep_alloc_desc_chain(&dwc_ep->iso_dma_desc_addr, ++ dwc_ep->desc_cnt * 2); ++ if (dwc_ep->desc_addr) { ++ DWC_WARN("%s, can't allocate DMA descriptor chain\n", __func__); ++ return; ++ } ++ ++ dsts.d32 = DWC_READ_REG32(&core_if->dev_if->dev_global_regs->dsts); ++ ++ /** ISO OUT EP */ ++ if (dwc_ep->is_in == 0) { ++ dev_dma_desc_sts_t sts = {.d32 = 0 }; ++ dwc_otg_dev_dma_desc_t *dma_desc = dwc_ep->iso_desc_addr; ++ dma_addr_t dma_ad; ++ uint32_t data_per_desc; ++ dwc_otg_dev_out_ep_regs_t *out_regs = ++ core_if->dev_if->out_ep_regs[dwc_ep->num]; ++ int offset; ++ ++ addr = &core_if->dev_if->out_ep_regs[dwc_ep->num]->doepctl; ++ dma_ad = (dma_addr_t) DWC_READ_REG32(&(out_regs->doepdma)); ++ ++ /** Buffer 0 descriptors setup */ ++ dma_ad = dwc_ep->dma_addr0; ++ ++ sts.b_iso_out.bs = BS_HOST_READY; ++ sts.b_iso_out.rxsts = 0; ++ sts.b_iso_out.l = 0; ++ sts.b_iso_out.sp = 0; ++ sts.b_iso_out.ioc = 0; ++ sts.b_iso_out.pid = 0; ++ sts.b_iso_out.framenum = 0; ++ ++ offset = 0; ++ for (i = 0; i < dwc_ep->desc_cnt - dwc_ep->pkt_per_frm; ++ i += dwc_ep->pkt_per_frm) { ++ ++ for (j = 0; j < dwc_ep->pkt_per_frm; ++j) { ++ uint32_t len = (j + 1) * dwc_ep->maxpacket; ++ if (len > dwc_ep->data_per_frame) ++ data_per_desc = ++ dwc_ep->data_per_frame - ++ j * dwc_ep->maxpacket; ++ else ++ data_per_desc = dwc_ep->maxpacket; ++ len = data_per_desc % 4; ++ if (len) ++ data_per_desc += 4 - len; ++ ++ sts.b_iso_out.rxbytes = data_per_desc; ++ dma_desc->buf = dma_ad; ++ dma_desc->status.d32 = sts.d32; ++ ++ offset += data_per_desc; ++ dma_desc++; ++ dma_ad += data_per_desc; ++ } ++ } ++ ++ for (j = 0; j < dwc_ep->pkt_per_frm - 1; ++j) { ++ uint32_t len = (j + 1) * dwc_ep->maxpacket; ++ if (len > dwc_ep->data_per_frame) ++ data_per_desc = ++ dwc_ep->data_per_frame - ++ j * dwc_ep->maxpacket; ++ else ++ data_per_desc = dwc_ep->maxpacket; ++ len = data_per_desc % 4; ++ if (len) ++ data_per_desc += 4 - len; ++ sts.b_iso_out.rxbytes = data_per_desc; ++ dma_desc->buf = dma_ad; ++ dma_desc->status.d32 = sts.d32; ++ ++ offset += data_per_desc; ++ dma_desc++; ++ dma_ad += data_per_desc; ++ } ++ ++ sts.b_iso_out.ioc = 1; ++ len = (j + 1) * dwc_ep->maxpacket; ++ if (len > dwc_ep->data_per_frame) ++ data_per_desc = ++ dwc_ep->data_per_frame - j * dwc_ep->maxpacket; ++ else ++ data_per_desc = dwc_ep->maxpacket; ++ len = data_per_desc % 4; ++ if (len) ++ data_per_desc += 4 - len; ++ sts.b_iso_out.rxbytes = data_per_desc; ++ ++ dma_desc->buf = dma_ad; ++ dma_desc->status.d32 = sts.d32; ++ dma_desc++; ++ ++ /** Buffer 1 descriptors setup */ ++ sts.b_iso_out.ioc = 0; ++ dma_ad = dwc_ep->dma_addr1; ++ ++ offset = 0; ++ for (i = 0; i < dwc_ep->desc_cnt - dwc_ep->pkt_per_frm; ++ i += dwc_ep->pkt_per_frm) { ++ for (j = 0; j < dwc_ep->pkt_per_frm; ++j) { ++ uint32_t len = (j + 1) * dwc_ep->maxpacket; ++ if (len > dwc_ep->data_per_frame) ++ data_per_desc = ++ dwc_ep->data_per_frame - ++ j * dwc_ep->maxpacket; ++ else ++ data_per_desc = dwc_ep->maxpacket; ++ len = data_per_desc % 4; ++ if (len) ++ data_per_desc += 4 - len; ++ ++ data_per_desc = ++ sts.b_iso_out.rxbytes = data_per_desc; ++ dma_desc->buf = dma_ad; ++ dma_desc->status.d32 = sts.d32; ++ ++ offset += data_per_desc; ++ dma_desc++; ++ dma_ad += data_per_desc; ++ } ++ } ++ for (j = 0; j < dwc_ep->pkt_per_frm - 1; ++j) { ++ data_per_desc = ++ ((j + 1) * dwc_ep->maxpacket > ++ dwc_ep->data_per_frame) ? dwc_ep->data_per_frame - ++ j * dwc_ep->maxpacket : dwc_ep->maxpacket; ++ data_per_desc += ++ (data_per_desc % 4) ? (4 - data_per_desc % 4) : 0; ++ sts.b_iso_out.rxbytes = data_per_desc; ++ dma_desc->buf = dma_ad; ++ dma_desc->status.d32 = sts.d32; ++ ++ offset += data_per_desc; ++ dma_desc++; ++ dma_ad += data_per_desc; ++ } ++ ++ sts.b_iso_out.ioc = 1; ++ sts.b_iso_out.l = 1; ++ data_per_desc = ++ ((j + 1) * dwc_ep->maxpacket > ++ dwc_ep->data_per_frame) ? dwc_ep->data_per_frame - ++ j * dwc_ep->maxpacket : dwc_ep->maxpacket; ++ data_per_desc += ++ (data_per_desc % 4) ? (4 - data_per_desc % 4) : 0; ++ sts.b_iso_out.rxbytes = data_per_desc; ++ ++ dma_desc->buf = dma_ad; ++ dma_desc->status.d32 = sts.d32; ++ ++ dwc_ep->next_frame = 0; ++ ++ /** Write dma_ad into DOEPDMA register */ ++ DWC_WRITE_REG32(&(out_regs->doepdma), ++ (uint32_t) dwc_ep->iso_dma_desc_addr); ++ ++ } ++ /** ISO IN EP */ ++ else { ++ dev_dma_desc_sts_t sts = {.d32 = 0 }; ++ dwc_otg_dev_dma_desc_t *dma_desc = dwc_ep->iso_desc_addr; ++ dma_addr_t dma_ad; ++ dwc_otg_dev_in_ep_regs_t *in_regs = ++ core_if->dev_if->in_ep_regs[dwc_ep->num]; ++ unsigned int frmnumber; ++ fifosize_data_t txfifosize, rxfifosize; ++ ++ txfifosize.d32 = ++ DWC_READ_REG32(&core_if->dev_if->in_ep_regs[dwc_ep->num]-> ++ dtxfsts); ++ rxfifosize.d32 = ++ DWC_READ_REG32(&core_if->core_global_regs->grxfsiz); ++ ++ addr = &core_if->dev_if->in_ep_regs[dwc_ep->num]->diepctl; ++ ++ dma_ad = dwc_ep->dma_addr0; ++ ++ dsts.d32 = ++ DWC_READ_REG32(&core_if->dev_if->dev_global_regs->dsts); ++ ++ sts.b_iso_in.bs = BS_HOST_READY; ++ sts.b_iso_in.txsts = 0; ++ sts.b_iso_in.sp = ++ (dwc_ep->data_per_frame % dwc_ep->maxpacket) ? 1 : 0; ++ sts.b_iso_in.ioc = 0; ++ sts.b_iso_in.pid = dwc_ep->pkt_per_frm; ++ ++ frmnumber = dwc_ep->next_frame; ++ ++ sts.b_iso_in.framenum = frmnumber; ++ sts.b_iso_in.txbytes = dwc_ep->data_per_frame; ++ sts.b_iso_in.l = 0; ++ ++ /** Buffer 0 descriptors setup */ ++ for (i = 0; i < dwc_ep->desc_cnt - 1; i++) { ++ dma_desc->buf = dma_ad; ++ dma_desc->status.d32 = sts.d32; ++ dma_desc++; ++ ++ dma_ad += dwc_ep->data_per_frame; ++ sts.b_iso_in.framenum += dwc_ep->bInterval; ++ } ++ ++ sts.b_iso_in.ioc = 1; ++ dma_desc->buf = dma_ad; ++ dma_desc->status.d32 = sts.d32; ++ ++dma_desc; ++ ++ /** Buffer 1 descriptors setup */ ++ sts.b_iso_in.ioc = 0; ++ dma_ad = dwc_ep->dma_addr1; ++ ++ for (i = 0; i < dwc_ep->desc_cnt - dwc_ep->pkt_per_frm; ++ i += dwc_ep->pkt_per_frm) { ++ dma_desc->buf = dma_ad; ++ dma_desc->status.d32 = sts.d32; ++ dma_desc++; ++ ++ dma_ad += dwc_ep->data_per_frame; ++ sts.b_iso_in.framenum += dwc_ep->bInterval; ++ ++ sts.b_iso_in.ioc = 0; ++ } ++ sts.b_iso_in.ioc = 1; ++ sts.b_iso_in.l = 1; ++ ++ dma_desc->buf = dma_ad; ++ dma_desc->status.d32 = sts.d32; ++ ++ dwc_ep->next_frame = sts.b_iso_in.framenum + dwc_ep->bInterval; ++ ++ /** Write dma_ad into diepdma register */ ++ DWC_WRITE_REG32(&(in_regs->diepdma), ++ (uint32_t) dwc_ep->iso_dma_desc_addr); ++ } ++ /** Enable endpoint, clear nak */ ++ depctl.d32 = 0; ++ depctl.b.epena = 1; ++ depctl.b.usbactep = 1; ++ depctl.b.cnak = 1; ++ ++ DWC_MODIFY_REG32(addr, depctl.d32, depctl.d32); ++ depctl.d32 = DWC_READ_REG32(addr); ++} ++ ++/** ++ * This function initializes a descriptor chain for Isochronous transfer ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ * @param ep The EP to start the transfer on. ++ * ++ */ ++void dwc_otg_iso_ep_start_buf_transfer(dwc_otg_core_if_t * core_if, ++ dwc_ep_t * ep) ++{ ++ depctl_data_t depctl = {.d32 = 0 }; ++ volatile uint32_t *addr; ++ ++ if (ep->is_in) { ++ addr = &core_if->dev_if->in_ep_regs[ep->num]->diepctl; ++ } else { ++ addr = &core_if->dev_if->out_ep_regs[ep->num]->doepctl; ++ } ++ ++ if (core_if->dma_enable == 0 || core_if->dma_desc_enable != 0) { ++ return; ++ } else { ++ deptsiz_data_t deptsiz = {.d32 = 0 }; ++ ++ ep->xfer_len = ++ ep->data_per_frame * ep->buf_proc_intrvl / ep->bInterval; ++ ep->pkt_cnt = ++ (ep->xfer_len - 1 + ep->maxpacket) / ep->maxpacket; ++ ep->xfer_count = 0; ++ ep->xfer_buff = ++ (ep->proc_buf_num) ? ep->xfer_buff1 : ep->xfer_buff0; ++ ep->dma_addr = ++ (ep->proc_buf_num) ? ep->dma_addr1 : ep->dma_addr0; ++ ++ if (ep->is_in) { ++ /* Program the transfer size and packet count ++ * as follows: xfersize = N * maxpacket + ++ * short_packet pktcnt = N + (short_packet ++ * exist ? 1 : 0) ++ */ ++ deptsiz.b.mc = ep->pkt_per_frm; ++ deptsiz.b.xfersize = ep->xfer_len; ++ deptsiz.b.pktcnt = ++ (ep->xfer_len - 1 + ep->maxpacket) / ep->maxpacket; ++ DWC_WRITE_REG32(&core_if->dev_if->in_ep_regs[ep->num]-> ++ dieptsiz, deptsiz.d32); ++ ++ /* Write the DMA register */ ++ DWC_WRITE_REG32(& ++ (core_if->dev_if->in_ep_regs[ep->num]-> ++ diepdma), (uint32_t) ep->dma_addr); ++ ++ } else { ++ deptsiz.b.pktcnt = ++ (ep->xfer_len + (ep->maxpacket - 1)) / ++ ep->maxpacket; ++ deptsiz.b.xfersize = deptsiz.b.pktcnt * ep->maxpacket; ++ ++ DWC_WRITE_REG32(&core_if->dev_if->out_ep_regs[ep->num]-> ++ doeptsiz, deptsiz.d32); ++ ++ /* Write the DMA register */ ++ DWC_WRITE_REG32(& ++ (core_if->dev_if->out_ep_regs[ep->num]-> ++ doepdma), (uint32_t) ep->dma_addr); ++ ++ } ++ /** Enable endpoint, clear nak */ ++ depctl.d32 = 0; ++ depctl.b.epena = 1; ++ depctl.b.cnak = 1; ++ ++ DWC_MODIFY_REG32(addr, depctl.d32, depctl.d32); ++ } ++} ++ ++/** ++ * This function does the setup for a data transfer for an EP and ++ * starts the transfer. For an IN transfer, the packets will be ++ * loaded into the appropriate Tx FIFO in the ISR. For OUT transfers, ++ * the packets are unloaded from the Rx FIFO in the ISR. ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ * @param ep The EP to start the transfer on. ++ */ ++ ++static void dwc_otg_iso_ep_start_transfer(dwc_otg_core_if_t * core_if, ++ dwc_ep_t * ep) ++{ ++ if (core_if->dma_enable) { ++ if (core_if->dma_desc_enable) { ++ if (ep->is_in) { ++ ep->desc_cnt = ep->pkt_cnt / ep->pkt_per_frm; ++ } else { ++ ep->desc_cnt = ep->pkt_cnt; ++ } ++ dwc_otg_iso_ep_start_ddma_transfer(core_if, ep); ++ } else { ++ if (core_if->pti_enh_enable) { ++ dwc_otg_iso_ep_start_buf_transfer(core_if, ep); ++ } else { ++ ep->cur_pkt_addr = ++ (ep->proc_buf_num) ? ep->xfer_buff1 : ep-> ++ xfer_buff0; ++ ep->cur_pkt_dma_addr = ++ (ep->proc_buf_num) ? ep->dma_addr1 : ep-> ++ dma_addr0; ++ dwc_otg_iso_ep_start_frm_transfer(core_if, ep); ++ } ++ } ++ } else { ++ ep->cur_pkt_addr = ++ (ep->proc_buf_num) ? ep->xfer_buff1 : ep->xfer_buff0; ++ ep->cur_pkt_dma_addr = ++ (ep->proc_buf_num) ? ep->dma_addr1 : ep->dma_addr0; ++ dwc_otg_iso_ep_start_frm_transfer(core_if, ep); ++ } ++} ++ ++/** ++ * This function stops transfer for an EP and ++ * resets the ep's variables. ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ * @param ep The EP to start the transfer on. ++ */ ++ ++void dwc_otg_iso_ep_stop_transfer(dwc_otg_core_if_t * core_if, dwc_ep_t * ep) ++{ ++ depctl_data_t depctl = {.d32 = 0 }; ++ volatile uint32_t *addr; ++ ++ if (ep->is_in == 1) { ++ addr = &core_if->dev_if->in_ep_regs[ep->num]->diepctl; ++ } else { ++ addr = &core_if->dev_if->out_ep_regs[ep->num]->doepctl; ++ } ++ ++ /* disable the ep */ ++ depctl.d32 = DWC_READ_REG32(addr); ++ ++ depctl.b.epdis = 1; ++ depctl.b.snak = 1; ++ ++ DWC_WRITE_REG32(addr, depctl.d32); ++ ++ if (core_if->dma_desc_enable && ++ ep->iso_desc_addr && ep->iso_dma_desc_addr) { ++ dwc_otg_ep_free_desc_chain(ep->iso_desc_addr, ++ ep->iso_dma_desc_addr, ++ ep->desc_cnt * 2); ++ } ++ ++ /* reset varibales */ ++ ep->dma_addr0 = 0; ++ ep->dma_addr1 = 0; ++ ep->xfer_buff0 = 0; ++ ep->xfer_buff1 = 0; ++ ep->data_per_frame = 0; ++ ep->data_pattern_frame = 0; ++ ep->sync_frame = 0; ++ ep->buf_proc_intrvl = 0; ++ ep->bInterval = 0; ++ ep->proc_buf_num = 0; ++ ep->pkt_per_frm = 0; ++ ep->pkt_per_frm = 0; ++ ep->desc_cnt = 0; ++ ep->iso_desc_addr = 0; ++ ep->iso_dma_desc_addr = 0; ++} ++ ++int dwc_otg_pcd_iso_ep_start(dwc_otg_pcd_t * pcd, void *ep_handle, ++ uint8_t * buf0, uint8_t * buf1, dwc_dma_t dma0, ++ dwc_dma_t dma1, int sync_frame, int dp_frame, ++ int data_per_frame, int start_frame, ++ int buf_proc_intrvl, void *req_handle, ++ int atomic_alloc) ++{ ++ dwc_otg_pcd_ep_t *ep; ++ dwc_irqflags_t flags = 0; ++ dwc_ep_t *dwc_ep; ++ int32_t frm_data; ++ dsts_data_t dsts; ++ dwc_otg_core_if_t *core_if; ++ ++ ep = get_ep_from_handle(pcd, ep_handle); ++ ++ if (!ep || !ep->desc || ep->dwc_ep.num == 0) { ++ DWC_WARN("bad ep\n"); ++ return -DWC_E_INVALID; ++ } ++ ++ DWC_SPINLOCK_IRQSAVE(pcd->lock, &flags); ++ core_if = GET_CORE_IF(pcd); ++ dwc_ep = &ep->dwc_ep; ++ ++ if (ep->iso_req_handle) { ++ DWC_WARN("ISO request in progress\n"); ++ } ++ ++ dwc_ep->dma_addr0 = dma0; ++ dwc_ep->dma_addr1 = dma1; ++ ++ dwc_ep->xfer_buff0 = buf0; ++ dwc_ep->xfer_buff1 = buf1; ++ ++ dwc_ep->data_per_frame = data_per_frame; ++ ++ /** @todo - pattern data support is to be implemented in the future */ ++ dwc_ep->data_pattern_frame = dp_frame; ++ dwc_ep->sync_frame = sync_frame; ++ ++ dwc_ep->buf_proc_intrvl = buf_proc_intrvl; ++ ++ dwc_ep->bInterval = 1 << (ep->desc->bInterval - 1); ++ ++ dwc_ep->proc_buf_num = 0; ++ ++ dwc_ep->pkt_per_frm = 0; ++ frm_data = ep->dwc_ep.data_per_frame; ++ while (frm_data > 0) { ++ dwc_ep->pkt_per_frm++; ++ frm_data -= ep->dwc_ep.maxpacket; ++ } ++ ++ dsts.d32 = DWC_READ_REG32(&core_if->dev_if->dev_global_regs->dsts); ++ ++ if (start_frame == -1) { ++ dwc_ep->next_frame = dsts.b.soffn + 1; ++ if (dwc_ep->bInterval != 1) { ++ dwc_ep->next_frame = ++ dwc_ep->next_frame + (dwc_ep->bInterval - 1 - ++ dwc_ep->next_frame % ++ dwc_ep->bInterval); ++ } ++ } else { ++ dwc_ep->next_frame = start_frame; ++ } ++ ++ if (!core_if->pti_enh_enable) { ++ dwc_ep->pkt_cnt = ++ dwc_ep->buf_proc_intrvl * dwc_ep->pkt_per_frm / ++ dwc_ep->bInterval; ++ } else { ++ dwc_ep->pkt_cnt = ++ (dwc_ep->data_per_frame * ++ (dwc_ep->buf_proc_intrvl / dwc_ep->bInterval) ++ - 1 + dwc_ep->maxpacket) / dwc_ep->maxpacket; ++ } ++ ++ if (core_if->dma_desc_enable) { ++ dwc_ep->desc_cnt = ++ dwc_ep->buf_proc_intrvl * dwc_ep->pkt_per_frm / ++ dwc_ep->bInterval; ++ } ++ ++ if (atomic_alloc) { ++ dwc_ep->pkt_info = ++ DWC_ALLOC_ATOMIC(sizeof(iso_pkt_info_t) * dwc_ep->pkt_cnt); ++ } else { ++ dwc_ep->pkt_info = ++ DWC_ALLOC(sizeof(iso_pkt_info_t) * dwc_ep->pkt_cnt); ++ } ++ if (!dwc_ep->pkt_info) { ++ DWC_SPINUNLOCK_IRQRESTORE(pcd->lock, flags); ++ return -DWC_E_NO_MEMORY; ++ } ++ if (core_if->pti_enh_enable) { ++ dwc_memset(dwc_ep->pkt_info, 0, ++ sizeof(iso_pkt_info_t) * dwc_ep->pkt_cnt); ++ } ++ ++ dwc_ep->cur_pkt = 0; ++ ep->iso_req_handle = req_handle; ++ ++ DWC_SPINUNLOCK_IRQRESTORE(pcd->lock, flags); ++ dwc_otg_iso_ep_start_transfer(core_if, dwc_ep); ++ return 0; ++} ++ ++int dwc_otg_pcd_iso_ep_stop(dwc_otg_pcd_t * pcd, void *ep_handle, ++ void *req_handle) ++{ ++ dwc_irqflags_t flags = 0; ++ dwc_otg_pcd_ep_t *ep; ++ dwc_ep_t *dwc_ep; ++ ++ ep = get_ep_from_handle(pcd, ep_handle); ++ if (!ep || !ep->desc || ep->dwc_ep.num == 0) { ++ DWC_WARN("bad ep\n"); ++ return -DWC_E_INVALID; ++ } ++ dwc_ep = &ep->dwc_ep; ++ ++ dwc_otg_iso_ep_stop_transfer(GET_CORE_IF(pcd), dwc_ep); ++ ++ DWC_FREE(dwc_ep->pkt_info); ++ DWC_SPINLOCK_IRQSAVE(pcd->lock, &flags); ++ if (ep->iso_req_handle != req_handle) { ++ DWC_SPINUNLOCK_IRQRESTORE(pcd->lock, flags); ++ return -DWC_E_INVALID; ++ } ++ ++ DWC_SPINUNLOCK_IRQRESTORE(pcd->lock, flags); ++ ++ ep->iso_req_handle = 0; ++ return 0; ++} ++ ++/** ++ * This function is used for perodical data exchnage between PCD and gadget drivers. ++ * for Isochronous EPs ++ * ++ * - Every time a sync period completes this function is called to ++ * perform data exchange between PCD and gadget ++ */ ++void dwc_otg_iso_buffer_done(dwc_otg_pcd_t * pcd, dwc_otg_pcd_ep_t * ep, ++ void *req_handle) ++{ ++ int i; ++ dwc_ep_t *dwc_ep; ++ ++ dwc_ep = &ep->dwc_ep; ++ ++ DWC_SPINUNLOCK(ep->pcd->lock); ++ pcd->fops->isoc_complete(pcd, ep->priv, ep->iso_req_handle, ++ dwc_ep->proc_buf_num ^ 0x1); ++ DWC_SPINLOCK(ep->pcd->lock); ++ ++ for (i = 0; i < dwc_ep->pkt_cnt; ++i) { ++ dwc_ep->pkt_info[i].status = 0; ++ dwc_ep->pkt_info[i].offset = 0; ++ dwc_ep->pkt_info[i].length = 0; ++ } ++} ++ ++int dwc_otg_pcd_get_iso_packet_count(dwc_otg_pcd_t * pcd, void *ep_handle, ++ void *iso_req_handle) ++{ ++ dwc_otg_pcd_ep_t *ep; ++ dwc_ep_t *dwc_ep; ++ ++ ep = get_ep_from_handle(pcd, ep_handle); ++ if (!ep->desc || ep->dwc_ep.num == 0) { ++ DWC_WARN("bad ep\n"); ++ return -DWC_E_INVALID; ++ } ++ dwc_ep = &ep->dwc_ep; ++ ++ return dwc_ep->pkt_cnt; ++} ++ ++void dwc_otg_pcd_get_iso_packet_params(dwc_otg_pcd_t * pcd, void *ep_handle, ++ void *iso_req_handle, int packet, ++ int *status, int *actual, int *offset) ++{ ++ dwc_otg_pcd_ep_t *ep; ++ dwc_ep_t *dwc_ep; ++ ++ ep = get_ep_from_handle(pcd, ep_handle); ++ if (!ep) ++ DWC_WARN("bad ep\n"); ++ ++ dwc_ep = &ep->dwc_ep; ++ ++ *status = dwc_ep->pkt_info[packet].status; ++ *actual = dwc_ep->pkt_info[packet].length; ++ *offset = dwc_ep->pkt_info[packet].offset; ++} ++ ++#endif /* DWC_EN_ISOC */ ++ ++static void dwc_otg_pcd_init_ep(dwc_otg_pcd_t * pcd, dwc_otg_pcd_ep_t * pcd_ep, ++ uint32_t is_in, uint32_t ep_num) ++{ ++ /* Init EP structure */ ++ pcd_ep->desc = 0; ++ pcd_ep->pcd = pcd; ++ pcd_ep->stopped = 1; ++ pcd_ep->queue_sof = 0; ++ ++ /* Init DWC ep structure */ ++ pcd_ep->dwc_ep.is_in = is_in; ++ pcd_ep->dwc_ep.num = ep_num; ++ pcd_ep->dwc_ep.active = 0; ++ pcd_ep->dwc_ep.tx_fifo_num = 0; ++ /* Control until ep is actvated */ ++ pcd_ep->dwc_ep.type = DWC_OTG_EP_TYPE_CONTROL; ++ pcd_ep->dwc_ep.maxpacket = MAX_PACKET_SIZE; ++ pcd_ep->dwc_ep.dma_addr = 0; ++ pcd_ep->dwc_ep.start_xfer_buff = 0; ++ pcd_ep->dwc_ep.xfer_buff = 0; ++ pcd_ep->dwc_ep.xfer_len = 0; ++ pcd_ep->dwc_ep.xfer_count = 0; ++ pcd_ep->dwc_ep.sent_zlp = 0; ++ pcd_ep->dwc_ep.total_len = 0; ++ pcd_ep->dwc_ep.desc_addr = 0; ++ pcd_ep->dwc_ep.dma_desc_addr = 0; ++ DWC_CIRCLEQ_INIT(&pcd_ep->queue); ++} ++ ++/** ++ * Initialize ep's ++ */ ++static void dwc_otg_pcd_reinit(dwc_otg_pcd_t * pcd) ++{ ++ int i; ++ uint32_t hwcfg1; ++ dwc_otg_pcd_ep_t *ep; ++ int in_ep_cntr, out_ep_cntr; ++ uint32_t num_in_eps = (GET_CORE_IF(pcd))->dev_if->num_in_eps; ++ uint32_t num_out_eps = (GET_CORE_IF(pcd))->dev_if->num_out_eps; ++ ++ /** ++ * Initialize the EP0 structure. ++ */ ++ ep = &pcd->ep0; ++ dwc_otg_pcd_init_ep(pcd, ep, 0, 0); ++ ++ in_ep_cntr = 0; ++ hwcfg1 = (GET_CORE_IF(pcd))->hwcfg1.d32 >> 3; ++ for (i = 1; in_ep_cntr < num_in_eps; i++) { ++ if ((hwcfg1 & 0x1) == 0) { ++ dwc_otg_pcd_ep_t *ep = &pcd->in_ep[in_ep_cntr]; ++ in_ep_cntr++; ++ /** ++ * @todo NGS: Add direction to EP, based on contents ++ * of HWCFG1. Need a copy of HWCFG1 in pcd structure? ++ * sprintf(";r ++ */ ++ dwc_otg_pcd_init_ep(pcd, ep, 1 /* IN */ , i); ++ ++ DWC_CIRCLEQ_INIT(&ep->queue); ++ } ++ hwcfg1 >>= 2; ++ } ++ ++ out_ep_cntr = 0; ++ hwcfg1 = (GET_CORE_IF(pcd))->hwcfg1.d32 >> 2; ++ for (i = 1; out_ep_cntr < num_out_eps; i++) { ++ if ((hwcfg1 & 0x1) == 0) { ++ dwc_otg_pcd_ep_t *ep = &pcd->out_ep[out_ep_cntr]; ++ out_ep_cntr++; ++ /** ++ * @todo NGS: Add direction to EP, based on contents ++ * of HWCFG1. Need a copy of HWCFG1 in pcd structure? ++ * sprintf(";r ++ */ ++ dwc_otg_pcd_init_ep(pcd, ep, 0 /* OUT */ , i); ++ DWC_CIRCLEQ_INIT(&ep->queue); ++ } ++ hwcfg1 >>= 2; ++ } ++ ++ pcd->ep0state = EP0_DISCONNECT; ++ pcd->ep0.dwc_ep.maxpacket = MAX_EP0_SIZE; ++ pcd->ep0.dwc_ep.type = DWC_OTG_EP_TYPE_CONTROL; ++} ++ ++/** ++ * This function is called when the SRP timer expires. The SRP should ++ * complete within 6 seconds. ++ */ ++static void srp_timeout(void *ptr) ++{ ++ gotgctl_data_t gotgctl; ++ dwc_otg_core_if_t *core_if = (dwc_otg_core_if_t *) ptr; ++ volatile uint32_t *addr = &core_if->core_global_regs->gotgctl; ++ ++ gotgctl.d32 = DWC_READ_REG32(addr); ++ ++ core_if->srp_timer_started = 0; ++ ++ if (core_if->adp_enable) { ++ if (gotgctl.b.bsesvld == 0) { ++ gpwrdn_data_t gpwrdn = {.d32 = 0 }; ++ DWC_PRINTF("SRP Timeout BSESSVLD = 0\n"); ++ /* Power off the core */ ++ if (core_if->power_down == 2) { ++ gpwrdn.b.pwrdnswtch = 1; ++ DWC_MODIFY_REG32(&core_if-> ++ core_global_regs->gpwrdn, ++ gpwrdn.d32, 0); ++ } ++ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pmuintsel = 1; ++ gpwrdn.b.pmuactv = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, 0, ++ gpwrdn.d32); ++ dwc_otg_adp_probe_start(core_if); ++ } else { ++ DWC_PRINTF("SRP Timeout BSESSVLD = 1\n"); ++ core_if->op_state = B_PERIPHERAL; ++ dwc_otg_core_init(core_if); ++ dwc_otg_enable_global_interrupts(core_if); ++ cil_pcd_start(core_if); ++ } ++ } ++ ++ if ((core_if->core_params->phy_type == DWC_PHY_TYPE_PARAM_FS) && ++ (core_if->core_params->i2c_enable)) { ++ DWC_PRINTF("SRP Timeout\n"); ++ ++ if ((core_if->srp_success) && (gotgctl.b.bsesvld)) { ++ if (core_if->pcd_cb && core_if->pcd_cb->resume_wakeup) { ++ core_if->pcd_cb->resume_wakeup(core_if->pcd_cb->p); ++ } ++ ++ /* Clear Session Request */ ++ gotgctl.d32 = 0; ++ gotgctl.b.sesreq = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gotgctl, ++ gotgctl.d32, 0); ++ ++ core_if->srp_success = 0; ++ } else { ++ __DWC_ERROR("Device not connected/responding\n"); ++ gotgctl.b.sesreq = 0; ++ DWC_WRITE_REG32(addr, gotgctl.d32); ++ } ++ } else if (gotgctl.b.sesreq) { ++ DWC_PRINTF("SRP Timeout\n"); ++ ++ __DWC_ERROR("Device not connected/responding\n"); ++ gotgctl.b.sesreq = 0; ++ DWC_WRITE_REG32(addr, gotgctl.d32); ++ } else { ++ DWC_PRINTF(" SRP GOTGCTL=%0x\n", gotgctl.d32); ++ } ++} ++ ++/** ++ * Tasklet ++ * ++ */ ++extern void start_next_request(dwc_otg_pcd_ep_t * ep); ++ ++static void start_xfer_tasklet_func(void *data) ++{ ++ dwc_otg_pcd_t *pcd = (dwc_otg_pcd_t *) data; ++ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); ++ ++ int i; ++ depctl_data_t diepctl; ++ ++ DWC_DEBUGPL(DBG_PCDV, "Start xfer tasklet\n"); ++ ++ diepctl.d32 = DWC_READ_REG32(&core_if->dev_if->in_ep_regs[0]->diepctl); ++ ++ if (pcd->ep0.queue_sof) { ++ pcd->ep0.queue_sof = 0; ++ start_next_request(&pcd->ep0); ++ // break; ++ } ++ ++ for (i = 0; i < core_if->dev_if->num_in_eps; i++) { ++ depctl_data_t diepctl; ++ diepctl.d32 = ++ DWC_READ_REG32(&core_if->dev_if->in_ep_regs[i]->diepctl); ++ ++ if (pcd->in_ep[i].queue_sof) { ++ pcd->in_ep[i].queue_sof = 0; ++ start_next_request(&pcd->in_ep[i]); ++ // break; ++ } ++ } ++ ++ return; ++} ++ ++/** ++ * This function initialized the PCD portion of the driver. ++ * ++ */ ++dwc_otg_pcd_t *dwc_otg_pcd_init(dwc_otg_core_if_t * core_if) ++{ ++ dwc_otg_pcd_t *pcd = NULL; ++ dwc_otg_dev_if_t *dev_if; ++ int i; ++ ++ /* ++ * Allocate PCD structure ++ */ ++ pcd = DWC_ALLOC(sizeof(dwc_otg_pcd_t)); ++ ++ if (pcd == NULL) { ++ return NULL; ++ } ++ ++#if (defined(DWC_LINUX) && defined(CONFIG_DEBUG_SPINLOCK)) ++ DWC_SPINLOCK_ALLOC_LINUX_DEBUG(pcd->lock); ++#else ++ pcd->lock = DWC_SPINLOCK_ALLOC(); ++#endif ++ DWC_DEBUGPL(DBG_HCDV, "Init of PCD %p given core_if %p\n", ++ pcd, core_if);//GRAYG ++ if (!pcd->lock) { ++ DWC_ERROR("Could not allocate lock for pcd"); ++ DWC_FREE(pcd); ++ return NULL; ++ } ++ /* Set core_if's lock pointer to hcd->lock */ ++ core_if->lock = pcd->lock; ++ pcd->core_if = core_if; ++ ++ dev_if = core_if->dev_if; ++ dev_if->isoc_ep = NULL; ++ ++ if (core_if->hwcfg4.b.ded_fifo_en) { ++ DWC_PRINTF("Dedicated Tx FIFOs mode\n"); ++ } else { ++ DWC_PRINTF("Shared Tx FIFO mode\n"); ++ } ++ ++ /* ++ * Initialized the Core for Device mode here if there is nod ADP support. ++ * Otherwise it will be done later in dwc_otg_adp_start routine. ++ */ ++ if (dwc_otg_is_device_mode(core_if) /*&& !core_if->adp_enable*/) { ++ dwc_otg_core_dev_init(core_if); ++ } ++ ++ /* ++ * Register the PCD Callbacks. ++ */ ++ dwc_otg_cil_register_pcd_callbacks(core_if, &pcd_callbacks, pcd); ++ ++ /* ++ * Initialize the DMA buffer for SETUP packets ++ */ ++ if (GET_CORE_IF(pcd)->dma_enable) { ++ pcd->setup_pkt = ++ DWC_DMA_ALLOC(sizeof(*pcd->setup_pkt) * 5, ++ &pcd->setup_pkt_dma_handle); ++ if (pcd->setup_pkt == NULL) { ++ DWC_FREE(pcd); ++ return NULL; ++ } ++ ++ pcd->status_buf = ++ DWC_DMA_ALLOC(sizeof(uint16_t), ++ &pcd->status_buf_dma_handle); ++ if (pcd->status_buf == NULL) { ++ DWC_DMA_FREE(sizeof(*pcd->setup_pkt) * 5, ++ pcd->setup_pkt, pcd->setup_pkt_dma_handle); ++ DWC_FREE(pcd); ++ return NULL; ++ } ++ ++ if (GET_CORE_IF(pcd)->dma_desc_enable) { ++ dev_if->setup_desc_addr[0] = ++ dwc_otg_ep_alloc_desc_chain ++ (&dev_if->dma_setup_desc_addr[0], 1); ++ dev_if->setup_desc_addr[1] = ++ dwc_otg_ep_alloc_desc_chain ++ (&dev_if->dma_setup_desc_addr[1], 1); ++ dev_if->in_desc_addr = ++ dwc_otg_ep_alloc_desc_chain ++ (&dev_if->dma_in_desc_addr, 1); ++ dev_if->out_desc_addr = ++ dwc_otg_ep_alloc_desc_chain ++ (&dev_if->dma_out_desc_addr, 1); ++ pcd->data_terminated = 0; ++ ++ if (dev_if->setup_desc_addr[0] == 0 ++ || dev_if->setup_desc_addr[1] == 0 ++ || dev_if->in_desc_addr == 0 ++ || dev_if->out_desc_addr == 0) { ++ ++ if (dev_if->out_desc_addr) ++ dwc_otg_ep_free_desc_chain ++ (dev_if->out_desc_addr, ++ dev_if->dma_out_desc_addr, 1); ++ if (dev_if->in_desc_addr) ++ dwc_otg_ep_free_desc_chain ++ (dev_if->in_desc_addr, ++ dev_if->dma_in_desc_addr, 1); ++ if (dev_if->setup_desc_addr[1]) ++ dwc_otg_ep_free_desc_chain ++ (dev_if->setup_desc_addr[1], ++ dev_if->dma_setup_desc_addr[1], 1); ++ if (dev_if->setup_desc_addr[0]) ++ dwc_otg_ep_free_desc_chain ++ (dev_if->setup_desc_addr[0], ++ dev_if->dma_setup_desc_addr[0], 1); ++ ++ DWC_DMA_FREE(sizeof(*pcd->setup_pkt) * 5, ++ pcd->setup_pkt, ++ pcd->setup_pkt_dma_handle); ++ DWC_DMA_FREE(sizeof(*pcd->status_buf), ++ pcd->status_buf, ++ pcd->status_buf_dma_handle); ++ ++ DWC_FREE(pcd); ++ ++ return NULL; ++ } ++ } ++ } else { ++ pcd->setup_pkt = DWC_ALLOC(sizeof(*pcd->setup_pkt) * 5); ++ if (pcd->setup_pkt == NULL) { ++ DWC_FREE(pcd); ++ return NULL; ++ } ++ ++ pcd->status_buf = DWC_ALLOC(sizeof(uint16_t)); ++ if (pcd->status_buf == NULL) { ++ DWC_FREE(pcd->setup_pkt); ++ DWC_FREE(pcd); ++ return NULL; ++ } ++ } ++ ++ dwc_otg_pcd_reinit(pcd); ++ ++ /* Allocate the cfi object for the PCD */ ++#ifdef DWC_UTE_CFI ++ pcd->cfi = DWC_ALLOC(sizeof(cfiobject_t)); ++ if (NULL == pcd->cfi) ++ goto fail; ++ if (init_cfi(pcd->cfi)) { ++ CFI_INFO("%s: Failed to init the CFI object\n", __func__); ++ goto fail; ++ } ++#endif ++ ++ /* Initialize tasklets */ ++ pcd->start_xfer_tasklet = DWC_TASK_ALLOC("xfer_tasklet", ++ start_xfer_tasklet_func, pcd); ++ pcd->test_mode_tasklet = DWC_TASK_ALLOC("test_mode_tasklet", ++ do_test_mode, pcd); ++ ++ /* Initialize SRP timer */ ++ core_if->srp_timer = DWC_TIMER_ALLOC("SRP TIMER", srp_timeout, core_if); ++ ++ if (core_if->core_params->dev_out_nak) { ++ /** ++ * Initialize xfer timeout timer. Implemented for ++ * 2.93a feature "Device DDMA OUT NAK Enhancement" ++ */ ++ for(i = 0; i < MAX_EPS_CHANNELS; i++) { ++ pcd->core_if->ep_xfer_timer[i] = ++ DWC_TIMER_ALLOC("ep timer", ep_xfer_timeout, ++ &pcd->core_if->ep_xfer_info[i]); ++ } ++ } ++ ++ return pcd; ++#ifdef DWC_UTE_CFI ++fail: ++#endif ++ if (pcd->setup_pkt) ++ DWC_FREE(pcd->setup_pkt); ++ if (pcd->status_buf) ++ DWC_FREE(pcd->status_buf); ++#ifdef DWC_UTE_CFI ++ if (pcd->cfi) ++ DWC_FREE(pcd->cfi); ++#endif ++ if (pcd) ++ DWC_FREE(pcd); ++ return NULL; ++ ++} ++ ++/** ++ * Remove PCD specific data ++ */ ++void dwc_otg_pcd_remove(dwc_otg_pcd_t * pcd) ++{ ++ dwc_otg_dev_if_t *dev_if = GET_CORE_IF(pcd)->dev_if; ++ int i; ++ if (pcd->core_if->core_params->dev_out_nak) { ++ for (i = 0; i < MAX_EPS_CHANNELS; i++) { ++ DWC_TIMER_CANCEL(pcd->core_if->ep_xfer_timer[i]); ++ pcd->core_if->ep_xfer_info[i].state = 0; ++ } ++ } ++ ++ if (GET_CORE_IF(pcd)->dma_enable) { ++ DWC_DMA_FREE(sizeof(*pcd->setup_pkt) * 5, pcd->setup_pkt, ++ pcd->setup_pkt_dma_handle); ++ DWC_DMA_FREE(sizeof(uint16_t), pcd->status_buf, ++ pcd->status_buf_dma_handle); ++ if (GET_CORE_IF(pcd)->dma_desc_enable) { ++ dwc_otg_ep_free_desc_chain(dev_if->setup_desc_addr[0], ++ dev_if->dma_setup_desc_addr ++ [0], 1); ++ dwc_otg_ep_free_desc_chain(dev_if->setup_desc_addr[1], ++ dev_if->dma_setup_desc_addr ++ [1], 1); ++ dwc_otg_ep_free_desc_chain(dev_if->in_desc_addr, ++ dev_if->dma_in_desc_addr, 1); ++ dwc_otg_ep_free_desc_chain(dev_if->out_desc_addr, ++ dev_if->dma_out_desc_addr, ++ 1); ++ } ++ } else { ++ DWC_FREE(pcd->setup_pkt); ++ DWC_FREE(pcd->status_buf); ++ } ++ DWC_SPINLOCK_FREE(pcd->lock); ++ /* Set core_if's lock pointer to NULL */ ++ pcd->core_if->lock = NULL; ++ ++ DWC_TASK_FREE(pcd->start_xfer_tasklet); ++ DWC_TASK_FREE(pcd->test_mode_tasklet); ++ if (pcd->core_if->core_params->dev_out_nak) { ++ for (i = 0; i < MAX_EPS_CHANNELS; i++) { ++ if (pcd->core_if->ep_xfer_timer[i]) { ++ DWC_TIMER_FREE(pcd->core_if->ep_xfer_timer[i]); ++ } ++ } ++ } ++ ++/* Release the CFI object's dynamic memory */ ++#ifdef DWC_UTE_CFI ++ if (pcd->cfi->ops.release) { ++ pcd->cfi->ops.release(pcd->cfi); ++ } ++#endif ++ ++ DWC_FREE(pcd); ++} ++ ++/** ++ * Returns whether registered pcd is dual speed or not ++ */ ++uint32_t dwc_otg_pcd_is_dualspeed(dwc_otg_pcd_t * pcd) ++{ ++ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); ++ ++ if ((core_if->core_params->speed == DWC_SPEED_PARAM_FULL) || ++ ((core_if->hwcfg2.b.hs_phy_type == 2) && ++ (core_if->hwcfg2.b.fs_phy_type == 1) && ++ (core_if->core_params->ulpi_fs_ls))) { ++ return 0; ++ } ++ ++ return 1; ++} ++ ++/** ++ * Returns whether registered pcd is OTG capable or not ++ */ ++uint32_t dwc_otg_pcd_is_otg(dwc_otg_pcd_t * pcd) ++{ ++ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); ++ gusbcfg_data_t usbcfg = {.d32 = 0 }; ++ ++ usbcfg.d32 = DWC_READ_REG32(&core_if->core_global_regs->gusbcfg); ++ if (!usbcfg.b.srpcap || !usbcfg.b.hnpcap) { ++ return 0; ++ } ++ ++ return 1; ++} ++ ++/** ++ * This function assigns periodic Tx FIFO to an periodic EP ++ * in shared Tx FIFO mode ++ */ ++static uint32_t assign_tx_fifo(dwc_otg_core_if_t * core_if) ++{ ++ uint32_t TxMsk = 1; ++ int i; ++ ++ for (i = 0; i < core_if->hwcfg4.b.num_in_eps; ++i) { ++ if ((TxMsk & core_if->tx_msk) == 0) { ++ core_if->tx_msk |= TxMsk; ++ return i + 1; ++ } ++ TxMsk <<= 1; ++ } ++ return 0; ++} ++ ++/** ++ * This function assigns periodic Tx FIFO to an periodic EP ++ * in shared Tx FIFO mode ++ */ ++static uint32_t assign_perio_tx_fifo(dwc_otg_core_if_t * core_if) ++{ ++ uint32_t PerTxMsk = 1; ++ int i; ++ for (i = 0; i < core_if->hwcfg4.b.num_dev_perio_in_ep; ++i) { ++ if ((PerTxMsk & core_if->p_tx_msk) == 0) { ++ core_if->p_tx_msk |= PerTxMsk; ++ return i + 1; ++ } ++ PerTxMsk <<= 1; ++ } ++ return 0; ++} ++ ++/** ++ * This function releases periodic Tx FIFO ++ * in shared Tx FIFO mode ++ */ ++static void release_perio_tx_fifo(dwc_otg_core_if_t * core_if, ++ uint32_t fifo_num) ++{ ++ core_if->p_tx_msk = ++ (core_if->p_tx_msk & (1 << (fifo_num - 1))) ^ core_if->p_tx_msk; ++} ++ ++/** ++ * This function releases periodic Tx FIFO ++ * in shared Tx FIFO mode ++ */ ++static void release_tx_fifo(dwc_otg_core_if_t * core_if, uint32_t fifo_num) ++{ ++ core_if->tx_msk = ++ (core_if->tx_msk & (1 << (fifo_num - 1))) ^ core_if->tx_msk; ++} ++ ++/** ++ * This function is being called from gadget ++ * to enable PCD endpoint. ++ */ ++int dwc_otg_pcd_ep_enable(dwc_otg_pcd_t * pcd, ++ const uint8_t * ep_desc, void *usb_ep) ++{ ++ int num, dir; ++ dwc_otg_pcd_ep_t *ep = NULL; ++ const usb_endpoint_descriptor_t *desc; ++ dwc_irqflags_t flags; ++ fifosize_data_t dptxfsiz = {.d32 = 0 }; ++ gdfifocfg_data_t gdfifocfg = {.d32 = 0 }; ++ gdfifocfg_data_t gdfifocfgbase = {.d32 = 0 }; ++ int retval = 0; ++ int i, epcount; ++ ++ desc = (const usb_endpoint_descriptor_t *)ep_desc; ++ ++ if (!desc) { ++ pcd->ep0.priv = usb_ep; ++ ep = &pcd->ep0; ++ retval = -DWC_E_INVALID; ++ goto out; ++ } ++ ++ num = UE_GET_ADDR(desc->bEndpointAddress); ++ dir = UE_GET_DIR(desc->bEndpointAddress); ++ ++ if (!desc->wMaxPacketSize) { ++ DWC_WARN("bad maxpacketsize\n"); ++ retval = -DWC_E_INVALID; ++ goto out; ++ } ++ ++ if (dir == UE_DIR_IN) { ++ epcount = pcd->core_if->dev_if->num_in_eps; ++ for (i = 0; i < epcount; i++) { ++ if (num == pcd->in_ep[i].dwc_ep.num) { ++ ep = &pcd->in_ep[i]; ++ break; ++ } ++ } ++ } else { ++ epcount = pcd->core_if->dev_if->num_out_eps; ++ for (i = 0; i < epcount; i++) { ++ if (num == pcd->out_ep[i].dwc_ep.num) { ++ ep = &pcd->out_ep[i]; ++ break; ++ } ++ } ++ } ++ ++ if (!ep) { ++ DWC_WARN("bad address\n"); ++ retval = -DWC_E_INVALID; ++ goto out; ++ } ++ ++ DWC_SPINLOCK_IRQSAVE(pcd->lock, &flags); ++ ++ ep->desc = desc; ++ ep->priv = usb_ep; ++ ++ /* ++ * Activate the EP ++ */ ++ ep->stopped = 0; ++ ++ ep->dwc_ep.is_in = (dir == UE_DIR_IN); ++ ep->dwc_ep.maxpacket = UGETW(desc->wMaxPacketSize); ++ ++ ep->dwc_ep.type = desc->bmAttributes & UE_XFERTYPE; ++ ++ if (ep->dwc_ep.is_in) { ++ if (!GET_CORE_IF(pcd)->en_multiple_tx_fifo) { ++ ep->dwc_ep.tx_fifo_num = 0; ++ ++ if (ep->dwc_ep.type == UE_ISOCHRONOUS) { ++ /* ++ * if ISOC EP then assign a Periodic Tx FIFO. ++ */ ++ ep->dwc_ep.tx_fifo_num = ++ assign_perio_tx_fifo(GET_CORE_IF(pcd)); ++ } ++ } else { ++ /* ++ * if Dedicated FIFOs mode is on then assign a Tx FIFO. ++ */ ++ ep->dwc_ep.tx_fifo_num = ++ assign_tx_fifo(GET_CORE_IF(pcd)); ++ } ++ ++ /* Calculating EP info controller base address */ ++ if (ep->dwc_ep.tx_fifo_num ++ && GET_CORE_IF(pcd)->en_multiple_tx_fifo) { ++ gdfifocfg.d32 = ++ DWC_READ_REG32(&GET_CORE_IF(pcd)-> ++ core_global_regs->gdfifocfg); ++ gdfifocfgbase.d32 = gdfifocfg.d32 >> 16; ++ dptxfsiz.d32 = ++ (DWC_READ_REG32 ++ (&GET_CORE_IF(pcd)->core_global_regs-> ++ dtxfsiz[ep->dwc_ep.tx_fifo_num - 1]) >> 16); ++ gdfifocfg.b.epinfobase = ++ gdfifocfgbase.d32 + dptxfsiz.d32; ++ if (GET_CORE_IF(pcd)->snpsid <= OTG_CORE_REV_2_94a) { ++ DWC_WRITE_REG32(&GET_CORE_IF(pcd)-> ++ core_global_regs->gdfifocfg, ++ gdfifocfg.d32); ++ } ++ } ++ } ++ /* Set initial data PID. */ ++ if (ep->dwc_ep.type == UE_BULK) { ++ ep->dwc_ep.data_pid_start = 0; ++ } ++ ++ /* Alloc DMA Descriptors */ ++ if (GET_CORE_IF(pcd)->dma_desc_enable) { ++#ifndef DWC_UTE_PER_IO ++ if (ep->dwc_ep.type != UE_ISOCHRONOUS) { ++#endif ++ ep->dwc_ep.desc_addr = ++ dwc_otg_ep_alloc_desc_chain(&ep-> ++ dwc_ep.dma_desc_addr, ++ MAX_DMA_DESC_CNT); ++ if (!ep->dwc_ep.desc_addr) { ++ DWC_WARN("%s, can't allocate DMA descriptor\n", ++ __func__); ++ retval = -DWC_E_SHUTDOWN; ++ DWC_SPINUNLOCK_IRQRESTORE(pcd->lock, flags); ++ goto out; ++ } ++#ifndef DWC_UTE_PER_IO ++ } ++#endif ++ } ++ ++ DWC_DEBUGPL(DBG_PCD, "Activate %s: type=%d, mps=%d desc=%p\n", ++ (ep->dwc_ep.is_in ? "IN" : "OUT"), ++ ep->dwc_ep.type, ep->dwc_ep.maxpacket, ep->desc); ++#ifdef DWC_UTE_PER_IO ++ ep->dwc_ep.xiso_bInterval = 1 << (ep->desc->bInterval - 1); ++#endif ++ if (ep->dwc_ep.type == DWC_OTG_EP_TYPE_ISOC) { ++ ep->dwc_ep.bInterval = 1 << (ep->desc->bInterval - 1); ++ ep->dwc_ep.frame_num = 0xFFFFFFFF; ++ } ++ ++ dwc_otg_ep_activate(GET_CORE_IF(pcd), &ep->dwc_ep); ++ ++#ifdef DWC_UTE_CFI ++ if (pcd->cfi->ops.ep_enable) { ++ pcd->cfi->ops.ep_enable(pcd->cfi, pcd, ep); ++ } ++#endif ++ ++ DWC_SPINUNLOCK_IRQRESTORE(pcd->lock, flags); ++ ++out: ++ return retval; ++} ++ ++/** ++ * This function is being called from gadget ++ * to disable PCD endpoint. ++ */ ++int dwc_otg_pcd_ep_disable(dwc_otg_pcd_t * pcd, void *ep_handle) ++{ ++ dwc_otg_pcd_ep_t *ep; ++ dwc_irqflags_t flags; ++ dwc_otg_dev_dma_desc_t *desc_addr; ++ dwc_dma_t dma_desc_addr; ++ gdfifocfg_data_t gdfifocfgbase = {.d32 = 0 }; ++ gdfifocfg_data_t gdfifocfg = {.d32 = 0 }; ++ fifosize_data_t dptxfsiz = {.d32 = 0 }; ++ ++ ep = get_ep_from_handle(pcd, ep_handle); ++ ++ if (!ep || !ep->desc) { ++ DWC_DEBUGPL(DBG_PCD, "bad ep address\n"); ++ return -DWC_E_INVALID; ++ } ++ ++ DWC_SPINLOCK_IRQSAVE(pcd->lock, &flags); ++ ++ dwc_otg_request_nuke(ep); ++ ++ dwc_otg_ep_deactivate(GET_CORE_IF(pcd), &ep->dwc_ep); ++ if (pcd->core_if->core_params->dev_out_nak) { ++ DWC_TIMER_CANCEL(pcd->core_if->ep_xfer_timer[ep->dwc_ep.num]); ++ pcd->core_if->ep_xfer_info[ep->dwc_ep.num].state = 0; ++ } ++ ep->desc = NULL; ++ ep->stopped = 1; ++ ++ gdfifocfg.d32 = ++ DWC_READ_REG32(&GET_CORE_IF(pcd)->core_global_regs->gdfifocfg); ++ gdfifocfgbase.d32 = gdfifocfg.d32 >> 16; ++ ++ if (ep->dwc_ep.is_in) { ++ if (GET_CORE_IF(pcd)->en_multiple_tx_fifo) { ++ /* Flush the Tx FIFO */ ++ dwc_otg_flush_tx_fifo(GET_CORE_IF(pcd), ++ ep->dwc_ep.tx_fifo_num); ++ } ++ release_perio_tx_fifo(GET_CORE_IF(pcd), ep->dwc_ep.tx_fifo_num); ++ release_tx_fifo(GET_CORE_IF(pcd), ep->dwc_ep.tx_fifo_num); ++ if (GET_CORE_IF(pcd)->en_multiple_tx_fifo) { ++ /* Decreasing EPinfo Base Addr */ ++ dptxfsiz.d32 = ++ (DWC_READ_REG32 ++ (&GET_CORE_IF(pcd)-> ++ core_global_regs->dtxfsiz[ep->dwc_ep.tx_fifo_num-1]) >> 16); ++ gdfifocfg.b.epinfobase = gdfifocfgbase.d32 - dptxfsiz.d32; ++ if (GET_CORE_IF(pcd)->snpsid <= OTG_CORE_REV_2_94a) { ++ DWC_WRITE_REG32(&GET_CORE_IF(pcd)->core_global_regs->gdfifocfg, ++ gdfifocfg.d32); ++ } ++ } ++ } ++ ++ /* Free DMA Descriptors */ ++ if (GET_CORE_IF(pcd)->dma_desc_enable) { ++ if (ep->dwc_ep.type != UE_ISOCHRONOUS) { ++ desc_addr = ep->dwc_ep.desc_addr; ++ dma_desc_addr = ep->dwc_ep.dma_desc_addr; ++ ++ /* Cannot call dma_free_coherent() with IRQs disabled */ ++ DWC_SPINUNLOCK_IRQRESTORE(pcd->lock, flags); ++ dwc_otg_ep_free_desc_chain(desc_addr, dma_desc_addr, ++ MAX_DMA_DESC_CNT); ++ ++ goto out_unlocked; ++ } ++ } ++ DWC_SPINUNLOCK_IRQRESTORE(pcd->lock, flags); ++ ++out_unlocked: ++ DWC_DEBUGPL(DBG_PCD, "%d %s disabled\n", ep->dwc_ep.num, ++ ep->dwc_ep.is_in ? "IN" : "OUT"); ++ return 0; ++ ++} ++ ++/******************************************************************************/ ++#ifdef DWC_UTE_PER_IO ++ ++/** ++ * Free the request and its extended parts ++ * ++ */ ++void dwc_pcd_xiso_ereq_free(dwc_otg_pcd_ep_t * ep, dwc_otg_pcd_request_t * req) ++{ ++ DWC_FREE(req->ext_req.per_io_frame_descs); ++ DWC_FREE(req); ++} ++ ++/** ++ * Start the next request in the endpoint's queue. ++ * ++ */ ++int dwc_otg_pcd_xiso_start_next_request(dwc_otg_pcd_t * pcd, ++ dwc_otg_pcd_ep_t * ep) ++{ ++ int i; ++ dwc_otg_pcd_request_t *req = NULL; ++ dwc_ep_t *dwcep = NULL; ++ struct dwc_iso_xreq_port *ereq = NULL; ++ struct dwc_iso_pkt_desc_port *ddesc_iso; ++ uint16_t nat; ++ depctl_data_t diepctl; ++ ++ dwcep = &ep->dwc_ep; ++ ++ if (dwcep->xiso_active_xfers > 0) { ++#if 0 //Disable this to decrease s/w overhead that is crucial for Isoc transfers ++ DWC_WARN("There are currently active transfers for EP%d \ ++ (active=%d; queued=%d)", dwcep->num, dwcep->xiso_active_xfers, ++ dwcep->xiso_queued_xfers); ++#endif ++ return 0; ++ } ++ ++ nat = UGETW(ep->desc->wMaxPacketSize); ++ nat = (nat >> 11) & 0x03; ++ ++ if (!DWC_CIRCLEQ_EMPTY(&ep->queue)) { ++ req = DWC_CIRCLEQ_FIRST(&ep->queue); ++ ereq = &req->ext_req; ++ ep->stopped = 0; ++ ++ /* Get the frame number */ ++ dwcep->xiso_frame_num = ++ dwc_otg_get_frame_number(GET_CORE_IF(pcd)); ++ DWC_DEBUG("FRM_NUM=%d", dwcep->xiso_frame_num); ++ ++ ddesc_iso = ereq->per_io_frame_descs; ++ ++ if (dwcep->is_in) { ++ /* Setup DMA Descriptor chain for IN Isoc request */ ++ for (i = 0; i < ereq->pio_pkt_count; i++) { ++ //if ((i % (nat + 1)) == 0) ++ if ( i > 0 ) ++ dwcep->xiso_frame_num = ++ (dwcep->xiso_bInterval + ++ dwcep->xiso_frame_num) & 0x3FFF; ++ dwcep->desc_addr[i].buf = ++ req->dma + ddesc_iso[i].offset; ++ dwcep->desc_addr[i].status.b_iso_in.txbytes = ++ ddesc_iso[i].length; ++ dwcep->desc_addr[i].status.b_iso_in.framenum = ++ dwcep->xiso_frame_num; ++ dwcep->desc_addr[i].status.b_iso_in.bs = ++ BS_HOST_READY; ++ dwcep->desc_addr[i].status.b_iso_in.txsts = 0; ++ dwcep->desc_addr[i].status.b_iso_in.sp = ++ (ddesc_iso[i].length % ++ dwcep->maxpacket) ? 1 : 0; ++ dwcep->desc_addr[i].status.b_iso_in.ioc = 0; ++ dwcep->desc_addr[i].status.b_iso_in.pid = nat + 1; ++ dwcep->desc_addr[i].status.b_iso_in.l = 0; ++ ++ /* Process the last descriptor */ ++ if (i == ereq->pio_pkt_count - 1) { ++ dwcep->desc_addr[i].status.b_iso_in.ioc = 1; ++ dwcep->desc_addr[i].status.b_iso_in.l = 1; ++ } ++ } ++ ++ /* Setup and start the transfer for this endpoint */ ++ dwcep->xiso_active_xfers++; ++ DWC_WRITE_REG32(&GET_CORE_IF(pcd)->dev_if-> ++ in_ep_regs[dwcep->num]->diepdma, ++ dwcep->dma_desc_addr); ++ diepctl.d32 = 0; ++ diepctl.b.epena = 1; ++ diepctl.b.cnak = 1; ++ DWC_MODIFY_REG32(&GET_CORE_IF(pcd)->dev_if-> ++ in_ep_regs[dwcep->num]->diepctl, 0, ++ diepctl.d32); ++ } else { ++ /* Setup DMA Descriptor chain for OUT Isoc request */ ++ for (i = 0; i < ereq->pio_pkt_count; i++) { ++ //if ((i % (nat + 1)) == 0) ++ dwcep->xiso_frame_num = (dwcep->xiso_bInterval + ++ dwcep->xiso_frame_num) & 0x3FFF; ++ dwcep->desc_addr[i].buf = ++ req->dma + ddesc_iso[i].offset; ++ dwcep->desc_addr[i].status.b_iso_out.rxbytes = ++ ddesc_iso[i].length; ++ dwcep->desc_addr[i].status.b_iso_out.framenum = ++ dwcep->xiso_frame_num; ++ dwcep->desc_addr[i].status.b_iso_out.bs = ++ BS_HOST_READY; ++ dwcep->desc_addr[i].status.b_iso_out.rxsts = 0; ++ dwcep->desc_addr[i].status.b_iso_out.sp = ++ (ddesc_iso[i].length % ++ dwcep->maxpacket) ? 1 : 0; ++ dwcep->desc_addr[i].status.b_iso_out.ioc = 0; ++ dwcep->desc_addr[i].status.b_iso_out.pid = nat + 1; ++ dwcep->desc_addr[i].status.b_iso_out.l = 0; ++ ++ /* Process the last descriptor */ ++ if (i == ereq->pio_pkt_count - 1) { ++ dwcep->desc_addr[i].status.b_iso_out.ioc = 1; ++ dwcep->desc_addr[i].status.b_iso_out.l = 1; ++ } ++ } ++ ++ /* Setup and start the transfer for this endpoint */ ++ dwcep->xiso_active_xfers++; ++ DWC_WRITE_REG32(&GET_CORE_IF(pcd)-> ++ dev_if->out_ep_regs[dwcep->num]-> ++ doepdma, dwcep->dma_desc_addr); ++ diepctl.d32 = 0; ++ diepctl.b.epena = 1; ++ diepctl.b.cnak = 1; ++ DWC_MODIFY_REG32(&GET_CORE_IF(pcd)-> ++ dev_if->out_ep_regs[dwcep->num]-> ++ doepctl, 0, diepctl.d32); ++ } ++ ++ } else { ++ ep->stopped = 1; ++ } ++ ++ return 0; ++} ++ ++/** ++ * - Remove the request from the queue ++ */ ++void complete_xiso_ep(dwc_otg_pcd_ep_t * ep) ++{ ++ dwc_otg_pcd_request_t *req = NULL; ++ struct dwc_iso_xreq_port *ereq = NULL; ++ struct dwc_iso_pkt_desc_port *ddesc_iso = NULL; ++ dwc_ep_t *dwcep = NULL; ++ int i; ++ ++ //DWC_DEBUG(); ++ dwcep = &ep->dwc_ep; ++ ++ /* Get the first pending request from the queue */ ++ if (!DWC_CIRCLEQ_EMPTY(&ep->queue)) { ++ req = DWC_CIRCLEQ_FIRST(&ep->queue); ++ if (!req) { ++ DWC_PRINTF("complete_ep 0x%p, req = NULL!\n", ep); ++ return; ++ } ++ dwcep->xiso_active_xfers--; ++ dwcep->xiso_queued_xfers--; ++ /* Remove this request from the queue */ ++ DWC_CIRCLEQ_REMOVE_INIT(&ep->queue, req, queue_entry); ++ } else { ++ DWC_PRINTF("complete_ep 0x%p, ep->queue empty!\n", ep); ++ return; ++ } ++ ++ ep->stopped = 1; ++ ereq = &req->ext_req; ++ ddesc_iso = ereq->per_io_frame_descs; ++ ++ if (dwcep->xiso_active_xfers < 0) { ++ DWC_WARN("EP#%d (xiso_active_xfers=%d)", dwcep->num, ++ dwcep->xiso_active_xfers); ++ } ++ ++ /* Fill the Isoc descs of portable extended req from dma descriptors */ ++ for (i = 0; i < ereq->pio_pkt_count; i++) { ++ if (dwcep->is_in) { /* IN endpoints */ ++ ddesc_iso[i].actual_length = ddesc_iso[i].length - ++ dwcep->desc_addr[i].status.b_iso_in.txbytes; ++ ddesc_iso[i].status = ++ dwcep->desc_addr[i].status.b_iso_in.txsts; ++ } else { /* OUT endpoints */ ++ ddesc_iso[i].actual_length = ddesc_iso[i].length - ++ dwcep->desc_addr[i].status.b_iso_out.rxbytes; ++ ddesc_iso[i].status = ++ dwcep->desc_addr[i].status.b_iso_out.rxsts; ++ } ++ } ++ ++ DWC_SPINUNLOCK(ep->pcd->lock); ++ ++ /* Call the completion function in the non-portable logic */ ++ ep->pcd->fops->xisoc_complete(ep->pcd, ep->priv, req->priv, 0, ++ &req->ext_req); ++ ++ DWC_SPINLOCK(ep->pcd->lock); ++ ++ /* Free the request - specific freeing needed for extended request object */ ++ dwc_pcd_xiso_ereq_free(ep, req); ++ ++ /* Start the next request */ ++ dwc_otg_pcd_xiso_start_next_request(ep->pcd, ep); ++ ++ return; ++} ++ ++/** ++ * Create and initialize the Isoc pkt descriptors of the extended request. ++ * ++ */ ++static int dwc_otg_pcd_xiso_create_pkt_descs(dwc_otg_pcd_request_t * req, ++ void *ereq_nonport, ++ int atomic_alloc) ++{ ++ struct dwc_iso_xreq_port *ereq = NULL; ++ struct dwc_iso_xreq_port *req_mapped = NULL; ++ struct dwc_iso_pkt_desc_port *ipds = NULL; /* To be created in this function */ ++ uint32_t pkt_count; ++ int i; ++ ++ ereq = &req->ext_req; ++ req_mapped = (struct dwc_iso_xreq_port *)ereq_nonport; ++ pkt_count = req_mapped->pio_pkt_count; ++ ++ /* Create the isoc descs */ ++ if (atomic_alloc) { ++ ipds = DWC_ALLOC_ATOMIC(sizeof(*ipds) * pkt_count); ++ } else { ++ ipds = DWC_ALLOC(sizeof(*ipds) * pkt_count); ++ } ++ ++ if (!ipds) { ++ DWC_ERROR("Failed to allocate isoc descriptors"); ++ return -DWC_E_NO_MEMORY; ++ } ++ ++ /* Initialize the extended request fields */ ++ ereq->per_io_frame_descs = ipds; ++ ereq->error_count = 0; ++ ereq->pio_alloc_pkt_count = pkt_count; ++ ereq->pio_pkt_count = pkt_count; ++ ereq->tr_sub_flags = req_mapped->tr_sub_flags; ++ ++ /* Init the Isoc descriptors */ ++ for (i = 0; i < pkt_count; i++) { ++ ipds[i].length = req_mapped->per_io_frame_descs[i].length; ++ ipds[i].offset = req_mapped->per_io_frame_descs[i].offset; ++ ipds[i].status = req_mapped->per_io_frame_descs[i].status; /* 0 */ ++ ipds[i].actual_length = ++ req_mapped->per_io_frame_descs[i].actual_length; ++ } ++ ++ return 0; ++} ++ ++static void prn_ext_request(struct dwc_iso_xreq_port *ereq) ++{ ++ struct dwc_iso_pkt_desc_port *xfd = NULL; ++ int i; ++ ++ DWC_DEBUG("per_io_frame_descs=%p", ereq->per_io_frame_descs); ++ DWC_DEBUG("tr_sub_flags=%d", ereq->tr_sub_flags); ++ DWC_DEBUG("error_count=%d", ereq->error_count); ++ DWC_DEBUG("pio_alloc_pkt_count=%d", ereq->pio_alloc_pkt_count); ++ DWC_DEBUG("pio_pkt_count=%d", ereq->pio_pkt_count); ++ DWC_DEBUG("res=%d", ereq->res); ++ ++ for (i = 0; i < ereq->pio_pkt_count; i++) { ++ xfd = &ereq->per_io_frame_descs[0]; ++ DWC_DEBUG("FD #%d", i); ++ ++ DWC_DEBUG("xfd->actual_length=%d", xfd->actual_length); ++ DWC_DEBUG("xfd->length=%d", xfd->length); ++ DWC_DEBUG("xfd->offset=%d", xfd->offset); ++ DWC_DEBUG("xfd->status=%d", xfd->status); ++ } ++} ++ ++/** ++ * ++ */ ++int dwc_otg_pcd_xiso_ep_queue(dwc_otg_pcd_t * pcd, void *ep_handle, ++ uint8_t * buf, dwc_dma_t dma_buf, uint32_t buflen, ++ int zero, void *req_handle, int atomic_alloc, ++ void *ereq_nonport) ++{ ++ dwc_otg_pcd_request_t *req = NULL; ++ dwc_otg_pcd_ep_t *ep; ++ dwc_irqflags_t flags; ++ int res; ++ ++ ep = get_ep_from_handle(pcd, ep_handle); ++ if (!ep) { ++ DWC_WARN("bad ep\n"); ++ return -DWC_E_INVALID; ++ } ++ ++ /* We support this extension only for DDMA mode */ ++ if (ep->dwc_ep.type == DWC_OTG_EP_TYPE_ISOC) ++ if (!GET_CORE_IF(pcd)->dma_desc_enable) ++ return -DWC_E_INVALID; ++ ++ /* Create a dwc_otg_pcd_request_t object */ ++ if (atomic_alloc) { ++ req = DWC_ALLOC_ATOMIC(sizeof(*req)); ++ } else { ++ req = DWC_ALLOC(sizeof(*req)); ++ } ++ ++ if (!req) { ++ return -DWC_E_NO_MEMORY; ++ } ++ ++ /* Create the Isoc descs for this request which shall be the exact match ++ * of the structure sent to us from the non-portable logic */ ++ res = ++ dwc_otg_pcd_xiso_create_pkt_descs(req, ereq_nonport, atomic_alloc); ++ if (res) { ++ DWC_WARN("Failed to init the Isoc descriptors"); ++ DWC_FREE(req); ++ return res; ++ } ++ ++ DWC_SPINLOCK_IRQSAVE(pcd->lock, &flags); ++ ++ DWC_CIRCLEQ_INIT_ENTRY(req, queue_entry); ++ req->buf = buf; ++ req->dma = dma_buf; ++ req->length = buflen; ++ req->sent_zlp = zero; ++ req->priv = req_handle; ++ ++ //DWC_SPINLOCK_IRQSAVE(pcd->lock, &flags); ++ ep->dwc_ep.dma_addr = dma_buf; ++ ep->dwc_ep.start_xfer_buff = buf; ++ ep->dwc_ep.xfer_buff = buf; ++ ep->dwc_ep.xfer_len = 0; ++ ep->dwc_ep.xfer_count = 0; ++ ep->dwc_ep.sent_zlp = 0; ++ ep->dwc_ep.total_len = buflen; ++ ++ /* Add this request to the tail */ ++ DWC_CIRCLEQ_INSERT_TAIL(&ep->queue, req, queue_entry); ++ ep->dwc_ep.xiso_queued_xfers++; ++ ++//DWC_DEBUG("CP_0"); ++//DWC_DEBUG("req->ext_req.tr_sub_flags=%d", req->ext_req.tr_sub_flags); ++//prn_ext_request((struct dwc_iso_xreq_port *) ereq_nonport); ++//prn_ext_request(&req->ext_req); ++ ++ //DWC_SPINUNLOCK_IRQRESTORE(pcd->lock, flags); ++ ++ /* If the req->status == ASAP then check if there is any active transfer ++ * for this endpoint. If no active transfers, then get the first entry ++ * from the queue and start that transfer ++ */ ++ if (req->ext_req.tr_sub_flags == DWC_EREQ_TF_ASAP) { ++ res = dwc_otg_pcd_xiso_start_next_request(pcd, ep); ++ if (res) { ++ DWC_WARN("Failed to start the next Isoc transfer"); ++ DWC_SPINUNLOCK_IRQRESTORE(pcd->lock, flags); ++ DWC_FREE(req); ++ return res; ++ } ++ } ++ ++ DWC_SPINUNLOCK_IRQRESTORE(pcd->lock, flags); ++ return 0; ++} ++ ++#endif ++/* END ifdef DWC_UTE_PER_IO ***************************************************/ ++int dwc_otg_pcd_ep_queue(dwc_otg_pcd_t * pcd, void *ep_handle, ++ uint8_t * buf, dwc_dma_t dma_buf, uint32_t buflen, ++ int zero, void *req_handle, int atomic_alloc) ++{ ++ dwc_irqflags_t flags; ++ dwc_otg_pcd_request_t *req; ++ dwc_otg_pcd_ep_t *ep; ++ uint32_t max_transfer; ++ ++ ep = get_ep_from_handle(pcd, ep_handle); ++ if (!ep || (!ep->desc && ep->dwc_ep.num != 0)) { ++ DWC_WARN("bad ep\n"); ++ return -DWC_E_INVALID; ++ } ++ ++ if (atomic_alloc) { ++ req = DWC_ALLOC_ATOMIC(sizeof(*req)); ++ } else { ++ req = DWC_ALLOC(sizeof(*req)); ++ } ++ ++ if (!req) { ++ return -DWC_E_NO_MEMORY; ++ } ++ DWC_CIRCLEQ_INIT_ENTRY(req, queue_entry); ++ if (!GET_CORE_IF(pcd)->core_params->opt) { ++ if (ep->dwc_ep.num != 0) { ++ DWC_ERROR("queue req %p, len %d buf %p\n", ++ req_handle, buflen, buf); ++ } ++ } ++ ++ req->buf = buf; ++ req->dma = dma_buf; ++ req->length = buflen; ++ req->sent_zlp = zero; ++ req->priv = req_handle; ++ req->dw_align_buf = NULL; ++ if ((dma_buf & 0x3) && GET_CORE_IF(pcd)->dma_enable ++ && !GET_CORE_IF(pcd)->dma_desc_enable) ++ req->dw_align_buf = DWC_DMA_ALLOC(buflen, ++ &req->dw_align_buf_dma); ++ DWC_SPINLOCK_IRQSAVE(pcd->lock, &flags); ++ ++ /* ++ * After adding request to the queue for IN ISOC wait for In Token Received ++ * when TX FIFO is empty interrupt and for OUT ISOC wait for OUT Token ++ * Received when EP is disabled interrupt to obtain starting microframe ++ * (odd/even) start transfer ++ */ ++ if (ep->dwc_ep.type == DWC_OTG_EP_TYPE_ISOC) { ++ if (req != 0) { ++ depctl_data_t depctl = {.d32 = ++ DWC_READ_REG32(&pcd->core_if->dev_if-> ++ in_ep_regs[ep->dwc_ep.num]-> ++ diepctl) }; ++ ++pcd->request_pending; ++ ++ DWC_CIRCLEQ_INSERT_TAIL(&ep->queue, req, queue_entry); ++ if (ep->dwc_ep.is_in) { ++ depctl.b.cnak = 1; ++ DWC_WRITE_REG32(&pcd->core_if->dev_if-> ++ in_ep_regs[ep->dwc_ep.num]-> ++ diepctl, depctl.d32); ++ } ++ ++ DWC_SPINUNLOCK_IRQRESTORE(pcd->lock, flags); ++ } ++ return 0; ++ } ++ ++ /* ++ * For EP0 IN without premature status, zlp is required? ++ */ ++ if (ep->dwc_ep.num == 0 && ep->dwc_ep.is_in) { ++ DWC_DEBUGPL(DBG_PCDV, "%d-OUT ZLP\n", ep->dwc_ep.num); ++ //_req->zero = 1; ++ } ++ ++ /* Start the transfer */ ++ if (DWC_CIRCLEQ_EMPTY(&ep->queue) && !ep->stopped) { ++ /* EP0 Transfer? */ ++ if (ep->dwc_ep.num == 0) { ++ switch (pcd->ep0state) { ++ case EP0_IN_DATA_PHASE: ++ DWC_DEBUGPL(DBG_PCD, ++ "%s ep0: EP0_IN_DATA_PHASE\n", ++ __func__); ++ break; ++ ++ case EP0_OUT_DATA_PHASE: ++ DWC_DEBUGPL(DBG_PCD, ++ "%s ep0: EP0_OUT_DATA_PHASE\n", ++ __func__); ++ if (pcd->request_config) { ++ /* Complete STATUS PHASE */ ++ ep->dwc_ep.is_in = 1; ++ pcd->ep0state = EP0_IN_STATUS_PHASE; ++ } ++ break; ++ ++ case EP0_IN_STATUS_PHASE: ++ DWC_DEBUGPL(DBG_PCD, ++ "%s ep0: EP0_IN_STATUS_PHASE\n", ++ __func__); ++ break; ++ ++ default: ++ DWC_DEBUGPL(DBG_ANY, "ep0: odd state %d\n", ++ pcd->ep0state); ++ DWC_SPINUNLOCK_IRQRESTORE(pcd->lock, flags); ++ return -DWC_E_SHUTDOWN; ++ } ++ ++ ep->dwc_ep.dma_addr = dma_buf; ++ ep->dwc_ep.start_xfer_buff = buf; ++ ep->dwc_ep.xfer_buff = buf; ++ ep->dwc_ep.xfer_len = buflen; ++ ep->dwc_ep.xfer_count = 0; ++ ep->dwc_ep.sent_zlp = 0; ++ ep->dwc_ep.total_len = ep->dwc_ep.xfer_len; ++ ++ if (zero) { ++ if ((ep->dwc_ep.xfer_len % ++ ep->dwc_ep.maxpacket == 0) ++ && (ep->dwc_ep.xfer_len != 0)) { ++ ep->dwc_ep.sent_zlp = 1; ++ } ++ ++ } ++ ++ dwc_otg_ep0_start_transfer(GET_CORE_IF(pcd), ++ &ep->dwc_ep); ++ } // non-ep0 endpoints ++ else { ++#ifdef DWC_UTE_CFI ++ if (ep->dwc_ep.buff_mode != BM_STANDARD) { ++ /* store the request length */ ++ ep->dwc_ep.cfi_req_len = buflen; ++ pcd->cfi->ops.build_descriptors(pcd->cfi, pcd, ++ ep, req); ++ } else { ++#endif ++ max_transfer = ++ GET_CORE_IF(ep->pcd)->core_params-> ++ max_transfer_size; ++ ++ /* Setup and start the Transfer */ ++ if (req->dw_align_buf){ ++ if (ep->dwc_ep.is_in) ++ dwc_memcpy(req->dw_align_buf, ++ buf, buflen); ++ ep->dwc_ep.dma_addr = ++ req->dw_align_buf_dma; ++ ep->dwc_ep.start_xfer_buff = ++ req->dw_align_buf; ++ ep->dwc_ep.xfer_buff = ++ req->dw_align_buf; ++ } else { ++ ep->dwc_ep.dma_addr = dma_buf; ++ ep->dwc_ep.start_xfer_buff = buf; ++ ep->dwc_ep.xfer_buff = buf; ++ } ++ ep->dwc_ep.xfer_len = 0; ++ ep->dwc_ep.xfer_count = 0; ++ ep->dwc_ep.sent_zlp = 0; ++ ep->dwc_ep.total_len = buflen; ++ ++ ep->dwc_ep.maxxfer = max_transfer; ++ if (GET_CORE_IF(pcd)->dma_desc_enable) { ++ uint32_t out_max_xfer = ++ DDMA_MAX_TRANSFER_SIZE - ++ (DDMA_MAX_TRANSFER_SIZE % 4); ++ if (ep->dwc_ep.is_in) { ++ if (ep->dwc_ep.maxxfer > ++ DDMA_MAX_TRANSFER_SIZE) { ++ ep->dwc_ep.maxxfer = ++ DDMA_MAX_TRANSFER_SIZE; ++ } ++ } else { ++ if (ep->dwc_ep.maxxfer > ++ out_max_xfer) { ++ ep->dwc_ep.maxxfer = ++ out_max_xfer; ++ } ++ } ++ } ++ if (ep->dwc_ep.maxxfer < ep->dwc_ep.total_len) { ++ ep->dwc_ep.maxxfer -= ++ (ep->dwc_ep.maxxfer % ++ ep->dwc_ep.maxpacket); ++ } ++ ++ if (zero) { ++ if ((ep->dwc_ep.total_len % ++ ep->dwc_ep.maxpacket == 0) ++ && (ep->dwc_ep.total_len != 0)) { ++ ep->dwc_ep.sent_zlp = 1; ++ } ++ } ++#ifdef DWC_UTE_CFI ++ } ++#endif ++ dwc_otg_ep_start_transfer(GET_CORE_IF(pcd), ++ &ep->dwc_ep); ++ } ++ } ++ ++ if (req != 0) { ++ ++pcd->request_pending; ++ DWC_CIRCLEQ_INSERT_TAIL(&ep->queue, req, queue_entry); ++ if (ep->dwc_ep.is_in && ep->stopped ++ && !(GET_CORE_IF(pcd)->dma_enable)) { ++ /** @todo NGS Create a function for this. */ ++ diepmsk_data_t diepmsk = {.d32 = 0 }; ++ diepmsk.b.intktxfemp = 1; ++ if (GET_CORE_IF(pcd)->multiproc_int_enable) { ++ DWC_MODIFY_REG32(&GET_CORE_IF(pcd)-> ++ dev_if->dev_global_regs->diepeachintmsk ++ [ep->dwc_ep.num], 0, ++ diepmsk.d32); ++ } else { ++ DWC_MODIFY_REG32(&GET_CORE_IF(pcd)-> ++ dev_if->dev_global_regs-> ++ diepmsk, 0, diepmsk.d32); ++ } ++ ++ } ++ } ++ DWC_SPINUNLOCK_IRQRESTORE(pcd->lock, flags); ++ ++ return 0; ++} ++ ++int dwc_otg_pcd_ep_dequeue(dwc_otg_pcd_t * pcd, void *ep_handle, ++ void *req_handle) ++{ ++ dwc_irqflags_t flags; ++ dwc_otg_pcd_request_t *req; ++ dwc_otg_pcd_ep_t *ep; ++ ++ ep = get_ep_from_handle(pcd, ep_handle); ++ if (!ep || (!ep->desc && ep->dwc_ep.num != 0)) { ++ DWC_WARN("bad argument\n"); ++ return -DWC_E_INVALID; ++ } ++ ++ DWC_SPINLOCK_IRQSAVE(pcd->lock, &flags); ++ ++ /* make sure it's actually queued on this endpoint */ ++ DWC_CIRCLEQ_FOREACH(req, &ep->queue, queue_entry) { ++ if (req->priv == (void *)req_handle) { ++ break; ++ } ++ } ++ ++ if (req->priv != (void *)req_handle) { ++ DWC_SPINUNLOCK_IRQRESTORE(pcd->lock, flags); ++ return -DWC_E_INVALID; ++ } ++ ++ if (!DWC_CIRCLEQ_EMPTY_ENTRY(req, queue_entry)) { ++ dwc_otg_request_done(ep, req, -DWC_E_RESTART); ++ } else { ++ req = NULL; ++ } ++ ++ DWC_SPINUNLOCK_IRQRESTORE(pcd->lock, flags); ++ ++ return req ? 0 : -DWC_E_SHUTDOWN; ++ ++} ++ ++/** ++ * dwc_otg_pcd_ep_wedge - sets the halt feature and ignores clear requests ++ * ++ * Use this to stall an endpoint and ignore CLEAR_FEATURE(HALT_ENDPOINT) ++ * requests. If the gadget driver clears the halt status, it will ++ * automatically unwedge the endpoint. ++ * ++ * Returns zero on success, else negative DWC error code. ++ */ ++int dwc_otg_pcd_ep_wedge(dwc_otg_pcd_t * pcd, void *ep_handle) ++{ ++ dwc_otg_pcd_ep_t *ep; ++ dwc_irqflags_t flags; ++ int retval = 0; ++ ++ ep = get_ep_from_handle(pcd, ep_handle); ++ ++ if ((!ep->desc && ep != &pcd->ep0) || ++ (ep->desc && (ep->desc->bmAttributes == UE_ISOCHRONOUS))) { ++ DWC_WARN("%s, bad ep\n", __func__); ++ return -DWC_E_INVALID; ++ } ++ ++ DWC_SPINLOCK_IRQSAVE(pcd->lock, &flags); ++ if (!DWC_CIRCLEQ_EMPTY(&ep->queue)) { ++ DWC_WARN("%d %s XFer In process\n", ep->dwc_ep.num, ++ ep->dwc_ep.is_in ? "IN" : "OUT"); ++ retval = -DWC_E_AGAIN; ++ } else { ++ /* This code needs to be reviewed */ ++ if (ep->dwc_ep.is_in == 1 && GET_CORE_IF(pcd)->dma_desc_enable) { ++ dtxfsts_data_t txstatus; ++ fifosize_data_t txfifosize; ++ ++ txfifosize.d32 = ++ DWC_READ_REG32(&GET_CORE_IF(pcd)-> ++ core_global_regs->dtxfsiz[ep->dwc_ep. ++ tx_fifo_num]); ++ txstatus.d32 = ++ DWC_READ_REG32(&GET_CORE_IF(pcd)-> ++ dev_if->in_ep_regs[ep->dwc_ep.num]-> ++ dtxfsts); ++ ++ if (txstatus.b.txfspcavail < txfifosize.b.depth) { ++ DWC_WARN("%s() Data In Tx Fifo\n", __func__); ++ retval = -DWC_E_AGAIN; ++ } else { ++ if (ep->dwc_ep.num == 0) { ++ pcd->ep0state = EP0_STALL; ++ } ++ ++ ep->stopped = 1; ++ dwc_otg_ep_set_stall(GET_CORE_IF(pcd), ++ &ep->dwc_ep); ++ } ++ } else { ++ if (ep->dwc_ep.num == 0) { ++ pcd->ep0state = EP0_STALL; ++ } ++ ++ ep->stopped = 1; ++ dwc_otg_ep_set_stall(GET_CORE_IF(pcd), &ep->dwc_ep); ++ } ++ } ++ ++ DWC_SPINUNLOCK_IRQRESTORE(pcd->lock, flags); ++ ++ return retval; ++} ++ ++int dwc_otg_pcd_ep_halt(dwc_otg_pcd_t * pcd, void *ep_handle, int value) ++{ ++ dwc_otg_pcd_ep_t *ep; ++ dwc_irqflags_t flags; ++ int retval = 0; ++ ++ ep = get_ep_from_handle(pcd, ep_handle); ++ ++ if (!ep || (!ep->desc && ep != &pcd->ep0) || ++ (ep->desc && (ep->desc->bmAttributes == UE_ISOCHRONOUS))) { ++ DWC_WARN("%s, bad ep\n", __func__); ++ return -DWC_E_INVALID; ++ } ++ ++ DWC_SPINLOCK_IRQSAVE(pcd->lock, &flags); ++ if (!DWC_CIRCLEQ_EMPTY(&ep->queue)) { ++ DWC_WARN("%d %s XFer In process\n", ep->dwc_ep.num, ++ ep->dwc_ep.is_in ? "IN" : "OUT"); ++ retval = -DWC_E_AGAIN; ++ } else if (value == 0) { ++ dwc_otg_ep_clear_stall(GET_CORE_IF(pcd), &ep->dwc_ep); ++ } else if (value == 1) { ++ if (ep->dwc_ep.is_in == 1 && GET_CORE_IF(pcd)->dma_desc_enable) { ++ dtxfsts_data_t txstatus; ++ fifosize_data_t txfifosize; ++ ++ txfifosize.d32 = ++ DWC_READ_REG32(&GET_CORE_IF(pcd)->core_global_regs-> ++ dtxfsiz[ep->dwc_ep.tx_fifo_num]); ++ txstatus.d32 = ++ DWC_READ_REG32(&GET_CORE_IF(pcd)->dev_if-> ++ in_ep_regs[ep->dwc_ep.num]->dtxfsts); ++ ++ if (txstatus.b.txfspcavail < txfifosize.b.depth) { ++ DWC_WARN("%s() Data In Tx Fifo\n", __func__); ++ retval = -DWC_E_AGAIN; ++ } else { ++ if (ep->dwc_ep.num == 0) { ++ pcd->ep0state = EP0_STALL; ++ } ++ ++ ep->stopped = 1; ++ dwc_otg_ep_set_stall(GET_CORE_IF(pcd), ++ &ep->dwc_ep); ++ } ++ } else { ++ if (ep->dwc_ep.num == 0) { ++ pcd->ep0state = EP0_STALL; ++ } ++ ++ ep->stopped = 1; ++ dwc_otg_ep_set_stall(GET_CORE_IF(pcd), &ep->dwc_ep); ++ } ++ } else if (value == 2) { ++ ep->dwc_ep.stall_clear_flag = 0; ++ } else if (value == 3) { ++ ep->dwc_ep.stall_clear_flag = 1; ++ } ++ ++ DWC_SPINUNLOCK_IRQRESTORE(pcd->lock, flags); ++ ++ return retval; ++} ++ ++/** ++ * This function initiates remote wakeup of the host from suspend state. ++ */ ++void dwc_otg_pcd_rem_wkup_from_suspend(dwc_otg_pcd_t * pcd, int set) ++{ ++ dctl_data_t dctl = { 0 }; ++ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); ++ dsts_data_t dsts; ++ ++ dsts.d32 = DWC_READ_REG32(&core_if->dev_if->dev_global_regs->dsts); ++ if (!dsts.b.suspsts) { ++ DWC_WARN("Remote wakeup while is not in suspend state\n"); ++ } ++ /* Check if DEVICE_REMOTE_WAKEUP feature enabled */ ++ if (pcd->remote_wakeup_enable) { ++ if (set) { ++ ++ if (core_if->adp_enable) { ++ gpwrdn_data_t gpwrdn; ++ ++ dwc_otg_adp_probe_stop(core_if); ++ ++ /* Mask SRP detected interrupt from Power Down Logic */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.srp_det_msk = 1; ++ DWC_MODIFY_REG32(&core_if-> ++ core_global_regs->gpwrdn, ++ gpwrdn.d32, 0); ++ ++ /* Disable Power Down Logic */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pmuactv = 1; ++ DWC_MODIFY_REG32(&core_if-> ++ core_global_regs->gpwrdn, ++ gpwrdn.d32, 0); ++ ++ /* ++ * Initialize the Core for Device mode. ++ */ ++ core_if->op_state = B_PERIPHERAL; ++ dwc_otg_core_init(core_if); ++ dwc_otg_enable_global_interrupts(core_if); ++ cil_pcd_start(core_if); ++ ++ dwc_otg_initiate_srp(core_if); ++ } ++ ++ dctl.b.rmtwkupsig = 1; ++ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs-> ++ dctl, 0, dctl.d32); ++ DWC_DEBUGPL(DBG_PCD, "Set Remote Wakeup\n"); ++ ++ dwc_mdelay(2); ++ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs-> ++ dctl, dctl.d32, 0); ++ DWC_DEBUGPL(DBG_PCD, "Clear Remote Wakeup\n"); ++ } ++ } else { ++ DWC_DEBUGPL(DBG_PCD, "Remote Wakeup is disabled\n"); ++ } ++} ++ ++#ifdef CONFIG_USB_DWC_OTG_LPM ++/** ++ * This function initiates remote wakeup of the host from L1 sleep state. ++ */ ++void dwc_otg_pcd_rem_wkup_from_sleep(dwc_otg_pcd_t * pcd, int set) ++{ ++ glpmcfg_data_t lpmcfg; ++ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); ++ ++ lpmcfg.d32 = DWC_READ_REG32(&core_if->core_global_regs->glpmcfg); ++ ++ /* Check if we are in L1 state */ ++ if (!lpmcfg.b.prt_sleep_sts) { ++ DWC_DEBUGPL(DBG_PCD, "Device is not in sleep state\n"); ++ return; ++ } ++ ++ /* Check if host allows remote wakeup */ ++ if (!lpmcfg.b.rem_wkup_en) { ++ DWC_DEBUGPL(DBG_PCD, "Host does not allow remote wakeup\n"); ++ return; ++ } ++ ++ /* Check if Resume OK */ ++ if (!lpmcfg.b.sleep_state_resumeok) { ++ DWC_DEBUGPL(DBG_PCD, "Sleep state resume is not OK\n"); ++ return; ++ } ++ ++ lpmcfg.d32 = DWC_READ_REG32(&core_if->core_global_regs->glpmcfg); ++ lpmcfg.b.en_utmi_sleep = 0; ++ lpmcfg.b.hird_thres &= (~(1 << 4)); ++ DWC_WRITE_REG32(&core_if->core_global_regs->glpmcfg, lpmcfg.d32); ++ ++ if (set) { ++ dctl_data_t dctl = {.d32 = 0 }; ++ dctl.b.rmtwkupsig = 1; ++ /* Set RmtWkUpSig bit to start remote wakup signaling. ++ * Hardware will automatically clear this bit. ++ */ ++ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs->dctl, ++ 0, dctl.d32); ++ DWC_DEBUGPL(DBG_PCD, "Set Remote Wakeup\n"); ++ } ++ ++} ++#endif ++ ++/** ++ * Performs remote wakeup. ++ */ ++void dwc_otg_pcd_remote_wakeup(dwc_otg_pcd_t * pcd, int set) ++{ ++ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); ++ dwc_irqflags_t flags; ++ if (dwc_otg_is_device_mode(core_if)) { ++ DWC_SPINLOCK_IRQSAVE(pcd->lock, &flags); ++#ifdef CONFIG_USB_DWC_OTG_LPM ++ if (core_if->lx_state == DWC_OTG_L1) { ++ dwc_otg_pcd_rem_wkup_from_sleep(pcd, set); ++ } else { ++#endif ++ dwc_otg_pcd_rem_wkup_from_suspend(pcd, set); ++#ifdef CONFIG_USB_DWC_OTG_LPM ++ } ++#endif ++ DWC_SPINUNLOCK_IRQRESTORE(pcd->lock, flags); ++ } ++ return; ++} ++ ++void dwc_otg_pcd_disconnect_us(dwc_otg_pcd_t * pcd, int no_of_usecs) ++{ ++ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); ++ dctl_data_t dctl = { 0 }; ++ ++ if (dwc_otg_is_device_mode(core_if)) { ++ dctl.b.sftdiscon = 1; ++ DWC_PRINTF("Soft disconnect for %d useconds\n",no_of_usecs); ++ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs->dctl, 0, dctl.d32); ++ dwc_udelay(no_of_usecs); ++ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs->dctl, dctl.d32,0); ++ ++ } else{ ++ DWC_PRINTF("NOT SUPPORTED IN HOST MODE\n"); ++ } ++ return; ++ ++} ++ ++int dwc_otg_pcd_wakeup(dwc_otg_pcd_t * pcd) ++{ ++ dsts_data_t dsts; ++ gotgctl_data_t gotgctl; ++ ++ /* ++ * This function starts the Protocol if no session is in progress. If ++ * a session is already in progress, but the device is suspended, ++ * remote wakeup signaling is started. ++ */ ++ ++ /* Check if valid session */ ++ gotgctl.d32 = ++ DWC_READ_REG32(&(GET_CORE_IF(pcd)->core_global_regs->gotgctl)); ++ if (gotgctl.b.bsesvld) { ++ /* Check if suspend state */ ++ dsts.d32 = ++ DWC_READ_REG32(& ++ (GET_CORE_IF(pcd)->dev_if-> ++ dev_global_regs->dsts)); ++ if (dsts.b.suspsts) { ++ dwc_otg_pcd_remote_wakeup(pcd, 1); ++ } ++ } else { ++ dwc_otg_pcd_initiate_srp(pcd); ++ } ++ ++ return 0; ++ ++} ++ ++/** ++ * Start the SRP timer to detect when the SRP does not complete within ++ * 6 seconds. ++ * ++ * @param pcd the pcd structure. ++ */ ++void dwc_otg_pcd_initiate_srp(dwc_otg_pcd_t * pcd) ++{ ++ dwc_irqflags_t flags; ++ DWC_SPINLOCK_IRQSAVE(pcd->lock, &flags); ++ dwc_otg_initiate_srp(GET_CORE_IF(pcd)); ++ DWC_SPINUNLOCK_IRQRESTORE(pcd->lock, flags); ++} ++ ++int dwc_otg_pcd_get_frame_number(dwc_otg_pcd_t * pcd) ++{ ++ return dwc_otg_get_frame_number(GET_CORE_IF(pcd)); ++} ++ ++int dwc_otg_pcd_is_lpm_enabled(dwc_otg_pcd_t * pcd) ++{ ++ return GET_CORE_IF(pcd)->core_params->lpm_enable; ++} ++ ++uint32_t get_b_hnp_enable(dwc_otg_pcd_t * pcd) ++{ ++ return pcd->b_hnp_enable; ++} ++ ++uint32_t get_a_hnp_support(dwc_otg_pcd_t * pcd) ++{ ++ return pcd->a_hnp_support; ++} ++ ++uint32_t get_a_alt_hnp_support(dwc_otg_pcd_t * pcd) ++{ ++ return pcd->a_alt_hnp_support; ++} ++ ++int dwc_otg_pcd_get_rmwkup_enable(dwc_otg_pcd_t * pcd) ++{ ++ return pcd->remote_wakeup_enable; ++} ++ ++#endif /* DWC_HOST_ONLY */ +diff --git a/drivers/usb/host/dwc_otg/dwc_otg_pcd.h b/drivers/usb/host/dwc_otg/dwc_otg_pcd.h +new file mode 100644 +index 0000000..8ef7ba6 +--- /dev/null ++++ b/drivers/usb/host/dwc_otg/dwc_otg_pcd.h +@@ -0,0 +1,266 @@ ++/* ========================================================================== ++ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_pcd.h $ ++ * $Revision: #48 $ ++ * $Date: 2012/08/10 $ ++ * $Change: 2047372 $ ++ * ++ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, ++ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless ++ * otherwise expressly agreed to in writing between Synopsys and you. ++ * ++ * The Software IS NOT an item of Licensed Software or Licensed Product under ++ * any End User Software License Agreement or Agreement for Licensed Product ++ * with Synopsys or any supplement thereto. You are permitted to use and ++ * redistribute this Software in source and binary forms, with or without ++ * modification, provided that redistributions of source code must retain this ++ * notice. You may not view, use, disclose, copy or distribute this file or ++ * any information contained herein except pursuant to this license grant from ++ * Synopsys. If you do not agree with this notice, including the disclaimer ++ * below, then you are not authorized to use the Software. ++ * ++ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS ++ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS 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. ++ * ========================================================================== */ ++#ifndef DWC_HOST_ONLY ++#if !defined(__DWC_PCD_H__) ++#define __DWC_PCD_H__ ++ ++#include "dwc_otg_os_dep.h" ++#include "usb.h" ++#include "dwc_otg_cil.h" ++#include "dwc_otg_pcd_if.h" ++struct cfiobject; ++ ++/** ++ * @file ++ * ++ * This file contains the structures, constants, and interfaces for ++ * the Perpherial Contoller Driver (PCD). ++ * ++ * The Peripheral Controller Driver (PCD) for Linux will implement the ++ * Gadget API, so that the existing Gadget drivers can be used. For ++ * the Mass Storage Function driver the File-backed USB Storage Gadget ++ * (FBS) driver will be used. The FBS driver supports the ++ * Control-Bulk (CB), Control-Bulk-Interrupt (CBI), and Bulk-Only ++ * transports. ++ * ++ */ ++ ++/** Invalid DMA Address */ ++#define DWC_DMA_ADDR_INVALID (~(dwc_dma_t)0) ++ ++/** Max Transfer size for any EP */ ++#define DDMA_MAX_TRANSFER_SIZE 65535 ++ ++/** ++ * Get the pointer to the core_if from the pcd pointer. ++ */ ++#define GET_CORE_IF( _pcd ) (_pcd->core_if) ++ ++/** ++ * States of EP0. ++ */ ++typedef enum ep0_state { ++ EP0_DISCONNECT, /* no host */ ++ EP0_IDLE, ++ EP0_IN_DATA_PHASE, ++ EP0_OUT_DATA_PHASE, ++ EP0_IN_STATUS_PHASE, ++ EP0_OUT_STATUS_PHASE, ++ EP0_STALL, ++} ep0state_e; ++ ++/** Fordward declaration.*/ ++struct dwc_otg_pcd; ++ ++/** DWC_otg iso request structure. ++ * ++ */ ++typedef struct usb_iso_request dwc_otg_pcd_iso_request_t; ++ ++#ifdef DWC_UTE_PER_IO ++ ++/** ++ * This shall be the exact analogy of the same type structure defined in the ++ * usb_gadget.h. Each descriptor contains ++ */ ++struct dwc_iso_pkt_desc_port { ++ uint32_t offset; ++ uint32_t length; /* expected length */ ++ uint32_t actual_length; ++ uint32_t status; ++}; ++ ++struct dwc_iso_xreq_port { ++ /** transfer/submission flag */ ++ uint32_t tr_sub_flags; ++ /** Start the request ASAP */ ++#define DWC_EREQ_TF_ASAP 0x00000002 ++ /** Just enqueue the request w/o initiating a transfer */ ++#define DWC_EREQ_TF_ENQUEUE 0x00000004 ++ ++ /** ++ * count of ISO packets attached to this request - shall ++ * not exceed the pio_alloc_pkt_count ++ */ ++ uint32_t pio_pkt_count; ++ /** count of ISO packets allocated for this request */ ++ uint32_t pio_alloc_pkt_count; ++ /** number of ISO packet errors */ ++ uint32_t error_count; ++ /** reserved for future extension */ ++ uint32_t res; ++ /** Will be allocated and freed in the UTE gadget and based on the CFC value */ ++ struct dwc_iso_pkt_desc_port *per_io_frame_descs; ++}; ++#endif ++/** DWC_otg request structure. ++ * This structure is a list of requests. ++ */ ++typedef struct dwc_otg_pcd_request { ++ void *priv; ++ void *buf; ++ dwc_dma_t dma; ++ uint32_t length; ++ uint32_t actual; ++ unsigned sent_zlp:1; ++ /** ++ * Used instead of original buffer if ++ * it(physical address) is not dword-aligned. ++ **/ ++ uint8_t *dw_align_buf; ++ dwc_dma_t dw_align_buf_dma; ++ ++ DWC_CIRCLEQ_ENTRY(dwc_otg_pcd_request) queue_entry; ++#ifdef DWC_UTE_PER_IO ++ struct dwc_iso_xreq_port ext_req; ++ //void *priv_ereq_nport; /* */ ++#endif ++} dwc_otg_pcd_request_t; ++ ++DWC_CIRCLEQ_HEAD(req_list, dwc_otg_pcd_request); ++ ++/** PCD EP structure. ++ * This structure describes an EP, there is an array of EPs in the PCD ++ * structure. ++ */ ++typedef struct dwc_otg_pcd_ep { ++ /** USB EP Descriptor */ ++ const usb_endpoint_descriptor_t *desc; ++ ++ /** queue of dwc_otg_pcd_requests. */ ++ struct req_list queue; ++ unsigned stopped:1; ++ unsigned disabling:1; ++ unsigned dma:1; ++ unsigned queue_sof:1; ++ ++#ifdef DWC_EN_ISOC ++ /** ISOC req handle passed */ ++ void *iso_req_handle; ++#endif //_EN_ISOC_ ++ ++ /** DWC_otg ep data. */ ++ dwc_ep_t dwc_ep; ++ ++ /** Pointer to PCD */ ++ struct dwc_otg_pcd *pcd; ++ ++ void *priv; ++} dwc_otg_pcd_ep_t; ++ ++/** DWC_otg PCD Structure. ++ * This structure encapsulates the data for the dwc_otg PCD. ++ */ ++struct dwc_otg_pcd { ++ const struct dwc_otg_pcd_function_ops *fops; ++ /** The DWC otg device pointer */ ++ struct dwc_otg_device *otg_dev; ++ /** Core Interface */ ++ dwc_otg_core_if_t *core_if; ++ /** State of EP0 */ ++ ep0state_e ep0state; ++ /** EP0 Request is pending */ ++ unsigned ep0_pending:1; ++ /** Indicates when SET CONFIGURATION Request is in process */ ++ unsigned request_config:1; ++ /** The state of the Remote Wakeup Enable. */ ++ unsigned remote_wakeup_enable:1; ++ /** The state of the B-Device HNP Enable. */ ++ unsigned b_hnp_enable:1; ++ /** The state of A-Device HNP Support. */ ++ unsigned a_hnp_support:1; ++ /** The state of the A-Device Alt HNP support. */ ++ unsigned a_alt_hnp_support:1; ++ /** Count of pending Requests */ ++ unsigned request_pending; ++ ++ /** SETUP packet for EP0 ++ * This structure is allocated as a DMA buffer on PCD initialization ++ * with enough space for up to 3 setup packets. ++ */ ++ union { ++ usb_device_request_t req; ++ uint32_t d32[2]; ++ } *setup_pkt; ++ ++ dwc_dma_t setup_pkt_dma_handle; ++ ++ /* Additional buffer and flag for CTRL_WR premature case */ ++ uint8_t *backup_buf; ++ unsigned data_terminated; ++ ++ /** 2-byte dma buffer used to return status from GET_STATUS */ ++ uint16_t *status_buf; ++ dwc_dma_t status_buf_dma_handle; ++ ++ /** EP0 */ ++ dwc_otg_pcd_ep_t ep0; ++ ++ /** Array of IN EPs. */ ++ dwc_otg_pcd_ep_t in_ep[MAX_EPS_CHANNELS - 1]; ++ /** Array of OUT EPs. */ ++ dwc_otg_pcd_ep_t out_ep[MAX_EPS_CHANNELS - 1]; ++ /** number of valid EPs in the above array. */ ++// unsigned num_eps : 4; ++ dwc_spinlock_t *lock; ++ ++ /** Tasklet to defer starting of TEST mode transmissions until ++ * Status Phase has been completed. ++ */ ++ dwc_tasklet_t *test_mode_tasklet; ++ ++ /** Tasklet to delay starting of xfer in DMA mode */ ++ dwc_tasklet_t *start_xfer_tasklet; ++ ++ /** The test mode to enter when the tasklet is executed. */ ++ unsigned test_mode; ++ /** The cfi_api structure that implements most of the CFI API ++ * and OTG specific core configuration functionality ++ */ ++#ifdef DWC_UTE_CFI ++ struct cfiobject *cfi; ++#endif ++ ++}; ++ ++//FIXME this functions should be static, and this prototypes should be removed ++extern void dwc_otg_request_nuke(dwc_otg_pcd_ep_t * ep); ++extern void dwc_otg_request_done(dwc_otg_pcd_ep_t * ep, ++ dwc_otg_pcd_request_t * req, int32_t status); ++ ++void dwc_otg_iso_buffer_done(dwc_otg_pcd_t * pcd, dwc_otg_pcd_ep_t * ep, ++ void *req_handle); ++ ++extern void do_test_mode(void *data); ++#endif ++#endif /* DWC_HOST_ONLY */ +diff --git a/drivers/usb/host/dwc_otg/dwc_otg_pcd_if.h b/drivers/usb/host/dwc_otg/dwc_otg_pcd_if.h +new file mode 100644 +index 0000000..c8d2e0e +--- /dev/null ++++ b/drivers/usb/host/dwc_otg/dwc_otg_pcd_if.h +@@ -0,0 +1,360 @@ ++/* ========================================================================== ++ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_pcd_if.h $ ++ * $Revision: #11 $ ++ * $Date: 2011/10/26 $ ++ * $Change: 1873028 $ ++ * ++ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, ++ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless ++ * otherwise expressly agreed to in writing between Synopsys and you. ++ * ++ * The Software IS NOT an item of Licensed Software or Licensed Product under ++ * any End User Software License Agreement or Agreement for Licensed Product ++ * with Synopsys or any supplement thereto. You are permitted to use and ++ * redistribute this Software in source and binary forms, with or without ++ * modification, provided that redistributions of source code must retain this ++ * notice. You may not view, use, disclose, copy or distribute this file or ++ * any information contained herein except pursuant to this license grant from ++ * Synopsys. If you do not agree with this notice, including the disclaimer ++ * below, then you are not authorized to use the Software. ++ * ++ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS ++ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS 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. ++ * ========================================================================== */ ++#ifndef DWC_HOST_ONLY ++ ++#if !defined(__DWC_PCD_IF_H__) ++#define __DWC_PCD_IF_H__ ++ ++//#include "dwc_os.h" ++#include "dwc_otg_core_if.h" ++ ++/** @file ++ * This file defines DWC_OTG PCD Core API. ++ */ ++ ++struct dwc_otg_pcd; ++typedef struct dwc_otg_pcd dwc_otg_pcd_t; ++ ++/** Maxpacket size for EP0 */ ++#define MAX_EP0_SIZE 64 ++/** Maxpacket size for any EP */ ++#define MAX_PACKET_SIZE 1024 ++ ++/** @name Function Driver Callbacks */ ++/** @{ */ ++ ++/** This function will be called whenever a previously queued request has ++ * completed. The status value will be set to -DWC_E_SHUTDOWN to indicated a ++ * failed or aborted transfer, or -DWC_E_RESTART to indicate the device was reset, ++ * or -DWC_E_TIMEOUT to indicate it timed out, or -DWC_E_INVALID to indicate invalid ++ * parameters. */ ++typedef int (*dwc_completion_cb_t) (dwc_otg_pcd_t * pcd, void *ep_handle, ++ void *req_handle, int32_t status, ++ uint32_t actual); ++/** ++ * This function will be called whenever a previousle queued ISOC request has ++ * completed. Count of ISOC packets could be read using dwc_otg_pcd_get_iso_packet_count ++ * function. ++ * The status of each ISOC packet could be read using dwc_otg_pcd_get_iso_packet_* ++ * functions. ++ */ ++typedef int (*dwc_isoc_completion_cb_t) (dwc_otg_pcd_t * pcd, void *ep_handle, ++ void *req_handle, int proc_buf_num); ++/** This function should handle any SETUP request that cannot be handled by the ++ * PCD Core. This includes most GET_DESCRIPTORs, SET_CONFIGS, Any ++ * class-specific requests, etc. The function must non-blocking. ++ * ++ * Returns 0 on success. ++ * Returns -DWC_E_NOT_SUPPORTED if the request is not supported. ++ * Returns -DWC_E_INVALID if the setup request had invalid parameters or bytes. ++ * Returns -DWC_E_SHUTDOWN on any other error. */ ++typedef int (*dwc_setup_cb_t) (dwc_otg_pcd_t * pcd, uint8_t * bytes); ++/** This is called whenever the device has been disconnected. The function ++ * driver should take appropriate action to clean up all pending requests in the ++ * PCD Core, remove all endpoints (except ep0), and initialize back to reset ++ * state. */ ++typedef int (*dwc_disconnect_cb_t) (dwc_otg_pcd_t * pcd); ++/** This function is called when device has been connected. */ ++typedef int (*dwc_connect_cb_t) (dwc_otg_pcd_t * pcd, int speed); ++/** This function is called when device has been suspended */ ++typedef int (*dwc_suspend_cb_t) (dwc_otg_pcd_t * pcd); ++/** This function is called when device has received LPM tokens, i.e. ++ * device has been sent to sleep state. */ ++typedef int (*dwc_sleep_cb_t) (dwc_otg_pcd_t * pcd); ++/** This function is called when device has been resumed ++ * from suspend(L2) or L1 sleep state. */ ++typedef int (*dwc_resume_cb_t) (dwc_otg_pcd_t * pcd); ++/** This function is called whenever hnp params has been changed. ++ * User can call get_b_hnp_enable, get_a_hnp_support, get_a_alt_hnp_support functions ++ * to get hnp parameters. */ ++typedef int (*dwc_hnp_params_changed_cb_t) (dwc_otg_pcd_t * pcd); ++/** This function is called whenever USB RESET is detected. */ ++typedef int (*dwc_reset_cb_t) (dwc_otg_pcd_t * pcd); ++ ++typedef int (*cfi_setup_cb_t) (dwc_otg_pcd_t * pcd, void *ctrl_req_bytes); ++ ++/** ++ * ++ * @param ep_handle Void pointer to the usb_ep structure ++ * @param ereq_port Pointer to the extended request structure created in the ++ * portable part. ++ */ ++typedef int (*xiso_completion_cb_t) (dwc_otg_pcd_t * pcd, void *ep_handle, ++ void *req_handle, int32_t status, ++ void *ereq_port); ++/** Function Driver Ops Data Structure */ ++struct dwc_otg_pcd_function_ops { ++ dwc_connect_cb_t connect; ++ dwc_disconnect_cb_t disconnect; ++ dwc_setup_cb_t setup; ++ dwc_completion_cb_t complete; ++ dwc_isoc_completion_cb_t isoc_complete; ++ dwc_suspend_cb_t suspend; ++ dwc_sleep_cb_t sleep; ++ dwc_resume_cb_t resume; ++ dwc_reset_cb_t reset; ++ dwc_hnp_params_changed_cb_t hnp_changed; ++ cfi_setup_cb_t cfi_setup; ++#ifdef DWC_UTE_PER_IO ++ xiso_completion_cb_t xisoc_complete; ++#endif ++}; ++/** @} */ ++ ++/** @name Function Driver Functions */ ++/** @{ */ ++ ++/** Call this function to get pointer on dwc_otg_pcd_t, ++ * this pointer will be used for all PCD API functions. ++ * ++ * @param core_if The DWC_OTG Core ++ */ ++extern dwc_otg_pcd_t *dwc_otg_pcd_init(dwc_otg_core_if_t * core_if); ++ ++/** Frees PCD allocated by dwc_otg_pcd_init ++ * ++ * @param pcd The PCD ++ */ ++extern void dwc_otg_pcd_remove(dwc_otg_pcd_t * pcd); ++ ++/** Call this to bind the function driver to the PCD Core. ++ * ++ * @param pcd Pointer on dwc_otg_pcd_t returned by dwc_otg_pcd_init function. ++ * @param fops The Function Driver Ops data structure containing pointers to all callbacks. ++ */ ++extern void dwc_otg_pcd_start(dwc_otg_pcd_t * pcd, ++ const struct dwc_otg_pcd_function_ops *fops); ++ ++/** Enables an endpoint for use. This function enables an endpoint in ++ * the PCD. The endpoint is described by the ep_desc which has the ++ * same format as a USB ep descriptor. The ep_handle parameter is used to refer ++ * to the endpoint from other API functions and in callbacks. Normally this ++ * should be called after a SET_CONFIGURATION/SET_INTERFACE to configure the ++ * core for that interface. ++ * ++ * Returns -DWC_E_INVALID if invalid parameters were passed. ++ * Returns -DWC_E_SHUTDOWN if any other error ocurred. ++ * Returns 0 on success. ++ * ++ * @param pcd The PCD ++ * @param ep_desc Endpoint descriptor ++ * @param usb_ep Handle on endpoint, that will be used to identify endpoint. ++ */ ++extern int dwc_otg_pcd_ep_enable(dwc_otg_pcd_t * pcd, ++ const uint8_t * ep_desc, void *usb_ep); ++ ++/** Disable the endpoint referenced by ep_handle. ++ * ++ * Returns -DWC_E_INVALID if invalid parameters were passed. ++ * Returns -DWC_E_SHUTDOWN if any other error occurred. ++ * Returns 0 on success. */ ++extern int dwc_otg_pcd_ep_disable(dwc_otg_pcd_t * pcd, void *ep_handle); ++ ++/** Queue a data transfer request on the endpoint referenced by ep_handle. ++ * After the transfer is completes, the complete callback will be called with ++ * the request status. ++ * ++ * @param pcd The PCD ++ * @param ep_handle The handle of the endpoint ++ * @param buf The buffer for the data ++ * @param dma_buf The DMA buffer for the data ++ * @param buflen The length of the data transfer ++ * @param zero Specifies whether to send zero length last packet. ++ * @param req_handle Set this handle to any value to use to reference this ++ * request in the ep_dequeue function or from the complete callback ++ * @param atomic_alloc If driver need to perform atomic allocations ++ * for internal data structures. ++ * ++ * Returns -DWC_E_INVALID if invalid parameters were passed. ++ * Returns -DWC_E_SHUTDOWN if any other error ocurred. ++ * Returns 0 on success. */ ++extern int dwc_otg_pcd_ep_queue(dwc_otg_pcd_t * pcd, void *ep_handle, ++ uint8_t * buf, dwc_dma_t dma_buf, ++ uint32_t buflen, int zero, void *req_handle, ++ int atomic_alloc); ++#ifdef DWC_UTE_PER_IO ++/** ++ * ++ * @param ereq_nonport Pointer to the extended request part of the ++ * usb_request structure defined in usb_gadget.h file. ++ */ ++extern int dwc_otg_pcd_xiso_ep_queue(dwc_otg_pcd_t * pcd, void *ep_handle, ++ uint8_t * buf, dwc_dma_t dma_buf, ++ uint32_t buflen, int zero, ++ void *req_handle, int atomic_alloc, ++ void *ereq_nonport); ++ ++#endif ++ ++/** De-queue the specified data transfer that has not yet completed. ++ * ++ * Returns -DWC_E_INVALID if invalid parameters were passed. ++ * Returns -DWC_E_SHUTDOWN if any other error ocurred. ++ * Returns 0 on success. */ ++extern int dwc_otg_pcd_ep_dequeue(dwc_otg_pcd_t * pcd, void *ep_handle, ++ void *req_handle); ++ ++/** Halt (STALL) an endpoint or clear it. ++ * ++ * Returns -DWC_E_INVALID if invalid parameters were passed. ++ * Returns -DWC_E_SHUTDOWN if any other error ocurred. ++ * Returns -DWC_E_AGAIN if the STALL cannot be sent and must be tried again later ++ * Returns 0 on success. */ ++extern int dwc_otg_pcd_ep_halt(dwc_otg_pcd_t * pcd, void *ep_handle, int value); ++ ++/** This function */ ++extern int dwc_otg_pcd_ep_wedge(dwc_otg_pcd_t * pcd, void *ep_handle); ++ ++/** This function should be called on every hardware interrupt */ ++extern int32_t dwc_otg_pcd_handle_intr(dwc_otg_pcd_t * pcd); ++ ++/** This function returns current frame number */ ++extern int dwc_otg_pcd_get_frame_number(dwc_otg_pcd_t * pcd); ++ ++/** ++ * Start isochronous transfers on the endpoint referenced by ep_handle. ++ * For isochronous transfers duble buffering is used. ++ * After processing each of buffers comlete callback will be called with ++ * status for each transaction. ++ * ++ * @param pcd The PCD ++ * @param ep_handle The handle of the endpoint ++ * @param buf0 The virtual address of first data buffer ++ * @param buf1 The virtual address of second data buffer ++ * @param dma0 The DMA address of first data buffer ++ * @param dma1 The DMA address of second data buffer ++ * @param sync_frame Data pattern frame number ++ * @param dp_frame Data size for pattern frame ++ * @param data_per_frame Data size for regular frame ++ * @param start_frame Frame number to start transfers, if -1 then start transfers ASAP. ++ * @param buf_proc_intrvl Interval of ISOC Buffer processing ++ * @param req_handle Handle of ISOC request ++ * @param atomic_alloc Specefies whether to perform atomic allocation for ++ * internal data structures. ++ * ++ * Returns -DWC_E_NO_MEMORY if there is no enough memory. ++ * Returns -DWC_E_INVALID if incorrect arguments are passed to the function. ++ * Returns -DW_E_SHUTDOWN for any other error. ++ * Returns 0 on success ++ */ ++extern int dwc_otg_pcd_iso_ep_start(dwc_otg_pcd_t * pcd, void *ep_handle, ++ uint8_t * buf0, uint8_t * buf1, ++ dwc_dma_t dma0, dwc_dma_t dma1, ++ int sync_frame, int dp_frame, ++ int data_per_frame, int start_frame, ++ int buf_proc_intrvl, void *req_handle, ++ int atomic_alloc); ++ ++/** Stop ISOC transfers on endpoint referenced by ep_handle. ++ * ++ * @param pcd The PCD ++ * @param ep_handle The handle of the endpoint ++ * @param req_handle Handle of ISOC request ++ * ++ * Returns -DWC_E_INVALID if incorrect arguments are passed to the function ++ * Returns 0 on success ++ */ ++int dwc_otg_pcd_iso_ep_stop(dwc_otg_pcd_t * pcd, void *ep_handle, ++ void *req_handle); ++ ++/** Get ISOC packet status. ++ * ++ * @param pcd The PCD ++ * @param ep_handle The handle of the endpoint ++ * @param iso_req_handle Isochronoush request handle ++ * @param packet Number of packet ++ * @param status Out parameter for returning status ++ * @param actual Out parameter for returning actual length ++ * @param offset Out parameter for returning offset ++ * ++ */ ++extern void dwc_otg_pcd_get_iso_packet_params(dwc_otg_pcd_t * pcd, ++ void *ep_handle, ++ void *iso_req_handle, int packet, ++ int *status, int *actual, ++ int *offset); ++ ++/** Get ISOC packet count. ++ * ++ * @param pcd The PCD ++ * @param ep_handle The handle of the endpoint ++ * @param iso_req_handle ++ */ ++extern int dwc_otg_pcd_get_iso_packet_count(dwc_otg_pcd_t * pcd, ++ void *ep_handle, ++ void *iso_req_handle); ++ ++/** This function starts the SRP Protocol if no session is in progress. If ++ * a session is already in progress, but the device is suspended, ++ * remote wakeup signaling is started. ++ */ ++extern int dwc_otg_pcd_wakeup(dwc_otg_pcd_t * pcd); ++ ++/** This function returns 1 if LPM support is enabled, and 0 otherwise. */ ++extern int dwc_otg_pcd_is_lpm_enabled(dwc_otg_pcd_t * pcd); ++ ++/** This function returns 1 if remote wakeup is allowed and 0, otherwise. */ ++extern int dwc_otg_pcd_get_rmwkup_enable(dwc_otg_pcd_t * pcd); ++ ++/** Initiate SRP */ ++extern void dwc_otg_pcd_initiate_srp(dwc_otg_pcd_t * pcd); ++ ++/** Starts remote wakeup signaling. */ ++extern void dwc_otg_pcd_remote_wakeup(dwc_otg_pcd_t * pcd, int set); ++ ++/** Starts micorsecond soft disconnect. */ ++extern void dwc_otg_pcd_disconnect_us(dwc_otg_pcd_t * pcd, int no_of_usecs); ++/** This function returns whether device is dualspeed.*/ ++extern uint32_t dwc_otg_pcd_is_dualspeed(dwc_otg_pcd_t * pcd); ++ ++/** This function returns whether device is otg. */ ++extern uint32_t dwc_otg_pcd_is_otg(dwc_otg_pcd_t * pcd); ++ ++/** These functions allow to get hnp parameters */ ++extern uint32_t get_b_hnp_enable(dwc_otg_pcd_t * pcd); ++extern uint32_t get_a_hnp_support(dwc_otg_pcd_t * pcd); ++extern uint32_t get_a_alt_hnp_support(dwc_otg_pcd_t * pcd); ++ ++/** CFI specific Interface functions */ ++/** Allocate a cfi buffer */ ++extern uint8_t *cfiw_ep_alloc_buffer(dwc_otg_pcd_t * pcd, void *pep, ++ dwc_dma_t * addr, size_t buflen, ++ int flags); ++ ++/******************************************************************************/ ++ ++/** @} */ ++ ++#endif /* __DWC_PCD_IF_H__ */ ++ ++#endif /* DWC_HOST_ONLY */ +diff --git a/drivers/usb/host/dwc_otg/dwc_otg_pcd_intr.c b/drivers/usb/host/dwc_otg/dwc_otg_pcd_intr.c +new file mode 100644 +index 0000000..c8590b5 +--- /dev/null ++++ b/drivers/usb/host/dwc_otg/dwc_otg_pcd_intr.c +@@ -0,0 +1,5147 @@ ++/* ========================================================================== ++ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_pcd_intr.c $ ++ * $Revision: #116 $ ++ * $Date: 2012/08/10 $ ++ * $Change: 2047372 $ ++ * ++ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, ++ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless ++ * otherwise expressly agreed to in writing between Synopsys and you. ++ * ++ * The Software IS NOT an item of Licensed Software or Licensed Product under ++ * any End User Software License Agreement or Agreement for Licensed Product ++ * with Synopsys or any supplement thereto. You are permitted to use and ++ * redistribute this Software in source and binary forms, with or without ++ * modification, provided that redistributions of source code must retain this ++ * notice. You may not view, use, disclose, copy or distribute this file or ++ * any information contained herein except pursuant to this license grant from ++ * Synopsys. If you do not agree with this notice, including the disclaimer ++ * below, then you are not authorized to use the Software. ++ * ++ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS ++ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS 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. ++ * ========================================================================== */ ++#ifndef DWC_HOST_ONLY ++ ++#include "dwc_otg_pcd.h" ++ ++#ifdef DWC_UTE_CFI ++#include "dwc_otg_cfi.h" ++#endif ++ ++#ifdef DWC_UTE_PER_IO ++extern void complete_xiso_ep(dwc_otg_pcd_ep_t * ep); ++#endif ++//#define PRINT_CFI_DMA_DESCS ++ ++#define DEBUG_EP0 ++ ++/** ++ * This function updates OTG. ++ */ ++static void dwc_otg_pcd_update_otg(dwc_otg_pcd_t * pcd, const unsigned reset) ++{ ++ ++ if (reset) { ++ pcd->b_hnp_enable = 0; ++ pcd->a_hnp_support = 0; ++ pcd->a_alt_hnp_support = 0; ++ } ++ ++ if (pcd->fops->hnp_changed) { ++ pcd->fops->hnp_changed(pcd); ++ } ++} ++ ++/** @file ++ * This file contains the implementation of the PCD Interrupt handlers. ++ * ++ * The PCD handles the device interrupts. Many conditions can cause a ++ * device interrupt. When an interrupt occurs, the device interrupt ++ * service routine determines the cause of the interrupt and ++ * dispatches handling to the appropriate function. These interrupt ++ * handling functions are described below. ++ * All interrupt registers are processed from LSB to MSB. ++ */ ++ ++/** ++ * This function prints the ep0 state for debug purposes. ++ */ ++static inline void print_ep0_state(dwc_otg_pcd_t * pcd) ++{ ++#ifdef DEBUG ++ char str[40]; ++ ++ switch (pcd->ep0state) { ++ case EP0_DISCONNECT: ++ dwc_strcpy(str, "EP0_DISCONNECT"); ++ break; ++ case EP0_IDLE: ++ dwc_strcpy(str, "EP0_IDLE"); ++ break; ++ case EP0_IN_DATA_PHASE: ++ dwc_strcpy(str, "EP0_IN_DATA_PHASE"); ++ break; ++ case EP0_OUT_DATA_PHASE: ++ dwc_strcpy(str, "EP0_OUT_DATA_PHASE"); ++ break; ++ case EP0_IN_STATUS_PHASE: ++ dwc_strcpy(str, "EP0_IN_STATUS_PHASE"); ++ break; ++ case EP0_OUT_STATUS_PHASE: ++ dwc_strcpy(str, "EP0_OUT_STATUS_PHASE"); ++ break; ++ case EP0_STALL: ++ dwc_strcpy(str, "EP0_STALL"); ++ break; ++ default: ++ dwc_strcpy(str, "EP0_INVALID"); ++ } ++ ++ DWC_DEBUGPL(DBG_ANY, "%s(%d)\n", str, pcd->ep0state); ++#endif ++} ++ ++/** ++ * This function calculate the size of the payload in the memory ++ * for out endpoints and prints size for debug purposes(used in ++ * 2.93a DevOutNak feature). ++ */ ++static inline void print_memory_payload(dwc_otg_pcd_t * pcd, dwc_ep_t * ep) ++{ ++#ifdef DEBUG ++ deptsiz_data_t deptsiz_init = {.d32 = 0 }; ++ deptsiz_data_t deptsiz_updt = {.d32 = 0 }; ++ int pack_num; ++ unsigned payload; ++ ++ deptsiz_init.d32 = pcd->core_if->start_doeptsiz_val[ep->num]; ++ deptsiz_updt.d32 = ++ DWC_READ_REG32(&pcd->core_if->dev_if-> ++ out_ep_regs[ep->num]->doeptsiz); ++ /* Payload will be */ ++ payload = deptsiz_init.b.xfersize - deptsiz_updt.b.xfersize; ++ /* Packet count is decremented every time a packet ++ * is written to the RxFIFO not in to the external memory ++ * So, if payload == 0, then it means no packet was sent to ext memory*/ ++ pack_num = (!payload) ? 0 : (deptsiz_init.b.pktcnt - deptsiz_updt.b.pktcnt); ++ DWC_DEBUGPL(DBG_PCDV, ++ "Payload for EP%d-%s\n", ++ ep->num, (ep->is_in ? "IN" : "OUT")); ++ DWC_DEBUGPL(DBG_PCDV, ++ "Number of transfered bytes = 0x%08x\n", payload); ++ DWC_DEBUGPL(DBG_PCDV, ++ "Number of transfered packets = %d\n", pack_num); ++#endif ++} ++ ++ ++#ifdef DWC_UTE_CFI ++static inline void print_desc(struct dwc_otg_dma_desc *ddesc, ++ const uint8_t * epname, int descnum) ++{ ++ CFI_INFO ++ ("%s DMA_DESC(%d) buf=0x%08x bytes=0x%04x; sp=0x%x; l=0x%x; sts=0x%02x; bs=0x%02x\n", ++ epname, descnum, ddesc->buf, ddesc->status.b.bytes, ++ ddesc->status.b.sp, ddesc->status.b.l, ddesc->status.b.sts, ++ ddesc->status.b.bs); ++} ++#endif ++ ++/** ++ * This function returns pointer to in ep struct with number ep_num ++ */ ++static inline dwc_otg_pcd_ep_t *get_in_ep(dwc_otg_pcd_t * pcd, uint32_t ep_num) ++{ ++ int i; ++ int num_in_eps = GET_CORE_IF(pcd)->dev_if->num_in_eps; ++ if (ep_num == 0) { ++ return &pcd->ep0; ++ } else { ++ for (i = 0; i < num_in_eps; ++i) { ++ if (pcd->in_ep[i].dwc_ep.num == ep_num) ++ return &pcd->in_ep[i]; ++ } ++ return 0; ++ } ++} ++ ++/** ++ * This function returns pointer to out ep struct with number ep_num ++ */ ++static inline dwc_otg_pcd_ep_t *get_out_ep(dwc_otg_pcd_t * pcd, uint32_t ep_num) ++{ ++ int i; ++ int num_out_eps = GET_CORE_IF(pcd)->dev_if->num_out_eps; ++ if (ep_num == 0) { ++ return &pcd->ep0; ++ } else { ++ for (i = 0; i < num_out_eps; ++i) { ++ if (pcd->out_ep[i].dwc_ep.num == ep_num) ++ return &pcd->out_ep[i]; ++ } ++ return 0; ++ } ++} ++ ++/** ++ * This functions gets a pointer to an EP from the wIndex address ++ * value of the control request. ++ */ ++dwc_otg_pcd_ep_t *get_ep_by_addr(dwc_otg_pcd_t * pcd, u16 wIndex) ++{ ++ dwc_otg_pcd_ep_t *ep; ++ uint32_t ep_num = UE_GET_ADDR(wIndex); ++ ++ if (ep_num == 0) { ++ ep = &pcd->ep0; ++ } else if (UE_GET_DIR(wIndex) == UE_DIR_IN) { /* in ep */ ++ ep = &pcd->in_ep[ep_num - 1]; ++ } else { ++ ep = &pcd->out_ep[ep_num - 1]; ++ } ++ ++ return ep; ++} ++ ++/** ++ * This function checks the EP request queue, if the queue is not ++ * empty the next request is started. ++ */ ++void start_next_request(dwc_otg_pcd_ep_t * ep) ++{ ++ dwc_otg_pcd_request_t *req = 0; ++ uint32_t max_transfer = ++ GET_CORE_IF(ep->pcd)->core_params->max_transfer_size; ++ ++#ifdef DWC_UTE_CFI ++ struct dwc_otg_pcd *pcd; ++ pcd = ep->pcd; ++#endif ++ ++ if (!DWC_CIRCLEQ_EMPTY(&ep->queue)) { ++ req = DWC_CIRCLEQ_FIRST(&ep->queue); ++ ++#ifdef DWC_UTE_CFI ++ if (ep->dwc_ep.buff_mode != BM_STANDARD) { ++ ep->dwc_ep.cfi_req_len = req->length; ++ pcd->cfi->ops.build_descriptors(pcd->cfi, pcd, ep, req); ++ } else { ++#endif ++ /* Setup and start the Transfer */ ++ if (req->dw_align_buf) { ++ ep->dwc_ep.dma_addr = req->dw_align_buf_dma; ++ ep->dwc_ep.start_xfer_buff = req->dw_align_buf; ++ ep->dwc_ep.xfer_buff = req->dw_align_buf; ++ } else { ++ ep->dwc_ep.dma_addr = req->dma; ++ ep->dwc_ep.start_xfer_buff = req->buf; ++ ep->dwc_ep.xfer_buff = req->buf; ++ } ++ ep->dwc_ep.sent_zlp = 0; ++ ep->dwc_ep.total_len = req->length; ++ ep->dwc_ep.xfer_len = 0; ++ ep->dwc_ep.xfer_count = 0; ++ ++ ep->dwc_ep.maxxfer = max_transfer; ++ if (GET_CORE_IF(ep->pcd)->dma_desc_enable) { ++ uint32_t out_max_xfer = DDMA_MAX_TRANSFER_SIZE ++ - (DDMA_MAX_TRANSFER_SIZE % 4); ++ if (ep->dwc_ep.is_in) { ++ if (ep->dwc_ep.maxxfer > ++ DDMA_MAX_TRANSFER_SIZE) { ++ ep->dwc_ep.maxxfer = ++ DDMA_MAX_TRANSFER_SIZE; ++ } ++ } else { ++ if (ep->dwc_ep.maxxfer > out_max_xfer) { ++ ep->dwc_ep.maxxfer = ++ out_max_xfer; ++ } ++ } ++ } ++ if (ep->dwc_ep.maxxfer < ep->dwc_ep.total_len) { ++ ep->dwc_ep.maxxfer -= ++ (ep->dwc_ep.maxxfer % ep->dwc_ep.maxpacket); ++ } ++ if (req->sent_zlp) { ++ if ((ep->dwc_ep.total_len % ++ ep->dwc_ep.maxpacket == 0) ++ && (ep->dwc_ep.total_len != 0)) { ++ ep->dwc_ep.sent_zlp = 1; ++ } ++ ++ } ++#ifdef DWC_UTE_CFI ++ } ++#endif ++ dwc_otg_ep_start_transfer(GET_CORE_IF(ep->pcd), &ep->dwc_ep); ++ } else if (ep->dwc_ep.type == DWC_OTG_EP_TYPE_ISOC) { ++ DWC_PRINTF("There are no more ISOC requests \n"); ++ ep->dwc_ep.frame_num = 0xFFFFFFFF; ++ } ++} ++ ++/** ++ * This function handles the SOF Interrupts. At this time the SOF ++ * Interrupt is disabled. ++ */ ++int32_t dwc_otg_pcd_handle_sof_intr(dwc_otg_pcd_t * pcd) ++{ ++ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); ++ ++ gintsts_data_t gintsts; ++ ++ DWC_DEBUGPL(DBG_PCD, "SOF\n"); ++ ++ /* Clear interrupt */ ++ gintsts.d32 = 0; ++ gintsts.b.sofintr = 1; ++ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, gintsts.d32); ++ ++ return 1; ++} ++ ++/** ++ * This function handles the Rx Status Queue Level Interrupt, which ++ * indicates that there is a least one packet in the Rx FIFO. The ++ * packets are moved from the FIFO to memory, where they will be ++ * processed when the Endpoint Interrupt Register indicates Transfer ++ * Complete or SETUP Phase Done. ++ * ++ * Repeat the following until the Rx Status Queue is empty: ++ * -# Read the Receive Status Pop Register (GRXSTSP) to get Packet ++ * info ++ * -# If Receive FIFO is empty then skip to step Clear the interrupt ++ * and exit ++ * -# If SETUP Packet call dwc_otg_read_setup_packet to copy the ++ * SETUP data to the buffer ++ * -# If OUT Data Packet call dwc_otg_read_packet to copy the data ++ * to the destination buffer ++ */ ++int32_t dwc_otg_pcd_handle_rx_status_q_level_intr(dwc_otg_pcd_t * pcd) ++{ ++ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); ++ dwc_otg_core_global_regs_t *global_regs = core_if->core_global_regs; ++ gintmsk_data_t gintmask = {.d32 = 0 }; ++ device_grxsts_data_t status; ++ dwc_otg_pcd_ep_t *ep; ++ gintsts_data_t gintsts; ++#ifdef DEBUG ++ static char *dpid_str[] = { "D0", "D2", "D1", "MDATA" }; ++#endif ++ ++ //DWC_DEBUGPL(DBG_PCDV, "%s(%p)\n", __func__, _pcd); ++ /* Disable the Rx Status Queue Level interrupt */ ++ gintmask.b.rxstsqlvl = 1; ++ DWC_MODIFY_REG32(&global_regs->gintmsk, gintmask.d32, 0); ++ ++ /* Get the Status from the top of the FIFO */ ++ status.d32 = DWC_READ_REG32(&global_regs->grxstsp); ++ ++ DWC_DEBUGPL(DBG_PCD, "EP:%d BCnt:%d DPID:%s " ++ "pktsts:%x Frame:%d(0x%0x)\n", ++ status.b.epnum, status.b.bcnt, ++ dpid_str[status.b.dpid], ++ status.b.pktsts, status.b.fn, status.b.fn); ++ /* Get pointer to EP structure */ ++ ep = get_out_ep(pcd, status.b.epnum); ++ ++ switch (status.b.pktsts) { ++ case DWC_DSTS_GOUT_NAK: ++ DWC_DEBUGPL(DBG_PCDV, "Global OUT NAK\n"); ++ break; ++ case DWC_STS_DATA_UPDT: ++ DWC_DEBUGPL(DBG_PCDV, "OUT Data Packet\n"); ++ if (status.b.bcnt && ep->dwc_ep.xfer_buff) { ++ /** @todo NGS Check for buffer overflow? */ ++ dwc_otg_read_packet(core_if, ++ ep->dwc_ep.xfer_buff, ++ status.b.bcnt); ++ ep->dwc_ep.xfer_count += status.b.bcnt; ++ ep->dwc_ep.xfer_buff += status.b.bcnt; ++ } ++ break; ++ case DWC_STS_XFER_COMP: ++ DWC_DEBUGPL(DBG_PCDV, "OUT Complete\n"); ++ break; ++ case DWC_DSTS_SETUP_COMP: ++#ifdef DEBUG_EP0 ++ DWC_DEBUGPL(DBG_PCDV, "Setup Complete\n"); ++#endif ++ break; ++ case DWC_DSTS_SETUP_UPDT: ++ dwc_otg_read_setup_packet(core_if, pcd->setup_pkt->d32); ++#ifdef DEBUG_EP0 ++ DWC_DEBUGPL(DBG_PCD, ++ "SETUP PKT: %02x.%02x v%04x i%04x l%04x\n", ++ pcd->setup_pkt->req.bmRequestType, ++ pcd->setup_pkt->req.bRequest, ++ UGETW(pcd->setup_pkt->req.wValue), ++ UGETW(pcd->setup_pkt->req.wIndex), ++ UGETW(pcd->setup_pkt->req.wLength)); ++#endif ++ ep->dwc_ep.xfer_count += status.b.bcnt; ++ break; ++ default: ++ DWC_DEBUGPL(DBG_PCDV, "Invalid Packet Status (0x%0x)\n", ++ status.b.pktsts); ++ break; ++ } ++ ++ /* Enable the Rx Status Queue Level interrupt */ ++ DWC_MODIFY_REG32(&global_regs->gintmsk, 0, gintmask.d32); ++ /* Clear interrupt */ ++ gintsts.d32 = 0; ++ gintsts.b.rxstsqlvl = 1; ++ DWC_WRITE_REG32(&global_regs->gintsts, gintsts.d32); ++ ++ //DWC_DEBUGPL(DBG_PCDV, "EXIT: %s\n", __func__); ++ return 1; ++} ++ ++/** ++ * This function examines the Device IN Token Learning Queue to ++ * determine the EP number of the last IN token received. This ++ * implementation is for the Mass Storage device where there are only ++ * 2 IN EPs (Control-IN and BULK-IN). ++ * ++ * The EP numbers for the first six IN Tokens are in DTKNQR1 and there ++ * are 8 EP Numbers in each of the other possible DTKNQ Registers. ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ * ++ */ ++static inline int get_ep_of_last_in_token(dwc_otg_core_if_t * core_if) ++{ ++ dwc_otg_device_global_regs_t *dev_global_regs = ++ core_if->dev_if->dev_global_regs; ++ const uint32_t TOKEN_Q_DEPTH = core_if->hwcfg2.b.dev_token_q_depth; ++ /* Number of Token Queue Registers */ ++ const int DTKNQ_REG_CNT = (TOKEN_Q_DEPTH + 7) / 8; ++ dtknq1_data_t dtknqr1; ++ uint32_t in_tkn_epnums[4]; ++ int ndx = 0; ++ int i = 0; ++ volatile uint32_t *addr = &dev_global_regs->dtknqr1; ++ int epnum = 0; ++ ++ //DWC_DEBUGPL(DBG_PCD,"dev_token_q_depth=%d\n",TOKEN_Q_DEPTH); ++ ++ /* Read the DTKNQ Registers */ ++ for (i = 0; i < DTKNQ_REG_CNT; i++) { ++ in_tkn_epnums[i] = DWC_READ_REG32(addr); ++ DWC_DEBUGPL(DBG_PCDV, "DTKNQR%d=0x%08x\n", i + 1, ++ in_tkn_epnums[i]); ++ if (addr == &dev_global_regs->dvbusdis) { ++ addr = &dev_global_regs->dtknqr3_dthrctl; ++ } else { ++ ++addr; ++ } ++ ++ } ++ ++ /* Copy the DTKNQR1 data to the bit field. */ ++ dtknqr1.d32 = in_tkn_epnums[0]; ++ /* Get the EP numbers */ ++ in_tkn_epnums[0] = dtknqr1.b.epnums0_5; ++ ndx = dtknqr1.b.intknwptr - 1; ++ ++ //DWC_DEBUGPL(DBG_PCDV,"ndx=%d\n",ndx); ++ if (ndx == -1) { ++ /** @todo Find a simpler way to calculate the max ++ * queue position.*/ ++ int cnt = TOKEN_Q_DEPTH; ++ if (TOKEN_Q_DEPTH <= 6) { ++ cnt = TOKEN_Q_DEPTH - 1; ++ } else if (TOKEN_Q_DEPTH <= 14) { ++ cnt = TOKEN_Q_DEPTH - 7; ++ } else if (TOKEN_Q_DEPTH <= 22) { ++ cnt = TOKEN_Q_DEPTH - 15; ++ } else { ++ cnt = TOKEN_Q_DEPTH - 23; ++ } ++ epnum = (in_tkn_epnums[DTKNQ_REG_CNT - 1] >> (cnt * 4)) & 0xF; ++ } else { ++ if (ndx <= 5) { ++ epnum = (in_tkn_epnums[0] >> (ndx * 4)) & 0xF; ++ } else if (ndx <= 13) { ++ ndx -= 6; ++ epnum = (in_tkn_epnums[1] >> (ndx * 4)) & 0xF; ++ } else if (ndx <= 21) { ++ ndx -= 14; ++ epnum = (in_tkn_epnums[2] >> (ndx * 4)) & 0xF; ++ } else if (ndx <= 29) { ++ ndx -= 22; ++ epnum = (in_tkn_epnums[3] >> (ndx * 4)) & 0xF; ++ } ++ } ++ //DWC_DEBUGPL(DBG_PCD,"epnum=%d\n",epnum); ++ return epnum; ++} ++ ++/** ++ * This interrupt occurs when the non-periodic Tx FIFO is half-empty. ++ * The active request is checked for the next packet to be loaded into ++ * the non-periodic Tx FIFO. ++ */ ++int32_t dwc_otg_pcd_handle_np_tx_fifo_empty_intr(dwc_otg_pcd_t * pcd) ++{ ++ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); ++ dwc_otg_core_global_regs_t *global_regs = core_if->core_global_regs; ++ dwc_otg_dev_in_ep_regs_t *ep_regs; ++ gnptxsts_data_t txstatus = {.d32 = 0 }; ++ gintsts_data_t gintsts; ++ ++ int epnum = 0; ++ dwc_otg_pcd_ep_t *ep = 0; ++ uint32_t len = 0; ++ int dwords; ++ ++ /* Get the epnum from the IN Token Learning Queue. */ ++ epnum = get_ep_of_last_in_token(core_if); ++ ep = get_in_ep(pcd, epnum); ++ ++ DWC_DEBUGPL(DBG_PCD, "NP TxFifo Empty: %d \n", epnum); ++ ++ ep_regs = core_if->dev_if->in_ep_regs[epnum]; ++ ++ len = ep->dwc_ep.xfer_len - ep->dwc_ep.xfer_count; ++ if (len > ep->dwc_ep.maxpacket) { ++ len = ep->dwc_ep.maxpacket; ++ } ++ dwords = (len + 3) / 4; ++ ++ /* While there is space in the queue and space in the FIFO and ++ * More data to tranfer, Write packets to the Tx FIFO */ ++ txstatus.d32 = DWC_READ_REG32(&global_regs->gnptxsts); ++ DWC_DEBUGPL(DBG_PCDV, "b4 GNPTXSTS=0x%08x\n", txstatus.d32); ++ ++ while (txstatus.b.nptxqspcavail > 0 && ++ txstatus.b.nptxfspcavail > dwords && ++ ep->dwc_ep.xfer_count < ep->dwc_ep.xfer_len) { ++ /* Write the FIFO */ ++ dwc_otg_ep_write_packet(core_if, &ep->dwc_ep, 0); ++ len = ep->dwc_ep.xfer_len - ep->dwc_ep.xfer_count; ++ ++ if (len > ep->dwc_ep.maxpacket) { ++ len = ep->dwc_ep.maxpacket; ++ } ++ ++ dwords = (len + 3) / 4; ++ txstatus.d32 = DWC_READ_REG32(&global_regs->gnptxsts); ++ DWC_DEBUGPL(DBG_PCDV, "GNPTXSTS=0x%08x\n", txstatus.d32); ++ } ++ ++ DWC_DEBUGPL(DBG_PCDV, "GNPTXSTS=0x%08x\n", ++ DWC_READ_REG32(&global_regs->gnptxsts)); ++ ++ /* Clear interrupt */ ++ gintsts.d32 = 0; ++ gintsts.b.nptxfempty = 1; ++ DWC_WRITE_REG32(&global_regs->gintsts, gintsts.d32); ++ ++ return 1; ++} ++ ++/** ++ * This function is called when dedicated Tx FIFO Empty interrupt occurs. ++ * The active request is checked for the next packet to be loaded into ++ * apropriate Tx FIFO. ++ */ ++static int32_t write_empty_tx_fifo(dwc_otg_pcd_t * pcd, uint32_t epnum) ++{ ++ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); ++ dwc_otg_dev_if_t *dev_if = core_if->dev_if; ++ dwc_otg_dev_in_ep_regs_t *ep_regs; ++ dtxfsts_data_t txstatus = {.d32 = 0 }; ++ dwc_otg_pcd_ep_t *ep = 0; ++ uint32_t len = 0; ++ int dwords; ++ ++ ep = get_in_ep(pcd, epnum); ++ ++ DWC_DEBUGPL(DBG_PCD, "Dedicated TxFifo Empty: %d \n", epnum); ++ ++ ep_regs = core_if->dev_if->in_ep_regs[epnum]; ++ ++ len = ep->dwc_ep.xfer_len - ep->dwc_ep.xfer_count; ++ ++ if (len > ep->dwc_ep.maxpacket) { ++ len = ep->dwc_ep.maxpacket; ++ } ++ ++ dwords = (len + 3) / 4; ++ ++ /* While there is space in the queue and space in the FIFO and ++ * More data to tranfer, Write packets to the Tx FIFO */ ++ txstatus.d32 = DWC_READ_REG32(&dev_if->in_ep_regs[epnum]->dtxfsts); ++ DWC_DEBUGPL(DBG_PCDV, "b4 dtxfsts[%d]=0x%08x\n", epnum, txstatus.d32); ++ ++ while (txstatus.b.txfspcavail > dwords && ++ ep->dwc_ep.xfer_count < ep->dwc_ep.xfer_len && ++ ep->dwc_ep.xfer_len != 0) { ++ /* Write the FIFO */ ++ dwc_otg_ep_write_packet(core_if, &ep->dwc_ep, 0); ++ ++ len = ep->dwc_ep.xfer_len - ep->dwc_ep.xfer_count; ++ if (len > ep->dwc_ep.maxpacket) { ++ len = ep->dwc_ep.maxpacket; ++ } ++ ++ dwords = (len + 3) / 4; ++ txstatus.d32 = ++ DWC_READ_REG32(&dev_if->in_ep_regs[epnum]->dtxfsts); ++ DWC_DEBUGPL(DBG_PCDV, "dtxfsts[%d]=0x%08x\n", epnum, ++ txstatus.d32); ++ } ++ ++ DWC_DEBUGPL(DBG_PCDV, "b4 dtxfsts[%d]=0x%08x\n", epnum, ++ DWC_READ_REG32(&dev_if->in_ep_regs[epnum]->dtxfsts)); ++ ++ return 1; ++} ++ ++/** ++ * This function is called when the Device is disconnected. It stops ++ * any active requests and informs the Gadget driver of the ++ * disconnect. ++ */ ++void dwc_otg_pcd_stop(dwc_otg_pcd_t * pcd) ++{ ++ int i, num_in_eps, num_out_eps; ++ dwc_otg_pcd_ep_t *ep; ++ ++ gintmsk_data_t intr_mask = {.d32 = 0 }; ++ ++ DWC_SPINLOCK(pcd->lock); ++ ++ num_in_eps = GET_CORE_IF(pcd)->dev_if->num_in_eps; ++ num_out_eps = GET_CORE_IF(pcd)->dev_if->num_out_eps; ++ ++ DWC_DEBUGPL(DBG_PCDV, "%s() \n", __func__); ++ /* don't disconnect drivers more than once */ ++ if (pcd->ep0state == EP0_DISCONNECT) { ++ DWC_DEBUGPL(DBG_ANY, "%s() Already Disconnected\n", __func__); ++ DWC_SPINUNLOCK(pcd->lock); ++ return; ++ } ++ pcd->ep0state = EP0_DISCONNECT; ++ ++ /* Reset the OTG state. */ ++ dwc_otg_pcd_update_otg(pcd, 1); ++ ++ /* Disable the NP Tx Fifo Empty Interrupt. */ ++ intr_mask.b.nptxfempty = 1; ++ DWC_MODIFY_REG32(&GET_CORE_IF(pcd)->core_global_regs->gintmsk, ++ intr_mask.d32, 0); ++ ++ /* Flush the FIFOs */ ++ /**@todo NGS Flush Periodic FIFOs */ ++ dwc_otg_flush_tx_fifo(GET_CORE_IF(pcd), 0x10); ++ dwc_otg_flush_rx_fifo(GET_CORE_IF(pcd)); ++ ++ /* prevent new request submissions, kill any outstanding requests */ ++ ep = &pcd->ep0; ++ dwc_otg_request_nuke(ep); ++ /* prevent new request submissions, kill any outstanding requests */ ++ for (i = 0; i < num_in_eps; i++) { ++ dwc_otg_pcd_ep_t *ep = &pcd->in_ep[i]; ++ dwc_otg_request_nuke(ep); ++ } ++ /* prevent new request submissions, kill any outstanding requests */ ++ for (i = 0; i < num_out_eps; i++) { ++ dwc_otg_pcd_ep_t *ep = &pcd->out_ep[i]; ++ dwc_otg_request_nuke(ep); ++ } ++ ++ /* report disconnect; the driver is already quiesced */ ++ if (pcd->fops->disconnect) { ++ DWC_SPINUNLOCK(pcd->lock); ++ pcd->fops->disconnect(pcd); ++ DWC_SPINLOCK(pcd->lock); ++ } ++ DWC_SPINUNLOCK(pcd->lock); ++} ++ ++/** ++ * This interrupt indicates that ... ++ */ ++int32_t dwc_otg_pcd_handle_i2c_intr(dwc_otg_pcd_t * pcd) ++{ ++ gintmsk_data_t intr_mask = {.d32 = 0 }; ++ gintsts_data_t gintsts; ++ ++ DWC_PRINTF("INTERRUPT Handler not implemented for %s\n", "i2cintr"); ++ intr_mask.b.i2cintr = 1; ++ DWC_MODIFY_REG32(&GET_CORE_IF(pcd)->core_global_regs->gintmsk, ++ intr_mask.d32, 0); ++ ++ /* Clear interrupt */ ++ gintsts.d32 = 0; ++ gintsts.b.i2cintr = 1; ++ DWC_WRITE_REG32(&GET_CORE_IF(pcd)->core_global_regs->gintsts, ++ gintsts.d32); ++ return 1; ++} ++ ++/** ++ * This interrupt indicates that ... ++ */ ++int32_t dwc_otg_pcd_handle_early_suspend_intr(dwc_otg_pcd_t * pcd) ++{ ++ gintsts_data_t gintsts; ++#if defined(VERBOSE) ++ DWC_PRINTF("Early Suspend Detected\n"); ++#endif ++ ++ /* Clear interrupt */ ++ gintsts.d32 = 0; ++ gintsts.b.erlysuspend = 1; ++ DWC_WRITE_REG32(&GET_CORE_IF(pcd)->core_global_regs->gintsts, ++ gintsts.d32); ++ return 1; ++} ++ ++/** ++ * This function configures EPO to receive SETUP packets. ++ * ++ * @todo NGS: Update the comments from the HW FS. ++ * ++ * -# Program the following fields in the endpoint specific registers ++ * for Control OUT EP 0, in order to receive a setup packet ++ * - DOEPTSIZ0.Packet Count = 3 (To receive up to 3 back to back ++ * setup packets) ++ * - DOEPTSIZE0.Transfer Size = 24 Bytes (To receive up to 3 back ++ * to back setup packets) ++ * - In DMA mode, DOEPDMA0 Register with a memory address to ++ * store any setup packets received ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ * @param pcd Programming view of the PCD. ++ */ ++static inline void ep0_out_start(dwc_otg_core_if_t * core_if, ++ dwc_otg_pcd_t * pcd) ++{ ++ dwc_otg_dev_if_t *dev_if = core_if->dev_if; ++ deptsiz0_data_t doeptsize0 = {.d32 = 0 }; ++ dwc_otg_dev_dma_desc_t *dma_desc; ++ depctl_data_t doepctl = {.d32 = 0 }; ++ ++#ifdef VERBOSE ++ DWC_DEBUGPL(DBG_PCDV, "%s() doepctl0=%0x\n", __func__, ++ DWC_READ_REG32(&dev_if->out_ep_regs[0]->doepctl)); ++#endif ++ if (core_if->snpsid >= OTG_CORE_REV_3_00a) { ++ doepctl.d32 = DWC_READ_REG32(&dev_if->out_ep_regs[0]->doepctl); ++ if (doepctl.b.epena) { ++ return; ++ } ++ } ++ ++ doeptsize0.b.supcnt = 3; ++ doeptsize0.b.pktcnt = 1; ++ doeptsize0.b.xfersize = 8 * 3; ++ ++ if (core_if->dma_enable) { ++ if (!core_if->dma_desc_enable) { ++ /** put here as for Hermes mode deptisz register should not be written */ ++ DWC_WRITE_REG32(&dev_if->out_ep_regs[0]->doeptsiz, ++ doeptsize0.d32); ++ ++ /** @todo dma needs to handle multiple setup packets (up to 3) */ ++ DWC_WRITE_REG32(&dev_if->out_ep_regs[0]->doepdma, ++ pcd->setup_pkt_dma_handle); ++ } else { ++ dev_if->setup_desc_index = ++ (dev_if->setup_desc_index + 1) & 1; ++ dma_desc = ++ dev_if->setup_desc_addr[dev_if->setup_desc_index]; ++ ++ /** DMA Descriptor Setup */ ++ dma_desc->status.b.bs = BS_HOST_BUSY; ++ if (core_if->snpsid >= OTG_CORE_REV_3_00a) { ++ dma_desc->status.b.sr = 0; ++ dma_desc->status.b.mtrf = 0; ++ } ++ dma_desc->status.b.l = 1; ++ dma_desc->status.b.ioc = 1; ++ dma_desc->status.b.bytes = pcd->ep0.dwc_ep.maxpacket; ++ dma_desc->buf = pcd->setup_pkt_dma_handle; ++ dma_desc->status.b.sts = 0; ++ dma_desc->status.b.bs = BS_HOST_READY; ++ ++ /** DOEPDMA0 Register write */ ++ DWC_WRITE_REG32(&dev_if->out_ep_regs[0]->doepdma, ++ dev_if->dma_setup_desc_addr ++ [dev_if->setup_desc_index]); ++ } ++ ++ } else { ++ /** put here as for Hermes mode deptisz register should not be written */ ++ DWC_WRITE_REG32(&dev_if->out_ep_regs[0]->doeptsiz, ++ doeptsize0.d32); ++ } ++ ++ /** DOEPCTL0 Register write cnak will be set after setup interrupt */ ++ doepctl.d32 = 0; ++ doepctl.b.epena = 1; ++ if (core_if->snpsid <= OTG_CORE_REV_2_94a) { ++ doepctl.b.cnak = 1; ++ DWC_WRITE_REG32(&dev_if->out_ep_regs[0]->doepctl, doepctl.d32); ++ } else { ++ DWC_MODIFY_REG32(&dev_if->out_ep_regs[0]->doepctl, 0, doepctl.d32); ++ } ++ ++#ifdef VERBOSE ++ DWC_DEBUGPL(DBG_PCDV, "doepctl0=%0x\n", ++ DWC_READ_REG32(&dev_if->out_ep_regs[0]->doepctl)); ++ DWC_DEBUGPL(DBG_PCDV, "diepctl0=%0x\n", ++ DWC_READ_REG32(&dev_if->in_ep_regs[0]->diepctl)); ++#endif ++} ++ ++/** ++ * This interrupt occurs when a USB Reset is detected. When the USB ++ * Reset Interrupt occurs the device state is set to DEFAULT and the ++ * EP0 state is set to IDLE. ++ * -# Set the NAK bit for all OUT endpoints (DOEPCTLn.SNAK = 1) ++ * -# Unmask the following interrupt bits ++ * - DAINTMSK.INEP0 = 1 (Control 0 IN endpoint) ++ * - DAINTMSK.OUTEP0 = 1 (Control 0 OUT endpoint) ++ * - DOEPMSK.SETUP = 1 ++ * - DOEPMSK.XferCompl = 1 ++ * - DIEPMSK.XferCompl = 1 ++ * - DIEPMSK.TimeOut = 1 ++ * -# Program the following fields in the endpoint specific registers ++ * for Control OUT EP 0, in order to receive a setup packet ++ * - DOEPTSIZ0.Packet Count = 3 (To receive up to 3 back to back ++ * setup packets) ++ * - DOEPTSIZE0.Transfer Size = 24 Bytes (To receive up to 3 back ++ * to back setup packets) ++ * - In DMA mode, DOEPDMA0 Register with a memory address to ++ * store any setup packets received ++ * At this point, all the required initialization, except for enabling ++ * the control 0 OUT endpoint is done, for receiving SETUP packets. ++ */ ++int32_t dwc_otg_pcd_handle_usb_reset_intr(dwc_otg_pcd_t * pcd) ++{ ++ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); ++ dwc_otg_dev_if_t *dev_if = core_if->dev_if; ++ depctl_data_t doepctl = {.d32 = 0 }; ++ depctl_data_t diepctl = {.d32 = 0 }; ++ daint_data_t daintmsk = {.d32 = 0 }; ++ doepmsk_data_t doepmsk = {.d32 = 0 }; ++ diepmsk_data_t diepmsk = {.d32 = 0 }; ++ dcfg_data_t dcfg = {.d32 = 0 }; ++ grstctl_t resetctl = {.d32 = 0 }; ++ dctl_data_t dctl = {.d32 = 0 }; ++ int i = 0; ++ gintsts_data_t gintsts; ++ pcgcctl_data_t power = {.d32 = 0 }; ++ ++ power.d32 = DWC_READ_REG32(core_if->pcgcctl); ++ if (power.b.stoppclk) { ++ power.d32 = 0; ++ power.b.stoppclk = 1; ++ DWC_MODIFY_REG32(core_if->pcgcctl, power.d32, 0); ++ ++ power.b.pwrclmp = 1; ++ DWC_MODIFY_REG32(core_if->pcgcctl, power.d32, 0); ++ ++ power.b.rstpdwnmodule = 1; ++ DWC_MODIFY_REG32(core_if->pcgcctl, power.d32, 0); ++ } ++ ++ core_if->lx_state = DWC_OTG_L0; ++ ++ DWC_PRINTF("USB RESET\n"); ++#ifdef DWC_EN_ISOC ++ for (i = 1; i < 16; ++i) { ++ dwc_otg_pcd_ep_t *ep; ++ dwc_ep_t *dwc_ep; ++ ep = get_in_ep(pcd, i); ++ if (ep != 0) { ++ dwc_ep = &ep->dwc_ep; ++ dwc_ep->next_frame = 0xffffffff; ++ } ++ } ++#endif /* DWC_EN_ISOC */ ++ ++ /* reset the HNP settings */ ++ dwc_otg_pcd_update_otg(pcd, 1); ++ ++ /* Clear the Remote Wakeup Signalling */ ++ dctl.b.rmtwkupsig = 1; ++ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs->dctl, dctl.d32, 0); ++ ++ /* Set NAK for all OUT EPs */ ++ doepctl.b.snak = 1; ++ for (i = 0; i <= dev_if->num_out_eps; i++) { ++ DWC_WRITE_REG32(&dev_if->out_ep_regs[i]->doepctl, doepctl.d32); ++ } ++ ++ /* Flush the NP Tx FIFO */ ++ dwc_otg_flush_tx_fifo(core_if, 0x10); ++ /* Flush the Learning Queue */ ++ resetctl.b.intknqflsh = 1; ++ DWC_WRITE_REG32(&core_if->core_global_regs->grstctl, resetctl.d32); ++ ++ if (!core_if->core_params->en_multiple_tx_fifo && core_if->dma_enable) { ++ core_if->start_predict = 0; ++ for (i = 0; i<= core_if->dev_if->num_in_eps; ++i) { ++ core_if->nextep_seq[i] = 0xff; // 0xff - EP not active ++ } ++ core_if->nextep_seq[0] = 0; ++ core_if->first_in_nextep_seq = 0; ++ diepctl.d32 = DWC_READ_REG32(&dev_if->in_ep_regs[0]->diepctl); ++ diepctl.b.nextep = 0; ++ DWC_WRITE_REG32(&dev_if->in_ep_regs[0]->diepctl, diepctl.d32); ++ ++ /* Update IN Endpoint Mismatch Count by active IN NP EP count + 1 */ ++ dcfg.d32 = DWC_READ_REG32(&dev_if->dev_global_regs->dcfg); ++ dcfg.b.epmscnt = 2; ++ DWC_WRITE_REG32(&dev_if->dev_global_regs->dcfg, dcfg.d32); ++ ++ DWC_DEBUGPL(DBG_PCDV, ++ "%s first_in_nextep_seq= %2d; nextep_seq[]:\n", ++ __func__, core_if->first_in_nextep_seq); ++ for (i=0; i <= core_if->dev_if->num_in_eps; i++) { ++ DWC_DEBUGPL(DBG_PCDV, "%2d\n", core_if->nextep_seq[i]); ++ } ++ } ++ ++ if (core_if->multiproc_int_enable) { ++ daintmsk.b.inep0 = 1; ++ daintmsk.b.outep0 = 1; ++ DWC_WRITE_REG32(&dev_if->dev_global_regs->deachintmsk, ++ daintmsk.d32); ++ ++ doepmsk.b.setup = 1; ++ doepmsk.b.xfercompl = 1; ++ doepmsk.b.ahberr = 1; ++ doepmsk.b.epdisabled = 1; ++ ++ if ((core_if->dma_desc_enable) || ++ (core_if->dma_enable ++ && core_if->snpsid >= OTG_CORE_REV_3_00a)) { ++ doepmsk.b.stsphsercvd = 1; ++ } ++ if (core_if->dma_desc_enable) ++ doepmsk.b.bna = 1; ++/* ++ doepmsk.b.babble = 1; ++ doepmsk.b.nyet = 1; ++ ++ if (core_if->dma_enable) { ++ doepmsk.b.nak = 1; ++ } ++*/ ++ DWC_WRITE_REG32(&dev_if->dev_global_regs->doepeachintmsk[0], ++ doepmsk.d32); ++ ++ diepmsk.b.xfercompl = 1; ++ diepmsk.b.timeout = 1; ++ diepmsk.b.epdisabled = 1; ++ diepmsk.b.ahberr = 1; ++ diepmsk.b.intknepmis = 1; ++ if (!core_if->en_multiple_tx_fifo && core_if->dma_enable) ++ diepmsk.b.intknepmis = 0; ++ ++/* if (core_if->dma_desc_enable) { ++ diepmsk.b.bna = 1; ++ } ++*/ ++/* ++ if (core_if->dma_enable) { ++ diepmsk.b.nak = 1; ++ } ++*/ ++ DWC_WRITE_REG32(&dev_if->dev_global_regs->diepeachintmsk[0], ++ diepmsk.d32); ++ } else { ++ daintmsk.b.inep0 = 1; ++ daintmsk.b.outep0 = 1; ++ DWC_WRITE_REG32(&dev_if->dev_global_regs->daintmsk, ++ daintmsk.d32); ++ ++ doepmsk.b.setup = 1; ++ doepmsk.b.xfercompl = 1; ++ doepmsk.b.ahberr = 1; ++ doepmsk.b.epdisabled = 1; ++ ++ if ((core_if->dma_desc_enable) || ++ (core_if->dma_enable ++ && core_if->snpsid >= OTG_CORE_REV_3_00a)) { ++ doepmsk.b.stsphsercvd = 1; ++ } ++ if (core_if->dma_desc_enable) ++ doepmsk.b.bna = 1; ++ DWC_WRITE_REG32(&dev_if->dev_global_regs->doepmsk, doepmsk.d32); ++ ++ diepmsk.b.xfercompl = 1; ++ diepmsk.b.timeout = 1; ++ diepmsk.b.epdisabled = 1; ++ diepmsk.b.ahberr = 1; ++ if (!core_if->en_multiple_tx_fifo && core_if->dma_enable) ++ diepmsk.b.intknepmis = 0; ++/* ++ if (core_if->dma_desc_enable) { ++ diepmsk.b.bna = 1; ++ } ++*/ ++ ++ DWC_WRITE_REG32(&dev_if->dev_global_regs->diepmsk, diepmsk.d32); ++ } ++ ++ /* Reset Device Address */ ++ dcfg.d32 = DWC_READ_REG32(&dev_if->dev_global_regs->dcfg); ++ dcfg.b.devaddr = 0; ++ DWC_WRITE_REG32(&dev_if->dev_global_regs->dcfg, dcfg.d32); ++ ++ /* setup EP0 to receive SETUP packets */ ++ if (core_if->snpsid <= OTG_CORE_REV_2_94a) ++ ep0_out_start(core_if, pcd); ++ ++ /* Clear interrupt */ ++ gintsts.d32 = 0; ++ gintsts.b.usbreset = 1; ++ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, gintsts.d32); ++ ++ return 1; ++} ++ ++/** ++ * Get the device speed from the device status register and convert it ++ * to USB speed constant. ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ */ ++static int get_device_speed(dwc_otg_core_if_t * core_if) ++{ ++ dsts_data_t dsts; ++ int speed = 0; ++ dsts.d32 = DWC_READ_REG32(&core_if->dev_if->dev_global_regs->dsts); ++ ++ switch (dsts.b.enumspd) { ++ case DWC_DSTS_ENUMSPD_HS_PHY_30MHZ_OR_60MHZ: ++ speed = USB_SPEED_HIGH; ++ break; ++ case DWC_DSTS_ENUMSPD_FS_PHY_30MHZ_OR_60MHZ: ++ case DWC_DSTS_ENUMSPD_FS_PHY_48MHZ: ++ speed = USB_SPEED_FULL; ++ break; ++ ++ case DWC_DSTS_ENUMSPD_LS_PHY_6MHZ: ++ speed = USB_SPEED_LOW; ++ break; ++ } ++ ++ return speed; ++} ++ ++/** ++ * Read the device status register and set the device speed in the ++ * data structure. ++ * Set up EP0 to receive SETUP packets by calling dwc_ep0_activate. ++ */ ++int32_t dwc_otg_pcd_handle_enum_done_intr(dwc_otg_pcd_t * pcd) ++{ ++ dwc_otg_pcd_ep_t *ep0 = &pcd->ep0; ++ gintsts_data_t gintsts; ++ gusbcfg_data_t gusbcfg; ++ dwc_otg_core_global_regs_t *global_regs = ++ GET_CORE_IF(pcd)->core_global_regs; ++ uint8_t utmi16b, utmi8b; ++ int speed; ++ DWC_DEBUGPL(DBG_PCD, "SPEED ENUM\n"); ++ ++ if (GET_CORE_IF(pcd)->snpsid >= OTG_CORE_REV_2_60a) { ++ utmi16b = 6; //vahrama old value was 6; ++ utmi8b = 9; ++ } else { ++ utmi16b = 4; ++ utmi8b = 8; ++ } ++ dwc_otg_ep0_activate(GET_CORE_IF(pcd), &ep0->dwc_ep); ++ if (GET_CORE_IF(pcd)->snpsid >= OTG_CORE_REV_3_00a) { ++ ep0_out_start(GET_CORE_IF(pcd), pcd); ++ } ++ ++#ifdef DEBUG_EP0 ++ print_ep0_state(pcd); ++#endif ++ ++ if (pcd->ep0state == EP0_DISCONNECT) { ++ pcd->ep0state = EP0_IDLE; ++ } else if (pcd->ep0state == EP0_STALL) { ++ pcd->ep0state = EP0_IDLE; ++ } ++ ++ pcd->ep0state = EP0_IDLE; ++ ++ ep0->stopped = 0; ++ ++ speed = get_device_speed(GET_CORE_IF(pcd)); ++ pcd->fops->connect(pcd, speed); ++ ++ /* Set USB turnaround time based on device speed and PHY interface. */ ++ gusbcfg.d32 = DWC_READ_REG32(&global_regs->gusbcfg); ++ if (speed == USB_SPEED_HIGH) { ++ if (GET_CORE_IF(pcd)->hwcfg2.b.hs_phy_type == ++ DWC_HWCFG2_HS_PHY_TYPE_ULPI) { ++ /* ULPI interface */ ++ gusbcfg.b.usbtrdtim = 9; ++ } ++ if (GET_CORE_IF(pcd)->hwcfg2.b.hs_phy_type == ++ DWC_HWCFG2_HS_PHY_TYPE_UTMI) { ++ /* UTMI+ interface */ ++ if (GET_CORE_IF(pcd)->hwcfg4.b.utmi_phy_data_width == 0) { ++ gusbcfg.b.usbtrdtim = utmi8b; ++ } else if (GET_CORE_IF(pcd)->hwcfg4. ++ b.utmi_phy_data_width == 1) { ++ gusbcfg.b.usbtrdtim = utmi16b; ++ } else if (GET_CORE_IF(pcd)-> ++ core_params->phy_utmi_width == 8) { ++ gusbcfg.b.usbtrdtim = utmi8b; ++ } else { ++ gusbcfg.b.usbtrdtim = utmi16b; ++ } ++ } ++ if (GET_CORE_IF(pcd)->hwcfg2.b.hs_phy_type == ++ DWC_HWCFG2_HS_PHY_TYPE_UTMI_ULPI) { ++ /* UTMI+ OR ULPI interface */ ++ if (gusbcfg.b.ulpi_utmi_sel == 1) { ++ /* ULPI interface */ ++ gusbcfg.b.usbtrdtim = 9; ++ } else { ++ /* UTMI+ interface */ ++ if (GET_CORE_IF(pcd)-> ++ core_params->phy_utmi_width == 16) { ++ gusbcfg.b.usbtrdtim = utmi16b; ++ } else { ++ gusbcfg.b.usbtrdtim = utmi8b; ++ } ++ } ++ } ++ } else { ++ /* Full or low speed */ ++ gusbcfg.b.usbtrdtim = 9; ++ } ++ DWC_WRITE_REG32(&global_regs->gusbcfg, gusbcfg.d32); ++ ++ /* Clear interrupt */ ++ gintsts.d32 = 0; ++ gintsts.b.enumdone = 1; ++ DWC_WRITE_REG32(&GET_CORE_IF(pcd)->core_global_regs->gintsts, ++ gintsts.d32); ++ return 1; ++} ++ ++/** ++ * This interrupt indicates that the ISO OUT Packet was dropped due to ++ * Rx FIFO full or Rx Status Queue Full. If this interrupt occurs ++ * read all the data from the Rx FIFO. ++ */ ++int32_t dwc_otg_pcd_handle_isoc_out_packet_dropped_intr(dwc_otg_pcd_t * pcd) ++{ ++ gintmsk_data_t intr_mask = {.d32 = 0 }; ++ gintsts_data_t gintsts; ++ ++ DWC_WARN("INTERRUPT Handler not implemented for %s\n", ++ "ISOC Out Dropped"); ++ ++ intr_mask.b.isooutdrop = 1; ++ DWC_MODIFY_REG32(&GET_CORE_IF(pcd)->core_global_regs->gintmsk, ++ intr_mask.d32, 0); ++ ++ /* Clear interrupt */ ++ gintsts.d32 = 0; ++ gintsts.b.isooutdrop = 1; ++ DWC_WRITE_REG32(&GET_CORE_IF(pcd)->core_global_regs->gintsts, ++ gintsts.d32); ++ ++ return 1; ++} ++ ++/** ++ * This interrupt indicates the end of the portion of the micro-frame ++ * for periodic transactions. If there is a periodic transaction for ++ * the next frame, load the packets into the EP periodic Tx FIFO. ++ */ ++int32_t dwc_otg_pcd_handle_end_periodic_frame_intr(dwc_otg_pcd_t * pcd) ++{ ++ gintmsk_data_t intr_mask = {.d32 = 0 }; ++ gintsts_data_t gintsts; ++ DWC_PRINTF("INTERRUPT Handler not implemented for %s\n", "EOP"); ++ ++ intr_mask.b.eopframe = 1; ++ DWC_MODIFY_REG32(&GET_CORE_IF(pcd)->core_global_regs->gintmsk, ++ intr_mask.d32, 0); ++ ++ /* Clear interrupt */ ++ gintsts.d32 = 0; ++ gintsts.b.eopframe = 1; ++ DWC_WRITE_REG32(&GET_CORE_IF(pcd)->core_global_regs->gintsts, ++ gintsts.d32); ++ ++ return 1; ++} ++ ++/** ++ * This interrupt indicates that EP of the packet on the top of the ++ * non-periodic Tx FIFO does not match EP of the IN Token received. ++ * ++ * The "Device IN Token Queue" Registers are read to determine the ++ * order the IN Tokens have been received. The non-periodic Tx FIFO ++ * is flushed, so it can be reloaded in the order seen in the IN Token ++ * Queue. ++ */ ++int32_t dwc_otg_pcd_handle_ep_mismatch_intr(dwc_otg_pcd_t * pcd) ++{ ++ gintsts_data_t gintsts; ++ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); ++ dctl_data_t dctl; ++ gintmsk_data_t intr_mask = {.d32 = 0 }; ++ ++ if (!core_if->en_multiple_tx_fifo && core_if->dma_enable) { ++ core_if->start_predict = 1; ++ ++ DWC_DEBUGPL(DBG_PCDV, "%s(%p)\n", __func__, core_if); ++ ++ gintsts.d32 = DWC_READ_REG32(&core_if->core_global_regs->gintsts); ++ if (!gintsts.b.ginnakeff) { ++ /* Disable EP Mismatch interrupt */ ++ intr_mask.d32 = 0; ++ intr_mask.b.epmismatch = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gintmsk, intr_mask.d32, 0); ++ /* Enable the Global IN NAK Effective Interrupt */ ++ intr_mask.d32 = 0; ++ intr_mask.b.ginnakeff = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gintmsk, 0, intr_mask.d32); ++ /* Set the global non-periodic IN NAK handshake */ ++ dctl.d32 = DWC_READ_REG32(&core_if->dev_if->dev_global_regs->dctl); ++ dctl.b.sgnpinnak = 1; ++ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->dctl, dctl.d32); ++ } else { ++ DWC_PRINTF("gintsts.b.ginnakeff = 1! dctl.b.sgnpinnak not set\n"); ++ } ++ /* Disabling of all EP's will be done in dwc_otg_pcd_handle_in_nak_effective() ++ * handler after Global IN NAK Effective interrupt will be asserted */ ++ } ++ /* Clear interrupt */ ++ gintsts.d32 = 0; ++ gintsts.b.epmismatch = 1; ++ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, gintsts.d32); ++ ++ return 1; ++} ++ ++/** ++ * This interrupt is valid only in DMA mode. This interrupt indicates that the ++ * core has stopped fetching data for IN endpoints due to the unavailability of ++ * TxFIFO space or Request Queue space. This interrupt is used by the ++ * application for an endpoint mismatch algorithm. ++ * ++ * @param pcd The PCD ++ */ ++int32_t dwc_otg_pcd_handle_ep_fetsusp_intr(dwc_otg_pcd_t * pcd) ++{ ++ gintsts_data_t gintsts; ++ gintmsk_data_t gintmsk_data; ++ dctl_data_t dctl; ++ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); ++ DWC_DEBUGPL(DBG_PCDV, "%s(%p)\n", __func__, core_if); ++ ++ /* Clear the global non-periodic IN NAK handshake */ ++ dctl.d32 = 0; ++ dctl.b.cgnpinnak = 1; ++ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs->dctl, dctl.d32, dctl.d32); ++ ++ /* Mask GINTSTS.FETSUSP interrupt */ ++ gintmsk_data.d32 = DWC_READ_REG32(&core_if->core_global_regs->gintmsk); ++ gintmsk_data.b.fetsusp = 0; ++ DWC_WRITE_REG32(&core_if->core_global_regs->gintmsk, gintmsk_data.d32); ++ ++ /* Clear interrupt */ ++ gintsts.d32 = 0; ++ gintsts.b.fetsusp = 1; ++ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, gintsts.d32); ++ ++ return 1; ++} ++/** ++ * This funcion stalls EP0. ++ */ ++static inline void ep0_do_stall(dwc_otg_pcd_t * pcd, const int err_val) ++{ ++ dwc_otg_pcd_ep_t *ep0 = &pcd->ep0; ++ usb_device_request_t *ctrl = &pcd->setup_pkt->req; ++ DWC_WARN("req %02x.%02x protocol STALL; err %d\n", ++ ctrl->bmRequestType, ctrl->bRequest, err_val); ++ ++ ep0->dwc_ep.is_in = 1; ++ dwc_otg_ep_set_stall(GET_CORE_IF(pcd), &ep0->dwc_ep); ++ pcd->ep0.stopped = 1; ++ pcd->ep0state = EP0_IDLE; ++ ep0_out_start(GET_CORE_IF(pcd), pcd); ++} ++ ++/** ++ * This functions delegates the setup command to the gadget driver. ++ */ ++static inline void do_gadget_setup(dwc_otg_pcd_t * pcd, ++ usb_device_request_t * ctrl) ++{ ++ int ret = 0; ++ DWC_SPINUNLOCK(pcd->lock); ++ ret = pcd->fops->setup(pcd, (uint8_t *) ctrl); ++ DWC_SPINLOCK(pcd->lock); ++ if (ret < 0) { ++ ep0_do_stall(pcd, ret); ++ } ++ ++ /** @todo This is a g_file_storage gadget driver specific ++ * workaround: a DELAYED_STATUS result from the fsg_setup ++ * routine will result in the gadget queueing a EP0 IN status ++ * phase for a two-stage control transfer. Exactly the same as ++ * a SET_CONFIGURATION/SET_INTERFACE except that this is a class ++ * specific request. Need a generic way to know when the gadget ++ * driver will queue the status phase. Can we assume when we ++ * call the gadget driver setup() function that it will always ++ * queue and require the following flag? Need to look into ++ * this. ++ */ ++ ++ if (ret == 256 + 999) { ++ pcd->request_config = 1; ++ } ++} ++ ++#ifdef DWC_UTE_CFI ++/** ++ * This functions delegates the CFI setup commands to the gadget driver. ++ * This function will return a negative value to indicate a failure. ++ */ ++static inline int cfi_gadget_setup(dwc_otg_pcd_t * pcd, ++ struct cfi_usb_ctrlrequest *ctrl_req) ++{ ++ int ret = 0; ++ ++ if (pcd->fops && pcd->fops->cfi_setup) { ++ DWC_SPINUNLOCK(pcd->lock); ++ ret = pcd->fops->cfi_setup(pcd, ctrl_req); ++ DWC_SPINLOCK(pcd->lock); ++ if (ret < 0) { ++ ep0_do_stall(pcd, ret); ++ return ret; ++ } ++ } ++ ++ return ret; ++} ++#endif ++ ++/** ++ * This function starts the Zero-Length Packet for the IN status phase ++ * of a 2 stage control transfer. ++ */ ++static inline void do_setup_in_status_phase(dwc_otg_pcd_t * pcd) ++{ ++ dwc_otg_pcd_ep_t *ep0 = &pcd->ep0; ++ if (pcd->ep0state == EP0_STALL) { ++ return; ++ } ++ ++ pcd->ep0state = EP0_IN_STATUS_PHASE; ++ ++ /* Prepare for more SETUP Packets */ ++ DWC_DEBUGPL(DBG_PCD, "EP0 IN ZLP\n"); ++ if ((GET_CORE_IF(pcd)->snpsid >= OTG_CORE_REV_3_00a) ++ && (pcd->core_if->dma_desc_enable) ++ && (ep0->dwc_ep.xfer_count < ep0->dwc_ep.total_len)) { ++ DWC_DEBUGPL(DBG_PCDV, ++ "Data terminated wait next packet in out_desc_addr\n"); ++ pcd->backup_buf = phys_to_virt(ep0->dwc_ep.dma_addr); ++ pcd->data_terminated = 1; ++ } ++ ep0->dwc_ep.xfer_len = 0; ++ ep0->dwc_ep.xfer_count = 0; ++ ep0->dwc_ep.is_in = 1; ++ ep0->dwc_ep.dma_addr = pcd->setup_pkt_dma_handle; ++ dwc_otg_ep0_start_transfer(GET_CORE_IF(pcd), &ep0->dwc_ep); ++ ++ /* Prepare for more SETUP Packets */ ++ //ep0_out_start(GET_CORE_IF(pcd), pcd); ++} ++ ++/** ++ * This function starts the Zero-Length Packet for the OUT status phase ++ * of a 2 stage control transfer. ++ */ ++static inline void do_setup_out_status_phase(dwc_otg_pcd_t * pcd) ++{ ++ dwc_otg_pcd_ep_t *ep0 = &pcd->ep0; ++ if (pcd->ep0state == EP0_STALL) { ++ DWC_DEBUGPL(DBG_PCD, "EP0 STALLED\n"); ++ return; ++ } ++ pcd->ep0state = EP0_OUT_STATUS_PHASE; ++ ++ DWC_DEBUGPL(DBG_PCD, "EP0 OUT ZLP\n"); ++ ep0->dwc_ep.xfer_len = 0; ++ ep0->dwc_ep.xfer_count = 0; ++ ep0->dwc_ep.is_in = 0; ++ ep0->dwc_ep.dma_addr = pcd->setup_pkt_dma_handle; ++ dwc_otg_ep0_start_transfer(GET_CORE_IF(pcd), &ep0->dwc_ep); ++ ++ /* Prepare for more SETUP Packets */ ++ if (GET_CORE_IF(pcd)->dma_enable == 0) { ++ ep0_out_start(GET_CORE_IF(pcd), pcd); ++ } ++} ++ ++/** ++ * Clear the EP halt (STALL) and if pending requests start the ++ * transfer. ++ */ ++static inline void pcd_clear_halt(dwc_otg_pcd_t * pcd, dwc_otg_pcd_ep_t * ep) ++{ ++ if (ep->dwc_ep.stall_clear_flag == 0) ++ dwc_otg_ep_clear_stall(GET_CORE_IF(pcd), &ep->dwc_ep); ++ ++ /* Reactive the EP */ ++ dwc_otg_ep_activate(GET_CORE_IF(pcd), &ep->dwc_ep); ++ if (ep->stopped) { ++ ep->stopped = 0; ++ /* If there is a request in the EP queue start it */ ++ ++ /** @todo FIXME: this causes an EP mismatch in DMA mode. ++ * epmismatch not yet implemented. */ ++ ++ /* ++ * Above fixme is solved by implmenting a tasklet to call the ++ * start_next_request(), outside of interrupt context at some ++ * time after the current time, after a clear-halt setup packet. ++ * Still need to implement ep mismatch in the future if a gadget ++ * ever uses more than one endpoint at once ++ */ ++ ep->queue_sof = 1; ++ DWC_TASK_SCHEDULE(pcd->start_xfer_tasklet); ++ } ++ /* Start Control Status Phase */ ++ do_setup_in_status_phase(pcd); ++} ++ ++/** ++ * This function is called when the SET_FEATURE TEST_MODE Setup packet ++ * is sent from the host. The Device Control register is written with ++ * the Test Mode bits set to the specified Test Mode. This is done as ++ * a tasklet so that the "Status" phase of the control transfer ++ * completes before transmitting the TEST packets. ++ * ++ * @todo This has not been tested since the tasklet struct was put ++ * into the PCD struct! ++ * ++ */ ++void do_test_mode(void *data) ++{ ++ dctl_data_t dctl; ++ dwc_otg_pcd_t *pcd = (dwc_otg_pcd_t *) data; ++ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); ++ int test_mode = pcd->test_mode; ++ ++// DWC_WARN("%s() has not been tested since being rewritten!\n", __func__); ++ ++ dctl.d32 = DWC_READ_REG32(&core_if->dev_if->dev_global_regs->dctl); ++ switch (test_mode) { ++ case 1: // TEST_J ++ dctl.b.tstctl = 1; ++ break; ++ ++ case 2: // TEST_K ++ dctl.b.tstctl = 2; ++ break; ++ ++ case 3: // TEST_SE0_NAK ++ dctl.b.tstctl = 3; ++ break; ++ ++ case 4: // TEST_PACKET ++ dctl.b.tstctl = 4; ++ break; ++ ++ case 5: // TEST_FORCE_ENABLE ++ dctl.b.tstctl = 5; ++ break; ++ } ++ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->dctl, dctl.d32); ++} ++ ++/** ++ * This function process the GET_STATUS Setup Commands. ++ */ ++static inline void do_get_status(dwc_otg_pcd_t * pcd) ++{ ++ usb_device_request_t ctrl = pcd->setup_pkt->req; ++ dwc_otg_pcd_ep_t *ep; ++ dwc_otg_pcd_ep_t *ep0 = &pcd->ep0; ++ uint16_t *status = pcd->status_buf; ++ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); ++ ++#ifdef DEBUG_EP0 ++ DWC_DEBUGPL(DBG_PCD, ++ "GET_STATUS %02x.%02x v%04x i%04x l%04x\n", ++ ctrl.bmRequestType, ctrl.bRequest, ++ UGETW(ctrl.wValue), UGETW(ctrl.wIndex), ++ UGETW(ctrl.wLength)); ++#endif ++ ++ switch (UT_GET_RECIPIENT(ctrl.bmRequestType)) { ++ case UT_DEVICE: ++ if(UGETW(ctrl.wIndex) == 0xF000) { /* OTG Status selector */ ++ DWC_PRINTF("wIndex - %d\n", UGETW(ctrl.wIndex)); ++ DWC_PRINTF("OTG VERSION - %d\n", core_if->otg_ver); ++ DWC_PRINTF("OTG CAP - %d, %d\n", ++ core_if->core_params->otg_cap, ++ DWC_OTG_CAP_PARAM_HNP_SRP_CAPABLE); ++ if (core_if->otg_ver == 1 ++ && core_if->core_params->otg_cap == ++ DWC_OTG_CAP_PARAM_HNP_SRP_CAPABLE) { ++ uint8_t *otgsts = (uint8_t*)pcd->status_buf; ++ *otgsts = (core_if->otg_sts & 0x1); ++ pcd->ep0_pending = 1; ++ ep0->dwc_ep.start_xfer_buff = ++ (uint8_t *) otgsts; ++ ep0->dwc_ep.xfer_buff = (uint8_t *) otgsts; ++ ep0->dwc_ep.dma_addr = ++ pcd->status_buf_dma_handle; ++ ep0->dwc_ep.xfer_len = 1; ++ ep0->dwc_ep.xfer_count = 0; ++ ep0->dwc_ep.total_len = ep0->dwc_ep.xfer_len; ++ dwc_otg_ep0_start_transfer(GET_CORE_IF(pcd), ++ &ep0->dwc_ep); ++ return; ++ } else { ++ ep0_do_stall(pcd, -DWC_E_NOT_SUPPORTED); ++ return; ++ } ++ break; ++ } else { ++ *status = 0x1; /* Self powered */ ++ *status |= pcd->remote_wakeup_enable << 1; ++ break; ++ } ++ case UT_INTERFACE: ++ *status = 0; ++ break; ++ ++ case UT_ENDPOINT: ++ ep = get_ep_by_addr(pcd, UGETW(ctrl.wIndex)); ++ if (ep == 0 || UGETW(ctrl.wLength) > 2) { ++ ep0_do_stall(pcd, -DWC_E_NOT_SUPPORTED); ++ return; ++ } ++ /** @todo check for EP stall */ ++ *status = ep->stopped; ++ break; ++ } ++ pcd->ep0_pending = 1; ++ ep0->dwc_ep.start_xfer_buff = (uint8_t *) status; ++ ep0->dwc_ep.xfer_buff = (uint8_t *) status; ++ ep0->dwc_ep.dma_addr = pcd->status_buf_dma_handle; ++ ep0->dwc_ep.xfer_len = 2; ++ ep0->dwc_ep.xfer_count = 0; ++ ep0->dwc_ep.total_len = ep0->dwc_ep.xfer_len; ++ dwc_otg_ep0_start_transfer(GET_CORE_IF(pcd), &ep0->dwc_ep); ++} ++ ++/** ++ * This function process the SET_FEATURE Setup Commands. ++ */ ++static inline void do_set_feature(dwc_otg_pcd_t * pcd) ++{ ++ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); ++ dwc_otg_core_global_regs_t *global_regs = core_if->core_global_regs; ++ usb_device_request_t ctrl = pcd->setup_pkt->req; ++ dwc_otg_pcd_ep_t *ep = 0; ++ int32_t otg_cap_param = core_if->core_params->otg_cap; ++ gotgctl_data_t gotgctl = {.d32 = 0 }; ++ ++ DWC_DEBUGPL(DBG_PCD, "SET_FEATURE:%02x.%02x v%04x i%04x l%04x\n", ++ ctrl.bmRequestType, ctrl.bRequest, ++ UGETW(ctrl.wValue), UGETW(ctrl.wIndex), ++ UGETW(ctrl.wLength)); ++ DWC_DEBUGPL(DBG_PCD, "otg_cap=%d\n", otg_cap_param); ++ ++ switch (UT_GET_RECIPIENT(ctrl.bmRequestType)) { ++ case UT_DEVICE: ++ switch (UGETW(ctrl.wValue)) { ++ case UF_DEVICE_REMOTE_WAKEUP: ++ pcd->remote_wakeup_enable = 1; ++ break; ++ ++ case UF_TEST_MODE: ++ /* Setup the Test Mode tasklet to do the Test ++ * Packet generation after the SETUP Status ++ * phase has completed. */ ++ ++ /** @todo This has not been tested since the ++ * tasklet struct was put into the PCD ++ * struct! */ ++ pcd->test_mode = UGETW(ctrl.wIndex) >> 8; ++ DWC_TASK_SCHEDULE(pcd->test_mode_tasklet); ++ break; ++ ++ case UF_DEVICE_B_HNP_ENABLE: ++ DWC_DEBUGPL(DBG_PCDV, ++ "SET_FEATURE: USB_DEVICE_B_HNP_ENABLE\n"); ++ ++ /* dev may initiate HNP */ ++ if (otg_cap_param == DWC_OTG_CAP_PARAM_HNP_SRP_CAPABLE) { ++ pcd->b_hnp_enable = 1; ++ dwc_otg_pcd_update_otg(pcd, 0); ++ DWC_DEBUGPL(DBG_PCD, "Request B HNP\n"); ++ /**@todo Is the gotgctl.devhnpen cleared ++ * by a USB Reset? */ ++ gotgctl.b.devhnpen = 1; ++ gotgctl.b.hnpreq = 1; ++ DWC_WRITE_REG32(&global_regs->gotgctl, ++ gotgctl.d32); ++ } else { ++ ep0_do_stall(pcd, -DWC_E_NOT_SUPPORTED); ++ return; ++ } ++ break; ++ ++ case UF_DEVICE_A_HNP_SUPPORT: ++ /* RH port supports HNP */ ++ DWC_DEBUGPL(DBG_PCDV, ++ "SET_FEATURE: USB_DEVICE_A_HNP_SUPPORT\n"); ++ if (otg_cap_param == DWC_OTG_CAP_PARAM_HNP_SRP_CAPABLE) { ++ pcd->a_hnp_support = 1; ++ dwc_otg_pcd_update_otg(pcd, 0); ++ } else { ++ ep0_do_stall(pcd, -DWC_E_NOT_SUPPORTED); ++ return; ++ } ++ break; ++ ++ case UF_DEVICE_A_ALT_HNP_SUPPORT: ++ /* other RH port does */ ++ DWC_DEBUGPL(DBG_PCDV, ++ "SET_FEATURE: USB_DEVICE_A_ALT_HNP_SUPPORT\n"); ++ if (otg_cap_param == DWC_OTG_CAP_PARAM_HNP_SRP_CAPABLE) { ++ pcd->a_alt_hnp_support = 1; ++ dwc_otg_pcd_update_otg(pcd, 0); ++ } else { ++ ep0_do_stall(pcd, -DWC_E_NOT_SUPPORTED); ++ return; ++ } ++ break; ++ ++ default: ++ ep0_do_stall(pcd, -DWC_E_NOT_SUPPORTED); ++ return; ++ ++ } ++ do_setup_in_status_phase(pcd); ++ break; ++ ++ case UT_INTERFACE: ++ do_gadget_setup(pcd, &ctrl); ++ break; ++ ++ case UT_ENDPOINT: ++ if (UGETW(ctrl.wValue) == UF_ENDPOINT_HALT) { ++ ep = get_ep_by_addr(pcd, UGETW(ctrl.wIndex)); ++ if (ep == 0) { ++ ep0_do_stall(pcd, -DWC_E_NOT_SUPPORTED); ++ return; ++ } ++ ep->stopped = 1; ++ dwc_otg_ep_set_stall(core_if, &ep->dwc_ep); ++ } ++ do_setup_in_status_phase(pcd); ++ break; ++ } ++} ++ ++/** ++ * This function process the CLEAR_FEATURE Setup Commands. ++ */ ++static inline void do_clear_feature(dwc_otg_pcd_t * pcd) ++{ ++ usb_device_request_t ctrl = pcd->setup_pkt->req; ++ dwc_otg_pcd_ep_t *ep = 0; ++ ++ DWC_DEBUGPL(DBG_PCD, ++ "CLEAR_FEATURE:%02x.%02x v%04x i%04x l%04x\n", ++ ctrl.bmRequestType, ctrl.bRequest, ++ UGETW(ctrl.wValue), UGETW(ctrl.wIndex), ++ UGETW(ctrl.wLength)); ++ ++ switch (UT_GET_RECIPIENT(ctrl.bmRequestType)) { ++ case UT_DEVICE: ++ switch (UGETW(ctrl.wValue)) { ++ case UF_DEVICE_REMOTE_WAKEUP: ++ pcd->remote_wakeup_enable = 0; ++ break; ++ ++ case UF_TEST_MODE: ++ /** @todo Add CLEAR_FEATURE for TEST modes. */ ++ break; ++ ++ default: ++ ep0_do_stall(pcd, -DWC_E_NOT_SUPPORTED); ++ return; ++ } ++ do_setup_in_status_phase(pcd); ++ break; ++ ++ case UT_ENDPOINT: ++ ep = get_ep_by_addr(pcd, UGETW(ctrl.wIndex)); ++ if (ep == 0) { ++ ep0_do_stall(pcd, -DWC_E_NOT_SUPPORTED); ++ return; ++ } ++ ++ pcd_clear_halt(pcd, ep); ++ ++ break; ++ } ++} ++ ++/** ++ * This function process the SET_ADDRESS Setup Commands. ++ */ ++static inline void do_set_address(dwc_otg_pcd_t * pcd) ++{ ++ dwc_otg_dev_if_t *dev_if = GET_CORE_IF(pcd)->dev_if; ++ usb_device_request_t ctrl = pcd->setup_pkt->req; ++ ++ if (ctrl.bmRequestType == UT_DEVICE) { ++ dcfg_data_t dcfg = {.d32 = 0 }; ++ ++#ifdef DEBUG_EP0 ++// DWC_DEBUGPL(DBG_PCDV, "SET_ADDRESS:%d\n", ctrl.wValue); ++#endif ++ dcfg.b.devaddr = UGETW(ctrl.wValue); ++ DWC_MODIFY_REG32(&dev_if->dev_global_regs->dcfg, 0, dcfg.d32); ++ do_setup_in_status_phase(pcd); ++ } ++} ++ ++/** ++ * This function processes SETUP commands. In Linux, the USB Command ++ * processing is done in two places - the first being the PCD and the ++ * second in the Gadget Driver (for example, the File-Backed Storage ++ * Gadget Driver). ++ * ++ * <table> ++ * <tr><td>Command </td><td>Driver </td><td>Description</td></tr> ++ * ++ * <tr><td>GET_STATUS </td><td>PCD </td><td>Command is processed as ++ * defined in chapter 9 of the USB 2.0 Specification chapter 9 ++ * </td></tr> ++ * ++ * <tr><td>CLEAR_FEATURE </td><td>PCD </td><td>The Device and Endpoint ++ * requests are the ENDPOINT_HALT feature is procesed, all others the ++ * interface requests are ignored.</td></tr> ++ * ++ * <tr><td>SET_FEATURE </td><td>PCD </td><td>The Device and Endpoint ++ * requests are processed by the PCD. Interface requests are passed ++ * to the Gadget Driver.</td></tr> ++ * ++ * <tr><td>SET_ADDRESS </td><td>PCD </td><td>Program the DCFG reg, ++ * with device address received </td></tr> ++ * ++ * <tr><td>GET_DESCRIPTOR </td><td>Gadget Driver </td><td>Return the ++ * requested descriptor</td></tr> ++ * ++ * <tr><td>SET_DESCRIPTOR </td><td>Gadget Driver </td><td>Optional - ++ * not implemented by any of the existing Gadget Drivers.</td></tr> ++ * ++ * <tr><td>SET_CONFIGURATION </td><td>Gadget Driver </td><td>Disable ++ * all EPs and enable EPs for new configuration.</td></tr> ++ * ++ * <tr><td>GET_CONFIGURATION </td><td>Gadget Driver </td><td>Return ++ * the current configuration</td></tr> ++ * ++ * <tr><td>SET_INTERFACE </td><td>Gadget Driver </td><td>Disable all ++ * EPs and enable EPs for new configuration.</td></tr> ++ * ++ * <tr><td>GET_INTERFACE </td><td>Gadget Driver </td><td>Return the ++ * current interface.</td></tr> ++ * ++ * <tr><td>SYNC_FRAME </td><td>PCD </td><td>Display debug ++ * message.</td></tr> ++ * </table> ++ * ++ * When the SETUP Phase Done interrupt occurs, the PCD SETUP commands are ++ * processed by pcd_setup. Calling the Function Driver's setup function from ++ * pcd_setup processes the gadget SETUP commands. ++ */ ++static inline void pcd_setup(dwc_otg_pcd_t * pcd) ++{ ++ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); ++ dwc_otg_dev_if_t *dev_if = core_if->dev_if; ++ usb_device_request_t ctrl = pcd->setup_pkt->req; ++ dwc_otg_pcd_ep_t *ep0 = &pcd->ep0; ++ ++ deptsiz0_data_t doeptsize0 = {.d32 = 0 }; ++ ++#ifdef DWC_UTE_CFI ++ int retval = 0; ++ struct cfi_usb_ctrlrequest cfi_req; ++#endif ++ ++ doeptsize0.d32 = DWC_READ_REG32(&dev_if->out_ep_regs[0]->doeptsiz); ++ ++ /** In BDMA more then 1 setup packet is not supported till 3.00a */ ++ if (core_if->dma_enable && core_if->dma_desc_enable == 0 ++ && (doeptsize0.b.supcnt < 2) ++ && (core_if->snpsid < OTG_CORE_REV_2_94a)) { ++ DWC_ERROR ++ ("\n\n----------- CANNOT handle > 1 setup packet in DMA mode\n\n"); ++ } ++ if ((core_if->snpsid >= OTG_CORE_REV_3_00a) ++ && (core_if->dma_enable == 1) && (core_if->dma_desc_enable == 0)) { ++ ctrl = ++ (pcd->setup_pkt + ++ (3 - doeptsize0.b.supcnt - 1 + ++ ep0->dwc_ep.stp_rollover))->req; ++ } ++#ifdef DEBUG_EP0 ++ DWC_DEBUGPL(DBG_PCD, "SETUP %02x.%02x v%04x i%04x l%04x\n", ++ ctrl.bmRequestType, ctrl.bRequest, ++ UGETW(ctrl.wValue), UGETW(ctrl.wIndex), ++ UGETW(ctrl.wLength)); ++#endif ++ ++ /* Clean up the request queue */ ++ dwc_otg_request_nuke(ep0); ++ ep0->stopped = 0; ++ ++ if (ctrl.bmRequestType & UE_DIR_IN) { ++ ep0->dwc_ep.is_in = 1; ++ pcd->ep0state = EP0_IN_DATA_PHASE; ++ } else { ++ ep0->dwc_ep.is_in = 0; ++ pcd->ep0state = EP0_OUT_DATA_PHASE; ++ } ++ ++ if (UGETW(ctrl.wLength) == 0) { ++ ep0->dwc_ep.is_in = 1; ++ pcd->ep0state = EP0_IN_STATUS_PHASE; ++ } ++ ++ if (UT_GET_TYPE(ctrl.bmRequestType) != UT_STANDARD) { ++ ++#ifdef DWC_UTE_CFI ++ DWC_MEMCPY(&cfi_req, &ctrl, sizeof(usb_device_request_t)); ++ ++ //printk(KERN_ALERT "CFI: req_type=0x%02x; req=0x%02x\n", ++ ctrl.bRequestType, ctrl.bRequest); ++ if (UT_GET_TYPE(cfi_req.bRequestType) == UT_VENDOR) { ++ if (cfi_req.bRequest > 0xB0 && cfi_req.bRequest < 0xBF) { ++ retval = cfi_setup(pcd, &cfi_req); ++ if (retval < 0) { ++ ep0_do_stall(pcd, retval); ++ pcd->ep0_pending = 0; ++ return; ++ } ++ ++ /* if need gadget setup then call it and check the retval */ ++ if (pcd->cfi->need_gadget_att) { ++ retval = ++ cfi_gadget_setup(pcd, ++ &pcd-> ++ cfi->ctrl_req); ++ if (retval < 0) { ++ pcd->ep0_pending = 0; ++ return; ++ } ++ } ++ ++ if (pcd->cfi->need_status_in_complete) { ++ do_setup_in_status_phase(pcd); ++ } ++ return; ++ } ++ } ++#endif ++ ++ /* handle non-standard (class/vendor) requests in the gadget driver */ ++ do_gadget_setup(pcd, &ctrl); ++ return; ++ } ++ ++ /** @todo NGS: Handle bad setup packet? */ ++ ++/////////////////////////////////////////// ++//// --- Standard Request handling --- //// ++ ++ switch (ctrl.bRequest) { ++ case UR_GET_STATUS: ++ do_get_status(pcd); ++ break; ++ ++ case UR_CLEAR_FEATURE: ++ do_clear_feature(pcd); ++ break; ++ ++ case UR_SET_FEATURE: ++ do_set_feature(pcd); ++ break; ++ ++ case UR_SET_ADDRESS: ++ do_set_address(pcd); ++ break; ++ ++ case UR_SET_INTERFACE: ++ case UR_SET_CONFIG: ++// _pcd->request_config = 1; /* Configuration changed */ ++ do_gadget_setup(pcd, &ctrl); ++ break; ++ ++ case UR_SYNCH_FRAME: ++ do_gadget_setup(pcd, &ctrl); ++ break; ++ ++ default: ++ /* Call the Gadget Driver's setup functions */ ++ do_gadget_setup(pcd, &ctrl); ++ break; ++ } ++} ++ ++/** ++ * This function completes the ep0 control transfer. ++ */ ++static int32_t ep0_complete_request(dwc_otg_pcd_ep_t * ep) ++{ ++ dwc_otg_core_if_t *core_if = GET_CORE_IF(ep->pcd); ++ dwc_otg_dev_if_t *dev_if = core_if->dev_if; ++ dwc_otg_dev_in_ep_regs_t *in_ep_regs = ++ dev_if->in_ep_regs[ep->dwc_ep.num]; ++#ifdef DEBUG_EP0 ++ dwc_otg_dev_out_ep_regs_t *out_ep_regs = ++ dev_if->out_ep_regs[ep->dwc_ep.num]; ++#endif ++ deptsiz0_data_t deptsiz; ++ dev_dma_desc_sts_t desc_sts; ++ dwc_otg_pcd_request_t *req; ++ int is_last = 0; ++ dwc_otg_pcd_t *pcd = ep->pcd; ++ ++#ifdef DWC_UTE_CFI ++ struct cfi_usb_ctrlrequest *ctrlreq; ++ int retval = -DWC_E_NOT_SUPPORTED; ++#endif ++ ++ desc_sts.b.bytes = 0; ++ ++ if (pcd->ep0_pending && DWC_CIRCLEQ_EMPTY(&ep->queue)) { ++ if (ep->dwc_ep.is_in) { ++#ifdef DEBUG_EP0 ++ DWC_DEBUGPL(DBG_PCDV, "Do setup OUT status phase\n"); ++#endif ++ do_setup_out_status_phase(pcd); ++ } else { ++#ifdef DEBUG_EP0 ++ DWC_DEBUGPL(DBG_PCDV, "Do setup IN status phase\n"); ++#endif ++ ++#ifdef DWC_UTE_CFI ++ ctrlreq = &pcd->cfi->ctrl_req; ++ ++ if (UT_GET_TYPE(ctrlreq->bRequestType) == UT_VENDOR) { ++ if (ctrlreq->bRequest > 0xB0 ++ && ctrlreq->bRequest < 0xBF) { ++ ++ /* Return if the PCD failed to handle the request */ ++ if ((retval = ++ pcd->cfi->ops. ++ ctrl_write_complete(pcd->cfi, ++ pcd)) < 0) { ++ CFI_INFO ++ ("ERROR setting a new value in the PCD(%d)\n", ++ retval); ++ ep0_do_stall(pcd, retval); ++ pcd->ep0_pending = 0; ++ return 0; ++ } ++ ++ /* If the gadget needs to be notified on the request */ ++ if (pcd->cfi->need_gadget_att == 1) { ++ //retval = do_gadget_setup(pcd, &pcd->cfi->ctrl_req); ++ retval = ++ cfi_gadget_setup(pcd, ++ &pcd->cfi-> ++ ctrl_req); ++ ++ /* Return from the function if the gadget failed to process ++ * the request properly - this should never happen !!! ++ */ ++ if (retval < 0) { ++ CFI_INFO ++ ("ERROR setting a new value in the gadget(%d)\n", ++ retval); ++ pcd->ep0_pending = 0; ++ return 0; ++ } ++ } ++ ++ CFI_INFO("%s: RETVAL=%d\n", __func__, ++ retval); ++ /* If we hit here then the PCD and the gadget has properly ++ * handled the request - so send the ZLP IN to the host. ++ */ ++ /* @todo: MAS - decide whether we need to start the setup ++ * stage based on the need_setup value of the cfi object ++ */ ++ do_setup_in_status_phase(pcd); ++ pcd->ep0_pending = 0; ++ return 1; ++ } ++ } ++#endif ++ ++ do_setup_in_status_phase(pcd); ++ } ++ pcd->ep0_pending = 0; ++ return 1; ++ } ++ ++ if (DWC_CIRCLEQ_EMPTY(&ep->queue)) { ++ return 0; ++ } ++ req = DWC_CIRCLEQ_FIRST(&ep->queue); ++ ++ if (pcd->ep0state == EP0_OUT_STATUS_PHASE ++ || pcd->ep0state == EP0_IN_STATUS_PHASE) { ++ is_last = 1; ++ } else if (ep->dwc_ep.is_in) { ++ deptsiz.d32 = DWC_READ_REG32(&in_ep_regs->dieptsiz); ++ if (core_if->dma_desc_enable != 0) ++ desc_sts = dev_if->in_desc_addr->status; ++#ifdef DEBUG_EP0 ++ DWC_DEBUGPL(DBG_PCDV, "%d len=%d xfersize=%d pktcnt=%d\n", ++ ep->dwc_ep.num, ep->dwc_ep.xfer_len, ++ deptsiz.b.xfersize, deptsiz.b.pktcnt); ++#endif ++ ++ if (((core_if->dma_desc_enable == 0) ++ && (deptsiz.b.xfersize == 0)) ++ || ((core_if->dma_desc_enable != 0) ++ && (desc_sts.b.bytes == 0))) { ++ req->actual = ep->dwc_ep.xfer_count; ++ /* Is a Zero Len Packet needed? */ ++ if (req->sent_zlp) { ++#ifdef DEBUG_EP0 ++ DWC_DEBUGPL(DBG_PCD, "Setup Rx ZLP\n"); ++#endif ++ req->sent_zlp = 0; ++ } ++ do_setup_out_status_phase(pcd); ++ } ++ } else { ++ /* ep0-OUT */ ++#ifdef DEBUG_EP0 ++ deptsiz.d32 = DWC_READ_REG32(&out_ep_regs->doeptsiz); ++ DWC_DEBUGPL(DBG_PCDV, "%d len=%d xsize=%d pktcnt=%d\n", ++ ep->dwc_ep.num, ep->dwc_ep.xfer_len, ++ deptsiz.b.xfersize, deptsiz.b.pktcnt); ++#endif ++ req->actual = ep->dwc_ep.xfer_count; ++ ++ /* Is a Zero Len Packet needed? */ ++ if (req->sent_zlp) { ++#ifdef DEBUG_EP0 ++ DWC_DEBUGPL(DBG_PCDV, "Setup Tx ZLP\n"); ++#endif ++ req->sent_zlp = 0; ++ } ++ /* For older cores do setup in status phase in Slave/BDMA modes, ++ * starting from 3.00 do that only in slave, and for DMA modes ++ * just re-enable ep 0 OUT here*/ ++ if (core_if->dma_enable == 0 ++ || (core_if->dma_desc_enable == 0 ++ && core_if->snpsid <= OTG_CORE_REV_2_94a)) { ++ do_setup_in_status_phase(pcd); ++ } else if (core_if->snpsid >= OTG_CORE_REV_3_00a) { ++ DWC_DEBUGPL(DBG_PCDV, ++ "Enable out ep before in status phase\n"); ++ ep0_out_start(core_if, pcd); ++ } ++ } ++ ++ /* Complete the request */ ++ if (is_last) { ++ dwc_otg_request_done(ep, req, 0); ++ ep->dwc_ep.start_xfer_buff = 0; ++ ep->dwc_ep.xfer_buff = 0; ++ ep->dwc_ep.xfer_len = 0; ++ return 1; ++ } ++ return 0; ++} ++ ++#ifdef DWC_UTE_CFI ++/** ++ * This function calculates traverses all the CFI DMA descriptors and ++ * and accumulates the bytes that are left to be transfered. ++ * ++ * @return The total bytes left to transfered, or a negative value as failure ++ */ ++static inline int cfi_calc_desc_residue(dwc_otg_pcd_ep_t * ep) ++{ ++ int32_t ret = 0; ++ int i; ++ struct dwc_otg_dma_desc *ddesc = NULL; ++ struct cfi_ep *cfiep; ++ ++ /* See if the pcd_ep has its respective cfi_ep mapped */ ++ cfiep = get_cfi_ep_by_pcd_ep(ep->pcd->cfi, ep); ++ if (!cfiep) { ++ CFI_INFO("%s: Failed to find ep\n", __func__); ++ return -1; ++ } ++ ++ ddesc = ep->dwc_ep.descs; ++ ++ for (i = 0; (i < cfiep->desc_count) && (i < MAX_DMA_DESCS_PER_EP); i++) { ++ ++#if defined(PRINT_CFI_DMA_DESCS) ++ print_desc(ddesc, ep->ep.name, i); ++#endif ++ ret += ddesc->status.b.bytes; ++ ddesc++; ++ } ++ ++ if (ret) ++ CFI_INFO("!!!!!!!!!! WARNING (%s) - residue=%d\n", __func__, ++ ret); ++ ++ return ret; ++} ++#endif ++ ++/** ++ * This function completes the request for the EP. If there are ++ * additional requests for the EP in the queue they will be started. ++ */ ++static void complete_ep(dwc_otg_pcd_ep_t * ep) ++{ ++ dwc_otg_core_if_t *core_if = GET_CORE_IF(ep->pcd); ++ dwc_otg_dev_if_t *dev_if = core_if->dev_if; ++ dwc_otg_dev_in_ep_regs_t *in_ep_regs = ++ dev_if->in_ep_regs[ep->dwc_ep.num]; ++ deptsiz_data_t deptsiz; ++ dev_dma_desc_sts_t desc_sts; ++ dwc_otg_pcd_request_t *req = 0; ++ dwc_otg_dev_dma_desc_t *dma_desc; ++ uint32_t byte_count = 0; ++ int is_last = 0; ++ int i; ++ ++ DWC_DEBUGPL(DBG_PCDV, "%s() %d-%s\n", __func__, ep->dwc_ep.num, ++ (ep->dwc_ep.is_in ? "IN" : "OUT")); ++ ++ /* Get any pending requests */ ++ if (!DWC_CIRCLEQ_EMPTY(&ep->queue)) { ++ req = DWC_CIRCLEQ_FIRST(&ep->queue); ++ if (!req) { ++ DWC_PRINTF("complete_ep 0x%p, req = NULL!\n", ep); ++ return; ++ } ++ } else { ++ DWC_PRINTF("complete_ep 0x%p, ep->queue empty!\n", ep); ++ return; ++ } ++ ++ DWC_DEBUGPL(DBG_PCD, "Requests %d\n", ep->pcd->request_pending); ++ ++ if (ep->dwc_ep.is_in) { ++ deptsiz.d32 = DWC_READ_REG32(&in_ep_regs->dieptsiz); ++ ++ if (core_if->dma_enable) { ++ if (core_if->dma_desc_enable == 0) { ++ if (deptsiz.b.xfersize == 0 ++ && deptsiz.b.pktcnt == 0) { ++ byte_count = ++ ep->dwc_ep.xfer_len - ++ ep->dwc_ep.xfer_count; ++ ++ ep->dwc_ep.xfer_buff += byte_count; ++ ep->dwc_ep.dma_addr += byte_count; ++ ep->dwc_ep.xfer_count += byte_count; ++ ++ DWC_DEBUGPL(DBG_PCDV, ++ "%d-%s len=%d xfersize=%d pktcnt=%d\n", ++ ep->dwc_ep.num, ++ (ep->dwc_ep. ++ is_in ? "IN" : "OUT"), ++ ep->dwc_ep.xfer_len, ++ deptsiz.b.xfersize, ++ deptsiz.b.pktcnt); ++ ++ if (ep->dwc_ep.xfer_len < ++ ep->dwc_ep.total_len) { ++ dwc_otg_ep_start_transfer ++ (core_if, &ep->dwc_ep); ++ } else if (ep->dwc_ep.sent_zlp) { ++ /* ++ * This fragment of code should initiate 0 ++ * length transfer in case if it is queued ++ * a transfer with size divisible to EPs max ++ * packet size and with usb_request zero field ++ * is set, which means that after data is transfered, ++ * it is also should be transfered ++ * a 0 length packet at the end. For Slave and ++ * Buffer DMA modes in this case SW has ++ * to initiate 2 transfers one with transfer size, ++ * and the second with 0 size. For Descriptor ++ * DMA mode SW is able to initiate a transfer, ++ * which will handle all the packets including ++ * the last 0 length. ++ */ ++ ep->dwc_ep.sent_zlp = 0; ++ dwc_otg_ep_start_zl_transfer ++ (core_if, &ep->dwc_ep); ++ } else { ++ is_last = 1; ++ } ++ } else { ++ if (ep->dwc_ep.type == ++ DWC_OTG_EP_TYPE_ISOC) { ++ req->actual = 0; ++ dwc_otg_request_done(ep, req, 0); ++ ++ ep->dwc_ep.start_xfer_buff = 0; ++ ep->dwc_ep.xfer_buff = 0; ++ ep->dwc_ep.xfer_len = 0; ++ ++ /* If there is a request in the queue start it. */ ++ start_next_request(ep); ++ } else ++ DWC_WARN ++ ("Incomplete transfer (%d - %s [siz=%d pkt=%d])\n", ++ ep->dwc_ep.num, ++ (ep->dwc_ep.is_in ? "IN" : "OUT"), ++ deptsiz.b.xfersize, ++ deptsiz.b.pktcnt); ++ } ++ } else { ++ dma_desc = ep->dwc_ep.desc_addr; ++ byte_count = 0; ++ ep->dwc_ep.sent_zlp = 0; ++ ++#ifdef DWC_UTE_CFI ++ CFI_INFO("%s: BUFFER_MODE=%d\n", __func__, ++ ep->dwc_ep.buff_mode); ++ if (ep->dwc_ep.buff_mode != BM_STANDARD) { ++ int residue; ++ ++ residue = cfi_calc_desc_residue(ep); ++ if (residue < 0) ++ return; ++ ++ byte_count = residue; ++ } else { ++#endif ++ for (i = 0; i < ep->dwc_ep.desc_cnt; ++ ++i) { ++ desc_sts = dma_desc->status; ++ byte_count += desc_sts.b.bytes; ++ dma_desc++; ++ } ++#ifdef DWC_UTE_CFI ++ } ++#endif ++ if (byte_count == 0) { ++ ep->dwc_ep.xfer_count = ++ ep->dwc_ep.total_len; ++ is_last = 1; ++ } else { ++ DWC_WARN("Incomplete transfer\n"); ++ } ++ } ++ } else { ++ if (deptsiz.b.xfersize == 0 && deptsiz.b.pktcnt == 0) { ++ DWC_DEBUGPL(DBG_PCDV, ++ "%d-%s len=%d xfersize=%d pktcnt=%d\n", ++ ep->dwc_ep.num, ++ ep->dwc_ep.is_in ? "IN" : "OUT", ++ ep->dwc_ep.xfer_len, ++ deptsiz.b.xfersize, ++ deptsiz.b.pktcnt); ++ ++ /* Check if the whole transfer was completed, ++ * if no, setup transfer for next portion of data ++ */ ++ if (ep->dwc_ep.xfer_len < ep->dwc_ep.total_len) { ++ dwc_otg_ep_start_transfer(core_if, ++ &ep->dwc_ep); ++ } else if (ep->dwc_ep.sent_zlp) { ++ /* ++ * This fragment of code should initiate 0 ++ * length trasfer in case if it is queued ++ * a trasfer with size divisible to EPs max ++ * packet size and with usb_request zero field ++ * is set, which means that after data is transfered, ++ * it is also should be transfered ++ * a 0 length packet at the end. For Slave and ++ * Buffer DMA modes in this case SW has ++ * to initiate 2 transfers one with transfer size, ++ * and the second with 0 size. For Desriptor ++ * DMA mode SW is able to initiate a transfer, ++ * which will handle all the packets including ++ * the last 0 legth. ++ */ ++ ep->dwc_ep.sent_zlp = 0; ++ dwc_otg_ep_start_zl_transfer(core_if, ++ &ep->dwc_ep); ++ } else { ++ is_last = 1; ++ } ++ } else { ++ DWC_WARN ++ ("Incomplete transfer (%d-%s [siz=%d pkt=%d])\n", ++ ep->dwc_ep.num, ++ (ep->dwc_ep.is_in ? "IN" : "OUT"), ++ deptsiz.b.xfersize, deptsiz.b.pktcnt); ++ } ++ } ++ } else { ++ dwc_otg_dev_out_ep_regs_t *out_ep_regs = ++ dev_if->out_ep_regs[ep->dwc_ep.num]; ++ desc_sts.d32 = 0; ++ if (core_if->dma_enable) { ++ if (core_if->dma_desc_enable) { ++ dma_desc = ep->dwc_ep.desc_addr; ++ byte_count = 0; ++ ep->dwc_ep.sent_zlp = 0; ++ ++#ifdef DWC_UTE_CFI ++ CFI_INFO("%s: BUFFER_MODE=%d\n", __func__, ++ ep->dwc_ep.buff_mode); ++ if (ep->dwc_ep.buff_mode != BM_STANDARD) { ++ int residue; ++ residue = cfi_calc_desc_residue(ep); ++ if (residue < 0) ++ return; ++ byte_count = residue; ++ } else { ++#endif ++ ++ for (i = 0; i < ep->dwc_ep.desc_cnt; ++ ++i) { ++ desc_sts = dma_desc->status; ++ byte_count += desc_sts.b.bytes; ++ dma_desc++; ++ } ++ ++#ifdef DWC_UTE_CFI ++ } ++#endif ++ /* Checking for interrupt Out transfers with not ++ * dword aligned mps sizes ++ */ ++ if (ep->dwc_ep.type == DWC_OTG_EP_TYPE_INTR && ++ (ep->dwc_ep.maxpacket%4)) { ++ ep->dwc_ep.xfer_count = ++ ep->dwc_ep.total_len - byte_count; ++ if ((ep->dwc_ep.xfer_len % ++ ep->dwc_ep.maxpacket) ++ && (ep->dwc_ep.xfer_len / ++ ep->dwc_ep.maxpacket < ++ MAX_DMA_DESC_CNT)) ++ ep->dwc_ep.xfer_len -= ++ (ep->dwc_ep.desc_cnt - ++ 1) * ep->dwc_ep.maxpacket + ++ ep->dwc_ep.xfer_len % ++ ep->dwc_ep.maxpacket; ++ else ++ ep->dwc_ep.xfer_len -= ++ ep->dwc_ep.desc_cnt * ++ ep->dwc_ep.maxpacket; ++ if (ep->dwc_ep.xfer_len > 0) { ++ dwc_otg_ep_start_transfer ++ (core_if, &ep->dwc_ep); ++ } else { ++ is_last = 1; ++ } ++ } else { ++ ep->dwc_ep.xfer_count = ++ ep->dwc_ep.total_len - byte_count + ++ ((4 - ++ (ep->dwc_ep. ++ total_len & 0x3)) & 0x3); ++ is_last = 1; ++ } ++ } else { ++ deptsiz.d32 = 0; ++ deptsiz.d32 = ++ DWC_READ_REG32(&out_ep_regs->doeptsiz); ++ ++ byte_count = (ep->dwc_ep.xfer_len - ++ ep->dwc_ep.xfer_count - ++ deptsiz.b.xfersize); ++ ep->dwc_ep.xfer_buff += byte_count; ++ ep->dwc_ep.dma_addr += byte_count; ++ ep->dwc_ep.xfer_count += byte_count; ++ ++ /* Check if the whole transfer was completed, ++ * if no, setup transfer for next portion of data ++ */ ++ if (ep->dwc_ep.xfer_len < ep->dwc_ep.total_len) { ++ dwc_otg_ep_start_transfer(core_if, ++ &ep->dwc_ep); ++ } else if (ep->dwc_ep.sent_zlp) { ++ /* ++ * This fragment of code should initiate 0 ++ * length trasfer in case if it is queued ++ * a trasfer with size divisible to EPs max ++ * packet size and with usb_request zero field ++ * is set, which means that after data is transfered, ++ * it is also should be transfered ++ * a 0 length packet at the end. For Slave and ++ * Buffer DMA modes in this case SW has ++ * to initiate 2 transfers one with transfer size, ++ * and the second with 0 size. For Desriptor ++ * DMA mode SW is able to initiate a transfer, ++ * which will handle all the packets including ++ * the last 0 legth. ++ */ ++ ep->dwc_ep.sent_zlp = 0; ++ dwc_otg_ep_start_zl_transfer(core_if, ++ &ep->dwc_ep); ++ } else { ++ is_last = 1; ++ } ++ } ++ } else { ++ /* Check if the whole transfer was completed, ++ * if no, setup transfer for next portion of data ++ */ ++ if (ep->dwc_ep.xfer_len < ep->dwc_ep.total_len) { ++ dwc_otg_ep_start_transfer(core_if, &ep->dwc_ep); ++ } else if (ep->dwc_ep.sent_zlp) { ++ /* ++ * This fragment of code should initiate 0 ++ * length transfer in case if it is queued ++ * a transfer with size divisible to EPs max ++ * packet size and with usb_request zero field ++ * is set, which means that after data is transfered, ++ * it is also should be transfered ++ * a 0 length packet at the end. For Slave and ++ * Buffer DMA modes in this case SW has ++ * to initiate 2 transfers one with transfer size, ++ * and the second with 0 size. For Descriptor ++ * DMA mode SW is able to initiate a transfer, ++ * which will handle all the packets including ++ * the last 0 length. ++ */ ++ ep->dwc_ep.sent_zlp = 0; ++ dwc_otg_ep_start_zl_transfer(core_if, ++ &ep->dwc_ep); ++ } else { ++ is_last = 1; ++ } ++ } ++ ++ DWC_DEBUGPL(DBG_PCDV, ++ "addr %p, %d-%s len=%d cnt=%d xsize=%d pktcnt=%d\n", ++ &out_ep_regs->doeptsiz, ep->dwc_ep.num, ++ ep->dwc_ep.is_in ? "IN" : "OUT", ++ ep->dwc_ep.xfer_len, ep->dwc_ep.xfer_count, ++ deptsiz.b.xfersize, deptsiz.b.pktcnt); ++ } ++ ++ /* Complete the request */ ++ if (is_last) { ++#ifdef DWC_UTE_CFI ++ if (ep->dwc_ep.buff_mode != BM_STANDARD) { ++ req->actual = ep->dwc_ep.cfi_req_len - byte_count; ++ } else { ++#endif ++ req->actual = ep->dwc_ep.xfer_count; ++#ifdef DWC_UTE_CFI ++ } ++#endif ++ if (req->dw_align_buf) { ++ if (!ep->dwc_ep.is_in) { ++ dwc_memcpy(req->buf, req->dw_align_buf, req->length); ++ } ++ DWC_DMA_FREE(req->length, req->dw_align_buf, ++ req->dw_align_buf_dma); ++ } ++ ++ dwc_otg_request_done(ep, req, 0); ++ ++ ep->dwc_ep.start_xfer_buff = 0; ++ ep->dwc_ep.xfer_buff = 0; ++ ep->dwc_ep.xfer_len = 0; ++ ++ /* If there is a request in the queue start it. */ ++ start_next_request(ep); ++ } ++} ++ ++#ifdef DWC_EN_ISOC ++ ++/** ++ * This function BNA interrupt for Isochronous EPs ++ * ++ */ ++static void dwc_otg_pcd_handle_iso_bna(dwc_otg_pcd_ep_t * ep) ++{ ++ dwc_ep_t *dwc_ep = &ep->dwc_ep; ++ volatile uint32_t *addr; ++ depctl_data_t depctl = {.d32 = 0 }; ++ dwc_otg_pcd_t *pcd = ep->pcd; ++ dwc_otg_dev_dma_desc_t *dma_desc; ++ int i; ++ ++ dma_desc = ++ dwc_ep->iso_desc_addr + dwc_ep->desc_cnt * (dwc_ep->proc_buf_num); ++ ++ if (dwc_ep->is_in) { ++ dev_dma_desc_sts_t sts = {.d32 = 0 }; ++ for (i = 0; i < dwc_ep->desc_cnt; ++i, ++dma_desc) { ++ sts.d32 = dma_desc->status.d32; ++ sts.b_iso_in.bs = BS_HOST_READY; ++ dma_desc->status.d32 = sts.d32; ++ } ++ } else { ++ dev_dma_desc_sts_t sts = {.d32 = 0 }; ++ for (i = 0; i < dwc_ep->desc_cnt; ++i, ++dma_desc) { ++ sts.d32 = dma_desc->status.d32; ++ sts.b_iso_out.bs = BS_HOST_READY; ++ dma_desc->status.d32 = sts.d32; ++ } ++ } ++ ++ if (dwc_ep->is_in == 0) { ++ addr = ++ &GET_CORE_IF(pcd)->dev_if->out_ep_regs[dwc_ep-> ++ num]->doepctl; ++ } else { ++ addr = ++ &GET_CORE_IF(pcd)->dev_if->in_ep_regs[dwc_ep->num]->diepctl; ++ } ++ depctl.b.epena = 1; ++ DWC_MODIFY_REG32(addr, depctl.d32, depctl.d32); ++} ++ ++/** ++ * This function sets latest iso packet information(non-PTI mode) ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ * @param ep The EP to start the transfer on. ++ * ++ */ ++void set_current_pkt_info(dwc_otg_core_if_t * core_if, dwc_ep_t * ep) ++{ ++ deptsiz_data_t deptsiz = {.d32 = 0 }; ++ dma_addr_t dma_addr; ++ uint32_t offset; ++ ++ if (ep->proc_buf_num) ++ dma_addr = ep->dma_addr1; ++ else ++ dma_addr = ep->dma_addr0; ++ ++ if (ep->is_in) { ++ deptsiz.d32 = ++ DWC_READ_REG32(&core_if->dev_if-> ++ in_ep_regs[ep->num]->dieptsiz); ++ offset = ep->data_per_frame; ++ } else { ++ deptsiz.d32 = ++ DWC_READ_REG32(&core_if->dev_if-> ++ out_ep_regs[ep->num]->doeptsiz); ++ offset = ++ ep->data_per_frame + ++ (0x4 & (0x4 - (ep->data_per_frame & 0x3))); ++ } ++ ++ if (!deptsiz.b.xfersize) { ++ ep->pkt_info[ep->cur_pkt].length = ep->data_per_frame; ++ ep->pkt_info[ep->cur_pkt].offset = ++ ep->cur_pkt_dma_addr - dma_addr; ++ ep->pkt_info[ep->cur_pkt].status = 0; ++ } else { ++ ep->pkt_info[ep->cur_pkt].length = ep->data_per_frame; ++ ep->pkt_info[ep->cur_pkt].offset = ++ ep->cur_pkt_dma_addr - dma_addr; ++ ep->pkt_info[ep->cur_pkt].status = -DWC_E_NO_DATA; ++ } ++ ep->cur_pkt_addr += offset; ++ ep->cur_pkt_dma_addr += offset; ++ ep->cur_pkt++; ++} ++ ++/** ++ * This function sets latest iso packet information(DDMA mode) ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ * @param dwc_ep The EP to start the transfer on. ++ * ++ */ ++static void set_ddma_iso_pkts_info(dwc_otg_core_if_t * core_if, ++ dwc_ep_t * dwc_ep) ++{ ++ dwc_otg_dev_dma_desc_t *dma_desc; ++ dev_dma_desc_sts_t sts = {.d32 = 0 }; ++ iso_pkt_info_t *iso_packet; ++ uint32_t data_per_desc; ++ uint32_t offset; ++ int i, j; ++ ++ iso_packet = dwc_ep->pkt_info; ++ ++ /** Reinit closed DMA Descriptors*/ ++ /** ISO OUT EP */ ++ if (dwc_ep->is_in == 0) { ++ dma_desc = ++ dwc_ep->iso_desc_addr + ++ dwc_ep->desc_cnt * dwc_ep->proc_buf_num; ++ offset = 0; ++ ++ for (i = 0; i < dwc_ep->desc_cnt - dwc_ep->pkt_per_frm; ++ i += dwc_ep->pkt_per_frm) { ++ for (j = 0; j < dwc_ep->pkt_per_frm; ++j) { ++ data_per_desc = ++ ((j + 1) * dwc_ep->maxpacket > ++ dwc_ep-> ++ data_per_frame) ? dwc_ep->data_per_frame - ++ j * dwc_ep->maxpacket : dwc_ep->maxpacket; ++ data_per_desc += ++ (data_per_desc % 4) ? (4 - ++ data_per_desc % ++ 4) : 0; ++ ++ sts.d32 = dma_desc->status.d32; ++ ++ /* Write status in iso_packet_decsriptor */ ++ iso_packet->status = ++ sts.b_iso_out.rxsts + ++ (sts.b_iso_out.bs ^ BS_DMA_DONE); ++ if (iso_packet->status) { ++ iso_packet->status = -DWC_E_NO_DATA; ++ } ++ ++ /* Received data length */ ++ if (!sts.b_iso_out.rxbytes) { ++ iso_packet->length = ++ data_per_desc - ++ sts.b_iso_out.rxbytes; ++ } else { ++ iso_packet->length = ++ data_per_desc - ++ sts.b_iso_out.rxbytes + (4 - ++ dwc_ep->data_per_frame ++ % 4); ++ } ++ ++ iso_packet->offset = offset; ++ ++ offset += data_per_desc; ++ dma_desc++; ++ iso_packet++; ++ } ++ } ++ ++ for (j = 0; j < dwc_ep->pkt_per_frm - 1; ++j) { ++ data_per_desc = ++ ((j + 1) * dwc_ep->maxpacket > ++ dwc_ep->data_per_frame) ? dwc_ep->data_per_frame - ++ j * dwc_ep->maxpacket : dwc_ep->maxpacket; ++ data_per_desc += ++ (data_per_desc % 4) ? (4 - data_per_desc % 4) : 0; ++ ++ sts.d32 = dma_desc->status.d32; ++ ++ /* Write status in iso_packet_decsriptor */ ++ iso_packet->status = ++ sts.b_iso_out.rxsts + ++ (sts.b_iso_out.bs ^ BS_DMA_DONE); ++ if (iso_packet->status) { ++ iso_packet->status = -DWC_E_NO_DATA; ++ } ++ ++ /* Received data length */ ++ iso_packet->length = ++ dwc_ep->data_per_frame - sts.b_iso_out.rxbytes; ++ ++ iso_packet->offset = offset; ++ ++ offset += data_per_desc; ++ iso_packet++; ++ dma_desc++; ++ } ++ ++ sts.d32 = dma_desc->status.d32; ++ ++ /* Write status in iso_packet_decsriptor */ ++ iso_packet->status = ++ sts.b_iso_out.rxsts + (sts.b_iso_out.bs ^ BS_DMA_DONE); ++ if (iso_packet->status) { ++ iso_packet->status = -DWC_E_NO_DATA; ++ } ++ /* Received data length */ ++ if (!sts.b_iso_out.rxbytes) { ++ iso_packet->length = ++ dwc_ep->data_per_frame - sts.b_iso_out.rxbytes; ++ } else { ++ iso_packet->length = ++ dwc_ep->data_per_frame - sts.b_iso_out.rxbytes + ++ (4 - dwc_ep->data_per_frame % 4); ++ } ++ ++ iso_packet->offset = offset; ++ } else { ++/** ISO IN EP */ ++ ++ dma_desc = ++ dwc_ep->iso_desc_addr + ++ dwc_ep->desc_cnt * dwc_ep->proc_buf_num; ++ ++ for (i = 0; i < dwc_ep->desc_cnt - 1; i++) { ++ sts.d32 = dma_desc->status.d32; ++ ++ /* Write status in iso packet descriptor */ ++ iso_packet->status = ++ sts.b_iso_in.txsts + ++ (sts.b_iso_in.bs ^ BS_DMA_DONE); ++ if (iso_packet->status != 0) { ++ iso_packet->status = -DWC_E_NO_DATA; ++ ++ } ++ /* Bytes has been transfered */ ++ iso_packet->length = ++ dwc_ep->data_per_frame - sts.b_iso_in.txbytes; ++ ++ dma_desc++; ++ iso_packet++; ++ } ++ ++ sts.d32 = dma_desc->status.d32; ++ while (sts.b_iso_in.bs == BS_DMA_BUSY) { ++ sts.d32 = dma_desc->status.d32; ++ } ++ ++ /* Write status in iso packet descriptor ??? do be done with ERROR codes */ ++ iso_packet->status = ++ sts.b_iso_in.txsts + (sts.b_iso_in.bs ^ BS_DMA_DONE); ++ if (iso_packet->status != 0) { ++ iso_packet->status = -DWC_E_NO_DATA; ++ } ++ ++ /* Bytes has been transfered */ ++ iso_packet->length = ++ dwc_ep->data_per_frame - sts.b_iso_in.txbytes; ++ } ++} ++ ++/** ++ * This function reinitialize DMA Descriptors for Isochronous transfer ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ * @param dwc_ep The EP to start the transfer on. ++ * ++ */ ++static void reinit_ddma_iso_xfer(dwc_otg_core_if_t * core_if, dwc_ep_t * dwc_ep) ++{ ++ int i, j; ++ dwc_otg_dev_dma_desc_t *dma_desc; ++ dma_addr_t dma_ad; ++ volatile uint32_t *addr; ++ dev_dma_desc_sts_t sts = {.d32 = 0 }; ++ uint32_t data_per_desc; ++ ++ if (dwc_ep->is_in == 0) { ++ addr = &core_if->dev_if->out_ep_regs[dwc_ep->num]->doepctl; ++ } else { ++ addr = &core_if->dev_if->in_ep_regs[dwc_ep->num]->diepctl; ++ } ++ ++ if (dwc_ep->proc_buf_num == 0) { ++ /** Buffer 0 descriptors setup */ ++ dma_ad = dwc_ep->dma_addr0; ++ } else { ++ /** Buffer 1 descriptors setup */ ++ dma_ad = dwc_ep->dma_addr1; ++ } ++ ++ /** Reinit closed DMA Descriptors*/ ++ /** ISO OUT EP */ ++ if (dwc_ep->is_in == 0) { ++ dma_desc = ++ dwc_ep->iso_desc_addr + ++ dwc_ep->desc_cnt * dwc_ep->proc_buf_num; ++ ++ sts.b_iso_out.bs = BS_HOST_READY; ++ sts.b_iso_out.rxsts = 0; ++ sts.b_iso_out.l = 0; ++ sts.b_iso_out.sp = 0; ++ sts.b_iso_out.ioc = 0; ++ sts.b_iso_out.pid = 0; ++ sts.b_iso_out.framenum = 0; ++ ++ for (i = 0; i < dwc_ep->desc_cnt - dwc_ep->pkt_per_frm; ++ i += dwc_ep->pkt_per_frm) { ++ for (j = 0; j < dwc_ep->pkt_per_frm; ++j) { ++ data_per_desc = ++ ((j + 1) * dwc_ep->maxpacket > ++ dwc_ep-> ++ data_per_frame) ? dwc_ep->data_per_frame - ++ j * dwc_ep->maxpacket : dwc_ep->maxpacket; ++ data_per_desc += ++ (data_per_desc % 4) ? (4 - ++ data_per_desc % ++ 4) : 0; ++ sts.b_iso_out.rxbytes = data_per_desc; ++ dma_desc->buf = dma_ad; ++ dma_desc->status.d32 = sts.d32; ++ ++ dma_ad += data_per_desc; ++ dma_desc++; ++ } ++ } ++ ++ for (j = 0; j < dwc_ep->pkt_per_frm - 1; ++j) { ++ ++ data_per_desc = ++ ((j + 1) * dwc_ep->maxpacket > ++ dwc_ep->data_per_frame) ? dwc_ep->data_per_frame - ++ j * dwc_ep->maxpacket : dwc_ep->maxpacket; ++ data_per_desc += ++ (data_per_desc % 4) ? (4 - data_per_desc % 4) : 0; ++ sts.b_iso_out.rxbytes = data_per_desc; ++ ++ dma_desc->buf = dma_ad; ++ dma_desc->status.d32 = sts.d32; ++ ++ dma_desc++; ++ dma_ad += data_per_desc; ++ } ++ ++ sts.b_iso_out.ioc = 1; ++ sts.b_iso_out.l = dwc_ep->proc_buf_num; ++ ++ data_per_desc = ++ ((j + 1) * dwc_ep->maxpacket > ++ dwc_ep->data_per_frame) ? dwc_ep->data_per_frame - ++ j * dwc_ep->maxpacket : dwc_ep->maxpacket; ++ data_per_desc += ++ (data_per_desc % 4) ? (4 - data_per_desc % 4) : 0; ++ sts.b_iso_out.rxbytes = data_per_desc; ++ ++ dma_desc->buf = dma_ad; ++ dma_desc->status.d32 = sts.d32; ++ } else { ++/** ISO IN EP */ ++ ++ dma_desc = ++ dwc_ep->iso_desc_addr + ++ dwc_ep->desc_cnt * dwc_ep->proc_buf_num; ++ ++ sts.b_iso_in.bs = BS_HOST_READY; ++ sts.b_iso_in.txsts = 0; ++ sts.b_iso_in.sp = 0; ++ sts.b_iso_in.ioc = 0; ++ sts.b_iso_in.pid = dwc_ep->pkt_per_frm; ++ sts.b_iso_in.framenum = dwc_ep->next_frame; ++ sts.b_iso_in.txbytes = dwc_ep->data_per_frame; ++ sts.b_iso_in.l = 0; ++ ++ for (i = 0; i < dwc_ep->desc_cnt - 1; i++) { ++ dma_desc->buf = dma_ad; ++ dma_desc->status.d32 = sts.d32; ++ ++ sts.b_iso_in.framenum += dwc_ep->bInterval; ++ dma_ad += dwc_ep->data_per_frame; ++ dma_desc++; ++ } ++ ++ sts.b_iso_in.ioc = 1; ++ sts.b_iso_in.l = dwc_ep->proc_buf_num; ++ ++ dma_desc->buf = dma_ad; ++ dma_desc->status.d32 = sts.d32; ++ ++ dwc_ep->next_frame = ++ sts.b_iso_in.framenum + dwc_ep->bInterval * 1; ++ } ++ dwc_ep->proc_buf_num = (dwc_ep->proc_buf_num ^ 1) & 0x1; ++} ++ ++/** ++ * This function is to handle Iso EP transfer complete interrupt ++ * in case Iso out packet was dropped ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ * @param dwc_ep The EP for wihich transfer complete was asserted ++ * ++ */ ++static uint32_t handle_iso_out_pkt_dropped(dwc_otg_core_if_t * core_if, ++ dwc_ep_t * dwc_ep) ++{ ++ uint32_t dma_addr; ++ uint32_t drp_pkt; ++ uint32_t drp_pkt_cnt; ++ deptsiz_data_t deptsiz = {.d32 = 0 }; ++ depctl_data_t depctl = {.d32 = 0 }; ++ int i; ++ ++ deptsiz.d32 = ++ DWC_READ_REG32(&core_if->dev_if-> ++ out_ep_regs[dwc_ep->num]->doeptsiz); ++ ++ drp_pkt = dwc_ep->pkt_cnt - deptsiz.b.pktcnt; ++ drp_pkt_cnt = dwc_ep->pkt_per_frm - (drp_pkt % dwc_ep->pkt_per_frm); ++ ++ /* Setting dropped packets status */ ++ for (i = 0; i < drp_pkt_cnt; ++i) { ++ dwc_ep->pkt_info[drp_pkt].status = -DWC_E_NO_DATA; ++ drp_pkt++; ++ deptsiz.b.pktcnt--; ++ } ++ ++ if (deptsiz.b.pktcnt > 0) { ++ deptsiz.b.xfersize = ++ dwc_ep->xfer_len - (dwc_ep->pkt_cnt - ++ deptsiz.b.pktcnt) * dwc_ep->maxpacket; ++ } else { ++ deptsiz.b.xfersize = 0; ++ deptsiz.b.pktcnt = 0; ++ } ++ ++ DWC_WRITE_REG32(&core_if->dev_if->out_ep_regs[dwc_ep->num]->doeptsiz, ++ deptsiz.d32); ++ ++ if (deptsiz.b.pktcnt > 0) { ++ if (dwc_ep->proc_buf_num) { ++ dma_addr = ++ dwc_ep->dma_addr1 + dwc_ep->xfer_len - ++ deptsiz.b.xfersize; ++ } else { ++ dma_addr = ++ dwc_ep->dma_addr0 + dwc_ep->xfer_len - ++ deptsiz.b.xfersize;; ++ } ++ ++ DWC_WRITE_REG32(&core_if->dev_if-> ++ out_ep_regs[dwc_ep->num]->doepdma, dma_addr); ++ ++ /** Re-enable endpoint, clear nak */ ++ depctl.d32 = 0; ++ depctl.b.epena = 1; ++ depctl.b.cnak = 1; ++ ++ DWC_MODIFY_REG32(&core_if->dev_if-> ++ out_ep_regs[dwc_ep->num]->doepctl, depctl.d32, ++ depctl.d32); ++ return 0; ++ } else { ++ return 1; ++ } ++} ++ ++/** ++ * This function sets iso packets information(PTI mode) ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ * @param ep The EP to start the transfer on. ++ * ++ */ ++static uint32_t set_iso_pkts_info(dwc_otg_core_if_t * core_if, dwc_ep_t * ep) ++{ ++ int i, j; ++ dma_addr_t dma_ad; ++ iso_pkt_info_t *packet_info = ep->pkt_info; ++ uint32_t offset; ++ uint32_t frame_data; ++ deptsiz_data_t deptsiz; ++ ++ if (ep->proc_buf_num == 0) { ++ /** Buffer 0 descriptors setup */ ++ dma_ad = ep->dma_addr0; ++ } else { ++ /** Buffer 1 descriptors setup */ ++ dma_ad = ep->dma_addr1; ++ } ++ ++ if (ep->is_in) { ++ deptsiz.d32 = ++ DWC_READ_REG32(&core_if->dev_if->in_ep_regs[ep->num]-> ++ dieptsiz); ++ } else { ++ deptsiz.d32 = ++ DWC_READ_REG32(&core_if->dev_if->out_ep_regs[ep->num]-> ++ doeptsiz); ++ } ++ ++ if (!deptsiz.b.xfersize) { ++ offset = 0; ++ for (i = 0; i < ep->pkt_cnt; i += ep->pkt_per_frm) { ++ frame_data = ep->data_per_frame; ++ for (j = 0; j < ep->pkt_per_frm; ++j) { ++ ++ /* Packet status - is not set as initially ++ * it is set to 0 and if packet was sent ++ successfully, status field will remain 0*/ ++ ++ /* Bytes has been transfered */ ++ packet_info->length = ++ (ep->maxpacket < ++ frame_data) ? ep->maxpacket : frame_data; ++ ++ /* Received packet offset */ ++ packet_info->offset = offset; ++ offset += packet_info->length; ++ frame_data -= packet_info->length; ++ ++ packet_info++; ++ } ++ } ++ return 1; ++ } else { ++ /* This is a workaround for in case of Transfer Complete with ++ * PktDrpSts interrupts merging - in this case Transfer complete ++ * interrupt for Isoc Out Endpoint is asserted without PktDrpSts ++ * set and with DOEPTSIZ register non zero. Investigations showed, ++ * that this happens when Out packet is dropped, but because of ++ * interrupts merging during first interrupt handling PktDrpSts ++ * bit is cleared and for next merged interrupts it is not reset. ++ * In this case SW hadles the interrupt as if PktDrpSts bit is set. ++ */ ++ if (ep->is_in) { ++ return 1; ++ } else { ++ return handle_iso_out_pkt_dropped(core_if, ep); ++ } ++ } ++} ++ ++/** ++ * This function is to handle Iso EP transfer complete interrupt ++ * ++ * @param pcd The PCD ++ * @param ep The EP for which transfer complete was asserted ++ * ++ */ ++static void complete_iso_ep(dwc_otg_pcd_t * pcd, dwc_otg_pcd_ep_t * ep) ++{ ++ dwc_otg_core_if_t *core_if = GET_CORE_IF(ep->pcd); ++ dwc_ep_t *dwc_ep = &ep->dwc_ep; ++ uint8_t is_last = 0; ++ ++ if (ep->dwc_ep.next_frame == 0xffffffff) { ++ DWC_WARN("Next frame is not set!\n"); ++ return; ++ } ++ ++ if (core_if->dma_enable) { ++ if (core_if->dma_desc_enable) { ++ set_ddma_iso_pkts_info(core_if, dwc_ep); ++ reinit_ddma_iso_xfer(core_if, dwc_ep); ++ is_last = 1; ++ } else { ++ if (core_if->pti_enh_enable) { ++ if (set_iso_pkts_info(core_if, dwc_ep)) { ++ dwc_ep->proc_buf_num = ++ (dwc_ep->proc_buf_num ^ 1) & 0x1; ++ dwc_otg_iso_ep_start_buf_transfer ++ (core_if, dwc_ep); ++ is_last = 1; ++ } ++ } else { ++ set_current_pkt_info(core_if, dwc_ep); ++ if (dwc_ep->cur_pkt >= dwc_ep->pkt_cnt) { ++ is_last = 1; ++ dwc_ep->cur_pkt = 0; ++ dwc_ep->proc_buf_num = ++ (dwc_ep->proc_buf_num ^ 1) & 0x1; ++ if (dwc_ep->proc_buf_num) { ++ dwc_ep->cur_pkt_addr = ++ dwc_ep->xfer_buff1; ++ dwc_ep->cur_pkt_dma_addr = ++ dwc_ep->dma_addr1; ++ } else { ++ dwc_ep->cur_pkt_addr = ++ dwc_ep->xfer_buff0; ++ dwc_ep->cur_pkt_dma_addr = ++ dwc_ep->dma_addr0; ++ } ++ ++ } ++ dwc_otg_iso_ep_start_frm_transfer(core_if, ++ dwc_ep); ++ } ++ } ++ } else { ++ set_current_pkt_info(core_if, dwc_ep); ++ if (dwc_ep->cur_pkt >= dwc_ep->pkt_cnt) { ++ is_last = 1; ++ dwc_ep->cur_pkt = 0; ++ dwc_ep->proc_buf_num = (dwc_ep->proc_buf_num ^ 1) & 0x1; ++ if (dwc_ep->proc_buf_num) { ++ dwc_ep->cur_pkt_addr = dwc_ep->xfer_buff1; ++ dwc_ep->cur_pkt_dma_addr = dwc_ep->dma_addr1; ++ } else { ++ dwc_ep->cur_pkt_addr = dwc_ep->xfer_buff0; ++ dwc_ep->cur_pkt_dma_addr = dwc_ep->dma_addr0; ++ } ++ ++ } ++ dwc_otg_iso_ep_start_frm_transfer(core_if, dwc_ep); ++ } ++ if (is_last) ++ dwc_otg_iso_buffer_done(pcd, ep, ep->iso_req_handle); ++} ++#endif /* DWC_EN_ISOC */ ++ ++/** ++ * This function handle BNA interrupt for Non Isochronous EPs ++ * ++ */ ++static void dwc_otg_pcd_handle_noniso_bna(dwc_otg_pcd_ep_t * ep) ++{ ++ dwc_ep_t *dwc_ep = &ep->dwc_ep; ++ volatile uint32_t *addr; ++ depctl_data_t depctl = {.d32 = 0 }; ++ dwc_otg_pcd_t *pcd = ep->pcd; ++ dwc_otg_dev_dma_desc_t *dma_desc; ++ dev_dma_desc_sts_t sts = {.d32 = 0 }; ++ dwc_otg_core_if_t *core_if = ep->pcd->core_if; ++ int i, start; ++ ++ if (!dwc_ep->desc_cnt) ++ DWC_WARN("Ep%d %s Descriptor count = %d \n", dwc_ep->num, ++ (dwc_ep->is_in ? "IN" : "OUT"), dwc_ep->desc_cnt); ++ ++ if (core_if->core_params->cont_on_bna && !dwc_ep->is_in ++ && dwc_ep->type != DWC_OTG_EP_TYPE_CONTROL) { ++ uint32_t doepdma; ++ dwc_otg_dev_out_ep_regs_t *out_regs = ++ core_if->dev_if->out_ep_regs[dwc_ep->num]; ++ doepdma = DWC_READ_REG32(&(out_regs->doepdma)); ++ start = (doepdma - dwc_ep->dma_desc_addr)/sizeof(dwc_otg_dev_dma_desc_t); ++ dma_desc = &(dwc_ep->desc_addr[start]); ++ } else { ++ start = 0; ++ dma_desc = dwc_ep->desc_addr; ++ } ++ ++ ++ for (i = start; i < dwc_ep->desc_cnt; ++i, ++dma_desc) { ++ sts.d32 = dma_desc->status.d32; ++ sts.b.bs = BS_HOST_READY; ++ dma_desc->status.d32 = sts.d32; ++ } ++ ++ if (dwc_ep->is_in == 0) { ++ addr = ++ &GET_CORE_IF(pcd)->dev_if->out_ep_regs[dwc_ep->num]-> ++ doepctl; ++ } else { ++ addr = ++ &GET_CORE_IF(pcd)->dev_if->in_ep_regs[dwc_ep->num]->diepctl; ++ } ++ depctl.b.epena = 1; ++ depctl.b.cnak = 1; ++ DWC_MODIFY_REG32(addr, 0, depctl.d32); ++} ++ ++/** ++ * This function handles EP0 Control transfers. ++ * ++ * The state of the control transfers are tracked in ++ * <code>ep0state</code>. ++ */ ++static void handle_ep0(dwc_otg_pcd_t * pcd) ++{ ++ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); ++ dwc_otg_pcd_ep_t *ep0 = &pcd->ep0; ++ dev_dma_desc_sts_t desc_sts; ++ deptsiz0_data_t deptsiz; ++ uint32_t byte_count; ++ ++#ifdef DEBUG_EP0 ++ DWC_DEBUGPL(DBG_PCDV, "%s()\n", __func__); ++ print_ep0_state(pcd); ++#endif ++ ++// DWC_PRINTF("HANDLE EP0\n"); ++ ++ switch (pcd->ep0state) { ++ case EP0_DISCONNECT: ++ break; ++ ++ case EP0_IDLE: ++ pcd->request_config = 0; ++ ++ pcd_setup(pcd); ++ break; ++ ++ case EP0_IN_DATA_PHASE: ++#ifdef DEBUG_EP0 ++ DWC_DEBUGPL(DBG_PCD, "DATA_IN EP%d-%s: type=%d, mps=%d\n", ++ ep0->dwc_ep.num, (ep0->dwc_ep.is_in ? "IN" : "OUT"), ++ ep0->dwc_ep.type, ep0->dwc_ep.maxpacket); ++#endif ++ ++ if (core_if->dma_enable != 0) { ++ /* ++ * For EP0 we can only program 1 packet at a time so we ++ * need to do the make calculations after each complete. ++ * Call write_packet to make the calculations, as in ++ * slave mode, and use those values to determine if we ++ * can complete. ++ */ ++ if (core_if->dma_desc_enable == 0) { ++ deptsiz.d32 = ++ DWC_READ_REG32(&core_if-> ++ dev_if->in_ep_regs[0]-> ++ dieptsiz); ++ byte_count = ++ ep0->dwc_ep.xfer_len - deptsiz.b.xfersize; ++ } else { ++ desc_sts = ++ core_if->dev_if->in_desc_addr->status; ++ byte_count = ++ ep0->dwc_ep.xfer_len - desc_sts.b.bytes; ++ } ++ ep0->dwc_ep.xfer_count += byte_count; ++ ep0->dwc_ep.xfer_buff += byte_count; ++ ep0->dwc_ep.dma_addr += byte_count; ++ } ++ if (ep0->dwc_ep.xfer_count < ep0->dwc_ep.total_len) { ++ dwc_otg_ep0_continue_transfer(GET_CORE_IF(pcd), ++ &ep0->dwc_ep); ++ DWC_DEBUGPL(DBG_PCD, "CONTINUE TRANSFER\n"); ++ } else if (ep0->dwc_ep.sent_zlp) { ++ dwc_otg_ep0_continue_transfer(GET_CORE_IF(pcd), ++ &ep0->dwc_ep); ++ ep0->dwc_ep.sent_zlp = 0; ++ DWC_DEBUGPL(DBG_PCD, "CONTINUE TRANSFER sent zlp\n"); ++ } else { ++ ep0_complete_request(ep0); ++ DWC_DEBUGPL(DBG_PCD, "COMPLETE TRANSFER\n"); ++ } ++ break; ++ case EP0_OUT_DATA_PHASE: ++#ifdef DEBUG_EP0 ++ DWC_DEBUGPL(DBG_PCD, "DATA_OUT EP%d-%s: type=%d, mps=%d\n", ++ ep0->dwc_ep.num, (ep0->dwc_ep.is_in ? "IN" : "OUT"), ++ ep0->dwc_ep.type, ep0->dwc_ep.maxpacket); ++#endif ++ if (core_if->dma_enable != 0) { ++ if (core_if->dma_desc_enable == 0) { ++ deptsiz.d32 = ++ DWC_READ_REG32(&core_if-> ++ dev_if->out_ep_regs[0]-> ++ doeptsiz); ++ byte_count = ++ ep0->dwc_ep.maxpacket - deptsiz.b.xfersize; ++ } else { ++ desc_sts = ++ core_if->dev_if->out_desc_addr->status; ++ byte_count = ++ ep0->dwc_ep.maxpacket - desc_sts.b.bytes; ++ } ++ ep0->dwc_ep.xfer_count += byte_count; ++ ep0->dwc_ep.xfer_buff += byte_count; ++ ep0->dwc_ep.dma_addr += byte_count; ++ } ++ if (ep0->dwc_ep.xfer_count < ep0->dwc_ep.total_len) { ++ dwc_otg_ep0_continue_transfer(GET_CORE_IF(pcd), ++ &ep0->dwc_ep); ++ DWC_DEBUGPL(DBG_PCD, "CONTINUE TRANSFER\n"); ++ } else if (ep0->dwc_ep.sent_zlp) { ++ dwc_otg_ep0_continue_transfer(GET_CORE_IF(pcd), ++ &ep0->dwc_ep); ++ ep0->dwc_ep.sent_zlp = 0; ++ DWC_DEBUGPL(DBG_PCD, "CONTINUE TRANSFER sent zlp\n"); ++ } else { ++ ep0_complete_request(ep0); ++ DWC_DEBUGPL(DBG_PCD, "COMPLETE TRANSFER\n"); ++ } ++ break; ++ ++ case EP0_IN_STATUS_PHASE: ++ case EP0_OUT_STATUS_PHASE: ++ DWC_DEBUGPL(DBG_PCD, "CASE: EP0_STATUS\n"); ++ ep0_complete_request(ep0); ++ pcd->ep0state = EP0_IDLE; ++ ep0->stopped = 1; ++ ep0->dwc_ep.is_in = 0; /* OUT for next SETUP */ ++ ++ /* Prepare for more SETUP Packets */ ++ if (core_if->dma_enable) { ++ ep0_out_start(core_if, pcd); ++ } ++ break; ++ ++ case EP0_STALL: ++ DWC_ERROR("EP0 STALLed, should not get here pcd_setup()\n"); ++ break; ++ } ++#ifdef DEBUG_EP0 ++ print_ep0_state(pcd); ++#endif ++} ++ ++/** ++ * Restart transfer ++ */ ++static void restart_transfer(dwc_otg_pcd_t * pcd, const uint32_t epnum) ++{ ++ dwc_otg_core_if_t *core_if; ++ dwc_otg_dev_if_t *dev_if; ++ deptsiz_data_t dieptsiz = {.d32 = 0 }; ++ dwc_otg_pcd_ep_t *ep; ++ ++ ep = get_in_ep(pcd, epnum); ++ ++#ifdef DWC_EN_ISOC ++ if (ep->dwc_ep.type == DWC_OTG_EP_TYPE_ISOC) { ++ return; ++ } ++#endif /* DWC_EN_ISOC */ ++ ++ core_if = GET_CORE_IF(pcd); ++ dev_if = core_if->dev_if; ++ ++ dieptsiz.d32 = DWC_READ_REG32(&dev_if->in_ep_regs[epnum]->dieptsiz); ++ ++ DWC_DEBUGPL(DBG_PCD, "xfer_buff=%p xfer_count=%0x xfer_len=%0x" ++ " stopped=%d\n", ep->dwc_ep.xfer_buff, ++ ep->dwc_ep.xfer_count, ep->dwc_ep.xfer_len, ep->stopped); ++ /* ++ * If xfersize is 0 and pktcnt in not 0, resend the last packet. ++ */ ++ if (dieptsiz.b.pktcnt && dieptsiz.b.xfersize == 0 && ++ ep->dwc_ep.start_xfer_buff != 0) { ++ if (ep->dwc_ep.total_len <= ep->dwc_ep.maxpacket) { ++ ep->dwc_ep.xfer_count = 0; ++ ep->dwc_ep.xfer_buff = ep->dwc_ep.start_xfer_buff; ++ ep->dwc_ep.xfer_len = ep->dwc_ep.xfer_count; ++ } else { ++ ep->dwc_ep.xfer_count -= ep->dwc_ep.maxpacket; ++ /* convert packet size to dwords. */ ++ ep->dwc_ep.xfer_buff -= ep->dwc_ep.maxpacket; ++ ep->dwc_ep.xfer_len = ep->dwc_ep.xfer_count; ++ } ++ ep->stopped = 0; ++ DWC_DEBUGPL(DBG_PCD, "xfer_buff=%p xfer_count=%0x " ++ "xfer_len=%0x stopped=%d\n", ++ ep->dwc_ep.xfer_buff, ++ ep->dwc_ep.xfer_count, ep->dwc_ep.xfer_len, ++ ep->stopped); ++ if (epnum == 0) { ++ dwc_otg_ep0_start_transfer(core_if, &ep->dwc_ep); ++ } else { ++ dwc_otg_ep_start_transfer(core_if, &ep->dwc_ep); ++ } ++ } ++} ++ ++/* ++ * This function create new nextep sequnce based on Learn Queue. ++ * ++ * @param core_if Programming view of DWC_otg controller ++ */ ++void predict_nextep_seq( dwc_otg_core_if_t * core_if) ++{ ++ dwc_otg_device_global_regs_t *dev_global_regs = ++ core_if->dev_if->dev_global_regs; ++ const uint32_t TOKEN_Q_DEPTH = core_if->hwcfg2.b.dev_token_q_depth; ++ /* Number of Token Queue Registers */ ++ const int DTKNQ_REG_CNT = (TOKEN_Q_DEPTH + 7) / 8; ++ dtknq1_data_t dtknqr1; ++ uint32_t in_tkn_epnums[4]; ++ uint8_t seqnum[MAX_EPS_CHANNELS]; ++ uint8_t intkn_seq[TOKEN_Q_DEPTH]; ++ grstctl_t resetctl = {.d32 = 0 }; ++ uint8_t temp; ++ int ndx = 0; ++ int start = 0; ++ int end = 0; ++ int sort_done = 0; ++ int i = 0; ++ volatile uint32_t *addr = &dev_global_regs->dtknqr1; ++ ++ ++ DWC_DEBUGPL(DBG_PCD,"dev_token_q_depth=%d\n",TOKEN_Q_DEPTH); ++ ++ /* Read the DTKNQ Registers */ ++ for (i = 0; i < DTKNQ_REG_CNT; i++) { ++ in_tkn_epnums[i] = DWC_READ_REG32(addr); ++ DWC_DEBUGPL(DBG_PCDV, "DTKNQR%d=0x%08x\n", i + 1, ++ in_tkn_epnums[i]); ++ if (addr == &dev_global_regs->dvbusdis) { ++ addr = &dev_global_regs->dtknqr3_dthrctl; ++ } else { ++ ++addr; ++ } ++ ++ } ++ ++ /* Copy the DTKNQR1 data to the bit field. */ ++ dtknqr1.d32 = in_tkn_epnums[0]; ++ if (dtknqr1.b.wrap_bit) { ++ ndx = dtknqr1.b.intknwptr; ++ end = ndx -1; ++ if (end < 0) ++ end = TOKEN_Q_DEPTH -1; ++ } else { ++ ndx = 0; ++ end = dtknqr1.b.intknwptr -1; ++ if (end < 0) ++ end = 0; ++ } ++ start = ndx; ++ ++ /* Fill seqnum[] by initial values: EP number + 31 */ ++ for (i=0; i <= core_if->dev_if->num_in_eps; i++) { ++ seqnum[i] = i +31; ++ } ++ ++ /* Fill intkn_seq[] from in_tkn_epnums[0] */ ++ for (i=0; i < 6; i++) ++ intkn_seq[i] = (in_tkn_epnums[0] >> ((7-i) * 4)) & 0xf; ++ ++ if (TOKEN_Q_DEPTH > 6) { ++ /* Fill intkn_seq[] from in_tkn_epnums[1] */ ++ for (i=6; i < 14; i++) ++ intkn_seq[i] = ++ (in_tkn_epnums[1] >> ((7 - (i - 6)) * 4)) & 0xf; ++ } ++ ++ if (TOKEN_Q_DEPTH > 14) { ++ /* Fill intkn_seq[] from in_tkn_epnums[1] */ ++ for (i=14; i < 22; i++) ++ intkn_seq[i] = ++ (in_tkn_epnums[2] >> ((7 - (i - 14)) * 4)) & 0xf; ++ } ++ ++ if (TOKEN_Q_DEPTH > 22) { ++ /* Fill intkn_seq[] from in_tkn_epnums[1] */ ++ for (i=22; i < 30; i++) ++ intkn_seq[i] = ++ (in_tkn_epnums[3] >> ((7 - (i - 22)) * 4)) & 0xf; ++ } ++ ++ DWC_DEBUGPL(DBG_PCDV, "%s start=%d end=%d intkn_seq[]:\n", __func__, ++ start, end); ++ for (i=0; i<TOKEN_Q_DEPTH; i++) ++ DWC_DEBUGPL(DBG_PCDV,"%d\n", intkn_seq[i]); ++ ++ /* Update seqnum based on intkn_seq[] */ ++ i = 0; ++ do { ++ seqnum[intkn_seq[ndx]] = i; ++ ndx++; ++ i++; ++ if (ndx == TOKEN_Q_DEPTH) ++ ndx = 0; ++ } while ( i < TOKEN_Q_DEPTH ); ++ ++ /* Mark non active EP's in seqnum[] by 0xff */ ++ for (i=0; i<=core_if->dev_if->num_in_eps; i++) { ++ if (core_if->nextep_seq[i] == 0xff ) ++ seqnum[i] = 0xff; ++ } ++ ++ /* Sort seqnum[] */ ++ sort_done = 0; ++ while (!sort_done) { ++ sort_done = 1; ++ for (i=0; i<core_if->dev_if->num_in_eps; i++) { ++ if (seqnum[i] > seqnum[i+1]) { ++ temp = seqnum[i]; ++ seqnum[i] = seqnum[i+1]; ++ seqnum[i+1] = temp; ++ sort_done = 0; ++ } ++ } ++ } ++ ++ ndx = start + seqnum[0]; ++ if (ndx >= TOKEN_Q_DEPTH) ++ ndx = ndx % TOKEN_Q_DEPTH; ++ core_if->first_in_nextep_seq = intkn_seq[ndx]; ++ ++ /* Update seqnum[] by EP numbers */ ++ for (i=0; i<=core_if->dev_if->num_in_eps; i++) { ++ ndx = start + i; ++ if (seqnum[i] < 31) { ++ ndx = start + seqnum[i]; ++ if (ndx >= TOKEN_Q_DEPTH) ++ ndx = ndx % TOKEN_Q_DEPTH; ++ seqnum[i] = intkn_seq[ndx]; ++ } else { ++ if (seqnum[i] < 0xff) { ++ seqnum[i] = seqnum[i] - 31; ++ } else { ++ break; ++ } ++ } ++ } ++ ++ /* Update nextep_seq[] based on seqnum[] */ ++ for (i=0; i<core_if->dev_if->num_in_eps; i++) { ++ if (seqnum[i] != 0xff) { ++ if (seqnum[i+1] != 0xff) { ++ core_if->nextep_seq[seqnum[i]] = seqnum[i+1]; ++ } else { ++ core_if->nextep_seq[seqnum[i]] = core_if->first_in_nextep_seq; ++ break; ++ } ++ } else { ++ break; ++ } ++ } ++ ++ DWC_DEBUGPL(DBG_PCDV, "%s first_in_nextep_seq= %2d; nextep_seq[]:\n", ++ __func__, core_if->first_in_nextep_seq); ++ for (i=0; i <= core_if->dev_if->num_in_eps; i++) { ++ DWC_DEBUGPL(DBG_PCDV,"%2d\n", core_if->nextep_seq[i]); ++ } ++ ++ /* Flush the Learning Queue */ ++ resetctl.d32 = DWC_READ_REG32(&core_if->core_global_regs->grstctl); ++ resetctl.b.intknqflsh = 1; ++ DWC_WRITE_REG32(&core_if->core_global_regs->grstctl, resetctl.d32); ++ ++ ++} ++ ++/** ++ * handle the IN EP disable interrupt. ++ */ ++static inline void handle_in_ep_disable_intr(dwc_otg_pcd_t * pcd, ++ const uint32_t epnum) ++{ ++ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); ++ dwc_otg_dev_if_t *dev_if = core_if->dev_if; ++ deptsiz_data_t dieptsiz = {.d32 = 0 }; ++ dctl_data_t dctl = {.d32 = 0 }; ++ dwc_otg_pcd_ep_t *ep; ++ dwc_ep_t *dwc_ep; ++ gintmsk_data_t gintmsk_data; ++ depctl_data_t depctl; ++ uint32_t diepdma; ++ uint32_t remain_to_transfer = 0; ++ uint8_t i; ++ uint32_t xfer_size; ++ ++ ep = get_in_ep(pcd, epnum); ++ dwc_ep = &ep->dwc_ep; ++ ++ if (dwc_ep->type == DWC_OTG_EP_TYPE_ISOC) { ++ dwc_otg_flush_tx_fifo(core_if, dwc_ep->tx_fifo_num); ++ complete_ep(ep); ++ return; ++ } ++ ++ DWC_DEBUGPL(DBG_PCD, "diepctl%d=%0x\n", epnum, ++ DWC_READ_REG32(&dev_if->in_ep_regs[epnum]->diepctl)); ++ dieptsiz.d32 = DWC_READ_REG32(&dev_if->in_ep_regs[epnum]->dieptsiz); ++ depctl.d32 = DWC_READ_REG32(&dev_if->in_ep_regs[epnum]->diepctl); ++ ++ DWC_DEBUGPL(DBG_ANY, "pktcnt=%d size=%d\n", ++ dieptsiz.b.pktcnt, dieptsiz.b.xfersize); ++ ++ if ((core_if->start_predict == 0) || (depctl.b.eptype & 1)) { ++ if (ep->stopped) { ++ if (core_if->en_multiple_tx_fifo) ++ /* Flush the Tx FIFO */ ++ dwc_otg_flush_tx_fifo(core_if, dwc_ep->tx_fifo_num); ++ /* Clear the Global IN NP NAK */ ++ dctl.d32 = 0; ++ dctl.b.cgnpinnak = 1; ++ DWC_MODIFY_REG32(&dev_if->dev_global_regs->dctl, dctl.d32, dctl.d32); ++ /* Restart the transaction */ ++ if (dieptsiz.b.pktcnt != 0 || dieptsiz.b.xfersize != 0) { ++ restart_transfer(pcd, epnum); ++ } ++ } else { ++ /* Restart the transaction */ ++ if (dieptsiz.b.pktcnt != 0 || dieptsiz.b.xfersize != 0) { ++ restart_transfer(pcd, epnum); ++ } ++ DWC_DEBUGPL(DBG_ANY, "STOPPED!!!\n"); ++ } ++ return; ++ } ++ ++ if (core_if->start_predict > 2) { // NP IN EP ++ core_if->start_predict--; ++ return; ++ } ++ ++ core_if->start_predict--; ++ ++ if (core_if->start_predict == 1) { // All NP IN Ep's disabled now ++ ++ predict_nextep_seq(core_if); ++ ++ /* Update all active IN EP's NextEP field based of nextep_seq[] */ ++ for ( i = 0; i <= core_if->dev_if->num_in_eps; i++) { ++ depctl.d32 = ++ DWC_READ_REG32(&dev_if->in_ep_regs[i]->diepctl); ++ if (core_if->nextep_seq[i] != 0xff) { // Active NP IN EP ++ depctl.b.nextep = core_if->nextep_seq[i]; ++ DWC_WRITE_REG32(&dev_if->in_ep_regs[i]->diepctl, depctl.d32); ++ } ++ } ++ /* Flush Shared NP TxFIFO */ ++ dwc_otg_flush_tx_fifo(core_if, 0); ++ /* Rewind buffers */ ++ if (!core_if->dma_desc_enable) { ++ i = core_if->first_in_nextep_seq; ++ do { ++ ep = get_in_ep(pcd, i); ++ dieptsiz.d32 = DWC_READ_REG32(&dev_if->in_ep_regs[i]->dieptsiz); ++ xfer_size = ep->dwc_ep.total_len - ep->dwc_ep.xfer_count; ++ if (xfer_size > ep->dwc_ep.maxxfer) ++ xfer_size = ep->dwc_ep.maxxfer; ++ depctl.d32 = DWC_READ_REG32(&dev_if->in_ep_regs[i]->diepctl); ++ if (dieptsiz.b.pktcnt != 0) { ++ if (xfer_size == 0) { ++ remain_to_transfer = 0; ++ } else { ++ if ((xfer_size % ep->dwc_ep.maxpacket) == 0) { ++ remain_to_transfer = ++ dieptsiz.b.pktcnt * ep->dwc_ep.maxpacket; ++ } else { ++ remain_to_transfer = ((dieptsiz.b.pktcnt -1) * ep->dwc_ep.maxpacket) ++ + (xfer_size % ep->dwc_ep.maxpacket); ++ } ++ } ++ diepdma = DWC_READ_REG32(&dev_if->in_ep_regs[i]->diepdma); ++ dieptsiz.b.xfersize = remain_to_transfer; ++ DWC_WRITE_REG32(&dev_if->in_ep_regs[i]->dieptsiz, dieptsiz.d32); ++ diepdma = ep->dwc_ep.dma_addr + (xfer_size - remain_to_transfer); ++ DWC_WRITE_REG32(&dev_if->in_ep_regs[i]->diepdma, diepdma); ++ } ++ i = core_if->nextep_seq[i]; ++ } while (i != core_if->first_in_nextep_seq); ++ } else { // dma_desc_enable ++ DWC_PRINTF("%s Learning Queue not supported in DDMA\n", __func__); ++ } ++ ++ /* Restart transfers in predicted sequences */ ++ i = core_if->first_in_nextep_seq; ++ do { ++ dieptsiz.d32 = DWC_READ_REG32(&dev_if->in_ep_regs[i]->dieptsiz); ++ depctl.d32 = DWC_READ_REG32(&dev_if->in_ep_regs[i]->diepctl); ++ if (dieptsiz.b.pktcnt != 0) { ++ depctl.d32 = DWC_READ_REG32(&dev_if->in_ep_regs[i]->diepctl); ++ depctl.b.epena = 1; ++ depctl.b.cnak = 1; ++ DWC_WRITE_REG32(&dev_if->in_ep_regs[i]->diepctl, depctl.d32); ++ } ++ i = core_if->nextep_seq[i]; ++ } while (i != core_if->first_in_nextep_seq); ++ ++ /* Clear the global non-periodic IN NAK handshake */ ++ dctl.d32 = 0; ++ dctl.b.cgnpinnak = 1; ++ DWC_MODIFY_REG32(&dev_if->dev_global_regs->dctl, dctl.d32, dctl.d32); ++ ++ /* Unmask EP Mismatch interrupt */ ++ gintmsk_data.d32 = 0; ++ gintmsk_data.b.epmismatch = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gintmsk, 0, gintmsk_data.d32); ++ ++ core_if->start_predict = 0; ++ ++ } ++} ++ ++/** ++ * Handler for the IN EP timeout handshake interrupt. ++ */ ++static inline void handle_in_ep_timeout_intr(dwc_otg_pcd_t * pcd, ++ const uint32_t epnum) ++{ ++ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); ++ dwc_otg_dev_if_t *dev_if = core_if->dev_if; ++ ++#ifdef DEBUG ++ deptsiz_data_t dieptsiz = {.d32 = 0 }; ++ uint32_t num = 0; ++#endif ++ dctl_data_t dctl = {.d32 = 0 }; ++ dwc_otg_pcd_ep_t *ep; ++ ++ gintmsk_data_t intr_mask = {.d32 = 0 }; ++ ++ ep = get_in_ep(pcd, epnum); ++ ++ /* Disable the NP Tx Fifo Empty Interrrupt */ ++ if (!core_if->dma_enable) { ++ intr_mask.b.nptxfempty = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gintmsk, ++ intr_mask.d32, 0); ++ } ++ /** @todo NGS Check EP type. ++ * Implement for Periodic EPs */ ++ /* ++ * Non-periodic EP ++ */ ++ /* Enable the Global IN NAK Effective Interrupt */ ++ intr_mask.b.ginnakeff = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gintmsk, 0, intr_mask.d32); ++ ++ /* Set Global IN NAK */ ++ dctl.b.sgnpinnak = 1; ++ DWC_MODIFY_REG32(&dev_if->dev_global_regs->dctl, dctl.d32, dctl.d32); ++ ++ ep->stopped = 1; ++ ++#ifdef DEBUG ++ dieptsiz.d32 = DWC_READ_REG32(&dev_if->in_ep_regs[num]->dieptsiz); ++ DWC_DEBUGPL(DBG_ANY, "pktcnt=%d size=%d\n", ++ dieptsiz.b.pktcnt, dieptsiz.b.xfersize); ++#endif ++ ++#ifdef DISABLE_PERIODIC_EP ++ /* ++ * Set the NAK bit for this EP to ++ * start the disable process. ++ */ ++ diepctl.d32 = 0; ++ diepctl.b.snak = 1; ++ DWC_MODIFY_REG32(&dev_if->in_ep_regs[num]->diepctl, diepctl.d32, ++ diepctl.d32); ++ ep->disabling = 1; ++ ep->stopped = 1; ++#endif ++} ++ ++/** ++ * Handler for the IN EP NAK interrupt. ++ */ ++static inline int32_t handle_in_ep_nak_intr(dwc_otg_pcd_t * pcd, ++ const uint32_t epnum) ++{ ++ /** @todo implement ISR */ ++ dwc_otg_core_if_t *core_if; ++ diepmsk_data_t intr_mask = {.d32 = 0 }; ++ ++ DWC_PRINTF("INTERRUPT Handler not implemented for %s\n", "IN EP NAK"); ++ core_if = GET_CORE_IF(pcd); ++ intr_mask.b.nak = 1; ++ ++ if (core_if->multiproc_int_enable) { ++ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs-> ++ diepeachintmsk[epnum], intr_mask.d32, 0); ++ } else { ++ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs->diepmsk, ++ intr_mask.d32, 0); ++ } ++ ++ return 1; ++} ++ ++/** ++ * Handler for the OUT EP Babble interrupt. ++ */ ++static inline int32_t handle_out_ep_babble_intr(dwc_otg_pcd_t * pcd, ++ const uint32_t epnum) ++{ ++ /** @todo implement ISR */ ++ dwc_otg_core_if_t *core_if; ++ doepmsk_data_t intr_mask = {.d32 = 0 }; ++ ++ DWC_PRINTF("INTERRUPT Handler not implemented for %s\n", ++ "OUT EP Babble"); ++ core_if = GET_CORE_IF(pcd); ++ intr_mask.b.babble = 1; ++ ++ if (core_if->multiproc_int_enable) { ++ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs-> ++ doepeachintmsk[epnum], intr_mask.d32, 0); ++ } else { ++ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs->doepmsk, ++ intr_mask.d32, 0); ++ } ++ ++ return 1; ++} ++ ++/** ++ * Handler for the OUT EP NAK interrupt. ++ */ ++static inline int32_t handle_out_ep_nak_intr(dwc_otg_pcd_t * pcd, ++ const uint32_t epnum) ++{ ++ /** @todo implement ISR */ ++ dwc_otg_core_if_t *core_if; ++ doepmsk_data_t intr_mask = {.d32 = 0 }; ++ ++ DWC_DEBUGPL(DBG_ANY, "INTERRUPT Handler not implemented for %s\n", "OUT EP NAK"); ++ core_if = GET_CORE_IF(pcd); ++ intr_mask.b.nak = 1; ++ ++ if (core_if->multiproc_int_enable) { ++ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs-> ++ doepeachintmsk[epnum], intr_mask.d32, 0); ++ } else { ++ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs->doepmsk, ++ intr_mask.d32, 0); ++ } ++ ++ return 1; ++} ++ ++/** ++ * Handler for the OUT EP NYET interrupt. ++ */ ++static inline int32_t handle_out_ep_nyet_intr(dwc_otg_pcd_t * pcd, ++ const uint32_t epnum) ++{ ++ /** @todo implement ISR */ ++ dwc_otg_core_if_t *core_if; ++ doepmsk_data_t intr_mask = {.d32 = 0 }; ++ ++ DWC_PRINTF("INTERRUPT Handler not implemented for %s\n", "OUT EP NYET"); ++ core_if = GET_CORE_IF(pcd); ++ intr_mask.b.nyet = 1; ++ ++ if (core_if->multiproc_int_enable) { ++ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs-> ++ doepeachintmsk[epnum], intr_mask.d32, 0); ++ } else { ++ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs->doepmsk, ++ intr_mask.d32, 0); ++ } ++ ++ return 1; ++} ++ ++/** ++ * This interrupt indicates that an IN EP has a pending Interrupt. ++ * The sequence for handling the IN EP interrupt is shown below: ++ * -# Read the Device All Endpoint Interrupt register ++ * -# Repeat the following for each IN EP interrupt bit set (from ++ * LSB to MSB). ++ * -# Read the Device Endpoint Interrupt (DIEPINTn) register ++ * -# If "Transfer Complete" call the request complete function ++ * -# If "Endpoint Disabled" complete the EP disable procedure. ++ * -# If "AHB Error Interrupt" log error ++ * -# If "Time-out Handshake" log error ++ * -# If "IN Token Received when TxFIFO Empty" write packet to Tx ++ * FIFO. ++ * -# If "IN Token EP Mismatch" (disable, this is handled by EP ++ * Mismatch Interrupt) ++ */ ++static int32_t dwc_otg_pcd_handle_in_ep_intr(dwc_otg_pcd_t * pcd) ++{ ++#define CLEAR_IN_EP_INTR(__core_if,__epnum,__intr) \ ++do { \ ++ diepint_data_t diepint = {.d32=0}; \ ++ diepint.b.__intr = 1; \ ++ DWC_WRITE_REG32(&__core_if->dev_if->in_ep_regs[__epnum]->diepint, \ ++ diepint.d32); \ ++} while (0) ++ ++ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); ++ dwc_otg_dev_if_t *dev_if = core_if->dev_if; ++ diepint_data_t diepint = {.d32 = 0 }; ++ depctl_data_t depctl = {.d32 = 0 }; ++ uint32_t ep_intr; ++ uint32_t epnum = 0; ++ dwc_otg_pcd_ep_t *ep; ++ dwc_ep_t *dwc_ep; ++ gintmsk_data_t intr_mask = {.d32 = 0 }; ++ ++ DWC_DEBUGPL(DBG_PCDV, "%s(%p)\n", __func__, pcd); ++ ++ /* Read in the device interrupt bits */ ++ ep_intr = dwc_otg_read_dev_all_in_ep_intr(core_if); ++ ++ /* Service the Device IN interrupts for each endpoint */ ++ while (ep_intr) { ++ if (ep_intr & 0x1) { ++ uint32_t empty_msk; ++ /* Get EP pointer */ ++ ep = get_in_ep(pcd, epnum); ++ dwc_ep = &ep->dwc_ep; ++ ++ depctl.d32 = ++ DWC_READ_REG32(&dev_if->in_ep_regs[epnum]->diepctl); ++ empty_msk = ++ DWC_READ_REG32(&dev_if-> ++ dev_global_regs->dtknqr4_fifoemptymsk); ++ ++ DWC_DEBUGPL(DBG_PCDV, ++ "IN EP INTERRUPT - %d\nepmty_msk - %8x diepctl - %8x\n", ++ epnum, empty_msk, depctl.d32); ++ ++ DWC_DEBUGPL(DBG_PCD, ++ "EP%d-%s: type=%d, mps=%d\n", ++ dwc_ep->num, (dwc_ep->is_in ? "IN" : "OUT"), ++ dwc_ep->type, dwc_ep->maxpacket); ++ ++ diepint.d32 = ++ dwc_otg_read_dev_in_ep_intr(core_if, dwc_ep); ++ ++ DWC_DEBUGPL(DBG_PCDV, ++ "EP %d Interrupt Register - 0x%x\n", epnum, ++ diepint.d32); ++ /* Transfer complete */ ++ if (diepint.b.xfercompl) { ++ /* Disable the NP Tx FIFO Empty ++ * Interrupt */ ++ if (core_if->en_multiple_tx_fifo == 0) { ++ intr_mask.b.nptxfempty = 1; ++ DWC_MODIFY_REG32 ++ (&core_if->core_global_regs->gintmsk, ++ intr_mask.d32, 0); ++ } else { ++ /* Disable the Tx FIFO Empty Interrupt for this EP */ ++ uint32_t fifoemptymsk = ++ 0x1 << dwc_ep->num; ++ DWC_MODIFY_REG32(&core_if-> ++ dev_if->dev_global_regs->dtknqr4_fifoemptymsk, ++ fifoemptymsk, 0); ++ } ++ /* Clear the bit in DIEPINTn for this interrupt */ ++ CLEAR_IN_EP_INTR(core_if, epnum, xfercompl); ++ ++ /* Complete the transfer */ ++ if (epnum == 0) { ++ handle_ep0(pcd); ++ } ++#ifdef DWC_EN_ISOC ++ else if (dwc_ep->type == DWC_OTG_EP_TYPE_ISOC) { ++ if (!ep->stopped) ++ complete_iso_ep(pcd, ep); ++ } ++#endif /* DWC_EN_ISOC */ ++#ifdef DWC_UTE_PER_IO ++ else if (dwc_ep->type == DWC_OTG_EP_TYPE_ISOC) { ++ if (!ep->stopped) ++ complete_xiso_ep(ep); ++ } ++#endif /* DWC_UTE_PER_IO */ ++ else { ++ if (dwc_ep->type == DWC_OTG_EP_TYPE_ISOC && ++ dwc_ep->bInterval > 1) { ++ dwc_ep->frame_num += dwc_ep->bInterval; ++ if (dwc_ep->frame_num > 0x3FFF) ++ { ++ dwc_ep->frm_overrun = 1; ++ dwc_ep->frame_num &= 0x3FFF; ++ } else ++ dwc_ep->frm_overrun = 0; ++ } ++ complete_ep(ep); ++ if(diepint.b.nak) ++ CLEAR_IN_EP_INTR(core_if, epnum, nak); ++ } ++ } ++ /* Endpoint disable */ ++ if (diepint.b.epdisabled) { ++ DWC_DEBUGPL(DBG_ANY, "EP%d IN disabled\n", ++ epnum); ++ handle_in_ep_disable_intr(pcd, epnum); ++ ++ /* Clear the bit in DIEPINTn for this interrupt */ ++ CLEAR_IN_EP_INTR(core_if, epnum, epdisabled); ++ } ++ /* AHB Error */ ++ if (diepint.b.ahberr) { ++ DWC_ERROR("EP%d IN AHB Error\n", epnum); ++ /* Clear the bit in DIEPINTn for this interrupt */ ++ CLEAR_IN_EP_INTR(core_if, epnum, ahberr); ++ } ++ /* TimeOUT Handshake (non-ISOC IN EPs) */ ++ if (diepint.b.timeout) { ++ DWC_ERROR("EP%d IN Time-out\n", epnum); ++ handle_in_ep_timeout_intr(pcd, epnum); ++ ++ CLEAR_IN_EP_INTR(core_if, epnum, timeout); ++ } ++ /** IN Token received with TxF Empty */ ++ if (diepint.b.intktxfemp) { ++ DWC_DEBUGPL(DBG_ANY, ++ "EP%d IN TKN TxFifo Empty\n", ++ epnum); ++ if (!ep->stopped && epnum != 0) { ++ ++ diepmsk_data_t diepmsk = {.d32 = 0 }; ++ diepmsk.b.intktxfemp = 1; ++ ++ if (core_if->multiproc_int_enable) { ++ DWC_MODIFY_REG32 ++ (&dev_if->dev_global_regs->diepeachintmsk ++ [epnum], diepmsk.d32, 0); ++ } else { ++ DWC_MODIFY_REG32 ++ (&dev_if->dev_global_regs->diepmsk, ++ diepmsk.d32, 0); ++ } ++ } else if (core_if->dma_desc_enable ++ && epnum == 0 ++ && pcd->ep0state == ++ EP0_OUT_STATUS_PHASE) { ++ // EP0 IN set STALL ++ depctl.d32 = ++ DWC_READ_REG32(&dev_if->in_ep_regs ++ [epnum]->diepctl); ++ ++ /* set the disable and stall bits */ ++ if (depctl.b.epena) { ++ depctl.b.epdis = 1; ++ } ++ depctl.b.stall = 1; ++ DWC_WRITE_REG32(&dev_if->in_ep_regs ++ [epnum]->diepctl, ++ depctl.d32); ++ } ++ CLEAR_IN_EP_INTR(core_if, epnum, intktxfemp); ++ } ++ /** IN Token Received with EP mismatch */ ++ if (diepint.b.intknepmis) { ++ DWC_DEBUGPL(DBG_ANY, ++ "EP%d IN TKN EP Mismatch\n", epnum); ++ CLEAR_IN_EP_INTR(core_if, epnum, intknepmis); ++ } ++ /** IN Endpoint NAK Effective */ ++ if (diepint.b.inepnakeff) { ++ DWC_DEBUGPL(DBG_ANY, ++ "EP%d IN EP NAK Effective\n", ++ epnum); ++ /* Periodic EP */ ++ if (ep->disabling) { ++ depctl.d32 = 0; ++ depctl.b.snak = 1; ++ depctl.b.epdis = 1; ++ DWC_MODIFY_REG32(&dev_if->in_ep_regs ++ [epnum]->diepctl, ++ depctl.d32, ++ depctl.d32); ++ } ++ CLEAR_IN_EP_INTR(core_if, epnum, inepnakeff); ++ ++ } ++ ++ /** IN EP Tx FIFO Empty Intr */ ++ if (diepint.b.emptyintr) { ++ DWC_DEBUGPL(DBG_ANY, ++ "EP%d Tx FIFO Empty Intr \n", ++ epnum); ++ write_empty_tx_fifo(pcd, epnum); ++ ++ CLEAR_IN_EP_INTR(core_if, epnum, emptyintr); ++ ++ } ++ ++ /** IN EP BNA Intr */ ++ if (diepint.b.bna) { ++ CLEAR_IN_EP_INTR(core_if, epnum, bna); ++ if (core_if->dma_desc_enable) { ++#ifdef DWC_EN_ISOC ++ if (dwc_ep->type == ++ DWC_OTG_EP_TYPE_ISOC) { ++ /* ++ * This checking is performed to prevent first "false" BNA ++ * handling occuring right after reconnect ++ */ ++ if (dwc_ep->next_frame != ++ 0xffffffff) ++ dwc_otg_pcd_handle_iso_bna(ep); ++ } else ++#endif /* DWC_EN_ISOC */ ++ { ++ dwc_otg_pcd_handle_noniso_bna(ep); ++ } ++ } ++ } ++ /* NAK Interrutp */ ++ if (diepint.b.nak) { ++ DWC_DEBUGPL(DBG_ANY, "EP%d IN NAK Interrupt\n", ++ epnum); ++ if (ep->dwc_ep.type == DWC_OTG_EP_TYPE_ISOC) { ++ depctl_data_t depctl; ++ if (ep->dwc_ep.frame_num == 0xFFFFFFFF) { ++ ep->dwc_ep.frame_num = core_if->frame_num; ++ if (ep->dwc_ep.bInterval > 1) { ++ depctl.d32 = 0; ++ depctl.d32 = DWC_READ_REG32(&dev_if->in_ep_regs[epnum]->diepctl); ++ if (ep->dwc_ep.frame_num & 0x1) { ++ depctl.b.setd1pid = 1; ++ depctl.b.setd0pid = 0; ++ } else { ++ depctl.b.setd0pid = 1; ++ depctl.b.setd1pid = 0; ++ } ++ DWC_WRITE_REG32(&dev_if->in_ep_regs[epnum]->diepctl, depctl.d32); ++ } ++ start_next_request(ep); ++ } ++ ep->dwc_ep.frame_num += ep->dwc_ep.bInterval; ++ if (dwc_ep->frame_num > 0x3FFF) { ++ dwc_ep->frm_overrun = 1; ++ dwc_ep->frame_num &= 0x3FFF; ++ } else ++ dwc_ep->frm_overrun = 0; ++ } ++ ++ CLEAR_IN_EP_INTR(core_if, epnum, nak); ++ } ++ } ++ epnum++; ++ ep_intr >>= 1; ++ } ++ ++ return 1; ++#undef CLEAR_IN_EP_INTR ++} ++ ++/** ++ * This interrupt indicates that an OUT EP has a pending Interrupt. ++ * The sequence for handling the OUT EP interrupt is shown below: ++ * -# Read the Device All Endpoint Interrupt register ++ * -# Repeat the following for each OUT EP interrupt bit set (from ++ * LSB to MSB). ++ * -# Read the Device Endpoint Interrupt (DOEPINTn) register ++ * -# If "Transfer Complete" call the request complete function ++ * -# If "Endpoint Disabled" complete the EP disable procedure. ++ * -# If "AHB Error Interrupt" log error ++ * -# If "Setup Phase Done" process Setup Packet (See Standard USB ++ * Command Processing) ++ */ ++static int32_t dwc_otg_pcd_handle_out_ep_intr(dwc_otg_pcd_t * pcd) ++{ ++#define CLEAR_OUT_EP_INTR(__core_if,__epnum,__intr) \ ++do { \ ++ doepint_data_t doepint = {.d32=0}; \ ++ doepint.b.__intr = 1; \ ++ DWC_WRITE_REG32(&__core_if->dev_if->out_ep_regs[__epnum]->doepint, \ ++ doepint.d32); \ ++} while (0) ++ ++ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); ++ uint32_t ep_intr; ++ doepint_data_t doepint = {.d32 = 0 }; ++ uint32_t epnum = 0; ++ dwc_otg_pcd_ep_t *ep; ++ dwc_ep_t *dwc_ep; ++ dctl_data_t dctl = {.d32 = 0 }; ++ gintmsk_data_t gintmsk = {.d32 = 0 }; ++ ++ ++ DWC_DEBUGPL(DBG_PCDV, "%s()\n", __func__); ++ ++ /* Read in the device interrupt bits */ ++ ep_intr = dwc_otg_read_dev_all_out_ep_intr(core_if); ++ ++ while (ep_intr) { ++ if (ep_intr & 0x1) { ++ /* Get EP pointer */ ++ ep = get_out_ep(pcd, epnum); ++ dwc_ep = &ep->dwc_ep; ++ ++#ifdef VERBOSE ++ DWC_DEBUGPL(DBG_PCDV, ++ "EP%d-%s: type=%d, mps=%d\n", ++ dwc_ep->num, (dwc_ep->is_in ? "IN" : "OUT"), ++ dwc_ep->type, dwc_ep->maxpacket); ++#endif ++ doepint.d32 = ++ dwc_otg_read_dev_out_ep_intr(core_if, dwc_ep); ++ /* Moved this interrupt upper due to core deffect of asserting ++ * OUT EP 0 xfercompl along with stsphsrcvd in BDMA */ ++ if (doepint.b.stsphsercvd) { ++ deptsiz0_data_t deptsiz; ++ CLEAR_OUT_EP_INTR(core_if, epnum, stsphsercvd); ++ deptsiz.d32 = ++ DWC_READ_REG32(&core_if->dev_if-> ++ out_ep_regs[0]->doeptsiz); ++ if (core_if->snpsid >= OTG_CORE_REV_3_00a ++ && core_if->dma_enable ++ && core_if->dma_desc_enable == 0 ++ && doepint.b.xfercompl ++ && deptsiz.b.xfersize == 24) { ++ CLEAR_OUT_EP_INTR(core_if, epnum, ++ xfercompl); ++ doepint.b.xfercompl = 0; ++ ep0_out_start(core_if, pcd); ++ } ++ if ((core_if->dma_desc_enable) || ++ (core_if->dma_enable ++ && core_if->snpsid >= ++ OTG_CORE_REV_3_00a)) { ++ do_setup_in_status_phase(pcd); ++ } ++ } ++ /* Transfer complete */ ++ if (doepint.b.xfercompl) { ++ ++ if (epnum == 0) { ++ /* Clear the bit in DOEPINTn for this interrupt */ ++ CLEAR_OUT_EP_INTR(core_if, epnum, xfercompl); ++ if (core_if->snpsid >= OTG_CORE_REV_3_00a) { ++ DWC_DEBUGPL(DBG_PCDV, "DOEPINT=%x doepint=%x\n", ++ DWC_READ_REG32(&core_if->dev_if->out_ep_regs[0]->doepint), ++ doepint.d32); ++ DWC_DEBUGPL(DBG_PCDV, "DOEPCTL=%x \n", ++ DWC_READ_REG32(&core_if->dev_if->out_ep_regs[0]->doepctl)); ++ ++ if (core_if->snpsid >= OTG_CORE_REV_3_00a ++ && core_if->dma_enable == 0) { ++ doepint_data_t doepint; ++ doepint.d32 = DWC_READ_REG32(&core_if->dev_if-> ++ out_ep_regs[0]->doepint); ++ if (pcd->ep0state == EP0_IDLE && doepint.b.sr) { ++ CLEAR_OUT_EP_INTR(core_if, epnum, sr); ++ goto exit_xfercompl; ++ } ++ } ++ /* In case of DDMA look at SR bit to go to the Data Stage */ ++ if (core_if->dma_desc_enable) { ++ dev_dma_desc_sts_t status = {.d32 = 0}; ++ if (pcd->ep0state == EP0_IDLE) { ++ status.d32 = core_if->dev_if->setup_desc_addr[core_if-> ++ dev_if->setup_desc_index]->status.d32; ++ if(pcd->data_terminated) { ++ pcd->data_terminated = 0; ++ status.d32 = core_if->dev_if->out_desc_addr->status.d32; ++ dwc_memcpy(&pcd->setup_pkt->req, pcd->backup_buf, 8); ++ } ++ if (status.b.sr) { ++ if (doepint.b.setup) { ++ DWC_DEBUGPL(DBG_PCDV, "DMA DESC EP0_IDLE SR=1 setup=1\n"); ++ /* Already started data stage, clear setup */ ++ CLEAR_OUT_EP_INTR(core_if, epnum, setup); ++ doepint.b.setup = 0; ++ handle_ep0(pcd); ++ /* Prepare for more setup packets */ ++ if (pcd->ep0state == EP0_IN_STATUS_PHASE || ++ pcd->ep0state == EP0_IN_DATA_PHASE) { ++ ep0_out_start(core_if, pcd); ++ } ++ ++ goto exit_xfercompl; ++ } else { ++ /* Prepare for more setup packets */ ++ DWC_DEBUGPL(DBG_PCDV, ++ "EP0_IDLE SR=1 setup=0 new setup comes\n"); ++ ep0_out_start(core_if, pcd); ++ } ++ } ++ } else { ++ dwc_otg_pcd_request_t *req; ++ dev_dma_desc_sts_t status = {.d32 = 0}; ++ diepint_data_t diepint0; ++ diepint0.d32 = DWC_READ_REG32(&core_if->dev_if-> ++ in_ep_regs[0]->diepint); ++ ++ if (pcd->ep0state == EP0_STALL || pcd->ep0state == EP0_DISCONNECT) { ++ DWC_ERROR("EP0 is stalled/disconnected\n"); ++ } ++ ++ /* Clear IN xfercompl if set */ ++ if (diepint0.b.xfercompl && (pcd->ep0state == EP0_IN_STATUS_PHASE ++ || pcd->ep0state == EP0_IN_DATA_PHASE)) { ++ DWC_WRITE_REG32(&core_if->dev_if-> ++ in_ep_regs[0]->diepint, diepint0.d32); ++ } ++ ++ status.d32 = core_if->dev_if->setup_desc_addr[core_if-> ++ dev_if->setup_desc_index]->status.d32; ++ ++ if (ep->dwc_ep.xfer_count != ep->dwc_ep.total_len ++ && (pcd->ep0state == EP0_OUT_DATA_PHASE)) ++ status.d32 = core_if->dev_if->out_desc_addr->status.d32; ++ if (pcd->ep0state == EP0_OUT_STATUS_PHASE) ++ status.d32 = core_if->dev_if-> ++ out_desc_addr->status.d32; ++ ++ if (status.b.sr) { ++ if (DWC_CIRCLEQ_EMPTY(&ep->queue)) { ++ DWC_DEBUGPL(DBG_PCDV, "Request queue empty!!\n"); ++ } else { ++ DWC_DEBUGPL(DBG_PCDV, "complete req!!\n"); ++ req = DWC_CIRCLEQ_FIRST(&ep->queue); ++ if (ep->dwc_ep.xfer_count != ep->dwc_ep.total_len && ++ pcd->ep0state == EP0_OUT_DATA_PHASE) { ++ /* Read arrived setup packet from req->buf */ ++ dwc_memcpy(&pcd->setup_pkt->req, ++ req->buf + ep->dwc_ep.xfer_count, 8); ++ } ++ req->actual = ep->dwc_ep.xfer_count; ++ dwc_otg_request_done(ep, req, -ECONNRESET); ++ ep->dwc_ep.start_xfer_buff = 0; ++ ep->dwc_ep.xfer_buff = 0; ++ ep->dwc_ep.xfer_len = 0; ++ } ++ pcd->ep0state = EP0_IDLE; ++ if (doepint.b.setup) { ++ DWC_DEBUGPL(DBG_PCDV, "EP0_IDLE SR=1 setup=1\n"); ++ /* Data stage started, clear setup */ ++ CLEAR_OUT_EP_INTR(core_if, epnum, setup); ++ doepint.b.setup = 0; ++ handle_ep0(pcd); ++ /* Prepare for setup packets if ep0in was enabled*/ ++ if (pcd->ep0state == EP0_IN_STATUS_PHASE) { ++ ep0_out_start(core_if, pcd); ++ } ++ ++ goto exit_xfercompl; ++ } else { ++ /* Prepare for more setup packets */ ++ DWC_DEBUGPL(DBG_PCDV, ++ "EP0_IDLE SR=1 setup=0 new setup comes 2\n"); ++ ep0_out_start(core_if, pcd); ++ } ++ } ++ } ++ } ++ if (core_if->snpsid >= OTG_CORE_REV_2_94a && core_if->dma_enable ++ && core_if->dma_desc_enable == 0) { ++ doepint_data_t doepint_temp = {.d32 = 0}; ++ deptsiz0_data_t doeptsize0 = {.d32 = 0 }; ++ doepint_temp.d32 = DWC_READ_REG32(&core_if->dev_if-> ++ out_ep_regs[ep->dwc_ep.num]->doepint); ++ doeptsize0.d32 = DWC_READ_REG32(&core_if->dev_if-> ++ out_ep_regs[ep->dwc_ep.num]->doeptsiz); ++ if (pcd->ep0state == EP0_IDLE) { ++ if (doepint_temp.b.sr) { ++ CLEAR_OUT_EP_INTR(core_if, epnum, sr); ++ } ++ doepint.d32 = DWC_READ_REG32(&core_if->dev_if-> ++ out_ep_regs[0]->doepint); ++ if (doeptsize0.b.supcnt == 3) { ++ DWC_DEBUGPL(DBG_ANY, "Rolling over!!!!!!!\n"); ++ ep->dwc_ep.stp_rollover = 1; ++ } ++ if (doepint.b.setup) { ++retry: ++ /* Already started data stage, clear setup */ ++ CLEAR_OUT_EP_INTR(core_if, epnum, setup); ++ doepint.b.setup = 0; ++ handle_ep0(pcd); ++ ep->dwc_ep.stp_rollover = 0; ++ /* Prepare for more setup packets */ ++ if (pcd->ep0state == EP0_IN_STATUS_PHASE || ++ pcd->ep0state == EP0_IN_DATA_PHASE) { ++ ep0_out_start(core_if, pcd); ++ } ++ goto exit_xfercompl; ++ } else { ++ /* Prepare for more setup packets */ ++ DWC_DEBUGPL(DBG_ANY, ++ "EP0_IDLE SR=1 setup=0 new setup comes\n"); ++ doepint.d32 = DWC_READ_REG32(&core_if->dev_if-> ++ out_ep_regs[0]->doepint); ++ if(doepint.b.setup) ++ goto retry; ++ ep0_out_start(core_if, pcd); ++ } ++ } else { ++ dwc_otg_pcd_request_t *req; ++ diepint_data_t diepint0 = {.d32 = 0}; ++ doepint_data_t doepint_temp = {.d32 = 0}; ++ depctl_data_t diepctl0; ++ diepint0.d32 = DWC_READ_REG32(&core_if->dev_if-> ++ in_ep_regs[0]->diepint); ++ diepctl0.d32 = DWC_READ_REG32(&core_if->dev_if-> ++ in_ep_regs[0]->diepctl); ++ ++ if (pcd->ep0state == EP0_IN_DATA_PHASE ++ || pcd->ep0state == EP0_IN_STATUS_PHASE) { ++ if (diepint0.b.xfercompl) { ++ DWC_WRITE_REG32(&core_if->dev_if-> ++ in_ep_regs[0]->diepint, diepint0.d32); ++ } ++ if (diepctl0.b.epena) { ++ diepint_data_t diepint = {.d32 = 0}; ++ diepctl0.b.snak = 1; ++ DWC_WRITE_REG32(&core_if->dev_if-> ++ in_ep_regs[0]->diepctl, diepctl0.d32); ++ do { ++ dwc_udelay(10); ++ diepint.d32 = DWC_READ_REG32(&core_if->dev_if-> ++ in_ep_regs[0]->diepint); ++ } while (!diepint.b.inepnakeff); ++ diepint.b.inepnakeff = 1; ++ DWC_WRITE_REG32(&core_if->dev_if-> ++ in_ep_regs[0]->diepint, diepint.d32); ++ diepctl0.d32 = 0; ++ diepctl0.b.epdis = 1; ++ DWC_WRITE_REG32(&core_if->dev_if->in_ep_regs[0]->diepctl, ++ diepctl0.d32); ++ do { ++ dwc_udelay(10); ++ diepint.d32 = DWC_READ_REG32(&core_if->dev_if-> ++ in_ep_regs[0]->diepint); ++ } while (!diepint.b.epdisabled); ++ diepint.b.epdisabled = 1; ++ DWC_WRITE_REG32(&core_if->dev_if->in_ep_regs[0]->diepint, ++ diepint.d32); ++ } ++ } ++ doepint_temp.d32 = DWC_READ_REG32(&core_if->dev_if-> ++ out_ep_regs[ep->dwc_ep.num]->doepint); ++ if (doepint_temp.b.sr) { ++ CLEAR_OUT_EP_INTR(core_if, epnum, sr); ++ if (DWC_CIRCLEQ_EMPTY(&ep->queue)) { ++ DWC_DEBUGPL(DBG_PCDV, "Request queue empty!!\n"); ++ } else { ++ DWC_DEBUGPL(DBG_PCDV, "complete req!!\n"); ++ req = DWC_CIRCLEQ_FIRST(&ep->queue); ++ if (ep->dwc_ep.xfer_count != ep->dwc_ep.total_len && ++ pcd->ep0state == EP0_OUT_DATA_PHASE) { ++ /* Read arrived setup packet from req->buf */ ++ dwc_memcpy(&pcd->setup_pkt->req, ++ req->buf + ep->dwc_ep.xfer_count, 8); ++ } ++ req->actual = ep->dwc_ep.xfer_count; ++ dwc_otg_request_done(ep, req, -ECONNRESET); ++ ep->dwc_ep.start_xfer_buff = 0; ++ ep->dwc_ep.xfer_buff = 0; ++ ep->dwc_ep.xfer_len = 0; ++ } ++ pcd->ep0state = EP0_IDLE; ++ if (doepint.b.setup) { ++ DWC_DEBUGPL(DBG_PCDV, "EP0_IDLE SR=1 setup=1\n"); ++ /* Data stage started, clear setup */ ++ CLEAR_OUT_EP_INTR(core_if, epnum, setup); ++ doepint.b.setup = 0; ++ handle_ep0(pcd); ++ /* Prepare for setup packets if ep0in was enabled*/ ++ if (pcd->ep0state == EP0_IN_STATUS_PHASE) { ++ ep0_out_start(core_if, pcd); ++ } ++ goto exit_xfercompl; ++ } else { ++ /* Prepare for more setup packets */ ++ DWC_DEBUGPL(DBG_PCDV, ++ "EP0_IDLE SR=1 setup=0 new setup comes 2\n"); ++ ep0_out_start(core_if, pcd); ++ } ++ } ++ } ++ } ++ if (core_if->dma_enable == 0 || pcd->ep0state != EP0_IDLE) ++ handle_ep0(pcd); ++exit_xfercompl: ++ DWC_DEBUGPL(DBG_PCDV, "DOEPINT=%x doepint=%x\n", ++ dwc_otg_read_dev_out_ep_intr(core_if, dwc_ep), doepint.d32); ++ } else { ++ if (core_if->dma_desc_enable == 0 ++ || pcd->ep0state != EP0_IDLE) ++ handle_ep0(pcd); ++ } ++#ifdef DWC_EN_ISOC ++ } else if (dwc_ep->type == DWC_OTG_EP_TYPE_ISOC) { ++ if (doepint.b.pktdrpsts == 0) { ++ /* Clear the bit in DOEPINTn for this interrupt */ ++ CLEAR_OUT_EP_INTR(core_if, ++ epnum, ++ xfercompl); ++ complete_iso_ep(pcd, ep); ++ } else { ++ ++ doepint_data_t doepint = {.d32 = 0 }; ++ doepint.b.xfercompl = 1; ++ doepint.b.pktdrpsts = 1; ++ DWC_WRITE_REG32 ++ (&core_if->dev_if->out_ep_regs ++ [epnum]->doepint, ++ doepint.d32); ++ if (handle_iso_out_pkt_dropped ++ (core_if, dwc_ep)) { ++ complete_iso_ep(pcd, ++ ep); ++ } ++ } ++#endif /* DWC_EN_ISOC */ ++#ifdef DWC_UTE_PER_IO ++ } else if (dwc_ep->type == DWC_OTG_EP_TYPE_ISOC) { ++ CLEAR_OUT_EP_INTR(core_if, epnum, xfercompl); ++ if (!ep->stopped) ++ complete_xiso_ep(ep); ++#endif /* DWC_UTE_PER_IO */ ++ } else { ++ /* Clear the bit in DOEPINTn for this interrupt */ ++ CLEAR_OUT_EP_INTR(core_if, epnum, ++ xfercompl); ++ ++ if (core_if->core_params->dev_out_nak) { ++ DWC_TIMER_CANCEL(pcd->core_if->ep_xfer_timer[epnum]); ++ pcd->core_if->ep_xfer_info[epnum].state = 0; ++#ifdef DEBUG ++ print_memory_payload(pcd, dwc_ep); ++#endif ++ } ++ complete_ep(ep); ++ } ++ ++ } ++ ++ /* Endpoint disable */ ++ if (doepint.b.epdisabled) { ++ ++ /* Clear the bit in DOEPINTn for this interrupt */ ++ CLEAR_OUT_EP_INTR(core_if, epnum, epdisabled); ++ if (core_if->core_params->dev_out_nak) { ++#ifdef DEBUG ++ print_memory_payload(pcd, dwc_ep); ++#endif ++ /* In case of timeout condition */ ++ if (core_if->ep_xfer_info[epnum].state == 2) { ++ dctl.d32 = DWC_READ_REG32(&core_if->dev_if-> ++ dev_global_regs->dctl); ++ dctl.b.cgoutnak = 1; ++ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->dctl, ++ dctl.d32); ++ /* Unmask goutnakeff interrupt which was masked ++ * during handle nak out interrupt */ ++ gintmsk.b.goutnakeff = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gintmsk, ++ 0, gintmsk.d32); ++ ++ complete_ep(ep); ++ } ++ } ++ if (ep->dwc_ep.type == DWC_OTG_EP_TYPE_ISOC) ++ { ++ dctl_data_t dctl; ++ gintmsk_data_t intr_mask = {.d32 = 0}; ++ dwc_otg_pcd_request_t *req = 0; ++ ++ dctl.d32 = DWC_READ_REG32(&core_if->dev_if-> ++ dev_global_regs->dctl); ++ dctl.b.cgoutnak = 1; ++ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->dctl, ++ dctl.d32); ++ ++ intr_mask.d32 = 0; ++ intr_mask.b.incomplisoout = 1; ++ ++ /* Get any pending requests */ ++ if (!DWC_CIRCLEQ_EMPTY(&ep->queue)) { ++ req = DWC_CIRCLEQ_FIRST(&ep->queue); ++ if (!req) { ++ DWC_PRINTF("complete_ep 0x%p, req = NULL!\n", ep); ++ } else { ++ dwc_otg_request_done(ep, req, 0); ++ start_next_request(ep); ++ } ++ } else { ++ DWC_PRINTF("complete_ep 0x%p, ep->queue empty!\n", ep); ++ } ++ } ++ } ++ /* AHB Error */ ++ if (doepint.b.ahberr) { ++ DWC_ERROR("EP%d OUT AHB Error\n", epnum); ++ DWC_ERROR("EP%d DEPDMA=0x%08x \n", ++ epnum, core_if->dev_if->out_ep_regs[epnum]->doepdma); ++ CLEAR_OUT_EP_INTR(core_if, epnum, ahberr); ++ } ++ /* Setup Phase Done (contorl EPs) */ ++ if (doepint.b.setup) { ++#ifdef DEBUG_EP0 ++ DWC_DEBUGPL(DBG_PCD, "EP%d SETUP Done\n", epnum); ++#endif ++ CLEAR_OUT_EP_INTR(core_if, epnum, setup); ++ ++ handle_ep0(pcd); ++ } ++ ++ /** OUT EP BNA Intr */ ++ if (doepint.b.bna) { ++ CLEAR_OUT_EP_INTR(core_if, epnum, bna); ++ if (core_if->dma_desc_enable) { ++#ifdef DWC_EN_ISOC ++ if (dwc_ep->type == ++ DWC_OTG_EP_TYPE_ISOC) { ++ /* ++ * This checking is performed to prevent first "false" BNA ++ * handling occuring right after reconnect ++ */ ++ if (dwc_ep->next_frame != ++ 0xffffffff) ++ dwc_otg_pcd_handle_iso_bna(ep); ++ } else ++#endif /* DWC_EN_ISOC */ ++ { ++ dwc_otg_pcd_handle_noniso_bna(ep); ++ } ++ } ++ } ++ /* Babble Interrupt */ ++ if (doepint.b.babble) { ++ DWC_DEBUGPL(DBG_ANY, "EP%d OUT Babble\n", ++ epnum); ++ handle_out_ep_babble_intr(pcd, epnum); ++ ++ CLEAR_OUT_EP_INTR(core_if, epnum, babble); ++ } ++ if (doepint.b.outtknepdis) { ++ DWC_DEBUGPL(DBG_ANY, "EP%d OUT Token received when EP is \ ++ disabled\n",epnum); ++ if (ep->dwc_ep.type == DWC_OTG_EP_TYPE_ISOC) { ++ doepmsk_data_t doepmsk = {.d32 = 0}; ++ ep->dwc_ep.frame_num = core_if->frame_num; ++ if (ep->dwc_ep.bInterval > 1) { ++ depctl_data_t depctl; ++ depctl.d32 = DWC_READ_REG32(&core_if->dev_if-> ++ out_ep_regs[epnum]->doepctl); ++ if (ep->dwc_ep.frame_num & 0x1) { ++ depctl.b.setd1pid = 1; ++ depctl.b.setd0pid = 0; ++ } else { ++ depctl.b.setd0pid = 1; ++ depctl.b.setd1pid = 0; ++ } ++ DWC_WRITE_REG32(&core_if->dev_if-> ++ out_ep_regs[epnum]->doepctl, depctl.d32); ++ } ++ start_next_request(ep); ++ doepmsk.b.outtknepdis = 1; ++ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs->doepmsk, ++ doepmsk.d32, 0); ++ } ++ CLEAR_OUT_EP_INTR(core_if, epnum, outtknepdis); ++ } ++ ++ /* NAK Interrutp */ ++ if (doepint.b.nak) { ++ DWC_DEBUGPL(DBG_ANY, "EP%d OUT NAK\n", epnum); ++ handle_out_ep_nak_intr(pcd, epnum); ++ ++ CLEAR_OUT_EP_INTR(core_if, epnum, nak); ++ } ++ /* NYET Interrutp */ ++ if (doepint.b.nyet) { ++ DWC_DEBUGPL(DBG_ANY, "EP%d OUT NYET\n", epnum); ++ handle_out_ep_nyet_intr(pcd, epnum); ++ ++ CLEAR_OUT_EP_INTR(core_if, epnum, nyet); ++ } ++ } ++ ++ epnum++; ++ ep_intr >>= 1; ++ } ++ ++ return 1; ++ ++#undef CLEAR_OUT_EP_INTR ++} ++static int drop_transfer(uint32_t trgt_fr, uint32_t curr_fr, uint8_t frm_overrun) ++{ ++ int retval = 0; ++ if(!frm_overrun && curr_fr >= trgt_fr) ++ retval = 1; ++ else if (frm_overrun ++ && (curr_fr >= trgt_fr && ((curr_fr - trgt_fr) < 0x3FFF / 2))) ++ retval = 1; ++ return retval; ++} ++/** ++ * Incomplete ISO IN Transfer Interrupt. ++ * This interrupt indicates one of the following conditions occurred ++ * while transmitting an ISOC transaction. ++ * - Corrupted IN Token for ISOC EP. ++ * - Packet not complete in FIFO. ++ * The follow actions will be taken: ++ * -# Determine the EP ++ * -# Set incomplete flag in dwc_ep structure ++ * -# Disable EP; when "Endpoint Disabled" interrupt is received ++ * Flush FIFO ++ */ ++int32_t dwc_otg_pcd_handle_incomplete_isoc_in_intr(dwc_otg_pcd_t * pcd) ++{ ++ gintsts_data_t gintsts; ++ ++#ifdef DWC_EN_ISOC ++ dwc_otg_dev_if_t *dev_if; ++ deptsiz_data_t deptsiz = {.d32 = 0 }; ++ depctl_data_t depctl = {.d32 = 0 }; ++ dsts_data_t dsts = {.d32 = 0 }; ++ dwc_ep_t *dwc_ep; ++ int i; ++ ++ dev_if = GET_CORE_IF(pcd)->dev_if; ++ ++ for (i = 1; i <= dev_if->num_in_eps; ++i) { ++ dwc_ep = &pcd->in_ep[i].dwc_ep; ++ if (dwc_ep->active && dwc_ep->type == DWC_OTG_EP_TYPE_ISOC) { ++ deptsiz.d32 = ++ DWC_READ_REG32(&dev_if->in_ep_regs[i]->dieptsiz); ++ depctl.d32 = ++ DWC_READ_REG32(&dev_if->in_ep_regs[i]->diepctl); ++ ++ if (depctl.b.epdis && deptsiz.d32) { ++ set_current_pkt_info(GET_CORE_IF(pcd), dwc_ep); ++ if (dwc_ep->cur_pkt >= dwc_ep->pkt_cnt) { ++ dwc_ep->cur_pkt = 0; ++ dwc_ep->proc_buf_num = ++ (dwc_ep->proc_buf_num ^ 1) & 0x1; ++ ++ if (dwc_ep->proc_buf_num) { ++ dwc_ep->cur_pkt_addr = ++ dwc_ep->xfer_buff1; ++ dwc_ep->cur_pkt_dma_addr = ++ dwc_ep->dma_addr1; ++ } else { ++ dwc_ep->cur_pkt_addr = ++ dwc_ep->xfer_buff0; ++ dwc_ep->cur_pkt_dma_addr = ++ dwc_ep->dma_addr0; ++ } ++ ++ } ++ ++ dsts.d32 = ++ DWC_READ_REG32(&GET_CORE_IF(pcd)->dev_if-> ++ dev_global_regs->dsts); ++ dwc_ep->next_frame = dsts.b.soffn; ++ ++ dwc_otg_iso_ep_start_frm_transfer(GET_CORE_IF ++ (pcd), ++ dwc_ep); ++ } ++ } ++ } ++ ++#else ++ depctl_data_t depctl = {.d32 = 0 }; ++ dwc_ep_t *dwc_ep; ++ dwc_otg_dev_if_t *dev_if; ++ int i; ++ dev_if = GET_CORE_IF(pcd)->dev_if; ++ ++ DWC_DEBUGPL(DBG_PCD,"Incomplete ISO IN \n"); ++ ++ for (i = 1; i <= dev_if->num_in_eps; ++i) { ++ dwc_ep = &pcd->in_ep[i-1].dwc_ep; ++ depctl.d32 = ++ DWC_READ_REG32(&dev_if->in_ep_regs[i]->diepctl); ++ if (depctl.b.epena && dwc_ep->type == DWC_OTG_EP_TYPE_ISOC) { ++ if (drop_transfer(dwc_ep->frame_num, GET_CORE_IF(pcd)->frame_num, ++ dwc_ep->frm_overrun)) ++ { ++ depctl.d32 = ++ DWC_READ_REG32(&dev_if->in_ep_regs[i]->diepctl); ++ depctl.b.snak = 1; ++ depctl.b.epdis = 1; ++ DWC_MODIFY_REG32(&dev_if->in_ep_regs[i]->diepctl, depctl.d32, depctl.d32); ++ } ++ } ++ } ++ ++ /*intr_mask.b.incomplisoin = 1; ++ DWC_MODIFY_REG32(&GET_CORE_IF(pcd)->core_global_regs->gintmsk, ++ intr_mask.d32, 0); */ ++#endif //DWC_EN_ISOC ++ ++ /* Clear interrupt */ ++ gintsts.d32 = 0; ++ gintsts.b.incomplisoin = 1; ++ DWC_WRITE_REG32(&GET_CORE_IF(pcd)->core_global_regs->gintsts, ++ gintsts.d32); ++ ++ return 1; ++} ++ ++/** ++ * Incomplete ISO OUT Transfer Interrupt. ++ * ++ * This interrupt indicates that the core has dropped an ISO OUT ++ * packet. The following conditions can be the cause: ++ * - FIFO Full, the entire packet would not fit in the FIFO. ++ * - CRC Error ++ * - Corrupted Token ++ * The follow actions will be taken: ++ * -# Determine the EP ++ * -# Set incomplete flag in dwc_ep structure ++ * -# Read any data from the FIFO ++ * -# Disable EP. When "Endpoint Disabled" interrupt is received ++ * re-enable EP. ++ */ ++int32_t dwc_otg_pcd_handle_incomplete_isoc_out_intr(dwc_otg_pcd_t * pcd) ++{ ++ ++ gintsts_data_t gintsts; ++ ++#ifdef DWC_EN_ISOC ++ dwc_otg_dev_if_t *dev_if; ++ deptsiz_data_t deptsiz = {.d32 = 0 }; ++ depctl_data_t depctl = {.d32 = 0 }; ++ dsts_data_t dsts = {.d32 = 0 }; ++ dwc_ep_t *dwc_ep; ++ int i; ++ ++ dev_if = GET_CORE_IF(pcd)->dev_if; ++ ++ for (i = 1; i <= dev_if->num_out_eps; ++i) { ++ dwc_ep = &pcd->in_ep[i].dwc_ep; ++ if (pcd->out_ep[i].dwc_ep.active && ++ pcd->out_ep[i].dwc_ep.type == DWC_OTG_EP_TYPE_ISOC) { ++ deptsiz.d32 = ++ DWC_READ_REG32(&dev_if->out_ep_regs[i]->doeptsiz); ++ depctl.d32 = ++ DWC_READ_REG32(&dev_if->out_ep_regs[i]->doepctl); ++ ++ if (depctl.b.epdis && deptsiz.d32) { ++ set_current_pkt_info(GET_CORE_IF(pcd), ++ &pcd->out_ep[i].dwc_ep); ++ if (dwc_ep->cur_pkt >= dwc_ep->pkt_cnt) { ++ dwc_ep->cur_pkt = 0; ++ dwc_ep->proc_buf_num = ++ (dwc_ep->proc_buf_num ^ 1) & 0x1; ++ ++ if (dwc_ep->proc_buf_num) { ++ dwc_ep->cur_pkt_addr = ++ dwc_ep->xfer_buff1; ++ dwc_ep->cur_pkt_dma_addr = ++ dwc_ep->dma_addr1; ++ } else { ++ dwc_ep->cur_pkt_addr = ++ dwc_ep->xfer_buff0; ++ dwc_ep->cur_pkt_dma_addr = ++ dwc_ep->dma_addr0; ++ } ++ ++ } ++ ++ dsts.d32 = ++ DWC_READ_REG32(&GET_CORE_IF(pcd)->dev_if-> ++ dev_global_regs->dsts); ++ dwc_ep->next_frame = dsts.b.soffn; ++ ++ dwc_otg_iso_ep_start_frm_transfer(GET_CORE_IF ++ (pcd), ++ dwc_ep); ++ } ++ } ++ } ++#else ++ /** @todo implement ISR */ ++ gintmsk_data_t intr_mask = {.d32 = 0 }; ++ dwc_otg_core_if_t *core_if; ++ deptsiz_data_t deptsiz = {.d32 = 0 }; ++ depctl_data_t depctl = {.d32 = 0 }; ++ dctl_data_t dctl = {.d32 = 0 }; ++ dwc_ep_t *dwc_ep = NULL; ++ int i; ++ core_if = GET_CORE_IF(pcd); ++ ++ for (i = 0; i < core_if->dev_if->num_out_eps; ++i) { ++ dwc_ep = &pcd->out_ep[i].dwc_ep; ++ depctl.d32 = ++ DWC_READ_REG32(&core_if->dev_if->out_ep_regs[dwc_ep->num]->doepctl); ++ if (depctl.b.epena && depctl.b.dpid == (core_if->frame_num & 0x1)) { ++ core_if->dev_if->isoc_ep = dwc_ep; ++ deptsiz.d32 = ++ DWC_READ_REG32(&core_if->dev_if->out_ep_regs[dwc_ep->num]->doeptsiz); ++ break; ++ } ++ } ++ dctl.d32 = DWC_READ_REG32(&core_if->dev_if->dev_global_regs->dctl); ++ gintsts.d32 = DWC_READ_REG32(&core_if->core_global_regs->gintsts); ++ intr_mask.d32 = DWC_READ_REG32(&core_if->core_global_regs->gintmsk); ++ ++ if (!intr_mask.b.goutnakeff) { ++ /* Unmask it */ ++ intr_mask.b.goutnakeff = 1; ++ DWC_WRITE_REG32(&core_if->core_global_regs->gintmsk, intr_mask.d32); ++ } ++ if (!gintsts.b.goutnakeff) { ++ dctl.b.sgoutnak = 1; ++ } ++ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->dctl, dctl.d32); ++ ++ depctl.d32 = DWC_READ_REG32(&core_if->dev_if->out_ep_regs[dwc_ep->num]->doepctl); ++ if (depctl.b.epena) { ++ depctl.b.epdis = 1; ++ depctl.b.snak = 1; ++ } ++ DWC_WRITE_REG32(&core_if->dev_if->out_ep_regs[dwc_ep->num]->doepctl, depctl.d32); ++ ++ intr_mask.d32 = 0; ++ intr_mask.b.incomplisoout = 1; ++ ++#endif /* DWC_EN_ISOC */ ++ ++ /* Clear interrupt */ ++ gintsts.d32 = 0; ++ gintsts.b.incomplisoout = 1; ++ DWC_WRITE_REG32(&GET_CORE_IF(pcd)->core_global_regs->gintsts, ++ gintsts.d32); ++ ++ return 1; ++} ++ ++/** ++ * This function handles the Global IN NAK Effective interrupt. ++ * ++ */ ++int32_t dwc_otg_pcd_handle_in_nak_effective(dwc_otg_pcd_t * pcd) ++{ ++ dwc_otg_dev_if_t *dev_if = GET_CORE_IF(pcd)->dev_if; ++ depctl_data_t diepctl = {.d32 = 0 }; ++ gintmsk_data_t intr_mask = {.d32 = 0 }; ++ gintsts_data_t gintsts; ++ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); ++ int i; ++ ++ DWC_DEBUGPL(DBG_PCD, "Global IN NAK Effective\n"); ++ ++ /* Disable all active IN EPs */ ++ for (i = 0; i <= dev_if->num_in_eps; i++) { ++ diepctl.d32 = DWC_READ_REG32(&dev_if->in_ep_regs[i]->diepctl); ++ if (!(diepctl.b.eptype & 1) && diepctl.b.epena) { ++ if (core_if->start_predict > 0) ++ core_if->start_predict++; ++ diepctl.b.epdis = 1; ++ diepctl.b.snak = 1; ++ DWC_WRITE_REG32(&dev_if->in_ep_regs[i]->diepctl, diepctl.d32); ++ } ++ } ++ ++ ++ /* Disable the Global IN NAK Effective Interrupt */ ++ intr_mask.b.ginnakeff = 1; ++ DWC_MODIFY_REG32(&GET_CORE_IF(pcd)->core_global_regs->gintmsk, ++ intr_mask.d32, 0); ++ ++ /* Clear interrupt */ ++ gintsts.d32 = 0; ++ gintsts.b.ginnakeff = 1; ++ DWC_WRITE_REG32(&GET_CORE_IF(pcd)->core_global_regs->gintsts, ++ gintsts.d32); ++ ++ return 1; ++} ++ ++/** ++ * OUT NAK Effective. ++ * ++ */ ++int32_t dwc_otg_pcd_handle_out_nak_effective(dwc_otg_pcd_t * pcd) ++{ ++ dwc_otg_dev_if_t *dev_if = GET_CORE_IF(pcd)->dev_if; ++ gintmsk_data_t intr_mask = {.d32 = 0 }; ++ gintsts_data_t gintsts; ++ depctl_data_t doepctl; ++ int i; ++ ++ /* Disable the Global OUT NAK Effective Interrupt */ ++ intr_mask.b.goutnakeff = 1; ++ DWC_MODIFY_REG32(&GET_CORE_IF(pcd)->core_global_regs->gintmsk, ++ intr_mask.d32, 0); ++ ++ /* If DEV OUT NAK enabled*/ ++ if (pcd->core_if->core_params->dev_out_nak) { ++ /* Run over all out endpoints to determine the ep number on ++ * which the timeout has happened ++ */ ++ for (i = 0; i <= dev_if->num_out_eps; i++) { ++ if ( pcd->core_if->ep_xfer_info[i].state == 2 ) ++ break; ++ } ++ if (i > dev_if->num_out_eps) { ++ dctl_data_t dctl; ++ dctl.d32 = ++ DWC_READ_REG32(&dev_if->dev_global_regs->dctl); ++ dctl.b.cgoutnak = 1; ++ DWC_WRITE_REG32(&dev_if->dev_global_regs->dctl, ++ dctl.d32); ++ goto out; ++ } ++ ++ /* Disable the endpoint */ ++ doepctl.d32 = DWC_READ_REG32(&dev_if->out_ep_regs[i]->doepctl); ++ if (doepctl.b.epena) { ++ doepctl.b.epdis = 1; ++ doepctl.b.snak = 1; ++ } ++ DWC_WRITE_REG32(&dev_if->out_ep_regs[i]->doepctl, doepctl.d32); ++ return 1; ++ } ++ /* We come here from Incomplete ISO OUT handler */ ++ if (dev_if->isoc_ep) { ++ dwc_ep_t *dwc_ep = (dwc_ep_t *)dev_if->isoc_ep; ++ uint32_t epnum = dwc_ep->num; ++ doepint_data_t doepint; ++ doepint.d32 = ++ DWC_READ_REG32(&dev_if->out_ep_regs[dwc_ep->num]->doepint); ++ dev_if->isoc_ep = NULL; ++ doepctl.d32 = ++ DWC_READ_REG32(&dev_if->out_ep_regs[epnum]->doepctl); ++ DWC_PRINTF("Before disable DOEPCTL = %08x\n", doepctl.d32); ++ if (doepctl.b.epena) { ++ doepctl.b.epdis = 1; ++ doepctl.b.snak = 1; ++ } ++ DWC_WRITE_REG32(&dev_if->out_ep_regs[epnum]->doepctl, ++ doepctl.d32); ++ return 1; ++ } else ++ DWC_PRINTF("INTERRUPT Handler not implemented for %s\n", ++ "Global OUT NAK Effective\n"); ++ ++out: ++ /* Clear interrupt */ ++ gintsts.d32 = 0; ++ gintsts.b.goutnakeff = 1; ++ DWC_WRITE_REG32(&GET_CORE_IF(pcd)->core_global_regs->gintsts, ++ gintsts.d32); ++ ++ return 1; ++} ++ ++/** ++ * PCD interrupt handler. ++ * ++ * The PCD handles the device interrupts. Many conditions can cause a ++ * device interrupt. When an interrupt occurs, the device interrupt ++ * service routine determines the cause of the interrupt and ++ * dispatches handling to the appropriate function. These interrupt ++ * handling functions are described below. ++ * ++ * All interrupt registers are processed from LSB to MSB. ++ * ++ */ ++int32_t dwc_otg_pcd_handle_intr(dwc_otg_pcd_t * pcd) ++{ ++ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); ++#ifdef VERBOSE ++ dwc_otg_core_global_regs_t *global_regs = core_if->core_global_regs; ++#endif ++ gintsts_data_t gintr_status; ++ int32_t retval = 0; ++ ++ /* Exit from ISR if core is hibernated */ ++ if (core_if->hibernation_suspend == 1) { ++ return retval; ++ } ++#ifdef VERBOSE ++ DWC_DEBUGPL(DBG_ANY, "%s() gintsts=%08x gintmsk=%08x\n", ++ __func__, ++ DWC_READ_REG32(&global_regs->gintsts), ++ DWC_READ_REG32(&global_regs->gintmsk)); ++#endif ++ ++ if (dwc_otg_is_device_mode(core_if)) { ++ DWC_SPINLOCK(pcd->lock); ++#ifdef VERBOSE ++ DWC_DEBUGPL(DBG_PCDV, "%s() gintsts=%08x gintmsk=%08x\n", ++ __func__, ++ DWC_READ_REG32(&global_regs->gintsts), ++ DWC_READ_REG32(&global_regs->gintmsk)); ++#endif ++ ++ gintr_status.d32 = dwc_otg_read_core_intr(core_if); ++ ++ DWC_DEBUGPL(DBG_PCDV, "%s: gintsts&gintmsk=%08x\n", ++ __func__, gintr_status.d32); ++ ++ if (gintr_status.b.sofintr) { ++ retval |= dwc_otg_pcd_handle_sof_intr(pcd); ++ } ++ if (gintr_status.b.rxstsqlvl) { ++ retval |= ++ dwc_otg_pcd_handle_rx_status_q_level_intr(pcd); ++ } ++ if (gintr_status.b.nptxfempty) { ++ retval |= dwc_otg_pcd_handle_np_tx_fifo_empty_intr(pcd); ++ } ++ if (gintr_status.b.goutnakeff) { ++ retval |= dwc_otg_pcd_handle_out_nak_effective(pcd); ++ } ++ if (gintr_status.b.i2cintr) { ++ retval |= dwc_otg_pcd_handle_i2c_intr(pcd); ++ } ++ if (gintr_status.b.erlysuspend) { ++ retval |= dwc_otg_pcd_handle_early_suspend_intr(pcd); ++ } ++ if (gintr_status.b.usbreset) { ++ retval |= dwc_otg_pcd_handle_usb_reset_intr(pcd); ++ } ++ if (gintr_status.b.enumdone) { ++ retval |= dwc_otg_pcd_handle_enum_done_intr(pcd); ++ } ++ if (gintr_status.b.isooutdrop) { ++ retval |= ++ dwc_otg_pcd_handle_isoc_out_packet_dropped_intr ++ (pcd); ++ } ++ if (gintr_status.b.eopframe) { ++ retval |= ++ dwc_otg_pcd_handle_end_periodic_frame_intr(pcd); ++ } ++ if (gintr_status.b.inepint) { ++ if (!core_if->multiproc_int_enable) { ++ retval |= dwc_otg_pcd_handle_in_ep_intr(pcd); ++ } ++ } ++ if (gintr_status.b.outepintr) { ++ if (!core_if->multiproc_int_enable) { ++ retval |= dwc_otg_pcd_handle_out_ep_intr(pcd); ++ } ++ } ++ if (gintr_status.b.epmismatch) { ++ retval |= dwc_otg_pcd_handle_ep_mismatch_intr(pcd); ++ } ++ if (gintr_status.b.fetsusp) { ++ retval |= dwc_otg_pcd_handle_ep_fetsusp_intr(pcd); ++ } ++ if (gintr_status.b.ginnakeff) { ++ retval |= dwc_otg_pcd_handle_in_nak_effective(pcd); ++ } ++ if (gintr_status.b.incomplisoin) { ++ retval |= ++ dwc_otg_pcd_handle_incomplete_isoc_in_intr(pcd); ++ } ++ if (gintr_status.b.incomplisoout) { ++ retval |= ++ dwc_otg_pcd_handle_incomplete_isoc_out_intr(pcd); ++ } ++ ++ /* In MPI mode Device Endpoints interrupts are asserted ++ * without setting outepintr and inepint bits set, so these ++ * Interrupt handlers are called without checking these bit-fields ++ */ ++ if (core_if->multiproc_int_enable) { ++ retval |= dwc_otg_pcd_handle_in_ep_intr(pcd); ++ retval |= dwc_otg_pcd_handle_out_ep_intr(pcd); ++ } ++#ifdef VERBOSE ++ DWC_DEBUGPL(DBG_PCDV, "%s() gintsts=%0x\n", __func__, ++ DWC_READ_REG32(&global_regs->gintsts)); ++#endif ++ DWC_SPINUNLOCK(pcd->lock); ++ } ++ return retval; ++} ++ ++#endif /* DWC_HOST_ONLY */ +diff --git a/drivers/usb/host/dwc_otg/dwc_otg_pcd_linux.c b/drivers/usb/host/dwc_otg/dwc_otg_pcd_linux.c +new file mode 100644 +index 0000000..0eb0f35 +--- /dev/null ++++ b/drivers/usb/host/dwc_otg/dwc_otg_pcd_linux.c +@@ -0,0 +1,1280 @@ ++ /* ========================================================================== ++ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_pcd_linux.c $ ++ * $Revision: #21 $ ++ * $Date: 2012/08/10 $ ++ * $Change: 2047372 $ ++ * ++ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, ++ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless ++ * otherwise expressly agreed to in writing between Synopsys and you. ++ * ++ * The Software IS NOT an item of Licensed Software or Licensed Product under ++ * any End User Software License Agreement or Agreement for Licensed Product ++ * with Synopsys or any supplement thereto. You are permitted to use and ++ * redistribute this Software in source and binary forms, with or without ++ * modification, provided that redistributions of source code must retain this ++ * notice. You may not view, use, disclose, copy or distribute this file or ++ * any information contained herein except pursuant to this license grant from ++ * Synopsys. If you do not agree with this notice, including the disclaimer ++ * below, then you are not authorized to use the Software. ++ * ++ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS ++ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS 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. ++ * ========================================================================== */ ++#ifndef DWC_HOST_ONLY ++ ++/** @file ++ * This file implements the Peripheral Controller Driver. ++ * ++ * The Peripheral Controller Driver (PCD) is responsible for ++ * translating requests from the Function Driver into the appropriate ++ * actions on the DWC_otg controller. It isolates the Function Driver ++ * from the specifics of the controller by providing an API to the ++ * Function Driver. ++ * ++ * The Peripheral Controller Driver for Linux will implement the ++ * Gadget API, so that the existing Gadget drivers can be used. ++ * (Gadget Driver is the Linux terminology for a Function Driver.) ++ * ++ * The Linux Gadget API is defined in the header file ++ * <code><linux/usb_gadget.h></code>. The USB EP operations API is ++ * defined in the structure <code>usb_ep_ops</code> and the USB ++ * Controller API is defined in the structure ++ * <code>usb_gadget_ops</code>. ++ * ++ */ ++ ++#include "dwc_otg_os_dep.h" ++#include "dwc_otg_pcd_if.h" ++#include "dwc_otg_pcd.h" ++#include "dwc_otg_driver.h" ++#include "dwc_otg_dbg.h" ++ ++extern bool fiq_enable; ++ ++static struct gadget_wrapper { ++ dwc_otg_pcd_t *pcd; ++ ++ struct usb_gadget gadget; ++ struct usb_gadget_driver *driver; ++ ++ struct usb_ep ep0; ++ struct usb_ep in_ep[16]; ++ struct usb_ep out_ep[16]; ++ ++} *gadget_wrapper; ++ ++/* Display the contents of the buffer */ ++extern void dump_msg(const u8 * buf, unsigned int length); ++/** ++ * Get the dwc_otg_pcd_ep_t* from usb_ep* pointer - NULL in case ++ * if the endpoint is not found ++ */ ++static struct dwc_otg_pcd_ep *ep_from_handle(dwc_otg_pcd_t * pcd, void *handle) ++{ ++ int i; ++ if (pcd->ep0.priv == handle) { ++ return &pcd->ep0; ++ } ++ ++ for (i = 0; i < MAX_EPS_CHANNELS - 1; i++) { ++ if (pcd->in_ep[i].priv == handle) ++ return &pcd->in_ep[i]; ++ if (pcd->out_ep[i].priv == handle) ++ return &pcd->out_ep[i]; ++ } ++ ++ return NULL; ++} ++ ++/* USB Endpoint Operations */ ++/* ++ * The following sections briefly describe the behavior of the Gadget ++ * API endpoint operations implemented in the DWC_otg driver ++ * software. Detailed descriptions of the generic behavior of each of ++ * these functions can be found in the Linux header file ++ * include/linux/usb_gadget.h. ++ * ++ * The Gadget API provides wrapper functions for each of the function ++ * pointers defined in usb_ep_ops. The Gadget Driver calls the wrapper ++ * function, which then calls the underlying PCD function. The ++ * following sections are named according to the wrapper ++ * functions. Within each section, the corresponding DWC_otg PCD ++ * function name is specified. ++ * ++ */ ++ ++/** ++ * This function is called by the Gadget Driver for each EP to be ++ * configured for the current configuration (SET_CONFIGURATION). ++ * ++ * This function initializes the dwc_otg_ep_t data structure, and then ++ * calls dwc_otg_ep_activate. ++ */ ++static int ep_enable(struct usb_ep *usb_ep, ++ const struct usb_endpoint_descriptor *ep_desc) ++{ ++ int retval; ++ ++ DWC_DEBUGPL(DBG_PCDV, "%s(%p,%p)\n", __func__, usb_ep, ep_desc); ++ ++ if (!usb_ep || !ep_desc || ep_desc->bDescriptorType != USB_DT_ENDPOINT) { ++ DWC_WARN("%s, bad ep or descriptor\n", __func__); ++ return -EINVAL; ++ } ++ if (usb_ep == &gadget_wrapper->ep0) { ++ DWC_WARN("%s, bad ep(0)\n", __func__); ++ return -EINVAL; ++ } ++ ++ /* Check FIFO size? */ ++ if (!ep_desc->wMaxPacketSize) { ++ DWC_WARN("%s, bad %s maxpacket\n", __func__, usb_ep->name); ++ return -ERANGE; ++ } ++ ++ if (!gadget_wrapper->driver || ++ gadget_wrapper->gadget.speed == USB_SPEED_UNKNOWN) { ++ DWC_WARN("%s, bogus device state\n", __func__); ++ return -ESHUTDOWN; ++ } ++ ++ /* Delete after check - MAS */ ++#if 0 ++ nat = (uint32_t) ep_desc->wMaxPacketSize; ++ printk(KERN_ALERT "%s: nat (before) =%d\n", __func__, nat); ++ nat = (nat >> 11) & 0x03; ++ printk(KERN_ALERT "%s: nat (after) =%d\n", __func__, nat); ++#endif ++ retval = dwc_otg_pcd_ep_enable(gadget_wrapper->pcd, ++ (const uint8_t *)ep_desc, ++ (void *)usb_ep); ++ if (retval) { ++ DWC_WARN("dwc_otg_pcd_ep_enable failed\n"); ++ return -EINVAL; ++ } ++ ++ usb_ep->maxpacket = le16_to_cpu(ep_desc->wMaxPacketSize); ++ ++ return 0; ++} ++ ++/** ++ * This function is called when an EP is disabled due to disconnect or ++ * change in configuration. Any pending requests will terminate with a ++ * status of -ESHUTDOWN. ++ * ++ * This function modifies the dwc_otg_ep_t data structure for this EP, ++ * and then calls dwc_otg_ep_deactivate. ++ */ ++static int ep_disable(struct usb_ep *usb_ep) ++{ ++ int retval; ++ ++ DWC_DEBUGPL(DBG_PCDV, "%s(%p)\n", __func__, usb_ep); ++ if (!usb_ep) { ++ DWC_DEBUGPL(DBG_PCD, "%s, %s not enabled\n", __func__, ++ usb_ep ? usb_ep->name : NULL); ++ return -EINVAL; ++ } ++ ++ retval = dwc_otg_pcd_ep_disable(gadget_wrapper->pcd, usb_ep); ++ if (retval) { ++ retval = -EINVAL; ++ } ++ ++ return retval; ++} ++ ++/** ++ * This function allocates a request object to use with the specified ++ * endpoint. ++ * ++ * @param ep The endpoint to be used with with the request ++ * @param gfp_flags the GFP_* flags to use. ++ */ ++static struct usb_request *dwc_otg_pcd_alloc_request(struct usb_ep *ep, ++ gfp_t gfp_flags) ++{ ++ struct usb_request *usb_req; ++ ++ DWC_DEBUGPL(DBG_PCDV, "%s(%p,%d)\n", __func__, ep, gfp_flags); ++ if (0 == ep) { ++ DWC_WARN("%s() %s\n", __func__, "Invalid EP!\n"); ++ return 0; ++ } ++ usb_req = kmalloc(sizeof(*usb_req), gfp_flags); ++ if (0 == usb_req) { ++ DWC_WARN("%s() %s\n", __func__, "request allocation failed!\n"); ++ return 0; ++ } ++ memset(usb_req, 0, sizeof(*usb_req)); ++ usb_req->dma = DWC_DMA_ADDR_INVALID; ++ ++ return usb_req; ++} ++ ++/** ++ * This function frees a request object. ++ * ++ * @param ep The endpoint associated with the request ++ * @param req The request being freed ++ */ ++static void dwc_otg_pcd_free_request(struct usb_ep *ep, struct usb_request *req) ++{ ++ DWC_DEBUGPL(DBG_PCDV, "%s(%p,%p)\n", __func__, ep, req); ++ ++ if (0 == ep || 0 == req) { ++ DWC_WARN("%s() %s\n", __func__, ++ "Invalid ep or req argument!\n"); ++ return; ++ } ++ ++ kfree(req); ++} ++ ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) ++/** ++ * This function allocates an I/O buffer to be used for a transfer ++ * to/from the specified endpoint. ++ * ++ * @param usb_ep The endpoint to be used with with the request ++ * @param bytes The desired number of bytes for the buffer ++ * @param dma Pointer to the buffer's DMA address; must be valid ++ * @param gfp_flags the GFP_* flags to use. ++ * @return address of a new buffer or null is buffer could not be allocated. ++ */ ++static void *dwc_otg_pcd_alloc_buffer(struct usb_ep *usb_ep, unsigned bytes, ++ dma_addr_t * dma, gfp_t gfp_flags) ++{ ++ void *buf; ++ dwc_otg_pcd_t *pcd = 0; ++ ++ pcd = gadget_wrapper->pcd; ++ ++ DWC_DEBUGPL(DBG_PCDV, "%s(%p,%d,%p,%0x)\n", __func__, usb_ep, bytes, ++ dma, gfp_flags); ++ ++ /* Check dword alignment */ ++ if ((bytes & 0x3UL) != 0) { ++ DWC_WARN("%s() Buffer size is not a multiple of" ++ "DWORD size (%d)", __func__, bytes); ++ } ++ ++ buf = dma_alloc_coherent(NULL, bytes, dma, gfp_flags); ++ ++ /* Check dword alignment */ ++ if (((int)buf & 0x3UL) != 0) { ++ DWC_WARN("%s() Buffer is not DWORD aligned (%p)", ++ __func__, buf); ++ } ++ ++ return buf; ++} ++ ++/** ++ * This function frees an I/O buffer that was allocated by alloc_buffer. ++ * ++ * @param usb_ep the endpoint associated with the buffer ++ * @param buf address of the buffer ++ * @param dma The buffer's DMA address ++ * @param bytes The number of bytes of the buffer ++ */ ++static void dwc_otg_pcd_free_buffer(struct usb_ep *usb_ep, void *buf, ++ dma_addr_t dma, unsigned bytes) ++{ ++ dwc_otg_pcd_t *pcd = 0; ++ ++ pcd = gadget_wrapper->pcd; ++ ++ DWC_DEBUGPL(DBG_PCDV, "%s(%p,%0x,%d)\n", __func__, buf, dma, bytes); ++ ++ dma_free_coherent(NULL, bytes, buf, dma); ++} ++#endif ++ ++/** ++ * This function is used to submit an I/O Request to an EP. ++ * ++ * - When the request completes the request's completion callback ++ * is called to return the request to the driver. ++ * - An EP, except control EPs, may have multiple requests ++ * pending. ++ * - Once submitted the request cannot be examined or modified. ++ * - Each request is turned into one or more packets. ++ * - A BULK EP can queue any amount of data; the transfer is ++ * packetized. ++ * - Zero length Packets are specified with the request 'zero' ++ * flag. ++ */ ++static int ep_queue(struct usb_ep *usb_ep, struct usb_request *usb_req, ++ gfp_t gfp_flags) ++{ ++ dwc_otg_pcd_t *pcd; ++ struct dwc_otg_pcd_ep *ep = NULL; ++ int retval = 0, is_isoc_ep = 0; ++ dma_addr_t dma_addr = DWC_DMA_ADDR_INVALID; ++ ++ DWC_DEBUGPL(DBG_PCDV, "%s(%p,%p,%d)\n", ++ __func__, usb_ep, usb_req, gfp_flags); ++ ++ if (!usb_req || !usb_req->complete || !usb_req->buf) { ++ DWC_WARN("bad params\n"); ++ return -EINVAL; ++ } ++ ++ if (!usb_ep) { ++ DWC_WARN("bad ep\n"); ++ return -EINVAL; ++ } ++ ++ pcd = gadget_wrapper->pcd; ++ if (!gadget_wrapper->driver || ++ gadget_wrapper->gadget.speed == USB_SPEED_UNKNOWN) { ++ DWC_DEBUGPL(DBG_PCDV, "gadget.speed=%d\n", ++ gadget_wrapper->gadget.speed); ++ DWC_WARN("bogus device state\n"); ++ return -ESHUTDOWN; ++ } ++ ++ DWC_DEBUGPL(DBG_PCD, "%s queue req %p, len %d buf %p\n", ++ usb_ep->name, usb_req, usb_req->length, usb_req->buf); ++ ++ usb_req->status = -EINPROGRESS; ++ usb_req->actual = 0; ++ ++ ep = ep_from_handle(pcd, usb_ep); ++ if (ep == NULL) ++ is_isoc_ep = 0; ++ else ++ is_isoc_ep = (ep->dwc_ep.type == DWC_OTG_EP_TYPE_ISOC) ? 1 : 0; ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) ++ dma_addr = usb_req->dma; ++#else ++ if (GET_CORE_IF(pcd)->dma_enable) { ++ dwc_otg_device_t *otg_dev = gadget_wrapper->pcd->otg_dev; ++ struct device *dev = NULL; ++ ++ if (otg_dev != NULL) ++ dev = DWC_OTG_OS_GETDEV(otg_dev->os_dep); ++ ++ if (usb_req->length != 0 && ++ usb_req->dma == DWC_DMA_ADDR_INVALID) { ++ dma_addr = dma_map_single(dev, usb_req->buf, ++ usb_req->length, ++ ep->dwc_ep.is_in ? ++ DMA_TO_DEVICE: ++ DMA_FROM_DEVICE); ++ } ++ } ++#endif ++ ++#ifdef DWC_UTE_PER_IO ++ if (is_isoc_ep == 1) { ++ retval = dwc_otg_pcd_xiso_ep_queue(pcd, usb_ep, usb_req->buf, dma_addr, ++ usb_req->length, usb_req->zero, usb_req, ++ gfp_flags == GFP_ATOMIC ? 1 : 0, &usb_req->ext_req); ++ if (retval) ++ return -EINVAL; ++ ++ return 0; ++ } ++#endif ++ retval = dwc_otg_pcd_ep_queue(pcd, usb_ep, usb_req->buf, dma_addr, ++ usb_req->length, usb_req->zero, usb_req, ++ gfp_flags == GFP_ATOMIC ? 1 : 0); ++ if (retval) { ++ return -EINVAL; ++ } ++ ++ return 0; ++} ++ ++/** ++ * This function cancels an I/O request from an EP. ++ */ ++static int ep_dequeue(struct usb_ep *usb_ep, struct usb_request *usb_req) ++{ ++ DWC_DEBUGPL(DBG_PCDV, "%s(%p,%p)\n", __func__, usb_ep, usb_req); ++ ++ if (!usb_ep || !usb_req) { ++ DWC_WARN("bad argument\n"); ++ return -EINVAL; ++ } ++ if (!gadget_wrapper->driver || ++ gadget_wrapper->gadget.speed == USB_SPEED_UNKNOWN) { ++ DWC_WARN("bogus device state\n"); ++ return -ESHUTDOWN; ++ } ++ if (dwc_otg_pcd_ep_dequeue(gadget_wrapper->pcd, usb_ep, usb_req)) { ++ return -EINVAL; ++ } ++ ++ return 0; ++} ++ ++/** ++ * usb_ep_set_halt stalls an endpoint. ++ * ++ * usb_ep_clear_halt clears an endpoint halt and resets its data ++ * toggle. ++ * ++ * Both of these functions are implemented with the same underlying ++ * function. The behavior depends on the value argument. ++ * ++ * @param[in] usb_ep the Endpoint to halt or clear halt. ++ * @param[in] value ++ * - 0 means clear_halt. ++ * - 1 means set_halt, ++ * - 2 means clear stall lock flag. ++ * - 3 means set stall lock flag. ++ */ ++static int ep_halt(struct usb_ep *usb_ep, int value) ++{ ++ int retval = 0; ++ ++ DWC_DEBUGPL(DBG_PCD, "HALT %s %d\n", usb_ep->name, value); ++ ++ if (!usb_ep) { ++ DWC_WARN("bad ep\n"); ++ return -EINVAL; ++ } ++ ++ retval = dwc_otg_pcd_ep_halt(gadget_wrapper->pcd, usb_ep, value); ++ if (retval == -DWC_E_AGAIN) { ++ return -EAGAIN; ++ } else if (retval) { ++ retval = -EINVAL; ++ } ++ ++ return retval; ++} ++ ++//#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,30)) ++#if 0 ++/** ++ * ep_wedge: sets the halt feature and ignores clear requests ++ * ++ * @usb_ep: the endpoint being wedged ++ * ++ * Use this to stall an endpoint and ignore CLEAR_FEATURE(HALT_ENDPOINT) ++ * requests. If the gadget driver clears the halt status, it will ++ * automatically unwedge the endpoint. ++ * ++ * Returns zero on success, else negative errno. * ++ * Check usb_ep_set_wedge() at "usb_gadget.h" for details ++ */ ++static int ep_wedge(struct usb_ep *usb_ep) ++{ ++ int retval = 0; ++ ++ DWC_DEBUGPL(DBG_PCD, "WEDGE %s\n", usb_ep->name); ++ ++ if (!usb_ep) { ++ DWC_WARN("bad ep\n"); ++ return -EINVAL; ++ } ++ ++ retval = dwc_otg_pcd_ep_wedge(gadget_wrapper->pcd, usb_ep); ++ if (retval == -DWC_E_AGAIN) { ++ retval = -EAGAIN; ++ } else if (retval) { ++ retval = -EINVAL; ++ } ++ ++ return retval; ++} ++#endif ++ ++#ifdef DWC_EN_ISOC ++/** ++ * This function is used to submit an ISOC Transfer Request to an EP. ++ * ++ * - Every time a sync period completes the request's completion callback ++ * is called to provide data to the gadget driver. ++ * - Once submitted the request cannot be modified. ++ * - Each request is turned into periodic data packets untill ISO ++ * Transfer is stopped.. ++ */ ++static int iso_ep_start(struct usb_ep *usb_ep, struct usb_iso_request *req, ++ gfp_t gfp_flags) ++{ ++ int retval = 0; ++ ++ if (!req || !req->process_buffer || !req->buf0 || !req->buf1) { ++ DWC_WARN("bad params\n"); ++ return -EINVAL; ++ } ++ ++ if (!usb_ep) { ++ DWC_PRINTF("bad params\n"); ++ return -EINVAL; ++ } ++ ++ req->status = -EINPROGRESS; ++ ++ retval = ++ dwc_otg_pcd_iso_ep_start(gadget_wrapper->pcd, usb_ep, req->buf0, ++ req->buf1, req->dma0, req->dma1, ++ req->sync_frame, req->data_pattern_frame, ++ req->data_per_frame, ++ req-> ++ flags & USB_REQ_ISO_ASAP ? -1 : ++ req->start_frame, req->buf_proc_intrvl, ++ req, gfp_flags == GFP_ATOMIC ? 1 : 0); ++ ++ if (retval) { ++ return -EINVAL; ++ } ++ ++ return retval; ++} ++ ++/** ++ * This function stops ISO EP Periodic Data Transfer. ++ */ ++static int iso_ep_stop(struct usb_ep *usb_ep, struct usb_iso_request *req) ++{ ++ int retval = 0; ++ if (!usb_ep) { ++ DWC_WARN("bad ep\n"); ++ } ++ ++ if (!gadget_wrapper->driver || ++ gadget_wrapper->gadget.speed == USB_SPEED_UNKNOWN) { ++ DWC_DEBUGPL(DBG_PCDV, "gadget.speed=%d\n", ++ gadget_wrapper->gadget.speed); ++ DWC_WARN("bogus device state\n"); ++ } ++ ++ dwc_otg_pcd_iso_ep_stop(gadget_wrapper->pcd, usb_ep, req); ++ if (retval) { ++ retval = -EINVAL; ++ } ++ ++ return retval; ++} ++ ++static struct usb_iso_request *alloc_iso_request(struct usb_ep *ep, ++ int packets, gfp_t gfp_flags) ++{ ++ struct usb_iso_request *pReq = NULL; ++ uint32_t req_size; ++ ++ req_size = sizeof(struct usb_iso_request); ++ req_size += ++ (2 * packets * (sizeof(struct usb_gadget_iso_packet_descriptor))); ++ ++ pReq = kmalloc(req_size, gfp_flags); ++ if (!pReq) { ++ DWC_WARN("Can't allocate Iso Request\n"); ++ return 0; ++ } ++ pReq->iso_packet_desc0 = (void *)(pReq + 1); ++ ++ pReq->iso_packet_desc1 = pReq->iso_packet_desc0 + packets; ++ ++ return pReq; ++} ++ ++static void free_iso_request(struct usb_ep *ep, struct usb_iso_request *req) ++{ ++ kfree(req); ++} ++ ++static struct usb_isoc_ep_ops dwc_otg_pcd_ep_ops = { ++ .ep_ops = { ++ .enable = ep_enable, ++ .disable = ep_disable, ++ ++ .alloc_request = dwc_otg_pcd_alloc_request, ++ .free_request = dwc_otg_pcd_free_request, ++ ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) ++ .alloc_buffer = dwc_otg_pcd_alloc_buffer, ++ .free_buffer = dwc_otg_pcd_free_buffer, ++#endif ++ ++ .queue = ep_queue, ++ .dequeue = ep_dequeue, ++ ++ .set_halt = ep_halt, ++ .fifo_status = 0, ++ .fifo_flush = 0, ++ }, ++ .iso_ep_start = iso_ep_start, ++ .iso_ep_stop = iso_ep_stop, ++ .alloc_iso_request = alloc_iso_request, ++ .free_iso_request = free_iso_request, ++}; ++ ++#else ++ ++ int (*enable) (struct usb_ep *ep, ++ const struct usb_endpoint_descriptor *desc); ++ int (*disable) (struct usb_ep *ep); ++ ++ struct usb_request *(*alloc_request) (struct usb_ep *ep, ++ gfp_t gfp_flags); ++ void (*free_request) (struct usb_ep *ep, struct usb_request *req); ++ ++ int (*queue) (struct usb_ep *ep, struct usb_request *req, ++ gfp_t gfp_flags); ++ int (*dequeue) (struct usb_ep *ep, struct usb_request *req); ++ ++ int (*set_halt) (struct usb_ep *ep, int value); ++ int (*set_wedge) (struct usb_ep *ep); ++ ++ int (*fifo_status) (struct usb_ep *ep); ++ void (*fifo_flush) (struct usb_ep *ep); ++static struct usb_ep_ops dwc_otg_pcd_ep_ops = { ++ .enable = ep_enable, ++ .disable = ep_disable, ++ ++ .alloc_request = dwc_otg_pcd_alloc_request, ++ .free_request = dwc_otg_pcd_free_request, ++ ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) ++ .alloc_buffer = dwc_otg_pcd_alloc_buffer, ++ .free_buffer = dwc_otg_pcd_free_buffer, ++#else ++ /* .set_wedge = ep_wedge, */ ++ .set_wedge = NULL, /* uses set_halt instead */ ++#endif ++ ++ .queue = ep_queue, ++ .dequeue = ep_dequeue, ++ ++ .set_halt = ep_halt, ++ .fifo_status = 0, ++ .fifo_flush = 0, ++ ++}; ++ ++#endif /* _EN_ISOC_ */ ++/* Gadget Operations */ ++/** ++ * The following gadget operations will be implemented in the DWC_otg ++ * PCD. Functions in the API that are not described below are not ++ * implemented. ++ * ++ * The Gadget API provides wrapper functions for each of the function ++ * pointers defined in usb_gadget_ops. The Gadget Driver calls the ++ * wrapper function, which then calls the underlying PCD function. The ++ * following sections are named according to the wrapper functions ++ * (except for ioctl, which doesn't have a wrapper function). Within ++ * each section, the corresponding DWC_otg PCD function name is ++ * specified. ++ * ++ */ ++ ++/** ++ *Gets the USB Frame number of the last SOF. ++ */ ++static int get_frame_number(struct usb_gadget *gadget) ++{ ++ struct gadget_wrapper *d; ++ ++ DWC_DEBUGPL(DBG_PCDV, "%s(%p)\n", __func__, gadget); ++ ++ if (gadget == 0) { ++ return -ENODEV; ++ } ++ ++ d = container_of(gadget, struct gadget_wrapper, gadget); ++ return dwc_otg_pcd_get_frame_number(d->pcd); ++} ++ ++#ifdef CONFIG_USB_DWC_OTG_LPM ++static int test_lpm_enabled(struct usb_gadget *gadget) ++{ ++ struct gadget_wrapper *d; ++ ++ d = container_of(gadget, struct gadget_wrapper, gadget); ++ ++ return dwc_otg_pcd_is_lpm_enabled(d->pcd); ++} ++#endif ++ ++/** ++ * Initiates Session Request Protocol (SRP) to wakeup the host if no ++ * session is in progress. If a session is already in progress, but ++ * the device is suspended, remote wakeup signaling is started. ++ * ++ */ ++static int wakeup(struct usb_gadget *gadget) ++{ ++ struct gadget_wrapper *d; ++ ++ DWC_DEBUGPL(DBG_PCDV, "%s(%p)\n", __func__, gadget); ++ ++ if (gadget == 0) { ++ return -ENODEV; ++ } else { ++ d = container_of(gadget, struct gadget_wrapper, gadget); ++ } ++ dwc_otg_pcd_wakeup(d->pcd); ++ return 0; ++} ++ ++static const struct usb_gadget_ops dwc_otg_pcd_ops = { ++ .get_frame = get_frame_number, ++ .wakeup = wakeup, ++#ifdef CONFIG_USB_DWC_OTG_LPM ++ .lpm_support = test_lpm_enabled, ++#endif ++ // current versions must always be self-powered ++}; ++ ++static int _setup(dwc_otg_pcd_t * pcd, uint8_t * bytes) ++{ ++ int retval = -DWC_E_NOT_SUPPORTED; ++ if (gadget_wrapper->driver && gadget_wrapper->driver->setup) { ++ retval = gadget_wrapper->driver->setup(&gadget_wrapper->gadget, ++ (struct usb_ctrlrequest ++ *)bytes); ++ } ++ ++ if (retval == -ENOTSUPP) { ++ retval = -DWC_E_NOT_SUPPORTED; ++ } else if (retval < 0) { ++ retval = -DWC_E_INVALID; ++ } ++ ++ return retval; ++} ++ ++#ifdef DWC_EN_ISOC ++static int _isoc_complete(dwc_otg_pcd_t * pcd, void *ep_handle, ++ void *req_handle, int proc_buf_num) ++{ ++ int i, packet_count; ++ struct usb_gadget_iso_packet_descriptor *iso_packet = 0; ++ struct usb_iso_request *iso_req = req_handle; ++ ++ if (proc_buf_num) { ++ iso_packet = iso_req->iso_packet_desc1; ++ } else { ++ iso_packet = iso_req->iso_packet_desc0; ++ } ++ packet_count = ++ dwc_otg_pcd_get_iso_packet_count(pcd, ep_handle, req_handle); ++ for (i = 0; i < packet_count; ++i) { ++ int status; ++ int actual; ++ int offset; ++ dwc_otg_pcd_get_iso_packet_params(pcd, ep_handle, req_handle, ++ i, &status, &actual, &offset); ++ switch (status) { ++ case -DWC_E_NO_DATA: ++ status = -ENODATA; ++ break; ++ default: ++ if (status) { ++ DWC_PRINTF("unknown status in isoc packet\n"); ++ } ++ ++ } ++ iso_packet[i].status = status; ++ iso_packet[i].offset = offset; ++ iso_packet[i].actual_length = actual; ++ } ++ ++ iso_req->status = 0; ++ iso_req->process_buffer(ep_handle, iso_req); ++ ++ return 0; ++} ++#endif /* DWC_EN_ISOC */ ++ ++#ifdef DWC_UTE_PER_IO ++/** ++ * Copy the contents of the extended request to the Linux usb_request's ++ * extended part and call the gadget's completion. ++ * ++ * @param pcd Pointer to the pcd structure ++ * @param ep_handle Void pointer to the usb_ep structure ++ * @param req_handle Void pointer to the usb_request structure ++ * @param status Request status returned from the portable logic ++ * @param ereq_port Void pointer to the extended request structure ++ * created in the the portable part that contains the ++ * results of the processed iso packets. ++ */ ++static int _xisoc_complete(dwc_otg_pcd_t * pcd, void *ep_handle, ++ void *req_handle, int32_t status, void *ereq_port) ++{ ++ struct dwc_ute_iso_req_ext *ereqorg = NULL; ++ struct dwc_iso_xreq_port *ereqport = NULL; ++ struct dwc_ute_iso_packet_descriptor *desc_org = NULL; ++ int i; ++ struct usb_request *req; ++ //struct dwc_ute_iso_packet_descriptor * ++ //int status = 0; ++ ++ req = (struct usb_request *)req_handle; ++ ereqorg = &req->ext_req; ++ ereqport = (struct dwc_iso_xreq_port *)ereq_port; ++ desc_org = ereqorg->per_io_frame_descs; ++ ++ if (req && req->complete) { ++ /* Copy the request data from the portable logic to our request */ ++ for (i = 0; i < ereqport->pio_pkt_count; i++) { ++ desc_org[i].actual_length = ++ ereqport->per_io_frame_descs[i].actual_length; ++ desc_org[i].status = ++ ereqport->per_io_frame_descs[i].status; ++ } ++ ++ switch (status) { ++ case -DWC_E_SHUTDOWN: ++ req->status = -ESHUTDOWN; ++ break; ++ case -DWC_E_RESTART: ++ req->status = -ECONNRESET; ++ break; ++ case -DWC_E_INVALID: ++ req->status = -EINVAL; ++ break; ++ case -DWC_E_TIMEOUT: ++ req->status = -ETIMEDOUT; ++ break; ++ default: ++ req->status = status; ++ } ++ ++ /* And call the gadget's completion */ ++ req->complete(ep_handle, req); ++ } ++ ++ return 0; ++} ++#endif /* DWC_UTE_PER_IO */ ++ ++static int _complete(dwc_otg_pcd_t * pcd, void *ep_handle, ++ void *req_handle, int32_t status, uint32_t actual) ++{ ++ struct usb_request *req = (struct usb_request *)req_handle; ++#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,27) ++ struct dwc_otg_pcd_ep *ep = NULL; ++#endif ++ ++ if (req && req->complete) { ++ switch (status) { ++ case -DWC_E_SHUTDOWN: ++ req->status = -ESHUTDOWN; ++ break; ++ case -DWC_E_RESTART: ++ req->status = -ECONNRESET; ++ break; ++ case -DWC_E_INVALID: ++ req->status = -EINVAL; ++ break; ++ case -DWC_E_TIMEOUT: ++ req->status = -ETIMEDOUT; ++ break; ++ default: ++ req->status = status; ++ ++ } ++ ++ req->actual = actual; ++ DWC_SPINUNLOCK(pcd->lock); ++ req->complete(ep_handle, req); ++ DWC_SPINLOCK(pcd->lock); ++ } ++#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,27) ++ ep = ep_from_handle(pcd, ep_handle); ++ if (GET_CORE_IF(pcd)->dma_enable) { ++ if (req->length != 0) { ++ dwc_otg_device_t *otg_dev = gadget_wrapper->pcd->otg_dev; ++ struct device *dev = NULL; ++ ++ if (otg_dev != NULL) ++ dev = DWC_OTG_OS_GETDEV(otg_dev->os_dep); ++ ++ dma_unmap_single(dev, req->dma, req->length, ++ ep->dwc_ep.is_in ? ++ DMA_TO_DEVICE: DMA_FROM_DEVICE); ++ } ++ } ++#endif ++ ++ return 0; ++} ++ ++static int _connect(dwc_otg_pcd_t * pcd, int speed) ++{ ++ gadget_wrapper->gadget.speed = speed; ++ return 0; ++} ++ ++static int _disconnect(dwc_otg_pcd_t * pcd) ++{ ++ if (gadget_wrapper->driver && gadget_wrapper->driver->disconnect) { ++ gadget_wrapper->driver->disconnect(&gadget_wrapper->gadget); ++ } ++ return 0; ++} ++ ++static int _resume(dwc_otg_pcd_t * pcd) ++{ ++ if (gadget_wrapper->driver && gadget_wrapper->driver->resume) { ++ gadget_wrapper->driver->resume(&gadget_wrapper->gadget); ++ } ++ ++ return 0; ++} ++ ++static int _suspend(dwc_otg_pcd_t * pcd) ++{ ++ if (gadget_wrapper->driver && gadget_wrapper->driver->suspend) { ++ gadget_wrapper->driver->suspend(&gadget_wrapper->gadget); ++ } ++ return 0; ++} ++ ++/** ++ * This function updates the otg values in the gadget structure. ++ */ ++static int _hnp_changed(dwc_otg_pcd_t * pcd) ++{ ++ ++ if (!gadget_wrapper->gadget.is_otg) ++ return 0; ++ ++ gadget_wrapper->gadget.b_hnp_enable = get_b_hnp_enable(pcd); ++ gadget_wrapper->gadget.a_hnp_support = get_a_hnp_support(pcd); ++ gadget_wrapper->gadget.a_alt_hnp_support = get_a_alt_hnp_support(pcd); ++ return 0; ++} ++ ++static int _reset(dwc_otg_pcd_t * pcd) ++{ ++ return 0; ++} ++ ++#ifdef DWC_UTE_CFI ++static int _cfi_setup(dwc_otg_pcd_t * pcd, void *cfi_req) ++{ ++ int retval = -DWC_E_INVALID; ++ if (gadget_wrapper->driver->cfi_feature_setup) { ++ retval = ++ gadget_wrapper->driver-> ++ cfi_feature_setup(&gadget_wrapper->gadget, ++ (struct cfi_usb_ctrlrequest *)cfi_req); ++ } ++ ++ return retval; ++} ++#endif ++ ++static const struct dwc_otg_pcd_function_ops fops = { ++ .complete = _complete, ++#ifdef DWC_EN_ISOC ++ .isoc_complete = _isoc_complete, ++#endif ++ .setup = _setup, ++ .disconnect = _disconnect, ++ .connect = _connect, ++ .resume = _resume, ++ .suspend = _suspend, ++ .hnp_changed = _hnp_changed, ++ .reset = _reset, ++#ifdef DWC_UTE_CFI ++ .cfi_setup = _cfi_setup, ++#endif ++#ifdef DWC_UTE_PER_IO ++ .xisoc_complete = _xisoc_complete, ++#endif ++}; ++ ++/** ++ * This function is the top level PCD interrupt handler. ++ */ ++static irqreturn_t dwc_otg_pcd_irq(int irq, void *dev) ++{ ++ dwc_otg_pcd_t *pcd = dev; ++ int32_t retval = IRQ_NONE; ++ ++ retval = dwc_otg_pcd_handle_intr(pcd); ++ if (retval != 0) { ++ S3C2410X_CLEAR_EINTPEND(); ++ } ++ return IRQ_RETVAL(retval); ++} ++ ++/** ++ * This function initialized the usb_ep structures to there default ++ * state. ++ * ++ * @param d Pointer on gadget_wrapper. ++ */ ++void gadget_add_eps(struct gadget_wrapper *d) ++{ ++ static const char *names[] = { ++ ++ "ep0", ++ "ep1in", ++ "ep2in", ++ "ep3in", ++ "ep4in", ++ "ep5in", ++ "ep6in", ++ "ep7in", ++ "ep8in", ++ "ep9in", ++ "ep10in", ++ "ep11in", ++ "ep12in", ++ "ep13in", ++ "ep14in", ++ "ep15in", ++ "ep1out", ++ "ep2out", ++ "ep3out", ++ "ep4out", ++ "ep5out", ++ "ep6out", ++ "ep7out", ++ "ep8out", ++ "ep9out", ++ "ep10out", ++ "ep11out", ++ "ep12out", ++ "ep13out", ++ "ep14out", ++ "ep15out" ++ }; ++ ++ int i; ++ struct usb_ep *ep; ++ int8_t dev_endpoints; ++ ++ DWC_DEBUGPL(DBG_PCDV, "%s\n", __func__); ++ ++ INIT_LIST_HEAD(&d->gadget.ep_list); ++ d->gadget.ep0 = &d->ep0; ++ d->gadget.speed = USB_SPEED_UNKNOWN; ++ ++ INIT_LIST_HEAD(&d->gadget.ep0->ep_list); ++ ++ /** ++ * Initialize the EP0 structure. ++ */ ++ ep = &d->ep0; ++ ++ /* Init the usb_ep structure. */ ++ ep->name = names[0]; ++ ep->ops = (struct usb_ep_ops *)&dwc_otg_pcd_ep_ops; ++ ++ /** ++ * @todo NGS: What should the max packet size be set to ++ * here? Before EP type is set? ++ */ ++ ep->maxpacket = MAX_PACKET_SIZE; ++ dwc_otg_pcd_ep_enable(d->pcd, NULL, ep); ++ ++ list_add_tail(&ep->ep_list, &d->gadget.ep_list); ++ ++ /** ++ * Initialize the EP structures. ++ */ ++ dev_endpoints = d->pcd->core_if->dev_if->num_in_eps; ++ ++ for (i = 0; i < dev_endpoints; i++) { ++ ep = &d->in_ep[i]; ++ ++ /* Init the usb_ep structure. */ ++ ep->name = names[d->pcd->in_ep[i].dwc_ep.num]; ++ ep->ops = (struct usb_ep_ops *)&dwc_otg_pcd_ep_ops; ++ ++ /** ++ * @todo NGS: What should the max packet size be set to ++ * here? Before EP type is set? ++ */ ++ ep->maxpacket = MAX_PACKET_SIZE; ++ list_add_tail(&ep->ep_list, &d->gadget.ep_list); ++ } ++ ++ dev_endpoints = d->pcd->core_if->dev_if->num_out_eps; ++ ++ for (i = 0; i < dev_endpoints; i++) { ++ ep = &d->out_ep[i]; ++ ++ /* Init the usb_ep structure. */ ++ ep->name = names[15 + d->pcd->out_ep[i].dwc_ep.num]; ++ ep->ops = (struct usb_ep_ops *)&dwc_otg_pcd_ep_ops; ++ ++ /** ++ * @todo NGS: What should the max packet size be set to ++ * here? Before EP type is set? ++ */ ++ ep->maxpacket = MAX_PACKET_SIZE; ++ ++ list_add_tail(&ep->ep_list, &d->gadget.ep_list); ++ } ++ ++ /* remove ep0 from the list. There is a ep0 pointer. */ ++ list_del_init(&d->ep0.ep_list); ++ ++ d->ep0.maxpacket = MAX_EP0_SIZE; ++} ++ ++/** ++ * This function releases the Gadget device. ++ * required by device_unregister(). ++ * ++ * @todo Should this do something? Should it free the PCD? ++ */ ++static void dwc_otg_pcd_gadget_release(struct device *dev) ++{ ++ DWC_DEBUGPL(DBG_PCDV, "%s(%p)\n", __func__, dev); ++} ++ ++static struct gadget_wrapper *alloc_wrapper(dwc_bus_dev_t *_dev) ++{ ++ static char pcd_name[] = "dwc_otg_pcd"; ++ dwc_otg_device_t *otg_dev = DWC_OTG_BUSDRVDATA(_dev); ++ struct gadget_wrapper *d; ++ int retval; ++ ++ d = DWC_ALLOC(sizeof(*d)); ++ if (d == NULL) { ++ return NULL; ++ } ++ ++ memset(d, 0, sizeof(*d)); ++ ++ d->gadget.name = pcd_name; ++ d->pcd = otg_dev->pcd; ++ ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30) ++ strcpy(d->gadget.dev.bus_id, "gadget"); ++#else ++ dev_set_name(&d->gadget.dev, "%s", "gadget"); ++#endif ++ ++ d->gadget.dev.parent = &_dev->dev; ++ d->gadget.dev.release = dwc_otg_pcd_gadget_release; ++ d->gadget.ops = &dwc_otg_pcd_ops; ++ d->gadget.max_speed = dwc_otg_pcd_is_dualspeed(otg_dev->pcd) ? USB_SPEED_HIGH:USB_SPEED_FULL; ++ d->gadget.is_otg = dwc_otg_pcd_is_otg(otg_dev->pcd); ++ ++ d->driver = 0; ++ /* Register the gadget device */ ++ retval = device_register(&d->gadget.dev); ++ if (retval != 0) { ++ DWC_ERROR("device_register failed\n"); ++ DWC_FREE(d); ++ return NULL; ++ } ++ ++ return d; ++} ++ ++static void free_wrapper(struct gadget_wrapper *d) ++{ ++ if (d->driver) { ++ /* should have been done already by driver model core */ ++ DWC_WARN("driver '%s' is still registered\n", ++ d->driver->driver.name); ++#ifdef CONFIG_USB_GADGET ++ usb_gadget_unregister_driver(d->driver); ++#endif ++ } ++ ++ device_unregister(&d->gadget.dev); ++ DWC_FREE(d); ++} ++ ++/** ++ * This function initialized the PCD portion of the driver. ++ * ++ */ ++int pcd_init(dwc_bus_dev_t *_dev) ++{ ++ dwc_otg_device_t *otg_dev = DWC_OTG_BUSDRVDATA(_dev); ++ int retval = 0; ++ ++ DWC_DEBUGPL(DBG_PCDV, "%s(%p) otg_dev=%p\n", __func__, _dev, otg_dev); ++ ++ otg_dev->pcd = dwc_otg_pcd_init(otg_dev->core_if); ++ ++ if (!otg_dev->pcd) { ++ DWC_ERROR("dwc_otg_pcd_init failed\n"); ++ return -ENOMEM; ++ } ++ ++ otg_dev->pcd->otg_dev = otg_dev; ++ gadget_wrapper = alloc_wrapper(_dev); ++ ++ /* ++ * Initialize EP structures ++ */ ++ gadget_add_eps(gadget_wrapper); ++ /* ++ * Setup interupt handler ++ */ ++#ifdef PLATFORM_INTERFACE ++ DWC_DEBUGPL(DBG_ANY, "registering handler for irq%d\n", ++ platform_get_irq(_dev, fiq_enable ? 0 : 1)); ++ retval = request_irq(platform_get_irq(_dev, fiq_enable ? 0 : 1), dwc_otg_pcd_irq, ++ IRQF_SHARED, gadget_wrapper->gadget.name, ++ otg_dev->pcd); ++ if (retval != 0) { ++ DWC_ERROR("request of irq%d failed\n", ++ platform_get_irq(_dev, fiq_enable ? 0 : 1)); ++ free_wrapper(gadget_wrapper); ++ return -EBUSY; ++ } ++#else ++ DWC_DEBUGPL(DBG_ANY, "registering handler for irq%d\n", ++ _dev->irq); ++ retval = request_irq(_dev->irq, dwc_otg_pcd_irq, ++ IRQF_SHARED | IRQF_DISABLED, ++ gadget_wrapper->gadget.name, otg_dev->pcd); ++ if (retval != 0) { ++ DWC_ERROR("request of irq%d failed\n", _dev->irq); ++ free_wrapper(gadget_wrapper); ++ return -EBUSY; ++ } ++#endif ++ ++ dwc_otg_pcd_start(gadget_wrapper->pcd, &fops); ++ ++ return retval; ++} ++ ++/** ++ * Cleanup the PCD. ++ */ ++void pcd_remove(dwc_bus_dev_t *_dev) ++{ ++ dwc_otg_device_t *otg_dev = DWC_OTG_BUSDRVDATA(_dev); ++ dwc_otg_pcd_t *pcd = otg_dev->pcd; ++ ++ DWC_DEBUGPL(DBG_PCDV, "%s(%p) otg_dev %p\n", __func__, _dev, otg_dev); ++ ++ /* ++ * Free the IRQ ++ */ ++#ifdef PLATFORM_INTERFACE ++ free_irq(platform_get_irq(_dev, 0), pcd); ++#else ++ free_irq(_dev->irq, pcd); ++#endif ++ dwc_otg_pcd_remove(otg_dev->pcd); ++ free_wrapper(gadget_wrapper); ++ otg_dev->pcd = 0; ++} ++ ++#endif /* DWC_HOST_ONLY */ +diff --git a/drivers/usb/host/dwc_otg/dwc_otg_regs.h b/drivers/usb/host/dwc_otg/dwc_otg_regs.h +new file mode 100644 +index 0000000..8e0e7b5 +--- /dev/null ++++ b/drivers/usb/host/dwc_otg/dwc_otg_regs.h +@@ -0,0 +1,2550 @@ ++/* ========================================================================== ++ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_regs.h $ ++ * $Revision: #98 $ ++ * $Date: 2012/08/10 $ ++ * $Change: 2047372 $ ++ * ++ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, ++ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless ++ * otherwise expressly agreed to in writing between Synopsys and you. ++ * ++ * The Software IS NOT an item of Licensed Software or Licensed Product under ++ * any End User Software License Agreement or Agreement for Licensed Product ++ * with Synopsys or any supplement thereto. You are permitted to use and ++ * redistribute this Software in source and binary forms, with or without ++ * modification, provided that redistributions of source code must retain this ++ * notice. You may not view, use, disclose, copy or distribute this file or ++ * any information contained herein except pursuant to this license grant from ++ * Synopsys. If you do not agree with this notice, including the disclaimer ++ * below, then you are not authorized to use the Software. ++ * ++ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS ++ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS 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. ++ * ========================================================================== */ ++ ++#ifndef __DWC_OTG_REGS_H__ ++#define __DWC_OTG_REGS_H__ ++ ++#include "dwc_otg_core_if.h" ++ ++/** ++ * @file ++ * ++ * This file contains the data structures for accessing the DWC_otg core registers. ++ * ++ * The application interfaces with the HS OTG core by reading from and ++ * writing to the Control and Status Register (CSR) space through the ++ * AHB Slave interface. These registers are 32 bits wide, and the ++ * addresses are 32-bit-block aligned. ++ * CSRs are classified as follows: ++ * - Core Global Registers ++ * - Device Mode Registers ++ * - Device Global Registers ++ * - Device Endpoint Specific Registers ++ * - Host Mode Registers ++ * - Host Global Registers ++ * - Host Port CSRs ++ * - Host Channel Specific Registers ++ * ++ * Only the Core Global registers can be accessed in both Device and ++ * Host modes. When the HS OTG core is operating in one mode, either ++ * Device or Host, the application must not access registers from the ++ * other mode. When the core switches from one mode to another, the ++ * registers in the new mode of operation must be reprogrammed as they ++ * would be after a power-on reset. ++ */ ++ ++/****************************************************************************/ ++/** DWC_otg Core registers . ++ * The dwc_otg_core_global_regs structure defines the size ++ * and relative field offsets for the Core Global registers. ++ */ ++typedef struct dwc_otg_core_global_regs { ++ /** OTG Control and Status Register. <i>Offset: 000h</i> */ ++ volatile uint32_t gotgctl; ++ /** OTG Interrupt Register. <i>Offset: 004h</i> */ ++ volatile uint32_t gotgint; ++ /**Core AHB Configuration Register. <i>Offset: 008h</i> */ ++ volatile uint32_t gahbcfg; ++ ++#define DWC_GLBINTRMASK 0x0001 ++#define DWC_DMAENABLE 0x0020 ++#define DWC_NPTXEMPTYLVL_EMPTY 0x0080 ++#define DWC_NPTXEMPTYLVL_HALFEMPTY 0x0000 ++#define DWC_PTXEMPTYLVL_EMPTY 0x0100 ++#define DWC_PTXEMPTYLVL_HALFEMPTY 0x0000 ++ ++ /**Core USB Configuration Register. <i>Offset: 00Ch</i> */ ++ volatile uint32_t gusbcfg; ++ /**Core Reset Register. <i>Offset: 010h</i> */ ++ volatile uint32_t grstctl; ++ /**Core Interrupt Register. <i>Offset: 014h</i> */ ++ volatile uint32_t gintsts; ++ /**Core Interrupt Mask Register. <i>Offset: 018h</i> */ ++ volatile uint32_t gintmsk; ++ /**Receive Status Queue Read Register (Read Only). <i>Offset: 01Ch</i> */ ++ volatile uint32_t grxstsr; ++ /**Receive Status Queue Read & POP Register (Read Only). <i>Offset: 020h</i>*/ ++ volatile uint32_t grxstsp; ++ /**Receive FIFO Size Register. <i>Offset: 024h</i> */ ++ volatile uint32_t grxfsiz; ++ /**Non Periodic Transmit FIFO Size Register. <i>Offset: 028h</i> */ ++ volatile uint32_t gnptxfsiz; ++ /**Non Periodic Transmit FIFO/Queue Status Register (Read ++ * Only). <i>Offset: 02Ch</i> */ ++ volatile uint32_t gnptxsts; ++ /**I2C Access Register. <i>Offset: 030h</i> */ ++ volatile uint32_t gi2cctl; ++ /**PHY Vendor Control Register. <i>Offset: 034h</i> */ ++ volatile uint32_t gpvndctl; ++ /**General Purpose Input/Output Register. <i>Offset: 038h</i> */ ++ volatile uint32_t ggpio; ++ /**User ID Register. <i>Offset: 03Ch</i> */ ++ volatile uint32_t guid; ++ /**Synopsys ID Register (Read Only). <i>Offset: 040h</i> */ ++ volatile uint32_t gsnpsid; ++ /**User HW Config1 Register (Read Only). <i>Offset: 044h</i> */ ++ volatile uint32_t ghwcfg1; ++ /**User HW Config2 Register (Read Only). <i>Offset: 048h</i> */ ++ volatile uint32_t ghwcfg2; ++#define DWC_SLAVE_ONLY_ARCH 0 ++#define DWC_EXT_DMA_ARCH 1 ++#define DWC_INT_DMA_ARCH 2 ++ ++#define DWC_MODE_HNP_SRP_CAPABLE 0 ++#define DWC_MODE_SRP_ONLY_CAPABLE 1 ++#define DWC_MODE_NO_HNP_SRP_CAPABLE 2 ++#define DWC_MODE_SRP_CAPABLE_DEVICE 3 ++#define DWC_MODE_NO_SRP_CAPABLE_DEVICE 4 ++#define DWC_MODE_SRP_CAPABLE_HOST 5 ++#define DWC_MODE_NO_SRP_CAPABLE_HOST 6 ++ ++ /**User HW Config3 Register (Read Only). <i>Offset: 04Ch</i> */ ++ volatile uint32_t ghwcfg3; ++ /**User HW Config4 Register (Read Only). <i>Offset: 050h</i>*/ ++ volatile uint32_t ghwcfg4; ++ /** Core LPM Configuration register <i>Offset: 054h</i>*/ ++ volatile uint32_t glpmcfg; ++ /** Global PowerDn Register <i>Offset: 058h</i> */ ++ volatile uint32_t gpwrdn; ++ /** Global DFIFO SW Config Register <i>Offset: 05Ch</i> */ ++ volatile uint32_t gdfifocfg; ++ /** ADP Control Register <i>Offset: 060h</i> */ ++ volatile uint32_t adpctl; ++ /** Reserved <i>Offset: 064h-0FFh</i> */ ++ volatile uint32_t reserved39[39]; ++ /** Host Periodic Transmit FIFO Size Register. <i>Offset: 100h</i> */ ++ volatile uint32_t hptxfsiz; ++ /** Device Periodic Transmit FIFO#n Register if dedicated fifos are disabled, ++ otherwise Device Transmit FIFO#n Register. ++ * <i>Offset: 104h + (FIFO_Number-1)*04h, 1 <= FIFO Number <= 15 (1<=n<=15).</i> */ ++ volatile uint32_t dtxfsiz[15]; ++} dwc_otg_core_global_regs_t; ++ ++/** ++ * This union represents the bit fields of the Core OTG Control ++ * and Status Register (GOTGCTL). Set the bits using the bit ++ * fields then write the <i>d32</i> value to the register. ++ */ ++typedef union gotgctl_data { ++ /** raw register data */ ++ uint32_t d32; ++ /** register bits */ ++ struct { ++ unsigned sesreqscs:1; ++ unsigned sesreq:1; ++ unsigned vbvalidoven:1; ++ unsigned vbvalidovval:1; ++ unsigned avalidoven:1; ++ unsigned avalidovval:1; ++ unsigned bvalidoven:1; ++ unsigned bvalidovval:1; ++ unsigned hstnegscs:1; ++ unsigned hnpreq:1; ++ unsigned hstsethnpen:1; ++ unsigned devhnpen:1; ++ unsigned reserved12_15:4; ++ unsigned conidsts:1; ++ unsigned dbnctime:1; ++ unsigned asesvld:1; ++ unsigned bsesvld:1; ++ unsigned otgver:1; ++ unsigned reserved1:1; ++ unsigned multvalidbc:5; ++ unsigned chirpen:1; ++ unsigned reserved28_31:4; ++ } b; ++} gotgctl_data_t; ++ ++/** ++ * This union represents the bit fields of the Core OTG Interrupt Register ++ * (GOTGINT). Set/clear the bits using the bit fields then write the <i>d32</i> ++ * value to the register. ++ */ ++typedef union gotgint_data { ++ /** raw register data */ ++ uint32_t d32; ++ /** register bits */ ++ struct { ++ /** Current Mode */ ++ unsigned reserved0_1:2; ++ ++ /** Session End Detected */ ++ unsigned sesenddet:1; ++ ++ unsigned reserved3_7:5; ++ ++ /** Session Request Success Status Change */ ++ unsigned sesreqsucstschng:1; ++ /** Host Negotiation Success Status Change */ ++ unsigned hstnegsucstschng:1; ++ ++ unsigned reserved10_16:7; ++ ++ /** Host Negotiation Detected */ ++ unsigned hstnegdet:1; ++ /** A-Device Timeout Change */ ++ unsigned adevtoutchng:1; ++ /** Debounce Done */ ++ unsigned debdone:1; ++ /** Multi-Valued input changed */ ++ unsigned mvic:1; ++ ++ unsigned reserved31_21:11; ++ ++ } b; ++} gotgint_data_t; ++ ++/** ++ * This union represents the bit fields of the Core AHB Configuration ++ * Register (GAHBCFG). Set/clear the bits using the bit fields then ++ * write the <i>d32</i> value to the register. ++ */ ++typedef union gahbcfg_data { ++ /** raw register data */ ++ uint32_t d32; ++ /** register bits */ ++ struct { ++ unsigned glblintrmsk:1; ++#define DWC_GAHBCFG_GLBINT_ENABLE 1 ++ ++ unsigned hburstlen:4; ++#define DWC_GAHBCFG_INT_DMA_BURST_SINGLE 0 ++#define DWC_GAHBCFG_INT_DMA_BURST_INCR 1 ++#define DWC_GAHBCFG_INT_DMA_BURST_INCR4 3 ++#define DWC_GAHBCFG_INT_DMA_BURST_INCR8 5 ++#define DWC_GAHBCFG_INT_DMA_BURST_INCR16 7 ++ ++ unsigned dmaenable:1; ++#define DWC_GAHBCFG_DMAENABLE 1 ++ unsigned reserved:1; ++ unsigned nptxfemplvl_txfemplvl:1; ++ unsigned ptxfemplvl:1; ++#define DWC_GAHBCFG_TXFEMPTYLVL_EMPTY 1 ++#define DWC_GAHBCFG_TXFEMPTYLVL_HALFEMPTY 0 ++ unsigned reserved9_20:12; ++ unsigned remmemsupp:1; ++ unsigned notialldmawrit:1; ++ unsigned ahbsingle:1; ++ unsigned reserved24_31:8; ++ } b; ++} gahbcfg_data_t; ++ ++/** ++ * This union represents the bit fields of the Core USB Configuration ++ * Register (GUSBCFG). Set the bits using the bit fields then write ++ * the <i>d32</i> value to the register. ++ */ ++typedef union gusbcfg_data { ++ /** raw register data */ ++ uint32_t d32; ++ /** register bits */ ++ struct { ++ unsigned toutcal:3; ++ unsigned phyif:1; ++ unsigned ulpi_utmi_sel:1; ++ unsigned fsintf:1; ++ unsigned physel:1; ++ unsigned ddrsel:1; ++ unsigned srpcap:1; ++ unsigned hnpcap:1; ++ unsigned usbtrdtim:4; ++ unsigned reserved1:1; ++ unsigned phylpwrclksel:1; ++ unsigned otgutmifssel:1; ++ unsigned ulpi_fsls:1; ++ unsigned ulpi_auto_res:1; ++ unsigned ulpi_clk_sus_m:1; ++ unsigned ulpi_ext_vbus_drv:1; ++ unsigned ulpi_int_vbus_indicator:1; ++ unsigned term_sel_dl_pulse:1; ++ unsigned indicator_complement:1; ++ unsigned indicator_pass_through:1; ++ unsigned ulpi_int_prot_dis:1; ++ unsigned ic_usb_cap:1; ++ unsigned ic_traffic_pull_remove:1; ++ unsigned tx_end_delay:1; ++ unsigned force_host_mode:1; ++ unsigned force_dev_mode:1; ++ unsigned reserved31:1; ++ } b; ++} gusbcfg_data_t; ++ ++/** ++ * This union represents the bit fields of the Core Reset Register ++ * (GRSTCTL). Set/clear the bits using the bit fields then write the ++ * <i>d32</i> value to the register. ++ */ ++typedef union grstctl_data { ++ /** raw register data */ ++ uint32_t d32; ++ /** register bits */ ++ struct { ++ /** Core Soft Reset (CSftRst) (Device and Host) ++ * ++ * The application can flush the control logic in the ++ * entire core using this bit. This bit resets the ++ * pipelines in the AHB Clock domain as well as the ++ * PHY Clock domain. ++ * ++ * The state machines are reset to an IDLE state, the ++ * control bits in the CSRs are cleared, all the ++ * transmit FIFOs and the receive FIFO are flushed. ++ * ++ * The status mask bits that control the generation of ++ * the interrupt, are cleared, to clear the ++ * interrupt. The interrupt status bits are not ++ * cleared, so the application can get the status of ++ * any events that occurred in the core after it has ++ * set this bit. ++ * ++ * Any transactions on the AHB are terminated as soon ++ * as possible following the protocol. Any ++ * transactions on the USB are terminated immediately. ++ * ++ * The configuration settings in the CSRs are ++ * unchanged, so the software doesn't have to ++ * reprogram these registers (Device ++ * Configuration/Host Configuration/Core System ++ * Configuration/Core PHY Configuration). ++ * ++ * The application can write to this bit, any time it ++ * wants to reset the core. This is a self clearing ++ * bit and the core clears this bit after all the ++ * necessary logic is reset in the core, which may ++ * take several clocks, depending on the current state ++ * of the core. ++ */ ++ unsigned csftrst:1; ++ /** Hclk Soft Reset ++ * ++ * The application uses this bit to reset the control logic in ++ * the AHB clock domain. Only AHB clock domain pipelines are ++ * reset. ++ */ ++ unsigned hsftrst:1; ++ /** Host Frame Counter Reset (Host Only)<br> ++ * ++ * The application can reset the (micro)frame number ++ * counter inside the core, using this bit. When the ++ * (micro)frame counter is reset, the subsequent SOF ++ * sent out by the core, will have a (micro)frame ++ * number of 0. ++ */ ++ unsigned hstfrm:1; ++ /** In Token Sequence Learning Queue Flush ++ * (INTknQFlsh) (Device Only) ++ */ ++ unsigned intknqflsh:1; ++ /** RxFIFO Flush (RxFFlsh) (Device and Host) ++ * ++ * The application can flush the entire Receive FIFO ++ * using this bit. The application must first ++ * ensure that the core is not in the middle of a ++ * transaction. The application should write into ++ * this bit, only after making sure that neither the ++ * DMA engine is reading from the RxFIFO nor the MAC ++ * is writing the data in to the FIFO. The ++ * application should wait until the bit is cleared ++ * before performing any other operations. This bit ++ * will takes 8 clocks (slowest of PHY or AHB clock) ++ * to clear. ++ */ ++ unsigned rxfflsh:1; ++ /** TxFIFO Flush (TxFFlsh) (Device and Host). ++ * ++ * This bit is used to selectively flush a single or ++ * all transmit FIFOs. The application must first ++ * ensure that the core is not in the middle of a ++ * transaction. The application should write into ++ * this bit, only after making sure that neither the ++ * DMA engine is writing into the TxFIFO nor the MAC ++ * is reading the data out of the FIFO. The ++ * application should wait until the core clears this ++ * bit, before performing any operations. This bit ++ * will takes 8 clocks (slowest of PHY or AHB clock) ++ * to clear. ++ */ ++ unsigned txfflsh:1; ++ ++ /** TxFIFO Number (TxFNum) (Device and Host). ++ * ++ * This is the FIFO number which needs to be flushed, ++ * using the TxFIFO Flush bit. This field should not ++ * be changed until the TxFIFO Flush bit is cleared by ++ * the core. ++ * - 0x0 : Non Periodic TxFIFO Flush ++ * - 0x1 : Periodic TxFIFO #1 Flush in device mode ++ * or Periodic TxFIFO in host mode ++ * - 0x2 : Periodic TxFIFO #2 Flush in device mode. ++ * - ... ++ * - 0xF : Periodic TxFIFO #15 Flush in device mode ++ * - 0x10: Flush all the Transmit NonPeriodic and ++ * Transmit Periodic FIFOs in the core ++ */ ++ unsigned txfnum:5; ++ /** Reserved */ ++ unsigned reserved11_29:19; ++ /** DMA Request Signal. Indicated DMA request is in ++ * probress. Used for debug purpose. */ ++ unsigned dmareq:1; ++ /** AHB Master Idle. Indicates the AHB Master State ++ * Machine is in IDLE condition. */ ++ unsigned ahbidle:1; ++ } b; ++} grstctl_t; ++ ++/** ++ * This union represents the bit fields of the Core Interrupt Mask ++ * Register (GINTMSK). Set/clear the bits using the bit fields then ++ * write the <i>d32</i> value to the register. ++ */ ++typedef union gintmsk_data { ++ /** raw register data */ ++ uint32_t d32; ++ /** register bits */ ++ struct { ++ unsigned reserved0:1; ++ unsigned modemismatch:1; ++ unsigned otgintr:1; ++ unsigned sofintr:1; ++ unsigned rxstsqlvl:1; ++ unsigned nptxfempty:1; ++ unsigned ginnakeff:1; ++ unsigned goutnakeff:1; ++ unsigned ulpickint:1; ++ unsigned i2cintr:1; ++ unsigned erlysuspend:1; ++ unsigned usbsuspend:1; ++ unsigned usbreset:1; ++ unsigned enumdone:1; ++ unsigned isooutdrop:1; ++ unsigned eopframe:1; ++ unsigned restoredone:1; ++ unsigned epmismatch:1; ++ unsigned inepintr:1; ++ unsigned outepintr:1; ++ unsigned incomplisoin:1; ++ unsigned incomplisoout:1; ++ unsigned fetsusp:1; ++ unsigned resetdet:1; ++ unsigned portintr:1; ++ unsigned hcintr:1; ++ unsigned ptxfempty:1; ++ unsigned lpmtranrcvd:1; ++ unsigned conidstschng:1; ++ unsigned disconnect:1; ++ unsigned sessreqintr:1; ++ unsigned wkupintr:1; ++ } b; ++} gintmsk_data_t; ++/** ++ * This union represents the bit fields of the Core Interrupt Register ++ * (GINTSTS). Set/clear the bits using the bit fields then write the ++ * <i>d32</i> value to the register. ++ */ ++typedef union gintsts_data { ++ /** raw register data */ ++ uint32_t d32; ++#define DWC_SOF_INTR_MASK 0x0008 ++ /** register bits */ ++ struct { ++#define DWC_HOST_MODE 1 ++ unsigned curmode:1; ++ unsigned modemismatch:1; ++ unsigned otgintr:1; ++ unsigned sofintr:1; ++ unsigned rxstsqlvl:1; ++ unsigned nptxfempty:1; ++ unsigned ginnakeff:1; ++ unsigned goutnakeff:1; ++ unsigned ulpickint:1; ++ unsigned i2cintr:1; ++ unsigned erlysuspend:1; ++ unsigned usbsuspend:1; ++ unsigned usbreset:1; ++ unsigned enumdone:1; ++ unsigned isooutdrop:1; ++ unsigned eopframe:1; ++ unsigned restoredone:1; ++ unsigned epmismatch:1; ++ unsigned inepint:1; ++ unsigned outepintr:1; ++ unsigned incomplisoin:1; ++ unsigned incomplisoout:1; ++ unsigned fetsusp:1; ++ unsigned resetdet:1; ++ unsigned portintr:1; ++ unsigned hcintr:1; ++ unsigned ptxfempty:1; ++ unsigned lpmtranrcvd:1; ++ unsigned conidstschng:1; ++ unsigned disconnect:1; ++ unsigned sessreqintr:1; ++ unsigned wkupintr:1; ++ } b; ++} gintsts_data_t; ++ ++/** ++ * This union represents the bit fields in the Device Receive Status Read and ++ * Pop Registers (GRXSTSR, GRXSTSP) Read the register into the <i>d32</i> ++ * element then read out the bits using the <i>b</i>it elements. ++ */ ++typedef union device_grxsts_data { ++ /** raw register data */ ++ uint32_t d32; ++ /** register bits */ ++ struct { ++ unsigned epnum:4; ++ unsigned bcnt:11; ++ unsigned dpid:2; ++ ++#define DWC_STS_DATA_UPDT 0x2 // OUT Data Packet ++#define DWC_STS_XFER_COMP 0x3 // OUT Data Transfer Complete ++ ++#define DWC_DSTS_GOUT_NAK 0x1 // Global OUT NAK ++#define DWC_DSTS_SETUP_COMP 0x4 // Setup Phase Complete ++#define DWC_DSTS_SETUP_UPDT 0x6 // SETUP Packet ++ unsigned pktsts:4; ++ unsigned fn:4; ++ unsigned reserved25_31:7; ++ } b; ++} device_grxsts_data_t; ++ ++/** ++ * This union represents the bit fields in the Host Receive Status Read and ++ * Pop Registers (GRXSTSR, GRXSTSP) Read the register into the <i>d32</i> ++ * element then read out the bits using the <i>b</i>it elements. ++ */ ++typedef union host_grxsts_data { ++ /** raw register data */ ++ uint32_t d32; ++ /** register bits */ ++ struct { ++ unsigned chnum:4; ++ unsigned bcnt:11; ++ unsigned dpid:2; ++ ++ unsigned pktsts:4; ++#define DWC_GRXSTS_PKTSTS_IN 0x2 ++#define DWC_GRXSTS_PKTSTS_IN_XFER_COMP 0x3 ++#define DWC_GRXSTS_PKTSTS_DATA_TOGGLE_ERR 0x5 ++#define DWC_GRXSTS_PKTSTS_CH_HALTED 0x7 ++ ++ unsigned reserved21_31:11; ++ } b; ++} host_grxsts_data_t; ++ ++/** ++ * This union represents the bit fields in the FIFO Size Registers (HPTXFSIZ, ++ * GNPTXFSIZ, DPTXFSIZn, DIEPTXFn). Read the register into the <i>d32</i> element ++ * then read out the bits using the <i>b</i>it elements. ++ */ ++typedef union fifosize_data { ++ /** raw register data */ ++ uint32_t d32; ++ /** register bits */ ++ struct { ++ unsigned startaddr:16; ++ unsigned depth:16; ++ } b; ++} fifosize_data_t; ++ ++/** ++ * This union represents the bit fields in the Non-Periodic Transmit ++ * FIFO/Queue Status Register (GNPTXSTS). Read the register into the ++ * <i>d32</i> element then read out the bits using the <i>b</i>it ++ * elements. ++ */ ++typedef union gnptxsts_data { ++ /** raw register data */ ++ uint32_t d32; ++ /** register bits */ ++ struct { ++ unsigned nptxfspcavail:16; ++ unsigned nptxqspcavail:8; ++ /** Top of the Non-Periodic Transmit Request Queue ++ * - bit 24 - Terminate (Last entry for the selected ++ * channel/EP) ++ * - bits 26:25 - Token Type ++ * - 2'b00 - IN/OUT ++ * - 2'b01 - Zero Length OUT ++ * - 2'b10 - PING/Complete Split ++ * - 2'b11 - Channel Halt ++ * - bits 30:27 - Channel/EP Number ++ */ ++ unsigned nptxqtop_terminate:1; ++ unsigned nptxqtop_token:2; ++ unsigned nptxqtop_chnep:4; ++ unsigned reserved:1; ++ } b; ++} gnptxsts_data_t; ++ ++/** ++ * This union represents the bit fields in the Transmit ++ * FIFO Status Register (DTXFSTS). Read the register into the ++ * <i>d32</i> element then read out the bits using the <i>b</i>it ++ * elements. ++ */ ++typedef union dtxfsts_data { ++ /** raw register data */ ++ uint32_t d32; ++ /** register bits */ ++ struct { ++ unsigned txfspcavail:16; ++ unsigned reserved:16; ++ } b; ++} dtxfsts_data_t; ++ ++/** ++ * This union represents the bit fields in the I2C Control Register ++ * (I2CCTL). Read the register into the <i>d32</i> element then read out the ++ * bits using the <i>b</i>it elements. ++ */ ++typedef union gi2cctl_data { ++ /** raw register data */ ++ uint32_t d32; ++ /** register bits */ ++ struct { ++ unsigned rwdata:8; ++ unsigned regaddr:8; ++ unsigned addr:7; ++ unsigned i2cen:1; ++ unsigned ack:1; ++ unsigned i2csuspctl:1; ++ unsigned i2cdevaddr:2; ++ unsigned i2cdatse0:1; ++ unsigned reserved:1; ++ unsigned rw:1; ++ unsigned bsydne:1; ++ } b; ++} gi2cctl_data_t; ++ ++/** ++ * This union represents the bit fields in the PHY Vendor Control Register ++ * (GPVNDCTL). Read the register into the <i>d32</i> element then read out the ++ * bits using the <i>b</i>it elements. ++ */ ++typedef union gpvndctl_data { ++ /** raw register data */ ++ uint32_t d32; ++ /** register bits */ ++ struct { ++ unsigned regdata:8; ++ unsigned vctrl:8; ++ unsigned regaddr16_21:6; ++ unsigned regwr:1; ++ unsigned reserved23_24:2; ++ unsigned newregreq:1; ++ unsigned vstsbsy:1; ++ unsigned vstsdone:1; ++ unsigned reserved28_30:3; ++ unsigned disulpidrvr:1; ++ } b; ++} gpvndctl_data_t; ++ ++/** ++ * This union represents the bit fields in the General Purpose ++ * Input/Output Register (GGPIO). ++ * Read the register into the <i>d32</i> element then read out the ++ * bits using the <i>b</i>it elements. ++ */ ++typedef union ggpio_data { ++ /** raw register data */ ++ uint32_t d32; ++ /** register bits */ ++ struct { ++ unsigned gpi:16; ++ unsigned gpo:16; ++ } b; ++} ggpio_data_t; ++ ++/** ++ * This union represents the bit fields in the User ID Register ++ * (GUID). Read the register into the <i>d32</i> element then read out the ++ * bits using the <i>b</i>it elements. ++ */ ++typedef union guid_data { ++ /** raw register data */ ++ uint32_t d32; ++ /** register bits */ ++ struct { ++ unsigned rwdata:32; ++ } b; ++} guid_data_t; ++ ++/** ++ * This union represents the bit fields in the Synopsys ID Register ++ * (GSNPSID). Read the register into the <i>d32</i> element then read out the ++ * bits using the <i>b</i>it elements. ++ */ ++typedef union gsnpsid_data { ++ /** raw register data */ ++ uint32_t d32; ++ /** register bits */ ++ struct { ++ unsigned rwdata:32; ++ } b; ++} gsnpsid_data_t; ++ ++/** ++ * This union represents the bit fields in the User HW Config1 ++ * Register. Read the register into the <i>d32</i> element then read ++ * out the bits using the <i>b</i>it elements. ++ */ ++typedef union hwcfg1_data { ++ /** raw register data */ ++ uint32_t d32; ++ /** register bits */ ++ struct { ++ unsigned ep_dir0:2; ++ unsigned ep_dir1:2; ++ unsigned ep_dir2:2; ++ unsigned ep_dir3:2; ++ unsigned ep_dir4:2; ++ unsigned ep_dir5:2; ++ unsigned ep_dir6:2; ++ unsigned ep_dir7:2; ++ unsigned ep_dir8:2; ++ unsigned ep_dir9:2; ++ unsigned ep_dir10:2; ++ unsigned ep_dir11:2; ++ unsigned ep_dir12:2; ++ unsigned ep_dir13:2; ++ unsigned ep_dir14:2; ++ unsigned ep_dir15:2; ++ } b; ++} hwcfg1_data_t; ++ ++/** ++ * This union represents the bit fields in the User HW Config2 ++ * Register. Read the register into the <i>d32</i> element then read ++ * out the bits using the <i>b</i>it elements. ++ */ ++typedef union hwcfg2_data { ++ /** raw register data */ ++ uint32_t d32; ++ /** register bits */ ++ struct { ++ /* GHWCFG2 */ ++ unsigned op_mode:3; ++#define DWC_HWCFG2_OP_MODE_HNP_SRP_CAPABLE_OTG 0 ++#define DWC_HWCFG2_OP_MODE_SRP_ONLY_CAPABLE_OTG 1 ++#define DWC_HWCFG2_OP_MODE_NO_HNP_SRP_CAPABLE_OTG 2 ++#define DWC_HWCFG2_OP_MODE_SRP_CAPABLE_DEVICE 3 ++#define DWC_HWCFG2_OP_MODE_NO_SRP_CAPABLE_DEVICE 4 ++#define DWC_HWCFG2_OP_MODE_SRP_CAPABLE_HOST 5 ++#define DWC_HWCFG2_OP_MODE_NO_SRP_CAPABLE_HOST 6 ++ ++ unsigned architecture:2; ++ unsigned point2point:1; ++ unsigned hs_phy_type:2; ++#define DWC_HWCFG2_HS_PHY_TYPE_NOT_SUPPORTED 0 ++#define DWC_HWCFG2_HS_PHY_TYPE_UTMI 1 ++#define DWC_HWCFG2_HS_PHY_TYPE_ULPI 2 ++#define DWC_HWCFG2_HS_PHY_TYPE_UTMI_ULPI 3 ++ ++ unsigned fs_phy_type:2; ++ unsigned num_dev_ep:4; ++ unsigned num_host_chan:4; ++ unsigned perio_ep_supported:1; ++ unsigned dynamic_fifo:1; ++ unsigned multi_proc_int:1; ++ unsigned reserved21:1; ++ unsigned nonperio_tx_q_depth:2; ++ unsigned host_perio_tx_q_depth:2; ++ unsigned dev_token_q_depth:5; ++ unsigned otg_enable_ic_usb:1; ++ } b; ++} hwcfg2_data_t; ++ ++/** ++ * This union represents the bit fields in the User HW Config3 ++ * Register. Read the register into the <i>d32</i> element then read ++ * out the bits using the <i>b</i>it elements. ++ */ ++typedef union hwcfg3_data { ++ /** raw register data */ ++ uint32_t d32; ++ /** register bits */ ++ struct { ++ /* GHWCFG3 */ ++ unsigned xfer_size_cntr_width:4; ++ unsigned packet_size_cntr_width:3; ++ unsigned otg_func:1; ++ unsigned i2c:1; ++ unsigned vendor_ctrl_if:1; ++ unsigned optional_features:1; ++ unsigned synch_reset_type:1; ++ unsigned adp_supp:1; ++ unsigned otg_enable_hsic:1; ++ unsigned bc_support:1; ++ unsigned otg_lpm_en:1; ++ unsigned dfifo_depth:16; ++ } b; ++} hwcfg3_data_t; ++ ++/** ++ * This union represents the bit fields in the User HW Config4 ++ * Register. Read the register into the <i>d32</i> element then read ++ * out the bits using the <i>b</i>it elements. ++ */ ++typedef union hwcfg4_data { ++ /** raw register data */ ++ uint32_t d32; ++ /** register bits */ ++ struct { ++ unsigned num_dev_perio_in_ep:4; ++ unsigned power_optimiz:1; ++ unsigned min_ahb_freq:1; ++ unsigned hiber:1; ++ unsigned xhiber:1; ++ unsigned reserved:6; ++ unsigned utmi_phy_data_width:2; ++ unsigned num_dev_mode_ctrl_ep:4; ++ unsigned iddig_filt_en:1; ++ unsigned vbus_valid_filt_en:1; ++ unsigned a_valid_filt_en:1; ++ unsigned b_valid_filt_en:1; ++ unsigned session_end_filt_en:1; ++ unsigned ded_fifo_en:1; ++ unsigned num_in_eps:4; ++ unsigned desc_dma:1; ++ unsigned desc_dma_dyn:1; ++ } b; ++} hwcfg4_data_t; ++ ++/** ++ * This union represents the bit fields of the Core LPM Configuration ++ * Register (GLPMCFG). Set the bits using bit fields then write ++ * the <i>d32</i> value to the register. ++ */ ++typedef union glpmctl_data { ++ /** raw register data */ ++ uint32_t d32; ++ /** register bits */ ++ struct { ++ /** LPM-Capable (LPMCap) (Device and Host) ++ * The application uses this bit to control ++ * the DWC_otg core LPM capabilities. ++ */ ++ unsigned lpm_cap_en:1; ++ /** LPM response programmed by application (AppL1Res) (Device) ++ * Handshake response to LPM token pre-programmed ++ * by device application software. ++ */ ++ unsigned appl_resp:1; ++ /** Host Initiated Resume Duration (HIRD) (Device and Host) ++ * In Host mode this field indicates the value of HIRD ++ * to be sent in an LPM transaction. ++ * In Device mode this field is updated with the ++ * Received LPM Token HIRD bmAttribute ++ * when an ACK/NYET/STALL response is sent ++ * to an LPM transaction. ++ */ ++ unsigned hird:4; ++ /** RemoteWakeEnable (bRemoteWake) (Device and Host) ++ * In Host mode this bit indicates the value of remote ++ * wake up to be sent in wIndex field of LPM transaction. ++ * In Device mode this field is updated with the ++ * Received LPM Token bRemoteWake bmAttribute ++ * when an ACK/NYET/STALL response is sent ++ * to an LPM transaction. ++ */ ++ unsigned rem_wkup_en:1; ++ /** Enable utmi_sleep_n (EnblSlpM) (Device and Host) ++ * The application uses this bit to control ++ * the utmi_sleep_n assertion to the PHY when in L1 state. ++ */ ++ unsigned en_utmi_sleep:1; ++ /** HIRD Threshold (HIRD_Thres) (Device and Host) ++ */ ++ unsigned hird_thres:5; ++ /** LPM Response (CoreL1Res) (Device and Host) ++ * In Host mode this bit contains handsake response to ++ * LPM transaction. ++ * In Device mode the response of the core to ++ * LPM transaction received is reflected in these two bits. ++ - 0x0 : ERROR (No handshake response) ++ - 0x1 : STALL ++ - 0x2 : NYET ++ - 0x3 : ACK ++ */ ++ unsigned lpm_resp:2; ++ /** Port Sleep Status (SlpSts) (Device and Host) ++ * This bit is set as long as a Sleep condition ++ * is present on the USB bus. ++ */ ++ unsigned prt_sleep_sts:1; ++ /** Sleep State Resume OK (L1ResumeOK) (Device and Host) ++ * Indicates that the application or host ++ * can start resume from Sleep state. ++ */ ++ unsigned sleep_state_resumeok:1; ++ /** LPM channel Index (LPM_Chnl_Indx) (Host) ++ * The channel number on which the LPM transaction ++ * has to be applied while sending ++ * an LPM transaction to the local device. ++ */ ++ unsigned lpm_chan_index:4; ++ /** LPM Retry Count (LPM_Retry_Cnt) (Host) ++ * Number host retries that would be performed ++ * if the device response was not valid response. ++ */ ++ unsigned retry_count:3; ++ /** Send LPM Transaction (SndLPM) (Host) ++ * When set by application software, ++ * an LPM transaction containing two tokens ++ * is sent. ++ */ ++ unsigned send_lpm:1; ++ /** LPM Retry status (LPM_RetryCnt_Sts) (Host) ++ * Number of LPM Host Retries still remaining ++ * to be transmitted for the current LPM sequence ++ */ ++ unsigned retry_count_sts:3; ++ unsigned reserved28_29:2; ++ /** In host mode once this bit is set, the host ++ * configures to drive the HSIC Idle state on the bus. ++ * It then waits for the device to initiate the Connect sequence. ++ * In device mode once this bit is set, the device waits for ++ * the HSIC Idle line state on the bus. Upon receving the Idle ++ * line state, it initiates the HSIC Connect sequence. ++ */ ++ unsigned hsic_connect:1; ++ /** This bit overrides and functionally inverts ++ * the if_select_hsic input port signal. ++ */ ++ unsigned inv_sel_hsic:1; ++ } b; ++} glpmcfg_data_t; ++ ++/** ++ * This union represents the bit fields of the Core ADP Timer, Control and ++ * Status Register (ADPTIMCTLSTS). Set the bits using bit fields then write ++ * the <i>d32</i> value to the register. ++ */ ++typedef union adpctl_data { ++ /** raw register data */ ++ uint32_t d32; ++ /** register bits */ ++ struct { ++ /** Probe Discharge (PRB_DSCHG) ++ * These bits set the times for TADP_DSCHG. ++ * These bits are defined as follows: ++ * 2'b00 - 4 msec ++ * 2'b01 - 8 msec ++ * 2'b10 - 16 msec ++ * 2'b11 - 32 msec ++ */ ++ unsigned prb_dschg:2; ++ /** Probe Delta (PRB_DELTA) ++ * These bits set the resolution for RTIM value. ++ * The bits are defined in units of 32 kHz clock cycles as follows: ++ * 2'b00 - 1 cycles ++ * 2'b01 - 2 cycles ++ * 2'b10 - 3 cycles ++ * 2'b11 - 4 cycles ++ * For example if this value is chosen to 2'b01, it means that RTIM ++ * increments for every 3(three) 32Khz clock cycles. ++ */ ++ unsigned prb_delta:2; ++ /** Probe Period (PRB_PER) ++ * These bits sets the TADP_PRD as shown in Figure 4 as follows: ++ * 2'b00 - 0.625 to 0.925 sec (typical 0.775 sec) ++ * 2'b01 - 1.25 to 1.85 sec (typical 1.55 sec) ++ * 2'b10 - 1.9 to 2.6 sec (typical 2.275 sec) ++ * 2'b11 - Reserved ++ */ ++ unsigned prb_per:2; ++ /** These bits capture the latest time it took for VBUS to ramp from ++ * VADP_SINK to VADP_PRB. ++ * 0x000 - 1 cycles ++ * 0x001 - 2 cycles ++ * 0x002 - 3 cycles ++ * etc ++ * 0x7FF - 2048 cycles ++ * A time of 1024 cycles at 32 kHz corresponds to a time of 32 msec. ++ */ ++ unsigned rtim:11; ++ /** Enable Probe (EnaPrb) ++ * When programmed to 1'b1, the core performs a probe operation. ++ * This bit is valid only if OTG_Ver = 1'b1. ++ */ ++ unsigned enaprb:1; ++ /** Enable Sense (EnaSns) ++ * When programmed to 1'b1, the core performs a Sense operation. ++ * This bit is valid only if OTG_Ver = 1'b1. ++ */ ++ unsigned enasns:1; ++ /** ADP Reset (ADPRes) ++ * When set, ADP controller is reset. ++ * This bit is valid only if OTG_Ver = 1'b1. ++ */ ++ unsigned adpres:1; ++ /** ADP Enable (ADPEn) ++ * When set, the core performs either ADP probing or sensing ++ * based on EnaPrb or EnaSns. ++ * This bit is valid only if OTG_Ver = 1'b1. ++ */ ++ unsigned adpen:1; ++ /** ADP Probe Interrupt (ADP_PRB_INT) ++ * When this bit is set, it means that the VBUS ++ * voltage is greater than VADP_PRB or VADP_PRB is reached. ++ * This bit is valid only if OTG_Ver = 1'b1. ++ */ ++ unsigned adp_prb_int:1; ++ /** ++ * ADP Sense Interrupt (ADP_SNS_INT) ++ * When this bit is set, it means that the VBUS voltage is greater than ++ * VADP_SNS value or VADP_SNS is reached. ++ * This bit is valid only if OTG_Ver = 1'b1. ++ */ ++ unsigned adp_sns_int:1; ++ /** ADP Tomeout Interrupt (ADP_TMOUT_INT) ++ * This bit is relevant only for an ADP probe. ++ * When this bit is set, it means that the ramp time has ++ * completed ie ADPCTL.RTIM has reached its terminal value ++ * of 0x7FF. This is a debug feature that allows software ++ * to read the ramp time after each cycle. ++ * This bit is valid only if OTG_Ver = 1'b1. ++ */ ++ unsigned adp_tmout_int:1; ++ /** ADP Probe Interrupt Mask (ADP_PRB_INT_MSK) ++ * When this bit is set, it unmasks the interrupt due to ADP_PRB_INT. ++ * This bit is valid only if OTG_Ver = 1'b1. ++ */ ++ unsigned adp_prb_int_msk:1; ++ /** ADP Sense Interrupt Mask (ADP_SNS_INT_MSK) ++ * When this bit is set, it unmasks the interrupt due to ADP_SNS_INT. ++ * This bit is valid only if OTG_Ver = 1'b1. ++ */ ++ unsigned adp_sns_int_msk:1; ++ /** ADP Timoeout Interrupt Mask (ADP_TMOUT_MSK) ++ * When this bit is set, it unmasks the interrupt due to ADP_TMOUT_INT. ++ * This bit is valid only if OTG_Ver = 1'b1. ++ */ ++ unsigned adp_tmout_int_msk:1; ++ /** Access Request ++ * 2'b00 - Read/Write Valid (updated by the core) ++ * 2'b01 - Read ++ * 2'b00 - Write ++ * 2'b00 - Reserved ++ */ ++ unsigned ar:2; ++ /** Reserved */ ++ unsigned reserved29_31:3; ++ } b; ++} adpctl_data_t; ++ ++//////////////////////////////////////////// ++// Device Registers ++/** ++ * Device Global Registers. <i>Offsets 800h-BFFh</i> ++ * ++ * The following structures define the size and relative field offsets ++ * for the Device Mode Registers. ++ * ++ * <i>These registers are visible only in Device mode and must not be ++ * accessed in Host mode, as the results are unknown.</i> ++ */ ++typedef struct dwc_otg_dev_global_regs { ++ /** Device Configuration Register. <i>Offset 800h</i> */ ++ volatile uint32_t dcfg; ++ /** Device Control Register. <i>Offset: 804h</i> */ ++ volatile uint32_t dctl; ++ /** Device Status Register (Read Only). <i>Offset: 808h</i> */ ++ volatile uint32_t dsts; ++ /** Reserved. <i>Offset: 80Ch</i> */ ++ uint32_t unused; ++ /** Device IN Endpoint Common Interrupt Mask ++ * Register. <i>Offset: 810h</i> */ ++ volatile uint32_t diepmsk; ++ /** Device OUT Endpoint Common Interrupt Mask ++ * Register. <i>Offset: 814h</i> */ ++ volatile uint32_t doepmsk; ++ /** Device All Endpoints Interrupt Register. <i>Offset: 818h</i> */ ++ volatile uint32_t daint; ++ /** Device All Endpoints Interrupt Mask Register. <i>Offset: ++ * 81Ch</i> */ ++ volatile uint32_t daintmsk; ++ /** Device IN Token Queue Read Register-1 (Read Only). ++ * <i>Offset: 820h</i> */ ++ volatile uint32_t dtknqr1; ++ /** Device IN Token Queue Read Register-2 (Read Only). ++ * <i>Offset: 824h</i> */ ++ volatile uint32_t dtknqr2; ++ /** Device VBUS discharge Register. <i>Offset: 828h</i> */ ++ volatile uint32_t dvbusdis; ++ /** Device VBUS Pulse Register. <i>Offset: 82Ch</i> */ ++ volatile uint32_t dvbuspulse; ++ /** Device IN Token Queue Read Register-3 (Read Only). / ++ * Device Thresholding control register (Read/Write) ++ * <i>Offset: 830h</i> */ ++ volatile uint32_t dtknqr3_dthrctl; ++ /** Device IN Token Queue Read Register-4 (Read Only). / ++ * Device IN EPs empty Inr. Mask Register (Read/Write) ++ * <i>Offset: 834h</i> */ ++ volatile uint32_t dtknqr4_fifoemptymsk; ++ /** Device Each Endpoint Interrupt Register (Read Only). / ++ * <i>Offset: 838h</i> */ ++ volatile uint32_t deachint; ++ /** Device Each Endpoint Interrupt mask Register (Read/Write). / ++ * <i>Offset: 83Ch</i> */ ++ volatile uint32_t deachintmsk; ++ /** Device Each In Endpoint Interrupt mask Register (Read/Write). / ++ * <i>Offset: 840h</i> */ ++ volatile uint32_t diepeachintmsk[MAX_EPS_CHANNELS]; ++ /** Device Each Out Endpoint Interrupt mask Register (Read/Write). / ++ * <i>Offset: 880h</i> */ ++ volatile uint32_t doepeachintmsk[MAX_EPS_CHANNELS]; ++} dwc_otg_device_global_regs_t; ++ ++/** ++ * This union represents the bit fields in the Device Configuration ++ * Register. Read the register into the <i>d32</i> member then ++ * set/clear the bits using the <i>b</i>it elements. Write the ++ * <i>d32</i> member to the dcfg register. ++ */ ++typedef union dcfg_data { ++ /** raw register data */ ++ uint32_t d32; ++ /** register bits */ ++ struct { ++ /** Device Speed */ ++ unsigned devspd:2; ++ /** Non Zero Length Status OUT Handshake */ ++ unsigned nzstsouthshk:1; ++#define DWC_DCFG_SEND_STALL 1 ++ ++ unsigned ena32khzs:1; ++ /** Device Addresses */ ++ unsigned devaddr:7; ++ /** Periodic Frame Interval */ ++ unsigned perfrint:2; ++#define DWC_DCFG_FRAME_INTERVAL_80 0 ++#define DWC_DCFG_FRAME_INTERVAL_85 1 ++#define DWC_DCFG_FRAME_INTERVAL_90 2 ++#define DWC_DCFG_FRAME_INTERVAL_95 3 ++ ++ /** Enable Device OUT NAK for bulk in DDMA mode */ ++ unsigned endevoutnak:1; ++ ++ unsigned reserved14_17:4; ++ /** In Endpoint Mis-match count */ ++ unsigned epmscnt:5; ++ /** Enable Descriptor DMA in Device mode */ ++ unsigned descdma:1; ++ unsigned perschintvl:2; ++ unsigned resvalid:6; ++ } b; ++} dcfg_data_t; ++ ++/** ++ * This union represents the bit fields in the Device Control ++ * Register. Read the register into the <i>d32</i> member then ++ * set/clear the bits using the <i>b</i>it elements. ++ */ ++typedef union dctl_data { ++ /** raw register data */ ++ uint32_t d32; ++ /** register bits */ ++ struct { ++ /** Remote Wakeup */ ++ unsigned rmtwkupsig:1; ++ /** Soft Disconnect */ ++ unsigned sftdiscon:1; ++ /** Global Non-Periodic IN NAK Status */ ++ unsigned gnpinnaksts:1; ++ /** Global OUT NAK Status */ ++ unsigned goutnaksts:1; ++ /** Test Control */ ++ unsigned tstctl:3; ++ /** Set Global Non-Periodic IN NAK */ ++ unsigned sgnpinnak:1; ++ /** Clear Global Non-Periodic IN NAK */ ++ unsigned cgnpinnak:1; ++ /** Set Global OUT NAK */ ++ unsigned sgoutnak:1; ++ /** Clear Global OUT NAK */ ++ unsigned cgoutnak:1; ++ /** Power-On Programming Done */ ++ unsigned pwronprgdone:1; ++ /** Reserved */ ++ unsigned reserved:1; ++ /** Global Multi Count */ ++ unsigned gmc:2; ++ /** Ignore Frame Number for ISOC EPs */ ++ unsigned ifrmnum:1; ++ /** NAK on Babble */ ++ unsigned nakonbble:1; ++ /** Enable Continue on BNA */ ++ unsigned encontonbna:1; ++ ++ unsigned reserved18_31:14; ++ } b; ++} dctl_data_t; ++ ++/** ++ * This union represents the bit fields in the Device Status ++ * Register. Read the register into the <i>d32</i> member then ++ * set/clear the bits using the <i>b</i>it elements. ++ */ ++typedef union dsts_data { ++ /** raw register data */ ++ uint32_t d32; ++ /** register bits */ ++ struct { ++ /** Suspend Status */ ++ unsigned suspsts:1; ++ /** Enumerated Speed */ ++ unsigned enumspd:2; ++#define DWC_DSTS_ENUMSPD_HS_PHY_30MHZ_OR_60MHZ 0 ++#define DWC_DSTS_ENUMSPD_FS_PHY_30MHZ_OR_60MHZ 1 ++#define DWC_DSTS_ENUMSPD_LS_PHY_6MHZ 2 ++#define DWC_DSTS_ENUMSPD_FS_PHY_48MHZ 3 ++ /** Erratic Error */ ++ unsigned errticerr:1; ++ unsigned reserved4_7:4; ++ /** Frame or Microframe Number of the received SOF */ ++ unsigned soffn:14; ++ unsigned reserved22_31:10; ++ } b; ++} dsts_data_t; ++ ++/** ++ * This union represents the bit fields in the Device IN EP Interrupt ++ * Register and the Device IN EP Common Mask Register. ++ * ++ * - Read the register into the <i>d32</i> member then set/clear the ++ * bits using the <i>b</i>it elements. ++ */ ++typedef union diepint_data { ++ /** raw register data */ ++ uint32_t d32; ++ /** register bits */ ++ struct { ++ /** Transfer complete mask */ ++ unsigned xfercompl:1; ++ /** Endpoint disable mask */ ++ unsigned epdisabled:1; ++ /** AHB Error mask */ ++ unsigned ahberr:1; ++ /** TimeOUT Handshake mask (non-ISOC EPs) */ ++ unsigned timeout:1; ++ /** IN Token received with TxF Empty mask */ ++ unsigned intktxfemp:1; ++ /** IN Token Received with EP mismatch mask */ ++ unsigned intknepmis:1; ++ /** IN Endpoint NAK Effective mask */ ++ unsigned inepnakeff:1; ++ /** Reserved */ ++ unsigned emptyintr:1; ++ ++ unsigned txfifoundrn:1; ++ ++ /** BNA Interrupt mask */ ++ unsigned bna:1; ++ ++ unsigned reserved10_12:3; ++ /** BNA Interrupt mask */ ++ unsigned nak:1; ++ ++ unsigned reserved14_31:18; ++ } b; ++} diepint_data_t; ++ ++/** ++ * This union represents the bit fields in the Device IN EP ++ * Common/Dedicated Interrupt Mask Register. ++ */ ++typedef union diepint_data diepmsk_data_t; ++ ++/** ++ * This union represents the bit fields in the Device OUT EP Interrupt ++ * Registerand Device OUT EP Common Interrupt Mask Register. ++ * ++ * - Read the register into the <i>d32</i> member then set/clear the ++ * bits using the <i>b</i>it elements. ++ */ ++typedef union doepint_data { ++ /** raw register data */ ++ uint32_t d32; ++ /** register bits */ ++ struct { ++ /** Transfer complete */ ++ unsigned xfercompl:1; ++ /** Endpoint disable */ ++ unsigned epdisabled:1; ++ /** AHB Error */ ++ unsigned ahberr:1; ++ /** Setup Phase Done (contorl EPs) */ ++ unsigned setup:1; ++ /** OUT Token Received when Endpoint Disabled */ ++ unsigned outtknepdis:1; ++ ++ unsigned stsphsercvd:1; ++ /** Back-to-Back SETUP Packets Received */ ++ unsigned back2backsetup:1; ++ ++ unsigned reserved7:1; ++ /** OUT packet Error */ ++ unsigned outpkterr:1; ++ /** BNA Interrupt */ ++ unsigned bna:1; ++ ++ unsigned reserved10:1; ++ /** Packet Drop Status */ ++ unsigned pktdrpsts:1; ++ /** Babble Interrupt */ ++ unsigned babble:1; ++ /** NAK Interrupt */ ++ unsigned nak:1; ++ /** NYET Interrupt */ ++ unsigned nyet:1; ++ /** Bit indicating setup packet received */ ++ unsigned sr:1; ++ ++ unsigned reserved16_31:16; ++ } b; ++} doepint_data_t; ++ ++/** ++ * This union represents the bit fields in the Device OUT EP ++ * Common/Dedicated Interrupt Mask Register. ++ */ ++typedef union doepint_data doepmsk_data_t; ++ ++/** ++ * This union represents the bit fields in the Device All EP Interrupt ++ * and Mask Registers. ++ * - Read the register into the <i>d32</i> member then set/clear the ++ * bits using the <i>b</i>it elements. ++ */ ++typedef union daint_data { ++ /** raw register data */ ++ uint32_t d32; ++ /** register bits */ ++ struct { ++ /** IN Endpoint bits */ ++ unsigned in:16; ++ /** OUT Endpoint bits */ ++ unsigned out:16; ++ } ep; ++ struct { ++ /** IN Endpoint bits */ ++ unsigned inep0:1; ++ unsigned inep1:1; ++ unsigned inep2:1; ++ unsigned inep3:1; ++ unsigned inep4:1; ++ unsigned inep5:1; ++ unsigned inep6:1; ++ unsigned inep7:1; ++ unsigned inep8:1; ++ unsigned inep9:1; ++ unsigned inep10:1; ++ unsigned inep11:1; ++ unsigned inep12:1; ++ unsigned inep13:1; ++ unsigned inep14:1; ++ unsigned inep15:1; ++ /** OUT Endpoint bits */ ++ unsigned outep0:1; ++ unsigned outep1:1; ++ unsigned outep2:1; ++ unsigned outep3:1; ++ unsigned outep4:1; ++ unsigned outep5:1; ++ unsigned outep6:1; ++ unsigned outep7:1; ++ unsigned outep8:1; ++ unsigned outep9:1; ++ unsigned outep10:1; ++ unsigned outep11:1; ++ unsigned outep12:1; ++ unsigned outep13:1; ++ unsigned outep14:1; ++ unsigned outep15:1; ++ } b; ++} daint_data_t; ++ ++/** ++ * This union represents the bit fields in the Device IN Token Queue ++ * Read Registers. ++ * - Read the register into the <i>d32</i> member. ++ * - READ-ONLY Register ++ */ ++typedef union dtknq1_data { ++ /** raw register data */ ++ uint32_t d32; ++ /** register bits */ ++ struct { ++ /** In Token Queue Write Pointer */ ++ unsigned intknwptr:5; ++ /** Reserved */ ++ unsigned reserved05_06:2; ++ /** write pointer has wrapped. */ ++ unsigned wrap_bit:1; ++ /** EP Numbers of IN Tokens 0 ... 4 */ ++ unsigned epnums0_5:24; ++ } b; ++} dtknq1_data_t; ++ ++/** ++ * This union represents Threshold control Register ++ * - Read and write the register into the <i>d32</i> member. ++ * - READ-WRITABLE Register ++ */ ++typedef union dthrctl_data { ++ /** raw register data */ ++ uint32_t d32; ++ /** register bits */ ++ struct { ++ /** non ISO Tx Thr. Enable */ ++ unsigned non_iso_thr_en:1; ++ /** ISO Tx Thr. Enable */ ++ unsigned iso_thr_en:1; ++ /** Tx Thr. Length */ ++ unsigned tx_thr_len:9; ++ /** AHB Threshold ratio */ ++ unsigned ahb_thr_ratio:2; ++ /** Reserved */ ++ unsigned reserved13_15:3; ++ /** Rx Thr. Enable */ ++ unsigned rx_thr_en:1; ++ /** Rx Thr. Length */ ++ unsigned rx_thr_len:9; ++ unsigned reserved26:1; ++ /** Arbiter Parking Enable*/ ++ unsigned arbprken:1; ++ /** Reserved */ ++ unsigned reserved28_31:4; ++ } b; ++} dthrctl_data_t; ++ ++/** ++ * Device Logical IN Endpoint-Specific Registers. <i>Offsets ++ * 900h-AFCh</i> ++ * ++ * There will be one set of endpoint registers per logical endpoint ++ * implemented. ++ * ++ * <i>These registers are visible only in Device mode and must not be ++ * accessed in Host mode, as the results are unknown.</i> ++ */ ++typedef struct dwc_otg_dev_in_ep_regs { ++ /** Device IN Endpoint Control Register. <i>Offset:900h + ++ * (ep_num * 20h) + 00h</i> */ ++ volatile uint32_t diepctl; ++ /** Reserved. <i>Offset:900h + (ep_num * 20h) + 04h</i> */ ++ uint32_t reserved04; ++ /** Device IN Endpoint Interrupt Register. <i>Offset:900h + ++ * (ep_num * 20h) + 08h</i> */ ++ volatile uint32_t diepint; ++ /** Reserved. <i>Offset:900h + (ep_num * 20h) + 0Ch</i> */ ++ uint32_t reserved0C; ++ /** Device IN Endpoint Transfer Size ++ * Register. <i>Offset:900h + (ep_num * 20h) + 10h</i> */ ++ volatile uint32_t dieptsiz; ++ /** Device IN Endpoint DMA Address Register. <i>Offset:900h + ++ * (ep_num * 20h) + 14h</i> */ ++ volatile uint32_t diepdma; ++ /** Device IN Endpoint Transmit FIFO Status Register. <i>Offset:900h + ++ * (ep_num * 20h) + 18h</i> */ ++ volatile uint32_t dtxfsts; ++ /** Device IN Endpoint DMA Buffer Register. <i>Offset:900h + ++ * (ep_num * 20h) + 1Ch</i> */ ++ volatile uint32_t diepdmab; ++} dwc_otg_dev_in_ep_regs_t; ++ ++/** ++ * Device Logical OUT Endpoint-Specific Registers. <i>Offsets: ++ * B00h-CFCh</i> ++ * ++ * There will be one set of endpoint registers per logical endpoint ++ * implemented. ++ * ++ * <i>These registers are visible only in Device mode and must not be ++ * accessed in Host mode, as the results are unknown.</i> ++ */ ++typedef struct dwc_otg_dev_out_ep_regs { ++ /** Device OUT Endpoint Control Register. <i>Offset:B00h + ++ * (ep_num * 20h) + 00h</i> */ ++ volatile uint32_t doepctl; ++ /** Reserved. <i>Offset:B00h + (ep_num * 20h) + 04h</i> */ ++ uint32_t reserved04; ++ /** Device OUT Endpoint Interrupt Register. <i>Offset:B00h + ++ * (ep_num * 20h) + 08h</i> */ ++ volatile uint32_t doepint; ++ /** Reserved. <i>Offset:B00h + (ep_num * 20h) + 0Ch</i> */ ++ uint32_t reserved0C; ++ /** Device OUT Endpoint Transfer Size Register. <i>Offset: ++ * B00h + (ep_num * 20h) + 10h</i> */ ++ volatile uint32_t doeptsiz; ++ /** Device OUT Endpoint DMA Address Register. <i>Offset:B00h ++ * + (ep_num * 20h) + 14h</i> */ ++ volatile uint32_t doepdma; ++ /** Reserved. <i>Offset:B00h + * (ep_num * 20h) + 18h</i> */ ++ uint32_t unused; ++ /** Device OUT Endpoint DMA Buffer Register. <i>Offset:B00h ++ * + (ep_num * 20h) + 1Ch</i> */ ++ uint32_t doepdmab; ++} dwc_otg_dev_out_ep_regs_t; ++ ++/** ++ * This union represents the bit fields in the Device EP Control ++ * Register. Read the register into the <i>d32</i> member then ++ * set/clear the bits using the <i>b</i>it elements. ++ */ ++typedef union depctl_data { ++ /** raw register data */ ++ uint32_t d32; ++ /** register bits */ ++ struct { ++ /** Maximum Packet Size ++ * IN/OUT EPn ++ * IN/OUT EP0 - 2 bits ++ * 2'b00: 64 Bytes ++ * 2'b01: 32 ++ * 2'b10: 16 ++ * 2'b11: 8 */ ++ unsigned mps:11; ++#define DWC_DEP0CTL_MPS_64 0 ++#define DWC_DEP0CTL_MPS_32 1 ++#define DWC_DEP0CTL_MPS_16 2 ++#define DWC_DEP0CTL_MPS_8 3 ++ ++ /** Next Endpoint ++ * IN EPn/IN EP0 ++ * OUT EPn/OUT EP0 - reserved */ ++ unsigned nextep:4; ++ ++ /** USB Active Endpoint */ ++ unsigned usbactep:1; ++ ++ /** Endpoint DPID (INTR/Bulk IN and OUT endpoints) ++ * This field contains the PID of the packet going to ++ * be received or transmitted on this endpoint. The ++ * application should program the PID of the first ++ * packet going to be received or transmitted on this ++ * endpoint , after the endpoint is ++ * activated. Application use the SetD1PID and ++ * SetD0PID fields of this register to program either ++ * D0 or D1 PID. ++ * ++ * The encoding for this field is ++ * - 0: D0 ++ * - 1: D1 ++ */ ++ unsigned dpid:1; ++ ++ /** NAK Status */ ++ unsigned naksts:1; ++ ++ /** Endpoint Type ++ * 2'b00: Control ++ * 2'b01: Isochronous ++ * 2'b10: Bulk ++ * 2'b11: Interrupt */ ++ unsigned eptype:2; ++ ++ /** Snoop Mode ++ * OUT EPn/OUT EP0 ++ * IN EPn/IN EP0 - reserved */ ++ unsigned snp:1; ++ ++ /** Stall Handshake */ ++ unsigned stall:1; ++ ++ /** Tx Fifo Number ++ * IN EPn/IN EP0 ++ * OUT EPn/OUT EP0 - reserved */ ++ unsigned txfnum:4; ++ ++ /** Clear NAK */ ++ unsigned cnak:1; ++ /** Set NAK */ ++ unsigned snak:1; ++ /** Set DATA0 PID (INTR/Bulk IN and OUT endpoints) ++ * Writing to this field sets the Endpoint DPID (DPID) ++ * field in this register to DATA0. Set Even ++ * (micro)frame (SetEvenFr) (ISO IN and OUT Endpoints) ++ * Writing to this field sets the Even/Odd ++ * (micro)frame (EO_FrNum) field to even (micro) ++ * frame. ++ */ ++ unsigned setd0pid:1; ++ /** Set DATA1 PID (INTR/Bulk IN and OUT endpoints) ++ * Writing to this field sets the Endpoint DPID (DPID) ++ * field in this register to DATA1 Set Odd ++ * (micro)frame (SetOddFr) (ISO IN and OUT Endpoints) ++ * Writing to this field sets the Even/Odd ++ * (micro)frame (EO_FrNum) field to odd (micro) frame. ++ */ ++ unsigned setd1pid:1; ++ ++ /** Endpoint Disable */ ++ unsigned epdis:1; ++ /** Endpoint Enable */ ++ unsigned epena:1; ++ } b; ++} depctl_data_t; ++ ++/** ++ * This union represents the bit fields in the Device EP Transfer ++ * Size Register. Read the register into the <i>d32</i> member then ++ * set/clear the bits using the <i>b</i>it elements. ++ */ ++typedef union deptsiz_data { ++ /** raw register data */ ++ uint32_t d32; ++ /** register bits */ ++ struct { ++ /** Transfer size */ ++ unsigned xfersize:19; ++/** Max packet count for EP (pow(2,10)-1) */ ++#define MAX_PKT_CNT 1023 ++ /** Packet Count */ ++ unsigned pktcnt:10; ++ /** Multi Count - Periodic IN endpoints */ ++ unsigned mc:2; ++ unsigned reserved:1; ++ } b; ++} deptsiz_data_t; ++ ++/** ++ * This union represents the bit fields in the Device EP 0 Transfer ++ * Size Register. Read the register into the <i>d32</i> member then ++ * set/clear the bits using the <i>b</i>it elements. ++ */ ++typedef union deptsiz0_data { ++ /** raw register data */ ++ uint32_t d32; ++ /** register bits */ ++ struct { ++ /** Transfer size */ ++ unsigned xfersize:7; ++ /** Reserved */ ++ unsigned reserved7_18:12; ++ /** Packet Count */ ++ unsigned pktcnt:2; ++ /** Reserved */ ++ unsigned reserved21_28:8; ++ /**Setup Packet Count (DOEPTSIZ0 Only) */ ++ unsigned supcnt:2; ++ unsigned reserved31; ++ } b; ++} deptsiz0_data_t; ++ ++///////////////////////////////////////////////// ++// DMA Descriptor Specific Structures ++// ++ ++/** Buffer status definitions */ ++ ++#define BS_HOST_READY 0x0 ++#define BS_DMA_BUSY 0x1 ++#define BS_DMA_DONE 0x2 ++#define BS_HOST_BUSY 0x3 ++ ++/** Receive/Transmit status definitions */ ++ ++#define RTS_SUCCESS 0x0 ++#define RTS_BUFFLUSH 0x1 ++#define RTS_RESERVED 0x2 ++#define RTS_BUFERR 0x3 ++ ++/** ++ * This union represents the bit fields in the DMA Descriptor ++ * status quadlet. Read the quadlet into the <i>d32</i> member then ++ * set/clear the bits using the <i>b</i>it, <i>b_iso_out</i> and ++ * <i>b_iso_in</i> elements. ++ */ ++typedef union dev_dma_desc_sts { ++ /** raw register data */ ++ uint32_t d32; ++ /** quadlet bits */ ++ struct { ++ /** Received number of bytes */ ++ unsigned bytes:16; ++ /** NAK bit - only for OUT EPs */ ++ unsigned nak:1; ++ unsigned reserved17_22:6; ++ /** Multiple Transfer - only for OUT EPs */ ++ unsigned mtrf:1; ++ /** Setup Packet received - only for OUT EPs */ ++ unsigned sr:1; ++ /** Interrupt On Complete */ ++ unsigned ioc:1; ++ /** Short Packet */ ++ unsigned sp:1; ++ /** Last */ ++ unsigned l:1; ++ /** Receive Status */ ++ unsigned sts:2; ++ /** Buffer Status */ ++ unsigned bs:2; ++ } b; ++ ++//#ifdef DWC_EN_ISOC ++ /** iso out quadlet bits */ ++ struct { ++ /** Received number of bytes */ ++ unsigned rxbytes:11; ++ ++ unsigned reserved11:1; ++ /** Frame Number */ ++ unsigned framenum:11; ++ /** Received ISO Data PID */ ++ unsigned pid:2; ++ /** Interrupt On Complete */ ++ unsigned ioc:1; ++ /** Short Packet */ ++ unsigned sp:1; ++ /** Last */ ++ unsigned l:1; ++ /** Receive Status */ ++ unsigned rxsts:2; ++ /** Buffer Status */ ++ unsigned bs:2; ++ } b_iso_out; ++ ++ /** iso in quadlet bits */ ++ struct { ++ /** Transmited number of bytes */ ++ unsigned txbytes:12; ++ /** Frame Number */ ++ unsigned framenum:11; ++ /** Transmited ISO Data PID */ ++ unsigned pid:2; ++ /** Interrupt On Complete */ ++ unsigned ioc:1; ++ /** Short Packet */ ++ unsigned sp:1; ++ /** Last */ ++ unsigned l:1; ++ /** Transmit Status */ ++ unsigned txsts:2; ++ /** Buffer Status */ ++ unsigned bs:2; ++ } b_iso_in; ++//#endif /* DWC_EN_ISOC */ ++} dev_dma_desc_sts_t; ++ ++/** ++ * DMA Descriptor structure ++ * ++ * DMA Descriptor structure contains two quadlets: ++ * Status quadlet and Data buffer pointer. ++ */ ++typedef struct dwc_otg_dev_dma_desc { ++ /** DMA Descriptor status quadlet */ ++ dev_dma_desc_sts_t status; ++ /** DMA Descriptor data buffer pointer */ ++ uint32_t buf; ++} dwc_otg_dev_dma_desc_t; ++ ++/** ++ * The dwc_otg_dev_if structure contains information needed to manage ++ * the DWC_otg controller acting in device mode. It represents the ++ * programming view of the device-specific aspects of the controller. ++ */ ++typedef struct dwc_otg_dev_if { ++ /** Pointer to device Global registers. ++ * Device Global Registers starting at offset 800h ++ */ ++ dwc_otg_device_global_regs_t *dev_global_regs; ++#define DWC_DEV_GLOBAL_REG_OFFSET 0x800 ++ ++ /** ++ * Device Logical IN Endpoint-Specific Registers 900h-AFCh ++ */ ++ dwc_otg_dev_in_ep_regs_t *in_ep_regs[MAX_EPS_CHANNELS]; ++#define DWC_DEV_IN_EP_REG_OFFSET 0x900 ++#define DWC_EP_REG_OFFSET 0x20 ++ ++ /** Device Logical OUT Endpoint-Specific Registers B00h-CFCh */ ++ dwc_otg_dev_out_ep_regs_t *out_ep_regs[MAX_EPS_CHANNELS]; ++#define DWC_DEV_OUT_EP_REG_OFFSET 0xB00 ++ ++ /* Device configuration information */ ++ uint8_t speed; /**< Device Speed 0: Unknown, 1: LS, 2:FS, 3: HS */ ++ uint8_t num_in_eps; /**< Number # of Tx EP range: 0-15 exept ep0 */ ++ uint8_t num_out_eps; /**< Number # of Rx EP range: 0-15 exept ep 0*/ ++ ++ /** Size of periodic FIFOs (Bytes) */ ++ uint16_t perio_tx_fifo_size[MAX_PERIO_FIFOS]; ++ ++ /** Size of Tx FIFOs (Bytes) */ ++ uint16_t tx_fifo_size[MAX_TX_FIFOS]; ++ ++ /** Thresholding enable flags and length varaiables **/ ++ uint16_t rx_thr_en; ++ uint16_t iso_tx_thr_en; ++ uint16_t non_iso_tx_thr_en; ++ ++ uint16_t rx_thr_length; ++ uint16_t tx_thr_length; ++ ++ /** ++ * Pointers to the DMA Descriptors for EP0 Control ++ * transfers (virtual and physical) ++ */ ++ ++ /** 2 descriptors for SETUP packets */ ++ dwc_dma_t dma_setup_desc_addr[2]; ++ dwc_otg_dev_dma_desc_t *setup_desc_addr[2]; ++ ++ /** Pointer to Descriptor with latest SETUP packet */ ++ dwc_otg_dev_dma_desc_t *psetup; ++ ++ /** Index of current SETUP handler descriptor */ ++ uint32_t setup_desc_index; ++ ++ /** Descriptor for Data In or Status In phases */ ++ dwc_dma_t dma_in_desc_addr; ++ dwc_otg_dev_dma_desc_t *in_desc_addr; ++ ++ /** Descriptor for Data Out or Status Out phases */ ++ dwc_dma_t dma_out_desc_addr; ++ dwc_otg_dev_dma_desc_t *out_desc_addr; ++ ++ /** Setup Packet Detected - if set clear NAK when queueing */ ++ uint32_t spd; ++ /** Isoc ep pointer on which incomplete happens */ ++ void *isoc_ep; ++ ++} dwc_otg_dev_if_t; ++ ++///////////////////////////////////////////////// ++// Host Mode Register Structures ++// ++/** ++ * The Host Global Registers structure defines the size and relative ++ * field offsets for the Host Mode Global Registers. Host Global ++ * Registers offsets 400h-7FFh. ++*/ ++typedef struct dwc_otg_host_global_regs { ++ /** Host Configuration Register. <i>Offset: 400h</i> */ ++ volatile uint32_t hcfg; ++ /** Host Frame Interval Register. <i>Offset: 404h</i> */ ++ volatile uint32_t hfir; ++ /** Host Frame Number / Frame Remaining Register. <i>Offset: 408h</i> */ ++ volatile uint32_t hfnum; ++ /** Reserved. <i>Offset: 40Ch</i> */ ++ uint32_t reserved40C; ++ /** Host Periodic Transmit FIFO/ Queue Status Register. <i>Offset: 410h</i> */ ++ volatile uint32_t hptxsts; ++ /** Host All Channels Interrupt Register. <i>Offset: 414h</i> */ ++ volatile uint32_t haint; ++ /** Host All Channels Interrupt Mask Register. <i>Offset: 418h</i> */ ++ volatile uint32_t haintmsk; ++ /** Host Frame List Base Address Register . <i>Offset: 41Ch</i> */ ++ volatile uint32_t hflbaddr; ++} dwc_otg_host_global_regs_t; ++ ++/** ++ * This union represents the bit fields in the Host Configuration Register. ++ * Read the register into the <i>d32</i> member then set/clear the bits using ++ * the <i>b</i>it elements. Write the <i>d32</i> member to the hcfg register. ++ */ ++typedef union hcfg_data { ++ /** raw register data */ ++ uint32_t d32; ++ ++ /** register bits */ ++ struct { ++ /** FS/LS Phy Clock Select */ ++ unsigned fslspclksel:2; ++#define DWC_HCFG_30_60_MHZ 0 ++#define DWC_HCFG_48_MHZ 1 ++#define DWC_HCFG_6_MHZ 2 ++ ++ /** FS/LS Only Support */ ++ unsigned fslssupp:1; ++ unsigned reserved3_6:4; ++ /** Enable 32-KHz Suspend Mode */ ++ unsigned ena32khzs:1; ++ /** Resume Validation Periiod */ ++ unsigned resvalid:8; ++ unsigned reserved16_22:7; ++ /** Enable Scatter/gather DMA in Host mode */ ++ unsigned descdma:1; ++ /** Frame List Entries */ ++ unsigned frlisten:2; ++ /** Enable Periodic Scheduling */ ++ unsigned perschedena:1; ++ unsigned reserved27_30:4; ++ unsigned modechtimen:1; ++ } b; ++} hcfg_data_t; ++ ++/** ++ * This union represents the bit fields in the Host Frame Remaing/Number ++ * Register. ++ */ ++typedef union hfir_data { ++ /** raw register data */ ++ uint32_t d32; ++ ++ /** register bits */ ++ struct { ++ unsigned frint:16; ++ unsigned hfirrldctrl:1; ++ unsigned reserved:15; ++ } b; ++} hfir_data_t; ++ ++/** ++ * This union represents the bit fields in the Host Frame Remaing/Number ++ * Register. ++ */ ++typedef union hfnum_data { ++ /** raw register data */ ++ uint32_t d32; ++ ++ /** register bits */ ++ struct { ++ unsigned frnum:16; ++#define DWC_HFNUM_MAX_FRNUM 0x3FFF ++ unsigned frrem:16; ++ } b; ++} hfnum_data_t; ++ ++typedef union hptxsts_data { ++ /** raw register data */ ++ uint32_t d32; ++ ++ /** register bits */ ++ struct { ++ unsigned ptxfspcavail:16; ++ unsigned ptxqspcavail:8; ++ /** Top of the Periodic Transmit Request Queue ++ * - bit 24 - Terminate (last entry for the selected channel) ++ * - bits 26:25 - Token Type ++ * - 2'b00 - Zero length ++ * - 2'b01 - Ping ++ * - 2'b10 - Disable ++ * - bits 30:27 - Channel Number ++ * - bit 31 - Odd/even microframe ++ */ ++ unsigned ptxqtop_terminate:1; ++ unsigned ptxqtop_token:2; ++ unsigned ptxqtop_chnum:4; ++ unsigned ptxqtop_odd:1; ++ } b; ++} hptxsts_data_t; ++ ++/** ++ * This union represents the bit fields in the Host Port Control and Status ++ * Register. Read the register into the <i>d32</i> member then set/clear the ++ * bits using the <i>b</i>it elements. Write the <i>d32</i> member to the ++ * hprt0 register. ++ */ ++typedef union hprt0_data { ++ /** raw register data */ ++ uint32_t d32; ++ /** register bits */ ++ struct { ++ unsigned prtconnsts:1; ++ unsigned prtconndet:1; ++ unsigned prtena:1; ++ unsigned prtenchng:1; ++ unsigned prtovrcurract:1; ++ unsigned prtovrcurrchng:1; ++ unsigned prtres:1; ++ unsigned prtsusp:1; ++ unsigned prtrst:1; ++ unsigned reserved9:1; ++ unsigned prtlnsts:2; ++ unsigned prtpwr:1; ++ unsigned prttstctl:4; ++ unsigned prtspd:2; ++#define DWC_HPRT0_PRTSPD_HIGH_SPEED 0 ++#define DWC_HPRT0_PRTSPD_FULL_SPEED 1 ++#define DWC_HPRT0_PRTSPD_LOW_SPEED 2 ++ unsigned reserved19_31:13; ++ } b; ++} hprt0_data_t; ++ ++/** ++ * This union represents the bit fields in the Host All Interrupt ++ * Register. ++ */ ++typedef union haint_data { ++ /** raw register data */ ++ uint32_t d32; ++ /** register bits */ ++ struct { ++ unsigned ch0:1; ++ unsigned ch1:1; ++ unsigned ch2:1; ++ unsigned ch3:1; ++ unsigned ch4:1; ++ unsigned ch5:1; ++ unsigned ch6:1; ++ unsigned ch7:1; ++ unsigned ch8:1; ++ unsigned ch9:1; ++ unsigned ch10:1; ++ unsigned ch11:1; ++ unsigned ch12:1; ++ unsigned ch13:1; ++ unsigned ch14:1; ++ unsigned ch15:1; ++ unsigned reserved:16; ++ } b; ++ ++ struct { ++ unsigned chint:16; ++ unsigned reserved:16; ++ } b2; ++} haint_data_t; ++ ++/** ++ * This union represents the bit fields in the Host All Interrupt ++ * Register. ++ */ ++typedef union haintmsk_data { ++ /** raw register data */ ++ uint32_t d32; ++ /** register bits */ ++ struct { ++ unsigned ch0:1; ++ unsigned ch1:1; ++ unsigned ch2:1; ++ unsigned ch3:1; ++ unsigned ch4:1; ++ unsigned ch5:1; ++ unsigned ch6:1; ++ unsigned ch7:1; ++ unsigned ch8:1; ++ unsigned ch9:1; ++ unsigned ch10:1; ++ unsigned ch11:1; ++ unsigned ch12:1; ++ unsigned ch13:1; ++ unsigned ch14:1; ++ unsigned ch15:1; ++ unsigned reserved:16; ++ } b; ++ ++ struct { ++ unsigned chint:16; ++ unsigned reserved:16; ++ } b2; ++} haintmsk_data_t; ++ ++/** ++ * Host Channel Specific Registers. <i>500h-5FCh</i> ++ */ ++typedef struct dwc_otg_hc_regs { ++ /** Host Channel 0 Characteristic Register. <i>Offset: 500h + (chan_num * 20h) + 00h</i> */ ++ volatile uint32_t hcchar; ++ /** Host Channel 0 Split Control Register. <i>Offset: 500h + (chan_num * 20h) + 04h</i> */ ++ volatile uint32_t hcsplt; ++ /** Host Channel 0 Interrupt Register. <i>Offset: 500h + (chan_num * 20h) + 08h</i> */ ++ volatile uint32_t hcint; ++ /** Host Channel 0 Interrupt Mask Register. <i>Offset: 500h + (chan_num * 20h) + 0Ch</i> */ ++ volatile uint32_t hcintmsk; ++ /** Host Channel 0 Transfer Size Register. <i>Offset: 500h + (chan_num * 20h) + 10h</i> */ ++ volatile uint32_t hctsiz; ++ /** Host Channel 0 DMA Address Register. <i>Offset: 500h + (chan_num * 20h) + 14h</i> */ ++ volatile uint32_t hcdma; ++ volatile uint32_t reserved; ++ /** Host Channel 0 DMA Buffer Address Register. <i>Offset: 500h + (chan_num * 20h) + 1Ch</i> */ ++ volatile uint32_t hcdmab; ++} dwc_otg_hc_regs_t; ++ ++/** ++ * This union represents the bit fields in the Host Channel Characteristics ++ * Register. Read the register into the <i>d32</i> member then set/clear the ++ * bits using the <i>b</i>it elements. Write the <i>d32</i> member to the ++ * hcchar register. ++ */ ++typedef union hcchar_data { ++ /** raw register data */ ++ uint32_t d32; ++ ++ /** register bits */ ++ struct { ++ /** Maximum packet size in bytes */ ++ unsigned mps:11; ++ ++ /** Endpoint number */ ++ unsigned epnum:4; ++ ++ /** 0: OUT, 1: IN */ ++ unsigned epdir:1; ++ ++ unsigned reserved:1; ++ ++ /** 0: Full/high speed device, 1: Low speed device */ ++ unsigned lspddev:1; ++ ++ /** 0: Control, 1: Isoc, 2: Bulk, 3: Intr */ ++ unsigned eptype:2; ++ ++ /** Packets per frame for periodic transfers. 0 is reserved. */ ++ unsigned multicnt:2; ++ ++ /** Device address */ ++ unsigned devaddr:7; ++ ++ /** ++ * Frame to transmit periodic transaction. ++ * 0: even, 1: odd ++ */ ++ unsigned oddfrm:1; ++ ++ /** Channel disable */ ++ unsigned chdis:1; ++ ++ /** Channel enable */ ++ unsigned chen:1; ++ } b; ++} hcchar_data_t; ++ ++typedef union hcsplt_data { ++ /** raw register data */ ++ uint32_t d32; ++ ++ /** register bits */ ++ struct { ++ /** Port Address */ ++ unsigned prtaddr:7; ++ ++ /** Hub Address */ ++ unsigned hubaddr:7; ++ ++ /** Transaction Position */ ++ unsigned xactpos:2; ++#define DWC_HCSPLIT_XACTPOS_MID 0 ++#define DWC_HCSPLIT_XACTPOS_END 1 ++#define DWC_HCSPLIT_XACTPOS_BEGIN 2 ++#define DWC_HCSPLIT_XACTPOS_ALL 3 ++ ++ /** Do Complete Split */ ++ unsigned compsplt:1; ++ ++ /** Reserved */ ++ unsigned reserved:14; ++ ++ /** Split Enble */ ++ unsigned spltena:1; ++ } b; ++} hcsplt_data_t; ++ ++/** ++ * This union represents the bit fields in the Host All Interrupt ++ * Register. ++ */ ++typedef union hcint_data { ++ /** raw register data */ ++ uint32_t d32; ++ /** register bits */ ++ struct { ++ /** Transfer Complete */ ++ unsigned xfercomp:1; ++ /** Channel Halted */ ++ unsigned chhltd:1; ++ /** AHB Error */ ++ unsigned ahberr:1; ++ /** STALL Response Received */ ++ unsigned stall:1; ++ /** NAK Response Received */ ++ unsigned nak:1; ++ /** ACK Response Received */ ++ unsigned ack:1; ++ /** NYET Response Received */ ++ unsigned nyet:1; ++ /** Transaction Err */ ++ unsigned xacterr:1; ++ /** Babble Error */ ++ unsigned bblerr:1; ++ /** Frame Overrun */ ++ unsigned frmovrun:1; ++ /** Data Toggle Error */ ++ unsigned datatglerr:1; ++ /** Buffer Not Available (only for DDMA mode) */ ++ unsigned bna:1; ++ /** Exessive transaction error (only for DDMA mode) */ ++ unsigned xcs_xact:1; ++ /** Frame List Rollover interrupt */ ++ unsigned frm_list_roll:1; ++ /** Reserved */ ++ unsigned reserved14_31:18; ++ } b; ++} hcint_data_t; ++ ++/** ++ * This union represents the bit fields in the Host Channel Interrupt Mask ++ * Register. Read the register into the <i>d32</i> member then set/clear the ++ * bits using the <i>b</i>it elements. Write the <i>d32</i> member to the ++ * hcintmsk register. ++ */ ++typedef union hcintmsk_data { ++ /** raw register data */ ++ uint32_t d32; ++ ++ /** register bits */ ++ struct { ++ unsigned xfercompl:1; ++ unsigned chhltd:1; ++ unsigned ahberr:1; ++ unsigned stall:1; ++ unsigned nak:1; ++ unsigned ack:1; ++ unsigned nyet:1; ++ unsigned xacterr:1; ++ unsigned bblerr:1; ++ unsigned frmovrun:1; ++ unsigned datatglerr:1; ++ unsigned bna:1; ++ unsigned xcs_xact:1; ++ unsigned frm_list_roll:1; ++ unsigned reserved14_31:18; ++ } b; ++} hcintmsk_data_t; ++ ++/** ++ * This union represents the bit fields in the Host Channel Transfer Size ++ * Register. Read the register into the <i>d32</i> member then set/clear the ++ * bits using the <i>b</i>it elements. Write the <i>d32</i> member to the ++ * hcchar register. ++ */ ++ ++typedef union hctsiz_data { ++ /** raw register data */ ++ uint32_t d32; ++ ++ /** register bits */ ++ struct { ++ /** Total transfer size in bytes */ ++ unsigned xfersize:19; ++ ++ /** Data packets to transfer */ ++ unsigned pktcnt:10; ++ ++ /** ++ * Packet ID for next data packet ++ * 0: DATA0 ++ * 1: DATA2 ++ * 2: DATA1 ++ * 3: MDATA (non-Control), SETUP (Control) ++ */ ++ unsigned pid:2; ++#define DWC_HCTSIZ_DATA0 0 ++#define DWC_HCTSIZ_DATA1 2 ++#define DWC_HCTSIZ_DATA2 1 ++#define DWC_HCTSIZ_MDATA 3 ++#define DWC_HCTSIZ_SETUP 3 ++ ++ /** Do PING protocol when 1 */ ++ unsigned dopng:1; ++ } b; ++ ++ /** register bits */ ++ struct { ++ /** Scheduling information */ ++ unsigned schinfo:8; ++ ++ /** Number of transfer descriptors. ++ * Max value: ++ * 64 in general, ++ * 256 only for HS isochronous endpoint. ++ */ ++ unsigned ntd:8; ++ ++ /** Data packets to transfer */ ++ unsigned reserved16_28:13; ++ ++ /** ++ * Packet ID for next data packet ++ * 0: DATA0 ++ * 1: DATA2 ++ * 2: DATA1 ++ * 3: MDATA (non-Control) ++ */ ++ unsigned pid:2; ++ ++ /** Do PING protocol when 1 */ ++ unsigned dopng:1; ++ } b_ddma; ++} hctsiz_data_t; ++ ++/** ++ * This union represents the bit fields in the Host DMA Address ++ * Register used in Descriptor DMA mode. ++ */ ++typedef union hcdma_data { ++ /** raw register data */ ++ uint32_t d32; ++ /** register bits */ ++ struct { ++ unsigned reserved0_2:3; ++ /** Current Transfer Descriptor. Not used for ISOC */ ++ unsigned ctd:8; ++ /** Start Address of Descriptor List */ ++ unsigned dma_addr:21; ++ } b; ++} hcdma_data_t; ++ ++/** ++ * This union represents the bit fields in the DMA Descriptor ++ * status quadlet for host mode. Read the quadlet into the <i>d32</i> member then ++ * set/clear the bits using the <i>b</i>it elements. ++ */ ++typedef union host_dma_desc_sts { ++ /** raw register data */ ++ uint32_t d32; ++ /** quadlet bits */ ++ ++ /* for non-isochronous */ ++ struct { ++ /** Number of bytes */ ++ unsigned n_bytes:17; ++ /** QTD offset to jump when Short Packet received - only for IN EPs */ ++ unsigned qtd_offset:6; ++ /** ++ * Set to request the core to jump to alternate QTD if ++ * Short Packet received - only for IN EPs ++ */ ++ unsigned a_qtd:1; ++ /** ++ * Setup Packet bit. When set indicates that buffer contains ++ * setup packet. ++ */ ++ unsigned sup:1; ++ /** Interrupt On Complete */ ++ unsigned ioc:1; ++ /** End of List */ ++ unsigned eol:1; ++ unsigned reserved27:1; ++ /** Rx/Tx Status */ ++ unsigned sts:2; ++#define DMA_DESC_STS_PKTERR 1 ++ unsigned reserved30:1; ++ /** Active Bit */ ++ unsigned a:1; ++ } b; ++ /* for isochronous */ ++ struct { ++ /** Number of bytes */ ++ unsigned n_bytes:12; ++ unsigned reserved12_24:13; ++ /** Interrupt On Complete */ ++ unsigned ioc:1; ++ unsigned reserved26_27:2; ++ /** Rx/Tx Status */ ++ unsigned sts:2; ++ unsigned reserved30:1; ++ /** Active Bit */ ++ unsigned a:1; ++ } b_isoc; ++} host_dma_desc_sts_t; ++ ++#define MAX_DMA_DESC_SIZE 131071 ++#define MAX_DMA_DESC_NUM_GENERIC 64 ++#define MAX_DMA_DESC_NUM_HS_ISOC 256 ++#define MAX_FRLIST_EN_NUM 64 ++/** ++ * Host-mode DMA Descriptor structure ++ * ++ * DMA Descriptor structure contains two quadlets: ++ * Status quadlet and Data buffer pointer. ++ */ ++typedef struct dwc_otg_host_dma_desc { ++ /** DMA Descriptor status quadlet */ ++ host_dma_desc_sts_t status; ++ /** DMA Descriptor data buffer pointer */ ++ uint32_t buf; ++} dwc_otg_host_dma_desc_t; ++ ++/** OTG Host Interface Structure. ++ * ++ * The OTG Host Interface Structure structure contains information ++ * needed to manage the DWC_otg controller acting in host mode. It ++ * represents the programming view of the host-specific aspects of the ++ * controller. ++ */ ++typedef struct dwc_otg_host_if { ++ /** Host Global Registers starting at offset 400h.*/ ++ dwc_otg_host_global_regs_t *host_global_regs; ++#define DWC_OTG_HOST_GLOBAL_REG_OFFSET 0x400 ++ ++ /** Host Port 0 Control and Status Register */ ++ volatile uint32_t *hprt0; ++#define DWC_OTG_HOST_PORT_REGS_OFFSET 0x440 ++ ++ /** Host Channel Specific Registers at offsets 500h-5FCh. */ ++ dwc_otg_hc_regs_t *hc_regs[MAX_EPS_CHANNELS]; ++#define DWC_OTG_HOST_CHAN_REGS_OFFSET 0x500 ++#define DWC_OTG_CHAN_REGS_OFFSET 0x20 ++ ++ /* Host configuration information */ ++ /** Number of Host Channels (range: 1-16) */ ++ uint8_t num_host_channels; ++ /** Periodic EPs supported (0: no, 1: yes) */ ++ uint8_t perio_eps_supported; ++ /** Periodic Tx FIFO Size (Only 1 host periodic Tx FIFO) */ ++ uint16_t perio_tx_fifo_size; ++ ++} dwc_otg_host_if_t; ++ ++/** ++ * This union represents the bit fields in the Power and Clock Gating Control ++ * Register. Read the register into the <i>d32</i> member then set/clear the ++ * bits using the <i>b</i>it elements. ++ */ ++typedef union pcgcctl_data { ++ /** raw register data */ ++ uint32_t d32; ++ ++ /** register bits */ ++ struct { ++ /** Stop Pclk */ ++ unsigned stoppclk:1; ++ /** Gate Hclk */ ++ unsigned gatehclk:1; ++ /** Power Clamp */ ++ unsigned pwrclmp:1; ++ /** Reset Power Down Modules */ ++ unsigned rstpdwnmodule:1; ++ /** Reserved */ ++ unsigned reserved:1; ++ /** Enable Sleep Clock Gating (Enbl_L1Gating) */ ++ unsigned enbl_sleep_gating:1; ++ /** PHY In Sleep (PhySleep) */ ++ unsigned phy_in_sleep:1; ++ /** Deep Sleep*/ ++ unsigned deep_sleep:1; ++ unsigned resetaftsusp:1; ++ unsigned restoremode:1; ++ unsigned enbl_extnd_hiber:1; ++ unsigned extnd_hiber_pwrclmp:1; ++ unsigned extnd_hiber_switch:1; ++ unsigned ess_reg_restored:1; ++ unsigned prt_clk_sel:2; ++ unsigned port_power:1; ++ unsigned max_xcvrselect:2; ++ unsigned max_termsel:1; ++ unsigned mac_dev_addr:7; ++ unsigned p2hd_dev_enum_spd:2; ++ unsigned p2hd_prt_spd:2; ++ unsigned if_dev_mode:1; ++ } b; ++} pcgcctl_data_t; ++ ++/** ++ * This union represents the bit fields in the Global Data FIFO Software ++ * Configuration Register. Read the register into the <i>d32</i> member then ++ * set/clear the bits using the <i>b</i>it elements. ++ */ ++typedef union gdfifocfg_data { ++ /* raw register data */ ++ uint32_t d32; ++ /** register bits */ ++ struct { ++ /** OTG Data FIFO depth */ ++ unsigned gdfifocfg:16; ++ /** Start address of EP info controller */ ++ unsigned epinfobase:16; ++ } b; ++} gdfifocfg_data_t; ++ ++/** ++ * This union represents the bit fields in the Global Power Down Register ++ * Register. Read the register into the <i>d32</i> member then set/clear the ++ * bits using the <i>b</i>it elements. ++ */ ++typedef union gpwrdn_data { ++ /* raw register data */ ++ uint32_t d32; ++ ++ /** register bits */ ++ struct { ++ /** PMU Interrupt Select */ ++ unsigned pmuintsel:1; ++ /** PMU Active */ ++ unsigned pmuactv:1; ++ /** Restore */ ++ unsigned restore:1; ++ /** Power Down Clamp */ ++ unsigned pwrdnclmp:1; ++ /** Power Down Reset */ ++ unsigned pwrdnrstn:1; ++ /** Power Down Switch */ ++ unsigned pwrdnswtch:1; ++ /** Disable VBUS */ ++ unsigned dis_vbus:1; ++ /** Line State Change */ ++ unsigned lnstschng:1; ++ /** Line state change mask */ ++ unsigned lnstchng_msk:1; ++ /** Reset Detected */ ++ unsigned rst_det:1; ++ /** Reset Detect mask */ ++ unsigned rst_det_msk:1; ++ /** Disconnect Detected */ ++ unsigned disconn_det:1; ++ /** Disconnect Detect mask */ ++ unsigned disconn_det_msk:1; ++ /** Connect Detected*/ ++ unsigned connect_det:1; ++ /** Connect Detected Mask*/ ++ unsigned connect_det_msk:1; ++ /** SRP Detected */ ++ unsigned srp_det:1; ++ /** SRP Detect mask */ ++ unsigned srp_det_msk:1; ++ /** Status Change Interrupt */ ++ unsigned sts_chngint:1; ++ /** Status Change Interrupt Mask */ ++ unsigned sts_chngint_msk:1; ++ /** Line State */ ++ unsigned linestate:2; ++ /** Indicates current mode(status of IDDIG signal) */ ++ unsigned idsts:1; ++ /** B Session Valid signal status*/ ++ unsigned bsessvld:1; ++ /** ADP Event Detected */ ++ unsigned adp_int:1; ++ /** Multi Valued ID pin */ ++ unsigned mult_val_id_bc:5; ++ /** Reserved 24_31 */ ++ unsigned reserved29_31:3; ++ } b; ++} gpwrdn_data_t; ++ ++#endif +diff --git a/drivers/usb/host/dwc_otg/test/Makefile b/drivers/usb/host/dwc_otg/test/Makefile +new file mode 100644 +index 0000000..fc45375 +--- /dev/null ++++ b/drivers/usb/host/dwc_otg/test/Makefile +@@ -0,0 +1,16 @@ ++ ++PERL=/usr/bin/perl ++PL_TESTS=test_sysfs.pl test_mod_param.pl ++ ++.PHONY : test ++test : perl_tests ++ ++perl_tests : ++ @echo ++ @echo Running perl tests ++ @for test in $(PL_TESTS); do \ ++ if $(PERL) ./$$test ; then \ ++ echo "=======> $$test, PASSED" ; \ ++ else echo "=======> $$test, FAILED" ; \ ++ fi \ ++ done +diff --git a/drivers/usb/host/dwc_otg/test/dwc_otg_test.pm b/drivers/usb/host/dwc_otg/test/dwc_otg_test.pm +new file mode 100644 +index 0000000..85e55fd +--- /dev/null ++++ b/drivers/usb/host/dwc_otg/test/dwc_otg_test.pm +@@ -0,0 +1,337 @@ ++package dwc_otg_test; ++ ++use strict; ++use Exporter (); ++ ++use vars qw(@ISA @EXPORT ++$sysfsdir $paramdir $errors $params ++); ++ ++@ISA = qw(Exporter); ++ ++# ++# Globals ++# ++$sysfsdir = "/sys/devices/lm0"; ++$paramdir = "/sys/module/dwc_otg"; ++$errors = 0; ++ ++$params = [ ++ { ++ NAME => "otg_cap", ++ DEFAULT => 0, ++ ENUM => [], ++ LOW => 0, ++ HIGH => 2 ++ }, ++ { ++ NAME => "dma_enable", ++ DEFAULT => 0, ++ ENUM => [], ++ LOW => 0, ++ HIGH => 1 ++ }, ++ { ++ NAME => "dma_burst_size", ++ DEFAULT => 32, ++ ENUM => [1, 4, 8, 16, 32, 64, 128, 256], ++ LOW => 1, ++ HIGH => 256 ++ }, ++ { ++ NAME => "host_speed", ++ DEFAULT => 0, ++ ENUM => [], ++ LOW => 0, ++ HIGH => 1 ++ }, ++ { ++ NAME => "host_support_fs_ls_low_power", ++ DEFAULT => 0, ++ ENUM => [], ++ LOW => 0, ++ HIGH => 1 ++ }, ++ { ++ NAME => "host_ls_low_power_phy_clk", ++ DEFAULT => 0, ++ ENUM => [], ++ LOW => 0, ++ HIGH => 1 ++ }, ++ { ++ NAME => "dev_speed", ++ DEFAULT => 0, ++ ENUM => [], ++ LOW => 0, ++ HIGH => 1 ++ }, ++ { ++ NAME => "enable_dynamic_fifo", ++ DEFAULT => 1, ++ ENUM => [], ++ LOW => 0, ++ HIGH => 1 ++ }, ++ { ++ NAME => "data_fifo_size", ++ DEFAULT => 8192, ++ ENUM => [], ++ LOW => 32, ++ HIGH => 32768 ++ }, ++ { ++ NAME => "dev_rx_fifo_size", ++ DEFAULT => 1064, ++ ENUM => [], ++ LOW => 16, ++ HIGH => 32768 ++ }, ++ { ++ NAME => "dev_nperio_tx_fifo_size", ++ DEFAULT => 1024, ++ ENUM => [], ++ LOW => 16, ++ HIGH => 32768 ++ }, ++ { ++ NAME => "dev_perio_tx_fifo_size_1", ++ DEFAULT => 256, ++ ENUM => [], ++ LOW => 4, ++ HIGH => 768 ++ }, ++ { ++ NAME => "dev_perio_tx_fifo_size_2", ++ DEFAULT => 256, ++ ENUM => [], ++ LOW => 4, ++ HIGH => 768 ++ }, ++ { ++ NAME => "dev_perio_tx_fifo_size_3", ++ DEFAULT => 256, ++ ENUM => [], ++ LOW => 4, ++ HIGH => 768 ++ }, ++ { ++ NAME => "dev_perio_tx_fifo_size_4", ++ DEFAULT => 256, ++ ENUM => [], ++ LOW => 4, ++ HIGH => 768 ++ }, ++ { ++ NAME => "dev_perio_tx_fifo_size_5", ++ DEFAULT => 256, ++ ENUM => [], ++ LOW => 4, ++ HIGH => 768 ++ }, ++ { ++ NAME => "dev_perio_tx_fifo_size_6", ++ DEFAULT => 256, ++ ENUM => [], ++ LOW => 4, ++ HIGH => 768 ++ }, ++ { ++ NAME => "dev_perio_tx_fifo_size_7", ++ DEFAULT => 256, ++ ENUM => [], ++ LOW => 4, ++ HIGH => 768 ++ }, ++ { ++ NAME => "dev_perio_tx_fifo_size_8", ++ DEFAULT => 256, ++ ENUM => [], ++ LOW => 4, ++ HIGH => 768 ++ }, ++ { ++ NAME => "dev_perio_tx_fifo_size_9", ++ DEFAULT => 256, ++ ENUM => [], ++ LOW => 4, ++ HIGH => 768 ++ }, ++ { ++ NAME => "dev_perio_tx_fifo_size_10", ++ DEFAULT => 256, ++ ENUM => [], ++ LOW => 4, ++ HIGH => 768 ++ }, ++ { ++ NAME => "dev_perio_tx_fifo_size_11", ++ DEFAULT => 256, ++ ENUM => [], ++ LOW => 4, ++ HIGH => 768 ++ }, ++ { ++ NAME => "dev_perio_tx_fifo_size_12", ++ DEFAULT => 256, ++ ENUM => [], ++ LOW => 4, ++ HIGH => 768 ++ }, ++ { ++ NAME => "dev_perio_tx_fifo_size_13", ++ DEFAULT => 256, ++ ENUM => [], ++ LOW => 4, ++ HIGH => 768 ++ }, ++ { ++ NAME => "dev_perio_tx_fifo_size_14", ++ DEFAULT => 256, ++ ENUM => [], ++ LOW => 4, ++ HIGH => 768 ++ }, ++ { ++ NAME => "dev_perio_tx_fifo_size_15", ++ DEFAULT => 256, ++ ENUM => [], ++ LOW => 4, ++ HIGH => 768 ++ }, ++ { ++ NAME => "host_rx_fifo_size", ++ DEFAULT => 1024, ++ ENUM => [], ++ LOW => 16, ++ HIGH => 32768 ++ }, ++ { ++ NAME => "host_nperio_tx_fifo_size", ++ DEFAULT => 1024, ++ ENUM => [], ++ LOW => 16, ++ HIGH => 32768 ++ }, ++ { ++ NAME => "host_perio_tx_fifo_size", ++ DEFAULT => 1024, ++ ENUM => [], ++ LOW => 16, ++ HIGH => 32768 ++ }, ++ { ++ NAME => "max_transfer_size", ++ DEFAULT => 65535, ++ ENUM => [], ++ LOW => 2047, ++ HIGH => 65535 ++ }, ++ { ++ NAME => "max_packet_count", ++ DEFAULT => 511, ++ ENUM => [], ++ LOW => 15, ++ HIGH => 511 ++ }, ++ { ++ NAME => "host_channels", ++ DEFAULT => 12, ++ ENUM => [], ++ LOW => 1, ++ HIGH => 16 ++ }, ++ { ++ NAME => "dev_endpoints", ++ DEFAULT => 6, ++ ENUM => [], ++ LOW => 1, ++ HIGH => 15 ++ }, ++ { ++ NAME => "phy_type", ++ DEFAULT => 1, ++ ENUM => [], ++ LOW => 0, ++ HIGH => 2 ++ }, ++ { ++ NAME => "phy_utmi_width", ++ DEFAULT => 16, ++ ENUM => [8, 16], ++ LOW => 8, ++ HIGH => 16 ++ }, ++ { ++ NAME => "phy_ulpi_ddr", ++ DEFAULT => 0, ++ ENUM => [], ++ LOW => 0, ++ HIGH => 1 ++ }, ++ ]; ++ ++ ++# ++# ++sub check_arch { ++ $_ = `uname -m`; ++ chomp; ++ unless (m/armv4tl/) { ++ warn "# \n# Can't execute on $_. Run on integrator platform.\n# \n"; ++ return 0; ++ } ++ return 1; ++} ++ ++# ++# ++sub load_module { ++ my $params = shift; ++ print "\nRemoving Module\n"; ++ system "rmmod dwc_otg"; ++ print "Loading Module\n"; ++ if ($params ne "") { ++ print "Module Parameters: $params\n"; ++ } ++ if (system("modprobe dwc_otg $params")) { ++ warn "Unable to load module\n"; ++ return 0; ++ } ++ return 1; ++} ++ ++# ++# ++sub test_status { ++ my $arg = shift; ++ ++ print "\n"; ++ ++ if (defined $arg) { ++ warn "WARNING: $arg\n"; ++ } ++ ++ if ($errors > 0) { ++ warn "TEST FAILED with $errors errors\n"; ++ return 0; ++ } else { ++ print "TEST PASSED\n"; ++ return 0 if (defined $arg); ++ } ++ return 1; ++} ++ ++# ++# ++@EXPORT = qw( ++$sysfsdir ++$paramdir ++$params ++$errors ++check_arch ++load_module ++test_status ++); ++ ++1; +diff --git a/drivers/usb/host/dwc_otg/test/test_mod_param.pl b/drivers/usb/host/dwc_otg/test/test_mod_param.pl +new file mode 100644 +index 0000000..dc3820d +--- /dev/null ++++ b/drivers/usb/host/dwc_otg/test/test_mod_param.pl +@@ -0,0 +1,133 @@ ++#!/usr/bin/perl -w ++# ++# Run this program on the integrator. ++# ++# - Tests module parameter default values. ++# - Tests setting of valid module parameter values via modprobe. ++# - Tests invalid module parameter values. ++# ----------------------------------------------------------------------------- ++use strict; ++use dwc_otg_test; ++ ++check_arch() or die; ++ ++# ++# ++sub test { ++ my ($param,$expected) = @_; ++ my $value = get($param); ++ ++ if ($value == $expected) { ++ print "$param = $value, okay\n"; ++ } ++ ++ else { ++ warn "ERROR: value of $param != $expected, $value\n"; ++ $errors ++; ++ } ++} ++ ++# ++# ++sub get { ++ my $param = shift; ++ my $tmp = `cat $paramdir/$param`; ++ chomp $tmp; ++ return $tmp; ++} ++ ++# ++# ++sub test_main { ++ ++ print "\nTesting Module Parameters\n"; ++ ++ load_module("") or die; ++ ++ # Test initial values ++ print "\nTesting Default Values\n"; ++ foreach (@{$params}) { ++ test ($_->{NAME}, $_->{DEFAULT}); ++ } ++ ++ # Test low value ++ print "\nTesting Low Value\n"; ++ my $cmd_params = ""; ++ foreach (@{$params}) { ++ $cmd_params = $cmd_params . "$_->{NAME}=$_->{LOW} "; ++ } ++ load_module($cmd_params) or die; ++ ++ foreach (@{$params}) { ++ test ($_->{NAME}, $_->{LOW}); ++ } ++ ++ # Test high value ++ print "\nTesting High Value\n"; ++ $cmd_params = ""; ++ foreach (@{$params}) { ++ $cmd_params = $cmd_params . "$_->{NAME}=$_->{HIGH} "; ++ } ++ load_module($cmd_params) or die; ++ ++ foreach (@{$params}) { ++ test ($_->{NAME}, $_->{HIGH}); ++ } ++ ++ # Test Enum ++ print "\nTesting Enumerated\n"; ++ foreach (@{$params}) { ++ if (defined $_->{ENUM}) { ++ my $value; ++ foreach $value (@{$_->{ENUM}}) { ++ $cmd_params = "$_->{NAME}=$value"; ++ load_module($cmd_params) or die; ++ test ($_->{NAME}, $value); ++ } ++ } ++ } ++ ++ # Test Invalid Values ++ print "\nTesting Invalid Values\n"; ++ $cmd_params = ""; ++ foreach (@{$params}) { ++ $cmd_params = $cmd_params . sprintf "$_->{NAME}=%d ", $_->{LOW}-1; ++ } ++ load_module($cmd_params) or die; ++ ++ foreach (@{$params}) { ++ test ($_->{NAME}, $_->{DEFAULT}); ++ } ++ ++ $cmd_params = ""; ++ foreach (@{$params}) { ++ $cmd_params = $cmd_params . sprintf "$_->{NAME}=%d ", $_->{HIGH}+1; ++ } ++ load_module($cmd_params) or die; ++ ++ foreach (@{$params}) { ++ test ($_->{NAME}, $_->{DEFAULT}); ++ } ++ ++ print "\nTesting Enumerated\n"; ++ foreach (@{$params}) { ++ if (defined $_->{ENUM}) { ++ my $value; ++ foreach $value (@{$_->{ENUM}}) { ++ $value = $value + 1; ++ $cmd_params = "$_->{NAME}=$value"; ++ load_module($cmd_params) or die; ++ test ($_->{NAME}, $_->{DEFAULT}); ++ $value = $value - 2; ++ $cmd_params = "$_->{NAME}=$value"; ++ load_module($cmd_params) or die; ++ test ($_->{NAME}, $_->{DEFAULT}); ++ } ++ } ++ } ++ ++ test_status() or die; ++} ++ ++test_main(); ++0; +diff --git a/drivers/usb/host/dwc_otg/test/test_sysfs.pl b/drivers/usb/host/dwc_otg/test/test_sysfs.pl +new file mode 100644 +index 0000000..cdc9963 +--- /dev/null ++++ b/drivers/usb/host/dwc_otg/test/test_sysfs.pl +@@ -0,0 +1,193 @@ ++#!/usr/bin/perl -w ++# ++# Run this program on the integrator ++# - Tests select sysfs attributes. ++# - Todo ... test more attributes, hnp/srp, buspower/bussuspend, etc. ++# ----------------------------------------------------------------------------- ++use strict; ++use dwc_otg_test; ++ ++check_arch() or die; ++ ++# ++# ++sub test { ++ my ($attr,$expected) = @_; ++ my $string = get($attr); ++ ++ if ($string eq $expected) { ++ printf("$attr = $string, okay\n"); ++ } ++ else { ++ warn "ERROR: value of $attr != $expected, $string\n"; ++ $errors ++; ++ } ++} ++ ++# ++# ++sub set { ++ my ($reg, $value) = @_; ++ system "echo $value > $sysfsdir/$reg"; ++} ++ ++# ++# ++sub get { ++ my $attr = shift; ++ my $string = `cat $sysfsdir/$attr`; ++ chomp $string; ++ if ($string =~ m/\s\=\s/) { ++ my $tmp; ++ ($tmp, $string) = split /\s=\s/, $string; ++ } ++ return $string; ++} ++ ++# ++# ++sub test_main { ++ print("\nTesting Sysfs Attributes\n"); ++ ++ load_module("") or die; ++ ++ # Test initial values of regoffset/regvalue/guid/gsnpsid ++ print("\nTesting Default Values\n"); ++ ++ test("regoffset", "0xffffffff"); ++ test("regvalue", "invalid offset"); ++ test("guid", "0x12345678"); # this will fail if it has been changed ++ test("gsnpsid", "0x4f54200a"); ++ ++ # Test operation of regoffset/regvalue ++ print("\nTesting regoffset\n"); ++ set('regoffset', '5a5a5a5a'); ++ test("regoffset", "0xffffffff"); ++ ++ set('regoffset', '0'); ++ test("regoffset", "0x00000000"); ++ ++ set('regoffset', '40000'); ++ test("regoffset", "0x00000000"); ++ ++ set('regoffset', '3ffff'); ++ test("regoffset", "0x0003ffff"); ++ ++ set('regoffset', '1'); ++ test("regoffset", "0x00000001"); ++ ++ print("\nTesting regvalue\n"); ++ set('regoffset', '3c'); ++ test("regvalue", "0x12345678"); ++ set('regvalue', '5a5a5a5a'); ++ test("regvalue", "0x5a5a5a5a"); ++ set('regvalue','a5a5a5a5'); ++ test("regvalue", "0xa5a5a5a5"); ++ set('guid','12345678'); ++ ++ # Test HNP Capable ++ print("\nTesting HNP Capable bit\n"); ++ set('hnpcapable', '1'); ++ test("hnpcapable", "0x1"); ++ set('hnpcapable','0'); ++ test("hnpcapable", "0x0"); ++ ++ set('regoffset','0c'); ++ ++ my $old = get('gusbcfg'); ++ print("setting hnpcapable\n"); ++ set('hnpcapable', '1'); ++ test("hnpcapable", "0x1"); ++ test('gusbcfg', sprintf "0x%08x", (oct ($old) | (1<<9))); ++ test('regvalue', sprintf "0x%08x", (oct ($old) | (1<<9))); ++ ++ $old = get('gusbcfg'); ++ print("clearing hnpcapable\n"); ++ set('hnpcapable', '0'); ++ test("hnpcapable", "0x0"); ++ test ('gusbcfg', sprintf "0x%08x", oct ($old) & (~(1<<9))); ++ test ('regvalue', sprintf "0x%08x", oct ($old) & (~(1<<9))); ++ ++ # Test SRP Capable ++ print("\nTesting SRP Capable bit\n"); ++ set('srpcapable', '1'); ++ test("srpcapable", "0x1"); ++ set('srpcapable','0'); ++ test("srpcapable", "0x0"); ++ ++ set('regoffset','0c'); ++ ++ $old = get('gusbcfg'); ++ print("setting srpcapable\n"); ++ set('srpcapable', '1'); ++ test("srpcapable", "0x1"); ++ test('gusbcfg', sprintf "0x%08x", (oct ($old) | (1<<8))); ++ test('regvalue', sprintf "0x%08x", (oct ($old) | (1<<8))); ++ ++ $old = get('gusbcfg'); ++ print("clearing srpcapable\n"); ++ set('srpcapable', '0'); ++ test("srpcapable", "0x0"); ++ test('gusbcfg', sprintf "0x%08x", oct ($old) & (~(1<<8))); ++ test('regvalue', sprintf "0x%08x", oct ($old) & (~(1<<8))); ++ ++ # Test GGPIO ++ print("\nTesting GGPIO\n"); ++ set('ggpio','5a5a5a5a'); ++ test('ggpio','0x5a5a0000'); ++ set('ggpio','a5a5a5a5'); ++ test('ggpio','0xa5a50000'); ++ set('ggpio','11110000'); ++ test('ggpio','0x11110000'); ++ set('ggpio','00001111'); ++ test('ggpio','0x00000000'); ++ ++ # Test DEVSPEED ++ print("\nTesting DEVSPEED\n"); ++ set('regoffset','800'); ++ $old = get('regvalue'); ++ set('devspeed','0'); ++ test('devspeed','0x0'); ++ test('regvalue',sprintf("0x%08x", oct($old) & ~(0x3))); ++ set('devspeed','1'); ++ test('devspeed','0x1'); ++ test('regvalue',sprintf("0x%08x", oct($old) & ~(0x3) | 1)); ++ set('devspeed','2'); ++ test('devspeed','0x2'); ++ test('regvalue',sprintf("0x%08x", oct($old) & ~(0x3) | 2)); ++ set('devspeed','3'); ++ test('devspeed','0x3'); ++ test('regvalue',sprintf("0x%08x", oct($old) & ~(0x3) | 3)); ++ set('devspeed','4'); ++ test('devspeed','0x0'); ++ test('regvalue',sprintf("0x%08x", oct($old) & ~(0x3))); ++ set('devspeed','5'); ++ test('devspeed','0x1'); ++ test('regvalue',sprintf("0x%08x", oct($old) & ~(0x3) | 1)); ++ ++ ++ # mode Returns the current mode:0 for device mode1 for host mode Read ++ # hnp Initiate the Host Negotiation Protocol. Read returns the status. Read/Write ++ # srp Initiate the Session Request Protocol. Read returns the status. Read/Write ++ # buspower Get or Set the Power State of the bus (0 - Off or 1 - On) Read/Write ++ # bussuspend Suspend the USB bus. Read/Write ++ # busconnected Get the connection status of the bus Read ++ ++ # gotgctl Get or set the Core Control Status Register. Read/Write ++ ## gusbcfg Get or set the Core USB Configuration Register Read/Write ++ # grxfsiz Get or set the Receive FIFO Size Register Read/Write ++ # gnptxfsiz Get or set the non-periodic Transmit Size Register Read/Write ++ # gpvndctl Get or set the PHY Vendor Control Register Read/Write ++ ## ggpio Get the value in the lower 16-bits of the General Purpose IO Register or Set the upper 16 bits. Read/Write ++ ## guid Get or set the value of the User ID Register Read/Write ++ ## gsnpsid Get the value of the Synopsys ID Regester Read ++ ## devspeed Get or set the device speed setting in the DCFG register Read/Write ++ # enumspeed Gets the device enumeration Speed. Read ++ # hptxfsiz Get the value of the Host Periodic Transmit FIFO Read ++ # hprt0 Get or Set the value in the Host Port Control and Status Register Read/Write ++ ++ test_status("TEST NYI") or die; ++} ++ ++test_main(); ++0; + +From 5eb9e2e749d68100ad84ad874d095e96f7583860 Mon Sep 17 00:00:00 2001 +From: popcornmix <popcornmix@gmail.com> +Date: Wed, 17 Jun 2015 17:06:34 +0100 +Subject: [PATCH 034/112] bcm2708 framebuffer driver +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: popcornmix <popcornmix@gmail.com> + +bcm2708_fb : Implement blanking support using the mailbox property interface + +bcm2708_fb: Add pan and vsync controls + +bcm2708_fb: DMA acceleration for fb_copyarea + +Based on http://www.raspberrypi.org/phpBB3/viewtopic.php?p=62425#p62425 +Also used Simon's dmaer_master module as a reference for tweaking DMA +settings for better performance. + +For now busylooping only. IRQ support might be added later. +With non-overclocked Raspberry Pi, the performance is ~360 MB/s +for simple copy or ~260 MB/s for two-pass copy (used when dragging +windows to the right). + +In the case of using DMA channel 0, the performance improves +to ~440 MB/s. + +For comparison, VFP optimized CPU copy can only do ~114 MB/s in +the same conditions (hindered by reading uncached source buffer). + +Signed-off-by: Siarhei Siamashka <siarhei.siamashka@gmail.com> + +bcm2708_fb: report number of dma copies + +Add a counter (exported via debugfs) reporting the +number of dma copies that the framebuffer driver +has done, in order to help evaluate different +optimization strategies. + +Signed-off-by: Luke Diamand <luked@broadcom.com> + +bcm2708_fb: use IRQ for DMA copies + +The copyarea ioctl() uses DMA to speed things along. This +was busy-waiting for completion. This change supports using +an interrupt instead for larger transfers. For small +transfers, busy-waiting is still likely to be faster. + +Signed-off-by: Luke Diamand <luke@diamand.org> + +bcm2708: Make ioctl logging quieter + +video: fbdev: bcm2708_fb: Don't panic on error + +No need to panic the kernel if the video driver fails. +Just print a message and return an error. + +Signed-off-by: Noralf Trønnes <noralf@tronnes.org> + +fbdev: bcm2708_fb: Add ARCH_BCM2835 support + +Add Device Tree support. +Pass the device to dma_alloc_coherent() in order to get the +correct bus address on ARCH_BCM2835. +Use the new DMA legacy API header file. +Including <mach/platform.h> is not necessary. + +Signed-off-by: Noralf Trønnes <noralf@tronnes.org> + +BCM270x_DT: Add bcm2708-fb device + +Add bcm2708-fb to Device Tree and don't add the +platform device when booting in DT mode. + +Signed-off-by: Noralf Trønnes <noralf@tronnes.org> +--- + drivers/video/fbdev/Kconfig | 14 + + drivers/video/fbdev/Makefile | 1 + + drivers/video/fbdev/bcm2708_fb.c | 844 ++++++++++ + drivers/video/logo/logo_linux_clut224.ppm | 2483 ++++++++++------------------- + 4 files changed, 1740 insertions(+), 1602 deletions(-) + create mode 100644 drivers/video/fbdev/bcm2708_fb.c + +diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig +index 983280e..ee72c3a 100644 +--- a/drivers/video/fbdev/Kconfig ++++ b/drivers/video/fbdev/Kconfig +@@ -228,6 +228,20 @@ config FB_TILEBLITTING + comment "Frame buffer hardware drivers" + depends on FB + ++config FB_BCM2708 ++ tristate "BCM2708 framebuffer support" ++ depends on FB && RASPBERRYPI_FIRMWARE ++ select FB_CFB_FILLRECT ++ select FB_CFB_COPYAREA ++ select FB_CFB_IMAGEBLIT ++ help ++ This framebuffer device driver is for the BCM2708 framebuffer. ++ ++ If you want to compile this as a module (=code which can be ++ inserted into and removed from the running kernel), say M ++ here and read <file:Documentation/kbuild/modules.txt>. The module ++ will be called bcm2708_fb. ++ + config FB_GRVGA + tristate "Aeroflex Gaisler framebuffer support" + depends on FB && SPARC +diff --git a/drivers/video/fbdev/Makefile b/drivers/video/fbdev/Makefile +index 65fb150..df473d8 100644 +--- a/drivers/video/fbdev/Makefile ++++ b/drivers/video/fbdev/Makefile +@@ -12,6 +12,7 @@ obj-$(CONFIG_FB_MACMODES) += macmodes.o + obj-$(CONFIG_FB_WMT_GE_ROPS) += wmt_ge_rops.o + + # Hardware specific drivers go first ++obj-$(CONFIG_FB_BCM2708) += bcm2708_fb.o + obj-$(CONFIG_FB_AMIGA) += amifb.o c2p_planar.o + obj-$(CONFIG_FB_ARC) += arcfb.o + obj-$(CONFIG_FB_CLPS711X) += clps711x-fb.o +diff --git a/drivers/video/fbdev/bcm2708_fb.c b/drivers/video/fbdev/bcm2708_fb.c +new file mode 100644 +index 0000000..cae5aab +--- /dev/null ++++ b/drivers/video/fbdev/bcm2708_fb.c +@@ -0,0 +1,844 @@ ++/* ++ * linux/drivers/video/bcm2708_fb.c ++ * ++ * Copyright (C) 2010 Broadcom ++ * ++ * This file is subject to the terms and conditions of the GNU General Public ++ * License. See the file COPYING in the main directory of this archive ++ * for more details. ++ * ++ * Broadcom simple framebuffer driver ++ * ++ * This file is derived from cirrusfb.c ++ * Copyright 1999-2001 Jeff Garzik <jgarzik@pobox.com> ++ * ++ */ ++#include <linux/module.h> ++#include <linux/kernel.h> ++#include <linux/errno.h> ++#include <linux/string.h> ++#include <linux/slab.h> ++#include <linux/mm.h> ++#include <linux/fb.h> ++#include <linux/init.h> ++#include <linux/interrupt.h> ++#include <linux/ioport.h> ++#include <linux/list.h> ++#include <linux/platform_data/dma-bcm2708.h> ++#include <linux/platform_device.h> ++#include <linux/clk.h> ++#include <linux/printk.h> ++#include <linux/console.h> ++#include <linux/debugfs.h> ++#include <asm/sizes.h> ++#include <linux/io.h> ++#include <linux/dma-mapping.h> ++#include <soc/bcm2835/raspberrypi-firmware.h> ++ ++//#define BCM2708_FB_DEBUG ++#define MODULE_NAME "bcm2708_fb" ++ ++#ifdef BCM2708_FB_DEBUG ++#define print_debug(fmt,...) pr_debug("%s:%s:%d: "fmt, MODULE_NAME, __func__, __LINE__, ##__VA_ARGS__) ++#else ++#define print_debug(fmt,...) ++#endif ++ ++/* This is limited to 16 characters when displayed by X startup */ ++static const char *bcm2708_name = "BCM2708 FB"; ++ ++#define DRIVER_NAME "bcm2708_fb" ++ ++static int fbwidth = 800; /* module parameter */ ++static int fbheight = 480; /* module parameter */ ++static int fbdepth = 16; /* module parameter */ ++static int fbswap = 0; /* module parameter */ ++ ++static u32 dma_busy_wait_threshold = 1<<15; ++module_param(dma_busy_wait_threshold, int, 0644); ++MODULE_PARM_DESC(dma_busy_wait_threshold, "Busy-wait for DMA completion below this area"); ++ ++struct fb_alloc_tags { ++ struct rpi_firmware_property_tag_header tag1; ++ u32 xres, yres; ++ struct rpi_firmware_property_tag_header tag2; ++ u32 xres_virtual, yres_virtual; ++ struct rpi_firmware_property_tag_header tag3; ++ u32 bpp; ++ struct rpi_firmware_property_tag_header tag4; ++ u32 xoffset, yoffset; ++ struct rpi_firmware_property_tag_header tag5; ++ u32 base, screen_size; ++ struct rpi_firmware_property_tag_header tag6; ++ u32 pitch; ++}; ++ ++struct bcm2708_fb_stats { ++ struct debugfs_regset32 regset; ++ u32 dma_copies; ++ u32 dma_irqs; ++}; ++ ++struct bcm2708_fb { ++ struct fb_info fb; ++ struct platform_device *dev; ++ struct rpi_firmware *fw; ++ u32 cmap[16]; ++ u32 gpu_cmap[256]; ++ int dma_chan; ++ int dma_irq; ++ void __iomem *dma_chan_base; ++ void *cb_base; /* DMA control blocks */ ++ dma_addr_t cb_handle; ++ struct dentry *debugfs_dir; ++ wait_queue_head_t dma_waitq; ++ struct bcm2708_fb_stats stats; ++ unsigned long fb_bus_address; ++}; ++ ++#define to_bcm2708(info) container_of(info, struct bcm2708_fb, fb) ++ ++static void bcm2708_fb_debugfs_deinit(struct bcm2708_fb *fb) ++{ ++ debugfs_remove_recursive(fb->debugfs_dir); ++ fb->debugfs_dir = NULL; ++} ++ ++static int bcm2708_fb_debugfs_init(struct bcm2708_fb *fb) ++{ ++ static struct debugfs_reg32 stats_registers[] = { ++ { ++ "dma_copies", ++ offsetof(struct bcm2708_fb_stats, dma_copies) ++ }, ++ { ++ "dma_irqs", ++ offsetof(struct bcm2708_fb_stats, dma_irqs) ++ }, ++ }; ++ ++ fb->debugfs_dir = debugfs_create_dir(DRIVER_NAME, NULL); ++ if (!fb->debugfs_dir) { ++ pr_warn("%s: could not create debugfs entry\n", ++ __func__); ++ return -EFAULT; ++ } ++ ++ fb->stats.regset.regs = stats_registers; ++ fb->stats.regset.nregs = ARRAY_SIZE(stats_registers); ++ fb->stats.regset.base = &fb->stats; ++ ++ if (!debugfs_create_regset32( ++ "stats", 0444, fb->debugfs_dir, &fb->stats.regset)) { ++ pr_warn("%s: could not create statistics registers\n", ++ __func__); ++ goto fail; ++ } ++ return 0; ++ ++fail: ++ bcm2708_fb_debugfs_deinit(fb); ++ return -EFAULT; ++} ++ ++static int bcm2708_fb_set_bitfields(struct fb_var_screeninfo *var) ++{ ++ int ret = 0; ++ ++ memset(&var->transp, 0, sizeof(var->transp)); ++ ++ var->red.msb_right = 0; ++ var->green.msb_right = 0; ++ var->blue.msb_right = 0; ++ ++ switch (var->bits_per_pixel) { ++ case 1: ++ case 2: ++ case 4: ++ case 8: ++ var->red.length = var->bits_per_pixel; ++ var->red.offset = 0; ++ var->green.length = var->bits_per_pixel; ++ var->green.offset = 0; ++ var->blue.length = var->bits_per_pixel; ++ var->blue.offset = 0; ++ break; ++ case 16: ++ var->red.length = 5; ++ var->blue.length = 5; ++ /* ++ * Green length can be 5 or 6 depending whether ++ * we're operating in RGB555 or RGB565 mode. ++ */ ++ if (var->green.length != 5 && var->green.length != 6) ++ var->green.length = 6; ++ break; ++ case 24: ++ var->red.length = 8; ++ var->blue.length = 8; ++ var->green.length = 8; ++ break; ++ case 32: ++ var->red.length = 8; ++ var->green.length = 8; ++ var->blue.length = 8; ++ var->transp.length = 8; ++ break; ++ default: ++ ret = -EINVAL; ++ break; ++ } ++ ++ /* ++ * >= 16bpp displays have separate colour component bitfields ++ * encoded in the pixel data. Calculate their position from ++ * the bitfield length defined above. ++ */ ++ if (ret == 0 && var->bits_per_pixel >= 24 && fbswap) { ++ var->blue.offset = 0; ++ var->green.offset = var->blue.offset + var->blue.length; ++ var->red.offset = var->green.offset + var->green.length; ++ var->transp.offset = var->red.offset + var->red.length; ++ } else if (ret == 0 && var->bits_per_pixel >= 24) { ++ var->red.offset = 0; ++ var->green.offset = var->red.offset + var->red.length; ++ var->blue.offset = var->green.offset + var->green.length; ++ var->transp.offset = var->blue.offset + var->blue.length; ++ } else if (ret == 0 && var->bits_per_pixel >= 16) { ++ var->blue.offset = 0; ++ var->green.offset = var->blue.offset + var->blue.length; ++ var->red.offset = var->green.offset + var->green.length; ++ var->transp.offset = var->red.offset + var->red.length; ++ } ++ ++ return ret; ++} ++ ++static int bcm2708_fb_check_var(struct fb_var_screeninfo *var, ++ struct fb_info *info) ++{ ++ /* info input, var output */ ++ print_debug("bcm2708_fb_check_var info(%p) %dx%d (%dx%d), %d, %d\n", info, ++ info->var.xres, info->var.yres, info->var.xres_virtual, ++ info->var.yres_virtual, (int)info->screen_size, ++ info->var.bits_per_pixel); ++ print_debug("bcm2708_fb_check_var var(%p) %dx%d (%dx%d), %d\n", var, ++ var->xres, var->yres, var->xres_virtual, var->yres_virtual, ++ var->bits_per_pixel); ++ ++ if (!var->bits_per_pixel) ++ var->bits_per_pixel = 16; ++ ++ if (bcm2708_fb_set_bitfields(var) != 0) { ++ pr_err("bcm2708_fb_check_var: invalid bits_per_pixel %d\n", ++ var->bits_per_pixel); ++ return -EINVAL; ++ } ++ ++ ++ if (var->xres_virtual < var->xres) ++ var->xres_virtual = var->xres; ++ /* use highest possible virtual resolution */ ++ if (var->yres_virtual == -1) { ++ var->yres_virtual = 480; ++ ++ pr_err ++ ("bcm2708_fb_check_var: virtual resolution set to maximum of %dx%d\n", ++ var->xres_virtual, var->yres_virtual); ++ } ++ if (var->yres_virtual < var->yres) ++ var->yres_virtual = var->yres; ++ ++ if (var->xoffset < 0) ++ var->xoffset = 0; ++ if (var->yoffset < 0) ++ var->yoffset = 0; ++ ++ /* truncate xoffset and yoffset to maximum if too high */ ++ if (var->xoffset > var->xres_virtual - var->xres) ++ var->xoffset = var->xres_virtual - var->xres - 1; ++ if (var->yoffset > var->yres_virtual - var->yres) ++ var->yoffset = var->yres_virtual - var->yres - 1; ++ ++ return 0; ++} ++ ++static int bcm2708_fb_set_par(struct fb_info *info) ++{ ++ struct bcm2708_fb *fb = to_bcm2708(info); ++ struct fb_alloc_tags fbinfo = { ++ .tag1 = { RPI_FIRMWARE_FRAMEBUFFER_SET_PHYSICAL_WIDTH_HEIGHT, ++ 8, 0, }, ++ .xres = info->var.xres, ++ .yres = info->var.yres, ++ .tag2 = { RPI_FIRMWARE_FRAMEBUFFER_SET_VIRTUAL_WIDTH_HEIGHT, ++ 8, 0, }, ++ .xres_virtual = info->var.xres_virtual, ++ .yres_virtual = info->var.yres_virtual, ++ .tag3 = { RPI_FIRMWARE_FRAMEBUFFER_SET_DEPTH, 4, 0 }, ++ .bpp = info->var.bits_per_pixel, ++ .tag4 = { RPI_FIRMWARE_FRAMEBUFFER_SET_VIRTUAL_OFFSET, 8, 0 }, ++ .xoffset = info->var.xoffset, ++ .yoffset = info->var.yoffset, ++ .tag5 = { RPI_FIRMWARE_FRAMEBUFFER_ALLOCATE, 8, 0 }, ++ .base = 0, ++ .screen_size = 0, ++ .tag6 = { RPI_FIRMWARE_FRAMEBUFFER_GET_PITCH, 4, 0 }, ++ .pitch = 0, ++ }; ++ int ret; ++ ++ print_debug("bcm2708_fb_set_par info(%p) %dx%d (%dx%d), %d, %d\n", info, ++ info->var.xres, info->var.yres, info->var.xres_virtual, ++ info->var.yres_virtual, (int)info->screen_size, ++ info->var.bits_per_pixel); ++ ++ ret = rpi_firmware_property_list(fb->fw, &fbinfo, sizeof(fbinfo)); ++ if (ret) { ++ dev_err(info->device, ++ "Failed to allocate GPU framebuffer (%d)\n", ret); ++ return ret; ++ } ++ ++ if (info->var.bits_per_pixel <= 8) ++ fb->fb.fix.visual = FB_VISUAL_PSEUDOCOLOR; ++ else ++ fb->fb.fix.visual = FB_VISUAL_TRUECOLOR; ++ ++ fb->fb.fix.line_length = fbinfo.pitch; ++ fbinfo.base |= 0x40000000; ++ fb->fb_bus_address = fbinfo.base; ++ fbinfo.base &= ~0xc0000000; ++ fb->fb.fix.smem_start = fbinfo.base; ++ fb->fb.fix.smem_len = fbinfo.pitch * fbinfo.yres_virtual; ++ fb->fb.screen_size = fbinfo.screen_size; ++ if (fb->fb.screen_base) ++ iounmap(fb->fb.screen_base); ++ fb->fb.screen_base = ioremap_wc(fbinfo.base, fb->fb.screen_size); ++ if (!fb->fb.screen_base) { ++ /* the console may currently be locked */ ++ console_trylock(); ++ console_unlock(); ++ dev_err(info->device, "Failed to set screen_base\n"); ++ return -ENOMEM; ++ } ++ ++ print_debug ++ ("BCM2708FB: start = %p,%p width=%d, height=%d, bpp=%d, pitch=%d size=%d\n", ++ (void *)fb->fb.screen_base, (void *)fb->fb_bus_address, ++ fbinfo.xres, fbinfo.yres, fbinfo.bpp, ++ fbinfo.pitch, (int)fb->fb.screen_size); ++ ++ return 0; ++} ++ ++static inline u32 convert_bitfield(int val, struct fb_bitfield *bf) ++{ ++ unsigned int mask = (1 << bf->length) - 1; ++ ++ return (val >> (16 - bf->length) & mask) << bf->offset; ++} ++ ++ ++static int bcm2708_fb_setcolreg(unsigned int regno, unsigned int red, ++ unsigned int green, unsigned int blue, ++ unsigned int transp, struct fb_info *info) ++{ ++ struct bcm2708_fb *fb = to_bcm2708(info); ++ ++ /*print_debug("BCM2708FB: setcolreg %d:(%02x,%02x,%02x,%02x) %x\n", regno, red, green, blue, transp, fb->fb.fix.visual);*/ ++ if (fb->fb.var.bits_per_pixel <= 8) { ++ if (regno < 256) { ++ /* blue [23:16], green [15:8], red [7:0] */ ++ fb->gpu_cmap[regno] = ((red >> 8) & 0xff) << 0 | ++ ((green >> 8) & 0xff) << 8 | ++ ((blue >> 8) & 0xff) << 16; ++ } ++ /* Hack: we need to tell GPU the palette has changed, but currently bcm2708_fb_set_par takes noticable time when called for every (256) colour */ ++ /* So just call it for what looks like the last colour in a list for now. */ ++ if (regno == 15 || regno == 255) { ++ struct packet { ++ u32 offset; ++ u32 length; ++ u32 cmap[256]; ++ } *packet; ++ int ret; ++ ++ packet = kmalloc(sizeof(*packet), GFP_KERNEL); ++ if (!packet) ++ return -ENOMEM; ++ packet->offset = 0; ++ packet->length = regno + 1; ++ memcpy(packet->cmap, fb->gpu_cmap, sizeof(packet->cmap)); ++ ret = rpi_firmware_property(fb->fw, RPI_FIRMWARE_FRAMEBUFFER_SET_PALETTE, ++ packet, (2 + packet->length) * sizeof(u32)); ++ if (ret || packet->offset) ++ dev_err(info->device, "Failed to set palette (%d,%u)\n", ++ ret, packet->offset); ++ kfree(packet); ++ } ++ } else if (regno < 16) { ++ fb->cmap[regno] = convert_bitfield(transp, &fb->fb.var.transp) | ++ convert_bitfield(blue, &fb->fb.var.blue) | ++ convert_bitfield(green, &fb->fb.var.green) | ++ convert_bitfield(red, &fb->fb.var.red); ++ } ++ return regno > 255; ++} ++ ++static int bcm2708_fb_blank(int blank_mode, struct fb_info *info) ++{ ++ struct bcm2708_fb *fb = to_bcm2708(info); ++ u32 value; ++ int ret; ++ ++ switch (blank_mode) { ++ case FB_BLANK_UNBLANK: ++ value = 0; ++ break; ++ case FB_BLANK_NORMAL: ++ case FB_BLANK_VSYNC_SUSPEND: ++ case FB_BLANK_HSYNC_SUSPEND: ++ case FB_BLANK_POWERDOWN: ++ value = 1; ++ break; ++ default: ++ return -EINVAL; ++ } ++ ++ ret = rpi_firmware_property(fb->fw, RPI_FIRMWARE_FRAMEBUFFER_BLANK, ++ &value, sizeof(value)); ++ if (ret) ++ dev_err(info->device, "bcm2708_fb_blank(%d) failed: %d\n", ++ blank_mode, ret); ++ ++ return ret; ++} ++ ++static int bcm2708_fb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info) ++{ ++ s32 result; ++ info->var.xoffset = var->xoffset; ++ info->var.yoffset = var->yoffset; ++ result = bcm2708_fb_set_par(info); ++ if (result != 0) ++ pr_err("bcm2708_fb_pan_display(%d,%d) returns=%d\n", var->xoffset, var->yoffset, result); ++ return result; ++} ++ ++static int bcm2708_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg) ++{ ++ struct bcm2708_fb *fb = to_bcm2708(info); ++ u32 dummy = 0; ++ int ret; ++ ++ switch (cmd) { ++ case FBIO_WAITFORVSYNC: ++ ret = rpi_firmware_property(fb->fw, ++ RPI_FIRMWARE_FRAMEBUFFER_SET_VSYNC, ++ &dummy, sizeof(dummy)); ++ break; ++ default: ++ dev_dbg(info->device, "Unknown ioctl 0x%x\n", cmd); ++ return -ENOTTY; ++ } ++ ++ if (ret) ++ dev_err(info->device, "ioctl 0x%x failed (%d)\n", cmd, ret); ++ ++ return ret; ++} ++static void bcm2708_fb_fillrect(struct fb_info *info, ++ const struct fb_fillrect *rect) ++{ ++ /* (is called) print_debug("bcm2708_fb_fillrect\n"); */ ++ cfb_fillrect(info, rect); ++} ++ ++/* A helper function for configuring dma control block */ ++static void set_dma_cb(struct bcm2708_dma_cb *cb, ++ int burst_size, ++ dma_addr_t dst, ++ int dst_stride, ++ dma_addr_t src, ++ int src_stride, ++ int w, ++ int h) ++{ ++ cb->info = BCM2708_DMA_BURST(burst_size) | BCM2708_DMA_S_WIDTH | ++ BCM2708_DMA_S_INC | BCM2708_DMA_D_WIDTH | ++ BCM2708_DMA_D_INC | BCM2708_DMA_TDMODE; ++ cb->dst = dst; ++ cb->src = src; ++ /* ++ * This is not really obvious from the DMA documentation, ++ * but the top 16 bits must be programmmed to "height -1" ++ * and not "height" in 2D mode. ++ */ ++ cb->length = ((h - 1) << 16) | w; ++ cb->stride = ((dst_stride - w) << 16) | (u16)(src_stride - w); ++ cb->pad[0] = 0; ++ cb->pad[1] = 0; ++} ++ ++static void bcm2708_fb_copyarea(struct fb_info *info, ++ const struct fb_copyarea *region) ++{ ++ struct bcm2708_fb *fb = to_bcm2708(info); ++ struct bcm2708_dma_cb *cb = fb->cb_base; ++ int bytes_per_pixel = (info->var.bits_per_pixel + 7) >> 3; ++ /* Channel 0 supports larger bursts and is a bit faster */ ++ int burst_size = (fb->dma_chan == 0) ? 8 : 2; ++ int pixels = region->width * region->height; ++ ++ /* Fallback to cfb_copyarea() if we don't like something */ ++ if (in_atomic() || ++ bytes_per_pixel > 4 || ++ info->var.xres * info->var.yres > 1920 * 1200 || ++ region->width <= 0 || region->width > info->var.xres || ++ region->height <= 0 || region->height > info->var.yres || ++ region->sx < 0 || region->sx >= info->var.xres || ++ region->sy < 0 || region->sy >= info->var.yres || ++ region->dx < 0 || region->dx >= info->var.xres || ++ region->dy < 0 || region->dy >= info->var.yres || ++ region->sx + region->width > info->var.xres || ++ region->dx + region->width > info->var.xres || ++ region->sy + region->height > info->var.yres || ++ region->dy + region->height > info->var.yres) { ++ cfb_copyarea(info, region); ++ return; ++ } ++ ++ if (region->dy == region->sy && region->dx > region->sx) { ++ /* ++ * A difficult case of overlapped copy. Because DMA can't ++ * copy individual scanlines in backwards direction, we need ++ * two-pass processing. We do it by programming a chain of dma ++ * control blocks in the first 16K part of the buffer and use ++ * the remaining 48K as the intermediate temporary scratch ++ * buffer. The buffer size is sufficient to handle up to ++ * 1920x1200 resolution at 32bpp pixel depth. ++ */ ++ int y; ++ dma_addr_t control_block_pa = fb->cb_handle; ++ dma_addr_t scratchbuf = fb->cb_handle + 16 * 1024; ++ int scanline_size = bytes_per_pixel * region->width; ++ int scanlines_per_cb = (64 * 1024 - 16 * 1024) / scanline_size; ++ ++ for (y = 0; y < region->height; y += scanlines_per_cb) { ++ dma_addr_t src = ++ fb->fb_bus_address + ++ bytes_per_pixel * region->sx + ++ (region->sy + y) * fb->fb.fix.line_length; ++ dma_addr_t dst = ++ fb->fb_bus_address + ++ bytes_per_pixel * region->dx + ++ (region->dy + y) * fb->fb.fix.line_length; ++ ++ if (region->height - y < scanlines_per_cb) ++ scanlines_per_cb = region->height - y; ++ ++ set_dma_cb(cb, burst_size, scratchbuf, scanline_size, ++ src, fb->fb.fix.line_length, ++ scanline_size, scanlines_per_cb); ++ control_block_pa += sizeof(struct bcm2708_dma_cb); ++ cb->next = control_block_pa; ++ cb++; ++ ++ set_dma_cb(cb, burst_size, dst, fb->fb.fix.line_length, ++ scratchbuf, scanline_size, ++ scanline_size, scanlines_per_cb); ++ control_block_pa += sizeof(struct bcm2708_dma_cb); ++ cb->next = control_block_pa; ++ cb++; ++ } ++ /* move the pointer back to the last dma control block */ ++ cb--; ++ } else { ++ /* A single dma control block is enough. */ ++ int sy, dy, stride; ++ if (region->dy <= region->sy) { ++ /* processing from top to bottom */ ++ dy = region->dy; ++ sy = region->sy; ++ stride = fb->fb.fix.line_length; ++ } else { ++ /* processing from bottom to top */ ++ dy = region->dy + region->height - 1; ++ sy = region->sy + region->height - 1; ++ stride = -fb->fb.fix.line_length; ++ } ++ set_dma_cb(cb, burst_size, ++ fb->fb_bus_address + dy * fb->fb.fix.line_length + ++ bytes_per_pixel * region->dx, ++ stride, ++ fb->fb_bus_address + sy * fb->fb.fix.line_length + ++ bytes_per_pixel * region->sx, ++ stride, ++ region->width * bytes_per_pixel, ++ region->height); ++ } ++ ++ /* end of dma control blocks chain */ ++ cb->next = 0; ++ ++ ++ if (pixels < dma_busy_wait_threshold) { ++ bcm_dma_start(fb->dma_chan_base, fb->cb_handle); ++ bcm_dma_wait_idle(fb->dma_chan_base); ++ } else { ++ void __iomem *dma_chan = fb->dma_chan_base; ++ cb->info |= BCM2708_DMA_INT_EN; ++ bcm_dma_start(fb->dma_chan_base, fb->cb_handle); ++ while (bcm_dma_is_busy(dma_chan)) { ++ wait_event_interruptible( ++ fb->dma_waitq, ++ !bcm_dma_is_busy(dma_chan)); ++ } ++ fb->stats.dma_irqs++; ++ } ++ fb->stats.dma_copies++; ++} ++ ++static void bcm2708_fb_imageblit(struct fb_info *info, ++ const struct fb_image *image) ++{ ++ /* (is called) print_debug("bcm2708_fb_imageblit\n"); */ ++ cfb_imageblit(info, image); ++} ++ ++static irqreturn_t bcm2708_fb_dma_irq(int irq, void *cxt) ++{ ++ struct bcm2708_fb *fb = cxt; ++ ++ /* FIXME: should read status register to check if this is ++ * actually interrupting us or not, in case this interrupt ++ * ever becomes shared amongst several DMA channels ++ * ++ * readl(dma_chan_base + BCM2708_DMA_CS) & BCM2708_DMA_IRQ; ++ */ ++ ++ /* acknowledge the interrupt */ ++ writel(BCM2708_DMA_INT, fb->dma_chan_base + BCM2708_DMA_CS); ++ ++ wake_up(&fb->dma_waitq); ++ return IRQ_HANDLED; ++} ++ ++static struct fb_ops bcm2708_fb_ops = { ++ .owner = THIS_MODULE, ++ .fb_check_var = bcm2708_fb_check_var, ++ .fb_set_par = bcm2708_fb_set_par, ++ .fb_setcolreg = bcm2708_fb_setcolreg, ++ .fb_blank = bcm2708_fb_blank, ++ .fb_fillrect = bcm2708_fb_fillrect, ++ .fb_copyarea = bcm2708_fb_copyarea, ++ .fb_imageblit = bcm2708_fb_imageblit, ++ .fb_pan_display = bcm2708_fb_pan_display, ++ .fb_ioctl = bcm2708_ioctl, ++}; ++ ++static int bcm2708_fb_register(struct bcm2708_fb *fb) ++{ ++ int ret; ++ ++ fb->fb.fbops = &bcm2708_fb_ops; ++ fb->fb.flags = FBINFO_FLAG_DEFAULT | FBINFO_HWACCEL_COPYAREA; ++ fb->fb.pseudo_palette = fb->cmap; ++ ++ strncpy(fb->fb.fix.id, bcm2708_name, sizeof(fb->fb.fix.id)); ++ fb->fb.fix.type = FB_TYPE_PACKED_PIXELS; ++ fb->fb.fix.type_aux = 0; ++ fb->fb.fix.xpanstep = 1; ++ fb->fb.fix.ypanstep = 1; ++ fb->fb.fix.ywrapstep = 0; ++ fb->fb.fix.accel = FB_ACCEL_NONE; ++ ++ fb->fb.var.xres = fbwidth; ++ fb->fb.var.yres = fbheight; ++ fb->fb.var.xres_virtual = fbwidth; ++ fb->fb.var.yres_virtual = fbheight; ++ fb->fb.var.bits_per_pixel = fbdepth; ++ fb->fb.var.vmode = FB_VMODE_NONINTERLACED; ++ fb->fb.var.activate = FB_ACTIVATE_NOW; ++ fb->fb.var.nonstd = 0; ++ fb->fb.var.height = -1; /* height of picture in mm */ ++ fb->fb.var.width = -1; /* width of picture in mm */ ++ fb->fb.var.accel_flags = 0; ++ ++ fb->fb.monspecs.hfmin = 0; ++ fb->fb.monspecs.hfmax = 100000; ++ fb->fb.monspecs.vfmin = 0; ++ fb->fb.monspecs.vfmax = 400; ++ fb->fb.monspecs.dclkmin = 1000000; ++ fb->fb.monspecs.dclkmax = 100000000; ++ ++ bcm2708_fb_set_bitfields(&fb->fb.var); ++ init_waitqueue_head(&fb->dma_waitq); ++ ++ /* ++ * Allocate colourmap. ++ */ ++ ++ fb_set_var(&fb->fb, &fb->fb.var); ++ ret = bcm2708_fb_set_par(&fb->fb); ++ if (ret) ++ return ret; ++ ++ print_debug("BCM2708FB: registering framebuffer (%dx%d@%d) (%d)\n", fbwidth, ++ fbheight, fbdepth, fbswap); ++ ++ ret = register_framebuffer(&fb->fb); ++ print_debug("BCM2708FB: register framebuffer (%d)\n", ret); ++ if (ret == 0) ++ goto out; ++ ++ print_debug("BCM2708FB: cannot register framebuffer (%d)\n", ret); ++out: ++ return ret; ++} ++ ++static int bcm2708_fb_probe(struct platform_device *dev) ++{ ++ struct device_node *fw_np; ++ struct rpi_firmware *fw; ++ struct bcm2708_fb *fb; ++ int ret; ++ ++ fw_np = of_parse_phandle(dev->dev.of_node, "firmware", 0); ++/* Remove comment when booting without Device Tree is no longer supported ++ if (!fw_np) { ++ dev_err(&dev->dev, "Missing firmware node\n"); ++ return -ENOENT; ++ } ++*/ ++ fw = rpi_firmware_get(fw_np); ++ if (!fw) ++ return -EPROBE_DEFER; ++ ++ fb = kzalloc(sizeof(struct bcm2708_fb), GFP_KERNEL); ++ if (!fb) { ++ dev_err(&dev->dev, ++ "could not allocate new bcm2708_fb struct\n"); ++ ret = -ENOMEM; ++ goto free_region; ++ } ++ ++ fb->fw = fw; ++ bcm2708_fb_debugfs_init(fb); ++ ++ fb->cb_base = dma_alloc_writecombine(&dev->dev, SZ_64K, ++ &fb->cb_handle, GFP_KERNEL); ++ if (!fb->cb_base) { ++ dev_err(&dev->dev, "cannot allocate DMA CBs\n"); ++ ret = -ENOMEM; ++ goto free_fb; ++ } ++ ++ pr_info("BCM2708FB: allocated DMA memory %08x\n", ++ fb->cb_handle); ++ ++ ret = bcm_dma_chan_alloc(BCM_DMA_FEATURE_BULK, ++ &fb->dma_chan_base, &fb->dma_irq); ++ if (ret < 0) { ++ dev_err(&dev->dev, "couldn't allocate a DMA channel\n"); ++ goto free_cb; ++ } ++ fb->dma_chan = ret; ++ ++ ret = request_irq(fb->dma_irq, bcm2708_fb_dma_irq, ++ 0, "bcm2708_fb dma", fb); ++ if (ret) { ++ pr_err("%s: failed to request DMA irq\n", __func__); ++ goto free_dma_chan; ++ } ++ ++ ++ pr_info("BCM2708FB: allocated DMA channel %d @ %p\n", ++ fb->dma_chan, fb->dma_chan_base); ++ ++ fb->dev = dev; ++ fb->fb.device = &dev->dev; ++ ++ ret = bcm2708_fb_register(fb); ++ if (ret == 0) { ++ platform_set_drvdata(dev, fb); ++ goto out; ++ } ++ ++free_dma_chan: ++ bcm_dma_chan_free(fb->dma_chan); ++free_cb: ++ dma_free_writecombine(&dev->dev, SZ_64K, fb->cb_base, fb->cb_handle); ++free_fb: ++ kfree(fb); ++free_region: ++ dev_err(&dev->dev, "probe failed, err %d\n", ret); ++out: ++ return ret; ++} ++ ++static int bcm2708_fb_remove(struct platform_device *dev) ++{ ++ struct bcm2708_fb *fb = platform_get_drvdata(dev); ++ ++ platform_set_drvdata(dev, NULL); ++ ++ if (fb->fb.screen_base) ++ iounmap(fb->fb.screen_base); ++ unregister_framebuffer(&fb->fb); ++ ++ dma_free_writecombine(&dev->dev, SZ_64K, fb->cb_base, fb->cb_handle); ++ bcm_dma_chan_free(fb->dma_chan); ++ ++ bcm2708_fb_debugfs_deinit(fb); ++ ++ free_irq(fb->dma_irq, fb); ++ ++ kfree(fb); ++ ++ return 0; ++} ++ ++static const struct of_device_id bcm2708_fb_of_match_table[] = { ++ { .compatible = "brcm,bcm2708-fb", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, bcm2708_fb_of_match_table); ++ ++static struct platform_driver bcm2708_fb_driver = { ++ .probe = bcm2708_fb_probe, ++ .remove = bcm2708_fb_remove, ++ .driver = { ++ .name = DRIVER_NAME, ++ .owner = THIS_MODULE, ++ .of_match_table = bcm2708_fb_of_match_table, ++ }, ++}; ++ ++static int __init bcm2708_fb_init(void) ++{ ++ return platform_driver_register(&bcm2708_fb_driver); ++} ++ ++module_init(bcm2708_fb_init); ++ ++static void __exit bcm2708_fb_exit(void) ++{ ++ platform_driver_unregister(&bcm2708_fb_driver); ++} ++ ++module_exit(bcm2708_fb_exit); ++ ++module_param(fbwidth, int, 0644); ++module_param(fbheight, int, 0644); ++module_param(fbdepth, int, 0644); ++module_param(fbswap, int, 0644); ++ ++MODULE_DESCRIPTION("BCM2708 framebuffer driver"); ++MODULE_LICENSE("GPL"); ++ ++MODULE_PARM_DESC(fbwidth, "Width of ARM Framebuffer"); ++MODULE_PARM_DESC(fbheight, "Height of ARM Framebuffer"); ++MODULE_PARM_DESC(fbdepth, "Bit depth of ARM Framebuffer"); ++MODULE_PARM_DESC(fbswap, "Swap order of red and blue in 24 and 32 bit modes"); +diff --git a/drivers/video/logo/logo_linux_clut224.ppm b/drivers/video/logo/logo_linux_clut224.ppm +index 3c14e43..7626beb 100644 +--- a/drivers/video/logo/logo_linux_clut224.ppm ++++ b/drivers/video/logo/logo_linux_clut224.ppm +@@ -1,1604 +1,883 @@ + P3 +-# Standard 224-color Linux logo +-80 80 ++63 80 + 255 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 6 6 6 6 6 6 10 10 10 10 10 10 +- 10 10 10 6 6 6 6 6 6 6 6 6 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 6 6 6 10 10 10 14 14 14 +- 22 22 22 26 26 26 30 30 30 34 34 34 +- 30 30 30 30 30 30 26 26 26 18 18 18 +- 14 14 14 10 10 10 6 6 6 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 1 0 0 1 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 6 6 6 14 14 14 26 26 26 42 42 42 +- 54 54 54 66 66 66 78 78 78 78 78 78 +- 78 78 78 74 74 74 66 66 66 54 54 54 +- 42 42 42 26 26 26 18 18 18 10 10 10 +- 6 6 6 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 1 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 10 10 10 +- 22 22 22 42 42 42 66 66 66 86 86 86 +- 66 66 66 38 38 38 38 38 38 22 22 22 +- 26 26 26 34 34 34 54 54 54 66 66 66 +- 86 86 86 70 70 70 46 46 46 26 26 26 +- 14 14 14 6 6 6 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 1 0 0 1 0 0 1 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 10 10 10 26 26 26 +- 50 50 50 82 82 82 58 58 58 6 6 6 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 6 6 6 54 54 54 86 86 86 66 66 66 +- 38 38 38 18 18 18 6 6 6 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 6 6 6 22 22 22 50 50 50 +- 78 78 78 34 34 34 2 2 6 2 2 6 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 2 2 6 2 2 6 6 6 6 70 70 70 +- 78 78 78 46 46 46 22 22 22 6 6 6 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 1 0 0 1 0 0 1 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 6 6 6 18 18 18 42 42 42 82 82 82 +- 26 26 26 2 2 6 2 2 6 2 2 6 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 2 2 6 2 2 6 2 2 6 14 14 14 +- 46 46 46 34 34 34 6 6 6 2 2 6 +- 42 42 42 78 78 78 42 42 42 18 18 18 +- 6 6 6 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 1 0 0 0 0 0 1 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 10 10 10 30 30 30 66 66 66 58 58 58 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 2 2 6 2 2 6 2 2 6 26 26 26 +- 86 86 86 101 101 101 46 46 46 10 10 10 +- 2 2 6 58 58 58 70 70 70 34 34 34 +- 10 10 10 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 1 0 0 1 0 0 1 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 14 14 14 42 42 42 86 86 86 10 10 10 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 2 2 6 2 2 6 2 2 6 30 30 30 +- 94 94 94 94 94 94 58 58 58 26 26 26 +- 2 2 6 6 6 6 78 78 78 54 54 54 +- 22 22 22 6 6 6 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 6 6 6 +- 22 22 22 62 62 62 62 62 62 2 2 6 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 2 2 6 2 2 6 2 2 6 26 26 26 +- 54 54 54 38 38 38 18 18 18 10 10 10 +- 2 2 6 2 2 6 34 34 34 82 82 82 +- 38 38 38 14 14 14 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 1 0 0 1 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 6 6 6 +- 30 30 30 78 78 78 30 30 30 2 2 6 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 2 2 6 2 2 6 2 2 6 10 10 10 +- 10 10 10 2 2 6 2 2 6 2 2 6 +- 2 2 6 2 2 6 2 2 6 78 78 78 +- 50 50 50 18 18 18 6 6 6 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 1 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 10 10 10 +- 38 38 38 86 86 86 14 14 14 2 2 6 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 2 2 6 2 2 6 2 2 6 54 54 54 +- 66 66 66 26 26 26 6 6 6 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 1 0 0 1 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 14 14 14 +- 42 42 42 82 82 82 2 2 6 2 2 6 +- 2 2 6 6 6 6 10 10 10 2 2 6 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 2 2 6 2 2 6 2 2 6 6 6 6 +- 14 14 14 10 10 10 2 2 6 2 2 6 +- 2 2 6 2 2 6 2 2 6 18 18 18 +- 82 82 82 34 34 34 10 10 10 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 1 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 14 14 14 +- 46 46 46 86 86 86 2 2 6 2 2 6 +- 6 6 6 6 6 6 22 22 22 34 34 34 +- 6 6 6 2 2 6 2 2 6 2 2 6 +- 2 2 6 2 2 6 18 18 18 34 34 34 +- 10 10 10 50 50 50 22 22 22 2 2 6 +- 2 2 6 2 2 6 2 2 6 10 10 10 +- 86 86 86 42 42 42 14 14 14 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 1 0 0 1 0 0 1 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 14 14 14 +- 46 46 46 86 86 86 2 2 6 2 2 6 +- 38 38 38 116 116 116 94 94 94 22 22 22 +- 22 22 22 2 2 6 2 2 6 2 2 6 +- 14 14 14 86 86 86 138 138 138 162 162 162 +-154 154 154 38 38 38 26 26 26 6 6 6 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 86 86 86 46 46 46 14 14 14 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 14 14 14 +- 46 46 46 86 86 86 2 2 6 14 14 14 +-134 134 134 198 198 198 195 195 195 116 116 116 +- 10 10 10 2 2 6 2 2 6 6 6 6 +-101 98 89 187 187 187 210 210 210 218 218 218 +-214 214 214 134 134 134 14 14 14 6 6 6 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 86 86 86 50 50 50 18 18 18 6 6 6 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 1 0 0 0 +- 0 0 1 0 0 1 0 0 1 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 14 14 14 +- 46 46 46 86 86 86 2 2 6 54 54 54 +-218 218 218 195 195 195 226 226 226 246 246 246 +- 58 58 58 2 2 6 2 2 6 30 30 30 +-210 210 210 253 253 253 174 174 174 123 123 123 +-221 221 221 234 234 234 74 74 74 2 2 6 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 70 70 70 58 58 58 22 22 22 6 6 6 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 14 14 14 +- 46 46 46 82 82 82 2 2 6 106 106 106 +-170 170 170 26 26 26 86 86 86 226 226 226 +-123 123 123 10 10 10 14 14 14 46 46 46 +-231 231 231 190 190 190 6 6 6 70 70 70 +- 90 90 90 238 238 238 158 158 158 2 2 6 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 70 70 70 58 58 58 22 22 22 6 6 6 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 1 0 0 0 +- 0 0 1 0 0 1 0 0 1 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 14 14 14 +- 42 42 42 86 86 86 6 6 6 116 116 116 +-106 106 106 6 6 6 70 70 70 149 149 149 +-128 128 128 18 18 18 38 38 38 54 54 54 +-221 221 221 106 106 106 2 2 6 14 14 14 +- 46 46 46 190 190 190 198 198 198 2 2 6 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 74 74 74 62 62 62 22 22 22 6 6 6 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 1 0 0 0 +- 0 0 1 0 0 0 0 0 1 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 14 14 14 +- 42 42 42 94 94 94 14 14 14 101 101 101 +-128 128 128 2 2 6 18 18 18 116 116 116 +-118 98 46 121 92 8 121 92 8 98 78 10 +-162 162 162 106 106 106 2 2 6 2 2 6 +- 2 2 6 195 195 195 195 195 195 6 6 6 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 74 74 74 62 62 62 22 22 22 6 6 6 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 1 0 0 1 +- 0 0 1 0 0 0 0 0 1 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 10 10 10 +- 38 38 38 90 90 90 14 14 14 58 58 58 +-210 210 210 26 26 26 54 38 6 154 114 10 +-226 170 11 236 186 11 225 175 15 184 144 12 +-215 174 15 175 146 61 37 26 9 2 2 6 +- 70 70 70 246 246 246 138 138 138 2 2 6 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 70 70 70 66 66 66 26 26 26 6 6 6 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 10 10 10 +- 38 38 38 86 86 86 14 14 14 10 10 10 +-195 195 195 188 164 115 192 133 9 225 175 15 +-239 182 13 234 190 10 232 195 16 232 200 30 +-245 207 45 241 208 19 232 195 16 184 144 12 +-218 194 134 211 206 186 42 42 42 2 2 6 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 50 50 50 74 74 74 30 30 30 6 6 6 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 10 10 10 +- 34 34 34 86 86 86 14 14 14 2 2 6 +-121 87 25 192 133 9 219 162 10 239 182 13 +-236 186 11 232 195 16 241 208 19 244 214 54 +-246 218 60 246 218 38 246 215 20 241 208 19 +-241 208 19 226 184 13 121 87 25 2 2 6 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 50 50 50 82 82 82 34 34 34 10 10 10 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 10 10 10 +- 34 34 34 82 82 82 30 30 30 61 42 6 +-180 123 7 206 145 10 230 174 11 239 182 13 +-234 190 10 238 202 15 241 208 19 246 218 74 +-246 218 38 246 215 20 246 215 20 246 215 20 +-226 184 13 215 174 15 184 144 12 6 6 6 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 26 26 26 94 94 94 42 42 42 14 14 14 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 10 10 10 +- 30 30 30 78 78 78 50 50 50 104 69 6 +-192 133 9 216 158 10 236 178 12 236 186 11 +-232 195 16 241 208 19 244 214 54 245 215 43 +-246 215 20 246 215 20 241 208 19 198 155 10 +-200 144 11 216 158 10 156 118 10 2 2 6 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 6 6 6 90 90 90 54 54 54 18 18 18 +- 6 6 6 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 10 10 10 +- 30 30 30 78 78 78 46 46 46 22 22 22 +-137 92 6 210 162 10 239 182 13 238 190 10 +-238 202 15 241 208 19 246 215 20 246 215 20 +-241 208 19 203 166 17 185 133 11 210 150 10 +-216 158 10 210 150 10 102 78 10 2 2 6 +- 6 6 6 54 54 54 14 14 14 2 2 6 +- 2 2 6 62 62 62 74 74 74 30 30 30 +- 10 10 10 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 10 10 10 +- 34 34 34 78 78 78 50 50 50 6 6 6 +- 94 70 30 139 102 15 190 146 13 226 184 13 +-232 200 30 232 195 16 215 174 15 190 146 13 +-168 122 10 192 133 9 210 150 10 213 154 11 +-202 150 34 182 157 106 101 98 89 2 2 6 +- 2 2 6 78 78 78 116 116 116 58 58 58 +- 2 2 6 22 22 22 90 90 90 46 46 46 +- 18 18 18 6 6 6 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 10 10 10 +- 38 38 38 86 86 86 50 50 50 6 6 6 +-128 128 128 174 154 114 156 107 11 168 122 10 +-198 155 10 184 144 12 197 138 11 200 144 11 +-206 145 10 206 145 10 197 138 11 188 164 115 +-195 195 195 198 198 198 174 174 174 14 14 14 +- 2 2 6 22 22 22 116 116 116 116 116 116 +- 22 22 22 2 2 6 74 74 74 70 70 70 +- 30 30 30 10 10 10 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 6 6 6 18 18 18 +- 50 50 50 101 101 101 26 26 26 10 10 10 +-138 138 138 190 190 190 174 154 114 156 107 11 +-197 138 11 200 144 11 197 138 11 192 133 9 +-180 123 7 190 142 34 190 178 144 187 187 187 +-202 202 202 221 221 221 214 214 214 66 66 66 +- 2 2 6 2 2 6 50 50 50 62 62 62 +- 6 6 6 2 2 6 10 10 10 90 90 90 +- 50 50 50 18 18 18 6 6 6 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 10 10 10 34 34 34 +- 74 74 74 74 74 74 2 2 6 6 6 6 +-144 144 144 198 198 198 190 190 190 178 166 146 +-154 121 60 156 107 11 156 107 11 168 124 44 +-174 154 114 187 187 187 190 190 190 210 210 210 +-246 246 246 253 253 253 253 253 253 182 182 182 +- 6 6 6 2 2 6 2 2 6 2 2 6 +- 2 2 6 2 2 6 2 2 6 62 62 62 +- 74 74 74 34 34 34 14 14 14 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 10 10 10 22 22 22 54 54 54 +- 94 94 94 18 18 18 2 2 6 46 46 46 +-234 234 234 221 221 221 190 190 190 190 190 190 +-190 190 190 187 187 187 187 187 187 190 190 190 +-190 190 190 195 195 195 214 214 214 242 242 242 +-253 253 253 253 253 253 253 253 253 253 253 253 +- 82 82 82 2 2 6 2 2 6 2 2 6 +- 2 2 6 2 2 6 2 2 6 14 14 14 +- 86 86 86 54 54 54 22 22 22 6 6 6 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 6 6 6 18 18 18 46 46 46 90 90 90 +- 46 46 46 18 18 18 6 6 6 182 182 182 +-253 253 253 246 246 246 206 206 206 190 190 190 +-190 190 190 190 190 190 190 190 190 190 190 190 +-206 206 206 231 231 231 250 250 250 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-202 202 202 14 14 14 2 2 6 2 2 6 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 42 42 42 86 86 86 42 42 42 18 18 18 +- 6 6 6 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 6 6 6 +- 14 14 14 38 38 38 74 74 74 66 66 66 +- 2 2 6 6 6 6 90 90 90 250 250 250 +-253 253 253 253 253 253 238 238 238 198 198 198 +-190 190 190 190 190 190 195 195 195 221 221 221 +-246 246 246 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 82 82 82 2 2 6 2 2 6 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 2 2 6 78 78 78 70 70 70 34 34 34 +- 14 14 14 6 6 6 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 14 14 14 +- 34 34 34 66 66 66 78 78 78 6 6 6 +- 2 2 6 18 18 18 218 218 218 253 253 253 +-253 253 253 253 253 253 253 253 253 246 246 246 +-226 226 226 231 231 231 246 246 246 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 178 178 178 2 2 6 2 2 6 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 2 2 6 18 18 18 90 90 90 62 62 62 +- 30 30 30 10 10 10 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 10 10 10 26 26 26 +- 58 58 58 90 90 90 18 18 18 2 2 6 +- 2 2 6 110 110 110 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-250 250 250 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 231 231 231 18 18 18 2 2 6 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 2 2 6 2 2 6 18 18 18 94 94 94 +- 54 54 54 26 26 26 10 10 10 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 6 6 6 22 22 22 50 50 50 +- 90 90 90 26 26 26 2 2 6 2 2 6 +- 14 14 14 195 195 195 250 250 250 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-250 250 250 242 242 242 54 54 54 2 2 6 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 2 2 6 2 2 6 2 2 6 38 38 38 +- 86 86 86 50 50 50 22 22 22 6 6 6 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 6 6 6 14 14 14 38 38 38 82 82 82 +- 34 34 34 2 2 6 2 2 6 2 2 6 +- 42 42 42 195 195 195 246 246 246 253 253 253 +-253 253 253 253 253 253 253 253 253 250 250 250 +-242 242 242 242 242 242 250 250 250 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 250 250 250 246 246 246 238 238 238 +-226 226 226 231 231 231 101 101 101 6 6 6 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 38 38 38 82 82 82 42 42 42 14 14 14 +- 6 6 6 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 10 10 10 26 26 26 62 62 62 66 66 66 +- 2 2 6 2 2 6 2 2 6 6 6 6 +- 70 70 70 170 170 170 206 206 206 234 234 234 +-246 246 246 250 250 250 250 250 250 238 238 238 +-226 226 226 231 231 231 238 238 238 250 250 250 +-250 250 250 250 250 250 246 246 246 231 231 231 +-214 214 214 206 206 206 202 202 202 202 202 202 +-198 198 198 202 202 202 182 182 182 18 18 18 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 2 2 6 62 62 62 66 66 66 30 30 30 +- 10 10 10 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 14 14 14 42 42 42 82 82 82 18 18 18 +- 2 2 6 2 2 6 2 2 6 10 10 10 +- 94 94 94 182 182 182 218 218 218 242 242 242 +-250 250 250 253 253 253 253 253 253 250 250 250 +-234 234 234 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 246 246 246 +-238 238 238 226 226 226 210 210 210 202 202 202 +-195 195 195 195 195 195 210 210 210 158 158 158 +- 6 6 6 14 14 14 50 50 50 14 14 14 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 2 2 6 6 6 6 86 86 86 46 46 46 +- 18 18 18 6 6 6 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 6 6 6 +- 22 22 22 54 54 54 70 70 70 2 2 6 +- 2 2 6 10 10 10 2 2 6 22 22 22 +-166 166 166 231 231 231 250 250 250 253 253 253 +-253 253 253 253 253 253 253 253 253 250 250 250 +-242 242 242 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 246 246 246 +-231 231 231 206 206 206 198 198 198 226 226 226 +- 94 94 94 2 2 6 6 6 6 38 38 38 +- 30 30 30 2 2 6 2 2 6 2 2 6 +- 2 2 6 2 2 6 62 62 62 66 66 66 +- 26 26 26 10 10 10 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 10 10 10 +- 30 30 30 74 74 74 50 50 50 2 2 6 +- 26 26 26 26 26 26 2 2 6 106 106 106 +-238 238 238 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 246 246 246 218 218 218 202 202 202 +-210 210 210 14 14 14 2 2 6 2 2 6 +- 30 30 30 22 22 22 2 2 6 2 2 6 +- 2 2 6 2 2 6 18 18 18 86 86 86 +- 42 42 42 14 14 14 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 14 14 14 +- 42 42 42 90 90 90 22 22 22 2 2 6 +- 42 42 42 2 2 6 18 18 18 218 218 218 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 250 250 250 221 221 221 +-218 218 218 101 101 101 2 2 6 14 14 14 +- 18 18 18 38 38 38 10 10 10 2 2 6 +- 2 2 6 2 2 6 2 2 6 78 78 78 +- 58 58 58 22 22 22 6 6 6 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 6 6 6 18 18 18 +- 54 54 54 82 82 82 2 2 6 26 26 26 +- 22 22 22 2 2 6 123 123 123 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 250 250 250 +-238 238 238 198 198 198 6 6 6 38 38 38 +- 58 58 58 26 26 26 38 38 38 2 2 6 +- 2 2 6 2 2 6 2 2 6 46 46 46 +- 78 78 78 30 30 30 10 10 10 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 10 10 10 30 30 30 +- 74 74 74 58 58 58 2 2 6 42 42 42 +- 2 2 6 22 22 22 231 231 231 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 250 250 250 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 246 246 246 46 46 46 38 38 38 +- 42 42 42 14 14 14 38 38 38 14 14 14 +- 2 2 6 2 2 6 2 2 6 6 6 6 +- 86 86 86 46 46 46 14 14 14 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 6 6 6 14 14 14 42 42 42 +- 90 90 90 18 18 18 18 18 18 26 26 26 +- 2 2 6 116 116 116 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 250 250 250 238 238 238 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 94 94 94 6 6 6 +- 2 2 6 2 2 6 10 10 10 34 34 34 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 74 74 74 58 58 58 22 22 22 6 6 6 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 10 10 10 26 26 26 66 66 66 +- 82 82 82 2 2 6 38 38 38 6 6 6 +- 14 14 14 210 210 210 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 246 246 246 242 242 242 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 144 144 144 2 2 6 +- 2 2 6 2 2 6 2 2 6 46 46 46 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 42 42 42 74 74 74 30 30 30 10 10 10 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 6 6 6 14 14 14 42 42 42 90 90 90 +- 26 26 26 6 6 6 42 42 42 2 2 6 +- 74 74 74 250 250 250 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 242 242 242 242 242 242 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 182 182 182 2 2 6 +- 2 2 6 2 2 6 2 2 6 46 46 46 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 10 10 10 86 86 86 38 38 38 10 10 10 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 10 10 10 26 26 26 66 66 66 82 82 82 +- 2 2 6 22 22 22 18 18 18 2 2 6 +-149 149 149 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 234 234 234 242 242 242 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 206 206 206 2 2 6 +- 2 2 6 2 2 6 2 2 6 38 38 38 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 6 6 6 86 86 86 46 46 46 14 14 14 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 6 6 6 +- 18 18 18 46 46 46 86 86 86 18 18 18 +- 2 2 6 34 34 34 10 10 10 6 6 6 +-210 210 210 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 234 234 234 242 242 242 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 221 221 221 6 6 6 +- 2 2 6 2 2 6 6 6 6 30 30 30 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 2 2 6 82 82 82 54 54 54 18 18 18 +- 6 6 6 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 10 10 10 +- 26 26 26 66 66 66 62 62 62 2 2 6 +- 2 2 6 38 38 38 10 10 10 26 26 26 +-238 238 238 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 231 231 231 238 238 238 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 231 231 231 6 6 6 +- 2 2 6 2 2 6 10 10 10 30 30 30 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 2 2 6 66 66 66 58 58 58 22 22 22 +- 6 6 6 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 10 10 10 +- 38 38 38 78 78 78 6 6 6 2 2 6 +- 2 2 6 46 46 46 14 14 14 42 42 42 +-246 246 246 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 231 231 231 242 242 242 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 234 234 234 10 10 10 +- 2 2 6 2 2 6 22 22 22 14 14 14 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 2 2 6 66 66 66 62 62 62 22 22 22 +- 6 6 6 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 6 6 6 18 18 18 +- 50 50 50 74 74 74 2 2 6 2 2 6 +- 14 14 14 70 70 70 34 34 34 62 62 62 +-250 250 250 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 231 231 231 246 246 246 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 234 234 234 14 14 14 +- 2 2 6 2 2 6 30 30 30 2 2 6 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 2 2 6 66 66 66 62 62 62 22 22 22 +- 6 6 6 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 6 6 6 18 18 18 +- 54 54 54 62 62 62 2 2 6 2 2 6 +- 2 2 6 30 30 30 46 46 46 70 70 70 +-250 250 250 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 231 231 231 246 246 246 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 226 226 226 10 10 10 +- 2 2 6 6 6 6 30 30 30 2 2 6 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 2 2 6 66 66 66 58 58 58 22 22 22 +- 6 6 6 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 6 6 6 22 22 22 +- 58 58 58 62 62 62 2 2 6 2 2 6 +- 2 2 6 2 2 6 30 30 30 78 78 78 +-250 250 250 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 231 231 231 246 246 246 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 206 206 206 2 2 6 +- 22 22 22 34 34 34 18 14 6 22 22 22 +- 26 26 26 18 18 18 6 6 6 2 2 6 +- 2 2 6 82 82 82 54 54 54 18 18 18 +- 6 6 6 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 6 6 6 26 26 26 +- 62 62 62 106 106 106 74 54 14 185 133 11 +-210 162 10 121 92 8 6 6 6 62 62 62 +-238 238 238 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 231 231 231 246 246 246 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 158 158 158 18 18 18 +- 14 14 14 2 2 6 2 2 6 2 2 6 +- 6 6 6 18 18 18 66 66 66 38 38 38 +- 6 6 6 94 94 94 50 50 50 18 18 18 +- 6 6 6 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 6 6 6 +- 10 10 10 10 10 10 18 18 18 38 38 38 +- 78 78 78 142 134 106 216 158 10 242 186 14 +-246 190 14 246 190 14 156 118 10 10 10 10 +- 90 90 90 238 238 238 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 231 231 231 250 250 250 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 246 230 190 +-238 204 91 238 204 91 181 142 44 37 26 9 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 2 2 6 2 2 6 38 38 38 46 46 46 +- 26 26 26 106 106 106 54 54 54 18 18 18 +- 6 6 6 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 6 6 6 14 14 14 22 22 22 +- 30 30 30 38 38 38 50 50 50 70 70 70 +-106 106 106 190 142 34 226 170 11 242 186 14 +-246 190 14 246 190 14 246 190 14 154 114 10 +- 6 6 6 74 74 74 226 226 226 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 231 231 231 250 250 250 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 228 184 62 +-241 196 14 241 208 19 232 195 16 38 30 10 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 2 2 6 6 6 6 30 30 30 26 26 26 +-203 166 17 154 142 90 66 66 66 26 26 26 +- 6 6 6 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 6 6 6 18 18 18 38 38 38 58 58 58 +- 78 78 78 86 86 86 101 101 101 123 123 123 +-175 146 61 210 150 10 234 174 13 246 186 14 +-246 190 14 246 190 14 246 190 14 238 190 10 +-102 78 10 2 2 6 46 46 46 198 198 198 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 234 234 234 242 242 242 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 224 178 62 +-242 186 14 241 196 14 210 166 10 22 18 6 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 2 2 6 2 2 6 6 6 6 121 92 8 +-238 202 15 232 195 16 82 82 82 34 34 34 +- 10 10 10 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 14 14 14 38 38 38 70 70 70 154 122 46 +-190 142 34 200 144 11 197 138 11 197 138 11 +-213 154 11 226 170 11 242 186 14 246 190 14 +-246 190 14 246 190 14 246 190 14 246 190 14 +-225 175 15 46 32 6 2 2 6 22 22 22 +-158 158 158 250 250 250 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 250 250 250 242 242 242 224 178 62 +-239 182 13 236 186 11 213 154 11 46 32 6 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 2 2 6 2 2 6 61 42 6 225 175 15 +-238 190 10 236 186 11 112 100 78 42 42 42 +- 14 14 14 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 6 6 6 +- 22 22 22 54 54 54 154 122 46 213 154 11 +-226 170 11 230 174 11 226 170 11 226 170 11 +-236 178 12 242 186 14 246 190 14 246 190 14 +-246 190 14 246 190 14 246 190 14 246 190 14 +-241 196 14 184 144 12 10 10 10 2 2 6 +- 6 6 6 116 116 116 242 242 242 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 231 231 231 198 198 198 214 170 54 +-236 178 12 236 178 12 210 150 10 137 92 6 +- 18 14 6 2 2 6 2 2 6 2 2 6 +- 6 6 6 70 47 6 200 144 11 236 178 12 +-239 182 13 239 182 13 124 112 88 58 58 58 +- 22 22 22 6 6 6 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 10 10 10 +- 30 30 30 70 70 70 180 133 36 226 170 11 +-239 182 13 242 186 14 242 186 14 246 186 14 +-246 190 14 246 190 14 246 190 14 246 190 14 +-246 190 14 246 190 14 246 190 14 246 190 14 +-246 190 14 232 195 16 98 70 6 2 2 6 +- 2 2 6 2 2 6 66 66 66 221 221 221 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 206 206 206 198 198 198 214 166 58 +-230 174 11 230 174 11 216 158 10 192 133 9 +-163 110 8 116 81 8 102 78 10 116 81 8 +-167 114 7 197 138 11 226 170 11 239 182 13 +-242 186 14 242 186 14 162 146 94 78 78 78 +- 34 34 34 14 14 14 6 6 6 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 6 6 6 +- 30 30 30 78 78 78 190 142 34 226 170 11 +-239 182 13 246 190 14 246 190 14 246 190 14 +-246 190 14 246 190 14 246 190 14 246 190 14 +-246 190 14 246 190 14 246 190 14 246 190 14 +-246 190 14 241 196 14 203 166 17 22 18 6 +- 2 2 6 2 2 6 2 2 6 38 38 38 +-218 218 218 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-250 250 250 206 206 206 198 198 198 202 162 69 +-226 170 11 236 178 12 224 166 10 210 150 10 +-200 144 11 197 138 11 192 133 9 197 138 11 +-210 150 10 226 170 11 242 186 14 246 190 14 +-246 190 14 246 186 14 225 175 15 124 112 88 +- 62 62 62 30 30 30 14 14 14 6 6 6 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 10 10 10 +- 30 30 30 78 78 78 174 135 50 224 166 10 +-239 182 13 246 190 14 246 190 14 246 190 14 +-246 190 14 246 190 14 246 190 14 246 190 14 +-246 190 14 246 190 14 246 190 14 246 190 14 +-246 190 14 246 190 14 241 196 14 139 102 15 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 78 78 78 250 250 250 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-250 250 250 214 214 214 198 198 198 190 150 46 +-219 162 10 236 178 12 234 174 13 224 166 10 +-216 158 10 213 154 11 213 154 11 216 158 10 +-226 170 11 239 182 13 246 190 14 246 190 14 +-246 190 14 246 190 14 242 186 14 206 162 42 +-101 101 101 58 58 58 30 30 30 14 14 14 +- 6 6 6 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 10 10 10 +- 30 30 30 74 74 74 174 135 50 216 158 10 +-236 178 12 246 190 14 246 190 14 246 190 14 +-246 190 14 246 190 14 246 190 14 246 190 14 +-246 190 14 246 190 14 246 190 14 246 190 14 +-246 190 14 246 190 14 241 196 14 226 184 13 +- 61 42 6 2 2 6 2 2 6 2 2 6 +- 22 22 22 238 238 238 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 226 226 226 187 187 187 180 133 36 +-216 158 10 236 178 12 239 182 13 236 178 12 +-230 174 11 226 170 11 226 170 11 230 174 11 +-236 178 12 242 186 14 246 190 14 246 190 14 +-246 190 14 246 190 14 246 186 14 239 182 13 +-206 162 42 106 106 106 66 66 66 34 34 34 +- 14 14 14 6 6 6 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 6 6 6 +- 26 26 26 70 70 70 163 133 67 213 154 11 +-236 178 12 246 190 14 246 190 14 246 190 14 +-246 190 14 246 190 14 246 190 14 246 190 14 +-246 190 14 246 190 14 246 190 14 246 190 14 +-246 190 14 246 190 14 246 190 14 241 196 14 +-190 146 13 18 14 6 2 2 6 2 2 6 +- 46 46 46 246 246 246 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 221 221 221 86 86 86 156 107 11 +-216 158 10 236 178 12 242 186 14 246 186 14 +-242 186 14 239 182 13 239 182 13 242 186 14 +-242 186 14 246 186 14 246 190 14 246 190 14 +-246 190 14 246 190 14 246 190 14 246 190 14 +-242 186 14 225 175 15 142 122 72 66 66 66 +- 30 30 30 10 10 10 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 6 6 6 +- 26 26 26 70 70 70 163 133 67 210 150 10 +-236 178 12 246 190 14 246 190 14 246 190 14 +-246 190 14 246 190 14 246 190 14 246 190 14 +-246 190 14 246 190 14 246 190 14 246 190 14 +-246 190 14 246 190 14 246 190 14 246 190 14 +-232 195 16 121 92 8 34 34 34 106 106 106 +-221 221 221 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-242 242 242 82 82 82 18 14 6 163 110 8 +-216 158 10 236 178 12 242 186 14 246 190 14 +-246 190 14 246 190 14 246 190 14 246 190 14 +-246 190 14 246 190 14 246 190 14 246 190 14 +-246 190 14 246 190 14 246 190 14 246 190 14 +-246 190 14 246 190 14 242 186 14 163 133 67 +- 46 46 46 18 18 18 6 6 6 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 10 10 10 +- 30 30 30 78 78 78 163 133 67 210 150 10 +-236 178 12 246 186 14 246 190 14 246 190 14 +-246 190 14 246 190 14 246 190 14 246 190 14 +-246 190 14 246 190 14 246 190 14 246 190 14 +-246 190 14 246 190 14 246 190 14 246 190 14 +-241 196 14 215 174 15 190 178 144 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 218 218 218 +- 58 58 58 2 2 6 22 18 6 167 114 7 +-216 158 10 236 178 12 246 186 14 246 190 14 +-246 190 14 246 190 14 246 190 14 246 190 14 +-246 190 14 246 190 14 246 190 14 246 190 14 +-246 190 14 246 190 14 246 190 14 246 190 14 +-246 190 14 246 186 14 242 186 14 190 150 46 +- 54 54 54 22 22 22 6 6 6 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 14 14 14 +- 38 38 38 86 86 86 180 133 36 213 154 11 +-236 178 12 246 186 14 246 190 14 246 190 14 +-246 190 14 246 190 14 246 190 14 246 190 14 +-246 190 14 246 190 14 246 190 14 246 190 14 +-246 190 14 246 190 14 246 190 14 246 190 14 +-246 190 14 232 195 16 190 146 13 214 214 214 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 250 250 250 170 170 170 26 26 26 +- 2 2 6 2 2 6 37 26 9 163 110 8 +-219 162 10 239 182 13 246 186 14 246 190 14 +-246 190 14 246 190 14 246 190 14 246 190 14 +-246 190 14 246 190 14 246 190 14 246 190 14 +-246 190 14 246 190 14 246 190 14 246 190 14 +-246 186 14 236 178 12 224 166 10 142 122 72 +- 46 46 46 18 18 18 6 6 6 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 6 6 6 18 18 18 +- 50 50 50 109 106 95 192 133 9 224 166 10 +-242 186 14 246 190 14 246 190 14 246 190 14 +-246 190 14 246 190 14 246 190 14 246 190 14 +-246 190 14 246 190 14 246 190 14 246 190 14 +-246 190 14 246 190 14 246 190 14 246 190 14 +-242 186 14 226 184 13 210 162 10 142 110 46 +-226 226 226 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-198 198 198 66 66 66 2 2 6 2 2 6 +- 2 2 6 2 2 6 50 34 6 156 107 11 +-219 162 10 239 182 13 246 186 14 246 190 14 +-246 190 14 246 190 14 246 190 14 246 190 14 +-246 190 14 246 190 14 246 190 14 246 190 14 +-246 190 14 246 190 14 246 190 14 242 186 14 +-234 174 13 213 154 11 154 122 46 66 66 66 +- 30 30 30 10 10 10 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 6 6 6 22 22 22 +- 58 58 58 154 121 60 206 145 10 234 174 13 +-242 186 14 246 186 14 246 190 14 246 190 14 +-246 190 14 246 190 14 246 190 14 246 190 14 +-246 190 14 246 190 14 246 190 14 246 190 14 +-246 190 14 246 190 14 246 190 14 246 190 14 +-246 186 14 236 178 12 210 162 10 163 110 8 +- 61 42 6 138 138 138 218 218 218 250 250 250 +-253 253 253 253 253 253 253 253 253 250 250 250 +-242 242 242 210 210 210 144 144 144 66 66 66 +- 6 6 6 2 2 6 2 2 6 2 2 6 +- 2 2 6 2 2 6 61 42 6 163 110 8 +-216 158 10 236 178 12 246 190 14 246 190 14 +-246 190 14 246 190 14 246 190 14 246 190 14 +-246 190 14 246 190 14 246 190 14 246 190 14 +-246 190 14 239 182 13 230 174 11 216 158 10 +-190 142 34 124 112 88 70 70 70 38 38 38 +- 18 18 18 6 6 6 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 6 6 6 22 22 22 +- 62 62 62 168 124 44 206 145 10 224 166 10 +-236 178 12 239 182 13 242 186 14 242 186 14 +-246 186 14 246 190 14 246 190 14 246 190 14 +-246 190 14 246 190 14 246 190 14 246 190 14 +-246 190 14 246 190 14 246 190 14 246 190 14 +-246 190 14 236 178 12 216 158 10 175 118 6 +- 80 54 7 2 2 6 6 6 6 30 30 30 +- 54 54 54 62 62 62 50 50 50 38 38 38 +- 14 14 14 2 2 6 2 2 6 2 2 6 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 2 2 6 6 6 6 80 54 7 167 114 7 +-213 154 11 236 178 12 246 190 14 246 190 14 +-246 190 14 246 190 14 246 190 14 246 190 14 +-246 190 14 242 186 14 239 182 13 239 182 13 +-230 174 11 210 150 10 174 135 50 124 112 88 +- 82 82 82 54 54 54 34 34 34 18 18 18 +- 6 6 6 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 6 6 6 18 18 18 +- 50 50 50 158 118 36 192 133 9 200 144 11 +-216 158 10 219 162 10 224 166 10 226 170 11 +-230 174 11 236 178 12 239 182 13 239 182 13 +-242 186 14 246 186 14 246 190 14 246 190 14 +-246 190 14 246 190 14 246 190 14 246 190 14 +-246 186 14 230 174 11 210 150 10 163 110 8 +-104 69 6 10 10 10 2 2 6 2 2 6 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 2 2 6 6 6 6 91 60 6 167 114 7 +-206 145 10 230 174 11 242 186 14 246 190 14 +-246 190 14 246 190 14 246 186 14 242 186 14 +-239 182 13 230 174 11 224 166 10 213 154 11 +-180 133 36 124 112 88 86 86 86 58 58 58 +- 38 38 38 22 22 22 10 10 10 6 6 6 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 14 14 14 +- 34 34 34 70 70 70 138 110 50 158 118 36 +-167 114 7 180 123 7 192 133 9 197 138 11 +-200 144 11 206 145 10 213 154 11 219 162 10 +-224 166 10 230 174 11 239 182 13 242 186 14 +-246 186 14 246 186 14 246 186 14 246 186 14 +-239 182 13 216 158 10 185 133 11 152 99 6 +-104 69 6 18 14 6 2 2 6 2 2 6 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 2 2 6 6 6 6 80 54 7 152 99 6 +-192 133 9 219 162 10 236 178 12 239 182 13 +-246 186 14 242 186 14 239 182 13 236 178 12 +-224 166 10 206 145 10 192 133 9 154 121 60 +- 94 94 94 62 62 62 42 42 42 22 22 22 +- 14 14 14 6 6 6 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 6 6 6 +- 18 18 18 34 34 34 58 58 58 78 78 78 +-101 98 89 124 112 88 142 110 46 156 107 11 +-163 110 8 167 114 7 175 118 6 180 123 7 +-185 133 11 197 138 11 210 150 10 219 162 10 +-226 170 11 236 178 12 236 178 12 234 174 13 +-219 162 10 197 138 11 163 110 8 130 83 6 +- 91 60 6 10 10 10 2 2 6 2 2 6 +- 18 18 18 38 38 38 38 38 38 38 38 38 +- 38 38 38 38 38 38 38 38 38 38 38 38 +- 38 38 38 38 38 38 26 26 26 2 2 6 +- 2 2 6 6 6 6 70 47 6 137 92 6 +-175 118 6 200 144 11 219 162 10 230 174 11 +-234 174 13 230 174 11 219 162 10 210 150 10 +-192 133 9 163 110 8 124 112 88 82 82 82 +- 50 50 50 30 30 30 14 14 14 6 6 6 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 6 6 6 14 14 14 22 22 22 34 34 34 +- 42 42 42 58 58 58 74 74 74 86 86 86 +-101 98 89 122 102 70 130 98 46 121 87 25 +-137 92 6 152 99 6 163 110 8 180 123 7 +-185 133 11 197 138 11 206 145 10 200 144 11 +-180 123 7 156 107 11 130 83 6 104 69 6 +- 50 34 6 54 54 54 110 110 110 101 98 89 +- 86 86 86 82 82 82 78 78 78 78 78 78 +- 78 78 78 78 78 78 78 78 78 78 78 78 +- 78 78 78 82 82 82 86 86 86 94 94 94 +-106 106 106 101 101 101 86 66 34 124 80 6 +-156 107 11 180 123 7 192 133 9 200 144 11 +-206 145 10 200 144 11 192 133 9 175 118 6 +-139 102 15 109 106 95 70 70 70 42 42 42 +- 22 22 22 10 10 10 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 6 6 6 10 10 10 +- 14 14 14 22 22 22 30 30 30 38 38 38 +- 50 50 50 62 62 62 74 74 74 90 90 90 +-101 98 89 112 100 78 121 87 25 124 80 6 +-137 92 6 152 99 6 152 99 6 152 99 6 +-138 86 6 124 80 6 98 70 6 86 66 30 +-101 98 89 82 82 82 58 58 58 46 46 46 +- 38 38 38 34 34 34 34 34 34 34 34 34 +- 34 34 34 34 34 34 34 34 34 34 34 34 +- 34 34 34 34 34 34 38 38 38 42 42 42 +- 54 54 54 82 82 82 94 86 76 91 60 6 +-134 86 6 156 107 11 167 114 7 175 118 6 +-175 118 6 167 114 7 152 99 6 121 87 25 +-101 98 89 62 62 62 34 34 34 18 18 18 +- 6 6 6 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 6 6 6 6 6 6 10 10 10 +- 18 18 18 22 22 22 30 30 30 42 42 42 +- 50 50 50 66 66 66 86 86 86 101 98 89 +-106 86 58 98 70 6 104 69 6 104 69 6 +-104 69 6 91 60 6 82 62 34 90 90 90 +- 62 62 62 38 38 38 22 22 22 14 14 14 +- 10 10 10 10 10 10 10 10 10 10 10 10 +- 10 10 10 10 10 10 6 6 6 10 10 10 +- 10 10 10 10 10 10 10 10 10 14 14 14 +- 22 22 22 42 42 42 70 70 70 89 81 66 +- 80 54 7 104 69 6 124 80 6 137 92 6 +-134 86 6 116 81 8 100 82 52 86 86 86 +- 58 58 58 30 30 30 14 14 14 6 6 6 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 6 6 6 10 10 10 14 14 14 +- 18 18 18 26 26 26 38 38 38 54 54 54 +- 70 70 70 86 86 86 94 86 76 89 81 66 +- 89 81 66 86 86 86 74 74 74 50 50 50 +- 30 30 30 14 14 14 6 6 6 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 6 6 6 18 18 18 34 34 34 58 58 58 +- 82 82 82 89 81 66 89 81 66 89 81 66 +- 94 86 66 94 86 76 74 74 74 50 50 50 +- 26 26 26 14 14 14 6 6 6 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 6 6 6 6 6 6 14 14 14 18 18 18 +- 30 30 30 38 38 38 46 46 46 54 54 54 +- 50 50 50 42 42 42 30 30 30 18 18 18 +- 10 10 10 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 6 6 6 14 14 14 26 26 26 +- 38 38 38 50 50 50 58 58 58 58 58 58 +- 54 54 54 42 42 42 30 30 30 18 18 18 +- 10 10 10 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 6 6 6 +- 6 6 6 10 10 10 14 14 14 18 18 18 +- 18 18 18 14 14 14 10 10 10 6 6 6 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 6 6 6 +- 14 14 14 18 18 18 22 22 22 22 22 22 +- 18 18 18 14 14 14 10 10 10 6 6 6 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 1 0 ++0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 ++0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 ++10 15 3 2 3 1 12 18 4 42 61 14 19 27 6 11 16 4 ++38 55 13 10 15 3 3 4 1 10 15 3 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 3 1 ++12 18 4 1 1 0 23 34 8 31 45 11 10 15 3 32 47 11 ++34 49 12 3 4 1 3 4 1 3 4 1 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 10 15 3 29 42 10 26 37 9 12 18 4 ++55 80 19 81 118 28 55 80 19 92 132 31 106 153 36 69 100 23 ++100 144 34 80 116 27 42 61 14 81 118 28 23 34 8 27 40 9 ++15 21 5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 1 1 0 29 42 10 15 21 5 50 72 17 ++74 107 25 45 64 15 102 148 35 80 116 27 84 121 28 111 160 38 ++69 100 23 65 94 22 81 118 28 29 42 10 17 25 6 29 42 10 ++23 34 8 2 3 1 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 4 1 ++15 21 5 15 21 5 34 49 12 101 146 34 111 161 38 97 141 33 ++97 141 33 119 172 41 117 170 40 116 167 40 118 170 40 118 171 40 ++117 169 40 118 170 40 111 160 38 118 170 40 96 138 32 89 128 30 ++81 118 28 11 16 4 10 15 3 1 1 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++3 4 1 3 4 1 34 49 12 101 146 34 79 115 27 111 160 38 ++114 165 39 113 163 39 118 170 40 117 169 40 118 171 40 117 169 40 ++116 167 40 119 172 41 113 163 39 92 132 31 105 151 36 113 163 39 ++75 109 26 19 27 6 16 23 5 11 16 4 0 1 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 10 15 3 ++80 116 27 106 153 36 105 151 36 114 165 39 118 170 40 118 171 40 ++118 171 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 ++117 169 40 117 169 40 117 170 40 117 169 40 118 170 40 118 170 40 ++117 170 40 75 109 26 75 109 26 34 49 12 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 4 1 ++64 92 22 65 94 22 100 144 34 118 171 40 118 170 40 117 169 40 ++117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 ++117 169 40 117 169 40 117 169 40 118 171 41 118 170 40 117 169 40 ++109 158 37 105 151 36 104 150 35 47 69 16 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++42 61 14 115 167 39 118 170 40 117 169 40 117 169 40 117 169 40 ++117 170 40 117 170 40 117 169 40 117 169 40 117 169 40 117 169 40 ++117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 ++117 169 40 117 169 40 118 170 40 96 138 32 17 25 6 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 47 69 16 ++114 165 39 117 168 40 117 170 40 117 169 40 117 169 40 117 169 40 ++117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 ++117 169 40 117 169 40 118 170 40 117 169 40 117 169 40 117 169 40 ++117 170 40 119 172 41 96 138 32 12 18 4 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 10 15 3 ++32 47 11 105 151 36 118 170 40 117 169 40 117 169 40 116 168 40 ++109 157 37 111 160 38 117 169 40 118 171 40 117 169 40 117 169 40 ++117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 ++117 169 40 117 169 40 117 169 40 118 171 40 69 100 23 2 3 1 ++0 0 0 0 0 0 0 0 0 0 0 0 19 27 6 101 146 34 ++118 171 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 ++117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 170 40 ++118 171 40 115 166 39 107 154 36 111 161 38 117 169 40 117 169 40 ++117 169 40 118 171 40 75 109 26 19 27 6 2 3 1 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 16 23 5 ++89 128 30 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 ++111 160 38 92 132 31 79 115 27 96 138 32 115 166 39 119 171 41 ++117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 ++117 169 40 117 169 40 117 169 40 118 170 40 109 157 37 26 37 9 ++0 0 0 0 0 0 0 0 0 0 0 0 64 92 22 118 171 40 ++117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 ++117 169 40 117 169 40 117 169 40 118 170 40 118 171 40 109 157 37 ++89 128 30 81 118 28 100 144 34 115 166 39 117 169 40 117 169 40 ++117 169 40 117 170 40 113 163 39 60 86 20 1 1 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++27 40 9 96 138 32 118 170 40 117 169 40 117 169 40 117 169 40 ++117 170 40 117 169 40 101 146 34 67 96 23 55 80 19 84 121 28 ++113 163 39 119 171 41 117 169 40 117 169 40 117 169 40 117 169 40 ++117 169 40 117 169 40 117 169 40 117 169 40 119 171 41 65 94 22 ++0 0 0 0 0 0 0 0 0 15 21 5 101 146 34 118 171 40 ++117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 ++117 169 40 118 170 40 118 171 40 104 150 35 69 100 23 53 76 18 ++81 118 28 111 160 38 118 170 40 117 169 40 117 169 40 117 169 40 ++117 169 40 114 165 39 69 100 23 10 15 3 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 ++31 45 11 77 111 26 117 169 40 117 169 40 117 169 40 117 169 40 ++117 169 40 117 169 40 118 170 40 116 168 40 92 132 31 47 69 16 ++38 55 13 81 118 28 113 163 39 119 171 41 117 169 40 117 169 40 ++117 169 40 117 169 40 117 169 40 117 169 40 118 171 41 92 132 31 ++10 15 3 0 0 0 0 0 0 36 52 12 115 166 39 117 169 40 ++117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 118 170 40 ++118 171 40 102 148 35 64 92 22 34 49 12 65 94 22 106 153 36 ++118 171 40 117 170 40 117 169 40 117 169 40 117 169 40 117 169 40 ++118 170 40 107 154 36 55 80 19 15 21 5 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++29 42 10 101 146 34 118 171 40 117 169 40 117 169 40 117 169 40 ++117 169 40 117 169 40 117 169 40 117 169 40 118 171 40 113 163 39 ++75 109 26 27 40 9 36 52 12 89 128 30 116 167 40 118 171 40 ++117 169 40 117 169 40 117 169 40 117 169 40 118 170 40 104 150 35 ++16 23 5 0 0 0 0 0 0 53 76 18 118 171 40 117 169 40 ++117 169 40 117 169 40 117 169 40 117 169 40 119 171 41 109 157 37 ++67 96 23 23 34 8 42 61 14 96 138 32 118 170 40 118 170 40 ++117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 ++117 169 40 117 169 40 74 107 25 10 15 3 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 31 45 11 101 146 34 118 170 40 117 169 40 117 169 40 ++117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 ++119 171 41 102 148 35 47 69 16 14 20 5 50 72 17 102 148 35 ++118 171 40 117 169 40 117 169 40 117 169 40 118 170 40 102 148 35 ++15 21 5 0 0 0 0 0 0 50 72 17 118 170 40 117 169 40 ++117 169 40 117 169 40 118 170 40 116 167 40 84 121 28 27 40 9 ++19 27 6 74 107 25 114 165 39 118 171 40 117 169 40 117 169 40 ++117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 ++117 169 40 75 109 26 10 15 4 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 38 55 13 102 148 35 118 171 40 117 169 40 117 169 40 ++117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 ++117 169 40 118 170 40 115 167 39 77 111 26 17 25 6 19 27 6 ++77 111 26 115 166 39 118 170 40 117 169 40 119 172 41 81 118 28 ++3 4 1 0 0 0 0 0 0 27 40 9 111 160 38 118 170 40 ++117 169 40 118 171 40 105 151 36 50 72 17 10 15 3 38 55 13 ++100 144 34 118 171 40 117 169 40 117 169 40 117 169 40 117 169 40 ++117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 ++117 169 40 79 115 27 15 21 5 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 10 15 3 64 92 22 111 160 38 117 169 40 117 169 40 ++117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 ++117 169 40 117 169 40 117 169 40 118 171 40 96 138 32 32 47 11 ++3 4 1 50 72 17 107 154 36 120 173 41 105 151 36 31 45 11 ++0 0 0 0 0 0 0 0 0 3 4 1 65 94 22 117 169 40 ++118 170 40 89 128 30 26 37 9 3 4 1 60 86 20 111 161 38 ++118 171 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 ++117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 ++97 141 33 36 52 12 1 1 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 14 20 5 75 109 26 117 168 40 117 169 40 ++117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 ++117 169 40 117 169 40 117 169 40 117 169 40 118 171 40 107 154 36 ++45 64 15 2 3 1 31 45 11 75 109 26 32 47 11 0 1 0 ++0 0 0 0 0 0 0 0 0 0 0 0 10 15 3 55 80 19 ++65 94 22 11 16 4 11 16 4 75 109 26 116 168 40 118 170 40 ++117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 ++117 169 40 117 169 40 117 169 40 117 169 40 118 170 40 107 154 36 ++47 69 16 3 4 1 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 12 18 4 69 100 23 111 161 38 118 171 40 ++117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 ++117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 118 170 40 ++111 160 38 50 72 17 2 3 1 2 3 1 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 ++1 1 0 12 18 4 81 118 28 118 170 40 117 169 40 117 169 40 ++117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 ++117 169 40 117 169 40 117 169 40 117 170 40 118 171 40 101 146 34 ++42 61 14 2 3 1 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 3 4 1 36 52 12 89 128 30 ++117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 ++117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 ++118 171 41 101 146 34 14 20 5 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 47 69 16 118 170 40 117 169 40 117 169 40 117 169 40 ++117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 ++117 169 40 117 169 40 117 170 40 111 160 38 69 100 23 19 27 6 ++0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 11 16 4 69 100 23 ++115 167 39 119 172 41 117 169 40 117 169 40 117 169 40 117 169 40 ++117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 ++119 172 41 75 109 26 3 4 1 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 23 34 8 106 153 36 118 170 40 117 169 40 117 169 40 ++117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 ++117 169 40 118 170 40 119 172 41 105 151 36 42 61 14 2 3 1 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 15 21 5 ++45 64 15 80 116 27 114 165 39 118 170 40 117 169 40 117 169 40 ++117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 119 172 41 ++97 141 33 20 30 7 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 1 1 0 53 76 18 114 165 39 118 171 40 117 169 40 ++117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 ++118 171 40 104 150 35 64 92 22 31 45 11 10 15 3 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 36 52 12 97 141 33 109 158 37 113 163 39 116 168 40 ++117 169 40 117 170 40 118 170 40 119 172 41 115 167 39 84 121 28 ++23 34 8 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 3 4 1 50 72 17 102 148 35 118 171 40 ++119 171 41 118 170 40 117 169 40 117 169 40 115 166 39 111 161 38 ++109 157 37 79 115 27 12 18 4 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 3 4 1 15 21 5 23 34 8 45 64 15 106 153 36 ++116 167 40 111 160 38 101 146 34 79 115 27 42 61 14 10 15 3 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 1 1 0 20 30 7 60 86 20 ++89 128 30 106 153 36 113 163 39 117 169 40 84 121 28 29 42 10 ++19 27 6 10 15 3 2 3 1 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 16 23 5 38 55 13 ++36 52 12 26 37 9 12 18 4 2 3 1 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 1 0 0 19 2 7 52 5 18 ++78 7 27 88 8 31 81 7 29 56 5 19 25 2 9 3 0 1 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++3 4 1 19 27 6 31 45 11 38 55 13 32 47 11 3 4 1 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 0 1 ++9 0 3 12 1 4 9 0 3 4 0 1 0 0 0 0 0 0 ++0 0 0 0 0 0 28 3 10 99 9 35 156 14 55 182 16 64 ++189 17 66 190 17 67 189 17 66 184 17 65 166 15 58 118 13 41 ++45 4 16 3 0 1 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 11 1 4 52 5 18 101 9 35 134 12 47 ++151 14 53 154 14 54 151 14 53 113 10 40 11 1 4 0 0 0 ++3 0 1 67 6 24 159 14 56 190 17 67 190 17 67 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 190 17 67 191 17 67 ++174 16 61 101 9 35 14 1 5 0 0 0 35 3 12 108 10 38 ++122 11 43 122 11 43 112 10 39 87 8 30 50 5 17 13 1 5 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++3 0 1 56 5 19 141 13 49 182 16 64 191 17 67 191 17 67 ++190 17 67 190 17 67 191 17 67 113 10 40 3 0 1 1 0 0 ++79 7 28 180 16 63 190 17 67 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++189 17 66 188 17 66 122 11 43 11 1 4 41 4 14 176 16 62 ++191 17 67 191 17 67 191 17 67 190 17 67 181 16 63 146 13 51 ++75 7 26 10 1 4 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 1 2 ++90 8 32 178 16 62 191 17 67 188 17 66 188 17 66 188 17 66 ++188 17 66 190 17 67 141 13 49 22 2 8 0 0 0 41 4 14 ++173 16 61 190 17 67 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 88 8 31 1 0 0 89 8 31 ++185 17 65 189 17 66 188 17 66 188 17 66 189 17 66 191 17 67 ++186 17 65 124 11 43 25 2 9 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 2 0 1 89 8 31 ++184 17 65 189 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++190 17 67 151 14 53 34 3 12 0 0 0 0 0 0 79 7 28 ++190 17 67 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 191 17 67 146 13 51 9 1 3 7 1 2 ++108 10 38 187 17 66 189 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 190 17 67 141 13 49 22 2 8 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 52 5 18 176 16 62 ++189 17 66 188 17 66 188 17 66 188 17 66 188 17 66 190 17 67 ++151 14 53 38 3 13 0 0 0 0 0 0 0 0 0 50 5 17 ++180 16 63 189 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 191 17 67 141 13 49 7 1 3 0 0 0 ++11 1 4 112 10 39 187 17 66 189 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 190 17 67 113 10 40 5 0 2 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 7 1 3 132 12 46 191 17 67 ++188 17 66 188 17 66 188 17 66 188 17 66 190 17 67 146 13 51 ++35 3 12 0 0 0 0 0 0 0 0 0 0 0 0 5 0 2 ++101 9 35 185 17 65 190 17 67 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 190 17 67 180 16 63 67 6 24 0 0 0 0 0 0 ++0 0 0 11 1 4 108 10 38 186 17 65 189 17 66 188 17 66 ++188 17 66 188 17 66 189 17 66 180 16 63 56 5 19 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 44 4 15 177 16 62 189 17 66 ++188 17 66 188 17 66 189 17 66 189 17 66 134 12 47 28 3 10 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++8 1 3 79 7 28 159 14 56 188 17 66 191 17 67 190 17 67 ++189 17 66 189 17 66 189 17 66 189 17 66 190 17 67 191 17 67 ++188 17 66 158 14 55 72 7 25 4 0 1 0 0 0 0 0 0 ++0 0 0 0 0 0 8 1 3 95 9 33 182 16 64 189 17 67 ++188 17 66 188 17 66 188 17 66 191 17 67 122 11 43 3 0 1 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 88 8 31 190 17 67 188 17 66 ++188 17 66 189 17 66 185 17 65 113 10 40 18 2 6 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 1 0 0 24 2 8 77 7 27 124 11 43 154 14 54 ++168 15 59 173 16 61 173 16 61 168 15 59 154 14 54 124 11 43 ++77 7 27 22 2 8 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 5 0 2 77 7 27 173 16 61 ++190 17 67 188 17 66 188 17 66 190 17 67 164 15 57 23 2 8 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 1 0 0 118 13 41 191 17 67 188 17 66 ++190 17 67 174 16 61 87 8 30 8 1 3 0 0 0 0 0 0 ++0 0 0 0 0 0 10 1 4 29 3 10 40 4 14 36 3 13 ++18 2 6 2 0 1 0 0 0 0 0 0 3 0 1 14 1 5 ++26 2 9 33 3 11 32 3 11 25 2 9 13 1 5 3 0 1 ++0 0 0 14 1 5 56 5 19 95 9 33 109 10 38 101 9 35 ++77 7 27 35 3 12 5 0 2 0 0 0 1 0 0 56 5 19 ++156 14 55 190 17 67 188 17 66 188 17 66 182 16 64 50 5 17 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 5 0 2 134 12 47 191 17 67 189 17 66 ++151 14 53 52 5 18 2 0 1 0 0 0 0 0 0 1 0 0 ++28 3 10 90 8 32 146 13 51 170 15 60 178 16 62 174 16 61 ++158 14 55 112 10 39 40 4 14 1 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 0 1 ++56 5 19 146 13 51 183 17 64 191 17 67 191 17 67 191 17 67 ++188 17 66 173 16 61 122 11 43 41 4 14 1 0 0 0 0 0 ++30 3 10 124 11 43 185 17 65 190 17 67 187 17 66 67 6 24 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 6 1 2 134 12 47 168 15 59 99 9 35 ++21 2 7 0 0 0 0 0 0 0 0 0 6 1 2 77 7 27 ++162 15 57 190 17 67 191 17 67 189 17 66 189 17 66 189 17 66 ++190 17 67 191 17 67 169 15 59 75 7 26 3 0 1 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 2 0 1 79 7 28 ++178 16 62 191 17 67 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 189 17 66 191 17 67 170 15 60 79 7 28 5 0 2 ++0 0 0 10 1 3 78 7 27 159 14 56 188 17 66 75 7 26 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 1 0 0 35 3 12 29 3 10 2 0 1 ++0 0 0 0 0 0 0 0 0 9 1 3 101 9 35 183 17 64 ++190 17 67 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 190 17 67 178 16 63 67 6 23 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 52 5 18 174 16 61 ++190 17 67 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 190 17 67 182 16 64 89 8 31 ++4 0 1 0 0 0 0 0 0 25 2 9 73 7 26 31 3 11 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 4 0 1 98 9 34 187 17 66 189 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 190 17 67 158 14 55 25 2 9 ++0 0 0 0 0 0 0 0 0 8 1 3 134 12 47 191 17 67 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 189 17 66 180 16 63 ++68 6 24 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 6 1 2 19 2 7 3 0 1 0 0 0 0 0 0 ++0 0 0 0 0 0 65 6 23 180 16 63 189 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 189 17 66 83 8 29 ++0 0 0 0 0 0 0 0 0 41 4 14 177 16 62 189 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 190 17 67 ++159 14 56 28 3 10 0 0 0 0 0 0 0 0 0 23 2 8 ++41 4 14 5 0 2 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++23 2 8 113 10 40 159 14 56 65 6 23 0 0 0 0 0 0 ++0 0 0 16 1 6 146 13 51 191 17 67 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 191 17 67 132 12 46 ++5 0 2 0 0 0 0 0 0 77 7 27 189 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++190 17 67 98 9 34 0 0 0 0 0 0 12 1 4 134 12 47 ++178 16 63 108 10 38 16 1 6 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 30 3 10 ++141 13 49 190 17 67 191 17 67 134 12 47 6 1 2 0 0 0 ++0 0 0 68 6 24 186 17 65 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 190 17 67 156 14 55 ++14 1 5 0 0 0 0 0 0 98 9 34 191 17 67 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++190 17 67 156 14 55 19 2 7 0 0 0 47 4 16 181 16 63 ++190 17 67 189 17 66 126 14 44 17 2 6 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 16 1 6 134 12 47 ++191 17 67 188 17 66 190 17 67 162 15 57 19 2 7 0 0 0 ++3 0 1 123 11 43 191 17 67 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 190 17 67 163 15 57 ++20 2 7 0 0 0 0 0 0 101 9 35 191 17 67 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 182 16 64 52 5 18 0 0 0 73 7 26 188 17 66 ++188 17 66 188 17 66 189 17 66 109 10 38 5 0 2 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 95 9 33 189 17 66 ++188 17 66 188 17 66 189 17 66 171 15 60 29 3 10 0 0 0 ++16 1 6 156 14 55 190 17 67 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 190 17 67 158 14 55 ++17 2 6 0 0 0 0 0 0 85 8 30 190 17 67 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 189 17 66 81 7 29 0 0 0 85 8 30 190 17 67 ++188 17 66 188 17 66 189 17 66 180 16 63 56 5 19 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 25 2 9 162 15 57 190 17 67 ++188 17 66 188 17 66 189 17 66 173 16 61 31 3 11 0 0 0 ++30 3 10 171 15 60 189 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 191 17 67 141 13 49 ++7 1 2 0 0 0 0 0 0 56 5 19 183 17 64 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 191 17 67 98 9 34 0 0 0 88 8 31 190 17 67 ++188 17 66 188 17 66 188 17 66 191 17 67 124 11 43 5 0 2 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 68 6 24 187 17 66 188 17 66 ++188 17 66 188 17 66 189 17 66 170 15 60 28 3 10 0 0 0 ++34 3 12 174 16 61 189 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 191 17 67 101 9 35 ++0 0 0 0 0 0 0 0 0 21 2 7 159 14 56 190 17 67 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 191 17 67 98 9 34 0 0 0 81 7 29 189 17 66 ++188 17 66 188 17 66 188 17 66 189 17 66 168 15 59 28 3 10 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 109 10 38 191 17 67 188 17 66 ++188 17 66 188 17 66 190 17 67 163 15 57 21 2 7 0 0 0 ++26 2 9 168 15 59 189 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 189 17 66 180 16 63 47 4 16 ++0 0 0 0 0 0 0 0 0 0 0 0 108 10 38 190 17 67 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 189 17 66 78 7 27 0 0 0 68 6 24 187 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 183 17 64 56 5 19 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 3 0 1 131 12 46 191 17 67 188 17 66 ++188 17 66 188 17 66 190 17 67 151 14 53 12 1 4 0 0 0 ++11 1 4 146 13 51 190 17 67 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 191 17 67 126 14 44 7 1 2 ++0 0 0 0 0 0 0 0 0 0 0 0 32 3 11 164 15 58 ++190 17 67 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++189 17 66 178 16 62 44 4 15 0 0 0 50 5 17 182 16 64 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 72 7 25 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 5 0 2 134 12 47 191 17 67 188 17 66 ++188 17 66 188 17 66 191 17 67 131 12 46 3 0 1 0 0 0 ++0 0 0 101 9 35 190 17 67 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 190 17 67 170 15 60 44 4 15 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 77 7 27 ++183 17 64 189 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++191 17 67 134 12 47 9 1 3 0 0 0 31 3 11 171 15 60 ++189 17 66 188 17 66 188 17 66 188 17 66 188 17 66 72 7 25 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 2 0 1 124 11 43 191 17 67 188 17 66 ++188 17 66 188 17 66 191 17 67 101 9 35 0 0 0 0 0 0 ++0 0 0 35 3 12 168 15 59 190 17 67 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 189 17 66 182 16 64 77 7 27 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 6 1 2 ++99 9 35 185 17 65 189 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 189 17 66 ++177 16 62 56 5 19 0 0 0 0 0 0 13 1 5 151 14 53 ++190 17 67 188 17 66 188 17 66 188 17 66 185 17 65 56 5 19 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 99 9 35 191 17 67 188 17 66 ++188 17 66 188 17 66 186 17 65 65 6 23 0 0 0 0 0 0 ++0 0 0 0 0 0 79 7 28 182 16 64 190 17 67 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++191 17 67 177 16 62 83 8 29 4 0 1 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++8 1 3 89 8 31 175 16 62 191 17 67 189 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 190 17 67 181 16 63 ++85 8 30 3 0 1 0 0 0 0 0 0 1 0 0 118 13 41 ++191 17 67 188 17 66 188 17 66 189 17 66 173 16 61 34 3 12 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 56 5 19 183 17 64 188 17 66 ++188 17 66 189 17 66 169 15 59 30 3 10 0 0 0 0 0 0 ++0 0 0 0 0 0 5 0 2 83 8 29 173 16 61 191 17 67 ++190 17 67 189 17 66 189 17 66 190 17 67 191 17 67 187 17 66 ++151 14 53 56 5 19 3 0 1 0 0 0 16 1 6 50 5 17 ++79 7 28 95 9 33 95 9 33 75 7 26 41 4 14 10 1 4 ++0 0 0 2 0 1 50 5 17 132 12 46 178 16 62 190 17 67 ++191 17 67 191 17 67 191 17 67 186 17 65 154 14 54 68 6 24 ++4 0 1 0 0 0 0 0 0 0 0 0 0 0 0 72 7 25 ++187 17 66 188 17 66 188 17 66 191 17 67 141 13 49 9 1 3 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 14 1 5 151 14 53 190 17 67 ++188 17 66 191 17 67 131 12 46 5 0 2 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 2 0 1 44 4 15 113 10 40 ++156 14 55 173 16 61 174 16 61 164 15 58 134 12 47 77 7 27 ++18 2 6 0 0 0 16 1 6 85 8 30 151 14 53 182 16 64 ++189 17 66 191 17 67 190 17 67 188 17 66 177 16 62 141 13 49 ++68 6 24 8 1 3 0 0 0 8 1 3 44 4 15 88 8 31 ++113 10 40 122 11 43 108 10 38 67 6 24 20 2 7 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 28 3 10 ++166 15 58 190 17 67 188 17 66 187 17 66 79 7 28 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 73 7 26 185 17 65 ++189 17 66 184 17 65 65 6 23 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 1 ++17 2 6 32 3 11 34 3 12 22 2 8 6 1 2 0 0 0 ++0 0 0 38 3 13 141 13 49 188 17 66 190 17 67 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 189 17 66 191 17 67 ++184 17 65 122 11 43 21 2 7 0 0 0 0 0 0 0 0 0 ++0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 ++108 10 38 191 17 67 191 17 67 141 13 49 16 1 6 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 8 1 3 112 10 39 ++186 17 65 124 11 43 10 1 4 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++36 3 13 156 14 55 191 17 67 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++189 17 66 190 17 67 134 12 47 18 2 6 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 7 1 2 41 4 14 75 7 26 66 5 23 19 2 7 ++26 2 9 144 13 50 154 14 54 40 4 14 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 13 1 5 ++56 5 19 19 2 7 0 0 0 7 1 2 29 3 10 35 3 12 ++19 2 7 2 0 1 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 13 1 5 ++134 12 47 191 17 67 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 189 17 67 108 10 38 3 0 1 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 ++40 4 14 124 11 43 177 16 62 188 17 66 187 17 66 144 13 50 ++24 2 8 17 2 6 22 2 8 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 19 2 7 122 11 43 171 15 60 175 16 62 ++159 14 56 112 10 39 40 4 14 2 0 1 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 72 7 25 ++186 17 65 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 189 17 66 174 16 61 41 4 14 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 3 0 1 72 7 25 ++168 15 59 191 17 67 189 17 66 188 17 66 188 17 66 190 17 67 ++95 9 33 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 95 9 33 191 17 67 189 17 66 189 17 66 ++190 17 67 191 17 67 171 15 60 90 8 32 12 1 4 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 5 0 2 132 12 46 ++191 17 67 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 190 17 67 98 9 34 0 0 0 ++0 0 0 0 0 0 0 0 0 5 0 2 88 8 31 180 16 63 ++190 17 67 188 17 66 188 17 66 188 17 66 188 17 66 191 17 67 ++146 13 51 11 1 4 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 9 1 3 144 13 50 191 17 67 188 17 66 188 17 66 ++188 17 66 188 17 66 189 17 66 187 17 66 123 11 43 20 2 7 ++0 0 0 0 0 0 0 0 0 0 0 0 21 2 7 163 15 57 ++190 17 67 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 191 17 67 134 12 47 5 0 2 ++0 0 0 0 0 0 3 0 1 88 8 31 182 16 64 189 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 189 17 66 ++171 15 60 31 3 11 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 20 2 7 162 15 57 190 17 67 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 190 17 67 132 12 46 ++20 2 7 0 0 0 0 0 0 0 0 0 32 3 11 173 16 61 ++189 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 190 17 67 151 14 53 12 1 4 ++0 0 0 0 0 0 72 7 25 180 16 63 189 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++181 16 63 47 4 16 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 21 2 7 163 15 57 190 17 67 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 190 17 67 ++122 11 43 9 1 3 0 0 0 0 0 0 30 3 10 171 15 60 ++189 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 190 17 67 146 13 51 10 1 4 ++0 0 0 38 3 13 166 15 58 190 17 67 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++183 17 64 52 5 18 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 13 1 5 154 14 54 190 17 67 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++186 17 65 79 7 28 0 0 0 0 0 0 14 1 5 156 14 54 ++190 17 67 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 191 17 67 124 11 43 2 0 1 ++5 0 2 122 11 43 191 17 67 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++182 16 64 47 4 16 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 3 0 1 126 14 44 191 17 67 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++190 17 67 158 14 55 23 2 8 0 0 0 1 0 0 113 10 40 ++191 17 67 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 78 7 27 0 0 0 ++47 4 16 177 16 62 189 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 189 17 66 ++173 16 61 34 3 12 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 85 8 30 189 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 79 7 28 0 0 0 0 0 0 47 4 16 ++175 16 62 189 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 190 17 67 156 14 55 22 2 8 0 0 0 ++109 10 38 191 17 67 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 190 17 67 ++151 14 53 13 1 5 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 35 3 12 173 16 61 189 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 191 17 67 134 12 47 7 1 2 0 0 0 3 0 1 ++99 9 35 188 17 66 189 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 189 17 66 181 16 63 68 6 24 0 0 0 18 2 6 ++156 14 55 190 17 67 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 190 17 67 ++101 9 35 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 3 0 1 118 13 41 191 17 67 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 189 17 66 168 15 59 28 3 10 0 0 0 0 0 0 ++12 1 4 113 10 40 187 17 66 189 17 67 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++190 17 67 180 16 63 88 8 31 4 0 1 0 0 0 47 4 16 ++180 16 63 189 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 190 17 67 168 15 59 ++36 3 13 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 38 3 13 164 15 58 190 17 67 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 182 16 64 50 5 17 0 0 0 0 0 0 ++0 0 0 11 1 4 90 8 32 169 15 59 190 17 67 190 17 67 ++189 17 66 189 17 66 189 17 66 189 17 66 191 17 67 189 17 66 ++158 14 55 68 6 24 4 0 1 0 0 0 0 0 0 73 7 26 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 189 17 66 185 17 65 83 8 29 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 65 6 23 174 16 61 ++190 17 67 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 185 17 65 56 5 19 0 0 0 0 0 0 ++0 0 0 0 0 0 2 0 1 35 3 12 99 9 35 146 13 51 ++170 15 60 177 16 62 177 16 62 166 15 58 141 13 49 85 8 30 ++24 2 8 0 0 0 0 0 0 0 0 0 0 0 0 85 8 30 ++190 17 67 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 189 17 66 112 10 39 8 1 3 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 68 6 24 ++170 15 60 191 17 67 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 182 16 64 50 5 17 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 11 1 4 ++28 3 10 40 4 14 38 3 13 25 2 9 8 1 3 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 78 7 27 ++189 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 189 17 66 187 17 66 113 10 40 14 1 5 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 ++47 4 16 141 13 49 186 17 65 191 17 67 190 17 67 189 17 66 ++189 17 66 191 17 67 156 14 55 20 2 7 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 44 4 15 ++178 16 62 190 17 67 188 17 66 188 17 66 188 17 66 190 17 67 ++191 17 67 173 16 61 90 8 32 10 1 4 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 14 1 5 68 6 24 131 12 46 162 15 57 174 16 61 ++171 15 60 146 13 51 56 5 19 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 3 0 1 14 1 5 29 3 10 ++41 4 14 47 4 16 50 5 17 45 4 16 34 3 12 18 2 6 ++5 0 2 0 0 0 0 0 0 0 0 0 0 0 0 5 0 2 ++90 8 32 169 15 59 185 17 65 187 17 66 182 16 64 163 15 57 ++113 10 40 41 4 14 2 0 1 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 5 0 2 21 2 7 34 3 12 ++29 3 10 11 1 4 0 0 0 0 0 0 0 0 0 0 0 0 ++3 0 1 32 3 11 79 7 28 124 11 43 154 14 54 171 15 60 ++180 16 63 182 16 64 182 16 64 180 16 63 174 16 61 159 14 56 ++132 12 46 88 8 31 34 3 12 3 0 1 0 0 0 0 0 0 ++3 0 1 29 3 10 56 5 19 65 6 23 50 5 17 23 2 8 ++3 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 25 2 9 ++109 10 38 169 15 59 189 17 66 191 17 67 190 17 67 189 17 66 ++189 17 66 188 17 66 188 17 66 188 17 66 189 17 66 190 17 67 ++191 17 67 190 17 67 171 15 60 98 9 34 10 1 3 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 14 1 5 141 13 49 ++191 17 67 189 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 189 17 67 186 17 65 65 6 23 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 23 2 8 166 15 58 ++190 17 67 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 189 17 66 176 16 62 45 4 16 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 83 8 29 ++183 17 64 189 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 189 17 66 185 17 65 95 9 33 3 0 1 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5 0 2 ++85 8 30 176 16 62 191 17 67 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++191 17 67 180 16 63 95 9 33 7 1 3 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++2 0 1 52 5 18 141 13 49 185 17 65 191 17 67 189 17 67 ++189 17 66 188 17 66 188 17 66 189 17 66 191 17 67 187 17 66 ++146 13 51 56 5 19 4 0 1 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 14 1 5 68 6 24 131 12 46 166 15 58 ++180 16 63 183 17 64 180 16 63 168 15 59 134 12 47 75 7 26 ++17 2 6 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 5 0 2 24 2 8 ++44 4 15 52 5 18 45 4 16 26 2 9 6 1 2 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 + +From e25ec90f213f3d1c6437f42059f442c84a997114 Mon Sep 17 00:00:00 2001 +From: Florian Meier <florian.meier@koalo.de> +Date: Fri, 22 Nov 2013 14:22:53 +0100 +Subject: [PATCH 035/112] dmaengine: Add support for BCM2708 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Add support for DMA controller of BCM2708 as used in the Raspberry Pi. +Currently it only supports cyclic DMA. + +Signed-off-by: Florian Meier <florian.meier@koalo.de> + +dmaengine: expand functionality by supporting scatter/gather transfers sdhci-bcm2708 and dma.c: fix for LITE channels + +DMA: fix cyclic LITE length overflow bug + +dmaengine: bcm2708: Remove chancnt affectations + +Mirror bcm2835-dma.c commit 9eba5536a7434c69d8c185d4bd1c70734d92287d: +chancnt is already filled by dma_async_device_register, which uses the channel +list to know how much channels there is. + +Since it's already filled, we can safely remove it from the drivers' probe +function. + +Signed-off-by: Noralf Trønnes <noralf@tronnes.org> + +dmaengine: bcm2708: overwrite dreq only if it is not set + +dreq is set when the DMA channel is fetched from Device Tree. +slave_id is set using dmaengine_slave_config(). +Only overwrite dreq with slave_id if it is not set. + +dreq/slave_id in the cyclic DMA case is not touched, because I don't +have hardware to test with. + +Signed-off-by: Noralf Trønnes <noralf@tronnes.org> + +dmaengine: bcm2708: do device registration in the board file + +Don't register the device in the driver. Do it in the board file. + +Signed-off-by: Noralf Trønnes <noralf@tronnes.org> + +dmaengine: bcm2708: don't restrict DT support to ARCH_BCM2835 + +Both ARCH_BCM2835 and ARCH_BCM270x are built with OF now. +Add Device Tree support to the non ARCH_BCM2835 case. +Use the same driver name regardless of architecture. + +Signed-off-by: Noralf Trønnes <noralf@tronnes.org> + +BCM270x_DT: add bcm2835-dma entry + +Add Device Tree entry for bcm2835-dma. +The entry doesn't contain any resources since they are handled +by the arch/arm/mach-bcm270x/dma.c driver. +In non-DT mode, don't add the device in the board file. + +Signed-off-by: Noralf Trønnes <noralf@tronnes.org> + +bcm2708-dmaengine: Add debug options + +BCM270x: Add memory and irq resources to dmaengine device and DT + +Prepare for merging of the legacy DMA API arch driver dma.c +with bcm2708-dmaengine by adding memory and irq resources both +to platform file device and Device Tree node. +Don't use BCM_DMAMAN_DRIVER_NAME so we don't have to include mach/dma.h + +Signed-off-by: Noralf Trønnes <noralf@tronnes.org> + +dmaengine: bcm2708: Merge with arch dma.c driver and disable dma.c + +Merge the legacy DMA API driver with bcm2708-dmaengine. +This is done so we can use bcm2708_fb on ARCH_BCM2835 (mailbox +driver is also needed). + +Changes to the dma.c code: +- Use BIT() macro. +- Cutdown some comments to one line. +- Add mutex to vc_dmaman and use this, since the dev lock is locked + during probing of the engine part. +- Add global g_dmaman variable since drvdata is used by the engine part. +- Restructure for readability: + vc_dmaman_chan_alloc() + vc_dmaman_chan_free() + bcm_dma_chan_free() +- Restructure bcm_dma_chan_alloc() to simplify error handling. +- Use device irq resources instead of hardcoded bcm_dma_irqs table. +- Remove dev_dmaman_register() and code it directly. +- Remove dev_dmaman_deregister() and code it directly. +- Simplify bcm_dmaman_probe() using devm_* functions. +- Get dmachans from DT if available. +- Keep 'dma.dmachans' module argument name for backwards compatibility. + +Make it available on ARCH_BCM2835 as well. + +Signed-off-by: Noralf Trønnes <noralf@tronnes.org> + +dmaengine: bcm2708: set residue_granularity field + +bcm2708-dmaengine supports residue reporting at burst level +but didn't report this via the residue_granularity field. + +Without this field set properly we get playback issues with I2S cards. + +dmaengine: bcm2708-dmaengine: Fix memory leak when stopping a running transfer + +bcm2708-dmaengine: Use more DMA channels (but not 12) + +1) Only the bcm2708_fb drivers uses the legacy DMA API, and +it requires a BULK-capable channel, so all other types +(FAST, NORMAL and LITE) can be made available to the regular +DMA API. + +2) DMA channels 11-14 share an interrupt. The driver can't +handle this, so don't use channels 12-14 (12 was used, probably +because it appears to have an interrupt, but in reality that +interrupt is for activity on ANY channel). This may explain +a lockup encountered when running out of DMA channels. + +The combined effect of this patch is to leave 7 DMA channels +available + channel 0 for bcm2708_fb via the legacy API. + +See: https://github.com/raspberrypi/linux/issues/1110 + https://github.com/raspberrypi/linux/issues/1108 + +dmaengine: bcm2708: Make legacy API available for bcm2835-dma + +bcm2708_fb uses the legacy DMA API, so in order to start using +bcm2835-dma, bcm2835-dma has to support the legacy API. Make this +possible by exporting bcm_dmaman_probe() and bcm_dmaman_remove(). + +Signed-off-by: Noralf Trønnes <noralf@tronnes.org> + +dmaengine: bcm2708: Change DT compatible string + +Both bcm2835-dma and bcm2708-dmaengine have the same compatible string. +So change compatible to "brcm,bcm2708-dma". + +Signed-off-by: Noralf Trønnes <noralf@tronnes.org> + +dmaengine: bcm2708: Remove driver but keep legacy API + +Dropping non-DT support means we don't need this driver, +but we still need the legacy DMA API. + +Signed-off-by: Noralf Trønnes <noralf@tronnes.org> +--- + drivers/dma/Kconfig | 4 + + drivers/dma/Makefile | 1 + + drivers/dma/bcm2708-dmaengine.c | 281 ++++++++++++++++++++++++++++++ + include/linux/platform_data/dma-bcm2708.h | 143 +++++++++++++++ + 4 files changed, 429 insertions(+) + create mode 100644 drivers/dma/bcm2708-dmaengine.c + create mode 100644 include/linux/platform_data/dma-bcm2708.h + +diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig +index 4d0425c..b7863f0 100644 +--- a/drivers/dma/Kconfig ++++ b/drivers/dma/Kconfig +@@ -474,6 +474,10 @@ config TIMB_DMA + help + Enable support for the Timberdale FPGA DMA engine. + ++config DMA_BCM2708 ++ tristate "BCM2708 DMA legacy API support" ++ depends on DMA_BCM2835 ++ + config TI_CPPI41 + tristate "AM33xx CPPI41 DMA support" + depends on ARCH_OMAP +diff --git a/drivers/dma/Makefile b/drivers/dma/Makefile +index 6084127..8188c36 100644 +--- a/drivers/dma/Makefile ++++ b/drivers/dma/Makefile +@@ -18,6 +18,7 @@ obj-$(CONFIG_AT_HDMAC) += at_hdmac.o + obj-$(CONFIG_AT_XDMAC) += at_xdmac.o + obj-$(CONFIG_AXI_DMAC) += dma-axi-dmac.o + obj-$(CONFIG_COH901318) += coh901318.o coh901318_lli.o ++obj-$(CONFIG_DMA_BCM2708) += bcm2708-dmaengine.o + obj-$(CONFIG_DMA_BCM2835) += bcm2835-dma.o + obj-$(CONFIG_DMA_JZ4740) += dma-jz4740.o + obj-$(CONFIG_DMA_JZ4780) += dma-jz4780.o +diff --git a/drivers/dma/bcm2708-dmaengine.c b/drivers/dma/bcm2708-dmaengine.c +new file mode 100644 +index 0000000..56f18dc +--- /dev/null ++++ b/drivers/dma/bcm2708-dmaengine.c +@@ -0,0 +1,281 @@ ++/* ++ * BCM2708 legacy DMA API ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ */ ++ ++#include <linux/init.h> ++#include <linux/interrupt.h> ++#include <linux/list.h> ++#include <linux/module.h> ++#include <linux/platform_data/dma-bcm2708.h> ++#include <linux/platform_device.h> ++#include <linux/slab.h> ++#include <linux/io.h> ++#include <linux/spinlock.h> ++ ++#include "virt-dma.h" ++ ++#define CACHE_LINE_MASK 31 ++#define DEFAULT_DMACHAN_BITMAP 0x10 /* channel 4 only */ ++ ++/* valid only for channels 0 - 14, 15 has its own base address */ ++#define BCM2708_DMA_CHAN(n) ((n) << 8) /* base address */ ++#define BCM2708_DMA_CHANIO(dma_base, n) \ ++ ((void __iomem *)((char *)(dma_base) + BCM2708_DMA_CHAN(n))) ++ ++struct vc_dmaman { ++ void __iomem *dma_base; ++ u32 chan_available; /* bitmap of available channels */ ++ u32 has_feature[BCM_DMA_FEATURE_COUNT]; /* bitmap of feature presence */ ++ struct mutex lock; ++}; ++ ++static struct device *dmaman_dev; /* we assume there's only one! */ ++static struct vc_dmaman *g_dmaman; /* DMA manager */ ++ ++/* DMA Auxiliary Functions */ ++ ++/* A DMA buffer on an arbitrary boundary may separate a cache line into a ++ section inside the DMA buffer and another section outside it. ++ Even if we flush DMA buffers from the cache there is always the chance that ++ during a DMA someone will access the part of a cache line that is outside ++ the DMA buffer - which will then bring in unwelcome data. ++ Without being able to dictate our own buffer pools we must insist that ++ DMA buffers consist of a whole number of cache lines. ++*/ ++extern int bcm_sg_suitable_for_dma(struct scatterlist *sg_ptr, int sg_len) ++{ ++ int i; ++ ++ for (i = 0; i < sg_len; i++) { ++ if (sg_ptr[i].offset & CACHE_LINE_MASK || ++ sg_ptr[i].length & CACHE_LINE_MASK) ++ return 0; ++ } ++ ++ return 1; ++} ++EXPORT_SYMBOL_GPL(bcm_sg_suitable_for_dma); ++ ++extern void bcm_dma_start(void __iomem *dma_chan_base, ++ dma_addr_t control_block) ++{ ++ dsb(); /* ARM data synchronization (push) operation */ ++ ++ writel(control_block, dma_chan_base + BCM2708_DMA_ADDR); ++ writel(BCM2708_DMA_ACTIVE, dma_chan_base + BCM2708_DMA_CS); ++} ++EXPORT_SYMBOL_GPL(bcm_dma_start); ++ ++extern void bcm_dma_wait_idle(void __iomem *dma_chan_base) ++{ ++ dsb(); ++ ++ /* ugly busy wait only option for now */ ++ while (readl(dma_chan_base + BCM2708_DMA_CS) & BCM2708_DMA_ACTIVE) ++ cpu_relax(); ++} ++EXPORT_SYMBOL_GPL(bcm_dma_wait_idle); ++ ++extern bool bcm_dma_is_busy(void __iomem *dma_chan_base) ++{ ++ dsb(); ++ ++ return readl(dma_chan_base + BCM2708_DMA_CS) & BCM2708_DMA_ACTIVE; ++} ++EXPORT_SYMBOL_GPL(bcm_dma_is_busy); ++ ++/* Complete an ongoing DMA (assuming its results are to be ignored) ++ Does nothing if there is no DMA in progress. ++ This routine waits for the current AXI transfer to complete before ++ terminating the current DMA. If the current transfer is hung on a DREQ used ++ by an uncooperative peripheral the AXI transfer may never complete. In this ++ case the routine times out and return a non-zero error code. ++ Use of this routine doesn't guarantee that the ongoing or aborted DMA ++ does not produce an interrupt. ++*/ ++extern int bcm_dma_abort(void __iomem *dma_chan_base) ++{ ++ unsigned long int cs; ++ int rc = 0; ++ ++ cs = readl(dma_chan_base + BCM2708_DMA_CS); ++ ++ if (BCM2708_DMA_ACTIVE & cs) { ++ long int timeout = 10000; ++ ++ /* write 0 to the active bit - pause the DMA */ ++ writel(0, dma_chan_base + BCM2708_DMA_CS); ++ ++ /* wait for any current AXI transfer to complete */ ++ while (0 != (cs & BCM2708_DMA_ISPAUSED) && --timeout >= 0) ++ cs = readl(dma_chan_base + BCM2708_DMA_CS); ++ ++ if (0 != (cs & BCM2708_DMA_ISPAUSED)) { ++ /* we'll un-pause when we set of our next DMA */ ++ rc = -ETIMEDOUT; ++ ++ } else if (BCM2708_DMA_ACTIVE & cs) { ++ /* terminate the control block chain */ ++ writel(0, dma_chan_base + BCM2708_DMA_NEXTCB); ++ ++ /* abort the whole DMA */ ++ writel(BCM2708_DMA_ABORT | BCM2708_DMA_ACTIVE, ++ dma_chan_base + BCM2708_DMA_CS); ++ } ++ } ++ ++ return rc; ++} ++EXPORT_SYMBOL_GPL(bcm_dma_abort); ++ ++ /* DMA Manager Device Methods */ ++ ++static void vc_dmaman_init(struct vc_dmaman *dmaman, void __iomem *dma_base, ++ u32 chans_available) ++{ ++ dmaman->dma_base = dma_base; ++ dmaman->chan_available = chans_available; ++ dmaman->has_feature[BCM_DMA_FEATURE_FAST_ORD] = 0x0c; /* 2 & 3 */ ++ dmaman->has_feature[BCM_DMA_FEATURE_BULK_ORD] = 0x01; /* 0 */ ++ dmaman->has_feature[BCM_DMA_FEATURE_NORMAL_ORD] = 0xfe; /* 1 to 7 */ ++ dmaman->has_feature[BCM_DMA_FEATURE_LITE_ORD] = 0x7f00; /* 8 to 14 */ ++} ++ ++static int vc_dmaman_chan_alloc(struct vc_dmaman *dmaman, ++ unsigned required_feature_set) ++{ ++ u32 chans; ++ int chan = 0; ++ int feature; ++ ++ chans = dmaman->chan_available; ++ for (feature = 0; feature < BCM_DMA_FEATURE_COUNT; feature++) ++ /* select the subset of available channels with the desired ++ features */ ++ if (required_feature_set & (1 << feature)) ++ chans &= dmaman->has_feature[feature]; ++ ++ if (!chans) ++ return -ENOENT; ++ ++ /* return the ordinal of the first channel in the bitmap */ ++ while (chans != 0 && (chans & 1) == 0) { ++ chans >>= 1; ++ chan++; ++ } ++ /* claim the channel */ ++ dmaman->chan_available &= ~(1 << chan); ++ ++ return chan; ++} ++ ++static int vc_dmaman_chan_free(struct vc_dmaman *dmaman, int chan) ++{ ++ if (chan < 0) ++ return -EINVAL; ++ ++ if ((1 << chan) & dmaman->chan_available) ++ return -EIDRM; ++ ++ dmaman->chan_available |= (1 << chan); ++ ++ return 0; ++} ++ ++/* DMA Manager Monitor */ ++ ++extern int bcm_dma_chan_alloc(unsigned required_feature_set, ++ void __iomem **out_dma_base, int *out_dma_irq) ++{ ++ struct vc_dmaman *dmaman = g_dmaman; ++ struct platform_device *pdev = to_platform_device(dmaman_dev); ++ struct resource *r; ++ int chan; ++ ++ if (!dmaman_dev) ++ return -ENODEV; ++ ++ mutex_lock(&dmaman->lock); ++ chan = vc_dmaman_chan_alloc(dmaman, required_feature_set); ++ if (chan < 0) ++ goto out; ++ ++ r = platform_get_resource(pdev, IORESOURCE_IRQ, (unsigned int)chan); ++ if (!r) { ++ dev_err(dmaman_dev, "failed to get irq for DMA channel %d\n", ++ chan); ++ vc_dmaman_chan_free(dmaman, chan); ++ chan = -ENOENT; ++ goto out; ++ } ++ ++ *out_dma_base = BCM2708_DMA_CHANIO(dmaman->dma_base, chan); ++ *out_dma_irq = r->start; ++ dev_dbg(dmaman_dev, ++ "Legacy API allocated channel=%d, base=%p, irq=%i\n", ++ chan, *out_dma_base, *out_dma_irq); ++ ++out: ++ mutex_unlock(&dmaman->lock); ++ ++ return chan; ++} ++EXPORT_SYMBOL_GPL(bcm_dma_chan_alloc); ++ ++extern int bcm_dma_chan_free(int channel) ++{ ++ struct vc_dmaman *dmaman = g_dmaman; ++ int rc; ++ ++ if (!dmaman_dev) ++ return -ENODEV; ++ ++ mutex_lock(&dmaman->lock); ++ rc = vc_dmaman_chan_free(dmaman, channel); ++ mutex_unlock(&dmaman->lock); ++ ++ return rc; ++} ++EXPORT_SYMBOL_GPL(bcm_dma_chan_free); ++ ++int bcm_dmaman_probe(struct platform_device *pdev, void __iomem *base, ++ u32 chans_available) ++{ ++ struct device *dev = &pdev->dev; ++ struct vc_dmaman *dmaman; ++ ++ dmaman = devm_kzalloc(dev, sizeof(*dmaman), GFP_KERNEL); ++ if (!dmaman) ++ return -ENOMEM; ++ ++ mutex_init(&dmaman->lock); ++ vc_dmaman_init(dmaman, base, chans_available); ++ g_dmaman = dmaman; ++ dmaman_dev = dev; ++ ++ dev_info(dev, "DMA legacy API manager at %p, dmachans=0x%x\n", ++ base, chans_available); ++ ++ return 0; ++} ++EXPORT_SYMBOL(bcm_dmaman_probe); ++ ++int bcm_dmaman_remove(struct platform_device *pdev) ++{ ++ dmaman_dev = NULL; ++ ++ return 0; ++} ++EXPORT_SYMBOL(bcm_dmaman_remove); ++ ++MODULE_LICENSE("GPL"); +diff --git a/include/linux/platform_data/dma-bcm2708.h b/include/linux/platform_data/dma-bcm2708.h +new file mode 100644 +index 0000000..99cc7fd +--- /dev/null ++++ b/include/linux/platform_data/dma-bcm2708.h +@@ -0,0 +1,143 @@ ++/* ++ * Copyright (C) 2010 Broadcom ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 as ++ * published by the Free Software Foundation. ++ */ ++ ++#ifndef _PLAT_BCM2708_DMA_H ++#define _PLAT_BCM2708_DMA_H ++ ++/* DMA CS Control and Status bits */ ++#define BCM2708_DMA_ACTIVE BIT(0) ++#define BCM2708_DMA_INT BIT(2) ++#define BCM2708_DMA_ISPAUSED BIT(4) /* Pause requested or not active */ ++#define BCM2708_DMA_ISHELD BIT(5) /* Is held by DREQ flow control */ ++#define BCM2708_DMA_ERR BIT(8) ++#define BCM2708_DMA_ABORT BIT(30) /* stop current CB, go to next, WO */ ++#define BCM2708_DMA_RESET BIT(31) /* WO, self clearing */ ++ ++/* DMA control block "info" field bits */ ++#define BCM2708_DMA_INT_EN BIT(0) ++#define BCM2708_DMA_TDMODE BIT(1) ++#define BCM2708_DMA_WAIT_RESP BIT(3) ++#define BCM2708_DMA_D_INC BIT(4) ++#define BCM2708_DMA_D_WIDTH BIT(5) ++#define BCM2708_DMA_D_DREQ BIT(6) ++#define BCM2708_DMA_S_INC BIT(8) ++#define BCM2708_DMA_S_WIDTH BIT(9) ++#define BCM2708_DMA_S_DREQ BIT(10) ++ ++#define BCM2708_DMA_BURST(x) (((x) & 0xf) << 12) ++#define BCM2708_DMA_PER_MAP(x) ((x) << 16) ++#define BCM2708_DMA_WAITS(x) (((x) & 0x1f) << 21) ++ ++#define BCM2708_DMA_DREQ_EMMC 11 ++#define BCM2708_DMA_DREQ_SDHOST 13 ++ ++#define BCM2708_DMA_CS 0x00 /* Control and Status */ ++#define BCM2708_DMA_ADDR 0x04 ++/* the current control block appears in the following registers - read only */ ++#define BCM2708_DMA_INFO 0x08 ++#define BCM2708_DMA_SOURCE_AD 0x0c ++#define BCM2708_DMA_DEST_AD 0x10 ++#define BCM2708_DMA_NEXTCB 0x1C ++#define BCM2708_DMA_DEBUG 0x20 ++ ++#define BCM2708_DMA4_CS (BCM2708_DMA_CHAN(4) + BCM2708_DMA_CS) ++#define BCM2708_DMA4_ADDR (BCM2708_DMA_CHAN(4) + BCM2708_DMA_ADDR) ++ ++#define BCM2708_DMA_TDMODE_LEN(w, h) ((h) << 16 | (w)) ++ ++/* When listing features we can ask for when allocating DMA channels give ++ those with higher priority smaller ordinal numbers */ ++#define BCM_DMA_FEATURE_FAST_ORD 0 ++#define BCM_DMA_FEATURE_BULK_ORD 1 ++#define BCM_DMA_FEATURE_NORMAL_ORD 2 ++#define BCM_DMA_FEATURE_LITE_ORD 3 ++#define BCM_DMA_FEATURE_FAST BIT(BCM_DMA_FEATURE_FAST_ORD) ++#define BCM_DMA_FEATURE_BULK BIT(BCM_DMA_FEATURE_BULK_ORD) ++#define BCM_DMA_FEATURE_NORMAL BIT(BCM_DMA_FEATURE_NORMAL_ORD) ++#define BCM_DMA_FEATURE_LITE BIT(BCM_DMA_FEATURE_LITE_ORD) ++#define BCM_DMA_FEATURE_COUNT 4 ++ ++struct bcm2708_dma_cb { ++ unsigned long info; ++ unsigned long src; ++ unsigned long dst; ++ unsigned long length; ++ unsigned long stride; ++ unsigned long next; ++ unsigned long pad[2]; ++}; ++ ++struct scatterlist; ++struct platform_device; ++ ++#ifdef CONFIG_DMA_BCM2708 ++ ++int bcm_sg_suitable_for_dma(struct scatterlist *sg_ptr, int sg_len); ++void bcm_dma_start(void __iomem *dma_chan_base, dma_addr_t control_block); ++void bcm_dma_wait_idle(void __iomem *dma_chan_base); ++bool bcm_dma_is_busy(void __iomem *dma_chan_base); ++int bcm_dma_abort(void __iomem *dma_chan_base); ++ ++/* return channel no or -ve error */ ++int bcm_dma_chan_alloc(unsigned preferred_feature_set, ++ void __iomem **out_dma_base, int *out_dma_irq); ++int bcm_dma_chan_free(int channel); ++ ++int bcm_dmaman_probe(struct platform_device *pdev, void __iomem *base, ++ u32 chans_available); ++int bcm_dmaman_remove(struct platform_device *pdev); ++ ++#else /* CONFIG_DMA_BCM2708 */ ++ ++static inline int bcm_sg_suitable_for_dma(struct scatterlist *sg_ptr, ++ int sg_len) ++{ ++ return 0; ++} ++ ++static inline void bcm_dma_start(void __iomem *dma_chan_base, ++ dma_addr_t control_block) { } ++ ++static inline void bcm_dma_wait_idle(void __iomem *dma_chan_base) { } ++ ++static inline bool bcm_dma_is_busy(void __iomem *dma_chan_base) ++{ ++ return false; ++} ++ ++static inline int bcm_dma_abort(void __iomem *dma_chan_base) ++{ ++ return -EINVAL; ++} ++ ++static inline int bcm_dma_chan_alloc(unsigned preferred_feature_set, ++ void __iomem **out_dma_base, ++ int *out_dma_irq) ++{ ++ return -EINVAL; ++} ++ ++static inline int bcm_dma_chan_free(int channel) ++{ ++ return -EINVAL; ++} ++ ++static inline int bcm_dmaman_probe(struct platform_device *pdev, ++ void __iomem *base, u32 chans_available) ++{ ++ return 0; ++} ++ ++static inline int bcm_dmaman_remove(struct platform_device *pdev) ++{ ++ return 0; ++} ++ ++#endif /* CONFIG_DMA_BCM2708 */ ++ ++#endif /* _PLAT_BCM2708_DMA_H */ + +From 786f8c7793b58831efa8e1ffe5a02723842d3728 Mon Sep 17 00:00:00 2001 +From: gellert <gellert@raspberrypi.org> +Date: Fri, 15 Aug 2014 16:35:06 +0100 +Subject: [PATCH 036/112] MMC: added alternative MMC driver +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +mmc: Disable CMD23 transfers on all cards + +Pending wire-level investigation of these types of transfers +and associated errors on bcm2835-mmc, disable for now. Fallback of +CMD18/CMD25 transfers will be used automatically by the MMC layer. + +Reported/Tested-by: Gellert Weisz <gellert@raspberrypi.org> + +mmc: bcm2835-mmc: enable DT support for all architectures + +Both ARCH_BCM2835 and ARCH_BCM270x are built with OF now. +Enable Device Tree support for all architectures. + +Signed-off-by: Noralf Trønnes <noralf@tronnes.org> + +mmc: bcm2835-mmc: fix probe error handling + +Probe error handling is broken in several places. +Simplify error handling by using device managed functions. +Replace pr_{err,info} with dev_{err,info}. + +Signed-off-by: Noralf Trønnes <noralf@tronnes.org> + +bcm2835-mmc: Add locks when accessing sdhost registers + +bcm2835-mmc: Add range of debug options for slowing things down + +bcm2835-mmc: Add option to disable some delays + +bcm2835-mmc: Add option to disable MMC_QUIRK_BLK_NO_CMD23 + +bcm2835-mmc: Default to disabling MMC_QUIRK_BLK_NO_CMD23 + +bcm2835-mmc: Adding overclocking option + +Allow a different clock speed to be substitued for a requested 50MHz. +This option is exposed using the "overclock_50" DT parameter. +Note that the mmc interface is restricted to EVEN integer divisions of +250MHz, and the highest sensible option is 63 (250/4 = 62.5), the +next being 125 (250/2) which is much too high. + +Use at your own risk. + +bcm2835-mmc: Round up the overclock, so 62 works for 62.5Mhz + +Also only warn once for each overclock setting. + +mmc: bcm2835-mmc: Make available on ARCH_BCM2835 + +Make the bcm2835-mmc driver available for use on ARCH_BCM2835. + +Signed-off-by: Noralf Trønnes <noralf@tronnes.org> + +BCM270x_DT: add bcm2835-mmc entry + +Add Device Tree entry for bcm2835-mmc. +In non-DT mode, don't add the device in the board file. + +Signed-off-by: Noralf Trønnes <noralf@tronnes.org> + +bcm2835-mmc: Don't overwrite MMC capabilities from DT + +bcm2835-mmc: Don't override bus width capabilities from devicetree + +Take out the force setting of the MMC_CAP_4_BIT_DATA host capability +so that the result read from devicetree via mmc_of_parse() is +preserved. + +bcm2835-mmc: Only claim one DMA channel + +With both MMC controllers enabled there are few DMA channels left. The +bcm2835-mmc driver only uses DMA in one direction at a time, so it +doesn't need to claim two channels. + +See: https://github.com/raspberrypi/linux/issues/1327 + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> +--- + drivers/mmc/core/quirks.c | 10 + + drivers/mmc/host/Kconfig | 29 + + drivers/mmc/host/Makefile | 1 + + drivers/mmc/host/bcm2835-mmc.c | 1571 ++++++++++++++++++++++++++++++++++++++++ + 4 files changed, 1611 insertions(+) + create mode 100644 drivers/mmc/host/bcm2835-mmc.c + +diff --git a/drivers/mmc/core/quirks.c b/drivers/mmc/core/quirks.c +index fad660b..b79fe14 100644 +--- a/drivers/mmc/core/quirks.c ++++ b/drivers/mmc/core/quirks.c +@@ -53,6 +53,9 @@ static const struct mmc_fixup mmc_fixup_methods[] = { + + void mmc_fixup_device(struct mmc_card *card, const struct mmc_fixup *table) + { ++#ifdef CONFIG_MMC_BCM2835 ++ extern unsigned mmc_debug; ++#endif + const struct mmc_fixup *f; + u64 rev = cid_rev_card(card); + +@@ -77,5 +80,12 @@ void mmc_fixup_device(struct mmc_card *card, const struct mmc_fixup *table) + f->vendor_fixup(card, f->data); + } + } ++ /* SDHCI on BCM2708 - bug causes a certain sequence of CMD23 operations to fail. ++ * Disable this flag for all cards (fall-back to CMD25/CMD18 multi-block transfers). ++ */ ++#ifdef CONFIG_MMC_BCM2835 ++ if (mmc_debug & (1<<13)) ++ card->quirks |= MMC_QUIRK_BLK_NO_CMD23; ++#endif + } + EXPORT_SYMBOL(mmc_fixup_device); +diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig +index e657af0..0476061 100644 +--- a/drivers/mmc/host/Kconfig ++++ b/drivers/mmc/host/Kconfig +@@ -4,6 +4,35 @@ + + comment "MMC/SD/SDIO Host Controller Drivers" + ++config MMC_BCM2835 ++ tristate "MMC support on BCM2835" ++ depends on MACH_BCM2708 || MACH_BCM2709 || ARCH_BCM2835 ++ help ++ This selects the MMC Interface on BCM2835. ++ ++ If you have a controller with this interface, say Y or M here. ++ ++ If unsure, say N. ++ ++config MMC_BCM2835_DMA ++ bool "DMA support on BCM2835 Arasan controller" ++ depends on MMC_BCM2835 ++ help ++ Enable DMA support on the Arasan SDHCI controller in Broadcom 2708 ++ based chips. ++ ++ If unsure, say N. ++ ++config MMC_BCM2835_PIO_DMA_BARRIER ++ int "Block count limit for PIO transfers" ++ depends on MMC_BCM2835 && MMC_BCM2835_DMA ++ range 0 256 ++ default 2 ++ help ++ The inclusive limit in bytes under which PIO will be used instead of DMA ++ ++ If unsure, say 2 here. ++ + config MMC_ARMMMCI + tristate "ARM AMBA Multimedia Card Interface support" + depends on ARM_AMBA +diff --git a/drivers/mmc/host/Makefile b/drivers/mmc/host/Makefile +index af918d2..3ba94f0 100644 +--- a/drivers/mmc/host/Makefile ++++ b/drivers/mmc/host/Makefile +@@ -18,6 +18,7 @@ obj-$(CONFIG_MMC_SDHCI_S3C) += sdhci-s3c.o + obj-$(CONFIG_MMC_SDHCI_SIRF) += sdhci-sirf.o + obj-$(CONFIG_MMC_SDHCI_F_SDH30) += sdhci_f_sdh30.o + obj-$(CONFIG_MMC_SDHCI_SPEAR) += sdhci-spear.o ++obj-$(CONFIG_MMC_BCM2835) += bcm2835-mmc.o + obj-$(CONFIG_MMC_WBSD) += wbsd.o + obj-$(CONFIG_MMC_AU1X) += au1xmmc.o + obj-$(CONFIG_MMC_MTK) += mtk-sd.o +diff --git a/drivers/mmc/host/bcm2835-mmc.c b/drivers/mmc/host/bcm2835-mmc.c +new file mode 100644 +index 0000000..ceb3793 +--- /dev/null ++++ b/drivers/mmc/host/bcm2835-mmc.c +@@ -0,0 +1,1571 @@ ++/* ++ * BCM2835 MMC host driver. ++ * ++ * Author: Gellert Weisz <gellert@raspberrypi.org> ++ * Copyright 2014 ++ * ++ * Based on ++ * sdhci-bcm2708.c by Broadcom ++ * sdhci-bcm2835.c by Stephen Warren and Oleksandr Tymoshenko ++ * sdhci.c and sdhci-pci.c by Pierre Ossman ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms and conditions of the GNU General Public License, ++ * version 2, as published by the Free Software Foundation. ++ * ++ * This program is distributed in the hope it will be useful, but WITHOUT ++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for ++ * more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program. If not, see <http://www.gnu.org/licenses/>. ++ */ ++ ++#include <linux/delay.h> ++#include <linux/module.h> ++#include <linux/io.h> ++#include <linux/mmc/mmc.h> ++#include <linux/mmc/host.h> ++#include <linux/mmc/sd.h> ++#include <linux/scatterlist.h> ++#include <linux/of_address.h> ++#include <linux/of_irq.h> ++#include <linux/clk.h> ++#include <linux/platform_device.h> ++#include <linux/err.h> ++#include <linux/blkdev.h> ++#include <linux/dmaengine.h> ++#include <linux/dma-mapping.h> ++#include <linux/of_dma.h> ++ ++#include "sdhci.h" ++ ++ ++#define DRIVER_NAME "mmc-bcm2835" ++ ++#define DBG(f, x...) \ ++pr_debug(DRIVER_NAME " [%s()]: " f, __func__, ## x) ++ ++#ifndef CONFIG_MMC_BCM2835_DMA ++ #define FORCE_PIO ++#endif ++ ++ ++/* the inclusive limit in bytes under which PIO will be used instead of DMA */ ++#ifdef CONFIG_MMC_BCM2835_PIO_DMA_BARRIER ++#define PIO_DMA_BARRIER CONFIG_MMC_BCM2835_PIO_DMA_BARRIER ++#else ++#define PIO_DMA_BARRIER 00 ++#endif ++ ++#define MIN_FREQ 400000 ++#define TIMEOUT_VAL 0xE ++#define BCM2835_SDHCI_WRITE_DELAY(f) (((2 * 1000000) / f) + 1) ++ ++ ++unsigned mmc_debug; ++unsigned mmc_debug2; ++ ++struct bcm2835_host { ++ spinlock_t lock; ++ ++ void __iomem *ioaddr; ++ u32 bus_addr; ++ ++ struct mmc_host *mmc; ++ ++ u32 timeout; ++ ++ int clock; /* Current clock speed */ ++ u8 pwr; /* Current voltage */ ++ ++ unsigned int max_clk; /* Max possible freq */ ++ unsigned int timeout_clk; /* Timeout freq (KHz) */ ++ unsigned int clk_mul; /* Clock Muliplier value */ ++ ++ struct tasklet_struct finish_tasklet; /* Tasklet structures */ ++ ++ struct timer_list timer; /* Timer for timeouts */ ++ ++ struct sg_mapping_iter sg_miter; /* SG state for PIO */ ++ unsigned int blocks; /* remaining PIO blocks */ ++ ++ int irq; /* Device IRQ */ ++ ++ ++ u32 ier; /* cached registers */ ++ ++ struct mmc_request *mrq; /* Current request */ ++ struct mmc_command *cmd; /* Current command */ ++ struct mmc_data *data; /* Current data request */ ++ unsigned int data_early:1; /* Data finished before cmd */ ++ ++ wait_queue_head_t buf_ready_int; /* Waitqueue for Buffer Read Ready interrupt */ ++ ++ u32 thread_isr; ++ ++ u32 shadow; ++ ++ /*DMA part*/ ++ struct dma_chan *dma_chan_rxtx; /* DMA channel for reads and writes */ ++ struct dma_slave_config dma_cfg_rx; ++ struct dma_slave_config dma_cfg_tx; ++ struct dma_async_tx_descriptor *tx_desc; /* descriptor */ ++ ++ bool have_dma; ++ bool use_dma; ++ /*end of DMA part*/ ++ ++ int max_delay; /* maximum length of time spent waiting */ ++ ++ int flags; /* Host attributes */ ++#define SDHCI_REQ_USE_DMA (1<<2) /* Use DMA for this req. */ ++#define SDHCI_DEVICE_DEAD (1<<3) /* Device unresponsive */ ++#define SDHCI_AUTO_CMD12 (1<<6) /* Auto CMD12 support */ ++#define SDHCI_AUTO_CMD23 (1<<7) /* Auto CMD23 support */ ++#define SDHCI_SDIO_IRQ_ENABLED (1<<9) /* SDIO irq enabled */ ++ ++ u32 overclock_50; /* frequency to use when 50MHz is requested (in MHz) */ ++ u32 max_overclock; /* Highest reported */ ++}; ++ ++ ++static inline void bcm2835_mmc_writel(struct bcm2835_host *host, u32 val, int reg, int from) ++{ ++ unsigned delay; ++ lockdep_assert_held_once(&host->lock); ++ writel(val, host->ioaddr + reg); ++ udelay(BCM2835_SDHCI_WRITE_DELAY(max(host->clock, MIN_FREQ))); ++ ++ delay = ((mmc_debug >> 16) & 0xf) << ((mmc_debug >> 20) & 0xf); ++ if (delay && !((1<<from) & mmc_debug2)) ++ udelay(delay); ++} ++ ++static inline void mmc_raw_writel(struct bcm2835_host *host, u32 val, int reg) ++{ ++ unsigned delay; ++ lockdep_assert_held_once(&host->lock); ++ writel(val, host->ioaddr + reg); ++ ++ delay = ((mmc_debug >> 24) & 0xf) << ((mmc_debug >> 28) & 0xf); ++ if (delay) ++ udelay(delay); ++} ++ ++static inline u32 bcm2835_mmc_readl(struct bcm2835_host *host, int reg) ++{ ++ lockdep_assert_held_once(&host->lock); ++ return readl(host->ioaddr + reg); ++} ++ ++static inline void bcm2835_mmc_writew(struct bcm2835_host *host, u16 val, int reg) ++{ ++ u32 oldval = (reg == SDHCI_COMMAND) ? host->shadow : ++ bcm2835_mmc_readl(host, reg & ~3); ++ u32 word_num = (reg >> 1) & 1; ++ u32 word_shift = word_num * 16; ++ u32 mask = 0xffff << word_shift; ++ u32 newval = (oldval & ~mask) | (val << word_shift); ++ ++ if (reg == SDHCI_TRANSFER_MODE) ++ host->shadow = newval; ++ else ++ bcm2835_mmc_writel(host, newval, reg & ~3, 0); ++ ++} ++ ++static inline void bcm2835_mmc_writeb(struct bcm2835_host *host, u8 val, int reg) ++{ ++ u32 oldval = bcm2835_mmc_readl(host, reg & ~3); ++ u32 byte_num = reg & 3; ++ u32 byte_shift = byte_num * 8; ++ u32 mask = 0xff << byte_shift; ++ u32 newval = (oldval & ~mask) | (val << byte_shift); ++ ++ bcm2835_mmc_writel(host, newval, reg & ~3, 1); ++} ++ ++ ++static inline u16 bcm2835_mmc_readw(struct bcm2835_host *host, int reg) ++{ ++ u32 val = bcm2835_mmc_readl(host, (reg & ~3)); ++ u32 word_num = (reg >> 1) & 1; ++ u32 word_shift = word_num * 16; ++ u32 word = (val >> word_shift) & 0xffff; ++ ++ return word; ++} ++ ++static inline u8 bcm2835_mmc_readb(struct bcm2835_host *host, int reg) ++{ ++ u32 val = bcm2835_mmc_readl(host, (reg & ~3)); ++ u32 byte_num = reg & 3; ++ u32 byte_shift = byte_num * 8; ++ u32 byte = (val >> byte_shift) & 0xff; ++ ++ return byte; ++} ++ ++static void bcm2835_mmc_unsignal_irqs(struct bcm2835_host *host, u32 clear) ++{ ++ u32 ier; ++ ++ ier = bcm2835_mmc_readl(host, SDHCI_SIGNAL_ENABLE); ++ ier &= ~clear; ++ /* change which requests generate IRQs - makes no difference to ++ the content of SDHCI_INT_STATUS, or the need to acknowledge IRQs */ ++ bcm2835_mmc_writel(host, ier, SDHCI_SIGNAL_ENABLE, 2); ++} ++ ++ ++static void bcm2835_mmc_dumpregs(struct bcm2835_host *host) ++{ ++ pr_debug(DRIVER_NAME ": =========== REGISTER DUMP (%s)===========\n", ++ mmc_hostname(host->mmc)); ++ ++ pr_debug(DRIVER_NAME ": Sys addr: 0x%08x | Version: 0x%08x\n", ++ bcm2835_mmc_readl(host, SDHCI_DMA_ADDRESS), ++ bcm2835_mmc_readw(host, SDHCI_HOST_VERSION)); ++ pr_debug(DRIVER_NAME ": Blk size: 0x%08x | Blk cnt: 0x%08x\n", ++ bcm2835_mmc_readw(host, SDHCI_BLOCK_SIZE), ++ bcm2835_mmc_readw(host, SDHCI_BLOCK_COUNT)); ++ pr_debug(DRIVER_NAME ": Argument: 0x%08x | Trn mode: 0x%08x\n", ++ bcm2835_mmc_readl(host, SDHCI_ARGUMENT), ++ bcm2835_mmc_readw(host, SDHCI_TRANSFER_MODE)); ++ pr_debug(DRIVER_NAME ": Present: 0x%08x | Host ctl: 0x%08x\n", ++ bcm2835_mmc_readl(host, SDHCI_PRESENT_STATE), ++ bcm2835_mmc_readb(host, SDHCI_HOST_CONTROL)); ++ pr_debug(DRIVER_NAME ": Power: 0x%08x | Blk gap: 0x%08x\n", ++ bcm2835_mmc_readb(host, SDHCI_POWER_CONTROL), ++ bcm2835_mmc_readb(host, SDHCI_BLOCK_GAP_CONTROL)); ++ pr_debug(DRIVER_NAME ": Wake-up: 0x%08x | Clock: 0x%08x\n", ++ bcm2835_mmc_readb(host, SDHCI_WAKE_UP_CONTROL), ++ bcm2835_mmc_readw(host, SDHCI_CLOCK_CONTROL)); ++ pr_debug(DRIVER_NAME ": Timeout: 0x%08x | Int stat: 0x%08x\n", ++ bcm2835_mmc_readb(host, SDHCI_TIMEOUT_CONTROL), ++ bcm2835_mmc_readl(host, SDHCI_INT_STATUS)); ++ pr_debug(DRIVER_NAME ": Int enab: 0x%08x | Sig enab: 0x%08x\n", ++ bcm2835_mmc_readl(host, SDHCI_INT_ENABLE), ++ bcm2835_mmc_readl(host, SDHCI_SIGNAL_ENABLE)); ++ pr_debug(DRIVER_NAME ": AC12 err: 0x%08x | Slot int: 0x%08x\n", ++ bcm2835_mmc_readw(host, SDHCI_ACMD12_ERR), ++ bcm2835_mmc_readw(host, SDHCI_SLOT_INT_STATUS)); ++ pr_debug(DRIVER_NAME ": Caps: 0x%08x | Caps_1: 0x%08x\n", ++ bcm2835_mmc_readl(host, SDHCI_CAPABILITIES), ++ bcm2835_mmc_readl(host, SDHCI_CAPABILITIES_1)); ++ pr_debug(DRIVER_NAME ": Cmd: 0x%08x | Max curr: 0x%08x\n", ++ bcm2835_mmc_readw(host, SDHCI_COMMAND), ++ bcm2835_mmc_readl(host, SDHCI_MAX_CURRENT)); ++ pr_debug(DRIVER_NAME ": Host ctl2: 0x%08x\n", ++ bcm2835_mmc_readw(host, SDHCI_HOST_CONTROL2)); ++ ++ pr_debug(DRIVER_NAME ": ===========================================\n"); ++} ++ ++ ++static void bcm2835_mmc_reset(struct bcm2835_host *host, u8 mask) ++{ ++ unsigned long timeout; ++ unsigned long flags; ++ ++ spin_lock_irqsave(&host->lock, flags); ++ bcm2835_mmc_writeb(host, mask, SDHCI_SOFTWARE_RESET); ++ ++ if (mask & SDHCI_RESET_ALL) ++ host->clock = 0; ++ ++ /* Wait max 100 ms */ ++ timeout = 100; ++ ++ /* hw clears the bit when it's done */ ++ while (bcm2835_mmc_readb(host, SDHCI_SOFTWARE_RESET) & mask) { ++ if (timeout == 0) { ++ pr_err("%s: Reset 0x%x never completed.\n", ++ mmc_hostname(host->mmc), (int)mask); ++ bcm2835_mmc_dumpregs(host); ++ return; ++ } ++ timeout--; ++ spin_unlock_irqrestore(&host->lock, flags); ++ mdelay(1); ++ spin_lock_irqsave(&host->lock, flags); ++ } ++ ++ if (100-timeout > 10 && 100-timeout > host->max_delay) { ++ host->max_delay = 100-timeout; ++ pr_warning("Warning: MMC controller hung for %d ms\n", host->max_delay); ++ } ++ spin_unlock_irqrestore(&host->lock, flags); ++} ++ ++static void bcm2835_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios); ++ ++static void bcm2835_mmc_init(struct bcm2835_host *host, int soft) ++{ ++ unsigned long flags; ++ if (soft) ++ bcm2835_mmc_reset(host, SDHCI_RESET_CMD|SDHCI_RESET_DATA); ++ else ++ bcm2835_mmc_reset(host, SDHCI_RESET_ALL); ++ ++ host->ier = SDHCI_INT_BUS_POWER | SDHCI_INT_DATA_END_BIT | ++ SDHCI_INT_DATA_CRC | SDHCI_INT_DATA_TIMEOUT | ++ SDHCI_INT_INDEX | SDHCI_INT_END_BIT | SDHCI_INT_CRC | ++ SDHCI_INT_TIMEOUT | SDHCI_INT_DATA_END | ++ SDHCI_INT_RESPONSE; ++ ++ spin_lock_irqsave(&host->lock, flags); ++ bcm2835_mmc_writel(host, host->ier, SDHCI_INT_ENABLE, 3); ++ bcm2835_mmc_writel(host, host->ier, SDHCI_SIGNAL_ENABLE, 3); ++ spin_unlock_irqrestore(&host->lock, flags); ++ ++ if (soft) { ++ /* force clock reconfiguration */ ++ host->clock = 0; ++ bcm2835_mmc_set_ios(host->mmc, &host->mmc->ios); ++ } ++} ++ ++ ++ ++static void bcm2835_mmc_finish_data(struct bcm2835_host *host); ++ ++static void bcm2835_mmc_dma_complete(void *param) ++{ ++ struct bcm2835_host *host = param; ++ struct dma_chan *dma_chan; ++ unsigned long flags; ++ u32 dir_data; ++ ++ spin_lock_irqsave(&host->lock, flags); ++ ++ if (host->data && !(host->data->flags & MMC_DATA_WRITE)) { ++ /* otherwise handled in SDHCI IRQ */ ++ dma_chan = host->dma_chan_rxtx; ++ dir_data = DMA_FROM_DEVICE; ++ ++ dma_unmap_sg(dma_chan->device->dev, ++ host->data->sg, host->data->sg_len, ++ dir_data); ++ ++ bcm2835_mmc_finish_data(host); ++ } ++ ++ spin_unlock_irqrestore(&host->lock, flags); ++} ++ ++static void bcm2835_bcm2835_mmc_read_block_pio(struct bcm2835_host *host) ++{ ++ unsigned long flags; ++ size_t blksize, len, chunk; ++ ++ u32 uninitialized_var(scratch); ++ u8 *buf; ++ ++ blksize = host->data->blksz; ++ chunk = 0; ++ ++ local_irq_save(flags); ++ ++ while (blksize) { ++ if (!sg_miter_next(&host->sg_miter)) ++ BUG(); ++ ++ len = min(host->sg_miter.length, blksize); ++ ++ blksize -= len; ++ host->sg_miter.consumed = len; ++ ++ buf = host->sg_miter.addr; ++ ++ while (len) { ++ if (chunk == 0) { ++ scratch = bcm2835_mmc_readl(host, SDHCI_BUFFER); ++ chunk = 4; ++ } ++ ++ *buf = scratch & 0xFF; ++ ++ buf++; ++ scratch >>= 8; ++ chunk--; ++ len--; ++ } ++ } ++ ++ sg_miter_stop(&host->sg_miter); ++ ++ local_irq_restore(flags); ++} ++ ++static void bcm2835_bcm2835_mmc_write_block_pio(struct bcm2835_host *host) ++{ ++ unsigned long flags; ++ size_t blksize, len, chunk; ++ u32 scratch; ++ u8 *buf; ++ ++ blksize = host->data->blksz; ++ chunk = 0; ++ chunk = 0; ++ scratch = 0; ++ ++ local_irq_save(flags); ++ ++ while (blksize) { ++ if (!sg_miter_next(&host->sg_miter)) ++ BUG(); ++ ++ len = min(host->sg_miter.length, blksize); ++ ++ blksize -= len; ++ host->sg_miter.consumed = len; ++ ++ buf = host->sg_miter.addr; ++ ++ while (len) { ++ scratch |= (u32)*buf << (chunk * 8); ++ ++ buf++; ++ chunk++; ++ len--; ++ ++ if ((chunk == 4) || ((len == 0) && (blksize == 0))) { ++ mmc_raw_writel(host, scratch, SDHCI_BUFFER); ++ chunk = 0; ++ scratch = 0; ++ } ++ } ++ } ++ ++ sg_miter_stop(&host->sg_miter); ++ ++ local_irq_restore(flags); ++} ++ ++ ++static void bcm2835_mmc_transfer_pio(struct bcm2835_host *host) ++{ ++ u32 mask; ++ ++ BUG_ON(!host->data); ++ ++ if (host->blocks == 0) ++ return; ++ ++ if (host->data->flags & MMC_DATA_READ) ++ mask = SDHCI_DATA_AVAILABLE; ++ else ++ mask = SDHCI_SPACE_AVAILABLE; ++ ++ while (bcm2835_mmc_readl(host, SDHCI_PRESENT_STATE) & mask) { ++ ++ if (host->data->flags & MMC_DATA_READ) ++ bcm2835_bcm2835_mmc_read_block_pio(host); ++ else ++ bcm2835_bcm2835_mmc_write_block_pio(host); ++ ++ host->blocks--; ++ ++ /* QUIRK used in sdhci.c removes the 'if' */ ++ /* but it seems this is unnecessary */ ++ if (host->blocks == 0) ++ break; ++ ++ ++ } ++} ++ ++ ++static void bcm2835_mmc_transfer_dma(struct bcm2835_host *host) ++{ ++ u32 len, dir_data, dir_slave; ++ struct dma_async_tx_descriptor *desc = NULL; ++ struct dma_chan *dma_chan; ++ ++ ++ WARN_ON(!host->data); ++ ++ if (!host->data) ++ return; ++ ++ if (host->blocks == 0) ++ return; ++ ++ dma_chan = host->dma_chan_rxtx; ++ if (host->data->flags & MMC_DATA_READ) { ++ dir_data = DMA_FROM_DEVICE; ++ dir_slave = DMA_DEV_TO_MEM; ++ } else { ++ dir_data = DMA_TO_DEVICE; ++ dir_slave = DMA_MEM_TO_DEV; ++ } ++ ++ /* The parameters have already been validated, so this will not fail */ ++ (void)dmaengine_slave_config(dma_chan, ++ (dir_data == DMA_FROM_DEVICE) ? ++ &host->dma_cfg_rx : ++ &host->dma_cfg_tx); ++ ++ BUG_ON(!dma_chan->device); ++ BUG_ON(!dma_chan->device->dev); ++ BUG_ON(!host->data->sg); ++ ++ len = dma_map_sg(dma_chan->device->dev, host->data->sg, ++ host->data->sg_len, dir_data); ++ if (len > 0) { ++ desc = dmaengine_prep_slave_sg(dma_chan, host->data->sg, ++ len, dir_slave, ++ DMA_PREP_INTERRUPT | DMA_CTRL_ACK); ++ } else { ++ dev_err(mmc_dev(host->mmc), "dma_map_sg returned zero length\n"); ++ } ++ if (desc) { ++ unsigned long flags; ++ spin_lock_irqsave(&host->lock, flags); ++ bcm2835_mmc_unsignal_irqs(host, SDHCI_INT_DATA_AVAIL | ++ SDHCI_INT_SPACE_AVAIL); ++ host->tx_desc = desc; ++ desc->callback = bcm2835_mmc_dma_complete; ++ desc->callback_param = host; ++ spin_unlock_irqrestore(&host->lock, flags); ++ dmaengine_submit(desc); ++ dma_async_issue_pending(dma_chan); ++ } ++ ++} ++ ++ ++ ++static void bcm2835_mmc_set_transfer_irqs(struct bcm2835_host *host) ++{ ++ u32 pio_irqs = SDHCI_INT_DATA_AVAIL | SDHCI_INT_SPACE_AVAIL; ++ u32 dma_irqs = SDHCI_INT_DMA_END | SDHCI_INT_ADMA_ERROR; ++ ++ if (host->use_dma) ++ host->ier = (host->ier & ~pio_irqs) | dma_irqs; ++ else ++ host->ier = (host->ier & ~dma_irqs) | pio_irqs; ++ ++ bcm2835_mmc_writel(host, host->ier, SDHCI_INT_ENABLE, 4); ++ bcm2835_mmc_writel(host, host->ier, SDHCI_SIGNAL_ENABLE, 4); ++} ++ ++ ++static void bcm2835_mmc_prepare_data(struct bcm2835_host *host, struct mmc_command *cmd) ++{ ++ u8 count; ++ struct mmc_data *data = cmd->data; ++ ++ WARN_ON(host->data); ++ ++ if (data || (cmd->flags & MMC_RSP_BUSY)) { ++ count = TIMEOUT_VAL; ++ bcm2835_mmc_writeb(host, count, SDHCI_TIMEOUT_CONTROL); ++ } ++ ++ if (!data) ++ return; ++ ++ /* Sanity checks */ ++ BUG_ON(data->blksz * data->blocks > 524288); ++ BUG_ON(data->blksz > host->mmc->max_blk_size); ++ BUG_ON(data->blocks > 65535); ++ ++ host->data = data; ++ host->data_early = 0; ++ host->data->bytes_xfered = 0; ++ ++ ++ if (!(host->flags & SDHCI_REQ_USE_DMA)) { ++ int flags; ++ ++ flags = SG_MITER_ATOMIC; ++ if (host->data->flags & MMC_DATA_READ) ++ flags |= SG_MITER_TO_SG; ++ else ++ flags |= SG_MITER_FROM_SG; ++ sg_miter_start(&host->sg_miter, data->sg, data->sg_len, flags); ++ host->blocks = data->blocks; ++ } ++ ++ host->use_dma = host->have_dma && data->blocks > PIO_DMA_BARRIER; ++ ++ bcm2835_mmc_set_transfer_irqs(host); ++ ++ /* Set the DMA boundary value and block size */ ++ bcm2835_mmc_writew(host, SDHCI_MAKE_BLKSZ(SDHCI_DEFAULT_BOUNDARY_ARG, ++ data->blksz), SDHCI_BLOCK_SIZE); ++ bcm2835_mmc_writew(host, data->blocks, SDHCI_BLOCK_COUNT); ++ ++ BUG_ON(!host->data); ++} ++ ++static void bcm2835_mmc_set_transfer_mode(struct bcm2835_host *host, ++ struct mmc_command *cmd) ++{ ++ u16 mode; ++ struct mmc_data *data = cmd->data; ++ ++ if (data == NULL) { ++ /* clear Auto CMD settings for no data CMDs */ ++ mode = bcm2835_mmc_readw(host, SDHCI_TRANSFER_MODE); ++ bcm2835_mmc_writew(host, mode & ~(SDHCI_TRNS_AUTO_CMD12 | ++ SDHCI_TRNS_AUTO_CMD23), SDHCI_TRANSFER_MODE); ++ return; ++ } ++ ++ WARN_ON(!host->data); ++ ++ mode = SDHCI_TRNS_BLK_CNT_EN; ++ ++ if ((mmc_op_multi(cmd->opcode) || data->blocks > 1)) { ++ mode |= SDHCI_TRNS_MULTI; ++ ++ /* ++ * If we are sending CMD23, CMD12 never gets sent ++ * on successful completion (so no Auto-CMD12). ++ */ ++ if (!host->mrq->sbc && (host->flags & SDHCI_AUTO_CMD12)) ++ mode |= SDHCI_TRNS_AUTO_CMD12; ++ else if (host->mrq->sbc && (host->flags & SDHCI_AUTO_CMD23)) { ++ mode |= SDHCI_TRNS_AUTO_CMD23; ++ bcm2835_mmc_writel(host, host->mrq->sbc->arg, SDHCI_ARGUMENT2, 5); ++ } ++ } ++ ++ if (data->flags & MMC_DATA_READ) ++ mode |= SDHCI_TRNS_READ; ++ if (host->flags & SDHCI_REQ_USE_DMA) ++ mode |= SDHCI_TRNS_DMA; ++ ++ bcm2835_mmc_writew(host, mode, SDHCI_TRANSFER_MODE); ++} ++ ++void bcm2835_mmc_send_command(struct bcm2835_host *host, struct mmc_command *cmd) ++{ ++ int flags; ++ u32 mask; ++ unsigned long timeout; ++ ++ WARN_ON(host->cmd); ++ ++ /* Wait max 10 ms */ ++ timeout = 1000; ++ ++ mask = SDHCI_CMD_INHIBIT; ++ if ((cmd->data != NULL) || (cmd->flags & MMC_RSP_BUSY)) ++ mask |= SDHCI_DATA_INHIBIT; ++ ++ /* We shouldn't wait for data inihibit for stop commands, even ++ though they might use busy signaling */ ++ if (host->mrq->data && (cmd == host->mrq->data->stop)) ++ mask &= ~SDHCI_DATA_INHIBIT; ++ ++ while (bcm2835_mmc_readl(host, SDHCI_PRESENT_STATE) & mask) { ++ if (timeout == 0) { ++ pr_err("%s: Controller never released inhibit bit(s).\n", ++ mmc_hostname(host->mmc)); ++ bcm2835_mmc_dumpregs(host); ++ cmd->error = -EIO; ++ tasklet_schedule(&host->finish_tasklet); ++ return; ++ } ++ timeout--; ++ udelay(10); ++ } ++ ++ if ((1000-timeout)/100 > 1 && (1000-timeout)/100 > host->max_delay) { ++ host->max_delay = (1000-timeout)/100; ++ pr_warning("Warning: MMC controller hung for %d ms\n", host->max_delay); ++ } ++ ++ timeout = jiffies; ++ if (!cmd->data && cmd->busy_timeout > 9000) ++ timeout += DIV_ROUND_UP(cmd->busy_timeout, 1000) * HZ + HZ; ++ else ++ timeout += 10 * HZ; ++ mod_timer(&host->timer, timeout); ++ ++ host->cmd = cmd; ++ ++ bcm2835_mmc_prepare_data(host, cmd); ++ ++ bcm2835_mmc_writel(host, cmd->arg, SDHCI_ARGUMENT, 6); ++ ++ bcm2835_mmc_set_transfer_mode(host, cmd); ++ ++ if ((cmd->flags & MMC_RSP_136) && (cmd->flags & MMC_RSP_BUSY)) { ++ pr_err("%s: Unsupported response type!\n", ++ mmc_hostname(host->mmc)); ++ cmd->error = -EINVAL; ++ tasklet_schedule(&host->finish_tasklet); ++ return; ++ } ++ ++ if (!(cmd->flags & MMC_RSP_PRESENT)) ++ flags = SDHCI_CMD_RESP_NONE; ++ else if (cmd->flags & MMC_RSP_136) ++ flags = SDHCI_CMD_RESP_LONG; ++ else if (cmd->flags & MMC_RSP_BUSY) ++ flags = SDHCI_CMD_RESP_SHORT_BUSY; ++ else ++ flags = SDHCI_CMD_RESP_SHORT; ++ ++ if (cmd->flags & MMC_RSP_CRC) ++ flags |= SDHCI_CMD_CRC; ++ if (cmd->flags & MMC_RSP_OPCODE) ++ flags |= SDHCI_CMD_INDEX; ++ ++ if (cmd->data) ++ flags |= SDHCI_CMD_DATA; ++ ++ bcm2835_mmc_writew(host, SDHCI_MAKE_CMD(cmd->opcode, flags), SDHCI_COMMAND); ++} ++ ++ ++static void bcm2835_mmc_finish_data(struct bcm2835_host *host) ++{ ++ struct mmc_data *data; ++ ++ BUG_ON(!host->data); ++ ++ data = host->data; ++ host->data = NULL; ++ ++ if (data->error) ++ data->bytes_xfered = 0; ++ else ++ data->bytes_xfered = data->blksz * data->blocks; ++ ++ /* ++ * Need to send CMD12 if - ++ * a) open-ended multiblock transfer (no CMD23) ++ * b) error in multiblock transfer ++ */ ++ if (data->stop && ++ (data->error || ++ !host->mrq->sbc)) { ++ ++ /* ++ * The controller needs a reset of internal state machines ++ * upon error conditions. ++ */ ++ if (data->error) { ++ bcm2835_mmc_reset(host, SDHCI_RESET_CMD); ++ bcm2835_mmc_reset(host, SDHCI_RESET_DATA); ++ } ++ ++ bcm2835_mmc_send_command(host, data->stop); ++ } else ++ tasklet_schedule(&host->finish_tasklet); ++} ++ ++static void bcm2835_mmc_finish_command(struct bcm2835_host *host) ++{ ++ int i; ++ ++ BUG_ON(host->cmd == NULL); ++ ++ if (host->cmd->flags & MMC_RSP_PRESENT) { ++ if (host->cmd->flags & MMC_RSP_136) { ++ /* CRC is stripped so we need to do some shifting. */ ++ for (i = 0; i < 4; i++) { ++ host->cmd->resp[i] = bcm2835_mmc_readl(host, ++ SDHCI_RESPONSE + (3-i)*4) << 8; ++ if (i != 3) ++ host->cmd->resp[i] |= ++ bcm2835_mmc_readb(host, ++ SDHCI_RESPONSE + (3-i)*4-1); ++ } ++ } else { ++ host->cmd->resp[0] = bcm2835_mmc_readl(host, SDHCI_RESPONSE); ++ } ++ } ++ ++ host->cmd->error = 0; ++ ++ /* Finished CMD23, now send actual command. */ ++ if (host->cmd == host->mrq->sbc) { ++ host->cmd = NULL; ++ bcm2835_mmc_send_command(host, host->mrq->cmd); ++ ++ if (host->mrq->cmd->data && host->use_dma) { ++ /* DMA transfer starts now, PIO starts after interrupt */ ++ bcm2835_mmc_transfer_dma(host); ++ } ++ } else { ++ ++ /* Processed actual command. */ ++ if (host->data && host->data_early) ++ bcm2835_mmc_finish_data(host); ++ ++ if (!host->cmd->data) ++ tasklet_schedule(&host->finish_tasklet); ++ ++ host->cmd = NULL; ++ } ++} ++ ++ ++static void bcm2835_mmc_timeout_timer(unsigned long data) ++{ ++ struct bcm2835_host *host; ++ unsigned long flags; ++ ++ host = (struct bcm2835_host *)data; ++ ++ spin_lock_irqsave(&host->lock, flags); ++ ++ if (host->mrq) { ++ pr_err("%s: Timeout waiting for hardware interrupt.\n", ++ mmc_hostname(host->mmc)); ++ bcm2835_mmc_dumpregs(host); ++ ++ if (host->data) { ++ host->data->error = -ETIMEDOUT; ++ bcm2835_mmc_finish_data(host); ++ } else { ++ if (host->cmd) ++ host->cmd->error = -ETIMEDOUT; ++ else ++ host->mrq->cmd->error = -ETIMEDOUT; ++ ++ tasklet_schedule(&host->finish_tasklet); ++ } ++ } ++ ++ mmiowb(); ++ spin_unlock_irqrestore(&host->lock, flags); ++} ++ ++ ++static void bcm2835_mmc_enable_sdio_irq_nolock(struct bcm2835_host *host, int enable) ++{ ++ if (!(host->flags & SDHCI_DEVICE_DEAD)) { ++ if (enable) ++ host->ier |= SDHCI_INT_CARD_INT; ++ else ++ host->ier &= ~SDHCI_INT_CARD_INT; ++ ++ bcm2835_mmc_writel(host, host->ier, SDHCI_INT_ENABLE, 7); ++ bcm2835_mmc_writel(host, host->ier, SDHCI_SIGNAL_ENABLE, 7); ++ mmiowb(); ++ } ++} ++ ++static void bcm2835_mmc_enable_sdio_irq(struct mmc_host *mmc, int enable) ++{ ++ struct bcm2835_host *host = mmc_priv(mmc); ++ unsigned long flags; ++ ++ spin_lock_irqsave(&host->lock, flags); ++ if (enable) ++ host->flags |= SDHCI_SDIO_IRQ_ENABLED; ++ else ++ host->flags &= ~SDHCI_SDIO_IRQ_ENABLED; ++ ++ bcm2835_mmc_enable_sdio_irq_nolock(host, enable); ++ spin_unlock_irqrestore(&host->lock, flags); ++} ++ ++static void bcm2835_mmc_cmd_irq(struct bcm2835_host *host, u32 intmask) ++{ ++ ++ BUG_ON(intmask == 0); ++ ++ if (!host->cmd) { ++ pr_err("%s: Got command interrupt 0x%08x even " ++ "though no command operation was in progress.\n", ++ mmc_hostname(host->mmc), (unsigned)intmask); ++ bcm2835_mmc_dumpregs(host); ++ return; ++ } ++ ++ if (intmask & SDHCI_INT_TIMEOUT) ++ host->cmd->error = -ETIMEDOUT; ++ else if (intmask & (SDHCI_INT_CRC | SDHCI_INT_END_BIT | ++ SDHCI_INT_INDEX)) { ++ host->cmd->error = -EILSEQ; ++ } ++ ++ if (host->cmd->error) { ++ tasklet_schedule(&host->finish_tasklet); ++ return; ++ } ++ ++ if (intmask & SDHCI_INT_RESPONSE) ++ bcm2835_mmc_finish_command(host); ++ ++} ++ ++static void bcm2835_mmc_data_irq(struct bcm2835_host *host, u32 intmask) ++{ ++ struct dma_chan *dma_chan; ++ u32 dir_data; ++ ++ BUG_ON(intmask == 0); ++ ++ if (!host->data) { ++ /* ++ * The "data complete" interrupt is also used to ++ * indicate that a busy state has ended. See comment ++ * above in sdhci_cmd_irq(). ++ */ ++ if (host->cmd && (host->cmd->flags & MMC_RSP_BUSY)) { ++ if (intmask & SDHCI_INT_DATA_END) { ++ bcm2835_mmc_finish_command(host); ++ return; ++ } ++ } ++ ++ pr_debug("%s: Got data interrupt 0x%08x even " ++ "though no data operation was in progress.\n", ++ mmc_hostname(host->mmc), (unsigned)intmask); ++ bcm2835_mmc_dumpregs(host); ++ ++ return; ++ } ++ ++ if (intmask & SDHCI_INT_DATA_TIMEOUT) ++ host->data->error = -ETIMEDOUT; ++ else if (intmask & SDHCI_INT_DATA_END_BIT) ++ host->data->error = -EILSEQ; ++ else if ((intmask & SDHCI_INT_DATA_CRC) && ++ SDHCI_GET_CMD(bcm2835_mmc_readw(host, SDHCI_COMMAND)) ++ != MMC_BUS_TEST_R) ++ host->data->error = -EILSEQ; ++ ++ if (host->use_dma) { ++ if (host->data->flags & MMC_DATA_WRITE) { ++ /* IRQ handled here */ ++ ++ dma_chan = host->dma_chan_rxtx; ++ dir_data = DMA_TO_DEVICE; ++ dma_unmap_sg(dma_chan->device->dev, ++ host->data->sg, host->data->sg_len, ++ dir_data); ++ ++ bcm2835_mmc_finish_data(host); ++ } ++ ++ } else { ++ if (host->data->error) ++ bcm2835_mmc_finish_data(host); ++ else { ++ if (intmask & (SDHCI_INT_DATA_AVAIL | SDHCI_INT_SPACE_AVAIL)) ++ bcm2835_mmc_transfer_pio(host); ++ ++ if (intmask & SDHCI_INT_DATA_END) { ++ if (host->cmd) { ++ /* ++ * Data managed to finish before the ++ * command completed. Make sure we do ++ * things in the proper order. ++ */ ++ host->data_early = 1; ++ } else { ++ bcm2835_mmc_finish_data(host); ++ } ++ } ++ } ++ } ++} ++ ++ ++static irqreturn_t bcm2835_mmc_irq(int irq, void *dev_id) ++{ ++ irqreturn_t result = IRQ_NONE; ++ struct bcm2835_host *host = dev_id; ++ u32 intmask, mask, unexpected = 0; ++ int max_loops = 16; ++ ++ spin_lock(&host->lock); ++ ++ intmask = bcm2835_mmc_readl(host, SDHCI_INT_STATUS); ++ ++ if (!intmask || intmask == 0xffffffff) { ++ result = IRQ_NONE; ++ goto out; ++ } ++ ++ do { ++ /* Clear selected interrupts. */ ++ mask = intmask & (SDHCI_INT_CMD_MASK | SDHCI_INT_DATA_MASK | ++ SDHCI_INT_BUS_POWER); ++ bcm2835_mmc_writel(host, mask, SDHCI_INT_STATUS, 8); ++ ++ ++ if (intmask & SDHCI_INT_CMD_MASK) ++ bcm2835_mmc_cmd_irq(host, intmask & SDHCI_INT_CMD_MASK); ++ ++ if (intmask & SDHCI_INT_DATA_MASK) ++ bcm2835_mmc_data_irq(host, intmask & SDHCI_INT_DATA_MASK); ++ ++ if (intmask & SDHCI_INT_BUS_POWER) ++ pr_err("%s: Card is consuming too much power!\n", ++ mmc_hostname(host->mmc)); ++ ++ if (intmask & SDHCI_INT_CARD_INT) { ++ bcm2835_mmc_enable_sdio_irq_nolock(host, false); ++ host->thread_isr |= SDHCI_INT_CARD_INT; ++ result = IRQ_WAKE_THREAD; ++ } ++ ++ intmask &= ~(SDHCI_INT_CARD_INSERT | SDHCI_INT_CARD_REMOVE | ++ SDHCI_INT_CMD_MASK | SDHCI_INT_DATA_MASK | ++ SDHCI_INT_ERROR | SDHCI_INT_BUS_POWER | ++ SDHCI_INT_CARD_INT); ++ ++ if (intmask) { ++ unexpected |= intmask; ++ bcm2835_mmc_writel(host, intmask, SDHCI_INT_STATUS, 9); ++ } ++ ++ if (result == IRQ_NONE) ++ result = IRQ_HANDLED; ++ ++ intmask = bcm2835_mmc_readl(host, SDHCI_INT_STATUS); ++ } while (intmask && --max_loops); ++out: ++ spin_unlock(&host->lock); ++ ++ if (unexpected) { ++ pr_err("%s: Unexpected interrupt 0x%08x.\n", ++ mmc_hostname(host->mmc), unexpected); ++ bcm2835_mmc_dumpregs(host); ++ } ++ ++ return result; ++} ++ ++static irqreturn_t bcm2835_mmc_thread_irq(int irq, void *dev_id) ++{ ++ struct bcm2835_host *host = dev_id; ++ unsigned long flags; ++ u32 isr; ++ ++ spin_lock_irqsave(&host->lock, flags); ++ isr = host->thread_isr; ++ host->thread_isr = 0; ++ spin_unlock_irqrestore(&host->lock, flags); ++ ++ if (isr & SDHCI_INT_CARD_INT) { ++ sdio_run_irqs(host->mmc); ++ ++ spin_lock_irqsave(&host->lock, flags); ++ if (host->flags & SDHCI_SDIO_IRQ_ENABLED) ++ bcm2835_mmc_enable_sdio_irq_nolock(host, true); ++ spin_unlock_irqrestore(&host->lock, flags); ++ } ++ ++ return isr ? IRQ_HANDLED : IRQ_NONE; ++} ++ ++ ++ ++void bcm2835_mmc_set_clock(struct bcm2835_host *host, unsigned int clock) ++{ ++ int div = 0; /* Initialized for compiler warning */ ++ int real_div = div, clk_mul = 1; ++ u16 clk = 0; ++ unsigned long timeout; ++ unsigned int input_clock = clock; ++ ++ if (host->overclock_50 && (clock == 50000000)) ++ clock = host->overclock_50 * 1000000 + 999999; ++ ++ host->mmc->actual_clock = 0; ++ ++ bcm2835_mmc_writew(host, 0, SDHCI_CLOCK_CONTROL); ++ ++ if (clock == 0) ++ return; ++ ++ /* Version 3.00 divisors must be a multiple of 2. */ ++ if (host->max_clk <= clock) ++ div = 1; ++ else { ++ for (div = 2; div < SDHCI_MAX_DIV_SPEC_300; ++ div += 2) { ++ if ((host->max_clk / div) <= clock) ++ break; ++ } ++ } ++ ++ real_div = div; ++ div >>= 1; ++ ++ if (real_div) ++ clock = (host->max_clk * clk_mul) / real_div; ++ host->mmc->actual_clock = clock; ++ ++ if ((clock > input_clock) && (clock > host->max_overclock)) { ++ pr_warn("%s: Overclocking to %dHz\n", ++ mmc_hostname(host->mmc), clock); ++ host->max_overclock = clock; ++ } ++ ++ clk |= (div & SDHCI_DIV_MASK) << SDHCI_DIVIDER_SHIFT; ++ clk |= ((div & SDHCI_DIV_HI_MASK) >> SDHCI_DIV_MASK_LEN) ++ << SDHCI_DIVIDER_HI_SHIFT; ++ clk |= SDHCI_CLOCK_INT_EN; ++ bcm2835_mmc_writew(host, clk, SDHCI_CLOCK_CONTROL); ++ ++ /* Wait max 20 ms */ ++ timeout = 20; ++ while (!((clk = bcm2835_mmc_readw(host, SDHCI_CLOCK_CONTROL)) ++ & SDHCI_CLOCK_INT_STABLE)) { ++ if (timeout == 0) { ++ pr_err("%s: Internal clock never " ++ "stabilised.\n", mmc_hostname(host->mmc)); ++ bcm2835_mmc_dumpregs(host); ++ return; ++ } ++ timeout--; ++ mdelay(1); ++ } ++ ++ if (20-timeout > 10 && 20-timeout > host->max_delay) { ++ host->max_delay = 20-timeout; ++ pr_warning("Warning: MMC controller hung for %d ms\n", host->max_delay); ++ } ++ ++ clk |= SDHCI_CLOCK_CARD_EN; ++ bcm2835_mmc_writew(host, clk, SDHCI_CLOCK_CONTROL); ++} ++ ++static void bcm2835_mmc_request(struct mmc_host *mmc, struct mmc_request *mrq) ++{ ++ struct bcm2835_host *host; ++ unsigned long flags; ++ ++ host = mmc_priv(mmc); ++ ++ spin_lock_irqsave(&host->lock, flags); ++ ++ WARN_ON(host->mrq != NULL); ++ ++ host->mrq = mrq; ++ ++ if (mrq->sbc && !(host->flags & SDHCI_AUTO_CMD23)) ++ bcm2835_mmc_send_command(host, mrq->sbc); ++ else ++ bcm2835_mmc_send_command(host, mrq->cmd); ++ ++ mmiowb(); ++ spin_unlock_irqrestore(&host->lock, flags); ++ ++ if (!(mrq->sbc && !(host->flags & SDHCI_AUTO_CMD23)) && mrq->cmd->data && host->use_dma) { ++ /* DMA transfer starts now, PIO starts after interrupt */ ++ bcm2835_mmc_transfer_dma(host); ++ } ++} ++ ++ ++static void bcm2835_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) ++{ ++ ++ struct bcm2835_host *host = mmc_priv(mmc); ++ unsigned long flags; ++ u8 ctrl; ++ u16 clk, ctrl_2; ++ ++ pr_debug("bcm2835_mmc_set_ios: clock %d, pwr %d, bus_width %d, timing %d, vdd %d, drv_type %d\n", ++ ios->clock, ios->power_mode, ios->bus_width, ++ ios->timing, ios->signal_voltage, ios->drv_type); ++ ++ spin_lock_irqsave(&host->lock, flags); ++ ++ if (!ios->clock || ios->clock != host->clock) { ++ bcm2835_mmc_set_clock(host, ios->clock); ++ host->clock = ios->clock; ++ } ++ ++ if (host->pwr != SDHCI_POWER_330) { ++ host->pwr = SDHCI_POWER_330; ++ bcm2835_mmc_writeb(host, SDHCI_POWER_330 | SDHCI_POWER_ON, SDHCI_POWER_CONTROL); ++ } ++ ++ ctrl = bcm2835_mmc_readb(host, SDHCI_HOST_CONTROL); ++ ++ /* set bus width */ ++ ctrl &= ~SDHCI_CTRL_8BITBUS; ++ if (ios->bus_width == MMC_BUS_WIDTH_4) ++ ctrl |= SDHCI_CTRL_4BITBUS; ++ else ++ ctrl &= ~SDHCI_CTRL_4BITBUS; ++ ++ ctrl &= ~SDHCI_CTRL_HISPD; /* NO_HISPD_BIT */ ++ ++ ++ bcm2835_mmc_writeb(host, ctrl, SDHCI_HOST_CONTROL); ++ /* ++ * We only need to set Driver Strength if the ++ * preset value enable is not set. ++ */ ++ ctrl_2 = bcm2835_mmc_readw(host, SDHCI_HOST_CONTROL2); ++ ctrl_2 &= ~SDHCI_CTRL_DRV_TYPE_MASK; ++ if (ios->drv_type == MMC_SET_DRIVER_TYPE_A) ++ ctrl_2 |= SDHCI_CTRL_DRV_TYPE_A; ++ else if (ios->drv_type == MMC_SET_DRIVER_TYPE_C) ++ ctrl_2 |= SDHCI_CTRL_DRV_TYPE_C; ++ ++ bcm2835_mmc_writew(host, ctrl_2, SDHCI_HOST_CONTROL2); ++ ++ /* Reset SD Clock Enable */ ++ clk = bcm2835_mmc_readw(host, SDHCI_CLOCK_CONTROL); ++ clk &= ~SDHCI_CLOCK_CARD_EN; ++ bcm2835_mmc_writew(host, clk, SDHCI_CLOCK_CONTROL); ++ ++ /* Re-enable SD Clock */ ++ bcm2835_mmc_set_clock(host, host->clock); ++ bcm2835_mmc_writeb(host, ctrl, SDHCI_HOST_CONTROL); ++ ++ mmiowb(); ++ ++ spin_unlock_irqrestore(&host->lock, flags); ++} ++ ++ ++static struct mmc_host_ops bcm2835_ops = { ++ .request = bcm2835_mmc_request, ++ .set_ios = bcm2835_mmc_set_ios, ++ .enable_sdio_irq = bcm2835_mmc_enable_sdio_irq, ++}; ++ ++ ++static void bcm2835_mmc_tasklet_finish(unsigned long param) ++{ ++ struct bcm2835_host *host; ++ unsigned long flags; ++ struct mmc_request *mrq; ++ ++ host = (struct bcm2835_host *)param; ++ ++ spin_lock_irqsave(&host->lock, flags); ++ ++ /* ++ * If this tasklet gets rescheduled while running, it will ++ * be run again afterwards but without any active request. ++ */ ++ if (!host->mrq) { ++ spin_unlock_irqrestore(&host->lock, flags); ++ return; ++ } ++ ++ del_timer(&host->timer); ++ ++ mrq = host->mrq; ++ ++ /* ++ * The controller needs a reset of internal state machines ++ * upon error conditions. ++ */ ++ if (!(host->flags & SDHCI_DEVICE_DEAD) && ++ ((mrq->cmd && mrq->cmd->error) || ++ (mrq->data && (mrq->data->error || ++ (mrq->data->stop && mrq->data->stop->error))))) { ++ ++ spin_unlock_irqrestore(&host->lock, flags); ++ bcm2835_mmc_reset(host, SDHCI_RESET_CMD); ++ bcm2835_mmc_reset(host, SDHCI_RESET_DATA); ++ spin_lock_irqsave(&host->lock, flags); ++ } ++ ++ host->mrq = NULL; ++ host->cmd = NULL; ++ host->data = NULL; ++ ++ mmiowb(); ++ ++ spin_unlock_irqrestore(&host->lock, flags); ++ mmc_request_done(host->mmc, mrq); ++} ++ ++ ++ ++static int bcm2835_mmc_add_host(struct bcm2835_host *host) ++{ ++ struct mmc_host *mmc = host->mmc; ++ struct device *dev = mmc->parent; ++#ifndef FORCE_PIO ++ struct dma_slave_config cfg; ++#endif ++ int ret; ++ ++ bcm2835_mmc_reset(host, SDHCI_RESET_ALL); ++ ++ host->clk_mul = 0; ++ ++ mmc->f_max = host->max_clk; ++ mmc->f_max = host->max_clk; ++ mmc->f_min = host->max_clk / SDHCI_MAX_DIV_SPEC_300; ++ ++ /* SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK */ ++ host->timeout_clk = mmc->f_max / 1000; ++ mmc->max_busy_timeout = (1 << 27) / host->timeout_clk; ++ ++ /* host controller capabilities */ ++ mmc->caps |= MMC_CAP_CMD23 | MMC_CAP_ERASE | MMC_CAP_NEEDS_POLL | ++ MMC_CAP_SDIO_IRQ | MMC_CAP_SD_HIGHSPEED | ++ MMC_CAP_MMC_HIGHSPEED; ++ ++ mmc->caps2 |= MMC_CAP2_SDIO_IRQ_NOTHREAD; ++ ++ host->flags = SDHCI_AUTO_CMD23; ++ ++ dev_info(dev, "mmc_debug:%x mmc_debug2:%x\n", mmc_debug, mmc_debug2); ++#ifdef FORCE_PIO ++ dev_info(dev, "Forcing PIO mode\n"); ++ host->have_dma = false; ++#else ++ if (IS_ERR_OR_NULL(host->dma_chan_rxtx)) { ++ dev_err(dev, "%s: Unable to initialise DMA channel. Falling back to PIO\n", ++ DRIVER_NAME); ++ host->have_dma = false; ++ } else { ++ dev_info(dev, "DMA channel allocated"); ++ ++ cfg.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; ++ cfg.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; ++ cfg.slave_id = 11; /* DREQ channel */ ++ ++ /* Validate the slave configurations */ ++ ++ cfg.direction = DMA_MEM_TO_DEV; ++ cfg.src_addr = 0; ++ cfg.dst_addr = host->bus_addr + SDHCI_BUFFER; ++ ++ ret = dmaengine_slave_config(host->dma_chan_rxtx, &cfg); ++ ++ if (ret == 0) { ++ host->dma_cfg_tx = cfg; ++ ++ cfg.direction = DMA_DEV_TO_MEM; ++ cfg.src_addr = host->bus_addr + SDHCI_BUFFER; ++ cfg.dst_addr = 0; ++ ++ ret = dmaengine_slave_config(host->dma_chan_rxtx, &cfg); ++ } ++ ++ if (ret == 0) { ++ host->dma_cfg_rx = cfg; ++ ++ host->use_dma = true; ++ } else { ++ pr_err("%s: unable to configure DMA channel. " ++ "Faling back to PIO\n", ++ mmc_hostname(mmc)); ++ dma_release_channel(host->dma_chan_rxtx); ++ host->dma_chan_rxtx = NULL; ++ host->use_dma = false; ++ } ++ } ++#endif ++ mmc->max_segs = 128; ++ mmc->max_req_size = 524288; ++ mmc->max_seg_size = mmc->max_req_size; ++ mmc->max_blk_size = 512; ++ mmc->max_blk_count = 65535; ++ ++ /* report supported voltage ranges */ ++ mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34; ++ ++ tasklet_init(&host->finish_tasklet, ++ bcm2835_mmc_tasklet_finish, (unsigned long)host); ++ ++ setup_timer(&host->timer, bcm2835_mmc_timeout_timer, (unsigned long)host); ++ init_waitqueue_head(&host->buf_ready_int); ++ ++ bcm2835_mmc_init(host, 0); ++ ret = devm_request_threaded_irq(dev, host->irq, bcm2835_mmc_irq, ++ bcm2835_mmc_thread_irq, IRQF_SHARED, ++ mmc_hostname(mmc), host); ++ if (ret) { ++ dev_err(dev, "Failed to request IRQ %d: %d\n", host->irq, ret); ++ goto untasklet; ++ } ++ ++ mmiowb(); ++ mmc_add_host(mmc); ++ ++ return 0; ++ ++untasklet: ++ tasklet_kill(&host->finish_tasklet); ++ ++ return ret; ++} ++ ++static int bcm2835_mmc_probe(struct platform_device *pdev) ++{ ++ struct device *dev = &pdev->dev; ++ struct device_node *node = dev->of_node; ++ struct clk *clk; ++ struct resource *iomem; ++ struct bcm2835_host *host; ++ struct mmc_host *mmc; ++ const __be32 *addr; ++ int ret; ++ ++ mmc = mmc_alloc_host(sizeof(*host), dev); ++ if (!mmc) ++ return -ENOMEM; ++ ++ mmc->ops = &bcm2835_ops; ++ host = mmc_priv(mmc); ++ host->mmc = mmc; ++ host->timeout = msecs_to_jiffies(1000); ++ spin_lock_init(&host->lock); ++ ++ iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0); ++ host->ioaddr = devm_ioremap_resource(dev, iomem); ++ if (IS_ERR(host->ioaddr)) { ++ ret = PTR_ERR(host->ioaddr); ++ goto err; ++ } ++ ++ addr = of_get_address(node, 0, NULL, NULL); ++ if (!addr) { ++ dev_err(dev, "could not get DMA-register address\n"); ++ return -ENODEV; ++ } ++ host->bus_addr = be32_to_cpup(addr); ++ pr_debug(" - ioaddr %lx, iomem->start %lx, bus_addr %lx\n", ++ (unsigned long)host->ioaddr, ++ (unsigned long)iomem->start, ++ (unsigned long)host->bus_addr); ++ ++#ifndef FORCE_PIO ++ if (node) { ++ host->dma_chan_rxtx = dma_request_slave_channel(dev, "rx-tx"); ++ if (!host->dma_chan_rxtx) ++ host->dma_chan_rxtx = ++ dma_request_slave_channel(dev, "tx"); ++ if (!host->dma_chan_rxtx) ++ host->dma_chan_rxtx = ++ dma_request_slave_channel(dev, "rx"); ++ } else { ++ dma_cap_mask_t mask; ++ ++ dma_cap_zero(mask); ++ /* we don't care about the channel, any would work */ ++ dma_cap_set(DMA_SLAVE, mask); ++ host->dma_chan_rxtx = dma_request_channel(mask, NULL, NULL); ++ } ++#endif ++ clk = devm_clk_get(dev, NULL); ++ if (IS_ERR(clk)) { ++ dev_err(dev, "could not get clk\n"); ++ ret = PTR_ERR(clk); ++ goto err; ++ } ++ ++ host->max_clk = clk_get_rate(clk); ++ ++ host->irq = platform_get_irq(pdev, 0); ++ if (host->irq <= 0) { ++ dev_err(dev, "get IRQ failed\n"); ++ ret = -EINVAL; ++ goto err; ++ } ++ ++ if (node) { ++ mmc_of_parse(mmc); ++ ++ /* Read any custom properties */ ++ of_property_read_u32(node, ++ "brcm,overclock-50", ++ &host->overclock_50); ++ } else { ++ mmc->caps |= MMC_CAP_4_BIT_DATA; ++ } ++ ++ ret = bcm2835_mmc_add_host(host); ++ if (ret) ++ goto err; ++ ++ platform_set_drvdata(pdev, host); ++ ++ return 0; ++err: ++ mmc_free_host(mmc); ++ ++ return ret; ++} ++ ++static int bcm2835_mmc_remove(struct platform_device *pdev) ++{ ++ struct bcm2835_host *host = platform_get_drvdata(pdev); ++ unsigned long flags; ++ int dead; ++ u32 scratch; ++ ++ dead = 0; ++ scratch = bcm2835_mmc_readl(host, SDHCI_INT_STATUS); ++ if (scratch == (u32)-1) ++ dead = 1; ++ ++ ++ if (dead) { ++ spin_lock_irqsave(&host->lock, flags); ++ ++ host->flags |= SDHCI_DEVICE_DEAD; ++ ++ if (host->mrq) { ++ pr_err("%s: Controller removed during " ++ " transfer!\n", mmc_hostname(host->mmc)); ++ ++ host->mrq->cmd->error = -ENOMEDIUM; ++ tasklet_schedule(&host->finish_tasklet); ++ } ++ ++ spin_unlock_irqrestore(&host->lock, flags); ++ } ++ ++ mmc_remove_host(host->mmc); ++ ++ if (!dead) ++ bcm2835_mmc_reset(host, SDHCI_RESET_ALL); ++ ++ free_irq(host->irq, host); ++ ++ del_timer_sync(&host->timer); ++ ++ tasklet_kill(&host->finish_tasklet); ++ ++ mmc_free_host(host->mmc); ++ platform_set_drvdata(pdev, NULL); ++ ++ return 0; ++} ++ ++ ++static const struct of_device_id bcm2835_mmc_match[] = { ++ { .compatible = "brcm,bcm2835-mmc" }, ++ { } ++}; ++MODULE_DEVICE_TABLE(of, bcm2835_mmc_match); ++ ++ ++ ++static struct platform_driver bcm2835_mmc_driver = { ++ .probe = bcm2835_mmc_probe, ++ .remove = bcm2835_mmc_remove, ++ .driver = { ++ .name = DRIVER_NAME, ++ .owner = THIS_MODULE, ++ .of_match_table = bcm2835_mmc_match, ++ }, ++}; ++module_platform_driver(bcm2835_mmc_driver); ++ ++module_param(mmc_debug, uint, 0644); ++module_param(mmc_debug2, uint, 0644); ++MODULE_ALIAS("platform:mmc-bcm2835"); ++MODULE_DESCRIPTION("BCM2835 SDHCI driver"); ++MODULE_LICENSE("GPL v2"); ++MODULE_AUTHOR("Gellert Weisz"); + +From 56c375164a7120be703d11e3614f78b3e5cb784d Mon Sep 17 00:00:00 2001 +From: Phil Elwell <phil@raspberrypi.org> +Date: Wed, 25 Mar 2015 17:49:47 +0000 +Subject: [PATCH 037/112] Adding bcm2835-sdhost driver, and an overlay to + enable it + +BCM2835 has two SD card interfaces. This driver uses the other one. + +bcm2835-sdhost: Error handling fix, and code clarification + +bcm2835-sdhost: Adding overclocking option + +Allow a different clock speed to be substitued for a requested 50MHz. +This option is exposed using the "overclock_50" DT parameter. +Note that the sdhost interface is restricted to integer divisions of +core_freq, and the highest sensible option for a core_freq of 250MHz +is 84 (250/3 = 83.3MHz), the next being 125 (250/2) which is much too +high. + +Use at your own risk. + +bcm2835-sdhost: Round up the overclock, so 62 works for 62.5Mhz + +Also only warn once for each overclock setting. + +bcm2835-sdhost: Improve error handling and recovery + +1) Expose the hw_reset method to the MMC framework, removing many + internal calls by the driver. + +2) Reduce overclock setting on error. + +3) Increase timeout to cope with high capacity cards. + +4) Add properties and parameters to control pio_limit and debug. + +5) Reduce messages at probe time. + +bcm2835-sdhost: Further improve overclock back-off + +bcm2835-sdhost: Clear HBLC for PIO mode + +Also update pio_limit default in overlay README. + +bcm2835-sdhost: Add the ERASE capability + +See: https://github.com/raspberrypi/linux/issues/1076 + +bcm2835-sdhost: Ignore CRC7 for MMC CMD1 + +It seems that the sdhost interface returns CRC7 errors for CMD1, +which is the MMC-specific SEND_OP_COND. Returning these errors to +the MMC layer causes a downward spiral, but ignoring them seems +to be harmless. + +bcm2835-mmc/sdhost: Remove ARCH_BCM2835 differences + +The bcm2835-mmc driver (and -sdhost driver that copied from it) +contains code to handle SDIO interrupts in a threaded interrupt +handler rather than waking the MMC framework thread. The change +follows a patch from Russell King that adds the facility as the +preferred way of working. + +However, the new code path is only present in ARCH_BCM2835 +builds, which I have taken to be a way of testing the waters +rather than making the change across the board; I can't see +any technical reason why it wouldn't be enabled for MACH_BCM270X +builds. So this patch standardises on the ARCH_BCM2835 code, +removing the old code paths. + +bcm2835-sdhost: Don't log timeout errors unless debug=1 + +The MMC card-discovery process generates timeouts. This is +expected behaviour, so reporting it to the user serves no purpose. +Suppress the reporting of timeout errors unless the debug flag +is on. + +bcm2835-sdhost: Add workaround for odd behaviour on some cards + +For reasons not understood, the sdhost driver fails when reading +sectors very near the end of some SD cards. The problem could +be related to the similar issue that reading the final sector +of any card as part of a multiple read never completes, and the +workaround is an extension of the mechanism introduced to solve +that problem which ensures those sectors are always read singly. + +bcm2835-sdhost: Major revision + +This is a significant revision of the bcm2835-sdhost driver. It +improves on the original in a number of ways: + +1) Through the use of CMD23 for reads it appears to avoid problems + reading some sectors on certain high speed cards. +2) Better atomicity to prevent crashes. +3) Higher performance. +4) Activity logging included, for easier diagnosis in the event + of a problem. + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> + +bcm2835-sdhost: Restore ATOMIC flag to PIO sg mapping + +Allocation problems have been seen in a wireless driver, and +this is the only change which might have been responsible. + +SQUASH: bcm2835-sdhost: Only claim one DMA channel + +With both MMC controllers enabled there are few DMA channels left. The +bcm2835-sdhost driver only uses DMA in one direction at a time, so it +doesn't need to claim two channels. + +See: https://github.com/raspberrypi/linux/issues/1327 + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> + +bcm2835-sdhost: Workaround for "slow" sectors + +Some cards have been seen to cause timeouts after certain sectors are +read. This workaround enforces a minimum delay between the stop after +reading one of those sectors and a subsequent data command. + +Using CMD23 (SET_BLOCK_COUNT) avoids this problem, so good cards will +not be penalised by this workaround. + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> + +bcm2835-sdhost: Firmware manages the clock divisor + +The bcm2835-sdhost driver hands control of the CDIV clock divisor +register to matching firmware, allowing it to adjust to a changing +core clock. This removes the need to use the performance governor or +to enable io_is_busy on the on-demand governor in order to get the +best SD performance. + +N.B. As SD clocks must be an integer divisor of the core clock, it is +possible that the SD clock for "turbo" mode can be different (even +lower) than "normal" mode. + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> + +bcm2835-sdhost: Reset the clock in task context + +Since reprogramming the clock can now involve a round-trip to the +firmware it must not be done at atomic context, and a tasklet +is not a task. + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> +--- + drivers/mmc/host/Kconfig | 10 + + drivers/mmc/host/Makefile | 1 + + drivers/mmc/host/bcm2835-sdhost.c | 2158 +++++++++++++++++++++++++++++++++++++ + 3 files changed, 2169 insertions(+) + create mode 100644 drivers/mmc/host/bcm2835-sdhost.c + +diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig +index 0476061..2595474 100644 +--- a/drivers/mmc/host/Kconfig ++++ b/drivers/mmc/host/Kconfig +@@ -33,6 +33,16 @@ config MMC_BCM2835_PIO_DMA_BARRIER + + If unsure, say 2 here. + ++config MMC_BCM2835_SDHOST ++ tristate "Support for the SDHost controller on BCM2708/9" ++ depends on MACH_BCM2708 || MACH_BCM2709 || ARCH_BCM2835 ++ help ++ This selects the SDHost controller on BCM2835/6. ++ ++ If you have a controller with this interface, say Y or M here. ++ ++ If unsure, say N. ++ + config MMC_ARMMMCI + tristate "ARM AMBA Multimedia Card Interface support" + depends on ARM_AMBA +diff --git a/drivers/mmc/host/Makefile b/drivers/mmc/host/Makefile +index 3ba94f0..8daaa94 100644 +--- a/drivers/mmc/host/Makefile ++++ b/drivers/mmc/host/Makefile +@@ -18,6 +18,7 @@ obj-$(CONFIG_MMC_SDHCI_S3C) += sdhci-s3c.o + obj-$(CONFIG_MMC_SDHCI_SIRF) += sdhci-sirf.o + obj-$(CONFIG_MMC_SDHCI_F_SDH30) += sdhci_f_sdh30.o + obj-$(CONFIG_MMC_SDHCI_SPEAR) += sdhci-spear.o ++obj-$(CONFIG_MMC_BCM2835_SDHOST) += bcm2835-sdhost.o + obj-$(CONFIG_MMC_BCM2835) += bcm2835-mmc.o + obj-$(CONFIG_MMC_WBSD) += wbsd.o + obj-$(CONFIG_MMC_AU1X) += au1xmmc.o +diff --git a/drivers/mmc/host/bcm2835-sdhost.c b/drivers/mmc/host/bcm2835-sdhost.c +new file mode 100644 +index 0000000..a57faed +--- /dev/null ++++ b/drivers/mmc/host/bcm2835-sdhost.c +@@ -0,0 +1,2158 @@ ++/* ++ * BCM2835 SD host driver. ++ * ++ * Author: Phil Elwell <phil@raspberrypi.org> ++ * Copyright (C) 2015-2016 Raspberry Pi (Trading) Ltd. ++ * ++ * Based on ++ * mmc-bcm2835.c by Gellert Weisz ++ * which is, in turn, based on ++ * sdhci-bcm2708.c by Broadcom ++ * sdhci-bcm2835.c by Stephen Warren and Oleksandr Tymoshenko ++ * sdhci.c and sdhci-pci.c by Pierre Ossman ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms and conditions of the GNU General Public License, ++ * version 2, as published by the Free Software Foundation. ++ * ++ * This program is distributed in the hope it will be useful, but WITHOUT ++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for ++ * more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program. If not, see <http://www.gnu.org/licenses/>. ++ */ ++ ++#define FIFO_READ_THRESHOLD 4 ++#define FIFO_WRITE_THRESHOLD 4 ++#define ALLOW_CMD23_READ 1 ++#define ALLOW_CMD23_WRITE 0 ++#define ENABLE_LOG 1 ++#define SDDATA_FIFO_PIO_BURST 8 ++#define CMD_DALLY_US 1 ++ ++#include <linux/delay.h> ++#include <linux/module.h> ++#include <linux/io.h> ++#include <linux/mmc/mmc.h> ++#include <linux/mmc/host.h> ++#include <linux/mmc/sd.h> ++#include <linux/scatterlist.h> ++#include <linux/of_address.h> ++#include <linux/of_irq.h> ++#include <linux/clk.h> ++#include <linux/platform_device.h> ++#include <linux/err.h> ++#include <linux/blkdev.h> ++#include <linux/dmaengine.h> ++#include <linux/dma-mapping.h> ++#include <linux/of_dma.h> ++#include <linux/time.h> ++#include <linux/workqueue.h> ++#include <soc/bcm2835/raspberrypi-firmware.h> ++ ++#define DRIVER_NAME "sdhost-bcm2835" ++ ++#define SDCMD 0x00 /* Command to SD card - 16 R/W */ ++#define SDARG 0x04 /* Argument to SD card - 32 R/W */ ++#define SDTOUT 0x08 /* Start value for timeout counter - 32 R/W */ ++#define SDCDIV 0x0c /* Start value for clock divider - 11 R/W */ ++#define SDRSP0 0x10 /* SD card response (31:0) - 32 R */ ++#define SDRSP1 0x14 /* SD card response (63:32) - 32 R */ ++#define SDRSP2 0x18 /* SD card response (95:64) - 32 R */ ++#define SDRSP3 0x1c /* SD card response (127:96) - 32 R */ ++#define SDHSTS 0x20 /* SD host status - 11 R */ ++#define SDVDD 0x30 /* SD card power control - 1 R/W */ ++#define SDEDM 0x34 /* Emergency Debug Mode - 13 R/W */ ++#define SDHCFG 0x38 /* Host configuration - 2 R/W */ ++#define SDHBCT 0x3c /* Host byte count (debug) - 32 R/W */ ++#define SDDATA 0x40 /* Data to/from SD card - 32 R/W */ ++#define SDHBLC 0x50 /* Host block count (SDIO/SDHC) - 9 R/W */ ++ ++#define SDCMD_NEW_FLAG 0x8000 ++#define SDCMD_FAIL_FLAG 0x4000 ++#define SDCMD_BUSYWAIT 0x800 ++#define SDCMD_NO_RESPONSE 0x400 ++#define SDCMD_LONG_RESPONSE 0x200 ++#define SDCMD_WRITE_CMD 0x80 ++#define SDCMD_READ_CMD 0x40 ++#define SDCMD_CMD_MASK 0x3f ++ ++#define SDCDIV_MAX_CDIV 0x7ff ++ ++#define SDHSTS_BUSY_IRPT 0x400 ++#define SDHSTS_BLOCK_IRPT 0x200 ++#define SDHSTS_SDIO_IRPT 0x100 ++#define SDHSTS_REW_TIME_OUT 0x80 ++#define SDHSTS_CMD_TIME_OUT 0x40 ++#define SDHSTS_CRC16_ERROR 0x20 ++#define SDHSTS_CRC7_ERROR 0x10 ++#define SDHSTS_FIFO_ERROR 0x08 ++/* Reserved */ ++/* Reserved */ ++#define SDHSTS_DATA_FLAG 0x01 ++ ++#define SDHSTS_TRANSFER_ERROR_MASK (SDHSTS_CRC7_ERROR|SDHSTS_CRC16_ERROR|SDHSTS_REW_TIME_OUT|SDHSTS_FIFO_ERROR) ++#define SDHSTS_ERROR_MASK (SDHSTS_CMD_TIME_OUT|SDHSTS_TRANSFER_ERROR_MASK) ++ ++#define SDHCFG_BUSY_IRPT_EN (1<<10) ++#define SDHCFG_BLOCK_IRPT_EN (1<<8) ++#define SDHCFG_SDIO_IRPT_EN (1<<5) ++#define SDHCFG_DATA_IRPT_EN (1<<4) ++#define SDHCFG_SLOW_CARD (1<<3) ++#define SDHCFG_WIDE_EXT_BUS (1<<2) ++#define SDHCFG_WIDE_INT_BUS (1<<1) ++#define SDHCFG_REL_CMD_LINE (1<<0) ++ ++#define SDEDM_FORCE_DATA_MODE (1<<19) ++#define SDEDM_CLOCK_PULSE (1<<20) ++#define SDEDM_BYPASS (1<<21) ++ ++#define SDEDM_WRITE_THRESHOLD_SHIFT 9 ++#define SDEDM_READ_THRESHOLD_SHIFT 14 ++#define SDEDM_THRESHOLD_MASK 0x1f ++ ++#define SDEDM_FSM_MASK 0xf ++#define SDEDM_FSM_IDENTMODE 0x0 ++#define SDEDM_FSM_DATAMODE 0x1 ++#define SDEDM_FSM_READDATA 0x2 ++#define SDEDM_FSM_WRITEDATA 0x3 ++#define SDEDM_FSM_READWAIT 0x4 ++#define SDEDM_FSM_READCRC 0x5 ++#define SDEDM_FSM_WRITECRC 0x6 ++#define SDEDM_FSM_WRITEWAIT1 0x7 ++#define SDEDM_FSM_POWERDOWN 0x8 ++#define SDEDM_FSM_POWERUP 0x9 ++#define SDEDM_FSM_WRITESTART1 0xa ++#define SDEDM_FSM_WRITESTART2 0xb ++#define SDEDM_FSM_GENPULSES 0xc ++#define SDEDM_FSM_WRITEWAIT2 0xd ++#define SDEDM_FSM_STARTPOWDOWN 0xf ++ ++#define SDDATA_FIFO_WORDS 16 ++ ++#define USE_CMD23_FLAGS ((ALLOW_CMD23_READ * MMC_DATA_READ) | \ ++ (ALLOW_CMD23_WRITE * MMC_DATA_WRITE)) ++ ++#define MHZ 1000000 ++ ++ ++struct bcm2835_host { ++ spinlock_t lock; ++ ++ void __iomem *ioaddr; ++ u32 bus_addr; ++ ++ struct mmc_host *mmc; ++ ++ u32 pio_timeout; /* In jiffies */ ++ ++ int clock; /* Current clock speed */ ++ ++ bool slow_card; /* Force 11-bit divisor */ ++ ++ unsigned int max_clk; /* Max possible freq */ ++ ++ struct tasklet_struct finish_tasklet; /* Tasklet structures */ ++ ++ struct work_struct cmd_wait_wq; /* Workqueue function */ ++ ++ struct timer_list timer; /* Timer for timeouts */ ++ ++ struct sg_mapping_iter sg_miter; /* SG state for PIO */ ++ unsigned int blocks; /* remaining PIO blocks */ ++ ++ int irq; /* Device IRQ */ ++ ++ u32 cmd_quick_poll_retries; ++ u32 ns_per_fifo_word; ++ ++ /* cached registers */ ++ u32 hcfg; ++ u32 cdiv; ++ ++ struct mmc_request *mrq; /* Current request */ ++ struct mmc_command *cmd; /* Current command */ ++ struct mmc_data *data; /* Current data request */ ++ unsigned int data_complete:1; /* Data finished before cmd */ ++ ++ unsigned int flush_fifo:1; /* Drain the fifo when finishing */ ++ ++ unsigned int use_busy:1; /* Wait for busy interrupt */ ++ ++ unsigned int use_sbc:1; /* Send CMD23 */ ++ ++ unsigned int debug:1; /* Enable debug output */ ++ unsigned int firmware_sets_cdiv:1; /* Let the firmware manage the clock */ ++ unsigned int reset_clock:1; /* Reset the clock fore the next request */ ++ ++ /*DMA part*/ ++ struct dma_chan *dma_chan_rxtx; /* DMA channel for reads and writes */ ++ struct dma_chan *dma_chan; /* Channel in use */ ++ struct dma_slave_config dma_cfg_rx; ++ struct dma_slave_config dma_cfg_tx; ++ struct dma_async_tx_descriptor *dma_desc; ++ u32 dma_dir; ++ u32 drain_words; ++ struct page *drain_page; ++ u32 drain_offset; ++ ++ bool allow_dma; ++ bool use_dma; ++ /*end of DMA part*/ ++ ++ int max_delay; /* maximum length of time spent waiting */ ++ struct timeval stop_time; /* when the last stop was issued */ ++ u32 delay_after_stop; /* minimum time between stop and subsequent data transfer */ ++ u32 delay_after_this_stop; /* minimum time between this stop and subsequent data transfer */ ++ u32 overclock_50; /* frequency to use when 50MHz is requested (in MHz) */ ++ u32 overclock; /* Current frequency if overclocked, else zero */ ++ u32 pio_limit; /* Maximum block count for PIO (0 = always DMA) */ ++ ++ u32 sectors; /* Cached card size in sectors */ ++}; ++ ++#if ENABLE_LOG ++ ++struct log_entry_struct { ++ char event[4]; ++ u32 timestamp; ++ u32 param1; ++ u32 param2; ++}; ++ ++typedef struct log_entry_struct LOG_ENTRY_T; ++ ++LOG_ENTRY_T *sdhost_log_buf; ++dma_addr_t sdhost_log_addr; ++static u32 sdhost_log_idx; ++static spinlock_t log_lock; ++static void __iomem *timer_base; ++ ++#define LOG_ENTRIES (256*1) ++#define LOG_SIZE (sizeof(LOG_ENTRY_T)*LOG_ENTRIES) ++ ++static void log_init(u32 bus_to_phys) ++{ ++ spin_lock_init(&log_lock); ++ sdhost_log_buf = dma_zalloc_coherent(NULL, LOG_SIZE, &sdhost_log_addr, ++ GFP_KERNEL); ++ if (sdhost_log_buf) { ++ pr_info("sdhost: log_buf @ %p (%x)\n", ++ sdhost_log_buf, sdhost_log_addr); ++ timer_base = ioremap_nocache(bus_to_phys + 0x7e003000, SZ_4K); ++ if (!timer_base) ++ pr_err("sdhost: failed to remap timer\n"); ++ } ++ else ++ pr_err("sdhost: failed to allocate log buf\n"); ++} ++ ++static void log_event_impl(const char *event, u32 param1, u32 param2) ++{ ++ if (sdhost_log_buf) { ++ LOG_ENTRY_T *entry; ++ unsigned long flags; ++ ++ spin_lock_irqsave(&log_lock, flags); ++ ++ entry = sdhost_log_buf + sdhost_log_idx; ++ memcpy(entry->event, event, 4); ++ entry->timestamp = (readl(timer_base + 4) & 0x3fffffff) + ++ (smp_processor_id()<<30); ++ entry->param1 = param1; ++ entry->param2 = param2; ++ sdhost_log_idx = (sdhost_log_idx + 1) % LOG_ENTRIES; ++ ++ spin_unlock_irqrestore(&log_lock, flags); ++ } ++} ++ ++static void log_dump(void) ++{ ++ if (sdhost_log_buf) { ++ LOG_ENTRY_T *entry; ++ unsigned long flags; ++ int idx; ++ ++ spin_lock_irqsave(&log_lock, flags); ++ ++ idx = sdhost_log_idx; ++ do { ++ entry = sdhost_log_buf + idx; ++ if (entry->event[0] != '\0') ++ pr_err("[%08x] %.4s %x %x\n", ++ entry->timestamp, ++ entry->event, ++ entry->param1, ++ entry->param2); ++ idx = (idx + 1) % LOG_ENTRIES; ++ } while (idx != sdhost_log_idx); ++ ++ spin_unlock_irqrestore(&log_lock, flags); ++ } ++} ++ ++#define log_event(event, param1, param2) log_event_impl(event, param1, param2) ++ ++#else ++ ++#define log_init(x) (void)0 ++#define log_event(event, param1, param2) (void)0 ++#define log_dump() (void)0 ++ ++#endif ++ ++static inline void bcm2835_sdhost_write(struct bcm2835_host *host, u32 val, int reg) ++{ ++ writel(val, host->ioaddr + reg); ++} ++ ++static inline u32 bcm2835_sdhost_read(struct bcm2835_host *host, int reg) ++{ ++ return readl(host->ioaddr + reg); ++} ++ ++static inline u32 bcm2835_sdhost_read_relaxed(struct bcm2835_host *host, int reg) ++{ ++ return readl_relaxed(host->ioaddr + reg); ++} ++ ++static void bcm2835_sdhost_dumpcmd(struct bcm2835_host *host, ++ struct mmc_command *cmd, ++ const char *label) ++{ ++ if (cmd) ++ pr_err("%s:%c%s op %d arg 0x%x flags 0x%x - resp %08x %08x %08x %08x, err %d\n", ++ mmc_hostname(host->mmc), ++ (cmd == host->cmd) ? '>' : ' ', ++ label, cmd->opcode, cmd->arg, cmd->flags, ++ cmd->resp[0], cmd->resp[1], cmd->resp[2], cmd->resp[3], ++ cmd->error); ++} ++ ++static void bcm2835_sdhost_dumpregs(struct bcm2835_host *host) ++{ ++ if (host->mrq) ++ { ++ bcm2835_sdhost_dumpcmd(host, host->mrq->sbc, "sbc"); ++ bcm2835_sdhost_dumpcmd(host, host->mrq->cmd, "cmd"); ++ if (host->mrq->data) ++ pr_err("%s: data blocks %x blksz %x - err %d\n", ++ mmc_hostname(host->mmc), ++ host->mrq->data->blocks, ++ host->mrq->data->blksz, ++ host->mrq->data->error); ++ bcm2835_sdhost_dumpcmd(host, host->mrq->stop, "stop"); ++ } ++ ++ pr_err("%s: =========== REGISTER DUMP ===========\n", ++ mmc_hostname(host->mmc)); ++ ++ pr_err("%s: SDCMD 0x%08x\n", ++ mmc_hostname(host->mmc), ++ bcm2835_sdhost_read(host, SDCMD)); ++ pr_err("%s: SDARG 0x%08x\n", ++ mmc_hostname(host->mmc), ++ bcm2835_sdhost_read(host, SDARG)); ++ pr_err("%s: SDTOUT 0x%08x\n", ++ mmc_hostname(host->mmc), ++ bcm2835_sdhost_read(host, SDTOUT)); ++ pr_err("%s: SDCDIV 0x%08x\n", ++ mmc_hostname(host->mmc), ++ bcm2835_sdhost_read(host, SDCDIV)); ++ pr_err("%s: SDRSP0 0x%08x\n", ++ mmc_hostname(host->mmc), ++ bcm2835_sdhost_read(host, SDRSP0)); ++ pr_err("%s: SDRSP1 0x%08x\n", ++ mmc_hostname(host->mmc), ++ bcm2835_sdhost_read(host, SDRSP1)); ++ pr_err("%s: SDRSP2 0x%08x\n", ++ mmc_hostname(host->mmc), ++ bcm2835_sdhost_read(host, SDRSP2)); ++ pr_err("%s: SDRSP3 0x%08x\n", ++ mmc_hostname(host->mmc), ++ bcm2835_sdhost_read(host, SDRSP3)); ++ pr_err("%s: SDHSTS 0x%08x\n", ++ mmc_hostname(host->mmc), ++ bcm2835_sdhost_read(host, SDHSTS)); ++ pr_err("%s: SDVDD 0x%08x\n", ++ mmc_hostname(host->mmc), ++ bcm2835_sdhost_read(host, SDVDD)); ++ pr_err("%s: SDEDM 0x%08x\n", ++ mmc_hostname(host->mmc), ++ bcm2835_sdhost_read(host, SDEDM)); ++ pr_err("%s: SDHCFG 0x%08x\n", ++ mmc_hostname(host->mmc), ++ bcm2835_sdhost_read(host, SDHCFG)); ++ pr_err("%s: SDHBCT 0x%08x\n", ++ mmc_hostname(host->mmc), ++ bcm2835_sdhost_read(host, SDHBCT)); ++ pr_err("%s: SDHBLC 0x%08x\n", ++ mmc_hostname(host->mmc), ++ bcm2835_sdhost_read(host, SDHBLC)); ++ ++ pr_err("%s: ===========================================\n", ++ mmc_hostname(host->mmc)); ++} ++ ++static void bcm2835_sdhost_set_power(struct bcm2835_host *host, bool on) ++{ ++ bcm2835_sdhost_write(host, on ? 1 : 0, SDVDD); ++} ++ ++static void bcm2835_sdhost_reset_internal(struct bcm2835_host *host) ++{ ++ u32 temp; ++ ++ if (host->debug) ++ pr_info("%s: reset\n", mmc_hostname(host->mmc)); ++ ++ bcm2835_sdhost_set_power(host, false); ++ ++ bcm2835_sdhost_write(host, 0, SDCMD); ++ bcm2835_sdhost_write(host, 0, SDARG); ++ bcm2835_sdhost_write(host, 0xf00000, SDTOUT); ++ bcm2835_sdhost_write(host, 0, SDCDIV); ++ bcm2835_sdhost_write(host, 0x7f8, SDHSTS); /* Write 1s to clear */ ++ bcm2835_sdhost_write(host, 0, SDHCFG); ++ bcm2835_sdhost_write(host, 0, SDHBCT); ++ bcm2835_sdhost_write(host, 0, SDHBLC); ++ ++ /* Limit fifo usage due to silicon bug */ ++ temp = bcm2835_sdhost_read(host, SDEDM); ++ temp &= ~((SDEDM_THRESHOLD_MASK<<SDEDM_READ_THRESHOLD_SHIFT) | ++ (SDEDM_THRESHOLD_MASK<<SDEDM_WRITE_THRESHOLD_SHIFT)); ++ temp |= (FIFO_READ_THRESHOLD << SDEDM_READ_THRESHOLD_SHIFT) | ++ (FIFO_WRITE_THRESHOLD << SDEDM_WRITE_THRESHOLD_SHIFT); ++ bcm2835_sdhost_write(host, temp, SDEDM); ++ mdelay(10); ++ bcm2835_sdhost_set_power(host, true); ++ mdelay(10); ++ host->clock = 0; ++ host->sectors = 0; ++ bcm2835_sdhost_write(host, host->hcfg, SDHCFG); ++ bcm2835_sdhost_write(host, SDCDIV_MAX_CDIV, SDCDIV); ++ mmiowb(); ++} ++ ++static void bcm2835_sdhost_reset(struct mmc_host *mmc) ++{ ++ struct bcm2835_host *host = mmc_priv(mmc); ++ unsigned long flags; ++ spin_lock_irqsave(&host->lock, flags); ++ log_event("RST<", 0, 0); ++ ++ bcm2835_sdhost_reset_internal(host); ++ ++ spin_unlock_irqrestore(&host->lock, flags); ++} ++ ++static void bcm2835_sdhost_set_ios(struct mmc_host *mmc, struct mmc_ios *ios); ++ ++static void bcm2835_sdhost_init(struct bcm2835_host *host, int soft) ++{ ++ pr_debug("bcm2835_sdhost_init(%d)\n", soft); ++ ++ /* Set interrupt enables */ ++ host->hcfg = SDHCFG_BUSY_IRPT_EN; ++ ++ bcm2835_sdhost_reset_internal(host); ++ ++ if (soft) { ++ /* force clock reconfiguration */ ++ host->clock = 0; ++ bcm2835_sdhost_set_ios(host->mmc, &host->mmc->ios); ++ } ++} ++ ++static void bcm2835_sdhost_wait_transfer_complete(struct bcm2835_host *host) ++{ ++ int timediff; ++ u32 alternate_idle; ++ u32 edm; ++ ++ alternate_idle = (host->mrq->data->flags & MMC_DATA_READ) ? ++ SDEDM_FSM_READWAIT : SDEDM_FSM_WRITESTART1; ++ ++ edm = bcm2835_sdhost_read(host, SDEDM); ++ ++ log_event("WTC<", edm, 0); ++ ++ timediff = 0; ++ ++ while (1) { ++ u32 fsm = edm & SDEDM_FSM_MASK; ++ if ((fsm == SDEDM_FSM_IDENTMODE) || ++ (fsm == SDEDM_FSM_DATAMODE)) ++ break; ++ if (fsm == alternate_idle) { ++ bcm2835_sdhost_write(host, ++ edm | SDEDM_FORCE_DATA_MODE, ++ SDEDM); ++ break; ++ } ++ ++ timediff++; ++ if (timediff == 100000) { ++ pr_err("%s: wait_transfer_complete - still waiting after %d retries\n", ++ mmc_hostname(host->mmc), ++ timediff); ++ log_dump(); ++ bcm2835_sdhost_dumpregs(host); ++ host->mrq->data->error = -ETIMEDOUT; ++ log_event("WTC!", edm, 0); ++ return; ++ } ++ cpu_relax(); ++ edm = bcm2835_sdhost_read(host, SDEDM); ++ } ++ log_event("WTC>", edm, 0); ++} ++ ++static void bcm2835_sdhost_finish_data(struct bcm2835_host *host); ++ ++static void bcm2835_sdhost_dma_complete(void *param) ++{ ++ struct bcm2835_host *host = param; ++ struct mmc_data *data = host->data; ++ unsigned long flags; ++ ++ spin_lock_irqsave(&host->lock, flags); ++ log_event("DMA<", (u32)host->data, bcm2835_sdhost_read(host, SDHSTS)); ++ log_event("DMA ", bcm2835_sdhost_read(host, SDCMD), ++ bcm2835_sdhost_read(host, SDEDM)); ++ ++ if (host->dma_chan) { ++ dma_unmap_sg(host->dma_chan->device->dev, ++ data->sg, data->sg_len, ++ host->dma_dir); ++ ++ host->dma_chan = NULL; ++ } ++ ++ if (host->drain_words) { ++ void *page; ++ u32 *buf; ++ ++ page = kmap_atomic(host->drain_page); ++ buf = page + host->drain_offset; ++ ++ while (host->drain_words) { ++ u32 edm = bcm2835_sdhost_read(host, SDEDM); ++ if ((edm >> 4) & 0x1f) ++ *(buf++) = bcm2835_sdhost_read(host, ++ SDDATA); ++ host->drain_words--; ++ } ++ ++ kunmap_atomic(page); ++ } ++ ++ bcm2835_sdhost_finish_data(host); ++ ++ log_event("DMA>", (u32)host->data, 0); ++ spin_unlock_irqrestore(&host->lock, flags); ++} ++ ++static void bcm2835_sdhost_read_block_pio(struct bcm2835_host *host) ++{ ++ unsigned long flags; ++ size_t blksize, len; ++ u32 *buf; ++ unsigned long wait_max; ++ ++ blksize = host->data->blksz; ++ ++ wait_max = jiffies + msecs_to_jiffies(host->pio_timeout); ++ ++ local_irq_save(flags); ++ ++ while (blksize) { ++ int copy_words; ++ u32 hsts = 0; ++ ++ if (!sg_miter_next(&host->sg_miter)) { ++ host->data->error = -EINVAL; ++ break; ++ } ++ ++ len = min(host->sg_miter.length, blksize); ++ if (len % 4) { ++ host->data->error = -EINVAL; ++ break; ++ } ++ ++ blksize -= len; ++ host->sg_miter.consumed = len; ++ ++ buf = (u32 *)host->sg_miter.addr; ++ ++ copy_words = len/4; ++ ++ while (copy_words) { ++ int burst_words, words; ++ u32 edm; ++ ++ burst_words = SDDATA_FIFO_PIO_BURST; ++ if (burst_words > copy_words) ++ burst_words = copy_words; ++ edm = bcm2835_sdhost_read(host, SDEDM); ++ words = ((edm >> 4) & 0x1f); ++ ++ if (words < burst_words) { ++ int fsm_state = (edm & SDEDM_FSM_MASK); ++ if ((fsm_state != SDEDM_FSM_READDATA) && ++ (fsm_state != SDEDM_FSM_READWAIT) && ++ (fsm_state != SDEDM_FSM_READCRC)) { ++ hsts = bcm2835_sdhost_read(host, ++ SDHSTS); ++ pr_err("%s: fsm %x, hsts %x\n", ++ mmc_hostname(host->mmc), ++ fsm_state, hsts); ++ if (hsts & SDHSTS_ERROR_MASK) ++ break; ++ } ++ ++ if (time_after(jiffies, wait_max)) { ++ pr_err("%s: PIO read timeout - EDM %x\n", ++ mmc_hostname(host->mmc), ++ edm); ++ hsts = SDHSTS_REW_TIME_OUT; ++ break; ++ } ++ ndelay((burst_words - words) * ++ host->ns_per_fifo_word); ++ continue; ++ } else if (words > copy_words) { ++ words = copy_words; ++ } ++ ++ copy_words -= words; ++ ++ while (words) { ++ *(buf++) = bcm2835_sdhost_read(host, SDDATA); ++ words--; ++ } ++ } ++ ++ if (hsts & SDHSTS_ERROR_MASK) ++ break; ++ } ++ ++ sg_miter_stop(&host->sg_miter); ++ ++ local_irq_restore(flags); ++} ++ ++static void bcm2835_sdhost_write_block_pio(struct bcm2835_host *host) ++{ ++ unsigned long flags; ++ size_t blksize, len; ++ u32 *buf; ++ unsigned long wait_max; ++ ++ blksize = host->data->blksz; ++ ++ wait_max = jiffies + msecs_to_jiffies(host->pio_timeout); ++ ++ local_irq_save(flags); ++ ++ while (blksize) { ++ int copy_words; ++ u32 hsts = 0; ++ ++ if (!sg_miter_next(&host->sg_miter)) { ++ host->data->error = -EINVAL; ++ break; ++ } ++ ++ len = min(host->sg_miter.length, blksize); ++ if (len % 4) { ++ host->data->error = -EINVAL; ++ break; ++ } ++ ++ blksize -= len; ++ host->sg_miter.consumed = len; ++ ++ buf = (u32 *)host->sg_miter.addr; ++ ++ copy_words = len/4; ++ ++ while (copy_words) { ++ int burst_words, words; ++ u32 edm; ++ ++ burst_words = SDDATA_FIFO_PIO_BURST; ++ if (burst_words > copy_words) ++ burst_words = copy_words; ++ edm = bcm2835_sdhost_read(host, SDEDM); ++ words = SDDATA_FIFO_WORDS - ((edm >> 4) & 0x1f); ++ ++ if (words < burst_words) { ++ int fsm_state = (edm & SDEDM_FSM_MASK); ++ if ((fsm_state != SDEDM_FSM_WRITEDATA) && ++ (fsm_state != SDEDM_FSM_WRITESTART1) && ++ (fsm_state != SDEDM_FSM_WRITESTART2)) { ++ hsts = bcm2835_sdhost_read(host, ++ SDHSTS); ++ pr_err("%s: fsm %x, hsts %x\n", ++ mmc_hostname(host->mmc), ++ fsm_state, hsts); ++ if (hsts & SDHSTS_ERROR_MASK) ++ break; ++ } ++ ++ if (time_after(jiffies, wait_max)) { ++ pr_err("%s: PIO write timeout - EDM %x\n", ++ mmc_hostname(host->mmc), ++ edm); ++ hsts = SDHSTS_REW_TIME_OUT; ++ break; ++ } ++ ndelay((burst_words - words) * ++ host->ns_per_fifo_word); ++ continue; ++ } else if (words > copy_words) { ++ words = copy_words; ++ } ++ ++ copy_words -= words; ++ ++ while (words) { ++ bcm2835_sdhost_write(host, *(buf++), SDDATA); ++ words--; ++ } ++ } ++ ++ if (hsts & SDHSTS_ERROR_MASK) ++ break; ++ } ++ ++ sg_miter_stop(&host->sg_miter); ++ ++ local_irq_restore(flags); ++} ++ ++static void bcm2835_sdhost_transfer_pio(struct bcm2835_host *host) ++{ ++ u32 sdhsts; ++ bool is_read; ++ BUG_ON(!host->data); ++ log_event("XFP<", (u32)host->data, host->blocks); ++ ++ is_read = (host->data->flags & MMC_DATA_READ) != 0; ++ if (is_read) ++ bcm2835_sdhost_read_block_pio(host); ++ else ++ bcm2835_sdhost_write_block_pio(host); ++ ++ sdhsts = bcm2835_sdhost_read(host, SDHSTS); ++ if (sdhsts & (SDHSTS_CRC16_ERROR | ++ SDHSTS_CRC7_ERROR | ++ SDHSTS_FIFO_ERROR)) { ++ pr_err("%s: %s transfer error - HSTS %x\n", ++ mmc_hostname(host->mmc), ++ is_read ? "read" : "write", ++ sdhsts); ++ host->data->error = -EILSEQ; ++ } else if ((sdhsts & (SDHSTS_CMD_TIME_OUT | ++ SDHSTS_REW_TIME_OUT))) { ++ pr_err("%s: %s timeout error - HSTS %x\n", ++ mmc_hostname(host->mmc), ++ is_read ? "read" : "write", ++ sdhsts); ++ host->data->error = -ETIMEDOUT; ++ } ++ log_event("XFP>", (u32)host->data, host->blocks); ++} ++ ++static void bcm2835_sdhost_prepare_dma(struct bcm2835_host *host, ++ struct mmc_data *data) ++{ ++ int len, dir_data, dir_slave; ++ struct dma_async_tx_descriptor *desc = NULL; ++ struct dma_chan *dma_chan; ++ ++ log_event("PRD<", (u32)data, 0); ++ pr_debug("bcm2835_sdhost_prepare_dma()\n"); ++ ++ dma_chan = host->dma_chan_rxtx; ++ if (data->flags & MMC_DATA_READ) { ++ dir_data = DMA_FROM_DEVICE; ++ dir_slave = DMA_DEV_TO_MEM; ++ } else { ++ dir_data = DMA_TO_DEVICE; ++ dir_slave = DMA_MEM_TO_DEV; ++ } ++ log_event("PRD1", (u32)dma_chan, 0); ++ ++ BUG_ON(!dma_chan->device); ++ BUG_ON(!dma_chan->device->dev); ++ BUG_ON(!data->sg); ++ ++ /* The block doesn't manage the FIFO DREQs properly for multi-block ++ transfers, so don't attempt to DMA the final few words. ++ Unfortunately this requires the final sg entry to be trimmed. ++ N.B. This code demands that the overspill is contained in ++ a single sg entry. ++ */ ++ ++ host->drain_words = 0; ++ if ((data->blocks > 1) && (dir_data == DMA_FROM_DEVICE)) { ++ struct scatterlist *sg; ++ u32 len; ++ int i; ++ ++ len = min((u32)(FIFO_READ_THRESHOLD - 1) * 4, ++ (u32)data->blocks * data->blksz); ++ ++ for_each_sg(data->sg, sg, data->sg_len, i) { ++ if (sg_is_last(sg)) { ++ BUG_ON(sg->length < len); ++ sg->length -= len; ++ host->drain_page = (struct page *)sg->page_link; ++ host->drain_offset = sg->offset + sg->length; ++ } ++ } ++ host->drain_words = len/4; ++ } ++ ++ /* The parameters have already been validated, so this will not fail */ ++ (void)dmaengine_slave_config(dma_chan, ++ (dir_data == DMA_FROM_DEVICE) ? ++ &host->dma_cfg_rx : ++ &host->dma_cfg_tx); ++ ++ len = dma_map_sg(dma_chan->device->dev, data->sg, data->sg_len, ++ dir_data); ++ ++ log_event("PRD2", len, 0); ++ if (len > 0) ++ desc = dmaengine_prep_slave_sg(dma_chan, data->sg, ++ len, dir_slave, ++ DMA_PREP_INTERRUPT | DMA_CTRL_ACK); ++ log_event("PRD3", (u32)desc, 0); ++ ++ if (desc) { ++ desc->callback = bcm2835_sdhost_dma_complete; ++ desc->callback_param = host; ++ host->dma_desc = desc; ++ host->dma_chan = dma_chan; ++ host->dma_dir = dir_data; ++ } ++ log_event("PDM>", (u32)data, 0); ++} ++ ++static void bcm2835_sdhost_start_dma(struct bcm2835_host *host) ++{ ++ log_event("SDMA", (u32)host->data, (u32)host->dma_chan); ++ dmaengine_submit(host->dma_desc); ++ dma_async_issue_pending(host->dma_chan); ++} ++ ++static void bcm2835_sdhost_set_transfer_irqs(struct bcm2835_host *host) ++{ ++ u32 all_irqs = SDHCFG_DATA_IRPT_EN | SDHCFG_BLOCK_IRPT_EN | ++ SDHCFG_BUSY_IRPT_EN; ++ if (host->dma_desc) ++ host->hcfg = (host->hcfg & ~all_irqs) | ++ SDHCFG_BUSY_IRPT_EN; ++ else ++ host->hcfg = (host->hcfg & ~all_irqs) | ++ SDHCFG_DATA_IRPT_EN | ++ SDHCFG_BUSY_IRPT_EN; ++ ++ bcm2835_sdhost_write(host, host->hcfg, SDHCFG); ++} ++ ++static void bcm2835_sdhost_prepare_data(struct bcm2835_host *host, struct mmc_command *cmd) ++{ ++ struct mmc_data *data = cmd->data; ++ ++ WARN_ON(host->data); ++ ++ host->data = data; ++ if (!data) ++ return; ++ ++ /* Sanity checks */ ++ BUG_ON(data->blksz * data->blocks > 524288); ++ BUG_ON(data->blksz > host->mmc->max_blk_size); ++ BUG_ON(data->blocks > 65535); ++ ++ host->data_complete = 0; ++ host->flush_fifo = 0; ++ host->data->bytes_xfered = 0; ++ ++ if (!host->sectors && host->mmc->card) { ++ struct mmc_card *card = host->mmc->card; ++ if (!mmc_card_sd(card) && mmc_card_blockaddr(card)) { ++ /* ++ * The EXT_CSD sector count is in number of 512 byte ++ * sectors. ++ */ ++ host->sectors = card->ext_csd.sectors; ++ } else { ++ /* ++ * The CSD capacity field is in units of read_blkbits. ++ * set_capacity takes units of 512 bytes. ++ */ ++ host->sectors = card->csd.capacity << ++ (card->csd.read_blkbits - 9); ++ } ++ } ++ ++ if (!host->dma_desc) { ++ /* Use PIO */ ++ int flags = SG_MITER_ATOMIC; ++ ++ if (data->flags & MMC_DATA_READ) ++ flags |= SG_MITER_TO_SG; ++ else ++ flags |= SG_MITER_FROM_SG; ++ sg_miter_start(&host->sg_miter, data->sg, data->sg_len, flags); ++ host->blocks = data->blocks; ++ } ++ ++ bcm2835_sdhost_set_transfer_irqs(host); ++ ++ bcm2835_sdhost_write(host, data->blksz, SDHBCT); ++ bcm2835_sdhost_write(host, data->blocks, SDHBLC); ++ ++ BUG_ON(!host->data); ++} ++ ++bool bcm2835_sdhost_send_command(struct bcm2835_host *host, ++ struct mmc_command *cmd) ++{ ++ u32 sdcmd, sdhsts; ++ unsigned long timeout; ++ int delay; ++ ++ WARN_ON(host->cmd); ++ log_event("CMD<", cmd->opcode, cmd->arg); ++ ++ if (cmd->data) ++ pr_debug("%s: send_command %d 0x%x " ++ "(flags 0x%x) - %s %d*%d\n", ++ mmc_hostname(host->mmc), ++ cmd->opcode, cmd->arg, cmd->flags, ++ (cmd->data->flags & MMC_DATA_READ) ? ++ "read" : "write", cmd->data->blocks, ++ cmd->data->blksz); ++ else ++ pr_debug("%s: send_command %d 0x%x (flags 0x%x)\n", ++ mmc_hostname(host->mmc), ++ cmd->opcode, cmd->arg, cmd->flags); ++ ++ /* Wait max 100 ms */ ++ timeout = 10000; ++ ++ while (bcm2835_sdhost_read(host, SDCMD) & SDCMD_NEW_FLAG) { ++ if (timeout == 0) { ++ pr_err("%s: previous command never completed.\n", ++ mmc_hostname(host->mmc)); ++ bcm2835_sdhost_dumpregs(host); ++ cmd->error = -EILSEQ; ++ tasklet_schedule(&host->finish_tasklet); ++ return false; ++ } ++ timeout--; ++ udelay(10); ++ } ++ ++ delay = (10000 - timeout)/100; ++ if (delay > host->max_delay) { ++ host->max_delay = delay; ++ pr_warning("%s: controller hung for %d ms\n", ++ mmc_hostname(host->mmc), ++ host->max_delay); ++ } ++ ++ timeout = jiffies; ++ if (!cmd->data && cmd->busy_timeout > 9000) ++ timeout += DIV_ROUND_UP(cmd->busy_timeout, 1000) * HZ + HZ; ++ else ++ timeout += 10 * HZ; ++ mod_timer(&host->timer, timeout); ++ ++ host->cmd = cmd; ++ ++ /* Clear any error flags */ ++ sdhsts = bcm2835_sdhost_read(host, SDHSTS); ++ if (sdhsts & SDHSTS_ERROR_MASK) ++ bcm2835_sdhost_write(host, sdhsts, SDHSTS); ++ ++ if ((cmd->flags & MMC_RSP_136) && (cmd->flags & MMC_RSP_BUSY)) { ++ pr_err("%s: unsupported response type!\n", ++ mmc_hostname(host->mmc)); ++ cmd->error = -EINVAL; ++ tasklet_schedule(&host->finish_tasklet); ++ return false; ++ } ++ ++ bcm2835_sdhost_prepare_data(host, cmd); ++ ++ bcm2835_sdhost_write(host, cmd->arg, SDARG); ++ ++ sdcmd = cmd->opcode & SDCMD_CMD_MASK; ++ ++ host->use_busy = 0; ++ if (!(cmd->flags & MMC_RSP_PRESENT)) { ++ sdcmd |= SDCMD_NO_RESPONSE; ++ } else { ++ if (cmd->flags & MMC_RSP_136) ++ sdcmd |= SDCMD_LONG_RESPONSE; ++ if (cmd->flags & MMC_RSP_BUSY) { ++ sdcmd |= SDCMD_BUSYWAIT; ++ host->use_busy = 1; ++ } ++ } ++ ++ if (cmd->data) { ++ log_event("CMDD", cmd->data->blocks, cmd->data->blksz); ++ if (host->delay_after_this_stop) { ++ struct timeval now; ++ int time_since_stop; ++ do_gettimeofday(&now); ++ time_since_stop = (now.tv_sec - host->stop_time.tv_sec); ++ if (time_since_stop < 2) { ++ /* Possibly less than one second */ ++ time_since_stop = time_since_stop * 1000000 + ++ (now.tv_usec - host->stop_time.tv_usec); ++ if (time_since_stop < ++ host->delay_after_this_stop) ++ udelay(host->delay_after_this_stop - ++ time_since_stop); ++ } ++ } ++ ++ host->delay_after_this_stop = host->delay_after_stop; ++ if ((cmd->data->flags & MMC_DATA_READ) && !host->use_sbc) { ++ /* See if read crosses one of the hazardous sectors */ ++ u32 first_blk, last_blk; ++ ++ /* Intentionally include the following sector because ++ without CMD23/SBC the read may run on. */ ++ first_blk = host->mrq->cmd->arg; ++ last_blk = first_blk + cmd->data->blocks; ++ ++ if (((last_blk >= (host->sectors - 64)) && ++ (first_blk <= (host->sectors - 64))) || ++ ((last_blk >= (host->sectors - 32)) && ++ (first_blk <= (host->sectors - 32)))) { ++ host->delay_after_this_stop = ++ max(250u, host->delay_after_stop); ++ } ++ } ++ ++ if (cmd->data->flags & MMC_DATA_WRITE) ++ sdcmd |= SDCMD_WRITE_CMD; ++ if (cmd->data->flags & MMC_DATA_READ) ++ sdcmd |= SDCMD_READ_CMD; ++ } ++ ++ bcm2835_sdhost_write(host, sdcmd | SDCMD_NEW_FLAG, SDCMD); ++ ++ return true; ++} ++ ++static void bcm2835_sdhost_finish_command(struct bcm2835_host *host, ++ unsigned long *irq_flags); ++static void bcm2835_sdhost_transfer_complete(struct bcm2835_host *host); ++ ++static void bcm2835_sdhost_finish_data(struct bcm2835_host *host) ++{ ++ struct mmc_data *data; ++ ++ data = host->data; ++ BUG_ON(!data); ++ ++ log_event("FDA<", (u32)host->mrq, (u32)host->cmd); ++ pr_debug("finish_data(error %d, stop %d, sbc %d)\n", ++ data->error, data->stop ? 1 : 0, ++ host->mrq->sbc ? 1 : 0); ++ ++ host->hcfg &= ~(SDHCFG_DATA_IRPT_EN | SDHCFG_BLOCK_IRPT_EN); ++ bcm2835_sdhost_write(host, host->hcfg, SDHCFG); ++ ++ data->bytes_xfered = data->error ? 0 : (data->blksz * data->blocks); ++ ++ host->data_complete = 1; ++ ++ if (host->cmd) { ++ /* ++ * Data managed to finish before the ++ * command completed. Make sure we do ++ * things in the proper order. ++ */ ++ pr_debug("Finished early - HSTS %x\n", ++ bcm2835_sdhost_read(host, SDHSTS)); ++ } ++ else ++ bcm2835_sdhost_transfer_complete(host); ++ log_event("FDA>", (u32)host->mrq, (u32)host->cmd); ++} ++ ++static void bcm2835_sdhost_transfer_complete(struct bcm2835_host *host) ++{ ++ struct mmc_data *data; ++ ++ BUG_ON(host->cmd); ++ BUG_ON(!host->data); ++ BUG_ON(!host->data_complete); ++ ++ data = host->data; ++ host->data = NULL; ++ ++ log_event("TCM<", (u32)data, data->error); ++ pr_debug("transfer_complete(error %d, stop %d)\n", ++ data->error, data->stop ? 1 : 0); ++ ++ /* ++ * Need to send CMD12 if - ++ * a) open-ended multiblock transfer (no CMD23) ++ * b) error in multiblock transfer ++ */ ++ if (host->mrq->stop && (data->error || !host->use_sbc)) { ++ if (bcm2835_sdhost_send_command(host, host->mrq->stop)) { ++ /* No busy, so poll for completion */ ++ if (!host->use_busy) ++ bcm2835_sdhost_finish_command(host, NULL); ++ ++ if (host->delay_after_this_stop) ++ do_gettimeofday(&host->stop_time); ++ } ++ } else { ++ bcm2835_sdhost_wait_transfer_complete(host); ++ tasklet_schedule(&host->finish_tasklet); ++ } ++ log_event("TCM>", (u32)data, 0); ++} ++ ++/* If irq_flags is valid, the caller is in a thread context and is allowed ++ to sleep */ ++static void bcm2835_sdhost_finish_command(struct bcm2835_host *host, ++ unsigned long *irq_flags) ++{ ++ u32 sdcmd; ++ u32 retries; ++#ifdef DEBUG ++ struct timeval before, after; ++ int timediff = 0; ++#endif ++ ++ log_event("FCM<", (u32)host->mrq, (u32)host->cmd); ++ pr_debug("finish_command(%x)\n", bcm2835_sdhost_read(host, SDCMD)); ++ ++ BUG_ON(!host->cmd || !host->mrq); ++ ++ /* Poll quickly at first */ ++ ++ retries = host->cmd_quick_poll_retries; ++ if (!retries) { ++ /* Work out how many polls take 1us by timing 10us */ ++ struct timeval start, now; ++ int us_diff; ++ ++ retries = 1; ++ do { ++ int i; ++ ++ retries *= 2; ++ ++ do_gettimeofday(&start); ++ ++ for (i = 0; i < retries; i++) { ++ cpu_relax(); ++ sdcmd = bcm2835_sdhost_read(host, SDCMD); ++ } ++ ++ do_gettimeofday(&now); ++ us_diff = (now.tv_sec - start.tv_sec) * 1000000 + ++ (now.tv_usec - start.tv_usec); ++ } while (us_diff < 10); ++ ++ host->cmd_quick_poll_retries = ((retries * us_diff + 9)*CMD_DALLY_US)/10 + 1; ++ retries = 1; // We've already waited long enough this time ++ } ++ ++ retries = host->cmd_quick_poll_retries; ++ for (sdcmd = bcm2835_sdhost_read(host, SDCMD); ++ (sdcmd & SDCMD_NEW_FLAG) && !(sdcmd & SDCMD_FAIL_FLAG) && retries; ++ retries--) { ++ cpu_relax(); ++ sdcmd = bcm2835_sdhost_read(host, SDCMD); ++ } ++ ++ if (!retries) { ++ unsigned long wait_max; ++ ++ if (!irq_flags) { ++ /* Schedule the work */ ++ log_event("CWWQ", 0, 0); ++ schedule_work(&host->cmd_wait_wq); ++ return; ++ } ++ ++ /* Wait max 100 ms */ ++ wait_max = jiffies + msecs_to_jiffies(100); ++ while (time_before(jiffies, wait_max)) { ++ spin_unlock_irqrestore(&host->lock, *irq_flags); ++ usleep_range(1, 10); ++ spin_lock_irqsave(&host->lock, *irq_flags); ++ sdcmd = bcm2835_sdhost_read(host, SDCMD); ++ if (!(sdcmd & SDCMD_NEW_FLAG) || ++ (sdcmd & SDCMD_FAIL_FLAG)) ++ break; ++ } ++ } ++ ++ /* Check for errors */ ++ if (sdcmd & SDCMD_NEW_FLAG) { ++ pr_err("%s: command never completed.\n", ++ mmc_hostname(host->mmc)); ++ bcm2835_sdhost_dumpregs(host); ++ host->cmd->error = -EIO; ++ tasklet_schedule(&host->finish_tasklet); ++ return; ++ } else if (sdcmd & SDCMD_FAIL_FLAG) { ++ u32 sdhsts = bcm2835_sdhost_read(host, SDHSTS); ++ ++ /* Clear the errors */ ++ bcm2835_sdhost_write(host, SDHSTS_ERROR_MASK, SDHSTS); ++ ++ if (host->debug) ++ pr_info("%s: error detected - CMD %x, HSTS %03x, EDM %x\n", ++ mmc_hostname(host->mmc), sdcmd, sdhsts, ++ bcm2835_sdhost_read(host, SDEDM)); ++ ++ if ((sdhsts & SDHSTS_CRC7_ERROR) && ++ (host->cmd->opcode == 1)) { ++ if (host->debug) ++ pr_info("%s: ignoring CRC7 error for CMD1\n", ++ mmc_hostname(host->mmc)); ++ } else { ++ if (sdhsts & SDHSTS_CMD_TIME_OUT) { ++ if (host->debug) ++ pr_err("%s: command %d timeout\n", ++ mmc_hostname(host->mmc), ++ host->cmd->opcode); ++ host->cmd->error = -ETIMEDOUT; ++ } else { ++ pr_err("%s: unexpected command %d error\n", ++ mmc_hostname(host->mmc), ++ host->cmd->opcode); ++ bcm2835_sdhost_dumpregs(host); ++ host->cmd->error = -EILSEQ; ++ } ++ tasklet_schedule(&host->finish_tasklet); ++ return; ++ } ++ } ++ ++ if (host->cmd->flags & MMC_RSP_PRESENT) { ++ if (host->cmd->flags & MMC_RSP_136) { ++ int i; ++ for (i = 0; i < 4; i++) ++ host->cmd->resp[3 - i] = bcm2835_sdhost_read(host, SDRSP0 + i*4); ++ pr_debug("%s: finish_command %08x %08x %08x %08x\n", ++ mmc_hostname(host->mmc), ++ host->cmd->resp[0], host->cmd->resp[1], host->cmd->resp[2], host->cmd->resp[3]); ++ log_event("RSP ", host->cmd->resp[0], host->cmd->resp[1]); ++ } else { ++ host->cmd->resp[0] = bcm2835_sdhost_read(host, SDRSP0); ++ pr_debug("%s: finish_command %08x\n", ++ mmc_hostname(host->mmc), ++ host->cmd->resp[0]); ++ log_event("RSP ", host->cmd->resp[0], 0); ++ } ++ } ++ ++ if (host->cmd == host->mrq->sbc) { ++ /* Finished CMD23, now send actual command. */ ++ host->cmd = NULL; ++ if (bcm2835_sdhost_send_command(host, host->mrq->cmd)) { ++ if (host->data && host->dma_desc) ++ /* DMA transfer starts now, PIO starts after irq */ ++ bcm2835_sdhost_start_dma(host); ++ ++ if (!host->use_busy) ++ bcm2835_sdhost_finish_command(host, NULL); ++ } ++ } else if (host->cmd == host->mrq->stop) { ++ /* Finished CMD12 */ ++ tasklet_schedule(&host->finish_tasklet); ++ } else { ++ /* Processed actual command. */ ++ host->cmd = NULL; ++ if (!host->data) ++ tasklet_schedule(&host->finish_tasklet); ++ else if (host->data_complete) ++ bcm2835_sdhost_transfer_complete(host); ++ } ++ log_event("FCM>", (u32)host->mrq, (u32)host->cmd); ++} ++ ++static void bcm2835_sdhost_timeout(unsigned long data) ++{ ++ struct bcm2835_host *host; ++ unsigned long flags; ++ ++ host = (struct bcm2835_host *)data; ++ ++ spin_lock_irqsave(&host->lock, flags); ++ log_event("TIM<", 0, 0); ++ ++ if (host->mrq) { ++ pr_err("%s: timeout waiting for hardware interrupt.\n", ++ mmc_hostname(host->mmc)); ++ log_dump(); ++ bcm2835_sdhost_dumpregs(host); ++ ++ if (host->data) { ++ host->data->error = -ETIMEDOUT; ++ bcm2835_sdhost_finish_data(host); ++ } else { ++ if (host->cmd) ++ host->cmd->error = -ETIMEDOUT; ++ else ++ host->mrq->cmd->error = -ETIMEDOUT; ++ ++ pr_debug("timeout_timer tasklet_schedule\n"); ++ tasklet_schedule(&host->finish_tasklet); ++ } ++ } ++ ++ mmiowb(); ++ spin_unlock_irqrestore(&host->lock, flags); ++} ++ ++static void bcm2835_sdhost_busy_irq(struct bcm2835_host *host, u32 intmask) ++{ ++ log_event("IRQB", (u32)host->cmd, intmask); ++ if (!host->cmd) { ++ pr_err("%s: got command busy interrupt 0x%08x even " ++ "though no command operation was in progress.\n", ++ mmc_hostname(host->mmc), (unsigned)intmask); ++ bcm2835_sdhost_dumpregs(host); ++ return; ++ } ++ ++ if (!host->use_busy) { ++ pr_err("%s: got command busy interrupt 0x%08x even " ++ "though not expecting one.\n", ++ mmc_hostname(host->mmc), (unsigned)intmask); ++ bcm2835_sdhost_dumpregs(host); ++ return; ++ } ++ host->use_busy = 0; ++ ++ if (intmask & SDHSTS_ERROR_MASK) ++ { ++ pr_err("sdhost_busy_irq: intmask %x, data %p\n", intmask, host->mrq->data); ++ if (intmask & SDHSTS_CRC7_ERROR) ++ host->cmd->error = -EILSEQ; ++ else if (intmask & (SDHSTS_CRC16_ERROR | ++ SDHSTS_FIFO_ERROR)) { ++ if (host->mrq->data) ++ host->mrq->data->error = -EILSEQ; ++ else ++ host->cmd->error = -EILSEQ; ++ } else if (intmask & SDHSTS_REW_TIME_OUT) { ++ if (host->mrq->data) ++ host->mrq->data->error = -ETIMEDOUT; ++ else ++ host->cmd->error = -ETIMEDOUT; ++ } else if (intmask & SDHSTS_CMD_TIME_OUT) ++ host->cmd->error = -ETIMEDOUT; ++ ++ log_dump(); ++ bcm2835_sdhost_dumpregs(host); ++ } ++ else ++ bcm2835_sdhost_finish_command(host, NULL); ++} ++ ++static void bcm2835_sdhost_data_irq(struct bcm2835_host *host, u32 intmask) ++{ ++ /* There are no dedicated data/space available interrupt ++ status bits, so it is necessary to use the single shared ++ data/space available FIFO status bits. It is therefore not ++ an error to get here when there is no data transfer in ++ progress. */ ++ log_event("IRQD", (u32)host->data, intmask); ++ if (!host->data) ++ return; ++ ++ if (intmask & (SDHSTS_CRC16_ERROR | ++ SDHSTS_FIFO_ERROR | ++ SDHSTS_REW_TIME_OUT)) { ++ if (intmask & (SDHSTS_CRC16_ERROR | ++ SDHSTS_FIFO_ERROR)) ++ host->data->error = -EILSEQ; ++ else ++ host->data->error = -ETIMEDOUT; ++ ++ if (host->debug) { ++ log_dump(); ++ bcm2835_sdhost_dumpregs(host); ++ } ++ } ++ ++ if (host->data->error) { ++ bcm2835_sdhost_finish_data(host); ++ } else if (host->data->flags & MMC_DATA_WRITE) { ++ /* Use the block interrupt for writes after the first block */ ++ host->hcfg &= ~(SDHCFG_DATA_IRPT_EN); ++ host->hcfg |= SDHCFG_BLOCK_IRPT_EN; ++ bcm2835_sdhost_write(host, host->hcfg, SDHCFG); ++ bcm2835_sdhost_transfer_pio(host); ++ } else { ++ bcm2835_sdhost_transfer_pio(host); ++ host->blocks--; ++ if ((host->blocks == 0) || host->data->error) ++ bcm2835_sdhost_finish_data(host); ++ } ++} ++ ++static void bcm2835_sdhost_block_irq(struct bcm2835_host *host, u32 intmask) ++{ ++ log_event("IRQK", (u32)host->data, intmask); ++ if (!host->data) { ++ pr_err("%s: got block interrupt 0x%08x even " ++ "though no data operation was in progress.\n", ++ mmc_hostname(host->mmc), (unsigned)intmask); ++ bcm2835_sdhost_dumpregs(host); ++ return; ++ } ++ ++ if (intmask & (SDHSTS_CRC16_ERROR | ++ SDHSTS_FIFO_ERROR | ++ SDHSTS_REW_TIME_OUT)) { ++ if (intmask & (SDHSTS_CRC16_ERROR | ++ SDHSTS_FIFO_ERROR)) ++ host->data->error = -EILSEQ; ++ else ++ host->data->error = -ETIMEDOUT; ++ ++ if (host->debug) { ++ log_dump(); ++ bcm2835_sdhost_dumpregs(host); ++ } ++ } ++ ++ if (!host->dma_desc) { ++ BUG_ON(!host->blocks); ++ if (host->data->error || (--host->blocks == 0)) { ++ bcm2835_sdhost_finish_data(host); ++ } else { ++ bcm2835_sdhost_transfer_pio(host); ++ } ++ } else if (host->data->flags & MMC_DATA_WRITE) { ++ bcm2835_sdhost_finish_data(host); ++ } ++} ++ ++static irqreturn_t bcm2835_sdhost_irq(int irq, void *dev_id) ++{ ++ irqreturn_t result = IRQ_NONE; ++ struct bcm2835_host *host = dev_id; ++ u32 intmask; ++ ++ spin_lock(&host->lock); ++ ++ intmask = bcm2835_sdhost_read(host, SDHSTS); ++ log_event("IRQ<", intmask, 0); ++ ++ bcm2835_sdhost_write(host, ++ SDHSTS_BUSY_IRPT | ++ SDHSTS_BLOCK_IRPT | ++ SDHSTS_SDIO_IRPT | ++ SDHSTS_DATA_FLAG, ++ SDHSTS); ++ ++ if (intmask & SDHSTS_BLOCK_IRPT) { ++ bcm2835_sdhost_block_irq(host, intmask); ++ result = IRQ_HANDLED; ++ } ++ ++ if (intmask & SDHSTS_BUSY_IRPT) { ++ bcm2835_sdhost_busy_irq(host, intmask); ++ result = IRQ_HANDLED; ++ } ++ ++ /* There is no true data interrupt status bit, so it is ++ necessary to qualify the data flag with the interrupt ++ enable bit */ ++ if ((intmask & SDHSTS_DATA_FLAG) && ++ (host->hcfg & SDHCFG_DATA_IRPT_EN)) { ++ bcm2835_sdhost_data_irq(host, intmask); ++ result = IRQ_HANDLED; ++ } ++ ++ mmiowb(); ++ ++ log_event("IRQ>", bcm2835_sdhost_read(host, SDHSTS), 0); ++ spin_unlock(&host->lock); ++ ++ return result; ++} ++ ++void bcm2835_sdhost_set_clock(struct bcm2835_host *host, unsigned int clock) ++{ ++ int div = 0; /* Initialized for compiler warning */ ++ unsigned int input_clock = clock; ++ unsigned long flags; ++ ++ if (host->debug) ++ pr_info("%s: set_clock(%d)\n", mmc_hostname(host->mmc), clock); ++ ++ if ((host->overclock_50 > 50) && ++ (clock == 50*MHZ)) ++ clock = host->overclock_50 * MHZ + (MHZ - 1); ++ ++ /* The SDCDIV register has 11 bits, and holds (div - 2). ++ But in data mode the max is 50MHz wihout a minimum, and only the ++ bottom 3 bits are used. Since the switch over is automatic (unless ++ we have marked the card as slow...), chosen values have to make ++ sense in both modes. ++ Ident mode must be 100-400KHz, so can range check the requested ++ clock. CMD15 must be used to return to data mode, so this can be ++ monitored. ++ ++ clock 250MHz -> 0->125MHz, 1->83.3MHz, 2->62.5MHz, 3->50.0MHz ++ 4->41.7MHz, 5->35.7MHz, 6->31.3MHz, 7->27.8MHz ++ ++ 623->400KHz/27.8MHz ++ reset value (507)->491159/50MHz ++ ++ BUT, the 3-bit clock divisor in data mode is too small if the ++ core clock is higher than 250MHz, so instead use the SLOW_CARD ++ configuration bit to force the use of the ident clock divisor ++ at all times. ++ */ ++ ++ host->mmc->actual_clock = 0; ++ ++ if (host->firmware_sets_cdiv) { ++ u32 msg[3] = { clock, 0, 0 }; ++ ++ rpi_firmware_property(rpi_firmware_get(NULL), ++ RPI_FIRMWARE_SET_SDHOST_CLOCK, ++ &msg, sizeof(msg)); ++ ++ clock = max(msg[1], msg[2]); ++ spin_lock_irqsave(&host->lock, flags); ++ } else { ++ spin_lock_irqsave(&host->lock, flags); ++ if (clock < 100000) { ++ /* Can't stop the clock, but make it as slow as ++ * possible to show willing ++ */ ++ host->cdiv = SDCDIV_MAX_CDIV; ++ bcm2835_sdhost_write(host, host->cdiv, SDCDIV); ++ mmiowb(); ++ spin_unlock_irqrestore(&host->lock, flags); ++ return; ++ } ++ ++ div = host->max_clk / clock; ++ if (div < 2) ++ div = 2; ++ if ((host->max_clk / div) > clock) ++ div++; ++ div -= 2; ++ ++ if (div > SDCDIV_MAX_CDIV) ++ div = SDCDIV_MAX_CDIV; ++ ++ clock = host->max_clk / (div + 2); ++ ++ host->cdiv = div; ++ bcm2835_sdhost_write(host, host->cdiv, SDCDIV); ++ ++ if (host->debug) ++ pr_info("%s: clock=%d -> max_clk=%d, cdiv=%x " ++ "(actual clock %d)\n", ++ mmc_hostname(host->mmc), input_clock, ++ host->max_clk, host->cdiv, ++ clock); ++ } ++ ++ /* Calibrate some delays */ ++ ++ host->ns_per_fifo_word = (1000000000/clock) * ++ ((host->mmc->caps & MMC_CAP_4_BIT_DATA) ? 8 : 32); ++ ++ if (input_clock == 50 * MHZ) { ++ if (clock > input_clock) { ++ /* Save the closest value, to make it easier ++ to reduce in the event of error */ ++ host->overclock_50 = (clock/MHZ); ++ ++ if (clock != host->overclock) { ++ pr_warn("%s: overclocking to %dHz\n", ++ mmc_hostname(host->mmc), clock); ++ host->overclock = clock; ++ } ++ } else if (host->overclock) { ++ host->overclock = 0; ++ if (clock == 50 * MHZ) ++ pr_warn("%s: cancelling overclock\n", ++ mmc_hostname(host->mmc)); ++ } ++ } ++ ++ /* Set the timeout to 500ms */ ++ bcm2835_sdhost_write(host, clock/2, SDTOUT); ++ ++ host->mmc->actual_clock = clock; ++ host->clock = input_clock; ++ host->reset_clock = 0; ++ ++ mmiowb(); ++ spin_unlock_irqrestore(&host->lock, flags); ++} ++ ++static void bcm2835_sdhost_request(struct mmc_host *mmc, struct mmc_request *mrq) ++{ ++ struct bcm2835_host *host; ++ unsigned long flags; ++ u32 edm, fsm; ++ ++ host = mmc_priv(mmc); ++ ++ if (host->debug) { ++ struct mmc_command *cmd = mrq->cmd; ++ BUG_ON(!cmd); ++ if (cmd->data) ++ pr_info("%s: cmd %d 0x%x (flags 0x%x) - %s %d*%d\n", ++ mmc_hostname(mmc), ++ cmd->opcode, cmd->arg, cmd->flags, ++ (cmd->data->flags & MMC_DATA_READ) ? ++ "read" : "write", cmd->data->blocks, ++ cmd->data->blksz); ++ else ++ pr_info("%s: cmd %d 0x%x (flags 0x%x)\n", ++ mmc_hostname(mmc), ++ cmd->opcode, cmd->arg, cmd->flags); ++ } ++ ++ /* Reset the error statuses in case this is a retry */ ++ if (mrq->sbc) ++ mrq->sbc->error = 0; ++ if (mrq->cmd) ++ mrq->cmd->error = 0; ++ if (mrq->data) ++ mrq->data->error = 0; ++ if (mrq->stop) ++ mrq->stop->error = 0; ++ ++ if (mrq->data && !is_power_of_2(mrq->data->blksz)) { ++ pr_err("%s: unsupported block size (%d bytes)\n", ++ mmc_hostname(mmc), mrq->data->blksz); ++ mrq->cmd->error = -EINVAL; ++ mmc_request_done(mmc, mrq); ++ return; ++ } ++ ++ if (host->use_dma && mrq->data && ++ (mrq->data->blocks > host->pio_limit)) ++ bcm2835_sdhost_prepare_dma(host, mrq->data); ++ ++ if (host->reset_clock) ++ bcm2835_sdhost_set_clock(host, host->clock); ++ ++ spin_lock_irqsave(&host->lock, flags); ++ ++ WARN_ON(host->mrq != NULL); ++ host->mrq = mrq; ++ ++ edm = bcm2835_sdhost_read(host, SDEDM); ++ fsm = edm & SDEDM_FSM_MASK; ++ ++ log_event("REQ<", (u32)mrq, edm); ++ if ((fsm != SDEDM_FSM_IDENTMODE) && ++ (fsm != SDEDM_FSM_DATAMODE)) { ++ pr_err("%s: previous command (%d) not complete (EDM %x)\n", ++ mmc_hostname(host->mmc), ++ bcm2835_sdhost_read(host, SDCMD) & SDCMD_CMD_MASK, ++ edm); ++ log_event("REQ!", (u32)mrq, edm); ++ log_dump(); ++ bcm2835_sdhost_dumpregs(host); ++ mrq->cmd->error = -EILSEQ; ++ tasklet_schedule(&host->finish_tasklet); ++ mmiowb(); ++ spin_unlock_irqrestore(&host->lock, flags); ++ return; ++ } ++ ++ host->use_sbc = !!mrq->sbc && ++ (host->mrq->data->flags & USE_CMD23_FLAGS); ++ if (host->use_sbc) { ++ if (bcm2835_sdhost_send_command(host, mrq->sbc)) { ++ if (!host->use_busy) ++ bcm2835_sdhost_finish_command(host, &flags); ++ } ++ } else if (bcm2835_sdhost_send_command(host, mrq->cmd)) { ++ if (host->data && host->dma_desc) ++ /* DMA transfer starts now, PIO starts after irq */ ++ bcm2835_sdhost_start_dma(host); ++ ++ if (!host->use_busy) ++ bcm2835_sdhost_finish_command(host, &flags); ++ } ++ ++ log_event("CMD ", (u32)mrq->cmd->opcode, ++ mrq->data ? (u32)mrq->data->blksz : 0); ++ mmiowb(); ++ ++ log_event("REQ>", (u32)mrq, 0); ++ spin_unlock_irqrestore(&host->lock, flags); ++} ++ ++static void bcm2835_sdhost_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) ++{ ++ ++ struct bcm2835_host *host = mmc_priv(mmc); ++ unsigned long flags; ++ ++ if (host->debug) ++ pr_info("%s: ios clock %d, pwr %d, bus_width %d, " ++ "timing %d, vdd %d, drv_type %d\n", ++ mmc_hostname(mmc), ++ ios->clock, ios->power_mode, ios->bus_width, ++ ios->timing, ios->signal_voltage, ios->drv_type); ++ ++ spin_lock_irqsave(&host->lock, flags); ++ ++ log_event("IOS<", ios->clock, 0); ++ ++ /* set bus width */ ++ host->hcfg &= ~SDHCFG_WIDE_EXT_BUS; ++ if (ios->bus_width == MMC_BUS_WIDTH_4) ++ host->hcfg |= SDHCFG_WIDE_EXT_BUS; ++ ++ host->hcfg |= SDHCFG_WIDE_INT_BUS; ++ ++ /* Disable clever clock switching, to cope with fast core clocks */ ++ host->hcfg |= SDHCFG_SLOW_CARD; ++ ++ bcm2835_sdhost_write(host, host->hcfg, SDHCFG); ++ ++ mmiowb(); ++ ++ spin_unlock_irqrestore(&host->lock, flags); ++ ++ if (!ios->clock || ios->clock != host->clock) ++ bcm2835_sdhost_set_clock(host, ios->clock); ++} ++ ++static struct mmc_host_ops bcm2835_sdhost_ops = { ++ .request = bcm2835_sdhost_request, ++ .set_ios = bcm2835_sdhost_set_ios, ++ .hw_reset = bcm2835_sdhost_reset, ++}; ++ ++static void bcm2835_sdhost_cmd_wait_work(struct work_struct *work) ++{ ++ struct bcm2835_host *host; ++ unsigned long flags; ++ ++ host = container_of(work, struct bcm2835_host, cmd_wait_wq); ++ ++ spin_lock_irqsave(&host->lock, flags); ++ ++ log_event("CWK<", (u32)host->cmd, (u32)host->mrq); ++ ++ /* ++ * If this tasklet gets rescheduled while running, it will ++ * be run again afterwards but without any active request. ++ */ ++ if (!host->mrq) { ++ spin_unlock_irqrestore(&host->lock, flags); ++ return; ++ } ++ ++ bcm2835_sdhost_finish_command(host, &flags); ++ ++ mmiowb(); ++ ++ log_event("CWK>", (u32)host->cmd, 0); ++ ++ spin_unlock_irqrestore(&host->lock, flags); ++} ++ ++static void bcm2835_sdhost_tasklet_finish(unsigned long param) ++{ ++ struct bcm2835_host *host; ++ unsigned long flags; ++ struct mmc_request *mrq; ++ struct dma_chan *terminate_chan = NULL; ++ ++ host = (struct bcm2835_host *)param; ++ ++ spin_lock_irqsave(&host->lock, flags); ++ ++ log_event("TSK<", (u32)host->mrq, 0); ++ /* ++ * If this tasklet gets rescheduled while running, it will ++ * be run again afterwards but without any active request. ++ */ ++ if (!host->mrq) { ++ spin_unlock_irqrestore(&host->lock, flags); ++ return; ++ } ++ ++ del_timer(&host->timer); ++ ++ mrq = host->mrq; ++ ++ /* Drop the overclock after any data corruption, or after any ++ error overclocked */ ++ if (host->overclock) { ++ if ((mrq->cmd && mrq->cmd->error) || ++ (mrq->data && mrq->data->error) || ++ (mrq->stop && mrq->stop->error)) { ++ host->overclock_50--; ++ pr_warn("%s: reducing overclock due to errors\n", ++ mmc_hostname(host->mmc)); ++ host->reset_clock = 1; ++ mrq->cmd->error = -EILSEQ; ++ mrq->cmd->retries = 1; ++ } ++ } ++ ++ host->mrq = NULL; ++ host->cmd = NULL; ++ host->data = NULL; ++ ++ mmiowb(); ++ ++ host->dma_desc = NULL; ++ terminate_chan = host->dma_chan; ++ host->dma_chan = NULL; ++ ++ spin_unlock_irqrestore(&host->lock, flags); ++ ++ if (terminate_chan) ++ { ++ int err = dmaengine_terminate_all(terminate_chan); ++ if (err) ++ pr_err("%s: failed to terminate DMA (%d)\n", ++ mmc_hostname(host->mmc), err); ++ } ++ ++ mmc_request_done(host->mmc, mrq); ++ log_event("TSK>", (u32)mrq, 0); ++} ++ ++int bcm2835_sdhost_add_host(struct bcm2835_host *host) ++{ ++ struct mmc_host *mmc; ++ struct dma_slave_config cfg; ++ char pio_limit_string[20]; ++ int ret; ++ ++ mmc = host->mmc; ++ ++ bcm2835_sdhost_reset_internal(host); ++ ++ mmc->f_max = host->max_clk; ++ mmc->f_min = host->max_clk / SDCDIV_MAX_CDIV; ++ ++ mmc->max_busy_timeout = (~(unsigned int)0)/(mmc->f_max/1000); ++ ++ pr_debug("f_max %d, f_min %d, max_busy_timeout %d\n", ++ mmc->f_max, mmc->f_min, mmc->max_busy_timeout); ++ ++ /* host controller capabilities */ ++ mmc->caps |= ++ MMC_CAP_SD_HIGHSPEED | MMC_CAP_MMC_HIGHSPEED | ++ MMC_CAP_NEEDS_POLL | MMC_CAP_HW_RESET | MMC_CAP_ERASE | ++ ((ALLOW_CMD23_READ|ALLOW_CMD23_WRITE) * MMC_CAP_CMD23); ++ ++ spin_lock_init(&host->lock); ++ ++ if (host->allow_dma) { ++ if (IS_ERR_OR_NULL(host->dma_chan_rxtx)) { ++ pr_err("%s: unable to initialise DMA channel. " ++ "Falling back to PIO\n", ++ mmc_hostname(mmc)); ++ host->use_dma = false; ++ } else { ++ cfg.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; ++ cfg.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; ++ cfg.slave_id = 13; /* DREQ channel */ ++ ++ /* Validate the slave configurations */ ++ ++ cfg.direction = DMA_MEM_TO_DEV; ++ cfg.src_addr = 0; ++ cfg.dst_addr = host->bus_addr + SDDATA; ++ ++ ret = dmaengine_slave_config(host->dma_chan_rxtx, &cfg); ++ ++ if (ret == 0) { ++ host->dma_cfg_tx = cfg; ++ ++ cfg.direction = DMA_DEV_TO_MEM; ++ cfg.src_addr = host->bus_addr + SDDATA; ++ cfg.dst_addr = 0; ++ ++ ret = dmaengine_slave_config(host->dma_chan_rxtx, &cfg); ++ } ++ ++ if (ret == 0) { ++ host->dma_cfg_rx = cfg; ++ ++ host->use_dma = true; ++ } else { ++ pr_err("%s: unable to configure DMA channel. " ++ "Falling back to PIO\n", ++ mmc_hostname(mmc)); ++ dma_release_channel(host->dma_chan_rxtx); ++ host->dma_chan_rxtx = NULL; ++ host->use_dma = false; ++ } ++ } ++ } else { ++ host->use_dma = false; ++ } ++ ++ mmc->max_segs = 128; ++ mmc->max_req_size = 524288; ++ mmc->max_seg_size = mmc->max_req_size; ++ mmc->max_blk_size = 512; ++ mmc->max_blk_count = 65535; ++ ++ /* report supported voltage ranges */ ++ mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34; ++ ++ tasklet_init(&host->finish_tasklet, ++ bcm2835_sdhost_tasklet_finish, (unsigned long)host); ++ ++ INIT_WORK(&host->cmd_wait_wq, bcm2835_sdhost_cmd_wait_work); ++ ++ setup_timer(&host->timer, bcm2835_sdhost_timeout, ++ (unsigned long)host); ++ ++ bcm2835_sdhost_init(host, 0); ++ ++ ret = request_irq(host->irq, bcm2835_sdhost_irq, 0 /*IRQF_SHARED*/, ++ mmc_hostname(mmc), host); ++ if (ret) { ++ pr_err("%s: failed to request IRQ %d: %d\n", ++ mmc_hostname(mmc), host->irq, ret); ++ goto untasklet; ++ } ++ ++ mmiowb(); ++ mmc_add_host(mmc); ++ ++ pio_limit_string[0] = '\0'; ++ if (host->use_dma && (host->pio_limit > 0)) ++ sprintf(pio_limit_string, " (>%d)", host->pio_limit); ++ pr_info("%s: %s loaded - DMA %s%s\n", ++ mmc_hostname(mmc), DRIVER_NAME, ++ host->use_dma ? "enabled" : "disabled", ++ pio_limit_string); ++ ++ return 0; ++ ++untasklet: ++ tasklet_kill(&host->finish_tasklet); ++ ++ return ret; ++} ++ ++static int bcm2835_sdhost_probe(struct platform_device *pdev) ++{ ++ struct device *dev = &pdev->dev; ++ struct device_node *node = dev->of_node; ++ struct clk *clk; ++ struct resource *iomem; ++ struct bcm2835_host *host; ++ struct mmc_host *mmc; ++ const __be32 *addr; ++ u32 msg[3]; ++ int ret; ++ ++ pr_debug("bcm2835_sdhost_probe\n"); ++ mmc = mmc_alloc_host(sizeof(*host), dev); ++ if (!mmc) ++ return -ENOMEM; ++ ++ mmc->ops = &bcm2835_sdhost_ops; ++ host = mmc_priv(mmc); ++ host->mmc = mmc; ++ host->pio_timeout = msecs_to_jiffies(500); ++ host->pio_limit = 1; ++ host->max_delay = 1; /* Warn if over 1ms */ ++ host->allow_dma = 1; ++ spin_lock_init(&host->lock); ++ ++ iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0); ++ host->ioaddr = devm_ioremap_resource(dev, iomem); ++ if (IS_ERR(host->ioaddr)) { ++ ret = PTR_ERR(host->ioaddr); ++ goto err; ++ } ++ ++ addr = of_get_address(node, 0, NULL, NULL); ++ if (!addr) { ++ dev_err(dev, "could not get DMA-register address\n"); ++ return -ENODEV; ++ } ++ host->bus_addr = be32_to_cpup(addr); ++ log_init(iomem->start - host->bus_addr); ++ pr_debug(" - ioaddr %lx, iomem->start %lx, bus_addr %lx\n", ++ (unsigned long)host->ioaddr, ++ (unsigned long)iomem->start, ++ (unsigned long)host->bus_addr); ++ ++ if (node) { ++ /* Read any custom properties */ ++ of_property_read_u32(node, ++ "brcm,delay-after-stop", ++ &host->delay_after_stop); ++ of_property_read_u32(node, ++ "brcm,overclock-50", ++ &host->overclock_50); ++ of_property_read_u32(node, ++ "brcm,pio-limit", ++ &host->pio_limit); ++ host->allow_dma = ++ !of_property_read_bool(node, "brcm,force-pio"); ++ host->debug = of_property_read_bool(node, "brcm,debug"); ++ } ++ ++ host->dma_chan = NULL; ++ host->dma_desc = NULL; ++ ++ /* Formally recognise the other way of disabling DMA */ ++ if (host->pio_limit == 0x7fffffff) ++ host->allow_dma = false; ++ ++ if (host->allow_dma) { ++ if (node) { ++ host->dma_chan_rxtx = ++ dma_request_slave_channel(dev, "rx-tx"); ++ if (!host->dma_chan_rxtx) ++ host->dma_chan_rxtx = ++ dma_request_slave_channel(dev, "tx"); ++ if (!host->dma_chan_rxtx) ++ host->dma_chan_rxtx = ++ dma_request_slave_channel(dev, "rx"); ++ } else { ++ dma_cap_mask_t mask; ++ ++ dma_cap_zero(mask); ++ /* we don't care about the channel, any would work */ ++ dma_cap_set(DMA_SLAVE, mask); ++ host->dma_chan_rxtx = ++ dma_request_channel(mask, NULL, NULL); ++ } ++ } ++ ++ clk = devm_clk_get(dev, NULL); ++ if (IS_ERR(clk)) { ++ dev_err(dev, "could not get clk\n"); ++ ret = PTR_ERR(clk); ++ goto err; ++ } ++ ++ host->max_clk = clk_get_rate(clk); ++ ++ host->irq = platform_get_irq(pdev, 0); ++ if (host->irq <= 0) { ++ dev_err(dev, "get IRQ failed\n"); ++ ret = -EINVAL; ++ goto err; ++ } ++ ++ pr_debug(" - max_clk %lx, irq %d\n", ++ (unsigned long)host->max_clk, ++ (int)host->irq); ++ ++ if (node) ++ mmc_of_parse(mmc); ++ else ++ mmc->caps |= MMC_CAP_4_BIT_DATA; ++ ++ msg[0] = 0; ++ msg[1] = ~0; ++ msg[2] = ~0; ++ ++ rpi_firmware_property(rpi_firmware_get(NULL), ++ RPI_FIRMWARE_SET_SDHOST_CLOCK, ++ &msg, sizeof(msg)); ++ ++ host->firmware_sets_cdiv = (msg[1] != ~0); ++ ++ ret = bcm2835_sdhost_add_host(host); ++ if (ret) ++ goto err; ++ ++ platform_set_drvdata(pdev, host); ++ ++ pr_debug("bcm2835_sdhost_probe -> OK\n"); ++ ++ return 0; ++ ++err: ++ pr_debug("bcm2835_sdhost_probe -> err %d\n", ret); ++ mmc_free_host(mmc); ++ ++ return ret; ++} ++ ++static int bcm2835_sdhost_remove(struct platform_device *pdev) ++{ ++ struct bcm2835_host *host = platform_get_drvdata(pdev); ++ ++ pr_debug("bcm2835_sdhost_remove\n"); ++ ++ mmc_remove_host(host->mmc); ++ ++ bcm2835_sdhost_set_power(host, false); ++ ++ free_irq(host->irq, host); ++ ++ del_timer_sync(&host->timer); ++ ++ tasklet_kill(&host->finish_tasklet); ++ ++ mmc_free_host(host->mmc); ++ platform_set_drvdata(pdev, NULL); ++ ++ pr_debug("bcm2835_sdhost_remove - OK\n"); ++ return 0; ++} ++ ++static const struct of_device_id bcm2835_sdhost_match[] = { ++ { .compatible = "brcm,bcm2835-sdhost" }, ++ { } ++}; ++MODULE_DEVICE_TABLE(of, bcm2835_sdhost_match); ++ ++static struct platform_driver bcm2835_sdhost_driver = { ++ .probe = bcm2835_sdhost_probe, ++ .remove = bcm2835_sdhost_remove, ++ .driver = { ++ .name = DRIVER_NAME, ++ .owner = THIS_MODULE, ++ .of_match_table = bcm2835_sdhost_match, ++ }, ++}; ++module_platform_driver(bcm2835_sdhost_driver); ++ ++MODULE_ALIAS("platform:sdhost-bcm2835"); ++MODULE_DESCRIPTION("BCM2835 SDHost driver"); ++MODULE_LICENSE("GPL v2"); ++MODULE_AUTHOR("Phil Elwell"); + +From 6f2e23aee85a87ba940dd5649a290e4e0a1fd84e Mon Sep 17 00:00:00 2001 +From: Phil Elwell <phil@raspberrypi.org> +Date: Wed, 11 May 2016 12:50:33 +0100 +Subject: [PATCH 038/112] mmc: Add MMC_QUIRK_ERASE_BROKEN for some cards + +Some SD cards have been found that corrupt data when small blocks +are erased. Add a quirk to indicate that ERASE should not be used, +and set it for cards of that type. + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> + +mmc: Apply QUIRK_BROKEN_ERASE to other capacities + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> + +mmc: Add card_quirks module parameter, log quirks + +Use mmc_block.card_quirks to override the quirks for all SD or MMC +cards. The value is a bitfield using the bit positions defined in +include/linux/mmc/card.h. If the module parameter is placed in the +kernel command line (or bootargs) stored on the card then, assuming the +device only has one SD card interface, the override effectively becomes +card-specific. + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> +--- + drivers/mmc/card/block.c | 39 ++++++++++++++++++++++++++++++++++++--- + drivers/mmc/core/core.c | 3 ++- + include/linux/mmc/card.h | 3 +++ + 3 files changed, 41 insertions(+), 4 deletions(-) + +diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c +index b0a2741..9ce8676 100644 +--- a/drivers/mmc/card/block.c ++++ b/drivers/mmc/card/block.c +@@ -132,6 +132,13 @@ enum { + module_param(perdev_minors, int, 0444); + MODULE_PARM_DESC(perdev_minors, "Minors numbers to allocate per device"); + ++/* ++ * Allow quirks to be overridden for the current card ++ */ ++static char *card_quirks; ++module_param(card_quirks, charp, 0644); ++MODULE_PARM_DESC(card_quirks, "Force the use of the indicated quirks (a bitfield)"); ++ + static inline int mmc_blk_part_switch(struct mmc_card *card, + struct mmc_blk_data *md); + static int get_card_status(struct mmc_card *card, u32 *status, int retries); +@@ -2532,6 +2539,17 @@ static const struct mmc_fixup blk_fixups[] = + MMC_FIXUP("V10016", CID_MANFID_KINGSTON, CID_OEMID_ANY, add_quirk_mmc, + MMC_QUIRK_TRIM_BROKEN), + ++ /* ++ * On some Kingston SD cards, multiple erases of less than 64 ++ * sectors can cause corruption. ++ */ ++ MMC_FIXUP("SD16G", 0x41, 0x3432, add_quirk_mmc, ++ MMC_QUIRK_ERASE_BROKEN), ++ MMC_FIXUP("SD32G", 0x41, 0x3432, add_quirk_mmc, ++ MMC_QUIRK_ERASE_BROKEN), ++ MMC_FIXUP("SD64G", 0x41, 0x3432, add_quirk_mmc, ++ MMC_QUIRK_ERASE_BROKEN), ++ + END_FIXUP + }; + +@@ -2539,6 +2557,7 @@ static int mmc_blk_probe(struct mmc_card *card) + { + struct mmc_blk_data *md, *part_md; + char cap_str[10]; ++ char quirk_str[24]; + + /* + * Check that the card supports the command class(es) we need. +@@ -2546,7 +2565,16 @@ static int mmc_blk_probe(struct mmc_card *card) + if (!(card->csd.cmdclass & CCC_BLOCK_READ)) + return -ENODEV; + +- mmc_fixup_device(card, blk_fixups); ++ if (card_quirks) { ++ unsigned long quirks; ++ if (kstrtoul(card_quirks, 0, &quirks) == 0) ++ card->quirks = (unsigned int)quirks; ++ else ++ pr_err("mmc_block: Invalid card_quirks parameter '%s'\n", ++ card_quirks); ++ } ++ else ++ mmc_fixup_device(card, blk_fixups); + + md = mmc_blk_alloc(card); + if (IS_ERR(md)) +@@ -2554,9 +2582,14 @@ static int mmc_blk_probe(struct mmc_card *card) + + string_get_size((u64)get_capacity(md->disk), 512, STRING_UNITS_2, + cap_str, sizeof(cap_str)); +- pr_info("%s: %s %s %s %s\n", ++ if (card->quirks) ++ snprintf(quirk_str, sizeof(quirk_str), ++ " (quirks 0x%08x)", card->quirks); ++ else ++ quirk_str[0] = '\0'; ++ pr_info("%s: %s %s %s%s%s\n", + md->disk->disk_name, mmc_card_id(card), mmc_card_name(card), +- cap_str, md->read_only ? "(ro)" : ""); ++ cap_str, md->read_only ? " (ro)" : "", quirk_str); + + if (mmc_blk_alloc_parts(card, md)) + goto out; +diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c +index 9eba56c..4b1ff84 100644 +--- a/drivers/mmc/core/core.c ++++ b/drivers/mmc/core/core.c +@@ -2253,7 +2253,8 @@ EXPORT_SYMBOL(mmc_erase); + int mmc_can_erase(struct mmc_card *card) + { + if ((card->host->caps & MMC_CAP_ERASE) && +- (card->csd.cmdclass & CCC_ERASE) && card->erase_size) ++ (card->csd.cmdclass & CCC_ERASE) && card->erase_size && ++ !(card->quirks & MMC_QUIRK_ERASE_BROKEN)) + return 1; + return 0; + } +diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h +index eb0151b..fa4e645 100644 +--- a/include/linux/mmc/card.h ++++ b/include/linux/mmc/card.h +@@ -281,6 +281,9 @@ struct mmc_card { + #define MMC_QUIRK_TRIM_BROKEN (1<<12) /* Skip trim */ + + ++#define MMC_QUIRK_ERASE_BROKEN (1<<31) /* Skip erase */ ++ ++ + unsigned int erase_size; /* erase size in sectors */ + unsigned int erase_shift; /* if erase unit is power 2 */ + unsigned int pref_erase; /* in sectors */ + +From b3dfc4d3fd00b16fdde707b9974710ca1378b1b8 Mon Sep 17 00:00:00 2001 +From: popcornmix <popcornmix@gmail.com> +Date: Wed, 3 Jul 2013 00:31:47 +0100 +Subject: [PATCH 039/112] cma: Add vc_cma driver to enable use of CMA +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: popcornmix <popcornmix@gmail.com> + +vc_cma: Make the vc_cma area the default contiguous DMA area + +vc_cma: Provide empty functions when module is not built + +Providing empty functions saves the users from guarding the +function call with an #if clause. +Move __init markings from prototypes to functions. + +Signed-off-by: Noralf Trønnes <noralf@tronnes.org> +--- + drivers/char/Kconfig | 2 + + drivers/char/Makefile | 1 + + drivers/char/broadcom/Kconfig | 15 + + drivers/char/broadcom/Makefile | 1 + + drivers/char/broadcom/vc_cma/Makefile | 14 + + drivers/char/broadcom/vc_cma/vc_cma.c | 1193 +++++++++++++++++++++++++++++++++ + include/linux/broadcom/vc_cma.h | 36 + + 7 files changed, 1262 insertions(+) + create mode 100644 drivers/char/broadcom/Kconfig + create mode 100644 drivers/char/broadcom/Makefile + create mode 100644 drivers/char/broadcom/vc_cma/Makefile + create mode 100644 drivers/char/broadcom/vc_cma/vc_cma.c + create mode 100644 include/linux/broadcom/vc_cma.h + +diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig +index 3ec0766..aec9337 100644 +--- a/drivers/char/Kconfig ++++ b/drivers/char/Kconfig +@@ -4,6 +4,8 @@ + + menu "Character devices" + ++source "drivers/char/broadcom/Kconfig" ++ + source "drivers/tty/Kconfig" + + config DEVMEM +diff --git a/drivers/char/Makefile b/drivers/char/Makefile +index d8a7579..9d8662e 100644 +--- a/drivers/char/Makefile ++++ b/drivers/char/Makefile +@@ -60,3 +60,4 @@ js-rtc-y = rtc.o + + obj-$(CONFIG_TILE_SROM) += tile-srom.o + obj-$(CONFIG_XILLYBUS) += xillybus/ ++obj-$(CONFIG_BRCM_CHAR_DRIVERS) += broadcom/ +diff --git a/drivers/char/broadcom/Kconfig b/drivers/char/broadcom/Kconfig +new file mode 100644 +index 0000000..2d8bd6e +--- /dev/null ++++ b/drivers/char/broadcom/Kconfig +@@ -0,0 +1,15 @@ ++# ++# Broadcom char driver config ++# ++ ++menuconfig BRCM_CHAR_DRIVERS ++ bool "Broadcom Char Drivers" ++ help ++ Broadcom's char drivers ++ ++config BCM_VC_CMA ++ bool "Videocore CMA" ++ depends on CMA && BRCM_CHAR_DRIVERS && BCM2708_VCHIQ ++ default n ++ help ++ Helper for videocore CMA access. +diff --git a/drivers/char/broadcom/Makefile b/drivers/char/broadcom/Makefile +new file mode 100644 +index 0000000..13c5bca +--- /dev/null ++++ b/drivers/char/broadcom/Makefile +@@ -0,0 +1 @@ ++obj-$(CONFIG_BCM_VC_CMA) += vc_cma/ +diff --git a/drivers/char/broadcom/vc_cma/Makefile b/drivers/char/broadcom/vc_cma/Makefile +new file mode 100644 +index 0000000..6a94de4 +--- /dev/null ++++ b/drivers/char/broadcom/vc_cma/Makefile +@@ -0,0 +1,14 @@ ++ccflags-y += -Wall -Wstrict-prototypes -Wno-trigraphs ++ccflags-y += -Werror ++ccflags-y += -Iinclude/linux/broadcom ++ccflags-y += -Idrivers/misc/vc04_services ++ccflags-y += -Idrivers/misc/vc04_services/interface/vchi ++ccflags-y += -Idrivers/misc/vc04_services/interface/vchiq_arm ++ ++ccflags-y += -D__KERNEL__ ++ccflags-y += -D__linux__ ++ccflags-y += -Werror ++ ++obj-$(CONFIG_BCM_VC_CMA) += vc-cma.o ++ ++vc-cma-objs := vc_cma.o +diff --git a/drivers/char/broadcom/vc_cma/vc_cma.c b/drivers/char/broadcom/vc_cma/vc_cma.c +new file mode 100644 +index 0000000..85f6e9d +--- /dev/null ++++ b/drivers/char/broadcom/vc_cma/vc_cma.c +@@ -0,0 +1,1193 @@ ++/** ++ * Copyright (c) 2010-2012 Broadcom. 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, ++ * without modification. ++ * 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. ++ * 3. The names of the above-listed copyright holders may not be used ++ * to endorse or promote products derived from this software without ++ * specific prior written permission. ++ * ++ * ALTERNATIVELY, this software may be distributed under the terms of the ++ * GNU General Public License ("GPL") version 2, as published by the Free ++ * Software Foundation. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER OR ++ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ++ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, ++ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR ++ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF ++ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING ++ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ */ ++ ++#include <linux/kernel.h> ++#include <linux/module.h> ++#include <linux/kthread.h> ++#include <linux/fs.h> ++#include <linux/device.h> ++#include <linux/cdev.h> ++#include <linux/mm.h> ++#include <linux/proc_fs.h> ++#include <linux/seq_file.h> ++#include <linux/dma-mapping.h> ++#include <linux/dma-contiguous.h> ++#include <linux/platform_device.h> ++#include <linux/uaccess.h> ++#include <asm/cacheflush.h> ++ ++#include "vc_cma.h" ++ ++#include "vchiq_util.h" ++#include "vchiq_connected.h" ++//#include "debug_sym.h" ++//#include "vc_mem.h" ++ ++#define DRIVER_NAME "vc-cma" ++ ++#define LOG_DBG(fmt, ...) \ ++ if (vc_cma_debug) \ ++ printk(KERN_INFO fmt "\n", ##__VA_ARGS__) ++#define LOG_INFO(fmt, ...) \ ++ printk(KERN_INFO fmt "\n", ##__VA_ARGS__) ++#define LOG_ERR(fmt, ...) \ ++ printk(KERN_ERR fmt "\n", ##__VA_ARGS__) ++ ++#define VC_CMA_FOURCC VCHIQ_MAKE_FOURCC('C', 'M', 'A', ' ') ++#define VC_CMA_VERSION 2 ++ ++#define VC_CMA_CHUNK_ORDER 6 /* 256K */ ++#define VC_CMA_CHUNK_SIZE (4096 << VC_CMA_CHUNK_ORDER) ++#define VC_CMA_MAX_PARAMS_PER_MSG \ ++ ((VCHIQ_MAX_MSG_SIZE - sizeof(unsigned short))/sizeof(unsigned short)) ++#define VC_CMA_RESERVE_COUNT_MAX 16 ++ ++#define PAGES_PER_CHUNK (VC_CMA_CHUNK_SIZE / PAGE_SIZE) ++ ++#define VCADDR_TO_PHYSADDR(vcaddr) (mm_vc_mem_phys_addr + vcaddr) ++ ++#define loud_error(...) \ ++ LOG_ERR("===== " __VA_ARGS__) ++ ++enum { ++ VC_CMA_MSG_QUIT, ++ VC_CMA_MSG_OPEN, ++ VC_CMA_MSG_TICK, ++ VC_CMA_MSG_ALLOC, /* chunk count */ ++ VC_CMA_MSG_FREE, /* chunk, chunk, ... */ ++ VC_CMA_MSG_ALLOCATED, /* chunk, chunk, ... */ ++ VC_CMA_MSG_REQUEST_ALLOC, /* chunk count */ ++ VC_CMA_MSG_REQUEST_FREE, /* chunk count */ ++ VC_CMA_MSG_RESERVE, /* bytes lo, bytes hi */ ++ VC_CMA_MSG_UPDATE_RESERVE, ++ VC_CMA_MSG_MAX ++}; ++ ++struct cma_msg { ++ unsigned short type; ++ unsigned short params[VC_CMA_MAX_PARAMS_PER_MSG]; ++}; ++ ++struct vc_cma_reserve_user { ++ unsigned int pid; ++ unsigned int reserve; ++}; ++ ++/* Device (/dev) related variables */ ++static dev_t vc_cma_devnum; ++static struct class *vc_cma_class; ++static struct cdev vc_cma_cdev; ++static int vc_cma_inited; ++static int vc_cma_debug; ++ ++/* Proc entry */ ++static struct proc_dir_entry *vc_cma_proc_entry; ++ ++phys_addr_t vc_cma_base; ++struct page *vc_cma_base_page; ++unsigned int vc_cma_size; ++EXPORT_SYMBOL(vc_cma_size); ++unsigned int vc_cma_initial; ++unsigned int vc_cma_chunks; ++unsigned int vc_cma_chunks_used; ++unsigned int vc_cma_chunks_reserved; ++ ++ ++void *vc_cma_dma_alloc; ++unsigned int vc_cma_dma_size; ++ ++static int in_loud_error; ++ ++unsigned int vc_cma_reserve_total; ++unsigned int vc_cma_reserve_count; ++struct vc_cma_reserve_user vc_cma_reserve_users[VC_CMA_RESERVE_COUNT_MAX]; ++static DEFINE_SEMAPHORE(vc_cma_reserve_mutex); ++static DEFINE_SEMAPHORE(vc_cma_worker_queue_push_mutex); ++ ++static u64 vc_cma_dma_mask = DMA_BIT_MASK(32); ++static struct platform_device vc_cma_device = { ++ .name = "vc-cma", ++ .id = 0, ++ .dev = { ++ .dma_mask = &vc_cma_dma_mask, ++ .coherent_dma_mask = DMA_BIT_MASK(32), ++ }, ++}; ++ ++static VCHIQ_INSTANCE_T cma_instance; ++static VCHIQ_SERVICE_HANDLE_T cma_service; ++static VCHIU_QUEUE_T cma_msg_queue; ++static struct task_struct *cma_worker; ++ ++static int vc_cma_set_reserve(unsigned int reserve, unsigned int pid); ++static int vc_cma_alloc_chunks(int num_chunks, struct cma_msg *reply); ++static VCHIQ_STATUS_T cma_service_callback(VCHIQ_REASON_T reason, ++ VCHIQ_HEADER_T * header, ++ VCHIQ_SERVICE_HANDLE_T service, ++ void *bulk_userdata); ++static void send_vc_msg(unsigned short type, ++ unsigned short param1, unsigned short param2); ++static bool send_worker_msg(VCHIQ_HEADER_T * msg); ++ ++static int early_vc_cma_mem(char *p) ++{ ++ unsigned int new_size; ++ printk(KERN_NOTICE "early_vc_cma_mem(%s)", p); ++ vc_cma_size = memparse(p, &p); ++ vc_cma_initial = vc_cma_size; ++ if (*p == '/') ++ vc_cma_size = memparse(p + 1, &p); ++ if (*p == '@') ++ vc_cma_base = memparse(p + 1, &p); ++ ++ new_size = (vc_cma_size - ((-vc_cma_base) & (VC_CMA_CHUNK_SIZE - 1))) ++ & ~(VC_CMA_CHUNK_SIZE - 1); ++ if (new_size > vc_cma_size) ++ vc_cma_size = 0; ++ vc_cma_initial = (vc_cma_initial + VC_CMA_CHUNK_SIZE - 1) ++ & ~(VC_CMA_CHUNK_SIZE - 1); ++ if (vc_cma_initial > vc_cma_size) ++ vc_cma_initial = vc_cma_size; ++ vc_cma_base = (vc_cma_base + VC_CMA_CHUNK_SIZE - 1) ++ & ~(VC_CMA_CHUNK_SIZE - 1); ++ ++ printk(KERN_NOTICE " -> initial %x, size %x, base %x", vc_cma_initial, ++ vc_cma_size, (unsigned int)vc_cma_base); ++ ++ return 0; ++} ++ ++early_param("vc-cma-mem", early_vc_cma_mem); ++ ++void __init vc_cma_early_init(void) ++{ ++ LOG_DBG("vc_cma_early_init - vc_cma_chunks = %d", vc_cma_chunks); ++ if (vc_cma_size) { ++ int rc = platform_device_register(&vc_cma_device); ++ LOG_DBG("platform_device_register -> %d", rc); ++ } ++} ++ ++void __init vc_cma_reserve(void) ++{ ++ /* if vc_cma_size is set, then declare vc CMA area of the same ++ * size from the end of memory ++ */ ++ if (vc_cma_size) { ++ if (dma_declare_contiguous(&vc_cma_device.dev, vc_cma_size, ++ vc_cma_base, 0) == 0) { ++ if (!dev_get_cma_area(NULL)) { ++ /* There is no default CMA area - make this ++ the default */ ++ struct cma *vc_cma_area = dev_get_cma_area( ++ &vc_cma_device.dev); ++ dma_contiguous_set_default(vc_cma_area); ++ LOG_INFO("vc_cma_reserve - using vc_cma as " ++ "the default contiguous DMA area"); ++ } ++ } else { ++ LOG_ERR("vc_cma: dma_declare_contiguous(%x,%x) failed", ++ vc_cma_size, (unsigned int)vc_cma_base); ++ vc_cma_size = 0; ++ } ++ } ++ vc_cma_chunks = vc_cma_size / VC_CMA_CHUNK_SIZE; ++} ++ ++/**************************************************************************** ++* ++* vc_cma_open ++* ++***************************************************************************/ ++ ++static int vc_cma_open(struct inode *inode, struct file *file) ++{ ++ (void)inode; ++ (void)file; ++ ++ return 0; ++} ++ ++/**************************************************************************** ++* ++* vc_cma_release ++* ++***************************************************************************/ ++ ++static int vc_cma_release(struct inode *inode, struct file *file) ++{ ++ (void)inode; ++ (void)file; ++ ++ vc_cma_set_reserve(0, current->tgid); ++ ++ return 0; ++} ++ ++/**************************************************************************** ++* ++* vc_cma_ioctl ++* ++***************************************************************************/ ++ ++static long vc_cma_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ++{ ++ int rc = 0; ++ ++ (void)cmd; ++ (void)arg; ++ ++ switch (cmd) { ++ case VC_CMA_IOC_RESERVE: ++ rc = vc_cma_set_reserve((unsigned int)arg, current->tgid); ++ if (rc >= 0) ++ rc = 0; ++ break; ++ default: ++ LOG_ERR("vc-cma: Unknown ioctl %x", cmd); ++ return -ENOTTY; ++ } ++ ++ return rc; ++} ++ ++/**************************************************************************** ++* ++* File Operations for the driver. ++* ++***************************************************************************/ ++ ++static const struct file_operations vc_cma_fops = { ++ .owner = THIS_MODULE, ++ .open = vc_cma_open, ++ .release = vc_cma_release, ++ .unlocked_ioctl = vc_cma_ioctl, ++}; ++ ++/**************************************************************************** ++* ++* vc_cma_proc_open ++* ++***************************************************************************/ ++ ++static int vc_cma_show_info(struct seq_file *m, void *v) ++{ ++ int i; ++ ++ seq_printf(m, "Videocore CMA:\n"); ++ seq_printf(m, " Base : %08x\n", (unsigned int)vc_cma_base); ++ seq_printf(m, " Length : %08x\n", vc_cma_size); ++ seq_printf(m, " Initial : %08x\n", vc_cma_initial); ++ seq_printf(m, " Chunk size : %08x\n", VC_CMA_CHUNK_SIZE); ++ seq_printf(m, " Chunks : %4d (%d bytes)\n", ++ (int)vc_cma_chunks, ++ (int)(vc_cma_chunks * VC_CMA_CHUNK_SIZE)); ++ seq_printf(m, " Used : %4d (%d bytes)\n", ++ (int)vc_cma_chunks_used, ++ (int)(vc_cma_chunks_used * VC_CMA_CHUNK_SIZE)); ++ seq_printf(m, " Reserved : %4d (%d bytes)\n", ++ (unsigned int)vc_cma_chunks_reserved, ++ (int)(vc_cma_chunks_reserved * VC_CMA_CHUNK_SIZE)); ++ ++ for (i = 0; i < vc_cma_reserve_count; i++) { ++ struct vc_cma_reserve_user *user = &vc_cma_reserve_users[i]; ++ seq_printf(m, " PID %5d: %d bytes\n", user->pid, ++ user->reserve); ++ } ++ seq_printf(m, " dma_alloc : %p (%d pages)\n", ++ vc_cma_dma_alloc ? page_address(vc_cma_dma_alloc) : 0, ++ vc_cma_dma_size); ++ ++ seq_printf(m, "\n"); ++ ++ return 0; ++} ++ ++static int vc_cma_proc_open(struct inode *inode, struct file *file) ++{ ++ return single_open(file, vc_cma_show_info, NULL); ++} ++ ++/**************************************************************************** ++* ++* vc_cma_proc_write ++* ++***************************************************************************/ ++ ++static int vc_cma_proc_write(struct file *file, ++ const char __user *buffer, ++ size_t size, loff_t *ppos) ++{ ++ int rc = -EFAULT; ++ char input_str[20]; ++ ++ memset(input_str, 0, sizeof(input_str)); ++ ++ if (size > sizeof(input_str)) { ++ LOG_ERR("%s: input string length too long", __func__); ++ goto out; ++ } ++ ++ if (copy_from_user(input_str, buffer, size - 1)) { ++ LOG_ERR("%s: failed to get input string", __func__); ++ goto out; ++ } ++#define ALLOC_STR "alloc" ++#define FREE_STR "free" ++#define DEBUG_STR "debug" ++#define RESERVE_STR "reserve" ++#define DMA_ALLOC_STR "dma_alloc" ++#define DMA_FREE_STR "dma_free" ++ if (strncmp(input_str, ALLOC_STR, strlen(ALLOC_STR)) == 0) { ++ int alloc_size; ++ char *p = input_str + strlen(ALLOC_STR); ++ ++ while (*p == ' ') ++ p++; ++ alloc_size = memparse(p, NULL); ++ LOG_INFO("/proc/vc-cma: alloc %d", alloc_size); ++ if (alloc_size) ++ send_vc_msg(VC_CMA_MSG_REQUEST_FREE, ++ alloc_size / VC_CMA_CHUNK_SIZE, 0); ++ else ++ LOG_ERR("invalid size '%s'", p); ++ rc = size; ++ } else if (strncmp(input_str, FREE_STR, strlen(FREE_STR)) == 0) { ++ int alloc_size; ++ char *p = input_str + strlen(FREE_STR); ++ ++ while (*p == ' ') ++ p++; ++ alloc_size = memparse(p, NULL); ++ LOG_INFO("/proc/vc-cma: free %d", alloc_size); ++ if (alloc_size) ++ send_vc_msg(VC_CMA_MSG_REQUEST_ALLOC, ++ alloc_size / VC_CMA_CHUNK_SIZE, 0); ++ else ++ LOG_ERR("invalid size '%s'", p); ++ rc = size; ++ } else if (strncmp(input_str, DEBUG_STR, strlen(DEBUG_STR)) == 0) { ++ char *p = input_str + strlen(DEBUG_STR); ++ while (*p == ' ') ++ p++; ++ if ((strcmp(p, "on") == 0) || (strcmp(p, "1") == 0)) ++ vc_cma_debug = 1; ++ else if ((strcmp(p, "off") == 0) || (strcmp(p, "0") == 0)) ++ vc_cma_debug = 0; ++ LOG_INFO("/proc/vc-cma: debug %s", vc_cma_debug ? "on" : "off"); ++ rc = size; ++ } else if (strncmp(input_str, RESERVE_STR, strlen(RESERVE_STR)) == 0) { ++ int alloc_size; ++ int reserved; ++ char *p = input_str + strlen(RESERVE_STR); ++ while (*p == ' ') ++ p++; ++ alloc_size = memparse(p, NULL); ++ ++ reserved = vc_cma_set_reserve(alloc_size, current->tgid); ++ rc = (reserved >= 0) ? size : reserved; ++ } else if (strncmp(input_str, DMA_ALLOC_STR, strlen(DMA_ALLOC_STR)) == 0) { ++ int alloc_size; ++ char *p = input_str + strlen(DMA_ALLOC_STR); ++ while (*p == ' ') ++ p++; ++ alloc_size = memparse(p, NULL); ++ ++ if (vc_cma_dma_alloc) { ++ dma_release_from_contiguous(NULL, vc_cma_dma_alloc, ++ vc_cma_dma_size); ++ vc_cma_dma_alloc = NULL; ++ vc_cma_dma_size = 0; ++ } ++ vc_cma_dma_alloc = dma_alloc_from_contiguous(NULL, alloc_size, 0); ++ vc_cma_dma_size = (vc_cma_dma_alloc ? alloc_size : 0); ++ if (vc_cma_dma_alloc) ++ LOG_INFO("dma_alloc(%d pages) -> %p", alloc_size, page_address(vc_cma_dma_alloc)); ++ else ++ LOG_ERR("dma_alloc(%d pages) failed", alloc_size); ++ rc = size; ++ } else if (strncmp(input_str, DMA_FREE_STR, strlen(DMA_FREE_STR)) == 0) { ++ if (vc_cma_dma_alloc) { ++ dma_release_from_contiguous(NULL, vc_cma_dma_alloc, ++ vc_cma_dma_size); ++ vc_cma_dma_alloc = NULL; ++ vc_cma_dma_size = 0; ++ } ++ rc = size; ++ } ++ ++out: ++ return rc; ++} ++ ++/**************************************************************************** ++* ++* File Operations for /proc interface. ++* ++***************************************************************************/ ++ ++static const struct file_operations vc_cma_proc_fops = { ++ .open = vc_cma_proc_open, ++ .read = seq_read, ++ .write = vc_cma_proc_write, ++ .llseek = seq_lseek, ++ .release = single_release ++}; ++ ++static int vc_cma_set_reserve(unsigned int reserve, unsigned int pid) ++{ ++ struct vc_cma_reserve_user *user = NULL; ++ int delta = 0; ++ int i; ++ ++ if (down_interruptible(&vc_cma_reserve_mutex)) ++ return -ERESTARTSYS; ++ ++ for (i = 0; i < vc_cma_reserve_count; i++) { ++ if (pid == vc_cma_reserve_users[i].pid) { ++ user = &vc_cma_reserve_users[i]; ++ delta = reserve - user->reserve; ++ if (reserve) ++ user->reserve = reserve; ++ else { ++ /* Remove this entry by copying downwards */ ++ while ((i + 1) < vc_cma_reserve_count) { ++ user[0].pid = user[1].pid; ++ user[0].reserve = user[1].reserve; ++ user++; ++ i++; ++ } ++ vc_cma_reserve_count--; ++ user = NULL; ++ } ++ break; ++ } ++ } ++ ++ if (reserve && !user) { ++ if (vc_cma_reserve_count == VC_CMA_RESERVE_COUNT_MAX) { ++ LOG_ERR("vc-cma: Too many reservations - " ++ "increase CMA_RESERVE_COUNT_MAX"); ++ up(&vc_cma_reserve_mutex); ++ return -EBUSY; ++ } ++ user = &vc_cma_reserve_users[vc_cma_reserve_count]; ++ user->pid = pid; ++ user->reserve = reserve; ++ delta = reserve; ++ vc_cma_reserve_count++; ++ } ++ ++ vc_cma_reserve_total += delta; ++ ++ send_vc_msg(VC_CMA_MSG_RESERVE, ++ vc_cma_reserve_total & 0xffff, vc_cma_reserve_total >> 16); ++ ++ send_worker_msg((VCHIQ_HEADER_T *) VC_CMA_MSG_UPDATE_RESERVE); ++ ++ LOG_DBG("/proc/vc-cma: reserve %d (PID %d) - total %u", ++ reserve, pid, vc_cma_reserve_total); ++ ++ up(&vc_cma_reserve_mutex); ++ ++ return vc_cma_reserve_total; ++} ++ ++static VCHIQ_STATUS_T cma_service_callback(VCHIQ_REASON_T reason, ++ VCHIQ_HEADER_T * header, ++ VCHIQ_SERVICE_HANDLE_T service, ++ void *bulk_userdata) ++{ ++ switch (reason) { ++ case VCHIQ_MESSAGE_AVAILABLE: ++ if (!send_worker_msg(header)) ++ return VCHIQ_RETRY; ++ break; ++ case VCHIQ_SERVICE_CLOSED: ++ LOG_DBG("CMA service closed"); ++ break; ++ default: ++ LOG_ERR("Unexpected CMA callback reason %d", reason); ++ break; ++ } ++ return VCHIQ_SUCCESS; ++} ++ ++static void send_vc_msg(unsigned short type, ++ unsigned short param1, unsigned short param2) ++{ ++ unsigned short msg[] = { type, param1, param2 }; ++ VCHIQ_ELEMENT_T elem = { &msg, sizeof(msg) }; ++ VCHIQ_STATUS_T ret; ++ vchiq_use_service(cma_service); ++ ret = vchiq_queue_message(cma_service, &elem, 1); ++ vchiq_release_service(cma_service); ++ if (ret != VCHIQ_SUCCESS) ++ LOG_ERR("vchiq_queue_message returned %x", ret); ++} ++ ++static bool send_worker_msg(VCHIQ_HEADER_T * msg) ++{ ++ if (down_interruptible(&vc_cma_worker_queue_push_mutex)) ++ return false; ++ vchiu_queue_push(&cma_msg_queue, msg); ++ up(&vc_cma_worker_queue_push_mutex); ++ return true; ++} ++ ++static int vc_cma_alloc_chunks(int num_chunks, struct cma_msg *reply) ++{ ++ int i; ++ for (i = 0; i < num_chunks; i++) { ++ struct page *chunk; ++ unsigned int chunk_num; ++ uint8_t *chunk_addr; ++ size_t chunk_size = PAGES_PER_CHUNK << PAGE_SHIFT; ++ ++ chunk = dma_alloc_from_contiguous(&vc_cma_device.dev, ++ PAGES_PER_CHUNK, ++ VC_CMA_CHUNK_ORDER); ++ if (!chunk) ++ break; ++ ++ chunk_addr = page_address(chunk); ++ dmac_flush_range(chunk_addr, chunk_addr + chunk_size); ++ outer_inv_range(__pa(chunk_addr), __pa(chunk_addr) + ++ chunk_size); ++ ++ chunk_num = ++ (page_to_phys(chunk) - vc_cma_base) / VC_CMA_CHUNK_SIZE; ++ BUG_ON(((page_to_phys(chunk) - vc_cma_base) % ++ VC_CMA_CHUNK_SIZE) != 0); ++ if (chunk_num >= vc_cma_chunks) { ++ phys_addr_t _pa = vc_cma_base + vc_cma_size - 1; ++ LOG_ERR("%s: ===============================", ++ __func__); ++ LOG_ERR("%s: chunk phys %x, vc_cma %pa-%pa - " ++ "bad SPARSEMEM configuration?", ++ __func__, (unsigned int)page_to_phys(chunk), ++ &vc_cma_base, &_pa); ++ LOG_ERR("%s: dev->cma_area = %p", __func__, ++ (void*)0/*vc_cma_device.dev.cma_area*/); ++ LOG_ERR("%s: ===============================", ++ __func__); ++ break; ++ } ++ reply->params[i] = chunk_num; ++ vc_cma_chunks_used++; ++ } ++ ++ if (i < num_chunks) { ++ LOG_ERR("%s: dma_alloc_from_contiguous failed " ++ "for %x bytes (alloc %d of %d, %d free)", ++ __func__, VC_CMA_CHUNK_SIZE, i, ++ num_chunks, vc_cma_chunks - vc_cma_chunks_used); ++ num_chunks = i; ++ } ++ ++ LOG_DBG("CMA allocated %d chunks -> %d used", ++ num_chunks, vc_cma_chunks_used); ++ reply->type = VC_CMA_MSG_ALLOCATED; ++ ++ { ++ VCHIQ_ELEMENT_T elem = { ++ reply, ++ offsetof(struct cma_msg, params[0]) + ++ num_chunks * sizeof(reply->params[0]) ++ }; ++ VCHIQ_STATUS_T ret; ++ vchiq_use_service(cma_service); ++ ret = vchiq_queue_message(cma_service, &elem, 1); ++ vchiq_release_service(cma_service); ++ if (ret != VCHIQ_SUCCESS) ++ LOG_ERR("vchiq_queue_message return " "%x", ret); ++ } ++ ++ return num_chunks; ++} ++ ++static int cma_worker_proc(void *param) ++{ ++ static struct cma_msg reply; ++ (void)param; ++ ++ while (1) { ++ VCHIQ_HEADER_T *msg; ++ static struct cma_msg msg_copy; ++ struct cma_msg *cma_msg = &msg_copy; ++ int type, msg_size; ++ ++ msg = vchiu_queue_pop(&cma_msg_queue); ++ if ((unsigned int)msg >= VC_CMA_MSG_MAX) { ++ msg_size = msg->size; ++ memcpy(&msg_copy, msg->data, msg_size); ++ type = cma_msg->type; ++ vchiq_release_message(cma_service, msg); ++ } else { ++ msg_size = 0; ++ type = (int)msg; ++ if (type == VC_CMA_MSG_QUIT) ++ break; ++ else if (type == VC_CMA_MSG_UPDATE_RESERVE) { ++ msg = NULL; ++ cma_msg = NULL; ++ } else { ++ BUG(); ++ continue; ++ } ++ } ++ ++ switch (type) { ++ case VC_CMA_MSG_ALLOC:{ ++ int num_chunks, free_chunks; ++ num_chunks = cma_msg->params[0]; ++ free_chunks = ++ vc_cma_chunks - vc_cma_chunks_used; ++ LOG_DBG("CMA_MSG_ALLOC(%d chunks)", num_chunks); ++ if (num_chunks > VC_CMA_MAX_PARAMS_PER_MSG) { ++ LOG_ERR ++ ("CMA_MSG_ALLOC - chunk count (%d) " ++ "exceeds VC_CMA_MAX_PARAMS_PER_MSG (%d)", ++ num_chunks, ++ VC_CMA_MAX_PARAMS_PER_MSG); ++ num_chunks = VC_CMA_MAX_PARAMS_PER_MSG; ++ } ++ ++ if (num_chunks > free_chunks) { ++ LOG_ERR ++ ("CMA_MSG_ALLOC - chunk count (%d) " ++ "exceeds free chunks (%d)", ++ num_chunks, free_chunks); ++ num_chunks = free_chunks; ++ } ++ ++ vc_cma_alloc_chunks(num_chunks, &reply); ++ } ++ break; ++ ++ case VC_CMA_MSG_FREE:{ ++ int chunk_count = ++ (msg_size - ++ offsetof(struct cma_msg, ++ params)) / ++ sizeof(cma_msg->params[0]); ++ int i; ++ BUG_ON(chunk_count <= 0); ++ ++ LOG_DBG("CMA_MSG_FREE(%d chunks - %x, ...)", ++ chunk_count, cma_msg->params[0]); ++ for (i = 0; i < chunk_count; i++) { ++ int chunk_num = cma_msg->params[i]; ++ struct page *page = vc_cma_base_page + ++ chunk_num * PAGES_PER_CHUNK; ++ if (chunk_num >= vc_cma_chunks) { ++ LOG_ERR ++ ("CMA_MSG_FREE - chunk %d of %d" ++ " (value %x) exceeds maximum " ++ "(%x)", i, chunk_count, ++ chunk_num, ++ vc_cma_chunks - 1); ++ break; ++ } ++ ++ if (!dma_release_from_contiguous ++ (&vc_cma_device.dev, page, ++ PAGES_PER_CHUNK)) { ++ phys_addr_t _pa = page_to_phys(page); ++ LOG_ERR ++ ("CMA_MSG_FREE - failed to " ++ "release chunk %d (phys %pa, " ++ "page %x)", chunk_num, ++ &_pa, ++ (unsigned int)page); ++ } ++ vc_cma_chunks_used--; ++ } ++ LOG_DBG("CMA released %d chunks -> %d used", ++ i, vc_cma_chunks_used); ++ } ++ break; ++ ++ case VC_CMA_MSG_UPDATE_RESERVE:{ ++ int chunks_needed = ++ ((vc_cma_reserve_total + VC_CMA_CHUNK_SIZE - ++ 1) ++ / VC_CMA_CHUNK_SIZE) - ++ vc_cma_chunks_reserved; ++ ++ LOG_DBG ++ ("CMA_MSG_UPDATE_RESERVE(%d chunks needed)", ++ chunks_needed); ++ ++ /* Cap the reservations to what is available */ ++ if (chunks_needed > 0) { ++ if (chunks_needed > ++ (vc_cma_chunks - ++ vc_cma_chunks_used)) ++ chunks_needed = ++ (vc_cma_chunks - ++ vc_cma_chunks_used); ++ ++ chunks_needed = ++ vc_cma_alloc_chunks(chunks_needed, ++ &reply); ++ } ++ ++ LOG_DBG ++ ("CMA_MSG_UPDATE_RESERVE(%d chunks allocated)", ++ chunks_needed); ++ vc_cma_chunks_reserved += chunks_needed; ++ } ++ break; ++ ++ default: ++ LOG_ERR("unexpected msg type %d", type); ++ break; ++ } ++ } ++ ++ LOG_DBG("quitting..."); ++ return 0; ++} ++ ++/**************************************************************************** ++* ++* vc_cma_connected_init ++* ++* This function is called once the videocore has been connected. ++* ++***************************************************************************/ ++ ++static void vc_cma_connected_init(void) ++{ ++ VCHIQ_SERVICE_PARAMS_T service_params; ++ ++ LOG_DBG("vc_cma_connected_init"); ++ ++ if (!vchiu_queue_init(&cma_msg_queue, 16)) { ++ LOG_ERR("could not create CMA msg queue"); ++ goto fail_queue; ++ } ++ ++ if (vchiq_initialise(&cma_instance) != VCHIQ_SUCCESS) ++ goto fail_vchiq_init; ++ ++ vchiq_connect(cma_instance); ++ ++ service_params.fourcc = VC_CMA_FOURCC; ++ service_params.callback = cma_service_callback; ++ service_params.userdata = NULL; ++ service_params.version = VC_CMA_VERSION; ++ service_params.version_min = VC_CMA_VERSION; ++ ++ if (vchiq_open_service(cma_instance, &service_params, ++ &cma_service) != VCHIQ_SUCCESS) { ++ LOG_ERR("failed to open service - already in use?"); ++ goto fail_vchiq_open; ++ } ++ ++ vchiq_release_service(cma_service); ++ ++ cma_worker = kthread_create(cma_worker_proc, NULL, "cma_worker"); ++ if (!cma_worker) { ++ LOG_ERR("could not create CMA worker thread"); ++ goto fail_worker; ++ } ++ set_user_nice(cma_worker, -20); ++ wake_up_process(cma_worker); ++ ++ return; ++ ++fail_worker: ++ vchiq_close_service(cma_service); ++fail_vchiq_open: ++ vchiq_shutdown(cma_instance); ++fail_vchiq_init: ++ vchiu_queue_delete(&cma_msg_queue); ++fail_queue: ++ return; ++} ++ ++void ++loud_error_header(void) ++{ ++ if (in_loud_error) ++ return; ++ ++ LOG_ERR("============================================================" ++ "================"); ++ LOG_ERR("============================================================" ++ "================"); ++ LOG_ERR("====="); ++ ++ in_loud_error = 1; ++} ++ ++void ++loud_error_footer(void) ++{ ++ if (!in_loud_error) ++ return; ++ ++ LOG_ERR("====="); ++ LOG_ERR("============================================================" ++ "================"); ++ LOG_ERR("============================================================" ++ "================"); ++ ++ in_loud_error = 0; ++} ++ ++#if 1 ++static int check_cma_config(void) { return 1; } ++#else ++static int ++read_vc_debug_var(VC_MEM_ACCESS_HANDLE_T handle, ++ const char *symbol, ++ void *buf, size_t bufsize) ++{ ++ VC_MEM_ADDR_T vcMemAddr; ++ size_t vcMemSize; ++ uint8_t *mapAddr; ++ off_t vcMapAddr; ++ ++ if (!LookupVideoCoreSymbol(handle, symbol, ++ &vcMemAddr, ++ &vcMemSize)) { ++ loud_error_header(); ++ loud_error( ++ "failed to find VC symbol \"%s\".", ++ symbol); ++ loud_error_footer(); ++ return 0; ++ } ++ ++ if (vcMemSize != bufsize) { ++ loud_error_header(); ++ loud_error( ++ "VC symbol \"%s\" is the wrong size.", ++ symbol); ++ loud_error_footer(); ++ return 0; ++ } ++ ++ vcMapAddr = (off_t)vcMemAddr & VC_MEM_TO_ARM_ADDR_MASK; ++ vcMapAddr += mm_vc_mem_phys_addr; ++ mapAddr = ioremap_nocache(vcMapAddr, vcMemSize); ++ if (mapAddr == 0) { ++ loud_error_header(); ++ loud_error( ++ "failed to ioremap \"%s\" @ 0x%x " ++ "(phys: 0x%x, size: %u).", ++ symbol, ++ (unsigned int)vcMapAddr, ++ (unsigned int)vcMemAddr, ++ (unsigned int)vcMemSize); ++ loud_error_footer(); ++ return 0; ++ } ++ ++ memcpy(buf, mapAddr, bufsize); ++ iounmap(mapAddr); ++ ++ return 1; ++} ++ ++ ++static int ++check_cma_config(void) ++{ ++ VC_MEM_ACCESS_HANDLE_T mem_hndl; ++ VC_MEM_ADDR_T mempool_start; ++ VC_MEM_ADDR_T mempool_end; ++ VC_MEM_ADDR_T mempool_offline_start; ++ VC_MEM_ADDR_T mempool_offline_end; ++ VC_MEM_ADDR_T cam_alloc_base; ++ VC_MEM_ADDR_T cam_alloc_size; ++ VC_MEM_ADDR_T cam_alloc_end; ++ int success = 0; ++ ++ if (OpenVideoCoreMemory(&mem_hndl) != 0) ++ goto out; ++ ++ /* Read the relevant VideoCore variables */ ++ if (!read_vc_debug_var(mem_hndl, "__MEMPOOL_START", ++ &mempool_start, ++ sizeof(mempool_start))) ++ goto close; ++ ++ if (!read_vc_debug_var(mem_hndl, "__MEMPOOL_END", ++ &mempool_end, ++ sizeof(mempool_end))) ++ goto close; ++ ++ if (!read_vc_debug_var(mem_hndl, "__MEMPOOL_OFFLINE_START", ++ &mempool_offline_start, ++ sizeof(mempool_offline_start))) ++ goto close; ++ ++ if (!read_vc_debug_var(mem_hndl, "__MEMPOOL_OFFLINE_END", ++ &mempool_offline_end, ++ sizeof(mempool_offline_end))) ++ goto close; ++ ++ if (!read_vc_debug_var(mem_hndl, "cam_alloc_base", ++ &cam_alloc_base, ++ sizeof(cam_alloc_base))) ++ goto close; ++ ++ if (!read_vc_debug_var(mem_hndl, "cam_alloc_size", ++ &cam_alloc_size, ++ sizeof(cam_alloc_size))) ++ goto close; ++ ++ cam_alloc_end = cam_alloc_base + cam_alloc_size; ++ ++ success = 1; ++ ++ /* Now the sanity checks */ ++ if (!mempool_offline_start) ++ mempool_offline_start = mempool_start; ++ if (!mempool_offline_end) ++ mempool_offline_end = mempool_end; ++ ++ if (VCADDR_TO_PHYSADDR(mempool_offline_start) != vc_cma_base) { ++ loud_error_header(); ++ loud_error( ++ "__MEMPOOL_OFFLINE_START(%x -> %lx) doesn't match " ++ "vc_cma_base(%x)", ++ mempool_offline_start, ++ VCADDR_TO_PHYSADDR(mempool_offline_start), ++ vc_cma_base); ++ success = 0; ++ } ++ ++ if (VCADDR_TO_PHYSADDR(mempool_offline_end) != ++ (vc_cma_base + vc_cma_size)) { ++ loud_error_header(); ++ loud_error( ++ "__MEMPOOL_OFFLINE_END(%x -> %lx) doesn't match " ++ "vc_cma_base(%x) + vc_cma_size(%x) = %x", ++ mempool_offline_start, ++ VCADDR_TO_PHYSADDR(mempool_offline_end), ++ vc_cma_base, vc_cma_size, vc_cma_base + vc_cma_size); ++ success = 0; ++ } ++ ++ if (mempool_end < mempool_start) { ++ loud_error_header(); ++ loud_error( ++ "__MEMPOOL_END(%x) must not be before " ++ "__MEMPOOL_START(%x)", ++ mempool_end, ++ mempool_start); ++ success = 0; ++ } ++ ++ if (mempool_offline_end < mempool_offline_start) { ++ loud_error_header(); ++ loud_error( ++ "__MEMPOOL_OFFLINE_END(%x) must not be before " ++ "__MEMPOOL_OFFLINE_START(%x)", ++ mempool_offline_end, ++ mempool_offline_start); ++ success = 0; ++ } ++ ++ if (mempool_offline_start < mempool_start) { ++ loud_error_header(); ++ loud_error( ++ "__MEMPOOL_OFFLINE_START(%x) must not be before " ++ "__MEMPOOL_START(%x)", ++ mempool_offline_start, ++ mempool_start); ++ success = 0; ++ } ++ ++ if (mempool_offline_end > mempool_end) { ++ loud_error_header(); ++ loud_error( ++ "__MEMPOOL_OFFLINE_END(%x) must not be after " ++ "__MEMPOOL_END(%x)", ++ mempool_offline_end, ++ mempool_end); ++ success = 0; ++ } ++ ++ if ((cam_alloc_base < mempool_end) && ++ (cam_alloc_end > mempool_start)) { ++ loud_error_header(); ++ loud_error( ++ "cam_alloc pool(%x-%x) overlaps " ++ "mempool(%x-%x)", ++ cam_alloc_base, cam_alloc_end, ++ mempool_start, mempool_end); ++ success = 0; ++ } ++ ++ loud_error_footer(); ++ ++close: ++ CloseVideoCoreMemory(mem_hndl); ++ ++out: ++ return success; ++} ++#endif ++ ++static int vc_cma_init(void) ++{ ++ int rc = -EFAULT; ++ struct device *dev; ++ ++ if (!check_cma_config()) ++ goto out_release; ++ ++ LOG_INFO("vc-cma: Videocore CMA driver"); ++ LOG_INFO("vc-cma: vc_cma_base = %pa", &vc_cma_base); ++ LOG_INFO("vc-cma: vc_cma_size = 0x%08x (%u MiB)", ++ vc_cma_size, vc_cma_size / (1024 * 1024)); ++ LOG_INFO("vc-cma: vc_cma_initial = 0x%08x (%u MiB)", ++ vc_cma_initial, vc_cma_initial / (1024 * 1024)); ++ ++ vc_cma_base_page = phys_to_page(vc_cma_base); ++ ++ if (vc_cma_chunks) { ++ int chunks_needed = vc_cma_initial / VC_CMA_CHUNK_SIZE; ++ ++ for (vc_cma_chunks_used = 0; ++ vc_cma_chunks_used < chunks_needed; vc_cma_chunks_used++) { ++ struct page *chunk; ++ chunk = dma_alloc_from_contiguous(&vc_cma_device.dev, ++ PAGES_PER_CHUNK, ++ VC_CMA_CHUNK_ORDER); ++ if (!chunk) ++ break; ++ BUG_ON(((page_to_phys(chunk) - vc_cma_base) % ++ VC_CMA_CHUNK_SIZE) != 0); ++ } ++ if (vc_cma_chunks_used != chunks_needed) { ++ LOG_ERR("%s: dma_alloc_from_contiguous failed (%d " ++ "bytes, allocation %d of %d)", ++ __func__, VC_CMA_CHUNK_SIZE, ++ vc_cma_chunks_used, chunks_needed); ++ goto out_release; ++ } ++ ++ vchiq_add_connected_callback(vc_cma_connected_init); ++ } ++ ++ rc = alloc_chrdev_region(&vc_cma_devnum, 0, 1, DRIVER_NAME); ++ if (rc < 0) { ++ LOG_ERR("%s: alloc_chrdev_region failed (rc=%d)", __func__, rc); ++ goto out_release; ++ } ++ ++ cdev_init(&vc_cma_cdev, &vc_cma_fops); ++ rc = cdev_add(&vc_cma_cdev, vc_cma_devnum, 1); ++ if (rc != 0) { ++ LOG_ERR("%s: cdev_add failed (rc=%d)", __func__, rc); ++ goto out_unregister; ++ } ++ ++ vc_cma_class = class_create(THIS_MODULE, DRIVER_NAME); ++ if (IS_ERR(vc_cma_class)) { ++ rc = PTR_ERR(vc_cma_class); ++ LOG_ERR("%s: class_create failed (rc=%d)", __func__, rc); ++ goto out_cdev_del; ++ } ++ ++ dev = device_create(vc_cma_class, NULL, vc_cma_devnum, NULL, ++ DRIVER_NAME); ++ if (IS_ERR(dev)) { ++ rc = PTR_ERR(dev); ++ LOG_ERR("%s: device_create failed (rc=%d)", __func__, rc); ++ goto out_class_destroy; ++ } ++ ++ vc_cma_proc_entry = proc_create(DRIVER_NAME, 0444, NULL, &vc_cma_proc_fops); ++ if (vc_cma_proc_entry == NULL) { ++ rc = -EFAULT; ++ LOG_ERR("%s: proc_create failed", __func__); ++ goto out_device_destroy; ++ } ++ ++ vc_cma_inited = 1; ++ return 0; ++ ++out_device_destroy: ++ device_destroy(vc_cma_class, vc_cma_devnum); ++ ++out_class_destroy: ++ class_destroy(vc_cma_class); ++ vc_cma_class = NULL; ++ ++out_cdev_del: ++ cdev_del(&vc_cma_cdev); ++ ++out_unregister: ++ unregister_chrdev_region(vc_cma_devnum, 1); ++ ++out_release: ++ /* It is tempting to try to clean up by calling ++ dma_release_from_contiguous for all allocated chunks, but it isn't ++ a very safe thing to do. If vc_cma_initial is non-zero it is because ++ VideoCore is already using that memory, so giving it back to Linux ++ is likely to be fatal. ++ */ ++ return -1; ++} ++ ++/**************************************************************************** ++* ++* vc_cma_exit ++* ++***************************************************************************/ ++ ++static void __exit vc_cma_exit(void) ++{ ++ LOG_DBG("%s: called", __func__); ++ ++ if (vc_cma_inited) { ++ remove_proc_entry(DRIVER_NAME, NULL); ++ device_destroy(vc_cma_class, vc_cma_devnum); ++ class_destroy(vc_cma_class); ++ cdev_del(&vc_cma_cdev); ++ unregister_chrdev_region(vc_cma_devnum, 1); ++ } ++} ++ ++module_init(vc_cma_init); ++module_exit(vc_cma_exit); ++MODULE_LICENSE("GPL"); ++MODULE_AUTHOR("Broadcom Corporation"); +diff --git a/include/linux/broadcom/vc_cma.h b/include/linux/broadcom/vc_cma.h +new file mode 100644 +index 0000000..be2819d +--- /dev/null ++++ b/include/linux/broadcom/vc_cma.h +@@ -0,0 +1,36 @@ ++/***************************************************************************** ++* Copyright 2012 Broadcom Corporation. All rights reserved. ++* ++* Unless you and Broadcom execute a separate written software license ++* agreement governing use of this software, this software is licensed to you ++* under the terms of the GNU General Public License version 2, available at ++* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). ++* ++* Notwithstanding the above, under no circumstances may you combine this ++* software in any way with any other Broadcom software provided under a ++* license other than the GPL, without Broadcom's express prior written ++* consent. ++*****************************************************************************/ ++ ++#if !defined( VC_CMA_H ) ++#define VC_CMA_H ++ ++#include <linux/ioctl.h> ++ ++#define VC_CMA_IOC_MAGIC 0xc5 ++ ++#define VC_CMA_IOC_RESERVE _IO(VC_CMA_IOC_MAGIC, 0) ++ ++#ifdef __KERNEL__ ++ ++#ifdef CONFIG_BCM_VC_CMA ++void vc_cma_early_init(void); ++void vc_cma_reserve(void); ++#else ++static inline void vc_cma_early_init(void) { } ++static inline void vc_cma_reserve(void) { } ++#endif ++ ++#endif ++ ++#endif /* VC_CMA_H */ + +From b66d625fcacb21a8529ef74eeb6c33e550d841e6 Mon Sep 17 00:00:00 2001 +From: popcornmix <popcornmix@gmail.com> +Date: Mon, 26 Mar 2012 22:15:50 +0100 +Subject: [PATCH 040/112] bcm2708: alsa sound driver +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: popcornmix <popcornmix@gmail.com> + +alsa: add mmap support and some cleanups to bcm2835 ALSA driver + +snd-bcm2835: Add support for spdif/hdmi passthrough + +This adds a dedicated subdevice which can be used for passthrough of non-audio +formats (ie encoded a52) through the hdmi audio link. In addition to this +driver extension an appropriate card config is required to make alsa-lib +support the AES parameters for this device. + +snd-bcm2708: Add mutex, improve logging + +Fix for ALSA driver crash + +Avoids an issue when closing and opening vchiq where a message can arrive before service handle has been written + +alsa: reduce severity of expected warning message + +snd-bcm2708: Fix dmesg spam for non-error case + +alsa: Ensure mutexes are released through error paths + +alsa: Make interrupted close paths quieter + +BCM270x: Add onboard sound device to Device Tree + +Add Device Tree support to alsa driver. +Add device to Device Tree. +Don't add platform devices when booting in DT mode. + +Signed-off-by: Noralf Trønnes <noralf@tronnes.org> + +bcm2835: access controls under the audio mutex + +I don't think the ALSA framework provides any kind of automatic +synchronization within the control callbacks. We most likely need +to ensure this manually, so add locking around all access to shared +mutable data. In particular, bcm2835_audio_set_ctls() should +probably always be called under our own audio lock. +--- + sound/arm/Kconfig | 8 + + sound/arm/Makefile | 5 + + sound/arm/bcm2835-ctl.c | 350 ++++++++++++++ + sound/arm/bcm2835-pcm.c | 561 +++++++++++++++++++++++ + sound/arm/bcm2835-vchiq.c | 902 +++++++++++++++++++++++++++++++++++++ + sound/arm/bcm2835.c | 511 +++++++++++++++++++++ + sound/arm/bcm2835.h | 167 +++++++ + sound/arm/vc_vchi_audioserv_defs.h | 116 +++++ + 8 files changed, 2620 insertions(+) + create mode 100755 sound/arm/bcm2835-ctl.c + create mode 100755 sound/arm/bcm2835-pcm.c + create mode 100755 sound/arm/bcm2835-vchiq.c + create mode 100644 sound/arm/bcm2835.c + create mode 100755 sound/arm/bcm2835.h + create mode 100644 sound/arm/vc_vchi_audioserv_defs.h + +diff --git a/sound/arm/Kconfig b/sound/arm/Kconfig +index e040621..7746e5d2 100644 +--- a/sound/arm/Kconfig ++++ b/sound/arm/Kconfig +@@ -40,5 +40,13 @@ config SND_PXA2XX_AC97 + Say Y or M if you want to support any AC97 codec attached to + the PXA2xx AC97 interface. + ++config SND_BCM2835 ++ tristate "BCM2835 ALSA driver" ++ depends on (ARCH_BCM2708 || ARCH_BCM2709 || ARCH_BCM2835) \ ++ && BCM2708_VCHIQ && SND ++ select SND_PCM ++ help ++ Say Y or M if you want to support BCM2835 Alsa pcm card driver ++ + endif # SND_ARM + +diff --git a/sound/arm/Makefile b/sound/arm/Makefile +index 8c0c851..6796d7f 100644 +--- a/sound/arm/Makefile ++++ b/sound/arm/Makefile +@@ -14,3 +14,8 @@ snd-pxa2xx-lib-$(CONFIG_SND_PXA2XX_LIB_AC97) += pxa2xx-ac97-lib.o + + obj-$(CONFIG_SND_PXA2XX_AC97) += snd-pxa2xx-ac97.o + snd-pxa2xx-ac97-objs := pxa2xx-ac97.o ++ ++obj-$(CONFIG_SND_BCM2835) += snd-bcm2835.o ++snd-bcm2835-objs := bcm2835.o bcm2835-ctl.o bcm2835-pcm.o bcm2835-vchiq.o ++ ++ccflags-y += -Idrivers/misc/vc04_services -Idrivers/misc/vc04_services/interface/vcos/linuxkernel -D__VCCOREVER__=0x04000000 +diff --git a/sound/arm/bcm2835-ctl.c b/sound/arm/bcm2835-ctl.c +new file mode 100755 +index 0000000..75dc322 +--- /dev/null ++++ b/sound/arm/bcm2835-ctl.c +@@ -0,0 +1,350 @@ ++/***************************************************************************** ++* Copyright 2011 Broadcom Corporation. All rights reserved. ++* ++* Unless you and Broadcom execute a separate written software license ++* agreement governing use of this software, this software is licensed to you ++* under the terms of the GNU General Public License version 2, available at ++* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). ++* ++* Notwithstanding the above, under no circumstances may you combine this ++* software in any way with any other Broadcom software provided under a ++* license other than the GPL, without Broadcom's express prior written ++* consent. ++*****************************************************************************/ ++ ++#include <linux/platform_device.h> ++#include <linux/init.h> ++#include <linux/io.h> ++#include <linux/jiffies.h> ++#include <linux/slab.h> ++#include <linux/time.h> ++#include <linux/wait.h> ++#include <linux/delay.h> ++#include <linux/moduleparam.h> ++#include <linux/sched.h> ++ ++#include <sound/core.h> ++#include <sound/control.h> ++#include <sound/pcm.h> ++#include <sound/pcm_params.h> ++#include <sound/rawmidi.h> ++#include <sound/initval.h> ++#include <sound/tlv.h> ++#include <sound/asoundef.h> ++ ++#include "bcm2835.h" ++ ++/* volume maximum and minimum in terms of 0.01dB */ ++#define CTRL_VOL_MAX 400 ++#define CTRL_VOL_MIN -10239 /* originally -10240 */ ++ ++ ++static int snd_bcm2835_ctl_info(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_info *uinfo) ++{ ++ audio_info(" ... IN\n"); ++ if (kcontrol->private_value == PCM_PLAYBACK_VOLUME) { ++ uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; ++ uinfo->count = 1; ++ uinfo->value.integer.min = CTRL_VOL_MIN; ++ uinfo->value.integer.max = CTRL_VOL_MAX; /* 2303 */ ++ } else if (kcontrol->private_value == PCM_PLAYBACK_MUTE) { ++ uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; ++ uinfo->count = 1; ++ uinfo->value.integer.min = 0; ++ uinfo->value.integer.max = 1; ++ } else if (kcontrol->private_value == PCM_PLAYBACK_DEVICE) { ++ uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; ++ uinfo->count = 1; ++ uinfo->value.integer.min = 0; ++ uinfo->value.integer.max = AUDIO_DEST_MAX-1; ++ } ++ audio_info(" ... OUT\n"); ++ return 0; ++} ++ ++/* toggles mute on or off depending on the value of nmute, and returns ++ * 1 if the mute value was changed, otherwise 0 ++ */ ++static int toggle_mute(struct bcm2835_chip *chip, int nmute) ++{ ++ /* if settings are ok, just return 0 */ ++ if(chip->mute == nmute) ++ return 0; ++ ++ /* if the sound is muted then we need to unmute */ ++ if(chip->mute == CTRL_VOL_MUTE) ++ { ++ chip->volume = chip->old_volume; /* copy the old volume back */ ++ audio_info("Unmuting, old_volume = %d, volume = %d ...\n", chip->old_volume, chip->volume); ++ } ++ else /* otherwise we mute */ ++ { ++ chip->old_volume = chip->volume; ++ chip->volume = 26214; /* set volume to minimum level AKA mute */ ++ audio_info("Muting, old_volume = %d, volume = %d ...\n", chip->old_volume, chip->volume); ++ } ++ ++ chip->mute = nmute; ++ return 1; ++} ++ ++static int snd_bcm2835_ctl_get(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol) ++{ ++ struct bcm2835_chip *chip = snd_kcontrol_chip(kcontrol); ++ ++ if (mutex_lock_interruptible(&chip->audio_mutex)) ++ return -EINTR; ++ ++ BUG_ON(!chip && !(chip->avail_substreams & AVAIL_SUBSTREAMS_MASK)); ++ ++ if (kcontrol->private_value == PCM_PLAYBACK_VOLUME) ++ ucontrol->value.integer.value[0] = chip2alsa(chip->volume); ++ else if (kcontrol->private_value == PCM_PLAYBACK_MUTE) ++ ucontrol->value.integer.value[0] = chip->mute; ++ else if (kcontrol->private_value == PCM_PLAYBACK_DEVICE) ++ ucontrol->value.integer.value[0] = chip->dest; ++ ++ mutex_unlock(&chip->audio_mutex); ++ return 0; ++} ++ ++static int snd_bcm2835_ctl_put(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol) ++{ ++ struct bcm2835_chip *chip = snd_kcontrol_chip(kcontrol); ++ int changed = 0; ++ ++ if (mutex_lock_interruptible(&chip->audio_mutex)) ++ return -EINTR; ++ ++ if (kcontrol->private_value == PCM_PLAYBACK_VOLUME) { ++ audio_info("Volume change attempted.. volume = %d new_volume = %d\n", chip->volume, (int)ucontrol->value.integer.value[0]); ++ if (chip->mute == CTRL_VOL_MUTE) { ++ /* changed = toggle_mute(chip, CTRL_VOL_UNMUTE); */ ++ changed = 1; /* should return 0 to signify no change but the mixer takes this as the opposite sign (no idea why) */ ++ goto unlock; ++ } ++ if (changed ++ || (ucontrol->value.integer.value[0] != chip2alsa(chip->volume))) { ++ ++ chip->volume = alsa2chip(ucontrol->value.integer.value[0]); ++ changed = 1; ++ } ++ ++ } else if (kcontrol->private_value == PCM_PLAYBACK_MUTE) { ++ /* Now implemented */ ++ audio_info(" Mute attempted\n"); ++ changed = toggle_mute(chip, ucontrol->value.integer.value[0]); ++ ++ } else if (kcontrol->private_value == PCM_PLAYBACK_DEVICE) { ++ if (ucontrol->value.integer.value[0] != chip->dest) { ++ chip->dest = ucontrol->value.integer.value[0]; ++ changed = 1; ++ } ++ } ++ ++ if (changed) { ++ if (bcm2835_audio_set_ctls(chip)) ++ printk(KERN_ERR "Failed to set ALSA controls..\n"); ++ } ++ ++unlock: ++ mutex_unlock(&chip->audio_mutex); ++ return changed; ++} ++ ++static DECLARE_TLV_DB_SCALE(snd_bcm2835_db_scale, CTRL_VOL_MIN, 1, 1); ++ ++static struct snd_kcontrol_new snd_bcm2835_ctl[] = { ++ { ++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, ++ .name = "PCM Playback Volume", ++ .index = 0, ++ .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_TLV_READ, ++ .private_value = PCM_PLAYBACK_VOLUME, ++ .info = snd_bcm2835_ctl_info, ++ .get = snd_bcm2835_ctl_get, ++ .put = snd_bcm2835_ctl_put, ++ .count = 1, ++ .tlv = {.p = snd_bcm2835_db_scale} ++ }, ++ { ++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, ++ .name = "PCM Playback Switch", ++ .index = 0, ++ .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, ++ .private_value = PCM_PLAYBACK_MUTE, ++ .info = snd_bcm2835_ctl_info, ++ .get = snd_bcm2835_ctl_get, ++ .put = snd_bcm2835_ctl_put, ++ .count = 1, ++ }, ++ { ++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, ++ .name = "PCM Playback Route", ++ .index = 0, ++ .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, ++ .private_value = PCM_PLAYBACK_DEVICE, ++ .info = snd_bcm2835_ctl_info, ++ .get = snd_bcm2835_ctl_get, ++ .put = snd_bcm2835_ctl_put, ++ .count = 1, ++ }, ++}; ++ ++static int snd_bcm2835_spdif_default_info(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_info *uinfo) ++{ ++ uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958; ++ uinfo->count = 1; ++ return 0; ++} ++ ++static int snd_bcm2835_spdif_default_get(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol) ++{ ++ struct bcm2835_chip *chip = snd_kcontrol_chip(kcontrol); ++ int i; ++ ++ if (mutex_lock_interruptible(&chip->audio_mutex)) ++ return -EINTR; ++ ++ for (i = 0; i < 4; i++) ++ ucontrol->value.iec958.status[i] = ++ (chip->spdif_status >> (i * 8)) && 0xff; ++ ++ mutex_unlock(&chip->audio_mutex); ++ return 0; ++} ++ ++static int snd_bcm2835_spdif_default_put(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol) ++{ ++ struct bcm2835_chip *chip = snd_kcontrol_chip(kcontrol); ++ unsigned int val = 0; ++ int i, change; ++ ++ if (mutex_lock_interruptible(&chip->audio_mutex)) ++ return -EINTR; ++ ++ for (i = 0; i < 4; i++) ++ val |= (unsigned int)ucontrol->value.iec958.status[i] << (i * 8); ++ ++ change = val != chip->spdif_status; ++ chip->spdif_status = val; ++ ++ mutex_unlock(&chip->audio_mutex); ++ return change; ++} ++ ++static int snd_bcm2835_spdif_mask_info(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_info *uinfo) ++{ ++ uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958; ++ uinfo->count = 1; ++ return 0; ++} ++ ++static int snd_bcm2835_spdif_mask_get(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol) ++{ ++ /* bcm2835 supports only consumer mode and sets all other format flags ++ * automatically. So the only thing left is signalling non-audio ++ * content */ ++ ucontrol->value.iec958.status[0] = IEC958_AES0_NONAUDIO; ++ return 0; ++} ++ ++static int snd_bcm2835_spdif_stream_info(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_info *uinfo) ++{ ++ uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958; ++ uinfo->count = 1; ++ return 0; ++} ++ ++static int snd_bcm2835_spdif_stream_get(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol) ++{ ++ struct bcm2835_chip *chip = snd_kcontrol_chip(kcontrol); ++ int i; ++ ++ if (mutex_lock_interruptible(&chip->audio_mutex)) ++ return -EINTR; ++ ++ for (i = 0; i < 4; i++) ++ ucontrol->value.iec958.status[i] = ++ (chip->spdif_status >> (i * 8)) & 0xff; ++ ++ mutex_unlock(&chip->audio_mutex); ++ return 0; ++} ++ ++static int snd_bcm2835_spdif_stream_put(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol) ++{ ++ struct bcm2835_chip *chip = snd_kcontrol_chip(kcontrol); ++ unsigned int val = 0; ++ int i, change; ++ ++ if (mutex_lock_interruptible(&chip->audio_mutex)) ++ return -EINTR; ++ ++ for (i = 0; i < 4; i++) ++ val |= (unsigned int)ucontrol->value.iec958.status[i] << (i * 8); ++ change = val != chip->spdif_status; ++ chip->spdif_status = val; ++ ++ mutex_unlock(&chip->audio_mutex); ++ return change; ++} ++ ++static struct snd_kcontrol_new snd_bcm2835_spdif[] = { ++ { ++ .iface = SNDRV_CTL_ELEM_IFACE_PCM, ++ .name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, DEFAULT), ++ .info = snd_bcm2835_spdif_default_info, ++ .get = snd_bcm2835_spdif_default_get, ++ .put = snd_bcm2835_spdif_default_put ++ }, ++ { ++ .access = SNDRV_CTL_ELEM_ACCESS_READ, ++ .iface = SNDRV_CTL_ELEM_IFACE_PCM, ++ .name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, CON_MASK), ++ .info = snd_bcm2835_spdif_mask_info, ++ .get = snd_bcm2835_spdif_mask_get, ++ }, ++ { ++ .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | ++ SNDRV_CTL_ELEM_ACCESS_INACTIVE, ++ .iface = SNDRV_CTL_ELEM_IFACE_PCM, ++ .name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, PCM_STREAM), ++ .info = snd_bcm2835_spdif_stream_info, ++ .get = snd_bcm2835_spdif_stream_get, ++ .put = snd_bcm2835_spdif_stream_put, ++ }, ++}; ++ ++int snd_bcm2835_new_ctl(bcm2835_chip_t * chip) ++{ ++ int err; ++ unsigned int idx; ++ ++ strcpy(chip->card->mixername, "Broadcom Mixer"); ++ for (idx = 0; idx < ARRAY_SIZE(snd_bcm2835_ctl); idx++) { ++ err = ++ snd_ctl_add(chip->card, ++ snd_ctl_new1(&snd_bcm2835_ctl[idx], chip)); ++ if (err < 0) ++ return err; ++ } ++ for (idx = 0; idx < ARRAY_SIZE(snd_bcm2835_spdif); idx++) { ++ err = snd_ctl_add(chip->card, ++ snd_ctl_new1(&snd_bcm2835_spdif[idx], chip)); ++ if (err < 0) ++ return err; ++ } ++ return 0; ++} +diff --git a/sound/arm/bcm2835-pcm.c b/sound/arm/bcm2835-pcm.c +new file mode 100755 +index 0000000..d2de13c +--- /dev/null ++++ b/sound/arm/bcm2835-pcm.c +@@ -0,0 +1,561 @@ ++/***************************************************************************** ++* Copyright 2011 Broadcom Corporation. All rights reserved. ++* ++* Unless you and Broadcom execute a separate written software license ++* agreement governing use of this software, this software is licensed to you ++* under the terms of the GNU General Public License version 2, available at ++* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). ++* ++* Notwithstanding the above, under no circumstances may you combine this ++* software in any way with any other Broadcom software provided under a ++* license other than the GPL, without Broadcom's express prior written ++* consent. ++*****************************************************************************/ ++ ++#include <linux/interrupt.h> ++#include <linux/slab.h> ++ ++#include <sound/asoundef.h> ++ ++#include "bcm2835.h" ++ ++/* hardware definition */ ++static struct snd_pcm_hardware snd_bcm2835_playback_hw = { ++ .info = (SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | ++ SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID), ++ .formats = SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE, ++ .rates = SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_8000_48000, ++ .rate_min = 8000, ++ .rate_max = 48000, ++ .channels_min = 1, ++ .channels_max = 2, ++ .buffer_bytes_max = 128 * 1024, ++ .period_bytes_min = 1 * 1024, ++ .period_bytes_max = 128 * 1024, ++ .periods_min = 1, ++ .periods_max = 128, ++}; ++ ++static struct snd_pcm_hardware snd_bcm2835_playback_spdif_hw = { ++ .info = (SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | ++ SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID), ++ .formats = SNDRV_PCM_FMTBIT_S16_LE, ++ .rates = SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_44100 | ++ SNDRV_PCM_RATE_48000, ++ .rate_min = 44100, ++ .rate_max = 48000, ++ .channels_min = 2, ++ .channels_max = 2, ++ .buffer_bytes_max = 128 * 1024, ++ .period_bytes_min = 1 * 1024, ++ .period_bytes_max = 128 * 1024, ++ .periods_min = 1, ++ .periods_max = 128, ++}; ++ ++static void snd_bcm2835_playback_free(struct snd_pcm_runtime *runtime) ++{ ++ audio_info("Freeing up alsa stream here ..\n"); ++ if (runtime->private_data) ++ kfree(runtime->private_data); ++ runtime->private_data = NULL; ++} ++ ++static irqreturn_t bcm2835_playback_fifo_irq(int irq, void *dev_id) ++{ ++ bcm2835_alsa_stream_t *alsa_stream = (bcm2835_alsa_stream_t *) dev_id; ++ uint32_t consumed = 0; ++ int new_period = 0; ++ ++ audio_info(" .. IN\n"); ++ ++ audio_info("alsa_stream=%p substream=%p\n", alsa_stream, ++ alsa_stream ? alsa_stream->substream : 0); ++ ++ if (alsa_stream->open) ++ consumed = bcm2835_audio_retrieve_buffers(alsa_stream); ++ ++ /* We get called only if playback was triggered, So, the number of buffers we retrieve in ++ * each iteration are the buffers that have been played out already ++ */ ++ ++ if (alsa_stream->period_size) { ++ if ((alsa_stream->pos / alsa_stream->period_size) != ++ ((alsa_stream->pos + consumed) / alsa_stream->period_size)) ++ new_period = 1; ++ } ++ audio_debug("updating pos cur: %d + %d max:%d period_bytes:%d, hw_ptr: %d new_period:%d\n", ++ alsa_stream->pos, ++ consumed, ++ alsa_stream->buffer_size, ++ (int)(alsa_stream->period_size*alsa_stream->substream->runtime->periods), ++ frames_to_bytes(alsa_stream->substream->runtime, alsa_stream->substream->runtime->status->hw_ptr), ++ new_period); ++ if (alsa_stream->buffer_size) { ++ alsa_stream->pos += consumed &~ (1<<30); ++ alsa_stream->pos %= alsa_stream->buffer_size; ++ } ++ ++ if (alsa_stream->substream) { ++ if (new_period) ++ snd_pcm_period_elapsed(alsa_stream->substream); ++ } else { ++ audio_warning(" unexpected NULL substream\n"); ++ } ++ audio_info(" .. OUT\n"); ++ ++ return IRQ_HANDLED; ++} ++ ++/* open callback */ ++static int snd_bcm2835_playback_open_generic( ++ struct snd_pcm_substream *substream, int spdif) ++{ ++ bcm2835_chip_t *chip = snd_pcm_substream_chip(substream); ++ struct snd_pcm_runtime *runtime = substream->runtime; ++ bcm2835_alsa_stream_t *alsa_stream; ++ int idx; ++ int err; ++ ++ audio_info(" .. IN (%d)\n", substream->number); ++ ++ if(mutex_lock_interruptible(&chip->audio_mutex)) ++ { ++ audio_error("Interrupted whilst waiting for lock\n"); ++ return -EINTR; ++ } ++ audio_info("Alsa open (%d)\n", substream->number); ++ idx = substream->number; ++ ++ if (spdif && chip->opened != 0) { ++ err = -EBUSY; ++ goto out; ++ } ++ else if (!spdif && (chip->opened & (1 << idx))) { ++ err = -EBUSY; ++ goto out; ++ } ++ if (idx > MAX_SUBSTREAMS) { ++ audio_error ++ ("substream(%d) device doesn't exist max(%d) substreams allowed\n", ++ idx, MAX_SUBSTREAMS); ++ err = -ENODEV; ++ goto out; ++ } ++ ++ /* Check if we are ready */ ++ if (!(chip->avail_substreams & (1 << idx))) { ++ /* We are not ready yet */ ++ audio_error("substream(%d) device is not ready yet\n", idx); ++ err = -EAGAIN; ++ goto out; ++ } ++ ++ alsa_stream = kzalloc(sizeof(bcm2835_alsa_stream_t), GFP_KERNEL); ++ if (alsa_stream == NULL) { ++ err = -ENOMEM; ++ goto out; ++ } ++ ++ /* Initialise alsa_stream */ ++ alsa_stream->chip = chip; ++ alsa_stream->substream = substream; ++ alsa_stream->idx = idx; ++ ++ sema_init(&alsa_stream->buffers_update_sem, 0); ++ sema_init(&alsa_stream->control_sem, 0); ++ spin_lock_init(&alsa_stream->lock); ++ ++ /* Enabled in start trigger, called on each "fifo irq" after that */ ++ alsa_stream->enable_fifo_irq = 0; ++ alsa_stream->fifo_irq_handler = bcm2835_playback_fifo_irq; ++ ++ err = bcm2835_audio_open(alsa_stream); ++ if (err != 0) { ++ kfree(alsa_stream); ++ goto out; ++ } ++ runtime->private_data = alsa_stream; ++ runtime->private_free = snd_bcm2835_playback_free; ++ if (spdif) { ++ runtime->hw = snd_bcm2835_playback_spdif_hw; ++ } else { ++ /* clear spdif status, as we are not in spdif mode */ ++ chip->spdif_status = 0; ++ runtime->hw = snd_bcm2835_playback_hw; ++ } ++ /* minimum 16 bytes alignment (for vchiq bulk transfers) */ ++ snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, ++ 16); ++ ++ chip->alsa_stream[idx] = alsa_stream; ++ ++ chip->opened |= (1 << idx); ++ alsa_stream->open = 1; ++ alsa_stream->draining = 1; ++ ++out: ++ mutex_unlock(&chip->audio_mutex); ++ ++ audio_info(" .. OUT =%d\n", err); ++ ++ return err; ++} ++ ++static int snd_bcm2835_playback_open(struct snd_pcm_substream *substream) ++{ ++ return snd_bcm2835_playback_open_generic(substream, 0); ++} ++ ++static int snd_bcm2835_playback_spdif_open(struct snd_pcm_substream *substream) ++{ ++ return snd_bcm2835_playback_open_generic(substream, 1); ++} ++ ++/* close callback */ ++static int snd_bcm2835_playback_close(struct snd_pcm_substream *substream) ++{ ++ /* the hardware-specific codes will be here */ ++ ++ bcm2835_chip_t *chip; ++ struct snd_pcm_runtime *runtime; ++ bcm2835_alsa_stream_t *alsa_stream; ++ ++ audio_info(" .. IN\n"); ++ ++ chip = snd_pcm_substream_chip(substream); ++ if(mutex_lock_interruptible(&chip->audio_mutex)) ++ { ++ audio_error("Interrupted whilst waiting for lock\n"); ++ return -EINTR; ++ } ++ runtime = substream->runtime; ++ alsa_stream = runtime->private_data; ++ ++ audio_info("Alsa close\n"); ++ ++ /* ++ * Call stop if it's still running. This happens when app ++ * is force killed and we don't get a stop trigger. ++ */ ++ if (alsa_stream->running) { ++ int err; ++ err = bcm2835_audio_stop(alsa_stream); ++ alsa_stream->running = 0; ++ if (err != 0) ++ audio_error(" Failed to STOP alsa device\n"); ++ } ++ ++ alsa_stream->period_size = 0; ++ alsa_stream->buffer_size = 0; ++ ++ if (alsa_stream->open) { ++ alsa_stream->open = 0; ++ bcm2835_audio_close(alsa_stream); ++ } ++ if (alsa_stream->chip) ++ alsa_stream->chip->alsa_stream[alsa_stream->idx] = NULL; ++ /* ++ * Do not free up alsa_stream here, it will be freed up by ++ * runtime->private_free callback we registered in *_open above ++ */ ++ ++ chip->opened &= ~(1 << substream->number); ++ ++ mutex_unlock(&chip->audio_mutex); ++ audio_info(" .. OUT\n"); ++ ++ return 0; ++} ++ ++/* hw_params callback */ ++static int snd_bcm2835_pcm_hw_params(struct snd_pcm_substream *substream, ++ struct snd_pcm_hw_params *params) ++{ ++ struct snd_pcm_runtime *runtime = substream->runtime; ++ bcm2835_alsa_stream_t *alsa_stream = runtime->private_data; ++ int err; ++ ++ audio_info(" .. IN\n"); ++ ++ err = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(params)); ++ if (err < 0) { ++ audio_error ++ (" pcm_lib_malloc failed to allocated pages for buffers\n"); ++ return err; ++ } ++ ++ alsa_stream->channels = params_channels(params); ++ alsa_stream->params_rate = params_rate(params); ++ alsa_stream->pcm_format_width = snd_pcm_format_width(params_format (params)); ++ audio_info(" .. OUT\n"); ++ ++ return err; ++} ++ ++/* hw_free callback */ ++static int snd_bcm2835_pcm_hw_free(struct snd_pcm_substream *substream) ++{ ++ audio_info(" .. IN\n"); ++ return snd_pcm_lib_free_pages(substream); ++} ++ ++/* prepare callback */ ++static int snd_bcm2835_pcm_prepare(struct snd_pcm_substream *substream) ++{ ++ bcm2835_chip_t *chip = snd_pcm_substream_chip(substream); ++ struct snd_pcm_runtime *runtime = substream->runtime; ++ bcm2835_alsa_stream_t *alsa_stream = runtime->private_data; ++ int channels; ++ int err; ++ ++ audio_info(" .. IN\n"); ++ ++ if (mutex_lock_interruptible(&chip->audio_mutex)) ++ return -EINTR; ++ ++ /* notify the vchiq that it should enter spdif passthrough mode by ++ * setting channels=0 (see ++ * https://github.com/raspberrypi/linux/issues/528) */ ++ if (chip->spdif_status & IEC958_AES0_NONAUDIO) ++ channels = 0; ++ else ++ channels = alsa_stream->channels; ++ ++ err = bcm2835_audio_set_params(alsa_stream, channels, ++ alsa_stream->params_rate, ++ alsa_stream->pcm_format_width); ++ if (err < 0) { ++ audio_error(" error setting hw params\n"); ++ } ++ ++ bcm2835_audio_setup(alsa_stream); ++ ++ /* in preparation of the stream, set the controls (volume level) of the stream */ ++ bcm2835_audio_set_ctls(alsa_stream->chip); ++ ++ ++ memset(&alsa_stream->pcm_indirect, 0, sizeof(alsa_stream->pcm_indirect)); ++ ++ alsa_stream->pcm_indirect.hw_buffer_size = ++ alsa_stream->pcm_indirect.sw_buffer_size = ++ snd_pcm_lib_buffer_bytes(substream); ++ ++ alsa_stream->buffer_size = snd_pcm_lib_buffer_bytes(substream); ++ alsa_stream->period_size = snd_pcm_lib_period_bytes(substream); ++ alsa_stream->pos = 0; ++ ++ audio_debug("buffer_size=%d, period_size=%d pos=%d frame_bits=%d\n", ++ alsa_stream->buffer_size, alsa_stream->period_size, ++ alsa_stream->pos, runtime->frame_bits); ++ ++ mutex_unlock(&chip->audio_mutex); ++ audio_info(" .. OUT\n"); ++ return 0; ++} ++ ++static void snd_bcm2835_pcm_transfer(struct snd_pcm_substream *substream, ++ struct snd_pcm_indirect *rec, size_t bytes) ++{ ++ struct snd_pcm_runtime *runtime = substream->runtime; ++ bcm2835_alsa_stream_t *alsa_stream = runtime->private_data; ++ void *src = (void *)(substream->runtime->dma_area + rec->sw_data); ++ int err; ++ ++ err = bcm2835_audio_write(alsa_stream, bytes, src); ++ if (err) ++ audio_error(" Failed to transfer to alsa device (%d)\n", err); ++ ++} ++ ++static int snd_bcm2835_pcm_ack(struct snd_pcm_substream *substream) ++{ ++ struct snd_pcm_runtime *runtime = substream->runtime; ++ bcm2835_alsa_stream_t *alsa_stream = runtime->private_data; ++ struct snd_pcm_indirect *pcm_indirect = &alsa_stream->pcm_indirect; ++ ++ pcm_indirect->hw_queue_size = runtime->hw.buffer_bytes_max; ++ snd_pcm_indirect_playback_transfer(substream, pcm_indirect, ++ snd_bcm2835_pcm_transfer); ++ return 0; ++} ++ ++/* trigger callback */ ++static int snd_bcm2835_pcm_trigger(struct snd_pcm_substream *substream, int cmd) ++{ ++ struct snd_pcm_runtime *runtime = substream->runtime; ++ bcm2835_alsa_stream_t *alsa_stream = runtime->private_data; ++ int err = 0; ++ ++ audio_info(" .. IN\n"); ++ ++ switch (cmd) { ++ case SNDRV_PCM_TRIGGER_START: ++ audio_debug("bcm2835_AUDIO_TRIGGER_START running=%d\n", ++ alsa_stream->running); ++ if (!alsa_stream->running) { ++ err = bcm2835_audio_start(alsa_stream); ++ if (err == 0) { ++ alsa_stream->pcm_indirect.hw_io = ++ alsa_stream->pcm_indirect.hw_data = ++ bytes_to_frames(runtime, ++ alsa_stream->pos); ++ substream->ops->ack(substream); ++ alsa_stream->running = 1; ++ alsa_stream->draining = 1; ++ } else { ++ audio_error(" Failed to START alsa device (%d)\n", err); ++ } ++ } ++ break; ++ case SNDRV_PCM_TRIGGER_STOP: ++ audio_debug ++ ("bcm2835_AUDIO_TRIGGER_STOP running=%d draining=%d\n", ++ alsa_stream->running, runtime->status->state == SNDRV_PCM_STATE_DRAINING); ++ if (runtime->status->state == SNDRV_PCM_STATE_DRAINING) { ++ audio_info("DRAINING\n"); ++ alsa_stream->draining = 1; ++ } else { ++ audio_info("DROPPING\n"); ++ alsa_stream->draining = 0; ++ } ++ if (alsa_stream->running) { ++ err = bcm2835_audio_stop(alsa_stream); ++ if (err != 0) ++ audio_error(" Failed to STOP alsa device (%d)\n", err); ++ alsa_stream->running = 0; ++ } ++ break; ++ default: ++ err = -EINVAL; ++ } ++ ++ audio_info(" .. OUT\n"); ++ return err; ++} ++ ++/* pointer callback */ ++static snd_pcm_uframes_t ++snd_bcm2835_pcm_pointer(struct snd_pcm_substream *substream) ++{ ++ struct snd_pcm_runtime *runtime = substream->runtime; ++ bcm2835_alsa_stream_t *alsa_stream = runtime->private_data; ++ ++ audio_info(" .. IN\n"); ++ ++ audio_debug("pcm_pointer... (%d) hwptr=%d appl=%d pos=%d\n", 0, ++ frames_to_bytes(runtime, runtime->status->hw_ptr), ++ frames_to_bytes(runtime, runtime->control->appl_ptr), ++ alsa_stream->pos); ++ ++ audio_info(" .. OUT\n"); ++ return snd_pcm_indirect_playback_pointer(substream, ++ &alsa_stream->pcm_indirect, ++ alsa_stream->pos); ++} ++ ++static int snd_bcm2835_pcm_lib_ioctl(struct snd_pcm_substream *substream, ++ unsigned int cmd, void *arg) ++{ ++ int ret = snd_pcm_lib_ioctl(substream, cmd, arg); ++ audio_info(" .. substream=%p, cmd=%d, arg=%p (%x) ret=%d\n", substream, ++ cmd, arg, arg ? *(unsigned *)arg : 0, ret); ++ return ret; ++} ++ ++/* operators */ ++static struct snd_pcm_ops snd_bcm2835_playback_ops = { ++ .open = snd_bcm2835_playback_open, ++ .close = snd_bcm2835_playback_close, ++ .ioctl = snd_bcm2835_pcm_lib_ioctl, ++ .hw_params = snd_bcm2835_pcm_hw_params, ++ .hw_free = snd_bcm2835_pcm_hw_free, ++ .prepare = snd_bcm2835_pcm_prepare, ++ .trigger = snd_bcm2835_pcm_trigger, ++ .pointer = snd_bcm2835_pcm_pointer, ++ .ack = snd_bcm2835_pcm_ack, ++}; ++ ++static struct snd_pcm_ops snd_bcm2835_playback_spdif_ops = { ++ .open = snd_bcm2835_playback_spdif_open, ++ .close = snd_bcm2835_playback_close, ++ .ioctl = snd_bcm2835_pcm_lib_ioctl, ++ .hw_params = snd_bcm2835_pcm_hw_params, ++ .hw_free = snd_bcm2835_pcm_hw_free, ++ .prepare = snd_bcm2835_pcm_prepare, ++ .trigger = snd_bcm2835_pcm_trigger, ++ .pointer = snd_bcm2835_pcm_pointer, ++ .ack = snd_bcm2835_pcm_ack, ++}; ++ ++/* create a pcm device */ ++int snd_bcm2835_new_pcm(bcm2835_chip_t * chip) ++{ ++ struct snd_pcm *pcm; ++ int err; ++ ++ audio_info(" .. IN\n"); ++ mutex_init(&chip->audio_mutex); ++ if(mutex_lock_interruptible(&chip->audio_mutex)) ++ { ++ audio_error("Interrupted whilst waiting for lock\n"); ++ return -EINTR; ++ } ++ err = ++ snd_pcm_new(chip->card, "bcm2835 ALSA", 0, MAX_SUBSTREAMS, 0, &pcm); ++ if (err < 0) ++ goto out; ++ pcm->private_data = chip; ++ strcpy(pcm->name, "bcm2835 ALSA"); ++ chip->pcm = pcm; ++ chip->dest = AUDIO_DEST_AUTO; ++ chip->volume = alsa2chip(0); ++ chip->mute = CTRL_VOL_UNMUTE; /*disable mute on startup */ ++ /* set operators */ ++ snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, ++ &snd_bcm2835_playback_ops); ++ ++ /* pre-allocation of buffers */ ++ /* NOTE: this may fail */ ++ snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_CONTINUOUS, ++ snd_dma_continuous_data ++ (GFP_KERNEL), 64 * 1024, ++ 64 * 1024); ++ ++out: ++ mutex_unlock(&chip->audio_mutex); ++ audio_info(" .. OUT\n"); ++ ++ return 0; ++} ++ ++int snd_bcm2835_new_spdif_pcm(bcm2835_chip_t * chip) ++{ ++ struct snd_pcm *pcm; ++ int err; ++ ++ audio_info(" .. IN\n"); ++ if(mutex_lock_interruptible(&chip->audio_mutex)) ++ { ++ audio_error("Interrupted whilst waiting for lock\n"); ++ return -EINTR; ++ } ++ err = snd_pcm_new(chip->card, "bcm2835 ALSA", 1, 1, 0, &pcm); ++ if (err < 0) ++ goto out; ++ ++ pcm->private_data = chip; ++ strcpy(pcm->name, "bcm2835 IEC958/HDMI"); ++ chip->pcm_spdif = pcm; ++ snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, ++ &snd_bcm2835_playback_spdif_ops); ++ ++ snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_CONTINUOUS, ++ snd_dma_continuous_data (GFP_KERNEL), ++ 64 * 1024, 64 * 1024); ++out: ++ mutex_unlock(&chip->audio_mutex); ++ audio_info(" .. OUT\n"); ++ ++ return 0; ++} +diff --git a/sound/arm/bcm2835-vchiq.c b/sound/arm/bcm2835-vchiq.c +new file mode 100755 +index 0000000..3de3094 +--- /dev/null ++++ b/sound/arm/bcm2835-vchiq.c +@@ -0,0 +1,902 @@ ++/***************************************************************************** ++* Copyright 2011 Broadcom Corporation. All rights reserved. ++* ++* Unless you and Broadcom execute a separate written software license ++* agreement governing use of this software, this software is licensed to you ++* under the terms of the GNU General Public License version 2, available at ++* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). ++* ++* Notwithstanding the above, under no circumstances may you combine this ++* software in any way with any other Broadcom software provided under a ++* license other than the GPL, without Broadcom's express prior written ++* consent. ++*****************************************************************************/ ++ ++#include <linux/device.h> ++#include <sound/core.h> ++#include <sound/initval.h> ++#include <sound/pcm.h> ++#include <linux/io.h> ++#include <linux/interrupt.h> ++#include <linux/fs.h> ++#include <linux/file.h> ++#include <linux/mm.h> ++#include <linux/syscalls.h> ++#include <asm/uaccess.h> ++#include <linux/slab.h> ++#include <linux/delay.h> ++#include <linux/atomic.h> ++#include <linux/module.h> ++#include <linux/completion.h> ++ ++#include "bcm2835.h" ++ ++/* ---- Include Files -------------------------------------------------------- */ ++ ++#include "interface/vchi/vchi.h" ++#include "vc_vchi_audioserv_defs.h" ++ ++/* ---- Private Constants and Types ------------------------------------------ */ ++ ++#define BCM2835_AUDIO_STOP 0 ++#define BCM2835_AUDIO_START 1 ++#define BCM2835_AUDIO_WRITE 2 ++ ++/* Logging macros (for remapping to other logging mechanisms, i.e., printf) */ ++#ifdef AUDIO_DEBUG_ENABLE ++ #define LOG_ERR( fmt, arg... ) pr_err( "%s:%d " fmt, __func__, __LINE__, ##arg) ++ #define LOG_WARN( fmt, arg... ) pr_info( "%s:%d " fmt, __func__, __LINE__, ##arg) ++ #define LOG_INFO( fmt, arg... ) pr_info( "%s:%d " fmt, __func__, __LINE__, ##arg) ++ #define LOG_DBG( fmt, arg... ) pr_info( "%s:%d " fmt, __func__, __LINE__, ##arg) ++#else ++ #define LOG_ERR( fmt, arg... ) pr_err( "%s:%d " fmt, __func__, __LINE__, ##arg) ++ #define LOG_WARN( fmt, arg... ) ++ #define LOG_INFO( fmt, arg... ) ++ #define LOG_DBG( fmt, arg... ) ++#endif ++ ++typedef struct opaque_AUDIO_INSTANCE_T { ++ uint32_t num_connections; ++ VCHI_SERVICE_HANDLE_T vchi_handle[VCHI_MAX_NUM_CONNECTIONS]; ++ struct completion msg_avail_comp; ++ struct mutex vchi_mutex; ++ bcm2835_alsa_stream_t *alsa_stream; ++ int32_t result; ++ short peer_version; ++} AUDIO_INSTANCE_T; ++ ++bool force_bulk = false; ++ ++/* ---- Private Variables ---------------------------------------------------- */ ++ ++/* ---- Private Function Prototypes ------------------------------------------ */ ++ ++/* ---- Private Functions ---------------------------------------------------- */ ++ ++static int bcm2835_audio_stop_worker(bcm2835_alsa_stream_t * alsa_stream); ++static int bcm2835_audio_start_worker(bcm2835_alsa_stream_t * alsa_stream); ++static int bcm2835_audio_write_worker(bcm2835_alsa_stream_t *alsa_stream, ++ uint32_t count, void *src); ++ ++typedef struct { ++ struct work_struct my_work; ++ bcm2835_alsa_stream_t *alsa_stream; ++ int cmd; ++ void *src; ++ uint32_t count; ++} my_work_t; ++ ++static void my_wq_function(struct work_struct *work) ++{ ++ my_work_t *w = (my_work_t *) work; ++ int ret = -9; ++ LOG_DBG(" .. IN %p:%d\n", w->alsa_stream, w->cmd); ++ switch (w->cmd) { ++ case BCM2835_AUDIO_START: ++ ret = bcm2835_audio_start_worker(w->alsa_stream); ++ break; ++ case BCM2835_AUDIO_STOP: ++ ret = bcm2835_audio_stop_worker(w->alsa_stream); ++ break; ++ case BCM2835_AUDIO_WRITE: ++ ret = bcm2835_audio_write_worker(w->alsa_stream, w->count, ++ w->src); ++ break; ++ default: ++ LOG_ERR(" Unexpected work: %p:%d\n", w->alsa_stream, w->cmd); ++ break; ++ } ++ kfree((void *)work); ++ LOG_DBG(" .. OUT %d\n", ret); ++} ++ ++int bcm2835_audio_start(bcm2835_alsa_stream_t * alsa_stream) ++{ ++ int ret = -1; ++ LOG_DBG(" .. IN\n"); ++ if (alsa_stream->my_wq) { ++ my_work_t *work = kmalloc(sizeof(my_work_t), GFP_ATOMIC); ++ /*--- Queue some work (item 1) ---*/ ++ if (work) { ++ INIT_WORK((struct work_struct *)work, my_wq_function); ++ work->alsa_stream = alsa_stream; ++ work->cmd = BCM2835_AUDIO_START; ++ if (queue_work ++ (alsa_stream->my_wq, (struct work_struct *)work)) ++ ret = 0; ++ } else ++ LOG_ERR(" .. Error: NULL work kmalloc\n"); ++ } ++ LOG_DBG(" .. OUT %d\n", ret); ++ return ret; ++} ++ ++int bcm2835_audio_stop(bcm2835_alsa_stream_t * alsa_stream) ++{ ++ int ret = -1; ++ LOG_DBG(" .. IN\n"); ++ if (alsa_stream->my_wq) { ++ my_work_t *work = kmalloc(sizeof(my_work_t), GFP_ATOMIC); ++ /*--- Queue some work (item 1) ---*/ ++ if (work) { ++ INIT_WORK((struct work_struct *)work, my_wq_function); ++ work->alsa_stream = alsa_stream; ++ work->cmd = BCM2835_AUDIO_STOP; ++ if (queue_work ++ (alsa_stream->my_wq, (struct work_struct *)work)) ++ ret = 0; ++ } else ++ LOG_ERR(" .. Error: NULL work kmalloc\n"); ++ } ++ LOG_DBG(" .. OUT %d\n", ret); ++ return ret; ++} ++ ++int bcm2835_audio_write(bcm2835_alsa_stream_t *alsa_stream, ++ uint32_t count, void *src) ++{ ++ int ret = -1; ++ LOG_DBG(" .. IN\n"); ++ if (alsa_stream->my_wq) { ++ my_work_t *work = kmalloc(sizeof(my_work_t), GFP_ATOMIC); ++ /*--- Queue some work (item 1) ---*/ ++ if (work) { ++ INIT_WORK((struct work_struct *)work, my_wq_function); ++ work->alsa_stream = alsa_stream; ++ work->cmd = BCM2835_AUDIO_WRITE; ++ work->src = src; ++ work->count = count; ++ if (queue_work ++ (alsa_stream->my_wq, (struct work_struct *)work)) ++ ret = 0; ++ } else ++ LOG_ERR(" .. Error: NULL work kmalloc\n"); ++ } ++ LOG_DBG(" .. OUT %d\n", ret); ++ return ret; ++} ++ ++void my_workqueue_init(bcm2835_alsa_stream_t * alsa_stream) ++{ ++ alsa_stream->my_wq = alloc_workqueue("my_queue", WQ_HIGHPRI, 1); ++ return; ++} ++ ++void my_workqueue_quit(bcm2835_alsa_stream_t * alsa_stream) ++{ ++ if (alsa_stream->my_wq) { ++ flush_workqueue(alsa_stream->my_wq); ++ destroy_workqueue(alsa_stream->my_wq); ++ alsa_stream->my_wq = NULL; ++ } ++ return; ++} ++ ++static void audio_vchi_callback(void *param, ++ const VCHI_CALLBACK_REASON_T reason, ++ void *msg_handle) ++{ ++ AUDIO_INSTANCE_T *instance = (AUDIO_INSTANCE_T *) param; ++ int32_t status; ++ int32_t msg_len; ++ VC_AUDIO_MSG_T m; ++ LOG_DBG(" .. IN instance=%p, handle=%p, alsa=%p, reason=%d, handle=%p\n", ++ instance, instance ? instance->vchi_handle[0] : NULL, instance ? instance->alsa_stream : NULL, reason, msg_handle); ++ ++ if (reason != VCHI_CALLBACK_MSG_AVAILABLE) { ++ return; ++ } ++ if (!instance) { ++ LOG_ERR(" .. instance is null\n"); ++ BUG(); ++ return; ++ } ++ if (!instance->vchi_handle[0]) { ++ LOG_ERR(" .. instance->vchi_handle[0] is null\n"); ++ BUG(); ++ return; ++ } ++ status = vchi_msg_dequeue(instance->vchi_handle[0], ++ &m, sizeof m, &msg_len, VCHI_FLAGS_NONE); ++ if (m.type == VC_AUDIO_MSG_TYPE_RESULT) { ++ LOG_DBG ++ (" .. instance=%p, m.type=VC_AUDIO_MSG_TYPE_RESULT, success=%d\n", ++ instance, m.u.result.success); ++ instance->result = m.u.result.success; ++ complete(&instance->msg_avail_comp); ++ } else if (m.type == VC_AUDIO_MSG_TYPE_COMPLETE) { ++ bcm2835_alsa_stream_t *alsa_stream = instance->alsa_stream; ++ irq_handler_t callback = (irq_handler_t) m.u.complete.callback; ++ LOG_DBG ++ (" .. instance=%p, m.type=VC_AUDIO_MSG_TYPE_COMPLETE, complete=%d\n", ++ instance, m.u.complete.count); ++ if (alsa_stream && callback) { ++ atomic_add(m.u.complete.count, &alsa_stream->retrieved); ++ callback(0, alsa_stream); ++ } else { ++ LOG_ERR(" .. unexpected alsa_stream=%p, callback=%p\n", ++ alsa_stream, callback); ++ } ++ } else { ++ LOG_ERR(" .. unexpected m.type=%d\n", m.type); ++ } ++ LOG_DBG(" .. OUT\n"); ++} ++ ++static AUDIO_INSTANCE_T *vc_vchi_audio_init(VCHI_INSTANCE_T vchi_instance, ++ VCHI_CONNECTION_T ** ++ vchi_connections, ++ uint32_t num_connections) ++{ ++ uint32_t i; ++ AUDIO_INSTANCE_T *instance; ++ int status; ++ ++ LOG_DBG("%s: start", __func__); ++ ++ if (num_connections > VCHI_MAX_NUM_CONNECTIONS) { ++ LOG_ERR("%s: unsupported number of connections %u (max=%u)\n", ++ __func__, num_connections, VCHI_MAX_NUM_CONNECTIONS); ++ ++ return NULL; ++ } ++ /* Allocate memory for this instance */ ++ instance = kmalloc(sizeof(*instance), GFP_KERNEL); ++ if (!instance) ++ return NULL; ++ ++ memset(instance, 0, sizeof(*instance)); ++ instance->num_connections = num_connections; ++ ++ /* Create a lock for exclusive, serialized VCHI connection access */ ++ mutex_init(&instance->vchi_mutex); ++ /* Open the VCHI service connections */ ++ for (i = 0; i < num_connections; i++) { ++ SERVICE_CREATION_T params = { ++ VCHI_VERSION_EX(VC_AUDIOSERV_VER, VC_AUDIOSERV_MIN_VER), ++ VC_AUDIO_SERVER_NAME, // 4cc service code ++ vchi_connections[i], // passed in fn pointers ++ 0, // rx fifo size (unused) ++ 0, // tx fifo size (unused) ++ audio_vchi_callback, // service callback ++ instance, // service callback parameter ++ 1, //TODO: remove VCOS_FALSE, // unaligned bulk recieves ++ 1, //TODO: remove VCOS_FALSE, // unaligned bulk transmits ++ 0 // want crc check on bulk transfers ++ }; ++ ++ LOG_DBG("%s: about to open %i\n", __func__, i); ++ status = vchi_service_open(vchi_instance, &params, ++ &instance->vchi_handle[i]); ++ LOG_DBG("%s: opened %i: %p=%d\n", __func__, i, instance->vchi_handle[i], status); ++ if (status) { ++ LOG_ERR ++ ("%s: failed to open VCHI service connection (status=%d)\n", ++ __func__, status); ++ ++ goto err_close_services; ++ } ++ /* Finished with the service for now */ ++ vchi_service_release(instance->vchi_handle[i]); ++ } ++ ++ LOG_DBG("%s: okay\n", __func__); ++ return instance; ++ ++err_close_services: ++ for (i = 0; i < instance->num_connections; i++) { ++ LOG_ERR("%s: closing %i: %p\n", __func__, i, instance->vchi_handle[i]); ++ if (instance->vchi_handle[i]) ++ vchi_service_close(instance->vchi_handle[i]); ++ } ++ ++ kfree(instance); ++ LOG_ERR("%s: error\n", __func__); ++ ++ return NULL; ++} ++ ++static int32_t vc_vchi_audio_deinit(AUDIO_INSTANCE_T * instance) ++{ ++ uint32_t i; ++ ++ LOG_DBG(" .. IN\n"); ++ ++ if (instance == NULL) { ++ LOG_ERR("%s: invalid handle %p\n", __func__, instance); ++ ++ return -1; ++ } ++ ++ LOG_DBG(" .. about to lock (%d)\n", instance->num_connections); ++ if(mutex_lock_interruptible(&instance->vchi_mutex)) ++ { ++ LOG_DBG("Interrupted whilst waiting for lock on (%d)\n",instance->num_connections); ++ return -EINTR; ++ } ++ ++ /* Close all VCHI service connections */ ++ for (i = 0; i < instance->num_connections; i++) { ++ int32_t success; ++ LOG_DBG(" .. %i:closing %p\n", i, instance->vchi_handle[i]); ++ vchi_service_use(instance->vchi_handle[i]); ++ ++ success = vchi_service_close(instance->vchi_handle[i]); ++ if (success != 0) { ++ LOG_DBG ++ ("%s: failed to close VCHI service connection (status=%d)\n", ++ __func__, success); ++ } ++ } ++ ++ mutex_unlock(&instance->vchi_mutex); ++ ++ kfree(instance); ++ ++ LOG_DBG(" .. OUT\n"); ++ ++ return 0; ++} ++ ++static int bcm2835_audio_open_connection(bcm2835_alsa_stream_t * alsa_stream) ++{ ++ static VCHI_INSTANCE_T vchi_instance; ++ static VCHI_CONNECTION_T *vchi_connection; ++ static int initted; ++ AUDIO_INSTANCE_T *instance = alsa_stream->instance; ++ int ret; ++ LOG_DBG(" .. IN\n"); ++ ++ LOG_INFO("%s: start\n", __func__); ++ BUG_ON(instance); ++ if (instance) { ++ LOG_ERR("%s: VCHI instance already open (%p)\n", ++ __func__, instance); ++ instance->alsa_stream = alsa_stream; ++ alsa_stream->instance = instance; ++ ret = 0; // xxx todo -1; ++ goto err_free_mem; ++ } ++ ++ /* Initialize and create a VCHI connection */ ++ if (!initted) { ++ ret = vchi_initialise(&vchi_instance); ++ if (ret != 0) { ++ LOG_ERR("%s: failed to initialise VCHI instance (ret=%d)\n", ++ __func__, ret); ++ ++ ret = -EIO; ++ goto err_free_mem; ++ } ++ ret = vchi_connect(NULL, 0, vchi_instance); ++ if (ret != 0) { ++ LOG_ERR("%s: failed to connect VCHI instance (ret=%d)\n", ++ __func__, ret); ++ ++ ret = -EIO; ++ goto err_free_mem; ++ } ++ initted = 1; ++ } ++ ++ /* Initialize an instance of the audio service */ ++ instance = vc_vchi_audio_init(vchi_instance, &vchi_connection, 1); ++ ++ if (instance == NULL) { ++ LOG_ERR("%s: failed to initialize audio service\n", __func__); ++ ++ ret = -EPERM; ++ goto err_free_mem; ++ } ++ ++ instance->alsa_stream = alsa_stream; ++ alsa_stream->instance = instance; ++ ++ LOG_DBG(" success !\n"); ++err_free_mem: ++ LOG_DBG(" .. OUT\n"); ++ ++ return ret; ++} ++ ++int bcm2835_audio_open(bcm2835_alsa_stream_t * alsa_stream) ++{ ++ AUDIO_INSTANCE_T *instance; ++ VC_AUDIO_MSG_T m; ++ int32_t success; ++ int ret; ++ LOG_DBG(" .. IN\n"); ++ ++ my_workqueue_init(alsa_stream); ++ ++ ret = bcm2835_audio_open_connection(alsa_stream); ++ if (ret != 0) { ++ ret = -1; ++ goto exit; ++ } ++ instance = alsa_stream->instance; ++ LOG_DBG(" instance (%p)\n", instance); ++ ++ if(mutex_lock_interruptible(&instance->vchi_mutex)) ++ { ++ LOG_DBG("Interrupted whilst waiting for lock on (%d)\n",instance->num_connections); ++ return -EINTR; ++ } ++ vchi_service_use(instance->vchi_handle[0]); ++ ++ m.type = VC_AUDIO_MSG_TYPE_OPEN; ++ ++ /* Send the message to the videocore */ ++ success = vchi_msg_queue(instance->vchi_handle[0], ++ &m, sizeof m, ++ VCHI_FLAGS_BLOCK_UNTIL_QUEUED, NULL); ++ ++ if (success != 0) { ++ LOG_ERR("%s: failed on vchi_msg_queue (status=%d)\n", ++ __func__, success); ++ ++ ret = -1; ++ goto unlock; ++ } ++ ++ ret = 0; ++ ++unlock: ++ vchi_service_release(instance->vchi_handle[0]); ++ mutex_unlock(&instance->vchi_mutex); ++exit: ++ LOG_DBG(" .. OUT\n"); ++ return ret; ++} ++ ++static int bcm2835_audio_set_ctls_chan(bcm2835_alsa_stream_t * alsa_stream, ++ bcm2835_chip_t * chip) ++{ ++ VC_AUDIO_MSG_T m; ++ AUDIO_INSTANCE_T *instance = alsa_stream->instance; ++ int32_t success; ++ int ret; ++ LOG_DBG(" .. IN\n"); ++ ++ LOG_INFO ++ (" Setting ALSA dest(%d), volume(%d)\n", chip->dest, chip->volume); ++ ++ if(mutex_lock_interruptible(&instance->vchi_mutex)) ++ { ++ LOG_DBG("Interrupted whilst waiting for lock on (%d)\n",instance->num_connections); ++ return -EINTR; ++ } ++ vchi_service_use(instance->vchi_handle[0]); ++ ++ instance->result = -1; ++ ++ m.type = VC_AUDIO_MSG_TYPE_CONTROL; ++ m.u.control.dest = chip->dest; ++ m.u.control.volume = chip->volume; ++ ++ /* Create the message available completion */ ++ init_completion(&instance->msg_avail_comp); ++ ++ /* Send the message to the videocore */ ++ success = vchi_msg_queue(instance->vchi_handle[0], ++ &m, sizeof m, ++ VCHI_FLAGS_BLOCK_UNTIL_QUEUED, NULL); ++ ++ if (success != 0) { ++ LOG_ERR("%s: failed on vchi_msg_queue (status=%d)\n", ++ __func__, success); ++ ++ ret = -1; ++ goto unlock; ++ } ++ ++ /* We are expecting a reply from the videocore */ ++ ret = wait_for_completion_interruptible(&instance->msg_avail_comp); ++ if (ret) { ++ LOG_DBG("%s: failed on waiting for event (status=%d)\n", ++ __func__, success); ++ goto unlock; ++ } ++ ++ if (instance->result != 0) { ++ LOG_ERR("%s: result=%d\n", __func__, instance->result); ++ ++ ret = -1; ++ goto unlock; ++ } ++ ++ ret = 0; ++ ++unlock: ++ vchi_service_release(instance->vchi_handle[0]); ++ mutex_unlock(&instance->vchi_mutex); ++ ++ LOG_DBG(" .. OUT\n"); ++ return ret; ++} ++ ++int bcm2835_audio_set_ctls(bcm2835_chip_t * chip) ++{ ++ int i; ++ int ret = 0; ++ LOG_DBG(" .. IN\n"); ++ LOG_DBG(" Setting ALSA dest(%d), volume(%d)\n", chip->dest, chip->volume); ++ ++ /* change ctls for all substreams */ ++ for (i = 0; i < MAX_SUBSTREAMS; i++) { ++ if (chip->avail_substreams & (1 << i)) { ++ if (!chip->alsa_stream[i]) ++ { ++ LOG_DBG(" No ALSA stream available?! %i:%p (%x)\n", i, chip->alsa_stream[i], chip->avail_substreams); ++ ret = 0; ++ } ++ else if (bcm2835_audio_set_ctls_chan /* returns 0 on success */ ++ (chip->alsa_stream[i], chip) != 0) ++ { ++ LOG_ERR("Couldn't set the controls for stream %d\n", i); ++ ret = -1; ++ } ++ else LOG_DBG(" Controls set for stream %d\n", i); ++ } ++ } ++ LOG_DBG(" .. OUT ret=%d\n", ret); ++ return ret; ++} ++ ++int bcm2835_audio_set_params(bcm2835_alsa_stream_t * alsa_stream, ++ uint32_t channels, uint32_t samplerate, ++ uint32_t bps) ++{ ++ VC_AUDIO_MSG_T m; ++ AUDIO_INSTANCE_T *instance = alsa_stream->instance; ++ int32_t success; ++ int ret; ++ LOG_DBG(" .. IN\n"); ++ ++ LOG_INFO ++ (" Setting ALSA channels(%d), samplerate(%d), bits-per-sample(%d)\n", ++ channels, samplerate, bps); ++ ++ /* resend ctls - alsa_stream may not have been open when first send */ ++ ret = bcm2835_audio_set_ctls_chan(alsa_stream, alsa_stream->chip); ++ if (ret != 0) { ++ LOG_ERR(" Alsa controls not supported\n"); ++ return -EINVAL; ++ } ++ ++ if(mutex_lock_interruptible(&instance->vchi_mutex)) ++ { ++ LOG_DBG("Interrupted whilst waiting for lock on (%d)\n",instance->num_connections); ++ return -EINTR; ++ } ++ vchi_service_use(instance->vchi_handle[0]); ++ ++ instance->result = -1; ++ ++ m.type = VC_AUDIO_MSG_TYPE_CONFIG; ++ m.u.config.channels = channels; ++ m.u.config.samplerate = samplerate; ++ m.u.config.bps = bps; ++ ++ /* Create the message available completion */ ++ init_completion(&instance->msg_avail_comp); ++ ++ /* Send the message to the videocore */ ++ success = vchi_msg_queue(instance->vchi_handle[0], ++ &m, sizeof m, ++ VCHI_FLAGS_BLOCK_UNTIL_QUEUED, NULL); ++ ++ if (success != 0) { ++ LOG_ERR("%s: failed on vchi_msg_queue (status=%d)\n", ++ __func__, success); ++ ++ ret = -1; ++ goto unlock; ++ } ++ ++ /* We are expecting a reply from the videocore */ ++ ret = wait_for_completion_interruptible(&instance->msg_avail_comp); ++ if (ret) { ++ LOG_DBG("%s: failed on waiting for event (status=%d)\n", ++ __func__, success); ++ goto unlock; ++ } ++ ++ if (instance->result != 0) { ++ LOG_ERR("%s: result=%d", __func__, instance->result); ++ ++ ret = -1; ++ goto unlock; ++ } ++ ++ ret = 0; ++ ++unlock: ++ vchi_service_release(instance->vchi_handle[0]); ++ mutex_unlock(&instance->vchi_mutex); ++ ++ LOG_DBG(" .. OUT\n"); ++ return ret; ++} ++ ++int bcm2835_audio_setup(bcm2835_alsa_stream_t * alsa_stream) ++{ ++ LOG_DBG(" .. IN\n"); ++ ++ LOG_DBG(" .. OUT\n"); ++ ++ return 0; ++} ++ ++static int bcm2835_audio_start_worker(bcm2835_alsa_stream_t * alsa_stream) ++{ ++ VC_AUDIO_MSG_T m; ++ AUDIO_INSTANCE_T *instance = alsa_stream->instance; ++ int32_t success; ++ int ret; ++ LOG_DBG(" .. IN\n"); ++ ++ if(mutex_lock_interruptible(&instance->vchi_mutex)) ++ { ++ LOG_DBG("Interrupted whilst waiting for lock on (%d)\n",instance->num_connections); ++ return -EINTR; ++ } ++ vchi_service_use(instance->vchi_handle[0]); ++ ++ m.type = VC_AUDIO_MSG_TYPE_START; ++ ++ /* Send the message to the videocore */ ++ success = vchi_msg_queue(instance->vchi_handle[0], ++ &m, sizeof m, ++ VCHI_FLAGS_BLOCK_UNTIL_QUEUED, NULL); ++ ++ if (success != 0) { ++ LOG_ERR("%s: failed on vchi_msg_queue (status=%d)\n", ++ __func__, success); ++ ++ ret = -1; ++ goto unlock; ++ } ++ ++ ret = 0; ++ ++unlock: ++ vchi_service_release(instance->vchi_handle[0]); ++ mutex_unlock(&instance->vchi_mutex); ++ LOG_DBG(" .. OUT\n"); ++ return ret; ++} ++ ++static int bcm2835_audio_stop_worker(bcm2835_alsa_stream_t * alsa_stream) ++{ ++ VC_AUDIO_MSG_T m; ++ AUDIO_INSTANCE_T *instance = alsa_stream->instance; ++ int32_t success; ++ int ret; ++ LOG_DBG(" .. IN\n"); ++ ++ if(mutex_lock_interruptible(&instance->vchi_mutex)) ++ { ++ LOG_DBG("Interrupted whilst waiting for lock on (%d)\n",instance->num_connections); ++ return -EINTR; ++ } ++ vchi_service_use(instance->vchi_handle[0]); ++ ++ m.type = VC_AUDIO_MSG_TYPE_STOP; ++ m.u.stop.draining = alsa_stream->draining; ++ ++ /* Send the message to the videocore */ ++ success = vchi_msg_queue(instance->vchi_handle[0], ++ &m, sizeof m, ++ VCHI_FLAGS_BLOCK_UNTIL_QUEUED, NULL); ++ ++ if (success != 0) { ++ LOG_ERR("%s: failed on vchi_msg_queue (status=%d)\n", ++ __func__, success); ++ ++ ret = -1; ++ goto unlock; ++ } ++ ++ ret = 0; ++ ++unlock: ++ vchi_service_release(instance->vchi_handle[0]); ++ mutex_unlock(&instance->vchi_mutex); ++ LOG_DBG(" .. OUT\n"); ++ return ret; ++} ++ ++int bcm2835_audio_close(bcm2835_alsa_stream_t * alsa_stream) ++{ ++ VC_AUDIO_MSG_T m; ++ AUDIO_INSTANCE_T *instance = alsa_stream->instance; ++ int32_t success; ++ int ret; ++ LOG_DBG(" .. IN\n"); ++ ++ my_workqueue_quit(alsa_stream); ++ ++ if(mutex_lock_interruptible(&instance->vchi_mutex)) ++ { ++ LOG_DBG("Interrupted whilst waiting for lock on (%d)\n",instance->num_connections); ++ return -EINTR; ++ } ++ vchi_service_use(instance->vchi_handle[0]); ++ ++ m.type = VC_AUDIO_MSG_TYPE_CLOSE; ++ ++ /* Create the message available completion */ ++ init_completion(&instance->msg_avail_comp); ++ ++ /* Send the message to the videocore */ ++ success = vchi_msg_queue(instance->vchi_handle[0], ++ &m, sizeof m, ++ VCHI_FLAGS_BLOCK_UNTIL_QUEUED, NULL); ++ ++ if (success != 0) { ++ LOG_ERR("%s: failed on vchi_msg_queue (status=%d)\n", ++ __func__, success); ++ ret = -1; ++ goto unlock; ++ } ++ ++ ret = wait_for_completion_interruptible(&instance->msg_avail_comp); ++ if (ret) { ++ LOG_DBG("%s: failed on waiting for event (status=%d)\n", ++ __func__, success); ++ goto unlock; ++ } ++ if (instance->result != 0) { ++ LOG_ERR("%s: failed result (status=%d)\n", ++ __func__, instance->result); ++ ++ ret = -1; ++ goto unlock; ++ } ++ ++ ret = 0; ++ ++unlock: ++ vchi_service_release(instance->vchi_handle[0]); ++ mutex_unlock(&instance->vchi_mutex); ++ ++ /* Stop the audio service */ ++ if (instance) { ++ vc_vchi_audio_deinit(instance); ++ alsa_stream->instance = NULL; ++ } ++ LOG_DBG(" .. OUT\n"); ++ return ret; ++} ++ ++int bcm2835_audio_write_worker(bcm2835_alsa_stream_t *alsa_stream, ++ uint32_t count, void *src) ++{ ++ VC_AUDIO_MSG_T m; ++ AUDIO_INSTANCE_T *instance = alsa_stream->instance; ++ int32_t success; ++ int ret; ++ ++ LOG_DBG(" .. IN\n"); ++ ++ LOG_INFO(" Writing %d bytes from %p\n", count, src); ++ ++ if(mutex_lock_interruptible(&instance->vchi_mutex)) ++ { ++ LOG_DBG("Interrupted whilst waiting for lock on (%d)\n",instance->num_connections); ++ return -EINTR; ++ } ++ vchi_service_use(instance->vchi_handle[0]); ++ ++ if ( instance->peer_version==0 && vchi_get_peer_version(instance->vchi_handle[0], &instance->peer_version) == 0 ) { ++ LOG_DBG("%s: client version %d connected\n", __func__, instance->peer_version); ++ } ++ m.type = VC_AUDIO_MSG_TYPE_WRITE; ++ m.u.write.count = count; ++ // old version uses bulk, new version uses control ++ m.u.write.max_packet = instance->peer_version < 2 || force_bulk ? 0:4000; ++ m.u.write.callback = alsa_stream->fifo_irq_handler; ++ m.u.write.cookie = alsa_stream; ++ m.u.write.silence = src == NULL; ++ ++ /* Send the message to the videocore */ ++ success = vchi_msg_queue(instance->vchi_handle[0], ++ &m, sizeof m, ++ VCHI_FLAGS_BLOCK_UNTIL_QUEUED, NULL); ++ ++ if (success != 0) { ++ LOG_ERR("%s: failed on vchi_msg_queue (status=%d)\n", ++ __func__, success); ++ ++ ret = -1; ++ goto unlock; ++ } ++ if (!m.u.write.silence) { ++ if (m.u.write.max_packet == 0) { ++ /* Send the message to the videocore */ ++ success = vchi_bulk_queue_transmit(instance->vchi_handle[0], ++ src, count, ++ 0 * ++ VCHI_FLAGS_BLOCK_UNTIL_QUEUED ++ + ++ 1 * ++ VCHI_FLAGS_BLOCK_UNTIL_DATA_READ, ++ NULL); ++ } else { ++ while (count > 0) { ++ int bytes = min((int)m.u.write.max_packet, (int)count); ++ success = vchi_msg_queue(instance->vchi_handle[0], ++ src, bytes, ++ VCHI_FLAGS_BLOCK_UNTIL_QUEUED, NULL); ++ src = (char *)src + bytes; ++ count -= bytes; ++ } ++ } ++ if (success != 0) { ++ LOG_ERR ++ ("%s: failed on vchi_bulk_queue_transmit (status=%d)\n", ++ __func__, success); ++ ++ ret = -1; ++ goto unlock; ++ } ++ } ++ ret = 0; ++ ++unlock: ++ vchi_service_release(instance->vchi_handle[0]); ++ mutex_unlock(&instance->vchi_mutex); ++ LOG_DBG(" .. OUT\n"); ++ return ret; ++} ++ ++/** ++ * Returns all buffers from arm->vc ++ */ ++void bcm2835_audio_flush_buffers(bcm2835_alsa_stream_t * alsa_stream) ++{ ++ LOG_DBG(" .. IN\n"); ++ LOG_DBG(" .. OUT\n"); ++ return; ++} ++ ++/** ++ * Forces VC to flush(drop) its filled playback buffers and ++ * return them the us. (VC->ARM) ++ */ ++void bcm2835_audio_flush_playback_buffers(bcm2835_alsa_stream_t * alsa_stream) ++{ ++ LOG_DBG(" .. IN\n"); ++ LOG_DBG(" .. OUT\n"); ++} ++ ++uint32_t bcm2835_audio_retrieve_buffers(bcm2835_alsa_stream_t * alsa_stream) ++{ ++ uint32_t count = atomic_read(&alsa_stream->retrieved); ++ atomic_sub(count, &alsa_stream->retrieved); ++ return count; ++} ++ ++module_param(force_bulk, bool, 0444); ++MODULE_PARM_DESC(force_bulk, "Force use of vchiq bulk for audio"); +diff --git a/sound/arm/bcm2835.c b/sound/arm/bcm2835.c +new file mode 100644 +index 0000000..7a2ed78 +--- /dev/null ++++ b/sound/arm/bcm2835.c +@@ -0,0 +1,511 @@ ++/***************************************************************************** ++* Copyright 2011 Broadcom Corporation. All rights reserved. ++* ++* Unless you and Broadcom execute a separate written software license ++* agreement governing use of this software, this software is licensed to you ++* under the terms of the GNU General Public License version 2, available at ++* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). ++* ++* Notwithstanding the above, under no circumstances may you combine this ++* software in any way with any other Broadcom software provided under a ++* license other than the GPL, without Broadcom's express prior written ++* consent. ++*****************************************************************************/ ++ ++#include <linux/platform_device.h> ++ ++#include <linux/init.h> ++#include <linux/slab.h> ++#include <linux/module.h> ++#include <linux/of.h> ++ ++#include "bcm2835.h" ++ ++/* module parameters (see "Module Parameters") */ ++/* SNDRV_CARDS: maximum number of cards supported by this module */ ++static int index[MAX_SUBSTREAMS] = {[0 ... (MAX_SUBSTREAMS - 1)] = -1 }; ++static char *id[MAX_SUBSTREAMS] = {[0 ... (MAX_SUBSTREAMS - 1)] = NULL }; ++static int enable[MAX_SUBSTREAMS] = {[0 ... (MAX_SUBSTREAMS - 1)] = 1 }; ++ ++/* HACKY global pointers needed for successive probes to work : ssp ++ * But compared against the changes we will have to do in VC audio_ipc code ++ * to export 8 audio_ipc devices as a single IPC device and then monitor all ++ * four devices in a thread, this gets things done quickly and should be easier ++ * to debug if we run into issues ++ */ ++ ++static struct snd_card *g_card = NULL; ++static bcm2835_chip_t *g_chip = NULL; ++ ++static int snd_bcm2835_free(bcm2835_chip_t * chip) ++{ ++ kfree(chip); ++ return 0; ++} ++ ++/* component-destructor ++ * (see "Management of Cards and Components") ++ */ ++static int snd_bcm2835_dev_free(struct snd_device *device) ++{ ++ return snd_bcm2835_free(device->device_data); ++} ++ ++/* chip-specific constructor ++ * (see "Management of Cards and Components") ++ */ ++static int snd_bcm2835_create(struct snd_card *card, ++ struct platform_device *pdev, ++ bcm2835_chip_t ** rchip) ++{ ++ bcm2835_chip_t *chip; ++ int err; ++ static struct snd_device_ops ops = { ++ .dev_free = snd_bcm2835_dev_free, ++ }; ++ ++ *rchip = NULL; ++ ++ chip = kzalloc(sizeof(*chip), GFP_KERNEL); ++ if (chip == NULL) ++ return -ENOMEM; ++ ++ chip->card = card; ++ ++ err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops); ++ if (err < 0) { ++ snd_bcm2835_free(chip); ++ return err; ++ } ++ ++ *rchip = chip; ++ return 0; ++} ++ ++static int snd_bcm2835_alsa_probe_dt(struct platform_device *pdev) ++{ ++ struct device *dev = &pdev->dev; ++ bcm2835_chip_t *chip; ++ struct snd_card *card; ++ u32 numchans; ++ int err, i; ++ ++ err = of_property_read_u32(dev->of_node, "brcm,pwm-channels", ++ &numchans); ++ if (err) { ++ dev_err(dev, "Failed to get DT property 'brcm,pwm-channels'"); ++ return err; ++ } ++ ++ if (numchans == 0 || numchans > MAX_SUBSTREAMS) { ++ numchans = MAX_SUBSTREAMS; ++ dev_warn(dev, "Illegal 'brcm,pwm-channels' value, will use %u\n", ++ numchans); ++ } ++ ++ err = snd_card_new(&pdev->dev, -1, NULL, THIS_MODULE, 0, &card); ++ if (err) { ++ dev_err(dev, "Failed to create soundcard structure\n"); ++ return err; ++ } ++ ++ snd_card_set_dev(card, dev); ++ strcpy(card->driver, "bcm2835"); ++ strcpy(card->shortname, "bcm2835 ALSA"); ++ sprintf(card->longname, "%s", card->shortname); ++ ++ err = snd_bcm2835_create(card, pdev, &chip); ++ if (err < 0) { ++ dev_err(dev, "Failed to create bcm2835 chip\n"); ++ goto err_free; ++ } ++ ++ err = snd_bcm2835_new_pcm(chip); ++ if (err < 0) { ++ dev_err(dev, "Failed to create new bcm2835 pcm device\n"); ++ goto err_free; ++ } ++ ++ err = snd_bcm2835_new_spdif_pcm(chip); ++ if (err < 0) { ++ dev_err(dev, "Failed to create new bcm2835 spdif pcm device\n"); ++ goto err_free; ++ } ++ ++ err = snd_bcm2835_new_ctl(chip); ++ if (err < 0) { ++ dev_err(dev, "Failed to create new bcm2835 ctl\n"); ++ goto err_free; ++ } ++ ++ for (i = 0; i < numchans; i++) { ++ chip->avail_substreams |= (1 << i); ++ chip->pdev[i] = pdev; ++ } ++ ++ err = snd_card_register(card); ++ if (err) { ++ dev_err(dev, "Failed to register bcm2835 ALSA card \n"); ++ goto err_free; ++ } ++ ++ g_card = card; ++ g_chip = chip; ++ platform_set_drvdata(pdev, card); ++ audio_info("bcm2835 ALSA card created with %u channels\n", numchans); ++ ++ return 0; ++ ++err_free: ++ snd_card_free(card); ++ ++ return err; ++} ++ ++static int snd_bcm2835_alsa_probe(struct platform_device *pdev) ++{ ++ static int dev; ++ bcm2835_chip_t *chip; ++ struct snd_card *card; ++ int err; ++ ++ if (pdev->dev.of_node) ++ return snd_bcm2835_alsa_probe_dt(pdev); ++ ++ if (dev >= MAX_SUBSTREAMS) ++ return -ENODEV; ++ ++ if (!enable[dev]) { ++ dev++; ++ return -ENOENT; ++ } ++ ++ if (dev > 0) ++ goto add_register_map; ++ ++ err = snd_card_new(&pdev->dev, index[dev], id[dev], THIS_MODULE, 0, &g_card); ++ if (err < 0) ++ goto out; ++ ++ snd_card_set_dev(g_card, &pdev->dev); ++ strcpy(g_card->driver, "bcm2835"); ++ strcpy(g_card->shortname, "bcm2835 ALSA"); ++ sprintf(g_card->longname, "%s", g_card->shortname); ++ ++ err = snd_bcm2835_create(g_card, pdev, &chip); ++ if (err < 0) { ++ dev_err(&pdev->dev, "Failed to create bcm2835 chip\n"); ++ goto out_bcm2835_create; ++ } ++ ++ g_chip = chip; ++ err = snd_bcm2835_new_pcm(chip); ++ if (err < 0) { ++ dev_err(&pdev->dev, "Failed to create new BCM2835 pcm device\n"); ++ goto out_bcm2835_new_pcm; ++ } ++ ++ err = snd_bcm2835_new_spdif_pcm(chip); ++ if (err < 0) { ++ dev_err(&pdev->dev, "Failed to create new BCM2835 spdif pcm device\n"); ++ goto out_bcm2835_new_spdif; ++ } ++ ++ err = snd_bcm2835_new_ctl(chip); ++ if (err < 0) { ++ dev_err(&pdev->dev, "Failed to create new BCM2835 ctl\n"); ++ goto out_bcm2835_new_ctl; ++ } ++ ++add_register_map: ++ card = g_card; ++ chip = g_chip; ++ ++ BUG_ON(!(card && chip)); ++ ++ chip->avail_substreams |= (1 << dev); ++ chip->pdev[dev] = pdev; ++ ++ if (dev == 0) { ++ err = snd_card_register(card); ++ if (err < 0) { ++ dev_err(&pdev->dev, ++ "Failed to register bcm2835 ALSA card \n"); ++ goto out_card_register; ++ } ++ platform_set_drvdata(pdev, card); ++ audio_info("bcm2835 ALSA card created!\n"); ++ } else { ++ audio_info("bcm2835 ALSA chip created!\n"); ++ platform_set_drvdata(pdev, (void *)dev); ++ } ++ ++ dev++; ++ ++ return 0; ++ ++out_card_register: ++out_bcm2835_new_ctl: ++out_bcm2835_new_spdif: ++out_bcm2835_new_pcm: ++out_bcm2835_create: ++ BUG_ON(!g_card); ++ if (snd_card_free(g_card)) ++ dev_err(&pdev->dev, "Failed to free Registered alsa card\n"); ++ g_card = NULL; ++out: ++ dev = SNDRV_CARDS; /* stop more avail_substreams from being probed */ ++ dev_err(&pdev->dev, "BCM2835 ALSA Probe failed !!\n"); ++ return err; ++} ++ ++static int snd_bcm2835_alsa_remove(struct platform_device *pdev) ++{ ++ uint32_t idx; ++ void *drv_data; ++ ++ drv_data = platform_get_drvdata(pdev); ++ ++ if (drv_data == (void *)g_card) { ++ /* This is the card device */ ++ snd_card_free((struct snd_card *)drv_data); ++ g_card = NULL; ++ g_chip = NULL; ++ } else { ++ idx = (uint32_t) drv_data; ++ if (g_card != NULL) { ++ BUG_ON(!g_chip); ++ /* We pass chip device numbers in audio ipc devices ++ * other than the one we registered our card with ++ */ ++ idx = (uint32_t) drv_data; ++ BUG_ON(!idx || idx > MAX_SUBSTREAMS); ++ g_chip->avail_substreams &= ~(1 << idx); ++ /* There should be atleast one substream registered ++ * after we are done here, as it wil be removed when ++ * the *remove* is called for the card device ++ */ ++ BUG_ON(!g_chip->avail_substreams); ++ } ++ } ++ ++ platform_set_drvdata(pdev, NULL); ++ ++ return 0; ++} ++ ++#ifdef CONFIG_PM ++static int snd_bcm2835_alsa_suspend(struct platform_device *pdev, ++ pm_message_t state) ++{ ++ return 0; ++} ++ ++static int snd_bcm2835_alsa_resume(struct platform_device *pdev) ++{ ++ return 0; ++} ++ ++#endif ++ ++static const struct of_device_id snd_bcm2835_of_match_table[] = { ++ { .compatible = "brcm,bcm2835-audio", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, snd_bcm2835_of_match_table); ++ ++static struct platform_driver bcm2835_alsa0_driver = { ++ .probe = snd_bcm2835_alsa_probe, ++ .remove = snd_bcm2835_alsa_remove, ++#ifdef CONFIG_PM ++ .suspend = snd_bcm2835_alsa_suspend, ++ .resume = snd_bcm2835_alsa_resume, ++#endif ++ .driver = { ++ .name = "bcm2835_AUD0", ++ .owner = THIS_MODULE, ++ .of_match_table = snd_bcm2835_of_match_table, ++ }, ++}; ++ ++static struct platform_driver bcm2835_alsa1_driver = { ++ .probe = snd_bcm2835_alsa_probe, ++ .remove = snd_bcm2835_alsa_remove, ++#ifdef CONFIG_PM ++ .suspend = snd_bcm2835_alsa_suspend, ++ .resume = snd_bcm2835_alsa_resume, ++#endif ++ .driver = { ++ .name = "bcm2835_AUD1", ++ .owner = THIS_MODULE, ++ }, ++}; ++ ++static struct platform_driver bcm2835_alsa2_driver = { ++ .probe = snd_bcm2835_alsa_probe, ++ .remove = snd_bcm2835_alsa_remove, ++#ifdef CONFIG_PM ++ .suspend = snd_bcm2835_alsa_suspend, ++ .resume = snd_bcm2835_alsa_resume, ++#endif ++ .driver = { ++ .name = "bcm2835_AUD2", ++ .owner = THIS_MODULE, ++ }, ++}; ++ ++static struct platform_driver bcm2835_alsa3_driver = { ++ .probe = snd_bcm2835_alsa_probe, ++ .remove = snd_bcm2835_alsa_remove, ++#ifdef CONFIG_PM ++ .suspend = snd_bcm2835_alsa_suspend, ++ .resume = snd_bcm2835_alsa_resume, ++#endif ++ .driver = { ++ .name = "bcm2835_AUD3", ++ .owner = THIS_MODULE, ++ }, ++}; ++ ++static struct platform_driver bcm2835_alsa4_driver = { ++ .probe = snd_bcm2835_alsa_probe, ++ .remove = snd_bcm2835_alsa_remove, ++#ifdef CONFIG_PM ++ .suspend = snd_bcm2835_alsa_suspend, ++ .resume = snd_bcm2835_alsa_resume, ++#endif ++ .driver = { ++ .name = "bcm2835_AUD4", ++ .owner = THIS_MODULE, ++ }, ++}; ++ ++static struct platform_driver bcm2835_alsa5_driver = { ++ .probe = snd_bcm2835_alsa_probe, ++ .remove = snd_bcm2835_alsa_remove, ++#ifdef CONFIG_PM ++ .suspend = snd_bcm2835_alsa_suspend, ++ .resume = snd_bcm2835_alsa_resume, ++#endif ++ .driver = { ++ .name = "bcm2835_AUD5", ++ .owner = THIS_MODULE, ++ }, ++}; ++ ++static struct platform_driver bcm2835_alsa6_driver = { ++ .probe = snd_bcm2835_alsa_probe, ++ .remove = snd_bcm2835_alsa_remove, ++#ifdef CONFIG_PM ++ .suspend = snd_bcm2835_alsa_suspend, ++ .resume = snd_bcm2835_alsa_resume, ++#endif ++ .driver = { ++ .name = "bcm2835_AUD6", ++ .owner = THIS_MODULE, ++ }, ++}; ++ ++static struct platform_driver bcm2835_alsa7_driver = { ++ .probe = snd_bcm2835_alsa_probe, ++ .remove = snd_bcm2835_alsa_remove, ++#ifdef CONFIG_PM ++ .suspend = snd_bcm2835_alsa_suspend, ++ .resume = snd_bcm2835_alsa_resume, ++#endif ++ .driver = { ++ .name = "bcm2835_AUD7", ++ .owner = THIS_MODULE, ++ }, ++}; ++ ++static int bcm2835_alsa_device_init(void) ++{ ++ int err; ++ err = platform_driver_register(&bcm2835_alsa0_driver); ++ if (err) { ++ pr_err("Error registering bcm2835_alsa0_driver %d .\n", err); ++ goto out; ++ } ++ ++ err = platform_driver_register(&bcm2835_alsa1_driver); ++ if (err) { ++ pr_err("Error registering bcm2835_alsa0_driver %d .\n", err); ++ goto unregister_0; ++ } ++ ++ err = platform_driver_register(&bcm2835_alsa2_driver); ++ if (err) { ++ pr_err("Error registering bcm2835_alsa0_driver %d .\n", err); ++ goto unregister_1; ++ } ++ ++ err = platform_driver_register(&bcm2835_alsa3_driver); ++ if (err) { ++ pr_err("Error registering bcm2835_alsa0_driver %d .\n", err); ++ goto unregister_2; ++ } ++ ++ err = platform_driver_register(&bcm2835_alsa4_driver); ++ if (err) { ++ pr_err("Error registering bcm2835_alsa0_driver %d .\n", err); ++ goto unregister_3; ++ } ++ ++ err = platform_driver_register(&bcm2835_alsa5_driver); ++ if (err) { ++ pr_err("Error registering bcm2835_alsa0_driver %d .\n", err); ++ goto unregister_4; ++ } ++ ++ err = platform_driver_register(&bcm2835_alsa6_driver); ++ if (err) { ++ pr_err("Error registering bcm2835_alsa0_driver %d .\n", err); ++ goto unregister_5; ++ } ++ ++ err = platform_driver_register(&bcm2835_alsa7_driver); ++ if (err) { ++ pr_err("Error registering bcm2835_alsa0_driver %d .\n", err); ++ goto unregister_6; ++ } ++ ++ return 0; ++ ++unregister_6: ++ platform_driver_unregister(&bcm2835_alsa6_driver); ++unregister_5: ++ platform_driver_unregister(&bcm2835_alsa5_driver); ++unregister_4: ++ platform_driver_unregister(&bcm2835_alsa4_driver); ++unregister_3: ++ platform_driver_unregister(&bcm2835_alsa3_driver); ++unregister_2: ++ platform_driver_unregister(&bcm2835_alsa2_driver); ++unregister_1: ++ platform_driver_unregister(&bcm2835_alsa1_driver); ++unregister_0: ++ platform_driver_unregister(&bcm2835_alsa0_driver); ++out: ++ return err; ++} ++ ++static void bcm2835_alsa_device_exit(void) ++{ ++ platform_driver_unregister(&bcm2835_alsa0_driver); ++ platform_driver_unregister(&bcm2835_alsa1_driver); ++ platform_driver_unregister(&bcm2835_alsa2_driver); ++ platform_driver_unregister(&bcm2835_alsa3_driver); ++ platform_driver_unregister(&bcm2835_alsa4_driver); ++ platform_driver_unregister(&bcm2835_alsa5_driver); ++ platform_driver_unregister(&bcm2835_alsa6_driver); ++ platform_driver_unregister(&bcm2835_alsa7_driver); ++} ++ ++late_initcall(bcm2835_alsa_device_init); ++module_exit(bcm2835_alsa_device_exit); ++ ++MODULE_AUTHOR("Dom Cobley"); ++MODULE_DESCRIPTION("Alsa driver for BCM2835 chip"); ++MODULE_LICENSE("GPL"); ++MODULE_ALIAS("platform:bcm2835_alsa"); +diff --git a/sound/arm/bcm2835.h b/sound/arm/bcm2835.h +new file mode 100755 +index 0000000..0f71c5d +--- /dev/null ++++ b/sound/arm/bcm2835.h +@@ -0,0 +1,167 @@ ++/***************************************************************************** ++* Copyright 2011 Broadcom Corporation. All rights reserved. ++* ++* Unless you and Broadcom execute a separate written software license ++* agreement governing use of this software, this software is licensed to you ++* under the terms of the GNU General Public License version 2, available at ++* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). ++* ++* Notwithstanding the above, under no circumstances may you combine this ++* software in any way with any other Broadcom software provided under a ++* license other than the GPL, without Broadcom's express prior written ++* consent. ++*****************************************************************************/ ++ ++#ifndef __SOUND_ARM_BCM2835_H ++#define __SOUND_ARM_BCM2835_H ++ ++#include <linux/device.h> ++#include <linux/list.h> ++#include <linux/interrupt.h> ++#include <linux/wait.h> ++#include <sound/core.h> ++#include <sound/initval.h> ++#include <sound/pcm.h> ++#include <sound/pcm_params.h> ++#include <sound/pcm-indirect.h> ++#include <linux/workqueue.h> ++ ++/* ++#define AUDIO_DEBUG_ENABLE ++#define AUDIO_VERBOSE_DEBUG_ENABLE ++*/ ++ ++/* Debug macros */ ++ ++#ifdef AUDIO_DEBUG_ENABLE ++#ifdef AUDIO_VERBOSE_DEBUG_ENABLE ++ ++#define audio_debug(fmt, arg...) \ ++ printk(KERN_INFO"%s:%d " fmt, __func__, __LINE__, ##arg) ++ ++#define audio_info(fmt, arg...) \ ++ printk(KERN_INFO"%s:%d " fmt, __func__, __LINE__, ##arg) ++ ++#else ++ ++#define audio_debug(fmt, arg...) ++ ++#define audio_info(fmt, arg...) ++ ++#endif /* AUDIO_VERBOSE_DEBUG_ENABLE */ ++ ++#else ++ ++#define audio_debug(fmt, arg...) ++ ++#define audio_info(fmt, arg...) ++ ++#endif /* AUDIO_DEBUG_ENABLE */ ++ ++#define audio_error(fmt, arg...) \ ++ printk(KERN_ERR"%s:%d " fmt, __func__, __LINE__, ##arg) ++ ++#define audio_warning(fmt, arg...) \ ++ printk(KERN_WARNING"%s:%d " fmt, __func__, __LINE__, ##arg) ++ ++#define audio_alert(fmt, arg...) \ ++ printk(KERN_ALERT"%s:%d " fmt, __func__, __LINE__, ##arg) ++ ++#define MAX_SUBSTREAMS (8) ++#define AVAIL_SUBSTREAMS_MASK (0xff) ++enum { ++ CTRL_VOL_MUTE, ++ CTRL_VOL_UNMUTE ++}; ++ ++/* macros for alsa2chip and chip2alsa, instead of functions */ ++ ++#define alsa2chip(vol) (uint)(-((vol << 8) / 100)) /* convert alsa to chip volume (defined as macro rather than function call) */ ++#define chip2alsa(vol) -((vol * 100) >> 8) /* convert chip to alsa volume */ ++ ++/* Some constants for values .. */ ++typedef enum { ++ AUDIO_DEST_AUTO = 0, ++ AUDIO_DEST_HEADPHONES = 1, ++ AUDIO_DEST_HDMI = 2, ++ AUDIO_DEST_MAX, ++} SND_BCM2835_ROUTE_T; ++ ++typedef enum { ++ PCM_PLAYBACK_VOLUME, ++ PCM_PLAYBACK_MUTE, ++ PCM_PLAYBACK_DEVICE, ++} SND_BCM2835_CTRL_T; ++ ++/* definition of the chip-specific record */ ++typedef struct bcm2835_chip { ++ struct snd_card *card; ++ struct snd_pcm *pcm; ++ struct snd_pcm *pcm_spdif; ++ /* Bitmat for valid reg_base and irq numbers */ ++ uint32_t avail_substreams; ++ struct platform_device *pdev[MAX_SUBSTREAMS]; ++ struct bcm2835_alsa_stream *alsa_stream[MAX_SUBSTREAMS]; ++ ++ int volume; ++ int old_volume; /* stores the volume value whist muted */ ++ int dest; ++ int mute; ++ ++ unsigned int opened; ++ unsigned int spdif_status; ++ struct mutex audio_mutex; ++} bcm2835_chip_t; ++ ++typedef struct bcm2835_alsa_stream { ++ bcm2835_chip_t *chip; ++ struct snd_pcm_substream *substream; ++ struct snd_pcm_indirect pcm_indirect; ++ ++ struct semaphore buffers_update_sem; ++ struct semaphore control_sem; ++ spinlock_t lock; ++ volatile uint32_t control; ++ volatile uint32_t status; ++ ++ int open; ++ int running; ++ int draining; ++ ++ int channels; ++ int params_rate; ++ int pcm_format_width; ++ ++ unsigned int pos; ++ unsigned int buffer_size; ++ unsigned int period_size; ++ ++ uint32_t enable_fifo_irq; ++ irq_handler_t fifo_irq_handler; ++ ++ atomic_t retrieved; ++ struct opaque_AUDIO_INSTANCE_T *instance; ++ struct workqueue_struct *my_wq; ++ int idx; ++} bcm2835_alsa_stream_t; ++ ++int snd_bcm2835_new_ctl(bcm2835_chip_t * chip); ++int snd_bcm2835_new_pcm(bcm2835_chip_t * chip); ++int snd_bcm2835_new_spdif_pcm(bcm2835_chip_t * chip); ++ ++int bcm2835_audio_open(bcm2835_alsa_stream_t * alsa_stream); ++int bcm2835_audio_close(bcm2835_alsa_stream_t * alsa_stream); ++int bcm2835_audio_set_params(bcm2835_alsa_stream_t * alsa_stream, ++ uint32_t channels, uint32_t samplerate, ++ uint32_t bps); ++int bcm2835_audio_setup(bcm2835_alsa_stream_t * alsa_stream); ++int bcm2835_audio_start(bcm2835_alsa_stream_t * alsa_stream); ++int bcm2835_audio_stop(bcm2835_alsa_stream_t * alsa_stream); ++int bcm2835_audio_set_ctls(bcm2835_chip_t * chip); ++int bcm2835_audio_write(bcm2835_alsa_stream_t * alsa_stream, uint32_t count, ++ void *src); ++uint32_t bcm2835_audio_retrieve_buffers(bcm2835_alsa_stream_t * alsa_stream); ++void bcm2835_audio_flush_buffers(bcm2835_alsa_stream_t * alsa_stream); ++void bcm2835_audio_flush_playback_buffers(bcm2835_alsa_stream_t * alsa_stream); ++ ++#endif /* __SOUND_ARM_BCM2835_H */ +diff --git a/sound/arm/vc_vchi_audioserv_defs.h b/sound/arm/vc_vchi_audioserv_defs.h +new file mode 100644 +index 0000000..af3e6eb +--- /dev/null ++++ b/sound/arm/vc_vchi_audioserv_defs.h +@@ -0,0 +1,116 @@ ++/***************************************************************************** ++* Copyright 2011 Broadcom Corporation. All rights reserved. ++* ++* Unless you and Broadcom execute a separate written software license ++* agreement governing use of this software, this software is licensed to you ++* under the terms of the GNU General Public License version 2, available at ++* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). ++* ++* Notwithstanding the above, under no circumstances may you combine this ++* software in any way with any other Broadcom software provided under a ++* license other than the GPL, without Broadcom's express prior written ++* consent. ++*****************************************************************************/ ++ ++#ifndef _VC_AUDIO_DEFS_H_ ++#define _VC_AUDIO_DEFS_H_ ++ ++#define VC_AUDIOSERV_MIN_VER 1 ++#define VC_AUDIOSERV_VER 2 ++ ++// FourCC code used for VCHI connection ++#define VC_AUDIO_SERVER_NAME MAKE_FOURCC("AUDS") ++ ++// Maximum message length ++#define VC_AUDIO_MAX_MSG_LEN (sizeof( VC_AUDIO_MSG_T )) ++ ++// List of screens that are currently supported ++// All message types supported for HOST->VC direction ++typedef enum { ++ VC_AUDIO_MSG_TYPE_RESULT, // Generic result ++ VC_AUDIO_MSG_TYPE_COMPLETE, // Generic result ++ VC_AUDIO_MSG_TYPE_CONFIG, // Configure audio ++ VC_AUDIO_MSG_TYPE_CONTROL, // Configure audio ++ VC_AUDIO_MSG_TYPE_OPEN, // Configure audio ++ VC_AUDIO_MSG_TYPE_CLOSE, // Configure audio ++ VC_AUDIO_MSG_TYPE_START, // Configure audio ++ VC_AUDIO_MSG_TYPE_STOP, // Configure audio ++ VC_AUDIO_MSG_TYPE_WRITE, // Configure audio ++ VC_AUDIO_MSG_TYPE_MAX ++} VC_AUDIO_MSG_TYPE; ++ ++// configure the audio ++typedef struct { ++ uint32_t channels; ++ uint32_t samplerate; ++ uint32_t bps; ++ ++} VC_AUDIO_CONFIG_T; ++ ++typedef struct { ++ uint32_t volume; ++ uint32_t dest; ++ ++} VC_AUDIO_CONTROL_T; ++ ++// audio ++typedef struct { ++ uint32_t dummy; ++ ++} VC_AUDIO_OPEN_T; ++ ++// audio ++typedef struct { ++ uint32_t dummy; ++ ++} VC_AUDIO_CLOSE_T; ++// audio ++typedef struct { ++ uint32_t dummy; ++ ++} VC_AUDIO_START_T; ++// audio ++typedef struct { ++ uint32_t draining; ++ ++} VC_AUDIO_STOP_T; ++ ++// configure the write audio samples ++typedef struct { ++ uint32_t count; // in bytes ++ void *callback; ++ void *cookie; ++ uint16_t silence; ++ uint16_t max_packet; ++} VC_AUDIO_WRITE_T; ++ ++// Generic result for a request (VC->HOST) ++typedef struct { ++ int32_t success; // Success value ++ ++} VC_AUDIO_RESULT_T; ++ ++// Generic result for a request (VC->HOST) ++typedef struct { ++ int32_t count; // Success value ++ void *callback; ++ void *cookie; ++} VC_AUDIO_COMPLETE_T; ++ ++// Message header for all messages in HOST->VC direction ++typedef struct { ++ int32_t type; // Message type (VC_AUDIO_MSG_TYPE) ++ union { ++ VC_AUDIO_CONFIG_T config; ++ VC_AUDIO_CONTROL_T control; ++ VC_AUDIO_OPEN_T open; ++ VC_AUDIO_CLOSE_T close; ++ VC_AUDIO_START_T start; ++ VC_AUDIO_STOP_T stop; ++ VC_AUDIO_WRITE_T write; ++ VC_AUDIO_RESULT_T result; ++ VC_AUDIO_COMPLETE_T complete; ++ } u; ++} VC_AUDIO_MSG_T; ++ ++#endif // _VC_AUDIO_DEFS_H_ + +From cd1caba5928a0a0e6c8901da2151c83428f03b4f Mon Sep 17 00:00:00 2001 +From: popcornmix <popcornmix@gmail.com> +Date: Tue, 2 Jul 2013 23:42:01 +0100 +Subject: [PATCH 041/112] bcm2708 vchiq driver +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: popcornmix <popcornmix@gmail.com> + +vchiq: create_pagelist copes with vmalloc memory + +Signed-off-by: Daniel Stone <daniels@collabora.com> + +vchiq: fix the shim message release + +Signed-off-by: Daniel Stone <daniels@collabora.com> + +vchiq: export additional symbols + +Signed-off-by: Daniel Stone <daniels@collabora.com> + +VCHIQ: Make service closure fully synchronous (drv) + +This is one half of a two-part patch, the other half of which is to +the vchiq_lib user library. With these patches, calls to +vchiq_close_service and vchiq_remove_service won't return until any +associated callbacks have been delivered to the callback thread. + +VCHIQ: Add per-service tracing + +The new service option VCHIQ_SERVICE_OPTION_TRACE is a boolean that +toggles tracing for the specified service. + +This commit also introduces vchi_service_set_option and the associated +option VCHI_SERVICE_OPTION_TRACE. + +vchiq: Make the synchronous-CLOSE logic more tolerant + +vchiq: Move logging control into debugfs + +vchiq: Take care of a corner case tickled by VCSM + +Closing a connection that isn't fully open requires care, since one +side does not know the other side's port number. Code was present to +handle the case where a CLOSE is sent immediately after an OPEN, i.e. +before the OPENACK has been received, but this was incorrectly being +used when an OPEN from a client using port 0 was rejected. + +(In the observed failure, the host was attempting to use the VCSM +service, which isn't present in the 'cutdown' firmware. The failure +was intermittent because sometimes the keepalive service would +grab port 0.) + +This case can be distinguished because the client's remoteport will +still be VCHIQ_PORT_FREE, and the srvstate will be OPENING. Either +condition is sufficient to differentiate it from the special case +described above. + +vchiq: Avoid high load when blocked and unkillable + +vchiq: Include SIGSTOP and SIGCONT in list of signals not-masked by vchiq to allow gdb to work + +vchiq_arm: Complete support for SYNCHRONOUS mode + +vchiq: Remove inline from suspend/resume + +vchiq: Allocation does not need to be atomic + +vchiq: Fix wrong condition check + +The log level is checked from within the log call. Remove the check in the call. + +Signed-off-by: Pranith Kumar <bobby.prani@gmail.com> + +BCM270x: Add vchiq device to platform file and Device Tree + +Prepare to turn the vchiq module into a driver. + +Signed-off-by: Noralf Trønnes <noralf@tronnes.org> + +bcm2708: vchiq: Add Device Tree support + +Turn vchiq into a driver and stop hardcoding resources. +Use devm_* functions in probe path to simplify cleanup. +A global variable is used to hold the register address. This is done +to keep this patch as small as possible. +Also make available on ARCH_BCM2835. +Based on work by Lubomir Rintel. + +Signed-off-by: Noralf Trønnes <noralf@tronnes.org> + +vchiq: Change logging level for inbound data + +vchiq_arm: Two cacheing fixes + +1) Make fragment size vary with cache line size +Without this patch, non-cache-line-aligned transfers may corrupt +(or be corrupted by) adjacent data structures. + +Both ARM and VC need to be updated to enable this feature. This is +ensured by having the loader apply a new DT parameter - +cache-line-size. The existence of this parameter guarantees that the +kernel is capable, and the parameter will only be modified from the +safe default if the loader is capable. + +2) Flush/invalidate vmalloc'd memory, and invalidate after reads + +vchiq: fix NULL pointer dereference when closing driver + +The following code run as root will cause a null pointer dereference oops: + + int fd = open("/dev/vc-cma", O_RDONLY); + if (fd < 0) + err(1, "open failed"); + (void)close(fd); + +[ 1704.877721] Unable to handle kernel NULL pointer dereference at virtual address 00000000 +[ 1704.877725] pgd = b899c000 +[ 1704.877736] [00000000] *pgd=37fab831, *pte=00000000, *ppte=00000000 +[ 1704.877748] Internal error: Oops: 817 [#1] PREEMPT SMP ARM +[ 1704.877765] Modules linked in: evdev i2c_bcm2708 uio_pdrv_genirq uio +[ 1704.877774] CPU: 2 PID: 3656 Comm: stress-ng-fstat Not tainted 3.19.1-12-generic-bcm2709 #12-Ubuntu +[ 1704.877777] Hardware name: BCM2709 +[ 1704.877783] task: b8ab9b00 ti: b7e68000 task.ti: b7e68000 +[ 1704.877798] PC is at __down_interruptible+0x50/0xec +[ 1704.877806] LR is at down_interruptible+0x5c/0x68 +[ 1704.877813] pc : [<80630ee8>] lr : [<800704b0>] psr: 60080093 +sp : b7e69e50 ip : b7e69e88 fp : b7e69e84 +[ 1704.877817] r10: b88123c8 r9 : 00000010 r8 : 00000001 +[ 1704.877822] r7 : b8ab9b00 r6 : 7fffffff r5 : 80a1cc34 r4 : 80a1cc34 +[ 1704.877826] r3 : b7e69e50 r2 : 00000000 r1 : 00000000 r0 : 80a1cc34 +[ 1704.877833] Flags: nZCv IRQs off FIQs on Mode SVC_32 ISA ARM Segment user +[ 1704.877838] Control: 10c5387d Table: 3899c06a DAC: 00000015 +[ 1704.877843] Process do-oops (pid: 3656, stack limit = 0xb7e68238) +[ 1704.877848] Stack: (0xb7e69e50 to 0xb7e6a000) +[ 1704.877856] 9e40: 80a1cc3c 00000000 00000010 b88123c8 +[ 1704.877865] 9e60: b7e69e84 80a1cc34 fff9fee9 ffffffff b7e68000 00000009 b7e69ea4 b7e69e88 +[ 1704.877874] 9e80: 800704b0 80630ea4 fff9fee9 60080013 80a1cc28 fff9fee9 b7e69edc b7e69ea8 +[ 1704.877884] 9ea0: 8040f558 80070460 fff9fee9 ffffffff 00000000 00000000 00000009 80a1cb7c +[ 1704.877893] 9ec0: 00000000 80a1cb7c 00000000 00000010 b7e69ef4 b7e69ee0 803e1ba4 8040f514 +[ 1704.877902] 9ee0: 00000e48 80a1cb7c b7e69f14 b7e69ef8 803e1c9c 803e1b74 b88123c0 b92acb18 +[ 1704.877911] 9f00: b8812790 b8d815d8 b7e69f24 b7e69f18 803e2250 803e1bc8 b7e69f5c b7e69f28 +[ 1704.877921] 9f20: 80167bac 803e222c 00000000 00000000 b7e69f54 b8ab9ffc 00000000 8098c794 +[ 1704.877930] 9f40: b8ab9b00 8000efc4 b7e68000 00000000 b7e69f6c b7e69f60 80167d6c 80167b28 +[ 1704.877939] 9f60: b7e69f8c b7e69f70 80047d38 80167d60 b7e68000 b7e68010 8000efc4 b7e69fb0 +[ 1704.877949] 9f80: b7e69fac b7e69f90 80012820 80047c84 01155490 011549a8 00000001 00000006 +[ 1704.877957] 9fa0: 00000000 b7e69fb0 8000ee5c 80012790 00000000 353d8c0f 7efc4308 00000000 +[ 1704.877966] 9fc0: 01155490 011549a8 00000001 00000006 00000000 00000000 76cf3ba0 00000003 +[ 1704.877975] 9fe0: 00000000 7efc42e4 0002272f 76e2ed66 60080030 00000003 00000000 00000000 +[ 1704.877998] [<80630ee8>] (__down_interruptible) from [<800704b0>] (down_interruptible+0x5c/0x68) +[ 1704.878015] [<800704b0>] (down_interruptible) from [<8040f558>] (vchiu_queue_push+0x50/0xd8) +[ 1704.878032] [<8040f558>] (vchiu_queue_push) from [<803e1ba4>] (send_worker_msg+0x3c/0x54) +[ 1704.878045] [<803e1ba4>] (send_worker_msg) from [<803e1c9c>] (vc_cma_set_reserve+0xe0/0x1c4) +[ 1704.878057] [<803e1c9c>] (vc_cma_set_reserve) from [<803e2250>] (vc_cma_release+0x30/0x38) +[ 1704.878069] [<803e2250>] (vc_cma_release) from [<80167bac>] (__fput+0x90/0x1e0) +[ 1704.878082] [<80167bac>] (__fput) from [<80167d6c>] (____fput+0x18/0x1c) +[ 1704.878094] [<80167d6c>] (____fput) from [<80047d38>] (task_work_run+0xc0/0xf8) +[ 1704.878109] [<80047d38>] (task_work_run) from [<80012820>] (do_work_pending+0x9c/0xc4) +[ 1704.878123] [<80012820>] (do_work_pending) from [<8000ee5c>] (work_pending+0xc/0x20) +[ 1704.878133] Code: e50b1034 e3a01000 e50b2030 e580300c (e5823000) + +..the fix is to ensure that we have actually initialized the queue before we attempt +to push any items onto it. This occurs if we do an open() followed by a close() without +any activity in between. + +Signed-off-by: Colin Ian King <colin.king@canonical.com> + +vchiq_arm: Sort out the vmalloc case + +See: https://github.com/raspberrypi/linux/issues/1055 + +vchiq: hack: Add include depecated dma include file + +vchiq_arm: Tweak the logging output + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> + +vchiq_arm: Access the dequeue_pending flag locked + +Reading through this code looking for another problem (now found in userland) +the use of dequeue_pending outside a lock didn't seem safe. + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> + +vchiq_arm: Service callbacks must not fail + +Service callbacks are not allowed to return an error. The internal callback +that delivers events and messages to user tasks does not enqueue them if +the service is closing, but this is not an error and should not be +reported as such. + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> + +vchiq_arm: do not use page_cache_release(page) macro (#1403) + +This macro is gone since 1fa64f198b9f8d6ec0f7aec7c18dc94684391140. + +Signed-off-by: Slawomir Stepien <sst@poczta.fm> + +vchiq: Upate to match get_user_pages prototype + +vchiq_arm: Add completion records under the mutex + +An issue was observed when flushing openmax components +which generate a large number of messages returning +buffers to host. + +We occasionally found a duplicate message from 16 +messages prior, resulting in a buffer returned twice. + +While only one thread adds completions, without the +mutex you don't get the protection of the automatic +memory barrier you get with synchronisation objects. + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> +--- + arch/arm/mach-bcm2708/include/mach/platform.h | 2 + + arch/arm/mach-bcm2709/include/mach/platform.h | 2 + + drivers/misc/Kconfig | 1 + + drivers/misc/Makefile | 1 + + drivers/misc/vc04_services/Kconfig | 9 + + drivers/misc/vc04_services/Makefile | 14 + + .../interface/vchi/connections/connection.h | 328 ++ + .../interface/vchi/message_drivers/message.h | 204 + + drivers/misc/vc04_services/interface/vchi/vchi.h | 378 ++ + .../misc/vc04_services/interface/vchi/vchi_cfg.h | 224 ++ + .../interface/vchi/vchi_cfg_internal.h | 71 + + .../vc04_services/interface/vchi/vchi_common.h | 175 + + .../misc/vc04_services/interface/vchi/vchi_mh.h | 42 + + .../misc/vc04_services/interface/vchiq_arm/vchiq.h | 40 + + .../vc04_services/interface/vchiq_arm/vchiq_2835.h | 42 + + .../interface/vchiq_arm/vchiq_2835_arm.c | 586 +++ + .../vc04_services/interface/vchiq_arm/vchiq_arm.c | 2920 +++++++++++++++ + .../vc04_services/interface/vchiq_arm/vchiq_arm.h | 220 ++ + .../interface/vchiq_arm/vchiq_build_info.h | 37 + + .../vc04_services/interface/vchiq_arm/vchiq_cfg.h | 69 + + .../interface/vchiq_arm/vchiq_connected.c | 120 + + .../interface/vchiq_arm/vchiq_connected.h | 50 + + .../vc04_services/interface/vchiq_arm/vchiq_core.c | 3929 ++++++++++++++++++++ + .../vc04_services/interface/vchiq_arm/vchiq_core.h | 712 ++++ + .../interface/vchiq_arm/vchiq_debugfs.c | 383 ++ + .../interface/vchiq_arm/vchiq_debugfs.h | 52 + + .../interface/vchiq_arm/vchiq_genversion | 87 + + .../vc04_services/interface/vchiq_arm/vchiq_if.h | 189 + + .../interface/vchiq_arm/vchiq_ioctl.h | 131 + + .../interface/vchiq_arm/vchiq_kern_lib.c | 458 +++ + .../interface/vchiq_arm/vchiq_killable.h | 69 + + .../interface/vchiq_arm/vchiq_memdrv.h | 71 + + .../interface/vchiq_arm/vchiq_pagelist.h | 58 + + .../vc04_services/interface/vchiq_arm/vchiq_shim.c | 860 +++++ + .../vc04_services/interface/vchiq_arm/vchiq_util.c | 156 + + .../vc04_services/interface/vchiq_arm/vchiq_util.h | 82 + + .../interface/vchiq_arm/vchiq_version.c | 59 + + 37 files changed, 12831 insertions(+) + create mode 100644 drivers/misc/vc04_services/Kconfig + create mode 100644 drivers/misc/vc04_services/Makefile + create mode 100644 drivers/misc/vc04_services/interface/vchi/connections/connection.h + create mode 100644 drivers/misc/vc04_services/interface/vchi/message_drivers/message.h + create mode 100644 drivers/misc/vc04_services/interface/vchi/vchi.h + create mode 100644 drivers/misc/vc04_services/interface/vchi/vchi_cfg.h + create mode 100644 drivers/misc/vc04_services/interface/vchi/vchi_cfg_internal.h + create mode 100644 drivers/misc/vc04_services/interface/vchi/vchi_common.h + create mode 100644 drivers/misc/vc04_services/interface/vchi/vchi_mh.h + create mode 100644 drivers/misc/vc04_services/interface/vchiq_arm/vchiq.h + create mode 100644 drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835.h + create mode 100644 drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c + create mode 100644 drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm.c + create mode 100644 drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm.h + create mode 100644 drivers/misc/vc04_services/interface/vchiq_arm/vchiq_build_info.h + create mode 100644 drivers/misc/vc04_services/interface/vchiq_arm/vchiq_cfg.h + create mode 100644 drivers/misc/vc04_services/interface/vchiq_arm/vchiq_connected.c + create mode 100644 drivers/misc/vc04_services/interface/vchiq_arm/vchiq_connected.h + create mode 100644 drivers/misc/vc04_services/interface/vchiq_arm/vchiq_core.c + create mode 100644 drivers/misc/vc04_services/interface/vchiq_arm/vchiq_core.h + create mode 100644 drivers/misc/vc04_services/interface/vchiq_arm/vchiq_debugfs.c + create mode 100644 drivers/misc/vc04_services/interface/vchiq_arm/vchiq_debugfs.h + create mode 100644 drivers/misc/vc04_services/interface/vchiq_arm/vchiq_genversion + create mode 100644 drivers/misc/vc04_services/interface/vchiq_arm/vchiq_if.h + create mode 100644 drivers/misc/vc04_services/interface/vchiq_arm/vchiq_ioctl.h + create mode 100644 drivers/misc/vc04_services/interface/vchiq_arm/vchiq_kern_lib.c + create mode 100644 drivers/misc/vc04_services/interface/vchiq_arm/vchiq_killable.h + create mode 100644 drivers/misc/vc04_services/interface/vchiq_arm/vchiq_memdrv.h + create mode 100644 drivers/misc/vc04_services/interface/vchiq_arm/vchiq_pagelist.h + create mode 100644 drivers/misc/vc04_services/interface/vchiq_arm/vchiq_shim.c + create mode 100644 drivers/misc/vc04_services/interface/vchiq_arm/vchiq_util.c + create mode 100644 drivers/misc/vc04_services/interface/vchiq_arm/vchiq_util.h + create mode 100644 drivers/misc/vc04_services/interface/vchiq_arm/vchiq_version.c + +diff --git a/arch/arm/mach-bcm2708/include/mach/platform.h b/arch/arm/mach-bcm2708/include/mach/platform.h +index 4fb43cf..e98ec5a 100644 +--- a/arch/arm/mach-bcm2708/include/mach/platform.h ++++ b/arch/arm/mach-bcm2708/include/mach/platform.h +@@ -78,6 +78,8 @@ + #define ARMCTRL_IC_BASE (ARM_BASE + 0x200) /* ARM interrupt controller */ + #define ARMCTRL_TIMER0_1_BASE (ARM_BASE + 0x400) /* Timer 0 and 1 */ + #define ARMCTRL_0_SBM_BASE (ARM_BASE + 0x800) /* User 0 (ARM)'s Semaphores Doorbells and Mailboxes */ ++#define ARMCTRL_0_BELL_BASE (ARMCTRL_0_SBM_BASE + 0x40) /* User 0 (ARM)'s Doorbell */ ++#define ARMCTRL_0_MAIL0_BASE (ARMCTRL_0_SBM_BASE + 0x80) /* User 0 (ARM)'s Mailbox 0 */ + + /* + * Watchdog +diff --git a/arch/arm/mach-bcm2709/include/mach/platform.h b/arch/arm/mach-bcm2709/include/mach/platform.h +index 311b9f2..9a638f5 100644 +--- a/arch/arm/mach-bcm2709/include/mach/platform.h ++++ b/arch/arm/mach-bcm2709/include/mach/platform.h +@@ -78,6 +78,8 @@ + #define ARMCTRL_IC_BASE (ARM_BASE + 0x200) /* ARM interrupt controller */ + #define ARMCTRL_TIMER0_1_BASE (ARM_BASE + 0x400) /* Timer 0 and 1 */ + #define ARMCTRL_0_SBM_BASE (ARM_BASE + 0x800) /* User 0 (ARM)'s Semaphores Doorbells and Mailboxes */ ++#define ARMCTRL_0_BELL_BASE (ARMCTRL_0_SBM_BASE + 0x40) /* User 0 (ARM)'s Doorbell */ ++#define ARMCTRL_0_MAIL0_BASE (ARMCTRL_0_SBM_BASE + 0x80) /* User 0 (ARM)'s Mailbox 0 */ + + /* + * Watchdog +diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig +index a216b46..90af750 100644 +--- a/drivers/misc/Kconfig ++++ b/drivers/misc/Kconfig +@@ -812,6 +812,7 @@ source "drivers/misc/lis3lv02d/Kconfig" + source "drivers/misc/altera-stapl/Kconfig" + source "drivers/misc/mei/Kconfig" + source "drivers/misc/vmw_vmci/Kconfig" ++source "drivers/misc/vc04_services/Kconfig" + source "drivers/misc/mic/Kconfig" + source "drivers/misc/genwqe/Kconfig" + source "drivers/misc/echo/Kconfig" +diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile +index b2fb6dbf..1a58cf7 100644 +--- a/drivers/misc/Makefile ++++ b/drivers/misc/Makefile +@@ -51,6 +51,7 @@ obj-$(CONFIG_INTEL_MEI) += mei/ + obj-$(CONFIG_VMWARE_VMCI) += vmw_vmci/ + obj-$(CONFIG_LATTICE_ECP3_CONFIG) += lattice-ecp3-config.o + obj-$(CONFIG_SRAM) += sram.o ++obj-$(CONFIG_BCM2708_VCHIQ) += vc04_services/ + obj-y += mic/ + obj-$(CONFIG_GENWQE) += genwqe/ + obj-$(CONFIG_ECHO) += echo/ +diff --git a/drivers/misc/vc04_services/Kconfig b/drivers/misc/vc04_services/Kconfig +new file mode 100644 +index 0000000..db8e1be +--- /dev/null ++++ b/drivers/misc/vc04_services/Kconfig +@@ -0,0 +1,9 @@ ++config BCM2708_VCHIQ ++ tristate "Videocore VCHIQ" ++ depends on RASPBERRYPI_FIRMWARE ++ default y ++ help ++ Kernel to VideoCore communication interface for the ++ BCM2708 family of products. ++ Defaults to Y when the Broadcom Videocore services ++ are included in the build, N otherwise. +diff --git a/drivers/misc/vc04_services/Makefile b/drivers/misc/vc04_services/Makefile +new file mode 100644 +index 0000000..8d038fe +--- /dev/null ++++ b/drivers/misc/vc04_services/Makefile +@@ -0,0 +1,14 @@ ++obj-$(CONFIG_BCM2708_VCHIQ) += vchiq.o ++ ++vchiq-objs := \ ++ interface/vchiq_arm/vchiq_core.o \ ++ interface/vchiq_arm/vchiq_arm.o \ ++ interface/vchiq_arm/vchiq_kern_lib.o \ ++ interface/vchiq_arm/vchiq_2835_arm.o \ ++ interface/vchiq_arm/vchiq_debugfs.o \ ++ interface/vchiq_arm/vchiq_shim.o \ ++ interface/vchiq_arm/vchiq_util.o \ ++ interface/vchiq_arm/vchiq_connected.o \ ++ ++ccflags-y += -DVCOS_VERIFY_BKPTS=1 -Idrivers/misc/vc04_services -DUSE_VCHIQ_ARM -D__VCCOREVER__=0x04000000 ++ +diff --git a/drivers/misc/vc04_services/interface/vchi/connections/connection.h b/drivers/misc/vc04_services/interface/vchi/connections/connection.h +new file mode 100644 +index 0000000..fef6ac3 +--- /dev/null ++++ b/drivers/misc/vc04_services/interface/vchi/connections/connection.h +@@ -0,0 +1,328 @@ ++/** ++ * Copyright (c) 2010-2012 Broadcom. 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, ++ * without modification. ++ * 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. ++ * 3. The names of the above-listed copyright holders may not be used ++ * to endorse or promote products derived from this software without ++ * specific prior written permission. ++ * ++ * ALTERNATIVELY, this software may be distributed under the terms of the ++ * GNU General Public License ("GPL") version 2, as published by the Free ++ * Software Foundation. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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. ++ */ ++ ++#ifndef CONNECTION_H_ ++#define CONNECTION_H_ ++ ++#include <linux/kernel.h> ++#include <linux/types.h> ++#include <linux/semaphore.h> ++ ++#include "interface/vchi/vchi_cfg_internal.h" ++#include "interface/vchi/vchi_common.h" ++#include "interface/vchi/message_drivers/message.h" ++ ++/****************************************************************************** ++ Global defs ++ *****************************************************************************/ ++ ++// Opaque handle for a connection / service pair ++typedef struct opaque_vchi_connection_connected_service_handle_t *VCHI_CONNECTION_SERVICE_HANDLE_T; ++ ++// opaque handle to the connection state information ++typedef struct opaque_vchi_connection_info_t VCHI_CONNECTION_STATE_T; ++ ++typedef struct vchi_connection_t VCHI_CONNECTION_T; ++ ++ ++/****************************************************************************** ++ API ++ *****************************************************************************/ ++ ++// Routine to init a connection with a particular low level driver ++typedef VCHI_CONNECTION_STATE_T * (*VCHI_CONNECTION_INIT_T)( struct vchi_connection_t * connection, ++ const VCHI_MESSAGE_DRIVER_T * driver ); ++ ++// Routine to control CRC enabling at a connection level ++typedef int32_t (*VCHI_CONNECTION_CRC_CONTROL_T)( VCHI_CONNECTION_STATE_T *state_handle, ++ VCHI_CRC_CONTROL_T control ); ++ ++// Routine to create a service ++typedef int32_t (*VCHI_CONNECTION_SERVICE_CONNECT_T)( VCHI_CONNECTION_STATE_T *state_handle, ++ int32_t service_id, ++ uint32_t rx_fifo_size, ++ uint32_t tx_fifo_size, ++ int server, ++ VCHI_CALLBACK_T callback, ++ void *callback_param, ++ int32_t want_crc, ++ int32_t want_unaligned_bulk_rx, ++ int32_t want_unaligned_bulk_tx, ++ VCHI_CONNECTION_SERVICE_HANDLE_T *service_handle ); ++ ++// Routine to close a service ++typedef int32_t (*VCHI_CONNECTION_SERVICE_DISCONNECT_T)( VCHI_CONNECTION_SERVICE_HANDLE_T service_handle ); ++ ++// Routine to queue a message ++typedef int32_t (*VCHI_CONNECTION_SERVICE_QUEUE_MESSAGE_T)( VCHI_CONNECTION_SERVICE_HANDLE_T service_handle, ++ const void *data, ++ uint32_t data_size, ++ VCHI_FLAGS_T flags, ++ void *msg_handle ); ++ ++// scatter-gather (vector) message queueing ++typedef int32_t (*VCHI_CONNECTION_SERVICE_QUEUE_MESSAGEV_T)( VCHI_CONNECTION_SERVICE_HANDLE_T service_handle, ++ VCHI_MSG_VECTOR_T *vector, ++ uint32_t count, ++ VCHI_FLAGS_T flags, ++ void *msg_handle ); ++ ++// Routine to dequeue a message ++typedef int32_t (*VCHI_CONNECTION_SERVICE_DEQUEUE_MESSAGE_T)( VCHI_CONNECTION_SERVICE_HANDLE_T service_handle, ++ void *data, ++ uint32_t max_data_size_to_read, ++ uint32_t *actual_msg_size, ++ VCHI_FLAGS_T flags ); ++ ++// Routine to peek at a message ++typedef int32_t (*VCHI_CONNECTION_SERVICE_PEEK_MESSAGE_T)( VCHI_CONNECTION_SERVICE_HANDLE_T service_handle, ++ void **data, ++ uint32_t *msg_size, ++ VCHI_FLAGS_T flags ); ++ ++// Routine to hold a message ++typedef int32_t (*VCHI_CONNECTION_SERVICE_HOLD_MESSAGE_T)( VCHI_CONNECTION_SERVICE_HANDLE_T service_handle, ++ void **data, ++ uint32_t *msg_size, ++ VCHI_FLAGS_T flags, ++ void **message_handle ); ++ ++// Routine to initialise a received message iterator ++typedef int32_t (*VCHI_CONNECTION_SERVICE_LOOKAHEAD_MESSAGE_T)( VCHI_CONNECTION_SERVICE_HANDLE_T service_handle, ++ VCHI_MSG_ITER_T *iter, ++ VCHI_FLAGS_T flags ); ++ ++// Routine to release a held message ++typedef int32_t (*VCHI_CONNECTION_HELD_MSG_RELEASE_T)( VCHI_CONNECTION_SERVICE_HANDLE_T service_handle, ++ void *message_handle ); ++ ++// Routine to get info on a held message ++typedef int32_t (*VCHI_CONNECTION_HELD_MSG_INFO_T)( VCHI_CONNECTION_SERVICE_HANDLE_T service_handle, ++ void *message_handle, ++ void **data, ++ int32_t *msg_size, ++ uint32_t *tx_timestamp, ++ uint32_t *rx_timestamp ); ++ ++// Routine to check whether the iterator has a next message ++typedef int32_t (*VCHI_CONNECTION_MSG_ITER_HAS_NEXT_T)( VCHI_CONNECTION_SERVICE_HANDLE_T service, ++ const VCHI_MSG_ITER_T *iter ); ++ ++// Routine to advance the iterator ++typedef int32_t (*VCHI_CONNECTION_MSG_ITER_NEXT_T)( VCHI_CONNECTION_SERVICE_HANDLE_T service, ++ VCHI_MSG_ITER_T *iter, ++ void **data, ++ uint32_t *msg_size ); ++ ++// Routine to remove the last message returned by the iterator ++typedef int32_t (*VCHI_CONNECTION_MSG_ITER_REMOVE_T)( VCHI_CONNECTION_SERVICE_HANDLE_T service, ++ VCHI_MSG_ITER_T *iter ); ++ ++// Routine to hold the last message returned by the iterator ++typedef int32_t (*VCHI_CONNECTION_MSG_ITER_HOLD_T)( VCHI_CONNECTION_SERVICE_HANDLE_T service, ++ VCHI_MSG_ITER_T *iter, ++ void **msg_handle ); ++ ++// Routine to transmit bulk data ++typedef int32_t (*VCHI_CONNECTION_BULK_QUEUE_TRANSMIT_T)( VCHI_CONNECTION_SERVICE_HANDLE_T service_handle, ++ const void *data_src, ++ uint32_t data_size, ++ VCHI_FLAGS_T flags, ++ void *bulk_handle ); ++ ++// Routine to receive data ++typedef int32_t (*VCHI_CONNECTION_BULK_QUEUE_RECEIVE_T)( VCHI_CONNECTION_SERVICE_HANDLE_T service_handle, ++ void *data_dst, ++ uint32_t data_size, ++ VCHI_FLAGS_T flags, ++ void *bulk_handle ); ++ ++// Routine to report if a server is available ++typedef int32_t (*VCHI_CONNECTION_SERVER_PRESENT)( VCHI_CONNECTION_STATE_T *state, int32_t service_id, int32_t peer_flags ); ++ ++// Routine to report the number of RX slots available ++typedef int (*VCHI_CONNECTION_RX_SLOTS_AVAILABLE)( const VCHI_CONNECTION_STATE_T *state ); ++ ++// Routine to report the RX slot size ++typedef uint32_t (*VCHI_CONNECTION_RX_SLOT_SIZE)( const VCHI_CONNECTION_STATE_T *state ); ++ ++// Callback to indicate that the other side has added a buffer to the rx bulk DMA FIFO ++typedef void (*VCHI_CONNECTION_RX_BULK_BUFFER_ADDED)(VCHI_CONNECTION_STATE_T *state, ++ int32_t service, ++ uint32_t length, ++ MESSAGE_TX_CHANNEL_T channel, ++ uint32_t channel_params, ++ uint32_t data_length, ++ uint32_t data_offset); ++ ++// Callback to inform a service that a Xon or Xoff message has been received ++typedef void (*VCHI_CONNECTION_FLOW_CONTROL)(VCHI_CONNECTION_STATE_T *state, int32_t service_id, int32_t xoff); ++ ++// Callback to inform a service that a server available reply message has been received ++typedef void (*VCHI_CONNECTION_SERVER_AVAILABLE_REPLY)(VCHI_CONNECTION_STATE_T *state, int32_t service_id, uint32_t flags); ++ ++// Callback to indicate that bulk auxiliary messages have arrived ++typedef void (*VCHI_CONNECTION_BULK_AUX_RECEIVED)(VCHI_CONNECTION_STATE_T *state); ++ ++// Callback to indicate that bulk auxiliary messages have arrived ++typedef void (*VCHI_CONNECTION_BULK_AUX_TRANSMITTED)(VCHI_CONNECTION_STATE_T *state, void *handle); ++ ++// Callback with all the connection info you require ++typedef void (*VCHI_CONNECTION_INFO)(VCHI_CONNECTION_STATE_T *state, uint32_t protocol_version, uint32_t slot_size, uint32_t num_slots, uint32_t min_bulk_size); ++ ++// Callback to inform of a disconnect ++typedef void (*VCHI_CONNECTION_DISCONNECT)(VCHI_CONNECTION_STATE_T *state, uint32_t flags); ++ ++// Callback to inform of a power control request ++typedef void (*VCHI_CONNECTION_POWER_CONTROL)(VCHI_CONNECTION_STATE_T *state, MESSAGE_TX_CHANNEL_T channel, int32_t enable); ++ ++// allocate memory suitably aligned for this connection ++typedef void * (*VCHI_BUFFER_ALLOCATE)(VCHI_CONNECTION_SERVICE_HANDLE_T service_handle, uint32_t * length); ++ ++// free memory allocated by buffer_allocate ++typedef void (*VCHI_BUFFER_FREE)(VCHI_CONNECTION_SERVICE_HANDLE_T service_handle, void * address); ++ ++ ++/****************************************************************************** ++ System driver struct ++ *****************************************************************************/ ++ ++struct opaque_vchi_connection_api_t ++{ ++ // Routine to init the connection ++ VCHI_CONNECTION_INIT_T init; ++ ++ // Connection-level CRC control ++ VCHI_CONNECTION_CRC_CONTROL_T crc_control; ++ ++ // Routine to connect to or create service ++ VCHI_CONNECTION_SERVICE_CONNECT_T service_connect; ++ ++ // Routine to disconnect from a service ++ VCHI_CONNECTION_SERVICE_DISCONNECT_T service_disconnect; ++ ++ // Routine to queue a message ++ VCHI_CONNECTION_SERVICE_QUEUE_MESSAGE_T service_queue_msg; ++ ++ // scatter-gather (vector) message queue ++ VCHI_CONNECTION_SERVICE_QUEUE_MESSAGEV_T service_queue_msgv; ++ ++ // Routine to dequeue a message ++ VCHI_CONNECTION_SERVICE_DEQUEUE_MESSAGE_T service_dequeue_msg; ++ ++ // Routine to peek at a message ++ VCHI_CONNECTION_SERVICE_PEEK_MESSAGE_T service_peek_msg; ++ ++ // Routine to hold a message ++ VCHI_CONNECTION_SERVICE_HOLD_MESSAGE_T service_hold_msg; ++ ++ // Routine to initialise a received message iterator ++ VCHI_CONNECTION_SERVICE_LOOKAHEAD_MESSAGE_T service_look_ahead_msg; ++ ++ // Routine to release a message ++ VCHI_CONNECTION_HELD_MSG_RELEASE_T held_msg_release; ++ ++ // Routine to get information on a held message ++ VCHI_CONNECTION_HELD_MSG_INFO_T held_msg_info; ++ ++ // Routine to check for next message on iterator ++ VCHI_CONNECTION_MSG_ITER_HAS_NEXT_T msg_iter_has_next; ++ ++ // Routine to get next message on iterator ++ VCHI_CONNECTION_MSG_ITER_NEXT_T msg_iter_next; ++ ++ // Routine to remove the last message returned by iterator ++ VCHI_CONNECTION_MSG_ITER_REMOVE_T msg_iter_remove; ++ ++ // Routine to hold the last message returned by iterator ++ VCHI_CONNECTION_MSG_ITER_HOLD_T msg_iter_hold; ++ ++ // Routine to transmit bulk data ++ VCHI_CONNECTION_BULK_QUEUE_TRANSMIT_T bulk_queue_transmit; ++ ++ // Routine to receive data ++ VCHI_CONNECTION_BULK_QUEUE_RECEIVE_T bulk_queue_receive; ++ ++ // Routine to report the available servers ++ VCHI_CONNECTION_SERVER_PRESENT server_present; ++ ++ // Routine to report the number of RX slots available ++ VCHI_CONNECTION_RX_SLOTS_AVAILABLE connection_rx_slots_available; ++ ++ // Routine to report the RX slot size ++ VCHI_CONNECTION_RX_SLOT_SIZE connection_rx_slot_size; ++ ++ // Callback to indicate that the other side has added a buffer to the rx bulk DMA FIFO ++ VCHI_CONNECTION_RX_BULK_BUFFER_ADDED rx_bulk_buffer_added; ++ ++ // Callback to inform a service that a Xon or Xoff message has been received ++ VCHI_CONNECTION_FLOW_CONTROL flow_control; ++ ++ // Callback to inform a service that a server available reply message has been received ++ VCHI_CONNECTION_SERVER_AVAILABLE_REPLY server_available_reply; ++ ++ // Callback to indicate that bulk auxiliary messages have arrived ++ VCHI_CONNECTION_BULK_AUX_RECEIVED bulk_aux_received; ++ ++ // Callback to indicate that a bulk auxiliary message has been transmitted ++ VCHI_CONNECTION_BULK_AUX_TRANSMITTED bulk_aux_transmitted; ++ ++ // Callback to provide information about the connection ++ VCHI_CONNECTION_INFO connection_info; ++ ++ // Callback to notify that peer has requested disconnect ++ VCHI_CONNECTION_DISCONNECT disconnect; ++ ++ // Callback to notify that peer has requested power change ++ VCHI_CONNECTION_POWER_CONTROL power_control; ++ ++ // allocate memory suitably aligned for this connection ++ VCHI_BUFFER_ALLOCATE buffer_allocate; ++ ++ // free memory allocated by buffer_allocate ++ VCHI_BUFFER_FREE buffer_free; ++ ++}; ++ ++struct vchi_connection_t { ++ const VCHI_CONNECTION_API_T *api; ++ VCHI_CONNECTION_STATE_T *state; ++#ifdef VCHI_COARSE_LOCKING ++ struct semaphore sem; ++#endif ++}; ++ ++ ++#endif /* CONNECTION_H_ */ ++ ++/****************************** End of file **********************************/ +diff --git a/drivers/misc/vc04_services/interface/vchi/message_drivers/message.h b/drivers/misc/vc04_services/interface/vchi/message_drivers/message.h +new file mode 100644 +index 0000000..8b3f767 +--- /dev/null ++++ b/drivers/misc/vc04_services/interface/vchi/message_drivers/message.h +@@ -0,0 +1,204 @@ ++/** ++ * Copyright (c) 2010-2012 Broadcom. 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, ++ * without modification. ++ * 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. ++ * 3. The names of the above-listed copyright holders may not be used ++ * to endorse or promote products derived from this software without ++ * specific prior written permission. ++ * ++ * ALTERNATIVELY, this software may be distributed under the terms of the ++ * GNU General Public License ("GPL") version 2, as published by the Free ++ * Software Foundation. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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. ++ */ ++ ++#ifndef _VCHI_MESSAGE_H_ ++#define _VCHI_MESSAGE_H_ ++ ++#include <linux/kernel.h> ++#include <linux/types.h> ++#include <linux/semaphore.h> ++ ++#include "interface/vchi/vchi_cfg_internal.h" ++#include "interface/vchi/vchi_common.h" ++ ++ ++typedef enum message_event_type { ++ MESSAGE_EVENT_NONE, ++ MESSAGE_EVENT_NOP, ++ MESSAGE_EVENT_MESSAGE, ++ MESSAGE_EVENT_SLOT_COMPLETE, ++ MESSAGE_EVENT_RX_BULK_PAUSED, ++ MESSAGE_EVENT_RX_BULK_COMPLETE, ++ MESSAGE_EVENT_TX_COMPLETE, ++ MESSAGE_EVENT_MSG_DISCARDED ++} MESSAGE_EVENT_TYPE_T; ++ ++typedef enum vchi_msg_flags ++{ ++ VCHI_MSG_FLAGS_NONE = 0x0, ++ VCHI_MSG_FLAGS_TERMINATE_DMA = 0x1 ++} VCHI_MSG_FLAGS_T; ++ ++typedef enum message_tx_channel ++{ ++ MESSAGE_TX_CHANNEL_MESSAGE = 0, ++ MESSAGE_TX_CHANNEL_BULK = 1 // drivers may provide multiple bulk channels, from 1 upwards ++} MESSAGE_TX_CHANNEL_T; ++ ++// Macros used for cycling through bulk channels ++#define MESSAGE_TX_CHANNEL_BULK_PREV(c) (MESSAGE_TX_CHANNEL_BULK+((c)-MESSAGE_TX_CHANNEL_BULK+VCHI_MAX_BULK_TX_CHANNELS_PER_CONNECTION-1)%VCHI_MAX_BULK_TX_CHANNELS_PER_CONNECTION) ++#define MESSAGE_TX_CHANNEL_BULK_NEXT(c) (MESSAGE_TX_CHANNEL_BULK+((c)-MESSAGE_TX_CHANNEL_BULK+1)%VCHI_MAX_BULK_TX_CHANNELS_PER_CONNECTION) ++ ++typedef enum message_rx_channel ++{ ++ MESSAGE_RX_CHANNEL_MESSAGE = 0, ++ MESSAGE_RX_CHANNEL_BULK = 1 // drivers may provide multiple bulk channels, from 1 upwards ++} MESSAGE_RX_CHANNEL_T; ++ ++// Message receive slot information ++typedef struct rx_msg_slot_info { ++ ++ struct rx_msg_slot_info *next; ++ //struct slot_info *prev; ++#if !defined VCHI_COARSE_LOCKING ++ struct semaphore sem; ++#endif ++ ++ uint8_t *addr; // base address of slot ++ uint32_t len; // length of slot in bytes ++ ++ uint32_t write_ptr; // hardware causes this to advance ++ uint32_t read_ptr; // this module does the reading ++ int active; // is this slot in the hardware dma fifo? ++ uint32_t msgs_parsed; // count how many messages are in this slot ++ uint32_t msgs_released; // how many messages have been released ++ void *state; // connection state information ++ uint8_t ref_count[VCHI_MAX_SERVICES_PER_CONNECTION]; // reference count for slots held by services ++} RX_MSG_SLOTINFO_T; ++ ++// The message driver no longer needs to know about the fields of RX_BULK_SLOTINFO_T - sort this out. ++// In particular, it mustn't use addr and len - they're the client buffer, but the message ++// driver will be tasked with sending the aligned core section. ++typedef struct rx_bulk_slotinfo_t { ++ struct rx_bulk_slotinfo_t *next; ++ ++ struct semaphore *blocking; ++ ++ // needed by DMA ++ void *addr; ++ uint32_t len; ++ ++ // needed for the callback ++ void *service; ++ void *handle; ++ VCHI_FLAGS_T flags; ++} RX_BULK_SLOTINFO_T; ++ ++ ++/* ---------------------------------------------------------------------- ++ * each connection driver will have a pool of the following struct. ++ * ++ * the pool will be managed by vchi_qman_* ++ * this means there will be multiple queues (single linked lists) ++ * a given struct message_info will be on exactly one of these queues ++ * at any one time ++ * -------------------------------------------------------------------- */ ++typedef struct rx_message_info { ++ ++ struct message_info *next; ++ //struct message_info *prev; ++ ++ uint8_t *addr; ++ uint32_t len; ++ RX_MSG_SLOTINFO_T *slot; // points to whichever slot contains this message ++ uint32_t tx_timestamp; ++ uint32_t rx_timestamp; ++ ++} RX_MESSAGE_INFO_T; ++ ++typedef struct { ++ MESSAGE_EVENT_TYPE_T type; ++ ++ struct { ++ // for messages ++ void *addr; // address of message ++ uint16_t slot_delta; // whether this message indicated slot delta ++ uint32_t len; // length of message ++ RX_MSG_SLOTINFO_T *slot; // slot this message is in ++ int32_t service; // service id this message is destined for ++ uint32_t tx_timestamp; // timestamp from the header ++ uint32_t rx_timestamp; // timestamp when we parsed it ++ } message; ++ ++ // FIXME: cleanup slot reporting... ++ RX_MSG_SLOTINFO_T *rx_msg; ++ RX_BULK_SLOTINFO_T *rx_bulk; ++ void *tx_handle; ++ MESSAGE_TX_CHANNEL_T tx_channel; ++ ++} MESSAGE_EVENT_T; ++ ++ ++// callbacks ++typedef void VCHI_MESSAGE_DRIVER_EVENT_CALLBACK_T( void *state ); ++ ++typedef struct { ++ VCHI_MESSAGE_DRIVER_EVENT_CALLBACK_T *event_callback; ++} VCHI_MESSAGE_DRIVER_OPEN_T; ++ ++ ++// handle to this instance of message driver (as returned by ->open) ++typedef struct opaque_mhandle_t *VCHI_MDRIVER_HANDLE_T; ++ ++struct opaque_vchi_message_driver_t { ++ VCHI_MDRIVER_HANDLE_T *(*open)( VCHI_MESSAGE_DRIVER_OPEN_T *params, void *state ); ++ int32_t (*suspending)( VCHI_MDRIVER_HANDLE_T *handle ); ++ int32_t (*resumed)( VCHI_MDRIVER_HANDLE_T *handle ); ++ int32_t (*power_control)( VCHI_MDRIVER_HANDLE_T *handle, MESSAGE_TX_CHANNEL_T, int32_t enable ); ++ int32_t (*add_msg_rx_slot)( VCHI_MDRIVER_HANDLE_T *handle, RX_MSG_SLOTINFO_T *slot ); // rx message ++ int32_t (*add_bulk_rx)( VCHI_MDRIVER_HANDLE_T *handle, void *data, uint32_t len, RX_BULK_SLOTINFO_T *slot ); // rx data (bulk) ++ int32_t (*send)( VCHI_MDRIVER_HANDLE_T *handle, MESSAGE_TX_CHANNEL_T channel, const void *data, uint32_t len, VCHI_MSG_FLAGS_T flags, void *send_handle ); // tx (message & bulk) ++ void (*next_event)( VCHI_MDRIVER_HANDLE_T *handle, MESSAGE_EVENT_T *event ); // get the next event from message_driver ++ int32_t (*enable)( VCHI_MDRIVER_HANDLE_T *handle ); ++ int32_t (*form_message)( VCHI_MDRIVER_HANDLE_T *handle, int32_t service_id, VCHI_MSG_VECTOR_T *vector, uint32_t count, void ++ *address, uint32_t length_avail, uint32_t max_total_length, int32_t pad_to_fill, int32_t allow_partial ); ++ ++ int32_t (*update_message)( VCHI_MDRIVER_HANDLE_T *handle, void *dest, int16_t *slot_count ); ++ int32_t (*buffer_aligned)( VCHI_MDRIVER_HANDLE_T *handle, int tx, int uncached, const void *address, const uint32_t length ); ++ void * (*allocate_buffer)( VCHI_MDRIVER_HANDLE_T *handle, uint32_t *length ); ++ void (*free_buffer)( VCHI_MDRIVER_HANDLE_T *handle, void *address ); ++ int (*rx_slot_size)( VCHI_MDRIVER_HANDLE_T *handle, int msg_size ); ++ int (*tx_slot_size)( VCHI_MDRIVER_HANDLE_T *handle, int msg_size ); ++ ++ int32_t (*tx_supports_terminate)( const VCHI_MDRIVER_HANDLE_T *handle, MESSAGE_TX_CHANNEL_T channel ); ++ uint32_t (*tx_bulk_chunk_size)( const VCHI_MDRIVER_HANDLE_T *handle, MESSAGE_TX_CHANNEL_T channel ); ++ int (*tx_alignment)( const VCHI_MDRIVER_HANDLE_T *handle, MESSAGE_TX_CHANNEL_T channel ); ++ int (*rx_alignment)( const VCHI_MDRIVER_HANDLE_T *handle, MESSAGE_RX_CHANNEL_T channel ); ++ void (*form_bulk_aux)( VCHI_MDRIVER_HANDLE_T *handle, MESSAGE_TX_CHANNEL_T channel, const void *data, uint32_t len, uint32_t chunk_size, const void **aux_data, int32_t *aux_len ); ++ void (*debug)( VCHI_MDRIVER_HANDLE_T *handle ); ++}; ++ ++ ++#endif // _VCHI_MESSAGE_H_ ++ ++/****************************** End of file ***********************************/ +diff --git a/drivers/misc/vc04_services/interface/vchi/vchi.h b/drivers/misc/vc04_services/interface/vchi/vchi.h +new file mode 100644 +index 0000000..1b17e98 +--- /dev/null ++++ b/drivers/misc/vc04_services/interface/vchi/vchi.h +@@ -0,0 +1,378 @@ ++/** ++ * Copyright (c) 2010-2012 Broadcom. 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, ++ * without modification. ++ * 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. ++ * 3. The names of the above-listed copyright holders may not be used ++ * to endorse or promote products derived from this software without ++ * specific prior written permission. ++ * ++ * ALTERNATIVELY, this software may be distributed under the terms of the ++ * GNU General Public License ("GPL") version 2, as published by the Free ++ * Software Foundation. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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. ++ */ ++ ++#ifndef VCHI_H_ ++#define VCHI_H_ ++ ++#include "interface/vchi/vchi_cfg.h" ++#include "interface/vchi/vchi_common.h" ++#include "interface/vchi/connections/connection.h" ++#include "vchi_mh.h" ++ ++ ++/****************************************************************************** ++ Global defs ++ *****************************************************************************/ ++ ++#define VCHI_BULK_ROUND_UP(x) ((((unsigned long)(x))+VCHI_BULK_ALIGN-1) & ~(VCHI_BULK_ALIGN-1)) ++#define VCHI_BULK_ROUND_DOWN(x) (((unsigned long)(x)) & ~(VCHI_BULK_ALIGN-1)) ++#define VCHI_BULK_ALIGN_NBYTES(x) (VCHI_BULK_ALIGNED(x) ? 0 : (VCHI_BULK_ALIGN - ((unsigned long)(x) & (VCHI_BULK_ALIGN-1)))) ++ ++#ifdef USE_VCHIQ_ARM ++#define VCHI_BULK_ALIGNED(x) 1 ++#else ++#define VCHI_BULK_ALIGNED(x) (((unsigned long)(x) & (VCHI_BULK_ALIGN-1)) == 0) ++#endif ++ ++struct vchi_version { ++ uint32_t version; ++ uint32_t version_min; ++}; ++#define VCHI_VERSION(v_) { v_, v_ } ++#define VCHI_VERSION_EX(v_, m_) { v_, m_ } ++ ++typedef enum ++{ ++ VCHI_VEC_POINTER, ++ VCHI_VEC_HANDLE, ++ VCHI_VEC_LIST ++} VCHI_MSG_VECTOR_TYPE_T; ++ ++typedef struct vchi_msg_vector_ex { ++ ++ VCHI_MSG_VECTOR_TYPE_T type; ++ union ++ { ++ // a memory handle ++ struct ++ { ++ VCHI_MEM_HANDLE_T handle; ++ uint32_t offset; ++ int32_t vec_len; ++ } handle; ++ ++ // an ordinary data pointer ++ struct ++ { ++ const void *vec_base; ++ int32_t vec_len; ++ } ptr; ++ ++ // a nested vector list ++ struct ++ { ++ struct vchi_msg_vector_ex *vec; ++ uint32_t vec_len; ++ } list; ++ } u; ++} VCHI_MSG_VECTOR_EX_T; ++ ++ ++// Construct an entry in a msg vector for a pointer (p) of length (l) ++#define VCHI_VEC_POINTER(p,l) VCHI_VEC_POINTER, { { (VCHI_MEM_HANDLE_T)(p), (l) } } ++ ++// Construct an entry in a msg vector for a message handle (h), starting at offset (o) of length (l) ++#define VCHI_VEC_HANDLE(h,o,l) VCHI_VEC_HANDLE, { { (h), (o), (l) } } ++ ++// Macros to manipulate 'FOURCC' values ++#define MAKE_FOURCC(x) ((int32_t)( (x[0] << 24) | (x[1] << 16) | (x[2] << 8) | x[3] )) ++#define FOURCC_TO_CHAR(x) (x >> 24) & 0xFF,(x >> 16) & 0xFF,(x >> 8) & 0xFF, x & 0xFF ++ ++ ++// Opaque service information ++struct opaque_vchi_service_t; ++ ++// Descriptor for a held message. Allocated by client, initialised by vchi_msg_hold, ++// vchi_msg_iter_hold or vchi_msg_iter_hold_next. Fields are for internal VCHI use only. ++typedef struct ++{ ++ struct opaque_vchi_service_t *service; ++ void *message; ++} VCHI_HELD_MSG_T; ++ ++ ++ ++// structure used to provide the information needed to open a server or a client ++typedef struct { ++ struct vchi_version version; ++ int32_t service_id; ++ VCHI_CONNECTION_T *connection; ++ uint32_t rx_fifo_size; ++ uint32_t tx_fifo_size; ++ VCHI_CALLBACK_T callback; ++ void *callback_param; ++ /* client intends to receive bulk transfers of ++ odd lengths or into unaligned buffers */ ++ int32_t want_unaligned_bulk_rx; ++ /* client intends to transmit bulk transfers of ++ odd lengths or out of unaligned buffers */ ++ int32_t want_unaligned_bulk_tx; ++ /* client wants to check CRCs on (bulk) xfers. ++ Only needs to be set at 1 end - will do both directions. */ ++ int32_t want_crc; ++} SERVICE_CREATION_T; ++ ++// Opaque handle for a VCHI instance ++typedef struct opaque_vchi_instance_handle_t *VCHI_INSTANCE_T; ++ ++// Opaque handle for a server or client ++typedef struct opaque_vchi_service_handle_t *VCHI_SERVICE_HANDLE_T; ++ ++// Service registration & startup ++typedef void (*VCHI_SERVICE_INIT)(VCHI_INSTANCE_T initialise_instance, VCHI_CONNECTION_T **connections, uint32_t num_connections); ++ ++typedef struct service_info_tag { ++ const char * const vll_filename; /* VLL to load to start this service. This is an empty string if VLL is "static" */ ++ VCHI_SERVICE_INIT init; /* Service initialisation function */ ++ void *vll_handle; /* VLL handle; NULL when unloaded or a "static VLL" in build */ ++} SERVICE_INFO_T; ++ ++/****************************************************************************** ++ Global funcs - implementation is specific to which side you are on (local / remote) ++ *****************************************************************************/ ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++extern /*@observer@*/ VCHI_CONNECTION_T * vchi_create_connection( const VCHI_CONNECTION_API_T * function_table, ++ const VCHI_MESSAGE_DRIVER_T * low_level); ++ ++ ++// Routine used to initialise the vchi on both local + remote connections ++extern int32_t vchi_initialise( VCHI_INSTANCE_T *instance_handle ); ++ ++extern int32_t vchi_exit( void ); ++ ++extern int32_t vchi_connect( VCHI_CONNECTION_T **connections, ++ const uint32_t num_connections, ++ VCHI_INSTANCE_T instance_handle ); ++ ++//When this is called, ensure that all services have no data pending. ++//Bulk transfers can remain 'queued' ++extern int32_t vchi_disconnect( VCHI_INSTANCE_T instance_handle ); ++ ++// Global control over bulk CRC checking ++extern int32_t vchi_crc_control( VCHI_CONNECTION_T *connection, ++ VCHI_CRC_CONTROL_T control ); ++ ++// helper functions ++extern void * vchi_allocate_buffer(VCHI_SERVICE_HANDLE_T handle, uint32_t *length); ++extern void vchi_free_buffer(VCHI_SERVICE_HANDLE_T handle, void *address); ++extern uint32_t vchi_current_time(VCHI_INSTANCE_T instance_handle); ++ ++ ++/****************************************************************************** ++ Global service API ++ *****************************************************************************/ ++// Routine to create a named service ++extern int32_t vchi_service_create( VCHI_INSTANCE_T instance_handle, ++ SERVICE_CREATION_T *setup, ++ VCHI_SERVICE_HANDLE_T *handle ); ++ ++// Routine to destory a service ++extern int32_t vchi_service_destroy( const VCHI_SERVICE_HANDLE_T handle ); ++ ++// Routine to open a named service ++extern int32_t vchi_service_open( VCHI_INSTANCE_T instance_handle, ++ SERVICE_CREATION_T *setup, ++ VCHI_SERVICE_HANDLE_T *handle); ++ ++extern int32_t vchi_get_peer_version( const VCHI_SERVICE_HANDLE_T handle, ++ short *peer_version ); ++ ++// Routine to close a named service ++extern int32_t vchi_service_close( const VCHI_SERVICE_HANDLE_T handle ); ++ ++// Routine to increment ref count on a named service ++extern int32_t vchi_service_use( const VCHI_SERVICE_HANDLE_T handle ); ++ ++// Routine to decrement ref count on a named service ++extern int32_t vchi_service_release( const VCHI_SERVICE_HANDLE_T handle ); ++ ++// Routine to set a control option for a named service ++extern int32_t vchi_service_set_option( const VCHI_SERVICE_HANDLE_T handle, ++ VCHI_SERVICE_OPTION_T option, ++ int value); ++ ++// Routine to send a message across a service ++extern int32_t vchi_msg_queue( VCHI_SERVICE_HANDLE_T handle, ++ const void *data, ++ uint32_t data_size, ++ VCHI_FLAGS_T flags, ++ void *msg_handle ); ++ ++// scatter-gather (vector) and send message ++int32_t vchi_msg_queuev_ex( VCHI_SERVICE_HANDLE_T handle, ++ VCHI_MSG_VECTOR_EX_T *vector, ++ uint32_t count, ++ VCHI_FLAGS_T flags, ++ void *msg_handle ); ++ ++// legacy scatter-gather (vector) and send message, only handles pointers ++int32_t vchi_msg_queuev( VCHI_SERVICE_HANDLE_T handle, ++ VCHI_MSG_VECTOR_T *vector, ++ uint32_t count, ++ VCHI_FLAGS_T flags, ++ void *msg_handle ); ++ ++// Routine to receive a msg from a service ++// Dequeue is equivalent to hold, copy into client buffer, release ++extern int32_t vchi_msg_dequeue( VCHI_SERVICE_HANDLE_T handle, ++ void *data, ++ uint32_t max_data_size_to_read, ++ uint32_t *actual_msg_size, ++ VCHI_FLAGS_T flags ); ++ ++// Routine to look at a message in place. ++// The message is not dequeued, so a subsequent call to peek or dequeue ++// will return the same message. ++extern int32_t vchi_msg_peek( VCHI_SERVICE_HANDLE_T handle, ++ void **data, ++ uint32_t *msg_size, ++ VCHI_FLAGS_T flags ); ++ ++// Routine to remove a message after it has been read in place with peek ++// The first message on the queue is dequeued. ++extern int32_t vchi_msg_remove( VCHI_SERVICE_HANDLE_T handle ); ++ ++// Routine to look at a message in place. ++// The message is dequeued, so the caller is left holding it; the descriptor is ++// filled in and must be released when the user has finished with the message. ++extern int32_t vchi_msg_hold( VCHI_SERVICE_HANDLE_T handle, ++ void **data, // } may be NULL, as info can be ++ uint32_t *msg_size, // } obtained from HELD_MSG_T ++ VCHI_FLAGS_T flags, ++ VCHI_HELD_MSG_T *message_descriptor ); ++ ++// Initialise an iterator to look through messages in place ++extern int32_t vchi_msg_look_ahead( VCHI_SERVICE_HANDLE_T handle, ++ VCHI_MSG_ITER_T *iter, ++ VCHI_FLAGS_T flags ); ++ ++/****************************************************************************** ++ Global service support API - operations on held messages and message iterators ++ *****************************************************************************/ ++ ++// Routine to get the address of a held message ++extern void *vchi_held_msg_ptr( const VCHI_HELD_MSG_T *message ); ++ ++// Routine to get the size of a held message ++extern int32_t vchi_held_msg_size( const VCHI_HELD_MSG_T *message ); ++ ++// Routine to get the transmit timestamp as written into the header by the peer ++extern uint32_t vchi_held_msg_tx_timestamp( const VCHI_HELD_MSG_T *message ); ++ ++// Routine to get the reception timestamp, written as we parsed the header ++extern uint32_t vchi_held_msg_rx_timestamp( const VCHI_HELD_MSG_T *message ); ++ ++// Routine to release a held message after it has been processed ++extern int32_t vchi_held_msg_release( VCHI_HELD_MSG_T *message ); ++ ++// Indicates whether the iterator has a next message. ++extern int32_t vchi_msg_iter_has_next( const VCHI_MSG_ITER_T *iter ); ++ ++// Return the pointer and length for the next message and advance the iterator. ++extern int32_t vchi_msg_iter_next( VCHI_MSG_ITER_T *iter, ++ void **data, ++ uint32_t *msg_size ); ++ ++// Remove the last message returned by vchi_msg_iter_next. ++// Can only be called once after each call to vchi_msg_iter_next. ++extern int32_t vchi_msg_iter_remove( VCHI_MSG_ITER_T *iter ); ++ ++// Hold the last message returned by vchi_msg_iter_next. ++// Can only be called once after each call to vchi_msg_iter_next. ++extern int32_t vchi_msg_iter_hold( VCHI_MSG_ITER_T *iter, ++ VCHI_HELD_MSG_T *message ); ++ ++// Return information for the next message, and hold it, advancing the iterator. ++extern int32_t vchi_msg_iter_hold_next( VCHI_MSG_ITER_T *iter, ++ void **data, // } may be NULL ++ uint32_t *msg_size, // } ++ VCHI_HELD_MSG_T *message ); ++ ++ ++/****************************************************************************** ++ Global bulk API ++ *****************************************************************************/ ++ ++// Routine to prepare interface for a transfer from the other side ++extern int32_t vchi_bulk_queue_receive( VCHI_SERVICE_HANDLE_T handle, ++ void *data_dst, ++ uint32_t data_size, ++ VCHI_FLAGS_T flags, ++ void *transfer_handle ); ++ ++ ++// Prepare interface for a transfer from the other side into relocatable memory. ++int32_t vchi_bulk_queue_receive_reloc( const VCHI_SERVICE_HANDLE_T handle, ++ VCHI_MEM_HANDLE_T h_dst, ++ uint32_t offset, ++ uint32_t data_size, ++ const VCHI_FLAGS_T flags, ++ void * const bulk_handle ); ++ ++// Routine to queue up data ready for transfer to the other (once they have signalled they are ready) ++extern int32_t vchi_bulk_queue_transmit( VCHI_SERVICE_HANDLE_T handle, ++ const void *data_src, ++ uint32_t data_size, ++ VCHI_FLAGS_T flags, ++ void *transfer_handle ); ++ ++ ++/****************************************************************************** ++ Configuration plumbing ++ *****************************************************************************/ ++ ++// function prototypes for the different mid layers (the state info gives the different physical connections) ++extern const VCHI_CONNECTION_API_T *single_get_func_table( void ); ++//extern const VCHI_CONNECTION_API_T *local_server_get_func_table( void ); ++//extern const VCHI_CONNECTION_API_T *local_client_get_func_table( void ); ++ ++// declare all message drivers here ++const VCHI_MESSAGE_DRIVER_T *vchi_mphi_message_driver_func_table( void ); ++ ++#ifdef __cplusplus ++} ++#endif ++ ++extern int32_t vchi_bulk_queue_transmit_reloc( VCHI_SERVICE_HANDLE_T handle, ++ VCHI_MEM_HANDLE_T h_src, ++ uint32_t offset, ++ uint32_t data_size, ++ VCHI_FLAGS_T flags, ++ void *transfer_handle ); ++#endif /* VCHI_H_ */ ++ ++/****************************** End of file **********************************/ +diff --git a/drivers/misc/vc04_services/interface/vchi/vchi_cfg.h b/drivers/misc/vc04_services/interface/vchi/vchi_cfg.h +new file mode 100644 +index 0000000..26bc2d3 +--- /dev/null ++++ b/drivers/misc/vc04_services/interface/vchi/vchi_cfg.h +@@ -0,0 +1,224 @@ ++/** ++ * Copyright (c) 2010-2012 Broadcom. 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, ++ * without modification. ++ * 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. ++ * 3. The names of the above-listed copyright holders may not be used ++ * to endorse or promote products derived from this software without ++ * specific prior written permission. ++ * ++ * ALTERNATIVELY, this software may be distributed under the terms of the ++ * GNU General Public License ("GPL") version 2, as published by the Free ++ * Software Foundation. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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. ++ */ ++ ++#ifndef VCHI_CFG_H_ ++#define VCHI_CFG_H_ ++ ++/**************************************************************************************** ++ * Defines in this first section are part of the VCHI API and may be examined by VCHI ++ * services. ++ ***************************************************************************************/ ++ ++/* Required alignment of base addresses for bulk transfer, if unaligned transfers are not enabled */ ++/* Really determined by the message driver, and should be available from a run-time call. */ ++#ifndef VCHI_BULK_ALIGN ++# if __VCCOREVER__ >= 0x04000000 ++# define VCHI_BULK_ALIGN 32 // Allows for the need to do cache cleans ++# else ++# define VCHI_BULK_ALIGN 16 ++# endif ++#endif ++ ++/* Required length multiple for bulk transfers, if unaligned transfers are not enabled */ ++/* May be less than or greater than VCHI_BULK_ALIGN */ ++/* Really determined by the message driver, and should be available from a run-time call. */ ++#ifndef VCHI_BULK_GRANULARITY ++# if __VCCOREVER__ >= 0x04000000 ++# define VCHI_BULK_GRANULARITY 32 // Allows for the need to do cache cleans ++# else ++# define VCHI_BULK_GRANULARITY 16 ++# endif ++#endif ++ ++/* The largest possible message to be queued with vchi_msg_queue. */ ++#ifndef VCHI_MAX_MSG_SIZE ++# if defined VCHI_LOCAL_HOST_PORT ++# define VCHI_MAX_MSG_SIZE 16384 // makes file transfers fast, but should they be using bulk? ++# else ++# define VCHI_MAX_MSG_SIZE 4096 // NOTE: THIS MUST BE LARGER THAN OR EQUAL TO THE SIZE OF THE KHRONOS MERGE BUFFER!! ++# endif ++#endif ++ ++/****************************************************************************************** ++ * Defines below are system configuration options, and should not be used by VCHI services. ++ *****************************************************************************************/ ++ ++/* How many connections can we support? A localhost implementation uses 2 connections, ++ * 1 for host-app, 1 for VMCS, and these are hooked together by a loopback MPHI VCFW ++ * driver. */ ++#ifndef VCHI_MAX_NUM_CONNECTIONS ++# define VCHI_MAX_NUM_CONNECTIONS 3 ++#endif ++ ++/* How many services can we open per connection? Extending this doesn't cost processing time, just a small ++ * amount of static memory. */ ++#ifndef VCHI_MAX_SERVICES_PER_CONNECTION ++# define VCHI_MAX_SERVICES_PER_CONNECTION 36 ++#endif ++ ++/* Adjust if using a message driver that supports more logical TX channels */ ++#ifndef VCHI_MAX_BULK_TX_CHANNELS_PER_CONNECTION ++# define VCHI_MAX_BULK_TX_CHANNELS_PER_CONNECTION 9 // 1 MPHI + 8 CCP2 logical channels ++#endif ++ ++/* Adjust if using a message driver that supports more logical RX channels */ ++#ifndef VCHI_MAX_BULK_RX_CHANNELS_PER_CONNECTION ++# define VCHI_MAX_BULK_RX_CHANNELS_PER_CONNECTION 1 // 1 MPHI ++#endif ++ ++/* How many receive slots do we use. This times VCHI_MAX_MSG_SIZE gives the effective ++ * receive queue space, less message headers. */ ++#ifndef VCHI_NUM_READ_SLOTS ++# if defined(VCHI_LOCAL_HOST_PORT) ++# define VCHI_NUM_READ_SLOTS 4 ++# else ++# define VCHI_NUM_READ_SLOTS 48 ++# endif ++#endif ++ ++/* Do we utilise overrun facility for receive message slots? Can aid peer transmit ++ * performance. Only define on VideoCore end, talking to host. ++ */ ++//#define VCHI_MSG_RX_OVERRUN ++ ++/* How many transmit slots do we use. Generally don't need many, as the hardware driver ++ * underneath VCHI will usually have its own buffering. */ ++#ifndef VCHI_NUM_WRITE_SLOTS ++# define VCHI_NUM_WRITE_SLOTS 4 ++#endif ++ ++/* If a service has held or queued received messages in VCHI_XOFF_THRESHOLD or more slots, ++ * then it's taking up too much buffer space, and the peer service will be told to stop ++ * transmitting with an XOFF message. For this to be effective, the VCHI_NUM_READ_SLOTS ++ * needs to be considerably bigger than VCHI_NUM_WRITE_SLOTS, or the transmit latency ++ * is too high. */ ++#ifndef VCHI_XOFF_THRESHOLD ++# define VCHI_XOFF_THRESHOLD (VCHI_NUM_READ_SLOTS / 2) ++#endif ++ ++/* After we've sent an XOFF, the peer will be told to resume transmission once the local ++ * service has dequeued/released enough messages that it's now occupying ++ * VCHI_XON_THRESHOLD slots or fewer. */ ++#ifndef VCHI_XON_THRESHOLD ++# define VCHI_XON_THRESHOLD (VCHI_NUM_READ_SLOTS / 4) ++#endif ++ ++/* A size below which a bulk transfer omits the handshake completely and always goes ++ * via the message channel, if bulk auxiliary is being sent on that service. (The user ++ * can guarantee this by enabling unaligned transmits). ++ * Not API. */ ++#ifndef VCHI_MIN_BULK_SIZE ++# define VCHI_MIN_BULK_SIZE ( VCHI_MAX_MSG_SIZE / 2 < 4096 ? VCHI_MAX_MSG_SIZE / 2 : 4096 ) ++#endif ++ ++/* Maximum size of bulk transmission chunks, for each interface type. A trade-off between ++ * speed and latency; the smaller the chunk size the better change of messages and other ++ * bulk transmissions getting in when big bulk transfers are happening. Set to 0 to not ++ * break transmissions into chunks. ++ */ ++#ifndef VCHI_MAX_BULK_CHUNK_SIZE_MPHI ++# define VCHI_MAX_BULK_CHUNK_SIZE_MPHI (16 * 1024) ++#endif ++ ++/* NB Chunked CCP2 transmissions violate the letter of the CCP2 spec by using "JPEG8" mode ++ * with multiple-line frames. Only use if the receiver can cope. */ ++#ifndef VCHI_MAX_BULK_CHUNK_SIZE_CCP2 ++# define VCHI_MAX_BULK_CHUNK_SIZE_CCP2 0 ++#endif ++ ++/* How many TX messages can we have pending in our transmit slots. Once exhausted, ++ * vchi_msg_queue will be blocked. */ ++#ifndef VCHI_TX_MSG_QUEUE_SIZE ++# define VCHI_TX_MSG_QUEUE_SIZE 256 ++#endif ++ ++/* How many RX messages can we have parsed in the receive slots. Once exhausted, parsing ++ * will be suspended until older messages are dequeued/released. */ ++#ifndef VCHI_RX_MSG_QUEUE_SIZE ++# define VCHI_RX_MSG_QUEUE_SIZE 256 ++#endif ++ ++/* Really should be able to cope if we run out of received message descriptors, by ++ * suspending parsing as the comment above says, but we don't. This sweeps the issue ++ * under the carpet. */ ++#if VCHI_RX_MSG_QUEUE_SIZE < (VCHI_MAX_MSG_SIZE/16 + 1) * VCHI_NUM_READ_SLOTS ++# undef VCHI_RX_MSG_QUEUE_SIZE ++# define VCHI_RX_MSG_QUEUE_SIZE (VCHI_MAX_MSG_SIZE/16 + 1) * VCHI_NUM_READ_SLOTS ++#endif ++ ++/* How many bulk transmits can we have pending. Once exhausted, vchi_bulk_queue_transmit ++ * will be blocked. */ ++#ifndef VCHI_TX_BULK_QUEUE_SIZE ++# define VCHI_TX_BULK_QUEUE_SIZE 64 ++#endif ++ ++/* How many bulk receives can we have pending. Once exhausted, vchi_bulk_queue_receive ++ * will be blocked. */ ++#ifndef VCHI_RX_BULK_QUEUE_SIZE ++# define VCHI_RX_BULK_QUEUE_SIZE 64 ++#endif ++ ++/* A limit on how many outstanding bulk requests we expect the peer to give us. If ++ * the peer asks for more than this, VCHI will fail and assert. The number is determined ++ * by the peer's hardware - it's the number of outstanding requests that can be queued ++ * on all bulk channels. VC3's MPHI peripheral allows 16. */ ++#ifndef VCHI_MAX_PEER_BULK_REQUESTS ++# define VCHI_MAX_PEER_BULK_REQUESTS 32 ++#endif ++ ++/* Define VCHI_CCP2TX_MANUAL_POWER if the host tells us when to turn the CCP2 ++ * transmitter on and off. ++ */ ++/*#define VCHI_CCP2TX_MANUAL_POWER*/ ++ ++#ifndef VCHI_CCP2TX_MANUAL_POWER ++ ++/* Timeout (in milliseconds) for putting the CCP2TX interface into IDLE state. Set ++ * negative for no IDLE. ++ */ ++# ifndef VCHI_CCP2TX_IDLE_TIMEOUT ++# define VCHI_CCP2TX_IDLE_TIMEOUT 5 ++# endif ++ ++/* Timeout (in milliseconds) for putting the CCP2TX interface into OFF state. Set ++ * negative for no OFF. ++ */ ++# ifndef VCHI_CCP2TX_OFF_TIMEOUT ++# define VCHI_CCP2TX_OFF_TIMEOUT 1000 ++# endif ++ ++#endif /* VCHI_CCP2TX_MANUAL_POWER */ ++ ++#endif /* VCHI_CFG_H_ */ ++ ++/****************************** End of file **********************************/ +diff --git a/drivers/misc/vc04_services/interface/vchi/vchi_cfg_internal.h b/drivers/misc/vc04_services/interface/vchi/vchi_cfg_internal.h +new file mode 100644 +index 0000000..35dcba4 +--- /dev/null ++++ b/drivers/misc/vc04_services/interface/vchi/vchi_cfg_internal.h +@@ -0,0 +1,71 @@ ++/** ++ * Copyright (c) 2010-2012 Broadcom. 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, ++ * without modification. ++ * 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. ++ * 3. The names of the above-listed copyright holders may not be used ++ * to endorse or promote products derived from this software without ++ * specific prior written permission. ++ * ++ * ALTERNATIVELY, this software may be distributed under the terms of the ++ * GNU General Public License ("GPL") version 2, as published by the Free ++ * Software Foundation. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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. ++ */ ++ ++#ifndef VCHI_CFG_INTERNAL_H_ ++#define VCHI_CFG_INTERNAL_H_ ++ ++/**************************************************************************************** ++ * Control optimisation attempts. ++ ***************************************************************************************/ ++ ++// Don't use lots of short-term locks - use great long ones, reducing the overall locks-per-second ++#define VCHI_COARSE_LOCKING ++ ++// Avoid lock then unlock on exit from blocking queue operations (msg tx, bulk rx/tx) ++// (only relevant if VCHI_COARSE_LOCKING) ++#define VCHI_ELIDE_BLOCK_EXIT_LOCK ++ ++// Avoid lock on non-blocking peek ++// (only relevant if VCHI_COARSE_LOCKING) ++#define VCHI_AVOID_PEEK_LOCK ++ ++// Use one slot-handler thread per connection, rather than 1 thread dealing with all connections in rotation. ++#define VCHI_MULTIPLE_HANDLER_THREADS ++ ++// Put free descriptors onto the head of the free queue, rather than the tail, so that we don't thrash ++// our way through the pool of descriptors. ++#define VCHI_PUSH_FREE_DESCRIPTORS_ONTO_HEAD ++ ++// Don't issue a MSG_AVAILABLE callback for every single message. Possibly only safe if VCHI_COARSE_LOCKING. ++#define VCHI_FEWER_MSG_AVAILABLE_CALLBACKS ++ ++// Don't use message descriptors for TX messages that don't need them ++#define VCHI_MINIMISE_TX_MSG_DESCRIPTORS ++ ++// Nano-locks for multiqueue ++//#define VCHI_MQUEUE_NANOLOCKS ++ ++// Lock-free(er) dequeuing ++//#define VCHI_RX_NANOLOCKS ++ ++#endif /*VCHI_CFG_INTERNAL_H_*/ +diff --git a/drivers/misc/vc04_services/interface/vchi/vchi_common.h b/drivers/misc/vc04_services/interface/vchi/vchi_common.h +new file mode 100644 +index 0000000..d535a72 +--- /dev/null ++++ b/drivers/misc/vc04_services/interface/vchi/vchi_common.h +@@ -0,0 +1,175 @@ ++/** ++ * Copyright (c) 2010-2012 Broadcom. 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, ++ * without modification. ++ * 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. ++ * 3. The names of the above-listed copyright holders may not be used ++ * to endorse or promote products derived from this software without ++ * specific prior written permission. ++ * ++ * ALTERNATIVELY, this software may be distributed under the terms of the ++ * GNU General Public License ("GPL") version 2, as published by the Free ++ * Software Foundation. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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. ++ */ ++ ++#ifndef VCHI_COMMON_H_ ++#define VCHI_COMMON_H_ ++ ++ ++//flags used when sending messages (must be bitmapped) ++typedef enum ++{ ++ VCHI_FLAGS_NONE = 0x0, ++ VCHI_FLAGS_BLOCK_UNTIL_OP_COMPLETE = 0x1, // waits for message to be received, or sent (NB. not the same as being seen on other side) ++ VCHI_FLAGS_CALLBACK_WHEN_OP_COMPLETE = 0x2, // run a callback when message sent ++ VCHI_FLAGS_BLOCK_UNTIL_QUEUED = 0x4, // return once the transfer is in a queue ready to go ++ VCHI_FLAGS_ALLOW_PARTIAL = 0x8, ++ VCHI_FLAGS_BLOCK_UNTIL_DATA_READ = 0x10, ++ VCHI_FLAGS_CALLBACK_WHEN_DATA_READ = 0x20, ++ ++ VCHI_FLAGS_ALIGN_SLOT = 0x000080, // internal use only ++ VCHI_FLAGS_BULK_AUX_QUEUED = 0x010000, // internal use only ++ VCHI_FLAGS_BULK_AUX_COMPLETE = 0x020000, // internal use only ++ VCHI_FLAGS_BULK_DATA_QUEUED = 0x040000, // internal use only ++ VCHI_FLAGS_BULK_DATA_COMPLETE = 0x080000, // internal use only ++ VCHI_FLAGS_INTERNAL = 0xFF0000 ++} VCHI_FLAGS_T; ++ ++// constants for vchi_crc_control() ++typedef enum { ++ VCHI_CRC_NOTHING = -1, ++ VCHI_CRC_PER_SERVICE = 0, ++ VCHI_CRC_EVERYTHING = 1, ++} VCHI_CRC_CONTROL_T; ++ ++//callback reasons when an event occurs on a service ++typedef enum ++{ ++ VCHI_CALLBACK_REASON_MIN, ++ ++ //This indicates that there is data available ++ //handle is the msg id that was transmitted with the data ++ // When a message is received and there was no FULL message available previously, send callback ++ // Tasks get kicked by the callback, reset their event and try and read from the fifo until it fails ++ VCHI_CALLBACK_MSG_AVAILABLE, ++ VCHI_CALLBACK_MSG_SENT, ++ VCHI_CALLBACK_MSG_SPACE_AVAILABLE, // XXX not yet implemented ++ ++ // This indicates that a transfer from the other side has completed ++ VCHI_CALLBACK_BULK_RECEIVED, ++ //This indicates that data queued up to be sent has now gone ++ //handle is the msg id that was used when sending the data ++ VCHI_CALLBACK_BULK_SENT, ++ VCHI_CALLBACK_BULK_RX_SPACE_AVAILABLE, // XXX not yet implemented ++ VCHI_CALLBACK_BULK_TX_SPACE_AVAILABLE, // XXX not yet implemented ++ ++ VCHI_CALLBACK_SERVICE_CLOSED, ++ ++ // this side has sent XOFF to peer due to lack of data consumption by service ++ // (suggests the service may need to take some recovery action if it has ++ // been deliberately holding off consuming data) ++ VCHI_CALLBACK_SENT_XOFF, ++ VCHI_CALLBACK_SENT_XON, ++ ++ // indicates that a bulk transfer has finished reading the source buffer ++ VCHI_CALLBACK_BULK_DATA_READ, ++ ++ // power notification events (currently host side only) ++ VCHI_CALLBACK_PEER_OFF, ++ VCHI_CALLBACK_PEER_SUSPENDED, ++ VCHI_CALLBACK_PEER_ON, ++ VCHI_CALLBACK_PEER_RESUMED, ++ VCHI_CALLBACK_FORCED_POWER_OFF, ++ ++#ifdef USE_VCHIQ_ARM ++ // some extra notifications provided by vchiq_arm ++ VCHI_CALLBACK_SERVICE_OPENED, ++ VCHI_CALLBACK_BULK_RECEIVE_ABORTED, ++ VCHI_CALLBACK_BULK_TRANSMIT_ABORTED, ++#endif ++ ++ VCHI_CALLBACK_REASON_MAX ++} VCHI_CALLBACK_REASON_T; ++ ++// service control options ++typedef enum ++{ ++ VCHI_SERVICE_OPTION_MIN, ++ ++ VCHI_SERVICE_OPTION_TRACE, ++ VCHI_SERVICE_OPTION_SYNCHRONOUS, ++ ++ VCHI_SERVICE_OPTION_MAX ++} VCHI_SERVICE_OPTION_T; ++ ++ ++//Callback used by all services / bulk transfers ++typedef void (*VCHI_CALLBACK_T)( void *callback_param, //my service local param ++ VCHI_CALLBACK_REASON_T reason, ++ void *handle ); //for transmitting msg's only ++ ++ ++ ++/* ++ * Define vector struct for scatter-gather (vector) operations ++ * Vectors can be nested - if a vector element has negative length, then ++ * the data pointer is treated as pointing to another vector array, with ++ * '-vec_len' elements. Thus to append a header onto an existing vector, ++ * you can do this: ++ * ++ * void foo(const VCHI_MSG_VECTOR_T *v, int n) ++ * { ++ * VCHI_MSG_VECTOR_T nv[2]; ++ * nv[0].vec_base = my_header; ++ * nv[0].vec_len = sizeof my_header; ++ * nv[1].vec_base = v; ++ * nv[1].vec_len = -n; ++ * ... ++ * ++ */ ++typedef struct vchi_msg_vector { ++ const void *vec_base; ++ int32_t vec_len; ++} VCHI_MSG_VECTOR_T; ++ ++// Opaque type for a connection API ++typedef struct opaque_vchi_connection_api_t VCHI_CONNECTION_API_T; ++ ++// Opaque type for a message driver ++typedef struct opaque_vchi_message_driver_t VCHI_MESSAGE_DRIVER_T; ++ ++ ++// Iterator structure for reading ahead through received message queue. Allocated by client, ++// initialised by vchi_msg_look_ahead. Fields are for internal VCHI use only. ++// Iterates over messages in queue at the instant of the call to vchi_msg_lookahead - ++// will not proceed to messages received since. Behaviour is undefined if an iterator ++// is used again after messages for that service are removed/dequeued by any ++// means other than vchi_msg_iter_... calls on the iterator itself. ++typedef struct { ++ struct opaque_vchi_service_t *service; ++ void *last; ++ void *next; ++ void *remove; ++} VCHI_MSG_ITER_T; ++ ++ ++#endif // VCHI_COMMON_H_ +diff --git a/drivers/misc/vc04_services/interface/vchi/vchi_mh.h b/drivers/misc/vc04_services/interface/vchi/vchi_mh.h +new file mode 100644 +index 0000000..198bd07 +--- /dev/null ++++ b/drivers/misc/vc04_services/interface/vchi/vchi_mh.h +@@ -0,0 +1,42 @@ ++/** ++ * Copyright (c) 2010-2012 Broadcom. 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, ++ * without modification. ++ * 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. ++ * 3. The names of the above-listed copyright holders may not be used ++ * to endorse or promote products derived from this software without ++ * specific prior written permission. ++ * ++ * ALTERNATIVELY, this software may be distributed under the terms of the ++ * GNU General Public License ("GPL") version 2, as published by the Free ++ * Software Foundation. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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. ++ */ ++ ++#ifndef VCHI_MH_H_ ++#define VCHI_MH_H_ ++ ++#include <linux/types.h> ++ ++typedef int32_t VCHI_MEM_HANDLE_T; ++#define VCHI_MEM_HANDLE_INVALID 0 ++ ++#endif +diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq.h b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq.h +new file mode 100644 +index 0000000..ad398ba +--- /dev/null ++++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq.h +@@ -0,0 +1,40 @@ ++/** ++ * Copyright (c) 2010-2012 Broadcom. 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, ++ * without modification. ++ * 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. ++ * 3. The names of the above-listed copyright holders may not be used ++ * to endorse or promote products derived from this software without ++ * specific prior written permission. ++ * ++ * ALTERNATIVELY, this software may be distributed under the terms of the ++ * GNU General Public License ("GPL") version 2, as published by the Free ++ * Software Foundation. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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. ++ */ ++ ++#ifndef VCHIQ_VCHIQ_H ++#define VCHIQ_VCHIQ_H ++ ++#include "vchiq_if.h" ++#include "vchiq_util.h" ++ ++#endif +diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835.h b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835.h +new file mode 100644 +index 0000000..7ea5c64 +--- /dev/null ++++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835.h +@@ -0,0 +1,42 @@ ++/** ++ * Copyright (c) 2010-2012 Broadcom. 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, ++ * without modification. ++ * 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. ++ * 3. The names of the above-listed copyright holders may not be used ++ * to endorse or promote products derived from this software without ++ * specific prior written permission. ++ * ++ * ALTERNATIVELY, this software may be distributed under the terms of the ++ * GNU General Public License ("GPL") version 2, as published by the Free ++ * Software Foundation. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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. ++ */ ++ ++#ifndef VCHIQ_2835_H ++#define VCHIQ_2835_H ++ ++#include "vchiq_pagelist.h" ++ ++#define VCHIQ_PLATFORM_FRAGMENTS_OFFSET_IDX 0 ++#define VCHIQ_PLATFORM_FRAGMENTS_COUNT_IDX 1 ++ ++#endif /* VCHIQ_2835_H */ +diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c +new file mode 100644 +index 0000000..4cb5bff +--- /dev/null ++++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c +@@ -0,0 +1,586 @@ ++/** ++ * Copyright (c) 2010-2012 Broadcom. 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, ++ * without modification. ++ * 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. ++ * 3. The names of the above-listed copyright holders may not be used ++ * to endorse or promote products derived from this software without ++ * specific prior written permission. ++ * ++ * ALTERNATIVELY, this software may be distributed under the terms of the ++ * GNU General Public License ("GPL") version 2, as published by the Free ++ * Software Foundation. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER OR ++ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ++ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, ++ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR ++ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF ++ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING ++ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ */ ++ ++#include <linux/kernel.h> ++#include <linux/types.h> ++#include <linux/errno.h> ++#include <linux/interrupt.h> ++#include <linux/pagemap.h> ++#include <linux/dma-mapping.h> ++#include <linux/version.h> ++#include <linux/io.h> ++#include <linux/platform_device.h> ++#include <linux/uaccess.h> ++#include <linux/of.h> ++#include <asm/pgtable.h> ++#include <soc/bcm2835/raspberrypi-firmware.h> ++ ++#define dmac_map_area __glue(_CACHE,_dma_map_area) ++#define dmac_unmap_area __glue(_CACHE,_dma_unmap_area) ++ ++extern void dmac_map_area(const void *, size_t, int); ++extern void dmac_unmap_area(const void *, size_t, int); ++ ++#define TOTAL_SLOTS (VCHIQ_SLOT_ZERO_SLOTS + 2 * 32) ++ ++#define VCHIQ_ARM_ADDRESS(x) ((void *)((char *)x + g_virt_to_bus_offset)) ++ ++#include "vchiq_arm.h" ++#include "vchiq_2835.h" ++#include "vchiq_connected.h" ++#include "vchiq_killable.h" ++ ++#define MAX_FRAGMENTS (VCHIQ_NUM_CURRENT_BULKS * 2) ++ ++#define BELL0 0x00 ++#define BELL2 0x08 ++ ++typedef struct vchiq_2835_state_struct { ++ int inited; ++ VCHIQ_ARM_STATE_T arm_state; ++} VCHIQ_2835_ARM_STATE_T; ++ ++static void __iomem *g_regs; ++static unsigned int g_cache_line_size = sizeof(CACHE_LINE_SIZE); ++static unsigned int g_fragments_size; ++static char *g_fragments_base; ++static char *g_free_fragments; ++static struct semaphore g_free_fragments_sema; ++static unsigned long g_virt_to_bus_offset; ++ ++extern int vchiq_arm_log_level; ++ ++static DEFINE_SEMAPHORE(g_free_fragments_mutex); ++ ++static irqreturn_t ++vchiq_doorbell_irq(int irq, void *dev_id); ++ ++static int ++create_pagelist(char __user *buf, size_t count, unsigned short type, ++ struct task_struct *task, PAGELIST_T ** ppagelist); ++ ++static void ++free_pagelist(PAGELIST_T *pagelist, int actual); ++ ++int vchiq_platform_init(struct platform_device *pdev, VCHIQ_STATE_T *state) ++{ ++ struct device *dev = &pdev->dev; ++ struct rpi_firmware *fw = platform_get_drvdata(pdev); ++ VCHIQ_SLOT_ZERO_T *vchiq_slot_zero; ++ struct resource *res; ++ void *slot_mem; ++ dma_addr_t slot_phys; ++ u32 channelbase; ++ int slot_mem_size, frag_mem_size; ++ int err, irq, i; ++ ++ g_virt_to_bus_offset = virt_to_dma(dev, (void *)0); ++ ++ (void)of_property_read_u32(dev->of_node, "cache-line-size", ++ &g_cache_line_size); ++ g_fragments_size = 2 * g_cache_line_size; ++ ++ /* Allocate space for the channels in coherent memory */ ++ slot_mem_size = PAGE_ALIGN(TOTAL_SLOTS * VCHIQ_SLOT_SIZE); ++ frag_mem_size = PAGE_ALIGN(g_fragments_size * MAX_FRAGMENTS); ++ ++ slot_mem = dmam_alloc_coherent(dev, slot_mem_size + frag_mem_size, ++ &slot_phys, GFP_KERNEL); ++ if (!slot_mem) { ++ dev_err(dev, "could not allocate DMA memory\n"); ++ return -ENOMEM; ++ } ++ ++ WARN_ON(((int)slot_mem & (PAGE_SIZE - 1)) != 0); ++ ++ vchiq_slot_zero = vchiq_init_slots(slot_mem, slot_mem_size); ++ if (!vchiq_slot_zero) ++ return -EINVAL; ++ ++ vchiq_slot_zero->platform_data[VCHIQ_PLATFORM_FRAGMENTS_OFFSET_IDX] = ++ (int)slot_phys + slot_mem_size; ++ vchiq_slot_zero->platform_data[VCHIQ_PLATFORM_FRAGMENTS_COUNT_IDX] = ++ MAX_FRAGMENTS; ++ ++ g_fragments_base = (char *)slot_mem + slot_mem_size; ++ slot_mem_size += frag_mem_size; ++ ++ g_free_fragments = g_fragments_base; ++ for (i = 0; i < (MAX_FRAGMENTS - 1); i++) { ++ *(char **)&g_fragments_base[i*g_fragments_size] = ++ &g_fragments_base[(i + 1)*g_fragments_size]; ++ } ++ *(char **)&g_fragments_base[i * g_fragments_size] = NULL; ++ sema_init(&g_free_fragments_sema, MAX_FRAGMENTS); ++ ++ if (vchiq_init_state(state, vchiq_slot_zero, 0) != VCHIQ_SUCCESS) ++ return -EINVAL; ++ ++ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); ++ g_regs = devm_ioremap_resource(&pdev->dev, res); ++ if (IS_ERR(g_regs)) ++ return PTR_ERR(g_regs); ++ ++ irq = platform_get_irq(pdev, 0); ++ if (irq <= 0) { ++ dev_err(dev, "failed to get IRQ\n"); ++ return irq; ++ } ++ ++ err = devm_request_irq(dev, irq, vchiq_doorbell_irq, IRQF_IRQPOLL, ++ "VCHIQ doorbell", state); ++ if (err) { ++ dev_err(dev, "failed to register irq=%d\n", irq); ++ return err; ++ } ++ ++ /* Send the base address of the slots to VideoCore */ ++ channelbase = slot_phys; ++ err = rpi_firmware_property(fw, RPI_FIRMWARE_VCHIQ_INIT, ++ &channelbase, sizeof(channelbase)); ++ if (err || channelbase) { ++ dev_err(dev, "failed to set channelbase\n"); ++ return err ? : -ENXIO; ++ } ++ ++ vchiq_log_info(vchiq_arm_log_level, ++ "vchiq_init - done (slots %x, phys %pad)", ++ (unsigned int)vchiq_slot_zero, &slot_phys); ++ ++ vchiq_call_connected_callbacks(); ++ ++ return 0; ++} ++ ++VCHIQ_STATUS_T ++vchiq_platform_init_state(VCHIQ_STATE_T *state) ++{ ++ VCHIQ_STATUS_T status = VCHIQ_SUCCESS; ++ state->platform_state = kzalloc(sizeof(VCHIQ_2835_ARM_STATE_T), GFP_KERNEL); ++ ((VCHIQ_2835_ARM_STATE_T*)state->platform_state)->inited = 1; ++ status = vchiq_arm_init_state(state, &((VCHIQ_2835_ARM_STATE_T*)state->platform_state)->arm_state); ++ if(status != VCHIQ_SUCCESS) ++ { ++ ((VCHIQ_2835_ARM_STATE_T*)state->platform_state)->inited = 0; ++ } ++ return status; ++} ++ ++VCHIQ_ARM_STATE_T* ++vchiq_platform_get_arm_state(VCHIQ_STATE_T *state) ++{ ++ if(!((VCHIQ_2835_ARM_STATE_T*)state->platform_state)->inited) ++ { ++ BUG(); ++ } ++ return &((VCHIQ_2835_ARM_STATE_T*)state->platform_state)->arm_state; ++} ++ ++void ++remote_event_signal(REMOTE_EVENT_T *event) ++{ ++ wmb(); ++ ++ event->fired = 1; ++ ++ dsb(); /* data barrier operation */ ++ ++ if (event->armed) ++ writel(0, g_regs + BELL2); /* trigger vc interrupt */ ++} ++ ++int ++vchiq_copy_from_user(void *dst, const void *src, int size) ++{ ++ if ((uint32_t)src < TASK_SIZE) { ++ return copy_from_user(dst, src, size); ++ } else { ++ memcpy(dst, src, size); ++ return 0; ++ } ++} ++ ++VCHIQ_STATUS_T ++vchiq_prepare_bulk_data(VCHIQ_BULK_T *bulk, VCHI_MEM_HANDLE_T memhandle, ++ void *offset, int size, int dir) ++{ ++ PAGELIST_T *pagelist; ++ int ret; ++ ++ WARN_ON(memhandle != VCHI_MEM_HANDLE_INVALID); ++ ++ ret = create_pagelist((char __user *)offset, size, ++ (dir == VCHIQ_BULK_RECEIVE) ++ ? PAGELIST_READ ++ : PAGELIST_WRITE, ++ current, ++ &pagelist); ++ if (ret != 0) ++ return VCHIQ_ERROR; ++ ++ bulk->handle = memhandle; ++ bulk->data = VCHIQ_ARM_ADDRESS(pagelist); ++ ++ /* Store the pagelist address in remote_data, which isn't used by the ++ slave. */ ++ bulk->remote_data = pagelist; ++ ++ return VCHIQ_SUCCESS; ++} ++ ++void ++vchiq_complete_bulk(VCHIQ_BULK_T *bulk) ++{ ++ if (bulk && bulk->remote_data && bulk->actual) ++ free_pagelist((PAGELIST_T *)bulk->remote_data, bulk->actual); ++} ++ ++void ++vchiq_transfer_bulk(VCHIQ_BULK_T *bulk) ++{ ++ /* ++ * This should only be called on the master (VideoCore) side, but ++ * provide an implementation to avoid the need for ifdefery. ++ */ ++ BUG(); ++} ++ ++void ++vchiq_dump_platform_state(void *dump_context) ++{ ++ char buf[80]; ++ int len; ++ len = snprintf(buf, sizeof(buf), ++ " Platform: 2835 (VC master)"); ++ vchiq_dump(dump_context, buf, len + 1); ++} ++ ++VCHIQ_STATUS_T ++vchiq_platform_suspend(VCHIQ_STATE_T *state) ++{ ++ return VCHIQ_ERROR; ++} ++ ++VCHIQ_STATUS_T ++vchiq_platform_resume(VCHIQ_STATE_T *state) ++{ ++ return VCHIQ_SUCCESS; ++} ++ ++void ++vchiq_platform_paused(VCHIQ_STATE_T *state) ++{ ++} ++ ++void ++vchiq_platform_resumed(VCHIQ_STATE_T *state) ++{ ++} ++ ++int ++vchiq_platform_videocore_wanted(VCHIQ_STATE_T* state) ++{ ++ return 1; // autosuspend not supported - videocore always wanted ++} ++ ++int ++vchiq_platform_use_suspend_timer(void) ++{ ++ return 0; ++} ++void ++vchiq_dump_platform_use_state(VCHIQ_STATE_T *state) ++{ ++ vchiq_log_info(vchiq_arm_log_level, "Suspend timer not in use"); ++} ++void ++vchiq_platform_handle_timeout(VCHIQ_STATE_T *state) ++{ ++ (void)state; ++} ++/* ++ * Local functions ++ */ ++ ++static irqreturn_t ++vchiq_doorbell_irq(int irq, void *dev_id) ++{ ++ VCHIQ_STATE_T *state = dev_id; ++ irqreturn_t ret = IRQ_NONE; ++ unsigned int status; ++ ++ /* Read (and clear) the doorbell */ ++ status = readl(g_regs + BELL0); ++ ++ if (status & 0x4) { /* Was the doorbell rung? */ ++ remote_event_pollall(state); ++ ret = IRQ_HANDLED; ++ } ++ ++ return ret; ++} ++ ++/* There is a potential problem with partial cache lines (pages?) ++** at the ends of the block when reading. If the CPU accessed anything in ++** the same line (page?) then it may have pulled old data into the cache, ++** obscuring the new data underneath. We can solve this by transferring the ++** partial cache lines separately, and allowing the ARM to copy into the ++** cached area. ++ ++** N.B. This implementation plays slightly fast and loose with the Linux ++** driver programming rules, e.g. its use of dmac_map_area instead of ++** dma_map_single, but it isn't a multi-platform driver and it benefits ++** from increased speed as a result. ++*/ ++ ++static int ++create_pagelist(char __user *buf, size_t count, unsigned short type, ++ struct task_struct *task, PAGELIST_T ** ppagelist) ++{ ++ PAGELIST_T *pagelist; ++ struct page **pages; ++ unsigned long *addrs; ++ unsigned int num_pages, offset, i; ++ char *addr, *base_addr, *next_addr; ++ int run, addridx, actual_pages; ++ unsigned long *need_release; ++ ++ offset = (unsigned int)buf & (PAGE_SIZE - 1); ++ num_pages = (count + offset + PAGE_SIZE - 1) / PAGE_SIZE; ++ ++ *ppagelist = NULL; ++ ++ /* Allocate enough storage to hold the page pointers and the page ++ ** list ++ */ ++ pagelist = kmalloc(sizeof(PAGELIST_T) + ++ (num_pages * sizeof(unsigned long)) + ++ sizeof(unsigned long) + ++ (num_pages * sizeof(pages[0])), ++ GFP_KERNEL); ++ ++ vchiq_log_trace(vchiq_arm_log_level, ++ "create_pagelist - %x", (unsigned int)pagelist); ++ if (!pagelist) ++ return -ENOMEM; ++ ++ addrs = pagelist->addrs; ++ need_release = (unsigned long *)(addrs + num_pages); ++ pages = (struct page **)(addrs + num_pages + 1); ++ ++ if (is_vmalloc_addr(buf)) { ++ int dir = (type == PAGELIST_WRITE) ? ++ DMA_TO_DEVICE : DMA_FROM_DEVICE; ++ unsigned long length = count; ++ unsigned int off = offset; ++ ++ for (actual_pages = 0; actual_pages < num_pages; ++ actual_pages++) { ++ struct page *pg = vmalloc_to_page(buf + (actual_pages * ++ PAGE_SIZE)); ++ size_t bytes = PAGE_SIZE - off; ++ ++ if (bytes > length) ++ bytes = length; ++ pages[actual_pages] = pg; ++ dmac_map_area(page_address(pg) + off, bytes, dir); ++ length -= bytes; ++ off = 0; ++ } ++ *need_release = 0; /* do not try and release vmalloc pages */ ++ } else { ++ down_read(&task->mm->mmap_sem); ++ actual_pages = get_user_pages( ++ (unsigned long)buf & ~(PAGE_SIZE - 1), ++ num_pages, ++ (type == PAGELIST_READ) /*Write */ , ++ 0 /*Force */ , ++ pages, ++ NULL /*vmas */); ++ up_read(&task->mm->mmap_sem); ++ ++ if (actual_pages != num_pages) { ++ vchiq_log_info(vchiq_arm_log_level, ++ "create_pagelist - only %d/%d pages locked", ++ actual_pages, ++ num_pages); ++ ++ /* This is probably due to the process being killed */ ++ while (actual_pages > 0) ++ { ++ actual_pages--; ++ put_page(pages[actual_pages]); ++ } ++ kfree(pagelist); ++ if (actual_pages == 0) ++ actual_pages = -ENOMEM; ++ return actual_pages; ++ } ++ *need_release = 1; /* release user pages */ ++ } ++ ++ pagelist->length = count; ++ pagelist->type = type; ++ pagelist->offset = offset; ++ ++ /* Group the pages into runs of contiguous pages */ ++ ++ base_addr = VCHIQ_ARM_ADDRESS(page_address(pages[0])); ++ next_addr = base_addr + PAGE_SIZE; ++ addridx = 0; ++ run = 0; ++ ++ for (i = 1; i < num_pages; i++) { ++ addr = VCHIQ_ARM_ADDRESS(page_address(pages[i])); ++ if ((addr == next_addr) && (run < (PAGE_SIZE - 1))) { ++ next_addr += PAGE_SIZE; ++ run++; ++ } else { ++ addrs[addridx] = (unsigned long)base_addr + run; ++ addridx++; ++ base_addr = addr; ++ next_addr = addr + PAGE_SIZE; ++ run = 0; ++ } ++ } ++ ++ addrs[addridx] = (unsigned long)base_addr + run; ++ addridx++; ++ ++ /* Partial cache lines (fragments) require special measures */ ++ if ((type == PAGELIST_READ) && ++ ((pagelist->offset & (g_cache_line_size - 1)) || ++ ((pagelist->offset + pagelist->length) & ++ (g_cache_line_size - 1)))) { ++ char *fragments; ++ ++ if (down_interruptible(&g_free_fragments_sema) != 0) { ++ kfree(pagelist); ++ return -EINTR; ++ } ++ ++ WARN_ON(g_free_fragments == NULL); ++ ++ down(&g_free_fragments_mutex); ++ fragments = g_free_fragments; ++ WARN_ON(fragments == NULL); ++ g_free_fragments = *(char **) g_free_fragments; ++ up(&g_free_fragments_mutex); ++ pagelist->type = PAGELIST_READ_WITH_FRAGMENTS + ++ (fragments - g_fragments_base) / g_fragments_size; ++ } ++ ++ dmac_flush_range(pagelist, addrs + num_pages); ++ ++ *ppagelist = pagelist; ++ ++ return 0; ++} ++ ++static void ++free_pagelist(PAGELIST_T *pagelist, int actual) ++{ ++ unsigned long *need_release; ++ struct page **pages; ++ unsigned int num_pages, i; ++ ++ vchiq_log_trace(vchiq_arm_log_level, ++ "free_pagelist - %x, %d", (unsigned int)pagelist, actual); ++ ++ num_pages = ++ (pagelist->length + pagelist->offset + PAGE_SIZE - 1) / ++ PAGE_SIZE; ++ ++ need_release = (unsigned long *)(pagelist->addrs + num_pages); ++ pages = (struct page **)(pagelist->addrs + num_pages + 1); ++ ++ /* Deal with any partial cache lines (fragments) */ ++ if (pagelist->type >= PAGELIST_READ_WITH_FRAGMENTS) { ++ char *fragments = g_fragments_base + ++ (pagelist->type - PAGELIST_READ_WITH_FRAGMENTS) * ++ g_fragments_size; ++ int head_bytes, tail_bytes; ++ head_bytes = (g_cache_line_size - pagelist->offset) & ++ (g_cache_line_size - 1); ++ tail_bytes = (pagelist->offset + actual) & ++ (g_cache_line_size - 1); ++ ++ if ((actual >= 0) && (head_bytes != 0)) { ++ if (head_bytes > actual) ++ head_bytes = actual; ++ ++ memcpy((char *)page_address(pages[0]) + ++ pagelist->offset, ++ fragments, ++ head_bytes); ++ } ++ if ((actual >= 0) && (head_bytes < actual) && ++ (tail_bytes != 0)) { ++ memcpy((char *)page_address(pages[num_pages - 1]) + ++ ((pagelist->offset + actual) & ++ (PAGE_SIZE - 1) & ~(g_cache_line_size - 1)), ++ fragments + g_cache_line_size, ++ tail_bytes); ++ } ++ ++ down(&g_free_fragments_mutex); ++ *(char **)fragments = g_free_fragments; ++ g_free_fragments = fragments; ++ up(&g_free_fragments_mutex); ++ up(&g_free_fragments_sema); ++ } ++ ++ if (*need_release) { ++ unsigned int length = pagelist->length; ++ unsigned int offset = pagelist->offset; ++ ++ for (i = 0; i < num_pages; i++) { ++ struct page *pg = pages[i]; ++ ++ if (pagelist->type != PAGELIST_WRITE) { ++ unsigned int bytes = PAGE_SIZE - offset; ++ ++ if (bytes > length) ++ bytes = length; ++ dmac_unmap_area(page_address(pg) + offset, ++ bytes, DMA_FROM_DEVICE); ++ length -= bytes; ++ offset = 0; ++ set_page_dirty(pg); ++ } ++ put_page(pg); ++ } ++ } ++ ++ kfree(pagelist); ++} +diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm.c +new file mode 100644 +index 0000000..51e6018 +--- /dev/null ++++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm.c +@@ -0,0 +1,2920 @@ ++/** ++ * Copyright (c) 2014 Raspberry Pi (Trading) Ltd. All rights reserved. ++ * Copyright (c) 2010-2012 Broadcom. 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, ++ * without modification. ++ * 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. ++ * 3. The names of the above-listed copyright holders may not be used ++ * to endorse or promote products derived from this software without ++ * specific prior written permission. ++ * ++ * ALTERNATIVELY, this software may be distributed under the terms of the ++ * GNU General Public License ("GPL") version 2, as published by the Free ++ * Software Foundation. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER OR ++ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ++ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, ++ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR ++ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF ++ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING ++ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ */ ++ ++#include <linux/kernel.h> ++#include <linux/module.h> ++#include <linux/types.h> ++#include <linux/errno.h> ++#include <linux/cdev.h> ++#include <linux/fs.h> ++#include <linux/device.h> ++#include <linux/mm.h> ++#include <linux/highmem.h> ++#include <linux/pagemap.h> ++#include <linux/bug.h> ++#include <linux/semaphore.h> ++#include <linux/list.h> ++#include <linux/of.h> ++#include <linux/platform_device.h> ++#include <soc/bcm2835/raspberrypi-firmware.h> ++ ++#include "vchiq_core.h" ++#include "vchiq_ioctl.h" ++#include "vchiq_arm.h" ++#include "vchiq_debugfs.h" ++#include "vchiq_killable.h" ++ ++#define DEVICE_NAME "vchiq" ++ ++/* Override the default prefix, which would be vchiq_arm (from the filename) */ ++#undef MODULE_PARAM_PREFIX ++#define MODULE_PARAM_PREFIX DEVICE_NAME "." ++ ++#define VCHIQ_MINOR 0 ++ ++/* Some per-instance constants */ ++#define MAX_COMPLETIONS 16 ++#define MAX_SERVICES 64 ++#define MAX_ELEMENTS 8 ++#define MSG_QUEUE_SIZE 64 ++ ++#define KEEPALIVE_VER 1 ++#define KEEPALIVE_VER_MIN KEEPALIVE_VER ++ ++/* Run time control of log level, based on KERN_XXX level. */ ++int vchiq_arm_log_level = VCHIQ_LOG_DEFAULT; ++int vchiq_susp_log_level = VCHIQ_LOG_ERROR; ++ ++#define SUSPEND_TIMER_TIMEOUT_MS 100 ++#define SUSPEND_RETRY_TIMER_TIMEOUT_MS 1000 ++ ++#define VC_SUSPEND_NUM_OFFSET 3 /* number of values before idle which are -ve */ ++static const char *const suspend_state_names[] = { ++ "VC_SUSPEND_FORCE_CANCELED", ++ "VC_SUSPEND_REJECTED", ++ "VC_SUSPEND_FAILED", ++ "VC_SUSPEND_IDLE", ++ "VC_SUSPEND_REQUESTED", ++ "VC_SUSPEND_IN_PROGRESS", ++ "VC_SUSPEND_SUSPENDED" ++}; ++#define VC_RESUME_NUM_OFFSET 1 /* number of values before idle which are -ve */ ++static const char *const resume_state_names[] = { ++ "VC_RESUME_FAILED", ++ "VC_RESUME_IDLE", ++ "VC_RESUME_REQUESTED", ++ "VC_RESUME_IN_PROGRESS", ++ "VC_RESUME_RESUMED" ++}; ++/* The number of times we allow force suspend to timeout before actually ++** _forcing_ suspend. This is to cater for SW which fails to release vchiq ++** correctly - we don't want to prevent ARM suspend indefinitely in this case. ++*/ ++#define FORCE_SUSPEND_FAIL_MAX 8 ++ ++/* The time in ms allowed for videocore to go idle when force suspend has been ++ * requested */ ++#define FORCE_SUSPEND_TIMEOUT_MS 200 ++ ++ ++static void suspend_timer_callback(unsigned long context); ++ ++ ++typedef struct user_service_struct { ++ VCHIQ_SERVICE_T *service; ++ void *userdata; ++ VCHIQ_INSTANCE_T instance; ++ char is_vchi; ++ char dequeue_pending; ++ char close_pending; ++ int message_available_pos; ++ int msg_insert; ++ int msg_remove; ++ struct semaphore insert_event; ++ struct semaphore remove_event; ++ struct semaphore close_event; ++ VCHIQ_HEADER_T * msg_queue[MSG_QUEUE_SIZE]; ++} USER_SERVICE_T; ++ ++struct bulk_waiter_node { ++ struct bulk_waiter bulk_waiter; ++ int pid; ++ struct list_head list; ++}; ++ ++struct vchiq_instance_struct { ++ VCHIQ_STATE_T *state; ++ VCHIQ_COMPLETION_DATA_T completions[MAX_COMPLETIONS]; ++ int completion_insert; ++ int completion_remove; ++ struct semaphore insert_event; ++ struct semaphore remove_event; ++ struct mutex completion_mutex; ++ ++ int connected; ++ int closing; ++ int pid; ++ int mark; ++ int use_close_delivered; ++ int trace; ++ ++ struct list_head bulk_waiter_list; ++ struct mutex bulk_waiter_list_mutex; ++ ++ VCHIQ_DEBUGFS_NODE_T debugfs_node; ++}; ++ ++typedef struct dump_context_struct { ++ char __user *buf; ++ size_t actual; ++ size_t space; ++ loff_t offset; ++} DUMP_CONTEXT_T; ++ ++static struct cdev vchiq_cdev; ++static dev_t vchiq_devid; ++static VCHIQ_STATE_T g_state; ++static struct class *vchiq_class; ++static struct device *vchiq_dev; ++static DEFINE_SPINLOCK(msg_queue_spinlock); ++ ++static const char *const ioctl_names[] = { ++ "CONNECT", ++ "SHUTDOWN", ++ "CREATE_SERVICE", ++ "REMOVE_SERVICE", ++ "QUEUE_MESSAGE", ++ "QUEUE_BULK_TRANSMIT", ++ "QUEUE_BULK_RECEIVE", ++ "AWAIT_COMPLETION", ++ "DEQUEUE_MESSAGE", ++ "GET_CLIENT_ID", ++ "GET_CONFIG", ++ "CLOSE_SERVICE", ++ "USE_SERVICE", ++ "RELEASE_SERVICE", ++ "SET_SERVICE_OPTION", ++ "DUMP_PHYS_MEM", ++ "LIB_VERSION", ++ "CLOSE_DELIVERED" ++}; ++ ++vchiq_static_assert((sizeof(ioctl_names)/sizeof(ioctl_names[0])) == ++ (VCHIQ_IOC_MAX + 1)); ++ ++static void ++dump_phys_mem(void *virt_addr, uint32_t num_bytes); ++ ++/**************************************************************************** ++* ++* add_completion ++* ++***************************************************************************/ ++ ++static VCHIQ_STATUS_T ++add_completion(VCHIQ_INSTANCE_T instance, VCHIQ_REASON_T reason, ++ VCHIQ_HEADER_T *header, USER_SERVICE_T *user_service, ++ void *bulk_userdata) ++{ ++ VCHIQ_COMPLETION_DATA_T *completion; ++ DEBUG_INITIALISE(g_state.local) ++ ++ mutex_lock(&instance->completion_mutex); ++ ++ while (instance->completion_insert == ++ (instance->completion_remove + MAX_COMPLETIONS)) { ++ /* Out of space - wait for the client */ ++ DEBUG_TRACE(SERVICE_CALLBACK_LINE); ++ vchiq_log_trace(vchiq_arm_log_level, ++ "add_completion - completion queue full"); ++ DEBUG_COUNT(COMPLETION_QUEUE_FULL_COUNT); ++ ++ mutex_unlock(&instance->completion_mutex); ++ if (down_interruptible(&instance->remove_event) != 0) { ++ vchiq_log_info(vchiq_arm_log_level, ++ "service_callback interrupted"); ++ return VCHIQ_RETRY; ++ } ++ ++ mutex_lock(&instance->completion_mutex); ++ if (instance->closing) { ++ mutex_unlock(&instance->completion_mutex); ++ vchiq_log_info(vchiq_arm_log_level, ++ "service_callback closing"); ++ return VCHIQ_SUCCESS; ++ } ++ DEBUG_TRACE(SERVICE_CALLBACK_LINE); ++ } ++ ++ completion = ++ &instance->completions[instance->completion_insert & ++ (MAX_COMPLETIONS - 1)]; ++ ++ completion->header = header; ++ completion->reason = reason; ++ /* N.B. service_userdata is updated while processing AWAIT_COMPLETION */ ++ completion->service_userdata = user_service->service; ++ completion->bulk_userdata = bulk_userdata; ++ ++ if (reason == VCHIQ_SERVICE_CLOSED) { ++ /* Take an extra reference, to be held until ++ this CLOSED notification is delivered. */ ++ lock_service(user_service->service); ++ if (instance->use_close_delivered) ++ user_service->close_pending = 1; ++ } ++ ++ /* A write barrier is needed here to ensure that the entire completion ++ record is written out before the insert point. */ ++ wmb(); ++ ++ if (reason == VCHIQ_MESSAGE_AVAILABLE) ++ user_service->message_available_pos = ++ instance->completion_insert; ++ ++ instance->completion_insert++; ++ ++ mutex_unlock(&instance->completion_mutex); ++ ++ up(&instance->insert_event); ++ ++ return VCHIQ_SUCCESS; ++} ++ ++/**************************************************************************** ++* ++* service_callback ++* ++***************************************************************************/ ++ ++static VCHIQ_STATUS_T ++service_callback(VCHIQ_REASON_T reason, VCHIQ_HEADER_T *header, ++ VCHIQ_SERVICE_HANDLE_T handle, void *bulk_userdata) ++{ ++ /* How do we ensure the callback goes to the right client? ++ ** The service_user data points to a USER_SERVICE_T record containing ++ ** the original callback and the user state structure, which contains a ++ ** circular buffer for completion records. ++ */ ++ USER_SERVICE_T *user_service; ++ VCHIQ_SERVICE_T *service; ++ VCHIQ_INSTANCE_T instance; ++ int skip_completion = 0; ++ DEBUG_INITIALISE(g_state.local) ++ ++ DEBUG_TRACE(SERVICE_CALLBACK_LINE); ++ ++ service = handle_to_service(handle); ++ BUG_ON(!service); ++ user_service = (USER_SERVICE_T *)service->base.userdata; ++ instance = user_service->instance; ++ ++ if (!instance || instance->closing) ++ return VCHIQ_SUCCESS; ++ ++ vchiq_log_trace(vchiq_arm_log_level, ++ "service_callback - service %lx(%d,%p), reason %d, header %lx, " ++ "instance %lx, bulk_userdata %lx", ++ (unsigned long)user_service, ++ service->localport, user_service->userdata, ++ reason, (unsigned long)header, ++ (unsigned long)instance, (unsigned long)bulk_userdata); ++ ++ if (header && user_service->is_vchi) { ++ spin_lock(&msg_queue_spinlock); ++ while (user_service->msg_insert == ++ (user_service->msg_remove + MSG_QUEUE_SIZE)) { ++ spin_unlock(&msg_queue_spinlock); ++ DEBUG_TRACE(SERVICE_CALLBACK_LINE); ++ DEBUG_COUNT(MSG_QUEUE_FULL_COUNT); ++ vchiq_log_trace(vchiq_arm_log_level, ++ "service_callback - msg queue full"); ++ /* If there is no MESSAGE_AVAILABLE in the completion ++ ** queue, add one ++ */ ++ if ((user_service->message_available_pos - ++ instance->completion_remove) < 0) { ++ VCHIQ_STATUS_T status; ++ vchiq_log_info(vchiq_arm_log_level, ++ "Inserting extra MESSAGE_AVAILABLE"); ++ DEBUG_TRACE(SERVICE_CALLBACK_LINE); ++ status = add_completion(instance, reason, ++ NULL, user_service, bulk_userdata); ++ if (status != VCHIQ_SUCCESS) { ++ DEBUG_TRACE(SERVICE_CALLBACK_LINE); ++ return status; ++ } ++ } ++ ++ DEBUG_TRACE(SERVICE_CALLBACK_LINE); ++ if (down_interruptible(&user_service->remove_event) ++ != 0) { ++ vchiq_log_info(vchiq_arm_log_level, ++ "service_callback interrupted"); ++ DEBUG_TRACE(SERVICE_CALLBACK_LINE); ++ return VCHIQ_RETRY; ++ } else if (instance->closing) { ++ vchiq_log_info(vchiq_arm_log_level, ++ "service_callback closing"); ++ DEBUG_TRACE(SERVICE_CALLBACK_LINE); ++ return VCHIQ_ERROR; ++ } ++ DEBUG_TRACE(SERVICE_CALLBACK_LINE); ++ spin_lock(&msg_queue_spinlock); ++ } ++ ++ user_service->msg_queue[user_service->msg_insert & ++ (MSG_QUEUE_SIZE - 1)] = header; ++ user_service->msg_insert++; ++ ++ /* If there is a thread waiting in DEQUEUE_MESSAGE, or if ++ ** there is a MESSAGE_AVAILABLE in the completion queue then ++ ** bypass the completion queue. ++ */ ++ if (((user_service->message_available_pos - ++ instance->completion_remove) >= 0) || ++ user_service->dequeue_pending) { ++ user_service->dequeue_pending = 0; ++ skip_completion = 1; ++ } ++ ++ spin_unlock(&msg_queue_spinlock); ++ ++ up(&user_service->insert_event); ++ ++ header = NULL; ++ } ++ ++ if (skip_completion) { ++ DEBUG_TRACE(SERVICE_CALLBACK_LINE); ++ return VCHIQ_SUCCESS; ++ } ++ ++ DEBUG_TRACE(SERVICE_CALLBACK_LINE); ++ ++ return add_completion(instance, reason, header, user_service, ++ bulk_userdata); ++} ++ ++/**************************************************************************** ++* ++* user_service_free ++* ++***************************************************************************/ ++static void ++user_service_free(void *userdata) ++{ ++ kfree(userdata); ++} ++ ++/**************************************************************************** ++* ++* close_delivered ++* ++***************************************************************************/ ++static void close_delivered(USER_SERVICE_T *user_service) ++{ ++ vchiq_log_info(vchiq_arm_log_level, ++ "close_delivered(handle=%x)", ++ user_service->service->handle); ++ ++ if (user_service->close_pending) { ++ /* Allow the underlying service to be culled */ ++ unlock_service(user_service->service); ++ ++ /* Wake the user-thread blocked in close_ or remove_service */ ++ up(&user_service->close_event); ++ ++ user_service->close_pending = 0; ++ } ++} ++ ++/**************************************************************************** ++* ++* vchiq_ioctl ++* ++***************************************************************************/ ++static long ++vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ++{ ++ VCHIQ_INSTANCE_T instance = file->private_data; ++ VCHIQ_STATUS_T status = VCHIQ_SUCCESS; ++ VCHIQ_SERVICE_T *service = NULL; ++ long ret = 0; ++ int i, rc; ++ DEBUG_INITIALISE(g_state.local) ++ ++ vchiq_log_trace(vchiq_arm_log_level, ++ "vchiq_ioctl - instance %x, cmd %s, arg %lx", ++ (unsigned int)instance, ++ ((_IOC_TYPE(cmd) == VCHIQ_IOC_MAGIC) && ++ (_IOC_NR(cmd) <= VCHIQ_IOC_MAX)) ? ++ ioctl_names[_IOC_NR(cmd)] : "<invalid>", arg); ++ ++ switch (cmd) { ++ case VCHIQ_IOC_SHUTDOWN: ++ if (!instance->connected) ++ break; ++ ++ /* Remove all services */ ++ i = 0; ++ while ((service = next_service_by_instance(instance->state, ++ instance, &i)) != NULL) { ++ status = vchiq_remove_service(service->handle); ++ unlock_service(service); ++ if (status != VCHIQ_SUCCESS) ++ break; ++ } ++ service = NULL; ++ ++ if (status == VCHIQ_SUCCESS) { ++ /* Wake the completion thread and ask it to exit */ ++ instance->closing = 1; ++ up(&instance->insert_event); ++ } ++ ++ break; ++ ++ case VCHIQ_IOC_CONNECT: ++ if (instance->connected) { ++ ret = -EINVAL; ++ break; ++ } ++ rc = mutex_lock_interruptible(&instance->state->mutex); ++ if (rc != 0) { ++ vchiq_log_error(vchiq_arm_log_level, ++ "vchiq: connect: could not lock mutex for " ++ "state %d: %d", ++ instance->state->id, rc); ++ ret = -EINTR; ++ break; ++ } ++ status = vchiq_connect_internal(instance->state, instance); ++ mutex_unlock(&instance->state->mutex); ++ ++ if (status == VCHIQ_SUCCESS) ++ instance->connected = 1; ++ else ++ vchiq_log_error(vchiq_arm_log_level, ++ "vchiq: could not connect: %d", status); ++ break; ++ ++ case VCHIQ_IOC_CREATE_SERVICE: { ++ VCHIQ_CREATE_SERVICE_T args; ++ USER_SERVICE_T *user_service = NULL; ++ void *userdata; ++ int srvstate; ++ ++ if (copy_from_user ++ (&args, (const void __user *)arg, ++ sizeof(args)) != 0) { ++ ret = -EFAULT; ++ break; ++ } ++ ++ user_service = kmalloc(sizeof(USER_SERVICE_T), GFP_KERNEL); ++ if (!user_service) { ++ ret = -ENOMEM; ++ break; ++ } ++ ++ if (args.is_open) { ++ if (!instance->connected) { ++ ret = -ENOTCONN; ++ kfree(user_service); ++ break; ++ } ++ srvstate = VCHIQ_SRVSTATE_OPENING; ++ } else { ++ srvstate = ++ instance->connected ? ++ VCHIQ_SRVSTATE_LISTENING : ++ VCHIQ_SRVSTATE_HIDDEN; ++ } ++ ++ userdata = args.params.userdata; ++ args.params.callback = service_callback; ++ args.params.userdata = user_service; ++ service = vchiq_add_service_internal( ++ instance->state, ++ &args.params, srvstate, ++ instance, user_service_free); ++ ++ if (service != NULL) { ++ user_service->service = service; ++ user_service->userdata = userdata; ++ user_service->instance = instance; ++ user_service->is_vchi = (args.is_vchi != 0); ++ user_service->dequeue_pending = 0; ++ user_service->close_pending = 0; ++ user_service->message_available_pos = ++ instance->completion_remove - 1; ++ user_service->msg_insert = 0; ++ user_service->msg_remove = 0; ++ sema_init(&user_service->insert_event, 0); ++ sema_init(&user_service->remove_event, 0); ++ sema_init(&user_service->close_event, 0); ++ ++ if (args.is_open) { ++ status = vchiq_open_service_internal ++ (service, instance->pid); ++ if (status != VCHIQ_SUCCESS) { ++ vchiq_remove_service(service->handle); ++ service = NULL; ++ ret = (status == VCHIQ_RETRY) ? ++ -EINTR : -EIO; ++ break; ++ } ++ } ++ ++ if (copy_to_user((void __user *) ++ &(((VCHIQ_CREATE_SERVICE_T __user *) ++ arg)->handle), ++ (const void *)&service->handle, ++ sizeof(service->handle)) != 0) { ++ ret = -EFAULT; ++ vchiq_remove_service(service->handle); ++ } ++ ++ service = NULL; ++ } else { ++ ret = -EEXIST; ++ kfree(user_service); ++ } ++ } break; ++ ++ case VCHIQ_IOC_CLOSE_SERVICE: { ++ VCHIQ_SERVICE_HANDLE_T handle = (VCHIQ_SERVICE_HANDLE_T)arg; ++ ++ service = find_service_for_instance(instance, handle); ++ if (service != NULL) { ++ USER_SERVICE_T *user_service = ++ (USER_SERVICE_T *)service->base.userdata; ++ /* close_pending is false on first entry, and when the ++ wait in vchiq_close_service has been interrupted. */ ++ if (!user_service->close_pending) { ++ status = vchiq_close_service(service->handle); ++ if (status != VCHIQ_SUCCESS) ++ break; ++ } ++ ++ /* close_pending is true once the underlying service ++ has been closed until the client library calls the ++ CLOSE_DELIVERED ioctl, signalling close_event. */ ++ if (user_service->close_pending && ++ down_interruptible(&user_service->close_event)) ++ status = VCHIQ_RETRY; ++ } ++ else ++ ret = -EINVAL; ++ } break; ++ ++ case VCHIQ_IOC_REMOVE_SERVICE: { ++ VCHIQ_SERVICE_HANDLE_T handle = (VCHIQ_SERVICE_HANDLE_T)arg; ++ ++ service = find_service_for_instance(instance, handle); ++ if (service != NULL) { ++ USER_SERVICE_T *user_service = ++ (USER_SERVICE_T *)service->base.userdata; ++ /* close_pending is false on first entry, and when the ++ wait in vchiq_close_service has been interrupted. */ ++ if (!user_service->close_pending) { ++ status = vchiq_remove_service(service->handle); ++ if (status != VCHIQ_SUCCESS) ++ break; ++ } ++ ++ /* close_pending is true once the underlying service ++ has been closed until the client library calls the ++ CLOSE_DELIVERED ioctl, signalling close_event. */ ++ if (user_service->close_pending && ++ down_interruptible(&user_service->close_event)) ++ status = VCHIQ_RETRY; ++ } ++ else ++ ret = -EINVAL; ++ } break; ++ ++ case VCHIQ_IOC_USE_SERVICE: ++ case VCHIQ_IOC_RELEASE_SERVICE: { ++ VCHIQ_SERVICE_HANDLE_T handle = (VCHIQ_SERVICE_HANDLE_T)arg; ++ ++ service = find_service_for_instance(instance, handle); ++ if (service != NULL) { ++ status = (cmd == VCHIQ_IOC_USE_SERVICE) ? ++ vchiq_use_service_internal(service) : ++ vchiq_release_service_internal(service); ++ if (status != VCHIQ_SUCCESS) { ++ vchiq_log_error(vchiq_susp_log_level, ++ "%s: cmd %s returned error %d for " ++ "service %c%c%c%c:%03d", ++ __func__, ++ (cmd == VCHIQ_IOC_USE_SERVICE) ? ++ "VCHIQ_IOC_USE_SERVICE" : ++ "VCHIQ_IOC_RELEASE_SERVICE", ++ status, ++ VCHIQ_FOURCC_AS_4CHARS( ++ service->base.fourcc), ++ service->client_id); ++ ret = -EINVAL; ++ } ++ } else ++ ret = -EINVAL; ++ } break; ++ ++ case VCHIQ_IOC_QUEUE_MESSAGE: { ++ VCHIQ_QUEUE_MESSAGE_T args; ++ if (copy_from_user ++ (&args, (const void __user *)arg, ++ sizeof(args)) != 0) { ++ ret = -EFAULT; ++ break; ++ } ++ ++ service = find_service_for_instance(instance, args.handle); ++ ++ if ((service != NULL) && (args.count <= MAX_ELEMENTS)) { ++ /* Copy elements into kernel space */ ++ VCHIQ_ELEMENT_T elements[MAX_ELEMENTS]; ++ if (copy_from_user(elements, args.elements, ++ args.count * sizeof(VCHIQ_ELEMENT_T)) == 0) ++ status = vchiq_queue_message ++ (args.handle, ++ elements, args.count); ++ else ++ ret = -EFAULT; ++ } else { ++ ret = -EINVAL; ++ } ++ } break; ++ ++ case VCHIQ_IOC_QUEUE_BULK_TRANSMIT: ++ case VCHIQ_IOC_QUEUE_BULK_RECEIVE: { ++ VCHIQ_QUEUE_BULK_TRANSFER_T args; ++ struct bulk_waiter_node *waiter = NULL; ++ VCHIQ_BULK_DIR_T dir = ++ (cmd == VCHIQ_IOC_QUEUE_BULK_TRANSMIT) ? ++ VCHIQ_BULK_TRANSMIT : VCHIQ_BULK_RECEIVE; ++ ++ if (copy_from_user ++ (&args, (const void __user *)arg, ++ sizeof(args)) != 0) { ++ ret = -EFAULT; ++ break; ++ } ++ ++ service = find_service_for_instance(instance, args.handle); ++ if (!service) { ++ ret = -EINVAL; ++ break; ++ } ++ ++ if (args.mode == VCHIQ_BULK_MODE_BLOCKING) { ++ waiter = kzalloc(sizeof(struct bulk_waiter_node), ++ GFP_KERNEL); ++ if (!waiter) { ++ ret = -ENOMEM; ++ break; ++ } ++ args.userdata = &waiter->bulk_waiter; ++ } else if (args.mode == VCHIQ_BULK_MODE_WAITING) { ++ struct list_head *pos; ++ mutex_lock(&instance->bulk_waiter_list_mutex); ++ list_for_each(pos, &instance->bulk_waiter_list) { ++ if (list_entry(pos, struct bulk_waiter_node, ++ list)->pid == current->pid) { ++ waiter = list_entry(pos, ++ struct bulk_waiter_node, ++ list); ++ list_del(pos); ++ break; ++ } ++ ++ } ++ mutex_unlock(&instance->bulk_waiter_list_mutex); ++ if (!waiter) { ++ vchiq_log_error(vchiq_arm_log_level, ++ "no bulk_waiter found for pid %d", ++ current->pid); ++ ret = -ESRCH; ++ break; ++ } ++ vchiq_log_info(vchiq_arm_log_level, ++ "found bulk_waiter %x for pid %d", ++ (unsigned int)waiter, current->pid); ++ args.userdata = &waiter->bulk_waiter; ++ } ++ status = vchiq_bulk_transfer ++ (args.handle, ++ VCHI_MEM_HANDLE_INVALID, ++ args.data, args.size, ++ args.userdata, args.mode, ++ dir); ++ if (!waiter) ++ break; ++ if ((status != VCHIQ_RETRY) || fatal_signal_pending(current) || ++ !waiter->bulk_waiter.bulk) { ++ if (waiter->bulk_waiter.bulk) { ++ /* Cancel the signal when the transfer ++ ** completes. */ ++ spin_lock(&bulk_waiter_spinlock); ++ waiter->bulk_waiter.bulk->userdata = NULL; ++ spin_unlock(&bulk_waiter_spinlock); ++ } ++ kfree(waiter); ++ } else { ++ const VCHIQ_BULK_MODE_T mode_waiting = ++ VCHIQ_BULK_MODE_WAITING; ++ waiter->pid = current->pid; ++ mutex_lock(&instance->bulk_waiter_list_mutex); ++ list_add(&waiter->list, &instance->bulk_waiter_list); ++ mutex_unlock(&instance->bulk_waiter_list_mutex); ++ vchiq_log_info(vchiq_arm_log_level, ++ "saved bulk_waiter %x for pid %d", ++ (unsigned int)waiter, current->pid); ++ ++ if (copy_to_user((void __user *) ++ &(((VCHIQ_QUEUE_BULK_TRANSFER_T __user *) ++ arg)->mode), ++ (const void *)&mode_waiting, ++ sizeof(mode_waiting)) != 0) ++ ret = -EFAULT; ++ } ++ } break; ++ ++ case VCHIQ_IOC_AWAIT_COMPLETION: { ++ VCHIQ_AWAIT_COMPLETION_T args; ++ ++ DEBUG_TRACE(AWAIT_COMPLETION_LINE); ++ if (!instance->connected) { ++ ret = -ENOTCONN; ++ break; ++ } ++ ++ if (copy_from_user(&args, (const void __user *)arg, ++ sizeof(args)) != 0) { ++ ret = -EFAULT; ++ break; ++ } ++ ++ mutex_lock(&instance->completion_mutex); ++ ++ DEBUG_TRACE(AWAIT_COMPLETION_LINE); ++ while ((instance->completion_remove == ++ instance->completion_insert) ++ && !instance->closing) { ++ int rc; ++ DEBUG_TRACE(AWAIT_COMPLETION_LINE); ++ mutex_unlock(&instance->completion_mutex); ++ rc = down_interruptible(&instance->insert_event); ++ mutex_lock(&instance->completion_mutex); ++ if (rc != 0) { ++ DEBUG_TRACE(AWAIT_COMPLETION_LINE); ++ vchiq_log_info(vchiq_arm_log_level, ++ "AWAIT_COMPLETION interrupted"); ++ ret = -EINTR; ++ break; ++ } ++ } ++ DEBUG_TRACE(AWAIT_COMPLETION_LINE); ++ ++ /* A read memory barrier is needed to stop prefetch of a stale ++ ** completion record ++ */ ++ rmb(); ++ ++ if (ret == 0) { ++ int msgbufcount = args.msgbufcount; ++ for (ret = 0; ret < args.count; ret++) { ++ VCHIQ_COMPLETION_DATA_T *completion; ++ VCHIQ_SERVICE_T *service; ++ USER_SERVICE_T *user_service; ++ VCHIQ_HEADER_T *header; ++ if (instance->completion_remove == ++ instance->completion_insert) ++ break; ++ completion = &instance->completions[ ++ instance->completion_remove & ++ (MAX_COMPLETIONS - 1)]; ++ ++ service = completion->service_userdata; ++ user_service = service->base.userdata; ++ completion->service_userdata = ++ user_service->userdata; ++ ++ header = completion->header; ++ if (header) { ++ void __user *msgbuf; ++ int msglen; ++ ++ msglen = header->size + ++ sizeof(VCHIQ_HEADER_T); ++ /* This must be a VCHIQ-style service */ ++ if (args.msgbufsize < msglen) { ++ vchiq_log_error( ++ vchiq_arm_log_level, ++ "header %x: msgbufsize" ++ " %x < msglen %x", ++ (unsigned int)header, ++ args.msgbufsize, ++ msglen); ++ WARN(1, "invalid message " ++ "size\n"); ++ if (ret == 0) ++ ret = -EMSGSIZE; ++ break; ++ } ++ if (msgbufcount <= 0) ++ /* Stall here for lack of a ++ ** buffer for the message. */ ++ break; ++ /* Get the pointer from user space */ ++ msgbufcount--; ++ if (copy_from_user(&msgbuf, ++ (const void __user *) ++ &args.msgbufs[msgbufcount], ++ sizeof(msgbuf)) != 0) { ++ if (ret == 0) ++ ret = -EFAULT; ++ break; ++ } ++ ++ /* Copy the message to user space */ ++ if (copy_to_user(msgbuf, header, ++ msglen) != 0) { ++ if (ret == 0) ++ ret = -EFAULT; ++ break; ++ } ++ ++ /* Now it has been copied, the message ++ ** can be released. */ ++ vchiq_release_message(service->handle, ++ header); ++ ++ /* The completion must point to the ++ ** msgbuf. */ ++ completion->header = msgbuf; ++ } ++ ++ if ((completion->reason == ++ VCHIQ_SERVICE_CLOSED) && ++ !instance->use_close_delivered) ++ unlock_service(service); ++ ++ if (copy_to_user((void __user *)( ++ (size_t)args.buf + ++ ret * sizeof(VCHIQ_COMPLETION_DATA_T)), ++ completion, ++ sizeof(VCHIQ_COMPLETION_DATA_T)) != 0) { ++ if (ret == 0) ++ ret = -EFAULT; ++ break; ++ } ++ ++ instance->completion_remove++; ++ } ++ ++ if (msgbufcount != args.msgbufcount) { ++ if (copy_to_user((void __user *) ++ &((VCHIQ_AWAIT_COMPLETION_T *)arg)-> ++ msgbufcount, ++ &msgbufcount, ++ sizeof(msgbufcount)) != 0) { ++ ret = -EFAULT; ++ } ++ } ++ } ++ ++ if (ret != 0) ++ up(&instance->remove_event); ++ mutex_unlock(&instance->completion_mutex); ++ DEBUG_TRACE(AWAIT_COMPLETION_LINE); ++ } break; ++ ++ case VCHIQ_IOC_DEQUEUE_MESSAGE: { ++ VCHIQ_DEQUEUE_MESSAGE_T args; ++ USER_SERVICE_T *user_service; ++ VCHIQ_HEADER_T *header; ++ ++ DEBUG_TRACE(DEQUEUE_MESSAGE_LINE); ++ if (copy_from_user ++ (&args, (const void __user *)arg, ++ sizeof(args)) != 0) { ++ ret = -EFAULT; ++ break; ++ } ++ service = find_service_for_instance(instance, args.handle); ++ if (!service) { ++ ret = -EINVAL; ++ break; ++ } ++ user_service = (USER_SERVICE_T *)service->base.userdata; ++ if (user_service->is_vchi == 0) { ++ ret = -EINVAL; ++ break; ++ } ++ ++ spin_lock(&msg_queue_spinlock); ++ if (user_service->msg_remove == user_service->msg_insert) { ++ if (!args.blocking) { ++ spin_unlock(&msg_queue_spinlock); ++ DEBUG_TRACE(DEQUEUE_MESSAGE_LINE); ++ ret = -EWOULDBLOCK; ++ break; ++ } ++ user_service->dequeue_pending = 1; ++ do { ++ spin_unlock(&msg_queue_spinlock); ++ DEBUG_TRACE(DEQUEUE_MESSAGE_LINE); ++ if (down_interruptible( ++ &user_service->insert_event) != 0) { ++ vchiq_log_info(vchiq_arm_log_level, ++ "DEQUEUE_MESSAGE interrupted"); ++ ret = -EINTR; ++ break; ++ } ++ spin_lock(&msg_queue_spinlock); ++ } while (user_service->msg_remove == ++ user_service->msg_insert); ++ ++ if (ret) ++ break; ++ } ++ ++ BUG_ON((int)(user_service->msg_insert - ++ user_service->msg_remove) < 0); ++ ++ header = user_service->msg_queue[user_service->msg_remove & ++ (MSG_QUEUE_SIZE - 1)]; ++ user_service->msg_remove++; ++ spin_unlock(&msg_queue_spinlock); ++ ++ up(&user_service->remove_event); ++ if (header == NULL) ++ ret = -ENOTCONN; ++ else if (header->size <= args.bufsize) { ++ /* Copy to user space if msgbuf is not NULL */ ++ if ((args.buf == NULL) || ++ (copy_to_user((void __user *)args.buf, ++ header->data, ++ header->size) == 0)) { ++ ret = header->size; ++ vchiq_release_message( ++ service->handle, ++ header); ++ } else ++ ret = -EFAULT; ++ } else { ++ vchiq_log_error(vchiq_arm_log_level, ++ "header %x: bufsize %x < size %x", ++ (unsigned int)header, args.bufsize, ++ header->size); ++ WARN(1, "invalid size\n"); ++ ret = -EMSGSIZE; ++ } ++ DEBUG_TRACE(DEQUEUE_MESSAGE_LINE); ++ } break; ++ ++ case VCHIQ_IOC_GET_CLIENT_ID: { ++ VCHIQ_SERVICE_HANDLE_T handle = (VCHIQ_SERVICE_HANDLE_T)arg; ++ ++ ret = vchiq_get_client_id(handle); ++ } break; ++ ++ case VCHIQ_IOC_GET_CONFIG: { ++ VCHIQ_GET_CONFIG_T args; ++ VCHIQ_CONFIG_T config; ++ ++ if (copy_from_user(&args, (const void __user *)arg, ++ sizeof(args)) != 0) { ++ ret = -EFAULT; ++ break; ++ } ++ if (args.config_size > sizeof(config)) { ++ ret = -EINVAL; ++ break; ++ } ++ status = vchiq_get_config(instance, args.config_size, &config); ++ if (status == VCHIQ_SUCCESS) { ++ if (copy_to_user((void __user *)args.pconfig, ++ &config, args.config_size) != 0) { ++ ret = -EFAULT; ++ break; ++ } ++ } ++ } break; ++ ++ case VCHIQ_IOC_SET_SERVICE_OPTION: { ++ VCHIQ_SET_SERVICE_OPTION_T args; ++ ++ if (copy_from_user( ++ &args, (const void __user *)arg, ++ sizeof(args)) != 0) { ++ ret = -EFAULT; ++ break; ++ } ++ ++ service = find_service_for_instance(instance, args.handle); ++ if (!service) { ++ ret = -EINVAL; ++ break; ++ } ++ ++ status = vchiq_set_service_option( ++ args.handle, args.option, args.value); ++ } break; ++ ++ case VCHIQ_IOC_DUMP_PHYS_MEM: { ++ VCHIQ_DUMP_MEM_T args; ++ ++ if (copy_from_user ++ (&args, (const void __user *)arg, ++ sizeof(args)) != 0) { ++ ret = -EFAULT; ++ break; ++ } ++ dump_phys_mem(args.virt_addr, args.num_bytes); ++ } break; ++ ++ case VCHIQ_IOC_LIB_VERSION: { ++ unsigned int lib_version = (unsigned int)arg; ++ ++ if (lib_version < VCHIQ_VERSION_MIN) ++ ret = -EINVAL; ++ else if (lib_version >= VCHIQ_VERSION_CLOSE_DELIVERED) ++ instance->use_close_delivered = 1; ++ } break; ++ ++ case VCHIQ_IOC_CLOSE_DELIVERED: { ++ VCHIQ_SERVICE_HANDLE_T handle = (VCHIQ_SERVICE_HANDLE_T)arg; ++ ++ service = find_closed_service_for_instance(instance, handle); ++ if (service != NULL) { ++ USER_SERVICE_T *user_service = ++ (USER_SERVICE_T *)service->base.userdata; ++ close_delivered(user_service); ++ } ++ else ++ ret = -EINVAL; ++ } break; ++ ++ default: ++ ret = -ENOTTY; ++ break; ++ } ++ ++ if (service) ++ unlock_service(service); ++ ++ if (ret == 0) { ++ if (status == VCHIQ_ERROR) ++ ret = -EIO; ++ else if (status == VCHIQ_RETRY) ++ ret = -EINTR; ++ } ++ ++ if ((status == VCHIQ_SUCCESS) && (ret < 0) && (ret != -EINTR) && ++ (ret != -EWOULDBLOCK)) ++ vchiq_log_info(vchiq_arm_log_level, ++ " ioctl instance %lx, cmd %s -> status %d, %ld", ++ (unsigned long)instance, ++ (_IOC_NR(cmd) <= VCHIQ_IOC_MAX) ? ++ ioctl_names[_IOC_NR(cmd)] : ++ "<invalid>", ++ status, ret); ++ else ++ vchiq_log_trace(vchiq_arm_log_level, ++ " ioctl instance %lx, cmd %s -> status %d, %ld", ++ (unsigned long)instance, ++ (_IOC_NR(cmd) <= VCHIQ_IOC_MAX) ? ++ ioctl_names[_IOC_NR(cmd)] : ++ "<invalid>", ++ status, ret); ++ ++ return ret; ++} ++ ++/**************************************************************************** ++* ++* vchiq_open ++* ++***************************************************************************/ ++ ++static int ++vchiq_open(struct inode *inode, struct file *file) ++{ ++ int dev = iminor(inode) & 0x0f; ++ vchiq_log_info(vchiq_arm_log_level, "vchiq_open"); ++ switch (dev) { ++ case VCHIQ_MINOR: { ++ int ret; ++ VCHIQ_STATE_T *state = vchiq_get_state(); ++ VCHIQ_INSTANCE_T instance; ++ ++ if (!state) { ++ vchiq_log_error(vchiq_arm_log_level, ++ "vchiq has no connection to VideoCore"); ++ return -ENOTCONN; ++ } ++ ++ instance = kzalloc(sizeof(*instance), GFP_KERNEL); ++ if (!instance) ++ return -ENOMEM; ++ ++ instance->state = state; ++ instance->pid = current->tgid; ++ ++ ret = vchiq_debugfs_add_instance(instance); ++ if (ret != 0) { ++ kfree(instance); ++ return ret; ++ } ++ ++ sema_init(&instance->insert_event, 0); ++ sema_init(&instance->remove_event, 0); ++ mutex_init(&instance->completion_mutex); ++ mutex_init(&instance->bulk_waiter_list_mutex); ++ INIT_LIST_HEAD(&instance->bulk_waiter_list); ++ ++ file->private_data = instance; ++ } break; ++ ++ default: ++ vchiq_log_error(vchiq_arm_log_level, ++ "Unknown minor device: %d", dev); ++ return -ENXIO; ++ } ++ ++ return 0; ++} ++ ++/**************************************************************************** ++* ++* vchiq_release ++* ++***************************************************************************/ ++ ++static int ++vchiq_release(struct inode *inode, struct file *file) ++{ ++ int dev = iminor(inode) & 0x0f; ++ int ret = 0; ++ switch (dev) { ++ case VCHIQ_MINOR: { ++ VCHIQ_INSTANCE_T instance = file->private_data; ++ VCHIQ_STATE_T *state = vchiq_get_state(); ++ VCHIQ_SERVICE_T *service; ++ int i; ++ ++ vchiq_log_info(vchiq_arm_log_level, ++ "vchiq_release: instance=%lx", ++ (unsigned long)instance); ++ ++ if (!state) { ++ ret = -EPERM; ++ goto out; ++ } ++ ++ /* Ensure videocore is awake to allow termination. */ ++ vchiq_use_internal(instance->state, NULL, ++ USE_TYPE_VCHIQ); ++ ++ mutex_lock(&instance->completion_mutex); ++ ++ /* Wake the completion thread and ask it to exit */ ++ instance->closing = 1; ++ up(&instance->insert_event); ++ ++ mutex_unlock(&instance->completion_mutex); ++ ++ /* Wake the slot handler if the completion queue is full. */ ++ up(&instance->remove_event); ++ ++ /* Mark all services for termination... */ ++ i = 0; ++ while ((service = next_service_by_instance(state, instance, ++ &i)) != NULL) { ++ USER_SERVICE_T *user_service = service->base.userdata; ++ ++ /* Wake the slot handler if the msg queue is full. */ ++ up(&user_service->remove_event); ++ ++ vchiq_terminate_service_internal(service); ++ unlock_service(service); ++ } ++ ++ /* ...and wait for them to die */ ++ i = 0; ++ while ((service = next_service_by_instance(state, instance, &i)) ++ != NULL) { ++ USER_SERVICE_T *user_service = service->base.userdata; ++ ++ down(&service->remove_event); ++ ++ BUG_ON(service->srvstate != VCHIQ_SRVSTATE_FREE); ++ ++ spin_lock(&msg_queue_spinlock); ++ ++ while (user_service->msg_remove != ++ user_service->msg_insert) { ++ VCHIQ_HEADER_T *header = user_service-> ++ msg_queue[user_service->msg_remove & ++ (MSG_QUEUE_SIZE - 1)]; ++ user_service->msg_remove++; ++ spin_unlock(&msg_queue_spinlock); ++ ++ if (header) ++ vchiq_release_message( ++ service->handle, ++ header); ++ spin_lock(&msg_queue_spinlock); ++ } ++ ++ spin_unlock(&msg_queue_spinlock); ++ ++ unlock_service(service); ++ } ++ ++ /* Release any closed services */ ++ while (instance->completion_remove != ++ instance->completion_insert) { ++ VCHIQ_COMPLETION_DATA_T *completion; ++ VCHIQ_SERVICE_T *service; ++ completion = &instance->completions[ ++ instance->completion_remove & ++ (MAX_COMPLETIONS - 1)]; ++ service = completion->service_userdata; ++ if (completion->reason == VCHIQ_SERVICE_CLOSED) ++ { ++ USER_SERVICE_T *user_service = ++ service->base.userdata; ++ ++ /* Wake any blocked user-thread */ ++ if (instance->use_close_delivered) ++ up(&user_service->close_event); ++ unlock_service(service); ++ } ++ instance->completion_remove++; ++ } ++ ++ /* Release the PEER service count. */ ++ vchiq_release_internal(instance->state, NULL); ++ ++ { ++ struct list_head *pos, *next; ++ list_for_each_safe(pos, next, ++ &instance->bulk_waiter_list) { ++ struct bulk_waiter_node *waiter; ++ waiter = list_entry(pos, ++ struct bulk_waiter_node, ++ list); ++ list_del(pos); ++ vchiq_log_info(vchiq_arm_log_level, ++ "bulk_waiter - cleaned up %x " ++ "for pid %d", ++ (unsigned int)waiter, waiter->pid); ++ kfree(waiter); ++ } ++ } ++ ++ vchiq_debugfs_remove_instance(instance); ++ ++ kfree(instance); ++ file->private_data = NULL; ++ } break; ++ ++ default: ++ vchiq_log_error(vchiq_arm_log_level, ++ "Unknown minor device: %d", dev); ++ ret = -ENXIO; ++ } ++ ++out: ++ return ret; ++} ++ ++/**************************************************************************** ++* ++* vchiq_dump ++* ++***************************************************************************/ ++ ++void ++vchiq_dump(void *dump_context, const char *str, int len) ++{ ++ DUMP_CONTEXT_T *context = (DUMP_CONTEXT_T *)dump_context; ++ ++ if (context->actual < context->space) { ++ int copy_bytes; ++ if (context->offset > 0) { ++ int skip_bytes = min(len, (int)context->offset); ++ str += skip_bytes; ++ len -= skip_bytes; ++ context->offset -= skip_bytes; ++ if (context->offset > 0) ++ return; ++ } ++ copy_bytes = min(len, (int)(context->space - context->actual)); ++ if (copy_bytes == 0) ++ return; ++ if (copy_to_user(context->buf + context->actual, str, ++ copy_bytes)) ++ context->actual = -EFAULT; ++ context->actual += copy_bytes; ++ len -= copy_bytes; ++ ++ /* If tne terminating NUL is included in the length, then it ++ ** marks the end of a line and should be replaced with a ++ ** carriage return. */ ++ if ((len == 0) && (str[copy_bytes - 1] == '\0')) { ++ char cr = '\n'; ++ if (copy_to_user(context->buf + context->actual - 1, ++ &cr, 1)) ++ context->actual = -EFAULT; ++ } ++ } ++} ++ ++/**************************************************************************** ++* ++* vchiq_dump_platform_instance_state ++* ++***************************************************************************/ ++ ++void ++vchiq_dump_platform_instances(void *dump_context) ++{ ++ VCHIQ_STATE_T *state = vchiq_get_state(); ++ char buf[80]; ++ int len; ++ int i; ++ ++ /* There is no list of instances, so instead scan all services, ++ marking those that have been dumped. */ ++ ++ for (i = 0; i < state->unused_service; i++) { ++ VCHIQ_SERVICE_T *service = state->services[i]; ++ VCHIQ_INSTANCE_T instance; ++ ++ if (service && (service->base.callback == service_callback)) { ++ instance = service->instance; ++ if (instance) ++ instance->mark = 0; ++ } ++ } ++ ++ for (i = 0; i < state->unused_service; i++) { ++ VCHIQ_SERVICE_T *service = state->services[i]; ++ VCHIQ_INSTANCE_T instance; ++ ++ if (service && (service->base.callback == service_callback)) { ++ instance = service->instance; ++ if (instance && !instance->mark) { ++ len = snprintf(buf, sizeof(buf), ++ "Instance %x: pid %d,%s completions " ++ "%d/%d", ++ (unsigned int)instance, instance->pid, ++ instance->connected ? " connected, " : ++ "", ++ instance->completion_insert - ++ instance->completion_remove, ++ MAX_COMPLETIONS); ++ ++ vchiq_dump(dump_context, buf, len + 1); ++ ++ instance->mark = 1; ++ } ++ } ++ } ++} ++ ++/**************************************************************************** ++* ++* vchiq_dump_platform_service_state ++* ++***************************************************************************/ ++ ++void ++vchiq_dump_platform_service_state(void *dump_context, VCHIQ_SERVICE_T *service) ++{ ++ USER_SERVICE_T *user_service = (USER_SERVICE_T *)service->base.userdata; ++ char buf[80]; ++ int len; ++ ++ len = snprintf(buf, sizeof(buf), " instance %x", ++ (unsigned int)service->instance); ++ ++ if ((service->base.callback == service_callback) && ++ user_service->is_vchi) { ++ len += snprintf(buf + len, sizeof(buf) - len, ++ ", %d/%d messages", ++ user_service->msg_insert - user_service->msg_remove, ++ MSG_QUEUE_SIZE); ++ ++ if (user_service->dequeue_pending) ++ len += snprintf(buf + len, sizeof(buf) - len, ++ " (dequeue pending)"); ++ } ++ ++ vchiq_dump(dump_context, buf, len + 1); ++} ++ ++/**************************************************************************** ++* ++* dump_user_mem ++* ++***************************************************************************/ ++ ++static void ++dump_phys_mem(void *virt_addr, uint32_t num_bytes) ++{ ++ int rc; ++ uint8_t *end_virt_addr = virt_addr + num_bytes; ++ int num_pages; ++ int offset; ++ int end_offset; ++ int page_idx; ++ int prev_idx; ++ struct page *page; ++ struct page **pages; ++ uint8_t *kmapped_virt_ptr; ++ ++ /* Align virtAddr and endVirtAddr to 16 byte boundaries. */ ++ ++ virt_addr = (void *)((unsigned long)virt_addr & ~0x0fuL); ++ end_virt_addr = (void *)(((unsigned long)end_virt_addr + 15uL) & ++ ~0x0fuL); ++ ++ offset = (int)(long)virt_addr & (PAGE_SIZE - 1); ++ end_offset = (int)(long)end_virt_addr & (PAGE_SIZE - 1); ++ ++ num_pages = (offset + num_bytes + PAGE_SIZE - 1) / PAGE_SIZE; ++ ++ pages = kmalloc(sizeof(struct page *) * num_pages, GFP_KERNEL); ++ if (pages == NULL) { ++ vchiq_log_error(vchiq_arm_log_level, ++ "Unable to allocation memory for %d pages\n", ++ num_pages); ++ return; ++ } ++ ++ down_read(&current->mm->mmap_sem); ++ rc = get_user_pages( ++ (unsigned long)virt_addr, /* start */ ++ num_pages, /* len */ ++ 0, /* write */ ++ 0, /* force */ ++ pages, /* pages (array of page pointers) */ ++ NULL); /* vmas */ ++ up_read(&current->mm->mmap_sem); ++ ++ prev_idx = -1; ++ page = NULL; ++ ++ while (offset < end_offset) { ++ ++ int page_offset = offset % PAGE_SIZE; ++ page_idx = offset / PAGE_SIZE; ++ ++ if (page_idx != prev_idx) { ++ ++ if (page != NULL) ++ kunmap(page); ++ page = pages[page_idx]; ++ kmapped_virt_ptr = kmap(page); ++ ++ prev_idx = page_idx; ++ } ++ ++ if (vchiq_arm_log_level >= VCHIQ_LOG_TRACE) ++ vchiq_log_dump_mem("ph", ++ (uint32_t)(unsigned long)&kmapped_virt_ptr[ ++ page_offset], ++ &kmapped_virt_ptr[page_offset], 16); ++ ++ offset += 16; ++ } ++ if (page != NULL) ++ kunmap(page); ++ ++ for (page_idx = 0; page_idx < num_pages; page_idx++) ++ put_page(pages[page_idx]); ++ ++ kfree(pages); ++} ++ ++/**************************************************************************** ++* ++* vchiq_read ++* ++***************************************************************************/ ++ ++static ssize_t ++vchiq_read(struct file *file, char __user *buf, ++ size_t count, loff_t *ppos) ++{ ++ DUMP_CONTEXT_T context; ++ context.buf = buf; ++ context.actual = 0; ++ context.space = count; ++ context.offset = *ppos; ++ ++ vchiq_dump_state(&context, &g_state); ++ ++ *ppos += context.actual; ++ ++ return context.actual; ++} ++ ++VCHIQ_STATE_T * ++vchiq_get_state(void) ++{ ++ ++ if (g_state.remote == NULL) ++ printk(KERN_ERR "%s: g_state.remote == NULL\n", __func__); ++ else if (g_state.remote->initialised != 1) ++ printk(KERN_NOTICE "%s: g_state.remote->initialised != 1 (%d)\n", ++ __func__, g_state.remote->initialised); ++ ++ return ((g_state.remote != NULL) && ++ (g_state.remote->initialised == 1)) ? &g_state : NULL; ++} ++ ++static const struct file_operations ++vchiq_fops = { ++ .owner = THIS_MODULE, ++ .unlocked_ioctl = vchiq_ioctl, ++ .open = vchiq_open, ++ .release = vchiq_release, ++ .read = vchiq_read ++}; ++ ++/* ++ * Autosuspend related functionality ++ */ ++ ++int ++vchiq_videocore_wanted(VCHIQ_STATE_T *state) ++{ ++ VCHIQ_ARM_STATE_T *arm_state = vchiq_platform_get_arm_state(state); ++ if (!arm_state) ++ /* autosuspend not supported - always return wanted */ ++ return 1; ++ else if (arm_state->blocked_count) ++ return 1; ++ else if (!arm_state->videocore_use_count) ++ /* usage count zero - check for override unless we're forcing */ ++ if (arm_state->resume_blocked) ++ return 0; ++ else ++ return vchiq_platform_videocore_wanted(state); ++ else ++ /* non-zero usage count - videocore still required */ ++ return 1; ++} ++ ++static VCHIQ_STATUS_T ++vchiq_keepalive_vchiq_callback(VCHIQ_REASON_T reason, ++ VCHIQ_HEADER_T *header, ++ VCHIQ_SERVICE_HANDLE_T service_user, ++ void *bulk_user) ++{ ++ vchiq_log_error(vchiq_susp_log_level, ++ "%s callback reason %d", __func__, reason); ++ return 0; ++} ++ ++static int ++vchiq_keepalive_thread_func(void *v) ++{ ++ VCHIQ_STATE_T *state = (VCHIQ_STATE_T *) v; ++ VCHIQ_ARM_STATE_T *arm_state = vchiq_platform_get_arm_state(state); ++ ++ VCHIQ_STATUS_T status; ++ VCHIQ_INSTANCE_T instance; ++ VCHIQ_SERVICE_HANDLE_T ka_handle; ++ ++ VCHIQ_SERVICE_PARAMS_T params = { ++ .fourcc = VCHIQ_MAKE_FOURCC('K', 'E', 'E', 'P'), ++ .callback = vchiq_keepalive_vchiq_callback, ++ .version = KEEPALIVE_VER, ++ .version_min = KEEPALIVE_VER_MIN ++ }; ++ ++ status = vchiq_initialise(&instance); ++ if (status != VCHIQ_SUCCESS) { ++ vchiq_log_error(vchiq_susp_log_level, ++ "%s vchiq_initialise failed %d", __func__, status); ++ goto exit; ++ } ++ ++ status = vchiq_connect(instance); ++ if (status != VCHIQ_SUCCESS) { ++ vchiq_log_error(vchiq_susp_log_level, ++ "%s vchiq_connect failed %d", __func__, status); ++ goto shutdown; ++ } ++ ++ status = vchiq_add_service(instance, &params, &ka_handle); ++ if (status != VCHIQ_SUCCESS) { ++ vchiq_log_error(vchiq_susp_log_level, ++ "%s vchiq_open_service failed %d", __func__, status); ++ goto shutdown; ++ } ++ ++ while (1) { ++ long rc = 0, uc = 0; ++ if (wait_for_completion_interruptible(&arm_state->ka_evt) ++ != 0) { ++ vchiq_log_error(vchiq_susp_log_level, ++ "%s interrupted", __func__); ++ flush_signals(current); ++ continue; ++ } ++ ++ /* read and clear counters. Do release_count then use_count to ++ * prevent getting more releases than uses */ ++ rc = atomic_xchg(&arm_state->ka_release_count, 0); ++ uc = atomic_xchg(&arm_state->ka_use_count, 0); ++ ++ /* Call use/release service the requisite number of times. ++ * Process use before release so use counts don't go negative */ ++ while (uc--) { ++ atomic_inc(&arm_state->ka_use_ack_count); ++ status = vchiq_use_service(ka_handle); ++ if (status != VCHIQ_SUCCESS) { ++ vchiq_log_error(vchiq_susp_log_level, ++ "%s vchiq_use_service error %d", ++ __func__, status); ++ } ++ } ++ while (rc--) { ++ status = vchiq_release_service(ka_handle); ++ if (status != VCHIQ_SUCCESS) { ++ vchiq_log_error(vchiq_susp_log_level, ++ "%s vchiq_release_service error %d", ++ __func__, status); ++ } ++ } ++ } ++ ++shutdown: ++ vchiq_shutdown(instance); ++exit: ++ return 0; ++} ++ ++ ++ ++VCHIQ_STATUS_T ++vchiq_arm_init_state(VCHIQ_STATE_T *state, VCHIQ_ARM_STATE_T *arm_state) ++{ ++ VCHIQ_STATUS_T status = VCHIQ_SUCCESS; ++ ++ if (arm_state) { ++ rwlock_init(&arm_state->susp_res_lock); ++ ++ init_completion(&arm_state->ka_evt); ++ atomic_set(&arm_state->ka_use_count, 0); ++ atomic_set(&arm_state->ka_use_ack_count, 0); ++ atomic_set(&arm_state->ka_release_count, 0); ++ ++ init_completion(&arm_state->vc_suspend_complete); ++ ++ init_completion(&arm_state->vc_resume_complete); ++ /* Initialise to 'done' state. We only want to block on resume ++ * completion while videocore is suspended. */ ++ set_resume_state(arm_state, VC_RESUME_RESUMED); ++ ++ init_completion(&arm_state->resume_blocker); ++ /* Initialise to 'done' state. We only want to block on this ++ * completion while resume is blocked */ ++ complete_all(&arm_state->resume_blocker); ++ ++ init_completion(&arm_state->blocked_blocker); ++ /* Initialise to 'done' state. We only want to block on this ++ * completion while things are waiting on the resume blocker */ ++ complete_all(&arm_state->blocked_blocker); ++ ++ arm_state->suspend_timer_timeout = SUSPEND_TIMER_TIMEOUT_MS; ++ arm_state->suspend_timer_running = 0; ++ init_timer(&arm_state->suspend_timer); ++ arm_state->suspend_timer.data = (unsigned long)(state); ++ arm_state->suspend_timer.function = suspend_timer_callback; ++ ++ arm_state->first_connect = 0; ++ ++ } ++ return status; ++} ++ ++/* ++** Functions to modify the state variables; ++** set_suspend_state ++** set_resume_state ++** ++** There are more state variables than we might like, so ensure they remain in ++** step. Suspend and resume state are maintained separately, since most of ++** these state machines can operate independently. However, there are a few ++** states where state transitions in one state machine cause a reset to the ++** other state machine. In addition, there are some completion events which ++** need to occur on state machine reset and end-state(s), so these are also ++** dealt with in these functions. ++** ++** In all states we set the state variable according to the input, but in some ++** cases we perform additional steps outlined below; ++** ++** VC_SUSPEND_IDLE - Initialise the suspend completion at the same time. ++** The suspend completion is completed after any suspend ++** attempt. When we reset the state machine we also reset ++** the completion. This reset occurs when videocore is ++** resumed, and also if we initiate suspend after a suspend ++** failure. ++** ++** VC_SUSPEND_IN_PROGRESS - This state is considered the point of no return for ++** suspend - ie from this point on we must try to suspend ++** before resuming can occur. We therefore also reset the ++** resume state machine to VC_RESUME_IDLE in this state. ++** ++** VC_SUSPEND_SUSPENDED - Suspend has completed successfully. Also call ++** complete_all on the suspend completion to notify ++** anything waiting for suspend to happen. ++** ++** VC_SUSPEND_REJECTED - Videocore rejected suspend. Videocore will also ++** initiate resume, so no need to alter resume state. ++** We call complete_all on the suspend completion to notify ++** of suspend rejection. ++** ++** VC_SUSPEND_FAILED - We failed to initiate videocore suspend. We notify the ++** suspend completion and reset the resume state machine. ++** ++** VC_RESUME_IDLE - Initialise the resume completion at the same time. The ++** resume completion is in it's 'done' state whenever ++** videcore is running. Therfore, the VC_RESUME_IDLE state ++** implies that videocore is suspended. ++** Hence, any thread which needs to wait until videocore is ++** running can wait on this completion - it will only block ++** if videocore is suspended. ++** ++** VC_RESUME_RESUMED - Resume has completed successfully. Videocore is running. ++** Call complete_all on the resume completion to unblock ++** any threads waiting for resume. Also reset the suspend ++** state machine to it's idle state. ++** ++** VC_RESUME_FAILED - Currently unused - no mechanism to fail resume exists. ++*/ ++ ++void ++set_suspend_state(VCHIQ_ARM_STATE_T *arm_state, ++ enum vc_suspend_status new_state) ++{ ++ /* set the state in all cases */ ++ arm_state->vc_suspend_state = new_state; ++ ++ /* state specific additional actions */ ++ switch (new_state) { ++ case VC_SUSPEND_FORCE_CANCELED: ++ complete_all(&arm_state->vc_suspend_complete); ++ break; ++ case VC_SUSPEND_REJECTED: ++ complete_all(&arm_state->vc_suspend_complete); ++ break; ++ case VC_SUSPEND_FAILED: ++ complete_all(&arm_state->vc_suspend_complete); ++ arm_state->vc_resume_state = VC_RESUME_RESUMED; ++ complete_all(&arm_state->vc_resume_complete); ++ break; ++ case VC_SUSPEND_IDLE: ++ reinit_completion(&arm_state->vc_suspend_complete); ++ break; ++ case VC_SUSPEND_REQUESTED: ++ break; ++ case VC_SUSPEND_IN_PROGRESS: ++ set_resume_state(arm_state, VC_RESUME_IDLE); ++ break; ++ case VC_SUSPEND_SUSPENDED: ++ complete_all(&arm_state->vc_suspend_complete); ++ break; ++ default: ++ BUG(); ++ break; ++ } ++} ++ ++void ++set_resume_state(VCHIQ_ARM_STATE_T *arm_state, ++ enum vc_resume_status new_state) ++{ ++ /* set the state in all cases */ ++ arm_state->vc_resume_state = new_state; ++ ++ /* state specific additional actions */ ++ switch (new_state) { ++ case VC_RESUME_FAILED: ++ break; ++ case VC_RESUME_IDLE: ++ reinit_completion(&arm_state->vc_resume_complete); ++ break; ++ case VC_RESUME_REQUESTED: ++ break; ++ case VC_RESUME_IN_PROGRESS: ++ break; ++ case VC_RESUME_RESUMED: ++ complete_all(&arm_state->vc_resume_complete); ++ set_suspend_state(arm_state, VC_SUSPEND_IDLE); ++ break; ++ default: ++ BUG(); ++ break; ++ } ++} ++ ++ ++/* should be called with the write lock held */ ++inline void ++start_suspend_timer(VCHIQ_ARM_STATE_T *arm_state) ++{ ++ del_timer(&arm_state->suspend_timer); ++ arm_state->suspend_timer.expires = jiffies + ++ msecs_to_jiffies(arm_state-> ++ suspend_timer_timeout); ++ add_timer(&arm_state->suspend_timer); ++ arm_state->suspend_timer_running = 1; ++} ++ ++/* should be called with the write lock held */ ++static inline void ++stop_suspend_timer(VCHIQ_ARM_STATE_T *arm_state) ++{ ++ if (arm_state->suspend_timer_running) { ++ del_timer(&arm_state->suspend_timer); ++ arm_state->suspend_timer_running = 0; ++ } ++} ++ ++static inline int ++need_resume(VCHIQ_STATE_T *state) ++{ ++ VCHIQ_ARM_STATE_T *arm_state = vchiq_platform_get_arm_state(state); ++ return (arm_state->vc_suspend_state > VC_SUSPEND_IDLE) && ++ (arm_state->vc_resume_state < VC_RESUME_REQUESTED) && ++ vchiq_videocore_wanted(state); ++} ++ ++static int ++block_resume(VCHIQ_ARM_STATE_T *arm_state) ++{ ++ int status = VCHIQ_SUCCESS; ++ const unsigned long timeout_val = ++ msecs_to_jiffies(FORCE_SUSPEND_TIMEOUT_MS); ++ int resume_count = 0; ++ ++ /* Allow any threads which were blocked by the last force suspend to ++ * complete if they haven't already. Only give this one shot; if ++ * blocked_count is incremented after blocked_blocker is completed ++ * (which only happens when blocked_count hits 0) then those threads ++ * will have to wait until next time around */ ++ if (arm_state->blocked_count) { ++ reinit_completion(&arm_state->blocked_blocker); ++ write_unlock_bh(&arm_state->susp_res_lock); ++ vchiq_log_info(vchiq_susp_log_level, "%s wait for previously " ++ "blocked clients", __func__); ++ if (wait_for_completion_interruptible_timeout( ++ &arm_state->blocked_blocker, timeout_val) ++ <= 0) { ++ vchiq_log_error(vchiq_susp_log_level, "%s wait for " ++ "previously blocked clients failed" , __func__); ++ status = VCHIQ_ERROR; ++ write_lock_bh(&arm_state->susp_res_lock); ++ goto out; ++ } ++ vchiq_log_info(vchiq_susp_log_level, "%s previously blocked " ++ "clients resumed", __func__); ++ write_lock_bh(&arm_state->susp_res_lock); ++ } ++ ++ /* We need to wait for resume to complete if it's in process */ ++ while (arm_state->vc_resume_state != VC_RESUME_RESUMED && ++ arm_state->vc_resume_state > VC_RESUME_IDLE) { ++ if (resume_count > 1) { ++ status = VCHIQ_ERROR; ++ vchiq_log_error(vchiq_susp_log_level, "%s waited too " ++ "many times for resume" , __func__); ++ goto out; ++ } ++ write_unlock_bh(&arm_state->susp_res_lock); ++ vchiq_log_info(vchiq_susp_log_level, "%s wait for resume", ++ __func__); ++ if (wait_for_completion_interruptible_timeout( ++ &arm_state->vc_resume_complete, timeout_val) ++ <= 0) { ++ vchiq_log_error(vchiq_susp_log_level, "%s wait for " ++ "resume failed (%s)", __func__, ++ resume_state_names[arm_state->vc_resume_state + ++ VC_RESUME_NUM_OFFSET]); ++ status = VCHIQ_ERROR; ++ write_lock_bh(&arm_state->susp_res_lock); ++ goto out; ++ } ++ vchiq_log_info(vchiq_susp_log_level, "%s resumed", __func__); ++ write_lock_bh(&arm_state->susp_res_lock); ++ resume_count++; ++ } ++ reinit_completion(&arm_state->resume_blocker); ++ arm_state->resume_blocked = 1; ++ ++out: ++ return status; ++} ++ ++static inline void ++unblock_resume(VCHIQ_ARM_STATE_T *arm_state) ++{ ++ complete_all(&arm_state->resume_blocker); ++ arm_state->resume_blocked = 0; ++} ++ ++/* Initiate suspend via slot handler. Should be called with the write lock ++ * held */ ++VCHIQ_STATUS_T ++vchiq_arm_vcsuspend(VCHIQ_STATE_T *state) ++{ ++ VCHIQ_STATUS_T status = VCHIQ_ERROR; ++ VCHIQ_ARM_STATE_T *arm_state = vchiq_platform_get_arm_state(state); ++ ++ if (!arm_state) ++ goto out; ++ ++ vchiq_log_trace(vchiq_susp_log_level, "%s", __func__); ++ status = VCHIQ_SUCCESS; ++ ++ ++ switch (arm_state->vc_suspend_state) { ++ case VC_SUSPEND_REQUESTED: ++ vchiq_log_info(vchiq_susp_log_level, "%s: suspend already " ++ "requested", __func__); ++ break; ++ case VC_SUSPEND_IN_PROGRESS: ++ vchiq_log_info(vchiq_susp_log_level, "%s: suspend already in " ++ "progress", __func__); ++ break; ++ ++ default: ++ /* We don't expect to be in other states, so log but continue ++ * anyway */ ++ vchiq_log_error(vchiq_susp_log_level, ++ "%s unexpected suspend state %s", __func__, ++ suspend_state_names[arm_state->vc_suspend_state + ++ VC_SUSPEND_NUM_OFFSET]); ++ /* fall through */ ++ case VC_SUSPEND_REJECTED: ++ case VC_SUSPEND_FAILED: ++ /* Ensure any idle state actions have been run */ ++ set_suspend_state(arm_state, VC_SUSPEND_IDLE); ++ /* fall through */ ++ case VC_SUSPEND_IDLE: ++ vchiq_log_info(vchiq_susp_log_level, ++ "%s: suspending", __func__); ++ set_suspend_state(arm_state, VC_SUSPEND_REQUESTED); ++ /* kick the slot handler thread to initiate suspend */ ++ request_poll(state, NULL, 0); ++ break; ++ } ++ ++out: ++ vchiq_log_trace(vchiq_susp_log_level, "%s exit %d", __func__, status); ++ return status; ++} ++ ++void ++vchiq_platform_check_suspend(VCHIQ_STATE_T *state) ++{ ++ VCHIQ_ARM_STATE_T *arm_state = vchiq_platform_get_arm_state(state); ++ int susp = 0; ++ ++ if (!arm_state) ++ goto out; ++ ++ vchiq_log_trace(vchiq_susp_log_level, "%s", __func__); ++ ++ write_lock_bh(&arm_state->susp_res_lock); ++ if (arm_state->vc_suspend_state == VC_SUSPEND_REQUESTED && ++ arm_state->vc_resume_state == VC_RESUME_RESUMED) { ++ set_suspend_state(arm_state, VC_SUSPEND_IN_PROGRESS); ++ susp = 1; ++ } ++ write_unlock_bh(&arm_state->susp_res_lock); ++ ++ if (susp) ++ vchiq_platform_suspend(state); ++ ++out: ++ vchiq_log_trace(vchiq_susp_log_level, "%s exit", __func__); ++ return; ++} ++ ++ ++static void ++output_timeout_error(VCHIQ_STATE_T *state) ++{ ++ VCHIQ_ARM_STATE_T *arm_state = vchiq_platform_get_arm_state(state); ++ char service_err[50] = ""; ++ int vc_use_count = arm_state->videocore_use_count; ++ int active_services = state->unused_service; ++ int i; ++ ++ if (!arm_state->videocore_use_count) { ++ snprintf(service_err, 50, " Videocore usecount is 0"); ++ goto output_msg; ++ } ++ for (i = 0; i < active_services; i++) { ++ VCHIQ_SERVICE_T *service_ptr = state->services[i]; ++ if (service_ptr && service_ptr->service_use_count && ++ (service_ptr->srvstate != VCHIQ_SRVSTATE_FREE)) { ++ snprintf(service_err, 50, " %c%c%c%c(%d) service has " ++ "use count %d%s", VCHIQ_FOURCC_AS_4CHARS( ++ service_ptr->base.fourcc), ++ service_ptr->client_id, ++ service_ptr->service_use_count, ++ service_ptr->service_use_count == ++ vc_use_count ? "" : " (+ more)"); ++ break; ++ } ++ } ++ ++output_msg: ++ vchiq_log_error(vchiq_susp_log_level, ++ "timed out waiting for vc suspend (%d).%s", ++ arm_state->autosuspend_override, service_err); ++ ++} ++ ++/* Try to get videocore into suspended state, regardless of autosuspend state. ++** We don't actually force suspend, since videocore may get into a bad state ++** if we force suspend at a bad time. Instead, we wait for autosuspend to ++** determine a good point to suspend. If this doesn't happen within 100ms we ++** report failure. ++** ++** Returns VCHIQ_SUCCESS if videocore suspended successfully, VCHIQ_RETRY if ++** videocore failed to suspend in time or VCHIQ_ERROR if interrupted. ++*/ ++VCHIQ_STATUS_T ++vchiq_arm_force_suspend(VCHIQ_STATE_T *state) ++{ ++ VCHIQ_ARM_STATE_T *arm_state = vchiq_platform_get_arm_state(state); ++ VCHIQ_STATUS_T status = VCHIQ_ERROR; ++ long rc = 0; ++ int repeat = -1; ++ ++ if (!arm_state) ++ goto out; ++ ++ vchiq_log_trace(vchiq_susp_log_level, "%s", __func__); ++ ++ write_lock_bh(&arm_state->susp_res_lock); ++ ++ status = block_resume(arm_state); ++ if (status != VCHIQ_SUCCESS) ++ goto unlock; ++ if (arm_state->vc_suspend_state == VC_SUSPEND_SUSPENDED) { ++ /* Already suspended - just block resume and exit */ ++ vchiq_log_info(vchiq_susp_log_level, "%s already suspended", ++ __func__); ++ status = VCHIQ_SUCCESS; ++ goto unlock; ++ } else if (arm_state->vc_suspend_state <= VC_SUSPEND_IDLE) { ++ /* initiate suspend immediately in the case that we're waiting ++ * for the timeout */ ++ stop_suspend_timer(arm_state); ++ if (!vchiq_videocore_wanted(state)) { ++ vchiq_log_info(vchiq_susp_log_level, "%s videocore " ++ "idle, initiating suspend", __func__); ++ status = vchiq_arm_vcsuspend(state); ++ } else if (arm_state->autosuspend_override < ++ FORCE_SUSPEND_FAIL_MAX) { ++ vchiq_log_info(vchiq_susp_log_level, "%s letting " ++ "videocore go idle", __func__); ++ status = VCHIQ_SUCCESS; ++ } else { ++ vchiq_log_warning(vchiq_susp_log_level, "%s failed too " ++ "many times - attempting suspend", __func__); ++ status = vchiq_arm_vcsuspend(state); ++ } ++ } else { ++ vchiq_log_info(vchiq_susp_log_level, "%s videocore suspend " ++ "in progress - wait for completion", __func__); ++ status = VCHIQ_SUCCESS; ++ } ++ ++ /* Wait for suspend to happen due to system idle (not forced..) */ ++ if (status != VCHIQ_SUCCESS) ++ goto unblock_resume; ++ ++ do { ++ write_unlock_bh(&arm_state->susp_res_lock); ++ ++ rc = wait_for_completion_interruptible_timeout( ++ &arm_state->vc_suspend_complete, ++ msecs_to_jiffies(FORCE_SUSPEND_TIMEOUT_MS)); ++ ++ write_lock_bh(&arm_state->susp_res_lock); ++ if (rc < 0) { ++ vchiq_log_warning(vchiq_susp_log_level, "%s " ++ "interrupted waiting for suspend", __func__); ++ status = VCHIQ_ERROR; ++ goto unblock_resume; ++ } else if (rc == 0) { ++ if (arm_state->vc_suspend_state > VC_SUSPEND_IDLE) { ++ /* Repeat timeout once if in progress */ ++ if (repeat < 0) { ++ repeat = 1; ++ continue; ++ } ++ } ++ arm_state->autosuspend_override++; ++ output_timeout_error(state); ++ ++ status = VCHIQ_RETRY; ++ goto unblock_resume; ++ } ++ } while (0 < (repeat--)); ++ ++ /* Check and report state in case we need to abort ARM suspend */ ++ if (arm_state->vc_suspend_state != VC_SUSPEND_SUSPENDED) { ++ status = VCHIQ_RETRY; ++ vchiq_log_error(vchiq_susp_log_level, ++ "%s videocore suspend failed (state %s)", __func__, ++ suspend_state_names[arm_state->vc_suspend_state + ++ VC_SUSPEND_NUM_OFFSET]); ++ /* Reset the state only if it's still in an error state. ++ * Something could have already initiated another suspend. */ ++ if (arm_state->vc_suspend_state < VC_SUSPEND_IDLE) ++ set_suspend_state(arm_state, VC_SUSPEND_IDLE); ++ ++ goto unblock_resume; ++ } ++ ++ /* successfully suspended - unlock and exit */ ++ goto unlock; ++ ++unblock_resume: ++ /* all error states need to unblock resume before exit */ ++ unblock_resume(arm_state); ++ ++unlock: ++ write_unlock_bh(&arm_state->susp_res_lock); ++ ++out: ++ vchiq_log_trace(vchiq_susp_log_level, "%s exit %d", __func__, status); ++ return status; ++} ++ ++void ++vchiq_check_suspend(VCHIQ_STATE_T *state) ++{ ++ VCHIQ_ARM_STATE_T *arm_state = vchiq_platform_get_arm_state(state); ++ ++ if (!arm_state) ++ goto out; ++ ++ vchiq_log_trace(vchiq_susp_log_level, "%s", __func__); ++ ++ write_lock_bh(&arm_state->susp_res_lock); ++ if (arm_state->vc_suspend_state != VC_SUSPEND_SUSPENDED && ++ arm_state->first_connect && ++ !vchiq_videocore_wanted(state)) { ++ vchiq_arm_vcsuspend(state); ++ } ++ write_unlock_bh(&arm_state->susp_res_lock); ++ ++out: ++ vchiq_log_trace(vchiq_susp_log_level, "%s exit", __func__); ++ return; ++} ++ ++ ++int ++vchiq_arm_allow_resume(VCHIQ_STATE_T *state) ++{ ++ VCHIQ_ARM_STATE_T *arm_state = vchiq_platform_get_arm_state(state); ++ int resume = 0; ++ int ret = -1; ++ ++ if (!arm_state) ++ goto out; ++ ++ vchiq_log_trace(vchiq_susp_log_level, "%s", __func__); ++ ++ write_lock_bh(&arm_state->susp_res_lock); ++ unblock_resume(arm_state); ++ resume = vchiq_check_resume(state); ++ write_unlock_bh(&arm_state->susp_res_lock); ++ ++ if (resume) { ++ if (wait_for_completion_interruptible( ++ &arm_state->vc_resume_complete) < 0) { ++ vchiq_log_error(vchiq_susp_log_level, ++ "%s interrupted", __func__); ++ /* failed, cannot accurately derive suspend ++ * state, so exit early. */ ++ goto out; ++ } ++ } ++ ++ read_lock_bh(&arm_state->susp_res_lock); ++ if (arm_state->vc_suspend_state == VC_SUSPEND_SUSPENDED) { ++ vchiq_log_info(vchiq_susp_log_level, ++ "%s: Videocore remains suspended", __func__); ++ } else { ++ vchiq_log_info(vchiq_susp_log_level, ++ "%s: Videocore resumed", __func__); ++ ret = 0; ++ } ++ read_unlock_bh(&arm_state->susp_res_lock); ++out: ++ vchiq_log_trace(vchiq_susp_log_level, "%s exit %d", __func__, ret); ++ return ret; ++} ++ ++/* This function should be called with the write lock held */ ++int ++vchiq_check_resume(VCHIQ_STATE_T *state) ++{ ++ VCHIQ_ARM_STATE_T *arm_state = vchiq_platform_get_arm_state(state); ++ int resume = 0; ++ ++ if (!arm_state) ++ goto out; ++ ++ vchiq_log_trace(vchiq_susp_log_level, "%s", __func__); ++ ++ if (need_resume(state)) { ++ set_resume_state(arm_state, VC_RESUME_REQUESTED); ++ request_poll(state, NULL, 0); ++ resume = 1; ++ } ++ ++out: ++ vchiq_log_trace(vchiq_susp_log_level, "%s exit", __func__); ++ return resume; ++} ++ ++void ++vchiq_platform_check_resume(VCHIQ_STATE_T *state) ++{ ++ VCHIQ_ARM_STATE_T *arm_state = vchiq_platform_get_arm_state(state); ++ int res = 0; ++ ++ if (!arm_state) ++ goto out; ++ ++ vchiq_log_trace(vchiq_susp_log_level, "%s", __func__); ++ ++ write_lock_bh(&arm_state->susp_res_lock); ++ if (arm_state->wake_address == 0) { ++ vchiq_log_info(vchiq_susp_log_level, ++ "%s: already awake", __func__); ++ goto unlock; ++ } ++ if (arm_state->vc_resume_state == VC_RESUME_IN_PROGRESS) { ++ vchiq_log_info(vchiq_susp_log_level, ++ "%s: already resuming", __func__); ++ goto unlock; ++ } ++ ++ if (arm_state->vc_resume_state == VC_RESUME_REQUESTED) { ++ set_resume_state(arm_state, VC_RESUME_IN_PROGRESS); ++ res = 1; ++ } else ++ vchiq_log_trace(vchiq_susp_log_level, ++ "%s: not resuming (resume state %s)", __func__, ++ resume_state_names[arm_state->vc_resume_state + ++ VC_RESUME_NUM_OFFSET]); ++ ++unlock: ++ write_unlock_bh(&arm_state->susp_res_lock); ++ ++ if (res) ++ vchiq_platform_resume(state); ++ ++out: ++ vchiq_log_trace(vchiq_susp_log_level, "%s exit", __func__); ++ return; ++ ++} ++ ++ ++ ++VCHIQ_STATUS_T ++vchiq_use_internal(VCHIQ_STATE_T *state, VCHIQ_SERVICE_T *service, ++ enum USE_TYPE_E use_type) ++{ ++ VCHIQ_ARM_STATE_T *arm_state = vchiq_platform_get_arm_state(state); ++ VCHIQ_STATUS_T ret = VCHIQ_SUCCESS; ++ char entity[16]; ++ int *entity_uc; ++ int local_uc, local_entity_uc; ++ ++ if (!arm_state) ++ goto out; ++ ++ vchiq_log_trace(vchiq_susp_log_level, "%s", __func__); ++ ++ if (use_type == USE_TYPE_VCHIQ) { ++ sprintf(entity, "VCHIQ: "); ++ entity_uc = &arm_state->peer_use_count; ++ } else if (service) { ++ sprintf(entity, "%c%c%c%c:%03d", ++ VCHIQ_FOURCC_AS_4CHARS(service->base.fourcc), ++ service->client_id); ++ entity_uc = &service->service_use_count; ++ } else { ++ vchiq_log_error(vchiq_susp_log_level, "%s null service " ++ "ptr", __func__); ++ ret = VCHIQ_ERROR; ++ goto out; ++ } ++ ++ write_lock_bh(&arm_state->susp_res_lock); ++ while (arm_state->resume_blocked) { ++ /* If we call 'use' while force suspend is waiting for suspend, ++ * then we're about to block the thread which the force is ++ * waiting to complete, so we're bound to just time out. In this ++ * case, set the suspend state such that the wait will be ++ * canceled, so we can complete as quickly as possible. */ ++ if (arm_state->resume_blocked && arm_state->vc_suspend_state == ++ VC_SUSPEND_IDLE) { ++ set_suspend_state(arm_state, VC_SUSPEND_FORCE_CANCELED); ++ break; ++ } ++ /* If suspend is already in progress then we need to block */ ++ if (!try_wait_for_completion(&arm_state->resume_blocker)) { ++ /* Indicate that there are threads waiting on the resume ++ * blocker. These need to be allowed to complete before ++ * a _second_ call to force suspend can complete, ++ * otherwise low priority threads might never actually ++ * continue */ ++ arm_state->blocked_count++; ++ write_unlock_bh(&arm_state->susp_res_lock); ++ vchiq_log_info(vchiq_susp_log_level, "%s %s resume " ++ "blocked - waiting...", __func__, entity); ++ if (wait_for_completion_killable( ++ &arm_state->resume_blocker) != 0) { ++ vchiq_log_error(vchiq_susp_log_level, "%s %s " ++ "wait for resume blocker interrupted", ++ __func__, entity); ++ ret = VCHIQ_ERROR; ++ write_lock_bh(&arm_state->susp_res_lock); ++ arm_state->blocked_count--; ++ write_unlock_bh(&arm_state->susp_res_lock); ++ goto out; ++ } ++ vchiq_log_info(vchiq_susp_log_level, "%s %s resume " ++ "unblocked", __func__, entity); ++ write_lock_bh(&arm_state->susp_res_lock); ++ if (--arm_state->blocked_count == 0) ++ complete_all(&arm_state->blocked_blocker); ++ } ++ } ++ ++ stop_suspend_timer(arm_state); ++ ++ local_uc = ++arm_state->videocore_use_count; ++ local_entity_uc = ++(*entity_uc); ++ ++ /* If there's a pending request which hasn't yet been serviced then ++ * just clear it. If we're past VC_SUSPEND_REQUESTED state then ++ * vc_resume_complete will block until we either resume or fail to ++ * suspend */ ++ if (arm_state->vc_suspend_state <= VC_SUSPEND_REQUESTED) ++ set_suspend_state(arm_state, VC_SUSPEND_IDLE); ++ ++ if ((use_type != USE_TYPE_SERVICE_NO_RESUME) && need_resume(state)) { ++ set_resume_state(arm_state, VC_RESUME_REQUESTED); ++ vchiq_log_info(vchiq_susp_log_level, ++ "%s %s count %d, state count %d", ++ __func__, entity, local_entity_uc, local_uc); ++ request_poll(state, NULL, 0); ++ } else ++ vchiq_log_trace(vchiq_susp_log_level, ++ "%s %s count %d, state count %d", ++ __func__, entity, *entity_uc, local_uc); ++ ++ ++ write_unlock_bh(&arm_state->susp_res_lock); ++ ++ /* Completion is in a done state when we're not suspended, so this won't ++ * block for the non-suspended case. */ ++ if (!try_wait_for_completion(&arm_state->vc_resume_complete)) { ++ vchiq_log_info(vchiq_susp_log_level, "%s %s wait for resume", ++ __func__, entity); ++ if (wait_for_completion_killable( ++ &arm_state->vc_resume_complete) != 0) { ++ vchiq_log_error(vchiq_susp_log_level, "%s %s wait for " ++ "resume interrupted", __func__, entity); ++ ret = VCHIQ_ERROR; ++ goto out; ++ } ++ vchiq_log_info(vchiq_susp_log_level, "%s %s resumed", __func__, ++ entity); ++ } ++ ++ if (ret == VCHIQ_SUCCESS) { ++ VCHIQ_STATUS_T status = VCHIQ_SUCCESS; ++ long ack_cnt = atomic_xchg(&arm_state->ka_use_ack_count, 0); ++ while (ack_cnt && (status == VCHIQ_SUCCESS)) { ++ /* Send the use notify to videocore */ ++ status = vchiq_send_remote_use_active(state); ++ if (status == VCHIQ_SUCCESS) ++ ack_cnt--; ++ else ++ atomic_add(ack_cnt, ++ &arm_state->ka_use_ack_count); ++ } ++ } ++ ++out: ++ vchiq_log_trace(vchiq_susp_log_level, "%s exit %d", __func__, ret); ++ return ret; ++} ++ ++VCHIQ_STATUS_T ++vchiq_release_internal(VCHIQ_STATE_T *state, VCHIQ_SERVICE_T *service) ++{ ++ VCHIQ_ARM_STATE_T *arm_state = vchiq_platform_get_arm_state(state); ++ VCHIQ_STATUS_T ret = VCHIQ_SUCCESS; ++ char entity[16]; ++ int *entity_uc; ++ int local_uc, local_entity_uc; ++ ++ if (!arm_state) ++ goto out; ++ ++ vchiq_log_trace(vchiq_susp_log_level, "%s", __func__); ++ ++ if (service) { ++ sprintf(entity, "%c%c%c%c:%03d", ++ VCHIQ_FOURCC_AS_4CHARS(service->base.fourcc), ++ service->client_id); ++ entity_uc = &service->service_use_count; ++ } else { ++ sprintf(entity, "PEER: "); ++ entity_uc = &arm_state->peer_use_count; ++ } ++ ++ write_lock_bh(&arm_state->susp_res_lock); ++ if (!arm_state->videocore_use_count || !(*entity_uc)) { ++ /* Don't use BUG_ON - don't allow user thread to crash kernel */ ++ WARN_ON(!arm_state->videocore_use_count); ++ WARN_ON(!(*entity_uc)); ++ ret = VCHIQ_ERROR; ++ goto unlock; ++ } ++ local_uc = --arm_state->videocore_use_count; ++ local_entity_uc = --(*entity_uc); ++ ++ if (!vchiq_videocore_wanted(state)) { ++ if (vchiq_platform_use_suspend_timer() && ++ !arm_state->resume_blocked) { ++ /* Only use the timer if we're not trying to force ++ * suspend (=> resume_blocked) */ ++ start_suspend_timer(arm_state); ++ } else { ++ vchiq_log_info(vchiq_susp_log_level, ++ "%s %s count %d, state count %d - suspending", ++ __func__, entity, *entity_uc, ++ arm_state->videocore_use_count); ++ vchiq_arm_vcsuspend(state); ++ } ++ } else ++ vchiq_log_trace(vchiq_susp_log_level, ++ "%s %s count %d, state count %d", ++ __func__, entity, *entity_uc, ++ arm_state->videocore_use_count); ++ ++unlock: ++ write_unlock_bh(&arm_state->susp_res_lock); ++ ++out: ++ vchiq_log_trace(vchiq_susp_log_level, "%s exit %d", __func__, ret); ++ return ret; ++} ++ ++void ++vchiq_on_remote_use(VCHIQ_STATE_T *state) ++{ ++ VCHIQ_ARM_STATE_T *arm_state = vchiq_platform_get_arm_state(state); ++ vchiq_log_trace(vchiq_susp_log_level, "%s", __func__); ++ atomic_inc(&arm_state->ka_use_count); ++ complete(&arm_state->ka_evt); ++} ++ ++void ++vchiq_on_remote_release(VCHIQ_STATE_T *state) ++{ ++ VCHIQ_ARM_STATE_T *arm_state = vchiq_platform_get_arm_state(state); ++ vchiq_log_trace(vchiq_susp_log_level, "%s", __func__); ++ atomic_inc(&arm_state->ka_release_count); ++ complete(&arm_state->ka_evt); ++} ++ ++VCHIQ_STATUS_T ++vchiq_use_service_internal(VCHIQ_SERVICE_T *service) ++{ ++ return vchiq_use_internal(service->state, service, USE_TYPE_SERVICE); ++} ++ ++VCHIQ_STATUS_T ++vchiq_release_service_internal(VCHIQ_SERVICE_T *service) ++{ ++ return vchiq_release_internal(service->state, service); ++} ++ ++VCHIQ_DEBUGFS_NODE_T * ++vchiq_instance_get_debugfs_node(VCHIQ_INSTANCE_T instance) ++{ ++ return &instance->debugfs_node; ++} ++ ++int ++vchiq_instance_get_use_count(VCHIQ_INSTANCE_T instance) ++{ ++ VCHIQ_SERVICE_T *service; ++ int use_count = 0, i; ++ i = 0; ++ while ((service = next_service_by_instance(instance->state, ++ instance, &i)) != NULL) { ++ use_count += service->service_use_count; ++ unlock_service(service); ++ } ++ return use_count; ++} ++ ++int ++vchiq_instance_get_pid(VCHIQ_INSTANCE_T instance) ++{ ++ return instance->pid; ++} ++ ++int ++vchiq_instance_get_trace(VCHIQ_INSTANCE_T instance) ++{ ++ return instance->trace; ++} ++ ++void ++vchiq_instance_set_trace(VCHIQ_INSTANCE_T instance, int trace) ++{ ++ VCHIQ_SERVICE_T *service; ++ int i; ++ i = 0; ++ while ((service = next_service_by_instance(instance->state, ++ instance, &i)) != NULL) { ++ service->trace = trace; ++ unlock_service(service); ++ } ++ instance->trace = (trace != 0); ++} ++ ++static void suspend_timer_callback(unsigned long context) ++{ ++ VCHIQ_STATE_T *state = (VCHIQ_STATE_T *)context; ++ VCHIQ_ARM_STATE_T *arm_state = vchiq_platform_get_arm_state(state); ++ if (!arm_state) ++ goto out; ++ vchiq_log_info(vchiq_susp_log_level, ++ "%s - suspend timer expired - check suspend", __func__); ++ vchiq_check_suspend(state); ++out: ++ return; ++} ++ ++VCHIQ_STATUS_T ++vchiq_use_service_no_resume(VCHIQ_SERVICE_HANDLE_T handle) ++{ ++ VCHIQ_STATUS_T ret = VCHIQ_ERROR; ++ VCHIQ_SERVICE_T *service = find_service_by_handle(handle); ++ if (service) { ++ ret = vchiq_use_internal(service->state, service, ++ USE_TYPE_SERVICE_NO_RESUME); ++ unlock_service(service); ++ } ++ return ret; ++} ++ ++VCHIQ_STATUS_T ++vchiq_use_service(VCHIQ_SERVICE_HANDLE_T handle) ++{ ++ VCHIQ_STATUS_T ret = VCHIQ_ERROR; ++ VCHIQ_SERVICE_T *service = find_service_by_handle(handle); ++ if (service) { ++ ret = vchiq_use_internal(service->state, service, ++ USE_TYPE_SERVICE); ++ unlock_service(service); ++ } ++ return ret; ++} ++ ++VCHIQ_STATUS_T ++vchiq_release_service(VCHIQ_SERVICE_HANDLE_T handle) ++{ ++ VCHIQ_STATUS_T ret = VCHIQ_ERROR; ++ VCHIQ_SERVICE_T *service = find_service_by_handle(handle); ++ if (service) { ++ ret = vchiq_release_internal(service->state, service); ++ unlock_service(service); ++ } ++ return ret; ++} ++ ++void ++vchiq_dump_service_use_state(VCHIQ_STATE_T *state) ++{ ++ VCHIQ_ARM_STATE_T *arm_state = vchiq_platform_get_arm_state(state); ++ int i, j = 0; ++ /* Only dump 64 services */ ++ static const int local_max_services = 64; ++ /* If there's more than 64 services, only dump ones with ++ * non-zero counts */ ++ int only_nonzero = 0; ++ static const char *nz = "<-- preventing suspend"; ++ ++ enum vc_suspend_status vc_suspend_state; ++ enum vc_resume_status vc_resume_state; ++ int peer_count; ++ int vc_use_count; ++ int active_services; ++ struct service_data_struct { ++ int fourcc; ++ int clientid; ++ int use_count; ++ } service_data[local_max_services]; ++ ++ if (!arm_state) ++ return; ++ ++ read_lock_bh(&arm_state->susp_res_lock); ++ vc_suspend_state = arm_state->vc_suspend_state; ++ vc_resume_state = arm_state->vc_resume_state; ++ peer_count = arm_state->peer_use_count; ++ vc_use_count = arm_state->videocore_use_count; ++ active_services = state->unused_service; ++ if (active_services > local_max_services) ++ only_nonzero = 1; ++ ++ for (i = 0; (i < active_services) && (j < local_max_services); i++) { ++ VCHIQ_SERVICE_T *service_ptr = state->services[i]; ++ if (!service_ptr) ++ continue; ++ ++ if (only_nonzero && !service_ptr->service_use_count) ++ continue; ++ ++ if (service_ptr->srvstate != VCHIQ_SRVSTATE_FREE) { ++ service_data[j].fourcc = service_ptr->base.fourcc; ++ service_data[j].clientid = service_ptr->client_id; ++ service_data[j++].use_count = service_ptr-> ++ service_use_count; ++ } ++ } ++ ++ read_unlock_bh(&arm_state->susp_res_lock); ++ ++ vchiq_log_warning(vchiq_susp_log_level, ++ "-- Videcore suspend state: %s --", ++ suspend_state_names[vc_suspend_state + VC_SUSPEND_NUM_OFFSET]); ++ vchiq_log_warning(vchiq_susp_log_level, ++ "-- Videcore resume state: %s --", ++ resume_state_names[vc_resume_state + VC_RESUME_NUM_OFFSET]); ++ ++ if (only_nonzero) ++ vchiq_log_warning(vchiq_susp_log_level, "Too many active " ++ "services (%d). Only dumping up to first %d services " ++ "with non-zero use-count", active_services, ++ local_max_services); ++ ++ for (i = 0; i < j; i++) { ++ vchiq_log_warning(vchiq_susp_log_level, ++ "----- %c%c%c%c:%d service count %d %s", ++ VCHIQ_FOURCC_AS_4CHARS(service_data[i].fourcc), ++ service_data[i].clientid, ++ service_data[i].use_count, ++ service_data[i].use_count ? nz : ""); ++ } ++ vchiq_log_warning(vchiq_susp_log_level, ++ "----- VCHIQ use count count %d", peer_count); ++ vchiq_log_warning(vchiq_susp_log_level, ++ "--- Overall vchiq instance use count %d", vc_use_count); ++ ++ vchiq_dump_platform_use_state(state); ++} ++ ++VCHIQ_STATUS_T ++vchiq_check_service(VCHIQ_SERVICE_T *service) ++{ ++ VCHIQ_ARM_STATE_T *arm_state; ++ VCHIQ_STATUS_T ret = VCHIQ_ERROR; ++ ++ if (!service || !service->state) ++ goto out; ++ ++ vchiq_log_trace(vchiq_susp_log_level, "%s", __func__); ++ ++ arm_state = vchiq_platform_get_arm_state(service->state); ++ ++ read_lock_bh(&arm_state->susp_res_lock); ++ if (service->service_use_count) ++ ret = VCHIQ_SUCCESS; ++ read_unlock_bh(&arm_state->susp_res_lock); ++ ++ if (ret == VCHIQ_ERROR) { ++ vchiq_log_error(vchiq_susp_log_level, ++ "%s ERROR - %c%c%c%c:%d service count %d, " ++ "state count %d, videocore suspend state %s", __func__, ++ VCHIQ_FOURCC_AS_4CHARS(service->base.fourcc), ++ service->client_id, service->service_use_count, ++ arm_state->videocore_use_count, ++ suspend_state_names[arm_state->vc_suspend_state + ++ VC_SUSPEND_NUM_OFFSET]); ++ vchiq_dump_service_use_state(service->state); ++ } ++out: ++ return ret; ++} ++ ++/* stub functions */ ++void vchiq_on_remote_use_active(VCHIQ_STATE_T *state) ++{ ++ (void)state; ++} ++ ++void vchiq_platform_conn_state_changed(VCHIQ_STATE_T *state, ++ VCHIQ_CONNSTATE_T oldstate, VCHIQ_CONNSTATE_T newstate) ++{ ++ VCHIQ_ARM_STATE_T *arm_state = vchiq_platform_get_arm_state(state); ++ vchiq_log_info(vchiq_susp_log_level, "%d: %s->%s", state->id, ++ get_conn_state_name(oldstate), get_conn_state_name(newstate)); ++ if (state->conn_state == VCHIQ_CONNSTATE_CONNECTED) { ++ write_lock_bh(&arm_state->susp_res_lock); ++ if (!arm_state->first_connect) { ++ char threadname[10]; ++ arm_state->first_connect = 1; ++ write_unlock_bh(&arm_state->susp_res_lock); ++ snprintf(threadname, sizeof(threadname), "VCHIQka-%d", ++ state->id); ++ arm_state->ka_thread = kthread_create( ++ &vchiq_keepalive_thread_func, ++ (void *)state, ++ threadname); ++ if (arm_state->ka_thread == NULL) { ++ vchiq_log_error(vchiq_susp_log_level, ++ "vchiq: FATAL: couldn't create thread %s", ++ threadname); ++ } else { ++ wake_up_process(arm_state->ka_thread); ++ } ++ } else ++ write_unlock_bh(&arm_state->susp_res_lock); ++ } ++} ++ ++static int vchiq_probe(struct platform_device *pdev) ++{ ++ struct device_node *fw_node; ++ struct rpi_firmware *fw; ++ int err; ++ void *ptr_err; ++ ++ fw_node = of_parse_phandle(pdev->dev.of_node, "firmware", 0); ++/* Remove comment when booting without Device Tree is no longer supported ++ if (!fw_node) { ++ dev_err(&pdev->dev, "Missing firmware node\n"); ++ return -ENOENT; ++ } ++*/ ++ fw = rpi_firmware_get(fw_node); ++ if (!fw) ++ return -EPROBE_DEFER; ++ ++ platform_set_drvdata(pdev, fw); ++ ++ /* create debugfs entries */ ++ err = vchiq_debugfs_init(); ++ if (err != 0) ++ goto failed_debugfs_init; ++ ++ err = alloc_chrdev_region(&vchiq_devid, VCHIQ_MINOR, 1, DEVICE_NAME); ++ if (err != 0) { ++ vchiq_log_error(vchiq_arm_log_level, ++ "Unable to allocate device number"); ++ goto failed_alloc_chrdev; ++ } ++ cdev_init(&vchiq_cdev, &vchiq_fops); ++ vchiq_cdev.owner = THIS_MODULE; ++ err = cdev_add(&vchiq_cdev, vchiq_devid, 1); ++ if (err != 0) { ++ vchiq_log_error(vchiq_arm_log_level, ++ "Unable to register device"); ++ goto failed_cdev_add; ++ } ++ ++ /* create sysfs entries */ ++ vchiq_class = class_create(THIS_MODULE, DEVICE_NAME); ++ ptr_err = vchiq_class; ++ if (IS_ERR(ptr_err)) ++ goto failed_class_create; ++ ++ vchiq_dev = device_create(vchiq_class, NULL, ++ vchiq_devid, NULL, "vchiq"); ++ ptr_err = vchiq_dev; ++ if (IS_ERR(ptr_err)) ++ goto failed_device_create; ++ ++ err = vchiq_platform_init(pdev, &g_state); ++ if (err != 0) ++ goto failed_platform_init; ++ ++ vchiq_log_info(vchiq_arm_log_level, ++ "vchiq: initialised - version %d (min %d), device %d.%d", ++ VCHIQ_VERSION, VCHIQ_VERSION_MIN, ++ MAJOR(vchiq_devid), MINOR(vchiq_devid)); ++ ++ return 0; ++ ++failed_platform_init: ++ device_destroy(vchiq_class, vchiq_devid); ++failed_device_create: ++ class_destroy(vchiq_class); ++failed_class_create: ++ cdev_del(&vchiq_cdev); ++ err = PTR_ERR(ptr_err); ++failed_cdev_add: ++ unregister_chrdev_region(vchiq_devid, 1); ++failed_alloc_chrdev: ++ vchiq_debugfs_deinit(); ++failed_debugfs_init: ++ vchiq_log_warning(vchiq_arm_log_level, "could not load vchiq"); ++ return err; ++} ++ ++static int vchiq_remove(struct platform_device *pdev) ++{ ++ device_destroy(vchiq_class, vchiq_devid); ++ class_destroy(vchiq_class); ++ cdev_del(&vchiq_cdev); ++ unregister_chrdev_region(vchiq_devid, 1); ++ ++ return 0; ++} ++ ++static const struct of_device_id vchiq_of_match[] = { ++ { .compatible = "brcm,bcm2835-vchiq", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, vchiq_of_match); ++ ++static struct platform_driver vchiq_driver = { ++ .driver = { ++ .name = "bcm2835_vchiq", ++ .owner = THIS_MODULE, ++ .of_match_table = vchiq_of_match, ++ }, ++ .probe = vchiq_probe, ++ .remove = vchiq_remove, ++}; ++module_platform_driver(vchiq_driver); ++ ++MODULE_LICENSE("GPL"); ++MODULE_AUTHOR("Broadcom Corporation"); +diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm.h b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm.h +new file mode 100644 +index 0000000..9740e1a +--- /dev/null ++++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm.h +@@ -0,0 +1,220 @@ ++/** ++ * Copyright (c) 2014 Raspberry Pi (Trading) Ltd. All rights reserved. ++ * Copyright (c) 2010-2012 Broadcom. 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, ++ * without modification. ++ * 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. ++ * 3. The names of the above-listed copyright holders may not be used ++ * to endorse or promote products derived from this software without ++ * specific prior written permission. ++ * ++ * ALTERNATIVELY, this software may be distributed under the terms of the ++ * GNU General Public License ("GPL") version 2, as published by the Free ++ * Software Foundation. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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. ++ */ ++ ++#ifndef VCHIQ_ARM_H ++#define VCHIQ_ARM_H ++ ++#include <linux/mutex.h> ++#include <linux/platform_device.h> ++#include <linux/semaphore.h> ++#include <linux/atomic.h> ++#include "vchiq_core.h" ++#include "vchiq_debugfs.h" ++ ++ ++enum vc_suspend_status { ++ VC_SUSPEND_FORCE_CANCELED = -3, /* Force suspend canceled, too busy */ ++ VC_SUSPEND_REJECTED = -2, /* Videocore rejected suspend request */ ++ VC_SUSPEND_FAILED = -1, /* Videocore suspend failed */ ++ VC_SUSPEND_IDLE = 0, /* VC active, no suspend actions */ ++ VC_SUSPEND_REQUESTED, /* User has requested suspend */ ++ VC_SUSPEND_IN_PROGRESS, /* Slot handler has recvd suspend request */ ++ VC_SUSPEND_SUSPENDED /* Videocore suspend succeeded */ ++}; ++ ++enum vc_resume_status { ++ VC_RESUME_FAILED = -1, /* Videocore resume failed */ ++ VC_RESUME_IDLE = 0, /* VC suspended, no resume actions */ ++ VC_RESUME_REQUESTED, /* User has requested resume */ ++ VC_RESUME_IN_PROGRESS, /* Slot handler has received resume request */ ++ VC_RESUME_RESUMED /* Videocore resumed successfully (active) */ ++}; ++ ++ ++enum USE_TYPE_E { ++ USE_TYPE_SERVICE, ++ USE_TYPE_SERVICE_NO_RESUME, ++ USE_TYPE_VCHIQ ++}; ++ ++ ++ ++typedef struct vchiq_arm_state_struct { ++ /* Keepalive-related data */ ++ struct task_struct *ka_thread; ++ struct completion ka_evt; ++ atomic_t ka_use_count; ++ atomic_t ka_use_ack_count; ++ atomic_t ka_release_count; ++ ++ struct completion vc_suspend_complete; ++ struct completion vc_resume_complete; ++ ++ rwlock_t susp_res_lock; ++ enum vc_suspend_status vc_suspend_state; ++ enum vc_resume_status vc_resume_state; ++ ++ unsigned int wake_address; ++ ++ struct timer_list suspend_timer; ++ int suspend_timer_timeout; ++ int suspend_timer_running; ++ ++ /* Global use count for videocore. ++ ** This is equal to the sum of the use counts for all services. When ++ ** this hits zero the videocore suspend procedure will be initiated. ++ */ ++ int videocore_use_count; ++ ++ /* Use count to track requests from videocore peer. ++ ** This use count is not associated with a service, so needs to be ++ ** tracked separately with the state. ++ */ ++ int peer_use_count; ++ ++ /* Flag to indicate whether resume is blocked. This happens when the ++ ** ARM is suspending ++ */ ++ struct completion resume_blocker; ++ int resume_blocked; ++ struct completion blocked_blocker; ++ int blocked_count; ++ ++ int autosuspend_override; ++ ++ /* Flag to indicate that the first vchiq connect has made it through. ++ ** This means that both sides should be fully ready, and we should ++ ** be able to suspend after this point. ++ */ ++ int first_connect; ++ ++ unsigned long long suspend_start_time; ++ unsigned long long sleep_start_time; ++ unsigned long long resume_start_time; ++ unsigned long long last_wake_time; ++ ++} VCHIQ_ARM_STATE_T; ++ ++extern int vchiq_arm_log_level; ++extern int vchiq_susp_log_level; ++ ++int vchiq_platform_init(struct platform_device *pdev, VCHIQ_STATE_T *state); ++ ++extern VCHIQ_STATE_T * ++vchiq_get_state(void); ++ ++extern VCHIQ_STATUS_T ++vchiq_arm_vcsuspend(VCHIQ_STATE_T *state); ++ ++extern VCHIQ_STATUS_T ++vchiq_arm_force_suspend(VCHIQ_STATE_T *state); ++ ++extern int ++vchiq_arm_allow_resume(VCHIQ_STATE_T *state); ++ ++extern VCHIQ_STATUS_T ++vchiq_arm_vcresume(VCHIQ_STATE_T *state); ++ ++extern VCHIQ_STATUS_T ++vchiq_arm_init_state(VCHIQ_STATE_T *state, VCHIQ_ARM_STATE_T *arm_state); ++ ++extern int ++vchiq_check_resume(VCHIQ_STATE_T *state); ++ ++extern void ++vchiq_check_suspend(VCHIQ_STATE_T *state); ++ VCHIQ_STATUS_T ++vchiq_use_service(VCHIQ_SERVICE_HANDLE_T handle); ++ ++extern VCHIQ_STATUS_T ++vchiq_release_service(VCHIQ_SERVICE_HANDLE_T handle); ++ ++extern VCHIQ_STATUS_T ++vchiq_check_service(VCHIQ_SERVICE_T *service); ++ ++extern VCHIQ_STATUS_T ++vchiq_platform_suspend(VCHIQ_STATE_T *state); ++ ++extern int ++vchiq_platform_videocore_wanted(VCHIQ_STATE_T *state); ++ ++extern int ++vchiq_platform_use_suspend_timer(void); ++ ++extern void ++vchiq_dump_platform_use_state(VCHIQ_STATE_T *state); ++ ++extern void ++vchiq_dump_service_use_state(VCHIQ_STATE_T *state); ++ ++extern VCHIQ_ARM_STATE_T* ++vchiq_platform_get_arm_state(VCHIQ_STATE_T *state); ++ ++extern int ++vchiq_videocore_wanted(VCHIQ_STATE_T *state); ++ ++extern VCHIQ_STATUS_T ++vchiq_use_internal(VCHIQ_STATE_T *state, VCHIQ_SERVICE_T *service, ++ enum USE_TYPE_E use_type); ++extern VCHIQ_STATUS_T ++vchiq_release_internal(VCHIQ_STATE_T *state, VCHIQ_SERVICE_T *service); ++ ++extern VCHIQ_DEBUGFS_NODE_T * ++vchiq_instance_get_debugfs_node(VCHIQ_INSTANCE_T instance); ++ ++extern int ++vchiq_instance_get_use_count(VCHIQ_INSTANCE_T instance); ++ ++extern int ++vchiq_instance_get_pid(VCHIQ_INSTANCE_T instance); ++ ++extern int ++vchiq_instance_get_trace(VCHIQ_INSTANCE_T instance); ++ ++extern void ++vchiq_instance_set_trace(VCHIQ_INSTANCE_T instance, int trace); ++ ++extern void ++set_suspend_state(VCHIQ_ARM_STATE_T *arm_state, ++ enum vc_suspend_status new_state); ++ ++extern void ++set_resume_state(VCHIQ_ARM_STATE_T *arm_state, ++ enum vc_resume_status new_state); ++ ++extern void ++start_suspend_timer(VCHIQ_ARM_STATE_T *arm_state); ++ ++ ++#endif /* VCHIQ_ARM_H */ +diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_build_info.h b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_build_info.h +new file mode 100644 +index 0000000..df64581 +--- /dev/null ++++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_build_info.h +@@ -0,0 +1,37 @@ ++/** ++ * Copyright (c) 2010-2012 Broadcom. 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, ++ * without modification. ++ * 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. ++ * 3. The names of the above-listed copyright holders may not be used ++ * to endorse or promote products derived from this software without ++ * specific prior written permission. ++ * ++ * ALTERNATIVELY, this software may be distributed under the terms of the ++ * GNU General Public License ("GPL") version 2, as published by the Free ++ * Software Foundation. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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. ++ */ ++ ++const char *vchiq_get_build_hostname(void); ++const char *vchiq_get_build_version(void); ++const char *vchiq_get_build_time(void); ++const char *vchiq_get_build_date(void); +diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_cfg.h b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_cfg.h +new file mode 100644 +index 0000000..d2797db +--- /dev/null ++++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_cfg.h +@@ -0,0 +1,69 @@ ++/** ++ * Copyright (c) 2010-2014 Broadcom. 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, ++ * without modification. ++ * 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. ++ * 3. The names of the above-listed copyright holders may not be used ++ * to endorse or promote products derived from this software without ++ * specific prior written permission. ++ * ++ * ALTERNATIVELY, this software may be distributed under the terms of the ++ * GNU General Public License ("GPL") version 2, as published by the Free ++ * Software Foundation. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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. ++ */ ++ ++#ifndef VCHIQ_CFG_H ++#define VCHIQ_CFG_H ++ ++#define VCHIQ_MAGIC VCHIQ_MAKE_FOURCC('V', 'C', 'H', 'I') ++/* The version of VCHIQ - change with any non-trivial change */ ++#define VCHIQ_VERSION 8 ++/* The minimum compatible version - update to match VCHIQ_VERSION with any ++** incompatible change */ ++#define VCHIQ_VERSION_MIN 3 ++ ++/* The version that introduced the VCHIQ_IOC_LIB_VERSION ioctl */ ++#define VCHIQ_VERSION_LIB_VERSION 7 ++ ++/* The version that introduced the VCHIQ_IOC_CLOSE_DELIVERED ioctl */ ++#define VCHIQ_VERSION_CLOSE_DELIVERED 7 ++ ++/* The version that made it safe to use SYNCHRONOUS mode */ ++#define VCHIQ_VERSION_SYNCHRONOUS_MODE 8 ++ ++#define VCHIQ_MAX_STATES 1 ++#define VCHIQ_MAX_SERVICES 4096 ++#define VCHIQ_MAX_SLOTS 128 ++#define VCHIQ_MAX_SLOTS_PER_SIDE 64 ++ ++#define VCHIQ_NUM_CURRENT_BULKS 32 ++#define VCHIQ_NUM_SERVICE_BULKS 4 ++ ++#ifndef VCHIQ_ENABLE_DEBUG ++#define VCHIQ_ENABLE_DEBUG 1 ++#endif ++ ++#ifndef VCHIQ_ENABLE_STATS ++#define VCHIQ_ENABLE_STATS 1 ++#endif ++ ++#endif /* VCHIQ_CFG_H */ +diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_connected.c b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_connected.c +new file mode 100644 +index 0000000..5efc62f +--- /dev/null ++++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_connected.c +@@ -0,0 +1,120 @@ ++/** ++ * Copyright (c) 2010-2012 Broadcom. 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, ++ * without modification. ++ * 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. ++ * 3. The names of the above-listed copyright holders may not be used ++ * to endorse or promote products derived from this software without ++ * specific prior written permission. ++ * ++ * ALTERNATIVELY, this software may be distributed under the terms of the ++ * GNU General Public License ("GPL") version 2, as published by the Free ++ * Software Foundation. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER OR ++ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ++ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, ++ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR ++ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF ++ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING ++ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ */ ++ ++#include "vchiq_connected.h" ++#include "vchiq_core.h" ++#include "vchiq_killable.h" ++#include <linux/module.h> ++#include <linux/mutex.h> ++ ++#define MAX_CALLBACKS 10 ++ ++static int g_connected; ++static int g_num_deferred_callbacks; ++static VCHIQ_CONNECTED_CALLBACK_T g_deferred_callback[MAX_CALLBACKS]; ++static int g_once_init; ++static struct mutex g_connected_mutex; ++ ++/**************************************************************************** ++* ++* Function to initialize our lock. ++* ++***************************************************************************/ ++ ++static void connected_init(void) ++{ ++ if (!g_once_init) { ++ mutex_init(&g_connected_mutex); ++ g_once_init = 1; ++ } ++} ++ ++/**************************************************************************** ++* ++* This function is used to defer initialization until the vchiq stack is ++* initialized. If the stack is already initialized, then the callback will ++* be made immediately, otherwise it will be deferred until ++* vchiq_call_connected_callbacks is called. ++* ++***************************************************************************/ ++ ++void vchiq_add_connected_callback(VCHIQ_CONNECTED_CALLBACK_T callback) ++{ ++ connected_init(); ++ ++ if (mutex_lock_interruptible(&g_connected_mutex) != 0) ++ return; ++ ++ if (g_connected) ++ /* We're already connected. Call the callback immediately. */ ++ ++ callback(); ++ else { ++ if (g_num_deferred_callbacks >= MAX_CALLBACKS) ++ vchiq_log_error(vchiq_core_log_level, ++ "There already %d callback registered - " ++ "please increase MAX_CALLBACKS", ++ g_num_deferred_callbacks); ++ else { ++ g_deferred_callback[g_num_deferred_callbacks] = ++ callback; ++ g_num_deferred_callbacks++; ++ } ++ } ++ mutex_unlock(&g_connected_mutex); ++} ++ ++/**************************************************************************** ++* ++* This function is called by the vchiq stack once it has been connected to ++* the videocore and clients can start to use the stack. ++* ++***************************************************************************/ ++ ++void vchiq_call_connected_callbacks(void) ++{ ++ int i; ++ ++ connected_init(); ++ ++ if (mutex_lock_interruptible(&g_connected_mutex) != 0) ++ return; ++ ++ for (i = 0; i < g_num_deferred_callbacks; i++) ++ g_deferred_callback[i](); ++ ++ g_num_deferred_callbacks = 0; ++ g_connected = 1; ++ mutex_unlock(&g_connected_mutex); ++} ++EXPORT_SYMBOL(vchiq_add_connected_callback); +diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_connected.h b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_connected.h +new file mode 100644 +index 0000000..863b3e3 +--- /dev/null ++++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_connected.h +@@ -0,0 +1,50 @@ ++/** ++ * Copyright (c) 2010-2012 Broadcom. 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, ++ * without modification. ++ * 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. ++ * 3. The names of the above-listed copyright holders may not be used ++ * to endorse or promote products derived from this software without ++ * specific prior written permission. ++ * ++ * ALTERNATIVELY, this software may be distributed under the terms of the ++ * GNU General Public License ("GPL") version 2, as published by the Free ++ * Software Foundation. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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. ++ */ ++ ++#ifndef VCHIQ_CONNECTED_H ++#define VCHIQ_CONNECTED_H ++ ++/* ---- Include Files ----------------------------------------------------- */ ++ ++/* ---- Constants and Types ---------------------------------------------- */ ++ ++typedef void (*VCHIQ_CONNECTED_CALLBACK_T)(void); ++ ++/* ---- Variable Externs ------------------------------------------------- */ ++ ++/* ---- Function Prototypes ---------------------------------------------- */ ++ ++void vchiq_add_connected_callback(VCHIQ_CONNECTED_CALLBACK_T callback); ++void vchiq_call_connected_callbacks(void); ++ ++#endif /* VCHIQ_CONNECTED_H */ +diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_core.c b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_core.c +new file mode 100644 +index 0000000..160db24 +--- /dev/null ++++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_core.c +@@ -0,0 +1,3929 @@ ++/** ++ * Copyright (c) 2010-2012 Broadcom. 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, ++ * without modification. ++ * 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. ++ * 3. The names of the above-listed copyright holders may not be used ++ * to endorse or promote products derived from this software without ++ * specific prior written permission. ++ * ++ * ALTERNATIVELY, this software may be distributed under the terms of the ++ * GNU General Public License ("GPL") version 2, as published by the Free ++ * Software Foundation. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER OR ++ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ++ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, ++ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR ++ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF ++ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING ++ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ */ ++ ++#include "vchiq_core.h" ++#include "vchiq_killable.h" ++ ++#define VCHIQ_SLOT_HANDLER_STACK 8192 ++ ++#define HANDLE_STATE_SHIFT 12 ++ ++#define SLOT_INFO_FROM_INDEX(state, index) (state->slot_info + (index)) ++#define SLOT_DATA_FROM_INDEX(state, index) (state->slot_data + (index)) ++#define SLOT_INDEX_FROM_DATA(state, data) \ ++ (((unsigned int)((char *)data - (char *)state->slot_data)) / \ ++ VCHIQ_SLOT_SIZE) ++#define SLOT_INDEX_FROM_INFO(state, info) \ ++ ((unsigned int)(info - state->slot_info)) ++#define SLOT_QUEUE_INDEX_FROM_POS(pos) \ ++ ((int)((unsigned int)(pos) / VCHIQ_SLOT_SIZE)) ++ ++#define BULK_INDEX(x) (x & (VCHIQ_NUM_SERVICE_BULKS - 1)) ++ ++#define SRVTRACE_LEVEL(srv) \ ++ (((srv) && (srv)->trace) ? VCHIQ_LOG_TRACE : vchiq_core_msg_log_level) ++#define SRVTRACE_ENABLED(srv, lev) \ ++ (((srv) && (srv)->trace) || (vchiq_core_msg_log_level >= (lev))) ++ ++struct vchiq_open_payload { ++ int fourcc; ++ int client_id; ++ short version; ++ short version_min; ++}; ++ ++struct vchiq_openack_payload { ++ short version; ++}; ++ ++enum ++{ ++ QMFLAGS_IS_BLOCKING = (1 << 0), ++ QMFLAGS_NO_MUTEX_LOCK = (1 << 1), ++ QMFLAGS_NO_MUTEX_UNLOCK = (1 << 2) ++}; ++ ++/* we require this for consistency between endpoints */ ++vchiq_static_assert(sizeof(VCHIQ_HEADER_T) == 8); ++vchiq_static_assert(IS_POW2(sizeof(VCHIQ_HEADER_T))); ++vchiq_static_assert(IS_POW2(VCHIQ_NUM_CURRENT_BULKS)); ++vchiq_static_assert(IS_POW2(VCHIQ_NUM_SERVICE_BULKS)); ++vchiq_static_assert(IS_POW2(VCHIQ_MAX_SERVICES)); ++vchiq_static_assert(VCHIQ_VERSION >= VCHIQ_VERSION_MIN); ++ ++/* Run time control of log level, based on KERN_XXX level. */ ++int vchiq_core_log_level = VCHIQ_LOG_DEFAULT; ++int vchiq_core_msg_log_level = VCHIQ_LOG_DEFAULT; ++int vchiq_sync_log_level = VCHIQ_LOG_DEFAULT; ++ ++static atomic_t pause_bulks_count = ATOMIC_INIT(0); ++ ++static DEFINE_SPINLOCK(service_spinlock); ++DEFINE_SPINLOCK(bulk_waiter_spinlock); ++DEFINE_SPINLOCK(quota_spinlock); ++ ++VCHIQ_STATE_T *vchiq_states[VCHIQ_MAX_STATES]; ++static unsigned int handle_seq; ++ ++static const char *const srvstate_names[] = { ++ "FREE", ++ "HIDDEN", ++ "LISTENING", ++ "OPENING", ++ "OPEN", ++ "OPENSYNC", ++ "CLOSESENT", ++ "CLOSERECVD", ++ "CLOSEWAIT", ++ "CLOSED" ++}; ++ ++static const char *const reason_names[] = { ++ "SERVICE_OPENED", ++ "SERVICE_CLOSED", ++ "MESSAGE_AVAILABLE", ++ "BULK_TRANSMIT_DONE", ++ "BULK_RECEIVE_DONE", ++ "BULK_TRANSMIT_ABORTED", ++ "BULK_RECEIVE_ABORTED" ++}; ++ ++static const char *const conn_state_names[] = { ++ "DISCONNECTED", ++ "CONNECTING", ++ "CONNECTED", ++ "PAUSING", ++ "PAUSE_SENT", ++ "PAUSED", ++ "RESUMING", ++ "PAUSE_TIMEOUT", ++ "RESUME_TIMEOUT" ++}; ++ ++ ++static void ++release_message_sync(VCHIQ_STATE_T *state, VCHIQ_HEADER_T *header); ++ ++static const char *msg_type_str(unsigned int msg_type) ++{ ++ switch (msg_type) { ++ case VCHIQ_MSG_PADDING: return "PADDING"; ++ case VCHIQ_MSG_CONNECT: return "CONNECT"; ++ case VCHIQ_MSG_OPEN: return "OPEN"; ++ case VCHIQ_MSG_OPENACK: return "OPENACK"; ++ case VCHIQ_MSG_CLOSE: return "CLOSE"; ++ case VCHIQ_MSG_DATA: return "DATA"; ++ case VCHIQ_MSG_BULK_RX: return "BULK_RX"; ++ case VCHIQ_MSG_BULK_TX: return "BULK_TX"; ++ case VCHIQ_MSG_BULK_RX_DONE: return "BULK_RX_DONE"; ++ case VCHIQ_MSG_BULK_TX_DONE: return "BULK_TX_DONE"; ++ case VCHIQ_MSG_PAUSE: return "PAUSE"; ++ case VCHIQ_MSG_RESUME: return "RESUME"; ++ case VCHIQ_MSG_REMOTE_USE: return "REMOTE_USE"; ++ case VCHIQ_MSG_REMOTE_RELEASE: return "REMOTE_RELEASE"; ++ case VCHIQ_MSG_REMOTE_USE_ACTIVE: return "REMOTE_USE_ACTIVE"; ++ } ++ return "???"; ++} ++ ++static inline void ++vchiq_set_service_state(VCHIQ_SERVICE_T *service, int newstate) ++{ ++ vchiq_log_info(vchiq_core_log_level, "%d: srv:%d %s->%s", ++ service->state->id, service->localport, ++ srvstate_names[service->srvstate], ++ srvstate_names[newstate]); ++ service->srvstate = newstate; ++} ++ ++VCHIQ_SERVICE_T * ++find_service_by_handle(VCHIQ_SERVICE_HANDLE_T handle) ++{ ++ VCHIQ_SERVICE_T *service; ++ ++ spin_lock(&service_spinlock); ++ service = handle_to_service(handle); ++ if (service && (service->srvstate != VCHIQ_SRVSTATE_FREE) && ++ (service->handle == handle)) { ++ BUG_ON(service->ref_count == 0); ++ service->ref_count++; ++ } else ++ service = NULL; ++ spin_unlock(&service_spinlock); ++ ++ if (!service) ++ vchiq_log_info(vchiq_core_log_level, ++ "Invalid service handle 0x%x", handle); ++ ++ return service; ++} ++ ++VCHIQ_SERVICE_T * ++find_service_by_port(VCHIQ_STATE_T *state, int localport) ++{ ++ VCHIQ_SERVICE_T *service = NULL; ++ if ((unsigned int)localport <= VCHIQ_PORT_MAX) { ++ spin_lock(&service_spinlock); ++ service = state->services[localport]; ++ if (service && (service->srvstate != VCHIQ_SRVSTATE_FREE)) { ++ BUG_ON(service->ref_count == 0); ++ service->ref_count++; ++ } else ++ service = NULL; ++ spin_unlock(&service_spinlock); ++ } ++ ++ if (!service) ++ vchiq_log_info(vchiq_core_log_level, ++ "Invalid port %d", localport); ++ ++ return service; ++} ++ ++VCHIQ_SERVICE_T * ++find_service_for_instance(VCHIQ_INSTANCE_T instance, ++ VCHIQ_SERVICE_HANDLE_T handle) { ++ VCHIQ_SERVICE_T *service; ++ ++ spin_lock(&service_spinlock); ++ service = handle_to_service(handle); ++ if (service && (service->srvstate != VCHIQ_SRVSTATE_FREE) && ++ (service->handle == handle) && ++ (service->instance == instance)) { ++ BUG_ON(service->ref_count == 0); ++ service->ref_count++; ++ } else ++ service = NULL; ++ spin_unlock(&service_spinlock); ++ ++ if (!service) ++ vchiq_log_info(vchiq_core_log_level, ++ "Invalid service handle 0x%x", handle); ++ ++ return service; ++} ++ ++VCHIQ_SERVICE_T * ++find_closed_service_for_instance(VCHIQ_INSTANCE_T instance, ++ VCHIQ_SERVICE_HANDLE_T handle) { ++ VCHIQ_SERVICE_T *service; ++ ++ spin_lock(&service_spinlock); ++ service = handle_to_service(handle); ++ if (service && ++ ((service->srvstate == VCHIQ_SRVSTATE_FREE) || ++ (service->srvstate == VCHIQ_SRVSTATE_CLOSED)) && ++ (service->handle == handle) && ++ (service->instance == instance)) { ++ BUG_ON(service->ref_count == 0); ++ service->ref_count++; ++ } else ++ service = NULL; ++ spin_unlock(&service_spinlock); ++ ++ if (!service) ++ vchiq_log_info(vchiq_core_log_level, ++ "Invalid service handle 0x%x", handle); ++ ++ return service; ++} ++ ++VCHIQ_SERVICE_T * ++next_service_by_instance(VCHIQ_STATE_T *state, VCHIQ_INSTANCE_T instance, ++ int *pidx) ++{ ++ VCHIQ_SERVICE_T *service = NULL; ++ int idx = *pidx; ++ ++ spin_lock(&service_spinlock); ++ while (idx < state->unused_service) { ++ VCHIQ_SERVICE_T *srv = state->services[idx++]; ++ if (srv && (srv->srvstate != VCHIQ_SRVSTATE_FREE) && ++ (srv->instance == instance)) { ++ service = srv; ++ BUG_ON(service->ref_count == 0); ++ service->ref_count++; ++ break; ++ } ++ } ++ spin_unlock(&service_spinlock); ++ ++ *pidx = idx; ++ ++ return service; ++} ++ ++void ++lock_service(VCHIQ_SERVICE_T *service) ++{ ++ spin_lock(&service_spinlock); ++ BUG_ON(!service || (service->ref_count == 0)); ++ if (service) ++ service->ref_count++; ++ spin_unlock(&service_spinlock); ++} ++ ++void ++unlock_service(VCHIQ_SERVICE_T *service) ++{ ++ VCHIQ_STATE_T *state = service->state; ++ spin_lock(&service_spinlock); ++ BUG_ON(!service || (service->ref_count == 0)); ++ if (service && service->ref_count) { ++ service->ref_count--; ++ if (!service->ref_count) { ++ BUG_ON(service->srvstate != VCHIQ_SRVSTATE_FREE); ++ state->services[service->localport] = NULL; ++ } else ++ service = NULL; ++ } ++ spin_unlock(&service_spinlock); ++ ++ if (service && service->userdata_term) ++ service->userdata_term(service->base.userdata); ++ ++ kfree(service); ++} ++ ++int ++vchiq_get_client_id(VCHIQ_SERVICE_HANDLE_T handle) ++{ ++ VCHIQ_SERVICE_T *service = find_service_by_handle(handle); ++ int id; ++ ++ id = service ? service->client_id : 0; ++ if (service) ++ unlock_service(service); ++ ++ return id; ++} ++ ++void * ++vchiq_get_service_userdata(VCHIQ_SERVICE_HANDLE_T handle) ++{ ++ VCHIQ_SERVICE_T *service = handle_to_service(handle); ++ ++ return service ? service->base.userdata : NULL; ++} ++ ++int ++vchiq_get_service_fourcc(VCHIQ_SERVICE_HANDLE_T handle) ++{ ++ VCHIQ_SERVICE_T *service = handle_to_service(handle); ++ ++ return service ? service->base.fourcc : 0; ++} ++ ++static void ++mark_service_closing_internal(VCHIQ_SERVICE_T *service, int sh_thread) ++{ ++ VCHIQ_STATE_T *state = service->state; ++ VCHIQ_SERVICE_QUOTA_T *service_quota; ++ ++ service->closing = 1; ++ ++ /* Synchronise with other threads. */ ++ mutex_lock(&state->recycle_mutex); ++ mutex_unlock(&state->recycle_mutex); ++ if (!sh_thread || (state->conn_state != VCHIQ_CONNSTATE_PAUSE_SENT)) { ++ /* If we're pausing then the slot_mutex is held until resume ++ * by the slot handler. Therefore don't try to acquire this ++ * mutex if we're the slot handler and in the pause sent state. ++ * We don't need to in this case anyway. */ ++ mutex_lock(&state->slot_mutex); ++ mutex_unlock(&state->slot_mutex); ++ } ++ ++ /* Unblock any sending thread. */ ++ service_quota = &state->service_quotas[service->localport]; ++ up(&service_quota->quota_event); ++} ++ ++static void ++mark_service_closing(VCHIQ_SERVICE_T *service) ++{ ++ mark_service_closing_internal(service, 0); ++} ++ ++static inline VCHIQ_STATUS_T ++make_service_callback(VCHIQ_SERVICE_T *service, VCHIQ_REASON_T reason, ++ VCHIQ_HEADER_T *header, void *bulk_userdata) ++{ ++ VCHIQ_STATUS_T status; ++ vchiq_log_trace(vchiq_core_log_level, "%d: callback:%d (%s, %x, %x)", ++ service->state->id, service->localport, reason_names[reason], ++ (unsigned int)header, (unsigned int)bulk_userdata); ++ status = service->base.callback(reason, header, service->handle, ++ bulk_userdata); ++ if (status == VCHIQ_ERROR) { ++ vchiq_log_warning(vchiq_core_log_level, ++ "%d: ignoring ERROR from callback to service %x", ++ service->state->id, service->handle); ++ status = VCHIQ_SUCCESS; ++ } ++ return status; ++} ++ ++inline void ++vchiq_set_conn_state(VCHIQ_STATE_T *state, VCHIQ_CONNSTATE_T newstate) ++{ ++ VCHIQ_CONNSTATE_T oldstate = state->conn_state; ++ vchiq_log_info(vchiq_core_log_level, "%d: %s->%s", state->id, ++ conn_state_names[oldstate], ++ conn_state_names[newstate]); ++ state->conn_state = newstate; ++ vchiq_platform_conn_state_changed(state, oldstate, newstate); ++} ++ ++static inline void ++remote_event_create(REMOTE_EVENT_T *event) ++{ ++ event->armed = 0; ++ /* Don't clear the 'fired' flag because it may already have been set ++ ** by the other side. */ ++ sema_init(event->event, 0); ++} ++ ++static inline void ++remote_event_destroy(REMOTE_EVENT_T *event) ++{ ++ (void)event; ++} ++ ++static inline int ++remote_event_wait(REMOTE_EVENT_T *event) ++{ ++ if (!event->fired) { ++ event->armed = 1; ++ dsb(); ++ if (!event->fired) { ++ if (down_interruptible(event->event) != 0) { ++ event->armed = 0; ++ return 0; ++ } ++ } ++ event->armed = 0; ++ wmb(); ++ } ++ ++ event->fired = 0; ++ return 1; ++} ++ ++static inline void ++remote_event_signal_local(REMOTE_EVENT_T *event) ++{ ++ event->armed = 0; ++ up(event->event); ++} ++ ++static inline void ++remote_event_poll(REMOTE_EVENT_T *event) ++{ ++ if (event->fired && event->armed) ++ remote_event_signal_local(event); ++} ++ ++void ++remote_event_pollall(VCHIQ_STATE_T *state) ++{ ++ remote_event_poll(&state->local->sync_trigger); ++ remote_event_poll(&state->local->sync_release); ++ remote_event_poll(&state->local->trigger); ++ remote_event_poll(&state->local->recycle); ++} ++ ++/* Round up message sizes so that any space at the end of a slot is always big ++** enough for a header. This relies on header size being a power of two, which ++** has been verified earlier by a static assertion. */ ++ ++static inline unsigned int ++calc_stride(unsigned int size) ++{ ++ /* Allow room for the header */ ++ size += sizeof(VCHIQ_HEADER_T); ++ ++ /* Round up */ ++ return (size + sizeof(VCHIQ_HEADER_T) - 1) & ~(sizeof(VCHIQ_HEADER_T) ++ - 1); ++} ++ ++/* Called by the slot handler thread */ ++static VCHIQ_SERVICE_T * ++get_listening_service(VCHIQ_STATE_T *state, int fourcc) ++{ ++ int i; ++ ++ WARN_ON(fourcc == VCHIQ_FOURCC_INVALID); ++ ++ for (i = 0; i < state->unused_service; i++) { ++ VCHIQ_SERVICE_T *service = state->services[i]; ++ if (service && ++ (service->public_fourcc == fourcc) && ++ ((service->srvstate == VCHIQ_SRVSTATE_LISTENING) || ++ ((service->srvstate == VCHIQ_SRVSTATE_OPEN) && ++ (service->remoteport == VCHIQ_PORT_FREE)))) { ++ lock_service(service); ++ return service; ++ } ++ } ++ ++ return NULL; ++} ++ ++/* Called by the slot handler thread */ ++static VCHIQ_SERVICE_T * ++get_connected_service(VCHIQ_STATE_T *state, unsigned int port) ++{ ++ int i; ++ for (i = 0; i < state->unused_service; i++) { ++ VCHIQ_SERVICE_T *service = state->services[i]; ++ if (service && (service->srvstate == VCHIQ_SRVSTATE_OPEN) ++ && (service->remoteport == port)) { ++ lock_service(service); ++ return service; ++ } ++ } ++ return NULL; ++} ++ ++inline void ++request_poll(VCHIQ_STATE_T *state, VCHIQ_SERVICE_T *service, int poll_type) ++{ ++ uint32_t value; ++ ++ if (service) { ++ do { ++ value = atomic_read(&service->poll_flags); ++ } while (atomic_cmpxchg(&service->poll_flags, value, ++ value | (1 << poll_type)) != value); ++ ++ do { ++ value = atomic_read(&state->poll_services[ ++ service->localport>>5]); ++ } while (atomic_cmpxchg( ++ &state->poll_services[service->localport>>5], ++ value, value | (1 << (service->localport & 0x1f))) ++ != value); ++ } ++ ++ state->poll_needed = 1; ++ wmb(); ++ ++ /* ... and ensure the slot handler runs. */ ++ remote_event_signal_local(&state->local->trigger); ++} ++ ++/* Called from queue_message, by the slot handler and application threads, ++** with slot_mutex held */ ++static VCHIQ_HEADER_T * ++reserve_space(VCHIQ_STATE_T *state, int space, int is_blocking) ++{ ++ VCHIQ_SHARED_STATE_T *local = state->local; ++ int tx_pos = state->local_tx_pos; ++ int slot_space = VCHIQ_SLOT_SIZE - (tx_pos & VCHIQ_SLOT_MASK); ++ ++ if (space > slot_space) { ++ VCHIQ_HEADER_T *header; ++ /* Fill the remaining space with padding */ ++ WARN_ON(state->tx_data == NULL); ++ header = (VCHIQ_HEADER_T *) ++ (state->tx_data + (tx_pos & VCHIQ_SLOT_MASK)); ++ header->msgid = VCHIQ_MSGID_PADDING; ++ header->size = slot_space - sizeof(VCHIQ_HEADER_T); ++ ++ tx_pos += slot_space; ++ } ++ ++ /* If necessary, get the next slot. */ ++ if ((tx_pos & VCHIQ_SLOT_MASK) == 0) { ++ int slot_index; ++ ++ /* If there is no free slot... */ ++ ++ if (down_trylock(&state->slot_available_event) != 0) { ++ /* ...wait for one. */ ++ ++ VCHIQ_STATS_INC(state, slot_stalls); ++ ++ /* But first, flush through the last slot. */ ++ state->local_tx_pos = tx_pos; ++ local->tx_pos = tx_pos; ++ remote_event_signal(&state->remote->trigger); ++ ++ if (!is_blocking || ++ (down_interruptible( ++ &state->slot_available_event) != 0)) ++ return NULL; /* No space available */ ++ } ++ ++ BUG_ON(tx_pos == ++ (state->slot_queue_available * VCHIQ_SLOT_SIZE)); ++ ++ slot_index = local->slot_queue[ ++ SLOT_QUEUE_INDEX_FROM_POS(tx_pos) & ++ VCHIQ_SLOT_QUEUE_MASK]; ++ state->tx_data = ++ (char *)SLOT_DATA_FROM_INDEX(state, slot_index); ++ } ++ ++ state->local_tx_pos = tx_pos + space; ++ ++ return (VCHIQ_HEADER_T *)(state->tx_data + (tx_pos & VCHIQ_SLOT_MASK)); ++} ++ ++/* Called by the recycle thread. */ ++static void ++process_free_queue(VCHIQ_STATE_T *state) ++{ ++ VCHIQ_SHARED_STATE_T *local = state->local; ++ BITSET_T service_found[BITSET_SIZE(VCHIQ_MAX_SERVICES)]; ++ int slot_queue_available; ++ ++ /* Use a read memory barrier to ensure that any state that may have ++ ** been modified by another thread is not masked by stale prefetched ++ ** values. */ ++ rmb(); ++ ++ /* Find slots which have been freed by the other side, and return them ++ ** to the available queue. */ ++ slot_queue_available = state->slot_queue_available; ++ ++ while (slot_queue_available != local->slot_queue_recycle) { ++ unsigned int pos; ++ int slot_index = local->slot_queue[slot_queue_available++ & ++ VCHIQ_SLOT_QUEUE_MASK]; ++ char *data = (char *)SLOT_DATA_FROM_INDEX(state, slot_index); ++ int data_found = 0; ++ ++ vchiq_log_trace(vchiq_core_log_level, "%d: pfq %d=%x %x %x", ++ state->id, slot_index, (unsigned int)data, ++ local->slot_queue_recycle, slot_queue_available); ++ ++ /* Initialise the bitmask for services which have used this ++ ** slot */ ++ BITSET_ZERO(service_found); ++ ++ pos = 0; ++ ++ while (pos < VCHIQ_SLOT_SIZE) { ++ VCHIQ_HEADER_T *header = ++ (VCHIQ_HEADER_T *)(data + pos); ++ int msgid = header->msgid; ++ if (VCHIQ_MSG_TYPE(msgid) == VCHIQ_MSG_DATA) { ++ int port = VCHIQ_MSG_SRCPORT(msgid); ++ VCHIQ_SERVICE_QUOTA_T *service_quota = ++ &state->service_quotas[port]; ++ int count; ++ spin_lock(&quota_spinlock); ++ count = service_quota->message_use_count; ++ if (count > 0) ++ service_quota->message_use_count = ++ count - 1; ++ spin_unlock(&quota_spinlock); ++ ++ if (count == service_quota->message_quota) ++ /* Signal the service that it ++ ** has dropped below its quota ++ */ ++ up(&service_quota->quota_event); ++ else if (count == 0) { ++ vchiq_log_error(vchiq_core_log_level, ++ "service %d " ++ "message_use_count=%d " ++ "(header %x, msgid %x, " ++ "header->msgid %x, " ++ "header->size %x)", ++ port, ++ service_quota-> ++ message_use_count, ++ (unsigned int)header, msgid, ++ header->msgid, ++ header->size); ++ WARN(1, "invalid message use count\n"); ++ } ++ if (!BITSET_IS_SET(service_found, port)) { ++ /* Set the found bit for this service */ ++ BITSET_SET(service_found, port); ++ ++ spin_lock(&quota_spinlock); ++ count = service_quota->slot_use_count; ++ if (count > 0) ++ service_quota->slot_use_count = ++ count - 1; ++ spin_unlock(&quota_spinlock); ++ ++ if (count > 0) { ++ /* Signal the service in case ++ ** it has dropped below its ++ ** quota */ ++ up(&service_quota->quota_event); ++ vchiq_log_trace( ++ vchiq_core_log_level, ++ "%d: pfq:%d %x@%x - " ++ "slot_use->%d", ++ state->id, port, ++ header->size, ++ (unsigned int)header, ++ count - 1); ++ } else { ++ vchiq_log_error( ++ vchiq_core_log_level, ++ "service %d " ++ "slot_use_count" ++ "=%d (header %x" ++ ", msgid %x, " ++ "header->msgid" ++ " %x, header->" ++ "size %x)", ++ port, count, ++ (unsigned int)header, ++ msgid, ++ header->msgid, ++ header->size); ++ WARN(1, "bad slot use count\n"); ++ } ++ } ++ ++ data_found = 1; ++ } ++ ++ pos += calc_stride(header->size); ++ if (pos > VCHIQ_SLOT_SIZE) { ++ vchiq_log_error(vchiq_core_log_level, ++ "pfq - pos %x: header %x, msgid %x, " ++ "header->msgid %x, header->size %x", ++ pos, (unsigned int)header, msgid, ++ header->msgid, header->size); ++ WARN(1, "invalid slot position\n"); ++ } ++ } ++ ++ if (data_found) { ++ int count; ++ spin_lock(&quota_spinlock); ++ count = state->data_use_count; ++ if (count > 0) ++ state->data_use_count = ++ count - 1; ++ spin_unlock(&quota_spinlock); ++ if (count == state->data_quota) ++ up(&state->data_quota_event); ++ } ++ ++ state->slot_queue_available = slot_queue_available; ++ up(&state->slot_available_event); ++ } ++} ++ ++/* Called by the slot handler and application threads */ ++static VCHIQ_STATUS_T ++queue_message(VCHIQ_STATE_T *state, VCHIQ_SERVICE_T *service, ++ int msgid, const VCHIQ_ELEMENT_T *elements, ++ int count, int size, int flags) ++{ ++ VCHIQ_SHARED_STATE_T *local; ++ VCHIQ_SERVICE_QUOTA_T *service_quota = NULL; ++ VCHIQ_HEADER_T *header; ++ int type = VCHIQ_MSG_TYPE(msgid); ++ ++ unsigned int stride; ++ ++ local = state->local; ++ ++ stride = calc_stride(size); ++ ++ WARN_ON(!(stride <= VCHIQ_SLOT_SIZE)); ++ ++ if (!(flags & QMFLAGS_NO_MUTEX_LOCK) && ++ (mutex_lock_interruptible(&state->slot_mutex) != 0)) ++ return VCHIQ_RETRY; ++ ++ if (type == VCHIQ_MSG_DATA) { ++ int tx_end_index; ++ ++ BUG_ON(!service); ++ BUG_ON((flags & (QMFLAGS_NO_MUTEX_LOCK | ++ QMFLAGS_NO_MUTEX_UNLOCK)) != 0); ++ ++ if (service->closing) { ++ /* The service has been closed */ ++ mutex_unlock(&state->slot_mutex); ++ return VCHIQ_ERROR; ++ } ++ ++ service_quota = &state->service_quotas[service->localport]; ++ ++ spin_lock(&quota_spinlock); ++ ++ /* Ensure this service doesn't use more than its quota of ++ ** messages or slots */ ++ tx_end_index = SLOT_QUEUE_INDEX_FROM_POS( ++ state->local_tx_pos + stride - 1); ++ ++ /* Ensure data messages don't use more than their quota of ++ ** slots */ ++ while ((tx_end_index != state->previous_data_index) && ++ (state->data_use_count == state->data_quota)) { ++ VCHIQ_STATS_INC(state, data_stalls); ++ spin_unlock(&quota_spinlock); ++ mutex_unlock(&state->slot_mutex); ++ ++ if (down_interruptible(&state->data_quota_event) ++ != 0) ++ return VCHIQ_RETRY; ++ ++ mutex_lock(&state->slot_mutex); ++ spin_lock(&quota_spinlock); ++ tx_end_index = SLOT_QUEUE_INDEX_FROM_POS( ++ state->local_tx_pos + stride - 1); ++ if ((tx_end_index == state->previous_data_index) || ++ (state->data_use_count < state->data_quota)) { ++ /* Pass the signal on to other waiters */ ++ up(&state->data_quota_event); ++ break; ++ } ++ } ++ ++ while ((service_quota->message_use_count == ++ service_quota->message_quota) || ++ ((tx_end_index != service_quota->previous_tx_index) && ++ (service_quota->slot_use_count == ++ service_quota->slot_quota))) { ++ spin_unlock(&quota_spinlock); ++ vchiq_log_trace(vchiq_core_log_level, ++ "%d: qm:%d %s,%x - quota stall " ++ "(msg %d, slot %d)", ++ state->id, service->localport, ++ msg_type_str(type), size, ++ service_quota->message_use_count, ++ service_quota->slot_use_count); ++ VCHIQ_SERVICE_STATS_INC(service, quota_stalls); ++ mutex_unlock(&state->slot_mutex); ++ if (down_interruptible(&service_quota->quota_event) ++ != 0) ++ return VCHIQ_RETRY; ++ if (service->closing) ++ return VCHIQ_ERROR; ++ if (mutex_lock_interruptible(&state->slot_mutex) != 0) ++ return VCHIQ_RETRY; ++ if (service->srvstate != VCHIQ_SRVSTATE_OPEN) { ++ /* The service has been closed */ ++ mutex_unlock(&state->slot_mutex); ++ return VCHIQ_ERROR; ++ } ++ spin_lock(&quota_spinlock); ++ tx_end_index = SLOT_QUEUE_INDEX_FROM_POS( ++ state->local_tx_pos + stride - 1); ++ } ++ ++ spin_unlock(&quota_spinlock); ++ } ++ ++ header = reserve_space(state, stride, flags & QMFLAGS_IS_BLOCKING); ++ ++ if (!header) { ++ if (service) ++ VCHIQ_SERVICE_STATS_INC(service, slot_stalls); ++ /* In the event of a failure, return the mutex to the ++ state it was in */ ++ if (!(flags & QMFLAGS_NO_MUTEX_LOCK)) ++ mutex_unlock(&state->slot_mutex); ++ return VCHIQ_RETRY; ++ } ++ ++ if (type == VCHIQ_MSG_DATA) { ++ int i, pos; ++ int tx_end_index; ++ int slot_use_count; ++ ++ vchiq_log_info(vchiq_core_log_level, ++ "%d: qm %s@%x,%x (%d->%d)", ++ state->id, ++ msg_type_str(VCHIQ_MSG_TYPE(msgid)), ++ (unsigned int)header, size, ++ VCHIQ_MSG_SRCPORT(msgid), ++ VCHIQ_MSG_DSTPORT(msgid)); ++ ++ BUG_ON(!service); ++ BUG_ON((flags & (QMFLAGS_NO_MUTEX_LOCK | ++ QMFLAGS_NO_MUTEX_UNLOCK)) != 0); ++ ++ for (i = 0, pos = 0; i < (unsigned int)count; ++ pos += elements[i++].size) ++ if (elements[i].size) { ++ if (vchiq_copy_from_user ++ (header->data + pos, elements[i].data, ++ (size_t) elements[i].size) != ++ VCHIQ_SUCCESS) { ++ mutex_unlock(&state->slot_mutex); ++ VCHIQ_SERVICE_STATS_INC(service, ++ error_count); ++ return VCHIQ_ERROR; ++ } ++ } ++ ++ if (SRVTRACE_ENABLED(service, ++ VCHIQ_LOG_INFO)) ++ vchiq_log_dump_mem("Sent", 0, ++ header->data, ++ min(16, pos)); ++ ++ spin_lock(&quota_spinlock); ++ service_quota->message_use_count++; ++ ++ tx_end_index = ++ SLOT_QUEUE_INDEX_FROM_POS(state->local_tx_pos - 1); ++ ++ /* If this transmission can't fit in the last slot used by any ++ ** service, the data_use_count must be increased. */ ++ if (tx_end_index != state->previous_data_index) { ++ state->previous_data_index = tx_end_index; ++ state->data_use_count++; ++ } ++ ++ /* If this isn't the same slot last used by this service, ++ ** the service's slot_use_count must be increased. */ ++ if (tx_end_index != service_quota->previous_tx_index) { ++ service_quota->previous_tx_index = tx_end_index; ++ slot_use_count = ++service_quota->slot_use_count; ++ } else { ++ slot_use_count = 0; ++ } ++ ++ spin_unlock(&quota_spinlock); ++ ++ if (slot_use_count) ++ vchiq_log_trace(vchiq_core_log_level, ++ "%d: qm:%d %s,%x - slot_use->%d (hdr %p)", ++ state->id, service->localport, ++ msg_type_str(VCHIQ_MSG_TYPE(msgid)), size, ++ slot_use_count, header); ++ ++ VCHIQ_SERVICE_STATS_INC(service, ctrl_tx_count); ++ VCHIQ_SERVICE_STATS_ADD(service, ctrl_tx_bytes, size); ++ } else { ++ vchiq_log_info(vchiq_core_log_level, ++ "%d: qm %s@%x,%x (%d->%d)", state->id, ++ msg_type_str(VCHIQ_MSG_TYPE(msgid)), ++ (unsigned int)header, size, ++ VCHIQ_MSG_SRCPORT(msgid), ++ VCHIQ_MSG_DSTPORT(msgid)); ++ if (size != 0) { ++ WARN_ON(!((count == 1) && (size == elements[0].size))); ++ memcpy(header->data, elements[0].data, ++ elements[0].size); ++ } ++ VCHIQ_STATS_INC(state, ctrl_tx_count); ++ } ++ ++ header->msgid = msgid; ++ header->size = size; ++ ++ { ++ int svc_fourcc; ++ ++ svc_fourcc = service ++ ? service->base.fourcc ++ : VCHIQ_MAKE_FOURCC('?', '?', '?', '?'); ++ ++ vchiq_log_info(SRVTRACE_LEVEL(service), ++ "Sent Msg %s(%u) to %c%c%c%c s:%u d:%d len:%d", ++ msg_type_str(VCHIQ_MSG_TYPE(msgid)), ++ VCHIQ_MSG_TYPE(msgid), ++ VCHIQ_FOURCC_AS_4CHARS(svc_fourcc), ++ VCHIQ_MSG_SRCPORT(msgid), ++ VCHIQ_MSG_DSTPORT(msgid), ++ size); ++ } ++ ++ /* Make sure the new header is visible to the peer. */ ++ wmb(); ++ ++ /* Make the new tx_pos visible to the peer. */ ++ local->tx_pos = state->local_tx_pos; ++ wmb(); ++ ++ if (service && (type == VCHIQ_MSG_CLOSE)) ++ vchiq_set_service_state(service, VCHIQ_SRVSTATE_CLOSESENT); ++ ++ if (!(flags & QMFLAGS_NO_MUTEX_UNLOCK)) ++ mutex_unlock(&state->slot_mutex); ++ ++ remote_event_signal(&state->remote->trigger); ++ ++ return VCHIQ_SUCCESS; ++} ++ ++/* Called by the slot handler and application threads */ ++static VCHIQ_STATUS_T ++queue_message_sync(VCHIQ_STATE_T *state, VCHIQ_SERVICE_T *service, ++ int msgid, const VCHIQ_ELEMENT_T *elements, ++ int count, int size, int is_blocking) ++{ ++ VCHIQ_SHARED_STATE_T *local; ++ VCHIQ_HEADER_T *header; ++ ++ local = state->local; ++ ++ if ((VCHIQ_MSG_TYPE(msgid) != VCHIQ_MSG_RESUME) && ++ (mutex_lock_interruptible(&state->sync_mutex) != 0)) ++ return VCHIQ_RETRY; ++ ++ remote_event_wait(&local->sync_release); ++ ++ rmb(); ++ ++ header = (VCHIQ_HEADER_T *)SLOT_DATA_FROM_INDEX(state, ++ local->slot_sync); ++ ++ { ++ int oldmsgid = header->msgid; ++ if (oldmsgid != VCHIQ_MSGID_PADDING) ++ vchiq_log_error(vchiq_core_log_level, ++ "%d: qms - msgid %x, not PADDING", ++ state->id, oldmsgid); ++ } ++ ++ if (service) { ++ int i, pos; ++ ++ vchiq_log_info(vchiq_sync_log_level, ++ "%d: qms %s@%x,%x (%d->%d)", state->id, ++ msg_type_str(VCHIQ_MSG_TYPE(msgid)), ++ (unsigned int)header, size, ++ VCHIQ_MSG_SRCPORT(msgid), ++ VCHIQ_MSG_DSTPORT(msgid)); ++ ++ for (i = 0, pos = 0; i < (unsigned int)count; ++ pos += elements[i++].size) ++ if (elements[i].size) { ++ if (vchiq_copy_from_user ++ (header->data + pos, elements[i].data, ++ (size_t) elements[i].size) != ++ VCHIQ_SUCCESS) { ++ mutex_unlock(&state->sync_mutex); ++ VCHIQ_SERVICE_STATS_INC(service, ++ error_count); ++ return VCHIQ_ERROR; ++ } ++ } ++ ++ if (vchiq_sync_log_level >= VCHIQ_LOG_TRACE) ++ vchiq_log_dump_mem("Sent Sync", ++ 0, header->data, ++ min(16, pos)); ++ ++ VCHIQ_SERVICE_STATS_INC(service, ctrl_tx_count); ++ VCHIQ_SERVICE_STATS_ADD(service, ctrl_tx_bytes, size); ++ } else { ++ vchiq_log_info(vchiq_sync_log_level, ++ "%d: qms %s@%x,%x (%d->%d)", state->id, ++ msg_type_str(VCHIQ_MSG_TYPE(msgid)), ++ (unsigned int)header, size, ++ VCHIQ_MSG_SRCPORT(msgid), ++ VCHIQ_MSG_DSTPORT(msgid)); ++ if (size != 0) { ++ WARN_ON(!((count == 1) && (size == elements[0].size))); ++ memcpy(header->data, elements[0].data, ++ elements[0].size); ++ } ++ VCHIQ_STATS_INC(state, ctrl_tx_count); ++ } ++ ++ header->size = size; ++ header->msgid = msgid; ++ ++ if (vchiq_sync_log_level >= VCHIQ_LOG_TRACE) { ++ int svc_fourcc; ++ ++ svc_fourcc = service ++ ? service->base.fourcc ++ : VCHIQ_MAKE_FOURCC('?', '?', '?', '?'); ++ ++ vchiq_log_trace(vchiq_sync_log_level, ++ "Sent Sync Msg %s(%u) to %c%c%c%c s:%u d:%d len:%d", ++ msg_type_str(VCHIQ_MSG_TYPE(msgid)), ++ VCHIQ_MSG_TYPE(msgid), ++ VCHIQ_FOURCC_AS_4CHARS(svc_fourcc), ++ VCHIQ_MSG_SRCPORT(msgid), ++ VCHIQ_MSG_DSTPORT(msgid), ++ size); ++ } ++ ++ /* Make sure the new header is visible to the peer. */ ++ wmb(); ++ ++ remote_event_signal(&state->remote->sync_trigger); ++ ++ if (VCHIQ_MSG_TYPE(msgid) != VCHIQ_MSG_PAUSE) ++ mutex_unlock(&state->sync_mutex); ++ ++ return VCHIQ_SUCCESS; ++} ++ ++static inline void ++claim_slot(VCHIQ_SLOT_INFO_T *slot) ++{ ++ slot->use_count++; ++} ++ ++static void ++release_slot(VCHIQ_STATE_T *state, VCHIQ_SLOT_INFO_T *slot_info, ++ VCHIQ_HEADER_T *header, VCHIQ_SERVICE_T *service) ++{ ++ int release_count; ++ ++ mutex_lock(&state->recycle_mutex); ++ ++ if (header) { ++ int msgid = header->msgid; ++ if (((msgid & VCHIQ_MSGID_CLAIMED) == 0) || ++ (service && service->closing)) { ++ mutex_unlock(&state->recycle_mutex); ++ return; ++ } ++ ++ /* Rewrite the message header to prevent a double ++ ** release */ ++ header->msgid = msgid & ~VCHIQ_MSGID_CLAIMED; ++ } ++ ++ release_count = slot_info->release_count; ++ slot_info->release_count = ++release_count; ++ ++ if (release_count == slot_info->use_count) { ++ int slot_queue_recycle; ++ /* Add to the freed queue */ ++ ++ /* A read barrier is necessary here to prevent speculative ++ ** fetches of remote->slot_queue_recycle from overtaking the ++ ** mutex. */ ++ rmb(); ++ ++ slot_queue_recycle = state->remote->slot_queue_recycle; ++ state->remote->slot_queue[slot_queue_recycle & ++ VCHIQ_SLOT_QUEUE_MASK] = ++ SLOT_INDEX_FROM_INFO(state, slot_info); ++ state->remote->slot_queue_recycle = slot_queue_recycle + 1; ++ vchiq_log_info(vchiq_core_log_level, ++ "%d: release_slot %d - recycle->%x", ++ state->id, SLOT_INDEX_FROM_INFO(state, slot_info), ++ state->remote->slot_queue_recycle); ++ ++ /* A write barrier is necessary, but remote_event_signal ++ ** contains one. */ ++ remote_event_signal(&state->remote->recycle); ++ } ++ ++ mutex_unlock(&state->recycle_mutex); ++} ++ ++/* Called by the slot handler - don't hold the bulk mutex */ ++static VCHIQ_STATUS_T ++notify_bulks(VCHIQ_SERVICE_T *service, VCHIQ_BULK_QUEUE_T *queue, ++ int retry_poll) ++{ ++ VCHIQ_STATUS_T status = VCHIQ_SUCCESS; ++ ++ vchiq_log_trace(vchiq_core_log_level, ++ "%d: nb:%d %cx - p=%x rn=%x r=%x", ++ service->state->id, service->localport, ++ (queue == &service->bulk_tx) ? 't' : 'r', ++ queue->process, queue->remote_notify, queue->remove); ++ ++ if (service->state->is_master) { ++ while (queue->remote_notify != queue->process) { ++ VCHIQ_BULK_T *bulk = ++ &queue->bulks[BULK_INDEX(queue->remote_notify)]; ++ int msgtype = (bulk->dir == VCHIQ_BULK_TRANSMIT) ? ++ VCHIQ_MSG_BULK_RX_DONE : VCHIQ_MSG_BULK_TX_DONE; ++ int msgid = VCHIQ_MAKE_MSG(msgtype, service->localport, ++ service->remoteport); ++ VCHIQ_ELEMENT_T element = { &bulk->actual, 4 }; ++ /* Only reply to non-dummy bulk requests */ ++ if (bulk->remote_data) { ++ status = queue_message(service->state, NULL, ++ msgid, &element, 1, 4, 0); ++ if (status != VCHIQ_SUCCESS) ++ break; ++ } ++ queue->remote_notify++; ++ } ++ } else { ++ queue->remote_notify = queue->process; ++ } ++ ++ if (status == VCHIQ_SUCCESS) { ++ while (queue->remove != queue->remote_notify) { ++ VCHIQ_BULK_T *bulk = ++ &queue->bulks[BULK_INDEX(queue->remove)]; ++ ++ /* Only generate callbacks for non-dummy bulk ++ ** requests, and non-terminated services */ ++ if (bulk->data && service->instance) { ++ if (bulk->actual != VCHIQ_BULK_ACTUAL_ABORTED) { ++ if (bulk->dir == VCHIQ_BULK_TRANSMIT) { ++ VCHIQ_SERVICE_STATS_INC(service, ++ bulk_tx_count); ++ VCHIQ_SERVICE_STATS_ADD(service, ++ bulk_tx_bytes, ++ bulk->actual); ++ } else { ++ VCHIQ_SERVICE_STATS_INC(service, ++ bulk_rx_count); ++ VCHIQ_SERVICE_STATS_ADD(service, ++ bulk_rx_bytes, ++ bulk->actual); ++ } ++ } else { ++ VCHIQ_SERVICE_STATS_INC(service, ++ bulk_aborted_count); ++ } ++ if (bulk->mode == VCHIQ_BULK_MODE_BLOCKING) { ++ struct bulk_waiter *waiter; ++ spin_lock(&bulk_waiter_spinlock); ++ waiter = bulk->userdata; ++ if (waiter) { ++ waiter->actual = bulk->actual; ++ up(&waiter->event); ++ } ++ spin_unlock(&bulk_waiter_spinlock); ++ } else if (bulk->mode == ++ VCHIQ_BULK_MODE_CALLBACK) { ++ VCHIQ_REASON_T reason = (bulk->dir == ++ VCHIQ_BULK_TRANSMIT) ? ++ ((bulk->actual == ++ VCHIQ_BULK_ACTUAL_ABORTED) ? ++ VCHIQ_BULK_TRANSMIT_ABORTED : ++ VCHIQ_BULK_TRANSMIT_DONE) : ++ ((bulk->actual == ++ VCHIQ_BULK_ACTUAL_ABORTED) ? ++ VCHIQ_BULK_RECEIVE_ABORTED : ++ VCHIQ_BULK_RECEIVE_DONE); ++ status = make_service_callback(service, ++ reason, NULL, bulk->userdata); ++ if (status == VCHIQ_RETRY) ++ break; ++ } ++ } ++ ++ queue->remove++; ++ up(&service->bulk_remove_event); ++ } ++ if (!retry_poll) ++ status = VCHIQ_SUCCESS; ++ } ++ ++ if (status == VCHIQ_RETRY) ++ request_poll(service->state, service, ++ (queue == &service->bulk_tx) ? ++ VCHIQ_POLL_TXNOTIFY : VCHIQ_POLL_RXNOTIFY); ++ ++ return status; ++} ++ ++/* Called by the slot handler thread */ ++static void ++poll_services(VCHIQ_STATE_T *state) ++{ ++ int group, i; ++ ++ for (group = 0; group < BITSET_SIZE(state->unused_service); group++) { ++ uint32_t flags; ++ flags = atomic_xchg(&state->poll_services[group], 0); ++ for (i = 0; flags; i++) { ++ if (flags & (1 << i)) { ++ VCHIQ_SERVICE_T *service = ++ find_service_by_port(state, ++ (group<<5) + i); ++ uint32_t service_flags; ++ flags &= ~(1 << i); ++ if (!service) ++ continue; ++ service_flags = ++ atomic_xchg(&service->poll_flags, 0); ++ if (service_flags & ++ (1 << VCHIQ_POLL_REMOVE)) { ++ vchiq_log_info(vchiq_core_log_level, ++ "%d: ps - remove %d<->%d", ++ state->id, service->localport, ++ service->remoteport); ++ ++ /* Make it look like a client, because ++ it must be removed and not left in ++ the LISTENING state. */ ++ service->public_fourcc = ++ VCHIQ_FOURCC_INVALID; ++ ++ if (vchiq_close_service_internal( ++ service, 0/*!close_recvd*/) != ++ VCHIQ_SUCCESS) ++ request_poll(state, service, ++ VCHIQ_POLL_REMOVE); ++ } else if (service_flags & ++ (1 << VCHIQ_POLL_TERMINATE)) { ++ vchiq_log_info(vchiq_core_log_level, ++ "%d: ps - terminate %d<->%d", ++ state->id, service->localport, ++ service->remoteport); ++ if (vchiq_close_service_internal( ++ service, 0/*!close_recvd*/) != ++ VCHIQ_SUCCESS) ++ request_poll(state, service, ++ VCHIQ_POLL_TERMINATE); ++ } ++ if (service_flags & (1 << VCHIQ_POLL_TXNOTIFY)) ++ notify_bulks(service, ++ &service->bulk_tx, ++ 1/*retry_poll*/); ++ if (service_flags & (1 << VCHIQ_POLL_RXNOTIFY)) ++ notify_bulks(service, ++ &service->bulk_rx, ++ 1/*retry_poll*/); ++ unlock_service(service); ++ } ++ } ++ } ++} ++ ++/* Called by the slot handler or application threads, holding the bulk mutex. */ ++static int ++resolve_bulks(VCHIQ_SERVICE_T *service, VCHIQ_BULK_QUEUE_T *queue) ++{ ++ VCHIQ_STATE_T *state = service->state; ++ int resolved = 0; ++ int rc; ++ ++ while ((queue->process != queue->local_insert) && ++ (queue->process != queue->remote_insert)) { ++ VCHIQ_BULK_T *bulk = &queue->bulks[BULK_INDEX(queue->process)]; ++ ++ vchiq_log_trace(vchiq_core_log_level, ++ "%d: rb:%d %cx - li=%x ri=%x p=%x", ++ state->id, service->localport, ++ (queue == &service->bulk_tx) ? 't' : 'r', ++ queue->local_insert, queue->remote_insert, ++ queue->process); ++ ++ WARN_ON(!((int)(queue->local_insert - queue->process) > 0)); ++ WARN_ON(!((int)(queue->remote_insert - queue->process) > 0)); ++ ++ rc = mutex_lock_interruptible(&state->bulk_transfer_mutex); ++ if (rc != 0) ++ break; ++ ++ vchiq_transfer_bulk(bulk); ++ mutex_unlock(&state->bulk_transfer_mutex); ++ ++ if (SRVTRACE_ENABLED(service, VCHIQ_LOG_INFO)) { ++ const char *header = (queue == &service->bulk_tx) ? ++ "Send Bulk to" : "Recv Bulk from"; ++ if (bulk->actual != VCHIQ_BULK_ACTUAL_ABORTED) ++ vchiq_log_info(SRVTRACE_LEVEL(service), ++ "%s %c%c%c%c d:%d len:%d %x<->%x", ++ header, ++ VCHIQ_FOURCC_AS_4CHARS( ++ service->base.fourcc), ++ service->remoteport, ++ bulk->size, ++ (unsigned int)bulk->data, ++ (unsigned int)bulk->remote_data); ++ else ++ vchiq_log_info(SRVTRACE_LEVEL(service), ++ "%s %c%c%c%c d:%d ABORTED - tx len:%d," ++ " rx len:%d %x<->%x", ++ header, ++ VCHIQ_FOURCC_AS_4CHARS( ++ service->base.fourcc), ++ service->remoteport, ++ bulk->size, ++ bulk->remote_size, ++ (unsigned int)bulk->data, ++ (unsigned int)bulk->remote_data); ++ } ++ ++ vchiq_complete_bulk(bulk); ++ queue->process++; ++ resolved++; ++ } ++ return resolved; ++} ++ ++/* Called with the bulk_mutex held */ ++static void ++abort_outstanding_bulks(VCHIQ_SERVICE_T *service, VCHIQ_BULK_QUEUE_T *queue) ++{ ++ int is_tx = (queue == &service->bulk_tx); ++ vchiq_log_trace(vchiq_core_log_level, ++ "%d: aob:%d %cx - li=%x ri=%x p=%x", ++ service->state->id, service->localport, is_tx ? 't' : 'r', ++ queue->local_insert, queue->remote_insert, queue->process); ++ ++ WARN_ON(!((int)(queue->local_insert - queue->process) >= 0)); ++ WARN_ON(!((int)(queue->remote_insert - queue->process) >= 0)); ++ ++ while ((queue->process != queue->local_insert) || ++ (queue->process != queue->remote_insert)) { ++ VCHIQ_BULK_T *bulk = &queue->bulks[BULK_INDEX(queue->process)]; ++ ++ if (queue->process == queue->remote_insert) { ++ /* fabricate a matching dummy bulk */ ++ bulk->remote_data = NULL; ++ bulk->remote_size = 0; ++ queue->remote_insert++; ++ } ++ ++ if (queue->process != queue->local_insert) { ++ vchiq_complete_bulk(bulk); ++ ++ vchiq_log_info(SRVTRACE_LEVEL(service), ++ "%s %c%c%c%c d:%d ABORTED - tx len:%d, " ++ "rx len:%d", ++ is_tx ? "Send Bulk to" : "Recv Bulk from", ++ VCHIQ_FOURCC_AS_4CHARS(service->base.fourcc), ++ service->remoteport, ++ bulk->size, ++ bulk->remote_size); ++ } else { ++ /* fabricate a matching dummy bulk */ ++ bulk->data = NULL; ++ bulk->size = 0; ++ bulk->actual = VCHIQ_BULK_ACTUAL_ABORTED; ++ bulk->dir = is_tx ? VCHIQ_BULK_TRANSMIT : ++ VCHIQ_BULK_RECEIVE; ++ queue->local_insert++; ++ } ++ ++ queue->process++; ++ } ++} ++ ++/* Called from the slot handler thread */ ++static void ++pause_bulks(VCHIQ_STATE_T *state) ++{ ++ if (unlikely(atomic_inc_return(&pause_bulks_count) != 1)) { ++ WARN_ON_ONCE(1); ++ atomic_set(&pause_bulks_count, 1); ++ return; ++ } ++ ++ /* Block bulk transfers from all services */ ++ mutex_lock(&state->bulk_transfer_mutex); ++} ++ ++/* Called from the slot handler thread */ ++static void ++resume_bulks(VCHIQ_STATE_T *state) ++{ ++ int i; ++ if (unlikely(atomic_dec_return(&pause_bulks_count) != 0)) { ++ WARN_ON_ONCE(1); ++ atomic_set(&pause_bulks_count, 0); ++ return; ++ } ++ ++ /* Allow bulk transfers from all services */ ++ mutex_unlock(&state->bulk_transfer_mutex); ++ ++ if (state->deferred_bulks == 0) ++ return; ++ ++ /* Deal with any bulks which had to be deferred due to being in ++ * paused state. Don't try to match up to number of deferred bulks ++ * in case we've had something come and close the service in the ++ * interim - just process all bulk queues for all services */ ++ vchiq_log_info(vchiq_core_log_level, "%s: processing %d deferred bulks", ++ __func__, state->deferred_bulks); ++ ++ for (i = 0; i < state->unused_service; i++) { ++ VCHIQ_SERVICE_T *service = state->services[i]; ++ int resolved_rx = 0; ++ int resolved_tx = 0; ++ if (!service || (service->srvstate != VCHIQ_SRVSTATE_OPEN)) ++ continue; ++ ++ mutex_lock(&service->bulk_mutex); ++ resolved_rx = resolve_bulks(service, &service->bulk_rx); ++ resolved_tx = resolve_bulks(service, &service->bulk_tx); ++ mutex_unlock(&service->bulk_mutex); ++ if (resolved_rx) ++ notify_bulks(service, &service->bulk_rx, 1); ++ if (resolved_tx) ++ notify_bulks(service, &service->bulk_tx, 1); ++ } ++ state->deferred_bulks = 0; ++} ++ ++static int ++parse_open(VCHIQ_STATE_T *state, VCHIQ_HEADER_T *header) ++{ ++ VCHIQ_SERVICE_T *service = NULL; ++ int msgid, size; ++ int type; ++ unsigned int localport, remoteport; ++ ++ msgid = header->msgid; ++ size = header->size; ++ type = VCHIQ_MSG_TYPE(msgid); ++ localport = VCHIQ_MSG_DSTPORT(msgid); ++ remoteport = VCHIQ_MSG_SRCPORT(msgid); ++ if (size >= sizeof(struct vchiq_open_payload)) { ++ const struct vchiq_open_payload *payload = ++ (struct vchiq_open_payload *)header->data; ++ unsigned int fourcc; ++ ++ fourcc = payload->fourcc; ++ vchiq_log_info(vchiq_core_log_level, ++ "%d: prs OPEN@%x (%d->'%c%c%c%c')", ++ state->id, (unsigned int)header, ++ localport, ++ VCHIQ_FOURCC_AS_4CHARS(fourcc)); ++ ++ service = get_listening_service(state, fourcc); ++ ++ if (service) { ++ /* A matching service exists */ ++ short version = payload->version; ++ short version_min = payload->version_min; ++ if ((service->version < version_min) || ++ (version < service->version_min)) { ++ /* Version mismatch */ ++ vchiq_loud_error_header(); ++ vchiq_loud_error("%d: service %d (%c%c%c%c) " ++ "version mismatch - local (%d, min %d)" ++ " vs. remote (%d, min %d)", ++ state->id, service->localport, ++ VCHIQ_FOURCC_AS_4CHARS(fourcc), ++ service->version, service->version_min, ++ version, version_min); ++ vchiq_loud_error_footer(); ++ unlock_service(service); ++ service = NULL; ++ goto fail_open; ++ } ++ service->peer_version = version; ++ ++ if (service->srvstate == VCHIQ_SRVSTATE_LISTENING) { ++ struct vchiq_openack_payload ack_payload = { ++ service->version ++ }; ++ VCHIQ_ELEMENT_T body = { ++ &ack_payload, ++ sizeof(ack_payload) ++ }; ++ ++ if (state->version_common < ++ VCHIQ_VERSION_SYNCHRONOUS_MODE) ++ service->sync = 0; ++ ++ /* Acknowledge the OPEN */ ++ if (service->sync && ++ (state->version_common >= ++ VCHIQ_VERSION_SYNCHRONOUS_MODE)) { ++ if (queue_message_sync(state, NULL, ++ VCHIQ_MAKE_MSG( ++ VCHIQ_MSG_OPENACK, ++ service->localport, ++ remoteport), ++ &body, 1, sizeof(ack_payload), ++ 0) == VCHIQ_RETRY) ++ goto bail_not_ready; ++ } else { ++ if (queue_message(state, NULL, ++ VCHIQ_MAKE_MSG( ++ VCHIQ_MSG_OPENACK, ++ service->localport, ++ remoteport), ++ &body, 1, sizeof(ack_payload), ++ 0) == VCHIQ_RETRY) ++ goto bail_not_ready; ++ } ++ ++ /* The service is now open */ ++ vchiq_set_service_state(service, ++ service->sync ? VCHIQ_SRVSTATE_OPENSYNC ++ : VCHIQ_SRVSTATE_OPEN); ++ } ++ ++ service->remoteport = remoteport; ++ service->client_id = ((int *)header->data)[1]; ++ if (make_service_callback(service, VCHIQ_SERVICE_OPENED, ++ NULL, NULL) == VCHIQ_RETRY) { ++ /* Bail out if not ready */ ++ service->remoteport = VCHIQ_PORT_FREE; ++ goto bail_not_ready; ++ } ++ ++ /* Success - the message has been dealt with */ ++ unlock_service(service); ++ return 1; ++ } ++ } ++ ++fail_open: ++ /* No available service, or an invalid request - send a CLOSE */ ++ if (queue_message(state, NULL, ++ VCHIQ_MAKE_MSG(VCHIQ_MSG_CLOSE, 0, VCHIQ_MSG_SRCPORT(msgid)), ++ NULL, 0, 0, 0) == VCHIQ_RETRY) ++ goto bail_not_ready; ++ ++ return 1; ++ ++bail_not_ready: ++ if (service) ++ unlock_service(service); ++ ++ return 0; ++} ++ ++/* Called by the slot handler thread */ ++static void ++parse_rx_slots(VCHIQ_STATE_T *state) ++{ ++ VCHIQ_SHARED_STATE_T *remote = state->remote; ++ VCHIQ_SERVICE_T *service = NULL; ++ int tx_pos; ++ DEBUG_INITIALISE(state->local) ++ ++ tx_pos = remote->tx_pos; ++ ++ while (state->rx_pos != tx_pos) { ++ VCHIQ_HEADER_T *header; ++ int msgid, size; ++ int type; ++ unsigned int localport, remoteport; ++ ++ DEBUG_TRACE(PARSE_LINE); ++ if (!state->rx_data) { ++ int rx_index; ++ WARN_ON(!((state->rx_pos & VCHIQ_SLOT_MASK) == 0)); ++ rx_index = remote->slot_queue[ ++ SLOT_QUEUE_INDEX_FROM_POS(state->rx_pos) & ++ VCHIQ_SLOT_QUEUE_MASK]; ++ state->rx_data = (char *)SLOT_DATA_FROM_INDEX(state, ++ rx_index); ++ state->rx_info = SLOT_INFO_FROM_INDEX(state, rx_index); ++ ++ /* Initialise use_count to one, and increment ++ ** release_count at the end of the slot to avoid ++ ** releasing the slot prematurely. */ ++ state->rx_info->use_count = 1; ++ state->rx_info->release_count = 0; ++ } ++ ++ header = (VCHIQ_HEADER_T *)(state->rx_data + ++ (state->rx_pos & VCHIQ_SLOT_MASK)); ++ DEBUG_VALUE(PARSE_HEADER, (int)header); ++ msgid = header->msgid; ++ DEBUG_VALUE(PARSE_MSGID, msgid); ++ size = header->size; ++ type = VCHIQ_MSG_TYPE(msgid); ++ localport = VCHIQ_MSG_DSTPORT(msgid); ++ remoteport = VCHIQ_MSG_SRCPORT(msgid); ++ ++ if (type != VCHIQ_MSG_DATA) ++ VCHIQ_STATS_INC(state, ctrl_rx_count); ++ ++ switch (type) { ++ case VCHIQ_MSG_OPENACK: ++ case VCHIQ_MSG_CLOSE: ++ case VCHIQ_MSG_DATA: ++ case VCHIQ_MSG_BULK_RX: ++ case VCHIQ_MSG_BULK_TX: ++ case VCHIQ_MSG_BULK_RX_DONE: ++ case VCHIQ_MSG_BULK_TX_DONE: ++ service = find_service_by_port(state, localport); ++ if ((!service || ++ ((service->remoteport != remoteport) && ++ (service->remoteport != VCHIQ_PORT_FREE))) && ++ (localport == 0) && ++ (type == VCHIQ_MSG_CLOSE)) { ++ /* This could be a CLOSE from a client which ++ hadn't yet received the OPENACK - look for ++ the connected service */ ++ if (service) ++ unlock_service(service); ++ service = get_connected_service(state, ++ remoteport); ++ if (service) ++ vchiq_log_warning(vchiq_core_log_level, ++ "%d: prs %s@%x (%d->%d) - " ++ "found connected service %d", ++ state->id, msg_type_str(type), ++ (unsigned int)header, ++ remoteport, localport, ++ service->localport); ++ } ++ ++ if (!service) { ++ vchiq_log_error(vchiq_core_log_level, ++ "%d: prs %s@%x (%d->%d) - " ++ "invalid/closed service %d", ++ state->id, msg_type_str(type), ++ (unsigned int)header, ++ remoteport, localport, localport); ++ goto skip_message; ++ } ++ break; ++ default: ++ break; ++ } ++ ++ if (SRVTRACE_ENABLED(service, VCHIQ_LOG_INFO)) { ++ int svc_fourcc; ++ ++ svc_fourcc = service ++ ? service->base.fourcc ++ : VCHIQ_MAKE_FOURCC('?', '?', '?', '?'); ++ vchiq_log_info(SRVTRACE_LEVEL(service), ++ "Rcvd Msg %s(%u) from %c%c%c%c s:%d d:%d " ++ "len:%d", ++ msg_type_str(type), type, ++ VCHIQ_FOURCC_AS_4CHARS(svc_fourcc), ++ remoteport, localport, size); ++ if (size > 0) ++ vchiq_log_dump_mem("Rcvd", 0, header->data, ++ min(16, size)); ++ } ++ ++ if (((unsigned int)header & VCHIQ_SLOT_MASK) + calc_stride(size) ++ > VCHIQ_SLOT_SIZE) { ++ vchiq_log_error(vchiq_core_log_level, ++ "header %x (msgid %x) - size %x too big for " ++ "slot", ++ (unsigned int)header, (unsigned int)msgid, ++ (unsigned int)size); ++ WARN(1, "oversized for slot\n"); ++ } ++ ++ switch (type) { ++ case VCHIQ_MSG_OPEN: ++ WARN_ON(!(VCHIQ_MSG_DSTPORT(msgid) == 0)); ++ if (!parse_open(state, header)) ++ goto bail_not_ready; ++ break; ++ case VCHIQ_MSG_OPENACK: ++ if (size >= sizeof(struct vchiq_openack_payload)) { ++ const struct vchiq_openack_payload *payload = ++ (struct vchiq_openack_payload *) ++ header->data; ++ service->peer_version = payload->version; ++ } ++ vchiq_log_info(vchiq_core_log_level, ++ "%d: prs OPENACK@%x,%x (%d->%d) v:%d", ++ state->id, (unsigned int)header, size, ++ remoteport, localport, service->peer_version); ++ if (service->srvstate == ++ VCHIQ_SRVSTATE_OPENING) { ++ service->remoteport = remoteport; ++ vchiq_set_service_state(service, ++ VCHIQ_SRVSTATE_OPEN); ++ up(&service->remove_event); ++ } else ++ vchiq_log_error(vchiq_core_log_level, ++ "OPENACK received in state %s", ++ srvstate_names[service->srvstate]); ++ break; ++ case VCHIQ_MSG_CLOSE: ++ WARN_ON(size != 0); /* There should be no data */ ++ ++ vchiq_log_info(vchiq_core_log_level, ++ "%d: prs CLOSE@%x (%d->%d)", ++ state->id, (unsigned int)header, ++ remoteport, localport); ++ ++ mark_service_closing_internal(service, 1); ++ ++ if (vchiq_close_service_internal(service, ++ 1/*close_recvd*/) == VCHIQ_RETRY) ++ goto bail_not_ready; ++ ++ vchiq_log_info(vchiq_core_log_level, ++ "Close Service %c%c%c%c s:%u d:%d", ++ VCHIQ_FOURCC_AS_4CHARS(service->base.fourcc), ++ service->localport, ++ service->remoteport); ++ break; ++ case VCHIQ_MSG_DATA: ++ vchiq_log_info(vchiq_core_log_level, ++ "%d: prs DATA@%x,%x (%d->%d)", ++ state->id, (unsigned int)header, size, ++ remoteport, localport); ++ ++ if ((service->remoteport == remoteport) ++ && (service->srvstate == ++ VCHIQ_SRVSTATE_OPEN)) { ++ header->msgid = msgid | VCHIQ_MSGID_CLAIMED; ++ claim_slot(state->rx_info); ++ DEBUG_TRACE(PARSE_LINE); ++ if (make_service_callback(service, ++ VCHIQ_MESSAGE_AVAILABLE, header, ++ NULL) == VCHIQ_RETRY) { ++ DEBUG_TRACE(PARSE_LINE); ++ goto bail_not_ready; ++ } ++ VCHIQ_SERVICE_STATS_INC(service, ctrl_rx_count); ++ VCHIQ_SERVICE_STATS_ADD(service, ctrl_rx_bytes, ++ size); ++ } else { ++ VCHIQ_STATS_INC(state, error_count); ++ } ++ break; ++ case VCHIQ_MSG_CONNECT: ++ vchiq_log_info(vchiq_core_log_level, ++ "%d: prs CONNECT@%x", ++ state->id, (unsigned int)header); ++ state->version_common = ((VCHIQ_SLOT_ZERO_T *) ++ state->slot_data)->version; ++ up(&state->connect); ++ break; ++ case VCHIQ_MSG_BULK_RX: ++ case VCHIQ_MSG_BULK_TX: { ++ VCHIQ_BULK_QUEUE_T *queue; ++ WARN_ON(!state->is_master); ++ queue = (type == VCHIQ_MSG_BULK_RX) ? ++ &service->bulk_tx : &service->bulk_rx; ++ if ((service->remoteport == remoteport) ++ && (service->srvstate == ++ VCHIQ_SRVSTATE_OPEN)) { ++ VCHIQ_BULK_T *bulk; ++ int resolved = 0; ++ ++ DEBUG_TRACE(PARSE_LINE); ++ if (mutex_lock_interruptible( ++ &service->bulk_mutex) != 0) { ++ DEBUG_TRACE(PARSE_LINE); ++ goto bail_not_ready; ++ } ++ ++ WARN_ON(!(queue->remote_insert < queue->remove + ++ VCHIQ_NUM_SERVICE_BULKS)); ++ bulk = &queue->bulks[ ++ BULK_INDEX(queue->remote_insert)]; ++ bulk->remote_data = ++ (void *)((int *)header->data)[0]; ++ bulk->remote_size = ((int *)header->data)[1]; ++ wmb(); ++ ++ vchiq_log_info(vchiq_core_log_level, ++ "%d: prs %s@%x (%d->%d) %x@%x", ++ state->id, msg_type_str(type), ++ (unsigned int)header, ++ remoteport, localport, ++ bulk->remote_size, ++ (unsigned int)bulk->remote_data); ++ ++ queue->remote_insert++; ++ ++ if (atomic_read(&pause_bulks_count)) { ++ state->deferred_bulks++; ++ vchiq_log_info(vchiq_core_log_level, ++ "%s: deferring bulk (%d)", ++ __func__, ++ state->deferred_bulks); ++ if (state->conn_state != ++ VCHIQ_CONNSTATE_PAUSE_SENT) ++ vchiq_log_error( ++ vchiq_core_log_level, ++ "%s: bulks paused in " ++ "unexpected state %s", ++ __func__, ++ conn_state_names[ ++ state->conn_state]); ++ } else if (state->conn_state == ++ VCHIQ_CONNSTATE_CONNECTED) { ++ DEBUG_TRACE(PARSE_LINE); ++ resolved = resolve_bulks(service, ++ queue); ++ } ++ ++ mutex_unlock(&service->bulk_mutex); ++ if (resolved) ++ notify_bulks(service, queue, ++ 1/*retry_poll*/); ++ } ++ } break; ++ case VCHIQ_MSG_BULK_RX_DONE: ++ case VCHIQ_MSG_BULK_TX_DONE: ++ WARN_ON(state->is_master); ++ if ((service->remoteport == remoteport) ++ && (service->srvstate != ++ VCHIQ_SRVSTATE_FREE)) { ++ VCHIQ_BULK_QUEUE_T *queue; ++ VCHIQ_BULK_T *bulk; ++ ++ queue = (type == VCHIQ_MSG_BULK_RX_DONE) ? ++ &service->bulk_rx : &service->bulk_tx; ++ ++ DEBUG_TRACE(PARSE_LINE); ++ if (mutex_lock_interruptible( ++ &service->bulk_mutex) != 0) { ++ DEBUG_TRACE(PARSE_LINE); ++ goto bail_not_ready; ++ } ++ if ((int)(queue->remote_insert - ++ queue->local_insert) >= 0) { ++ vchiq_log_error(vchiq_core_log_level, ++ "%d: prs %s@%x (%d->%d) " ++ "unexpected (ri=%d,li=%d)", ++ state->id, msg_type_str(type), ++ (unsigned int)header, ++ remoteport, localport, ++ queue->remote_insert, ++ queue->local_insert); ++ mutex_unlock(&service->bulk_mutex); ++ break; ++ } ++ ++ BUG_ON(queue->process == queue->local_insert); ++ BUG_ON(queue->process != queue->remote_insert); ++ ++ bulk = &queue->bulks[ ++ BULK_INDEX(queue->remote_insert)]; ++ bulk->actual = *(int *)header->data; ++ queue->remote_insert++; ++ ++ vchiq_log_info(vchiq_core_log_level, ++ "%d: prs %s@%x (%d->%d) %x@%x", ++ state->id, msg_type_str(type), ++ (unsigned int)header, ++ remoteport, localport, ++ bulk->actual, (unsigned int)bulk->data); ++ ++ vchiq_log_trace(vchiq_core_log_level, ++ "%d: prs:%d %cx li=%x ri=%x p=%x", ++ state->id, localport, ++ (type == VCHIQ_MSG_BULK_RX_DONE) ? ++ 'r' : 't', ++ queue->local_insert, ++ queue->remote_insert, queue->process); ++ ++ DEBUG_TRACE(PARSE_LINE); ++ WARN_ON(queue->process == queue->local_insert); ++ vchiq_complete_bulk(bulk); ++ queue->process++; ++ mutex_unlock(&service->bulk_mutex); ++ DEBUG_TRACE(PARSE_LINE); ++ notify_bulks(service, queue, 1/*retry_poll*/); ++ DEBUG_TRACE(PARSE_LINE); ++ } ++ break; ++ case VCHIQ_MSG_PADDING: ++ vchiq_log_trace(vchiq_core_log_level, ++ "%d: prs PADDING@%x,%x", ++ state->id, (unsigned int)header, size); ++ break; ++ case VCHIQ_MSG_PAUSE: ++ /* If initiated, signal the application thread */ ++ vchiq_log_trace(vchiq_core_log_level, ++ "%d: prs PAUSE@%x,%x", ++ state->id, (unsigned int)header, size); ++ if (state->conn_state == VCHIQ_CONNSTATE_PAUSED) { ++ vchiq_log_error(vchiq_core_log_level, ++ "%d: PAUSE received in state PAUSED", ++ state->id); ++ break; ++ } ++ if (state->conn_state != VCHIQ_CONNSTATE_PAUSE_SENT) { ++ /* Send a PAUSE in response */ ++ if (queue_message(state, NULL, ++ VCHIQ_MAKE_MSG(VCHIQ_MSG_PAUSE, 0, 0), ++ NULL, 0, 0, QMFLAGS_NO_MUTEX_UNLOCK) ++ == VCHIQ_RETRY) ++ goto bail_not_ready; ++ if (state->is_master) ++ pause_bulks(state); ++ } ++ /* At this point slot_mutex is held */ ++ vchiq_set_conn_state(state, VCHIQ_CONNSTATE_PAUSED); ++ vchiq_platform_paused(state); ++ break; ++ case VCHIQ_MSG_RESUME: ++ vchiq_log_trace(vchiq_core_log_level, ++ "%d: prs RESUME@%x,%x", ++ state->id, (unsigned int)header, size); ++ /* Release the slot mutex */ ++ mutex_unlock(&state->slot_mutex); ++ if (state->is_master) ++ resume_bulks(state); ++ vchiq_set_conn_state(state, VCHIQ_CONNSTATE_CONNECTED); ++ vchiq_platform_resumed(state); ++ break; ++ ++ case VCHIQ_MSG_REMOTE_USE: ++ vchiq_on_remote_use(state); ++ break; ++ case VCHIQ_MSG_REMOTE_RELEASE: ++ vchiq_on_remote_release(state); ++ break; ++ case VCHIQ_MSG_REMOTE_USE_ACTIVE: ++ vchiq_on_remote_use_active(state); ++ break; ++ ++ default: ++ vchiq_log_error(vchiq_core_log_level, ++ "%d: prs invalid msgid %x@%x,%x", ++ state->id, msgid, (unsigned int)header, size); ++ WARN(1, "invalid message\n"); ++ break; ++ } ++ ++skip_message: ++ if (service) { ++ unlock_service(service); ++ service = NULL; ++ } ++ ++ state->rx_pos += calc_stride(size); ++ ++ DEBUG_TRACE(PARSE_LINE); ++ /* Perform some housekeeping when the end of the slot is ++ ** reached. */ ++ if ((state->rx_pos & VCHIQ_SLOT_MASK) == 0) { ++ /* Remove the extra reference count. */ ++ release_slot(state, state->rx_info, NULL, NULL); ++ state->rx_data = NULL; ++ } ++ } ++ ++bail_not_ready: ++ if (service) ++ unlock_service(service); ++} ++ ++/* Called by the slot handler thread */ ++static int ++slot_handler_func(void *v) ++{ ++ VCHIQ_STATE_T *state = (VCHIQ_STATE_T *) v; ++ VCHIQ_SHARED_STATE_T *local = state->local; ++ DEBUG_INITIALISE(local) ++ ++ while (1) { ++ DEBUG_COUNT(SLOT_HANDLER_COUNT); ++ DEBUG_TRACE(SLOT_HANDLER_LINE); ++ remote_event_wait(&local->trigger); ++ ++ rmb(); ++ ++ DEBUG_TRACE(SLOT_HANDLER_LINE); ++ if (state->poll_needed) { ++ /* Check if we need to suspend - may change our ++ * conn_state */ ++ vchiq_platform_check_suspend(state); ++ ++ state->poll_needed = 0; ++ ++ /* Handle service polling and other rare conditions here ++ ** out of the mainline code */ ++ switch (state->conn_state) { ++ case VCHIQ_CONNSTATE_CONNECTED: ++ /* Poll the services as requested */ ++ poll_services(state); ++ break; ++ ++ case VCHIQ_CONNSTATE_PAUSING: ++ if (state->is_master) ++ pause_bulks(state); ++ if (queue_message(state, NULL, ++ VCHIQ_MAKE_MSG(VCHIQ_MSG_PAUSE, 0, 0), ++ NULL, 0, 0, ++ QMFLAGS_NO_MUTEX_UNLOCK) ++ != VCHIQ_RETRY) { ++ vchiq_set_conn_state(state, ++ VCHIQ_CONNSTATE_PAUSE_SENT); ++ } else { ++ if (state->is_master) ++ resume_bulks(state); ++ /* Retry later */ ++ state->poll_needed = 1; ++ } ++ break; ++ ++ case VCHIQ_CONNSTATE_PAUSED: ++ vchiq_platform_resume(state); ++ break; ++ ++ case VCHIQ_CONNSTATE_RESUMING: ++ if (queue_message(state, NULL, ++ VCHIQ_MAKE_MSG(VCHIQ_MSG_RESUME, 0, 0), ++ NULL, 0, 0, QMFLAGS_NO_MUTEX_LOCK) ++ != VCHIQ_RETRY) { ++ if (state->is_master) ++ resume_bulks(state); ++ vchiq_set_conn_state(state, ++ VCHIQ_CONNSTATE_CONNECTED); ++ vchiq_platform_resumed(state); ++ } else { ++ /* This should really be impossible, ++ ** since the PAUSE should have flushed ++ ** through outstanding messages. */ ++ vchiq_log_error(vchiq_core_log_level, ++ "Failed to send RESUME " ++ "message"); ++ BUG(); ++ } ++ break; ++ ++ case VCHIQ_CONNSTATE_PAUSE_TIMEOUT: ++ case VCHIQ_CONNSTATE_RESUME_TIMEOUT: ++ vchiq_platform_handle_timeout(state); ++ break; ++ default: ++ break; ++ } ++ ++ ++ } ++ ++ DEBUG_TRACE(SLOT_HANDLER_LINE); ++ parse_rx_slots(state); ++ } ++ return 0; ++} ++ ++ ++/* Called by the recycle thread */ ++static int ++recycle_func(void *v) ++{ ++ VCHIQ_STATE_T *state = (VCHIQ_STATE_T *) v; ++ VCHIQ_SHARED_STATE_T *local = state->local; ++ ++ while (1) { ++ remote_event_wait(&local->recycle); ++ ++ process_free_queue(state); ++ } ++ return 0; ++} ++ ++ ++/* Called by the sync thread */ ++static int ++sync_func(void *v) ++{ ++ VCHIQ_STATE_T *state = (VCHIQ_STATE_T *) v; ++ VCHIQ_SHARED_STATE_T *local = state->local; ++ VCHIQ_HEADER_T *header = (VCHIQ_HEADER_T *)SLOT_DATA_FROM_INDEX(state, ++ state->remote->slot_sync); ++ ++ while (1) { ++ VCHIQ_SERVICE_T *service; ++ int msgid, size; ++ int type; ++ unsigned int localport, remoteport; ++ ++ remote_event_wait(&local->sync_trigger); ++ ++ rmb(); ++ ++ msgid = header->msgid; ++ size = header->size; ++ type = VCHIQ_MSG_TYPE(msgid); ++ localport = VCHIQ_MSG_DSTPORT(msgid); ++ remoteport = VCHIQ_MSG_SRCPORT(msgid); ++ ++ service = find_service_by_port(state, localport); ++ ++ if (!service) { ++ vchiq_log_error(vchiq_sync_log_level, ++ "%d: sf %s@%x (%d->%d) - " ++ "invalid/closed service %d", ++ state->id, msg_type_str(type), ++ (unsigned int)header, ++ remoteport, localport, localport); ++ release_message_sync(state, header); ++ continue; ++ } ++ ++ if (vchiq_sync_log_level >= VCHIQ_LOG_TRACE) { ++ int svc_fourcc; ++ ++ svc_fourcc = service ++ ? service->base.fourcc ++ : VCHIQ_MAKE_FOURCC('?', '?', '?', '?'); ++ vchiq_log_trace(vchiq_sync_log_level, ++ "Rcvd Msg %s from %c%c%c%c s:%d d:%d len:%d", ++ msg_type_str(type), ++ VCHIQ_FOURCC_AS_4CHARS(svc_fourcc), ++ remoteport, localport, size); ++ if (size > 0) ++ vchiq_log_dump_mem("Rcvd", 0, header->data, ++ min(16, size)); ++ } ++ ++ switch (type) { ++ case VCHIQ_MSG_OPENACK: ++ if (size >= sizeof(struct vchiq_openack_payload)) { ++ const struct vchiq_openack_payload *payload = ++ (struct vchiq_openack_payload *) ++ header->data; ++ service->peer_version = payload->version; ++ } ++ vchiq_log_info(vchiq_sync_log_level, ++ "%d: sf OPENACK@%x,%x (%d->%d) v:%d", ++ state->id, (unsigned int)header, size, ++ remoteport, localport, service->peer_version); ++ if (service->srvstate == VCHIQ_SRVSTATE_OPENING) { ++ service->remoteport = remoteport; ++ vchiq_set_service_state(service, ++ VCHIQ_SRVSTATE_OPENSYNC); ++ service->sync = 1; ++ up(&service->remove_event); ++ } ++ release_message_sync(state, header); ++ break; ++ ++ case VCHIQ_MSG_DATA: ++ vchiq_log_trace(vchiq_sync_log_level, ++ "%d: sf DATA@%x,%x (%d->%d)", ++ state->id, (unsigned int)header, size, ++ remoteport, localport); ++ ++ if ((service->remoteport == remoteport) && ++ (service->srvstate == ++ VCHIQ_SRVSTATE_OPENSYNC)) { ++ if (make_service_callback(service, ++ VCHIQ_MESSAGE_AVAILABLE, header, ++ NULL) == VCHIQ_RETRY) ++ vchiq_log_error(vchiq_sync_log_level, ++ "synchronous callback to " ++ "service %d returns " ++ "VCHIQ_RETRY", ++ localport); ++ } ++ break; ++ ++ default: ++ vchiq_log_error(vchiq_sync_log_level, ++ "%d: sf unexpected msgid %x@%x,%x", ++ state->id, msgid, (unsigned int)header, size); ++ release_message_sync(state, header); ++ break; ++ } ++ ++ unlock_service(service); ++ } ++ ++ return 0; ++} ++ ++ ++static void ++init_bulk_queue(VCHIQ_BULK_QUEUE_T *queue) ++{ ++ queue->local_insert = 0; ++ queue->remote_insert = 0; ++ queue->process = 0; ++ queue->remote_notify = 0; ++ queue->remove = 0; ++} ++ ++ ++inline const char * ++get_conn_state_name(VCHIQ_CONNSTATE_T conn_state) ++{ ++ return conn_state_names[conn_state]; ++} ++ ++ ++VCHIQ_SLOT_ZERO_T * ++vchiq_init_slots(void *mem_base, int mem_size) ++{ ++ int mem_align = (VCHIQ_SLOT_SIZE - (int)mem_base) & VCHIQ_SLOT_MASK; ++ VCHIQ_SLOT_ZERO_T *slot_zero = ++ (VCHIQ_SLOT_ZERO_T *)((char *)mem_base + mem_align); ++ int num_slots = (mem_size - mem_align)/VCHIQ_SLOT_SIZE; ++ int first_data_slot = VCHIQ_SLOT_ZERO_SLOTS; ++ ++ /* Ensure there is enough memory to run an absolutely minimum system */ ++ num_slots -= first_data_slot; ++ ++ if (num_slots < 4) { ++ vchiq_log_error(vchiq_core_log_level, ++ "vchiq_init_slots - insufficient memory %x bytes", ++ mem_size); ++ return NULL; ++ } ++ ++ memset(slot_zero, 0, sizeof(VCHIQ_SLOT_ZERO_T)); ++ ++ slot_zero->magic = VCHIQ_MAGIC; ++ slot_zero->version = VCHIQ_VERSION; ++ slot_zero->version_min = VCHIQ_VERSION_MIN; ++ slot_zero->slot_zero_size = sizeof(VCHIQ_SLOT_ZERO_T); ++ slot_zero->slot_size = VCHIQ_SLOT_SIZE; ++ slot_zero->max_slots = VCHIQ_MAX_SLOTS; ++ slot_zero->max_slots_per_side = VCHIQ_MAX_SLOTS_PER_SIDE; ++ ++ slot_zero->master.slot_sync = first_data_slot; ++ slot_zero->master.slot_first = first_data_slot + 1; ++ slot_zero->master.slot_last = first_data_slot + (num_slots/2) - 1; ++ slot_zero->slave.slot_sync = first_data_slot + (num_slots/2); ++ slot_zero->slave.slot_first = first_data_slot + (num_slots/2) + 1; ++ slot_zero->slave.slot_last = first_data_slot + num_slots - 1; ++ ++ return slot_zero; ++} ++ ++VCHIQ_STATUS_T ++vchiq_init_state(VCHIQ_STATE_T *state, VCHIQ_SLOT_ZERO_T *slot_zero, ++ int is_master) ++{ ++ VCHIQ_SHARED_STATE_T *local; ++ VCHIQ_SHARED_STATE_T *remote; ++ VCHIQ_STATUS_T status; ++ char threadname[10]; ++ static int id; ++ int i; ++ ++ vchiq_log_warning(vchiq_core_log_level, ++ "%s: slot_zero = 0x%08lx, is_master = %d", ++ __func__, (unsigned long)slot_zero, is_master); ++ ++ /* Check the input configuration */ ++ ++ if (slot_zero->magic != VCHIQ_MAGIC) { ++ vchiq_loud_error_header(); ++ vchiq_loud_error("Invalid VCHIQ magic value found."); ++ vchiq_loud_error("slot_zero=%x: magic=%x (expected %x)", ++ (unsigned int)slot_zero, slot_zero->magic, VCHIQ_MAGIC); ++ vchiq_loud_error_footer(); ++ return VCHIQ_ERROR; ++ } ++ ++ if (slot_zero->version < VCHIQ_VERSION_MIN) { ++ vchiq_loud_error_header(); ++ vchiq_loud_error("Incompatible VCHIQ versions found."); ++ vchiq_loud_error("slot_zero=%x: VideoCore version=%d " ++ "(minimum %d)", ++ (unsigned int)slot_zero, slot_zero->version, ++ VCHIQ_VERSION_MIN); ++ vchiq_loud_error("Restart with a newer VideoCore image."); ++ vchiq_loud_error_footer(); ++ return VCHIQ_ERROR; ++ } ++ ++ if (VCHIQ_VERSION < slot_zero->version_min) { ++ vchiq_loud_error_header(); ++ vchiq_loud_error("Incompatible VCHIQ versions found."); ++ vchiq_loud_error("slot_zero=%x: version=%d (VideoCore " ++ "minimum %d)", ++ (unsigned int)slot_zero, VCHIQ_VERSION, ++ slot_zero->version_min); ++ vchiq_loud_error("Restart with a newer kernel."); ++ vchiq_loud_error_footer(); ++ return VCHIQ_ERROR; ++ } ++ ++ if ((slot_zero->slot_zero_size != sizeof(VCHIQ_SLOT_ZERO_T)) || ++ (slot_zero->slot_size != VCHIQ_SLOT_SIZE) || ++ (slot_zero->max_slots != VCHIQ_MAX_SLOTS) || ++ (slot_zero->max_slots_per_side != VCHIQ_MAX_SLOTS_PER_SIDE)) { ++ vchiq_loud_error_header(); ++ if (slot_zero->slot_zero_size != sizeof(VCHIQ_SLOT_ZERO_T)) ++ vchiq_loud_error("slot_zero=%x: slot_zero_size=%x " ++ "(expected %x)", ++ (unsigned int)slot_zero, ++ slot_zero->slot_zero_size, ++ sizeof(VCHIQ_SLOT_ZERO_T)); ++ if (slot_zero->slot_size != VCHIQ_SLOT_SIZE) ++ vchiq_loud_error("slot_zero=%x: slot_size=%d " ++ "(expected %d", ++ (unsigned int)slot_zero, slot_zero->slot_size, ++ VCHIQ_SLOT_SIZE); ++ if (slot_zero->max_slots != VCHIQ_MAX_SLOTS) ++ vchiq_loud_error("slot_zero=%x: max_slots=%d " ++ "(expected %d)", ++ (unsigned int)slot_zero, slot_zero->max_slots, ++ VCHIQ_MAX_SLOTS); ++ if (slot_zero->max_slots_per_side != VCHIQ_MAX_SLOTS_PER_SIDE) ++ vchiq_loud_error("slot_zero=%x: max_slots_per_side=%d " ++ "(expected %d)", ++ (unsigned int)slot_zero, ++ slot_zero->max_slots_per_side, ++ VCHIQ_MAX_SLOTS_PER_SIDE); ++ vchiq_loud_error_footer(); ++ return VCHIQ_ERROR; ++ } ++ ++ if (VCHIQ_VERSION < slot_zero->version) ++ slot_zero->version = VCHIQ_VERSION; ++ ++ if (is_master) { ++ local = &slot_zero->master; ++ remote = &slot_zero->slave; ++ } else { ++ local = &slot_zero->slave; ++ remote = &slot_zero->master; ++ } ++ ++ if (local->initialised) { ++ vchiq_loud_error_header(); ++ if (remote->initialised) ++ vchiq_loud_error("local state has already been " ++ "initialised"); ++ else ++ vchiq_loud_error("master/slave mismatch - two %ss", ++ is_master ? "master" : "slave"); ++ vchiq_loud_error_footer(); ++ return VCHIQ_ERROR; ++ } ++ ++ memset(state, 0, sizeof(VCHIQ_STATE_T)); ++ ++ state->id = id++; ++ state->is_master = is_master; ++ ++ /* ++ initialize shared state pointers ++ */ ++ ++ state->local = local; ++ state->remote = remote; ++ state->slot_data = (VCHIQ_SLOT_T *)slot_zero; ++ ++ /* ++ initialize events and mutexes ++ */ ++ ++ sema_init(&state->connect, 0); ++ mutex_init(&state->mutex); ++ sema_init(&state->trigger_event, 0); ++ sema_init(&state->recycle_event, 0); ++ sema_init(&state->sync_trigger_event, 0); ++ sema_init(&state->sync_release_event, 0); ++ ++ mutex_init(&state->slot_mutex); ++ mutex_init(&state->recycle_mutex); ++ mutex_init(&state->sync_mutex); ++ mutex_init(&state->bulk_transfer_mutex); ++ ++ sema_init(&state->slot_available_event, 0); ++ sema_init(&state->slot_remove_event, 0); ++ sema_init(&state->data_quota_event, 0); ++ ++ state->slot_queue_available = 0; ++ ++ for (i = 0; i < VCHIQ_MAX_SERVICES; i++) { ++ VCHIQ_SERVICE_QUOTA_T *service_quota = ++ &state->service_quotas[i]; ++ sema_init(&service_quota->quota_event, 0); ++ } ++ ++ for (i = local->slot_first; i <= local->slot_last; i++) { ++ local->slot_queue[state->slot_queue_available++] = i; ++ up(&state->slot_available_event); ++ } ++ ++ state->default_slot_quota = state->slot_queue_available/2; ++ state->default_message_quota = ++ min((unsigned short)(state->default_slot_quota * 256), ++ (unsigned short)~0); ++ ++ state->previous_data_index = -1; ++ state->data_use_count = 0; ++ state->data_quota = state->slot_queue_available - 1; ++ ++ local->trigger.event = &state->trigger_event; ++ remote_event_create(&local->trigger); ++ local->tx_pos = 0; ++ ++ local->recycle.event = &state->recycle_event; ++ remote_event_create(&local->recycle); ++ local->slot_queue_recycle = state->slot_queue_available; ++ ++ local->sync_trigger.event = &state->sync_trigger_event; ++ remote_event_create(&local->sync_trigger); ++ ++ local->sync_release.event = &state->sync_release_event; ++ remote_event_create(&local->sync_release); ++ ++ /* At start-of-day, the slot is empty and available */ ++ ((VCHIQ_HEADER_T *)SLOT_DATA_FROM_INDEX(state, local->slot_sync))->msgid ++ = VCHIQ_MSGID_PADDING; ++ remote_event_signal_local(&local->sync_release); ++ ++ local->debug[DEBUG_ENTRIES] = DEBUG_MAX; ++ ++ status = vchiq_platform_init_state(state); ++ ++ /* ++ bring up slot handler thread ++ */ ++ snprintf(threadname, sizeof(threadname), "VCHIQ-%d", state->id); ++ state->slot_handler_thread = kthread_create(&slot_handler_func, ++ (void *)state, ++ threadname); ++ ++ if (state->slot_handler_thread == NULL) { ++ vchiq_loud_error_header(); ++ vchiq_loud_error("couldn't create thread %s", threadname); ++ vchiq_loud_error_footer(); ++ return VCHIQ_ERROR; ++ } ++ set_user_nice(state->slot_handler_thread, -19); ++ wake_up_process(state->slot_handler_thread); ++ ++ snprintf(threadname, sizeof(threadname), "VCHIQr-%d", state->id); ++ state->recycle_thread = kthread_create(&recycle_func, ++ (void *)state, ++ threadname); ++ if (state->recycle_thread == NULL) { ++ vchiq_loud_error_header(); ++ vchiq_loud_error("couldn't create thread %s", threadname); ++ vchiq_loud_error_footer(); ++ return VCHIQ_ERROR; ++ } ++ set_user_nice(state->recycle_thread, -19); ++ wake_up_process(state->recycle_thread); ++ ++ snprintf(threadname, sizeof(threadname), "VCHIQs-%d", state->id); ++ state->sync_thread = kthread_create(&sync_func, ++ (void *)state, ++ threadname); ++ if (state->sync_thread == NULL) { ++ vchiq_loud_error_header(); ++ vchiq_loud_error("couldn't create thread %s", threadname); ++ vchiq_loud_error_footer(); ++ return VCHIQ_ERROR; ++ } ++ set_user_nice(state->sync_thread, -20); ++ wake_up_process(state->sync_thread); ++ ++ BUG_ON(state->id >= VCHIQ_MAX_STATES); ++ vchiq_states[state->id] = state; ++ ++ /* Indicate readiness to the other side */ ++ local->initialised = 1; ++ ++ return status; ++} ++ ++/* Called from application thread when a client or server service is created. */ ++VCHIQ_SERVICE_T * ++vchiq_add_service_internal(VCHIQ_STATE_T *state, ++ const VCHIQ_SERVICE_PARAMS_T *params, int srvstate, ++ VCHIQ_INSTANCE_T instance, VCHIQ_USERDATA_TERM_T userdata_term) ++{ ++ VCHIQ_SERVICE_T *service; ++ ++ service = kmalloc(sizeof(VCHIQ_SERVICE_T), GFP_KERNEL); ++ if (service) { ++ service->base.fourcc = params->fourcc; ++ service->base.callback = params->callback; ++ service->base.userdata = params->userdata; ++ service->handle = VCHIQ_SERVICE_HANDLE_INVALID; ++ service->ref_count = 1; ++ service->srvstate = VCHIQ_SRVSTATE_FREE; ++ service->userdata_term = userdata_term; ++ service->localport = VCHIQ_PORT_FREE; ++ service->remoteport = VCHIQ_PORT_FREE; ++ ++ service->public_fourcc = (srvstate == VCHIQ_SRVSTATE_OPENING) ? ++ VCHIQ_FOURCC_INVALID : params->fourcc; ++ service->client_id = 0; ++ service->auto_close = 1; ++ service->sync = 0; ++ service->closing = 0; ++ service->trace = 0; ++ atomic_set(&service->poll_flags, 0); ++ service->version = params->version; ++ service->version_min = params->version_min; ++ service->state = state; ++ service->instance = instance; ++ service->service_use_count = 0; ++ init_bulk_queue(&service->bulk_tx); ++ init_bulk_queue(&service->bulk_rx); ++ sema_init(&service->remove_event, 0); ++ sema_init(&service->bulk_remove_event, 0); ++ mutex_init(&service->bulk_mutex); ++ memset(&service->stats, 0, sizeof(service->stats)); ++ } else { ++ vchiq_log_error(vchiq_core_log_level, ++ "Out of memory"); ++ } ++ ++ if (service) { ++ VCHIQ_SERVICE_T **pservice = NULL; ++ int i; ++ ++ /* Although it is perfectly possible to use service_spinlock ++ ** to protect the creation of services, it is overkill as it ++ ** disables interrupts while the array is searched. ++ ** The only danger is of another thread trying to create a ++ ** service - service deletion is safe. ++ ** Therefore it is preferable to use state->mutex which, ++ ** although slower to claim, doesn't block interrupts while ++ ** it is held. ++ */ ++ ++ mutex_lock(&state->mutex); ++ ++ /* Prepare to use a previously unused service */ ++ if (state->unused_service < VCHIQ_MAX_SERVICES) ++ pservice = &state->services[state->unused_service]; ++ ++ if (srvstate == VCHIQ_SRVSTATE_OPENING) { ++ for (i = 0; i < state->unused_service; i++) { ++ VCHIQ_SERVICE_T *srv = state->services[i]; ++ if (!srv) { ++ pservice = &state->services[i]; ++ break; ++ } ++ } ++ } else { ++ for (i = (state->unused_service - 1); i >= 0; i--) { ++ VCHIQ_SERVICE_T *srv = state->services[i]; ++ if (!srv) ++ pservice = &state->services[i]; ++ else if ((srv->public_fourcc == params->fourcc) ++ && ((srv->instance != instance) || ++ (srv->base.callback != ++ params->callback))) { ++ /* There is another server using this ++ ** fourcc which doesn't match. */ ++ pservice = NULL; ++ break; ++ } ++ } ++ } ++ ++ if (pservice) { ++ service->localport = (pservice - state->services); ++ if (!handle_seq) ++ handle_seq = VCHIQ_MAX_STATES * ++ VCHIQ_MAX_SERVICES; ++ service->handle = handle_seq | ++ (state->id * VCHIQ_MAX_SERVICES) | ++ service->localport; ++ handle_seq += VCHIQ_MAX_STATES * VCHIQ_MAX_SERVICES; ++ *pservice = service; ++ if (pservice == &state->services[state->unused_service]) ++ state->unused_service++; ++ } ++ ++ mutex_unlock(&state->mutex); ++ ++ if (!pservice) { ++ kfree(service); ++ service = NULL; ++ } ++ } ++ ++ if (service) { ++ VCHIQ_SERVICE_QUOTA_T *service_quota = ++ &state->service_quotas[service->localport]; ++ service_quota->slot_quota = state->default_slot_quota; ++ service_quota->message_quota = state->default_message_quota; ++ if (service_quota->slot_use_count == 0) ++ service_quota->previous_tx_index = ++ SLOT_QUEUE_INDEX_FROM_POS(state->local_tx_pos) ++ - 1; ++ ++ /* Bring this service online */ ++ vchiq_set_service_state(service, srvstate); ++ ++ vchiq_log_info(vchiq_core_msg_log_level, ++ "%s Service %c%c%c%c SrcPort:%d", ++ (srvstate == VCHIQ_SRVSTATE_OPENING) ++ ? "Open" : "Add", ++ VCHIQ_FOURCC_AS_4CHARS(params->fourcc), ++ service->localport); ++ } ++ ++ /* Don't unlock the service - leave it with a ref_count of 1. */ ++ ++ return service; ++} ++ ++VCHIQ_STATUS_T ++vchiq_open_service_internal(VCHIQ_SERVICE_T *service, int client_id) ++{ ++ struct vchiq_open_payload payload = { ++ service->base.fourcc, ++ client_id, ++ service->version, ++ service->version_min ++ }; ++ VCHIQ_ELEMENT_T body = { &payload, sizeof(payload) }; ++ VCHIQ_STATUS_T status = VCHIQ_SUCCESS; ++ ++ service->client_id = client_id; ++ vchiq_use_service_internal(service); ++ status = queue_message(service->state, NULL, ++ VCHIQ_MAKE_MSG(VCHIQ_MSG_OPEN, service->localport, 0), ++ &body, 1, sizeof(payload), QMFLAGS_IS_BLOCKING); ++ if (status == VCHIQ_SUCCESS) { ++ /* Wait for the ACK/NAK */ ++ if (down_interruptible(&service->remove_event) != 0) { ++ status = VCHIQ_RETRY; ++ vchiq_release_service_internal(service); ++ } else if ((service->srvstate != VCHIQ_SRVSTATE_OPEN) && ++ (service->srvstate != VCHIQ_SRVSTATE_OPENSYNC)) { ++ if (service->srvstate != VCHIQ_SRVSTATE_CLOSEWAIT) ++ vchiq_log_error(vchiq_core_log_level, ++ "%d: osi - srvstate = %s (ref %d)", ++ service->state->id, ++ srvstate_names[service->srvstate], ++ service->ref_count); ++ status = VCHIQ_ERROR; ++ VCHIQ_SERVICE_STATS_INC(service, error_count); ++ vchiq_release_service_internal(service); ++ } ++ } ++ return status; ++} ++ ++static void ++release_service_messages(VCHIQ_SERVICE_T *service) ++{ ++ VCHIQ_STATE_T *state = service->state; ++ int slot_last = state->remote->slot_last; ++ int i; ++ ++ /* Release any claimed messages aimed at this service */ ++ ++ if (service->sync) { ++ VCHIQ_HEADER_T *header = ++ (VCHIQ_HEADER_T *)SLOT_DATA_FROM_INDEX(state, ++ state->remote->slot_sync); ++ if (VCHIQ_MSG_DSTPORT(header->msgid) == service->localport) ++ release_message_sync(state, header); ++ ++ return; ++ } ++ ++ for (i = state->remote->slot_first; i <= slot_last; i++) { ++ VCHIQ_SLOT_INFO_T *slot_info = ++ SLOT_INFO_FROM_INDEX(state, i); ++ if (slot_info->release_count != slot_info->use_count) { ++ char *data = ++ (char *)SLOT_DATA_FROM_INDEX(state, i); ++ unsigned int pos, end; ++ ++ end = VCHIQ_SLOT_SIZE; ++ if (data == state->rx_data) ++ /* This buffer is still being read from - stop ++ ** at the current read position */ ++ end = state->rx_pos & VCHIQ_SLOT_MASK; ++ ++ pos = 0; ++ ++ while (pos < end) { ++ VCHIQ_HEADER_T *header = ++ (VCHIQ_HEADER_T *)(data + pos); ++ int msgid = header->msgid; ++ int port = VCHIQ_MSG_DSTPORT(msgid); ++ if ((port == service->localport) && ++ (msgid & VCHIQ_MSGID_CLAIMED)) { ++ vchiq_log_info(vchiq_core_log_level, ++ " fsi - hdr %x", ++ (unsigned int)header); ++ release_slot(state, slot_info, header, ++ NULL); ++ } ++ pos += calc_stride(header->size); ++ if (pos > VCHIQ_SLOT_SIZE) { ++ vchiq_log_error(vchiq_core_log_level, ++ "fsi - pos %x: header %x, " ++ "msgid %x, header->msgid %x, " ++ "header->size %x", ++ pos, (unsigned int)header, ++ msgid, header->msgid, ++ header->size); ++ WARN(1, "invalid slot position\n"); ++ } ++ } ++ } ++ } ++} ++ ++static int ++do_abort_bulks(VCHIQ_SERVICE_T *service) ++{ ++ VCHIQ_STATUS_T status; ++ ++ /* Abort any outstanding bulk transfers */ ++ if (mutex_lock_interruptible(&service->bulk_mutex) != 0) ++ return 0; ++ abort_outstanding_bulks(service, &service->bulk_tx); ++ abort_outstanding_bulks(service, &service->bulk_rx); ++ mutex_unlock(&service->bulk_mutex); ++ ++ status = notify_bulks(service, &service->bulk_tx, 0/*!retry_poll*/); ++ if (status == VCHIQ_SUCCESS) ++ status = notify_bulks(service, &service->bulk_rx, ++ 0/*!retry_poll*/); ++ return (status == VCHIQ_SUCCESS); ++} ++ ++static VCHIQ_STATUS_T ++close_service_complete(VCHIQ_SERVICE_T *service, int failstate) ++{ ++ VCHIQ_STATUS_T status; ++ int is_server = (service->public_fourcc != VCHIQ_FOURCC_INVALID); ++ int newstate; ++ ++ switch (service->srvstate) { ++ case VCHIQ_SRVSTATE_OPEN: ++ case VCHIQ_SRVSTATE_CLOSESENT: ++ case VCHIQ_SRVSTATE_CLOSERECVD: ++ if (is_server) { ++ if (service->auto_close) { ++ service->client_id = 0; ++ service->remoteport = VCHIQ_PORT_FREE; ++ newstate = VCHIQ_SRVSTATE_LISTENING; ++ } else ++ newstate = VCHIQ_SRVSTATE_CLOSEWAIT; ++ } else ++ newstate = VCHIQ_SRVSTATE_CLOSED; ++ vchiq_set_service_state(service, newstate); ++ break; ++ case VCHIQ_SRVSTATE_LISTENING: ++ break; ++ default: ++ vchiq_log_error(vchiq_core_log_level, ++ "close_service_complete(%x) called in state %s", ++ service->handle, srvstate_names[service->srvstate]); ++ WARN(1, "close_service_complete in unexpected state\n"); ++ return VCHIQ_ERROR; ++ } ++ ++ status = make_service_callback(service, ++ VCHIQ_SERVICE_CLOSED, NULL, NULL); ++ ++ if (status != VCHIQ_RETRY) { ++ int uc = service->service_use_count; ++ int i; ++ /* Complete the close process */ ++ for (i = 0; i < uc; i++) ++ /* cater for cases where close is forced and the ++ ** client may not close all it's handles */ ++ vchiq_release_service_internal(service); ++ ++ service->client_id = 0; ++ service->remoteport = VCHIQ_PORT_FREE; ++ ++ if (service->srvstate == VCHIQ_SRVSTATE_CLOSED) ++ vchiq_free_service_internal(service); ++ else if (service->srvstate != VCHIQ_SRVSTATE_CLOSEWAIT) { ++ if (is_server) ++ service->closing = 0; ++ ++ up(&service->remove_event); ++ } ++ } else ++ vchiq_set_service_state(service, failstate); ++ ++ return status; ++} ++ ++/* Called by the slot handler */ ++VCHIQ_STATUS_T ++vchiq_close_service_internal(VCHIQ_SERVICE_T *service, int close_recvd) ++{ ++ VCHIQ_STATE_T *state = service->state; ++ VCHIQ_STATUS_T status = VCHIQ_SUCCESS; ++ int is_server = (service->public_fourcc != VCHIQ_FOURCC_INVALID); ++ ++ vchiq_log_info(vchiq_core_log_level, "%d: csi:%d,%d (%s)", ++ service->state->id, service->localport, close_recvd, ++ srvstate_names[service->srvstate]); ++ ++ switch (service->srvstate) { ++ case VCHIQ_SRVSTATE_CLOSED: ++ case VCHIQ_SRVSTATE_HIDDEN: ++ case VCHIQ_SRVSTATE_LISTENING: ++ case VCHIQ_SRVSTATE_CLOSEWAIT: ++ if (close_recvd) ++ vchiq_log_error(vchiq_core_log_level, ++ "vchiq_close_service_internal(1) called " ++ "in state %s", ++ srvstate_names[service->srvstate]); ++ else if (is_server) { ++ if (service->srvstate == VCHIQ_SRVSTATE_LISTENING) { ++ status = VCHIQ_ERROR; ++ } else { ++ service->client_id = 0; ++ service->remoteport = VCHIQ_PORT_FREE; ++ if (service->srvstate == ++ VCHIQ_SRVSTATE_CLOSEWAIT) ++ vchiq_set_service_state(service, ++ VCHIQ_SRVSTATE_LISTENING); ++ } ++ up(&service->remove_event); ++ } else ++ vchiq_free_service_internal(service); ++ break; ++ case VCHIQ_SRVSTATE_OPENING: ++ if (close_recvd) { ++ /* The open was rejected - tell the user */ ++ vchiq_set_service_state(service, ++ VCHIQ_SRVSTATE_CLOSEWAIT); ++ up(&service->remove_event); ++ } else { ++ /* Shutdown mid-open - let the other side know */ ++ status = queue_message(state, service, ++ VCHIQ_MAKE_MSG ++ (VCHIQ_MSG_CLOSE, ++ service->localport, ++ VCHIQ_MSG_DSTPORT(service->remoteport)), ++ NULL, 0, 0, 0); ++ } ++ break; ++ ++ case VCHIQ_SRVSTATE_OPENSYNC: ++ mutex_lock(&state->sync_mutex); ++ /* Drop through */ ++ ++ case VCHIQ_SRVSTATE_OPEN: ++ if (state->is_master || close_recvd) { ++ if (!do_abort_bulks(service)) ++ status = VCHIQ_RETRY; ++ } ++ ++ release_service_messages(service); ++ ++ if (status == VCHIQ_SUCCESS) ++ status = queue_message(state, service, ++ VCHIQ_MAKE_MSG ++ (VCHIQ_MSG_CLOSE, ++ service->localport, ++ VCHIQ_MSG_DSTPORT(service->remoteport)), ++ NULL, 0, 0, QMFLAGS_NO_MUTEX_UNLOCK); ++ ++ if (status == VCHIQ_SUCCESS) { ++ if (!close_recvd) { ++ /* Change the state while the mutex is ++ still held */ ++ vchiq_set_service_state(service, ++ VCHIQ_SRVSTATE_CLOSESENT); ++ mutex_unlock(&state->slot_mutex); ++ if (service->sync) ++ mutex_unlock(&state->sync_mutex); ++ break; ++ } ++ } else if (service->srvstate == VCHIQ_SRVSTATE_OPENSYNC) { ++ mutex_unlock(&state->sync_mutex); ++ break; ++ } else ++ break; ++ ++ /* Change the state while the mutex is still held */ ++ vchiq_set_service_state(service, VCHIQ_SRVSTATE_CLOSERECVD); ++ mutex_unlock(&state->slot_mutex); ++ if (service->sync) ++ mutex_unlock(&state->sync_mutex); ++ ++ status = close_service_complete(service, ++ VCHIQ_SRVSTATE_CLOSERECVD); ++ break; ++ ++ case VCHIQ_SRVSTATE_CLOSESENT: ++ if (!close_recvd) ++ /* This happens when a process is killed mid-close */ ++ break; ++ ++ if (!state->is_master) { ++ if (!do_abort_bulks(service)) { ++ status = VCHIQ_RETRY; ++ break; ++ } ++ } ++ ++ if (status == VCHIQ_SUCCESS) ++ status = close_service_complete(service, ++ VCHIQ_SRVSTATE_CLOSERECVD); ++ break; ++ ++ case VCHIQ_SRVSTATE_CLOSERECVD: ++ if (!close_recvd && is_server) ++ /* Force into LISTENING mode */ ++ vchiq_set_service_state(service, ++ VCHIQ_SRVSTATE_LISTENING); ++ status = close_service_complete(service, ++ VCHIQ_SRVSTATE_CLOSERECVD); ++ break; ++ ++ default: ++ vchiq_log_error(vchiq_core_log_level, ++ "vchiq_close_service_internal(%d) called in state %s", ++ close_recvd, srvstate_names[service->srvstate]); ++ break; ++ } ++ ++ return status; ++} ++ ++/* Called from the application process upon process death */ ++void ++vchiq_terminate_service_internal(VCHIQ_SERVICE_T *service) ++{ ++ VCHIQ_STATE_T *state = service->state; ++ ++ vchiq_log_info(vchiq_core_log_level, "%d: tsi - (%d<->%d)", ++ state->id, service->localport, service->remoteport); ++ ++ mark_service_closing(service); ++ ++ /* Mark the service for removal by the slot handler */ ++ request_poll(state, service, VCHIQ_POLL_REMOVE); ++} ++ ++/* Called from the slot handler */ ++void ++vchiq_free_service_internal(VCHIQ_SERVICE_T *service) ++{ ++ VCHIQ_STATE_T *state = service->state; ++ ++ vchiq_log_info(vchiq_core_log_level, "%d: fsi - (%d)", ++ state->id, service->localport); ++ ++ switch (service->srvstate) { ++ case VCHIQ_SRVSTATE_OPENING: ++ case VCHIQ_SRVSTATE_CLOSED: ++ case VCHIQ_SRVSTATE_HIDDEN: ++ case VCHIQ_SRVSTATE_LISTENING: ++ case VCHIQ_SRVSTATE_CLOSEWAIT: ++ break; ++ default: ++ vchiq_log_error(vchiq_core_log_level, ++ "%d: fsi - (%d) in state %s", ++ state->id, service->localport, ++ srvstate_names[service->srvstate]); ++ return; ++ } ++ ++ vchiq_set_service_state(service, VCHIQ_SRVSTATE_FREE); ++ ++ up(&service->remove_event); ++ ++ /* Release the initial lock */ ++ unlock_service(service); ++} ++ ++VCHIQ_STATUS_T ++vchiq_connect_internal(VCHIQ_STATE_T *state, VCHIQ_INSTANCE_T instance) ++{ ++ VCHIQ_SERVICE_T *service; ++ int i; ++ ++ /* Find all services registered to this client and enable them. */ ++ i = 0; ++ while ((service = next_service_by_instance(state, instance, ++ &i)) != NULL) { ++ if (service->srvstate == VCHIQ_SRVSTATE_HIDDEN) ++ vchiq_set_service_state(service, ++ VCHIQ_SRVSTATE_LISTENING); ++ unlock_service(service); ++ } ++ ++ if (state->conn_state == VCHIQ_CONNSTATE_DISCONNECTED) { ++ if (queue_message(state, NULL, ++ VCHIQ_MAKE_MSG(VCHIQ_MSG_CONNECT, 0, 0), NULL, 0, ++ 0, QMFLAGS_IS_BLOCKING) == VCHIQ_RETRY) ++ return VCHIQ_RETRY; ++ ++ vchiq_set_conn_state(state, VCHIQ_CONNSTATE_CONNECTING); ++ } ++ ++ if (state->conn_state == VCHIQ_CONNSTATE_CONNECTING) { ++ if (down_interruptible(&state->connect) != 0) ++ return VCHIQ_RETRY; ++ ++ vchiq_set_conn_state(state, VCHIQ_CONNSTATE_CONNECTED); ++ up(&state->connect); ++ } ++ ++ return VCHIQ_SUCCESS; ++} ++ ++VCHIQ_STATUS_T ++vchiq_shutdown_internal(VCHIQ_STATE_T *state, VCHIQ_INSTANCE_T instance) ++{ ++ VCHIQ_SERVICE_T *service; ++ int i; ++ ++ /* Find all services registered to this client and enable them. */ ++ i = 0; ++ while ((service = next_service_by_instance(state, instance, ++ &i)) != NULL) { ++ (void)vchiq_remove_service(service->handle); ++ unlock_service(service); ++ } ++ ++ return VCHIQ_SUCCESS; ++} ++ ++VCHIQ_STATUS_T ++vchiq_pause_internal(VCHIQ_STATE_T *state) ++{ ++ VCHIQ_STATUS_T status = VCHIQ_SUCCESS; ++ ++ switch (state->conn_state) { ++ case VCHIQ_CONNSTATE_CONNECTED: ++ /* Request a pause */ ++ vchiq_set_conn_state(state, VCHIQ_CONNSTATE_PAUSING); ++ request_poll(state, NULL, 0); ++ break; ++ default: ++ vchiq_log_error(vchiq_core_log_level, ++ "vchiq_pause_internal in state %s\n", ++ conn_state_names[state->conn_state]); ++ status = VCHIQ_ERROR; ++ VCHIQ_STATS_INC(state, error_count); ++ break; ++ } ++ ++ return status; ++} ++ ++VCHIQ_STATUS_T ++vchiq_resume_internal(VCHIQ_STATE_T *state) ++{ ++ VCHIQ_STATUS_T status = VCHIQ_SUCCESS; ++ ++ if (state->conn_state == VCHIQ_CONNSTATE_PAUSED) { ++ vchiq_set_conn_state(state, VCHIQ_CONNSTATE_RESUMING); ++ request_poll(state, NULL, 0); ++ } else { ++ status = VCHIQ_ERROR; ++ VCHIQ_STATS_INC(state, error_count); ++ } ++ ++ return status; ++} ++ ++VCHIQ_STATUS_T ++vchiq_close_service(VCHIQ_SERVICE_HANDLE_T handle) ++{ ++ /* Unregister the service */ ++ VCHIQ_SERVICE_T *service = find_service_by_handle(handle); ++ VCHIQ_STATUS_T status = VCHIQ_SUCCESS; ++ ++ if (!service) ++ return VCHIQ_ERROR; ++ ++ vchiq_log_info(vchiq_core_log_level, ++ "%d: close_service:%d", ++ service->state->id, service->localport); ++ ++ if ((service->srvstate == VCHIQ_SRVSTATE_FREE) || ++ (service->srvstate == VCHIQ_SRVSTATE_LISTENING) || ++ (service->srvstate == VCHIQ_SRVSTATE_HIDDEN)) { ++ unlock_service(service); ++ return VCHIQ_ERROR; ++ } ++ ++ mark_service_closing(service); ++ ++ if (current == service->state->slot_handler_thread) { ++ status = vchiq_close_service_internal(service, ++ 0/*!close_recvd*/); ++ BUG_ON(status == VCHIQ_RETRY); ++ } else { ++ /* Mark the service for termination by the slot handler */ ++ request_poll(service->state, service, VCHIQ_POLL_TERMINATE); ++ } ++ ++ while (1) { ++ if (down_interruptible(&service->remove_event) != 0) { ++ status = VCHIQ_RETRY; ++ break; ++ } ++ ++ if ((service->srvstate == VCHIQ_SRVSTATE_FREE) || ++ (service->srvstate == VCHIQ_SRVSTATE_LISTENING) || ++ (service->srvstate == VCHIQ_SRVSTATE_OPEN)) ++ break; ++ ++ vchiq_log_warning(vchiq_core_log_level, ++ "%d: close_service:%d - waiting in state %s", ++ service->state->id, service->localport, ++ srvstate_names[service->srvstate]); ++ } ++ ++ if ((status == VCHIQ_SUCCESS) && ++ (service->srvstate != VCHIQ_SRVSTATE_FREE) && ++ (service->srvstate != VCHIQ_SRVSTATE_LISTENING)) ++ status = VCHIQ_ERROR; ++ ++ unlock_service(service); ++ ++ return status; ++} ++ ++VCHIQ_STATUS_T ++vchiq_remove_service(VCHIQ_SERVICE_HANDLE_T handle) ++{ ++ /* Unregister the service */ ++ VCHIQ_SERVICE_T *service = find_service_by_handle(handle); ++ VCHIQ_STATUS_T status = VCHIQ_SUCCESS; ++ ++ if (!service) ++ return VCHIQ_ERROR; ++ ++ vchiq_log_info(vchiq_core_log_level, ++ "%d: remove_service:%d", ++ service->state->id, service->localport); ++ ++ if (service->srvstate == VCHIQ_SRVSTATE_FREE) { ++ unlock_service(service); ++ return VCHIQ_ERROR; ++ } ++ ++ mark_service_closing(service); ++ ++ if ((service->srvstate == VCHIQ_SRVSTATE_HIDDEN) || ++ (current == service->state->slot_handler_thread)) { ++ /* Make it look like a client, because it must be removed and ++ not left in the LISTENING state. */ ++ service->public_fourcc = VCHIQ_FOURCC_INVALID; ++ ++ status = vchiq_close_service_internal(service, ++ 0/*!close_recvd*/); ++ BUG_ON(status == VCHIQ_RETRY); ++ } else { ++ /* Mark the service for removal by the slot handler */ ++ request_poll(service->state, service, VCHIQ_POLL_REMOVE); ++ } ++ while (1) { ++ if (down_interruptible(&service->remove_event) != 0) { ++ status = VCHIQ_RETRY; ++ break; ++ } ++ ++ if ((service->srvstate == VCHIQ_SRVSTATE_FREE) || ++ (service->srvstate == VCHIQ_SRVSTATE_OPEN)) ++ break; ++ ++ vchiq_log_warning(vchiq_core_log_level, ++ "%d: remove_service:%d - waiting in state %s", ++ service->state->id, service->localport, ++ srvstate_names[service->srvstate]); ++ } ++ ++ if ((status == VCHIQ_SUCCESS) && ++ (service->srvstate != VCHIQ_SRVSTATE_FREE)) ++ status = VCHIQ_ERROR; ++ ++ unlock_service(service); ++ ++ return status; ++} ++ ++ ++/* This function may be called by kernel threads or user threads. ++ * User threads may receive VCHIQ_RETRY to indicate that a signal has been ++ * received and the call should be retried after being returned to user ++ * context. ++ * When called in blocking mode, the userdata field points to a bulk_waiter ++ * structure. ++ */ ++VCHIQ_STATUS_T ++vchiq_bulk_transfer(VCHIQ_SERVICE_HANDLE_T handle, ++ VCHI_MEM_HANDLE_T memhandle, void *offset, int size, void *userdata, ++ VCHIQ_BULK_MODE_T mode, VCHIQ_BULK_DIR_T dir) ++{ ++ VCHIQ_SERVICE_T *service = find_service_by_handle(handle); ++ VCHIQ_BULK_QUEUE_T *queue; ++ VCHIQ_BULK_T *bulk; ++ VCHIQ_STATE_T *state; ++ struct bulk_waiter *bulk_waiter = NULL; ++ const char dir_char = (dir == VCHIQ_BULK_TRANSMIT) ? 't' : 'r'; ++ const int dir_msgtype = (dir == VCHIQ_BULK_TRANSMIT) ? ++ VCHIQ_MSG_BULK_TX : VCHIQ_MSG_BULK_RX; ++ VCHIQ_STATUS_T status = VCHIQ_ERROR; ++ ++ if (!service || ++ (service->srvstate != VCHIQ_SRVSTATE_OPEN) || ++ ((memhandle == VCHI_MEM_HANDLE_INVALID) && (offset == NULL)) || ++ (vchiq_check_service(service) != VCHIQ_SUCCESS)) ++ goto error_exit; ++ ++ switch (mode) { ++ case VCHIQ_BULK_MODE_NOCALLBACK: ++ case VCHIQ_BULK_MODE_CALLBACK: ++ break; ++ case VCHIQ_BULK_MODE_BLOCKING: ++ bulk_waiter = (struct bulk_waiter *)userdata; ++ sema_init(&bulk_waiter->event, 0); ++ bulk_waiter->actual = 0; ++ bulk_waiter->bulk = NULL; ++ break; ++ case VCHIQ_BULK_MODE_WAITING: ++ bulk_waiter = (struct bulk_waiter *)userdata; ++ bulk = bulk_waiter->bulk; ++ goto waiting; ++ default: ++ goto error_exit; ++ } ++ ++ state = service->state; ++ ++ queue = (dir == VCHIQ_BULK_TRANSMIT) ? ++ &service->bulk_tx : &service->bulk_rx; ++ ++ if (mutex_lock_interruptible(&service->bulk_mutex) != 0) { ++ status = VCHIQ_RETRY; ++ goto error_exit; ++ } ++ ++ if (queue->local_insert == queue->remove + VCHIQ_NUM_SERVICE_BULKS) { ++ VCHIQ_SERVICE_STATS_INC(service, bulk_stalls); ++ do { ++ mutex_unlock(&service->bulk_mutex); ++ if (down_interruptible(&service->bulk_remove_event) ++ != 0) { ++ status = VCHIQ_RETRY; ++ goto error_exit; ++ } ++ if (mutex_lock_interruptible(&service->bulk_mutex) ++ != 0) { ++ status = VCHIQ_RETRY; ++ goto error_exit; ++ } ++ } while (queue->local_insert == queue->remove + ++ VCHIQ_NUM_SERVICE_BULKS); ++ } ++ ++ bulk = &queue->bulks[BULK_INDEX(queue->local_insert)]; ++ ++ bulk->mode = mode; ++ bulk->dir = dir; ++ bulk->userdata = userdata; ++ bulk->size = size; ++ bulk->actual = VCHIQ_BULK_ACTUAL_ABORTED; ++ ++ if (vchiq_prepare_bulk_data(bulk, memhandle, offset, size, dir) != ++ VCHIQ_SUCCESS) ++ goto unlock_error_exit; ++ ++ wmb(); ++ ++ vchiq_log_info(vchiq_core_log_level, ++ "%d: bt (%d->%d) %cx %x@%x %x", ++ state->id, ++ service->localport, service->remoteport, dir_char, ++ size, (unsigned int)bulk->data, (unsigned int)userdata); ++ ++ /* The slot mutex must be held when the service is being closed, so ++ claim it here to ensure that isn't happening */ ++ if (mutex_lock_interruptible(&state->slot_mutex) != 0) { ++ status = VCHIQ_RETRY; ++ goto cancel_bulk_error_exit; ++ } ++ ++ if (service->srvstate != VCHIQ_SRVSTATE_OPEN) ++ goto unlock_both_error_exit; ++ ++ if (state->is_master) { ++ queue->local_insert++; ++ if (resolve_bulks(service, queue)) ++ request_poll(state, service, ++ (dir == VCHIQ_BULK_TRANSMIT) ? ++ VCHIQ_POLL_TXNOTIFY : VCHIQ_POLL_RXNOTIFY); ++ } else { ++ int payload[2] = { (int)bulk->data, bulk->size }; ++ VCHIQ_ELEMENT_T element = { payload, sizeof(payload) }; ++ ++ status = queue_message(state, NULL, ++ VCHIQ_MAKE_MSG(dir_msgtype, ++ service->localport, service->remoteport), ++ &element, 1, sizeof(payload), ++ QMFLAGS_IS_BLOCKING | ++ QMFLAGS_NO_MUTEX_LOCK | ++ QMFLAGS_NO_MUTEX_UNLOCK); ++ if (status != VCHIQ_SUCCESS) { ++ goto unlock_both_error_exit; ++ } ++ queue->local_insert++; ++ } ++ ++ mutex_unlock(&state->slot_mutex); ++ mutex_unlock(&service->bulk_mutex); ++ ++ vchiq_log_trace(vchiq_core_log_level, ++ "%d: bt:%d %cx li=%x ri=%x p=%x", ++ state->id, ++ service->localport, dir_char, ++ queue->local_insert, queue->remote_insert, queue->process); ++ ++waiting: ++ unlock_service(service); ++ ++ status = VCHIQ_SUCCESS; ++ ++ if (bulk_waiter) { ++ bulk_waiter->bulk = bulk; ++ if (down_interruptible(&bulk_waiter->event) != 0) ++ status = VCHIQ_RETRY; ++ else if (bulk_waiter->actual == VCHIQ_BULK_ACTUAL_ABORTED) ++ status = VCHIQ_ERROR; ++ } ++ ++ return status; ++ ++unlock_both_error_exit: ++ mutex_unlock(&state->slot_mutex); ++cancel_bulk_error_exit: ++ vchiq_complete_bulk(bulk); ++unlock_error_exit: ++ mutex_unlock(&service->bulk_mutex); ++ ++error_exit: ++ if (service) ++ unlock_service(service); ++ return status; ++} ++ ++VCHIQ_STATUS_T ++vchiq_queue_message(VCHIQ_SERVICE_HANDLE_T handle, ++ const VCHIQ_ELEMENT_T *elements, unsigned int count) ++{ ++ VCHIQ_SERVICE_T *service = find_service_by_handle(handle); ++ VCHIQ_STATUS_T status = VCHIQ_ERROR; ++ ++ unsigned int size = 0; ++ unsigned int i; ++ ++ if (!service || ++ (vchiq_check_service(service) != VCHIQ_SUCCESS)) ++ goto error_exit; ++ ++ for (i = 0; i < (unsigned int)count; i++) { ++ if (elements[i].size) { ++ if (elements[i].data == NULL) { ++ VCHIQ_SERVICE_STATS_INC(service, error_count); ++ goto error_exit; ++ } ++ size += elements[i].size; ++ } ++ } ++ ++ if (size > VCHIQ_MAX_MSG_SIZE) { ++ VCHIQ_SERVICE_STATS_INC(service, error_count); ++ goto error_exit; ++ } ++ ++ switch (service->srvstate) { ++ case VCHIQ_SRVSTATE_OPEN: ++ status = queue_message(service->state, service, ++ VCHIQ_MAKE_MSG(VCHIQ_MSG_DATA, ++ service->localport, ++ service->remoteport), ++ elements, count, size, 1); ++ break; ++ case VCHIQ_SRVSTATE_OPENSYNC: ++ status = queue_message_sync(service->state, service, ++ VCHIQ_MAKE_MSG(VCHIQ_MSG_DATA, ++ service->localport, ++ service->remoteport), ++ elements, count, size, 1); ++ break; ++ default: ++ status = VCHIQ_ERROR; ++ break; ++ } ++ ++error_exit: ++ if (service) ++ unlock_service(service); ++ ++ return status; ++} ++ ++void ++vchiq_release_message(VCHIQ_SERVICE_HANDLE_T handle, VCHIQ_HEADER_T *header) ++{ ++ VCHIQ_SERVICE_T *service = find_service_by_handle(handle); ++ VCHIQ_SHARED_STATE_T *remote; ++ VCHIQ_STATE_T *state; ++ int slot_index; ++ ++ if (!service) ++ return; ++ ++ state = service->state; ++ remote = state->remote; ++ ++ slot_index = SLOT_INDEX_FROM_DATA(state, (void *)header); ++ ++ if ((slot_index >= remote->slot_first) && ++ (slot_index <= remote->slot_last)) { ++ int msgid = header->msgid; ++ if (msgid & VCHIQ_MSGID_CLAIMED) { ++ VCHIQ_SLOT_INFO_T *slot_info = ++ SLOT_INFO_FROM_INDEX(state, slot_index); ++ ++ release_slot(state, slot_info, header, service); ++ } ++ } else if (slot_index == remote->slot_sync) ++ release_message_sync(state, header); ++ ++ unlock_service(service); ++} ++ ++static void ++release_message_sync(VCHIQ_STATE_T *state, VCHIQ_HEADER_T *header) ++{ ++ header->msgid = VCHIQ_MSGID_PADDING; ++ wmb(); ++ remote_event_signal(&state->remote->sync_release); ++} ++ ++VCHIQ_STATUS_T ++vchiq_get_peer_version(VCHIQ_SERVICE_HANDLE_T handle, short *peer_version) ++{ ++ VCHIQ_STATUS_T status = VCHIQ_ERROR; ++ VCHIQ_SERVICE_T *service = find_service_by_handle(handle); ++ ++ if (!service || ++ (vchiq_check_service(service) != VCHIQ_SUCCESS) || ++ !peer_version) ++ goto exit; ++ *peer_version = service->peer_version; ++ status = VCHIQ_SUCCESS; ++ ++exit: ++ if (service) ++ unlock_service(service); ++ return status; ++} ++ ++VCHIQ_STATUS_T ++vchiq_get_config(VCHIQ_INSTANCE_T instance, ++ int config_size, VCHIQ_CONFIG_T *pconfig) ++{ ++ VCHIQ_CONFIG_T config; ++ ++ (void)instance; ++ ++ config.max_msg_size = VCHIQ_MAX_MSG_SIZE; ++ config.bulk_threshold = VCHIQ_MAX_MSG_SIZE; ++ config.max_outstanding_bulks = VCHIQ_NUM_SERVICE_BULKS; ++ config.max_services = VCHIQ_MAX_SERVICES; ++ config.version = VCHIQ_VERSION; ++ config.version_min = VCHIQ_VERSION_MIN; ++ ++ if (config_size > sizeof(VCHIQ_CONFIG_T)) ++ return VCHIQ_ERROR; ++ ++ memcpy(pconfig, &config, ++ min(config_size, (int)(sizeof(VCHIQ_CONFIG_T)))); ++ ++ return VCHIQ_SUCCESS; ++} ++ ++VCHIQ_STATUS_T ++vchiq_set_service_option(VCHIQ_SERVICE_HANDLE_T handle, ++ VCHIQ_SERVICE_OPTION_T option, int value) ++{ ++ VCHIQ_SERVICE_T *service = find_service_by_handle(handle); ++ VCHIQ_STATUS_T status = VCHIQ_ERROR; ++ ++ if (service) { ++ switch (option) { ++ case VCHIQ_SERVICE_OPTION_AUTOCLOSE: ++ service->auto_close = value; ++ status = VCHIQ_SUCCESS; ++ break; ++ ++ case VCHIQ_SERVICE_OPTION_SLOT_QUOTA: { ++ VCHIQ_SERVICE_QUOTA_T *service_quota = ++ &service->state->service_quotas[ ++ service->localport]; ++ if (value == 0) ++ value = service->state->default_slot_quota; ++ if ((value >= service_quota->slot_use_count) && ++ (value < (unsigned short)~0)) { ++ service_quota->slot_quota = value; ++ if ((value >= service_quota->slot_use_count) && ++ (service_quota->message_quota >= ++ service_quota->message_use_count)) { ++ /* Signal the service that it may have ++ ** dropped below its quota */ ++ up(&service_quota->quota_event); ++ } ++ status = VCHIQ_SUCCESS; ++ } ++ } break; ++ ++ case VCHIQ_SERVICE_OPTION_MESSAGE_QUOTA: { ++ VCHIQ_SERVICE_QUOTA_T *service_quota = ++ &service->state->service_quotas[ ++ service->localport]; ++ if (value == 0) ++ value = service->state->default_message_quota; ++ if ((value >= service_quota->message_use_count) && ++ (value < (unsigned short)~0)) { ++ service_quota->message_quota = value; ++ if ((value >= ++ service_quota->message_use_count) && ++ (service_quota->slot_quota >= ++ service_quota->slot_use_count)) ++ /* Signal the service that it may have ++ ** dropped below its quota */ ++ up(&service_quota->quota_event); ++ status = VCHIQ_SUCCESS; ++ } ++ } break; ++ ++ case VCHIQ_SERVICE_OPTION_SYNCHRONOUS: ++ if ((service->srvstate == VCHIQ_SRVSTATE_HIDDEN) || ++ (service->srvstate == ++ VCHIQ_SRVSTATE_LISTENING)) { ++ service->sync = value; ++ status = VCHIQ_SUCCESS; ++ } ++ break; ++ ++ case VCHIQ_SERVICE_OPTION_TRACE: ++ service->trace = value; ++ status = VCHIQ_SUCCESS; ++ break; ++ ++ default: ++ break; ++ } ++ unlock_service(service); ++ } ++ ++ return status; ++} ++ ++void ++vchiq_dump_shared_state(void *dump_context, VCHIQ_STATE_T *state, ++ VCHIQ_SHARED_STATE_T *shared, const char *label) ++{ ++ static const char *const debug_names[] = { ++ "<entries>", ++ "SLOT_HANDLER_COUNT", ++ "SLOT_HANDLER_LINE", ++ "PARSE_LINE", ++ "PARSE_HEADER", ++ "PARSE_MSGID", ++ "AWAIT_COMPLETION_LINE", ++ "DEQUEUE_MESSAGE_LINE", ++ "SERVICE_CALLBACK_LINE", ++ "MSG_QUEUE_FULL_COUNT", ++ "COMPLETION_QUEUE_FULL_COUNT" ++ }; ++ int i; ++ ++ char buf[80]; ++ int len; ++ len = snprintf(buf, sizeof(buf), ++ " %s: slots %d-%d tx_pos=%x recycle=%x", ++ label, shared->slot_first, shared->slot_last, ++ shared->tx_pos, shared->slot_queue_recycle); ++ vchiq_dump(dump_context, buf, len + 1); ++ ++ len = snprintf(buf, sizeof(buf), ++ " Slots claimed:"); ++ vchiq_dump(dump_context, buf, len + 1); ++ ++ for (i = shared->slot_first; i <= shared->slot_last; i++) { ++ VCHIQ_SLOT_INFO_T slot_info = *SLOT_INFO_FROM_INDEX(state, i); ++ if (slot_info.use_count != slot_info.release_count) { ++ len = snprintf(buf, sizeof(buf), ++ " %d: %d/%d", i, slot_info.use_count, ++ slot_info.release_count); ++ vchiq_dump(dump_context, buf, len + 1); ++ } ++ } ++ ++ for (i = 1; i < shared->debug[DEBUG_ENTRIES]; i++) { ++ len = snprintf(buf, sizeof(buf), " DEBUG: %s = %d(%x)", ++ debug_names[i], shared->debug[i], shared->debug[i]); ++ vchiq_dump(dump_context, buf, len + 1); ++ } ++} ++ ++void ++vchiq_dump_state(void *dump_context, VCHIQ_STATE_T *state) ++{ ++ char buf[80]; ++ int len; ++ int i; ++ ++ len = snprintf(buf, sizeof(buf), "State %d: %s", state->id, ++ conn_state_names[state->conn_state]); ++ vchiq_dump(dump_context, buf, len + 1); ++ ++ len = snprintf(buf, sizeof(buf), ++ " tx_pos=%x(@%x), rx_pos=%x(@%x)", ++ state->local->tx_pos, ++ (uint32_t)state->tx_data + ++ (state->local_tx_pos & VCHIQ_SLOT_MASK), ++ state->rx_pos, ++ (uint32_t)state->rx_data + ++ (state->rx_pos & VCHIQ_SLOT_MASK)); ++ vchiq_dump(dump_context, buf, len + 1); ++ ++ len = snprintf(buf, sizeof(buf), ++ " Version: %d (min %d)", ++ VCHIQ_VERSION, VCHIQ_VERSION_MIN); ++ vchiq_dump(dump_context, buf, len + 1); ++ ++ if (VCHIQ_ENABLE_STATS) { ++ len = snprintf(buf, sizeof(buf), ++ " Stats: ctrl_tx_count=%d, ctrl_rx_count=%d, " ++ "error_count=%d", ++ state->stats.ctrl_tx_count, state->stats.ctrl_rx_count, ++ state->stats.error_count); ++ vchiq_dump(dump_context, buf, len + 1); ++ } ++ ++ len = snprintf(buf, sizeof(buf), ++ " Slots: %d available (%d data), %d recyclable, %d stalls " ++ "(%d data)", ++ ((state->slot_queue_available * VCHIQ_SLOT_SIZE) - ++ state->local_tx_pos) / VCHIQ_SLOT_SIZE, ++ state->data_quota - state->data_use_count, ++ state->local->slot_queue_recycle - state->slot_queue_available, ++ state->stats.slot_stalls, state->stats.data_stalls); ++ vchiq_dump(dump_context, buf, len + 1); ++ ++ vchiq_dump_platform_state(dump_context); ++ ++ vchiq_dump_shared_state(dump_context, state, state->local, "Local"); ++ vchiq_dump_shared_state(dump_context, state, state->remote, "Remote"); ++ ++ vchiq_dump_platform_instances(dump_context); ++ ++ for (i = 0; i < state->unused_service; i++) { ++ VCHIQ_SERVICE_T *service = find_service_by_port(state, i); ++ ++ if (service) { ++ vchiq_dump_service_state(dump_context, service); ++ unlock_service(service); ++ } ++ } ++} ++ ++void ++vchiq_dump_service_state(void *dump_context, VCHIQ_SERVICE_T *service) ++{ ++ char buf[80]; ++ int len; ++ ++ len = snprintf(buf, sizeof(buf), "Service %d: %s (ref %u)", ++ service->localport, srvstate_names[service->srvstate], ++ service->ref_count - 1); /*Don't include the lock just taken*/ ++ ++ if (service->srvstate != VCHIQ_SRVSTATE_FREE) { ++ char remoteport[30]; ++ VCHIQ_SERVICE_QUOTA_T *service_quota = ++ &service->state->service_quotas[service->localport]; ++ int fourcc = service->base.fourcc; ++ int tx_pending, rx_pending; ++ if (service->remoteport != VCHIQ_PORT_FREE) { ++ int len2 = snprintf(remoteport, sizeof(remoteport), ++ "%d", service->remoteport); ++ if (service->public_fourcc != VCHIQ_FOURCC_INVALID) ++ snprintf(remoteport + len2, ++ sizeof(remoteport) - len2, ++ " (client %x)", service->client_id); ++ } else ++ strcpy(remoteport, "n/a"); ++ ++ len += snprintf(buf + len, sizeof(buf) - len, ++ " '%c%c%c%c' remote %s (msg use %d/%d, slot use %d/%d)", ++ VCHIQ_FOURCC_AS_4CHARS(fourcc), ++ remoteport, ++ service_quota->message_use_count, ++ service_quota->message_quota, ++ service_quota->slot_use_count, ++ service_quota->slot_quota); ++ ++ vchiq_dump(dump_context, buf, len + 1); ++ ++ tx_pending = service->bulk_tx.local_insert - ++ service->bulk_tx.remote_insert; ++ ++ rx_pending = service->bulk_rx.local_insert - ++ service->bulk_rx.remote_insert; ++ ++ len = snprintf(buf, sizeof(buf), ++ " Bulk: tx_pending=%d (size %d)," ++ " rx_pending=%d (size %d)", ++ tx_pending, ++ tx_pending ? service->bulk_tx.bulks[ ++ BULK_INDEX(service->bulk_tx.remove)].size : 0, ++ rx_pending, ++ rx_pending ? service->bulk_rx.bulks[ ++ BULK_INDEX(service->bulk_rx.remove)].size : 0); ++ ++ if (VCHIQ_ENABLE_STATS) { ++ vchiq_dump(dump_context, buf, len + 1); ++ ++ len = snprintf(buf, sizeof(buf), ++ " Ctrl: tx_count=%d, tx_bytes=%llu, " ++ "rx_count=%d, rx_bytes=%llu", ++ service->stats.ctrl_tx_count, ++ service->stats.ctrl_tx_bytes, ++ service->stats.ctrl_rx_count, ++ service->stats.ctrl_rx_bytes); ++ vchiq_dump(dump_context, buf, len + 1); ++ ++ len = snprintf(buf, sizeof(buf), ++ " Bulk: tx_count=%d, tx_bytes=%llu, " ++ "rx_count=%d, rx_bytes=%llu", ++ service->stats.bulk_tx_count, ++ service->stats.bulk_tx_bytes, ++ service->stats.bulk_rx_count, ++ service->stats.bulk_rx_bytes); ++ vchiq_dump(dump_context, buf, len + 1); ++ ++ len = snprintf(buf, sizeof(buf), ++ " %d quota stalls, %d slot stalls, " ++ "%d bulk stalls, %d aborted, %d errors", ++ service->stats.quota_stalls, ++ service->stats.slot_stalls, ++ service->stats.bulk_stalls, ++ service->stats.bulk_aborted_count, ++ service->stats.error_count); ++ } ++ } ++ ++ vchiq_dump(dump_context, buf, len + 1); ++ ++ if (service->srvstate != VCHIQ_SRVSTATE_FREE) ++ vchiq_dump_platform_service_state(dump_context, service); ++} ++ ++ ++void ++vchiq_loud_error_header(void) ++{ ++ vchiq_log_error(vchiq_core_log_level, ++ "============================================================" ++ "================"); ++ vchiq_log_error(vchiq_core_log_level, ++ "============================================================" ++ "================"); ++ vchiq_log_error(vchiq_core_log_level, "====="); ++} ++ ++void ++vchiq_loud_error_footer(void) ++{ ++ vchiq_log_error(vchiq_core_log_level, "====="); ++ vchiq_log_error(vchiq_core_log_level, ++ "============================================================" ++ "================"); ++ vchiq_log_error(vchiq_core_log_level, ++ "============================================================" ++ "================"); ++} ++ ++ ++VCHIQ_STATUS_T vchiq_send_remote_use(VCHIQ_STATE_T *state) ++{ ++ VCHIQ_STATUS_T status = VCHIQ_RETRY; ++ if (state->conn_state != VCHIQ_CONNSTATE_DISCONNECTED) ++ status = queue_message(state, NULL, ++ VCHIQ_MAKE_MSG(VCHIQ_MSG_REMOTE_USE, 0, 0), ++ NULL, 0, 0, 0); ++ return status; ++} ++ ++VCHIQ_STATUS_T vchiq_send_remote_release(VCHIQ_STATE_T *state) ++{ ++ VCHIQ_STATUS_T status = VCHIQ_RETRY; ++ if (state->conn_state != VCHIQ_CONNSTATE_DISCONNECTED) ++ status = queue_message(state, NULL, ++ VCHIQ_MAKE_MSG(VCHIQ_MSG_REMOTE_RELEASE, 0, 0), ++ NULL, 0, 0, 0); ++ return status; ++} ++ ++VCHIQ_STATUS_T vchiq_send_remote_use_active(VCHIQ_STATE_T *state) ++{ ++ VCHIQ_STATUS_T status = VCHIQ_RETRY; ++ if (state->conn_state != VCHIQ_CONNSTATE_DISCONNECTED) ++ status = queue_message(state, NULL, ++ VCHIQ_MAKE_MSG(VCHIQ_MSG_REMOTE_USE_ACTIVE, 0, 0), ++ NULL, 0, 0, 0); ++ return status; ++} ++ ++void vchiq_log_dump_mem(const char *label, uint32_t addr, const void *voidMem, ++ size_t numBytes) ++{ ++ const uint8_t *mem = (const uint8_t *)voidMem; ++ size_t offset; ++ char lineBuf[100]; ++ char *s; ++ ++ while (numBytes > 0) { ++ s = lineBuf; ++ ++ for (offset = 0; offset < 16; offset++) { ++ if (offset < numBytes) ++ s += snprintf(s, 4, "%02x ", mem[offset]); ++ else ++ s += snprintf(s, 4, " "); ++ } ++ ++ for (offset = 0; offset < 16; offset++) { ++ if (offset < numBytes) { ++ uint8_t ch = mem[offset]; ++ ++ if ((ch < ' ') || (ch > '~')) ++ ch = '.'; ++ *s++ = (char)ch; ++ } ++ } ++ *s++ = '\0'; ++ ++ if ((label != NULL) && (*label != '\0')) ++ vchiq_log_trace(VCHIQ_LOG_TRACE, ++ "%s: %08x: %s", label, addr, lineBuf); ++ else ++ vchiq_log_trace(VCHIQ_LOG_TRACE, ++ "%08x: %s", addr, lineBuf); ++ ++ addr += 16; ++ mem += 16; ++ if (numBytes > 16) ++ numBytes -= 16; ++ else ++ numBytes = 0; ++ } ++} +diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_core.h b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_core.h +new file mode 100644 +index 0000000..9be484c +--- /dev/null ++++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_core.h +@@ -0,0 +1,712 @@ ++/** ++ * Copyright (c) 2010-2012 Broadcom. 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, ++ * without modification. ++ * 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. ++ * 3. The names of the above-listed copyright holders may not be used ++ * to endorse or promote products derived from this software without ++ * specific prior written permission. ++ * ++ * ALTERNATIVELY, this software may be distributed under the terms of the ++ * GNU General Public License ("GPL") version 2, as published by the Free ++ * Software Foundation. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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. ++ */ ++ ++#ifndef VCHIQ_CORE_H ++#define VCHIQ_CORE_H ++ ++#include <linux/mutex.h> ++#include <linux/semaphore.h> ++#include <linux/kthread.h> ++ ++#include "vchiq_cfg.h" ++ ++#include "vchiq.h" ++ ++/* Run time control of log level, based on KERN_XXX level. */ ++#define VCHIQ_LOG_DEFAULT 4 ++#define VCHIQ_LOG_ERROR 3 ++#define VCHIQ_LOG_WARNING 4 ++#define VCHIQ_LOG_INFO 6 ++#define VCHIQ_LOG_TRACE 7 ++ ++#define VCHIQ_LOG_PREFIX KERN_INFO "vchiq: " ++ ++#ifndef vchiq_log_error ++#define vchiq_log_error(cat, fmt, ...) \ ++ do { if (cat >= VCHIQ_LOG_ERROR) \ ++ printk(VCHIQ_LOG_PREFIX fmt "\n", ##__VA_ARGS__); } while (0) ++#endif ++#ifndef vchiq_log_warning ++#define vchiq_log_warning(cat, fmt, ...) \ ++ do { if (cat >= VCHIQ_LOG_WARNING) \ ++ printk(VCHIQ_LOG_PREFIX fmt "\n", ##__VA_ARGS__); } while (0) ++#endif ++#ifndef vchiq_log_info ++#define vchiq_log_info(cat, fmt, ...) \ ++ do { if (cat >= VCHIQ_LOG_INFO) \ ++ printk(VCHIQ_LOG_PREFIX fmt "\n", ##__VA_ARGS__); } while (0) ++#endif ++#ifndef vchiq_log_trace ++#define vchiq_log_trace(cat, fmt, ...) \ ++ do { if (cat >= VCHIQ_LOG_TRACE) \ ++ printk(VCHIQ_LOG_PREFIX fmt "\n", ##__VA_ARGS__); } while (0) ++#endif ++ ++#define vchiq_loud_error(...) \ ++ vchiq_log_error(vchiq_core_log_level, "===== " __VA_ARGS__) ++ ++#ifndef vchiq_static_assert ++#define vchiq_static_assert(cond) __attribute__((unused)) \ ++ extern int vchiq_static_assert[(cond) ? 1 : -1] ++#endif ++ ++#define IS_POW2(x) (x && ((x & (x - 1)) == 0)) ++ ++/* Ensure that the slot size and maximum number of slots are powers of 2 */ ++vchiq_static_assert(IS_POW2(VCHIQ_SLOT_SIZE)); ++vchiq_static_assert(IS_POW2(VCHIQ_MAX_SLOTS)); ++vchiq_static_assert(IS_POW2(VCHIQ_MAX_SLOTS_PER_SIDE)); ++ ++#define VCHIQ_SLOT_MASK (VCHIQ_SLOT_SIZE - 1) ++#define VCHIQ_SLOT_QUEUE_MASK (VCHIQ_MAX_SLOTS_PER_SIDE - 1) ++#define VCHIQ_SLOT_ZERO_SLOTS ((sizeof(VCHIQ_SLOT_ZERO_T) + \ ++ VCHIQ_SLOT_SIZE - 1) / VCHIQ_SLOT_SIZE) ++ ++#define VCHIQ_MSG_PADDING 0 /* - */ ++#define VCHIQ_MSG_CONNECT 1 /* - */ ++#define VCHIQ_MSG_OPEN 2 /* + (srcport, -), fourcc, client_id */ ++#define VCHIQ_MSG_OPENACK 3 /* + (srcport, dstport) */ ++#define VCHIQ_MSG_CLOSE 4 /* + (srcport, dstport) */ ++#define VCHIQ_MSG_DATA 5 /* + (srcport, dstport) */ ++#define VCHIQ_MSG_BULK_RX 6 /* + (srcport, dstport), data, size */ ++#define VCHIQ_MSG_BULK_TX 7 /* + (srcport, dstport), data, size */ ++#define VCHIQ_MSG_BULK_RX_DONE 8 /* + (srcport, dstport), actual */ ++#define VCHIQ_MSG_BULK_TX_DONE 9 /* + (srcport, dstport), actual */ ++#define VCHIQ_MSG_PAUSE 10 /* - */ ++#define VCHIQ_MSG_RESUME 11 /* - */ ++#define VCHIQ_MSG_REMOTE_USE 12 /* - */ ++#define VCHIQ_MSG_REMOTE_RELEASE 13 /* - */ ++#define VCHIQ_MSG_REMOTE_USE_ACTIVE 14 /* - */ ++ ++#define VCHIQ_PORT_MAX (VCHIQ_MAX_SERVICES - 1) ++#define VCHIQ_PORT_FREE 0x1000 ++#define VCHIQ_PORT_IS_VALID(port) (port < VCHIQ_PORT_FREE) ++#define VCHIQ_MAKE_MSG(type, srcport, dstport) \ ++ ((type<<24) | (srcport<<12) | (dstport<<0)) ++#define VCHIQ_MSG_TYPE(msgid) ((unsigned int)msgid >> 24) ++#define VCHIQ_MSG_SRCPORT(msgid) \ ++ (unsigned short)(((unsigned int)msgid >> 12) & 0xfff) ++#define VCHIQ_MSG_DSTPORT(msgid) \ ++ ((unsigned short)msgid & 0xfff) ++ ++#define VCHIQ_FOURCC_AS_4CHARS(fourcc) \ ++ ((fourcc) >> 24) & 0xff, \ ++ ((fourcc) >> 16) & 0xff, \ ++ ((fourcc) >> 8) & 0xff, \ ++ (fourcc) & 0xff ++ ++/* Ensure the fields are wide enough */ ++vchiq_static_assert(VCHIQ_MSG_SRCPORT(VCHIQ_MAKE_MSG(0, 0, VCHIQ_PORT_MAX)) ++ == 0); ++vchiq_static_assert(VCHIQ_MSG_TYPE(VCHIQ_MAKE_MSG(0, VCHIQ_PORT_MAX, 0)) == 0); ++vchiq_static_assert((unsigned int)VCHIQ_PORT_MAX < ++ (unsigned int)VCHIQ_PORT_FREE); ++ ++#define VCHIQ_MSGID_PADDING VCHIQ_MAKE_MSG(VCHIQ_MSG_PADDING, 0, 0) ++#define VCHIQ_MSGID_CLAIMED 0x40000000 ++ ++#define VCHIQ_FOURCC_INVALID 0x00000000 ++#define VCHIQ_FOURCC_IS_LEGAL(fourcc) (fourcc != VCHIQ_FOURCC_INVALID) ++ ++#define VCHIQ_BULK_ACTUAL_ABORTED -1 ++ ++typedef uint32_t BITSET_T; ++ ++vchiq_static_assert((sizeof(BITSET_T) * 8) == 32); ++ ++#define BITSET_SIZE(b) ((b + 31) >> 5) ++#define BITSET_WORD(b) (b >> 5) ++#define BITSET_BIT(b) (1 << (b & 31)) ++#define BITSET_ZERO(bs) memset(bs, 0, sizeof(bs)) ++#define BITSET_IS_SET(bs, b) (bs[BITSET_WORD(b)] & BITSET_BIT(b)) ++#define BITSET_SET(bs, b) (bs[BITSET_WORD(b)] |= BITSET_BIT(b)) ++#define BITSET_CLR(bs, b) (bs[BITSET_WORD(b)] &= ~BITSET_BIT(b)) ++ ++#if VCHIQ_ENABLE_STATS ++#define VCHIQ_STATS_INC(state, stat) (state->stats. stat++) ++#define VCHIQ_SERVICE_STATS_INC(service, stat) (service->stats. stat++) ++#define VCHIQ_SERVICE_STATS_ADD(service, stat, addend) \ ++ (service->stats. stat += addend) ++#else ++#define VCHIQ_STATS_INC(state, stat) ((void)0) ++#define VCHIQ_SERVICE_STATS_INC(service, stat) ((void)0) ++#define VCHIQ_SERVICE_STATS_ADD(service, stat, addend) ((void)0) ++#endif ++ ++enum { ++ DEBUG_ENTRIES, ++#if VCHIQ_ENABLE_DEBUG ++ DEBUG_SLOT_HANDLER_COUNT, ++ DEBUG_SLOT_HANDLER_LINE, ++ DEBUG_PARSE_LINE, ++ DEBUG_PARSE_HEADER, ++ DEBUG_PARSE_MSGID, ++ DEBUG_AWAIT_COMPLETION_LINE, ++ DEBUG_DEQUEUE_MESSAGE_LINE, ++ DEBUG_SERVICE_CALLBACK_LINE, ++ DEBUG_MSG_QUEUE_FULL_COUNT, ++ DEBUG_COMPLETION_QUEUE_FULL_COUNT, ++#endif ++ DEBUG_MAX ++}; ++ ++#if VCHIQ_ENABLE_DEBUG ++ ++#define DEBUG_INITIALISE(local) int *debug_ptr = (local)->debug; ++#define DEBUG_TRACE(d) \ ++ do { debug_ptr[DEBUG_ ## d] = __LINE__; dsb(); } while (0) ++#define DEBUG_VALUE(d, v) \ ++ do { debug_ptr[DEBUG_ ## d] = (v); dsb(); } while (0) ++#define DEBUG_COUNT(d) \ ++ do { debug_ptr[DEBUG_ ## d]++; dsb(); } while (0) ++ ++#else /* VCHIQ_ENABLE_DEBUG */ ++ ++#define DEBUG_INITIALISE(local) ++#define DEBUG_TRACE(d) ++#define DEBUG_VALUE(d, v) ++#define DEBUG_COUNT(d) ++ ++#endif /* VCHIQ_ENABLE_DEBUG */ ++ ++typedef enum { ++ VCHIQ_CONNSTATE_DISCONNECTED, ++ VCHIQ_CONNSTATE_CONNECTING, ++ VCHIQ_CONNSTATE_CONNECTED, ++ VCHIQ_CONNSTATE_PAUSING, ++ VCHIQ_CONNSTATE_PAUSE_SENT, ++ VCHIQ_CONNSTATE_PAUSED, ++ VCHIQ_CONNSTATE_RESUMING, ++ VCHIQ_CONNSTATE_PAUSE_TIMEOUT, ++ VCHIQ_CONNSTATE_RESUME_TIMEOUT ++} VCHIQ_CONNSTATE_T; ++ ++enum { ++ VCHIQ_SRVSTATE_FREE, ++ VCHIQ_SRVSTATE_HIDDEN, ++ VCHIQ_SRVSTATE_LISTENING, ++ VCHIQ_SRVSTATE_OPENING, ++ VCHIQ_SRVSTATE_OPEN, ++ VCHIQ_SRVSTATE_OPENSYNC, ++ VCHIQ_SRVSTATE_CLOSESENT, ++ VCHIQ_SRVSTATE_CLOSERECVD, ++ VCHIQ_SRVSTATE_CLOSEWAIT, ++ VCHIQ_SRVSTATE_CLOSED ++}; ++ ++enum { ++ VCHIQ_POLL_TERMINATE, ++ VCHIQ_POLL_REMOVE, ++ VCHIQ_POLL_TXNOTIFY, ++ VCHIQ_POLL_RXNOTIFY, ++ VCHIQ_POLL_COUNT ++}; ++ ++typedef enum { ++ VCHIQ_BULK_TRANSMIT, ++ VCHIQ_BULK_RECEIVE ++} VCHIQ_BULK_DIR_T; ++ ++typedef void (*VCHIQ_USERDATA_TERM_T)(void *userdata); ++ ++typedef struct vchiq_bulk_struct { ++ short mode; ++ short dir; ++ void *userdata; ++ VCHI_MEM_HANDLE_T handle; ++ void *data; ++ int size; ++ void *remote_data; ++ int remote_size; ++ int actual; ++} VCHIQ_BULK_T; ++ ++typedef struct vchiq_bulk_queue_struct { ++ int local_insert; /* Where to insert the next local bulk */ ++ int remote_insert; /* Where to insert the next remote bulk (master) */ ++ int process; /* Bulk to transfer next */ ++ int remote_notify; /* Bulk to notify the remote client of next (mstr) */ ++ int remove; /* Bulk to notify the local client of, and remove, ++ ** next */ ++ VCHIQ_BULK_T bulks[VCHIQ_NUM_SERVICE_BULKS]; ++} VCHIQ_BULK_QUEUE_T; ++ ++typedef struct remote_event_struct { ++ int armed; ++ int fired; ++ struct semaphore *event; ++} REMOTE_EVENT_T; ++ ++typedef struct opaque_platform_state_t *VCHIQ_PLATFORM_STATE_T; ++ ++typedef struct vchiq_state_struct VCHIQ_STATE_T; ++ ++typedef struct vchiq_slot_struct { ++ char data[VCHIQ_SLOT_SIZE]; ++} VCHIQ_SLOT_T; ++ ++typedef struct vchiq_slot_info_struct { ++ /* Use two counters rather than one to avoid the need for a mutex. */ ++ short use_count; ++ short release_count; ++} VCHIQ_SLOT_INFO_T; ++ ++typedef struct vchiq_service_struct { ++ VCHIQ_SERVICE_BASE_T base; ++ VCHIQ_SERVICE_HANDLE_T handle; ++ unsigned int ref_count; ++ int srvstate; ++ VCHIQ_USERDATA_TERM_T userdata_term; ++ unsigned int localport; ++ unsigned int remoteport; ++ int public_fourcc; ++ int client_id; ++ char auto_close; ++ char sync; ++ char closing; ++ char trace; ++ atomic_t poll_flags; ++ short version; ++ short version_min; ++ short peer_version; ++ ++ VCHIQ_STATE_T *state; ++ VCHIQ_INSTANCE_T instance; ++ ++ int service_use_count; ++ ++ VCHIQ_BULK_QUEUE_T bulk_tx; ++ VCHIQ_BULK_QUEUE_T bulk_rx; ++ ++ struct semaphore remove_event; ++ struct semaphore bulk_remove_event; ++ struct mutex bulk_mutex; ++ ++ struct service_stats_struct { ++ int quota_stalls; ++ int slot_stalls; ++ int bulk_stalls; ++ int error_count; ++ int ctrl_tx_count; ++ int ctrl_rx_count; ++ int bulk_tx_count; ++ int bulk_rx_count; ++ int bulk_aborted_count; ++ uint64_t ctrl_tx_bytes; ++ uint64_t ctrl_rx_bytes; ++ uint64_t bulk_tx_bytes; ++ uint64_t bulk_rx_bytes; ++ } stats; ++} VCHIQ_SERVICE_T; ++ ++/* The quota information is outside VCHIQ_SERVICE_T so that it can be ++ statically allocated, since for accounting reasons a service's slot ++ usage is carried over between users of the same port number. ++ */ ++typedef struct vchiq_service_quota_struct { ++ unsigned short slot_quota; ++ unsigned short slot_use_count; ++ unsigned short message_quota; ++ unsigned short message_use_count; ++ struct semaphore quota_event; ++ int previous_tx_index; ++} VCHIQ_SERVICE_QUOTA_T; ++ ++typedef struct vchiq_shared_state_struct { ++ ++ /* A non-zero value here indicates that the content is valid. */ ++ int initialised; ++ ++ /* The first and last (inclusive) slots allocated to the owner. */ ++ int slot_first; ++ int slot_last; ++ ++ /* The slot allocated to synchronous messages from the owner. */ ++ int slot_sync; ++ ++ /* Signalling this event indicates that owner's slot handler thread ++ ** should run. */ ++ REMOTE_EVENT_T trigger; ++ ++ /* Indicates the byte position within the stream where the next message ++ ** will be written. The least significant bits are an index into the ++ ** slot. The next bits are the index of the slot in slot_queue. */ ++ int tx_pos; ++ ++ /* This event should be signalled when a slot is recycled. */ ++ REMOTE_EVENT_T recycle; ++ ++ /* The slot_queue index where the next recycled slot will be written. */ ++ int slot_queue_recycle; ++ ++ /* This event should be signalled when a synchronous message is sent. */ ++ REMOTE_EVENT_T sync_trigger; ++ ++ /* This event should be signalled when a synchronous message has been ++ ** released. */ ++ REMOTE_EVENT_T sync_release; ++ ++ /* A circular buffer of slot indexes. */ ++ int slot_queue[VCHIQ_MAX_SLOTS_PER_SIDE]; ++ ++ /* Debugging state */ ++ int debug[DEBUG_MAX]; ++} VCHIQ_SHARED_STATE_T; ++ ++typedef struct vchiq_slot_zero_struct { ++ int magic; ++ short version; ++ short version_min; ++ int slot_zero_size; ++ int slot_size; ++ int max_slots; ++ int max_slots_per_side; ++ int platform_data[2]; ++ VCHIQ_SHARED_STATE_T master; ++ VCHIQ_SHARED_STATE_T slave; ++ VCHIQ_SLOT_INFO_T slots[VCHIQ_MAX_SLOTS]; ++} VCHIQ_SLOT_ZERO_T; ++ ++struct vchiq_state_struct { ++ int id; ++ int initialised; ++ VCHIQ_CONNSTATE_T conn_state; ++ int is_master; ++ short version_common; ++ ++ VCHIQ_SHARED_STATE_T *local; ++ VCHIQ_SHARED_STATE_T *remote; ++ VCHIQ_SLOT_T *slot_data; ++ ++ unsigned short default_slot_quota; ++ unsigned short default_message_quota; ++ ++ /* Event indicating connect message received */ ++ struct semaphore connect; ++ ++ /* Mutex protecting services */ ++ struct mutex mutex; ++ VCHIQ_INSTANCE_T *instance; ++ ++ /* Processes incoming messages */ ++ struct task_struct *slot_handler_thread; ++ ++ /* Processes recycled slots */ ++ struct task_struct *recycle_thread; ++ ++ /* Processes synchronous messages */ ++ struct task_struct *sync_thread; ++ ++ /* Local implementation of the trigger remote event */ ++ struct semaphore trigger_event; ++ ++ /* Local implementation of the recycle remote event */ ++ struct semaphore recycle_event; ++ ++ /* Local implementation of the sync trigger remote event */ ++ struct semaphore sync_trigger_event; ++ ++ /* Local implementation of the sync release remote event */ ++ struct semaphore sync_release_event; ++ ++ char *tx_data; ++ char *rx_data; ++ VCHIQ_SLOT_INFO_T *rx_info; ++ ++ struct mutex slot_mutex; ++ ++ struct mutex recycle_mutex; ++ ++ struct mutex sync_mutex; ++ ++ struct mutex bulk_transfer_mutex; ++ ++ /* Indicates the byte position within the stream from where the next ++ ** message will be read. The least significant bits are an index into ++ ** the slot.The next bits are the index of the slot in ++ ** remote->slot_queue. */ ++ int rx_pos; ++ ++ /* A cached copy of local->tx_pos. Only write to local->tx_pos, and read ++ from remote->tx_pos. */ ++ int local_tx_pos; ++ ++ /* The slot_queue index of the slot to become available next. */ ++ int slot_queue_available; ++ ++ /* A flag to indicate if any poll has been requested */ ++ int poll_needed; ++ ++ /* Ths index of the previous slot used for data messages. */ ++ int previous_data_index; ++ ++ /* The number of slots occupied by data messages. */ ++ unsigned short data_use_count; ++ ++ /* The maximum number of slots to be occupied by data messages. */ ++ unsigned short data_quota; ++ ++ /* An array of bit sets indicating which services must be polled. */ ++ atomic_t poll_services[BITSET_SIZE(VCHIQ_MAX_SERVICES)]; ++ ++ /* The number of the first unused service */ ++ int unused_service; ++ ++ /* Signalled when a free slot becomes available. */ ++ struct semaphore slot_available_event; ++ ++ struct semaphore slot_remove_event; ++ ++ /* Signalled when a free data slot becomes available. */ ++ struct semaphore data_quota_event; ++ ++ /* Incremented when there are bulk transfers which cannot be processed ++ * whilst paused and must be processed on resume */ ++ int deferred_bulks; ++ ++ struct state_stats_struct { ++ int slot_stalls; ++ int data_stalls; ++ int ctrl_tx_count; ++ int ctrl_rx_count; ++ int error_count; ++ } stats; ++ ++ VCHIQ_SERVICE_T * services[VCHIQ_MAX_SERVICES]; ++ VCHIQ_SERVICE_QUOTA_T service_quotas[VCHIQ_MAX_SERVICES]; ++ VCHIQ_SLOT_INFO_T slot_info[VCHIQ_MAX_SLOTS]; ++ ++ VCHIQ_PLATFORM_STATE_T platform_state; ++}; ++ ++struct bulk_waiter { ++ VCHIQ_BULK_T *bulk; ++ struct semaphore event; ++ int actual; ++}; ++ ++extern spinlock_t bulk_waiter_spinlock; ++ ++extern int vchiq_core_log_level; ++extern int vchiq_core_msg_log_level; ++extern int vchiq_sync_log_level; ++ ++extern VCHIQ_STATE_T *vchiq_states[VCHIQ_MAX_STATES]; ++ ++extern const char * ++get_conn_state_name(VCHIQ_CONNSTATE_T conn_state); ++ ++extern VCHIQ_SLOT_ZERO_T * ++vchiq_init_slots(void *mem_base, int mem_size); ++ ++extern VCHIQ_STATUS_T ++vchiq_init_state(VCHIQ_STATE_T *state, VCHIQ_SLOT_ZERO_T *slot_zero, ++ int is_master); ++ ++extern VCHIQ_STATUS_T ++vchiq_connect_internal(VCHIQ_STATE_T *state, VCHIQ_INSTANCE_T instance); ++ ++extern VCHIQ_SERVICE_T * ++vchiq_add_service_internal(VCHIQ_STATE_T *state, ++ const VCHIQ_SERVICE_PARAMS_T *params, int srvstate, ++ VCHIQ_INSTANCE_T instance, VCHIQ_USERDATA_TERM_T userdata_term); ++ ++extern VCHIQ_STATUS_T ++vchiq_open_service_internal(VCHIQ_SERVICE_T *service, int client_id); ++ ++extern VCHIQ_STATUS_T ++vchiq_close_service_internal(VCHIQ_SERVICE_T *service, int close_recvd); ++ ++extern void ++vchiq_terminate_service_internal(VCHIQ_SERVICE_T *service); ++ ++extern void ++vchiq_free_service_internal(VCHIQ_SERVICE_T *service); ++ ++extern VCHIQ_STATUS_T ++vchiq_shutdown_internal(VCHIQ_STATE_T *state, VCHIQ_INSTANCE_T instance); ++ ++extern VCHIQ_STATUS_T ++vchiq_pause_internal(VCHIQ_STATE_T *state); ++ ++extern VCHIQ_STATUS_T ++vchiq_resume_internal(VCHIQ_STATE_T *state); ++ ++extern void ++remote_event_pollall(VCHIQ_STATE_T *state); ++ ++extern VCHIQ_STATUS_T ++vchiq_bulk_transfer(VCHIQ_SERVICE_HANDLE_T handle, ++ VCHI_MEM_HANDLE_T memhandle, void *offset, int size, void *userdata, ++ VCHIQ_BULK_MODE_T mode, VCHIQ_BULK_DIR_T dir); ++ ++extern void ++vchiq_dump_state(void *dump_context, VCHIQ_STATE_T *state); ++ ++extern void ++vchiq_dump_service_state(void *dump_context, VCHIQ_SERVICE_T *service); ++ ++extern void ++vchiq_loud_error_header(void); ++ ++extern void ++vchiq_loud_error_footer(void); ++ ++extern void ++request_poll(VCHIQ_STATE_T *state, VCHIQ_SERVICE_T *service, int poll_type); ++ ++static inline VCHIQ_SERVICE_T * ++handle_to_service(VCHIQ_SERVICE_HANDLE_T handle) ++{ ++ VCHIQ_STATE_T *state = vchiq_states[(handle / VCHIQ_MAX_SERVICES) & ++ (VCHIQ_MAX_STATES - 1)]; ++ if (!state) ++ return NULL; ++ ++ return state->services[handle & (VCHIQ_MAX_SERVICES - 1)]; ++} ++ ++extern VCHIQ_SERVICE_T * ++find_service_by_handle(VCHIQ_SERVICE_HANDLE_T handle); ++ ++extern VCHIQ_SERVICE_T * ++find_service_by_port(VCHIQ_STATE_T *state, int localport); ++ ++extern VCHIQ_SERVICE_T * ++find_service_for_instance(VCHIQ_INSTANCE_T instance, ++ VCHIQ_SERVICE_HANDLE_T handle); ++ ++extern VCHIQ_SERVICE_T * ++find_closed_service_for_instance(VCHIQ_INSTANCE_T instance, ++ VCHIQ_SERVICE_HANDLE_T handle); ++ ++extern VCHIQ_SERVICE_T * ++next_service_by_instance(VCHIQ_STATE_T *state, VCHIQ_INSTANCE_T instance, ++ int *pidx); ++ ++extern void ++lock_service(VCHIQ_SERVICE_T *service); ++ ++extern void ++unlock_service(VCHIQ_SERVICE_T *service); ++ ++/* The following functions are called from vchiq_core, and external ++** implementations must be provided. */ ++ ++extern VCHIQ_STATUS_T ++vchiq_prepare_bulk_data(VCHIQ_BULK_T *bulk, ++ VCHI_MEM_HANDLE_T memhandle, void *offset, int size, int dir); ++ ++extern void ++vchiq_transfer_bulk(VCHIQ_BULK_T *bulk); ++ ++extern void ++vchiq_complete_bulk(VCHIQ_BULK_T *bulk); ++ ++extern VCHIQ_STATUS_T ++vchiq_copy_from_user(void *dst, const void *src, int size); ++ ++extern void ++remote_event_signal(REMOTE_EVENT_T *event); ++ ++void ++vchiq_platform_check_suspend(VCHIQ_STATE_T *state); ++ ++extern void ++vchiq_platform_paused(VCHIQ_STATE_T *state); ++ ++extern VCHIQ_STATUS_T ++vchiq_platform_resume(VCHIQ_STATE_T *state); ++ ++extern void ++vchiq_platform_resumed(VCHIQ_STATE_T *state); ++ ++extern void ++vchiq_dump(void *dump_context, const char *str, int len); ++ ++extern void ++vchiq_dump_platform_state(void *dump_context); ++ ++extern void ++vchiq_dump_platform_instances(void *dump_context); ++ ++extern void ++vchiq_dump_platform_service_state(void *dump_context, ++ VCHIQ_SERVICE_T *service); ++ ++extern VCHIQ_STATUS_T ++vchiq_use_service_internal(VCHIQ_SERVICE_T *service); ++ ++extern VCHIQ_STATUS_T ++vchiq_release_service_internal(VCHIQ_SERVICE_T *service); ++ ++extern void ++vchiq_on_remote_use(VCHIQ_STATE_T *state); ++ ++extern void ++vchiq_on_remote_release(VCHIQ_STATE_T *state); ++ ++extern VCHIQ_STATUS_T ++vchiq_platform_init_state(VCHIQ_STATE_T *state); ++ ++extern VCHIQ_STATUS_T ++vchiq_check_service(VCHIQ_SERVICE_T *service); ++ ++extern void ++vchiq_on_remote_use_active(VCHIQ_STATE_T *state); ++ ++extern VCHIQ_STATUS_T ++vchiq_send_remote_use(VCHIQ_STATE_T *state); ++ ++extern VCHIQ_STATUS_T ++vchiq_send_remote_release(VCHIQ_STATE_T *state); ++ ++extern VCHIQ_STATUS_T ++vchiq_send_remote_use_active(VCHIQ_STATE_T *state); ++ ++extern void ++vchiq_platform_conn_state_changed(VCHIQ_STATE_T *state, ++ VCHIQ_CONNSTATE_T oldstate, VCHIQ_CONNSTATE_T newstate); ++ ++extern void ++vchiq_platform_handle_timeout(VCHIQ_STATE_T *state); ++ ++extern void ++vchiq_set_conn_state(VCHIQ_STATE_T *state, VCHIQ_CONNSTATE_T newstate); ++ ++ ++extern void ++vchiq_log_dump_mem(const char *label, uint32_t addr, const void *voidMem, ++ size_t numBytes); ++ ++#endif +diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_debugfs.c b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_debugfs.c +new file mode 100644 +index 0000000..7e03213 +--- /dev/null ++++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_debugfs.c +@@ -0,0 +1,383 @@ ++/** ++ * Copyright (c) 2014 Raspberry Pi (Trading) Ltd. All rights reserved. ++ * Copyright (c) 2010-2012 Broadcom. 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, ++ * without modification. ++ * 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. ++ * 3. The names of the above-listed copyright holders may not be used ++ * to endorse or promote products derived from this software without ++ * specific prior written permission. ++ * ++ * ALTERNATIVELY, this software may be distributed under the terms of the ++ * GNU General Public License ("GPL") version 2, as published by the Free ++ * Software Foundation. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER OR ++ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ++ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, ++ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR ++ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF ++ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING ++ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ */ ++ ++ ++#include <linux/debugfs.h> ++#include "vchiq_core.h" ++#include "vchiq_arm.h" ++#include "vchiq_debugfs.h" ++ ++#ifdef CONFIG_DEBUG_FS ++ ++/**************************************************************************** ++* ++* log category entries ++* ++***************************************************************************/ ++#define DEBUGFS_WRITE_BUF_SIZE 256 ++ ++#define VCHIQ_LOG_ERROR_STR "error" ++#define VCHIQ_LOG_WARNING_STR "warning" ++#define VCHIQ_LOG_INFO_STR "info" ++#define VCHIQ_LOG_TRACE_STR "trace" ++ ++ ++/* Top-level debug info */ ++struct vchiq_debugfs_info { ++ /* Global 'vchiq' debugfs entry used by all instances */ ++ struct dentry *vchiq_cfg_dir; ++ ++ /* one entry per client process */ ++ struct dentry *clients; ++ ++ /* log categories */ ++ struct dentry *log_categories; ++}; ++ ++static struct vchiq_debugfs_info debugfs_info; ++ ++/* Log category debugfs entries */ ++struct vchiq_debugfs_log_entry { ++ const char *name; ++ int *plevel; ++ struct dentry *dir; ++}; ++ ++static struct vchiq_debugfs_log_entry vchiq_debugfs_log_entries[] = { ++ { "core", &vchiq_core_log_level }, ++ { "msg", &vchiq_core_msg_log_level }, ++ { "sync", &vchiq_sync_log_level }, ++ { "susp", &vchiq_susp_log_level }, ++ { "arm", &vchiq_arm_log_level }, ++}; ++static int n_log_entries = ++ sizeof(vchiq_debugfs_log_entries)/sizeof(vchiq_debugfs_log_entries[0]); ++ ++ ++static struct dentry *vchiq_clients_top(void); ++static struct dentry *vchiq_debugfs_top(void); ++ ++static int debugfs_log_show(struct seq_file *f, void *offset) ++{ ++ int *levp = f->private; ++ char *log_value = NULL; ++ ++ switch (*levp) { ++ case VCHIQ_LOG_ERROR: ++ log_value = VCHIQ_LOG_ERROR_STR; ++ break; ++ case VCHIQ_LOG_WARNING: ++ log_value = VCHIQ_LOG_WARNING_STR; ++ break; ++ case VCHIQ_LOG_INFO: ++ log_value = VCHIQ_LOG_INFO_STR; ++ break; ++ case VCHIQ_LOG_TRACE: ++ log_value = VCHIQ_LOG_TRACE_STR; ++ break; ++ default: ++ break; ++ } ++ ++ seq_printf(f, "%s\n", log_value ? log_value : "(null)"); ++ ++ return 0; ++} ++ ++static int debugfs_log_open(struct inode *inode, struct file *file) ++{ ++ return single_open(file, debugfs_log_show, inode->i_private); ++} ++ ++static int debugfs_log_write(struct file *file, ++ const char __user *buffer, ++ size_t count, loff_t *ppos) ++{ ++ struct seq_file *f = (struct seq_file *)file->private_data; ++ int *levp = f->private; ++ char kbuf[DEBUGFS_WRITE_BUF_SIZE + 1]; ++ ++ memset(kbuf, 0, DEBUGFS_WRITE_BUF_SIZE + 1); ++ if (count >= DEBUGFS_WRITE_BUF_SIZE) ++ count = DEBUGFS_WRITE_BUF_SIZE; ++ ++ if (copy_from_user(kbuf, buffer, count) != 0) ++ return -EFAULT; ++ kbuf[count - 1] = 0; ++ ++ if (strncmp("error", kbuf, strlen("error")) == 0) ++ *levp = VCHIQ_LOG_ERROR; ++ else if (strncmp("warning", kbuf, strlen("warning")) == 0) ++ *levp = VCHIQ_LOG_WARNING; ++ else if (strncmp("info", kbuf, strlen("info")) == 0) ++ *levp = VCHIQ_LOG_INFO; ++ else if (strncmp("trace", kbuf, strlen("trace")) == 0) ++ *levp = VCHIQ_LOG_TRACE; ++ else ++ *levp = VCHIQ_LOG_DEFAULT; ++ ++ *ppos += count; ++ ++ return count; ++} ++ ++static const struct file_operations debugfs_log_fops = { ++ .owner = THIS_MODULE, ++ .open = debugfs_log_open, ++ .write = debugfs_log_write, ++ .read = seq_read, ++ .llseek = seq_lseek, ++ .release = single_release, ++}; ++ ++/* create an entry under <debugfs>/vchiq/log for each log category */ ++static int vchiq_debugfs_create_log_entries(struct dentry *top) ++{ ++ struct dentry *dir; ++ size_t i; ++ int ret = 0; ++ dir = debugfs_create_dir("log", vchiq_debugfs_top()); ++ if (!dir) ++ return -ENOMEM; ++ debugfs_info.log_categories = dir; ++ ++ for (i = 0; i < n_log_entries; i++) { ++ void *levp = (void *)vchiq_debugfs_log_entries[i].plevel; ++ dir = debugfs_create_file(vchiq_debugfs_log_entries[i].name, ++ 0644, ++ debugfs_info.log_categories, ++ levp, ++ &debugfs_log_fops); ++ if (!dir) { ++ ret = -ENOMEM; ++ break; ++ } ++ ++ vchiq_debugfs_log_entries[i].dir = dir; ++ } ++ return ret; ++} ++ ++static int debugfs_usecount_show(struct seq_file *f, void *offset) ++{ ++ VCHIQ_INSTANCE_T instance = f->private; ++ int use_count; ++ ++ use_count = vchiq_instance_get_use_count(instance); ++ seq_printf(f, "%d\n", use_count); ++ ++ return 0; ++} ++ ++static int debugfs_usecount_open(struct inode *inode, struct file *file) ++{ ++ return single_open(file, debugfs_usecount_show, inode->i_private); ++} ++ ++static const struct file_operations debugfs_usecount_fops = { ++ .owner = THIS_MODULE, ++ .open = debugfs_usecount_open, ++ .read = seq_read, ++ .llseek = seq_lseek, ++ .release = single_release, ++}; ++ ++static int debugfs_trace_show(struct seq_file *f, void *offset) ++{ ++ VCHIQ_INSTANCE_T instance = f->private; ++ int trace; ++ ++ trace = vchiq_instance_get_trace(instance); ++ seq_printf(f, "%s\n", trace ? "Y" : "N"); ++ ++ return 0; ++} ++ ++static int debugfs_trace_open(struct inode *inode, struct file *file) ++{ ++ return single_open(file, debugfs_trace_show, inode->i_private); ++} ++ ++static int debugfs_trace_write(struct file *file, ++ const char __user *buffer, ++ size_t count, loff_t *ppos) ++{ ++ struct seq_file *f = (struct seq_file *)file->private_data; ++ VCHIQ_INSTANCE_T instance = f->private; ++ char firstchar; ++ ++ if (copy_from_user(&firstchar, buffer, 1) != 0) ++ return -EFAULT; ++ ++ switch (firstchar) { ++ case 'Y': ++ case 'y': ++ case '1': ++ vchiq_instance_set_trace(instance, 1); ++ break; ++ case 'N': ++ case 'n': ++ case '0': ++ vchiq_instance_set_trace(instance, 0); ++ break; ++ default: ++ break; ++ } ++ ++ *ppos += count; ++ ++ return count; ++} ++ ++static const struct file_operations debugfs_trace_fops = { ++ .owner = THIS_MODULE, ++ .open = debugfs_trace_open, ++ .write = debugfs_trace_write, ++ .read = seq_read, ++ .llseek = seq_lseek, ++ .release = single_release, ++}; ++ ++/* add an instance (process) to the debugfs entries */ ++int vchiq_debugfs_add_instance(VCHIQ_INSTANCE_T instance) ++{ ++ char pidstr[16]; ++ struct dentry *top, *use_count, *trace; ++ struct dentry *clients = vchiq_clients_top(); ++ ++ snprintf(pidstr, sizeof(pidstr), "%d", ++ vchiq_instance_get_pid(instance)); ++ ++ top = debugfs_create_dir(pidstr, clients); ++ if (!top) ++ goto fail_top; ++ ++ use_count = debugfs_create_file("use_count", ++ 0444, top, ++ instance, ++ &debugfs_usecount_fops); ++ if (!use_count) ++ goto fail_use_count; ++ ++ trace = debugfs_create_file("trace", ++ 0644, top, ++ instance, ++ &debugfs_trace_fops); ++ if (!trace) ++ goto fail_trace; ++ ++ vchiq_instance_get_debugfs_node(instance)->dentry = top; ++ ++ return 0; ++ ++fail_trace: ++ debugfs_remove(use_count); ++fail_use_count: ++ debugfs_remove(top); ++fail_top: ++ return -ENOMEM; ++} ++ ++void vchiq_debugfs_remove_instance(VCHIQ_INSTANCE_T instance) ++{ ++ VCHIQ_DEBUGFS_NODE_T *node = vchiq_instance_get_debugfs_node(instance); ++ debugfs_remove_recursive(node->dentry); ++} ++ ++ ++int vchiq_debugfs_init(void) ++{ ++ BUG_ON(debugfs_info.vchiq_cfg_dir != NULL); ++ ++ debugfs_info.vchiq_cfg_dir = debugfs_create_dir("vchiq", NULL); ++ if (debugfs_info.vchiq_cfg_dir == NULL) ++ goto fail; ++ ++ debugfs_info.clients = debugfs_create_dir("clients", ++ vchiq_debugfs_top()); ++ if (!debugfs_info.clients) ++ goto fail; ++ ++ if (vchiq_debugfs_create_log_entries(vchiq_debugfs_top()) != 0) ++ goto fail; ++ ++ return 0; ++ ++fail: ++ vchiq_debugfs_deinit(); ++ vchiq_log_error(vchiq_arm_log_level, ++ "%s: failed to create debugfs directory", ++ __func__); ++ ++ return -ENOMEM; ++} ++ ++/* remove all the debugfs entries */ ++void vchiq_debugfs_deinit(void) ++{ ++ debugfs_remove_recursive(vchiq_debugfs_top()); ++} ++ ++static struct dentry *vchiq_clients_top(void) ++{ ++ return debugfs_info.clients; ++} ++ ++static struct dentry *vchiq_debugfs_top(void) ++{ ++ BUG_ON(debugfs_info.vchiq_cfg_dir == NULL); ++ return debugfs_info.vchiq_cfg_dir; ++} ++ ++#else /* CONFIG_DEBUG_FS */ ++ ++int vchiq_debugfs_init(void) ++{ ++ return 0; ++} ++ ++void vchiq_debugfs_deinit(void) ++{ ++} ++ ++int vchiq_debugfs_add_instance(VCHIQ_INSTANCE_T instance) ++{ ++ return 0; ++} ++ ++void vchiq_debugfs_remove_instance(VCHIQ_INSTANCE_T instance) ++{ ++} ++ ++#endif /* CONFIG_DEBUG_FS */ +diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_debugfs.h b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_debugfs.h +new file mode 100644 +index 0000000..4d6a378 +--- /dev/null ++++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_debugfs.h +@@ -0,0 +1,52 @@ ++/** ++ * Copyright (c) 2014 Raspberry Pi (Trading) Ltd. 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, ++ * without modification. ++ * 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. ++ * 3. The names of the above-listed copyright holders may not be used ++ * to endorse or promote products derived from this software without ++ * specific prior written permission. ++ * ++ * ALTERNATIVELY, this software may be distributed under the terms of the ++ * GNU General Public License ("GPL") version 2, as published by the Free ++ * Software Foundation. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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. ++ */ ++ ++#ifndef VCHIQ_DEBUGFS_H ++#define VCHIQ_DEBUGFS_H ++ ++#include "vchiq_core.h" ++ ++typedef struct vchiq_debugfs_node_struct ++{ ++ struct dentry *dentry; ++} VCHIQ_DEBUGFS_NODE_T; ++ ++int vchiq_debugfs_init(void); ++ ++void vchiq_debugfs_deinit(void); ++ ++int vchiq_debugfs_add_instance(VCHIQ_INSTANCE_T instance); ++ ++void vchiq_debugfs_remove_instance(VCHIQ_INSTANCE_T instance); ++ ++#endif /* VCHIQ_DEBUGFS_H */ +diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_genversion b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_genversion +new file mode 100644 +index 0000000..9f5b634 +--- /dev/null ++++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_genversion +@@ -0,0 +1,87 @@ ++#!/usr/bin/perl -w ++ ++use strict; ++ ++# ++# Generate a version from available information ++# ++ ++my $prefix = shift @ARGV; ++my $root = shift @ARGV; ++ ++ ++if ( not defined $root ) { ++ die "usage: $0 prefix root-dir\n"; ++} ++ ++if ( ! -d $root ) { ++ die "root directory $root not found\n"; ++} ++ ++my $version = "unknown"; ++my $tainted = ""; ++ ++if ( -d "$root/.git" ) { ++ # attempt to work out git version. only do so ++ # on a linux build host, as cygwin builds are ++ # already slow enough ++ ++ if ( -f "/usr/bin/git" || -f "/usr/local/bin/git" ) { ++ if (not open(F, "git --git-dir $root/.git rev-parse --verify HEAD|")) { ++ $version = "no git version"; ++ } ++ else { ++ $version = <F>; ++ $version =~ s/[ \r\n]*$//; # chomp may not be enough (cygwin). ++ $version =~ s/^[ \r\n]*//; # chomp may not be enough (cygwin). ++ } ++ ++ if (open(G, "git --git-dir $root/.git status --porcelain|")) { ++ $tainted = <G>; ++ $tainted =~ s/[ \r\n]*$//; # chomp may not be enough (cygwin). ++ $tainted =~ s/^[ \r\n]*//; # chomp may not be enough (cygwin). ++ if (length $tainted) { ++ $version = join ' ', $version, "(tainted)"; ++ } ++ else { ++ $version = join ' ', $version, "(clean)"; ++ } ++ } ++ } ++} ++ ++my $hostname = `hostname`; ++$hostname =~ s/[ \r\n]*$//; # chomp may not be enough (cygwin). ++$hostname =~ s/^[ \r\n]*//; # chomp may not be enough (cygwin). ++ ++ ++print STDERR "Version $version\n"; ++print <<EOF; ++#include "${prefix}_build_info.h" ++#include <linux/broadcom/vc_debug_sym.h> ++ ++VC_DEBUG_DECLARE_STRING_VAR( ${prefix}_build_hostname, "$hostname" ); ++VC_DEBUG_DECLARE_STRING_VAR( ${prefix}_build_version, "$version" ); ++VC_DEBUG_DECLARE_STRING_VAR( ${prefix}_build_time, __TIME__ ); ++VC_DEBUG_DECLARE_STRING_VAR( ${prefix}_build_date, __DATE__ ); ++ ++const char *vchiq_get_build_hostname( void ) ++{ ++ return vchiq_build_hostname; ++} ++ ++const char *vchiq_get_build_version( void ) ++{ ++ return vchiq_build_version; ++} ++ ++const char *vchiq_get_build_date( void ) ++{ ++ return vchiq_build_date; ++} ++ ++const char *vchiq_get_build_time( void ) ++{ ++ return vchiq_build_time; ++} ++EOF +diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_if.h b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_if.h +new file mode 100644 +index 0000000..8067bbe +--- /dev/null ++++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_if.h +@@ -0,0 +1,189 @@ ++/** ++ * Copyright (c) 2010-2012 Broadcom. 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, ++ * without modification. ++ * 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. ++ * 3. The names of the above-listed copyright holders may not be used ++ * to endorse or promote products derived from this software without ++ * specific prior written permission. ++ * ++ * ALTERNATIVELY, this software may be distributed under the terms of the ++ * GNU General Public License ("GPL") version 2, as published by the Free ++ * Software Foundation. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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. ++ */ ++ ++#ifndef VCHIQ_IF_H ++#define VCHIQ_IF_H ++ ++#include "interface/vchi/vchi_mh.h" ++ ++#define VCHIQ_SERVICE_HANDLE_INVALID 0 ++ ++#define VCHIQ_SLOT_SIZE 4096 ++#define VCHIQ_MAX_MSG_SIZE (VCHIQ_SLOT_SIZE - sizeof(VCHIQ_HEADER_T)) ++#define VCHIQ_CHANNEL_SIZE VCHIQ_MAX_MSG_SIZE /* For backwards compatibility */ ++ ++#define VCHIQ_MAKE_FOURCC(x0, x1, x2, x3) \ ++ (((x0) << 24) | ((x1) << 16) | ((x2) << 8) | (x3)) ++#define VCHIQ_GET_SERVICE_USERDATA(service) vchiq_get_service_userdata(service) ++#define VCHIQ_GET_SERVICE_FOURCC(service) vchiq_get_service_fourcc(service) ++ ++typedef enum { ++ VCHIQ_SERVICE_OPENED, /* service, -, - */ ++ VCHIQ_SERVICE_CLOSED, /* service, -, - */ ++ VCHIQ_MESSAGE_AVAILABLE, /* service, header, - */ ++ VCHIQ_BULK_TRANSMIT_DONE, /* service, -, bulk_userdata */ ++ VCHIQ_BULK_RECEIVE_DONE, /* service, -, bulk_userdata */ ++ VCHIQ_BULK_TRANSMIT_ABORTED, /* service, -, bulk_userdata */ ++ VCHIQ_BULK_RECEIVE_ABORTED /* service, -, bulk_userdata */ ++} VCHIQ_REASON_T; ++ ++typedef enum { ++ VCHIQ_ERROR = -1, ++ VCHIQ_SUCCESS = 0, ++ VCHIQ_RETRY = 1 ++} VCHIQ_STATUS_T; ++ ++typedef enum { ++ VCHIQ_BULK_MODE_CALLBACK, ++ VCHIQ_BULK_MODE_BLOCKING, ++ VCHIQ_BULK_MODE_NOCALLBACK, ++ VCHIQ_BULK_MODE_WAITING /* Reserved for internal use */ ++} VCHIQ_BULK_MODE_T; ++ ++typedef enum { ++ VCHIQ_SERVICE_OPTION_AUTOCLOSE, ++ VCHIQ_SERVICE_OPTION_SLOT_QUOTA, ++ VCHIQ_SERVICE_OPTION_MESSAGE_QUOTA, ++ VCHIQ_SERVICE_OPTION_SYNCHRONOUS, ++ VCHIQ_SERVICE_OPTION_TRACE ++} VCHIQ_SERVICE_OPTION_T; ++ ++typedef struct vchiq_header_struct { ++ /* The message identifier - opaque to applications. */ ++ int msgid; ++ ++ /* Size of message data. */ ++ unsigned int size; ++ ++ char data[0]; /* message */ ++} VCHIQ_HEADER_T; ++ ++typedef struct { ++ const void *data; ++ unsigned int size; ++} VCHIQ_ELEMENT_T; ++ ++typedef unsigned int VCHIQ_SERVICE_HANDLE_T; ++ ++typedef VCHIQ_STATUS_T (*VCHIQ_CALLBACK_T)(VCHIQ_REASON_T, VCHIQ_HEADER_T *, ++ VCHIQ_SERVICE_HANDLE_T, void *); ++ ++typedef struct vchiq_service_base_struct { ++ int fourcc; ++ VCHIQ_CALLBACK_T callback; ++ void *userdata; ++} VCHIQ_SERVICE_BASE_T; ++ ++typedef struct vchiq_service_params_struct { ++ int fourcc; ++ VCHIQ_CALLBACK_T callback; ++ void *userdata; ++ short version; /* Increment for non-trivial changes */ ++ short version_min; /* Update for incompatible changes */ ++} VCHIQ_SERVICE_PARAMS_T; ++ ++typedef struct vchiq_config_struct { ++ unsigned int max_msg_size; ++ unsigned int bulk_threshold; /* The message size above which it ++ is better to use a bulk transfer ++ (<= max_msg_size) */ ++ unsigned int max_outstanding_bulks; ++ unsigned int max_services; ++ short version; /* The version of VCHIQ */ ++ short version_min; /* The minimum compatible version of VCHIQ */ ++} VCHIQ_CONFIG_T; ++ ++typedef struct vchiq_instance_struct *VCHIQ_INSTANCE_T; ++typedef void (*VCHIQ_REMOTE_USE_CALLBACK_T)(void *cb_arg); ++ ++extern VCHIQ_STATUS_T vchiq_initialise(VCHIQ_INSTANCE_T *pinstance); ++extern VCHIQ_STATUS_T vchiq_shutdown(VCHIQ_INSTANCE_T instance); ++extern VCHIQ_STATUS_T vchiq_connect(VCHIQ_INSTANCE_T instance); ++extern VCHIQ_STATUS_T vchiq_add_service(VCHIQ_INSTANCE_T instance, ++ const VCHIQ_SERVICE_PARAMS_T *params, ++ VCHIQ_SERVICE_HANDLE_T *pservice); ++extern VCHIQ_STATUS_T vchiq_open_service(VCHIQ_INSTANCE_T instance, ++ const VCHIQ_SERVICE_PARAMS_T *params, ++ VCHIQ_SERVICE_HANDLE_T *pservice); ++extern VCHIQ_STATUS_T vchiq_close_service(VCHIQ_SERVICE_HANDLE_T service); ++extern VCHIQ_STATUS_T vchiq_remove_service(VCHIQ_SERVICE_HANDLE_T service); ++extern VCHIQ_STATUS_T vchiq_use_service(VCHIQ_SERVICE_HANDLE_T service); ++extern VCHIQ_STATUS_T vchiq_use_service_no_resume( ++ VCHIQ_SERVICE_HANDLE_T service); ++extern VCHIQ_STATUS_T vchiq_release_service(VCHIQ_SERVICE_HANDLE_T service); ++ ++extern VCHIQ_STATUS_T vchiq_queue_message(VCHIQ_SERVICE_HANDLE_T service, ++ const VCHIQ_ELEMENT_T *elements, unsigned int count); ++extern void vchiq_release_message(VCHIQ_SERVICE_HANDLE_T service, ++ VCHIQ_HEADER_T *header); ++extern VCHIQ_STATUS_T vchiq_queue_bulk_transmit(VCHIQ_SERVICE_HANDLE_T service, ++ const void *data, unsigned int size, void *userdata); ++extern VCHIQ_STATUS_T vchiq_queue_bulk_receive(VCHIQ_SERVICE_HANDLE_T service, ++ void *data, unsigned int size, void *userdata); ++extern VCHIQ_STATUS_T vchiq_queue_bulk_transmit_handle( ++ VCHIQ_SERVICE_HANDLE_T service, VCHI_MEM_HANDLE_T handle, ++ const void *offset, unsigned int size, void *userdata); ++extern VCHIQ_STATUS_T vchiq_queue_bulk_receive_handle( ++ VCHIQ_SERVICE_HANDLE_T service, VCHI_MEM_HANDLE_T handle, ++ void *offset, unsigned int size, void *userdata); ++extern VCHIQ_STATUS_T vchiq_bulk_transmit(VCHIQ_SERVICE_HANDLE_T service, ++ const void *data, unsigned int size, void *userdata, ++ VCHIQ_BULK_MODE_T mode); ++extern VCHIQ_STATUS_T vchiq_bulk_receive(VCHIQ_SERVICE_HANDLE_T service, ++ void *data, unsigned int size, void *userdata, ++ VCHIQ_BULK_MODE_T mode); ++extern VCHIQ_STATUS_T vchiq_bulk_transmit_handle(VCHIQ_SERVICE_HANDLE_T service, ++ VCHI_MEM_HANDLE_T handle, const void *offset, unsigned int size, ++ void *userdata, VCHIQ_BULK_MODE_T mode); ++extern VCHIQ_STATUS_T vchiq_bulk_receive_handle(VCHIQ_SERVICE_HANDLE_T service, ++ VCHI_MEM_HANDLE_T handle, void *offset, unsigned int size, ++ void *userdata, VCHIQ_BULK_MODE_T mode); ++extern int vchiq_get_client_id(VCHIQ_SERVICE_HANDLE_T service); ++extern void *vchiq_get_service_userdata(VCHIQ_SERVICE_HANDLE_T service); ++extern int vchiq_get_service_fourcc(VCHIQ_SERVICE_HANDLE_T service); ++extern VCHIQ_STATUS_T vchiq_get_config(VCHIQ_INSTANCE_T instance, ++ int config_size, VCHIQ_CONFIG_T *pconfig); ++extern VCHIQ_STATUS_T vchiq_set_service_option(VCHIQ_SERVICE_HANDLE_T service, ++ VCHIQ_SERVICE_OPTION_T option, int value); ++ ++extern VCHIQ_STATUS_T vchiq_remote_use(VCHIQ_INSTANCE_T instance, ++ VCHIQ_REMOTE_USE_CALLBACK_T callback, void *cb_arg); ++extern VCHIQ_STATUS_T vchiq_remote_release(VCHIQ_INSTANCE_T instance); ++ ++extern VCHIQ_STATUS_T vchiq_dump_phys_mem(VCHIQ_SERVICE_HANDLE_T service, ++ void *ptr, size_t num_bytes); ++ ++extern VCHIQ_STATUS_T vchiq_get_peer_version(VCHIQ_SERVICE_HANDLE_T handle, ++ short *peer_version); ++ ++#endif /* VCHIQ_IF_H */ +diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_ioctl.h b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_ioctl.h +new file mode 100644 +index 0000000..6137ae9 +--- /dev/null ++++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_ioctl.h +@@ -0,0 +1,131 @@ ++/** ++ * Copyright (c) 2010-2012 Broadcom. 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, ++ * without modification. ++ * 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. ++ * 3. The names of the above-listed copyright holders may not be used ++ * to endorse or promote products derived from this software without ++ * specific prior written permission. ++ * ++ * ALTERNATIVELY, this software may be distributed under the terms of the ++ * GNU General Public License ("GPL") version 2, as published by the Free ++ * Software Foundation. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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. ++ */ ++ ++#ifndef VCHIQ_IOCTLS_H ++#define VCHIQ_IOCTLS_H ++ ++#include <linux/ioctl.h> ++#include "vchiq_if.h" ++ ++#define VCHIQ_IOC_MAGIC 0xc4 ++#define VCHIQ_INVALID_HANDLE (~0) ++ ++typedef struct { ++ VCHIQ_SERVICE_PARAMS_T params; ++ int is_open; ++ int is_vchi; ++ unsigned int handle; /* OUT */ ++} VCHIQ_CREATE_SERVICE_T; ++ ++typedef struct { ++ unsigned int handle; ++ unsigned int count; ++ const VCHIQ_ELEMENT_T *elements; ++} VCHIQ_QUEUE_MESSAGE_T; ++ ++typedef struct { ++ unsigned int handle; ++ void *data; ++ unsigned int size; ++ void *userdata; ++ VCHIQ_BULK_MODE_T mode; ++} VCHIQ_QUEUE_BULK_TRANSFER_T; ++ ++typedef struct { ++ VCHIQ_REASON_T reason; ++ VCHIQ_HEADER_T *header; ++ void *service_userdata; ++ void *bulk_userdata; ++} VCHIQ_COMPLETION_DATA_T; ++ ++typedef struct { ++ unsigned int count; ++ VCHIQ_COMPLETION_DATA_T *buf; ++ unsigned int msgbufsize; ++ unsigned int msgbufcount; /* IN/OUT */ ++ void **msgbufs; ++} VCHIQ_AWAIT_COMPLETION_T; ++ ++typedef struct { ++ unsigned int handle; ++ int blocking; ++ unsigned int bufsize; ++ void *buf; ++} VCHIQ_DEQUEUE_MESSAGE_T; ++ ++typedef struct { ++ unsigned int config_size; ++ VCHIQ_CONFIG_T *pconfig; ++} VCHIQ_GET_CONFIG_T; ++ ++typedef struct { ++ unsigned int handle; ++ VCHIQ_SERVICE_OPTION_T option; ++ int value; ++} VCHIQ_SET_SERVICE_OPTION_T; ++ ++typedef struct { ++ void *virt_addr; ++ size_t num_bytes; ++} VCHIQ_DUMP_MEM_T; ++ ++#define VCHIQ_IOC_CONNECT _IO(VCHIQ_IOC_MAGIC, 0) ++#define VCHIQ_IOC_SHUTDOWN _IO(VCHIQ_IOC_MAGIC, 1) ++#define VCHIQ_IOC_CREATE_SERVICE \ ++ _IOWR(VCHIQ_IOC_MAGIC, 2, VCHIQ_CREATE_SERVICE_T) ++#define VCHIQ_IOC_REMOVE_SERVICE _IO(VCHIQ_IOC_MAGIC, 3) ++#define VCHIQ_IOC_QUEUE_MESSAGE \ ++ _IOW(VCHIQ_IOC_MAGIC, 4, VCHIQ_QUEUE_MESSAGE_T) ++#define VCHIQ_IOC_QUEUE_BULK_TRANSMIT \ ++ _IOWR(VCHIQ_IOC_MAGIC, 5, VCHIQ_QUEUE_BULK_TRANSFER_T) ++#define VCHIQ_IOC_QUEUE_BULK_RECEIVE \ ++ _IOWR(VCHIQ_IOC_MAGIC, 6, VCHIQ_QUEUE_BULK_TRANSFER_T) ++#define VCHIQ_IOC_AWAIT_COMPLETION \ ++ _IOWR(VCHIQ_IOC_MAGIC, 7, VCHIQ_AWAIT_COMPLETION_T) ++#define VCHIQ_IOC_DEQUEUE_MESSAGE \ ++ _IOWR(VCHIQ_IOC_MAGIC, 8, VCHIQ_DEQUEUE_MESSAGE_T) ++#define VCHIQ_IOC_GET_CLIENT_ID _IO(VCHIQ_IOC_MAGIC, 9) ++#define VCHIQ_IOC_GET_CONFIG \ ++ _IOWR(VCHIQ_IOC_MAGIC, 10, VCHIQ_GET_CONFIG_T) ++#define VCHIQ_IOC_CLOSE_SERVICE _IO(VCHIQ_IOC_MAGIC, 11) ++#define VCHIQ_IOC_USE_SERVICE _IO(VCHIQ_IOC_MAGIC, 12) ++#define VCHIQ_IOC_RELEASE_SERVICE _IO(VCHIQ_IOC_MAGIC, 13) ++#define VCHIQ_IOC_SET_SERVICE_OPTION \ ++ _IOW(VCHIQ_IOC_MAGIC, 14, VCHIQ_SET_SERVICE_OPTION_T) ++#define VCHIQ_IOC_DUMP_PHYS_MEM \ ++ _IOW(VCHIQ_IOC_MAGIC, 15, VCHIQ_DUMP_MEM_T) ++#define VCHIQ_IOC_LIB_VERSION _IO(VCHIQ_IOC_MAGIC, 16) ++#define VCHIQ_IOC_CLOSE_DELIVERED _IO(VCHIQ_IOC_MAGIC, 17) ++#define VCHIQ_IOC_MAX 17 ++ ++#endif +diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_kern_lib.c b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_kern_lib.c +new file mode 100644 +index 0000000..25e7011 +--- /dev/null ++++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_kern_lib.c +@@ -0,0 +1,458 @@ ++/** ++ * Copyright (c) 2010-2012 Broadcom. 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, ++ * without modification. ++ * 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. ++ * 3. The names of the above-listed copyright holders may not be used ++ * to endorse or promote products derived from this software without ++ * specific prior written permission. ++ * ++ * ALTERNATIVELY, this software may be distributed under the terms of the ++ * GNU General Public License ("GPL") version 2, as published by the Free ++ * Software Foundation. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER OR ++ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ++ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, ++ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR ++ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF ++ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING ++ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ */ ++ ++/* ---- Include Files ---------------------------------------------------- */ ++ ++#include <linux/kernel.h> ++#include <linux/module.h> ++#include <linux/mutex.h> ++ ++#include "vchiq_core.h" ++#include "vchiq_arm.h" ++#include "vchiq_killable.h" ++ ++/* ---- Public Variables ------------------------------------------------- */ ++ ++/* ---- Private Constants and Types -------------------------------------- */ ++ ++struct bulk_waiter_node { ++ struct bulk_waiter bulk_waiter; ++ int pid; ++ struct list_head list; ++}; ++ ++struct vchiq_instance_struct { ++ VCHIQ_STATE_T *state; ++ ++ int connected; ++ ++ struct list_head bulk_waiter_list; ++ struct mutex bulk_waiter_list_mutex; ++}; ++ ++static VCHIQ_STATUS_T ++vchiq_blocking_bulk_transfer(VCHIQ_SERVICE_HANDLE_T handle, void *data, ++ unsigned int size, VCHIQ_BULK_DIR_T dir); ++ ++/**************************************************************************** ++* ++* vchiq_initialise ++* ++***************************************************************************/ ++#define VCHIQ_INIT_RETRIES 10 ++VCHIQ_STATUS_T vchiq_initialise(VCHIQ_INSTANCE_T *instanceOut) ++{ ++ VCHIQ_STATUS_T status = VCHIQ_ERROR; ++ VCHIQ_STATE_T *state; ++ VCHIQ_INSTANCE_T instance = NULL; ++ int i; ++ ++ vchiq_log_trace(vchiq_core_log_level, "%s called", __func__); ++ ++ /* VideoCore may not be ready due to boot up timing. ++ It may never be ready if kernel and firmware are mismatched, so don't block forever. */ ++ for (i=0; i<VCHIQ_INIT_RETRIES; i++) { ++ state = vchiq_get_state(); ++ if (state) ++ break; ++ udelay(500); ++ } ++ if (i==VCHIQ_INIT_RETRIES) { ++ vchiq_log_error(vchiq_core_log_level, ++ "%s: videocore not initialized\n", __func__); ++ goto failed; ++ } else if (i>0) { ++ vchiq_log_warning(vchiq_core_log_level, ++ "%s: videocore initialized after %d retries\n", __func__, i); ++ } ++ ++ instance = kzalloc(sizeof(*instance), GFP_KERNEL); ++ if (!instance) { ++ vchiq_log_error(vchiq_core_log_level, ++ "%s: error allocating vchiq instance\n", __func__); ++ goto failed; ++ } ++ ++ instance->connected = 0; ++ instance->state = state; ++ mutex_init(&instance->bulk_waiter_list_mutex); ++ INIT_LIST_HEAD(&instance->bulk_waiter_list); ++ ++ *instanceOut = instance; ++ ++ status = VCHIQ_SUCCESS; ++ ++failed: ++ vchiq_log_trace(vchiq_core_log_level, ++ "%s(%p): returning %d", __func__, instance, status); ++ ++ return status; ++} ++EXPORT_SYMBOL(vchiq_initialise); ++ ++/**************************************************************************** ++* ++* vchiq_shutdown ++* ++***************************************************************************/ ++ ++VCHIQ_STATUS_T vchiq_shutdown(VCHIQ_INSTANCE_T instance) ++{ ++ VCHIQ_STATUS_T status; ++ VCHIQ_STATE_T *state = instance->state; ++ ++ vchiq_log_trace(vchiq_core_log_level, ++ "%s(%p) called", __func__, instance); ++ ++ if (mutex_lock_interruptible(&state->mutex) != 0) ++ return VCHIQ_RETRY; ++ ++ /* Remove all services */ ++ status = vchiq_shutdown_internal(state, instance); ++ ++ mutex_unlock(&state->mutex); ++ ++ vchiq_log_trace(vchiq_core_log_level, ++ "%s(%p): returning %d", __func__, instance, status); ++ ++ if (status == VCHIQ_SUCCESS) { ++ struct list_head *pos, *next; ++ list_for_each_safe(pos, next, ++ &instance->bulk_waiter_list) { ++ struct bulk_waiter_node *waiter; ++ waiter = list_entry(pos, ++ struct bulk_waiter_node, ++ list); ++ list_del(pos); ++ vchiq_log_info(vchiq_arm_log_level, ++ "bulk_waiter - cleaned up %x " ++ "for pid %d", ++ (unsigned int)waiter, waiter->pid); ++ kfree(waiter); ++ } ++ kfree(instance); ++ } ++ ++ return status; ++} ++EXPORT_SYMBOL(vchiq_shutdown); ++ ++/**************************************************************************** ++* ++* vchiq_is_connected ++* ++***************************************************************************/ ++ ++int vchiq_is_connected(VCHIQ_INSTANCE_T instance) ++{ ++ return instance->connected; ++} ++ ++/**************************************************************************** ++* ++* vchiq_connect ++* ++***************************************************************************/ ++ ++VCHIQ_STATUS_T vchiq_connect(VCHIQ_INSTANCE_T instance) ++{ ++ VCHIQ_STATUS_T status; ++ VCHIQ_STATE_T *state = instance->state; ++ ++ vchiq_log_trace(vchiq_core_log_level, ++ "%s(%p) called", __func__, instance); ++ ++ if (mutex_lock_interruptible(&state->mutex) != 0) { ++ vchiq_log_trace(vchiq_core_log_level, ++ "%s: call to mutex_lock failed", __func__); ++ status = VCHIQ_RETRY; ++ goto failed; ++ } ++ status = vchiq_connect_internal(state, instance); ++ ++ if (status == VCHIQ_SUCCESS) ++ instance->connected = 1; ++ ++ mutex_unlock(&state->mutex); ++ ++failed: ++ vchiq_log_trace(vchiq_core_log_level, ++ "%s(%p): returning %d", __func__, instance, status); ++ ++ return status; ++} ++EXPORT_SYMBOL(vchiq_connect); ++ ++/**************************************************************************** ++* ++* vchiq_add_service ++* ++***************************************************************************/ ++ ++VCHIQ_STATUS_T vchiq_add_service( ++ VCHIQ_INSTANCE_T instance, ++ const VCHIQ_SERVICE_PARAMS_T *params, ++ VCHIQ_SERVICE_HANDLE_T *phandle) ++{ ++ VCHIQ_STATUS_T status; ++ VCHIQ_STATE_T *state = instance->state; ++ VCHIQ_SERVICE_T *service = NULL; ++ int srvstate; ++ ++ vchiq_log_trace(vchiq_core_log_level, ++ "%s(%p) called", __func__, instance); ++ ++ *phandle = VCHIQ_SERVICE_HANDLE_INVALID; ++ ++ srvstate = vchiq_is_connected(instance) ++ ? VCHIQ_SRVSTATE_LISTENING ++ : VCHIQ_SRVSTATE_HIDDEN; ++ ++ service = vchiq_add_service_internal( ++ state, ++ params, ++ srvstate, ++ instance, ++ NULL); ++ ++ if (service) { ++ *phandle = service->handle; ++ status = VCHIQ_SUCCESS; ++ } else ++ status = VCHIQ_ERROR; ++ ++ vchiq_log_trace(vchiq_core_log_level, ++ "%s(%p): returning %d", __func__, instance, status); ++ ++ return status; ++} ++EXPORT_SYMBOL(vchiq_add_service); ++ ++/**************************************************************************** ++* ++* vchiq_open_service ++* ++***************************************************************************/ ++ ++VCHIQ_STATUS_T vchiq_open_service( ++ VCHIQ_INSTANCE_T instance, ++ const VCHIQ_SERVICE_PARAMS_T *params, ++ VCHIQ_SERVICE_HANDLE_T *phandle) ++{ ++ VCHIQ_STATUS_T status = VCHIQ_ERROR; ++ VCHIQ_STATE_T *state = instance->state; ++ VCHIQ_SERVICE_T *service = NULL; ++ ++ vchiq_log_trace(vchiq_core_log_level, ++ "%s(%p) called", __func__, instance); ++ ++ *phandle = VCHIQ_SERVICE_HANDLE_INVALID; ++ ++ if (!vchiq_is_connected(instance)) ++ goto failed; ++ ++ service = vchiq_add_service_internal(state, ++ params, ++ VCHIQ_SRVSTATE_OPENING, ++ instance, ++ NULL); ++ ++ if (service) { ++ *phandle = service->handle; ++ status = vchiq_open_service_internal(service, current->pid); ++ if (status != VCHIQ_SUCCESS) { ++ vchiq_remove_service(service->handle); ++ *phandle = VCHIQ_SERVICE_HANDLE_INVALID; ++ } ++ } ++ ++failed: ++ vchiq_log_trace(vchiq_core_log_level, ++ "%s(%p): returning %d", __func__, instance, status); ++ ++ return status; ++} ++EXPORT_SYMBOL(vchiq_open_service); ++ ++VCHIQ_STATUS_T ++vchiq_queue_bulk_transmit(VCHIQ_SERVICE_HANDLE_T handle, ++ const void *data, unsigned int size, void *userdata) ++{ ++ return vchiq_bulk_transfer(handle, ++ VCHI_MEM_HANDLE_INVALID, (void *)data, size, userdata, ++ VCHIQ_BULK_MODE_CALLBACK, VCHIQ_BULK_TRANSMIT); ++} ++EXPORT_SYMBOL(vchiq_queue_bulk_transmit); ++ ++VCHIQ_STATUS_T ++vchiq_queue_bulk_receive(VCHIQ_SERVICE_HANDLE_T handle, void *data, ++ unsigned int size, void *userdata) ++{ ++ return vchiq_bulk_transfer(handle, ++ VCHI_MEM_HANDLE_INVALID, data, size, userdata, ++ VCHIQ_BULK_MODE_CALLBACK, VCHIQ_BULK_RECEIVE); ++} ++EXPORT_SYMBOL(vchiq_queue_bulk_receive); ++ ++VCHIQ_STATUS_T ++vchiq_bulk_transmit(VCHIQ_SERVICE_HANDLE_T handle, const void *data, ++ unsigned int size, void *userdata, VCHIQ_BULK_MODE_T mode) ++{ ++ VCHIQ_STATUS_T status; ++ ++ switch (mode) { ++ case VCHIQ_BULK_MODE_NOCALLBACK: ++ case VCHIQ_BULK_MODE_CALLBACK: ++ status = vchiq_bulk_transfer(handle, ++ VCHI_MEM_HANDLE_INVALID, (void *)data, size, userdata, ++ mode, VCHIQ_BULK_TRANSMIT); ++ break; ++ case VCHIQ_BULK_MODE_BLOCKING: ++ status = vchiq_blocking_bulk_transfer(handle, ++ (void *)data, size, VCHIQ_BULK_TRANSMIT); ++ break; ++ default: ++ return VCHIQ_ERROR; ++ } ++ ++ return status; ++} ++EXPORT_SYMBOL(vchiq_bulk_transmit); ++ ++VCHIQ_STATUS_T ++vchiq_bulk_receive(VCHIQ_SERVICE_HANDLE_T handle, void *data, ++ unsigned int size, void *userdata, VCHIQ_BULK_MODE_T mode) ++{ ++ VCHIQ_STATUS_T status; ++ ++ switch (mode) { ++ case VCHIQ_BULK_MODE_NOCALLBACK: ++ case VCHIQ_BULK_MODE_CALLBACK: ++ status = vchiq_bulk_transfer(handle, ++ VCHI_MEM_HANDLE_INVALID, data, size, userdata, ++ mode, VCHIQ_BULK_RECEIVE); ++ break; ++ case VCHIQ_BULK_MODE_BLOCKING: ++ status = vchiq_blocking_bulk_transfer(handle, ++ (void *)data, size, VCHIQ_BULK_RECEIVE); ++ break; ++ default: ++ return VCHIQ_ERROR; ++ } ++ ++ return status; ++} ++EXPORT_SYMBOL(vchiq_bulk_receive); ++ ++static VCHIQ_STATUS_T ++vchiq_blocking_bulk_transfer(VCHIQ_SERVICE_HANDLE_T handle, void *data, ++ unsigned int size, VCHIQ_BULK_DIR_T dir) ++{ ++ VCHIQ_INSTANCE_T instance; ++ VCHIQ_SERVICE_T *service; ++ VCHIQ_STATUS_T status; ++ struct bulk_waiter_node *waiter = NULL; ++ struct list_head *pos; ++ ++ service = find_service_by_handle(handle); ++ if (!service) ++ return VCHIQ_ERROR; ++ ++ instance = service->instance; ++ ++ unlock_service(service); ++ ++ mutex_lock(&instance->bulk_waiter_list_mutex); ++ list_for_each(pos, &instance->bulk_waiter_list) { ++ if (list_entry(pos, struct bulk_waiter_node, ++ list)->pid == current->pid) { ++ waiter = list_entry(pos, ++ struct bulk_waiter_node, ++ list); ++ list_del(pos); ++ break; ++ } ++ } ++ mutex_unlock(&instance->bulk_waiter_list_mutex); ++ ++ if (waiter) { ++ VCHIQ_BULK_T *bulk = waiter->bulk_waiter.bulk; ++ if (bulk) { ++ /* This thread has an outstanding bulk transfer. */ ++ if ((bulk->data != data) || ++ (bulk->size != size)) { ++ /* This is not a retry of the previous one. ++ ** Cancel the signal when the transfer ++ ** completes. */ ++ spin_lock(&bulk_waiter_spinlock); ++ bulk->userdata = NULL; ++ spin_unlock(&bulk_waiter_spinlock); ++ } ++ } ++ } ++ ++ if (!waiter) { ++ waiter = kzalloc(sizeof(struct bulk_waiter_node), GFP_KERNEL); ++ if (!waiter) { ++ vchiq_log_error(vchiq_core_log_level, ++ "%s - out of memory", __func__); ++ return VCHIQ_ERROR; ++ } ++ } ++ ++ status = vchiq_bulk_transfer(handle, VCHI_MEM_HANDLE_INVALID, ++ data, size, &waiter->bulk_waiter, VCHIQ_BULK_MODE_BLOCKING, ++ dir); ++ if ((status != VCHIQ_RETRY) || fatal_signal_pending(current) || ++ !waiter->bulk_waiter.bulk) { ++ VCHIQ_BULK_T *bulk = waiter->bulk_waiter.bulk; ++ if (bulk) { ++ /* Cancel the signal when the transfer ++ ** completes. */ ++ spin_lock(&bulk_waiter_spinlock); ++ bulk->userdata = NULL; ++ spin_unlock(&bulk_waiter_spinlock); ++ } ++ kfree(waiter); ++ } else { ++ waiter->pid = current->pid; ++ mutex_lock(&instance->bulk_waiter_list_mutex); ++ list_add(&waiter->list, &instance->bulk_waiter_list); ++ mutex_unlock(&instance->bulk_waiter_list_mutex); ++ vchiq_log_info(vchiq_arm_log_level, ++ "saved bulk_waiter %x for pid %d", ++ (unsigned int)waiter, current->pid); ++ } ++ ++ return status; ++} +diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_killable.h b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_killable.h +new file mode 100644 +index 0000000..335446e +--- /dev/null ++++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_killable.h +@@ -0,0 +1,69 @@ ++/** ++ * Copyright (c) 2010-2012 Broadcom. 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, ++ * without modification. ++ * 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. ++ * 3. The names of the above-listed copyright holders may not be used ++ * to endorse or promote products derived from this software without ++ * specific prior written permission. ++ * ++ * ALTERNATIVELY, this software may be distributed under the terms of the ++ * GNU General Public License ("GPL") version 2, as published by the Free ++ * Software Foundation. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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. ++ */ ++ ++#ifndef VCHIQ_KILLABLE_H ++#define VCHIQ_KILLABLE_H ++ ++#include <linux/mutex.h> ++#include <linux/semaphore.h> ++ ++#define SHUTDOWN_SIGS (sigmask(SIGKILL) | sigmask(SIGINT) | sigmask(SIGQUIT) | sigmask(SIGTRAP) | sigmask(SIGSTOP) | sigmask(SIGCONT)) ++ ++static inline int __must_check down_interruptible_killable(struct semaphore *sem) ++{ ++ /* Allow interception of killable signals only. We don't want to be interrupted by harmless signals like SIGALRM */ ++ int ret; ++ sigset_t blocked, oldset; ++ siginitsetinv(&blocked, SHUTDOWN_SIGS); ++ sigprocmask(SIG_SETMASK, &blocked, &oldset); ++ ret = down_interruptible(sem); ++ sigprocmask(SIG_SETMASK, &oldset, NULL); ++ return ret; ++} ++#define down_interruptible down_interruptible_killable ++ ++ ++static inline int __must_check mutex_lock_interruptible_killable(struct mutex *lock) ++{ ++ /* Allow interception of killable signals only. We don't want to be interrupted by harmless signals like SIGALRM */ ++ int ret; ++ sigset_t blocked, oldset; ++ siginitsetinv(&blocked, SHUTDOWN_SIGS); ++ sigprocmask(SIG_SETMASK, &blocked, &oldset); ++ ret = mutex_lock_interruptible(lock); ++ sigprocmask(SIG_SETMASK, &oldset, NULL); ++ return ret; ++} ++#define mutex_lock_interruptible mutex_lock_interruptible_killable ++ ++#endif +diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_memdrv.h b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_memdrv.h +new file mode 100644 +index 0000000..d02e776 +--- /dev/null ++++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_memdrv.h +@@ -0,0 +1,71 @@ ++/** ++ * Copyright (c) 2010-2012 Broadcom. 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, ++ * without modification. ++ * 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. ++ * 3. The names of the above-listed copyright holders may not be used ++ * to endorse or promote products derived from this software without ++ * specific prior written permission. ++ * ++ * ALTERNATIVELY, this software may be distributed under the terms of the ++ * GNU General Public License ("GPL") version 2, as published by the Free ++ * Software Foundation. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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. ++ */ ++ ++#ifndef VCHIQ_MEMDRV_H ++#define VCHIQ_MEMDRV_H ++ ++/* ---- Include Files ----------------------------------------------------- */ ++ ++#include <linux/kernel.h> ++#include "vchiq_if.h" ++ ++/* ---- Constants and Types ---------------------------------------------- */ ++ ++typedef struct { ++ void *armSharedMemVirt; ++ dma_addr_t armSharedMemPhys; ++ size_t armSharedMemSize; ++ ++ void *vcSharedMemVirt; ++ dma_addr_t vcSharedMemPhys; ++ size_t vcSharedMemSize; ++} VCHIQ_SHARED_MEM_INFO_T; ++ ++/* ---- Variable Externs ------------------------------------------------- */ ++ ++/* ---- Function Prototypes ---------------------------------------------- */ ++ ++void vchiq_get_shared_mem_info(VCHIQ_SHARED_MEM_INFO_T *info); ++ ++VCHIQ_STATUS_T vchiq_memdrv_initialise(void); ++ ++VCHIQ_STATUS_T vchiq_userdrv_create_instance( ++ const VCHIQ_PLATFORM_DATA_T * platform_data); ++ ++VCHIQ_STATUS_T vchiq_userdrv_suspend( ++ const VCHIQ_PLATFORM_DATA_T * platform_data); ++ ++VCHIQ_STATUS_T vchiq_userdrv_resume( ++ const VCHIQ_PLATFORM_DATA_T * platform_data); ++ ++#endif +diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_pagelist.h b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_pagelist.h +new file mode 100644 +index 0000000..54a3ece +--- /dev/null ++++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_pagelist.h +@@ -0,0 +1,58 @@ ++/** ++ * Copyright (c) 2010-2012 Broadcom. 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, ++ * without modification. ++ * 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. ++ * 3. The names of the above-listed copyright holders may not be used ++ * to endorse or promote products derived from this software without ++ * specific prior written permission. ++ * ++ * ALTERNATIVELY, this software may be distributed under the terms of the ++ * GNU General Public License ("GPL") version 2, as published by the Free ++ * Software Foundation. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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. ++ */ ++ ++#ifndef VCHIQ_PAGELIST_H ++#define VCHIQ_PAGELIST_H ++ ++#ifndef PAGE_SIZE ++#define PAGE_SIZE 4096 ++#endif ++#define CACHE_LINE_SIZE 32 ++#define PAGELIST_WRITE 0 ++#define PAGELIST_READ 1 ++#define PAGELIST_READ_WITH_FRAGMENTS 2 ++ ++typedef struct pagelist_struct { ++ unsigned long length; ++ unsigned short type; ++ unsigned short offset; ++ unsigned long addrs[1]; /* N.B. 12 LSBs hold the number of following ++ pages at consecutive addresses. */ ++} PAGELIST_T; ++ ++typedef struct fragments_struct { ++ char headbuf[CACHE_LINE_SIZE]; ++ char tailbuf[CACHE_LINE_SIZE]; ++} FRAGMENTS_T; ++ ++#endif /* VCHIQ_PAGELIST_H */ +diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_shim.c b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_shim.c +new file mode 100644 +index 0000000..8072ff6 +--- /dev/null ++++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_shim.c +@@ -0,0 +1,860 @@ ++/** ++ * Copyright (c) 2010-2012 Broadcom. 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, ++ * without modification. ++ * 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. ++ * 3. The names of the above-listed copyright holders may not be used ++ * to endorse or promote products derived from this software without ++ * specific prior written permission. ++ * ++ * ALTERNATIVELY, this software may be distributed under the terms of the ++ * GNU General Public License ("GPL") version 2, as published by the Free ++ * Software Foundation. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER OR ++ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ++ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, ++ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR ++ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF ++ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING ++ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ */ ++#include <linux/module.h> ++#include <linux/types.h> ++ ++#include "interface/vchi/vchi.h" ++#include "vchiq.h" ++#include "vchiq_core.h" ++ ++#include "vchiq_util.h" ++ ++#include <stddef.h> ++ ++#define vchiq_status_to_vchi(status) ((int32_t)status) ++ ++typedef struct { ++ VCHIQ_SERVICE_HANDLE_T handle; ++ ++ VCHIU_QUEUE_T queue; ++ ++ VCHI_CALLBACK_T callback; ++ void *callback_param; ++} SHIM_SERVICE_T; ++ ++/* ---------------------------------------------------------------------- ++ * return pointer to the mphi message driver function table ++ * -------------------------------------------------------------------- */ ++const VCHI_MESSAGE_DRIVER_T * ++vchi_mphi_message_driver_func_table(void) ++{ ++ return NULL; ++} ++ ++/* ---------------------------------------------------------------------- ++ * return a pointer to the 'single' connection driver fops ++ * -------------------------------------------------------------------- */ ++const VCHI_CONNECTION_API_T * ++single_get_func_table(void) ++{ ++ return NULL; ++} ++ ++VCHI_CONNECTION_T *vchi_create_connection( ++ const VCHI_CONNECTION_API_T *function_table, ++ const VCHI_MESSAGE_DRIVER_T *low_level) ++{ ++ (void)function_table; ++ (void)low_level; ++ return NULL; ++} ++ ++/*********************************************************** ++ * Name: vchi_msg_peek ++ * ++ * Arguments: const VCHI_SERVICE_HANDLE_T handle, ++ * void **data, ++ * uint32_t *msg_size, ++ ++ ++ * VCHI_FLAGS_T flags ++ * ++ * Description: Routine to return a pointer to the current message (to allow in ++ * place processing). The message can be removed using ++ * vchi_msg_remove when you're finished ++ * ++ * Returns: int32_t - success == 0 ++ * ++ ***********************************************************/ ++int32_t vchi_msg_peek(VCHI_SERVICE_HANDLE_T handle, ++ void **data, ++ uint32_t *msg_size, ++ VCHI_FLAGS_T flags) ++{ ++ SHIM_SERVICE_T *service = (SHIM_SERVICE_T *)handle; ++ VCHIQ_HEADER_T *header; ++ ++ WARN_ON((flags != VCHI_FLAGS_NONE) && ++ (flags != VCHI_FLAGS_BLOCK_UNTIL_OP_COMPLETE)); ++ ++ if (flags == VCHI_FLAGS_NONE) ++ if (vchiu_queue_is_empty(&service->queue)) ++ return -1; ++ ++ header = vchiu_queue_peek(&service->queue); ++ ++ *data = header->data; ++ *msg_size = header->size; ++ ++ return 0; ++} ++EXPORT_SYMBOL(vchi_msg_peek); ++ ++/*********************************************************** ++ * Name: vchi_msg_remove ++ * ++ * Arguments: const VCHI_SERVICE_HANDLE_T handle, ++ * ++ * Description: Routine to remove a message (after it has been read with ++ * vchi_msg_peek) ++ * ++ * Returns: int32_t - success == 0 ++ * ++ ***********************************************************/ ++int32_t vchi_msg_remove(VCHI_SERVICE_HANDLE_T handle) ++{ ++ SHIM_SERVICE_T *service = (SHIM_SERVICE_T *)handle; ++ VCHIQ_HEADER_T *header; ++ ++ header = vchiu_queue_pop(&service->queue); ++ ++ vchiq_release_message(service->handle, header); ++ ++ return 0; ++} ++EXPORT_SYMBOL(vchi_msg_remove); ++ ++/*********************************************************** ++ * Name: vchi_msg_queue ++ * ++ * Arguments: VCHI_SERVICE_HANDLE_T handle, ++ * const void *data, ++ * uint32_t data_size, ++ * VCHI_FLAGS_T flags, ++ * void *msg_handle, ++ * ++ * Description: Thin wrapper to queue a message onto a connection ++ * ++ * Returns: int32_t - success == 0 ++ * ++ ***********************************************************/ ++int32_t vchi_msg_queue(VCHI_SERVICE_HANDLE_T handle, ++ const void *data, ++ uint32_t data_size, ++ VCHI_FLAGS_T flags, ++ void *msg_handle) ++{ ++ SHIM_SERVICE_T *service = (SHIM_SERVICE_T *)handle; ++ VCHIQ_ELEMENT_T element = {data, data_size}; ++ VCHIQ_STATUS_T status; ++ ++ (void)msg_handle; ++ ++ WARN_ON(flags != VCHI_FLAGS_BLOCK_UNTIL_QUEUED); ++ ++ status = vchiq_queue_message(service->handle, &element, 1); ++ ++ /* vchiq_queue_message() may return VCHIQ_RETRY, so we need to ++ ** implement a retry mechanism since this function is supposed ++ ** to block until queued ++ */ ++ while (status == VCHIQ_RETRY) { ++ msleep(1); ++ status = vchiq_queue_message(service->handle, &element, 1); ++ } ++ ++ return vchiq_status_to_vchi(status); ++} ++EXPORT_SYMBOL(vchi_msg_queue); ++ ++/*********************************************************** ++ * Name: vchi_bulk_queue_receive ++ * ++ * Arguments: VCHI_BULK_HANDLE_T handle, ++ * void *data_dst, ++ * const uint32_t data_size, ++ * VCHI_FLAGS_T flags ++ * void *bulk_handle ++ * ++ * Description: Routine to setup a rcv buffer ++ * ++ * Returns: int32_t - success == 0 ++ * ++ ***********************************************************/ ++int32_t vchi_bulk_queue_receive(VCHI_SERVICE_HANDLE_T handle, ++ void *data_dst, ++ uint32_t data_size, ++ VCHI_FLAGS_T flags, ++ void *bulk_handle) ++{ ++ SHIM_SERVICE_T *service = (SHIM_SERVICE_T *)handle; ++ VCHIQ_BULK_MODE_T mode; ++ VCHIQ_STATUS_T status; ++ ++ switch ((int)flags) { ++ case VCHI_FLAGS_CALLBACK_WHEN_OP_COMPLETE ++ | VCHI_FLAGS_BLOCK_UNTIL_QUEUED: ++ WARN_ON(!service->callback); ++ mode = VCHIQ_BULK_MODE_CALLBACK; ++ break; ++ case VCHI_FLAGS_BLOCK_UNTIL_OP_COMPLETE: ++ mode = VCHIQ_BULK_MODE_BLOCKING; ++ break; ++ case VCHI_FLAGS_BLOCK_UNTIL_QUEUED: ++ case VCHI_FLAGS_NONE: ++ mode = VCHIQ_BULK_MODE_NOCALLBACK; ++ break; ++ default: ++ WARN(1, "unsupported message\n"); ++ return vchiq_status_to_vchi(VCHIQ_ERROR); ++ } ++ ++ status = vchiq_bulk_receive(service->handle, data_dst, data_size, ++ bulk_handle, mode); ++ ++ /* vchiq_bulk_receive() may return VCHIQ_RETRY, so we need to ++ ** implement a retry mechanism since this function is supposed ++ ** to block until queued ++ */ ++ while (status == VCHIQ_RETRY) { ++ msleep(1); ++ status = vchiq_bulk_receive(service->handle, data_dst, ++ data_size, bulk_handle, mode); ++ } ++ ++ return vchiq_status_to_vchi(status); ++} ++EXPORT_SYMBOL(vchi_bulk_queue_receive); ++ ++/*********************************************************** ++ * Name: vchi_bulk_queue_transmit ++ * ++ * Arguments: VCHI_BULK_HANDLE_T handle, ++ * const void *data_src, ++ * uint32_t data_size, ++ * VCHI_FLAGS_T flags, ++ * void *bulk_handle ++ * ++ * Description: Routine to transmit some data ++ * ++ * Returns: int32_t - success == 0 ++ * ++ ***********************************************************/ ++int32_t vchi_bulk_queue_transmit(VCHI_SERVICE_HANDLE_T handle, ++ const void *data_src, ++ uint32_t data_size, ++ VCHI_FLAGS_T flags, ++ void *bulk_handle) ++{ ++ SHIM_SERVICE_T *service = (SHIM_SERVICE_T *)handle; ++ VCHIQ_BULK_MODE_T mode; ++ VCHIQ_STATUS_T status; ++ ++ switch ((int)flags) { ++ case VCHI_FLAGS_CALLBACK_WHEN_OP_COMPLETE ++ | VCHI_FLAGS_BLOCK_UNTIL_QUEUED: ++ WARN_ON(!service->callback); ++ mode = VCHIQ_BULK_MODE_CALLBACK; ++ break; ++ case VCHI_FLAGS_BLOCK_UNTIL_DATA_READ: ++ case VCHI_FLAGS_BLOCK_UNTIL_OP_COMPLETE: ++ mode = VCHIQ_BULK_MODE_BLOCKING; ++ break; ++ case VCHI_FLAGS_BLOCK_UNTIL_QUEUED: ++ case VCHI_FLAGS_NONE: ++ mode = VCHIQ_BULK_MODE_NOCALLBACK; ++ break; ++ default: ++ WARN(1, "unsupported message\n"); ++ return vchiq_status_to_vchi(VCHIQ_ERROR); ++ } ++ ++ status = vchiq_bulk_transmit(service->handle, data_src, data_size, ++ bulk_handle, mode); ++ ++ /* vchiq_bulk_transmit() may return VCHIQ_RETRY, so we need to ++ ** implement a retry mechanism since this function is supposed ++ ** to block until queued ++ */ ++ while (status == VCHIQ_RETRY) { ++ msleep(1); ++ status = vchiq_bulk_transmit(service->handle, data_src, ++ data_size, bulk_handle, mode); ++ } ++ ++ return vchiq_status_to_vchi(status); ++} ++EXPORT_SYMBOL(vchi_bulk_queue_transmit); ++ ++/*********************************************************** ++ * Name: vchi_msg_dequeue ++ * ++ * Arguments: VCHI_SERVICE_HANDLE_T handle, ++ * void *data, ++ * uint32_t max_data_size_to_read, ++ * uint32_t *actual_msg_size ++ * VCHI_FLAGS_T flags ++ * ++ * Description: Routine to dequeue a message into the supplied buffer ++ * ++ * Returns: int32_t - success == 0 ++ * ++ ***********************************************************/ ++int32_t vchi_msg_dequeue(VCHI_SERVICE_HANDLE_T handle, ++ void *data, ++ uint32_t max_data_size_to_read, ++ uint32_t *actual_msg_size, ++ VCHI_FLAGS_T flags) ++{ ++ SHIM_SERVICE_T *service = (SHIM_SERVICE_T *)handle; ++ VCHIQ_HEADER_T *header; ++ ++ WARN_ON((flags != VCHI_FLAGS_NONE) && ++ (flags != VCHI_FLAGS_BLOCK_UNTIL_OP_COMPLETE)); ++ ++ if (flags == VCHI_FLAGS_NONE) ++ if (vchiu_queue_is_empty(&service->queue)) ++ return -1; ++ ++ header = vchiu_queue_pop(&service->queue); ++ ++ memcpy(data, header->data, header->size < max_data_size_to_read ? ++ header->size : max_data_size_to_read); ++ ++ *actual_msg_size = header->size; ++ ++ vchiq_release_message(service->handle, header); ++ ++ return 0; ++} ++EXPORT_SYMBOL(vchi_msg_dequeue); ++ ++/*********************************************************** ++ * Name: vchi_msg_queuev ++ * ++ * Arguments: VCHI_SERVICE_HANDLE_T handle, ++ * VCHI_MSG_VECTOR_T *vector, ++ * uint32_t count, ++ * VCHI_FLAGS_T flags, ++ * void *msg_handle ++ * ++ * Description: Thin wrapper to queue a message onto a connection ++ * ++ * Returns: int32_t - success == 0 ++ * ++ ***********************************************************/ ++ ++vchiq_static_assert(sizeof(VCHI_MSG_VECTOR_T) == sizeof(VCHIQ_ELEMENT_T)); ++vchiq_static_assert(offsetof(VCHI_MSG_VECTOR_T, vec_base) == ++ offsetof(VCHIQ_ELEMENT_T, data)); ++vchiq_static_assert(offsetof(VCHI_MSG_VECTOR_T, vec_len) == ++ offsetof(VCHIQ_ELEMENT_T, size)); ++ ++int32_t vchi_msg_queuev(VCHI_SERVICE_HANDLE_T handle, ++ VCHI_MSG_VECTOR_T *vector, ++ uint32_t count, ++ VCHI_FLAGS_T flags, ++ void *msg_handle) ++{ ++ SHIM_SERVICE_T *service = (SHIM_SERVICE_T *)handle; ++ ++ (void)msg_handle; ++ ++ WARN_ON(flags != VCHI_FLAGS_BLOCK_UNTIL_QUEUED); ++ ++ return vchiq_status_to_vchi(vchiq_queue_message(service->handle, ++ (const VCHIQ_ELEMENT_T *)vector, count)); ++} ++EXPORT_SYMBOL(vchi_msg_queuev); ++ ++/*********************************************************** ++ * Name: vchi_held_msg_release ++ * ++ * Arguments: VCHI_HELD_MSG_T *message ++ * ++ * Description: Routine to release a held message (after it has been read with ++ * vchi_msg_hold) ++ * ++ * Returns: int32_t - success == 0 ++ * ++ ***********************************************************/ ++int32_t vchi_held_msg_release(VCHI_HELD_MSG_T *message) ++{ ++ vchiq_release_message((VCHIQ_SERVICE_HANDLE_T)message->service, ++ (VCHIQ_HEADER_T *)message->message); ++ ++ return 0; ++} ++EXPORT_SYMBOL(vchi_held_msg_release); ++ ++/*********************************************************** ++ * Name: vchi_msg_hold ++ * ++ * Arguments: VCHI_SERVICE_HANDLE_T handle, ++ * void **data, ++ * uint32_t *msg_size, ++ * VCHI_FLAGS_T flags, ++ * VCHI_HELD_MSG_T *message_handle ++ * ++ * Description: Routine to return a pointer to the current message (to allow ++ * in place processing). The message is dequeued - don't forget ++ * to release the message using vchi_held_msg_release when you're ++ * finished. ++ * ++ * Returns: int32_t - success == 0 ++ * ++ ***********************************************************/ ++int32_t vchi_msg_hold(VCHI_SERVICE_HANDLE_T handle, ++ void **data, ++ uint32_t *msg_size, ++ VCHI_FLAGS_T flags, ++ VCHI_HELD_MSG_T *message_handle) ++{ ++ SHIM_SERVICE_T *service = (SHIM_SERVICE_T *)handle; ++ VCHIQ_HEADER_T *header; ++ ++ WARN_ON((flags != VCHI_FLAGS_NONE) && ++ (flags != VCHI_FLAGS_BLOCK_UNTIL_OP_COMPLETE)); ++ ++ if (flags == VCHI_FLAGS_NONE) ++ if (vchiu_queue_is_empty(&service->queue)) ++ return -1; ++ ++ header = vchiu_queue_pop(&service->queue); ++ ++ *data = header->data; ++ *msg_size = header->size; ++ ++ message_handle->service = ++ (struct opaque_vchi_service_t *)service->handle; ++ message_handle->message = header; ++ ++ return 0; ++} ++EXPORT_SYMBOL(vchi_msg_hold); ++ ++/*********************************************************** ++ * Name: vchi_initialise ++ * ++ * Arguments: VCHI_INSTANCE_T *instance_handle ++ * ++ * Description: Initialises the hardware but does not transmit anything ++ * When run as a Host App this will be called twice hence the need ++ * to malloc the state information ++ * ++ * Returns: 0 if successful, failure otherwise ++ * ++ ***********************************************************/ ++ ++int32_t vchi_initialise(VCHI_INSTANCE_T *instance_handle) ++{ ++ VCHIQ_INSTANCE_T instance; ++ VCHIQ_STATUS_T status; ++ ++ status = vchiq_initialise(&instance); ++ ++ *instance_handle = (VCHI_INSTANCE_T)instance; ++ ++ return vchiq_status_to_vchi(status); ++} ++EXPORT_SYMBOL(vchi_initialise); ++ ++/*********************************************************** ++ * Name: vchi_connect ++ * ++ * Arguments: VCHI_CONNECTION_T **connections ++ * const uint32_t num_connections ++ * VCHI_INSTANCE_T instance_handle) ++ * ++ * Description: Starts the command service on each connection, ++ * causing INIT messages to be pinged back and forth ++ * ++ * Returns: 0 if successful, failure otherwise ++ * ++ ***********************************************************/ ++int32_t vchi_connect(VCHI_CONNECTION_T **connections, ++ const uint32_t num_connections, ++ VCHI_INSTANCE_T instance_handle) ++{ ++ VCHIQ_INSTANCE_T instance = (VCHIQ_INSTANCE_T)instance_handle; ++ ++ (void)connections; ++ (void)num_connections; ++ ++ return vchiq_connect(instance); ++} ++EXPORT_SYMBOL(vchi_connect); ++ ++ ++/*********************************************************** ++ * Name: vchi_disconnect ++ * ++ * Arguments: VCHI_INSTANCE_T instance_handle ++ * ++ * Description: Stops the command service on each connection, ++ * causing DE-INIT messages to be pinged back and forth ++ * ++ * Returns: 0 if successful, failure otherwise ++ * ++ ***********************************************************/ ++int32_t vchi_disconnect(VCHI_INSTANCE_T instance_handle) ++{ ++ VCHIQ_INSTANCE_T instance = (VCHIQ_INSTANCE_T)instance_handle; ++ return vchiq_status_to_vchi(vchiq_shutdown(instance)); ++} ++EXPORT_SYMBOL(vchi_disconnect); ++ ++ ++/*********************************************************** ++ * Name: vchi_service_open ++ * Name: vchi_service_create ++ * ++ * Arguments: VCHI_INSTANCE_T *instance_handle ++ * SERVICE_CREATION_T *setup, ++ * VCHI_SERVICE_HANDLE_T *handle ++ * ++ * Description: Routine to open a service ++ * ++ * Returns: int32_t - success == 0 ++ * ++ ***********************************************************/ ++ ++static VCHIQ_STATUS_T shim_callback(VCHIQ_REASON_T reason, ++ VCHIQ_HEADER_T *header, VCHIQ_SERVICE_HANDLE_T handle, void *bulk_user) ++{ ++ SHIM_SERVICE_T *service = ++ (SHIM_SERVICE_T *)VCHIQ_GET_SERVICE_USERDATA(handle); ++ ++ if (!service->callback) ++ goto release; ++ ++ switch (reason) { ++ case VCHIQ_MESSAGE_AVAILABLE: ++ vchiu_queue_push(&service->queue, header); ++ ++ service->callback(service->callback_param, ++ VCHI_CALLBACK_MSG_AVAILABLE, NULL); ++ ++ goto done; ++ break; ++ ++ case VCHIQ_BULK_TRANSMIT_DONE: ++ service->callback(service->callback_param, ++ VCHI_CALLBACK_BULK_SENT, bulk_user); ++ break; ++ ++ case VCHIQ_BULK_RECEIVE_DONE: ++ service->callback(service->callback_param, ++ VCHI_CALLBACK_BULK_RECEIVED, bulk_user); ++ break; ++ ++ case VCHIQ_SERVICE_CLOSED: ++ service->callback(service->callback_param, ++ VCHI_CALLBACK_SERVICE_CLOSED, NULL); ++ break; ++ ++ case VCHIQ_SERVICE_OPENED: ++ /* No equivalent VCHI reason */ ++ break; ++ ++ case VCHIQ_BULK_TRANSMIT_ABORTED: ++ service->callback(service->callback_param, ++ VCHI_CALLBACK_BULK_TRANSMIT_ABORTED, ++ bulk_user); ++ break; ++ ++ case VCHIQ_BULK_RECEIVE_ABORTED: ++ service->callback(service->callback_param, ++ VCHI_CALLBACK_BULK_RECEIVE_ABORTED, ++ bulk_user); ++ break; ++ ++ default: ++ WARN(1, "not supported\n"); ++ break; ++ } ++ ++release: ++ vchiq_release_message(service->handle, header); ++done: ++ return VCHIQ_SUCCESS; ++} ++ ++static SHIM_SERVICE_T *service_alloc(VCHIQ_INSTANCE_T instance, ++ SERVICE_CREATION_T *setup) ++{ ++ SHIM_SERVICE_T *service = kzalloc(sizeof(SHIM_SERVICE_T), GFP_KERNEL); ++ ++ (void)instance; ++ ++ if (service) { ++ if (vchiu_queue_init(&service->queue, 64)) { ++ service->callback = setup->callback; ++ service->callback_param = setup->callback_param; ++ } else { ++ kfree(service); ++ service = NULL; ++ } ++ } ++ ++ return service; ++} ++ ++static void service_free(SHIM_SERVICE_T *service) ++{ ++ if (service) { ++ vchiu_queue_delete(&service->queue); ++ kfree(service); ++ } ++} ++ ++int32_t vchi_service_open(VCHI_INSTANCE_T instance_handle, ++ SERVICE_CREATION_T *setup, ++ VCHI_SERVICE_HANDLE_T *handle) ++{ ++ VCHIQ_INSTANCE_T instance = (VCHIQ_INSTANCE_T)instance_handle; ++ SHIM_SERVICE_T *service = service_alloc(instance, setup); ++ ++ *handle = (VCHI_SERVICE_HANDLE_T)service; ++ ++ if (service) { ++ VCHIQ_SERVICE_PARAMS_T params; ++ VCHIQ_STATUS_T status; ++ ++ memset(&params, 0, sizeof(params)); ++ params.fourcc = setup->service_id; ++ params.callback = shim_callback; ++ params.userdata = service; ++ params.version = setup->version.version; ++ params.version_min = setup->version.version_min; ++ ++ status = vchiq_open_service(instance, &params, ++ &service->handle); ++ if (status != VCHIQ_SUCCESS) { ++ service_free(service); ++ service = NULL; ++ *handle = NULL; ++ } ++ } ++ ++ return (service != NULL) ? 0 : -1; ++} ++EXPORT_SYMBOL(vchi_service_open); ++ ++int32_t vchi_service_create(VCHI_INSTANCE_T instance_handle, ++ SERVICE_CREATION_T *setup, ++ VCHI_SERVICE_HANDLE_T *handle) ++{ ++ VCHIQ_INSTANCE_T instance = (VCHIQ_INSTANCE_T)instance_handle; ++ SHIM_SERVICE_T *service = service_alloc(instance, setup); ++ ++ *handle = (VCHI_SERVICE_HANDLE_T)service; ++ ++ if (service) { ++ VCHIQ_SERVICE_PARAMS_T params; ++ VCHIQ_STATUS_T status; ++ ++ memset(&params, 0, sizeof(params)); ++ params.fourcc = setup->service_id; ++ params.callback = shim_callback; ++ params.userdata = service; ++ params.version = setup->version.version; ++ params.version_min = setup->version.version_min; ++ status = vchiq_add_service(instance, &params, &service->handle); ++ ++ if (status != VCHIQ_SUCCESS) { ++ service_free(service); ++ service = NULL; ++ *handle = NULL; ++ } ++ } ++ ++ return (service != NULL) ? 0 : -1; ++} ++EXPORT_SYMBOL(vchi_service_create); ++ ++int32_t vchi_service_close(const VCHI_SERVICE_HANDLE_T handle) ++{ ++ int32_t ret = -1; ++ SHIM_SERVICE_T *service = (SHIM_SERVICE_T *)handle; ++ if (service) { ++ VCHIQ_STATUS_T status = vchiq_close_service(service->handle); ++ if (status == VCHIQ_SUCCESS) { ++ service_free(service); ++ service = NULL; ++ } ++ ++ ret = vchiq_status_to_vchi(status); ++ } ++ return ret; ++} ++EXPORT_SYMBOL(vchi_service_close); ++ ++int32_t vchi_service_destroy(const VCHI_SERVICE_HANDLE_T handle) ++{ ++ int32_t ret = -1; ++ SHIM_SERVICE_T *service = (SHIM_SERVICE_T *)handle; ++ if (service) { ++ VCHIQ_STATUS_T status = vchiq_remove_service(service->handle); ++ if (status == VCHIQ_SUCCESS) { ++ service_free(service); ++ service = NULL; ++ } ++ ++ ret = vchiq_status_to_vchi(status); ++ } ++ return ret; ++} ++EXPORT_SYMBOL(vchi_service_destroy); ++ ++int32_t vchi_service_set_option(const VCHI_SERVICE_HANDLE_T handle, ++ VCHI_SERVICE_OPTION_T option, ++ int value) ++{ ++ int32_t ret = -1; ++ SHIM_SERVICE_T *service = (SHIM_SERVICE_T *)handle; ++ VCHIQ_SERVICE_OPTION_T vchiq_option; ++ switch (option) { ++ case VCHI_SERVICE_OPTION_TRACE: ++ vchiq_option = VCHIQ_SERVICE_OPTION_TRACE; ++ break; ++ case VCHI_SERVICE_OPTION_SYNCHRONOUS: ++ vchiq_option = VCHIQ_SERVICE_OPTION_SYNCHRONOUS; ++ break; ++ default: ++ service = NULL; ++ break; ++ } ++ if (service) { ++ VCHIQ_STATUS_T status = ++ vchiq_set_service_option(service->handle, ++ vchiq_option, ++ value); ++ ++ ret = vchiq_status_to_vchi(status); ++ } ++ return ret; ++} ++EXPORT_SYMBOL(vchi_service_set_option); ++ ++int32_t vchi_get_peer_version( const VCHI_SERVICE_HANDLE_T handle, short *peer_version ) ++{ ++ int32_t ret = -1; ++ SHIM_SERVICE_T *service = (SHIM_SERVICE_T *)handle; ++ if(service) ++ { ++ VCHIQ_STATUS_T status = vchiq_get_peer_version(service->handle, peer_version); ++ ret = vchiq_status_to_vchi( status ); ++ } ++ return ret; ++} ++EXPORT_SYMBOL(vchi_get_peer_version); ++ ++/* ---------------------------------------------------------------------- ++ * read a uint32_t from buffer. ++ * network format is defined to be little endian ++ * -------------------------------------------------------------------- */ ++uint32_t ++vchi_readbuf_uint32(const void *_ptr) ++{ ++ const unsigned char *ptr = _ptr; ++ return ptr[0] | (ptr[1] << 8) | (ptr[2] << 16) | (ptr[3] << 24); ++} ++ ++/* ---------------------------------------------------------------------- ++ * write a uint32_t to buffer. ++ * network format is defined to be little endian ++ * -------------------------------------------------------------------- */ ++void ++vchi_writebuf_uint32(void *_ptr, uint32_t value) ++{ ++ unsigned char *ptr = _ptr; ++ ptr[0] = (unsigned char)((value >> 0) & 0xFF); ++ ptr[1] = (unsigned char)((value >> 8) & 0xFF); ++ ptr[2] = (unsigned char)((value >> 16) & 0xFF); ++ ptr[3] = (unsigned char)((value >> 24) & 0xFF); ++} ++ ++/* ---------------------------------------------------------------------- ++ * read a uint16_t from buffer. ++ * network format is defined to be little endian ++ * -------------------------------------------------------------------- */ ++uint16_t ++vchi_readbuf_uint16(const void *_ptr) ++{ ++ const unsigned char *ptr = _ptr; ++ return ptr[0] | (ptr[1] << 8); ++} ++ ++/* ---------------------------------------------------------------------- ++ * write a uint16_t into the buffer. ++ * network format is defined to be little endian ++ * -------------------------------------------------------------------- */ ++void ++vchi_writebuf_uint16(void *_ptr, uint16_t value) ++{ ++ unsigned char *ptr = _ptr; ++ ptr[0] = (value >> 0) & 0xFF; ++ ptr[1] = (value >> 8) & 0xFF; ++} ++ ++/*********************************************************** ++ * Name: vchi_service_use ++ * ++ * Arguments: const VCHI_SERVICE_HANDLE_T handle ++ * ++ * Description: Routine to increment refcount on a service ++ * ++ * Returns: void ++ * ++ ***********************************************************/ ++int32_t vchi_service_use(const VCHI_SERVICE_HANDLE_T handle) ++{ ++ int32_t ret = -1; ++ SHIM_SERVICE_T *service = (SHIM_SERVICE_T *)handle; ++ if (service) ++ ret = vchiq_status_to_vchi(vchiq_use_service(service->handle)); ++ return ret; ++} ++EXPORT_SYMBOL(vchi_service_use); ++ ++/*********************************************************** ++ * Name: vchi_service_release ++ * ++ * Arguments: const VCHI_SERVICE_HANDLE_T handle ++ * ++ * Description: Routine to decrement refcount on a service ++ * ++ * Returns: void ++ * ++ ***********************************************************/ ++int32_t vchi_service_release(const VCHI_SERVICE_HANDLE_T handle) ++{ ++ int32_t ret = -1; ++ SHIM_SERVICE_T *service = (SHIM_SERVICE_T *)handle; ++ if (service) ++ ret = vchiq_status_to_vchi( ++ vchiq_release_service(service->handle)); ++ return ret; ++} ++EXPORT_SYMBOL(vchi_service_release); +diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_util.c b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_util.c +new file mode 100644 +index 0000000..384acb8 +--- /dev/null ++++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_util.c +@@ -0,0 +1,156 @@ ++/** ++ * Copyright (c) 2010-2012 Broadcom. 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, ++ * without modification. ++ * 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. ++ * 3. The names of the above-listed copyright holders may not be used ++ * to endorse or promote products derived from this software without ++ * specific prior written permission. ++ * ++ * ALTERNATIVELY, this software may be distributed under the terms of the ++ * GNU General Public License ("GPL") version 2, as published by the Free ++ * Software Foundation. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER OR ++ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ++ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, ++ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR ++ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF ++ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING ++ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ */ ++ ++#include "vchiq_util.h" ++#include "vchiq_killable.h" ++ ++static inline int is_pow2(int i) ++{ ++ return i && !(i & (i - 1)); ++} ++ ++int vchiu_queue_init(VCHIU_QUEUE_T *queue, int size) ++{ ++ WARN_ON(!is_pow2(size)); ++ ++ queue->size = size; ++ queue->read = 0; ++ queue->write = 0; ++ queue->initialized = 1; ++ ++ sema_init(&queue->pop, 0); ++ sema_init(&queue->push, 0); ++ ++ queue->storage = kzalloc(size * sizeof(VCHIQ_HEADER_T *), GFP_KERNEL); ++ if (queue->storage == NULL) { ++ vchiu_queue_delete(queue); ++ return 0; ++ } ++ return 1; ++} ++ ++void vchiu_queue_delete(VCHIU_QUEUE_T *queue) ++{ ++ if (queue->storage != NULL) ++ kfree(queue->storage); ++} ++ ++int vchiu_queue_is_empty(VCHIU_QUEUE_T *queue) ++{ ++ return queue->read == queue->write; ++} ++ ++int vchiu_queue_is_full(VCHIU_QUEUE_T *queue) ++{ ++ return queue->write == queue->read + queue->size; ++} ++ ++void vchiu_queue_push(VCHIU_QUEUE_T *queue, VCHIQ_HEADER_T *header) ++{ ++ if (!queue->initialized) ++ return; ++ ++ while (queue->write == queue->read + queue->size) { ++ if (down_interruptible(&queue->pop) != 0) { ++ flush_signals(current); ++ } ++ } ++ ++ /* ++ * Write to queue->storage must be visible after read from ++ * queue->read ++ */ ++ smp_mb(); ++ ++ queue->storage[queue->write & (queue->size - 1)] = header; ++ ++ /* ++ * Write to queue->storage must be visible before write to ++ * queue->write ++ */ ++ smp_wmb(); ++ ++ queue->write++; ++ ++ up(&queue->push); ++} ++ ++VCHIQ_HEADER_T *vchiu_queue_peek(VCHIU_QUEUE_T *queue) ++{ ++ while (queue->write == queue->read) { ++ if (down_interruptible(&queue->push) != 0) { ++ flush_signals(current); ++ } ++ } ++ ++ up(&queue->push); // We haven't removed anything from the queue. ++ ++ /* ++ * Read from queue->storage must be visible after read from ++ * queue->write ++ */ ++ smp_rmb(); ++ ++ return queue->storage[queue->read & (queue->size - 1)]; ++} ++ ++VCHIQ_HEADER_T *vchiu_queue_pop(VCHIU_QUEUE_T *queue) ++{ ++ VCHIQ_HEADER_T *header; ++ ++ while (queue->write == queue->read) { ++ if (down_interruptible(&queue->push) != 0) { ++ flush_signals(current); ++ } ++ } ++ ++ /* ++ * Read from queue->storage must be visible after read from ++ * queue->write ++ */ ++ smp_rmb(); ++ ++ header = queue->storage[queue->read & (queue->size - 1)]; ++ ++ /* ++ * Read from queue->storage must be visible before write to ++ * queue->read ++ */ ++ smp_mb(); ++ ++ queue->read++; ++ ++ up(&queue->pop); ++ ++ return header; ++} +diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_util.h b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_util.h +new file mode 100644 +index 0000000..4055d4b +--- /dev/null ++++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_util.h +@@ -0,0 +1,82 @@ ++/** ++ * Copyright (c) 2010-2012 Broadcom. 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, ++ * without modification. ++ * 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. ++ * 3. The names of the above-listed copyright holders may not be used ++ * to endorse or promote products derived from this software without ++ * specific prior written permission. ++ * ++ * ALTERNATIVELY, this software may be distributed under the terms of the ++ * GNU General Public License ("GPL") version 2, as published by the Free ++ * Software Foundation. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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. ++ */ ++ ++#ifndef VCHIQ_UTIL_H ++#define VCHIQ_UTIL_H ++ ++#include <linux/types.h> ++#include <linux/semaphore.h> ++#include <linux/mutex.h> ++#include <linux/bitops.h> ++#include <linux/kthread.h> ++#include <linux/wait.h> ++#include <linux/vmalloc.h> ++#include <linux/jiffies.h> ++#include <linux/delay.h> ++#include <linux/string.h> ++#include <linux/types.h> ++#include <linux/interrupt.h> ++#include <linux/random.h> ++#include <linux/sched.h> ++#include <linux/ctype.h> ++#include <linux/uaccess.h> ++#include <linux/time.h> /* for time_t */ ++#include <linux/slab.h> ++#include <linux/vmalloc.h> ++ ++#include "vchiq_if.h" ++ ++typedef struct { ++ int size; ++ int read; ++ int write; ++ int initialized; ++ ++ struct semaphore pop; ++ struct semaphore push; ++ ++ VCHIQ_HEADER_T **storage; ++} VCHIU_QUEUE_T; ++ ++extern int vchiu_queue_init(VCHIU_QUEUE_T *queue, int size); ++extern void vchiu_queue_delete(VCHIU_QUEUE_T *queue); ++ ++extern int vchiu_queue_is_empty(VCHIU_QUEUE_T *queue); ++extern int vchiu_queue_is_full(VCHIU_QUEUE_T *queue); ++ ++extern void vchiu_queue_push(VCHIU_QUEUE_T *queue, VCHIQ_HEADER_T *header); ++ ++extern VCHIQ_HEADER_T *vchiu_queue_peek(VCHIU_QUEUE_T *queue); ++extern VCHIQ_HEADER_T *vchiu_queue_pop(VCHIU_QUEUE_T *queue); ++ ++#endif +diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_version.c b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_version.c +new file mode 100644 +index 0000000..b6bfa21 +--- /dev/null ++++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_version.c +@@ -0,0 +1,59 @@ ++/** ++ * Copyright (c) 2010-2012 Broadcom. 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, ++ * without modification. ++ * 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. ++ * 3. The names of the above-listed copyright holders may not be used ++ * to endorse or promote products derived from this software without ++ * specific prior written permission. ++ * ++ * ALTERNATIVELY, this software may be distributed under the terms of the ++ * GNU General Public License ("GPL") version 2, as published by the Free ++ * Software Foundation. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER OR ++ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ++ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, ++ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR ++ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF ++ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING ++ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ */ ++#include "vchiq_build_info.h" ++#include <linux/broadcom/vc_debug_sym.h> ++ ++VC_DEBUG_DECLARE_STRING_VAR( vchiq_build_hostname, "dc4-arm-01" ); ++VC_DEBUG_DECLARE_STRING_VAR( vchiq_build_version, "9245b4c35b99b3870e1f7dc598c5692b3c66a6f0 (tainted)" ); ++VC_DEBUG_DECLARE_STRING_VAR( vchiq_build_time, __TIME__ ); ++VC_DEBUG_DECLARE_STRING_VAR( vchiq_build_date, __DATE__ ); ++ ++const char *vchiq_get_build_hostname( void ) ++{ ++ return vchiq_build_hostname; ++} ++ ++const char *vchiq_get_build_version( void ) ++{ ++ return vchiq_build_version; ++} ++ ++const char *vchiq_get_build_date( void ) ++{ ++ return vchiq_build_date; ++} ++ ++const char *vchiq_get_build_time( void ) ++{ ++ return vchiq_build_time; ++} + +From 5e58581648c99f1696b84c9e4b8b89eb3c659407 Mon Sep 17 00:00:00 2001 +From: popcornmix <popcornmix@gmail.com> +Date: Wed, 17 Jun 2015 16:07:06 +0100 +Subject: [PATCH 042/112] vc_mem: Add vc_mem driver +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: popcornmix <popcornmix@gmail.com> + +BCM270x: Move vc_mem + +Make the vc_mem module available for ARCH_BCM2835 by moving it. + +Signed-off-by: Noralf Trønnes <noralf@tronnes.org> +--- + arch/arm/mach-bcm2709/include/mach/vc_mem.h | 35 --- + arch/arm/mach-bcm2709/vc_mem.c | 431 ---------------------------- + drivers/char/broadcom/Kconfig | 12 +- + drivers/char/broadcom/Makefile | 1 + + drivers/char/broadcom/vc_mem.c | 422 +++++++++++++++++++++++++++ + include/linux/broadcom/vc_mem.h | 35 +++ + 6 files changed, 469 insertions(+), 467 deletions(-) + delete mode 100644 arch/arm/mach-bcm2709/include/mach/vc_mem.h + delete mode 100644 arch/arm/mach-bcm2709/vc_mem.c + create mode 100644 drivers/char/broadcom/vc_mem.c + create mode 100644 include/linux/broadcom/vc_mem.h + +diff --git a/arch/arm/mach-bcm2709/include/mach/vc_mem.h b/arch/arm/mach-bcm2709/include/mach/vc_mem.h +deleted file mode 100644 +index 4a4a338..0000000 +--- a/arch/arm/mach-bcm2709/include/mach/vc_mem.h ++++ /dev/null +@@ -1,35 +0,0 @@ +-/***************************************************************************** +-* Copyright 2010 - 2011 Broadcom Corporation. All rights reserved. +-* +-* Unless you and Broadcom execute a separate written software license +-* agreement governing use of this software, this software is licensed to you +-* under the terms of the GNU General Public License version 2, available at +-* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). +-* +-* Notwithstanding the above, under no circumstances may you combine this +-* software in any way with any other Broadcom software provided under a +-* license other than the GPL, without Broadcom's express prior written +-* consent. +-*****************************************************************************/ +- +-#if !defined( VC_MEM_H ) +-#define VC_MEM_H +- +-#include <linux/ioctl.h> +- +-#define VC_MEM_IOC_MAGIC 'v' +- +-#define VC_MEM_IOC_MEM_PHYS_ADDR _IOR( VC_MEM_IOC_MAGIC, 0, unsigned long ) +-#define VC_MEM_IOC_MEM_SIZE _IOR( VC_MEM_IOC_MAGIC, 1, unsigned int ) +-#define VC_MEM_IOC_MEM_BASE _IOR( VC_MEM_IOC_MAGIC, 2, unsigned int ) +-#define VC_MEM_IOC_MEM_LOAD _IOR( VC_MEM_IOC_MAGIC, 3, unsigned int ) +- +-#if defined( __KERNEL__ ) +-#define VC_MEM_TO_ARM_ADDR_MASK 0x3FFFFFFF +- +-extern unsigned long mm_vc_mem_phys_addr; +-extern unsigned int mm_vc_mem_size; +-extern int vc_mem_get_current_size( void ); +-#endif +- +-#endif /* VC_MEM_H */ +diff --git a/arch/arm/mach-bcm2709/vc_mem.c b/arch/arm/mach-bcm2709/vc_mem.c +deleted file mode 100644 +index d2adfd1..0000000 +--- a/arch/arm/mach-bcm2709/vc_mem.c ++++ /dev/null +@@ -1,431 +0,0 @@ +-/***************************************************************************** +-* Copyright 2010 - 2011 Broadcom Corporation. All rights reserved. +-* +-* Unless you and Broadcom execute a separate written software license +-* agreement governing use of this software, this software is licensed to you +-* under the terms of the GNU General Public License version 2, available at +-* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). +-* +-* Notwithstanding the above, under no circumstances may you combine this +-* software in any way with any other Broadcom software provided under a +-* license other than the GPL, without Broadcom's express prior written +-* consent. +-*****************************************************************************/ +- +-#include <linux/kernel.h> +-#include <linux/module.h> +-#include <linux/fs.h> +-#include <linux/device.h> +-#include <linux/cdev.h> +-#include <linux/mm.h> +-#include <linux/slab.h> +-#include <linux/debugfs.h> +-#include <asm/uaccess.h> +-#include <linux/dma-mapping.h> +-#include <linux/platform_data/mailbox-bcm2708.h> +- +-#ifdef CONFIG_ARCH_KONA +-#include <chal/chal_ipc.h> +-#elif defined(CONFIG_ARCH_BCM2708) || defined(CONFIG_ARCH_BCM2709) +-#else +-#include <csp/chal_ipc.h> +-#endif +- +-#include "mach/vc_mem.h" +- +-#define DRIVER_NAME "vc-mem" +- +-// Device (/dev) related variables +-static dev_t vc_mem_devnum = 0; +-static struct class *vc_mem_class = NULL; +-static struct cdev vc_mem_cdev; +-static int vc_mem_inited = 0; +- +-#ifdef CONFIG_DEBUG_FS +-static struct dentry *vc_mem_debugfs_entry; +-#endif +- +-/* +- * Videocore memory addresses and size +- * +- * Drivers that wish to know the videocore memory addresses and sizes should +- * use these variables instead of the MM_IO_BASE and MM_ADDR_IO defines in +- * headers. This allows the other drivers to not be tied down to a a certain +- * address/size at compile time. +- * +- * In the future, the goal is to have the videocore memory virtual address and +- * size be calculated at boot time rather than at compile time. The decision of +- * where the videocore memory resides and its size would be in the hands of the +- * bootloader (and/or kernel). When that happens, the values of these variables +- * would be calculated and assigned in the init function. +- */ +-// in the 2835 VC in mapped above ARM, but ARM has full access to VC space +-unsigned long mm_vc_mem_phys_addr = 0x00000000; +-unsigned int mm_vc_mem_size = 0; +-unsigned int mm_vc_mem_base = 0; +- +-EXPORT_SYMBOL(mm_vc_mem_phys_addr); +-EXPORT_SYMBOL(mm_vc_mem_size); +-EXPORT_SYMBOL(mm_vc_mem_base); +- +-static uint phys_addr = 0; +-static uint mem_size = 0; +-static uint mem_base = 0; +- +- +-/**************************************************************************** +-* +-* vc_mem_open +-* +-***************************************************************************/ +- +-static int +-vc_mem_open(struct inode *inode, struct file *file) +-{ +- (void) inode; +- (void) file; +- +- pr_debug("%s: called file = 0x%p\n", __func__, file); +- +- return 0; +-} +- +-/**************************************************************************** +-* +-* vc_mem_release +-* +-***************************************************************************/ +- +-static int +-vc_mem_release(struct inode *inode, struct file *file) +-{ +- (void) inode; +- (void) file; +- +- pr_debug("%s: called file = 0x%p\n", __func__, file); +- +- return 0; +-} +- +-/**************************************************************************** +-* +-* vc_mem_get_size +-* +-***************************************************************************/ +- +-static void +-vc_mem_get_size(void) +-{ +-} +- +-/**************************************************************************** +-* +-* vc_mem_get_base +-* +-***************************************************************************/ +- +-static void +-vc_mem_get_base(void) +-{ +-} +- +-/**************************************************************************** +-* +-* vc_mem_get_current_size +-* +-***************************************************************************/ +- +-int +-vc_mem_get_current_size(void) +-{ +- return mm_vc_mem_size; +-} +- +-EXPORT_SYMBOL_GPL(vc_mem_get_current_size); +- +-/**************************************************************************** +-* +-* vc_mem_ioctl +-* +-***************************************************************************/ +- +-static long +-vc_mem_ioctl(struct file *file, unsigned int cmd, unsigned long arg) +-{ +- int rc = 0; +- +- (void) cmd; +- (void) arg; +- +- pr_debug("%s: called file = 0x%p\n", __func__, file); +- +- switch (cmd) { +- case VC_MEM_IOC_MEM_PHYS_ADDR: +- { +- pr_debug("%s: VC_MEM_IOC_MEM_PHYS_ADDR=0x%p\n", +- __func__, (void *) mm_vc_mem_phys_addr); +- +- if (copy_to_user((void *) arg, &mm_vc_mem_phys_addr, +- sizeof (mm_vc_mem_phys_addr)) != 0) { +- rc = -EFAULT; +- } +- break; +- } +- case VC_MEM_IOC_MEM_SIZE: +- { +- // Get the videocore memory size first +- vc_mem_get_size(); +- +- pr_debug("%s: VC_MEM_IOC_MEM_SIZE=%u\n", __func__, +- mm_vc_mem_size); +- +- if (copy_to_user((void *) arg, &mm_vc_mem_size, +- sizeof (mm_vc_mem_size)) != 0) { +- rc = -EFAULT; +- } +- break; +- } +- case VC_MEM_IOC_MEM_BASE: +- { +- // Get the videocore memory base +- vc_mem_get_base(); +- +- pr_debug("%s: VC_MEM_IOC_MEM_BASE=%u\n", __func__, +- mm_vc_mem_base); +- +- if (copy_to_user((void *) arg, &mm_vc_mem_base, +- sizeof (mm_vc_mem_base)) != 0) { +- rc = -EFAULT; +- } +- break; +- } +- case VC_MEM_IOC_MEM_LOAD: +- { +- // Get the videocore memory base +- vc_mem_get_base(); +- +- pr_debug("%s: VC_MEM_IOC_MEM_LOAD=%u\n", __func__, +- mm_vc_mem_base); +- +- if (copy_to_user((void *) arg, &mm_vc_mem_base, +- sizeof (mm_vc_mem_base)) != 0) { +- rc = -EFAULT; +- } +- break; +- } +- default: +- { +- return -ENOTTY; +- } +- } +- pr_debug("%s: file = 0x%p returning %d\n", __func__, file, rc); +- +- return rc; +-} +- +-/**************************************************************************** +-* +-* vc_mem_mmap +-* +-***************************************************************************/ +- +-static int +-vc_mem_mmap(struct file *filp, struct vm_area_struct *vma) +-{ +- int rc = 0; +- unsigned long length = vma->vm_end - vma->vm_start; +- unsigned long offset = vma->vm_pgoff << PAGE_SHIFT; +- +- pr_debug("%s: vm_start = 0x%08lx vm_end = 0x%08lx vm_pgoff = 0x%08lx\n", +- __func__, (long) vma->vm_start, (long) vma->vm_end, +- (long) vma->vm_pgoff); +- +- if (offset + length > mm_vc_mem_size) { +- pr_err("%s: length %ld is too big\n", __func__, length); +- return -EINVAL; +- } +- // Do not cache the memory map +- vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); +- +- rc = remap_pfn_range(vma, vma->vm_start, +- (mm_vc_mem_phys_addr >> PAGE_SHIFT) + +- vma->vm_pgoff, length, vma->vm_page_prot); +- if (rc != 0) { +- pr_err("%s: remap_pfn_range failed (rc=%d)\n", __func__, rc); +- } +- +- return rc; +-} +- +-/**************************************************************************** +-* +-* File Operations for the driver. +-* +-***************************************************************************/ +- +-static const struct file_operations vc_mem_fops = { +- .owner = THIS_MODULE, +- .open = vc_mem_open, +- .release = vc_mem_release, +- .unlocked_ioctl = vc_mem_ioctl, +- .mmap = vc_mem_mmap, +-}; +- +-#ifdef CONFIG_DEBUG_FS +-static void vc_mem_debugfs_deinit(void) +-{ +- debugfs_remove_recursive(vc_mem_debugfs_entry); +- vc_mem_debugfs_entry = NULL; +-} +- +- +-static int vc_mem_debugfs_init( +- struct device *dev) +-{ +- vc_mem_debugfs_entry = debugfs_create_dir(DRIVER_NAME, NULL); +- if (!vc_mem_debugfs_entry) { +- dev_warn(dev, "could not create debugfs entry\n"); +- return -EFAULT; +- } +- +- if (!debugfs_create_x32("vc_mem_phys_addr", +- 0444, +- vc_mem_debugfs_entry, +- (u32 *)&mm_vc_mem_phys_addr)) { +- dev_warn(dev, "%s:could not create vc_mem_phys entry\n", +- __func__); +- goto fail; +- } +- +- if (!debugfs_create_x32("vc_mem_size", +- 0444, +- vc_mem_debugfs_entry, +- (u32 *)&mm_vc_mem_size)) { +- dev_warn(dev, "%s:could not create vc_mem_size entry\n", +- __func__); +- goto fail; +- } +- +- if (!debugfs_create_x32("vc_mem_base", +- 0444, +- vc_mem_debugfs_entry, +- (u32 *)&mm_vc_mem_base)) { +- dev_warn(dev, "%s:could not create vc_mem_base entry\n", +- __func__); +- goto fail; +- } +- +- return 0; +- +-fail: +- vc_mem_debugfs_deinit(); +- return -EFAULT; +-} +- +-#endif /* CONFIG_DEBUG_FS */ +- +- +-/**************************************************************************** +-* +-* vc_mem_init +-* +-***************************************************************************/ +- +-static int __init +-vc_mem_init(void) +-{ +- int rc = -EFAULT; +- struct device *dev; +- +- pr_debug("%s: called\n", __func__); +- +- mm_vc_mem_phys_addr = phys_addr; +- mm_vc_mem_size = mem_size; +- mm_vc_mem_base = mem_base; +- +- vc_mem_get_size(); +- +- pr_info("vc-mem: phys_addr:0x%08lx mem_base=0x%08x mem_size:0x%08x(%u MiB)\n", +- mm_vc_mem_phys_addr, mm_vc_mem_base, mm_vc_mem_size, mm_vc_mem_size / (1024 * 1024)); +- +- if ((rc = alloc_chrdev_region(&vc_mem_devnum, 0, 1, DRIVER_NAME)) < 0) { +- pr_err("%s: alloc_chrdev_region failed (rc=%d)\n", +- __func__, rc); +- goto out_err; +- } +- +- cdev_init(&vc_mem_cdev, &vc_mem_fops); +- if ((rc = cdev_add(&vc_mem_cdev, vc_mem_devnum, 1)) != 0) { +- pr_err("%s: cdev_add failed (rc=%d)\n", __func__, rc); +- goto out_unregister; +- } +- +- vc_mem_class = class_create(THIS_MODULE, DRIVER_NAME); +- if (IS_ERR(vc_mem_class)) { +- rc = PTR_ERR(vc_mem_class); +- pr_err("%s: class_create failed (rc=%d)\n", __func__, rc); +- goto out_cdev_del; +- } +- +- dev = device_create(vc_mem_class, NULL, vc_mem_devnum, NULL, +- DRIVER_NAME); +- if (IS_ERR(dev)) { +- rc = PTR_ERR(dev); +- pr_err("%s: device_create failed (rc=%d)\n", __func__, rc); +- goto out_class_destroy; +- } +- +-#ifdef CONFIG_DEBUG_FS +- /* don't fail if the debug entries cannot be created */ +- vc_mem_debugfs_init(dev); +-#endif +- +- vc_mem_inited = 1; +- return 0; +- +- device_destroy(vc_mem_class, vc_mem_devnum); +- +- out_class_destroy: +- class_destroy(vc_mem_class); +- vc_mem_class = NULL; +- +- out_cdev_del: +- cdev_del(&vc_mem_cdev); +- +- out_unregister: +- unregister_chrdev_region(vc_mem_devnum, 1); +- +- out_err: +- return -1; +-} +- +-/**************************************************************************** +-* +-* vc_mem_exit +-* +-***************************************************************************/ +- +-static void __exit +-vc_mem_exit(void) +-{ +- pr_debug("%s: called\n", __func__); +- +- if (vc_mem_inited) { +-#if CONFIG_DEBUG_FS +- vc_mem_debugfs_deinit(); +-#endif +- device_destroy(vc_mem_class, vc_mem_devnum); +- class_destroy(vc_mem_class); +- cdev_del(&vc_mem_cdev); +- unregister_chrdev_region(vc_mem_devnum, 1); +- } +-} +- +-module_init(vc_mem_init); +-module_exit(vc_mem_exit); +-MODULE_LICENSE("GPL"); +-MODULE_AUTHOR("Broadcom Corporation"); +- +-module_param(phys_addr, uint, 0644); +-module_param(mem_size, uint, 0644); +-module_param(mem_base, uint, 0644); +diff --git a/drivers/char/broadcom/Kconfig b/drivers/char/broadcom/Kconfig +index 2d8bd6e..7037928 100644 +--- a/drivers/char/broadcom/Kconfig ++++ b/drivers/char/broadcom/Kconfig +@@ -7,9 +7,19 @@ menuconfig BRCM_CHAR_DRIVERS + help + Broadcom's char drivers + ++if BRCM_CHAR_DRIVERS ++ + config BCM_VC_CMA + bool "Videocore CMA" +- depends on CMA && BRCM_CHAR_DRIVERS && BCM2708_VCHIQ ++ depends on CMA && BCM2708_VCHIQ + default n + help + Helper for videocore CMA access. ++ ++config BCM2708_VCMEM ++ bool "Videocore Memory" ++ default y ++ help ++ Helper for videocore memory access and total size allocation. ++ ++endif +diff --git a/drivers/char/broadcom/Makefile b/drivers/char/broadcom/Makefile +index 13c5bca..fce918c 100644 +--- a/drivers/char/broadcom/Makefile ++++ b/drivers/char/broadcom/Makefile +@@ -1 +1,2 @@ + obj-$(CONFIG_BCM_VC_CMA) += vc_cma/ ++obj-$(CONFIG_BCM2708_VCMEM) += vc_mem.o +diff --git a/drivers/char/broadcom/vc_mem.c b/drivers/char/broadcom/vc_mem.c +new file mode 100644 +index 0000000..be64f23 +--- /dev/null ++++ b/drivers/char/broadcom/vc_mem.c +@@ -0,0 +1,422 @@ ++/***************************************************************************** ++* Copyright 2010 - 2011 Broadcom Corporation. All rights reserved. ++* ++* Unless you and Broadcom execute a separate written software license ++* agreement governing use of this software, this software is licensed to you ++* under the terms of the GNU General Public License version 2, available at ++* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). ++* ++* Notwithstanding the above, under no circumstances may you combine this ++* software in any way with any other Broadcom software provided under a ++* license other than the GPL, without Broadcom's express prior written ++* consent. ++*****************************************************************************/ ++ ++#include <linux/kernel.h> ++#include <linux/module.h> ++#include <linux/fs.h> ++#include <linux/device.h> ++#include <linux/cdev.h> ++#include <linux/mm.h> ++#include <linux/slab.h> ++#include <linux/debugfs.h> ++#include <asm/uaccess.h> ++#include <linux/dma-mapping.h> ++#include <linux/broadcom/vc_mem.h> ++ ++#define DRIVER_NAME "vc-mem" ++ ++// Device (/dev) related variables ++static dev_t vc_mem_devnum = 0; ++static struct class *vc_mem_class = NULL; ++static struct cdev vc_mem_cdev; ++static int vc_mem_inited = 0; ++ ++#ifdef CONFIG_DEBUG_FS ++static struct dentry *vc_mem_debugfs_entry; ++#endif ++ ++/* ++ * Videocore memory addresses and size ++ * ++ * Drivers that wish to know the videocore memory addresses and sizes should ++ * use these variables instead of the MM_IO_BASE and MM_ADDR_IO defines in ++ * headers. This allows the other drivers to not be tied down to a a certain ++ * address/size at compile time. ++ * ++ * In the future, the goal is to have the videocore memory virtual address and ++ * size be calculated at boot time rather than at compile time. The decision of ++ * where the videocore memory resides and its size would be in the hands of the ++ * bootloader (and/or kernel). When that happens, the values of these variables ++ * would be calculated and assigned in the init function. ++ */ ++// in the 2835 VC in mapped above ARM, but ARM has full access to VC space ++unsigned long mm_vc_mem_phys_addr = 0x00000000; ++unsigned int mm_vc_mem_size = 0; ++unsigned int mm_vc_mem_base = 0; ++ ++EXPORT_SYMBOL(mm_vc_mem_phys_addr); ++EXPORT_SYMBOL(mm_vc_mem_size); ++EXPORT_SYMBOL(mm_vc_mem_base); ++ ++static uint phys_addr = 0; ++static uint mem_size = 0; ++static uint mem_base = 0; ++ ++ ++/**************************************************************************** ++* ++* vc_mem_open ++* ++***************************************************************************/ ++ ++static int ++vc_mem_open(struct inode *inode, struct file *file) ++{ ++ (void) inode; ++ (void) file; ++ ++ pr_debug("%s: called file = 0x%p\n", __func__, file); ++ ++ return 0; ++} ++ ++/**************************************************************************** ++* ++* vc_mem_release ++* ++***************************************************************************/ ++ ++static int ++vc_mem_release(struct inode *inode, struct file *file) ++{ ++ (void) inode; ++ (void) file; ++ ++ pr_debug("%s: called file = 0x%p\n", __func__, file); ++ ++ return 0; ++} ++ ++/**************************************************************************** ++* ++* vc_mem_get_size ++* ++***************************************************************************/ ++ ++static void ++vc_mem_get_size(void) ++{ ++} ++ ++/**************************************************************************** ++* ++* vc_mem_get_base ++* ++***************************************************************************/ ++ ++static void ++vc_mem_get_base(void) ++{ ++} ++ ++/**************************************************************************** ++* ++* vc_mem_get_current_size ++* ++***************************************************************************/ ++ ++int ++vc_mem_get_current_size(void) ++{ ++ return mm_vc_mem_size; ++} ++ ++EXPORT_SYMBOL_GPL(vc_mem_get_current_size); ++ ++/**************************************************************************** ++* ++* vc_mem_ioctl ++* ++***************************************************************************/ ++ ++static long ++vc_mem_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ++{ ++ int rc = 0; ++ ++ (void) cmd; ++ (void) arg; ++ ++ pr_debug("%s: called file = 0x%p\n", __func__, file); ++ ++ switch (cmd) { ++ case VC_MEM_IOC_MEM_PHYS_ADDR: ++ { ++ pr_debug("%s: VC_MEM_IOC_MEM_PHYS_ADDR=0x%p\n", ++ __func__, (void *) mm_vc_mem_phys_addr); ++ ++ if (copy_to_user((void *) arg, &mm_vc_mem_phys_addr, ++ sizeof (mm_vc_mem_phys_addr)) != 0) { ++ rc = -EFAULT; ++ } ++ break; ++ } ++ case VC_MEM_IOC_MEM_SIZE: ++ { ++ // Get the videocore memory size first ++ vc_mem_get_size(); ++ ++ pr_debug("%s: VC_MEM_IOC_MEM_SIZE=%u\n", __func__, ++ mm_vc_mem_size); ++ ++ if (copy_to_user((void *) arg, &mm_vc_mem_size, ++ sizeof (mm_vc_mem_size)) != 0) { ++ rc = -EFAULT; ++ } ++ break; ++ } ++ case VC_MEM_IOC_MEM_BASE: ++ { ++ // Get the videocore memory base ++ vc_mem_get_base(); ++ ++ pr_debug("%s: VC_MEM_IOC_MEM_BASE=%u\n", __func__, ++ mm_vc_mem_base); ++ ++ if (copy_to_user((void *) arg, &mm_vc_mem_base, ++ sizeof (mm_vc_mem_base)) != 0) { ++ rc = -EFAULT; ++ } ++ break; ++ } ++ case VC_MEM_IOC_MEM_LOAD: ++ { ++ // Get the videocore memory base ++ vc_mem_get_base(); ++ ++ pr_debug("%s: VC_MEM_IOC_MEM_LOAD=%u\n", __func__, ++ mm_vc_mem_base); ++ ++ if (copy_to_user((void *) arg, &mm_vc_mem_base, ++ sizeof (mm_vc_mem_base)) != 0) { ++ rc = -EFAULT; ++ } ++ break; ++ } ++ default: ++ { ++ return -ENOTTY; ++ } ++ } ++ pr_debug("%s: file = 0x%p returning %d\n", __func__, file, rc); ++ ++ return rc; ++} ++ ++/**************************************************************************** ++* ++* vc_mem_mmap ++* ++***************************************************************************/ ++ ++static int ++vc_mem_mmap(struct file *filp, struct vm_area_struct *vma) ++{ ++ int rc = 0; ++ unsigned long length = vma->vm_end - vma->vm_start; ++ unsigned long offset = vma->vm_pgoff << PAGE_SHIFT; ++ ++ pr_debug("%s: vm_start = 0x%08lx vm_end = 0x%08lx vm_pgoff = 0x%08lx\n", ++ __func__, (long) vma->vm_start, (long) vma->vm_end, ++ (long) vma->vm_pgoff); ++ ++ if (offset + length > mm_vc_mem_size) { ++ pr_err("%s: length %ld is too big\n", __func__, length); ++ return -EINVAL; ++ } ++ // Do not cache the memory map ++ vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); ++ ++ rc = remap_pfn_range(vma, vma->vm_start, ++ (mm_vc_mem_phys_addr >> PAGE_SHIFT) + ++ vma->vm_pgoff, length, vma->vm_page_prot); ++ if (rc != 0) { ++ pr_err("%s: remap_pfn_range failed (rc=%d)\n", __func__, rc); ++ } ++ ++ return rc; ++} ++ ++/**************************************************************************** ++* ++* File Operations for the driver. ++* ++***************************************************************************/ ++ ++static const struct file_operations vc_mem_fops = { ++ .owner = THIS_MODULE, ++ .open = vc_mem_open, ++ .release = vc_mem_release, ++ .unlocked_ioctl = vc_mem_ioctl, ++ .mmap = vc_mem_mmap, ++}; ++ ++#ifdef CONFIG_DEBUG_FS ++static void vc_mem_debugfs_deinit(void) ++{ ++ debugfs_remove_recursive(vc_mem_debugfs_entry); ++ vc_mem_debugfs_entry = NULL; ++} ++ ++ ++static int vc_mem_debugfs_init( ++ struct device *dev) ++{ ++ vc_mem_debugfs_entry = debugfs_create_dir(DRIVER_NAME, NULL); ++ if (!vc_mem_debugfs_entry) { ++ dev_warn(dev, "could not create debugfs entry\n"); ++ return -EFAULT; ++ } ++ ++ if (!debugfs_create_x32("vc_mem_phys_addr", ++ 0444, ++ vc_mem_debugfs_entry, ++ (u32 *)&mm_vc_mem_phys_addr)) { ++ dev_warn(dev, "%s:could not create vc_mem_phys entry\n", ++ __func__); ++ goto fail; ++ } ++ ++ if (!debugfs_create_x32("vc_mem_size", ++ 0444, ++ vc_mem_debugfs_entry, ++ (u32 *)&mm_vc_mem_size)) { ++ dev_warn(dev, "%s:could not create vc_mem_size entry\n", ++ __func__); ++ goto fail; ++ } ++ ++ if (!debugfs_create_x32("vc_mem_base", ++ 0444, ++ vc_mem_debugfs_entry, ++ (u32 *)&mm_vc_mem_base)) { ++ dev_warn(dev, "%s:could not create vc_mem_base entry\n", ++ __func__); ++ goto fail; ++ } ++ ++ return 0; ++ ++fail: ++ vc_mem_debugfs_deinit(); ++ return -EFAULT; ++} ++ ++#endif /* CONFIG_DEBUG_FS */ ++ ++ ++/**************************************************************************** ++* ++* vc_mem_init ++* ++***************************************************************************/ ++ ++static int __init ++vc_mem_init(void) ++{ ++ int rc = -EFAULT; ++ struct device *dev; ++ ++ pr_debug("%s: called\n", __func__); ++ ++ mm_vc_mem_phys_addr = phys_addr; ++ mm_vc_mem_size = mem_size; ++ mm_vc_mem_base = mem_base; ++ ++ vc_mem_get_size(); ++ ++ pr_info("vc-mem: phys_addr:0x%08lx mem_base=0x%08x mem_size:0x%08x(%u MiB)\n", ++ mm_vc_mem_phys_addr, mm_vc_mem_base, mm_vc_mem_size, mm_vc_mem_size / (1024 * 1024)); ++ ++ if ((rc = alloc_chrdev_region(&vc_mem_devnum, 0, 1, DRIVER_NAME)) < 0) { ++ pr_err("%s: alloc_chrdev_region failed (rc=%d)\n", ++ __func__, rc); ++ goto out_err; ++ } ++ ++ cdev_init(&vc_mem_cdev, &vc_mem_fops); ++ if ((rc = cdev_add(&vc_mem_cdev, vc_mem_devnum, 1)) != 0) { ++ pr_err("%s: cdev_add failed (rc=%d)\n", __func__, rc); ++ goto out_unregister; ++ } ++ ++ vc_mem_class = class_create(THIS_MODULE, DRIVER_NAME); ++ if (IS_ERR(vc_mem_class)) { ++ rc = PTR_ERR(vc_mem_class); ++ pr_err("%s: class_create failed (rc=%d)\n", __func__, rc); ++ goto out_cdev_del; ++ } ++ ++ dev = device_create(vc_mem_class, NULL, vc_mem_devnum, NULL, ++ DRIVER_NAME); ++ if (IS_ERR(dev)) { ++ rc = PTR_ERR(dev); ++ pr_err("%s: device_create failed (rc=%d)\n", __func__, rc); ++ goto out_class_destroy; ++ } ++ ++#ifdef CONFIG_DEBUG_FS ++ /* don't fail if the debug entries cannot be created */ ++ vc_mem_debugfs_init(dev); ++#endif ++ ++ vc_mem_inited = 1; ++ return 0; ++ ++ device_destroy(vc_mem_class, vc_mem_devnum); ++ ++ out_class_destroy: ++ class_destroy(vc_mem_class); ++ vc_mem_class = NULL; ++ ++ out_cdev_del: ++ cdev_del(&vc_mem_cdev); ++ ++ out_unregister: ++ unregister_chrdev_region(vc_mem_devnum, 1); ++ ++ out_err: ++ return -1; ++} ++ ++/**************************************************************************** ++* ++* vc_mem_exit ++* ++***************************************************************************/ ++ ++static void __exit ++vc_mem_exit(void) ++{ ++ pr_debug("%s: called\n", __func__); ++ ++ if (vc_mem_inited) { ++#if CONFIG_DEBUG_FS ++ vc_mem_debugfs_deinit(); ++#endif ++ device_destroy(vc_mem_class, vc_mem_devnum); ++ class_destroy(vc_mem_class); ++ cdev_del(&vc_mem_cdev); ++ unregister_chrdev_region(vc_mem_devnum, 1); ++ } ++} ++ ++module_init(vc_mem_init); ++module_exit(vc_mem_exit); ++MODULE_LICENSE("GPL"); ++MODULE_AUTHOR("Broadcom Corporation"); ++ ++module_param(phys_addr, uint, 0644); ++module_param(mem_size, uint, 0644); ++module_param(mem_base, uint, 0644); +diff --git a/include/linux/broadcom/vc_mem.h b/include/linux/broadcom/vc_mem.h +new file mode 100644 +index 0000000..20a4753 +--- /dev/null ++++ b/include/linux/broadcom/vc_mem.h +@@ -0,0 +1,35 @@ ++/***************************************************************************** ++* Copyright 2010 - 2011 Broadcom Corporation. All rights reserved. ++* ++* Unless you and Broadcom execute a separate written software license ++* agreement governing use of this software, this software is licensed to you ++* under the terms of the GNU General Public License version 2, available at ++* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). ++* ++* Notwithstanding the above, under no circumstances may you combine this ++* software in any way with any other Broadcom software provided under a ++* license other than the GPL, without Broadcom's express prior written ++* consent. ++*****************************************************************************/ ++ ++#ifndef _VC_MEM_H ++#define _VC_MEM_H ++ ++#include <linux/ioctl.h> ++ ++#define VC_MEM_IOC_MAGIC 'v' ++ ++#define VC_MEM_IOC_MEM_PHYS_ADDR _IOR( VC_MEM_IOC_MAGIC, 0, unsigned long ) ++#define VC_MEM_IOC_MEM_SIZE _IOR( VC_MEM_IOC_MAGIC, 1, unsigned int ) ++#define VC_MEM_IOC_MEM_BASE _IOR( VC_MEM_IOC_MAGIC, 2, unsigned int ) ++#define VC_MEM_IOC_MEM_LOAD _IOR( VC_MEM_IOC_MAGIC, 3, unsigned int ) ++ ++#if defined( __KERNEL__ ) ++#define VC_MEM_TO_ARM_ADDR_MASK 0x3FFFFFFF ++ ++extern unsigned long mm_vc_mem_phys_addr; ++extern unsigned int mm_vc_mem_size; ++extern int vc_mem_get_current_size( void ); ++#endif ++ ++#endif /* _VC_MEM_H */ + +From 9e8a9f6739d247779cfed83ca57c70c963eaa14e Mon Sep 17 00:00:00 2001 +From: Tim Gover <tgover@broadcom.com> +Date: Tue, 22 Jul 2014 15:41:04 +0100 +Subject: [PATCH 043/112] vcsm: VideoCore shared memory service for BCM2835 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Add experimental support for the VideoCore shared memory service. +This allows user processes to allocate memory from VideoCore's +GPU relocatable heap and mmap the buffers. Additionally, the memory +handles can passed to other VideoCore services such as MMAL, OpenMax +and DispmanX + +TODO +* This driver was originally released for BCM28155 which has a different + cache architecture to BCM2835. Consequently, in this release only + uncached mappings are supported. However, there's no fundamental + reason which cached mappings cannot be support or BCM2835 +* More refactoring is required to remove the typedefs. +* Re-enable the some of the commented out debug-fs statistics which were + disabled when migrating code from proc-fs. +* There's a lot of code to support sharing of VCSM in order to support + Android. This could probably done more cleanly or perhaps just + removed. + +Signed-off-by: Tim Gover <timgover@gmail.com> + +config: Disable VC_SM for now to fix hang with cutdown kernel + +vcsm: Use boolean as it cannot be built as module + +On building the bcm_vc_sm as a module we get the following error: + +v7_dma_flush_range and do_munmap are undefined in vc-sm.ko. + +Fix by making it not an option to build as module + +vcsm: Add ioctl for custom cache flushing + +vc-sm: Move headers out of arch directory + +Signed-off-by: Noralf Trønnes <noralf@tronnes.org> +--- + drivers/char/broadcom/Kconfig | 9 + + drivers/char/broadcom/Makefile | 1 + + drivers/char/broadcom/vc_sm/Makefile | 20 + + drivers/char/broadcom/vc_sm/vc_sm_defs.h | 181 ++ + drivers/char/broadcom/vc_sm/vc_sm_knl.h | 55 + + drivers/char/broadcom/vc_sm/vc_vchi_sm.c | 492 +++++ + drivers/char/broadcom/vc_sm/vc_vchi_sm.h | 82 + + drivers/char/broadcom/vc_sm/vmcs_sm.c | 3213 ++++++++++++++++++++++++++++++ + include/linux/broadcom/vmcs_sm_ioctl.h | 248 +++ + 9 files changed, 4301 insertions(+) + create mode 100644 drivers/char/broadcom/vc_sm/Makefile + create mode 100644 drivers/char/broadcom/vc_sm/vc_sm_defs.h + create mode 100644 drivers/char/broadcom/vc_sm/vc_sm_knl.h + create mode 100644 drivers/char/broadcom/vc_sm/vc_vchi_sm.c + create mode 100644 drivers/char/broadcom/vc_sm/vc_vchi_sm.h + create mode 100644 drivers/char/broadcom/vc_sm/vmcs_sm.c + create mode 100644 include/linux/broadcom/vmcs_sm_ioctl.h + +diff --git a/drivers/char/broadcom/Kconfig b/drivers/char/broadcom/Kconfig +index 7037928..75fa1cb 100644 +--- a/drivers/char/broadcom/Kconfig ++++ b/drivers/char/broadcom/Kconfig +@@ -23,3 +23,12 @@ config BCM2708_VCMEM + Helper for videocore memory access and total size allocation. + + endif ++ ++config BCM_VC_SM ++ bool "VMCS Shared Memory" ++ depends on BCM2708_VCHIQ ++ select BCM2708_VCMEM ++ default n ++ help ++ Support for the VC shared memory on the Broadcom reference ++ design. Uses the VCHIQ stack. +diff --git a/drivers/char/broadcom/Makefile b/drivers/char/broadcom/Makefile +index fce918c..de8feb9 100644 +--- a/drivers/char/broadcom/Makefile ++++ b/drivers/char/broadcom/Makefile +@@ -1,2 +1,3 @@ + obj-$(CONFIG_BCM_VC_CMA) += vc_cma/ + obj-$(CONFIG_BCM2708_VCMEM) += vc_mem.o ++obj-$(CONFIG_BCM_VC_SM) += vc_sm/ +diff --git a/drivers/char/broadcom/vc_sm/Makefile b/drivers/char/broadcom/vc_sm/Makefile +new file mode 100644 +index 0000000..68fa2aa +--- /dev/null ++++ b/drivers/char/broadcom/vc_sm/Makefile +@@ -0,0 +1,20 @@ ++EXTRA_CFLAGS += -Wall -Wstrict-prototypes -Wno-trigraphs -O2 ++ ++EXTRA_CFLAGS += -I"drivers/misc/vc04_services" ++EXTRA_CFLAGS += -I"drivers/misc/vc04_services/interface/vchi" ++EXTRA_CFLAGS += -I"drivers/misc/vc04_services/interface/vchiq_arm" ++EXTRA_CFLAGS += -I"$(srctree)/fs/" ++ ++EXTRA_CFLAGS += -DOS_ASSERT_FAILURE ++EXTRA_CFLAGS += -D__STDC_VERSION=199901L ++EXTRA_CFLAGS += -D__STDC_VERSION__=199901L ++EXTRA_CFLAGS += -D__VCCOREVER__=0 ++EXTRA_CFLAGS += -D__KERNEL__ ++EXTRA_CFLAGS += -D__linux__ ++EXTRA_CFLAGS += -Werror ++ ++obj-$(CONFIG_BCM_VC_SM) := vc-sm.o ++ ++vc-sm-objs := \ ++ vmcs_sm.o \ ++ vc_vchi_sm.o +diff --git a/drivers/char/broadcom/vc_sm/vc_sm_defs.h b/drivers/char/broadcom/vc_sm/vc_sm_defs.h +new file mode 100644 +index 0000000..c4d5ff7 +--- /dev/null ++++ b/drivers/char/broadcom/vc_sm/vc_sm_defs.h +@@ -0,0 +1,181 @@ ++/***************************************************************************** ++* Copyright 2011 Broadcom Corporation. All rights reserved. ++* ++* Unless you and Broadcom execute a separate written software license ++* agreement governing use of this software, this software is licensed to you ++* under the terms of the GNU General Public License version 2, available at ++* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). ++* ++* Notwithstanding the above, under no circumstances may you combine this ++* software in any way with any other Broadcom software provided under a ++* license other than the GPL, without Broadcom's express prior written ++* consent. ++*****************************************************************************/ ++ ++#ifndef __VC_SM_DEFS_H__INCLUDED__ ++#define __VC_SM_DEFS_H__INCLUDED__ ++ ++/* FourCC code used for VCHI connection */ ++#define VC_SM_SERVER_NAME MAKE_FOURCC("SMEM") ++ ++/* Maximum message length */ ++#define VC_SM_MAX_MSG_LEN (sizeof(VC_SM_MSG_UNION_T) + \ ++ sizeof(VC_SM_MSG_HDR_T)) ++#define VC_SM_MAX_RSP_LEN (sizeof(VC_SM_MSG_UNION_T)) ++ ++/* Resource name maximum size */ ++#define VC_SM_RESOURCE_NAME 32 ++ ++/* All message types supported for HOST->VC direction */ ++typedef enum { ++ /* Allocate shared memory block */ ++ VC_SM_MSG_TYPE_ALLOC, ++ /* Lock allocated shared memory block */ ++ VC_SM_MSG_TYPE_LOCK, ++ /* Unlock allocated shared memory block */ ++ VC_SM_MSG_TYPE_UNLOCK, ++ /* Unlock allocated shared memory block, do not answer command */ ++ VC_SM_MSG_TYPE_UNLOCK_NOANS, ++ /* Free shared memory block */ ++ VC_SM_MSG_TYPE_FREE, ++ /* Resize a shared memory block */ ++ VC_SM_MSG_TYPE_RESIZE, ++ /* Walk the allocated shared memory block(s) */ ++ VC_SM_MSG_TYPE_WALK_ALLOC, ++ ++ /* A previously applied action will need to be reverted */ ++ VC_SM_MSG_TYPE_ACTION_CLEAN, ++ VC_SM_MSG_TYPE_MAX ++} VC_SM_MSG_TYPE; ++ ++/* Type of memory to be allocated */ ++typedef enum { ++ VC_SM_ALLOC_CACHED, ++ VC_SM_ALLOC_NON_CACHED, ++ ++} VC_SM_ALLOC_TYPE_T; ++ ++/* Message header for all messages in HOST->VC direction */ ++typedef struct { ++ int32_t type; ++ uint32_t trans_id; ++ uint8_t body[0]; ++ ++} VC_SM_MSG_HDR_T; ++ ++/* Request to allocate memory (HOST->VC) */ ++typedef struct { ++ /* type of memory to allocate */ ++ VC_SM_ALLOC_TYPE_T type; ++ /* byte amount of data to allocate per unit */ ++ uint32_t base_unit; ++ /* number of unit to allocate */ ++ uint32_t num_unit; ++ /* alignement to be applied on allocation */ ++ uint32_t alignement; ++ /* identity of who allocated this block */ ++ uint32_t allocator; ++ /* resource name (for easier tracking on vc side) */ ++ char name[VC_SM_RESOURCE_NAME]; ++ ++} VC_SM_ALLOC_T; ++ ++/* Result of a requested memory allocation (VC->HOST) */ ++typedef struct { ++ /* Transaction identifier */ ++ uint32_t trans_id; ++ ++ /* Resource handle */ ++ uint32_t res_handle; ++ /* Pointer to resource buffer */ ++ void *res_mem; ++ /* Resource base size (bytes) */ ++ uint32_t res_base_size; ++ /* Resource number */ ++ uint32_t res_num; ++ ++} VC_SM_ALLOC_RESULT_T; ++ ++/* Request to free a previously allocated memory (HOST->VC) */ ++typedef struct { ++ /* Resource handle (returned from alloc) */ ++ uint32_t res_handle; ++ /* Resource buffer (returned from alloc) */ ++ void *res_mem; ++ ++} VC_SM_FREE_T; ++ ++/* Request to lock a previously allocated memory (HOST->VC) */ ++typedef struct { ++ /* Resource handle (returned from alloc) */ ++ uint32_t res_handle; ++ /* Resource buffer (returned from alloc) */ ++ void *res_mem; ++ ++} VC_SM_LOCK_UNLOCK_T; ++ ++/* Request to resize a previously allocated memory (HOST->VC) */ ++typedef struct { ++ /* Resource handle (returned from alloc) */ ++ uint32_t res_handle; ++ /* Resource buffer (returned from alloc) */ ++ void *res_mem; ++ /* Resource *new* size requested (bytes) */ ++ uint32_t res_new_size; ++ ++} VC_SM_RESIZE_T; ++ ++/* Result of a requested memory lock (VC->HOST) */ ++typedef struct { ++ /* Transaction identifier */ ++ uint32_t trans_id; ++ ++ /* Resource handle */ ++ uint32_t res_handle; ++ /* Pointer to resource buffer */ ++ void *res_mem; ++ /* Pointer to former resource buffer if the memory ++ * was reallocated */ ++ void *res_old_mem; ++ ++} VC_SM_LOCK_RESULT_T; ++ ++/* Generic result for a request (VC->HOST) */ ++typedef struct { ++ /* Transaction identifier */ ++ uint32_t trans_id; ++ ++ int32_t success; ++ ++} VC_SM_RESULT_T; ++ ++/* Request to revert a previously applied action (HOST->VC) */ ++typedef struct { ++ /* Action of interest */ ++ VC_SM_MSG_TYPE res_action; ++ /* Transaction identifier for the action of interest */ ++ uint32_t action_trans_id; ++ ++} VC_SM_ACTION_CLEAN_T; ++ ++/* Request to remove all data associated with a given allocator (HOST->VC) */ ++typedef struct { ++ /* Allocator identifier */ ++ uint32_t allocator; ++ ++} VC_SM_FREE_ALL_T; ++ ++/* Union of ALL messages */ ++typedef union { ++ VC_SM_ALLOC_T alloc; ++ VC_SM_ALLOC_RESULT_T alloc_result; ++ VC_SM_FREE_T free; ++ VC_SM_ACTION_CLEAN_T action_clean; ++ VC_SM_RESIZE_T resize; ++ VC_SM_LOCK_RESULT_T lock_result; ++ VC_SM_RESULT_T result; ++ VC_SM_FREE_ALL_T free_all; ++ ++} VC_SM_MSG_UNION_T; ++ ++#endif /* __VC_SM_DEFS_H__INCLUDED__ */ +diff --git a/drivers/char/broadcom/vc_sm/vc_sm_knl.h b/drivers/char/broadcom/vc_sm/vc_sm_knl.h +new file mode 100644 +index 0000000..965f9a2 +--- /dev/null ++++ b/drivers/char/broadcom/vc_sm/vc_sm_knl.h +@@ -0,0 +1,55 @@ ++/***************************************************************************** ++* Copyright 2011 Broadcom Corporation. All rights reserved. ++* ++* Unless you and Broadcom execute a separate written software license ++* agreement governing use of this software, this software is licensed to you ++* under the terms of the GNU General Public License version 2, available at ++* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). ++* ++* Notwithstanding the above, under no circumstances may you combine this ++* software in any way with any other Broadcom software provided under a ++* license other than the GPL, without Broadcom's express prior written ++* consent. ++*****************************************************************************/ ++ ++#ifndef __VC_SM_KNL_H__INCLUDED__ ++#define __VC_SM_KNL_H__INCLUDED__ ++ ++#if !defined(__KERNEL__) ++#error "This interface is for kernel use only..." ++#endif ++ ++/* Type of memory to be locked (ie mapped) */ ++typedef enum { ++ VC_SM_LOCK_CACHED, ++ VC_SM_LOCK_NON_CACHED, ++ ++} VC_SM_LOCK_CACHE_MODE_T; ++ ++/* Allocate a shared memory handle and block. ++*/ ++int vc_sm_alloc(VC_SM_ALLOC_T *alloc, int *handle); ++ ++/* Free a previously allocated shared memory handle and block. ++*/ ++int vc_sm_free(int handle); ++ ++/* Lock a memory handle for use by kernel. ++*/ ++int vc_sm_lock(int handle, VC_SM_LOCK_CACHE_MODE_T mode, ++ long unsigned int *data); ++ ++/* Unlock a memory handle in use by kernel. ++*/ ++int vc_sm_unlock(int handle, int flush, int no_vc_unlock); ++ ++/* Get an internal resource handle mapped from the external one. ++*/ ++int vc_sm_int_handle(int handle); ++ ++/* Map a shared memory region for use by kernel. ++*/ ++int vc_sm_map(int handle, unsigned int sm_addr, VC_SM_LOCK_CACHE_MODE_T mode, ++ long unsigned int *data); ++ ++#endif /* __VC_SM_KNL_H__INCLUDED__ */ +diff --git a/drivers/char/broadcom/vc_sm/vc_vchi_sm.c b/drivers/char/broadcom/vc_sm/vc_vchi_sm.c +new file mode 100644 +index 0000000..7c6ba1a +--- /dev/null ++++ b/drivers/char/broadcom/vc_sm/vc_vchi_sm.c +@@ -0,0 +1,492 @@ ++/***************************************************************************** ++* Copyright 2011-2012 Broadcom Corporation. All rights reserved. ++* ++* Unless you and Broadcom execute a separate written software license ++* agreement governing use of this software, this software is licensed to you ++* under the terms of the GNU General Public License version 2, available at ++* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). ++* ++* Notwithstanding the above, under no circumstances may you combine this ++* software in any way with any other Broadcom software provided under a ++* license other than the GPL, without Broadcom's express prior written ++* consent. ++*****************************************************************************/ ++ ++/* ---- Include Files ----------------------------------------------------- */ ++#include <linux/types.h> ++#include <linux/kernel.h> ++#include <linux/list.h> ++#include <linux/semaphore.h> ++#include <linux/mutex.h> ++#include <linux/slab.h> ++#include <linux/kthread.h> ++ ++#include "vc_vchi_sm.h" ++ ++#define VC_SM_VER 1 ++#define VC_SM_MIN_VER 0 ++ ++/* ---- Private Constants and Types -------------------------------------- */ ++ ++/* Command blocks come from a pool */ ++#define SM_MAX_NUM_CMD_RSP_BLKS 32 ++ ++struct sm_cmd_rsp_blk { ++ struct list_head head; /* To create lists */ ++ struct semaphore sema; /* To be signaled when the response is there */ ++ ++ uint16_t id; ++ uint16_t length; ++ ++ uint8_t msg[VC_SM_MAX_MSG_LEN]; ++ ++ uint32_t wait:1; ++ uint32_t sent:1; ++ uint32_t alloc:1; ++ ++}; ++ ++struct sm_instance { ++ uint32_t num_connections; ++ VCHI_SERVICE_HANDLE_T vchi_handle[VCHI_MAX_NUM_CONNECTIONS]; ++ struct task_struct *io_thread; ++ struct semaphore io_sema; ++ ++ uint32_t trans_id; ++ ++ struct mutex lock; ++ struct list_head cmd_list; ++ struct list_head rsp_list; ++ struct list_head dead_list; ++ ++ struct sm_cmd_rsp_blk free_blk[SM_MAX_NUM_CMD_RSP_BLKS]; ++ struct list_head free_list; ++ struct mutex free_lock; ++ struct semaphore free_sema; ++ ++}; ++ ++/* ---- Private Variables ------------------------------------------------ */ ++ ++/* ---- Private Function Prototypes -------------------------------------- */ ++ ++/* ---- Private Functions ------------------------------------------------ */ ++static struct ++sm_cmd_rsp_blk *vc_vchi_cmd_create(struct sm_instance *instance, ++ VC_SM_MSG_TYPE id, void *msg, ++ uint32_t size, int wait) ++{ ++ struct sm_cmd_rsp_blk *blk; ++ VC_SM_MSG_HDR_T *hdr; ++ ++ if (down_interruptible(&instance->free_sema)) { ++ blk = kmalloc(sizeof(*blk), GFP_KERNEL); ++ if (!blk) ++ return NULL; ++ ++ blk->alloc = 1; ++ sema_init(&blk->sema, 0); ++ } else { ++ mutex_lock(&instance->free_lock); ++ blk = ++ list_first_entry(&instance->free_list, ++ struct sm_cmd_rsp_blk, head); ++ list_del(&blk->head); ++ mutex_unlock(&instance->free_lock); ++ } ++ ++ blk->sent = 0; ++ blk->wait = wait; ++ blk->length = sizeof(*hdr) + size; ++ ++ hdr = (VC_SM_MSG_HDR_T *) blk->msg; ++ hdr->type = id; ++ mutex_lock(&instance->lock); ++ hdr->trans_id = blk->id = ++instance->trans_id; ++ mutex_unlock(&instance->lock); ++ ++ if (size) ++ memcpy(hdr->body, msg, size); ++ ++ return blk; ++} ++ ++static void ++vc_vchi_cmd_delete(struct sm_instance *instance, struct sm_cmd_rsp_blk *blk) ++{ ++ if (blk->alloc) { ++ kfree(blk); ++ return; ++ } ++ ++ mutex_lock(&instance->free_lock); ++ list_add(&blk->head, &instance->free_list); ++ mutex_unlock(&instance->free_lock); ++ up(&instance->free_sema); ++} ++ ++static int vc_vchi_sm_videocore_io(void *arg) ++{ ++ struct sm_instance *instance = arg; ++ struct sm_cmd_rsp_blk *cmd = NULL, *cmd_tmp; ++ VC_SM_RESULT_T *reply; ++ uint32_t reply_len; ++ int32_t status; ++ int svc_use = 1; ++ ++ while (1) { ++ if (svc_use) ++ vchi_service_release(instance->vchi_handle[0]); ++ svc_use = 0; ++ if (!down_interruptible(&instance->io_sema)) { ++ vchi_service_use(instance->vchi_handle[0]); ++ svc_use = 1; ++ ++ do { ++ unsigned int flags; ++ /* ++ * Get new command and move it to response list ++ */ ++ mutex_lock(&instance->lock); ++ if (list_empty(&instance->cmd_list)) { ++ /* no more commands to process */ ++ mutex_unlock(&instance->lock); ++ break; ++ } ++ cmd = ++ list_first_entry(&instance->cmd_list, ++ struct sm_cmd_rsp_blk, ++ head); ++ list_move(&cmd->head, &instance->rsp_list); ++ cmd->sent = 1; ++ mutex_unlock(&instance->lock); ++ ++ /* Send the command */ ++ flags = VCHI_FLAGS_BLOCK_UNTIL_QUEUED; ++ status = vchi_msg_queue( ++ instance->vchi_handle[0], ++ cmd->msg, cmd->length, ++ flags, NULL); ++ if (status) { ++ pr_err("%s: failed to queue message (%d)", ++ __func__, status); ++ } ++ ++ /* If no reply is needed then we're done */ ++ if (!cmd->wait) { ++ mutex_lock(&instance->lock); ++ list_del(&cmd->head); ++ mutex_unlock(&instance->lock); ++ vc_vchi_cmd_delete(instance, cmd); ++ continue; ++ } ++ ++ if (status) { ++ up(&cmd->sema); ++ continue; ++ } ++ ++ } while (1); ++ ++ while (!vchi_msg_peek ++ (instance->vchi_handle[0], (void **)&reply, ++ &reply_len, VCHI_FLAGS_NONE)) { ++ mutex_lock(&instance->lock); ++ list_for_each_entry(cmd, &instance->rsp_list, ++ head) { ++ if (cmd->id == reply->trans_id) ++ break; ++ } ++ mutex_unlock(&instance->lock); ++ ++ if (&cmd->head == &instance->rsp_list) { ++ pr_debug("%s: received response %u, throw away...", ++ __func__, reply->trans_id); ++ } else if (reply_len > sizeof(cmd->msg)) { ++ pr_err("%s: reply too big (%u) %u, throw away...", ++ __func__, reply_len, ++ reply->trans_id); ++ } else { ++ memcpy(cmd->msg, reply, reply_len); ++ up(&cmd->sema); ++ } ++ ++ vchi_msg_remove(instance->vchi_handle[0]); ++ } ++ ++ /* Go through the dead list and free them */ ++ mutex_lock(&instance->lock); ++ list_for_each_entry_safe(cmd, cmd_tmp, ++ &instance->dead_list, head) { ++ list_del(&cmd->head); ++ vc_vchi_cmd_delete(instance, cmd); ++ } ++ mutex_unlock(&instance->lock); ++ } ++ } ++ ++ return 0; ++} ++ ++static void vc_sm_vchi_callback(void *param, ++ const VCHI_CALLBACK_REASON_T reason, ++ void *msg_handle) ++{ ++ struct sm_instance *instance = param; ++ ++ (void)msg_handle; ++ ++ switch (reason) { ++ case VCHI_CALLBACK_MSG_AVAILABLE: ++ up(&instance->io_sema); ++ break; ++ ++ case VCHI_CALLBACK_SERVICE_CLOSED: ++ pr_info("%s: service CLOSED!!", __func__); ++ default: ++ break; ++ } ++} ++ ++VC_VCHI_SM_HANDLE_T vc_vchi_sm_init(VCHI_INSTANCE_T vchi_instance, ++ VCHI_CONNECTION_T **vchi_connections, ++ uint32_t num_connections) ++{ ++ uint32_t i; ++ struct sm_instance *instance; ++ int status; ++ ++ pr_debug("%s: start", __func__); ++ ++ if (num_connections > VCHI_MAX_NUM_CONNECTIONS) { ++ pr_err("%s: unsupported number of connections %u (max=%u)", ++ __func__, num_connections, VCHI_MAX_NUM_CONNECTIONS); ++ ++ goto err_null; ++ } ++ /* Allocate memory for this instance */ ++ instance = kzalloc(sizeof(*instance), GFP_KERNEL); ++ ++ /* Misc initialisations */ ++ mutex_init(&instance->lock); ++ sema_init(&instance->io_sema, 0); ++ INIT_LIST_HEAD(&instance->cmd_list); ++ INIT_LIST_HEAD(&instance->rsp_list); ++ INIT_LIST_HEAD(&instance->dead_list); ++ INIT_LIST_HEAD(&instance->free_list); ++ sema_init(&instance->free_sema, SM_MAX_NUM_CMD_RSP_BLKS); ++ mutex_init(&instance->free_lock); ++ for (i = 0; i < SM_MAX_NUM_CMD_RSP_BLKS; i++) { ++ sema_init(&instance->free_blk[i].sema, 0); ++ list_add(&instance->free_blk[i].head, &instance->free_list); ++ } ++ ++ /* Open the VCHI service connections */ ++ instance->num_connections = num_connections; ++ for (i = 0; i < num_connections; i++) { ++ SERVICE_CREATION_T params = { ++ VCHI_VERSION_EX(VC_SM_VER, VC_SM_MIN_VER), ++ VC_SM_SERVER_NAME, ++ vchi_connections[i], ++ 0, ++ 0, ++ vc_sm_vchi_callback, ++ instance, ++ 0, ++ 0, ++ 0, ++ }; ++ ++ status = vchi_service_open(vchi_instance, ++ &params, &instance->vchi_handle[i]); ++ if (status) { ++ pr_err("%s: failed to open VCHI service (%d)", ++ __func__, status); ++ ++ goto err_close_services; ++ } ++ } ++ ++ /* Create the thread which takes care of all io to/from videoocore. */ ++ instance->io_thread = kthread_create(&vc_vchi_sm_videocore_io, ++ (void *)instance, "SMIO"); ++ if (instance->io_thread == NULL) { ++ pr_err("%s: failed to create SMIO thread", __func__); ++ ++ goto err_close_services; ++ } ++ set_user_nice(instance->io_thread, -10); ++ wake_up_process(instance->io_thread); ++ ++ pr_debug("%s: success - instance 0x%x", __func__, (unsigned)instance); ++ return instance; ++ ++err_close_services: ++ for (i = 0; i < instance->num_connections; i++) { ++ if (instance->vchi_handle[i] != NULL) ++ vchi_service_close(instance->vchi_handle[i]); ++ } ++ kfree(instance); ++err_null: ++ pr_debug("%s: FAILED", __func__); ++ return NULL; ++} ++ ++int vc_vchi_sm_stop(VC_VCHI_SM_HANDLE_T *handle) ++{ ++ struct sm_instance *instance; ++ uint32_t i; ++ ++ if (handle == NULL) { ++ pr_err("%s: invalid pointer to handle %p", __func__, handle); ++ goto lock; ++ } ++ ++ if (*handle == NULL) { ++ pr_err("%s: invalid handle %p", __func__, *handle); ++ goto lock; ++ } ++ ++ instance = *handle; ++ ++ /* Close all VCHI service connections */ ++ for (i = 0; i < instance->num_connections; i++) { ++ int32_t success; ++ vchi_service_use(instance->vchi_handle[i]); ++ ++ success = vchi_service_close(instance->vchi_handle[i]); ++ } ++ ++ kfree(instance); ++ ++ *handle = NULL; ++ return 0; ++ ++lock: ++ return -EINVAL; ++} ++ ++int vc_vchi_sm_send_msg(VC_VCHI_SM_HANDLE_T handle, ++ VC_SM_MSG_TYPE msg_id, ++ void *msg, uint32_t msg_size, ++ void *result, uint32_t result_size, ++ uint32_t *cur_trans_id, uint8_t wait_reply) ++{ ++ int status = 0; ++ struct sm_instance *instance = handle; ++ struct sm_cmd_rsp_blk *cmd_blk; ++ ++ if (handle == NULL) { ++ pr_err("%s: invalid handle", __func__); ++ return -EINVAL; ++ } ++ if (msg == NULL) { ++ pr_err("%s: invalid msg pointer", __func__); ++ return -EINVAL; ++ } ++ ++ cmd_blk = ++ vc_vchi_cmd_create(instance, msg_id, msg, msg_size, wait_reply); ++ if (cmd_blk == NULL) { ++ pr_err("[%s]: failed to allocate global tracking resource", ++ __func__); ++ return -ENOMEM; ++ } ++ ++ if (cur_trans_id != NULL) ++ *cur_trans_id = cmd_blk->id; ++ ++ mutex_lock(&instance->lock); ++ list_add_tail(&cmd_blk->head, &instance->cmd_list); ++ mutex_unlock(&instance->lock); ++ up(&instance->io_sema); ++ ++ if (!wait_reply) ++ /* We're done */ ++ return 0; ++ ++ /* Wait for the response */ ++ if (down_interruptible(&cmd_blk->sema)) { ++ mutex_lock(&instance->lock); ++ if (!cmd_blk->sent) { ++ list_del(&cmd_blk->head); ++ mutex_unlock(&instance->lock); ++ vc_vchi_cmd_delete(instance, cmd_blk); ++ return -ENXIO; ++ } ++ mutex_unlock(&instance->lock); ++ ++ mutex_lock(&instance->lock); ++ list_move(&cmd_blk->head, &instance->dead_list); ++ mutex_unlock(&instance->lock); ++ up(&instance->io_sema); ++ return -EINTR; /* We're done */ ++ } ++ ++ if (result && result_size) { ++ memcpy(result, cmd_blk->msg, result_size); ++ } else { ++ VC_SM_RESULT_T *res = (VC_SM_RESULT_T *) cmd_blk->msg; ++ status = (res->success == 0) ? 0 : -ENXIO; ++ } ++ ++ mutex_lock(&instance->lock); ++ list_del(&cmd_blk->head); ++ mutex_unlock(&instance->lock); ++ vc_vchi_cmd_delete(instance, cmd_blk); ++ return status; ++} ++ ++int vc_vchi_sm_alloc(VC_VCHI_SM_HANDLE_T handle, VC_SM_ALLOC_T *msg, ++ VC_SM_ALLOC_RESULT_T *result, uint32_t *cur_trans_id) ++{ ++ return vc_vchi_sm_send_msg(handle, VC_SM_MSG_TYPE_ALLOC, ++ msg, sizeof(*msg), result, sizeof(*result), ++ cur_trans_id, 1); ++} ++ ++int vc_vchi_sm_free(VC_VCHI_SM_HANDLE_T handle, ++ VC_SM_FREE_T *msg, uint32_t *cur_trans_id) ++{ ++ return vc_vchi_sm_send_msg(handle, VC_SM_MSG_TYPE_FREE, ++ msg, sizeof(*msg), 0, 0, cur_trans_id, 0); ++} ++ ++int vc_vchi_sm_lock(VC_VCHI_SM_HANDLE_T handle, ++ VC_SM_LOCK_UNLOCK_T *msg, ++ VC_SM_LOCK_RESULT_T *result, uint32_t *cur_trans_id) ++{ ++ return vc_vchi_sm_send_msg(handle, VC_SM_MSG_TYPE_LOCK, ++ msg, sizeof(*msg), result, sizeof(*result), ++ cur_trans_id, 1); ++} ++ ++int vc_vchi_sm_unlock(VC_VCHI_SM_HANDLE_T handle, ++ VC_SM_LOCK_UNLOCK_T *msg, ++ uint32_t *cur_trans_id, uint8_t wait_reply) ++{ ++ return vc_vchi_sm_send_msg(handle, wait_reply ? ++ VC_SM_MSG_TYPE_UNLOCK : ++ VC_SM_MSG_TYPE_UNLOCK_NOANS, msg, ++ sizeof(*msg), 0, 0, cur_trans_id, ++ wait_reply); ++} ++ ++int vc_vchi_sm_resize(VC_VCHI_SM_HANDLE_T handle, VC_SM_RESIZE_T *msg, ++ uint32_t *cur_trans_id) ++{ ++ return vc_vchi_sm_send_msg(handle, VC_SM_MSG_TYPE_RESIZE, ++ msg, sizeof(*msg), 0, 0, cur_trans_id, 1); ++} ++ ++int vc_vchi_sm_walk_alloc(VC_VCHI_SM_HANDLE_T handle) ++{ ++ return vc_vchi_sm_send_msg(handle, VC_SM_MSG_TYPE_WALK_ALLOC, ++ 0, 0, 0, 0, 0, 0); ++} ++ ++int vc_vchi_sm_clean_up(VC_VCHI_SM_HANDLE_T handle, VC_SM_ACTION_CLEAN_T *msg) ++{ ++ return vc_vchi_sm_send_msg(handle, VC_SM_MSG_TYPE_ACTION_CLEAN, ++ msg, sizeof(*msg), 0, 0, 0, 0); ++} +diff --git a/drivers/char/broadcom/vc_sm/vc_vchi_sm.h b/drivers/char/broadcom/vc_sm/vc_vchi_sm.h +new file mode 100644 +index 0000000..5e279f5 +--- /dev/null ++++ b/drivers/char/broadcom/vc_sm/vc_vchi_sm.h +@@ -0,0 +1,82 @@ ++/***************************************************************************** ++* Copyright 2011 Broadcom Corporation. All rights reserved. ++* ++* Unless you and Broadcom execute a separate written software license ++* agreement governing use of this software, this software is licensed to you ++* under the terms of the GNU General Public License version 2, available at ++* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). ++* ++* Notwithstanding the above, under no circumstances may you combine this ++* software in any way with any other Broadcom software provided under a ++* license other than the GPL, without Broadcom's express prior written ++* consent. ++*****************************************************************************/ ++ ++#ifndef __VC_VCHI_SM_H__INCLUDED__ ++#define __VC_VCHI_SM_H__INCLUDED__ ++ ++#include "interface/vchi/vchi.h" ++ ++#include "vc_sm_defs.h" ++ ++/* Forward declare. ++*/ ++typedef struct sm_instance *VC_VCHI_SM_HANDLE_T; ++ ++/* Initialize the shared memory service, opens up vchi connection to talk to it. ++*/ ++VC_VCHI_SM_HANDLE_T vc_vchi_sm_init(VCHI_INSTANCE_T vchi_instance, ++ VCHI_CONNECTION_T **vchi_connections, ++ uint32_t num_connections); ++ ++/* Terminates the shared memory service. ++*/ ++int vc_vchi_sm_stop(VC_VCHI_SM_HANDLE_T *handle); ++ ++/* Ask the shared memory service to allocate some memory on videocre and ++** return the result of this allocation (which upon success will be a pointer ++** to some memory in videocore space). ++*/ ++int vc_vchi_sm_alloc(VC_VCHI_SM_HANDLE_T handle, ++ VC_SM_ALLOC_T *alloc, ++ VC_SM_ALLOC_RESULT_T *alloc_result, uint32_t *trans_id); ++ ++/* Ask the shared memory service to free up some memory that was previously ++** allocated by the vc_vchi_sm_alloc function call. ++*/ ++int vc_vchi_sm_free(VC_VCHI_SM_HANDLE_T handle, ++ VC_SM_FREE_T *free, uint32_t *trans_id); ++ ++/* Ask the shared memory service to lock up some memory that was previously ++** allocated by the vc_vchi_sm_alloc function call. ++*/ ++int vc_vchi_sm_lock(VC_VCHI_SM_HANDLE_T handle, ++ VC_SM_LOCK_UNLOCK_T *lock_unlock, ++ VC_SM_LOCK_RESULT_T *lock_result, uint32_t *trans_id); ++ ++/* Ask the shared memory service to unlock some memory that was previously ++** allocated by the vc_vchi_sm_alloc function call. ++*/ ++int vc_vchi_sm_unlock(VC_VCHI_SM_HANDLE_T handle, ++ VC_SM_LOCK_UNLOCK_T *lock_unlock, ++ uint32_t *trans_id, uint8_t wait_reply); ++ ++/* Ask the shared memory service to resize some memory that was previously ++** allocated by the vc_vchi_sm_alloc function call. ++*/ ++int vc_vchi_sm_resize(VC_VCHI_SM_HANDLE_T handle, ++ VC_SM_RESIZE_T *resize, uint32_t *trans_id); ++ ++/* Walk the allocated resources on the videocore side, the allocation will ++** show up in the log. This is purely for debug/information and takes no ++** specific actions. ++*/ ++int vc_vchi_sm_walk_alloc(VC_VCHI_SM_HANDLE_T handle); ++ ++/* Clean up following a previously interrupted action which left the system ++** in a bad state of some sort. ++*/ ++int vc_vchi_sm_clean_up(VC_VCHI_SM_HANDLE_T handle, ++ VC_SM_ACTION_CLEAN_T *action_clean); ++ ++#endif /* __VC_VCHI_SM_H__INCLUDED__ */ +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +new file mode 100644 +index 0000000..1db6716 +--- /dev/null ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -0,0 +1,3213 @@ ++/***************************************************************************** ++* Copyright 2011-2012 Broadcom Corporation. All rights reserved. ++* ++* Unless you and Broadcom execute a separate written software license ++* agreement governing use of this software, this software is licensed to you ++* under the terms of the GNU General Public License version 2, available at ++* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). ++* ++* Notwithstanding the above, under no circumstances may you combine this ++* software in any way with any other Broadcom software provided under a ++* license other than the GPL, without Broadcom's express prior written ++* consent. ++*****************************************************************************/ ++ ++/* ---- Include Files ----------------------------------------------------- */ ++ ++#include <linux/cdev.h> ++#include <linux/broadcom/vc_mem.h> ++#include <linux/device.h> ++#include <linux/debugfs.h> ++#include <linux/dma-mapping.h> ++#include <linux/errno.h> ++#include <linux/fs.h> ++#include <linux/hugetlb.h> ++#include <linux/ioctl.h> ++#include <linux/kernel.h> ++#include <linux/list.h> ++#include <linux/module.h> ++#include <linux/mm.h> ++#include <linux/pfn.h> ++#include <linux/proc_fs.h> ++#include <linux/pagemap.h> ++#include <linux/semaphore.h> ++#include <linux/slab.h> ++#include <linux/seq_file.h> ++#include <linux/types.h> ++#include <asm/cacheflush.h> ++ ++#include "vchiq_connected.h" ++#include "vc_vchi_sm.h" ++ ++#include <linux/broadcom/vmcs_sm_ioctl.h> ++#include "vc_sm_knl.h" ++ ++/* ---- Private Constants and Types --------------------------------------- */ ++ ++#define DEVICE_NAME "vcsm" ++#define DEVICE_MINOR 0 ++ ++#define VC_SM_DIR_ROOT_NAME "vc-smem" ++#define VC_SM_DIR_ALLOC_NAME "alloc" ++#define VC_SM_STATE "state" ++#define VC_SM_STATS "statistics" ++#define VC_SM_RESOURCES "resources" ++#define VC_SM_DEBUG "debug" ++#define VC_SM_WRITE_BUF_SIZE 128 ++ ++/* Statistics tracked per resource and globally. ++*/ ++enum SM_STATS_T { ++ /* Attempt. */ ++ ALLOC, ++ FREE, ++ LOCK, ++ UNLOCK, ++ MAP, ++ FLUSH, ++ INVALID, ++ ++ END_ATTEMPT, ++ ++ /* Failure. */ ++ ALLOC_FAIL, ++ FREE_FAIL, ++ LOCK_FAIL, ++ UNLOCK_FAIL, ++ MAP_FAIL, ++ FLUSH_FAIL, ++ INVALID_FAIL, ++ ++ END_ALL, ++ ++}; ++ ++static const char *const sm_stats_human_read[] = { ++ "Alloc", ++ "Free", ++ "Lock", ++ "Unlock", ++ "Map", ++ "Cache Flush", ++ "Cache Invalidate", ++}; ++ ++typedef int (*VC_SM_SHOW) (struct seq_file *s, void *v); ++struct SM_PDE_T { ++ VC_SM_SHOW show; /* Debug fs function hookup. */ ++ struct dentry *dir_entry; /* Debug fs directory entry. */ ++ void *priv_data; /* Private data */ ++ ++}; ++ ++/* Single resource allocation tracked for all devices. ++*/ ++struct sm_mmap { ++ struct list_head map_list; /* Linked list of maps. */ ++ ++ struct SM_RESOURCE_T *resource; /* Pointer to the resource. */ ++ ++ pid_t res_pid; /* PID owning that resource. */ ++ unsigned int res_vc_hdl; /* Resource handle (videocore). */ ++ unsigned int res_usr_hdl; /* Resource handle (user). */ ++ ++ long unsigned int res_addr; /* Mapped virtual address. */ ++ struct vm_area_struct *vma; /* VM area for this mapping. */ ++ unsigned int ref_count; /* Reference count to this vma. */ ++ ++ /* Used to link maps associated with a resource. */ ++ struct list_head resource_map_list; ++}; ++ ++/* Single resource allocation tracked for each opened device. ++*/ ++struct SM_RESOURCE_T { ++ struct list_head resource_list; /* List of resources. */ ++ struct list_head global_resource_list; /* Global list of resources. */ ++ ++ pid_t pid; /* PID owning that resource. */ ++ uint32_t res_guid; /* Unique identifier. */ ++ uint32_t lock_count; /* Lock count for this resource. */ ++ uint32_t ref_count; /* Ref count for this resource. */ ++ ++ uint32_t res_handle; /* Resource allocation handle. */ ++ void *res_base_mem; /* Resource base memory address. */ ++ uint32_t res_size; /* Resource size allocated. */ ++ enum vmcs_sm_cache_e res_cached; /* Resource cache type. */ ++ struct SM_RESOURCE_T *res_shared; /* Shared resource */ ++ ++ enum SM_STATS_T res_stats[END_ALL]; /* Resource statistics. */ ++ ++ uint8_t map_count; /* Counter of mappings for this resource. */ ++ struct list_head map_list; /* Maps associated with a resource. */ ++ ++ struct SM_PRIV_DATA_T *private; ++}; ++ ++/* Private file data associated with each opened device. ++*/ ++struct SM_PRIV_DATA_T { ++ struct list_head resource_list; /* List of resources. */ ++ ++ pid_t pid; /* PID of creator. */ ++ ++ struct dentry *dir_pid; /* Debug fs entries root. */ ++ struct SM_PDE_T dir_stats; /* Debug fs entries statistics sub-tree. */ ++ struct SM_PDE_T dir_res; /* Debug fs resource sub-tree. */ ++ ++ int restart_sys; /* Tracks restart on interrupt. */ ++ VC_SM_MSG_TYPE int_action; /* Interrupted action. */ ++ uint32_t int_trans_id; /* Interrupted transaction. */ ++ ++}; ++ ++/* Global state information. ++*/ ++struct SM_STATE_T { ++ VC_VCHI_SM_HANDLE_T sm_handle; /* Handle for videocore service. */ ++ struct dentry *dir_root; /* Debug fs entries root. */ ++ struct dentry *dir_alloc; /* Debug fs entries allocations. */ ++ struct SM_PDE_T dir_stats; /* Debug fs entries statistics sub-tree. */ ++ struct SM_PDE_T dir_state; /* Debug fs entries state sub-tree. */ ++ struct dentry *debug; /* Debug fs entries debug. */ ++ ++ struct mutex map_lock; /* Global map lock. */ ++ struct list_head map_list; /* List of maps. */ ++ struct list_head resource_list; /* List of resources. */ ++ ++ enum SM_STATS_T deceased[END_ALL]; /* Natural termination stats. */ ++ enum SM_STATS_T terminated[END_ALL]; /* Forced termination stats. */ ++ uint32_t res_deceased_cnt; /* Natural termination counter. */ ++ uint32_t res_terminated_cnt; /* Forced termination counter. */ ++ ++ struct cdev sm_cdev; /* Device. */ ++ dev_t sm_devid; /* Device identifier. */ ++ struct class *sm_class; /* Class. */ ++ struct device *sm_dev; /* Device. */ ++ ++ struct SM_PRIV_DATA_T *data_knl; /* Kernel internal data tracking. */ ++ ++ struct mutex lock; /* Global lock. */ ++ uint32_t guid; /* GUID (next) tracker. */ ++ ++}; ++ ++/* ---- Private Variables ----------------------------------------------- */ ++ ++static struct SM_STATE_T *sm_state; ++static int sm_inited; ++ ++#if 0 ++static const char *const sm_cache_map_vector[] = { ++ "(null)", ++ "host", ++ "videocore", ++ "host+videocore", ++}; ++#endif ++ ++/* ---- Private Function Prototypes -------------------------------------- */ ++ ++/* ---- Private Functions ------------------------------------------------ */ ++ ++static inline unsigned vcaddr_to_pfn(unsigned long vc_addr) ++{ ++ unsigned long pfn = vc_addr & 0x3FFFFFFF; ++ pfn += mm_vc_mem_phys_addr; ++ pfn >>= PAGE_SHIFT; ++ return pfn; ++} ++ ++/* Carries over to the state statistics the statistics once owned by a deceased ++** resource. ++*/ ++static void vc_sm_resource_deceased(struct SM_RESOURCE_T *p_res, int terminated) ++{ ++ if (sm_state != NULL) { ++ if (p_res != NULL) { ++ int ix; ++ ++ if (terminated) ++ sm_state->res_terminated_cnt++; ++ else ++ sm_state->res_deceased_cnt++; ++ ++ for (ix = 0; ix < END_ALL; ix++) { ++ if (terminated) ++ sm_state->terminated[ix] += ++ p_res->res_stats[ix]; ++ else ++ sm_state->deceased[ix] += ++ p_res->res_stats[ix]; ++ } ++ } ++ } ++} ++ ++/* Fetch a videocore handle corresponding to a mapping of the pid+address ++** returns 0 (ie NULL) if no such handle exists in the global map. ++*/ ++static unsigned int vmcs_sm_vc_handle_from_pid_and_address(unsigned int pid, ++ unsigned int addr) ++{ ++ struct sm_mmap *map = NULL; ++ unsigned int handle = 0; ++ ++ if (!sm_state || addr == 0) ++ goto out; ++ ++ mutex_lock(&(sm_state->map_lock)); ++ ++ /* Lookup the resource. ++ */ ++ if (!list_empty(&sm_state->map_list)) { ++ list_for_each_entry(map, &sm_state->map_list, map_list) { ++ if (map->res_pid != pid || map->res_addr != addr) ++ continue; ++ ++ pr_debug("[%s]: global map %p (pid %u, addr %lx) -> vc-hdl %x (usr-hdl %x)\n", ++ __func__, map, map->res_pid, map->res_addr, ++ map->res_vc_hdl, map->res_usr_hdl); ++ ++ handle = map->res_vc_hdl; ++ break; ++ } ++ } ++ ++ mutex_unlock(&(sm_state->map_lock)); ++ ++out: ++ /* Use a debug log here as it may be a valid situation that we query ++ ** for something that is not mapped, we do not want a kernel log each ++ ** time around. ++ ** ++ ** There are other error log that would pop up accordingly if someone ++ ** subsequently tries to use something invalid after being told not to ++ ** use it... ++ */ ++ if (handle == 0) { ++ pr_debug("[%s]: not a valid map (pid %u, addr %x)\n", ++ __func__, pid, addr); ++ } ++ ++ return handle; ++} ++ ++/* Fetch a user handle corresponding to a mapping of the pid+address ++** returns 0 (ie NULL) if no such handle exists in the global map. ++*/ ++static unsigned int vmcs_sm_usr_handle_from_pid_and_address(unsigned int pid, ++ unsigned int addr) ++{ ++ struct sm_mmap *map = NULL; ++ unsigned int handle = 0; ++ ++ if (!sm_state || addr == 0) ++ goto out; ++ ++ mutex_lock(&(sm_state->map_lock)); ++ ++ /* Lookup the resource. ++ */ ++ if (!list_empty(&sm_state->map_list)) { ++ list_for_each_entry(map, &sm_state->map_list, map_list) { ++ if (map->res_pid != pid || map->res_addr != addr) ++ continue; ++ ++ pr_debug("[%s]: global map %p (pid %u, addr %lx) -> usr-hdl %x (vc-hdl %x)\n", ++ __func__, map, map->res_pid, map->res_addr, ++ map->res_usr_hdl, map->res_vc_hdl); ++ ++ handle = map->res_usr_hdl; ++ break; ++ } ++ } ++ ++ mutex_unlock(&(sm_state->map_lock)); ++ ++out: ++ /* Use a debug log here as it may be a valid situation that we query ++ * for something that is not mapped yet. ++ * ++ * There are other error log that would pop up accordingly if someone ++ * subsequently tries to use something invalid after being told not to ++ * use it... ++ */ ++ if (handle == 0) ++ pr_debug("[%s]: not a valid map (pid %u, addr %x)\n", ++ __func__, pid, addr); ++ ++ return handle; ++} ++ ++#if defined(DO_NOT_USE) ++/* Fetch an address corresponding to a mapping of the pid+handle ++** returns 0 (ie NULL) if no such address exists in the global map. ++*/ ++static unsigned int vmcs_sm_usr_address_from_pid_and_vc_handle(unsigned int pid, ++ unsigned int hdl) ++{ ++ struct sm_mmap *map = NULL; ++ unsigned int addr = 0; ++ ++ if (sm_state == NULL || hdl == 0) ++ goto out; ++ ++ mutex_lock(&(sm_state->map_lock)); ++ ++ /* Lookup the resource. ++ */ ++ if (!list_empty(&sm_state->map_list)) { ++ list_for_each_entry(map, &sm_state->map_list, map_list) { ++ if (map->res_pid != pid || map->res_vc_hdl != hdl) ++ continue; ++ ++ pr_debug("[%s]: global map %p (pid %u, vc-hdl %x, usr-hdl %x) -> addr %lx\n", ++ __func__, map, map->res_pid, map->res_vc_hdl, ++ map->res_usr_hdl, map->res_addr); ++ ++ addr = map->res_addr; ++ break; ++ } ++ } ++ ++ mutex_unlock(&(sm_state->map_lock)); ++ ++out: ++ /* Use a debug log here as it may be a valid situation that we query ++ ** for something that is not mapped, we do not want a kernel log each ++ ** time around. ++ ** ++ ** There are other error log that would pop up accordingly if someone ++ ** subsequently tries to use something invalid after being told not to ++ ** use it... ++ */ ++ if (addr == 0) ++ pr_debug("[%s]: not a valid map (pid %u, hdl %x)\n", ++ __func__, pid, hdl); ++ ++ return addr; ++} ++#endif ++ ++/* Fetch an address corresponding to a mapping of the pid+handle ++** returns 0 (ie NULL) if no such address exists in the global map. ++*/ ++static unsigned int vmcs_sm_usr_address_from_pid_and_usr_handle(unsigned int ++ pid, ++ unsigned int ++ hdl) ++{ ++ struct sm_mmap *map = NULL; ++ unsigned int addr = 0; ++ ++ if (sm_state == NULL || hdl == 0) ++ goto out; ++ ++ mutex_lock(&(sm_state->map_lock)); ++ ++ /* Lookup the resource. ++ */ ++ if (!list_empty(&sm_state->map_list)) { ++ list_for_each_entry(map, &sm_state->map_list, map_list) { ++ if (map->res_pid != pid || map->res_usr_hdl != hdl) ++ continue; ++ ++ pr_debug("[%s]: global map %p (pid %u, vc-hdl %x, usr-hdl %x) -> addr %lx\n", ++ __func__, map, map->res_pid, map->res_vc_hdl, ++ map->res_usr_hdl, map->res_addr); ++ ++ addr = map->res_addr; ++ break; ++ } ++ } ++ ++ mutex_unlock(&(sm_state->map_lock)); ++ ++out: ++ /* Use a debug log here as it may be a valid situation that we query ++ * for something that is not mapped, we do not want a kernel log each ++ * time around. ++ * ++ * There are other error log that would pop up accordingly if someone ++ * subsequently tries to use something invalid after being told not to ++ * use it... ++ */ ++ if (addr == 0) ++ pr_debug("[%s]: not a valid map (pid %u, hdl %x)\n", __func__, ++ pid, hdl); ++ ++ return addr; ++} ++ ++/* Adds a resource mapping to the global data list. ++*/ ++static void vmcs_sm_add_map(struct SM_STATE_T *state, ++ struct SM_RESOURCE_T *resource, struct sm_mmap *map) ++{ ++ mutex_lock(&(state->map_lock)); ++ ++ /* Add to the global list of mappings ++ */ ++ list_add(&map->map_list, &state->map_list); ++ ++ /* Add to the list of mappings for this resource ++ */ ++ list_add(&map->resource_map_list, &resource->map_list); ++ resource->map_count++; ++ ++ mutex_unlock(&(state->map_lock)); ++ ++ pr_debug("[%s]: added map %p (pid %u, vc-hdl %x, usr-hdl %x, addr %lx)\n", ++ __func__, map, map->res_pid, map->res_vc_hdl, ++ map->res_usr_hdl, map->res_addr); ++} ++ ++/* Removes a resource mapping from the global data list. ++*/ ++static void vmcs_sm_remove_map(struct SM_STATE_T *state, ++ struct SM_RESOURCE_T *resource, ++ struct sm_mmap *map) ++{ ++ mutex_lock(&(state->map_lock)); ++ ++ /* Remove from the global list of mappings ++ */ ++ list_del(&map->map_list); ++ ++ /* Remove from the list of mapping for this resource ++ */ ++ list_del(&map->resource_map_list); ++ if (resource->map_count > 0) ++ resource->map_count--; ++ ++ mutex_unlock(&(state->map_lock)); ++ ++ pr_debug("[%s]: removed map %p (pid %d, vc-hdl %x, usr-hdl %x, addr %lx)\n", ++ __func__, map, map->res_pid, map->res_vc_hdl, map->res_usr_hdl, ++ map->res_addr); ++ ++ kfree(map); ++} ++ ++/* Read callback for the global state proc entry. ++*/ ++static int vc_sm_global_state_show(struct seq_file *s, void *v) ++{ ++ struct sm_mmap *map = NULL; ++ int map_count = 0; ++ ++ if (sm_state == NULL) ++ return 0; ++ ++ seq_printf(s, "\nVC-ServiceHandle 0x%x\n", ++ (unsigned int)sm_state->sm_handle); ++ ++ /* Log all applicable mapping(s). ++ */ ++ ++ mutex_lock(&(sm_state->map_lock)); ++ ++ if (!list_empty(&sm_state->map_list)) { ++ list_for_each_entry(map, &sm_state->map_list, map_list) { ++ map_count++; ++ ++ seq_printf(s, "\nMapping 0x%x\n", ++ (unsigned int)map); ++ seq_printf(s, " TGID %u\n", ++ map->res_pid); ++ seq_printf(s, " VC-HDL 0x%x\n", ++ map->res_vc_hdl); ++ seq_printf(s, " USR-HDL 0x%x\n", ++ map->res_usr_hdl); ++ seq_printf(s, " USR-ADDR 0x%lx\n", ++ map->res_addr); ++ } ++ } ++ ++ mutex_unlock(&(sm_state->map_lock)); ++ seq_printf(s, "\n\nTotal map count: %d\n\n", map_count); ++ ++ return 0; ++} ++ ++static int vc_sm_global_statistics_show(struct seq_file *s, void *v) ++{ ++ int ix; ++ ++ /* Global state tracked statistics. ++ */ ++ if (sm_state != NULL) { ++ seq_puts(s, "\nDeceased Resources Statistics\n"); ++ ++ seq_printf(s, "\nNatural Cause (%u occurences)\n", ++ sm_state->res_deceased_cnt); ++ for (ix = 0; ix < END_ATTEMPT; ix++) { ++ if (sm_state->deceased[ix] > 0) { ++ seq_printf(s, " %u\t%s\n", ++ sm_state->deceased[ix], ++ sm_stats_human_read[ix]); ++ } ++ } ++ seq_puts(s, "\n"); ++ for (ix = 0; ix < END_ATTEMPT; ix++) { ++ if (sm_state->deceased[ix + END_ATTEMPT] > 0) { ++ seq_printf(s, " %u\tFAILED %s\n", ++ sm_state->deceased[ix + END_ATTEMPT], ++ sm_stats_human_read[ix]); ++ } ++ } ++ ++ seq_printf(s, "\nForcefull (%u occurences)\n", ++ sm_state->res_terminated_cnt); ++ for (ix = 0; ix < END_ATTEMPT; ix++) { ++ if (sm_state->terminated[ix] > 0) { ++ seq_printf(s, " %u\t%s\n", ++ sm_state->terminated[ix], ++ sm_stats_human_read[ix]); ++ } ++ } ++ seq_puts(s, "\n"); ++ for (ix = 0; ix < END_ATTEMPT; ix++) { ++ if (sm_state->terminated[ix + END_ATTEMPT] > 0) { ++ seq_printf(s, " %u\tFAILED %s\n", ++ sm_state->terminated[ix + ++ END_ATTEMPT], ++ sm_stats_human_read[ix]); ++ } ++ } ++ } ++ ++ return 0; ++} ++ ++#if 0 ++/* Read callback for the statistics proc entry. ++*/ ++static int vc_sm_statistics_show(struct seq_file *s, void *v) ++{ ++ int ix; ++ struct SM_PRIV_DATA_T *file_data; ++ struct SM_RESOURCE_T *resource; ++ int res_count = 0; ++ struct SM_PDE_T *p_pde; ++ ++ p_pde = (struct SM_PDE_T *)(s->private); ++ file_data = (struct SM_PRIV_DATA_T *)(p_pde->priv_data); ++ ++ if (file_data == NULL) ++ return 0; ++ ++ /* Per process statistics. ++ */ ++ ++ seq_printf(s, "\nStatistics for TGID %d\n", file_data->pid); ++ ++ mutex_lock(&(sm_state->map_lock)); ++ ++ if (!list_empty(&file_data->resource_list)) { ++ list_for_each_entry(resource, &file_data->resource_list, ++ resource_list) { ++ res_count++; ++ ++ seq_printf(s, "\nGUID: 0x%x\n\n", ++ resource->res_guid); ++ for (ix = 0; ix < END_ATTEMPT; ix++) { ++ if (resource->res_stats[ix] > 0) { ++ seq_printf(s, ++ " %u\t%s\n", ++ resource->res_stats[ix], ++ sm_stats_human_read[ix]); ++ } ++ } ++ seq_puts(s, "\n"); ++ for (ix = 0; ix < END_ATTEMPT; ix++) { ++ if (resource->res_stats[ix + END_ATTEMPT] > 0) { ++ seq_printf(s, ++ " %u\tFAILED %s\n", ++ resource->res_stats[ ++ ix + END_ATTEMPT], ++ sm_stats_human_read[ix]); ++ } ++ } ++ } ++ } ++ ++ mutex_unlock(&(sm_state->map_lock)); ++ ++ seq_printf(s, "\nResources Count %d\n", res_count); ++ ++ return 0; ++} ++#endif ++ ++#if 0 ++/* Read callback for the allocation proc entry. */ ++static int vc_sm_alloc_show(struct seq_file *s, void *v) ++{ ++ struct SM_PRIV_DATA_T *file_data; ++ struct SM_RESOURCE_T *resource; ++ int alloc_count = 0; ++ struct SM_PDE_T *p_pde; ++ ++ p_pde = (struct SM_PDE_T *)(s->private); ++ file_data = (struct SM_PRIV_DATA_T *)(p_pde->priv_data); ++ ++ if (!file_data) ++ return 0; ++ ++ /* Per process statistics. */ ++ seq_printf(s, "\nAllocation for TGID %d\n", file_data->pid); ++ ++ mutex_lock(&(sm_state->map_lock)); ++ ++ if (!list_empty(&file_data->resource_list)) { ++ list_for_each_entry(resource, &file_data->resource_list, ++ resource_list) { ++ alloc_count++; ++ ++ seq_printf(s, "\nGUID: 0x%x\n", ++ resource->res_guid); ++ seq_printf(s, "Lock Count: %u\n", ++ resource->lock_count); ++ seq_printf(s, "Mapped: %s\n", ++ (resource->map_count ? "yes" : "no")); ++ seq_printf(s, "VC-handle: 0x%x\n", ++ resource->res_handle); ++ seq_printf(s, "VC-address: 0x%p\n", ++ resource->res_base_mem); ++ seq_printf(s, "VC-size (bytes): %u\n", ++ resource->res_size); ++ seq_printf(s, "Cache: %s\n", ++ sm_cache_map_vector[resource->res_cached]); ++ } ++ } ++ ++ mutex_unlock(&(sm_state->map_lock)); ++ ++ seq_printf(s, "\n\nTotal allocation count: %d\n\n", alloc_count); ++ ++ return 0; ++} ++#endif ++ ++static int vc_sm_seq_file_show(struct seq_file *s, void *v) ++{ ++ struct SM_PDE_T *sm_pde; ++ ++ sm_pde = (struct SM_PDE_T *)(s->private); ++ ++ if (sm_pde && sm_pde->show) ++ sm_pde->show(s, v); ++ ++ return 0; ++} ++ ++static int vc_sm_single_open(struct inode *inode, struct file *file) ++{ ++ return single_open(file, vc_sm_seq_file_show, inode->i_private); ++} ++ ++static const struct file_operations vc_sm_debug_fs_fops = { ++ .open = vc_sm_single_open, ++ .read = seq_read, ++ .llseek = seq_lseek, ++ .release = single_release, ++}; ++ ++/* Adds a resource to the private data list which tracks all the allocated ++** data. ++*/ ++static void vmcs_sm_add_resource(struct SM_PRIV_DATA_T *privdata, ++ struct SM_RESOURCE_T *resource) ++{ ++ mutex_lock(&(sm_state->map_lock)); ++ list_add(&resource->resource_list, &privdata->resource_list); ++ list_add(&resource->global_resource_list, &sm_state->resource_list); ++ mutex_unlock(&(sm_state->map_lock)); ++ ++ pr_debug("[%s]: added resource %p (base addr %p, hdl %x, size %u, cache %u)\n", ++ __func__, resource, resource->res_base_mem, ++ resource->res_handle, resource->res_size, resource->res_cached); ++} ++ ++/* Locates a resource and acquire a reference on it. ++** The resource won't be deleted while there is a reference on it. ++*/ ++static struct SM_RESOURCE_T *vmcs_sm_acquire_resource(struct SM_PRIV_DATA_T ++ *private, ++ unsigned int res_guid) ++{ ++ struct SM_RESOURCE_T *resource, *ret = NULL; ++ ++ mutex_lock(&(sm_state->map_lock)); ++ ++ list_for_each_entry(resource, &private->resource_list, resource_list) { ++ if (resource->res_guid != res_guid) ++ continue; ++ ++ pr_debug("[%s]: located resource %p (guid: %x, base addr %p, hdl %x, size %u, cache %u)\n", ++ __func__, resource, resource->res_guid, ++ resource->res_base_mem, resource->res_handle, ++ resource->res_size, resource->res_cached); ++ resource->ref_count++; ++ ret = resource; ++ break; ++ } ++ ++ mutex_unlock(&(sm_state->map_lock)); ++ ++ return ret; ++} ++ ++/* Locates a resource and acquire a reference on it. ++** The resource won't be deleted while there is a reference on it. ++*/ ++static struct SM_RESOURCE_T *vmcs_sm_acquire_first_resource( ++ struct SM_PRIV_DATA_T *private) ++{ ++ struct SM_RESOURCE_T *resource, *ret = NULL; ++ ++ mutex_lock(&(sm_state->map_lock)); ++ ++ list_for_each_entry(resource, &private->resource_list, resource_list) { ++ pr_debug("[%s]: located resource %p (guid: %x, base addr %p, hdl %x, size %u, cache %u)\n", ++ __func__, resource, resource->res_guid, ++ resource->res_base_mem, resource->res_handle, ++ resource->res_size, resource->res_cached); ++ resource->ref_count++; ++ ret = resource; ++ break; ++ } ++ ++ mutex_unlock(&(sm_state->map_lock)); ++ ++ return ret; ++} ++ ++/* Locates a resource and acquire a reference on it. ++** The resource won't be deleted while there is a reference on it. ++*/ ++static struct SM_RESOURCE_T *vmcs_sm_acquire_global_resource(unsigned int ++ res_guid) ++{ ++ struct SM_RESOURCE_T *resource, *ret = NULL; ++ ++ mutex_lock(&(sm_state->map_lock)); ++ ++ list_for_each_entry(resource, &sm_state->resource_list, ++ global_resource_list) { ++ if (resource->res_guid != res_guid) ++ continue; ++ ++ pr_debug("[%s]: located resource %p (guid: %x, base addr %p, hdl %x, size %u, cache %u)\n", ++ __func__, resource, resource->res_guid, ++ resource->res_base_mem, resource->res_handle, ++ resource->res_size, resource->res_cached); ++ resource->ref_count++; ++ ret = resource; ++ break; ++ } ++ ++ mutex_unlock(&(sm_state->map_lock)); ++ ++ return ret; ++} ++ ++/* Release a previously acquired resource. ++** The resource will be deleted when its refcount reaches 0. ++*/ ++static void vmcs_sm_release_resource(struct SM_RESOURCE_T *resource, int force) ++{ ++ struct SM_PRIV_DATA_T *private = resource->private; ++ struct sm_mmap *map, *map_tmp; ++ struct SM_RESOURCE_T *res_tmp; ++ int ret; ++ ++ mutex_lock(&(sm_state->map_lock)); ++ ++ if (--resource->ref_count) { ++ if (force) ++ pr_err("[%s]: resource %p in use\n", __func__, resource); ++ ++ mutex_unlock(&(sm_state->map_lock)); ++ return; ++ } ++ ++ /* Time to free the resource. Start by removing it from the list */ ++ list_del(&resource->resource_list); ++ list_del(&resource->global_resource_list); ++ ++ /* Walk the global resource list, find out if the resource is used ++ * somewhere else. In which case we don't want to delete it. ++ */ ++ list_for_each_entry(res_tmp, &sm_state->resource_list, ++ global_resource_list) { ++ if (res_tmp->res_handle == resource->res_handle) { ++ resource->res_handle = 0; ++ break; ++ } ++ } ++ ++ mutex_unlock(&(sm_state->map_lock)); ++ ++ pr_debug("[%s]: freeing data - guid %x, hdl %x, base address %p\n", ++ __func__, resource->res_guid, resource->res_handle, ++ resource->res_base_mem); ++ resource->res_stats[FREE]++; ++ ++ /* Make sure the resource we're removing is unmapped first */ ++ if (resource->map_count && !list_empty(&resource->map_list)) { ++ down_write(&current->mm->mmap_sem); ++ list_for_each_entry_safe(map, map_tmp, &resource->map_list, ++ resource_map_list) { ++ ret = ++ do_munmap(current->mm, map->res_addr, ++ resource->res_size); ++ if (ret) { ++ pr_err("[%s]: could not unmap resource %p\n", ++ __func__, resource); ++ } ++ } ++ up_write(&current->mm->mmap_sem); ++ } ++ ++ /* Free up the videocore allocated resource. ++ */ ++ if (resource->res_handle) { ++ VC_SM_FREE_T free = { ++ resource->res_handle, resource->res_base_mem ++ }; ++ int status = vc_vchi_sm_free(sm_state->sm_handle, &free, ++ &private->int_trans_id); ++ if (status != 0 && status != -EINTR) { ++ pr_err("[%s]: failed to free memory on videocore (status: %u, trans_id: %u)\n", ++ __func__, status, private->int_trans_id); ++ resource->res_stats[FREE_FAIL]++; ++ ret = -EPERM; ++ } ++ } ++ ++ /* Free up the shared resource. ++ */ ++ if (resource->res_shared) ++ vmcs_sm_release_resource(resource->res_shared, 0); ++ ++ /* Free up the local resource tracking this allocation. ++ */ ++ vc_sm_resource_deceased(resource, force); ++ kfree(resource); ++} ++ ++/* Dump the map table for the driver. If process is -1, dumps the whole table, ++** if process is a valid pid (non -1) dump only the entries associated with the ++** pid of interest. ++*/ ++static void vmcs_sm_host_walk_map_per_pid(int pid) ++{ ++ struct sm_mmap *map = NULL; ++ ++ /* Make sure the device was started properly. ++ */ ++ if (sm_state == NULL) { ++ pr_err("[%s]: invalid device\n", __func__); ++ return; ++ } ++ ++ mutex_lock(&(sm_state->map_lock)); ++ ++ /* Log all applicable mapping(s). ++ */ ++ if (!list_empty(&sm_state->map_list)) { ++ list_for_each_entry(map, &sm_state->map_list, map_list) { ++ if (pid == -1 || map->res_pid == pid) { ++ pr_info("[%s]: tgid: %u - vc-hdl: %x, usr-hdl: %x, usr-addr: %lx\n", ++ __func__, map->res_pid, map->res_vc_hdl, ++ map->res_usr_hdl, map->res_addr); ++ } ++ } ++ } ++ ++ mutex_unlock(&(sm_state->map_lock)); ++ ++ return; ++} ++ ++/* Dump the allocation table from host side point of view. This only dumps the ++** data allocated for this process/device referenced by the file_data. ++*/ ++static void vmcs_sm_host_walk_alloc(struct SM_PRIV_DATA_T *file_data) ++{ ++ struct SM_RESOURCE_T *resource = NULL; ++ ++ /* Make sure the device was started properly. ++ */ ++ if ((sm_state == NULL) || (file_data == NULL)) { ++ pr_err("[%s]: invalid device\n", __func__); ++ return; ++ } ++ ++ mutex_lock(&(sm_state->map_lock)); ++ ++ if (!list_empty(&file_data->resource_list)) { ++ list_for_each_entry(resource, &file_data->resource_list, ++ resource_list) { ++ pr_info("[%s]: guid: %x - hdl: %x, vc-mem: %p, size: %u, cache: %u\n", ++ __func__, resource->res_guid, resource->res_handle, ++ resource->res_base_mem, resource->res_size, ++ resource->res_cached); ++ } ++ } ++ ++ mutex_unlock(&(sm_state->map_lock)); ++ ++ return; ++} ++ ++/* Create support for private data tracking. ++*/ ++static struct SM_PRIV_DATA_T *vc_sm_create_priv_data(pid_t id) ++{ ++ char alloc_name[32]; ++ struct SM_PRIV_DATA_T *file_data = NULL; ++ ++ /* Allocate private structure. */ ++ file_data = kzalloc(sizeof(*file_data), GFP_KERNEL); ++ ++ if (!file_data) { ++ pr_err("[%s]: cannot allocate file data\n", __func__); ++ goto out; ++ } ++ ++ snprintf(alloc_name, sizeof(alloc_name), "%d", id); ++ ++ INIT_LIST_HEAD(&file_data->resource_list); ++ file_data->pid = id; ++ file_data->dir_pid = debugfs_create_dir(alloc_name, ++ sm_state->dir_alloc); ++#if 0 ++ /* TODO: fix this to support querying statistics per pid */ ++ ++ if (IS_ERR_OR_NULL(file_data->dir_pid)) { ++ file_data->dir_pid = NULL; ++ } else { ++ struct dentry *dir_entry; ++ ++ dir_entry = debugfs_create_file(VC_SM_RESOURCES, S_IRUGO, ++ file_data->dir_pid, file_data, ++ vc_sm_debug_fs_fops); ++ ++ file_data->dir_res.dir_entry = dir_entry; ++ file_data->dir_res.priv_data = file_data; ++ file_data->dir_res.show = &vc_sm_alloc_show; ++ ++ dir_entry = debugfs_create_file(VC_SM_STATS, S_IRUGO, ++ file_data->dir_pid, file_data, ++ vc_sm_debug_fs_fops); ++ ++ file_data->dir_res.dir_entry = dir_entry; ++ file_data->dir_res.priv_data = file_data; ++ file_data->dir_res.show = &vc_sm_statistics_show; ++ } ++ pr_debug("[%s]: private data allocated %p\n", __func__, file_data); ++ ++#endif ++out: ++ return file_data; ++} ++ ++/* Open the device. Creates a private state to help track all allocation ++** associated with this device. ++*/ ++static int vc_sm_open(struct inode *inode, struct file *file) ++{ ++ int ret = 0; ++ ++ /* Make sure the device was started properly. ++ */ ++ if (!sm_state) { ++ pr_err("[%s]: invalid device\n", __func__); ++ ret = -EPERM; ++ goto out; ++ } ++ ++ file->private_data = vc_sm_create_priv_data(current->tgid); ++ if (file->private_data == NULL) { ++ pr_err("[%s]: failed to create data tracker\n", __func__); ++ ++ ret = -ENOMEM; ++ goto out; ++ } ++ ++out: ++ return ret; ++} ++ ++/* Close the device. Free up all resources still associated with this device ++** at the time. ++*/ ++static int vc_sm_release(struct inode *inode, struct file *file) ++{ ++ struct SM_PRIV_DATA_T *file_data = ++ (struct SM_PRIV_DATA_T *)file->private_data; ++ struct SM_RESOURCE_T *resource; ++ int ret = 0; ++ ++ /* Make sure the device was started properly. ++ */ ++ if (sm_state == NULL || file_data == NULL) { ++ pr_err("[%s]: invalid device\n", __func__); ++ ret = -EPERM; ++ goto out; ++ } ++ ++ pr_debug("[%s]: using private data %p\n", __func__, file_data); ++ ++ if (file_data->restart_sys == -EINTR) { ++ VC_SM_ACTION_CLEAN_T action_clean; ++ ++ pr_debug("[%s]: releasing following EINTR on %u (trans_id: %u) (likely due to signal)...\n", ++ __func__, file_data->int_action, ++ file_data->int_trans_id); ++ ++ action_clean.res_action = file_data->int_action; ++ action_clean.action_trans_id = file_data->int_trans_id; ++ ++ vc_vchi_sm_clean_up(sm_state->sm_handle, &action_clean); ++ } ++ ++ while ((resource = vmcs_sm_acquire_first_resource(file_data)) != NULL) { ++ vmcs_sm_release_resource(resource, 0); ++ vmcs_sm_release_resource(resource, 1); ++ } ++ ++ /* Remove the corresponding proc entry. */ ++ debugfs_remove_recursive(file_data->dir_pid); ++ ++ /* Terminate the private data. ++ */ ++ kfree(file_data); ++ ++out: ++ return ret; ++} ++ ++static void vcsm_vma_open(struct vm_area_struct *vma) ++{ ++ struct sm_mmap *map = (struct sm_mmap *)vma->vm_private_data; ++ ++ pr_debug("[%s]: virt %lx-%lx, pid %i, pfn %i\n", ++ __func__, vma->vm_start, vma->vm_end, (int)current->tgid, ++ (int)vma->vm_pgoff); ++ ++ map->ref_count++; ++} ++ ++static void vcsm_vma_close(struct vm_area_struct *vma) ++{ ++ struct sm_mmap *map = (struct sm_mmap *)vma->vm_private_data; ++ ++ pr_debug("[%s]: virt %lx-%lx, pid %i, pfn %i\n", ++ __func__, vma->vm_start, vma->vm_end, (int)current->tgid, ++ (int)vma->vm_pgoff); ++ ++ map->ref_count--; ++ ++ /* Remove from the map table. ++ */ ++ if (map->ref_count == 0) ++ vmcs_sm_remove_map(sm_state, map->resource, map); ++} ++ ++static int vcsm_vma_fault(struct vm_area_struct *vma, struct vm_fault *vmf) ++{ ++ struct sm_mmap *map = (struct sm_mmap *)vma->vm_private_data; ++ struct SM_RESOURCE_T *resource = map->resource; ++ pgoff_t page_offset; ++ unsigned long pfn; ++ int ret = 0; ++ ++ /* Lock the resource if necessary. ++ */ ++ if (!resource->lock_count) { ++ VC_SM_LOCK_UNLOCK_T lock_unlock; ++ VC_SM_LOCK_RESULT_T lock_result; ++ int status; ++ ++ lock_unlock.res_handle = resource->res_handle; ++ lock_unlock.res_mem = resource->res_base_mem; ++ ++ pr_debug("[%s]: attempt to lock data - hdl %x, base address %p\n", ++ __func__, lock_unlock.res_handle, lock_unlock.res_mem); ++ ++ /* Lock the videocore allocated resource. ++ */ ++ status = vc_vchi_sm_lock(sm_state->sm_handle, ++ &lock_unlock, &lock_result, 0); ++ if ((status != 0) || ++ ((status == 0) && (lock_result.res_mem == NULL))) { ++ pr_err("[%s]: failed to lock memory on videocore (status: %u)\n", ++ __func__, status); ++ resource->res_stats[LOCK_FAIL]++; ++ return VM_FAULT_SIGBUS; ++ } ++ ++ pfn = vcaddr_to_pfn((unsigned long)resource->res_base_mem); ++ outer_inv_range(__pfn_to_phys(pfn), ++ __pfn_to_phys(pfn) + resource->res_size); ++ ++ resource->res_stats[LOCK]++; ++ resource->lock_count++; ++ ++ /* Keep track of the new base memory. ++ */ ++ if ((lock_result.res_mem != NULL) && ++ (lock_result.res_old_mem != NULL) && ++ (lock_result.res_mem != lock_result.res_old_mem)) { ++ resource->res_base_mem = lock_result.res_mem; ++ } ++ } ++ ++ /* We don't use vmf->pgoff since that has the fake offset */ ++ page_offset = ((unsigned long)vmf->virtual_address - vma->vm_start); ++ pfn = (uint32_t)resource->res_base_mem & 0x3FFFFFFF; ++ pfn += mm_vc_mem_phys_addr; ++ pfn += page_offset; ++ pfn >>= PAGE_SHIFT; ++ ++ /* Finally, remap it */ ++ ret = vm_insert_pfn(vma, (unsigned long)vmf->virtual_address, pfn); ++ ++ switch (ret) { ++ case 0: ++ case -ERESTARTSYS: ++ return VM_FAULT_NOPAGE; ++ case -ENOMEM: ++ case -EAGAIN: ++ return VM_FAULT_OOM; ++ default: ++ return VM_FAULT_SIGBUS; ++ } ++} ++ ++static struct vm_operations_struct vcsm_vm_ops = { ++ .open = vcsm_vma_open, ++ .close = vcsm_vma_close, ++ .fault = vcsm_vma_fault, ++}; ++ ++/* Walks a VMA and clean each valid page from the cache */ ++static void vcsm_vma_cache_clean_page_range(unsigned long addr, ++ unsigned long end) ++{ ++ pgd_t *pgd; ++ pud_t *pud; ++ pmd_t *pmd; ++ pte_t *pte; ++ unsigned long pgd_next, pud_next, pmd_next; ++ ++ if (addr >= end) ++ return; ++ ++ /* Walk PGD */ ++ pgd = pgd_offset(current->mm, addr); ++ do { ++ pgd_next = pgd_addr_end(addr, end); ++ ++ if (pgd_none(*pgd) || pgd_bad(*pgd)) ++ continue; ++ ++ /* Walk PUD */ ++ pud = pud_offset(pgd, addr); ++ do { ++ pud_next = pud_addr_end(addr, pgd_next); ++ if (pud_none(*pud) || pud_bad(*pud)) ++ continue; ++ ++ /* Walk PMD */ ++ pmd = pmd_offset(pud, addr); ++ do { ++ pmd_next = pmd_addr_end(addr, pud_next); ++ if (pmd_none(*pmd) || pmd_bad(*pmd)) ++ continue; ++ ++ /* Walk PTE */ ++ pte = pte_offset_map(pmd, addr); ++ do { ++ if (pte_none(*pte) ++ || !pte_present(*pte)) ++ continue; ++ ++ /* Clean + invalidate */ ++ dmac_flush_range((const void *) addr, ++ (const void *) ++ (addr + PAGE_SIZE)); ++ ++ } while (pte++, addr += ++ PAGE_SIZE, addr != pmd_next); ++ pte_unmap(pte); ++ ++ } while (pmd++, addr = pmd_next, addr != pud_next); ++ ++ } while (pud++, addr = pud_next, addr != pgd_next); ++ } while (pgd++, addr = pgd_next, addr != end); ++} ++ ++/* Map an allocated data into something that the user space. ++*/ ++static int vc_sm_mmap(struct file *file, struct vm_area_struct *vma) ++{ ++ int ret = 0; ++ struct SM_PRIV_DATA_T *file_data = ++ (struct SM_PRIV_DATA_T *)file->private_data; ++ struct SM_RESOURCE_T *resource = NULL; ++ struct sm_mmap *map = NULL; ++ ++ /* Make sure the device was started properly. ++ */ ++ if ((sm_state == NULL) || (file_data == NULL)) { ++ pr_err("[%s]: invalid device\n", __func__); ++ return -EPERM; ++ } ++ ++ pr_debug("[%s]: private data %p, guid %x\n", __func__, file_data, ++ ((unsigned int)vma->vm_pgoff << PAGE_SHIFT)); ++ ++ /* We lookup to make sure that the data we are being asked to mmap is ++ ** something that we allocated. ++ ** ++ ** We use the offset information as the key to tell us which resource ++ ** we are mapping. ++ */ ++ resource = vmcs_sm_acquire_resource(file_data, ++ ((unsigned int)vma->vm_pgoff << ++ PAGE_SHIFT)); ++ if (resource == NULL) { ++ pr_err("[%s]: failed to locate resource for guid %x\n", __func__, ++ ((unsigned int)vma->vm_pgoff << PAGE_SHIFT)); ++ return -ENOMEM; ++ } ++ ++ pr_debug("[%s]: guid %x, tgid %u, %u, %u\n", ++ __func__, resource->res_guid, current->tgid, resource->pid, ++ file_data->pid); ++ ++ /* Check permissions. ++ */ ++ if (resource->pid && (resource->pid != current->tgid)) { ++ pr_err("[%s]: current tgid %u != %u owner\n", ++ __func__, current->tgid, resource->pid); ++ ret = -EPERM; ++ goto error; ++ } ++ ++ /* Verify that what we are asked to mmap is proper. ++ */ ++ if (resource->res_size != (unsigned int)(vma->vm_end - vma->vm_start)) { ++ pr_err("[%s]: size inconsistency (resource: %u - mmap: %u)\n", ++ __func__, ++ resource->res_size, ++ (unsigned int)(vma->vm_end - vma->vm_start)); ++ ++ ret = -EINVAL; ++ goto error; ++ } ++ ++ /* Keep track of the tuple in the global resource list such that one ++ * can do a mapping lookup for address/memory handle. ++ */ ++ map = kzalloc(sizeof(*map), GFP_KERNEL); ++ if (map == NULL) { ++ pr_err("[%s]: failed to allocate global tracking resource\n", ++ __func__); ++ ret = -ENOMEM; ++ goto error; ++ } ++ ++ map->res_pid = current->tgid; ++ map->res_vc_hdl = resource->res_handle; ++ map->res_usr_hdl = resource->res_guid; ++ map->res_addr = (long unsigned int)vma->vm_start; ++ map->resource = resource; ++ map->vma = vma; ++ vmcs_sm_add_map(sm_state, resource, map); ++ ++ /* We are not actually mapping the pages, we just provide a fault ++ ** handler to allow pages to be mapped when accessed ++ */ ++ vma->vm_flags |= ++ VM_IO | VM_PFNMAP | VM_DONTCOPY | VM_DONTEXPAND; ++ vma->vm_ops = &vcsm_vm_ops; ++ vma->vm_private_data = map; ++ ++ /* vm_pgoff is the first PFN of the mapped memory */ ++ vma->vm_pgoff = (unsigned long)resource->res_base_mem & 0x3FFFFFFF; ++ vma->vm_pgoff += mm_vc_mem_phys_addr; ++ vma->vm_pgoff >>= PAGE_SHIFT; ++ ++ if ((resource->res_cached == VMCS_SM_CACHE_NONE) || ++ (resource->res_cached == VMCS_SM_CACHE_VC)) { ++ /* Allocated non host cached memory, honour it. ++ */ ++ vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); ++ } ++ ++ pr_debug("[%s]: resource %p (guid %x) - cnt %u, base address %p, handle %x, size %u (%u), cache %u\n", ++ __func__, ++ resource, resource->res_guid, resource->lock_count, ++ resource->res_base_mem, resource->res_handle, ++ resource->res_size, (unsigned int)(vma->vm_end - vma->vm_start), ++ resource->res_cached); ++ ++ pr_debug("[%s]: resource %p (base address %p, handle %x) - map-count %d, usr-addr %x\n", ++ __func__, resource, resource->res_base_mem, ++ resource->res_handle, resource->map_count, ++ (unsigned int)vma->vm_start); ++ ++ vcsm_vma_open(vma); ++ resource->res_stats[MAP]++; ++ vmcs_sm_release_resource(resource, 0); ++ return 0; ++ ++error: ++ resource->res_stats[MAP_FAIL]++; ++ vmcs_sm_release_resource(resource, 0); ++ return ret; ++} ++ ++/* Allocate a shared memory handle and block. ++*/ ++int vc_sm_ioctl_alloc(struct SM_PRIV_DATA_T *private, ++ struct vmcs_sm_ioctl_alloc *ioparam) ++{ ++ int ret = 0; ++ int status; ++ struct SM_RESOURCE_T *resource; ++ VC_SM_ALLOC_T alloc = { 0 }; ++ VC_SM_ALLOC_RESULT_T result = { 0 }; ++ ++ /* Setup our allocation parameters */ ++ alloc.type = ((ioparam->cached == VMCS_SM_CACHE_VC) ++ || (ioparam->cached == ++ VMCS_SM_CACHE_BOTH)) ? VC_SM_ALLOC_CACHED : ++ VC_SM_ALLOC_NON_CACHED; ++ alloc.base_unit = ioparam->size; ++ alloc.num_unit = ioparam->num; ++ alloc.allocator = current->tgid; ++ /* Align to kernel page size */ ++ alloc.alignement = 4096; ++ /* Align the size to the kernel page size */ ++ alloc.base_unit = ++ (alloc.base_unit + alloc.alignement - 1) & ~(alloc.alignement - 1); ++ if (*ioparam->name) { ++ memcpy(alloc.name, ioparam->name, sizeof(alloc.name) - 1); ++ } else { ++ memcpy(alloc.name, VMCS_SM_RESOURCE_NAME_DEFAULT, ++ sizeof(VMCS_SM_RESOURCE_NAME_DEFAULT)); ++ } ++ ++ pr_debug("[%s]: attempt to allocate \"%s\" data - type %u, base %u (%u), num %u, alignement %u\n", ++ __func__, alloc.name, alloc.type, ioparam->size, ++ alloc.base_unit, alloc.num_unit, alloc.alignement); ++ ++ /* Allocate local resource to track this allocation. ++ */ ++ resource = kzalloc(sizeof(*resource), GFP_KERNEL); ++ if (!resource) { ++ ret = -ENOMEM; ++ goto error; ++ } ++ INIT_LIST_HEAD(&resource->map_list); ++ resource->ref_count++; ++ resource->pid = current->tgid; ++ ++ /* Allocate the videocore resource. ++ */ ++ status = vc_vchi_sm_alloc(sm_state->sm_handle, &alloc, &result, ++ &private->int_trans_id); ++ if (status == -EINTR) { ++ pr_debug("[%s]: requesting allocate memory action restart (trans_id: %u)\n", ++ __func__, private->int_trans_id); ++ ret = -ERESTARTSYS; ++ private->restart_sys = -EINTR; ++ private->int_action = VC_SM_MSG_TYPE_ALLOC; ++ goto error; ++ } else if (status != 0 || (status == 0 && result.res_mem == NULL)) { ++ pr_err("[%s]: failed to allocate memory on videocore (status: %u, trans_id: %u)\n", ++ __func__, status, private->int_trans_id); ++ ret = -ENOMEM; ++ resource->res_stats[ALLOC_FAIL]++; ++ goto error; ++ } ++ ++ /* Keep track of the resource we created. ++ */ ++ resource->private = private; ++ resource->res_handle = result.res_handle; ++ resource->res_base_mem = result.res_mem; ++ resource->res_size = alloc.base_unit * alloc.num_unit; ++ resource->res_cached = ioparam->cached; ++ ++ /* Kernel/user GUID. This global identifier is used for mmap'ing the ++ * allocated region from user space, it is passed as the mmap'ing ++ * offset, we use it to 'hide' the videocore handle/address. ++ */ ++ mutex_lock(&sm_state->lock); ++ resource->res_guid = ++sm_state->guid; ++ mutex_unlock(&sm_state->lock); ++ resource->res_guid <<= PAGE_SHIFT; ++ ++ vmcs_sm_add_resource(private, resource); ++ ++ pr_debug("[%s]: allocated data - guid %x, hdl %x, base address %p, size %d, cache %d\n", ++ __func__, resource->res_guid, resource->res_handle, ++ resource->res_base_mem, resource->res_size, ++ resource->res_cached); ++ ++ /* We're done */ ++ resource->res_stats[ALLOC]++; ++ ioparam->handle = resource->res_guid; ++ return 0; ++ ++error: ++ pr_err("[%s]: failed to allocate \"%s\" data (%i) - type %u, base %u (%u), num %u, alignment %u\n", ++ __func__, alloc.name, ret, alloc.type, ioparam->size, ++ alloc.base_unit, alloc.num_unit, alloc.alignement); ++ if (resource != NULL) { ++ vc_sm_resource_deceased(resource, 1); ++ kfree(resource); ++ } ++ return ret; ++} ++ ++/* Share an allocate memory handle and block. ++*/ ++int vc_sm_ioctl_alloc_share(struct SM_PRIV_DATA_T *private, ++ struct vmcs_sm_ioctl_alloc_share *ioparam) ++{ ++ struct SM_RESOURCE_T *resource, *shared_resource; ++ int ret = 0; ++ ++ pr_debug("[%s]: attempt to share resource %u\n", __func__, ++ ioparam->handle); ++ ++ shared_resource = vmcs_sm_acquire_global_resource(ioparam->handle); ++ if (shared_resource == NULL) { ++ ret = -ENOMEM; ++ goto error; ++ } ++ ++ /* Allocate local resource to track this allocation. ++ */ ++ resource = kzalloc(sizeof(*resource), GFP_KERNEL); ++ if (resource == NULL) { ++ pr_err("[%s]: failed to allocate local tracking resource\n", ++ __func__); ++ ret = -ENOMEM; ++ goto error; ++ } ++ INIT_LIST_HEAD(&resource->map_list); ++ resource->ref_count++; ++ resource->pid = current->tgid; ++ ++ /* Keep track of the resource we created. ++ */ ++ resource->private = private; ++ resource->res_handle = shared_resource->res_handle; ++ resource->res_base_mem = shared_resource->res_base_mem; ++ resource->res_size = shared_resource->res_size; ++ resource->res_cached = shared_resource->res_cached; ++ resource->res_shared = shared_resource; ++ ++ mutex_lock(&sm_state->lock); ++ resource->res_guid = ++sm_state->guid; ++ mutex_unlock(&sm_state->lock); ++ resource->res_guid <<= PAGE_SHIFT; ++ ++ vmcs_sm_add_resource(private, resource); ++ ++ pr_debug("[%s]: allocated data - guid %x, hdl %x, base address %p, size %d, cache %d\n", ++ __func__, resource->res_guid, resource->res_handle, ++ resource->res_base_mem, resource->res_size, ++ resource->res_cached); ++ ++ /* We're done */ ++ resource->res_stats[ALLOC]++; ++ ioparam->handle = resource->res_guid; ++ ioparam->size = resource->res_size; ++ return 0; ++ ++error: ++ pr_err("[%s]: failed to share %u\n", __func__, ioparam->handle); ++ if (shared_resource != NULL) ++ vmcs_sm_release_resource(shared_resource, 0); ++ ++ return ret; ++} ++ ++/* Free a previously allocated shared memory handle and block. ++*/ ++static int vc_sm_ioctl_free(struct SM_PRIV_DATA_T *private, ++ struct vmcs_sm_ioctl_free *ioparam) ++{ ++ struct SM_RESOURCE_T *resource = ++ vmcs_sm_acquire_resource(private, ioparam->handle); ++ ++ if (resource == NULL) { ++ pr_err("[%s]: resource for guid %u does not exist\n", __func__, ++ ioparam->handle); ++ return -EINVAL; ++ } ++ ++ /* Check permissions. ++ */ ++ if (resource->pid && (resource->pid != current->tgid)) { ++ pr_err("[%s]: current tgid %u != %u owner\n", ++ __func__, current->tgid, resource->pid); ++ vmcs_sm_release_resource(resource, 0); ++ return -EPERM; ++ } ++ ++ vmcs_sm_release_resource(resource, 0); ++ vmcs_sm_release_resource(resource, 0); ++ return 0; ++} ++ ++/* Resize a previously allocated shared memory handle and block. ++*/ ++static int vc_sm_ioctl_resize(struct SM_PRIV_DATA_T *private, ++ struct vmcs_sm_ioctl_resize *ioparam) ++{ ++ int ret = 0; ++ int status; ++ VC_SM_RESIZE_T resize; ++ struct SM_RESOURCE_T *resource; ++ ++ /* Locate resource from GUID. ++ */ ++ resource = vmcs_sm_acquire_resource(private, ioparam->handle); ++ if (!resource) { ++ pr_err("[%s]: failed resource - guid %x\n", ++ __func__, ioparam->handle); ++ ret = -EFAULT; ++ goto error; ++ } ++ ++ /* If the resource is locked, its reference count will be not NULL, ++ ** in which case we will not be allowed to resize it anyways, so ++ ** reject the attempt here. ++ */ ++ if (resource->lock_count != 0) { ++ pr_err("[%s]: cannot resize - guid %x, ref-cnt %d\n", ++ __func__, ioparam->handle, resource->lock_count); ++ ret = -EFAULT; ++ goto error; ++ } ++ ++ /* Check permissions. ++ */ ++ if (resource->pid && (resource->pid != current->tgid)) { ++ pr_err("[%s]: current tgid %u != %u owner\n", __func__, ++ current->tgid, resource->pid); ++ ret = -EPERM; ++ goto error; ++ } ++ ++ if (resource->map_count != 0) { ++ pr_err("[%s]: cannot resize - guid %x, ref-cnt %d\n", ++ __func__, ioparam->handle, resource->map_count); ++ ret = -EFAULT; ++ goto error; ++ } ++ ++ resize.res_handle = resource->res_handle; ++ resize.res_mem = resource->res_base_mem; ++ resize.res_new_size = ioparam->new_size; ++ ++ pr_debug("[%s]: attempt to resize data - guid %x, hdl %x, base address %p\n", ++ __func__, ioparam->handle, resize.res_handle, resize.res_mem); ++ ++ /* Resize the videocore allocated resource. ++ */ ++ status = vc_vchi_sm_resize(sm_state->sm_handle, &resize, ++ &private->int_trans_id); ++ if (status == -EINTR) { ++ pr_debug("[%s]: requesting resize memory action restart (trans_id: %u)\n", ++ __func__, private->int_trans_id); ++ ret = -ERESTARTSYS; ++ private->restart_sys = -EINTR; ++ private->int_action = VC_SM_MSG_TYPE_RESIZE; ++ goto error; ++ } else if (status != 0) { ++ pr_err("[%s]: failed to resize memory on videocore (status: %u, trans_id: %u)\n", ++ __func__, status, private->int_trans_id); ++ ret = -EPERM; ++ goto error; ++ } ++ ++ pr_debug("[%s]: success to resize data - hdl %x, size %d -> %d\n", ++ __func__, resize.res_handle, resource->res_size, ++ resize.res_new_size); ++ ++ /* Successfully resized, save the information and inform the user. ++ */ ++ ioparam->old_size = resource->res_size; ++ resource->res_size = resize.res_new_size; ++ ++error: ++ if (resource) ++ vmcs_sm_release_resource(resource, 0); ++ ++ return ret; ++} ++ ++/* Lock a previously allocated shared memory handle and block. ++*/ ++static int vc_sm_ioctl_lock(struct SM_PRIV_DATA_T *private, ++ struct vmcs_sm_ioctl_lock_unlock *ioparam, ++ int change_cache, enum vmcs_sm_cache_e cache_type, ++ unsigned int vc_addr) ++{ ++ int status; ++ VC_SM_LOCK_UNLOCK_T lock; ++ VC_SM_LOCK_RESULT_T result; ++ struct SM_RESOURCE_T *resource; ++ int ret = 0; ++ struct sm_mmap *map, *map_tmp; ++ long unsigned int phys_addr; ++ ++ map = NULL; ++ ++ /* Locate resource from GUID. ++ */ ++ resource = vmcs_sm_acquire_resource(private, ioparam->handle); ++ if (resource == NULL) { ++ ret = -EINVAL; ++ goto error; ++ } ++ ++ /* Check permissions. ++ */ ++ if (resource->pid && (resource->pid != current->tgid)) { ++ pr_err("[%s]: current tgid %u != %u owner\n", __func__, ++ current->tgid, resource->pid); ++ ret = -EPERM; ++ goto error; ++ } ++ ++ lock.res_handle = resource->res_handle; ++ lock.res_mem = resource->res_base_mem; ++ ++ /* Take the lock and get the address to be mapped. ++ */ ++ if (vc_addr == 0) { ++ pr_debug("[%s]: attempt to lock data - guid %x, hdl %x, base address %p\n", ++ __func__, ioparam->handle, lock.res_handle, ++ lock.res_mem); ++ ++ /* Lock the videocore allocated resource. ++ */ ++ status = vc_vchi_sm_lock(sm_state->sm_handle, &lock, &result, ++ &private->int_trans_id); ++ if (status == -EINTR) { ++ pr_debug("[%s]: requesting lock memory action restart (trans_id: %u)\n", ++ __func__, private->int_trans_id); ++ ret = -ERESTARTSYS; ++ private->restart_sys = -EINTR; ++ private->int_action = VC_SM_MSG_TYPE_LOCK; ++ goto error; ++ } else if (status != 0 || ++ (status == 0 && result.res_mem == NULL)) { ++ pr_err("[%s]: failed to lock memory on videocore (status: %u, trans_id: %u)\n", ++ __func__, status, private->int_trans_id); ++ ret = -EPERM; ++ resource->res_stats[LOCK_FAIL]++; ++ goto error; ++ } ++ ++ pr_debug("[%s]: succeed to lock data - hdl %x, base address %p (%p), ref-cnt %d\n", ++ __func__, lock.res_handle, result.res_mem, ++ lock.res_mem, resource->lock_count); ++ } ++ /* Lock assumed taken already, address to be mapped is known. ++ */ ++ else ++ resource->res_base_mem = (void *)vc_addr; ++ ++ resource->res_stats[LOCK]++; ++ resource->lock_count++; ++ ++ /* Keep track of the new base memory allocation if it has changed. ++ */ ++ if ((vc_addr == 0) && ++ (result.res_mem != NULL) && ++ (result.res_old_mem != NULL) && ++ (result.res_mem != result.res_old_mem)) { ++ resource->res_base_mem = result.res_mem; ++ ++ /* Kernel allocated resources. ++ */ ++ if (resource->pid == 0) { ++ if (!list_empty(&resource->map_list)) { ++ list_for_each_entry_safe(map, map_tmp, ++ &resource->map_list, ++ resource_map_list) { ++ if (map->res_addr) { ++ iounmap((void *)map->res_addr); ++ map->res_addr = 0; ++ ++ vmcs_sm_remove_map(sm_state, ++ map->resource, ++ map); ++ break; ++ } ++ } ++ } ++ } ++ } ++ ++ if (change_cache) ++ resource->res_cached = cache_type; ++ ++ if (resource->map_count) { ++ ioparam->addr = ++ vmcs_sm_usr_address_from_pid_and_usr_handle( ++ current->tgid, ioparam->handle); ++ ++ pr_debug("[%s] map_count %d private->pid %d current->tgid %d hnd %x addr %u\n", ++ __func__, resource->map_count, private->pid, ++ current->tgid, ioparam->handle, ioparam->addr); ++ } else { ++ /* Kernel allocated resources. ++ */ ++ if (resource->pid == 0) { ++ pr_debug("[%s]: attempt mapping kernel resource - guid %x, hdl %x\n", ++ __func__, ioparam->handle, lock.res_handle); ++ ++ ioparam->addr = 0; ++ ++ map = kzalloc(sizeof(*map), GFP_KERNEL); ++ if (map == NULL) { ++ pr_err("[%s]: failed allocating tracker\n", ++ __func__); ++ ret = -ENOMEM; ++ goto error; ++ } else { ++ phys_addr = (uint32_t)resource->res_base_mem & ++ 0x3FFFFFFF; ++ phys_addr += mm_vc_mem_phys_addr; ++ if (resource->res_cached ++ == VMCS_SM_CACHE_HOST) { ++ ioparam->addr = (long unsigned int) ++ /* TODO - make cached work */ ++ ioremap_nocache(phys_addr, ++ resource->res_size); ++ ++ pr_debug("[%s]: mapping kernel - guid %x, hdl %x - cached mapping %u\n", ++ __func__, ioparam->handle, ++ lock.res_handle, ioparam->addr); ++ } else { ++ ioparam->addr = (long unsigned int) ++ ioremap_nocache(phys_addr, ++ resource->res_size); ++ ++ pr_debug("[%s]: mapping kernel- guid %x, hdl %x - non cached mapping %u\n", ++ __func__, ioparam->handle, ++ lock.res_handle, ioparam->addr); ++ } ++ ++ map->res_pid = 0; ++ map->res_vc_hdl = resource->res_handle; ++ map->res_usr_hdl = resource->res_guid; ++ map->res_addr = ioparam->addr; ++ map->resource = resource; ++ map->vma = NULL; ++ ++ vmcs_sm_add_map(sm_state, resource, map); ++ } ++ } else ++ ioparam->addr = 0; ++ } ++ ++error: ++ if (resource) ++ vmcs_sm_release_resource(resource, 0); ++ ++ return ret; ++} ++ ++/* Unlock a previously allocated shared memory handle and block. ++*/ ++static int vc_sm_ioctl_unlock(struct SM_PRIV_DATA_T *private, ++ struct vmcs_sm_ioctl_lock_unlock *ioparam, ++ int flush, int wait_reply, int no_vc_unlock) ++{ ++ int status; ++ VC_SM_LOCK_UNLOCK_T unlock; ++ struct sm_mmap *map, *map_tmp; ++ struct SM_RESOURCE_T *resource; ++ int ret = 0; ++ ++ map = NULL; ++ ++ /* Locate resource from GUID. ++ */ ++ resource = vmcs_sm_acquire_resource(private, ioparam->handle); ++ if (resource == NULL) { ++ ret = -EINVAL; ++ goto error; ++ } ++ ++ /* Check permissions. ++ */ ++ if (resource->pid && (resource->pid != current->tgid)) { ++ pr_err("[%s]: current tgid %u != %u owner\n", ++ __func__, current->tgid, resource->pid); ++ ret = -EPERM; ++ goto error; ++ } ++ ++ unlock.res_handle = resource->res_handle; ++ unlock.res_mem = resource->res_base_mem; ++ ++ pr_debug("[%s]: attempt to unlock data - guid %x, hdl %x, base address %p\n", ++ __func__, ioparam->handle, unlock.res_handle, unlock.res_mem); ++ ++ /* User space allocated resources. ++ */ ++ if (resource->pid) { ++ /* Flush if requested */ ++ if (resource->res_cached && flush) { ++ dma_addr_t phys_addr = 0; ++ resource->res_stats[FLUSH]++; ++ ++ phys_addr = ++ (dma_addr_t)((uint32_t)resource->res_base_mem & ++ 0x3FFFFFFF); ++ phys_addr += (dma_addr_t)mm_vc_mem_phys_addr; ++ ++ /* L1 cache flush */ ++ down_read(&current->mm->mmap_sem); ++ list_for_each_entry(map, &resource->map_list, ++ resource_map_list) { ++ if (map->vma) { ++ unsigned long start; ++ unsigned long end; ++ start = map->vma->vm_start; ++ end = map->vma->vm_end; ++ ++ vcsm_vma_cache_clean_page_range( ++ start, end); ++ } ++ } ++ up_read(&current->mm->mmap_sem); ++ ++ /* L2 cache flush */ ++ outer_clean_range(phys_addr, ++ phys_addr + ++ (size_t) resource->res_size); ++ } ++ ++ /* We need to zap all the vmas associated with this resource */ ++ if (resource->lock_count == 1) { ++ down_read(&current->mm->mmap_sem); ++ list_for_each_entry(map, &resource->map_list, ++ resource_map_list) { ++ if (map->vma) { ++ zap_vma_ptes(map->vma, ++ map->vma->vm_start, ++ map->vma->vm_end - ++ map->vma->vm_start); ++ } ++ } ++ up_read(&current->mm->mmap_sem); ++ } ++ } ++ /* Kernel allocated resources. */ ++ else { ++ /* Global + Taken in this context */ ++ if (resource->ref_count == 2) { ++ if (!list_empty(&resource->map_list)) { ++ list_for_each_entry_safe(map, map_tmp, ++ &resource->map_list, ++ resource_map_list) { ++ if (map->res_addr) { ++ if (flush && ++ (resource->res_cached == ++ VMCS_SM_CACHE_HOST)) { ++ long unsigned int ++ phys_addr; ++ phys_addr = (uint32_t) ++ resource->res_base_mem & 0x3FFFFFFF; ++ phys_addr += ++ mm_vc_mem_phys_addr; ++ ++ /* L1 cache flush */ ++ dmac_flush_range((const ++ void ++ *) ++ map->res_addr, (const void *) ++ (map->res_addr + resource->res_size)); ++ ++ /* L2 cache flush */ ++ outer_clean_range ++ (phys_addr, ++ phys_addr + ++ (size_t) ++ resource->res_size); ++ } ++ ++ iounmap((void *)map->res_addr); ++ map->res_addr = 0; ++ ++ vmcs_sm_remove_map(sm_state, ++ map->resource, ++ map); ++ break; ++ } ++ } ++ } ++ } ++ } ++ ++ if (resource->lock_count) { ++ /* Bypass the videocore unlock. ++ */ ++ if (no_vc_unlock) ++ status = 0; ++ /* Unlock the videocore allocated resource. ++ */ ++ else { ++ status = ++ vc_vchi_sm_unlock(sm_state->sm_handle, &unlock, ++ &private->int_trans_id, ++ wait_reply); ++ if (status == -EINTR) { ++ pr_debug("[%s]: requesting unlock memory action restart (trans_id: %u)\n", ++ __func__, private->int_trans_id); ++ ++ ret = -ERESTARTSYS; ++ resource->res_stats[UNLOCK]--; ++ private->restart_sys = -EINTR; ++ private->int_action = VC_SM_MSG_TYPE_UNLOCK; ++ goto error; ++ } else if (status != 0) { ++ pr_err("[%s]: failed to unlock vc mem (status: %u, trans_id: %u)\n", ++ __func__, status, private->int_trans_id); ++ ++ ret = -EPERM; ++ resource->res_stats[UNLOCK_FAIL]++; ++ goto error; ++ } ++ } ++ ++ resource->res_stats[UNLOCK]++; ++ resource->lock_count--; ++ } ++ ++ pr_debug("[%s]: success to unlock data - hdl %x, base address %p, ref-cnt %d\n", ++ __func__, unlock.res_handle, unlock.res_mem, ++ resource->lock_count); ++ ++error: ++ if (resource) ++ vmcs_sm_release_resource(resource, 0); ++ ++ return ret; ++} ++ ++/* Handle control from host. */ ++static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ++{ ++ int ret = 0; ++ unsigned int cmdnr = _IOC_NR(cmd); ++ struct SM_PRIV_DATA_T *file_data = ++ (struct SM_PRIV_DATA_T *)file->private_data; ++ struct SM_RESOURCE_T *resource = NULL; ++ ++ /* Validate we can work with this device. */ ++ if ((sm_state == NULL) || (file_data == NULL)) { ++ pr_err("[%s]: invalid device\n", __func__); ++ ret = -EPERM; ++ goto out; ++ } ++ ++ pr_debug("[%s]: cmd %x tgid %u, owner %u\n", __func__, cmdnr, ++ current->tgid, file_data->pid); ++ ++ /* Action is a re-post of a previously interrupted action? */ ++ if (file_data->restart_sys == -EINTR) { ++ VC_SM_ACTION_CLEAN_T action_clean; ++ ++ pr_debug("[%s]: clean up of action %u (trans_id: %u) following EINTR\n", ++ __func__, file_data->int_action, ++ file_data->int_trans_id); ++ ++ action_clean.res_action = file_data->int_action; ++ action_clean.action_trans_id = file_data->int_trans_id; ++ ++ vc_vchi_sm_clean_up(sm_state->sm_handle, &action_clean); ++ ++ file_data->restart_sys = 0; ++ } ++ ++ /* Now process the command. ++ */ ++ switch (cmdnr) { ++ /* New memory allocation. ++ */ ++ case VMCS_SM_CMD_ALLOC: ++ { ++ struct vmcs_sm_ioctl_alloc ioparam; ++ ++ /* Get the parameter data. ++ */ ++ if (copy_from_user ++ (&ioparam, (void *)arg, sizeof(ioparam)) != 0) { ++ pr_err("[%s]: failed to copy-from-user for cmd %x\n", ++ __func__, cmdnr); ++ ret = -EFAULT; ++ goto out; ++ } ++ ++ ret = vc_sm_ioctl_alloc(file_data, &ioparam); ++ if (!ret && ++ (copy_to_user((void *)arg, ++ &ioparam, sizeof(ioparam)) != 0)) { ++ struct vmcs_sm_ioctl_free freeparam = { ++ ioparam.handle ++ }; ++ pr_err("[%s]: failed to copy-to-user for cmd %x\n", ++ __func__, cmdnr); ++ vc_sm_ioctl_free(file_data, &freeparam); ++ ret = -EFAULT; ++ } ++ ++ /* Done. ++ */ ++ goto out; ++ } ++ break; ++ ++ /* Share existing memory allocation. ++ */ ++ case VMCS_SM_CMD_ALLOC_SHARE: ++ { ++ struct vmcs_sm_ioctl_alloc_share ioparam; ++ ++ /* Get the parameter data. ++ */ ++ if (copy_from_user ++ (&ioparam, (void *)arg, sizeof(ioparam)) != 0) { ++ pr_err("[%s]: failed to copy-from-user for cmd %x\n", ++ __func__, cmdnr); ++ ret = -EFAULT; ++ goto out; ++ } ++ ++ ret = vc_sm_ioctl_alloc_share(file_data, &ioparam); ++ ++ /* Copy result back to user. ++ */ ++ if (!ret ++ && copy_to_user((void *)arg, &ioparam, ++ sizeof(ioparam)) != 0) { ++ struct vmcs_sm_ioctl_free freeparam = { ++ ioparam.handle ++ }; ++ pr_err("[%s]: failed to copy-to-user for cmd %x\n", ++ __func__, cmdnr); ++ vc_sm_ioctl_free(file_data, &freeparam); ++ ret = -EFAULT; ++ } ++ ++ /* Done. ++ */ ++ goto out; ++ } ++ break; ++ ++ /* Lock (attempt to) *and* register a cache behavior change. ++ */ ++ case VMCS_SM_CMD_LOCK_CACHE: ++ { ++ struct vmcs_sm_ioctl_lock_cache ioparam; ++ struct vmcs_sm_ioctl_lock_unlock lock; ++ ++ /* Get parameter data. ++ */ ++ if (copy_from_user ++ (&ioparam, (void *)arg, sizeof(ioparam)) != 0) { ++ pr_err("[%s]: failed to copy-from-user for cmd %x\n", ++ __func__, cmdnr); ++ ret = -EFAULT; ++ goto out; ++ } ++ ++ lock.handle = ioparam.handle; ++ ret = ++ vc_sm_ioctl_lock(file_data, &lock, 1, ++ ioparam.cached, 0); ++ ++ /* Done. ++ */ ++ goto out; ++ } ++ break; ++ ++ /* Lock (attempt to) existing memory allocation. ++ */ ++ case VMCS_SM_CMD_LOCK: ++ { ++ struct vmcs_sm_ioctl_lock_unlock ioparam; ++ ++ /* Get parameter data. ++ */ ++ if (copy_from_user ++ (&ioparam, (void *)arg, sizeof(ioparam)) != 0) { ++ pr_err("[%s]: failed to copy-from-user for cmd %x\n", ++ __func__, cmdnr); ++ ret = -EFAULT; ++ goto out; ++ } ++ ++ ret = vc_sm_ioctl_lock(file_data, &ioparam, 0, 0, 0); ++ ++ /* Copy result back to user. ++ */ ++ if (copy_to_user((void *)arg, &ioparam, sizeof(ioparam)) ++ != 0) { ++ pr_err("[%s]: failed to copy-to-user for cmd %x\n", ++ __func__, cmdnr); ++ ret = -EFAULT; ++ } ++ ++ /* Done. ++ */ ++ goto out; ++ } ++ break; ++ ++ /* Unlock (attempt to) existing memory allocation. ++ */ ++ case VMCS_SM_CMD_UNLOCK: ++ { ++ struct vmcs_sm_ioctl_lock_unlock ioparam; ++ ++ /* Get parameter data. ++ */ ++ if (copy_from_user ++ (&ioparam, (void *)arg, sizeof(ioparam)) != 0) { ++ pr_err("[%s]: failed to copy-from-user for cmd %x\n", ++ __func__, cmdnr); ++ ret = -EFAULT; ++ goto out; ++ } ++ ++ ret = vc_sm_ioctl_unlock(file_data, &ioparam, 0, 1, 0); ++ ++ /* Done. ++ */ ++ goto out; ++ } ++ break; ++ ++ /* Resize (attempt to) existing memory allocation. ++ */ ++ case VMCS_SM_CMD_RESIZE: ++ { ++ struct vmcs_sm_ioctl_resize ioparam; ++ ++ /* Get parameter data. ++ */ ++ if (copy_from_user ++ (&ioparam, (void *)arg, sizeof(ioparam)) != 0) { ++ pr_err("[%s]: failed to copy-from-user for cmd %x\n", ++ __func__, cmdnr); ++ ret = -EFAULT; ++ goto out; ++ } ++ ++ ret = vc_sm_ioctl_resize(file_data, &ioparam); ++ ++ /* Copy result back to user. ++ */ ++ if (copy_to_user((void *)arg, &ioparam, sizeof(ioparam)) ++ != 0) { ++ pr_err("[%s]: failed to copy-to-user for cmd %x\n", ++ __func__, cmdnr); ++ ret = -EFAULT; ++ } ++ ++ /* Done. ++ */ ++ goto out; ++ } ++ break; ++ ++ /* Terminate existing memory allocation. ++ */ ++ case VMCS_SM_CMD_FREE: ++ { ++ struct vmcs_sm_ioctl_free ioparam; ++ ++ /* Get parameter data. ++ */ ++ if (copy_from_user ++ (&ioparam, (void *)arg, sizeof(ioparam)) != 0) { ++ pr_err("[%s]: failed to copy-from-user for cmd %x\n", ++ __func__, cmdnr); ++ ret = -EFAULT; ++ goto out; ++ } ++ ++ ret = vc_sm_ioctl_free(file_data, &ioparam); ++ ++ /* Done. ++ */ ++ goto out; ++ } ++ break; ++ ++ /* Walk allocation on videocore, information shows up in the ++ ** videocore log. ++ */ ++ case VMCS_SM_CMD_VC_WALK_ALLOC: ++ { ++ pr_debug("[%s]: invoking walk alloc\n", __func__); ++ ++ if (vc_vchi_sm_walk_alloc(sm_state->sm_handle) != 0) ++ pr_err("[%s]: failed to walk-alloc on videocore\n", ++ __func__); ++ ++ /* Done. ++ */ ++ goto out; ++ } ++ break; ++/* Walk mapping table on host, information shows up in the ++ ** kernel log. ++ */ ++ case VMCS_SM_CMD_HOST_WALK_MAP: ++ { ++ /* Use pid of -1 to tell to walk the whole map. */ ++ vmcs_sm_host_walk_map_per_pid(-1); ++ ++ /* Done. */ ++ goto out; ++ } ++ break; ++ ++ /* Walk mapping table per process on host. */ ++ case VMCS_SM_CMD_HOST_WALK_PID_ALLOC: ++ { ++ struct vmcs_sm_ioctl_walk ioparam; ++ ++ /* Get parameter data. */ ++ if (copy_from_user(&ioparam, ++ (void *)arg, sizeof(ioparam)) != 0) { ++ pr_err("[%s]: failed to copy-from-user for cmd %x\n", ++ __func__, cmdnr); ++ ret = -EFAULT; ++ goto out; ++ } ++ ++ vmcs_sm_host_walk_alloc(file_data); ++ ++ /* Done. */ ++ goto out; ++ } ++ break; ++ ++ /* Walk allocation per process on host. */ ++ case VMCS_SM_CMD_HOST_WALK_PID_MAP: ++ { ++ struct vmcs_sm_ioctl_walk ioparam; ++ ++ /* Get parameter data. */ ++ if (copy_from_user(&ioparam, ++ (void *)arg, sizeof(ioparam)) != 0) { ++ pr_err("[%s]: failed to copy-from-user for cmd %x\n", ++ __func__, cmdnr); ++ ret = -EFAULT; ++ goto out; ++ } ++ ++ vmcs_sm_host_walk_map_per_pid(ioparam.pid); ++ ++ /* Done. */ ++ goto out; ++ } ++ break; ++ ++ /* Gets the size of the memory associated with a user handle. */ ++ case VMCS_SM_CMD_SIZE_USR_HANDLE: ++ { ++ struct vmcs_sm_ioctl_size ioparam; ++ ++ /* Get parameter data. */ ++ if (copy_from_user(&ioparam, ++ (void *)arg, sizeof(ioparam)) != 0) { ++ pr_err("[%s]: failed to copy-from-user for cmd %x\n", ++ __func__, cmdnr); ++ ret = -EFAULT; ++ goto out; ++ } ++ ++ /* Locate resource from GUID. */ ++ resource = ++ vmcs_sm_acquire_resource(file_data, ioparam.handle); ++ if (resource != NULL) { ++ ioparam.size = resource->res_size; ++ vmcs_sm_release_resource(resource, 0); ++ } else { ++ ioparam.size = 0; ++ } ++ ++ if (copy_to_user((void *)arg, ++ &ioparam, sizeof(ioparam)) != 0) { ++ pr_err("[%s]: failed to copy-to-user for cmd %x\n", ++ __func__, cmdnr); ++ ret = -EFAULT; ++ } ++ ++ /* Done. */ ++ goto out; ++ } ++ break; ++ ++ /* Verify we are dealing with a valid resource. */ ++ case VMCS_SM_CMD_CHK_USR_HANDLE: ++ { ++ struct vmcs_sm_ioctl_chk ioparam; ++ ++ /* Get parameter data. ++ */ ++ if (copy_from_user(&ioparam, ++ (void *)arg, sizeof(ioparam)) != 0) { ++ pr_err("[%s]: failed to copy-from-user for cmd %x\n", ++ __func__, cmdnr); ++ ++ ret = -EFAULT; ++ goto out; ++ } ++ ++ /* Locate resource from GUID. */ ++ resource = ++ vmcs_sm_acquire_resource(file_data, ioparam.handle); ++ if (resource == NULL) ++ ret = -EINVAL; ++ /* If the resource is cacheable, return additional ++ * information that may be needed to flush the cache. ++ */ ++ else if ((resource->res_cached == VMCS_SM_CACHE_HOST) || ++ (resource->res_cached == VMCS_SM_CACHE_BOTH)) { ++ ioparam.addr = ++ vmcs_sm_usr_address_from_pid_and_usr_handle ++ (current->tgid, ioparam.handle); ++ ioparam.size = resource->res_size; ++ ioparam.cache = resource->res_cached; ++ } else { ++ ioparam.addr = 0; ++ ioparam.size = 0; ++ ioparam.cache = resource->res_cached; ++ } ++ ++ if (resource) ++ vmcs_sm_release_resource(resource, 0); ++ ++ if (copy_to_user((void *)arg, ++ &ioparam, sizeof(ioparam)) != 0) { ++ pr_err("[%s]: failed to copy-to-user for cmd %x\n", ++ __func__, cmdnr); ++ ret = -EFAULT; ++ } ++ ++ /* Done. ++ */ ++ goto out; ++ } ++ break; ++ ++ /* ++ * Maps a user handle given the process and the virtual address. ++ */ ++ case VMCS_SM_CMD_MAPPED_USR_HANDLE: ++ { ++ struct vmcs_sm_ioctl_map ioparam; ++ ++ /* Get parameter data. */ ++ if (copy_from_user(&ioparam, ++ (void *)arg, sizeof(ioparam)) != 0) { ++ pr_err("[%s]: failed to copy-from-user for cmd %x\n", ++ __func__, cmdnr); ++ ++ ret = -EFAULT; ++ goto out; ++ } ++ ++ ioparam.handle = ++ vmcs_sm_usr_handle_from_pid_and_address( ++ ioparam.pid, ioparam.addr); ++ ++ resource = ++ vmcs_sm_acquire_resource(file_data, ioparam.handle); ++ if ((resource != NULL) ++ && ((resource->res_cached == VMCS_SM_CACHE_HOST) ++ || (resource->res_cached == ++ VMCS_SM_CACHE_BOTH))) { ++ ioparam.size = resource->res_size; ++ } else { ++ ioparam.size = 0; ++ } ++ ++ if (resource) ++ vmcs_sm_release_resource(resource, 0); ++ ++ if (copy_to_user((void *)arg, ++ &ioparam, sizeof(ioparam)) != 0) { ++ pr_err("[%s]: failed to copy-to-user for cmd %x\n", ++ __func__, cmdnr); ++ ret = -EFAULT; ++ } ++ ++ /* Done. */ ++ goto out; ++ } ++ break; ++ ++ /* ++ * Maps a videocore handle given process and virtual address. ++ */ ++ case VMCS_SM_CMD_MAPPED_VC_HDL_FROM_ADDR: ++ { ++ struct vmcs_sm_ioctl_map ioparam; ++ ++ /* Get parameter data. */ ++ if (copy_from_user(&ioparam, ++ (void *)arg, sizeof(ioparam)) != 0) { ++ pr_err("[%s]: failed to copy-from-user for cmd %x\n", ++ __func__, cmdnr); ++ ret = -EFAULT; ++ goto out; ++ } ++ ++ ioparam.handle = vmcs_sm_vc_handle_from_pid_and_address( ++ ioparam.pid, ioparam.addr); ++ ++ if (copy_to_user((void *)arg, ++ &ioparam, sizeof(ioparam)) != 0) { ++ pr_err("[%s]: failed to copy-to-user for cmd %x\n", ++ __func__, cmdnr); ++ ++ ret = -EFAULT; ++ } ++ ++ /* Done. ++ */ ++ goto out; ++ } ++ break; ++ ++ /* Maps a videocore handle given process and user handle. */ ++ case VMCS_SM_CMD_MAPPED_VC_HDL_FROM_HDL: ++ { ++ struct vmcs_sm_ioctl_map ioparam; ++ ++ /* Get parameter data. */ ++ if (copy_from_user(&ioparam, ++ (void *)arg, sizeof(ioparam)) != 0) { ++ pr_err("[%s]: failed to copy-from-user for cmd %x\n", ++ __func__, cmdnr); ++ ret = -EFAULT; ++ goto out; ++ } ++ ++ /* Locate resource from GUID. */ ++ resource = ++ vmcs_sm_acquire_resource(file_data, ioparam.handle); ++ if (resource != NULL) { ++ ioparam.handle = resource->res_handle; ++ vmcs_sm_release_resource(resource, 0); ++ } else { ++ ioparam.handle = 0; ++ } ++ ++ if (copy_to_user((void *)arg, ++ &ioparam, sizeof(ioparam)) != 0) { ++ pr_err("[%s]: failed to copy-to-user for cmd %x\n", ++ __func__, cmdnr); ++ ++ ret = -EFAULT; ++ } ++ ++ /* Done. */ ++ goto out; ++ } ++ break; ++ ++ /* ++ * Maps a videocore address given process and videocore handle. ++ */ ++ case VMCS_SM_CMD_MAPPED_VC_ADDR_FROM_HDL: ++ { ++ struct vmcs_sm_ioctl_map ioparam; ++ ++ /* Get parameter data. */ ++ if (copy_from_user(&ioparam, ++ (void *)arg, sizeof(ioparam)) != 0) { ++ pr_err("[%s]: failed to copy-from-user for cmd %x\n", ++ __func__, cmdnr); ++ ++ ret = -EFAULT; ++ goto out; ++ } ++ ++ /* Locate resource from GUID. */ ++ resource = ++ vmcs_sm_acquire_resource(file_data, ioparam.handle); ++ if (resource != NULL) { ++ ioparam.addr = ++ (unsigned int)resource->res_base_mem; ++ vmcs_sm_release_resource(resource, 0); ++ } else { ++ ioparam.addr = 0; ++ } ++ ++ if (copy_to_user((void *)arg, ++ &ioparam, sizeof(ioparam)) != 0) { ++ pr_err("[%s]: failed to copy-to-user for cmd %x\n", ++ __func__, cmdnr); ++ ret = -EFAULT; ++ } ++ ++ /* Done. */ ++ goto out; ++ } ++ break; ++ ++ /* Maps a user address given process and vc handle. ++ */ ++ case VMCS_SM_CMD_MAPPED_USR_ADDRESS: ++ { ++ struct vmcs_sm_ioctl_map ioparam; ++ ++ /* Get parameter data. */ ++ if (copy_from_user(&ioparam, ++ (void *)arg, sizeof(ioparam)) != 0) { ++ pr_err("[%s]: failed to copy-from-user for cmd %x\n", ++ __func__, cmdnr); ++ ret = -EFAULT; ++ goto out; ++ } ++ ++ /* ++ * Return the address information from the mapping, ++ * 0 (ie NULL) if it cannot locate the actual mapping. ++ */ ++ ioparam.addr = ++ vmcs_sm_usr_address_from_pid_and_usr_handle ++ (ioparam.pid, ioparam.handle); ++ ++ if (copy_to_user((void *)arg, ++ &ioparam, sizeof(ioparam)) != 0) { ++ pr_err("[%s]: failed to copy-to-user for cmd %x\n", ++ __func__, cmdnr); ++ ret = -EFAULT; ++ } ++ ++ /* Done. */ ++ goto out; ++ } ++ break; ++ ++ /* Flush the cache for a given mapping. */ ++ case VMCS_SM_CMD_FLUSH: ++ { ++ struct vmcs_sm_ioctl_cache ioparam; ++ ++ /* Get parameter data. */ ++ if (copy_from_user(&ioparam, ++ (void *)arg, sizeof(ioparam)) != 0) { ++ pr_err("[%s]: failed to copy-from-user for cmd %x\n", ++ __func__, cmdnr); ++ ret = -EFAULT; ++ goto out; ++ } ++ ++ /* Locate resource from GUID. */ ++ resource = ++ vmcs_sm_acquire_resource(file_data, ioparam.handle); ++ ++ if ((resource != NULL) && resource->res_cached) { ++ dma_addr_t phys_addr = 0; ++ ++ resource->res_stats[FLUSH]++; ++ ++ phys_addr = ++ (dma_addr_t)((uint32_t) ++ resource->res_base_mem & ++ 0x3FFFFFFF); ++ phys_addr += (dma_addr_t)mm_vc_mem_phys_addr; ++ ++ /* L1 cache flush */ ++ down_read(&current->mm->mmap_sem); ++ vcsm_vma_cache_clean_page_range((unsigned long) ++ ioparam.addr, ++ (unsigned long) ++ ioparam.addr + ++ ioparam.size); ++ up_read(&current->mm->mmap_sem); ++ ++ /* L2 cache flush */ ++ outer_clean_range(phys_addr, ++ phys_addr + ++ (size_t) ioparam.size); ++ } else if (resource == NULL) { ++ ret = -EINVAL; ++ goto out; ++ } ++ ++ if (resource) ++ vmcs_sm_release_resource(resource, 0); ++ ++ /* Done. */ ++ goto out; ++ } ++ break; ++ ++ /* Invalidate the cache for a given mapping. */ ++ case VMCS_SM_CMD_INVALID: ++ { ++ struct vmcs_sm_ioctl_cache ioparam; ++ ++ /* Get parameter data. */ ++ if (copy_from_user(&ioparam, ++ (void *)arg, sizeof(ioparam)) != 0) { ++ pr_err("[%s]: failed to copy-from-user for cmd %x\n", ++ __func__, cmdnr); ++ ret = -EFAULT; ++ goto out; ++ } ++ ++ /* Locate resource from GUID. ++ */ ++ resource = ++ vmcs_sm_acquire_resource(file_data, ioparam.handle); ++ ++ if ((resource != NULL) && resource->res_cached) { ++ dma_addr_t phys_addr = 0; ++ ++ resource->res_stats[INVALID]++; ++ ++ phys_addr = ++ (dma_addr_t)((uint32_t) ++ resource->res_base_mem & ++ 0x3FFFFFFF); ++ phys_addr += (dma_addr_t)mm_vc_mem_phys_addr; ++ ++ /* L2 cache invalidate */ ++ outer_inv_range(phys_addr, ++ phys_addr + ++ (size_t) ioparam.size); ++ ++ /* L1 cache invalidate */ ++ down_read(&current->mm->mmap_sem); ++ vcsm_vma_cache_clean_page_range((unsigned long) ++ ioparam.addr, ++ (unsigned long) ++ ioparam.addr + ++ ioparam.size); ++ up_read(&current->mm->mmap_sem); ++ } else if (resource == NULL) { ++ ret = -EINVAL; ++ goto out; ++ } ++ ++ if (resource) ++ vmcs_sm_release_resource(resource, 0); ++ ++ /* Done. ++ */ ++ goto out; ++ } ++ break; ++ ++ /* Flush/Invalidate the cache for a given mapping. */ ++ case VMCS_SM_CMD_CLEAN_INVALID: ++ { ++ int i; ++ struct vmcs_sm_ioctl_clean_invalid ioparam; ++ ++ /* Get parameter data. */ ++ if (copy_from_user(&ioparam, ++ (void *)arg, sizeof(ioparam)) != 0) { ++ pr_err("[%s]: failed to copy-from-user for cmd %x\n", ++ __func__, cmdnr); ++ ret = -EFAULT; ++ goto out; ++ } ++ for (i=0; i<sizeof ioparam.s/sizeof *ioparam.s; i++) { ++ switch (ioparam.s[i].cmd) { ++ default: case 0: break; /* NOOP */ ++ case 1: /* L1/L2 invalidate virtual range */ ++ case 2: /* L1/L2 clean physical range */ ++ case 3: /* L1/L2 clean+invalidate all */ ++ { ++ /* Locate resource from GUID. ++ */ ++ resource = ++ vmcs_sm_acquire_resource(file_data, ioparam.s[i].handle); ++ ++ if ((resource != NULL) && resource->res_cached) { ++ unsigned long base = ioparam.s[i].addr & ~(PAGE_SIZE-1); ++ unsigned long end = (ioparam.s[i].addr + ioparam.s[i].size + PAGE_SIZE-1) & ~(PAGE_SIZE-1); ++ resource->res_stats[ioparam.s[i].cmd == 1 ? INVALID:FLUSH]++; ++ ++ /* L1/L2 cache flush */ ++ down_read(&current->mm->mmap_sem); ++ vcsm_vma_cache_clean_page_range(base, end); ++ up_read(&current->mm->mmap_sem); ++ } else if (resource == NULL) { ++ ret = -EINVAL; ++ goto out; ++ } ++ ++ if (resource) ++ vmcs_sm_release_resource(resource, 0); ++ } ++ break; ++ } ++ } ++ } ++ break; ++ ++ default: ++ { ++ ret = -EINVAL; ++ goto out; ++ } ++ break; ++ } ++ ++out: ++ return ret; ++} ++ ++/* Device operations that we managed in this driver. ++*/ ++static const struct file_operations vmcs_sm_ops = { ++ .owner = THIS_MODULE, ++ .unlocked_ioctl = vc_sm_ioctl, ++ .open = vc_sm_open, ++ .release = vc_sm_release, ++ .mmap = vc_sm_mmap, ++}; ++ ++/* Creation of device. ++*/ ++static int vc_sm_create_sharedmemory(void) ++{ ++ int ret; ++ ++ if (sm_state == NULL) { ++ ret = -ENOMEM; ++ goto out; ++ } ++ ++ /* Create a device class for creating dev nodes. ++ */ ++ sm_state->sm_class = class_create(THIS_MODULE, "vc-sm"); ++ if (IS_ERR(sm_state->sm_class)) { ++ pr_err("[%s]: unable to create device class\n", __func__); ++ ret = PTR_ERR(sm_state->sm_class); ++ goto out; ++ } ++ ++ /* Create a character driver. ++ */ ++ ret = alloc_chrdev_region(&sm_state->sm_devid, ++ DEVICE_MINOR, 1, DEVICE_NAME); ++ if (ret != 0) { ++ pr_err("[%s]: unable to allocate device number\n", __func__); ++ goto out_dev_class_destroy; ++ } ++ ++ cdev_init(&sm_state->sm_cdev, &vmcs_sm_ops); ++ ret = cdev_add(&sm_state->sm_cdev, sm_state->sm_devid, 1); ++ if (ret != 0) { ++ pr_err("[%s]: unable to register device\n", __func__); ++ goto out_chrdev_unreg; ++ } ++ ++ /* Create a device node. ++ */ ++ sm_state->sm_dev = device_create(sm_state->sm_class, ++ NULL, ++ MKDEV(MAJOR(sm_state->sm_devid), ++ DEVICE_MINOR), NULL, ++ DEVICE_NAME); ++ if (IS_ERR(sm_state->sm_dev)) { ++ pr_err("[%s]: unable to create device node\n", __func__); ++ ret = PTR_ERR(sm_state->sm_dev); ++ goto out_chrdev_del; ++ } ++ ++ goto out; ++ ++out_chrdev_del: ++ cdev_del(&sm_state->sm_cdev); ++out_chrdev_unreg: ++ unregister_chrdev_region(sm_state->sm_devid, 1); ++out_dev_class_destroy: ++ class_destroy(sm_state->sm_class); ++ sm_state->sm_class = NULL; ++out: ++ return ret; ++} ++ ++/* Termination of the device. ++*/ ++static int vc_sm_remove_sharedmemory(void) ++{ ++ int ret; ++ ++ if (sm_state == NULL) { ++ /* Nothing to do. ++ */ ++ ret = 0; ++ goto out; ++ } ++ ++ /* Remove the sharedmemory character driver. ++ */ ++ cdev_del(&sm_state->sm_cdev); ++ ++ /* Unregister region. ++ */ ++ unregister_chrdev_region(sm_state->sm_devid, 1); ++ ++ ret = 0; ++ goto out; ++ ++out: ++ return ret; ++} ++ ++/* Videocore connected. */ ++static void vc_sm_connected_init(void) ++{ ++ int ret; ++ VCHI_INSTANCE_T vchi_instance; ++ VCHI_CONNECTION_T *vchi_connection = NULL; ++ ++ pr_info("[%s]: start\n", __func__); ++ ++ /* Allocate memory for the state structure. ++ */ ++ sm_state = kzalloc(sizeof(struct SM_STATE_T), GFP_KERNEL); ++ if (sm_state == NULL) { ++ pr_err("[%s]: failed to allocate memory\n", __func__); ++ ret = -ENOMEM; ++ goto out; ++ } ++ ++ mutex_init(&sm_state->lock); ++ mutex_init(&sm_state->map_lock); ++ ++ /* Initialize and create a VCHI connection for the shared memory service ++ ** running on videocore. ++ */ ++ ret = vchi_initialise(&vchi_instance); ++ if (ret != 0) { ++ pr_err("[%s]: failed to initialise VCHI instance (ret=%d)\n", ++ __func__, ret); ++ ++ ret = -EIO; ++ goto err_free_mem; ++ } ++ ++ ret = vchi_connect(NULL, 0, vchi_instance); ++ if (ret != 0) { ++ pr_err("[%s]: failed to connect VCHI instance (ret=%d)\n", ++ __func__, ret); ++ ++ ret = -EIO; ++ goto err_free_mem; ++ } ++ ++ /* Initialize an instance of the shared memory service. */ ++ sm_state->sm_handle = ++ vc_vchi_sm_init(vchi_instance, &vchi_connection, 1); ++ if (sm_state->sm_handle == NULL) { ++ pr_err("[%s]: failed to initialize shared memory service\n", ++ __func__); ++ ++ ret = -EPERM; ++ goto err_free_mem; ++ } ++ ++ /* Create a debug fs directory entry (root). */ ++ sm_state->dir_root = debugfs_create_dir(VC_SM_DIR_ROOT_NAME, NULL); ++ if (!sm_state->dir_root) { ++ pr_err("[%s]: failed to create \'%s\' directory entry\n", ++ __func__, VC_SM_DIR_ROOT_NAME); ++ ++ ret = -EPERM; ++ goto err_stop_sm_service; ++ } ++ ++ sm_state->dir_state.show = &vc_sm_global_state_show; ++ sm_state->dir_state.dir_entry = debugfs_create_file(VC_SM_STATE, ++ S_IRUGO, sm_state->dir_root, &sm_state->dir_state, ++ &vc_sm_debug_fs_fops); ++ ++ sm_state->dir_stats.show = &vc_sm_global_statistics_show; ++ sm_state->dir_stats.dir_entry = debugfs_create_file(VC_SM_STATS, ++ S_IRUGO, sm_state->dir_root, &sm_state->dir_stats, ++ &vc_sm_debug_fs_fops); ++ ++ /* Create the proc entry children. */ ++ sm_state->dir_alloc = debugfs_create_dir(VC_SM_DIR_ALLOC_NAME, ++ sm_state->dir_root); ++ ++ /* Create a shared memory device. */ ++ ret = vc_sm_create_sharedmemory(); ++ if (ret != 0) { ++ pr_err("[%s]: failed to create shared memory device\n", ++ __func__); ++ goto err_remove_debugfs; ++ } ++ ++ INIT_LIST_HEAD(&sm_state->map_list); ++ INIT_LIST_HEAD(&sm_state->resource_list); ++ ++ sm_state->data_knl = vc_sm_create_priv_data(0); ++ if (sm_state->data_knl == NULL) { ++ pr_err("[%s]: failed to create kernel private data tracker\n", ++ __func__); ++ goto err_remove_shared_memory; ++ } ++ ++ /* Done! ++ */ ++ sm_inited = 1; ++ goto out; ++ ++err_remove_shared_memory: ++ vc_sm_remove_sharedmemory(); ++err_remove_debugfs: ++ debugfs_remove_recursive(sm_state->dir_root); ++err_stop_sm_service: ++ vc_vchi_sm_stop(&sm_state->sm_handle); ++err_free_mem: ++ kfree(sm_state); ++out: ++ pr_info("[%s]: end - returning %d\n", __func__, ret); ++} ++ ++/* Driver loading. */ ++static int __init vc_sm_init(void) ++{ ++ pr_info("vc-sm: Videocore shared memory driver\n"); ++ vchiq_add_connected_callback(vc_sm_connected_init); ++ return 0; ++} ++ ++/* Driver unloading. */ ++static void __exit vc_sm_exit(void) ++{ ++ pr_debug("[%s]: start\n", __func__); ++ if (sm_inited) { ++ /* Remove shared memory device. ++ */ ++ vc_sm_remove_sharedmemory(); ++ ++ /* Remove all proc entries. ++ */ ++ debugfs_remove_recursive(sm_state->dir_root); ++ ++ /* Stop the videocore shared memory service. ++ */ ++ vc_vchi_sm_stop(&sm_state->sm_handle); ++ ++ /* Free the memory for the state structure. ++ */ ++ mutex_destroy(&(sm_state->map_lock)); ++ kfree(sm_state); ++ } ++ ++ pr_debug("[%s]: end\n", __func__); ++} ++ ++#if defined(__KERNEL__) ++/* Allocate a shared memory handle and block. */ ++int vc_sm_alloc(VC_SM_ALLOC_T *alloc, int *handle) ++{ ++ struct vmcs_sm_ioctl_alloc ioparam = { 0 }; ++ int ret; ++ struct SM_RESOURCE_T *resource; ++ ++ /* Validate we can work with this device. ++ */ ++ if (sm_state == NULL || alloc == NULL || handle == NULL) { ++ pr_err("[%s]: invalid input\n", __func__); ++ return -EPERM; ++ } ++ ++ ioparam.size = alloc->base_unit; ++ ioparam.num = alloc->num_unit; ++ ioparam.cached = ++ alloc->type == VC_SM_ALLOC_CACHED ? VMCS_SM_CACHE_VC : 0; ++ ++ ret = vc_sm_ioctl_alloc(sm_state->data_knl, &ioparam); ++ ++ if (ret == 0) { ++ resource = ++ vmcs_sm_acquire_resource(sm_state->data_knl, ++ ioparam.handle); ++ if (resource) { ++ resource->pid = 0; ++ vmcs_sm_release_resource(resource, 0); ++ ++ /* Assign valid handle at this time. ++ */ ++ *handle = ioparam.handle; ++ } else { ++ ret = -ENOMEM; ++ } ++ } ++ ++ return ret; ++} ++EXPORT_SYMBOL_GPL(vc_sm_alloc); ++ ++/* Get an internal resource handle mapped from the external one. ++*/ ++int vc_sm_int_handle(int handle) ++{ ++ struct SM_RESOURCE_T *resource; ++ int ret = 0; ++ ++ /* Validate we can work with this device. ++ */ ++ if (sm_state == NULL || handle == 0) { ++ pr_err("[%s]: invalid input\n", __func__); ++ return 0; ++ } ++ ++ /* Locate resource from GUID. ++ */ ++ resource = vmcs_sm_acquire_resource(sm_state->data_knl, handle); ++ if (resource) { ++ ret = resource->res_handle; ++ vmcs_sm_release_resource(resource, 0); ++ } ++ ++ return ret; ++} ++EXPORT_SYMBOL_GPL(vc_sm_int_handle); ++ ++/* Free a previously allocated shared memory handle and block. ++*/ ++int vc_sm_free(int handle) ++{ ++ struct vmcs_sm_ioctl_free ioparam = { handle }; ++ ++ /* Validate we can work with this device. ++ */ ++ if (sm_state == NULL || handle == 0) { ++ pr_err("[%s]: invalid input\n", __func__); ++ return -EPERM; ++ } ++ ++ return vc_sm_ioctl_free(sm_state->data_knl, &ioparam); ++} ++EXPORT_SYMBOL_GPL(vc_sm_free); ++ ++/* Lock a memory handle for use by kernel. ++*/ ++int vc_sm_lock(int handle, VC_SM_LOCK_CACHE_MODE_T mode, ++ long unsigned int *data) ++{ ++ struct vmcs_sm_ioctl_lock_unlock ioparam; ++ int ret; ++ ++ /* Validate we can work with this device. ++ */ ++ if (sm_state == NULL || handle == 0 || data == NULL) { ++ pr_err("[%s]: invalid input\n", __func__); ++ return -EPERM; ++ } ++ ++ *data = 0; ++ ++ ioparam.handle = handle; ++ ret = vc_sm_ioctl_lock(sm_state->data_knl, ++ &ioparam, ++ 1, ++ ((mode == ++ VC_SM_LOCK_CACHED) ? VMCS_SM_CACHE_HOST : ++ VMCS_SM_CACHE_NONE), 0); ++ ++ *data = ioparam.addr; ++ return ret; ++} ++EXPORT_SYMBOL_GPL(vc_sm_lock); ++ ++/* Unlock a memory handle in use by kernel. ++*/ ++int vc_sm_unlock(int handle, int flush, int no_vc_unlock) ++{ ++ struct vmcs_sm_ioctl_lock_unlock ioparam; ++ ++ /* Validate we can work with this device. ++ */ ++ if (sm_state == NULL || handle == 0) { ++ pr_err("[%s]: invalid input\n", __func__); ++ return -EPERM; ++ } ++ ++ ioparam.handle = handle; ++ return vc_sm_ioctl_unlock(sm_state->data_knl, ++ &ioparam, flush, 0, no_vc_unlock); ++} ++EXPORT_SYMBOL_GPL(vc_sm_unlock); ++ ++/* Map a shared memory region for use by kernel. ++*/ ++int vc_sm_map(int handle, unsigned int sm_addr, VC_SM_LOCK_CACHE_MODE_T mode, ++ long unsigned int *data) ++{ ++ struct vmcs_sm_ioctl_lock_unlock ioparam; ++ int ret; ++ ++ /* Validate we can work with this device. ++ */ ++ if (sm_state == NULL || handle == 0 || data == NULL || sm_addr == 0) { ++ pr_err("[%s]: invalid input\n", __func__); ++ return -EPERM; ++ } ++ ++ *data = 0; ++ ++ ioparam.handle = handle; ++ ret = vc_sm_ioctl_lock(sm_state->data_knl, ++ &ioparam, ++ 1, ++ ((mode == ++ VC_SM_LOCK_CACHED) ? VMCS_SM_CACHE_HOST : ++ VMCS_SM_CACHE_NONE), sm_addr); ++ ++ *data = ioparam.addr; ++ return ret; ++} ++EXPORT_SYMBOL_GPL(vc_sm_map); ++#endif ++ ++late_initcall(vc_sm_init); ++module_exit(vc_sm_exit); ++ ++MODULE_AUTHOR("Broadcom"); ++MODULE_DESCRIPTION("VideoCore SharedMemory Driver"); ++MODULE_LICENSE("GPL v2"); +diff --git a/include/linux/broadcom/vmcs_sm_ioctl.h b/include/linux/broadcom/vmcs_sm_ioctl.h +new file mode 100644 +index 0000000..334f36d +--- /dev/null ++++ b/include/linux/broadcom/vmcs_sm_ioctl.h +@@ -0,0 +1,248 @@ ++/***************************************************************************** ++* Copyright 2011 Broadcom Corporation. All rights reserved. ++* ++* Unless you and Broadcom execute a separate written software license ++* agreement governing use of this software, this software is licensed to you ++* under the terms of the GNU General Public License version 2, available at ++* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). ++* ++* Notwithstanding the above, under no circumstances may you combine this ++* software in any way with any other Broadcom software provided under a ++* license other than the GPL, without Broadcom's express prior written ++* consent. ++* ++*****************************************************************************/ ++ ++#if !defined(__VMCS_SM_IOCTL_H__INCLUDED__) ++#define __VMCS_SM_IOCTL_H__INCLUDED__ ++ ++/* ---- Include Files ---------------------------------------------------- */ ++ ++#if defined(__KERNEL__) ++#include <linux/types.h> /* Needed for standard types */ ++#else ++#include <stdint.h> ++#endif ++ ++#include <linux/ioctl.h> ++ ++/* ---- Constants and Types ---------------------------------------------- */ ++ ++#define VMCS_SM_RESOURCE_NAME 32 ++#define VMCS_SM_RESOURCE_NAME_DEFAULT "sm-host-resource" ++ ++/* Type define used to create unique IOCTL number */ ++#define VMCS_SM_MAGIC_TYPE 'I' ++ ++/* IOCTL commands */ ++enum vmcs_sm_cmd_e { ++ VMCS_SM_CMD_ALLOC = 0x5A, /* Start at 0x5A arbitrarily */ ++ VMCS_SM_CMD_ALLOC_SHARE, ++ VMCS_SM_CMD_LOCK, ++ VMCS_SM_CMD_LOCK_CACHE, ++ VMCS_SM_CMD_UNLOCK, ++ VMCS_SM_CMD_RESIZE, ++ VMCS_SM_CMD_UNMAP, ++ VMCS_SM_CMD_FREE, ++ VMCS_SM_CMD_FLUSH, ++ VMCS_SM_CMD_INVALID, ++ ++ VMCS_SM_CMD_SIZE_USR_HANDLE, ++ VMCS_SM_CMD_CHK_USR_HANDLE, ++ ++ VMCS_SM_CMD_MAPPED_USR_HANDLE, ++ VMCS_SM_CMD_MAPPED_USR_ADDRESS, ++ VMCS_SM_CMD_MAPPED_VC_HDL_FROM_ADDR, ++ VMCS_SM_CMD_MAPPED_VC_HDL_FROM_HDL, ++ VMCS_SM_CMD_MAPPED_VC_ADDR_FROM_HDL, ++ ++ VMCS_SM_CMD_VC_WALK_ALLOC, ++ VMCS_SM_CMD_HOST_WALK_MAP, ++ VMCS_SM_CMD_HOST_WALK_PID_ALLOC, ++ VMCS_SM_CMD_HOST_WALK_PID_MAP, ++ ++ VMCS_SM_CMD_CLEAN_INVALID, ++ ++ VMCS_SM_CMD_LAST /* Do no delete */ ++}; ++ ++/* Cache type supported, conveniently matches the user space definition in ++** user-vcsm.h. ++*/ ++enum vmcs_sm_cache_e { ++ VMCS_SM_CACHE_NONE, ++ VMCS_SM_CACHE_HOST, ++ VMCS_SM_CACHE_VC, ++ VMCS_SM_CACHE_BOTH, ++}; ++ ++/* IOCTL Data structures */ ++struct vmcs_sm_ioctl_alloc { ++ /* user -> kernel */ ++ unsigned int size; ++ unsigned int num; ++ enum vmcs_sm_cache_e cached; ++ char name[VMCS_SM_RESOURCE_NAME]; ++ ++ /* kernel -> user */ ++ unsigned int handle; ++ /* unsigned int base_addr; */ ++}; ++ ++struct vmcs_sm_ioctl_alloc_share { ++ /* user -> kernel */ ++ unsigned int handle; ++ unsigned int size; ++}; ++ ++struct vmcs_sm_ioctl_free { ++ /* user -> kernel */ ++ unsigned int handle; ++ /* unsigned int base_addr; */ ++}; ++ ++struct vmcs_sm_ioctl_lock_unlock { ++ /* user -> kernel */ ++ unsigned int handle; ++ ++ /* kernel -> user */ ++ unsigned int addr; ++}; ++ ++struct vmcs_sm_ioctl_lock_cache { ++ /* user -> kernel */ ++ unsigned int handle; ++ enum vmcs_sm_cache_e cached; ++}; ++ ++struct vmcs_sm_ioctl_resize { ++ /* user -> kernel */ ++ unsigned int handle; ++ unsigned int new_size; ++ ++ /* kernel -> user */ ++ unsigned int old_size; ++}; ++ ++struct vmcs_sm_ioctl_map { ++ /* user -> kernel */ ++ /* and kernel -> user */ ++ unsigned int pid; ++ unsigned int handle; ++ unsigned int addr; ++ ++ /* kernel -> user */ ++ unsigned int size; ++}; ++ ++struct vmcs_sm_ioctl_walk { ++ /* user -> kernel */ ++ unsigned int pid; ++}; ++ ++struct vmcs_sm_ioctl_chk { ++ /* user -> kernel */ ++ unsigned int handle; ++ ++ /* kernel -> user */ ++ unsigned int addr; ++ unsigned int size; ++ enum vmcs_sm_cache_e cache; ++}; ++ ++struct vmcs_sm_ioctl_size { ++ /* user -> kernel */ ++ unsigned int handle; ++ ++ /* kernel -> user */ ++ unsigned int size; ++}; ++ ++struct vmcs_sm_ioctl_cache { ++ /* user -> kernel */ ++ unsigned int handle; ++ unsigned int addr; ++ unsigned int size; ++}; ++ ++struct vmcs_sm_ioctl_clean_invalid { ++ /* user -> kernel */ ++ struct { ++ unsigned int cmd; ++ unsigned int handle; ++ unsigned int addr; ++ unsigned int size; ++ } s[8]; ++}; ++ ++/* IOCTL numbers */ ++#define VMCS_SM_IOCTL_MEM_ALLOC\ ++ _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_ALLOC,\ ++ struct vmcs_sm_ioctl_alloc) ++#define VMCS_SM_IOCTL_MEM_ALLOC_SHARE\ ++ _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_ALLOC_SHARE,\ ++ struct vmcs_sm_ioctl_alloc_share) ++#define VMCS_SM_IOCTL_MEM_LOCK\ ++ _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_LOCK,\ ++ struct vmcs_sm_ioctl_lock_unlock) ++#define VMCS_SM_IOCTL_MEM_LOCK_CACHE\ ++ _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_LOCK_CACHE,\ ++ struct vmcs_sm_ioctl_lock_cache) ++#define VMCS_SM_IOCTL_MEM_UNLOCK\ ++ _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_UNLOCK,\ ++ struct vmcs_sm_ioctl_lock_unlock) ++#define VMCS_SM_IOCTL_MEM_RESIZE\ ++ _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_RESIZE,\ ++ struct vmcs_sm_ioctl_resize) ++#define VMCS_SM_IOCTL_MEM_FREE\ ++ _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_FREE,\ ++ struct vmcs_sm_ioctl_free) ++#define VMCS_SM_IOCTL_MEM_FLUSH\ ++ _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_FLUSH,\ ++ struct vmcs_sm_ioctl_cache) ++#define VMCS_SM_IOCTL_MEM_INVALID\ ++ _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_INVALID,\ ++ struct vmcs_sm_ioctl_cache) ++#define VMCS_SM_IOCTL_MEM_CLEAN_INVALID\ ++ _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_CLEAN_INVALID,\ ++ struct vmcs_sm_ioctl_clean_invalid) ++ ++#define VMCS_SM_IOCTL_SIZE_USR_HDL\ ++ _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_SIZE_USR_HANDLE,\ ++ struct vmcs_sm_ioctl_size) ++#define VMCS_SM_IOCTL_CHK_USR_HDL\ ++ _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_CHK_USR_HANDLE,\ ++ struct vmcs_sm_ioctl_chk) ++ ++#define VMCS_SM_IOCTL_MAP_USR_HDL\ ++ _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_MAPPED_USR_HANDLE,\ ++ struct vmcs_sm_ioctl_map) ++#define VMCS_SM_IOCTL_MAP_USR_ADDRESS\ ++ _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_MAPPED_USR_ADDRESS,\ ++ struct vmcs_sm_ioctl_map) ++#define VMCS_SM_IOCTL_MAP_VC_HDL_FR_ADDR\ ++ _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_MAPPED_VC_HDL_FROM_ADDR,\ ++ struct vmcs_sm_ioctl_map) ++#define VMCS_SM_IOCTL_MAP_VC_HDL_FR_HDL\ ++ _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_MAPPED_VC_HDL_FROM_HDL,\ ++ struct vmcs_sm_ioctl_map) ++#define VMCS_SM_IOCTL_MAP_VC_ADDR_FR_HDL\ ++ _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_MAPPED_VC_ADDR_FROM_HDL,\ ++ struct vmcs_sm_ioctl_map) ++ ++#define VMCS_SM_IOCTL_VC_WALK_ALLOC\ ++ _IO(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_VC_WALK_ALLOC) ++#define VMCS_SM_IOCTL_HOST_WALK_MAP\ ++ _IO(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_HOST_WALK_MAP) ++#define VMCS_SM_IOCTL_HOST_WALK_PID_ALLOC\ ++ _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_HOST_WALK_PID_ALLOC,\ ++ struct vmcs_sm_ioctl_walk) ++#define VMCS_SM_IOCTL_HOST_WALK_PID_MAP\ ++ _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_HOST_WALK_PID_MAP,\ ++ struct vmcs_sm_ioctl_walk) ++ ++/* ---- Variable Externs ------------------------------------------------- */ ++ ++/* ---- Function Prototypes ---------------------------------------------- */ ++ ++#endif /* __VMCS_SM_IOCTL_H__INCLUDED__ */ + +From a8149b98a7e18684c916b50e54b5b4c365bbe530 Mon Sep 17 00:00:00 2001 +From: Luke Wren <luke@raspberrypi.org> +Date: Fri, 21 Aug 2015 23:14:48 +0100 +Subject: [PATCH 044/112] Add /dev/gpiomem device for rootless user GPIO access + +Signed-off-by: Luke Wren <luke@raspberrypi.org> + +bcm2835-gpiomem: Fix for ARCH_BCM2835 builds + +Build on ARCH_BCM2835, and fail to probe if no IO resource. + +See: https://github.com/raspberrypi/linux/issues/1154 +--- + drivers/char/broadcom/Kconfig | 9 ++ + drivers/char/broadcom/Makefile | 3 + + drivers/char/broadcom/bcm2835-gpiomem.c | 260 ++++++++++++++++++++++++++++++++ + 3 files changed, 272 insertions(+) + create mode 100644 drivers/char/broadcom/bcm2835-gpiomem.c + +diff --git a/drivers/char/broadcom/Kconfig b/drivers/char/broadcom/Kconfig +index 75fa1cb..b75c9b2 100644 +--- a/drivers/char/broadcom/Kconfig ++++ b/drivers/char/broadcom/Kconfig +@@ -32,3 +32,12 @@ config BCM_VC_SM + help + Support for the VC shared memory on the Broadcom reference + design. Uses the VCHIQ stack. ++ ++config BCM2835_DEVGPIOMEM ++ tristate "/dev/gpiomem rootless GPIO access via mmap() on the BCM2835" ++ default m ++ help ++ Provides users with root-free access to the GPIO registers ++ on the 2835. Calling mmap(/dev/gpiomem) will map the GPIO ++ register page to the user's pointer. ++ +diff --git a/drivers/char/broadcom/Makefile b/drivers/char/broadcom/Makefile +index de8feb9..1eb06e9 100644 +--- a/drivers/char/broadcom/Makefile ++++ b/drivers/char/broadcom/Makefile +@@ -1,3 +1,6 @@ + obj-$(CONFIG_BCM_VC_CMA) += vc_cma/ + obj-$(CONFIG_BCM2708_VCMEM) += vc_mem.o + obj-$(CONFIG_BCM_VC_SM) += vc_sm/ ++ ++obj-$(CONFIG_BCM2835_DEVGPIOMEM)+= bcm2835-gpiomem.o ++ +diff --git a/drivers/char/broadcom/bcm2835-gpiomem.c b/drivers/char/broadcom/bcm2835-gpiomem.c +new file mode 100644 +index 0000000..911f5b7 +--- /dev/null ++++ b/drivers/char/broadcom/bcm2835-gpiomem.c +@@ -0,0 +1,260 @@ ++/** ++ * GPIO memory device driver ++ * ++ * Creates a chardev /dev/gpiomem which will provide user access to ++ * the BCM2835's GPIO registers when it is mmap()'d. ++ * No longer need root for user GPIO access, but without relaxing permissions ++ * on /dev/mem. ++ * ++ * Written by Luke Wren <luke@raspberrypi.org> ++ * Copyright (c) 2015, Raspberry Pi (Trading) Ltd. ++ * ++ * 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, ++ * without modification. ++ * 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. ++ * 3. The names of the above-listed copyright holders may not be used ++ * to endorse or promote products derived from this software without ++ * specific prior written permission. ++ * ++ * ALTERNATIVELY, this software may be distributed under the terms of the ++ * GNU General Public License ("GPL") version 2, as published by the Free ++ * Software Foundation. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER OR ++ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ++ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, ++ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR ++ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF ++ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING ++ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ */ ++ ++#include <linux/kernel.h> ++#include <linux/module.h> ++#include <linux/of.h> ++#include <linux/platform_device.h> ++#include <linux/mm.h> ++#include <linux/slab.h> ++#include <linux/cdev.h> ++#include <linux/pagemap.h> ++#include <linux/io.h> ++ ++#define DEVICE_NAME "bcm2835-gpiomem" ++#define DRIVER_NAME "gpiomem-bcm2835" ++#define DEVICE_MINOR 0 ++ ++struct bcm2835_gpiomem_instance { ++ unsigned long gpio_regs_phys; ++ struct device *dev; ++}; ++ ++static struct cdev bcm2835_gpiomem_cdev; ++static dev_t bcm2835_gpiomem_devid; ++static struct class *bcm2835_gpiomem_class; ++static struct device *bcm2835_gpiomem_dev; ++static struct bcm2835_gpiomem_instance *inst; ++ ++ ++/**************************************************************************** ++* ++* GPIO mem chardev file ops ++* ++***************************************************************************/ ++ ++static int bcm2835_gpiomem_open(struct inode *inode, struct file *file) ++{ ++ int dev = iminor(inode); ++ int ret = 0; ++ ++ dev_info(inst->dev, "gpiomem device opened."); ++ ++ if (dev != DEVICE_MINOR) { ++ dev_err(inst->dev, "Unknown minor device: %d", dev); ++ ret = -ENXIO; ++ } ++ return ret; ++} ++ ++static int bcm2835_gpiomem_release(struct inode *inode, struct file *file) ++{ ++ int dev = iminor(inode); ++ int ret = 0; ++ ++ if (dev != DEVICE_MINOR) { ++ dev_err(inst->dev, "Unknown minor device %d", dev); ++ ret = -ENXIO; ++ } ++ return ret; ++} ++ ++static const struct vm_operations_struct bcm2835_gpiomem_vm_ops = { ++#ifdef CONFIG_HAVE_IOREMAP_PROT ++ .access = generic_access_phys ++#endif ++}; ++ ++static int bcm2835_gpiomem_mmap(struct file *file, struct vm_area_struct *vma) ++{ ++ /* Ignore what the user says - they're getting the GPIO regs ++ whether they like it or not! */ ++ unsigned long gpio_page = inst->gpio_regs_phys >> PAGE_SHIFT; ++ ++ vma->vm_page_prot = phys_mem_access_prot(file, gpio_page, ++ PAGE_SIZE, ++ vma->vm_page_prot); ++ vma->vm_ops = &bcm2835_gpiomem_vm_ops; ++ if (remap_pfn_range(vma, vma->vm_start, ++ gpio_page, ++ PAGE_SIZE, ++ vma->vm_page_prot)) { ++ return -EAGAIN; ++ } ++ return 0; ++} ++ ++static const struct file_operations ++bcm2835_gpiomem_fops = { ++ .owner = THIS_MODULE, ++ .open = bcm2835_gpiomem_open, ++ .release = bcm2835_gpiomem_release, ++ .mmap = bcm2835_gpiomem_mmap, ++}; ++ ++ ++ /**************************************************************************** ++* ++* Probe and remove functions ++* ++***************************************************************************/ ++ ++ ++static int bcm2835_gpiomem_probe(struct platform_device *pdev) ++{ ++ int err; ++ void *ptr_err; ++ struct device *dev = &pdev->dev; ++ struct resource *ioresource; ++ ++ /* Allocate buffers and instance data */ ++ ++ inst = kzalloc(sizeof(struct bcm2835_gpiomem_instance), GFP_KERNEL); ++ ++ if (!inst) { ++ err = -ENOMEM; ++ goto failed_inst_alloc; ++ } ++ ++ inst->dev = dev; ++ ++ ioresource = platform_get_resource(pdev, IORESOURCE_MEM, 0); ++ if (ioresource) { ++ inst->gpio_regs_phys = ioresource->start; ++ } else { ++ dev_err(inst->dev, "failed to get IO resource"); ++ err = -ENOENT; ++ goto failed_get_resource; ++ } ++ ++ /* Create character device entries */ ++ ++ err = alloc_chrdev_region(&bcm2835_gpiomem_devid, ++ DEVICE_MINOR, 1, DEVICE_NAME); ++ if (err != 0) { ++ dev_err(inst->dev, "unable to allocate device number"); ++ goto failed_alloc_chrdev; ++ } ++ cdev_init(&bcm2835_gpiomem_cdev, &bcm2835_gpiomem_fops); ++ bcm2835_gpiomem_cdev.owner = THIS_MODULE; ++ err = cdev_add(&bcm2835_gpiomem_cdev, bcm2835_gpiomem_devid, 1); ++ if (err != 0) { ++ dev_err(inst->dev, "unable to register device"); ++ goto failed_cdev_add; ++ } ++ ++ /* Create sysfs entries */ ++ ++ bcm2835_gpiomem_class = class_create(THIS_MODULE, DEVICE_NAME); ++ ptr_err = bcm2835_gpiomem_class; ++ if (IS_ERR(ptr_err)) ++ goto failed_class_create; ++ ++ bcm2835_gpiomem_dev = device_create(bcm2835_gpiomem_class, NULL, ++ bcm2835_gpiomem_devid, NULL, ++ "gpiomem"); ++ ptr_err = bcm2835_gpiomem_dev; ++ if (IS_ERR(ptr_err)) ++ goto failed_device_create; ++ ++ dev_info(inst->dev, "Initialised: Registers at 0x%08lx", ++ inst->gpio_regs_phys); ++ ++ return 0; ++ ++failed_device_create: ++ class_destroy(bcm2835_gpiomem_class); ++failed_class_create: ++ cdev_del(&bcm2835_gpiomem_cdev); ++ err = PTR_ERR(ptr_err); ++failed_cdev_add: ++ unregister_chrdev_region(bcm2835_gpiomem_devid, 1); ++failed_alloc_chrdev: ++failed_get_resource: ++ kfree(inst); ++failed_inst_alloc: ++ dev_err(inst->dev, "could not load bcm2835_gpiomem"); ++ return err; ++} ++ ++static int bcm2835_gpiomem_remove(struct platform_device *pdev) ++{ ++ struct device *dev = inst->dev; ++ ++ kfree(inst); ++ device_destroy(bcm2835_gpiomem_class, bcm2835_gpiomem_devid); ++ class_destroy(bcm2835_gpiomem_class); ++ cdev_del(&bcm2835_gpiomem_cdev); ++ unregister_chrdev_region(bcm2835_gpiomem_devid, 1); ++ ++ dev_info(dev, "GPIO mem driver removed - OK"); ++ return 0; ++} ++ ++ /**************************************************************************** ++* ++* Register the driver with device tree ++* ++***************************************************************************/ ++ ++static const struct of_device_id bcm2835_gpiomem_of_match[] = { ++ {.compatible = "brcm,bcm2835-gpiomem",}, ++ { /* sentinel */ }, ++}; ++ ++MODULE_DEVICE_TABLE(of, bcm2835_gpiomem_of_match); ++ ++static struct platform_driver bcm2835_gpiomem_driver = { ++ .probe = bcm2835_gpiomem_probe, ++ .remove = bcm2835_gpiomem_remove, ++ .driver = { ++ .name = DRIVER_NAME, ++ .owner = THIS_MODULE, ++ .of_match_table = bcm2835_gpiomem_of_match, ++ }, ++}; ++ ++module_platform_driver(bcm2835_gpiomem_driver); ++ ++MODULE_ALIAS("platform:gpiomem-bcm2835"); ++MODULE_LICENSE("GPL"); ++MODULE_DESCRIPTION("gpiomem driver for accessing GPIO from userspace"); ++MODULE_AUTHOR("Luke Wren <luke@raspberrypi.org>"); + +From e4a7770dc5ecfcd28d0caef360659afd54bb95e5 Mon Sep 17 00:00:00 2001 +From: Luke Wren <wren6991@gmail.com> +Date: Sat, 5 Sep 2015 01:14:45 +0100 +Subject: [PATCH 045/112] Add SMI driver + +Signed-off-by: Luke Wren <wren6991@gmail.com> +--- + .../bindings/misc/brcm,bcm2835-smi-dev.txt | 17 + + .../devicetree/bindings/misc/brcm,bcm2835-smi.txt | 48 + + drivers/char/broadcom/Kconfig | 8 + + drivers/char/broadcom/Makefile | 2 +- + drivers/char/broadcom/bcm2835_smi_dev.c | 402 +++++++++ + drivers/misc/Kconfig | 8 + + drivers/misc/Makefile | 1 + + drivers/misc/bcm2835_smi.c | 985 +++++++++++++++++++++ + include/linux/broadcom/bcm2835_smi.h | 391 ++++++++ + 9 files changed, 1861 insertions(+), 1 deletion(-) + create mode 100644 Documentation/devicetree/bindings/misc/brcm,bcm2835-smi-dev.txt + create mode 100644 Documentation/devicetree/bindings/misc/brcm,bcm2835-smi.txt + create mode 100644 drivers/char/broadcom/bcm2835_smi_dev.c + create mode 100644 drivers/misc/bcm2835_smi.c + create mode 100644 include/linux/broadcom/bcm2835_smi.h + +diff --git a/Documentation/devicetree/bindings/misc/brcm,bcm2835-smi-dev.txt b/Documentation/devicetree/bindings/misc/brcm,bcm2835-smi-dev.txt +new file mode 100644 +index 0000000..68cc8eb +--- /dev/null ++++ b/Documentation/devicetree/bindings/misc/brcm,bcm2835-smi-dev.txt +@@ -0,0 +1,17 @@ ++* Broadcom BCM2835 SMI character device driver. ++ ++SMI or secondary memory interface is a peripheral specific to certain Broadcom ++SOCs, and is helpful for talking to things like parallel-interface displays ++and NAND flashes (in fact, most things with a parallel register interface). ++ ++This driver adds a character device which provides a user-space interface to ++an instance of the SMI driver. ++ ++Required properties: ++- compatible: "brcm,bcm2835-smi-dev" ++- smi_handle: a phandle to the smi node. ++ ++Optional properties: ++- None. ++ ++ +diff --git a/Documentation/devicetree/bindings/misc/brcm,bcm2835-smi.txt b/Documentation/devicetree/bindings/misc/brcm,bcm2835-smi.txt +new file mode 100644 +index 0000000..b76dc69 +--- /dev/null ++++ b/Documentation/devicetree/bindings/misc/brcm,bcm2835-smi.txt +@@ -0,0 +1,48 @@ ++* Broadcom BCM2835 SMI driver. ++ ++SMI or secondary memory interface is a peripheral specific to certain Broadcom ++SOCs, and is helpful for talking to things like parallel-interface displays ++and NAND flashes (in fact, most things with a parallel register interface). ++ ++Required properties: ++- compatible: "brcm,bcm2835-smi" ++- reg: Should contain location and length of SMI registers and SMI clkman regs ++- interrupts: *the* SMI interrupt. ++- pinctrl-names: should be "default". ++- pinctrl-0: the phandle of the gpio pin node. ++- brcm,smi-clock-source: the clock source for clkman ++- brcm,smi-clock-divisor: the integer clock divisor for clkman ++- dmas: the dma controller phandle and the DREQ number (4 on a 2835) ++- dma-names: the name used by the driver to request its channel. ++ Should be "rx-tx". ++ ++Optional properties: ++- None. ++ ++Examples: ++ ++8 data pin configuration: ++ ++smi: smi@7e600000 { ++ compatible = "brcm,bcm2835-smi"; ++ reg = <0x7e600000 0x44>, <0x7e1010b0 0x8>; ++ interrupts = <2 16>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&smi_pins>; ++ brcm,smi-clock-source = <6>; ++ brcm,smi-clock-divisor = <4>; ++ dmas = <&dma 4>; ++ dma-names = "rx-tx"; ++ ++ status = "okay"; ++}; ++ ++smi_pins: smi_pins { ++ brcm,pins = <2 3 4 5 6 7 8 9 10 11 12 13 14 15>; ++ /* Alt 1: SMI */ ++ brcm,function = <5 5 5 5 5 5 5 5 5 5 5 5 5 5>; ++ /* /CS, /WE and /OE are pulled high, as they are ++ generally active low signals */ ++ brcm,pull = <2 2 2 2 2 2 0 0 0 0 0 0 0 0>; ++}; ++ +diff --git a/drivers/char/broadcom/Kconfig b/drivers/char/broadcom/Kconfig +index b75c9b2..2292ed2 100644 +--- a/drivers/char/broadcom/Kconfig ++++ b/drivers/char/broadcom/Kconfig +@@ -41,3 +41,11 @@ config BCM2835_DEVGPIOMEM + on the 2835. Calling mmap(/dev/gpiomem) will map the GPIO + register page to the user's pointer. + ++config BCM2835_SMI_DEV ++ tristate "Character device driver for BCM2835 Secondary Memory Interface" ++ depends on (MACH_BCM2708 || MACH_BCM2709 || ARCH_BCM2835) && BCM2835_SMI ++ default m ++ help ++ This driver provides a character device interface (ioctl + read/write) to ++ Broadcom's Secondary Memory interface. The low-level functionality is provided ++ by the SMI driver itself. +diff --git a/drivers/char/broadcom/Makefile b/drivers/char/broadcom/Makefile +index 1eb06e9..667d33e 100644 +--- a/drivers/char/broadcom/Makefile ++++ b/drivers/char/broadcom/Makefile +@@ -3,4 +3,4 @@ obj-$(CONFIG_BCM2708_VCMEM) += vc_mem.o + obj-$(CONFIG_BCM_VC_SM) += vc_sm/ + + obj-$(CONFIG_BCM2835_DEVGPIOMEM)+= bcm2835-gpiomem.o +- ++obj-$(CONFIG_BCM2835_SMI_DEV) += bcm2835_smi_dev.o +diff --git a/drivers/char/broadcom/bcm2835_smi_dev.c b/drivers/char/broadcom/bcm2835_smi_dev.c +new file mode 100644 +index 0000000..d6efd92 +--- /dev/null ++++ b/drivers/char/broadcom/bcm2835_smi_dev.c +@@ -0,0 +1,402 @@ ++/** ++ * Character device driver for Broadcom Secondary Memory Interface ++ * ++ * Written by Luke Wren <luke@raspberrypi.org> ++ * Copyright (c) 2015, Raspberry Pi (Trading) Ltd. ++ * ++ * 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, ++ * without modification. ++ * 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. ++ * 3. The names of the above-listed copyright holders may not be used ++ * to endorse or promote products derived from this software without ++ * specific prior written permission. ++ * ++ * ALTERNATIVELY, this software may be distributed under the terms of the ++ * GNU General Public License ("GPL") version 2, as published by the Free ++ * Software Foundation. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER OR ++ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ++ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, ++ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR ++ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF ++ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING ++ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ */ ++ ++#include <linux/kernel.h> ++#include <linux/module.h> ++#include <linux/of.h> ++#include <linux/platform_device.h> ++#include <linux/slab.h> ++#include <linux/mm.h> ++#include <linux/pagemap.h> ++#include <linux/fs.h> ++#include <linux/cdev.h> ++#include <linux/fs.h> ++ ++#include <linux/broadcom/bcm2835_smi.h> ++ ++#define DEVICE_NAME "bcm2835-smi-dev" ++#define DRIVER_NAME "smi-dev-bcm2835" ++#define DEVICE_MINOR 0 ++ ++static struct cdev bcm2835_smi_cdev; ++static dev_t bcm2835_smi_devid; ++static struct class *bcm2835_smi_class; ++static struct device *bcm2835_smi_dev; ++ ++struct bcm2835_smi_dev_instance { ++ struct device *dev; ++}; ++ ++static struct bcm2835_smi_instance *smi_inst; ++static struct bcm2835_smi_dev_instance *inst; ++ ++static const char *const ioctl_names[] = { ++ "READ_SETTINGS", ++ "WRITE_SETTINGS", ++ "ADDRESS" ++}; ++ ++/**************************************************************************** ++* ++* SMI chardev file ops ++* ++***************************************************************************/ ++static long ++bcm2835_smi_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ++{ ++ long ret = 0; ++ ++ dev_info(inst->dev, "serving ioctl..."); ++ ++ switch (cmd) { ++ case BCM2835_SMI_IOC_GET_SETTINGS:{ ++ struct smi_settings *settings; ++ ++ dev_info(inst->dev, "Reading SMI settings to user."); ++ settings = bcm2835_smi_get_settings_from_regs(smi_inst); ++ if (copy_to_user((void *)arg, settings, ++ sizeof(struct smi_settings))) ++ dev_err(inst->dev, "settings copy failed."); ++ break; ++ } ++ case BCM2835_SMI_IOC_WRITE_SETTINGS:{ ++ struct smi_settings *settings; ++ ++ dev_info(inst->dev, "Setting user's SMI settings."); ++ settings = bcm2835_smi_get_settings_from_regs(smi_inst); ++ if (copy_from_user(settings, (void *)arg, ++ sizeof(struct smi_settings))) ++ dev_err(inst->dev, "settings copy failed."); ++ else ++ bcm2835_smi_set_regs_from_settings(smi_inst); ++ break; ++ } ++ case BCM2835_SMI_IOC_ADDRESS: ++ dev_info(inst->dev, "SMI address set: 0x%02x", (int)arg); ++ bcm2835_smi_set_address(smi_inst, arg); ++ break; ++ default: ++ dev_err(inst->dev, "invalid ioctl cmd: %d", cmd); ++ ret = -ENOTTY; ++ break; ++ } ++ ++ return ret; ++} ++ ++static int bcm2835_smi_open(struct inode *inode, struct file *file) ++{ ++ int dev = iminor(inode); ++ ++ dev_dbg(inst->dev, "SMI device opened."); ++ ++ if (dev != DEVICE_MINOR) { ++ dev_err(inst->dev, ++ "bcm2835_smi_release: Unknown minor device: %d", ++ dev); ++ return -ENXIO; ++ } ++ ++ return 0; ++} ++ ++static int bcm2835_smi_release(struct inode *inode, struct file *file) ++{ ++ int dev = iminor(inode); ++ ++ if (dev != DEVICE_MINOR) { ++ dev_err(inst->dev, ++ "bcm2835_smi_release: Unknown minor device %d", dev); ++ return -ENXIO; ++ } ++ ++ return 0; ++} ++ ++static ssize_t dma_bounce_user( ++ enum dma_transfer_direction dma_dir, ++ char __user *user_ptr, ++ size_t count, ++ struct bcm2835_smi_bounce_info *bounce) ++{ ++ int chunk_size; ++ int chunk_no = 0; ++ int count_left = count; ++ ++ while (count_left) { ++ int rv; ++ void *buf; ++ ++ /* Wait for current chunk to complete: */ ++ if (down_timeout(&bounce->callback_sem, ++ msecs_to_jiffies(1000))) { ++ dev_err(inst->dev, "DMA bounce timed out"); ++ count -= (count_left); ++ break; ++ } ++ ++ if (bounce->callback_sem.count >= DMA_BOUNCE_BUFFER_COUNT - 1) ++ dev_err(inst->dev, "WARNING: Ring buffer overflow"); ++ chunk_size = count_left > DMA_BOUNCE_BUFFER_SIZE ? ++ DMA_BOUNCE_BUFFER_SIZE : count_left; ++ buf = bounce->buffer[chunk_no % DMA_BOUNCE_BUFFER_COUNT]; ++ if (dma_dir == DMA_DEV_TO_MEM) ++ rv = copy_to_user(user_ptr, buf, chunk_size); ++ else ++ rv = copy_from_user(buf, user_ptr, chunk_size); ++ if (rv) ++ dev_err(inst->dev, "copy_*_user() failed!: %d", rv); ++ user_ptr += chunk_size; ++ count_left -= chunk_size; ++ chunk_no++; ++ } ++ return count; ++} ++ ++static ssize_t ++bcm2835_read_file(struct file *f, char __user *user_ptr, ++ size_t count, loff_t *offs) ++{ ++ int odd_bytes; ++ ++ dev_dbg(inst->dev, "User reading %d bytes from SMI.", count); ++ /* We don't want to DMA a number of bytes % 4 != 0 (32 bit FIFO) */ ++ if (count > DMA_THRESHOLD_BYTES) ++ odd_bytes = count & 0x3; ++ else ++ odd_bytes = count; ++ count -= odd_bytes; ++ if (count) { ++ struct bcm2835_smi_bounce_info *bounce; ++ ++ count = bcm2835_smi_user_dma(smi_inst, ++ DMA_DEV_TO_MEM, user_ptr, count, ++ &bounce); ++ if (count) ++ count = dma_bounce_user(DMA_DEV_TO_MEM, user_ptr, ++ count, bounce); ++ } ++ if (odd_bytes) { ++ /* Read from FIFO directly if not using DMA */ ++ uint8_t buf[DMA_THRESHOLD_BYTES]; ++ ++ bcm2835_smi_read_buf(smi_inst, buf, odd_bytes); ++ if (copy_to_user(user_ptr, buf, odd_bytes)) ++ dev_err(inst->dev, "copy_to_user() failed."); ++ count += odd_bytes; ++ ++ } ++ return count; ++} ++ ++static ssize_t ++bcm2835_write_file(struct file *f, const char __user *user_ptr, ++ size_t count, loff_t *offs) ++{ ++ int odd_bytes; ++ ++ dev_dbg(inst->dev, "User writing %d bytes to SMI.", count); ++ if (count > DMA_THRESHOLD_BYTES) ++ odd_bytes = count & 0x3; ++ else ++ odd_bytes = count; ++ count -= odd_bytes; ++ if (count) { ++ struct bcm2835_smi_bounce_info *bounce; ++ ++ count = bcm2835_smi_user_dma(smi_inst, ++ DMA_MEM_TO_DEV, (char __user *)user_ptr, count, ++ &bounce); ++ if (count) ++ count = dma_bounce_user(DMA_MEM_TO_DEV, ++ (char __user *)user_ptr, ++ count, bounce); ++ } ++ if (odd_bytes) { ++ uint8_t buf[DMA_THRESHOLD_BYTES]; ++ ++ if (copy_from_user(buf, user_ptr, odd_bytes)) ++ dev_err(inst->dev, "copy_from_user() failed."); ++ else ++ bcm2835_smi_write_buf(smi_inst, buf, odd_bytes); ++ count += odd_bytes; ++ } ++ return count; ++} ++ ++static const struct file_operations ++bcm2835_smi_fops = { ++ .owner = THIS_MODULE, ++ .unlocked_ioctl = bcm2835_smi_ioctl, ++ .open = bcm2835_smi_open, ++ .release = bcm2835_smi_release, ++ .read = bcm2835_read_file, ++ .write = bcm2835_write_file, ++}; ++ ++ ++/**************************************************************************** ++* ++* bcm2835_smi_probe - called when the driver is loaded. ++* ++***************************************************************************/ ++ ++static int bcm2835_smi_dev_probe(struct platform_device *pdev) ++{ ++ int err; ++ void *ptr_err; ++ struct device *dev = &pdev->dev; ++ struct device_node *node = dev->of_node, *smi_node; ++ ++ if (!node) { ++ dev_err(dev, "No device tree node supplied!"); ++ return -EINVAL; ++ } ++ ++ smi_node = of_parse_phandle(node, "smi_handle", 0); ++ ++ if (!smi_node) { ++ dev_err(dev, "No such property: smi_handle"); ++ return -ENXIO; ++ } ++ ++ smi_inst = bcm2835_smi_get(smi_node); ++ ++ if (!smi_inst) ++ return -EPROBE_DEFER; ++ ++ /* Allocate buffers and instance data */ ++ ++ inst = devm_kzalloc(dev, sizeof(*inst), GFP_KERNEL); ++ ++ if (!inst) ++ return -ENOMEM; ++ ++ inst->dev = dev; ++ ++ /* Create character device entries */ ++ ++ err = alloc_chrdev_region(&bcm2835_smi_devid, ++ DEVICE_MINOR, 1, DEVICE_NAME); ++ if (err != 0) { ++ dev_err(inst->dev, "unable to allocate device number"); ++ return -ENOMEM; ++ } ++ cdev_init(&bcm2835_smi_cdev, &bcm2835_smi_fops); ++ bcm2835_smi_cdev.owner = THIS_MODULE; ++ err = cdev_add(&bcm2835_smi_cdev, bcm2835_smi_devid, 1); ++ if (err != 0) { ++ dev_err(inst->dev, "unable to register device"); ++ err = -ENOMEM; ++ goto failed_cdev_add; ++ } ++ ++ /* Create sysfs entries */ ++ ++ bcm2835_smi_class = class_create(THIS_MODULE, DEVICE_NAME); ++ ptr_err = bcm2835_smi_class; ++ if (IS_ERR(ptr_err)) ++ goto failed_class_create; ++ ++ bcm2835_smi_dev = device_create(bcm2835_smi_class, NULL, ++ bcm2835_smi_devid, NULL, ++ "smi"); ++ ptr_err = bcm2835_smi_dev; ++ if (IS_ERR(ptr_err)) ++ goto failed_device_create; ++ ++ dev_info(inst->dev, "initialised"); ++ ++ return 0; ++ ++failed_device_create: ++ class_destroy(bcm2835_smi_class); ++failed_class_create: ++ cdev_del(&bcm2835_smi_cdev); ++ err = PTR_ERR(ptr_err); ++failed_cdev_add: ++ unregister_chrdev_region(bcm2835_smi_devid, 1); ++ dev_err(dev, "could not load bcm2835_smi_dev"); ++ return err; ++} ++ ++/**************************************************************************** ++* ++* bcm2835_smi_remove - called when the driver is unloaded. ++* ++***************************************************************************/ ++ ++static int bcm2835_smi_dev_remove(struct platform_device *pdev) ++{ ++ device_destroy(bcm2835_smi_class, bcm2835_smi_devid); ++ class_destroy(bcm2835_smi_class); ++ cdev_del(&bcm2835_smi_cdev); ++ unregister_chrdev_region(bcm2835_smi_devid, 1); ++ ++ dev_info(inst->dev, "SMI character dev removed - OK"); ++ return 0; ++} ++ ++/**************************************************************************** ++* ++* Register the driver with device tree ++* ++***************************************************************************/ ++ ++static const struct of_device_id bcm2835_smi_dev_of_match[] = { ++ {.compatible = "brcm,bcm2835-smi-dev",}, ++ { /* sentinel */ }, ++}; ++ ++MODULE_DEVICE_TABLE(of, bcm2835_smi_dev_of_match); ++ ++static struct platform_driver bcm2835_smi_dev_driver = { ++ .probe = bcm2835_smi_dev_probe, ++ .remove = bcm2835_smi_dev_remove, ++ .driver = { ++ .name = DRIVER_NAME, ++ .owner = THIS_MODULE, ++ .of_match_table = bcm2835_smi_dev_of_match, ++ }, ++}; ++ ++module_platform_driver(bcm2835_smi_dev_driver); ++ ++MODULE_ALIAS("platform:smi-dev-bcm2835"); ++MODULE_LICENSE("GPL"); ++MODULE_DESCRIPTION( ++ "Character device driver for BCM2835's secondary memory interface"); ++MODULE_AUTHOR("Luke Wren <luke@raspberrypi.org>"); +diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig +index 90af750..7011b2d 100644 +--- a/drivers/misc/Kconfig ++++ b/drivers/misc/Kconfig +@@ -10,6 +10,14 @@ config SENSORS_LIS3LV02D + select INPUT_POLLDEV + default n + ++config BCM2835_SMI ++ tristate "Broadcom 283x Secondary Memory Interface driver" ++ depends on MACH_BCM2708 || MACH_BCM2709 || ARCH_BCM2835 ++ default m ++ help ++ Driver for enabling and using Broadcom's Secondary/Slow Memory Interface. ++ Appears as /dev/bcm2835_smi. For ioctl interface see drivers/misc/bcm2835_smi.h ++ + config AD525X_DPOT + tristate "Analog Devices Digital Potentiometers" + depends on (I2C || SPI) && SYSFS +diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile +index 1a58cf7..28989fa 100644 +--- a/drivers/misc/Makefile ++++ b/drivers/misc/Makefile +@@ -9,6 +9,7 @@ obj-$(CONFIG_AD525X_DPOT_SPI) += ad525x_dpot-spi.o + obj-$(CONFIG_INTEL_MID_PTI) += pti.o + obj-$(CONFIG_ATMEL_SSC) += atmel-ssc.o + obj-$(CONFIG_ATMEL_TCLIB) += atmel_tclib.o ++obj-$(CONFIG_BCM2835_SMI) += bcm2835_smi.o + obj-$(CONFIG_BMP085) += bmp085.o + obj-$(CONFIG_BMP085_I2C) += bmp085-i2c.o + obj-$(CONFIG_BMP085_SPI) += bmp085-spi.o +diff --git a/drivers/misc/bcm2835_smi.c b/drivers/misc/bcm2835_smi.c +new file mode 100644 +index 0000000..63a4ea0 +--- /dev/null ++++ b/drivers/misc/bcm2835_smi.c +@@ -0,0 +1,985 @@ ++/** ++ * Broadcom Secondary Memory Interface driver ++ * ++ * Written by Luke Wren <luke@raspberrypi.org> ++ * Copyright (c) 2015, Raspberry Pi (Trading) Ltd. ++ * ++ * 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, ++ * without modification. ++ * 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. ++ * 3. The names of the above-listed copyright holders may not be used ++ * to endorse or promote products derived from this software without ++ * specific prior written permission. ++ * ++ * ALTERNATIVELY, this software may be distributed under the terms of the ++ * GNU General Public License ("GPL") version 2, as published by the Free ++ * Software Foundation. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER OR ++ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ++ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, ++ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR ++ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF ++ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING ++ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ */ ++ ++#include <linux/kernel.h> ++#include <linux/module.h> ++#include <linux/of.h> ++#include <linux/platform_device.h> ++#include <linux/of_address.h> ++#include <linux/of_platform.h> ++#include <linux/mm.h> ++#include <linux/slab.h> ++#include <linux/pagemap.h> ++#include <linux/dma-mapping.h> ++#include <linux/dmaengine.h> ++#include <linux/semaphore.h> ++#include <linux/spinlock.h> ++#include <linux/io.h> ++ ++#define BCM2835_SMI_IMPLEMENTATION ++#include <linux/broadcom/bcm2835_smi.h> ++ ++#define DRIVER_NAME "smi-bcm2835" ++ ++#define N_PAGES_FROM_BYTES(n) ((n + PAGE_SIZE-1) / PAGE_SIZE) ++ ++#define DMA_WRITE_TO_MEM true ++#define DMA_READ_FROM_MEM false ++ ++struct bcm2835_smi_instance { ++ struct device *dev; ++ struct smi_settings settings; ++ __iomem void *smi_regs_ptr, *cm_smi_regs_ptr; ++ dma_addr_t smi_regs_busaddr; ++ ++ struct dma_chan *dma_chan; ++ struct dma_slave_config dma_config; ++ ++ struct bcm2835_smi_bounce_info bounce; ++ ++ struct scatterlist buffer_sgl; ++ ++ int clock_source; ++ int clock_divisor; ++ ++ /* Sometimes we are called into in an atomic context (e.g. by ++ JFFS2 + MTD) so we can't use a mutex */ ++ spinlock_t transaction_lock; ++}; ++ ++/**************************************************************************** ++* ++* SMI clock manager setup ++* ++***************************************************************************/ ++ ++static inline void write_smi_cm_reg(struct bcm2835_smi_instance *inst, ++ u32 val, unsigned reg) ++{ ++ writel(CM_PWD | val, inst->cm_smi_regs_ptr + reg); ++} ++ ++static inline u32 read_smi_cm_reg(struct bcm2835_smi_instance *inst, ++ unsigned reg) ++{ ++ return readl(inst->cm_smi_regs_ptr + reg); ++} ++ ++static void smi_setup_clock(struct bcm2835_smi_instance *inst) ++{ ++ dev_dbg(inst->dev, "Setting up clock..."); ++ /* Disable SMI clock and wait for it to stop. */ ++ write_smi_cm_reg(inst, 0, CM_SMI_CTL); ++ while (read_smi_cm_reg(inst, CM_SMI_CTL) & CM_SMI_CTL_BUSY) ++ ; ++ ++ write_smi_cm_reg(inst, (inst->clock_divisor << CM_SMI_DIV_DIVI_OFFS), ++ CM_SMI_DIV); ++ write_smi_cm_reg(inst, (inst->clock_source << CM_SMI_CTL_SRC_OFFS), ++ CM_SMI_CTL); ++ ++ /* Enable the clock */ ++ write_smi_cm_reg(inst, (inst->clock_source << CM_SMI_CTL_SRC_OFFS) | ++ CM_SMI_CTL_ENAB, CM_SMI_CTL); ++} ++ ++/**************************************************************************** ++* ++* SMI peripheral setup ++* ++***************************************************************************/ ++ ++static inline void write_smi_reg(struct bcm2835_smi_instance *inst, ++ u32 val, unsigned reg) ++{ ++ writel(val, inst->smi_regs_ptr + reg); ++} ++ ++static inline u32 read_smi_reg(struct bcm2835_smi_instance *inst, unsigned reg) ++{ ++ return readl(inst->smi_regs_ptr + reg); ++} ++ ++/* Token-paste macro for e.g SMIDSR_RSTROBE -> value of SMIDSR_RSTROBE_MASK */ ++#define _CONCAT(x, y) x##y ++#define CONCAT(x, y) _CONCAT(x, y) ++ ++#define SET_BIT_FIELD(dest, field, bits) ((dest) = \ ++ ((dest) & ~CONCAT(field, _MASK)) | (((bits) << CONCAT(field, _OFFS))& \ ++ CONCAT(field, _MASK))) ++#define GET_BIT_FIELD(src, field) (((src) & \ ++ CONCAT(field, _MASK)) >> CONCAT(field, _OFFS)) ++ ++static void smi_dump_context_labelled(struct bcm2835_smi_instance *inst, ++ const char *label) ++{ ++ dev_err(inst->dev, "SMI context dump: %s", label); ++ dev_err(inst->dev, "SMICS: 0x%08x", read_smi_reg(inst, SMICS)); ++ dev_err(inst->dev, "SMIL: 0x%08x", read_smi_reg(inst, SMIL)); ++ dev_err(inst->dev, "SMIDSR: 0x%08x", read_smi_reg(inst, SMIDSR0)); ++ dev_err(inst->dev, "SMIDSW: 0x%08x", read_smi_reg(inst, SMIDSW0)); ++ dev_err(inst->dev, "SMIDC: 0x%08x", read_smi_reg(inst, SMIDC)); ++ dev_err(inst->dev, "SMIFD: 0x%08x", read_smi_reg(inst, SMIFD)); ++ dev_err(inst->dev, " "); ++} ++ ++static inline void smi_dump_context(struct bcm2835_smi_instance *inst) ++{ ++ smi_dump_context_labelled(inst, ""); ++} ++ ++static void smi_get_default_settings(struct bcm2835_smi_instance *inst) ++{ ++ struct smi_settings *settings = &inst->settings; ++ ++ settings->data_width = SMI_WIDTH_16BIT; ++ settings->pack_data = true; ++ ++ settings->read_setup_time = 1; ++ settings->read_hold_time = 1; ++ settings->read_pace_time = 1; ++ settings->read_strobe_time = 3; ++ ++ settings->write_setup_time = settings->read_setup_time; ++ settings->write_hold_time = settings->read_hold_time; ++ settings->write_pace_time = settings->read_pace_time; ++ settings->write_strobe_time = settings->read_strobe_time; ++ ++ settings->dma_enable = true; ++ settings->dma_passthrough_enable = false; ++ settings->dma_read_thresh = 0x01; ++ settings->dma_write_thresh = 0x3f; ++ settings->dma_panic_read_thresh = 0x20; ++ settings->dma_panic_write_thresh = 0x20; ++} ++ ++void bcm2835_smi_set_regs_from_settings(struct bcm2835_smi_instance *inst) ++{ ++ struct smi_settings *settings = &inst->settings; ++ int smidsr_temp = 0, smidsw_temp = 0, smics_temp, ++ smidcs_temp, smidc_temp = 0; ++ ++ spin_lock(&inst->transaction_lock); ++ ++ /* temporarily disable the peripheral: */ ++ smics_temp = read_smi_reg(inst, SMICS); ++ write_smi_reg(inst, 0, SMICS); ++ smidcs_temp = read_smi_reg(inst, SMIDCS); ++ write_smi_reg(inst, 0, SMIDCS); ++ ++ if (settings->pack_data) ++ smics_temp |= SMICS_PXLDAT; ++ else ++ smics_temp &= ~SMICS_PXLDAT; ++ ++ SET_BIT_FIELD(smidsr_temp, SMIDSR_RWIDTH, settings->data_width); ++ SET_BIT_FIELD(smidsr_temp, SMIDSR_RSETUP, settings->read_setup_time); ++ SET_BIT_FIELD(smidsr_temp, SMIDSR_RHOLD, settings->read_hold_time); ++ SET_BIT_FIELD(smidsr_temp, SMIDSR_RPACE, settings->read_pace_time); ++ SET_BIT_FIELD(smidsr_temp, SMIDSR_RSTROBE, settings->read_strobe_time); ++ write_smi_reg(inst, smidsr_temp, SMIDSR0); ++ ++ SET_BIT_FIELD(smidsw_temp, SMIDSW_WWIDTH, settings->data_width); ++ if (settings->data_width == SMI_WIDTH_8BIT) ++ smidsw_temp |= SMIDSW_WSWAP; ++ else ++ smidsw_temp &= ~SMIDSW_WSWAP; ++ SET_BIT_FIELD(smidsw_temp, SMIDSW_WSETUP, settings->write_setup_time); ++ SET_BIT_FIELD(smidsw_temp, SMIDSW_WHOLD, settings->write_hold_time); ++ SET_BIT_FIELD(smidsw_temp, SMIDSW_WPACE, settings->write_pace_time); ++ SET_BIT_FIELD(smidsw_temp, SMIDSW_WSTROBE, ++ settings->write_strobe_time); ++ write_smi_reg(inst, smidsw_temp, SMIDSW0); ++ ++ SET_BIT_FIELD(smidc_temp, SMIDC_REQR, settings->dma_read_thresh); ++ SET_BIT_FIELD(smidc_temp, SMIDC_REQW, settings->dma_write_thresh); ++ SET_BIT_FIELD(smidc_temp, SMIDC_PANICR, ++ settings->dma_panic_read_thresh); ++ SET_BIT_FIELD(smidc_temp, SMIDC_PANICW, ++ settings->dma_panic_write_thresh); ++ if (settings->dma_passthrough_enable) { ++ smidc_temp |= SMIDC_DMAP; ++ smidsr_temp |= SMIDSR_RDREQ; ++ write_smi_reg(inst, smidsr_temp, SMIDSR0); ++ smidsw_temp |= SMIDSW_WDREQ; ++ write_smi_reg(inst, smidsw_temp, SMIDSW0); ++ } else ++ smidc_temp &= ~SMIDC_DMAP; ++ if (settings->dma_enable) ++ smidc_temp |= SMIDC_DMAEN; ++ else ++ smidc_temp &= ~SMIDC_DMAEN; ++ ++ write_smi_reg(inst, smidc_temp, SMIDC); ++ ++ /* re-enable (if was previously enabled) */ ++ write_smi_reg(inst, smics_temp, SMICS); ++ write_smi_reg(inst, smidcs_temp, SMIDCS); ++ ++ spin_unlock(&inst->transaction_lock); ++} ++EXPORT_SYMBOL(bcm2835_smi_set_regs_from_settings); ++ ++struct smi_settings *bcm2835_smi_get_settings_from_regs ++ (struct bcm2835_smi_instance *inst) ++{ ++ struct smi_settings *settings = &inst->settings; ++ int smidsr, smidsw, smidc; ++ ++ spin_lock(&inst->transaction_lock); ++ ++ smidsr = read_smi_reg(inst, SMIDSR0); ++ smidsw = read_smi_reg(inst, SMIDSW0); ++ smidc = read_smi_reg(inst, SMIDC); ++ ++ settings->pack_data = (read_smi_reg(inst, SMICS) & SMICS_PXLDAT) ? ++ true : false; ++ ++ settings->data_width = GET_BIT_FIELD(smidsr, SMIDSR_RWIDTH); ++ settings->read_setup_time = GET_BIT_FIELD(smidsr, SMIDSR_RSETUP); ++ settings->read_hold_time = GET_BIT_FIELD(smidsr, SMIDSR_RHOLD); ++ settings->read_pace_time = GET_BIT_FIELD(smidsr, SMIDSR_RPACE); ++ settings->read_strobe_time = GET_BIT_FIELD(smidsr, SMIDSR_RSTROBE); ++ ++ settings->write_setup_time = GET_BIT_FIELD(smidsw, SMIDSW_WSETUP); ++ settings->write_hold_time = GET_BIT_FIELD(smidsw, SMIDSW_WHOLD); ++ settings->write_pace_time = GET_BIT_FIELD(smidsw, SMIDSW_WPACE); ++ settings->write_strobe_time = GET_BIT_FIELD(smidsw, SMIDSW_WSTROBE); ++ ++ settings->dma_read_thresh = GET_BIT_FIELD(smidc, SMIDC_REQR); ++ settings->dma_write_thresh = GET_BIT_FIELD(smidc, SMIDC_REQW); ++ settings->dma_panic_read_thresh = GET_BIT_FIELD(smidc, SMIDC_PANICR); ++ settings->dma_panic_write_thresh = GET_BIT_FIELD(smidc, SMIDC_PANICW); ++ settings->dma_passthrough_enable = (smidc & SMIDC_DMAP) ? true : false; ++ settings->dma_enable = (smidc & SMIDC_DMAEN) ? true : false; ++ ++ spin_unlock(&inst->transaction_lock); ++ ++ return settings; ++} ++EXPORT_SYMBOL(bcm2835_smi_get_settings_from_regs); ++ ++static inline void smi_set_address(struct bcm2835_smi_instance *inst, ++ unsigned int address) ++{ ++ int smia_temp = 0, smida_temp = 0; ++ ++ SET_BIT_FIELD(smia_temp, SMIA_ADDR, address); ++ SET_BIT_FIELD(smida_temp, SMIDA_ADDR, address); ++ ++ /* Write to both address registers - user doesn't care whether we're ++ doing programmed or direct transfers. */ ++ write_smi_reg(inst, smia_temp, SMIA); ++ write_smi_reg(inst, smida_temp, SMIDA); ++} ++ ++static void smi_setup_regs(struct bcm2835_smi_instance *inst) ++{ ++ ++ dev_dbg(inst->dev, "Initialising SMI registers..."); ++ /* Disable the peripheral if already enabled */ ++ write_smi_reg(inst, 0, SMICS); ++ write_smi_reg(inst, 0, SMIDCS); ++ ++ smi_get_default_settings(inst); ++ bcm2835_smi_set_regs_from_settings(inst); ++ smi_set_address(inst, 0); ++ ++ write_smi_reg(inst, read_smi_reg(inst, SMICS) | SMICS_ENABLE, SMICS); ++ write_smi_reg(inst, read_smi_reg(inst, SMIDCS) | SMIDCS_ENABLE, ++ SMIDCS); ++} ++ ++/**************************************************************************** ++* ++* Low-level SMI access functions ++* Other modules should use the exported higher-level functions e.g. ++* bcm2835_smi_write_buf() unless they have a good reason to use these ++* ++***************************************************************************/ ++ ++static inline uint32_t smi_read_single_word(struct bcm2835_smi_instance *inst) ++{ ++ int timeout = 0; ++ ++ write_smi_reg(inst, SMIDCS_ENABLE, SMIDCS); ++ write_smi_reg(inst, SMIDCS_ENABLE | SMIDCS_START, SMIDCS); ++ /* Make sure things happen in the right order...*/ ++ mb(); ++ while (!(read_smi_reg(inst, SMIDCS) & SMIDCS_DONE) && ++ ++timeout < 10000) ++ ; ++ if (timeout < 10000) ++ return read_smi_reg(inst, SMIDD); ++ ++ dev_err(inst->dev, ++ "SMI direct read timed out (is the clock set up correctly?)"); ++ return 0; ++} ++ ++static inline void smi_write_single_word(struct bcm2835_smi_instance *inst, ++ uint32_t data) ++{ ++ int timeout = 0; ++ ++ write_smi_reg(inst, SMIDCS_ENABLE | SMIDCS_WRITE, SMIDCS); ++ write_smi_reg(inst, data, SMIDD); ++ write_smi_reg(inst, SMIDCS_ENABLE | SMIDCS_WRITE | SMIDCS_START, ++ SMIDCS); ++ ++ while (!(read_smi_reg(inst, SMIDCS) & SMIDCS_DONE) && ++ ++timeout < 10000) ++ ; ++ if (timeout >= 10000) ++ dev_err(inst->dev, ++ "SMI direct write timed out (is the clock set up correctly?)"); ++} ++ ++/* Initiates a programmed read into the read FIFO. It is up to the caller to ++ * read data from the FIFO - either via paced DMA transfer, ++ * or polling SMICS_RXD to check whether data is available. ++ * SMICS_ACTIVE will go low upon completion. */ ++static void smi_init_programmed_read(struct bcm2835_smi_instance *inst, ++ int num_transfers) ++{ ++ int smics_temp; ++ ++ /* Disable the peripheral: */ ++ smics_temp = read_smi_reg(inst, SMICS) & ~(SMICS_ENABLE | SMICS_WRITE); ++ write_smi_reg(inst, smics_temp, SMICS); ++ while (read_smi_reg(inst, SMICS) & SMICS_ENABLE) ++ ; ++ ++ /* Program the transfer count: */ ++ write_smi_reg(inst, num_transfers, SMIL); ++ ++ /* re-enable and start: */ ++ smics_temp |= SMICS_ENABLE; ++ write_smi_reg(inst, smics_temp, SMICS); ++ smics_temp |= SMICS_CLEAR; ++ /* Just to be certain: */ ++ mb(); ++ while (read_smi_reg(inst, SMICS) & SMICS_ACTIVE) ++ ; ++ write_smi_reg(inst, smics_temp, SMICS); ++ smics_temp |= SMICS_START; ++ write_smi_reg(inst, smics_temp, SMICS); ++} ++ ++/* Initiates a programmed write sequence, using data from the write FIFO. ++ * It is up to the caller to initiate a DMA transfer before calling, ++ * or use another method to keep the write FIFO topped up. ++ * SMICS_ACTIVE will go low upon completion. ++ */ ++static void smi_init_programmed_write(struct bcm2835_smi_instance *inst, ++ int num_transfers) ++{ ++ int smics_temp; ++ ++ /* Disable the peripheral: */ ++ smics_temp = read_smi_reg(inst, SMICS) & ~SMICS_ENABLE; ++ write_smi_reg(inst, smics_temp, SMICS); ++ while (read_smi_reg(inst, SMICS) & SMICS_ENABLE) ++ ; ++ ++ /* Program the transfer count: */ ++ write_smi_reg(inst, num_transfers, SMIL); ++ ++ /* setup, re-enable and start: */ ++ smics_temp |= SMICS_WRITE | SMICS_ENABLE; ++ write_smi_reg(inst, smics_temp, SMICS); ++ smics_temp |= SMICS_START; ++ write_smi_reg(inst, smics_temp, SMICS); ++} ++ ++/* Initiate a read and then poll FIFO for data, reading out as it appears. */ ++static void smi_read_fifo(struct bcm2835_smi_instance *inst, ++ uint32_t *dest, int n_bytes) ++{ ++ if (read_smi_reg(inst, SMICS) & SMICS_RXD) { ++ smi_dump_context_labelled(inst, ++ "WARNING: read FIFO not empty at start of read call."); ++ while (read_smi_reg(inst, SMICS)) ++ ; ++ } ++ ++ /* Dispatch the read: */ ++ if (inst->settings.data_width == SMI_WIDTH_8BIT) ++ smi_init_programmed_read(inst, n_bytes); ++ else if (inst->settings.data_width == SMI_WIDTH_16BIT) ++ smi_init_programmed_read(inst, n_bytes / 2); ++ else { ++ dev_err(inst->dev, "Unsupported data width for read."); ++ return; ++ } ++ ++ /* Poll FIFO to keep it empty */ ++ while (!(read_smi_reg(inst, SMICS) & SMICS_DONE)) ++ if (read_smi_reg(inst, SMICS) & SMICS_RXD) ++ *dest++ = read_smi_reg(inst, SMID); ++ ++ /* Ensure that the FIFO is emptied */ ++ if (read_smi_reg(inst, SMICS) & SMICS_RXD) { ++ int fifo_count; ++ ++ fifo_count = GET_BIT_FIELD(read_smi_reg(inst, SMIFD), ++ SMIFD_FCNT); ++ while (fifo_count--) ++ *dest++ = read_smi_reg(inst, SMID); ++ } ++ ++ if (!(read_smi_reg(inst, SMICS) & SMICS_DONE)) ++ smi_dump_context_labelled(inst, ++ "WARNING: transaction finished but done bit not set."); ++ ++ if (read_smi_reg(inst, SMICS) & SMICS_RXD) ++ smi_dump_context_labelled(inst, ++ "WARNING: read FIFO not empty at end of read call."); ++ ++} ++ ++/* Initiate a write, and then keep the FIFO topped up. */ ++static void smi_write_fifo(struct bcm2835_smi_instance *inst, ++ uint32_t *src, int n_bytes) ++{ ++ int i, timeout = 0; ++ ++ /* Empty FIFOs if not already so */ ++ if (!(read_smi_reg(inst, SMICS) & SMICS_TXE)) { ++ smi_dump_context_labelled(inst, ++ "WARNING: write fifo not empty at start of write call."); ++ write_smi_reg(inst, read_smi_reg(inst, SMICS) | SMICS_CLEAR, ++ SMICS); ++ } ++ ++ /* Initiate the transfer */ ++ if (inst->settings.data_width == SMI_WIDTH_8BIT) ++ smi_init_programmed_write(inst, n_bytes); ++ else if (inst->settings.data_width == SMI_WIDTH_16BIT) ++ smi_init_programmed_write(inst, n_bytes / 2); ++ else { ++ dev_err(inst->dev, "Unsupported data width for write."); ++ return; ++ } ++ /* Fill the FIFO: */ ++ for (i = 0; i < (n_bytes - 1) / 4 + 1; ++i) { ++ while (!(read_smi_reg(inst, SMICS) & SMICS_TXD)) ++ ; ++ write_smi_reg(inst, *src++, SMID); ++ } ++ /* Busy wait... */ ++ while (!(read_smi_reg(inst, SMICS) & SMICS_DONE) && ++timeout < ++ 1000000) ++ ; ++ if (timeout >= 1000000) ++ smi_dump_context_labelled(inst, ++ "Timed out on write operation!"); ++ if (!(read_smi_reg(inst, SMICS) & SMICS_TXE)) ++ smi_dump_context_labelled(inst, ++ "WARNING: FIFO not empty at end of write operation."); ++} ++ ++/**************************************************************************** ++* ++* SMI DMA operations ++* ++***************************************************************************/ ++ ++/* Disable SMI and put it into the correct direction before doing DMA setup. ++ Stops spurious DREQs during setup. Peripheral is re-enabled by init_*() */ ++static void smi_disable(struct bcm2835_smi_instance *inst, ++ enum dma_transfer_direction direction) ++{ ++ int smics_temp = read_smi_reg(inst, SMICS) & ~SMICS_ENABLE; ++ ++ if (direction == DMA_DEV_TO_MEM) ++ smics_temp &= ~SMICS_WRITE; ++ else ++ smics_temp |= SMICS_WRITE; ++ write_smi_reg(inst, smics_temp, SMICS); ++ while (read_smi_reg(inst, SMICS) & SMICS_ACTIVE) ++ ; ++} ++ ++static struct scatterlist *smi_scatterlist_from_buffer( ++ struct bcm2835_smi_instance *inst, ++ dma_addr_t buf, ++ size_t len, ++ struct scatterlist *sg) ++{ ++ sg_init_table(sg, 1); ++ sg_dma_address(sg) = buf; ++ sg_dma_len(sg) = len; ++ return sg; ++} ++ ++static void smi_dma_callback_user_copy(void *param) ++{ ++ /* Notify the bottom half that a chunk is ready for user copy */ ++ struct bcm2835_smi_instance *inst = ++ (struct bcm2835_smi_instance *)param; ++ ++ up(&inst->bounce.callback_sem); ++} ++ ++/* Creates a descriptor, assigns the given callback, and submits the ++ descriptor to dmaengine. Does not block - can queue up multiple ++ descriptors and then wait for them all to complete. ++ sg_len is the number of control blocks, NOT the number of bytes. ++ dir can be DMA_MEM_TO_DEV or DMA_DEV_TO_MEM. ++ callback can be NULL - in this case it is not called. */ ++static inline struct dma_async_tx_descriptor *smi_dma_submit_sgl( ++ struct bcm2835_smi_instance *inst, ++ struct scatterlist *sgl, ++ size_t sg_len, ++ enum dma_transfer_direction dir, ++ dma_async_tx_callback callback) ++{ ++ struct dma_async_tx_descriptor *desc; ++ ++ desc = dmaengine_prep_slave_sg(inst->dma_chan, ++ sgl, ++ sg_len, ++ dir, ++ DMA_PREP_INTERRUPT | DMA_CTRL_ACK | ++ DMA_PREP_FENCE); ++ if (!desc) { ++ dev_err(inst->dev, "read_sgl: dma slave preparation failed!"); ++ write_smi_reg(inst, read_smi_reg(inst, SMICS) & ~SMICS_ACTIVE, ++ SMICS); ++ while (read_smi_reg(inst, SMICS) & SMICS_ACTIVE) ++ cpu_relax(); ++ write_smi_reg(inst, read_smi_reg(inst, SMICS) | SMICS_ACTIVE, ++ SMICS); ++ return NULL; ++ } ++ desc->callback = callback; ++ desc->callback_param = inst; ++ if (dmaengine_submit(desc) < 0) ++ return NULL; ++ return desc; ++} ++ ++/* NB this function blocks until the transfer is complete */ ++static void ++smi_dma_read_sgl(struct bcm2835_smi_instance *inst, ++ struct scatterlist *sgl, size_t sg_len, size_t n_bytes) ++{ ++ struct dma_async_tx_descriptor *desc; ++ ++ /* Disable SMI and set to read before dispatching DMA - if SMI is in ++ * write mode and TX fifo is empty, it will generate a DREQ which may ++ * cause the read DMA to complete before the SMI read command is even ++ * dispatched! We want to dispatch DMA before SMI read so that reading ++ * is gapless, for logic analyser. ++ */ ++ ++ smi_disable(inst, DMA_DEV_TO_MEM); ++ ++ desc = smi_dma_submit_sgl(inst, sgl, sg_len, DMA_DEV_TO_MEM, NULL); ++ dma_async_issue_pending(inst->dma_chan); ++ ++ if (inst->settings.data_width == SMI_WIDTH_8BIT) ++ smi_init_programmed_read(inst, n_bytes); ++ else ++ smi_init_programmed_read(inst, n_bytes / 2); ++ ++ if (dma_wait_for_async_tx(desc) == DMA_ERROR) ++ smi_dump_context_labelled(inst, "DMA timeout!"); ++} ++ ++static void ++smi_dma_write_sgl(struct bcm2835_smi_instance *inst, ++ struct scatterlist *sgl, size_t sg_len, size_t n_bytes) ++{ ++ struct dma_async_tx_descriptor *desc; ++ ++ if (inst->settings.data_width == SMI_WIDTH_8BIT) ++ smi_init_programmed_write(inst, n_bytes); ++ else ++ smi_init_programmed_write(inst, n_bytes / 2); ++ ++ desc = smi_dma_submit_sgl(inst, sgl, sg_len, DMA_MEM_TO_DEV, NULL); ++ dma_async_issue_pending(inst->dma_chan); ++ ++ if (dma_wait_for_async_tx(desc) == DMA_ERROR) ++ smi_dump_context_labelled(inst, "DMA timeout!"); ++ else ++ /* Wait for SMI to finish our writes */ ++ while (!(read_smi_reg(inst, SMICS) & SMICS_DONE)) ++ cpu_relax(); ++} ++ ++ssize_t bcm2835_smi_user_dma( ++ struct bcm2835_smi_instance *inst, ++ enum dma_transfer_direction dma_dir, ++ char __user *user_ptr, size_t count, ++ struct bcm2835_smi_bounce_info **bounce) ++{ ++ int chunk_no = 0, chunk_size, count_left = count; ++ struct scatterlist *sgl; ++ void (*init_trans_func)(struct bcm2835_smi_instance *, int); ++ ++ spin_lock(&inst->transaction_lock); ++ ++ if (dma_dir == DMA_DEV_TO_MEM) ++ init_trans_func = smi_init_programmed_read; ++ else ++ init_trans_func = smi_init_programmed_write; ++ ++ smi_disable(inst, dma_dir); ++ ++ sema_init(&inst->bounce.callback_sem, 0); ++ if (bounce) ++ *bounce = &inst->bounce; ++ while (count_left) { ++ chunk_size = count_left > DMA_BOUNCE_BUFFER_SIZE ? ++ DMA_BOUNCE_BUFFER_SIZE : count_left; ++ if (chunk_size == DMA_BOUNCE_BUFFER_SIZE) { ++ sgl = ++ &inst->bounce.sgl[chunk_no % DMA_BOUNCE_BUFFER_COUNT]; ++ } else { ++ sgl = smi_scatterlist_from_buffer( ++ inst, ++ inst->bounce.phys[ ++ chunk_no % DMA_BOUNCE_BUFFER_COUNT], ++ chunk_size, ++ &inst->buffer_sgl); ++ } ++ ++ if (!smi_dma_submit_sgl(inst, sgl, 1, dma_dir, ++ smi_dma_callback_user_copy ++ )) { ++ dev_err(inst->dev, "sgl submit failed"); ++ count = 0; ++ goto out; ++ } ++ count_left -= chunk_size; ++ chunk_no++; ++ } ++ dma_async_issue_pending(inst->dma_chan); ++ ++ if (inst->settings.data_width == SMI_WIDTH_8BIT) ++ init_trans_func(inst, count); ++ else if (inst->settings.data_width == SMI_WIDTH_16BIT) ++ init_trans_func(inst, count / 2); ++out: ++ spin_unlock(&inst->transaction_lock); ++ return count; ++} ++EXPORT_SYMBOL(bcm2835_smi_user_dma); ++ ++ ++/**************************************************************************** ++* ++* High level buffer transfer functions - for use by other drivers ++* ++***************************************************************************/ ++ ++/* Buffer must be physically contiguous - i.e. kmalloc, not vmalloc! */ ++void bcm2835_smi_write_buf( ++ struct bcm2835_smi_instance *inst, ++ const void *buf, size_t n_bytes) ++{ ++ int odd_bytes = n_bytes & 0x3; ++ ++ n_bytes -= odd_bytes; ++ ++ spin_lock(&inst->transaction_lock); ++ ++ if (n_bytes > DMA_THRESHOLD_BYTES) { ++ dma_addr_t phy_addr = dma_map_single( ++ inst->dev, ++ (void *)buf, ++ n_bytes, ++ DMA_MEM_TO_DEV); ++ struct scatterlist *sgl = ++ smi_scatterlist_from_buffer(inst, phy_addr, n_bytes, ++ &inst->buffer_sgl); ++ ++ if (!sgl) { ++ smi_dump_context_labelled(inst, ++ "Error: could not create scatterlist for write!"); ++ goto out; ++ } ++ smi_dma_write_sgl(inst, sgl, 1, n_bytes); ++ ++ dma_unmap_single ++ (inst->dev, phy_addr, n_bytes, DMA_MEM_TO_DEV); ++ } else if (n_bytes) { ++ smi_write_fifo(inst, (uint32_t *) buf, n_bytes); ++ } ++ buf += n_bytes; ++ ++ if (inst->settings.data_width == SMI_WIDTH_8BIT) { ++ while (odd_bytes--) ++ smi_write_single_word(inst, *(uint8_t *) (buf++)); ++ } else { ++ while (odd_bytes >= 2) { ++ smi_write_single_word(inst, *(uint16_t *)buf); ++ buf += 2; ++ odd_bytes -= 2; ++ } ++ if (odd_bytes) { ++ /* Reading an odd number of bytes on a 16 bit bus is ++ a user bug. It's kinder to fail early and tell them ++ than to e.g. transparently give them the bottom byte ++ of a 16 bit transfer. */ ++ dev_err(inst->dev, ++ "WARNING: odd number of bytes specified for wide transfer."); ++ dev_err(inst->dev, ++ "At least one byte dropped as a result."); ++ dump_stack(); ++ } ++ } ++out: ++ spin_unlock(&inst->transaction_lock); ++} ++EXPORT_SYMBOL(bcm2835_smi_write_buf); ++ ++void bcm2835_smi_read_buf(struct bcm2835_smi_instance *inst, ++ void *buf, size_t n_bytes) ++{ ++ ++ /* SMI is inherently 32-bit, which causes surprising amounts of mess ++ for bytes % 4 != 0. Easiest to avoid this mess altogether ++ by handling remainder separately. */ ++ int odd_bytes = n_bytes & 0x3; ++ ++ spin_lock(&inst->transaction_lock); ++ n_bytes -= odd_bytes; ++ if (n_bytes > DMA_THRESHOLD_BYTES) { ++ dma_addr_t phy_addr = dma_map_single(inst->dev, ++ buf, n_bytes, ++ DMA_DEV_TO_MEM); ++ struct scatterlist *sgl = smi_scatterlist_from_buffer( ++ inst, phy_addr, n_bytes, ++ &inst->buffer_sgl); ++ if (!sgl) { ++ smi_dump_context_labelled(inst, ++ "Error: could not create scatterlist for read!"); ++ goto out; ++ } ++ smi_dma_read_sgl(inst, sgl, 1, n_bytes); ++ dma_unmap_single(inst->dev, phy_addr, n_bytes, DMA_DEV_TO_MEM); ++ } else if (n_bytes) { ++ smi_read_fifo(inst, (uint32_t *)buf, n_bytes); ++ } ++ buf += n_bytes; ++ ++ if (inst->settings.data_width == SMI_WIDTH_8BIT) { ++ while (odd_bytes--) ++ *((uint8_t *) (buf++)) = smi_read_single_word(inst); ++ } else { ++ while (odd_bytes >= 2) { ++ *(uint16_t *) buf = smi_read_single_word(inst); ++ buf += 2; ++ odd_bytes -= 2; ++ } ++ if (odd_bytes) { ++ dev_err(inst->dev, ++ "WARNING: odd number of bytes specified for wide transfer."); ++ dev_err(inst->dev, ++ "At least one byte dropped as a result."); ++ dump_stack(); ++ } ++ } ++out: ++ spin_unlock(&inst->transaction_lock); ++} ++EXPORT_SYMBOL(bcm2835_smi_read_buf); ++ ++void bcm2835_smi_set_address(struct bcm2835_smi_instance *inst, ++ unsigned int address) ++{ ++ spin_lock(&inst->transaction_lock); ++ smi_set_address(inst, address); ++ spin_unlock(&inst->transaction_lock); ++} ++EXPORT_SYMBOL(bcm2835_smi_set_address); ++ ++struct bcm2835_smi_instance *bcm2835_smi_get(struct device_node *node) ++{ ++ struct platform_device *pdev; ++ ++ if (!node) ++ return NULL; ++ ++ pdev = of_find_device_by_node(node); ++ if (!pdev) ++ return NULL; ++ ++ return platform_get_drvdata(pdev); ++} ++EXPORT_SYMBOL(bcm2835_smi_get); ++ ++/**************************************************************************** ++* ++* bcm2835_smi_probe - called when the driver is loaded. ++* ++***************************************************************************/ ++ ++static int bcm2835_smi_dma_setup(struct bcm2835_smi_instance *inst) ++{ ++ int i, rv = 0; ++ ++ inst->dma_chan = dma_request_slave_channel(inst->dev, "rx-tx"); ++ ++ inst->dma_config.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; ++ inst->dma_config.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; ++ inst->dma_config.src_addr = inst->smi_regs_busaddr + SMID; ++ inst->dma_config.dst_addr = inst->dma_config.src_addr; ++ /* Direction unimportant - always overridden by prep_slave_sg */ ++ inst->dma_config.direction = DMA_DEV_TO_MEM; ++ dmaengine_slave_config(inst->dma_chan, &inst->dma_config); ++ /* Alloc and map bounce buffers */ ++ for (i = 0; i < DMA_BOUNCE_BUFFER_COUNT; ++i) { ++ inst->bounce.buffer[i] = ++ dmam_alloc_coherent(inst->dev, DMA_BOUNCE_BUFFER_SIZE, ++ &inst->bounce.phys[i], ++ GFP_KERNEL); ++ if (!inst->bounce.buffer[i]) { ++ dev_err(inst->dev, "Could not allocate buffer!"); ++ rv = -ENOMEM; ++ break; ++ } ++ smi_scatterlist_from_buffer( ++ inst, ++ inst->bounce.phys[i], ++ DMA_BOUNCE_BUFFER_SIZE, ++ &inst->bounce.sgl[i] ++ ); ++ } ++ ++ return rv; ++} ++ ++static int bcm2835_smi_probe(struct platform_device *pdev) ++{ ++ int err; ++ struct device *dev = &pdev->dev; ++ struct device_node *node = dev->of_node; ++ struct resource *ioresource; ++ struct bcm2835_smi_instance *inst; ++ ++ /* Allocate buffers and instance data */ ++ ++ inst = devm_kzalloc(dev, sizeof(struct bcm2835_smi_instance), ++ GFP_KERNEL); ++ ++ if (!inst) ++ return -ENOMEM; ++ ++ inst->dev = dev; ++ spin_lock_init(&inst->transaction_lock); ++ ++ /* We require device tree support */ ++ if (!node) ++ return -EINVAL; ++ ++ ioresource = platform_get_resource(pdev, IORESOURCE_MEM, 0); ++ inst->smi_regs_ptr = devm_ioremap_resource(dev, ioresource); ++ ioresource = platform_get_resource(pdev, IORESOURCE_MEM, 1); ++ inst->cm_smi_regs_ptr = devm_ioremap_resource(dev, ioresource); ++ inst->smi_regs_busaddr = be32_to_cpu( ++ *of_get_address(node, 0, NULL, NULL)); ++ of_property_read_u32(node, ++ "brcm,smi-clock-source", ++ &inst->clock_source); ++ of_property_read_u32(node, ++ "brcm,smi-clock-divisor", ++ &inst->clock_divisor); ++ ++ err = bcm2835_smi_dma_setup(inst); ++ if (err) ++ return err; ++ ++ /* Finally, do peripheral setup */ ++ ++ smi_setup_clock(inst); ++ smi_setup_regs(inst); ++ ++ platform_set_drvdata(pdev, inst); ++ ++ dev_info(inst->dev, "initialised"); ++ ++ return 0; ++} ++ ++/**************************************************************************** ++* ++* bcm2835_smi_remove - called when the driver is unloaded. ++* ++***************************************************************************/ ++ ++static int bcm2835_smi_remove(struct platform_device *pdev) ++{ ++ struct bcm2835_smi_instance *inst = platform_get_drvdata(pdev); ++ struct device *dev = inst->dev; ++ ++ dev_info(dev, "SMI device removed - OK"); ++ return 0; ++} ++ ++/**************************************************************************** ++* ++* Register the driver with device tree ++* ++***************************************************************************/ ++ ++static const struct of_device_id bcm2835_smi_of_match[] = { ++ {.compatible = "brcm,bcm2835-smi",}, ++ { /* sentinel */ }, ++}; ++ ++MODULE_DEVICE_TABLE(of, bcm2835_smi_of_match); ++ ++static struct platform_driver bcm2835_smi_driver = { ++ .probe = bcm2835_smi_probe, ++ .remove = bcm2835_smi_remove, ++ .driver = { ++ .name = DRIVER_NAME, ++ .owner = THIS_MODULE, ++ .of_match_table = bcm2835_smi_of_match, ++ }, ++}; ++ ++module_platform_driver(bcm2835_smi_driver); ++ ++MODULE_ALIAS("platform:smi-bcm2835"); ++MODULE_LICENSE("GPL"); ++MODULE_DESCRIPTION("Device driver for BCM2835's secondary memory interface"); ++MODULE_AUTHOR("Luke Wren <luke@raspberrypi.org>"); +diff --git a/include/linux/broadcom/bcm2835_smi.h b/include/linux/broadcom/bcm2835_smi.h +new file mode 100644 +index 0000000..ee3a75e +--- /dev/null ++++ b/include/linux/broadcom/bcm2835_smi.h +@@ -0,0 +1,391 @@ ++/** ++ * Declarations and definitions for Broadcom's Secondary Memory Interface ++ * ++ * Written by Luke Wren <luke@raspberrypi.org> ++ * Copyright (c) 2015, Raspberry Pi (Trading) Ltd. ++ * Copyright (c) 2010-2012 Broadcom. 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, ++ * without modification. ++ * 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. ++ * 3. The names of the above-listed copyright holders may not be used ++ * to endorse or promote products derived from this software without ++ * specific prior written permission. ++ * ++ * ALTERNATIVELY, this software may be distributed under the terms of the ++ * GNU General Public License ("GPL") version 2, as published by the Free ++ * Software Foundation. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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. ++ */ ++ ++#ifndef BCM2835_SMI_H ++#define BCM2835_SMI_H ++ ++#include <linux/ioctl.h> ++ ++#ifndef __KERNEL__ ++#include <stdint.h> ++#include <stdbool.h> ++#endif ++ ++#define BCM2835_SMI_IOC_MAGIC 0x1 ++#define BCM2835_SMI_INVALID_HANDLE (~0) ++ ++/* IOCTLs 0x100...0x1ff are not device-specific - we can use them */ ++#define BCM2835_SMI_IOC_GET_SETTINGS _IO(BCM2835_SMI_IOC_MAGIC, 0) ++#define BCM2835_SMI_IOC_WRITE_SETTINGS _IO(BCM2835_SMI_IOC_MAGIC, 1) ++#define BCM2835_SMI_IOC_ADDRESS _IO(BCM2835_SMI_IOC_MAGIC, 2) ++#define BCM2835_SMI_IOC_MAX 2 ++ ++#define SMI_WIDTH_8BIT 0 ++#define SMI_WIDTH_16BIT 1 ++#define SMI_WIDTH_9BIT 2 ++#define SMI_WIDTH_18BIT 3 ++ ++/* max number of bytes where DMA will not be used */ ++#define DMA_THRESHOLD_BYTES 128 ++#define DMA_BOUNCE_BUFFER_SIZE (1024 * 1024 / 2) ++#define DMA_BOUNCE_BUFFER_COUNT 3 ++ ++ ++struct smi_settings { ++ int data_width; ++ /* Whether or not to pack multiple SMI transfers into a ++ single 32 bit FIFO word */ ++ bool pack_data; ++ ++ /* Timing for reads (writes the same but for WE) ++ * ++ * OE ----------+ +-------------------- ++ * | | ++ * +----------+ ++ * SD -<==============================>----------- ++ * SA -<=========================================>- ++ * <-setup-> <-strobe -> <-hold -> <- pace -> ++ */ ++ ++ int read_setup_time; ++ int read_hold_time; ++ int read_pace_time; ++ int read_strobe_time; ++ ++ int write_setup_time; ++ int write_hold_time; ++ int write_pace_time; ++ int write_strobe_time; ++ ++ bool dma_enable; /* DREQs */ ++ bool dma_passthrough_enable; /* External DREQs */ ++ int dma_read_thresh; ++ int dma_write_thresh; ++ int dma_panic_read_thresh; ++ int dma_panic_write_thresh; ++}; ++ ++/**************************************************************************** ++* ++* Declare exported SMI functions ++* ++***************************************************************************/ ++ ++#ifdef __KERNEL__ ++ ++#include <linux/dmaengine.h> /* for enum dma_transfer_direction */ ++#include <linux/of.h> ++#include <linux/semaphore.h> ++ ++struct bcm2835_smi_instance; ++ ++struct bcm2835_smi_bounce_info { ++ struct semaphore callback_sem; ++ void *buffer[DMA_BOUNCE_BUFFER_COUNT]; ++ dma_addr_t phys[DMA_BOUNCE_BUFFER_COUNT]; ++ struct scatterlist sgl[DMA_BOUNCE_BUFFER_COUNT]; ++}; ++ ++ ++void bcm2835_smi_set_regs_from_settings(struct bcm2835_smi_instance *); ++ ++struct smi_settings *bcm2835_smi_get_settings_from_regs( ++ struct bcm2835_smi_instance *inst); ++ ++void bcm2835_smi_write_buf( ++ struct bcm2835_smi_instance *inst, ++ const void *buf, ++ size_t n_bytes); ++ ++void bcm2835_smi_read_buf( ++ struct bcm2835_smi_instance *inst, ++ void *buf, ++ size_t n_bytes); ++ ++void bcm2835_smi_set_address(struct bcm2835_smi_instance *inst, ++ unsigned int address); ++ ++ssize_t bcm2835_smi_user_dma( ++ struct bcm2835_smi_instance *inst, ++ enum dma_transfer_direction dma_dir, ++ char __user *user_ptr, ++ size_t count, ++ struct bcm2835_smi_bounce_info **bounce); ++ ++struct bcm2835_smi_instance *bcm2835_smi_get(struct device_node *node); ++ ++#endif /* __KERNEL__ */ ++ ++/**************************************************************** ++* ++* Implementation-only declarations ++* ++****************************************************************/ ++ ++#ifdef BCM2835_SMI_IMPLEMENTATION ++ ++/* Clock manager registers for SMI clock: */ ++#define CM_SMI_BASE_ADDRESS ((BCM2708_PERI_BASE) + 0x1010b0) ++/* Clock manager "password" to protect registers from spurious writes */ ++#define CM_PWD (0x5a << 24) ++ ++#define CM_SMI_CTL 0x00 ++#define CM_SMI_DIV 0x04 ++ ++#define CM_SMI_CTL_FLIP (1 << 8) ++#define CM_SMI_CTL_BUSY (1 << 7) ++#define CM_SMI_CTL_KILL (1 << 5) ++#define CM_SMI_CTL_ENAB (1 << 4) ++#define CM_SMI_CTL_SRC_MASK (0xf) ++#define CM_SMI_CTL_SRC_OFFS (0) ++ ++#define CM_SMI_DIV_DIVI_MASK (0xf << 12) ++#define CM_SMI_DIV_DIVI_OFFS (12) ++#define CM_SMI_DIV_DIVF_MASK (0xff << 4) ++#define CM_SMI_DIV_DIVF_OFFS (4) ++ ++/* SMI register mapping:*/ ++#define SMI_BASE_ADDRESS ((BCM2708_PERI_BASE) + 0x600000) ++ ++#define SMICS 0x00 /* control + status register */ ++#define SMIL 0x04 /* length/count (n external txfers) */ ++#define SMIA 0x08 /* address register */ ++#define SMID 0x0c /* data register */ ++#define SMIDSR0 0x10 /* device 0 read settings */ ++#define SMIDSW0 0x14 /* device 0 write settings */ ++#define SMIDSR1 0x18 /* device 1 read settings */ ++#define SMIDSW1 0x1c /* device 1 write settings */ ++#define SMIDSR2 0x20 /* device 2 read settings */ ++#define SMIDSW2 0x24 /* device 2 write settings */ ++#define SMIDSR3 0x28 /* device 3 read settings */ ++#define SMIDSW3 0x2c /* device 3 write settings */ ++#define SMIDC 0x30 /* DMA control registers */ ++#define SMIDCS 0x34 /* direct control/status register */ ++#define SMIDA 0x38 /* direct address register */ ++#define SMIDD 0x3c /* direct data registers */ ++#define SMIFD 0x40 /* FIFO debug register */ ++ ++ ++ ++/* Control and Status register bits: ++ * SMICS_RXF : RX fifo full: 1 when RX fifo is full ++ * SMICS_TXE : TX fifo empty: 1 when empty. ++ * SMICS_RXD : RX fifo contains data: 1 when there is data. ++ * SMICS_TXD : TX fifo can accept data: 1 when true. ++ * SMICS_RXR : RX fifo needs reading: 1 when fifo more than 3/4 full, or ++ * when "DONE" and fifo not emptied. ++ * SMICS_TXW : TX fifo needs writing: 1 when less than 1/4 full. ++ * SMICS_AFERR : AXI FIFO error: 1 when fifo read when empty or written ++ * when full. Write 1 to clear. ++ * SMICS_EDREQ : 1 when external DREQ received. ++ * SMICS_PXLDAT : Pixel data: write 1 to enable pixel transfer modes. ++ * SMICS_SETERR : 1 if there was an error writing to setup regs (e.g. ++ * tx was in progress). Write 1 to clear. ++ * SMICS_PVMODE : Set to 1 to enable pixel valve mode. ++ * SMICS_INTR : Set to 1 to enable interrupt on RX. ++ * SMICS_INTT : Set to 1 to enable interrupt on TX. ++ * SMICS_INTD : Set to 1 to enable interrupt on DONE condition. ++ * SMICS_TEEN : Tear effect mode enabled: Programmed transfers will wait ++ * for a TE trigger before writing. ++ * SMICS_PAD1 : Padding settings for external transfers. For writes: the ++ * number of bytes initially written to the TX fifo that ++ * SMICS_PAD0 : should be ignored. For reads: the number of bytes that will ++ * be read before the data, and should be dropped. ++ * SMICS_WRITE : Transfer direction: 1 = write to external device, 0 = read ++ * SMICS_CLEAR : Write 1 to clear the FIFOs. ++ * SMICS_START : Write 1 to start the programmed transfer. ++ * SMICS_ACTIVE : Reads as 1 when a programmed transfer is underway. ++ * SMICS_DONE : Reads as 1 when transfer finished. For RX, not set until ++ * FIFO emptied. ++ * SMICS_ENABLE : Set to 1 to enable the SMI peripheral, 0 to disable. ++ */ ++ ++#define SMICS_RXF (1 << 31) ++#define SMICS_TXE (1 << 30) ++#define SMICS_RXD (1 << 29) ++#define SMICS_TXD (1 << 28) ++#define SMICS_RXR (1 << 27) ++#define SMICS_TXW (1 << 26) ++#define SMICS_AFERR (1 << 25) ++#define SMICS_EDREQ (1 << 15) ++#define SMICS_PXLDAT (1 << 14) ++#define SMICS_SETERR (1 << 13) ++#define SMICS_PVMODE (1 << 12) ++#define SMICS_INTR (1 << 11) ++#define SMICS_INTT (1 << 10) ++#define SMICS_INTD (1 << 9) ++#define SMICS_TEEN (1 << 8) ++#define SMICS_PAD1 (1 << 7) ++#define SMICS_PAD0 (1 << 6) ++#define SMICS_WRITE (1 << 5) ++#define SMICS_CLEAR (1 << 4) ++#define SMICS_START (1 << 3) ++#define SMICS_ACTIVE (1 << 2) ++#define SMICS_DONE (1 << 1) ++#define SMICS_ENABLE (1 << 0) ++ ++/* Address register bits: */ ++ ++#define SMIA_DEVICE_MASK ((1 << 9) | (1 << 8)) ++#define SMIA_DEVICE_OFFS (8) ++#define SMIA_ADDR_MASK (0x3f) /* bits 5 -> 0 */ ++#define SMIA_ADDR_OFFS (0) ++ ++/* DMA control register bits: ++ * SMIDC_DMAEN : DMA enable: set 1: DMA requests will be issued. ++ * SMIDC_DMAP : DMA passthrough: when set to 0, top two data pins are used by ++ * SMI as usual. When set to 1, the top two pins are used for ++ * external DREQs: pin 16 read request, 17 write. ++ * SMIDC_PANIC* : Threshold at which DMA will panic during read/write. ++ * SMIDC_REQ* : Threshold at which DMA will generate a DREQ. ++ */ ++ ++#define SMIDC_DMAEN (1 << 28) ++#define SMIDC_DMAP (1 << 24) ++#define SMIDC_PANICR_MASK (0x3f << 18) ++#define SMIDC_PANICR_OFFS (18) ++#define SMIDC_PANICW_MASK (0x3f << 12) ++#define SMIDC_PANICW_OFFS (12) ++#define SMIDC_REQR_MASK (0x3f << 6) ++#define SMIDC_REQR_OFFS (6) ++#define SMIDC_REQW_MASK (0x3f) ++#define SMIDC_REQW_OFFS (0) ++ ++/* Device settings register bits: same for all 4 (or 3?) device register sets. ++ * Device read settings: ++ * SMIDSR_RWIDTH : Read transfer width. 00 = 8bit, 01 = 16bit, ++ * 10 = 18bit, 11 = 9bit. ++ * SMIDSR_RSETUP : Read setup time: number of core cycles between chip ++ * select/address and read strobe. Min 1, max 64. ++ * SMIDSR_MODE68 : 1 for System 68 mode (i.e. enable + direction pins, ++ * rather than OE + WE pin) ++ * SMIDSR_FSETUP : If set to 1, setup time only applies to first ++ * transfer after address change. ++ * SMIDSR_RHOLD : Number of core cycles between read strobe going ++ * inactive and CS/address going inactive. Min 1, max 64 ++ * SMIDSR_RPACEALL : When set to 1, this device's RPACE value will always ++ * be used for the next transaction, even if it is not ++ * to this device. ++ * SMIDSR_RPACE : Number of core cycles spent waiting between CS ++ * deassert and start of next transfer. Min 1, max 128 ++ * SMIDSR_RDREQ : 1 = use external DMA request on SD16 to pace reads ++ * from device. Must also set DMAP in SMICS. ++ * SMIDSR_RSTROBE : Number of cycles to assert the read strobe. ++ * min 1, max 128. ++ */ ++#define SMIDSR_RWIDTH_MASK ((1<<31)|(1<<30)) ++#define SMIDSR_RWIDTH_OFFS (30) ++#define SMIDSR_RSETUP_MASK (0x3f << 24) ++#define SMIDSR_RSETUP_OFFS (24) ++#define SMIDSR_MODE68 (1 << 23) ++#define SMIDSR_FSETUP (1 << 22) ++#define SMIDSR_RHOLD_MASK (0x3f << 16) ++#define SMIDSR_RHOLD_OFFS (16) ++#define SMIDSR_RPACEALL (1 << 15) ++#define SMIDSR_RPACE_MASK (0x7f << 8) ++#define SMIDSR_RPACE_OFFS (8) ++#define SMIDSR_RDREQ (1 << 7) ++#define SMIDSR_RSTROBE_MASK (0x7f) ++#define SMIDSR_RSTROBE_OFFS (0) ++ ++/* Device write settings: ++ * SMIDSW_WWIDTH : Write transfer width. 00 = 8bit, 01 = 16bit, ++ * 10= 18bit, 11 = 9bit. ++ * SMIDSW_WSETUP : Number of cycles between CS assert and write strobe. ++ * Min 1, max 64. ++ * SMIDSW_WFORMAT : Pixel format of input. 0 = 16bit RGB 565, ++ * 1 = 32bit RGBA 8888 ++ * SMIDSW_WSWAP : 1 = swap pixel data bits. (Use with SMICS_PXLDAT) ++ * SMIDSW_WHOLD : Time between WE deassert and CS deassert. 1 to 64 ++ * SMIDSW_WPACEALL : 1: this device's WPACE will be used for the next ++ * transfer, regardless of that transfer's device. ++ * SMIDSW_WPACE : Cycles between CS deassert and next CS assert. ++ * Min 1, max 128 ++ * SMIDSW_WDREQ : Use external DREQ on pin 17 to pace writes. DMAP must ++ * be set in SMICS. ++ * SMIDSW_WSTROBE : Number of cycles to assert the write strobe. ++ * Min 1, max 128 ++ */ ++#define SMIDSW_WWIDTH_MASK ((1<<31)|(1<<30)) ++#define SMIDSW_WWIDTH_OFFS (30) ++#define SMIDSW_WSETUP_MASK (0x3f << 24) ++#define SMIDSW_WSETUP_OFFS (24) ++#define SMIDSW_WFORMAT (1 << 23) ++#define SMIDSW_WSWAP (1 << 22) ++#define SMIDSW_WHOLD_MASK (0x3f << 16) ++#define SMIDSW_WHOLD_OFFS (16) ++#define SMIDSW_WPACEALL (1 << 15) ++#define SMIDSW_WPACE_MASK (0x7f << 8) ++#define SMIDSW_WPACE_OFFS (8) ++#define SMIDSW_WDREQ (1 << 7) ++#define SMIDSW_WSTROBE_MASK (0x7f) ++#define SMIDSW_WSTROBE_OFFS (0) ++ ++/* Direct transfer control + status register ++ * SMIDCS_WRITE : Direction of transfer: 1 -> write, 0 -> read ++ * SMIDCS_DONE : 1 when a transfer has finished. Write 1 to clear. ++ * SMIDCS_START : Write 1 to start a transfer, if one is not already underway. ++ * SMIDCE_ENABLE: Write 1 to enable SMI in direct mode. ++ */ ++ ++#define SMIDCS_WRITE (1 << 3) ++#define SMIDCS_DONE (1 << 2) ++#define SMIDCS_START (1 << 1) ++#define SMIDCS_ENABLE (1 << 0) ++ ++/* Direct transfer address register ++ * SMIDA_DEVICE : Indicates which of the device settings banks should be used. ++ * SMIDA_ADDR : The value to be asserted on the address pins. ++ */ ++ ++#define SMIDA_DEVICE_MASK ((1<<9)|(1<<8)) ++#define SMIDA_DEVICE_OFFS (8) ++#define SMIDA_ADDR_MASK (0x3f) ++#define SMIDA_ADDR_OFFS (0) ++ ++/* FIFO debug register ++ * SMIFD_FLVL : The high-tide mark of FIFO count during the most recent txfer ++ * SMIFD_FCNT : The current FIFO count. ++ */ ++#define SMIFD_FLVL_MASK (0x3f << 8) ++#define SMIFD_FLVL_OFFS (8) ++#define SMIFD_FCNT_MASK (0x3f) ++#define SMIFD_FCNT_OFFS (0) ++ ++#endif /* BCM2835_SMI_IMPLEMENTATION */ ++ ++#endif /* BCM2835_SMI_H */ + +From 6da5091e686e4c92424fe6d70a96baf54fbcc2fd Mon Sep 17 00:00:00 2001 +From: Luke Wren <wren6991@gmail.com> +Date: Sat, 5 Sep 2015 01:16:10 +0100 +Subject: [PATCH 046/112] Add SMI NAND driver + +Signed-off-by: Luke Wren <wren6991@gmail.com> +--- + .../bindings/mtd/brcm,bcm2835-smi-nand.txt | 42 ++++ + drivers/mtd/nand/Kconfig | 7 + + drivers/mtd/nand/Makefile | 1 + + drivers/mtd/nand/bcm2835_smi_nand.c | 267 +++++++++++++++++++++ + 4 files changed, 317 insertions(+) + create mode 100644 Documentation/devicetree/bindings/mtd/brcm,bcm2835-smi-nand.txt + create mode 100644 drivers/mtd/nand/bcm2835_smi_nand.c + +diff --git a/Documentation/devicetree/bindings/mtd/brcm,bcm2835-smi-nand.txt b/Documentation/devicetree/bindings/mtd/brcm,bcm2835-smi-nand.txt +new file mode 100644 +index 0000000..159544d +--- /dev/null ++++ b/Documentation/devicetree/bindings/mtd/brcm,bcm2835-smi-nand.txt +@@ -0,0 +1,42 @@ ++* BCM2835 SMI NAND flash ++ ++This driver is a shim between the BCM2835 SMI driver (SMI is a peripheral for ++talking to parallel register interfaces) and Linux's MTD layer. ++ ++Required properties: ++- compatible: "brcm,bcm2835-smi-nand" ++- status: "okay" ++ ++Optional properties: ++- partition@n, where n is an integer from a consecutive sequence starting at 0 ++ - Difficult to store partition table on NAND device - normally put it ++ in the source code, kernel bootparams, or device tree (the best way!) ++ - Sub-properties: ++ - label: the partition name, as shown by mtdinfo /dev/mtd* ++ - reg: the size and offset of this partition. ++ - (optional) read-only: an empty property flagging as read only ++ ++Example: ++ ++nand: flash@0 { ++ compatible = "brcm,bcm2835-smi-nand"; ++ status = "okay"; ++ ++ partition@0 { ++ label = "stage2"; ++ // 128k ++ reg = <0 0x20000>; ++ read-only; ++ }; ++ partition@1 { ++ label = "firmware"; ++ // 16M ++ reg = <0x20000 0x1000000>; ++ read-only; ++ }; ++ partition@2 { ++ label = "root"; ++ // 2G ++ reg = <0x1020000 0x80000000>; ++ }; ++}; +\ No newline at end of file +diff --git a/drivers/mtd/nand/Kconfig b/drivers/mtd/nand/Kconfig +index f05e0e9..8c69541 100644 +--- a/drivers/mtd/nand/Kconfig ++++ b/drivers/mtd/nand/Kconfig +@@ -41,6 +41,13 @@ config MTD_SM_COMMON + tristate + default n + ++config MTD_NAND_BCM2835_SMI ++ tristate "Use Broadcom's Secondary Memory Interface as a NAND controller (BCM283x)" ++ depends on (MACH_BCM2708 || MACH_BCM2709 || ARCH_BCM2835) && BCM2835_SMI && MTD_NAND ++ default m ++ help ++ Uses the BCM2835's SMI peripheral as a NAND controller. ++ + config MTD_NAND_DENALI + tristate + +diff --git a/drivers/mtd/nand/Makefile b/drivers/mtd/nand/Makefile +index f553353..ea8d647 100644 +--- a/drivers/mtd/nand/Makefile ++++ b/drivers/mtd/nand/Makefile +@@ -14,6 +14,7 @@ obj-$(CONFIG_MTD_NAND_DENALI) += denali.o + obj-$(CONFIG_MTD_NAND_DENALI_PCI) += denali_pci.o + obj-$(CONFIG_MTD_NAND_DENALI_DT) += denali_dt.o + obj-$(CONFIG_MTD_NAND_AU1550) += au1550nd.o ++obj-$(CONFIG_MTD_NAND_BCM2835_SMI) += bcm2835_smi_nand.o + obj-$(CONFIG_MTD_NAND_BF5XX) += bf5xx_nand.o + obj-$(CONFIG_MTD_NAND_S3C2410) += s3c2410.o + obj-$(CONFIG_MTD_NAND_DAVINCI) += davinci_nand.o +diff --git a/drivers/mtd/nand/bcm2835_smi_nand.c b/drivers/mtd/nand/bcm2835_smi_nand.c +new file mode 100644 +index 0000000..02adda6 +--- /dev/null ++++ b/drivers/mtd/nand/bcm2835_smi_nand.c +@@ -0,0 +1,267 @@ ++/** ++ * NAND flash driver for Broadcom Secondary Memory Interface ++ * ++ * Written by Luke Wren <luke@raspberrypi.org> ++ * Copyright (c) 2015, Raspberry Pi (Trading) Ltd. ++ * ++ * 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, ++ * without modification. ++ * 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. ++ * 3. The names of the above-listed copyright holders may not be used ++ * to endorse or promote products derived from this software without ++ * specific prior written permission. ++ * ++ * ALTERNATIVELY, this software may be distributed under the terms of the ++ * GNU General Public License ("GPL") version 2, as published by the Free ++ * Software Foundation. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER OR ++ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ++ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, ++ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR ++ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF ++ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING ++ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ */ ++ ++#include <linux/kernel.h> ++#include <linux/module.h> ++#include <linux/of.h> ++#include <linux/platform_device.h> ++#include <linux/slab.h> ++#include <linux/mtd/nand.h> ++#include <linux/mtd/partitions.h> ++ ++#include <linux/broadcom/bcm2835_smi.h> ++ ++#define DEVICE_NAME "bcm2835-smi-nand" ++#define DRIVER_NAME "smi-nand-bcm2835" ++ ++struct bcm2835_smi_nand_host { ++ struct bcm2835_smi_instance *smi_inst; ++ struct nand_chip nand_chip; ++ struct mtd_info mtd; ++ struct device *dev; ++}; ++ ++/**************************************************************************** ++* ++* NAND functionality implementation ++* ++****************************************************************************/ ++ ++#define SMI_NAND_CLE_PIN 0x01 ++#define SMI_NAND_ALE_PIN 0x02 ++ ++static inline void bcm2835_smi_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, ++ unsigned int ctrl) ++{ ++ uint32_t cmd32 = cmd; ++ uint32_t addr = ~(SMI_NAND_CLE_PIN | SMI_NAND_ALE_PIN); ++ struct bcm2835_smi_nand_host *host = dev_get_drvdata(mtd->dev.parent); ++ struct bcm2835_smi_instance *inst = host->smi_inst; ++ ++ if (ctrl & NAND_CLE) ++ addr |= SMI_NAND_CLE_PIN; ++ if (ctrl & NAND_ALE) ++ addr |= SMI_NAND_ALE_PIN; ++ /* Lower ALL the CS pins! */ ++ if (ctrl & NAND_NCE) ++ addr &= (SMI_NAND_CLE_PIN | SMI_NAND_ALE_PIN); ++ ++ bcm2835_smi_set_address(inst, addr); ++ ++ if (cmd != NAND_CMD_NONE) ++ bcm2835_smi_write_buf(inst, &cmd32, 1); ++} ++ ++static inline uint8_t bcm2835_smi_nand_read_byte(struct mtd_info *mtd) ++{ ++ uint8_t byte; ++ struct bcm2835_smi_nand_host *host = dev_get_drvdata(mtd->dev.parent); ++ struct bcm2835_smi_instance *inst = host->smi_inst; ++ ++ bcm2835_smi_read_buf(inst, &byte, 1); ++ return byte; ++} ++ ++static inline void bcm2835_smi_nand_write_byte(struct mtd_info *mtd, ++ uint8_t byte) ++{ ++ struct bcm2835_smi_nand_host *host = dev_get_drvdata(mtd->dev.parent); ++ struct bcm2835_smi_instance *inst = host->smi_inst; ++ ++ bcm2835_smi_write_buf(inst, &byte, 1); ++} ++ ++static inline void bcm2835_smi_nand_write_buf(struct mtd_info *mtd, ++ const uint8_t *buf, int len) ++{ ++ struct bcm2835_smi_nand_host *host = dev_get_drvdata(mtd->dev.parent); ++ struct bcm2835_smi_instance *inst = host->smi_inst; ++ ++ bcm2835_smi_write_buf(inst, buf, len); ++} ++ ++static inline void bcm2835_smi_nand_read_buf(struct mtd_info *mtd, ++ uint8_t *buf, int len) ++{ ++ struct bcm2835_smi_nand_host *host = dev_get_drvdata(mtd->dev.parent); ++ struct bcm2835_smi_instance *inst = host->smi_inst; ++ ++ bcm2835_smi_read_buf(inst, buf, len); ++} ++ ++/**************************************************************************** ++* ++* Probe and remove functions ++* ++***************************************************************************/ ++ ++static int bcm2835_smi_nand_probe(struct platform_device *pdev) ++{ ++ struct bcm2835_smi_nand_host *host; ++ struct nand_chip *this; ++ struct mtd_info *mtd; ++ struct device *dev = &pdev->dev; ++ struct device_node *node = dev->of_node, *smi_node; ++ struct mtd_part_parser_data ppdata; ++ struct smi_settings *smi_settings; ++ struct bcm2835_smi_instance *smi_inst; ++ int ret = -ENXIO; ++ ++ if (!node) { ++ dev_err(dev, "No device tree node supplied!"); ++ return -EINVAL; ++ } ++ ++ smi_node = of_parse_phandle(node, "smi_handle", 0); ++ ++ /* Request use of SMI peripheral: */ ++ smi_inst = bcm2835_smi_get(smi_node); ++ ++ if (!smi_inst) { ++ dev_err(dev, "Could not register with SMI."); ++ return -EPROBE_DEFER; ++ } ++ ++ /* Set SMI timing and bus width */ ++ ++ smi_settings = bcm2835_smi_get_settings_from_regs(smi_inst); ++ ++ smi_settings->data_width = SMI_WIDTH_8BIT; ++ smi_settings->read_setup_time = 2; ++ smi_settings->read_hold_time = 1; ++ smi_settings->read_pace_time = 1; ++ smi_settings->read_strobe_time = 3; ++ ++ smi_settings->write_setup_time = 2; ++ smi_settings->write_hold_time = 1; ++ smi_settings->write_pace_time = 1; ++ smi_settings->write_strobe_time = 3; ++ ++ bcm2835_smi_set_regs_from_settings(smi_inst); ++ ++ host = devm_kzalloc(dev, sizeof(struct bcm2835_smi_nand_host), ++ GFP_KERNEL); ++ if (!host) ++ return -ENOMEM; ++ ++ host->dev = dev; ++ host->smi_inst = smi_inst; ++ ++ platform_set_drvdata(pdev, host); ++ ++ /* Link the structures together */ ++ ++ this = &host->nand_chip; ++ mtd = &host->mtd; ++ mtd->priv = this; ++ mtd->owner = THIS_MODULE; ++ mtd->dev.parent = dev; ++ mtd->name = DRIVER_NAME; ++ ++ /* 20 us command delay time... */ ++ this->chip_delay = 20; ++ ++ this->priv = host; ++ this->cmd_ctrl = bcm2835_smi_nand_cmd_ctrl; ++ this->read_byte = bcm2835_smi_nand_read_byte; ++ this->write_byte = bcm2835_smi_nand_write_byte; ++ this->write_buf = bcm2835_smi_nand_write_buf; ++ this->read_buf = bcm2835_smi_nand_read_buf; ++ ++ this->ecc.mode = NAND_ECC_SOFT; ++ ++ /* Should never be accessed directly: */ ++ ++ this->IO_ADDR_R = (void *)0xdeadbeef; ++ this->IO_ADDR_W = (void *)0xdeadbeef; ++ ++ /* First scan to find the device and get the page size */ ++ ++ if (nand_scan_ident(mtd, 1, NULL)) ++ return -ENXIO; ++ ++ /* Second phase scan */ ++ ++ if (nand_scan_tail(mtd)) ++ return -ENXIO; ++ ++ ret = mtd_device_parse_register(mtd, NULL, &ppdata, NULL, 0); ++ if (!ret) ++ return 0; ++ ++ nand_release(mtd); ++ return -EINVAL; ++} ++ ++static int bcm2835_smi_nand_remove(struct platform_device *pdev) ++{ ++ struct bcm2835_smi_nand_host *host = platform_get_drvdata(pdev); ++ ++ nand_release(&host->mtd); ++ ++ return 0; ++} ++ ++/**************************************************************************** ++* ++* Register the driver with device tree ++* ++***************************************************************************/ ++ ++static const struct of_device_id bcm2835_smi_nand_of_match[] = { ++ {.compatible = "brcm,bcm2835-smi-nand",}, ++ { /* sentinel */ } ++}; ++ ++MODULE_DEVICE_TABLE(of, bcm2835_smi_nand_of_match); ++ ++static struct platform_driver bcm2835_smi_nand_driver = { ++ .probe = bcm2835_smi_nand_probe, ++ .remove = bcm2835_smi_nand_remove, ++ .driver = { ++ .name = DRIVER_NAME, ++ .owner = THIS_MODULE, ++ .of_match_table = bcm2835_smi_nand_of_match, ++ }, ++}; ++ ++module_platform_driver(bcm2835_smi_nand_driver); ++ ++MODULE_ALIAS("platform:smi-nand-bcm2835"); ++MODULE_LICENSE("GPL"); ++MODULE_DESCRIPTION ++ ("Driver for NAND chips using Broadcom Secondary Memory Interface"); ++MODULE_AUTHOR("Luke Wren <luke@raspberrypi.org>"); + +From d294fc10d2c2d93dd5280e2ef30f4b6dfa7ad3bf Mon Sep 17 00:00:00 2001 +From: Aron Szabo <aron@aron.ws> +Date: Sat, 16 Jun 2012 12:15:55 +0200 +Subject: [PATCH 047/112] lirc: added support for RaspberryPi GPIO + +lirc_rpi: Use read_current_timer to determine transmitter delay. Thanks to jjmz and others +See: https://github.com/raspberrypi/linux/issues/525 + +lirc: Remove restriction on gpio pins that can be used with lirc + +Compute Module, for example could use different pins + +lirc_rpi: Add parameter to specify input pin pull + +Depending on the connected IR circuitry it might be desirable to change the +gpios internal pull from it pull-down default behaviour. Add a module +parameter to allow the user to set it explicitly. + +Signed-off-by: Julian Scheel <julian@jusst.de> + +lirc-rpi: Use the higher-level irq control functions + +This module used to access the irq_chip methods of the +gpio controller directly, rather than going through the +standard enable_irq/irq_set_irq_type functions. This +caused problems on pinctrl-bcm2835 which only implements +the irq_enable/disable methods and not irq_unmask/mask. + +lirc-rpi: Correct the interrupt usage + +1) Correct the use of enable_irq (i.e. don't call it so often) +2) Correct the shutdown sequence. +3) Avoid a bcm2708_gpio driver quirk by setting the irq flags earlier + +lirc-rpi: use getnstimeofday instead of read_current_timer + +read_current_timer isn't guaranteed to return values in +microseconds, and indeed it doesn't on a Pi2. + +Issue: linux#827 + +lirc-rpi: Add device tree support, and a suitable overlay + +The overlay supports DT parameters that match the old module +parameters, except that gpio_in_pull should be set using the +strings "up", "down" or "off". + +lirc-rpi: Also support pinctrl-bcm2835 in non-DT mode +--- + drivers/staging/media/lirc/Kconfig | 6 + + drivers/staging/media/lirc/Makefile | 1 + + drivers/staging/media/lirc/lirc_rpi.c | 730 ++++++++++++++++++++++++++++++++++ + include/linux/platform_data/bcm2708.h | 23 ++ + 4 files changed, 760 insertions(+) + create mode 100644 drivers/staging/media/lirc/lirc_rpi.c + create mode 100644 include/linux/platform_data/bcm2708.h + +diff --git a/drivers/staging/media/lirc/Kconfig b/drivers/staging/media/lirc/Kconfig +index 6879c46..77c69f2 100644 +--- a/drivers/staging/media/lirc/Kconfig ++++ b/drivers/staging/media/lirc/Kconfig +@@ -32,6 +32,12 @@ config LIRC_PARALLEL + help + Driver for Homebrew Parallel Port Receivers + ++config LIRC_RPI ++ tristate "Homebrew GPIO Port Receiver/Transmitter for the RaspberryPi" ++ depends on LIRC ++ help ++ Driver for Homebrew GPIO Port Receiver/Transmitter for the RaspberryPi ++ + config LIRC_SASEM + tristate "Sasem USB IR Remote" + depends on LIRC && USB +diff --git a/drivers/staging/media/lirc/Makefile b/drivers/staging/media/lirc/Makefile +index 5430adf..9e53cd0 100644 +--- a/drivers/staging/media/lirc/Makefile ++++ b/drivers/staging/media/lirc/Makefile +@@ -6,6 +6,7 @@ + obj-$(CONFIG_LIRC_BT829) += lirc_bt829.o + obj-$(CONFIG_LIRC_IMON) += lirc_imon.o + obj-$(CONFIG_LIRC_PARALLEL) += lirc_parallel.o ++obj-$(CONFIG_LIRC_RPI) += lirc_rpi.o + obj-$(CONFIG_LIRC_SASEM) += lirc_sasem.o + obj-$(CONFIG_LIRC_SERIAL) += lirc_serial.o + obj-$(CONFIG_LIRC_SIR) += lirc_sir.o +diff --git a/drivers/staging/media/lirc/lirc_rpi.c b/drivers/staging/media/lirc/lirc_rpi.c +new file mode 100644 +index 0000000..0624439 +--- /dev/null ++++ b/drivers/staging/media/lirc/lirc_rpi.c +@@ -0,0 +1,730 @@ ++/* ++ * lirc_rpi.c ++ * ++ * lirc_rpi - Device driver that records pulse- and pause-lengths ++ * (space-lengths) (just like the lirc_serial driver does) ++ * between GPIO interrupt events on the Raspberry Pi. ++ * Lots of code has been taken from the lirc_serial module, ++ * so I would like say thanks to the authors. ++ * ++ * Copyright (C) 2012 Aron Robert Szabo <aron@reon.hu>, ++ * Michael Bishop <cleverca22@gmail.com> ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ */ ++ ++#include <linux/module.h> ++#include <linux/errno.h> ++#include <linux/interrupt.h> ++#include <linux/sched.h> ++#include <linux/kernel.h> ++#include <linux/time.h> ++#include <linux/timex.h> ++#include <linux/timekeeping.h> ++#include <linux/string.h> ++#include <linux/delay.h> ++#include <linux/platform_device.h> ++#include <linux/irq.h> ++#include <linux/spinlock.h> ++#include <media/lirc.h> ++#include <media/lirc_dev.h> ++#include <linux/gpio.h> ++#include <linux/of_platform.h> ++#include <linux/platform_data/bcm2708.h> ++ ++#define LIRC_DRIVER_NAME "lirc_rpi" ++#define RBUF_LEN 256 ++#define LIRC_TRANSMITTER_LATENCY 50 ++ ++#ifndef MAX_UDELAY_MS ++#define MAX_UDELAY_US 5000 ++#else ++#define MAX_UDELAY_US (MAX_UDELAY_MS*1000) ++#endif ++ ++#define dprintk(fmt, args...) \ ++ do { \ ++ if (debug) \ ++ printk(KERN_DEBUG LIRC_DRIVER_NAME ": " \ ++ fmt, ## args); \ ++ } while (0) ++ ++/* module parameters */ ++ ++/* set the default GPIO input pin */ ++static int gpio_in_pin = 18; ++/* set the default pull behaviour for input pin */ ++static int gpio_in_pull = BCM2708_PULL_DOWN; ++/* set the default GPIO output pin */ ++static int gpio_out_pin = 17; ++/* enable debugging messages */ ++static bool debug; ++/* -1 = auto, 0 = active high, 1 = active low */ ++static int sense = -1; ++/* use softcarrier by default */ ++static bool softcarrier = 1; ++/* 0 = do not invert output, 1 = invert output */ ++static bool invert = 0; ++ ++struct gpio_chip *gpiochip; ++static int irq_num; ++ ++/* forward declarations */ ++static long send_pulse(unsigned long length); ++static void send_space(long length); ++static void lirc_rpi_exit(void); ++ ++static struct platform_device *lirc_rpi_dev; ++static struct timeval lasttv = { 0, 0 }; ++static struct lirc_buffer rbuf; ++static spinlock_t lock; ++ ++/* initialized/set in init_timing_params() */ ++static unsigned int freq = 38000; ++static unsigned int duty_cycle = 50; ++static unsigned long period; ++static unsigned long pulse_width; ++static unsigned long space_width; ++ ++static void safe_udelay(unsigned long usecs) ++{ ++ while (usecs > MAX_UDELAY_US) { ++ udelay(MAX_UDELAY_US); ++ usecs -= MAX_UDELAY_US; ++ } ++ udelay(usecs); ++} ++ ++static unsigned long read_current_us(void) ++{ ++ struct timespec now; ++ getnstimeofday(&now); ++ return (now.tv_sec * 1000000) + (now.tv_nsec/1000); ++} ++ ++static int init_timing_params(unsigned int new_duty_cycle, ++ unsigned int new_freq) ++{ ++ if (1000 * 1000000L / new_freq * new_duty_cycle / 100 <= ++ LIRC_TRANSMITTER_LATENCY) ++ return -EINVAL; ++ if (1000 * 1000000L / new_freq * (100 - new_duty_cycle) / 100 <= ++ LIRC_TRANSMITTER_LATENCY) ++ return -EINVAL; ++ duty_cycle = new_duty_cycle; ++ freq = new_freq; ++ period = 1000 * 1000000L / freq; ++ pulse_width = period * duty_cycle / 100; ++ space_width = period - pulse_width; ++ dprintk("in init_timing_params, freq=%d pulse=%ld, " ++ "space=%ld\n", freq, pulse_width, space_width); ++ return 0; ++} ++ ++static long send_pulse_softcarrier(unsigned long length) ++{ ++ int flag; ++ unsigned long actual, target; ++ unsigned long actual_us, initial_us, target_us; ++ ++ length *= 1000; ++ ++ actual = 0; target = 0; flag = 0; ++ actual_us = read_current_us(); ++ ++ while (actual < length) { ++ if (flag) { ++ gpiochip->set(gpiochip, gpio_out_pin, invert); ++ target += space_width; ++ } else { ++ gpiochip->set(gpiochip, gpio_out_pin, !invert); ++ target += pulse_width; ++ } ++ initial_us = actual_us; ++ target_us = actual_us + (target - actual) / 1000; ++ /* ++ * Note - we've checked in ioctl that the pulse/space ++ * widths are big enough so that d is > 0 ++ */ ++ if ((int)(target_us - actual_us) > 0) ++ udelay(target_us - actual_us); ++ actual_us = read_current_us(); ++ actual += (actual_us - initial_us) * 1000; ++ flag = !flag; ++ } ++ return (actual-length) / 1000; ++} ++ ++static long send_pulse(unsigned long length) ++{ ++ if (length <= 0) ++ return 0; ++ ++ if (softcarrier) { ++ return send_pulse_softcarrier(length); ++ } else { ++ gpiochip->set(gpiochip, gpio_out_pin, !invert); ++ safe_udelay(length); ++ return 0; ++ } ++} ++ ++static void send_space(long length) ++{ ++ gpiochip->set(gpiochip, gpio_out_pin, invert); ++ if (length <= 0) ++ return; ++ safe_udelay(length); ++} ++ ++static void rbwrite(int l) ++{ ++ if (lirc_buffer_full(&rbuf)) { ++ /* no new signals will be accepted */ ++ dprintk("Buffer overrun\n"); ++ return; ++ } ++ lirc_buffer_write(&rbuf, (void *)&l); ++} ++ ++static void frbwrite(int l) ++{ ++ /* simple noise filter */ ++ static int pulse, space; ++ static unsigned int ptr; ++ ++ if (ptr > 0 && (l & PULSE_BIT)) { ++ pulse += l & PULSE_MASK; ++ if (pulse > 250) { ++ rbwrite(space); ++ rbwrite(pulse | PULSE_BIT); ++ ptr = 0; ++ pulse = 0; ++ } ++ return; ++ } ++ if (!(l & PULSE_BIT)) { ++ if (ptr == 0) { ++ if (l > 20000) { ++ space = l; ++ ptr++; ++ return; ++ } ++ } else { ++ if (l > 20000) { ++ space += pulse; ++ if (space > PULSE_MASK) ++ space = PULSE_MASK; ++ space += l; ++ if (space > PULSE_MASK) ++ space = PULSE_MASK; ++ pulse = 0; ++ return; ++ } ++ rbwrite(space); ++ rbwrite(pulse | PULSE_BIT); ++ ptr = 0; ++ pulse = 0; ++ } ++ } ++ rbwrite(l); ++} ++ ++static irqreturn_t irq_handler(int i, void *blah, struct pt_regs *regs) ++{ ++ struct timeval tv; ++ long deltv; ++ int data; ++ int signal; ++ ++ /* use the GPIO signal level */ ++ signal = gpiochip->get(gpiochip, gpio_in_pin); ++ ++ if (sense != -1) { ++ /* get current time */ ++ do_gettimeofday(&tv); ++ ++ /* calc time since last interrupt in microseconds */ ++ deltv = tv.tv_sec-lasttv.tv_sec; ++ if (tv.tv_sec < lasttv.tv_sec || ++ (tv.tv_sec == lasttv.tv_sec && ++ tv.tv_usec < lasttv.tv_usec)) { ++ printk(KERN_WARNING LIRC_DRIVER_NAME ++ ": AIEEEE: your clock just jumped backwards\n"); ++ printk(KERN_WARNING LIRC_DRIVER_NAME ++ ": %d %d %lx %lx %lx %lx\n", signal, sense, ++ tv.tv_sec, lasttv.tv_sec, ++ tv.tv_usec, lasttv.tv_usec); ++ data = PULSE_MASK; ++ } else if (deltv > 15) { ++ data = PULSE_MASK; /* really long time */ ++ if (!(signal^sense)) { ++ /* sanity check */ ++ printk(KERN_DEBUG LIRC_DRIVER_NAME ++ ": AIEEEE: %d %d %lx %lx %lx %lx\n", ++ signal, sense, tv.tv_sec, lasttv.tv_sec, ++ tv.tv_usec, lasttv.tv_usec); ++ /* ++ * detecting pulse while this ++ * MUST be a space! ++ */ ++ sense = sense ? 0 : 1; ++ } ++ } else { ++ data = (int) (deltv*1000000 + ++ (tv.tv_usec - lasttv.tv_usec)); ++ } ++ frbwrite(signal^sense ? data : (data|PULSE_BIT)); ++ lasttv = tv; ++ wake_up_interruptible(&rbuf.wait_poll); ++ } ++ ++ return IRQ_HANDLED; ++} ++ ++static int is_right_chip(struct gpio_chip *chip, void *data) ++{ ++ dprintk("is_right_chip %s %d\n", chip->label, strcmp(data, chip->label)); ++ ++ if (strcmp(data, chip->label) == 0) ++ return 1; ++ return 0; ++} ++ ++static inline int read_bool_property(const struct device_node *np, ++ const char *propname, ++ bool *out_value) ++{ ++ u32 value = 0; ++ int err = of_property_read_u32(np, propname, &value); ++ if (err == 0) ++ *out_value = (value != 0); ++ return err; ++} ++ ++static void read_pin_settings(struct device_node *node) ++{ ++ u32 pin; ++ int index; ++ ++ for (index = 0; ++ of_property_read_u32_index( ++ node, ++ "brcm,pins", ++ index, ++ &pin) == 0; ++ index++) { ++ u32 function; ++ int err; ++ err = of_property_read_u32_index( ++ node, ++ "brcm,function", ++ index, ++ &function); ++ if (err == 0) { ++ if (function == 1) /* Output */ ++ gpio_out_pin = pin; ++ else if (function == 0) /* Input */ ++ gpio_in_pin = pin; ++ } ++ } ++} ++ ++static int init_port(void) ++{ ++ int i, nlow, nhigh; ++ struct device_node *node; ++ ++ node = lirc_rpi_dev->dev.of_node; ++ ++ gpiochip = gpiochip_find("bcm2708_gpio", is_right_chip); ++ ++ /* ++ * Because of the lack of a setpull function, only support ++ * pinctrl-bcm2835 if using device tree. ++ */ ++ if (!gpiochip && node) ++ gpiochip = gpiochip_find("pinctrl-bcm2835", is_right_chip); ++ ++ if (!gpiochip) { ++ pr_err(LIRC_DRIVER_NAME ": gpio chip not found!\n"); ++ return -ENODEV; ++ } ++ ++ if (node) { ++ struct device_node *pins_node; ++ ++ pins_node = of_parse_phandle(node, "pinctrl-0", 0); ++ if (!pins_node) { ++ printk(KERN_ERR LIRC_DRIVER_NAME ++ ": pinctrl settings not found!\n"); ++ return -EINVAL; ++ } ++ ++ read_pin_settings(pins_node); ++ ++ of_property_read_u32(node, "rpi,sense", &sense); ++ ++ read_bool_property(node, "rpi,softcarrier", &softcarrier); ++ ++ read_bool_property(node, "rpi,invert", &invert); ++ ++ read_bool_property(node, "rpi,debug", &debug); ++ ++ } else { ++ return -EINVAL; ++ } ++ ++ gpiochip->set(gpiochip, gpio_out_pin, invert); ++ ++ irq_num = gpiochip->to_irq(gpiochip, gpio_in_pin); ++ dprintk("to_irq %d\n", irq_num); ++ ++ /* if pin is high, then this must be an active low receiver. */ ++ if (sense == -1) { ++ /* wait 1/2 sec for the power supply */ ++ msleep(500); ++ ++ /* ++ * probe 9 times every 0.04s, collect "votes" for ++ * active high/low ++ */ ++ nlow = 0; ++ nhigh = 0; ++ for (i = 0; i < 9; i++) { ++ if (gpiochip->get(gpiochip, gpio_in_pin)) ++ nlow++; ++ else ++ nhigh++; ++ msleep(40); ++ } ++ sense = (nlow >= nhigh ? 1 : 0); ++ printk(KERN_INFO LIRC_DRIVER_NAME ++ ": auto-detected active %s receiver on GPIO pin %d\n", ++ sense ? "low" : "high", gpio_in_pin); ++ } else { ++ printk(KERN_INFO LIRC_DRIVER_NAME ++ ": manually using active %s receiver on GPIO pin %d\n", ++ sense ? "low" : "high", gpio_in_pin); ++ } ++ ++ return 0; ++} ++ ++// called when the character device is opened ++static int set_use_inc(void *data) ++{ ++ int result; ++ ++ /* initialize timestamp */ ++ do_gettimeofday(&lasttv); ++ ++ result = request_irq(irq_num, ++ (irq_handler_t) irq_handler, ++ IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING, ++ LIRC_DRIVER_NAME, (void*) 0); ++ ++ switch (result) { ++ case -EBUSY: ++ printk(KERN_ERR LIRC_DRIVER_NAME ++ ": IRQ %d is busy\n", ++ irq_num); ++ return -EBUSY; ++ case -EINVAL: ++ printk(KERN_ERR LIRC_DRIVER_NAME ++ ": Bad irq number or handler\n"); ++ return -EINVAL; ++ default: ++ dprintk("Interrupt %d obtained\n", ++ irq_num); ++ break; ++ }; ++ ++ /* initialize pulse/space widths */ ++ init_timing_params(duty_cycle, freq); ++ ++ return 0; ++} ++ ++static void set_use_dec(void *data) ++{ ++ /* GPIO Pin Falling/Rising Edge Detect Disable */ ++ irq_set_irq_type(irq_num, 0); ++ disable_irq(irq_num); ++ ++ free_irq(irq_num, (void *) 0); ++ ++ dprintk(KERN_INFO LIRC_DRIVER_NAME ++ ": freed IRQ %d\n", irq_num); ++} ++ ++static ssize_t lirc_write(struct file *file, const char *buf, ++ size_t n, loff_t *ppos) ++{ ++ int i, count; ++ unsigned long flags; ++ long delta = 0; ++ int *wbuf; ++ ++ count = n / sizeof(int); ++ if (n % sizeof(int) || count % 2 == 0) ++ return -EINVAL; ++ wbuf = memdup_user(buf, n); ++ if (IS_ERR(wbuf)) ++ return PTR_ERR(wbuf); ++ spin_lock_irqsave(&lock, flags); ++ ++ for (i = 0; i < count; i++) { ++ if (i%2) ++ send_space(wbuf[i] - delta); ++ else ++ delta = send_pulse(wbuf[i]); ++ } ++ gpiochip->set(gpiochip, gpio_out_pin, invert); ++ ++ spin_unlock_irqrestore(&lock, flags); ++ kfree(wbuf); ++ return n; ++} ++ ++static long lirc_ioctl(struct file *filep, unsigned int cmd, unsigned long arg) ++{ ++ int result; ++ __u32 value; ++ ++ switch (cmd) { ++ case LIRC_GET_SEND_MODE: ++ return -ENOIOCTLCMD; ++ break; ++ ++ case LIRC_SET_SEND_MODE: ++ result = get_user(value, (__u32 *) arg); ++ if (result) ++ return result; ++ /* only LIRC_MODE_PULSE supported */ ++ if (value != LIRC_MODE_PULSE) ++ return -ENOSYS; ++ break; ++ ++ case LIRC_GET_LENGTH: ++ return -ENOSYS; ++ break; ++ ++ case LIRC_SET_SEND_DUTY_CYCLE: ++ dprintk("SET_SEND_DUTY_CYCLE\n"); ++ result = get_user(value, (__u32 *) arg); ++ if (result) ++ return result; ++ if (value <= 0 || value > 100) ++ return -EINVAL; ++ return init_timing_params(value, freq); ++ break; ++ ++ case LIRC_SET_SEND_CARRIER: ++ dprintk("SET_SEND_CARRIER\n"); ++ result = get_user(value, (__u32 *) arg); ++ if (result) ++ return result; ++ if (value > 500000 || value < 20000) ++ return -EINVAL; ++ return init_timing_params(duty_cycle, value); ++ break; ++ ++ default: ++ return lirc_dev_fop_ioctl(filep, cmd, arg); ++ } ++ return 0; ++} ++ ++static const struct file_operations lirc_fops = { ++ .owner = THIS_MODULE, ++ .write = lirc_write, ++ .unlocked_ioctl = lirc_ioctl, ++ .read = lirc_dev_fop_read, ++ .poll = lirc_dev_fop_poll, ++ .open = lirc_dev_fop_open, ++ .release = lirc_dev_fop_close, ++ .llseek = no_llseek, ++}; ++ ++static struct lirc_driver driver = { ++ .name = LIRC_DRIVER_NAME, ++ .minor = -1, ++ .code_length = 1, ++ .sample_rate = 0, ++ .data = NULL, ++ .add_to_buf = NULL, ++ .rbuf = &rbuf, ++ .set_use_inc = set_use_inc, ++ .set_use_dec = set_use_dec, ++ .fops = &lirc_fops, ++ .dev = NULL, ++ .owner = THIS_MODULE, ++}; ++ ++static const struct of_device_id lirc_rpi_of_match[] = { ++ { .compatible = "rpi,lirc-rpi", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, lirc_rpi_of_match); ++ ++static struct platform_driver lirc_rpi_driver = { ++ .driver = { ++ .name = LIRC_DRIVER_NAME, ++ .owner = THIS_MODULE, ++ .of_match_table = of_match_ptr(lirc_rpi_of_match), ++ }, ++}; ++ ++static int __init lirc_rpi_init(void) ++{ ++ struct device_node *node; ++ int result; ++ ++ /* Init read buffer. */ ++ result = lirc_buffer_init(&rbuf, sizeof(int), RBUF_LEN); ++ if (result < 0) ++ return -ENOMEM; ++ ++ result = platform_driver_register(&lirc_rpi_driver); ++ if (result) { ++ printk(KERN_ERR LIRC_DRIVER_NAME ++ ": lirc register returned %d\n", result); ++ goto exit_buffer_free; ++ } ++ ++ node = of_find_compatible_node(NULL, NULL, ++ lirc_rpi_of_match[0].compatible); ++ ++ if (node) { ++ /* DT-enabled */ ++ lirc_rpi_dev = of_find_device_by_node(node); ++ WARN_ON(lirc_rpi_dev->dev.of_node != node); ++ of_node_put(node); ++ } ++ else { ++ lirc_rpi_dev = platform_device_alloc(LIRC_DRIVER_NAME, 0); ++ if (!lirc_rpi_dev) { ++ result = -ENOMEM; ++ goto exit_driver_unregister; ++ } ++ ++ result = platform_device_add(lirc_rpi_dev); ++ if (result) ++ goto exit_device_put; ++ } ++ ++ return 0; ++ ++ exit_device_put: ++ platform_device_put(lirc_rpi_dev); ++ ++ exit_driver_unregister: ++ platform_driver_unregister(&lirc_rpi_driver); ++ ++ exit_buffer_free: ++ lirc_buffer_free(&rbuf); ++ ++ return result; ++} ++ ++static void lirc_rpi_exit(void) ++{ ++ if (!lirc_rpi_dev->dev.of_node) ++ platform_device_unregister(lirc_rpi_dev); ++ platform_driver_unregister(&lirc_rpi_driver); ++ lirc_buffer_free(&rbuf); ++} ++ ++static int __init lirc_rpi_init_module(void) ++{ ++ int result; ++ ++ result = lirc_rpi_init(); ++ if (result) ++ return result; ++ ++ result = init_port(); ++ if (result < 0) ++ goto exit_rpi; ++ ++ driver.features = LIRC_CAN_SET_SEND_DUTY_CYCLE | ++ LIRC_CAN_SET_SEND_CARRIER | ++ LIRC_CAN_SEND_PULSE | ++ LIRC_CAN_REC_MODE2; ++ ++ driver.dev = &lirc_rpi_dev->dev; ++ driver.minor = lirc_register_driver(&driver); ++ ++ if (driver.minor < 0) { ++ printk(KERN_ERR LIRC_DRIVER_NAME ++ ": device registration failed with %d\n", result); ++ result = -EIO; ++ goto exit_rpi; ++ } ++ ++ printk(KERN_INFO LIRC_DRIVER_NAME ": driver registered!\n"); ++ ++ return 0; ++ ++ exit_rpi: ++ lirc_rpi_exit(); ++ ++ return result; ++} ++ ++static void __exit lirc_rpi_exit_module(void) ++{ ++ lirc_unregister_driver(driver.minor); ++ ++ gpio_free(gpio_out_pin); ++ gpio_free(gpio_in_pin); ++ ++ lirc_rpi_exit(); ++ ++ printk(KERN_INFO LIRC_DRIVER_NAME ": cleaned up module\n"); ++} ++ ++module_init(lirc_rpi_init_module); ++module_exit(lirc_rpi_exit_module); ++ ++MODULE_DESCRIPTION("Infra-red receiver and blaster driver for Raspberry Pi GPIO."); ++MODULE_AUTHOR("Aron Robert Szabo <aron@reon.hu>"); ++MODULE_AUTHOR("Michael Bishop <cleverca22@gmail.com>"); ++MODULE_LICENSE("GPL"); ++ ++module_param(gpio_out_pin, int, S_IRUGO); ++MODULE_PARM_DESC(gpio_out_pin, "GPIO output/transmitter pin number of the BCM" ++ " processor. (default 17"); ++ ++module_param(gpio_in_pin, int, S_IRUGO); ++MODULE_PARM_DESC(gpio_in_pin, "GPIO input pin number of the BCM processor." ++ " (default 18"); ++ ++module_param(gpio_in_pull, int, S_IRUGO); ++MODULE_PARM_DESC(gpio_in_pull, "GPIO input pin pull configuration." ++ " (0 = off, 1 = up, 2 = down, default down)"); ++ ++module_param(sense, int, S_IRUGO); ++MODULE_PARM_DESC(sense, "Override autodetection of IR receiver circuit" ++ " (0 = active high, 1 = active low )"); ++ ++module_param(softcarrier, bool, S_IRUGO); ++MODULE_PARM_DESC(softcarrier, "Software carrier (0 = off, 1 = on, default on)"); ++ ++module_param(invert, bool, S_IRUGO); ++MODULE_PARM_DESC(invert, "Invert output (0 = off, 1 = on, default off"); ++ ++module_param(debug, bool, S_IRUGO | S_IWUSR); ++MODULE_PARM_DESC(debug, "Enable debugging messages"); +diff --git a/include/linux/platform_data/bcm2708.h b/include/linux/platform_data/bcm2708.h +new file mode 100644 +index 0000000..fb69624 +--- /dev/null ++++ b/include/linux/platform_data/bcm2708.h +@@ -0,0 +1,23 @@ ++/* ++ * include/linux/platform_data/bcm2708.h ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 as ++ * published by the Free Software Foundation. ++ * ++ * (C) 2014 Julian Scheel <julian@jusst.de> ++ * ++ */ ++#ifndef __BCM2708_H_ ++#define __BCM2708_H_ ++ ++typedef enum { ++ BCM2708_PULL_OFF, ++ BCM2708_PULL_UP, ++ BCM2708_PULL_DOWN ++} bcm2708_gpio_pull_t; ++ ++extern int bcm2708_gpio_setpull(struct gpio_chip *gc, unsigned offset, ++ bcm2708_gpio_pull_t value); ++ ++#endif + +From 2fd607ce8d6e45776c6f6d750dc5e167d8865f54 Mon Sep 17 00:00:00 2001 +From: popcornmix <popcornmix@gmail.com> +Date: Wed, 3 Jul 2013 00:49:20 +0100 +Subject: [PATCH 048/112] Add cpufreq driver + +Signed-off-by: popcornmix <popcornmix@gmail.com> +--- + drivers/cpufreq/Kconfig.arm | 9 ++ + drivers/cpufreq/Makefile | 1 + + drivers/cpufreq/bcm2835-cpufreq.c | 213 ++++++++++++++++++++++++++++++++++++++ + 3 files changed, 223 insertions(+) + create mode 100644 drivers/cpufreq/bcm2835-cpufreq.c + +diff --git a/drivers/cpufreq/Kconfig.arm b/drivers/cpufreq/Kconfig.arm +index 14b1f93..c6e8bd5 100644 +--- a/drivers/cpufreq/Kconfig.arm ++++ b/drivers/cpufreq/Kconfig.arm +@@ -229,6 +229,15 @@ config ARM_STI_CPUFREQ + this config option if you wish to add CPUFreq support for STi based + SoCs. + ++config ARM_BCM2835_CPUFREQ ++ depends on RASPBERRYPI_FIRMWARE ++ bool "BCM2835 Driver" ++ default y ++ help ++ This adds the CPUFreq driver for BCM2835 ++ ++ If in doubt, say N. ++ + config ARM_TEGRA20_CPUFREQ + bool "Tegra20 CPUFreq support" + depends on ARCH_TEGRA +diff --git a/drivers/cpufreq/Makefile b/drivers/cpufreq/Makefile +index 9e63fb1..9e55083 100644 +--- a/drivers/cpufreq/Makefile ++++ b/drivers/cpufreq/Makefile +@@ -74,6 +74,7 @@ obj-$(CONFIG_ARM_SA1110_CPUFREQ) += sa1110-cpufreq.o + obj-$(CONFIG_ARM_SCPI_CPUFREQ) += scpi-cpufreq.o + obj-$(CONFIG_ARM_SPEAR_CPUFREQ) += spear-cpufreq.o + obj-$(CONFIG_ARM_STI_CPUFREQ) += sti-cpufreq.o ++obj-$(CONFIG_ARM_BCM2835_CPUFREQ) += bcm2835-cpufreq.o + obj-$(CONFIG_ARM_TEGRA20_CPUFREQ) += tegra20-cpufreq.o + obj-$(CONFIG_ARM_TEGRA124_CPUFREQ) += tegra124-cpufreq.o + obj-$(CONFIG_ARM_VEXPRESS_SPC_CPUFREQ) += vexpress-spc-cpufreq.o +diff --git a/drivers/cpufreq/bcm2835-cpufreq.c b/drivers/cpufreq/bcm2835-cpufreq.c +new file mode 100644 +index 0000000..3eb9e93 +--- /dev/null ++++ b/drivers/cpufreq/bcm2835-cpufreq.c +@@ -0,0 +1,213 @@ ++/***************************************************************************** ++* Copyright 2011 Broadcom Corporation. All rights reserved. ++* ++* Unless you and Broadcom execute a separate written software license ++* agreement governing use of this software, this software is licensed to you ++* under the terms of the GNU General Public License version 2, available at ++* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). ++* ++* Notwithstanding the above, under no circumstances may you combine this ++* software in any way with any other Broadcom software provided under a ++* license other than the GPL, without Broadcom's express prior written ++* consent. ++*****************************************************************************/ ++ ++/***************************************************************************** ++* FILENAME: bcm2835-cpufreq.h ++* DESCRIPTION: This driver dynamically manages the CPU Frequency of the ARM ++* processor. Messages are sent to Videocore either setting or requesting the ++* frequency of the ARM in order to match an appropiate frequency to the current ++* usage of the processor. The policy which selects the frequency to use is ++* defined in the kernel .config file, but can be changed during runtime. ++*****************************************************************************/ ++ ++/* ---------- INCLUDES ---------- */ ++#include <linux/kernel.h> ++#include <linux/init.h> ++#include <linux/module.h> ++#include <linux/cpufreq.h> ++#include <soc/bcm2835/raspberrypi-firmware.h> ++ ++/* ---------- DEFINES ---------- */ ++/*#define CPUFREQ_DEBUG_ENABLE*/ /* enable debugging */ ++#define MODULE_NAME "bcm2835-cpufreq" ++ ++#define VCMSG_ID_ARM_CLOCK 0x000000003 /* Clock/Voltage ID's */ ++ ++/* debug printk macros */ ++#ifdef CPUFREQ_DEBUG_ENABLE ++#define print_debug(fmt,...) pr_debug("%s:%s:%d: "fmt, MODULE_NAME, __func__, __LINE__, ##__VA_ARGS__) ++#else ++#define print_debug(fmt,...) ++#endif ++#define print_err(fmt,...) pr_err("%s:%s:%d: "fmt, MODULE_NAME, __func__,__LINE__, ##__VA_ARGS__) ++#define print_info(fmt,...) pr_info("%s: "fmt, MODULE_NAME, ##__VA_ARGS__) ++ ++/* ---------- GLOBALS ---------- */ ++static struct cpufreq_driver bcm2835_cpufreq_driver; /* the cpufreq driver global */ ++ ++static struct cpufreq_frequency_table bcm2835_freq_table[] = { ++ {0, 0, 0}, ++ {0, 0, 0}, ++ {0, 0, CPUFREQ_TABLE_END}, ++}; ++ ++/* ++ =============================================== ++ clk_rate either gets or sets the clock rates. ++ =============================================== ++*/ ++ ++static int bcm2835_cpufreq_clock_property(u32 tag, u32 id, u32 *val) ++{ ++ struct rpi_firmware *fw = rpi_firmware_get(NULL); ++ struct { ++ u32 id; ++ u32 val; ++ } packet; ++ int ret; ++ ++ packet.id = id; ++ packet.val = *val; ++ ret = rpi_firmware_property(fw, tag, &packet, sizeof(packet)); ++ if (ret) ++ return ret; ++ ++ *val = packet.val; ++ ++ return 0; ++} ++ ++static uint32_t bcm2835_cpufreq_set_clock(int cur_rate, int arm_rate) ++{ ++ u32 rate = arm_rate * 1000; ++ int ret; ++ ++ ret = bcm2835_cpufreq_clock_property(RPI_FIRMWARE_SET_CLOCK_RATE, VCMSG_ID_ARM_CLOCK, &rate); ++ if (ret) { ++ print_err("Failed to set clock: %d (%d)\n", arm_rate, ret); ++ return 0; ++ } ++ ++ rate /= 1000; ++ print_debug("Setting new frequency = %d -> %d (actual %d)\n", cur_rate, arm_rate, rate); ++ ++ return rate; ++} ++ ++static uint32_t bcm2835_cpufreq_get_clock(int tag) ++{ ++ u32 rate; ++ int ret; ++ ++ ret = bcm2835_cpufreq_clock_property(tag, VCMSG_ID_ARM_CLOCK, &rate); ++ if (ret) { ++ print_err("Failed to get clock (%d)\n", ret); ++ return 0; ++ } ++ ++ rate /= 1000; ++ print_debug("%s frequency = %u\n", ++ tag == RPI_FIRMWARE_GET_CLOCK_RATE ? "Current": ++ tag == RPI_FIRMWARE_GET_MIN_CLOCK_RATE ? "Min": ++ tag == RPI_FIRMWARE_GET_MAX_CLOCK_RATE ? "Max": ++ "Unexpected", rate); ++ ++ return rate; ++} ++ ++/* ++ ==================================================== ++ Module Initialisation registers the cpufreq driver ++ ==================================================== ++*/ ++static int __init bcm2835_cpufreq_module_init(void) ++{ ++ print_debug("IN\n"); ++ return cpufreq_register_driver(&bcm2835_cpufreq_driver); ++} ++ ++/* ++ ============= ++ Module exit ++ ============= ++*/ ++static void __exit bcm2835_cpufreq_module_exit(void) ++{ ++ print_debug("IN\n"); ++ cpufreq_unregister_driver(&bcm2835_cpufreq_driver); ++ return; ++} ++ ++/* ++ ============================================================== ++ Initialisation function sets up the CPU policy for first use ++ ============================================================== ++*/ ++static int bcm2835_cpufreq_driver_init(struct cpufreq_policy *policy) ++{ ++ /* measured value of how long it takes to change frequency */ ++ const unsigned int transition_latency = 355000; /* ns */ ++ ++ if (!rpi_firmware_get(NULL)) { ++ print_err("Firmware is not available\n"); ++ return -ENODEV; ++ } ++ ++ /* now find out what the maximum and minimum frequencies are */ ++ bcm2835_freq_table[0].frequency = bcm2835_cpufreq_get_clock(RPI_FIRMWARE_GET_MIN_CLOCK_RATE); ++ bcm2835_freq_table[1].frequency = bcm2835_cpufreq_get_clock(RPI_FIRMWARE_GET_MAX_CLOCK_RATE); ++ ++ print_info("min=%d max=%d\n", bcm2835_freq_table[0].frequency, bcm2835_freq_table[1].frequency); ++ return cpufreq_generic_init(policy, bcm2835_freq_table, transition_latency); ++} ++ ++/* ++ ===================================================================== ++ Target index function chooses the requested frequency from the table ++ ===================================================================== ++*/ ++ ++static int bcm2835_cpufreq_driver_target_index(struct cpufreq_policy *policy, unsigned int state) ++{ ++ unsigned int target_freq = bcm2835_freq_table[state].frequency; ++ unsigned int cur = bcm2835_cpufreq_set_clock(policy->cur, target_freq); ++ ++ if (!cur) ++ { ++ print_err("Error occurred setting a new frequency (%d)\n", target_freq); ++ return -EINVAL; ++ } ++ print_debug("%s: %i: freq %d->%d\n", policy->governor->name, state, policy->cur, cur); ++ return 0; ++} ++ ++/* ++ ====================================================== ++ Get function returns the current frequency from table ++ ====================================================== ++*/ ++ ++static unsigned int bcm2835_cpufreq_driver_get(unsigned int cpu) ++{ ++ unsigned int actual_rate = bcm2835_cpufreq_get_clock(RPI_FIRMWARE_GET_CLOCK_RATE); ++ print_debug("cpu%d: freq=%d\n", cpu, actual_rate); ++ return actual_rate <= bcm2835_freq_table[0].frequency ? bcm2835_freq_table[0].frequency : bcm2835_freq_table[1].frequency; ++} ++ ++/* the CPUFreq driver */ ++static struct cpufreq_driver bcm2835_cpufreq_driver = { ++ .name = "BCM2835 CPUFreq", ++ .init = bcm2835_cpufreq_driver_init, ++ .verify = cpufreq_generic_frequency_table_verify, ++ .target_index = bcm2835_cpufreq_driver_target_index, ++ .get = bcm2835_cpufreq_driver_get, ++ .attr = cpufreq_generic_attr, ++}; ++ ++MODULE_AUTHOR("Dorian Peake and Dom Cobley"); ++MODULE_DESCRIPTION("CPU frequency driver for BCM2835 chip"); ++MODULE_LICENSE("GPL"); ++ ++module_init(bcm2835_cpufreq_module_init); ++module_exit(bcm2835_cpufreq_module_exit); + +From aed691d5d3e8bd608d947a963c71413b068f4575 Mon Sep 17 00:00:00 2001 +From: popcornmix <popcornmix@gmail.com> +Date: Tue, 26 Mar 2013 19:24:24 +0000 +Subject: [PATCH 049/112] Added hwmon/thermal driver for reporting core + temperature. Thanks Dorian +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +BCM270x: Move thermal sensor to Device Tree + +Add Device Tree support to bcm2835-thermal driver. +Add thermal sensor device to Device Tree. +Don't add platform device when booting in DT mode. + +Signed-off-by: Noralf Trønnes <noralf@tronnes.org> +--- + drivers/thermal/Kconfig | 7 +++ + drivers/thermal/Makefile | 1 + + drivers/thermal/bcm2835-thermal.c | 109 ++++++++++++++++++++++++++++++++++++++ + 3 files changed, 117 insertions(+) + create mode 100644 drivers/thermal/bcm2835-thermal.c + +diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig +index 3c3dc4a..6789340 100644 +--- a/drivers/thermal/Kconfig ++++ b/drivers/thermal/Kconfig +@@ -292,6 +292,13 @@ config INTEL_POWERCLAMP + enforce idle time which results in more package C-state residency. The + user interface is exposed via generic thermal framework. + ++config THERMAL_BCM2835 ++ depends on RASPBERRYPI_FIRMWARE ++ tristate "BCM2835 Thermal Driver" ++ help ++ This will enable temperature monitoring for the Broadcom BCM2835 ++ chip. If built as a module, it will be called 'bcm2835-thermal'. ++ + config X86_PKG_TEMP_THERMAL + tristate "X86 package temperature thermal driver" + depends on X86_THERMAL_VECTOR +diff --git a/drivers/thermal/Makefile b/drivers/thermal/Makefile +index 8e9cbc3..497014c 100644 +--- a/drivers/thermal/Makefile ++++ b/drivers/thermal/Makefile +@@ -38,6 +38,7 @@ obj-$(CONFIG_ARMADA_THERMAL) += armada_thermal.o + obj-$(CONFIG_IMX_THERMAL) += imx_thermal.o + obj-$(CONFIG_DB8500_CPUFREQ_COOLING) += db8500_cpufreq_cooling.o + obj-$(CONFIG_INTEL_POWERCLAMP) += intel_powerclamp.o ++obj-$(CONFIG_THERMAL_BCM2835) += bcm2835-thermal.o + obj-$(CONFIG_X86_PKG_TEMP_THERMAL) += x86_pkg_temp_thermal.o + obj-$(CONFIG_INTEL_SOC_DTS_IOSF_CORE) += intel_soc_dts_iosf.o + obj-$(CONFIG_INTEL_SOC_DTS_THERMAL) += intel_soc_dts_thermal.o +diff --git a/drivers/thermal/bcm2835-thermal.c b/drivers/thermal/bcm2835-thermal.c +new file mode 100644 +index 0000000..c63fb9f +--- /dev/null ++++ b/drivers/thermal/bcm2835-thermal.c +@@ -0,0 +1,109 @@ ++/***************************************************************************** ++* Copyright 2011 Broadcom Corporation. All rights reserved. ++* ++* Unless you and Broadcom execute a separate written software license ++* agreement governing use of this software, this software is licensed to you ++* under the terms of the GNU General Public License version 2, available at ++* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). ++* ++* Notwithstanding the above, under no circumstances may you combine this ++* software in any way with any other Broadcom software provided under a ++* license other than the GPL, without Broadcom's express prior written ++* consent. ++*****************************************************************************/ ++ ++#include <linux/module.h> ++#include <linux/platform_device.h> ++#include <linux/thermal.h> ++#include <soc/bcm2835/raspberrypi-firmware.h> ++ ++static int bcm2835_thermal_get_property(struct thermal_zone_device *tz, ++ int *temp, u32 tag) ++{ ++ struct rpi_firmware *fw = tz->devdata; ++ struct { ++ u32 id; ++ u32 val; ++ } packet; ++ int ret; ++ ++ *temp = 0; ++ packet.id = 0; ++ ret = rpi_firmware_property(fw, tag, &packet, sizeof(packet)); ++ if (ret) { ++ dev_err(&tz->device, "Failed to get temperature\n"); ++ return ret; ++ } ++ ++ *temp = packet.val; ++ dev_dbg(&tz->device, "%stemp=%d\n", ++ tag == RPI_FIRMWARE_GET_MAX_TEMPERATURE ? "max" : "", *temp); ++ ++ return 0; ++} ++ ++static int bcm2835_thermal_get_temp(struct thermal_zone_device *tz, ++ int *temp) ++{ ++ return bcm2835_thermal_get_property(tz, temp, ++ RPI_FIRMWARE_GET_TEMPERATURE); ++} ++ ++static struct thermal_zone_device_ops ops = { ++ .get_temp = bcm2835_thermal_get_temp, ++}; ++ ++static int bcm2835_thermal_probe(struct platform_device *pdev) ++{ ++ struct device_node *fw_np; ++ struct rpi_firmware *fw; ++ struct thermal_zone_device *tz; ++ ++ fw_np = of_parse_phandle(pdev->dev.of_node, "firmware", 0); ++ if (!fw_np) { ++ dev_err(&pdev->dev, "Missing firmware node\n"); ++ return -ENOENT; ++ } ++ fw = rpi_firmware_get(fw_np); ++ if (!fw) ++ return -EPROBE_DEFER; ++ ++ tz = thermal_zone_device_register("bcm2835_thermal", 0, 0, fw, &ops, ++ NULL, 0, 0); ++ if (IS_ERR(tz)) { ++ dev_err(&pdev->dev, "Failed to register the thermal device\n"); ++ return PTR_ERR(tz); ++ } ++ ++ platform_set_drvdata(pdev, tz); ++ ++ return 0; ++} ++ ++static int bcm2835_thermal_remove(struct platform_device *pdev) ++{ ++ thermal_zone_device_unregister(platform_get_drvdata(pdev)); ++ ++ return 0; ++} ++ ++static const struct of_device_id bcm2835_thermal_of_match_table[] = { ++ { .compatible = "brcm,bcm2835-thermal", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, bcm2835_thermal_of_match_table); ++ ++static struct platform_driver bcm2835_thermal_driver = { ++ .probe = bcm2835_thermal_probe, ++ .remove = bcm2835_thermal_remove, ++ .driver = { ++ .name = "bcm2835_thermal", ++ .of_match_table = bcm2835_thermal_of_match_table, ++ }, ++}; ++module_platform_driver(bcm2835_thermal_driver); ++ ++MODULE_AUTHOR("Dorian Peake"); ++MODULE_AUTHOR("Noralf Trønnes"); ++MODULE_DESCRIPTION("Thermal driver for bcm2835 chip"); ++MODULE_LICENSE("GPL"); + +From 61031ab34cccd4b7be3198a2b91bd585caceed78 Mon Sep 17 00:00:00 2001 +From: popcornmix <popcornmix@gmail.com> +Date: Wed, 17 Jun 2015 15:44:08 +0100 +Subject: [PATCH 050/112] Add Chris Boot's i2c driver +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +i2c-bcm2708: fixed baudrate + +Fixed issue where the wrong CDIV value was set for baudrates below 3815 Hz (for 250MHz bus clock). +In that case the computed CDIV value was more than 0xffff. However the CDIV register width is only 16 bits. +This resulted in incorrect setting of CDIV and higher baudrate than intended. +Example: 3500Hz -> CDIV=0x11704 -> CDIV(16bit)=0x1704 -> 42430Hz +After correction: 3500Hz -> CDIV=0x11704 -> CDIV(16bit)=0xffff -> 3815Hz +The correct baudrate is shown in the log after the cdiv > 0xffff correction. + +Perform I2C combined transactions when possible + +Perform I2C combined transactions whenever possible, within the +restrictions of the Broadcomm Serial Controller. + +Disable DONE interrupt during TA poll + +Prevent interrupt from being triggered if poll is missed and transfer +starts and finishes. + +i2c: Make combined transactions optional and disabled by default + +i2c: bcm2708: add device tree support + +Add DT support to driver and add to .dtsi file. +Setup pins in .dts file. +i2c is disabled by default. + +Signed-off-by: Noralf Tronnes <notro@tronnes.org> + +bcm2708: don't register i2c controllers when using DT + +The devices for the i2c controllers are in the Device Tree. +Only register devices when not using DT. + +Signed-off-by: Noralf Tronnes <notro@tronnes.org> + +I2C: Only register the I2C device for the current board revision + +i2c_bcm2708: Fix clock reference counting + +Fix grabbing lock from atomic context in i2c driver + +2 main changes: +- check for timeouts in the bcm2708_bsc_setup function as indicated by this comment: + /* poll for transfer start bit (should only take 1-20 polls) */ + This implies that the setup function can now fail so account for this everywhere it's called +- Removed the clk_get_rate call from inside the setup function as it locks a mutex and that's not ok since we call it from under a spin lock. + +i2c-bcm2708: When using DT, leave the GPIO setup to pinctrl + +i2c-bcm2708: Increase timeouts to allow larger transfers + +Use the timeout value provided by the I2C_TIMEOUT ioctl when waiting +for completion. The default timeout is 1 second. + +See: https://github.com/raspberrypi/linux/issues/260 + +i2c-bcm2708/BCM270X_DT: Add support for I2C2 + +The third I2C bus (I2C2) is normally reserved for HDMI use. Careless +use of this bus can break an attached display - use with caution. + +It is recommended to disable accesses by VideoCore by setting +hdmi_ignore_edid=1 or hdmi_edid_file=1 in config.txt. + +The interface is disabled by default - enable using the +i2c2_iknowwhatimdoing DT parameter. + +bcm2708-spi: Don't use static pin configuration with DT + +Also remove superfluous error checking - the SPI framework ensures the +validity of the chip_select value. + +i2c-bcm2708: Remove non-DT support + +Signed-off-by: Noralf Trønnes <noralf@tronnes.org> + +Set the BSC_CLKT clock streching timeout to 35ms as per SMBus specs. +--- + drivers/i2c/busses/Kconfig | 21 +- + drivers/i2c/busses/Makefile | 2 + + drivers/i2c/busses/i2c-bcm2708.c | 508 +++++++++++++++++++++++++++++++++++++++ + 3 files changed, 530 insertions(+), 1 deletion(-) + create mode 100644 drivers/i2c/busses/i2c-bcm2708.c + +diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig +index 0967e1a..c11fce1 100644 +--- a/drivers/i2c/busses/Kconfig ++++ b/drivers/i2c/busses/Kconfig +@@ -8,6 +8,25 @@ menu "I2C Hardware Bus support" + comment "PC SMBus host controller drivers" + depends on PCI + ++config I2C_BCM2708 ++ tristate "BCM2708 BSC" ++ depends on MACH_BCM2708 || MACH_BCM2709 || ARCH_BCM2835 ++ help ++ Enabling this option will add BSC (Broadcom Serial Controller) ++ support for the BCM2708. BSC is a Broadcom proprietary bus compatible ++ with I2C/TWI/SMBus. ++ ++config I2C_BCM2708_BAUDRATE ++ prompt "BCM2708 I2C baudrate" ++ depends on I2C_BCM2708 ++ int ++ default 100000 ++ help ++ Set the I2C baudrate. This will alter the default value. A ++ different baudrate can be set by using a module parameter as well. If ++ no parameter is provided when loading, this is the value that will be ++ used. ++ + config I2C_ALI1535 + tristate "ALI 1535" + depends on PCI +@@ -365,7 +384,7 @@ config I2C_AXXIA + + config I2C_BCM2835 + tristate "Broadcom BCM2835 I2C controller" +- depends on ARCH_BCM2835 ++ depends on ARCH_BCM2835 || ARCH_BCM2708 || ARCH_BCM2709 + help + If you say yes to this option, support will be included for the + BCM2835 I2C controller. +diff --git a/drivers/i2c/busses/Makefile b/drivers/i2c/busses/Makefile +index 37f2819..e309579 100644 +--- a/drivers/i2c/busses/Makefile ++++ b/drivers/i2c/busses/Makefile +@@ -2,6 +2,8 @@ + # Makefile for the i2c bus drivers. + # + ++obj-$(CONFIG_I2C_BCM2708) += i2c-bcm2708.o ++ + # ACPI drivers + obj-$(CONFIG_I2C_SCMI) += i2c-scmi.o + +diff --git a/drivers/i2c/busses/i2c-bcm2708.c b/drivers/i2c/busses/i2c-bcm2708.c +new file mode 100644 +index 0000000..c9b8e5c +--- /dev/null ++++ b/drivers/i2c/busses/i2c-bcm2708.c +@@ -0,0 +1,508 @@ ++/* ++ * Driver for Broadcom BCM2708 BSC Controllers ++ * ++ * Copyright (C) 2012 Chris Boot & Frank Buss ++ * ++ * This driver is inspired by: ++ * i2c-ocores.c, by Peter Korsgaard <jacmet@sunsite.dk> ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ++ */ ++ ++#include <linux/kernel.h> ++#include <linux/module.h> ++#include <linux/spinlock.h> ++#include <linux/clk.h> ++#include <linux/err.h> ++#include <linux/of.h> ++#include <linux/platform_device.h> ++#include <linux/io.h> ++#include <linux/slab.h> ++#include <linux/i2c.h> ++#include <linux/interrupt.h> ++#include <linux/sched.h> ++#include <linux/wait.h> ++ ++/* BSC register offsets */ ++#define BSC_C 0x00 ++#define BSC_S 0x04 ++#define BSC_DLEN 0x08 ++#define BSC_A 0x0c ++#define BSC_FIFO 0x10 ++#define BSC_DIV 0x14 ++#define BSC_DEL 0x18 ++#define BSC_CLKT 0x1c ++ ++/* Bitfields in BSC_C */ ++#define BSC_C_I2CEN 0x00008000 ++#define BSC_C_INTR 0x00000400 ++#define BSC_C_INTT 0x00000200 ++#define BSC_C_INTD 0x00000100 ++#define BSC_C_ST 0x00000080 ++#define BSC_C_CLEAR_1 0x00000020 ++#define BSC_C_CLEAR_2 0x00000010 ++#define BSC_C_READ 0x00000001 ++ ++/* Bitfields in BSC_S */ ++#define BSC_S_CLKT 0x00000200 ++#define BSC_S_ERR 0x00000100 ++#define BSC_S_RXF 0x00000080 ++#define BSC_S_TXE 0x00000040 ++#define BSC_S_RXD 0x00000020 ++#define BSC_S_TXD 0x00000010 ++#define BSC_S_RXR 0x00000008 ++#define BSC_S_TXW 0x00000004 ++#define BSC_S_DONE 0x00000002 ++#define BSC_S_TA 0x00000001 ++ ++#define I2C_WAIT_LOOP_COUNT 200 ++ ++#define DRV_NAME "bcm2708_i2c" ++ ++static unsigned int baudrate; ++module_param(baudrate, uint, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP); ++MODULE_PARM_DESC(baudrate, "The I2C baudrate"); ++ ++static bool combined = false; ++module_param(combined, bool, 0644); ++MODULE_PARM_DESC(combined, "Use combined transactions"); ++ ++struct bcm2708_i2c { ++ struct i2c_adapter adapter; ++ ++ spinlock_t lock; ++ void __iomem *base; ++ int irq; ++ struct clk *clk; ++ u32 cdiv; ++ u32 clk_tout; ++ ++ struct completion done; ++ ++ struct i2c_msg *msg; ++ int pos; ++ int nmsgs; ++ bool error; ++}; ++ ++static inline u32 bcm2708_rd(struct bcm2708_i2c *bi, unsigned reg) ++{ ++ return readl(bi->base + reg); ++} ++ ++static inline void bcm2708_wr(struct bcm2708_i2c *bi, unsigned reg, u32 val) ++{ ++ writel(val, bi->base + reg); ++} ++ ++static inline void bcm2708_bsc_reset(struct bcm2708_i2c *bi) ++{ ++ bcm2708_wr(bi, BSC_C, 0); ++ bcm2708_wr(bi, BSC_S, BSC_S_CLKT | BSC_S_ERR | BSC_S_DONE); ++} ++ ++static inline void bcm2708_bsc_fifo_drain(struct bcm2708_i2c *bi) ++{ ++ while ((bcm2708_rd(bi, BSC_S) & BSC_S_RXD) && (bi->pos < bi->msg->len)) ++ bi->msg->buf[bi->pos++] = bcm2708_rd(bi, BSC_FIFO); ++} ++ ++static inline void bcm2708_bsc_fifo_fill(struct bcm2708_i2c *bi) ++{ ++ while ((bcm2708_rd(bi, BSC_S) & BSC_S_TXD) && (bi->pos < bi->msg->len)) ++ bcm2708_wr(bi, BSC_FIFO, bi->msg->buf[bi->pos++]); ++} ++ ++static inline int bcm2708_bsc_setup(struct bcm2708_i2c *bi) ++{ ++ u32 cdiv, s, clk_tout; ++ u32 c = BSC_C_I2CEN | BSC_C_INTD | BSC_C_ST | BSC_C_CLEAR_1; ++ int wait_loops = I2C_WAIT_LOOP_COUNT; ++ ++ /* Can't call clk_get_rate as it locks a mutex and here we are spinlocked. ++ * Use the value that we cached in the probe. ++ */ ++ cdiv = bi->cdiv; ++ clk_tout = bi->clk_tout; ++ ++ if (bi->msg->flags & I2C_M_RD) ++ c |= BSC_C_INTR | BSC_C_READ; ++ else ++ c |= BSC_C_INTT; ++ ++ bcm2708_wr(bi, BSC_CLKT, clk_tout); ++ bcm2708_wr(bi, BSC_DIV, cdiv); ++ bcm2708_wr(bi, BSC_A, bi->msg->addr); ++ bcm2708_wr(bi, BSC_DLEN, bi->msg->len); ++ if (combined) ++ { ++ /* Do the next two messages meet combined transaction criteria? ++ - Current message is a write, next message is a read ++ - Both messages to same slave address ++ - Write message can fit inside FIFO (16 bytes or less) */ ++ if ( (bi->nmsgs > 1) && ++ !(bi->msg[0].flags & I2C_M_RD) && (bi->msg[1].flags & I2C_M_RD) && ++ (bi->msg[0].addr == bi->msg[1].addr) && (bi->msg[0].len <= 16)) { ++ /* Fill FIFO with entire write message (16 byte FIFO) */ ++ while (bi->pos < bi->msg->len) { ++ bcm2708_wr(bi, BSC_FIFO, bi->msg->buf[bi->pos++]); ++ } ++ /* Start write transfer (no interrupts, don't clear FIFO) */ ++ bcm2708_wr(bi, BSC_C, BSC_C_I2CEN | BSC_C_ST); ++ ++ /* poll for transfer start bit (should only take 1-20 polls) */ ++ do { ++ s = bcm2708_rd(bi, BSC_S); ++ } while (!(s & (BSC_S_TA | BSC_S_ERR | BSC_S_CLKT | BSC_S_DONE)) && --wait_loops >= 0); ++ ++ /* did we time out or some error occured? */ ++ if (wait_loops < 0 || (s & (BSC_S_ERR | BSC_S_CLKT))) { ++ return -1; ++ } ++ ++ /* Send next read message before the write transfer finishes. */ ++ bi->nmsgs--; ++ bi->msg++; ++ bi->pos = 0; ++ bcm2708_wr(bi, BSC_DLEN, bi->msg->len); ++ c = BSC_C_I2CEN | BSC_C_INTD | BSC_C_INTR | BSC_C_ST | BSC_C_READ; ++ } ++ } ++ bcm2708_wr(bi, BSC_C, c); ++ ++ return 0; ++} ++ ++static irqreturn_t bcm2708_i2c_interrupt(int irq, void *dev_id) ++{ ++ struct bcm2708_i2c *bi = dev_id; ++ bool handled = true; ++ u32 s; ++ int ret; ++ ++ spin_lock(&bi->lock); ++ ++ /* we may see camera interrupts on the "other" I2C channel ++ Just return if we've not sent anything */ ++ if (!bi->nmsgs || !bi->msg) { ++ goto early_exit; ++ } ++ ++ s = bcm2708_rd(bi, BSC_S); ++ ++ if (s & (BSC_S_CLKT | BSC_S_ERR)) { ++ bcm2708_bsc_reset(bi); ++ bi->error = true; ++ ++ bi->msg = 0; /* to inform the that all work is done */ ++ bi->nmsgs = 0; ++ /* wake up our bh */ ++ complete(&bi->done); ++ } else if (s & BSC_S_DONE) { ++ bi->nmsgs--; ++ ++ if (bi->msg->flags & I2C_M_RD) { ++ bcm2708_bsc_fifo_drain(bi); ++ } ++ ++ bcm2708_bsc_reset(bi); ++ ++ if (bi->nmsgs) { ++ /* advance to next message */ ++ bi->msg++; ++ bi->pos = 0; ++ ret = bcm2708_bsc_setup(bi); ++ if (ret < 0) { ++ bcm2708_bsc_reset(bi); ++ bi->error = true; ++ bi->msg = 0; /* to inform the that all work is done */ ++ bi->nmsgs = 0; ++ /* wake up our bh */ ++ complete(&bi->done); ++ goto early_exit; ++ } ++ } else { ++ bi->msg = 0; /* to inform the that all work is done */ ++ bi->nmsgs = 0; ++ /* wake up our bh */ ++ complete(&bi->done); ++ } ++ } else if (s & BSC_S_TXW) { ++ bcm2708_bsc_fifo_fill(bi); ++ } else if (s & BSC_S_RXR) { ++ bcm2708_bsc_fifo_drain(bi); ++ } else { ++ handled = false; ++ } ++ ++early_exit: ++ spin_unlock(&bi->lock); ++ ++ return handled ? IRQ_HANDLED : IRQ_NONE; ++} ++ ++static int bcm2708_i2c_master_xfer(struct i2c_adapter *adap, ++ struct i2c_msg *msgs, int num) ++{ ++ struct bcm2708_i2c *bi = adap->algo_data; ++ unsigned long flags; ++ int ret; ++ ++ spin_lock_irqsave(&bi->lock, flags); ++ ++ reinit_completion(&bi->done); ++ bi->msg = msgs; ++ bi->pos = 0; ++ bi->nmsgs = num; ++ bi->error = false; ++ ++ ret = bcm2708_bsc_setup(bi); ++ ++ spin_unlock_irqrestore(&bi->lock, flags); ++ ++ /* check the result of the setup */ ++ if (ret < 0) ++ { ++ dev_err(&adap->dev, "transfer setup timed out\n"); ++ goto error_timeout; ++ } ++ ++ ret = wait_for_completion_timeout(&bi->done, adap->timeout); ++ if (ret == 0) { ++ dev_err(&adap->dev, "transfer timed out\n"); ++ goto error_timeout; ++ } ++ ++ ret = bi->error ? -EIO : num; ++ return ret; ++ ++error_timeout: ++ spin_lock_irqsave(&bi->lock, flags); ++ bcm2708_bsc_reset(bi); ++ bi->msg = 0; /* to inform the interrupt handler that there's nothing else to be done */ ++ bi->nmsgs = 0; ++ spin_unlock_irqrestore(&bi->lock, flags); ++ return -ETIMEDOUT; ++} ++ ++static u32 bcm2708_i2c_functionality(struct i2c_adapter *adap) ++{ ++ return I2C_FUNC_I2C | /*I2C_FUNC_10BIT_ADDR |*/ I2C_FUNC_SMBUS_EMUL; ++} ++ ++static struct i2c_algorithm bcm2708_i2c_algorithm = { ++ .master_xfer = bcm2708_i2c_master_xfer, ++ .functionality = bcm2708_i2c_functionality, ++}; ++ ++static int bcm2708_i2c_probe(struct platform_device *pdev) ++{ ++ struct resource *regs; ++ int irq, err = -ENOMEM; ++ struct clk *clk; ++ struct bcm2708_i2c *bi; ++ struct i2c_adapter *adap; ++ unsigned long bus_hz; ++ u32 cdiv, clk_tout; ++ u32 baud; ++ ++ baud = CONFIG_I2C_BCM2708_BAUDRATE; ++ ++ if (pdev->dev.of_node) { ++ u32 bus_clk_rate; ++ pdev->id = of_alias_get_id(pdev->dev.of_node, "i2c"); ++ if (pdev->id < 0) { ++ dev_err(&pdev->dev, "alias is missing\n"); ++ return -EINVAL; ++ } ++ if (!of_property_read_u32(pdev->dev.of_node, ++ "clock-frequency", &bus_clk_rate)) ++ baud = bus_clk_rate; ++ else ++ dev_warn(&pdev->dev, ++ "Could not read clock-frequency property\n"); ++ } ++ ++ if (baudrate) ++ baud = baudrate; ++ ++ regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); ++ if (!regs) { ++ dev_err(&pdev->dev, "could not get IO memory\n"); ++ return -ENXIO; ++ } ++ ++ irq = platform_get_irq(pdev, 0); ++ if (irq < 0) { ++ dev_err(&pdev->dev, "could not get IRQ\n"); ++ return irq; ++ } ++ ++ clk = clk_get(&pdev->dev, NULL); ++ if (IS_ERR(clk)) { ++ dev_err(&pdev->dev, "could not find clk: %ld\n", PTR_ERR(clk)); ++ return PTR_ERR(clk); ++ } ++ ++ err = clk_prepare_enable(clk); ++ if (err) { ++ dev_err(&pdev->dev, "could not enable clk: %d\n", err); ++ goto out_clk_put; ++ } ++ ++ bi = kzalloc(sizeof(*bi), GFP_KERNEL); ++ if (!bi) ++ goto out_clk_disable; ++ ++ platform_set_drvdata(pdev, bi); ++ ++ adap = &bi->adapter; ++ adap->class = I2C_CLASS_HWMON | I2C_CLASS_DDC; ++ adap->algo = &bcm2708_i2c_algorithm; ++ adap->algo_data = bi; ++ adap->dev.parent = &pdev->dev; ++ adap->nr = pdev->id; ++ strlcpy(adap->name, dev_name(&pdev->dev), sizeof(adap->name)); ++ adap->dev.of_node = pdev->dev.of_node; ++ ++ switch (pdev->id) { ++ case 0: ++ adap->class = I2C_CLASS_HWMON; ++ break; ++ case 1: ++ adap->class = I2C_CLASS_DDC; ++ break; ++ case 2: ++ adap->class = I2C_CLASS_DDC; ++ break; ++ default: ++ dev_err(&pdev->dev, "can only bind to BSC 0, 1 or 2\n"); ++ err = -ENXIO; ++ goto out_free_bi; ++ } ++ ++ spin_lock_init(&bi->lock); ++ init_completion(&bi->done); ++ ++ bi->base = ioremap(regs->start, resource_size(regs)); ++ if (!bi->base) { ++ dev_err(&pdev->dev, "could not remap memory\n"); ++ goto out_free_bi; ++ } ++ ++ bi->irq = irq; ++ bi->clk = clk; ++ ++ err = request_irq(irq, bcm2708_i2c_interrupt, IRQF_SHARED, ++ dev_name(&pdev->dev), bi); ++ if (err) { ++ dev_err(&pdev->dev, "could not request IRQ: %d\n", err); ++ goto out_iounmap; ++ } ++ ++ bcm2708_bsc_reset(bi); ++ ++ err = i2c_add_numbered_adapter(adap); ++ if (err < 0) { ++ dev_err(&pdev->dev, "could not add I2C adapter: %d\n", err); ++ goto out_free_irq; ++ } ++ ++ bus_hz = clk_get_rate(bi->clk); ++ cdiv = bus_hz / baud; ++ if (cdiv > 0xffff) { ++ cdiv = 0xffff; ++ baud = bus_hz / cdiv; ++ } ++ ++ clk_tout = 35/1000*baud; //35ms timeout as per SMBus specs. ++ if (clk_tout > 0xffff) ++ clk_tout = 0xffff; ++ ++ bi->cdiv = cdiv; ++ bi->clk_tout = clk_tout; ++ ++ dev_info(&pdev->dev, "BSC%d Controller at 0x%08lx (irq %d) (baudrate %d)\n", ++ pdev->id, (unsigned long)regs->start, irq, baud); ++ ++ return 0; ++ ++out_free_irq: ++ free_irq(bi->irq, bi); ++out_iounmap: ++ iounmap(bi->base); ++out_free_bi: ++ kfree(bi); ++out_clk_disable: ++ clk_disable_unprepare(clk); ++out_clk_put: ++ clk_put(clk); ++ return err; ++} ++ ++static int bcm2708_i2c_remove(struct platform_device *pdev) ++{ ++ struct bcm2708_i2c *bi = platform_get_drvdata(pdev); ++ ++ platform_set_drvdata(pdev, NULL); ++ ++ i2c_del_adapter(&bi->adapter); ++ free_irq(bi->irq, bi); ++ iounmap(bi->base); ++ clk_disable_unprepare(bi->clk); ++ clk_put(bi->clk); ++ kfree(bi); ++ ++ return 0; ++} ++ ++static const struct of_device_id bcm2708_i2c_of_match[] = { ++ { .compatible = "brcm,bcm2708-i2c" }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, bcm2708_i2c_of_match); ++ ++static struct platform_driver bcm2708_i2c_driver = { ++ .driver = { ++ .name = DRV_NAME, ++ .owner = THIS_MODULE, ++ .of_match_table = bcm2708_i2c_of_match, ++ }, ++ .probe = bcm2708_i2c_probe, ++ .remove = bcm2708_i2c_remove, ++}; ++ ++// module_platform_driver(bcm2708_i2c_driver); ++ ++ ++static int __init bcm2708_i2c_init(void) ++{ ++ return platform_driver_register(&bcm2708_i2c_driver); ++} ++ ++static void __exit bcm2708_i2c_exit(void) ++{ ++ platform_driver_unregister(&bcm2708_i2c_driver); ++} ++ ++module_init(bcm2708_i2c_init); ++module_exit(bcm2708_i2c_exit); ++ ++ ++ ++MODULE_DESCRIPTION("BSC controller driver for Broadcom BCM2708"); ++MODULE_AUTHOR("Chris Boot <bootc@bootc.net>"); ++MODULE_LICENSE("GPL v2"); ++MODULE_ALIAS("platform:" DRV_NAME); + +From 299b995c56f17d7b8b67cb128f170f7f552e7b54 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= <noralf@tronnes.org> +Date: Fri, 26 Jun 2015 14:27:06 +0200 +Subject: [PATCH 051/112] char: broadcom: Add vcio module +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Add module for accessing the mailbox property channel through +/dev/vcio. Was previously in bcm2708-vcio. + +Signed-off-by: Noralf Trønnes <noralf@tronnes.org> +--- + drivers/char/broadcom/Kconfig | 6 ++ + drivers/char/broadcom/Makefile | 1 + + drivers/char/broadcom/vcio.c | 175 +++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 182 insertions(+) + create mode 100644 drivers/char/broadcom/vcio.c + +diff --git a/drivers/char/broadcom/Kconfig b/drivers/char/broadcom/Kconfig +index 2292ed2..5489f19 100644 +--- a/drivers/char/broadcom/Kconfig ++++ b/drivers/char/broadcom/Kconfig +@@ -22,6 +22,12 @@ config BCM2708_VCMEM + help + Helper for videocore memory access and total size allocation. + ++config BCM_VCIO ++ tristate "Mailbox userspace access" ++ depends on BCM2835_MBOX ++ help ++ Gives access to the mailbox property channel from userspace. ++ + endif + + config BCM_VC_SM +diff --git a/drivers/char/broadcom/Makefile b/drivers/char/broadcom/Makefile +index 667d33e..14775c9 100644 +--- a/drivers/char/broadcom/Makefile ++++ b/drivers/char/broadcom/Makefile +@@ -1,5 +1,6 @@ + obj-$(CONFIG_BCM_VC_CMA) += vc_cma/ + obj-$(CONFIG_BCM2708_VCMEM) += vc_mem.o ++obj-$(CONFIG_BCM_VCIO) += vcio.o + obj-$(CONFIG_BCM_VC_SM) += vc_sm/ + + obj-$(CONFIG_BCM2835_DEVGPIOMEM)+= bcm2835-gpiomem.o +diff --git a/drivers/char/broadcom/vcio.c b/drivers/char/broadcom/vcio.c +new file mode 100644 +index 0000000..c19bc20 +--- /dev/null ++++ b/drivers/char/broadcom/vcio.c +@@ -0,0 +1,175 @@ ++/* ++ * Copyright (C) 2010 Broadcom ++ * Copyright (C) 2015 Noralf Trønnes ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 as ++ * published by the Free Software Foundation. ++ * ++ */ ++ ++#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt ++ ++#include <linux/cdev.h> ++#include <linux/device.h> ++#include <linux/fs.h> ++#include <linux/init.h> ++#include <linux/ioctl.h> ++#include <linux/module.h> ++#include <linux/slab.h> ++#include <linux/uaccess.h> ++#include <soc/bcm2835/raspberrypi-firmware.h> ++ ++#define MBOX_CHAN_PROPERTY 8 ++ ++#define VCIO_IOC_MAGIC 100 ++#define IOCTL_MBOX_PROPERTY _IOWR(VCIO_IOC_MAGIC, 0, char *) ++ ++static struct { ++ dev_t devt; ++ struct cdev cdev; ++ struct class *class; ++ struct rpi_firmware *fw; ++} vcio; ++ ++static int vcio_user_property_list(void *user) ++{ ++ u32 *buf, size; ++ int ret; ++ ++ /* The first 32-bit is the size of the buffer */ ++ if (copy_from_user(&size, user, sizeof(size))) ++ return -EFAULT; ++ ++ buf = kmalloc(size, GFP_KERNEL); ++ if (!buf) ++ return -ENOMEM; ++ ++ if (copy_from_user(buf, user, size)) { ++ kfree(buf); ++ return -EFAULT; ++ } ++ ++ /* Strip off protocol encapsulation */ ++ ret = rpi_firmware_property_list(vcio.fw, &buf[2], size - 12); ++ if (ret) { ++ kfree(buf); ++ return ret; ++ } ++ ++ buf[1] = RPI_FIRMWARE_STATUS_SUCCESS; ++ if (copy_to_user(user, buf, size)) ++ ret = -EFAULT; ++ ++ kfree(buf); ++ ++ return ret; ++} ++ ++static int vcio_device_open(struct inode *inode, struct file *file) ++{ ++ try_module_get(THIS_MODULE); ++ ++ return 0; ++} ++ ++static int vcio_device_release(struct inode *inode, struct file *file) ++{ ++ module_put(THIS_MODULE); ++ ++ return 0; ++} ++ ++static long vcio_device_ioctl(struct file *file, unsigned int ioctl_num, ++ unsigned long ioctl_param) ++{ ++ switch (ioctl_num) { ++ case IOCTL_MBOX_PROPERTY: ++ return vcio_user_property_list((void *)ioctl_param); ++ default: ++ pr_err("unknown ioctl: %d\n", ioctl_num); ++ return -EINVAL; ++ } ++} ++ ++const struct file_operations vcio_fops = { ++ .unlocked_ioctl = vcio_device_ioctl, ++ .open = vcio_device_open, ++ .release = vcio_device_release, ++}; ++ ++static int __init vcio_init(void) ++{ ++ struct device_node *np; ++ static struct device *dev; ++ int ret; ++ ++ np = of_find_compatible_node(NULL, NULL, ++ "raspberrypi,bcm2835-firmware"); ++/* Uncomment this when we only boot with Device Tree ++ if (!of_device_is_available(np)) ++ return -ENODEV; ++*/ ++ vcio.fw = rpi_firmware_get(np); ++ if (!vcio.fw) ++ return -ENODEV; ++ ++ ret = alloc_chrdev_region(&vcio.devt, 0, 1, "vcio"); ++ if (ret) { ++ pr_err("failed to allocate device number\n"); ++ return ret; ++ } ++ ++ cdev_init(&vcio.cdev, &vcio_fops); ++ vcio.cdev.owner = THIS_MODULE; ++ ret = cdev_add(&vcio.cdev, vcio.devt, 1); ++ if (ret) { ++ pr_err("failed to register device\n"); ++ goto err_unregister_chardev; ++ } ++ ++ /* ++ * Create sysfs entries ++ * 'bcm2708_vcio' is used for backwards compatibility so we don't break ++ * userspace. Raspian has a udev rule that changes the permissions. ++ */ ++ vcio.class = class_create(THIS_MODULE, "bcm2708_vcio"); ++ if (IS_ERR(vcio.class)) { ++ ret = PTR_ERR(vcio.class); ++ pr_err("failed to create class\n"); ++ goto err_cdev_del; ++ } ++ ++ dev = device_create(vcio.class, NULL, vcio.devt, NULL, "vcio"); ++ if (IS_ERR(dev)) { ++ ret = PTR_ERR(dev); ++ pr_err("failed to create device\n"); ++ goto err_class_destroy; ++ } ++ ++ return 0; ++ ++err_class_destroy: ++ class_destroy(vcio.class); ++err_cdev_del: ++ cdev_del(&vcio.cdev); ++err_unregister_chardev: ++ unregister_chrdev_region(vcio.devt, 1); ++ ++ return ret; ++} ++module_init(vcio_init); ++ ++static void __exit vcio_exit(void) ++{ ++ device_destroy(vcio.class, vcio.devt); ++ class_destroy(vcio.class); ++ cdev_del(&vcio.cdev); ++ unregister_chrdev_region(vcio.devt, 1); ++} ++module_exit(vcio_exit); ++ ++MODULE_AUTHOR("Gray Girling"); ++MODULE_AUTHOR("Noralf Trønnes"); ++MODULE_DESCRIPTION("Mailbox userspace access"); ++MODULE_LICENSE("GPL"); + +From ae4644ff503855f8f68767d92b9abbf9ffa7c5bf Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= <noralf@tronnes.org> +Date: Fri, 26 Jun 2015 14:25:01 +0200 +Subject: [PATCH 052/112] firmware: bcm2835: Support ARCH_BCM270x +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Support booting without Device Tree. +Turn on USB power. +Load driver early because of lacking support for deferred probing +in many drivers. + +Signed-off-by: Noralf Trønnes <noralf@tronnes.org> +--- + drivers/firmware/raspberrypi.c | 41 +++++++++++++++++++++++++++++++++++++++-- + 1 file changed, 39 insertions(+), 2 deletions(-) + +diff --git a/drivers/firmware/raspberrypi.c b/drivers/firmware/raspberrypi.c +index dd506cd3..b980d53 100644 +--- a/drivers/firmware/raspberrypi.c ++++ b/drivers/firmware/raspberrypi.c +@@ -28,6 +28,8 @@ struct rpi_firmware { + u32 enabled; + }; + ++static struct platform_device *g_pdev; ++ + static DEFINE_MUTEX(transaction_lock); + + static void response_callback(struct mbox_client *cl, void *msg) +@@ -183,6 +185,25 @@ rpi_firmware_print_firmware_revision(struct rpi_firmware *fw) + } + } + ++static int raspberrypi_firmware_set_power(struct rpi_firmware *fw, ++ u32 domain, bool on) ++{ ++ struct { ++ u32 domain; ++ u32 on; ++ } packet; ++ int ret; ++ ++ packet.domain = domain; ++ packet.on = on; ++ ret = rpi_firmware_property(fw, RPI_FIRMWARE_SET_POWER_STATE, ++ &packet, sizeof(packet)); ++ if (!ret && packet.on != on) ++ ret = -EINVAL; ++ ++ return ret; ++} ++ + static int rpi_firmware_probe(struct platform_device *pdev) + { + struct device *dev = &pdev->dev; +@@ -207,9 +228,13 @@ static int rpi_firmware_probe(struct platform_device *pdev) + init_completion(&fw->c); + + platform_set_drvdata(pdev, fw); ++ g_pdev = pdev; + + rpi_firmware_print_firmware_revision(fw); + ++ if (raspberrypi_firmware_set_power(fw, 3, true)) ++ dev_err(dev, "failed to turn on USB power\n"); ++ + return 0; + } + +@@ -218,6 +243,7 @@ static int rpi_firmware_remove(struct platform_device *pdev) + struct rpi_firmware *fw = platform_get_drvdata(pdev); + + mbox_free_channel(fw->chan); ++ g_pdev = NULL; + + return 0; + } +@@ -230,7 +256,7 @@ static int rpi_firmware_remove(struct platform_device *pdev) + */ + struct rpi_firmware *rpi_firmware_get(struct device_node *firmware_node) + { +- struct platform_device *pdev = of_find_device_by_node(firmware_node); ++ struct platform_device *pdev = g_pdev; + + if (!pdev) + return NULL; +@@ -253,7 +279,18 @@ static struct platform_driver rpi_firmware_driver = { + .probe = rpi_firmware_probe, + .remove = rpi_firmware_remove, + }; +-module_platform_driver(rpi_firmware_driver); ++ ++static int __init rpi_firmware_init(void) ++{ ++ return platform_driver_register(&rpi_firmware_driver); ++} ++subsys_initcall(rpi_firmware_init); ++ ++static void __init rpi_firmware_exit(void) ++{ ++ platform_driver_unregister(&rpi_firmware_driver); ++} ++module_exit(rpi_firmware_exit); + + MODULE_AUTHOR("Eric Anholt <eric@anholt.net>"); + MODULE_DESCRIPTION("Raspberry Pi firmware driver"); + +From fcaa83d6edd872b393cad689acf8b1975af74867 Mon Sep 17 00:00:00 2001 +From: Vincent Sanders <vincent.sanders@collabora.co.uk> +Date: Wed, 30 Jan 2013 12:45:18 +0000 +Subject: [PATCH 053/112] bcm2835: add v4l2 camera device + +- Supports raw YUV capture, preview, JPEG and H264. +- Uses videobuf2 for data transfer, using dma_buf. +- Uses 3.6.10 timestamping +- Camera power based on use +- Uses immutable input mode on video encoder + +Signed-off-by: Daniel Stone <daniels@collabora.com> +Signed-off-by: Luke Diamand <luked@broadcom.com> + +V4L2: Fixes from 6by9 + +V4L2: Fix EV values. Add manual shutter speed control + +V4L2 EV values should be in units of 1/1000. Corrected. +Add support for V4L2_CID_EXPOSURE_ABSOLUTE which should +give manual shutter control. Requires manual exposure mode +to be selected first. + +Signed-off-by: Dave Stevenson <dsteve@broadcom.com> + +V4L2: Correct JPEG Q-factor range + +Should be 1-100, not 0-100 + +Signed-off-by: Dave Stevenson <dsteve@broadcom.com> + +V4L2: Fix issue of driver jamming if STREAMON failed. + +Fix issue where the driver was left in a partially enabled +state if STREAMON failed, and would then reject many IOCTLs +as it thought it was streaming. + +Signed-off-by: Dave Stevenson <dsteve@broadcom.com> + +V4L2: Fix ISO controls. + +Driver was passing the index to the GPU, and not the desired +ISO value. + +Signed-off-by: Dave Stevenson <dsteve@broadcom.com> + +V4L2: Add flicker avoidance controls + +Add support for V4L2_CID_POWER_LINE_FREQUENCY to set flicker +avoidance frequencies. + +Signed-off-by: Dave Stevenson <dsteve@broadcom.com> + +V4L2: Add support for frame rate control. + +Add support for frame rate (or time per frame as V4L2 +inverts it) control via s_parm. + +Signed-off-by: Dave Stevenson <dsteve@broadcom.com> + +V4L2: Improve G_FBUF handling so we pass conformance + +Return some sane numbers for get framebuffer so that +we pass conformance. + +Signed-off-by: Dave Stevenson <dsteve@broadcom.com> + +V4L2: Fix information advertised through g_vidfmt + +Width and height were being stored based on incorrect +values. + +Signed-off-by: Dave Stevenson <dsteve@broadcom.com> + +V4L2: Add support for inline H264 headers + +Add support for V4L2_CID_MPEG_VIDEO_REPEAT_SEQ_HEADER +to control H264 inline headers. +Requires firmware fix to work correctly, otherwise format +has to be set to H264 before this parameter is set. + +Signed-off-by: Dave Stevenson <dsteve@broadcom.com> + +V4L2: Fix JPEG timestamp issue + +JPEG images were coming through from the GPU with timestamp +of 0. Detect this and give current system time instead +of some invalid value. + +Signed-off-by: Dave Stevenson <dsteve@broadcom.com> + +V4L2: Fix issue when switching down JPEG resolution. + +JPEG buffer size calculation is based on input resolution. +Input resolution was being configured after output port +format. Caused failures if switching from one JPEG resolution +to a smaller one. + +Signed-off-by: Dave Stevenson <dsteve@broadcom.com> + +V4L2: Enable MJPEG encoding + +Requires GPU firmware update to support MJPEG encoder. + +Signed-off-by: Dave Stevenson <dsteve@broadcom.com> + +V4L2: Correct flag settings for compressed formats + +Set flags field correctly on enum_fmt_vid_cap for compressed +image formats. + +Signed-off-by: Dave Stevenson <dsteve@broadcom.com> + +V4L2: H264 profile & level ctrls, FPS control and auto exp pri + +Several control handling updates. +H264 profile and level controls. +Timeperframe/FPS reworked to add V4L2_CID_EXPOSURE_AUTO_PRIORITY to +select whether AE is allowed to override the framerate specified. + +Signed-off-by: Dave Stevenson <dsteve@broadcom.com> + +V4L2: Correct BGR24 to RGB24 in format table + +Signed-off-by: Dave Stevenson <dsteve@broadcom.com> + +V4L2: Add additional pixel formats. Correct colourspace + +Adds the other flavours of YUYV, and NV12. +Corrects the overlay advertised colourspace. + +Signed-off-by: Dave Stevenson <dsteve@broadcom.com> + +V4L2: Drop logging msg from info to debug + +Signed-off-by: Dave Stevenson <dsteve@broadcom.com> + +V4L2: Initial pass at scene modes. + +Only supports exposure mode and metering modes. + +Signed-off-by: Dave Stevenson <dsteve@broadcom.com> + +V4L2: Add manual white balance control. + +Adds support for V4L2_CID_RED_BALANCE and +V4L2_CID_BLUE_BALANCE. Only has an effect if +V4L2_CID_AUTO_N_PRESET_WHITE_BALANCE has +V4L2_WHITE_BALANCE_MANUAL selected. + +Signed-off-by: Dave Stevenson <dsteve@broadcom.com> + +config: Enable V4L / MMAL driver + +V4L2: Increase the MMAL timeout to 3sec + +MJPEG codec flush is now taking longer and results +in a kernel panic if the driver has stopped waiting for +the result when it finally completes. +Increase the timeout value from 1 to 3secs. + +Signed-off-by: Dave Stevenson <dsteve@broadcom.com> + +V4L2: Add support for setting H264_I_PERIOD + +Adds support for the parameter V4L2_CID_MPEG_VIDEO_H264_I_PERIOD +to set the frequency with which I frames are produced. + +Signed-off-by: Dave Stevenson <dsteve@broadcom.com> + +V4L2: Enable GPU function for removing padding from images. + +GPU can now support arbitrary strides, although may require +additional processing to achieve it. Enable this feature +so that the images delivered are the size requested. + +Signed-off-by: Dave Stevenson <dsteve@broadcom.com> + +V4L2: Add support for V4L2_PIX_FMT_BGR32 + +Signed-off-by: Dave Stevenson <dsteve@broadcom.com> + +V4L2: Set the colourspace to avoid odd YUV-RGB conversions + +Removes the amiguity from the conversion routines and stops +them dropping back to the SD vs HD choice of coeffs. + +Signed-off-by: Dave Stevenson <dsteve@broadcom.com> + +V4L2: Make video/still threshold a run-time param + +Move the define for at what resolution the driver +switches from a video mode capture to a stills mode +capture to module parameters. + +Signed-off-by: Dave Stevenson <dsteve@broadcom.com> + +V4L2: Fix incorrect pool sizing + +Signed-off-by: Dave Stevenson <dsteve@broadcom.com> + +V4L2: Add option to disable enum_framesizes. + +Gstreamer's handling of a driver that advertises +V4L2_FRMSIZE_TYPE_STEPWISE to define the supported +resolutions is broken. See bug +https://bugzilla.gnome.org/show_bug.cgi?id=726521 + +Optional parameter of gst_v4l2src_is_broken added. +If non-zero, the driver claims not to support that +ioctl, and gstreamer should be happy again (it +guesses a set of defaults for itself). + +Signed-off-by: Dave Stevenson <dsteve@broadcom.com> + +V4L2: Add support for more image formats + +Adds YVU420 (YV12), YVU420SP (NV21), and BGR888. + +Signed-off-by: Dave Stevenson <dsteve@broadcom.com> + +V4L2: Extend range for V4L2_CID_MPEG_VIDEO_H264_I_PERIOD + +Request to extend the range from the fairly arbitrary +1000 frames (33 seconds at 30fps). Extend out to the +max range supported (int32 value). +Also allow 0, which is handled by the codec as only +send an I-frame on the first frame and never again. +There may be an exception if it detects a significant +scene change, but there's no easy way around that. + +Signed-off-by: Dave Stevenson <dsteve@broadcom.com> + +bcm2835-camera: stop_streaming now has a void return + +BCM2835-V4L2: Fix compliance test failures + +VIDIOC_TRY_FMT and VIDIOC_S_FMT tests were faling due +to reporting V4L2_COLORSPACE_JPEG when the colour +format wasn't V4L2_PIX_FMT_JPEG. +Now reports V4L2_COLORSPACE_SMPTE170M for YUV formats. + +bcm2835 camera planar/packed stride length + +Added a field to the mmal_fmt struct used to compute the bytes per line +when using a particular format. This results in the correct stride being +calculated even when the format is planar. + +Signed-off-by: Garrett Wilson <g@floft.net> + +bcm2835: camera: check for scene not being found + +static analysis by cppcheck detected some potential NULL pointer +dereference issues: + +[drivers/media/platform/bcm2835/controls.c:854]: (error) Possible null + pointer dereference: scene + (and lines 858, 859 too) + +it is possible that scene is not found because of an invalue ctrl->val +and is therefore NULL and hence causing a null pointer dereference. + +Signed-off-by: Colin Ian King <colin.king@canonical.com> + +bcm2835: memcpy port data to m rather than rmsg + +static analysis by cppcheck detected a memcpy to rmsg which is +not actually initialized at that point. The memcpy should be copying +to variable m instead. + +Signed-off-by: Colin Ian King <colin.king@canonical.com> + +BCM2835-V4L2: Return buffers to videobuf2 on shutdown + +https://github.com/raspberrypi/linux/issues/817 +Fixes the kernel warning from videobuf2 as buffers +are now returned as they are being flushed on +stop_streaming. + +squash: Fixup bcm2835-camera for changes in kernel 4.4 api + +v4l2: Fix up driver to upstream timestamp changes + +bcm2835-camera: fix a bug in computation of frame timestamp + +Fixes #1318 + +V4L2 driver updates (#1393) + +* BCM2835-V4L2: Correct ISO control and add V4L2_CID_ISO_SENSITIVITY_AUTO + +https://github.com/raspberrypi/linux/issues/1251 + +V4L2_CID_ISO_SENSITIVITY was not advertising ISO*1000 as it should. +V4L2_CID_ISO_SENSITIVITY_AUTO was not implemented, so was taking +V4L2_CID_ISO_SENSITIVITY as 0 for auto mode. +Still accepts 0 for auto, but also abides by the new parameter. + +Signed-off-by: Dave Stevenson <6by9@users.noreply.github.com> + +* BCM2835-V4L2: Add a video_nr parameter. + +Adds a kernel parameter "video_nr" to specify the preferred +/dev/videoX device node. +https://www.raspberrypi.org/forums/viewtopic.php?f=38&t=136120&p=905545 + +Signed-off-by: Dave Stevenson <6by9@users.noreply.github.com> + +* BCM2835-V4L2: Add support for multiple cameras + +Ask GPU on load how many cameras have been detected, and +enumerate that number of devices. +Only applicable on the Compute Module as no other device +exposes multiple CSI2 interfaces. + +Signed-off-by: Dave Stevenson <6by9@users.noreply.github.com> + +* BCM2835-V4L2: Add control of the overlay location and alpha. + +Actually do something useful in vidioc_s_fmt_vid_overlay and +vidioc_try_fmt_vid_overlay, rather than effectively having +read-only fields. + +Signed-off-by: Dave Stevenson <6by9@users.noreply.github.com> + +* BCM2835-V4L2: V4L2-Compliance failure fix + +VIDIOC_TRY_FMT was failing due to bytesperline not +being set correctly by default. + +Signed-off-by: Dave Stevenson <6by9@users.noreply.github.com> + +* BCM2835-V4L2: Make all module parameters static + +Clean up to correct variable scope + +Signed-off-by: Dave Stevenson <6by9@users.noreply.github.com> + +V4L2: Request maximum resolution from GPU + +Get resolution information about the sensors from the GPU +and advertise it correctly. + +Signed-off-by: Dave Stevenson <6by9@users.noreply.github.com> + +BCM2835-V4L2: Increase minimum resolution to 32x32 + +https://github.com/raspberrypi/linux/issues/1498 showed +up that 16x16 is failing to work on the GPU for some reason. + +GPU bug being tracked on +https://github.com/raspberrypi/firmware/issues/607 +Workaround here by increasing minimum resolution via V4L2 +to 32x32. + +Signed-off-by: Dave Stevenson <6by9@users.noreply.github.com> + +[media]: bcm2835-camera: fix compilation error + +There is an error when compiling rpi-4.6.y branch: + CC [M] drivers/media/platform/bcm2835/bcm2835-camera.o +drivers/media/platform/bcm2835/bcm2835-camera.c:639:17: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types] + .queue_setup = queue_setup, + ^ +drivers/media/platform/bcm2835/bcm2835-camera.c:639:17: note: (near initialization for 'bm2835_mmal_video_qops.queue_setup') + +The const void *parg in setup_queue callback is not needed since commit: +df9ecb0cad14b952a2865f8b3af86b2bbadfab45. +This commit removes it. + +Signed-off-by: Slawomir Stepien <sst@poczta.fm> + +bcm2835-camera: Fix max/min error when looping over cameras/resolutions + +See: https://github.com/raspberrypi/linux/issues/1447#issuecomment-221303506 +--- + Documentation/video4linux/bcm2835-v4l2.txt | 60 + + drivers/media/platform/Kconfig | 2 + + drivers/media/platform/Makefile | 2 + + drivers/media/platform/bcm2835/Kconfig | 25 + + drivers/media/platform/bcm2835/Makefile | 5 + + drivers/media/platform/bcm2835/bcm2835-camera.c | 1982 ++++++++++++++++++++++ + drivers/media/platform/bcm2835/bcm2835-camera.h | 144 ++ + drivers/media/platform/bcm2835/controls.c | 1345 +++++++++++++++ + drivers/media/platform/bcm2835/mmal-common.h | 53 + + drivers/media/platform/bcm2835/mmal-encodings.h | 127 ++ + drivers/media/platform/bcm2835/mmal-msg-common.h | 50 + + drivers/media/platform/bcm2835/mmal-msg-format.h | 81 + + drivers/media/platform/bcm2835/mmal-msg-port.h | 107 ++ + drivers/media/platform/bcm2835/mmal-msg.h | 404 +++++ + drivers/media/platform/bcm2835/mmal-parameters.h | 689 ++++++++ + drivers/media/platform/bcm2835/mmal-vchiq.c | 1916 +++++++++++++++++++++ + drivers/media/platform/bcm2835/mmal-vchiq.h | 178 ++ + 17 files changed, 7170 insertions(+) + create mode 100644 Documentation/video4linux/bcm2835-v4l2.txt + create mode 100644 drivers/media/platform/bcm2835/Kconfig + create mode 100644 drivers/media/platform/bcm2835/Makefile + create mode 100644 drivers/media/platform/bcm2835/bcm2835-camera.c + create mode 100644 drivers/media/platform/bcm2835/bcm2835-camera.h + create mode 100644 drivers/media/platform/bcm2835/controls.c + create mode 100644 drivers/media/platform/bcm2835/mmal-common.h + create mode 100644 drivers/media/platform/bcm2835/mmal-encodings.h + create mode 100644 drivers/media/platform/bcm2835/mmal-msg-common.h + create mode 100644 drivers/media/platform/bcm2835/mmal-msg-format.h + create mode 100644 drivers/media/platform/bcm2835/mmal-msg-port.h + create mode 100644 drivers/media/platform/bcm2835/mmal-msg.h + create mode 100644 drivers/media/platform/bcm2835/mmal-parameters.h + create mode 100644 drivers/media/platform/bcm2835/mmal-vchiq.c + create mode 100644 drivers/media/platform/bcm2835/mmal-vchiq.h + +diff --git a/Documentation/video4linux/bcm2835-v4l2.txt b/Documentation/video4linux/bcm2835-v4l2.txt +new file mode 100644 +index 0000000..c585a8f +--- /dev/null ++++ b/Documentation/video4linux/bcm2835-v4l2.txt +@@ -0,0 +1,60 @@ ++ ++BCM2835 (aka Raspberry Pi) V4L2 driver ++====================================== ++ ++1. Copyright ++============ ++ ++Copyright © 2013 Raspberry Pi (Trading) Ltd. ++ ++2. License ++========== ++ ++This program is free software; you can redistribute it and/or modify ++it under the terms of the GNU General Public License as published by ++the Free Software Foundation; either version 2 of the License, or ++(at your option) any later version. ++ ++This program is distributed in the hope that it will be useful, ++but WITHOUT ANY WARRANTY; without even the implied warranty of ++MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++GNU General Public License for more details. ++ ++You should have received a copy of the GNU General Public License ++along with this program; if not, write to the Free Software ++Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ++ ++3. Quick Start ++============== ++ ++You need a version 1.0 or later of v4l2-ctl, available from: ++ git://git.linuxtv.org/v4l-utils.git ++ ++$ sudo modprobe bcm2835-v4l2 ++ ++Turn on the overlay: ++ ++$ v4l2-ctl --overlay=1 ++ ++Turn off the overlay: ++ ++$ v4l2-ctl --overlay=0 ++ ++Set the capture format for video: ++ ++$ v4l2-ctl --set-fmt-video=width=1920,height=1088,pixelformat=4 ++ ++(Note: 1088 not 1080). ++ ++Capture: ++ ++$ v4l2-ctl --stream-mmap=3 --stream-count=100 --stream-to=somefile.h264 ++ ++Stills capture: ++ ++$ v4l2-ctl --set-fmt-video=width=2592,height=1944,pixelformat=3 ++$ v4l2-ctl --stream-mmap=3 --stream-count=1 --stream-to=somefile.jpg ++ ++List of available formats: ++ ++$ v4l2-ctl --list-formats +diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig +index 201f5c2..b798ab8 100644 +--- a/drivers/media/platform/Kconfig ++++ b/drivers/media/platform/Kconfig +@@ -11,6 +11,8 @@ menuconfig V4L_PLATFORM_DRIVERS + + if V4L_PLATFORM_DRIVERS + ++source "drivers/media/platform/bcm2835/Kconfig" ++ + source "drivers/media/platform/marvell-ccic/Kconfig" + + config VIDEO_VIA_CAMERA +diff --git a/drivers/media/platform/Makefile b/drivers/media/platform/Makefile +index bbb7bd1..6fe5b3f 100644 +--- a/drivers/media/platform/Makefile ++++ b/drivers/media/platform/Makefile +@@ -2,6 +2,8 @@ + # Makefile for the video capture/playback device drivers. + # + ++obj-$(CONFIG_VIDEO_BCM2835) += bcm2835/ ++ + obj-$(CONFIG_VIDEO_M32R_AR_M64278) += arv.o + + obj-$(CONFIG_VIDEO_VIA_CAMERA) += via-camera.o +diff --git a/drivers/media/platform/bcm2835/Kconfig b/drivers/media/platform/bcm2835/Kconfig +new file mode 100644 +index 0000000..99a5cbc +--- /dev/null ++++ b/drivers/media/platform/bcm2835/Kconfig +@@ -0,0 +1,25 @@ ++# Broadcom VideoCore IV v4l2 camera support ++ ++config VIDEO_BCM2835 ++ bool "Broadcom BCM2835 camera interface driver" ++ depends on VIDEO_V4L2 && (ARCH_BCM2708 || ARCH_BCM2709 || ARCH_BCM2835) ++ ---help--- ++ Say Y here to enable camera host interface devices for ++ Broadcom BCM2835 SoC. This operates over the VCHIQ interface ++ to a service running on VideoCore. ++ ++ ++if VIDEO_BCM2835 ++ ++config VIDEO_BCM2835_MMAL ++ tristate "Broadcom BM2835 MMAL camera interface driver" ++ depends on BCM2708_VCHIQ ++ select VIDEOBUF2_VMALLOC ++ ---help--- ++ This is a V4L2 driver for the Broadcom BCM2835 MMAL camera host interface ++ ++ To compile this driver as a module, choose M here: the ++ module will be called bcm2835-v4l2.o ++ ++ ++endif # VIDEO_BM2835 +diff --git a/drivers/media/platform/bcm2835/Makefile b/drivers/media/platform/bcm2835/Makefile +new file mode 100644 +index 0000000..f17c79c +--- /dev/null ++++ b/drivers/media/platform/bcm2835/Makefile +@@ -0,0 +1,5 @@ ++bcm2835-v4l2-objs := bcm2835-camera.o controls.o mmal-vchiq.o ++ ++obj-$(CONFIG_VIDEO_BCM2835_MMAL) += bcm2835-v4l2.o ++ ++ccflags-$(CONFIG_VIDEO_BCM2835) += -Idrivers/misc/vc04_services -Idrivers/misc/vc04_services/interface/vcos/linuxkernel -D__VCCOREVER__=0x04000000 +diff --git a/drivers/media/platform/bcm2835/bcm2835-camera.c b/drivers/media/platform/bcm2835/bcm2835-camera.c +new file mode 100644 +index 0000000..1b16c63 +--- /dev/null ++++ b/drivers/media/platform/bcm2835/bcm2835-camera.c +@@ -0,0 +1,1982 @@ ++/* ++ * Broadcom BM2835 V4L2 driver ++ * ++ * Copyright © 2013 Raspberry Pi (Trading) Ltd. ++ * ++ * This file is subject to the terms and conditions of the GNU General Public ++ * License. See the file COPYING in the main directory of this archive ++ * for more details. ++ * ++ * Authors: Vincent Sanders <vincent.sanders@collabora.co.uk> ++ * Dave Stevenson <dsteve@broadcom.com> ++ * Simon Mellor <simellor@broadcom.com> ++ * Luke Diamand <luked@broadcom.com> ++ */ ++ ++#include <linux/errno.h> ++#include <linux/kernel.h> ++#include <linux/module.h> ++#include <linux/slab.h> ++#include <media/videobuf2-vmalloc.h> ++#include <media/videobuf2-dma-contig.h> ++#include <media/v4l2-device.h> ++#include <media/v4l2-ioctl.h> ++#include <media/v4l2-ctrls.h> ++#include <media/v4l2-fh.h> ++#include <media/v4l2-event.h> ++#include <media/v4l2-common.h> ++#include <linux/delay.h> ++ ++#include "mmal-common.h" ++#include "mmal-encodings.h" ++#include "mmal-vchiq.h" ++#include "mmal-msg.h" ++#include "mmal-parameters.h" ++#include "bcm2835-camera.h" ++ ++#define BM2835_MMAL_VERSION "0.0.2" ++#define BM2835_MMAL_MODULE_NAME "bcm2835-v4l2" ++#define MIN_WIDTH 32 ++#define MIN_HEIGHT 32 ++#define MIN_BUFFER_SIZE (80*1024) ++ ++#define MAX_VIDEO_MODE_WIDTH 1280 ++#define MAX_VIDEO_MODE_HEIGHT 720 ++ ++#define MAX_BCM2835_CAMERAS 2 ++ ++MODULE_DESCRIPTION("Broadcom 2835 MMAL video capture"); ++MODULE_AUTHOR("Vincent Sanders"); ++MODULE_LICENSE("GPL"); ++MODULE_VERSION(BM2835_MMAL_VERSION); ++ ++int bcm2835_v4l2_debug; ++module_param_named(debug, bcm2835_v4l2_debug, int, 0644); ++MODULE_PARM_DESC(bcm2835_v4l2_debug, "Debug level 0-2"); ++ ++#define UNSET (-1) ++static int video_nr[] = {[0 ... (MAX_BCM2835_CAMERAS - 1)] = UNSET }; ++module_param_array(video_nr, int, NULL, 0644); ++MODULE_PARM_DESC(video_nr, "videoX start numbers, -1 is autodetect"); ++ ++static int max_video_width = MAX_VIDEO_MODE_WIDTH; ++static int max_video_height = MAX_VIDEO_MODE_HEIGHT; ++module_param(max_video_width, int, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); ++MODULE_PARM_DESC(max_video_width, "Threshold for video mode"); ++module_param(max_video_height, int, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); ++MODULE_PARM_DESC(max_video_height, "Threshold for video mode"); ++ ++/* Gstreamer bug https://bugzilla.gnome.org/show_bug.cgi?id=726521 ++ * v4l2src does bad (and actually wrong) things when the vidioc_enum_framesizes ++ * function says type V4L2_FRMSIZE_TYPE_STEPWISE, which we do by default. ++ * It's happier if we just don't say anything at all, when it then ++ * sets up a load of defaults that it thinks might work. ++ * If gst_v4l2src_is_broken is non-zero, then we remove the function from ++ * our function table list (actually switch to an alternate set, but same ++ * result). ++ */ ++static int gst_v4l2src_is_broken; ++module_param(gst_v4l2src_is_broken, int, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); ++MODULE_PARM_DESC(gst_v4l2src_is_broken, "If non-zero, enable workaround for Gstreamer"); ++ ++/* global device data array */ ++static struct bm2835_mmal_dev *gdev[MAX_BCM2835_CAMERAS]; ++ ++#define FPS_MIN 1 ++#define FPS_MAX 90 ++ ++/* timeperframe: min/max and default */ ++static const struct v4l2_fract ++ tpf_min = {.numerator = 1, .denominator = FPS_MAX}, ++ tpf_max = {.numerator = 1, .denominator = FPS_MIN}, ++ tpf_default = {.numerator = 1000, .denominator = 30000}; ++ ++/* video formats */ ++static struct mmal_fmt formats[] = { ++ { ++ .name = "4:2:0, planar, YUV", ++ .fourcc = V4L2_PIX_FMT_YUV420, ++ .flags = 0, ++ .mmal = MMAL_ENCODING_I420, ++ .depth = 12, ++ .mmal_component = MMAL_COMPONENT_CAMERA, ++ .ybbp = 1, ++ }, ++ { ++ .name = "4:2:2, packed, YUYV", ++ .fourcc = V4L2_PIX_FMT_YUYV, ++ .flags = 0, ++ .mmal = MMAL_ENCODING_YUYV, ++ .depth = 16, ++ .mmal_component = MMAL_COMPONENT_CAMERA, ++ .ybbp = 2, ++ }, ++ { ++ .name = "RGB24 (LE)", ++ .fourcc = V4L2_PIX_FMT_RGB24, ++ .flags = 0, ++ .mmal = MMAL_ENCODING_BGR24, ++ .depth = 24, ++ .mmal_component = MMAL_COMPONENT_CAMERA, ++ .ybbp = 3, ++ }, ++ { ++ .name = "JPEG", ++ .fourcc = V4L2_PIX_FMT_JPEG, ++ .flags = V4L2_FMT_FLAG_COMPRESSED, ++ .mmal = MMAL_ENCODING_JPEG, ++ .depth = 8, ++ .mmal_component = MMAL_COMPONENT_IMAGE_ENCODE, ++ .ybbp = 0, ++ }, ++ { ++ .name = "H264", ++ .fourcc = V4L2_PIX_FMT_H264, ++ .flags = V4L2_FMT_FLAG_COMPRESSED, ++ .mmal = MMAL_ENCODING_H264, ++ .depth = 8, ++ .mmal_component = MMAL_COMPONENT_VIDEO_ENCODE, ++ .ybbp = 0, ++ }, ++ { ++ .name = "MJPEG", ++ .fourcc = V4L2_PIX_FMT_MJPEG, ++ .flags = V4L2_FMT_FLAG_COMPRESSED, ++ .mmal = MMAL_ENCODING_MJPEG, ++ .depth = 8, ++ .mmal_component = MMAL_COMPONENT_VIDEO_ENCODE, ++ .ybbp = 0, ++ }, ++ { ++ .name = "4:2:2, packed, YVYU", ++ .fourcc = V4L2_PIX_FMT_YVYU, ++ .flags = 0, ++ .mmal = MMAL_ENCODING_YVYU, ++ .depth = 16, ++ .mmal_component = MMAL_COMPONENT_CAMERA, ++ .ybbp = 2, ++ }, ++ { ++ .name = "4:2:2, packed, VYUY", ++ .fourcc = V4L2_PIX_FMT_VYUY, ++ .flags = 0, ++ .mmal = MMAL_ENCODING_VYUY, ++ .depth = 16, ++ .mmal_component = MMAL_COMPONENT_CAMERA, ++ .ybbp = 2, ++ }, ++ { ++ .name = "4:2:2, packed, UYVY", ++ .fourcc = V4L2_PIX_FMT_UYVY, ++ .flags = 0, ++ .mmal = MMAL_ENCODING_UYVY, ++ .depth = 16, ++ .mmal_component = MMAL_COMPONENT_CAMERA, ++ .ybbp = 2, ++ }, ++ { ++ .name = "4:2:0, planar, NV12", ++ .fourcc = V4L2_PIX_FMT_NV12, ++ .flags = 0, ++ .mmal = MMAL_ENCODING_NV12, ++ .depth = 12, ++ .mmal_component = MMAL_COMPONENT_CAMERA, ++ .ybbp = 1, ++ }, ++ { ++ .name = "RGB24 (BE)", ++ .fourcc = V4L2_PIX_FMT_BGR24, ++ .flags = 0, ++ .mmal = MMAL_ENCODING_RGB24, ++ .depth = 24, ++ .mmal_component = MMAL_COMPONENT_CAMERA, ++ .ybbp = 3, ++ }, ++ { ++ .name = "4:2:0, planar, YVU", ++ .fourcc = V4L2_PIX_FMT_YVU420, ++ .flags = 0, ++ .mmal = MMAL_ENCODING_YV12, ++ .depth = 12, ++ .mmal_component = MMAL_COMPONENT_CAMERA, ++ .ybbp = 1, ++ }, ++ { ++ .name = "4:2:0, planar, NV21", ++ .fourcc = V4L2_PIX_FMT_NV21, ++ .flags = 0, ++ .mmal = MMAL_ENCODING_NV21, ++ .depth = 12, ++ .mmal_component = MMAL_COMPONENT_CAMERA, ++ .ybbp = 1, ++ }, ++ { ++ .name = "RGB32 (BE)", ++ .fourcc = V4L2_PIX_FMT_BGR32, ++ .flags = 0, ++ .mmal = MMAL_ENCODING_BGRA, ++ .depth = 32, ++ .mmal_component = MMAL_COMPONENT_CAMERA, ++ .ybbp = 4, ++ }, ++}; ++ ++static struct mmal_fmt *get_format(struct v4l2_format *f) ++{ ++ struct mmal_fmt *fmt; ++ unsigned int k; ++ ++ for (k = 0; k < ARRAY_SIZE(formats); k++) { ++ fmt = &formats[k]; ++ if (fmt->fourcc == f->fmt.pix.pixelformat) ++ break; ++ } ++ ++ if (k == ARRAY_SIZE(formats)) ++ return NULL; ++ ++ return &formats[k]; ++} ++ ++/* ------------------------------------------------------------------ ++ Videobuf queue operations ++ ------------------------------------------------------------------*/ ++ ++static int queue_setup(struct vb2_queue *vq, ++ unsigned int *nbuffers, unsigned int *nplanes, ++ unsigned int sizes[], void *alloc_ctxs[]) ++{ ++ struct bm2835_mmal_dev *dev = vb2_get_drv_priv(vq); ++ unsigned long size; ++ ++ /* refuse queue setup if port is not configured */ ++ if (dev->capture.port == NULL) { ++ v4l2_err(&dev->v4l2_dev, ++ "%s: capture port not configured\n", __func__); ++ return -EINVAL; ++ } ++ ++ size = dev->capture.port->current_buffer.size; ++ if (size == 0) { ++ v4l2_err(&dev->v4l2_dev, ++ "%s: capture port buffer size is zero\n", __func__); ++ return -EINVAL; ++ } ++ ++ if (*nbuffers < (dev->capture.port->current_buffer.num + 2)) ++ *nbuffers = (dev->capture.port->current_buffer.num + 2); ++ ++ *nplanes = 1; ++ ++ sizes[0] = size; ++ ++ /* ++ * videobuf2-vmalloc allocator is context-less so no need to set ++ * alloc_ctxs array. ++ */ ++ ++ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, "%s: dev:%p\n", ++ __func__, dev); ++ ++ return 0; ++} ++ ++static int buffer_prepare(struct vb2_buffer *vb) ++{ ++ struct bm2835_mmal_dev *dev = vb2_get_drv_priv(vb->vb2_queue); ++ unsigned long size; ++ ++ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, "%s: dev:%p\n", ++ __func__, dev); ++ ++ BUG_ON(dev->capture.port == NULL); ++ BUG_ON(dev->capture.fmt == NULL); ++ ++ size = dev->capture.stride * dev->capture.height; ++ if (vb2_plane_size(vb, 0) < size) { ++ v4l2_err(&dev->v4l2_dev, ++ "%s data will not fit into plane (%lu < %lu)\n", ++ __func__, vb2_plane_size(vb, 0), size); ++ return -EINVAL; ++ } ++ ++ return 0; ++} ++ ++static inline bool is_capturing(struct bm2835_mmal_dev *dev) ++{ ++ return dev->capture.camera_port == ++ &dev-> ++ component[MMAL_COMPONENT_CAMERA]->output[MMAL_CAMERA_PORT_CAPTURE]; ++} ++ ++static void buffer_cb(struct vchiq_mmal_instance *instance, ++ struct vchiq_mmal_port *port, ++ int status, ++ struct mmal_buffer *buf, ++ unsigned long length, u32 mmal_flags, s64 dts, s64 pts) ++{ ++ struct bm2835_mmal_dev *dev = port->cb_ctx; ++ ++ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, ++ "%s: status:%d, buf:%p, length:%lu, flags %u, pts %lld\n", ++ __func__, status, buf, length, mmal_flags, pts); ++ ++ if (status != 0) { ++ /* error in transfer */ ++ if (buf != NULL) { ++ /* there was a buffer with the error so return it */ ++ vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR); ++ } ++ return; ++ } else if (length == 0) { ++ /* stream ended */ ++ if (buf != NULL) { ++ /* this should only ever happen if the port is ++ * disabled and there are buffers still queued ++ */ ++ vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR); ++ pr_debug("Empty buffer"); ++ } else if (dev->capture.frame_count) { ++ /* grab another frame */ ++ if (is_capturing(dev)) { ++ pr_debug("Grab another frame"); ++ vchiq_mmal_port_parameter_set( ++ instance, ++ dev->capture. ++ camera_port, ++ MMAL_PARAMETER_CAPTURE, ++ &dev->capture. ++ frame_count, ++ sizeof(dev->capture.frame_count)); ++ } ++ } else { ++ /* signal frame completion */ ++ complete(&dev->capture.frame_cmplt); ++ } ++ } else { ++ if (dev->capture.frame_count) { ++ if (dev->capture.vc_start_timestamp != -1 && ++ pts != 0) { ++ struct timeval timestamp; ++ s64 runtime_us = pts - ++ dev->capture.vc_start_timestamp; ++ u32 div = 0; ++ u32 rem = 0; ++ ++ div = ++ div_u64_rem(runtime_us, USEC_PER_SEC, &rem); ++ timestamp.tv_sec = ++ dev->capture.kernel_start_ts.tv_sec + div; ++ timestamp.tv_usec = ++ dev->capture.kernel_start_ts.tv_usec + rem; ++ ++ if (timestamp.tv_usec >= ++ USEC_PER_SEC) { ++ timestamp.tv_sec++; ++ timestamp.tv_usec -= ++ USEC_PER_SEC; ++ } ++ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, ++ "Convert start time %d.%06d and %llu " ++ "with offset %llu to %d.%06d\n", ++ (int)dev->capture.kernel_start_ts. ++ tv_sec, ++ (int)dev->capture.kernel_start_ts. ++ tv_usec, ++ dev->capture.vc_start_timestamp, pts, ++ (int)timestamp.tv_sec, ++ (int)timestamp.tv_usec); ++ buf->vb.vb2_buf.timestamp = timestamp.tv_sec * 1000000000ULL + ++ timestamp.tv_usec * 1000ULL; ++ } else { ++ buf->vb.vb2_buf.timestamp = ktime_get_ns(); ++ } ++ ++ vb2_set_plane_payload(&buf->vb.vb2_buf, 0, length); ++ vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_DONE); ++ ++ if (mmal_flags & MMAL_BUFFER_HEADER_FLAG_EOS && ++ is_capturing(dev)) { ++ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, ++ "Grab another frame as buffer has EOS"); ++ vchiq_mmal_port_parameter_set( ++ instance, ++ dev->capture. ++ camera_port, ++ MMAL_PARAMETER_CAPTURE, ++ &dev->capture. ++ frame_count, ++ sizeof(dev->capture.frame_count)); ++ } ++ } else { ++ /* signal frame completion */ ++ vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR); ++ complete(&dev->capture.frame_cmplt); ++ } ++ } ++} ++ ++static int enable_camera(struct bm2835_mmal_dev *dev) ++{ ++ int ret; ++ if (!dev->camera_use_count) { ++ ret = vchiq_mmal_port_parameter_set( ++ dev->instance, ++ &dev->component[MMAL_COMPONENT_CAMERA]->control, ++ MMAL_PARAMETER_CAMERA_NUM, &dev->camera_num, ++ sizeof(dev->camera_num)); ++ if (ret < 0) { ++ v4l2_err(&dev->v4l2_dev, ++ "Failed setting camera num, ret %d\n", ret); ++ return -EINVAL; ++ } ++ ++ ret = vchiq_mmal_component_enable( ++ dev->instance, ++ dev->component[MMAL_COMPONENT_CAMERA]); ++ if (ret < 0) { ++ v4l2_err(&dev->v4l2_dev, ++ "Failed enabling camera, ret %d\n", ret); ++ return -EINVAL; ++ } ++ } ++ dev->camera_use_count++; ++ v4l2_dbg(1, bcm2835_v4l2_debug, ++ &dev->v4l2_dev, "enabled camera (refcount %d)\n", ++ dev->camera_use_count); ++ return 0; ++} ++ ++static int disable_camera(struct bm2835_mmal_dev *dev) ++{ ++ int ret; ++ if (!dev->camera_use_count) { ++ v4l2_err(&dev->v4l2_dev, ++ "Disabled the camera when already disabled\n"); ++ return -EINVAL; ++ } ++ dev->camera_use_count--; ++ if (!dev->camera_use_count) { ++ unsigned int i = 0xFFFFFFFF; ++ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, ++ "Disabling camera\n"); ++ ret = ++ vchiq_mmal_component_disable( ++ dev->instance, ++ dev->component[MMAL_COMPONENT_CAMERA]); ++ if (ret < 0) { ++ v4l2_err(&dev->v4l2_dev, ++ "Failed disabling camera, ret %d\n", ret); ++ return -EINVAL; ++ } ++ vchiq_mmal_port_parameter_set( ++ dev->instance, ++ &dev->component[MMAL_COMPONENT_CAMERA]->control, ++ MMAL_PARAMETER_CAMERA_NUM, &i, ++ sizeof(i)); ++ } ++ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, ++ "Camera refcount now %d\n", dev->camera_use_count); ++ return 0; ++} ++ ++static void buffer_queue(struct vb2_buffer *vb) ++{ ++ struct bm2835_mmal_dev *dev = vb2_get_drv_priv(vb->vb2_queue); ++ struct vb2_v4l2_buffer *vb2 = to_vb2_v4l2_buffer(vb); ++ struct mmal_buffer *buf = container_of(vb2, struct mmal_buffer, vb); ++ int ret; ++ ++ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, ++ "%s: dev:%p buf:%p\n", __func__, dev, buf); ++ ++ buf->buffer = vb2_plane_vaddr(&buf->vb.vb2_buf, 0); ++ buf->buffer_size = vb2_plane_size(&buf->vb.vb2_buf, 0); ++ ++ ret = vchiq_mmal_submit_buffer(dev->instance, dev->capture.port, buf); ++ if (ret < 0) ++ v4l2_err(&dev->v4l2_dev, "%s: error submitting buffer\n", ++ __func__); ++} ++ ++static int start_streaming(struct vb2_queue *vq, unsigned int count) ++{ ++ struct bm2835_mmal_dev *dev = vb2_get_drv_priv(vq); ++ int ret; ++ int parameter_size; ++ ++ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, "%s: dev:%p\n", ++ __func__, dev); ++ ++ /* ensure a format has actually been set */ ++ if (dev->capture.port == NULL) ++ return -EINVAL; ++ ++ if (enable_camera(dev) < 0) { ++ v4l2_err(&dev->v4l2_dev, "Failed to enable camera\n"); ++ return -EINVAL; ++ } ++ ++ /*init_completion(&dev->capture.frame_cmplt); */ ++ ++ /* enable frame capture */ ++ dev->capture.frame_count = 1; ++ ++ /* if the preview is not already running, wait for a few frames for AGC ++ * to settle down. ++ */ ++ if (!dev->component[MMAL_COMPONENT_PREVIEW]->enabled) ++ msleep(300); ++ ++ /* enable the connection from camera to encoder (if applicable) */ ++ if (dev->capture.camera_port != dev->capture.port ++ && dev->capture.camera_port) { ++ ret = vchiq_mmal_port_enable(dev->instance, ++ dev->capture.camera_port, NULL); ++ if (ret) { ++ v4l2_err(&dev->v4l2_dev, ++ "Failed to enable encode tunnel - error %d\n", ++ ret); ++ return -1; ++ } ++ } ++ ++ /* Get VC timestamp at this point in time */ ++ parameter_size = sizeof(dev->capture.vc_start_timestamp); ++ if (vchiq_mmal_port_parameter_get(dev->instance, ++ dev->capture.camera_port, ++ MMAL_PARAMETER_SYSTEM_TIME, ++ &dev->capture.vc_start_timestamp, ++ &parameter_size)) { ++ v4l2_err(&dev->v4l2_dev, ++ "Failed to get VC start time - update your VC f/w\n"); ++ ++ /* Flag to indicate just to rely on kernel timestamps */ ++ dev->capture.vc_start_timestamp = -1; ++ } else ++ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, ++ "Start time %lld size %d\n", ++ dev->capture.vc_start_timestamp, parameter_size); ++ ++ v4l2_get_timestamp(&dev->capture.kernel_start_ts); ++ ++ /* enable the camera port */ ++ dev->capture.port->cb_ctx = dev; ++ ret = ++ vchiq_mmal_port_enable(dev->instance, dev->capture.port, buffer_cb); ++ if (ret) { ++ v4l2_err(&dev->v4l2_dev, ++ "Failed to enable capture port - error %d. " ++ "Disabling camera port again\n", ret); ++ ++ vchiq_mmal_port_disable(dev->instance, ++ dev->capture.camera_port); ++ if (disable_camera(dev) < 0) { ++ v4l2_err(&dev->v4l2_dev, "Failed to disable camera\n"); ++ return -EINVAL; ++ } ++ return -1; ++ } ++ ++ /* capture the first frame */ ++ vchiq_mmal_port_parameter_set(dev->instance, ++ dev->capture.camera_port, ++ MMAL_PARAMETER_CAPTURE, ++ &dev->capture.frame_count, ++ sizeof(dev->capture.frame_count)); ++ return 0; ++} ++ ++/* abort streaming and wait for last buffer */ ++static void stop_streaming(struct vb2_queue *vq) ++{ ++ int ret; ++ struct bm2835_mmal_dev *dev = vb2_get_drv_priv(vq); ++ ++ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, "%s: dev:%p\n", ++ __func__, dev); ++ ++ init_completion(&dev->capture.frame_cmplt); ++ dev->capture.frame_count = 0; ++ ++ /* ensure a format has actually been set */ ++ if (dev->capture.port == NULL) { ++ v4l2_err(&dev->v4l2_dev, ++ "no capture port - stream not started?\n"); ++ return; ++ } ++ ++ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, "stopping capturing\n"); ++ ++ /* stop capturing frames */ ++ vchiq_mmal_port_parameter_set(dev->instance, ++ dev->capture.camera_port, ++ MMAL_PARAMETER_CAPTURE, ++ &dev->capture.frame_count, ++ sizeof(dev->capture.frame_count)); ++ ++ /* wait for last frame to complete */ ++ ret = wait_for_completion_timeout(&dev->capture.frame_cmplt, HZ); ++ if (ret <= 0) ++ v4l2_err(&dev->v4l2_dev, ++ "error %d waiting for frame completion\n", ret); ++ ++ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, ++ "disabling connection\n"); ++ ++ /* disable the connection from camera to encoder */ ++ ret = vchiq_mmal_port_disable(dev->instance, dev->capture.camera_port); ++ if (!ret && dev->capture.camera_port != dev->capture.port) { ++ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, ++ "disabling port\n"); ++ ret = vchiq_mmal_port_disable(dev->instance, dev->capture.port); ++ } else if (dev->capture.camera_port != dev->capture.port) { ++ v4l2_err(&dev->v4l2_dev, "port_disable failed, error %d\n", ++ ret); ++ } ++ ++ if (disable_camera(dev) < 0) ++ v4l2_err(&dev->v4l2_dev, "Failed to disable camera\n"); ++} ++ ++static void bm2835_mmal_lock(struct vb2_queue *vq) ++{ ++ struct bm2835_mmal_dev *dev = vb2_get_drv_priv(vq); ++ mutex_lock(&dev->mutex); ++} ++ ++static void bm2835_mmal_unlock(struct vb2_queue *vq) ++{ ++ struct bm2835_mmal_dev *dev = vb2_get_drv_priv(vq); ++ mutex_unlock(&dev->mutex); ++} ++ ++static struct vb2_ops bm2835_mmal_video_qops = { ++ .queue_setup = queue_setup, ++ .buf_prepare = buffer_prepare, ++ .buf_queue = buffer_queue, ++ .start_streaming = start_streaming, ++ .stop_streaming = stop_streaming, ++ .wait_prepare = bm2835_mmal_unlock, ++ .wait_finish = bm2835_mmal_lock, ++}; ++ ++/* ------------------------------------------------------------------ ++ IOCTL operations ++ ------------------------------------------------------------------*/ ++ ++static int set_overlay_params(struct bm2835_mmal_dev *dev, ++ struct vchiq_mmal_port *port) ++{ ++ int ret; ++ struct mmal_parameter_displayregion prev_config = { ++ .set = MMAL_DISPLAY_SET_LAYER | MMAL_DISPLAY_SET_ALPHA | ++ MMAL_DISPLAY_SET_DEST_RECT | MMAL_DISPLAY_SET_FULLSCREEN, ++ .layer = PREVIEW_LAYER, ++ .alpha = dev->overlay.global_alpha, ++ .fullscreen = 0, ++ .dest_rect = { ++ .x = dev->overlay.w.left, ++ .y = dev->overlay.w.top, ++ .width = dev->overlay.w.width, ++ .height = dev->overlay.w.height, ++ }, ++ }; ++ ret = vchiq_mmal_port_parameter_set(dev->instance, port, ++ MMAL_PARAMETER_DISPLAYREGION, ++ &prev_config, sizeof(prev_config)); ++ ++ return ret; ++} ++ ++/* overlay ioctl */ ++static int vidioc_enum_fmt_vid_overlay(struct file *file, void *priv, ++ struct v4l2_fmtdesc *f) ++{ ++ struct mmal_fmt *fmt; ++ ++ if (f->index >= ARRAY_SIZE(formats)) ++ return -EINVAL; ++ ++ fmt = &formats[f->index]; ++ ++ strlcpy(f->description, fmt->name, sizeof(f->description)); ++ f->pixelformat = fmt->fourcc; ++ f->flags = fmt->flags; ++ ++ return 0; ++} ++ ++static int vidioc_g_fmt_vid_overlay(struct file *file, void *priv, ++ struct v4l2_format *f) ++{ ++ struct bm2835_mmal_dev *dev = video_drvdata(file); ++ ++ f->fmt.win = dev->overlay; ++ ++ return 0; ++} ++ ++static int vidioc_try_fmt_vid_overlay(struct file *file, void *priv, ++ struct v4l2_format *f) ++{ ++ struct bm2835_mmal_dev *dev = video_drvdata(file); ++ ++ f->fmt.win.field = V4L2_FIELD_NONE; ++ f->fmt.win.chromakey = 0; ++ f->fmt.win.clips = NULL; ++ f->fmt.win.clipcount = 0; ++ f->fmt.win.bitmap = NULL; ++ ++ v4l_bound_align_image(&f->fmt.win.w.width, MIN_WIDTH, dev->max_width, 1, ++ &f->fmt.win.w.height, MIN_HEIGHT, dev->max_height, ++ 1, 0); ++ v4l_bound_align_image(&f->fmt.win.w.left, MIN_WIDTH, dev->max_width, 1, ++ &f->fmt.win.w.top, MIN_HEIGHT, dev->max_height, ++ 1, 0); ++ ++ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, ++ "Overlay: Now w/h %dx%d l/t %dx%d\n", ++ f->fmt.win.w.width, f->fmt.win.w.height, ++ f->fmt.win.w.left, f->fmt.win.w.top); ++ ++ v4l2_dump_win_format(1, ++ bcm2835_v4l2_debug, ++ &dev->v4l2_dev, ++ &f->fmt.win, ++ __func__); ++ return 0; ++} ++ ++static int vidioc_s_fmt_vid_overlay(struct file *file, void *priv, ++ struct v4l2_format *f) ++{ ++ struct bm2835_mmal_dev *dev = video_drvdata(file); ++ ++ vidioc_try_fmt_vid_overlay(file, priv, f); ++ ++ dev->overlay = f->fmt.win; ++ if (dev->component[MMAL_COMPONENT_PREVIEW]->enabled) { ++ set_overlay_params(dev, ++ &dev->component[MMAL_COMPONENT_PREVIEW]->input[0]); ++ } ++ ++ return 0; ++} ++ ++static int vidioc_overlay(struct file *file, void *f, unsigned int on) ++{ ++ int ret; ++ struct bm2835_mmal_dev *dev = video_drvdata(file); ++ struct vchiq_mmal_port *src; ++ struct vchiq_mmal_port *dst; ++ if ((on && dev->component[MMAL_COMPONENT_PREVIEW]->enabled) || ++ (!on && !dev->component[MMAL_COMPONENT_PREVIEW]->enabled)) ++ return 0; /* already in requested state */ ++ ++ src = ++ &dev->component[MMAL_COMPONENT_CAMERA]-> ++ output[MMAL_CAMERA_PORT_PREVIEW]; ++ ++ if (!on) { ++ /* disconnect preview ports and disable component */ ++ ret = vchiq_mmal_port_disable(dev->instance, src); ++ if (!ret) ++ ret = ++ vchiq_mmal_port_connect_tunnel(dev->instance, src, ++ NULL); ++ if (ret >= 0) ++ ret = vchiq_mmal_component_disable( ++ dev->instance, ++ dev->component[MMAL_COMPONENT_PREVIEW]); ++ ++ disable_camera(dev); ++ return ret; ++ } ++ ++ /* set preview port format and connect it to output */ ++ dst = &dev->component[MMAL_COMPONENT_PREVIEW]->input[0]; ++ ++ ret = vchiq_mmal_port_set_format(dev->instance, src); ++ if (ret < 0) ++ goto error; ++ ++ ret = set_overlay_params(dev, dst); ++ if (ret < 0) ++ goto error; ++ ++ if (enable_camera(dev) < 0) ++ goto error; ++ ++ ret = vchiq_mmal_component_enable( ++ dev->instance, ++ dev->component[MMAL_COMPONENT_PREVIEW]); ++ if (ret < 0) ++ goto error; ++ ++ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, "connecting %p to %p\n", ++ src, dst); ++ ret = vchiq_mmal_port_connect_tunnel(dev->instance, src, dst); ++ if (!ret) ++ ret = vchiq_mmal_port_enable(dev->instance, src, NULL); ++error: ++ return ret; ++} ++ ++static int vidioc_g_fbuf(struct file *file, void *fh, ++ struct v4l2_framebuffer *a) ++{ ++ /* The video overlay must stay within the framebuffer and can't be ++ positioned independently. */ ++ struct bm2835_mmal_dev *dev = video_drvdata(file); ++ struct vchiq_mmal_port *preview_port = ++ &dev->component[MMAL_COMPONENT_CAMERA]-> ++ output[MMAL_CAMERA_PORT_PREVIEW]; ++ ++ a->capability = V4L2_FBUF_CAP_EXTERNOVERLAY | ++ V4L2_FBUF_CAP_GLOBAL_ALPHA; ++ a->flags = V4L2_FBUF_FLAG_OVERLAY; ++ a->fmt.width = preview_port->es.video.width; ++ a->fmt.height = preview_port->es.video.height; ++ a->fmt.pixelformat = V4L2_PIX_FMT_YUV420; ++ a->fmt.bytesperline = preview_port->es.video.width; ++ a->fmt.sizeimage = (preview_port->es.video.width * ++ preview_port->es.video.height * 3)>>1; ++ a->fmt.colorspace = V4L2_COLORSPACE_SMPTE170M; ++ ++ return 0; ++} ++ ++/* input ioctls */ ++static int vidioc_enum_input(struct file *file, void *priv, ++ struct v4l2_input *inp) ++{ ++ /* only a single camera input */ ++ if (inp->index != 0) ++ return -EINVAL; ++ ++ inp->type = V4L2_INPUT_TYPE_CAMERA; ++ sprintf(inp->name, "Camera %u", inp->index); ++ return 0; ++} ++ ++static int vidioc_g_input(struct file *file, void *priv, unsigned int *i) ++{ ++ *i = 0; ++ return 0; ++} ++ ++static int vidioc_s_input(struct file *file, void *priv, unsigned int i) ++{ ++ if (i != 0) ++ return -EINVAL; ++ ++ return 0; ++} ++ ++/* capture ioctls */ ++static int vidioc_querycap(struct file *file, void *priv, ++ struct v4l2_capability *cap) ++{ ++ struct bm2835_mmal_dev *dev = video_drvdata(file); ++ u32 major; ++ u32 minor; ++ ++ vchiq_mmal_version(dev->instance, &major, &minor); ++ ++ strcpy(cap->driver, "bm2835 mmal"); ++ snprintf(cap->card, sizeof(cap->card), "mmal service %d.%d", ++ major, minor); ++ ++ snprintf(cap->bus_info, sizeof(cap->bus_info), ++ "platform:%s", dev->v4l2_dev.name); ++ cap->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_VIDEO_OVERLAY | ++ V4L2_CAP_STREAMING | V4L2_CAP_READWRITE; ++ cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS; ++ ++ return 0; ++} ++ ++static int vidioc_enum_fmt_vid_cap(struct file *file, void *priv, ++ struct v4l2_fmtdesc *f) ++{ ++ struct mmal_fmt *fmt; ++ ++ if (f->index >= ARRAY_SIZE(formats)) ++ return -EINVAL; ++ ++ fmt = &formats[f->index]; ++ ++ strlcpy(f->description, fmt->name, sizeof(f->description)); ++ f->pixelformat = fmt->fourcc; ++ f->flags = fmt->flags; ++ ++ return 0; ++} ++ ++static int vidioc_g_fmt_vid_cap(struct file *file, void *priv, ++ struct v4l2_format *f) ++{ ++ struct bm2835_mmal_dev *dev = video_drvdata(file); ++ ++ f->fmt.pix.width = dev->capture.width; ++ f->fmt.pix.height = dev->capture.height; ++ f->fmt.pix.field = V4L2_FIELD_NONE; ++ f->fmt.pix.pixelformat = dev->capture.fmt->fourcc; ++ f->fmt.pix.bytesperline = dev->capture.stride; ++ f->fmt.pix.sizeimage = dev->capture.buffersize; ++ ++ if (dev->capture.fmt->fourcc == V4L2_PIX_FMT_RGB24) ++ f->fmt.pix.colorspace = V4L2_COLORSPACE_SRGB; ++ else if (dev->capture.fmt->fourcc == V4L2_PIX_FMT_JPEG) ++ f->fmt.pix.colorspace = V4L2_COLORSPACE_JPEG; ++ else ++ f->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M; ++ f->fmt.pix.priv = 0; ++ ++ v4l2_dump_pix_format(1, bcm2835_v4l2_debug, &dev->v4l2_dev, &f->fmt.pix, ++ __func__); ++ return 0; ++} ++ ++static int vidioc_try_fmt_vid_cap(struct file *file, void *priv, ++ struct v4l2_format *f) ++{ ++ struct bm2835_mmal_dev *dev = video_drvdata(file); ++ struct mmal_fmt *mfmt; ++ ++ mfmt = get_format(f); ++ if (!mfmt) { ++ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, ++ "Fourcc format (0x%08x) unknown.\n", ++ f->fmt.pix.pixelformat); ++ f->fmt.pix.pixelformat = formats[0].fourcc; ++ mfmt = get_format(f); ++ } ++ ++ f->fmt.pix.field = V4L2_FIELD_NONE; ++ ++ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, ++ "Clipping/aligning %dx%d format %08X\n", ++ f->fmt.pix.width, f->fmt.pix.height, f->fmt.pix.pixelformat); ++ ++ v4l_bound_align_image(&f->fmt.pix.width, MIN_WIDTH, dev->max_width, 1, ++ &f->fmt.pix.height, MIN_HEIGHT, dev->max_height, ++ 1, 0); ++ f->fmt.pix.bytesperline = f->fmt.pix.width * mfmt->ybbp; ++ ++ /* Image buffer has to be padded to allow for alignment, even though ++ * we then remove that padding before delivering the buffer. ++ */ ++ f->fmt.pix.sizeimage = ((f->fmt.pix.height+15)&~15) * ++ (((f->fmt.pix.width+31)&~31) * mfmt->depth) >> 3; ++ ++ if ((mfmt->flags & V4L2_FMT_FLAG_COMPRESSED) && ++ f->fmt.pix.sizeimage < MIN_BUFFER_SIZE) ++ f->fmt.pix.sizeimage = MIN_BUFFER_SIZE; ++ ++ if (f->fmt.pix.pixelformat == V4L2_PIX_FMT_RGB24) ++ f->fmt.pix.colorspace = V4L2_COLORSPACE_SRGB; ++ else if (f->fmt.pix.pixelformat == V4L2_PIX_FMT_JPEG) ++ f->fmt.pix.colorspace = V4L2_COLORSPACE_JPEG; ++ else ++ f->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M; ++ f->fmt.pix.priv = 0; ++ ++ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, ++ "Now %dx%d format %08X\n", ++ f->fmt.pix.width, f->fmt.pix.height, f->fmt.pix.pixelformat); ++ ++ v4l2_dump_pix_format(1, bcm2835_v4l2_debug, &dev->v4l2_dev, &f->fmt.pix, ++ __func__); ++ return 0; ++} ++ ++static int mmal_setup_components(struct bm2835_mmal_dev *dev, ++ struct v4l2_format *f) ++{ ++ int ret; ++ struct vchiq_mmal_port *port = NULL, *camera_port = NULL; ++ struct vchiq_mmal_component *encode_component = NULL; ++ struct mmal_fmt *mfmt = get_format(f); ++ ++ BUG_ON(!mfmt); ++ ++ if (dev->capture.encode_component) { ++ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, ++ "vid_cap - disconnect previous tunnel\n"); ++ ++ /* Disconnect any previous connection */ ++ vchiq_mmal_port_connect_tunnel(dev->instance, ++ dev->capture.camera_port, NULL); ++ dev->capture.camera_port = NULL; ++ ret = vchiq_mmal_component_disable(dev->instance, ++ dev->capture. ++ encode_component); ++ if (ret) ++ v4l2_err(&dev->v4l2_dev, ++ "Failed to disable encode component %d\n", ++ ret); ++ ++ dev->capture.encode_component = NULL; ++ } ++ /* format dependant port setup */ ++ switch (mfmt->mmal_component) { ++ case MMAL_COMPONENT_CAMERA: ++ /* Make a further decision on port based on resolution */ ++ if (f->fmt.pix.width <= max_video_width ++ && f->fmt.pix.height <= max_video_height) ++ camera_port = port = ++ &dev->component[MMAL_COMPONENT_CAMERA]-> ++ output[MMAL_CAMERA_PORT_VIDEO]; ++ else ++ camera_port = port = ++ &dev->component[MMAL_COMPONENT_CAMERA]-> ++ output[MMAL_CAMERA_PORT_CAPTURE]; ++ break; ++ case MMAL_COMPONENT_IMAGE_ENCODE: ++ encode_component = dev->component[MMAL_COMPONENT_IMAGE_ENCODE]; ++ port = &dev->component[MMAL_COMPONENT_IMAGE_ENCODE]->output[0]; ++ camera_port = ++ &dev->component[MMAL_COMPONENT_CAMERA]-> ++ output[MMAL_CAMERA_PORT_CAPTURE]; ++ break; ++ case MMAL_COMPONENT_VIDEO_ENCODE: ++ encode_component = dev->component[MMAL_COMPONENT_VIDEO_ENCODE]; ++ port = &dev->component[MMAL_COMPONENT_VIDEO_ENCODE]->output[0]; ++ camera_port = ++ &dev->component[MMAL_COMPONENT_CAMERA]-> ++ output[MMAL_CAMERA_PORT_VIDEO]; ++ break; ++ default: ++ break; ++ } ++ ++ if (!port) ++ return -EINVAL; ++ ++ if (encode_component) ++ camera_port->format.encoding = MMAL_ENCODING_OPAQUE; ++ else ++ camera_port->format.encoding = mfmt->mmal; ++ ++ camera_port->format.encoding_variant = 0; ++ camera_port->es.video.width = f->fmt.pix.width; ++ camera_port->es.video.height = f->fmt.pix.height; ++ camera_port->es.video.crop.x = 0; ++ camera_port->es.video.crop.y = 0; ++ camera_port->es.video.crop.width = f->fmt.pix.width; ++ camera_port->es.video.crop.height = f->fmt.pix.height; ++ camera_port->es.video.frame_rate.num = 0; ++ camera_port->es.video.frame_rate.den = 1; ++ camera_port->es.video.color_space = MMAL_COLOR_SPACE_JPEG_JFIF; ++ ++ ret = vchiq_mmal_port_set_format(dev->instance, camera_port); ++ ++ if (!ret ++ && camera_port == ++ &dev->component[MMAL_COMPONENT_CAMERA]-> ++ output[MMAL_CAMERA_PORT_VIDEO]) { ++ bool overlay_enabled = ++ !!dev->component[MMAL_COMPONENT_PREVIEW]->enabled; ++ struct vchiq_mmal_port *preview_port = ++ &dev->component[MMAL_COMPONENT_CAMERA]-> ++ output[MMAL_CAMERA_PORT_PREVIEW]; ++ /* Preview and encode ports need to match on resolution */ ++ if (overlay_enabled) { ++ /* Need to disable the overlay before we can update ++ * the resolution ++ */ ++ ret = ++ vchiq_mmal_port_disable(dev->instance, ++ preview_port); ++ if (!ret) ++ ret = ++ vchiq_mmal_port_connect_tunnel( ++ dev->instance, ++ preview_port, ++ NULL); ++ } ++ preview_port->es.video.width = f->fmt.pix.width; ++ preview_port->es.video.height = f->fmt.pix.height; ++ preview_port->es.video.crop.x = 0; ++ preview_port->es.video.crop.y = 0; ++ preview_port->es.video.crop.width = f->fmt.pix.width; ++ preview_port->es.video.crop.height = f->fmt.pix.height; ++ preview_port->es.video.frame_rate.num = ++ dev->capture.timeperframe.denominator; ++ preview_port->es.video.frame_rate.den = ++ dev->capture.timeperframe.numerator; ++ ret = vchiq_mmal_port_set_format(dev->instance, preview_port); ++ if (overlay_enabled) { ++ ret = vchiq_mmal_port_connect_tunnel( ++ dev->instance, ++ preview_port, ++ &dev->component[MMAL_COMPONENT_PREVIEW]->input[0]); ++ if (!ret) ++ ret = vchiq_mmal_port_enable(dev->instance, ++ preview_port, ++ NULL); ++ } ++ } ++ ++ if (ret) { ++ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, ++ "%s failed to set format %dx%d %08X\n", __func__, ++ f->fmt.pix.width, f->fmt.pix.height, ++ f->fmt.pix.pixelformat); ++ /* ensure capture is not going to be tried */ ++ dev->capture.port = NULL; ++ } else { ++ if (encode_component) { ++ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, ++ "vid_cap - set up encode comp\n"); ++ ++ /* configure buffering */ ++ camera_port->current_buffer.size = ++ camera_port->recommended_buffer.size; ++ camera_port->current_buffer.num = ++ camera_port->recommended_buffer.num; ++ ++ ret = ++ vchiq_mmal_port_connect_tunnel( ++ dev->instance, ++ camera_port, ++ &encode_component->input[0]); ++ if (ret) { ++ v4l2_dbg(1, bcm2835_v4l2_debug, ++ &dev->v4l2_dev, ++ "%s failed to create connection\n", ++ __func__); ++ /* ensure capture is not going to be tried */ ++ dev->capture.port = NULL; ++ } else { ++ port->es.video.width = f->fmt.pix.width; ++ port->es.video.height = f->fmt.pix.height; ++ port->es.video.crop.x = 0; ++ port->es.video.crop.y = 0; ++ port->es.video.crop.width = f->fmt.pix.width; ++ port->es.video.crop.height = f->fmt.pix.height; ++ port->es.video.frame_rate.num = ++ dev->capture.timeperframe.denominator; ++ port->es.video.frame_rate.den = ++ dev->capture.timeperframe.numerator; ++ ++ port->format.encoding = mfmt->mmal; ++ port->format.encoding_variant = 0; ++ /* Set any encoding specific parameters */ ++ switch (mfmt->mmal_component) { ++ case MMAL_COMPONENT_VIDEO_ENCODE: ++ port->format.bitrate = ++ dev->capture.encode_bitrate; ++ break; ++ case MMAL_COMPONENT_IMAGE_ENCODE: ++ /* Could set EXIF parameters here */ ++ break; ++ default: ++ break; ++ } ++ ret = vchiq_mmal_port_set_format(dev->instance, ++ port); ++ if (ret) ++ v4l2_dbg(1, bcm2835_v4l2_debug, ++ &dev->v4l2_dev, ++ "%s failed to set format %dx%d fmt %08X\n", ++ __func__, ++ f->fmt.pix.width, ++ f->fmt.pix.height, ++ f->fmt.pix.pixelformat ++ ); ++ } ++ ++ if (!ret) { ++ ret = vchiq_mmal_component_enable( ++ dev->instance, ++ encode_component); ++ if (ret) { ++ v4l2_dbg(1, bcm2835_v4l2_debug, ++ &dev->v4l2_dev, ++ "%s Failed to enable encode components\n", ++ __func__); ++ } ++ } ++ if (!ret) { ++ /* configure buffering */ ++ port->current_buffer.num = 1; ++ port->current_buffer.size = ++ f->fmt.pix.sizeimage; ++ if (port->format.encoding == ++ MMAL_ENCODING_JPEG) { ++ v4l2_dbg(1, bcm2835_v4l2_debug, ++ &dev->v4l2_dev, ++ "JPG - buf size now %d was %d\n", ++ f->fmt.pix.sizeimage, ++ port->current_buffer.size); ++ port->current_buffer.size = ++ (f->fmt.pix.sizeimage < ++ (100 << 10)) ++ ? (100 << 10) : f->fmt.pix. ++ sizeimage; ++ } ++ v4l2_dbg(1, bcm2835_v4l2_debug, ++ &dev->v4l2_dev, ++ "vid_cap - cur_buf.size set to %d\n", ++ f->fmt.pix.sizeimage); ++ port->current_buffer.alignment = 0; ++ } ++ } else { ++ /* configure buffering */ ++ camera_port->current_buffer.num = 1; ++ camera_port->current_buffer.size = f->fmt.pix.sizeimage; ++ camera_port->current_buffer.alignment = 0; ++ } ++ ++ if (!ret) { ++ dev->capture.fmt = mfmt; ++ dev->capture.stride = f->fmt.pix.bytesperline; ++ dev->capture.width = camera_port->es.video.crop.width; ++ dev->capture.height = camera_port->es.video.crop.height; ++ dev->capture.buffersize = port->current_buffer.size; ++ ++ /* select port for capture */ ++ dev->capture.port = port; ++ dev->capture.camera_port = camera_port; ++ dev->capture.encode_component = encode_component; ++ v4l2_dbg(1, bcm2835_v4l2_debug, ++ &dev->v4l2_dev, ++ "Set dev->capture.fmt %08X, %dx%d, stride %d, size %d", ++ port->format.encoding, ++ dev->capture.width, dev->capture.height, ++ dev->capture.stride, dev->capture.buffersize); ++ } ++ } ++ ++ /* todo: Need to convert the vchiq/mmal error into a v4l2 error. */ ++ return ret; ++} ++ ++static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, ++ struct v4l2_format *f) ++{ ++ int ret; ++ struct bm2835_mmal_dev *dev = video_drvdata(file); ++ struct mmal_fmt *mfmt; ++ ++ /* try the format to set valid parameters */ ++ ret = vidioc_try_fmt_vid_cap(file, priv, f); ++ if (ret) { ++ v4l2_err(&dev->v4l2_dev, ++ "vid_cap - vidioc_try_fmt_vid_cap failed\n"); ++ return ret; ++ } ++ ++ /* if a capture is running refuse to set format */ ++ if (vb2_is_busy(&dev->capture.vb_vidq)) { ++ v4l2_info(&dev->v4l2_dev, "%s device busy\n", __func__); ++ return -EBUSY; ++ } ++ ++ /* If the format is unsupported v4l2 says we should switch to ++ * a supported one and not return an error. */ ++ mfmt = get_format(f); ++ if (!mfmt) { ++ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, ++ "Fourcc format (0x%08x) unknown.\n", ++ f->fmt.pix.pixelformat); ++ f->fmt.pix.pixelformat = formats[0].fourcc; ++ mfmt = get_format(f); ++ } ++ ++ ret = mmal_setup_components(dev, f); ++ if (ret != 0) { ++ v4l2_err(&dev->v4l2_dev, ++ "%s: failed to setup mmal components: %d\n", ++ __func__, ret); ++ ret = -EINVAL; ++ } ++ ++ return ret; ++} ++ ++int vidioc_enum_framesizes(struct file *file, void *fh, ++ struct v4l2_frmsizeenum *fsize) ++{ ++ struct bm2835_mmal_dev *dev = video_drvdata(file); ++ static const struct v4l2_frmsize_stepwise sizes = { ++ MIN_WIDTH, 0, 2, ++ MIN_HEIGHT, 0, 2 ++ }; ++ int i; ++ ++ if (fsize->index) ++ return -EINVAL; ++ for (i = 0; i < ARRAY_SIZE(formats); i++) ++ if (formats[i].fourcc == fsize->pixel_format) ++ break; ++ if (i == ARRAY_SIZE(formats)) ++ return -EINVAL; ++ fsize->type = V4L2_FRMSIZE_TYPE_STEPWISE; ++ fsize->stepwise = sizes; ++ fsize->stepwise.max_width = dev->max_width; ++ fsize->stepwise.max_height = dev->max_height; ++ return 0; ++} ++ ++/* timeperframe is arbitrary and continous */ ++static int vidioc_enum_frameintervals(struct file *file, void *priv, ++ struct v4l2_frmivalenum *fival) ++{ ++ struct bm2835_mmal_dev *dev = video_drvdata(file); ++ int i; ++ ++ if (fival->index) ++ return -EINVAL; ++ ++ for (i = 0; i < ARRAY_SIZE(formats); i++) ++ if (formats[i].fourcc == fival->pixel_format) ++ break; ++ if (i == ARRAY_SIZE(formats)) ++ return -EINVAL; ++ ++ /* regarding width & height - we support any within range */ ++ if (fival->width < MIN_WIDTH || fival->width > dev->max_width || ++ fival->height < MIN_HEIGHT || fival->height > dev->max_height) ++ return -EINVAL; ++ ++ fival->type = V4L2_FRMIVAL_TYPE_CONTINUOUS; ++ ++ /* fill in stepwise (step=1.0 is requred by V4L2 spec) */ ++ fival->stepwise.min = tpf_min; ++ fival->stepwise.max = tpf_max; ++ fival->stepwise.step = (struct v4l2_fract) {1, 1}; ++ ++ return 0; ++} ++ ++static int vidioc_g_parm(struct file *file, void *priv, ++ struct v4l2_streamparm *parm) ++{ ++ struct bm2835_mmal_dev *dev = video_drvdata(file); ++ ++ if (parm->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) ++ return -EINVAL; ++ ++ parm->parm.capture.capability = V4L2_CAP_TIMEPERFRAME; ++ parm->parm.capture.timeperframe = dev->capture.timeperframe; ++ parm->parm.capture.readbuffers = 1; ++ return 0; ++} ++ ++#define FRACT_CMP(a, OP, b) \ ++ ((u64)(a).numerator * (b).denominator OP \ ++ (u64)(b).numerator * (a).denominator) ++ ++static int vidioc_s_parm(struct file *file, void *priv, ++ struct v4l2_streamparm *parm) ++{ ++ struct bm2835_mmal_dev *dev = video_drvdata(file); ++ struct v4l2_fract tpf; ++ struct mmal_parameter_rational fps_param; ++ ++ if (parm->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) ++ return -EINVAL; ++ ++ tpf = parm->parm.capture.timeperframe; ++ ++ /* tpf: {*, 0} resets timing; clip to [min, max]*/ ++ tpf = tpf.denominator ? tpf : tpf_default; ++ tpf = FRACT_CMP(tpf, <, tpf_min) ? tpf_min : tpf; ++ tpf = FRACT_CMP(tpf, >, tpf_max) ? tpf_max : tpf; ++ ++ dev->capture.timeperframe = tpf; ++ parm->parm.capture.timeperframe = tpf; ++ parm->parm.capture.readbuffers = 1; ++ ++ fps_param.num = 0; /* Select variable fps, and then use ++ * FPS_RANGE to select the actual limits. ++ */ ++ fps_param.den = 1; ++ set_framerate_params(dev); ++ ++ return 0; ++} ++ ++static const struct v4l2_ioctl_ops camera0_ioctl_ops = { ++ /* overlay */ ++ .vidioc_enum_fmt_vid_overlay = vidioc_enum_fmt_vid_overlay, ++ .vidioc_g_fmt_vid_overlay = vidioc_g_fmt_vid_overlay, ++ .vidioc_try_fmt_vid_overlay = vidioc_try_fmt_vid_overlay, ++ .vidioc_s_fmt_vid_overlay = vidioc_s_fmt_vid_overlay, ++ .vidioc_overlay = vidioc_overlay, ++ .vidioc_g_fbuf = vidioc_g_fbuf, ++ ++ /* inputs */ ++ .vidioc_enum_input = vidioc_enum_input, ++ .vidioc_g_input = vidioc_g_input, ++ .vidioc_s_input = vidioc_s_input, ++ ++ /* capture */ ++ .vidioc_querycap = vidioc_querycap, ++ .vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap, ++ .vidioc_g_fmt_vid_cap = vidioc_g_fmt_vid_cap, ++ .vidioc_try_fmt_vid_cap = vidioc_try_fmt_vid_cap, ++ .vidioc_s_fmt_vid_cap = vidioc_s_fmt_vid_cap, ++ ++ /* buffer management */ ++ .vidioc_reqbufs = vb2_ioctl_reqbufs, ++ .vidioc_create_bufs = vb2_ioctl_create_bufs, ++ .vidioc_prepare_buf = vb2_ioctl_prepare_buf, ++ .vidioc_querybuf = vb2_ioctl_querybuf, ++ .vidioc_qbuf = vb2_ioctl_qbuf, ++ .vidioc_dqbuf = vb2_ioctl_dqbuf, ++ .vidioc_enum_framesizes = vidioc_enum_framesizes, ++ .vidioc_enum_frameintervals = vidioc_enum_frameintervals, ++ .vidioc_g_parm = vidioc_g_parm, ++ .vidioc_s_parm = vidioc_s_parm, ++ .vidioc_streamon = vb2_ioctl_streamon, ++ .vidioc_streamoff = vb2_ioctl_streamoff, ++ ++ .vidioc_log_status = v4l2_ctrl_log_status, ++ .vidioc_subscribe_event = v4l2_ctrl_subscribe_event, ++ .vidioc_unsubscribe_event = v4l2_event_unsubscribe, ++}; ++ ++static const struct v4l2_ioctl_ops camera0_ioctl_ops_gstreamer = { ++ /* overlay */ ++ .vidioc_enum_fmt_vid_overlay = vidioc_enum_fmt_vid_overlay, ++ .vidioc_g_fmt_vid_overlay = vidioc_g_fmt_vid_overlay, ++ .vidioc_try_fmt_vid_overlay = vidioc_try_fmt_vid_overlay, ++ .vidioc_s_fmt_vid_overlay = vidioc_s_fmt_vid_overlay, ++ .vidioc_overlay = vidioc_overlay, ++ .vidioc_g_fbuf = vidioc_g_fbuf, ++ ++ /* inputs */ ++ .vidioc_enum_input = vidioc_enum_input, ++ .vidioc_g_input = vidioc_g_input, ++ .vidioc_s_input = vidioc_s_input, ++ ++ /* capture */ ++ .vidioc_querycap = vidioc_querycap, ++ .vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap, ++ .vidioc_g_fmt_vid_cap = vidioc_g_fmt_vid_cap, ++ .vidioc_try_fmt_vid_cap = vidioc_try_fmt_vid_cap, ++ .vidioc_s_fmt_vid_cap = vidioc_s_fmt_vid_cap, ++ ++ /* buffer management */ ++ .vidioc_reqbufs = vb2_ioctl_reqbufs, ++ .vidioc_create_bufs = vb2_ioctl_create_bufs, ++ .vidioc_prepare_buf = vb2_ioctl_prepare_buf, ++ .vidioc_querybuf = vb2_ioctl_querybuf, ++ .vidioc_qbuf = vb2_ioctl_qbuf, ++ .vidioc_dqbuf = vb2_ioctl_dqbuf, ++ /* Remove this function ptr to fix gstreamer bug ++ .vidioc_enum_framesizes = vidioc_enum_framesizes, */ ++ .vidioc_enum_frameintervals = vidioc_enum_frameintervals, ++ .vidioc_g_parm = vidioc_g_parm, ++ .vidioc_s_parm = vidioc_s_parm, ++ .vidioc_streamon = vb2_ioctl_streamon, ++ .vidioc_streamoff = vb2_ioctl_streamoff, ++ ++ .vidioc_log_status = v4l2_ctrl_log_status, ++ .vidioc_subscribe_event = v4l2_ctrl_subscribe_event, ++ .vidioc_unsubscribe_event = v4l2_event_unsubscribe, ++}; ++ ++/* ------------------------------------------------------------------ ++ Driver init/finalise ++ ------------------------------------------------------------------*/ ++ ++static const struct v4l2_file_operations camera0_fops = { ++ .owner = THIS_MODULE, ++ .open = v4l2_fh_open, ++ .release = vb2_fop_release, ++ .read = vb2_fop_read, ++ .poll = vb2_fop_poll, ++ .unlocked_ioctl = video_ioctl2, /* V4L2 ioctl handler */ ++ .mmap = vb2_fop_mmap, ++}; ++ ++static struct video_device vdev_template = { ++ .name = "camera0", ++ .fops = &camera0_fops, ++ .ioctl_ops = &camera0_ioctl_ops, ++ .release = video_device_release_empty, ++}; ++ ++/* Returns the number of cameras, and also the max resolution supported ++ * by those cameras. ++ */ ++static int get_num_cameras(struct vchiq_mmal_instance *instance, ++ unsigned int resolutions[][2], int num_resolutions) ++{ ++ int ret; ++ struct vchiq_mmal_component *cam_info_component; ++ struct mmal_parameter_camera_info_t cam_info = {0}; ++ int param_size = sizeof(cam_info); ++ int i; ++ ++ /* create a camera_info component */ ++ ret = vchiq_mmal_component_init(instance, "camera_info", ++ &cam_info_component); ++ if (ret < 0) ++ /* Unusual failure - let's guess one camera. */ ++ return 1; ++ ++ if (vchiq_mmal_port_parameter_get(instance, ++ &cam_info_component->control, ++ MMAL_PARAMETER_CAMERA_INFO, ++ &cam_info, ++ &param_size)) { ++ pr_info("Failed to get camera info\n"); ++ } ++ for (i = 0; ++ i < (cam_info.num_cameras > num_resolutions ? ++ num_resolutions : ++ cam_info.num_cameras); ++ i++) { ++ resolutions[i][0] = cam_info.cameras[i].max_width; ++ resolutions[i][1] = cam_info.cameras[i].max_height; ++ } ++ ++ vchiq_mmal_component_finalise(instance, ++ cam_info_component); ++ ++ return cam_info.num_cameras; ++} ++ ++static int set_camera_parameters(struct vchiq_mmal_instance *instance, ++ struct vchiq_mmal_component *camera, ++ struct bm2835_mmal_dev *dev) ++{ ++ int ret; ++ struct mmal_parameter_camera_config cam_config = { ++ .max_stills_w = dev->max_width, ++ .max_stills_h = dev->max_height, ++ .stills_yuv422 = 1, ++ .one_shot_stills = 1, ++ .max_preview_video_w = (max_video_width > 1920) ? ++ max_video_width : 1920, ++ .max_preview_video_h = (max_video_height > 1088) ? ++ max_video_height : 1088, ++ .num_preview_video_frames = 3, ++ .stills_capture_circular_buffer_height = 0, ++ .fast_preview_resume = 0, ++ .use_stc_timestamp = MMAL_PARAM_TIMESTAMP_MODE_RAW_STC ++ }; ++ ++ ret = vchiq_mmal_port_parameter_set(instance, &camera->control, ++ MMAL_PARAMETER_CAMERA_CONFIG, ++ &cam_config, sizeof(cam_config)); ++ return ret; ++} ++ ++/* MMAL instance and component init */ ++static int __init mmal_init(struct bm2835_mmal_dev *dev) ++{ ++ int ret; ++ struct mmal_es_format *format; ++ u32 bool_true = 1; ++ ++ ret = vchiq_mmal_init(&dev->instance); ++ if (ret < 0) ++ return ret; ++ ++ /* get the camera component ready */ ++ ret = vchiq_mmal_component_init(dev->instance, "ril.camera", ++ &dev->component[MMAL_COMPONENT_CAMERA]); ++ if (ret < 0) ++ goto unreg_mmal; ++ ++ if (dev->component[MMAL_COMPONENT_CAMERA]->outputs < ++ MMAL_CAMERA_PORT_COUNT) { ++ ret = -EINVAL; ++ goto unreg_camera; ++ } ++ ++ ret = set_camera_parameters(dev->instance, ++ dev->component[MMAL_COMPONENT_CAMERA], ++ dev); ++ if (ret < 0) ++ goto unreg_camera; ++ ++ format = ++ &dev->component[MMAL_COMPONENT_CAMERA]-> ++ output[MMAL_CAMERA_PORT_PREVIEW].format; ++ ++ format->encoding = MMAL_ENCODING_OPAQUE; ++ format->encoding_variant = MMAL_ENCODING_I420; ++ ++ format->es->video.width = 1024; ++ format->es->video.height = 768; ++ format->es->video.crop.x = 0; ++ format->es->video.crop.y = 0; ++ format->es->video.crop.width = 1024; ++ format->es->video.crop.height = 768; ++ format->es->video.frame_rate.num = 0; /* Rely on fps_range */ ++ format->es->video.frame_rate.den = 1; ++ ++ format = ++ &dev->component[MMAL_COMPONENT_CAMERA]-> ++ output[MMAL_CAMERA_PORT_VIDEO].format; ++ ++ format->encoding = MMAL_ENCODING_OPAQUE; ++ format->encoding_variant = MMAL_ENCODING_I420; ++ ++ format->es->video.width = 1024; ++ format->es->video.height = 768; ++ format->es->video.crop.x = 0; ++ format->es->video.crop.y = 0; ++ format->es->video.crop.width = 1024; ++ format->es->video.crop.height = 768; ++ format->es->video.frame_rate.num = 0; /* Rely on fps_range */ ++ format->es->video.frame_rate.den = 1; ++ ++ vchiq_mmal_port_parameter_set(dev->instance, ++ &dev->component[MMAL_COMPONENT_CAMERA]-> ++ output[MMAL_CAMERA_PORT_VIDEO], ++ MMAL_PARAMETER_NO_IMAGE_PADDING, ++ &bool_true, sizeof(bool_true)); ++ ++ format = ++ &dev->component[MMAL_COMPONENT_CAMERA]-> ++ output[MMAL_CAMERA_PORT_CAPTURE].format; ++ ++ format->encoding = MMAL_ENCODING_OPAQUE; ++ ++ format->es->video.width = 2592; ++ format->es->video.height = 1944; ++ format->es->video.crop.x = 0; ++ format->es->video.crop.y = 0; ++ format->es->video.crop.width = 2592; ++ format->es->video.crop.height = 1944; ++ format->es->video.frame_rate.num = 0; /* Rely on fps_range */ ++ format->es->video.frame_rate.den = 1; ++ ++ dev->capture.width = format->es->video.width; ++ dev->capture.height = format->es->video.height; ++ dev->capture.fmt = &formats[0]; ++ dev->capture.encode_component = NULL; ++ dev->capture.timeperframe = tpf_default; ++ dev->capture.enc_profile = V4L2_MPEG_VIDEO_H264_PROFILE_HIGH; ++ dev->capture.enc_level = V4L2_MPEG_VIDEO_H264_LEVEL_4_0; ++ ++ vchiq_mmal_port_parameter_set(dev->instance, ++ &dev->component[MMAL_COMPONENT_CAMERA]-> ++ output[MMAL_CAMERA_PORT_CAPTURE], ++ MMAL_PARAMETER_NO_IMAGE_PADDING, ++ &bool_true, sizeof(bool_true)); ++ ++ /* get the preview component ready */ ++ ret = vchiq_mmal_component_init( ++ dev->instance, "ril.video_render", ++ &dev->component[MMAL_COMPONENT_PREVIEW]); ++ if (ret < 0) ++ goto unreg_camera; ++ ++ if (dev->component[MMAL_COMPONENT_PREVIEW]->inputs < 1) { ++ ret = -EINVAL; ++ pr_debug("too few input ports %d needed %d\n", ++ dev->component[MMAL_COMPONENT_PREVIEW]->inputs, 1); ++ goto unreg_preview; ++ } ++ ++ /* get the image encoder component ready */ ++ ret = vchiq_mmal_component_init( ++ dev->instance, "ril.image_encode", ++ &dev->component[MMAL_COMPONENT_IMAGE_ENCODE]); ++ if (ret < 0) ++ goto unreg_preview; ++ ++ if (dev->component[MMAL_COMPONENT_IMAGE_ENCODE]->inputs < 1) { ++ ret = -EINVAL; ++ v4l2_err(&dev->v4l2_dev, "too few input ports %d needed %d\n", ++ dev->component[MMAL_COMPONENT_IMAGE_ENCODE]->inputs, ++ 1); ++ goto unreg_image_encoder; ++ } ++ ++ /* get the video encoder component ready */ ++ ret = vchiq_mmal_component_init(dev->instance, "ril.video_encode", ++ &dev-> ++ component[MMAL_COMPONENT_VIDEO_ENCODE]); ++ if (ret < 0) ++ goto unreg_image_encoder; ++ ++ if (dev->component[MMAL_COMPONENT_VIDEO_ENCODE]->inputs < 1) { ++ ret = -EINVAL; ++ v4l2_err(&dev->v4l2_dev, "too few input ports %d needed %d\n", ++ dev->component[MMAL_COMPONENT_VIDEO_ENCODE]->inputs, ++ 1); ++ goto unreg_vid_encoder; ++ } ++ ++ { ++ struct vchiq_mmal_port *encoder_port = ++ &dev->component[MMAL_COMPONENT_VIDEO_ENCODE]->output[0]; ++ encoder_port->format.encoding = MMAL_ENCODING_H264; ++ ret = vchiq_mmal_port_set_format(dev->instance, ++ encoder_port); ++ } ++ ++ { ++ unsigned int enable = 1; ++ vchiq_mmal_port_parameter_set( ++ dev->instance, ++ &dev->component[MMAL_COMPONENT_VIDEO_ENCODE]->control, ++ MMAL_PARAMETER_VIDEO_IMMUTABLE_INPUT, ++ &enable, sizeof(enable)); ++ ++ vchiq_mmal_port_parameter_set(dev->instance, ++ &dev->component[MMAL_COMPONENT_VIDEO_ENCODE]->control, ++ MMAL_PARAMETER_MINIMISE_FRAGMENTATION, ++ &enable, ++ sizeof(enable)); ++ } ++ ret = bm2835_mmal_set_all_camera_controls(dev); ++ if (ret < 0) ++ goto unreg_vid_encoder; ++ ++ return 0; ++ ++unreg_vid_encoder: ++ pr_err("Cleanup: Destroy video encoder\n"); ++ vchiq_mmal_component_finalise( ++ dev->instance, ++ dev->component[MMAL_COMPONENT_VIDEO_ENCODE]); ++ ++unreg_image_encoder: ++ pr_err("Cleanup: Destroy image encoder\n"); ++ vchiq_mmal_component_finalise( ++ dev->instance, ++ dev->component[MMAL_COMPONENT_IMAGE_ENCODE]); ++ ++unreg_preview: ++ pr_err("Cleanup: Destroy video render\n"); ++ vchiq_mmal_component_finalise(dev->instance, ++ dev->component[MMAL_COMPONENT_PREVIEW]); ++ ++unreg_camera: ++ pr_err("Cleanup: Destroy camera\n"); ++ vchiq_mmal_component_finalise(dev->instance, ++ dev->component[MMAL_COMPONENT_CAMERA]); ++ ++unreg_mmal: ++ vchiq_mmal_finalise(dev->instance); ++ return ret; ++} ++ ++static int __init bm2835_mmal_init_device(struct bm2835_mmal_dev *dev, ++ struct video_device *vfd) ++{ ++ int ret; ++ ++ *vfd = vdev_template; ++ if (gst_v4l2src_is_broken) { ++ v4l2_info(&dev->v4l2_dev, ++ "Work-around for gstreamer issue is active.\n"); ++ vfd->ioctl_ops = &camera0_ioctl_ops_gstreamer; ++ } ++ ++ vfd->v4l2_dev = &dev->v4l2_dev; ++ ++ vfd->lock = &dev->mutex; ++ ++ vfd->queue = &dev->capture.vb_vidq; ++ ++ /* video device needs to be able to access instance data */ ++ video_set_drvdata(vfd, dev); ++ ++ ret = video_register_device(vfd, ++ VFL_TYPE_GRABBER, ++ video_nr[dev->camera_num]); ++ if (ret < 0) ++ return ret; ++ ++ v4l2_info(vfd->v4l2_dev, ++ "V4L2 device registered as %s - stills mode > %dx%d\n", ++ video_device_node_name(vfd), max_video_width, max_video_height); ++ ++ return 0; ++} ++ ++void bcm2835_cleanup_instance(struct bm2835_mmal_dev *dev) ++{ ++ if (!dev) ++ return; ++ ++ v4l2_info(&dev->v4l2_dev, "unregistering %s\n", ++ video_device_node_name(&dev->vdev)); ++ ++ video_unregister_device(&dev->vdev); ++ ++ if (dev->capture.encode_component) { ++ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, ++ "mmal_exit - disconnect tunnel\n"); ++ vchiq_mmal_port_connect_tunnel(dev->instance, ++ dev->capture.camera_port, NULL); ++ vchiq_mmal_component_disable(dev->instance, ++ dev->capture.encode_component); ++ } ++ vchiq_mmal_component_disable(dev->instance, ++ dev->component[MMAL_COMPONENT_CAMERA]); ++ ++ vchiq_mmal_component_finalise(dev->instance, ++ dev-> ++ component[MMAL_COMPONENT_VIDEO_ENCODE]); ++ ++ vchiq_mmal_component_finalise(dev->instance, ++ dev-> ++ component[MMAL_COMPONENT_IMAGE_ENCODE]); ++ ++ vchiq_mmal_component_finalise(dev->instance, ++ dev->component[MMAL_COMPONENT_PREVIEW]); ++ ++ vchiq_mmal_component_finalise(dev->instance, ++ dev->component[MMAL_COMPONENT_CAMERA]); ++ ++ v4l2_ctrl_handler_free(&dev->ctrl_handler); ++ ++ v4l2_device_unregister(&dev->v4l2_dev); ++ ++ kfree(dev); ++} ++ ++static struct v4l2_format default_v4l2_format = { ++ .fmt.pix.pixelformat = V4L2_PIX_FMT_JPEG, ++ .fmt.pix.width = 1024, ++ .fmt.pix.bytesperline = 0, ++ .fmt.pix.height = 768, ++ .fmt.pix.sizeimage = 1024*768, ++}; ++ ++static int __init bm2835_mmal_init(void) ++{ ++ int ret; ++ struct bm2835_mmal_dev *dev; ++ struct vb2_queue *q; ++ int camera; ++ unsigned int num_cameras; ++ struct vchiq_mmal_instance *instance; ++ unsigned int resolutions[MAX_BCM2835_CAMERAS][2]; ++ ++ ret = vchiq_mmal_init(&instance); ++ if (ret < 0) ++ return ret; ++ ++ num_cameras = get_num_cameras(instance, ++ resolutions, ++ MAX_BCM2835_CAMERAS); ++ if (num_cameras > MAX_BCM2835_CAMERAS) ++ num_cameras = MAX_BCM2835_CAMERAS; ++ ++ for (camera = 0; camera < num_cameras; camera++) { ++ dev = kzalloc(sizeof(struct bm2835_mmal_dev), GFP_KERNEL); ++ if (!dev) ++ return -ENOMEM; ++ ++ dev->camera_num = camera; ++ dev->max_width = resolutions[camera][0]; ++ dev->max_height = resolutions[camera][1]; ++ ++ /* setup device defaults */ ++ dev->overlay.w.left = 150; ++ dev->overlay.w.top = 50; ++ dev->overlay.w.width = 1024; ++ dev->overlay.w.height = 768; ++ dev->overlay.clipcount = 0; ++ dev->overlay.field = V4L2_FIELD_NONE; ++ dev->overlay.global_alpha = 255; ++ ++ dev->capture.fmt = &formats[3]; /* JPEG */ ++ ++ /* v4l device registration */ ++ snprintf(dev->v4l2_dev.name, sizeof(dev->v4l2_dev.name), ++ "%s", BM2835_MMAL_MODULE_NAME); ++ ret = v4l2_device_register(NULL, &dev->v4l2_dev); ++ if (ret) ++ goto free_dev; ++ ++ /* setup v4l controls */ ++ ret = bm2835_mmal_init_controls(dev, &dev->ctrl_handler); ++ if (ret < 0) ++ goto unreg_dev; ++ dev->v4l2_dev.ctrl_handler = &dev->ctrl_handler; ++ ++ /* mmal init */ ++ dev->instance = instance; ++ ret = mmal_init(dev); ++ if (ret < 0) ++ goto unreg_dev; ++ ++ /* initialize queue */ ++ q = &dev->capture.vb_vidq; ++ memset(q, 0, sizeof(*q)); ++ q->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; ++ q->io_modes = VB2_MMAP | VB2_USERPTR | VB2_READ; ++ q->drv_priv = dev; ++ q->buf_struct_size = sizeof(struct mmal_buffer); ++ q->ops = &bm2835_mmal_video_qops; ++ q->mem_ops = &vb2_vmalloc_memops; ++ q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; ++ ret = vb2_queue_init(q); ++ if (ret < 0) ++ goto unreg_dev; ++ ++ /* v4l2 core mutex used to protect all fops and v4l2 ioctls. */ ++ mutex_init(&dev->mutex); ++ ++ /* initialise video devices */ ++ ret = bm2835_mmal_init_device(dev, &dev->vdev); ++ if (ret < 0) ++ goto unreg_dev; ++ ++ /* Really want to call vidioc_s_fmt_vid_cap with the default ++ * format, but currently the APIs don't join up. ++ */ ++ ret = mmal_setup_components(dev, &default_v4l2_format); ++ if (ret < 0) { ++ v4l2_err(&dev->v4l2_dev, ++ "%s: could not setup components\n", __func__); ++ goto unreg_dev; ++ } ++ ++ v4l2_info(&dev->v4l2_dev, ++ "Broadcom 2835 MMAL video capture ver %s loaded.\n", ++ BM2835_MMAL_VERSION); ++ ++ gdev[camera] = dev; ++ } ++ return 0; ++ ++unreg_dev: ++ v4l2_ctrl_handler_free(&dev->ctrl_handler); ++ v4l2_device_unregister(&dev->v4l2_dev); ++ ++free_dev: ++ kfree(dev); ++ ++ for ( ; camera > 0; camera--) { ++ bcm2835_cleanup_instance(gdev[camera]); ++ gdev[camera] = NULL; ++ } ++ pr_info("%s: error %d while loading driver\n", ++ BM2835_MMAL_MODULE_NAME, ret); ++ ++ return ret; ++} ++ ++static void __exit bm2835_mmal_exit(void) ++{ ++ int camera; ++ struct vchiq_mmal_instance *instance = gdev[0]->instance; ++ ++ for (camera = 0; camera < MAX_BCM2835_CAMERAS; camera++) { ++ bcm2835_cleanup_instance(gdev[camera]); ++ gdev[camera] = NULL; ++ } ++ vchiq_mmal_finalise(instance); ++} ++ ++module_init(bm2835_mmal_init); ++module_exit(bm2835_mmal_exit); +diff --git a/drivers/media/platform/bcm2835/bcm2835-camera.h b/drivers/media/platform/bcm2835/bcm2835-camera.h +new file mode 100644 +index 0000000..13f426f +--- /dev/null ++++ b/drivers/media/platform/bcm2835/bcm2835-camera.h +@@ -0,0 +1,144 @@ ++/* ++ * Broadcom BM2835 V4L2 driver ++ * ++ * Copyright © 2013 Raspberry Pi (Trading) Ltd. ++ * ++ * This file is subject to the terms and conditions of the GNU General Public ++ * License. See the file COPYING in the main directory of this archive ++ * for more details. ++ * ++ * Authors: Vincent Sanders <vincent.sanders@collabora.co.uk> ++ * Dave Stevenson <dsteve@broadcom.com> ++ * Simon Mellor <simellor@broadcom.com> ++ * Luke Diamand <luked@broadcom.com> ++ * ++ * core driver device ++ */ ++ ++#define V4L2_CTRL_COUNT 29 /* number of v4l controls */ ++ ++enum { ++ MMAL_COMPONENT_CAMERA = 0, ++ MMAL_COMPONENT_PREVIEW, ++ MMAL_COMPONENT_IMAGE_ENCODE, ++ MMAL_COMPONENT_VIDEO_ENCODE, ++ MMAL_COMPONENT_COUNT ++}; ++ ++enum { ++ MMAL_CAMERA_PORT_PREVIEW = 0, ++ MMAL_CAMERA_PORT_VIDEO, ++ MMAL_CAMERA_PORT_CAPTURE, ++ MMAL_CAMERA_PORT_COUNT ++}; ++ ++#define PREVIEW_LAYER 2 ++ ++extern int bcm2835_v4l2_debug; ++ ++struct bm2835_mmal_dev { ++ /* v4l2 devices */ ++ struct v4l2_device v4l2_dev; ++ struct video_device vdev; ++ struct mutex mutex; ++ ++ /* controls */ ++ struct v4l2_ctrl_handler ctrl_handler; ++ struct v4l2_ctrl *ctrls[V4L2_CTRL_COUNT]; ++ enum v4l2_scene_mode scene_mode; ++ struct mmal_colourfx colourfx; ++ int hflip; ++ int vflip; ++ int red_gain; ++ int blue_gain; ++ enum mmal_parameter_exposuremode exposure_mode_user; ++ enum v4l2_exposure_auto_type exposure_mode_v4l2_user; ++ /* active exposure mode may differ if selected via a scene mode */ ++ enum mmal_parameter_exposuremode exposure_mode_active; ++ enum mmal_parameter_exposuremeteringmode metering_mode; ++ unsigned int manual_shutter_speed; ++ bool exp_auto_priority; ++ bool manual_iso_enabled; ++ uint32_t iso; ++ ++ /* allocated mmal instance and components */ ++ struct vchiq_mmal_instance *instance; ++ struct vchiq_mmal_component *component[MMAL_COMPONENT_COUNT]; ++ int camera_use_count; ++ ++ struct v4l2_window overlay; ++ ++ struct { ++ unsigned int width; /* width */ ++ unsigned int height; /* height */ ++ unsigned int stride; /* stride */ ++ unsigned int buffersize; /* buffer size with padding */ ++ struct mmal_fmt *fmt; ++ struct v4l2_fract timeperframe; ++ ++ /* H264 encode bitrate */ ++ int encode_bitrate; ++ /* H264 bitrate mode. CBR/VBR */ ++ int encode_bitrate_mode; ++ /* H264 profile */ ++ enum v4l2_mpeg_video_h264_profile enc_profile; ++ /* H264 level */ ++ enum v4l2_mpeg_video_h264_level enc_level; ++ /* JPEG Q-factor */ ++ int q_factor; ++ ++ struct vb2_queue vb_vidq; ++ ++ /* VC start timestamp for streaming */ ++ s64 vc_start_timestamp; ++ /* Kernel start timestamp for streaming */ ++ struct timeval kernel_start_ts; ++ ++ struct vchiq_mmal_port *port; /* port being used for capture */ ++ /* camera port being used for capture */ ++ struct vchiq_mmal_port *camera_port; ++ /* component being used for encode */ ++ struct vchiq_mmal_component *encode_component; ++ /* number of frames remaining which driver should capture */ ++ unsigned int frame_count; ++ /* last frame completion */ ++ struct completion frame_cmplt; ++ ++ } capture; ++ ++ unsigned int camera_num; ++ unsigned int max_width; ++ unsigned int max_height; ++}; ++ ++int bm2835_mmal_init_controls( ++ struct bm2835_mmal_dev *dev, ++ struct v4l2_ctrl_handler *hdl); ++ ++int bm2835_mmal_set_all_camera_controls(struct bm2835_mmal_dev *dev); ++int set_framerate_params(struct bm2835_mmal_dev *dev); ++ ++/* Debug helpers */ ++ ++#define v4l2_dump_pix_format(level, debug, dev, pix_fmt, desc) \ ++{ \ ++ v4l2_dbg(level, debug, dev, \ ++"%s: w %u h %u field %u pfmt 0x%x bpl %u sz_img %u colorspace 0x%x priv %u\n", \ ++ desc == NULL ? "" : desc, \ ++ (pix_fmt)->width, (pix_fmt)->height, (pix_fmt)->field, \ ++ (pix_fmt)->pixelformat, (pix_fmt)->bytesperline, \ ++ (pix_fmt)->sizeimage, (pix_fmt)->colorspace, (pix_fmt)->priv); \ ++} ++#define v4l2_dump_win_format(level, debug, dev, win_fmt, desc) \ ++{ \ ++ v4l2_dbg(level, debug, dev, \ ++"%s: w %u h %u l %u t %u field %u chromakey %06X clip %p " \ ++"clipcount %u bitmap %p\n", \ ++ desc == NULL ? "" : desc, \ ++ (win_fmt)->w.width, (win_fmt)->w.height, \ ++ (win_fmt)->w.left, (win_fmt)->w.top, \ ++ (win_fmt)->field, \ ++ (win_fmt)->chromakey, \ ++ (win_fmt)->clips, (win_fmt)->clipcount, \ ++ (win_fmt)->bitmap); \ ++} +diff --git a/drivers/media/platform/bcm2835/controls.c b/drivers/media/platform/bcm2835/controls.c +new file mode 100644 +index 0000000..fe61330 +--- /dev/null ++++ b/drivers/media/platform/bcm2835/controls.c +@@ -0,0 +1,1345 @@ ++/* ++ * Broadcom BM2835 V4L2 driver ++ * ++ * Copyright © 2013 Raspberry Pi (Trading) Ltd. ++ * ++ * This file is subject to the terms and conditions of the GNU General Public ++ * License. See the file COPYING in the main directory of this archive ++ * for more details. ++ * ++ * Authors: Vincent Sanders <vincent.sanders@collabora.co.uk> ++ * Dave Stevenson <dsteve@broadcom.com> ++ * Simon Mellor <simellor@broadcom.com> ++ * Luke Diamand <luked@broadcom.com> ++ */ ++ ++#include <linux/errno.h> ++#include <linux/kernel.h> ++#include <linux/module.h> ++#include <linux/slab.h> ++#include <media/videobuf2-vmalloc.h> ++#include <media/v4l2-device.h> ++#include <media/v4l2-ioctl.h> ++#include <media/v4l2-ctrls.h> ++#include <media/v4l2-fh.h> ++#include <media/v4l2-event.h> ++#include <media/v4l2-common.h> ++ ++#include "mmal-common.h" ++#include "mmal-vchiq.h" ++#include "mmal-parameters.h" ++#include "bcm2835-camera.h" ++ ++/* The supported V4L2_CID_AUTO_EXPOSURE_BIAS values are from -4.0 to +4.0. ++ * MMAL values are in 1/6th increments so the MMAL range is -24 to +24. ++ * V4L2 docs say value "is expressed in terms of EV, drivers should interpret ++ * the values as 0.001 EV units, where the value 1000 stands for +1 EV." ++ * V4L2 is limited to a max of 32 values in a menu, so count in 1/3rds from ++ * -4 to +4 ++ */ ++static const s64 ev_bias_qmenu[] = { ++ -4000, -3667, -3333, ++ -3000, -2667, -2333, ++ -2000, -1667, -1333, ++ -1000, -667, -333, ++ 0, 333, 667, ++ 1000, 1333, 1667, ++ 2000, 2333, 2667, ++ 3000, 3333, 3667, ++ 4000 ++}; ++ ++/* Supported ISO values (*1000) ++ * ISOO = auto ISO ++ */ ++static const s64 iso_qmenu[] = { ++ 0, 100000, 200000, 400000, 800000, ++}; ++static const uint32_t iso_values[] = { ++ 0, 100, 200, 400, 800, ++}; ++ ++static const s64 mains_freq_qmenu[] = { ++ V4L2_CID_POWER_LINE_FREQUENCY_DISABLED, ++ V4L2_CID_POWER_LINE_FREQUENCY_50HZ, ++ V4L2_CID_POWER_LINE_FREQUENCY_60HZ, ++ V4L2_CID_POWER_LINE_FREQUENCY_AUTO ++}; ++ ++/* Supported video encode modes */ ++static const s64 bitrate_mode_qmenu[] = { ++ (s64)V4L2_MPEG_VIDEO_BITRATE_MODE_VBR, ++ (s64)V4L2_MPEG_VIDEO_BITRATE_MODE_CBR, ++}; ++ ++enum bm2835_mmal_ctrl_type { ++ MMAL_CONTROL_TYPE_STD, ++ MMAL_CONTROL_TYPE_STD_MENU, ++ MMAL_CONTROL_TYPE_INT_MENU, ++ MMAL_CONTROL_TYPE_CLUSTER, /* special cluster entry */ ++}; ++ ++struct bm2835_mmal_v4l2_ctrl; ++ ++typedef int(bm2835_mmal_v4l2_ctrl_cb)( ++ struct bm2835_mmal_dev *dev, ++ struct v4l2_ctrl *ctrl, ++ const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl); ++ ++struct bm2835_mmal_v4l2_ctrl { ++ u32 id; /* v4l2 control identifier */ ++ enum bm2835_mmal_ctrl_type type; ++ /* control minimum value or ++ * mask for MMAL_CONTROL_TYPE_STD_MENU */ ++ s32 min; ++ s32 max; /* maximum value of control */ ++ s32 def; /* default value of control */ ++ s32 step; /* step size of the control */ ++ const s64 *imenu; /* integer menu array */ ++ u32 mmal_id; /* mmal parameter id */ ++ bm2835_mmal_v4l2_ctrl_cb *setter; ++ bool ignore_errors; ++}; ++ ++struct v4l2_to_mmal_effects_setting { ++ u32 v4l2_effect; ++ u32 mmal_effect; ++ s32 col_fx_enable; ++ s32 col_fx_fixed_cbcr; ++ u32 u; ++ u32 v; ++ u32 num_effect_params; ++ u32 effect_params[MMAL_MAX_IMAGEFX_PARAMETERS]; ++}; ++ ++static const struct v4l2_to_mmal_effects_setting ++ v4l2_to_mmal_effects_values[] = { ++ { V4L2_COLORFX_NONE, MMAL_PARAM_IMAGEFX_NONE, ++ 0, 0, 0, 0, 0, {0, 0, 0, 0, 0} }, ++ { V4L2_COLORFX_BW, MMAL_PARAM_IMAGEFX_NONE, ++ 1, 0, 128, 128, 0, {0, 0, 0, 0, 0} }, ++ { V4L2_COLORFX_SEPIA, MMAL_PARAM_IMAGEFX_NONE, ++ 1, 0, 87, 151, 0, {0, 0, 0, 0, 0} }, ++ { V4L2_COLORFX_NEGATIVE, MMAL_PARAM_IMAGEFX_NEGATIVE, ++ 0, 0, 0, 0, 0, {0, 0, 0, 0, 0} }, ++ { V4L2_COLORFX_EMBOSS, MMAL_PARAM_IMAGEFX_EMBOSS, ++ 0, 0, 0, 0, 0, {0, 0, 0, 0, 0} }, ++ { V4L2_COLORFX_SKETCH, MMAL_PARAM_IMAGEFX_SKETCH, ++ 0, 0, 0, 0, 0, {0, 0, 0, 0, 0} }, ++ { V4L2_COLORFX_SKY_BLUE, MMAL_PARAM_IMAGEFX_PASTEL, ++ 0, 0, 0, 0, 0, {0, 0, 0, 0, 0} }, ++ { V4L2_COLORFX_GRASS_GREEN, MMAL_PARAM_IMAGEFX_WATERCOLOUR, ++ 0, 0, 0, 0, 0, {0, 0, 0, 0, 0} }, ++ { V4L2_COLORFX_SKIN_WHITEN, MMAL_PARAM_IMAGEFX_WASHEDOUT, ++ 0, 0, 0, 0, 0, {0, 0, 0, 0, 0} }, ++ { V4L2_COLORFX_VIVID, MMAL_PARAM_IMAGEFX_SATURATION, ++ 0, 0, 0, 0, 0, {0, 0, 0, 0, 0} }, ++ { V4L2_COLORFX_AQUA, MMAL_PARAM_IMAGEFX_NONE, ++ 1, 0, 171, 121, 0, {0, 0, 0, 0, 0} }, ++ { V4L2_COLORFX_ART_FREEZE, MMAL_PARAM_IMAGEFX_HATCH, ++ 0, 0, 0, 0, 0, {0, 0, 0, 0, 0} }, ++ { V4L2_COLORFX_SILHOUETTE, MMAL_PARAM_IMAGEFX_FILM, ++ 0, 0, 0, 0, 0, {0, 0, 0, 0, 0} }, ++ { V4L2_COLORFX_SOLARIZATION, MMAL_PARAM_IMAGEFX_SOLARIZE, ++ 0, 0, 0, 0, 5, {1, 128, 160, 160, 48} }, ++ { V4L2_COLORFX_ANTIQUE, MMAL_PARAM_IMAGEFX_COLOURBALANCE, ++ 0, 0, 0, 0, 3, {108, 274, 238, 0, 0} }, ++ { V4L2_COLORFX_SET_CBCR, MMAL_PARAM_IMAGEFX_NONE, ++ 1, 1, 0, 0, 0, {0, 0, 0, 0, 0} } ++}; ++ ++struct v4l2_mmal_scene_config { ++ enum v4l2_scene_mode v4l2_scene; ++ enum mmal_parameter_exposuremode exposure_mode; ++ enum mmal_parameter_exposuremeteringmode metering_mode; ++}; ++ ++static const struct v4l2_mmal_scene_config scene_configs[] = { ++ /* V4L2_SCENE_MODE_NONE automatically added */ ++ { ++ V4L2_SCENE_MODE_NIGHT, ++ MMAL_PARAM_EXPOSUREMODE_NIGHT, ++ MMAL_PARAM_EXPOSUREMETERINGMODE_AVERAGE ++ }, ++ { ++ V4L2_SCENE_MODE_SPORTS, ++ MMAL_PARAM_EXPOSUREMODE_SPORTS, ++ MMAL_PARAM_EXPOSUREMETERINGMODE_AVERAGE ++ }, ++}; ++ ++/* control handlers*/ ++ ++static int ctrl_set_rational(struct bm2835_mmal_dev *dev, ++ struct v4l2_ctrl *ctrl, ++ const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl) ++{ ++ struct mmal_parameter_rational rational_value; ++ struct vchiq_mmal_port *control; ++ ++ control = &dev->component[MMAL_COMPONENT_CAMERA]->control; ++ ++ rational_value.num = ctrl->val; ++ rational_value.den = 100; ++ ++ return vchiq_mmal_port_parameter_set(dev->instance, control, ++ mmal_ctrl->mmal_id, ++ &rational_value, ++ sizeof(rational_value)); ++} ++ ++static int ctrl_set_value(struct bm2835_mmal_dev *dev, ++ struct v4l2_ctrl *ctrl, ++ const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl) ++{ ++ u32 u32_value; ++ struct vchiq_mmal_port *control; ++ ++ control = &dev->component[MMAL_COMPONENT_CAMERA]->control; ++ ++ u32_value = ctrl->val; ++ ++ return vchiq_mmal_port_parameter_set(dev->instance, control, ++ mmal_ctrl->mmal_id, ++ &u32_value, sizeof(u32_value)); ++} ++ ++static int ctrl_set_iso(struct bm2835_mmal_dev *dev, ++ struct v4l2_ctrl *ctrl, ++ const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl) ++{ ++ u32 u32_value; ++ struct vchiq_mmal_port *control; ++ ++ if (ctrl->val > mmal_ctrl->max || ctrl->val < mmal_ctrl->min) ++ return 1; ++ ++ if (ctrl->id == V4L2_CID_ISO_SENSITIVITY) ++ dev->iso = iso_values[ctrl->val]; ++ else if (ctrl->id == V4L2_CID_ISO_SENSITIVITY_AUTO) ++ dev->manual_iso_enabled = ++ (ctrl->val == V4L2_ISO_SENSITIVITY_MANUAL ? ++ true : ++ false); ++ ++ control = &dev->component[MMAL_COMPONENT_CAMERA]->control; ++ ++ if (dev->manual_iso_enabled) ++ u32_value = dev->iso; ++ else ++ u32_value = 0; ++ ++ return vchiq_mmal_port_parameter_set(dev->instance, control, ++ MMAL_PARAMETER_ISO, ++ &u32_value, sizeof(u32_value)); ++} ++ ++static int ctrl_set_value_ev(struct bm2835_mmal_dev *dev, ++ struct v4l2_ctrl *ctrl, ++ const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl) ++{ ++ s32 s32_value; ++ struct vchiq_mmal_port *control; ++ ++ control = &dev->component[MMAL_COMPONENT_CAMERA]->control; ++ ++ s32_value = (ctrl->val-12)*2; /* Convert from index to 1/6ths */ ++ ++ return vchiq_mmal_port_parameter_set(dev->instance, control, ++ mmal_ctrl->mmal_id, ++ &s32_value, sizeof(s32_value)); ++} ++ ++static int ctrl_set_rotate(struct bm2835_mmal_dev *dev, ++ struct v4l2_ctrl *ctrl, ++ const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl) ++{ ++ int ret; ++ u32 u32_value; ++ struct vchiq_mmal_component *camera; ++ ++ camera = dev->component[MMAL_COMPONENT_CAMERA]; ++ ++ u32_value = ((ctrl->val % 360) / 90) * 90; ++ ++ ret = vchiq_mmal_port_parameter_set(dev->instance, &camera->output[0], ++ mmal_ctrl->mmal_id, ++ &u32_value, sizeof(u32_value)); ++ if (ret < 0) ++ return ret; ++ ++ ret = vchiq_mmal_port_parameter_set(dev->instance, &camera->output[1], ++ mmal_ctrl->mmal_id, ++ &u32_value, sizeof(u32_value)); ++ if (ret < 0) ++ return ret; ++ ++ ret = vchiq_mmal_port_parameter_set(dev->instance, &camera->output[2], ++ mmal_ctrl->mmal_id, ++ &u32_value, sizeof(u32_value)); ++ ++ return ret; ++} ++ ++static int ctrl_set_flip(struct bm2835_mmal_dev *dev, ++ struct v4l2_ctrl *ctrl, ++ const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl) ++{ ++ int ret; ++ u32 u32_value; ++ struct vchiq_mmal_component *camera; ++ ++ if (ctrl->id == V4L2_CID_HFLIP) ++ dev->hflip = ctrl->val; ++ else ++ dev->vflip = ctrl->val; ++ ++ camera = dev->component[MMAL_COMPONENT_CAMERA]; ++ ++ if (dev->hflip && dev->vflip) ++ u32_value = MMAL_PARAM_MIRROR_BOTH; ++ else if (dev->hflip) ++ u32_value = MMAL_PARAM_MIRROR_HORIZONTAL; ++ else if (dev->vflip) ++ u32_value = MMAL_PARAM_MIRROR_VERTICAL; ++ else ++ u32_value = MMAL_PARAM_MIRROR_NONE; ++ ++ ret = vchiq_mmal_port_parameter_set(dev->instance, &camera->output[0], ++ mmal_ctrl->mmal_id, ++ &u32_value, sizeof(u32_value)); ++ if (ret < 0) ++ return ret; ++ ++ ret = vchiq_mmal_port_parameter_set(dev->instance, &camera->output[1], ++ mmal_ctrl->mmal_id, ++ &u32_value, sizeof(u32_value)); ++ if (ret < 0) ++ return ret; ++ ++ ret = vchiq_mmal_port_parameter_set(dev->instance, &camera->output[2], ++ mmal_ctrl->mmal_id, ++ &u32_value, sizeof(u32_value)); ++ ++ return ret; ++ ++} ++ ++static int ctrl_set_exposure(struct bm2835_mmal_dev *dev, ++ struct v4l2_ctrl *ctrl, ++ const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl) ++{ ++ enum mmal_parameter_exposuremode exp_mode = dev->exposure_mode_user; ++ u32 shutter_speed = 0; ++ struct vchiq_mmal_port *control; ++ int ret = 0; ++ ++ control = &dev->component[MMAL_COMPONENT_CAMERA]->control; ++ ++ if (mmal_ctrl->mmal_id == MMAL_PARAMETER_SHUTTER_SPEED) { ++ /* V4L2 is in 100usec increments. ++ * MMAL is 1usec. ++ */ ++ dev->manual_shutter_speed = ctrl->val * 100; ++ } else if (mmal_ctrl->mmal_id == MMAL_PARAMETER_EXPOSURE_MODE) { ++ switch (ctrl->val) { ++ case V4L2_EXPOSURE_AUTO: ++ exp_mode = MMAL_PARAM_EXPOSUREMODE_AUTO; ++ break; ++ ++ case V4L2_EXPOSURE_MANUAL: ++ exp_mode = MMAL_PARAM_EXPOSUREMODE_OFF; ++ break; ++ } ++ dev->exposure_mode_user = exp_mode; ++ dev->exposure_mode_v4l2_user = ctrl->val; ++ } else if (mmal_ctrl->id == V4L2_CID_EXPOSURE_AUTO_PRIORITY) { ++ dev->exp_auto_priority = ctrl->val; ++ } ++ ++ if (dev->scene_mode == V4L2_SCENE_MODE_NONE) { ++ if (exp_mode == MMAL_PARAM_EXPOSUREMODE_OFF) ++ shutter_speed = dev->manual_shutter_speed; ++ ++ ret = vchiq_mmal_port_parameter_set(dev->instance, ++ control, ++ MMAL_PARAMETER_SHUTTER_SPEED, ++ &shutter_speed, ++ sizeof(shutter_speed)); ++ ret += vchiq_mmal_port_parameter_set(dev->instance, ++ control, ++ MMAL_PARAMETER_EXPOSURE_MODE, ++ &exp_mode, ++ sizeof(u32)); ++ dev->exposure_mode_active = exp_mode; ++ } ++ /* exposure_dynamic_framerate (V4L2_CID_EXPOSURE_AUTO_PRIORITY) should ++ * always apply irrespective of scene mode. ++ */ ++ ret += set_framerate_params(dev); ++ ++ return ret; ++} ++ ++static int ctrl_set_metering_mode(struct bm2835_mmal_dev *dev, ++ struct v4l2_ctrl *ctrl, ++ const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl) ++{ ++ switch (ctrl->val) { ++ case V4L2_EXPOSURE_METERING_AVERAGE: ++ dev->metering_mode = MMAL_PARAM_EXPOSUREMETERINGMODE_AVERAGE; ++ break; ++ ++ case V4L2_EXPOSURE_METERING_CENTER_WEIGHTED: ++ dev->metering_mode = MMAL_PARAM_EXPOSUREMETERINGMODE_BACKLIT; ++ break; ++ ++ case V4L2_EXPOSURE_METERING_SPOT: ++ dev->metering_mode = MMAL_PARAM_EXPOSUREMETERINGMODE_SPOT; ++ break; ++ ++ /* todo matrix weighting not added to Linux API till 3.9 ++ case V4L2_EXPOSURE_METERING_MATRIX: ++ dev->metering_mode = MMAL_PARAM_EXPOSUREMETERINGMODE_MATRIX; ++ break; ++ */ ++ ++ } ++ ++ if (dev->scene_mode == V4L2_SCENE_MODE_NONE) { ++ struct vchiq_mmal_port *control; ++ u32 u32_value = dev->metering_mode; ++ ++ control = &dev->component[MMAL_COMPONENT_CAMERA]->control; ++ ++ return vchiq_mmal_port_parameter_set(dev->instance, control, ++ mmal_ctrl->mmal_id, ++ &u32_value, sizeof(u32_value)); ++ } else ++ return 0; ++} ++ ++static int ctrl_set_flicker_avoidance(struct bm2835_mmal_dev *dev, ++ struct v4l2_ctrl *ctrl, ++ const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl) ++{ ++ u32 u32_value; ++ struct vchiq_mmal_port *control; ++ ++ control = &dev->component[MMAL_COMPONENT_CAMERA]->control; ++ ++ switch (ctrl->val) { ++ case V4L2_CID_POWER_LINE_FREQUENCY_DISABLED: ++ u32_value = MMAL_PARAM_FLICKERAVOID_OFF; ++ break; ++ case V4L2_CID_POWER_LINE_FREQUENCY_50HZ: ++ u32_value = MMAL_PARAM_FLICKERAVOID_50HZ; ++ break; ++ case V4L2_CID_POWER_LINE_FREQUENCY_60HZ: ++ u32_value = MMAL_PARAM_FLICKERAVOID_60HZ; ++ break; ++ case V4L2_CID_POWER_LINE_FREQUENCY_AUTO: ++ u32_value = MMAL_PARAM_FLICKERAVOID_AUTO; ++ break; ++ } ++ ++ return vchiq_mmal_port_parameter_set(dev->instance, control, ++ mmal_ctrl->mmal_id, ++ &u32_value, sizeof(u32_value)); ++} ++ ++static int ctrl_set_awb_mode(struct bm2835_mmal_dev *dev, ++ struct v4l2_ctrl *ctrl, ++ const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl) ++{ ++ u32 u32_value; ++ struct vchiq_mmal_port *control; ++ ++ control = &dev->component[MMAL_COMPONENT_CAMERA]->control; ++ ++ switch (ctrl->val) { ++ case V4L2_WHITE_BALANCE_MANUAL: ++ u32_value = MMAL_PARAM_AWBMODE_OFF; ++ break; ++ ++ case V4L2_WHITE_BALANCE_AUTO: ++ u32_value = MMAL_PARAM_AWBMODE_AUTO; ++ break; ++ ++ case V4L2_WHITE_BALANCE_INCANDESCENT: ++ u32_value = MMAL_PARAM_AWBMODE_INCANDESCENT; ++ break; ++ ++ case V4L2_WHITE_BALANCE_FLUORESCENT: ++ u32_value = MMAL_PARAM_AWBMODE_FLUORESCENT; ++ break; ++ ++ case V4L2_WHITE_BALANCE_FLUORESCENT_H: ++ u32_value = MMAL_PARAM_AWBMODE_TUNGSTEN; ++ break; ++ ++ case V4L2_WHITE_BALANCE_HORIZON: ++ u32_value = MMAL_PARAM_AWBMODE_HORIZON; ++ break; ++ ++ case V4L2_WHITE_BALANCE_DAYLIGHT: ++ u32_value = MMAL_PARAM_AWBMODE_SUNLIGHT; ++ break; ++ ++ case V4L2_WHITE_BALANCE_FLASH: ++ u32_value = MMAL_PARAM_AWBMODE_FLASH; ++ break; ++ ++ case V4L2_WHITE_BALANCE_CLOUDY: ++ u32_value = MMAL_PARAM_AWBMODE_CLOUDY; ++ break; ++ ++ case V4L2_WHITE_BALANCE_SHADE: ++ u32_value = MMAL_PARAM_AWBMODE_SHADE; ++ break; ++ ++ } ++ ++ return vchiq_mmal_port_parameter_set(dev->instance, control, ++ mmal_ctrl->mmal_id, ++ &u32_value, sizeof(u32_value)); ++} ++ ++static int ctrl_set_awb_gains(struct bm2835_mmal_dev *dev, ++ struct v4l2_ctrl *ctrl, ++ const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl) ++{ ++ struct vchiq_mmal_port *control; ++ struct mmal_parameter_awbgains gains; ++ ++ control = &dev->component[MMAL_COMPONENT_CAMERA]->control; ++ ++ if (ctrl->id == V4L2_CID_RED_BALANCE) ++ dev->red_gain = ctrl->val; ++ else if (ctrl->id == V4L2_CID_BLUE_BALANCE) ++ dev->blue_gain = ctrl->val; ++ ++ gains.r_gain.num = dev->red_gain; ++ gains.b_gain.num = dev->blue_gain; ++ gains.r_gain.den = gains.b_gain.den = 1000; ++ ++ return vchiq_mmal_port_parameter_set(dev->instance, control, ++ mmal_ctrl->mmal_id, ++ &gains, sizeof(gains)); ++} ++ ++static int ctrl_set_image_effect(struct bm2835_mmal_dev *dev, ++ struct v4l2_ctrl *ctrl, ++ const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl) ++{ ++ int ret = -EINVAL; ++ int i, j; ++ struct vchiq_mmal_port *control; ++ struct mmal_parameter_imagefx_parameters imagefx; ++ ++ for (i = 0; i < ARRAY_SIZE(v4l2_to_mmal_effects_values); i++) { ++ if (ctrl->val == v4l2_to_mmal_effects_values[i].v4l2_effect) { ++ ++ imagefx.effect = ++ v4l2_to_mmal_effects_values[i].mmal_effect; ++ imagefx.num_effect_params = ++ v4l2_to_mmal_effects_values[i].num_effect_params; ++ ++ if (imagefx.num_effect_params > MMAL_MAX_IMAGEFX_PARAMETERS) ++ imagefx.num_effect_params = MMAL_MAX_IMAGEFX_PARAMETERS; ++ ++ for (j = 0; j < imagefx.num_effect_params; j++) ++ imagefx.effect_parameter[j] = ++ v4l2_to_mmal_effects_values[i].effect_params[j]; ++ ++ dev->colourfx.enable = ++ v4l2_to_mmal_effects_values[i].col_fx_enable; ++ if (!v4l2_to_mmal_effects_values[i].col_fx_fixed_cbcr) { ++ dev->colourfx.u = ++ v4l2_to_mmal_effects_values[i].u; ++ dev->colourfx.v = ++ v4l2_to_mmal_effects_values[i].v; ++ } ++ ++ control = &dev->component[MMAL_COMPONENT_CAMERA]->control; ++ ++ ret = vchiq_mmal_port_parameter_set( ++ dev->instance, control, ++ MMAL_PARAMETER_IMAGE_EFFECT_PARAMETERS, ++ &imagefx, sizeof(imagefx)); ++ if (ret) ++ goto exit; ++ ++ ret = vchiq_mmal_port_parameter_set( ++ dev->instance, control, ++ MMAL_PARAMETER_COLOUR_EFFECT, ++ &dev->colourfx, sizeof(dev->colourfx)); ++ } ++ } ++ ++exit: ++ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, ++ "mmal_ctrl:%p ctrl id:0x%x ctrl val:%d imagefx:0x%x color_effect:%s u:%d v:%d ret %d(%d)\n", ++ mmal_ctrl, ctrl->id, ctrl->val, imagefx.effect, ++ dev->colourfx.enable ? "true" : "false", ++ dev->colourfx.u, dev->colourfx.v, ++ ret, (ret == 0 ? 0 : -EINVAL)); ++ return (ret == 0 ? 0 : EINVAL); ++} ++ ++static int ctrl_set_colfx(struct bm2835_mmal_dev *dev, ++ struct v4l2_ctrl *ctrl, ++ const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl) ++{ ++ int ret = -EINVAL; ++ struct vchiq_mmal_port *control; ++ ++ control = &dev->component[MMAL_COMPONENT_CAMERA]->control; ++ ++ dev->colourfx.enable = (ctrl->val & 0xff00) >> 8; ++ dev->colourfx.enable = ctrl->val & 0xff; ++ ++ ret = vchiq_mmal_port_parameter_set(dev->instance, control, ++ MMAL_PARAMETER_COLOUR_EFFECT, ++ &dev->colourfx, sizeof(dev->colourfx)); ++ ++ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, ++ "%s: After: mmal_ctrl:%p ctrl id:0x%x ctrl val:%d ret %d(%d)\n", ++ __func__, mmal_ctrl, ctrl->id, ctrl->val, ret, ++ (ret == 0 ? 0 : -EINVAL)); ++ return (ret == 0 ? 0 : EINVAL); ++} ++ ++static int ctrl_set_bitrate(struct bm2835_mmal_dev *dev, ++ struct v4l2_ctrl *ctrl, ++ const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl) ++{ ++ int ret; ++ struct vchiq_mmal_port *encoder_out; ++ ++ dev->capture.encode_bitrate = ctrl->val; ++ ++ encoder_out = &dev->component[MMAL_COMPONENT_VIDEO_ENCODE]->output[0]; ++ ++ ret = vchiq_mmal_port_parameter_set(dev->instance, encoder_out, ++ mmal_ctrl->mmal_id, ++ &ctrl->val, sizeof(ctrl->val)); ++ ret = 0; ++ return ret; ++} ++ ++static int ctrl_set_bitrate_mode(struct bm2835_mmal_dev *dev, ++ struct v4l2_ctrl *ctrl, ++ const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl) ++{ ++ u32 bitrate_mode; ++ struct vchiq_mmal_port *encoder_out; ++ ++ encoder_out = &dev->component[MMAL_COMPONENT_VIDEO_ENCODE]->output[0]; ++ ++ dev->capture.encode_bitrate_mode = ctrl->val; ++ switch (ctrl->val) { ++ default: ++ case V4L2_MPEG_VIDEO_BITRATE_MODE_VBR: ++ bitrate_mode = MMAL_VIDEO_RATECONTROL_VARIABLE; ++ break; ++ case V4L2_MPEG_VIDEO_BITRATE_MODE_CBR: ++ bitrate_mode = MMAL_VIDEO_RATECONTROL_CONSTANT; ++ break; ++ } ++ ++ vchiq_mmal_port_parameter_set(dev->instance, encoder_out, ++ mmal_ctrl->mmal_id, ++ &bitrate_mode, ++ sizeof(bitrate_mode)); ++ return 0; ++} ++ ++static int ctrl_set_image_encode_output(struct bm2835_mmal_dev *dev, ++ struct v4l2_ctrl *ctrl, ++ const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl) ++{ ++ u32 u32_value; ++ struct vchiq_mmal_port *jpeg_out; ++ ++ jpeg_out = &dev->component[MMAL_COMPONENT_IMAGE_ENCODE]->output[0]; ++ ++ u32_value = ctrl->val; ++ ++ return vchiq_mmal_port_parameter_set(dev->instance, jpeg_out, ++ mmal_ctrl->mmal_id, ++ &u32_value, sizeof(u32_value)); ++} ++ ++static int ctrl_set_video_encode_param_output(struct bm2835_mmal_dev *dev, ++ struct v4l2_ctrl *ctrl, ++ const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl) ++{ ++ u32 u32_value; ++ struct vchiq_mmal_port *vid_enc_ctl; ++ ++ vid_enc_ctl = &dev->component[MMAL_COMPONENT_VIDEO_ENCODE]->output[0]; ++ ++ u32_value = ctrl->val; ++ ++ return vchiq_mmal_port_parameter_set(dev->instance, vid_enc_ctl, ++ mmal_ctrl->mmal_id, ++ &u32_value, sizeof(u32_value)); ++} ++ ++static int ctrl_set_video_encode_profile_level(struct bm2835_mmal_dev *dev, ++ struct v4l2_ctrl *ctrl, ++ const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl) ++{ ++ struct mmal_parameter_video_profile param; ++ int ret = 0; ++ ++ if (ctrl->id == V4L2_CID_MPEG_VIDEO_H264_PROFILE) { ++ switch (ctrl->val) { ++ case V4L2_MPEG_VIDEO_H264_PROFILE_BASELINE: ++ case V4L2_MPEG_VIDEO_H264_PROFILE_CONSTRAINED_BASELINE: ++ case V4L2_MPEG_VIDEO_H264_PROFILE_MAIN: ++ case V4L2_MPEG_VIDEO_H264_PROFILE_HIGH: ++ dev->capture.enc_profile = ctrl->val; ++ break; ++ default: ++ ret = -EINVAL; ++ break; ++ } ++ } else if (ctrl->id == V4L2_CID_MPEG_VIDEO_H264_LEVEL) { ++ switch (ctrl->val) { ++ case V4L2_MPEG_VIDEO_H264_LEVEL_1_0: ++ case V4L2_MPEG_VIDEO_H264_LEVEL_1B: ++ case V4L2_MPEG_VIDEO_H264_LEVEL_1_1: ++ case V4L2_MPEG_VIDEO_H264_LEVEL_1_2: ++ case V4L2_MPEG_VIDEO_H264_LEVEL_1_3: ++ case V4L2_MPEG_VIDEO_H264_LEVEL_2_0: ++ case V4L2_MPEG_VIDEO_H264_LEVEL_2_1: ++ case V4L2_MPEG_VIDEO_H264_LEVEL_2_2: ++ case V4L2_MPEG_VIDEO_H264_LEVEL_3_0: ++ case V4L2_MPEG_VIDEO_H264_LEVEL_3_1: ++ case V4L2_MPEG_VIDEO_H264_LEVEL_3_2: ++ case V4L2_MPEG_VIDEO_H264_LEVEL_4_0: ++ dev->capture.enc_level = ctrl->val; ++ break; ++ default: ++ ret = -EINVAL; ++ break; ++ } ++ } ++ ++ if (!ret) { ++ switch (dev->capture.enc_profile) { ++ case V4L2_MPEG_VIDEO_H264_PROFILE_BASELINE: ++ param.profile = MMAL_VIDEO_PROFILE_H264_BASELINE; ++ break; ++ case V4L2_MPEG_VIDEO_H264_PROFILE_CONSTRAINED_BASELINE: ++ param.profile = ++ MMAL_VIDEO_PROFILE_H264_CONSTRAINED_BASELINE; ++ break; ++ case V4L2_MPEG_VIDEO_H264_PROFILE_MAIN: ++ param.profile = MMAL_VIDEO_PROFILE_H264_MAIN; ++ break; ++ case V4L2_MPEG_VIDEO_H264_PROFILE_HIGH: ++ param.profile = MMAL_VIDEO_PROFILE_H264_HIGH; ++ break; ++ default: ++ /* Should never get here */ ++ break; ++ } ++ ++ switch (dev->capture.enc_level) { ++ case V4L2_MPEG_VIDEO_H264_LEVEL_1_0: ++ param.level = MMAL_VIDEO_LEVEL_H264_1; ++ break; ++ case V4L2_MPEG_VIDEO_H264_LEVEL_1B: ++ param.level = MMAL_VIDEO_LEVEL_H264_1b; ++ break; ++ case V4L2_MPEG_VIDEO_H264_LEVEL_1_1: ++ param.level = MMAL_VIDEO_LEVEL_H264_11; ++ break; ++ case V4L2_MPEG_VIDEO_H264_LEVEL_1_2: ++ param.level = MMAL_VIDEO_LEVEL_H264_12; ++ break; ++ case V4L2_MPEG_VIDEO_H264_LEVEL_1_3: ++ param.level = MMAL_VIDEO_LEVEL_H264_13; ++ break; ++ case V4L2_MPEG_VIDEO_H264_LEVEL_2_0: ++ param.level = MMAL_VIDEO_LEVEL_H264_2; ++ break; ++ case V4L2_MPEG_VIDEO_H264_LEVEL_2_1: ++ param.level = MMAL_VIDEO_LEVEL_H264_21; ++ break; ++ case V4L2_MPEG_VIDEO_H264_LEVEL_2_2: ++ param.level = MMAL_VIDEO_LEVEL_H264_22; ++ break; ++ case V4L2_MPEG_VIDEO_H264_LEVEL_3_0: ++ param.level = MMAL_VIDEO_LEVEL_H264_3; ++ break; ++ case V4L2_MPEG_VIDEO_H264_LEVEL_3_1: ++ param.level = MMAL_VIDEO_LEVEL_H264_31; ++ break; ++ case V4L2_MPEG_VIDEO_H264_LEVEL_3_2: ++ param.level = MMAL_VIDEO_LEVEL_H264_32; ++ break; ++ case V4L2_MPEG_VIDEO_H264_LEVEL_4_0: ++ param.level = MMAL_VIDEO_LEVEL_H264_4; ++ break; ++ default: ++ /* Should never get here */ ++ break; ++ } ++ ++ ret = vchiq_mmal_port_parameter_set(dev->instance, ++ &dev->component[MMAL_COMPONENT_VIDEO_ENCODE]->output[0], ++ mmal_ctrl->mmal_id, ++ &param, sizeof(param)); ++ } ++ return ret; ++} ++ ++static int ctrl_set_scene_mode(struct bm2835_mmal_dev *dev, ++ struct v4l2_ctrl *ctrl, ++ const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl) ++{ ++ int ret = 0; ++ int shutter_speed; ++ struct vchiq_mmal_port *control; ++ ++ v4l2_dbg(0, bcm2835_v4l2_debug, &dev->v4l2_dev, ++ "scene mode selected %d, was %d\n", ctrl->val, ++ dev->scene_mode); ++ control = &dev->component[MMAL_COMPONENT_CAMERA]->control; ++ ++ if (ctrl->val == dev->scene_mode) ++ return 0; ++ ++ if (ctrl->val == V4L2_SCENE_MODE_NONE) { ++ /* Restore all user selections */ ++ dev->scene_mode = V4L2_SCENE_MODE_NONE; ++ ++ if (dev->exposure_mode_user == MMAL_PARAM_EXPOSUREMODE_OFF) ++ shutter_speed = dev->manual_shutter_speed; ++ else ++ shutter_speed = 0; ++ ++ v4l2_dbg(0, bcm2835_v4l2_debug, &dev->v4l2_dev, ++ "%s: scene mode none: shut_speed %d, exp_mode %d, metering %d\n", ++ __func__, shutter_speed, dev->exposure_mode_user, ++ dev->metering_mode); ++ ret = vchiq_mmal_port_parameter_set(dev->instance, ++ control, ++ MMAL_PARAMETER_SHUTTER_SPEED, ++ &shutter_speed, ++ sizeof(shutter_speed)); ++ ret += vchiq_mmal_port_parameter_set(dev->instance, ++ control, ++ MMAL_PARAMETER_EXPOSURE_MODE, ++ &dev->exposure_mode_user, ++ sizeof(u32)); ++ dev->exposure_mode_active = dev->exposure_mode_user; ++ ret += vchiq_mmal_port_parameter_set(dev->instance, ++ control, ++ MMAL_PARAMETER_EXP_METERING_MODE, ++ &dev->metering_mode, ++ sizeof(u32)); ++ ret += set_framerate_params(dev); ++ } else { ++ /* Set up scene mode */ ++ int i; ++ const struct v4l2_mmal_scene_config *scene = NULL; ++ int shutter_speed; ++ enum mmal_parameter_exposuremode exposure_mode; ++ enum mmal_parameter_exposuremeteringmode metering_mode; ++ ++ for (i = 0; i < ARRAY_SIZE(scene_configs); i++) { ++ if (scene_configs[i].v4l2_scene == ++ ctrl->val) { ++ scene = &scene_configs[i]; ++ break; ++ } ++ } ++ if (!scene) ++ return -EINVAL; ++ if (i >= ARRAY_SIZE(scene_configs)) ++ return -EINVAL; ++ ++ /* Set all the values */ ++ dev->scene_mode = ctrl->val; ++ ++ if (scene->exposure_mode == MMAL_PARAM_EXPOSUREMODE_OFF) ++ shutter_speed = dev->manual_shutter_speed; ++ else ++ shutter_speed = 0; ++ exposure_mode = scene->exposure_mode; ++ metering_mode = scene->metering_mode; ++ ++ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, ++ "%s: scene mode none: shut_speed %d, exp_mode %d, metering %d\n", ++ __func__, shutter_speed, exposure_mode, metering_mode); ++ ++ ret = vchiq_mmal_port_parameter_set(dev->instance, control, ++ MMAL_PARAMETER_SHUTTER_SPEED, ++ &shutter_speed, ++ sizeof(shutter_speed)); ++ ret += vchiq_mmal_port_parameter_set(dev->instance, ++ control, ++ MMAL_PARAMETER_EXPOSURE_MODE, ++ &exposure_mode, ++ sizeof(u32)); ++ dev->exposure_mode_active = exposure_mode; ++ ret += vchiq_mmal_port_parameter_set(dev->instance, control, ++ MMAL_PARAMETER_EXPOSURE_MODE, ++ &exposure_mode, ++ sizeof(u32)); ++ ret += vchiq_mmal_port_parameter_set(dev->instance, control, ++ MMAL_PARAMETER_EXP_METERING_MODE, ++ &metering_mode, ++ sizeof(u32)); ++ ret += set_framerate_params(dev); ++ } ++ if (ret) { ++ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, ++ "%s: Setting scene to %d, ret=%d\n", ++ __func__, ctrl->val, ret); ++ ret = -EINVAL; ++ } ++ return 0; ++} ++ ++static int bm2835_mmal_s_ctrl(struct v4l2_ctrl *ctrl) ++{ ++ struct bm2835_mmal_dev *dev = ++ container_of(ctrl->handler, struct bm2835_mmal_dev, ++ ctrl_handler); ++ const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl = ctrl->priv; ++ int ret; ++ ++ if ((mmal_ctrl == NULL) || ++ (mmal_ctrl->id != ctrl->id) || ++ (mmal_ctrl->setter == NULL)) { ++ pr_warn("mmal_ctrl:%p ctrl id:%d\n", mmal_ctrl, ctrl->id); ++ return -EINVAL; ++ } ++ ++ ret = mmal_ctrl->setter(dev, ctrl, mmal_ctrl); ++ if (ret) ++ pr_warn("ctrl id:%d/MMAL param %08X- returned ret %d\n", ++ ctrl->id, mmal_ctrl->mmal_id, ret); ++ if (mmal_ctrl->ignore_errors) ++ ret = 0; ++ return ret; ++} ++ ++static const struct v4l2_ctrl_ops bm2835_mmal_ctrl_ops = { ++ .s_ctrl = bm2835_mmal_s_ctrl, ++}; ++ ++ ++ ++static const struct bm2835_mmal_v4l2_ctrl v4l2_ctrls[V4L2_CTRL_COUNT] = { ++ { ++ V4L2_CID_SATURATION, MMAL_CONTROL_TYPE_STD, ++ -100, 100, 0, 1, NULL, ++ MMAL_PARAMETER_SATURATION, ++ &ctrl_set_rational, ++ false ++ }, ++ { ++ V4L2_CID_SHARPNESS, MMAL_CONTROL_TYPE_STD, ++ -100, 100, 0, 1, NULL, ++ MMAL_PARAMETER_SHARPNESS, ++ &ctrl_set_rational, ++ false ++ }, ++ { ++ V4L2_CID_CONTRAST, MMAL_CONTROL_TYPE_STD, ++ -100, 100, 0, 1, NULL, ++ MMAL_PARAMETER_CONTRAST, ++ &ctrl_set_rational, ++ false ++ }, ++ { ++ V4L2_CID_BRIGHTNESS, MMAL_CONTROL_TYPE_STD, ++ 0, 100, 50, 1, NULL, ++ MMAL_PARAMETER_BRIGHTNESS, ++ &ctrl_set_rational, ++ false ++ }, ++ { ++ V4L2_CID_ISO_SENSITIVITY, MMAL_CONTROL_TYPE_INT_MENU, ++ 0, ARRAY_SIZE(iso_qmenu) - 1, 0, 1, iso_qmenu, ++ MMAL_PARAMETER_ISO, ++ &ctrl_set_iso, ++ false ++ }, ++ { ++ V4L2_CID_ISO_SENSITIVITY_AUTO, MMAL_CONTROL_TYPE_STD_MENU, ++ 0, 1, V4L2_ISO_SENSITIVITY_AUTO, 1, NULL, ++ MMAL_PARAMETER_ISO, ++ &ctrl_set_iso, ++ false ++ }, ++ { ++ V4L2_CID_IMAGE_STABILIZATION, MMAL_CONTROL_TYPE_STD, ++ 0, 1, 0, 1, NULL, ++ MMAL_PARAMETER_VIDEO_STABILISATION, ++ &ctrl_set_value, ++ false ++ }, ++/* { ++ 0, MMAL_CONTROL_TYPE_CLUSTER, 3, 1, 0, NULL, 0, NULL ++ }, */ ++ { ++ V4L2_CID_EXPOSURE_AUTO, MMAL_CONTROL_TYPE_STD_MENU, ++ ~0x03, 3, V4L2_EXPOSURE_AUTO, 0, NULL, ++ MMAL_PARAMETER_EXPOSURE_MODE, ++ &ctrl_set_exposure, ++ false ++ }, ++/* todo this needs mixing in with set exposure ++ { ++ V4L2_CID_SCENE_MODE, MMAL_CONTROL_TYPE_STD_MENU, ++ }, ++ */ ++ { ++ V4L2_CID_EXPOSURE_ABSOLUTE, MMAL_CONTROL_TYPE_STD, ++ /* Units of 100usecs */ ++ 1, 1*1000*10, 100*10, 1, NULL, ++ MMAL_PARAMETER_SHUTTER_SPEED, ++ &ctrl_set_exposure, ++ false ++ }, ++ { ++ V4L2_CID_AUTO_EXPOSURE_BIAS, MMAL_CONTROL_TYPE_INT_MENU, ++ 0, ARRAY_SIZE(ev_bias_qmenu) - 1, ++ (ARRAY_SIZE(ev_bias_qmenu)+1)/2 - 1, 0, ev_bias_qmenu, ++ MMAL_PARAMETER_EXPOSURE_COMP, ++ &ctrl_set_value_ev, ++ false ++ }, ++ { ++ V4L2_CID_EXPOSURE_AUTO_PRIORITY, MMAL_CONTROL_TYPE_STD, ++ 0, 1, ++ 0, 1, NULL, ++ 0, /* Dummy MMAL ID as it gets mapped into FPS range*/ ++ &ctrl_set_exposure, ++ false ++ }, ++ { ++ V4L2_CID_EXPOSURE_METERING, ++ MMAL_CONTROL_TYPE_STD_MENU, ++ ~0x7, 2, V4L2_EXPOSURE_METERING_AVERAGE, 0, NULL, ++ MMAL_PARAMETER_EXP_METERING_MODE, ++ &ctrl_set_metering_mode, ++ false ++ }, ++ { ++ V4L2_CID_AUTO_N_PRESET_WHITE_BALANCE, ++ MMAL_CONTROL_TYPE_STD_MENU, ++ ~0x3ff, 9, V4L2_WHITE_BALANCE_AUTO, 0, NULL, ++ MMAL_PARAMETER_AWB_MODE, ++ &ctrl_set_awb_mode, ++ false ++ }, ++ { ++ V4L2_CID_RED_BALANCE, MMAL_CONTROL_TYPE_STD, ++ 1, 7999, 1000, 1, NULL, ++ MMAL_PARAMETER_CUSTOM_AWB_GAINS, ++ &ctrl_set_awb_gains, ++ false ++ }, ++ { ++ V4L2_CID_BLUE_BALANCE, MMAL_CONTROL_TYPE_STD, ++ 1, 7999, 1000, 1, NULL, ++ MMAL_PARAMETER_CUSTOM_AWB_GAINS, ++ &ctrl_set_awb_gains, ++ false ++ }, ++ { ++ V4L2_CID_COLORFX, MMAL_CONTROL_TYPE_STD_MENU, ++ 0, 15, V4L2_COLORFX_NONE, 0, NULL, ++ MMAL_PARAMETER_IMAGE_EFFECT, ++ &ctrl_set_image_effect, ++ false ++ }, ++ { ++ V4L2_CID_COLORFX_CBCR, MMAL_CONTROL_TYPE_STD, ++ 0, 0xffff, 0x8080, 1, NULL, ++ MMAL_PARAMETER_COLOUR_EFFECT, ++ &ctrl_set_colfx, ++ false ++ }, ++ { ++ V4L2_CID_ROTATE, MMAL_CONTROL_TYPE_STD, ++ 0, 360, 0, 90, NULL, ++ MMAL_PARAMETER_ROTATION, ++ &ctrl_set_rotate, ++ false ++ }, ++ { ++ V4L2_CID_HFLIP, MMAL_CONTROL_TYPE_STD, ++ 0, 1, 0, 1, NULL, ++ MMAL_PARAMETER_MIRROR, ++ &ctrl_set_flip, ++ false ++ }, ++ { ++ V4L2_CID_VFLIP, MMAL_CONTROL_TYPE_STD, ++ 0, 1, 0, 1, NULL, ++ MMAL_PARAMETER_MIRROR, ++ &ctrl_set_flip, ++ false ++ }, ++ { ++ V4L2_CID_MPEG_VIDEO_BITRATE_MODE, MMAL_CONTROL_TYPE_STD_MENU, ++ 0, ARRAY_SIZE(bitrate_mode_qmenu) - 1, ++ 0, 0, bitrate_mode_qmenu, ++ MMAL_PARAMETER_RATECONTROL, ++ &ctrl_set_bitrate_mode, ++ false ++ }, ++ { ++ V4L2_CID_MPEG_VIDEO_BITRATE, MMAL_CONTROL_TYPE_STD, ++ 25*1000, 25*1000*1000, 10*1000*1000, 25*1000, NULL, ++ MMAL_PARAMETER_VIDEO_BIT_RATE, ++ &ctrl_set_bitrate, ++ false ++ }, ++ { ++ V4L2_CID_JPEG_COMPRESSION_QUALITY, MMAL_CONTROL_TYPE_STD, ++ 1, 100, ++ 30, 1, NULL, ++ MMAL_PARAMETER_JPEG_Q_FACTOR, ++ &ctrl_set_image_encode_output, ++ false ++ }, ++ { ++ V4L2_CID_POWER_LINE_FREQUENCY, MMAL_CONTROL_TYPE_STD_MENU, ++ 0, ARRAY_SIZE(mains_freq_qmenu) - 1, ++ 1, 1, NULL, ++ MMAL_PARAMETER_FLICKER_AVOID, ++ &ctrl_set_flicker_avoidance, ++ false ++ }, ++ { ++ V4L2_CID_MPEG_VIDEO_REPEAT_SEQ_HEADER, MMAL_CONTROL_TYPE_STD, ++ 0, 1, ++ 0, 1, NULL, ++ MMAL_PARAMETER_VIDEO_ENCODE_INLINE_HEADER, ++ &ctrl_set_video_encode_param_output, ++ true /* Errors ignored as requires latest firmware to work */ ++ }, ++ { ++ V4L2_CID_MPEG_VIDEO_H264_PROFILE, ++ MMAL_CONTROL_TYPE_STD_MENU, ++ ~((1<<V4L2_MPEG_VIDEO_H264_PROFILE_BASELINE) | ++ (1<<V4L2_MPEG_VIDEO_H264_PROFILE_CONSTRAINED_BASELINE) | ++ (1<<V4L2_MPEG_VIDEO_H264_PROFILE_MAIN) | ++ (1<<V4L2_MPEG_VIDEO_H264_PROFILE_HIGH)), ++ V4L2_MPEG_VIDEO_H264_PROFILE_HIGH, ++ V4L2_MPEG_VIDEO_H264_PROFILE_HIGH, 1, NULL, ++ MMAL_PARAMETER_PROFILE, ++ &ctrl_set_video_encode_profile_level, ++ false ++ }, ++ { ++ V4L2_CID_MPEG_VIDEO_H264_LEVEL, MMAL_CONTROL_TYPE_STD_MENU, ++ ~((1<<V4L2_MPEG_VIDEO_H264_LEVEL_1_0) | ++ (1<<V4L2_MPEG_VIDEO_H264_LEVEL_1B) | ++ (1<<V4L2_MPEG_VIDEO_H264_LEVEL_1_1) | ++ (1<<V4L2_MPEG_VIDEO_H264_LEVEL_1_2) | ++ (1<<V4L2_MPEG_VIDEO_H264_LEVEL_1_3) | ++ (1<<V4L2_MPEG_VIDEO_H264_LEVEL_2_0) | ++ (1<<V4L2_MPEG_VIDEO_H264_LEVEL_2_1) | ++ (1<<V4L2_MPEG_VIDEO_H264_LEVEL_2_2) | ++ (1<<V4L2_MPEG_VIDEO_H264_LEVEL_3_0) | ++ (1<<V4L2_MPEG_VIDEO_H264_LEVEL_3_1) | ++ (1<<V4L2_MPEG_VIDEO_H264_LEVEL_3_2) | ++ (1<<V4L2_MPEG_VIDEO_H264_LEVEL_4_0)), ++ V4L2_MPEG_VIDEO_H264_LEVEL_4_0, ++ V4L2_MPEG_VIDEO_H264_LEVEL_4_0, 1, NULL, ++ MMAL_PARAMETER_PROFILE, ++ &ctrl_set_video_encode_profile_level, ++ false ++ }, ++ { ++ V4L2_CID_SCENE_MODE, MMAL_CONTROL_TYPE_STD_MENU, ++ -1, /* Min is computed at runtime */ ++ V4L2_SCENE_MODE_TEXT, ++ V4L2_SCENE_MODE_NONE, 1, NULL, ++ MMAL_PARAMETER_PROFILE, ++ &ctrl_set_scene_mode, ++ false ++ }, ++ { ++ V4L2_CID_MPEG_VIDEO_H264_I_PERIOD, MMAL_CONTROL_TYPE_STD, ++ 0, 0x7FFFFFFF, 60, 1, NULL, ++ MMAL_PARAMETER_INTRAPERIOD, ++ &ctrl_set_video_encode_param_output, ++ false ++ }, ++}; ++ ++int bm2835_mmal_set_all_camera_controls(struct bm2835_mmal_dev *dev) ++{ ++ int c; ++ int ret = 0; ++ ++ for (c = 0; c < V4L2_CTRL_COUNT; c++) { ++ if ((dev->ctrls[c]) && (v4l2_ctrls[c].setter)) { ++ ret = v4l2_ctrls[c].setter(dev, dev->ctrls[c], ++ &v4l2_ctrls[c]); ++ if (!v4l2_ctrls[c].ignore_errors && ret) { ++ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, ++ "Failed when setting default values for ctrl %d\n", ++ c); ++ break; ++ } ++ } ++ } ++ return ret; ++} ++ ++int set_framerate_params(struct bm2835_mmal_dev *dev) ++{ ++ struct mmal_parameter_fps_range fps_range; ++ int ret; ++ ++ if ((dev->exposure_mode_active != MMAL_PARAM_EXPOSUREMODE_OFF) && ++ (dev->exp_auto_priority)) { ++ /* Variable FPS. Define min FPS as 1fps. ++ * Max as max defined FPS. ++ */ ++ fps_range.fps_low.num = 1; ++ fps_range.fps_low.den = 1; ++ fps_range.fps_high.num = dev->capture.timeperframe.denominator; ++ fps_range.fps_high.den = dev->capture.timeperframe.numerator; ++ } else { ++ /* Fixed FPS - set min and max to be the same */ ++ fps_range.fps_low.num = fps_range.fps_high.num = ++ dev->capture.timeperframe.denominator; ++ fps_range.fps_low.den = fps_range.fps_high.den = ++ dev->capture.timeperframe.numerator; ++ } ++ ++ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, ++ "Set fps range to %d/%d to %d/%d\n", ++ fps_range.fps_low.num, ++ fps_range.fps_low.den, ++ fps_range.fps_high.num, ++ fps_range.fps_high.den ++ ); ++ ++ ret = vchiq_mmal_port_parameter_set(dev->instance, ++ &dev->component[MMAL_COMPONENT_CAMERA]-> ++ output[MMAL_CAMERA_PORT_PREVIEW], ++ MMAL_PARAMETER_FPS_RANGE, ++ &fps_range, sizeof(fps_range)); ++ ret += vchiq_mmal_port_parameter_set(dev->instance, ++ &dev->component[MMAL_COMPONENT_CAMERA]-> ++ output[MMAL_CAMERA_PORT_VIDEO], ++ MMAL_PARAMETER_FPS_RANGE, ++ &fps_range, sizeof(fps_range)); ++ ret += vchiq_mmal_port_parameter_set(dev->instance, ++ &dev->component[MMAL_COMPONENT_CAMERA]-> ++ output[MMAL_CAMERA_PORT_CAPTURE], ++ MMAL_PARAMETER_FPS_RANGE, ++ &fps_range, sizeof(fps_range)); ++ if (ret) ++ v4l2_dbg(0, bcm2835_v4l2_debug, &dev->v4l2_dev, ++ "Failed to set fps ret %d\n", ++ ret); ++ ++ return ret; ++ ++} ++ ++int bm2835_mmal_init_controls(struct bm2835_mmal_dev *dev, ++ struct v4l2_ctrl_handler *hdl) ++{ ++ int c; ++ const struct bm2835_mmal_v4l2_ctrl *ctrl; ++ ++ v4l2_ctrl_handler_init(hdl, V4L2_CTRL_COUNT); ++ ++ for (c = 0; c < V4L2_CTRL_COUNT; c++) { ++ ctrl = &v4l2_ctrls[c]; ++ ++ switch (ctrl->type) { ++ case MMAL_CONTROL_TYPE_STD: ++ dev->ctrls[c] = v4l2_ctrl_new_std(hdl, ++ &bm2835_mmal_ctrl_ops, ctrl->id, ++ ctrl->min, ctrl->max, ctrl->step, ctrl->def); ++ break; ++ ++ case MMAL_CONTROL_TYPE_STD_MENU: ++ { ++ int mask = ctrl->min; ++ ++ if (ctrl->id == V4L2_CID_SCENE_MODE) { ++ /* Special handling to work out the mask ++ * value based on the scene_configs array ++ * at runtime. Reduces the chance of ++ * mismatches. ++ */ ++ int i; ++ mask = 1<<V4L2_SCENE_MODE_NONE; ++ for (i = 0; ++ i < ARRAY_SIZE(scene_configs); ++ i++) { ++ mask |= 1<<scene_configs[i].v4l2_scene; ++ } ++ mask = ~mask; ++ } ++ ++ dev->ctrls[c] = v4l2_ctrl_new_std_menu(hdl, ++ &bm2835_mmal_ctrl_ops, ctrl->id, ++ ctrl->max, mask, ctrl->def); ++ break; ++ } ++ ++ case MMAL_CONTROL_TYPE_INT_MENU: ++ dev->ctrls[c] = v4l2_ctrl_new_int_menu(hdl, ++ &bm2835_mmal_ctrl_ops, ctrl->id, ++ ctrl->max, ctrl->def, ctrl->imenu); ++ break; ++ ++ case MMAL_CONTROL_TYPE_CLUSTER: ++ /* skip this entry when constructing controls */ ++ continue; ++ } ++ ++ if (hdl->error) ++ break; ++ ++ dev->ctrls[c]->priv = (void *)ctrl; ++ } ++ ++ if (hdl->error) { ++ pr_err("error adding control %d/%d id 0x%x\n", c, ++ V4L2_CTRL_COUNT, ctrl->id); ++ return hdl->error; ++ } ++ ++ for (c = 0; c < V4L2_CTRL_COUNT; c++) { ++ ctrl = &v4l2_ctrls[c]; ++ ++ switch (ctrl->type) { ++ case MMAL_CONTROL_TYPE_CLUSTER: ++ v4l2_ctrl_auto_cluster(ctrl->min, ++ &dev->ctrls[c+1], ++ ctrl->max, ++ ctrl->def); ++ break; ++ ++ case MMAL_CONTROL_TYPE_STD: ++ case MMAL_CONTROL_TYPE_STD_MENU: ++ case MMAL_CONTROL_TYPE_INT_MENU: ++ break; ++ } ++ ++ } ++ ++ return 0; ++} +diff --git a/drivers/media/platform/bcm2835/mmal-common.h b/drivers/media/platform/bcm2835/mmal-common.h +new file mode 100644 +index 0000000..840fd13 +--- /dev/null ++++ b/drivers/media/platform/bcm2835/mmal-common.h +@@ -0,0 +1,53 @@ ++/* ++ * Broadcom BM2835 V4L2 driver ++ * ++ * Copyright © 2013 Raspberry Pi (Trading) Ltd. ++ * ++ * This file is subject to the terms and conditions of the GNU General Public ++ * License. See the file COPYING in the main directory of this archive ++ * for more details. ++ * ++ * Authors: Vincent Sanders <vincent.sanders@collabora.co.uk> ++ * Dave Stevenson <dsteve@broadcom.com> ++ * Simon Mellor <simellor@broadcom.com> ++ * Luke Diamand <luked@broadcom.com> ++ * ++ * MMAL structures ++ * ++ */ ++ ++#define MMAL_FOURCC(a, b, c, d) ((a) | (b << 8) | (c << 16) | (d << 24)) ++#define MMAL_MAGIC MMAL_FOURCC('m', 'm', 'a', 'l') ++ ++/** Special value signalling that time is not known */ ++#define MMAL_TIME_UNKNOWN (1LL<<63) ++ ++/* mapping between v4l and mmal video modes */ ++struct mmal_fmt { ++ char *name; ++ u32 fourcc; /* v4l2 format id */ ++ int flags; /* v4l2 flags field */ ++ u32 mmal; ++ int depth; ++ u32 mmal_component; /* MMAL component index to be used to encode */ ++ u32 ybbp; /* depth of first Y plane for planar formats */ ++}; ++ ++/* buffer for one video frame */ ++struct mmal_buffer { ++ /* v4l buffer data -- must be first */ ++ struct vb2_v4l2_buffer vb; ++ ++ /* list of buffers available */ ++ struct list_head list; ++ ++ void *buffer; /* buffer pointer */ ++ unsigned long buffer_size; /* size of allocated buffer */ ++}; ++ ++/* */ ++struct mmal_colourfx { ++ s32 enable; ++ u32 u; ++ u32 v; ++}; +diff --git a/drivers/media/platform/bcm2835/mmal-encodings.h b/drivers/media/platform/bcm2835/mmal-encodings.h +new file mode 100644 +index 0000000..024d620 +--- /dev/null ++++ b/drivers/media/platform/bcm2835/mmal-encodings.h +@@ -0,0 +1,127 @@ ++/* ++ * Broadcom BM2835 V4L2 driver ++ * ++ * Copyright © 2013 Raspberry Pi (Trading) Ltd. ++ * ++ * This file is subject to the terms and conditions of the GNU General Public ++ * License. See the file COPYING in the main directory of this archive ++ * for more details. ++ * ++ * Authors: Vincent Sanders <vincent.sanders@collabora.co.uk> ++ * Dave Stevenson <dsteve@broadcom.com> ++ * Simon Mellor <simellor@broadcom.com> ++ * Luke Diamand <luked@broadcom.com> ++ */ ++#ifndef MMAL_ENCODINGS_H ++#define MMAL_ENCODINGS_H ++ ++#define MMAL_ENCODING_H264 MMAL_FOURCC('H', '2', '6', '4') ++#define MMAL_ENCODING_H263 MMAL_FOURCC('H', '2', '6', '3') ++#define MMAL_ENCODING_MP4V MMAL_FOURCC('M', 'P', '4', 'V') ++#define MMAL_ENCODING_MP2V MMAL_FOURCC('M', 'P', '2', 'V') ++#define MMAL_ENCODING_MP1V MMAL_FOURCC('M', 'P', '1', 'V') ++#define MMAL_ENCODING_WMV3 MMAL_FOURCC('W', 'M', 'V', '3') ++#define MMAL_ENCODING_WMV2 MMAL_FOURCC('W', 'M', 'V', '2') ++#define MMAL_ENCODING_WMV1 MMAL_FOURCC('W', 'M', 'V', '1') ++#define MMAL_ENCODING_WVC1 MMAL_FOURCC('W', 'V', 'C', '1') ++#define MMAL_ENCODING_VP8 MMAL_FOURCC('V', 'P', '8', ' ') ++#define MMAL_ENCODING_VP7 MMAL_FOURCC('V', 'P', '7', ' ') ++#define MMAL_ENCODING_VP6 MMAL_FOURCC('V', 'P', '6', ' ') ++#define MMAL_ENCODING_THEORA MMAL_FOURCC('T', 'H', 'E', 'O') ++#define MMAL_ENCODING_SPARK MMAL_FOURCC('S', 'P', 'R', 'K') ++#define MMAL_ENCODING_MJPEG MMAL_FOURCC('M', 'J', 'P', 'G') ++ ++#define MMAL_ENCODING_JPEG MMAL_FOURCC('J', 'P', 'E', 'G') ++#define MMAL_ENCODING_GIF MMAL_FOURCC('G', 'I', 'F', ' ') ++#define MMAL_ENCODING_PNG MMAL_FOURCC('P', 'N', 'G', ' ') ++#define MMAL_ENCODING_PPM MMAL_FOURCC('P', 'P', 'M', ' ') ++#define MMAL_ENCODING_TGA MMAL_FOURCC('T', 'G', 'A', ' ') ++#define MMAL_ENCODING_BMP MMAL_FOURCC('B', 'M', 'P', ' ') ++ ++#define MMAL_ENCODING_I420 MMAL_FOURCC('I', '4', '2', '0') ++#define MMAL_ENCODING_I420_SLICE MMAL_FOURCC('S', '4', '2', '0') ++#define MMAL_ENCODING_YV12 MMAL_FOURCC('Y', 'V', '1', '2') ++#define MMAL_ENCODING_I422 MMAL_FOURCC('I', '4', '2', '2') ++#define MMAL_ENCODING_I422_SLICE MMAL_FOURCC('S', '4', '2', '2') ++#define MMAL_ENCODING_YUYV MMAL_FOURCC('Y', 'U', 'Y', 'V') ++#define MMAL_ENCODING_YVYU MMAL_FOURCC('Y', 'V', 'Y', 'U') ++#define MMAL_ENCODING_UYVY MMAL_FOURCC('U', 'Y', 'V', 'Y') ++#define MMAL_ENCODING_VYUY MMAL_FOURCC('V', 'Y', 'U', 'Y') ++#define MMAL_ENCODING_NV12 MMAL_FOURCC('N', 'V', '1', '2') ++#define MMAL_ENCODING_NV21 MMAL_FOURCC('N', 'V', '2', '1') ++#define MMAL_ENCODING_ARGB MMAL_FOURCC('A', 'R', 'G', 'B') ++#define MMAL_ENCODING_RGBA MMAL_FOURCC('R', 'G', 'B', 'A') ++#define MMAL_ENCODING_ABGR MMAL_FOURCC('A', 'B', 'G', 'R') ++#define MMAL_ENCODING_BGRA MMAL_FOURCC('B', 'G', 'R', 'A') ++#define MMAL_ENCODING_RGB16 MMAL_FOURCC('R', 'G', 'B', '2') ++#define MMAL_ENCODING_RGB24 MMAL_FOURCC('R', 'G', 'B', '3') ++#define MMAL_ENCODING_RGB32 MMAL_FOURCC('R', 'G', 'B', '4') ++#define MMAL_ENCODING_BGR16 MMAL_FOURCC('B', 'G', 'R', '2') ++#define MMAL_ENCODING_BGR24 MMAL_FOURCC('B', 'G', 'R', '3') ++#define MMAL_ENCODING_BGR32 MMAL_FOURCC('B', 'G', 'R', '4') ++ ++/** SAND Video (YUVUV128) format, native format understood by VideoCore. ++ * This format is *not* opaque - if requested you will receive full frames ++ * of YUV_UV video. ++ */ ++#define MMAL_ENCODING_YUVUV128 MMAL_FOURCC('S', 'A', 'N', 'D') ++ ++/** VideoCore opaque image format, image handles are returned to ++ * the host but not the actual image data. ++ */ ++#define MMAL_ENCODING_OPAQUE MMAL_FOURCC('O', 'P', 'Q', 'V') ++ ++/** An EGL image handle ++ */ ++#define MMAL_ENCODING_EGL_IMAGE MMAL_FOURCC('E', 'G', 'L', 'I') ++ ++/* }@ */ ++ ++/** \name Pre-defined audio encodings */ ++/* @{ */ ++#define MMAL_ENCODING_PCM_UNSIGNED_BE MMAL_FOURCC('P', 'C', 'M', 'U') ++#define MMAL_ENCODING_PCM_UNSIGNED_LE MMAL_FOURCC('p', 'c', 'm', 'u') ++#define MMAL_ENCODING_PCM_SIGNED_BE MMAL_FOURCC('P', 'C', 'M', 'S') ++#define MMAL_ENCODING_PCM_SIGNED_LE MMAL_FOURCC('p', 'c', 'm', 's') ++#define MMAL_ENCODING_PCM_FLOAT_BE MMAL_FOURCC('P', 'C', 'M', 'F') ++#define MMAL_ENCODING_PCM_FLOAT_LE MMAL_FOURCC('p', 'c', 'm', 'f') ++ ++/* Pre-defined H264 encoding variants */ ++ ++/** ISO 14496-10 Annex B byte stream format */ ++#define MMAL_ENCODING_VARIANT_H264_DEFAULT 0 ++/** ISO 14496-15 AVC stream format */ ++#define MMAL_ENCODING_VARIANT_H264_AVC1 MMAL_FOURCC('A', 'V', 'C', '1') ++/** Implicitly delineated NAL units without emulation prevention */ ++#define MMAL_ENCODING_VARIANT_H264_RAW MMAL_FOURCC('R', 'A', 'W', ' ') ++ ++ ++/** \defgroup MmalColorSpace List of pre-defined video color spaces ++ * This defines a list of common color spaces. This list isn't exhaustive and ++ * is only provided as a convenience to avoid clients having to use FourCC ++ * codes directly. However components are allowed to define and use their own ++ * FourCC codes. ++ */ ++/* @{ */ ++ ++/** Unknown color space */ ++#define MMAL_COLOR_SPACE_UNKNOWN 0 ++/** ITU-R BT.601-5 [SDTV] */ ++#define MMAL_COLOR_SPACE_ITUR_BT601 MMAL_FOURCC('Y', '6', '0', '1') ++/** ITU-R BT.709-3 [HDTV] */ ++#define MMAL_COLOR_SPACE_ITUR_BT709 MMAL_FOURCC('Y', '7', '0', '9') ++/** JPEG JFIF */ ++#define MMAL_COLOR_SPACE_JPEG_JFIF MMAL_FOURCC('Y', 'J', 'F', 'I') ++/** Title 47 Code of Federal Regulations (2003) 73.682 (a) (20) */ ++#define MMAL_COLOR_SPACE_FCC MMAL_FOURCC('Y', 'F', 'C', 'C') ++/** Society of Motion Picture and Television Engineers 240M (1999) */ ++#define MMAL_COLOR_SPACE_SMPTE240M MMAL_FOURCC('Y', '2', '4', '0') ++/** ITU-R BT.470-2 System M */ ++#define MMAL_COLOR_SPACE_BT470_2_M MMAL_FOURCC('Y', '_', '_', 'M') ++/** ITU-R BT.470-2 System BG */ ++#define MMAL_COLOR_SPACE_BT470_2_BG MMAL_FOURCC('Y', '_', 'B', 'G') ++/** JPEG JFIF, but with 16..255 luma */ ++#define MMAL_COLOR_SPACE_JFIF_Y16_255 MMAL_FOURCC('Y', 'Y', '1', '6') ++/* @} MmalColorSpace List */ ++ ++#endif /* MMAL_ENCODINGS_H */ +diff --git a/drivers/media/platform/bcm2835/mmal-msg-common.h b/drivers/media/platform/bcm2835/mmal-msg-common.h +new file mode 100644 +index 0000000..66e8a6e +--- /dev/null ++++ b/drivers/media/platform/bcm2835/mmal-msg-common.h +@@ -0,0 +1,50 @@ ++/* ++ * Broadcom BM2835 V4L2 driver ++ * ++ * Copyright © 2013 Raspberry Pi (Trading) Ltd. ++ * ++ * This file is subject to the terms and conditions of the GNU General Public ++ * License. See the file COPYING in the main directory of this archive ++ * for more details. ++ * ++ * Authors: Vincent Sanders <vincent.sanders@collabora.co.uk> ++ * Dave Stevenson <dsteve@broadcom.com> ++ * Simon Mellor <simellor@broadcom.com> ++ * Luke Diamand <luked@broadcom.com> ++ */ ++ ++#ifndef MMAL_MSG_COMMON_H ++#define MMAL_MSG_COMMON_H ++ ++enum mmal_msg_status { ++ MMAL_MSG_STATUS_SUCCESS = 0, /**< Success */ ++ MMAL_MSG_STATUS_ENOMEM, /**< Out of memory */ ++ MMAL_MSG_STATUS_ENOSPC, /**< Out of resources other than memory */ ++ MMAL_MSG_STATUS_EINVAL, /**< Argument is invalid */ ++ MMAL_MSG_STATUS_ENOSYS, /**< Function not implemented */ ++ MMAL_MSG_STATUS_ENOENT, /**< No such file or directory */ ++ MMAL_MSG_STATUS_ENXIO, /**< No such device or address */ ++ MMAL_MSG_STATUS_EIO, /**< I/O error */ ++ MMAL_MSG_STATUS_ESPIPE, /**< Illegal seek */ ++ MMAL_MSG_STATUS_ECORRUPT, /**< Data is corrupt \attention */ ++ MMAL_MSG_STATUS_ENOTREADY, /**< Component is not ready */ ++ MMAL_MSG_STATUS_ECONFIG, /**< Component is not configured */ ++ MMAL_MSG_STATUS_EISCONN, /**< Port is already connected */ ++ MMAL_MSG_STATUS_ENOTCONN, /**< Port is disconnected */ ++ MMAL_MSG_STATUS_EAGAIN, /**< Resource temporarily unavailable. */ ++ MMAL_MSG_STATUS_EFAULT, /**< Bad address */ ++}; ++ ++struct mmal_rect { ++ s32 x; /**< x coordinate (from left) */ ++ s32 y; /**< y coordinate (from top) */ ++ s32 width; /**< width */ ++ s32 height; /**< height */ ++}; ++ ++struct mmal_rational { ++ s32 num; /**< Numerator */ ++ s32 den; /**< Denominator */ ++}; ++ ++#endif /* MMAL_MSG_COMMON_H */ +diff --git a/drivers/media/platform/bcm2835/mmal-msg-format.h b/drivers/media/platform/bcm2835/mmal-msg-format.h +new file mode 100644 +index 0000000..123d86e +--- /dev/null ++++ b/drivers/media/platform/bcm2835/mmal-msg-format.h +@@ -0,0 +1,81 @@ ++/* ++ * Broadcom BM2835 V4L2 driver ++ * ++ * Copyright © 2013 Raspberry Pi (Trading) Ltd. ++ * ++ * This file is subject to the terms and conditions of the GNU General Public ++ * License. See the file COPYING in the main directory of this archive ++ * for more details. ++ * ++ * Authors: Vincent Sanders <vincent.sanders@collabora.co.uk> ++ * Dave Stevenson <dsteve@broadcom.com> ++ * Simon Mellor <simellor@broadcom.com> ++ * Luke Diamand <luked@broadcom.com> ++ */ ++ ++#ifndef MMAL_MSG_FORMAT_H ++#define MMAL_MSG_FORMAT_H ++ ++#include "mmal-msg-common.h" ++ ++/* MMAL_ES_FORMAT_T */ ++ ++ ++struct mmal_audio_format { ++ u32 channels; /**< Number of audio channels */ ++ u32 sample_rate; /**< Sample rate */ ++ ++ u32 bits_per_sample; /**< Bits per sample */ ++ u32 block_align; /**< Size of a block of data */ ++}; ++ ++struct mmal_video_format { ++ u32 width; /**< Width of frame in pixels */ ++ u32 height; /**< Height of frame in rows of pixels */ ++ struct mmal_rect crop; /**< Visible region of the frame */ ++ struct mmal_rational frame_rate; /**< Frame rate */ ++ struct mmal_rational par; /**< Pixel aspect ratio */ ++ ++ /* FourCC specifying the color space of the video stream. See the ++ * \ref MmalColorSpace "pre-defined color spaces" for some examples. ++ */ ++ u32 color_space; ++}; ++ ++struct mmal_subpicture_format { ++ u32 x_offset; ++ u32 y_offset; ++}; ++ ++union mmal_es_specific_format { ++ struct mmal_audio_format audio; ++ struct mmal_video_format video; ++ struct mmal_subpicture_format subpicture; ++}; ++ ++/** Definition of an elementary stream format (MMAL_ES_FORMAT_T) */ ++struct mmal_es_format { ++ u32 type; /* enum mmal_es_type */ ++ ++ u32 encoding; /* FourCC specifying encoding of the elementary stream.*/ ++ u32 encoding_variant; /* FourCC specifying the specific ++ * encoding variant of the elementary ++ * stream. ++ */ ++ ++ union mmal_es_specific_format *es; /* TODO: pointers in ++ * message serialisation?!? ++ */ ++ /* Type specific ++ * information for the ++ * elementary stream ++ */ ++ ++ u32 bitrate; /**< Bitrate in bits per second */ ++ u32 flags; /**< Flags describing properties of the elementary stream. */ ++ ++ u32 extradata_size; /**< Size of the codec specific data */ ++ u8 *extradata; /**< Codec specific data */ ++}; ++ ++#endif /* MMAL_MSG_FORMAT_H */ +diff --git a/drivers/media/platform/bcm2835/mmal-msg-port.h b/drivers/media/platform/bcm2835/mmal-msg-port.h +new file mode 100644 +index 0000000..a55c1ea +--- /dev/null ++++ b/drivers/media/platform/bcm2835/mmal-msg-port.h +@@ -0,0 +1,107 @@ ++/* ++ * Broadcom BM2835 V4L2 driver ++ * ++ * Copyright © 2013 Raspberry Pi (Trading) Ltd. ++ * ++ * This file is subject to the terms and conditions of the GNU General Public ++ * License. See the file COPYING in the main directory of this archive ++ * for more details. ++ * ++ * Authors: Vincent Sanders <vincent.sanders@collabora.co.uk> ++ * Dave Stevenson <dsteve@broadcom.com> ++ * Simon Mellor <simellor@broadcom.com> ++ * Luke Diamand <luked@broadcom.com> ++ */ ++ ++/* MMAL_PORT_TYPE_T */ ++enum mmal_port_type { ++ MMAL_PORT_TYPE_UNKNOWN = 0, /**< Unknown port type */ ++ MMAL_PORT_TYPE_CONTROL, /**< Control port */ ++ MMAL_PORT_TYPE_INPUT, /**< Input port */ ++ MMAL_PORT_TYPE_OUTPUT, /**< Output port */ ++ MMAL_PORT_TYPE_CLOCK, /**< Clock port */ ++}; ++ ++/** The port is pass-through and doesn't need buffer headers allocated */ ++#define MMAL_PORT_CAPABILITY_PASSTHROUGH 0x01 ++/** The port wants to allocate the buffer payloads. ++ * This signals a preference that payload allocation should be done ++ * on this port for efficiency reasons. */ ++#define MMAL_PORT_CAPABILITY_ALLOCATION 0x02 ++/** The port supports format change events. ++ * This applies to input ports and is used to let the client know ++ * whether the port supports being reconfigured via a format ++ * change event (i.e. without having to disable the port). */ ++#define MMAL_PORT_CAPABILITY_SUPPORTS_EVENT_FORMAT_CHANGE 0x04 ++ ++/* mmal port structure (MMAL_PORT_T) ++ * ++ * most elements are informational only, the pointer values for ++ * interogation messages are generally provided as additional ++ * strucures within the message. When used to set values only teh ++ * buffer_num, buffer_size and userdata parameters are writable. ++ */ ++struct mmal_port { ++ void *priv; /* Private member used by the framework */ ++ const char *name; /* Port name. Used for debugging purposes (RO) */ ++ ++ u32 type; /* Type of the port (RO) enum mmal_port_type */ ++ u16 index; /* Index of the port in its type list (RO) */ ++ u16 index_all; /* Index of the port in the list of all ports (RO) */ ++ ++ u32 is_enabled; /* Indicates whether the port is enabled or not (RO) */ ++ struct mmal_es_format *format; /* Format of the elementary stream */ ++ ++ u32 buffer_num_min; /* Minimum number of buffers the port ++ * requires (RO). This is set by the ++ * component. ++ */ ++ ++ u32 buffer_size_min; /* Minimum size of buffers the port ++ * requires (RO). This is set by the ++ * component. ++ */ ++ ++ u32 buffer_alignment_min; /* Minimum alignment requirement for ++ * the buffers (RO). A value of ++ * zero means no special alignment ++ * requirements. This is set by the ++ * component. ++ */ ++ ++ u32 buffer_num_recommended; /* Number of buffers the port ++ * recommends for optimal ++ * performance (RO). A value of ++ * zero means no special ++ * recommendation. This is set ++ * by the component. ++ */ ++ ++ u32 buffer_size_recommended; /* Size of buffers the port ++ * recommends for optimal ++ * performance (RO). A value of ++ * zero means no special ++ * recommendation. This is set ++ * by the component. ++ */ ++ ++ u32 buffer_num; /* Actual number of buffers the port will use. ++ * This is set by the client. ++ */ ++ ++ u32 buffer_size; /* Actual maximum size of the buffers that ++ * will be sent to the port. This is set by ++ * the client. ++ */ ++ ++ void *component; /* Component this port belongs to (Read Only) */ ++ ++ void *userdata; /* Field reserved for use by the client */ ++ ++ u32 capabilities; /* Flags describing the capabilities of a ++ * port (RO). Bitwise combination of \ref ++ * portcapabilities "Port capabilities" ++ * values. ++ */ ++ ++}; +diff --git a/drivers/media/platform/bcm2835/mmal-msg.h b/drivers/media/platform/bcm2835/mmal-msg.h +new file mode 100644 +index 0000000..67b1076 +--- /dev/null ++++ b/drivers/media/platform/bcm2835/mmal-msg.h +@@ -0,0 +1,404 @@ ++/* ++ * Broadcom BM2835 V4L2 driver ++ * ++ * Copyright © 2013 Raspberry Pi (Trading) Ltd. ++ * ++ * This file is subject to the terms and conditions of the GNU General Public ++ * License. See the file COPYING in the main directory of this archive ++ * for more details. ++ * ++ * Authors: Vincent Sanders <vincent.sanders@collabora.co.uk> ++ * Dave Stevenson <dsteve@broadcom.com> ++ * Simon Mellor <simellor@broadcom.com> ++ * Luke Diamand <luked@broadcom.com> ++ */ ++ ++/* all the data structures which serialise the MMAL protocol. note ++ * these are directly mapped onto the recived message data. ++ * ++ * BEWARE: They seem to *assume* pointers are u32 and that there is no ++ * structure padding! ++ * ++ * NOTE: this implementation uses kernel types to ensure sizes. Rather ++ * than assigning values to enums to force their size the ++ * implementation uses fixed size types and not the enums (though the ++ * comments have the actual enum type ++ */ ++ ++#define VC_MMAL_VER 15 ++#define VC_MMAL_MIN_VER 10 ++#define VC_MMAL_SERVER_NAME MAKE_FOURCC("mmal") ++ ++/* max total message size is 512 bytes */ ++#define MMAL_MSG_MAX_SIZE 512 ++/* with six 32bit header elements max payload is therefore 488 bytes */ ++#define MMAL_MSG_MAX_PAYLOAD 488 ++ ++#include "mmal-msg-common.h" ++#include "mmal-msg-format.h" ++#include "mmal-msg-port.h" ++ ++enum mmal_msg_type { ++ MMAL_MSG_TYPE_QUIT = 1, ++ MMAL_MSG_TYPE_SERVICE_CLOSED, ++ MMAL_MSG_TYPE_GET_VERSION, ++ MMAL_MSG_TYPE_COMPONENT_CREATE, ++ MMAL_MSG_TYPE_COMPONENT_DESTROY, /* 5 */ ++ MMAL_MSG_TYPE_COMPONENT_ENABLE, ++ MMAL_MSG_TYPE_COMPONENT_DISABLE, ++ MMAL_MSG_TYPE_PORT_INFO_GET, ++ MMAL_MSG_TYPE_PORT_INFO_SET, ++ MMAL_MSG_TYPE_PORT_ACTION, /* 10 */ ++ MMAL_MSG_TYPE_BUFFER_FROM_HOST, ++ MMAL_MSG_TYPE_BUFFER_TO_HOST, ++ MMAL_MSG_TYPE_GET_STATS, ++ MMAL_MSG_TYPE_PORT_PARAMETER_SET, ++ MMAL_MSG_TYPE_PORT_PARAMETER_GET, /* 15 */ ++ MMAL_MSG_TYPE_EVENT_TO_HOST, ++ MMAL_MSG_TYPE_GET_CORE_STATS_FOR_PORT, ++ MMAL_MSG_TYPE_OPAQUE_ALLOCATOR, ++ MMAL_MSG_TYPE_CONSUME_MEM, ++ MMAL_MSG_TYPE_LMK, /* 20 */ ++ MMAL_MSG_TYPE_OPAQUE_ALLOCATOR_DESC, ++ MMAL_MSG_TYPE_DRM_GET_LHS32, ++ MMAL_MSG_TYPE_DRM_GET_TIME, ++ MMAL_MSG_TYPE_BUFFER_FROM_HOST_ZEROLEN, ++ MMAL_MSG_TYPE_PORT_FLUSH, /* 25 */ ++ MMAL_MSG_TYPE_HOST_LOG, ++ MMAL_MSG_TYPE_MSG_LAST ++}; ++ ++/* port action request messages differ depending on the action type */ ++enum mmal_msg_port_action_type { ++ MMAL_MSG_PORT_ACTION_TYPE_UNKNOWN = 0, /* Unkown action */ ++ MMAL_MSG_PORT_ACTION_TYPE_ENABLE, /* Enable a port */ ++ MMAL_MSG_PORT_ACTION_TYPE_DISABLE, /* Disable a port */ ++ MMAL_MSG_PORT_ACTION_TYPE_FLUSH, /* Flush a port */ ++ MMAL_MSG_PORT_ACTION_TYPE_CONNECT, /* Connect ports */ ++ MMAL_MSG_PORT_ACTION_TYPE_DISCONNECT, /* Disconnect ports */ ++ MMAL_MSG_PORT_ACTION_TYPE_SET_REQUIREMENTS, /* Set buffer requirements*/ ++}; ++ ++struct mmal_msg_header { ++ u32 magic; ++ u32 type; /** enum mmal_msg_type */ ++ ++ /* Opaque handle to the control service */ ++ struct mmal_control_service *control_service; ++ ++ struct mmal_msg_context *context; /** a u32 per message context */ ++ u32 status; /** The status of the vchiq operation */ ++ u32 padding; ++}; ++ ++/* Send from VC to host to report version */ ++struct mmal_msg_version { ++ u32 flags; ++ u32 major; ++ u32 minor; ++ u32 minimum; ++}; ++ ++/* request to VC to create component */ ++struct mmal_msg_component_create { ++ void *client_component; /* component context */ ++ char name[128]; ++ u32 pid; /* For debug */ ++}; ++ ++/* reply from VC to component creation request */ ++struct mmal_msg_component_create_reply { ++ u32 status; /** enum mmal_msg_status - how does this differ to ++ * the one in the header? ++ */ ++ u32 component_handle; /* VideoCore handle for component */ ++ u32 input_num; /* Number of input ports */ ++ u32 output_num; /* Number of output ports */ ++ u32 clock_num; /* Number of clock ports */ ++}; ++ ++/* request to VC to destroy a component */ ++struct mmal_msg_component_destroy { ++ u32 component_handle; ++}; ++ ++struct mmal_msg_component_destroy_reply { ++ u32 status; /** The component destruction status */ ++}; ++ ++ ++/* request and reply to VC to enable a component */ ++struct mmal_msg_component_enable { ++ u32 component_handle; ++}; ++ ++struct mmal_msg_component_enable_reply { ++ u32 status; /** The component enable status */ ++}; ++ ++ ++/* request and reply to VC to disable a component */ ++struct mmal_msg_component_disable { ++ u32 component_handle; ++}; ++ ++struct mmal_msg_component_disable_reply { ++ u32 status; /** The component disable status */ ++}; ++ ++/* request to VC to get port information */ ++struct mmal_msg_port_info_get { ++ u32 component_handle; /* component handle port is associated with */ ++ u32 port_type; /* enum mmal_msg_port_type */ ++ u32 index; /* port index to query */ ++}; ++ ++/* reply from VC to get port info request */ ++struct mmal_msg_port_info_get_reply { ++ u32 status; /** enum mmal_msg_status */ ++ u32 component_handle; /* component handle port is associated with */ ++ u32 port_type; /* enum mmal_msg_port_type */ ++ u32 port_index; /* port indexed in query */ ++ s32 found; /* unused */ ++ u32 port_handle; /**< Handle to use for this port */ ++ struct mmal_port port; ++ struct mmal_es_format format; /* elementry stream format */ ++ union mmal_es_specific_format es; /* es type specific data */ ++ u8 extradata[MMAL_FORMAT_EXTRADATA_MAX_SIZE]; /* es extra data */ ++}; ++ ++/* request to VC to set port information */ ++struct mmal_msg_port_info_set { ++ u32 component_handle; ++ u32 port_type; /* enum mmal_msg_port_type */ ++ u32 port_index; /* port indexed in query */ ++ struct mmal_port port; ++ struct mmal_es_format format; ++ union mmal_es_specific_format es; ++ u8 extradata[MMAL_FORMAT_EXTRADATA_MAX_SIZE]; ++}; ++ ++/* reply from VC to port info set request */ ++struct mmal_msg_port_info_set_reply { ++ u32 status; ++ u32 component_handle; /* component handle port is associated with */ ++ u32 port_type; /* enum mmal_msg_port_type */ ++ u32 index; /* port indexed in query */ ++ s32 found; /* unused */ ++ u32 port_handle; /**< Handle to use for this port */ ++ struct mmal_port port; ++ struct mmal_es_format format; ++ union mmal_es_specific_format es; ++ u8 extradata[MMAL_FORMAT_EXTRADATA_MAX_SIZE]; ++}; ++ ++ ++/* port action requests that take a mmal_port as a parameter */ ++struct mmal_msg_port_action_port { ++ u32 component_handle; ++ u32 port_handle; ++ u32 action; /* enum mmal_msg_port_action_type */ ++ struct mmal_port port; ++}; ++ ++/* port action requests that take handles as a parameter */ ++struct mmal_msg_port_action_handle { ++ u32 component_handle; ++ u32 port_handle; ++ u32 action; /* enum mmal_msg_port_action_type */ ++ u32 connect_component_handle; ++ u32 connect_port_handle; ++}; ++ ++struct mmal_msg_port_action_reply { ++ u32 status; /** The port action operation status */ ++}; ++ ++ ++ ++ ++/* MMAL buffer transfer */ ++ ++/** Size of space reserved in a buffer message for short messages. */ ++#define MMAL_VC_SHORT_DATA 128 ++ ++/** Signals that the current payload is the end of the stream of data */ ++#define MMAL_BUFFER_HEADER_FLAG_EOS (1<<0) ++/** Signals that the start of the current payload starts a frame */ ++#define MMAL_BUFFER_HEADER_FLAG_FRAME_START (1<<1) ++/** Signals that the end of the current payload ends a frame */ ++#define MMAL_BUFFER_HEADER_FLAG_FRAME_END (1<<2) ++/** Signals that the current payload contains only complete frames (>1) */ ++#define MMAL_BUFFER_HEADER_FLAG_FRAME \ ++ (MMAL_BUFFER_HEADER_FLAG_FRAME_START|MMAL_BUFFER_HEADER_FLAG_FRAME_END) ++/** Signals that the current payload is a keyframe (i.e. self decodable) */ ++#define MMAL_BUFFER_HEADER_FLAG_KEYFRAME (1<<3) ++/** Signals a discontinuity in the stream of data (e.g. after a seek). ++ * Can be used for instance by a decoder to reset its state */ ++#define MMAL_BUFFER_HEADER_FLAG_DISCONTINUITY (1<<4) ++/** Signals a buffer containing some kind of config data for the component ++ * (e.g. codec config data) */ ++#define MMAL_BUFFER_HEADER_FLAG_CONFIG (1<<5) ++/** Signals an encrypted payload */ ++#define MMAL_BUFFER_HEADER_FLAG_ENCRYPTED (1<<6) ++/** Signals a buffer containing side information */ ++#define MMAL_BUFFER_HEADER_FLAG_CODECSIDEINFO (1<<7) ++/** Signals a buffer which is the snapshot/postview image from a stills ++ * capture ++ */ ++#define MMAL_BUFFER_HEADER_FLAGS_SNAPSHOT (1<<8) ++/** Signals a buffer which contains data known to be corrupted */ ++#define MMAL_BUFFER_HEADER_FLAG_CORRUPTED (1<<9) ++/** Signals that a buffer failed to be transmitted */ ++#define MMAL_BUFFER_HEADER_FLAG_TRANSMISSION_FAILED (1<<10) ++ ++struct mmal_driver_buffer { ++ u32 magic; ++ u32 component_handle; ++ u32 port_handle; ++ void *client_context; ++}; ++ ++/* buffer header */ ++struct mmal_buffer_header { ++ struct mmal_buffer_header *next; /* next header */ ++ void *priv; /* framework private data */ ++ u32 cmd; ++ void *data; ++ u32 alloc_size; ++ u32 length; ++ u32 offset; ++ u32 flags; ++ s64 pts; ++ s64 dts; ++ void *type; ++ void *user_data; ++}; ++ ++struct mmal_buffer_header_type_specific { ++ union { ++ struct { ++ u32 planes; ++ u32 offset[4]; ++ u32 pitch[4]; ++ u32 flags; ++ } video; ++ } u; ++}; ++ ++struct mmal_msg_buffer_from_host { ++ /* The front 32 bytes of the buffer header are copied ++ * back to us in the reply to allow for context. This ++ * area is used to store two mmal_driver_buffer structures to ++ * allow for multiple concurrent service users. ++ */ ++ /* control data */ ++ struct mmal_driver_buffer drvbuf; ++ ++ /* referenced control data for passthrough buffer management */ ++ struct mmal_driver_buffer drvbuf_ref; ++ struct mmal_buffer_header buffer_header; /* buffer header itself */ ++ struct mmal_buffer_header_type_specific buffer_header_type_specific; ++ s32 is_zero_copy; ++ s32 has_reference; ++ ++ /** allows short data to be xfered in control message */ ++ u32 payload_in_message; ++ u8 short_data[MMAL_VC_SHORT_DATA]; ++}; ++ ++ ++/* port parameter setting */ ++ ++#define MMAL_WORKER_PORT_PARAMETER_SPACE 96 ++ ++struct mmal_msg_port_parameter_set { ++ u32 component_handle; /* component */ ++ u32 port_handle; /* port */ ++ u32 id; /* Parameter ID */ ++ u32 size; /* Parameter size */ ++ uint32_t value[MMAL_WORKER_PORT_PARAMETER_SPACE]; ++}; ++ ++struct mmal_msg_port_parameter_set_reply { ++ u32 status; /** enum mmal_msg_status todo: how does this ++ * differ to the one in the header? ++ */ ++}; ++ ++/* port parameter getting */ ++ ++struct mmal_msg_port_parameter_get { ++ u32 component_handle; /* component */ ++ u32 port_handle; /* port */ ++ u32 id; /* Parameter ID */ ++ u32 size; /* Parameter size */ ++}; ++ ++struct mmal_msg_port_parameter_get_reply { ++ u32 status; /* Status of mmal_port_parameter_get call */ ++ u32 id; /* Parameter ID */ ++ u32 size; /* Parameter size */ ++ uint32_t value[MMAL_WORKER_PORT_PARAMETER_SPACE]; ++}; ++ ++/* event messages */ ++#define MMAL_WORKER_EVENT_SPACE 256 ++ ++struct mmal_msg_event_to_host { ++ void *client_component; /* component context */ ++ ++ u32 port_type; ++ u32 port_num; ++ ++ u32 cmd; ++ u32 length; ++ u8 data[MMAL_WORKER_EVENT_SPACE]; ++ struct mmal_buffer_header *delayed_buffer; ++}; ++ ++/* all mmal messages are serialised through this structure */ ++struct mmal_msg { ++ /* header */ ++ struct mmal_msg_header h; ++ /* payload */ ++ union { ++ struct mmal_msg_version version; ++ ++ struct mmal_msg_component_create component_create; ++ struct mmal_msg_component_create_reply component_create_reply; ++ ++ struct mmal_msg_component_destroy component_destroy; ++ struct mmal_msg_component_destroy_reply component_destroy_reply; ++ ++ struct mmal_msg_component_enable component_enable; ++ struct mmal_msg_component_enable_reply component_enable_reply; ++ ++ struct mmal_msg_component_disable component_disable; ++ struct mmal_msg_component_disable_reply component_disable_reply; ++ ++ struct mmal_msg_port_info_get port_info_get; ++ struct mmal_msg_port_info_get_reply port_info_get_reply; ++ ++ struct mmal_msg_port_info_set port_info_set; ++ struct mmal_msg_port_info_set_reply port_info_set_reply; ++ ++ struct mmal_msg_port_action_port port_action_port; ++ struct mmal_msg_port_action_handle port_action_handle; ++ struct mmal_msg_port_action_reply port_action_reply; ++ ++ struct mmal_msg_buffer_from_host buffer_from_host; ++ ++ struct mmal_msg_port_parameter_set port_parameter_set; ++ struct mmal_msg_port_parameter_set_reply ++ port_parameter_set_reply; ++ struct mmal_msg_port_parameter_get ++ port_parameter_get; ++ struct mmal_msg_port_parameter_get_reply ++ port_parameter_get_reply; ++ ++ struct mmal_msg_event_to_host event_to_host; ++ ++ u8 payload[MMAL_MSG_MAX_PAYLOAD]; ++ } u; ++}; +diff --git a/drivers/media/platform/bcm2835/mmal-parameters.h b/drivers/media/platform/bcm2835/mmal-parameters.h +new file mode 100644 +index 0000000..f6abb5c +--- /dev/null ++++ b/drivers/media/platform/bcm2835/mmal-parameters.h +@@ -0,0 +1,689 @@ ++/* ++ * Broadcom BM2835 V4L2 driver ++ * ++ * Copyright © 2013 Raspberry Pi (Trading) Ltd. ++ * ++ * This file is subject to the terms and conditions of the GNU General Public ++ * License. See the file COPYING in the main directory of this archive ++ * for more details. ++ * ++ * Authors: Vincent Sanders <vincent.sanders@collabora.co.uk> ++ * Dave Stevenson <dsteve@broadcom.com> ++ * Simon Mellor <simellor@broadcom.com> ++ * Luke Diamand <luked@broadcom.com> ++ */ ++ ++/* common parameters */ ++ ++/** @name Parameter groups ++ * Parameters are divided into groups, and then allocated sequentially within ++ * a group using an enum. ++ * @{ ++ */ ++ ++/** Common parameter ID group, used with many types of component. */ ++#define MMAL_PARAMETER_GROUP_COMMON (0<<16) ++/** Camera-specific parameter ID group. */ ++#define MMAL_PARAMETER_GROUP_CAMERA (1<<16) ++/** Video-specific parameter ID group. */ ++#define MMAL_PARAMETER_GROUP_VIDEO (2<<16) ++/** Audio-specific parameter ID group. */ ++#define MMAL_PARAMETER_GROUP_AUDIO (3<<16) ++/** Clock-specific parameter ID group. */ ++#define MMAL_PARAMETER_GROUP_CLOCK (4<<16) ++/** Miracast-specific parameter ID group. */ ++#define MMAL_PARAMETER_GROUP_MIRACAST (5<<16) ++ ++/* Common parameters */ ++enum mmal_parameter_common_type { ++ MMAL_PARAMETER_UNUSED /**< Never a valid parameter ID */ ++ = MMAL_PARAMETER_GROUP_COMMON, ++ MMAL_PARAMETER_SUPPORTED_ENCODINGS, /**< MMAL_PARAMETER_ENCODING_T */ ++ MMAL_PARAMETER_URI, /**< MMAL_PARAMETER_URI_T */ ++ ++ /** MMAL_PARAMETER_CHANGE_EVENT_REQUEST_T */ ++ MMAL_PARAMETER_CHANGE_EVENT_REQUEST, ++ ++ /** MMAL_PARAMETER_BOOLEAN_T */ ++ MMAL_PARAMETER_ZERO_COPY, ++ ++ /**< MMAL_PARAMETER_BUFFER_REQUIREMENTS_T */ ++ MMAL_PARAMETER_BUFFER_REQUIREMENTS, ++ ++ MMAL_PARAMETER_STATISTICS, /**< MMAL_PARAMETER_STATISTICS_T */ ++ MMAL_PARAMETER_CORE_STATISTICS, /**< MMAL_PARAMETER_CORE_STATISTICS_T */ ++ MMAL_PARAMETER_MEM_USAGE, /**< MMAL_PARAMETER_MEM_USAGE_T */ ++ MMAL_PARAMETER_BUFFER_FLAG_FILTER, /**< MMAL_PARAMETER_UINT32_T */ ++ MMAL_PARAMETER_SEEK, /**< MMAL_PARAMETER_SEEK_T */ ++ MMAL_PARAMETER_POWERMON_ENABLE, /**< MMAL_PARAMETER_BOOLEAN_T */ ++ MMAL_PARAMETER_LOGGING, /**< MMAL_PARAMETER_LOGGING_T */ ++ MMAL_PARAMETER_SYSTEM_TIME, /**< MMAL_PARAMETER_UINT64_T */ ++ MMAL_PARAMETER_NO_IMAGE_PADDING /**< MMAL_PARAMETER_BOOLEAN_T */ ++}; ++ ++/* camera parameters */ ++ ++enum mmal_parameter_camera_type { ++ /* 0 */ ++ /** @ref MMAL_PARAMETER_THUMBNAIL_CONFIG_T */ ++ MMAL_PARAMETER_THUMBNAIL_CONFIGURATION ++ = MMAL_PARAMETER_GROUP_CAMERA, ++ MMAL_PARAMETER_CAPTURE_QUALITY, /**< Unused? */ ++ MMAL_PARAMETER_ROTATION, /**< @ref MMAL_PARAMETER_INT32_T */ ++ MMAL_PARAMETER_EXIF_DISABLE, /**< @ref MMAL_PARAMETER_BOOLEAN_T */ ++ MMAL_PARAMETER_EXIF, /**< @ref MMAL_PARAMETER_EXIF_T */ ++ MMAL_PARAMETER_AWB_MODE, /**< @ref MMAL_PARAM_AWBMODE_T */ ++ MMAL_PARAMETER_IMAGE_EFFECT, /**< @ref MMAL_PARAMETER_IMAGEFX_T */ ++ MMAL_PARAMETER_COLOUR_EFFECT, /**< @ref MMAL_PARAMETER_COLOURFX_T */ ++ MMAL_PARAMETER_FLICKER_AVOID, /**< @ref MMAL_PARAMETER_FLICKERAVOID_T */ ++ MMAL_PARAMETER_FLASH, /**< @ref MMAL_PARAMETER_FLASH_T */ ++ MMAL_PARAMETER_REDEYE, /**< @ref MMAL_PARAMETER_REDEYE_T */ ++ MMAL_PARAMETER_FOCUS, /**< @ref MMAL_PARAMETER_FOCUS_T */ ++ MMAL_PARAMETER_FOCAL_LENGTHS, /**< Unused? */ ++ MMAL_PARAMETER_EXPOSURE_COMP, /**< @ref MMAL_PARAMETER_INT32_T */ ++ MMAL_PARAMETER_ZOOM, /**< @ref MMAL_PARAMETER_SCALEFACTOR_T */ ++ MMAL_PARAMETER_MIRROR, /**< @ref MMAL_PARAMETER_MIRROR_T */ ++ ++ /* 0x10 */ ++ MMAL_PARAMETER_CAMERA_NUM, /**< @ref MMAL_PARAMETER_UINT32_T */ ++ MMAL_PARAMETER_CAPTURE, /**< @ref MMAL_PARAMETER_BOOLEAN_T */ ++ MMAL_PARAMETER_EXPOSURE_MODE, /**< @ref MMAL_PARAMETER_EXPOSUREMODE_T */ ++ MMAL_PARAMETER_EXP_METERING_MODE, /**< @ref MMAL_PARAMETER_EXPOSUREMETERINGMODE_T */ ++ MMAL_PARAMETER_FOCUS_STATUS, /**< @ref MMAL_PARAMETER_FOCUS_STATUS_T */ ++ MMAL_PARAMETER_CAMERA_CONFIG, /**< @ref MMAL_PARAMETER_CAMERA_CONFIG_T */ ++ MMAL_PARAMETER_CAPTURE_STATUS, /**< @ref MMAL_PARAMETER_CAPTURE_STATUS_T */ ++ MMAL_PARAMETER_FACE_TRACK, /**< @ref MMAL_PARAMETER_FACE_TRACK_T */ ++ MMAL_PARAMETER_DRAW_BOX_FACES_AND_FOCUS, /**< @ref MMAL_PARAMETER_BOOLEAN_T */ ++ MMAL_PARAMETER_JPEG_Q_FACTOR, /**< @ref MMAL_PARAMETER_UINT32_T */ ++ MMAL_PARAMETER_FRAME_RATE, /**< @ref MMAL_PARAMETER_FRAME_RATE_T */ ++ MMAL_PARAMETER_USE_STC, /**< @ref MMAL_PARAMETER_CAMERA_STC_MODE_T */ ++ MMAL_PARAMETER_CAMERA_INFO, /**< @ref MMAL_PARAMETER_CAMERA_INFO_T */ ++ MMAL_PARAMETER_VIDEO_STABILISATION, /**< @ref MMAL_PARAMETER_BOOLEAN_T */ ++ MMAL_PARAMETER_FACE_TRACK_RESULTS, /**< @ref MMAL_PARAMETER_FACE_TRACK_RESULTS_T */ ++ MMAL_PARAMETER_ENABLE_RAW_CAPTURE, /**< @ref MMAL_PARAMETER_BOOLEAN_T */ ++ ++ /* 0x20 */ ++ MMAL_PARAMETER_DPF_FILE, /**< @ref MMAL_PARAMETER_URI_T */ ++ MMAL_PARAMETER_ENABLE_DPF_FILE, /**< @ref MMAL_PARAMETER_BOOLEAN_T */ ++ MMAL_PARAMETER_DPF_FAIL_IS_FATAL, /**< @ref MMAL_PARAMETER_BOOLEAN_T */ ++ MMAL_PARAMETER_CAPTURE_MODE, /**< @ref MMAL_PARAMETER_CAPTUREMODE_T */ ++ MMAL_PARAMETER_FOCUS_REGIONS, /**< @ref MMAL_PARAMETER_FOCUS_REGIONS_T */ ++ MMAL_PARAMETER_INPUT_CROP, /**< @ref MMAL_PARAMETER_INPUT_CROP_T */ ++ MMAL_PARAMETER_SENSOR_INFORMATION, /**< @ref MMAL_PARAMETER_SENSOR_INFORMATION_T */ ++ MMAL_PARAMETER_FLASH_SELECT, /**< @ref MMAL_PARAMETER_FLASH_SELECT_T */ ++ MMAL_PARAMETER_FIELD_OF_VIEW, /**< @ref MMAL_PARAMETER_FIELD_OF_VIEW_T */ ++ MMAL_PARAMETER_HIGH_DYNAMIC_RANGE, /**< @ref MMAL_PARAMETER_BOOLEAN_T */ ++ MMAL_PARAMETER_DYNAMIC_RANGE_COMPRESSION, /**< @ref MMAL_PARAMETER_DRC_T */ ++ MMAL_PARAMETER_ALGORITHM_CONTROL, /**< @ref MMAL_PARAMETER_ALGORITHM_CONTROL_T */ ++ MMAL_PARAMETER_SHARPNESS, /**< @ref MMAL_PARAMETER_RATIONAL_T */ ++ MMAL_PARAMETER_CONTRAST, /**< @ref MMAL_PARAMETER_RATIONAL_T */ ++ MMAL_PARAMETER_BRIGHTNESS, /**< @ref MMAL_PARAMETER_RATIONAL_T */ ++ MMAL_PARAMETER_SATURATION, /**< @ref MMAL_PARAMETER_RATIONAL_T */ ++ ++ /* 0x30 */ ++ MMAL_PARAMETER_ISO, /**< @ref MMAL_PARAMETER_UINT32_T */ ++ MMAL_PARAMETER_ANTISHAKE, /**< @ref MMAL_PARAMETER_BOOLEAN_T */ ++ ++ /** @ref MMAL_PARAMETER_IMAGEFX_PARAMETERS_T */ ++ MMAL_PARAMETER_IMAGE_EFFECT_PARAMETERS, ++ ++ /** @ref MMAL_PARAMETER_BOOLEAN_T */ ++ MMAL_PARAMETER_CAMERA_BURST_CAPTURE, ++ ++ /** @ref MMAL_PARAMETER_UINT32_T */ ++ MMAL_PARAMETER_CAMERA_MIN_ISO, ++ ++ /** @ref MMAL_PARAMETER_CAMERA_USE_CASE_T */ ++ MMAL_PARAMETER_CAMERA_USE_CASE, ++ ++ /**< @ref MMAL_PARAMETER_BOOLEAN_T */ ++ MMAL_PARAMETER_CAPTURE_STATS_PASS, ++ ++ /** @ref MMAL_PARAMETER_UINT32_T */ ++ MMAL_PARAMETER_CAMERA_CUSTOM_SENSOR_CONFIG, ++ ++ /** @ref MMAL_PARAMETER_BOOLEAN_T */ ++ MMAL_PARAMETER_ENABLE_REGISTER_FILE, ++ ++ /** @ref MMAL_PARAMETER_BOOLEAN_T */ ++ MMAL_PARAMETER_REGISTER_FAIL_IS_FATAL, ++ ++ /** @ref MMAL_PARAMETER_CONFIGFILE_T */ ++ MMAL_PARAMETER_CONFIGFILE_REGISTERS, ++ ++ /** @ref MMAL_PARAMETER_CONFIGFILE_CHUNK_T */ ++ MMAL_PARAMETER_CONFIGFILE_CHUNK_REGISTERS, ++ MMAL_PARAMETER_JPEG_ATTACH_LOG, /**< @ref MMAL_PARAMETER_BOOLEAN_T */ ++ MMAL_PARAMETER_ZERO_SHUTTER_LAG, /**< @ref MMAL_PARAMETER_ZEROSHUTTERLAG_T */ ++ MMAL_PARAMETER_FPS_RANGE, /**< @ref MMAL_PARAMETER_FPS_RANGE_T */ ++ MMAL_PARAMETER_CAPTURE_EXPOSURE_COMP, /**< @ref MMAL_PARAMETER_INT32_T */ ++ ++ /* 0x40 */ ++ MMAL_PARAMETER_SW_SHARPEN_DISABLE, /**< @ref MMAL_PARAMETER_BOOLEAN_T */ ++ MMAL_PARAMETER_FLASH_REQUIRED, /**< @ref MMAL_PARAMETER_BOOLEAN_T */ ++ MMAL_PARAMETER_SW_SATURATION_DISABLE, /**< @ref MMAL_PARAMETER_BOOLEAN_T */ ++ MMAL_PARAMETER_SHUTTER_SPEED, /**< Takes a @ref MMAL_PARAMETER_UINT32_T */ ++ MMAL_PARAMETER_CUSTOM_AWB_GAINS, /**< Takes a @ref MMAL_PARAMETER_AWB_GAINS_T */ ++}; ++ ++struct mmal_parameter_rational { ++ s32 num; /**< Numerator */ ++ s32 den; /**< Denominator */ ++}; ++ ++enum mmal_parameter_camera_config_timestamp_mode { ++ MMAL_PARAM_TIMESTAMP_MODE_ZERO = 0, /* Always timestamp frames as 0 */ ++ MMAL_PARAM_TIMESTAMP_MODE_RAW_STC, /* Use the raw STC value ++ * for the frame timestamp ++ */ ++ MMAL_PARAM_TIMESTAMP_MODE_RESET_STC, /* Use the STC timestamp ++ * but subtract the ++ * timestamp of the first ++ * frame sent to give a ++ * zero based timestamp. ++ */ ++}; ++ ++struct mmal_parameter_fps_range { ++ /**< Low end of the permitted framerate range */ ++ struct mmal_parameter_rational fps_low; ++ /**< High end of the permitted framerate range */ ++ struct mmal_parameter_rational fps_high; ++}; ++ ++ ++/* camera configuration parameter */ ++struct mmal_parameter_camera_config { ++ /* Parameters for setting up the image pools */ ++ u32 max_stills_w; /* Max size of stills capture */ ++ u32 max_stills_h; ++ u32 stills_yuv422; /* Allow YUV422 stills capture */ ++ u32 one_shot_stills; /* Continuous or one shot stills captures. */ ++ ++ u32 max_preview_video_w; /* Max size of the preview or video ++ * capture frames ++ */ ++ u32 max_preview_video_h; ++ u32 num_preview_video_frames; ++ ++ /** Sets the height of the circular buffer for stills capture. */ ++ u32 stills_capture_circular_buffer_height; ++ ++ /** Allows preview/encode to resume as fast as possible after the stills ++ * input frame has been received, and then processes the still frame in ++ * the background whilst preview/encode has resumed. ++ * Actual mode is controlled by MMAL_PARAMETER_CAPTURE_MODE. ++ */ ++ u32 fast_preview_resume; ++ ++ /** Selects algorithm for timestamping frames if ++ * there is no clock component connected. ++ * enum mmal_parameter_camera_config_timestamp_mode ++ */ ++ s32 use_stc_timestamp; ++}; ++ ++ ++enum mmal_parameter_exposuremode { ++ MMAL_PARAM_EXPOSUREMODE_OFF, ++ MMAL_PARAM_EXPOSUREMODE_AUTO, ++ MMAL_PARAM_EXPOSUREMODE_NIGHT, ++ MMAL_PARAM_EXPOSUREMODE_NIGHTPREVIEW, ++ MMAL_PARAM_EXPOSUREMODE_BACKLIGHT, ++ MMAL_PARAM_EXPOSUREMODE_SPOTLIGHT, ++ MMAL_PARAM_EXPOSUREMODE_SPORTS, ++ MMAL_PARAM_EXPOSUREMODE_SNOW, ++ MMAL_PARAM_EXPOSUREMODE_BEACH, ++ MMAL_PARAM_EXPOSUREMODE_VERYLONG, ++ MMAL_PARAM_EXPOSUREMODE_FIXEDFPS, ++ MMAL_PARAM_EXPOSUREMODE_ANTISHAKE, ++ MMAL_PARAM_EXPOSUREMODE_FIREWORKS, ++}; ++ ++enum mmal_parameter_exposuremeteringmode { ++ MMAL_PARAM_EXPOSUREMETERINGMODE_AVERAGE, ++ MMAL_PARAM_EXPOSUREMETERINGMODE_SPOT, ++ MMAL_PARAM_EXPOSUREMETERINGMODE_BACKLIT, ++ MMAL_PARAM_EXPOSUREMETERINGMODE_MATRIX, ++}; ++ ++enum mmal_parameter_awbmode { ++ MMAL_PARAM_AWBMODE_OFF, ++ MMAL_PARAM_AWBMODE_AUTO, ++ MMAL_PARAM_AWBMODE_SUNLIGHT, ++ MMAL_PARAM_AWBMODE_CLOUDY, ++ MMAL_PARAM_AWBMODE_SHADE, ++ MMAL_PARAM_AWBMODE_TUNGSTEN, ++ MMAL_PARAM_AWBMODE_FLUORESCENT, ++ MMAL_PARAM_AWBMODE_INCANDESCENT, ++ MMAL_PARAM_AWBMODE_FLASH, ++ MMAL_PARAM_AWBMODE_HORIZON, ++}; ++ ++enum mmal_parameter_imagefx { ++ MMAL_PARAM_IMAGEFX_NONE, ++ MMAL_PARAM_IMAGEFX_NEGATIVE, ++ MMAL_PARAM_IMAGEFX_SOLARIZE, ++ MMAL_PARAM_IMAGEFX_POSTERIZE, ++ MMAL_PARAM_IMAGEFX_WHITEBOARD, ++ MMAL_PARAM_IMAGEFX_BLACKBOARD, ++ MMAL_PARAM_IMAGEFX_SKETCH, ++ MMAL_PARAM_IMAGEFX_DENOISE, ++ MMAL_PARAM_IMAGEFX_EMBOSS, ++ MMAL_PARAM_IMAGEFX_OILPAINT, ++ MMAL_PARAM_IMAGEFX_HATCH, ++ MMAL_PARAM_IMAGEFX_GPEN, ++ MMAL_PARAM_IMAGEFX_PASTEL, ++ MMAL_PARAM_IMAGEFX_WATERCOLOUR, ++ MMAL_PARAM_IMAGEFX_FILM, ++ MMAL_PARAM_IMAGEFX_BLUR, ++ MMAL_PARAM_IMAGEFX_SATURATION, ++ MMAL_PARAM_IMAGEFX_COLOURSWAP, ++ MMAL_PARAM_IMAGEFX_WASHEDOUT, ++ MMAL_PARAM_IMAGEFX_POSTERISE, ++ MMAL_PARAM_IMAGEFX_COLOURPOINT, ++ MMAL_PARAM_IMAGEFX_COLOURBALANCE, ++ MMAL_PARAM_IMAGEFX_CARTOON, ++}; ++ ++enum MMAL_PARAM_FLICKERAVOID_T { ++ MMAL_PARAM_FLICKERAVOID_OFF, ++ MMAL_PARAM_FLICKERAVOID_AUTO, ++ MMAL_PARAM_FLICKERAVOID_50HZ, ++ MMAL_PARAM_FLICKERAVOID_60HZ, ++ MMAL_PARAM_FLICKERAVOID_MAX = 0x7FFFFFFF ++}; ++ ++struct mmal_parameter_awbgains { ++ struct mmal_parameter_rational r_gain; /**< Red gain */ ++ struct mmal_parameter_rational b_gain; /**< Blue gain */ ++}; ++ ++/** Manner of video rate control */ ++enum mmal_parameter_rate_control_mode { ++ MMAL_VIDEO_RATECONTROL_DEFAULT, ++ MMAL_VIDEO_RATECONTROL_VARIABLE, ++ MMAL_VIDEO_RATECONTROL_CONSTANT, ++ MMAL_VIDEO_RATECONTROL_VARIABLE_SKIP_FRAMES, ++ MMAL_VIDEO_RATECONTROL_CONSTANT_SKIP_FRAMES ++}; ++ ++enum mmal_video_profile { ++ MMAL_VIDEO_PROFILE_H263_BASELINE, ++ MMAL_VIDEO_PROFILE_H263_H320CODING, ++ MMAL_VIDEO_PROFILE_H263_BACKWARDCOMPATIBLE, ++ MMAL_VIDEO_PROFILE_H263_ISWV2, ++ MMAL_VIDEO_PROFILE_H263_ISWV3, ++ MMAL_VIDEO_PROFILE_H263_HIGHCOMPRESSION, ++ MMAL_VIDEO_PROFILE_H263_INTERNET, ++ MMAL_VIDEO_PROFILE_H263_INTERLACE, ++ MMAL_VIDEO_PROFILE_H263_HIGHLATENCY, ++ MMAL_VIDEO_PROFILE_MP4V_SIMPLE, ++ MMAL_VIDEO_PROFILE_MP4V_SIMPLESCALABLE, ++ MMAL_VIDEO_PROFILE_MP4V_CORE, ++ MMAL_VIDEO_PROFILE_MP4V_MAIN, ++ MMAL_VIDEO_PROFILE_MP4V_NBIT, ++ MMAL_VIDEO_PROFILE_MP4V_SCALABLETEXTURE, ++ MMAL_VIDEO_PROFILE_MP4V_SIMPLEFACE, ++ MMAL_VIDEO_PROFILE_MP4V_SIMPLEFBA, ++ MMAL_VIDEO_PROFILE_MP4V_BASICANIMATED, ++ MMAL_VIDEO_PROFILE_MP4V_HYBRID, ++ MMAL_VIDEO_PROFILE_MP4V_ADVANCEDREALTIME, ++ MMAL_VIDEO_PROFILE_MP4V_CORESCALABLE, ++ MMAL_VIDEO_PROFILE_MP4V_ADVANCEDCODING, ++ MMAL_VIDEO_PROFILE_MP4V_ADVANCEDCORE, ++ MMAL_VIDEO_PROFILE_MP4V_ADVANCEDSCALABLE, ++ MMAL_VIDEO_PROFILE_MP4V_ADVANCEDSIMPLE, ++ MMAL_VIDEO_PROFILE_H264_BASELINE, ++ MMAL_VIDEO_PROFILE_H264_MAIN, ++ MMAL_VIDEO_PROFILE_H264_EXTENDED, ++ MMAL_VIDEO_PROFILE_H264_HIGH, ++ MMAL_VIDEO_PROFILE_H264_HIGH10, ++ MMAL_VIDEO_PROFILE_H264_HIGH422, ++ MMAL_VIDEO_PROFILE_H264_HIGH444, ++ MMAL_VIDEO_PROFILE_H264_CONSTRAINED_BASELINE, ++ MMAL_VIDEO_PROFILE_DUMMY = 0x7FFFFFFF ++}; ++ ++enum mmal_video_level { ++ MMAL_VIDEO_LEVEL_H263_10, ++ MMAL_VIDEO_LEVEL_H263_20, ++ MMAL_VIDEO_LEVEL_H263_30, ++ MMAL_VIDEO_LEVEL_H263_40, ++ MMAL_VIDEO_LEVEL_H263_45, ++ MMAL_VIDEO_LEVEL_H263_50, ++ MMAL_VIDEO_LEVEL_H263_60, ++ MMAL_VIDEO_LEVEL_H263_70, ++ MMAL_VIDEO_LEVEL_MP4V_0, ++ MMAL_VIDEO_LEVEL_MP4V_0b, ++ MMAL_VIDEO_LEVEL_MP4V_1, ++ MMAL_VIDEO_LEVEL_MP4V_2, ++ MMAL_VIDEO_LEVEL_MP4V_3, ++ MMAL_VIDEO_LEVEL_MP4V_4, ++ MMAL_VIDEO_LEVEL_MP4V_4a, ++ MMAL_VIDEO_LEVEL_MP4V_5, ++ MMAL_VIDEO_LEVEL_MP4V_6, ++ MMAL_VIDEO_LEVEL_H264_1, ++ MMAL_VIDEO_LEVEL_H264_1b, ++ MMAL_VIDEO_LEVEL_H264_11, ++ MMAL_VIDEO_LEVEL_H264_12, ++ MMAL_VIDEO_LEVEL_H264_13, ++ MMAL_VIDEO_LEVEL_H264_2, ++ MMAL_VIDEO_LEVEL_H264_21, ++ MMAL_VIDEO_LEVEL_H264_22, ++ MMAL_VIDEO_LEVEL_H264_3, ++ MMAL_VIDEO_LEVEL_H264_31, ++ MMAL_VIDEO_LEVEL_H264_32, ++ MMAL_VIDEO_LEVEL_H264_4, ++ MMAL_VIDEO_LEVEL_H264_41, ++ MMAL_VIDEO_LEVEL_H264_42, ++ MMAL_VIDEO_LEVEL_H264_5, ++ MMAL_VIDEO_LEVEL_H264_51, ++ MMAL_VIDEO_LEVEL_DUMMY = 0x7FFFFFFF ++}; ++ ++struct mmal_parameter_video_profile { ++ enum mmal_video_profile profile; ++ enum mmal_video_level level; ++}; ++ ++/* video parameters */ ++ ++enum mmal_parameter_video_type { ++ /** @ref MMAL_DISPLAYREGION_T */ ++ MMAL_PARAMETER_DISPLAYREGION = MMAL_PARAMETER_GROUP_VIDEO, ++ ++ /** @ref MMAL_PARAMETER_VIDEO_PROFILE_T */ ++ MMAL_PARAMETER_SUPPORTED_PROFILES, ++ ++ /** @ref MMAL_PARAMETER_VIDEO_PROFILE_T */ ++ MMAL_PARAMETER_PROFILE, ++ ++ /** @ref MMAL_PARAMETER_UINT32_T */ ++ MMAL_PARAMETER_INTRAPERIOD, ++ ++ /** @ref MMAL_PARAMETER_VIDEO_RATECONTROL_T */ ++ MMAL_PARAMETER_RATECONTROL, ++ ++ /** @ref MMAL_PARAMETER_VIDEO_NALUNITFORMAT_T */ ++ MMAL_PARAMETER_NALUNITFORMAT, ++ ++ /** @ref MMAL_PARAMETER_BOOLEAN_T */ ++ MMAL_PARAMETER_MINIMISE_FRAGMENTATION, ++ ++ /** @ref MMAL_PARAMETER_UINT32_T. ++ * Setting the value to zero resets to the default (one slice per frame). ++ */ ++ MMAL_PARAMETER_MB_ROWS_PER_SLICE, ++ ++ /** @ref MMAL_PARAMETER_VIDEO_LEVEL_EXTENSION_T */ ++ MMAL_PARAMETER_VIDEO_LEVEL_EXTENSION, ++ ++ /** @ref MMAL_PARAMETER_VIDEO_EEDE_ENABLE_T */ ++ MMAL_PARAMETER_VIDEO_EEDE_ENABLE, ++ ++ /** @ref MMAL_PARAMETER_VIDEO_EEDE_LOSSRATE_T */ ++ MMAL_PARAMETER_VIDEO_EEDE_LOSSRATE, ++ ++ /** @ref MMAL_PARAMETER_BOOLEAN_T. Request an I-frame. */ ++ MMAL_PARAMETER_VIDEO_REQUEST_I_FRAME, ++ /** @ref MMAL_PARAMETER_VIDEO_INTRA_REFRESH_T */ ++ MMAL_PARAMETER_VIDEO_INTRA_REFRESH, ++ ++ /** @ref MMAL_PARAMETER_BOOLEAN_T. */ ++ MMAL_PARAMETER_VIDEO_IMMUTABLE_INPUT, ++ ++ /** @ref MMAL_PARAMETER_UINT32_T. Run-time bit rate control */ ++ MMAL_PARAMETER_VIDEO_BIT_RATE, ++ ++ /** @ref MMAL_PARAMETER_FRAME_RATE_T */ ++ MMAL_PARAMETER_VIDEO_FRAME_RATE, ++ ++ /** @ref MMAL_PARAMETER_UINT32_T. */ ++ MMAL_PARAMETER_VIDEO_ENCODE_MIN_QUANT, ++ ++ /** @ref MMAL_PARAMETER_UINT32_T. */ ++ MMAL_PARAMETER_VIDEO_ENCODE_MAX_QUANT, ++ ++ /** @ref MMAL_PARAMETER_VIDEO_ENCODE_RC_MODEL_T. */ ++ MMAL_PARAMETER_VIDEO_ENCODE_RC_MODEL, ++ ++ MMAL_PARAMETER_EXTRA_BUFFERS, /**< @ref MMAL_PARAMETER_UINT32_T. */ ++ /** @ref MMAL_PARAMETER_UINT32_T. ++ * Changing this parameter from the default can reduce frame rate ++ * because image buffers need to be re-pitched. ++ */ ++ MMAL_PARAMETER_VIDEO_ALIGN_HORIZ, ++ ++ /** @ref MMAL_PARAMETER_UINT32_T. ++ * Changing this parameter from the default can reduce frame rate ++ * because image buffers need to be re-pitched. ++ */ ++ MMAL_PARAMETER_VIDEO_ALIGN_VERT, ++ ++ /** @ref MMAL_PARAMETER_BOOLEAN_T. */ ++ MMAL_PARAMETER_VIDEO_DROPPABLE_PFRAMES, ++ ++ /** @ref MMAL_PARAMETER_UINT32_T. */ ++ MMAL_PARAMETER_VIDEO_ENCODE_INITIAL_QUANT, ++ ++ /**< @ref MMAL_PARAMETER_UINT32_T. */ ++ MMAL_PARAMETER_VIDEO_ENCODE_QP_P, ++ ++ /**< @ref MMAL_PARAMETER_UINT32_T. */ ++ MMAL_PARAMETER_VIDEO_ENCODE_RC_SLICE_DQUANT, ++ ++ /** @ref MMAL_PARAMETER_UINT32_T */ ++ MMAL_PARAMETER_VIDEO_ENCODE_FRAME_LIMIT_BITS, ++ ++ /** @ref MMAL_PARAMETER_UINT32_T. */ ++ MMAL_PARAMETER_VIDEO_ENCODE_PEAK_RATE, ++ ++ /* H264 specific parameters */ ++ ++ /** @ref MMAL_PARAMETER_BOOLEAN_T. */ ++ MMAL_PARAMETER_VIDEO_ENCODE_H264_DISABLE_CABAC, ++ ++ /** @ref MMAL_PARAMETER_BOOLEAN_T. */ ++ MMAL_PARAMETER_VIDEO_ENCODE_H264_LOW_LATENCY, ++ ++ /** @ref MMAL_PARAMETER_BOOLEAN_T. */ ++ MMAL_PARAMETER_VIDEO_ENCODE_H264_AU_DELIMITERS, ++ ++ /** @ref MMAL_PARAMETER_UINT32_T. */ ++ MMAL_PARAMETER_VIDEO_ENCODE_H264_DEBLOCK_IDC, ++ ++ /** @ref MMAL_PARAMETER_VIDEO_ENCODER_H264_MB_INTRA_MODES_T. */ ++ MMAL_PARAMETER_VIDEO_ENCODE_H264_MB_INTRA_MODE, ++ ++ /** @ref MMAL_PARAMETER_BOOLEAN_T */ ++ MMAL_PARAMETER_VIDEO_ENCODE_HEADER_ON_OPEN, ++ ++ /** @ref MMAL_PARAMETER_BOOLEAN_T */ ++ MMAL_PARAMETER_VIDEO_ENCODE_PRECODE_FOR_QP, ++ ++ /** @ref MMAL_PARAMETER_VIDEO_DRM_INIT_INFO_T. */ ++ MMAL_PARAMETER_VIDEO_DRM_INIT_INFO, ++ ++ /** @ref MMAL_PARAMETER_BOOLEAN_T */ ++ MMAL_PARAMETER_VIDEO_TIMESTAMP_FIFO, ++ ++ /** @ref MMAL_PARAMETER_BOOLEAN_T */ ++ MMAL_PARAMETER_VIDEO_DECODE_ERROR_CONCEALMENT, ++ ++ /** @ref MMAL_PARAMETER_VIDEO_DRM_PROTECT_BUFFER_T. */ ++ MMAL_PARAMETER_VIDEO_DRM_PROTECT_BUFFER, ++ ++ /** @ref MMAL_PARAMETER_BYTES_T */ ++ MMAL_PARAMETER_VIDEO_DECODE_CONFIG_VD3, ++ ++ /**< @ref MMAL_PARAMETER_BOOLEAN_T */ ++ MMAL_PARAMETER_VIDEO_ENCODE_H264_VCL_HRD_PARAMETERS, ++ ++ /**< @ref MMAL_PARAMETER_BOOLEAN_T */ ++ MMAL_PARAMETER_VIDEO_ENCODE_H264_LOW_DELAY_HRD_FLAG, ++ ++ /**< @ref MMAL_PARAMETER_BOOLEAN_T */ ++ MMAL_PARAMETER_VIDEO_ENCODE_INLINE_HEADER ++}; ++ ++/** Valid mirror modes */ ++enum mmal_parameter_mirror { ++ MMAL_PARAM_MIRROR_NONE, ++ MMAL_PARAM_MIRROR_VERTICAL, ++ MMAL_PARAM_MIRROR_HORIZONTAL, ++ MMAL_PARAM_MIRROR_BOTH, ++}; ++ ++enum mmal_parameter_displaytransform { ++ MMAL_DISPLAY_ROT0 = 0, ++ MMAL_DISPLAY_MIRROR_ROT0 = 1, ++ MMAL_DISPLAY_MIRROR_ROT180 = 2, ++ MMAL_DISPLAY_ROT180 = 3, ++ MMAL_DISPLAY_MIRROR_ROT90 = 4, ++ MMAL_DISPLAY_ROT270 = 5, ++ MMAL_DISPLAY_ROT90 = 6, ++ MMAL_DISPLAY_MIRROR_ROT270 = 7, ++}; ++ ++enum mmal_parameter_displaymode { ++ MMAL_DISPLAY_MODE_FILL = 0, ++ MMAL_DISPLAY_MODE_LETTERBOX = 1, ++}; ++ ++enum mmal_parameter_displayset { ++ MMAL_DISPLAY_SET_NONE = 0, ++ MMAL_DISPLAY_SET_NUM = 1, ++ MMAL_DISPLAY_SET_FULLSCREEN = 2, ++ MMAL_DISPLAY_SET_TRANSFORM = 4, ++ MMAL_DISPLAY_SET_DEST_RECT = 8, ++ MMAL_DISPLAY_SET_SRC_RECT = 0x10, ++ MMAL_DISPLAY_SET_MODE = 0x20, ++ MMAL_DISPLAY_SET_PIXEL = 0x40, ++ MMAL_DISPLAY_SET_NOASPECT = 0x80, ++ MMAL_DISPLAY_SET_LAYER = 0x100, ++ MMAL_DISPLAY_SET_COPYPROTECT = 0x200, ++ MMAL_DISPLAY_SET_ALPHA = 0x400, ++}; ++ ++struct mmal_parameter_displayregion { ++ /** Bitfield that indicates which fields are set and should be ++ * used. All other fields will maintain their current value. ++ * \ref MMAL_DISPLAYSET_T defines the bits that can be ++ * combined. ++ */ ++ u32 set; ++ ++ /** Describes the display output device, with 0 typically ++ * being a directly connected LCD display. The actual values ++ * will depend on the hardware. Code using hard-wired numbers ++ * (e.g. 2) is certain to fail. ++ */ ++ ++ u32 display_num; ++ /** Indicates that we are using the full device screen area, ++ * rather than a window of the display. If zero, then ++ * dest_rect is used to specify a region of the display to ++ * use. ++ */ ++ ++ s32 fullscreen; ++ /** Indicates any rotation or flipping used to map frames onto ++ * the natural display orientation. ++ */ ++ u32 transform; /* enum mmal_parameter_displaytransform */ ++ ++ /** Where to display the frame within the screen, if ++ * fullscreen is zero. ++ */ ++ struct vchiq_mmal_rect dest_rect; ++ ++ /** Indicates which area of the frame to display. If all ++ * values are zero, the whole frame will be used. ++ */ ++ struct vchiq_mmal_rect src_rect; ++ ++ /** If set to non-zero, indicates that any display scaling ++ * should disregard the aspect ratio of the frame region being ++ * displayed. ++ */ ++ s32 noaspect; ++ ++ /** Indicates how the image should be scaled to fit the ++ * display. \code MMAL_DISPLAY_MODE_FILL \endcode indicates ++ * that the image should fill the screen by potentially ++ * cropping the frames. Setting \code mode \endcode to \code ++ * MMAL_DISPLAY_MODE_LETTERBOX \endcode indicates that all the ++ * source region should be displayed and black bars added if ++ * necessary. ++ */ ++ u32 mode; /* enum mmal_parameter_displaymode */ ++ ++ /** If non-zero, defines the width of a source pixel relative ++ * to \code pixel_y \endcode. If zero, then pixels default to ++ * being square. ++ */ ++ u32 pixel_x; ++ ++ /** If non-zero, defines the height of a source pixel relative ++ * to \code pixel_x \endcode. If zero, then pixels default to ++ * being square. ++ */ ++ u32 pixel_y; ++ ++ /** Sets the relative depth of the images, with greater values ++ * being in front of smaller values. ++ */ ++ u32 layer; ++ ++ /** Set to non-zero to ensure copy protection is used on ++ * output. ++ */ ++ s32 copyprotect_required; ++ ++ /** Level of opacity of the layer, where zero is fully ++ * transparent and 255 is fully opaque. ++ */ ++ u32 alpha; ++}; ++ ++#define MMAL_MAX_IMAGEFX_PARAMETERS 5 ++ ++struct mmal_parameter_imagefx_parameters { ++ enum mmal_parameter_imagefx effect; ++ u32 num_effect_params; ++ u32 effect_parameter[MMAL_MAX_IMAGEFX_PARAMETERS]; ++}; ++ ++#define MMAL_PARAMETER_CAMERA_INFO_MAX_CAMERAS 4 ++#define MMAL_PARAMETER_CAMERA_INFO_MAX_FLASHES 2 ++#define MMAL_PARAMETER_CAMERA_INFO_MAX_STR_LEN 16 ++ ++struct mmal_parameter_camera_info_camera_t { ++ u32 port_id; ++ u32 max_width; ++ u32 max_height; ++ u32 lens_present; ++ u8 camera_name[MMAL_PARAMETER_CAMERA_INFO_MAX_STR_LEN]; ++}; ++ ++enum mmal_parameter_camera_info_flash_type_t { ++ /* Make values explicit to ensure they match values in config ini */ ++ MMAL_PARAMETER_CAMERA_INFO_FLASH_TYPE_XENON = 0, ++ MMAL_PARAMETER_CAMERA_INFO_FLASH_TYPE_LED = 1, ++ MMAL_PARAMETER_CAMERA_INFO_FLASH_TYPE_OTHER = 2, ++ MMAL_PARAMETER_CAMERA_INFO_FLASH_TYPE_MAX = 0x7FFFFFFF ++}; ++ ++struct mmal_parameter_camera_info_flash_t { ++ enum mmal_parameter_camera_info_flash_type_t flash_type; ++}; ++ ++struct mmal_parameter_camera_info_t { ++ u32 num_cameras; ++ u32 num_flashes; ++ struct mmal_parameter_camera_info_camera_t ++ cameras[MMAL_PARAMETER_CAMERA_INFO_MAX_CAMERAS]; ++ struct mmal_parameter_camera_info_flash_t ++ flashes[MMAL_PARAMETER_CAMERA_INFO_MAX_FLASHES]; ++}; +diff --git a/drivers/media/platform/bcm2835/mmal-vchiq.c b/drivers/media/platform/bcm2835/mmal-vchiq.c +new file mode 100644 +index 0000000..78132254 +--- /dev/null ++++ b/drivers/media/platform/bcm2835/mmal-vchiq.c +@@ -0,0 +1,1916 @@ ++/* ++ * Broadcom BM2835 V4L2 driver ++ * ++ * Copyright © 2013 Raspberry Pi (Trading) Ltd. ++ * ++ * This file is subject to the terms and conditions of the GNU General Public ++ * License. See the file COPYING in the main directory of this archive ++ * for more details. ++ * ++ * Authors: Vincent Sanders <vincent.sanders@collabora.co.uk> ++ * Dave Stevenson <dsteve@broadcom.com> ++ * Simon Mellor <simellor@broadcom.com> ++ * Luke Diamand <luked@broadcom.com> ++ * ++ * V4L2 driver MMAL vchiq interface code ++ */ ++ ++#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt ++ ++#include <linux/errno.h> ++#include <linux/kernel.h> ++#include <linux/mutex.h> ++#include <linux/mm.h> ++#include <linux/slab.h> ++#include <linux/completion.h> ++#include <linux/vmalloc.h> ++#include <asm/cacheflush.h> ++#include <media/videobuf2-vmalloc.h> ++ ++#include "mmal-common.h" ++#include "mmal-vchiq.h" ++#include "mmal-msg.h" ++ ++#define USE_VCHIQ_ARM ++#include "interface/vchi/vchi.h" ++ ++/* maximum number of components supported */ ++#define VCHIQ_MMAL_MAX_COMPONENTS 4 ++ ++/*#define FULL_MSG_DUMP 1*/ ++ ++#ifdef DEBUG ++static const char *const msg_type_names[] = { ++ "UNKNOWN", ++ "QUIT", ++ "SERVICE_CLOSED", ++ "GET_VERSION", ++ "COMPONENT_CREATE", ++ "COMPONENT_DESTROY", ++ "COMPONENT_ENABLE", ++ "COMPONENT_DISABLE", ++ "PORT_INFO_GET", ++ "PORT_INFO_SET", ++ "PORT_ACTION", ++ "BUFFER_FROM_HOST", ++ "BUFFER_TO_HOST", ++ "GET_STATS", ++ "PORT_PARAMETER_SET", ++ "PORT_PARAMETER_GET", ++ "EVENT_TO_HOST", ++ "GET_CORE_STATS_FOR_PORT", ++ "OPAQUE_ALLOCATOR", ++ "CONSUME_MEM", ++ "LMK", ++ "OPAQUE_ALLOCATOR_DESC", ++ "DRM_GET_LHS32", ++ "DRM_GET_TIME", ++ "BUFFER_FROM_HOST_ZEROLEN", ++ "PORT_FLUSH", ++ "HOST_LOG", ++}; ++#endif ++ ++static const char *const port_action_type_names[] = { ++ "UNKNOWN", ++ "ENABLE", ++ "DISABLE", ++ "FLUSH", ++ "CONNECT", ++ "DISCONNECT", ++ "SET_REQUIREMENTS", ++}; ++ ++#if defined(DEBUG) ++#if defined(FULL_MSG_DUMP) ++#define DBG_DUMP_MSG(MSG, MSG_LEN, TITLE) \ ++ do { \ ++ pr_debug(TITLE" type:%s(%d) length:%d\n", \ ++ msg_type_names[(MSG)->h.type], \ ++ (MSG)->h.type, (MSG_LEN)); \ ++ print_hex_dump(KERN_DEBUG, "<<h: ", DUMP_PREFIX_OFFSET, \ ++ 16, 4, (MSG), \ ++ sizeof(struct mmal_msg_header), 1); \ ++ print_hex_dump(KERN_DEBUG, "<<p: ", DUMP_PREFIX_OFFSET, \ ++ 16, 4, \ ++ ((u8 *)(MSG)) + sizeof(struct mmal_msg_header),\ ++ (MSG_LEN) - sizeof(struct mmal_msg_header), 1); \ ++ } while (0) ++#else ++#define DBG_DUMP_MSG(MSG, MSG_LEN, TITLE) \ ++ { \ ++ pr_debug(TITLE" type:%s(%d) length:%d\n", \ ++ msg_type_names[(MSG)->h.type], \ ++ (MSG)->h.type, (MSG_LEN)); \ ++ } ++#endif ++#else ++#define DBG_DUMP_MSG(MSG, MSG_LEN, TITLE) ++#endif ++ ++/* normal message context */ ++struct mmal_msg_context { ++ union { ++ struct { ++ /* work struct for defered callback - must come first */ ++ struct work_struct work; ++ /* mmal instance */ ++ struct vchiq_mmal_instance *instance; ++ /* mmal port */ ++ struct vchiq_mmal_port *port; ++ /* actual buffer used to store bulk reply */ ++ struct mmal_buffer *buffer; ++ /* amount of buffer used */ ++ unsigned long buffer_used; ++ /* MMAL buffer flags */ ++ u32 mmal_flags; ++ /* Presentation and Decode timestamps */ ++ s64 pts; ++ s64 dts; ++ ++ int status; /* context status */ ++ ++ } bulk; /* bulk data */ ++ ++ struct { ++ /* message handle to release */ ++ VCHI_HELD_MSG_T msg_handle; ++ /* pointer to received message */ ++ struct mmal_msg *msg; ++ /* received message length */ ++ u32 msg_len; ++ /* completion upon reply */ ++ struct completion cmplt; ++ } sync; /* synchronous response */ ++ } u; ++ ++}; ++ ++struct vchiq_mmal_instance { ++ VCHI_SERVICE_HANDLE_T handle; ++ ++ /* ensure serialised access to service */ ++ struct mutex vchiq_mutex; ++ ++ /* ensure serialised access to bulk operations */ ++ struct mutex bulk_mutex; ++ ++ /* vmalloc page to receive scratch bulk xfers into */ ++ void *bulk_scratch; ++ ++ /* component to use next */ ++ int component_idx; ++ struct vchiq_mmal_component component[VCHIQ_MMAL_MAX_COMPONENTS]; ++}; ++ ++static struct mmal_msg_context *get_msg_context(struct vchiq_mmal_instance ++ *instance) ++{ ++ struct mmal_msg_context *msg_context; ++ ++ /* todo: should this be allocated from a pool to avoid kmalloc */ ++ msg_context = kmalloc(sizeof(*msg_context), GFP_KERNEL); ++ memset(msg_context, 0, sizeof(*msg_context)); ++ ++ return msg_context; ++} ++ ++static void release_msg_context(struct mmal_msg_context *msg_context) ++{ ++ kfree(msg_context); ++} ++ ++/* deals with receipt of event to host message */ ++static void event_to_host_cb(struct vchiq_mmal_instance *instance, ++ struct mmal_msg *msg, u32 msg_len) ++{ ++ pr_debug("unhandled event\n"); ++ pr_debug("component:%p port type:%d num:%d cmd:0x%x length:%d\n", ++ msg->u.event_to_host.client_component, ++ msg->u.event_to_host.port_type, ++ msg->u.event_to_host.port_num, ++ msg->u.event_to_host.cmd, msg->u.event_to_host.length); ++} ++ ++/* workqueue scheduled callback ++ * ++ * we do this because it is important we do not call any other vchiq ++ * sync calls from witin the message delivery thread ++ */ ++static void buffer_work_cb(struct work_struct *work) ++{ ++ struct mmal_msg_context *msg_context = (struct mmal_msg_context *)work; ++ ++ msg_context->u.bulk.port->buffer_cb(msg_context->u.bulk.instance, ++ msg_context->u.bulk.port, ++ msg_context->u.bulk.status, ++ msg_context->u.bulk.buffer, ++ msg_context->u.bulk.buffer_used, ++ msg_context->u.bulk.mmal_flags, ++ msg_context->u.bulk.dts, ++ msg_context->u.bulk.pts); ++ ++ /* release message context */ ++ release_msg_context(msg_context); ++} ++ ++/* enqueue a bulk receive for a given message context */ ++static int bulk_receive(struct vchiq_mmal_instance *instance, ++ struct mmal_msg *msg, ++ struct mmal_msg_context *msg_context) ++{ ++ unsigned long rd_len; ++ unsigned long flags = 0; ++ int ret; ++ ++ /* bulk mutex stops other bulk operations while we have a ++ * receive in progress - released in callback ++ */ ++ ret = mutex_lock_interruptible(&instance->bulk_mutex); ++ if (ret != 0) ++ return ret; ++ ++ rd_len = msg->u.buffer_from_host.buffer_header.length; ++ ++ /* take buffer from queue */ ++ spin_lock_irqsave(&msg_context->u.bulk.port->slock, flags); ++ if (list_empty(&msg_context->u.bulk.port->buffers)) { ++ spin_unlock_irqrestore(&msg_context->u.bulk.port->slock, flags); ++ pr_err("buffer list empty trying to submit bulk receive\n"); ++ ++ /* todo: this is a serious error, we should never have ++ * commited a buffer_to_host operation to the mmal ++ * port without the buffer to back it up (underflow ++ * handling) and there is no obvious way to deal with ++ * this - how is the mmal servie going to react when ++ * we fail to do the xfer and reschedule a buffer when ++ * it arrives? perhaps a starved flag to indicate a ++ * waiting bulk receive? ++ */ ++ ++ mutex_unlock(&instance->bulk_mutex); ++ ++ return -EINVAL; ++ } ++ ++ msg_context->u.bulk.buffer = ++ list_entry(msg_context->u.bulk.port->buffers.next, ++ struct mmal_buffer, list); ++ list_del(&msg_context->u.bulk.buffer->list); ++ ++ spin_unlock_irqrestore(&msg_context->u.bulk.port->slock, flags); ++ ++ /* ensure we do not overrun the available buffer */ ++ if (rd_len > msg_context->u.bulk.buffer->buffer_size) { ++ rd_len = msg_context->u.bulk.buffer->buffer_size; ++ pr_warn("short read as not enough receive buffer space\n"); ++ /* todo: is this the correct response, what happens to ++ * the rest of the message data? ++ */ ++ } ++ ++ /* store length */ ++ msg_context->u.bulk.buffer_used = rd_len; ++ msg_context->u.bulk.mmal_flags = ++ msg->u.buffer_from_host.buffer_header.flags; ++ msg_context->u.bulk.dts = msg->u.buffer_from_host.buffer_header.dts; ++ msg_context->u.bulk.pts = msg->u.buffer_from_host.buffer_header.pts; ++ ++ // only need to flush L1 cache here, as VCHIQ takes care of the L2 ++ // cache. ++ __cpuc_flush_dcache_area(msg_context->u.bulk.buffer->buffer, rd_len); ++ ++ /* queue the bulk submission */ ++ vchi_service_use(instance->handle); ++ ret = vchi_bulk_queue_receive(instance->handle, ++ msg_context->u.bulk.buffer->buffer, ++ /* Actual receive needs to be a multiple ++ * of 4 bytes ++ */ ++ (rd_len + 3) & ~3, ++ VCHI_FLAGS_CALLBACK_WHEN_OP_COMPLETE | ++ VCHI_FLAGS_BLOCK_UNTIL_QUEUED, ++ msg_context); ++ ++ vchi_service_release(instance->handle); ++ ++ if (ret != 0) { ++ /* callback will not be clearing the mutex */ ++ mutex_unlock(&instance->bulk_mutex); ++ } ++ ++ return ret; ++} ++ ++/* enque a dummy bulk receive for a given message context */ ++static int dummy_bulk_receive(struct vchiq_mmal_instance *instance, ++ struct mmal_msg_context *msg_context) ++{ ++ int ret; ++ ++ /* bulk mutex stops other bulk operations while we have a ++ * receive in progress - released in callback ++ */ ++ ret = mutex_lock_interruptible(&instance->bulk_mutex); ++ if (ret != 0) ++ return ret; ++ ++ /* zero length indicates this was a dummy transfer */ ++ msg_context->u.bulk.buffer_used = 0; ++ ++ /* queue the bulk submission */ ++ vchi_service_use(instance->handle); ++ ++ ret = vchi_bulk_queue_receive(instance->handle, ++ instance->bulk_scratch, ++ 8, ++ VCHI_FLAGS_CALLBACK_WHEN_OP_COMPLETE | ++ VCHI_FLAGS_BLOCK_UNTIL_QUEUED, ++ msg_context); ++ ++ vchi_service_release(instance->handle); ++ ++ if (ret != 0) { ++ /* callback will not be clearing the mutex */ ++ mutex_unlock(&instance->bulk_mutex); ++ } ++ ++ return ret; ++} ++ ++/* data in message, memcpy from packet into output buffer */ ++static int inline_receive(struct vchiq_mmal_instance *instance, ++ struct mmal_msg *msg, ++ struct mmal_msg_context *msg_context) ++{ ++ unsigned long flags = 0; ++ ++ /* take buffer from queue */ ++ spin_lock_irqsave(&msg_context->u.bulk.port->slock, flags); ++ if (list_empty(&msg_context->u.bulk.port->buffers)) { ++ spin_unlock_irqrestore(&msg_context->u.bulk.port->slock, flags); ++ pr_err("buffer list empty trying to receive inline\n"); ++ ++ /* todo: this is a serious error, we should never have ++ * commited a buffer_to_host operation to the mmal ++ * port without the buffer to back it up (with ++ * underflow handling) and there is no obvious way to ++ * deal with this. Less bad than the bulk case as we ++ * can just drop this on the floor but...unhelpful ++ */ ++ return -EINVAL; ++ } ++ ++ msg_context->u.bulk.buffer = ++ list_entry(msg_context->u.bulk.port->buffers.next, ++ struct mmal_buffer, list); ++ list_del(&msg_context->u.bulk.buffer->list); ++ ++ spin_unlock_irqrestore(&msg_context->u.bulk.port->slock, flags); ++ ++ memcpy(msg_context->u.bulk.buffer->buffer, ++ msg->u.buffer_from_host.short_data, ++ msg->u.buffer_from_host.payload_in_message); ++ ++ msg_context->u.bulk.buffer_used = ++ msg->u.buffer_from_host.payload_in_message; ++ ++ return 0; ++} ++ ++/* queue the buffer availability with MMAL_MSG_TYPE_BUFFER_FROM_HOST */ ++static int ++buffer_from_host(struct vchiq_mmal_instance *instance, ++ struct vchiq_mmal_port *port, struct mmal_buffer *buf) ++{ ++ struct mmal_msg_context *msg_context; ++ struct mmal_msg m; ++ int ret; ++ ++ pr_debug("instance:%p buffer:%p\n", instance->handle, buf); ++ ++ /* bulk mutex stops other bulk operations while we ++ * have a receive in progress ++ */ ++ if (mutex_lock_interruptible(&instance->bulk_mutex)) ++ return -EINTR; ++ ++ /* get context */ ++ msg_context = get_msg_context(instance); ++ if (msg_context == NULL) ++ return -ENOMEM; ++ ++ /* store bulk message context for when data arrives */ ++ msg_context->u.bulk.instance = instance; ++ msg_context->u.bulk.port = port; ++ msg_context->u.bulk.buffer = NULL; /* not valid until bulk xfer */ ++ msg_context->u.bulk.buffer_used = 0; ++ ++ /* initialise work structure ready to schedule callback */ ++ INIT_WORK(&msg_context->u.bulk.work, buffer_work_cb); ++ ++ /* prep the buffer from host message */ ++ memset(&m, 0xbc, sizeof(m)); /* just to make debug clearer */ ++ ++ m.h.type = MMAL_MSG_TYPE_BUFFER_FROM_HOST; ++ m.h.magic = MMAL_MAGIC; ++ m.h.context = msg_context; ++ m.h.status = 0; ++ ++ /* drvbuf is our private data passed back */ ++ m.u.buffer_from_host.drvbuf.magic = MMAL_MAGIC; ++ m.u.buffer_from_host.drvbuf.component_handle = port->component->handle; ++ m.u.buffer_from_host.drvbuf.port_handle = port->handle; ++ m.u.buffer_from_host.drvbuf.client_context = msg_context; ++ ++ /* buffer header */ ++ m.u.buffer_from_host.buffer_header.cmd = 0; ++ m.u.buffer_from_host.buffer_header.data = buf->buffer; ++ m.u.buffer_from_host.buffer_header.alloc_size = buf->buffer_size; ++ m.u.buffer_from_host.buffer_header.length = 0; /* nothing used yet */ ++ m.u.buffer_from_host.buffer_header.offset = 0; /* no offset */ ++ m.u.buffer_from_host.buffer_header.flags = 0; /* no flags */ ++ m.u.buffer_from_host.buffer_header.pts = MMAL_TIME_UNKNOWN; ++ m.u.buffer_from_host.buffer_header.dts = MMAL_TIME_UNKNOWN; ++ ++ /* clear buffer type sepecific data */ ++ memset(&m.u.buffer_from_host.buffer_header_type_specific, 0, ++ sizeof(m.u.buffer_from_host.buffer_header_type_specific)); ++ ++ /* no payload in message */ ++ m.u.buffer_from_host.payload_in_message = 0; ++ ++ vchi_service_use(instance->handle); ++ ++ ret = vchi_msg_queue(instance->handle, &m, ++ sizeof(struct mmal_msg_header) + ++ sizeof(m.u.buffer_from_host), ++ VCHI_FLAGS_BLOCK_UNTIL_QUEUED, NULL); ++ ++ if (ret != 0) { ++ release_msg_context(msg_context); ++ /* todo: is this correct error value? */ ++ } ++ ++ vchi_service_release(instance->handle); ++ ++ mutex_unlock(&instance->bulk_mutex); ++ ++ return ret; ++} ++ ++/* submit a buffer to the mmal sevice ++ * ++ * the buffer_from_host uses size data from the ports next available ++ * mmal_buffer and deals with there being no buffer available by ++ * incrementing the underflow for later ++ */ ++static int port_buffer_from_host(struct vchiq_mmal_instance *instance, ++ struct vchiq_mmal_port *port) ++{ ++ int ret; ++ struct mmal_buffer *buf; ++ unsigned long flags = 0; ++ ++ if (!port->enabled) ++ return -EINVAL; ++ ++ /* peek buffer from queue */ ++ spin_lock_irqsave(&port->slock, flags); ++ if (list_empty(&port->buffers)) { ++ port->buffer_underflow++; ++ spin_unlock_irqrestore(&port->slock, flags); ++ return -ENOSPC; ++ } ++ ++ buf = list_entry(port->buffers.next, struct mmal_buffer, list); ++ ++ spin_unlock_irqrestore(&port->slock, flags); ++ ++ /* issue buffer to mmal service */ ++ ret = buffer_from_host(instance, port, buf); ++ if (ret) { ++ pr_err("adding buffer header failed\n"); ++ /* todo: how should this be dealt with */ ++ } ++ ++ return ret; ++} ++ ++/* deals with receipt of buffer to host message */ ++static void buffer_to_host_cb(struct vchiq_mmal_instance *instance, ++ struct mmal_msg *msg, u32 msg_len) ++{ ++ struct mmal_msg_context *msg_context; ++ ++ pr_debug("buffer_to_host_cb: instance:%p msg:%p msg_len:%d\n", ++ instance, msg, msg_len); ++ ++ if (msg->u.buffer_from_host.drvbuf.magic == MMAL_MAGIC) { ++ msg_context = msg->u.buffer_from_host.drvbuf.client_context; ++ } else { ++ pr_err("MMAL_MSG_TYPE_BUFFER_TO_HOST with bad magic\n"); ++ return; ++ } ++ ++ if (msg->h.status != MMAL_MSG_STATUS_SUCCESS) { ++ /* message reception had an error */ ++ pr_warn("error %d in reply\n", msg->h.status); ++ ++ msg_context->u.bulk.status = msg->h.status; ++ ++ } else if (msg->u.buffer_from_host.buffer_header.length == 0) { ++ /* empty buffer */ ++ if (msg->u.buffer_from_host.buffer_header.flags & ++ MMAL_BUFFER_HEADER_FLAG_EOS) { ++ msg_context->u.bulk.status = ++ dummy_bulk_receive(instance, msg_context); ++ if (msg_context->u.bulk.status == 0) ++ return; /* successful bulk submission, bulk ++ * completion will trigger callback ++ */ ++ } else { ++ /* do callback with empty buffer - not EOS though */ ++ msg_context->u.bulk.status = 0; ++ msg_context->u.bulk.buffer_used = 0; ++ } ++ } else if (msg->u.buffer_from_host.payload_in_message == 0) { ++ /* data is not in message, queue a bulk receive */ ++ msg_context->u.bulk.status = ++ bulk_receive(instance, msg, msg_context); ++ if (msg_context->u.bulk.status == 0) ++ return; /* successful bulk submission, bulk ++ * completion will trigger callback ++ */ ++ ++ /* failed to submit buffer, this will end badly */ ++ pr_err("error %d on bulk submission\n", ++ msg_context->u.bulk.status); ++ ++ } else if (msg->u.buffer_from_host.payload_in_message <= ++ MMAL_VC_SHORT_DATA) { ++ /* data payload within message */ ++ msg_context->u.bulk.status = inline_receive(instance, msg, ++ msg_context); ++ } else { ++ pr_err("message with invalid short payload\n"); ++ ++ /* signal error */ ++ msg_context->u.bulk.status = -EINVAL; ++ msg_context->u.bulk.buffer_used = ++ msg->u.buffer_from_host.payload_in_message; ++ } ++ ++ /* replace the buffer header */ ++ port_buffer_from_host(instance, msg_context->u.bulk.port); ++ ++ /* schedule the port callback */ ++ schedule_work(&msg_context->u.bulk.work); ++} ++ ++static void bulk_receive_cb(struct vchiq_mmal_instance *instance, ++ struct mmal_msg_context *msg_context) ++{ ++ /* bulk receive operation complete */ ++ mutex_unlock(&msg_context->u.bulk.instance->bulk_mutex); ++ ++ /* replace the buffer header */ ++ port_buffer_from_host(msg_context->u.bulk.instance, ++ msg_context->u.bulk.port); ++ ++ msg_context->u.bulk.status = 0; ++ ++ /* schedule the port callback */ ++ schedule_work(&msg_context->u.bulk.work); ++} ++ ++static void bulk_abort_cb(struct vchiq_mmal_instance *instance, ++ struct mmal_msg_context *msg_context) ++{ ++ pr_err("%s: bulk ABORTED msg_context:%p\n", __func__, msg_context); ++ ++ /* bulk receive operation complete */ ++ mutex_unlock(&msg_context->u.bulk.instance->bulk_mutex); ++ ++ /* replace the buffer header */ ++ port_buffer_from_host(msg_context->u.bulk.instance, ++ msg_context->u.bulk.port); ++ ++ msg_context->u.bulk.status = -EINTR; ++ ++ schedule_work(&msg_context->u.bulk.work); ++} ++ ++/* incoming event service callback */ ++static void service_callback(void *param, ++ const VCHI_CALLBACK_REASON_T reason, ++ void *bulk_ctx) ++{ ++ struct vchiq_mmal_instance *instance = param; ++ int status; ++ u32 msg_len; ++ struct mmal_msg *msg; ++ VCHI_HELD_MSG_T msg_handle; ++ ++ if (!instance) { ++ pr_err("Message callback passed NULL instance\n"); ++ return; ++ } ++ ++ switch (reason) { ++ case VCHI_CALLBACK_MSG_AVAILABLE: ++ status = vchi_msg_hold(instance->handle, (void **)&msg, ++ &msg_len, VCHI_FLAGS_NONE, &msg_handle); ++ if (status) { ++ pr_err("Unable to dequeue a message (%d)\n", status); ++ break; ++ } ++ ++ DBG_DUMP_MSG(msg, msg_len, "<<< reply message"); ++ ++ /* handling is different for buffer messages */ ++ switch (msg->h.type) { ++ ++ case MMAL_MSG_TYPE_BUFFER_FROM_HOST: ++ vchi_held_msg_release(&msg_handle); ++ break; ++ ++ case MMAL_MSG_TYPE_EVENT_TO_HOST: ++ event_to_host_cb(instance, msg, msg_len); ++ vchi_held_msg_release(&msg_handle); ++ ++ break; ++ ++ case MMAL_MSG_TYPE_BUFFER_TO_HOST: ++ buffer_to_host_cb(instance, msg, msg_len); ++ vchi_held_msg_release(&msg_handle); ++ break; ++ ++ default: ++ /* messages dependant on header context to complete */ ++ ++ /* todo: the msg.context really ought to be sanity ++ * checked before we just use it, afaict it comes back ++ * and is used raw from the videocore. Perhaps it ++ * should be verified the address lies in the kernel ++ * address space. ++ */ ++ if (msg->h.context == NULL) { ++ pr_err("received message context was null!\n"); ++ vchi_held_msg_release(&msg_handle); ++ break; ++ } ++ ++ /* fill in context values */ ++ msg->h.context->u.sync.msg_handle = msg_handle; ++ msg->h.context->u.sync.msg = msg; ++ msg->h.context->u.sync.msg_len = msg_len; ++ ++ /* todo: should this check (completion_done() ++ * == 1) for no one waiting? or do we need a ++ * flag to tell us the completion has been ++ * interrupted so we can free the message and ++ * its context. This probably also solves the ++ * message arriving after interruption todo ++ * below ++ */ ++ ++ /* complete message so caller knows it happened */ ++ complete(&msg->h.context->u.sync.cmplt); ++ break; ++ } ++ ++ break; ++ ++ case VCHI_CALLBACK_BULK_RECEIVED: ++ bulk_receive_cb(instance, bulk_ctx); ++ break; ++ ++ case VCHI_CALLBACK_BULK_RECEIVE_ABORTED: ++ bulk_abort_cb(instance, bulk_ctx); ++ break; ++ ++ case VCHI_CALLBACK_SERVICE_CLOSED: ++ /* TODO: consider if this requires action if received when ++ * driver is not explicitly closing the service ++ */ ++ break; ++ ++ default: ++ pr_err("Received unhandled message reason %d\n", reason); ++ break; ++ } ++} ++ ++static int send_synchronous_mmal_msg(struct vchiq_mmal_instance *instance, ++ struct mmal_msg *msg, ++ unsigned int payload_len, ++ struct mmal_msg **msg_out, ++ VCHI_HELD_MSG_T *msg_handle_out) ++{ ++ struct mmal_msg_context msg_context; ++ int ret; ++ ++ /* payload size must not cause message to exceed max size */ ++ if (payload_len > ++ (MMAL_MSG_MAX_SIZE - sizeof(struct mmal_msg_header))) { ++ pr_err("payload length %d exceeds max:%d\n", payload_len, ++ (MMAL_MSG_MAX_SIZE - sizeof(struct mmal_msg_header))); ++ return -EINVAL; ++ } ++ ++ init_completion(&msg_context.u.sync.cmplt); ++ ++ msg->h.magic = MMAL_MAGIC; ++ msg->h.context = &msg_context; ++ msg->h.status = 0; ++ ++ DBG_DUMP_MSG(msg, (sizeof(struct mmal_msg_header) + payload_len), ++ ">>> sync message"); ++ ++ vchi_service_use(instance->handle); ++ ++ ret = vchi_msg_queue(instance->handle, ++ msg, ++ sizeof(struct mmal_msg_header) + payload_len, ++ VCHI_FLAGS_BLOCK_UNTIL_QUEUED, NULL); ++ ++ vchi_service_release(instance->handle); ++ ++ if (ret) { ++ pr_err("error %d queuing message\n", ret); ++ return ret; ++ } ++ ++ ret = wait_for_completion_timeout(&msg_context.u.sync.cmplt, 3*HZ); ++ if (ret <= 0) { ++ pr_err("error %d waiting for sync completion\n", ret); ++ if (ret == 0) ++ ret = -ETIME; ++ /* todo: what happens if the message arrives after aborting */ ++ return ret; ++ } ++ ++ *msg_out = msg_context.u.sync.msg; ++ *msg_handle_out = msg_context.u.sync.msg_handle; ++ ++ return 0; ++} ++ ++static void dump_port_info(struct vchiq_mmal_port *port) ++{ ++ pr_debug("port handle:0x%x enabled:%d\n", port->handle, port->enabled); ++ ++ pr_debug("buffer minimum num:%d size:%d align:%d\n", ++ port->minimum_buffer.num, ++ port->minimum_buffer.size, port->minimum_buffer.alignment); ++ ++ pr_debug("buffer recommended num:%d size:%d align:%d\n", ++ port->recommended_buffer.num, ++ port->recommended_buffer.size, ++ port->recommended_buffer.alignment); ++ ++ pr_debug("buffer current values num:%d size:%d align:%d\n", ++ port->current_buffer.num, ++ port->current_buffer.size, port->current_buffer.alignment); ++ ++ pr_debug("elementry stream: type:%d encoding:0x%x varient:0x%x\n", ++ port->format.type, ++ port->format.encoding, port->format.encoding_variant); ++ ++ pr_debug(" bitrate:%d flags:0x%x\n", ++ port->format.bitrate, port->format.flags); ++ ++ if (port->format.type == MMAL_ES_TYPE_VIDEO) { ++ pr_debug ++ ("es video format: width:%d height:%d colourspace:0x%x\n", ++ port->es.video.width, port->es.video.height, ++ port->es.video.color_space); ++ ++ pr_debug(" : crop xywh %d,%d,%d,%d\n", ++ port->es.video.crop.x, ++ port->es.video.crop.y, ++ port->es.video.crop.width, port->es.video.crop.height); ++ pr_debug(" : framerate %d/%d aspect %d/%d\n", ++ port->es.video.frame_rate.num, ++ port->es.video.frame_rate.den, ++ port->es.video.par.num, port->es.video.par.den); ++ } ++} ++ ++static void port_to_mmal_msg(struct vchiq_mmal_port *port, struct mmal_port *p) ++{ ++ ++ /* todo do readonly fields need setting at all? */ ++ p->type = port->type; ++ p->index = port->index; ++ p->index_all = 0; ++ p->is_enabled = port->enabled; ++ p->buffer_num_min = port->minimum_buffer.num; ++ p->buffer_size_min = port->minimum_buffer.size; ++ p->buffer_alignment_min = port->minimum_buffer.alignment; ++ p->buffer_num_recommended = port->recommended_buffer.num; ++ p->buffer_size_recommended = port->recommended_buffer.size; ++ ++ /* only three writable fields in a port */ ++ p->buffer_num = port->current_buffer.num; ++ p->buffer_size = port->current_buffer.size; ++ p->userdata = port; ++} ++ ++static int port_info_set(struct vchiq_mmal_instance *instance, ++ struct vchiq_mmal_port *port) ++{ ++ int ret; ++ struct mmal_msg m; ++ struct mmal_msg *rmsg; ++ VCHI_HELD_MSG_T rmsg_handle; ++ ++ pr_debug("setting port info port %p\n", port); ++ if (!port) ++ return -1; ++ dump_port_info(port); ++ ++ m.h.type = MMAL_MSG_TYPE_PORT_INFO_SET; ++ ++ m.u.port_info_set.component_handle = port->component->handle; ++ m.u.port_info_set.port_type = port->type; ++ m.u.port_info_set.port_index = port->index; ++ ++ port_to_mmal_msg(port, &m.u.port_info_set.port); ++ ++ /* elementry stream format setup */ ++ m.u.port_info_set.format.type = port->format.type; ++ m.u.port_info_set.format.encoding = port->format.encoding; ++ m.u.port_info_set.format.encoding_variant = ++ port->format.encoding_variant; ++ m.u.port_info_set.format.bitrate = port->format.bitrate; ++ m.u.port_info_set.format.flags = port->format.flags; ++ ++ memcpy(&m.u.port_info_set.es, &port->es, ++ sizeof(union mmal_es_specific_format)); ++ ++ m.u.port_info_set.format.extradata_size = port->format.extradata_size; ++ memcpy(&m.u.port_info_set.extradata, port->format.extradata, ++ port->format.extradata_size); ++ ++ ret = send_synchronous_mmal_msg(instance, &m, ++ sizeof(m.u.port_info_set), ++ &rmsg, &rmsg_handle); ++ if (ret) ++ return ret; ++ ++ if (rmsg->h.type != MMAL_MSG_TYPE_PORT_INFO_SET) { ++ /* got an unexpected message type in reply */ ++ ret = -EINVAL; ++ goto release_msg; ++ } ++ ++ /* return operation status */ ++ ret = -rmsg->u.port_info_get_reply.status; ++ ++ pr_debug("%s:result:%d component:0x%x port:%d\n", __func__, ret, ++ port->component->handle, port->handle); ++ ++release_msg: ++ vchi_held_msg_release(&rmsg_handle); ++ ++ return ret; ++ ++} ++ ++/* use port info get message to retrive port information */ ++static int port_info_get(struct vchiq_mmal_instance *instance, ++ struct vchiq_mmal_port *port) ++{ ++ int ret; ++ struct mmal_msg m; ++ struct mmal_msg *rmsg; ++ VCHI_HELD_MSG_T rmsg_handle; ++ ++ /* port info time */ ++ m.h.type = MMAL_MSG_TYPE_PORT_INFO_GET; ++ m.u.port_info_get.component_handle = port->component->handle; ++ m.u.port_info_get.port_type = port->type; ++ m.u.port_info_get.index = port->index; ++ ++ ret = send_synchronous_mmal_msg(instance, &m, ++ sizeof(m.u.port_info_get), ++ &rmsg, &rmsg_handle); ++ if (ret) ++ return ret; ++ ++ if (rmsg->h.type != MMAL_MSG_TYPE_PORT_INFO_GET) { ++ /* got an unexpected message type in reply */ ++ ret = -EINVAL; ++ goto release_msg; ++ } ++ ++ /* return operation status */ ++ ret = -rmsg->u.port_info_get_reply.status; ++ if (ret != MMAL_MSG_STATUS_SUCCESS) ++ goto release_msg; ++ ++ if (rmsg->u.port_info_get_reply.port.is_enabled == 0) ++ port->enabled = false; ++ else ++ port->enabled = true; ++ ++ /* copy the values out of the message */ ++ port->handle = rmsg->u.port_info_get_reply.port_handle; ++ ++ /* port type and index cached to use on port info set becuase ++ * it does not use a port handle ++ */ ++ port->type = rmsg->u.port_info_get_reply.port_type; ++ port->index = rmsg->u.port_info_get_reply.port_index; ++ ++ port->minimum_buffer.num = ++ rmsg->u.port_info_get_reply.port.buffer_num_min; ++ port->minimum_buffer.size = ++ rmsg->u.port_info_get_reply.port.buffer_size_min; ++ port->minimum_buffer.alignment = ++ rmsg->u.port_info_get_reply.port.buffer_alignment_min; ++ ++ port->recommended_buffer.alignment = ++ rmsg->u.port_info_get_reply.port.buffer_alignment_min; ++ port->recommended_buffer.num = ++ rmsg->u.port_info_get_reply.port.buffer_num_recommended; ++ ++ port->current_buffer.num = rmsg->u.port_info_get_reply.port.buffer_num; ++ port->current_buffer.size = ++ rmsg->u.port_info_get_reply.port.buffer_size; ++ ++ /* stream format */ ++ port->format.type = rmsg->u.port_info_get_reply.format.type; ++ port->format.encoding = rmsg->u.port_info_get_reply.format.encoding; ++ port->format.encoding_variant = ++ rmsg->u.port_info_get_reply.format.encoding_variant; ++ port->format.bitrate = rmsg->u.port_info_get_reply.format.bitrate; ++ port->format.flags = rmsg->u.port_info_get_reply.format.flags; ++ ++ /* elementry stream format */ ++ memcpy(&port->es, ++ &rmsg->u.port_info_get_reply.es, ++ sizeof(union mmal_es_specific_format)); ++ port->format.es = &port->es; ++ ++ port->format.extradata_size = ++ rmsg->u.port_info_get_reply.format.extradata_size; ++ memcpy(port->format.extradata, ++ rmsg->u.port_info_get_reply.extradata, ++ port->format.extradata_size); ++ ++ pr_debug("received port info\n"); ++ dump_port_info(port); ++ ++release_msg: ++ ++ pr_debug("%s:result:%d component:0x%x port:%d\n", ++ __func__, ret, port->component->handle, port->handle); ++ ++ vchi_held_msg_release(&rmsg_handle); ++ ++ return ret; ++} ++ ++/* create comonent on vc */ ++static int create_component(struct vchiq_mmal_instance *instance, ++ struct vchiq_mmal_component *component, ++ const char *name) ++{ ++ int ret; ++ struct mmal_msg m; ++ struct mmal_msg *rmsg; ++ VCHI_HELD_MSG_T rmsg_handle; ++ ++ /* build component create message */ ++ m.h.type = MMAL_MSG_TYPE_COMPONENT_CREATE; ++ m.u.component_create.client_component = component; ++ strncpy(m.u.component_create.name, name, ++ sizeof(m.u.component_create.name)); ++ ++ ret = send_synchronous_mmal_msg(instance, &m, ++ sizeof(m.u.component_create), ++ &rmsg, &rmsg_handle); ++ if (ret) ++ return ret; ++ ++ if (rmsg->h.type != m.h.type) { ++ /* got an unexpected message type in reply */ ++ ret = -EINVAL; ++ goto release_msg; ++ } ++ ++ ret = -rmsg->u.component_create_reply.status; ++ if (ret != MMAL_MSG_STATUS_SUCCESS) ++ goto release_msg; ++ ++ /* a valid component response received */ ++ component->handle = rmsg->u.component_create_reply.component_handle; ++ component->inputs = rmsg->u.component_create_reply.input_num; ++ component->outputs = rmsg->u.component_create_reply.output_num; ++ component->clocks = rmsg->u.component_create_reply.clock_num; ++ ++ pr_debug("Component handle:0x%x in:%d out:%d clock:%d\n", ++ component->handle, ++ component->inputs, component->outputs, component->clocks); ++ ++release_msg: ++ vchi_held_msg_release(&rmsg_handle); ++ ++ return ret; ++} ++ ++/* destroys a component on vc */ ++static int destroy_component(struct vchiq_mmal_instance *instance, ++ struct vchiq_mmal_component *component) ++{ ++ int ret; ++ struct mmal_msg m; ++ struct mmal_msg *rmsg; ++ VCHI_HELD_MSG_T rmsg_handle; ++ ++ m.h.type = MMAL_MSG_TYPE_COMPONENT_DESTROY; ++ m.u.component_destroy.component_handle = component->handle; ++ ++ ret = send_synchronous_mmal_msg(instance, &m, ++ sizeof(m.u.component_destroy), ++ &rmsg, &rmsg_handle); ++ if (ret) ++ return ret; ++ ++ if (rmsg->h.type != m.h.type) { ++ /* got an unexpected message type in reply */ ++ ret = -EINVAL; ++ goto release_msg; ++ } ++ ++ ret = -rmsg->u.component_destroy_reply.status; ++ ++release_msg: ++ ++ vchi_held_msg_release(&rmsg_handle); ++ ++ return ret; ++} ++ ++/* enable a component on vc */ ++static int enable_component(struct vchiq_mmal_instance *instance, ++ struct vchiq_mmal_component *component) ++{ ++ int ret; ++ struct mmal_msg m; ++ struct mmal_msg *rmsg; ++ VCHI_HELD_MSG_T rmsg_handle; ++ ++ m.h.type = MMAL_MSG_TYPE_COMPONENT_ENABLE; ++ m.u.component_enable.component_handle = component->handle; ++ ++ ret = send_synchronous_mmal_msg(instance, &m, ++ sizeof(m.u.component_enable), ++ &rmsg, &rmsg_handle); ++ if (ret) ++ return ret; ++ ++ if (rmsg->h.type != m.h.type) { ++ /* got an unexpected message type in reply */ ++ ret = -EINVAL; ++ goto release_msg; ++ } ++ ++ ret = -rmsg->u.component_enable_reply.status; ++ ++release_msg: ++ vchi_held_msg_release(&rmsg_handle); ++ ++ return ret; ++} ++ ++/* disable a component on vc */ ++static int disable_component(struct vchiq_mmal_instance *instance, ++ struct vchiq_mmal_component *component) ++{ ++ int ret; ++ struct mmal_msg m; ++ struct mmal_msg *rmsg; ++ VCHI_HELD_MSG_T rmsg_handle; ++ ++ m.h.type = MMAL_MSG_TYPE_COMPONENT_DISABLE; ++ m.u.component_disable.component_handle = component->handle; ++ ++ ret = send_synchronous_mmal_msg(instance, &m, ++ sizeof(m.u.component_disable), ++ &rmsg, &rmsg_handle); ++ if (ret) ++ return ret; ++ ++ if (rmsg->h.type != m.h.type) { ++ /* got an unexpected message type in reply */ ++ ret = -EINVAL; ++ goto release_msg; ++ } ++ ++ ret = -rmsg->u.component_disable_reply.status; ++ ++release_msg: ++ ++ vchi_held_msg_release(&rmsg_handle); ++ ++ return ret; ++} ++ ++/* get version of mmal implementation */ ++static int get_version(struct vchiq_mmal_instance *instance, ++ u32 *major_out, u32 *minor_out) ++{ ++ int ret; ++ struct mmal_msg m; ++ struct mmal_msg *rmsg; ++ VCHI_HELD_MSG_T rmsg_handle; ++ ++ m.h.type = MMAL_MSG_TYPE_GET_VERSION; ++ ++ ret = send_synchronous_mmal_msg(instance, &m, ++ sizeof(m.u.version), ++ &rmsg, &rmsg_handle); ++ if (ret) ++ return ret; ++ ++ if (rmsg->h.type != m.h.type) { ++ /* got an unexpected message type in reply */ ++ ret = -EINVAL; ++ goto release_msg; ++ } ++ ++ *major_out = rmsg->u.version.major; ++ *minor_out = rmsg->u.version.minor; ++ ++release_msg: ++ vchi_held_msg_release(&rmsg_handle); ++ ++ return ret; ++} ++ ++/* do a port action with a port as a parameter */ ++static int port_action_port(struct vchiq_mmal_instance *instance, ++ struct vchiq_mmal_port *port, ++ enum mmal_msg_port_action_type action_type) ++{ ++ int ret; ++ struct mmal_msg m; ++ struct mmal_msg *rmsg; ++ VCHI_HELD_MSG_T rmsg_handle; ++ ++ m.h.type = MMAL_MSG_TYPE_PORT_ACTION; ++ m.u.port_action_port.component_handle = port->component->handle; ++ m.u.port_action_port.port_handle = port->handle; ++ m.u.port_action_port.action = action_type; ++ ++ port_to_mmal_msg(port, &m.u.port_action_port.port); ++ ++ ret = send_synchronous_mmal_msg(instance, &m, ++ sizeof(m.u.port_action_port), ++ &rmsg, &rmsg_handle); ++ if (ret) ++ return ret; ++ ++ if (rmsg->h.type != MMAL_MSG_TYPE_PORT_ACTION) { ++ /* got an unexpected message type in reply */ ++ ret = -EINVAL; ++ goto release_msg; ++ } ++ ++ ret = -rmsg->u.port_action_reply.status; ++ ++ pr_debug("%s:result:%d component:0x%x port:%d action:%s(%d)\n", ++ __func__, ++ ret, port->component->handle, port->handle, ++ port_action_type_names[action_type], action_type); ++ ++release_msg: ++ vchi_held_msg_release(&rmsg_handle); ++ ++ return ret; ++} ++ ++/* do a port action with handles as parameters */ ++static int port_action_handle(struct vchiq_mmal_instance *instance, ++ struct vchiq_mmal_port *port, ++ enum mmal_msg_port_action_type action_type, ++ u32 connect_component_handle, ++ u32 connect_port_handle) ++{ ++ int ret; ++ struct mmal_msg m; ++ struct mmal_msg *rmsg; ++ VCHI_HELD_MSG_T rmsg_handle; ++ ++ m.h.type = MMAL_MSG_TYPE_PORT_ACTION; ++ ++ m.u.port_action_handle.component_handle = port->component->handle; ++ m.u.port_action_handle.port_handle = port->handle; ++ m.u.port_action_handle.action = action_type; ++ ++ m.u.port_action_handle.connect_component_handle = ++ connect_component_handle; ++ m.u.port_action_handle.connect_port_handle = connect_port_handle; ++ ++ ret = send_synchronous_mmal_msg(instance, &m, ++ sizeof(m.u.port_action_handle), ++ &rmsg, &rmsg_handle); ++ if (ret) ++ return ret; ++ ++ if (rmsg->h.type != MMAL_MSG_TYPE_PORT_ACTION) { ++ /* got an unexpected message type in reply */ ++ ret = -EINVAL; ++ goto release_msg; ++ } ++ ++ ret = -rmsg->u.port_action_reply.status; ++ ++ pr_debug("%s:result:%d component:0x%x port:%d action:%s(%d)" \ ++ " connect component:0x%x connect port:%d\n", ++ __func__, ++ ret, port->component->handle, port->handle, ++ port_action_type_names[action_type], ++ action_type, connect_component_handle, connect_port_handle); ++ ++release_msg: ++ vchi_held_msg_release(&rmsg_handle); ++ ++ return ret; ++} ++ ++static int port_parameter_set(struct vchiq_mmal_instance *instance, ++ struct vchiq_mmal_port *port, ++ u32 parameter_id, void *value, u32 value_size) ++{ ++ int ret; ++ struct mmal_msg m; ++ struct mmal_msg *rmsg; ++ VCHI_HELD_MSG_T rmsg_handle; ++ ++ m.h.type = MMAL_MSG_TYPE_PORT_PARAMETER_SET; ++ ++ m.u.port_parameter_set.component_handle = port->component->handle; ++ m.u.port_parameter_set.port_handle = port->handle; ++ m.u.port_parameter_set.id = parameter_id; ++ m.u.port_parameter_set.size = (2 * sizeof(u32)) + value_size; ++ memcpy(&m.u.port_parameter_set.value, value, value_size); ++ ++ ret = send_synchronous_mmal_msg(instance, &m, ++ (4 * sizeof(u32)) + value_size, ++ &rmsg, &rmsg_handle); ++ if (ret) ++ return ret; ++ ++ if (rmsg->h.type != MMAL_MSG_TYPE_PORT_PARAMETER_SET) { ++ /* got an unexpected message type in reply */ ++ ret = -EINVAL; ++ goto release_msg; ++ } ++ ++ ret = -rmsg->u.port_parameter_set_reply.status; ++ ++ pr_debug("%s:result:%d component:0x%x port:%d parameter:%d\n", ++ __func__, ++ ret, port->component->handle, port->handle, parameter_id); ++ ++release_msg: ++ vchi_held_msg_release(&rmsg_handle); ++ ++ return ret; ++} ++ ++static int port_parameter_get(struct vchiq_mmal_instance *instance, ++ struct vchiq_mmal_port *port, ++ u32 parameter_id, void *value, u32 *value_size) ++{ ++ int ret; ++ struct mmal_msg m; ++ struct mmal_msg *rmsg; ++ VCHI_HELD_MSG_T rmsg_handle; ++ ++ m.h.type = MMAL_MSG_TYPE_PORT_PARAMETER_GET; ++ ++ m.u.port_parameter_get.component_handle = port->component->handle; ++ m.u.port_parameter_get.port_handle = port->handle; ++ m.u.port_parameter_get.id = parameter_id; ++ m.u.port_parameter_get.size = (2 * sizeof(u32)) + *value_size; ++ ++ ret = send_synchronous_mmal_msg(instance, &m, ++ sizeof(struct ++ mmal_msg_port_parameter_get), ++ &rmsg, &rmsg_handle); ++ if (ret) ++ return ret; ++ ++ if (rmsg->h.type != MMAL_MSG_TYPE_PORT_PARAMETER_GET) { ++ /* got an unexpected message type in reply */ ++ pr_err("Incorrect reply type %d\n", rmsg->h.type); ++ ret = -EINVAL; ++ goto release_msg; ++ } ++ ++ ret = -rmsg->u.port_parameter_get_reply.status; ++ if (ret) { ++ /* Copy only as much as we have space for ++ * but report true size of parameter ++ */ ++ memcpy(value, &rmsg->u.port_parameter_get_reply.value, ++ *value_size); ++ *value_size = rmsg->u.port_parameter_get_reply.size; ++ } else ++ memcpy(value, &rmsg->u.port_parameter_get_reply.value, ++ rmsg->u.port_parameter_get_reply.size); ++ ++ pr_debug("%s:result:%d component:0x%x port:%d parameter:%d\n", __func__, ++ ret, port->component->handle, port->handle, parameter_id); ++ ++release_msg: ++ vchi_held_msg_release(&rmsg_handle); ++ ++ return ret; ++} ++ ++/* disables a port and drains buffers from it */ ++static int port_disable(struct vchiq_mmal_instance *instance, ++ struct vchiq_mmal_port *port) ++{ ++ int ret; ++ struct list_head *q, *buf_head; ++ unsigned long flags = 0; ++ ++ if (!port->enabled) ++ return 0; ++ ++ port->enabled = false; ++ ++ ret = port_action_port(instance, port, ++ MMAL_MSG_PORT_ACTION_TYPE_DISABLE); ++ if (ret == 0) { ++ ++ /* drain all queued buffers on port */ ++ spin_lock_irqsave(&port->slock, flags); ++ ++ list_for_each_safe(buf_head, q, &port->buffers) { ++ struct mmal_buffer *mmalbuf; ++ mmalbuf = list_entry(buf_head, struct mmal_buffer, ++ list); ++ list_del(buf_head); ++ if (port->buffer_cb) ++ port->buffer_cb(instance, ++ port, 0, mmalbuf, 0, 0, ++ MMAL_TIME_UNKNOWN, ++ MMAL_TIME_UNKNOWN); ++ } ++ ++ spin_unlock_irqrestore(&port->slock, flags); ++ ++ ret = port_info_get(instance, port); ++ } ++ ++ return ret; ++} ++ ++/* enable a port */ ++static int port_enable(struct vchiq_mmal_instance *instance, ++ struct vchiq_mmal_port *port) ++{ ++ unsigned int hdr_count; ++ struct list_head *buf_head; ++ int ret; ++ ++ if (port->enabled) ++ return 0; ++ ++ /* ensure there are enough buffers queued to cover the buffer headers */ ++ if (port->buffer_cb != NULL) { ++ hdr_count = 0; ++ list_for_each(buf_head, &port->buffers) { ++ hdr_count++; ++ } ++ if (hdr_count < port->current_buffer.num) ++ return -ENOSPC; ++ } ++ ++ ret = port_action_port(instance, port, ++ MMAL_MSG_PORT_ACTION_TYPE_ENABLE); ++ if (ret) ++ goto done; ++ ++ port->enabled = true; ++ ++ if (port->buffer_cb) { ++ /* send buffer headers to videocore */ ++ hdr_count = 1; ++ list_for_each(buf_head, &port->buffers) { ++ struct mmal_buffer *mmalbuf; ++ mmalbuf = list_entry(buf_head, struct mmal_buffer, ++ list); ++ ret = buffer_from_host(instance, port, mmalbuf); ++ if (ret) ++ goto done; ++ ++ hdr_count++; ++ if (hdr_count > port->current_buffer.num) ++ break; ++ } ++ } ++ ++ ret = port_info_get(instance, port); ++ ++done: ++ return ret; ++} ++ ++/* ------------------------------------------------------------------ ++ * Exported API ++ *------------------------------------------------------------------*/ ++ ++int vchiq_mmal_port_set_format(struct vchiq_mmal_instance *instance, ++ struct vchiq_mmal_port *port) ++{ ++ int ret; ++ ++ if (mutex_lock_interruptible(&instance->vchiq_mutex)) ++ return -EINTR; ++ ++ ret = port_info_set(instance, port); ++ if (ret) ++ goto release_unlock; ++ ++ /* read what has actually been set */ ++ ret = port_info_get(instance, port); ++ ++release_unlock: ++ mutex_unlock(&instance->vchiq_mutex); ++ ++ return ret; ++ ++} ++ ++int vchiq_mmal_port_parameter_set(struct vchiq_mmal_instance *instance, ++ struct vchiq_mmal_port *port, ++ u32 parameter, void *value, u32 value_size) ++{ ++ int ret; ++ ++ if (mutex_lock_interruptible(&instance->vchiq_mutex)) ++ return -EINTR; ++ ++ ret = port_parameter_set(instance, port, parameter, value, value_size); ++ ++ mutex_unlock(&instance->vchiq_mutex); ++ ++ return ret; ++} ++ ++int vchiq_mmal_port_parameter_get(struct vchiq_mmal_instance *instance, ++ struct vchiq_mmal_port *port, ++ u32 parameter, void *value, u32 *value_size) ++{ ++ int ret; ++ ++ if (mutex_lock_interruptible(&instance->vchiq_mutex)) ++ return -EINTR; ++ ++ ret = port_parameter_get(instance, port, parameter, value, value_size); ++ ++ mutex_unlock(&instance->vchiq_mutex); ++ ++ return ret; ++} ++ ++/* enable a port ++ * ++ * enables a port and queues buffers for satisfying callbacks if we ++ * provide a callback handler ++ */ ++int vchiq_mmal_port_enable(struct vchiq_mmal_instance *instance, ++ struct vchiq_mmal_port *port, ++ vchiq_mmal_buffer_cb buffer_cb) ++{ ++ int ret; ++ ++ if (mutex_lock_interruptible(&instance->vchiq_mutex)) ++ return -EINTR; ++ ++ /* already enabled - noop */ ++ if (port->enabled) { ++ ret = 0; ++ goto unlock; ++ } ++ ++ port->buffer_cb = buffer_cb; ++ ++ ret = port_enable(instance, port); ++ ++unlock: ++ mutex_unlock(&instance->vchiq_mutex); ++ ++ return ret; ++} ++ ++int vchiq_mmal_port_disable(struct vchiq_mmal_instance *instance, ++ struct vchiq_mmal_port *port) ++{ ++ int ret; ++ ++ if (mutex_lock_interruptible(&instance->vchiq_mutex)) ++ return -EINTR; ++ ++ if (!port->enabled) { ++ mutex_unlock(&instance->vchiq_mutex); ++ return 0; ++ } ++ ++ ret = port_disable(instance, port); ++ ++ mutex_unlock(&instance->vchiq_mutex); ++ ++ return ret; ++} ++ ++/* ports will be connected in a tunneled manner so data buffers ++ * are not handled by client. ++ */ ++int vchiq_mmal_port_connect_tunnel(struct vchiq_mmal_instance *instance, ++ struct vchiq_mmal_port *src, ++ struct vchiq_mmal_port *dst) ++{ ++ int ret; ++ ++ if (mutex_lock_interruptible(&instance->vchiq_mutex)) ++ return -EINTR; ++ ++ /* disconnect ports if connected */ ++ if (src->connected != NULL) { ++ ret = port_disable(instance, src); ++ if (ret) { ++ pr_err("failed disabling src port(%d)\n", ret); ++ goto release_unlock; ++ } ++ ++ /* do not need to disable the destination port as they ++ * are connected and it is done automatically ++ */ ++ ++ ret = port_action_handle(instance, src, ++ MMAL_MSG_PORT_ACTION_TYPE_DISCONNECT, ++ src->connected->component->handle, ++ src->connected->handle); ++ if (ret < 0) { ++ pr_err("failed disconnecting src port\n"); ++ goto release_unlock; ++ } ++ src->connected->enabled = false; ++ src->connected = NULL; ++ } ++ ++ if (dst == NULL) { ++ /* do not make new connection */ ++ ret = 0; ++ pr_debug("not making new connection\n"); ++ goto release_unlock; ++ } ++ ++ /* copy src port format to dst */ ++ dst->format.encoding = src->format.encoding; ++ dst->es.video.width = src->es.video.width; ++ dst->es.video.height = src->es.video.height; ++ dst->es.video.crop.x = src->es.video.crop.x; ++ dst->es.video.crop.y = src->es.video.crop.y; ++ dst->es.video.crop.width = src->es.video.crop.width; ++ dst->es.video.crop.height = src->es.video.crop.height; ++ dst->es.video.frame_rate.num = src->es.video.frame_rate.num; ++ dst->es.video.frame_rate.den = src->es.video.frame_rate.den; ++ ++ /* set new format */ ++ ret = port_info_set(instance, dst); ++ if (ret) { ++ pr_debug("setting port info failed\n"); ++ goto release_unlock; ++ } ++ ++ /* read what has actually been set */ ++ ret = port_info_get(instance, dst); ++ if (ret) { ++ pr_debug("read back port info failed\n"); ++ goto release_unlock; ++ } ++ ++ /* connect two ports together */ ++ ret = port_action_handle(instance, src, ++ MMAL_MSG_PORT_ACTION_TYPE_CONNECT, ++ dst->component->handle, dst->handle); ++ if (ret < 0) { ++ pr_debug("connecting port %d:%d to %d:%d failed\n", ++ src->component->handle, src->handle, ++ dst->component->handle, dst->handle); ++ goto release_unlock; ++ } ++ src->connected = dst; ++ ++release_unlock: ++ ++ mutex_unlock(&instance->vchiq_mutex); ++ ++ return ret; ++} ++ ++int vchiq_mmal_submit_buffer(struct vchiq_mmal_instance *instance, ++ struct vchiq_mmal_port *port, ++ struct mmal_buffer *buffer) ++{ ++ unsigned long flags = 0; ++ ++ spin_lock_irqsave(&port->slock, flags); ++ list_add_tail(&buffer->list, &port->buffers); ++ spin_unlock_irqrestore(&port->slock, flags); ++ ++ /* the port previously underflowed because it was missing a ++ * mmal_buffer which has just been added, submit that buffer ++ * to the mmal service. ++ */ ++ if (port->buffer_underflow) { ++ port_buffer_from_host(instance, port); ++ port->buffer_underflow--; ++ } ++ ++ return 0; ++} ++ ++/* Initialise a mmal component and its ports ++ * ++ */ ++int vchiq_mmal_component_init(struct vchiq_mmal_instance *instance, ++ const char *name, ++ struct vchiq_mmal_component **component_out) ++{ ++ int ret; ++ int idx; /* port index */ ++ struct vchiq_mmal_component *component; ++ ++ if (mutex_lock_interruptible(&instance->vchiq_mutex)) ++ return -EINTR; ++ ++ if (instance->component_idx == VCHIQ_MMAL_MAX_COMPONENTS) { ++ ret = -EINVAL; /* todo is this correct error? */ ++ goto unlock; ++ } ++ ++ component = &instance->component[instance->component_idx]; ++ ++ ret = create_component(instance, component, name); ++ if (ret < 0) ++ goto unlock; ++ ++ /* ports info needs gathering */ ++ component->control.type = MMAL_PORT_TYPE_CONTROL; ++ component->control.index = 0; ++ component->control.component = component; ++ spin_lock_init(&component->control.slock); ++ INIT_LIST_HEAD(&component->control.buffers); ++ ret = port_info_get(instance, &component->control); ++ if (ret < 0) ++ goto release_component; ++ ++ for (idx = 0; idx < component->inputs; idx++) { ++ component->input[idx].type = MMAL_PORT_TYPE_INPUT; ++ component->input[idx].index = idx; ++ component->input[idx].component = component; ++ spin_lock_init(&component->input[idx].slock); ++ INIT_LIST_HEAD(&component->input[idx].buffers); ++ ret = port_info_get(instance, &component->input[idx]); ++ if (ret < 0) ++ goto release_component; ++ } ++ ++ for (idx = 0; idx < component->outputs; idx++) { ++ component->output[idx].type = MMAL_PORT_TYPE_OUTPUT; ++ component->output[idx].index = idx; ++ component->output[idx].component = component; ++ spin_lock_init(&component->output[idx].slock); ++ INIT_LIST_HEAD(&component->output[idx].buffers); ++ ret = port_info_get(instance, &component->output[idx]); ++ if (ret < 0) ++ goto release_component; ++ } ++ ++ for (idx = 0; idx < component->clocks; idx++) { ++ component->clock[idx].type = MMAL_PORT_TYPE_CLOCK; ++ component->clock[idx].index = idx; ++ component->clock[idx].component = component; ++ spin_lock_init(&component->clock[idx].slock); ++ INIT_LIST_HEAD(&component->clock[idx].buffers); ++ ret = port_info_get(instance, &component->clock[idx]); ++ if (ret < 0) ++ goto release_component; ++ } ++ ++ instance->component_idx++; ++ ++ *component_out = component; ++ ++ mutex_unlock(&instance->vchiq_mutex); ++ ++ return 0; ++ ++release_component: ++ destroy_component(instance, component); ++unlock: ++ mutex_unlock(&instance->vchiq_mutex); ++ ++ return ret; ++} ++ ++/* ++ * cause a mmal component to be destroyed ++ */ ++int vchiq_mmal_component_finalise(struct vchiq_mmal_instance *instance, ++ struct vchiq_mmal_component *component) ++{ ++ int ret; ++ ++ if (mutex_lock_interruptible(&instance->vchiq_mutex)) ++ return -EINTR; ++ ++ if (component->enabled) ++ ret = disable_component(instance, component); ++ ++ ret = destroy_component(instance, component); ++ ++ mutex_unlock(&instance->vchiq_mutex); ++ ++ return ret; ++} ++ ++/* ++ * cause a mmal component to be enabled ++ */ ++int vchiq_mmal_component_enable(struct vchiq_mmal_instance *instance, ++ struct vchiq_mmal_component *component) ++{ ++ int ret; ++ ++ if (mutex_lock_interruptible(&instance->vchiq_mutex)) ++ return -EINTR; ++ ++ if (component->enabled) { ++ mutex_unlock(&instance->vchiq_mutex); ++ return 0; ++ } ++ ++ ret = enable_component(instance, component); ++ if (ret == 0) ++ component->enabled = true; ++ ++ mutex_unlock(&instance->vchiq_mutex); ++ ++ return ret; ++} ++ ++/* ++ * cause a mmal component to be enabled ++ */ ++int vchiq_mmal_component_disable(struct vchiq_mmal_instance *instance, ++ struct vchiq_mmal_component *component) ++{ ++ int ret; ++ ++ if (mutex_lock_interruptible(&instance->vchiq_mutex)) ++ return -EINTR; ++ ++ if (!component->enabled) { ++ mutex_unlock(&instance->vchiq_mutex); ++ return 0; ++ } ++ ++ ret = disable_component(instance, component); ++ if (ret == 0) ++ component->enabled = false; ++ ++ mutex_unlock(&instance->vchiq_mutex); ++ ++ return ret; ++} ++ ++int vchiq_mmal_version(struct vchiq_mmal_instance *instance, ++ u32 *major_out, u32 *minor_out) ++{ ++ int ret; ++ ++ if (mutex_lock_interruptible(&instance->vchiq_mutex)) ++ return -EINTR; ++ ++ ret = get_version(instance, major_out, minor_out); ++ ++ mutex_unlock(&instance->vchiq_mutex); ++ ++ return ret; ++} ++ ++int vchiq_mmal_finalise(struct vchiq_mmal_instance *instance) ++{ ++ int status = 0; ++ ++ if (instance == NULL) ++ return -EINVAL; ++ ++ if (mutex_lock_interruptible(&instance->vchiq_mutex)) ++ return -EINTR; ++ ++ vchi_service_use(instance->handle); ++ ++ status = vchi_service_close(instance->handle); ++ if (status != 0) ++ pr_err("mmal-vchiq: VCHIQ close failed"); ++ ++ mutex_unlock(&instance->vchiq_mutex); ++ ++ vfree(instance->bulk_scratch); ++ ++ kfree(instance); ++ ++ return status; ++} ++ ++int vchiq_mmal_init(struct vchiq_mmal_instance **out_instance) ++{ ++ int status; ++ struct vchiq_mmal_instance *instance; ++ static VCHI_CONNECTION_T *vchi_connection; ++ static VCHI_INSTANCE_T vchi_instance; ++ SERVICE_CREATION_T params = { ++ VCHI_VERSION_EX(VC_MMAL_VER, VC_MMAL_MIN_VER), ++ VC_MMAL_SERVER_NAME, ++ vchi_connection, ++ 0, /* rx fifo size (unused) */ ++ 0, /* tx fifo size (unused) */ ++ service_callback, ++ NULL, /* service callback parameter */ ++ 1, /* unaligned bulk receives */ ++ 1, /* unaligned bulk transmits */ ++ 0 /* want crc check on bulk transfers */ ++ }; ++ ++ /* compile time checks to ensure structure size as they are ++ * directly (de)serialised from memory. ++ */ ++ ++ /* ensure the header structure has packed to the correct size */ ++ BUILD_BUG_ON(sizeof(struct mmal_msg_header) != 24); ++ ++ /* ensure message structure does not exceed maximum length */ ++ BUILD_BUG_ON(sizeof(struct mmal_msg) > MMAL_MSG_MAX_SIZE); ++ ++ /* mmal port struct is correct size */ ++ BUILD_BUG_ON(sizeof(struct mmal_port) != 64); ++ ++ /* create a vchi instance */ ++ status = vchi_initialise(&vchi_instance); ++ if (status) { ++ pr_err("Failed to initialise VCHI instance (status=%d)\n", ++ status); ++ return -EIO; ++ } ++ ++ status = vchi_connect(NULL, 0, vchi_instance); ++ if (status) { ++ pr_err("Failed to connect VCHI instance (status=%d)\n", status); ++ return -EIO; ++ } ++ ++ instance = kmalloc(sizeof(*instance), GFP_KERNEL); ++ memset(instance, 0, sizeof(*instance)); ++ ++ mutex_init(&instance->vchiq_mutex); ++ mutex_init(&instance->bulk_mutex); ++ ++ instance->bulk_scratch = vmalloc(PAGE_SIZE); ++ ++ params.callback_param = instance; ++ ++ status = vchi_service_open(vchi_instance, &params, &instance->handle); ++ if (status) { ++ pr_err("Failed to open VCHI service connection (status=%d)\n", ++ status); ++ goto err_close_services; ++ } ++ ++ vchi_service_release(instance->handle); ++ ++ *out_instance = instance; ++ ++ return 0; ++ ++err_close_services: ++ ++ vchi_service_close(instance->handle); ++ vfree(instance->bulk_scratch); ++ kfree(instance); ++ return -ENODEV; ++} +diff --git a/drivers/media/platform/bcm2835/mmal-vchiq.h b/drivers/media/platform/bcm2835/mmal-vchiq.h +new file mode 100644 +index 0000000..9d1d11e +--- /dev/null ++++ b/drivers/media/platform/bcm2835/mmal-vchiq.h +@@ -0,0 +1,178 @@ ++/* ++ * Broadcom BM2835 V4L2 driver ++ * ++ * Copyright © 2013 Raspberry Pi (Trading) Ltd. ++ * ++ * This file is subject to the terms and conditions of the GNU General Public ++ * License. See the file COPYING in the main directory of this archive ++ * for more details. ++ * ++ * Authors: Vincent Sanders <vincent.sanders@collabora.co.uk> ++ * Dave Stevenson <dsteve@broadcom.com> ++ * Simon Mellor <simellor@broadcom.com> ++ * Luke Diamand <luked@broadcom.com> ++ * ++ * MMAL interface to VCHIQ message passing ++ */ ++ ++#ifndef MMAL_VCHIQ_H ++#define MMAL_VCHIQ_H ++ ++#include "mmal-msg-format.h" ++ ++#define MAX_PORT_COUNT 4 ++ ++/* Maximum size of the format extradata. */ ++#define MMAL_FORMAT_EXTRADATA_MAX_SIZE 128 ++ ++struct vchiq_mmal_instance; ++ ++enum vchiq_mmal_es_type { ++ MMAL_ES_TYPE_UNKNOWN, /**< Unknown elementary stream type */ ++ MMAL_ES_TYPE_CONTROL, /**< Elementary stream of control commands */ ++ MMAL_ES_TYPE_AUDIO, /**< Audio elementary stream */ ++ MMAL_ES_TYPE_VIDEO, /**< Video elementary stream */ ++ MMAL_ES_TYPE_SUBPICTURE /**< Sub-picture elementary stream */ ++}; ++ ++/* rectangle, used lots so it gets its own struct */ ++struct vchiq_mmal_rect { ++ s32 x; ++ s32 y; ++ s32 width; ++ s32 height; ++}; ++ ++struct vchiq_mmal_port_buffer { ++ unsigned int num; /* number of buffers */ ++ u32 size; /* size of buffers */ ++ u32 alignment; /* alignment of buffers */ ++}; ++ ++struct vchiq_mmal_port; ++ ++typedef void (*vchiq_mmal_buffer_cb)( ++ struct vchiq_mmal_instance *instance, ++ struct vchiq_mmal_port *port, ++ int status, struct mmal_buffer *buffer, ++ unsigned long length, u32 mmal_flags, s64 dts, s64 pts); ++ ++struct vchiq_mmal_port { ++ bool enabled; ++ u32 handle; ++ u32 type; /* port type, cached to use on port info set */ ++ u32 index; /* port index, cached to use on port info set */ ++ ++ /* component port belongs to, allows simple deref */ ++ struct vchiq_mmal_component *component; ++ ++ struct vchiq_mmal_port *connected; /* port conencted to */ ++ ++ /* buffer info */ ++ struct vchiq_mmal_port_buffer minimum_buffer; ++ struct vchiq_mmal_port_buffer recommended_buffer; ++ struct vchiq_mmal_port_buffer current_buffer; ++ ++ /* stream format */ ++ struct mmal_es_format format; ++ /* elementry stream format */ ++ union mmal_es_specific_format es; ++ ++ /* data buffers to fill */ ++ struct list_head buffers; ++ /* lock to serialise adding and removing buffers from list */ ++ spinlock_t slock; ++ /* count of how many buffer header refils have failed because ++ * there was no buffer to satisfy them ++ */ ++ int buffer_underflow; ++ /* callback on buffer completion */ ++ vchiq_mmal_buffer_cb buffer_cb; ++ /* callback context */ ++ void *cb_ctx; ++}; ++ ++struct vchiq_mmal_component { ++ bool enabled; ++ u32 handle; /* VideoCore handle for component */ ++ u32 inputs; /* Number of input ports */ ++ u32 outputs; /* Number of output ports */ ++ u32 clocks; /* Number of clock ports */ ++ struct vchiq_mmal_port control; /* control port */ ++ struct vchiq_mmal_port input[MAX_PORT_COUNT]; /* input ports */ ++ struct vchiq_mmal_port output[MAX_PORT_COUNT]; /* output ports */ ++ struct vchiq_mmal_port clock[MAX_PORT_COUNT]; /* clock ports */ ++}; ++ ++ ++int vchiq_mmal_init(struct vchiq_mmal_instance **out_instance); ++int vchiq_mmal_finalise(struct vchiq_mmal_instance *instance); ++ ++/* Initialise a mmal component and its ports ++* ++*/ ++int vchiq_mmal_component_init( ++ struct vchiq_mmal_instance *instance, ++ const char *name, ++ struct vchiq_mmal_component **component_out); ++ ++int vchiq_mmal_component_finalise( ++ struct vchiq_mmal_instance *instance, ++ struct vchiq_mmal_component *component); ++ ++int vchiq_mmal_component_enable( ++ struct vchiq_mmal_instance *instance, ++ struct vchiq_mmal_component *component); ++ ++int vchiq_mmal_component_disable( ++ struct vchiq_mmal_instance *instance, ++ struct vchiq_mmal_component *component); ++ ++ ++ ++/* enable a mmal port ++ * ++ * enables a port and if a buffer callback provided enque buffer ++ * headers as apropriate for the port. ++ */ ++int vchiq_mmal_port_enable( ++ struct vchiq_mmal_instance *instance, ++ struct vchiq_mmal_port *port, ++ vchiq_mmal_buffer_cb buffer_cb); ++ ++/* disable a port ++ * ++ * disable a port will dequeue any pending buffers ++ */ ++int vchiq_mmal_port_disable(struct vchiq_mmal_instance *instance, ++ struct vchiq_mmal_port *port); ++ ++ ++int vchiq_mmal_port_parameter_set(struct vchiq_mmal_instance *instance, ++ struct vchiq_mmal_port *port, ++ u32 parameter, ++ void *value, ++ u32 value_size); ++ ++int vchiq_mmal_port_parameter_get(struct vchiq_mmal_instance *instance, ++ struct vchiq_mmal_port *port, ++ u32 parameter, ++ void *value, ++ u32 *value_size); ++ ++int vchiq_mmal_port_set_format(struct vchiq_mmal_instance *instance, ++ struct vchiq_mmal_port *port); ++ ++int vchiq_mmal_port_connect_tunnel(struct vchiq_mmal_instance *instance, ++ struct vchiq_mmal_port *src, ++ struct vchiq_mmal_port *dst); ++ ++int vchiq_mmal_version(struct vchiq_mmal_instance *instance, ++ u32 *major_out, ++ u32 *minor_out); ++ ++int vchiq_mmal_submit_buffer(struct vchiq_mmal_instance *instance, ++ struct vchiq_mmal_port *port, ++ struct mmal_buffer *buf); ++ ++#endif /* MMAL_VCHIQ_H */ + +From f91fde0e119041b5a8c762748fc51c2637eb38a4 Mon Sep 17 00:00:00 2001 +From: Phil Elwell <phil@raspberrypi.org> +Date: Mon, 11 May 2015 09:00:42 +0100 +Subject: [PATCH 054/112] scripts: Add mkknlimg and knlinfo scripts from tools + repo + +The Raspberry Pi firmware looks for a trailer on the kernel image to +determine whether it was compiled with Device Tree support enabled. +If the firmware finds a kernel without this trailer, or which has a +trailer indicating that it isn't DT-capable, it disables DT support +and reverts to using ATAGs. + +The mkknlimg utility adds that trailer, having first analysed the +image to look for signs of DT support and the kernel version string. + +knlinfo displays the contents of the trailer in the given kernel image. + +scripts/mkknlimg: Add support for ARCH_BCM2835 + +Add a new trailer field indicating whether this is an ARCH_BCM2835 +build, as opposed to MACH_BCM2708/9. If the loader finds this flag +is set it changes the default base dtb file name from bcm270x... +to bcm283y... + +Also update knlinfo to show the status of the field. + +scripts/mkknlimg: Improve ARCH_BCM2835 detection + +The board support code contains sufficient strings to be able to +distinguish 2708 vs. 2835 builds, so remove the check for +bcm2835-pm-wdt which could exist in either. + +Also, since the canned configuration is no longer built in (it's +a module), remove the config string checking. + +See: https://github.com/raspberrypi/linux/issues/1157 + +scripts: Multi-platform support for mkknlimg and knlinfo + +The firmware uses tags in the kernel trailer to choose which dtb file +to load. Current firmware loads bcm2835-*.dtb if the '283x' tag is true, +otherwise it loads bcm270*.dtb. This scheme breaks if an image supports +multiple platforms. + +This patch adds '270X' and '283X' tags to indicate support for RPi and +upstream platforms, respectively. '283x' (note lower case 'x') is left +for old firmware, and is only set if the image only supports upstream +builds. + +scripts/mkknlimg: Append a trailer for all input + +Now that the firmware assumes an unsigned kernel is DT-capable, it is +helpful to be able to mark a kernel as being non-DT-capable. + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> + +scripts/knlinfo: Decode DDTK atom + +Show the DDTK atom as being a boolean. + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> +--- + scripts/knlinfo | 171 ++++++++++++++++++++++++++++++++++++ + scripts/mkknlimg | 263 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 434 insertions(+) + create mode 100755 scripts/knlinfo + create mode 100755 scripts/mkknlimg + +diff --git a/scripts/knlinfo b/scripts/knlinfo +new file mode 100755 +index 0000000..263ec93 +--- /dev/null ++++ b/scripts/knlinfo +@@ -0,0 +1,171 @@ ++#!/usr/bin/env perl ++# ---------------------------------------------------------------------- ++# knlinfo by Phil Elwell for Raspberry Pi ++# ++# (c) 2014,2015 Raspberry Pi (Trading) Limited <info@raspberrypi.org> ++# ++# Licensed under the terms of the GNU General Public License. ++# ---------------------------------------------------------------------- ++ ++use strict; ++use integer; ++ ++use Fcntl ":seek"; ++ ++my $trailer_magic = 'RPTL'; ++ ++my %atom_formats = ++( ++ 'DDTK' => \&format_bool, ++ 'DTOK' => \&format_bool, ++ 'KVer' => \&format_string, ++ '270X' => \&format_bool, ++ '283X' => \&format_bool, ++ '283x' => \&format_bool, ++); ++ ++if (@ARGV != 1) ++{ ++ print ("Usage: knlinfo <kernel image>\n"); ++ exit(1); ++} ++ ++my $kernel_file = $ARGV[0]; ++ ++ ++my ($atoms, $pos) = read_trailer($kernel_file); ++ ++exit(1) if (!$atoms); ++ ++printf("Kernel trailer found at %d/0x%x:\n", $pos, $pos); ++ ++foreach my $atom (@$atoms) ++{ ++ printf(" %s: %s\n", $atom->[0], format_atom($atom)); ++} ++ ++exit(0); ++ ++sub read_trailer ++{ ++ my ($kernel_file) = @_; ++ my $fh; ++ ++ if (!open($fh, '<', $kernel_file)) ++ { ++ print ("* Failed to open '$kernel_file'\n"); ++ return undef; ++ } ++ ++ if (!seek($fh, -12, SEEK_END)) ++ { ++ print ("* seek error in '$kernel_file'\n"); ++ return undef; ++ } ++ ++ my $last_bytes; ++ sysread($fh, $last_bytes, 12); ++ ++ my ($trailer_len, $data_len, $magic) = unpack('VVa4', $last_bytes); ++ ++ if (($magic ne $trailer_magic) || ($data_len != 4)) ++ { ++ print ("* no trailer\n"); ++ return undef; ++ } ++ if (!seek($fh, -12, SEEK_END)) ++ { ++ print ("* seek error in '$kernel_file'\n"); ++ return undef; ++ } ++ ++ $trailer_len -= 12; ++ ++ while ($trailer_len > 0) ++ { ++ if ($trailer_len < 8) ++ { ++ print ("* truncated atom header in trailer\n"); ++ return undef; ++ } ++ if (!seek($fh, -8, SEEK_CUR)) ++ { ++ print ("* seek error in '$kernel_file'\n"); ++ return undef; ++ } ++ $trailer_len -= 8; ++ ++ my $atom_hdr; ++ sysread($fh, $atom_hdr, 8); ++ my ($atom_len, $atom_type) = unpack('Va4', $atom_hdr); ++ ++ if ($trailer_len < $atom_len) ++ { ++ print ("* truncated atom data in trailer\n"); ++ return undef; ++ } ++ ++ my $rounded_len = (($atom_len + 3) & ~3); ++ if (!seek($fh, -(8 + $rounded_len), SEEK_CUR)) ++ { ++ print ("* seek error in '$kernel_file'\n"); ++ return undef; ++ } ++ $trailer_len -= $rounded_len; ++ ++ my $atom_data; ++ sysread($fh, $atom_data, $atom_len); ++ ++ if (!seek($fh, -$atom_len, SEEK_CUR)) ++ { ++ print ("* seek error in '$kernel_file'\n"); ++ return undef; ++ } ++ ++ push @$atoms, [ $atom_type, $atom_data ]; ++ } ++ ++ if (($$atoms[-1][0] eq "\x00\x00\x00\x00") && ++ ($$atoms[-1][1] eq "")) ++ { ++ pop @$atoms; ++ } ++ else ++ { ++ print ("* end marker missing from trailer\n"); ++ } ++ ++ return ($atoms, tell($fh)); ++} ++ ++sub format_atom ++{ ++ my ($atom) = @_; ++ ++ my $format_func = $atom_formats{$atom->[0]} || \&format_hex; ++ return $format_func->($atom->[1]); ++} ++ ++sub format_bool ++{ ++ my ($data) = @_; ++ return unpack('V', $data) ? 'y' : 'n'; ++} ++ ++sub format_int ++{ ++ my ($data) = @_; ++ return unpack('V', $data); ++} ++ ++sub format_string ++{ ++ my ($data) = @_; ++ return '"'.$data.'"'; ++} ++ ++sub format_hex ++{ ++ my ($data) = @_; ++ return unpack('H*', $data); ++} +diff --git a/scripts/mkknlimg b/scripts/mkknlimg +new file mode 100755 +index 0000000..78c5845 +--- /dev/null ++++ b/scripts/mkknlimg +@@ -0,0 +1,263 @@ ++#!/usr/bin/env perl ++# ---------------------------------------------------------------------- ++# mkknlimg by Phil Elwell for Raspberry Pi ++# based on extract-ikconfig by Dick Streefland ++# ++# (c) 2009,2010 Dick Streefland <dick@streefland.net> ++# (c) 2014,2015 Raspberry Pi (Trading) Limited <info@raspberrypi.org> ++# ++# Licensed under the terms of the GNU General Public License. ++# ---------------------------------------------------------------------- ++ ++use strict; ++use warnings; ++use integer; ++ ++use constant FLAG_PI => 0x01; ++use constant FLAG_DTOK => 0x02; ++use constant FLAG_DDTK => 0x04; ++use constant FLAG_270X => 0x08; ++use constant FLAG_283X => 0x10; ++ ++my $trailer_magic = 'RPTL'; ++ ++my $tmpfile1 = "/tmp/mkknlimg_$$.1"; ++my $tmpfile2 = "/tmp/mkknlimg_$$.2"; ++ ++my $dtok = 0; ++my $ddtk = 0; ++my $is_270x = 0; ++my $is_283x = 0; ++ ++while (@ARGV && ($ARGV[0] =~ /^-/)) ++{ ++ my $arg = shift(@ARGV); ++ if ($arg eq '--dtok') ++ { ++ $dtok = 1; ++ } ++ elsif ($arg eq '--ddtk') ++ { ++ $ddtk = 1; ++ } ++ elsif ($arg eq '--270x') ++ { ++ $is_270x = 1; ++ } ++ elsif ($arg eq '--283x') ++ { ++ $is_283x = 1; ++ } ++ else ++ { ++ print ("* Unknown option '$arg'\n"); ++ usage(); ++ } ++} ++ ++usage() if (@ARGV != 2); ++ ++my $kernel_file = $ARGV[0]; ++my $out_file = $ARGV[1]; ++ ++if (! -r $kernel_file) ++{ ++ print ("* File '$kernel_file' not found\n"); ++ usage(); ++} ++ ++my $wanted_strings = ++{ ++ 'bcm2708_fb' => FLAG_PI, ++ 'brcm,bcm2835-mmc' => FLAG_PI, ++ 'brcm,bcm2835-sdhost' => FLAG_PI, ++ 'brcm,bcm2708-pinctrl' => FLAG_PI | FLAG_DTOK, ++ 'brcm,bcm2835-gpio' => FLAG_PI | FLAG_DTOK, ++ 'brcm,bcm2708' => FLAG_PI | FLAG_DTOK | FLAG_270X, ++ 'brcm,bcm2709' => FLAG_PI | FLAG_DTOK | FLAG_270X, ++ 'brcm,bcm2835' => FLAG_PI | FLAG_DTOK | FLAG_283X, ++ 'brcm,bcm2836' => FLAG_PI | FLAG_DTOK | FLAG_283X, ++ 'of_overlay_apply' => FLAG_DTOK | FLAG_DDTK, ++}; ++ ++my $res = try_extract($kernel_file, $tmpfile1); ++$res ||= try_decompress('\037\213\010', 'xy', 'gunzip', 0, ++ $kernel_file, $tmpfile1, $tmpfile2); ++$res ||= try_decompress('\3757zXZ\000', 'abcde', 'unxz --single-stream', -1, ++ $kernel_file, $tmpfile1, $tmpfile2); ++$res ||= try_decompress('BZh', 'xy', 'bunzip2', 0, ++ $kernel_file, $tmpfile1, $tmpfile2); ++$res ||= try_decompress('\135\0\0\0', 'xxx', 'unlzma', 0, ++ $kernel_file, $tmpfile1, $tmpfile2); ++$res ||= try_decompress('\211\114\132', 'xy', 'lzop -d', 0, ++ $kernel_file, $tmpfile1, $tmpfile2); ++$res ||= try_decompress('\002\041\114\030', 'xy', 'lz4 -d', 1, ++ $kernel_file, $tmpfile1, $tmpfile2); ++ ++my $append_trailer; ++my $trailer; ++my $kver = '?'; ++ ++$append_trailer = 1; ++ ++if ($res) ++{ ++ $kver = $res->{'kver'} || '?'; ++ my $flags = $res->{'flags'}; ++ print("Version: $kver\n"); ++ ++ if ($flags & FLAG_PI) ++ { ++ $dtok ||= ($flags & FLAG_DTOK) != 0; ++ $is_270x ||= ($flags & FLAG_270X) != 0; ++ $is_283x ||= ($flags & FLAG_283X) != 0; ++ $ddtk ||= ($flags & FLAG_DDTK) != 0; ++ } ++ else ++ { ++ print ("* This doesn't look like a Raspberry Pi kernel.\n"); ++ } ++} ++elsif (!$dtok) ++{ ++ print ("* Is this a valid kernel?\n"); ++} ++ ++if ($append_trailer) ++{ ++ printf("DT: %s\n", $dtok ? "y" : "n"); ++ printf("DDT: %s\n", $ddtk ? "y" : "n"); ++ printf("270x: %s\n", $is_270x ? "y" : "n"); ++ printf("283x: %s\n", $is_283x ? "y" : "n"); ++ ++ my @atoms; ++ ++ push @atoms, [ $trailer_magic, pack('V', 0) ]; ++ push @atoms, [ 'KVer', $kver ]; ++ push @atoms, [ 'DTOK', pack('V', $dtok) ]; ++ push @atoms, [ 'DDTK', pack('V', $ddtk) ]; ++ push @atoms, [ '270X', pack('V', $is_270x) ]; ++ push @atoms, [ '283X', pack('V', $is_283x) ]; ++ push @atoms, [ '283x', pack('V', $is_283x && !$is_270x) ]; ++ ++ $trailer = pack_trailer(\@atoms); ++ $atoms[0]->[1] = pack('V', length($trailer)); ++ ++ $trailer = pack_trailer(\@atoms); ++} ++ ++my $ofh; ++my $total_len = 0; ++ ++if ($out_file eq $kernel_file) ++{ ++ die "* Failed to open '$out_file' for append\n" ++ if (!open($ofh, '>>', $out_file)); ++ $total_len = tell($ofh); ++} ++else ++{ ++ die "* Failed to open '$kernel_file'\n" ++ if (!open(my $ifh, '<', $kernel_file)); ++ die "* Failed to create '$out_file'\n" ++ if (!open($ofh, '>', $out_file)); ++ ++ my $copybuf; ++ while (1) ++ { ++ my $bytes = sysread($ifh, $copybuf, 64*1024); ++ last if (!$bytes); ++ syswrite($ofh, $copybuf, $bytes); ++ $total_len += $bytes; ++ } ++ close($ifh); ++} ++ ++if ($trailer) ++{ ++ # Pad to word-alignment ++ syswrite($ofh, "\x000\x000\x000", (-$total_len & 0x3)); ++ syswrite($ofh, $trailer); ++} ++ ++close($ofh); ++ ++exit($trailer ? 0 : 1); ++ ++END { ++ unlink($tmpfile1) if ($tmpfile1); ++ unlink($tmpfile2) if ($tmpfile2); ++} ++ ++ ++sub usage ++{ ++ print ("Usage: mkknlimg [--dtok] [--270x] [--283x] <vmlinux|zImage|bzImage> <outfile>\n"); ++ exit(1); ++} ++ ++sub try_extract ++{ ++ my ($knl, $tmp) = @_; ++ ++ my $ver = `strings "$knl" | grep -a -E "^Linux version [1-9]"`; ++ ++ return undef if (!$ver); ++ ++ chomp($ver); ++ ++ my $res = { 'kver'=>$ver }; ++ $res->{'flags'} = strings_to_flags($knl, $wanted_strings); ++ ++ return $res; ++} ++ ++ ++sub try_decompress ++{ ++ my ($magic, $subst, $zcat, $idx, $knl, $tmp1, $tmp2) = @_; ++ ++ my $pos = `tr "$magic\n$subst" "\n$subst=" < "$knl" | grep -abo "^$subst"`; ++ if ($pos) ++ { ++ chomp($pos); ++ $pos = (split(/[\r\n]+/, $pos))[$idx]; ++ return undef if (!defined($pos)); ++ $pos =~ s/:.*[\r\n]*$//s; ++ my $cmd = "tail -c+$pos \"$knl\" | $zcat > $tmp2 2> /dev/null"; ++ my $err = (system($cmd) >> 8); ++ return undef if (($err != 0) && ($err != 2)); ++ ++ return try_extract($tmp2, $tmp1); ++ } ++ ++ return undef; ++} ++ ++sub strings_to_flags ++{ ++ my ($knl, $strings) = @_; ++ my $string_pattern = '^('.join('|', keys(%$strings)).')$'; ++ my $flags = 0; ++ ++ my @matches = `strings \"$knl\" | grep -E \"$string_pattern\"`; ++ foreach my $match (@matches) ++ { ++ chomp($match); ++ $flags |= $strings->{$match}; ++ } ++ ++ return $flags; ++} ++ ++sub pack_trailer ++{ ++ my ($atoms) = @_; ++ my $trailer = pack('VV', 0, 0); ++ for (my $i = $#$atoms; $i>=0; $i--) ++ { ++ my $atom = $atoms->[$i]; ++ $trailer .= pack('a*x!4Va4', $atom->[1], length($atom->[1]), $atom->[0]); ++ } ++ return $trailer; ++} + +From bcf6cc7b91fb794994940d91f41159cd16d1cb18 Mon Sep 17 00:00:00 2001 +From: Phil Elwell <phil@raspberrypi.org> +Date: Mon, 10 Aug 2015 09:49:15 +0100 +Subject: [PATCH 055/112] scripts/dtc: Update to upstream version 1.4.1 + +Includes the new localfixups format. + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> + +scripts/dtc: Fix UMR causing corrupt dtbo overlay files + +struct fixup_entry is allocated from the heap but it's member +local_fixup_generated was never initialized. This lead to +corrupted dtbo files. + +Fix this by initializing local_fixup_generated to false. + +Signed-off-by: Matthias Reichl <hias@horus.com> + +scripts/dtc: Only emit local fixups for overlays + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> +--- + scripts/dtc/checks.c | 106 +++++- + scripts/dtc/dtc-lexer.l | 5 + + scripts/dtc/dtc-lexer.lex.c_shipped | 537 +++++++++++++------------- + scripts/dtc/dtc-parser.tab.c_shipped | 714 ++++++++++++++++++----------------- + scripts/dtc/dtc-parser.tab.h_shipped | 46 +-- + scripts/dtc/dtc-parser.y | 22 +- + scripts/dtc/dtc.c | 9 +- + scripts/dtc/dtc.h | 40 ++ + scripts/dtc/flattree.c | 202 ++++++++++ + scripts/dtc/version_gen.h | 2 +- + 10 files changed, 1029 insertions(+), 654 deletions(-) + +diff --git a/scripts/dtc/checks.c b/scripts/dtc/checks.c +index 0c03ac9..88550b4 100644 +--- a/scripts/dtc/checks.c ++++ b/scripts/dtc/checks.c +@@ -458,6 +458,8 @@ static void fixup_phandle_references(struct check *c, struct node *dt, + struct node *node, struct property *prop) + { + struct marker *m = prop->val.markers; ++ struct fixup *f, **fp; ++ struct fixup_entry *fe, **fep; + struct node *refnode; + cell_t phandle; + +@@ -466,11 +468,70 @@ static void fixup_phandle_references(struct check *c, struct node *dt, + + refnode = get_node_by_ref(dt, m->ref); + if (! refnode) { +- FAIL(c, "Reference to non-existent node or label \"%s\"\n", +- m->ref); ++ if (!dt->is_plugin) { ++ FAIL(c, "Reference to non-existent node or label \"%s\"\n", ++ m->ref); ++ continue; ++ } ++ ++ /* allocate fixup entry */ ++ fe = xmalloc(sizeof(*fe)); ++ ++ fe->node = node; ++ fe->prop = prop; ++ fe->offset = m->offset; ++ fe->next = NULL; ++ ++ /* search for an already existing fixup */ ++ for_each_fixup(dt, f) ++ if (strcmp(f->ref, m->ref) == 0) ++ break; ++ ++ /* no fixup found, add new */ ++ if (f == NULL) { ++ f = xmalloc(sizeof(*f)); ++ f->ref = m->ref; ++ f->entries = NULL; ++ f->next = NULL; ++ ++ /* add it to the tree */ ++ fp = &dt->fixups; ++ while (*fp) ++ fp = &(*fp)->next; ++ *fp = f; ++ } ++ ++ /* and now append fixup entry */ ++ fep = &f->entries; ++ while (*fep) ++ fep = &(*fep)->next; ++ *fep = fe; ++ ++ /* mark the entry as unresolved */ ++ *((cell_t *)(prop->val.val + m->offset)) = ++ cpu_to_fdt32(0xdeadbeef); + continue; + } + ++ /* if it's a local reference, we need to record it */ ++ if (symbol_fixup_support && dt->is_plugin) { ++ ++ /* allocate a new local fixup entry */ ++ fe = xmalloc(sizeof(*fe)); ++ ++ fe->node = node; ++ fe->prop = prop; ++ fe->offset = m->offset; ++ fe->next = NULL; ++ fe->local_fixup_generated = false; ++ ++ /* append it to the local fixups */ ++ fep = &dt->local_fixups; ++ while (*fep) ++ fep = &(*fep)->next; ++ *fep = fe; ++ } ++ + phandle = get_node_phandle(dt, refnode); + *((cell_t *)(prop->val.val + m->offset)) = cpu_to_fdt32(phandle); + } +@@ -652,6 +713,45 @@ static void check_obsolete_chosen_interrupt_controller(struct check *c, + } + TREE_WARNING(obsolete_chosen_interrupt_controller, NULL); + ++static void check_auto_label_phandles(struct check *c, struct node *dt, ++ struct node *node) ++{ ++ struct label *l; ++ struct symbol *s, **sp; ++ int has_label; ++ ++ if (!symbol_fixup_support) ++ return; ++ ++ has_label = 0; ++ for_each_label(node->labels, l) { ++ has_label = 1; ++ break; ++ } ++ ++ if (!has_label) ++ return; ++ ++ /* force allocation of a phandle for this node */ ++ (void)get_node_phandle(dt, node); ++ ++ /* add the symbol */ ++ for_each_label(node->labels, l) { ++ ++ s = xmalloc(sizeof(*s)); ++ s->label = l; ++ s->node = node; ++ s->next = NULL; ++ ++ /* add it to the symbols list */ ++ sp = &dt->symbols; ++ while (*sp) ++ sp = &((*sp)->next); ++ *sp = s; ++ } ++} ++NODE_WARNING(auto_label_phandles, NULL); ++ + static struct check *check_table[] = { + &duplicate_node_names, &duplicate_property_names, + &node_name_chars, &node_name_format, &property_name_chars, +@@ -670,6 +770,8 @@ static struct check *check_table[] = { + &avoid_default_addr_size, + &obsolete_chosen_interrupt_controller, + ++ &auto_label_phandles, ++ + &always_fail, + }; + +diff --git a/scripts/dtc/dtc-lexer.l b/scripts/dtc/dtc-lexer.l +index 790fbf6..40bbc87 100644 +--- a/scripts/dtc/dtc-lexer.l ++++ b/scripts/dtc/dtc-lexer.l +@@ -121,6 +121,11 @@ static void lexical_error(const char *fmt, ...); + return DT_V1; + } + ++<*>"/plugin/" { ++ DPRINT("Keyword: /plugin/\n"); ++ return DT_PLUGIN; ++ } ++ + <*>"/memreserve/" { + DPRINT("Keyword: /memreserve/\n"); + BEGIN_DEFAULT(); +diff --git a/scripts/dtc/dtc-lexer.lex.c_shipped b/scripts/dtc/dtc-lexer.lex.c_shipped +index ba525c2..1518525 100644 +--- a/scripts/dtc/dtc-lexer.lex.c_shipped ++++ b/scripts/dtc/dtc-lexer.lex.c_shipped +@@ -9,7 +9,7 @@ + #define FLEX_SCANNER + #define YY_FLEX_MAJOR_VERSION 2 + #define YY_FLEX_MINOR_VERSION 5 +-#define YY_FLEX_SUBMINOR_VERSION 39 ++#define YY_FLEX_SUBMINOR_VERSION 35 + #if YY_FLEX_SUBMINOR_VERSION > 0 + #define FLEX_BETA + #endif +@@ -162,12 +162,7 @@ typedef unsigned int flex_uint32_t; + typedef struct yy_buffer_state *YY_BUFFER_STATE; + #endif + +-#ifndef YY_TYPEDEF_YY_SIZE_T +-#define YY_TYPEDEF_YY_SIZE_T +-typedef size_t yy_size_t; +-#endif +- +-extern yy_size_t yyleng; ++extern int yyleng; + + extern FILE *yyin, *yyout; + +@@ -176,7 +171,6 @@ extern FILE *yyin, *yyout; + #define EOB_ACT_LAST_MATCH 2 + + #define YY_LESS_LINENO(n) +- #define YY_LINENO_REWIND_TO(ptr) + + /* Return all but the first "n" matched characters back to the input stream. */ + #define yyless(n) \ +@@ -194,6 +188,11 @@ extern FILE *yyin, *yyout; + + #define unput(c) yyunput( c, (yytext_ptr) ) + ++#ifndef YY_TYPEDEF_YY_SIZE_T ++#define YY_TYPEDEF_YY_SIZE_T ++typedef size_t yy_size_t; ++#endif ++ + #ifndef YY_STRUCT_YY_BUFFER_STATE + #define YY_STRUCT_YY_BUFFER_STATE + struct yy_buffer_state +@@ -211,7 +210,7 @@ struct yy_buffer_state + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ +- yy_size_t yy_n_chars; ++ int yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to +@@ -281,8 +280,8 @@ static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ + + /* yy_hold_char holds the character lost when yytext is formed. */ + static char yy_hold_char; +-static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */ +-yy_size_t yyleng; ++static int yy_n_chars; /* number of characters read into yy_ch_buf */ ++int yyleng; + + /* Points to current character in buffer. */ + static char *yy_c_buf_p = (char *) 0; +@@ -310,7 +309,7 @@ static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ); + + YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ); + YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ); +-YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,yy_size_t len ); ++YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len ); + + void *yyalloc (yy_size_t ); + void *yyrealloc (void *,yy_size_t ); +@@ -342,7 +341,7 @@ void yyfree (void * ); + + /* Begin user sect3 */ + +-#define yywrap() 1 ++#define yywrap(n) 1 + #define YY_SKIP_YYWRAP + + typedef unsigned char YY_CHAR; +@@ -373,8 +372,8 @@ static void yy_fatal_error (yyconst char msg[] ); + *yy_cp = '\0'; \ + (yy_c_buf_p) = yy_cp; + +-#define YY_NUM_RULES 30 +-#define YY_END_OF_BUFFER 31 ++#define YY_NUM_RULES 31 ++#define YY_END_OF_BUFFER 32 + /* This struct is not used in this scanner, + but its presence is necessary. */ + struct yy_trans_info +@@ -382,25 +381,26 @@ struct yy_trans_info + flex_int32_t yy_verify; + flex_int32_t yy_nxt; + }; +-static yyconst flex_int16_t yy_accept[159] = ++static yyconst flex_int16_t yy_accept[166] = + { 0, +- 0, 0, 0, 0, 0, 0, 0, 0, 31, 29, +- 18, 18, 29, 29, 29, 29, 29, 29, 29, 29, +- 29, 29, 29, 29, 29, 29, 15, 16, 16, 29, +- 16, 10, 10, 18, 26, 0, 3, 0, 27, 12, +- 0, 0, 11, 0, 0, 0, 0, 0, 0, 0, +- 21, 23, 25, 24, 22, 0, 9, 28, 0, 0, +- 0, 14, 14, 16, 16, 16, 10, 10, 10, 0, +- 12, 0, 11, 0, 0, 0, 20, 0, 0, 0, +- 0, 0, 0, 0, 0, 16, 10, 10, 10, 0, +- 13, 19, 0, 0, 0, 0, 0, 0, 0, 0, +- +- 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, +- 0, 16, 6, 0, 0, 0, 0, 0, 0, 2, +- 0, 0, 0, 0, 0, 0, 0, 0, 4, 17, +- 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, +- 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, +- 5, 8, 0, 0, 0, 0, 7, 0 ++ 0, 0, 0, 0, 0, 0, 0, 0, 32, 30, ++ 19, 19, 30, 30, 30, 30, 30, 30, 30, 30, ++ 30, 30, 30, 30, 30, 30, 16, 17, 17, 30, ++ 17, 11, 11, 19, 27, 0, 3, 0, 28, 13, ++ 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, ++ 0, 22, 24, 26, 25, 23, 0, 10, 29, 0, ++ 0, 0, 15, 15, 17, 17, 17, 11, 11, 11, ++ 0, 13, 0, 12, 0, 0, 0, 21, 0, 0, ++ 0, 0, 0, 0, 0, 0, 0, 17, 11, 11, ++ 11, 0, 14, 20, 0, 0, 0, 0, 0, 0, ++ ++ 0, 0, 0, 0, 17, 0, 0, 0, 0, 0, ++ 0, 0, 0, 0, 0, 17, 7, 0, 0, 0, ++ 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, ++ 0, 0, 0, 0, 4, 18, 0, 0, 5, 2, ++ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ++ 0, 0, 1, 0, 0, 0, 0, 6, 9, 0, ++ 0, 0, 0, 8, 0 + } ; + + static yyconst flex_int32_t yy_ec[256] = +@@ -416,9 +416,9 @@ static yyconst flex_int32_t yy_ec[256] = + 22, 22, 22, 22, 24, 22, 22, 25, 22, 22, + 1, 26, 27, 1, 22, 1, 21, 28, 29, 30, + +- 31, 21, 22, 22, 32, 22, 22, 33, 34, 35, +- 36, 37, 22, 38, 39, 40, 41, 42, 22, 25, +- 43, 22, 44, 45, 46, 1, 1, 1, 1, 1, ++ 31, 21, 32, 22, 33, 22, 22, 34, 35, 36, ++ 37, 38, 22, 39, 40, 41, 42, 43, 22, 25, ++ 44, 22, 45, 46, 47, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +@@ -435,163 +435,165 @@ static yyconst flex_int32_t yy_ec[256] = + 1, 1, 1, 1, 1 + } ; + +-static yyconst flex_int32_t yy_meta[47] = ++static yyconst flex_int32_t yy_meta[48] = + { 0, + 1, 1, 1, 1, 1, 1, 2, 3, 1, 2, + 2, 2, 4, 5, 5, 5, 6, 1, 1, 1, + 7, 8, 8, 8, 8, 1, 1, 7, 7, 7, + 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, +- 8, 8, 8, 3, 1, 4 ++ 8, 8, 8, 8, 3, 1, 4 + } ; + +-static yyconst flex_int16_t yy_base[173] = ++static yyconst flex_int16_t yy_base[180] = + { 0, +- 0, 383, 34, 382, 65, 381, 37, 105, 387, 391, +- 54, 111, 367, 110, 109, 109, 112, 41, 366, 104, +- 367, 338, 124, 117, 0, 144, 391, 0, 121, 0, +- 135, 155, 140, 179, 391, 160, 391, 379, 391, 0, +- 368, 141, 391, 167, 370, 376, 346, 103, 342, 345, +- 391, 391, 391, 391, 391, 358, 391, 391, 175, 342, +- 338, 391, 355, 0, 185, 339, 184, 347, 346, 0, +- 0, 322, 175, 357, 175, 363, 352, 324, 330, 323, +- 332, 326, 201, 324, 329, 322, 391, 333, 181, 309, +- 391, 341, 340, 313, 320, 338, 178, 311, 146, 317, +- +- 314, 315, 335, 331, 303, 300, 309, 299, 308, 188, +- 336, 335, 391, 305, 320, 281, 283, 271, 203, 288, +- 281, 271, 266, 264, 245, 242, 208, 104, 391, 391, +- 244, 218, 204, 219, 206, 224, 201, 212, 204, 229, +- 215, 208, 207, 200, 219, 391, 233, 221, 200, 181, +- 391, 391, 149, 122, 86, 41, 391, 391, 245, 251, +- 259, 263, 267, 273, 280, 284, 292, 300, 304, 310, +- 318, 326 ++ 0, 393, 35, 392, 66, 391, 38, 107, 397, 401, ++ 55, 113, 377, 112, 111, 111, 114, 42, 376, 106, ++ 377, 347, 126, 120, 0, 147, 401, 0, 124, 0, ++ 137, 158, 170, 163, 401, 153, 401, 389, 401, 0, ++ 378, 120, 401, 131, 380, 386, 355, 139, 351, 355, ++ 351, 401, 401, 401, 401, 401, 367, 401, 401, 185, ++ 350, 346, 401, 364, 0, 185, 347, 189, 356, 355, ++ 0, 0, 330, 180, 366, 141, 372, 361, 332, 338, ++ 331, 341, 334, 326, 205, 331, 337, 329, 401, 341, ++ 167, 316, 401, 349, 348, 320, 328, 346, 180, 318, ++ ++ 324, 209, 324, 320, 322, 342, 338, 309, 306, 315, ++ 305, 315, 312, 192, 342, 341, 401, 293, 306, 282, ++ 268, 252, 255, 203, 285, 282, 272, 268, 252, 233, ++ 232, 239, 208, 107, 401, 401, 238, 211, 401, 211, ++ 212, 208, 228, 203, 215, 207, 233, 222, 212, 211, ++ 203, 227, 401, 237, 225, 204, 185, 401, 401, 149, ++ 128, 88, 42, 401, 401, 253, 259, 267, 271, 275, ++ 281, 288, 292, 300, 308, 312, 318, 326, 334 + } ; + +-static yyconst flex_int16_t yy_def[173] = ++static yyconst flex_int16_t yy_def[180] = + { 0, +- 158, 1, 1, 3, 158, 5, 1, 1, 158, 158, +- 158, 158, 158, 159, 160, 161, 158, 158, 158, 158, +- 162, 158, 158, 158, 163, 162, 158, 164, 165, 164, +- 164, 158, 158, 158, 158, 159, 158, 159, 158, 166, +- 158, 161, 158, 161, 167, 168, 158, 158, 158, 158, +- 158, 158, 158, 158, 158, 162, 158, 158, 158, 158, +- 158, 158, 162, 164, 165, 164, 158, 158, 158, 169, +- 166, 170, 161, 167, 167, 168, 158, 158, 158, 158, +- 158, 158, 158, 158, 158, 164, 158, 158, 169, 170, +- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, +- +- 158, 164, 158, 158, 158, 158, 158, 158, 158, 171, +- 158, 164, 158, 158, 158, 158, 158, 158, 171, 158, +- 171, 158, 158, 158, 158, 158, 158, 158, 158, 158, +- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, +- 172, 158, 158, 158, 172, 158, 172, 158, 158, 158, +- 158, 158, 158, 158, 158, 158, 158, 0, 158, 158, +- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, +- 158, 158 ++ 165, 1, 1, 3, 165, 5, 1, 1, 165, 165, ++ 165, 165, 165, 166, 167, 168, 165, 165, 165, 165, ++ 169, 165, 165, 165, 170, 169, 165, 171, 172, 171, ++ 171, 165, 165, 165, 165, 166, 165, 166, 165, 173, ++ 165, 168, 165, 168, 174, 175, 165, 165, 165, 165, ++ 165, 165, 165, 165, 165, 165, 169, 165, 165, 165, ++ 165, 165, 165, 169, 171, 172, 171, 165, 165, 165, ++ 176, 173, 177, 168, 174, 174, 175, 165, 165, 165, ++ 165, 165, 165, 165, 165, 165, 165, 171, 165, 165, ++ 176, 177, 165, 165, 165, 165, 165, 165, 165, 165, ++ ++ 165, 165, 165, 165, 171, 165, 165, 165, 165, 165, ++ 165, 165, 165, 178, 165, 171, 165, 165, 165, 165, ++ 165, 165, 165, 178, 165, 178, 165, 165, 165, 165, ++ 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, ++ 165, 165, 165, 165, 165, 165, 165, 179, 165, 165, ++ 165, 179, 165, 179, 165, 165, 165, 165, 165, 165, ++ 165, 165, 165, 165, 0, 165, 165, 165, 165, 165, ++ 165, 165, 165, 165, 165, 165, 165, 165, 165 + } ; + +-static yyconst flex_int16_t yy_nxt[438] = ++static yyconst flex_int16_t yy_nxt[449] = + { 0, + 10, 11, 12, 11, 13, 14, 10, 15, 16, 10, + 10, 10, 17, 10, 10, 10, 10, 18, 19, 20, + 21, 21, 21, 21, 21, 10, 10, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, +- 21, 21, 21, 10, 22, 10, 24, 25, 25, 25, +- 32, 33, 33, 157, 26, 34, 34, 34, 51, 52, +- 27, 26, 26, 26, 26, 10, 11, 12, 11, 13, +- 14, 28, 15, 16, 28, 28, 28, 24, 28, 28, +- 28, 10, 18, 19, 20, 29, 29, 29, 29, 29, +- 30, 10, 29, 29, 29, 29, 29, 29, 29, 29, +- +- 29, 29, 29, 29, 29, 29, 29, 29, 10, 22, +- 10, 23, 34, 34, 34, 37, 39, 43, 32, 33, +- 33, 45, 54, 55, 46, 59, 45, 64, 156, 46, +- 64, 64, 64, 79, 44, 38, 59, 57, 134, 47, +- 135, 48, 80, 49, 47, 50, 48, 99, 61, 43, +- 50, 110, 41, 67, 67, 67, 60, 63, 63, 63, +- 57, 155, 68, 69, 63, 37, 44, 66, 67, 67, +- 67, 63, 63, 63, 63, 73, 59, 68, 69, 70, +- 34, 34, 34, 43, 75, 38, 154, 92, 83, 83, +- 83, 64, 44, 120, 64, 64, 64, 67, 67, 67, +- +- 44, 57, 99, 68, 69, 107, 68, 69, 120, 127, +- 108, 153, 152, 121, 83, 83, 83, 133, 133, 133, +- 146, 133, 133, 133, 146, 140, 140, 140, 121, 141, +- 140, 140, 140, 151, 141, 158, 150, 149, 148, 144, +- 147, 143, 142, 139, 147, 36, 36, 36, 36, 36, +- 36, 36, 36, 40, 138, 137, 136, 40, 40, 42, +- 42, 42, 42, 42, 42, 42, 42, 56, 56, 56, +- 56, 62, 132, 62, 64, 131, 130, 64, 129, 64, +- 64, 65, 128, 158, 65, 65, 65, 65, 71, 127, +- 71, 71, 74, 74, 74, 74, 74, 74, 74, 74, +- +- 76, 76, 76, 76, 76, 76, 76, 76, 89, 126, +- 89, 90, 125, 90, 90, 124, 90, 90, 119, 119, +- 119, 119, 119, 119, 119, 119, 145, 145, 145, 145, +- 145, 145, 145, 145, 123, 122, 59, 59, 118, 117, +- 116, 115, 114, 113, 45, 112, 108, 111, 109, 106, +- 105, 104, 46, 103, 91, 87, 102, 101, 100, 98, +- 97, 96, 95, 94, 93, 77, 75, 91, 88, 87, +- 86, 57, 85, 84, 57, 82, 81, 78, 77, 75, +- 72, 158, 58, 57, 53, 35, 158, 31, 23, 23, +- 9, 158, 158, 158, 158, 158, 158, 158, 158, 158, +- +- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, +- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, +- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, +- 158, 158, 158, 158, 158, 158, 158 ++ 21, 21, 21, 21, 10, 22, 10, 24, 25, 25, ++ 25, 32, 33, 33, 164, 26, 34, 34, 34, 52, ++ 53, 27, 26, 26, 26, 26, 10, 11, 12, 11, ++ 13, 14, 28, 15, 16, 28, 28, 28, 24, 28, ++ 28, 28, 10, 18, 19, 20, 29, 29, 29, 29, ++ 29, 30, 10, 29, 29, 29, 29, 29, 29, 29, ++ ++ 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, ++ 10, 22, 10, 23, 34, 34, 34, 37, 39, 43, ++ 32, 33, 33, 45, 55, 56, 46, 60, 43, 45, ++ 65, 163, 46, 65, 65, 65, 44, 38, 60, 74, ++ 58, 47, 141, 48, 142, 44, 49, 47, 50, 48, ++ 76, 51, 62, 94, 50, 41, 44, 51, 37, 61, ++ 64, 64, 64, 58, 34, 34, 34, 64, 162, 80, ++ 67, 68, 68, 68, 64, 64, 64, 64, 38, 81, ++ 69, 70, 71, 68, 68, 68, 60, 161, 43, 69, ++ 70, 65, 69, 70, 65, 65, 65, 125, 85, 85, ++ ++ 85, 58, 68, 68, 68, 44, 102, 110, 125, 133, ++ 102, 69, 70, 111, 114, 160, 159, 126, 85, 85, ++ 85, 140, 140, 140, 140, 140, 140, 153, 126, 147, ++ 147, 147, 153, 148, 147, 147, 147, 158, 148, 165, ++ 157, 156, 155, 151, 150, 149, 146, 154, 145, 144, ++ 143, 139, 154, 36, 36, 36, 36, 36, 36, 36, ++ 36, 40, 138, 137, 136, 40, 40, 42, 42, 42, ++ 42, 42, 42, 42, 42, 57, 57, 57, 57, 63, ++ 135, 63, 65, 134, 165, 65, 133, 65, 65, 66, ++ 132, 131, 66, 66, 66, 66, 72, 130, 72, 72, ++ ++ 75, 75, 75, 75, 75, 75, 75, 75, 77, 77, ++ 77, 77, 77, 77, 77, 77, 91, 129, 91, 92, ++ 128, 92, 92, 127, 92, 92, 124, 124, 124, 124, ++ 124, 124, 124, 124, 152, 152, 152, 152, 152, 152, ++ 152, 152, 60, 60, 123, 122, 121, 120, 119, 118, ++ 117, 45, 116, 111, 115, 113, 112, 109, 108, 107, ++ 46, 106, 93, 89, 105, 104, 103, 101, 100, 99, ++ 98, 97, 96, 95, 78, 76, 93, 90, 89, 88, ++ 58, 87, 86, 58, 84, 83, 82, 79, 78, 76, ++ 73, 165, 59, 58, 54, 35, 165, 31, 23, 23, ++ ++ 9, 165, 165, 165, 165, 165, 165, 165, 165, 165, ++ 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, ++ 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, ++ 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, ++ 165, 165, 165, 165, 165, 165, 165, 165 + } ; + +-static yyconst flex_int16_t yy_chk[438] = ++static yyconst flex_int16_t yy_chk[449] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +- 1, 1, 1, 1, 1, 1, 3, 3, 3, 3, +- 7, 7, 7, 156, 3, 11, 11, 11, 18, 18, +- 3, 3, 3, 3, 3, 5, 5, 5, 5, 5, ++ 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, ++ 3, 7, 7, 7, 163, 3, 11, 11, 11, 18, ++ 18, 3, 3, 3, 3, 3, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, +- 5, 8, 12, 12, 12, 14, 15, 16, 8, 8, +- 8, 17, 20, 20, 17, 23, 24, 29, 155, 24, +- 29, 29, 29, 48, 16, 14, 31, 29, 128, 17, +- 128, 17, 48, 17, 24, 17, 24, 99, 24, 42, +- 24, 99, 15, 33, 33, 33, 23, 26, 26, 26, +- 26, 154, 33, 33, 26, 36, 42, 31, 32, 32, +- 32, 26, 26, 26, 26, 44, 59, 32, 32, 32, +- 34, 34, 34, 73, 75, 36, 153, 75, 59, 59, +- 59, 65, 44, 110, 65, 65, 65, 67, 67, 67, +- +- 73, 65, 83, 89, 89, 97, 67, 67, 119, 127, +- 97, 150, 149, 110, 83, 83, 83, 133, 133, 133, +- 141, 127, 127, 127, 145, 136, 136, 136, 119, 136, +- 140, 140, 140, 148, 140, 147, 144, 143, 142, 139, +- 141, 138, 137, 135, 145, 159, 159, 159, 159, 159, +- 159, 159, 159, 160, 134, 132, 131, 160, 160, 161, +- 161, 161, 161, 161, 161, 161, 161, 162, 162, 162, +- 162, 163, 126, 163, 164, 125, 124, 164, 123, 164, +- 164, 165, 122, 121, 165, 165, 165, 165, 166, 120, +- 166, 166, 167, 167, 167, 167, 167, 167, 167, 167, +- +- 168, 168, 168, 168, 168, 168, 168, 168, 169, 118, +- 169, 170, 117, 170, 170, 116, 170, 170, 171, 171, +- 171, 171, 171, 171, 171, 171, 172, 172, 172, 172, +- 172, 172, 172, 172, 115, 114, 112, 111, 109, 108, +- 107, 106, 105, 104, 103, 102, 101, 100, 98, 96, +- 95, 94, 93, 92, 90, 88, 86, 85, 84, 82, +- 81, 80, 79, 78, 77, 76, 74, 72, 69, 68, +- 66, 63, 61, 60, 56, 50, 49, 47, 46, 45, ++ 5, 5, 5, 8, 12, 12, 12, 14, 15, 16, ++ 8, 8, 8, 17, 20, 20, 17, 23, 42, 24, ++ 29, 162, 24, 29, 29, 29, 16, 14, 31, 44, ++ 29, 17, 134, 17, 134, 42, 17, 24, 17, 24, ++ 76, 17, 24, 76, 24, 15, 44, 24, 36, 23, ++ 26, 26, 26, 26, 34, 34, 34, 26, 161, 48, ++ 31, 32, 32, 32, 26, 26, 26, 26, 36, 48, ++ 32, 32, 32, 33, 33, 33, 60, 160, 74, 91, ++ 91, 66, 33, 33, 66, 66, 66, 114, 60, 60, ++ ++ 60, 66, 68, 68, 68, 74, 85, 99, 124, 133, ++ 102, 68, 68, 99, 102, 157, 156, 114, 85, 85, ++ 85, 133, 133, 133, 140, 140, 140, 148, 124, 143, ++ 143, 143, 152, 143, 147, 147, 147, 155, 147, 154, ++ 151, 150, 149, 146, 145, 144, 142, 148, 141, 138, ++ 137, 132, 152, 166, 166, 166, 166, 166, 166, 166, ++ 166, 167, 131, 130, 129, 167, 167, 168, 168, 168, ++ 168, 168, 168, 168, 168, 169, 169, 169, 169, 170, ++ 128, 170, 171, 127, 126, 171, 125, 171, 171, 172, ++ 123, 122, 172, 172, 172, 172, 173, 121, 173, 173, ++ ++ 174, 174, 174, 174, 174, 174, 174, 174, 175, 175, ++ 175, 175, 175, 175, 175, 175, 176, 120, 176, 177, ++ 119, 177, 177, 118, 177, 177, 178, 178, 178, 178, ++ 178, 178, 178, 178, 179, 179, 179, 179, 179, 179, ++ 179, 179, 116, 115, 113, 112, 111, 110, 109, 108, ++ 107, 106, 105, 104, 103, 101, 100, 98, 97, 96, ++ 95, 94, 92, 90, 88, 87, 86, 84, 83, 82, ++ 81, 80, 79, 78, 77, 75, 73, 70, 69, 67, ++ 64, 62, 61, 57, 51, 50, 49, 47, 46, 45, + 41, 38, 22, 21, 19, 13, 9, 6, 4, 2, +- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, + +- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, +- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, +- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, +- 158, 158, 158, 158, 158, 158, 158 ++ 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, ++ 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, ++ 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, ++ 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, ++ 165, 165, 165, 165, 165, 165, 165, 165 + } ; + + static yy_state_type yy_last_accepting_state; +@@ -662,7 +664,7 @@ static int dts_version = 1; + static void push_input_file(const char *filename); + static bool pop_input_file(void); + static void lexical_error(const char *fmt, ...); +-#line 666 "dtc-lexer.lex.c" ++#line 668 "dtc-lexer.lex.c" + + #define INITIAL 0 + #define BYTESTRING 1 +@@ -704,7 +706,7 @@ FILE *yyget_out (void ); + + void yyset_out (FILE * out_str ); + +-yy_size_t yyget_leng (void ); ++int yyget_leng (void ); + + char *yyget_text (void ); + +@@ -853,6 +855,10 @@ YY_DECL + register char *yy_cp, *yy_bp; + register int yy_act; + ++#line 68 "dtc-lexer.l" ++ ++#line 861 "dtc-lexer.lex.c" ++ + if ( !(yy_init) ) + { + (yy_init) = 1; +@@ -879,11 +885,6 @@ YY_DECL + yy_load_buffer_state( ); + } + +- { +-#line 68 "dtc-lexer.l" +- +-#line 886 "dtc-lexer.lex.c" +- + while ( 1 ) /* loops until end-of-file is reached */ + { + yy_cp = (yy_c_buf_p); +@@ -901,7 +902,7 @@ YY_DECL + yy_match: + do + { +- register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ; ++ register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; +@@ -910,13 +911,13 @@ yy_match: + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; +- if ( yy_current_state >= 159 ) ++ if ( yy_current_state >= 166 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + ++yy_cp; + } +- while ( yy_current_state != 158 ); ++ while ( yy_current_state != 165 ); + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + +@@ -951,39 +952,31 @@ case 2: + YY_RULE_SETUP + #line 75 "dtc-lexer.l" + { +- char *line, *fnstart, *fnend; +- struct data fn; ++ char *line, *tmp, *fn; + /* skip text before line # */ + line = yytext; + while (!isdigit((unsigned char)*line)) + line++; +- +- /* regexp ensures that first and list " +- * in the whole yytext are those at +- * beginning and end of the filename string */ +- fnstart = memchr(yytext, '"', yyleng); +- for (fnend = yytext + yyleng - 1; +- *fnend != '"'; fnend--) +- ; +- assert(fnstart && fnend && (fnend > fnstart)); +- +- fn = data_copy_escape_string(fnstart + 1, +- fnend - fnstart - 1); +- +- /* Don't allow nuls in filenames */ +- if (memchr(fn.val, '\0', fn.len - 1)) +- lexical_error("nul in line number directive"); +- ++ /* skip digits in line # */ ++ tmp = line; ++ while (!isspace((unsigned char)*tmp)) ++ tmp++; ++ /* "NULL"-terminate line # */ ++ *tmp = '\0'; ++ /* start of filename */ ++ fn = strchr(tmp + 1, '"') + 1; ++ /* strip trailing " from filename */ ++ tmp = strchr(fn, '"'); ++ *tmp = 0; + /* -1 since #line is the number of the next line */ +- srcpos_set_line(xstrdup(fn.val), atoi(line) - 1); +- data_free(fn); ++ srcpos_set_line(xstrdup(fn), atoi(line) - 1); + } + YY_BREAK + case YY_STATE_EOF(INITIAL): + case YY_STATE_EOF(BYTESTRING): + case YY_STATE_EOF(PROPNODENAME): + case YY_STATE_EOF(V1): +-#line 104 "dtc-lexer.l" ++#line 96 "dtc-lexer.l" + { + if (!pop_input_file()) { + yyterminate(); +@@ -993,7 +986,7 @@ case YY_STATE_EOF(V1): + case 3: + /* rule 3 can match eol */ + YY_RULE_SETUP +-#line 110 "dtc-lexer.l" ++#line 102 "dtc-lexer.l" + { + DPRINT("String: %s\n", yytext); + yylval.data = data_copy_escape_string(yytext+1, +@@ -1003,7 +996,7 @@ YY_RULE_SETUP + YY_BREAK + case 4: + YY_RULE_SETUP +-#line 117 "dtc-lexer.l" ++#line 109 "dtc-lexer.l" + { + DPRINT("Keyword: /dts-v1/\n"); + dts_version = 1; +@@ -1013,25 +1006,33 @@ YY_RULE_SETUP + YY_BREAK + case 5: + YY_RULE_SETUP +-#line 124 "dtc-lexer.l" ++#line 116 "dtc-lexer.l" ++{ ++ DPRINT("Keyword: /plugin/\n"); ++ return DT_PLUGIN; ++ } ++ YY_BREAK ++case 6: ++YY_RULE_SETUP ++#line 121 "dtc-lexer.l" + { + DPRINT("Keyword: /memreserve/\n"); + BEGIN_DEFAULT(); + return DT_MEMRESERVE; + } + YY_BREAK +-case 6: ++case 7: + YY_RULE_SETUP +-#line 130 "dtc-lexer.l" ++#line 127 "dtc-lexer.l" + { + DPRINT("Keyword: /bits/\n"); + BEGIN_DEFAULT(); + return DT_BITS; + } + YY_BREAK +-case 7: ++case 8: + YY_RULE_SETUP +-#line 136 "dtc-lexer.l" ++#line 133 "dtc-lexer.l" + { + DPRINT("Keyword: /delete-property/\n"); + DPRINT("<PROPNODENAME>\n"); +@@ -1039,9 +1040,9 @@ YY_RULE_SETUP + return DT_DEL_PROP; + } + YY_BREAK +-case 8: ++case 9: + YY_RULE_SETUP +-#line 143 "dtc-lexer.l" ++#line 140 "dtc-lexer.l" + { + DPRINT("Keyword: /delete-node/\n"); + DPRINT("<PROPNODENAME>\n"); +@@ -1049,9 +1050,9 @@ YY_RULE_SETUP + return DT_DEL_NODE; + } + YY_BREAK +-case 9: ++case 10: + YY_RULE_SETUP +-#line 150 "dtc-lexer.l" ++#line 147 "dtc-lexer.l" + { + DPRINT("Label: %s\n", yytext); + yylval.labelref = xstrdup(yytext); +@@ -1059,9 +1060,9 @@ YY_RULE_SETUP + return DT_LABEL; + } + YY_BREAK +-case 10: ++case 11: + YY_RULE_SETUP +-#line 157 "dtc-lexer.l" ++#line 154 "dtc-lexer.l" + { + char *e; + DPRINT("Integer Literal: '%s'\n", yytext); +@@ -1069,10 +1070,7 @@ YY_RULE_SETUP + errno = 0; + yylval.integer = strtoull(yytext, &e, 0); + +- if (*e && e[strspn(e, "UL")]) { +- lexical_error("Bad integer literal '%s'", +- yytext); +- } ++ assert(!(*e) || !e[strspn(e, "UL")]); + + if (errno == ERANGE) + lexical_error("Integer literal '%s' out of range", +@@ -1084,10 +1082,10 @@ YY_RULE_SETUP + return DT_LITERAL; + } + YY_BREAK +-case 11: +-/* rule 11 can match eol */ ++case 12: ++/* rule 12 can match eol */ + YY_RULE_SETUP +-#line 179 "dtc-lexer.l" ++#line 173 "dtc-lexer.l" + { + struct data d; + DPRINT("Character literal: %s\n", yytext); +@@ -1109,18 +1107,18 @@ YY_RULE_SETUP + return DT_CHAR_LITERAL; + } + YY_BREAK +-case 12: ++case 13: + YY_RULE_SETUP +-#line 200 "dtc-lexer.l" ++#line 194 "dtc-lexer.l" + { /* label reference */ + DPRINT("Ref: %s\n", yytext+1); + yylval.labelref = xstrdup(yytext+1); + return DT_REF; + } + YY_BREAK +-case 13: ++case 14: + YY_RULE_SETUP +-#line 206 "dtc-lexer.l" ++#line 200 "dtc-lexer.l" + { /* new-style path reference */ + yytext[yyleng-1] = '\0'; + DPRINT("Ref: %s\n", yytext+2); +@@ -1128,27 +1126,27 @@ YY_RULE_SETUP + return DT_REF; + } + YY_BREAK +-case 14: ++case 15: + YY_RULE_SETUP +-#line 213 "dtc-lexer.l" ++#line 207 "dtc-lexer.l" + { + yylval.byte = strtol(yytext, NULL, 16); + DPRINT("Byte: %02x\n", (int)yylval.byte); + return DT_BYTE; + } + YY_BREAK +-case 15: ++case 16: + YY_RULE_SETUP +-#line 219 "dtc-lexer.l" ++#line 213 "dtc-lexer.l" + { + DPRINT("/BYTESTRING\n"); + BEGIN_DEFAULT(); + return ']'; + } + YY_BREAK +-case 16: ++case 17: + YY_RULE_SETUP +-#line 225 "dtc-lexer.l" ++#line 219 "dtc-lexer.l" + { + DPRINT("PropNodeName: %s\n", yytext); + yylval.propnodename = xstrdup((yytext[0] == '\\') ? +@@ -1157,75 +1155,75 @@ YY_RULE_SETUP + return DT_PROPNODENAME; + } + YY_BREAK +-case 17: ++case 18: + YY_RULE_SETUP +-#line 233 "dtc-lexer.l" ++#line 227 "dtc-lexer.l" + { + DPRINT("Binary Include\n"); + return DT_INCBIN; + } + YY_BREAK +-case 18: +-/* rule 18 can match eol */ +-YY_RULE_SETUP +-#line 238 "dtc-lexer.l" +-/* eat whitespace */ +- YY_BREAK + case 19: + /* rule 19 can match eol */ + YY_RULE_SETUP +-#line 239 "dtc-lexer.l" +-/* eat C-style comments */ ++#line 232 "dtc-lexer.l" ++/* eat whitespace */ + YY_BREAK + case 20: + /* rule 20 can match eol */ + YY_RULE_SETUP +-#line 240 "dtc-lexer.l" +-/* eat C++-style comments */ ++#line 233 "dtc-lexer.l" ++/* eat C-style comments */ + YY_BREAK + case 21: ++/* rule 21 can match eol */ + YY_RULE_SETUP +-#line 242 "dtc-lexer.l" +-{ return DT_LSHIFT; }; ++#line 234 "dtc-lexer.l" ++/* eat C++-style comments */ + YY_BREAK + case 22: + YY_RULE_SETUP +-#line 243 "dtc-lexer.l" +-{ return DT_RSHIFT; }; ++#line 236 "dtc-lexer.l" ++{ return DT_LSHIFT; }; + YY_BREAK + case 23: + YY_RULE_SETUP +-#line 244 "dtc-lexer.l" +-{ return DT_LE; }; ++#line 237 "dtc-lexer.l" ++{ return DT_RSHIFT; }; + YY_BREAK + case 24: + YY_RULE_SETUP +-#line 245 "dtc-lexer.l" +-{ return DT_GE; }; ++#line 238 "dtc-lexer.l" ++{ return DT_LE; }; + YY_BREAK + case 25: + YY_RULE_SETUP +-#line 246 "dtc-lexer.l" +-{ return DT_EQ; }; ++#line 239 "dtc-lexer.l" ++{ return DT_GE; }; + YY_BREAK + case 26: + YY_RULE_SETUP +-#line 247 "dtc-lexer.l" +-{ return DT_NE; }; ++#line 240 "dtc-lexer.l" ++{ return DT_EQ; }; + YY_BREAK + case 27: + YY_RULE_SETUP +-#line 248 "dtc-lexer.l" +-{ return DT_AND; }; ++#line 241 "dtc-lexer.l" ++{ return DT_NE; }; + YY_BREAK + case 28: + YY_RULE_SETUP +-#line 249 "dtc-lexer.l" +-{ return DT_OR; }; ++#line 242 "dtc-lexer.l" ++{ return DT_AND; }; + YY_BREAK + case 29: + YY_RULE_SETUP +-#line 251 "dtc-lexer.l" ++#line 243 "dtc-lexer.l" ++{ return DT_OR; }; ++ YY_BREAK ++case 30: ++YY_RULE_SETUP ++#line 245 "dtc-lexer.l" + { + DPRINT("Char: %c (\\x%02x)\n", yytext[0], + (unsigned)yytext[0]); +@@ -1241,12 +1239,12 @@ YY_RULE_SETUP + return yytext[0]; + } + YY_BREAK +-case 30: ++case 31: + YY_RULE_SETUP +-#line 266 "dtc-lexer.l" ++#line 260 "dtc-lexer.l" + ECHO; + YY_BREAK +-#line 1250 "dtc-lexer.lex.c" ++#line 1248 "dtc-lexer.lex.c" + + case YY_END_OF_BUFFER: + { +@@ -1376,7 +1374,6 @@ ECHO; + "fatal flex scanner internal error--no action found" ); + } /* end of action switch */ + } /* end of scanning one token */ +- } /* end of user's declarations */ + } /* end of yylex */ + + /* yy_get_next_buffer - try to read in a new buffer +@@ -1432,21 +1429,21 @@ static int yy_get_next_buffer (void) + + else + { +- yy_size_t num_to_read = ++ int num_to_read = + YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; + + while ( num_to_read <= 0 ) + { /* Not enough room in the buffer - grow it. */ + + /* just a shorter name for the current buffer */ +- YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE; ++ YY_BUFFER_STATE b = YY_CURRENT_BUFFER; + + int yy_c_buf_p_offset = + (int) ((yy_c_buf_p) - b->yy_ch_buf); + + if ( b->yy_is_our_buffer ) + { +- yy_size_t new_size = b->yy_buf_size * 2; ++ int new_size = b->yy_buf_size * 2; + + if ( new_size <= 0 ) + b->yy_buf_size += b->yy_buf_size / 8; +@@ -1477,7 +1474,7 @@ static int yy_get_next_buffer (void) + + /* Read in more data. */ + YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), +- (yy_n_chars), num_to_read ); ++ (yy_n_chars), (size_t) num_to_read ); + + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } +@@ -1539,7 +1536,7 @@ static int yy_get_next_buffer (void) + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; +- if ( yy_current_state >= 159 ) ++ if ( yy_current_state >= 166 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; +@@ -1567,13 +1564,13 @@ static int yy_get_next_buffer (void) + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; +- if ( yy_current_state >= 159 ) ++ if ( yy_current_state >= 166 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; +- yy_is_jam = (yy_current_state == 158); ++ yy_is_jam = (yy_current_state == 165); + +- return yy_is_jam ? 0 : yy_current_state; ++ return yy_is_jam ? 0 : yy_current_state; + } + + #ifndef YY_NO_INPUT +@@ -1600,7 +1597,7 @@ static int yy_get_next_buffer (void) + + else + { /* need more input */ +- yy_size_t offset = (yy_c_buf_p) - (yytext_ptr); ++ int offset = (yy_c_buf_p) - (yytext_ptr); + ++(yy_c_buf_p); + + switch ( yy_get_next_buffer( ) ) +@@ -1874,7 +1871,7 @@ void yypop_buffer_state (void) + */ + static void yyensure_buffer_stack (void) + { +- yy_size_t num_to_alloc; ++ int num_to_alloc; + + if (!(yy_buffer_stack)) { + +@@ -1971,12 +1968,12 @@ YY_BUFFER_STATE yy_scan_string (yyconst char * yystr ) + * + * @return the newly allocated buffer state object. + */ +-YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len ) ++YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, int _yybytes_len ) + { + YY_BUFFER_STATE b; + char *buf; + yy_size_t n; +- yy_size_t i; ++ int i; + + /* Get memory for full buffer, including space for trailing EOB's. */ + n = _yybytes_len + 2; +@@ -2058,7 +2055,7 @@ FILE *yyget_out (void) + /** Get the length of the current token. + * + */ +-yy_size_t yyget_leng (void) ++int yyget_leng (void) + { + return yyleng; + } +@@ -2206,7 +2203,7 @@ void yyfree (void * ptr ) + + #define YYTABLES_NAME "yytables" + +-#line 265 "dtc-lexer.l" ++#line 260 "dtc-lexer.l" + + + +diff --git a/scripts/dtc/dtc-parser.tab.c_shipped b/scripts/dtc/dtc-parser.tab.c_shipped +index 31cec50..844c462 100644 +--- a/scripts/dtc/dtc-parser.tab.c_shipped ++++ b/scripts/dtc/dtc-parser.tab.c_shipped +@@ -65,6 +65,7 @@ + #line 20 "dtc-parser.y" /* yacc.c:339 */ + + #include <stdio.h> ++#include <inttypes.h> + + #include "dtc.h" + #include "srcpos.h" +@@ -80,7 +81,7 @@ extern void yyerror(char const *s); + extern struct boot_info *the_boot_info; + extern bool treesource_error; + +-#line 84 "dtc-parser.tab.c" /* yacc.c:339 */ ++#line 85 "dtc-parser.tab.c" /* yacc.c:339 */ + + # ifndef YY_NULLPTR + # if defined __cplusplus && 201103L <= __cplusplus +@@ -116,26 +117,27 @@ extern int yydebug; + enum yytokentype + { + DT_V1 = 258, +- DT_MEMRESERVE = 259, +- DT_LSHIFT = 260, +- DT_RSHIFT = 261, +- DT_LE = 262, +- DT_GE = 263, +- DT_EQ = 264, +- DT_NE = 265, +- DT_AND = 266, +- DT_OR = 267, +- DT_BITS = 268, +- DT_DEL_PROP = 269, +- DT_DEL_NODE = 270, +- DT_PROPNODENAME = 271, +- DT_LITERAL = 272, +- DT_CHAR_LITERAL = 273, +- DT_BYTE = 274, +- DT_STRING = 275, +- DT_LABEL = 276, +- DT_REF = 277, +- DT_INCBIN = 278 ++ DT_PLUGIN = 259, ++ DT_MEMRESERVE = 260, ++ DT_LSHIFT = 261, ++ DT_RSHIFT = 262, ++ DT_LE = 263, ++ DT_GE = 264, ++ DT_EQ = 265, ++ DT_NE = 266, ++ DT_AND = 267, ++ DT_OR = 268, ++ DT_BITS = 269, ++ DT_DEL_PROP = 270, ++ DT_DEL_NODE = 271, ++ DT_PROPNODENAME = 272, ++ DT_LITERAL = 273, ++ DT_CHAR_LITERAL = 274, ++ DT_BYTE = 275, ++ DT_STRING = 276, ++ DT_LABEL = 277, ++ DT_REF = 278, ++ DT_INCBIN = 279 + }; + #endif + +@@ -144,7 +146,7 @@ extern int yydebug; + typedef union YYSTYPE YYSTYPE; + union YYSTYPE + { +-#line 38 "dtc-parser.y" /* yacc.c:355 */ ++#line 39 "dtc-parser.y" /* yacc.c:355 */ + + char *propnodename; + char *labelref; +@@ -162,8 +164,9 @@ union YYSTYPE + struct node *nodelist; + struct reserve_info *re; + uint64_t integer; ++ bool is_plugin; + +-#line 167 "dtc-parser.tab.c" /* yacc.c:355 */ ++#line 170 "dtc-parser.tab.c" /* yacc.c:355 */ + }; + # define YYSTYPE_IS_TRIVIAL 1 + # define YYSTYPE_IS_DECLARED 1 +@@ -192,7 +195,7 @@ int yyparse (void); + + /* Copy the second part of user declarations. */ + +-#line 196 "dtc-parser.tab.c" /* yacc.c:358 */ ++#line 199 "dtc-parser.tab.c" /* yacc.c:358 */ + + #ifdef short + # undef short +@@ -439,18 +442,18 @@ union yyalloc + #define YYLAST 136 + + /* YYNTOKENS -- Number of terminals. */ +-#define YYNTOKENS 47 ++#define YYNTOKENS 48 + /* YYNNTS -- Number of nonterminals. */ +-#define YYNNTS 28 ++#define YYNNTS 29 + /* YYNRULES -- Number of rules. */ +-#define YYNRULES 80 ++#define YYNRULES 82 + /* YYNSTATES -- Number of states. */ +-#define YYNSTATES 144 ++#define YYNSTATES 147 + + /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned + by yylex, with out-of-bounds checking. */ + #define YYUNDEFTOK 2 +-#define YYMAXUTOK 278 ++#define YYMAXUTOK 279 + + #define YYTRANSLATE(YYX) \ + ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) +@@ -462,16 +465,16 @@ static const yytype_uint8 yytranslate[] = + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +- 2, 2, 2, 46, 2, 2, 2, 44, 40, 2, +- 32, 34, 43, 41, 33, 42, 2, 25, 2, 2, +- 2, 2, 2, 2, 2, 2, 2, 2, 37, 24, +- 35, 28, 29, 36, 2, 2, 2, 2, 2, 2, ++ 2, 2, 2, 47, 2, 2, 2, 45, 41, 2, ++ 33, 35, 44, 42, 34, 43, 2, 26, 2, 2, ++ 2, 2, 2, 2, 2, 2, 2, 2, 38, 25, ++ 36, 29, 30, 37, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +- 2, 30, 2, 31, 39, 2, 2, 2, 2, 2, ++ 2, 31, 2, 32, 40, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +- 2, 2, 2, 26, 38, 27, 45, 2, 2, 2, ++ 2, 2, 2, 27, 39, 28, 46, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +@@ -486,22 +489,22 @@ static const yytype_uint8 yytranslate[] = + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, + 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, +- 15, 16, 17, 18, 19, 20, 21, 22, 23 ++ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24 + }; + + #if YYDEBUG + /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ + static const yytype_uint16 yyrline[] = + { +- 0, 104, 104, 113, 116, 123, 127, 135, 139, 144, +- 155, 165, 180, 188, 191, 198, 202, 206, 210, 218, +- 222, 226, 230, 234, 250, 260, 268, 271, 275, 282, +- 298, 303, 322, 336, 343, 344, 345, 352, 356, 357, +- 361, 362, 366, 367, 371, 372, 376, 377, 381, 382, +- 386, 387, 388, 392, 393, 394, 395, 396, 400, 401, +- 402, 406, 407, 408, 412, 413, 422, 431, 435, 436, +- 437, 438, 443, 446, 450, 458, 461, 465, 473, 477, +- 481 ++ 0, 108, 108, 118, 121, 129, 132, 139, 143, 151, ++ 155, 160, 171, 181, 196, 204, 207, 214, 218, 222, ++ 226, 234, 238, 242, 246, 250, 266, 276, 284, 287, ++ 291, 298, 314, 319, 338, 352, 359, 360, 361, 368, ++ 372, 373, 377, 378, 382, 383, 387, 388, 392, 393, ++ 397, 398, 402, 403, 404, 408, 409, 410, 411, 412, ++ 416, 417, 418, 422, 423, 424, 428, 429, 430, 431, ++ 435, 436, 437, 438, 443, 446, 450, 458, 461, 465, ++ 473, 477, 481 + }; + #endif + +@@ -510,19 +513,19 @@ static const yytype_uint16 yyrline[] = + First, the terminals, then, starting at YYNTOKENS, nonterminals. */ + static const char *const yytname[] = + { +- "$end", "error", "$undefined", "DT_V1", "DT_MEMRESERVE", "DT_LSHIFT", +- "DT_RSHIFT", "DT_LE", "DT_GE", "DT_EQ", "DT_NE", "DT_AND", "DT_OR", +- "DT_BITS", "DT_DEL_PROP", "DT_DEL_NODE", "DT_PROPNODENAME", "DT_LITERAL", +- "DT_CHAR_LITERAL", "DT_BYTE", "DT_STRING", "DT_LABEL", "DT_REF", +- "DT_INCBIN", "';'", "'/'", "'{'", "'}'", "'='", "'>'", "'['", "']'", +- "'('", "','", "')'", "'<'", "'?'", "':'", "'|'", "'^'", "'&'", "'+'", +- "'-'", "'*'", "'%'", "'~'", "'!'", "$accept", "sourcefile", +- "memreserves", "memreserve", "devicetree", "nodedef", "proplist", +- "propdef", "propdata", "propdataprefix", "arrayprefix", "integer_prim", +- "integer_expr", "integer_trinary", "integer_or", "integer_and", +- "integer_bitor", "integer_bitxor", "integer_bitand", "integer_eq", +- "integer_rela", "integer_shift", "integer_add", "integer_mul", +- "integer_unary", "bytestring", "subnodes", "subnode", YY_NULLPTR ++ "$end", "error", "$undefined", "DT_V1", "DT_PLUGIN", "DT_MEMRESERVE", ++ "DT_LSHIFT", "DT_RSHIFT", "DT_LE", "DT_GE", "DT_EQ", "DT_NE", "DT_AND", ++ "DT_OR", "DT_BITS", "DT_DEL_PROP", "DT_DEL_NODE", "DT_PROPNODENAME", ++ "DT_LITERAL", "DT_CHAR_LITERAL", "DT_BYTE", "DT_STRING", "DT_LABEL", ++ "DT_REF", "DT_INCBIN", "';'", "'/'", "'{'", "'}'", "'='", "'>'", "'['", ++ "']'", "'('", "','", "')'", "'<'", "'?'", "':'", "'|'", "'^'", "'&'", ++ "'+'", "'-'", "'*'", "'%'", "'~'", "'!'", "$accept", "sourcefile", ++ "plugindecl", "memreserves", "memreserve", "devicetree", "nodedef", ++ "proplist", "propdef", "propdata", "propdataprefix", "arrayprefix", ++ "integer_prim", "integer_expr", "integer_trinary", "integer_or", ++ "integer_and", "integer_bitor", "integer_bitxor", "integer_bitand", ++ "integer_eq", "integer_rela", "integer_shift", "integer_add", ++ "integer_mul", "integer_unary", "bytestring", "subnodes", "subnode", YY_NULLPTR + }; + #endif + +@@ -533,16 +536,16 @@ static const yytype_uint16 yytoknum[] = + { + 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, + 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, +- 275, 276, 277, 278, 59, 47, 123, 125, 61, 62, +- 91, 93, 40, 44, 41, 60, 63, 58, 124, 94, +- 38, 43, 45, 42, 37, 126, 33 ++ 275, 276, 277, 278, 279, 59, 47, 123, 125, 61, ++ 62, 91, 93, 40, 44, 41, 60, 63, 58, 124, ++ 94, 38, 43, 45, 42, 37, 126, 33 + }; + # endif + +-#define YYPACT_NINF -81 ++#define YYPACT_NINF -84 + + #define yypact_value_is_default(Yystate) \ +- (!!((Yystate) == (-81))) ++ (!!((Yystate) == (-84))) + + #define YYTABLE_NINF -1 + +@@ -553,21 +556,21 @@ static const yytype_uint16 yytoknum[] = + STATE-NUM. */ + static const yytype_int8 yypact[] = + { +- 16, -11, 21, 10, -81, 25, 10, 19, 10, -81, +- -81, -9, 25, -81, 2, 51, -81, -9, -9, -9, +- -81, 1, -81, -6, 50, 14, 28, 29, 36, 3, +- 58, 44, -3, -81, 47, -81, -81, 65, 68, 2, +- 2, -81, -81, -81, -81, -9, -9, -9, -9, -9, +- -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, +- -9, -9, -9, -9, -81, 63, 69, 2, -81, -81, +- 50, 57, 14, 28, 29, 36, 3, 3, 58, 58, +- 58, 58, 44, 44, -3, -3, -81, -81, -81, 79, +- 80, -8, 63, -81, 72, 63, -81, -81, -9, 76, +- 77, -81, -81, -81, -81, -81, 78, -81, -81, -81, +- -81, -81, 35, 4, -81, -81, -81, -81, 86, -81, +- -81, -81, 73, -81, -81, 33, 71, 84, 39, -81, +- -81, -81, -81, -81, 41, -81, -81, -81, 25, -81, +- 74, 25, 75, -81 ++ 15, -12, 35, 42, -84, 27, 9, -84, 24, 9, ++ 43, 9, -84, -84, -10, 24, -84, 60, 44, -84, ++ -10, -10, -10, -84, 55, -84, -7, 52, 53, 51, ++ 54, 10, 2, 38, 37, -4, -84, 68, -84, -84, ++ 71, 73, 60, 60, -84, -84, -84, -84, -10, -10, ++ -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, ++ -10, -10, -10, -10, -10, -10, -10, -84, 56, 72, ++ 60, -84, -84, 52, 61, 53, 51, 54, 10, 2, ++ 2, 38, 38, 38, 38, 37, 37, -4, -4, -84, ++ -84, -84, 81, 83, 34, 56, -84, 74, 56, -84, ++ -84, -10, 76, 78, -84, -84, -84, -84, -84, 79, ++ -84, -84, -84, -84, -84, -6, 3, -84, -84, -84, ++ -84, 87, -84, -84, -84, 75, -84, -84, 32, 70, ++ 86, 36, -84, -84, -84, -84, -84, 47, -84, -84, ++ -84, 24, -84, 77, 24, 80, -84 + }; + + /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. +@@ -575,37 +578,37 @@ static const yytype_int8 yypact[] = + means the default is an error. */ + static const yytype_uint8 yydefact[] = + { +- 0, 0, 0, 3, 1, 0, 0, 0, 3, 34, +- 35, 0, 0, 6, 0, 2, 4, 0, 0, 0, +- 68, 0, 37, 38, 40, 42, 44, 46, 48, 50, +- 53, 60, 63, 67, 0, 13, 7, 0, 0, 0, +- 0, 69, 70, 71, 36, 0, 0, 0, 0, 0, ++ 0, 0, 0, 3, 1, 0, 5, 4, 0, 0, ++ 0, 5, 36, 37, 0, 0, 8, 0, 2, 6, ++ 0, 0, 0, 70, 0, 39, 40, 42, 44, 46, ++ 48, 50, 52, 55, 62, 65, 69, 0, 15, 9, ++ 0, 0, 0, 0, 71, 72, 73, 38, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +- 0, 0, 0, 0, 5, 75, 0, 0, 10, 8, +- 41, 0, 43, 45, 47, 49, 51, 52, 56, 57, +- 55, 54, 58, 59, 61, 62, 65, 64, 66, 0, +- 0, 0, 0, 14, 0, 75, 11, 9, 0, 0, +- 0, 16, 26, 78, 18, 80, 0, 77, 76, 39, +- 17, 79, 0, 0, 12, 25, 15, 27, 0, 19, +- 28, 22, 0, 72, 30, 0, 0, 0, 0, 33, +- 32, 20, 31, 29, 0, 73, 74, 21, 0, 24, +- 0, 0, 0, 23 ++ 0, 0, 0, 0, 0, 0, 0, 7, 77, 0, ++ 0, 12, 10, 43, 0, 45, 47, 49, 51, 53, ++ 54, 58, 59, 57, 56, 60, 61, 63, 64, 67, ++ 66, 68, 0, 0, 0, 0, 16, 0, 77, 13, ++ 11, 0, 0, 0, 18, 28, 80, 20, 82, 0, ++ 79, 78, 41, 19, 81, 0, 0, 14, 27, 17, ++ 29, 0, 21, 30, 24, 0, 74, 32, 0, 0, ++ 0, 0, 35, 34, 22, 33, 31, 0, 75, 76, ++ 23, 0, 26, 0, 0, 0, 25 + }; + + /* YYPGOTO[NTERM-NUM]. */ + static const yytype_int8 yypgoto[] = + { +- -81, -81, 100, 104, -81, -38, -81, -80, -81, -81, +- -81, -5, 66, 13, -81, 70, 67, 81, 64, 82, +- 37, 27, 34, 38, -14, -81, 22, 24 ++ -84, -84, -84, 98, 101, -84, -41, -84, -83, -84, ++ -84, -84, -8, 63, 12, -84, 66, 67, 65, 69, ++ 82, 29, 18, 25, 26, -17, -84, 20, 28 + }; + + /* YYDEFGOTO[NTERM-NUM]. */ + static const yytype_int16 yydefgoto[] = + { +- -1, 2, 7, 8, 15, 36, 65, 93, 112, 113, +- 125, 20, 21, 22, 23, 24, 25, 26, 27, 28, +- 29, 30, 31, 32, 33, 128, 94, 95 ++ -1, 2, 6, 10, 11, 18, 39, 68, 96, 115, ++ 116, 128, 23, 24, 25, 26, 27, 28, 29, 30, ++ 31, 32, 33, 34, 35, 36, 131, 97, 98 + }; + + /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If +@@ -613,87 +616,87 @@ static const yytype_int16 yydefgoto[] = + number is the opposite. If YYTABLE_NINF, syntax error. */ + static const yytype_uint8 yytable[] = + { +- 12, 68, 69, 41, 42, 43, 45, 34, 9, 10, +- 53, 54, 104, 3, 5, 107, 101, 118, 35, 1, +- 102, 4, 61, 11, 119, 120, 121, 122, 35, 97, +- 46, 6, 55, 17, 123, 44, 18, 19, 56, 124, +- 62, 63, 9, 10, 14, 51, 52, 86, 87, 88, +- 9, 10, 48, 103, 129, 130, 115, 11, 135, 116, +- 136, 47, 131, 57, 58, 11, 37, 49, 117, 50, +- 137, 64, 38, 39, 138, 139, 40, 89, 90, 91, +- 78, 79, 80, 81, 92, 59, 60, 66, 76, 77, +- 67, 82, 83, 96, 98, 99, 100, 84, 85, 106, +- 110, 111, 114, 126, 134, 127, 133, 141, 16, 143, +- 13, 109, 71, 74, 72, 70, 105, 108, 0, 0, +- 132, 0, 0, 0, 0, 0, 0, 0, 0, 73, +- 0, 0, 75, 140, 0, 0, 142 ++ 15, 71, 72, 44, 45, 46, 48, 37, 12, 13, ++ 56, 57, 107, 3, 8, 110, 118, 121, 1, 119, ++ 54, 55, 64, 14, 122, 123, 124, 125, 120, 100, ++ 49, 9, 58, 20, 126, 4, 21, 22, 59, 127, ++ 65, 66, 12, 13, 60, 61, 5, 89, 90, 91, ++ 12, 13, 7, 106, 132, 133, 138, 14, 139, 104, ++ 40, 38, 134, 105, 50, 14, 41, 42, 140, 17, ++ 43, 92, 93, 94, 81, 82, 83, 84, 95, 62, ++ 63, 141, 142, 79, 80, 85, 86, 38, 87, 88, ++ 47, 52, 51, 67, 69, 53, 70, 99, 102, 101, ++ 103, 113, 109, 114, 117, 129, 136, 137, 130, 19, ++ 16, 144, 74, 112, 73, 146, 76, 75, 111, 0, ++ 135, 77, 0, 108, 0, 0, 0, 0, 0, 0, ++ 0, 0, 0, 143, 0, 78, 145 + }; + + static const yytype_int16 yycheck[] = + { +- 5, 39, 40, 17, 18, 19, 12, 12, 17, 18, +- 7, 8, 92, 24, 4, 95, 24, 13, 26, 3, +- 28, 0, 25, 32, 20, 21, 22, 23, 26, 67, +- 36, 21, 29, 42, 30, 34, 45, 46, 35, 35, +- 43, 44, 17, 18, 25, 9, 10, 61, 62, 63, +- 17, 18, 38, 91, 21, 22, 21, 32, 19, 24, +- 21, 11, 29, 5, 6, 32, 15, 39, 33, 40, +- 31, 24, 21, 22, 33, 34, 25, 14, 15, 16, +- 53, 54, 55, 56, 21, 41, 42, 22, 51, 52, +- 22, 57, 58, 24, 37, 16, 16, 59, 60, 27, +- 24, 24, 24, 17, 20, 32, 35, 33, 8, 34, +- 6, 98, 46, 49, 47, 45, 92, 95, -1, -1, +- 125, -1, -1, -1, -1, -1, -1, -1, -1, 48, +- -1, -1, 50, 138, -1, -1, 141 ++ 8, 42, 43, 20, 21, 22, 13, 15, 18, 19, ++ 8, 9, 95, 25, 5, 98, 22, 14, 3, 25, ++ 10, 11, 26, 33, 21, 22, 23, 24, 34, 70, ++ 37, 22, 30, 43, 31, 0, 46, 47, 36, 36, ++ 44, 45, 18, 19, 6, 7, 4, 64, 65, 66, ++ 18, 19, 25, 94, 22, 23, 20, 33, 22, 25, ++ 16, 27, 30, 29, 12, 33, 22, 23, 32, 26, ++ 26, 15, 16, 17, 56, 57, 58, 59, 22, 42, ++ 43, 34, 35, 54, 55, 60, 61, 27, 62, 63, ++ 35, 40, 39, 25, 23, 41, 23, 25, 17, 38, ++ 17, 25, 28, 25, 25, 18, 36, 21, 33, 11, ++ 9, 34, 49, 101, 48, 35, 51, 50, 98, -1, ++ 128, 52, -1, 95, -1, -1, -1, -1, -1, -1, ++ -1, -1, -1, 141, -1, 53, 144 + }; + + /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ + static const yytype_uint8 yystos[] = + { +- 0, 3, 48, 24, 0, 4, 21, 49, 50, 17, +- 18, 32, 58, 50, 25, 51, 49, 42, 45, 46, +- 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, +- 68, 69, 70, 71, 58, 26, 52, 15, 21, 22, +- 25, 71, 71, 71, 34, 12, 36, 11, 38, 39, +- 40, 9, 10, 7, 8, 29, 35, 5, 6, 41, +- 42, 25, 43, 44, 24, 53, 22, 22, 52, 52, +- 62, 59, 63, 64, 65, 66, 67, 67, 68, 68, +- 68, 68, 69, 69, 70, 70, 71, 71, 71, 14, +- 15, 16, 21, 54, 73, 74, 24, 52, 37, 16, +- 16, 24, 28, 52, 54, 74, 27, 54, 73, 60, +- 24, 24, 55, 56, 24, 21, 24, 33, 13, 20, +- 21, 22, 23, 30, 35, 57, 17, 32, 72, 21, +- 22, 29, 58, 35, 20, 19, 21, 31, 33, 34, +- 58, 33, 58, 34 ++ 0, 3, 49, 25, 0, 4, 50, 25, 5, 22, ++ 51, 52, 18, 19, 33, 60, 52, 26, 53, 51, ++ 43, 46, 47, 60, 61, 62, 63, 64, 65, 66, ++ 67, 68, 69, 70, 71, 72, 73, 60, 27, 54, ++ 16, 22, 23, 26, 73, 73, 73, 35, 13, 37, ++ 12, 39, 40, 41, 10, 11, 8, 9, 30, 36, ++ 6, 7, 42, 43, 26, 44, 45, 25, 55, 23, ++ 23, 54, 54, 64, 61, 65, 66, 67, 68, 69, ++ 69, 70, 70, 70, 70, 71, 71, 72, 72, 73, ++ 73, 73, 15, 16, 17, 22, 56, 75, 76, 25, ++ 54, 38, 17, 17, 25, 29, 54, 56, 76, 28, ++ 56, 75, 62, 25, 25, 57, 58, 25, 22, 25, ++ 34, 14, 21, 22, 23, 24, 31, 36, 59, 18, ++ 33, 74, 22, 23, 30, 60, 36, 21, 20, 22, ++ 32, 34, 35, 60, 34, 60, 35 + }; + + /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ + static const yytype_uint8 yyr1[] = + { +- 0, 47, 48, 49, 49, 50, 50, 51, 51, 51, +- 51, 51, 52, 53, 53, 54, 54, 54, 54, 55, +- 55, 55, 55, 55, 55, 55, 56, 56, 56, 57, +- 57, 57, 57, 57, 58, 58, 58, 59, 60, 60, +- 61, 61, 62, 62, 63, 63, 64, 64, 65, 65, +- 66, 66, 66, 67, 67, 67, 67, 67, 68, 68, +- 68, 69, 69, 69, 70, 70, 70, 70, 71, 71, +- 71, 71, 72, 72, 72, 73, 73, 73, 74, 74, +- 74 ++ 0, 48, 49, 50, 50, 51, 51, 52, 52, 53, ++ 53, 53, 53, 53, 54, 55, 55, 56, 56, 56, ++ 56, 57, 57, 57, 57, 57, 57, 57, 58, 58, ++ 58, 59, 59, 59, 59, 59, 60, 60, 60, 61, ++ 62, 62, 63, 63, 64, 64, 65, 65, 66, 66, ++ 67, 67, 68, 68, 68, 69, 69, 69, 69, 69, ++ 70, 70, 70, 71, 71, 71, 72, 72, 72, 72, ++ 73, 73, 73, 73, 74, 74, 74, 75, 75, 75, ++ 76, 76, 76 + }; + + /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ + static const yytype_uint8 yyr2[] = + { +- 0, 2, 4, 0, 2, 4, 2, 2, 3, 4, +- 3, 4, 5, 0, 2, 4, 2, 3, 2, 2, +- 3, 4, 2, 9, 5, 2, 0, 2, 2, 3, +- 1, 2, 2, 2, 1, 1, 3, 1, 1, 5, +- 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, +- 1, 3, 3, 1, 3, 3, 3, 3, 3, 3, +- 1, 3, 3, 1, 3, 3, 3, 1, 1, 2, +- 2, 2, 0, 2, 2, 0, 2, 2, 2, 3, +- 2 ++ 0, 2, 5, 0, 2, 0, 2, 4, 2, 2, ++ 3, 4, 3, 4, 5, 0, 2, 4, 2, 3, ++ 2, 2, 3, 4, 2, 9, 5, 2, 0, 2, ++ 2, 3, 1, 2, 2, 2, 1, 1, 3, 1, ++ 1, 5, 1, 3, 1, 3, 1, 3, 1, 3, ++ 1, 3, 1, 3, 3, 1, 3, 3, 3, 3, ++ 3, 3, 1, 3, 3, 1, 3, 3, 3, 1, ++ 1, 2, 2, 2, 0, 2, 2, 0, 2, 2, ++ 2, 3, 2 + }; + + +@@ -1463,65 +1466,82 @@ yyreduce: + switch (yyn) + { + case 2: +-#line 105 "dtc-parser.y" /* yacc.c:1646 */ ++#line 109 "dtc-parser.y" /* yacc.c:1646 */ + { ++ (yyvsp[0].node)->is_plugin = (yyvsp[-2].is_plugin); + the_boot_info = build_boot_info((yyvsp[-1].re), (yyvsp[0].node), + guess_boot_cpuid((yyvsp[0].node))); + } +-#line 1472 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1476 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + + case 3: +-#line 113 "dtc-parser.y" /* yacc.c:1646 */ ++#line 118 "dtc-parser.y" /* yacc.c:1646 */ + { +- (yyval.re) = NULL; ++ (yyval.is_plugin) = false; + } +-#line 1480 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1484 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + + case 4: +-#line 117 "dtc-parser.y" /* yacc.c:1646 */ ++#line 122 "dtc-parser.y" /* yacc.c:1646 */ + { +- (yyval.re) = chain_reserve_entry((yyvsp[-1].re), (yyvsp[0].re)); ++ (yyval.is_plugin) = true; + } +-#line 1488 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1492 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + + case 5: +-#line 124 "dtc-parser.y" /* yacc.c:1646 */ ++#line 129 "dtc-parser.y" /* yacc.c:1646 */ + { +- (yyval.re) = build_reserve_entry((yyvsp[-2].integer), (yyvsp[-1].integer)); ++ (yyval.re) = NULL; + } +-#line 1496 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1500 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + + case 6: +-#line 128 "dtc-parser.y" /* yacc.c:1646 */ ++#line 133 "dtc-parser.y" /* yacc.c:1646 */ ++ { ++ (yyval.re) = chain_reserve_entry((yyvsp[-1].re), (yyvsp[0].re)); ++ } ++#line 1508 "dtc-parser.tab.c" /* yacc.c:1646 */ ++ break; ++ ++ case 7: ++#line 140 "dtc-parser.y" /* yacc.c:1646 */ ++ { ++ (yyval.re) = build_reserve_entry((yyvsp[-2].integer), (yyvsp[-1].integer)); ++ } ++#line 1516 "dtc-parser.tab.c" /* yacc.c:1646 */ ++ break; ++ ++ case 8: ++#line 144 "dtc-parser.y" /* yacc.c:1646 */ + { + add_label(&(yyvsp[0].re)->labels, (yyvsp[-1].labelref)); + (yyval.re) = (yyvsp[0].re); + } +-#line 1505 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1525 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 7: +-#line 136 "dtc-parser.y" /* yacc.c:1646 */ ++ case 9: ++#line 152 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = name_node((yyvsp[0].node), ""); + } +-#line 1513 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1533 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 8: +-#line 140 "dtc-parser.y" /* yacc.c:1646 */ ++ case 10: ++#line 156 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = merge_nodes((yyvsp[-2].node), (yyvsp[0].node)); + } +-#line 1521 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1541 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 9: +-#line 145 "dtc-parser.y" /* yacc.c:1646 */ ++ case 11: ++#line 161 "dtc-parser.y" /* yacc.c:1646 */ + { + struct node *target = get_node_by_ref((yyvsp[-3].node), (yyvsp[-1].labelref)); + +@@ -1532,11 +1552,11 @@ yyreduce: + ERROR(&(yylsp[-1]), "Label or path %s not found", (yyvsp[-1].labelref)); + (yyval.node) = (yyvsp[-3].node); + } +-#line 1536 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1556 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 10: +-#line 156 "dtc-parser.y" /* yacc.c:1646 */ ++ case 12: ++#line 172 "dtc-parser.y" /* yacc.c:1646 */ + { + struct node *target = get_node_by_ref((yyvsp[-2].node), (yyvsp[-1].labelref)); + +@@ -1546,11 +1566,11 @@ yyreduce: + ERROR(&(yylsp[-1]), "Label or path %s not found", (yyvsp[-1].labelref)); + (yyval.node) = (yyvsp[-2].node); + } +-#line 1550 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1570 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 11: +-#line 166 "dtc-parser.y" /* yacc.c:1646 */ ++ case 13: ++#line 182 "dtc-parser.y" /* yacc.c:1646 */ + { + struct node *target = get_node_by_ref((yyvsp[-3].node), (yyvsp[-1].labelref)); + +@@ -1562,100 +1582,100 @@ yyreduce: + + (yyval.node) = (yyvsp[-3].node); + } +-#line 1566 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1586 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 12: +-#line 181 "dtc-parser.y" /* yacc.c:1646 */ ++ case 14: ++#line 197 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = build_node((yyvsp[-3].proplist), (yyvsp[-2].nodelist)); + } +-#line 1574 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1594 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 13: +-#line 188 "dtc-parser.y" /* yacc.c:1646 */ ++ case 15: ++#line 204 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.proplist) = NULL; + } +-#line 1582 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1602 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 14: +-#line 192 "dtc-parser.y" /* yacc.c:1646 */ ++ case 16: ++#line 208 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.proplist) = chain_property((yyvsp[0].prop), (yyvsp[-1].proplist)); + } +-#line 1590 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1610 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 15: +-#line 199 "dtc-parser.y" /* yacc.c:1646 */ ++ case 17: ++#line 215 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.prop) = build_property((yyvsp[-3].propnodename), (yyvsp[-1].data)); + } +-#line 1598 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1618 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 16: +-#line 203 "dtc-parser.y" /* yacc.c:1646 */ ++ case 18: ++#line 219 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.prop) = build_property((yyvsp[-1].propnodename), empty_data); + } +-#line 1606 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1626 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 17: +-#line 207 "dtc-parser.y" /* yacc.c:1646 */ ++ case 19: ++#line 223 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.prop) = build_property_delete((yyvsp[-1].propnodename)); + } +-#line 1614 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1634 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 18: +-#line 211 "dtc-parser.y" /* yacc.c:1646 */ ++ case 20: ++#line 227 "dtc-parser.y" /* yacc.c:1646 */ + { + add_label(&(yyvsp[0].prop)->labels, (yyvsp[-1].labelref)); + (yyval.prop) = (yyvsp[0].prop); + } +-#line 1623 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1643 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 19: +-#line 219 "dtc-parser.y" /* yacc.c:1646 */ ++ case 21: ++#line 235 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.data) = data_merge((yyvsp[-1].data), (yyvsp[0].data)); + } +-#line 1631 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1651 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 20: +-#line 223 "dtc-parser.y" /* yacc.c:1646 */ ++ case 22: ++#line 239 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.data) = data_merge((yyvsp[-2].data), (yyvsp[-1].array).data); + } +-#line 1639 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1659 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 21: +-#line 227 "dtc-parser.y" /* yacc.c:1646 */ ++ case 23: ++#line 243 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.data) = data_merge((yyvsp[-3].data), (yyvsp[-1].data)); + } +-#line 1647 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1667 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 22: +-#line 231 "dtc-parser.y" /* yacc.c:1646 */ ++ case 24: ++#line 247 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.data) = data_add_marker((yyvsp[-1].data), REF_PATH, (yyvsp[0].labelref)); + } +-#line 1655 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1675 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 23: +-#line 235 "dtc-parser.y" /* yacc.c:1646 */ ++ case 25: ++#line 251 "dtc-parser.y" /* yacc.c:1646 */ + { + FILE *f = srcfile_relative_open((yyvsp[-5].data).val, NULL); + struct data d; +@@ -1671,11 +1691,11 @@ yyreduce: + (yyval.data) = data_merge((yyvsp[-8].data), d); + fclose(f); + } +-#line 1675 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1695 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 24: +-#line 251 "dtc-parser.y" /* yacc.c:1646 */ ++ case 26: ++#line 267 "dtc-parser.y" /* yacc.c:1646 */ + { + FILE *f = srcfile_relative_open((yyvsp[-1].data).val, NULL); + struct data d = empty_data; +@@ -1685,43 +1705,43 @@ yyreduce: + (yyval.data) = data_merge((yyvsp[-4].data), d); + fclose(f); + } +-#line 1689 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1709 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 25: +-#line 261 "dtc-parser.y" /* yacc.c:1646 */ ++ case 27: ++#line 277 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.data) = data_add_marker((yyvsp[-1].data), LABEL, (yyvsp[0].labelref)); + } +-#line 1697 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1717 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 26: +-#line 268 "dtc-parser.y" /* yacc.c:1646 */ ++ case 28: ++#line 284 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.data) = empty_data; + } +-#line 1705 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1725 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 27: +-#line 272 "dtc-parser.y" /* yacc.c:1646 */ ++ case 29: ++#line 288 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.data) = (yyvsp[-1].data); + } +-#line 1713 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1733 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 28: +-#line 276 "dtc-parser.y" /* yacc.c:1646 */ ++ case 30: ++#line 292 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.data) = data_add_marker((yyvsp[-1].data), LABEL, (yyvsp[0].labelref)); + } +-#line 1721 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1741 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 29: +-#line 283 "dtc-parser.y" /* yacc.c:1646 */ ++ case 31: ++#line 299 "dtc-parser.y" /* yacc.c:1646 */ + { + unsigned long long bits; + +@@ -1737,20 +1757,20 @@ yyreduce: + (yyval.array).data = empty_data; + (yyval.array).bits = bits; + } +-#line 1741 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1761 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 30: +-#line 299 "dtc-parser.y" /* yacc.c:1646 */ ++ case 32: ++#line 315 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.array).data = empty_data; + (yyval.array).bits = 32; + } +-#line 1750 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1770 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 31: +-#line 304 "dtc-parser.y" /* yacc.c:1646 */ ++ case 33: ++#line 320 "dtc-parser.y" /* yacc.c:1646 */ + { + if ((yyvsp[-1].array).bits < 64) { + uint64_t mask = (1ULL << (yyvsp[-1].array).bits) - 1; +@@ -1769,11 +1789,11 @@ yyreduce: + + (yyval.array).data = data_append_integer((yyvsp[-1].array).data, (yyvsp[0].integer), (yyvsp[-1].array).bits); + } +-#line 1773 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1793 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 32: +-#line 323 "dtc-parser.y" /* yacc.c:1646 */ ++ case 34: ++#line 339 "dtc-parser.y" /* yacc.c:1646 */ + { + uint64_t val = ~0ULL >> (64 - (yyvsp[-1].array).bits); + +@@ -1787,247 +1807,233 @@ yyreduce: + + (yyval.array).data = data_append_integer((yyvsp[-1].array).data, val, (yyvsp[-1].array).bits); + } +-#line 1791 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1811 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 33: +-#line 337 "dtc-parser.y" /* yacc.c:1646 */ ++ case 35: ++#line 353 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.array).data = data_add_marker((yyvsp[-1].array).data, LABEL, (yyvsp[0].labelref)); + } +-#line 1799 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1819 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 36: +-#line 346 "dtc-parser.y" /* yacc.c:1646 */ ++ case 38: ++#line 362 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.integer) = (yyvsp[-1].integer); + } +-#line 1807 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1827 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 39: +-#line 357 "dtc-parser.y" /* yacc.c:1646 */ ++ case 41: ++#line 373 "dtc-parser.y" /* yacc.c:1646 */ + { (yyval.integer) = (yyvsp[-4].integer) ? (yyvsp[-2].integer) : (yyvsp[0].integer); } +-#line 1813 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1833 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 41: +-#line 362 "dtc-parser.y" /* yacc.c:1646 */ ++ case 43: ++#line 378 "dtc-parser.y" /* yacc.c:1646 */ + { (yyval.integer) = (yyvsp[-2].integer) || (yyvsp[0].integer); } +-#line 1819 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1839 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 43: +-#line 367 "dtc-parser.y" /* yacc.c:1646 */ ++ case 45: ++#line 383 "dtc-parser.y" /* yacc.c:1646 */ + { (yyval.integer) = (yyvsp[-2].integer) && (yyvsp[0].integer); } +-#line 1825 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1845 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 45: +-#line 372 "dtc-parser.y" /* yacc.c:1646 */ ++ case 47: ++#line 388 "dtc-parser.y" /* yacc.c:1646 */ + { (yyval.integer) = (yyvsp[-2].integer) | (yyvsp[0].integer); } +-#line 1831 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1851 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 47: +-#line 377 "dtc-parser.y" /* yacc.c:1646 */ ++ case 49: ++#line 393 "dtc-parser.y" /* yacc.c:1646 */ + { (yyval.integer) = (yyvsp[-2].integer) ^ (yyvsp[0].integer); } +-#line 1837 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1857 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 49: +-#line 382 "dtc-parser.y" /* yacc.c:1646 */ ++ case 51: ++#line 398 "dtc-parser.y" /* yacc.c:1646 */ + { (yyval.integer) = (yyvsp[-2].integer) & (yyvsp[0].integer); } +-#line 1843 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1863 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 51: +-#line 387 "dtc-parser.y" /* yacc.c:1646 */ ++ case 53: ++#line 403 "dtc-parser.y" /* yacc.c:1646 */ + { (yyval.integer) = (yyvsp[-2].integer) == (yyvsp[0].integer); } +-#line 1849 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1869 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 52: +-#line 388 "dtc-parser.y" /* yacc.c:1646 */ ++ case 54: ++#line 404 "dtc-parser.y" /* yacc.c:1646 */ + { (yyval.integer) = (yyvsp[-2].integer) != (yyvsp[0].integer); } +-#line 1855 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1875 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 54: +-#line 393 "dtc-parser.y" /* yacc.c:1646 */ ++ case 56: ++#line 409 "dtc-parser.y" /* yacc.c:1646 */ + { (yyval.integer) = (yyvsp[-2].integer) < (yyvsp[0].integer); } +-#line 1861 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1881 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 55: +-#line 394 "dtc-parser.y" /* yacc.c:1646 */ ++ case 57: ++#line 410 "dtc-parser.y" /* yacc.c:1646 */ + { (yyval.integer) = (yyvsp[-2].integer) > (yyvsp[0].integer); } +-#line 1867 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1887 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 56: +-#line 395 "dtc-parser.y" /* yacc.c:1646 */ ++ case 58: ++#line 411 "dtc-parser.y" /* yacc.c:1646 */ + { (yyval.integer) = (yyvsp[-2].integer) <= (yyvsp[0].integer); } +-#line 1873 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1893 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 57: +-#line 396 "dtc-parser.y" /* yacc.c:1646 */ ++ case 59: ++#line 412 "dtc-parser.y" /* yacc.c:1646 */ + { (yyval.integer) = (yyvsp[-2].integer) >= (yyvsp[0].integer); } +-#line 1879 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1899 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 58: +-#line 400 "dtc-parser.y" /* yacc.c:1646 */ ++ case 60: ++#line 416 "dtc-parser.y" /* yacc.c:1646 */ + { (yyval.integer) = (yyvsp[-2].integer) << (yyvsp[0].integer); } +-#line 1885 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1905 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 59: +-#line 401 "dtc-parser.y" /* yacc.c:1646 */ ++ case 61: ++#line 417 "dtc-parser.y" /* yacc.c:1646 */ + { (yyval.integer) = (yyvsp[-2].integer) >> (yyvsp[0].integer); } +-#line 1891 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1911 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 61: +-#line 406 "dtc-parser.y" /* yacc.c:1646 */ ++ case 63: ++#line 422 "dtc-parser.y" /* yacc.c:1646 */ + { (yyval.integer) = (yyvsp[-2].integer) + (yyvsp[0].integer); } +-#line 1897 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1917 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 62: +-#line 407 "dtc-parser.y" /* yacc.c:1646 */ ++ case 64: ++#line 423 "dtc-parser.y" /* yacc.c:1646 */ + { (yyval.integer) = (yyvsp[-2].integer) - (yyvsp[0].integer); } +-#line 1903 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1923 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 64: +-#line 412 "dtc-parser.y" /* yacc.c:1646 */ ++ case 66: ++#line 428 "dtc-parser.y" /* yacc.c:1646 */ + { (yyval.integer) = (yyvsp[-2].integer) * (yyvsp[0].integer); } +-#line 1909 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1929 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 65: +-#line 414 "dtc-parser.y" /* yacc.c:1646 */ +- { +- if ((yyvsp[0].integer) != 0) { +- (yyval.integer) = (yyvsp[-2].integer) / (yyvsp[0].integer); +- } else { +- ERROR(&(yyloc), "Division by zero"); +- (yyval.integer) = 0; +- } +- } +-#line 1922 "dtc-parser.tab.c" /* yacc.c:1646 */ ++ case 67: ++#line 429 "dtc-parser.y" /* yacc.c:1646 */ ++ { (yyval.integer) = (yyvsp[-2].integer) / (yyvsp[0].integer); } ++#line 1935 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 66: +-#line 423 "dtc-parser.y" /* yacc.c:1646 */ +- { +- if ((yyvsp[0].integer) != 0) { +- (yyval.integer) = (yyvsp[-2].integer) % (yyvsp[0].integer); +- } else { +- ERROR(&(yyloc), "Division by zero"); +- (yyval.integer) = 0; +- } +- } +-#line 1935 "dtc-parser.tab.c" /* yacc.c:1646 */ ++ case 68: ++#line 430 "dtc-parser.y" /* yacc.c:1646 */ ++ { (yyval.integer) = (yyvsp[-2].integer) % (yyvsp[0].integer); } ++#line 1941 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 69: ++ case 71: + #line 436 "dtc-parser.y" /* yacc.c:1646 */ + { (yyval.integer) = -(yyvsp[0].integer); } +-#line 1941 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1947 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 70: ++ case 72: + #line 437 "dtc-parser.y" /* yacc.c:1646 */ + { (yyval.integer) = ~(yyvsp[0].integer); } +-#line 1947 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1953 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 71: ++ case 73: + #line 438 "dtc-parser.y" /* yacc.c:1646 */ + { (yyval.integer) = !(yyvsp[0].integer); } +-#line 1953 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1959 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 72: ++ case 74: + #line 443 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.data) = empty_data; + } +-#line 1961 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1967 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 73: ++ case 75: + #line 447 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.data) = data_append_byte((yyvsp[-1].data), (yyvsp[0].byte)); + } +-#line 1969 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1975 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 74: ++ case 76: + #line 451 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.data) = data_add_marker((yyvsp[-1].data), LABEL, (yyvsp[0].labelref)); + } +-#line 1977 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1983 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 75: ++ case 77: + #line 458 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.nodelist) = NULL; + } +-#line 1985 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1991 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 76: ++ case 78: + #line 462 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.nodelist) = chain_node((yyvsp[-1].node), (yyvsp[0].nodelist)); + } +-#line 1993 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1999 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 77: ++ case 79: + #line 466 "dtc-parser.y" /* yacc.c:1646 */ + { + ERROR(&(yylsp[0]), "Properties must precede subnodes"); + YYERROR; + } +-#line 2002 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 2008 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 78: ++ case 80: + #line 474 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = name_node((yyvsp[0].node), (yyvsp[-1].propnodename)); + } +-#line 2010 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 2016 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 79: ++ case 81: + #line 478 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = name_node(build_node_delete(), (yyvsp[-1].propnodename)); + } +-#line 2018 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 2024 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 80: ++ case 82: + #line 482 "dtc-parser.y" /* yacc.c:1646 */ + { + add_label(&(yyvsp[0].node)->labels, (yyvsp[-1].labelref)); + (yyval.node) = (yyvsp[0].node); + } +-#line 2027 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 2033 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + + +-#line 2031 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 2037 "dtc-parser.tab.c" /* yacc.c:1646 */ + default: break; + } + /* User semantic actions sometimes alter yychar, and that requires +diff --git a/scripts/dtc/dtc-parser.tab.h_shipped b/scripts/dtc/dtc-parser.tab.h_shipped +index 30867c6..276d078 100644 +--- a/scripts/dtc/dtc-parser.tab.h_shipped ++++ b/scripts/dtc/dtc-parser.tab.h_shipped +@@ -46,26 +46,27 @@ extern int yydebug; + enum yytokentype + { + DT_V1 = 258, +- DT_MEMRESERVE = 259, +- DT_LSHIFT = 260, +- DT_RSHIFT = 261, +- DT_LE = 262, +- DT_GE = 263, +- DT_EQ = 264, +- DT_NE = 265, +- DT_AND = 266, +- DT_OR = 267, +- DT_BITS = 268, +- DT_DEL_PROP = 269, +- DT_DEL_NODE = 270, +- DT_PROPNODENAME = 271, +- DT_LITERAL = 272, +- DT_CHAR_LITERAL = 273, +- DT_BYTE = 274, +- DT_STRING = 275, +- DT_LABEL = 276, +- DT_REF = 277, +- DT_INCBIN = 278 ++ DT_PLUGIN = 259, ++ DT_MEMRESERVE = 260, ++ DT_LSHIFT = 261, ++ DT_RSHIFT = 262, ++ DT_LE = 263, ++ DT_GE = 264, ++ DT_EQ = 265, ++ DT_NE = 266, ++ DT_AND = 267, ++ DT_OR = 268, ++ DT_BITS = 269, ++ DT_DEL_PROP = 270, ++ DT_DEL_NODE = 271, ++ DT_PROPNODENAME = 272, ++ DT_LITERAL = 273, ++ DT_CHAR_LITERAL = 274, ++ DT_BYTE = 275, ++ DT_STRING = 276, ++ DT_LABEL = 277, ++ DT_REF = 278, ++ DT_INCBIN = 279 + }; + #endif + +@@ -74,7 +75,7 @@ extern int yydebug; + typedef union YYSTYPE YYSTYPE; + union YYSTYPE + { +-#line 38 "dtc-parser.y" /* yacc.c:1909 */ ++#line 39 "dtc-parser.y" /* yacc.c:1909 */ + + char *propnodename; + char *labelref; +@@ -92,8 +93,9 @@ union YYSTYPE + struct node *nodelist; + struct reserve_info *re; + uint64_t integer; ++ bool is_plugin; + +-#line 97 "dtc-parser.tab.h" /* yacc.c:1909 */ ++#line 99 "dtc-parser.tab.h" /* yacc.c:1909 */ + }; + # define YYSTYPE_IS_TRIVIAL 1 + # define YYSTYPE_IS_DECLARED 1 +diff --git a/scripts/dtc/dtc-parser.y b/scripts/dtc/dtc-parser.y +index 000873f..bd67bac 100644 +--- a/scripts/dtc/dtc-parser.y ++++ b/scripts/dtc/dtc-parser.y +@@ -19,6 +19,7 @@ + */ + %{ + #include <stdio.h> ++#include <inttypes.h> + + #include "dtc.h" + #include "srcpos.h" +@@ -52,9 +53,11 @@ extern bool treesource_error; + struct node *nodelist; + struct reserve_info *re; + uint64_t integer; ++ bool is_plugin; + } + + %token DT_V1 ++%token DT_PLUGIN + %token DT_MEMRESERVE + %token DT_LSHIFT DT_RSHIFT DT_LE DT_GE DT_EQ DT_NE DT_AND DT_OR + %token DT_BITS +@@ -71,6 +74,7 @@ extern bool treesource_error; + + %type <data> propdata + %type <data> propdataprefix ++%type <is_plugin> plugindecl + %type <re> memreserve + %type <re> memreserves + %type <array> arrayprefix +@@ -101,10 +105,22 @@ extern bool treesource_error; + %% + + sourcefile: +- DT_V1 ';' memreserves devicetree ++ DT_V1 ';' plugindecl memreserves devicetree + { +- the_boot_info = build_boot_info($3, $4, +- guess_boot_cpuid($4)); ++ $5->is_plugin = $3; ++ the_boot_info = build_boot_info($4, $5, ++ guess_boot_cpuid($5)); ++ } ++ ; ++ ++plugindecl: ++ /* empty */ ++ { ++ $$ = false; ++ } ++ | DT_PLUGIN ';' ++ { ++ $$ = true; + } + ; + +diff --git a/scripts/dtc/dtc.c b/scripts/dtc/dtc.c +index 5fa23c4..1f8c285 100644 +--- a/scripts/dtc/dtc.c ++++ b/scripts/dtc/dtc.c +@@ -31,6 +31,7 @@ int reservenum; /* Number of memory reservation slots */ + int minsize; /* Minimum blob size */ + int padsize; /* Additional padding to blob */ + int phandle_format = PHANDLE_BOTH; /* Use linux,phandle or phandle properties */ ++int symbol_fixup_support = 0; + + static void fill_fullpaths(struct node *tree, const char *prefix) + { +@@ -53,7 +54,7 @@ static void fill_fullpaths(struct node *tree, const char *prefix) + #define FDT_VERSION(version) _FDT_VERSION(version) + #define _FDT_VERSION(version) #version + static const char usage_synopsis[] = "dtc [options] <input file>"; +-static const char usage_short_opts[] = "qI:O:o:V:d:R:S:p:fb:i:H:sW:E:hv"; ++static const char usage_short_opts[] = "qI:O:o:V:d:R:S:p:fb:i:H:sW:E:@hv"; + static struct option const usage_long_opts[] = { + {"quiet", no_argument, NULL, 'q'}, + {"in-format", a_argument, NULL, 'I'}, +@@ -71,6 +72,7 @@ static struct option const usage_long_opts[] = { + {"phandle", a_argument, NULL, 'H'}, + {"warning", a_argument, NULL, 'W'}, + {"error", a_argument, NULL, 'E'}, ++ {"symbols", no_argument, NULL, '@'}, + {"help", no_argument, NULL, 'h'}, + {"version", no_argument, NULL, 'v'}, + {NULL, no_argument, NULL, 0x0}, +@@ -101,6 +103,7 @@ static const char * const usage_opts_help[] = { + "\t\tboth - Both \"linux,phandle\" and \"phandle\" properties", + "\n\tEnable/disable warnings (prefix with \"no-\")", + "\n\tEnable/disable errors (prefix with \"no-\")", ++ "\n\tEnable symbols/fixup support", + "\n\tPrint this help and exit", + "\n\tPrint version and exit", + NULL, +@@ -233,7 +236,9 @@ int main(int argc, char *argv[]) + case 'E': + parse_checks_option(false, true, optarg); + break; +- ++ case '@': ++ symbol_fixup_support = 1; ++ break; + case 'h': + usage(NULL); + default: +diff --git a/scripts/dtc/dtc.h b/scripts/dtc/dtc.h +index 56212c8..f163b22 100644 +--- a/scripts/dtc/dtc.h ++++ b/scripts/dtc/dtc.h +@@ -54,6 +54,7 @@ extern int reservenum; /* Number of memory reservation slots */ + extern int minsize; /* Minimum blob size */ + extern int padsize; /* Additional padding to blob */ + extern int phandle_format; /* Use linux,phandle or phandle properties */ ++extern int symbol_fixup_support;/* enable symbols & fixup support */ + + #define PHANDLE_LEGACY 0x1 + #define PHANDLE_EPAPR 0x2 +@@ -132,6 +133,26 @@ struct label { + struct label *next; + }; + ++struct fixup_entry { ++ int offset; ++ struct node *node; ++ struct property *prop; ++ struct fixup_entry *next; ++ bool local_fixup_generated; ++}; ++ ++struct fixup { ++ char *ref; ++ struct fixup_entry *entries; ++ struct fixup *next; ++}; ++ ++struct symbol { ++ struct label *label; ++ struct node *node; ++ struct symbol *next; ++}; ++ + struct property { + bool deleted; + char *name; +@@ -158,6 +179,13 @@ struct node { + int addr_cells, size_cells; + + struct label *labels; ++ ++ struct symbol *symbols; ++ struct fixup_entry *local_fixups; ++ bool emit_local_fixup_node; ++ ++ bool is_plugin; ++ struct fixup *fixups; + }; + + #define for_each_label_withdel(l0, l) \ +@@ -181,6 +209,18 @@ struct node { + for_each_child_withdel(n, c) \ + if (!(c)->deleted) + ++#define for_each_fixup(n, f) \ ++ for ((f) = (n)->fixups; (f); (f) = (f)->next) ++ ++#define for_each_fixup_entry(f, fe) \ ++ for ((fe) = (f)->entries; (fe); (fe) = (fe)->next) ++ ++#define for_each_symbol(n, s) \ ++ for ((s) = (n)->symbols; (s); (s) = (s)->next) ++ ++#define for_each_local_fixup_entry(n, fe) \ ++ for ((fe) = (n)->local_fixups; (fe); (fe) = (fe)->next) ++ + void add_label(struct label **labels, char *label); + void delete_labels(struct label **labels); + +diff --git a/scripts/dtc/flattree.c b/scripts/dtc/flattree.c +index bd99fa2..2385137 100644 +--- a/scripts/dtc/flattree.c ++++ b/scripts/dtc/flattree.c +@@ -255,6 +255,204 @@ static int stringtable_insert(struct data *d, const char *str) + return i; + } + ++static void emit_local_fixups(struct node *tree, struct emitter *emit, ++ void *etarget, struct data *strbuf, struct version_info *vi, ++ struct node *node) ++{ ++ struct fixup_entry *fe, *fen; ++ struct node *child; ++ int nameoff, count; ++ cell_t *buf; ++ struct data d; ++ ++ if (node->emit_local_fixup_node) { ++ ++ /* emit the external fixups (do not emit /) */ ++ if (node != tree) { ++ emit->beginnode(etarget, NULL); ++ emit->string(etarget, node->name, 0); ++ emit->align(etarget, sizeof(cell_t)); ++ } ++ ++ for_each_local_fixup_entry(tree, fe) { ++ if (fe->node != node || fe->local_fixup_generated) ++ continue; ++ ++ /* count the number of fixup entries */ ++ count = 0; ++ for_each_local_fixup_entry(tree, fen) { ++ if (fen->prop != fe->prop) ++ continue; ++ fen->local_fixup_generated = true; ++ count++; ++ } ++ ++ /* allocate buffer */ ++ buf = xmalloc(count * sizeof(cell_t)); ++ ++ /* collect all the offsets in buffer */ ++ count = 0; ++ for_each_local_fixup_entry(tree, fen) { ++ if (fen->prop != fe->prop) ++ continue; ++ fen->local_fixup_generated = true; ++ buf[count++] = cpu_to_fdt32(fen->offset); ++ } ++ d = empty_data; ++ d.len = count * sizeof(cell_t); ++ d.val = (char *)buf; ++ ++ nameoff = stringtable_insert(strbuf, fe->prop->name); ++ emit->property(etarget, fe->prop->labels); ++ emit->cell(etarget, count * sizeof(cell_t)); ++ emit->cell(etarget, nameoff); ++ ++ if ((vi->flags & FTF_VARALIGN) && ++ (count * sizeof(cell_t)) >= 8) ++ emit->align(etarget, 8); ++ ++ emit->data(etarget, d); ++ emit->align(etarget, sizeof(cell_t)); ++ ++ free(buf); ++ } ++ } ++ ++ for_each_child(node, child) ++ emit_local_fixups(tree, emit, etarget, strbuf, vi, child); ++ ++ if (node->emit_local_fixup_node && node != tree) ++ emit->endnode(etarget, tree->labels); ++} ++ ++static void emit_symbols_node(struct node *tree, struct emitter *emit, ++ void *etarget, struct data *strbuf, ++ struct version_info *vi) ++{ ++ struct symbol *sym; ++ int nameoff, vallen; ++ ++ /* do nothing if no symbols */ ++ if (!tree->symbols) ++ return; ++ ++ emit->beginnode(etarget, NULL); ++ emit->string(etarget, "__symbols__", 0); ++ emit->align(etarget, sizeof(cell_t)); ++ ++ for_each_symbol(tree, sym) { ++ ++ vallen = strlen(sym->node->fullpath); ++ ++ nameoff = stringtable_insert(strbuf, sym->label->label); ++ ++ emit->property(etarget, NULL); ++ emit->cell(etarget, vallen + 1); ++ emit->cell(etarget, nameoff); ++ ++ if ((vi->flags & FTF_VARALIGN) && vallen >= 8) ++ emit->align(etarget, 8); ++ ++ emit->string(etarget, sym->node->fullpath, ++ strlen(sym->node->fullpath)); ++ emit->align(etarget, sizeof(cell_t)); ++ } ++ ++ emit->endnode(etarget, NULL); ++} ++ ++static void emit_local_fixups_node(struct node *tree, struct emitter *emit, ++ void *etarget, struct data *strbuf, ++ struct version_info *vi) ++{ ++ struct fixup_entry *fe; ++ struct node *node; ++ ++ /* do nothing if no local fixups */ ++ if (!tree->local_fixups) ++ return; ++ ++ /* mark all nodes that need a local fixup generated (and parents) */ ++ for_each_local_fixup_entry(tree, fe) { ++ node = fe->node; ++ while (node != NULL && !node->emit_local_fixup_node) { ++ node->emit_local_fixup_node = true; ++ node = node->parent; ++ } ++ } ++ ++ /* emit the local fixups node now */ ++ emit->beginnode(etarget, NULL); ++ emit->string(etarget, "__local_fixups__", 0); ++ emit->align(etarget, sizeof(cell_t)); ++ ++ emit_local_fixups(tree, emit, etarget, strbuf, vi, tree); ++ ++ emit->endnode(etarget, tree->labels); ++} ++ ++static void emit_fixups_node(struct node *tree, struct emitter *emit, ++ void *etarget, struct data *strbuf, ++ struct version_info *vi) ++{ ++ struct fixup *f; ++ struct fixup_entry *fe; ++ char *name, *s; ++ const char *fullpath; ++ int namesz, nameoff, vallen; ++ ++ /* do nothing if no fixups */ ++ if (!tree->fixups) ++ return; ++ ++ /* emit the external fixups */ ++ emit->beginnode(etarget, NULL); ++ emit->string(etarget, "__fixups__", 0); ++ emit->align(etarget, sizeof(cell_t)); ++ ++ for_each_fixup(tree, f) { ++ ++ namesz = 0; ++ for_each_fixup_entry(f, fe) { ++ fullpath = fe->node->fullpath; ++ if (fullpath[0] == '\0') ++ fullpath = "/"; ++ namesz += strlen(fullpath) + 1; ++ namesz += strlen(fe->prop->name) + 1; ++ namesz += 32; /* space for :<number> + '\0' */ ++ } ++ ++ name = xmalloc(namesz); ++ ++ s = name; ++ for_each_fixup_entry(f, fe) { ++ fullpath = fe->node->fullpath; ++ if (fullpath[0] == '\0') ++ fullpath = "/"; ++ snprintf(s, name + namesz - s, "%s:%s:%d", fullpath, ++ fe->prop->name, fe->offset); ++ s += strlen(s) + 1; ++ } ++ ++ nameoff = stringtable_insert(strbuf, f->ref); ++ vallen = s - name - 1; ++ ++ emit->property(etarget, NULL); ++ emit->cell(etarget, vallen + 1); ++ emit->cell(etarget, nameoff); ++ ++ if ((vi->flags & FTF_VARALIGN) && vallen >= 8) ++ emit->align(etarget, 8); ++ ++ emit->string(etarget, name, vallen); ++ emit->align(etarget, sizeof(cell_t)); ++ ++ free(name); ++ } ++ ++ emit->endnode(etarget, tree->labels); ++} ++ + static void flatten_tree(struct node *tree, struct emitter *emit, + void *etarget, struct data *strbuf, + struct version_info *vi) +@@ -310,6 +508,10 @@ static void flatten_tree(struct node *tree, struct emitter *emit, + flatten_tree(child, emit, etarget, strbuf, vi); + } + ++ emit_symbols_node(tree, emit, etarget, strbuf, vi); ++ emit_local_fixups_node(tree, emit, etarget, strbuf, vi); ++ emit_fixups_node(tree, emit, etarget, strbuf, vi); ++ + emit->endnode(etarget, tree->labels); + } + +diff --git a/scripts/dtc/version_gen.h b/scripts/dtc/version_gen.h +index 11d93e6..2595dfd 100644 +--- a/scripts/dtc/version_gen.h ++++ b/scripts/dtc/version_gen.h +@@ -1 +1 @@ +-#define DTC_VERSION "DTC 1.4.1-gb06e55c8" ++#define DTC_VERSION "DTC 1.4.1-g25efc119" + +From 43f338fd4cb0e7a0813f527883930806c712369e Mon Sep 17 00:00:00 2001 +From: Phil Elwell <phil@raspberrypi.org> +Date: Fri, 5 Dec 2014 17:26:26 +0000 +Subject: [PATCH 056/112] fdt: Add support for the CONFIG_CMDLINE_EXTEND option + +--- + drivers/of/fdt.c | 29 ++++++++++++++++++++++++----- + 1 file changed, 24 insertions(+), 5 deletions(-) + +diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c +index 3349d2a..1e26605 100644 +--- a/drivers/of/fdt.c ++++ b/drivers/of/fdt.c +@@ -960,19 +960,38 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname, + + /* Retrieve command line */ + p = of_get_flat_dt_prop(node, "bootargs", &l); +- if (p != NULL && l > 0) +- strlcpy(data, p, min((int)l, COMMAND_LINE_SIZE)); + + /* + * CONFIG_CMDLINE is meant to be a default in case nothing else + * managed to set the command line, unless CONFIG_CMDLINE_FORCE + * is set in which case we override whatever was found earlier. ++ * ++ * However, it can be useful to be able to treat the default as ++ * a starting point to be extended using CONFIG_CMDLINE_EXTEND. + */ ++ ((char *)data)[0] = '\0'; ++ + #ifdef CONFIG_CMDLINE +-#ifndef CONFIG_CMDLINE_FORCE +- if (!((char *)data)[0]) ++ strlcpy(data, CONFIG_CMDLINE, COMMAND_LINE_SIZE); ++ ++ if (p != NULL && l > 0) { ++#if defined(CONFIG_CMDLINE_EXTEND) ++ int len = strlen(data); ++ if (len > 0) { ++ strlcat(data, " ", COMMAND_LINE_SIZE); ++ len++; ++ } ++ strlcpy((char *)data + len, p, min((int)l, COMMAND_LINE_SIZE - len)); ++#elif defined(CONFIG_CMDLINE_FORCE) ++ pr_warning("Ignoring bootargs property (using the default kernel command line)\n"); ++#else ++ /* Neither extend nor force - just override */ ++ strlcpy(data, p, min((int)l, COMMAND_LINE_SIZE)); + #endif +- strlcpy(data, CONFIG_CMDLINE, COMMAND_LINE_SIZE); ++ } ++#else /* CONFIG_CMDLINE */ ++ if (p != NULL && l > 0) ++ strlcpy(data, p, min((int)l, COMMAND_LINE_SIZE)); + #endif /* CONFIG_CMDLINE */ + + pr_debug("Command line is: %s\n", (char*)data); + +From d0653a1baeb2b6a9507051fb026b01a1621cb321 Mon Sep 17 00:00:00 2001 +From: notro <notro@tronnes.org> +Date: Wed, 9 Jul 2014 14:46:08 +0200 +Subject: [PATCH 057/112] BCM2708: Add core Device Tree support + +Add the bare minimum needed to boot BCM2708 from a Device Tree. + +Signed-off-by: Noralf Tronnes <notro@tronnes.org> + +BCM2708: DT: change 'axi' nodename to 'soc' + +Change DT node named 'axi' to 'soc' so it matches ARCH_BCM2835. +The VC4 bootloader fills in certain properties in the 'axi' subtree, +but since this is part of an upstreaming effort, the name is changed. + +Signed-off-by: Noralf Tronnes notro@tronnes.org + +BCM2708_DT: Correct length of the peripheral space + +Use dts-dirs feature for overlays. + +The kernel makefiles have a dts-dirs target that is for vendor subdirectories. + +Using this fixes the install_dtbs target, which previously did not install the overlays. + +BCM270X_DT: configure I2S DMA channels + +Signed-off-by: Matthias Reichl <hias@horus.com> + +BCM270X_DT: switch to bcm2835-i2s + +I2S soundcard drivers with proper devicetree support (i.e. not linking +to the cpu_dai/platform via name but to cpu/platform via of_node) +will work out of the box without any modifications. + +When the kernel is compiled without devicetree support the platform +code will instantiate the bcm2708-i2s driver and I2S soundcard drivers +will link to it via name, as before. + +Signed-off-by: Matthias Reichl <hias@horus.com> + +SDIO-overlay: add poll_once-boolean parameter + +Add paramter to toggle sdio-device-polling +done every second or once at boot-time. + +Signed-off-by: Patrick Boettcher <patrick.boettcher@posteo.de> + +BCM270X_DT: Make mmc overlay compatible with current firmware + +The original DT overlay logic followed a merge-then-patch procedure, +i.e. parameters are applied to the loaded overlay before the overlay +is merged into the base DTB. This sequence has been changed to +patch-then-merge, in order to support parameterised node names, and +to protect against bad overlays. As a result, overrides (parameters) +must only target labels in the overlay, but the overlay can obviously target nodes in the base DTB. + +mmc-overlay.dts (that switches back to the original mmc sdcard +driver) is the only overlay violating that rule, and this patch +fixes it. + +bcm270x_dt: Use the sdhost MMC controller by default + +The "mmc" overlay reverts to using the other controller. + +squash: Add cprman to dt + +BCM270X_DT: Use clk_core for I2C interfaces +--- + arch/arm/boot/dts/Makefile | 31 + + arch/arm/boot/dts/bcm2708-rpi-b-plus.dts | 154 +++ + arch/arm/boot/dts/bcm2708-rpi-b.dts | 144 +++ + arch/arm/boot/dts/bcm2708-rpi-cm.dts | 102 ++ + arch/arm/boot/dts/bcm2708-rpi-cm.dtsi | 52 + + arch/arm/boot/dts/bcm2708.dtsi | 40 + + arch/arm/boot/dts/bcm2708_common.dtsi | 438 ++++++++ + arch/arm/boot/dts/bcm2709-rpi-2-b.dts | 154 +++ + arch/arm/boot/dts/bcm2709.dtsi | 102 ++ + arch/arm/boot/dts/bcm2710-rpi-3-b.dts | 201 ++++ + arch/arm/boot/dts/bcm2710.dtsi | 102 ++ + arch/arm/boot/dts/bcm2835-rpi-cm.dts | 93 ++ + arch/arm/boot/dts/bcm2835-rpi-cm.dtsi | 30 + + arch/arm/boot/dts/overlays/Makefile | 99 ++ + arch/arm/boot/dts/overlays/README | 1161 ++++++++++++++++++++ + .../arm/boot/dts/overlays/adau1977-adc-overlay.dts | 53 + + arch/arm/boot/dts/overlays/ads7846-overlay.dts | 89 ++ + .../dts/overlays/akkordion-iqdacplus-overlay.dts | 46 + + arch/arm/boot/dts/overlays/at86rf233-overlay.dts | 57 + + .../audioinjector-wm8731-audio-overlay.dts | 39 + + .../dts/overlays/bmp085_i2c-sensor-overlay.dts | 23 + + arch/arm/boot/dts/overlays/dht11-overlay.dts | 39 + + arch/arm/boot/dts/overlays/dpi24-overlay.dts | 31 + + arch/arm/boot/dts/overlays/dwc-otg-overlay.dts | 20 + + arch/arm/boot/dts/overlays/dwc2-overlay.dts | 29 + + arch/arm/boot/dts/overlays/enc28j60-overlay.dts | 53 + + arch/arm/boot/dts/overlays/gpio-ir-overlay.dts | 45 + + .../boot/dts/overlays/gpio-poweroff-overlay.dts | 34 + + .../boot/dts/overlays/hifiberry-amp-overlay.dts | 39 + + .../boot/dts/overlays/hifiberry-dac-overlay.dts | 34 + + .../dts/overlays/hifiberry-dacplus-overlay.dts | 56 + + .../boot/dts/overlays/hifiberry-digi-overlay.dts | 39 + + arch/arm/boot/dts/overlays/hy28a-overlay.dts | 93 ++ + arch/arm/boot/dts/overlays/hy28b-overlay.dts | 148 +++ + arch/arm/boot/dts/overlays/i2c-gpio-overlay.dts | 28 + + arch/arm/boot/dts/overlays/i2c-mux-overlay.dts | 139 +++ + .../boot/dts/overlays/i2c-pwm-pca9685a-overlay.dts | 26 + + arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts | 69 ++ + .../arm/boot/dts/overlays/i2c0-bcm2708-overlay.dts | 61 + + .../arm/boot/dts/overlays/i2c1-bcm2708-overlay.dts | 37 + + .../boot/dts/overlays/i2s-gpio28-31-overlay.dts | 18 + + arch/arm/boot/dts/overlays/i2s-mmap-overlay.dts | 13 + + arch/arm/boot/dts/overlays/iqaudio-dac-overlay.dts | 43 + + .../boot/dts/overlays/iqaudio-dacplus-overlay.dts | 43 + + .../arm/boot/dts/overlays/justboom-dac-overlay.dts | 43 + + .../boot/dts/overlays/justboom-digi-overlay.dts | 39 + + arch/arm/boot/dts/overlays/lirc-rpi-overlay.dts | 57 + + arch/arm/boot/dts/overlays/mcp23017-overlay.dts | 54 + + .../arm/boot/dts/overlays/mcp2515-can0-overlay.dts | 73 ++ + .../arm/boot/dts/overlays/mcp2515-can1-overlay.dts | 73 ++ + arch/arm/boot/dts/overlays/mmc-overlay.dts | 38 + + arch/arm/boot/dts/overlays/mz61581-overlay.dts | 117 ++ + arch/arm/boot/dts/overlays/pi3-act-led-overlay.dts | 27 + + .../boot/dts/overlays/pi3-disable-bt-overlay.dts | 46 + + .../boot/dts/overlays/pi3-miniuart-bt-overlay.dts | 64 ++ + arch/arm/boot/dts/overlays/piscreen-overlay.dts | 102 ++ + arch/arm/boot/dts/overlays/piscreen2r-overlay.dts | 106 ++ + arch/arm/boot/dts/overlays/pitft22-overlay.dts | 69 ++ + .../dts/overlays/pitft28-capacitive-overlay.dts | 91 ++ + .../dts/overlays/pitft28-resistive-overlay.dts | 121 ++ + arch/arm/boot/dts/overlays/pps-gpio-overlay.dts | 34 + + arch/arm/boot/dts/overlays/pwm-2chan-overlay.dts | 53 + + arch/arm/boot/dts/overlays/pwm-overlay.dts | 49 + + arch/arm/boot/dts/overlays/qca7000-overlay.dts | 52 + + arch/arm/boot/dts/overlays/raspidac3-overlay.dts | 45 + + .../boot/dts/overlays/rpi-backlight-overlay.dts | 21 + + arch/arm/boot/dts/overlays/rpi-dac-overlay.dts | 34 + + arch/arm/boot/dts/overlays/rpi-display-overlay.dts | 89 ++ + arch/arm/boot/dts/overlays/rpi-ft5406-overlay.dts | 17 + + arch/arm/boot/dts/overlays/rpi-proto-overlay.dts | 39 + + arch/arm/boot/dts/overlays/rpi-sense-overlay.dts | 47 + + .../overlays/rra-digidac1-wm8741-audio-overlay.dts | 81 ++ + arch/arm/boot/dts/overlays/sdhost-overlay.dts | 32 + + arch/arm/boot/dts/overlays/sdio-1bit-overlay.dts | 36 + + arch/arm/boot/dts/overlays/sdio-overlay.dts | 36 + + arch/arm/boot/dts/overlays/sdtweak-overlay.dts | 23 + + arch/arm/boot/dts/overlays/smi-dev-overlay.dts | 18 + + arch/arm/boot/dts/overlays/smi-nand-overlay.dts | 69 ++ + arch/arm/boot/dts/overlays/smi-overlay.dts | 37 + + .../boot/dts/overlays/spi-gpio35-39-overlay.dts | 31 + + arch/arm/boot/dts/overlays/spi1-1cs-overlay.dts | 57 + + arch/arm/boot/dts/overlays/spi1-2cs-overlay.dts | 69 ++ + arch/arm/boot/dts/overlays/spi1-3cs-overlay.dts | 81 ++ + arch/arm/boot/dts/overlays/spi2-1cs-overlay.dts | 57 + + arch/arm/boot/dts/overlays/spi2-2cs-overlay.dts | 69 ++ + arch/arm/boot/dts/overlays/spi2-3cs-overlay.dts | 81 ++ + arch/arm/boot/dts/overlays/tinylcd35-overlay.dts | 224 ++++ + arch/arm/boot/dts/overlays/uart1-overlay.dts | 38 + + arch/arm/boot/dts/overlays/vc4-kms-v3d-overlay.dts | 129 +++ + arch/arm/boot/dts/overlays/vga666-overlay.dts | 30 + + arch/arm/boot/dts/overlays/w1-gpio-overlay.dts | 39 + + .../boot/dts/overlays/w1-gpio-pullup-overlay.dts | 41 + + arch/arm/boot/dts/overlays/wittypi-overlay.dts | 44 + + 93 files changed, 7269 insertions(+) + create mode 100644 arch/arm/boot/dts/bcm2708-rpi-b-plus.dts + create mode 100644 arch/arm/boot/dts/bcm2708-rpi-b.dts + create mode 100755 arch/arm/boot/dts/bcm2708-rpi-cm.dts + create mode 100644 arch/arm/boot/dts/bcm2708-rpi-cm.dtsi + create mode 100644 arch/arm/boot/dts/bcm2708.dtsi + create mode 100644 arch/arm/boot/dts/bcm2708_common.dtsi + create mode 100644 arch/arm/boot/dts/bcm2709-rpi-2-b.dts + create mode 100644 arch/arm/boot/dts/bcm2709.dtsi + create mode 100644 arch/arm/boot/dts/bcm2710-rpi-3-b.dts + create mode 100644 arch/arm/boot/dts/bcm2710.dtsi + create mode 100644 arch/arm/boot/dts/bcm2835-rpi-cm.dts + create mode 100644 arch/arm/boot/dts/bcm2835-rpi-cm.dtsi + create mode 100644 arch/arm/boot/dts/overlays/Makefile + create mode 100644 arch/arm/boot/dts/overlays/README + create mode 100644 arch/arm/boot/dts/overlays/adau1977-adc-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/ads7846-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/akkordion-iqdacplus-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/at86rf233-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/audioinjector-wm8731-audio-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/bmp085_i2c-sensor-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/dht11-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/dpi24-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/dwc-otg-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/dwc2-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/enc28j60-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/gpio-ir-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/gpio-poweroff-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/hifiberry-amp-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/hifiberry-dac-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/hifiberry-digi-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/hy28a-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/hy28b-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/i2c-gpio-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/i2c-mux-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/i2c-pwm-pca9685a-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/i2c0-bcm2708-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/i2c1-bcm2708-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/i2s-gpio28-31-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/i2s-mmap-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/iqaudio-dac-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/iqaudio-dacplus-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/justboom-dac-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/justboom-digi-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/lirc-rpi-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/mcp23017-overlay.dts + create mode 100755 arch/arm/boot/dts/overlays/mcp2515-can0-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/mcp2515-can1-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/mmc-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/mz61581-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/pi3-act-led-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/pi3-disable-bt-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/pi3-miniuart-bt-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/piscreen-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/piscreen2r-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/pitft22-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/pitft28-capacitive-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/pitft28-resistive-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/pps-gpio-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/pwm-2chan-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/pwm-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/qca7000-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/raspidac3-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/rpi-backlight-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/rpi-dac-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/rpi-display-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/rpi-ft5406-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/rpi-proto-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/rpi-sense-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/rra-digidac1-wm8741-audio-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/sdhost-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/sdio-1bit-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/sdio-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/sdtweak-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/smi-dev-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/smi-nand-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/smi-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/spi-gpio35-39-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/spi1-1cs-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/spi1-2cs-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/spi1-3cs-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/spi2-1cs-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/spi2-2cs-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/spi2-3cs-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/tinylcd35-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/uart1-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/vc4-kms-v3d-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/vga666-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/w1-gpio-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/w1-gpio-pullup-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/wittypi-overlay.dts + +diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile +index 95c1923..1af92d7 100644 +--- a/arch/arm/boot/dts/Makefile ++++ b/arch/arm/boot/dts/Makefile +@@ -1,5 +1,26 @@ + ifeq ($(CONFIG_OF),y) + ++dtb-$(CONFIG_ARCH_BCM2708) += bcm2708-rpi-b.dtb ++dtb-$(CONFIG_ARCH_BCM2708) += bcm2708-rpi-b-plus.dtb ++dtb-$(CONFIG_ARCH_BCM2708) += bcm2708-rpi-cm.dtb ++dtb-$(CONFIG_ARCH_BCM2835) += bcm2835-rpi-cm.dtb ++dtb-$(CONFIG_ARCH_BCM2709) += bcm2709-rpi-2-b.dtb ++dtb-$(CONFIG_ARCH_BCM2709) += bcm2710-rpi-3-b.dtb ++ ++# Raspberry Pi ++ifeq ($(CONFIG_ARCH_BCM2708),y) ++ RPI_DT_OVERLAYS=y ++endif ++ifeq ($(CONFIG_ARCH_BCM2709),y) ++ RPI_DT_OVERLAYS=y ++endif ++ifeq ($(CONFIG_ARCH_BCM2835),y) ++ RPI_DT_OVERLAYS=y ++endif ++ifeq ($(RPI_DT_OVERLAYS),y) ++ dts-dirs += overlays ++endif ++ + dtb-$(CONFIG_ARCH_ALPINE) += \ + alpine-db.dtb + dtb-$(CONFIG_MACH_ARTPEC6) += \ +@@ -839,10 +860,20 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \ + mt8127-moose.dtb \ + mt8135-evbp1.dtb + dtb-$(CONFIG_ARCH_ZX) += zx296702-ad1.dtb ++ ++targets += dtbs dtbs_install ++targets += $(dtb-y) ++ + endif + + dtstree := $(srctree)/$(src) + dtb-$(CONFIG_OF_ALL_DTBS) := $(patsubst $(dtstree)/%.dts,%.dtb, $(wildcard $(dtstree)/*.dts)) + + always := $(dtb-y) ++subdir-y := $(dts-dirs) + clean-files := *.dtb ++ ++# Enable fixups to support overlays on BCM2708 platforms ++ifeq ($(RPI_DT_OVERLAYS),y) ++ DTC_FLAGS ?= -@ -H epapr ++endif +diff --git a/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts b/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts +new file mode 100644 +index 0000000..0ac7725 +--- /dev/null ++++ b/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts +@@ -0,0 +1,154 @@ ++/dts-v1/; ++ ++#include "bcm2708.dtsi" ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ model = "Raspberry Pi Model B+"; ++}; ++ ++&gpio { ++ sdhost_pins: sdhost_pins { ++ brcm,pins = <48 49 50 51 52 53>; ++ brcm,function = <4>; /* alt0 */ ++ }; ++ ++ spi0_pins: spi0_pins { ++ brcm,pins = <9 10 11>; ++ brcm,function = <4>; /* alt0 */ ++ }; ++ ++ spi0_cs_pins: spi0_cs_pins { ++ brcm,pins = <8 7>; ++ brcm,function = <1>; /* output */ ++ }; ++ ++ i2c0_pins: i2c0 { ++ brcm,pins = <0 1>; ++ brcm,function = <4>; ++ }; ++ ++ i2c1_pins: i2c1 { ++ brcm,pins = <2 3>; ++ brcm,function = <4>; ++ }; ++ ++ i2s_pins: i2s { ++ brcm,pins = <18 19 20 21>; ++ brcm,function = <4>; /* alt0 */ ++ }; ++}; ++ ++&sdhost { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&sdhost_pins>; ++ bus-width = <4>; ++ status = "okay"; ++}; ++ ++&fb { ++ status = "okay"; ++}; ++ ++&uart0 { ++ status = "okay"; ++}; ++ ++&spi0 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&spi0_pins &spi0_cs_pins>; ++ cs-gpios = <&gpio 8 1>, <&gpio 7 1>; ++ ++ spidev0: spidev@0{ ++ compatible = "spidev"; ++ reg = <0>; /* CE0 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ }; ++ ++ spidev1: spidev@1{ ++ compatible = "spidev"; ++ reg = <1>; /* CE1 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ }; ++}; ++ ++&i2c0 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2c0_pins>; ++ clock-frequency = <100000>; ++}; ++ ++&i2c1 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2c1_pins>; ++ clock-frequency = <100000>; ++}; ++ ++&i2c2 { ++ clock-frequency = <100000>; ++}; ++ ++&i2s { ++ #sound-dai-cells = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2s_pins>; ++}; ++ ++&random { ++ status = "okay"; ++}; ++ ++&leds { ++ act_led: act { ++ label = "led0"; ++ linux,default-trigger = "mmc0"; ++ gpios = <&gpio 47 0>; ++ }; ++ ++ pwr_led: pwr { ++ label = "led1"; ++ linux,default-trigger = "input"; ++ gpios = <&gpio 35 0>; ++ }; ++}; ++ ++&hdmi { ++ hpd-gpios = <&gpio 46 GPIO_ACTIVE_LOW>; ++}; ++ ++/ { ++ __overrides__ { ++ uart0 = <&uart0>,"status"; ++ uart0_clkrate = <&clk_uart0>,"clock-frequency:0"; ++ uart1 = <&uart1>,"status"; ++ i2s = <&i2s>,"status"; ++ spi = <&spi0>,"status"; ++ i2c0 = <&i2c0>,"status"; ++ i2c1 = <&i2c1>,"status"; ++ i2c2_iknowwhatimdoing = <&i2c2>,"status"; ++ i2c0_baudrate = <&i2c0>,"clock-frequency:0"; ++ i2c1_baudrate = <&i2c1>,"clock-frequency:0"; ++ i2c2_baudrate = <&i2c2>,"clock-frequency:0"; ++ core_freq = <&clk_core>,"clock-frequency:0"; ++ ++ act_led_gpio = <&act_led>,"gpios:4"; ++ act_led_activelow = <&act_led>,"gpios:8"; ++ act_led_trigger = <&act_led>,"linux,default-trigger"; ++ ++ pwr_led_gpio = <&pwr_led>,"gpios:4"; ++ pwr_led_activelow = <&pwr_led>,"gpios:8"; ++ pwr_led_trigger = <&pwr_led>,"linux,default-trigger"; ++ ++ audio = <&audio>,"status"; ++ watchdog = <&watchdog>,"status"; ++ random = <&random>,"status"; ++ sd_overclock = <&sdhost>,"brcm,overclock-50:0"; ++ sd_force_pio = <&sdhost>,"brcm,force-pio?"; ++ sd_pio_limit = <&sdhost>,"brcm,pio-limit:0"; ++ sd_debug = <&sdhost>,"brcm,debug"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/bcm2708-rpi-b.dts b/arch/arm/boot/dts/bcm2708-rpi-b.dts +new file mode 100644 +index 0000000..8474834 +--- /dev/null ++++ b/arch/arm/boot/dts/bcm2708-rpi-b.dts +@@ -0,0 +1,144 @@ ++/dts-v1/; ++ ++#include "bcm2708.dtsi" ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ model = "Raspberry Pi Model B"; ++}; ++ ++&gpio { ++ sdhost_pins: sdhost_pins { ++ brcm,pins = <48 49 50 51 52 53>; ++ brcm,function = <4>; /* alt0 */ ++ }; ++ ++ spi0_pins: spi0_pins { ++ brcm,pins = <9 10 11>; ++ brcm,function = <4>; /* alt0 */ ++ }; ++ ++ spi0_cs_pins: spi0_cs_pins { ++ brcm,pins = <8 7>; ++ brcm,function = <1>; /* output */ ++ }; ++ ++ i2c0_pins: i2c0 { ++ brcm,pins = <0 1>; ++ brcm,function = <4>; ++ }; ++ ++ i2c1_pins: i2c1 { ++ brcm,pins = <2 3>; ++ brcm,function = <4>; ++ }; ++ ++ i2s_pins: i2s { ++ brcm,pins = <28 29 30 31>; ++ brcm,function = <6>; /* alt2 */ ++ }; ++}; ++ ++&sdhost { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&sdhost_pins>; ++ bus-width = <4>; ++ status = "okay"; ++}; ++ ++&fb { ++ status = "okay"; ++}; ++ ++&uart0 { ++ status = "okay"; ++}; ++ ++&spi0 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&spi0_pins &spi0_cs_pins>; ++ cs-gpios = <&gpio 8 1>, <&gpio 7 1>; ++ ++ spidev0: spidev@0{ ++ compatible = "spidev"; ++ reg = <0>; /* CE0 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ }; ++ ++ spidev1: spidev@1{ ++ compatible = "spidev"; ++ reg = <1>; /* CE1 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ }; ++}; ++ ++&i2c0 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2c0_pins>; ++ clock-frequency = <100000>; ++}; ++ ++&i2c1 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2c1_pins>; ++ clock-frequency = <100000>; ++}; ++ ++&i2c2 { ++ clock-frequency = <100000>; ++}; ++ ++&i2s { ++ #sound-dai-cells = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2s_pins>; ++}; ++ ++&random { ++ status = "okay"; ++}; ++ ++&leds { ++ act_led: act { ++ label = "led0"; ++ linux,default-trigger = "mmc0"; ++ gpios = <&gpio 16 1>; ++ }; ++}; ++ ++&hdmi { ++ hpd-gpios = <&gpio 46 GPIO_ACTIVE_HIGH>; ++}; ++ ++/ { ++ __overrides__ { ++ uart0 = <&uart0>,"status"; ++ uart0_clkrate = <&clk_uart0>,"clock-frequency:0"; ++ uart1 = <&uart1>,"status"; ++ i2s = <&i2s>,"status"; ++ spi = <&spi0>,"status"; ++ i2c0 = <&i2c0>,"status"; ++ i2c1 = <&i2c1>,"status"; ++ i2c2_iknowwhatimdoing = <&i2c2>,"status"; ++ i2c0_baudrate = <&i2c0>,"clock-frequency:0"; ++ i2c1_baudrate = <&i2c1>,"clock-frequency:0"; ++ i2c2_baudrate = <&i2c2>,"clock-frequency:0"; ++ core_freq = <&clk_core>,"clock-frequency:0"; ++ ++ act_led_gpio = <&act_led>,"gpios:4"; ++ act_led_activelow = <&act_led>,"gpios:8"; ++ act_led_trigger = <&act_led>,"linux,default-trigger"; ++ ++ audio = <&audio>,"status"; ++ watchdog = <&watchdog>,"status"; ++ random = <&random>,"status"; ++ sd_overclock = <&sdhost>,"brcm,overclock-50:0"; ++ sd_force_pio = <&sdhost>,"brcm,force-pio?"; ++ sd_pio_limit = <&sdhost>,"brcm,pio-limit:0"; ++ sd_debug = <&sdhost>,"brcm,debug"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/bcm2708-rpi-cm.dts b/arch/arm/boot/dts/bcm2708-rpi-cm.dts +new file mode 100755 +index 0000000..cd0e1ac +--- /dev/null ++++ b/arch/arm/boot/dts/bcm2708-rpi-cm.dts +@@ -0,0 +1,102 @@ ++/dts-v1/; ++ ++#include "bcm2708-rpi-cm.dtsi" ++ ++/ { ++ model = "Raspberry Pi Compute Module"; ++}; ++ ++&uart0 { ++ status = "okay"; ++}; ++ ++&gpio { ++ spi0_pins: spi0_pins { ++ brcm,pins = <9 10 11>; ++ brcm,function = <4>; /* alt0 */ ++ }; ++ ++ spi0_cs_pins: spi0_cs_pins { ++ brcm,pins = <8 7>; ++ brcm,function = <1>; /* output */ ++ }; ++ ++ i2c0_pins: i2c0 { ++ brcm,pins = <0 1>; ++ brcm,function = <4>; ++ }; ++ ++ i2c1_pins: i2c1 { ++ brcm,pins = <2 3>; ++ brcm,function = <4>; ++ }; ++ ++ i2s_pins: i2s { ++ brcm,pins = <18 19 20 21>; ++ brcm,function = <4>; /* alt0 */ ++ }; ++}; ++ ++&spi0 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&spi0_pins &spi0_cs_pins>; ++ cs-gpios = <&gpio 8 1>, <&gpio 7 1>; ++ ++ spidev0: spidev@0{ ++ compatible = "spidev"; ++ reg = <0>; /* CE0 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ }; ++ ++ spidev1: spidev@1{ ++ compatible = "spidev"; ++ reg = <1>; /* CE1 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ }; ++}; ++ ++&i2c0 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2c0_pins>; ++ clock-frequency = <100000>; ++}; ++ ++&i2c1 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2c1_pins>; ++ clock-frequency = <100000>; ++}; ++ ++&i2c2 { ++ clock-frequency = <100000>; ++}; ++ ++&i2s { ++ #sound-dai-cells = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2s_pins>; ++}; ++ ++&random { ++ status = "okay"; ++}; ++ ++/ { ++ __overrides__ { ++ uart0 = <&uart0>,"status"; ++ uart0_clkrate = <&clk_uart0>,"clock-frequency:0"; ++ uart1 = <&uart1>,"status"; ++ i2s = <&i2s>,"status"; ++ spi = <&spi0>,"status"; ++ i2c0 = <&i2c0>,"status"; ++ i2c1 = <&i2c1>,"status"; ++ i2c2_iknowwhatimdoing = <&i2c2>,"status"; ++ i2c0_baudrate = <&i2c0>,"clock-frequency:0"; ++ i2c1_baudrate = <&i2c1>,"clock-frequency:0"; ++ i2c2_baudrate = <&i2c2>,"clock-frequency:0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi b/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi +new file mode 100644 +index 0000000..90e330d +--- /dev/null ++++ b/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi +@@ -0,0 +1,52 @@ ++#include "bcm2708.dtsi" ++ ++&gpio { ++ sdhost_pins: sdhost_pins { ++ brcm,pins = <48 49 50 51 52 53>; ++ brcm,function = <4>; /* alt0 */ ++ }; ++}; ++ ++&gpio { ++ mmc_pins: mmc_pins { ++ brcm,pins = <48 49 50 51 52 53>; ++ brcm,function = <7>; /* alt3 */ ++ }; ++}; ++ ++&leds { ++ act_led: act { ++ label = "led0"; ++ linux,default-trigger = "mmc0"; ++ gpios = <&gpio 47 0>; ++ }; ++}; ++ ++ ++&mmc { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&mmc_pins>; ++ non-removable; ++ bus-width = <4>; ++ status = "okay"; ++ brcm,overclock-50 = <0>; ++}; ++ ++&fb { ++ status = "okay"; ++}; ++ ++/ { ++ __overrides__ { ++ core_freq = <&clk_core>,"clock-frequency:0"; ++ ++ act_led_gpio = <&act_led>,"gpios:4"; ++ act_led_activelow = <&act_led>,"gpios:8"; ++ act_led_trigger = <&act_led>,"linux,default-trigger"; ++ ++ audio = <&audio>,"status"; ++ watchdog = <&watchdog>,"status"; ++ random = <&random>,"status"; ++ sd_overclock = <&mmc>,"brcm,overclock-50:0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/bcm2708.dtsi b/arch/arm/boot/dts/bcm2708.dtsi +new file mode 100644 +index 0000000..f5a44cd +--- /dev/null ++++ b/arch/arm/boot/dts/bcm2708.dtsi +@@ -0,0 +1,40 @@ ++#include "bcm2708_common.dtsi" ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ model = "BCM2708"; ++ ++ chosen { ++ /* No padding required - the boot loader can do that. */ ++ bootargs = ""; ++ }; ++ ++ soc { ++ ranges = <0x7e000000 0x20000000 0x01000000>; ++ ++ timer@7e003000 { ++ compatible = "brcm,bcm2835-system-timer"; ++ reg = <0x7e003000 0x1000>; ++ interrupts = <1 0>, <1 1>, <1 2>, <1 3>; ++ clock-frequency = <1000000>; ++ }; ++ ++ arm-pmu { ++ compatible = "arm,arm1176-pmu"; ++ }; ++ ++ gpiomem { ++ compatible = "brcm,bcm2835-gpiomem"; ++ reg = <0x7e200000 0x1000>; ++ status = "okay"; ++ }; ++ }; ++}; ++ ++&intc { ++ compatible = "brcm,bcm2835-armctrl-ic"; ++}; ++ ++&watchdog { ++ status = "okay"; ++}; +diff --git a/arch/arm/boot/dts/bcm2708_common.dtsi b/arch/arm/boot/dts/bcm2708_common.dtsi +new file mode 100644 +index 0000000..6ea37c5 +--- /dev/null ++++ b/arch/arm/boot/dts/bcm2708_common.dtsi +@@ -0,0 +1,438 @@ ++#include "dt-bindings/clock/bcm2835.h" ++#include <dt-bindings/clock/bcm2835-aux.h> ++#include "dt-bindings/power/raspberrypi-power.h" ++#include "dt-bindings/gpio/gpio.h" ++#include "skeleton.dtsi" ++ ++/ { ++ interrupt-parent = <&intc>; ++ ++ aliases { ++ audio = &audio; ++ aux = &aux; ++ sound = &sound; ++ soc = &soc; ++ dma = &dma; ++ intc = &intc; ++ watchdog = &watchdog; ++ random = &random; ++ mailbox = &mailbox; ++ gpio = &gpio; ++ uart0 = &uart0; ++ sdhost = &sdhost; ++ i2s = &i2s; ++ spi0 = &spi0; ++ i2c0 = &i2c0; ++ uart1 = &uart1; ++ spi1 = &spi1; ++ spi2 = &spi2; ++ mmc = &mmc; ++ i2c1 = &i2c1; ++ i2c2 = &i2c2; ++ usb = &usb; ++ leds = &leds; ++ fb = &fb; ++ vchiq = &vchiq; ++ thermal = &thermal; ++ clocks = &clocks; ++ }; ++ ++ soc: soc { ++ compatible = "simple-bus"; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ++ dma: dma@7e007000 { ++ compatible = "brcm,bcm2835-dma"; ++ reg = <0x7e007000 0xf00>; ++ interrupts = <1 16>, ++ <1 17>, ++ <1 18>, ++ <1 19>, ++ <1 20>, ++ <1 21>, ++ <1 22>, ++ <1 23>, ++ <1 24>, ++ <1 25>, ++ <1 26>, ++ <1 27>; ++ ++ #dma-cells = <1>; ++ brcm,dma-channel-mask = <0x0f35>; ++ }; ++ ++ intc: interrupt-controller@7e00b200 { ++ compatible = "brcm,bcm2708-armctrl-ic"; ++ reg = <0x7e00b200 0x200>; ++ interrupt-controller; ++ #interrupt-cells = <2>; ++ }; ++ ++ mailbox: mailbox@7e00b800 { ++ compatible = "brcm,bcm2835-mbox"; ++ reg = <0x7e00b880 0x40>; ++ interrupts = <0 1>; ++ #mbox-cells = <0>; ++ }; ++ ++ watchdog: watchdog@7e100000 { ++ compatible = "brcm,bcm2835-pm-wdt"; ++ reg = <0x7e100000 0x28>; ++ status = "disabled"; ++ }; ++ ++ cprman: cprman@7e101000 { ++ compatible = "brcm,bcm2835-cprman"; ++ #clock-cells = <1>; ++ reg = <0x7e101000 0x2000>; ++ ++ /* CPRMAN derives everything from the platform's ++ * oscillator. ++ */ ++ clocks = <&clk_osc>; ++ status = "disabled"; ++ }; ++ ++ random: rng@7e104000 { ++ compatible = "brcm,bcm2835-rng"; ++ reg = <0x7e104000 0x10>; ++ status = "disabled"; ++ }; ++ ++ gpio: gpio@7e200000 { ++ compatible = "brcm,bcm2835-gpio"; ++ reg = <0x7e200000 0xb4>; ++ interrupts = <2 17>, <2 18>; ++ ++ gpio-controller; ++ #gpio-cells = <2>; ++ ++ interrupt-controller; ++ #interrupt-cells = <2>; ++ }; ++ ++ uart0: uart@7e201000 { ++ compatible = "arm,pl011", "arm,primecell"; ++ reg = <0x7e201000 0x1000>; ++ interrupts = <2 25>; ++ clocks = <&clk_uart0 &clk_apb_p>; ++ clock-names = "uartclk","apb_pclk"; ++ arm,primecell-periphid = <0x00241011>; // For an explanation, see ++ // https://github.com/raspberrypi/linux/commit/13731d862cf5219216533a3b0de052cee4cc5038 ++ status = "disabled"; ++ }; ++ ++ sdhost: sdhost@7e202000 { ++ compatible = "brcm,bcm2835-sdhost"; ++ reg = <0x7e202000 0x100>; ++ interrupts = <2 24>; ++ clocks = <&clk_core>; ++ dmas = <&dma 13>; ++ dma-names = "rx-tx"; ++ brcm,overclock-50 = <0>; ++ brcm,pio-limit = <1>; ++ status = "disabled"; ++ }; ++ ++ i2s: i2s@7e203000 { ++ compatible = "brcm,bcm2835-i2s"; ++ #sound-dai-cells = <0>; ++ reg = <0x7e203000 0x24>, ++ <0x7e101098 0x08>; ++ ++ dmas = <&dma 2>, <&dma 3>; ++ dma-names = "tx", "rx"; ++ status = "disabled"; ++ }; ++ ++ spi0: spi@7e204000 { ++ compatible = "brcm,bcm2835-spi"; ++ reg = <0x7e204000 0x1000>; ++ interrupts = <2 22>; ++ clocks = <&clk_core>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "disabled"; ++ /* the dma channels */ ++ dmas = <&dma 6>, <&dma 7>; ++ dma-names = "tx", "rx"; ++ /* the chipselects used - <0> means native GPIO ++ * add more gpios if necessary as <&gpio 6 1> ++ * (but do not forget to make them output!) ++ */ ++ cs-gpios = <0>, <0>; ++ }; ++ ++ i2c0: i2c@7e205000 { ++ compatible = "brcm,bcm2708-i2c"; ++ reg = <0x7e205000 0x1000>; ++ interrupts = <2 21>; ++ clocks = <&clk_core>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "disabled"; ++ }; ++ ++ pixelvalve0: pixelvalve@7e206000 { ++ compatible = "brcm,bcm2835-pixelvalve0"; ++ reg = <0x7e206000 0x100>; ++ status = "disabled"; ++ }; ++ ++ pixelvalve1: pixelvalve@7e207000 { ++ compatible = "brcm,bcm2835-pixelvalve1"; ++ reg = <0x7e207000 0x100>; ++ status = "disabled"; ++ }; ++ ++ pwm: pwm@7e20c000 { ++ compatible = "brcm,bcm2835-pwm"; ++ reg = <0x7e20c000 0x28>; ++ clocks = <&clk_pwm>; ++ #pwm-cells = <2>; ++ status = "disabled"; ++ }; ++ ++ aux: aux@0x7e215004 { ++ compatible = "brcm,bcm2835-aux"; ++ #clock-cells = <1>; ++ reg = <0x7e215000 0x8>; ++ clocks = <&clk_core>; ++ status = "disabled"; ++ }; ++ ++ uart1: uart@7e215040 { ++ compatible = "brcm,bcm2835-aux-uart", "ns16550"; ++ reg = <0x7e215040 0x40>; ++ interrupts = <1 29>; ++ clocks = <&clk_uart1>; ++ reg-shift = <2>; ++ no-loopback-test; ++ status = "disabled"; ++ }; ++ ++ spi1: spi@7e215080 { ++ compatible = "brcm,bcm2835-aux-spi"; ++ reg = <0x7e215080 0x40>, <0x7e215000 0x8>; ++ interrupts = <1 29>; ++ clocks = <&aux BCM2835_AUX_CLOCK_SPI1>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "disabled"; ++ }; ++ ++ spi2: spi@7e2150C0 { ++ compatible = "brcm,bcm2835-aux-spi"; ++ reg = <0x7e2150C0 0x40>, <0x7e215000 0x8>; ++ interrupts = <1 29>; ++ clocks = <&aux BCM2835_AUX_CLOCK_SPI2>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "disabled"; ++ }; ++ ++ mmc: mmc@7e300000 { ++ compatible = "brcm,bcm2835-mmc"; ++ reg = <0x7e300000 0x100>; ++ interrupts = <2 30>; ++ clocks = <&clk_mmc>; ++ dmas = <&dma 11>; ++ dma-names = "rx-tx"; ++ brcm,overclock-50 = <0>; ++ status = "disabled"; ++ }; ++ ++ hvs: hvs@7e400000 { ++ compatible = "brcm,bcm2835-hvs"; ++ reg = <0x7e400000 0x6000>; ++ status = "disabled"; ++ }; ++ ++ i2c1: i2c@7e804000 { ++ compatible = "brcm,bcm2708-i2c"; ++ reg = <0x7e804000 0x1000>; ++ interrupts = <2 21>; ++ clocks = <&clk_core>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "disabled"; ++ }; ++ ++ i2c2: i2c@7e805000 { ++ // Beware - this is shared with the HDMI module. ++ // Careless use may break (really) your display. ++ // Caveat emptor. ++ compatible = "brcm,bcm2708-i2c"; ++ reg = <0x7e805000 0x1000>; ++ interrupts = <2 21>; ++ clocks = <&clk_core>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "disabled"; ++ }; ++ ++ smi: smi@7e600000 { ++ compatible = "brcm,bcm2835-smi"; ++ reg = <0x7e600000 0x44>, <0x7e1010b0 0x8>; ++ interrupts = <2 16>; ++ brcm,smi-clock-source = <6>; ++ brcm,smi-clock-divisor = <4>; ++ dmas = <&dma 4>; ++ dma-names = "rx-tx"; ++ status = "disabled"; ++ }; ++ ++ pixelvalve2: pixelvalve@7e807000 { ++ compatible = "brcm,bcm2835-pixelvalve2"; ++ reg = <0x7e807000 0x100>; ++ status = "disabled"; ++ }; ++ ++ hdmi: hdmi@7e902000 { ++ compatible = "brcm,bcm2835-hdmi"; ++ reg = <0x7e902000 0x600>, ++ <0x7e808000 0x100>; ++ ddc = <&i2c2>; ++ hpd-gpios = <&gpio 46 GPIO_ACTIVE_HIGH>; ++ clocks = <&cprman BCM2835_PLLH_PIX>, ++ <&cprman BCM2835_CLOCK_HSM>; ++ clock-names = "pixel", "hdmi"; ++ power-domains = <&power RPI_POWER_DOMAIN_HDMI>; ++ status = "disabled"; ++ }; ++ ++ usb: usb@7e980000 { ++ compatible = "brcm,bcm2708-usb"; ++ reg = <0x7e980000 0x10000>, ++ <0x7e006000 0x1000>; ++ interrupts = <2 0>, ++ <1 9>; ++ }; ++ ++ v3d: v3d@7ec00000 { ++ compatible = "brcm,vc4-v3d"; ++ reg = <0x7ec00000 0x1000>; ++ status = "disabled"; ++ }; ++ ++ firmware: firmware { ++ compatible = "raspberrypi,bcm2835-firmware"; ++ mboxes = <&mailbox>; ++ }; ++ ++ power: power { ++ compatible = "raspberrypi,bcm2835-power"; ++ firmware = <&firmware>; ++ #power-domain-cells = <1>; ++ }; ++ ++ leds: leds { ++ compatible = "gpio-leds"; ++ }; ++ ++ fb: fb { ++ compatible = "brcm,bcm2708-fb"; ++ firmware = <&firmware>; ++ status = "disabled"; ++ }; ++ ++ vchiq: vchiq { ++ compatible = "brcm,bcm2835-vchiq"; ++ reg = <0x7e00b840 0xf>; ++ interrupts = <0 2>; ++ cache-line-size = <32>; ++ firmware = <&firmware>; ++ }; ++ ++ thermal: thermal { ++ compatible = "brcm,bcm2835-thermal"; ++ firmware = <&firmware>; ++ }; ++ ++ gpu: gpu { ++ compatible = "brcm,bcm2835-vc4"; ++ status = "disabled"; ++ }; ++ ++ /* Onboard audio */ ++ audio: audio { ++ compatible = "brcm,bcm2835-audio"; ++ brcm,pwm-channels = <8>; ++ status = "disabled"; ++ }; ++ ++ /* External sound card */ ++ sound: sound { ++ status = "disabled"; ++ }; ++ }; ++ ++ clocks: clocks { ++ compatible = "simple-bus"; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ clk_core: clock@0 { ++ compatible = "fixed-clock"; ++ reg = <0>; ++ #clock-cells = <0>; ++ clock-output-names = "core"; ++ clock-frequency = <250000000>; ++ }; ++ ++ clk_mmc: clock@1 { ++ compatible = "fixed-clock"; ++ reg = <1>; ++ #clock-cells = <0>; ++ clock-output-names = "mmc"; ++ clock-frequency = <250000000>; ++ }; ++ ++ clk_uart0: clock@2 { ++ compatible = "fixed-clock"; ++ reg = <2>; ++ #clock-cells = <0>; ++ clock-output-names = "uart0_pclk"; ++ clock-frequency = <3000000>; ++ }; ++ ++ clk_apb_p: clock@3 { ++ compatible = "fixed-clock"; ++ reg = <3>; ++ #clock-cells = <0>; ++ clock-output-names = "apb_pclk"; ++ clock-frequency = <126000000>; ++ }; ++ ++ clk_pwm: clock@4 { ++ compatible = "fixed-clock"; ++ reg = <4>; ++ #clock-cells = <0>; ++ clock-output-names = "pwm"; ++ clock-frequency = <100000000>; ++ }; ++ ++ clk_uart1: clock@5 { ++ compatible = "fixed-factor-clock"; ++ reg = <5>; ++ clocks = <&clk_core>; ++ #clock-cells = <0>; ++ clock-div = <1>; ++ clock-mult = <2>; ++ }; ++ ++ /* The oscillator is the root of the clock tree. */ ++ clk_osc: clock@6 { ++ compatible = "fixed-clock"; ++ reg = <6>; ++ #clock-cells = <0>; ++ clock-output-names = "osc"; ++ clock-frequency = <19200000>; ++ }; ++ }; ++ ++ __overrides__ { ++ cache_line_size = <&vchiq>, "cache-line-size:0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/bcm2709-rpi-2-b.dts b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts +new file mode 100644 +index 0000000..5e23c04 +--- /dev/null ++++ b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts +@@ -0,0 +1,154 @@ ++/dts-v1/; ++ ++#include "bcm2709.dtsi" ++ ++/ { ++ compatible = "brcm,bcm2709"; ++ model = "Raspberry Pi 2 Model B"; ++}; ++ ++&gpio { ++ sdhost_pins: sdhost_pins { ++ brcm,pins = <48 49 50 51 52 53>; ++ brcm,function = <4>; /* alt0 */ ++ }; ++ ++ spi0_pins: spi0_pins { ++ brcm,pins = <9 10 11>; ++ brcm,function = <4>; /* alt0 */ ++ }; ++ ++ spi0_cs_pins: spi0_cs_pins { ++ brcm,pins = <8 7>; ++ brcm,function = <1>; /* output */ ++ }; ++ ++ i2c0_pins: i2c0 { ++ brcm,pins = <0 1>; ++ brcm,function = <4>; ++ }; ++ ++ i2c1_pins: i2c1 { ++ brcm,pins = <2 3>; ++ brcm,function = <4>; ++ }; ++ ++ i2s_pins: i2s { ++ brcm,pins = <18 19 20 21>; ++ brcm,function = <4>; /* alt0 */ ++ }; ++}; ++ ++&sdhost { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&sdhost_pins>; ++ bus-width = <4>; ++ status = "okay"; ++}; ++ ++&fb { ++ status = "okay"; ++}; ++ ++&uart0 { ++ status = "okay"; ++}; ++ ++&spi0 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&spi0_pins &spi0_cs_pins>; ++ cs-gpios = <&gpio 8 1>, <&gpio 7 1>; ++ ++ spidev0: spidev@0{ ++ compatible = "spidev"; ++ reg = <0>; /* CE0 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ }; ++ ++ spidev1: spidev@1{ ++ compatible = "spidev"; ++ reg = <1>; /* CE1 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ }; ++}; ++ ++&i2c0 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2c0_pins>; ++ clock-frequency = <100000>; ++}; ++ ++&i2c1 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2c1_pins>; ++ clock-frequency = <100000>; ++}; ++ ++&i2c2 { ++ clock-frequency = <100000>; ++}; ++ ++&i2s { ++ #sound-dai-cells = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2s_pins>; ++}; ++ ++&random { ++ status = "okay"; ++}; ++ ++&leds { ++ act_led: act { ++ label = "led0"; ++ linux,default-trigger = "mmc0"; ++ gpios = <&gpio 47 0>; ++ }; ++ ++ pwr_led: pwr { ++ label = "led1"; ++ linux,default-trigger = "input"; ++ gpios = <&gpio 35 0>; ++ }; ++}; ++ ++&hdmi { ++ hpd-gpios = <&gpio 46 GPIO_ACTIVE_LOW>; ++}; ++ ++/ { ++ __overrides__ { ++ uart0 = <&uart0>,"status"; ++ uart0_clkrate = <&clk_uart0>,"clock-frequency:0"; ++ uart1 = <&uart1>,"status"; ++ i2s = <&i2s>,"status"; ++ spi = <&spi0>,"status"; ++ i2c0 = <&i2c0>,"status"; ++ i2c1 = <&i2c1>,"status"; ++ i2c2_iknowwhatimdoing = <&i2c2>,"status"; ++ i2c0_baudrate = <&i2c0>,"clock-frequency:0"; ++ i2c1_baudrate = <&i2c1>,"clock-frequency:0"; ++ i2c2_baudrate = <&i2c2>,"clock-frequency:0"; ++ core_freq = <&clk_core>,"clock-frequency:0"; ++ ++ act_led_gpio = <&act_led>,"gpios:4"; ++ act_led_activelow = <&act_led>,"gpios:8"; ++ act_led_trigger = <&act_led>,"linux,default-trigger"; ++ ++ pwr_led_gpio = <&pwr_led>,"gpios:4"; ++ pwr_led_activelow = <&pwr_led>,"gpios:8"; ++ pwr_led_trigger = <&pwr_led>,"linux,default-trigger"; ++ ++ audio = <&audio>,"status"; ++ watchdog = <&watchdog>,"status"; ++ random = <&random>,"status"; ++ sd_overclock = <&sdhost>,"brcm,overclock-50:0"; ++ sd_force_pio = <&sdhost>,"brcm,force-pio?"; ++ sd_pio_limit = <&sdhost>,"brcm,pio-limit:0"; ++ sd_debug = <&sdhost>,"brcm,debug"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/bcm2709.dtsi b/arch/arm/boot/dts/bcm2709.dtsi +new file mode 100644 +index 0000000..a8cfd7c +--- /dev/null ++++ b/arch/arm/boot/dts/bcm2709.dtsi +@@ -0,0 +1,102 @@ ++#include "bcm2708_common.dtsi" ++ ++/ { ++ compatible = "brcm,bcm2709"; ++ model = "BCM2709"; ++ ++ chosen { ++ /* No padding required - the boot loader can do that. */ ++ bootargs = ""; ++ }; ++ ++ soc { ++ ranges = <0x7e000000 0x3f000000 0x01000000>, ++ <0x40000000 0x40000000 0x00040000>; ++ ++ local_intc: local_intc { ++ compatible = "brcm,bcm2836-l1-intc"; ++ reg = <0x40000000 0x100>; ++ interrupt-controller; ++ #interrupt-cells = <1>; ++ interrupt-parent = <&local_intc>; ++ }; ++ ++ arm-pmu { ++ compatible = "arm,cortex-a7-pmu"; ++ interrupt-parent = <&local_intc>; ++ interrupts = <9>; ++ }; ++ ++ gpiomem { ++ compatible = "brcm,bcm2835-gpiomem"; ++ reg = <0x7e200000 0x1000>; ++ status = "okay"; ++ }; ++ ++ timer { ++ compatible = "arm,armv7-timer"; ++ clock-frequency = <19200000>; ++ interrupt-parent = <&local_intc>; ++ interrupts = <0>, // PHYS_SECURE_PPI ++ <1>, // PHYS_NONSECURE_PPI ++ <3>, // VIRT_PPI ++ <2>; // HYP_PPI ++ always-on; ++ }; ++ ++ syscon@40000000 { ++ compatible = "brcm,bcm2836-arm-local", "syscon"; ++ reg = <0x40000000 0x100>; ++ }; ++ }; ++ ++ cpus: cpus { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ v7_cpu0: cpu@0 { ++ device_type = "cpu"; ++ compatible = "arm,cortex-a7"; ++ reg = <0xf00>; ++ clock-frequency = <800000000>; ++ }; ++ ++ v7_cpu1: cpu@1 { ++ device_type = "cpu"; ++ compatible = "arm,cortex-a7"; ++ reg = <0xf01>; ++ clock-frequency = <800000000>; ++ }; ++ ++ v7_cpu2: cpu@2 { ++ device_type = "cpu"; ++ compatible = "arm,cortex-a7"; ++ reg = <0xf02>; ++ clock-frequency = <800000000>; ++ }; ++ ++ v7_cpu3: cpu@3 { ++ device_type = "cpu"; ++ compatible = "arm,cortex-a7"; ++ reg = <0xf03>; ++ clock-frequency = <800000000>; ++ }; ++ }; ++ ++ __overrides__ { ++ arm_freq = <&v7_cpu0>, "clock-frequency:0", ++ <&v7_cpu1>, "clock-frequency:0", ++ <&v7_cpu2>, "clock-frequency:0", ++ <&v7_cpu3>, "clock-frequency:0"; ++ }; ++}; ++ ++&watchdog { ++ status = "okay"; ++}; ++ ++&intc { ++ compatible = "brcm,bcm2836-armctrl-ic"; ++ interrupt-parent = <&local_intc>; ++ interrupts = <8>; ++}; +diff --git a/arch/arm/boot/dts/bcm2710-rpi-3-b.dts b/arch/arm/boot/dts/bcm2710-rpi-3-b.dts +new file mode 100644 +index 0000000..0979a27 +--- /dev/null ++++ b/arch/arm/boot/dts/bcm2710-rpi-3-b.dts +@@ -0,0 +1,201 @@ ++/dts-v1/; ++ ++#include "bcm2710.dtsi" ++ ++/ { ++ compatible = "brcm,bcm2710","brcm,bcm2709"; ++ model = "Raspberry Pi 3 Model B"; ++}; ++ ++&gpio { ++ sdhost_pins: sdhost_pins { ++ brcm,pins = <48 49 50 51 52 53>; ++ brcm,function = <4>; /* alt0 */ ++ }; ++ ++ spi0_pins: spi0_pins { ++ brcm,pins = <9 10 11>; ++ brcm,function = <4>; /* alt0 */ ++ }; ++ ++ spi0_cs_pins: spi0_cs_pins { ++ brcm,pins = <8 7>; ++ brcm,function = <1>; /* output */ ++ }; ++ ++ i2c0_pins: i2c0 { ++ brcm,pins = <0 1>; ++ brcm,function = <4>; ++ }; ++ ++ i2c1_pins: i2c1 { ++ brcm,pins = <2 3>; ++ brcm,function = <4>; ++ }; ++ ++ i2s_pins: i2s { ++ brcm,pins = <18 19 20 21>; ++ brcm,function = <4>; /* alt0 */ ++ }; ++ ++ sdio_pins: sdio_pins { ++ brcm,pins = <34 35 36 37 38 39>; ++ brcm,function = <7>; // alt3 = SD1 ++ brcm,pull = <0 2 2 2 2 2>; ++ }; ++ ++ bt_pins: bt_pins { ++ brcm,pins = <43>; ++ brcm,function = <4>; /* alt0:GPCLK2 */ ++ brcm,pull = <0>; ++ }; ++ ++ uart0_pins: uart0_pins { ++ brcm,pins = <32 33>; ++ brcm,function = <7>; /* alt3=UART0 */ ++ brcm,pull = <0 2>; ++ }; ++ ++ uart1_pins: uart1_pins { ++ brcm,pins; ++ brcm,function; ++ brcm,pull; ++ }; ++}; ++ ++&sdhost { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&sdhost_pins>; ++ bus-width = <4>; ++ status = "okay"; ++}; ++ ++&mmc { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&sdio_pins>; ++ non-removable; ++ bus-width = <4>; ++ status = "okay"; ++ brcm,overclock-50 = <0>; ++}; ++ ++&soc { ++ virtgpio: virtgpio { ++ compatible = "brcm,bcm2835-virtgpio"; ++ gpio-controller; ++ #gpio-cells = <2>; ++ firmware = <&firmware>; ++ status = "okay"; ++ }; ++}; ++ ++&fb { ++ status = "okay"; ++}; ++ ++&uart0 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&uart0_pins &bt_pins>; ++ status = "okay"; ++}; ++ ++&uart1 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&uart1_pins>; ++ status = "okay"; ++}; ++ ++&spi0 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&spi0_pins &spi0_cs_pins>; ++ cs-gpios = <&gpio 8 1>, <&gpio 7 1>; ++ ++ spidev0: spidev@0{ ++ compatible = "spidev"; ++ reg = <0>; /* CE0 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ }; ++ ++ spidev1: spidev@1{ ++ compatible = "spidev"; ++ reg = <1>; /* CE1 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ }; ++}; ++ ++&i2c0 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2c0_pins>; ++ clock-frequency = <100000>; ++}; ++ ++&i2c1 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2c1_pins>; ++ clock-frequency = <100000>; ++}; ++ ++&i2c2 { ++ clock-frequency = <100000>; ++}; ++ ++&i2s { ++ #sound-dai-cells = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2s_pins>; ++}; ++ ++&random { ++ status = "okay"; ++}; ++ ++&leds { ++ act_led: act { ++ label = "led0"; ++ linux,default-trigger = "mmc0"; ++ gpios = <&virtgpio 0 0>; ++ }; ++}; ++ ++&hdmi { ++ hpd-gpios = <&gpio 46 GPIO_ACTIVE_LOW>; ++}; ++ ++/ { ++ chosen { ++ bootargs = "8250.nr_uarts=1"; ++ }; ++}; ++ ++/ { ++ __overrides__ { ++ uart0 = <&uart0>,"status"; ++ uart0_clkrate = <&clk_uart0>,"clock-frequency:0"; ++ uart1 = <&uart1>,"status"; ++ i2s = <&i2s>,"status"; ++ spi = <&spi0>,"status"; ++ i2c0 = <&i2c0>,"status"; ++ i2c1 = <&i2c1>,"status"; ++ i2c2_iknowwhatimdoing = <&i2c2>,"status"; ++ i2c0_baudrate = <&i2c0>,"clock-frequency:0"; ++ i2c1_baudrate = <&i2c1>,"clock-frequency:0"; ++ i2c2_baudrate = <&i2c2>,"clock-frequency:0"; ++ core_freq = <&clk_core>,"clock-frequency:0"; ++ ++ act_led_gpio = <&act_led>,"gpios:4"; ++ act_led_activelow = <&act_led>,"gpios:8"; ++ act_led_trigger = <&act_led>,"linux,default-trigger"; ++ ++ audio = <&audio>,"status"; ++ watchdog = <&watchdog>,"status"; ++ random = <&random>,"status"; ++ sd_overclock = <&sdhost>,"brcm,overclock-50:0"; ++ sd_force_pio = <&sdhost>,"brcm,force-pio?"; ++ sd_pio_limit = <&sdhost>,"brcm,pio-limit:0"; ++ sd_debug = <&sdhost>,"brcm,debug"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/bcm2710.dtsi b/arch/arm/boot/dts/bcm2710.dtsi +new file mode 100644 +index 0000000..1a48686 +--- /dev/null ++++ b/arch/arm/boot/dts/bcm2710.dtsi +@@ -0,0 +1,102 @@ ++#include "bcm2708_common.dtsi" ++ ++/ { ++ compatible = "brcm,bcm2710","brcm,bcm2709"; ++ model = "BCM2710"; ++ ++ chosen { ++ /* No padding required - the boot loader can do that. */ ++ bootargs = ""; ++ }; ++ ++ soc { ++ ranges = <0x7e000000 0x3f000000 0x01000000>, ++ <0x40000000 0x40000000 0x00040000>; ++ ++ local_intc: local_intc { ++ compatible = "brcm,bcm2836-l1-intc"; ++ reg = <0x40000000 0x100>; ++ interrupt-controller; ++ #interrupt-cells = <1>; ++ interrupt-parent = <&local_intc>; ++ }; ++ ++ arm-pmu { ++ compatible = "arm,cortex-a7-pmu"; ++ interrupt-parent = <&local_intc>; ++ interrupts = <9>; ++ }; ++ ++ gpiomem { ++ compatible = "brcm,bcm2835-gpiomem"; ++ reg = <0x7e200000 0x1000>; ++ status = "okay"; ++ }; ++ ++ timer { ++ compatible = "arm,armv7-timer"; ++ clock-frequency = <19200000>; ++ interrupt-parent = <&local_intc>; ++ interrupts = <0>, // PHYS_SECURE_PPI ++ <1>, // PHYS_NONSECURE_PPI ++ <3>, // VIRT_PPI ++ <2>; // HYP_PPI ++ always-on; ++ }; ++ ++ syscon@40000000 { ++ compatible = "brcm,bcm2836-arm-local", "syscon"; ++ reg = <0x40000000 0x100>; ++ }; ++ }; ++ ++ cpus: cpus { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ v7_cpu0: cpu@0 { ++ device_type = "cpu"; ++ compatible = "arm,cortex-a7"; ++ reg = <0x000>; ++ clock-frequency = <800000000>; ++ }; ++ ++ v7_cpu1: cpu@1 { ++ device_type = "cpu"; ++ compatible = "arm,cortex-a7"; ++ reg = <0x001>; ++ clock-frequency = <800000000>; ++ }; ++ ++ v7_cpu2: cpu@2 { ++ device_type = "cpu"; ++ compatible = "arm,cortex-a7"; ++ reg = <0x002>; ++ clock-frequency = <800000000>; ++ }; ++ ++ v7_cpu3: cpu@3 { ++ device_type = "cpu"; ++ compatible = "arm,cortex-a7"; ++ reg = <0x003>; ++ clock-frequency = <800000000>; ++ }; ++ }; ++ ++ __overrides__ { ++ arm_freq = <&v7_cpu0>, "clock-frequency:0", ++ <&v7_cpu1>, "clock-frequency:0", ++ <&v7_cpu2>, "clock-frequency:0", ++ <&v7_cpu3>, "clock-frequency:0"; ++ }; ++}; ++ ++&watchdog { ++ status = "okay"; ++}; ++ ++&intc { ++ compatible = "brcm,bcm2836-armctrl-ic"; ++ interrupt-parent = <&local_intc>; ++ interrupts = <8>; ++}; +diff --git a/arch/arm/boot/dts/bcm2835-rpi-cm.dts b/arch/arm/boot/dts/bcm2835-rpi-cm.dts +new file mode 100644 +index 0000000..c6e6860 +--- /dev/null ++++ b/arch/arm/boot/dts/bcm2835-rpi-cm.dts +@@ -0,0 +1,93 @@ ++/dts-v1/; ++ ++#include "bcm2835-rpi-cm.dtsi" ++ ++/ { ++ model = "Raspberry Pi Compute Module"; ++}; ++ ++&uart0 { ++ status = "okay"; ++}; ++ ++&gpio { ++ spi0_pins: spi0_pins { ++ brcm,pins = <7 8 9 10 11>; ++ brcm,function = <4>; /* alt0 */ ++ }; ++ ++ i2c0_pins: i2c0 { ++ brcm,pins = <0 1>; ++ brcm,function = <4>; ++ }; ++ ++ i2c1_pins: i2c1 { ++ brcm,pins = <2 3>; ++ brcm,function = <4>; ++ }; ++ ++ i2s_pins: i2s { ++ brcm,pins = <18 19 20 21>; ++ brcm,function = <4>; /* alt0 */ ++ }; ++}; ++ ++&spi0 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&spi0_pins>; ++ ++ spidev@0{ ++ compatible = "spidev"; ++ reg = <0>; /* CE0 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ }; ++ ++ spidev@1{ ++ compatible = "spidev"; ++ reg = <1>; /* CE1 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ }; ++}; ++ ++&i2c0 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2c0_pins>; ++ clock-frequency = <100000>; ++}; ++ ++&i2c1 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2c1_pins>; ++ clock-frequency = <100000>; ++}; ++ ++&i2c2 { ++ clock-frequency = <100000>; ++}; ++ ++&i2s { ++ #sound-dai-cells = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2s_pins>; ++}; ++ ++/ { ++ __overrides__ { ++ uart0 = <&uart0>,"status"; ++ uart0_clkrate = <&clk_uart0>,"clock-frequency:0"; ++ uart1_clkrate = <&uart1>,"clock-frequency:0"; ++ i2s = <&i2s>,"status"; ++ spi = <&spi0>,"status"; ++ i2c0 = <&i2c0>,"status"; ++ i2c1 = <&i2c1>,"status"; ++ i2c2_iknowwhatimdoing = <&i2c2>,"status"; ++ i2c0_baudrate = <&i2c0>,"clock-frequency:0"; ++ i2c1_baudrate = <&i2c1>,"clock-frequency:0"; ++ i2c2_baudrate = <&i2c2>,"clock-frequency:0"; ++ core_freq = <&clk_core>,"clock-frequency:0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/bcm2835-rpi-cm.dtsi b/arch/arm/boot/dts/bcm2835-rpi-cm.dtsi +new file mode 100644 +index 0000000..9c4000f +--- /dev/null ++++ b/arch/arm/boot/dts/bcm2835-rpi-cm.dtsi +@@ -0,0 +1,30 @@ ++#include "bcm2835.dtsi" ++ ++&leds { ++ act_led: act { ++ label = "led0"; ++ linux,default-trigger = "mmc0"; ++ gpios = <&gpio 47 0>; ++ }; ++}; ++ ++&mmc { ++ status = "okay"; ++ bus-width = <4>; ++}; ++ ++&fb { ++ status = "okay"; ++}; ++ ++/ { ++ __overrides__ { ++ act_led_gpio = <&act_led>,"gpios:4"; ++ act_led_activelow = <&act_led>,"gpios:8"; ++ act_led_trigger = <&act_led>,"linux,default-trigger"; ++ ++ audio = <&audio>,"status"; ++ watchdog = <&watchdog>,"status"; ++ random = <&random>,"status"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/Makefile b/arch/arm/boot/dts/overlays/Makefile +new file mode 100644 +index 0000000..0adb5b9 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/Makefile +@@ -0,0 +1,99 @@ ++ifeq ($(CONFIG_OF),y) ++ ++# Overlays for the Raspberry Pi platform ++ ++ifeq ($(CONFIG_ARCH_BCM2708),y) ++ RPI_DT_OVERLAYS=y ++endif ++ifeq ($(CONFIG_ARCH_BCM2709),y) ++ RPI_DT_OVERLAYS=y ++endif ++ifeq ($(CONFIG_ARCH_BCM2835),y) ++ RPI_DT_OVERLAYS=y ++endif ++ ++dtbo-$(RPI_DT_OVERLAYS) += adau1977-adc.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += ads7846.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += akkordion-iqdacplus.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += at86rf233.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += audioinjector-wm8731-audio.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += bmp085_i2c-sensor.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += dpi24.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += dwc2.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += dwc-otg.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += dht11.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += enc28j60.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += gpio-ir.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += gpio-poweroff.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += hifiberry-amp.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += hifiberry-dac.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += hifiberry-dacplus.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += hifiberry-digi.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += hy28a.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += hy28b.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += i2c-rtc.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += i2c-gpio.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += i2c-mux.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += i2c-pwm-pca9685a.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += i2c0-bcm2708.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += i2c1-bcm2708.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += i2s-gpio28-31.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += i2s-mmap.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += iqaudio-dac.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += iqaudio-dacplus.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += justboom-dac.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += justboom-digi.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += lirc-rpi.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += mcp2515-can0.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += mcp2515-can1.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += mmc.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += mz61581.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += pi3-act-led.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += pi3-disable-bt.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += pi3-miniuart-bt.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += piscreen.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += piscreen2r.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += pitft22.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += pitft28-capacitive.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += pitft28-resistive.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += pps-gpio.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += pwm.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += pwm-2chan.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += qca7000.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += raspidac3.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += rpi-backlight.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += rpi-dac.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += rpi-display.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += rpi-ft5406.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += rpi-proto.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += rpi-sense.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += rra-digidac1-wm8741-audio.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += sdhost.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += sdio.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += sdio-1bit.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += sdtweak.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += smi-dev.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += smi-nand.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += smi.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += spi1-1cs.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += spi1-2cs.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += spi1-3cs.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += spi2-1cs.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += spi2-2cs.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += spi2-3cs.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += spi-gpio35-39.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += tinylcd35.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += uart1.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += vc4-kms-v3d.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += vga666.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += w1-gpio.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += w1-gpio-pullup.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += wittypi.dtbo ++ ++targets += dtbs dtbs_install ++targets += $(dtbo-y) ++ ++endif ++ ++always := $(dtbo-y) ++clean-files := *.dtbo +diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README +new file mode 100644 +index 0000000..1516cc2 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/README +@@ -0,0 +1,1161 @@ ++Introduction ++============ ++ ++This directory contains Device Tree overlays. Device Tree makes it possible ++to support many hardware configurations with a single kernel and without the ++need to explicitly load or blacklist kernel modules. Note that this isn't a ++"pure" Device Tree configuration (c.f. MACH_BCM2835) - some on-board devices ++are still configured by the board support code, but the intention is to ++eventually reach that goal. ++ ++On Raspberry Pi, Device Tree usage is controlled from /boot/config.txt. By ++default, the Raspberry Pi kernel boots with device tree enabled. You can ++completely disable DT usage (for now) by adding: ++ ++ device_tree= ++ ++to your config.txt, which should cause your Pi to revert to the old way of ++doing things after a reboot. ++ ++In /boot you will find a .dtb for each base platform. This describes the ++hardware that is part of the Raspberry Pi board. The loader (start.elf and its ++siblings) selects the .dtb file appropriate for the platform by name, and reads ++it into memory. At this point, all of the optional interfaces (i2c, i2s, spi) ++are disabled, but they can be enabled using Device Tree parameters: ++ ++ dtparam=i2c=on,i2s=on,spi=on ++ ++However, this shouldn't be necessary in many use cases because loading an ++overlay that requires one of those interfaces will cause it to be enabled ++automatically, and it is advisable to only enable interfaces if they are ++needed. ++ ++Configuring additional, optional hardware is done using Device Tree overlays ++(see below). ++ ++raspi-config ++============ ++ ++The Advanced Options section of the raspi-config utility can enable and disable ++Device Tree use, as well as toggling the I2C and SPI interfaces. Note that it ++is possible to both enable an interface and blacklist the driver, if for some ++reason you should want to defer the loading. ++ ++Modules ++======= ++ ++As well as describing the hardware, Device Tree also gives enough information ++to allow suitable driver modules to be located and loaded, with the corollary ++that unneeded modules are not loaded. As a result it should be possible to ++remove lines from /etc/modules, and /etc/modprobe.d/raspi-blacklist.conf can ++have its contents deleted (or commented out). ++ ++Using Overlays ++============== ++ ++Overlays are loaded using the "dtoverlay" directive. As an example, consider ++the popular lirc-rpi module, the Linux Infrared Remote Control driver. In the ++pre-DT world this would be loaded from /etc/modules, with an explicit ++"modprobe lirc-rpi" command, or programmatically by lircd. With DT enabled, ++this becomes a line in config.txt: ++ ++ dtoverlay=lirc-rpi ++ ++This causes the file /boot/overlays/lirc-rpi-overlay.dtb to be loaded. By ++default it will use GPIOs 17 (out) and 18 (in), but this can be modified using ++DT parameters: ++ ++ dtoverlay=lirc-rpi,gpio_out_pin=17,gpio_in_pin=13 ++ ++Parameters always have default values, although in some cases (e.g. "w1-gpio") ++it is necessary to provided multiple overlays in order to get the desired ++behaviour. See the list of overlays below for a description of the parameters ++and their defaults. ++ ++The Overlay and Parameter Reference ++=================================== ++ ++N.B. When editing this file, please preserve the indentation levels to make it ++simple to parse programmatically. NO HARD TABS. ++ ++ ++Name: <The base DTB> ++Info: Configures the base Raspberry Pi hardware ++Load: <loaded automatically> ++Params: ++ audio Set to "on" to enable the onboard ALSA audio ++ interface (default "off") ++ ++ i2c_arm Set to "on" to enable the ARM's i2c interface ++ (default "off") ++ ++ i2c_vc Set to "on" to enable the i2c interface ++ usually reserved for the VideoCore processor ++ (default "off") ++ ++ i2c An alias for i2c_arm ++ ++ i2c_arm_baudrate Set the baudrate of the ARM's i2c interface ++ (default "100000") ++ ++ i2c_vc_baudrate Set the baudrate of the VideoCore i2c interface ++ (default "100000") ++ ++ i2c_baudrate An alias for i2c_arm_baudrate ++ ++ i2s Set to "on" to enable the i2s interface ++ (default "off") ++ ++ spi Set to "on" to enable the spi interfaces ++ (default "off") ++ ++ random Set to "on" to enable the hardware random ++ number generator (default "on") ++ ++ sd_overclock Clock (in MHz) to use when the MMC framework ++ requests 50MHz ++ ++ sd_force_pio Disable DMA support for SD driver (default off) ++ ++ sd_pio_limit Number of blocks above which to use DMA for ++ SD card (default 1) ++ ++ sd_debug Enable debug output from SD driver (default off) ++ ++ uart0 Set to "off" to disable uart0 (default "on") ++ ++ uart1 Set to "on" or "off" to enable or disable uart1 ++ (default varies) ++ ++ watchdog Set to "on" to enable the hardware watchdog ++ (default "off") ++ ++ act_led_trigger Choose which activity the LED tracks. ++ Use "heartbeat" for a nice load indicator. ++ (default "mmc") ++ ++ act_led_activelow Set to "on" to invert the sense of the LED ++ (default "off") ++ N.B. For Pi3 see pi3-act-led overlay. ++ ++ act_led_gpio Set which GPIO to use for the activity LED ++ (in case you want to connect it to an external ++ device) ++ (default "16" on a non-Plus board, "47" on a ++ Plus or Pi 2) ++ N.B. For Pi3 see pi3-act-led overlay. ++ ++ pwr_led_trigger ++ pwr_led_activelow ++ pwr_led_gpio ++ As for act_led_*, but using the PWR LED. ++ Not available on Model A/B boards. ++ ++ N.B. It is recommended to only enable those interfaces that are needed. ++ Leaving all interfaces enabled can lead to unwanted behaviour (i2c_vc ++ interfering with Pi Camera, I2S and SPI hogging GPIO pins, etc.) ++ Note also that i2c, i2c_arm and i2c_vc are aliases for the physical ++ interfaces i2c0 and i2c1. Use of the numeric variants is still possible ++ but deprecated because the ARM/VC assignments differ between board ++ revisions. The same board-specific mapping applies to i2c_baudrate, ++ and the other i2c baudrate parameters. ++ ++ ++Name: adau1977-adc ++Info: Overlay for activation of ADAU1977 ADC codec over I2C for control ++ and I2S for data. ++Load: dtoverlay=adau1977-adc ++Params: <None> ++ ++ ++Name: ads7846 ++Info: ADS7846 Touch controller ++Load: dtoverlay=ads7846,<param>=<val> ++Params: cs SPI bus Chip Select (default 1) ++ speed SPI bus speed (default 2MHz, max 3.25MHz) ++ penirq GPIO used for PENIRQ. REQUIRED ++ penirq_pull Set GPIO pull (default 0=none, 2=pullup) ++ swapxy Swap x and y axis ++ xmin Minimum value on the X axis (default 0) ++ ymin Minimum value on the Y axis (default 0) ++ xmax Maximum value on the X axis (default 4095) ++ ymax Maximum value on the Y axis (default 4095) ++ pmin Minimum reported pressure value (default 0) ++ pmax Maximum reported pressure value (default 65535) ++ xohms Touchpanel sensitivity (X-plate resistance) ++ (default 400) ++ ++ penirq is required and usually xohms (60-100) has to be set as well. ++ Apart from that, pmax (255) and swapxy are also common. ++ The rest of the calibration can be done with xinput-calibrator. ++ See: github.com/notro/fbtft/wiki/FBTFT-on-Raspian ++ Device Tree binding document: ++ www.kernel.org/doc/Documentation/devicetree/bindings/input/ads7846.txt ++ ++ ++Name: akkordion-iqdacplus ++Info: Configures the Digital Dreamtime Akkordion Music Player (based on the ++ OEM IQAudIO DAC+ or DAC Zero module). ++Load: dtoverlay=akkordion-iqdacplus,<param>=<val> ++Params: 24db_digital_gain Allow gain to be applied via the PCM512x codec ++ Digital volume control. Enable with ++ dtoverlay=akkordion-iqdacplus,24db_digital_gain ++ (The default behaviour is that the Digital ++ volume control is limited to a maximum of ++ 0dB. ie. it can attenuate but not provide ++ gain. For most users, this will be desired ++ as it will prevent clipping. By appending ++ the 24db_digital_gain parameter, the Digital ++ volume control will allow up to 24dB of ++ gain. If this parameter is enabled, it is the ++ responsibility of the user to ensure that ++ the Digital volume control is set to a value ++ that does not result in clipping/distortion!) ++ ++ ++Name: at86rf233 ++Info: Configures the Atmel AT86RF233 802.15.4 low-power WPAN transceiver, ++ connected to spi0.0 ++Load: dtoverlay=at86rf233,<param>=<val> ++Params: interrupt GPIO used for INT (default 23) ++ reset GPIO used for Reset (default 24) ++ sleep GPIO used for Sleep (default 25) ++ speed SPI bus speed in Hz (default 3000000) ++ trim Fine tuning of the internal capacitance ++ arrays (0=+0pF, 15=+4.5pF, default 15) ++ ++ ++Name: audioinjector-wm8731-audio ++Info: Configures the audioinjector.net audio add on soundcard ++Load: dtoverlay=audioinjector-wm8731-audio ++Params: <None> ++ ++ ++Name: bmp085_i2c-sensor ++Info: Configures the BMP085/BMP180 digital barometric pressure and temperature ++ sensors from Bosch Sensortec ++Load: dtoverlay=bmp085_i2c-sensor ++Params: <None> ++ ++ ++Name: dht11 ++Info: Overlay for the DHT11/DHT21/DHT22 humidity/temperature sensors ++ Also sometimes found with the part number(s) AM230x. ++Load: dtoverlay=dht11,<param>=<val> ++Params: gpiopin GPIO connected to the sensor's DATA output. ++ (default 4) ++ ++ ++Name: dpi24 ++Info: Overlay for a generic 24-bit DPI display ++ This uses GPIOs 0-27 (so no I2C, uart etc.), and activates the output ++ 2-3 seconds after the kernel has started. ++Load: dtoverlay=dpi24 ++Params: <None> ++ ++ ++Name: dwc-otg ++Info: Selects the dwc_otg USB controller driver which has fiq support. This ++ is the default on all except the Pi Zero which defaults to dwc2. ++Load: dtoverlay=dwc-otg ++Params: <None> ++ ++ ++Name: dwc2 ++Info: Selects the dwc2 USB controller driver ++Load: dtoverlay=dwc2,<param>=<val> ++Params: dr_mode Dual role mode: "host", "peripheral" or "otg" ++ ++ g-rx-fifo-size Size of rx fifo size in gadget mode ++ ++ g-np-tx-fifo-size Size of non-periodic tx fifo size in gadget ++ mode ++ ++ g-tx-fifo-size Size of periodic tx fifo per endpoint ++ (except ep0) in gadget mode ++ ++ ++[ The ds1307-rtc overlay has been deleted. See i2c-rtc. ] ++ ++ ++Name: enc28j60 ++Info: Overlay for the Microchip ENC28J60 Ethernet Controller (SPI) ++Load: dtoverlay=enc28j60,<param>=<val> ++Params: int_pin GPIO used for INT (default 25) ++ ++ speed SPI bus speed (default 12000000) ++ ++ ++Name: gpio-ir ++Info: Use GPIO pin as rc-core style infrared receiver input. The rc-core- ++ based gpio_ir_recv driver maps received keys directly to a ++ /dev/input/event* device, all decoding is done by the kernel - LIRC is ++ not required! The key mapping and other decoding parameters can be ++ configured by "ir-keytable" tool. ++Load: dtoverlay=gpio-ir,<param>=<val> ++Params: gpio_pin Input pin number. Default is 18. ++ ++ gpio_pull Desired pull-up/down state (off, down, up) ++ Default is "down". ++ ++ rc-map-name Default rc keymap (can also be changed by ++ ir-keytable), defaults to "rc-rc6-mce" ++ ++ ++Name: gpio-poweroff ++Info: Drives a GPIO high or low on reboot ++Load: dtoverlay=gpio-poweroff,<param>=<val> ++Params: gpiopin GPIO for signalling (default 26) ++ ++ active_low Set if the power control device requires a ++ high->low transition to trigger a power-down. ++ Note that this will require the support of a ++ custom dt-blob.bin to prevent a power-down ++ during the boot process, and that a reboot ++ will also cause the pin to go low. ++ ++ ++Name: hifiberry-amp ++Info: Configures the HifiBerry Amp and Amp+ audio cards ++Load: dtoverlay=hifiberry-amp ++Params: <None> ++ ++ ++Name: hifiberry-dac ++Info: Configures the HifiBerry DAC audio card ++Load: dtoverlay=hifiberry-dac ++Params: <None> ++ ++ ++Name: hifiberry-dacplus ++Info: Configures the HifiBerry DAC+ audio card ++Load: dtoverlay=hifiberry-dacplus,<param>=<val> ++Params: 24db_digital_gain Allow gain to be applied via the PCM512x codec ++ Digital volume control. Enable with ++ "dtoverlay=hifiberry-dacplus,24db_digital_gain" ++ (The default behaviour is that the Digital ++ volume control is limited to a maximum of ++ 0dB. ie. it can attenuate but not provide ++ gain. For most users, this will be desired ++ as it will prevent clipping. By appending ++ the 24dB_digital_gain parameter, the Digital ++ volume control will allow up to 24dB of ++ gain. If this parameter is enabled, it is the ++ responsibility of the user to ensure that ++ the Digital volume control is set to a value ++ that does not result in clipping/distortion!) ++ slave Force DAC+ Pro into slave mode, using Pi as ++ master for bit clock and frame clock. ++ ++ ++Name: hifiberry-digi ++Info: Configures the HifiBerry Digi audio card ++Load: dtoverlay=hifiberry-digi ++Params: <None> ++ ++ ++Name: hy28a ++Info: HY28A - 2.8" TFT LCD Display Module by HAOYU Electronics ++ Default values match Texy's display shield ++Load: dtoverlay=hy28a,<param>=<val> ++Params: speed Display SPI bus speed ++ ++ rotate Display rotation {0,90,180,270} ++ ++ fps Delay between frame updates ++ ++ debug Debug output level {0-7} ++ ++ xohms Touchpanel sensitivity (X-plate resistance) ++ ++ resetgpio GPIO used to reset controller ++ ++ ledgpio GPIO used to control backlight ++ ++ ++Name: hy28b ++Info: HY28B - 2.8" TFT LCD Display Module by HAOYU Electronics ++ Default values match Texy's display shield ++Load: dtoverlay=hy28b,<param>=<val> ++Params: speed Display SPI bus speed ++ ++ rotate Display rotation {0,90,180,270} ++ ++ fps Delay between frame updates ++ ++ debug Debug output level {0-7} ++ ++ xohms Touchpanel sensitivity (X-plate resistance) ++ ++ resetgpio GPIO used to reset controller ++ ++ ledgpio GPIO used to control backlight ++ ++ ++Name: i2c-gpio ++Info: Adds support for software i2c controller on gpio pins ++Load: dtoverlay=i2c-gpio,<param>=<val> ++Params: i2c_gpio_sda GPIO used for I2C data (default "23") ++ ++ i2c_gpio_scl GPIO used for I2C clock (default "24") ++ ++ i2c_gpio_delay_us Clock delay in microseconds ++ (default "2" = ~100kHz) ++ ++ ++Name: i2c-mux ++Info: Adds support for a number of I2C bus multiplexers on i2c_arm ++Load: dtoverlay=i2c-mux,<param>=<val> ++Params: pca9542 Select the NXP PCA9542 device ++ ++ pca9545 Select the NXP PCA9545 device ++ ++ pca9548 Select the NXP PCA9548 device ++ ++ addr Change I2C address of the device (default 0x70) ++ ++ ++[ The i2c-mux-pca9548a overlay has been deleted. See i2c-mux. ] ++ ++ ++Name: i2c-pwm-pca9685a ++Info: Adds support for an NXP PCA9685A I2C PWM controller on i2c_arm ++Load: dtoverlay=i2c-pwm-pca9685a,<param>=<val> ++Params: addr I2C address of PCA9685A (default 0x40) ++ ++ ++Name: i2c-rtc ++Info: Adds support for a number of I2C Real Time Clock devices ++Load: dtoverlay=i2c-rtc,<param>=<val> ++Params: ds1307 Select the DS1307 device ++ ++ ds1339 Select the DS1339 device ++ ++ ds3231 Select the DS3231 device ++ ++ mcp7940x Select the MCP7940x device ++ ++ mcp7941x Select the MCP7941x device ++ ++ pcf2127 Select the PCF2127 device ++ ++ pcf8523 Select the PCF8523 device ++ ++ pcf8563 Select the PCF8563 device ++ ++ trickle-resistor-ohms Resistor value for trickle charge (DS1339-only) ++ ++ ++Name: i2c0-bcm2708 ++Info: Enable the i2c_bcm2708 driver for the i2c0 bus. Not all pin combinations ++ are usable on all platforms. ++Load: dtoverlay=i2c0-bcm2708,<param>=<val> ++Params: sda0_pin GPIO pin for SDA0 (deprecated - use pins_*) ++ scl0_pin GPIO pin for SCL0 (deprecated - use pins_*) ++ pins_0_1 Use pins 0 and 1 (default) ++ pins_28_29 Use pins 28 and 29 ++ pins_44_45 Use pins 44 and 45 ++ pins_46_47 Use pins 46 and 47 ++ ++ ++Name: i2c1-bcm2708 ++Info: Enable the i2c_bcm2708 driver for the i2c1 bus ++Load: dtoverlay=i2c1-bcm2708,<param>=<val> ++Params: sda1_pin GPIO pin for SDA1 (2 or 44 - default 2) ++ scl1_pin GPIO pin for SCL1 (3 or 45 - default 3) ++ pin_func Alternative pin function (4 (alt0), 6 (alt2) - ++ default 4) ++ ++ ++Name: i2s-gpio28-31 ++Info: move I2S function block to GPIO 28 to 31 ++Load: dtoverlay=i2s-gpio28-31 ++Params: <None> ++ ++ ++Name: i2s-mmap ++Info: Enables mmap support in the bcm2708-i2s driver ++Load: dtoverlay=i2s-mmap ++Params: <None> ++ ++ ++Name: iqaudio-dac ++Info: Configures the IQaudio DAC audio card ++Load: dtoverlay=iqaudio-dac,<param> ++Params: 24db_digital_gain Allow gain to be applied via the PCM512x codec ++ Digital volume control. Enable with ++ "dtoverlay=iqaudio-dac,24db_digital_gain" ++ (The default behaviour is that the Digital ++ volume control is limited to a maximum of ++ 0dB. ie. it can attenuate but not provide ++ gain. For most users, this will be desired ++ as it will prevent clipping. By appending ++ the 24db_digital_gain parameter, the Digital ++ volume control will allow up to 24dB of ++ gain. If this parameter is enabled, it is the ++ responsibility of the user to ensure that ++ the Digital volume control is set to a value ++ that does not result in clipping/distortion!) ++ ++ ++Name: iqaudio-dacplus ++Info: Configures the IQaudio DAC+ audio card ++Load: dtoverlay=iqaudio-dacplus,<param>=<val> ++Params: 24db_digital_gain Allow gain to be applied via the PCM512x codec ++ Digital volume control. Enable with ++ "dtoverlay=iqaudio-dacplus,24db_digital_gain" ++ (The default behaviour is that the Digital ++ volume control is limited to a maximum of ++ 0dB. ie. it can attenuate but not provide ++ gain. For most users, this will be desired ++ as it will prevent clipping. By appending ++ the 24db_digital_gain parameter, the Digital ++ volume control will allow up to 24dB of ++ gain. If this parameter is enabled, it is the ++ responsibility of the user to ensure that ++ the Digital volume control is set to a value ++ that does not result in clipping/distortion!) ++ ++ ++Name: justboom-dac ++Info: Configures the JustBoom DAC HAT, Amp HAT, DAC Zero and Amp Zero audio ++ cards ++Load: dtoverlay=justboom-dac,<param>=<val> ++Params: 24db_digital_gain Allow gain to be applied via the PCM512x codec ++ Digital volume control. Enable with ++ "dtoverlay=justboom-dac,24db_digital_gain" ++ (The default behaviour is that the Digital ++ volume control is limited to a maximum of ++ 0dB. ie. it can attenuate but not provide ++ gain. For most users, this will be desired ++ as it will prevent clipping. By appending ++ the 24dB_digital_gain parameter, the Digital ++ volume control will allow up to 24dB of ++ gain. If this parameter is enabled, it is the ++ responsibility of the user to ensure that ++ the Digital volume control is set to a value ++ that does not result in clipping/distortion!) ++ ++ ++Name: justboom-digi ++Info: Configures the JustBoom Digi HAT and Digi Zero audio cards ++Load: dtoverlay=justboom-digi ++Params: <None> ++ ++ ++Name: lirc-rpi ++Info: Configures lirc-rpi (Linux Infrared Remote Control for Raspberry Pi) ++ Consult the module documentation for more details. ++Load: dtoverlay=lirc-rpi,<param>=<val> ++Params: gpio_out_pin GPIO for output (default "17") ++ ++ gpio_in_pin GPIO for input (default "18") ++ ++ gpio_in_pull Pull up/down/off on the input pin ++ (default "down") ++ ++ sense Override the IR receive auto-detection logic: ++ "0" = force active-high ++ "1" = force active-low ++ "-1" = use auto-detection ++ (default "-1") ++ ++ softcarrier Turn the software carrier "on" or "off" ++ (default "on") ++ ++ invert "on" = invert the output pin (default "off") ++ ++ debug "on" = enable additional debug messages ++ (default "off") ++ ++ ++Name: mcp23017 ++Info: Configures the MCP23017 I2C port expander ++Load: dtoverlay=mcp23017,<param>=<val> ++Params: gpiopin Gpio pin connected to the INTA output of the ++ MCP23017 (default: 4) ++ ++ addr I2C address of the MCP23017 (default: 0x20) ++ ++ ++Name: mcp2515-can0 ++Info: Configures the MCP2515 CAN controller on spi0.0 ++Load: dtoverlay=mcp2515-can0,<param>=<val> ++Params: oscillator Clock frequency for the CAN controller (Hz) ++ ++ spimaxfrequency Maximum SPI frequence (Hz) ++ ++ interrupt GPIO for interrupt signal ++ ++ ++Name: mcp2515-can1 ++Info: Configures the MCP2515 CAN controller on spi0.1 ++Load: dtoverlay=mcp2515-can1,<param>=<val> ++Params: oscillator Clock frequency for the CAN controller (Hz) ++ ++ spimaxfrequency Maximum SPI frequence (Hz) ++ ++ interrupt GPIO for interrupt signal ++ ++ ++Name: mmc ++Info: Selects the bcm2835-mmc SD/MMC driver, optionally with overclock ++Load: dtoverlay=mmc,<param>=<val> ++Params: overclock_50 Clock (in MHz) to use when the MMC framework ++ requests 50MHz ++ ++ ++Name: mz61581 ++Info: MZ61581 display by Tontec ++Load: dtoverlay=mz61581,<param>=<val> ++Params: speed Display SPI bus speed ++ ++ rotate Display rotation {0,90,180,270} ++ ++ fps Delay between frame updates ++ ++ txbuflen Transmit buffer length (default 32768) ++ ++ debug Debug output level {0-7} ++ ++ xohms Touchpanel sensitivity (X-plate resistance) ++ ++ ++[ The pcf2127-rtc overlay has been deleted. See i2c-rtc. ] ++ ++ ++[ The pcf8523-rtc overlay has been deleted. See i2c-rtc. ] ++ ++ ++[ The pcf8563-rtc overlay has been deleted. See i2c-rtc. ] ++ ++ ++Name: pi3-act-led ++Info: Pi3 uses a GPIO expander to drive the LEDs which can only be accessed ++ from the VPU. There is a special driver for this with a separate DT ++ node, which has the unfortunate consequence of breaking the ++ act_led_gpio and act_led_activelow dtparams. ++ This overlay changes the GPIO controller back to the standard one and ++ restores the dtparams. ++Load: dtoverlay=pi3-act-led,<param>=<val> ++Params: activelow Set to "on" to invert the sense of the LED ++ (default "off") ++ ++ gpio Set which GPIO to use for the activity LED ++ (in case you want to connect it to an external ++ device) ++ REQUIRED ++ ++ ++Name: pi3-disable-bt ++Info: Disable Pi3 Bluetooth and restore UART0/ttyAMA0 over GPIOs 14 & 15 ++ N.B. To disable the systemd service that initialises the modem so it ++ doesn't use the UART, use 'sudo systemctl disable hciuart'. ++Load: dtoverlay=pi3-disable-bt ++Params: <None> ++ ++ ++Name: pi3-miniuart-bt ++Info: Switch Pi3 Bluetooth function to use the mini-UART (ttyS0) and restore ++ UART0/ttyAMA0 over GPIOs 14 & 15. Note that this may reduce the maximum ++ usable baudrate. ++ N.B. It is also necessary to edit /lib/systemd/system/hciuart.service ++ and replace ttyAMA0 with ttyS0, unless you have a system with udev rules ++ that create /dev/serial0 and /dev/serial1, in which case use ++ /dev/serial1 instead because it will always be correct. ++Load: dtoverlay=pi3-miniuart-bt ++Params: <None> ++ ++ ++Name: piscreen ++Info: PiScreen display by OzzMaker.com ++Load: dtoverlay=piscreen,<param>=<val> ++Params: speed Display SPI bus speed ++ ++ rotate Display rotation {0,90,180,270} ++ ++ fps Delay between frame updates ++ ++ debug Debug output level {0-7} ++ ++ xohms Touchpanel sensitivity (X-plate resistance) ++ ++ ++Name: piscreen2r ++Info: PiScreen 2 with resistive TP display by OzzMaker.com ++Load: dtoverlay=piscreen2r,<param>=<val> ++Params: speed Display SPI bus speed ++ ++ rotate Display rotation {0,90,180,270} ++ ++ fps Delay between frame updates ++ ++ debug Debug output level {0-7} ++ ++ xohms Touchpanel sensitivity (X-plate resistance) ++ ++ ++Name: pitft22 ++Info: Adafruit PiTFT 2.2" screen ++Load: dtoverlay=pitft22,<param>=<val> ++Params: speed Display SPI bus speed ++ ++ rotate Display rotation {0,90,180,270} ++ ++ fps Delay between frame updates ++ ++ debug Debug output level {0-7} ++ ++ ++Name: pitft28-capacitive ++Info: Adafruit PiTFT 2.8" capacitive touch screen ++Load: dtoverlay=pitft28-capacitive,<param>=<val> ++Params: speed Display SPI bus speed ++ ++ rotate Display rotation {0,90,180,270} ++ ++ fps Delay between frame updates ++ ++ debug Debug output level {0-7} ++ ++ touch-sizex Touchscreen size x (default 240) ++ ++ touch-sizey Touchscreen size y (default 320) ++ ++ touch-invx Touchscreen inverted x axis ++ ++ touch-invy Touchscreen inverted y axis ++ ++ touch-swapxy Touchscreen swapped x y axis ++ ++ ++Name: pitft28-resistive ++Info: Adafruit PiTFT 2.8" resistive touch screen ++Load: dtoverlay=pitft28-resistive,<param>=<val> ++Params: speed Display SPI bus speed ++ ++ rotate Display rotation {0,90,180,270} ++ ++ fps Delay between frame updates ++ ++ debug Debug output level {0-7} ++ ++ ++Name: pps-gpio ++Info: Configures the pps-gpio (pulse-per-second time signal via GPIO). ++Load: dtoverlay=pps-gpio,<param>=<val> ++Params: gpiopin Input GPIO (default "18") ++ ++ ++Name: pwm ++Info: Configures a single PWM channel ++ Legal pin,function combinations for each channel: ++ PWM0: 12,4(Alt0) 18,2(Alt5) 40,4(Alt0) 52,5(Alt1) ++ PWM1: 13,4(Alt0) 19,2(Alt5) 41,4(Alt0) 45,4(Alt0) 53,5(Alt1) ++ N.B.: ++ 1) Pin 18 is the only one available on all platforms, and ++ it is the one used by the I2S audio interface. ++ Pins 12 and 13 might be better choices on an A+, B+ or Pi2. ++ 2) The onboard analogue audio output uses both PWM channels. ++ 3) So be careful mixing audio and PWM. ++ 4) Currently the clock must have been enabled and configured ++ by other means. ++Load: dtoverlay=pwm,<param>=<val> ++Params: pin Output pin (default 18) - see table ++ func Pin function (default 2 = Alt5) - see above ++ clock PWM clock frequency (informational) ++ ++ ++Name: pwm-2chan ++Info: Configures both PWM channels ++ Legal pin,function combinations for each channel: ++ PWM0: 12,4(Alt0) 18,2(Alt5) 40,4(Alt0) 52,5(Alt1) ++ PWM1: 13,4(Alt0) 19,2(Alt5) 41,4(Alt0) 45,4(Alt0) 53,5(Alt1) ++ N.B.: ++ 1) Pin 18 is the only one available on all platforms, and ++ it is the one used by the I2S audio interface. ++ Pins 12 and 13 might be better choices on an A+, B+ or Pi2. ++ 2) The onboard analogue audio output uses both PWM channels. ++ 3) So be careful mixing audio and PWM. ++ 4) Currently the clock must have been enabled and configured ++ by other means. ++Load: dtoverlay=pwm-2chan,<param>=<val> ++Params: pin Output pin (default 18) - see table ++ pin2 Output pin for other channel (default 19) ++ func Pin function (default 2 = Alt5) - see above ++ func2 Function for pin2 (default 2 = Alt5) ++ clock PWM clock frequency (informational) ++ ++ ++Name: qca7000 ++Info: I2SE's Evaluation Board for PLC Stamp micro ++Load: dtoverlay=qca7000,<param>=<val> ++Params: int_pin GPIO pin for interrupt signal (default 23) ++ ++ speed SPI bus speed (default 12 MHz) ++ ++ ++Name: raspidac3 ++Info: Configures the RaspiDAV Rev.3x audio card ++Load: dtoverlay=raspidac3 ++Params: <None> ++ ++ ++Name: rpi-backlight ++Info: Raspberry Pi official display backlight driver ++Load: dtoverlay=rpi-backlight ++Params: <None> ++ ++ ++Name: rpi-dac ++Info: Configures the RPi DAC audio card ++Load: dtoverlay=rpi-dac ++Params: <None> ++ ++ ++Name: rpi-display ++Info: RPi-Display - 2.8" Touch Display by Watterott ++Load: dtoverlay=rpi-display,<param>=<val> ++Params: speed Display SPI bus speed ++ rotate Display rotation {0,90,180,270} ++ fps Delay between frame updates ++ debug Debug output level {0-7} ++ xohms Touchpanel sensitivity (X-plate resistance) ++ swapxy Swap x and y axis ++ ++ ++Name: rpi-ft5406 ++Info: Official Raspberry Pi display touchscreen ++Load: dtoverlay=rpi-ft5406 ++Params: <None> ++ ++ ++Name: rpi-proto ++Info: Configures the RPi Proto audio card ++Load: dtoverlay=rpi-proto ++Params: <None> ++ ++ ++Name: rpi-sense ++Info: Raspberry Pi Sense HAT ++Load: dtoverlay=rpi-sense ++Params: <None> ++ ++ ++Name: rra-digidac1-wm8741-audio ++Info: Configures the Red Rocks Audio DigiDAC1 soundcard ++Load: dtoverlay=rra-digidac1-wm8741-audio ++Params: <None> ++ ++ ++Name: sdhost ++Info: Selects the bcm2835-sdhost SD/MMC driver, optionally with overclock. ++ N.B. This overlay is designed for situations where the mmc driver is ++ the default, so it disables the other (mmc) interface - this will kill ++ WiFi on a Pi3. If this isn't what you want, either use the sdtweak ++ overlay or the new sd_* dtparams of the base DTBs. ++Load: dtoverlay=sdhost,<param>=<val> ++Params: overclock_50 Clock (in MHz) to use when the MMC framework ++ requests 50MHz ++ ++ force_pio Disable DMA support (default off) ++ ++ pio_limit Number of blocks above which to use DMA ++ (default 1) ++ ++ debug Enable debug output (default off) ++ ++ ++Name: sdio ++Info: Selects the bcm2835-sdhost SD/MMC driver, optionally with overclock, ++ and enables SDIO via GPIOs 22-27. ++Load: dtoverlay=sdio,<param>=<val> ++Params: overclock_50 SD Clock (in MHz) to use when the MMC framework ++ requests 50MHz ++ ++ sdio_overclock SDIO Clock (in MHz) to use when the MMC ++ framework requests 50MHz ++ ++ force_pio Disable DMA support (default off) ++ ++ pio_limit Number of blocks above which to use DMA ++ (default 1) ++ ++ debug Enable debug output (default off) ++ ++ poll_once Disable SDIO-device polling every second ++ (default on: polling once at boot-time) ++ ++ bus_width Set the SDIO host bus width (default 4 bits) ++ ++ ++Name: sdio-1bit ++Info: Selects the bcm2835-sdhost SD/MMC driver, optionally with overclock, ++ and enables 1-bit SDIO via GPIOs 22-25. ++Load: dtoverlay=sdio-1bit,<param>=<val> ++Params: overclock_50 SD Clock (in MHz) to use when the MMC framework ++ requests 50MHz ++ ++ sdio_overclock SDIO Clock (in MHz) to use when the MMC ++ framework requests 50MHz ++ ++ force_pio Disable DMA support (default off) ++ ++ pio_limit Number of blocks above which to use DMA ++ (default 1) ++ ++ debug Enable debug output (default off) ++ ++ poll_once Disable SDIO-device polling every second ++ (default on: polling once at boot-time) ++ ++ ++Name: sdtweak ++Info: Tunes the bcm2835-sdhost SD/MMC driver ++ N.B. This functionality is now available via the sd_* dtparams in the ++ base DTB. ++Load: dtoverlay=sdtweak,<param>=<val> ++Params: overclock_50 Clock (in MHz) to use when the MMC framework ++ requests 50MHz ++ ++ force_pio Disable DMA support (default off) ++ ++ pio_limit Number of blocks above which to use DMA ++ (default 1) ++ ++ debug Enable debug output (default off) ++ ++ ++Name: smi ++Info: Enables the Secondary Memory Interface peripheral. Uses GPIOs 2-25! ++Load: dtoverlay=smi ++Params: <None> ++ ++ ++Name: smi-dev ++Info: Enables the userspace interface for the SMI driver ++Load: dtoverlay=smi-dev ++Params: <None> ++ ++ ++Name: smi-nand ++Info: Enables access to NAND flash via the SMI interface ++Load: dtoverlay=smi-nand ++Params: <None> ++ ++ ++Name: spi-gpio35-39 ++Info: move SPI function block to GPIO 35 to 39 ++Load: dtoverlay=spi-gpio35-39 ++Params: <None> ++ ++ ++Name: spi1-1cs ++Info: Enables spi1 with a single chip select (CS) line and associated spidev ++ dev node. The gpio pin number for the CS line and spidev device node ++ creation are configurable. ++ N.B.: spi1 is only accessible on devices with a 40pin header, eg: ++ A+, B+, Zero and PI2 B; as well as the Compute Module. ++Load: dtoverlay=spi1-1cs,<param>=<val> ++Params: cs0_pin GPIO pin for CS0 (default 18 - BCM SPI1_CE0). ++ cs0_spidev Set to 'disabled' to stop the creation of a ++ userspace device node /dev/spidev1.0 (default ++ is 'okay' or enabled). ++ ++ ++Name: spi1-2cs ++Info: Enables spi1 with two chip select (CS) lines and associated spidev ++ dev nodes. The gpio pin numbers for the CS lines and spidev device node ++ creation are configurable. ++ N.B.: spi1 is only accessible on devices with a 40pin header, eg: ++ A+, B+, Zero and PI2 B; as well as the Compute Module. ++Load: dtoverlay=spi1-2cs,<param>=<val> ++Params: cs0_pin GPIO pin for CS0 (default 18 - BCM SPI1_CE0). ++ cs1_pin GPIO pin for CS1 (default 17 - BCM SPI1_CE1). ++ cs0_spidev Set to 'disabled' to stop the creation of a ++ userspace device node /dev/spidev1.0 (default ++ is 'okay' or enabled). ++ cs1_spidev Set to 'disabled' to stop the creation of a ++ userspace device node /dev/spidev1.1 (default ++ is 'okay' or enabled). ++ ++ ++Name: spi1-3cs ++Info: Enables spi1 with three chip select (CS) lines and associated spidev ++ dev nodes. The gpio pin numbers for the CS lines and spidev device node ++ creation are configurable. ++ N.B.: spi1 is only accessible on devices with a 40pin header, eg: ++ A+, B+, Zero and PI2 B; as well as the Compute Module. ++Load: dtoverlay=spi1-3cs,<param>=<val> ++Params: cs0_pin GPIO pin for CS0 (default 18 - BCM SPI1_CE0). ++ cs1_pin GPIO pin for CS1 (default 17 - BCM SPI1_CE1). ++ cs2_pin GPIO pin for CS2 (default 16 - BCM SPI1_CE2). ++ cs0_spidev Set to 'disabled' to stop the creation of a ++ userspace device node /dev/spidev1.0 (default ++ is 'okay' or enabled). ++ cs1_spidev Set to 'disabled' to stop the creation of a ++ userspace device node /dev/spidev1.1 (default ++ is 'okay' or enabled). ++ cs2_spidev Set to 'disabled' to stop the creation of a ++ userspace device node /dev/spidev1.2 (default ++ is 'okay' or enabled). ++ ++ ++Name: spi2-1cs ++Info: Enables spi2 with a single chip select (CS) line and associated spidev ++ dev node. The gpio pin number for the CS line and spidev device node ++ creation are configurable. ++ N.B.: spi2 is only accessible with the Compute Module. ++Load: dtoverlay=spi2-1cs,<param>=<val> ++Params: cs0_pin GPIO pin for CS0 (default 43 - BCM SPI2_CE0). ++ cs0_spidev Set to 'disabled' to stop the creation of a ++ userspace device node /dev/spidev2.0 (default ++ is 'okay' or enabled). ++ ++ ++Name: spi2-2cs ++Info: Enables spi2 with two chip select (CS) lines and associated spidev ++ dev nodes. The gpio pin numbers for the CS lines and spidev device node ++ creation are configurable. ++ N.B.: spi2 is only accessible with the Compute Module. ++Load: dtoverlay=spi2-2cs,<param>=<val> ++Params: cs0_pin GPIO pin for CS0 (default 43 - BCM SPI2_CE0). ++ cs1_pin GPIO pin for CS1 (default 44 - BCM SPI2_CE1). ++ cs0_spidev Set to 'disabled' to stop the creation of a ++ userspace device node /dev/spidev2.0 (default ++ is 'okay' or enabled). ++ cs1_spidev Set to 'disabled' to stop the creation of a ++ userspace device node /dev/spidev2.1 (default ++ is 'okay' or enabled). ++ ++ ++Name: spi2-3cs ++Info: Enables spi2 with three chip select (CS) lines and associated spidev ++ dev nodes. The gpio pin numbers for the CS lines and spidev device node ++ creation are configurable. ++ N.B.: spi2 is only accessible with the Compute Module. ++Load: dtoverlay=spi2-3cs,<param>=<val> ++Params: cs0_pin GPIO pin for CS0 (default 43 - BCM SPI2_CE0). ++ cs1_pin GPIO pin for CS1 (default 44 - BCM SPI2_CE1). ++ cs2_pin GPIO pin for CS2 (default 45 - BCM SPI2_CE2). ++ cs0_spidev Set to 'disabled' to stop the creation of a ++ userspace device node /dev/spidev2.0 (default ++ is 'okay' or enabled). ++ cs1_spidev Set to 'disabled' to stop the creation of a ++ userspace device node /dev/spidev2.1 (default ++ is 'okay' or enabled). ++ cs2_spidev Set to 'disabled' to stop the creation of a ++ userspace device node /dev/spidev2.2 (default ++ is 'okay' or enabled). ++ ++ ++Name: tinylcd35 ++Info: 3.5" Color TFT Display by www.tinylcd.com ++ Options: Touch, RTC, keypad ++Load: dtoverlay=tinylcd35,<param>=<val> ++Params: speed Display SPI bus speed ++ ++ rotate Display rotation {0,90,180,270} ++ ++ fps Delay between frame updates ++ ++ debug Debug output level {0-7} ++ ++ touch Enable touch panel ++ ++ touchgpio Touch controller IRQ GPIO ++ ++ xohms Touchpanel: Resistance of X-plate in ohms ++ ++ rtc-pcf PCF8563 Real Time Clock ++ ++ rtc-ds DS1307 Real Time Clock ++ ++ keypad Enable keypad ++ ++ Examples: ++ Display with touchpanel, PCF8563 RTC and keypad: ++ dtoverlay=tinylcd35,touch,rtc-pcf,keypad ++ Old touch display: ++ dtoverlay=tinylcd35,touch,touchgpio=3 ++ ++ ++Name: uart1 ++Info: Enable uart1 in place of uart0 ++Load: dtoverlay=uart1,<param>=<val> ++Params: txd1_pin GPIO pin for TXD1 (14, 32 or 40 - default 14) ++ ++ rxd1_pin GPIO pin for RXD1 (15, 33 or 41 - default 15) ++ ++ ++Name: vc4-kms-v3d ++Info: Enable Eric Anholt's DRM VC4 HDMI/HVS/V3D driver. Running startx or ++ booting to GUI while this overlay is in use will cause interesting ++ lockups. ++Load: dtoverlay=vc4-kms-v3d,<param> ++Params: cma-256 CMA is 256MB, 256MB-aligned (needs 1GB) ++ cma-192 CMA is 192MB, 256MB-aligned (needs 1GB) ++ cma-128 CMA is 128MB, 128MB-aligned ++ cma-96 CMA is 96MB, 128MB-aligned ++ cma-64 CMA is 64MB, 64MB-aligned ++ ++ ++Name: vga666 ++Info: Overlay for the Fen Logic VGA666 board ++ This uses GPIOs 2-21 (so no I2C), and activates the output 2-3 seconds ++ after the kernel has started. ++Load: dtoverlay=vga666 ++Params: <None> ++ ++ ++Name: w1-gpio ++Info: Configures the w1-gpio Onewire interface module. ++ Use this overlay if you *don't* need a GPIO to drive an external pullup. ++Load: dtoverlay=w1-gpio,<param>=<val> ++Params: gpiopin GPIO for I/O (default "4") ++ ++ pullup Non-zero, "on", or "y" to enable the parasitic ++ power (2-wire, power-on-data) feature ++ ++ ++Name: w1-gpio-pullup ++Info: Configures the w1-gpio Onewire interface module. ++ Use this overlay if you *do* need a GPIO to drive an external pullup. ++Load: dtoverlay=w1-gpio-pullup,<param>=<val> ++Params: gpiopin GPIO for I/O (default "4") ++ ++ pullup Non-zero, "on", or "y" to enable the parasitic ++ power (2-wire, power-on-data) feature ++ ++ extpullup GPIO for external pullup (default "5") ++ ++ ++Name: wittypi ++Info: Configures the wittypi RTC module. ++Load: dtoverlay=wittypi,<param>=<val> ++Params: led_gpio GPIO for LED (default "17") ++ led_trigger Choose which activity the LED tracks (default ++ "default-on") ++ ++ ++Troubleshooting ++=============== ++ ++If you are experiencing problems that you think are DT-related, enable DT ++diagnostic output by adding this to /boot/config.txt: ++ ++ dtdebug=on ++ ++and rebooting. Then run: ++ ++ sudo vcdbg log msg ++ ++and look for relevant messages. ++ ++Further reading ++=============== ++ ++This is only meant to be a quick introduction to the subject of Device Tree on ++Raspberry Pi. There is a more complete explanation here: ++ ++http://www.raspberrypi.org/documentation/configuration/device-tree.md +diff --git a/arch/arm/boot/dts/overlays/adau1977-adc-overlay.dts b/arch/arm/boot/dts/overlays/adau1977-adc-overlay.dts +new file mode 100644 +index 0000000..24fcd58 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/adau1977-adc-overlay.dts +@@ -0,0 +1,53 @@ ++// Definitions for ADAU1977 ADC ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&soc>; ++ ++ __overlay__ { ++ codec_supply: fixedregulator@0 { ++ compatible = "regulator-fixed"; ++ regulator-name = "AVDD"; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&i2c>; ++ ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ adau1977: codec@11 { ++ compatible = "adi,adau1977"; ++ reg = <0x11>; ++ reset-gpios = <&gpio 5 0>; ++ AVDD-supply = <&codec_supply>; ++ }; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&i2s>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@3 { ++ target = <&sound>; ++ __overlay__ { ++ compatible = "adi,adau1977-adc"; ++ i2s-controller = <&i2s>; ++ status = "okay"; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/ads7846-overlay.dts b/arch/arm/boot/dts/overlays/ads7846-overlay.dts +new file mode 100644 +index 0000000..edf2dc9 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/ads7846-overlay.dts +@@ -0,0 +1,89 @@ ++/* ++ * Generic Device Tree overlay for the ADS7846 touch controller ++ * ++ */ ++ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; ++ ++ fragment@0 { ++ target = <&spi0>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&spidev0>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&spidev1>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; ++ ++ fragment@3 { ++ target = <&gpio>; ++ __overlay__ { ++ ads7846_pins: ads7846_pins { ++ brcm,pins = <255>; /* illegal default value */ ++ brcm,function = <0>; /* in */ ++ brcm,pull = <0>; /* none */ ++ }; ++ }; ++ }; ++ ++ fragment@4 { ++ target = <&spi0>; ++ __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ ads7846: ads7846@1 { ++ compatible = "ti,ads7846"; ++ reg = <1>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&ads7846_pins>; ++ ++ spi-max-frequency = <2000000>; ++ interrupts = <255 2>; /* high-to-low edge triggered */ ++ interrupt-parent = <&gpio>; ++ pendown-gpio = <&gpio 255 0>; ++ ++ /* driver defaults */ ++ ti,x-min = /bits/ 16 <0>; ++ ti,y-min = /bits/ 16 <0>; ++ ti,x-max = /bits/ 16 <0x0FFF>; ++ ti,y-max = /bits/ 16 <0x0FFF>; ++ ti,pressure-min = /bits/ 16 <0>; ++ ti,pressure-max = /bits/ 16 <0xFFFF>; ++ ti,x-plate-ohms = /bits/ 16 <400>; ++ }; ++ }; ++ }; ++ __overrides__ { ++ cs = <&ads7846>,"reg:0"; ++ speed = <&ads7846>,"spi-max-frequency:0"; ++ penirq = <&ads7846_pins>,"brcm,pins:0", /* REQUIRED */ ++ <&ads7846>,"interrupts:0", ++ <&ads7846>,"pendown-gpio:4"; ++ penirq_pull = <&ads7846_pins>,"brcm,pull:0"; ++ swapxy = <&ads7846>,"ti,swap-xy?"; ++ xmin = <&ads7846>,"ti,x-min;0"; ++ ymin = <&ads7846>,"ti,y-min;0"; ++ xmax = <&ads7846>,"ti,x-max;0"; ++ ymax = <&ads7846>,"ti,y-max;0"; ++ pmin = <&ads7846>,"ti,pressure-min;0"; ++ pmax = <&ads7846>,"ti,pressure-max;0"; ++ xohms = <&ads7846>,"ti,x-plate-ohms;0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/akkordion-iqdacplus-overlay.dts b/arch/arm/boot/dts/overlays/akkordion-iqdacplus-overlay.dts +new file mode 100644 +index 0000000..208849d +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/akkordion-iqdacplus-overlay.dts +@@ -0,0 +1,46 @@ ++// Definitions for Digital Dreamtime Akkordion using IQaudIO DAC+ or DACZero ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&i2s>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&i2c1>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ pcm5122@4c { ++ #sound-dai-cells = <0>; ++ compatible = "ti,pcm5122"; ++ reg = <0x4c>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&sound>; ++ frag2: __overlay__ { ++ compatible = "iqaudio,iqaudio-dac"; ++ card_name = "Akkordion"; ++ dai_name = "IQaudIO DAC"; ++ dai_stream_name = "IQaudIO DAC HiFi"; ++ i2s-controller = <&i2s>; ++ status = "okay"; ++ }; ++ }; ++ ++ __overrides__ { ++ 24db_digital_gain = <&frag2>,"iqaudio,24db_digital_gain?"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/at86rf233-overlay.dts b/arch/arm/boot/dts/overlays/at86rf233-overlay.dts +new file mode 100644 +index 0000000..880c753 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/at86rf233-overlay.dts +@@ -0,0 +1,57 @@ ++/dts-v1/; ++/plugin/; ++ ++/* Overlay for Atmel AT86RF233 IEEE 802.15.4 WPAN transceiver on spi0.0 */ ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2836", "brcm,bcm2708", "brcm,bcm2709"; ++ ++ fragment@0 { ++ target = <&spi0>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ status = "okay"; ++ ++ lowpan0: at86rf233@0 { ++ compatible = "atmel,at86rf233"; ++ reg = <0>; ++ interrupt-parent = <&gpio>; ++ interrupts = <23 4>; /* active high */ ++ reset-gpio = <&gpio 24 1>; ++ sleep-gpio = <&gpio 25 1>; ++ spi-max-frequency = <3000000>; ++ xtal-trim = /bits/ 8 <0xf>; ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&spidev0>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&gpio>; ++ __overlay__ { ++ lowpan0_pins: lowpan0_pins { ++ brcm,pins = <23 24 25>; ++ brcm,function = <0 1 1>; /* in out out */ ++ }; ++ }; ++ }; ++ ++ __overrides__ { ++ interrupt = <&lowpan0>, "interrupts:0", ++ <&lowpan0_pins>, "brcm,pins:0"; ++ reset = <&lowpan0>, "reset-gpio:4", ++ <&lowpan0_pins>, "brcm,pins:4"; ++ sleep = <&lowpan0>, "sleep-gpio:4", ++ <&lowpan0_pins>, "brcm,pins:8"; ++ speed = <&lowpan0>, "spi-max-frequency:0"; ++ trim = <&lowpan0>, "xtal-trim.0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/audioinjector-wm8731-audio-overlay.dts b/arch/arm/boot/dts/overlays/audioinjector-wm8731-audio-overlay.dts +new file mode 100644 +index 0000000..4ed66577 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/audioinjector-wm8731-audio-overlay.dts +@@ -0,0 +1,39 @@ ++// Definitions for audioinjector.net audio add on soundcard ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&i2s>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&i2c1>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ wm8731@1a { ++ #sound-dai-cells = <0>; ++ compatible = "wlf,wm8731"; ++ reg = <0x1a>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&sound>; ++ __overlay__ { ++ compatible = "ai,audioinjector-pi-soundcard"; ++ i2s-controller = <&i2s>; ++ status = "okay"; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/bmp085_i2c-sensor-overlay.dts b/arch/arm/boot/dts/overlays/bmp085_i2c-sensor-overlay.dts +new file mode 100644 +index 0000000..782b171 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/bmp085_i2c-sensor-overlay.dts +@@ -0,0 +1,23 @@ ++// Definitions for BMP085/BMP180 digital barometric pressure and temperature sensors from Bosch Sensortec ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&i2c_arm>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ bmp085@77 { ++ compatible = "bosch,bmp085"; ++ reg = <0x77>; ++ default-oversampling = <3>; ++ status = "okay"; ++ }; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/dht11-overlay.dts b/arch/arm/boot/dts/overlays/dht11-overlay.dts +new file mode 100644 +index 0000000..9bf67fd +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/dht11-overlay.dts +@@ -0,0 +1,39 @@ ++/* ++ * Overlay for the DHT11/21/22 humidity/temperature sensor modules. ++ */ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target-path = "/"; ++ __overlay__ { ++ ++ dht11: dht11@0 { ++ compatible = "dht11"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&dht11_pins>; ++ gpios = <&gpio 4 0>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ dht11_pins: dht11_pins { ++ brcm,pins = <4>; ++ brcm,function = <0>; // in ++ brcm,pull = <0>; // off ++ }; ++ }; ++ }; ++ ++ __overrides__ { ++ gpiopin = <&dht11_pins>,"brcm,pins:0", ++ <&dht11>,"gpios:4"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/dpi24-overlay.dts b/arch/arm/boot/dts/overlays/dpi24-overlay.dts +new file mode 100644 +index 0000000..e4dbe40 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/dpi24-overlay.dts +@@ -0,0 +1,31 @@ ++/dts-v1/; ++/plugin/; ++ ++/{ ++ compatible = "brcm,bcm2708"; ++ ++ // There is no DPI driver module, but we need a platform device ++ // node (that doesn't already use pinctrl) to hang the pinctrl ++ // reference on - leds will do ++ ++ fragment@0 { ++ target = <&leds>; ++ __overlay__ { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&dpi24_pins>; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ dpi24_pins: dpi24_pins { ++ brcm,pins = <0 1 2 3 4 5 6 7 8 9 10 11 ++ 12 13 14 15 16 17 18 19 20 ++ 21 22 23 24 25 26 27>; ++ brcm,function = <6>; /* alt2 */ ++ brcm,pull = <0>; /* no pull */ ++ }; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/dwc-otg-overlay.dts b/arch/arm/boot/dts/overlays/dwc-otg-overlay.dts +new file mode 100644 +index 0000000..fc48bd1 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/dwc-otg-overlay.dts +@@ -0,0 +1,20 @@ ++/dts-v1/; ++/plugin/; ++ ++/{ ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&usb>; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ __overlay__ { ++ compatible = "brcm,bcm2708-usb"; ++ reg = <0x7e980000 0x10000>, ++ <0x7e006000 0x1000>; ++ interrupts = <2 0>, ++ <1 9>; ++ status = "okay"; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/dwc2-overlay.dts b/arch/arm/boot/dts/overlays/dwc2-overlay.dts +new file mode 100644 +index 0000000..527abc9 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/dwc2-overlay.dts +@@ -0,0 +1,29 @@ ++/dts-v1/; ++/plugin/; ++ ++/{ ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&usb>; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ dwc2_usb: __overlay__ { ++ compatible = "brcm,bcm2835-usb"; ++ reg = <0x7e980000 0x10000>; ++ interrupts = <1 9>; ++ dr_mode = "otg"; ++ g-np-tx-fifo-size = <32>; ++ g-rx-fifo-size = <256>; ++ g-tx-fifo-size = <256 128 128 64 64 64 32>; ++ status = "okay"; ++ }; ++ }; ++ ++ __overrides__ { ++ dr_mode = <&dwc2_usb>, "dr_mode"; ++ g-np-tx-fifo-size = <&dwc2_usb>,"g-np-tx-fifo-size:0"; ++ g-rx-fifo-size = <&dwc2_usb>,"g-rx-fifo-size:0"; ++ g-tx-fifo-size = <&dwc2_usb>,"g-tx-fifo-size:0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/enc28j60-overlay.dts b/arch/arm/boot/dts/overlays/enc28j60-overlay.dts +new file mode 100644 +index 0000000..db8a8fe +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/enc28j60-overlay.dts +@@ -0,0 +1,53 @@ ++// Overlay for the Microchip ENC28J60 Ethernet Controller ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&spi0>; ++ __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ status = "okay"; ++ ++ eth1: enc28j60@0{ ++ compatible = "microchip,enc28j60"; ++ reg = <0>; /* CE0 */ ++ pinctrl-names = "default"; ++ pinctrl-0 = <&eth1_pins>; ++ interrupt-parent = <&gpio>; ++ interrupts = <25 0x2>; /* falling edge */ ++ spi-max-frequency = <12000000>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&spidev0>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&gpio>; ++ __overlay__ { ++ eth1_pins: eth1_pins { ++ brcm,pins = <25>; ++ brcm,function = <0>; /* in */ ++ brcm,pull = <0>; /* none */ ++ }; ++ }; ++ }; ++ ++ __overrides__ { ++ int_pin = <&eth1>, "interrupts:0", ++ <&eth1_pins>, "brcm,pins:0"; ++ speed = <&eth1>, "spi-max-frequency:0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/gpio-ir-overlay.dts b/arch/arm/boot/dts/overlays/gpio-ir-overlay.dts +new file mode 100644 +index 0000000..a2d6bc7 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/gpio-ir-overlay.dts +@@ -0,0 +1,45 @@ ++// Definitions for ir-gpio module ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target-path = "/"; ++ __overlay__ { ++ gpio_ir: ir-receiver { ++ compatible = "gpio-ir-receiver"; ++ ++ // pin number, high or low ++ gpios = <&gpio 18 1>; ++ ++ // parameter for keymap name ++ linux,rc-map-name = "rc-rc6-mce"; ++ ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ gpio_ir_pins: gpio_ir_pins { ++ brcm,pins = <18>; // pin 18 ++ brcm,function = <0>; // in ++ brcm,pull = <1>; // down ++ }; ++ }; ++ }; ++ ++ __overrides__ { ++ // parameters ++ gpio_pin = <&gpio_ir>,"gpios:4", ++ <&gpio_ir_pins>,"brcm,pins:0", ++ <&gpio_ir_pins>,"brcm,pull:0"; // pin number ++ gpio_pull = <&gpio_ir_pins>,"brcm,pull:0"; // pull-up/down state ++ ++ rc-map-name = <&gpio_ir>,"linux,rc-map-name"; // default rc map ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/gpio-poweroff-overlay.dts b/arch/arm/boot/dts/overlays/gpio-poweroff-overlay.dts +new file mode 100644 +index 0000000..ff8cb36 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/gpio-poweroff-overlay.dts +@@ -0,0 +1,34 @@ ++// Definitions for gpio-poweroff module ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target-path = "/"; ++ __overlay__ { ++ power_ctrl: power_ctrl { ++ compatible = "gpio-poweroff"; ++ gpios = <&gpio 26 0>; ++ force; ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ power_ctrl_pins: power_ctrl_pins { ++ brcm,pins = <26>; ++ brcm,function = <1>; // out ++ }; ++ }; ++ }; ++ ++ __overrides__ { ++ gpiopin = <&power_ctrl>,"gpios:4", ++ <&power_ctrl_pins>,"brcm,pins:0"; ++ active_low = <&power_ctrl>,"gpios:8"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/hifiberry-amp-overlay.dts b/arch/arm/boot/dts/overlays/hifiberry-amp-overlay.dts +new file mode 100644 +index 0000000..5f57855 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/hifiberry-amp-overlay.dts +@@ -0,0 +1,39 @@ ++// Definitions for HiFiBerry Amp/Amp+ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&i2s>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&i2c1>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ tas5713@1b { ++ #sound-dai-cells = <0>; ++ compatible = "ti,tas5713"; ++ reg = <0x1b>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&sound>; ++ __overlay__ { ++ compatible = "hifiberry,hifiberry-amp"; ++ i2s-controller = <&i2s>; ++ status = "okay"; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/hifiberry-dac-overlay.dts b/arch/arm/boot/dts/overlays/hifiberry-dac-overlay.dts +new file mode 100644 +index 0000000..0b74fdc +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/hifiberry-dac-overlay.dts +@@ -0,0 +1,34 @@ ++// Definitions for HiFiBerry DAC ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&i2s>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target-path = "/"; ++ __overlay__ { ++ pcm5102a-codec { ++ #sound-dai-cells = <0>; ++ compatible = "ti,pcm5102a"; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&sound>; ++ __overlay__ { ++ compatible = "hifiberry,hifiberry-dac"; ++ i2s-controller = <&i2s>; ++ status = "okay"; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts b/arch/arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts +new file mode 100644 +index 0000000..2f078d4 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts +@@ -0,0 +1,56 @@ ++// Definitions for HiFiBerry DAC+ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target-path = "/clocks"; ++ __overlay__ { ++ dacpro_osc: dacpro_osc { ++ compatible = "hifiberry,dacpro-clk"; ++ #clock-cells = <0>; ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&i2s>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&i2c1>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ pcm5122@4d { ++ #sound-dai-cells = <0>; ++ compatible = "ti,pcm5122"; ++ reg = <0x4d>; ++ clocks = <&dacpro_osc>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@3 { ++ target = <&sound>; ++ hifiberry_dacplus: __overlay__ { ++ compatible = "hifiberry,hifiberry-dacplus"; ++ i2s-controller = <&i2s>; ++ status = "okay"; ++ }; ++ }; ++ ++ __overrides__ { ++ 24db_digital_gain = ++ <&hifiberry_dacplus>,"hifiberry,24db_digital_gain?"; ++ slave = <&hifiberry_dacplus>,"hifiberry-dacplus,slave?"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/hifiberry-digi-overlay.dts b/arch/arm/boot/dts/overlays/hifiberry-digi-overlay.dts +new file mode 100644 +index 0000000..f5e41f4 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/hifiberry-digi-overlay.dts +@@ -0,0 +1,39 @@ ++// Definitions for HiFiBerry Digi ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&i2s>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&i2c1>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ wm8804@3b { ++ #sound-dai-cells = <0>; ++ compatible = "wlf,wm8804"; ++ reg = <0x3b>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&sound>; ++ __overlay__ { ++ compatible = "hifiberry,hifiberry-digi"; ++ i2s-controller = <&i2s>; ++ status = "okay"; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/hy28a-overlay.dts b/arch/arm/boot/dts/overlays/hy28a-overlay.dts +new file mode 100644 +index 0000000..ac0f3c2 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/hy28a-overlay.dts +@@ -0,0 +1,93 @@ ++/* ++ * Device Tree overlay for HY28A display ++ * ++ */ ++ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; ++ ++ fragment@0 { ++ target = <&spi0>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&spidev0>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&spidev1>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; ++ ++ fragment@3 { ++ target = <&gpio>; ++ __overlay__ { ++ hy28a_pins: hy28a_pins { ++ brcm,pins = <17 25 18>; ++ brcm,function = <0 1 1>; /* in out out */ ++ }; ++ }; ++ }; ++ ++ fragment@4 { ++ target = <&spi0>; ++ __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ hy28a: hy28a@0{ ++ compatible = "ilitek,ili9320"; ++ reg = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&hy28a_pins>; ++ ++ spi-max-frequency = <32000000>; ++ spi-cpol; ++ spi-cpha; ++ rotate = <270>; ++ bgr; ++ fps = <50>; ++ buswidth = <8>; ++ startbyte = <0x70>; ++ reset-gpios = <&gpio 25 0>; ++ led-gpios = <&gpio 18 1>; ++ debug = <0>; ++ }; ++ ++ hy28a_ts: hy28a-ts@1 { ++ compatible = "ti,ads7846"; ++ reg = <1>; ++ ++ spi-max-frequency = <2000000>; ++ interrupts = <17 2>; /* high-to-low edge triggered */ ++ interrupt-parent = <&gpio>; ++ pendown-gpio = <&gpio 17 0>; ++ ti,x-plate-ohms = /bits/ 16 <100>; ++ ti,pressure-max = /bits/ 16 <255>; ++ }; ++ }; ++ }; ++ __overrides__ { ++ speed = <&hy28a>,"spi-max-frequency:0"; ++ rotate = <&hy28a>,"rotate:0"; ++ fps = <&hy28a>,"fps:0"; ++ debug = <&hy28a>,"debug:0"; ++ xohms = <&hy28a_ts>,"ti,x-plate-ohms;0"; ++ resetgpio = <&hy28a>,"reset-gpios:4", ++ <&hy28a_pins>, "brcm,pins:1"; ++ ledgpio = <&hy28a>,"led-gpios:4", ++ <&hy28a_pins>, "brcm,pins:2"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/hy28b-overlay.dts b/arch/arm/boot/dts/overlays/hy28b-overlay.dts +new file mode 100644 +index 0000000..8018aeb +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/hy28b-overlay.dts +@@ -0,0 +1,148 @@ ++/* ++ * Device Tree overlay for HY28b display shield by Texy ++ * ++ */ ++ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; ++ ++ fragment@0 { ++ target = <&spi0>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&spidev0>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&spidev1>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; ++ ++ fragment@3 { ++ target = <&gpio>; ++ __overlay__ { ++ hy28b_pins: hy28b_pins { ++ brcm,pins = <17 25 18>; ++ brcm,function = <0 1 1>; /* in out out */ ++ }; ++ }; ++ }; ++ ++ fragment@4 { ++ target = <&spi0>; ++ __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ hy28b: hy28b@0{ ++ compatible = "ilitek,ili9325"; ++ reg = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&hy28b_pins>; ++ ++ spi-max-frequency = <48000000>; ++ spi-cpol; ++ spi-cpha; ++ rotate = <270>; ++ bgr; ++ fps = <50>; ++ buswidth = <8>; ++ startbyte = <0x70>; ++ reset-gpios = <&gpio 25 0>; ++ led-gpios = <&gpio 18 1>; ++ ++ gamma = "04 1F 4 7 7 0 7 7 6 0\n0F 00 1 7 4 0 0 0 6 7"; ++ ++ init = <0x10000e7 0x0010 ++ 0x1000000 0x0001 ++ 0x1000001 0x0100 ++ 0x1000002 0x0700 ++ 0x1000003 0x1030 ++ 0x1000004 0x0000 ++ 0x1000008 0x0207 ++ 0x1000009 0x0000 ++ 0x100000a 0x0000 ++ 0x100000c 0x0001 ++ 0x100000d 0x0000 ++ 0x100000f 0x0000 ++ 0x1000010 0x0000 ++ 0x1000011 0x0007 ++ 0x1000012 0x0000 ++ 0x1000013 0x0000 ++ 0x2000032 ++ 0x1000010 0x1590 ++ 0x1000011 0x0227 ++ 0x2000032 ++ 0x1000012 0x009c ++ 0x2000032 ++ 0x1000013 0x1900 ++ 0x1000029 0x0023 ++ 0x100002b 0x000e ++ 0x2000032 ++ 0x1000020 0x0000 ++ 0x1000021 0x0000 ++ 0x2000032 ++ 0x1000050 0x0000 ++ 0x1000051 0x00ef ++ 0x1000052 0x0000 ++ 0x1000053 0x013f ++ 0x1000060 0xa700 ++ 0x1000061 0x0001 ++ 0x100006a 0x0000 ++ 0x1000080 0x0000 ++ 0x1000081 0x0000 ++ 0x1000082 0x0000 ++ 0x1000083 0x0000 ++ 0x1000084 0x0000 ++ 0x1000085 0x0000 ++ 0x1000090 0x0010 ++ 0x1000092 0x0000 ++ 0x1000093 0x0003 ++ 0x1000095 0x0110 ++ 0x1000097 0x0000 ++ 0x1000098 0x0000 ++ 0x1000007 0x0133 ++ 0x1000020 0x0000 ++ 0x1000021 0x0000 ++ 0x2000064>; ++ debug = <0>; ++ }; ++ ++ hy28b_ts: hy28b-ts@1 { ++ compatible = "ti,ads7846"; ++ reg = <1>; ++ ++ spi-max-frequency = <2000000>; ++ interrupts = <17 2>; /* high-to-low edge triggered */ ++ interrupt-parent = <&gpio>; ++ pendown-gpio = <&gpio 17 0>; ++ ti,x-plate-ohms = /bits/ 16 <100>; ++ ti,pressure-max = /bits/ 16 <255>; ++ }; ++ }; ++ }; ++ __overrides__ { ++ speed = <&hy28b>,"spi-max-frequency:0"; ++ rotate = <&hy28b>,"rotate:0"; ++ fps = <&hy28b>,"fps:0"; ++ debug = <&hy28b>,"debug:0"; ++ xohms = <&hy28b_ts>,"ti,x-plate-ohms;0"; ++ resetgpio = <&hy28b>,"reset-gpios:4", ++ <&hy28b_pins>, "brcm,pins:1"; ++ ledgpio = <&hy28b>,"led-gpios:4", ++ <&hy28b_pins>, "brcm,pins:2"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/i2c-gpio-overlay.dts b/arch/arm/boot/dts/overlays/i2c-gpio-overlay.dts +new file mode 100644 +index 0000000..2a2dc98 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/i2c-gpio-overlay.dts +@@ -0,0 +1,28 @@ ++// Overlay for i2c_gpio bitbanging host bus. ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target-path = "/"; ++ __overlay__ { ++ i2c_gpio: i2c@0 { ++ compatible = "i2c-gpio"; ++ gpios = <&gpio 23 0 /* sda */ ++ &gpio 24 0 /* scl */ ++ >; ++ i2c-gpio,delay-us = <2>; /* ~100 kHz */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ }; ++ }; ++ }; ++ __overrides__ { ++ i2c_gpio_sda = <&i2c_gpio>,"gpios:4"; ++ i2c_gpio_scl = <&i2c_gpio>,"gpios:16"; ++ i2c_gpio_delay_us = <&i2c_gpio>,"i2c-gpio,delay-us:0"; ++ }; ++}; ++ +diff --git a/arch/arm/boot/dts/overlays/i2c-mux-overlay.dts b/arch/arm/boot/dts/overlays/i2c-mux-overlay.dts +new file mode 100644 +index 0000000..976d38e +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/i2c-mux-overlay.dts +@@ -0,0 +1,139 @@ ++// Umbrella I2C Mux overlay ++ ++/dts-v1/; ++/plugin/; ++ ++/{ ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&i2c_arm>; ++ __dormant__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ pca9542: mux@70 { ++ compatible = "nxp,pca9542"; ++ reg = <0x70>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ i2c@0 { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ reg = <0>; ++ }; ++ i2c@1 { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ reg = <1>; ++ }; ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&i2c_arm>; ++ __dormant__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ pca9545: mux@70 { ++ compatible = "nxp,pca9545"; ++ reg = <0x70>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ i2c@0 { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ reg = <0>; ++ }; ++ i2c@1 { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ reg = <1>; ++ }; ++ i2c@2 { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ reg = <2>; ++ }; ++ i2c@3 { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ reg = <3>; ++ }; ++ }; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&i2c_arm>; ++ __dormant__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ pca9548: mux@70 { ++ compatible = "nxp,pca9548"; ++ reg = <0x70>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ i2c@0 { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ reg = <0>; ++ }; ++ i2c@1 { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ reg = <1>; ++ }; ++ i2c@2 { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ reg = <2>; ++ }; ++ i2c@3 { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ reg = <3>; ++ }; ++ i2c@4 { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ reg = <4>; ++ }; ++ i2c@5 { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ reg = <5>; ++ }; ++ i2c@6 { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ reg = <6>; ++ }; ++ i2c@7 { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ reg = <7>; ++ }; ++ }; ++ }; ++ }; ++ ++ __overrides__ { ++ pca9542 = <0>, "+0"; ++ pca9545 = <0>, "+1"; ++ pca9548 = <0>, "+2"; ++ ++ addr = <&pca9542>,"reg:0", ++ <&pca9545>,"reg:0", ++ <&pca9548>,"reg:0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/i2c-pwm-pca9685a-overlay.dts b/arch/arm/boot/dts/overlays/i2c-pwm-pca9685a-overlay.dts +new file mode 100644 +index 0000000..d1ffd23 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/i2c-pwm-pca9685a-overlay.dts +@@ -0,0 +1,26 @@ ++// Definitions for NXP PCA9685A I2C PWM controller on ARM I2C bus. ++/dts-v1/; ++/plugin/; ++ ++/{ ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&i2c_arm>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ pca: pca@40 { ++ compatible = "nxp,pca9685"; ++ #pwm-cells = <2>; ++ reg = <0x40>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ __overrides__ { ++ addr = <&pca>,"reg:0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts b/arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts +new file mode 100644 +index 0000000..4065647 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts +@@ -0,0 +1,69 @@ ++// Definitions for several I2C based Real Time Clocks ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&i2c_arm>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ ds1307: ds1307@68 { ++ compatible = "maxim,ds1307"; ++ reg = <0x68>; ++ status = "disable"; ++ }; ++ ds1339: ds1339@68 { ++ compatible = "dallas,ds1339"; ++ trickle-resistor-ohms = <0>; ++ reg = <0x68>; ++ status = "disable"; ++ }; ++ mcp7940x: mcp7940x@6f { ++ compatible = "microchip,mcp7940x"; ++ reg = <0x6f>; ++ status = "disable"; ++ }; ++ mcp7941x: mcp7941x@6f { ++ compatible = "microchip,mcp7941x"; ++ reg = <0x6f>; ++ status = "disable"; ++ }; ++ ds3231: ds3231@68 { ++ compatible = "maxim,ds3231"; ++ reg = <0x68>; ++ status = "disable"; ++ }; ++ pcf2127: pcf2127@51 { ++ compatible = "nxp,pcf2127"; ++ reg = <0x51>; ++ status = "disable"; ++ }; ++ pcf8523: pcf8523@68 { ++ compatible = "nxp,pcf8523"; ++ reg = <0x68>; ++ status = "disable"; ++ }; ++ pcf8563: pcf8563@51 { ++ compatible = "nxp,pcf8563"; ++ reg = <0x51>; ++ status = "disable"; ++ }; ++ }; ++ }; ++ __overrides__ { ++ ds1307 = <&ds1307>,"status"; ++ ds1339 = <&ds1339>,"status"; ++ ds3231 = <&ds3231>,"status"; ++ mcp7940x = <&mcp7940x>,"status"; ++ mcp7941x = <&mcp7941x>,"status"; ++ pcf2127 = <&pcf2127>,"status"; ++ pcf8523 = <&pcf8523>,"status"; ++ pcf8563 = <&pcf8563>,"status"; ++ trickle-resistor-ohms = <&ds1339>,"trickle-resistor-ohms:0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/i2c0-bcm2708-overlay.dts b/arch/arm/boot/dts/overlays/i2c0-bcm2708-overlay.dts +new file mode 100644 +index 0000000..1f4fc7b +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/i2c0-bcm2708-overlay.dts +@@ -0,0 +1,61 @@ ++/* ++ * Device tree overlay for i2c_bcm2708, i2c0 bus ++ * ++ * Compile: ++ * dtc -@ -I dts -O dtb -o i2c0-bcm2708-overlay.dtb i2c0-bcm2708-overlay.dts ++ */ ++ ++/dts-v1/; ++/plugin/; ++ ++/{ ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&i2c0>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&i2c0_pins>; ++ frag1: __overlay__ { ++ brcm,pins = <0 1>; ++ brcm,function = <4>; /* alt0 */ ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&i2c0_pins>; ++ __dormant__ { ++ brcm,pins = <28 29>; ++ brcm,function = <4>; /* alt0 */ ++ }; ++ }; ++ ++ fragment@3 { ++ target = <&i2c0_pins>; ++ __dormant__ { ++ brcm,pins = <44 45>; ++ brcm,function = <5>; /* alt1 */ ++ }; ++ }; ++ ++ fragment@4 { ++ target = <&i2c0_pins>; ++ __dormant__ { ++ brcm,pins = <46 47>; ++ brcm,function = <4>; /* alt0 */ ++ }; ++ }; ++ ++ __overrides__ { ++ sda0_pin = <&frag1>,"brcm,pins:0"; ++ scl0_pin = <&frag1>,"brcm,pins:4"; ++ pins_0_1 = <0>,"+1-2-3-4"; ++ pins_28_29 = <0>,"-1+2-3-4"; ++ pins_44_45 = <0>,"-1-2+3-4"; ++ pins_46_47 = <0>,"-1-2-3+4"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/i2c1-bcm2708-overlay.dts b/arch/arm/boot/dts/overlays/i2c1-bcm2708-overlay.dts +new file mode 100644 +index 0000000..e303b9c +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/i2c1-bcm2708-overlay.dts +@@ -0,0 +1,37 @@ ++/* ++ * Device tree overlay for i2c_bcm2708, i2c1 bus ++ * ++ * Compile: ++ * dtc -@ -I dts -O dtb -o i2c1-bcm2708-overlay.dtb i2c1-bcm2708-overlay.dts ++ */ ++ ++/dts-v1/; ++/plugin/; ++ ++/{ ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&i2c1>; ++ __overlay__ { ++ pinctrl-0 = <&i2c1_pins>; ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ i2c1_pins: i2c1 { ++ brcm,pins = <2 3>; ++ brcm,function = <4>; /* alt0 */ ++ }; ++ }; ++ }; ++ ++ __overrides__ { ++ sda1_pin = <&i2c1_pins>,"brcm,pins:0"; ++ scl1_pin = <&i2c1_pins>,"brcm,pins:4"; ++ pin_func = <&i2c1_pins>,"brcm,function:0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/i2s-gpio28-31-overlay.dts b/arch/arm/boot/dts/overlays/i2s-gpio28-31-overlay.dts +new file mode 100644 +index 0000000..30c356d6 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/i2s-gpio28-31-overlay.dts +@@ -0,0 +1,18 @@ ++/* ++ * Device tree overlay to move i2s to gpio 28 to 31 on CM ++ */ ++ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2836", "brcm,bcm2708", "brcm,bcm2709"; ++ ++ fragment@0 { ++ target = <&i2s_pins>; ++ __overlay__ { ++ brcm,pins = <28 29 30 31>; ++ brcm,function = <6>; /* alt2 */ ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/i2s-mmap-overlay.dts b/arch/arm/boot/dts/overlays/i2s-mmap-overlay.dts +new file mode 100644 +index 0000000..a11160a +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/i2s-mmap-overlay.dts +@@ -0,0 +1,13 @@ ++/dts-v1/; ++/plugin/; ++ ++/{ ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&i2s>; ++ __overlay__ { ++ brcm,enable-mmap; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/iqaudio-dac-overlay.dts b/arch/arm/boot/dts/overlays/iqaudio-dac-overlay.dts +new file mode 100644 +index 0000000..0d35c85 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/iqaudio-dac-overlay.dts +@@ -0,0 +1,43 @@ ++// Definitions for IQaudIO DAC ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&i2s>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&i2c1>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ pcm5122@4c { ++ #sound-dai-cells = <0>; ++ compatible = "ti,pcm5122"; ++ reg = <0x4c>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&sound>; ++ frag2: __overlay__ { ++ compatible = "iqaudio,iqaudio-dac"; ++ i2s-controller = <&i2s>; ++ status = "okay"; ++ }; ++ }; ++ ++ __overrides__ { ++ 24db_digital_gain = <&frag2>,"iqaudio,24db_digital_gain?"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/iqaudio-dacplus-overlay.dts b/arch/arm/boot/dts/overlays/iqaudio-dacplus-overlay.dts +new file mode 100644 +index 0000000..1d0663e +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/iqaudio-dacplus-overlay.dts +@@ -0,0 +1,43 @@ ++// Definitions for IQaudIO DAC+ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&i2s>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&i2c1>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ pcm5122@4c { ++ #sound-dai-cells = <0>; ++ compatible = "ti,pcm5122"; ++ reg = <0x4c>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&sound>; ++ frag2: __overlay__ { ++ compatible = "iqaudio,iqaudio-dac"; ++ i2s-controller = <&i2s>; ++ status = "okay"; ++ }; ++ }; ++ ++ __overrides__ { ++ 24db_digital_gain = <&frag2>,"iqaudio,24db_digital_gain?"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/justboom-dac-overlay.dts b/arch/arm/boot/dts/overlays/justboom-dac-overlay.dts +new file mode 100644 +index 0000000..312632a +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/justboom-dac-overlay.dts +@@ -0,0 +1,43 @@ ++// Definitions for JustBoom DAC ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&i2s>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&i2c1>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ pcm5122@4d { ++ #sound-dai-cells = <0>; ++ compatible = "ti,pcm5122"; ++ reg = <0x4d>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&sound>; ++ frag2: __overlay__ { ++ compatible = "justboom,justboom-dac"; ++ i2s-controller = <&i2s>; ++ status = "okay"; ++ }; ++ }; ++ ++ __overrides__ { ++ 24db_digital_gain = <&frag2>,"justboom,24db_digital_gain?"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/justboom-digi-overlay.dts b/arch/arm/boot/dts/overlays/justboom-digi-overlay.dts +new file mode 100644 +index 0000000..cbbede9 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/justboom-digi-overlay.dts +@@ -0,0 +1,39 @@ ++// Definitions for JustBoom Digi ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&i2s>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&i2c1>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ wm8804@3b { ++ #sound-dai-cells = <0>; ++ compatible = "wlf,wm8804"; ++ reg = <0x3b>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&sound>; ++ __overlay__ { ++ compatible = "justboom,justboom-digi"; ++ i2s-controller = <&i2s>; ++ status = "okay"; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/lirc-rpi-overlay.dts b/arch/arm/boot/dts/overlays/lirc-rpi-overlay.dts +new file mode 100644 +index 0000000..7d5d82b +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/lirc-rpi-overlay.dts +@@ -0,0 +1,57 @@ ++// Definitions for lirc-rpi module ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target-path = "/"; ++ __overlay__ { ++ lirc_rpi: lirc_rpi { ++ compatible = "rpi,lirc-rpi"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&lirc_pins>; ++ status = "okay"; ++ ++ // Override autodetection of IR receiver circuit ++ // (0 = active high, 1 = active low, -1 = no override ) ++ rpi,sense = <0xffffffff>; ++ ++ // Software carrier ++ // (0 = off, 1 = on) ++ rpi,softcarrier = <1>; ++ ++ // Invert output ++ // (0 = off, 1 = on) ++ rpi,invert = <0>; ++ ++ // Enable debugging messages ++ // (0 = off, 1 = on) ++ rpi,debug = <0>; ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ lirc_pins: lirc_pins { ++ brcm,pins = <17 18>; ++ brcm,function = <1 0>; // out in ++ brcm,pull = <0 1>; // off down ++ }; ++ }; ++ }; ++ ++ __overrides__ { ++ gpio_out_pin = <&lirc_pins>,"brcm,pins:0"; ++ gpio_in_pin = <&lirc_pins>,"brcm,pins:4"; ++ gpio_in_pull = <&lirc_pins>,"brcm,pull:4"; ++ ++ sense = <&lirc_rpi>,"rpi,sense:0"; ++ softcarrier = <&lirc_rpi>,"rpi,softcarrier:0"; ++ invert = <&lirc_rpi>,"rpi,invert:0"; ++ debug = <&lirc_rpi>,"rpi,debug:0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/mcp23017-overlay.dts b/arch/arm/boot/dts/overlays/mcp23017-overlay.dts +new file mode 100644 +index 0000000..412f966 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/mcp23017-overlay.dts +@@ -0,0 +1,54 @@ ++// Definitions for MCP23017 Gpio Extender from Microchip Semiconductor ++ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; ++ ++ fragment@0 { ++ target = <&i2c1>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ mcp23017_pins: mcp23017_pins { ++ brcm,pins = <4>; ++ brcm,function = <0>; ++ }; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&i2c1>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ mcp23017: mcp@20 { ++ compatible = "microchip,mcp23017"; ++ reg = <0x20>; ++ gpio-controller; ++ #gpio-cells = <2>; ++ #interrupt-cells=<2>; ++ interrupt-parent = <&gpio>; ++ interrupts = <4 2>; ++ interrupt-controller; ++ microchip,irq-mirror; ++ ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ __overrides__ { ++ gpiopin = <&mcp23017_pins>,"brcm,pins:0", ++ <&mcp23017>,"interrupts:0"; ++ addr = <&mcp23017>,"reg:0"; ++ }; ++}; ++ +diff --git a/arch/arm/boot/dts/overlays/mcp2515-can0-overlay.dts b/arch/arm/boot/dts/overlays/mcp2515-can0-overlay.dts +new file mode 100755 +index 0000000..c96cdae +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/mcp2515-can0-overlay.dts +@@ -0,0 +1,73 @@ ++/* ++ * Device tree overlay for mcp251x/can0 on spi0.0 ++ */ ++ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2836", "brcm,bcm2708", "brcm,bcm2709"; ++ /* disable spi-dev for spi0.0 */ ++ fragment@0 { ++ target = <&spi0>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&spidev0>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; ++ ++ /* the interrupt pin of the can-controller */ ++ fragment@2 { ++ target = <&gpio>; ++ __overlay__ { ++ can0_pins: can0_pins { ++ brcm,pins = <25>; ++ brcm,function = <0>; /* input */ ++ }; ++ }; ++ }; ++ ++ /* the clock/oscillator of the can-controller */ ++ fragment@3 { ++ target-path = "/clocks"; ++ __overlay__ { ++ /* external oscillator of mcp2515 on SPI0.0 */ ++ can0_osc: can0_osc { ++ compatible = "fixed-clock"; ++ #clock-cells = <0>; ++ clock-frequency = <16000000>; ++ }; ++ }; ++ }; ++ ++ /* the spi config of the can-controller itself binding everything together */ ++ fragment@4 { ++ target = <&spi0>; ++ __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ can0: mcp2515@0 { ++ reg = <0>; ++ compatible = "microchip,mcp2515"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&can0_pins>; ++ spi-max-frequency = <10000000>; ++ interrupt-parent = <&gpio>; ++ interrupts = <25 0x2>; ++ clocks = <&can0_osc>; ++ }; ++ }; ++ }; ++ __overrides__ { ++ oscillator = <&can0_osc>,"clock-frequency:0"; ++ spimaxfrequency = <&can0>,"spi-max-frequency:0"; ++ interrupt = <&can0_pins>,"brcm,pins:0",<&can0>,"interrupts:0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/mcp2515-can1-overlay.dts b/arch/arm/boot/dts/overlays/mcp2515-can1-overlay.dts +new file mode 100644 +index 0000000..67bd0d9 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/mcp2515-can1-overlay.dts +@@ -0,0 +1,73 @@ ++/* ++ * Device tree overlay for mcp251x/can1 on spi0.1 edited by petit_miner ++ */ ++ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2836", "brcm,bcm2708", "brcm,bcm2709"; ++ /* disable spi-dev for spi0.1 */ ++ fragment@0 { ++ target = <&spi0>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&spidev1>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; ++ ++ /* the interrupt pin of the can-controller */ ++ fragment@2 { ++ target = <&gpio>; ++ __overlay__ { ++ can1_pins: can1_pins { ++ brcm,pins = <25>; ++ brcm,function = <0>; /* input */ ++ }; ++ }; ++ }; ++ ++ /* the clock/oscillator of the can-controller */ ++ fragment@3 { ++ target-path = "/clocks"; ++ __overlay__ { ++ /* external oscillator of mcp2515 on spi0.1 */ ++ can1_osc: can1_osc { ++ compatible = "fixed-clock"; ++ #clock-cells = <0>; ++ clock-frequency = <16000000>; ++ }; ++ }; ++ }; ++ ++ /* the spi config of the can-controller itself binding everything together */ ++ fragment@4 { ++ target = <&spi0>; ++ __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ can1: mcp2515@1 { ++ reg = <1>; ++ compatible = "microchip,mcp2515"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&can1_pins>; ++ spi-max-frequency = <10000000>; ++ interrupt-parent = <&gpio>; ++ interrupts = <25 0x2>; ++ clocks = <&can1_osc>; ++ }; ++ }; ++ }; ++ __overrides__ { ++ oscillator = <&can1_osc>,"clock-frequency:0"; ++ spimaxfrequency = <&can1>,"spi-max-frequency:0"; ++ interrupt = <&can1_pins>,"brcm,pins:0",<&can1>,"interrupts:0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/mmc-overlay.dts b/arch/arm/boot/dts/overlays/mmc-overlay.dts +new file mode 100644 +index 0000000..d32b02c +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/mmc-overlay.dts +@@ -0,0 +1,38 @@ ++/dts-v1/; ++/plugin/; ++ ++/{ ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&mmc>; ++ frag0: __overlay__ { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&mmc_pins>; ++ bus-width = <4>; ++ brcm,overclock-50 = <0>; ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ mmc_pins: mmc_pins { ++ brcm,pins = <48 49 50 51 52 53>; ++ brcm,function = <7>; /* alt3 */ ++ }; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&sdhost>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; ++ ++ __overrides__ { ++ overclock_50 = <&frag0>,"brcm,overclock-50:0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/mz61581-overlay.dts b/arch/arm/boot/dts/overlays/mz61581-overlay.dts +new file mode 100644 +index 0000000..2c29aae +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/mz61581-overlay.dts +@@ -0,0 +1,117 @@ ++/* ++ * Device Tree overlay for MZ61581-PI-EXT 2014.12.28 by Tontec ++ * ++ */ ++ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; ++ ++ fragment@0 { ++ target = <&spi0>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&spidev0>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&spidev1>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; ++ ++ fragment@3 { ++ target = <&gpio>; ++ __overlay__ { ++ mz61581_pins: mz61581_pins { ++ brcm,pins = <4 15 18 25>; ++ brcm,function = <0 1 1 1>; /* in out out out */ ++ }; ++ }; ++ }; ++ ++ fragment@4 { ++ target = <&spi0>; ++ __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ mz61581: mz61581@0{ ++ compatible = "samsung,s6d02a1"; ++ reg = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&mz61581_pins>; ++ ++ spi-max-frequency = <128000000>; ++ spi-cpol; ++ spi-cpha; ++ ++ width = <320>; ++ height = <480>; ++ rotate = <270>; ++ bgr; ++ fps = <30>; ++ buswidth = <8>; ++ txbuflen = <32768>; ++ ++ reset-gpios = <&gpio 15 0>; ++ dc-gpios = <&gpio 25 0>; ++ led-gpios = <&gpio 18 0>; ++ ++ init = <0x10000b0 00 ++ 0x1000011 ++ 0x20000ff ++ 0x10000b3 0x02 0x00 0x00 0x00 ++ 0x10000c0 0x13 0x3b 0x00 0x02 0x00 0x01 0x00 0x43 ++ 0x10000c1 0x08 0x16 0x08 0x08 ++ 0x10000c4 0x11 0x07 0x03 0x03 ++ 0x10000c6 0x00 ++ 0x10000c8 0x03 0x03 0x13 0x5c 0x03 0x07 0x14 0x08 0x00 0x21 0x08 0x14 0x07 0x53 0x0c 0x13 0x03 0x03 0x21 0x00 ++ 0x1000035 0x00 ++ 0x1000036 0xa0 ++ 0x100003a 0x55 ++ 0x1000044 0x00 0x01 ++ 0x10000d0 0x07 0x07 0x1d 0x03 ++ 0x10000d1 0x03 0x30 0x10 ++ 0x10000d2 0x03 0x14 0x04 ++ 0x1000029 ++ 0x100002c>; ++ ++ /* This is a workaround to make sure the init sequence slows down and doesn't fail */ ++ debug = <3>; ++ }; ++ ++ mz61581_ts: mz61581_ts@1 { ++ compatible = "ti,ads7846"; ++ reg = <1>; ++ ++ spi-max-frequency = <2000000>; ++ interrupts = <4 2>; /* high-to-low edge triggered */ ++ interrupt-parent = <&gpio>; ++ pendown-gpio = <&gpio 4 0>; ++ ++ ti,x-plate-ohms = /bits/ 16 <60>; ++ ti,pressure-max = /bits/ 16 <255>; ++ }; ++ }; ++ }; ++ __overrides__ { ++ speed = <&mz61581>, "spi-max-frequency:0"; ++ rotate = <&mz61581>, "rotate:0"; ++ fps = <&mz61581>, "fps:0"; ++ txbuflen = <&mz61581>, "txbuflen:0"; ++ debug = <&mz61581>, "debug:0"; ++ xohms = <&mz61581_ts>,"ti,x-plate-ohms;0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/pi3-act-led-overlay.dts b/arch/arm/boot/dts/overlays/pi3-act-led-overlay.dts +new file mode 100644 +index 0000000..14a59dc +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/pi3-act-led-overlay.dts +@@ -0,0 +1,27 @@ ++/dts-v1/; ++/plugin/; ++ ++/* Pi3 uses a GPIO expander to drive the LEDs which can only be accessed ++ from the VPU. There is a special driver for this with a separate DT node, ++ which has the unfortunate consequence of breaking the act_led_gpio and ++ act_led_activelow dtparams. ++ ++ This overlay changes the GPIO controller back to the standard one and ++ restores the dtparams. ++*/ ++ ++/{ ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&act_led>; ++ frag0: __overlay__ { ++ gpios = <&gpio 0 0>; ++ }; ++ }; ++ ++ __overrides__ { ++ gpio = <&frag0>,"gpios:4"; ++ activelow = <&frag0>,"gpios:8"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/pi3-disable-bt-overlay.dts b/arch/arm/boot/dts/overlays/pi3-disable-bt-overlay.dts +new file mode 100644 +index 0000000..68f6069 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/pi3-disable-bt-overlay.dts +@@ -0,0 +1,46 @@ ++/dts-v1/; ++/plugin/; ++ ++/* Disable Bluetooth and restore UART0/ttyAMA0 over GPIOs 14 & 15. ++ To disable the systemd service that initialises the modem so it doesn't use ++ the UART: ++ ++ sudo systemctl disable hciuart ++*/ ++ ++/{ ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&uart1>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&uart0>; ++ __overlay__ { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&uart0_pins>; ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&uart0_pins>; ++ __overlay__ { ++ brcm,pins; ++ brcm,function; ++ brcm,pull; ++ }; ++ }; ++ ++ fragment@3 { ++ target-path = "/aliases"; ++ __overlay__ { ++ serial0 = "/soc/uart@7e201000"; ++ serial1 = "/soc/uart@7e215040"; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/pi3-miniuart-bt-overlay.dts b/arch/arm/boot/dts/overlays/pi3-miniuart-bt-overlay.dts +new file mode 100644 +index 0000000..17d04cf +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/pi3-miniuart-bt-overlay.dts +@@ -0,0 +1,64 @@ ++/dts-v1/; ++/plugin/; ++ ++/* Switch Pi3 Bluetooth function to use the mini-UART (ttyS0) and restore ++ UART0/ttyAMA0 over GPIOs 14 & 15. Note that this may reduce the maximum ++ usable baudrate. ++ ++ It is also necessary to edit /lib/systemd/system/hciuart.service and ++ replace ttyAMA0 with ttyS0, unless you have a system with udev rules ++ that create /dev/serial0 and /dev/serial1, in which case use /dev/serial1 ++ instead because it will always be correct. ++ ++ If cmdline.txt uses the alias serial0 to refer to the user-accessable port ++ then the firmware will replace with the appropriate port whether or not ++ this overlay is used. ++*/ ++ ++/{ ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&uart0>; ++ __overlay__ { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&uart0_pins>; ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&uart1>; ++ __overlay__ { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&uart1_pins &bt_pins>; ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&uart0_pins>; ++ __overlay__ { ++ brcm,pins; ++ brcm,function; ++ brcm,pull; ++ }; ++ }; ++ ++ fragment@3 { ++ target = <&uart1_pins>; ++ __overlay__ { ++ brcm,pins = <32 33>; ++ brcm,function = <2>; /* alt5=UART1 */ ++ brcm,pull = <0 2>; ++ }; ++ }; ++ ++ fragment@4 { ++ target-path = "/aliases"; ++ __overlay__ { ++ serial0 = "/soc/uart@7e201000"; ++ serial1 = "/soc/uart@7e215040"; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/piscreen-overlay.dts b/arch/arm/boot/dts/overlays/piscreen-overlay.dts +new file mode 100644 +index 0000000..40a1f29 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/piscreen-overlay.dts +@@ -0,0 +1,102 @@ ++/* ++ * Device Tree overlay for PiScreen 3.5" display shield by Ozzmaker ++ * ++ */ ++ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; ++ ++ fragment@0 { ++ target = <&spi0>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&spidev0>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&spidev1>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; ++ ++ fragment@3 { ++ target = <&gpio>; ++ __overlay__ { ++ piscreen_pins: piscreen_pins { ++ brcm,pins = <17 25 24 22>; ++ brcm,function = <0 1 1 1>; /* in out out out */ ++ }; ++ }; ++ }; ++ ++ fragment@4 { ++ target = <&spi0>; ++ __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ piscreen: piscreen@0{ ++ compatible = "ilitek,ili9486"; ++ reg = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&piscreen_pins>; ++ ++ spi-max-frequency = <24000000>; ++ rotate = <270>; ++ bgr; ++ fps = <30>; ++ buswidth = <8>; ++ regwidth = <16>; ++ reset-gpios = <&gpio 25 0>; ++ dc-gpios = <&gpio 24 0>; ++ led-gpios = <&gpio 22 1>; ++ debug = <0>; ++ ++ init = <0x10000b0 0x00 ++ 0x1000011 ++ 0x20000ff ++ 0x100003a 0x55 ++ 0x1000036 0x28 ++ 0x10000c2 0x44 ++ 0x10000c5 0x00 0x00 0x00 0x00 ++ 0x10000e0 0x0f 0x1f 0x1c 0x0c 0x0f 0x08 0x48 0x98 0x37 0x0a 0x13 0x04 0x11 0x0d 0x00 ++ 0x10000e1 0x0f 0x32 0x2e 0x0b 0x0d 0x05 0x47 0x75 0x37 0x06 0x10 0x03 0x24 0x20 0x00 ++ 0x10000e2 0x0f 0x32 0x2e 0x0b 0x0d 0x05 0x47 0x75 0x37 0x06 0x10 0x03 0x24 0x20 0x00 ++ 0x1000011 ++ 0x1000029>; ++ }; ++ ++ piscreen_ts: piscreen-ts@1 { ++ compatible = "ti,ads7846"; ++ reg = <1>; ++ ++ spi-max-frequency = <2000000>; ++ interrupts = <17 2>; /* high-to-low edge triggered */ ++ interrupt-parent = <&gpio>; ++ pendown-gpio = <&gpio 17 0>; ++ ti,swap-xy; ++ ti,x-plate-ohms = /bits/ 16 <100>; ++ ti,pressure-max = /bits/ 16 <255>; ++ }; ++ }; ++ }; ++ __overrides__ { ++ speed = <&piscreen>,"spi-max-frequency:0"; ++ rotate = <&piscreen>,"rotate:0"; ++ fps = <&piscreen>,"fps:0"; ++ debug = <&piscreen>,"debug:0"; ++ xohms = <&piscreen_ts>,"ti,x-plate-ohms;0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/piscreen2r-overlay.dts b/arch/arm/boot/dts/overlays/piscreen2r-overlay.dts +new file mode 100644 +index 0000000..9c0bed8 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/piscreen2r-overlay.dts +@@ -0,0 +1,106 @@ ++ /* ++ * Device Tree overlay for PiScreen2 3.5" TFT with resistive touch by Ozzmaker.com ++ * ++ */ ++ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; ++ ++ fragment@0 { ++ target = <&spi0>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&spidev0>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&spidev1>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; ++ ++ fragment@3 { ++ target = <&gpio>; ++ __overlay__ { ++ piscreen2_pins: piscreen2_pins { ++ brcm,pins = <17 25 24 22>; ++ brcm,function = <0 1 1 1>; /* in out out out */ ++ }; ++ }; ++ }; ++ ++ fragment@4 { ++ target = <&spi0>; ++ __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ piscreen2: piscreen2@0{ ++ compatible = "ilitek,ili9486"; ++ reg = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&piscreen2_pins>; ++ bgr; ++ spi-max-frequency = <64000000>; ++ rotate = <90>; ++ fps = <30>; ++ buswidth = <8>; ++ regwidth = <16>; ++ txbuflen = <32768>; ++ reset-gpios = <&gpio 25 0>; ++ dc-gpios = <&gpio 24 0>; ++ led-gpios = <&gpio 22 1>; ++ debug = <0>; ++ ++ init = <0x10000b0 0x00 ++ 0x1000011 ++ 0x20000ff ++ 0x100003a 0x55 ++ 0x1000036 0x28 ++ 0x10000c0 0x11 0x09 ++ 0x10000c1 0x41 ++ 0x10000c5 0x00 0x00 0x00 0x00 ++ 0x10000b6 0x00 0x02 ++ 0x10000f7 0xa9 0x51 0x2c 0x2 ++ 0x10000be 0x00 0x04 ++ 0x10000e9 0x00 ++ 0x1000011 ++ 0x1000029>; ++ ++ }; ++ ++ piscreen2_ts: piscreen2-ts@1 { ++ compatible = "ti,ads7846"; ++ reg = <1>; ++ ++ spi-max-frequency = <2000000>; ++ interrupts = <17 2>; /* high-to-low edge triggered */ ++ interrupt-parent = <&gpio>; ++ pendown-gpio = <&gpio 17 0>; ++ ti,swap-xy; ++ ti,x-plate-ohms = /bits/ 16 <100>; ++ ti,pressure-max = /bits/ 16 <255>; ++ }; ++ }; ++ }; ++ __overrides__ { ++ speed = <&piscreen2>,"spi-max-frequency:0"; ++ rotate = <&piscreen2>,"rotate:0"; ++ fps = <&piscreen2>,"fps:0"; ++ debug = <&piscreen2>,"debug:0"; ++ xohms = <&piscreen2_ts>,"ti,x-plate-ohms;0"; ++ }; ++}; ++ +diff --git a/arch/arm/boot/dts/overlays/pitft22-overlay.dts b/arch/arm/boot/dts/overlays/pitft22-overlay.dts +new file mode 100644 +index 0000000..894ba22 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/pitft22-overlay.dts +@@ -0,0 +1,69 @@ ++/* ++ * Device Tree overlay for pitft by Adafruit ++ * ++ */ ++ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; ++ ++ fragment@0 { ++ target = <&spi0>; ++ __overlay__ { ++ status = "okay"; ++ ++ spidev@0{ ++ status = "disabled"; ++ }; ++ ++ spidev@1{ ++ status = "disabled"; ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ pitft_pins: pitft_pins { ++ brcm,pins = <25>; ++ brcm,function = <1>; /* out */ ++ brcm,pull = <0>; /* none */ ++ }; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&spi0>; ++ __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ pitft: pitft@0{ ++ compatible = "ilitek,ili9340"; ++ reg = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pitft_pins>; ++ ++ spi-max-frequency = <32000000>; ++ rotate = <90>; ++ fps = <25>; ++ bgr; ++ buswidth = <8>; ++ dc-gpios = <&gpio 25 0>; ++ debug = <0>; ++ }; ++ ++ }; ++ }; ++ ++ __overrides__ { ++ speed = <&pitft>,"spi-max-frequency:0"; ++ rotate = <&pitft>,"rotate:0"; ++ fps = <&pitft>,"fps:0"; ++ debug = <&pitft>,"debug:0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/pitft28-capacitive-overlay.dts b/arch/arm/boot/dts/overlays/pitft28-capacitive-overlay.dts +new file mode 100644 +index 0000000..5c07526 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/pitft28-capacitive-overlay.dts +@@ -0,0 +1,91 @@ ++/* ++ * Device Tree overlay for Adafruit PiTFT 2.8" capacitive touch screen ++ * ++ */ ++ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; ++ ++ fragment@0 { ++ target = <&spi0>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&spidev0>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&gpio>; ++ __overlay__ { ++ pitft_pins: pitft_pins { ++ brcm,pins = <24 25>; ++ brcm,function = <0 1>; /* in out */ ++ brcm,pull = <2 0>; /* pullup none */ ++ }; ++ }; ++ }; ++ ++ fragment@3 { ++ target = <&spi0>; ++ __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ pitft: pitft@0{ ++ compatible = "ilitek,ili9340"; ++ reg = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pitft_pins>; ++ ++ spi-max-frequency = <32000000>; ++ rotate = <90>; ++ fps = <25>; ++ bgr; ++ buswidth = <8>; ++ dc-gpios = <&gpio 25 0>; ++ debug = <0>; ++ }; ++ }; ++ }; ++ ++ fragment@4 { ++ target = <&i2c1>; ++ __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ ft6236: ft6236@38 { ++ compatible = "focaltech,ft6236"; ++ reg = <0x38>; ++ ++ interrupt-parent = <&gpio>; ++ interrupts = <24 2>; ++ touchscreen-size-x = <240>; ++ touchscreen-size-y = <320>; ++ }; ++ }; ++ }; ++ ++ __overrides__ { ++ speed = <&pitft>,"spi-max-frequency:0"; ++ rotate = <&pitft>,"rotate:0"; ++ fps = <&pitft>,"fps:0"; ++ debug = <&pitft>,"debug:0"; ++ touch-sizex = <&ft6236>,"touchscreen-size-x?"; ++ touch-sizey = <&ft6236>,"touchscreen-size-y?"; ++ touch-invx = <&ft6236>,"touchscreen-inverted-x?"; ++ touch-invy = <&ft6236>,"touchscreen-inverted-y?"; ++ touch-swapxy = <&ft6236>,"touchscreen-swapped-x-y?"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/pitft28-resistive-overlay.dts b/arch/arm/boot/dts/overlays/pitft28-resistive-overlay.dts +new file mode 100644 +index 0000000..ed2afc2 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/pitft28-resistive-overlay.dts +@@ -0,0 +1,121 @@ ++/* ++ * Device Tree overlay for Adafruit PiTFT 2.8" resistive touch screen ++ * ++ */ ++ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; ++ ++ fragment@0 { ++ target = <&spi0>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&spidev0>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&spidev1>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; ++ ++ fragment@3 { ++ target = <&gpio>; ++ __overlay__ { ++ pitft_pins: pitft_pins { ++ brcm,pins = <24 25>; ++ brcm,function = <0 1>; /* in out */ ++ brcm,pull = <2 0>; /* pullup none */ ++ }; ++ }; ++ }; ++ ++ fragment@4 { ++ target = <&spi0>; ++ __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ pitft: pitft@0{ ++ compatible = "ilitek,ili9340"; ++ reg = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pitft_pins>; ++ ++ spi-max-frequency = <32000000>; ++ rotate = <90>; ++ fps = <25>; ++ bgr; ++ buswidth = <8>; ++ dc-gpios = <&gpio 25 0>; ++ debug = <0>; ++ }; ++ ++ pitft_ts@1 { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ compatible = "st,stmpe610"; ++ reg = <1>; ++ ++ spi-max-frequency = <500000>; ++ irq-gpio = <&gpio 24 0x2>; /* IRQF_TRIGGER_FALLING */ ++ interrupts = <24 2>; /* high-to-low edge triggered */ ++ interrupt-parent = <&gpio>; ++ interrupt-controller; ++ ++ stmpe_touchscreen { ++ compatible = "st,stmpe-ts"; ++ st,sample-time = <4>; ++ st,mod-12b = <1>; ++ st,ref-sel = <0>; ++ st,adc-freq = <2>; ++ st,ave-ctrl = <3>; ++ st,touch-det-delay = <4>; ++ st,settling = <2>; ++ st,fraction-z = <7>; ++ st,i-drive = <0>; ++ }; ++ ++ stmpe_gpio: stmpe_gpio { ++ #gpio-cells = <2>; ++ compatible = "st,stmpe-gpio"; ++ /* ++ * only GPIO2 is wired/available ++ * and it is wired to the backlight ++ */ ++ st,norequest-mask = <0x7b>; ++ }; ++ }; ++ }; ++ }; ++ ++ fragment@5 { ++ target-path = "/soc"; ++ __overlay__ { ++ backlight { ++ compatible = "gpio-backlight"; ++ gpios = <&stmpe_gpio 2 0>; ++ default-on; ++ }; ++ }; ++ }; ++ ++ __overrides__ { ++ speed = <&pitft>,"spi-max-frequency:0"; ++ rotate = <&pitft>,"rotate:0"; ++ fps = <&pitft>,"fps:0"; ++ debug = <&pitft>,"debug:0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/pps-gpio-overlay.dts b/arch/arm/boot/dts/overlays/pps-gpio-overlay.dts +new file mode 100644 +index 0000000..40bf0e1 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/pps-gpio-overlay.dts +@@ -0,0 +1,34 @@ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ fragment@0 { ++ target-path = "/"; ++ __overlay__ { ++ pps: pps { ++ compatible = "pps-gpio"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pps_pins>; ++ gpios = <&gpio 18 0>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ pps_pins: pps_pins { ++ brcm,pins = <18>; ++ brcm,function = <0>; // in ++ brcm,pull = <0>; // off ++ }; ++ }; ++ }; ++ ++ __overrides__ { ++ gpiopin = <&pps>,"gpios:4", ++ <&pps_pins>,"brcm,pins:0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/pwm-2chan-overlay.dts b/arch/arm/boot/dts/overlays/pwm-2chan-overlay.dts +new file mode 100644 +index 0000000..18e4e4f +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/pwm-2chan-overlay.dts +@@ -0,0 +1,53 @@ ++/dts-v1/; ++/plugin/; ++ ++/* ++This is the 2-channel overlay - only use it if you need both channels. ++ ++Legal pin,function combinations for each channel: ++ PWM0: 12,4(Alt0) 18,2(Alt5) 40,4(Alt0) 52,5(Alt1) ++ PWM1: 13,4(Alt0) 19,2(Alt5) 41,4(Alt0) 45,4(Alt0) 53,5(Alt1) ++ ++N.B.: ++ 1) Pin 18 is the only one available on all platforms, and ++ it is the one used by the I2S audio interface. ++ Pins 12 and 13 might be better choices on an A+, B+ or Pi2. ++ 2) The onboard analogue audio output uses both PWM channels. ++ 3) So be careful mixing audio and PWM. ++*/ ++ ++/ { ++ fragment@0 { ++ target = <&gpio>; ++ __overlay__ { ++ pwm_pins: pwm_pins { ++ brcm,pins = <18 19>; ++ brcm,function = <2 2>; /* Alt5 */ ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&pwm>; ++ __overlay__ { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pwm_pins>; ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&clk_pwm>; ++ frag2: __overlay__ { ++ clock-frequency = <100000000>; ++ }; ++ }; ++ ++ __overrides__ { ++ pin = <&pwm_pins>,"brcm,pins:0"; ++ pin2 = <&pwm_pins>,"brcm,pins:4"; ++ func = <&pwm_pins>,"brcm,function:0"; ++ func2 = <&pwm_pins>,"brcm,function:4"; ++ clock = <&frag2>,"clock-frequency:0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/pwm-overlay.dts b/arch/arm/boot/dts/overlays/pwm-overlay.dts +new file mode 100644 +index 0000000..bf030a6 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/pwm-overlay.dts +@@ -0,0 +1,49 @@ ++/dts-v1/; ++/plugin/; ++ ++/* ++Legal pin,function combinations for each channel: ++ PWM0: 12,4(Alt0) 18,2(Alt5) 40,4(Alt0) 52,5(Alt1) ++ PWM1: 13,4(Alt0) 19,2(Alt5) 41,4(Alt0) 45,4(Alt0) 53,5(Alt1) ++ ++N.B.: ++ 1) Pin 18 is the only one available on all platforms, and ++ it is the one used by the I2S audio interface. ++ Pins 12 and 13 might be better choices on an A+, B+ or Pi2. ++ 2) The onboard analogue audio output uses both PWM channels. ++ 3) So be careful mixing audio and PWM. ++*/ ++ ++/ { ++ fragment@0 { ++ target = <&gpio>; ++ __overlay__ { ++ pwm_pins: pwm_pins { ++ brcm,pins = <18>; ++ brcm,function = <2>; /* Alt5 */ ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&pwm>; ++ __overlay__ { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pwm_pins>; ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&clk_pwm>; ++ frag2: __overlay__ { ++ clock-frequency = <100000000>; ++ }; ++ }; ++ ++ __overrides__ { ++ pin = <&pwm_pins>,"brcm,pins:0"; ++ func = <&pwm_pins>,"brcm,function:0"; ++ clock = <&frag2>,"clock-frequency:0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/qca7000-overlay.dts b/arch/arm/boot/dts/overlays/qca7000-overlay.dts +new file mode 100644 +index 0000000..b4e6013 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/qca7000-overlay.dts +@@ -0,0 +1,52 @@ ++// Overlay for the Qualcomm Atheros QCA7000 on I2SE's PLC Stamp micro EVK ++// Visit: https://www.i2se.com/product/plc-stamp-micro-evk for details ++ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&spi0>; ++ __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ status = "okay"; ++ ++ spidev@0 { ++ status = "disabled"; ++ }; ++ ++ eth1: qca7000@0 { ++ compatible = "qca,qca7000"; ++ reg = <0>; /* CE0 */ ++ pinctrl-names = "default"; ++ pinctrl-0 = <&eth1_pins>; ++ interrupt-parent = <&gpio>; ++ interrupts = <23 0x1>; /* rising edge */ ++ spi-max-frequency = <12000000>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ eth1_pins: eth1_pins { ++ brcm,pins = <23>; ++ brcm,function = <0>; /* in */ ++ brcm,pull = <0>; /* none */ ++ }; ++ }; ++ }; ++ ++ __overrides__ { ++ int_pin = <&eth1>, "interrupts:0", ++ <&eth1_pins>, "brcm,pins:0"; ++ speed = <&eth1>, "spi-max-frequency:0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/raspidac3-overlay.dts b/arch/arm/boot/dts/overlays/raspidac3-overlay.dts +new file mode 100644 +index 0000000..2fac57c +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/raspidac3-overlay.dts +@@ -0,0 +1,45 @@ ++// Definitions for RaspiDACv3 ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&i2s>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&i2c1>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ pcm5122@4c { ++ #sound-dai-cells = <0>; ++ compatible = "ti,pcm5122"; ++ reg = <0x4c>; ++ status = "okay"; ++ }; ++ ++ tpa6130a2: tpa6130a2@60 { ++ compatible = "ti,tpa6130a2"; ++ reg = <0x60>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&sound>; ++ __overlay__ { ++ compatible = "jg,raspidacv3"; ++ i2s-controller = <&i2s>; ++ status = "okay"; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/rpi-backlight-overlay.dts b/arch/arm/boot/dts/overlays/rpi-backlight-overlay.dts +new file mode 100644 +index 0000000..c021d02 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/rpi-backlight-overlay.dts +@@ -0,0 +1,21 @@ ++/* ++ * Devicetree overlay for mailbox-driven Raspberry Pi DSI Display ++ * backlight controller ++ */ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target-path = "/"; ++ __overlay__ { ++ rpi_backlight: rpi_backlight { ++ compatible = "raspberrypi,rpi-backlight"; ++ firmware = <&firmware>; ++ status = "okay"; ++ }; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/rpi-dac-overlay.dts b/arch/arm/boot/dts/overlays/rpi-dac-overlay.dts +new file mode 100644 +index 0000000..1523eae +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/rpi-dac-overlay.dts +@@ -0,0 +1,34 @@ ++// Definitions for RPi DAC ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&i2s>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&soc>; ++ __overlay__ { ++ pcm1794a-codec { ++ #sound-dai-cells = <0>; ++ compatible = "ti,pcm1794a"; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&sound>; ++ __overlay__ { ++ compatible = "rpi,rpi-dac"; ++ i2s-controller = <&i2s>; ++ status = "okay"; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/rpi-display-overlay.dts b/arch/arm/boot/dts/overlays/rpi-display-overlay.dts +new file mode 100644 +index 0000000..d7e72ee +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/rpi-display-overlay.dts +@@ -0,0 +1,89 @@ ++/* ++ * Device Tree overlay for rpi-display by Watterott ++ * ++ */ ++ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; ++ ++ fragment@0 { ++ target = <&spi0>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&spidev0>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&spidev1>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; ++ ++ fragment@3 { ++ target = <&gpio>; ++ __overlay__ { ++ rpi_display_pins: rpi_display_pins { ++ brcm,pins = <18 23 24 25>; ++ brcm,function = <1 1 1 0>; /* out out out in */ ++ brcm,pull = <0 0 0 2>; /* - - - up */ ++ }; ++ }; ++ }; ++ ++ fragment@4 { ++ target = <&spi0>; ++ __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ rpidisplay: rpi-display@0{ ++ compatible = "ilitek,ili9341"; ++ reg = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&rpi_display_pins>; ++ ++ spi-max-frequency = <32000000>; ++ rotate = <270>; ++ bgr; ++ fps = <30>; ++ buswidth = <8>; ++ reset-gpios = <&gpio 23 0>; ++ dc-gpios = <&gpio 24 0>; ++ led-gpios = <&gpio 18 1>; ++ debug = <0>; ++ }; ++ ++ rpidisplay_ts: rpi-display-ts@1 { ++ compatible = "ti,ads7846"; ++ reg = <1>; ++ ++ spi-max-frequency = <2000000>; ++ interrupts = <25 2>; /* high-to-low edge triggered */ ++ interrupt-parent = <&gpio>; ++ pendown-gpio = <&gpio 25 0>; ++ ti,x-plate-ohms = /bits/ 16 <60>; ++ ti,pressure-max = /bits/ 16 <255>; ++ }; ++ }; ++ }; ++ __overrides__ { ++ speed = <&rpidisplay>,"spi-max-frequency:0"; ++ rotate = <&rpidisplay>,"rotate:0"; ++ fps = <&rpidisplay>,"fps:0"; ++ debug = <&rpidisplay>,"debug:0"; ++ xohms = <&rpidisplay_ts>,"ti,x-plate-ohms;0"; ++ swapxy = <&rpidisplay_ts>,"ti,swap-xy?"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/rpi-ft5406-overlay.dts b/arch/arm/boot/dts/overlays/rpi-ft5406-overlay.dts +new file mode 100644 +index 0000000..2e53a17 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/rpi-ft5406-overlay.dts +@@ -0,0 +1,17 @@ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target-path = "/"; ++ __overlay__ { ++ rpi_ft5406: rpi_ft5406 { ++ compatible = "rpi,rpi-ft5406"; ++ firmware = <&firmware>; ++ status = "okay"; ++ }; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/rpi-proto-overlay.dts b/arch/arm/boot/dts/overlays/rpi-proto-overlay.dts +new file mode 100644 +index 0000000..8332d01 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/rpi-proto-overlay.dts +@@ -0,0 +1,39 @@ ++// Definitions for Rpi-Proto ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&i2s>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&i2c1>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ wm8731@1a { ++ #sound-dai-cells = <0>; ++ compatible = "wlf,wm8731"; ++ reg = <0x1a>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&sound>; ++ __overlay__ { ++ compatible = "rpi,rpi-proto"; ++ i2s-controller = <&i2s>; ++ status = "okay"; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/rpi-sense-overlay.dts b/arch/arm/boot/dts/overlays/rpi-sense-overlay.dts +new file mode 100644 +index 0000000..2715324 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/rpi-sense-overlay.dts +@@ -0,0 +1,47 @@ ++// rpi-sense HAT ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708", "brcm,bcm2709"; ++ ++ fragment@0 { ++ target = <&i2c1>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ rpi-sense@46 { ++ compatible = "rpi,rpi-sense"; ++ reg = <0x46>; ++ keys-int-gpios = <&gpio 23 1>; ++ status = "okay"; ++ }; ++ ++ lsm9ds1-magn@1c { ++ compatible = "st,lsm9ds1-magn"; ++ reg = <0x1c>; ++ status = "okay"; ++ }; ++ ++ lsm9ds1-accel6a { ++ compatible = "st,lsm9ds1-accel"; ++ reg = <0x6a>; ++ status = "okay"; ++ }; ++ ++ lps25h-press@5c { ++ compatible = "st,lps25h-press"; ++ reg = <0x5c>; ++ status = "okay"; ++ }; ++ ++ hts221-humid@5f { ++ compatible = "st,hts221-humid"; ++ reg = <0x5f>; ++ status = "okay"; ++ }; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/rra-digidac1-wm8741-audio-overlay.dts b/arch/arm/boot/dts/overlays/rra-digidac1-wm8741-audio-overlay.dts +new file mode 100644 +index 0000000..16b1247 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/rra-digidac1-wm8741-audio-overlay.dts +@@ -0,0 +1,81 @@ ++// Definitions for RRA DigiDAC1 Audio card ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target-path = "/"; ++ __overlay__ { ++ aliases { ++ ldo0 = &ldo0; ++ ldo1 = &ldo1; ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target-path = "/soc"; ++ __overlay__ { ++ ++ ldo1: ldo1 { ++ compatible = "regulator-fixed"; ++ regulator-name = "DC_5V"; ++ regulator-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; ++ regulator-always-on; ++ }; ++ ++ ldo0: ldo0 { ++ compatible = "regulator-fixed"; ++ regulator-name = "DC_3V3"; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ regulator-always-on; ++ }; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&i2s>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@3 { ++ target = <&i2c1>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ wm8804@3b { ++ #sound-dai-cells = <0>; ++ compatible = "wlf,wm8804"; ++ reg = <0x3b>; ++ status = "okay"; ++ PVDD-supply = <&ldo0>; ++ DVDD-supply = <&ldo0>; ++ }; ++ ++ wm8742: wm8741@1a { ++ compatible = "wlf,wm8741"; ++ reg = <0x1a>; ++ status = "okay"; ++ AVDD-supply = <&ldo1>; ++ DVDD-supply = <&ldo0>; ++ }; ++ }; ++ }; ++ ++ fragment@4 { ++ target = <&sound>; ++ __overlay__ { ++ compatible = "rra,digidac1-soundcard"; ++ i2s-controller = <&i2s>; ++ status = "okay"; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/sdhost-overlay.dts b/arch/arm/boot/dts/overlays/sdhost-overlay.dts +new file mode 100644 +index 0000000..a431177 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/sdhost-overlay.dts +@@ -0,0 +1,32 @@ ++/dts-v1/; ++/plugin/; ++ ++/* Provide backwards compatible aliases for the old sdhost dtparams. */ ++ ++/{ ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&sdhost>; ++ frag0: __overlay__ { ++ brcm,overclock-50 = <0>; ++ brcm,pio-limit = <1>; ++ brcm,debug-flags = <0>; ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&mmc>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; ++ ++ __overrides__ { ++ overclock_50 = <&frag0>,"brcm,overclock-50:0"; ++ force_pio = <&frag0>,"brcm,force-pio?"; ++ pio_limit = <&frag0>,"brcm,pio-limit:0"; ++ debug = <&frag0>,"brcm,debug?"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/sdio-1bit-overlay.dts b/arch/arm/boot/dts/overlays/sdio-1bit-overlay.dts +new file mode 100644 +index 0000000..46d4538 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/sdio-1bit-overlay.dts +@@ -0,0 +1,36 @@ ++/* Enable 1-bit SDIO from MMC interface via GPIOs 22-25. Includes sdhost overlay. */ ++ ++/include/ "sdhost-overlay.dts" ++ ++/{ ++ compatible = "brcm,bcm2708"; ++ ++ fragment@3 { ++ target = <&mmc>; ++ sdio_mmc: __overlay__ { ++ compatible = "brcm,bcm2835-mmc"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&sdio_pins>; ++ non-removable; ++ bus-width = <1>; ++ brcm,overclock-50 = <0>; ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@4 { ++ target = <&gpio>; ++ __overlay__ { ++ sdio_pins: sdio_pins { ++ brcm,pins = <22 23 24 25>; ++ brcm,function = <7 7 7 7>; /* ALT3 = SD1 */ ++ brcm,pull = <0 2 2 2>; ++ }; ++ }; ++ }; ++ ++ __overrides__ { ++ poll_once = <&sdio_mmc>,"non-removable?"; ++ sdio_overclock = <&sdio_mmc>,"brcm,overclock-50:0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/sdio-overlay.dts b/arch/arm/boot/dts/overlays/sdio-overlay.dts +new file mode 100644 +index 0000000..398bd81 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/sdio-overlay.dts +@@ -0,0 +1,36 @@ ++/* Enable SDIO from MMC interface via GPIOs 22-27. Includes sdhost overlay. */ ++ ++/include/ "sdhost-overlay.dts" ++ ++/{ ++ compatible = "brcm,bcm2708"; ++ ++ fragment@3 { ++ target = <&mmc>; ++ sdio_mmc: __overlay__ { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&sdio_pins>; ++ non-removable; ++ bus-width = <4>; ++ brcm,overclock-50 = <0>; ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@4 { ++ target = <&gpio>; ++ __overlay__ { ++ sdio_pins: sdio_pins { ++ brcm,pins = <22 23 24 25 26 27>; ++ brcm,function = <7 7 7 7 7 7>; /* ALT3 = SD1 */ ++ brcm,pull = <0 2 2 2 2 2>; ++ }; ++ }; ++ }; ++ ++ __overrides__ { ++ poll_once = <&sdio_mmc>,"non-removable?"; ++ bus_width = <&sdio_mmc>,"bus-width:0"; ++ sdio_overclock = <&sdio_mmc>,"brcm,overclock-50:0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/sdtweak-overlay.dts b/arch/arm/boot/dts/overlays/sdtweak-overlay.dts +new file mode 100644 +index 0000000..e4a4677 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/sdtweak-overlay.dts +@@ -0,0 +1,23 @@ ++/dts-v1/; ++/plugin/; ++ ++/* Provide backwards compatible aliases for the old sdhost dtparams. */ ++ ++/{ ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&sdhost>; ++ frag0: __overlay__ { ++ brcm,overclock-50 = <0>; ++ brcm,pio-limit = <1>; ++ }; ++ }; ++ ++ __overrides__ { ++ overclock_50 = <&frag0>,"brcm,overclock-50:0"; ++ force_pio = <&frag0>,"brcm,force-pio?"; ++ pio_limit = <&frag0>,"brcm,pio-limit:0"; ++ debug = <&frag0>,"brcm,debug?"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/smi-dev-overlay.dts b/arch/arm/boot/dts/overlays/smi-dev-overlay.dts +new file mode 100644 +index 0000000..b610d82 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/smi-dev-overlay.dts +@@ -0,0 +1,18 @@ ++// Description: Overlay to enable character device interface for SMI. ++// Author: Luke Wren <luke@raspberrypi.org> ++ ++/dts-v1/; ++/plugin/; ++ ++/{ ++ fragment@0 { ++ target = <&soc>; ++ __overlay__ { ++ smi_dev { ++ compatible = "brcm,bcm2835-smi-dev"; ++ smi_handle = <&smi>; ++ status = "okay"; ++ }; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/smi-nand-overlay.dts b/arch/arm/boot/dts/overlays/smi-nand-overlay.dts +new file mode 100644 +index 0000000..13ce0b7 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/smi-nand-overlay.dts +@@ -0,0 +1,69 @@ ++// Description: Overlay to enable NAND flash through ++// the secondary memory interface ++// Author: Luke Wren ++ ++/dts-v1/; ++/plugin/; ++ ++/{ ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&smi>; ++ __overlay__ { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&smi_pins>; ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&soc>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ++ nand: flash@0 { ++ compatible = "brcm,bcm2835-smi-nand"; ++ smi_handle = <&smi>; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ status = "okay"; ++ ++ partition@0 { ++ label = "stage2"; ++ // 128k ++ reg = <0 0x20000>; ++ read-only; ++ }; ++ partition@1 { ++ label = "firmware"; ++ // 16M ++ reg = <0x20000 0x1000000>; ++ read-only; ++ }; ++ partition@2 { ++ label = "root"; ++ // 2G (will need to use 64 bit for >=4G) ++ reg = <0x1020000 0x80000000>; ++ }; ++ }; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&gpio>; ++ __overlay__ { ++ smi_pins: smi_pins { ++ brcm,pins = <0 1 2 3 4 5 6 7 8 9 10 11 ++ 12 13 14 15>; ++ /* Alt 1: SMI */ ++ brcm,function = <5 5 5 5 5 5 5 5 5 5 5 ++ 5 5 5 5 5>; ++ /* /CS, /WE and /OE are pulled high, as they are ++ generally active low signals */ ++ brcm,pull = <2 2 2 2 2 2 2 2 0 0 0 0 0 0 0 0>; ++ }; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/smi-overlay.dts b/arch/arm/boot/dts/overlays/smi-overlay.dts +new file mode 100644 +index 0000000..095f52c +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/smi-overlay.dts +@@ -0,0 +1,37 @@ ++// Description: Overlay to enable the secondary memory interface peripheral ++// Author: Luke Wren ++ ++/dts-v1/; ++/plugin/; ++ ++/{ ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&smi>; ++ __overlay__ { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&smi_pins>; ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ smi_pins: smi_pins { ++ /* Don't configure the top two address bits, as ++ these are already used as ID_SD and ID_SC */ ++ brcm,pins = <2 3 4 5 6 7 8 9 10 11 12 13 14 15 ++ 16 17 18 19 20 21 22 23 24 25>; ++ /* Alt 0: SMI */ ++ brcm,function = <5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 ++ 5 5 5 5 5 5 5 5 5>; ++ /* /CS, /WE and /OE are pulled high, as they are ++ generally active low signals */ ++ brcm,pull = <2 2 2 2 2 2 0 0 0 0 0 0 0 0 0 0 0 ++ 0 0 0 0 0 0 0>; ++ }; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/spi-gpio35-39-overlay.dts b/arch/arm/boot/dts/overlays/spi-gpio35-39-overlay.dts +new file mode 100644 +index 0000000..9648063 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/spi-gpio35-39-overlay.dts +@@ -0,0 +1,31 @@ ++/* ++ * Device tree overlay to move spi0 to gpio 35 to 39 on CM ++ */ ++ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2836", "brcm,bcm2708", "brcm,bcm2709"; ++ ++ fragment@0 { ++ target = <&spi0>; ++ __overlay__ { ++ cs-gpios = <&gpio 36 1>, <&gpio 35 1>; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&spi0_cs_pins>; ++ __overlay__ { ++ bcrm,pins = <36 35>; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&spi0_pins>; ++ __overlay__ { ++ bcrm,pins = <37 38 39>; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/spi1-1cs-overlay.dts b/arch/arm/boot/dts/overlays/spi1-1cs-overlay.dts +new file mode 100644 +index 0000000..71c2439 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/spi1-1cs-overlay.dts +@@ -0,0 +1,57 @@ ++/dts-v1/; ++/plugin/; ++ ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; ++ ++ fragment@0 { ++ target = <&gpio>; ++ __overlay__ { ++ spi1_pins: spi1_pins { ++ brcm,pins = <19 20 21>; ++ brcm,function = <3>; /* alt4 */ ++ }; ++ ++ spi1_cs_pins: spi1_cs_pins { ++ brcm,pins = <18>; ++ brcm,function = <1>; /* output */ ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&spi1>; ++ frag1: __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&spi1_pins &spi1_cs_pins>; ++ cs-gpios = <&gpio 18 1>; ++ status = "okay"; ++ ++ spidev1_0: spidev@0 { ++ compatible = "spidev"; ++ reg = <0>; /* CE0 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&aux>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ __overrides__ { ++ cs0_pin = <&spi1_cs_pins>,"brcm,pins:0", ++ <&frag1>,"cs-gpios:4"; ++ cs0_spidev = <&spidev1_0>,"status"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/spi1-2cs-overlay.dts b/arch/arm/boot/dts/overlays/spi1-2cs-overlay.dts +new file mode 100644 +index 0000000..2ae0885 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/spi1-2cs-overlay.dts +@@ -0,0 +1,69 @@ ++/dts-v1/; ++/plugin/; ++ ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; ++ ++ fragment@0 { ++ target = <&gpio>; ++ __overlay__ { ++ spi1_pins: spi1_pins { ++ brcm,pins = <19 20 21>; ++ brcm,function = <3>; /* alt4 */ ++ }; ++ ++ spi1_cs_pins: spi1_cs_pins { ++ brcm,pins = <18 17>; ++ brcm,function = <1>; /* output */ ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&spi1>; ++ frag1: __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&spi1_pins &spi1_cs_pins>; ++ cs-gpios = <&gpio 18 1>, <&gpio 17 1>; ++ status = "okay"; ++ ++ spidev1_0: spidev@0 { ++ compatible = "spidev"; ++ reg = <0>; /* CE0 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ status = "okay"; ++ }; ++ ++ spidev1_1: spidev@1 { ++ compatible = "spidev"; ++ reg = <1>; /* CE1 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&aux>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ __overrides__ { ++ cs0_pin = <&spi1_cs_pins>,"brcm,pins:0", ++ <&frag1>,"cs-gpios:4"; ++ cs1_pin = <&spi1_cs_pins>,"brcm,pins:4", ++ <&frag1>,"cs-gpios:16"; ++ cs0_spidev = <&spidev1_0>,"status"; ++ cs1_spidev = <&spidev1_1>,"status"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/spi1-3cs-overlay.dts b/arch/arm/boot/dts/overlays/spi1-3cs-overlay.dts +new file mode 100644 +index 0000000..8f79044 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/spi1-3cs-overlay.dts +@@ -0,0 +1,81 @@ ++/dts-v1/; ++/plugin/; ++ ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; ++ ++ fragment@0 { ++ target = <&gpio>; ++ __overlay__ { ++ spi1_pins: spi1_pins { ++ brcm,pins = <19 20 21>; ++ brcm,function = <3>; /* alt4 */ ++ }; ++ ++ spi1_cs_pins: spi1_cs_pins { ++ brcm,pins = <18 17 16>; ++ brcm,function = <1>; /* output */ ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&spi1>; ++ frag1: __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&spi1_pins &spi1_cs_pins>; ++ cs-gpios = <&gpio 18 1>, <&gpio 17 1>, <&gpio 16 1>; ++ status = "okay"; ++ ++ spidev1_0: spidev@0 { ++ compatible = "spidev"; ++ reg = <0>; /* CE0 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ status = "okay"; ++ }; ++ ++ spidev1_1: spidev@1 { ++ compatible = "spidev"; ++ reg = <1>; /* CE1 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ status = "okay"; ++ }; ++ ++ spidev1_2: spidev@2 { ++ compatible = "spidev"; ++ reg = <2>; /* CE2 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&aux>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ __overrides__ { ++ cs0_pin = <&spi1_cs_pins>,"brcm,pins:0", ++ <&frag1>,"cs-gpios:4"; ++ cs1_pin = <&spi1_cs_pins>,"brcm,pins:4", ++ <&frag1>,"cs-gpios:16"; ++ cs2_pin = <&spi1_cs_pins>,"brcm,pins:8", ++ <&frag1>,"cs-gpios:28"; ++ cs0_spidev = <&spidev1_0>,"status"; ++ cs1_spidev = <&spidev1_1>,"status"; ++ cs2_spidev = <&spidev1_2>,"status"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/spi2-1cs-overlay.dts b/arch/arm/boot/dts/overlays/spi2-1cs-overlay.dts +new file mode 100644 +index 0000000..6f57bc7 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/spi2-1cs-overlay.dts +@@ -0,0 +1,57 @@ ++/dts-v1/; ++/plugin/; ++ ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; ++ ++ fragment@0 { ++ target = <&gpio>; ++ __overlay__ { ++ spi2_pins: spi2_pins { ++ brcm,pins = <40 41 42>; ++ brcm,function = <3>; /* alt4 */ ++ }; ++ ++ spi2_cs_pins: spi2_cs_pins { ++ brcm,pins = <43>; ++ brcm,function = <1>; /* output */ ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&spi2>; ++ frag1: __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&spi2_pins &spi2_cs_pins>; ++ cs-gpios = <&gpio 43 1>; ++ status = "okay"; ++ ++ spidev2_0: spidev@0 { ++ compatible = "spidev"; ++ reg = <0>; /* CE0 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&aux>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ __overrides__ { ++ cs0_pin = <&spi2_cs_pins>,"brcm,pins:0", ++ <&frag1>,"cs-gpios:4"; ++ cs0_spidev = <&spidev2_0>,"status"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/spi2-2cs-overlay.dts b/arch/arm/boot/dts/overlays/spi2-2cs-overlay.dts +new file mode 100644 +index 0000000..d090631 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/spi2-2cs-overlay.dts +@@ -0,0 +1,69 @@ ++/dts-v1/; ++/plugin/; ++ ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; ++ ++ fragment@0 { ++ target = <&gpio>; ++ __overlay__ { ++ spi2_pins: spi2_pins { ++ brcm,pins = <40 41 42>; ++ brcm,function = <3>; /* alt4 */ ++ }; ++ ++ spi2_cs_pins: spi2_cs_pins { ++ brcm,pins = <43 44>; ++ brcm,function = <1>; /* output */ ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&spi2>; ++ frag1: __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&spi2_pins &spi2_cs_pins>; ++ cs-gpios = <&gpio 43 1>, <&gpio 44 1>; ++ status = "okay"; ++ ++ spidev2_0: spidev@0 { ++ compatible = "spidev"; ++ reg = <0>; /* CE0 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ status = "okay"; ++ }; ++ ++ spidev2_1: spidev@1 { ++ compatible = "spidev"; ++ reg = <1>; /* CE1 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&aux>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ __overrides__ { ++ cs0_pin = <&spi2_cs_pins>,"brcm,pins:0", ++ <&frag1>,"cs-gpios:4"; ++ cs1_pin = <&spi2_cs_pins>,"brcm,pins:4", ++ <&frag1>,"cs-gpios:16"; ++ cs0_spidev = <&spidev2_0>,"status"; ++ cs1_spidev = <&spidev2_1>,"status"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/spi2-3cs-overlay.dts b/arch/arm/boot/dts/overlays/spi2-3cs-overlay.dts +new file mode 100644 +index 0000000..e258672 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/spi2-3cs-overlay.dts +@@ -0,0 +1,81 @@ ++/dts-v1/; ++/plugin/; ++ ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; ++ ++ fragment@0 { ++ target = <&gpio>; ++ __overlay__ { ++ spi2_pins: spi2_pins { ++ brcm,pins = <40 41 42>; ++ brcm,function = <3>; /* alt4 */ ++ }; ++ ++ spi2_cs_pins: spi2_cs_pins { ++ brcm,pins = <43 44 45>; ++ brcm,function = <1>; /* output */ ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&spi2>; ++ frag1: __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&spi2_pins &spi2_cs_pins>; ++ cs-gpios = <&gpio 43 1>, <&gpio 44 1>, <&gpio 45 1>; ++ status = "okay"; ++ ++ spidev2_0: spidev@0 { ++ compatible = "spidev"; ++ reg = <0>; /* CE0 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ status = "okay"; ++ }; ++ ++ spidev2_1: spidev@1 { ++ compatible = "spidev"; ++ reg = <1>; /* CE1 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ status = "okay"; ++ }; ++ ++ spidev2_2: spidev@2 { ++ compatible = "spidev"; ++ reg = <2>; /* CE2 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&aux>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ __overrides__ { ++ cs0_pin = <&spi2_cs_pins>,"brcm,pins:0", ++ <&frag1>,"cs-gpios:4"; ++ cs1_pin = <&spi2_cs_pins>,"brcm,pins:4", ++ <&frag1>,"cs-gpios:16"; ++ cs2_pin = <&spi2_cs_pins>,"brcm,pins:8", ++ <&frag1>,"cs-gpios:28"; ++ cs0_spidev = <&spidev2_0>,"status"; ++ cs1_spidev = <&spidev2_1>,"status"; ++ cs2_spidev = <&spidev2_2>,"status"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/tinylcd35-overlay.dts b/arch/arm/boot/dts/overlays/tinylcd35-overlay.dts +new file mode 100644 +index 0000000..ed2b053 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/tinylcd35-overlay.dts +@@ -0,0 +1,224 @@ ++/* ++ * tinylcd35-overlay.dts ++ * ++ * ------------------------------------------------- ++ * www.tinlylcd.com ++ * ------------------------------------------------- ++ * Device---Driver-----BUS GPIO's ++ * display tinylcd35 spi0.0 25 24 18 ++ * touch ads7846 spi0.1 5 ++ * rtc ds1307 i2c1-0068 ++ * rtc pcf8563 i2c1-0051 ++ * keypad gpio-keys --------- 17 22 27 23 28 ++ * ++ * ++ * TinyLCD.com 3.5 inch TFT ++ * ++ * Version 001 ++ * 5/3/2015 -- Noralf Trønnes Initial Device tree framework ++ * 10/3/2015 -- tinylcd@gmail.com added ds1307 support. ++ * ++ */ ++ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; ++ ++ fragment@0 { ++ target = <&spi0>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&spidev0>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&spidev1>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; ++ ++ fragment@3 { ++ target = <&gpio>; ++ __overlay__ { ++ tinylcd35_pins: tinylcd35_pins { ++ brcm,pins = <25 24 18>; ++ brcm,function = <1>; /* out */ ++ }; ++ tinylcd35_ts_pins: tinylcd35_ts_pins { ++ brcm,pins = <5>; ++ brcm,function = <0>; /* in */ ++ }; ++ keypad_pins: keypad_pins { ++ brcm,pins = <4 17 22 23 27>; ++ brcm,function = <0>; /* in */ ++ brcm,pull = <1>; /* down */ ++ }; ++ }; ++ }; ++ ++ fragment@4 { ++ target = <&spi0>; ++ __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ tinylcd35: tinylcd35@0{ ++ compatible = "neosec,tinylcd"; ++ reg = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&tinylcd35_pins>, ++ <&tinylcd35_ts_pins>; ++ ++ spi-max-frequency = <48000000>; ++ rotate = <270>; ++ fps = <20>; ++ bgr; ++ buswidth = <8>; ++ reset-gpios = <&gpio 25 0>; ++ dc-gpios = <&gpio 24 0>; ++ led-gpios = <&gpio 18 1>; ++ debug = <0>; ++ ++ init = <0x10000B0 0x80 ++ 0x10000C0 0x0A 0x0A ++ 0x10000C1 0x01 0x01 ++ 0x10000C2 0x33 ++ 0x10000C5 0x00 0x42 0x80 ++ 0x10000B1 0xD0 0x11 ++ 0x10000B4 0x02 ++ 0x10000B6 0x00 0x22 0x3B ++ 0x10000B7 0x07 ++ 0x1000036 0x58 ++ 0x10000F0 0x36 0xA5 0xD3 ++ 0x10000E5 0x80 ++ 0x10000E5 0x01 ++ 0x10000B3 0x00 ++ 0x10000E5 0x00 ++ 0x10000F0 0x36 0xA5 0x53 ++ 0x10000E0 0x00 0x35 0x33 0x00 0x00 0x00 0x00 0x35 0x33 0x00 0x00 0x00 ++ 0x100003A 0x55 ++ 0x1000011 ++ 0x2000001 ++ 0x1000029>; ++ }; ++ ++ tinylcd35_ts: tinylcd35_ts@1 { ++ compatible = "ti,ads7846"; ++ reg = <1>; ++ status = "disabled"; ++ ++ spi-max-frequency = <2000000>; ++ interrupts = <5 2>; /* high-to-low edge triggered */ ++ interrupt-parent = <&gpio>; ++ pendown-gpio = <&gpio 5 0>; ++ ti,x-plate-ohms = /bits/ 16 <100>; ++ ti,pressure-max = /bits/ 16 <255>; ++ }; ++ }; ++ }; ++ ++ /* RTC */ ++ ++ fragment@5 { ++ target = <&i2c1>; ++ __dormant__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ status = "okay"; ++ ++ pcf8563: pcf8563@51 { ++ compatible = "nxp,pcf8563"; ++ reg = <0x51>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@6 { ++ target = <&i2c1>; ++ __dormant__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ status = "okay"; ++ ++ ds1307: ds1307@68 { ++ compatible = "maxim,ds1307"; ++ reg = <0x68>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ /* ++ * Values for input event code is found under the ++ * 'Keys and buttons' heading in include/uapi/linux/input.h ++ */ ++ fragment@7 { ++ target-path = "/soc"; ++ __overlay__ { ++ keypad: keypad { ++ compatible = "gpio-keys"; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&keypad_pins>; ++ status = "disabled"; ++ autorepeat; ++ ++ button@17 { ++ label = "GPIO KEY_UP"; ++ linux,code = <103>; ++ gpios = <&gpio 17 0>; ++ }; ++ button@22 { ++ label = "GPIO KEY_DOWN"; ++ linux,code = <108>; ++ gpios = <&gpio 22 0>; ++ }; ++ button@27 { ++ label = "GPIO KEY_LEFT"; ++ linux,code = <105>; ++ gpios = <&gpio 27 0>; ++ }; ++ button@23 { ++ label = "GPIO KEY_RIGHT"; ++ linux,code = <106>; ++ gpios = <&gpio 23 0>; ++ }; ++ button@4 { ++ label = "GPIO KEY_ENTER"; ++ linux,code = <28>; ++ gpios = <&gpio 4 0>; ++ }; ++ }; ++ }; ++ }; ++ ++ __overrides__ { ++ speed = <&tinylcd35>,"spi-max-frequency:0"; ++ rotate = <&tinylcd35>,"rotate:0"; ++ fps = <&tinylcd35>,"fps:0"; ++ debug = <&tinylcd35>,"debug:0"; ++ touch = <&tinylcd35_ts>,"status"; ++ touchgpio = <&tinylcd35_ts_pins>,"brcm,pins:0", ++ <&tinylcd35_ts>,"interrupts:0", ++ <&tinylcd35_ts>,"pendown-gpio:4"; ++ xohms = <&tinylcd35_ts>,"ti,x-plate-ohms;0"; ++ rtc-pcf = <0>,"=5"; ++ rtc-ds = <0>,"=6"; ++ keypad = <&keypad>,"status"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/uart1-overlay.dts b/arch/arm/boot/dts/overlays/uart1-overlay.dts +new file mode 100644 +index 0000000..fa73e1f +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/uart1-overlay.dts +@@ -0,0 +1,38 @@ ++/dts-v1/; ++/plugin/; ++ ++/{ ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&uart1>; ++ __overlay__ { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&uart1_pins>; ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ uart1_pins: uart1_pins { ++ brcm,pins = <14 15>; ++ brcm,function = <2>; /* alt5 */ ++ brcm,pull = <0 2>; ++ }; ++ }; ++ }; ++ ++ fragment@2 { ++ target-path = "/chosen"; ++ __overlay__ { ++ bootargs = "8250.nr_uarts=1"; ++ }; ++ }; ++ ++ __overrides__ { ++ txd1_pin = <&uart1_pins>,"brcm,pins:0"; ++ rxd1_pin = <&uart1_pins>,"brcm,pins:4"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/vc4-kms-v3d-overlay.dts b/arch/arm/boot/dts/overlays/vc4-kms-v3d-overlay.dts +new file mode 100644 +index 0000000..a4ca2ca +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/vc4-kms-v3d-overlay.dts +@@ -0,0 +1,129 @@ ++/* ++ * vc4-kms-v3d-overlay.dts ++ */ ++ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; ++ ++ fragment@0 { ++ target-path = "/chosen"; ++ __overlay__ { ++ bootargs = "cma=256M@256M"; ++ }; ++ }; ++ ++ fragment@1 { ++ target-path = "/chosen"; ++ __dormant__ { ++ bootargs = "cma=192M@256M"; ++ }; ++ }; ++ ++ fragment@2 { ++ target-path = "/chosen"; ++ __dormant__ { ++ bootargs = "cma=128M@128M"; ++ }; ++ }; ++ ++ fragment@3 { ++ target-path = "/chosen"; ++ __dormant__ { ++ bootargs = "cma=96M@128M"; ++ }; ++ }; ++ ++ fragment@4 { ++ target-path = "/chosen"; ++ __dormant__ { ++ bootargs = "cma=64M@64M"; ++ }; ++ }; ++ ++ fragment@5 { ++ target = <&i2c2>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@6 { ++ target = <&cprman>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@7 { ++ target = <&fb>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; ++ ++ fragment@8 { ++ target = <&pixelvalve0>; ++ __overlay__ { ++ interrupts = <2 13>; /* pwa0 */ ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@9 { ++ target = <&pixelvalve1>; ++ __overlay__ { ++ interrupts = <2 14>; /* pwa1 */ ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@10 { ++ target = <&pixelvalve2>; ++ __overlay__ { ++ interrupts = <2 10>; /* pixelvalve */ ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@11 { ++ target = <&hvs>; ++ __overlay__ { ++ interrupts = <2 1>; ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@12 { ++ target = <&hdmi>; ++ __overlay__ { ++ interrupts = <2 8>, <2 9>; ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@13 { ++ target = <&v3d>; ++ __overlay__ { ++ interrupts = <1 10>; ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@14 { ++ target = <&gpu>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ __overrides__ { ++ cma-256 = <0>,"+0-1-2-3-4"; ++ cma-192 = <0>,"-0+1-2-3-4"; ++ cma-128 = <0>,"-0-1+2-3-4"; ++ cma-96 = <0>,"-0-1-2+3-4"; ++ cma-64 = <0>,"-0-1-2-3+4"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/vga666-overlay.dts b/arch/arm/boot/dts/overlays/vga666-overlay.dts +new file mode 100644 +index 0000000..7fcab96 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/vga666-overlay.dts +@@ -0,0 +1,30 @@ ++/dts-v1/; ++/plugin/; ++ ++/{ ++ compatible = "brcm,bcm2708"; ++ ++ // There is no VGA driver module, but we need a platform device ++ // node (that doesn't already use pinctrl) to hang the pinctrl ++ // reference on - leds will do ++ ++ fragment@0 { ++ target = <&leds>; ++ __overlay__ { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&vga666_pins>; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ vga666_pins: vga666_pins { ++ brcm,pins = <2 3 4 5 6 7 8 9 10 11 12 ++ 13 14 15 16 17 18 19 20 21>; ++ brcm,function = <6>; /* alt2 */ ++ brcm,pull = <0>; /* no pull */ ++ }; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/w1-gpio-overlay.dts b/arch/arm/boot/dts/overlays/w1-gpio-overlay.dts +new file mode 100644 +index 0000000..29a3b48 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/w1-gpio-overlay.dts +@@ -0,0 +1,39 @@ ++// Definitions for w1-gpio module (without external pullup) ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target-path = "/"; ++ __overlay__ { ++ ++ w1: onewire@0 { ++ compatible = "w1-gpio"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&w1_pins>; ++ gpios = <&gpio 4 0>; ++ rpi,parasitic-power = <0>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ w1_pins: w1_pins { ++ brcm,pins = <4>; ++ brcm,function = <0>; // in (initially) ++ brcm,pull = <0>; // off ++ }; ++ }; ++ }; ++ ++ __overrides__ { ++ gpiopin = <&w1>,"gpios:4", ++ <&w1_pins>,"brcm,pins:0"; ++ pullup = <&w1>,"rpi,parasitic-power:0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/w1-gpio-pullup-overlay.dts b/arch/arm/boot/dts/overlays/w1-gpio-pullup-overlay.dts +new file mode 100644 +index 0000000..66a98f6 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/w1-gpio-pullup-overlay.dts +@@ -0,0 +1,41 @@ ++// Definitions for w1-gpio module (with external pullup) ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target-path = "/"; ++ __overlay__ { ++ ++ w1: onewire@0 { ++ compatible = "w1-gpio"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&w1_pins>; ++ gpios = <&gpio 4 0>, <&gpio 5 1>; ++ rpi,parasitic-power = <0>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ w1_pins: w1_pins { ++ brcm,pins = <4 5>; ++ brcm,function = <0 1>; // in out ++ brcm,pull = <0 0>; // off off ++ }; ++ }; ++ }; ++ ++ __overrides__ { ++ gpiopin = <&w1>,"gpios:4", ++ <&w1_pins>,"brcm,pins:0"; ++ extpullup = <&w1>,"gpios:16", ++ <&w1_pins>,"brcm,pins:4"; ++ pullup = <&w1>,"rpi,parasitic-power:0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/wittypi-overlay.dts b/arch/arm/boot/dts/overlays/wittypi-overlay.dts +new file mode 100644 +index 0000000..8498134 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/wittypi-overlay.dts +@@ -0,0 +1,44 @@ ++/* ++ * Device Tree overlay for Witty Pi extension board by UUGear ++ * ++ */ ++ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; ++ ++ fragment@0 { ++ target = <&leds>; ++ __overlay__ { ++ compatible = "gpio-leds"; ++ wittypi_led: wittypi_led { ++ label = "wittypi_led"; ++ linux,default-trigger = "default-on"; ++ gpios = <&gpio 17 0>; ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&i2c1>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ rtc: ds1337@68 { ++ compatible = "dallas,ds1337"; ++ reg = <0x68>; ++ wakeup-source; ++ }; ++ }; ++ }; ++ ++ __overrides__ { ++ led_gpio = <&wittypi_led>,"gpios:4"; ++ led_trigger = <&wittypi_led>,"linux,default-trigger"; ++ }; ++ ++}; + +From 548bca82b6fa7a057e5db331334a25c80810dfc7 Mon Sep 17 00:00:00 2001 +From: Phil Elwell <phil@raspberrypi.org> +Date: Fri, 13 Mar 2015 20:00:21 +0000 +Subject: [PATCH 058/112] BCM270X_DT: Add a .dtbo target, use for overlays + +Change the filenames and extensions to keep the pre-DDT style of +overlay (<name>-overlay.dtb) distinct from new ones that use a +different style of local fixups (<name>.dtbo), and to match other +platforms. + +The RPi firmware uses the DDTK trailer atom to choose which type of +overlay to use for each kernel. + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> +--- + arch/arm/boot/.gitignore | 2 +- + scripts/Makefile.dtbinst | 10 +++++++--- + scripts/Makefile.lib | 10 ++++++++++ + 3 files changed, 18 insertions(+), 4 deletions(-) + +diff --git a/arch/arm/boot/.gitignore b/arch/arm/boot/.gitignore +index 3c79f85..eaaeb17 100644 +--- a/arch/arm/boot/.gitignore ++++ b/arch/arm/boot/.gitignore +@@ -3,4 +3,4 @@ zImage + xipImage + bootpImage + uImage +-*.dtb ++*.dtb* +diff --git a/scripts/Makefile.dtbinst b/scripts/Makefile.dtbinst +index a1be75d..ad8dc1c 100644 +--- a/scripts/Makefile.dtbinst ++++ b/scripts/Makefile.dtbinst +@@ -27,6 +27,7 @@ ifeq ("$(dtbinst-root)", "$(obj)") + endif + + dtbinst-files := $(dtb-y) ++dtboinst-files := $(dtbo-y) + dtbinst-dirs := $(dts-dirs) + + # Helper targets for Installing DTBs into the boot directory +@@ -35,15 +36,18 @@ quiet_cmd_dtb_install = INSTALL $< + + install-dir = $(patsubst $(dtbinst-root)%,$(INSTALL_DTBS_PATH)%,$(obj)) + +-$(dtbinst-files) $(dtbinst-dirs): | __dtbs_install_prep ++$(dtbinst-files) $(dtboinst-files) $(dtbinst-dirs): | __dtbs_install_prep + + $(dtbinst-files): %.dtb: $(obj)/%.dtb + $(call cmd,dtb_install,$(install-dir)) + ++$(dtboinst-files): %.dtbo: $(obj)/%.dtbo ++ $(call cmd,dtb_install,$(install-dir)) ++ + $(dtbinst-dirs): + $(Q)$(MAKE) $(dtbinst)=$(obj)/$@ + +-PHONY += $(dtbinst-files) $(dtbinst-dirs) +-__dtbs_install: $(dtbinst-files) $(dtbinst-dirs) ++PHONY += $(dtbinst-files) $(dtboinst-files) $(dtbinst-dirs) ++__dtbs_install: $(dtbinst-files) $(dtboinst-files) $(dtbinst-dirs) + + .PHONY: $(PHONY) +diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib +index ddf83d0..c819ddc 100644 +--- a/scripts/Makefile.lib ++++ b/scripts/Makefile.lib +@@ -306,6 +306,16 @@ cmd_dtc = mkdir -p $(dir ${dtc-tmp}) ; \ + $(obj)/%.dtb: $(src)/%.dts FORCE + $(call if_changed_dep,dtc) + ++quiet_cmd_dtco = DTCO $@ ++cmd_dtco = $(CPP) $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $< ; \ ++ $(objtree)/scripts/dtc/dtc -@ -O dtb -o $@ -b 0 \ ++ -i $(dir $<) $(DTC_FLAGS) \ ++ -d $(depfile).dtc.tmp $(dtc-tmp) ; \ ++ cat $(depfile).pre.tmp $(depfile).dtc.tmp > $(depfile) ++ ++$(obj)/%.dtbo: $(src)/%-overlay.dts FORCE ++ $(call if_changed_dep,dtco) ++ + dtc-tmp = $(subst $(comma),_,$(dot-target).dts.tmp) + + # Bzip2 + +From cea163c683858d514cbdeac63a351a160c1ff4e6 Mon Sep 17 00:00:00 2001 +From: Phil Elwell <phil@raspberrypi.org> +Date: Fri, 8 Apr 2016 17:43:27 +0100 +Subject: [PATCH 059/112] BCM270X_DT: Don't generate "linux,phandle" props + +The EPAPR standard says to use "phandle" properties to store phandles, +rather than the deprecated "linux,phandle" version. By default, dtc +generates both, but adding "-H epapr" causes it to only generate +"phandle"s, saving some space and clutter. + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> +--- + scripts/Makefile.lib | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib +index c819ddc..b36099a 100644 +--- a/scripts/Makefile.lib ++++ b/scripts/Makefile.lib +@@ -308,7 +308,7 @@ $(obj)/%.dtb: $(src)/%.dts FORCE + + quiet_cmd_dtco = DTCO $@ + cmd_dtco = $(CPP) $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $< ; \ +- $(objtree)/scripts/dtc/dtc -@ -O dtb -o $@ -b 0 \ ++ $(objtree)/scripts/dtc/dtc -@ -H epapr -O dtb -o $@ -b 0 \ + -i $(dir $<) $(DTC_FLAGS) \ + -d $(depfile).dtc.tmp $(dtc-tmp) ; \ + cat $(depfile).pre.tmp $(depfile).dtc.tmp > $(depfile) + +From 273e251cd1f6808847b4f04d87a04048f549fb9d Mon Sep 17 00:00:00 2001 +From: Phil Elwell <phil@raspberrypi.org> +Date: Fri, 6 Feb 2015 13:50:57 +0000 +Subject: [PATCH 060/112] BCM270x_DT: Add pwr_led, and the required "input" + trigger + +The "input" trigger makes the associated GPIO an input. This is to support +the Raspberry Pi PWR LED, which is driven by external hardware in normal use. + +N.B. pwr_led is not available on Model A or B boards. + +leds-gpio: Implement the brightness_get method + +The power LED uses some clever logic that means it is driven +by a voltage measuring circuit when configured as input, otherwise +it is driven by the GPIO output value. This patch wires up the +brightness_get method for leds-gpio so that user-space can monitor +the LED value via /sys/class/gpio/led1/brightness. Using the input +trigger this returns an indication of the system power health, +otherwise it is just whatever value the trigger has written most +recently. + +See: https://github.com/raspberrypi/linux/issues/1064 +--- + drivers/leds/leds-gpio.c | 18 +++++++++++- + drivers/leds/trigger/Kconfig | 7 +++++ + drivers/leds/trigger/Makefile | 1 + + drivers/leds/trigger/ledtrig-input.c | 54 ++++++++++++++++++++++++++++++++++++ + include/linux/leds.h | 3 ++ + 5 files changed, 82 insertions(+), 1 deletion(-) + create mode 100644 drivers/leds/trigger/ledtrig-input.c + +diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c +index 61143f5..e98df59 100644 +--- a/drivers/leds/leds-gpio.c ++++ b/drivers/leds/leds-gpio.c +@@ -46,8 +46,15 @@ static void gpio_led_set(struct led_classdev *led_cdev, + led_dat->platform_gpio_blink_set(led_dat->gpiod, level, + NULL, NULL); + led_dat->blinking = 0; ++ } else if (led_dat->cdev.flags & SET_GPIO_INPUT) { ++ gpiod_direction_input(led_dat->gpiod); ++ led_dat->cdev.flags &= ~SET_GPIO_INPUT; ++ } else if (led_dat->cdev.flags & SET_GPIO_OUTPUT) { ++ gpiod_direction_output(led_dat->gpiod, level); ++ led_dat->cdev.flags &= ~SET_GPIO_OUTPUT; + } else { +- if (led_dat->can_sleep) ++ if (led_dat->can_sleep || ++ (led_dat->cdev.flags & (SET_GPIO_INPUT | SET_GPIO_OUTPUT) )) + gpiod_set_value_cansleep(led_dat->gpiod, level); + else + gpiod_set_value(led_dat->gpiod, level); +@@ -61,6 +68,13 @@ static int gpio_led_set_blocking(struct led_classdev *led_cdev, + return 0; + } + ++static enum led_brightness gpio_led_get(struct led_classdev *led_cdev) ++{ ++ struct gpio_led_data *led_dat = ++ container_of(led_cdev, struct gpio_led_data, cdev); ++ return gpiod_get_value_cansleep(led_dat->gpiod) ? LED_FULL : LED_OFF; ++} ++ + static int gpio_blink_set(struct led_classdev *led_cdev, + unsigned long *delay_on, unsigned long *delay_off) + { +@@ -120,6 +134,8 @@ static int create_gpio_led(const struct gpio_led *template, + led_dat->platform_gpio_blink_set = blink_set; + led_dat->cdev.blink_set = gpio_blink_set; + } ++ led_dat->cdev.brightness_set = gpio_led_set; ++ led_dat->cdev.brightness_get = gpio_led_get; + if (template->default_state == LEDS_GPIO_DEFSTATE_KEEP) + state = !!gpiod_get_value_cansleep(led_dat->gpiod); + else +diff --git a/drivers/leds/trigger/Kconfig b/drivers/leds/trigger/Kconfig +index 5bda6a9..eb98cca 100644 +--- a/drivers/leds/trigger/Kconfig ++++ b/drivers/leds/trigger/Kconfig +@@ -108,4 +108,11 @@ config LEDS_TRIGGER_CAMERA + This enables direct flash/torch on/off by the driver, kernel space. + If unsure, say Y. + ++config LEDS_TRIGGER_INPUT ++ tristate "LED Input Trigger" ++ depends on LEDS_TRIGGERS ++ help ++ This allows the GPIOs assigned to be LEDs to be initialised to inputs. ++ If unsure, say Y. ++ + endif # LEDS_TRIGGERS +diff --git a/drivers/leds/trigger/Makefile b/drivers/leds/trigger/Makefile +index 1abf48d..c03afdc 100644 +--- a/drivers/leds/trigger/Makefile ++++ b/drivers/leds/trigger/Makefile +@@ -8,3 +8,4 @@ obj-$(CONFIG_LEDS_TRIGGER_CPU) += ledtrig-cpu.o + obj-$(CONFIG_LEDS_TRIGGER_DEFAULT_ON) += ledtrig-default-on.o + obj-$(CONFIG_LEDS_TRIGGER_TRANSIENT) += ledtrig-transient.o + obj-$(CONFIG_LEDS_TRIGGER_CAMERA) += ledtrig-camera.o ++obj-$(CONFIG_LEDS_TRIGGER_INPUT) += ledtrig-input.o +diff --git a/drivers/leds/trigger/ledtrig-input.c b/drivers/leds/trigger/ledtrig-input.c +new file mode 100644 +index 0000000..27f8ebe +--- /dev/null ++++ b/drivers/leds/trigger/ledtrig-input.c +@@ -0,0 +1,54 @@ ++/* ++ * Set LED GPIO to Input "Trigger" ++ * ++ * Copyright 2015 Phil Elwell <phil@raspberrypi.org> ++ * ++ * Based on Nick Forbes's ledtrig-default-on.c. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 as ++ * published by the Free Software Foundation. ++ * ++ */ ++ ++#include <linux/module.h> ++#include <linux/kernel.h> ++#include <linux/init.h> ++#include <linux/leds.h> ++#include <linux/gpio.h> ++#include "../leds.h" ++ ++static void input_trig_activate(struct led_classdev *led_cdev) ++{ ++ led_cdev->flags |= SET_GPIO_INPUT; ++ led_set_brightness(led_cdev, 0); ++} ++ ++static void input_trig_deactivate(struct led_classdev *led_cdev) ++{ ++ led_cdev->flags |= SET_GPIO_OUTPUT; ++ led_set_brightness(led_cdev, 0); ++} ++ ++static struct led_trigger input_led_trigger = { ++ .name = "input", ++ .activate = input_trig_activate, ++ .deactivate = input_trig_deactivate, ++}; ++ ++static int __init input_trig_init(void) ++{ ++ return led_trigger_register(&input_led_trigger); ++} ++ ++static void __exit input_trig_exit(void) ++{ ++ led_trigger_unregister(&input_led_trigger); ++} ++ ++module_init(input_trig_init); ++module_exit(input_trig_exit); ++ ++MODULE_AUTHOR("Phil Elwell <phil@raspberrypi.org>"); ++MODULE_DESCRIPTION("Set LED GPIO to Input \"trigger\""); ++MODULE_LICENSE("GPL"); +diff --git a/include/linux/leds.h b/include/linux/leds.h +index f203a8f..555cf15 100644 +--- a/include/linux/leds.h ++++ b/include/linux/leds.h +@@ -50,6 +50,9 @@ struct led_classdev { + #define LED_SYSFS_DISABLE (1 << 22) + #define LED_DEV_CAP_FLASH (1 << 23) + #define LED_HW_PLUGGABLE (1 << 24) ++ /* Additions for Raspberry Pi PWR LED */ ++#define SET_GPIO_INPUT (1 << 30) ++#define SET_GPIO_OUTPUT (1 << 31) + + /* Set LED brightness level + * Must not sleep. Use brightness_set_blocking for drivers + +From ea3dfa01346c7b37d14b3b01b82d05fff57903bd Mon Sep 17 00:00:00 2001 +From: Siarhei Siamashka <siarhei.siamashka@gmail.com> +Date: Mon, 17 Jun 2013 13:32:11 +0300 +Subject: [PATCH 061/112] fbdev: add FBIOCOPYAREA ioctl + +Based on the patch authored by Ali Gholami Rudi at + https://lkml.org/lkml/2009/7/13/153 + +Provide an ioctl for userspace applications, but only if this operation +is hardware accelerated (otherwide it does not make any sense). + +Signed-off-by: Siarhei Siamashka <siarhei.siamashka@gmail.com> +--- + drivers/video/fbdev/core/fbmem.c | 30 ++++++++++++++++++++++++++++++ + include/uapi/linux/fb.h | 5 +++++ + 2 files changed, 35 insertions(+) + +diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c +index 4e73b6f..d3a8cc3 100644 +--- a/drivers/video/fbdev/core/fbmem.c ++++ b/drivers/video/fbdev/core/fbmem.c +@@ -1084,6 +1084,25 @@ fb_blank(struct fb_info *info, int blank) + } + EXPORT_SYMBOL(fb_blank); + ++static int fb_copyarea_user(struct fb_info *info, ++ struct fb_copyarea *copy) ++{ ++ int ret = 0; ++ if (!lock_fb_info(info)) ++ return -ENODEV; ++ if (copy->dx + copy->width > info->var.xres || ++ copy->sx + copy->width > info->var.xres || ++ copy->dy + copy->height > info->var.yres || ++ copy->sy + copy->height > info->var.yres) { ++ ret = -EINVAL; ++ goto out; ++ } ++ info->fbops->fb_copyarea(info, copy); ++out: ++ unlock_fb_info(info); ++ return ret; ++} ++ + static long do_fb_ioctl(struct fb_info *info, unsigned int cmd, + unsigned long arg) + { +@@ -1094,6 +1113,7 @@ static long do_fb_ioctl(struct fb_info *info, unsigned int cmd, + struct fb_cmap cmap_from; + struct fb_cmap_user cmap; + struct fb_event event; ++ struct fb_copyarea copy; + void __user *argp = (void __user *)arg; + long ret = 0; + +@@ -1211,6 +1231,15 @@ static long do_fb_ioctl(struct fb_info *info, unsigned int cmd, + unlock_fb_info(info); + console_unlock(); + break; ++ case FBIOCOPYAREA: ++ if (info->flags & FBINFO_HWACCEL_COPYAREA) { ++ /* only provide this ioctl if it is accelerated */ ++ if (copy_from_user(&copy, argp, sizeof(copy))) ++ return -EFAULT; ++ ret = fb_copyarea_user(info, &copy); ++ break; ++ } ++ /* fall through */ + default: + if (!lock_fb_info(info)) + return -ENODEV; +@@ -1365,6 +1394,7 @@ static long fb_compat_ioctl(struct file *file, unsigned int cmd, + case FBIOPAN_DISPLAY: + case FBIOGET_CON2FBMAP: + case FBIOPUT_CON2FBMAP: ++ case FBIOCOPYAREA: + arg = (unsigned long) compat_ptr(arg); + case FBIOBLANK: + ret = do_fb_ioctl(info, cmd, arg); +diff --git a/include/uapi/linux/fb.h b/include/uapi/linux/fb.h +index fb795c3..fa72af0 100644 +--- a/include/uapi/linux/fb.h ++++ b/include/uapi/linux/fb.h +@@ -34,6 +34,11 @@ + #define FBIOPUT_MODEINFO 0x4617 + #define FBIOGET_DISPINFO 0x4618 + #define FBIO_WAITFORVSYNC _IOW('F', 0x20, __u32) ++/* ++ * HACK: use 'z' in order not to clash with any other ioctl numbers which might ++ * be concurrently added to the mainline kernel ++ */ ++#define FBIOCOPYAREA _IOW('z', 0x21, struct fb_copyarea) + + #define FB_TYPE_PACKED_PIXELS 0 /* Packed Pixels */ + #define FB_TYPE_PLANES 1 /* Non interleaved planes */ + +From 3de9d9af98b49cd140532eee17196742d1d875c7 Mon Sep 17 00:00:00 2001 +From: Harm Hanemaaijer <fgenfb@yahoo.com> +Date: Thu, 20 Jun 2013 20:21:39 +0200 +Subject: [PATCH 062/112] Speed up console framebuffer imageblit function + +Especially on platforms with a slower CPU but a relatively high +framebuffer fill bandwidth, like current ARM devices, the existing +console monochrome imageblit function used to draw console text is +suboptimal for common pixel depths such as 16bpp and 32bpp. The existing +code is quite general and can deal with several pixel depths. By creating +special case functions for 16bpp and 32bpp, by far the most common pixel +formats used on modern systems, a significant speed-up is attained +which can be readily felt on ARM-based devices like the Raspberry Pi +and the Allwinner platform, but should help any platform using the +fb layer. + +The special case functions allow constant folding, eliminating a number +of instructions including divide operations, and allow the use of an +unrolled loop, eliminating instructions with a variable shift size, +reducing source memory access instructions, and eliminating excessive +branching. These unrolled loops also allow much better code optimization +by the C compiler. The code that selects which optimized variant is used +is also simplified, eliminating integer divide instructions. + +The speed-up, measured by timing 'cat file.txt' in the console, varies +between 40% and 70%, when testing on the Raspberry Pi and Allwinner +ARM-based platforms, depending on font size and the pixel depth, with +the greater benefit for 32bpp. + +Signed-off-by: Harm Hanemaaijer <fgenfb@yahoo.com> +--- + drivers/video/fbdev/core/cfbimgblt.c | 152 +++++++++++++++++++++++++++++++++-- + 1 file changed, 147 insertions(+), 5 deletions(-) + +diff --git a/drivers/video/fbdev/core/cfbimgblt.c b/drivers/video/fbdev/core/cfbimgblt.c +index a2bb276..436494f 100644 +--- a/drivers/video/fbdev/core/cfbimgblt.c ++++ b/drivers/video/fbdev/core/cfbimgblt.c +@@ -28,6 +28,11 @@ + * + * Also need to add code to deal with cards endians that are different than + * the native cpu endians. I also need to deal with MSB position in the word. ++ * Modified by Harm Hanemaaijer (fgenfb@yahoo.com) 2013: ++ * - Provide optimized versions of fast_imageblit for 16 and 32bpp that are ++ * significantly faster than the previous implementation. ++ * - Simplify the fast/slow_imageblit selection code, avoiding integer ++ * divides. + */ + #include <linux/module.h> + #include <linux/string.h> +@@ -262,6 +267,133 @@ static inline void fast_imageblit(const struct fb_image *image, struct fb_info * + } + } + ++/* ++ * Optimized fast_imageblit for bpp == 16. ppw = 2, bit_mask = 3 folded ++ * into the code, main loop unrolled. ++ */ ++ ++static inline void fast_imageblit16(const struct fb_image *image, ++ struct fb_info *p, u8 __iomem * dst1, ++ u32 fgcolor, u32 bgcolor) ++{ ++ u32 fgx = fgcolor, bgx = bgcolor; ++ u32 spitch = (image->width + 7) / 8; ++ u32 end_mask, eorx; ++ const char *s = image->data, *src; ++ u32 __iomem *dst; ++ const u32 *tab = NULL; ++ int i, j, k; ++ ++ tab = fb_be_math(p) ? cfb_tab16_be : cfb_tab16_le; ++ ++ fgx <<= 16; ++ bgx <<= 16; ++ fgx |= fgcolor; ++ bgx |= bgcolor; ++ ++ eorx = fgx ^ bgx; ++ k = image->width / 2; ++ ++ for (i = image->height; i--;) { ++ dst = (u32 __iomem *) dst1; ++ src = s; ++ ++ j = k; ++ while (j >= 4) { ++ u8 bits = *src; ++ end_mask = tab[(bits >> 6) & 3]; ++ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); ++ end_mask = tab[(bits >> 4) & 3]; ++ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); ++ end_mask = tab[(bits >> 2) & 3]; ++ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); ++ end_mask = tab[bits & 3]; ++ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); ++ src++; ++ j -= 4; ++ } ++ if (j != 0) { ++ u8 bits = *src; ++ end_mask = tab[(bits >> 6) & 3]; ++ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); ++ if (j >= 2) { ++ end_mask = tab[(bits >> 4) & 3]; ++ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); ++ if (j == 3) { ++ end_mask = tab[(bits >> 2) & 3]; ++ FB_WRITEL((end_mask & eorx) ^ bgx, dst); ++ } ++ } ++ } ++ dst1 += p->fix.line_length; ++ s += spitch; ++ } ++} ++ ++/* ++ * Optimized fast_imageblit for bpp == 32. ppw = 1, bit_mask = 1 folded ++ * into the code, main loop unrolled. ++ */ ++ ++static inline void fast_imageblit32(const struct fb_image *image, ++ struct fb_info *p, u8 __iomem * dst1, ++ u32 fgcolor, u32 bgcolor) ++{ ++ u32 fgx = fgcolor, bgx = bgcolor; ++ u32 spitch = (image->width + 7) / 8; ++ u32 end_mask, eorx; ++ const char *s = image->data, *src; ++ u32 __iomem *dst; ++ const u32 *tab = NULL; ++ int i, j, k; ++ ++ tab = cfb_tab32; ++ ++ eorx = fgx ^ bgx; ++ k = image->width; ++ ++ for (i = image->height; i--;) { ++ dst = (u32 __iomem *) dst1; ++ src = s; ++ ++ j = k; ++ while (j >= 8) { ++ u8 bits = *src; ++ end_mask = tab[(bits >> 7) & 1]; ++ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); ++ end_mask = tab[(bits >> 6) & 1]; ++ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); ++ end_mask = tab[(bits >> 5) & 1]; ++ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); ++ end_mask = tab[(bits >> 4) & 1]; ++ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); ++ end_mask = tab[(bits >> 3) & 1]; ++ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); ++ end_mask = tab[(bits >> 2) & 1]; ++ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); ++ end_mask = tab[(bits >> 1) & 1]; ++ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); ++ end_mask = tab[bits & 1]; ++ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); ++ src++; ++ j -= 8; ++ } ++ if (j != 0) { ++ u32 bits = (u32) * src; ++ while (j > 1) { ++ end_mask = tab[(bits >> 7) & 1]; ++ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); ++ bits <<= 1; ++ j--; ++ } ++ end_mask = tab[(bits >> 7) & 1]; ++ FB_WRITEL((end_mask & eorx) ^ bgx, dst); ++ } ++ dst1 += p->fix.line_length; ++ s += spitch; ++ } ++} ++ + void cfb_imageblit(struct fb_info *p, const struct fb_image *image) + { + u32 fgcolor, bgcolor, start_index, bitstart, pitch_index = 0; +@@ -294,11 +426,21 @@ void cfb_imageblit(struct fb_info *p, const struct fb_image *image) + bgcolor = image->bg_color; + } + +- if (32 % bpp == 0 && !start_index && !pitch_index && +- ((width & (32/bpp-1)) == 0) && +- bpp >= 8 && bpp <= 32) +- fast_imageblit(image, p, dst1, fgcolor, bgcolor); +- else ++ if (!start_index && !pitch_index) { ++ if (bpp == 32) ++ fast_imageblit32(image, p, dst1, fgcolor, ++ bgcolor); ++ else if (bpp == 16 && (width & 1) == 0) ++ fast_imageblit16(image, p, dst1, fgcolor, ++ bgcolor); ++ else if (bpp == 8 && (width & 3) == 0) ++ fast_imageblit(image, p, dst1, fgcolor, ++ bgcolor); ++ else ++ slow_imageblit(image, p, dst1, fgcolor, ++ bgcolor, ++ start_index, pitch_index); ++ } else + slow_imageblit(image, p, dst1, fgcolor, bgcolor, + start_index, pitch_index); + } else + +From fe2e696dfa4ad9e5a5f6c772efc6be7e8aba5a75 Mon Sep 17 00:00:00 2001 +From: popcornmix <popcornmix@gmail.com> +Date: Wed, 8 May 2013 11:46:50 +0100 +Subject: [PATCH 063/112] enabling the realtime clock 1-wire chip DS1307 and + 1-wire on GPIO4 (as a module) + +1-wire: Add support for configuring pin for w1-gpio kernel module +See: https://github.com/raspberrypi/linux/pull/457 + +Add bitbanging pullups, use them for w1-gpio + +Allows parasite power to work, uses module option pullup=1 + +bcm2708: Ensure 1-wire pullup is disabled by default, and expose as module parameter + +Signed-off-by: Alex J Lennon <ajlennon@dynamicdevices.co.uk> + +w1-gpio: Add gpiopin module parameter and correctly free up gpio pull-up pin, if set + +Signed-off-by: Alex J Lennon <ajlennon@dynamicdevices.co.uk> + +w1-gpio: Sort out the pullup/parasitic power tangle +--- + drivers/w1/masters/w1-gpio.c | 69 ++++++++++++++++++++++++++++++++++++++++---- + drivers/w1/w1.h | 6 ++++ + drivers/w1/w1_int.c | 14 +++++++++ + drivers/w1/w1_io.c | 18 ++++++++++-- + include/linux/w1-gpio.h | 1 + + 5 files changed, 99 insertions(+), 9 deletions(-) + +diff --git a/drivers/w1/masters/w1-gpio.c b/drivers/w1/masters/w1-gpio.c +index a373ae6..080e597 100644 +--- a/drivers/w1/masters/w1-gpio.c ++++ b/drivers/w1/masters/w1-gpio.c +@@ -23,6 +23,19 @@ + #include "../w1.h" + #include "../w1_int.h" + ++static int w1_gpio_pullup = 0; ++static int w1_gpio_pullup_orig = 0; ++module_param_named(pullup, w1_gpio_pullup, int, 0); ++MODULE_PARM_DESC(pullup, "Enable parasitic power (power on data) mode"); ++static int w1_gpio_pullup_pin = -1; ++static int w1_gpio_pullup_pin_orig = -1; ++module_param_named(extpullup, w1_gpio_pullup_pin, int, 0); ++MODULE_PARM_DESC(extpullup, "GPIO external pullup pin number"); ++static int w1_gpio_pin = -1; ++static int w1_gpio_pin_orig = -1; ++module_param_named(gpiopin, w1_gpio_pin, int, 0); ++MODULE_PARM_DESC(gpiopin, "GPIO pin number"); ++ + static u8 w1_gpio_set_pullup(void *data, int delay) + { + struct w1_gpio_platform_data *pdata = data; +@@ -67,6 +80,16 @@ static u8 w1_gpio_read_bit(void *data) + return gpio_get_value(pdata->pin) ? 1 : 0; + } + ++static void w1_gpio_bitbang_pullup(void *data, u8 on) ++{ ++ struct w1_gpio_platform_data *pdata = data; ++ ++ if (on) ++ gpio_direction_output(pdata->pin, 1); ++ else ++ gpio_direction_input(pdata->pin); ++} ++ + #if defined(CONFIG_OF) + static const struct of_device_id w1_gpio_dt_ids[] = { + { .compatible = "w1-gpio" }, +@@ -80,6 +103,7 @@ static int w1_gpio_probe_dt(struct platform_device *pdev) + struct w1_gpio_platform_data *pdata = dev_get_platdata(&pdev->dev); + struct device_node *np = pdev->dev.of_node; + int gpio; ++ u32 value; + + pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); + if (!pdata) +@@ -88,6 +112,9 @@ static int w1_gpio_probe_dt(struct platform_device *pdev) + if (of_get_property(np, "linux,open-drain", NULL)) + pdata->is_open_drain = 1; + ++ if (of_property_read_u32(np, "rpi,parasitic-power", &value) == 0) ++ pdata->parasitic_power = (value != 0); ++ + gpio = of_get_gpio(np, 0); + if (gpio < 0) { + if (gpio != -EPROBE_DEFER) +@@ -103,7 +130,7 @@ static int w1_gpio_probe_dt(struct platform_device *pdev) + if (gpio == -EPROBE_DEFER) + return gpio; + /* ignore other errors as the pullup gpio is optional */ +- pdata->ext_pullup_enable_pin = gpio; ++ pdata->ext_pullup_enable_pin = (gpio >= 0) ? gpio : -1; + + pdev->dev.platform_data = pdata; + +@@ -113,13 +140,15 @@ static int w1_gpio_probe_dt(struct platform_device *pdev) + static int w1_gpio_probe(struct platform_device *pdev) + { + struct w1_bus_master *master; +- struct w1_gpio_platform_data *pdata; ++ struct w1_gpio_platform_data *pdata = pdev->dev.platform_data; + int err; + +- if (of_have_populated_dt()) { +- err = w1_gpio_probe_dt(pdev); +- if (err < 0) +- return err; ++ if(pdata == NULL) { ++ if (of_have_populated_dt()) { ++ err = w1_gpio_probe_dt(pdev); ++ if (err < 0) ++ return err; ++ } + } + + pdata = dev_get_platdata(&pdev->dev); +@@ -136,6 +165,22 @@ static int w1_gpio_probe(struct platform_device *pdev) + return -ENOMEM; + } + ++ w1_gpio_pin_orig = pdata->pin; ++ w1_gpio_pullup_pin_orig = pdata->ext_pullup_enable_pin; ++ w1_gpio_pullup_orig = pdata->parasitic_power; ++ ++ if(gpio_is_valid(w1_gpio_pin)) { ++ pdata->pin = w1_gpio_pin; ++ pdata->ext_pullup_enable_pin = -1; ++ pdata->parasitic_power = -1; ++ } ++ pdata->parasitic_power |= w1_gpio_pullup; ++ if(gpio_is_valid(w1_gpio_pullup_pin)) { ++ pdata->ext_pullup_enable_pin = w1_gpio_pullup_pin; ++ } ++ ++ dev_info(&pdev->dev, "gpio pin %d, external pullup pin %d, parasitic power %d\n", pdata->pin, pdata->ext_pullup_enable_pin, pdata->parasitic_power); ++ + err = devm_gpio_request(&pdev->dev, pdata->pin, "w1"); + if (err) { + dev_err(&pdev->dev, "gpio_request (pin) failed\n"); +@@ -165,6 +210,14 @@ static int w1_gpio_probe(struct platform_device *pdev) + master->set_pullup = w1_gpio_set_pullup; + } + ++ if (pdata->parasitic_power) { ++ if (pdata->is_open_drain) ++ printk(KERN_ERR "w1-gpio 'pullup'(parasitic power) " ++ "option doesn't work with open drain GPIO\n"); ++ else ++ master->bitbang_pullup = w1_gpio_bitbang_pullup; ++ } ++ + err = w1_add_master_device(master); + if (err) { + dev_err(&pdev->dev, "w1_add_master device failed\n"); +@@ -195,6 +248,10 @@ static int w1_gpio_remove(struct platform_device *pdev) + + w1_remove_master_device(master); + ++ pdata->pin = w1_gpio_pin_orig; ++ pdata->ext_pullup_enable_pin = w1_gpio_pullup_pin_orig; ++ pdata->parasitic_power = w1_gpio_pullup_orig; ++ + return 0; + } + +diff --git a/drivers/w1/w1.h b/drivers/w1/w1.h +index 56a49ba..881d728 100644 +--- a/drivers/w1/w1.h ++++ b/drivers/w1/w1.h +@@ -171,6 +171,12 @@ struct w1_bus_master + + u8 (*set_pullup)(void *, int); + ++ /** ++ * Turns the pullup on/off in bitbanging mode, takes an on/off argument. ++ * @return -1=Error, 0=completed ++ */ ++ void (*bitbang_pullup) (void *, u8); ++ + void (*search)(void *, struct w1_master *, + u8, w1_slave_found_callback); + }; +diff --git a/drivers/w1/w1_int.c b/drivers/w1/w1_int.c +index 20f766a..c4fbdb1 100644 +--- a/drivers/w1/w1_int.c ++++ b/drivers/w1/w1_int.c +@@ -122,6 +122,20 @@ int w1_add_master_device(struct w1_bus_master *master) + return(-EINVAL); + } + ++ /* bitbanging hardware uses bitbang_pullup, other hardware uses set_pullup ++ * and takes care of timing itself */ ++ if (!master->write_byte && !master->touch_bit && master->set_pullup) { ++ printk(KERN_ERR "w1_add_master_device: set_pullup requires " ++ "write_byte or touch_bit, disabling\n"); ++ master->set_pullup = NULL; ++ } ++ ++ if (master->set_pullup && master->bitbang_pullup) { ++ printk(KERN_ERR "w1_add_master_device: set_pullup should not " ++ "be set when bitbang_pullup is used, disabling\n"); ++ master->set_pullup = NULL; ++ } ++ + /* Lock until the device is added (or not) to w1_masters. */ + mutex_lock(&w1_mlock); + /* Search for the first available id (starting at 1). */ +diff --git a/drivers/w1/w1_io.c b/drivers/w1/w1_io.c +index 2820924..fd0550f 100644 +--- a/drivers/w1/w1_io.c ++++ b/drivers/w1/w1_io.c +@@ -134,10 +134,22 @@ static void w1_pre_write(struct w1_master *dev) + static void w1_post_write(struct w1_master *dev) + { + if (dev->pullup_duration) { +- if (dev->enable_pullup && dev->bus_master->set_pullup) +- dev->bus_master->set_pullup(dev->bus_master->data, 0); +- else ++ if (dev->enable_pullup) { ++ if (dev->bus_master->set_pullup) { ++ dev->bus_master->set_pullup(dev-> ++ bus_master->data, ++ 0); ++ } else if (dev->bus_master->bitbang_pullup) { ++ dev->bus_master-> ++ bitbang_pullup(dev->bus_master->data, 1); ++ msleep(dev->pullup_duration); ++ dev->bus_master-> ++ bitbang_pullup(dev->bus_master->data, 0); ++ } ++ } else { + msleep(dev->pullup_duration); ++ } ++ + dev->pullup_duration = 0; + } + } +diff --git a/include/linux/w1-gpio.h b/include/linux/w1-gpio.h +index d58594a..feae942 100644 +--- a/include/linux/w1-gpio.h ++++ b/include/linux/w1-gpio.h +@@ -18,6 +18,7 @@ + struct w1_gpio_platform_data { + unsigned int pin; + unsigned int is_open_drain:1; ++ unsigned int parasitic_power:1; + void (*enable_external_pullup)(int enable); + unsigned int ext_pullup_enable_pin; + unsigned int pullup_duration; + +From 8f8fe914a218412e705869e5ca6b205556275bf3 Mon Sep 17 00:00:00 2001 +From: popcornmix <popcornmix@gmail.com> +Date: Wed, 18 Dec 2013 22:16:19 +0000 +Subject: [PATCH 064/112] config: Enable CONFIG_MEMCG, but leave it disabled + (due to memory cost). Enable with cgroup_enable=memory. + +--- + kernel/cgroup.c | 24 +++++++++++++++++++++++- + 1 file changed, 23 insertions(+), 1 deletion(-) + +diff --git a/kernel/cgroup.c b/kernel/cgroup.c +index 86cb5c6..0b5668a 100644 +--- a/kernel/cgroup.c ++++ b/kernel/cgroup.c +@@ -5587,7 +5587,7 @@ int __init cgroup_init_early(void) + return 0; + } + +-static u16 cgroup_disable_mask __initdata; ++static u16 cgroup_disable_mask __initdata = 1<<0; + + /** + * cgroup_init - cgroup initialization +@@ -6117,6 +6117,28 @@ static int __init cgroup_no_v1(char *str) + } + __setup("cgroup_no_v1=", cgroup_no_v1); + ++static int __init cgroup_enable(char *str) ++{ ++ struct cgroup_subsys *ss; ++ char *token; ++ int i; ++ ++ while ((token = strsep(&str, ",")) != NULL) { ++ if (!*token) ++ continue; ++ ++ for_each_subsys(ss, i) { ++ if (strcmp(token, ss->name) && ++ strcmp(token, ss->legacy_name)) ++ continue; ++ ++ cgroup_disable_mask &= ~(1 << i); ++ } ++ } ++ return 1; ++} ++__setup("cgroup_enable=", cgroup_enable); ++ + /** + * css_tryget_online_from_dir - get corresponding css from a cgroup dentry + * @dentry: directory dentry of interest + +From 52e23c689e7112dee3f533c35dc4d952293a2694 Mon Sep 17 00:00:00 2001 +From: Florian Meier <florian.meier@koalo.de> +Date: Fri, 22 Nov 2013 14:59:51 +0100 +Subject: [PATCH 065/112] ASoC: Add support for PCM5102A codec + +Some definitions to support the PCM5102A codec +by Texas Instruments. + +Signed-off-by: Florian Meier <florian.meier@koalo.de> +--- + sound/soc/codecs/Kconfig | 5 ++++ + sound/soc/codecs/Makefile | 2 ++ + sound/soc/codecs/pcm5102a.c | 70 +++++++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 77 insertions(+) + create mode 100644 sound/soc/codecs/pcm5102a.c + +diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig +index 7ef3a0c..4308f90 100644 +--- a/sound/soc/codecs/Kconfig ++++ b/sound/soc/codecs/Kconfig +@@ -100,6 +100,7 @@ config SND_SOC_ALL_CODECS + select SND_SOC_RT298 if I2C + select SND_SOC_RT5514 if I2C + select SND_SOC_RT5616 if I2C ++ select SND_SOC_PCM5102A if I2C + select SND_SOC_RT5631 if I2C + select SND_SOC_RT5640 if I2C + select SND_SOC_RT5645 if I2C +@@ -631,6 +632,10 @@ config SND_SOC_RT5616 + tristate "Realtek RT5616 CODEC" + depends on I2C + ++config SND_SOC_PCM5102A ++ tristate ++ depends on I2C ++ + config SND_SOC_RT5631 + tristate "Realtek ALC5631/RT5631 CODEC" + depends on I2C +diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile +index 185a712..7522017 100644 +--- a/sound/soc/codecs/Makefile ++++ b/sound/soc/codecs/Makefile +@@ -98,6 +98,7 @@ snd-soc-rt286-objs := rt286.o + snd-soc-rt298-objs := rt298.o + snd-soc-rt5514-objs := rt5514.o + snd-soc-rt5616-objs := rt5616.o ++snd-soc-pcm5102a-objs := pcm5102a.o + snd-soc-rt5631-objs := rt5631.o + snd-soc-rt5640-objs := rt5640.o + snd-soc-rt5645-objs := rt5645.o +@@ -307,6 +308,7 @@ obj-$(CONFIG_SND_SOC_RT286) += snd-soc-rt286.o + obj-$(CONFIG_SND_SOC_RT298) += snd-soc-rt298.o + obj-$(CONFIG_SND_SOC_RT5514) += snd-soc-rt5514.o + obj-$(CONFIG_SND_SOC_RT5616) += snd-soc-rt5616.o ++obj-$(CONFIG_SND_SOC_PCM5102A) += snd-soc-pcm5102a.o + obj-$(CONFIG_SND_SOC_RT5631) += snd-soc-rt5631.o + obj-$(CONFIG_SND_SOC_RT5640) += snd-soc-rt5640.o + obj-$(CONFIG_SND_SOC_RT5645) += snd-soc-rt5645.o +diff --git a/sound/soc/codecs/pcm5102a.c b/sound/soc/codecs/pcm5102a.c +new file mode 100644 +index 0000000..7c6598e +--- /dev/null ++++ b/sound/soc/codecs/pcm5102a.c +@@ -0,0 +1,70 @@ ++/* ++ * Driver for the PCM5102A codec ++ * ++ * Author: Florian Meier <florian.meier@koalo.de> ++ * Copyright 2013 ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * version 2 as published by the Free Software Foundation. ++ * ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * General Public License for more details. ++ */ ++ ++ ++#include <linux/init.h> ++#include <linux/module.h> ++#include <linux/platform_device.h> ++ ++#include <sound/soc.h> ++ ++static struct snd_soc_dai_driver pcm5102a_dai = { ++ .name = "pcm5102a-hifi", ++ .playback = { ++ .channels_min = 2, ++ .channels_max = 2, ++ .rates = SNDRV_PCM_RATE_8000_192000, ++ .formats = SNDRV_PCM_FMTBIT_S16_LE | ++ SNDRV_PCM_FMTBIT_S24_LE | ++ SNDRV_PCM_FMTBIT_S32_LE ++ }, ++}; ++ ++static struct snd_soc_codec_driver soc_codec_dev_pcm5102a; ++ ++static int pcm5102a_probe(struct platform_device *pdev) ++{ ++ return snd_soc_register_codec(&pdev->dev, &soc_codec_dev_pcm5102a, ++ &pcm5102a_dai, 1); ++} ++ ++static int pcm5102a_remove(struct platform_device *pdev) ++{ ++ snd_soc_unregister_codec(&pdev->dev); ++ return 0; ++} ++ ++static const struct of_device_id pcm5102a_of_match[] = { ++ { .compatible = "ti,pcm5102a", }, ++ { } ++}; ++MODULE_DEVICE_TABLE(of, pcm5102a_of_match); ++ ++static struct platform_driver pcm5102a_codec_driver = { ++ .probe = pcm5102a_probe, ++ .remove = pcm5102a_remove, ++ .driver = { ++ .name = "pcm5102a-codec", ++ .owner = THIS_MODULE, ++ .of_match_table = pcm5102a_of_match, ++ }, ++}; ++ ++module_platform_driver(pcm5102a_codec_driver); ++ ++MODULE_DESCRIPTION("ASoC PCM5102A codec driver"); ++MODULE_AUTHOR("Florian Meier <florian.meier@koalo.de>"); ++MODULE_LICENSE("GPL v2"); + +From 8963bf5947a58437d86fd18cd2e1a3dacb6c16ae Mon Sep 17 00:00:00 2001 +From: Florian Meier <florian.meier@koalo.de> +Date: Fri, 22 Nov 2013 19:19:08 +0100 +Subject: [PATCH 066/112] ASoC: Add support for HifiBerry DAC + +This adds a machine driver for the HifiBerry DAC. +It is a sound card that can +be stacked onto the Raspberry Pi. + +Signed-off-by: Florian Meier <florian.meier@koalo.de> +--- + sound/soc/bcm/Kconfig | 7 +++ + sound/soc/bcm/Makefile | 4 ++ + sound/soc/bcm/hifiberry_dac.c | 123 ++++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 134 insertions(+) + create mode 100644 sound/soc/bcm/hifiberry_dac.c + +diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig +index c5070ae..ce81f14 100644 +--- a/sound/soc/bcm/Kconfig ++++ b/sound/soc/bcm/Kconfig +@@ -7,3 +7,10 @@ config SND_BCM2835_SOC_I2S + Say Y or M if you want to add support for codecs attached to + the BCM2835 I2S interface. You will also need + to select the audio interfaces to support below. ++ ++config SND_BCM2708_SOC_HIFIBERRY_DAC ++ tristate "Support for HifiBerry DAC" ++ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S ++ select SND_SOC_PCM5102A ++ help ++ Say Y or M if you want to add support for HifiBerry DAC. +diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile +index bc816b7..b877d38 100644 +--- a/sound/soc/bcm/Makefile ++++ b/sound/soc/bcm/Makefile +@@ -3,3 +3,7 @@ snd-soc-bcm2835-i2s-objs := bcm2835-i2s.o + + obj-$(CONFIG_SND_BCM2835_SOC_I2S) += snd-soc-bcm2835-i2s.o + ++# BCM2708 Machine Support ++snd-soc-hifiberry-dac-objs := hifiberry_dac.o ++ ++obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o +diff --git a/sound/soc/bcm/hifiberry_dac.c b/sound/soc/bcm/hifiberry_dac.c +new file mode 100644 +index 0000000..29ecc08 +--- /dev/null ++++ b/sound/soc/bcm/hifiberry_dac.c +@@ -0,0 +1,123 @@ ++/* ++ * ASoC Driver for HifiBerry DAC ++ * ++ * Author: Florian Meier <florian.meier@koalo.de> ++ * Copyright 2013 ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * version 2 as published by the Free Software Foundation. ++ * ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * General Public License for more details. ++ */ ++ ++#include <linux/module.h> ++#include <linux/platform_device.h> ++ ++#include <sound/core.h> ++#include <sound/pcm.h> ++#include <sound/pcm_params.h> ++#include <sound/soc.h> ++#include <sound/jack.h> ++ ++static int snd_rpi_hifiberry_dac_init(struct snd_soc_pcm_runtime *rtd) ++{ ++ return 0; ++} ++ ++static int snd_rpi_hifiberry_dac_hw_params(struct snd_pcm_substream *substream, ++ struct snd_pcm_hw_params *params) ++{ ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; ++ ++ unsigned int sample_bits = ++ snd_pcm_format_physical_width(params_format(params)); ++ ++ return snd_soc_dai_set_bclk_ratio(cpu_dai, sample_bits * 2); ++} ++ ++/* machine stream operations */ ++static struct snd_soc_ops snd_rpi_hifiberry_dac_ops = { ++ .hw_params = snd_rpi_hifiberry_dac_hw_params, ++}; ++ ++static struct snd_soc_dai_link snd_rpi_hifiberry_dac_dai[] = { ++{ ++ .name = "HifiBerry DAC", ++ .stream_name = "HifiBerry DAC HiFi", ++ .cpu_dai_name = "bcm2708-i2s.0", ++ .codec_dai_name = "pcm5102a-hifi", ++ .platform_name = "bcm2708-i2s.0", ++ .codec_name = "pcm5102a-codec", ++ .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | ++ SND_SOC_DAIFMT_CBS_CFS, ++ .ops = &snd_rpi_hifiberry_dac_ops, ++ .init = snd_rpi_hifiberry_dac_init, ++}, ++}; ++ ++/* audio machine driver */ ++static struct snd_soc_card snd_rpi_hifiberry_dac = { ++ .name = "snd_rpi_hifiberry_dac", ++ .owner = THIS_MODULE, ++ .dai_link = snd_rpi_hifiberry_dac_dai, ++ .num_links = ARRAY_SIZE(snd_rpi_hifiberry_dac_dai), ++}; ++ ++static int snd_rpi_hifiberry_dac_probe(struct platform_device *pdev) ++{ ++ int ret = 0; ++ ++ snd_rpi_hifiberry_dac.dev = &pdev->dev; ++ ++ if (pdev->dev.of_node) { ++ struct device_node *i2s_node; ++ struct snd_soc_dai_link *dai = &snd_rpi_hifiberry_dac_dai[0]; ++ i2s_node = of_parse_phandle(pdev->dev.of_node, ++ "i2s-controller", 0); ++ ++ if (i2s_node) { ++ dai->cpu_dai_name = NULL; ++ dai->cpu_of_node = i2s_node; ++ dai->platform_name = NULL; ++ dai->platform_of_node = i2s_node; ++ } ++ } ++ ++ ret = snd_soc_register_card(&snd_rpi_hifiberry_dac); ++ if (ret) ++ dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", ret); ++ ++ return ret; ++} ++ ++static int snd_rpi_hifiberry_dac_remove(struct platform_device *pdev) ++{ ++ return snd_soc_unregister_card(&snd_rpi_hifiberry_dac); ++} ++ ++static const struct of_device_id snd_rpi_hifiberry_dac_of_match[] = { ++ { .compatible = "hifiberry,hifiberry-dac", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, snd_rpi_hifiberry_dac_of_match); ++ ++static struct platform_driver snd_rpi_hifiberry_dac_driver = { ++ .driver = { ++ .name = "snd-hifiberry-dac", ++ .owner = THIS_MODULE, ++ .of_match_table = snd_rpi_hifiberry_dac_of_match, ++ }, ++ .probe = snd_rpi_hifiberry_dac_probe, ++ .remove = snd_rpi_hifiberry_dac_remove, ++}; ++ ++module_platform_driver(snd_rpi_hifiberry_dac_driver); ++ ++MODULE_AUTHOR("Florian Meier <florian.meier@koalo.de>"); ++MODULE_DESCRIPTION("ASoC Driver for HifiBerry DAC"); ++MODULE_LICENSE("GPL v2"); + +From 133cbdab8d6f90145845d63730736887fbeb3cbe Mon Sep 17 00:00:00 2001 +From: Florian Meier <florian.meier@koalo.de> +Date: Mon, 25 Jan 2016 15:48:59 +0000 +Subject: [PATCH 067/112] ASoC: Add support for Rpi-DAC + +--- + sound/soc/bcm/Kconfig | 7 +++ + sound/soc/bcm/Makefile | 2 + + sound/soc/bcm/rpi-dac.c | 119 ++++++++++++++++++++++++++++++++++++++++++++ + sound/soc/codecs/Kconfig | 9 ++++ + sound/soc/codecs/Makefile | 2 + + sound/soc/codecs/pcm1794a.c | 69 +++++++++++++++++++++++++ + 6 files changed, 208 insertions(+) + create mode 100644 sound/soc/bcm/rpi-dac.c + create mode 100644 sound/soc/codecs/pcm1794a.c + +diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig +index ce81f14..900de22 100644 +--- a/sound/soc/bcm/Kconfig ++++ b/sound/soc/bcm/Kconfig +@@ -14,3 +14,10 @@ config SND_BCM2708_SOC_HIFIBERRY_DAC + select SND_SOC_PCM5102A + help + Say Y or M if you want to add support for HifiBerry DAC. ++ ++config SND_BCM2708_SOC_RPI_DAC ++ tristate "Support for RPi-DAC" ++ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S ++ select SND_SOC_PCM1794A ++ help ++ Say Y or M if you want to add support for RPi-DAC. +diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile +index b877d38..99c96b4 100644 +--- a/sound/soc/bcm/Makefile ++++ b/sound/soc/bcm/Makefile +@@ -5,5 +5,7 @@ obj-$(CONFIG_SND_BCM2835_SOC_I2S) += snd-soc-bcm2835-i2s.o + + # BCM2708 Machine Support + snd-soc-hifiberry-dac-objs := hifiberry_dac.o ++snd-soc-rpi-dac-objs := rpi-dac.o + + obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o ++obj-$(CONFIG_SND_BCM2708_SOC_RPI_DAC) += snd-soc-rpi-dac.o +diff --git a/sound/soc/bcm/rpi-dac.c b/sound/soc/bcm/rpi-dac.c +new file mode 100644 +index 0000000..59dc89e +--- /dev/null ++++ b/sound/soc/bcm/rpi-dac.c +@@ -0,0 +1,119 @@ ++/* ++ * ASoC Driver for RPi-DAC. ++ * ++ * Author: Florian Meier <florian.meier@koalo.de> ++ * Copyright 2013 ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * version 2 as published by the Free Software Foundation. ++ * ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * General Public License for more details. ++ */ ++ ++#include <linux/module.h> ++#include <linux/platform_device.h> ++ ++#include <sound/core.h> ++#include <sound/pcm.h> ++#include <sound/pcm_params.h> ++#include <sound/soc.h> ++#include <sound/jack.h> ++ ++static int snd_rpi_rpi_dac_init(struct snd_soc_pcm_runtime *rtd) ++{ ++ return 0; ++} ++ ++static int snd_rpi_rpi_dac_hw_params(struct snd_pcm_substream *substream, ++ struct snd_pcm_hw_params *params) ++{ ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; ++ ++ return snd_soc_dai_set_bclk_ratio(cpu_dai, 32*2); ++} ++ ++/* machine stream operations */ ++static struct snd_soc_ops snd_rpi_rpi_dac_ops = { ++ .hw_params = snd_rpi_rpi_dac_hw_params, ++}; ++ ++static struct snd_soc_dai_link snd_rpi_rpi_dac_dai[] = { ++{ ++ .name = "RPi-DAC", ++ .stream_name = "RPi-DAC HiFi", ++ .cpu_dai_name = "bcm2708-i2s.0", ++ .codec_dai_name = "pcm1794a-hifi", ++ .platform_name = "bcm2708-i2s.0", ++ .codec_name = "pcm1794a-codec", ++ .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | ++ SND_SOC_DAIFMT_CBS_CFS, ++ .ops = &snd_rpi_rpi_dac_ops, ++ .init = snd_rpi_rpi_dac_init, ++}, ++}; ++ ++/* audio machine driver */ ++static struct snd_soc_card snd_rpi_rpi_dac = { ++ .name = "snd_rpi_rpi_dac", ++ .owner = THIS_MODULE, ++ .dai_link = snd_rpi_rpi_dac_dai, ++ .num_links = ARRAY_SIZE(snd_rpi_rpi_dac_dai), ++}; ++ ++static int snd_rpi_rpi_dac_probe(struct platform_device *pdev) ++{ ++ int ret = 0; ++ ++ snd_rpi_rpi_dac.dev = &pdev->dev; ++ ++ if (pdev->dev.of_node) { ++ struct device_node *i2s_node; ++ struct snd_soc_dai_link *dai = &snd_rpi_rpi_dac_dai[0]; ++ i2s_node = of_parse_phandle(pdev->dev.of_node, "i2s-controller", 0); ++ ++ if (i2s_node) { ++ dai->cpu_dai_name = NULL; ++ dai->cpu_of_node = i2s_node; ++ dai->platform_name = NULL; ++ dai->platform_of_node = i2s_node; ++ } ++ } ++ ++ ret = snd_soc_register_card(&snd_rpi_rpi_dac); ++ if (ret) ++ dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", ret); ++ ++ return ret; ++} ++ ++static int snd_rpi_rpi_dac_remove(struct platform_device *pdev) ++{ ++ return snd_soc_unregister_card(&snd_rpi_rpi_dac); ++} ++ ++static const struct of_device_id snd_rpi_rpi_dac_of_match[] = { ++ { .compatible = "rpi,rpi-dac", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, snd_rpi_rpi_dac_of_match); ++ ++static struct platform_driver snd_rpi_rpi_dac_driver = { ++ .driver = { ++ .name = "snd-rpi-dac", ++ .owner = THIS_MODULE, ++ .of_match_table = snd_rpi_rpi_dac_of_match, ++ }, ++ .probe = snd_rpi_rpi_dac_probe, ++ .remove = snd_rpi_rpi_dac_remove, ++}; ++ ++module_platform_driver(snd_rpi_rpi_dac_driver); ++ ++MODULE_AUTHOR("Florian Meier <florian.meier@koalo.de>"); ++MODULE_DESCRIPTION("ASoC Driver for RPi-DAC"); ++MODULE_LICENSE("GPL v2"); +diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig +index 4308f90..513ab55 100644 +--- a/sound/soc/codecs/Kconfig ++++ b/sound/soc/codecs/Kconfig +@@ -101,6 +101,7 @@ config SND_SOC_ALL_CODECS + select SND_SOC_RT5514 if I2C + select SND_SOC_RT5616 if I2C + select SND_SOC_PCM5102A if I2C ++ select SND_SOC_PCM1794A if I2C + select SND_SOC_RT5631 if I2C + select SND_SOC_RT5640 if I2C + select SND_SOC_RT5645 if I2C +@@ -632,6 +633,14 @@ config SND_SOC_RT5616 + tristate "Realtek RT5616 CODEC" + depends on I2C + ++config SND_SOC_RT298 ++ tristate ++ depends on I2C ++ ++config SND_SOC_PCM1794A ++ tristate ++ depends on I2C ++ + config SND_SOC_PCM5102A + tristate + depends on I2C +diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile +index 7522017..b87e845 100644 +--- a/sound/soc/codecs/Makefile ++++ b/sound/soc/codecs/Makefile +@@ -98,6 +98,7 @@ snd-soc-rt286-objs := rt286.o + snd-soc-rt298-objs := rt298.o + snd-soc-rt5514-objs := rt5514.o + snd-soc-rt5616-objs := rt5616.o ++snd-soc-pcm1794a-objs := pcm1794a.o + snd-soc-pcm5102a-objs := pcm5102a.o + snd-soc-rt5631-objs := rt5631.o + snd-soc-rt5640-objs := rt5640.o +@@ -308,6 +309,7 @@ obj-$(CONFIG_SND_SOC_RT286) += snd-soc-rt286.o + obj-$(CONFIG_SND_SOC_RT298) += snd-soc-rt298.o + obj-$(CONFIG_SND_SOC_RT5514) += snd-soc-rt5514.o + obj-$(CONFIG_SND_SOC_RT5616) += snd-soc-rt5616.o ++obj-$(CONFIG_SND_SOC_PCM1794A) += snd-soc-pcm1794a.o + obj-$(CONFIG_SND_SOC_PCM5102A) += snd-soc-pcm5102a.o + obj-$(CONFIG_SND_SOC_RT5631) += snd-soc-rt5631.o + obj-$(CONFIG_SND_SOC_RT5640) += snd-soc-rt5640.o +diff --git a/sound/soc/codecs/pcm1794a.c b/sound/soc/codecs/pcm1794a.c +new file mode 100644 +index 0000000..afe1b41 +--- /dev/null ++++ b/sound/soc/codecs/pcm1794a.c +@@ -0,0 +1,69 @@ ++/* ++ * Driver for the PCM1794A codec ++ * ++ * Author: Florian Meier <florian.meier@koalo.de> ++ * Copyright 2013 ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * version 2 as published by the Free Software Foundation. ++ * ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * General Public License for more details. ++ */ ++ ++ ++#include <linux/init.h> ++#include <linux/module.h> ++#include <linux/platform_device.h> ++ ++#include <sound/soc.h> ++ ++static struct snd_soc_dai_driver pcm1794a_dai = { ++ .name = "pcm1794a-hifi", ++ .playback = { ++ .channels_min = 2, ++ .channels_max = 2, ++ .rates = SNDRV_PCM_RATE_8000_192000, ++ .formats = SNDRV_PCM_FMTBIT_S16_LE | ++ SNDRV_PCM_FMTBIT_S24_LE ++ }, ++}; ++ ++static struct snd_soc_codec_driver soc_codec_dev_pcm1794a; ++ ++static int pcm1794a_probe(struct platform_device *pdev) ++{ ++ return snd_soc_register_codec(&pdev->dev, &soc_codec_dev_pcm1794a, ++ &pcm1794a_dai, 1); ++} ++ ++static int pcm1794a_remove(struct platform_device *pdev) ++{ ++ snd_soc_unregister_codec(&pdev->dev); ++ return 0; ++} ++ ++static const struct of_device_id pcm1794a_of_match[] = { ++ { .compatible = "ti,pcm1794a", }, ++ { } ++}; ++MODULE_DEVICE_TABLE(of, pcm1794a_of_match); ++ ++static struct platform_driver pcm1794a_codec_driver = { ++ .probe = pcm1794a_probe, ++ .remove = pcm1794a_remove, ++ .driver = { ++ .name = "pcm1794a-codec", ++ .owner = THIS_MODULE, ++ .of_match_table = of_match_ptr(pcm1794a_of_match), ++ }, ++}; ++ ++module_platform_driver(pcm1794a_codec_driver); ++ ++MODULE_DESCRIPTION("ASoC PCM1794A codec driver"); ++MODULE_AUTHOR("Florian Meier <florian.meier@koalo.de>"); ++MODULE_LICENSE("GPL v2"); + +From a8113bd47e56c48df869517ceff8a9e05d61e036 Mon Sep 17 00:00:00 2001 +From: Daniel Matuschek <info@crazy-audio.com> +Date: Wed, 15 Jan 2014 21:41:23 +0100 +Subject: [PATCH 068/112] ASoC: wm8804: Implement MCLK configuration options, + add 32bit support WM8804 can run with PLL frequencies of 256xfs and 128xfs + for most sample rates. At 192kHz only 128xfs is supported. The existing + driver selects 128xfs automatically for some lower samples rates. By using an + additional mclk_div divider, it is now possible to control the behaviour. + This allows using 256xfs PLL frequency on all sample rates up to 96kHz. It + should allow lower jitter and better signal quality. The behavior has to be + controlled by the sound card driver, because some sample frequency share the + same setting. e.g. 192kHz and 96kHz use 24.576MHz master clock. The only + difference is the MCLK divider. + +This also added support for 32bit data. + +Signed-off-by: Daniel Matuschek <daniel@matuschek.net> +--- + sound/soc/codecs/wm8804.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/sound/soc/codecs/wm8804.c b/sound/soc/codecs/wm8804.c +index 8d91470..c846716 100644 +--- a/sound/soc/codecs/wm8804.c ++++ b/sound/soc/codecs/wm8804.c +@@ -304,6 +304,7 @@ static int wm8804_hw_params(struct snd_pcm_substream *substream, + blen = 0x1; + break; + case 24: ++ case 32: + blen = 0x2; + break; + default: +@@ -515,7 +516,7 @@ static const struct snd_soc_dai_ops wm8804_dai_ops = { + }; + + #define WM8804_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE | \ +- SNDRV_PCM_FMTBIT_S24_LE) ++ SNDRV_PCM_FMTBIT_S24_3LE | SNDRV_PCM_FMTBIT_S32_LE) + + #define WM8804_RATES (SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 | \ + SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_64000 | \ +@@ -543,7 +544,7 @@ static struct snd_soc_dai_driver wm8804_dai = { + }; + + static const struct snd_soc_codec_driver soc_codec_dev_wm8804 = { +- .idle_bias_off = true, ++ .idle_bias_off = false, + + .dapm_widgets = wm8804_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(wm8804_dapm_widgets), + +From e4119855ee7612fe8032d43fb0cd14e87109d613 Mon Sep 17 00:00:00 2001 +From: Daniel Matuschek <info@crazy-audio.com> +Date: Wed, 15 Jan 2014 21:42:08 +0100 +Subject: [PATCH 069/112] ASoC: BCM:Add support for HiFiBerry Digi. Driver is + based on the patched WM8804 driver. + +Signed-off-by: Daniel Matuschek <daniel@matuschek.net> + +Add a parameter to turn off SPDIF output if no audio is playing + +This patch adds the paramater auto_shutdown_output to the kernel module. +Default behaviour of the module is the same, but when auto_shutdown_output +is set to 1, the SPDIF oputput will shutdown if no stream is playing. + +bugfix for 32kHz sample rate, was missing + +HiFiBerry Digi: set SPDIF status bits for sample rate + +The HiFiBerry Digi driver did not signal the sample rate in the SPDIF status bits. +While this is optional, some DACs and receivers do not accept this signal. This patch +adds the sample rate bits in the SPDIF status block. +--- + sound/soc/bcm/Kconfig | 7 ++ + sound/soc/bcm/Makefile | 2 + + sound/soc/bcm/hifiberry_digi.c | 224 +++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 233 insertions(+) + create mode 100644 sound/soc/bcm/hifiberry_digi.c + +diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig +index 900de22..a34aff2 100644 +--- a/sound/soc/bcm/Kconfig ++++ b/sound/soc/bcm/Kconfig +@@ -15,6 +15,13 @@ config SND_BCM2708_SOC_HIFIBERRY_DAC + help + Say Y or M if you want to add support for HifiBerry DAC. + ++config SND_BCM2708_SOC_HIFIBERRY_DIGI ++ tristate "Support for HifiBerry Digi" ++ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S ++ select SND_SOC_WM8804 ++ help ++ Say Y or M if you want to add support for HifiBerry Digi S/PDIF output board. ++ + config SND_BCM2708_SOC_RPI_DAC + tristate "Support for RPi-DAC" + depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S +diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile +index 99c96b4..4d53c58 100644 +--- a/sound/soc/bcm/Makefile ++++ b/sound/soc/bcm/Makefile +@@ -5,7 +5,9 @@ obj-$(CONFIG_SND_BCM2835_SOC_I2S) += snd-soc-bcm2835-i2s.o + + # BCM2708 Machine Support + snd-soc-hifiberry-dac-objs := hifiberry_dac.o ++snd-soc-hifiberry-digi-objs := hifiberry_digi.o + snd-soc-rpi-dac-objs := rpi-dac.o + + obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o ++obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI) += snd-soc-hifiberry-digi.o + obj-$(CONFIG_SND_BCM2708_SOC_RPI_DAC) += snd-soc-rpi-dac.o +diff --git a/sound/soc/bcm/hifiberry_digi.c b/sound/soc/bcm/hifiberry_digi.c +new file mode 100644 +index 0000000..9840e15 +--- /dev/null ++++ b/sound/soc/bcm/hifiberry_digi.c +@@ -0,0 +1,224 @@ ++/* ++ * ASoC Driver for HifiBerry Digi ++ * ++ * Author: Daniel Matuschek <info@crazy-audio.com> ++ * based on the HifiBerry DAC driver by Florian Meier <florian.meier@koalo.de> ++ * Copyright 2013 ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * version 2 as published by the Free Software Foundation. ++ * ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * General Public License for more details. ++ */ ++ ++#include <linux/module.h> ++#include <linux/platform_device.h> ++ ++#include <sound/core.h> ++#include <sound/pcm.h> ++#include <sound/pcm_params.h> ++#include <sound/soc.h> ++#include <sound/jack.h> ++ ++#include "../codecs/wm8804.h" ++ ++static short int auto_shutdown_output = 0; ++module_param(auto_shutdown_output, short, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP); ++MODULE_PARM_DESC(auto_shutdown_output, "Shutdown SP/DIF output if playback is stopped"); ++ ++ ++static int samplerate=44100; ++ ++static int snd_rpi_hifiberry_digi_init(struct snd_soc_pcm_runtime *rtd) ++{ ++ struct snd_soc_codec *codec = rtd->codec; ++ ++ /* enable TX output */ ++ snd_soc_update_bits(codec, WM8804_PWRDN, 0x4, 0x0); ++ ++ return 0; ++} ++ ++static int snd_rpi_hifiberry_digi_startup(struct snd_pcm_substream *substream) { ++ /* turn on digital output */ ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_codec *codec = rtd->codec; ++ snd_soc_update_bits(codec, WM8804_PWRDN, 0x3c, 0x00); ++ return 0; ++} ++ ++static void snd_rpi_hifiberry_digi_shutdown(struct snd_pcm_substream *substream) { ++ /* turn off output */ ++ if (auto_shutdown_output) { ++ /* turn off output */ ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_codec *codec = rtd->codec; ++ snd_soc_update_bits(codec, WM8804_PWRDN, 0x3c, 0x3c); ++ } ++} ++ ++ ++static int snd_rpi_hifiberry_digi_hw_params(struct snd_pcm_substream *substream, ++ struct snd_pcm_hw_params *params) ++{ ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_dai *codec_dai = rtd->codec_dai; ++ struct snd_soc_codec *codec = rtd->codec; ++ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; ++ ++ int sysclk = 27000000; /* This is fixed on this board */ ++ ++ long mclk_freq=0; ++ int mclk_div=1; ++ int sampling_freq=1; ++ ++ int ret; ++ ++ samplerate = params_rate(params); ++ ++ if (samplerate<=96000) { ++ mclk_freq=samplerate*256; ++ mclk_div=WM8804_MCLKDIV_256FS; ++ } else { ++ mclk_freq=samplerate*128; ++ mclk_div=WM8804_MCLKDIV_128FS; ++ } ++ ++ switch (samplerate) { ++ case 32000: ++ sampling_freq=0x03; ++ break; ++ case 44100: ++ sampling_freq=0x00; ++ break; ++ case 48000: ++ sampling_freq=0x02; ++ break; ++ case 88200: ++ sampling_freq=0x08; ++ break; ++ case 96000: ++ sampling_freq=0x0a; ++ break; ++ case 176400: ++ sampling_freq=0x0c; ++ break; ++ case 192000: ++ sampling_freq=0x0e; ++ break; ++ default: ++ dev_err(codec->dev, ++ "Failed to set WM8804 SYSCLK, unsupported samplerate %d\n", ++ samplerate); ++ } ++ ++ snd_soc_dai_set_clkdiv(codec_dai, WM8804_MCLK_DIV, mclk_div); ++ snd_soc_dai_set_pll(codec_dai, 0, 0, sysclk, mclk_freq); ++ ++ ret = snd_soc_dai_set_sysclk(codec_dai, WM8804_TX_CLKSRC_PLL, ++ sysclk, SND_SOC_CLOCK_OUT); ++ if (ret < 0) { ++ dev_err(codec->dev, ++ "Failed to set WM8804 SYSCLK: %d\n", ret); ++ return ret; ++ } ++ ++ /* Enable TX output */ ++ snd_soc_update_bits(codec, WM8804_PWRDN, 0x4, 0x0); ++ ++ /* Power on */ ++ snd_soc_update_bits(codec, WM8804_PWRDN, 0x9, 0); ++ ++ /* set sampling frequency status bits */ ++ snd_soc_update_bits(codec, WM8804_SPDTX4, 0x0f, sampling_freq); ++ ++ return snd_soc_dai_set_bclk_ratio(cpu_dai,64); ++} ++ ++/* machine stream operations */ ++static struct snd_soc_ops snd_rpi_hifiberry_digi_ops = { ++ .hw_params = snd_rpi_hifiberry_digi_hw_params, ++ .startup = snd_rpi_hifiberry_digi_startup, ++ .shutdown = snd_rpi_hifiberry_digi_shutdown, ++}; ++ ++static struct snd_soc_dai_link snd_rpi_hifiberry_digi_dai[] = { ++{ ++ .name = "HifiBerry Digi", ++ .stream_name = "HifiBerry Digi HiFi", ++ .cpu_dai_name = "bcm2708-i2s.0", ++ .codec_dai_name = "wm8804-spdif", ++ .platform_name = "bcm2708-i2s.0", ++ .codec_name = "wm8804.1-003b", ++ .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | ++ SND_SOC_DAIFMT_CBM_CFM, ++ .ops = &snd_rpi_hifiberry_digi_ops, ++ .init = snd_rpi_hifiberry_digi_init, ++}, ++}; ++ ++/* audio machine driver */ ++static struct snd_soc_card snd_rpi_hifiberry_digi = { ++ .name = "snd_rpi_hifiberry_digi", ++ .owner = THIS_MODULE, ++ .dai_link = snd_rpi_hifiberry_digi_dai, ++ .num_links = ARRAY_SIZE(snd_rpi_hifiberry_digi_dai), ++}; ++ ++static int snd_rpi_hifiberry_digi_probe(struct platform_device *pdev) ++{ ++ int ret = 0; ++ ++ snd_rpi_hifiberry_digi.dev = &pdev->dev; ++ ++ if (pdev->dev.of_node) { ++ struct device_node *i2s_node; ++ struct snd_soc_dai_link *dai = &snd_rpi_hifiberry_digi_dai[0]; ++ i2s_node = of_parse_phandle(pdev->dev.of_node, ++ "i2s-controller", 0); ++ ++ if (i2s_node) { ++ dai->cpu_dai_name = NULL; ++ dai->cpu_of_node = i2s_node; ++ dai->platform_name = NULL; ++ dai->platform_of_node = i2s_node; ++ } ++ } ++ ++ ret = snd_soc_register_card(&snd_rpi_hifiberry_digi); ++ if (ret) ++ dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", ret); ++ ++ return ret; ++} ++ ++static int snd_rpi_hifiberry_digi_remove(struct platform_device *pdev) ++{ ++ return snd_soc_unregister_card(&snd_rpi_hifiberry_digi); ++} ++ ++static const struct of_device_id snd_rpi_hifiberry_digi_of_match[] = { ++ { .compatible = "hifiberry,hifiberry-digi", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, snd_rpi_hifiberry_digi_of_match); ++ ++static struct platform_driver snd_rpi_hifiberry_digi_driver = { ++ .driver = { ++ .name = "snd-hifiberry-digi", ++ .owner = THIS_MODULE, ++ .of_match_table = snd_rpi_hifiberry_digi_of_match, ++ }, ++ .probe = snd_rpi_hifiberry_digi_probe, ++ .remove = snd_rpi_hifiberry_digi_remove, ++}; ++ ++module_platform_driver(snd_rpi_hifiberry_digi_driver); ++ ++MODULE_AUTHOR("Daniel Matuschek <info@crazy-audio.com>"); ++MODULE_DESCRIPTION("ASoC Driver for HifiBerry Digi"); ++MODULE_LICENSE("GPL v2"); + +From ea72e0251bc9d43b981cf3f5caa807c41475e327 Mon Sep 17 00:00:00 2001 +From: Gordon Garrity <gordon@iqaudio.com> +Date: Sat, 8 Mar 2014 16:56:57 +0000 +Subject: [PATCH 070/112] Add IQaudIO Sound Card support for Raspberry Pi + +Set a limit of 0dB on Digital Volume Control + +The main volume control in the PCM512x DAC has a range up to ++24dB. This is dangerously loud and can potentially cause massive +clipping in the output stages. Therefore this sets a sensible +limit of 0dB for this control. + +Allow up to 24dB digital gain to be applied when using IQAudIO DAC+ + +24db_digital_gain DT param can be used to specify that PCM512x +codec "Digital" volume control should not be limited to 0dB gain, +and if specified will allow the full 24dB gain. + +Modify IQAudIO DAC+ ASoC driver to set card/dai config from dt + +Add the ability to set the card name, dai name and dai stream name, from +dt config. + +Signed-off-by: DigitalDreamtime <clive.messer@digitaldreamtime.co.uk> +--- + sound/soc/bcm/Kconfig | 7 +++ + sound/soc/bcm/Makefile | 2 + + sound/soc/bcm/iqaudio-dac.c | 148 ++++++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 157 insertions(+) + create mode 100644 sound/soc/bcm/iqaudio-dac.c + +diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig +index a34aff2..38dcdd9 100644 +--- a/sound/soc/bcm/Kconfig ++++ b/sound/soc/bcm/Kconfig +@@ -28,3 +28,10 @@ config SND_BCM2708_SOC_RPI_DAC + select SND_SOC_PCM1794A + help + Say Y or M if you want to add support for RPi-DAC. ++ ++config SND_BCM2708_SOC_IQAUDIO_DAC ++ tristate "Support for IQaudIO-DAC" ++ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S ++ select SND_SOC_PCM512x_I2C ++ help ++ Say Y or M if you want to add support for IQaudIO-DAC. +diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile +index 4d53c58..08e4dc5 100644 +--- a/sound/soc/bcm/Makefile ++++ b/sound/soc/bcm/Makefile +@@ -7,7 +7,9 @@ obj-$(CONFIG_SND_BCM2835_SOC_I2S) += snd-soc-bcm2835-i2s.o + snd-soc-hifiberry-dac-objs := hifiberry_dac.o + snd-soc-hifiberry-digi-objs := hifiberry_digi.o + snd-soc-rpi-dac-objs := rpi-dac.o ++snd-soc-iqaudio-dac-objs := iqaudio-dac.o + + obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o + obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI) += snd-soc-hifiberry-digi.o + obj-$(CONFIG_SND_BCM2708_SOC_RPI_DAC) += snd-soc-rpi-dac.o ++obj-$(CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC) += snd-soc-iqaudio-dac.o +diff --git a/sound/soc/bcm/iqaudio-dac.c b/sound/soc/bcm/iqaudio-dac.c +new file mode 100644 +index 0000000..b6b6dcf +--- /dev/null ++++ b/sound/soc/bcm/iqaudio-dac.c +@@ -0,0 +1,148 @@ ++/* ++ * ASoC Driver for IQaudIO DAC ++ * ++ * Author: Florian Meier <florian.meier@koalo.de> ++ * Copyright 2013 ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * version 2 as published by the Free Software Foundation. ++ * ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * General Public License for more details. ++ */ ++ ++#include <linux/module.h> ++#include <linux/platform_device.h> ++ ++#include <sound/core.h> ++#include <sound/pcm.h> ++#include <sound/pcm_params.h> ++#include <sound/soc.h> ++#include <sound/jack.h> ++ ++static bool digital_gain_0db_limit = true; ++ ++static int snd_rpi_iqaudio_dac_init(struct snd_soc_pcm_runtime *rtd) ++{ ++ if (digital_gain_0db_limit) ++ { ++ int ret; ++ struct snd_soc_card *card = rtd->card; ++ ++ ret = snd_soc_limit_volume(card, "Digital Playback Volume", 207); ++ if (ret < 0) ++ dev_warn(card->dev, "Failed to set volume limit: %d\n", ret); ++ } ++ ++ return 0; ++} ++ ++static int snd_rpi_iqaudio_dac_hw_params(struct snd_pcm_substream *substream, ++ struct snd_pcm_hw_params *params) ++{ ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++// NOT USED struct snd_soc_dai *codec_dai = rtd->codec_dai; ++// NOT USED struct snd_soc_codec *codec = rtd->codec; ++ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; ++ ++ unsigned int sample_bits = ++ snd_pcm_format_physical_width(params_format(params)); ++ ++ return snd_soc_dai_set_bclk_ratio(cpu_dai, sample_bits * 2); ++} ++ ++/* machine stream operations */ ++static struct snd_soc_ops snd_rpi_iqaudio_dac_ops = { ++ .hw_params = snd_rpi_iqaudio_dac_hw_params, ++}; ++ ++static struct snd_soc_dai_link snd_rpi_iqaudio_dac_dai[] = { ++{ ++ .cpu_dai_name = "bcm2708-i2s.0", ++ .codec_dai_name = "pcm512x-hifi", ++ .platform_name = "bcm2708-i2s.0", ++ .codec_name = "pcm512x.1-004c", ++ .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | ++ SND_SOC_DAIFMT_CBS_CFS, ++ .ops = &snd_rpi_iqaudio_dac_ops, ++ .init = snd_rpi_iqaudio_dac_init, ++}, ++}; ++ ++/* audio machine driver */ ++static struct snd_soc_card snd_rpi_iqaudio_dac = { ++ .owner = THIS_MODULE, ++ .dai_link = snd_rpi_iqaudio_dac_dai, ++ .num_links = ARRAY_SIZE(snd_rpi_iqaudio_dac_dai), ++}; ++ ++static int snd_rpi_iqaudio_dac_probe(struct platform_device *pdev) ++{ ++ int ret = 0; ++ ++ snd_rpi_iqaudio_dac.dev = &pdev->dev; ++ ++ if (pdev->dev.of_node) { ++ struct device_node *i2s_node; ++ struct snd_soc_card *card = &snd_rpi_iqaudio_dac; ++ struct snd_soc_dai_link *dai = &snd_rpi_iqaudio_dac_dai[0]; ++ i2s_node = of_parse_phandle(pdev->dev.of_node, ++ "i2s-controller", 0); ++ ++ if (i2s_node) { ++ dai->cpu_dai_name = NULL; ++ dai->cpu_of_node = i2s_node; ++ dai->platform_name = NULL; ++ dai->platform_of_node = i2s_node; ++ } ++ ++ digital_gain_0db_limit = !of_property_read_bool(pdev->dev.of_node, ++ "iqaudio,24db_digital_gain"); ++ if (of_property_read_string(pdev->dev.of_node, "card_name", ++ &card->name)) ++ card->name = "IQaudIODAC"; ++ if (of_property_read_string(pdev->dev.of_node, "dai_name", ++ &dai->name)) ++ dai->name = "IQaudIO DAC"; ++ if (of_property_read_string(pdev->dev.of_node, "dai_stream_name", ++ &dai->stream_name)) ++ dai->stream_name = "IQaudIO DAC HiFi"; ++ } ++ ++ ret = snd_soc_register_card(&snd_rpi_iqaudio_dac); ++ if (ret) ++ dev_err(&pdev->dev, ++ "snd_soc_register_card() failed: %d\n", ret); ++ ++ return ret; ++} ++ ++static int snd_rpi_iqaudio_dac_remove(struct platform_device *pdev) ++{ ++ return snd_soc_unregister_card(&snd_rpi_iqaudio_dac); ++} ++ ++static const struct of_device_id iqaudio_of_match[] = { ++ { .compatible = "iqaudio,iqaudio-dac", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, iqaudio_of_match); ++ ++static struct platform_driver snd_rpi_iqaudio_dac_driver = { ++ .driver = { ++ .name = "snd-rpi-iqaudio-dac", ++ .owner = THIS_MODULE, ++ .of_match_table = iqaudio_of_match, ++ }, ++ .probe = snd_rpi_iqaudio_dac_probe, ++ .remove = snd_rpi_iqaudio_dac_remove, ++}; ++ ++module_platform_driver(snd_rpi_iqaudio_dac_driver); ++ ++MODULE_AUTHOR("Florian Meier <florian.meier@koalo.de>"); ++MODULE_DESCRIPTION("ASoC Driver for IQAudio DAC"); ++MODULE_LICENSE("GPL v2"); + +From 51d3e7110c3e009d1f568a280f7645d0b44592d7 Mon Sep 17 00:00:00 2001 +From: popcornmix <popcornmix@gmail.com> +Date: Mon, 14 Jul 2014 22:02:09 +0100 +Subject: [PATCH 071/112] hid: Reduce default mouse polling interval to 60Hz + +Reduces overhead when using X +--- + drivers/hid/usbhid/hid-core.c | 10 +++++++--- + 1 file changed, 7 insertions(+), 3 deletions(-) + +diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c +index ae83af6..4a7af9d 100644 +--- a/drivers/hid/usbhid/hid-core.c ++++ b/drivers/hid/usbhid/hid-core.c +@@ -49,7 +49,7 @@ + * Module parameters. + */ + +-static unsigned int hid_mousepoll_interval; ++static unsigned int hid_mousepoll_interval = ~0; + module_param_named(mousepoll, hid_mousepoll_interval, uint, 0644); + MODULE_PARM_DESC(mousepoll, "Polling interval of mice"); + +@@ -1083,8 +1083,12 @@ static int usbhid_start(struct hid_device *hid) + } + + /* Change the polling interval of mice. */ +- if (hid->collection->usage == HID_GD_MOUSE && hid_mousepoll_interval > 0) +- interval = hid_mousepoll_interval; ++ if (hid->collection->usage == HID_GD_MOUSE) { ++ if (hid_mousepoll_interval == ~0 && interval < 16) ++ interval = 16; ++ else if (hid_mousepoll_interval != ~0 && hid_mousepoll_interval != 0) ++ interval = hid_mousepoll_interval; ++ } + + ret = -ENOMEM; + if (usb_endpoint_dir_in(endpoint)) { + +From 6b4093df74895715c00c4a7f3d364ef2bc02421d Mon Sep 17 00:00:00 2001 +From: Daniel Matuschek <info@crazy-audio.com> +Date: Mon, 4 Aug 2014 10:06:56 +0200 +Subject: [PATCH 072/112] Added support for HiFiBerry DAC+ + +The driver is based on the HiFiBerry DAC driver. However HiFiBerry DAC+ uses +a different codec chip (PCM5122), therefore a new driver is necessary. + +Add support for the HiFiBerry DAC+ Pro. + +The HiFiBerry DAC+ and DAC+ Pro products both use the existing bcm sound driver with the DAC+ Pro having a special clock device driver representing the two high precision oscillators. + +An addition bug fix is included for the PCM512x codec where by the physical size of the sample frame is used in the calculation of the LRCK divisor as it was found to be wrong when using 24-bit depth sample contained in a little endian 4-byte sample frame. + +Limit PCM512x "Digital" gain to 0dB by default with HiFiBerry DAC+ + +24db_digital_gain DT param can be used to specify that PCM512x +codec "Digital" volume control should not be limited to 0dB gain, +and if specified will allow the full 24dB gain. + +Add dt param to force HiFiBerry DAC+ Pro into slave mode + +"dtoverlay=hifiberry-dacplus,slave" + +Add 'slave' param to use HiFiBerry DAC+ Pro in slave mode, +with Pi as master for bit and frame clock. + +Signed-off-by: DigitalDreamtime <clive.messer@digitaldreamtime.co.uk> +--- + drivers/clk/Makefile | 1 + + drivers/clk/clk-hifiberry-dacpro.c | 160 +++++++++++++++++ + sound/soc/bcm/Kconfig | 7 + + sound/soc/bcm/Makefile | 2 + + sound/soc/bcm/hifiberry_dacplus.c | 358 +++++++++++++++++++++++++++++++++++++ + sound/soc/codecs/pcm512x.c | 3 +- + 6 files changed, 530 insertions(+), 1 deletion(-) + create mode 100644 drivers/clk/clk-hifiberry-dacpro.c + create mode 100644 sound/soc/bcm/hifiberry_dacplus.c + +diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile +index 46869d6..a202e6f 100644 +--- a/drivers/clk/Makefile ++++ b/drivers/clk/Makefile +@@ -25,6 +25,7 @@ obj-$(CONFIG_COMMON_CLK_CS2000_CP) += clk-cs2000-cp.o + obj-$(CONFIG_ARCH_CLPS711X) += clk-clps711x.o + obj-$(CONFIG_ARCH_EFM32) += clk-efm32gg.o + obj-$(CONFIG_ARCH_HIGHBANK) += clk-highbank.o ++obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS) += clk-hifiberry-dacpro.o + obj-$(CONFIG_MACH_LOONGSON32) += clk-ls1x.o + obj-$(CONFIG_COMMON_CLK_MAX_GEN) += clk-max-gen.o + obj-$(CONFIG_COMMON_CLK_MAX77686) += clk-max77686.o +diff --git a/drivers/clk/clk-hifiberry-dacpro.c b/drivers/clk/clk-hifiberry-dacpro.c +new file mode 100644 +index 0000000..3e35d45 +--- /dev/null ++++ b/drivers/clk/clk-hifiberry-dacpro.c +@@ -0,0 +1,160 @@ ++/* ++ * Clock Driver for HiFiBerry DAC Pro ++ * ++ * Author: Stuart MacLean ++ * Copyright 2015 ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * version 2 as published by the Free Software Foundation. ++ * ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * General Public License for more details. ++ */ ++ ++#include <linux/clk-provider.h> ++#include <linux/clkdev.h> ++#include <linux/kernel.h> ++#include <linux/module.h> ++#include <linux/of.h> ++#include <linux/slab.h> ++#include <linux/platform_device.h> ++ ++/* Clock rate of CLK44EN attached to GPIO6 pin */ ++#define CLK_44EN_RATE 22579200UL ++/* Clock rate of CLK48EN attached to GPIO3 pin */ ++#define CLK_48EN_RATE 24576000UL ++ ++/** ++ * struct hifiberry_dacpro_clk - Common struct to the HiFiBerry DAC Pro ++ * @hw: clk_hw for the common clk framework ++ * @mode: 0 => CLK44EN, 1 => CLK48EN ++ */ ++struct clk_hifiberry_hw { ++ struct clk_hw hw; ++ uint8_t mode; ++}; ++ ++#define to_hifiberry_clk(_hw) container_of(_hw, struct clk_hifiberry_hw, hw) ++ ++static const struct of_device_id clk_hifiberry_dacpro_dt_ids[] = { ++ { .compatible = "hifiberry,dacpro-clk",}, ++ { } ++}; ++MODULE_DEVICE_TABLE(of, clk_hifiberry_dacpro_dt_ids); ++ ++static unsigned long clk_hifiberry_dacpro_recalc_rate(struct clk_hw *hw, ++ unsigned long parent_rate) ++{ ++ return (to_hifiberry_clk(hw)->mode == 0) ? CLK_44EN_RATE : ++ CLK_48EN_RATE; ++} ++ ++static long clk_hifiberry_dacpro_round_rate(struct clk_hw *hw, ++ unsigned long rate, unsigned long *parent_rate) ++{ ++ long actual_rate; ++ ++ if (rate <= CLK_44EN_RATE) { ++ actual_rate = (long)CLK_44EN_RATE; ++ } else if (rate >= CLK_48EN_RATE) { ++ actual_rate = (long)CLK_48EN_RATE; ++ } else { ++ long diff44Rate = (long)(rate - CLK_44EN_RATE); ++ long diff48Rate = (long)(CLK_48EN_RATE - rate); ++ ++ if (diff44Rate < diff48Rate) ++ actual_rate = (long)CLK_44EN_RATE; ++ else ++ actual_rate = (long)CLK_48EN_RATE; ++ } ++ return actual_rate; ++} ++ ++ ++static int clk_hifiberry_dacpro_set_rate(struct clk_hw *hw, ++ unsigned long rate, unsigned long parent_rate) ++{ ++ unsigned long actual_rate; ++ struct clk_hifiberry_hw *clk = to_hifiberry_clk(hw); ++ ++ actual_rate = (unsigned long)clk_hifiberry_dacpro_round_rate(hw, rate, ++ &parent_rate); ++ clk->mode = (actual_rate == CLK_44EN_RATE) ? 0 : 1; ++ return 0; ++} ++ ++ ++const struct clk_ops clk_hifiberry_dacpro_rate_ops = { ++ .recalc_rate = clk_hifiberry_dacpro_recalc_rate, ++ .round_rate = clk_hifiberry_dacpro_round_rate, ++ .set_rate = clk_hifiberry_dacpro_set_rate, ++}; ++ ++static int clk_hifiberry_dacpro_probe(struct platform_device *pdev) ++{ ++ int ret; ++ struct clk_hifiberry_hw *proclk; ++ struct clk *clk; ++ struct device *dev; ++ struct clk_init_data init; ++ ++ dev = &pdev->dev; ++ ++ proclk = kzalloc(sizeof(struct clk_hifiberry_hw), GFP_KERNEL); ++ if (!proclk) ++ return -ENOMEM; ++ ++ init.name = "clk-hifiberry-dacpro"; ++ init.ops = &clk_hifiberry_dacpro_rate_ops; ++ init.flags = CLK_IS_ROOT | CLK_IS_BASIC; ++ init.parent_names = NULL; ++ init.num_parents = 0; ++ ++ proclk->mode = 0; ++ proclk->hw.init = &init; ++ ++ clk = devm_clk_register(dev, &proclk->hw); ++ if (!IS_ERR(clk)) { ++ ret = of_clk_add_provider(dev->of_node, of_clk_src_simple_get, ++ clk); ++ } else { ++ dev_err(dev, "Fail to register clock driver\n"); ++ kfree(proclk); ++ ret = PTR_ERR(clk); ++ } ++ return ret; ++} ++ ++static int clk_hifiberry_dacpro_remove(struct platform_device *pdev) ++{ ++ of_clk_del_provider(pdev->dev.of_node); ++ return 0; ++} ++ ++static struct platform_driver clk_hifiberry_dacpro_driver = { ++ .probe = clk_hifiberry_dacpro_probe, ++ .remove = clk_hifiberry_dacpro_remove, ++ .driver = { ++ .name = "clk-hifiberry-dacpro", ++ .of_match_table = clk_hifiberry_dacpro_dt_ids, ++ }, ++}; ++ ++static int __init clk_hifiberry_dacpro_init(void) ++{ ++ return platform_driver_register(&clk_hifiberry_dacpro_driver); ++} ++core_initcall(clk_hifiberry_dacpro_init); ++ ++static void __exit clk_hifiberry_dacpro_exit(void) ++{ ++ platform_driver_unregister(&clk_hifiberry_dacpro_driver); ++} ++module_exit(clk_hifiberry_dacpro_exit); ++ ++MODULE_DESCRIPTION("HiFiBerry DAC Pro clock driver"); ++MODULE_LICENSE("GPL v2"); ++MODULE_ALIAS("platform:clk-hifiberry-dacpro"); +diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig +index 38dcdd9..8c338b5 100644 +--- a/sound/soc/bcm/Kconfig ++++ b/sound/soc/bcm/Kconfig +@@ -15,6 +15,13 @@ config SND_BCM2708_SOC_HIFIBERRY_DAC + help + Say Y or M if you want to add support for HifiBerry DAC. + ++config SND_BCM2708_SOC_HIFIBERRY_DACPLUS ++ tristate "Support for HifiBerry DAC+" ++ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S ++ select SND_SOC_PCM512x ++ help ++ Say Y or M if you want to add support for HifiBerry DAC+. ++ + config SND_BCM2708_SOC_HIFIBERRY_DIGI + tristate "Support for HifiBerry Digi" + depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S +diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile +index 08e4dc5..a29538e 100644 +--- a/sound/soc/bcm/Makefile ++++ b/sound/soc/bcm/Makefile +@@ -5,11 +5,13 @@ obj-$(CONFIG_SND_BCM2835_SOC_I2S) += snd-soc-bcm2835-i2s.o + + # BCM2708 Machine Support + snd-soc-hifiberry-dac-objs := hifiberry_dac.o ++snd-soc-hifiberry-dacplus-objs := hifiberry_dacplus.o + snd-soc-hifiberry-digi-objs := hifiberry_digi.o + snd-soc-rpi-dac-objs := rpi-dac.o + snd-soc-iqaudio-dac-objs := iqaudio-dac.o + + obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o ++obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS) += snd-soc-hifiberry-dacplus.o + obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI) += snd-soc-hifiberry-digi.o + obj-$(CONFIG_SND_BCM2708_SOC_RPI_DAC) += snd-soc-rpi-dac.o + obj-$(CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC) += snd-soc-iqaudio-dac.o +diff --git a/sound/soc/bcm/hifiberry_dacplus.c b/sound/soc/bcm/hifiberry_dacplus.c +new file mode 100644 +index 0000000..6560067 +--- /dev/null ++++ b/sound/soc/bcm/hifiberry_dacplus.c +@@ -0,0 +1,358 @@ ++/* ++ * ASoC Driver for HiFiBerry DAC+ / DAC Pro ++ * ++ * Author: Daniel Matuschek, Stuart MacLean <stuart@hifiberry.com> ++ * Copyright 2014-2015 ++ * based on code by Florian Meier <florian.meier@koalo.de> ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * version 2 as published by the Free Software Foundation. ++ * ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * General Public License for more details. ++ */ ++ ++#include <linux/module.h> ++#include <linux/platform_device.h> ++#include <linux/kernel.h> ++#include <linux/clk.h> ++#include <linux/kernel.h> ++#include <linux/module.h> ++#include <linux/of.h> ++#include <linux/slab.h> ++#include <linux/delay.h> ++ ++#include <sound/core.h> ++#include <sound/pcm.h> ++#include <sound/pcm_params.h> ++#include <sound/soc.h> ++#include <sound/jack.h> ++ ++#include "../codecs/pcm512x.h" ++ ++#define HIFIBERRY_DACPRO_NOCLOCK 0 ++#define HIFIBERRY_DACPRO_CLK44EN 1 ++#define HIFIBERRY_DACPRO_CLK48EN 2 ++ ++struct pcm512x_priv { ++ struct regmap *regmap; ++ struct clk *sclk; ++}; ++ ++/* Clock rate of CLK44EN attached to GPIO6 pin */ ++#define CLK_44EN_RATE 22579200UL ++/* Clock rate of CLK48EN attached to GPIO3 pin */ ++#define CLK_48EN_RATE 24576000UL ++ ++static bool slave; ++static bool snd_rpi_hifiberry_is_dacpro; ++static bool digital_gain_0db_limit = true; ++ ++static void snd_rpi_hifiberry_dacplus_select_clk(struct snd_soc_codec *codec, ++ int clk_id) ++{ ++ switch (clk_id) { ++ case HIFIBERRY_DACPRO_NOCLOCK: ++ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x24, 0x00); ++ break; ++ case HIFIBERRY_DACPRO_CLK44EN: ++ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x24, 0x20); ++ break; ++ case HIFIBERRY_DACPRO_CLK48EN: ++ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x24, 0x04); ++ break; ++ } ++} ++ ++static void snd_rpi_hifiberry_dacplus_clk_gpio(struct snd_soc_codec *codec) ++{ ++ snd_soc_update_bits(codec, PCM512x_GPIO_EN, 0x24, 0x24); ++ snd_soc_update_bits(codec, PCM512x_GPIO_OUTPUT_3, 0x0f, 0x02); ++ snd_soc_update_bits(codec, PCM512x_GPIO_OUTPUT_6, 0x0f, 0x02); ++} ++ ++static bool snd_rpi_hifiberry_dacplus_is_sclk(struct snd_soc_codec *codec) ++{ ++ int sck; ++ ++ sck = snd_soc_read(codec, PCM512x_RATE_DET_4); ++ return (!(sck & 0x40)); ++} ++ ++static bool snd_rpi_hifiberry_dacplus_is_sclk_sleep( ++ struct snd_soc_codec *codec) ++{ ++ msleep(2); ++ return snd_rpi_hifiberry_dacplus_is_sclk(codec); ++} ++ ++static bool snd_rpi_hifiberry_dacplus_is_pro_card(struct snd_soc_codec *codec) ++{ ++ bool isClk44EN, isClk48En, isNoClk; ++ ++ snd_rpi_hifiberry_dacplus_clk_gpio(codec); ++ ++ snd_rpi_hifiberry_dacplus_select_clk(codec, HIFIBERRY_DACPRO_CLK44EN); ++ isClk44EN = snd_rpi_hifiberry_dacplus_is_sclk_sleep(codec); ++ ++ snd_rpi_hifiberry_dacplus_select_clk(codec, HIFIBERRY_DACPRO_NOCLOCK); ++ isNoClk = snd_rpi_hifiberry_dacplus_is_sclk_sleep(codec); ++ ++ snd_rpi_hifiberry_dacplus_select_clk(codec, HIFIBERRY_DACPRO_CLK48EN); ++ isClk48En = snd_rpi_hifiberry_dacplus_is_sclk_sleep(codec); ++ ++ return (isClk44EN && isClk48En && !isNoClk); ++} ++ ++static int snd_rpi_hifiberry_dacplus_clk_for_rate(int sample_rate) ++{ ++ int type; ++ ++ switch (sample_rate) { ++ case 11025: ++ case 22050: ++ case 44100: ++ case 88200: ++ case 176400: ++ type = HIFIBERRY_DACPRO_CLK44EN; ++ break; ++ default: ++ type = HIFIBERRY_DACPRO_CLK48EN; ++ break; ++ } ++ return type; ++} ++ ++static void snd_rpi_hifiberry_dacplus_set_sclk(struct snd_soc_codec *codec, ++ int sample_rate) ++{ ++ struct pcm512x_priv *pcm512x = snd_soc_codec_get_drvdata(codec); ++ ++ if (!IS_ERR(pcm512x->sclk)) { ++ int ctype; ++ ++ ctype = snd_rpi_hifiberry_dacplus_clk_for_rate(sample_rate); ++ clk_set_rate(pcm512x->sclk, (ctype == HIFIBERRY_DACPRO_CLK44EN) ++ ? CLK_44EN_RATE : CLK_48EN_RATE); ++ snd_rpi_hifiberry_dacplus_select_clk(codec, ctype); ++ } ++} ++ ++static int snd_rpi_hifiberry_dacplus_init(struct snd_soc_pcm_runtime *rtd) ++{ ++ struct snd_soc_codec *codec = rtd->codec; ++ struct pcm512x_priv *priv; ++ ++ if (slave) ++ snd_rpi_hifiberry_is_dacpro = false; ++ else ++ snd_rpi_hifiberry_is_dacpro = ++ snd_rpi_hifiberry_dacplus_is_pro_card(codec); ++ ++ if (snd_rpi_hifiberry_is_dacpro) { ++ struct snd_soc_dai_link *dai = rtd->dai_link; ++ ++ dai->name = "HiFiBerry DAC+ Pro"; ++ dai->stream_name = "HiFiBerry DAC+ Pro HiFi"; ++ dai->dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF ++ | SND_SOC_DAIFMT_CBM_CFM; ++ ++ snd_soc_update_bits(codec, PCM512x_BCLK_LRCLK_CFG, 0x31, 0x11); ++ snd_soc_update_bits(codec, PCM512x_MASTER_MODE, 0x03, 0x03); ++ snd_soc_update_bits(codec, PCM512x_MASTER_CLKDIV_2, 0x7f, 63); ++ } else { ++ priv = snd_soc_codec_get_drvdata(codec); ++ priv->sclk = ERR_PTR(-ENOENT); ++ } ++ ++ snd_soc_update_bits(codec, PCM512x_GPIO_EN, 0x08, 0x08); ++ snd_soc_update_bits(codec, PCM512x_GPIO_OUTPUT_4, 0x0f, 0x02); ++ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x08, 0x08); ++ ++ if (digital_gain_0db_limit) ++ { ++ int ret; ++ struct snd_soc_card *card = rtd->card; ++ ++ ret = snd_soc_limit_volume(card, "Digital Playback Volume", 207); ++ if (ret < 0) ++ dev_warn(card->dev, "Failed to set volume limit: %d\n", ret); ++ } ++ ++ return 0; ++} ++ ++static int snd_rpi_hifiberry_dacplus_update_rate_den( ++ struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params) ++{ ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_codec *codec = rtd->codec; ++ struct pcm512x_priv *pcm512x = snd_soc_codec_get_drvdata(codec); ++ struct snd_ratnum *rats_no_pll; ++ unsigned int num = 0, den = 0; ++ int err; ++ ++ rats_no_pll = devm_kzalloc(rtd->dev, sizeof(*rats_no_pll), GFP_KERNEL); ++ if (!rats_no_pll) ++ return -ENOMEM; ++ ++ rats_no_pll->num = clk_get_rate(pcm512x->sclk) / 64; ++ rats_no_pll->den_min = 1; ++ rats_no_pll->den_max = 128; ++ rats_no_pll->den_step = 1; ++ ++ err = snd_interval_ratnum(hw_param_interval(params, ++ SNDRV_PCM_HW_PARAM_RATE), 1, rats_no_pll, &num, &den); ++ if (err >= 0 && den) { ++ params->rate_num = num; ++ params->rate_den = den; ++ } ++ ++ devm_kfree(rtd->dev, rats_no_pll); ++ return 0; ++} ++ ++static int snd_rpi_hifiberry_dacplus_set_bclk_ratio_pro( ++ struct snd_soc_dai *cpu_dai, struct snd_pcm_hw_params *params) ++{ ++ int bratio = snd_pcm_format_physical_width(params_format(params)) ++ * params_channels(params); ++ return snd_soc_dai_set_bclk_ratio(cpu_dai, bratio); ++} ++ ++static int snd_rpi_hifiberry_dacplus_hw_params( ++ struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params) ++{ ++ int ret; ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; ++ ++ if (snd_rpi_hifiberry_is_dacpro) { ++ struct snd_soc_codec *codec = rtd->codec; ++ ++ snd_rpi_hifiberry_dacplus_set_sclk(codec, ++ params_rate(params)); ++ ++ ret = snd_rpi_hifiberry_dacplus_set_bclk_ratio_pro(cpu_dai, ++ params); ++ if (!ret) ++ ret = snd_rpi_hifiberry_dacplus_update_rate_den( ++ substream, params); ++ } else { ++ ret = snd_soc_dai_set_bclk_ratio(cpu_dai, 64); ++ } ++ return ret; ++} ++ ++static int snd_rpi_hifiberry_dacplus_startup( ++ struct snd_pcm_substream *substream) ++{ ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_codec *codec = rtd->codec; ++ ++ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x08, 0x08); ++ return 0; ++} ++ ++static void snd_rpi_hifiberry_dacplus_shutdown( ++ struct snd_pcm_substream *substream) ++{ ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_codec *codec = rtd->codec; ++ ++ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x08, 0x00); ++} ++ ++/* machine stream operations */ ++static struct snd_soc_ops snd_rpi_hifiberry_dacplus_ops = { ++ .hw_params = snd_rpi_hifiberry_dacplus_hw_params, ++ .startup = snd_rpi_hifiberry_dacplus_startup, ++ .shutdown = snd_rpi_hifiberry_dacplus_shutdown, ++}; ++ ++static struct snd_soc_dai_link snd_rpi_hifiberry_dacplus_dai[] = { ++{ ++ .name = "HiFiBerry DAC+", ++ .stream_name = "HiFiBerry DAC+ HiFi", ++ .cpu_dai_name = "bcm2708-i2s.0", ++ .codec_dai_name = "pcm512x-hifi", ++ .platform_name = "bcm2708-i2s.0", ++ .codec_name = "pcm512x.1-004d", ++ .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | ++ SND_SOC_DAIFMT_CBS_CFS, ++ .ops = &snd_rpi_hifiberry_dacplus_ops, ++ .init = snd_rpi_hifiberry_dacplus_init, ++}, ++}; ++ ++/* audio machine driver */ ++static struct snd_soc_card snd_rpi_hifiberry_dacplus = { ++ .name = "snd_rpi_hifiberry_dacplus", ++ .owner = THIS_MODULE, ++ .dai_link = snd_rpi_hifiberry_dacplus_dai, ++ .num_links = ARRAY_SIZE(snd_rpi_hifiberry_dacplus_dai), ++}; ++ ++static int snd_rpi_hifiberry_dacplus_probe(struct platform_device *pdev) ++{ ++ int ret = 0; ++ ++ snd_rpi_hifiberry_dacplus.dev = &pdev->dev; ++ if (pdev->dev.of_node) { ++ struct device_node *i2s_node; ++ struct snd_soc_dai_link *dai; ++ ++ dai = &snd_rpi_hifiberry_dacplus_dai[0]; ++ i2s_node = of_parse_phandle(pdev->dev.of_node, ++ "i2s-controller", 0); ++ ++ if (i2s_node) { ++ dai->cpu_dai_name = NULL; ++ dai->cpu_of_node = i2s_node; ++ dai->platform_name = NULL; ++ dai->platform_of_node = i2s_node; ++ } ++ ++ digital_gain_0db_limit = !of_property_read_bool( ++ pdev->dev.of_node, "hifiberry,24db_digital_gain"); ++ slave = of_property_read_bool(pdev->dev.of_node, ++ "hifiberry-dacplus,slave"); ++ } ++ ++ ret = snd_soc_register_card(&snd_rpi_hifiberry_dacplus); ++ if (ret) ++ dev_err(&pdev->dev, ++ "snd_soc_register_card() failed: %d\n", ret); ++ ++ return ret; ++} ++ ++static int snd_rpi_hifiberry_dacplus_remove(struct platform_device *pdev) ++{ ++ return snd_soc_unregister_card(&snd_rpi_hifiberry_dacplus); ++} ++ ++static const struct of_device_id snd_rpi_hifiberry_dacplus_of_match[] = { ++ { .compatible = "hifiberry,hifiberry-dacplus", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, snd_rpi_hifiberry_dacplus_of_match); ++ ++static struct platform_driver snd_rpi_hifiberry_dacplus_driver = { ++ .driver = { ++ .name = "snd-rpi-hifiberry-dacplus", ++ .owner = THIS_MODULE, ++ .of_match_table = snd_rpi_hifiberry_dacplus_of_match, ++ }, ++ .probe = snd_rpi_hifiberry_dacplus_probe, ++ .remove = snd_rpi_hifiberry_dacplus_remove, ++}; ++ ++module_platform_driver(snd_rpi_hifiberry_dacplus_driver); ++ ++MODULE_AUTHOR("Daniel Matuschek <daniel@hifiberry.com>"); ++MODULE_DESCRIPTION("ASoC Driver for HiFiBerry DAC+"); ++MODULE_LICENSE("GPL v2"); +diff --git a/sound/soc/codecs/pcm512x.c b/sound/soc/codecs/pcm512x.c +index 047c489..090fe0e 100644 +--- a/sound/soc/codecs/pcm512x.c ++++ b/sound/soc/codecs/pcm512x.c +@@ -854,7 +854,8 @@ static int pcm512x_set_dividers(struct snd_soc_dai *dai, + int fssp; + int gpio; + +- lrclk_div = snd_soc_params_to_frame_size(params); ++ lrclk_div = snd_pcm_format_physical_width(params_format(params)) ++ * params_channels(params); + if (lrclk_div == 0) { + dev_err(dev, "No LRCLK?\n"); + return -EINVAL; + +From e98480a9bdf2baa680bdd5e92a9cc914c3dea397 Mon Sep 17 00:00:00 2001 +From: Daniel Matuschek <info@crazy-audio.com> +Date: Mon, 4 Aug 2014 11:09:58 +0200 +Subject: [PATCH 073/112] Added driver for HiFiBerry Amp amplifier add-on board + +The driver contains a low-level hardware driver for the TAS5713 and the +drivers for the Raspberry Pi I2S subsystem. + +TAS5713: return error if initialisation fails + +Existing TAS5713 driver logs errors during initialisation, but does not return +an error code. Therefore even if initialisation fails, the driver will still be +loaded, but won't work. This patch fixes this. I2C communication error will now +reported correctly by a non-zero return code. + +HiFiBerry Amp: fix device-tree problems + +Some code to load the driver based on device-tree-overlays was missing. This is added by this patch. +--- + sound/soc/bcm/Kconfig | 7 + + sound/soc/bcm/Makefile | 2 + + sound/soc/bcm/hifiberry_amp.c | 128 +++++++++++++++ + sound/soc/codecs/Kconfig | 4 + + sound/soc/codecs/Makefile | 2 + + sound/soc/codecs/tas5713.c | 369 ++++++++++++++++++++++++++++++++++++++++++ + sound/soc/codecs/tas5713.h | 210 ++++++++++++++++++++++++ + 7 files changed, 722 insertions(+) + create mode 100644 sound/soc/bcm/hifiberry_amp.c + create mode 100644 sound/soc/codecs/tas5713.c + create mode 100644 sound/soc/codecs/tas5713.h + +diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig +index 8c338b5..7677c89 100644 +--- a/sound/soc/bcm/Kconfig ++++ b/sound/soc/bcm/Kconfig +@@ -29,6 +29,13 @@ config SND_BCM2708_SOC_HIFIBERRY_DIGI + help + Say Y or M if you want to add support for HifiBerry Digi S/PDIF output board. + ++config SND_BCM2708_SOC_HIFIBERRY_AMP ++ tristate "Support for the HifiBerry Amp" ++ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S ++ select SND_SOC_TAS5713 ++ help ++ Say Y or M if you want to add support for the HifiBerry Amp amplifier board. ++ + config SND_BCM2708_SOC_RPI_DAC + tristate "Support for RPi-DAC" + depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S +diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile +index a29538e..30db495 100644 +--- a/sound/soc/bcm/Makefile ++++ b/sound/soc/bcm/Makefile +@@ -7,11 +7,13 @@ obj-$(CONFIG_SND_BCM2835_SOC_I2S) += snd-soc-bcm2835-i2s.o + snd-soc-hifiberry-dac-objs := hifiberry_dac.o + snd-soc-hifiberry-dacplus-objs := hifiberry_dacplus.o + snd-soc-hifiberry-digi-objs := hifiberry_digi.o ++snd-soc-hifiberry-amp-objs := hifiberry_amp.o + snd-soc-rpi-dac-objs := rpi-dac.o + snd-soc-iqaudio-dac-objs := iqaudio-dac.o + + obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o + obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS) += snd-soc-hifiberry-dacplus.o + obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI) += snd-soc-hifiberry-digi.o ++obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_AMP) += snd-soc-hifiberry-amp.o + obj-$(CONFIG_SND_BCM2708_SOC_RPI_DAC) += snd-soc-rpi-dac.o + obj-$(CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC) += snd-soc-iqaudio-dac.o +diff --git a/sound/soc/bcm/hifiberry_amp.c b/sound/soc/bcm/hifiberry_amp.c +new file mode 100644 +index 0000000..0bb12e4 +--- /dev/null ++++ b/sound/soc/bcm/hifiberry_amp.c +@@ -0,0 +1,128 @@ ++/* ++ * ASoC Driver for HifiBerry AMP ++ * ++ * Author: Sebastian Eickhoff <basti.eickhoff@googlemail.com> ++ * Copyright 2014 ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * version 2 as published by the Free Software Foundation. ++ * ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * General Public License for more details. ++ */ ++ ++#include <linux/module.h> ++#include <linux/platform_device.h> ++ ++#include <sound/core.h> ++#include <sound/pcm.h> ++#include <sound/pcm_params.h> ++#include <sound/soc.h> ++#include <sound/jack.h> ++ ++static int snd_rpi_hifiberry_amp_init(struct snd_soc_pcm_runtime *rtd) ++{ ++ // ToDo: init of the dsp-registers. ++ return 0; ++} ++ ++static int snd_rpi_hifiberry_amp_hw_params( struct snd_pcm_substream *substream, ++ struct snd_pcm_hw_params *params ) ++{ ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; ++ ++ return snd_soc_dai_set_bclk_ratio(cpu_dai, 64); ++} ++ ++static struct snd_soc_ops snd_rpi_hifiberry_amp_ops = { ++ .hw_params = snd_rpi_hifiberry_amp_hw_params, ++}; ++ ++static struct snd_soc_dai_link snd_rpi_hifiberry_amp_dai[] = { ++ { ++ .name = "HifiBerry AMP", ++ .stream_name = "HifiBerry AMP HiFi", ++ .cpu_dai_name = "bcm2708-i2s.0", ++ .codec_dai_name = "tas5713-hifi", ++ .platform_name = "bcm2708-i2s.0", ++ .codec_name = "tas5713.1-001b", ++ .dai_fmt = SND_SOC_DAIFMT_I2S | ++ SND_SOC_DAIFMT_NB_NF | ++ SND_SOC_DAIFMT_CBS_CFS, ++ .ops = &snd_rpi_hifiberry_amp_ops, ++ .init = snd_rpi_hifiberry_amp_init, ++ }, ++}; ++ ++ ++static struct snd_soc_card snd_rpi_hifiberry_amp = { ++ .name = "snd_rpi_hifiberry_amp", ++ .owner = THIS_MODULE, ++ .dai_link = snd_rpi_hifiberry_amp_dai, ++ .num_links = ARRAY_SIZE(snd_rpi_hifiberry_amp_dai), ++}; ++ ++static const struct of_device_id snd_rpi_hifiberry_amp_of_match[] = { ++ { .compatible = "hifiberry,hifiberry-amp", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, snd_rpi_hifiberry_amp_of_match); ++ ++ ++static int snd_rpi_hifiberry_amp_probe(struct platform_device *pdev) ++{ ++ int ret = 0; ++ ++ snd_rpi_hifiberry_amp.dev = &pdev->dev; ++ ++ if (pdev->dev.of_node) { ++ struct device_node *i2s_node; ++ struct snd_soc_dai_link *dai = &snd_rpi_hifiberry_amp_dai[0]; ++ i2s_node = of_parse_phandle(pdev->dev.of_node, ++ "i2s-controller", 0); ++ ++ if (i2s_node) { ++ dai->cpu_dai_name = NULL; ++ dai->cpu_of_node = i2s_node; ++ dai->platform_name = NULL; ++ dai->platform_of_node = i2s_node; ++ } ++ } ++ ++ ret = snd_soc_register_card(&snd_rpi_hifiberry_amp); ++ ++ if (ret != 0) { ++ dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", ret); ++ } ++ ++ return ret; ++} ++ ++ ++static int snd_rpi_hifiberry_amp_remove(struct platform_device *pdev) ++{ ++ return snd_soc_unregister_card(&snd_rpi_hifiberry_amp); ++} ++ ++ ++static struct platform_driver snd_rpi_hifiberry_amp_driver = { ++ .driver = { ++ .name = "snd-hifiberry-amp", ++ .owner = THIS_MODULE, ++ .of_match_table = snd_rpi_hifiberry_amp_of_match, ++ }, ++ .probe = snd_rpi_hifiberry_amp_probe, ++ .remove = snd_rpi_hifiberry_amp_remove, ++}; ++ ++ ++module_platform_driver(snd_rpi_hifiberry_amp_driver); ++ ++ ++MODULE_AUTHOR("Sebastian Eickhoff <basti.eickhoff@googlemail.com>"); ++MODULE_DESCRIPTION("ASoC driver for HiFiBerry-AMP"); ++MODULE_LICENSE("GPL v2"); +diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig +index 513ab55..ebcfbfd 100644 +--- a/sound/soc/codecs/Kconfig ++++ b/sound/soc/codecs/Kconfig +@@ -129,6 +129,7 @@ config SND_SOC_ALL_CODECS + select SND_SOC_TFA9879 if I2C + select SND_SOC_TLV320AIC23_I2C if I2C + select SND_SOC_TLV320AIC23_SPI if SPI_MASTER ++ select SND_SOC_TAS5713 if I2C + select SND_SOC_TLV320AIC26 if SPI_MASTER + select SND_SOC_TLV320AIC31XX if I2C + select SND_SOC_TLV320AIC32X4 if I2C +@@ -759,6 +760,9 @@ config SND_SOC_TFA9879 + tristate "NXP Semiconductors TFA9879 amplifier" + depends on I2C + ++config SND_SOC_TAS5713 ++ tristate ++ + config SND_SOC_TLV320AIC23 + tristate + +diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile +index b87e845..9974a13 100644 +--- a/sound/soc/codecs/Makefile ++++ b/sound/soc/codecs/Makefile +@@ -132,6 +132,7 @@ snd-soc-sti-sas-objs := sti-sas.o + snd-soc-tas5086-objs := tas5086.o + snd-soc-tas571x-objs := tas571x.o + snd-soc-tfa9879-objs := tfa9879.o ++snd-soc-tas5713-objs := tas5713.o + snd-soc-tlv320aic23-objs := tlv320aic23.o + snd-soc-tlv320aic23-i2c-objs := tlv320aic23-i2c.o + snd-soc-tlv320aic23-spi-objs := tlv320aic23-spi.o +@@ -340,6 +341,7 @@ obj-$(CONFIG_SND_SOC_TAS2552) += snd-soc-tas2552.o + obj-$(CONFIG_SND_SOC_TAS5086) += snd-soc-tas5086.o + obj-$(CONFIG_SND_SOC_TAS571X) += snd-soc-tas571x.o + obj-$(CONFIG_SND_SOC_TFA9879) += snd-soc-tfa9879.o ++obj-$(CONFIG_SND_SOC_TAS5713) += snd-soc-tas5713.o + obj-$(CONFIG_SND_SOC_TLV320AIC23) += snd-soc-tlv320aic23.o + obj-$(CONFIG_SND_SOC_TLV320AIC23_I2C) += snd-soc-tlv320aic23-i2c.o + obj-$(CONFIG_SND_SOC_TLV320AIC23_SPI) += snd-soc-tlv320aic23-spi.o +diff --git a/sound/soc/codecs/tas5713.c b/sound/soc/codecs/tas5713.c +new file mode 100644 +index 0000000..9b27138 +--- /dev/null ++++ b/sound/soc/codecs/tas5713.c +@@ -0,0 +1,369 @@ ++/* ++ * ASoC Driver for TAS5713 ++ * ++ * Author: Sebastian Eickhoff <basti.eickhoff@googlemail.com> ++ * Copyright 2014 ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * version 2 as published by the Free Software Foundation. ++ * ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * General Public License for more details. ++ */ ++ ++#include <linux/module.h> ++#include <linux/moduleparam.h> ++#include <linux/init.h> ++#include <linux/delay.h> ++#include <linux/pm.h> ++#include <linux/i2c.h> ++#include <linux/of_device.h> ++#include <linux/spi/spi.h> ++#include <linux/regmap.h> ++#include <linux/regulator/consumer.h> ++#include <linux/slab.h> ++#include <sound/core.h> ++#include <sound/pcm.h> ++#include <sound/pcm_params.h> ++#include <sound/soc.h> ++#include <sound/initval.h> ++#include <sound/tlv.h> ++ ++#include <linux/kernel.h> ++#include <linux/string.h> ++#include <linux/fs.h> ++#include <asm/uaccess.h> ++ ++#include "tas5713.h" ++ ++ ++static struct i2c_client *i2c; ++ ++struct tas5713_priv { ++ struct regmap *regmap; ++ int mclk_div; ++ struct snd_soc_codec *codec; ++}; ++ ++static struct tas5713_priv *priv_data; ++ ++ ++ ++ ++/* ++ * _ _ ___ _ ___ _ _ ++ * /_\ | | / __| /_\ / __|___ _ _| |_ _ _ ___| |___ ++ * / _ \| |__\__ \/ _ \ | (__/ _ \ ' \ _| '_/ _ \ (_-< ++ * /_/ \_\____|___/_/ \_\ \___\___/_||_\__|_| \___/_/__/ ++ * ++ */ ++ ++static const DECLARE_TLV_DB_SCALE(tas5713_vol_tlv, -10000, 50, 1); ++ ++ ++static const struct snd_kcontrol_new tas5713_snd_controls[] = { ++ SOC_SINGLE_TLV ("Master" , TAS5713_VOL_MASTER, 0, 248, 1, tas5713_vol_tlv), ++ SOC_DOUBLE_R_TLV("Channels" , TAS5713_VOL_CH1, TAS5713_VOL_CH2, 0, 248, 1, tas5713_vol_tlv) ++}; ++ ++ ++ ++ ++/* ++ * __ __ _ _ ___ _ ++ * | \/ |__ _ __| |_ (_)_ _ ___ | \ _ _(_)_ _____ _ _ ++ * | |\/| / _` / _| ' \| | ' \/ -_) | |) | '_| \ V / -_) '_| ++ * |_| |_\__,_\__|_||_|_|_||_\___| |___/|_| |_|\_/\___|_| ++ * ++ */ ++ ++static int tas5713_hw_params(struct snd_pcm_substream *substream, ++ struct snd_pcm_hw_params *params, ++ struct snd_soc_dai *dai) ++{ ++ u16 blen = 0x00; ++ ++ struct snd_soc_codec *codec; ++ codec = dai->codec; ++ priv_data->codec = dai->codec; ++ ++ switch (params_format(params)) { ++ case SNDRV_PCM_FORMAT_S16_LE: ++ blen = 0x03; ++ break; ++ case SNDRV_PCM_FORMAT_S20_3LE: ++ blen = 0x1; ++ break; ++ case SNDRV_PCM_FORMAT_S24_LE: ++ blen = 0x04; ++ break; ++ case SNDRV_PCM_FORMAT_S32_LE: ++ blen = 0x05; ++ break; ++ default: ++ dev_err(dai->dev, "Unsupported word length: %u\n", ++ params_format(params)); ++ return -EINVAL; ++ } ++ ++ // set word length ++ snd_soc_update_bits(codec, TAS5713_SERIAL_DATA_INTERFACE, 0x7, blen); ++ ++ return 0; ++} ++ ++ ++static int tas5713_mute_stream(struct snd_soc_dai *dai, int mute, int stream) ++{ ++ unsigned int val = 0; ++ ++ struct tas5713_priv *tas5713; ++ struct snd_soc_codec *codec = dai->codec; ++ tas5713 = snd_soc_codec_get_drvdata(codec); ++ ++ if (mute) { ++ val = TAS5713_SOFT_MUTE_ALL; ++ } ++ ++ return regmap_write(tas5713->regmap, TAS5713_SOFT_MUTE, val); ++} ++ ++ ++static const struct snd_soc_dai_ops tas5713_dai_ops = { ++ .hw_params = tas5713_hw_params, ++ .mute_stream = tas5713_mute_stream, ++}; ++ ++ ++static struct snd_soc_dai_driver tas5713_dai = { ++ .name = "tas5713-hifi", ++ .playback = { ++ .stream_name = "Playback", ++ .channels_min = 2, ++ .channels_max = 2, ++ .rates = SNDRV_PCM_RATE_8000_48000, ++ .formats = (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE ), ++ }, ++ .ops = &tas5713_dai_ops, ++}; ++ ++ ++ ++ ++/* ++ * ___ _ ___ _ ++ * / __|___ __| |___ __ | \ _ _(_)_ _____ _ _ ++ * | (__/ _ \/ _` / -_) _| | |) | '_| \ V / -_) '_| ++ * \___\___/\__,_\___\__| |___/|_| |_|\_/\___|_| ++ * ++ */ ++ ++static int tas5713_remove(struct snd_soc_codec *codec) ++{ ++ struct tas5713_priv *tas5713; ++ ++ tas5713 = snd_soc_codec_get_drvdata(codec); ++ ++ return 0; ++} ++ ++ ++static int tas5713_probe(struct snd_soc_codec *codec) ++{ ++ struct tas5713_priv *tas5713; ++ int i, ret; ++ ++ i2c = container_of(codec->dev, struct i2c_client, dev); ++ ++ tas5713 = snd_soc_codec_get_drvdata(codec); ++ ++ // Reset error ++ ret = snd_soc_write(codec, TAS5713_ERROR_STATUS, 0x00); ++ if (ret < 0) return ret; ++ ++ // Trim oscillator ++ ret = snd_soc_write(codec, TAS5713_OSC_TRIM, 0x00); ++ if (ret < 0) return ret; ++ msleep(1000); ++ ++ // Reset error ++ ret = snd_soc_write(codec, TAS5713_ERROR_STATUS, 0x00); ++ if (ret < 0) return ret; ++ ++ // Clock mode: 44/48kHz, MCLK=64xfs ++ ret = snd_soc_write(codec, TAS5713_CLOCK_CTRL, 0x60); ++ if (ret < 0) return ret; ++ ++ // I2S 24bit ++ ret = snd_soc_write(codec, TAS5713_SERIAL_DATA_INTERFACE, 0x05); ++ if (ret < 0) return ret; ++ ++ // Unmute ++ ret = snd_soc_write(codec, TAS5713_SYSTEM_CTRL2, 0x00); ++ if (ret < 0) return ret; ++ ret = snd_soc_write(codec, TAS5713_SOFT_MUTE, 0x00); ++ if (ret < 0) return ret; ++ ++ // Set volume to 0db ++ ret = snd_soc_write(codec, TAS5713_VOL_MASTER, 0x00); ++ if (ret < 0) return ret; ++ ++ // Now start programming the default initialization sequence ++ for (i = 0; i < ARRAY_SIZE(tas5713_init_sequence); ++i) { ++ ret = i2c_master_send(i2c, ++ tas5713_init_sequence[i].data, ++ tas5713_init_sequence[i].size); ++ if (ret < 0) { ++ printk(KERN_INFO "TAS5713 CODEC PROBE: InitSeq returns: %d\n", ret); ++ } ++ } ++ ++ // Unmute ++ ret = snd_soc_write(codec, TAS5713_SYSTEM_CTRL2, 0x00); ++ if (ret < 0) return ret; ++ ++ return 0; ++} ++ ++ ++static struct snd_soc_codec_driver soc_codec_dev_tas5713 = { ++ .probe = tas5713_probe, ++ .remove = tas5713_remove, ++ .controls = tas5713_snd_controls, ++ .num_controls = ARRAY_SIZE(tas5713_snd_controls), ++}; ++ ++ ++ ++ ++/* ++ * ___ ___ ___ ___ _ ++ * |_ _|_ ) __| | \ _ _(_)_ _____ _ _ ++ * | | / / (__ | |) | '_| \ V / -_) '_| ++ * |___/___\___| |___/|_| |_|\_/\___|_| ++ * ++ */ ++ ++static const struct reg_default tas5713_reg_defaults[] = { ++ { 0x07 ,0x80 }, // R7 - VOL_MASTER - -40dB ++ { 0x08 , 30 }, // R8 - VOL_CH1 - 0dB ++ { 0x09 , 30 }, // R9 - VOL_CH2 - 0dB ++ { 0x0A ,0x80 }, // R10 - VOL_HEADPHONE - -40dB ++}; ++ ++ ++static bool tas5713_reg_volatile(struct device *dev, unsigned int reg) ++{ ++ switch (reg) { ++ case TAS5713_DEVICE_ID: ++ case TAS5713_ERROR_STATUS: ++ return true; ++ default: ++ return false; ++ } ++} ++ ++ ++static const struct of_device_id tas5713_of_match[] = { ++ { .compatible = "ti,tas5713", }, ++ { } ++}; ++MODULE_DEVICE_TABLE(of, tas5713_of_match); ++ ++ ++static struct regmap_config tas5713_regmap_config = { ++ .reg_bits = 8, ++ .val_bits = 8, ++ ++ .max_register = TAS5713_MAX_REGISTER, ++ .volatile_reg = tas5713_reg_volatile, ++ ++ .cache_type = REGCACHE_RBTREE, ++ .reg_defaults = tas5713_reg_defaults, ++ .num_reg_defaults = ARRAY_SIZE(tas5713_reg_defaults), ++}; ++ ++ ++static int tas5713_i2c_probe(struct i2c_client *i2c, ++ const struct i2c_device_id *id) ++{ ++ int ret; ++ ++ priv_data = devm_kzalloc(&i2c->dev, sizeof *priv_data, GFP_KERNEL); ++ if (!priv_data) ++ return -ENOMEM; ++ ++ priv_data->regmap = devm_regmap_init_i2c(i2c, &tas5713_regmap_config); ++ if (IS_ERR(priv_data->regmap)) { ++ ret = PTR_ERR(priv_data->regmap); ++ return ret; ++ } ++ ++ i2c_set_clientdata(i2c, priv_data); ++ ++ ret = snd_soc_register_codec(&i2c->dev, ++ &soc_codec_dev_tas5713, &tas5713_dai, 1); ++ ++ return ret; ++} ++ ++ ++static int tas5713_i2c_remove(struct i2c_client *i2c) ++{ ++ snd_soc_unregister_codec(&i2c->dev); ++ i2c_set_clientdata(i2c, NULL); ++ ++ kfree(priv_data); ++ ++ return 0; ++} ++ ++ ++static const struct i2c_device_id tas5713_i2c_id[] = { ++ { "tas5713", 0 }, ++ { } ++}; ++ ++MODULE_DEVICE_TABLE(i2c, tas5713_i2c_id); ++ ++ ++static struct i2c_driver tas5713_i2c_driver = { ++ .driver = { ++ .name = "tas5713", ++ .owner = THIS_MODULE, ++ .of_match_table = tas5713_of_match, ++ }, ++ .probe = tas5713_i2c_probe, ++ .remove = tas5713_i2c_remove, ++ .id_table = tas5713_i2c_id ++}; ++ ++ ++static int __init tas5713_modinit(void) ++{ ++ int ret = 0; ++ ++ ret = i2c_add_driver(&tas5713_i2c_driver); ++ if (ret) { ++ printk(KERN_ERR "Failed to register tas5713 I2C driver: %d\n", ++ ret); ++ } ++ ++ return ret; ++} ++module_init(tas5713_modinit); ++ ++ ++static void __exit tas5713_exit(void) ++{ ++ i2c_del_driver(&tas5713_i2c_driver); ++} ++module_exit(tas5713_exit); ++ ++ ++MODULE_AUTHOR("Sebastian Eickhoff <basti.eickhoff@googlemail.com>"); ++MODULE_DESCRIPTION("ASoC driver for TAS5713"); ++MODULE_LICENSE("GPL v2"); +diff --git a/sound/soc/codecs/tas5713.h b/sound/soc/codecs/tas5713.h +new file mode 100644 +index 0000000..8f019e0 +--- /dev/null ++++ b/sound/soc/codecs/tas5713.h +@@ -0,0 +1,210 @@ ++/* ++ * ASoC Driver for TAS5713 ++ * ++ * Author: Sebastian Eickhoff <basti.eickhoff@googlemail.com> ++ * Copyright 2014 ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * version 2 as published by the Free Software Foundation. ++ * ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * General Public License for more details. ++ */ ++ ++#ifndef _TAS5713_H ++#define _TAS5713_H ++ ++ ++// TAS5713 I2C-bus register addresses ++ ++#define TAS5713_CLOCK_CTRL 0x00 ++#define TAS5713_DEVICE_ID 0x01 ++#define TAS5713_ERROR_STATUS 0x02 ++#define TAS5713_SYSTEM_CTRL1 0x03 ++#define TAS5713_SERIAL_DATA_INTERFACE 0x04 ++#define TAS5713_SYSTEM_CTRL2 0x05 ++#define TAS5713_SOFT_MUTE 0x06 ++#define TAS5713_VOL_MASTER 0x07 ++#define TAS5713_VOL_CH1 0x08 ++#define TAS5713_VOL_CH2 0x09 ++#define TAS5713_VOL_HEADPHONE 0x0A ++#define TAS5713_VOL_CONFIG 0x0E ++#define TAS5713_MODULATION_LIMIT 0x10 ++#define TAS5713_IC_DLY_CH1 0x11 ++#define TAS5713_IC_DLY_CH2 0x12 ++#define TAS5713_IC_DLY_CH3 0x13 ++#define TAS5713_IC_DLY_CH4 0x14 ++ ++#define TAS5713_START_STOP_PERIOD 0x1A ++#define TAS5713_OSC_TRIM 0x1B ++#define TAS5713_BKND_ERR 0x1C ++ ++#define TAS5713_INPUT_MUX 0x20 ++#define TAS5713_SRC_SELECT_CH4 0x21 ++#define TAS5713_PWM_MUX 0x25 ++ ++#define TAS5713_CH1_BQ0 0x29 ++#define TAS5713_CH1_BQ1 0x2A ++#define TAS5713_CH1_BQ2 0x2B ++#define TAS5713_CH1_BQ3 0x2C ++#define TAS5713_CH1_BQ4 0x2D ++#define TAS5713_CH1_BQ5 0x2E ++#define TAS5713_CH1_BQ6 0x2F ++#define TAS5713_CH1_BQ7 0x58 ++#define TAS5713_CH1_BQ8 0x59 ++ ++#define TAS5713_CH2_BQ0 0x30 ++#define TAS5713_CH2_BQ1 0x31 ++#define TAS5713_CH2_BQ2 0x32 ++#define TAS5713_CH2_BQ3 0x33 ++#define TAS5713_CH2_BQ4 0x34 ++#define TAS5713_CH2_BQ5 0x35 ++#define TAS5713_CH2_BQ6 0x36 ++#define TAS5713_CH2_BQ7 0x5C ++#define TAS5713_CH2_BQ8 0x5D ++ ++#define TAS5713_CH4_BQ0 0x5A ++#define TAS5713_CH4_BQ1 0x5B ++#define TAS5713_CH3_BQ0 0x5E ++#define TAS5713_CH3_BQ1 0x5F ++ ++#define TAS5713_DRC1_SOFTENING_FILTER_ALPHA_OMEGA 0x3B ++#define TAS5713_DRC1_ATTACK_RELEASE_RATE 0x3C ++#define TAS5713_DRC2_SOFTENING_FILTER_ALPHA_OMEGA 0x3E ++#define TAS5713_DRC2_ATTACK_RELEASE_RATE 0x3F ++#define TAS5713_DRC1_ATTACK_RELEASE_THRES 0x40 ++#define TAS5713_DRC2_ATTACK_RELEASE_THRES 0x43 ++#define TAS5713_DRC_CTRL 0x46 ++ ++#define TAS5713_BANK_SW_CTRL 0x50 ++#define TAS5713_CH1_OUTPUT_MIXER 0x51 ++#define TAS5713_CH2_OUTPUT_MIXER 0x52 ++#define TAS5713_CH1_INPUT_MIXER 0x53 ++#define TAS5713_CH2_INPUT_MIXER 0x54 ++#define TAS5713_OUTPUT_POST_SCALE 0x56 ++#define TAS5713_OUTPUT_PRESCALE 0x57 ++ ++#define TAS5713_IDF_POST_SCALE 0x62 ++ ++#define TAS5713_CH1_INLINE_MIXER 0x70 ++#define TAS5713_CH1_INLINE_DRC_EN_MIXER 0x71 ++#define TAS5713_CH1_R_CHANNEL_MIXER 0x72 ++#define TAS5713_CH1_L_CHANNEL_MIXER 0x73 ++#define TAS5713_CH2_INLINE_MIXER 0x74 ++#define TAS5713_CH2_INLINE_DRC_EN_MIXER 0x75 ++#define TAS5713_CH2_L_CHANNEL_MIXER 0x76 ++#define TAS5713_CH2_R_CHANNEL_MIXER 0x77 ++ ++#define TAS5713_UPDATE_DEV_ADDR_KEY 0xF8 ++#define TAS5713_UPDATE_DEV_ADDR_REG 0xF9 ++ ++#define TAS5713_REGISTER_COUNT 0x46 ++#define TAS5713_MAX_REGISTER 0xF9 ++ ++ ++// Bitmasks for registers ++#define TAS5713_SOFT_MUTE_ALL 0x07 ++ ++ ++ ++struct tas5713_init_command { ++ const int size; ++ const char *const data; ++}; ++ ++static const struct tas5713_init_command tas5713_init_sequence[] = { ++ ++ // Trim oscillator ++ { .size = 2, .data = "\x1B\x00" }, ++ // System control register 1 (0x03): block DC ++ { .size = 2, .data = "\x03\x80" }, ++ // Mute everything ++ { .size = 2, .data = "\x05\x40" }, ++ // Modulation limit register (0x10): 97.7% ++ { .size = 2, .data = "\x10\x02" }, ++ // Interchannel delay registers ++ // (0x11, 0x12, 0x13, and 0x14): BD mode ++ { .size = 2, .data = "\x11\xB8" }, ++ { .size = 2, .data = "\x12\x60" }, ++ { .size = 2, .data = "\x13\xA0" }, ++ { .size = 2, .data = "\x14\x48" }, ++ // PWM shutdown group register (0x19): no shutdown ++ { .size = 2, .data = "\x19\x00" }, ++ // Input multiplexer register (0x20): BD mode ++ { .size = 2, .data = "\x20\x00\x89\x77\x72" }, ++ // PWM output mux register (0x25) ++ // Channel 1 --> OUTA, channel 1 neg --> OUTB ++ // Channel 2 --> OUTC, channel 2 neg --> OUTD ++ { .size = 5, .data = "\x25\x01\x02\x13\x45" }, ++ // DRC control (0x46): DRC off ++ { .size = 5, .data = "\x46\x00\x00\x00\x00" }, ++ // BKND_ERR register (0x1C): 299ms reset period ++ { .size = 2, .data = "\x1C\x07" }, ++ // Mute channel 3 ++ { .size = 2, .data = "\x0A\xFF" }, ++ // Volume configuration register (0x0E): volume slew 512 steps ++ { .size = 2, .data = "\x0E\x90" }, ++ // Clock control register (0x00): 44/48kHz, MCLK=64xfs ++ { .size = 2, .data = "\x00\x60" }, ++ // Bank switch and eq control (0x50): no bank switching ++ { .size = 5, .data = "\x50\x00\x00\x00\x00" }, ++ // Volume registers (0x07, 0x08, 0x09, 0x0A) ++ { .size = 2, .data = "\x07\x20" }, ++ { .size = 2, .data = "\x08\x30" }, ++ { .size = 2, .data = "\x09\x30" }, ++ { .size = 2, .data = "\x0A\xFF" }, ++ // 0x72, 0x73, 0x76, 0x77 input mixer: ++ // no intermix between channels ++ { .size = 5, .data = "\x72\x00\x00\x00\x00" }, ++ { .size = 5, .data = "\x73\x00\x80\x00\x00" }, ++ { .size = 5, .data = "\x76\x00\x00\x00\x00" }, ++ { .size = 5, .data = "\x77\x00\x80\x00\x00" }, ++ // 0x70, 0x71, 0x74, 0x75 inline DRC mixer: ++ // no inline DRC inmix ++ { .size = 5, .data = "\x70\x00\x80\x00\x00" }, ++ { .size = 5, .data = "\x71\x00\x00\x00\x00" }, ++ { .size = 5, .data = "\x74\x00\x80\x00\x00" }, ++ { .size = 5, .data = "\x75\x00\x00\x00\x00" }, ++ // 0x56, 0x57 Output scale ++ { .size = 5, .data = "\x56\x00\x80\x00\x00" }, ++ { .size = 5, .data = "\x57\x00\x02\x00\x00" }, ++ // 0x3B, 0x3c ++ { .size = 9, .data = "\x3B\x00\x08\x00\x00\x00\x78\x00\x00" }, ++ { .size = 9, .data = "\x3C\x00\x00\x01\x00\xFF\xFF\xFF\x00" }, ++ { .size = 9, .data = "\x3E\x00\x08\x00\x00\x00\x78\x00\x00" }, ++ { .size = 9, .data = "\x3F\x00\x00\x01\x00\xFF\xFF\xFF\x00" }, ++ { .size = 9, .data = "\x40\x00\x00\x01\x00\xFF\xFF\xFF\x00" }, ++ { .size = 9, .data = "\x43\x00\x00\x01\x00\xFF\xFF\xFF\x00" }, ++ // 0x51, 0x52: output mixer ++ { .size = 9, .data = "\x51\x00\x80\x00\x00\x00\x00\x00\x00" }, ++ { .size = 9, .data = "\x52\x00\x80\x00\x00\x00\x00\x00\x00" }, ++ // PEQ defaults ++ { .size = 21, .data = "\x29\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, ++ { .size = 21, .data = "\x2A\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, ++ { .size = 21, .data = "\x2B\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, ++ { .size = 21, .data = "\x2C\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, ++ { .size = 21, .data = "\x2D\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, ++ { .size = 21, .data = "\x2E\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, ++ { .size = 21, .data = "\x2F\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, ++ { .size = 21, .data = "\x30\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, ++ { .size = 21, .data = "\x31\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, ++ { .size = 21, .data = "\x32\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, ++ { .size = 21, .data = "\x33\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, ++ { .size = 21, .data = "\x34\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, ++ { .size = 21, .data = "\x35\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, ++ { .size = 21, .data = "\x36\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, ++ { .size = 21, .data = "\x58\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, ++ { .size = 21, .data = "\x59\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, ++ { .size = 21, .data = "\x5C\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, ++ { .size = 21, .data = "\x5D\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, ++ { .size = 21, .data = "\x5E\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, ++ { .size = 21, .data = "\x5F\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, ++ { .size = 21, .data = "\x5A\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, ++ { .size = 21, .data = "\x5B\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, ++}; ++ ++ ++#endif /* _TAS5713_H */ + +From c3ed64332c5f99c98c467d4640a94a63d8b0554f Mon Sep 17 00:00:00 2001 +From: Ryan Coe <bluemrp9@gmail.com> +Date: Sat, 31 Jan 2015 18:25:49 -0700 +Subject: [PATCH 074/112] Update ds1307 driver for device-tree support + +Signed-off-by: Ryan Coe <bluemrp9@gmail.com> +--- + drivers/rtc/rtc-ds1307.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c +index e94eb09..f5d93be 100644 +--- a/drivers/rtc/rtc-ds1307.c ++++ b/drivers/rtc/rtc-ds1307.c +@@ -1608,6 +1608,14 @@ static int ds1307_remove(struct i2c_client *client) + return 0; + } + ++#ifdef CONFIG_OF ++static const struct of_device_id ds1307_of_match[] = { ++ { .compatible = "maxim,ds1307" }, ++ { } ++}; ++MODULE_DEVICE_TABLE(of, ds1307_of_match); ++#endif ++ + static struct i2c_driver ds1307_driver = { + .driver = { + .name = "rtc-ds1307", + +From 0cb5de060ca2b6655d39f5e2368439b5e1f0d8f2 Mon Sep 17 00:00:00 2001 +From: Phil Elwell <phil@raspberrypi.org> +Date: Fri, 27 Feb 2015 15:10:24 +0000 +Subject: [PATCH 075/112] enc28j60: Add device tree compatible string and an + overlay + +--- + drivers/net/ethernet/microchip/enc28j60.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/drivers/net/ethernet/microchip/enc28j60.c b/drivers/net/ethernet/microchip/enc28j60.c +index 86ea17e..a1b20c1 100644 +--- a/drivers/net/ethernet/microchip/enc28j60.c ++++ b/drivers/net/ethernet/microchip/enc28j60.c +@@ -1630,9 +1630,16 @@ static int enc28j60_remove(struct spi_device *spi) + return 0; + } + ++static const struct of_device_id enc28j60_of_match[] = { ++ { .compatible = "microchip,enc28j60", }, ++ { /* sentinel */ } ++}; ++MODULE_DEVICE_TABLE(of, enc28j60_of_match); ++ + static struct spi_driver enc28j60_driver = { + .driver = { + .name = DRV_NAME, ++ .of_match_table = enc28j60_of_match, + }, + .probe = enc28j60_probe, + .remove = enc28j60_remove, + +From b93b87463485525ab8d4a782dda0e04d36d1c1b3 Mon Sep 17 00:00:00 2001 +From: Waldemar Brodkorb <wbrodkorb@conet.de> +Date: Wed, 25 Mar 2015 09:26:17 +0100 +Subject: [PATCH 076/112] Add driver for rpi-proto + +Forward port of 3.10.x driver from https://github.com/koalo +We are using a custom board and would like to use rpi 3.18.x +kernel. Patch works fine for our embedded system. + +URL to the audio chip: +http://www.mikroe.com/add-on-boards/audio-voice/audio-codec-proto/ + +Playback tested with devicetree enabled. + +Signed-off-by: Waldemar Brodkorb <wbrodkorb@conet.de> +--- + sound/soc/bcm/Kconfig | 7 +++ + sound/soc/bcm/Makefile | 2 + + sound/soc/bcm/rpi-proto.c | 154 ++++++++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 163 insertions(+) + create mode 100644 sound/soc/bcm/rpi-proto.c + +diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig +index 7677c89..8669a9a 100644 +--- a/sound/soc/bcm/Kconfig ++++ b/sound/soc/bcm/Kconfig +@@ -43,6 +43,13 @@ config SND_BCM2708_SOC_RPI_DAC + help + Say Y or M if you want to add support for RPi-DAC. + ++config SND_BCM2708_SOC_RPI_PROTO ++ tristate "Support for Rpi-PROTO" ++ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S ++ select SND_SOC_WM8731 ++ help ++ Say Y or M if you want to add support for Audio Codec Board PROTO (WM8731). ++ + config SND_BCM2708_SOC_IQAUDIO_DAC + tristate "Support for IQaudIO-DAC" + depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S +diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile +index 30db495..4f5ab1f 100644 +--- a/sound/soc/bcm/Makefile ++++ b/sound/soc/bcm/Makefile +@@ -9,6 +9,7 @@ snd-soc-hifiberry-dacplus-objs := hifiberry_dacplus.o + snd-soc-hifiberry-digi-objs := hifiberry_digi.o + snd-soc-hifiberry-amp-objs := hifiberry_amp.o + snd-soc-rpi-dac-objs := rpi-dac.o ++snd-soc-rpi-proto-objs := rpi-proto.o + snd-soc-iqaudio-dac-objs := iqaudio-dac.o + + obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o +@@ -16,4 +17,5 @@ obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS) += snd-soc-hifiberry-dacplus.o + obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI) += snd-soc-hifiberry-digi.o + obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_AMP) += snd-soc-hifiberry-amp.o + obj-$(CONFIG_SND_BCM2708_SOC_RPI_DAC) += snd-soc-rpi-dac.o ++obj-$(CONFIG_SND_BCM2708_SOC_RPI_PROTO) += snd-soc-rpi-proto.o + obj-$(CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC) += snd-soc-iqaudio-dac.o +diff --git a/sound/soc/bcm/rpi-proto.c b/sound/soc/bcm/rpi-proto.c +new file mode 100644 +index 0000000..9db678e +--- /dev/null ++++ b/sound/soc/bcm/rpi-proto.c +@@ -0,0 +1,154 @@ ++/* ++ * ASoC driver for PROTO AudioCODEC (with a WM8731) ++ * connected to a Raspberry Pi ++ * ++ * Author: Florian Meier, <koalo@koalo.de> ++ * Copyright 2013 ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 as ++ * published by the Free Software Foundation. ++ */ ++ ++#include <linux/module.h> ++#include <linux/platform_device.h> ++ ++#include <sound/core.h> ++#include <sound/pcm.h> ++#include <sound/soc.h> ++#include <sound/jack.h> ++ ++#include "../codecs/wm8731.h" ++ ++static const unsigned int wm8731_rates_12288000[] = { ++ 8000, 32000, 48000, 96000, ++}; ++ ++static struct snd_pcm_hw_constraint_list wm8731_constraints_12288000 = { ++ .list = wm8731_rates_12288000, ++ .count = ARRAY_SIZE(wm8731_rates_12288000), ++}; ++ ++static int snd_rpi_proto_startup(struct snd_pcm_substream *substream) ++{ ++ /* Setup constraints, because there is a 12.288 MHz XTAL on the board */ ++ snd_pcm_hw_constraint_list(substream->runtime, 0, ++ SNDRV_PCM_HW_PARAM_RATE, ++ &wm8731_constraints_12288000); ++ return 0; ++} ++ ++static int snd_rpi_proto_hw_params(struct snd_pcm_substream *substream, ++ struct snd_pcm_hw_params *params) ++{ ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_codec *codec = rtd->codec; ++ struct snd_soc_dai *codec_dai = rtd->codec_dai; ++ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; ++ int sysclk = 12288000; /* This is fixed on this board */ ++ ++ /* Set proto bclk */ ++ int ret = snd_soc_dai_set_bclk_ratio(cpu_dai,32*2); ++ if (ret < 0){ ++ dev_err(codec->dev, ++ "Failed to set BCLK ratio %d\n", ret); ++ return ret; ++ } ++ ++ /* Set proto sysclk */ ++ ret = snd_soc_dai_set_sysclk(codec_dai, WM8731_SYSCLK_XTAL, ++ sysclk, SND_SOC_CLOCK_IN); ++ if (ret < 0) { ++ dev_err(codec->dev, ++ "Failed to set WM8731 SYSCLK: %d\n", ret); ++ return ret; ++ } ++ ++ return 0; ++} ++ ++/* machine stream operations */ ++static struct snd_soc_ops snd_rpi_proto_ops = { ++ .startup = snd_rpi_proto_startup, ++ .hw_params = snd_rpi_proto_hw_params, ++}; ++ ++static struct snd_soc_dai_link snd_rpi_proto_dai[] = { ++{ ++ .name = "WM8731", ++ .stream_name = "WM8731 HiFi", ++ .cpu_dai_name = "bcm2708-i2s.0", ++ .codec_dai_name = "wm8731-hifi", ++ .platform_name = "bcm2708-i2s.0", ++ .codec_name = "wm8731.1-001a", ++ .dai_fmt = SND_SOC_DAIFMT_I2S ++ | SND_SOC_DAIFMT_NB_NF ++ | SND_SOC_DAIFMT_CBM_CFM, ++ .ops = &snd_rpi_proto_ops, ++}, ++}; ++ ++/* audio machine driver */ ++static struct snd_soc_card snd_rpi_proto = { ++ .name = "snd_rpi_proto", ++ .owner = THIS_MODULE, ++ .dai_link = snd_rpi_proto_dai, ++ .num_links = ARRAY_SIZE(snd_rpi_proto_dai), ++}; ++ ++static int snd_rpi_proto_probe(struct platform_device *pdev) ++{ ++ int ret = 0; ++ ++ snd_rpi_proto.dev = &pdev->dev; ++ ++ if (pdev->dev.of_node) { ++ struct device_node *i2s_node; ++ struct snd_soc_dai_link *dai = &snd_rpi_proto_dai[0]; ++ i2s_node = of_parse_phandle(pdev->dev.of_node, ++ "i2s-controller", 0); ++ ++ if (i2s_node) { ++ dai->cpu_dai_name = NULL; ++ dai->cpu_of_node = i2s_node; ++ dai->platform_name = NULL; ++ dai->platform_of_node = i2s_node; ++ } ++ } ++ ++ ret = snd_soc_register_card(&snd_rpi_proto); ++ if (ret) { ++ dev_err(&pdev->dev, ++ "snd_soc_register_card() failed: %d\n", ret); ++ } ++ ++ return ret; ++} ++ ++ ++static int snd_rpi_proto_remove(struct platform_device *pdev) ++{ ++ return snd_soc_unregister_card(&snd_rpi_proto); ++} ++ ++static const struct of_device_id snd_rpi_proto_of_match[] = { ++ { .compatible = "rpi,rpi-proto", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, snd_rpi_proto_of_match); ++ ++static struct platform_driver snd_rpi_proto_driver = { ++ .driver = { ++ .name = "snd-rpi-proto", ++ .owner = THIS_MODULE, ++ .of_match_table = snd_rpi_proto_of_match, ++ }, ++ .probe = snd_rpi_proto_probe, ++ .remove = snd_rpi_proto_remove, ++}; ++ ++module_platform_driver(snd_rpi_proto_driver); ++ ++MODULE_AUTHOR("Florian Meier"); ++MODULE_DESCRIPTION("ASoC Driver for Raspberry Pi connected to PROTO board (WM8731)"); ++MODULE_LICENSE("GPL"); + +From 1bd993b072abd8431882cd24e374c24d3144d206 Mon Sep 17 00:00:00 2001 +From: popcornmix <popcornmix@gmail.com> +Date: Mon, 13 Apr 2015 17:16:29 +0100 +Subject: [PATCH 077/112] config: Add default configs + +--- + arch/arm/configs/bcm2709_defconfig | 1279 +++++++++++++++++++++++++++++++++++ + arch/arm/configs/bcmrpi_defconfig | 1289 ++++++++++++++++++++++++++++++++++++ + 2 files changed, 2568 insertions(+) + create mode 100644 arch/arm/configs/bcm2709_defconfig + create mode 100644 arch/arm/configs/bcmrpi_defconfig + +diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig +new file mode 100644 +index 0000000..f42c5eb +--- /dev/null ++++ b/arch/arm/configs/bcm2709_defconfig +@@ -0,0 +1,1279 @@ ++# CONFIG_ARM_PATCH_PHYS_VIRT is not set ++CONFIG_PHYS_OFFSET=0 ++CONFIG_LOCALVERSION="-v7" ++# CONFIG_LOCALVERSION_AUTO is not set ++CONFIG_SYSVIPC=y ++CONFIG_POSIX_MQUEUE=y ++CONFIG_NO_HZ=y ++CONFIG_HIGH_RES_TIMERS=y ++CONFIG_BSD_PROCESS_ACCT=y ++CONFIG_BSD_PROCESS_ACCT_V3=y ++CONFIG_TASKSTATS=y ++CONFIG_TASK_DELAY_ACCT=y ++CONFIG_TASK_XACCT=y ++CONFIG_TASK_IO_ACCOUNTING=y ++CONFIG_IKCONFIG=m ++CONFIG_IKCONFIG_PROC=y ++CONFIG_MEMCG=y ++CONFIG_BLK_CGROUP=y ++CONFIG_CGROUP_FREEZER=y ++CONFIG_CPUSETS=y ++CONFIG_CGROUP_DEVICE=y ++CONFIG_CGROUP_CPUACCT=y ++CONFIG_NAMESPACES=y ++CONFIG_SCHED_AUTOGROUP=y ++CONFIG_BLK_DEV_INITRD=y ++CONFIG_EMBEDDED=y ++# CONFIG_COMPAT_BRK is not set ++CONFIG_PROFILING=y ++CONFIG_OPROFILE=m ++CONFIG_KPROBES=y ++CONFIG_JUMP_LABEL=y ++CONFIG_MODULES=y ++CONFIG_MODULE_UNLOAD=y ++CONFIG_MODVERSIONS=y ++CONFIG_MODULE_SRCVERSION_ALL=y ++CONFIG_BLK_DEV_THROTTLING=y ++CONFIG_PARTITION_ADVANCED=y ++CONFIG_MAC_PARTITION=y ++CONFIG_CFQ_GROUP_IOSCHED=y ++CONFIG_ARCH_BCM2709=y ++# CONFIG_CACHE_L2X0 is not set ++CONFIG_SMP=y ++CONFIG_HAVE_ARM_ARCH_TIMER=y ++CONFIG_VMSPLIT_2G=y ++CONFIG_PREEMPT_VOLUNTARY=y ++CONFIG_AEABI=y ++CONFIG_OABI_COMPAT=y ++# CONFIG_CPU_SW_DOMAIN_PAN is not set ++CONFIG_CLEANCACHE=y ++CONFIG_FRONTSWAP=y ++CONFIG_CMA=y ++CONFIG_ZSMALLOC=m ++CONFIG_PGTABLE_MAPPING=y ++CONFIG_UACCESS_WITH_MEMCPY=y ++CONFIG_SECCOMP=y ++# CONFIG_ATAGS is not set ++CONFIG_ZBOOT_ROM_TEXT=0x0 ++CONFIG_ZBOOT_ROM_BSS=0x0 ++CONFIG_CMDLINE="console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait" ++CONFIG_CPU_FREQ=y ++CONFIG_CPU_FREQ_STAT=m ++CONFIG_CPU_FREQ_STAT_DETAILS=y ++CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE=y ++CONFIG_CPU_FREQ_GOV_PERFORMANCE=y ++CONFIG_CPU_FREQ_GOV_USERSPACE=y ++CONFIG_CPU_FREQ_GOV_ONDEMAND=y ++CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y ++CONFIG_VFP=y ++CONFIG_NEON=y ++CONFIG_KERNEL_MODE_NEON=y ++CONFIG_BINFMT_MISC=m ++# CONFIG_SUSPEND is not set ++CONFIG_PM=y ++CONFIG_NET=y ++CONFIG_PACKET=y ++CONFIG_UNIX=y ++CONFIG_XFRM_USER=y ++CONFIG_NET_KEY=m ++CONFIG_INET=y ++CONFIG_IP_MULTICAST=y ++CONFIG_IP_ADVANCED_ROUTER=y ++CONFIG_IP_MULTIPLE_TABLES=y ++CONFIG_IP_ROUTE_MULTIPATH=y ++CONFIG_IP_ROUTE_VERBOSE=y ++CONFIG_IP_PNP=y ++CONFIG_IP_PNP_DHCP=y ++CONFIG_IP_PNP_RARP=y ++CONFIG_NET_IPIP=m ++CONFIG_NET_IPGRE_DEMUX=m ++CONFIG_NET_IPGRE=m ++CONFIG_IP_MROUTE=y ++CONFIG_IP_MROUTE_MULTIPLE_TABLES=y ++CONFIG_IP_PIMSM_V1=y ++CONFIG_IP_PIMSM_V2=y ++CONFIG_SYN_COOKIES=y ++CONFIG_INET_AH=m ++CONFIG_INET_ESP=m ++CONFIG_INET_IPCOMP=m ++CONFIG_INET_XFRM_MODE_TRANSPORT=m ++CONFIG_INET_XFRM_MODE_TUNNEL=m ++CONFIG_INET_XFRM_MODE_BEET=m ++CONFIG_INET_DIAG=m ++CONFIG_IPV6=m ++CONFIG_IPV6_ROUTER_PREF=y ++CONFIG_INET6_AH=m ++CONFIG_INET6_ESP=m ++CONFIG_INET6_IPCOMP=m ++CONFIG_IPV6_TUNNEL=m ++CONFIG_IPV6_MULTIPLE_TABLES=y ++CONFIG_IPV6_SUBTREES=y ++CONFIG_IPV6_MROUTE=y ++CONFIG_IPV6_MROUTE_MULTIPLE_TABLES=y ++CONFIG_IPV6_PIMSM_V2=y ++CONFIG_NETFILTER=y ++CONFIG_NF_CONNTRACK=m ++CONFIG_NF_CONNTRACK_ZONES=y ++CONFIG_NF_CONNTRACK_EVENTS=y ++CONFIG_NF_CONNTRACK_TIMESTAMP=y ++CONFIG_NF_CT_PROTO_DCCP=m ++CONFIG_NF_CT_PROTO_UDPLITE=m ++CONFIG_NF_CONNTRACK_AMANDA=m ++CONFIG_NF_CONNTRACK_FTP=m ++CONFIG_NF_CONNTRACK_H323=m ++CONFIG_NF_CONNTRACK_IRC=m ++CONFIG_NF_CONNTRACK_NETBIOS_NS=m ++CONFIG_NF_CONNTRACK_SNMP=m ++CONFIG_NF_CONNTRACK_PPTP=m ++CONFIG_NF_CONNTRACK_SANE=m ++CONFIG_NF_CONNTRACK_SIP=m ++CONFIG_NF_CONNTRACK_TFTP=m ++CONFIG_NF_CT_NETLINK=m ++CONFIG_NETFILTER_XT_SET=m ++CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m ++CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m ++CONFIG_NETFILTER_XT_TARGET_CONNMARK=m ++CONFIG_NETFILTER_XT_TARGET_DSCP=m ++CONFIG_NETFILTER_XT_TARGET_HMARK=m ++CONFIG_NETFILTER_XT_TARGET_IDLETIMER=m ++CONFIG_NETFILTER_XT_TARGET_LED=m ++CONFIG_NETFILTER_XT_TARGET_LOG=m ++CONFIG_NETFILTER_XT_TARGET_MARK=m ++CONFIG_NETFILTER_XT_TARGET_NFLOG=m ++CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m ++CONFIG_NETFILTER_XT_TARGET_NOTRACK=m ++CONFIG_NETFILTER_XT_TARGET_TEE=m ++CONFIG_NETFILTER_XT_TARGET_TPROXY=m ++CONFIG_NETFILTER_XT_TARGET_TRACE=m ++CONFIG_NETFILTER_XT_TARGET_TCPMSS=m ++CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP=m ++CONFIG_NETFILTER_XT_MATCH_ADDRTYPE=m ++CONFIG_NETFILTER_XT_MATCH_BPF=m ++CONFIG_NETFILTER_XT_MATCH_CLUSTER=m ++CONFIG_NETFILTER_XT_MATCH_COMMENT=m ++CONFIG_NETFILTER_XT_MATCH_CONNBYTES=m ++CONFIG_NETFILTER_XT_MATCH_CONNLABEL=m ++CONFIG_NETFILTER_XT_MATCH_CONNLIMIT=m ++CONFIG_NETFILTER_XT_MATCH_CONNMARK=m ++CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m ++CONFIG_NETFILTER_XT_MATCH_CPU=m ++CONFIG_NETFILTER_XT_MATCH_DCCP=m ++CONFIG_NETFILTER_XT_MATCH_DEVGROUP=m ++CONFIG_NETFILTER_XT_MATCH_DSCP=m ++CONFIG_NETFILTER_XT_MATCH_ESP=m ++CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=m ++CONFIG_NETFILTER_XT_MATCH_HELPER=m ++CONFIG_NETFILTER_XT_MATCH_IPRANGE=m ++CONFIG_NETFILTER_XT_MATCH_IPVS=m ++CONFIG_NETFILTER_XT_MATCH_LENGTH=m ++CONFIG_NETFILTER_XT_MATCH_LIMIT=m ++CONFIG_NETFILTER_XT_MATCH_MAC=m ++CONFIG_NETFILTER_XT_MATCH_MARK=m ++CONFIG_NETFILTER_XT_MATCH_MULTIPORT=m ++CONFIG_NETFILTER_XT_MATCH_NFACCT=m ++CONFIG_NETFILTER_XT_MATCH_OSF=m ++CONFIG_NETFILTER_XT_MATCH_OWNER=m ++CONFIG_NETFILTER_XT_MATCH_POLICY=m ++CONFIG_NETFILTER_XT_MATCH_PHYSDEV=m ++CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m ++CONFIG_NETFILTER_XT_MATCH_QUOTA=m ++CONFIG_NETFILTER_XT_MATCH_RATEEST=m ++CONFIG_NETFILTER_XT_MATCH_REALM=m ++CONFIG_NETFILTER_XT_MATCH_RECENT=m ++CONFIG_NETFILTER_XT_MATCH_SOCKET=m ++CONFIG_NETFILTER_XT_MATCH_STATE=m ++CONFIG_NETFILTER_XT_MATCH_STATISTIC=m ++CONFIG_NETFILTER_XT_MATCH_STRING=m ++CONFIG_NETFILTER_XT_MATCH_TCPMSS=m ++CONFIG_NETFILTER_XT_MATCH_TIME=m ++CONFIG_NETFILTER_XT_MATCH_U32=m ++CONFIG_IP_SET=m ++CONFIG_IP_SET_BITMAP_IP=m ++CONFIG_IP_SET_BITMAP_IPMAC=m ++CONFIG_IP_SET_BITMAP_PORT=m ++CONFIG_IP_SET_HASH_IP=m ++CONFIG_IP_SET_HASH_IPPORT=m ++CONFIG_IP_SET_HASH_IPPORTIP=m ++CONFIG_IP_SET_HASH_IPPORTNET=m ++CONFIG_IP_SET_HASH_NET=m ++CONFIG_IP_SET_HASH_NETPORT=m ++CONFIG_IP_SET_HASH_NETIFACE=m ++CONFIG_IP_SET_LIST_SET=m ++CONFIG_IP_VS=m ++CONFIG_IP_VS_PROTO_TCP=y ++CONFIG_IP_VS_PROTO_UDP=y ++CONFIG_IP_VS_PROTO_ESP=y ++CONFIG_IP_VS_PROTO_AH=y ++CONFIG_IP_VS_PROTO_SCTP=y ++CONFIG_IP_VS_RR=m ++CONFIG_IP_VS_WRR=m ++CONFIG_IP_VS_LC=m ++CONFIG_IP_VS_WLC=m ++CONFIG_IP_VS_LBLC=m ++CONFIG_IP_VS_LBLCR=m ++CONFIG_IP_VS_DH=m ++CONFIG_IP_VS_SH=m ++CONFIG_IP_VS_SED=m ++CONFIG_IP_VS_NQ=m ++CONFIG_IP_VS_FTP=m ++CONFIG_IP_VS_PE_SIP=m ++CONFIG_NF_CONNTRACK_IPV4=m ++CONFIG_IP_NF_IPTABLES=m ++CONFIG_IP_NF_MATCH_AH=m ++CONFIG_IP_NF_MATCH_ECN=m ++CONFIG_IP_NF_MATCH_RPFILTER=m ++CONFIG_IP_NF_MATCH_TTL=m ++CONFIG_IP_NF_FILTER=m ++CONFIG_IP_NF_TARGET_REJECT=m ++CONFIG_IP_NF_NAT=m ++CONFIG_IP_NF_TARGET_MASQUERADE=m ++CONFIG_IP_NF_TARGET_NETMAP=m ++CONFIG_IP_NF_TARGET_REDIRECT=m ++CONFIG_IP_NF_MANGLE=m ++CONFIG_IP_NF_TARGET_CLUSTERIP=m ++CONFIG_IP_NF_TARGET_ECN=m ++CONFIG_IP_NF_TARGET_TTL=m ++CONFIG_IP_NF_RAW=m ++CONFIG_IP_NF_ARPTABLES=m ++CONFIG_IP_NF_ARPFILTER=m ++CONFIG_IP_NF_ARP_MANGLE=m ++CONFIG_NF_CONNTRACK_IPV6=m ++CONFIG_IP6_NF_IPTABLES=m ++CONFIG_IP6_NF_MATCH_AH=m ++CONFIG_IP6_NF_MATCH_EUI64=m ++CONFIG_IP6_NF_MATCH_FRAG=m ++CONFIG_IP6_NF_MATCH_OPTS=m ++CONFIG_IP6_NF_MATCH_HL=m ++CONFIG_IP6_NF_MATCH_IPV6HEADER=m ++CONFIG_IP6_NF_MATCH_MH=m ++CONFIG_IP6_NF_MATCH_RPFILTER=m ++CONFIG_IP6_NF_MATCH_RT=m ++CONFIG_IP6_NF_TARGET_HL=m ++CONFIG_IP6_NF_FILTER=m ++CONFIG_IP6_NF_TARGET_REJECT=m ++CONFIG_IP6_NF_MANGLE=m ++CONFIG_IP6_NF_RAW=m ++CONFIG_IP6_NF_NAT=m ++CONFIG_IP6_NF_TARGET_MASQUERADE=m ++CONFIG_IP6_NF_TARGET_NPT=m ++CONFIG_BRIDGE_NF_EBTABLES=m ++CONFIG_BRIDGE_EBT_BROUTE=m ++CONFIG_BRIDGE_EBT_T_FILTER=m ++CONFIG_BRIDGE_EBT_T_NAT=m ++CONFIG_BRIDGE_EBT_802_3=m ++CONFIG_BRIDGE_EBT_AMONG=m ++CONFIG_BRIDGE_EBT_ARP=m ++CONFIG_BRIDGE_EBT_IP=m ++CONFIG_BRIDGE_EBT_IP6=m ++CONFIG_BRIDGE_EBT_LIMIT=m ++CONFIG_BRIDGE_EBT_MARK=m ++CONFIG_BRIDGE_EBT_PKTTYPE=m ++CONFIG_BRIDGE_EBT_STP=m ++CONFIG_BRIDGE_EBT_VLAN=m ++CONFIG_BRIDGE_EBT_ARPREPLY=m ++CONFIG_BRIDGE_EBT_DNAT=m ++CONFIG_BRIDGE_EBT_MARK_T=m ++CONFIG_BRIDGE_EBT_REDIRECT=m ++CONFIG_BRIDGE_EBT_SNAT=m ++CONFIG_BRIDGE_EBT_LOG=m ++CONFIG_BRIDGE_EBT_NFLOG=m ++CONFIG_SCTP_COOKIE_HMAC_SHA1=y ++CONFIG_ATM=m ++CONFIG_L2TP=m ++CONFIG_L2TP_V3=y ++CONFIG_L2TP_IP=m ++CONFIG_L2TP_ETH=m ++CONFIG_BRIDGE=m ++CONFIG_VLAN_8021Q=m ++CONFIG_VLAN_8021Q_GVRP=y ++CONFIG_ATALK=m ++CONFIG_6LOWPAN=m ++CONFIG_IEEE802154=m ++CONFIG_IEEE802154_6LOWPAN=m ++CONFIG_MAC802154=m ++CONFIG_NET_SCHED=y ++CONFIG_NET_SCH_CBQ=m ++CONFIG_NET_SCH_HTB=m ++CONFIG_NET_SCH_HFSC=m ++CONFIG_NET_SCH_PRIO=m ++CONFIG_NET_SCH_MULTIQ=m ++CONFIG_NET_SCH_RED=m ++CONFIG_NET_SCH_SFB=m ++CONFIG_NET_SCH_SFQ=m ++CONFIG_NET_SCH_TEQL=m ++CONFIG_NET_SCH_TBF=m ++CONFIG_NET_SCH_GRED=m ++CONFIG_NET_SCH_DSMARK=m ++CONFIG_NET_SCH_NETEM=m ++CONFIG_NET_SCH_DRR=m ++CONFIG_NET_SCH_MQPRIO=m ++CONFIG_NET_SCH_CHOKE=m ++CONFIG_NET_SCH_QFQ=m ++CONFIG_NET_SCH_CODEL=m ++CONFIG_NET_SCH_FQ_CODEL=m ++CONFIG_NET_SCH_INGRESS=m ++CONFIG_NET_SCH_PLUG=m ++CONFIG_NET_CLS_BASIC=m ++CONFIG_NET_CLS_TCINDEX=m ++CONFIG_NET_CLS_ROUTE4=m ++CONFIG_NET_CLS_FW=m ++CONFIG_NET_CLS_U32=m ++CONFIG_CLS_U32_MARK=y ++CONFIG_NET_CLS_RSVP=m ++CONFIG_NET_CLS_RSVP6=m ++CONFIG_NET_CLS_FLOW=m ++CONFIG_NET_CLS_CGROUP=m ++CONFIG_NET_EMATCH=y ++CONFIG_NET_EMATCH_CMP=m ++CONFIG_NET_EMATCH_NBYTE=m ++CONFIG_NET_EMATCH_U32=m ++CONFIG_NET_EMATCH_META=m ++CONFIG_NET_EMATCH_TEXT=m ++CONFIG_NET_EMATCH_IPSET=m ++CONFIG_NET_CLS_ACT=y ++CONFIG_NET_ACT_POLICE=m ++CONFIG_NET_ACT_GACT=m ++CONFIG_GACT_PROB=y ++CONFIG_NET_ACT_MIRRED=m ++CONFIG_NET_ACT_IPT=m ++CONFIG_NET_ACT_NAT=m ++CONFIG_NET_ACT_PEDIT=m ++CONFIG_NET_ACT_SIMP=m ++CONFIG_NET_ACT_SKBEDIT=m ++CONFIG_NET_ACT_CSUM=m ++CONFIG_BATMAN_ADV=m ++CONFIG_OPENVSWITCH=m ++CONFIG_NET_PKTGEN=m ++CONFIG_HAMRADIO=y ++CONFIG_AX25=m ++CONFIG_NETROM=m ++CONFIG_ROSE=m ++CONFIG_MKISS=m ++CONFIG_6PACK=m ++CONFIG_BPQETHER=m ++CONFIG_BAYCOM_SER_FDX=m ++CONFIG_BAYCOM_SER_HDX=m ++CONFIG_YAM=m ++CONFIG_CAN=m ++CONFIG_CAN_VCAN=m ++CONFIG_CAN_MCP251X=m ++CONFIG_IRDA=m ++CONFIG_IRLAN=m ++CONFIG_IRNET=m ++CONFIG_IRCOMM=m ++CONFIG_IRDA_ULTRA=y ++CONFIG_IRDA_CACHE_LAST_LSAP=y ++CONFIG_IRDA_FAST_RR=y ++CONFIG_IRTTY_SIR=m ++CONFIG_KINGSUN_DONGLE=m ++CONFIG_KSDAZZLE_DONGLE=m ++CONFIG_KS959_DONGLE=m ++CONFIG_USB_IRDA=m ++CONFIG_SIGMATEL_FIR=m ++CONFIG_MCS_FIR=m ++CONFIG_BT=m ++CONFIG_BT_RFCOMM=m ++CONFIG_BT_RFCOMM_TTY=y ++CONFIG_BT_BNEP=m ++CONFIG_BT_BNEP_MC_FILTER=y ++CONFIG_BT_BNEP_PROTO_FILTER=y ++CONFIG_BT_HIDP=m ++CONFIG_BT_6LOWPAN=m ++CONFIG_BT_HCIBTUSB=m ++CONFIG_BT_HCIUART=m ++CONFIG_BT_HCIUART_3WIRE=y ++CONFIG_BT_HCIUART_BCM=y ++CONFIG_BT_HCIBCM203X=m ++CONFIG_BT_HCIBPA10X=m ++CONFIG_BT_HCIBFUSB=m ++CONFIG_BT_HCIVHCI=m ++CONFIG_BT_MRVL=m ++CONFIG_BT_MRVL_SDIO=m ++CONFIG_BT_ATH3K=m ++CONFIG_BT_WILINK=m ++CONFIG_MAC80211=m ++CONFIG_MAC80211_MESH=y ++CONFIG_WIMAX=m ++CONFIG_RFKILL=m ++CONFIG_RFKILL_INPUT=y ++CONFIG_NET_9P=m ++CONFIG_NFC=m ++CONFIG_NFC_PN533=m ++CONFIG_DEVTMPFS=y ++CONFIG_DEVTMPFS_MOUNT=y ++CONFIG_DMA_CMA=y ++CONFIG_CMA_SIZE_MBYTES=5 ++CONFIG_MTD=m ++CONFIG_MTD_BLOCK=m ++CONFIG_MTD_NAND=m ++CONFIG_MTD_UBI=m ++CONFIG_OF_CONFIGFS=y ++CONFIG_ZRAM=m ++CONFIG_ZRAM_LZ4_COMPRESS=y ++CONFIG_BLK_DEV_LOOP=y ++CONFIG_BLK_DEV_CRYPTOLOOP=m ++CONFIG_BLK_DEV_DRBD=m ++CONFIG_BLK_DEV_NBD=m ++CONFIG_BLK_DEV_RAM=y ++CONFIG_CDROM_PKTCDVD=m ++CONFIG_ATA_OVER_ETH=m ++CONFIG_EEPROM_AT24=m ++CONFIG_TI_ST=m ++CONFIG_SCSI=y ++# CONFIG_SCSI_PROC_FS is not set ++CONFIG_BLK_DEV_SD=y ++CONFIG_CHR_DEV_ST=m ++CONFIG_CHR_DEV_OSST=m ++CONFIG_BLK_DEV_SR=m ++CONFIG_CHR_DEV_SG=m ++CONFIG_SCSI_ISCSI_ATTRS=y ++CONFIG_ISCSI_TCP=m ++CONFIG_ISCSI_BOOT_SYSFS=m ++CONFIG_MD=y ++CONFIG_MD_LINEAR=m ++CONFIG_MD_RAID0=m ++CONFIG_BLK_DEV_DM=m ++CONFIG_DM_CRYPT=m ++CONFIG_DM_SNAPSHOT=m ++CONFIG_DM_THIN_PROVISIONING=m ++CONFIG_DM_MIRROR=m ++CONFIG_DM_LOG_USERSPACE=m ++CONFIG_DM_RAID=m ++CONFIG_DM_ZERO=m ++CONFIG_DM_DELAY=m ++CONFIG_NETDEVICES=y ++CONFIG_BONDING=m ++CONFIG_DUMMY=m ++CONFIG_IFB=m ++CONFIG_MACVLAN=m ++CONFIG_NETCONSOLE=m ++CONFIG_TUN=m ++CONFIG_VETH=m ++CONFIG_ENC28J60=m ++CONFIG_QCA7000=m ++CONFIG_MDIO_BITBANG=m ++CONFIG_PPP=m ++CONFIG_PPP_BSDCOMP=m ++CONFIG_PPP_DEFLATE=m ++CONFIG_PPP_FILTER=y ++CONFIG_PPP_MPPE=m ++CONFIG_PPP_MULTILINK=y ++CONFIG_PPPOATM=m ++CONFIG_PPPOE=m ++CONFIG_PPPOL2TP=m ++CONFIG_PPP_ASYNC=m ++CONFIG_PPP_SYNC_TTY=m ++CONFIG_SLIP=m ++CONFIG_SLIP_COMPRESSED=y ++CONFIG_SLIP_SMART=y ++CONFIG_USB_CATC=m ++CONFIG_USB_KAWETH=m ++CONFIG_USB_PEGASUS=m ++CONFIG_USB_RTL8150=m ++CONFIG_USB_RTL8152=m ++CONFIG_USB_USBNET=y ++CONFIG_USB_NET_AX8817X=m ++CONFIG_USB_NET_AX88179_178A=m ++CONFIG_USB_NET_CDCETHER=m ++CONFIG_USB_NET_CDC_EEM=m ++CONFIG_USB_NET_CDC_NCM=m ++CONFIG_USB_NET_HUAWEI_CDC_NCM=m ++CONFIG_USB_NET_CDC_MBIM=m ++CONFIG_USB_NET_DM9601=m ++CONFIG_USB_NET_SR9700=m ++CONFIG_USB_NET_SR9800=m ++CONFIG_USB_NET_SMSC75XX=m ++CONFIG_USB_NET_SMSC95XX=y ++CONFIG_USB_NET_GL620A=m ++CONFIG_USB_NET_NET1080=m ++CONFIG_USB_NET_PLUSB=m ++CONFIG_USB_NET_MCS7830=m ++CONFIG_USB_NET_CDC_SUBSET=m ++CONFIG_USB_ALI_M5632=y ++CONFIG_USB_AN2720=y ++CONFIG_USB_EPSON2888=y ++CONFIG_USB_KC2190=y ++CONFIG_USB_NET_ZAURUS=m ++CONFIG_USB_NET_CX82310_ETH=m ++CONFIG_USB_NET_KALMIA=m ++CONFIG_USB_NET_QMI_WWAN=m ++CONFIG_USB_HSO=m ++CONFIG_USB_NET_INT51X1=m ++CONFIG_USB_IPHETH=m ++CONFIG_USB_SIERRA_NET=m ++CONFIG_USB_VL600=m ++CONFIG_ATH9K=m ++CONFIG_ATH9K_HTC=m ++CONFIG_CARL9170=m ++CONFIG_ATH6KL=m ++CONFIG_ATH6KL_USB=m ++CONFIG_AR5523=m ++CONFIG_AT76C50X_USB=m ++CONFIG_B43=m ++# CONFIG_B43_PHY_N is not set ++CONFIG_B43LEGACY=m ++CONFIG_BRCMFMAC=m ++CONFIG_BRCMFMAC_USB=y ++CONFIG_HOSTAP=m ++CONFIG_P54_COMMON=m ++CONFIG_P54_USB=m ++CONFIG_LIBERTAS=m ++CONFIG_LIBERTAS_USB=m ++CONFIG_LIBERTAS_SDIO=m ++CONFIG_LIBERTAS_THINFIRM=m ++CONFIG_LIBERTAS_THINFIRM_USB=m ++CONFIG_MWIFIEX=m ++CONFIG_MWIFIEX_SDIO=m ++CONFIG_MT7601U=m ++CONFIG_RT2X00=m ++CONFIG_RT2500USB=m ++CONFIG_RT73USB=m ++CONFIG_RT2800USB=m ++CONFIG_RT2800USB_RT3573=y ++CONFIG_RT2800USB_RT53XX=y ++CONFIG_RT2800USB_RT55XX=y ++CONFIG_RT2800USB_UNKNOWN=y ++CONFIG_RTL8187=m ++CONFIG_RTL8192CU=m ++CONFIG_USB_ZD1201=m ++CONFIG_ZD1211RW=m ++CONFIG_MAC80211_HWSIM=m ++CONFIG_USB_NET_RNDIS_WLAN=m ++CONFIG_WIMAX_I2400M_USB=m ++CONFIG_IEEE802154_AT86RF230=m ++CONFIG_IEEE802154_MRF24J40=m ++CONFIG_IEEE802154_CC2520=m ++CONFIG_INPUT_POLLDEV=m ++# CONFIG_INPUT_MOUSEDEV_PSAUX is not set ++CONFIG_INPUT_JOYDEV=m ++CONFIG_INPUT_EVDEV=m ++# CONFIG_KEYBOARD_ATKBD is not set ++CONFIG_KEYBOARD_GPIO=m ++# CONFIG_INPUT_MOUSE is not set ++CONFIG_INPUT_JOYSTICK=y ++CONFIG_JOYSTICK_IFORCE=m ++CONFIG_JOYSTICK_IFORCE_USB=y ++CONFIG_JOYSTICK_XPAD=m ++CONFIG_JOYSTICK_XPAD_FF=y ++CONFIG_JOYSTICK_RPISENSE=m ++CONFIG_INPUT_TOUCHSCREEN=y ++CONFIG_TOUCHSCREEN_ADS7846=m ++CONFIG_TOUCHSCREEN_EGALAX=m ++CONFIG_TOUCHSCREEN_FT6236=m ++CONFIG_TOUCHSCREEN_RPI_FT5406=m ++CONFIG_TOUCHSCREEN_USB_COMPOSITE=m ++CONFIG_TOUCHSCREEN_STMPE=m ++CONFIG_INPUT_MISC=y ++CONFIG_INPUT_AD714X=m ++CONFIG_INPUT_ATI_REMOTE2=m ++CONFIG_INPUT_KEYSPAN_REMOTE=m ++CONFIG_INPUT_POWERMATE=m ++CONFIG_INPUT_YEALINK=m ++CONFIG_INPUT_CM109=m ++CONFIG_INPUT_UINPUT=m ++CONFIG_INPUT_GPIO_ROTARY_ENCODER=m ++CONFIG_INPUT_ADXL34X=m ++CONFIG_INPUT_CMA3000=m ++CONFIG_SERIO=m ++CONFIG_SERIO_RAW=m ++CONFIG_GAMEPORT=m ++CONFIG_GAMEPORT_NS558=m ++CONFIG_GAMEPORT_L4=m ++CONFIG_BRCM_CHAR_DRIVERS=y ++CONFIG_BCM_VC_CMA=y ++CONFIG_BCM_VCIO=y ++CONFIG_BCM_VC_SM=y ++CONFIG_DEVPTS_MULTIPLE_INSTANCES=y ++# CONFIG_LEGACY_PTYS is not set ++# CONFIG_DEVKMEM is not set ++CONFIG_SERIAL_8250=y ++# CONFIG_SERIAL_8250_DEPRECATED_OPTIONS is not set ++CONFIG_SERIAL_8250_CONSOLE=y ++# CONFIG_SERIAL_8250_DMA is not set ++CONFIG_SERIAL_8250_NR_UARTS=1 ++CONFIG_SERIAL_8250_RUNTIME_UARTS=0 ++CONFIG_SERIAL_OF_PLATFORM=y ++CONFIG_SERIAL_AMBA_PL011=y ++CONFIG_SERIAL_AMBA_PL011_CONSOLE=y ++CONFIG_TTY_PRINTK=y ++CONFIG_HW_RANDOM=y ++CONFIG_RAW_DRIVER=y ++CONFIG_I2C=y ++CONFIG_I2C_CHARDEV=m ++CONFIG_I2C_MUX_PCA954x=m ++CONFIG_I2C_BCM2708=m ++CONFIG_I2C_GPIO=m ++CONFIG_SPI=y ++CONFIG_SPI_BCM2835=m ++CONFIG_SPI_BCM2835AUX=m ++CONFIG_SPI_SPIDEV=y ++CONFIG_PPS=m ++CONFIG_PPS_CLIENT_LDISC=m ++CONFIG_PPS_CLIENT_GPIO=m ++CONFIG_GPIO_SYSFS=y ++CONFIG_GPIO_BCM_VIRT=y ++CONFIG_GPIO_ARIZONA=m ++CONFIG_GPIO_STMPE=y ++CONFIG_W1=m ++CONFIG_W1_MASTER_DS2490=m ++CONFIG_W1_MASTER_DS2482=m ++CONFIG_W1_MASTER_DS1WM=m ++CONFIG_W1_MASTER_GPIO=m ++CONFIG_W1_SLAVE_THERM=m ++CONFIG_W1_SLAVE_SMEM=m ++CONFIG_W1_SLAVE_DS2408=m ++CONFIG_W1_SLAVE_DS2413=m ++CONFIG_W1_SLAVE_DS2406=m ++CONFIG_W1_SLAVE_DS2423=m ++CONFIG_W1_SLAVE_DS2431=m ++CONFIG_W1_SLAVE_DS2433=m ++CONFIG_W1_SLAVE_DS2760=m ++CONFIG_W1_SLAVE_DS2780=m ++CONFIG_W1_SLAVE_DS2781=m ++CONFIG_W1_SLAVE_DS28E04=m ++CONFIG_W1_SLAVE_BQ27000=m ++CONFIG_BATTERY_DS2760=m ++CONFIG_POWER_RESET=y ++CONFIG_POWER_RESET_GPIO=y ++CONFIG_HWMON=m ++CONFIG_SENSORS_SHT21=m ++CONFIG_SENSORS_SHTC1=m ++CONFIG_THERMAL=y ++CONFIG_THERMAL_BCM2835=y ++CONFIG_WATCHDOG=y ++CONFIG_BCM2835_WDT=m ++CONFIG_UCB1400_CORE=m ++CONFIG_MFD_STMPE=y ++CONFIG_STMPE_SPI=y ++CONFIG_MFD_ARIZONA_I2C=m ++CONFIG_MFD_ARIZONA_SPI=m ++CONFIG_MFD_WM5102=y ++CONFIG_MEDIA_SUPPORT=m ++CONFIG_MEDIA_CAMERA_SUPPORT=y ++CONFIG_MEDIA_ANALOG_TV_SUPPORT=y ++CONFIG_MEDIA_DIGITAL_TV_SUPPORT=y ++CONFIG_MEDIA_RADIO_SUPPORT=y ++CONFIG_MEDIA_RC_SUPPORT=y ++CONFIG_MEDIA_CONTROLLER=y ++CONFIG_LIRC=m ++CONFIG_RC_DEVICES=y ++CONFIG_RC_ATI_REMOTE=m ++CONFIG_IR_IMON=m ++CONFIG_IR_MCEUSB=m ++CONFIG_IR_REDRAT3=m ++CONFIG_IR_STREAMZAP=m ++CONFIG_IR_IGUANA=m ++CONFIG_IR_TTUSBIR=m ++CONFIG_RC_LOOPBACK=m ++CONFIG_IR_GPIO_CIR=m ++CONFIG_MEDIA_USB_SUPPORT=y ++CONFIG_USB_VIDEO_CLASS=m ++CONFIG_USB_M5602=m ++CONFIG_USB_STV06XX=m ++CONFIG_USB_GL860=m ++CONFIG_USB_GSPCA_BENQ=m ++CONFIG_USB_GSPCA_CONEX=m ++CONFIG_USB_GSPCA_CPIA1=m ++CONFIG_USB_GSPCA_DTCS033=m ++CONFIG_USB_GSPCA_ETOMS=m ++CONFIG_USB_GSPCA_FINEPIX=m ++CONFIG_USB_GSPCA_JEILINJ=m ++CONFIG_USB_GSPCA_JL2005BCD=m ++CONFIG_USB_GSPCA_KINECT=m ++CONFIG_USB_GSPCA_KONICA=m ++CONFIG_USB_GSPCA_MARS=m ++CONFIG_USB_GSPCA_MR97310A=m ++CONFIG_USB_GSPCA_NW80X=m ++CONFIG_USB_GSPCA_OV519=m ++CONFIG_USB_GSPCA_OV534=m ++CONFIG_USB_GSPCA_OV534_9=m ++CONFIG_USB_GSPCA_PAC207=m ++CONFIG_USB_GSPCA_PAC7302=m ++CONFIG_USB_GSPCA_PAC7311=m ++CONFIG_USB_GSPCA_SE401=m ++CONFIG_USB_GSPCA_SN9C2028=m ++CONFIG_USB_GSPCA_SN9C20X=m ++CONFIG_USB_GSPCA_SONIXB=m ++CONFIG_USB_GSPCA_SONIXJ=m ++CONFIG_USB_GSPCA_SPCA500=m ++CONFIG_USB_GSPCA_SPCA501=m ++CONFIG_USB_GSPCA_SPCA505=m ++CONFIG_USB_GSPCA_SPCA506=m ++CONFIG_USB_GSPCA_SPCA508=m ++CONFIG_USB_GSPCA_SPCA561=m ++CONFIG_USB_GSPCA_SPCA1528=m ++CONFIG_USB_GSPCA_SQ905=m ++CONFIG_USB_GSPCA_SQ905C=m ++CONFIG_USB_GSPCA_SQ930X=m ++CONFIG_USB_GSPCA_STK014=m ++CONFIG_USB_GSPCA_STK1135=m ++CONFIG_USB_GSPCA_STV0680=m ++CONFIG_USB_GSPCA_SUNPLUS=m ++CONFIG_USB_GSPCA_T613=m ++CONFIG_USB_GSPCA_TOPRO=m ++CONFIG_USB_GSPCA_TV8532=m ++CONFIG_USB_GSPCA_VC032X=m ++CONFIG_USB_GSPCA_VICAM=m ++CONFIG_USB_GSPCA_XIRLINK_CIT=m ++CONFIG_USB_GSPCA_ZC3XX=m ++CONFIG_USB_PWC=m ++CONFIG_VIDEO_CPIA2=m ++CONFIG_USB_ZR364XX=m ++CONFIG_USB_STKWEBCAM=m ++CONFIG_USB_S2255=m ++CONFIG_VIDEO_USBTV=m ++CONFIG_VIDEO_PVRUSB2=m ++CONFIG_VIDEO_HDPVR=m ++CONFIG_VIDEO_USBVISION=m ++CONFIG_VIDEO_STK1160_COMMON=m ++CONFIG_VIDEO_STK1160_AC97=y ++CONFIG_VIDEO_GO7007=m ++CONFIG_VIDEO_GO7007_USB=m ++CONFIG_VIDEO_GO7007_USB_S2250_BOARD=m ++CONFIG_VIDEO_AU0828=m ++CONFIG_VIDEO_AU0828_RC=y ++CONFIG_VIDEO_CX231XX=m ++CONFIG_VIDEO_CX231XX_ALSA=m ++CONFIG_VIDEO_CX231XX_DVB=m ++CONFIG_VIDEO_TM6000=m ++CONFIG_VIDEO_TM6000_ALSA=m ++CONFIG_VIDEO_TM6000_DVB=m ++CONFIG_DVB_USB=m ++CONFIG_DVB_USB_A800=m ++CONFIG_DVB_USB_DIBUSB_MB=m ++CONFIG_DVB_USB_DIBUSB_MB_FAULTY=y ++CONFIG_DVB_USB_DIBUSB_MC=m ++CONFIG_DVB_USB_DIB0700=m ++CONFIG_DVB_USB_UMT_010=m ++CONFIG_DVB_USB_CXUSB=m ++CONFIG_DVB_USB_M920X=m ++CONFIG_DVB_USB_DIGITV=m ++CONFIG_DVB_USB_VP7045=m ++CONFIG_DVB_USB_VP702X=m ++CONFIG_DVB_USB_GP8PSK=m ++CONFIG_DVB_USB_NOVA_T_USB2=m ++CONFIG_DVB_USB_TTUSB2=m ++CONFIG_DVB_USB_DTT200U=m ++CONFIG_DVB_USB_OPERA1=m ++CONFIG_DVB_USB_AF9005=m ++CONFIG_DVB_USB_AF9005_REMOTE=m ++CONFIG_DVB_USB_PCTV452E=m ++CONFIG_DVB_USB_DW2102=m ++CONFIG_DVB_USB_CINERGY_T2=m ++CONFIG_DVB_USB_DTV5100=m ++CONFIG_DVB_USB_FRIIO=m ++CONFIG_DVB_USB_AZ6027=m ++CONFIG_DVB_USB_TECHNISAT_USB2=m ++CONFIG_DVB_USB_V2=m ++CONFIG_DVB_USB_AF9015=m ++CONFIG_DVB_USB_AF9035=m ++CONFIG_DVB_USB_ANYSEE=m ++CONFIG_DVB_USB_AU6610=m ++CONFIG_DVB_USB_AZ6007=m ++CONFIG_DVB_USB_CE6230=m ++CONFIG_DVB_USB_EC168=m ++CONFIG_DVB_USB_GL861=m ++CONFIG_DVB_USB_LME2510=m ++CONFIG_DVB_USB_MXL111SF=m ++CONFIG_DVB_USB_RTL28XXU=m ++CONFIG_DVB_USB_DVBSKY=m ++CONFIG_SMS_USB_DRV=m ++CONFIG_DVB_B2C2_FLEXCOP_USB=m ++CONFIG_DVB_AS102=m ++CONFIG_VIDEO_EM28XX=m ++CONFIG_VIDEO_EM28XX_V4L2=m ++CONFIG_VIDEO_EM28XX_ALSA=m ++CONFIG_VIDEO_EM28XX_DVB=m ++CONFIG_V4L_PLATFORM_DRIVERS=y ++CONFIG_VIDEO_BCM2835=y ++CONFIG_VIDEO_BCM2835_MMAL=m ++CONFIG_RADIO_SI470X=y ++CONFIG_USB_SI470X=m ++CONFIG_I2C_SI470X=m ++CONFIG_RADIO_SI4713=m ++CONFIG_I2C_SI4713=m ++CONFIG_USB_MR800=m ++CONFIG_USB_DSBR=m ++CONFIG_RADIO_SHARK=m ++CONFIG_RADIO_SHARK2=m ++CONFIG_USB_KEENE=m ++CONFIG_USB_MA901=m ++CONFIG_RADIO_TEA5764=m ++CONFIG_RADIO_SAA7706H=m ++CONFIG_RADIO_TEF6862=m ++CONFIG_RADIO_WL1273=m ++CONFIG_RADIO_WL128X=m ++# CONFIG_MEDIA_SUBDRV_AUTOSELECT is not set ++CONFIG_VIDEO_UDA1342=m ++CONFIG_VIDEO_SONY_BTF_MPX=m ++CONFIG_VIDEO_TVP5150=m ++CONFIG_VIDEO_TW2804=m ++CONFIG_VIDEO_TW9903=m ++CONFIG_VIDEO_TW9906=m ++CONFIG_VIDEO_OV7640=m ++CONFIG_VIDEO_MT9V011=m ++CONFIG_DRM=m ++CONFIG_DRM_LOAD_EDID_FIRMWARE=y ++CONFIG_DRM_UDL=m ++CONFIG_DRM_VC4=m ++CONFIG_FB=y ++CONFIG_FB_BCM2708=y ++CONFIG_FB_UDL=m ++CONFIG_FB_SSD1307=m ++CONFIG_FB_RPISENSE=m ++# CONFIG_BACKLIGHT_GENERIC is not set ++CONFIG_BACKLIGHT_RPI=m ++CONFIG_BACKLIGHT_GPIO=m ++CONFIG_FRAMEBUFFER_CONSOLE=y ++CONFIG_LOGO=y ++# CONFIG_LOGO_LINUX_MONO is not set ++# CONFIG_LOGO_LINUX_VGA16 is not set ++CONFIG_SOUND=y ++CONFIG_SND=m ++CONFIG_SND_SEQUENCER=m ++CONFIG_SND_SEQ_DUMMY=m ++CONFIG_SND_MIXER_OSS=m ++CONFIG_SND_PCM_OSS=m ++CONFIG_SND_SEQUENCER_OSS=y ++CONFIG_SND_HRTIMER=m ++CONFIG_SND_DUMMY=m ++CONFIG_SND_ALOOP=m ++CONFIG_SND_VIRMIDI=m ++CONFIG_SND_MTPAV=m ++CONFIG_SND_SERIAL_U16550=m ++CONFIG_SND_MPU401=m ++CONFIG_SND_BCM2835=m ++CONFIG_SND_USB_AUDIO=m ++CONFIG_SND_USB_UA101=m ++CONFIG_SND_USB_CAIAQ=m ++CONFIG_SND_USB_CAIAQ_INPUT=y ++CONFIG_SND_USB_6FIRE=m ++CONFIG_SND_SOC=m ++CONFIG_SND_BCM2835_SOC_I2S=m ++CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC=m ++CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS=m ++CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI=m ++CONFIG_SND_BCM2708_SOC_HIFIBERRY_AMP=m ++CONFIG_SND_BCM2708_SOC_RPI_DAC=m ++CONFIG_SND_BCM2708_SOC_RPI_PROTO=m ++CONFIG_SND_BCM2708_SOC_BOOMBERRY_DAC=m ++CONFIG_SND_BCM2708_SOC_BOOMBERRY_DIGI=m ++CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC=m ++CONFIG_SND_BCM2708_SOC_RASPIDAC3=m ++CONFIG_SND_BCM2708_SOC_ADAU1977_ADC=m ++CONFIG_SND_AUDIOINJECTOR_PI_SOUNDCARD=m ++CONFIG_SND_SOC_ADAU1701=m ++CONFIG_SND_SOC_WM8804_I2C=m ++CONFIG_SND_SIMPLE_CARD=m ++CONFIG_SOUND_PRIME=m ++CONFIG_HIDRAW=y ++CONFIG_UHID=m ++CONFIG_HID_A4TECH=m ++CONFIG_HID_ACRUX=m ++CONFIG_HID_APPLE=m ++CONFIG_HID_BELKIN=m ++CONFIG_HID_BETOP_FF=m ++CONFIG_HID_CHERRY=m ++CONFIG_HID_CHICONY=m ++CONFIG_HID_CYPRESS=m ++CONFIG_HID_DRAGONRISE=m ++CONFIG_HID_EMS_FF=m ++CONFIG_HID_ELECOM=m ++CONFIG_HID_ELO=m ++CONFIG_HID_EZKEY=m ++CONFIG_HID_HOLTEK=m ++CONFIG_HID_KEYTOUCH=m ++CONFIG_HID_KYE=m ++CONFIG_HID_UCLOGIC=m ++CONFIG_HID_WALTOP=m ++CONFIG_HID_GYRATION=m ++CONFIG_HID_TWINHAN=m ++CONFIG_HID_KENSINGTON=m ++CONFIG_HID_LCPOWER=m ++CONFIG_HID_LOGITECH=m ++CONFIG_HID_LOGITECH_DJ=m ++CONFIG_LOGITECH_FF=y ++CONFIG_LOGIRUMBLEPAD2_FF=y ++CONFIG_LOGIG940_FF=y ++CONFIG_HID_MAGICMOUSE=m ++CONFIG_HID_MICROSOFT=m ++CONFIG_HID_MONTEREY=m ++CONFIG_HID_MULTITOUCH=m ++CONFIG_HID_NTRIG=m ++CONFIG_HID_ORTEK=m ++CONFIG_HID_PANTHERLORD=m ++CONFIG_HID_PETALYNX=m ++CONFIG_HID_PICOLCD=m ++CONFIG_HID_ROCCAT=m ++CONFIG_HID_SAMSUNG=m ++CONFIG_HID_SONY=m ++CONFIG_HID_SPEEDLINK=m ++CONFIG_HID_SUNPLUS=m ++CONFIG_HID_GREENASIA=m ++CONFIG_HID_SMARTJOYPLUS=m ++CONFIG_HID_TOPSEED=m ++CONFIG_HID_THINGM=m ++CONFIG_HID_THRUSTMASTER=m ++CONFIG_HID_WACOM=m ++CONFIG_HID_WIIMOTE=m ++CONFIG_HID_XINMO=m ++CONFIG_HID_ZEROPLUS=m ++CONFIG_HID_ZYDACRON=m ++CONFIG_HID_PID=y ++CONFIG_USB_HIDDEV=y ++CONFIG_USB=y ++CONFIG_USB_ANNOUNCE_NEW_DEVICES=y ++CONFIG_USB_MON=m ++CONFIG_USB_DWCOTG=y ++CONFIG_USB_PRINTER=m ++CONFIG_USB_STORAGE=y ++CONFIG_USB_STORAGE_REALTEK=m ++CONFIG_USB_STORAGE_DATAFAB=m ++CONFIG_USB_STORAGE_FREECOM=m ++CONFIG_USB_STORAGE_ISD200=m ++CONFIG_USB_STORAGE_USBAT=m ++CONFIG_USB_STORAGE_SDDR09=m ++CONFIG_USB_STORAGE_SDDR55=m ++CONFIG_USB_STORAGE_JUMPSHOT=m ++CONFIG_USB_STORAGE_ALAUDA=m ++CONFIG_USB_STORAGE_ONETOUCH=m ++CONFIG_USB_STORAGE_KARMA=m ++CONFIG_USB_STORAGE_CYPRESS_ATACB=m ++CONFIG_USB_STORAGE_ENE_UB6250=m ++CONFIG_USB_MDC800=m ++CONFIG_USB_MICROTEK=m ++CONFIG_USBIP_CORE=m ++CONFIG_USBIP_VHCI_HCD=m ++CONFIG_USBIP_HOST=m ++CONFIG_USB_SERIAL=m ++CONFIG_USB_SERIAL_GENERIC=y ++CONFIG_USB_SERIAL_AIRCABLE=m ++CONFIG_USB_SERIAL_ARK3116=m ++CONFIG_USB_SERIAL_BELKIN=m ++CONFIG_USB_SERIAL_CH341=m ++CONFIG_USB_SERIAL_WHITEHEAT=m ++CONFIG_USB_SERIAL_DIGI_ACCELEPORT=m ++CONFIG_USB_SERIAL_CP210X=m ++CONFIG_USB_SERIAL_CYPRESS_M8=m ++CONFIG_USB_SERIAL_EMPEG=m ++CONFIG_USB_SERIAL_FTDI_SIO=m ++CONFIG_USB_SERIAL_VISOR=m ++CONFIG_USB_SERIAL_IPAQ=m ++CONFIG_USB_SERIAL_IR=m ++CONFIG_USB_SERIAL_EDGEPORT=m ++CONFIG_USB_SERIAL_EDGEPORT_TI=m ++CONFIG_USB_SERIAL_F81232=m ++CONFIG_USB_SERIAL_GARMIN=m ++CONFIG_USB_SERIAL_IPW=m ++CONFIG_USB_SERIAL_IUU=m ++CONFIG_USB_SERIAL_KEYSPAN_PDA=m ++CONFIG_USB_SERIAL_KEYSPAN=m ++CONFIG_USB_SERIAL_KLSI=m ++CONFIG_USB_SERIAL_KOBIL_SCT=m ++CONFIG_USB_SERIAL_MCT_U232=m ++CONFIG_USB_SERIAL_METRO=m ++CONFIG_USB_SERIAL_MOS7720=m ++CONFIG_USB_SERIAL_MOS7840=m ++CONFIG_USB_SERIAL_NAVMAN=m ++CONFIG_USB_SERIAL_PL2303=m ++CONFIG_USB_SERIAL_OTI6858=m ++CONFIG_USB_SERIAL_QCAUX=m ++CONFIG_USB_SERIAL_QUALCOMM=m ++CONFIG_USB_SERIAL_SPCP8X5=m ++CONFIG_USB_SERIAL_SAFE=m ++CONFIG_USB_SERIAL_SIERRAWIRELESS=m ++CONFIG_USB_SERIAL_SYMBOL=m ++CONFIG_USB_SERIAL_TI=m ++CONFIG_USB_SERIAL_CYBERJACK=m ++CONFIG_USB_SERIAL_XIRCOM=m ++CONFIG_USB_SERIAL_OPTION=m ++CONFIG_USB_SERIAL_OMNINET=m ++CONFIG_USB_SERIAL_OPTICON=m ++CONFIG_USB_SERIAL_XSENS_MT=m ++CONFIG_USB_SERIAL_WISHBONE=m ++CONFIG_USB_SERIAL_SSU100=m ++CONFIG_USB_SERIAL_QT2=m ++CONFIG_USB_SERIAL_DEBUG=m ++CONFIG_USB_EMI62=m ++CONFIG_USB_EMI26=m ++CONFIG_USB_ADUTUX=m ++CONFIG_USB_SEVSEG=m ++CONFIG_USB_RIO500=m ++CONFIG_USB_LEGOTOWER=m ++CONFIG_USB_LCD=m ++CONFIG_USB_LED=m ++CONFIG_USB_CYPRESS_CY7C63=m ++CONFIG_USB_CYTHERM=m ++CONFIG_USB_IDMOUSE=m ++CONFIG_USB_FTDI_ELAN=m ++CONFIG_USB_APPLEDISPLAY=m ++CONFIG_USB_LD=m ++CONFIG_USB_TRANCEVIBRATOR=m ++CONFIG_USB_IOWARRIOR=m ++CONFIG_USB_TEST=m ++CONFIG_USB_ISIGHTFW=m ++CONFIG_USB_YUREX=m ++CONFIG_USB_ATM=m ++CONFIG_USB_SPEEDTOUCH=m ++CONFIG_USB_CXACRU=m ++CONFIG_USB_UEAGLEATM=m ++CONFIG_USB_XUSBATM=m ++CONFIG_MMC=y ++CONFIG_MMC_BLOCK_MINORS=32 ++CONFIG_MMC_BCM2835=y ++CONFIG_MMC_BCM2835_DMA=y ++CONFIG_MMC_BCM2835_SDHOST=y ++CONFIG_MMC_SDHCI=y ++CONFIG_MMC_SDHCI_PLTFM=y ++CONFIG_MMC_SPI=m ++CONFIG_LEDS_CLASS=y ++CONFIG_LEDS_GPIO=y ++CONFIG_LEDS_TRIGGER_TIMER=y ++CONFIG_LEDS_TRIGGER_ONESHOT=y ++CONFIG_LEDS_TRIGGER_HEARTBEAT=y ++CONFIG_LEDS_TRIGGER_BACKLIGHT=y ++CONFIG_LEDS_TRIGGER_CPU=y ++CONFIG_LEDS_TRIGGER_GPIO=y ++CONFIG_LEDS_TRIGGER_DEFAULT_ON=y ++CONFIG_LEDS_TRIGGER_TRANSIENT=m ++CONFIG_LEDS_TRIGGER_CAMERA=m ++CONFIG_LEDS_TRIGGER_INPUT=y ++CONFIG_RTC_CLASS=y ++# CONFIG_RTC_HCTOSYS is not set ++CONFIG_RTC_DRV_DS1307=m ++CONFIG_RTC_DRV_DS1374=m ++CONFIG_RTC_DRV_DS1672=m ++CONFIG_RTC_DRV_MAX6900=m ++CONFIG_RTC_DRV_RS5C372=m ++CONFIG_RTC_DRV_ISL1208=m ++CONFIG_RTC_DRV_ISL12022=m ++CONFIG_RTC_DRV_ISL12057=m ++CONFIG_RTC_DRV_X1205=m ++CONFIG_RTC_DRV_PCF8523=m ++CONFIG_RTC_DRV_PCF8563=m ++CONFIG_RTC_DRV_PCF8583=m ++CONFIG_RTC_DRV_M41T80=m ++CONFIG_RTC_DRV_BQ32K=m ++CONFIG_RTC_DRV_S35390A=m ++CONFIG_RTC_DRV_FM3130=m ++CONFIG_RTC_DRV_RX8581=m ++CONFIG_RTC_DRV_RX8025=m ++CONFIG_RTC_DRV_EM3027=m ++CONFIG_RTC_DRV_RV3029C2=m ++CONFIG_RTC_DRV_M41T93=m ++CONFIG_RTC_DRV_M41T94=m ++CONFIG_RTC_DRV_DS1305=m ++CONFIG_RTC_DRV_DS1390=m ++CONFIG_RTC_DRV_R9701=m ++CONFIG_RTC_DRV_RX4581=m ++CONFIG_RTC_DRV_RS5C348=m ++CONFIG_RTC_DRV_MAX6902=m ++CONFIG_RTC_DRV_PCF2123=m ++CONFIG_RTC_DRV_DS3232=m ++CONFIG_RTC_DRV_PCF2127=m ++CONFIG_DMADEVICES=y ++CONFIG_DMA_BCM2835=y ++CONFIG_DMA_BCM2708=y ++CONFIG_UIO=m ++CONFIG_UIO_PDRV_GENIRQ=m ++CONFIG_STAGING=y ++CONFIG_PRISM2_USB=m ++CONFIG_R8712U=m ++CONFIG_R8188EU=m ++CONFIG_R8723AU=m ++CONFIG_VT6656=m ++CONFIG_SPEAKUP=m ++CONFIG_SPEAKUP_SYNTH_SOFT=m ++CONFIG_STAGING_MEDIA=y ++CONFIG_LIRC_STAGING=y ++CONFIG_LIRC_IMON=m ++CONFIG_LIRC_RPI=m ++CONFIG_LIRC_SASEM=m ++CONFIG_LIRC_SERIAL=m ++CONFIG_FB_TFT=m ++CONFIG_FB_TFT_AGM1264K_FL=m ++CONFIG_FB_TFT_BD663474=m ++CONFIG_FB_TFT_HX8340BN=m ++CONFIG_FB_TFT_HX8347D=m ++CONFIG_FB_TFT_HX8353D=m ++CONFIG_FB_TFT_ILI9163=m ++CONFIG_FB_TFT_ILI9320=m ++CONFIG_FB_TFT_ILI9325=m ++CONFIG_FB_TFT_ILI9340=m ++CONFIG_FB_TFT_ILI9341=m ++CONFIG_FB_TFT_ILI9481=m ++CONFIG_FB_TFT_ILI9486=m ++CONFIG_FB_TFT_PCD8544=m ++CONFIG_FB_TFT_RA8875=m ++CONFIG_FB_TFT_S6D02A1=m ++CONFIG_FB_TFT_S6D1121=m ++CONFIG_FB_TFT_SSD1289=m ++CONFIG_FB_TFT_SSD1306=m ++CONFIG_FB_TFT_SSD1331=m ++CONFIG_FB_TFT_SSD1351=m ++CONFIG_FB_TFT_ST7735R=m ++CONFIG_FB_TFT_TINYLCD=m ++CONFIG_FB_TFT_TLS8204=m ++CONFIG_FB_TFT_UC1701=m ++CONFIG_FB_TFT_UPD161704=m ++CONFIG_FB_TFT_WATTEROTT=m ++CONFIG_FB_FLEX=m ++CONFIG_FB_TFT_FBTFT_DEVICE=m ++CONFIG_MAILBOX=y ++CONFIG_BCM2835_MBOX=y ++# CONFIG_IOMMU_SUPPORT is not set ++CONFIG_RASPBERRYPI_POWER=y ++CONFIG_EXTCON=m ++CONFIG_EXTCON_ARIZONA=m ++CONFIG_IIO=m ++CONFIG_IIO_BUFFER=y ++CONFIG_IIO_BUFFER_CB=m ++CONFIG_IIO_KFIFO_BUF=m ++CONFIG_MCP320X=m ++CONFIG_MCP3422=m ++CONFIG_DHT11=m ++CONFIG_PWM_BCM2835=m ++CONFIG_PWM_PCA9685=m ++CONFIG_RASPBERRYPI_FIRMWARE=y ++CONFIG_EXT4_FS=y ++CONFIG_EXT4_FS_POSIX_ACL=y ++CONFIG_EXT4_FS_SECURITY=y ++CONFIG_REISERFS_FS=m ++CONFIG_REISERFS_FS_XATTR=y ++CONFIG_REISERFS_FS_POSIX_ACL=y ++CONFIG_REISERFS_FS_SECURITY=y ++CONFIG_JFS_FS=m ++CONFIG_JFS_POSIX_ACL=y ++CONFIG_JFS_SECURITY=y ++CONFIG_JFS_STATISTICS=y ++CONFIG_XFS_FS=m ++CONFIG_XFS_QUOTA=y ++CONFIG_XFS_POSIX_ACL=y ++CONFIG_XFS_RT=y ++CONFIG_GFS2_FS=m ++CONFIG_OCFS2_FS=m ++CONFIG_BTRFS_FS=m ++CONFIG_BTRFS_FS_POSIX_ACL=y ++CONFIG_NILFS2_FS=m ++CONFIG_F2FS_FS=y ++CONFIG_FANOTIFY=y ++CONFIG_QFMT_V1=m ++CONFIG_QFMT_V2=m ++CONFIG_AUTOFS4_FS=y ++CONFIG_FUSE_FS=m ++CONFIG_CUSE=m ++CONFIG_OVERLAY_FS=m ++CONFIG_FSCACHE=y ++CONFIG_FSCACHE_STATS=y ++CONFIG_FSCACHE_HISTOGRAM=y ++CONFIG_CACHEFILES=y ++CONFIG_ISO9660_FS=m ++CONFIG_JOLIET=y ++CONFIG_ZISOFS=y ++CONFIG_UDF_FS=m ++CONFIG_MSDOS_FS=y ++CONFIG_VFAT_FS=y ++CONFIG_FAT_DEFAULT_IOCHARSET="ascii" ++CONFIG_NTFS_FS=m ++CONFIG_NTFS_RW=y ++CONFIG_TMPFS=y ++CONFIG_TMPFS_POSIX_ACL=y ++CONFIG_ECRYPT_FS=m ++CONFIG_HFS_FS=m ++CONFIG_HFSPLUS_FS=m ++CONFIG_JFFS2_FS=m ++CONFIG_JFFS2_SUMMARY=y ++CONFIG_UBIFS_FS=m ++CONFIG_SQUASHFS=m ++CONFIG_SQUASHFS_XATTR=y ++CONFIG_SQUASHFS_LZO=y ++CONFIG_SQUASHFS_XZ=y ++CONFIG_NFS_FS=y ++CONFIG_NFS_V3_ACL=y ++CONFIG_NFS_V4=y ++CONFIG_NFS_SWAP=y ++CONFIG_ROOT_NFS=y ++CONFIG_NFS_FSCACHE=y ++CONFIG_NFSD=m ++CONFIG_NFSD_V3_ACL=y ++CONFIG_NFSD_V4=y ++CONFIG_CIFS=m ++CONFIG_CIFS_WEAK_PW_HASH=y ++CONFIG_CIFS_UPCALL=y ++CONFIG_CIFS_XATTR=y ++CONFIG_CIFS_POSIX=y ++CONFIG_CIFS_ACL=y ++CONFIG_CIFS_DFS_UPCALL=y ++CONFIG_CIFS_SMB2=y ++CONFIG_CIFS_FSCACHE=y ++CONFIG_9P_FS=m ++CONFIG_9P_FS_POSIX_ACL=y ++CONFIG_NLS_DEFAULT="utf8" ++CONFIG_NLS_CODEPAGE_437=y ++CONFIG_NLS_CODEPAGE_737=m ++CONFIG_NLS_CODEPAGE_775=m ++CONFIG_NLS_CODEPAGE_850=m ++CONFIG_NLS_CODEPAGE_852=m ++CONFIG_NLS_CODEPAGE_855=m ++CONFIG_NLS_CODEPAGE_857=m ++CONFIG_NLS_CODEPAGE_860=m ++CONFIG_NLS_CODEPAGE_861=m ++CONFIG_NLS_CODEPAGE_862=m ++CONFIG_NLS_CODEPAGE_863=m ++CONFIG_NLS_CODEPAGE_864=m ++CONFIG_NLS_CODEPAGE_865=m ++CONFIG_NLS_CODEPAGE_866=m ++CONFIG_NLS_CODEPAGE_869=m ++CONFIG_NLS_CODEPAGE_936=m ++CONFIG_NLS_CODEPAGE_950=m ++CONFIG_NLS_CODEPAGE_932=m ++CONFIG_NLS_CODEPAGE_949=m ++CONFIG_NLS_CODEPAGE_874=m ++CONFIG_NLS_ISO8859_8=m ++CONFIG_NLS_CODEPAGE_1250=m ++CONFIG_NLS_CODEPAGE_1251=m ++CONFIG_NLS_ASCII=y ++CONFIG_NLS_ISO8859_1=m ++CONFIG_NLS_ISO8859_2=m ++CONFIG_NLS_ISO8859_3=m ++CONFIG_NLS_ISO8859_4=m ++CONFIG_NLS_ISO8859_5=m ++CONFIG_NLS_ISO8859_6=m ++CONFIG_NLS_ISO8859_7=m ++CONFIG_NLS_ISO8859_9=m ++CONFIG_NLS_ISO8859_13=m ++CONFIG_NLS_ISO8859_14=m ++CONFIG_NLS_ISO8859_15=m ++CONFIG_NLS_KOI8_R=m ++CONFIG_NLS_KOI8_U=m ++CONFIG_DLM=m ++CONFIG_PRINTK_TIME=y ++CONFIG_BOOT_PRINTK_DELAY=y ++CONFIG_DEBUG_MEMORY_INIT=y ++CONFIG_DETECT_HUNG_TASK=y ++CONFIG_TIMER_STATS=y ++CONFIG_IRQSOFF_TRACER=y ++CONFIG_SCHED_TRACER=y ++CONFIG_STACK_TRACER=y ++CONFIG_BLK_DEV_IO_TRACE=y ++# CONFIG_KPROBE_EVENT is not set ++CONFIG_FUNCTION_PROFILER=y ++CONFIG_KGDB=y ++CONFIG_KGDB_KDB=y ++CONFIG_KDB_KEYBOARD=y ++CONFIG_CRYPTO_USER=m ++CONFIG_CRYPTO_CBC=y ++CONFIG_CRYPTO_CTS=m ++CONFIG_CRYPTO_XTS=m ++CONFIG_CRYPTO_XCBC=m ++CONFIG_CRYPTO_TGR192=m ++CONFIG_CRYPTO_WP512=m ++CONFIG_CRYPTO_CAST5=m ++CONFIG_CRYPTO_DES=y ++CONFIG_CRYPTO_USER_API_SKCIPHER=m ++# CONFIG_CRYPTO_HW is not set ++CONFIG_ARM_CRYPTO=y ++CONFIG_CRYPTO_SHA1_ARM_NEON=m ++CONFIG_CRYPTO_AES_ARM_BS=m ++CONFIG_CRC_ITU_T=y ++CONFIG_LIBCRC32C=y +diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig +new file mode 100644 +index 0000000..8bd0207 +--- /dev/null ++++ b/arch/arm/configs/bcmrpi_defconfig +@@ -0,0 +1,1289 @@ ++# CONFIG_ARM_PATCH_PHYS_VIRT is not set ++CONFIG_PHYS_OFFSET=0 ++# CONFIG_LOCALVERSION_AUTO is not set ++CONFIG_SYSVIPC=y ++CONFIG_POSIX_MQUEUE=y ++CONFIG_NO_HZ=y ++CONFIG_HIGH_RES_TIMERS=y ++CONFIG_BSD_PROCESS_ACCT=y ++CONFIG_BSD_PROCESS_ACCT_V3=y ++CONFIG_TASKSTATS=y ++CONFIG_TASK_DELAY_ACCT=y ++CONFIG_TASK_XACCT=y ++CONFIG_TASK_IO_ACCOUNTING=y ++CONFIG_IKCONFIG=m ++CONFIG_IKCONFIG_PROC=y ++CONFIG_MEMCG=y ++CONFIG_BLK_CGROUP=y ++CONFIG_CGROUP_FREEZER=y ++CONFIG_CPUSETS=y ++CONFIG_CGROUP_DEVICE=y ++CONFIG_CGROUP_CPUACCT=y ++CONFIG_NAMESPACES=y ++CONFIG_SCHED_AUTOGROUP=y ++CONFIG_BLK_DEV_INITRD=y ++CONFIG_EMBEDDED=y ++# CONFIG_COMPAT_BRK is not set ++CONFIG_PROFILING=y ++CONFIG_OPROFILE=m ++CONFIG_KPROBES=y ++CONFIG_JUMP_LABEL=y ++CONFIG_MODULES=y ++CONFIG_MODULE_UNLOAD=y ++CONFIG_MODVERSIONS=y ++CONFIG_MODULE_SRCVERSION_ALL=y ++CONFIG_BLK_DEV_THROTTLING=y ++CONFIG_PARTITION_ADVANCED=y ++CONFIG_MAC_PARTITION=y ++CONFIG_CFQ_GROUP_IOSCHED=y ++CONFIG_ARCH_BCM2708=y ++CONFIG_PREEMPT_VOLUNTARY=y ++CONFIG_AEABI=y ++CONFIG_OABI_COMPAT=y ++# CONFIG_CPU_SW_DOMAIN_PAN is not set ++CONFIG_CLEANCACHE=y ++CONFIG_FRONTSWAP=y ++CONFIG_CMA=y ++CONFIG_ZSMALLOC=m ++CONFIG_PGTABLE_MAPPING=y ++CONFIG_UACCESS_WITH_MEMCPY=y ++CONFIG_SECCOMP=y ++# CONFIG_ATAGS is not set ++CONFIG_ZBOOT_ROM_TEXT=0x0 ++CONFIG_ZBOOT_ROM_BSS=0x0 ++CONFIG_CMDLINE="console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait" ++CONFIG_CPU_FREQ=y ++CONFIG_CPU_FREQ_STAT=m ++CONFIG_CPU_FREQ_STAT_DETAILS=y ++CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE=y ++CONFIG_CPU_FREQ_GOV_PERFORMANCE=y ++CONFIG_CPU_FREQ_GOV_USERSPACE=y ++CONFIG_CPU_FREQ_GOV_ONDEMAND=y ++CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y ++CONFIG_VFP=y ++CONFIG_BINFMT_MISC=m ++# CONFIG_SUSPEND is not set ++CONFIG_PM=y ++CONFIG_NET=y ++CONFIG_PACKET=y ++CONFIG_UNIX=y ++CONFIG_XFRM_USER=y ++CONFIG_NET_KEY=m ++CONFIG_INET=y ++CONFIG_IP_MULTICAST=y ++CONFIG_IP_ADVANCED_ROUTER=y ++CONFIG_IP_MULTIPLE_TABLES=y ++CONFIG_IP_ROUTE_MULTIPATH=y ++CONFIG_IP_ROUTE_VERBOSE=y ++CONFIG_IP_PNP=y ++CONFIG_IP_PNP_DHCP=y ++CONFIG_IP_PNP_RARP=y ++CONFIG_NET_IPIP=m ++CONFIG_NET_IPGRE_DEMUX=m ++CONFIG_NET_IPGRE=m ++CONFIG_IP_MROUTE=y ++CONFIG_IP_MROUTE_MULTIPLE_TABLES=y ++CONFIG_IP_PIMSM_V1=y ++CONFIG_IP_PIMSM_V2=y ++CONFIG_SYN_COOKIES=y ++CONFIG_INET_AH=m ++CONFIG_INET_ESP=m ++CONFIG_INET_IPCOMP=m ++CONFIG_INET_XFRM_MODE_TRANSPORT=m ++CONFIG_INET_XFRM_MODE_TUNNEL=m ++CONFIG_INET_XFRM_MODE_BEET=m ++CONFIG_INET_DIAG=m ++CONFIG_IPV6=m ++CONFIG_IPV6_ROUTER_PREF=y ++CONFIG_INET6_AH=m ++CONFIG_INET6_ESP=m ++CONFIG_INET6_IPCOMP=m ++CONFIG_IPV6_TUNNEL=m ++CONFIG_IPV6_MULTIPLE_TABLES=y ++CONFIG_IPV6_SUBTREES=y ++CONFIG_IPV6_MROUTE=y ++CONFIG_IPV6_MROUTE_MULTIPLE_TABLES=y ++CONFIG_IPV6_PIMSM_V2=y ++CONFIG_NETFILTER=y ++CONFIG_NF_CONNTRACK=m ++CONFIG_NF_CONNTRACK_ZONES=y ++CONFIG_NF_CONNTRACK_EVENTS=y ++CONFIG_NF_CONNTRACK_TIMESTAMP=y ++CONFIG_NF_CT_PROTO_DCCP=m ++CONFIG_NF_CT_PROTO_UDPLITE=m ++CONFIG_NF_CONNTRACK_AMANDA=m ++CONFIG_NF_CONNTRACK_FTP=m ++CONFIG_NF_CONNTRACK_H323=m ++CONFIG_NF_CONNTRACK_IRC=m ++CONFIG_NF_CONNTRACK_NETBIOS_NS=m ++CONFIG_NF_CONNTRACK_SNMP=m ++CONFIG_NF_CONNTRACK_PPTP=m ++CONFIG_NF_CONNTRACK_SANE=m ++CONFIG_NF_CONNTRACK_SIP=m ++CONFIG_NF_CONNTRACK_TFTP=m ++CONFIG_NF_CT_NETLINK=m ++CONFIG_NETFILTER_XT_SET=m ++CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m ++CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m ++CONFIG_NETFILTER_XT_TARGET_CONNMARK=m ++CONFIG_NETFILTER_XT_TARGET_DSCP=m ++CONFIG_NETFILTER_XT_TARGET_HMARK=m ++CONFIG_NETFILTER_XT_TARGET_IDLETIMER=m ++CONFIG_NETFILTER_XT_TARGET_LED=m ++CONFIG_NETFILTER_XT_TARGET_LOG=m ++CONFIG_NETFILTER_XT_TARGET_MARK=m ++CONFIG_NETFILTER_XT_TARGET_NFLOG=m ++CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m ++CONFIG_NETFILTER_XT_TARGET_NOTRACK=m ++CONFIG_NETFILTER_XT_TARGET_TEE=m ++CONFIG_NETFILTER_XT_TARGET_TPROXY=m ++CONFIG_NETFILTER_XT_TARGET_TRACE=m ++CONFIG_NETFILTER_XT_TARGET_TCPMSS=m ++CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP=m ++CONFIG_NETFILTER_XT_MATCH_ADDRTYPE=m ++CONFIG_NETFILTER_XT_MATCH_BPF=m ++CONFIG_NETFILTER_XT_MATCH_CLUSTER=m ++CONFIG_NETFILTER_XT_MATCH_COMMENT=m ++CONFIG_NETFILTER_XT_MATCH_CONNBYTES=m ++CONFIG_NETFILTER_XT_MATCH_CONNLABEL=m ++CONFIG_NETFILTER_XT_MATCH_CONNLIMIT=m ++CONFIG_NETFILTER_XT_MATCH_CONNMARK=m ++CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m ++CONFIG_NETFILTER_XT_MATCH_CPU=m ++CONFIG_NETFILTER_XT_MATCH_DCCP=m ++CONFIG_NETFILTER_XT_MATCH_DEVGROUP=m ++CONFIG_NETFILTER_XT_MATCH_DSCP=m ++CONFIG_NETFILTER_XT_MATCH_ESP=m ++CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=m ++CONFIG_NETFILTER_XT_MATCH_HELPER=m ++CONFIG_NETFILTER_XT_MATCH_IPRANGE=m ++CONFIG_NETFILTER_XT_MATCH_IPVS=m ++CONFIG_NETFILTER_XT_MATCH_LENGTH=m ++CONFIG_NETFILTER_XT_MATCH_LIMIT=m ++CONFIG_NETFILTER_XT_MATCH_MAC=m ++CONFIG_NETFILTER_XT_MATCH_MARK=m ++CONFIG_NETFILTER_XT_MATCH_MULTIPORT=m ++CONFIG_NETFILTER_XT_MATCH_NFACCT=m ++CONFIG_NETFILTER_XT_MATCH_OSF=m ++CONFIG_NETFILTER_XT_MATCH_OWNER=m ++CONFIG_NETFILTER_XT_MATCH_POLICY=m ++CONFIG_NETFILTER_XT_MATCH_PHYSDEV=m ++CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m ++CONFIG_NETFILTER_XT_MATCH_QUOTA=m ++CONFIG_NETFILTER_XT_MATCH_RATEEST=m ++CONFIG_NETFILTER_XT_MATCH_REALM=m ++CONFIG_NETFILTER_XT_MATCH_RECENT=m ++CONFIG_NETFILTER_XT_MATCH_SOCKET=m ++CONFIG_NETFILTER_XT_MATCH_STATE=m ++CONFIG_NETFILTER_XT_MATCH_STATISTIC=m ++CONFIG_NETFILTER_XT_MATCH_STRING=m ++CONFIG_NETFILTER_XT_MATCH_TCPMSS=m ++CONFIG_NETFILTER_XT_MATCH_TIME=m ++CONFIG_NETFILTER_XT_MATCH_U32=m ++CONFIG_IP_SET=m ++CONFIG_IP_SET_BITMAP_IP=m ++CONFIG_IP_SET_BITMAP_IPMAC=m ++CONFIG_IP_SET_BITMAP_PORT=m ++CONFIG_IP_SET_HASH_IP=m ++CONFIG_IP_SET_HASH_IPPORT=m ++CONFIG_IP_SET_HASH_IPPORTIP=m ++CONFIG_IP_SET_HASH_IPPORTNET=m ++CONFIG_IP_SET_HASH_NET=m ++CONFIG_IP_SET_HASH_NETPORT=m ++CONFIG_IP_SET_HASH_NETIFACE=m ++CONFIG_IP_SET_LIST_SET=m ++CONFIG_IP_VS=m ++CONFIG_IP_VS_PROTO_TCP=y ++CONFIG_IP_VS_PROTO_UDP=y ++CONFIG_IP_VS_PROTO_ESP=y ++CONFIG_IP_VS_PROTO_AH=y ++CONFIG_IP_VS_PROTO_SCTP=y ++CONFIG_IP_VS_RR=m ++CONFIG_IP_VS_WRR=m ++CONFIG_IP_VS_LC=m ++CONFIG_IP_VS_WLC=m ++CONFIG_IP_VS_LBLC=m ++CONFIG_IP_VS_LBLCR=m ++CONFIG_IP_VS_DH=m ++CONFIG_IP_VS_SH=m ++CONFIG_IP_VS_SED=m ++CONFIG_IP_VS_NQ=m ++CONFIG_IP_VS_FTP=m ++CONFIG_IP_VS_PE_SIP=m ++CONFIG_NF_CONNTRACK_IPV4=m ++CONFIG_IP_NF_IPTABLES=m ++CONFIG_IP_NF_MATCH_AH=m ++CONFIG_IP_NF_MATCH_ECN=m ++CONFIG_IP_NF_MATCH_RPFILTER=m ++CONFIG_IP_NF_MATCH_TTL=m ++CONFIG_IP_NF_FILTER=m ++CONFIG_IP_NF_TARGET_REJECT=m ++CONFIG_IP_NF_NAT=m ++CONFIG_IP_NF_TARGET_MASQUERADE=m ++CONFIG_IP_NF_TARGET_NETMAP=m ++CONFIG_IP_NF_TARGET_REDIRECT=m ++CONFIG_IP_NF_MANGLE=m ++CONFIG_IP_NF_TARGET_CLUSTERIP=m ++CONFIG_IP_NF_TARGET_ECN=m ++CONFIG_IP_NF_TARGET_TTL=m ++CONFIG_IP_NF_RAW=m ++CONFIG_IP_NF_ARPTABLES=m ++CONFIG_IP_NF_ARPFILTER=m ++CONFIG_IP_NF_ARP_MANGLE=m ++CONFIG_NF_CONNTRACK_IPV6=m ++CONFIG_IP6_NF_IPTABLES=m ++CONFIG_IP6_NF_MATCH_AH=m ++CONFIG_IP6_NF_MATCH_EUI64=m ++CONFIG_IP6_NF_MATCH_FRAG=m ++CONFIG_IP6_NF_MATCH_OPTS=m ++CONFIG_IP6_NF_MATCH_HL=m ++CONFIG_IP6_NF_MATCH_IPV6HEADER=m ++CONFIG_IP6_NF_MATCH_MH=m ++CONFIG_IP6_NF_MATCH_RPFILTER=m ++CONFIG_IP6_NF_MATCH_RT=m ++CONFIG_IP6_NF_TARGET_HL=m ++CONFIG_IP6_NF_FILTER=m ++CONFIG_IP6_NF_TARGET_REJECT=m ++CONFIG_IP6_NF_MANGLE=m ++CONFIG_IP6_NF_RAW=m ++CONFIG_IP6_NF_NAT=m ++CONFIG_IP6_NF_TARGET_MASQUERADE=m ++CONFIG_IP6_NF_TARGET_NPT=m ++CONFIG_BRIDGE_NF_EBTABLES=m ++CONFIG_BRIDGE_EBT_BROUTE=m ++CONFIG_BRIDGE_EBT_T_FILTER=m ++CONFIG_BRIDGE_EBT_T_NAT=m ++CONFIG_BRIDGE_EBT_802_3=m ++CONFIG_BRIDGE_EBT_AMONG=m ++CONFIG_BRIDGE_EBT_ARP=m ++CONFIG_BRIDGE_EBT_IP=m ++CONFIG_BRIDGE_EBT_IP6=m ++CONFIG_BRIDGE_EBT_LIMIT=m ++CONFIG_BRIDGE_EBT_MARK=m ++CONFIG_BRIDGE_EBT_PKTTYPE=m ++CONFIG_BRIDGE_EBT_STP=m ++CONFIG_BRIDGE_EBT_VLAN=m ++CONFIG_BRIDGE_EBT_ARPREPLY=m ++CONFIG_BRIDGE_EBT_DNAT=m ++CONFIG_BRIDGE_EBT_MARK_T=m ++CONFIG_BRIDGE_EBT_REDIRECT=m ++CONFIG_BRIDGE_EBT_SNAT=m ++CONFIG_BRIDGE_EBT_LOG=m ++CONFIG_BRIDGE_EBT_NFLOG=m ++CONFIG_SCTP_COOKIE_HMAC_SHA1=y ++CONFIG_ATM=m ++CONFIG_L2TP=m ++CONFIG_L2TP_V3=y ++CONFIG_L2TP_IP=m ++CONFIG_L2TP_ETH=m ++CONFIG_BRIDGE=m ++CONFIG_VLAN_8021Q=m ++CONFIG_VLAN_8021Q_GVRP=y ++CONFIG_ATALK=m ++CONFIG_6LOWPAN=m ++CONFIG_IEEE802154=m ++CONFIG_IEEE802154_6LOWPAN=m ++CONFIG_MAC802154=m ++CONFIG_NET_SCHED=y ++CONFIG_NET_SCH_CBQ=m ++CONFIG_NET_SCH_HTB=m ++CONFIG_NET_SCH_HFSC=m ++CONFIG_NET_SCH_PRIO=m ++CONFIG_NET_SCH_MULTIQ=m ++CONFIG_NET_SCH_RED=m ++CONFIG_NET_SCH_SFB=m ++CONFIG_NET_SCH_SFQ=m ++CONFIG_NET_SCH_TEQL=m ++CONFIG_NET_SCH_TBF=m ++CONFIG_NET_SCH_GRED=m ++CONFIG_NET_SCH_DSMARK=m ++CONFIG_NET_SCH_NETEM=m ++CONFIG_NET_SCH_DRR=m ++CONFIG_NET_SCH_MQPRIO=m ++CONFIG_NET_SCH_CHOKE=m ++CONFIG_NET_SCH_QFQ=m ++CONFIG_NET_SCH_CODEL=m ++CONFIG_NET_SCH_FQ_CODEL=m ++CONFIG_NET_SCH_INGRESS=m ++CONFIG_NET_SCH_PLUG=m ++CONFIG_NET_CLS_BASIC=m ++CONFIG_NET_CLS_TCINDEX=m ++CONFIG_NET_CLS_ROUTE4=m ++CONFIG_NET_CLS_FW=m ++CONFIG_NET_CLS_U32=m ++CONFIG_CLS_U32_MARK=y ++CONFIG_NET_CLS_RSVP=m ++CONFIG_NET_CLS_RSVP6=m ++CONFIG_NET_CLS_FLOW=m ++CONFIG_NET_CLS_CGROUP=m ++CONFIG_NET_EMATCH=y ++CONFIG_NET_EMATCH_CMP=m ++CONFIG_NET_EMATCH_NBYTE=m ++CONFIG_NET_EMATCH_U32=m ++CONFIG_NET_EMATCH_META=m ++CONFIG_NET_EMATCH_TEXT=m ++CONFIG_NET_EMATCH_IPSET=m ++CONFIG_NET_CLS_ACT=y ++CONFIG_NET_ACT_POLICE=m ++CONFIG_NET_ACT_GACT=m ++CONFIG_GACT_PROB=y ++CONFIG_NET_ACT_MIRRED=m ++CONFIG_NET_ACT_IPT=m ++CONFIG_NET_ACT_NAT=m ++CONFIG_NET_ACT_PEDIT=m ++CONFIG_NET_ACT_SIMP=m ++CONFIG_NET_ACT_SKBEDIT=m ++CONFIG_NET_ACT_CSUM=m ++CONFIG_BATMAN_ADV=m ++CONFIG_OPENVSWITCH=m ++CONFIG_NET_PKTGEN=m ++CONFIG_HAMRADIO=y ++CONFIG_AX25=m ++CONFIG_NETROM=m ++CONFIG_ROSE=m ++CONFIG_MKISS=m ++CONFIG_6PACK=m ++CONFIG_BPQETHER=m ++CONFIG_BAYCOM_SER_FDX=m ++CONFIG_BAYCOM_SER_HDX=m ++CONFIG_YAM=m ++CONFIG_CAN=m ++CONFIG_CAN_VCAN=m ++CONFIG_CAN_MCP251X=m ++CONFIG_IRDA=m ++CONFIG_IRLAN=m ++CONFIG_IRNET=m ++CONFIG_IRCOMM=m ++CONFIG_IRDA_ULTRA=y ++CONFIG_IRDA_CACHE_LAST_LSAP=y ++CONFIG_IRDA_FAST_RR=y ++CONFIG_IRTTY_SIR=m ++CONFIG_KINGSUN_DONGLE=m ++CONFIG_KSDAZZLE_DONGLE=m ++CONFIG_KS959_DONGLE=m ++CONFIG_USB_IRDA=m ++CONFIG_SIGMATEL_FIR=m ++CONFIG_MCS_FIR=m ++CONFIG_BT=m ++CONFIG_BT_RFCOMM=m ++CONFIG_BT_RFCOMM_TTY=y ++CONFIG_BT_BNEP=m ++CONFIG_BT_BNEP_MC_FILTER=y ++CONFIG_BT_BNEP_PROTO_FILTER=y ++CONFIG_BT_HIDP=m ++CONFIG_BT_6LOWPAN=m ++CONFIG_BT_HCIBTUSB=m ++CONFIG_BT_HCIUART=m ++CONFIG_BT_HCIUART_3WIRE=y ++CONFIG_BT_HCIUART_BCM=y ++CONFIG_BT_HCIBCM203X=m ++CONFIG_BT_HCIBPA10X=m ++CONFIG_BT_HCIBFUSB=m ++CONFIG_BT_HCIVHCI=m ++CONFIG_BT_MRVL=m ++CONFIG_BT_MRVL_SDIO=m ++CONFIG_BT_ATH3K=m ++CONFIG_BT_WILINK=m ++CONFIG_MAC80211=m ++CONFIG_MAC80211_MESH=y ++CONFIG_WIMAX=m ++CONFIG_RFKILL=m ++CONFIG_RFKILL_INPUT=y ++CONFIG_NET_9P=m ++CONFIG_NFC=m ++CONFIG_NFC_PN533=m ++CONFIG_DEVTMPFS=y ++CONFIG_DEVTMPFS_MOUNT=y ++CONFIG_DMA_CMA=y ++CONFIG_CMA_SIZE_MBYTES=5 ++CONFIG_MTD=m ++CONFIG_MTD_BLOCK=m ++CONFIG_MTD_NAND=m ++CONFIG_MTD_UBI=m ++CONFIG_OF_CONFIGFS=y ++CONFIG_ZRAM=m ++CONFIG_ZRAM_LZ4_COMPRESS=y ++CONFIG_BLK_DEV_LOOP=y ++CONFIG_BLK_DEV_CRYPTOLOOP=m ++CONFIG_BLK_DEV_DRBD=m ++CONFIG_BLK_DEV_NBD=m ++CONFIG_BLK_DEV_RAM=y ++CONFIG_CDROM_PKTCDVD=m ++CONFIG_ATA_OVER_ETH=m ++CONFIG_EEPROM_AT24=m ++CONFIG_TI_ST=m ++CONFIG_SCSI=y ++# CONFIG_SCSI_PROC_FS is not set ++CONFIG_BLK_DEV_SD=y ++CONFIG_CHR_DEV_ST=m ++CONFIG_CHR_DEV_OSST=m ++CONFIG_BLK_DEV_SR=m ++CONFIG_CHR_DEV_SG=m ++CONFIG_SCSI_ISCSI_ATTRS=y ++CONFIG_ISCSI_TCP=m ++CONFIG_ISCSI_BOOT_SYSFS=m ++CONFIG_MD=y ++CONFIG_MD_LINEAR=m ++CONFIG_MD_RAID0=m ++CONFIG_BLK_DEV_DM=m ++CONFIG_DM_CRYPT=m ++CONFIG_DM_SNAPSHOT=m ++CONFIG_DM_THIN_PROVISIONING=m ++CONFIG_DM_MIRROR=m ++CONFIG_DM_LOG_USERSPACE=m ++CONFIG_DM_RAID=m ++CONFIG_DM_ZERO=m ++CONFIG_DM_DELAY=m ++CONFIG_NETDEVICES=y ++CONFIG_BONDING=m ++CONFIG_DUMMY=m ++CONFIG_IFB=m ++CONFIG_MACVLAN=m ++CONFIG_NETCONSOLE=m ++CONFIG_TUN=m ++CONFIG_VETH=m ++CONFIG_ENC28J60=m ++CONFIG_QCA7000=m ++CONFIG_MDIO_BITBANG=m ++CONFIG_PPP=m ++CONFIG_PPP_BSDCOMP=m ++CONFIG_PPP_DEFLATE=m ++CONFIG_PPP_FILTER=y ++CONFIG_PPP_MPPE=m ++CONFIG_PPP_MULTILINK=y ++CONFIG_PPPOATM=m ++CONFIG_PPPOE=m ++CONFIG_PPPOL2TP=m ++CONFIG_PPP_ASYNC=m ++CONFIG_PPP_SYNC_TTY=m ++CONFIG_SLIP=m ++CONFIG_SLIP_COMPRESSED=y ++CONFIG_SLIP_SMART=y ++CONFIG_USB_CATC=m ++CONFIG_USB_KAWETH=m ++CONFIG_USB_PEGASUS=m ++CONFIG_USB_RTL8150=m ++CONFIG_USB_RTL8152=m ++CONFIG_USB_USBNET=y ++CONFIG_USB_NET_AX8817X=m ++CONFIG_USB_NET_AX88179_178A=m ++CONFIG_USB_NET_CDCETHER=m ++CONFIG_USB_NET_CDC_EEM=m ++CONFIG_USB_NET_CDC_NCM=m ++CONFIG_USB_NET_HUAWEI_CDC_NCM=m ++CONFIG_USB_NET_CDC_MBIM=m ++CONFIG_USB_NET_DM9601=m ++CONFIG_USB_NET_SR9700=m ++CONFIG_USB_NET_SR9800=m ++CONFIG_USB_NET_SMSC75XX=m ++CONFIG_USB_NET_SMSC95XX=y ++CONFIG_USB_NET_GL620A=m ++CONFIG_USB_NET_NET1080=m ++CONFIG_USB_NET_PLUSB=m ++CONFIG_USB_NET_MCS7830=m ++CONFIG_USB_NET_CDC_SUBSET=m ++CONFIG_USB_ALI_M5632=y ++CONFIG_USB_AN2720=y ++CONFIG_USB_EPSON2888=y ++CONFIG_USB_KC2190=y ++CONFIG_USB_NET_ZAURUS=m ++CONFIG_USB_NET_CX82310_ETH=m ++CONFIG_USB_NET_KALMIA=m ++CONFIG_USB_NET_QMI_WWAN=m ++CONFIG_USB_HSO=m ++CONFIG_USB_NET_INT51X1=m ++CONFIG_USB_IPHETH=m ++CONFIG_USB_SIERRA_NET=m ++CONFIG_USB_VL600=m ++CONFIG_ATH9K=m ++CONFIG_ATH9K_HTC=m ++CONFIG_CARL9170=m ++CONFIG_ATH6KL=m ++CONFIG_ATH6KL_USB=m ++CONFIG_AR5523=m ++CONFIG_AT76C50X_USB=m ++CONFIG_B43=m ++# CONFIG_B43_PHY_N is not set ++CONFIG_B43LEGACY=m ++CONFIG_BRCMFMAC=m ++CONFIG_BRCMFMAC_USB=y ++CONFIG_HOSTAP=m ++CONFIG_P54_COMMON=m ++CONFIG_P54_USB=m ++CONFIG_LIBERTAS=m ++CONFIG_LIBERTAS_USB=m ++CONFIG_LIBERTAS_SDIO=m ++CONFIG_LIBERTAS_THINFIRM=m ++CONFIG_LIBERTAS_THINFIRM_USB=m ++CONFIG_MWIFIEX=m ++CONFIG_MWIFIEX_SDIO=m ++CONFIG_MT7601U=m ++CONFIG_RT2X00=m ++CONFIG_RT2500USB=m ++CONFIG_RT73USB=m ++CONFIG_RT2800USB=m ++CONFIG_RT2800USB_RT3573=y ++CONFIG_RT2800USB_RT53XX=y ++CONFIG_RT2800USB_RT55XX=y ++CONFIG_RT2800USB_UNKNOWN=y ++CONFIG_RTL8187=m ++CONFIG_RTL8192CU=m ++CONFIG_USB_ZD1201=m ++CONFIG_ZD1211RW=m ++CONFIG_MAC80211_HWSIM=m ++CONFIG_USB_NET_RNDIS_WLAN=m ++CONFIG_WIMAX_I2400M_USB=m ++CONFIG_IEEE802154_AT86RF230=m ++CONFIG_IEEE802154_MRF24J40=m ++CONFIG_IEEE802154_CC2520=m ++CONFIG_INPUT_POLLDEV=m ++# CONFIG_INPUT_MOUSEDEV_PSAUX is not set ++CONFIG_INPUT_JOYDEV=m ++CONFIG_INPUT_EVDEV=m ++# CONFIG_KEYBOARD_ATKBD is not set ++CONFIG_KEYBOARD_GPIO=m ++# CONFIG_INPUT_MOUSE is not set ++CONFIG_INPUT_JOYSTICK=y ++CONFIG_JOYSTICK_IFORCE=m ++CONFIG_JOYSTICK_IFORCE_USB=y ++CONFIG_JOYSTICK_XPAD=m ++CONFIG_JOYSTICK_XPAD_FF=y ++CONFIG_JOYSTICK_RPISENSE=m ++CONFIG_INPUT_TOUCHSCREEN=y ++CONFIG_TOUCHSCREEN_ADS7846=m ++CONFIG_TOUCHSCREEN_EGALAX=m ++CONFIG_TOUCHSCREEN_FT6236=m ++CONFIG_TOUCHSCREEN_RPI_FT5406=m ++CONFIG_TOUCHSCREEN_USB_COMPOSITE=m ++CONFIG_TOUCHSCREEN_STMPE=m ++CONFIG_INPUT_MISC=y ++CONFIG_INPUT_AD714X=m ++CONFIG_INPUT_ATI_REMOTE2=m ++CONFIG_INPUT_KEYSPAN_REMOTE=m ++CONFIG_INPUT_POWERMATE=m ++CONFIG_INPUT_YEALINK=m ++CONFIG_INPUT_CM109=m ++CONFIG_INPUT_UINPUT=m ++CONFIG_INPUT_GPIO_ROTARY_ENCODER=m ++CONFIG_INPUT_ADXL34X=m ++CONFIG_INPUT_CMA3000=m ++CONFIG_SERIO=m ++CONFIG_SERIO_RAW=m ++CONFIG_GAMEPORT=m ++CONFIG_GAMEPORT_NS558=m ++CONFIG_GAMEPORT_L4=m ++CONFIG_BRCM_CHAR_DRIVERS=y ++CONFIG_BCM_VC_CMA=y ++CONFIG_BCM_VCIO=y ++CONFIG_BCM_VC_SM=y ++CONFIG_DEVPTS_MULTIPLE_INSTANCES=y ++# CONFIG_LEGACY_PTYS is not set ++# CONFIG_DEVKMEM is not set ++CONFIG_SERIAL_8250=y ++# CONFIG_SERIAL_8250_DEPRECATED_OPTIONS is not set ++CONFIG_SERIAL_8250_CONSOLE=y ++# CONFIG_SERIAL_8250_DMA is not set ++CONFIG_SERIAL_8250_NR_UARTS=1 ++CONFIG_SERIAL_8250_RUNTIME_UARTS=0 ++CONFIG_SERIAL_OF_PLATFORM=y ++CONFIG_SERIAL_AMBA_PL011=y ++CONFIG_SERIAL_AMBA_PL011_CONSOLE=y ++CONFIG_TTY_PRINTK=y ++CONFIG_HW_RANDOM=y ++CONFIG_RAW_DRIVER=y ++CONFIG_I2C=y ++CONFIG_I2C_CHARDEV=m ++CONFIG_I2C_MUX_PCA954x=m ++CONFIG_I2C_BCM2708=m ++CONFIG_I2C_GPIO=m ++CONFIG_SPI=y ++CONFIG_SPI_BCM2835=m ++CONFIG_SPI_BCM2835AUX=m ++CONFIG_SPI_SPIDEV=y ++CONFIG_PPS=m ++CONFIG_PPS_CLIENT_LDISC=m ++CONFIG_PPS_CLIENT_GPIO=m ++CONFIG_GPIO_SYSFS=y ++CONFIG_GPIO_ARIZONA=m ++CONFIG_GPIO_STMPE=y ++CONFIG_W1=m ++CONFIG_W1_MASTER_DS2490=m ++CONFIG_W1_MASTER_DS2482=m ++CONFIG_W1_MASTER_DS1WM=m ++CONFIG_W1_MASTER_GPIO=m ++CONFIG_W1_SLAVE_THERM=m ++CONFIG_W1_SLAVE_SMEM=m ++CONFIG_W1_SLAVE_DS2408=m ++CONFIG_W1_SLAVE_DS2413=m ++CONFIG_W1_SLAVE_DS2406=m ++CONFIG_W1_SLAVE_DS2423=m ++CONFIG_W1_SLAVE_DS2431=m ++CONFIG_W1_SLAVE_DS2433=m ++CONFIG_W1_SLAVE_DS2760=m ++CONFIG_W1_SLAVE_DS2780=m ++CONFIG_W1_SLAVE_DS2781=m ++CONFIG_W1_SLAVE_DS28E04=m ++CONFIG_W1_SLAVE_BQ27000=m ++CONFIG_BATTERY_DS2760=m ++CONFIG_POWER_RESET=y ++CONFIG_POWER_RESET_GPIO=y ++CONFIG_HWMON=m ++CONFIG_SENSORS_SHT21=m ++CONFIG_SENSORS_SHTC1=m ++CONFIG_THERMAL=y ++CONFIG_THERMAL_BCM2835=y ++CONFIG_WATCHDOG=y ++CONFIG_BCM2835_WDT=m ++CONFIG_UCB1400_CORE=m ++CONFIG_MFD_STMPE=y ++CONFIG_STMPE_SPI=y ++CONFIG_MFD_ARIZONA_I2C=m ++CONFIG_MFD_ARIZONA_SPI=m ++CONFIG_MFD_WM5102=y ++CONFIG_MEDIA_SUPPORT=m ++CONFIG_MEDIA_CAMERA_SUPPORT=y ++CONFIG_MEDIA_ANALOG_TV_SUPPORT=y ++CONFIG_MEDIA_DIGITAL_TV_SUPPORT=y ++CONFIG_MEDIA_RADIO_SUPPORT=y ++CONFIG_MEDIA_RC_SUPPORT=y ++CONFIG_MEDIA_CONTROLLER=y ++CONFIG_LIRC=m ++CONFIG_RC_DEVICES=y ++CONFIG_RC_ATI_REMOTE=m ++CONFIG_IR_IMON=m ++CONFIG_IR_MCEUSB=m ++CONFIG_IR_REDRAT3=m ++CONFIG_IR_STREAMZAP=m ++CONFIG_IR_IGUANA=m ++CONFIG_IR_TTUSBIR=m ++CONFIG_RC_LOOPBACK=m ++CONFIG_IR_GPIO_CIR=m ++CONFIG_MEDIA_USB_SUPPORT=y ++CONFIG_USB_VIDEO_CLASS=m ++CONFIG_USB_M5602=m ++CONFIG_USB_STV06XX=m ++CONFIG_USB_GL860=m ++CONFIG_USB_GSPCA_BENQ=m ++CONFIG_USB_GSPCA_CONEX=m ++CONFIG_USB_GSPCA_CPIA1=m ++CONFIG_USB_GSPCA_DTCS033=m ++CONFIG_USB_GSPCA_ETOMS=m ++CONFIG_USB_GSPCA_FINEPIX=m ++CONFIG_USB_GSPCA_JEILINJ=m ++CONFIG_USB_GSPCA_JL2005BCD=m ++CONFIG_USB_GSPCA_KINECT=m ++CONFIG_USB_GSPCA_KONICA=m ++CONFIG_USB_GSPCA_MARS=m ++CONFIG_USB_GSPCA_MR97310A=m ++CONFIG_USB_GSPCA_NW80X=m ++CONFIG_USB_GSPCA_OV519=m ++CONFIG_USB_GSPCA_OV534=m ++CONFIG_USB_GSPCA_OV534_9=m ++CONFIG_USB_GSPCA_PAC207=m ++CONFIG_USB_GSPCA_PAC7302=m ++CONFIG_USB_GSPCA_PAC7311=m ++CONFIG_USB_GSPCA_SE401=m ++CONFIG_USB_GSPCA_SN9C2028=m ++CONFIG_USB_GSPCA_SN9C20X=m ++CONFIG_USB_GSPCA_SONIXB=m ++CONFIG_USB_GSPCA_SONIXJ=m ++CONFIG_USB_GSPCA_SPCA500=m ++CONFIG_USB_GSPCA_SPCA501=m ++CONFIG_USB_GSPCA_SPCA505=m ++CONFIG_USB_GSPCA_SPCA506=m ++CONFIG_USB_GSPCA_SPCA508=m ++CONFIG_USB_GSPCA_SPCA561=m ++CONFIG_USB_GSPCA_SPCA1528=m ++CONFIG_USB_GSPCA_SQ905=m ++CONFIG_USB_GSPCA_SQ905C=m ++CONFIG_USB_GSPCA_SQ930X=m ++CONFIG_USB_GSPCA_STK014=m ++CONFIG_USB_GSPCA_STK1135=m ++CONFIG_USB_GSPCA_STV0680=m ++CONFIG_USB_GSPCA_SUNPLUS=m ++CONFIG_USB_GSPCA_T613=m ++CONFIG_USB_GSPCA_TOPRO=m ++CONFIG_USB_GSPCA_TV8532=m ++CONFIG_USB_GSPCA_VC032X=m ++CONFIG_USB_GSPCA_VICAM=m ++CONFIG_USB_GSPCA_XIRLINK_CIT=m ++CONFIG_USB_GSPCA_ZC3XX=m ++CONFIG_USB_PWC=m ++CONFIG_VIDEO_CPIA2=m ++CONFIG_USB_ZR364XX=m ++CONFIG_USB_STKWEBCAM=m ++CONFIG_USB_S2255=m ++CONFIG_VIDEO_USBTV=m ++CONFIG_VIDEO_PVRUSB2=m ++CONFIG_VIDEO_HDPVR=m ++CONFIG_VIDEO_USBVISION=m ++CONFIG_VIDEO_STK1160_COMMON=m ++CONFIG_VIDEO_STK1160_AC97=y ++CONFIG_VIDEO_GO7007=m ++CONFIG_VIDEO_GO7007_USB=m ++CONFIG_VIDEO_GO7007_USB_S2250_BOARD=m ++CONFIG_VIDEO_AU0828=m ++CONFIG_VIDEO_AU0828_RC=y ++CONFIG_VIDEO_CX231XX=m ++CONFIG_VIDEO_CX231XX_ALSA=m ++CONFIG_VIDEO_CX231XX_DVB=m ++CONFIG_VIDEO_TM6000=m ++CONFIG_VIDEO_TM6000_ALSA=m ++CONFIG_VIDEO_TM6000_DVB=m ++CONFIG_DVB_USB=m ++CONFIG_DVB_USB_A800=m ++CONFIG_DVB_USB_DIBUSB_MB=m ++CONFIG_DVB_USB_DIBUSB_MB_FAULTY=y ++CONFIG_DVB_USB_DIBUSB_MC=m ++CONFIG_DVB_USB_DIB0700=m ++CONFIG_DVB_USB_UMT_010=m ++CONFIG_DVB_USB_CXUSB=m ++CONFIG_DVB_USB_M920X=m ++CONFIG_DVB_USB_DIGITV=m ++CONFIG_DVB_USB_VP7045=m ++CONFIG_DVB_USB_VP702X=m ++CONFIG_DVB_USB_GP8PSK=m ++CONFIG_DVB_USB_NOVA_T_USB2=m ++CONFIG_DVB_USB_TTUSB2=m ++CONFIG_DVB_USB_DTT200U=m ++CONFIG_DVB_USB_OPERA1=m ++CONFIG_DVB_USB_AF9005=m ++CONFIG_DVB_USB_AF9005_REMOTE=m ++CONFIG_DVB_USB_PCTV452E=m ++CONFIG_DVB_USB_DW2102=m ++CONFIG_DVB_USB_CINERGY_T2=m ++CONFIG_DVB_USB_DTV5100=m ++CONFIG_DVB_USB_FRIIO=m ++CONFIG_DVB_USB_AZ6027=m ++CONFIG_DVB_USB_TECHNISAT_USB2=m ++CONFIG_DVB_USB_V2=m ++CONFIG_DVB_USB_AF9015=m ++CONFIG_DVB_USB_AF9035=m ++CONFIG_DVB_USB_ANYSEE=m ++CONFIG_DVB_USB_AU6610=m ++CONFIG_DVB_USB_AZ6007=m ++CONFIG_DVB_USB_CE6230=m ++CONFIG_DVB_USB_EC168=m ++CONFIG_DVB_USB_GL861=m ++CONFIG_DVB_USB_LME2510=m ++CONFIG_DVB_USB_MXL111SF=m ++CONFIG_DVB_USB_RTL28XXU=m ++CONFIG_DVB_USB_DVBSKY=m ++CONFIG_SMS_USB_DRV=m ++CONFIG_DVB_B2C2_FLEXCOP_USB=m ++CONFIG_DVB_AS102=m ++CONFIG_VIDEO_EM28XX=m ++CONFIG_VIDEO_EM28XX_V4L2=m ++CONFIG_VIDEO_EM28XX_ALSA=m ++CONFIG_VIDEO_EM28XX_DVB=m ++CONFIG_V4L_PLATFORM_DRIVERS=y ++CONFIG_VIDEO_BCM2835=y ++CONFIG_VIDEO_BCM2835_MMAL=m ++CONFIG_RADIO_SI470X=y ++CONFIG_USB_SI470X=m ++CONFIG_I2C_SI470X=m ++CONFIG_RADIO_SI4713=m ++CONFIG_I2C_SI4713=m ++CONFIG_USB_MR800=m ++CONFIG_USB_DSBR=m ++CONFIG_RADIO_SHARK=m ++CONFIG_RADIO_SHARK2=m ++CONFIG_USB_KEENE=m ++CONFIG_USB_MA901=m ++CONFIG_RADIO_TEA5764=m ++CONFIG_RADIO_SAA7706H=m ++CONFIG_RADIO_TEF6862=m ++CONFIG_RADIO_WL1273=m ++CONFIG_RADIO_WL128X=m ++# CONFIG_MEDIA_SUBDRV_AUTOSELECT is not set ++CONFIG_VIDEO_UDA1342=m ++CONFIG_VIDEO_SONY_BTF_MPX=m ++CONFIG_VIDEO_TVP5150=m ++CONFIG_VIDEO_TW2804=m ++CONFIG_VIDEO_TW9903=m ++CONFIG_VIDEO_TW9906=m ++CONFIG_VIDEO_OV7640=m ++CONFIG_VIDEO_MT9V011=m ++CONFIG_DRM=m ++CONFIG_DRM_LOAD_EDID_FIRMWARE=y ++CONFIG_DRM_UDL=m ++CONFIG_DRM_VC4=m ++CONFIG_FB=y ++CONFIG_FB_BCM2708=y ++CONFIG_FB_UDL=m ++CONFIG_FB_SSD1307=m ++CONFIG_FB_RPISENSE=m ++# CONFIG_BACKLIGHT_GENERIC is not set ++CONFIG_BACKLIGHT_RPI=m ++CONFIG_BACKLIGHT_GPIO=m ++CONFIG_FRAMEBUFFER_CONSOLE=y ++CONFIG_LOGO=y ++# CONFIG_LOGO_LINUX_MONO is not set ++# CONFIG_LOGO_LINUX_VGA16 is not set ++CONFIG_SOUND=y ++CONFIG_SND=m ++CONFIG_SND_SEQUENCER=m ++CONFIG_SND_SEQ_DUMMY=m ++CONFIG_SND_MIXER_OSS=m ++CONFIG_SND_PCM_OSS=m ++CONFIG_SND_SEQUENCER_OSS=y ++CONFIG_SND_HRTIMER=m ++CONFIG_SND_DUMMY=m ++CONFIG_SND_ALOOP=m ++CONFIG_SND_VIRMIDI=m ++CONFIG_SND_MTPAV=m ++CONFIG_SND_SERIAL_U16550=m ++CONFIG_SND_MPU401=m ++CONFIG_SND_BCM2835=m ++CONFIG_SND_USB_AUDIO=m ++CONFIG_SND_USB_UA101=m ++CONFIG_SND_USB_CAIAQ=m ++CONFIG_SND_USB_CAIAQ_INPUT=y ++CONFIG_SND_USB_6FIRE=m ++CONFIG_SND_SOC=m ++CONFIG_SND_BCM2835_SOC_I2S=m ++CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC=m ++CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS=m ++CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI=m ++CONFIG_SND_BCM2708_SOC_HIFIBERRY_AMP=m ++CONFIG_SND_BCM2708_SOC_RPI_DAC=m ++CONFIG_SND_BCM2708_SOC_RPI_PROTO=m ++CONFIG_SND_BCM2708_SOC_BOOMBERRY_DAC=m ++CONFIG_SND_BCM2708_SOC_BOOMBERRY_DIGI=m ++CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC=m ++CONFIG_SND_BCM2708_SOC_RASPIDAC3=m ++CONFIG_SND_BCM2708_SOC_ADAU1977_ADC=m ++CONFIG_SND_AUDIOINJECTOR_PI_SOUNDCARD=m ++CONFIG_SND_SOC_ADAU1701=m ++CONFIG_SND_SOC_WM8804_I2C=m ++CONFIG_SND_SIMPLE_CARD=m ++CONFIG_SOUND_PRIME=m ++CONFIG_HIDRAW=y ++CONFIG_UHID=m ++CONFIG_HID_A4TECH=m ++CONFIG_HID_ACRUX=m ++CONFIG_HID_APPLE=m ++CONFIG_HID_BELKIN=m ++CONFIG_HID_BETOP_FF=m ++CONFIG_HID_CHERRY=m ++CONFIG_HID_CHICONY=m ++CONFIG_HID_CYPRESS=m ++CONFIG_HID_DRAGONRISE=m ++CONFIG_HID_EMS_FF=m ++CONFIG_HID_ELECOM=m ++CONFIG_HID_ELO=m ++CONFIG_HID_EZKEY=m ++CONFIG_HID_HOLTEK=m ++CONFIG_HID_KEYTOUCH=m ++CONFIG_HID_KYE=m ++CONFIG_HID_UCLOGIC=m ++CONFIG_HID_WALTOP=m ++CONFIG_HID_GYRATION=m ++CONFIG_HID_TWINHAN=m ++CONFIG_HID_KENSINGTON=m ++CONFIG_HID_LCPOWER=m ++CONFIG_HID_LOGITECH=m ++CONFIG_HID_LOGITECH_DJ=m ++CONFIG_LOGITECH_FF=y ++CONFIG_LOGIRUMBLEPAD2_FF=y ++CONFIG_LOGIG940_FF=y ++CONFIG_HID_MAGICMOUSE=m ++CONFIG_HID_MICROSOFT=m ++CONFIG_HID_MONTEREY=m ++CONFIG_HID_MULTITOUCH=m ++CONFIG_HID_NTRIG=m ++CONFIG_HID_ORTEK=m ++CONFIG_HID_PANTHERLORD=m ++CONFIG_HID_PETALYNX=m ++CONFIG_HID_PICOLCD=m ++CONFIG_HID_ROCCAT=m ++CONFIG_HID_SAMSUNG=m ++CONFIG_HID_SONY=m ++CONFIG_HID_SPEEDLINK=m ++CONFIG_HID_SUNPLUS=m ++CONFIG_HID_GREENASIA=m ++CONFIG_HID_SMARTJOYPLUS=m ++CONFIG_HID_TOPSEED=m ++CONFIG_HID_THINGM=m ++CONFIG_HID_THRUSTMASTER=m ++CONFIG_HID_WACOM=m ++CONFIG_HID_WIIMOTE=m ++CONFIG_HID_XINMO=m ++CONFIG_HID_ZEROPLUS=m ++CONFIG_HID_ZYDACRON=m ++CONFIG_HID_PID=y ++CONFIG_USB_HIDDEV=y ++CONFIG_USB=y ++CONFIG_USB_ANNOUNCE_NEW_DEVICES=y ++CONFIG_USB_MON=m ++CONFIG_USB_DWCOTG=y ++CONFIG_USB_PRINTER=m ++CONFIG_USB_STORAGE=y ++CONFIG_USB_STORAGE_REALTEK=m ++CONFIG_USB_STORAGE_DATAFAB=m ++CONFIG_USB_STORAGE_FREECOM=m ++CONFIG_USB_STORAGE_ISD200=m ++CONFIG_USB_STORAGE_USBAT=m ++CONFIG_USB_STORAGE_SDDR09=m ++CONFIG_USB_STORAGE_SDDR55=m ++CONFIG_USB_STORAGE_JUMPSHOT=m ++CONFIG_USB_STORAGE_ALAUDA=m ++CONFIG_USB_STORAGE_ONETOUCH=m ++CONFIG_USB_STORAGE_KARMA=m ++CONFIG_USB_STORAGE_CYPRESS_ATACB=m ++CONFIG_USB_STORAGE_ENE_UB6250=m ++CONFIG_USB_MDC800=m ++CONFIG_USB_MICROTEK=m ++CONFIG_USBIP_CORE=m ++CONFIG_USBIP_VHCI_HCD=m ++CONFIG_USBIP_HOST=m ++CONFIG_USB_DWC2=m ++CONFIG_USB_SERIAL=m ++CONFIG_USB_SERIAL_GENERIC=y ++CONFIG_USB_SERIAL_AIRCABLE=m ++CONFIG_USB_SERIAL_ARK3116=m ++CONFIG_USB_SERIAL_BELKIN=m ++CONFIG_USB_SERIAL_CH341=m ++CONFIG_USB_SERIAL_WHITEHEAT=m ++CONFIG_USB_SERIAL_DIGI_ACCELEPORT=m ++CONFIG_USB_SERIAL_CP210X=m ++CONFIG_USB_SERIAL_CYPRESS_M8=m ++CONFIG_USB_SERIAL_EMPEG=m ++CONFIG_USB_SERIAL_FTDI_SIO=m ++CONFIG_USB_SERIAL_VISOR=m ++CONFIG_USB_SERIAL_IPAQ=m ++CONFIG_USB_SERIAL_IR=m ++CONFIG_USB_SERIAL_EDGEPORT=m ++CONFIG_USB_SERIAL_EDGEPORT_TI=m ++CONFIG_USB_SERIAL_F81232=m ++CONFIG_USB_SERIAL_GARMIN=m ++CONFIG_USB_SERIAL_IPW=m ++CONFIG_USB_SERIAL_IUU=m ++CONFIG_USB_SERIAL_KEYSPAN_PDA=m ++CONFIG_USB_SERIAL_KEYSPAN=m ++CONFIG_USB_SERIAL_KLSI=m ++CONFIG_USB_SERIAL_KOBIL_SCT=m ++CONFIG_USB_SERIAL_MCT_U232=m ++CONFIG_USB_SERIAL_METRO=m ++CONFIG_USB_SERIAL_MOS7720=m ++CONFIG_USB_SERIAL_MOS7840=m ++CONFIG_USB_SERIAL_NAVMAN=m ++CONFIG_USB_SERIAL_PL2303=m ++CONFIG_USB_SERIAL_OTI6858=m ++CONFIG_USB_SERIAL_QCAUX=m ++CONFIG_USB_SERIAL_QUALCOMM=m ++CONFIG_USB_SERIAL_SPCP8X5=m ++CONFIG_USB_SERIAL_SAFE=m ++CONFIG_USB_SERIAL_SIERRAWIRELESS=m ++CONFIG_USB_SERIAL_SYMBOL=m ++CONFIG_USB_SERIAL_TI=m ++CONFIG_USB_SERIAL_CYBERJACK=m ++CONFIG_USB_SERIAL_XIRCOM=m ++CONFIG_USB_SERIAL_OPTION=m ++CONFIG_USB_SERIAL_OMNINET=m ++CONFIG_USB_SERIAL_OPTICON=m ++CONFIG_USB_SERIAL_XSENS_MT=m ++CONFIG_USB_SERIAL_WISHBONE=m ++CONFIG_USB_SERIAL_SSU100=m ++CONFIG_USB_SERIAL_QT2=m ++CONFIG_USB_SERIAL_DEBUG=m ++CONFIG_USB_EMI62=m ++CONFIG_USB_EMI26=m ++CONFIG_USB_ADUTUX=m ++CONFIG_USB_SEVSEG=m ++CONFIG_USB_RIO500=m ++CONFIG_USB_LEGOTOWER=m ++CONFIG_USB_LCD=m ++CONFIG_USB_LED=m ++CONFIG_USB_CYPRESS_CY7C63=m ++CONFIG_USB_CYTHERM=m ++CONFIG_USB_IDMOUSE=m ++CONFIG_USB_FTDI_ELAN=m ++CONFIG_USB_APPLEDISPLAY=m ++CONFIG_USB_LD=m ++CONFIG_USB_TRANCEVIBRATOR=m ++CONFIG_USB_IOWARRIOR=m ++CONFIG_USB_TEST=m ++CONFIG_USB_ISIGHTFW=m ++CONFIG_USB_YUREX=m ++CONFIG_USB_ATM=m ++CONFIG_USB_SPEEDTOUCH=m ++CONFIG_USB_CXACRU=m ++CONFIG_USB_UEAGLEATM=m ++CONFIG_USB_XUSBATM=m ++CONFIG_USB_GADGET=m ++CONFIG_USB_ZERO=m ++CONFIG_USB_AUDIO=m ++CONFIG_USB_ETH=m ++CONFIG_USB_GADGETFS=m ++CONFIG_USB_MASS_STORAGE=m ++CONFIG_USB_G_SERIAL=m ++CONFIG_USB_MIDI_GADGET=m ++CONFIG_USB_G_PRINTER=m ++CONFIG_USB_CDC_COMPOSITE=m ++CONFIG_USB_G_ACM_MS=m ++CONFIG_USB_G_MULTI=m ++CONFIG_USB_G_HID=m ++CONFIG_USB_G_WEBCAM=m ++CONFIG_MMC=y ++CONFIG_MMC_BLOCK_MINORS=32 ++CONFIG_MMC_BCM2835=y ++CONFIG_MMC_BCM2835_DMA=y ++CONFIG_MMC_BCM2835_SDHOST=y ++CONFIG_MMC_SDHCI=y ++CONFIG_MMC_SDHCI_PLTFM=y ++CONFIG_MMC_SPI=m ++CONFIG_LEDS_CLASS=y ++CONFIG_LEDS_GPIO=y ++CONFIG_LEDS_TRIGGER_TIMER=y ++CONFIG_LEDS_TRIGGER_ONESHOT=y ++CONFIG_LEDS_TRIGGER_HEARTBEAT=y ++CONFIG_LEDS_TRIGGER_BACKLIGHT=y ++CONFIG_LEDS_TRIGGER_CPU=y ++CONFIG_LEDS_TRIGGER_GPIO=y ++CONFIG_LEDS_TRIGGER_DEFAULT_ON=y ++CONFIG_LEDS_TRIGGER_TRANSIENT=m ++CONFIG_LEDS_TRIGGER_CAMERA=m ++CONFIG_LEDS_TRIGGER_INPUT=y ++CONFIG_RTC_CLASS=y ++# CONFIG_RTC_HCTOSYS is not set ++CONFIG_RTC_DRV_DS1307=m ++CONFIG_RTC_DRV_DS1374=m ++CONFIG_RTC_DRV_DS1672=m ++CONFIG_RTC_DRV_MAX6900=m ++CONFIG_RTC_DRV_RS5C372=m ++CONFIG_RTC_DRV_ISL1208=m ++CONFIG_RTC_DRV_ISL12022=m ++CONFIG_RTC_DRV_ISL12057=m ++CONFIG_RTC_DRV_X1205=m ++CONFIG_RTC_DRV_PCF8523=m ++CONFIG_RTC_DRV_PCF8563=m ++CONFIG_RTC_DRV_PCF8583=m ++CONFIG_RTC_DRV_M41T80=m ++CONFIG_RTC_DRV_BQ32K=m ++CONFIG_RTC_DRV_S35390A=m ++CONFIG_RTC_DRV_FM3130=m ++CONFIG_RTC_DRV_RX8581=m ++CONFIG_RTC_DRV_RX8025=m ++CONFIG_RTC_DRV_EM3027=m ++CONFIG_RTC_DRV_RV3029C2=m ++CONFIG_RTC_DRV_M41T93=m ++CONFIG_RTC_DRV_M41T94=m ++CONFIG_RTC_DRV_DS1305=m ++CONFIG_RTC_DRV_DS1390=m ++CONFIG_RTC_DRV_R9701=m ++CONFIG_RTC_DRV_RX4581=m ++CONFIG_RTC_DRV_RS5C348=m ++CONFIG_RTC_DRV_MAX6902=m ++CONFIG_RTC_DRV_PCF2123=m ++CONFIG_RTC_DRV_DS3232=m ++CONFIG_RTC_DRV_PCF2127=m ++CONFIG_DMADEVICES=y ++CONFIG_DMA_BCM2835=y ++CONFIG_DMA_BCM2708=y ++CONFIG_UIO=m ++CONFIG_UIO_PDRV_GENIRQ=m ++CONFIG_STAGING=y ++CONFIG_PRISM2_USB=m ++CONFIG_R8712U=m ++CONFIG_R8188EU=m ++CONFIG_R8723AU=m ++CONFIG_VT6656=m ++CONFIG_SPEAKUP=m ++CONFIG_SPEAKUP_SYNTH_SOFT=m ++CONFIG_STAGING_MEDIA=y ++CONFIG_LIRC_STAGING=y ++CONFIG_LIRC_IMON=m ++CONFIG_LIRC_RPI=m ++CONFIG_LIRC_SASEM=m ++CONFIG_LIRC_SERIAL=m ++CONFIG_FB_TFT=m ++CONFIG_FB_TFT_AGM1264K_FL=m ++CONFIG_FB_TFT_BD663474=m ++CONFIG_FB_TFT_HX8340BN=m ++CONFIG_FB_TFT_HX8347D=m ++CONFIG_FB_TFT_HX8353D=m ++CONFIG_FB_TFT_ILI9163=m ++CONFIG_FB_TFT_ILI9320=m ++CONFIG_FB_TFT_ILI9325=m ++CONFIG_FB_TFT_ILI9340=m ++CONFIG_FB_TFT_ILI9341=m ++CONFIG_FB_TFT_ILI9481=m ++CONFIG_FB_TFT_ILI9486=m ++CONFIG_FB_TFT_PCD8544=m ++CONFIG_FB_TFT_RA8875=m ++CONFIG_FB_TFT_S6D02A1=m ++CONFIG_FB_TFT_S6D1121=m ++CONFIG_FB_TFT_SSD1289=m ++CONFIG_FB_TFT_SSD1306=m ++CONFIG_FB_TFT_SSD1331=m ++CONFIG_FB_TFT_SSD1351=m ++CONFIG_FB_TFT_ST7735R=m ++CONFIG_FB_TFT_TINYLCD=m ++CONFIG_FB_TFT_TLS8204=m ++CONFIG_FB_TFT_UC1701=m ++CONFIG_FB_TFT_UPD161704=m ++CONFIG_FB_TFT_WATTEROTT=m ++CONFIG_FB_FLEX=m ++CONFIG_FB_TFT_FBTFT_DEVICE=m ++CONFIG_MAILBOX=y ++CONFIG_BCM2835_MBOX=y ++# CONFIG_IOMMU_SUPPORT is not set ++CONFIG_RASPBERRYPI_POWER=y ++CONFIG_EXTCON=m ++CONFIG_EXTCON_ARIZONA=m ++CONFIG_IIO=m ++CONFIG_IIO_BUFFER=y ++CONFIG_IIO_BUFFER_CB=m ++CONFIG_IIO_KFIFO_BUF=m ++CONFIG_MCP320X=m ++CONFIG_MCP3422=m ++CONFIG_DHT11=m ++CONFIG_PWM_BCM2835=m ++CONFIG_PWM_PCA9685=m ++CONFIG_RASPBERRYPI_FIRMWARE=y ++CONFIG_EXT4_FS=y ++CONFIG_EXT4_FS_POSIX_ACL=y ++CONFIG_EXT4_FS_SECURITY=y ++CONFIG_REISERFS_FS=m ++CONFIG_REISERFS_FS_XATTR=y ++CONFIG_REISERFS_FS_POSIX_ACL=y ++CONFIG_REISERFS_FS_SECURITY=y ++CONFIG_JFS_FS=m ++CONFIG_JFS_POSIX_ACL=y ++CONFIG_JFS_SECURITY=y ++CONFIG_JFS_STATISTICS=y ++CONFIG_XFS_FS=m ++CONFIG_XFS_QUOTA=y ++CONFIG_XFS_POSIX_ACL=y ++CONFIG_XFS_RT=y ++CONFIG_GFS2_FS=m ++CONFIG_OCFS2_FS=m ++CONFIG_BTRFS_FS=m ++CONFIG_BTRFS_FS_POSIX_ACL=y ++CONFIG_NILFS2_FS=m ++CONFIG_F2FS_FS=y ++CONFIG_FANOTIFY=y ++CONFIG_QFMT_V1=m ++CONFIG_QFMT_V2=m ++CONFIG_AUTOFS4_FS=y ++CONFIG_FUSE_FS=m ++CONFIG_CUSE=m ++CONFIG_OVERLAY_FS=m ++CONFIG_FSCACHE=y ++CONFIG_FSCACHE_STATS=y ++CONFIG_FSCACHE_HISTOGRAM=y ++CONFIG_CACHEFILES=y ++CONFIG_ISO9660_FS=m ++CONFIG_JOLIET=y ++CONFIG_ZISOFS=y ++CONFIG_UDF_FS=m ++CONFIG_MSDOS_FS=y ++CONFIG_VFAT_FS=y ++CONFIG_FAT_DEFAULT_IOCHARSET="ascii" ++CONFIG_NTFS_FS=m ++CONFIG_NTFS_RW=y ++CONFIG_TMPFS=y ++CONFIG_TMPFS_POSIX_ACL=y ++CONFIG_ECRYPT_FS=m ++CONFIG_HFS_FS=m ++CONFIG_HFSPLUS_FS=m ++CONFIG_JFFS2_FS=m ++CONFIG_JFFS2_SUMMARY=y ++CONFIG_UBIFS_FS=m ++CONFIG_SQUASHFS=m ++CONFIG_SQUASHFS_XATTR=y ++CONFIG_SQUASHFS_LZO=y ++CONFIG_SQUASHFS_XZ=y ++CONFIG_NFS_FS=y ++CONFIG_NFS_V3_ACL=y ++CONFIG_NFS_V4=y ++CONFIG_NFS_SWAP=y ++CONFIG_ROOT_NFS=y ++CONFIG_NFS_FSCACHE=y ++CONFIG_NFSD=m ++CONFIG_NFSD_V3_ACL=y ++CONFIG_NFSD_V4=y ++CONFIG_CIFS=m ++CONFIG_CIFS_WEAK_PW_HASH=y ++CONFIG_CIFS_UPCALL=y ++CONFIG_CIFS_XATTR=y ++CONFIG_CIFS_POSIX=y ++CONFIG_CIFS_ACL=y ++CONFIG_CIFS_DFS_UPCALL=y ++CONFIG_CIFS_SMB2=y ++CONFIG_CIFS_FSCACHE=y ++CONFIG_9P_FS=m ++CONFIG_9P_FS_POSIX_ACL=y ++CONFIG_NLS_DEFAULT="utf8" ++CONFIG_NLS_CODEPAGE_437=y ++CONFIG_NLS_CODEPAGE_737=m ++CONFIG_NLS_CODEPAGE_775=m ++CONFIG_NLS_CODEPAGE_850=m ++CONFIG_NLS_CODEPAGE_852=m ++CONFIG_NLS_CODEPAGE_855=m ++CONFIG_NLS_CODEPAGE_857=m ++CONFIG_NLS_CODEPAGE_860=m ++CONFIG_NLS_CODEPAGE_861=m ++CONFIG_NLS_CODEPAGE_862=m ++CONFIG_NLS_CODEPAGE_863=m ++CONFIG_NLS_CODEPAGE_864=m ++CONFIG_NLS_CODEPAGE_865=m ++CONFIG_NLS_CODEPAGE_866=m ++CONFIG_NLS_CODEPAGE_869=m ++CONFIG_NLS_CODEPAGE_936=m ++CONFIG_NLS_CODEPAGE_950=m ++CONFIG_NLS_CODEPAGE_932=m ++CONFIG_NLS_CODEPAGE_949=m ++CONFIG_NLS_CODEPAGE_874=m ++CONFIG_NLS_ISO8859_8=m ++CONFIG_NLS_CODEPAGE_1250=m ++CONFIG_NLS_CODEPAGE_1251=m ++CONFIG_NLS_ASCII=y ++CONFIG_NLS_ISO8859_1=m ++CONFIG_NLS_ISO8859_2=m ++CONFIG_NLS_ISO8859_3=m ++CONFIG_NLS_ISO8859_4=m ++CONFIG_NLS_ISO8859_5=m ++CONFIG_NLS_ISO8859_6=m ++CONFIG_NLS_ISO8859_7=m ++CONFIG_NLS_ISO8859_9=m ++CONFIG_NLS_ISO8859_13=m ++CONFIG_NLS_ISO8859_14=m ++CONFIG_NLS_ISO8859_15=m ++CONFIG_NLS_KOI8_R=m ++CONFIG_NLS_KOI8_U=m ++CONFIG_DLM=m ++CONFIG_PRINTK_TIME=y ++CONFIG_BOOT_PRINTK_DELAY=y ++CONFIG_DEBUG_MEMORY_INIT=y ++CONFIG_DETECT_HUNG_TASK=y ++CONFIG_TIMER_STATS=y ++CONFIG_LATENCYTOP=y ++CONFIG_IRQSOFF_TRACER=y ++CONFIG_SCHED_TRACER=y ++CONFIG_STACK_TRACER=y ++CONFIG_BLK_DEV_IO_TRACE=y ++# CONFIG_KPROBE_EVENT is not set ++CONFIG_FUNCTION_PROFILER=y ++CONFIG_KGDB=y ++CONFIG_KGDB_KDB=y ++CONFIG_KDB_KEYBOARD=y ++CONFIG_CRYPTO_USER=m ++CONFIG_CRYPTO_CRYPTD=m ++CONFIG_CRYPTO_CBC=y ++CONFIG_CRYPTO_CTS=m ++CONFIG_CRYPTO_XTS=m ++CONFIG_CRYPTO_XCBC=m ++CONFIG_CRYPTO_SHA512=m ++CONFIG_CRYPTO_TGR192=m ++CONFIG_CRYPTO_WP512=m ++CONFIG_CRYPTO_CAST5=m ++CONFIG_CRYPTO_DES=y ++CONFIG_CRYPTO_USER_API_SKCIPHER=m ++# CONFIG_CRYPTO_HW is not set ++CONFIG_ARM_CRYPTO=y ++CONFIG_CRYPTO_SHA1_ARM=m ++CONFIG_CRYPTO_AES_ARM=m ++CONFIG_CRC_ITU_T=y ++CONFIG_LIBCRC32C=y + +From 62dcca217ece326d398b5a2ded691690d01014f1 Mon Sep 17 00:00:00 2001 +From: Gordon Hollingworth <gordon@raspberrypi.org> +Date: Tue, 12 May 2015 14:47:56 +0100 +Subject: [PATCH 078/112] rpi-ft5406: Add touchscreen driver for pi LCD display + +Fix driver detection failure Check that the buffer response is non-zero meaning the touchscreen was detected + +rpi-ft5406: Use firmware API +--- + drivers/input/touchscreen/Kconfig | 7 + + drivers/input/touchscreen/Makefile | 1 + + drivers/input/touchscreen/rpi-ft5406.c | 246 +++++++++++++++++++++++++++++++++ + 3 files changed, 254 insertions(+) + create mode 100644 drivers/input/touchscreen/rpi-ft5406.c + +diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig +index 8ecdc38..1e4e7a0 100644 +--- a/drivers/input/touchscreen/Kconfig ++++ b/drivers/input/touchscreen/Kconfig +@@ -630,6 +630,13 @@ config TOUCHSCREEN_EDT_FT5X06 + To compile this driver as a module, choose M here: the + module will be called edt-ft5x06. + ++config TOUCHSCREEN_RPI_FT5406 ++ tristate "Raspberry Pi FT5406 driver" ++ depends on RASPBERRYPI_FIRMWARE ++ help ++ Say Y here to enable the Raspberry Pi memory based FT5406 device ++ ++ + config TOUCHSCREEN_MIGOR + tristate "Renesas MIGO-R touchscreen" + depends on SH_MIGOR && I2C +diff --git a/drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile +index f42975e..92590b3 100644 +--- a/drivers/input/touchscreen/Makefile ++++ b/drivers/input/touchscreen/Makefile +@@ -29,6 +29,7 @@ obj-$(CONFIG_TOUCHSCREEN_DA9034) += da9034-ts.o + obj-$(CONFIG_TOUCHSCREEN_DA9052) += da9052_tsi.o + obj-$(CONFIG_TOUCHSCREEN_DYNAPRO) += dynapro.o + obj-$(CONFIG_TOUCHSCREEN_EDT_FT5X06) += edt-ft5x06.o ++obj-$(CONFIG_TOUCHSCREEN_RPI_FT5406) += rpi-ft5406.o + obj-$(CONFIG_TOUCHSCREEN_HAMPSHIRE) += hampshire.o + obj-$(CONFIG_TOUCHSCREEN_GUNZE) += gunze.o + obj-$(CONFIG_TOUCHSCREEN_EETI) += eeti_ts.o +diff --git a/drivers/input/touchscreen/rpi-ft5406.c b/drivers/input/touchscreen/rpi-ft5406.c +new file mode 100644 +index 0000000..b27dbee +--- /dev/null ++++ b/drivers/input/touchscreen/rpi-ft5406.c +@@ -0,0 +1,246 @@ ++/* ++ * Driver for memory based ft5406 touchscreen ++ * ++ * Copyright (C) 2015 Raspberry Pi ++ * ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 as ++ * published by the Free Software Foundation. ++ */ ++ ++ ++#include <linux/module.h> ++#include <linux/interrupt.h> ++#include <linux/input.h> ++#include <linux/irq.h> ++#include <linux/delay.h> ++#include <linux/slab.h> ++#include <linux/bitops.h> ++#include <linux/input/mt.h> ++#include <linux/kthread.h> ++#include <linux/platform_device.h> ++#include <asm/io.h> ++#include <soc/bcm2835/raspberrypi-firmware.h> ++ ++#define MAXIMUM_SUPPORTED_POINTS 10 ++struct ft5406_regs { ++ uint8_t device_mode; ++ uint8_t gesture_id; ++ uint8_t num_points; ++ struct ft5406_touch { ++ uint8_t xh; ++ uint8_t xl; ++ uint8_t yh; ++ uint8_t yl; ++ uint8_t res1; ++ uint8_t res2; ++ } point[MAXIMUM_SUPPORTED_POINTS]; ++}; ++ ++#define SCREEN_WIDTH 800 ++#define SCREEN_HEIGHT 480 ++ ++struct ft5406 { ++ struct platform_device * pdev; ++ struct input_dev * input_dev; ++ void __iomem * ts_base; ++ struct ft5406_regs * regs; ++ struct task_struct * thread; ++}; ++ ++/* Thread to poll for touchscreen events ++ * ++ * This thread polls the memory based register copy of the ft5406 registers ++ * using the number of points register to know whether the copy has been ++ * updated (we write 99 to the memory copy, the GPU will write between ++ * 0 - 10 points) ++ */ ++static int ft5406_thread(void *arg) ++{ ++ struct ft5406 *ts = (struct ft5406 *) arg; ++ struct ft5406_regs regs; ++ int known_ids = 0; ++ ++ while(!kthread_should_stop()) ++ { ++ // 60fps polling ++ msleep_interruptible(17); ++ memcpy_fromio(&regs, ts->regs, sizeof(*ts->regs)); ++ writel(99, &ts->regs->num_points); ++ // Do not output if theres no new information (num_points is 99) ++ // or we have no touch points and don't need to release any ++ if(!(regs.num_points == 99 || (regs.num_points == 0 && known_ids == 0))) ++ { ++ int i; ++ int modified_ids = 0, released_ids; ++ for(i = 0; i < regs.num_points; i++) ++ { ++ int x = (((int) regs.point[i].xh & 0xf) << 8) + regs.point[i].xl; ++ int y = (((int) regs.point[i].yh & 0xf) << 8) + regs.point[i].yl; ++ int touchid = (regs.point[i].yh >> 4) & 0xf; ++ ++ modified_ids |= 1 << touchid; ++ ++ if(!((1 << touchid) & known_ids)) ++ dev_dbg(&ts->pdev->dev, "x = %d, y = %d, touchid = %d\n", x, y, touchid); ++ ++ input_mt_slot(ts->input_dev, touchid); ++ input_mt_report_slot_state(ts->input_dev, MT_TOOL_FINGER, 1); ++ ++ input_report_abs(ts->input_dev, ABS_MT_POSITION_X, x); ++ input_report_abs(ts->input_dev, ABS_MT_POSITION_Y, y); ++ ++ } ++ ++ released_ids = known_ids & ~modified_ids; ++ for(i = 0; released_ids && i < MAXIMUM_SUPPORTED_POINTS; i++) ++ { ++ if(released_ids & (1<<i)) ++ { ++ dev_dbg(&ts->pdev->dev, "Released %d, known = %x modified = %x\n", i, known_ids, modified_ids); ++ input_mt_slot(ts->input_dev, i); ++ input_mt_report_slot_state(ts->input_dev, MT_TOOL_FINGER, 0); ++ modified_ids &= ~(1 << i); ++ } ++ } ++ known_ids = modified_ids; ++ ++ input_mt_report_pointer_emulation(ts->input_dev, true); ++ input_sync(ts->input_dev); ++ } ++ ++ } ++ ++ return 0; ++} ++ ++static int ft5406_probe(struct platform_device *pdev) ++{ ++ int ret; ++ struct input_dev * input_dev = input_allocate_device(); ++ struct ft5406 * ts; ++ struct device_node *fw_node; ++ struct rpi_firmware *fw; ++ u32 touchbuf; ++ ++ dev_info(&pdev->dev, "Probing device\n"); ++ ++ fw_node = of_parse_phandle(pdev->dev.of_node, "firmware", 0); ++ if (!fw_node) { ++ dev_err(&pdev->dev, "Missing firmware node\n"); ++ return -ENOENT; ++ } ++ ++ fw = rpi_firmware_get(fw_node); ++ if (!fw) ++ return -EPROBE_DEFER; ++ ++ ret = rpi_firmware_property(fw, RPI_FIRMWARE_FRAMEBUFFER_GET_TOUCHBUF, ++ &touchbuf, sizeof(touchbuf)); ++ if (ret) { ++ dev_err(&pdev->dev, "Failed to get touch buffer\n"); ++ return ret; ++ } ++ ++ if (!touchbuf) { ++ dev_err(&pdev->dev, "Touchscreen not detected\n"); ++ return -ENODEV; ++ } ++ ++ dev_dbg(&pdev->dev, "Got TS buffer 0x%x\n", touchbuf); ++ ++ ts = kzalloc(sizeof(struct ft5406), GFP_KERNEL); ++ ++ if (!ts || !input_dev) { ++ ret = -ENOMEM; ++ dev_err(&pdev->dev, "Failed to allocate memory\n"); ++ return ret; ++ } ++ ts->input_dev = input_dev; ++ platform_set_drvdata(pdev, ts); ++ ts->pdev = pdev; ++ ++ input_dev->name = "FT5406 memory based driver"; ++ ++ __set_bit(EV_KEY, input_dev->evbit); ++ __set_bit(EV_SYN, input_dev->evbit); ++ __set_bit(EV_ABS, input_dev->evbit); ++ ++ input_set_abs_params(input_dev, ABS_MT_POSITION_X, 0, ++ SCREEN_WIDTH, 0, 0); ++ input_set_abs_params(input_dev, ABS_MT_POSITION_Y, 0, ++ SCREEN_HEIGHT, 0, 0); ++ ++ input_mt_init_slots(input_dev, MAXIMUM_SUPPORTED_POINTS, INPUT_MT_DIRECT); ++ ++ input_set_drvdata(input_dev, ts); ++ ++ ret = input_register_device(input_dev); ++ if (ret) { ++ dev_err(&pdev->dev, "could not register input device, %d\n", ++ ret); ++ return ret; ++ } ++ ++ // mmap the physical memory ++ touchbuf &= ~0xc0000000; ++ ts->ts_base = ioremap(touchbuf, sizeof(*ts->regs)); ++ if(ts->ts_base == NULL) ++ { ++ dev_err(&pdev->dev, "Failed to map physical address\n"); ++ input_unregister_device(input_dev); ++ kzfree(ts); ++ return -ENOMEM; ++ } ++ ++ ts->regs = (struct ft5406_regs *) ts->ts_base; ++ ++ // create thread to poll the touch events ++ ts->thread = kthread_run(ft5406_thread, ts, "ft5406"); ++ if(ts->thread == NULL) ++ { ++ dev_err(&pdev->dev, "Failed to create kernel thread"); ++ iounmap(ts->ts_base); ++ input_unregister_device(input_dev); ++ kzfree(ts); ++ } ++ ++ return 0; ++} ++ ++static int ft5406_remove(struct platform_device *pdev) ++{ ++ struct ft5406 *ts = (struct ft5406 *) platform_get_drvdata(pdev); ++ ++ dev_info(&pdev->dev, "Removing rpi-ft5406\n"); ++ ++ kthread_stop(ts->thread); ++ iounmap(ts->ts_base); ++ input_unregister_device(ts->input_dev); ++ kzfree(ts); ++ ++ return 0; ++} ++ ++static const struct of_device_id ft5406_match[] = { ++ { .compatible = "rpi,rpi-ft5406", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, ft5406_match); ++ ++static struct platform_driver ft5406_driver = { ++ .driver = { ++ .name = "rpi-ft5406", ++ .owner = THIS_MODULE, ++ .of_match_table = ft5406_match, ++ }, ++ .probe = ft5406_probe, ++ .remove = ft5406_remove, ++}; ++ ++module_platform_driver(ft5406_driver); ++ ++MODULE_AUTHOR("Gordon Hollingworth"); ++MODULE_DESCRIPTION("Touchscreen driver for memory based FT5406"); ++MODULE_LICENSE("GPL"); + +From d3b07af9751b03a6d60b5bcd95df067add313b78 Mon Sep 17 00:00:00 2001 +From: Phil Elwell <phil@raspberrypi.org> +Date: Mon, 13 Oct 2014 11:47:53 +0100 +Subject: [PATCH 079/112] Improve __copy_to_user and __copy_from_user + performance + +Provide a __copy_from_user that uses memcpy. On BCM2708, use +optimised memcpy/memmove/memcmp/memset implementations. + +arch/arm: Add mmiocpy/set aliases for memcpy/set + +See: https://github.com/raspberrypi/linux/issues/1082 + +copy_from_user: CPU_SW_DOMAIN_PAN compatibility + +The downstream copy_from_user acceleration must also play nice with +CONFIG_CPU_SW_DOMAIN_PAN. + +See: https://github.com/raspberrypi/linux/issues/1381 + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> +--- + arch/arm/include/asm/string.h | 5 + + arch/arm/include/asm/uaccess.h | 3 + + arch/arm/lib/Makefile | 15 +- + arch/arm/lib/arm-mem.h | 159 ++++++++++++ + arch/arm/lib/copy_from_user.S | 4 +- + arch/arm/lib/exports_rpi.c | 37 +++ + arch/arm/lib/memcmp_rpi.S | 285 +++++++++++++++++++++ + arch/arm/lib/memcpy_rpi.S | 61 +++++ + arch/arm/lib/memcpymove.h | 506 +++++++++++++++++++++++++++++++++++++ + arch/arm/lib/memmove_rpi.S | 61 +++++ + arch/arm/lib/memset_rpi.S | 123 +++++++++ + arch/arm/lib/uaccess_with_memcpy.c | 120 ++++++++- + 12 files changed, 1373 insertions(+), 6 deletions(-) + create mode 100644 arch/arm/lib/arm-mem.h + create mode 100644 arch/arm/lib/exports_rpi.c + create mode 100644 arch/arm/lib/memcmp_rpi.S + create mode 100644 arch/arm/lib/memcpy_rpi.S + create mode 100644 arch/arm/lib/memcpymove.h + create mode 100644 arch/arm/lib/memmove_rpi.S + create mode 100644 arch/arm/lib/memset_rpi.S + +diff --git a/arch/arm/include/asm/string.h b/arch/arm/include/asm/string.h +index cf4f3aa..9fe7780 100644 +--- a/arch/arm/include/asm/string.h ++++ b/arch/arm/include/asm/string.h +@@ -24,6 +24,11 @@ extern void * memchr(const void *, int, __kernel_size_t); + #define __HAVE_ARCH_MEMSET + extern void * memset(void *, int, __kernel_size_t); + ++#ifdef CONFIG_MACH_BCM2708 ++#define __HAVE_ARCH_MEMCMP ++extern int memcmp(const void *, const void *, size_t); ++#endif ++ + extern void __memzero(void *ptr, __kernel_size_t n); + + #define memset(p,v,n) \ +diff --git a/arch/arm/include/asm/uaccess.h b/arch/arm/include/asm/uaccess.h +index 35c9db8..52d3401 100644 +--- a/arch/arm/include/asm/uaccess.h ++++ b/arch/arm/include/asm/uaccess.h +@@ -493,6 +493,9 @@ do { \ + extern unsigned long __must_check + arm_copy_from_user(void *to, const void __user *from, unsigned long n); + ++extern unsigned long __must_check ++__copy_from_user_std(void *to, const void __user *from, unsigned long n); ++ + static inline unsigned long __must_check + __copy_from_user(void *to, const void __user *from, unsigned long n) + { +diff --git a/arch/arm/lib/Makefile b/arch/arm/lib/Makefile +index d8a7807..9c7dc5b 100644 +--- a/arch/arm/lib/Makefile ++++ b/arch/arm/lib/Makefile +@@ -6,9 +6,8 @@ + + lib-y := backtrace.o changebit.o csumipv6.o csumpartial.o \ + csumpartialcopy.o csumpartialcopyuser.o clearbit.o \ +- delay.o delay-loop.o findbit.o memchr.o memcpy.o \ +- memmove.o memset.o memzero.o setbit.o \ +- strchr.o strrchr.o \ ++ delay.o delay-loop.o findbit.o memchr.o memzero.o \ ++ setbit.o strchr.o strrchr.o \ + testchangebit.o testclearbit.o testsetbit.o \ + ashldi3.o ashrdi3.o lshrdi3.o muldi3.o \ + ucmpdi2.o lib1funcs.o div64.o \ +@@ -18,6 +17,16 @@ lib-y := backtrace.o changebit.o csumipv6.o csumpartial.o \ + mmu-y := clear_user.o copy_page.o getuser.o putuser.o \ + copy_from_user.o copy_to_user.o + ++# Choose optimised implementations for Raspberry Pi ++ifeq ($(CONFIG_MACH_BCM2708),y) ++ CFLAGS_uaccess_with_memcpy.o += -DCOPY_FROM_USER_THRESHOLD=1600 ++ CFLAGS_uaccess_with_memcpy.o += -DCOPY_TO_USER_THRESHOLD=672 ++ obj-$(CONFIG_MODULES) += exports_rpi.o ++ lib-y += memcpy_rpi.o memmove_rpi.o memset_rpi.o memcmp_rpi.o ++else ++ lib-y += memcpy.o memmove.o memset.o ++endif ++ + # using lib_ here won't override already available weak symbols + obj-$(CONFIG_UACCESS_WITH_MEMCPY) += uaccess_with_memcpy.o + +diff --git a/arch/arm/lib/arm-mem.h b/arch/arm/lib/arm-mem.h +new file mode 100644 +index 0000000..5d4bda1 +--- /dev/null ++++ b/arch/arm/lib/arm-mem.h +@@ -0,0 +1,159 @@ ++/* ++Copyright (c) 2013, Raspberry Pi Foundation ++Copyright (c) 2013, RISC OS Open Ltd ++All rights reserved. ++ ++Redistribution and use in source and binary forms, with or without ++modification, are permitted provided that the following conditions are met: ++ * Redistributions of source code must retain the above copyright ++ notice, this list of conditions and the following disclaimer. ++ * 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. ++ * Neither the name of the copyright holder nor the ++ names of its contributors may be used to endorse or promote products ++ derived from this software without specific prior written permission. ++ ++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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. ++*/ ++ ++.macro myfunc fname ++ .func fname ++ .global fname ++fname: ++.endm ++ ++.macro preload_leading_step1 backwards, ptr, base ++/* If the destination is already 16-byte aligned, then we need to preload ++ * between 0 and prefetch_distance (inclusive) cache lines ahead so there ++ * are no gaps when the inner loop starts. ++ */ ++ .if backwards ++ sub ptr, base, #1 ++ bic ptr, ptr, #31 ++ .else ++ bic ptr, base, #31 ++ .endif ++ .set OFFSET, 0 ++ .rept prefetch_distance+1 ++ pld [ptr, #OFFSET] ++ .if backwards ++ .set OFFSET, OFFSET-32 ++ .else ++ .set OFFSET, OFFSET+32 ++ .endif ++ .endr ++.endm ++ ++.macro preload_leading_step2 backwards, ptr, base, leading_bytes, tmp ++/* However, if the destination is not 16-byte aligned, we may need to ++ * preload one more cache line than that. The question we need to ask is: ++ * are the leading bytes more than the amount by which the source ++ * pointer will be rounded down for preloading, and if so, by how many ++ * cache lines? ++ */ ++ .if backwards ++/* Here we compare against how many bytes we are into the ++ * cache line, counting down from the highest such address. ++ * Effectively, we want to calculate ++ * leading_bytes = dst&15 ++ * cacheline_offset = 31-((src-leading_bytes-1)&31) ++ * extra_needed = leading_bytes - cacheline_offset ++ * and test if extra_needed is <= 0, or rearranging: ++ * leading_bytes + (src-leading_bytes-1)&31 <= 31 ++ */ ++ mov tmp, base, lsl #32-5 ++ sbc tmp, tmp, leading_bytes, lsl #32-5 ++ adds tmp, tmp, leading_bytes, lsl #32-5 ++ bcc 61f ++ pld [ptr, #-32*(prefetch_distance+1)] ++ .else ++/* Effectively, we want to calculate ++ * leading_bytes = (-dst)&15 ++ * cacheline_offset = (src+leading_bytes)&31 ++ * extra_needed = leading_bytes - cacheline_offset ++ * and test if extra_needed is <= 0. ++ */ ++ mov tmp, base, lsl #32-5 ++ add tmp, tmp, leading_bytes, lsl #32-5 ++ rsbs tmp, tmp, leading_bytes, lsl #32-5 ++ bls 61f ++ pld [ptr, #32*(prefetch_distance+1)] ++ .endif ++61: ++.endm ++ ++.macro preload_trailing backwards, base, remain, tmp ++ /* We need either 0, 1 or 2 extra preloads */ ++ .if backwards ++ rsb tmp, base, #0 ++ mov tmp, tmp, lsl #32-5 ++ .else ++ mov tmp, base, lsl #32-5 ++ .endif ++ adds tmp, tmp, remain, lsl #32-5 ++ adceqs tmp, tmp, #0 ++ /* The instruction above has two effects: ensures Z is only ++ * set if C was clear (so Z indicates that both shifted quantities ++ * were 0), and clears C if Z was set (so C indicates that the sum ++ * of the shifted quantities was greater and not equal to 32) */ ++ beq 82f ++ .if backwards ++ sub tmp, base, #1 ++ bic tmp, tmp, #31 ++ .else ++ bic tmp, base, #31 ++ .endif ++ bcc 81f ++ .if backwards ++ pld [tmp, #-32*(prefetch_distance+1)] ++81: ++ pld [tmp, #-32*prefetch_distance] ++ .else ++ pld [tmp, #32*(prefetch_distance+2)] ++81: ++ pld [tmp, #32*(prefetch_distance+1)] ++ .endif ++82: ++.endm ++ ++.macro preload_all backwards, narrow_case, shift, base, remain, tmp0, tmp1 ++ .if backwards ++ sub tmp0, base, #1 ++ bic tmp0, tmp0, #31 ++ pld [tmp0] ++ sub tmp1, base, remain, lsl #shift ++ .else ++ bic tmp0, base, #31 ++ pld [tmp0] ++ add tmp1, base, remain, lsl #shift ++ sub tmp1, tmp1, #1 ++ .endif ++ bic tmp1, tmp1, #31 ++ cmp tmp1, tmp0 ++ beq 92f ++ .if narrow_case ++ /* In this case, all the data fits in either 1 or 2 cache lines */ ++ pld [tmp1] ++ .else ++91: ++ .if backwards ++ sub tmp0, tmp0, #32 ++ .else ++ add tmp0, tmp0, #32 ++ .endif ++ cmp tmp0, tmp1 ++ pld [tmp0] ++ bne 91b ++ .endif ++92: ++.endm +diff --git a/arch/arm/lib/copy_from_user.S b/arch/arm/lib/copy_from_user.S +index 1512beb..3da60dd 100644 +--- a/arch/arm/lib/copy_from_user.S ++++ b/arch/arm/lib/copy_from_user.S +@@ -89,11 +89,13 @@ + + .text + +-ENTRY(arm_copy_from_user) ++ENTRY(__copy_from_user_std) ++WEAK(arm_copy_from_user) + + #include "copy_template.S" + + ENDPROC(arm_copy_from_user) ++ENDPROC(__copy_from_user_std) + + .pushsection .fixup,"ax" + .align 0 +diff --git a/arch/arm/lib/exports_rpi.c b/arch/arm/lib/exports_rpi.c +new file mode 100644 +index 0000000..1f82604 +--- /dev/null ++++ b/arch/arm/lib/exports_rpi.c +@@ -0,0 +1,37 @@ ++/** ++ * Copyright (c) 2014, Raspberry Pi (Trading) Ltd. ++ * ++ * 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, ++ * without modification. ++ * 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. ++ * 3. The names of the above-listed copyright holders may not be used ++ * to endorse or promote products derived from this software without ++ * specific prior written permission. ++ * ++ * ALTERNATIVELY, this software may be distributed under the terms of the ++ * GNU General Public License ("GPL") version 2, as published by the Free ++ * Software Foundation. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER OR ++ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ++ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, ++ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR ++ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF ++ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING ++ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ */ ++ ++#include <linux/kernel.h> ++#include <linux/module.h> ++ ++EXPORT_SYMBOL(memcmp); +diff --git a/arch/arm/lib/memcmp_rpi.S b/arch/arm/lib/memcmp_rpi.S +new file mode 100644 +index 0000000..bf6e4ed +--- /dev/null ++++ b/arch/arm/lib/memcmp_rpi.S +@@ -0,0 +1,285 @@ ++/* ++Copyright (c) 2013, Raspberry Pi Foundation ++Copyright (c) 2013, RISC OS Open Ltd ++All rights reserved. ++ ++Redistribution and use in source and binary forms, with or without ++modification, are permitted provided that the following conditions are met: ++ * Redistributions of source code must retain the above copyright ++ notice, this list of conditions and the following disclaimer. ++ * 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. ++ * Neither the name of the copyright holder nor the ++ names of its contributors may be used to endorse or promote products ++ derived from this software without specific prior written permission. ++ ++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY ++DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ++(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; ++LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ++ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ++(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++*/ ++ ++#include <linux/linkage.h> ++#include "arm-mem.h" ++ ++/* Prevent the stack from becoming executable */ ++#if defined(__linux__) && defined(__ELF__) ++.section .note.GNU-stack,"",%progbits ++#endif ++ ++ .text ++ .arch armv6 ++ .object_arch armv4 ++ .arm ++ .altmacro ++ .p2align 2 ++ ++.macro memcmp_process_head unaligned ++ .if unaligned ++ ldr DAT0, [S_1], #4 ++ ldr DAT1, [S_1], #4 ++ ldr DAT2, [S_1], #4 ++ ldr DAT3, [S_1], #4 ++ .else ++ ldmia S_1!, {DAT0, DAT1, DAT2, DAT3} ++ .endif ++ ldmia S_2!, {DAT4, DAT5, DAT6, DAT7} ++.endm ++ ++.macro memcmp_process_tail ++ cmp DAT0, DAT4 ++ cmpeq DAT1, DAT5 ++ cmpeq DAT2, DAT6 ++ cmpeq DAT3, DAT7 ++ bne 200f ++.endm ++ ++.macro memcmp_leading_31bytes ++ movs DAT0, OFF, lsl #31 ++ ldrmib DAT0, [S_1], #1 ++ ldrcsh DAT1, [S_1], #2 ++ ldrmib DAT4, [S_2], #1 ++ ldrcsh DAT5, [S_2], #2 ++ movpl DAT0, #0 ++ movcc DAT1, #0 ++ movpl DAT4, #0 ++ movcc DAT5, #0 ++ submi N, N, #1 ++ subcs N, N, #2 ++ cmp DAT0, DAT4 ++ cmpeq DAT1, DAT5 ++ bne 200f ++ movs DAT0, OFF, lsl #29 ++ ldrmi DAT0, [S_1], #4 ++ ldrcs DAT1, [S_1], #4 ++ ldrcs DAT2, [S_1], #4 ++ ldrmi DAT4, [S_2], #4 ++ ldmcsia S_2!, {DAT5, DAT6} ++ movpl DAT0, #0 ++ movcc DAT1, #0 ++ movcc DAT2, #0 ++ movpl DAT4, #0 ++ movcc DAT5, #0 ++ movcc DAT6, #0 ++ submi N, N, #4 ++ subcs N, N, #8 ++ cmp DAT0, DAT4 ++ cmpeq DAT1, DAT5 ++ cmpeq DAT2, DAT6 ++ bne 200f ++ tst OFF, #16 ++ beq 105f ++ memcmp_process_head 1 ++ sub N, N, #16 ++ memcmp_process_tail ++105: ++.endm ++ ++.macro memcmp_trailing_15bytes unaligned ++ movs N, N, lsl #29 ++ .if unaligned ++ ldrcs DAT0, [S_1], #4 ++ ldrcs DAT1, [S_1], #4 ++ .else ++ ldmcsia S_1!, {DAT0, DAT1} ++ .endif ++ ldrmi DAT2, [S_1], #4 ++ ldmcsia S_2!, {DAT4, DAT5} ++ ldrmi DAT6, [S_2], #4 ++ movcc DAT0, #0 ++ movcc DAT1, #0 ++ movpl DAT2, #0 ++ movcc DAT4, #0 ++ movcc DAT5, #0 ++ movpl DAT6, #0 ++ cmp DAT0, DAT4 ++ cmpeq DAT1, DAT5 ++ cmpeq DAT2, DAT6 ++ bne 200f ++ movs N, N, lsl #2 ++ ldrcsh DAT0, [S_1], #2 ++ ldrmib DAT1, [S_1] ++ ldrcsh DAT4, [S_2], #2 ++ ldrmib DAT5, [S_2] ++ movcc DAT0, #0 ++ movpl DAT1, #0 ++ movcc DAT4, #0 ++ movpl DAT5, #0 ++ cmp DAT0, DAT4 ++ cmpeq DAT1, DAT5 ++ bne 200f ++.endm ++ ++.macro memcmp_long_inner_loop unaligned ++110: ++ memcmp_process_head unaligned ++ pld [S_2, #prefetch_distance*32 + 16] ++ memcmp_process_tail ++ memcmp_process_head unaligned ++ pld [S_1, OFF] ++ memcmp_process_tail ++ subs N, N, #32 ++ bhs 110b ++ /* Just before the final (prefetch_distance+1) 32-byte blocks, ++ * deal with final preloads */ ++ preload_trailing 0, S_1, N, DAT0 ++ preload_trailing 0, S_2, N, DAT0 ++ add N, N, #(prefetch_distance+2)*32 - 16 ++120: ++ memcmp_process_head unaligned ++ memcmp_process_tail ++ subs N, N, #16 ++ bhs 120b ++ /* Trailing words and bytes */ ++ tst N, #15 ++ beq 199f ++ memcmp_trailing_15bytes unaligned ++199: /* Reached end without detecting a difference */ ++ mov a1, #0 ++ setend le ++ pop {DAT1-DAT6, pc} ++.endm ++ ++.macro memcmp_short_inner_loop unaligned ++ subs N, N, #16 /* simplifies inner loop termination */ ++ blo 122f ++120: ++ memcmp_process_head unaligned ++ memcmp_process_tail ++ subs N, N, #16 ++ bhs 120b ++122: /* Trailing words and bytes */ ++ tst N, #15 ++ beq 199f ++ memcmp_trailing_15bytes unaligned ++199: /* Reached end without detecting a difference */ ++ mov a1, #0 ++ setend le ++ pop {DAT1-DAT6, pc} ++.endm ++ ++/* ++ * int memcmp(const void *s1, const void *s2, size_t n); ++ * On entry: ++ * a1 = pointer to buffer 1 ++ * a2 = pointer to buffer 2 ++ * a3 = number of bytes to compare (as unsigned chars) ++ * On exit: ++ * a1 = >0/=0/<0 if s1 >/=/< s2 ++ */ ++ ++.set prefetch_distance, 2 ++ ++ENTRY(memcmp) ++ S_1 .req a1 ++ S_2 .req a2 ++ N .req a3 ++ DAT0 .req a4 ++ DAT1 .req v1 ++ DAT2 .req v2 ++ DAT3 .req v3 ++ DAT4 .req v4 ++ DAT5 .req v5 ++ DAT6 .req v6 ++ DAT7 .req ip ++ OFF .req lr ++ ++ push {DAT1-DAT6, lr} ++ setend be /* lowest-addressed bytes are most significant */ ++ ++ /* To preload ahead as we go, we need at least (prefetch_distance+2) 32-byte blocks */ ++ cmp N, #(prefetch_distance+3)*32 - 1 ++ blo 170f ++ ++ /* Long case */ ++ /* Adjust N so that the decrement instruction can also test for ++ * inner loop termination. We want it to stop when there are ++ * (prefetch_distance+1) complete blocks to go. */ ++ sub N, N, #(prefetch_distance+2)*32 ++ preload_leading_step1 0, DAT0, S_1 ++ preload_leading_step1 0, DAT1, S_2 ++ tst S_2, #31 ++ beq 154f ++ rsb OFF, S_2, #0 /* no need to AND with 15 here */ ++ preload_leading_step2 0, DAT0, S_1, OFF, DAT2 ++ preload_leading_step2 0, DAT1, S_2, OFF, DAT2 ++ memcmp_leading_31bytes ++154: /* Second source now cacheline (32-byte) aligned; we have at ++ * least one prefetch to go. */ ++ /* Prefetch offset is best selected such that it lies in the ++ * first 8 of each 32 bytes - but it's just as easy to aim for ++ * the first one */ ++ and OFF, S_1, #31 ++ rsb OFF, OFF, #32*prefetch_distance ++ tst S_1, #3 ++ bne 140f ++ memcmp_long_inner_loop 0 ++140: memcmp_long_inner_loop 1 ++ ++170: /* Short case */ ++ teq N, #0 ++ beq 199f ++ preload_all 0, 0, 0, S_1, N, DAT0, DAT1 ++ preload_all 0, 0, 0, S_2, N, DAT0, DAT1 ++ tst S_2, #3 ++ beq 174f ++172: subs N, N, #1 ++ blo 199f ++ ldrb DAT0, [S_1], #1 ++ ldrb DAT4, [S_2], #1 ++ cmp DAT0, DAT4 ++ bne 200f ++ tst S_2, #3 ++ bne 172b ++174: /* Second source now 4-byte aligned; we have 0 or more bytes to go */ ++ tst S_1, #3 ++ bne 140f ++ memcmp_short_inner_loop 0 ++140: memcmp_short_inner_loop 1 ++ ++200: /* Difference found: determine sign. */ ++ movhi a1, #1 ++ movlo a1, #-1 ++ setend le ++ pop {DAT1-DAT6, pc} ++ ++ .unreq S_1 ++ .unreq S_2 ++ .unreq N ++ .unreq DAT0 ++ .unreq DAT1 ++ .unreq DAT2 ++ .unreq DAT3 ++ .unreq DAT4 ++ .unreq DAT5 ++ .unreq DAT6 ++ .unreq DAT7 ++ .unreq OFF ++ENDPROC(memcmp) +diff --git a/arch/arm/lib/memcpy_rpi.S b/arch/arm/lib/memcpy_rpi.S +new file mode 100644 +index 0000000..30f8a90 +--- /dev/null ++++ b/arch/arm/lib/memcpy_rpi.S +@@ -0,0 +1,61 @@ ++/* ++Copyright (c) 2013, Raspberry Pi Foundation ++Copyright (c) 2013, RISC OS Open Ltd ++All rights reserved. ++ ++Redistribution and use in source and binary forms, with or without ++modification, are permitted provided that the following conditions are met: ++ * Redistributions of source code must retain the above copyright ++ notice, this list of conditions and the following disclaimer. ++ * 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. ++ * Neither the name of the copyright holder nor the ++ names of its contributors may be used to endorse or promote products ++ derived from this software without specific prior written permission. ++ ++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY ++DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ++(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; ++LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ++ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ++(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++*/ ++ ++#include <linux/linkage.h> ++#include "arm-mem.h" ++#include "memcpymove.h" ++ ++/* Prevent the stack from becoming executable */ ++#if defined(__linux__) && defined(__ELF__) ++.section .note.GNU-stack,"",%progbits ++#endif ++ ++ .text ++ .arch armv6 ++ .object_arch armv4 ++ .arm ++ .altmacro ++ .p2align 2 ++ ++/* ++ * void *memcpy(void * restrict s1, const void * restrict s2, size_t n); ++ * On entry: ++ * a1 = pointer to destination ++ * a2 = pointer to source ++ * a3 = number of bytes to copy ++ * On exit: ++ * a1 preserved ++ */ ++ ++.set prefetch_distance, 3 ++ ++ENTRY(mmiocpy) ++ENTRY(memcpy) ++ memcpy 0 ++ENDPROC(memcpy) ++ENDPROC(mmiocpy) +diff --git a/arch/arm/lib/memcpymove.h b/arch/arm/lib/memcpymove.h +new file mode 100644 +index 0000000..d8be584 +--- /dev/null ++++ b/arch/arm/lib/memcpymove.h +@@ -0,0 +1,506 @@ ++/* ++Copyright (c) 2013, Raspberry Pi Foundation ++Copyright (c) 2013, RISC OS Open Ltd ++All rights reserved. ++ ++Redistribution and use in source and binary forms, with or without ++modification, are permitted provided that the following conditions are met: ++ * Redistributions of source code must retain the above copyright ++ notice, this list of conditions and the following disclaimer. ++ * 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. ++ * Neither the name of the copyright holder nor the ++ names of its contributors may be used to endorse or promote products ++ derived from this software without specific prior written permission. ++ ++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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. ++*/ ++ ++.macro unaligned_words backwards, align, use_pld, words, r0, r1, r2, r3, r4, r5, r6, r7, r8 ++ .if words == 1 ++ .if backwards ++ mov r1, r0, lsl #32-align*8 ++ ldr r0, [S, #-4]! ++ orr r1, r1, r0, lsr #align*8 ++ str r1, [D, #-4]! ++ .else ++ mov r0, r1, lsr #align*8 ++ ldr r1, [S, #4]! ++ orr r0, r0, r1, lsl #32-align*8 ++ str r0, [D], #4 ++ .endif ++ .elseif words == 2 ++ .if backwards ++ ldr r1, [S, #-4]! ++ mov r2, r0, lsl #32-align*8 ++ ldr r0, [S, #-4]! ++ orr r2, r2, r1, lsr #align*8 ++ mov r1, r1, lsl #32-align*8 ++ orr r1, r1, r0, lsr #align*8 ++ stmdb D!, {r1, r2} ++ .else ++ ldr r1, [S, #4]! ++ mov r0, r2, lsr #align*8 ++ ldr r2, [S, #4]! ++ orr r0, r0, r1, lsl #32-align*8 ++ mov r1, r1, lsr #align*8 ++ orr r1, r1, r2, lsl #32-align*8 ++ stmia D!, {r0, r1} ++ .endif ++ .elseif words == 4 ++ .if backwards ++ ldmdb S!, {r2, r3} ++ mov r4, r0, lsl #32-align*8 ++ ldmdb S!, {r0, r1} ++ orr r4, r4, r3, lsr #align*8 ++ mov r3, r3, lsl #32-align*8 ++ orr r3, r3, r2, lsr #align*8 ++ mov r2, r2, lsl #32-align*8 ++ orr r2, r2, r1, lsr #align*8 ++ mov r1, r1, lsl #32-align*8 ++ orr r1, r1, r0, lsr #align*8 ++ stmdb D!, {r1, r2, r3, r4} ++ .else ++ ldmib S!, {r1, r2} ++ mov r0, r4, lsr #align*8 ++ ldmib S!, {r3, r4} ++ orr r0, r0, r1, lsl #32-align*8 ++ mov r1, r1, lsr #align*8 ++ orr r1, r1, r2, lsl #32-align*8 ++ mov r2, r2, lsr #align*8 ++ orr r2, r2, r3, lsl #32-align*8 ++ mov r3, r3, lsr #align*8 ++ orr r3, r3, r4, lsl #32-align*8 ++ stmia D!, {r0, r1, r2, r3} ++ .endif ++ .elseif words == 8 ++ .if backwards ++ ldmdb S!, {r4, r5, r6, r7} ++ mov r8, r0, lsl #32-align*8 ++ ldmdb S!, {r0, r1, r2, r3} ++ .if use_pld ++ pld [S, OFF] ++ .endif ++ orr r8, r8, r7, lsr #align*8 ++ mov r7, r7, lsl #32-align*8 ++ orr r7, r7, r6, lsr #align*8 ++ mov r6, r6, lsl #32-align*8 ++ orr r6, r6, r5, lsr #align*8 ++ mov r5, r5, lsl #32-align*8 ++ orr r5, r5, r4, lsr #align*8 ++ mov r4, r4, lsl #32-align*8 ++ orr r4, r4, r3, lsr #align*8 ++ mov r3, r3, lsl #32-align*8 ++ orr r3, r3, r2, lsr #align*8 ++ mov r2, r2, lsl #32-align*8 ++ orr r2, r2, r1, lsr #align*8 ++ mov r1, r1, lsl #32-align*8 ++ orr r1, r1, r0, lsr #align*8 ++ stmdb D!, {r5, r6, r7, r8} ++ stmdb D!, {r1, r2, r3, r4} ++ .else ++ ldmib S!, {r1, r2, r3, r4} ++ mov r0, r8, lsr #align*8 ++ ldmib S!, {r5, r6, r7, r8} ++ .if use_pld ++ pld [S, OFF] ++ .endif ++ orr r0, r0, r1, lsl #32-align*8 ++ mov r1, r1, lsr #align*8 ++ orr r1, r1, r2, lsl #32-align*8 ++ mov r2, r2, lsr #align*8 ++ orr r2, r2, r3, lsl #32-align*8 ++ mov r3, r3, lsr #align*8 ++ orr r3, r3, r4, lsl #32-align*8 ++ mov r4, r4, lsr #align*8 ++ orr r4, r4, r5, lsl #32-align*8 ++ mov r5, r5, lsr #align*8 ++ orr r5, r5, r6, lsl #32-align*8 ++ mov r6, r6, lsr #align*8 ++ orr r6, r6, r7, lsl #32-align*8 ++ mov r7, r7, lsr #align*8 ++ orr r7, r7, r8, lsl #32-align*8 ++ stmia D!, {r0, r1, r2, r3} ++ stmia D!, {r4, r5, r6, r7} ++ .endif ++ .endif ++.endm ++ ++.macro memcpy_leading_15bytes backwards, align ++ movs DAT1, DAT2, lsl #31 ++ sub N, N, DAT2 ++ .if backwards ++ ldrmib DAT0, [S, #-1]! ++ ldrcsh DAT1, [S, #-2]! ++ strmib DAT0, [D, #-1]! ++ strcsh DAT1, [D, #-2]! ++ .else ++ ldrmib DAT0, [S], #1 ++ ldrcsh DAT1, [S], #2 ++ strmib DAT0, [D], #1 ++ strcsh DAT1, [D], #2 ++ .endif ++ movs DAT1, DAT2, lsl #29 ++ .if backwards ++ ldrmi DAT0, [S, #-4]! ++ .if align == 0 ++ ldmcsdb S!, {DAT1, DAT2} ++ .else ++ ldrcs DAT2, [S, #-4]! ++ ldrcs DAT1, [S, #-4]! ++ .endif ++ strmi DAT0, [D, #-4]! ++ stmcsdb D!, {DAT1, DAT2} ++ .else ++ ldrmi DAT0, [S], #4 ++ .if align == 0 ++ ldmcsia S!, {DAT1, DAT2} ++ .else ++ ldrcs DAT1, [S], #4 ++ ldrcs DAT2, [S], #4 ++ .endif ++ strmi DAT0, [D], #4 ++ stmcsia D!, {DAT1, DAT2} ++ .endif ++.endm ++ ++.macro memcpy_trailing_15bytes backwards, align ++ movs N, N, lsl #29 ++ .if backwards ++ .if align == 0 ++ ldmcsdb S!, {DAT0, DAT1} ++ .else ++ ldrcs DAT1, [S, #-4]! ++ ldrcs DAT0, [S, #-4]! ++ .endif ++ ldrmi DAT2, [S, #-4]! ++ stmcsdb D!, {DAT0, DAT1} ++ strmi DAT2, [D, #-4]! ++ .else ++ .if align == 0 ++ ldmcsia S!, {DAT0, DAT1} ++ .else ++ ldrcs DAT0, [S], #4 ++ ldrcs DAT1, [S], #4 ++ .endif ++ ldrmi DAT2, [S], #4 ++ stmcsia D!, {DAT0, DAT1} ++ strmi DAT2, [D], #4 ++ .endif ++ movs N, N, lsl #2 ++ .if backwards ++ ldrcsh DAT0, [S, #-2]! ++ ldrmib DAT1, [S, #-1] ++ strcsh DAT0, [D, #-2]! ++ strmib DAT1, [D, #-1] ++ .else ++ ldrcsh DAT0, [S], #2 ++ ldrmib DAT1, [S] ++ strcsh DAT0, [D], #2 ++ strmib DAT1, [D] ++ .endif ++.endm ++ ++.macro memcpy_long_inner_loop backwards, align ++ .if align != 0 ++ .if backwards ++ ldr DAT0, [S, #-align]! ++ .else ++ ldr LAST, [S, #-align]! ++ .endif ++ .endif ++110: ++ .if align == 0 ++ .if backwards ++ ldmdb S!, {DAT0, DAT1, DAT2, DAT3, DAT4, DAT5, DAT6, LAST} ++ pld [S, OFF] ++ stmdb D!, {DAT4, DAT5, DAT6, LAST} ++ stmdb D!, {DAT0, DAT1, DAT2, DAT3} ++ .else ++ ldmia S!, {DAT0, DAT1, DAT2, DAT3, DAT4, DAT5, DAT6, LAST} ++ pld [S, OFF] ++ stmia D!, {DAT0, DAT1, DAT2, DAT3} ++ stmia D!, {DAT4, DAT5, DAT6, LAST} ++ .endif ++ .else ++ unaligned_words backwards, align, 1, 8, DAT0, DAT1, DAT2, DAT3, DAT4, DAT5, DAT6, DAT7, LAST ++ .endif ++ subs N, N, #32 ++ bhs 110b ++ /* Just before the final (prefetch_distance+1) 32-byte blocks, deal with final preloads */ ++ preload_trailing backwards, S, N, OFF ++ add N, N, #(prefetch_distance+2)*32 - 32 ++120: ++ .if align == 0 ++ .if backwards ++ ldmdb S!, {DAT0, DAT1, DAT2, DAT3, DAT4, DAT5, DAT6, LAST} ++ stmdb D!, {DAT4, DAT5, DAT6, LAST} ++ stmdb D!, {DAT0, DAT1, DAT2, DAT3} ++ .else ++ ldmia S!, {DAT0, DAT1, DAT2, DAT3, DAT4, DAT5, DAT6, LAST} ++ stmia D!, {DAT0, DAT1, DAT2, DAT3} ++ stmia D!, {DAT4, DAT5, DAT6, LAST} ++ .endif ++ .else ++ unaligned_words backwards, align, 0, 8, DAT0, DAT1, DAT2, DAT3, DAT4, DAT5, DAT6, DAT7, LAST ++ .endif ++ subs N, N, #32 ++ bhs 120b ++ tst N, #16 ++ .if align == 0 ++ .if backwards ++ ldmnedb S!, {DAT0, DAT1, DAT2, LAST} ++ stmnedb D!, {DAT0, DAT1, DAT2, LAST} ++ .else ++ ldmneia S!, {DAT0, DAT1, DAT2, LAST} ++ stmneia D!, {DAT0, DAT1, DAT2, LAST} ++ .endif ++ .else ++ beq 130f ++ unaligned_words backwards, align, 0, 4, DAT0, DAT1, DAT2, DAT3, LAST ++130: ++ .endif ++ /* Trailing words and bytes */ ++ tst N, #15 ++ beq 199f ++ .if align != 0 ++ add S, S, #align ++ .endif ++ memcpy_trailing_15bytes backwards, align ++199: ++ pop {DAT3, DAT4, DAT5, DAT6, DAT7} ++ pop {D, DAT1, DAT2, pc} ++.endm ++ ++.macro memcpy_medium_inner_loop backwards, align ++120: ++ .if backwards ++ .if align == 0 ++ ldmdb S!, {DAT0, DAT1, DAT2, LAST} ++ .else ++ ldr LAST, [S, #-4]! ++ ldr DAT2, [S, #-4]! ++ ldr DAT1, [S, #-4]! ++ ldr DAT0, [S, #-4]! ++ .endif ++ stmdb D!, {DAT0, DAT1, DAT2, LAST} ++ .else ++ .if align == 0 ++ ldmia S!, {DAT0, DAT1, DAT2, LAST} ++ .else ++ ldr DAT0, [S], #4 ++ ldr DAT1, [S], #4 ++ ldr DAT2, [S], #4 ++ ldr LAST, [S], #4 ++ .endif ++ stmia D!, {DAT0, DAT1, DAT2, LAST} ++ .endif ++ subs N, N, #16 ++ bhs 120b ++ /* Trailing words and bytes */ ++ tst N, #15 ++ beq 199f ++ memcpy_trailing_15bytes backwards, align ++199: ++ pop {D, DAT1, DAT2, pc} ++.endm ++ ++.macro memcpy_short_inner_loop backwards, align ++ tst N, #16 ++ .if backwards ++ .if align == 0 ++ ldmnedb S!, {DAT0, DAT1, DAT2, LAST} ++ .else ++ ldrne LAST, [S, #-4]! ++ ldrne DAT2, [S, #-4]! ++ ldrne DAT1, [S, #-4]! ++ ldrne DAT0, [S, #-4]! ++ .endif ++ stmnedb D!, {DAT0, DAT1, DAT2, LAST} ++ .else ++ .if align == 0 ++ ldmneia S!, {DAT0, DAT1, DAT2, LAST} ++ .else ++ ldrne DAT0, [S], #4 ++ ldrne DAT1, [S], #4 ++ ldrne DAT2, [S], #4 ++ ldrne LAST, [S], #4 ++ .endif ++ stmneia D!, {DAT0, DAT1, DAT2, LAST} ++ .endif ++ memcpy_trailing_15bytes backwards, align ++199: ++ pop {D, DAT1, DAT2, pc} ++.endm ++ ++.macro memcpy backwards ++ D .req a1 ++ S .req a2 ++ N .req a3 ++ DAT0 .req a4 ++ DAT1 .req v1 ++ DAT2 .req v2 ++ DAT3 .req v3 ++ DAT4 .req v4 ++ DAT5 .req v5 ++ DAT6 .req v6 ++ DAT7 .req sl ++ LAST .req ip ++ OFF .req lr ++ ++ .cfi_startproc ++ ++ push {D, DAT1, DAT2, lr} ++ ++ .cfi_def_cfa_offset 16 ++ .cfi_rel_offset D, 0 ++ .cfi_undefined S ++ .cfi_undefined N ++ .cfi_undefined DAT0 ++ .cfi_rel_offset DAT1, 4 ++ .cfi_rel_offset DAT2, 8 ++ .cfi_undefined LAST ++ .cfi_rel_offset lr, 12 ++ ++ .if backwards ++ add D, D, N ++ add S, S, N ++ .endif ++ ++ /* See if we're guaranteed to have at least one 16-byte aligned 16-byte write */ ++ cmp N, #31 ++ blo 170f ++ /* To preload ahead as we go, we need at least (prefetch_distance+2) 32-byte blocks */ ++ cmp N, #(prefetch_distance+3)*32 - 1 ++ blo 160f ++ ++ /* Long case */ ++ push {DAT3, DAT4, DAT5, DAT6, DAT7} ++ ++ .cfi_def_cfa_offset 36 ++ .cfi_rel_offset D, 20 ++ .cfi_rel_offset DAT1, 24 ++ .cfi_rel_offset DAT2, 28 ++ .cfi_rel_offset DAT3, 0 ++ .cfi_rel_offset DAT4, 4 ++ .cfi_rel_offset DAT5, 8 ++ .cfi_rel_offset DAT6, 12 ++ .cfi_rel_offset DAT7, 16 ++ .cfi_rel_offset lr, 32 ++ ++ /* Adjust N so that the decrement instruction can also test for ++ * inner loop termination. We want it to stop when there are ++ * (prefetch_distance+1) complete blocks to go. */ ++ sub N, N, #(prefetch_distance+2)*32 ++ preload_leading_step1 backwards, DAT0, S ++ .if backwards ++ /* Bug in GAS: it accepts, but mis-assembles the instruction ++ * ands DAT2, D, #60, 2 ++ * which sets DAT2 to the number of leading bytes until destination is aligned and also clears C (sets borrow) ++ */ ++ .word 0xE210513C ++ beq 154f ++ .else ++ ands DAT2, D, #15 ++ beq 154f ++ rsb DAT2, DAT2, #16 /* number of leading bytes until destination aligned */ ++ .endif ++ preload_leading_step2 backwards, DAT0, S, DAT2, OFF ++ memcpy_leading_15bytes backwards, 1 ++154: /* Destination now 16-byte aligned; we have at least one prefetch as well as at least one 16-byte output block */ ++ /* Prefetch offset is best selected such that it lies in the first 8 of each 32 bytes - but it's just as easy to aim for the first one */ ++ .if backwards ++ rsb OFF, S, #3 ++ and OFF, OFF, #28 ++ sub OFF, OFF, #32*(prefetch_distance+1) ++ .else ++ and OFF, S, #28 ++ rsb OFF, OFF, #32*prefetch_distance ++ .endif ++ movs DAT0, S, lsl #31 ++ bhi 157f ++ bcs 156f ++ bmi 155f ++ memcpy_long_inner_loop backwards, 0 ++155: memcpy_long_inner_loop backwards, 1 ++156: memcpy_long_inner_loop backwards, 2 ++157: memcpy_long_inner_loop backwards, 3 ++ ++ .cfi_def_cfa_offset 16 ++ .cfi_rel_offset D, 0 ++ .cfi_rel_offset DAT1, 4 ++ .cfi_rel_offset DAT2, 8 ++ .cfi_same_value DAT3 ++ .cfi_same_value DAT4 ++ .cfi_same_value DAT5 ++ .cfi_same_value DAT6 ++ .cfi_same_value DAT7 ++ .cfi_rel_offset lr, 12 ++ ++160: /* Medium case */ ++ preload_all backwards, 0, 0, S, N, DAT2, OFF ++ sub N, N, #16 /* simplifies inner loop termination */ ++ .if backwards ++ ands DAT2, D, #15 ++ beq 164f ++ .else ++ ands DAT2, D, #15 ++ beq 164f ++ rsb DAT2, DAT2, #16 ++ .endif ++ memcpy_leading_15bytes backwards, align ++164: /* Destination now 16-byte aligned; we have at least one 16-byte output block */ ++ tst S, #3 ++ bne 140f ++ memcpy_medium_inner_loop backwards, 0 ++140: memcpy_medium_inner_loop backwards, 1 ++ ++170: /* Short case, less than 31 bytes, so no guarantee of at least one 16-byte block */ ++ teq N, #0 ++ beq 199f ++ preload_all backwards, 1, 0, S, N, DAT2, LAST ++ tst D, #3 ++ beq 174f ++172: subs N, N, #1 ++ blo 199f ++ .if backwards ++ ldrb DAT0, [S, #-1]! ++ strb DAT0, [D, #-1]! ++ .else ++ ldrb DAT0, [S], #1 ++ strb DAT0, [D], #1 ++ .endif ++ tst D, #3 ++ bne 172b ++174: /* Destination now 4-byte aligned; we have 0 or more output bytes to go */ ++ tst S, #3 ++ bne 140f ++ memcpy_short_inner_loop backwards, 0 ++140: memcpy_short_inner_loop backwards, 1 ++ ++ .cfi_endproc ++ ++ .unreq D ++ .unreq S ++ .unreq N ++ .unreq DAT0 ++ .unreq DAT1 ++ .unreq DAT2 ++ .unreq DAT3 ++ .unreq DAT4 ++ .unreq DAT5 ++ .unreq DAT6 ++ .unreq DAT7 ++ .unreq LAST ++ .unreq OFF ++.endm +diff --git a/arch/arm/lib/memmove_rpi.S b/arch/arm/lib/memmove_rpi.S +new file mode 100644 +index 0000000..8b0760c +--- /dev/null ++++ b/arch/arm/lib/memmove_rpi.S +@@ -0,0 +1,61 @@ ++/* ++Copyright (c) 2013, Raspberry Pi Foundation ++Copyright (c) 2013, RISC OS Open Ltd ++All rights reserved. ++ ++Redistribution and use in source and binary forms, with or without ++modification, are permitted provided that the following conditions are met: ++ * Redistributions of source code must retain the above copyright ++ notice, this list of conditions and the following disclaimer. ++ * 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. ++ * Neither the name of the copyright holder nor the ++ names of its contributors may be used to endorse or promote products ++ derived from this software without specific prior written permission. ++ ++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY ++DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ++(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; ++LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ++ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ++(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++*/ ++ ++#include <linux/linkage.h> ++#include "arm-mem.h" ++#include "memcpymove.h" ++ ++/* Prevent the stack from becoming executable */ ++#if defined(__linux__) && defined(__ELF__) ++.section .note.GNU-stack,"",%progbits ++#endif ++ ++ .text ++ .arch armv6 ++ .object_arch armv4 ++ .arm ++ .altmacro ++ .p2align 2 ++ ++/* ++ * void *memmove(void *s1, const void *s2, size_t n); ++ * On entry: ++ * a1 = pointer to destination ++ * a2 = pointer to source ++ * a3 = number of bytes to copy ++ * On exit: ++ * a1 preserved ++ */ ++ ++.set prefetch_distance, 3 ++ ++ENTRY(memmove) ++ cmp a2, a1 ++ bpl memcpy /* pl works even over -1 - 0 and 0x7fffffff - 0x80000000 boundaries */ ++ memcpy 1 ++ENDPROC(memmove) +diff --git a/arch/arm/lib/memset_rpi.S b/arch/arm/lib/memset_rpi.S +new file mode 100644 +index 0000000..7067415 +--- /dev/null ++++ b/arch/arm/lib/memset_rpi.S +@@ -0,0 +1,123 @@ ++/* ++Copyright (c) 2013, Raspberry Pi Foundation ++Copyright (c) 2013, RISC OS Open Ltd ++All rights reserved. ++ ++Redistribution and use in source and binary forms, with or without ++modification, are permitted provided that the following conditions are met: ++ * Redistributions of source code must retain the above copyright ++ notice, this list of conditions and the following disclaimer. ++ * 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. ++ * Neither the name of the copyright holder nor the ++ names of its contributors may be used to endorse or promote products ++ derived from this software without specific prior written permission. ++ ++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY ++DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ++(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; ++LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ++ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ++(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++*/ ++ ++#include <linux/linkage.h> ++#include "arm-mem.h" ++ ++/* Prevent the stack from becoming executable */ ++#if defined(__linux__) && defined(__ELF__) ++.section .note.GNU-stack,"",%progbits ++#endif ++ ++ .text ++ .arch armv6 ++ .object_arch armv4 ++ .arm ++ .altmacro ++ .p2align 2 ++ ++/* ++ * void *memset(void *s, int c, size_t n); ++ * On entry: ++ * a1 = pointer to buffer to fill ++ * a2 = byte pattern to fill with (caller-narrowed) ++ * a3 = number of bytes to fill ++ * On exit: ++ * a1 preserved ++ */ ++ENTRY(mmioset) ++ENTRY(memset) ++ S .req a1 ++ DAT0 .req a2 ++ N .req a3 ++ DAT1 .req a4 ++ DAT2 .req ip ++ DAT3 .req lr ++ ++ orr DAT0, DAT0, lsl #8 ++ push {S, lr} ++ orr DAT0, DAT0, lsl #16 ++ mov DAT1, DAT0 ++ ++ /* See if we're guaranteed to have at least one 16-byte aligned 16-byte write */ ++ cmp N, #31 ++ blo 170f ++ ++161: sub N, N, #16 /* simplifies inner loop termination */ ++ /* Leading words and bytes */ ++ tst S, #15 ++ beq 164f ++ rsb DAT3, S, #0 /* bits 0-3 = number of leading bytes until aligned */ ++ movs DAT2, DAT3, lsl #31 ++ submi N, N, #1 ++ strmib DAT0, [S], #1 ++ subcs N, N, #2 ++ strcsh DAT0, [S], #2 ++ movs DAT2, DAT3, lsl #29 ++ submi N, N, #4 ++ strmi DAT0, [S], #4 ++ subcs N, N, #8 ++ stmcsia S!, {DAT0, DAT1} ++164: /* Delayed set up of DAT2 and DAT3 so we could use them as scratch registers above */ ++ mov DAT2, DAT0 ++ mov DAT3, DAT0 ++ /* Now the inner loop of 16-byte stores */ ++165: stmia S!, {DAT0, DAT1, DAT2, DAT3} ++ subs N, N, #16 ++ bhs 165b ++166: /* Trailing words and bytes */ ++ movs N, N, lsl #29 ++ stmcsia S!, {DAT0, DAT1} ++ strmi DAT0, [S], #4 ++ movs N, N, lsl #2 ++ strcsh DAT0, [S], #2 ++ strmib DAT0, [S] ++199: pop {S, pc} ++ ++170: /* Short case */ ++ mov DAT2, DAT0 ++ mov DAT3, DAT0 ++ tst S, #3 ++ beq 174f ++172: subs N, N, #1 ++ blo 199b ++ strb DAT0, [S], #1 ++ tst S, #3 ++ bne 172b ++174: tst N, #16 ++ stmneia S!, {DAT0, DAT1, DAT2, DAT3} ++ b 166b ++ ++ .unreq S ++ .unreq DAT0 ++ .unreq N ++ .unreq DAT1 ++ .unreq DAT2 ++ .unreq DAT3 ++ENDPROC(memset) ++ENDPROC(mmioset) +diff --git a/arch/arm/lib/uaccess_with_memcpy.c b/arch/arm/lib/uaccess_with_memcpy.c +index 6bd1089..cd17dd1 100644 +--- a/arch/arm/lib/uaccess_with_memcpy.c ++++ b/arch/arm/lib/uaccess_with_memcpy.c +@@ -22,6 +22,14 @@ + #include <asm/current.h> + #include <asm/page.h> + ++#ifndef COPY_FROM_USER_THRESHOLD ++#define COPY_FROM_USER_THRESHOLD 64 ++#endif ++ ++#ifndef COPY_TO_USER_THRESHOLD ++#define COPY_TO_USER_THRESHOLD 64 ++#endif ++ + static int + pin_page_for_write(const void __user *_addr, pte_t **ptep, spinlock_t **ptlp) + { +@@ -84,7 +92,44 @@ pin_page_for_write(const void __user *_addr, pte_t **ptep, spinlock_t **ptlp) + return 1; + } + +-static unsigned long noinline ++static int ++pin_page_for_read(const void __user *_addr, pte_t **ptep, spinlock_t **ptlp) ++{ ++ unsigned long addr = (unsigned long)_addr; ++ pgd_t *pgd; ++ pmd_t *pmd; ++ pte_t *pte; ++ pud_t *pud; ++ spinlock_t *ptl; ++ ++ pgd = pgd_offset(current->mm, addr); ++ if (unlikely(pgd_none(*pgd) || pgd_bad(*pgd))) ++ { ++ return 0; ++ } ++ pud = pud_offset(pgd, addr); ++ if (unlikely(pud_none(*pud) || pud_bad(*pud))) ++ { ++ return 0; ++ } ++ ++ pmd = pmd_offset(pud, addr); ++ if (unlikely(pmd_none(*pmd) || pmd_bad(*pmd))) ++ return 0; ++ ++ pte = pte_offset_map_lock(current->mm, pmd, addr, &ptl); ++ if (unlikely(!pte_present(*pte) || !pte_young(*pte))) { ++ pte_unmap_unlock(pte, ptl); ++ return 0; ++ } ++ ++ *ptep = pte; ++ *ptlp = ptl; ++ ++ return 1; ++} ++ ++unsigned long noinline + __copy_to_user_memcpy(void __user *to, const void *from, unsigned long n) + { + unsigned long ua_flags; +@@ -137,6 +182,57 @@ out: + return n; + } + ++unsigned long noinline ++__copy_from_user_memcpy(void *to, const void __user *from, unsigned long n) ++{ ++ unsigned long ua_flags; ++ int atomic; ++ ++ if (unlikely(segment_eq(get_fs(), KERNEL_DS))) { ++ memcpy(to, (const void *)from, n); ++ return 0; ++ } ++ ++ /* the mmap semaphore is taken only if not in an atomic context */ ++ atomic = in_atomic(); ++ ++ if (!atomic) ++ down_read(&current->mm->mmap_sem); ++ while (n) { ++ pte_t *pte; ++ spinlock_t *ptl; ++ int tocopy; ++ ++ while (!pin_page_for_read(from, &pte, &ptl)) { ++ char temp; ++ if (!atomic) ++ up_read(&current->mm->mmap_sem); ++ if (__get_user(temp, (char __user *)from)) ++ goto out; ++ if (!atomic) ++ down_read(&current->mm->mmap_sem); ++ } ++ ++ tocopy = (~(unsigned long)from & ~PAGE_MASK) + 1; ++ if (tocopy > n) ++ tocopy = n; ++ ++ ua_flags = uaccess_save_and_enable(); ++ memcpy(to, (const void *)from, tocopy); ++ uaccess_restore(ua_flags); ++ to += tocopy; ++ from += tocopy; ++ n -= tocopy; ++ ++ pte_unmap_unlock(pte, ptl); ++ } ++ if (!atomic) ++ up_read(&current->mm->mmap_sem); ++ ++out: ++ return n; ++} ++ + unsigned long + arm_copy_to_user(void __user *to, const void *from, unsigned long n) + { +@@ -147,7 +243,7 @@ arm_copy_to_user(void __user *to, const void *from, unsigned long n) + * With frame pointer disabled, tail call optimization kicks in + * as well making this test almost invisible. + */ +- if (n < 64) { ++ if (n < COPY_TO_USER_THRESHOLD) { + unsigned long ua_flags = uaccess_save_and_enable(); + n = __copy_to_user_std(to, from, n); + uaccess_restore(ua_flags); +@@ -156,6 +252,26 @@ arm_copy_to_user(void __user *to, const void *from, unsigned long n) + } + return n; + } ++ ++unsigned long __must_check ++arm_copy_from_user(void *to, const void __user *from, unsigned long n) ++{ ++ /* ++ * This test is stubbed out of the main function above to keep ++ * the overhead for small copies low by avoiding a large ++ * register dump on the stack just to reload them right away. ++ * With frame pointer disabled, tail call optimization kicks in ++ * as well making this test almost invisible. ++ */ ++ if (n < COPY_TO_USER_THRESHOLD) { ++ unsigned long ua_flags = uaccess_save_and_enable(); ++ n = __copy_from_user_std(to, from, n); ++ uaccess_restore(ua_flags); ++ } else { ++ n = __copy_from_user_memcpy(to, from, n); ++ } ++ return n; ++} + + static unsigned long noinline + __clear_user_memset(void __user *addr, unsigned long n) + +From d67c5533e1929885c312599acdf853138761f6ed Mon Sep 17 00:00:00 2001 +From: Phil Elwell <phil@raspberrypi.org> +Date: Thu, 25 Jun 2015 12:16:11 +0100 +Subject: [PATCH 080/112] gpio-poweroff: Allow it to work on Raspberry Pi + +The Raspberry Pi firmware manages the power-down and reboot +process. To do this it installs a pm_power_off handler, causing +the gpio-poweroff module to abort the probe function. + +This patch introduces a "force" DT property that overrides that +behaviour, and also adds a DT overlay to enable and control it. + +Note that running in an active-low configuration (DT parameter +"active_low") requires a custom dt-blob.bin and probably won't +allow a reboot without switching off, so an external inversion +of the trigger signal may be preferable. +--- + drivers/power/reset/gpio-poweroff.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/drivers/power/reset/gpio-poweroff.c b/drivers/power/reset/gpio-poweroff.c +index be3d81f..a030ae9 100644 +--- a/drivers/power/reset/gpio-poweroff.c ++++ b/drivers/power/reset/gpio-poweroff.c +@@ -49,9 +49,11 @@ static int gpio_poweroff_probe(struct platform_device *pdev) + { + bool input = false; + enum gpiod_flags flags; ++ bool force = false; + + /* If a pm_power_off function has already been added, leave it alone */ +- if (pm_power_off != NULL) { ++ force = of_property_read_bool(pdev->dev.of_node, "force"); ++ if (!force && (pm_power_off != NULL)) { + dev_err(&pdev->dev, + "%s: pm_power_off function already registered", + __func__); + +From e72f41d909aa46e9bc234f6f2a6301ef9ef23676 Mon Sep 17 00:00:00 2001 +From: Phil Elwell <pelwell@users.noreply.github.com> +Date: Tue, 14 Jul 2015 14:32:47 +0100 +Subject: [PATCH 081/112] mfd: Add Raspberry Pi Sense HAT core driver + +--- + drivers/input/joystick/Kconfig | 8 + + drivers/input/joystick/Makefile | 1 + + drivers/input/joystick/rpisense-js.c | 153 ++++++++++++++++ + drivers/mfd/Kconfig | 8 + + drivers/mfd/Makefile | 2 + + drivers/mfd/rpisense-core.c | 157 +++++++++++++++++ + drivers/video/fbdev/Kconfig | 13 ++ + drivers/video/fbdev/Makefile | 1 + + drivers/video/fbdev/rpisense-fb.c | 293 +++++++++++++++++++++++++++++++ + include/linux/mfd/rpisense/core.h | 47 +++++ + include/linux/mfd/rpisense/framebuffer.h | 32 ++++ + include/linux/mfd/rpisense/joystick.h | 35 ++++ + 12 files changed, 750 insertions(+) + create mode 100644 drivers/input/joystick/rpisense-js.c + create mode 100644 drivers/mfd/rpisense-core.c + create mode 100644 drivers/video/fbdev/rpisense-fb.c + create mode 100644 include/linux/mfd/rpisense/core.h + create mode 100644 include/linux/mfd/rpisense/framebuffer.h + create mode 100644 include/linux/mfd/rpisense/joystick.h + +diff --git a/drivers/input/joystick/Kconfig b/drivers/input/joystick/Kconfig +index 4215b53..4364d7c 100644 +--- a/drivers/input/joystick/Kconfig ++++ b/drivers/input/joystick/Kconfig +@@ -330,4 +330,12 @@ config JOYSTICK_MAPLE + To compile this as a module choose M here: the module will be called + maplecontrol. + ++config JOYSTICK_RPISENSE ++ tristate "Raspberry Pi Sense HAT joystick" ++ depends on GPIOLIB && INPUT ++ select MFD_RPISENSE_CORE ++ ++ help ++ This is the joystick driver for the Raspberry Pi Sense HAT ++ + endif +diff --git a/drivers/input/joystick/Makefile b/drivers/input/joystick/Makefile +index 92dc0de..1758160 100644 +--- a/drivers/input/joystick/Makefile ++++ b/drivers/input/joystick/Makefile +@@ -32,4 +32,5 @@ obj-$(CONFIG_JOYSTICK_WARRIOR) += warrior.o + obj-$(CONFIG_JOYSTICK_XPAD) += xpad.o + obj-$(CONFIG_JOYSTICK_ZHENHUA) += zhenhua.o + obj-$(CONFIG_JOYSTICK_WALKERA0701) += walkera0701.o ++obj-$(CONFIG_JOYSTICK_RPISENSE) += rpisense-js.o + +diff --git a/drivers/input/joystick/rpisense-js.c b/drivers/input/joystick/rpisense-js.c +new file mode 100644 +index 0000000..6a41676 +--- /dev/null ++++ b/drivers/input/joystick/rpisense-js.c +@@ -0,0 +1,153 @@ ++/* ++ * Raspberry Pi Sense HAT joystick driver ++ * http://raspberrypi.org ++ * ++ * Copyright (C) 2015 Raspberry Pi ++ * ++ * Author: Serge Schneider ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License as published by the ++ * Free Software Foundation; either version 2 of the License, or (at your ++ * option) any later version. ++ * ++ */ ++ ++#include <linux/module.h> ++ ++#include <linux/mfd/rpisense/joystick.h> ++#include <linux/mfd/rpisense/core.h> ++ ++static struct rpisense *rpisense; ++static unsigned char keymap[5] = {KEY_DOWN, KEY_RIGHT, KEY_UP, KEY_ENTER, KEY_LEFT,}; ++ ++static void keys_work_fn(struct work_struct *work) ++{ ++ int i; ++ static s32 prev_keys; ++ struct rpisense_js *rpisense_js = &rpisense->joystick; ++ s32 keys = rpisense_reg_read(rpisense, RPISENSE_KEYS); ++ s32 changes = keys ^ prev_keys; ++ ++ prev_keys = keys; ++ for (i = 0; i < 5; i++) { ++ if (changes & 1) { ++ input_report_key(rpisense_js->keys_dev, ++ keymap[i], keys & 1); ++ } ++ changes >>= 1; ++ keys >>= 1; ++ } ++ input_sync(rpisense_js->keys_dev); ++} ++ ++static irqreturn_t keys_irq_handler(int irq, void *pdev) ++{ ++ struct rpisense_js *rpisense_js = &rpisense->joystick; ++ ++ schedule_work(&rpisense_js->keys_work_s); ++ return IRQ_HANDLED; ++} ++ ++static int rpisense_js_probe(struct platform_device *pdev) ++{ ++ int ret; ++ int i; ++ struct rpisense_js *rpisense_js; ++ ++ rpisense = rpisense_get_dev(); ++ rpisense_js = &rpisense->joystick; ++ ++ INIT_WORK(&rpisense_js->keys_work_s, keys_work_fn); ++ ++ rpisense_js->keys_dev = input_allocate_device(); ++ if (!rpisense_js->keys_dev) { ++ dev_err(&pdev->dev, "Could not allocate input device.\n"); ++ return -ENOMEM; ++ } ++ ++ rpisense_js->keys_dev->evbit[0] = BIT_MASK(EV_KEY); ++ for (i = 0; i < ARRAY_SIZE(keymap); i++) { ++ set_bit(keymap[i], ++ rpisense_js->keys_dev->keybit); ++ } ++ ++ rpisense_js->keys_dev->name = "Raspberry Pi Sense HAT Joystick"; ++ rpisense_js->keys_dev->phys = "rpi-sense-joy/input0"; ++ rpisense_js->keys_dev->id.bustype = BUS_I2C; ++ rpisense_js->keys_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP); ++ rpisense_js->keys_dev->keycode = keymap; ++ rpisense_js->keys_dev->keycodesize = sizeof(unsigned char); ++ rpisense_js->keys_dev->keycodemax = ARRAY_SIZE(keymap); ++ ++ ret = input_register_device(rpisense_js->keys_dev); ++ if (ret) { ++ dev_err(&pdev->dev, "Could not register input device.\n"); ++ goto err_keys_alloc; ++ } ++ ++ ret = gpiod_direction_input(rpisense_js->keys_desc); ++ if (ret) { ++ dev_err(&pdev->dev, "Could not set keys-int direction.\n"); ++ goto err_keys_reg; ++ } ++ ++ rpisense_js->keys_irq = gpiod_to_irq(rpisense_js->keys_desc); ++ if (rpisense_js->keys_irq < 0) { ++ dev_err(&pdev->dev, "Could not determine keys-int IRQ.\n"); ++ ret = rpisense_js->keys_irq; ++ goto err_keys_reg; ++ } ++ ++ ret = devm_request_irq(&pdev->dev, rpisense_js->keys_irq, ++ keys_irq_handler, IRQF_TRIGGER_RISING, ++ "keys", &pdev->dev); ++ if (ret) { ++ dev_err(&pdev->dev, "IRQ request failed.\n"); ++ goto err_keys_reg; ++ } ++ return 0; ++err_keys_reg: ++ input_unregister_device(rpisense_js->keys_dev); ++err_keys_alloc: ++ input_free_device(rpisense_js->keys_dev); ++ return ret; ++} ++ ++static int rpisense_js_remove(struct platform_device *pdev) ++{ ++ struct rpisense_js *rpisense_js = &rpisense->joystick; ++ ++ input_unregister_device(rpisense_js->keys_dev); ++ input_free_device(rpisense_js->keys_dev); ++ return 0; ++} ++ ++#ifdef CONFIG_OF ++static const struct of_device_id rpisense_js_id[] = { ++ { .compatible = "rpi,rpi-sense-js" }, ++ { }, ++}; ++MODULE_DEVICE_TABLE(of, rpisense_js_id); ++#endif ++ ++static struct platform_device_id rpisense_js_device_id[] = { ++ { .name = "rpi-sense-js" }, ++ { }, ++}; ++MODULE_DEVICE_TABLE(platform, rpisense_js_device_id); ++ ++static struct platform_driver rpisense_js_driver = { ++ .probe = rpisense_js_probe, ++ .remove = rpisense_js_remove, ++ .driver = { ++ .name = "rpi-sense-js", ++ .owner = THIS_MODULE, ++ }, ++}; ++ ++module_platform_driver(rpisense_js_driver); ++ ++MODULE_DESCRIPTION("Raspberry Pi Sense HAT joystick driver"); ++MODULE_AUTHOR("Serge Schneider <serge@raspberrypi.org>"); ++MODULE_LICENSE("GPL"); +diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig +index eea61e3..d2c3b72 100644 +--- a/drivers/mfd/Kconfig ++++ b/drivers/mfd/Kconfig +@@ -10,6 +10,14 @@ config MFD_CORE + select IRQ_DOMAIN + default n + ++config MFD_RPISENSE_CORE ++ tristate "Raspberry Pi Sense HAT core functions" ++ depends on I2C ++ select MFD_CORE ++ help ++ This is the core driver for the Raspberry Pi Sense HAT. This provides ++ the necessary functions to communicate with the hardware. ++ + config MFD_CS5535 + tristate "AMD CS5535 and CS5536 southbridge core functions" + select MFD_CORE +diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile +index 5eaa6465d..8dc2dde 100644 +--- a/drivers/mfd/Makefile ++++ b/drivers/mfd/Makefile +@@ -203,3 +203,5 @@ intel-soc-pmic-objs := intel_soc_pmic_core.o intel_soc_pmic_crc.o + intel-soc-pmic-$(CONFIG_INTEL_PMC_IPC) += intel_soc_pmic_bxtwc.o + obj-$(CONFIG_INTEL_SOC_PMIC) += intel-soc-pmic.o + obj-$(CONFIG_MFD_MT6397) += mt6397-core.o ++ ++obj-$(CONFIG_MFD_RPISENSE_CORE) += rpisense-core.o +diff --git a/drivers/mfd/rpisense-core.c b/drivers/mfd/rpisense-core.c +new file mode 100644 +index 0000000..eea9312 +--- /dev/null ++++ b/drivers/mfd/rpisense-core.c +@@ -0,0 +1,157 @@ ++/* ++ * Raspberry Pi Sense HAT core driver ++ * http://raspberrypi.org ++ * ++ * Copyright (C) 2015 Raspberry Pi ++ * ++ * Author: Serge Schneider ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License as published by the ++ * Free Software Foundation; either version 2 of the License, or (at your ++ * option) any later version. ++ * ++ * This driver is based on wm8350 implementation. ++ */ ++ ++#include <linux/module.h> ++#include <linux/moduleparam.h> ++#include <linux/err.h> ++#include <linux/init.h> ++#include <linux/i2c.h> ++#include <linux/platform_device.h> ++#include <linux/mfd/rpisense/core.h> ++#include <linux/slab.h> ++ ++static struct rpisense *rpisense; ++ ++static void rpisense_client_dev_register(struct rpisense *rpisense, ++ const char *name, ++ struct platform_device **pdev) ++{ ++ int ret; ++ ++ *pdev = platform_device_alloc(name, -1); ++ if (*pdev == NULL) { ++ dev_err(rpisense->dev, "Failed to allocate %s\n", name); ++ return; ++ } ++ ++ (*pdev)->dev.parent = rpisense->dev; ++ platform_set_drvdata(*pdev, rpisense); ++ ret = platform_device_add(*pdev); ++ if (ret != 0) { ++ dev_err(rpisense->dev, "Failed to register %s: %d\n", ++ name, ret); ++ platform_device_put(*pdev); ++ *pdev = NULL; ++ } ++} ++ ++static int rpisense_probe(struct i2c_client *i2c, ++ const struct i2c_device_id *id) ++{ ++ int ret; ++ struct rpisense_js *rpisense_js; ++ ++ rpisense = devm_kzalloc(&i2c->dev, sizeof(struct rpisense), GFP_KERNEL); ++ if (rpisense == NULL) ++ return -ENOMEM; ++ ++ i2c_set_clientdata(i2c, rpisense); ++ rpisense->dev = &i2c->dev; ++ rpisense->i2c_client = i2c; ++ ++ ret = rpisense_reg_read(rpisense, RPISENSE_WAI); ++ if (ret > 0) { ++ if (ret != 's') ++ return -EINVAL; ++ } else { ++ return ret; ++ } ++ ret = rpisense_reg_read(rpisense, RPISENSE_VER); ++ if (ret < 0) ++ return ret; ++ ++ dev_info(rpisense->dev, ++ "Raspberry Pi Sense HAT firmware version %i\n", ret); ++ ++ rpisense_js = &rpisense->joystick; ++ rpisense_js->keys_desc = devm_gpiod_get(&i2c->dev, ++ "keys-int", GPIOD_IN); ++ if (IS_ERR(rpisense_js->keys_desc)) { ++ dev_warn(&i2c->dev, "Failed to get keys-int descriptor.\n"); ++ rpisense_js->keys_desc = gpio_to_desc(23); ++ if (rpisense_js->keys_desc == NULL) { ++ dev_err(&i2c->dev, "GPIO23 fallback failed.\n"); ++ return PTR_ERR(rpisense_js->keys_desc); ++ } ++ } ++ rpisense_client_dev_register(rpisense, "rpi-sense-js", ++ &(rpisense->joystick.pdev)); ++ rpisense_client_dev_register(rpisense, "rpi-sense-fb", ++ &(rpisense->framebuffer.pdev)); ++ ++ return 0; ++} ++ ++static int rpisense_remove(struct i2c_client *i2c) ++{ ++ struct rpisense *rpisense = i2c_get_clientdata(i2c); ++ ++ platform_device_unregister(rpisense->joystick.pdev); ++ return 0; ++} ++ ++struct rpisense *rpisense_get_dev(void) ++{ ++ return rpisense; ++} ++EXPORT_SYMBOL_GPL(rpisense_get_dev); ++ ++s32 rpisense_reg_read(struct rpisense *rpisense, int reg) ++{ ++ int ret = i2c_smbus_read_byte_data(rpisense->i2c_client, reg); ++ ++ if (ret < 0) ++ dev_err(rpisense->dev, "Read from reg %d failed\n", reg); ++ /* Due to the BCM270x I2C clock stretching bug, some values ++ * may have MSB set. Clear it to avoid incorrect values. ++ * */ ++ return ret & 0x7F; ++} ++EXPORT_SYMBOL_GPL(rpisense_reg_read); ++ ++int rpisense_block_write(struct rpisense *rpisense, const char *buf, int count) ++{ ++ int ret = i2c_master_send(rpisense->i2c_client, buf, count); ++ ++ if (ret < 0) ++ dev_err(rpisense->dev, "Block write failed\n"); ++ return ret; ++} ++EXPORT_SYMBOL_GPL(rpisense_block_write); ++ ++static const struct i2c_device_id rpisense_i2c_id[] = { ++ { "rpi-sense", 0 }, ++ { } ++}; ++MODULE_DEVICE_TABLE(i2c, rpisense_i2c_id); ++ ++ ++static struct i2c_driver rpisense_driver = { ++ .driver = { ++ .name = "rpi-sense", ++ .owner = THIS_MODULE, ++ }, ++ .probe = rpisense_probe, ++ .remove = rpisense_remove, ++ .id_table = rpisense_i2c_id, ++}; ++ ++module_i2c_driver(rpisense_driver); ++ ++MODULE_DESCRIPTION("Raspberry Pi Sense HAT core driver"); ++MODULE_AUTHOR("Serge Schneider <serge@raspberrypi.org>"); ++MODULE_LICENSE("GPL"); ++ +diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig +index ee72c3a..5be1a31 100644 +--- a/drivers/video/fbdev/Kconfig ++++ b/drivers/video/fbdev/Kconfig +@@ -2502,3 +2502,16 @@ config FB_SM712 + This driver is also available as a module. The module will be + called sm712fb. If you want to compile it as a module, say M + here and read <file:Documentation/kbuild/modules.txt>. ++ ++config FB_RPISENSE ++ tristate "Raspberry Pi Sense HAT framebuffer" ++ depends on FB ++ select MFD_RPISENSE_CORE ++ select FB_SYS_FOPS ++ select FB_SYS_FILLRECT ++ select FB_SYS_COPYAREA ++ select FB_SYS_IMAGEBLIT ++ select FB_DEFERRED_IO ++ ++ help ++ This is the framebuffer driver for the Raspberry Pi Sense HAT +diff --git a/drivers/video/fbdev/Makefile b/drivers/video/fbdev/Makefile +index df473d8..474c567 100644 +--- a/drivers/video/fbdev/Makefile ++++ b/drivers/video/fbdev/Makefile +@@ -149,6 +149,7 @@ obj-$(CONFIG_FB_DA8XX) += da8xx-fb.o + obj-$(CONFIG_FB_MXS) += mxsfb.o + obj-$(CONFIG_FB_SSD1307) += ssd1307fb.o + obj-$(CONFIG_FB_SIMPLE) += simplefb.o ++obj-$(CONFIG_FB_RPISENSE) += rpisense-fb.o + + # the test framebuffer is last + obj-$(CONFIG_FB_VIRTUAL) += vfb.o +diff --git a/drivers/video/fbdev/rpisense-fb.c b/drivers/video/fbdev/rpisense-fb.c +new file mode 100644 +index 0000000..26432a5 +--- /dev/null ++++ b/drivers/video/fbdev/rpisense-fb.c +@@ -0,0 +1,293 @@ ++/* ++ * Raspberry Pi Sense HAT framebuffer driver ++ * http://raspberrypi.org ++ * ++ * Copyright (C) 2015 Raspberry Pi ++ * ++ * Author: Serge Schneider ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License as published by the ++ * Free Software Foundation; either version 2 of the License, or (at your ++ * option) any later version. ++ * ++ */ ++ ++#include <linux/module.h> ++#include <linux/kernel.h> ++#include <linux/errno.h> ++#include <linux/string.h> ++#include <linux/mm.h> ++#include <linux/slab.h> ++#include <linux/uaccess.h> ++#include <linux/delay.h> ++#include <linux/fb.h> ++#include <linux/init.h> ++ ++#include <linux/mfd/rpisense/framebuffer.h> ++#include <linux/mfd/rpisense/core.h> ++ ++static bool lowlight; ++module_param(lowlight, bool, 0); ++MODULE_PARM_DESC(lowlight, "Reduce LED matrix brightness to one third"); ++ ++static struct rpisense *rpisense; ++ ++struct rpisense_fb_param { ++ char __iomem *vmem; ++ u8 *vmem_work; ++ u32 vmemsize; ++ u8 *gamma; ++}; ++ ++static u8 gamma_default[32] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, ++ 0x02, 0x02, 0x03, 0x03, 0x04, 0x05, 0x06, 0x07, ++ 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0E, 0x0F, 0x11, ++ 0x12, 0x14, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F,}; ++ ++static u8 gamma_low[32] = {0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, ++ 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, ++ 0x03, 0x03, 0x03, 0x04, 0x04, 0x05, 0x05, 0x06, ++ 0x06, 0x07, 0x07, 0x08, 0x08, 0x09, 0x0A, 0x0A,}; ++ ++static u8 gamma_user[32]; ++ ++static struct rpisense_fb_param rpisense_fb_param = { ++ .vmem = NULL, ++ .vmemsize = 128, ++ .gamma = gamma_default, ++}; ++ ++static struct fb_deferred_io rpisense_fb_defio; ++ ++static struct fb_fix_screeninfo rpisense_fb_fix = { ++ .id = "RPi-Sense FB", ++ .type = FB_TYPE_PACKED_PIXELS, ++ .visual = FB_VISUAL_TRUECOLOR, ++ .xpanstep = 0, ++ .ypanstep = 0, ++ .ywrapstep = 0, ++ .accel = FB_ACCEL_NONE, ++ .line_length = 16, ++}; ++ ++static struct fb_var_screeninfo rpisense_fb_var = { ++ .xres = 8, ++ .yres = 8, ++ .xres_virtual = 8, ++ .yres_virtual = 8, ++ .bits_per_pixel = 16, ++ .red = {11, 5, 0}, ++ .green = {5, 6, 0}, ++ .blue = {0, 5, 0}, ++}; ++ ++static ssize_t rpisense_fb_write(struct fb_info *info, ++ const char __user *buf, size_t count, ++ loff_t *ppos) ++{ ++ ssize_t res = fb_sys_write(info, buf, count, ppos); ++ ++ schedule_delayed_work(&info->deferred_work, rpisense_fb_defio.delay); ++ return res; ++} ++ ++static void rpisense_fb_fillrect(struct fb_info *info, ++ const struct fb_fillrect *rect) ++{ ++ sys_fillrect(info, rect); ++ schedule_delayed_work(&info->deferred_work, rpisense_fb_defio.delay); ++} ++ ++static void rpisense_fb_copyarea(struct fb_info *info, ++ const struct fb_copyarea *area) ++{ ++ sys_copyarea(info, area); ++ schedule_delayed_work(&info->deferred_work, rpisense_fb_defio.delay); ++} ++ ++static void rpisense_fb_imageblit(struct fb_info *info, ++ const struct fb_image *image) ++{ ++ sys_imageblit(info, image); ++ schedule_delayed_work(&info->deferred_work, rpisense_fb_defio.delay); ++} ++ ++static void rpisense_fb_deferred_io(struct fb_info *info, ++ struct list_head *pagelist) ++{ ++ int i; ++ int j; ++ u8 *vmem_work = rpisense_fb_param.vmem_work; ++ u16 *mem = (u16 *)rpisense_fb_param.vmem; ++ u8 *gamma = rpisense_fb_param.gamma; ++ ++ vmem_work[0] = 0; ++ for (j = 0; j < 8; j++) { ++ for (i = 0; i < 8; i++) { ++ vmem_work[(j * 24) + i + 1] = ++ gamma[(mem[(j * 8) + i] >> 11) & 0x1F]; ++ vmem_work[(j * 24) + (i + 8) + 1] = ++ gamma[(mem[(j * 8) + i] >> 6) & 0x1F]; ++ vmem_work[(j * 24) + (i + 16) + 1] = ++ gamma[(mem[(j * 8) + i]) & 0x1F]; ++ } ++ } ++ rpisense_block_write(rpisense, vmem_work, 193); ++} ++ ++static struct fb_deferred_io rpisense_fb_defio = { ++ .delay = HZ/100, ++ .deferred_io = rpisense_fb_deferred_io, ++}; ++ ++static int rpisense_fb_ioctl(struct fb_info *info, unsigned int cmd, ++ unsigned long arg) ++{ ++ switch (cmd) { ++ case SENSEFB_FBIOGET_GAMMA: ++ if (copy_to_user((void __user *) arg, rpisense_fb_param.gamma, ++ sizeof(u8[32]))) ++ return -EFAULT; ++ return 0; ++ case SENSEFB_FBIOSET_GAMMA: ++ if (copy_from_user(gamma_user, (void __user *)arg, ++ sizeof(u8[32]))) ++ return -EFAULT; ++ rpisense_fb_param.gamma = gamma_user; ++ schedule_delayed_work(&info->deferred_work, ++ rpisense_fb_defio.delay); ++ return 0; ++ case SENSEFB_FBIORESET_GAMMA: ++ switch (arg) { ++ case 0: ++ rpisense_fb_param.gamma = gamma_default; ++ break; ++ case 1: ++ rpisense_fb_param.gamma = gamma_low; ++ break; ++ case 2: ++ rpisense_fb_param.gamma = gamma_user; ++ break; ++ default: ++ return -EINVAL; ++ } ++ schedule_delayed_work(&info->deferred_work, ++ rpisense_fb_defio.delay); ++ break; ++ default: ++ return -EINVAL; ++ } ++ return 0; ++} ++ ++static struct fb_ops rpisense_fb_ops = { ++ .owner = THIS_MODULE, ++ .fb_read = fb_sys_read, ++ .fb_write = rpisense_fb_write, ++ .fb_fillrect = rpisense_fb_fillrect, ++ .fb_copyarea = rpisense_fb_copyarea, ++ .fb_imageblit = rpisense_fb_imageblit, ++ .fb_ioctl = rpisense_fb_ioctl, ++}; ++ ++static int rpisense_fb_probe(struct platform_device *pdev) ++{ ++ struct fb_info *info; ++ int ret = -ENOMEM; ++ struct rpisense_fb *rpisense_fb; ++ ++ rpisense = rpisense_get_dev(); ++ rpisense_fb = &rpisense->framebuffer; ++ ++ rpisense_fb_param.vmem = vzalloc(rpisense_fb_param.vmemsize); ++ if (!rpisense_fb_param.vmem) ++ return ret; ++ ++ rpisense_fb_param.vmem_work = devm_kmalloc(&pdev->dev, 193, GFP_KERNEL); ++ if (!rpisense_fb_param.vmem_work) ++ goto err_malloc; ++ ++ info = framebuffer_alloc(0, &pdev->dev); ++ if (!info) { ++ dev_err(&pdev->dev, "Could not allocate framebuffer.\n"); ++ goto err_malloc; ++ } ++ rpisense_fb->info = info; ++ ++ rpisense_fb_fix.smem_start = (unsigned long)rpisense_fb_param.vmem; ++ rpisense_fb_fix.smem_len = rpisense_fb_param.vmemsize; ++ ++ info->fbops = &rpisense_fb_ops; ++ info->fix = rpisense_fb_fix; ++ info->var = rpisense_fb_var; ++ info->fbdefio = &rpisense_fb_defio; ++ info->flags = FBINFO_FLAG_DEFAULT | FBINFO_VIRTFB; ++ info->screen_base = rpisense_fb_param.vmem; ++ info->screen_size = rpisense_fb_param.vmemsize; ++ ++ if (lowlight) ++ rpisense_fb_param.gamma = gamma_low; ++ ++ fb_deferred_io_init(info); ++ ++ ret = register_framebuffer(info); ++ if (ret < 0) { ++ dev_err(&pdev->dev, "Could not register framebuffer.\n"); ++ goto err_fballoc; ++ } ++ ++ fb_info(info, "%s frame buffer device\n", info->fix.id); ++ schedule_delayed_work(&info->deferred_work, rpisense_fb_defio.delay); ++ return 0; ++err_fballoc: ++ framebuffer_release(info); ++err_malloc: ++ vfree(rpisense_fb_param.vmem); ++ return ret; ++} ++ ++static int rpisense_fb_remove(struct platform_device *pdev) ++{ ++ struct rpisense_fb *rpisense_fb = &rpisense->framebuffer; ++ struct fb_info *info = rpisense_fb->info; ++ ++ if (info) { ++ unregister_framebuffer(info); ++ fb_deferred_io_cleanup(info); ++ framebuffer_release(info); ++ vfree(rpisense_fb_param.vmem); ++ } ++ ++ return 0; ++} ++ ++#ifdef CONFIG_OF ++static const struct of_device_id rpisense_fb_id[] = { ++ { .compatible = "rpi,rpi-sense-fb" }, ++ { }, ++}; ++MODULE_DEVICE_TABLE(of, rpisense_fb_id); ++#endif ++ ++static struct platform_device_id rpisense_fb_device_id[] = { ++ { .name = "rpi-sense-fb" }, ++ { }, ++}; ++MODULE_DEVICE_TABLE(platform, rpisense_fb_device_id); ++ ++static struct platform_driver rpisense_fb_driver = { ++ .probe = rpisense_fb_probe, ++ .remove = rpisense_fb_remove, ++ .driver = { ++ .name = "rpi-sense-fb", ++ .owner = THIS_MODULE, ++ }, ++}; ++ ++module_platform_driver(rpisense_fb_driver); ++ ++MODULE_DESCRIPTION("Raspberry Pi Sense HAT framebuffer driver"); ++MODULE_AUTHOR("Serge Schneider <serge@raspberrypi.org>"); ++MODULE_LICENSE("GPL"); ++ +diff --git a/include/linux/mfd/rpisense/core.h b/include/linux/mfd/rpisense/core.h +new file mode 100644 +index 0000000..4856aa3 +--- /dev/null ++++ b/include/linux/mfd/rpisense/core.h +@@ -0,0 +1,47 @@ ++/* ++ * Raspberry Pi Sense HAT core driver ++ * http://raspberrypi.org ++ * ++ * Copyright (C) 2015 Raspberry Pi ++ * ++ * Author: Serge Schneider ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License as published by the ++ * Free Software Foundation; either version 2 of the License, or (at your ++ * option) any later version. ++ * ++ */ ++ ++#ifndef __LINUX_MFD_RPISENSE_CORE_H_ ++#define __LINUX_MFD_RPISENSE_CORE_H_ ++ ++#include <linux/mfd/rpisense/joystick.h> ++#include <linux/mfd/rpisense/framebuffer.h> ++ ++/* ++ * Register values. ++ */ ++#define RPISENSE_FB 0x00 ++#define RPISENSE_WAI 0xF0 ++#define RPISENSE_VER 0xF1 ++#define RPISENSE_KEYS 0xF2 ++#define RPISENSE_EE_WP 0xF3 ++ ++#define RPISENSE_ID 's' ++ ++struct rpisense { ++ struct device *dev; ++ struct i2c_client *i2c_client; ++ ++ /* Client devices */ ++ struct rpisense_js joystick; ++ struct rpisense_fb framebuffer; ++}; ++ ++struct rpisense *rpisense_get_dev(void); ++s32 rpisense_reg_read(struct rpisense *rpisense, int reg); ++int rpisense_reg_write(struct rpisense *rpisense, int reg, u16 val); ++int rpisense_block_write(struct rpisense *rpisense, const char *buf, int count); ++ ++#endif +diff --git a/include/linux/mfd/rpisense/framebuffer.h b/include/linux/mfd/rpisense/framebuffer.h +new file mode 100644 +index 0000000..2ba95d7 +--- /dev/null ++++ b/include/linux/mfd/rpisense/framebuffer.h +@@ -0,0 +1,32 @@ ++/* ++ * Raspberry Pi Sense HAT framebuffer driver ++ * http://raspberrypi.org ++ * ++ * Copyright (C) 2015 Raspberry Pi ++ * ++ * Author: Serge Schneider ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License as published by the ++ * Free Software Foundation; either version 2 of the License, or (at your ++ * option) any later version. ++ * ++ */ ++ ++#ifndef __LINUX_RPISENSE_FB_H_ ++#define __LINUX_RPISENSE_FB_H_ ++ ++#define SENSEFB_FBIO_IOC_MAGIC 0xF1 ++ ++#define SENSEFB_FBIOGET_GAMMA _IO(SENSEFB_FBIO_IOC_MAGIC, 0) ++#define SENSEFB_FBIOSET_GAMMA _IO(SENSEFB_FBIO_IOC_MAGIC, 1) ++#define SENSEFB_FBIORESET_GAMMA _IO(SENSEFB_FBIO_IOC_MAGIC, 2) ++ ++struct rpisense; ++ ++struct rpisense_fb { ++ struct platform_device *pdev; ++ struct fb_info *info; ++}; ++ ++#endif +diff --git a/include/linux/mfd/rpisense/joystick.h b/include/linux/mfd/rpisense/joystick.h +new file mode 100644 +index 0000000..56196dc +--- /dev/null ++++ b/include/linux/mfd/rpisense/joystick.h +@@ -0,0 +1,35 @@ ++/* ++ * Raspberry Pi Sense HAT joystick driver ++ * http://raspberrypi.org ++ * ++ * Copyright (C) 2015 Raspberry Pi ++ * ++ * Author: Serge Schneider ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License as published by the ++ * Free Software Foundation; either version 2 of the License, or (at your ++ * option) any later version. ++ * ++ */ ++ ++#ifndef __LINUX_RPISENSE_JOYSTICK_H_ ++#define __LINUX_RPISENSE_JOYSTICK_H_ ++ ++#include <linux/input.h> ++#include <linux/interrupt.h> ++#include <linux/gpio/consumer.h> ++#include <linux/platform_device.h> ++ ++struct rpisense; ++ ++struct rpisense_js { ++ struct platform_device *pdev; ++ struct input_dev *keys_dev; ++ struct gpio_desc *keys_desc; ++ struct work_struct keys_work_s; ++ int keys_irq; ++}; ++ ++ ++#endif + +From 4b70a98f86ebee7fe728cc485ce689ea8f842ab6 Mon Sep 17 00:00:00 2001 +From: Jan Grulich <jan@grulich.eu> +Date: Mon, 24 Aug 2015 16:03:47 +0100 +Subject: [PATCH 082/112] RaspiDAC3 support + +Signed-off-by: Jan Grulich <jan@grulich.eu> + +config: fix RaspiDAC Rev.3x dependencies + +Change depends to SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S +like the other I2S soundcard drivers. + +Signed-off-by: Matthias Reichl <hias@horus.com> +--- + sound/soc/bcm/Kconfig | 8 ++ + sound/soc/bcm/Makefile | 2 + + sound/soc/bcm/raspidac3.c | 192 ++++++++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 202 insertions(+) + create mode 100644 sound/soc/bcm/raspidac3.c + +diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig +index 8669a9a..1a3f826 100644 +--- a/sound/soc/bcm/Kconfig ++++ b/sound/soc/bcm/Kconfig +@@ -56,3 +56,11 @@ config SND_BCM2708_SOC_IQAUDIO_DAC + select SND_SOC_PCM512x_I2C + help + Say Y or M if you want to add support for IQaudIO-DAC. ++ ++config SND_BCM2708_SOC_RASPIDAC3 ++ tristate "Support for RaspiDAC Rev.3x" ++ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S ++ select SND_SOC_PCM512x_I2C ++ select SND_SOC_TPA6130A2 ++ help ++ Say Y or M if you want to add support for RaspiDAC Rev.3x. +diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile +index 4f5ab1f..b21e11e 100644 +--- a/sound/soc/bcm/Makefile ++++ b/sound/soc/bcm/Makefile +@@ -11,6 +11,7 @@ snd-soc-hifiberry-amp-objs := hifiberry_amp.o + snd-soc-rpi-dac-objs := rpi-dac.o + snd-soc-rpi-proto-objs := rpi-proto.o + snd-soc-iqaudio-dac-objs := iqaudio-dac.o ++snd-soc-raspidac3-objs := raspidac3.o + + obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o + obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS) += snd-soc-hifiberry-dacplus.o +@@ -19,3 +20,4 @@ obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_AMP) += snd-soc-hifiberry-amp.o + obj-$(CONFIG_SND_BCM2708_SOC_RPI_DAC) += snd-soc-rpi-dac.o + obj-$(CONFIG_SND_BCM2708_SOC_RPI_PROTO) += snd-soc-rpi-proto.o + obj-$(CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC) += snd-soc-iqaudio-dac.o ++obj-$(CONFIG_SND_BCM2708_SOC_RASPIDAC3) += snd-soc-raspidac3.o +diff --git a/sound/soc/bcm/raspidac3.c b/sound/soc/bcm/raspidac3.c +new file mode 100644 +index 0000000..e7422e2 +--- /dev/null ++++ b/sound/soc/bcm/raspidac3.c +@@ -0,0 +1,192 @@ ++/* ++ * ASoC Driver for RaspiDAC v3 ++ * ++ * Author: Jan Grulich <jan@grulich.eu> ++ * Copyright 2015 ++ * based on code by Daniel Matuschek <daniel@hifiberry.com> ++ * based on code by Florian Meier <florian.meier@koalo.de> ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * version 2 as published by the Free Software Foundation. ++ * ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * General Public License for more details. ++ */ ++ ++#include <linux/module.h> ++#include <linux/platform_device.h> ++ ++#include <sound/core.h> ++#include <sound/pcm.h> ++#include <sound/pcm_params.h> ++#include <sound/soc.h> ++#include <sound/jack.h> ++#include <sound/soc-dapm.h> ++ ++#include "../codecs/pcm512x.h" ++#include "../codecs/tpa6130a2.h" ++ ++/* sound card init */ ++static int snd_rpi_raspidac3_init(struct snd_soc_pcm_runtime *rtd) ++{ ++ int ret; ++ struct snd_soc_card *card = rtd->card; ++ struct snd_soc_codec *codec = rtd->codec; ++ snd_soc_update_bits(codec, PCM512x_GPIO_EN, 0x08, 0x08); ++ snd_soc_update_bits(codec, PCM512x_GPIO_OUTPUT_4, 0xf, 0x02); ++ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x08,0x00); ++ ++ ret = snd_soc_limit_volume(card, "Digital Playback Volume", 207); ++ if (ret < 0) ++ dev_warn(card->dev, "Failed to set volume limit: %d\n", ret); ++ else { ++ struct snd_kcontrol *kctl; ++ ++ ret = tpa6130a2_add_controls(codec); ++ if (ret < 0) ++ dev_warn(card->dev, "Failed to add TPA6130A2 controls: %d\n", ++ ret); ++ ret = snd_soc_limit_volume(card, ++ "TPA6130A2 Headphone Playback Volume", ++ 54); ++ if (ret < 0) ++ dev_warn(card->dev, "Failed to set TPA6130A2 volume limit: %d\n", ++ ret); ++ kctl = snd_soc_card_get_kcontrol(card, ++ "TPA6130A2 Headphone Playback Volume"); ++ if (kctl) { ++ strcpy(kctl->id.name, "Headphones Playback Volume"); ++ /* disable the volume dB scale so alsamixer works */ ++ kctl->vd[0].access = SNDRV_CTL_ELEM_ACCESS_READWRITE; ++ } ++ ++ kctl = snd_soc_card_get_kcontrol(card, ++ "TPA6130A2 Headphone Playback Switch"); ++ if (kctl) ++ strcpy(kctl->id.name, "Headphones Playback Switch"); ++ } ++ ++ return 0; ++} ++ ++/* set hw parameters */ ++static int snd_rpi_raspidac3_hw_params(struct snd_pcm_substream *substream, ++ struct snd_pcm_hw_params *params) ++{ ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; ++ ++ unsigned int sample_bits = ++ snd_pcm_format_physical_width(params_format(params)); ++ ++ return snd_soc_dai_set_bclk_ratio(cpu_dai, sample_bits * 2); ++} ++ ++/* startup */ ++static int snd_rpi_raspidac3_startup(struct snd_pcm_substream *substream) { ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_codec *codec = rtd->codec; ++ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x08,0x08); ++ tpa6130a2_stereo_enable(codec, 1); ++ return 0; ++} ++ ++/* shutdown */ ++static void snd_rpi_raspidac3_shutdown(struct snd_pcm_substream *substream) { ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_codec *codec = rtd->codec; ++ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x08,0x00); ++ tpa6130a2_stereo_enable(codec, 0); ++} ++ ++/* machine stream operations */ ++static struct snd_soc_ops snd_rpi_raspidac3_ops = { ++ .hw_params = snd_rpi_raspidac3_hw_params, ++ .startup = snd_rpi_raspidac3_startup, ++ .shutdown = snd_rpi_raspidac3_shutdown, ++}; ++ ++/* interface setup */ ++static struct snd_soc_dai_link snd_rpi_raspidac3_dai[] = { ++{ ++ .name = "RaspiDAC Rev.3x", ++ .stream_name = "RaspiDAC HiFi", ++ .cpu_dai_name = "bcm2708-i2s.0", ++ .codec_dai_name = "pcm512x-hifi", ++ .platform_name = "bcm2708-i2s.0", ++ .codec_name = "pcm512x.1-004c", ++ .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | ++ SND_SOC_DAIFMT_CBS_CFS, ++ .ops = &snd_rpi_raspidac3_ops, ++ .init = snd_rpi_raspidac3_init, ++}, ++}; ++ ++/* audio machine driver */ ++static struct snd_soc_card snd_rpi_raspidac3 = { ++ .name = "RaspiDAC Rev.3x HiFi Audio Card", ++ .owner = THIS_MODULE, ++ .dai_link = snd_rpi_raspidac3_dai, ++ .num_links = ARRAY_SIZE(snd_rpi_raspidac3_dai), ++}; ++ ++/* sound card test */ ++static int snd_rpi_raspidac3_probe(struct platform_device *pdev) ++{ ++ int ret = 0; ++ ++ snd_rpi_raspidac3.dev = &pdev->dev; ++ ++ if (pdev->dev.of_node) { ++ struct device_node *i2s_node; ++ struct snd_soc_dai_link *dai = &snd_rpi_raspidac3_dai[0]; ++ i2s_node = of_parse_phandle(pdev->dev.of_node, ++ "i2s-controller", 0); ++ ++ if (i2s_node) { ++ dai->cpu_dai_name = NULL; ++ dai->cpu_of_node = i2s_node; ++ dai->platform_name = NULL; ++ dai->platform_of_node = i2s_node; ++ } ++ } ++ ++ ret = snd_soc_register_card(&snd_rpi_raspidac3); ++ if (ret) ++ dev_err(&pdev->dev, ++ "snd_soc_register_card() failed: %d\n", ret); ++ ++ return ret; ++} ++ ++/* sound card disconnect */ ++static int snd_rpi_raspidac3_remove(struct platform_device *pdev) ++{ ++ return snd_soc_unregister_card(&snd_rpi_raspidac3); ++} ++ ++static const struct of_device_id raspidac3_of_match[] = { ++ { .compatible = "jg,raspidacv3", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, raspidac3_of_match); ++ ++/* sound card platform driver */ ++static struct platform_driver snd_rpi_raspidac3_driver = { ++ .driver = { ++ .name = "snd-rpi-raspidac3", ++ .owner = THIS_MODULE, ++ .of_match_table = raspidac3_of_match, ++ }, ++ .probe = snd_rpi_raspidac3_probe, ++ .remove = snd_rpi_raspidac3_remove, ++}; ++ ++module_platform_driver(snd_rpi_raspidac3_driver); ++ ++MODULE_AUTHOR("Jan Grulich <jan@grulich.eu>"); ++MODULE_DESCRIPTION("ASoC Driver for RaspiDAC Rev.3x"); ++MODULE_LICENSE("GPL v2"); + +From 5d9f6033f4aa5a9c0430dfec7dae4ff5b5fb1d60 Mon Sep 17 00:00:00 2001 +From: Jan Grulich <jan@grulich.eu> +Date: Mon, 24 Aug 2015 16:02:34 +0100 +Subject: [PATCH 083/112] tpa6130a2: Add headphone switch control + +Signed-off-by: Jan Grulich <jan@grulich.eu> +--- + sound/soc/codecs/tpa6130a2.c | 29 ++++++++++++++++++++++++++--- + 1 file changed, 26 insertions(+), 3 deletions(-) + +diff --git a/sound/soc/codecs/tpa6130a2.c b/sound/soc/codecs/tpa6130a2.c +index 11d85c5..3caaa17 100644 +--- a/sound/soc/codecs/tpa6130a2.c ++++ b/sound/soc/codecs/tpa6130a2.c +@@ -4,6 +4,7 @@ + * Copyright (C) Nokia Corporation + * + * Author: Peter Ujfalusi <peter.ujfalusi@ti.com> ++ * Modified: Jan Grulich <jan@grulich.eu> + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License +@@ -52,6 +53,8 @@ struct tpa6130a2_data { + enum tpa_model id; + }; + ++static void tpa6130a2_channel_enable(u8 channel, int enable); ++ + static int tpa6130a2_i2c_read(int reg) + { + struct tpa6130a2_data *data; +@@ -189,7 +192,7 @@ exit: + } + + static int tpa6130a2_get_volsw(struct snd_kcontrol *kcontrol, +- struct snd_ctl_elem_value *ucontrol) ++ struct snd_ctl_elem_value *ucontrol) + { + struct soc_mixer_control *mc = + (struct soc_mixer_control *)kcontrol->private_value; +@@ -218,7 +221,7 @@ static int tpa6130a2_get_volsw(struct snd_kcontrol *kcontrol, + } + + static int tpa6130a2_put_volsw(struct snd_kcontrol *kcontrol, +- struct snd_ctl_elem_value *ucontrol) ++ struct snd_ctl_elem_value *ucontrol) + { + struct soc_mixer_control *mc = + (struct soc_mixer_control *)kcontrol->private_value; +@@ -255,8 +258,22 @@ static int tpa6130a2_put_volsw(struct snd_kcontrol *kcontrol, + return 1; + } + ++static int tpa6130a2_put_hp_sw(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol) ++{ ++ int enable = ucontrol->value.integer.value[0]; ++ unsigned int state; ++ ++ state = (tpa6130a2_read(TPA6130A2_REG_VOL_MUTE) & 0x80) == 0; ++ if (state == enable) ++ return 0; /* No change */ ++ ++ tpa6130a2_channel_enable(TPA6130A2_HP_EN_R | TPA6130A2_HP_EN_L, enable); ++ return 1; /* Changed */ ++} ++ + /* +- * TPA6130 volume. From -59.5 to 4 dB with increasing step size when going ++ * TPA6130 volume. From -59.5 to +4.0 dB with increasing step size when going + * down in gain. + */ + static const DECLARE_TLV_DB_RANGE(tpa6130_tlv, +@@ -277,6 +294,9 @@ static const struct snd_kcontrol_new tpa6130a2_controls[] = { + TPA6130A2_REG_VOL_MUTE, 0, 0x3f, 0, + tpa6130a2_get_volsw, tpa6130a2_put_volsw, + tpa6130_tlv), ++ SOC_SINGLE_EXT("TPA6130A2 Headphone Playback Switch", ++ TPA6130A2_REG_VOL_MUTE, 7, 1, 1, ++ tpa6130a2_get_volsw, tpa6130a2_put_hp_sw), + }; + + static const DECLARE_TLV_DB_RANGE(tpa6140_tlv, +@@ -290,6 +310,9 @@ static const struct snd_kcontrol_new tpa6140a2_controls[] = { + TPA6130A2_REG_VOL_MUTE, 1, 0x1f, 0, + tpa6130a2_get_volsw, tpa6130a2_put_volsw, + tpa6140_tlv), ++ SOC_SINGLE_EXT("TPA6140A2 Headphone Playback Switch", ++ TPA6130A2_REG_VOL_MUTE, 7, 1, 1, ++ tpa6130a2_get_volsw, tpa6130a2_put_hp_sw), + }; + + /* + +From 5859bcaed12501a27b5ac8adb573eccb739bbc7e Mon Sep 17 00:00:00 2001 +From: P33M <P33M@github.com> +Date: Wed, 21 Oct 2015 14:55:21 +0100 +Subject: [PATCH 084/112] rpi_display: add backlight driver and overlay + +Add a mailbox-driven backlight controller for the Raspberry Pi DSI +touchscreen display. Requires updated GPU firmware to recognise the +mailbox request. + +Signed-off-by: Gordon Hollingworth <gordon@raspberrypi.org> +--- + drivers/video/backlight/Kconfig | 6 ++ + drivers/video/backlight/Makefile | 1 + + drivers/video/backlight/rpi_backlight.c | 119 ++++++++++++++++++++++++++++++++ + 3 files changed, 126 insertions(+) + create mode 100644 drivers/video/backlight/rpi_backlight.c + +diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig +index 5ffa4b4..c3023ab 100644 +--- a/drivers/video/backlight/Kconfig ++++ b/drivers/video/backlight/Kconfig +@@ -265,6 +265,12 @@ config BACKLIGHT_PWM + If you have a LCD backlight adjustable by PWM, say Y to enable + this driver. + ++config BACKLIGHT_RPI ++ tristate "Raspberry Pi display firmware driven backlight" ++ help ++ If you have the Raspberry Pi DSI touchscreen display, say Y to ++ enable the mailbox-controlled backlight driver. ++ + config BACKLIGHT_DA903X + tristate "Backlight Driver for DA9030/DA9034 using WLED" + depends on PMIC_DA903X +diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile +index 16ec534..00eff87 100644 +--- a/drivers/video/backlight/Makefile ++++ b/drivers/video/backlight/Makefile +@@ -50,6 +50,7 @@ obj-$(CONFIG_BACKLIGHT_PANDORA) += pandora_bl.o + obj-$(CONFIG_BACKLIGHT_PCF50633) += pcf50633-backlight.o + obj-$(CONFIG_BACKLIGHT_PM8941_WLED) += pm8941-wled.o + obj-$(CONFIG_BACKLIGHT_PWM) += pwm_bl.o ++obj-$(CONFIG_BACKLIGHT_RPI) += rpi_backlight.o + obj-$(CONFIG_BACKLIGHT_SAHARA) += kb3886_bl.o + obj-$(CONFIG_BACKLIGHT_SKY81452) += sky81452-backlight.o + obj-$(CONFIG_BACKLIGHT_TOSA) += tosa_bl.o +diff --git a/drivers/video/backlight/rpi_backlight.c b/drivers/video/backlight/rpi_backlight.c +new file mode 100644 +index 0000000..14a0d9b +--- /dev/null ++++ b/drivers/video/backlight/rpi_backlight.c +@@ -0,0 +1,119 @@ ++/* ++ * rpi_bl.c - Backlight controller through VPU ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 as ++ * published by the Free Software Foundation. ++ */ ++ ++#include <linux/backlight.h> ++#include <linux/err.h> ++#include <linux/fb.h> ++#include <linux/gpio.h> ++#include <linux/init.h> ++#include <linux/kernel.h> ++#include <linux/module.h> ++#include <linux/of.h> ++#include <linux/of_gpio.h> ++#include <linux/platform_device.h> ++#include <linux/slab.h> ++#include <soc/bcm2835/raspberrypi-firmware.h> ++ ++struct rpi_backlight { ++ struct device *dev; ++ struct device *fbdev; ++ struct rpi_firmware *fw; ++}; ++ ++static int rpi_backlight_update_status(struct backlight_device *bl) ++{ ++ struct rpi_backlight *gbl = bl_get_data(bl); ++ int brightness = bl->props.brightness; ++ int ret; ++ ++ if (bl->props.power != FB_BLANK_UNBLANK || ++ bl->props.fb_blank != FB_BLANK_UNBLANK || ++ bl->props.state & (BL_CORE_SUSPENDED | BL_CORE_FBBLANK)) ++ brightness = 0; ++ ++ ret = rpi_firmware_property(gbl->fw, ++ RPI_FIRMWARE_FRAMEBUFFER_SET_BACKLIGHT, ++ &brightness, sizeof(brightness)); ++ if (ret) { ++ dev_err(gbl->dev, "Failed to set brightness\n"); ++ return ret; ++ } ++ ++ if (brightness < 0) { ++ dev_err(gbl->dev, "Backlight change failed\n"); ++ return -EAGAIN; ++ } ++ ++ return 0; ++} ++ ++static const struct backlight_ops rpi_backlight_ops = { ++ .options = BL_CORE_SUSPENDRESUME, ++ .update_status = rpi_backlight_update_status, ++}; ++ ++static int rpi_backlight_probe(struct platform_device *pdev) ++{ ++ struct backlight_properties props; ++ struct backlight_device *bl; ++ struct rpi_backlight *gbl; ++ struct device_node *fw_node; ++ ++ gbl = devm_kzalloc(&pdev->dev, sizeof(*gbl), GFP_KERNEL); ++ if (gbl == NULL) ++ return -ENOMEM; ++ ++ gbl->dev = &pdev->dev; ++ ++ fw_node = of_parse_phandle(pdev->dev.of_node, "firmware", 0); ++ if (!fw_node) { ++ dev_err(&pdev->dev, "Missing firmware node\n"); ++ return -ENOENT; ++ } ++ ++ gbl->fw = rpi_firmware_get(fw_node); ++ if (!gbl->fw) ++ return -EPROBE_DEFER; ++ ++ memset(&props, 0, sizeof(props)); ++ props.type = BACKLIGHT_RAW; ++ props.max_brightness = 255; ++ bl = devm_backlight_device_register(&pdev->dev, dev_name(&pdev->dev), ++ &pdev->dev, gbl, &rpi_backlight_ops, ++ &props); ++ if (IS_ERR(bl)) { ++ dev_err(&pdev->dev, "failed to register backlight\n"); ++ return PTR_ERR(bl); ++ } ++ ++ bl->props.brightness = 255; ++ backlight_update_status(bl); ++ ++ platform_set_drvdata(pdev, bl); ++ return 0; ++} ++ ++static const struct of_device_id rpi_backlight_of_match[] = { ++ { .compatible = "raspberrypi,rpi-backlight" }, ++ { /* sentinel */ } ++}; ++MODULE_DEVICE_TABLE(of, rpi_backlight_of_match); ++ ++static struct platform_driver rpi_backlight_driver = { ++ .driver = { ++ .name = "rpi-backlight", ++ .of_match_table = of_match_ptr(rpi_backlight_of_match), ++ }, ++ .probe = rpi_backlight_probe, ++}; ++ ++module_platform_driver(rpi_backlight_driver); ++ ++MODULE_AUTHOR("Gordon Hollingworth <gordon@raspberrypi.org>"); ++MODULE_DESCRIPTION("Raspberry Pi mailbox based Backlight Driver"); ++MODULE_LICENSE("GPL"); + +From 8b5f29a6c47607b328c57a67aca43a9f46f779c6 Mon Sep 17 00:00:00 2001 +From: popcornmix <popcornmix@gmail.com> +Date: Tue, 23 Feb 2016 19:56:04 +0000 +Subject: [PATCH 085/112] bcm2835-virtgpio: Virtual GPIO driver + +Add a virtual GPIO driver that uses the firmware mailbox interface to +request that the VPU toggles LEDs. +--- + drivers/gpio/Kconfig | 6 ++ + drivers/gpio/Makefile | 1 + + drivers/gpio/gpio-bcm-virt.c | 179 +++++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 186 insertions(+) + create mode 100644 drivers/gpio/gpio-bcm-virt.c + +diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig +index 5f3429f..86cb971 100644 +--- a/drivers/gpio/Kconfig ++++ b/drivers/gpio/Kconfig +@@ -142,6 +142,12 @@ config GPIO_BCM_KONA + help + Turn on GPIO support for Broadcom "Kona" chips. + ++config GPIO_BCM_VIRT ++ bool "Broadcom Virt GPIO" ++ depends on OF_GPIO && RASPBERRYPI_FIRMWARE && (ARCH_BCM2835 || ARCH_BCM2708 || ARCH_BCM2709 || COMPILE_TEST) ++ help ++ Turn on virtual GPIO support for Broadcom BCM283X chips. ++ + config GPIO_BRCMSTB + tristate "BRCMSTB GPIO support" + default y if (ARCH_BRCMSTB || BMIPS_GENERIC) +diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile +index 1e0b74f..908596d 100644 +--- a/drivers/gpio/Makefile ++++ b/drivers/gpio/Makefile +@@ -26,6 +26,7 @@ obj-$(CONFIG_GPIO_AMDPT) += gpio-amdpt.o + obj-$(CONFIG_GPIO_ARIZONA) += gpio-arizona.o + obj-$(CONFIG_GPIO_ATH79) += gpio-ath79.o + obj-$(CONFIG_GPIO_BCM_KONA) += gpio-bcm-kona.o ++obj-$(CONFIG_GPIO_BCM_VIRT) += gpio-bcm-virt.o + obj-$(CONFIG_GPIO_BRCMSTB) += gpio-brcmstb.o + obj-$(CONFIG_GPIO_BT8XX) += gpio-bt8xx.o + obj-$(CONFIG_GPIO_CLPS711X) += gpio-clps711x.o +diff --git a/drivers/gpio/gpio-bcm-virt.c b/drivers/gpio/gpio-bcm-virt.c +new file mode 100644 +index 0000000..f3e0f16 +--- /dev/null ++++ b/drivers/gpio/gpio-bcm-virt.c +@@ -0,0 +1,179 @@ ++/* ++ * brcmvirt GPIO driver ++ * ++ * Copyright (C) 2012,2013 Dom Cobley <popcornmix@gmail.com> ++ * Based on gpio-clps711x.c by Alexander Shiyan <shc_work@mail.ru> ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ */ ++ ++#include <linux/err.h> ++#include <linux/gpio.h> ++#include <linux/module.h> ++#include <linux/platform_device.h> ++#include <soc/bcm2835/raspberrypi-firmware.h> ++ ++#define MODULE_NAME "brcmvirt-gpio" ++#define NUM_GPIO 2 ++ ++struct brcmvirt_gpio { ++ struct gpio_chip gc; ++ u32 __iomem *ts_base; ++ /* two packed 16-bit counts of enabled and disables ++ Allows host to detect a brief enable that was missed */ ++ u32 enables_disables[NUM_GPIO]; ++}; ++ ++static int brcmvirt_gpio_dir_in(struct gpio_chip *gc, unsigned off) ++{ ++ struct brcmvirt_gpio *gpio; ++ gpio = container_of(gc, struct brcmvirt_gpio, gc); ++ return -EINVAL; ++} ++ ++static int brcmvirt_gpio_dir_out(struct gpio_chip *gc, unsigned off, int val) ++{ ++ struct brcmvirt_gpio *gpio; ++ gpio = container_of(gc, struct brcmvirt_gpio, gc); ++ return 0; ++} ++ ++static int brcmvirt_gpio_get(struct gpio_chip *gc, unsigned off) ++{ ++ struct brcmvirt_gpio *gpio; ++ unsigned v; ++ gpio = container_of(gc, struct brcmvirt_gpio, gc); ++ v = readl(gpio->ts_base + off); ++ return (v >> off) & 1; ++} ++ ++static void brcmvirt_gpio_set(struct gpio_chip *gc, unsigned off, int val) ++{ ++ struct brcmvirt_gpio *gpio; ++ u16 enables, disables; ++ s16 diff; ++ bool lit; ++ gpio = container_of(gc, struct brcmvirt_gpio, gc); ++ enables = gpio->enables_disables[off] >> 16; ++ disables = gpio->enables_disables[off] >> 0; ++ diff = (s16)(enables - disables); ++ lit = diff > 0; ++ if ((val && lit) || (!val && !lit)) ++ return; ++ if (val) ++ enables++; ++ else ++ disables++; ++ diff = (s16)(enables - disables); ++ BUG_ON(diff != 0 && diff != 1); ++ gpio->enables_disables[off] = (enables << 16) | (disables << 0); ++ writel(gpio->enables_disables[off], gpio->ts_base + off); ++} ++ ++static int brcmvirt_gpio_probe(struct platform_device *pdev) ++{ ++ struct device *dev = &pdev->dev; ++ struct device_node *np = dev->of_node; ++ struct device_node *fw_node; ++ struct rpi_firmware *fw; ++ struct brcmvirt_gpio *ucb; ++ u32 gpiovirtbuf; ++ int err = 0; ++ ++ fw_node = of_parse_phandle(np, "firmware", 0); ++ if (!fw_node) { ++ dev_err(dev, "Missing firmware node\n"); ++ return -ENOENT; ++ } ++ ++ fw = rpi_firmware_get(fw_node); ++ if (!fw) ++ return -EPROBE_DEFER; ++ ++ err = rpi_firmware_property(fw, RPI_FIRMWARE_FRAMEBUFFER_GET_GPIOVIRTBUF, ++ &gpiovirtbuf, sizeof(gpiovirtbuf)); ++ ++ if (err) { ++ dev_err(dev, "Failed to get gpiovirtbuf\n"); ++ goto err; ++ } ++ ++ if (!gpiovirtbuf) { ++ dev_err(dev, "No virtgpio buffer\n"); ++ err = -ENOENT; ++ goto err; ++ } ++ ++ ucb = devm_kzalloc(dev, sizeof *ucb, GFP_KERNEL); ++ if (!ucb) { ++ err = -EINVAL; ++ goto err; ++ } ++ ++ // mmap the physical memory ++ gpiovirtbuf &= ~0xc0000000; ++ ucb->ts_base = ioremap(gpiovirtbuf, 4096); ++ if (ucb->ts_base == NULL) { ++ dev_err(dev, "Failed to map physical address\n"); ++ err = -ENOENT; ++ goto err; ++ } ++ ++ ucb->gc.label = MODULE_NAME; ++ ucb->gc.owner = THIS_MODULE; ++ //ucb->gc.dev = dev; ++ ucb->gc.of_node = np; ++ ucb->gc.base = 100; ++ ucb->gc.ngpio = NUM_GPIO; ++ ++ ucb->gc.direction_input = brcmvirt_gpio_dir_in; ++ ucb->gc.direction_output = brcmvirt_gpio_dir_out; ++ ucb->gc.get = brcmvirt_gpio_get; ++ ucb->gc.set = brcmvirt_gpio_set; ++ ucb->gc.can_sleep = true; ++ ++ err = gpiochip_add(&ucb->gc); ++ if (err) ++ goto err; ++ ++ platform_set_drvdata(pdev, ucb); ++ ++err: ++ return err; ++ ++} ++ ++static int brcmvirt_gpio_remove(struct platform_device *pdev) ++{ ++ int err = 0; ++ struct brcmvirt_gpio *ucb = platform_get_drvdata(pdev); ++ ++ gpiochip_remove(&ucb->gc); ++ iounmap(ucb->ts_base); ++ return err; ++} ++ ++static const struct of_device_id __maybe_unused brcmvirt_gpio_ids[] = { ++ { .compatible = "brcm,bcm2835-virtgpio" }, ++ { } ++}; ++MODULE_DEVICE_TABLE(of, brcmvirt_gpio_ids); ++ ++static struct platform_driver brcmvirt_gpio_driver = { ++ .driver = { ++ .name = MODULE_NAME, ++ .owner = THIS_MODULE, ++ .of_match_table = of_match_ptr(brcmvirt_gpio_ids), ++ }, ++ .probe = brcmvirt_gpio_probe, ++ .remove = brcmvirt_gpio_remove, ++}; ++module_platform_driver(brcmvirt_gpio_driver); ++ ++MODULE_LICENSE("GPL"); ++MODULE_AUTHOR("Dom Cobley <popcornmix@gmail.com>"); ++MODULE_DESCRIPTION("brcmvirt GPIO driver"); ++MODULE_ALIAS("platform:brcmvirt-gpio"); + +From 4af55e5c7890f15b3ee2953fe66a7af6a35fde5d Mon Sep 17 00:00:00 2001 +From: popcornmix <popcornmix@gmail.com> +Date: Fri, 4 Mar 2016 12:49:09 +0000 +Subject: [PATCH 086/112] DRM_VC4: Allow to be built for ARCH_BCM270x + +--- + drivers/gpu/drm/vc4/Kconfig | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/vc4/Kconfig b/drivers/gpu/drm/vc4/Kconfig +index 5848104..870fea5 100644 +--- a/drivers/gpu/drm/vc4/Kconfig ++++ b/drivers/gpu/drm/vc4/Kconfig +@@ -1,6 +1,6 @@ + config DRM_VC4 + tristate "Broadcom VC4 Graphics" +- depends on ARCH_BCM2835 || COMPILE_TEST ++ depends on ARCH_BCM2835 || ARCH_BCM2708 || ARCH_BCM2709 || COMPILE_TEST + depends on DRM + select DRM_KMS_HELPER + select DRM_KMS_CMA_HELPER + +From 98b2c4aae5e4450f7fe526b36cb22d144d394f5b Mon Sep 17 00:00:00 2001 +From: Phil Elwell <phil@raspberrypi.org> +Date: Tue, 23 Feb 2016 17:26:48 +0000 +Subject: [PATCH 087/112] amba_pl011: Don't use DT aliases for numbering + +The pl011 driver looks for DT aliases of the form "serial<n>", +and if found uses <n> as the device ID. This can cause +/dev/ttyAMA0 to become /dev/ttyAMA1, which is confusing if the +other serial port is provided by the 8250 driver which doesn't +use the same logic. +--- + drivers/tty/serial/amba-pl011.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c +index 7c198e0..4f9e97b 100644 +--- a/drivers/tty/serial/amba-pl011.c ++++ b/drivers/tty/serial/amba-pl011.c +@@ -2413,7 +2413,12 @@ static int pl011_setup_port(struct device *dev, struct uart_amba_port *uap, + if (IS_ERR(base)) + return PTR_ERR(base); + ++ /* Don't use DT serial<n> aliases - it causes the device to ++ be renumbered to ttyAMA1 if it is the second serial port in the ++ system, even though the other one is ttyS0. The 8250 driver ++ doesn't use this logic, so always remains ttyS0. + index = pl011_probe_dt_alias(index, dev); ++ */ + + uap->old_cr = 0; + uap->port.dev = dev; + +From 74026743feb7e22a4393a00f227736160e146bb2 Mon Sep 17 00:00:00 2001 +From: Pantelis Antoniou <pantelis.antoniou@konsulko.com> +Date: Wed, 3 Dec 2014 13:23:28 +0200 +Subject: [PATCH 088/112] OF: DT-Overlay configfs interface + +This is a port of Pantelis Antoniou's v3 port that makes use of the +new upstreamed configfs support for binary attributes. + +Original commit message: + +Add a runtime interface to using configfs for generic device tree overlay +usage. With it its possible to use device tree overlays without having +to use a per-platform overlay manager. + +Please see Documentation/devicetree/configfs-overlays.txt for more info. + +Changes since v2: +- Removed ifdef CONFIG_OF_OVERLAY (since for now it's required) +- Created a documentation entry +- Slight rewording in Kconfig + +Changes since v1: +- of_resolve() -> of_resolve_phandles(). + +Originally-signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com> +Signed-off-by: Phil Elwell <phil@raspberrypi.org> + +DT configfs: Fix build errors on other platforms + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> + +DT configfs: fix build error + +There is an error when compiling rpi-4.6.y branch: + CC drivers/of/configfs.o +drivers/of/configfs.c:291:21: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types] + .default_groups = of_cfs_def_groups, + ^ +drivers/of/configfs.c:291:21: note: (near initialization for 'of_cfs_subsys.su_group.default_groups.next') + +The .default_groups is linked list since commit +1ae1602de028acaa42a0f6ff18d19756f8e825c6. +This commit uses configfs_add_default_group to fix this problem. + +Signed-off-by: Slawomir Stepien <sst@poczta.fm> +--- + Documentation/devicetree/configfs-overlays.txt | 31 +++ + drivers/of/Kconfig | 7 + + drivers/of/Makefile | 1 + + drivers/of/configfs.c | 311 +++++++++++++++++++++++++ + 4 files changed, 350 insertions(+) + create mode 100644 Documentation/devicetree/configfs-overlays.txt + create mode 100644 drivers/of/configfs.c + +diff --git a/Documentation/devicetree/configfs-overlays.txt b/Documentation/devicetree/configfs-overlays.txt +new file mode 100644 +index 0000000..5fa43e0 +--- /dev/null ++++ b/Documentation/devicetree/configfs-overlays.txt +@@ -0,0 +1,31 @@ ++Howto use the configfs overlay interface. ++ ++A device-tree configfs entry is created in /config/device-tree/overlays ++and and it is manipulated using standard file system I/O. ++Note that this is a debug level interface, for use by developers and ++not necessarily something accessed by normal users due to the ++security implications of having direct access to the kernel's device tree. ++ ++* To create an overlay you mkdir the directory: ++ ++ # mkdir /config/device-tree/overlays/foo ++ ++* Either you echo the overlay firmware file to the path property file. ++ ++ # echo foo.dtbo >/config/device-tree/overlays/foo/path ++ ++* Or you cat the contents of the overlay to the dtbo file ++ ++ # cat foo.dtbo >/config/device-tree/overlays/foo/dtbo ++ ++The overlay file will be applied, and devices will be created/destroyed ++as required. ++ ++To remove it simply rmdir the directory. ++ ++ # rmdir /config/device-tree/overlays/foo ++ ++The rationalle of the dual interface (firmware & direct copy) is that each is ++better suited to different use patterns. The firmware interface is what's ++intended to be used by hardware managers in the kernel, while the copy interface ++make sense for developers (since it avoids problems with namespaces). +diff --git a/drivers/of/Kconfig b/drivers/of/Kconfig +index e2a4841..7e5e6c4 100644 +--- a/drivers/of/Kconfig ++++ b/drivers/of/Kconfig +@@ -112,4 +112,11 @@ config OF_OVERLAY + While this option is selected automatically when needed, you can + enable it manually to improve device tree unit test coverage. + ++config OF_CONFIGFS ++ bool "Device Tree Overlay ConfigFS interface" ++ select CONFIGFS_FS ++ select OF_OVERLAY ++ help ++ Enable a simple user-space driven DT overlay interface. ++ + endif # OF +diff --git a/drivers/of/Makefile b/drivers/of/Makefile +index 156c072..46c8f57 100644 +--- a/drivers/of/Makefile ++++ b/drivers/of/Makefile +@@ -1,4 +1,5 @@ + obj-y = base.o device.o platform.o ++obj-$(CONFIG_OF_CONFIGFS) += configfs.o + obj-$(CONFIG_OF_DYNAMIC) += dynamic.o + obj-$(CONFIG_OF_FLATTREE) += fdt.o + obj-$(CONFIG_OF_EARLY_FLATTREE) += fdt_address.o +diff --git a/drivers/of/configfs.c b/drivers/of/configfs.c +new file mode 100644 +index 0000000..68f889d +--- /dev/null ++++ b/drivers/of/configfs.c +@@ -0,0 +1,311 @@ ++/* ++ * Configfs entries for device-tree ++ * ++ * Copyright (C) 2013 - Pantelis Antoniou <panto@antoniou-consulting.com> ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * as published by the Free Software Foundation; either version ++ * 2 of the License, or (at your option) any later version. ++ */ ++#include <linux/ctype.h> ++#include <linux/cpu.h> ++#include <linux/module.h> ++#include <linux/of.h> ++#include <linux/of_fdt.h> ++#include <linux/spinlock.h> ++#include <linux/slab.h> ++#include <linux/proc_fs.h> ++#include <linux/configfs.h> ++#include <linux/types.h> ++#include <linux/stat.h> ++#include <linux/limits.h> ++#include <linux/file.h> ++#include <linux/vmalloc.h> ++#include <linux/firmware.h> ++#include <linux/sizes.h> ++ ++#include "of_private.h" ++ ++struct cfs_overlay_item { ++ struct config_item item; ++ ++ char path[PATH_MAX]; ++ ++ const struct firmware *fw; ++ struct device_node *overlay; ++ int ov_id; ++ ++ void *dtbo; ++ int dtbo_size; ++}; ++ ++static int create_overlay(struct cfs_overlay_item *overlay, void *blob) ++{ ++ int err; ++ ++ /* unflatten the tree */ ++ of_fdt_unflatten_tree(blob, &overlay->overlay); ++ if (overlay->overlay == NULL) { ++ pr_err("%s: failed to unflatten tree\n", __func__); ++ err = -EINVAL; ++ goto out_err; ++ } ++ pr_debug("%s: unflattened OK\n", __func__); ++ ++ /* mark it as detached */ ++ of_node_set_flag(overlay->overlay, OF_DETACHED); ++ ++ /* perform resolution */ ++ err = of_resolve_phandles(overlay->overlay); ++ if (err != 0) { ++ pr_err("%s: Failed to resolve tree\n", __func__); ++ goto out_err; ++ } ++ pr_debug("%s: resolved OK\n", __func__); ++ ++ err = of_overlay_create(overlay->overlay); ++ if (err < 0) { ++ pr_err("%s: Failed to create overlay (err=%d)\n", ++ __func__, err); ++ goto out_err; ++ } ++ overlay->ov_id = err; ++ ++out_err: ++ return err; ++} ++ ++static inline struct cfs_overlay_item *to_cfs_overlay_item( ++ struct config_item *item) ++{ ++ return item ? container_of(item, struct cfs_overlay_item, item) : NULL; ++} ++ ++static ssize_t cfs_overlay_item_path_show(struct config_item *item, ++ char *page) ++{ ++ struct cfs_overlay_item *overlay = to_cfs_overlay_item(item); ++ return sprintf(page, "%s\n", overlay->path); ++} ++ ++static ssize_t cfs_overlay_item_path_store(struct config_item *item, ++ const char *page, size_t count) ++{ ++ struct cfs_overlay_item *overlay = to_cfs_overlay_item(item); ++ const char *p = page; ++ char *s; ++ int err; ++ ++ /* if it's set do not allow changes */ ++ if (overlay->path[0] != '\0' || overlay->dtbo_size > 0) ++ return -EPERM; ++ ++ /* copy to path buffer (and make sure it's always zero terminated */ ++ count = snprintf(overlay->path, sizeof(overlay->path) - 1, "%s", p); ++ overlay->path[sizeof(overlay->path) - 1] = '\0'; ++ ++ /* strip trailing newlines */ ++ s = overlay->path + strlen(overlay->path); ++ while (s > overlay->path && *--s == '\n') ++ *s = '\0'; ++ ++ pr_debug("%s: path is '%s'\n", __func__, overlay->path); ++ ++ err = request_firmware(&overlay->fw, overlay->path, NULL); ++ if (err != 0) ++ goto out_err; ++ ++ err = create_overlay(overlay, (void *)overlay->fw->data); ++ if (err != 0) ++ goto out_err; ++ ++ return count; ++ ++out_err: ++ ++ release_firmware(overlay->fw); ++ overlay->fw = NULL; ++ ++ overlay->path[0] = '\0'; ++ return err; ++} ++ ++static ssize_t cfs_overlay_item_status_show(struct config_item *item, ++ char *page) ++{ ++ struct cfs_overlay_item *overlay = to_cfs_overlay_item(item); ++ ++ return sprintf(page, "%s\n", ++ overlay->ov_id >= 0 ? "applied" : "unapplied"); ++} ++ ++CONFIGFS_ATTR(cfs_overlay_item_, path); ++CONFIGFS_ATTR_RO(cfs_overlay_item_, status); ++ ++static struct configfs_attribute *cfs_overlay_attrs[] = { ++ &cfs_overlay_item_attr_path, ++ &cfs_overlay_item_attr_status, ++ NULL, ++}; ++ ++ssize_t cfs_overlay_item_dtbo_read(struct config_item *item, ++ void *buf, size_t max_count) ++{ ++ struct cfs_overlay_item *overlay = to_cfs_overlay_item(item); ++ ++ pr_debug("%s: buf=%p max_count=%zu\n", __func__, ++ buf, max_count); ++ ++ if (overlay->dtbo == NULL) ++ return 0; ++ ++ /* copy if buffer provided */ ++ if (buf != NULL) { ++ /* the buffer must be large enough */ ++ if (overlay->dtbo_size > max_count) ++ return -ENOSPC; ++ ++ memcpy(buf, overlay->dtbo, overlay->dtbo_size); ++ } ++ ++ return overlay->dtbo_size; ++} ++ ++ssize_t cfs_overlay_item_dtbo_write(struct config_item *item, ++ const void *buf, size_t count) ++{ ++ struct cfs_overlay_item *overlay = to_cfs_overlay_item(item); ++ int err; ++ ++ /* if it's set do not allow changes */ ++ if (overlay->path[0] != '\0' || overlay->dtbo_size > 0) ++ return -EPERM; ++ ++ /* copy the contents */ ++ overlay->dtbo = kmemdup(buf, count, GFP_KERNEL); ++ if (overlay->dtbo == NULL) ++ return -ENOMEM; ++ ++ overlay->dtbo_size = count; ++ ++ err = create_overlay(overlay, overlay->dtbo); ++ if (err != 0) ++ goto out_err; ++ ++ return count; ++ ++out_err: ++ kfree(overlay->dtbo); ++ overlay->dtbo = NULL; ++ overlay->dtbo_size = 0; ++ ++ return err; ++} ++ ++CONFIGFS_BIN_ATTR(cfs_overlay_item_, dtbo, NULL, SZ_1M); ++ ++static struct configfs_bin_attribute *cfs_overlay_bin_attrs[] = { ++ &cfs_overlay_item_attr_dtbo, ++ NULL, ++}; ++ ++static void cfs_overlay_release(struct config_item *item) ++{ ++ struct cfs_overlay_item *overlay = to_cfs_overlay_item(item); ++ ++ if (overlay->ov_id >= 0) ++ of_overlay_destroy(overlay->ov_id); ++ if (overlay->fw) ++ release_firmware(overlay->fw); ++ /* kfree with NULL is safe */ ++ kfree(overlay->dtbo); ++ kfree(overlay); ++} ++ ++static struct configfs_item_operations cfs_overlay_item_ops = { ++ .release = cfs_overlay_release, ++}; ++ ++static struct config_item_type cfs_overlay_type = { ++ .ct_item_ops = &cfs_overlay_item_ops, ++ .ct_attrs = cfs_overlay_attrs, ++ .ct_bin_attrs = cfs_overlay_bin_attrs, ++ .ct_owner = THIS_MODULE, ++}; ++ ++static struct config_item *cfs_overlay_group_make_item( ++ struct config_group *group, const char *name) ++{ ++ struct cfs_overlay_item *overlay; ++ ++ overlay = kzalloc(sizeof(*overlay), GFP_KERNEL); ++ if (!overlay) ++ return ERR_PTR(-ENOMEM); ++ overlay->ov_id = -1; ++ ++ config_item_init_type_name(&overlay->item, name, &cfs_overlay_type); ++ return &overlay->item; ++} ++ ++static void cfs_overlay_group_drop_item(struct config_group *group, ++ struct config_item *item) ++{ ++ struct cfs_overlay_item *overlay = to_cfs_overlay_item(item); ++ ++ config_item_put(&overlay->item); ++} ++ ++static struct configfs_group_operations overlays_ops = { ++ .make_item = cfs_overlay_group_make_item, ++ .drop_item = cfs_overlay_group_drop_item, ++}; ++ ++static struct config_item_type overlays_type = { ++ .ct_group_ops = &overlays_ops, ++ .ct_owner = THIS_MODULE, ++}; ++ ++static struct configfs_group_operations of_cfs_ops = { ++ /* empty - we don't allow anything to be created */ ++}; ++ ++static struct config_item_type of_cfs_type = { ++ .ct_group_ops = &of_cfs_ops, ++ .ct_owner = THIS_MODULE, ++}; ++ ++struct config_group of_cfs_overlay_group; ++ ++static struct configfs_subsystem of_cfs_subsys = { ++ .su_group = { ++ .cg_item = { ++ .ci_namebuf = "device-tree", ++ .ci_type = &of_cfs_type, ++ }, ++ }, ++ .su_mutex = __MUTEX_INITIALIZER(of_cfs_subsys.su_mutex), ++}; ++ ++static int __init of_cfs_init(void) ++{ ++ int ret; ++ ++ pr_info("%s\n", __func__); ++ ++ config_group_init(&of_cfs_subsys.su_group); ++ config_group_init_type_name(&of_cfs_overlay_group, "overlays", ++ &overlays_type); ++ configfs_add_default_group(&of_cfs_overlay_group, ++ &of_cfs_subsys.su_group); ++ ++ ret = configfs_register_subsystem(&of_cfs_subsys); ++ if (ret != 0) { ++ pr_err("%s: failed to register subsys\n", __func__); ++ goto out; ++ } ++ pr_info("%s: OK\n", __func__); ++out: ++ return ret; ++} ++late_initcall(of_cfs_init); + +From 84da37731727b20a8b585757ad3b16f09a1d0073 Mon Sep 17 00:00:00 2001 +From: Cheong2K <cheong@redbear.cc> +Date: Fri, 26 Feb 2016 18:20:10 +0800 +Subject: [PATCH 089/112] brcm: adds support for BCM43341 wifi + +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 2 ++ + drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h | 1 + + 2 files changed, 3 insertions(+) + +diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +index 43fd3f4..c3c7c79 100644 +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +@@ -606,6 +606,7 @@ BRCMF_FW_NVRAM_DEF(4329, "brcmfmac4329-sdio.bin", "brcmfmac4329-sdio.txt"); + BRCMF_FW_NVRAM_DEF(4330, "brcmfmac4330-sdio.bin", "brcmfmac4330-sdio.txt"); + BRCMF_FW_NVRAM_DEF(4334, "brcmfmac4334-sdio.bin", "brcmfmac4334-sdio.txt"); + BRCMF_FW_NVRAM_DEF(43340, "brcmfmac43340-sdio.bin", "brcmfmac43340-sdio.txt"); ++BRCMF_FW_NVRAM_DEF(43341, "brcmfmac43341-sdio.bin", "brcmfmac43341-sdio.txt"); + BRCMF_FW_NVRAM_DEF(4335, "brcmfmac4335-sdio.bin", "brcmfmac4335-sdio.txt"); + BRCMF_FW_NVRAM_DEF(43362, "brcmfmac43362-sdio.bin", "brcmfmac43362-sdio.txt"); + BRCMF_FW_NVRAM_DEF(4339, "brcmfmac4339-sdio.bin", "brcmfmac4339-sdio.txt"); +@@ -622,6 +623,7 @@ static struct brcmf_firmware_mapping brcmf_sdio_fwnames[] = { + BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4330_CHIP_ID, 0xFFFFFFFF, 4330), + BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4334_CHIP_ID, 0xFFFFFFFF, 4334), + BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43340_CHIP_ID, 0xFFFFFFFF, 43340), ++ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43341_CHIP_ID, 0xFFFFFFFF, 43341), + BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4335_CHIP_ID, 0xFFFFFFFF, 4335), + BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43362_CHIP_ID, 0xFFFFFFFE, 43362), + BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4339_CHIP_ID, 0xFFFFFFFF, 4339), +diff --git a/drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h b/drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h +index 699f2c2..15598b3 100644 +--- a/drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h ++++ b/drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h +@@ -35,6 +35,7 @@ + #define BRCM_CC_4330_CHIP_ID 0x4330 + #define BRCM_CC_4334_CHIP_ID 0x4334 + #define BRCM_CC_43340_CHIP_ID 43340 ++#define BRCM_CC_43341_CHIP_ID 43341 + #define BRCM_CC_43362_CHIP_ID 43362 + #define BRCM_CC_4335_CHIP_ID 0x4335 + #define BRCM_CC_4339_CHIP_ID 0x4339 + +From 48b27165b0d028e22700c9c760ee28758191e153 Mon Sep 17 00:00:00 2001 +From: Phil Elwell <phil@raspberrypi.org> +Date: Wed, 9 Mar 2016 17:25:59 +0000 +Subject: [PATCH 090/112] brcmfmac: Disable power management + +Disable wireless power saving in the brcmfmac WLAN driver. This is a +temporary measure until the connectivity loss resulting from power +saving is resolved. + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +index d5c2a27..5a08f59 100644 +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +@@ -2623,6 +2623,8 @@ brcmf_cfg80211_set_power_mgmt(struct wiphy *wiphy, struct net_device *ndev, + * preference in cfg struct to apply this to + * FW later while initializing the dongle + */ ++ pr_info("power management disabled\n"); ++ enabled = false; + cfg->pwr_save = enabled; + if (!check_vif_up(ifp->vif)) { + + +From cf6845399aab2b43a579bc613a8c2b2f4cda5920 Mon Sep 17 00:00:00 2001 +From: Phil Elwell <phil@raspberrypi.org> +Date: Thu, 28 Apr 2016 17:13:47 +0100 +Subject: [PATCH 091/112] brcmfmac: Use original country code as a fallback + +Commit 73345fd212980d2e28a5c6d83801c903bd773680: + + brcmfmac: Configure country code using device specific settings + +prevents region codes from working on devices that lack a region code +translation table. In the event of an absent table, preserve the old +behaviour of using the provided code as-is. + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> +--- + .../wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 20 +++++++++++++++----- + 1 file changed, 15 insertions(+), 5 deletions(-) + +diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +index 5a08f59..ceba7b6 100644 +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +@@ -6516,12 +6516,18 @@ static s32 brcmf_translate_country_code(struct brcmf_pub *drvr, char alpha2[2], + struct brcmfmac_pd_cc *country_codes; + struct brcmfmac_pd_cc_entry *cc; + s32 found_index; ++ char ccode[BRCMF_COUNTRY_BUF_SZ]; ++ int rev; + int i; + ++ memcpy(ccode, alpha2, sizeof(ccode)); ++ rev = -1; ++ + country_codes = drvr->settings->country_codes; + if (!country_codes) { +- brcmf_dbg(TRACE, "No country codes configured for device\n"); +- return -EINVAL; ++ brcmf_dbg(TRACE, "No country codes configured for device" ++ " - use requested value\n"); ++ goto use_input_value; + } + + if ((alpha2[0] == ccreq->country_abbrev[0]) && +@@ -6545,10 +6551,14 @@ static s32 brcmf_translate_country_code(struct brcmf_pub *drvr, char alpha2[2], + brcmf_dbg(TRACE, "No country code match found\n"); + return -EINVAL; + } +- memset(ccreq, 0, sizeof(*ccreq)); +- ccreq->rev = cpu_to_le32(country_codes->table[found_index].rev); +- memcpy(ccreq->ccode, country_codes->table[found_index].cc, ++ rev = country_codes->table[found_index].rev; ++ memcpy(ccode, country_codes->table[found_index].cc, + BRCMF_COUNTRY_BUF_SZ); ++ ++use_input_value: ++ memset(ccreq, 0, sizeof(*ccreq)); ++ ccreq->rev = cpu_to_le32(rev); ++ memcpy(ccreq->ccode, ccode, sizeof(ccode)); + ccreq->country_abbrev[0] = alpha2[0]; + ccreq->country_abbrev[1] = alpha2[1]; + ccreq->country_abbrev[2] = 0; + +From 57720f476dafd8ad6d218c75d816df912d572d01 Mon Sep 17 00:00:00 2001 +From: Phil Elwell <phil@raspberrypi.org> +Date: Thu, 19 May 2016 15:36:09 +0100 +Subject: [PATCH 092/112] brcmfmac: Plug memory leak in brcmf_fill_bss_param + +See: https://github.com/raspberrypi/linux/issues/1471 + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +index ceba7b6..afb0154 100644 +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +@@ -2413,7 +2413,7 @@ static void brcmf_fill_bss_param(struct brcmf_if *ifp, struct station_info *si) + WL_BSS_INFO_MAX); + if (err) { + brcmf_err("Failed to get bss info (%d)\n", err); +- return; ++ goto out_err; + } + si->filled |= BIT(NL80211_STA_INFO_BSS_PARAM); + si->bss_param.beacon_interval = le16_to_cpu(buf->bss_le.beacon_period); +@@ -2425,6 +2425,9 @@ static void brcmf_fill_bss_param(struct brcmf_if *ifp, struct station_info *si) + si->bss_param.flags |= BSS_PARAM_FLAGS_SHORT_PREAMBLE; + if (capability & WLAN_CAPABILITY_SHORT_SLOT_TIME) + si->bss_param.flags |= BSS_PARAM_FLAGS_SHORT_SLOT_TIME; ++ ++out_err: ++ kfree(buf); + } + + static s32 + +From b83945eb624ddcfbf5687cbb64b3e502765b8847 Mon Sep 17 00:00:00 2001 +From: Phil Elwell <phil@raspberrypi.org> +Date: Thu, 17 Dec 2015 13:37:07 +0000 +Subject: [PATCH 093/112] hci_h5: Don't send conf_req when ACTIVE + +Without this patch, a modem and kernel can continuously bombard each +other with conf_req and conf_rsp messages, in a demented game of tag. +--- + drivers/bluetooth/hci_h5.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/bluetooth/hci_h5.c b/drivers/bluetooth/hci_h5.c +index 0879d64..5161ab3 100644 +--- a/drivers/bluetooth/hci_h5.c ++++ b/drivers/bluetooth/hci_h5.c +@@ -310,7 +310,8 @@ static void h5_handle_internal_rx(struct hci_uart *hu) + h5_link_control(hu, conf_req, 3); + } else if (memcmp(data, conf_req, 2) == 0) { + h5_link_control(hu, conf_rsp, 2); +- h5_link_control(hu, conf_req, 3); ++ if (h5->state != H5_ACTIVE) ++ h5_link_control(hu, conf_req, 3); + } else if (memcmp(data, conf_rsp, 2) == 0) { + if (H5_HDR_LEN(hdr) > 2) + h5->tx_win = (data[2] & 0x07); + +From b233a26228b7db2f5ce2dcf40cf27c9461661335 Mon Sep 17 00:00:00 2001 +From: Eric Anholt <eric@anholt.net> +Date: Fri, 22 Jan 2016 13:06:39 -0800 +Subject: [PATCH 094/112] drm/vc4: Add a debugfs node for tracking execution + state. + +Signed-off-by: Eric Anholt <eric@anholt.net> +--- + drivers/gpu/drm/vc4/vc4_debugfs.c | 1 + + drivers/gpu/drm/vc4/vc4_drv.h | 1 + + drivers/gpu/drm/vc4/vc4_gem.c | 14 ++++++++++++++ + 3 files changed, 16 insertions(+) + +diff --git a/drivers/gpu/drm/vc4/vc4_debugfs.c b/drivers/gpu/drm/vc4/vc4_debugfs.c +index d76ad10..a99aa86 100644 +--- a/drivers/gpu/drm/vc4/vc4_debugfs.c ++++ b/drivers/gpu/drm/vc4/vc4_debugfs.c +@@ -17,6 +17,7 @@ + + static const struct drm_info_list vc4_debugfs_list[] = { + {"bo_stats", vc4_bo_stats_debugfs, 0}, ++ {"gem_exec", vc4_gem_exec_debugfs, 0}, + {"hdmi_regs", vc4_hdmi_debugfs_regs, 0}, + {"hvs_regs", vc4_hvs_debugfs_regs, 0}, + {"crtc0_regs", vc4_crtc_debugfs_regs, 0, (void *)(uintptr_t)0}, +diff --git a/drivers/gpu/drm/vc4/vc4_drv.h b/drivers/gpu/drm/vc4/vc4_drv.h +index fa2ad15..f092986 100644 +--- a/drivers/gpu/drm/vc4/vc4_drv.h ++++ b/drivers/gpu/drm/vc4/vc4_drv.h +@@ -440,6 +440,7 @@ void vc4_job_handle_completed(struct vc4_dev *vc4); + int vc4_queue_seqno_cb(struct drm_device *dev, + struct vc4_seqno_cb *cb, uint64_t seqno, + void (*func)(struct vc4_seqno_cb *cb)); ++int vc4_gem_exec_debugfs(struct seq_file *m, void *arg); + + /* vc4_hdmi.c */ + extern struct platform_driver vc4_hdmi_driver; +diff --git a/drivers/gpu/drm/vc4/vc4_gem.c b/drivers/gpu/drm/vc4/vc4_gem.c +index 8d4384f..aa4517c 100644 +--- a/drivers/gpu/drm/vc4/vc4_gem.c ++++ b/drivers/gpu/drm/vc4/vc4_gem.c +@@ -32,6 +32,20 @@ + #include "vc4_regs.h" + #include "vc4_trace.h" + ++#ifdef CONFIG_DEBUG_FS ++int vc4_gem_exec_debugfs(struct seq_file *m, void *unused) ++{ ++ struct drm_info_node *node = (struct drm_info_node *)m->private; ++ struct drm_device *dev = node->minor->dev; ++ struct vc4_dev *vc4 = to_vc4_dev(dev); ++ ++ seq_printf(m, "Emitted seqno: 0x%016llx\n", vc4->emit_seqno); ++ seq_printf(m, "Finished seqno: 0x%016llx\n", vc4->finished_seqno); ++ ++ return 0; ++} ++#endif /* CONFIG_DEBUG_FS */ ++ + static void + vc4_queue_hangcheck(struct drm_device *dev) + { + +From 9e309d7f765e380b8e707659ab9ed4b182dc22f6 Mon Sep 17 00:00:00 2001 +From: Eric Anholt <eric@anholt.net> +Date: Mon, 25 Jan 2016 13:03:33 -0800 +Subject: [PATCH 095/112] drm/vc4: Include vc4_drm.h in uapi in downstream + build. + +Signed-off-by: Eric Anholt <eric@anholt.net> +--- + include/uapi/drm/Kbuild | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/include/uapi/drm/Kbuild b/include/uapi/drm/Kbuild +index 9355dd8..68828bf 100644 +--- a/include/uapi/drm/Kbuild ++++ b/include/uapi/drm/Kbuild +@@ -15,6 +15,7 @@ header-y += radeon_drm.h + header-y += savage_drm.h + header-y += sis_drm.h + header-y += tegra_drm.h ++header-y += vc4_drm.h + header-y += via_drm.h + header-y += vmwgfx_drm.h + header-y += msm_drm.h + +From 8ebc53b4f06a2076f30f0ec77153af7dcb5d1edb Mon Sep 17 00:00:00 2001 +From: Phil Elwell <phil@raspberrypi.org> +Date: Wed, 30 Mar 2016 17:23:15 +0100 +Subject: [PATCH 096/112] cpufreq: Temporarily ignore io_is_busy=1 + +To speed testing of the new sdhost driver that adapts to changes in +core_freq, hack the on-demand governor to treat io_is_busy=1 as +io_is_busy=0. The io_is_busy feature can still be forced using +io_is_busy=2. + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> +--- + drivers/cpufreq/cpufreq_ondemand.c | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/drivers/cpufreq/cpufreq_ondemand.c b/drivers/cpufreq/cpufreq_ondemand.c +index acd8027..72c5a4c 100644 +--- a/drivers/cpufreq/cpufreq_ondemand.c ++++ b/drivers/cpufreq/cpufreq_ondemand.c +@@ -216,7 +216,12 @@ static ssize_t store_io_is_busy(struct dbs_data *dbs_data, const char *buf, + ret = sscanf(buf, "%u", &input); + if (ret != 1) + return -EINVAL; +- dbs_data->io_is_busy = !!input; ++ // XXX temporary hack ++ if (input > 1) ++ input = 1; ++ else ++ input = 0; ++ dbs_data->io_is_busy = input; + + /* we need to re-evaluate prev_cpu_idle */ + gov_update_cpu_data(dbs_data); + +From 29509a4b9e47b129d5032bb7c0fdba0a7f9b66b6 Mon Sep 17 00:00:00 2001 +From: popcornmix <popcornmix@gmail.com> +Date: Wed, 27 Apr 2016 16:59:24 +0100 +Subject: [PATCH 097/112] Revert "ASoC: bcm2835: move to use the clock + framework" + +This reverts commit 517e7a1537ae4663268be5d0c0ec62c563b9fc99. +--- + sound/soc/bcm/bcm2835-i2s.c | 284 ++++++++++++++++++++++++++++++++++---------- + 1 file changed, 220 insertions(+), 64 deletions(-) + +diff --git a/sound/soc/bcm/bcm2835-i2s.c b/sound/soc/bcm/bcm2835-i2s.c +index 1c1f221..3303d5f 100644 +--- a/sound/soc/bcm/bcm2835-i2s.c ++++ b/sound/soc/bcm/bcm2835-i2s.c +@@ -37,7 +37,6 @@ + #include <linux/init.h> + #include <linux/io.h> + #include <linux/module.h> +-#include <linux/of_address.h> + #include <linux/slab.h> + + #include <sound/core.h> +@@ -47,6 +46,55 @@ + #include <sound/pcm_params.h> + #include <sound/soc.h> + ++/* Clock registers */ ++#define BCM2835_CLK_PCMCTL_REG 0x00 ++#define BCM2835_CLK_PCMDIV_REG 0x04 ++ ++/* Clock register settings */ ++#define BCM2835_CLK_PASSWD (0x5a000000) ++#define BCM2835_CLK_PASSWD_MASK (0xff000000) ++#define BCM2835_CLK_MASH(v) ((v) << 9) ++#define BCM2835_CLK_FLIP BIT(8) ++#define BCM2835_CLK_BUSY BIT(7) ++#define BCM2835_CLK_KILL BIT(5) ++#define BCM2835_CLK_ENAB BIT(4) ++#define BCM2835_CLK_SRC(v) (v) ++ ++#define BCM2835_CLK_SHIFT (12) ++#define BCM2835_CLK_DIVI(v) ((v) << BCM2835_CLK_SHIFT) ++#define BCM2835_CLK_DIVF(v) (v) ++#define BCM2835_CLK_DIVF_MASK (0xFFF) ++ ++enum { ++ BCM2835_CLK_MASH_0 = 0, ++ BCM2835_CLK_MASH_1, ++ BCM2835_CLK_MASH_2, ++ BCM2835_CLK_MASH_3, ++}; ++ ++enum { ++ BCM2835_CLK_SRC_GND = 0, ++ BCM2835_CLK_SRC_OSC, ++ BCM2835_CLK_SRC_DBG0, ++ BCM2835_CLK_SRC_DBG1, ++ BCM2835_CLK_SRC_PLLA, ++ BCM2835_CLK_SRC_PLLC, ++ BCM2835_CLK_SRC_PLLD, ++ BCM2835_CLK_SRC_HDMI, ++}; ++ ++/* Most clocks are not useable (freq = 0) */ ++static const unsigned int bcm2835_clk_freq[BCM2835_CLK_SRC_HDMI+1] = { ++ [BCM2835_CLK_SRC_GND] = 0, ++ [BCM2835_CLK_SRC_OSC] = 19200000, ++ [BCM2835_CLK_SRC_DBG0] = 0, ++ [BCM2835_CLK_SRC_DBG1] = 0, ++ [BCM2835_CLK_SRC_PLLA] = 0, ++ [BCM2835_CLK_SRC_PLLC] = 0, ++ [BCM2835_CLK_SRC_PLLD] = 500000000, ++ [BCM2835_CLK_SRC_HDMI] = 0, ++}; ++ + /* I2S registers */ + #define BCM2835_I2S_CS_A_REG 0x00 + #define BCM2835_I2S_FIFO_A_REG 0x04 +@@ -110,6 +158,10 @@ + #define BCM2835_I2S_INT_RXR BIT(1) + #define BCM2835_I2S_INT_TXW BIT(0) + ++/* I2S DMA interface */ ++/* FIXME: Needs IOMMU support */ ++#define BCM2835_VCMMU_SHIFT (0x7E000000 - 0x20000000) ++ + /* General device struct */ + struct bcm2835_i2s_dev { + struct device *dev; +@@ -117,23 +169,21 @@ struct bcm2835_i2s_dev { + unsigned int fmt; + unsigned int bclk_ratio; + +- struct regmap *i2s_regmap; +- struct clk *clk; +- bool clk_prepared; ++ struct regmap *i2s_regmap; ++ struct regmap *clk_regmap; + }; + + static void bcm2835_i2s_start_clock(struct bcm2835_i2s_dev *dev) + { ++ /* Start the clock if in master mode */ + unsigned int master = dev->fmt & SND_SOC_DAIFMT_MASTER_MASK; + +- if (dev->clk_prepared) +- return; +- + switch (master) { + case SND_SOC_DAIFMT_CBS_CFS: + case SND_SOC_DAIFMT_CBS_CFM: +- clk_prepare_enable(dev->clk); +- dev->clk_prepared = true; ++ regmap_update_bits(dev->clk_regmap, BCM2835_CLK_PCMCTL_REG, ++ BCM2835_CLK_PASSWD_MASK | BCM2835_CLK_ENAB, ++ BCM2835_CLK_PASSWD | BCM2835_CLK_ENAB); + break; + default: + break; +@@ -142,9 +192,28 @@ static void bcm2835_i2s_start_clock(struct bcm2835_i2s_dev *dev) + + static void bcm2835_i2s_stop_clock(struct bcm2835_i2s_dev *dev) + { +- if (dev->clk_prepared) +- clk_disable_unprepare(dev->clk); +- dev->clk_prepared = false; ++ uint32_t clkreg; ++ int timeout = 1000; ++ ++ /* Stop clock */ ++ regmap_update_bits(dev->clk_regmap, BCM2835_CLK_PCMCTL_REG, ++ BCM2835_CLK_PASSWD_MASK | BCM2835_CLK_ENAB, ++ BCM2835_CLK_PASSWD); ++ ++ /* Wait for the BUSY flag going down */ ++ while (--timeout) { ++ regmap_read(dev->clk_regmap, BCM2835_CLK_PCMCTL_REG, &clkreg); ++ if (!(clkreg & BCM2835_CLK_BUSY)) ++ break; ++ } ++ ++ if (!timeout) { ++ /* KILL the clock */ ++ dev_err(dev->dev, "I2S clock didn't stop. Kill the clock!\n"); ++ regmap_update_bits(dev->clk_regmap, BCM2835_CLK_PCMCTL_REG, ++ BCM2835_CLK_KILL | BCM2835_CLK_PASSWD_MASK, ++ BCM2835_CLK_KILL | BCM2835_CLK_PASSWD); ++ } + } + + static void bcm2835_i2s_clear_fifos(struct bcm2835_i2s_dev *dev, +@@ -154,7 +223,8 @@ static void bcm2835_i2s_clear_fifos(struct bcm2835_i2s_dev *dev, + uint32_t syncval; + uint32_t csreg; + uint32_t i2s_active_state; +- bool clk_was_prepared; ++ uint32_t clkreg; ++ uint32_t clk_active_state; + uint32_t off; + uint32_t clr; + +@@ -168,10 +238,15 @@ static void bcm2835_i2s_clear_fifos(struct bcm2835_i2s_dev *dev, + regmap_read(dev->i2s_regmap, BCM2835_I2S_CS_A_REG, &csreg); + i2s_active_state = csreg & (BCM2835_I2S_RXON | BCM2835_I2S_TXON); + ++ regmap_read(dev->clk_regmap, BCM2835_CLK_PCMCTL_REG, &clkreg); ++ clk_active_state = clkreg & BCM2835_CLK_ENAB; ++ + /* Start clock if not running */ +- clk_was_prepared = dev->clk_prepared; +- if (!clk_was_prepared) +- bcm2835_i2s_start_clock(dev); ++ if (!clk_active_state) { ++ regmap_update_bits(dev->clk_regmap, BCM2835_CLK_PCMCTL_REG, ++ BCM2835_CLK_PASSWD_MASK | BCM2835_CLK_ENAB, ++ BCM2835_CLK_PASSWD | BCM2835_CLK_ENAB); ++ } + + /* Stop I2S module */ + regmap_update_bits(dev->i2s_regmap, BCM2835_I2S_CS_A_REG, off, 0); +@@ -205,7 +280,7 @@ static void bcm2835_i2s_clear_fifos(struct bcm2835_i2s_dev *dev, + dev_err(dev->dev, "I2S SYNC error!\n"); + + /* Stop clock if it was not running before */ +- if (!clk_was_prepared) ++ if (!clk_active_state) + bcm2835_i2s_stop_clock(dev); + + /* Restore I2S state */ +@@ -234,9 +309,19 @@ static int bcm2835_i2s_hw_params(struct snd_pcm_substream *substream, + struct snd_soc_dai *dai) + { + struct bcm2835_i2s_dev *dev = snd_soc_dai_get_drvdata(dai); ++ + unsigned int sampling_rate = params_rate(params); + unsigned int data_length, data_delay, bclk_ratio; + unsigned int ch1pos, ch2pos, mode, format; ++ unsigned int mash = BCM2835_CLK_MASH_1; ++ unsigned int divi, divf, target_frequency; ++ int clk_src = -1; ++ unsigned int master = dev->fmt & SND_SOC_DAIFMT_MASTER_MASK; ++ bool bit_master = (master == SND_SOC_DAIFMT_CBS_CFS ++ || master == SND_SOC_DAIFMT_CBS_CFM); ++ ++ bool frame_master = (master == SND_SOC_DAIFMT_CBS_CFS ++ || master == SND_SOC_DAIFMT_CBM_CFS); + uint32_t csreg; + + /* +@@ -258,9 +343,11 @@ static int bcm2835_i2s_hw_params(struct snd_pcm_substream *substream, + switch (params_format(params)) { + case SNDRV_PCM_FORMAT_S16_LE: + data_length = 16; ++ bclk_ratio = 40; + break; + case SNDRV_PCM_FORMAT_S32_LE: + data_length = 32; ++ bclk_ratio = 80; + break; + default: + return -EINVAL; +@@ -269,12 +356,69 @@ static int bcm2835_i2s_hw_params(struct snd_pcm_substream *substream, + /* If bclk_ratio already set, use that one. */ + if (dev->bclk_ratio) + bclk_ratio = dev->bclk_ratio; +- else +- /* otherwise calculate a fitting block ratio */ +- bclk_ratio = 2 * data_length; + +- /* set target clock rate*/ +- clk_set_rate(dev->clk, sampling_rate * bclk_ratio); ++ /* ++ * Clock Settings ++ * ++ * The target frequency of the bit clock is ++ * sampling rate * frame length ++ * ++ * Integer mode: ++ * Sampling rates that are multiples of 8000 kHz ++ * can be driven by the oscillator of 19.2 MHz ++ * with an integer divider as long as the frame length ++ * is an integer divider of 19200000/8000=2400 as set up above. ++ * This is no longer possible if the sampling rate ++ * is too high (e.g. 192 kHz), because the oscillator is too slow. ++ * ++ * MASH mode: ++ * For all other sampling rates, it is not possible to ++ * have an integer divider. Approximate the clock ++ * with the MASH module that induces a slight frequency ++ * variance. To minimize that it is best to have the fastest ++ * clock here. That is PLLD with 500 MHz. ++ */ ++ target_frequency = sampling_rate * bclk_ratio; ++ clk_src = BCM2835_CLK_SRC_OSC; ++ mash = BCM2835_CLK_MASH_0; ++ ++ if (bcm2835_clk_freq[clk_src] % target_frequency == 0 ++ && bit_master && frame_master) { ++ divi = bcm2835_clk_freq[clk_src] / target_frequency; ++ divf = 0; ++ } else { ++ uint64_t dividend; ++ ++ if (!dev->bclk_ratio) { ++ /* ++ * Overwrite bclk_ratio, because the ++ * above trick is not needed or can ++ * not be used. ++ */ ++ bclk_ratio = 2 * data_length; ++ } ++ ++ target_frequency = sampling_rate * bclk_ratio; ++ ++ clk_src = BCM2835_CLK_SRC_PLLD; ++ mash = BCM2835_CLK_MASH_1; ++ ++ dividend = bcm2835_clk_freq[clk_src]; ++ dividend <<= BCM2835_CLK_SHIFT; ++ do_div(dividend, target_frequency); ++ divi = dividend >> BCM2835_CLK_SHIFT; ++ divf = dividend & BCM2835_CLK_DIVF_MASK; ++ } ++ ++ /* Set clock divider */ ++ regmap_write(dev->clk_regmap, BCM2835_CLK_PCMDIV_REG, BCM2835_CLK_PASSWD ++ | BCM2835_CLK_DIVI(divi) ++ | BCM2835_CLK_DIVF(divf)); ++ ++ /* Setup clock, but don't start it yet */ ++ regmap_write(dev->clk_regmap, BCM2835_CLK_PCMCTL_REG, BCM2835_CLK_PASSWD ++ | BCM2835_CLK_MASH(mash) ++ | BCM2835_CLK_SRC(clk_src)); + + /* Setup the frame format */ + format = BCM2835_I2S_CHEN; +@@ -548,7 +692,7 @@ static const struct snd_soc_dai_ops bcm2835_i2s_dai_ops = { + .trigger = bcm2835_i2s_trigger, + .hw_params = bcm2835_i2s_hw_params, + .set_fmt = bcm2835_i2s_set_dai_fmt, +- .set_bclk_ratio = bcm2835_i2s_set_dai_bclk_ratio, ++ .set_bclk_ratio = bcm2835_i2s_set_dai_bclk_ratio + }; + + static int bcm2835_i2s_dai_probe(struct snd_soc_dai *dai) +@@ -606,14 +750,34 @@ static bool bcm2835_i2s_precious_reg(struct device *dev, unsigned int reg) + }; + } + +-static const struct regmap_config bcm2835_regmap_config = { +- .reg_bits = 32, +- .reg_stride = 4, +- .val_bits = 32, +- .max_register = BCM2835_I2S_GRAY_REG, +- .precious_reg = bcm2835_i2s_precious_reg, +- .volatile_reg = bcm2835_i2s_volatile_reg, +- .cache_type = REGCACHE_RBTREE, ++static bool bcm2835_clk_volatile_reg(struct device *dev, unsigned int reg) ++{ ++ switch (reg) { ++ case BCM2835_CLK_PCMCTL_REG: ++ return true; ++ default: ++ return false; ++ }; ++} ++ ++static const struct regmap_config bcm2835_regmap_config[] = { ++ { ++ .reg_bits = 32, ++ .reg_stride = 4, ++ .val_bits = 32, ++ .max_register = BCM2835_I2S_GRAY_REG, ++ .precious_reg = bcm2835_i2s_precious_reg, ++ .volatile_reg = bcm2835_i2s_volatile_reg, ++ .cache_type = REGCACHE_RBTREE, ++ }, ++ { ++ .reg_bits = 32, ++ .reg_stride = 4, ++ .val_bits = 32, ++ .max_register = BCM2835_CLK_PCMDIV_REG, ++ .volatile_reg = bcm2835_clk_volatile_reg, ++ .cache_type = REGCACHE_RBTREE, ++ }, + }; + + static const struct snd_soc_component_driver bcm2835_i2s_component = { +@@ -623,50 +787,42 @@ static const struct snd_soc_component_driver bcm2835_i2s_component = { + static int bcm2835_i2s_probe(struct platform_device *pdev) + { + struct bcm2835_i2s_dev *dev; ++ int i; + int ret; +- struct resource *mem; +- void __iomem *base; +- const __be32 *addr; +- dma_addr_t dma_base; ++ struct regmap *regmap[2]; ++ struct resource *mem[2]; ++ ++ /* Request both ioareas */ ++ for (i = 0; i <= 1; i++) { ++ void __iomem *base; ++ ++ mem[i] = platform_get_resource(pdev, IORESOURCE_MEM, i); ++ base = devm_ioremap_resource(&pdev->dev, mem[i]); ++ if (IS_ERR(base)) ++ return PTR_ERR(base); ++ ++ regmap[i] = devm_regmap_init_mmio(&pdev->dev, base, ++ &bcm2835_regmap_config[i]); ++ if (IS_ERR(regmap[i])) ++ return PTR_ERR(regmap[i]); ++ } + + dev = devm_kzalloc(&pdev->dev, sizeof(*dev), + GFP_KERNEL); + if (!dev) + return -ENOMEM; + +- /* get the clock */ +- dev->clk_prepared = false; +- dev->clk = devm_clk_get(&pdev->dev, NULL); +- if (IS_ERR(dev->clk)) { +- dev_err(&pdev->dev, "could not get clk: %ld\n", +- PTR_ERR(dev->clk)); +- return PTR_ERR(dev->clk); +- } +- +- /* Request ioarea */ +- mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); +- base = devm_ioremap_resource(&pdev->dev, mem); +- if (IS_ERR(base)) +- return PTR_ERR(base); +- +- dev->i2s_regmap = devm_regmap_init_mmio(&pdev->dev, base, +- &bcm2835_regmap_config); +- if (IS_ERR(dev->i2s_regmap)) +- return PTR_ERR(dev->i2s_regmap); +- +- /* Set the DMA address - we have to parse DT ourselves */ +- addr = of_get_address(pdev->dev.of_node, 0, NULL, NULL); +- if (!addr) { +- dev_err(&pdev->dev, "could not get DMA-register address\n"); +- return -EINVAL; +- } +- dma_base = be32_to_cpup(addr); ++ dev->i2s_regmap = regmap[0]; ++ dev->clk_regmap = regmap[1]; + ++ /* Set the DMA address */ + dev->dma_data[SNDRV_PCM_STREAM_PLAYBACK].addr = +- dma_base + BCM2835_I2S_FIFO_A_REG; ++ (dma_addr_t)mem[0]->start + BCM2835_I2S_FIFO_A_REG ++ + BCM2835_VCMMU_SHIFT; + + dev->dma_data[SNDRV_PCM_STREAM_CAPTURE].addr = +- dma_base + BCM2835_I2S_FIFO_A_REG; ++ (dma_addr_t)mem[0]->start + BCM2835_I2S_FIFO_A_REG ++ + BCM2835_VCMMU_SHIFT; + + /* Set the bus width */ + dev->dma_data[SNDRV_PCM_STREAM_PLAYBACK].addr_width = + +From d62af4b3c919fa6330797345e0304d1d0d85e98f Mon Sep 17 00:00:00 2001 +From: Matthias Reichl <hias@horus.com> +Date: Sun, 11 Oct 2015 16:44:05 +0200 +Subject: [PATCH 098/112] bcm2835-i2s: get base address for DMA from devicetree + +Code copied from spi-bcm2835. Get physical address from devicetree +instead of using hardcoded constant. + +Signed-off-by: Matthias Reichl <hias@horus.com> +--- + sound/soc/bcm/bcm2835-i2s.c | 20 ++++++++++++-------- + 1 file changed, 12 insertions(+), 8 deletions(-) + +diff --git a/sound/soc/bcm/bcm2835-i2s.c b/sound/soc/bcm/bcm2835-i2s.c +index 3303d5f..0f25db4 100644 +--- a/sound/soc/bcm/bcm2835-i2s.c ++++ b/sound/soc/bcm/bcm2835-i2s.c +@@ -38,6 +38,7 @@ + #include <linux/io.h> + #include <linux/module.h> + #include <linux/slab.h> ++#include <linux/of_address.h> + + #include <sound/core.h> + #include <sound/dmaengine_pcm.h> +@@ -158,10 +159,6 @@ static const unsigned int bcm2835_clk_freq[BCM2835_CLK_SRC_HDMI+1] = { + #define BCM2835_I2S_INT_RXR BIT(1) + #define BCM2835_I2S_INT_TXW BIT(0) + +-/* I2S DMA interface */ +-/* FIXME: Needs IOMMU support */ +-#define BCM2835_VCMMU_SHIFT (0x7E000000 - 0x20000000) +- + /* General device struct */ + struct bcm2835_i2s_dev { + struct device *dev; +@@ -791,6 +788,15 @@ static int bcm2835_i2s_probe(struct platform_device *pdev) + int ret; + struct regmap *regmap[2]; + struct resource *mem[2]; ++ const __be32 *addr; ++ dma_addr_t dma_reg_base; ++ ++ addr = of_get_address(pdev->dev.of_node, 0, NULL, NULL); ++ if (!addr) { ++ dev_err(&pdev->dev, "could not get DMA-register address\n"); ++ return -ENODEV; ++ } ++ dma_reg_base = be32_to_cpup(addr); + + /* Request both ioareas */ + for (i = 0; i <= 1; i++) { +@@ -817,12 +823,10 @@ static int bcm2835_i2s_probe(struct platform_device *pdev) + + /* Set the DMA address */ + dev->dma_data[SNDRV_PCM_STREAM_PLAYBACK].addr = +- (dma_addr_t)mem[0]->start + BCM2835_I2S_FIFO_A_REG +- + BCM2835_VCMMU_SHIFT; ++ dma_reg_base + BCM2835_I2S_FIFO_A_REG; + + dev->dma_data[SNDRV_PCM_STREAM_CAPTURE].addr = +- (dma_addr_t)mem[0]->start + BCM2835_I2S_FIFO_A_REG +- + BCM2835_VCMMU_SHIFT; ++ dma_reg_base + BCM2835_I2S_FIFO_A_REG; + + /* Set the bus width */ + dev->dma_data[SNDRV_PCM_STREAM_PLAYBACK].addr_width = + +From 8a02cd06b98460363d598c1df1a92b05b4dc1ad5 Mon Sep 17 00:00:00 2001 +From: Matthias Reichl <hias@horus.com> +Date: Sun, 11 Oct 2015 15:21:16 +0200 +Subject: [PATCH 099/112] bcm2835-i2s: add 24bit support, update bclk_ratio to + more correct values + +Code ported from bcm2708-i2s driver in Raspberry Pi tree. + +RPi commit 62c05a0b5328d9376d39c9e74da10b8a2465c234 ("ASoC: BCM2708: +Add 24 bit support") + +This adds 24 bit support to the I2S driver of the BCM2708. +Besides enabling the 24 bit flags, it includes two bug fixes: + +MMAP is not supported. Claiming this leads to strange issues +when the format of driver and file do not match. + +The datasheet states that the width extension bit should be set +for widths greater than 24, but greater or equal would be correct. +This follows from the definition of the width field. + +Signed-off-by: Florian Meier <florian.meier@koalo.de> + +RPi commit 3e8c672bc4e92d457aa4654bbb4cfd79a18a2327 ("bcm2708-i2s: +Update bclk_ratio to more correct values") + +Discussion about blck_ratio affecting sound quality: +https://github.com/raspberrypi/linux/issues/681 + +Signed-off-by: Matthias Reichl <hias@horus.com> +--- + sound/soc/bcm/bcm2835-i2s.c | 12 +++++++++--- + 1 file changed, 9 insertions(+), 3 deletions(-) + +diff --git a/sound/soc/bcm/bcm2835-i2s.c b/sound/soc/bcm/bcm2835-i2s.c +index 0f25db4..0f35d7c 100644 +--- a/sound/soc/bcm/bcm2835-i2s.c ++++ b/sound/soc/bcm/bcm2835-i2s.c +@@ -340,11 +340,15 @@ static int bcm2835_i2s_hw_params(struct snd_pcm_substream *substream, + switch (params_format(params)) { + case SNDRV_PCM_FORMAT_S16_LE: + data_length = 16; +- bclk_ratio = 40; ++ bclk_ratio = 50; ++ break; ++ case SNDRV_PCM_FORMAT_S24_LE: ++ data_length = 24; ++ bclk_ratio = 50; + break; + case SNDRV_PCM_FORMAT_S32_LE: + data_length = 32; +- bclk_ratio = 80; ++ bclk_ratio = 100; + break; + default: + return -EINVAL; +@@ -420,7 +424,7 @@ static int bcm2835_i2s_hw_params(struct snd_pcm_substream *substream, + /* Setup the frame format */ + format = BCM2835_I2S_CHEN; + +- if (data_length > 24) ++ if (data_length >= 24) + format |= BCM2835_I2S_CHWEX; + + format |= BCM2835_I2S_CHWID((data_length-8)&0xf); +@@ -711,6 +715,7 @@ static struct snd_soc_dai_driver bcm2835_i2s_dai = { + .channels_max = 2, + .rates = SNDRV_PCM_RATE_8000_192000, + .formats = SNDRV_PCM_FMTBIT_S16_LE ++ | SNDRV_PCM_FMTBIT_S24_LE + | SNDRV_PCM_FMTBIT_S32_LE + }, + .capture = { +@@ -718,6 +723,7 @@ static struct snd_soc_dai_driver bcm2835_i2s_dai = { + .channels_max = 2, + .rates = SNDRV_PCM_RATE_8000_192000, + .formats = SNDRV_PCM_FMTBIT_S16_LE ++ | SNDRV_PCM_FMTBIT_S24_LE + | SNDRV_PCM_FMTBIT_S32_LE + }, + .ops = &bcm2835_i2s_dai_ops, + +From c7032249121b5eb95cfeb1812782c204810dc939 Mon Sep 17 00:00:00 2001 +From: Matthias Reichl <hias@horus.com> +Date: Sun, 11 Oct 2015 15:25:51 +0200 +Subject: [PATCH 100/112] bcm2835-i2s: setup clock only if CPU is clock master + +Code ported from bcm2708-i2s driver in Raspberry Pi tree. + +RPi commit c14827ecdaa36607f6110f9ce8df96e698672191 ("bcm2708: Allow +option card devices to be configured via DT") + +Original work by Zoltan Szenczi, committed to RPi tree by +Phil Elwell. + +Signed-off-by: Matthias Reichl <hias@horus.com> +--- + sound/soc/bcm/bcm2835-i2s.c | 28 +++++++++++++++++++--------- + 1 file changed, 19 insertions(+), 9 deletions(-) + +diff --git a/sound/soc/bcm/bcm2835-i2s.c b/sound/soc/bcm/bcm2835-i2s.c +index 0f35d7c..d5e4123 100644 +--- a/sound/soc/bcm/bcm2835-i2s.c ++++ b/sound/soc/bcm/bcm2835-i2s.c +@@ -411,15 +411,25 @@ static int bcm2835_i2s_hw_params(struct snd_pcm_substream *substream, + divf = dividend & BCM2835_CLK_DIVF_MASK; + } + +- /* Set clock divider */ +- regmap_write(dev->clk_regmap, BCM2835_CLK_PCMDIV_REG, BCM2835_CLK_PASSWD +- | BCM2835_CLK_DIVI(divi) +- | BCM2835_CLK_DIVF(divf)); +- +- /* Setup clock, but don't start it yet */ +- regmap_write(dev->clk_regmap, BCM2835_CLK_PCMCTL_REG, BCM2835_CLK_PASSWD +- | BCM2835_CLK_MASH(mash) +- | BCM2835_CLK_SRC(clk_src)); ++ /* Clock should only be set up here if CPU is clock master */ ++ switch (dev->fmt & SND_SOC_DAIFMT_MASTER_MASK) { ++ case SND_SOC_DAIFMT_CBS_CFS: ++ case SND_SOC_DAIFMT_CBS_CFM: ++ /* Set clock divider */ ++ regmap_write(dev->clk_regmap, BCM2835_CLK_PCMDIV_REG, ++ BCM2835_CLK_PASSWD ++ | BCM2835_CLK_DIVI(divi) ++ | BCM2835_CLK_DIVF(divf)); ++ ++ /* Setup clock, but don't start it yet */ ++ regmap_write(dev->clk_regmap, BCM2835_CLK_PCMCTL_REG, ++ BCM2835_CLK_PASSWD ++ | BCM2835_CLK_MASH(mash) ++ | BCM2835_CLK_SRC(clk_src)); ++ break; ++ default: ++ break; ++ } + + /* Setup the frame format */ + format = BCM2835_I2S_CHEN; + +From 1fcff3b17e19175b7fc986f868ac4209abc5a71d Mon Sep 17 00:00:00 2001 +From: Matthias Reichl <hias@horus.com> +Date: Sun, 11 Oct 2015 15:49:51 +0200 +Subject: [PATCH 101/112] bcm2835-i2s: Eliminate debugfs directory error + +Code ported from bcm2708-i2s driver in Raspberry Pi tree. + +RPi commit fd7d7a3dbe9262d16971ef81c234ed28c6499dd7 ("bcm2708: +Eliminate i2s debugfs directory error") + +Qualify the two regmap ranges uses by bcm2708-i2s ('-i2s' and '-clk') +to avoid the name clash when registering debugfs entries. + +Signed-off-by: Matthias Reichl <hias@horus.com> +--- + sound/soc/bcm/bcm2835-i2s.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/sound/soc/bcm/bcm2835-i2s.c b/sound/soc/bcm/bcm2835-i2s.c +index d5e4123..2d29050 100644 +--- a/sound/soc/bcm/bcm2835-i2s.c ++++ b/sound/soc/bcm/bcm2835-i2s.c +@@ -782,6 +782,7 @@ static const struct regmap_config bcm2835_regmap_config[] = { + .precious_reg = bcm2835_i2s_precious_reg, + .volatile_reg = bcm2835_i2s_volatile_reg, + .cache_type = REGCACHE_RBTREE, ++ .name = "i2s", + }, + { + .reg_bits = 32, +@@ -790,6 +791,7 @@ static const struct regmap_config bcm2835_regmap_config[] = { + .max_register = BCM2835_CLK_PCMDIV_REG, + .volatile_reg = bcm2835_clk_volatile_reg, + .cache_type = REGCACHE_RBTREE, ++ .name = "clk", + }, + }; + + +From 46931a1a476d1f1deb4dd654305a911e720bda21 Mon Sep 17 00:00:00 2001 +From: Matthias Reichl <hias@horus.com> +Date: Sun, 11 Oct 2015 15:35:20 +0200 +Subject: [PATCH 102/112] bcm2835-i2s: Register PCM device + +Code ported from bcm2708-i2s driver in Raspberry Pi tree. + +RPi commit ba46b4935a23aa2caac1855ead52a035d4776680 ("ASoC: Add +support for BCM2708") + +This driver adds support for digital audio (I2S) +for the BCM2708 SoC that is used by the +Raspberry Pi. External audio codecs can be +connected to the Raspberry Pi via P5 header. + +It relies on cyclic DMA engine support for BCM2708. + +Signed-off-by: Florian Meier <florian.meier@koalo.de> + +Signed-off-by: Matthias Reichl <hias@horus.com> +--- + sound/soc/bcm/bcm2835-i2s.c | 23 ++++++++++++++++++++++- + 1 file changed, 22 insertions(+), 1 deletion(-) + +diff --git a/sound/soc/bcm/bcm2835-i2s.c b/sound/soc/bcm/bcm2835-i2s.c +index 2d29050..ce93ef0 100644 +--- a/sound/soc/bcm/bcm2835-i2s.c ++++ b/sound/soc/bcm/bcm2835-i2s.c +@@ -799,6 +799,25 @@ static const struct snd_soc_component_driver bcm2835_i2s_component = { + .name = "bcm2835-i2s-comp", + }; + ++static const struct snd_pcm_hardware bcm2835_pcm_hardware = { ++ .info = SNDRV_PCM_INFO_INTERLEAVED | ++ SNDRV_PCM_INFO_JOINT_DUPLEX, ++ .formats = SNDRV_PCM_FMTBIT_S16_LE | ++ SNDRV_PCM_FMTBIT_S24_LE | ++ SNDRV_PCM_FMTBIT_S32_LE, ++ .period_bytes_min = 32, ++ .period_bytes_max = 64 * PAGE_SIZE, ++ .periods_min = 2, ++ .periods_max = 255, ++ .buffer_bytes_max = 128 * PAGE_SIZE, ++}; ++ ++static const struct snd_dmaengine_pcm_config bcm2835_dmaengine_pcm_config = { ++ .prepare_slave_config = snd_dmaengine_pcm_prepare_slave_config, ++ .pcm_hardware = &bcm2835_pcm_hardware, ++ .prealloc_buffer_size = 256 * PAGE_SIZE, ++}; ++ + static int bcm2835_i2s_probe(struct platform_device *pdev) + { + struct bcm2835_i2s_dev *dev; +@@ -870,7 +889,9 @@ static int bcm2835_i2s_probe(struct platform_device *pdev) + return ret; + } + +- ret = devm_snd_dmaengine_pcm_register(&pdev->dev, NULL, 0); ++ ret = devm_snd_dmaengine_pcm_register(&pdev->dev, ++ &bcm2835_dmaengine_pcm_config, ++ SND_DMAENGINE_PCM_FLAG_COMPAT); + if (ret) { + dev_err(&pdev->dev, "Could not register PCM: %d\n", ret); + return ret; + +From 04c99807249213d277900d529ad921edad28af25 Mon Sep 17 00:00:00 2001 +From: Matthias Reichl <hias@horus.com> +Date: Sun, 11 Oct 2015 15:55:21 +0200 +Subject: [PATCH 103/112] bcm2835-i2s: Enable MMAP support via a DT property + +Code ported from bcm2708-i2s driver in Raspberry Pi tree. + +RPi commit 7ee829fd77a30127db5d0b3c7d79b8718166e568 ("bcm2708-i2s: +Enable MMAP support via a DT property and overlay") + +The i2s driver used to claim to support MMAP, but that feature was disabled +when some problems were found. Add the ability to enable this feature +through Device Tree, using the i2s-mmap overlay. + +See: #1004 + +Signed-off-by: Matthias Reichl <hias@horus.com> +--- + sound/soc/bcm/bcm2835-i2s.c | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/sound/soc/bcm/bcm2835-i2s.c b/sound/soc/bcm/bcm2835-i2s.c +index ce93ef0..6f60c2c 100644 +--- a/sound/soc/bcm/bcm2835-i2s.c ++++ b/sound/soc/bcm/bcm2835-i2s.c +@@ -799,7 +799,7 @@ static const struct snd_soc_component_driver bcm2835_i2s_component = { + .name = "bcm2835-i2s-comp", + }; + +-static const struct snd_pcm_hardware bcm2835_pcm_hardware = { ++static struct snd_pcm_hardware bcm2835_pcm_hardware = { + .info = SNDRV_PCM_INFO_INTERLEAVED | + SNDRV_PCM_INFO_JOINT_DUPLEX, + .formats = SNDRV_PCM_FMTBIT_S16_LE | +@@ -835,6 +835,11 @@ static int bcm2835_i2s_probe(struct platform_device *pdev) + } + dma_reg_base = be32_to_cpup(addr); + ++ if (of_property_read_bool(pdev->dev.of_node, "brcm,enable-mmap")) ++ bcm2835_pcm_hardware.info |= ++ SNDRV_PCM_INFO_MMAP | ++ SNDRV_PCM_INFO_MMAP_VALID; ++ + /* Request both ioareas */ + for (i = 0; i <= 1; i++) { + void __iomem *base; + +From 262486d1cc4f3cf204c012100bd7bfd36f446b37 Mon Sep 17 00:00:00 2001 +From: Phil Elwell <phil@raspberrypi.org> +Date: Thu, 21 Apr 2016 15:44:14 +0100 +Subject: [PATCH 104/112] bcm2835-i2s: Reduce the TX DREQ threshold + +TX FIFO overrun is thought to be the cause of channel swapping, so +reducing the DREQ threshold seems reasonable and appears to be +effective. + +See: https://github.com/raspberrypi/linux/issues/1417 + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> +--- + sound/soc/bcm/bcm2835-i2s.c | 21 ++++++++++++++------- + 1 file changed, 14 insertions(+), 7 deletions(-) + +diff --git a/sound/soc/bcm/bcm2835-i2s.c b/sound/soc/bcm/bcm2835-i2s.c +index 6f60c2c..b26f958 100644 +--- a/sound/soc/bcm/bcm2835-i2s.c ++++ b/sound/soc/bcm/bcm2835-i2s.c +@@ -555,15 +555,22 @@ static int bcm2835_i2s_hw_params(struct snd_pcm_substream *substream, + + /* Setup the DMA parameters */ + regmap_update_bits(dev->i2s_regmap, BCM2835_I2S_CS_A_REG, +- BCM2835_I2S_RXTHR(1) +- | BCM2835_I2S_TXTHR(1) +- | BCM2835_I2S_DMAEN, 0xffffffff); ++ BCM2835_I2S_RXTHR(3) ++ | BCM2835_I2S_TXTHR(3) ++ | BCM2835_I2S_DMAEN, ++ BCM2835_I2S_RXTHR(1) ++ | BCM2835_I2S_TXTHR(1) ++ | BCM2835_I2S_DMAEN); + + regmap_update_bits(dev->i2s_regmap, BCM2835_I2S_DREQ_A_REG, +- BCM2835_I2S_TX_PANIC(0x10) +- | BCM2835_I2S_RX_PANIC(0x30) +- | BCM2835_I2S_TX(0x30) +- | BCM2835_I2S_RX(0x20), 0xffffffff); ++ BCM2835_I2S_TX_PANIC(0x7f) ++ | BCM2835_I2S_RX_PANIC(0x7f) ++ | BCM2835_I2S_TX(0x7f) ++ | BCM2835_I2S_RX(0x7f), ++ BCM2835_I2S_TX_PANIC(0x10) ++ | BCM2835_I2S_RX_PANIC(0x30) ++ | BCM2835_I2S_TX(0x20) ++ | BCM2835_I2S_RX(0x20)); + + /* Clear FIFOs */ + bcm2835_i2s_clear_fifos(dev, true, true); + +From de142c7f01c5fea98e0548d564c08e0084cb4706 Mon Sep 17 00:00:00 2001 +From: Eric Anholt <eric@anholt.net> +Date: Wed, 14 Oct 2015 11:32:14 -0700 +Subject: [PATCH 105/112] drm/vc4: Force HDMI to connected. + +For some reason on the downstream tree, the HPD GPIO isn't working. + +Signed-off-by: Eric Anholt <eric@anholt.net> +--- + drivers/gpu/drm/vc4/vc4_hdmi.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c +index d8b8649..136847e 100644 +--- a/drivers/gpu/drm/vc4/vc4_hdmi.c ++++ b/drivers/gpu/drm/vc4/vc4_hdmi.c +@@ -166,6 +166,8 @@ vc4_hdmi_connector_detect(struct drm_connector *connector, bool force) + struct drm_device *dev = connector->dev; + struct vc4_dev *vc4 = to_vc4_dev(dev); + ++ return connector_status_connected; ++ + if (vc4->hdmi->hpd_gpio) { + if (gpio_get_value_cansleep(vc4->hdmi->hpd_gpio) ^ + vc4->hdmi->hpd_active_low) + +From 69dd4dd3bef6d673a6b81f115b83238e70c30e7b Mon Sep 17 00:00:00 2001 +From: Aaron Shaw <shawaj@gmail.com> +Date: Thu, 7 Apr 2016 21:26:21 +0100 +Subject: [PATCH 106/112] Add Support for JustBoom Audio boards + +justboom-dac: Adjust for ALSA API change + +As of 4.4, snd_soc_limit_volume now takes a struct snd_soc_card * +rather than a struct snd_soc_codec *. + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> +--- + arch/arm/configs/bcm2709_defconfig | 4 +- + arch/arm/configs/bcmrpi_defconfig | 4 +- + sound/soc/bcm/Kconfig | 14 +++ + sound/soc/bcm/Makefile | 4 + + sound/soc/bcm/justboom-dac.c | 162 ++++++++++++++++++++++++++++ + sound/soc/bcm/justboom-digi.c | 215 +++++++++++++++++++++++++++++++++++++ + 6 files changed, 399 insertions(+), 4 deletions(-) + create mode 100644 sound/soc/bcm/justboom-dac.c + create mode 100644 sound/soc/bcm/justboom-digi.c + +diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig +index f42c5eb..055ecfc 100644 +--- a/arch/arm/configs/bcm2709_defconfig ++++ b/arch/arm/configs/bcm2709_defconfig +@@ -856,8 +856,8 @@ CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI=m + CONFIG_SND_BCM2708_SOC_HIFIBERRY_AMP=m + CONFIG_SND_BCM2708_SOC_RPI_DAC=m + CONFIG_SND_BCM2708_SOC_RPI_PROTO=m +-CONFIG_SND_BCM2708_SOC_BOOMBERRY_DAC=m +-CONFIG_SND_BCM2708_SOC_BOOMBERRY_DIGI=m ++CONFIG_SND_BCM2708_SOC_JUSTBOOM_DAC=m ++CONFIG_SND_BCM2708_SOC_JUSTBOOM_DIGI=m + CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC=m + CONFIG_SND_BCM2708_SOC_RASPIDAC3=m + CONFIG_SND_BCM2708_SOC_ADAU1977_ADC=m +diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig +index 8bd0207..8e0b51f 100644 +--- a/arch/arm/configs/bcmrpi_defconfig ++++ b/arch/arm/configs/bcmrpi_defconfig +@@ -848,8 +848,8 @@ CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI=m + CONFIG_SND_BCM2708_SOC_HIFIBERRY_AMP=m + CONFIG_SND_BCM2708_SOC_RPI_DAC=m + CONFIG_SND_BCM2708_SOC_RPI_PROTO=m +-CONFIG_SND_BCM2708_SOC_BOOMBERRY_DAC=m +-CONFIG_SND_BCM2708_SOC_BOOMBERRY_DIGI=m ++CONFIG_SND_BCM2708_SOC_JUSTBOOM_DAC=m ++CONFIG_SND_BCM2708_SOC_JUSTBOOM_DIGI=m + CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC=m + CONFIG_SND_BCM2708_SOC_RASPIDAC3=m + CONFIG_SND_BCM2708_SOC_ADAU1977_ADC=m +diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig +index 1a3f826..e2e2782 100644 +--- a/sound/soc/bcm/Kconfig ++++ b/sound/soc/bcm/Kconfig +@@ -50,6 +50,20 @@ config SND_BCM2708_SOC_RPI_PROTO + help + Say Y or M if you want to add support for Audio Codec Board PROTO (WM8731). + ++config SND_BCM2708_SOC_JUSTBOOM_DAC ++ tristate "Support for JustBoom DAC" ++ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S ++ select SND_SOC_PCM512x ++ help ++ Say Y or M if you want to add support for JustBoom DAC. ++ ++config SND_BCM2708_SOC_JUSTBOOM_DIGI ++ tristate "Support for JustBoom Digi" ++ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S ++ select SND_SOC_WM8804 ++ help ++ Say Y or M if you want to add support for JustBoom Digi. ++ + config SND_BCM2708_SOC_IQAUDIO_DAC + tristate "Support for IQaudIO-DAC" + depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S +diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile +index b21e11e..6c9714c 100644 +--- a/sound/soc/bcm/Makefile ++++ b/sound/soc/bcm/Makefile +@@ -8,6 +8,8 @@ snd-soc-hifiberry-dac-objs := hifiberry_dac.o + snd-soc-hifiberry-dacplus-objs := hifiberry_dacplus.o + snd-soc-hifiberry-digi-objs := hifiberry_digi.o + snd-soc-hifiberry-amp-objs := hifiberry_amp.o ++snd-soc-justboom-dac-objs := justboom-dac.o ++snd-soc-justboom-digi-objs := justboom-digi.o + snd-soc-rpi-dac-objs := rpi-dac.o + snd-soc-rpi-proto-objs := rpi-proto.o + snd-soc-iqaudio-dac-objs := iqaudio-dac.o +@@ -17,6 +19,8 @@ obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o + obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS) += snd-soc-hifiberry-dacplus.o + obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI) += snd-soc-hifiberry-digi.o + obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_AMP) += snd-soc-hifiberry-amp.o ++obj-$(CONFIG_SND_BCM2708_SOC_JUSTBOOM_DAC) += snd-soc-justboom-dac.o ++obj-$(CONFIG_SND_BCM2708_SOC_JUSTBOOM_DIGI) += snd-soc-justboom-digi.o + obj-$(CONFIG_SND_BCM2708_SOC_RPI_DAC) += snd-soc-rpi-dac.o + obj-$(CONFIG_SND_BCM2708_SOC_RPI_PROTO) += snd-soc-rpi-proto.o + obj-$(CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC) += snd-soc-iqaudio-dac.o +diff --git a/sound/soc/bcm/justboom-dac.c b/sound/soc/bcm/justboom-dac.c +new file mode 100644 +index 0000000..8fd50db +--- /dev/null ++++ b/sound/soc/bcm/justboom-dac.c +@@ -0,0 +1,162 @@ ++/* ++ * ASoC Driver for JustBoom DAC Raspberry Pi HAT Sound Card ++ * ++ * Author: Milan Neskovic ++ * Copyright 2016 ++ * based on code by Daniel Matuschek <info@crazy-audio.com> ++ * based on code by Florian Meier <florian.meier@koalo.de> ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * version 2 as published by the Free Software Foundation. ++ * ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * General Public License for more details. ++ */ ++ ++#include <linux/module.h> ++#include <linux/platform_device.h> ++ ++#include <sound/core.h> ++#include <sound/pcm.h> ++#include <sound/pcm_params.h> ++#include <sound/soc.h> ++#include <sound/jack.h> ++ ++#include "../codecs/pcm512x.h" ++ ++static bool digital_gain_0db_limit = true; ++ ++static int snd_rpi_justboom_dac_init(struct snd_soc_pcm_runtime *rtd) ++{ ++ struct snd_soc_codec *codec = rtd->codec; ++ snd_soc_update_bits(codec, PCM512x_GPIO_EN, 0x08, 0x08); ++ snd_soc_update_bits(codec, PCM512x_GPIO_OUTPUT_4, 0xf, 0x02); ++ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x08,0x08); ++ ++ if (digital_gain_0db_limit) ++ { ++ int ret; ++ struct snd_soc_card *card = rtd->card; ++ ++ ret = snd_soc_limit_volume(card, "Digital Playback Volume", 207); ++ if (ret < 0) ++ dev_warn(card->dev, "Failed to set volume limit: %d\n", ret); ++ } ++ ++ return 0; ++} ++ ++static int snd_rpi_justboom_dac_hw_params(struct snd_pcm_substream *substream, ++ struct snd_pcm_hw_params *params) ++{ ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; ++ /*return snd_soc_dai_set_bclk_ratio(cpu_dai, 64);*/ ++ unsigned int sample_bits = ++ snd_pcm_format_physical_width(params_format(params)); ++ return snd_soc_dai_set_bclk_ratio(cpu_dai, sample_bits * 2); ++} ++ ++static int snd_rpi_justboom_dac_startup(struct snd_pcm_substream *substream) { ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_codec *codec = rtd->codec; ++ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x08,0x08); ++ return 0; ++} ++ ++static void snd_rpi_justboom_dac_shutdown(struct snd_pcm_substream *substream) { ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_codec *codec = rtd->codec; ++ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x08,0x00); ++} ++ ++/* machine stream operations */ ++static struct snd_soc_ops snd_rpi_justboom_dac_ops = { ++ .hw_params = snd_rpi_justboom_dac_hw_params, ++ .startup = snd_rpi_justboom_dac_startup, ++ .shutdown = snd_rpi_justboom_dac_shutdown, ++}; ++ ++static struct snd_soc_dai_link snd_rpi_justboom_dac_dai[] = { ++{ ++ .name = "JustBoom DAC", ++ .stream_name = "JustBoom DAC HiFi", ++ .cpu_dai_name = "bcm2708-i2s.0", ++ .codec_dai_name = "pcm512x-hifi", ++ .platform_name = "bcm2708-i2s.0", ++ .codec_name = "pcm512x.1-004d", ++ .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | ++ SND_SOC_DAIFMT_CBS_CFS, ++ .ops = &snd_rpi_justboom_dac_ops, ++ .init = snd_rpi_justboom_dac_init, ++}, ++}; ++ ++/* audio machine driver */ ++static struct snd_soc_card snd_rpi_justboom_dac = { ++ .name = "snd_rpi_justboom_dac", ++ .owner = THIS_MODULE, ++ .dai_link = snd_rpi_justboom_dac_dai, ++ .num_links = ARRAY_SIZE(snd_rpi_justboom_dac_dai), ++}; ++ ++static int snd_rpi_justboom_dac_probe(struct platform_device *pdev) ++{ ++ int ret = 0; ++ ++ snd_rpi_justboom_dac.dev = &pdev->dev; ++ ++ if (pdev->dev.of_node) { ++ struct device_node *i2s_node; ++ struct snd_soc_dai_link *dai = &snd_rpi_justboom_dac_dai[0]; ++ i2s_node = of_parse_phandle(pdev->dev.of_node, ++ "i2s-controller", 0); ++ ++ if (i2s_node) { ++ dai->cpu_dai_name = NULL; ++ dai->cpu_of_node = i2s_node; ++ dai->platform_name = NULL; ++ dai->platform_of_node = i2s_node; ++ } ++ ++ digital_gain_0db_limit = !of_property_read_bool( ++ pdev->dev.of_node, "justboom,24db_digital_gain"); ++ } ++ ++ ret = snd_soc_register_card(&snd_rpi_justboom_dac); ++ if (ret) ++ dev_err(&pdev->dev, ++ "snd_soc_register_card() failed: %d\n", ret); ++ ++ return ret; ++} ++ ++static int snd_rpi_justboom_dac_remove(struct platform_device *pdev) ++{ ++ return snd_soc_unregister_card(&snd_rpi_justboom_dac); ++} ++ ++static const struct of_device_id snd_rpi_justboom_dac_of_match[] = { ++ { .compatible = "justboom,justboom-dac", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, snd_rpi_justboom_dac_of_match); ++ ++static struct platform_driver snd_rpi_justboom_dac_driver = { ++ .driver = { ++ .name = "snd-rpi-justboom-dac", ++ .owner = THIS_MODULE, ++ .of_match_table = snd_rpi_justboom_dac_of_match, ++ }, ++ .probe = snd_rpi_justboom_dac_probe, ++ .remove = snd_rpi_justboom_dac_remove, ++}; ++ ++module_platform_driver(snd_rpi_justboom_dac_driver); ++ ++MODULE_AUTHOR("Milan Neskovic <info@justboom.co>"); ++MODULE_DESCRIPTION("ASoC Driver for JustBoom PI DAC HAT Sound Card"); ++MODULE_LICENSE("GPL v2"); +diff --git a/sound/soc/bcm/justboom-digi.c b/sound/soc/bcm/justboom-digi.c +new file mode 100644 +index 0000000..91acb66 +--- /dev/null ++++ b/sound/soc/bcm/justboom-digi.c +@@ -0,0 +1,215 @@ ++/* ++ * ASoC Driver for JustBoom Raspberry Pi Digi HAT Sound Card ++ * ++ * Author: Milan Neskovic ++ * Copyright 2016 ++ * based on code by Daniel Matuschek <info@crazy-audio.com> ++ * based on code by Florian Meier <florian.meier@koalo.de> ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * version 2 as published by the Free Software Foundation. ++ * ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * General Public License for more details. ++ */ ++ ++#include <linux/module.h> ++#include <linux/platform_device.h> ++ ++#include <sound/core.h> ++#include <sound/pcm.h> ++#include <sound/pcm_params.h> ++#include <sound/soc.h> ++#include <sound/jack.h> ++ ++#include "../codecs/wm8804.h" ++ ++static int snd_rpi_justboom_digi_init(struct snd_soc_pcm_runtime *rtd) ++{ ++ struct snd_soc_codec *codec = rtd->codec; ++ ++ /* enable TX output */ ++ snd_soc_update_bits(codec, WM8804_PWRDN, 0x4, 0x0); ++ ++ return 0; ++} ++ ++static int snd_rpi_justboom_digi_startup(struct snd_pcm_substream *substream) { ++ /* turn on digital output */ ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_codec *codec = rtd->codec; ++ snd_soc_update_bits(codec, WM8804_PWRDN, 0x3c, 0x00); ++ return 0; ++} ++ ++static void snd_rpi_justboom_digi_shutdown(struct snd_pcm_substream *substream) { ++ /* turn off output */ ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_codec *codec = rtd->codec; ++ snd_soc_update_bits(codec, WM8804_PWRDN, 0x3c, 0x3c); ++} ++ ++static int snd_rpi_justboom_digi_hw_params(struct snd_pcm_substream *substream, ++ struct snd_pcm_hw_params *params) ++{ ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_dai *codec_dai = rtd->codec_dai; ++ struct snd_soc_codec *codec = rtd->codec; ++ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; ++ ++ int sysclk = 27000000; /* This is fixed on this board */ ++ ++ long mclk_freq=0; ++ int mclk_div=1; ++ int sampling_freq=1; ++ ++ int ret; ++ ++ int samplerate = params_rate(params); ++ ++ if (samplerate<=96000) { ++ mclk_freq=samplerate*256; ++ mclk_div=WM8804_MCLKDIV_256FS; ++ } else { ++ mclk_freq=samplerate*128; ++ mclk_div=WM8804_MCLKDIV_128FS; ++ } ++ ++ switch (samplerate) { ++ case 32000: ++ sampling_freq=0x03; ++ break; ++ case 44100: ++ sampling_freq=0x00; ++ break; ++ case 48000: ++ sampling_freq=0x02; ++ break; ++ case 88200: ++ sampling_freq=0x08; ++ break; ++ case 96000: ++ sampling_freq=0x0a; ++ break; ++ case 176400: ++ sampling_freq=0x0c; ++ break; ++ case 192000: ++ sampling_freq=0x0e; ++ break; ++ default: ++ dev_err(codec->dev, ++ "Failed to set WM8804 SYSCLK, unsupported samplerate %d\n", ++ samplerate); ++ } ++ ++ snd_soc_dai_set_clkdiv(codec_dai, WM8804_MCLK_DIV, mclk_div); ++ snd_soc_dai_set_pll(codec_dai, 0, 0, sysclk, mclk_freq); ++ ++ ret = snd_soc_dai_set_sysclk(codec_dai, WM8804_TX_CLKSRC_PLL, ++ sysclk, SND_SOC_CLOCK_OUT); ++ if (ret < 0) { ++ dev_err(codec->dev, ++ "Failed to set WM8804 SYSCLK: %d\n", ret); ++ return ret; ++ } ++ ++ /* Enable TX output */ ++ snd_soc_update_bits(codec, WM8804_PWRDN, 0x4, 0x0); ++ ++ /* Power on */ ++ snd_soc_update_bits(codec, WM8804_PWRDN, 0x9, 0); ++ ++ /* set sampling frequency status bits */ ++ snd_soc_update_bits(codec, WM8804_SPDTX4, 0x0f, sampling_freq); ++ ++ return snd_soc_dai_set_bclk_ratio(cpu_dai,64); ++} ++ ++/* machine stream operations */ ++static struct snd_soc_ops snd_rpi_justboom_digi_ops = { ++ .hw_params = snd_rpi_justboom_digi_hw_params, ++ .startup = snd_rpi_justboom_digi_startup, ++ .shutdown = snd_rpi_justboom_digi_shutdown, ++}; ++ ++static struct snd_soc_dai_link snd_rpi_justboom_digi_dai[] = { ++{ ++ .name = "JustBoom Digi", ++ .stream_name = "JustBoom Digi HiFi", ++ .cpu_dai_name = "bcm2708-i2s.0", ++ .codec_dai_name = "wm8804-spdif", ++ .platform_name = "bcm2708-i2s.0", ++ .codec_name = "wm8804.1-003b", ++ .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | ++ SND_SOC_DAIFMT_CBM_CFM, ++ .ops = &snd_rpi_justboom_digi_ops, ++ .init = snd_rpi_justboom_digi_init, ++}, ++}; ++ ++/* audio machine driver */ ++static struct snd_soc_card snd_rpi_justboom_digi = { ++ .name = "snd_rpi_justboom_digi", ++ .owner = THIS_MODULE, ++ .dai_link = snd_rpi_justboom_digi_dai, ++ .num_links = ARRAY_SIZE(snd_rpi_justboom_digi_dai), ++}; ++ ++static int snd_rpi_justboom_digi_probe(struct platform_device *pdev) ++{ ++ int ret = 0; ++ ++ snd_rpi_justboom_digi.dev = &pdev->dev; ++ ++ if (pdev->dev.of_node) { ++ struct device_node *i2s_node; ++ struct snd_soc_dai_link *dai = &snd_rpi_justboom_digi_dai[0]; ++ i2s_node = of_parse_phandle(pdev->dev.of_node, ++ "i2s-controller", 0); ++ ++ if (i2s_node) { ++ dai->cpu_dai_name = NULL; ++ dai->cpu_of_node = i2s_node; ++ dai->platform_name = NULL; ++ dai->platform_of_node = i2s_node; ++ } ++ } ++ ++ ret = snd_soc_register_card(&snd_rpi_justboom_digi); ++ if (ret) ++ dev_err(&pdev->dev, ++ "snd_soc_register_card() failed: %d\n", ret); ++ ++ return ret; ++} ++ ++static int snd_rpi_justboom_digi_remove(struct platform_device *pdev) ++{ ++ return snd_soc_unregister_card(&snd_rpi_justboom_digi); ++} ++ ++static const struct of_device_id snd_rpi_justboom_digi_of_match[] = { ++ { .compatible = "justboom,justboom-digi", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, snd_rpi_justboom_digi_of_match); ++ ++static struct platform_driver snd_rpi_justboom_digi_driver = { ++ .driver = { ++ .name = "snd-rpi-justboom-digi", ++ .owner = THIS_MODULE, ++ .of_match_table = snd_rpi_justboom_digi_of_match, ++ }, ++ .probe = snd_rpi_justboom_digi_probe, ++ .remove = snd_rpi_justboom_digi_remove, ++}; ++ ++module_platform_driver(snd_rpi_justboom_digi_driver); ++ ++MODULE_AUTHOR("Milan Neskovic <info@justboom.co>"); ++MODULE_DESCRIPTION("ASoC Driver for JustBoom PI Digi HAT Sound Card"); ++MODULE_LICENSE("GPL v2"); + +From 2fc52b7468ac688af8a702978eb688fac59eb97b Mon Sep 17 00:00:00 2001 +From: Eric Anholt <eric@anholt.net> +Date: Tue, 19 Apr 2016 15:55:02 -0700 +Subject: [PATCH 107/112] ARM: bcm2708: Enable building power domain driver. + +Signed-off-by: Eric Anholt <eric@anholt.net> +--- + drivers/soc/bcm/Kconfig | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/soc/bcm/Kconfig b/drivers/soc/bcm/Kconfig +index 3066ede..e235181 100644 +--- a/drivers/soc/bcm/Kconfig ++++ b/drivers/soc/bcm/Kconfig +@@ -1,6 +1,6 @@ + config RASPBERRYPI_POWER + bool "Raspberry Pi power domain driver" +- depends on ARCH_BCM2835 || COMPILE_TEST ++ depends on ARCH_BCM2835 || ARCH_BCM2708 || ARCH_BCM2709 || COMPILE_TEST + depends on RASPBERRYPI_FIRMWARE=y + select PM_GENERIC_DOMAINS if PM + select PM_GENERIC_DOMAINS_OF if PM + +From 1acf838a61e40b5f1a59152810802e6e2db3d273 Mon Sep 17 00:00:00 2001 +From: Andrey Grodzovsky <andrey2805@gmail.com> +Date: Tue, 3 May 2016 22:10:59 -0400 +Subject: [PATCH 108/112] ARM: adau1977-adc: Add basic machine driver for + adau1977 codec driver. + +This commit adds basic support for the codec usage including: Device tree overlay, +binding I2S bus and setting I2S mode, clock source and frequency setting according +to spec. + +Signed-off-by: Andrey Grodzovsky <andrey2805@gmail.com> +--- + sound/soc/bcm/Kconfig | 7 +++ + sound/soc/bcm/Makefile | 2 + + sound/soc/bcm/adau1977-adc.c | 125 +++++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 134 insertions(+) + create mode 100644 sound/soc/bcm/adau1977-adc.c + +diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig +index e2e2782..59890cc 100644 +--- a/sound/soc/bcm/Kconfig ++++ b/sound/soc/bcm/Kconfig +@@ -78,3 +78,10 @@ config SND_BCM2708_SOC_RASPIDAC3 + select SND_SOC_TPA6130A2 + help + Say Y or M if you want to add support for RaspiDAC Rev.3x. ++ ++config SND_BCM2708_SOC_ADAU1977_ADC ++ tristate "Support for ADAU1977 ADC" ++ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S ++ select SND_SOC_ADAU1977_I2C ++ help ++ Say Y or M if you want to add support for ADAU1977 ADC. +diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile +index 6c9714c..d3124f5 100644 +--- a/sound/soc/bcm/Makefile ++++ b/sound/soc/bcm/Makefile +@@ -4,6 +4,7 @@ snd-soc-bcm2835-i2s-objs := bcm2835-i2s.o + obj-$(CONFIG_SND_BCM2835_SOC_I2S) += snd-soc-bcm2835-i2s.o + + # BCM2708 Machine Support ++snd-soc-adau1977-adc-objs := adau1977-adc.o + snd-soc-hifiberry-dac-objs := hifiberry_dac.o + snd-soc-hifiberry-dacplus-objs := hifiberry_dacplus.o + snd-soc-hifiberry-digi-objs := hifiberry_digi.o +@@ -15,6 +16,7 @@ snd-soc-rpi-proto-objs := rpi-proto.o + snd-soc-iqaudio-dac-objs := iqaudio-dac.o + snd-soc-raspidac3-objs := raspidac3.o + ++obj-$(CONFIG_SND_BCM2708_SOC_ADAU1977_ADC) += snd-soc-adau1977-adc.o + obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o + obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS) += snd-soc-hifiberry-dacplus.o + obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI) += snd-soc-hifiberry-digi.o +diff --git a/sound/soc/bcm/adau1977-adc.c b/sound/soc/bcm/adau1977-adc.c +new file mode 100644 +index 0000000..6e2ee02 +--- /dev/null ++++ b/sound/soc/bcm/adau1977-adc.c +@@ -0,0 +1,125 @@ ++/* ++ * ASoC Driver for ADAU1977 ADC ++ * ++ * Author: Andrey Grodzovsky <andrey2805@gmail.com> ++ * Copyright 2016 ++ * ++ * This file is based on hifibery_dac driver by Florian Meier. ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * version 2 as published by the Free Software Foundation. ++ * ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * General Public License for more details. ++ */ ++ ++#include <linux/module.h> ++#include <linux/platform_device.h> ++ ++#include <sound/core.h> ++#include <sound/pcm.h> ++#include <sound/pcm_params.h> ++#include <sound/soc.h> ++#include <sound/jack.h> ++ ++enum adau1977_clk_id { ++ ADAU1977_SYSCLK, ++}; ++ ++enum adau1977_sysclk_src { ++ ADAU1977_SYSCLK_SRC_MCLK, ++ ADAU1977_SYSCLK_SRC_LRCLK, ++}; ++ ++static int eval_adau1977_init(struct snd_soc_pcm_runtime *rtd) ++{ ++ int ret; ++ struct snd_soc_dai *codec_dai = rtd->codec_dai; ++ ++ ret = snd_soc_dai_set_tdm_slot(codec_dai, 0, 0, 0, 0); ++ if (ret < 0) ++ return ret; ++ ++ return snd_soc_codec_set_sysclk(rtd->codec, ADAU1977_SYSCLK, ++ ADAU1977_SYSCLK_SRC_MCLK, 11289600, SND_SOC_CLOCK_IN); ++} ++ ++static struct snd_soc_dai_link snd_rpi_adau1977_dai[] = { ++ { ++ .name = "adau1977", ++ .stream_name = "ADAU1977", ++ .cpu_dai_name = "bcm2708-i2s.0", ++ .codec_dai_name = "adau1977-hifi", ++ .platform_name = "bcm2708-i2s.0", ++ .codec_name = "adau1977.1-0011", ++ .init = eval_adau1977_init, ++ .dai_fmt = SND_SOC_DAIFMT_I2S | ++ SND_SOC_DAIFMT_NB_NF | ++ SND_SOC_DAIFMT_CBM_CFM, ++ }, ++}; ++ ++/* audio machine driver */ ++static struct snd_soc_card snd_adau1977_adc = { ++ .name = "snd_rpi_adau1977_adc", ++ .owner = THIS_MODULE, ++ .dai_link = snd_rpi_adau1977_dai, ++ .num_links = ARRAY_SIZE(snd_rpi_adau1977_dai), ++}; ++ ++static int snd_adau1977_adc_probe(struct platform_device *pdev) ++{ ++ int ret = 0; ++ ++ snd_adau1977_adc.dev = &pdev->dev; ++ if (pdev->dev.of_node) { ++ struct device_node *i2s_node; ++ struct snd_soc_dai_link *dai = &snd_rpi_adau1977_dai[0]; ++ i2s_node = of_parse_phandle(pdev->dev.of_node, ++ "i2s-controller", 0); ++ ++ if (i2s_node) { ++ dai->cpu_dai_name = NULL; ++ dai->cpu_of_node = i2s_node; ++ dai->platform_name = NULL; ++ dai->platform_of_node = i2s_node; ++ } ++ } ++ ++ ret = snd_soc_register_card(&snd_adau1977_adc); ++ if (ret) ++ dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", ret); ++ ++ return ret; ++} ++ ++static int snd_adau1977_adc_remove(struct platform_device *pdev) ++{ ++ return snd_soc_unregister_card(&snd_adau1977_adc); ++} ++ ++static const struct of_device_id snd_adau1977_adc_of_match[] = { ++ { .compatible = "adi,adau1977-adc", }, ++ {}, ++}; ++ ++MODULE_DEVICE_TABLE(of, snd_adau1977_adc_of_match); ++ ++static struct platform_driver snd_adau1977_adc_driver = { ++ .driver = { ++ .name = "snd-adau1977-adc", ++ .owner = THIS_MODULE, ++ .of_match_table = snd_adau1977_adc_of_match, ++ }, ++ .probe = snd_adau1977_adc_probe, ++ .remove = snd_adau1977_adc_remove, ++}; ++ ++module_platform_driver(snd_adau1977_adc_driver); ++ ++MODULE_AUTHOR("Andrey Grodzovsky <andrey2805@gmail.com>"); ++MODULE_DESCRIPTION("ASoC Driver for ADAU1977 ADC"); ++MODULE_LICENSE("GPL v2"); + +From ae03e3ad4d50779677d0cf9ca847c8a1b4372e1c Mon Sep 17 00:00:00 2001 +From: Matt Flax <flatmax@flatmax.org> +Date: Mon, 16 May 2016 21:36:31 +1000 +Subject: [PATCH 109/112] New AudioInjector.net Pi soundcard with low jitter + audio in and out. + +Contains the sound/soc/bcm ALSA machine driver and necessary alterations to the Kconfig and Makefile. +Adds the dts overlay and updates the Makefile and README. +Updates the relevant defconfig files to enable building for the Raspberry Pi. +Thanks to Phil Elwell (pelwell) for the review, simple-card concepts and discussion. Thanks to Clive Messer for overlay naming suggestions. +--- + sound/soc/bcm/Kconfig | 7 ++ + sound/soc/bcm/Makefile | 3 + + sound/soc/bcm/audioinjector-pi-soundcard.c | 142 +++++++++++++++++++++++++++++ + 3 files changed, 152 insertions(+) + create mode 100644 sound/soc/bcm/audioinjector-pi-soundcard.c + +diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig +index 59890cc..e2e40ed 100644 +--- a/sound/soc/bcm/Kconfig ++++ b/sound/soc/bcm/Kconfig +@@ -85,3 +85,10 @@ config SND_BCM2708_SOC_ADAU1977_ADC + select SND_SOC_ADAU1977_I2C + help + Say Y or M if you want to add support for ADAU1977 ADC. ++ ++config SND_AUDIOINJECTOR_PI_SOUNDCARD ++ tristate "Support for audioinjector.net Pi add on soundcard" ++ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S ++ select SND_SOC_WM8731 ++ help ++ Say Y or M if you want to add support for audioinjector.net Pi Hat +diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile +index d3124f5..3353192 100644 +--- a/sound/soc/bcm/Makefile ++++ b/sound/soc/bcm/Makefile +@@ -15,6 +15,7 @@ snd-soc-rpi-dac-objs := rpi-dac.o + snd-soc-rpi-proto-objs := rpi-proto.o + snd-soc-iqaudio-dac-objs := iqaudio-dac.o + snd-soc-raspidac3-objs := raspidac3.o ++snd-soc-audioinjector-pi-soundcard-objs := audioinjector-pi-soundcard.o + + obj-$(CONFIG_SND_BCM2708_SOC_ADAU1977_ADC) += snd-soc-adau1977-adc.o + obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o +@@ -27,3 +28,5 @@ obj-$(CONFIG_SND_BCM2708_SOC_RPI_DAC) += snd-soc-rpi-dac.o + obj-$(CONFIG_SND_BCM2708_SOC_RPI_PROTO) += snd-soc-rpi-proto.o + obj-$(CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC) += snd-soc-iqaudio-dac.o + obj-$(CONFIG_SND_BCM2708_SOC_RASPIDAC3) += snd-soc-raspidac3.o ++obj-$(CONFIG_SND_AUDIOINJECTOR_PI_SOUNDCARD) += snd-soc-audioinjector-pi-soundcard.o ++ +diff --git a/sound/soc/bcm/audioinjector-pi-soundcard.c b/sound/soc/bcm/audioinjector-pi-soundcard.c +new file mode 100644 +index 0000000..39f29e2 +--- /dev/null ++++ b/sound/soc/bcm/audioinjector-pi-soundcard.c +@@ -0,0 +1,142 @@ ++/* ++ * ASoC Driver for AudioInjector Pi add on soundcard ++ * ++ * Created on: 13-May-2016 ++ * Author: flatmax@flatmax.org ++ * based on code by Cliff Cai <Cliff.Cai@analog.com> for the ssm2602 machine blackfin. ++ * with help from Lars-Peter Clausen for simplifying the original code to use the dai_fmt field. ++ * i2s_node code taken from the other sound/soc/bcm machine drivers. ++ * ++ * Copyright (C) 2016 Flatmax Pty. Ltd. ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * version 2 as published by the Free Software Foundation. ++ * ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * General Public License for more details. ++ */ ++ ++#include <linux/module.h> ++#include <linux/types.h> ++ ++#include <sound/core.h> ++#include <sound/soc.h> ++#include <sound/pcm_params.h> ++#include <sound/control.h> ++ ++#include "../codecs/wm8731.h" ++ ++static int audioinjector_pi_soundcard_dai_init(struct snd_soc_pcm_runtime *rtd) ++{ ++ struct snd_soc_dapm_context *dapm = &rtd->card->dapm; ++ ++ // not connected ++ snd_soc_dapm_nc_pin(dapm, "Mic Bias"); ++ snd_soc_dapm_nc_pin(dapm, "MICIN"); ++ snd_soc_dapm_nc_pin(dapm, "RHPOUT"); ++ snd_soc_dapm_nc_pin(dapm, "LHPOUT"); ++ ++ return snd_soc_dai_set_sysclk(rtd->codec_dai, WM8731_SYSCLK_XTAL, 12000000, SND_SOC_CLOCK_IN); ++} ++ ++static struct snd_soc_dai_link audioinjector_pi_soundcard_dai[] = { ++ { ++ .name = "AudioInjector audio", ++ .stream_name = "AudioInjector audio", ++ .cpu_dai_name = "bcm2708-i2s.0", ++ .codec_dai_name = "wm8731-hifi", ++ .platform_name = "bcm2835-i2s.0", ++ .codec_name = "wm8731.1-001a", ++ .init = audioinjector_pi_soundcard_dai_init, ++ .dai_fmt = SND_SOC_DAIFMT_CBM_CFM|SND_SOC_DAIFMT_I2S|SND_SOC_DAIFMT_NB_NF, ++ }, ++}; ++ ++static const struct snd_soc_dapm_widget wm8731_dapm_widgets[] = { ++ SND_SOC_DAPM_SPK("Ext Spk", NULL), ++ SND_SOC_DAPM_LINE("Line In Jacks", NULL), ++}; ++ ++/* Corgi machine connections to the codec pins */ ++static const struct snd_soc_dapm_route audioinjector_audio_map[] = { ++ /* speaker connected to LOUT, ROUT */ ++ {"Ext Spk", NULL, "ROUT"}, ++ {"Ext Spk", NULL, "LOUT"}, ++ ++ /* line inputs */ ++ {"Line In Jacks", NULL, "Line Input"}, ++}; ++ ++static struct snd_soc_card snd_soc_audioinjector = { ++ .name = "audioinjector-pi-soundcard", ++ .dai_link = audioinjector_pi_soundcard_dai, ++ .num_links = 1, ++ ++ .dapm_widgets = wm8731_dapm_widgets, ++ .num_dapm_widgets = ARRAY_SIZE(wm8731_dapm_widgets), ++ .dapm_routes = audioinjector_audio_map, ++ .num_dapm_routes = ARRAY_SIZE(audioinjector_audio_map), ++}; ++ ++static int audioinjector_pi_soundcard_probe(struct platform_device *pdev) ++{ ++ struct snd_soc_card *card = &snd_soc_audioinjector; ++ int ret; ++ ++ card->dev = &pdev->dev; ++ ++ if (pdev->dev.of_node) { ++ struct snd_soc_dai_link *dai = &audioinjector_pi_soundcard_dai[0]; ++ struct device_node *i2s_node = of_parse_phandle(pdev->dev.of_node, ++ "i2s-controller", 0); ++ ++ if (i2s_node) { ++ dai->cpu_dai_name = NULL; ++ dai->cpu_of_node = i2s_node; ++ dai->platform_name = NULL; ++ dai->platform_of_node = i2s_node; ++ } else ++ if (!dai->cpu_of_node) { ++ dev_err(&pdev->dev, "Property 'i2s-controller' missing or invalid\n"); ++ return -EINVAL; ++ } ++ } ++ ++ if ((ret = snd_soc_register_card(card))) { ++ dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", ret); ++ } ++ return ret; ++} ++ ++static int audioinjector_pi_soundcard_remove(struct platform_device *pdev) ++{ ++ struct snd_soc_card *card = platform_get_drvdata(pdev); ++ return snd_soc_unregister_card(card); ++ ++} ++ ++static const struct of_device_id audioinjector_pi_soundcard_of_match[] = { ++ { .compatible = "ai,audioinjector-pi-soundcard", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, audioinjector_pi_soundcard_of_match); ++ ++static struct platform_driver audioinjector_pi_soundcard_driver = { ++ .driver = { ++ .name = "audioinjector-audio", ++ .owner = THIS_MODULE, ++ .of_match_table = audioinjector_pi_soundcard_of_match, ++ }, ++ .probe = audioinjector_pi_soundcard_probe, ++ .remove = audioinjector_pi_soundcard_remove, ++}; ++ ++module_platform_driver(audioinjector_pi_soundcard_driver); ++MODULE_AUTHOR("Matt Flax <flatmax@flatmax.org>"); ++MODULE_DESCRIPTION("AudioInjector.net Pi Soundcard"); ++MODULE_LICENSE("GPL v2"); ++MODULE_ALIAS("platform:audioinjector-pi-soundcard"); ++ + +From aa9aed28809dbf4d95025626cb5de26b7da023d1 Mon Sep 17 00:00:00 2001 +From: Dave Stevenson <6by9@users.noreply.github.com> +Date: Wed, 25 May 2016 23:25:36 +0100 +Subject: [PATCH 110/112] BCM2835-V4L2: Correct handling for BGR24 vs RGB24. + +There was a bug in the GPU firmware that had reversed these +two formats. +Detect the old firmware, and reverse the formats if necessary. + +Signed-off-by: Dave Stevenson <6by9@users.noreply.github.com> +--- + drivers/media/platform/bcm2835/bcm2835-camera.c | 69 ++++++++++++++++++------- + drivers/media/platform/bcm2835/bcm2835-camera.h | 1 + + 2 files changed, 52 insertions(+), 18 deletions(-) + +diff --git a/drivers/media/platform/bcm2835/bcm2835-camera.c b/drivers/media/platform/bcm2835/bcm2835-camera.c +index 1b16c63..70f4db2 100644 +--- a/drivers/media/platform/bcm2835/bcm2835-camera.c ++++ b/drivers/media/platform/bcm2835/bcm2835-camera.c +@@ -115,7 +115,7 @@ static struct mmal_fmt formats[] = { + .name = "RGB24 (LE)", + .fourcc = V4L2_PIX_FMT_RGB24, + .flags = 0, +- .mmal = MMAL_ENCODING_BGR24, ++ .mmal = MMAL_ENCODING_RGB24, + .depth = 24, + .mmal_component = MMAL_COMPONENT_CAMERA, + .ybbp = 3, +@@ -187,7 +187,7 @@ static struct mmal_fmt formats[] = { + .name = "RGB24 (BE)", + .fourcc = V4L2_PIX_FMT_BGR24, + .flags = 0, +- .mmal = MMAL_ENCODING_RGB24, ++ .mmal = MMAL_ENCODING_BGR24, + .depth = 24, + .mmal_component = MMAL_COMPONENT_CAMERA, + .ybbp = 3, +@@ -1061,6 +1061,13 @@ static int mmal_setup_components(struct bm2835_mmal_dev *dev, + else + camera_port->format.encoding = mfmt->mmal; + ++ if (dev->rgb_bgr_swapped) { ++ if (camera_port->format.encoding == MMAL_ENCODING_RGB24) ++ camera_port->format.encoding = MMAL_ENCODING_BGR24; ++ else if (camera_port->format.encoding == MMAL_ENCODING_BGR24) ++ camera_port->format.encoding = MMAL_ENCODING_RGB24; ++ } ++ + camera_port->format.encoding_variant = 0; + camera_port->es.video.width = f->fmt.pix.width; + camera_port->es.video.height = f->fmt.pix.height; +@@ -1571,12 +1578,17 @@ static int set_camera_parameters(struct vchiq_mmal_instance *instance, + return ret; + } + ++#define MAX_SUPPORTED_ENCODINGS 20 ++ + /* MMAL instance and component init */ + static int __init mmal_init(struct bm2835_mmal_dev *dev) + { + int ret; + struct mmal_es_format *format; + u32 bool_true = 1; ++ u32 supported_encodings[MAX_SUPPORTED_ENCODINGS]; ++ int param_size; ++ struct vchiq_mmal_component *camera; + + ret = vchiq_mmal_init(&dev->instance); + if (ret < 0) +@@ -1588,21 +1600,48 @@ static int __init mmal_init(struct bm2835_mmal_dev *dev) + if (ret < 0) + goto unreg_mmal; + +- if (dev->component[MMAL_COMPONENT_CAMERA]->outputs < +- MMAL_CAMERA_PORT_COUNT) { ++ camera = dev->component[MMAL_COMPONENT_CAMERA]; ++ if (camera->outputs < MMAL_CAMERA_PORT_COUNT) { + ret = -EINVAL; + goto unreg_camera; + } + + ret = set_camera_parameters(dev->instance, +- dev->component[MMAL_COMPONENT_CAMERA], ++ camera, + dev); + if (ret < 0) + goto unreg_camera; + +- format = +- &dev->component[MMAL_COMPONENT_CAMERA]-> +- output[MMAL_CAMERA_PORT_PREVIEW].format; ++ /* There was an error in the firmware that meant the camera component ++ * produced BGR instead of RGB. ++ * This is now fixed, but in order to support the old firmwares, we ++ * have to check. ++ */ ++ dev->rgb_bgr_swapped = true; ++ param_size = sizeof(supported_encodings); ++ ret = vchiq_mmal_port_parameter_get(dev->instance, ++ &camera->output[MMAL_CAMERA_PORT_CAPTURE], ++ MMAL_PARAMETER_SUPPORTED_ENCODINGS, ++ &supported_encodings, ++ &param_size); ++ if (ret == 0) { ++ int i; ++ ++ for (i = 0; i < param_size/sizeof(u32); i++) { ++ if (supported_encodings[i] == MMAL_ENCODING_BGR24) { ++ /* Found BGR24 first - old firmware. */ ++ break; ++ } ++ if (supported_encodings[i] == MMAL_ENCODING_RGB24) { ++ /* Found RGB24 first ++ * new firmware, so use RGB24. ++ */ ++ dev->rgb_bgr_swapped = false; ++ break; ++ } ++ } ++ } ++ format = &camera->output[MMAL_CAMERA_PORT_PREVIEW].format; + + format->encoding = MMAL_ENCODING_OPAQUE; + format->encoding_variant = MMAL_ENCODING_I420; +@@ -1616,9 +1655,7 @@ static int __init mmal_init(struct bm2835_mmal_dev *dev) + format->es->video.frame_rate.num = 0; /* Rely on fps_range */ + format->es->video.frame_rate.den = 1; + +- format = +- &dev->component[MMAL_COMPONENT_CAMERA]-> +- output[MMAL_CAMERA_PORT_VIDEO].format; ++ format = &camera->output[MMAL_CAMERA_PORT_VIDEO].format; + + format->encoding = MMAL_ENCODING_OPAQUE; + format->encoding_variant = MMAL_ENCODING_I420; +@@ -1633,14 +1670,11 @@ static int __init mmal_init(struct bm2835_mmal_dev *dev) + format->es->video.frame_rate.den = 1; + + vchiq_mmal_port_parameter_set(dev->instance, +- &dev->component[MMAL_COMPONENT_CAMERA]-> +- output[MMAL_CAMERA_PORT_VIDEO], ++ &camera->output[MMAL_CAMERA_PORT_VIDEO], + MMAL_PARAMETER_NO_IMAGE_PADDING, + &bool_true, sizeof(bool_true)); + +- format = +- &dev->component[MMAL_COMPONENT_CAMERA]-> +- output[MMAL_CAMERA_PORT_CAPTURE].format; ++ format = &camera->output[MMAL_CAMERA_PORT_CAPTURE].format; + + format->encoding = MMAL_ENCODING_OPAQUE; + +@@ -1662,8 +1696,7 @@ static int __init mmal_init(struct bm2835_mmal_dev *dev) + dev->capture.enc_level = V4L2_MPEG_VIDEO_H264_LEVEL_4_0; + + vchiq_mmal_port_parameter_set(dev->instance, +- &dev->component[MMAL_COMPONENT_CAMERA]-> +- output[MMAL_CAMERA_PORT_CAPTURE], ++ &camera->output[MMAL_CAMERA_PORT_CAPTURE], + MMAL_PARAMETER_NO_IMAGE_PADDING, + &bool_true, sizeof(bool_true)); + +diff --git a/drivers/media/platform/bcm2835/bcm2835-camera.h b/drivers/media/platform/bcm2835/bcm2835-camera.h +index 13f426f..e6aeb7e 100644 +--- a/drivers/media/platform/bcm2835/bcm2835-camera.h ++++ b/drivers/media/platform/bcm2835/bcm2835-camera.h +@@ -109,6 +109,7 @@ struct bm2835_mmal_dev { + unsigned int camera_num; + unsigned int max_width; + unsigned int max_height; ++ unsigned int rgb_bgr_swapped; + }; + + int bm2835_mmal_init_controls( + +From e17217216036509a8711ab042e4808b0b4c59a66 Mon Sep 17 00:00:00 2001 +From: escalator2015 <jmtasende@gmail.com> +Date: Tue, 24 May 2016 16:20:09 +0100 +Subject: [PATCH 111/112] New driver for RRA DigiDAC1 soundcard using WM8741 + + WM8804 + +--- + arch/arm/configs/bcm2709_defconfig | 1 + + arch/arm/configs/bcmrpi_defconfig | 1 + + sound/soc/bcm/Kconfig | 8 + + sound/soc/bcm/Makefile | 2 + + sound/soc/bcm/digidac1-soundcard.c | 422 +++++++++++++++++++++++++++++++++++++ + 5 files changed, 434 insertions(+) + create mode 100644 sound/soc/bcm/digidac1-soundcard.c + +diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig +index 055ecfc..1643dab 100644 +--- a/arch/arm/configs/bcm2709_defconfig ++++ b/arch/arm/configs/bcm2709_defconfig +@@ -862,6 +862,7 @@ CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC=m + CONFIG_SND_BCM2708_SOC_RASPIDAC3=m + CONFIG_SND_BCM2708_SOC_ADAU1977_ADC=m + CONFIG_SND_AUDIOINJECTOR_PI_SOUNDCARD=m ++CONFIG_SND_DIGIDAC1_SOUNDCARD=m + CONFIG_SND_SOC_ADAU1701=m + CONFIG_SND_SOC_WM8804_I2C=m + CONFIG_SND_SIMPLE_CARD=m +diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig +index 8e0b51f..d936b43 100644 +--- a/arch/arm/configs/bcmrpi_defconfig ++++ b/arch/arm/configs/bcmrpi_defconfig +@@ -854,6 +854,7 @@ CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC=m + CONFIG_SND_BCM2708_SOC_RASPIDAC3=m + CONFIG_SND_BCM2708_SOC_ADAU1977_ADC=m + CONFIG_SND_AUDIOINJECTOR_PI_SOUNDCARD=m ++CONFIG_SND_DIGIDAC1_SOUNDCARD=m + CONFIG_SND_SOC_ADAU1701=m + CONFIG_SND_SOC_WM8804_I2C=m + CONFIG_SND_SIMPLE_CARD=m +diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig +index e2e40ed..fa11cd7 100644 +--- a/sound/soc/bcm/Kconfig ++++ b/sound/soc/bcm/Kconfig +@@ -92,3 +92,11 @@ config SND_AUDIOINJECTOR_PI_SOUNDCARD + select SND_SOC_WM8731 + help + Say Y or M if you want to add support for audioinjector.net Pi Hat ++ ++config SND_DIGIDAC1_SOUNDCARD ++ tristate "Support for Red Rocks Audio DigiDAC1" ++ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S ++ select SND_SOC_WM8804 ++ select SND_SOC_WM8741 ++ help ++ Say Y or M if you want to add support for Red Rocks Audio DigiDAC1 board. +diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile +index 3353192..a9448fd 100644 +--- a/sound/soc/bcm/Makefile ++++ b/sound/soc/bcm/Makefile +@@ -16,6 +16,7 @@ snd-soc-rpi-proto-objs := rpi-proto.o + snd-soc-iqaudio-dac-objs := iqaudio-dac.o + snd-soc-raspidac3-objs := raspidac3.o + snd-soc-audioinjector-pi-soundcard-objs := audioinjector-pi-soundcard.o ++snd-soc-digidac1-soundcard-objs := digidac1-soundcard.o + + obj-$(CONFIG_SND_BCM2708_SOC_ADAU1977_ADC) += snd-soc-adau1977-adc.o + obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o +@@ -29,4 +30,5 @@ obj-$(CONFIG_SND_BCM2708_SOC_RPI_PROTO) += snd-soc-rpi-proto.o + obj-$(CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC) += snd-soc-iqaudio-dac.o + obj-$(CONFIG_SND_BCM2708_SOC_RASPIDAC3) += snd-soc-raspidac3.o + obj-$(CONFIG_SND_AUDIOINJECTOR_PI_SOUNDCARD) += snd-soc-audioinjector-pi-soundcard.o ++obj-$(CONFIG_SND_DIGIDAC1_SOUNDCARD) += snd-soc-digidac1-soundcard.o + +diff --git a/sound/soc/bcm/digidac1-soundcard.c b/sound/soc/bcm/digidac1-soundcard.c +new file mode 100644 +index 0000000..446796e +--- /dev/null ++++ b/sound/soc/bcm/digidac1-soundcard.c +@@ -0,0 +1,422 @@ ++/* ++ * ASoC Driver for RRA DigiDAC1 ++ * Copyright 2016 ++ * Author: José M. Tasende <vintage@redrocksaudio.es> ++ * based on the HifiBerry DAC driver by Florian Meier <florian.meier@koalo.de> ++ * and the Wolfson card driver by Nikesh Oswal, <Nikesh.Oswal@wolfsonmicro.com> ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * version 2 as published by the Free Software Foundation. ++ * ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * General Public License for more details. ++ */ ++ ++#include <linux/module.h> ++#include <linux/platform_device.h> ++#include <linux/i2c.h> ++#include <sound/core.h> ++#include <sound/pcm.h> ++#include <sound/pcm_params.h> ++#include <sound/soc.h> ++#include <sound/jack.h> ++#include <sound/soc-dapm.h> ++#include <sound/tlv.h> ++#include <linux/regulator/consumer.h> ++ ++#include "../codecs/wm8804.h" ++#include "../codecs/wm8741.h" ++ ++#define WM8741_NUM_SUPPLIES 2 ++ ++/* codec private data */ ++struct wm8741_priv { ++ struct wm8741_platform_data pdata; ++ struct regmap *regmap; ++ struct regulator_bulk_data supplies[WM8741_NUM_SUPPLIES]; ++ unsigned int sysclk; ++ const struct snd_pcm_hw_constraint_list *sysclk_constraints; ++}; ++ ++static int samplerate = 44100; ++ ++/* New Alsa Controls not exposed by original wm8741 codec driver */ ++/* in actual driver the att. adjustment is wrong because */ ++/* this DAC has a coarse attenuation register with 4dB steps */ ++/* and a fine level register with 0.125dB steps */ ++/* each register has 32 steps so combining both we have 1024 steps */ ++/* of 0.125 dB. */ ++/* The original level controls from driver are removed at startup */ ++/* and replaced by the corrected ones. */ ++/* The same wm8741 driver can be used for wm8741 and wm8742 devices */ ++ ++static const DECLARE_TLV_DB_SCALE(dac_tlv_fine, 0, 13, 0); ++static const DECLARE_TLV_DB_SCALE(dac_tlv_coarse, -12700, 400, 1); ++static const char *w8741_dither[4] = {"Off", "RPDF", "TPDF", "HPDF"}; ++static const char *w8741_filter[5] = { ++ "Type 1", "Type 2", "Type 3", "Type 4", "Type 5"}; ++static const char *w8741_switch[2] = {"Off", "On"}; ++static const struct soc_enum w8741_enum[] = { ++SOC_ENUM_SINGLE(WM8741_MODE_CONTROL_2, 0, 4, w8741_dither),/* dithering type */ ++SOC_ENUM_SINGLE(WM8741_FILTER_CONTROL, 0, 5, w8741_filter),/* filter type */ ++SOC_ENUM_SINGLE(WM8741_FORMAT_CONTROL, 6, 2, w8741_switch),/* phase invert */ ++SOC_ENUM_SINGLE(WM8741_VOLUME_CONTROL, 0, 2, w8741_switch),/* volume ramp */ ++SOC_ENUM_SINGLE(WM8741_VOLUME_CONTROL, 3, 2, w8741_switch),/* soft mute */ ++}; ++ ++static const struct snd_kcontrol_new w8741_snd_controls_stereo[] = { ++SOC_DOUBLE_R_TLV("DAC Fine Playback Volume", WM8741_DACLLSB_ATTENUATION, ++ WM8741_DACRLSB_ATTENUATION, 0, 31, 1, dac_tlv_fine), ++SOC_DOUBLE_R_TLV("Digital Playback Volume", WM8741_DACLMSB_ATTENUATION, ++ WM8741_DACRMSB_ATTENUATION, 0, 31, 1, dac_tlv_coarse), ++SOC_ENUM("DAC Dither", w8741_enum[0]), ++SOC_ENUM("DAC Digital Filter", w8741_enum[1]), ++SOC_ENUM("DAC Phase Invert", w8741_enum[2]), ++SOC_ENUM("DAC Volume Ramp", w8741_enum[3]), ++SOC_ENUM("DAC Soft Mute", w8741_enum[4]), ++}; ++ ++static const struct snd_kcontrol_new w8741_snd_controls_mono_left[] = { ++SOC_SINGLE_TLV("DAC Fine Playback Volume", WM8741_DACLLSB_ATTENUATION, ++ 0, 31, 0, dac_tlv_fine), ++SOC_SINGLE_TLV("Digital Playback Volume", WM8741_DACLMSB_ATTENUATION, ++ 0, 31, 1, dac_tlv_coarse), ++SOC_ENUM("DAC Dither", w8741_enum[0]), ++SOC_ENUM("DAC Digital Filter", w8741_enum[1]), ++SOC_ENUM("DAC Phase Invert", w8741_enum[2]), ++SOC_ENUM("DAC Volume Ramp", w8741_enum[3]), ++SOC_ENUM("DAC Soft Mute", w8741_enum[4]), ++}; ++ ++static const struct snd_kcontrol_new w8741_snd_controls_mono_right[] = { ++SOC_SINGLE_TLV("DAC Fine Playback Volume", WM8741_DACRLSB_ATTENUATION, ++ 0, 31, 0, dac_tlv_fine), ++SOC_SINGLE_TLV("Digital Playback Volume", WM8741_DACRMSB_ATTENUATION, ++ 0, 31, 1, dac_tlv_coarse), ++SOC_ENUM("DAC Dither", w8741_enum[0]), ++SOC_ENUM("DAC Digital Filter", w8741_enum[1]), ++SOC_ENUM("DAC Phase Invert", w8741_enum[2]), ++SOC_ENUM("DAC Volume Ramp", w8741_enum[3]), ++SOC_ENUM("DAC Soft Mute", w8741_enum[4]), ++}; ++ ++static int w8741_add_controls(struct snd_soc_codec *codec) ++{ ++ struct wm8741_priv *wm8741 = snd_soc_codec_get_drvdata(codec); ++ ++ switch (wm8741->pdata.diff_mode) { ++ case WM8741_DIFF_MODE_STEREO: ++ case WM8741_DIFF_MODE_STEREO_REVERSED: ++ snd_soc_add_codec_controls(codec, ++ w8741_snd_controls_stereo, ++ ARRAY_SIZE(w8741_snd_controls_stereo)); ++ break; ++ case WM8741_DIFF_MODE_MONO_LEFT: ++ snd_soc_add_codec_controls(codec, ++ w8741_snd_controls_mono_left, ++ ARRAY_SIZE(w8741_snd_controls_mono_left)); ++ break; ++ case WM8741_DIFF_MODE_MONO_RIGHT: ++ snd_soc_add_codec_controls(codec, ++ w8741_snd_controls_mono_right, ++ ARRAY_SIZE(w8741_snd_controls_mono_right)); ++ break; ++ default: ++ return -EINVAL; ++ } ++ ++ return 0; ++} ++ ++static int digidac1_soundcard_init(struct snd_soc_pcm_runtime *rtd) ++{ ++ struct snd_soc_codec *codec = rtd->codec; ++ struct snd_soc_card *card = rtd->card; ++ struct snd_soc_pcm_runtime *wm8741_rtd; ++ struct snd_soc_codec *wm8741_codec; ++ struct snd_card *sound_card = card->snd_card; ++ struct snd_kcontrol *kctl; ++ int ret; ++ ++ wm8741_rtd = snd_soc_get_pcm_runtime(card, card->dai_link[1].name); ++ if (!wm8741_rtd) { ++ dev_warn(card->dev, "digidac1_soundcard_init: couldn't get wm8741 rtd\n"); ++ return -EFAULT; ++ } ++ wm8741_codec = wm8741_rtd->codec; ++ ret = w8741_add_controls(wm8741_codec); ++ if (ret < 0) ++ dev_warn(card->dev, "Failed to add new wm8741 controls: %d\n", ++ ret); ++ ++ /* enable TX output */ ++ snd_soc_update_bits(codec, WM8804_PWRDN, 0x4, 0x0); ++ ++ kctl = snd_soc_card_get_kcontrol(card, ++ "Playback Volume"); ++ if (kctl) { ++ kctl->vd[0].access = SNDRV_CTL_ELEM_ACCESS_READWRITE; ++ snd_ctl_remove(sound_card, kctl); ++ } ++ kctl = snd_soc_card_get_kcontrol(card, ++ "Fine Playback Volume"); ++ if (kctl) { ++ kctl->vd[0].access = SNDRV_CTL_ELEM_ACCESS_READWRITE; ++ snd_ctl_remove(sound_card, kctl); ++ } ++ return 0; ++} ++ ++static int digidac1_soundcard_startup(struct snd_pcm_substream *substream) ++{ ++ /* turn on wm8804 digital output */ ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_codec *codec = rtd->codec; ++ struct snd_soc_card *card = rtd->card; ++ struct snd_soc_pcm_runtime *wm8741_rtd; ++ struct snd_soc_codec *wm8741_codec; ++ ++ snd_soc_update_bits(codec, WM8804_PWRDN, 0x3c, 0x00); ++ wm8741_rtd = snd_soc_get_pcm_runtime(card, card->dai_link[1].name); ++ if (!wm8741_rtd) { ++ dev_warn(card->dev, "digidac1_soundcard_startup: couldn't get WM8741 rtd\n"); ++ return -EFAULT; ++ } ++ wm8741_codec = wm8741_rtd->codec; ++ ++ /* latch wm8741 level */ ++ snd_soc_update_bits(wm8741_codec, WM8741_DACLLSB_ATTENUATION, ++ WM8741_UPDATELL, WM8741_UPDATELL); ++ snd_soc_update_bits(wm8741_codec, WM8741_DACLMSB_ATTENUATION, ++ WM8741_UPDATELM, WM8741_UPDATELM); ++ snd_soc_update_bits(wm8741_codec, WM8741_DACRLSB_ATTENUATION, ++ WM8741_UPDATERL, WM8741_UPDATERL); ++ snd_soc_update_bits(wm8741_codec, WM8741_DACRMSB_ATTENUATION, ++ WM8741_UPDATERM, WM8741_UPDATERM); ++ ++ return 0; ++} ++ ++static void digidac1_soundcard_shutdown(struct snd_pcm_substream *substream) ++{ ++ /* turn off wm8804 digital output */ ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_codec *codec = rtd->codec; ++ ++ snd_soc_update_bits(codec, WM8804_PWRDN, 0x3c, 0x3c); ++} ++ ++static int digidac1_soundcard_hw_params(struct snd_pcm_substream *substream, ++ struct snd_pcm_hw_params *params) ++{ ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_dai *codec_dai = rtd->codec_dai; ++ struct snd_soc_codec *codec = rtd->codec; ++ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; ++ struct snd_soc_card *card = rtd->card; ++ struct snd_soc_pcm_runtime *wm8741_rtd; ++ struct snd_soc_codec *wm8741_codec; ++ ++ int sysclk = 27000000; ++ long mclk_freq = 0; ++ int mclk_div = 1; ++ int sampling_freq = 1; ++ int ret; ++ ++ wm8741_rtd = snd_soc_get_pcm_runtime(card, card->dai_link[1].name); ++ if (!wm8741_rtd) { ++ dev_warn(card->dev, "digidac1_soundcard_hw_params: couldn't get WM8741 rtd\n"); ++ return -EFAULT; ++ } ++ wm8741_codec = wm8741_rtd->codec; ++ samplerate = params_rate(params); ++ ++ if (samplerate <= 96000) { ++ mclk_freq = samplerate*256; ++ mclk_div = WM8804_MCLKDIV_256FS; ++ } else { ++ mclk_freq = samplerate*128; ++ mclk_div = WM8804_MCLKDIV_128FS; ++ } ++ ++ switch (samplerate) { ++ case 32000: ++ sampling_freq = 0x03; ++ break; ++ case 44100: ++ sampling_freq = 0x00; ++ break; ++ case 48000: ++ sampling_freq = 0x02; ++ break; ++ case 88200: ++ sampling_freq = 0x08; ++ break; ++ case 96000: ++ sampling_freq = 0x0a; ++ break; ++ case 176400: ++ sampling_freq = 0x0c; ++ break; ++ case 192000: ++ sampling_freq = 0x0e; ++ break; ++ default: ++ dev_err(codec->dev, ++ "Failed to set WM8804 SYSCLK, unsupported samplerate %d\n", ++ samplerate); ++ } ++ ++ snd_soc_dai_set_clkdiv(codec_dai, WM8804_MCLK_DIV, mclk_div); ++ snd_soc_dai_set_pll(codec_dai, 0, 0, sysclk, mclk_freq); ++ ++ ret = snd_soc_dai_set_sysclk(codec_dai, WM8804_TX_CLKSRC_PLL, ++ sysclk, SND_SOC_CLOCK_OUT); ++ if (ret < 0) { ++ dev_err(codec->dev, ++ "Failed to set WM8804 SYSCLK: %d\n", ret); ++ return ret; ++ } ++ /* Enable wm8804 TX output */ ++ snd_soc_update_bits(codec, WM8804_PWRDN, 0x4, 0x0); ++ ++ /* wm8804 Power on */ ++ snd_soc_update_bits(codec, WM8804_PWRDN, 0x9, 0); ++ ++ /* wm8804 set sampling frequency status bits */ ++ snd_soc_update_bits(codec, WM8804_SPDTX4, 0x0f, sampling_freq); ++ ++ /* Now update wm8741 registers for the correct oversampling */ ++ if (samplerate <= 48000) ++ snd_soc_update_bits(wm8741_codec, WM8741_MODE_CONTROL_1, ++ WM8741_OSR_MASK, 0x00); ++ else if (samplerate <= 96000) ++ snd_soc_update_bits(wm8741_codec, WM8741_MODE_CONTROL_1, ++ WM8741_OSR_MASK, 0x20); ++ else ++ snd_soc_update_bits(wm8741_codec, WM8741_MODE_CONTROL_1, ++ WM8741_OSR_MASK, 0x40); ++ ++ /* wm8741 bit size */ ++ switch (params_width(params)) { ++ case 16: ++ snd_soc_update_bits(wm8741_codec, WM8741_FORMAT_CONTROL, ++ WM8741_IWL_MASK, 0x00); ++ break; ++ case 20: ++ snd_soc_update_bits(wm8741_codec, WM8741_FORMAT_CONTROL, ++ WM8741_IWL_MASK, 0x01); ++ break; ++ case 24: ++ snd_soc_update_bits(wm8741_codec, WM8741_FORMAT_CONTROL, ++ WM8741_IWL_MASK, 0x02); ++ break; ++ case 32: ++ snd_soc_update_bits(wm8741_codec, WM8741_FORMAT_CONTROL, ++ WM8741_IWL_MASK, 0x03); ++ break; ++ default: ++ dev_dbg(codec->dev, "wm8741_hw_params: Unsupported bit size param = %d", ++ params_width(params)); ++ return -EINVAL; ++ } ++ ++ return snd_soc_dai_set_bclk_ratio(cpu_dai, 64); ++} ++/* machine stream operations */ ++static struct snd_soc_ops digidac1_soundcard_ops = { ++ .hw_params = digidac1_soundcard_hw_params, ++ .startup = digidac1_soundcard_startup, ++ .shutdown = digidac1_soundcard_shutdown, ++}; ++ ++static struct snd_soc_dai_link digidac1_soundcard_dai[] = { ++ { ++ .name = "RRA DigiDAC1", ++ .stream_name = "RRA DigiDAC1 HiFi", ++ .cpu_dai_name = "bcm2708-i2s.0", ++ .codec_dai_name = "wm8804-spdif", ++ .platform_name = "bcm2708-i2s.0", ++ .codec_name = "wm8804.1-003b", ++ .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | ++ SND_SOC_DAIFMT_CBM_CFM, ++ .ops = &digidac1_soundcard_ops, ++ .init = digidac1_soundcard_init, ++ }, ++ { ++ .name = "RRA DigiDAC11", ++ .stream_name = "RRA DigiDAC11 HiFi", ++ .cpu_dai_name = "wm8804-spdif", ++ .codec_dai_name = "wm8741", ++ .codec_name = "wm8741.1-001a", ++ .dai_fmt = SND_SOC_DAIFMT_I2S ++ | SND_SOC_DAIFMT_NB_NF ++ | SND_SOC_DAIFMT_CBS_CFS, ++ }, ++}; ++ ++/* audio machine driver */ ++static struct snd_soc_card digidac1_soundcard = { ++ .name = "digidac1-soundcard", ++ .owner = THIS_MODULE, ++ .dai_link = digidac1_soundcard_dai, ++ .num_links = ARRAY_SIZE(digidac1_soundcard_dai), ++}; ++ ++static int digidac1_soundcard_probe(struct platform_device *pdev) ++{ ++ int ret = 0; ++ ++ digidac1_soundcard.dev = &pdev->dev; ++ ++ if (pdev->dev.of_node) { ++ struct device_node *i2s_node; ++ struct snd_soc_dai_link *dai = &digidac1_soundcard_dai[0]; ++ ++ i2s_node = of_parse_phandle(pdev->dev.of_node, ++ "i2s-controller", 0); ++ ++ if (i2s_node) { ++ dai->cpu_dai_name = NULL; ++ dai->cpu_of_node = i2s_node; ++ dai->platform_name = NULL; ++ dai->platform_of_node = i2s_node; ++ } ++ } ++ ++ ret = snd_soc_register_card(&digidac1_soundcard); ++ if (ret) ++ dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", ++ ret); ++ ++ return ret; ++} ++ ++static int digidac1_soundcard_remove(struct platform_device *pdev) ++{ ++ return snd_soc_unregister_card(&digidac1_soundcard); ++} ++ ++static const struct of_device_id digidac1_soundcard_of_match[] = { ++ { .compatible = "rra,digidac1-soundcard", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, digidac1_soundcard_of_match); ++ ++static struct platform_driver digidac1_soundcard_driver = { ++ .driver = { ++ .name = "digidac1-audio", ++ .owner = THIS_MODULE, ++ .of_match_table = digidac1_soundcard_of_match, ++ }, ++ .probe = digidac1_soundcard_probe, ++ .remove = digidac1_soundcard_remove, ++}; ++ ++module_platform_driver(digidac1_soundcard_driver); ++ ++MODULE_AUTHOR("José M. Tasende <vintage@redrocksaudio.es>"); ++MODULE_DESCRIPTION("ASoC Driver for RRA DigiDAC1"); ++MODULE_LICENSE("GPL v2"); + +From 8f1f7957d7684294706126f51dc46e362d7822a4 Mon Sep 17 00:00:00 2001 +From: Phil Elwell <phil@raspberrypi.org> +Date: Fri, 3 Jun 2016 21:56:40 +0100 +Subject: [PATCH 112/112] BCM270X_DT: Fix rpi-dac overlay + +The rpi-dac overlay is almost identical to the hifiberry-dac overlay - +the codec used is different but it also doesn't sit on the I2C bus. As +a result, when the overlays were modified for dynamic loading and it +was discovered that the hifiberry-dac overlay didn't work any more, the +the rpi-dac overlay was also broken. + +The failure was caused by the fact that outside a bus, device names are +constructed from the concatenation of the path elements leading to it, +so moving the codec instantiation inside /soc caused the device name +to get a "soc" added, breaking ALSA's naming. + +See: http://forum.kodi.tv/showthread.php?tid=269814&pid=2349776#pid2349776 + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> +--- + arch/arm/boot/dts/overlays/rpi-dac-overlay.dts | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm/boot/dts/overlays/rpi-dac-overlay.dts b/arch/arm/boot/dts/overlays/rpi-dac-overlay.dts +index 1523eae..a442c8f0 100644 +--- a/arch/arm/boot/dts/overlays/rpi-dac-overlay.dts ++++ b/arch/arm/boot/dts/overlays/rpi-dac-overlay.dts +@@ -13,7 +13,7 @@ + }; + + fragment@1 { +- target = <&soc>; ++ target-path = "/"; + __overlay__ { + pcm1794a-codec { + #sound-dai-cells = <0>; diff --git a/projects/Slice/patches/linux/linux-02-Slice.patch b/projects/Slice/patches/linux/linux-02-Slice.patch new file mode 100644 index 00000000000..45e4b97cf89 --- /dev/null +++ b/projects/Slice/patches/linux/linux-02-Slice.patch @@ -0,0 +1,2376 @@ +diff -ruN linux-4.6.1-old/arch/arm/boot/dts/overlays/Makefile linux-4.6.1/arch/arm/boot/dts/overlays/Makefile +--- linux-4.6.1-old/arch/arm/boot/dts/overlays/Makefile 2016-06-04 12:03:45.289652775 +0000 ++++ linux-4.6.1/arch/arm/boot/dts/overlays/Makefile 2016-06-04 12:04:23.877652775 +0000 +@@ -89,6 +89,8 @@ + dtbo-$(RPI_DT_OVERLAYS) += w1-gpio.dtbo + dtbo-$(RPI_DT_OVERLAYS) += w1-gpio-pullup.dtbo + dtbo-$(RPI_DT_OVERLAYS) += wittypi.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += ws2812.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += slice.dtbo + + targets += dtbs dtbs_install + targets += $(dtbo-y) +diff -ruN linux-4.6.1-old/arch/arm/boot/dts/overlays/README linux-4.6.1/arch/arm/boot/dts/overlays/README +--- linux-4.6.1-old/arch/arm/boot/dts/overlays/README 2016-06-04 12:03:45.289652775 +0000 ++++ linux-4.6.1/arch/arm/boot/dts/overlays/README 2016-06-04 12:04:23.877652775 +0000 +@@ -1079,6 +1079,11 @@ + Old touch display: + dtoverlay=tinylcd35,touch,touchgpio=3 + ++Name: ws2812 ++Info: WS2812 LED driver using Raspberry Pi PWM interface ++Load: dtoverlay=ws2812,<param>=<val> ++Params: invert Enable inversion of the PWM output ++ num_leds Configure number of LEDs + + Name: uart1 + Info: Enable uart1 in place of uart0 +diff -ruN linux-4.6.1-old/arch/arm/boot/dts/overlays/slice-overlay.dts linux-4.6.1/arch/arm/boot/dts/overlays/slice-overlay.dts +--- linux-4.6.1-old/arch/arm/boot/dts/overlays/slice-overlay.dts 1970-01-01 00:00:00.000000000 +0000 ++++ linux-4.6.1/arch/arm/boot/dts/overlays/slice-overlay.dts 2016-06-04 12:04:23.877652775 +0000 +@@ -0,0 +1,171 @@ ++// Definitions for Slice hardware ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ // ++ // Set up GPIOs: ++ // I2C1 on GPIO44,45 ++ // LIRC input/output on GPIO4 and 37 (NB GPIO4 NC on Slice) ++ // I2S on GPIO28-31 ++ // ++ fragment@0 { ++ target = <&gpio>; ++ __overlay__ { ++ i2c1_pins: i2c1 { ++ brcm,pins = <44 45>; ++ brcm,function = <6>; /* alt2 */ ++ }; ++ lirc_pins: lirc_pins { ++ brcm,pins = <4 37>; // <out in> ++ brcm,function = <1 0>; // out in ++ brcm,pull = <0 1>; // off down ++ }; ++ i2s_pins: i2s { ++ brcm,pins = <28 29 30 31>; ++ brcm,function = <6>; /* alt2 */ ++ }; ++ ws2812_pins: ws2812 { ++ brcm,pins = <40>; ++ brcm,function = <4>; /* alt0 */ ++ }; ++ }; ++ }; ++ ++ // ++ // I2C at 100KHz ++ // ++ fragment@1 { ++ target = <&i2c1>; ++ __overlay__ { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2c1_pins>; ++ clock-frequency = <100000>; ++ }; ++ }; ++ ++ // ++ // Add devices to I2C1 Bus: ++ // PCF8523 RTC device ++ // CS4265 Audio CODEC ++ // ++ fragment@2 { ++ target = <&i2c1>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ pcf8523@68 { ++ compatible = "nxp,pcf8523"; ++ reg = <0x68>; ++ nxp,xtalcap-7pf; /* set crystal load to 7pf */ ++ status = "okay"; ++ }; ++ cs4265@4e { ++ #sound-dai-cells = <0>; ++ compatible = "cirrus,cs4265"; ++ reg = <0x4e>; ++ cs4265-reset-gpios = <&gpio 33 0>; /* AUD_RST_N on GPIO33 */ ++ cirrus,no-s16le; /* remove S16LE support to workaround I2S controller issue */ ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ // ++ // LIRC ++ // ++ fragment@3 { ++ target-path = "/"; ++ __overlay__ { ++ lirc_rpi: lirc_rpi { ++ compatible = "rpi,lirc-rpi"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&lirc_pins>; ++ status = "okay"; ++ ++ // Override autodetection of IR receiver circuit ++ // (0 = active high, 1 = active low, -1 = no override ) ++ rpi,sense = <0xffffffff>; ++ ++ // Software carrier ++ // (0 = off, 1 = on) ++ rpi,softcarrier = <1>; ++ ++ // Invert output ++ // (0 = off, 1 = on) ++ rpi,invert = <0>; ++ ++ // Enable debugging messages ++ // (0 = off, 1 = on) ++ rpi,debug = <0>; ++ }; ++ }; ++ }; ++ ++ // ++ // Audio driver ++ // ++ fragment@4 { ++ #address-cells = <1>; ++ #size-cells = <1>; ++ target = <&sound>; ++ __overlay__ { ++ compatible = "fiveninjas,slice"; ++ reg = <0x20101070 0x11>, ++ <0x20101104 0x05>, ++ <0x20102500 0x04>; ++ pinctrl-names = "default"; ++ i2s-controller = <&i2s>; ++ status = "okay"; ++ }; ++ }; ++ ++ // ++ // Enable I2S ++ // ++ fragment@5 { ++ target = <&i2s>; ++ __overlay__ { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2s_pins>; ++ brcm,enable-mmap; ++ status = "okay"; ++ }; ++ }; ++ ++ // ++ // WS2812B LEDs driver ++ // ++ fragment@6 { ++ target = <&soc>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ws2812: ws2812 { ++ compatible = "rpi,ws2812"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&ws2812_pins>; ++ reg = <0x7e20c000 0x100>; /* PWM */ ++ dmas = <&dma 5>; ++ dma-names = "pwm_dma"; ++ led-en-gpios = <&gpio 43 0>; ++ rpi,invert = <1>; ++ rpi,num_leds = <25>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ // ++ // Disable standard audio ++ // ++ fragment@7 { ++ target = <&audio>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; ++}; +diff -ruN linux-4.6.1-old/arch/arm/boot/dts/overlays/ws2812-overlay.dts linux-4.6.1/arch/arm/boot/dts/overlays/ws2812-overlay.dts +--- linux-4.6.1-old/arch/arm/boot/dts/overlays/ws2812-overlay.dts 1970-01-01 00:00:00.000000000 +0000 ++++ linux-4.6.1/arch/arm/boot/dts/overlays/ws2812-overlay.dts 2016-06-04 12:04:23.877652775 +0000 +@@ -0,0 +1,33 @@ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&soc>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ++ ws2812: ws2812 { ++ compatible = "rpi,ws2812"; ++ reg = <0x7e20c000 0x100>; /* PWM */ ++ dmas = <&dma 5>; ++ dma-names = "pwm_dma"; ++ led-en-gpios = <&gpio 43 0>; ++ ++ rpi,invert = <1>; ++ rpi,num_leds = <25>; ++ ++ status = "okay"; ++ ++ }; ++ }; ++ }; ++ ++ __overrides__ { ++ invert = <&ws2812>,"rpi,invert:0"; ++ num_leds = <&ws2812>,"rpi,num_leds:0"; ++ }; ++}; +diff -ruN linux-4.6.1-old/arch/arm/configs/slice2708_defconfig linux-4.6.1/arch/arm/configs/slice2708_defconfig +--- linux-4.6.1-old/arch/arm/configs/slice2708_defconfig 1970-01-01 00:00:00.000000000 +0000 ++++ linux-4.6.1/arch/arm/configs/slice2708_defconfig 2016-06-04 12:04:23.877652775 +0000 +@@ -0,0 +1,1201 @@ ++# CONFIG_ARM_PATCH_PHYS_VIRT is not set ++CONFIG_PHYS_OFFSET=0 ++# CONFIG_LOCALVERSION_AUTO is not set ++CONFIG_SYSVIPC=y ++CONFIG_POSIX_MQUEUE=y ++CONFIG_FHANDLE=y ++CONFIG_NO_HZ=y ++CONFIG_HIGH_RES_TIMERS=y ++CONFIG_BSD_PROCESS_ACCT=y ++CONFIG_BSD_PROCESS_ACCT_V3=y ++CONFIG_TASKSTATS=y ++CONFIG_TASK_DELAY_ACCT=y ++CONFIG_TASK_XACCT=y ++CONFIG_TASK_IO_ACCOUNTING=y ++CONFIG_IKCONFIG=m ++CONFIG_IKCONFIG_PROC=y ++CONFIG_CGROUP_FREEZER=y ++CONFIG_CGROUP_DEVICE=y ++CONFIG_CGROUP_CPUACCT=y ++CONFIG_MEMCG=y ++CONFIG_BLK_CGROUP=y ++CONFIG_NAMESPACES=y ++CONFIG_SCHED_AUTOGROUP=y ++CONFIG_BLK_DEV_INITRD=y ++CONFIG_EMBEDDED=y ++# CONFIG_COMPAT_BRK is not set ++CONFIG_PROFILING=y ++CONFIG_OPROFILE=m ++CONFIG_KPROBES=y ++CONFIG_JUMP_LABEL=y ++CONFIG_MODULES=y ++CONFIG_MODULE_UNLOAD=y ++CONFIG_MODVERSIONS=y ++CONFIG_MODULE_SRCVERSION_ALL=y ++CONFIG_BLK_DEV_THROTTLING=y ++CONFIG_PARTITION_ADVANCED=y ++CONFIG_MAC_PARTITION=y ++CONFIG_CFQ_GROUP_IOSCHED=y ++CONFIG_ARCH_BCM2708=y ++CONFIG_BCM2708_DT=y ++CONFIG_PREEMPT=y ++CONFIG_AEABI=y ++CONFIG_OABI_COMPAT=y ++CONFIG_CLEANCACHE=y ++CONFIG_FRONTSWAP=y ++CONFIG_CMA=y ++CONFIG_UACCESS_WITH_MEMCPY=y ++CONFIG_SECCOMP=y ++CONFIG_ZBOOT_ROM_TEXT=0x0 ++CONFIG_ZBOOT_ROM_BSS=0x0 ++CONFIG_CMDLINE="console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait" ++CONFIG_CPU_FREQ=y ++CONFIG_CPU_FREQ_STAT=m ++CONFIG_CPU_FREQ_STAT_DETAILS=y ++CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE=y ++CONFIG_CPU_FREQ_GOV_PERFORMANCE=y ++CONFIG_CPU_FREQ_GOV_USERSPACE=y ++CONFIG_CPU_FREQ_GOV_ONDEMAND=y ++CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y ++CONFIG_VFP=y ++CONFIG_BINFMT_MISC=m ++# CONFIG_SUSPEND is not set ++CONFIG_NET=y ++CONFIG_PACKET=y ++CONFIG_UNIX=y ++CONFIG_XFRM_USER=y ++CONFIG_NET_KEY=m ++CONFIG_INET=y ++CONFIG_IP_MULTICAST=y ++CONFIG_IP_ADVANCED_ROUTER=y ++CONFIG_IP_MULTIPLE_TABLES=y ++CONFIG_IP_ROUTE_MULTIPATH=y ++CONFIG_IP_ROUTE_VERBOSE=y ++CONFIG_IP_PNP=y ++CONFIG_IP_PNP_DHCP=y ++CONFIG_IP_PNP_RARP=y ++CONFIG_NET_IPIP=m ++CONFIG_NET_IPGRE_DEMUX=m ++CONFIG_NET_IPGRE=m ++CONFIG_IP_MROUTE=y ++CONFIG_IP_MROUTE_MULTIPLE_TABLES=y ++CONFIG_IP_PIMSM_V1=y ++CONFIG_IP_PIMSM_V2=y ++CONFIG_SYN_COOKIES=y ++CONFIG_INET_AH=m ++CONFIG_INET_ESP=m ++CONFIG_INET_IPCOMP=m ++CONFIG_INET_XFRM_MODE_TRANSPORT=m ++CONFIG_INET_XFRM_MODE_TUNNEL=m ++CONFIG_INET_XFRM_MODE_BEET=m ++CONFIG_INET_LRO=m ++CONFIG_INET_DIAG=m ++CONFIG_INET6_AH=m ++CONFIG_INET6_ESP=m ++CONFIG_INET6_IPCOMP=m ++CONFIG_IPV6_TUNNEL=m ++CONFIG_IPV6_MULTIPLE_TABLES=y ++CONFIG_IPV6_MROUTE=y ++CONFIG_IPV6_MROUTE_MULTIPLE_TABLES=y ++CONFIG_IPV6_PIMSM_V2=y ++CONFIG_NETFILTER=y ++CONFIG_NF_CONNTRACK=m ++CONFIG_NF_CONNTRACK_ZONES=y ++CONFIG_NF_CONNTRACK_EVENTS=y ++CONFIG_NF_CONNTRACK_TIMESTAMP=y ++CONFIG_NF_CT_PROTO_DCCP=m ++CONFIG_NF_CT_PROTO_UDPLITE=m ++CONFIG_NF_CONNTRACK_AMANDA=m ++CONFIG_NF_CONNTRACK_FTP=m ++CONFIG_NF_CONNTRACK_H323=m ++CONFIG_NF_CONNTRACK_IRC=m ++CONFIG_NF_CONNTRACK_NETBIOS_NS=m ++CONFIG_NF_CONNTRACK_SNMP=m ++CONFIG_NF_CONNTRACK_PPTP=m ++CONFIG_NF_CONNTRACK_SANE=m ++CONFIG_NF_CONNTRACK_SIP=m ++CONFIG_NF_CONNTRACK_TFTP=m ++CONFIG_NF_CT_NETLINK=m ++CONFIG_NETFILTER_XT_SET=m ++CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m ++CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m ++CONFIG_NETFILTER_XT_TARGET_CONNMARK=m ++CONFIG_NETFILTER_XT_TARGET_DSCP=m ++CONFIG_NETFILTER_XT_TARGET_HMARK=m ++CONFIG_NETFILTER_XT_TARGET_IDLETIMER=m ++CONFIG_NETFILTER_XT_TARGET_LED=m ++CONFIG_NETFILTER_XT_TARGET_LOG=m ++CONFIG_NETFILTER_XT_TARGET_MARK=m ++CONFIG_NETFILTER_XT_TARGET_NFLOG=m ++CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m ++CONFIG_NETFILTER_XT_TARGET_NOTRACK=m ++CONFIG_NETFILTER_XT_TARGET_TEE=m ++CONFIG_NETFILTER_XT_TARGET_TPROXY=m ++CONFIG_NETFILTER_XT_TARGET_TRACE=m ++CONFIG_NETFILTER_XT_TARGET_TCPMSS=m ++CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP=m ++CONFIG_NETFILTER_XT_MATCH_ADDRTYPE=m ++CONFIG_NETFILTER_XT_MATCH_BPF=m ++CONFIG_NETFILTER_XT_MATCH_CLUSTER=m ++CONFIG_NETFILTER_XT_MATCH_COMMENT=m ++CONFIG_NETFILTER_XT_MATCH_CONNBYTES=m ++CONFIG_NETFILTER_XT_MATCH_CONNLABEL=m ++CONFIG_NETFILTER_XT_MATCH_CONNLIMIT=m ++CONFIG_NETFILTER_XT_MATCH_CONNMARK=m ++CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m ++CONFIG_NETFILTER_XT_MATCH_CPU=m ++CONFIG_NETFILTER_XT_MATCH_DCCP=m ++CONFIG_NETFILTER_XT_MATCH_DEVGROUP=m ++CONFIG_NETFILTER_XT_MATCH_DSCP=m ++CONFIG_NETFILTER_XT_MATCH_ESP=m ++CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=m ++CONFIG_NETFILTER_XT_MATCH_HELPER=m ++CONFIG_NETFILTER_XT_MATCH_IPRANGE=m ++CONFIG_NETFILTER_XT_MATCH_IPVS=m ++CONFIG_NETFILTER_XT_MATCH_LENGTH=m ++CONFIG_NETFILTER_XT_MATCH_LIMIT=m ++CONFIG_NETFILTER_XT_MATCH_MAC=m ++CONFIG_NETFILTER_XT_MATCH_MARK=m ++CONFIG_NETFILTER_XT_MATCH_MULTIPORT=m ++CONFIG_NETFILTER_XT_MATCH_NFACCT=m ++CONFIG_NETFILTER_XT_MATCH_OSF=m ++CONFIG_NETFILTER_XT_MATCH_OWNER=m ++CONFIG_NETFILTER_XT_MATCH_POLICY=m ++CONFIG_NETFILTER_XT_MATCH_PHYSDEV=m ++CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m ++CONFIG_NETFILTER_XT_MATCH_QUOTA=m ++CONFIG_NETFILTER_XT_MATCH_RATEEST=m ++CONFIG_NETFILTER_XT_MATCH_REALM=m ++CONFIG_NETFILTER_XT_MATCH_RECENT=m ++CONFIG_NETFILTER_XT_MATCH_SOCKET=m ++CONFIG_NETFILTER_XT_MATCH_STATE=m ++CONFIG_NETFILTER_XT_MATCH_STATISTIC=m ++CONFIG_NETFILTER_XT_MATCH_STRING=m ++CONFIG_NETFILTER_XT_MATCH_TCPMSS=m ++CONFIG_NETFILTER_XT_MATCH_TIME=m ++CONFIG_NETFILTER_XT_MATCH_U32=m ++CONFIG_IP_SET=m ++CONFIG_IP_SET_BITMAP_IP=m ++CONFIG_IP_SET_BITMAP_IPMAC=m ++CONFIG_IP_SET_BITMAP_PORT=m ++CONFIG_IP_SET_HASH_IP=m ++CONFIG_IP_SET_HASH_IPPORT=m ++CONFIG_IP_SET_HASH_IPPORTIP=m ++CONFIG_IP_SET_HASH_IPPORTNET=m ++CONFIG_IP_SET_HASH_NET=m ++CONFIG_IP_SET_HASH_NETPORT=m ++CONFIG_IP_SET_HASH_NETIFACE=m ++CONFIG_IP_SET_LIST_SET=m ++CONFIG_IP_VS=m ++CONFIG_IP_VS_PROTO_TCP=y ++CONFIG_IP_VS_PROTO_UDP=y ++CONFIG_IP_VS_PROTO_ESP=y ++CONFIG_IP_VS_PROTO_AH=y ++CONFIG_IP_VS_PROTO_SCTP=y ++CONFIG_IP_VS_RR=m ++CONFIG_IP_VS_WRR=m ++CONFIG_IP_VS_LC=m ++CONFIG_IP_VS_WLC=m ++CONFIG_IP_VS_LBLC=m ++CONFIG_IP_VS_LBLCR=m ++CONFIG_IP_VS_DH=m ++CONFIG_IP_VS_SH=m ++CONFIG_IP_VS_SED=m ++CONFIG_IP_VS_NQ=m ++CONFIG_IP_VS_FTP=m ++CONFIG_IP_VS_PE_SIP=m ++CONFIG_NF_CONNTRACK_IPV4=m ++CONFIG_IP_NF_IPTABLES=m ++CONFIG_IP_NF_MATCH_AH=m ++CONFIG_IP_NF_MATCH_ECN=m ++CONFIG_IP_NF_MATCH_TTL=m ++CONFIG_IP_NF_FILTER=m ++CONFIG_IP_NF_TARGET_REJECT=m ++CONFIG_IP_NF_NAT=m ++CONFIG_IP_NF_TARGET_MASQUERADE=m ++CONFIG_IP_NF_TARGET_NETMAP=m ++CONFIG_IP_NF_TARGET_REDIRECT=m ++CONFIG_IP_NF_MANGLE=m ++CONFIG_IP_NF_TARGET_CLUSTERIP=m ++CONFIG_IP_NF_TARGET_ECN=m ++CONFIG_IP_NF_TARGET_TTL=m ++CONFIG_IP_NF_RAW=m ++CONFIG_IP_NF_ARPTABLES=m ++CONFIG_IP_NF_ARPFILTER=m ++CONFIG_IP_NF_ARP_MANGLE=m ++CONFIG_NF_CONNTRACK_IPV6=m ++CONFIG_IP6_NF_IPTABLES=m ++CONFIG_IP6_NF_MATCH_AH=m ++CONFIG_IP6_NF_MATCH_EUI64=m ++CONFIG_IP6_NF_MATCH_FRAG=m ++CONFIG_IP6_NF_MATCH_OPTS=m ++CONFIG_IP6_NF_MATCH_HL=m ++CONFIG_IP6_NF_MATCH_IPV6HEADER=m ++CONFIG_IP6_NF_MATCH_MH=m ++CONFIG_IP6_NF_MATCH_RT=m ++CONFIG_IP6_NF_TARGET_HL=m ++CONFIG_IP6_NF_FILTER=m ++CONFIG_IP6_NF_TARGET_REJECT=m ++CONFIG_IP6_NF_MANGLE=m ++CONFIG_IP6_NF_RAW=m ++CONFIG_IP6_NF_NAT=m ++CONFIG_IP6_NF_TARGET_MASQUERADE=m ++CONFIG_IP6_NF_TARGET_NPT=m ++CONFIG_BRIDGE_NF_EBTABLES=m ++CONFIG_BRIDGE_EBT_BROUTE=m ++CONFIG_BRIDGE_EBT_T_FILTER=m ++CONFIG_BRIDGE_EBT_T_NAT=m ++CONFIG_BRIDGE_EBT_802_3=m ++CONFIG_BRIDGE_EBT_AMONG=m ++CONFIG_BRIDGE_EBT_ARP=m ++CONFIG_BRIDGE_EBT_IP=m ++CONFIG_BRIDGE_EBT_IP6=m ++CONFIG_BRIDGE_EBT_LIMIT=m ++CONFIG_BRIDGE_EBT_MARK=m ++CONFIG_BRIDGE_EBT_PKTTYPE=m ++CONFIG_BRIDGE_EBT_STP=m ++CONFIG_BRIDGE_EBT_VLAN=m ++CONFIG_BRIDGE_EBT_ARPREPLY=m ++CONFIG_BRIDGE_EBT_DNAT=m ++CONFIG_BRIDGE_EBT_MARK_T=m ++CONFIG_BRIDGE_EBT_REDIRECT=m ++CONFIG_BRIDGE_EBT_SNAT=m ++CONFIG_BRIDGE_EBT_LOG=m ++CONFIG_BRIDGE_EBT_NFLOG=m ++CONFIG_SCTP_COOKIE_HMAC_SHA1=y ++CONFIG_ATM=m ++CONFIG_L2TP=m ++CONFIG_L2TP_V3=y ++CONFIG_L2TP_IP=m ++CONFIG_L2TP_ETH=m ++CONFIG_BRIDGE=m ++CONFIG_VLAN_8021Q=m ++CONFIG_VLAN_8021Q_GVRP=y ++CONFIG_ATALK=m ++CONFIG_6LOWPAN=m ++CONFIG_NET_SCHED=y ++CONFIG_NET_SCH_CBQ=m ++CONFIG_NET_SCH_HTB=m ++CONFIG_NET_SCH_HFSC=m ++CONFIG_NET_SCH_PRIO=m ++CONFIG_NET_SCH_MULTIQ=m ++CONFIG_NET_SCH_RED=m ++CONFIG_NET_SCH_SFB=m ++CONFIG_NET_SCH_SFQ=m ++CONFIG_NET_SCH_TEQL=m ++CONFIG_NET_SCH_TBF=m ++CONFIG_NET_SCH_GRED=m ++CONFIG_NET_SCH_DSMARK=m ++CONFIG_NET_SCH_NETEM=m ++CONFIG_NET_SCH_DRR=m ++CONFIG_NET_SCH_MQPRIO=m ++CONFIG_NET_SCH_CHOKE=m ++CONFIG_NET_SCH_QFQ=m ++CONFIG_NET_SCH_CODEL=m ++CONFIG_NET_SCH_FQ_CODEL=m ++CONFIG_NET_SCH_INGRESS=m ++CONFIG_NET_SCH_PLUG=m ++CONFIG_NET_CLS_BASIC=m ++CONFIG_NET_CLS_TCINDEX=m ++CONFIG_NET_CLS_ROUTE4=m ++CONFIG_NET_CLS_FW=m ++CONFIG_NET_CLS_U32=m ++CONFIG_CLS_U32_MARK=y ++CONFIG_NET_CLS_RSVP=m ++CONFIG_NET_CLS_RSVP6=m ++CONFIG_NET_CLS_FLOW=m ++CONFIG_NET_CLS_CGROUP=m ++CONFIG_NET_EMATCH=y ++CONFIG_NET_EMATCH_CMP=m ++CONFIG_NET_EMATCH_NBYTE=m ++CONFIG_NET_EMATCH_U32=m ++CONFIG_NET_EMATCH_META=m ++CONFIG_NET_EMATCH_TEXT=m ++CONFIG_NET_EMATCH_IPSET=m ++CONFIG_NET_CLS_ACT=y ++CONFIG_NET_ACT_POLICE=m ++CONFIG_NET_ACT_GACT=m ++CONFIG_GACT_PROB=y ++CONFIG_NET_ACT_MIRRED=m ++CONFIG_NET_ACT_IPT=m ++CONFIG_NET_ACT_NAT=m ++CONFIG_NET_ACT_PEDIT=m ++CONFIG_NET_ACT_SIMP=m ++CONFIG_NET_ACT_SKBEDIT=m ++CONFIG_NET_ACT_CSUM=m ++CONFIG_BATMAN_ADV=m ++CONFIG_OPENVSWITCH=m ++CONFIG_NET_PKTGEN=m ++CONFIG_HAMRADIO=y ++CONFIG_AX25=m ++CONFIG_NETROM=m ++CONFIG_ROSE=m ++CONFIG_MKISS=m ++CONFIG_6PACK=m ++CONFIG_BPQETHER=m ++CONFIG_BAYCOM_SER_FDX=m ++CONFIG_BAYCOM_SER_HDX=m ++CONFIG_YAM=m ++CONFIG_CAN=m ++CONFIG_CAN_VCAN=m ++CONFIG_CAN_MCP251X=m ++CONFIG_IRDA=m ++CONFIG_IRLAN=m ++CONFIG_IRNET=m ++CONFIG_IRCOMM=m ++CONFIG_IRDA_ULTRA=y ++CONFIG_IRDA_CACHE_LAST_LSAP=y ++CONFIG_IRDA_FAST_RR=y ++CONFIG_IRTTY_SIR=m ++CONFIG_KINGSUN_DONGLE=m ++CONFIG_KSDAZZLE_DONGLE=m ++CONFIG_KS959_DONGLE=m ++CONFIG_USB_IRDA=m ++CONFIG_SIGMATEL_FIR=m ++CONFIG_MCS_FIR=m ++CONFIG_BT=m ++CONFIG_BT_RFCOMM=m ++CONFIG_BT_RFCOMM_TTY=y ++CONFIG_BT_BNEP=m ++CONFIG_BT_BNEP_MC_FILTER=y ++CONFIG_BT_BNEP_PROTO_FILTER=y ++CONFIG_BT_HIDP=m ++CONFIG_BT_6LOWPAN=m ++CONFIG_BT_HCIBTUSB=m ++CONFIG_BT_HCIBCM203X=m ++CONFIG_BT_HCIBPA10X=m ++CONFIG_BT_HCIBFUSB=m ++CONFIG_BT_HCIVHCI=m ++CONFIG_BT_MRVL=m ++CONFIG_BT_MRVL_SDIO=m ++CONFIG_BT_ATH3K=m ++CONFIG_BT_WILINK=m ++CONFIG_MAC80211=m ++CONFIG_MAC80211_MESH=y ++CONFIG_WIMAX=m ++CONFIG_RFKILL=m ++CONFIG_RFKILL_INPUT=y ++CONFIG_NET_9P=m ++CONFIG_NFC=m ++CONFIG_NFC_PN533=m ++CONFIG_DEVTMPFS=y ++CONFIG_DEVTMPFS_MOUNT=y ++CONFIG_DMA_CMA=y ++CONFIG_CMA_SIZE_MBYTES=5 ++CONFIG_BLK_DEV_LOOP=y ++CONFIG_BLK_DEV_CRYPTOLOOP=m ++CONFIG_BLK_DEV_DRBD=m ++CONFIG_BLK_DEV_NBD=m ++CONFIG_BLK_DEV_RAM=y ++CONFIG_CDROM_PKTCDVD=m ++CONFIG_ATA_OVER_ETH=m ++CONFIG_BCM2835_WS2812=m ++CONFIG_EEPROM_AT24=m ++CONFIG_SCSI=y ++# CONFIG_SCSI_PROC_FS is not set ++CONFIG_BLK_DEV_SD=y ++CONFIG_CHR_DEV_ST=m ++CONFIG_CHR_DEV_OSST=m ++CONFIG_BLK_DEV_SR=m ++CONFIG_CHR_DEV_SG=m ++CONFIG_SCSI_ISCSI_ATTRS=y ++CONFIG_ISCSI_TCP=m ++CONFIG_ISCSI_BOOT_SYSFS=m ++CONFIG_MD=y ++CONFIG_MD_LINEAR=m ++CONFIG_MD_RAID0=m ++CONFIG_BLK_DEV_DM=m ++CONFIG_DM_CRYPT=m ++CONFIG_DM_SNAPSHOT=m ++CONFIG_DM_MIRROR=m ++CONFIG_DM_LOG_USERSPACE=m ++CONFIG_DM_RAID=m ++CONFIG_DM_ZERO=m ++CONFIG_DM_DELAY=m ++CONFIG_NETDEVICES=y ++CONFIG_BONDING=m ++CONFIG_DUMMY=m ++CONFIG_IFB=m ++CONFIG_MACVLAN=m ++CONFIG_NETCONSOLE=m ++CONFIG_TUN=m ++CONFIG_VETH=m ++CONFIG_ENC28J60=m ++CONFIG_MDIO_BITBANG=m ++CONFIG_PPP=m ++CONFIG_PPP_BSDCOMP=m ++CONFIG_PPP_DEFLATE=m ++CONFIG_PPP_FILTER=y ++CONFIG_PPP_MPPE=m ++CONFIG_PPP_MULTILINK=y ++CONFIG_PPPOATM=m ++CONFIG_PPPOE=m ++CONFIG_PPPOL2TP=m ++CONFIG_PPP_ASYNC=m ++CONFIG_PPP_SYNC_TTY=m ++CONFIG_SLIP=m ++CONFIG_SLIP_COMPRESSED=y ++CONFIG_SLIP_SMART=y ++CONFIG_USB_CATC=m ++CONFIG_USB_KAWETH=m ++CONFIG_USB_PEGASUS=m ++CONFIG_USB_RTL8150=m ++CONFIG_USB_RTL8152=m ++CONFIG_USB_USBNET=y ++CONFIG_USB_NET_AX8817X=m ++CONFIG_USB_NET_AX88179_178A=m ++CONFIG_USB_NET_CDCETHER=m ++CONFIG_USB_NET_CDC_EEM=m ++CONFIG_USB_NET_CDC_NCM=m ++CONFIG_USB_NET_HUAWEI_CDC_NCM=m ++CONFIG_USB_NET_CDC_MBIM=m ++CONFIG_USB_NET_DM9601=m ++CONFIG_USB_NET_SR9700=m ++CONFIG_USB_NET_SR9800=m ++CONFIG_USB_NET_SMSC75XX=m ++CONFIG_USB_NET_SMSC95XX=y ++CONFIG_USB_NET_GL620A=m ++CONFIG_USB_NET_NET1080=m ++CONFIG_USB_NET_PLUSB=m ++CONFIG_USB_NET_MCS7830=m ++CONFIG_USB_NET_CDC_SUBSET=m ++CONFIG_USB_ALI_M5632=y ++CONFIG_USB_AN2720=y ++CONFIG_USB_EPSON2888=y ++CONFIG_USB_KC2190=y ++CONFIG_USB_NET_ZAURUS=m ++CONFIG_USB_NET_CX82310_ETH=m ++CONFIG_USB_NET_KALMIA=m ++CONFIG_USB_NET_QMI_WWAN=m ++CONFIG_USB_HSO=m ++CONFIG_USB_NET_INT51X1=m ++CONFIG_USB_IPHETH=m ++CONFIG_USB_SIERRA_NET=m ++CONFIG_USB_VL600=m ++CONFIG_LIBERTAS_THINFIRM=m ++CONFIG_LIBERTAS_THINFIRM_USB=m ++CONFIG_AT76C50X_USB=m ++CONFIG_USB_ZD1201=m ++CONFIG_USB_NET_RNDIS_WLAN=m ++CONFIG_RTL8187=m ++CONFIG_MAC80211_HWSIM=m ++CONFIG_ATH_CARDS=m ++CONFIG_ATH9K=m ++CONFIG_ATH9K_HTC=m ++CONFIG_CARL9170=m ++CONFIG_ATH6KL=m ++CONFIG_ATH6KL_USB=m ++CONFIG_AR5523=m ++CONFIG_B43=m ++# CONFIG_B43_PHY_N is not set ++CONFIG_B43LEGACY=m ++CONFIG_BRCMFMAC=m ++CONFIG_BRCMFMAC_USB=y ++CONFIG_HOSTAP=m ++CONFIG_LIBERTAS=m ++CONFIG_LIBERTAS_USB=m ++CONFIG_LIBERTAS_SDIO=m ++CONFIG_P54_COMMON=m ++CONFIG_P54_USB=m ++CONFIG_RT2X00=m ++CONFIG_RT2500USB=m ++CONFIG_RT73USB=m ++CONFIG_RT2800USB=m ++CONFIG_RT2800USB_RT3573=y ++CONFIG_RT2800USB_RT53XX=y ++CONFIG_RT2800USB_RT55XX=y ++CONFIG_RT2800USB_UNKNOWN=y ++CONFIG_RTL8192CU=m ++CONFIG_ZD1211RW=m ++CONFIG_MWIFIEX=m ++CONFIG_MWIFIEX_SDIO=m ++CONFIG_WIMAX_I2400M_USB=m ++CONFIG_INPUT_POLLDEV=m ++# CONFIG_INPUT_MOUSEDEV_PSAUX is not set ++CONFIG_INPUT_JOYDEV=m ++CONFIG_INPUT_EVDEV=m ++# CONFIG_KEYBOARD_ATKBD is not set ++CONFIG_KEYBOARD_GPIO=m ++# CONFIG_INPUT_MOUSE is not set ++CONFIG_INPUT_JOYSTICK=y ++CONFIG_JOYSTICK_IFORCE=m ++CONFIG_JOYSTICK_IFORCE_USB=y ++CONFIG_JOYSTICK_XPAD=m ++CONFIG_JOYSTICK_XPAD_FF=y ++CONFIG_INPUT_TOUCHSCREEN=y ++CONFIG_TOUCHSCREEN_ADS7846=m ++CONFIG_TOUCHSCREEN_EGALAX=m ++CONFIG_TOUCHSCREEN_USB_COMPOSITE=m ++CONFIG_TOUCHSCREEN_STMPE=m ++CONFIG_INPUT_MISC=y ++CONFIG_INPUT_AD714X=m ++CONFIG_INPUT_ATI_REMOTE2=m ++CONFIG_INPUT_KEYSPAN_REMOTE=m ++CONFIG_INPUT_POWERMATE=m ++CONFIG_INPUT_YEALINK=m ++CONFIG_INPUT_CM109=m ++CONFIG_INPUT_UINPUT=m ++CONFIG_INPUT_GPIO_ROTARY_ENCODER=m ++CONFIG_INPUT_ADXL34X=m ++CONFIG_INPUT_CMA3000=m ++CONFIG_SERIO=m ++CONFIG_SERIO_RAW=m ++CONFIG_GAMEPORT=m ++CONFIG_GAMEPORT_NS558=m ++CONFIG_GAMEPORT_L4=m ++CONFIG_DEVPTS_MULTIPLE_INSTANCES=y ++# CONFIG_LEGACY_PTYS is not set ++# CONFIG_DEVKMEM is not set ++CONFIG_SERIAL_AMBA_PL011=y ++CONFIG_SERIAL_AMBA_PL011_CONSOLE=y ++CONFIG_TTY_PRINTK=y ++CONFIG_HW_RANDOM=y ++CONFIG_HW_RANDOM_BCM2835=m ++CONFIG_HW_RANDOM_BCM2708=m ++CONFIG_RAW_DRIVER=y ++CONFIG_BRCM_CHAR_DRIVERS=y ++CONFIG_BCM_VC_CMA=y ++CONFIG_BCM_VC_SM=y ++CONFIG_I2C=y ++CONFIG_I2C_CHARDEV=m ++CONFIG_I2C_BCM2708=m ++CONFIG_SPI=y ++CONFIG_SPI_BCM2835=m ++CONFIG_SPI_BCM2708=m ++CONFIG_SPI_SPIDEV=y ++CONFIG_PPS=m ++CONFIG_PPS_CLIENT_LDISC=m ++CONFIG_PPS_CLIENT_GPIO=m ++CONFIG_GPIO_SYSFS=y ++CONFIG_GPIO_ARIZONA=m ++CONFIG_GPIO_STMPE=y ++CONFIG_W1=m ++CONFIG_W1_MASTER_DS2490=m ++CONFIG_W1_MASTER_DS2482=m ++CONFIG_W1_MASTER_DS1WM=m ++CONFIG_W1_MASTER_GPIO=m ++CONFIG_W1_SLAVE_THERM=m ++CONFIG_W1_SLAVE_SMEM=m ++CONFIG_W1_SLAVE_DS2408=m ++CONFIG_W1_SLAVE_DS2413=m ++CONFIG_W1_SLAVE_DS2406=m ++CONFIG_W1_SLAVE_DS2423=m ++CONFIG_W1_SLAVE_DS2431=m ++CONFIG_W1_SLAVE_DS2433=m ++CONFIG_W1_SLAVE_DS2760=m ++CONFIG_W1_SLAVE_DS2780=m ++CONFIG_W1_SLAVE_DS2781=m ++CONFIG_W1_SLAVE_DS28E04=m ++CONFIG_W1_SLAVE_BQ27000=m ++CONFIG_BATTERY_DS2760=m ++# CONFIG_HWMON is not set ++CONFIG_THERMAL=y ++CONFIG_THERMAL_BCM2835=y ++CONFIG_WATCHDOG=y ++CONFIG_BCM2708_WDT=m ++CONFIG_BCM2835_WDT=m ++CONFIG_UCB1400_CORE=m ++CONFIG_MFD_STMPE=y ++CONFIG_STMPE_SPI=y ++CONFIG_MFD_ARIZONA_I2C=m ++CONFIG_MFD_ARIZONA_SPI=m ++CONFIG_MFD_WM5102=y ++CONFIG_MEDIA_SUPPORT=m ++CONFIG_MEDIA_CAMERA_SUPPORT=y ++CONFIG_MEDIA_ANALOG_TV_SUPPORT=y ++CONFIG_MEDIA_DIGITAL_TV_SUPPORT=y ++CONFIG_MEDIA_RADIO_SUPPORT=y ++CONFIG_MEDIA_RC_SUPPORT=y ++CONFIG_MEDIA_CONTROLLER=y ++CONFIG_LIRC=m ++CONFIG_RC_DEVICES=y ++CONFIG_RC_ATI_REMOTE=m ++CONFIG_IR_IMON=m ++CONFIG_IR_MCEUSB=m ++CONFIG_IR_REDRAT3=m ++CONFIG_IR_STREAMZAP=m ++CONFIG_IR_IGUANA=m ++CONFIG_IR_TTUSBIR=m ++CONFIG_RC_LOOPBACK=m ++CONFIG_IR_GPIO_CIR=m ++CONFIG_MEDIA_USB_SUPPORT=y ++CONFIG_USB_VIDEO_CLASS=m ++CONFIG_USB_M5602=m ++CONFIG_USB_STV06XX=m ++CONFIG_USB_GL860=m ++CONFIG_USB_GSPCA_BENQ=m ++CONFIG_USB_GSPCA_CONEX=m ++CONFIG_USB_GSPCA_CPIA1=m ++CONFIG_USB_GSPCA_DTCS033=m ++CONFIG_USB_GSPCA_ETOMS=m ++CONFIG_USB_GSPCA_FINEPIX=m ++CONFIG_USB_GSPCA_JEILINJ=m ++CONFIG_USB_GSPCA_JL2005BCD=m ++CONFIG_USB_GSPCA_KINECT=m ++CONFIG_USB_GSPCA_KONICA=m ++CONFIG_USB_GSPCA_MARS=m ++CONFIG_USB_GSPCA_MR97310A=m ++CONFIG_USB_GSPCA_NW80X=m ++CONFIG_USB_GSPCA_OV519=m ++CONFIG_USB_GSPCA_OV534=m ++CONFIG_USB_GSPCA_OV534_9=m ++CONFIG_USB_GSPCA_PAC207=m ++CONFIG_USB_GSPCA_PAC7302=m ++CONFIG_USB_GSPCA_PAC7311=m ++CONFIG_USB_GSPCA_SE401=m ++CONFIG_USB_GSPCA_SN9C2028=m ++CONFIG_USB_GSPCA_SN9C20X=m ++CONFIG_USB_GSPCA_SONIXB=m ++CONFIG_USB_GSPCA_SONIXJ=m ++CONFIG_USB_GSPCA_SPCA500=m ++CONFIG_USB_GSPCA_SPCA501=m ++CONFIG_USB_GSPCA_SPCA505=m ++CONFIG_USB_GSPCA_SPCA506=m ++CONFIG_USB_GSPCA_SPCA508=m ++CONFIG_USB_GSPCA_SPCA561=m ++CONFIG_USB_GSPCA_SPCA1528=m ++CONFIG_USB_GSPCA_SQ905=m ++CONFIG_USB_GSPCA_SQ905C=m ++CONFIG_USB_GSPCA_SQ930X=m ++CONFIG_USB_GSPCA_STK014=m ++CONFIG_USB_GSPCA_STK1135=m ++CONFIG_USB_GSPCA_STV0680=m ++CONFIG_USB_GSPCA_SUNPLUS=m ++CONFIG_USB_GSPCA_T613=m ++CONFIG_USB_GSPCA_TOPRO=m ++CONFIG_USB_GSPCA_TV8532=m ++CONFIG_USB_GSPCA_VC032X=m ++CONFIG_USB_GSPCA_VICAM=m ++CONFIG_USB_GSPCA_XIRLINK_CIT=m ++CONFIG_USB_GSPCA_ZC3XX=m ++CONFIG_USB_PWC=m ++CONFIG_VIDEO_CPIA2=m ++CONFIG_USB_ZR364XX=m ++CONFIG_USB_STKWEBCAM=m ++CONFIG_USB_S2255=m ++CONFIG_VIDEO_USBTV=m ++CONFIG_VIDEO_PVRUSB2=m ++CONFIG_VIDEO_HDPVR=m ++CONFIG_VIDEO_USBVISION=m ++CONFIG_VIDEO_STK1160_COMMON=m ++CONFIG_VIDEO_STK1160_AC97=y ++CONFIG_VIDEO_GO7007=m ++CONFIG_VIDEO_GO7007_USB=m ++CONFIG_VIDEO_GO7007_USB_S2250_BOARD=m ++CONFIG_VIDEO_AU0828=m ++CONFIG_VIDEO_AU0828_RC=y ++CONFIG_VIDEO_CX231XX=m ++CONFIG_VIDEO_CX231XX_ALSA=m ++CONFIG_VIDEO_CX231XX_DVB=m ++CONFIG_VIDEO_TM6000=m ++CONFIG_VIDEO_TM6000_ALSA=m ++CONFIG_VIDEO_TM6000_DVB=m ++CONFIG_DVB_USB=m ++CONFIG_DVB_USB_A800=m ++CONFIG_DVB_USB_DIBUSB_MB=m ++CONFIG_DVB_USB_DIBUSB_MB_FAULTY=y ++CONFIG_DVB_USB_DIBUSB_MC=m ++CONFIG_DVB_USB_DIB0700=m ++CONFIG_DVB_USB_UMT_010=m ++CONFIG_DVB_USB_CXUSB=m ++CONFIG_DVB_USB_M920X=m ++CONFIG_DVB_USB_DIGITV=m ++CONFIG_DVB_USB_VP7045=m ++CONFIG_DVB_USB_VP702X=m ++CONFIG_DVB_USB_GP8PSK=m ++CONFIG_DVB_USB_NOVA_T_USB2=m ++CONFIG_DVB_USB_TTUSB2=m ++CONFIG_DVB_USB_DTT200U=m ++CONFIG_DVB_USB_OPERA1=m ++CONFIG_DVB_USB_AF9005=m ++CONFIG_DVB_USB_AF9005_REMOTE=m ++CONFIG_DVB_USB_PCTV452E=m ++CONFIG_DVB_USB_DW2102=m ++CONFIG_DVB_USB_CINERGY_T2=m ++CONFIG_DVB_USB_DTV5100=m ++CONFIG_DVB_USB_FRIIO=m ++CONFIG_DVB_USB_AZ6027=m ++CONFIG_DVB_USB_TECHNISAT_USB2=m ++CONFIG_DVB_USB_V2=m ++CONFIG_DVB_USB_AF9015=m ++CONFIG_DVB_USB_AF9035=m ++CONFIG_DVB_USB_ANYSEE=m ++CONFIG_DVB_USB_AU6610=m ++CONFIG_DVB_USB_AZ6007=m ++CONFIG_DVB_USB_CE6230=m ++CONFIG_DVB_USB_EC168=m ++CONFIG_DVB_USB_GL861=m ++CONFIG_DVB_USB_LME2510=m ++CONFIG_DVB_USB_MXL111SF=m ++CONFIG_DVB_USB_RTL28XXU=m ++CONFIG_DVB_USB_DVBSKY=m ++CONFIG_SMS_USB_DRV=m ++CONFIG_DVB_B2C2_FLEXCOP_USB=m ++CONFIG_DVB_AS102=m ++CONFIG_VIDEO_EM28XX=m ++CONFIG_VIDEO_EM28XX_V4L2=m ++CONFIG_VIDEO_EM28XX_ALSA=m ++CONFIG_VIDEO_EM28XX_DVB=m ++CONFIG_V4L_PLATFORM_DRIVERS=y ++CONFIG_VIDEO_BCM2835=y ++CONFIG_VIDEO_BCM2835_MMAL=m ++CONFIG_RADIO_SI470X=y ++CONFIG_USB_SI470X=m ++CONFIG_I2C_SI470X=m ++CONFIG_RADIO_SI4713=m ++CONFIG_I2C_SI4713=m ++CONFIG_USB_MR800=m ++CONFIG_USB_DSBR=m ++CONFIG_RADIO_SHARK=m ++CONFIG_RADIO_SHARK2=m ++CONFIG_USB_KEENE=m ++CONFIG_USB_MA901=m ++CONFIG_RADIO_TEA5764=m ++CONFIG_RADIO_SAA7706H=m ++CONFIG_RADIO_TEF6862=m ++CONFIG_RADIO_WL1273=m ++CONFIG_RADIO_WL128X=m ++# CONFIG_MEDIA_SUBDRV_AUTOSELECT is not set ++CONFIG_VIDEO_UDA1342=m ++CONFIG_VIDEO_SONY_BTF_MPX=m ++CONFIG_VIDEO_TVP5150=m ++CONFIG_VIDEO_TW2804=m ++CONFIG_VIDEO_TW9903=m ++CONFIG_VIDEO_TW9906=m ++CONFIG_VIDEO_OV7640=m ++CONFIG_VIDEO_MT9V011=m ++CONFIG_FB=y ++CONFIG_FB_BCM2708=y ++CONFIG_FB_SSD1307=m ++# CONFIG_BACKLIGHT_GENERIC is not set ++CONFIG_BACKLIGHT_GPIO=m ++CONFIG_FRAMEBUFFER_CONSOLE=y ++CONFIG_LOGO=y ++# CONFIG_LOGO_LINUX_MONO is not set ++# CONFIG_LOGO_LINUX_VGA16 is not set ++CONFIG_SOUND=y ++CONFIG_SND=m ++CONFIG_SND_SEQUENCER=m ++CONFIG_SND_SEQ_DUMMY=m ++CONFIG_SND_MIXER_OSS=m ++CONFIG_SND_PCM_OSS=m ++CONFIG_SND_SEQUENCER_OSS=y ++CONFIG_SND_HRTIMER=m ++CONFIG_SND_DUMMY=m ++CONFIG_SND_ALOOP=m ++CONFIG_SND_VIRMIDI=m ++CONFIG_SND_MTPAV=m ++CONFIG_SND_SERIAL_U16550=m ++CONFIG_SND_MPU401=m ++CONFIG_SND_BCM2835=m ++CONFIG_SND_USB_AUDIO=m ++CONFIG_SND_USB_UA101=m ++CONFIG_SND_USB_CAIAQ=m ++CONFIG_SND_USB_CAIAQ_INPUT=y ++CONFIG_SND_USB_6FIRE=m ++CONFIG_SND_SOC=m ++CONFIG_SND_BCM2708_SOC_I2S=m ++CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC=m ++CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS=m ++CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI=m ++CONFIG_SND_BCM2708_SOC_HIFIBERRY_AMP=m ++CONFIG_SND_BCM2708_SOC_RPI_DAC=m ++CONFIG_SND_BCM2708_SOC_RPI_PROTO=m ++CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC=m ++CONFIG_SND_BCM2708_SOC_SLICE=m ++CONFIG_SND_SIMPLE_CARD=m ++CONFIG_SOUND_PRIME=m ++CONFIG_HIDRAW=y ++CONFIG_HID_A4TECH=m ++CONFIG_HID_ACRUX=m ++CONFIG_HID_APPLE=m ++CONFIG_HID_BELKIN=m ++CONFIG_HID_CHERRY=m ++CONFIG_HID_CHICONY=m ++CONFIG_HID_CYPRESS=m ++CONFIG_HID_DRAGONRISE=m ++CONFIG_HID_EMS_FF=m ++CONFIG_HID_ELECOM=m ++CONFIG_HID_ELO=m ++CONFIG_HID_EZKEY=m ++CONFIG_HID_HOLTEK=m ++CONFIG_HID_KEYTOUCH=m ++CONFIG_HID_KYE=m ++CONFIG_HID_UCLOGIC=m ++CONFIG_HID_WALTOP=m ++CONFIG_HID_GYRATION=m ++CONFIG_HID_TWINHAN=m ++CONFIG_HID_KENSINGTON=m ++CONFIG_HID_LCPOWER=m ++CONFIG_HID_LOGITECH=m ++CONFIG_HID_MAGICMOUSE=m ++CONFIG_HID_MICROSOFT=m ++CONFIG_HID_MONTEREY=m ++CONFIG_HID_MULTITOUCH=m ++CONFIG_HID_NTRIG=m ++CONFIG_HID_ORTEK=m ++CONFIG_HID_PANTHERLORD=m ++CONFIG_HID_PETALYNX=m ++CONFIG_HID_PICOLCD=m ++CONFIG_HID_ROCCAT=m ++CONFIG_HID_SAMSUNG=m ++CONFIG_HID_SONY=m ++CONFIG_HID_SPEEDLINK=m ++CONFIG_HID_SUNPLUS=m ++CONFIG_HID_GREENASIA=m ++CONFIG_HID_SMARTJOYPLUS=m ++CONFIG_HID_TOPSEED=m ++CONFIG_HID_THINGM=m ++CONFIG_HID_THRUSTMASTER=m ++CONFIG_HID_WACOM=m ++CONFIG_HID_WIIMOTE=m ++CONFIG_HID_XINMO=m ++CONFIG_HID_ZEROPLUS=m ++CONFIG_HID_ZYDACRON=m ++CONFIG_HID_PID=y ++CONFIG_USB_HIDDEV=y ++CONFIG_USB=y ++CONFIG_USB_ANNOUNCE_NEW_DEVICES=y ++CONFIG_USB_MON=m ++CONFIG_USB_DWCOTG=y ++CONFIG_USB_PRINTER=m ++CONFIG_USB_STORAGE=y ++CONFIG_USB_STORAGE_REALTEK=m ++CONFIG_USB_STORAGE_DATAFAB=m ++CONFIG_USB_STORAGE_FREECOM=m ++CONFIG_USB_STORAGE_ISD200=m ++CONFIG_USB_STORAGE_USBAT=m ++CONFIG_USB_STORAGE_SDDR09=m ++CONFIG_USB_STORAGE_SDDR55=m ++CONFIG_USB_STORAGE_JUMPSHOT=m ++CONFIG_USB_STORAGE_ALAUDA=m ++CONFIG_USB_STORAGE_ONETOUCH=m ++CONFIG_USB_STORAGE_KARMA=m ++CONFIG_USB_STORAGE_CYPRESS_ATACB=m ++CONFIG_USB_STORAGE_ENE_UB6250=m ++CONFIG_USB_MDC800=m ++CONFIG_USB_MICROTEK=m ++CONFIG_USBIP_CORE=m ++CONFIG_USBIP_VHCI_HCD=m ++CONFIG_USBIP_HOST=m ++CONFIG_USB_SERIAL=m ++CONFIG_USB_SERIAL_GENERIC=y ++CONFIG_USB_SERIAL_AIRCABLE=m ++CONFIG_USB_SERIAL_ARK3116=m ++CONFIG_USB_SERIAL_BELKIN=m ++CONFIG_USB_SERIAL_CH341=m ++CONFIG_USB_SERIAL_WHITEHEAT=m ++CONFIG_USB_SERIAL_DIGI_ACCELEPORT=m ++CONFIG_USB_SERIAL_CP210X=m ++CONFIG_USB_SERIAL_CYPRESS_M8=m ++CONFIG_USB_SERIAL_EMPEG=m ++CONFIG_USB_SERIAL_FTDI_SIO=m ++CONFIG_USB_SERIAL_VISOR=m ++CONFIG_USB_SERIAL_IPAQ=m ++CONFIG_USB_SERIAL_IR=m ++CONFIG_USB_SERIAL_EDGEPORT=m ++CONFIG_USB_SERIAL_EDGEPORT_TI=m ++CONFIG_USB_SERIAL_F81232=m ++CONFIG_USB_SERIAL_GARMIN=m ++CONFIG_USB_SERIAL_IPW=m ++CONFIG_USB_SERIAL_IUU=m ++CONFIG_USB_SERIAL_KEYSPAN_PDA=m ++CONFIG_USB_SERIAL_KEYSPAN=m ++CONFIG_USB_SERIAL_KLSI=m ++CONFIG_USB_SERIAL_KOBIL_SCT=m ++CONFIG_USB_SERIAL_MCT_U232=m ++CONFIG_USB_SERIAL_METRO=m ++CONFIG_USB_SERIAL_MOS7720=m ++CONFIG_USB_SERIAL_MOS7840=m ++CONFIG_USB_SERIAL_NAVMAN=m ++CONFIG_USB_SERIAL_PL2303=m ++CONFIG_USB_SERIAL_OTI6858=m ++CONFIG_USB_SERIAL_QCAUX=m ++CONFIG_USB_SERIAL_QUALCOMM=m ++CONFIG_USB_SERIAL_SPCP8X5=m ++CONFIG_USB_SERIAL_SAFE=m ++CONFIG_USB_SERIAL_SIERRAWIRELESS=m ++CONFIG_USB_SERIAL_SYMBOL=m ++CONFIG_USB_SERIAL_TI=m ++CONFIG_USB_SERIAL_CYBERJACK=m ++CONFIG_USB_SERIAL_XIRCOM=m ++CONFIG_USB_SERIAL_OPTION=m ++CONFIG_USB_SERIAL_OMNINET=m ++CONFIG_USB_SERIAL_OPTICON=m ++CONFIG_USB_SERIAL_XSENS_MT=m ++CONFIG_USB_SERIAL_WISHBONE=m ++CONFIG_USB_SERIAL_SSU100=m ++CONFIG_USB_SERIAL_QT2=m ++CONFIG_USB_SERIAL_DEBUG=m ++CONFIG_USB_EMI62=m ++CONFIG_USB_EMI26=m ++CONFIG_USB_ADUTUX=m ++CONFIG_USB_SEVSEG=m ++CONFIG_USB_RIO500=m ++CONFIG_USB_LEGOTOWER=m ++CONFIG_USB_LCD=m ++CONFIG_USB_LED=m ++CONFIG_USB_CYPRESS_CY7C63=m ++CONFIG_USB_CYTHERM=m ++CONFIG_USB_IDMOUSE=m ++CONFIG_USB_FTDI_ELAN=m ++CONFIG_USB_APPLEDISPLAY=m ++CONFIG_USB_LD=m ++CONFIG_USB_TRANCEVIBRATOR=m ++CONFIG_USB_IOWARRIOR=m ++CONFIG_USB_TEST=m ++CONFIG_USB_ISIGHTFW=m ++CONFIG_USB_YUREX=m ++CONFIG_USB_ATM=m ++CONFIG_USB_SPEEDTOUCH=m ++CONFIG_USB_CXACRU=m ++CONFIG_USB_UEAGLEATM=m ++CONFIG_USB_XUSBATM=m ++CONFIG_MMC=y ++CONFIG_MMC_BLOCK_MINORS=32 ++CONFIG_MMC_BCM2835=y ++CONFIG_MMC_BCM2835_DMA=y ++CONFIG_MMC_BCM2835_SDHOST=y ++CONFIG_MMC_SDHCI=y ++CONFIG_MMC_SDHCI_PLTFM=y ++CONFIG_MMC_SPI=m ++CONFIG_LEDS_CLASS=y ++CONFIG_LEDS_GPIO=y ++CONFIG_LEDS_TRIGGER_TIMER=y ++CONFIG_LEDS_TRIGGER_ONESHOT=y ++CONFIG_LEDS_TRIGGER_HEARTBEAT=y ++CONFIG_LEDS_TRIGGER_BACKLIGHT=y ++CONFIG_LEDS_TRIGGER_CPU=y ++CONFIG_LEDS_TRIGGER_GPIO=y ++CONFIG_LEDS_TRIGGER_DEFAULT_ON=y ++CONFIG_LEDS_TRIGGER_TRANSIENT=m ++CONFIG_LEDS_TRIGGER_CAMERA=m ++CONFIG_LEDS_TRIGGER_INPUT=y ++CONFIG_RTC_CLASS=y ++# CONFIG_RTC_HCTOSYS is not set ++CONFIG_RTC_DRV_DS1307=m ++CONFIG_RTC_DRV_DS1374=m ++CONFIG_RTC_DRV_DS1672=m ++CONFIG_RTC_DRV_DS3232=m ++CONFIG_RTC_DRV_MAX6900=m ++CONFIG_RTC_DRV_RS5C372=m ++CONFIG_RTC_DRV_ISL1208=m ++CONFIG_RTC_DRV_ISL12022=m ++CONFIG_RTC_DRV_ISL12057=m ++CONFIG_RTC_DRV_X1205=m ++CONFIG_RTC_DRV_PCF2127=m ++CONFIG_RTC_DRV_PCF8523=m ++CONFIG_RTC_DRV_PCF8563=m ++CONFIG_RTC_DRV_PCF8583=m ++CONFIG_RTC_DRV_M41T80=m ++CONFIG_RTC_DRV_BQ32K=m ++CONFIG_RTC_DRV_S35390A=m ++CONFIG_RTC_DRV_FM3130=m ++CONFIG_RTC_DRV_RX8581=m ++CONFIG_RTC_DRV_RX8025=m ++CONFIG_RTC_DRV_EM3027=m ++CONFIG_RTC_DRV_RV3029C2=m ++CONFIG_RTC_DRV_M41T93=m ++CONFIG_RTC_DRV_M41T94=m ++CONFIG_RTC_DRV_DS1305=m ++CONFIG_RTC_DRV_DS1390=m ++CONFIG_RTC_DRV_MAX6902=m ++CONFIG_RTC_DRV_R9701=m ++CONFIG_RTC_DRV_RS5C348=m ++CONFIG_RTC_DRV_DS3234=m ++CONFIG_RTC_DRV_PCF2123=m ++CONFIG_RTC_DRV_RX4581=m ++CONFIG_DMADEVICES=y ++CONFIG_DMA_BCM2708=y ++CONFIG_UIO=m ++CONFIG_UIO_PDRV_GENIRQ=m ++CONFIG_STAGING=y ++CONFIG_PRISM2_USB=m ++CONFIG_R8712U=m ++CONFIG_R8188EU=m ++CONFIG_R8723AU=m ++CONFIG_VT6656=m ++CONFIG_SPEAKUP=m ++CONFIG_SPEAKUP_SYNTH_SOFT=m ++CONFIG_STAGING_MEDIA=y ++CONFIG_LIRC_STAGING=y ++CONFIG_LIRC_IMON=m ++CONFIG_LIRC_RPI=m ++CONFIG_LIRC_SASEM=m ++CONFIG_LIRC_SERIAL=m ++CONFIG_FB_TFT=m ++CONFIG_FB_TFT_AGM1264K_FL=m ++CONFIG_FB_TFT_BD663474=m ++CONFIG_FB_TFT_HX8340BN=m ++CONFIG_FB_TFT_HX8347D=m ++CONFIG_FB_TFT_HX8353D=m ++CONFIG_FB_TFT_ILI9320=m ++CONFIG_FB_TFT_ILI9325=m ++CONFIG_FB_TFT_ILI9340=m ++CONFIG_FB_TFT_ILI9341=m ++CONFIG_FB_TFT_ILI9481=m ++CONFIG_FB_TFT_ILI9486=m ++CONFIG_FB_TFT_PCD8544=m ++CONFIG_FB_TFT_RA8875=m ++CONFIG_FB_TFT_S6D02A1=m ++CONFIG_FB_TFT_S6D1121=m ++CONFIG_FB_TFT_SSD1289=m ++CONFIG_FB_TFT_SSD1306=m ++CONFIG_FB_TFT_SSD1331=m ++CONFIG_FB_TFT_SSD1351=m ++CONFIG_FB_TFT_ST7735R=m ++CONFIG_FB_TFT_TINYLCD=m ++CONFIG_FB_TFT_TLS8204=m ++CONFIG_FB_TFT_UC1701=m ++CONFIG_FB_TFT_UPD161704=m ++CONFIG_FB_TFT_WATTEROTT=m ++CONFIG_FB_FLEX=m ++CONFIG_FB_TFT_FBTFT_DEVICE=m ++CONFIG_MAILBOX=y ++CONFIG_BCM2708_MBOX=y ++# CONFIG_IOMMU_SUPPORT is not set ++CONFIG_EXTCON=m ++CONFIG_EXTCON_ARIZONA=m ++CONFIG_IIO=m ++CONFIG_IIO_BUFFER=y ++CONFIG_IIO_BUFFER_CB=y ++CONFIG_IIO_KFIFO_BUF=m ++CONFIG_DHT11=m ++CONFIG_EXT4_FS=y ++CONFIG_EXT4_FS_POSIX_ACL=y ++CONFIG_EXT4_FS_SECURITY=y ++CONFIG_REISERFS_FS=m ++CONFIG_REISERFS_FS_XATTR=y ++CONFIG_REISERFS_FS_POSIX_ACL=y ++CONFIG_REISERFS_FS_SECURITY=y ++CONFIG_JFS_FS=m ++CONFIG_JFS_POSIX_ACL=y ++CONFIG_JFS_SECURITY=y ++CONFIG_JFS_STATISTICS=y ++CONFIG_XFS_FS=m ++CONFIG_XFS_QUOTA=y ++CONFIG_XFS_POSIX_ACL=y ++CONFIG_XFS_RT=y ++CONFIG_GFS2_FS=m ++CONFIG_OCFS2_FS=m ++CONFIG_BTRFS_FS=m ++CONFIG_BTRFS_FS_POSIX_ACL=y ++CONFIG_NILFS2_FS=m ++CONFIG_FANOTIFY=y ++CONFIG_QFMT_V1=m ++CONFIG_QFMT_V2=m ++CONFIG_AUTOFS4_FS=y ++CONFIG_FUSE_FS=m ++CONFIG_CUSE=m ++CONFIG_FSCACHE=y ++CONFIG_FSCACHE_STATS=y ++CONFIG_FSCACHE_HISTOGRAM=y ++CONFIG_CACHEFILES=y ++CONFIG_ISO9660_FS=m ++CONFIG_JOLIET=y ++CONFIG_ZISOFS=y ++CONFIG_UDF_FS=m ++CONFIG_MSDOS_FS=y ++CONFIG_VFAT_FS=y ++CONFIG_FAT_DEFAULT_IOCHARSET="ascii" ++CONFIG_NTFS_FS=m ++CONFIG_NTFS_RW=y ++CONFIG_TMPFS=y ++CONFIG_TMPFS_POSIX_ACL=y ++CONFIG_CONFIGFS_FS=y ++CONFIG_ECRYPT_FS=m ++CONFIG_HFS_FS=m ++CONFIG_HFSPLUS_FS=m ++CONFIG_SQUASHFS=m ++CONFIG_SQUASHFS_XATTR=y ++CONFIG_SQUASHFS_LZO=y ++CONFIG_SQUASHFS_XZ=y ++CONFIG_F2FS_FS=y ++CONFIG_NFS_FS=y ++CONFIG_NFS_V3_ACL=y ++CONFIG_NFS_V4=y ++CONFIG_NFS_SWAP=y ++CONFIG_ROOT_NFS=y ++CONFIG_NFS_FSCACHE=y ++CONFIG_NFSD=m ++CONFIG_NFSD_V3_ACL=y ++CONFIG_NFSD_V4=y ++CONFIG_CIFS=m ++CONFIG_CIFS_WEAK_PW_HASH=y ++CONFIG_CIFS_UPCALL=y ++CONFIG_CIFS_XATTR=y ++CONFIG_CIFS_POSIX=y ++CONFIG_9P_FS=m ++CONFIG_9P_FS_POSIX_ACL=y ++CONFIG_NLS_DEFAULT="utf8" ++CONFIG_NLS_CODEPAGE_437=y ++CONFIG_NLS_CODEPAGE_737=m ++CONFIG_NLS_CODEPAGE_775=m ++CONFIG_NLS_CODEPAGE_850=m ++CONFIG_NLS_CODEPAGE_852=m ++CONFIG_NLS_CODEPAGE_855=m ++CONFIG_NLS_CODEPAGE_857=m ++CONFIG_NLS_CODEPAGE_860=m ++CONFIG_NLS_CODEPAGE_861=m ++CONFIG_NLS_CODEPAGE_862=m ++CONFIG_NLS_CODEPAGE_863=m ++CONFIG_NLS_CODEPAGE_864=m ++CONFIG_NLS_CODEPAGE_865=m ++CONFIG_NLS_CODEPAGE_866=m ++CONFIG_NLS_CODEPAGE_869=m ++CONFIG_NLS_CODEPAGE_936=m ++CONFIG_NLS_CODEPAGE_950=m ++CONFIG_NLS_CODEPAGE_932=m ++CONFIG_NLS_CODEPAGE_949=m ++CONFIG_NLS_CODEPAGE_874=m ++CONFIG_NLS_ISO8859_8=m ++CONFIG_NLS_CODEPAGE_1250=m ++CONFIG_NLS_CODEPAGE_1251=m ++CONFIG_NLS_ASCII=y ++CONFIG_NLS_ISO8859_1=m ++CONFIG_NLS_ISO8859_2=m ++CONFIG_NLS_ISO8859_3=m ++CONFIG_NLS_ISO8859_4=m ++CONFIG_NLS_ISO8859_5=m ++CONFIG_NLS_ISO8859_6=m ++CONFIG_NLS_ISO8859_7=m ++CONFIG_NLS_ISO8859_9=m ++CONFIG_NLS_ISO8859_13=m ++CONFIG_NLS_ISO8859_14=m ++CONFIG_NLS_ISO8859_15=m ++CONFIG_NLS_KOI8_R=m ++CONFIG_NLS_KOI8_U=m ++CONFIG_DLM=m ++CONFIG_PRINTK_TIME=y ++CONFIG_BOOT_PRINTK_DELAY=y ++CONFIG_DEBUG_MEMORY_INIT=y ++CONFIG_DETECT_HUNG_TASK=y ++CONFIG_TIMER_STATS=y ++# CONFIG_DEBUG_PREEMPT is not set ++CONFIG_LATENCYTOP=y ++CONFIG_IRQSOFF_TRACER=y ++CONFIG_SCHED_TRACER=y ++CONFIG_STACK_TRACER=y ++CONFIG_BLK_DEV_IO_TRACE=y ++# CONFIG_KPROBE_EVENT is not set ++CONFIG_FUNCTION_PROFILER=y ++CONFIG_KGDB=y ++CONFIG_KGDB_KDB=y ++CONFIG_KDB_KEYBOARD=y ++CONFIG_CRYPTO_USER=m ++CONFIG_CRYPTO_CRYPTD=m ++CONFIG_CRYPTO_CBC=y ++CONFIG_CRYPTO_CTS=m ++CONFIG_CRYPTO_XTS=m ++CONFIG_CRYPTO_XCBC=m ++CONFIG_CRYPTO_SHA1_ARM=m ++CONFIG_CRYPTO_SHA512=m ++CONFIG_CRYPTO_TGR192=m ++CONFIG_CRYPTO_WP512=m ++CONFIG_CRYPTO_AES_ARM=m ++CONFIG_CRYPTO_CAST5=m ++CONFIG_CRYPTO_DES=y ++# CONFIG_CRYPTO_ANSI_CPRNG is not set ++# CONFIG_CRYPTO_HW is not set ++CONFIG_CRC_ITU_T=y ++CONFIG_LIBCRC32C=y +diff -ruN linux-4.6.1-old/drivers/misc/Kconfig linux-4.6.1/drivers/misc/Kconfig +--- linux-4.6.1-old/drivers/misc/Kconfig 2016-06-04 12:03:45.637652775 +0000 ++++ linux-4.6.1/drivers/misc/Kconfig 2016-06-04 12:04:23.877652775 +0000 +@@ -4,6 +4,10 @@ + + menu "Misc devices" + ++config BCM2835_WS2812 ++ tristate "Support DMA user access to WS2812 LEDs" ++ ++ + config SENSORS_LIS3LV02D + tristate + depends on INPUT +diff -ruN linux-4.6.1-old/drivers/misc/Makefile linux-4.6.1/drivers/misc/Makefile +--- linux-4.6.1-old/drivers/misc/Makefile 2016-06-04 12:03:45.637652775 +0000 ++++ linux-4.6.1/drivers/misc/Makefile 2016-06-04 12:04:23.877652775 +0000 +@@ -2,6 +2,7 @@ + # Makefile for misc devices that really don't fit anywhere else. + # + ++obj-$(CONFIG_BCM2835_WS2812) += ws2812.o + obj-$(CONFIG_IBM_ASM) += ibmasm/ + obj-$(CONFIG_AD525X_DPOT) += ad525x_dpot.o + obj-$(CONFIG_AD525X_DPOT_I2C) += ad525x_dpot-i2c.o +diff -ruN linux-4.6.1-old/drivers/misc/ws2812.c linux-4.6.1/drivers/misc/ws2812.c +--- linux-4.6.1-old/drivers/misc/ws2812.c 1970-01-01 00:00:00.000000000 +0000 ++++ linux-4.6.1/drivers/misc/ws2812.c 2016-06-04 12:04:23.877652775 +0000 +@@ -0,0 +1,524 @@ ++/* ++ * Raspberry Pi WS2812 PWM driver ++ * ++ * Written by: Gordon Hollingworth <gordon@fiveninjas.com> ++ * Based on DMA PWM driver from Jonathan Bell <jonathan@raspberrypi.org> ++ * ++ * Copyright (C) 2014 Raspberry Pi Ltd. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 as ++ * published by the Free Software Foundation. ++ * ++ * To use this driver you need to make sure that the PWM clock is set to 2.4MHz ++ * and the correct PWM0 output is connected. The best way to do this is to ++ * create a dt-blob.bin on your RaspberryPi, start by downloading the default ++ * dt-blob.dts from ++ * ++ * Note, this uses the same PWM hardware as the standard audio output on the Pi ++ * so you cannot use both simultaneously. ++ * ++ * http://www.raspberrypi.org/documentation/configuration/pin-configuration.md ++ * ++ * (Copy the bit from /dts-v1/; through to the end... This will contain the pin ++ * configuration for all the Raspberry Pi versions (since they are different. ++ * You can get rid of the ones you don't care about. Next alter the PWM0 output ++ * you want to use. ++ * ++ * http://www.raspberrypi.org/documentation/hardware/raspberrypi/bcm2835/BCM2835-ARM-Peripherals.pdf ++ * ++ * The link above will help understand what the GPIOs can do, check out page 102 ++ * You can use: GPIO12, GPIO18 or GPIO40, so for the Slice board we use GPIO40 so ++ * we have the following in the dts file ++ * ++ * pin@p40 { ++ * function = "pwm"; ++ * termination = "no_pulling"; ++ * }; ++ * ++ * And at the bottom of the dts file, although still in the 'videocore' block we ++ * have: ++ * ++ * clock_setup { ++ * clock@PWM { freq = <2400000>; }; ++ * }; ++ * ++ * To check whether the changes are correct you can use 'vcgencmd measure_clock 25' ++ * This should return the value 2400000 ++ * ++ * Also if you use wiringPi then you can do 'gpio readall' to check that the pin ++ * alternate setting is set correctly. ++ * ++ */ ++ ++#include <linux/kernel.h> ++#include <linux/module.h> ++#include <linux/fcntl.h> ++#include <linux/file.h> ++#include <linux/fs.h> ++#include <linux/wait.h> ++#include <linux/io.h> ++#include <linux/ioctl.h> ++#include <linux/cdev.h> ++#include <linux/delay.h> ++#include <linux/interrupt.h> ++#include <linux/dma-mapping.h> ++#include <linux/dmaengine.h> ++#include <linux/slab.h> ++#include <linux/platform_device.h> ++#include <linux/uaccess.h> ++#include <linux/of.h> ++#include <linux/gpio/consumer.h> ++#include <asm-generic/ioctl.h> ++ ++#define DRIVER_NAME "ws2812" ++ ++struct ws2812_state { ++ struct device * dev; ++ struct cdev cdev; ++ struct class * cl; ++ struct dma_chan * dma_chan; ++ dma_addr_t dma_addr; ++ ++ void __iomem * ioaddr; ++ phys_addr_t phys_addr; ++ ++ uint8_t * buffer; ++ uint32_t * pixbuf; ++ ++ struct gpio_desc * led_en; ++ ++ unsigned char brightness; ++ u32 invert; ++ u32 num_leds; ++}; ++ ++#ifndef BCM2708_PERI_BASE ++ #define BCM2708_PERI_BASE 0x20000000 ++#endif ++ ++#define BCM2835_VCMMU_SHIFT (0x7E000000 - BCM2708_PERI_BASE) ++ ++/* Each LED is controlled with a 24 bit RGB value ++ * each bit is created from a nibble of data either ++ * 1000 or 1110 so to create 24 bits you need 12 bytes ++ * of PWM output ++ */ ++#define BYTES_PER_LED 12 ++ ++// Number of 2.4MHz bits in 50us to create a reset condition ++#define RESET_BYTES ((50 * 24) / 80) ++ ++#define PWM_CTL 0x0 ++#define PWM_STA 0x4 ++#define PWM_DMAC 0x8 ++#define PWM_RNG1 0x10 ++#define PWM_DAT1 0x14 ++#define PWM_FIFO1 0x18 ++#define PWM_ID 0x50 ++ ++#define PWM_DMA_DREQ 5 ++ ++static dev_t devid = MKDEV(1337, 0); ++ ++/* ++** Functions to access the pwm peripheral ++*/ ++static void pwm_writel(struct ws2812_state * state, uint32_t val, uint32_t reg) ++{ ++ writel(val, state->ioaddr + reg); ++} ++ ++#if 0 ++static uint32_t pwm_readl(struct ws2812_state * state, uint32_t reg) ++{ ++ return readl(state->ioaddr + reg); ++} ++#endif ++ ++/* Initialise the PWM module to use serial output ++ * mode ++ */ ++static int pwm_init(struct ws2812_state * state) ++{ ++ uint32_t reg; ++ ++ // serial 32 bits per word ++ pwm_writel(state, 32, PWM_RNG1); ++ // Clear ++ pwm_writel(state, 0, PWM_DAT1); ++ ++ reg = (1 << 0) | /* CH1EN */ ++ (1 << 1) | /* serialiser */ ++ (0 << 2) | /* don't repeat last word */ ++ (0 << 3) | /* silence is zero */ ++ ((state->invert ? 1 : 0) << 4) | /* polarity */ ++ (1 << 5) | /* use fifo */ ++ (1 << 6) | /* Clear fifo */ ++ (1 << 7) | /* MSEN - Mask space enable */ ++ ((state->invert ? 1 : 0) << 11); /* Silence bit = 1 */ ++ pwm_writel(state, reg, PWM_CTL); ++ reg = (1 << 31) | /* DMA enabled */ ++ (4 << 8) | /* Threshold for panic */ ++ (8 << 0); /* Threshold for dreq */ ++ pwm_writel(state, reg, PWM_DMAC); ++ ++ return 0; ++ ++} ++ ++/* ++ * DMA callback function, release the mapping and the calling function ++ */ ++void ws2812_callback(void * param) ++{ ++ struct ws2812_state * state = (struct ws2812_state *) param; ++ ++ dma_unmap_single(state->dev, state->dma_addr, state->num_leds * BYTES_PER_LED, ++ DMA_TO_DEVICE); ++ ++} ++ ++/* ++ * Issue a DMA to the PWM peripheral from the assigned buffer ++ * buffer must be unmapped again before being used ++ */ ++int issue_dma(struct ws2812_state * state, uint8_t *buffer, int length) ++{ ++ struct dma_async_tx_descriptor *desc; ++ ++ state->dma_addr = dma_map_single(state->dev, ++ buffer, length, ++ DMA_TO_DEVICE); ++ ++ if(state->dma_addr == 0) ++ { ++ pr_err("Failed to map buffer for DMA\n"); ++ return -1; ++ } ++ ++ desc = dmaengine_prep_slave_single(state->dma_chan, state->dma_addr, ++ length, DMA_TO_DEVICE, DMA_PREP_INTERRUPT); ++ if(desc == NULL) ++ { ++ pr_err("Failed to prep the DMA transfer\n"); ++ return -1; ++ } ++ ++ desc->callback = ws2812_callback; ++ desc->callback_param = state; ++ dmaengine_submit(desc); ++ dma_async_issue_pending(state->dma_chan); ++ ++ return 0; ++} ++ ++ ++int clear_leds(struct ws2812_state * state) ++{ ++ int i; ++ ++ for(i = 0; i < state->num_leds * BYTES_PER_LED; i++) ++ state->buffer[i] = 0x88; ++ for(i = 0; i < RESET_BYTES; i++) ++ state->buffer[state->num_leds * BYTES_PER_LED + i] = 0; ++ ++ issue_dma(state, state->buffer, state->num_leds * BYTES_PER_LED + RESET_BYTES); ++ ++ return 0; ++} ++ ++static int ws2812_open(struct inode *inode, struct file *file) ++{ ++ struct ws2812_state * state; ++ state = container_of(inode->i_cdev, struct ws2812_state, cdev); ++ ++ file->private_data = state; ++ ++ return 0; ++} ++ ++/* WS2812B gamma correction ++GammaE=255*(res/255).^(1/.45) ++From: http://rgb-123.com/ws2812-color-output/ ++*/ ++unsigned char gamma_(unsigned char brightness, unsigned char val) ++{ ++ int bright = val; ++ unsigned char GammaE[] = { ++ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ++ 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, ++ 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, ++ 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 11, 11, ++ 11, 12, 12, 13, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, ++ 19, 19, 20, 21, 21, 22, 22, 23, 23, 24, 25, 25, 26, 27, 27, 28, ++ 29, 29, 30, 31, 31, 32, 33, 34, 34, 35, 36, 37, 37, 38, 39, 40, ++ 40, 41, 42, 43, 44, 45, 46, 46, 47, 48, 49, 50, 51, 52, 53, 54, ++ 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, ++ 71, 72, 73, 74, 76, 77, 78, 79, 80, 81, 83, 84, 85, 86, 88, 89, ++ 90, 91, 93, 94, 95, 96, 98, 99,100,102,103,104,106,107,109,110, ++ 111,113,114,116,117,119,120,121,123,124,126,128,129,131,132,134, ++ 135,137,138,140,142,143,145,146,148,150,151,153,155,157,158,160, ++ 162,163,165,167,169,170,172,174,176,178,179,181,183,185,187,189, ++ 191,193,194,196,198,200,202,204,206,208,210,212,214,216,218,220, ++ 222,224,227,229,231,233,235,237,239,241,244,246,248,250,252,255}; ++ bright = (bright * brightness) / 255; ++ return GammaE[bright]; ++} ++ ++// LED serial output ++// 4 bits make up a single bit of the output ++// 1 1 1 0 -- 1 ++// 1 0 0 0 -- 0 ++// ++// Plus require a space of 50 microseconds for reset ++// 24 bits per led ++// ++// (24 * 4) / 8 = 12 bytes per led ++// ++// red = 0xff0000 == 0xeeeeeeee 0x88888888 0x88888888 ++unsigned char * led_encode(struct ws2812_state * state, int rgb, unsigned char *buf) ++{ ++ int i; ++ unsigned char red = gamma_(state->brightness, rgb >> 8); ++ unsigned char blu = gamma_(state->brightness, rgb); ++ unsigned char grn = gamma_(state->brightness, rgb >> 16); ++ int rearrange = red + ++ (blu << 8) + ++ (grn << 16); ++ for(i = 11; i >= 0; i--) ++ { ++ switch(rearrange & 3) ++ { ++ case 0: *buf++ = 0x88; break; ++ case 1: *buf++ = 0x8e; break; ++ case 2: *buf++ = 0xe8; break; ++ case 3: *buf++ = 0xee; break; ++ } ++ rearrange >>= 2; ++ } ++ ++ return buf; ++} ++ ++ ++/* Write to the PWM through DMA ++ * Function to write the RGB buffer to the WS2812 leds, the input buffer ++ * contains a sequence of up to num_leds RGB32 integers, these are then ++ * converted into the nibble per bit sequence required to drive the PWM ++ */ ++ssize_t ws2812_write(struct file *filp, const char __user *buf, size_t count, loff_t *pos) ++{ ++ int32_t *p_rgb; ++ int8_t * p_buffer; ++ int i, length, num_leds; ++ struct ws2812_state * state = (struct ws2812_state *) filp->private_data; ++ ++ num_leds = min(count/4, state->num_leds); ++ ++ if(copy_from_user(state->pixbuf, buf, num_leds * 4)) ++ return -EFAULT; ++ ++ p_rgb = state->pixbuf; ++ p_buffer = state->buffer; ++ for(i = 0; i < num_leds; i++) ++ p_buffer = led_encode(state, *p_rgb++, p_buffer); ++ ++ /* Fill rest with '0' */ ++ memset(p_buffer, 0x00, RESET_BYTES); ++ ++ length = (int) p_buffer - (int) state->buffer + RESET_BYTES; ++ ++ /* Setup DMA engine */ ++ issue_dma(state, state->buffer, length); ++ ++ return count; ++} ++ ++ ++struct file_operations ws2812_fops = { ++ .owner = THIS_MODULE, ++ .llseek = NULL, ++ .read = NULL, ++ .write = ws2812_write, ++ .open = ws2812_open, ++ .release = NULL, ++}; ++ ++/* ++ * Probe function ++ */ ++static int ws2812_probe(struct platform_device *pdev) ++{ ++ int ret; ++ struct device *dev = &pdev->dev; ++ struct device_node *node = dev->of_node; ++ struct ws2812_state * state; ++ struct dma_slave_config cfg = ++ { ++ .src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES, ++ .dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES, ++ .slave_id = PWM_DMA_DREQ, ++ .direction = DMA_MEM_TO_DEV, ++ .src_addr = 0, ++ }; ++ struct resource *iomem; ++ ++ if(node == NULL) ++ { ++ pr_err("Require device tree entry\n"); ++ goto fail; ++ } ++ ++ state = kmalloc(sizeof(struct ws2812_state), GFP_KERNEL); ++ if (!state) { ++ pr_err("Can't allocate state\n"); ++ goto fail; ++ } ++ ++ state->dev = dev; ++ state->brightness = 255; ++ ++ // Create character device interface /dev/ws2812 ++ if(alloc_chrdev_region(&devid, 0, 1, "ws2812") < 0) ++ { ++ pr_err("Unable to create chrdev region"); ++ goto fail_malloc; ++ } ++ if((state->cl = class_create(THIS_MODULE, "ws2812")) == NULL) ++ { ++ unregister_chrdev_region(devid, 1); ++ pr_err("Unable to create class ws2812"); ++ goto fail_chrdev; ++ } ++ if(device_create(state->cl, NULL, devid, NULL, "ws2812") == NULL) ++ { ++ class_destroy(state->cl); ++ unregister_chrdev_region(devid, 1); ++ pr_err("Unable to create device ws2812"); ++ goto fail_class; ++ } ++ ++ state->cdev.owner = THIS_MODULE; ++ cdev_init(&state->cdev, &ws2812_fops); ++ ++ if(cdev_add(&state->cdev, devid, 1)) { ++ pr_err("CDEV failed\n"); ++ goto fail_device; ++ } ++ ++ platform_set_drvdata(pdev, state); ++ ++ /* get parameters from device tree */ ++ of_property_read_u32(node, ++ "rpi,invert", ++ &state->invert); ++ of_property_read_u32(node, ++ "rpi,num_leds", ++ &state->num_leds); ++ ++ state->pixbuf = kmalloc(state->num_leds * sizeof(int), GFP_KERNEL); ++ if(state->pixbuf == NULL) ++ { ++ pr_err("Failed to allocate internal buffer\n"); ++ goto fail_cdev; ++ } ++ ++ iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0); ++ state->ioaddr = devm_ioremap_resource(dev, iomem); ++ if (IS_ERR(state->ioaddr)) { ++ goto fail_pixbuf; ++ } ++ pr_err("iomem->start = 0x%x\n", iomem->start); ++ state->phys_addr = iomem->start + BCM2835_VCMMU_SHIFT; ++ ++ state->buffer = kmalloc(state->num_leds * BYTES_PER_LED + RESET_BYTES, GFP_KERNEL); ++ if(state->buffer == NULL) ++ { ++ pr_err("Failed to allocate internal buffer\n"); ++ goto fail_pixbuf; ++ } ++ ++ state->dma_chan = dma_request_slave_channel(dev, "pwm_dma"); ++ if(state->dma_chan == NULL) ++ { ++ pr_err("Failed to request DMA channel"); ++ goto fail_buffer; ++ } ++ ++ /* request a DMA channel */ ++ cfg.dst_addr = state->phys_addr + PWM_FIFO1; ++ ret = dmaengine_slave_config(state->dma_chan, &cfg); ++ if (state->dma_chan < 0) { ++ pr_err("Can't allocate DMA channel\n"); ++ goto fail_dma_init; ++ } ++ pwm_init(state); ++ ++ // Enable the LED power ++ state->led_en = devm_gpiod_get(dev, "led-en", GPIOD_OUT_HIGH); ++ ++ clear_leds(state); ++ ++ return 0; ++fail_dma_init: ++ dma_release_channel(state->dma_chan); ++fail_buffer: ++ kfree(state->buffer); ++fail_pixbuf: ++ kfree(state->pixbuf); ++fail_cdev: ++ cdev_del(&state->cdev); ++fail_device: ++ device_destroy(state->cl, devid); ++fail_class: ++ class_destroy(state->cl); ++fail_chrdev: ++ unregister_chrdev_region(devid, 1); ++fail_malloc: ++ kfree(state); ++fail: ++ ++ return -1; ++} ++ ++ ++static int ws2812_remove(struct platform_device *pdev) ++{ ++ struct ws2812_state *state = platform_get_drvdata(pdev); ++ ++ platform_set_drvdata(pdev, NULL); ++ ++ dma_release_channel(state->dma_chan); ++ kfree(state->buffer); ++ kfree(state->pixbuf); ++ cdev_del(&state->cdev); ++ device_destroy(state->cl, devid); ++ class_destroy(state->cl); ++ unregister_chrdev_region(devid, 1); ++ kfree(state); ++ ++ return 0; ++} ++ ++static const struct of_device_id ws2812_match[] = { ++ { .compatible = "rpi,ws2812" }, ++ { } ++}; ++MODULE_DEVICE_TABLE(of, ws2812_match); ++ ++static struct platform_driver ws2812_driver = { ++ .probe = ws2812_probe, ++ .remove = ws2812_remove, ++ .driver = { ++ .name = DRIVER_NAME, ++ .owner = THIS_MODULE, ++ .of_match_table = ws2812_match, ++ }, ++}; ++module_platform_driver(ws2812_driver); ++ ++MODULE_ALIAS("platform:ws2812"); ++MODULE_DESCRIPTION("WS2812 PWM driver"); ++MODULE_LICENSE("GPL v2"); ++MODULE_AUTHOR("Gordon Hollingworth"); +diff -ruN linux-4.6.1-old/drivers/rtc/rtc-pcf8523.c linux-4.6.1/drivers/rtc/rtc-pcf8523.c +--- linux-4.6.1-old/drivers/rtc/rtc-pcf8523.c 2016-06-04 12:03:53.241652775 +0000 ++++ linux-4.6.1/drivers/rtc/rtc-pcf8523.c 2016-06-04 12:04:23.877652775 +0000 +@@ -291,7 +291,13 @@ + if (!pcf) + return -ENOMEM; + +- err = pcf8523_select_capacitance(client, true); ++ if (of_property_read_bool(client->dev.of_node, "nxp,xtalcap-7pf")) { ++ printk(KERN_ERR "PCF8523 - set 7pF crystal load"); ++ err = pcf8523_select_capacitance(client, false); ++ } else { ++ printk(KERN_ERR "PCF8523 - set 12pF crystal load"); ++ err = pcf8523_select_capacitance(client, true); ++ } + if (err < 0) + return err; + +diff -ruN linux-4.6.1-old/sound/soc/bcm/Kconfig linux-4.6.1/sound/soc/bcm/Kconfig +--- linux-4.6.1-old/sound/soc/bcm/Kconfig 2016-06-04 12:04:04.309652775 +0000 ++++ linux-4.6.1/sound/soc/bcm/Kconfig 2016-06-04 12:06:59.125652775 +0000 +@@ -100,3 +100,10 @@ + select SND_SOC_WM8741 + help + Say Y or M if you want to add support for Red Rocks Audio DigiDAC1 board. ++ ++config SND_BCM2708_SOC_SLICE ++ tristate "Support for Slice on-board sound" ++ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S ++ select SND_SOC_CS4265 ++ help ++ Say Y or M if you want to add support for Slice on-board sound. +diff -ruN linux-4.6.1-old/sound/soc/bcm/Makefile linux-4.6.1/sound/soc/bcm/Makefile +--- linux-4.6.1-old/sound/soc/bcm/Makefile 2016-06-04 12:04:04.309652775 +0000 ++++ linux-4.6.1/sound/soc/bcm/Makefile 2016-06-04 12:07:33.209652775 +0000 +@@ -17,6 +17,7 @@ + snd-soc-raspidac3-objs := raspidac3.o + snd-soc-audioinjector-pi-soundcard-objs := audioinjector-pi-soundcard.o + snd-soc-digidac1-soundcard-objs := digidac1-soundcard.o ++snd-soc-slice-objs := slice.o + + obj-$(CONFIG_SND_BCM2708_SOC_ADAU1977_ADC) += snd-soc-adau1977-adc.o + obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o +@@ -31,4 +32,5 @@ + obj-$(CONFIG_SND_BCM2708_SOC_RASPIDAC3) += snd-soc-raspidac3.o + obj-$(CONFIG_SND_AUDIOINJECTOR_PI_SOUNDCARD) += snd-soc-audioinjector-pi-soundcard.o + obj-$(CONFIG_SND_DIGIDAC1_SOUNDCARD) += snd-soc-digidac1-soundcard.o ++obj-$(CONFIG_SND_BCM2708_SOC_SLICE) += snd-soc-slice.o + +diff -ruN linux-4.6.1-old/sound/soc/bcm/slice.c linux-4.6.1/sound/soc/bcm/slice.c +--- linux-4.6.1-old/sound/soc/bcm/slice.c 1970-01-01 00:00:00.000000000 +0000 ++++ linux-4.6.1/sound/soc/bcm/slice.c 2016-06-04 12:04:23.877652775 +0000 +@@ -0,0 +1,326 @@ ++/* ++ * ASoC Driver for Slice on-board sound ++ * ++ * Author: James Adams <james@fiveninjas.com> ++ * Based on the HifiBerry DAC driver by Florian Meier <florian.meier@koalo.de> ++ * Copyright 2014 ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * version 2 as published by the Free Software Foundation. ++ * ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * General Public License for more details. ++ */ ++ ++#include <linux/module.h> ++#include <linux/platform_device.h> ++ ++#include <linux/io.h> ++ ++#include <sound/core.h> ++#include <sound/pcm.h> ++#include <sound/pcm_params.h> ++#include <sound/soc.h> ++#include <sound/jack.h> ++ ++#include "../codecs/cs4265.h" ++ ++static void __iomem *aper_base; ++static void __iomem *apll_base; ++static void __iomem *a2w_base; ++ ++#define CM_PLLA (apll_base) ++#define A2W_APER (a2w_base) ++ ++static int snd_slice_init(struct snd_soc_pcm_runtime *rtd) ++{ ++ return 0; ++} ++ ++#define BCM2708_CLK_PASSWD (0x5a000000) ++#define BCM2708_CLK_MASH(v) ((v) << 9) ++#define BCM2708_CLK_FLIP BIT(8) ++#define BCM2708_CLK_BUSY BIT(7) ++#define BCM2708_CLK_KILL BIT(5) ++#define BCM2708_CLK_ENAB BIT(4) ++#define BCM2708_CLK_SRC(v) (v) ++ ++#define BCM2708_CLK_LOADMASK BIT(6) ++#define BCM2708_CLK_HOLDMASK BIT(7) ++#define BCM2708_CLK_CHENB BIT(8) ++ ++void set_aper(int div) ++{ ++ if ( div == 0 ) { ++ writel(BCM2708_CLK_PASSWD | (readl(CM_PLLA) & ~BCM2708_CLK_LOADMASK) ++ | BCM2708_CLK_HOLDMASK, CM_PLLA); ++ // This line removes the channel enable and resets the divisor to 0 ++ // and disables the bypass clock ++ writel(BCM2708_CLK_PASSWD | BCM2708_CLK_CHENB, A2W_APER); ++ return; ++ } ++ ++ // To save time reading status bits from a2w regs we perform the same ++ // actions for starting a channel and changing a channel ++ // First we enable the channel and set the divisor ++ writel(BCM2708_CLK_PASSWD | div, A2W_APER); ++ ++ // Now load the divisor ++ writel(BCM2708_CLK_PASSWD | readl(CM_PLLA) | BCM2708_CLK_LOADMASK, CM_PLLA); ++ writel(BCM2708_CLK_PASSWD | (readl(CM_PLLA) & ~BCM2708_CLK_LOADMASK), CM_PLLA); ++ ++ // Now remove the hold (does nothing if already running) ++ writel(BCM2708_CLK_PASSWD | (readl(CM_PLLA) & ~BCM2708_CLK_HOLDMASK), CM_PLLA); ++} ++ ++ ++static void set_gp0div(unsigned int val) ++{ ++ int timeout = 1000; ++ ++ // First stop the clock ++ writel(BCM2708_CLK_PASSWD | (readl(aper_base) & ~BCM2708_CLK_ENAB), aper_base); ++ ++ // Wait until it is not busy ++ while (--timeout && (readl(aper_base) & BCM2708_CLK_BUSY)); ++ ++ if (timeout) { ++ writel(val | BCM2708_CLK_PASSWD, aper_base + 4); ++ writel(readl(aper_base) | BCM2708_CLK_PASSWD | BCM2708_CLK_ENAB, aper_base); ++ printk(KERN_ERR "New clock set"); ++ } ++ else ++ printk(KERN_ERR "Failed waiting for clock to stop"); ++} ++ ++ ++static int snd_slice_hw_params(struct snd_pcm_substream *substream, ++ struct snd_pcm_hw_params *params) ++{ ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_dai *codec_dai = rtd->codec_dai; ++ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; ++ struct snd_soc_codec *codec = rtd->codec; ++ int err; ++ int ret; ++ unsigned int rate = params_rate(params); ++ unsigned int sysclk = 12288000; ++ ++ switch (rate) { ++ case 32000: ++ sysclk = 12288000; ++ break; ++ case 44100: ++ sysclk = 11289600; ++ break; ++ case 48000: ++ sysclk = 12288000; ++ break; ++ case 64000: ++ sysclk = 12288000; ++ break; ++ case 88200: ++ sysclk = 11289600; ++ break; ++ case 96000: ++ sysclk = 12288000; ++ break; ++ case 128000: ++ dev_err(codec->dev, ++ "Failed to set CS4265 SYSCLK, sample rate not supported in ALSA: 128000\n"); ++ break; ++ case 176400: ++ sysclk = 11289600; ++ break; ++ case 192000: ++ sysclk = 12288000; ++ break; ++ default: ++ dev_err(codec->dev, ++ "Failed to set CS4265 SYSCLK, sample rate not supported\n"); ++ break; ++ } ++ ++ // Need two frequencies: 12.288 or 11.2896MHz ++ // Source is 1,806,336,000 ++ // /4 /40 - 1128960 ++ // /7 /21 - 1228800 ++ if (sysclk == 12288000) { ++ set_aper(0); ++ set_aper(7); ++ set_gp0div(0x15000); ++ printk(KERN_ERR "Setting hw_params, GP0_CTL=0x%x GP0_DIV=0x%x\n", readl(aper_base), readl(aper_base+0x4)); ++ } else { ++ set_aper(0); ++ set_aper(4); ++ set_gp0div(0x28000); ++ printk(KERN_ERR "Setting hw_params, GP0_CTL=0x%x GP0_DIV=0x%x\n", readl(aper_base), readl(aper_base+0x4)); ++ } ++ ++ printk(KERN_ERR "A2W_APER = 0x%x", readl(A2W_APER)); ++ ++ dev_err(codec->dev, "Set sampling frequency %d, using sysclk %d\n", rate, sysclk); ++ ++ err = snd_soc_dai_set_sysclk(codec_dai, 0, sysclk, ++ SND_SOC_CLOCK_OUT); ++ ++ ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S | ++ SND_SOC_DAIFMT_NB_NF | ++ SND_SOC_DAIFMT_CBM_CFM); ++ ++ if (ret) { ++ dev_err(cpu_dai->dev, ++ "Failed to set the cpu dai format.\n"); ++ return ret; ++ } ++ ++ ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S | ++ SND_SOC_DAIFMT_NB_NF | ++ SND_SOC_DAIFMT_CBM_CFM); ++ if (ret) { ++ dev_err(cpu_dai->dev, ++ "Failed to set the codec format.\n"); ++ return ret; ++ } ++ ++ snd_soc_dai_set_bclk_ratio(cpu_dai, 64); ++ ++ return 0; ++} ++ ++/* machine stream operations */ ++static struct snd_soc_ops snd_slice_ops = { ++ .hw_params = snd_slice_hw_params, ++}; ++ ++/* Widgets */ ++static const struct snd_soc_dapm_widget snd_slice_dapm_widgets[] = { ++ SND_SOC_DAPM_SPK("Speaker 1", NULL), ++ SND_SOC_DAPM_SPK("Speaker 2", NULL), ++ SND_SOC_DAPM_MIC("Mic 1", NULL), ++ SND_SOC_DAPM_MIC("Mic 2", NULL), ++ SND_SOC_DAPM_MIC("LineIn 1", NULL), ++ SND_SOC_DAPM_MIC("LineIn 2", NULL), ++ SND_SOC_DAPM_SPK("Spdif", NULL), ++}; ++ ++/* Audio Map */ ++static const struct snd_soc_dapm_route snd_slice_audio_map[] = { ++ {"Speaker 1", NULL, "LINEOUTL"}, ++ {"Speaker 2", NULL, "LINEOUTR"}, ++ {"MICL", NULL, "Mic 1"}, ++ {"MICR", NULL, "Mic 2"}, ++ {"LINEINL", NULL, "LineIn 1"}, ++ {"LINEINR", NULL, "LineIn 2"}, ++ {"Spdif", NULL, "SPDIF"}, ++}; ++ ++static struct snd_soc_dai_link snd_slice_dai[] = { ++{ ++ .name = "Slice", ++ .stream_name = "Slice HiFi", ++ .cpu_dai_name = "bcm2708-i2s.0", ++ .codec_dai_name = "cs4265-dai1", ++ .platform_name = "bcm2708-i2s.0", ++ .codec_name = "cs4265.1-004e", ++ .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | ++ SND_SOC_DAIFMT_CBM_CFM, ++ .ops = &snd_slice_ops, ++ .init = snd_slice_init, ++}, ++}; ++ ++/* audio machine driver */ ++static struct snd_soc_card snd_slice = { ++ .name = "snd_slice", ++ .dai_link = snd_slice_dai, ++ .num_links = ARRAY_SIZE(snd_slice_dai), ++ .fully_routed = 1, ++ .dapm_widgets = snd_slice_dapm_widgets, ++ .num_dapm_widgets = ARRAY_SIZE(snd_slice_dapm_widgets), ++ .dapm_routes = snd_slice_audio_map, ++ .num_dapm_routes = ARRAY_SIZE(snd_slice_audio_map), ++}; ++ ++static int snd_slice_probe(struct platform_device *pdev) ++{ ++ int ret = 0; ++ struct resource *mem; ++ snd_slice.dev = &pdev->dev; ++ ++ if (pdev->dev.of_node) { ++ struct device_node *i2s_node; ++ struct snd_soc_dai_link *dai = &snd_slice_dai[0]; ++ i2s_node = of_parse_phandle(pdev->dev.of_node, ++ "i2s-controller", 0); ++ ++ if (i2s_node) { ++ dai->cpu_dai_name = NULL; ++ dai->cpu_of_node = i2s_node; ++ dai->platform_name = NULL; ++ dai->platform_of_node = i2s_node; ++ } ++ } ++ else ++ { ++ printk(KERN_ERR "SLICEAUDIO - ERROR no Device Tree!\n"); ++ } ++ ++ ret = snd_soc_register_card(&snd_slice); ++ if (ret) { ++ dev_err(&pdev->dev, ++ "snd_soc_register_card() failed: %d\n", ret); ++ goto snd_soc_register_card_failed; ++ } ++ ++ mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); ++ aper_base = devm_ioremap_resource(&pdev->dev, mem); ++ if (IS_ERR(aper_base)) ++ return PTR_ERR(aper_base); ++ ++ mem = platform_get_resource(pdev, IORESOURCE_MEM, 1); ++ apll_base = devm_ioremap_resource(&pdev->dev, mem); ++ if (IS_ERR(apll_base)) ++ return PTR_ERR(apll_base); ++ ++ mem = platform_get_resource(pdev, IORESOURCE_MEM, 2); ++ a2w_base = devm_ioremap_resource(&pdev->dev, mem); ++ if (IS_ERR(a2w_base)) ++ return PTR_ERR(a2w_base); ++ ++ return 0; ++ ++snd_soc_register_card_failed: ++ ++ return ret; ++} ++ ++static int snd_slice_remove(struct platform_device *pdev) ++{ ++ return snd_soc_unregister_card(&snd_slice); ++} ++ ++static const struct of_device_id slice_of_match[] = { ++ { .compatible = "fiveninjas,slice", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, slice_of_match); ++ ++static struct platform_driver snd_slice_driver = { ++ .driver = { ++ .name = "snd-slice", ++ .owner = THIS_MODULE, ++ .of_match_table = slice_of_match, ++ }, ++ .probe = snd_slice_probe, ++ .remove = snd_slice_remove, ++}; ++ ++module_platform_driver(snd_slice_driver); ++ ++MODULE_AUTHOR("James Adams <james@fiveninjas.com>"); ++MODULE_DESCRIPTION("ASoC Driver for Slice on-board audio"); ++MODULE_LICENSE("GPL v2"); diff --git a/projects/Slice/patches/linux/linux-03-cs4265.patch b/projects/Slice/patches/linux/linux-03-cs4265.patch new file mode 100644 index 00000000000..5b6afea0f7c --- /dev/null +++ b/projects/Slice/patches/linux/linux-03-cs4265.patch @@ -0,0 +1,85 @@ +diff -ru linux-4.4-rc7-old/sound/soc/bcm/slice.c linux-4.4-rc7/sound/soc/bcm/slice.c +--- linux-4.4-rc7-old/sound/soc/bcm/slice.c 2016-01-14 20:44:40.637652775 +0000 ++++ linux-4.4-rc7/sound/soc/bcm/slice.c 2016-01-17 11:18:00.233652775 +0000 +@@ -191,6 +191,15 @@ + return 0; + } + ++static int snd_slice_params_fixup(struct snd_soc_pcm_runtime *rtd, ++ struct snd_pcm_hw_params *params) ++{ ++printk(KERN_ERR "snd_slice_params_fixup called\n"); ++ /* force 32 bit */ ++ params_set_format(params, SNDRV_PCM_FORMAT_S32_LE); ++ return 0; ++} ++ + /* machine stream operations */ + static struct snd_soc_ops snd_slice_ops = { + .hw_params = snd_slice_hw_params, +@@ -218,6 +227,10 @@ + {"Spdif", NULL, "SPDIF"}, + }; + ++static const struct snd_soc_pcm_stream snd_slice_params = { ++ .formats = SNDRV_PCM_FMTBIT_S32_LE | SNDRV_PCM_FMTBIT_S24_LE, ++}; ++ + static struct snd_soc_dai_link snd_slice_dai[] = { + { + .name = "Slice", +@@ -230,6 +243,7 @@ + SND_SOC_DAIFMT_CBM_CFM, + .ops = &snd_slice_ops, + .init = snd_slice_init, ++ .be_hw_params_fixup = snd_slice_params_fixup, + }, + }; + +diff -ru linux-4.4-rc7-old/sound/soc/codecs/cs4265.c linux-4.4-rc7/sound/soc/codecs/cs4265.c +--- linux-4.4-rc7-old/sound/soc/codecs/cs4265.c 2016-01-13 20:56:05.637652775 +0000 ++++ linux-4.4-rc7/sound/soc/codecs/cs4265.c 2016-01-17 11:21:16.977652775 +0000 +@@ -157,7 +157,7 @@ + SOC_SINGLE("Validity Bit Control Switch", CS4265_SPDIF_CTL2, + 3, 1, 0), + SOC_ENUM("SPDIF Mono/Stereo", spdif_mono_stereo_enum), +- SOC_SINGLE("MMTLR Data Switch", 0, ++ SOC_SINGLE("MMTLR Data Switch", CS4265_SPDIF_CTL2, + 1, 1, 0), + SOC_ENUM("Mono Channel Select", spdif_mono_select_enum), + SND_SOC_BYTES("C Data Buffer", CS4265_C_DATA_BUFF, 24), +@@ -199,8 +199,6 @@ + SND_SOC_NOPM, 0, 0), + SND_SOC_DAPM_AIF_IN("DIN2", NULL, 0, + SND_SOC_NOPM, 0, 0), +- SND_SOC_DAPM_AIF_IN("TXIN", NULL, 0, +- CS4265_SPDIF_CTL2, 5, 1), + + SND_SOC_DAPM_OUTPUT("LINEOUTL"), + SND_SOC_DAPM_OUTPUT("LINEOUTR"), +@@ -384,7 +382,6 @@ + static int cs4265_digital_mute(struct snd_soc_dai *dai, int mute) + { + struct snd_soc_codec *codec = dai->codec; +- + if (mute) { + snd_soc_update_bits(codec, CS4265_DAC_CTL, + CS4265_DAC_CTL_MUTE, +@@ -410,7 +407,7 @@ + struct snd_soc_codec *codec = dai->codec; + struct cs4265_private *cs4265 = snd_soc_codec_get_drvdata(codec); + int index; +- ++printk(KERN_ERR "cs4265_pcm_hw_params: format = 0x%x, width = %d\n", cs4265->format, params_width(params)); + if (substream->stream == SNDRV_PCM_STREAM_CAPTURE && + ((cs4265->format & SND_SOC_DAIFMT_FORMAT_MASK) + == SND_SOC_DAIFMT_RIGHT_J)) +@@ -469,6 +466,7 @@ + static int cs4265_set_bias_level(struct snd_soc_codec *codec, + enum snd_soc_bias_level level) + { ++printk(KERN_ERR "set_bias_level %d\n", level); + switch (level) { + case SND_SOC_BIAS_ON: + break; +Only in linux-4.4-rc7/sound/soc/codecs: cs4265.c.orig diff --git a/projects/Slice2/filesystem/usr/config/autostart.sh b/projects/Slice2/filesystem/usr/config/autostart.sh new file mode 100644 index 00000000000..0b6166972bc --- /dev/null +++ b/projects/Slice2/filesystem/usr/config/autostart.sh @@ -0,0 +1,2 @@ +#!/bin/bash +hdparm -S60 /dev/sda diff --git a/projects/Slice2/filesystem/usr/config/shutdown.sh b/projects/Slice2/filesystem/usr/config/shutdown.sh new file mode 100644 index 00000000000..ebd32374e62 --- /dev/null +++ b/projects/Slice2/filesystem/usr/config/shutdown.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +if [ -f /storage/.kodi/media/ledpatterns/shutdown.png ]; then + LEDDIR=/storage/.kodi +else + LEDDIR=/usr/share/kodi +fi + +case "$1" in + halt) + hdparm -y /dev/sda + led_png $LEDDIR/media/ledpatterns/shutdown.png + ;; + poweroff) + hdparm -y /dev/sda + led_png $LEDDIR/media/ledpatterns/shutdown.png + ;; + reboot) + led_png $LEDDIR/media/ledpatterns/shutdown.png + ;; + *) + ;; +esac diff --git a/projects/Slice2/filesystem/usr/lib/systemd/system/serial-console.service b/projects/Slice2/filesystem/usr/lib/systemd/system/serial-console.service new file mode 100644 index 00000000000..196e8c4a97a --- /dev/null +++ b/projects/Slice2/filesystem/usr/lib/systemd/system/serial-console.service @@ -0,0 +1,23 @@ +[Unit] +Description=Debug Shell on /dev/console +DefaultDependencies=no +ConditionKernelCommandLine=console + +[Service] +WorkingDirectory=/storage +Environment="ENV=/etc/profile" +ExecStartPre=/bin/sh -c 'echo -en "\033[?25h"' +ExecStart=/bin/sh +Restart=always +RestartSec=0 +StandardInput=tty +TTYPath=/dev/console +TTYReset=yes +TTYVHangup=yes +KillMode=process +IgnoreSIGPIPE=no +# bash ignores SIGTERM +KillSignal=SIGHUP + +[Install] +WantedBy=sysinit.target diff --git a/projects/Slice2/initramfs/platform_init b/projects/Slice2/initramfs/platform_init new file mode 100644 index 00000000000..e3e2e7d50aa --- /dev/null +++ b/projects/Slice2/initramfs/platform_init @@ -0,0 +1,28 @@ +#!/bin/sh + +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2015 Stephan Raue (stephan@openelec.tv) +# +# OpenELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# OpenELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with OpenELEC. If not, see <http://www.gnu.org/licenses/>. +################################################################################ + +# Enable io_is_busy for improved sdhost performance - essentially, equivalent of force_turbo=1 but for mmc +echo 1 > /sys/devices/system/cpu/cpufreq/ondemand/io_is_busy + +# Configure frequency scaling properties - should improve performance a little (turbo, in most cases) +echo ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor +echo 50 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold +echo 100000 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_rate +echo 50 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor diff --git a/projects/Slice2/kodi/advancedsettings.xml b/projects/Slice2/kodi/advancedsettings.xml new file mode 100644 index 00000000000..45b34cb598e --- /dev/null +++ b/projects/Slice2/kodi/advancedsettings.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<advancedsettings> + <showexitbutton>false</showexitbutton> + + <fanartres>720</fanartres> + <imageres>540</imageres> + + <video> + <busydialogdelayms>750</busydialogdelayms> + </video> + + <samba> + <clienttimeout>30</clienttimeout> + </samba> +</advancedsettings> diff --git a/projects/Slice2/kodi/guisettings.xml b/projects/Slice2/kodi/guisettings.xml new file mode 100644 index 00000000000..ea2cb014e40 --- /dev/null +++ b/projects/Slice2/kodi/guisettings.xml @@ -0,0 +1,514 @@ +<settings> + <audiocds> + <autoaction default="true">0</autoaction> + <ejectonrip default="true">true</ejectonrip> + <encoder default="true">audioencoder.xbmc.builtin.wav</encoder> + <recordingpath default="true"></recordingpath> + <trackpathformat default="true">%A/%A - %B/[%N. ][%A - ]%T</trackpathformat> + <usecddb default="true">true</usecddb> + </audiocds> + <audiooutput> + <ac3passthrough default="true">true</ac3passthrough> + <ac3transcode default="true">false</ac3transcode> + <audiodevice default="true">PI:HDMI</audiodevice> + <boostcenter default="true">0</boostcenter> + <channels default="true">1</channels> + <config default="true">2</config> + <dtshdpassthrough default="true">false</dtshdpassthrough> + <dtspassthrough default="true">false</dtspassthrough> + <eac3passthrough default="true">false</eac3passthrough> + <guisoundmode default="true">1</guisoundmode> + <maintainoriginalvolume default="true">true</maintainoriginalvolume> + <passthrough default="true">false</passthrough> + <passthroughdevice default="true">PI:HDMI</passthroughdevice> + <processquality default="true">101</processquality> + <samplerate default="true">48000</samplerate> + <stereoupmix default="true">false</stereoupmix> + <streamsilence default="true">1</streamsilence> + <truehdpassthrough default="true">false</truehdpassthrough> + </audiooutput> + <cache> + <harddisk default="true">256</harddisk> + </cache> + <cacheaudio> + <dvdrom default="true">256</dvdrom> + <internet default="true">256</internet> + <lan default="true">256</lan> + </cacheaudio> + <cachedvd> + <dvdrom default="true">2048</dvdrom> + <lan default="true">2048</lan> + </cachedvd> + <cacheunknown> + <internet default="true">4096</internet> + </cacheunknown> + <cachevideo> + <dvdrom default="true">2048</dvdrom> + <internet default="true">4096</internet> + <lan default="true">2048</lan> + </cachevideo> + <debug> + <extralogging default="true">false</extralogging> + <screenshotpath>/storage/screenshots/</screenshotpath> + <setextraloglevel default="true"></setextraloglevel> + <showloginfo default="true">false</showloginfo> + </debug> + <disc> + <playback default="true">0</playback> + </disc> + <dvds> + <automenu default="true">false</automenu> + <autorun default="true">false</autorun> + <playerregion default="true">0</playerregion> + </dvds> + <epg> + <daystodisplay default="true">3</daystodisplay> + <epgupdate default="true">120</epgupdate> + <hidenoinfoavailable default="true">true</hidenoinfoavailable> + <ignoredbforclient default="true">false</ignoredbforclient> + <preventupdateswhileplayingtv default="true">false</preventupdateswhileplayingtv> + <selectaction default="true">2</selectaction> + </epg> + <filelists> + <allowfiledeletion default="true">false</allowfiledeletion> + <browsearchives default="true">true</browsearchives> + <ignorethewhensorting>false</ignorethewhensorting> + <showaddsourcebuttons default="true">true</showaddsourcebuttons> + <showextensions>false</showextensions> + <showhidden default="true">false</showhidden> + <showparentdiritems>false</showparentdiritems> + </filelists> + <general> + <addonbrokenfilter default="true">true</addonbrokenfilter> + <addonforeignfilter default="true">false</addonforeignfilter> + <addonnotifications default="true">true</addonnotifications> + <addonupdates default="true">0</addonupdates> + <settinglevel>1</settinglevel> + <systemtotaluptime>0</systemtotaluptime> + </general> + <input> + <enablejoystick default="true">true</enablejoystick> + <enablemouse default="true">true</enablemouse> + </input> + <karaoke> + <autopopupselector default="true">false</autopopupselector> + <charset default="true">DEFAULT</charset> + <enabled default="true">false</enabled> + <font default="true">arial.ttf</font> + <fontcolors default="true">0</fontcolors> + <fontheight default="true">36</fontheight> + </karaoke> + <locale> + <audiolanguage>default</audiolanguage> + <charset default="true">DEFAULT</charset> + <country>UK (24h)</country> + <keyboardlayouts default="true">English QWERTY</keyboardlayouts> + <language default="true">English</language> + <subtitlelanguage default="true">original</subtitlelanguage> + <timezone>Europe/London</timezone> + <timezonecountry>Britain (UK)</timezonecountry> + </locale> + <lookandfeel> + <enablerssfeeds>false</enablerssfeeds> + <font default="true">Default</font> + <rssedit default="true"></rssedit> + <skin default="true">skin.estuary</skin> + <skincolors default="true">SKINDEFAULT</skincolors> + <skintheme default="true">SKINDEFAULT</skintheme> + <skinzoom default="true">0</skinzoom> + <soundskin default="true">SKINDEFAULT</soundskin> + <startupwindow default="true">10000</startupwindow> + </lookandfeel> + <masterlock> + <maxretries default="true">3</maxretries> + <startuplock default="true">false</startuplock> + </masterlock> + <musicfiles> + <findremotethumbs default="true">true</findremotethumbs> + <librarytrackformat default="true"></librarytrackformat> + <librarytrackformatright default="true"></librarytrackformatright> + <nowplayingtrackformat default="true"></nowplayingtrackformat> + <nowplayingtrackformatright default="true"></nowplayingtrackformatright> + <trackformat default="true">[%N. ]%A - %T</trackformat> + <trackformatright default="true">%D</trackformatright> + <usetags default="true">true</usetags> + </musicfiles> + <musiclibrary> + <albumsscraper default="true">metadata.album.universal</albumsscraper> + <artistsscraper default="true">metadata.artists.universal</artistsscraper> + <backgroundupdate default="true">false</backgroundupdate> + <downloadinfo default="true">false</downloadinfo> + <enabled default="true">true</enabled> + <overridetags default="true">false</overridetags> + <showcompilationartists default="true">true</showcompilationartists> + <updateonstartup default="true">false</updateonstartup> + </musiclibrary> + <musicplayer> + <autoplaynextitem default="true">true</autoplaynextitem> + <crossfade default="true">0</crossfade> + <crossfadealbumtracks default="true">true</crossfadealbumtracks> + <queuebydefault default="true">false</queuebydefault> + <replaygainavoidclipping default="true">false</replaygainavoidclipping> + <replaygainnogainpreamp default="true">89</replaygainnogainpreamp> + <replaygainpreamp default="true">89</replaygainpreamp> + <replaygaintype default="true">1</replaygaintype> + <visualisation default="true">visualization.glspectrum</visualisation> + </musicplayer> + <mymusic> + <defaultlibview default="true"></defaultlibview> + <songthumbinvis default="true">false</songthumbinvis> + <startwindow default="true">10501</startwindow> + <playlist> + <repeat>false</repeat> + <shuffle>false</shuffle> + </playlist> + <needsupdate>0</needsupdate> + </mymusic> + <myvideos> + <extractflags default="true">false</extractflags> + <extractthumb default="true">false</extractthumb> + <flatten default="true">false</flatten> + <replacelabels default="true">true</replacelabels> + <selectaction>0</selectaction> + <stackvideos default="true">false</stackvideos> + <startwindow>10025</startwindow> + <watchmodemovies>0</watchmodemovies> + <watchmodetvshows>0</watchmodetvshows> + <watchmodemusicvideos>0</watchmodemusicvideos> + <playlist> + <repeat>false</repeat> + <shuffle>false</shuffle> + </playlist> + <needsupdate>0</needsupdate> + </myvideos> + <network> + <bandwidth default="true">0</bandwidth> + <httpproxypassword default="true"></httpproxypassword> + <httpproxyport default="true">8080</httpproxyport> + <httpproxyserver default="true"></httpproxyserver> + <httpproxytype default="true">0</httpproxytype> + <httpproxyusername default="true"></httpproxyusername> + <usehttpproxy default="true">false</usehttpproxy> + </network> + <pictures> + <displayresolution default="true">14</displayresolution> + <generatethumbs default="true">true</generatethumbs> + <showvideos default="true">true</showvideos> + <useexifrotation default="true">true</useexifrotation> + <usetags default="true">true</usetags> + </pictures> + <powermanagement> + <displaysoff default="true">0</displaysoff> + <shutdownstate default="true">1</shutdownstate> + <shutdowntime default="true">0</shutdowntime> + <wakeonaccess default="true">false</wakeonaccess> + </powermanagement> + <pvrmanager> + <backendchannelorder default="true">true</backendchannelorder> + <enabled default="true">false</enabled> + <hideconnectionlostwarning default="true">false</hideconnectionlostwarning> + <syncchannelgroups default="true">true</syncchannelgroups> + <usebackendchannelnumbers default="true">false</usebackendchannelnumbers> + </pvrmanager> + <pvrmenu> + <closechannelosdonswitch default="true">true</closechannelosdonswitch> + <displaychannelinfo default="true">5</displaychannelinfo> + <iconpath default="true"></iconpath> + </pvrmenu> + <pvrparental> + <duration default="true">300</duration> + <enabled default="true">false</enabled> + <pin default="true"></pin> + </pvrparental> + <pvrplayback> + <channelentrytimeout default="true">0</channelentrytimeout> + <confirmchannelswitch default="true">false</confirmchannelswitch> + <playminimized default="true">true</playminimized> + <scantime default="true">10</scantime> + <signalquality default="true">true</signalquality> + <startlast default="true">0</startlast> + </pvrplayback> + <pvrpowermanagement> + <backendidletime default="true">15</backendidletime> + <dailywakeup default="true">false</dailywakeup> + <dailywakeuptime default="true">00:00:00</dailywakeuptime> + <enabled default="true">false</enabled> + <prewakeup default="true">15</prewakeup> + <setwakeupcmd default="true">/usr/bin/setwakeup.sh</setwakeupcmd> + </pvrpowermanagement> + <pvrrecord> + <defaultlifetime default="true">99</defaultlifetime> + <defaultpriority default="true">50</defaultpriority> + <instantrecordtime default="true">120</instantrecordtime> + <marginend default="true">0</marginend> + <marginstart default="true">0</marginstart> + <timernotifications default="true">true</timernotifications> + </pvrrecord> + <scrapers> + <moviesdefault default="true">metadata.themoviedb.org</moviesdefault> + <musicvideosdefault default="true">metadata.musicvideos.theaudiodb.com</musicvideosdefault> + <tvshowsdefault default="true">metadata.tvdb.com</tvshowsdefault> + </scrapers> + <screensaver> + <mode default="true">screensaver.xbmc.builtin.dim</mode> + <time default="true">3</time> + <usedimonpause default="true">true</usedimonpause> + <usemusicvisinstead default="true">true</usemusicvisinstead> + </screensaver> + <services> + <airplay default="true">true</airplay> + <airplayios8compat default="true">true</airplayios8compat> + <airplaypassword default="true"></airplaypassword> + <airplayvolumecontrol default="true">true</airplayvolumecontrol> + <devicename default="true">Kodi</devicename> + <esallinterfaces default="true">false</esallinterfaces> + <escontinuousdelay default="true">25</escontinuousdelay> + <esenabled default="true">true</esenabled> + <esinitialdelay default="true">750</esinitialdelay> + <esmaxclients default="true">20</esmaxclients> + <esport default="true">9777</esport> + <esportrange default="true">10</esportrange> + <upnpannounce default="true">true</upnpannounce> + <upnpcontroller default="true">false</upnpcontroller> + <upnprenderer default="true">false</upnprenderer> + <upnpserver default="true">false</upnpserver> + <useairplaypassword default="true">false</useairplaypassword> + <webserver default="true">true</webserver> + <webserverpassword default="true"></webserverpassword> + <webserverport default="true">80</webserverport> + <webserverusername default="true">kodi</webserverusername> + <webskin default="true">webinterface.default</webskin> + <zeroconf default="true">true</zeroconf> + </services> + <slideshow> + <displayeffects default="true">true</displayeffects> + <shuffle default="true">false</shuffle> + <staytime default="true">5</staytime> + </slideshow> + <smb> + <winsserver default="true">0.0.0.0</winsserver> + <workgroup default="true">WORKGROUP</workgroup> + </smb> + <subtitles> + <align default="true">0</align> + <charset default="true">DEFAULT</charset> + <color default="true">1</color> + <custompath default="true"></custompath> + <downloadfirst default="true">false</downloadfirst> + <font default="true">arial.ttf</font> + <height default="true">28</height> + <languages default="true">English</languages> + <movie default="true">-</movie> + <overrideassfonts default="true">false</overrideassfonts> + <pauseonsearch default="true">true</pauseonsearch> + <stereoscopicdepth default="true">0</stereoscopicdepth> + <storagemode default="true">0</storagemode> + <style default="true">1</style> + <tv default="true">-</tv> + </subtitles> + <system> + <playlistspath>special://profile/playlists/</playlistspath> + </system> + <videolibrary> + <actorthumbs default="true">true</actorthumbs> + <backgroundupdate default="true">false</backgroundupdate> + <enabled default="true">true</enabled> + <flattentvshows default="true">1</flattentvshows> + <groupmoviesets default="true">false</groupmoviesets> + <showunwatchedplots default="true">true</showunwatchedplots> + <updateonstartup default="true">false</updateonstartup> + </videolibrary> + <videoplayer> + <adjustrefreshrate>1</adjustrefreshrate> + <autoplaynextitem default="true">false</autoplaynextitem> + <decodingmethod default="true">1</decodingmethod> + <errorinaspect default="true">0</errorinaspect> + <hqscalers default="true">0</hqscalers> + <limitguiupdate default="true">10</limitguiupdate> + <maxspeedadjust default="true">5</maxspeedadjust> + <pauseafterrefreshchange default="true">0</pauseafterrefreshchange> + <prefervaapirender default="true">true</prefervaapirender> + <quitstereomodeonstop default="true">true</quitstereomodeonstop> + <rendermethod default="true">0</rendermethod> + <stereoscopicplaybackmode default="true">0</stereoscopicplaybackmode> + <stretch43 default="true">0</stretch43> + <synctype default="true">2</synctype> + <teletextenabled default="true">true</teletextenabled> + <teletextscale default="true">true</teletextscale> + <useamcodec default="true">true</useamcodec> + <usedisplayasclock>true</usedisplayasclock> + <usedxva2 default="true">true</usedxva2> + <usemmal default="true">true</usemmal> + <useomx default="true">true</useomx> + <useomxplayer default="true">true</useomxplayer> + <usepbo default="true">true</usepbo> + <usevaapi default="true">true</usevaapi> + <usevaapimpeg2 default="true">true</usevaapimpeg2> + <usevaapimpeg4 default="true">true</usevaapimpeg4> + <usevaapivc1 default="true">false</usevaapivc1> + <usevda default="true">true</usevda> + <usevdpau default="true">true</usevdpau> + <usevdpaumixer default="true">true</usevdpaumixer> + <usevdpaumpeg2 default="true">true</usevdpaumpeg2> + <usevdpaumpeg4 default="true">false</usevdpaumpeg4> + <usevdpauvc1 default="true">true</usevdpauvc1> + <usevideotoolbox default="true">true</usevideotoolbox> + <vdpauUpscalingLevel default="true">false</vdpauUpscalingLevel> + <vdpau_allow_xrandr default="true">false</vdpau_allow_xrandr> + </videoplayer> + <videoscreen> + <blankdisplays default="true">false</blankdisplays> + <fakefullscreen default="true">true</fakefullscreen> + <limitedrange default="true">false</limitedrange> + <limitgui default="true">0</limitgui> + <monitor default="true">Default</monitor> + <preferedstereoscopicmode default="true">100</preferedstereoscopicmode> + <resolution default="true">16</resolution> + <screen default="true">0</screen> + <screenmode default="true">DESKTOP</screenmode> + <stereoscopicmode default="true">0</stereoscopicmode> + <textures32 default="true">false</textures32> + <vsync default="true">2</vsync> + </videoscreen> + <weather> + <addon default="true"></addon> + <currentlocation default="true">1</currentlocation> + </weather> + <window> + <height default="true">480</height> + <width default="true">720</width> + </window> + <skinsettings> + <setting type="bool" name="skin.slice.DebugInfo">false</setting> + <setting type="bool" name="skin.slice.DebugGrid">false</setting> + <setting type="bool" name="skin.slice.LayoutGrid">false</setting> + <setting type="bool" name="skin.slice.AutoScroll">false</setting> + <setting type="bool" name="skin.slice.PVR_Enabled">false</setting> + </skinsettings> + <resolutions /> + <defaultvideosettings> + <deinterlacemode>1</deinterlacemode> + <interlacemethod>1</interlacemethod> + <scalingmethod>1</scalingmethod> + <noisereduction>0.000000</noisereduction> + <postprocess>false</postprocess> + <sharpness>0.000000</sharpness> + <viewmode>0</viewmode> + <zoomamount>1.000000</zoomamount> + <pixelratio>1.000000</pixelratio> + <verticalshift>0.000000</verticalshift> + <volumeamplification>0.000000</volumeamplification> + <outputtoallspeakers>false</outputtoallspeakers> + <showsubtitles>false</showsubtitles> + <brightness>50.000000</brightness> + <contrast>50.000000</contrast> + <gamma>20.000000</gamma> + <audiodelay>0.000000</audiodelay> + <subtitledelay>0.000000</subtitledelay> + <autocrop>false</autocrop> + <nonlinstretch>false</nonlinstretch> + <stereomode>0</stereomode> + </defaultvideosettings> + <viewstates> + <musicfiles> + <viewmode>720896</viewmode> + <sortmethod>1</sortmethod> + <sortorder>1</sortorder> + <sortattributes>0</sortattributes> + </musicfiles> + <musiclastfm> + <viewmode>65536</viewmode> + <sortmethod>1</sortmethod> + <sortorder>1</sortorder> + <sortattributes>0</sortattributes> + </musiclastfm> + <musicnavalbums> + <viewmode>65536</viewmode> + <sortmethod>1</sortmethod> + <sortorder>1</sortorder> + <sortattributes>0</sortattributes> + </musicnavalbums> + <musicnavartists> + <viewmode>65536</viewmode> + <sortmethod>1</sortmethod> + <sortorder>1</sortorder> + <sortattributes>0</sortattributes> + </musicnavartists> + <musicnavsongs> + <viewmode>65536</viewmode> + <sortmethod>1</sortmethod> + <sortorder>1</sortorder> + <sortattributes>0</sortattributes> + </musicnavsongs> + <pictures> + <viewmode>720896</viewmode> + <sortmethod>1</sortmethod> + <sortorder>1</sortorder> + <sortattributes>0</sortattributes> + </pictures> + <programs> + <viewmode>720896</viewmode> + <sortmethod>1</sortmethod> + <sortorder>1</sortorder> + <sortattributes>0</sortattributes> + </programs> + <videofiles> + <viewmode>720896</viewmode> + <sortmethod>1</sortmethod> + <sortorder>1</sortorder> + <sortattributes>0</sortattributes> + </videofiles> + <videonavactors> + <viewmode>65536</viewmode> + <sortmethod>1</sortmethod> + <sortorder>1</sortorder> + <sortattributes>0</sortattributes> + </videonavactors> + <videonavepisodes> + <viewmode>720896</viewmode> + <sortmethod>21</sortmethod> + <sortorder>1</sortorder> + <sortattributes>0</sortattributes> + </videonavepisodes> + <videonavgenres> + <viewmode>65536</viewmode> + <sortmethod>1</sortmethod> + <sortorder>1</sortorder> + <sortattributes>0</sortattributes> + </videonavgenres> + <videonavmusicvideos> + <viewmode>65536</viewmode> + <sortmethod>1</sortmethod> + <sortorder>1</sortorder> + <sortattributes>0</sortattributes> + </videonavmusicvideos> + <videonavseasons> + <viewmode>65536</viewmode> + <sortmethod>1</sortmethod> + <sortorder>1</sortorder> + <sortattributes>0</sortattributes> + </videonavseasons> + <videonavtitles> + <viewmode>65536</viewmode> + <sortmethod>1</sortmethod> + <sortorder>1</sortorder> + <sortattributes>0</sortattributes> + </videonavtitles> + <videonavtvshows> + <viewmode>65536</viewmode> + <sortmethod>1</sortmethod> + <sortorder>1</sortorder> + <sortattributes>0</sortattributes> + </videonavtvshows> + <videonavyears> + <viewmode>65536</viewmode> + <sortmethod>1</sortmethod> + <sortorder>1</sortorder> + <sortattributes>0</sortattributes> + </videonavyears> + </viewstates> + <audio> + <mute>false</mute> + <fvolumelevel>1.000000</fvolumelevel> + </audio> +</settings> diff --git a/projects/Slice2/kodi/ledpatterns/ffwd.png b/projects/Slice2/kodi/ledpatterns/ffwd.png new file mode 100644 index 00000000000..5bee66fb5cf Binary files /dev/null and b/projects/Slice2/kodi/ledpatterns/ffwd.png differ diff --git a/projects/Slice2/kodi/ledpatterns/pause.png b/projects/Slice2/kodi/ledpatterns/pause.png new file mode 100644 index 00000000000..60a480f1047 Binary files /dev/null and b/projects/Slice2/kodi/ledpatterns/pause.png differ diff --git a/projects/Slice2/kodi/ledpatterns/play.png b/projects/Slice2/kodi/ledpatterns/play.png new file mode 100644 index 00000000000..ae890193286 Binary files /dev/null and b/projects/Slice2/kodi/ledpatterns/play.png differ diff --git a/projects/Slice2/kodi/ledpatterns/quit.png b/projects/Slice2/kodi/ledpatterns/quit.png new file mode 100644 index 00000000000..667ada77e62 Binary files /dev/null and b/projects/Slice2/kodi/ledpatterns/quit.png differ diff --git a/projects/Slice2/kodi/ledpatterns/rew.png b/projects/Slice2/kodi/ledpatterns/rew.png new file mode 100644 index 00000000000..0420bee2905 Binary files /dev/null and b/projects/Slice2/kodi/ledpatterns/rew.png differ diff --git a/projects/Slice2/kodi/ledpatterns/shutdown.png b/projects/Slice2/kodi/ledpatterns/shutdown.png new file mode 100644 index 00000000000..d4fde7ee7bd Binary files /dev/null and b/projects/Slice2/kodi/ledpatterns/shutdown.png differ diff --git a/projects/Slice2/kodi/ledpatterns/skipf.png b/projects/Slice2/kodi/ledpatterns/skipf.png new file mode 100644 index 00000000000..2018e325eb8 Binary files /dev/null and b/projects/Slice2/kodi/ledpatterns/skipf.png differ diff --git a/projects/Slice2/kodi/ledpatterns/skipr.png b/projects/Slice2/kodi/ledpatterns/skipr.png new file mode 100644 index 00000000000..9292082b82f Binary files /dev/null and b/projects/Slice2/kodi/ledpatterns/skipr.png differ diff --git a/projects/Slice2/kodi/ledpatterns/sleep.png b/projects/Slice2/kodi/ledpatterns/sleep.png new file mode 100644 index 00000000000..3cef539d53e Binary files /dev/null and b/projects/Slice2/kodi/ledpatterns/sleep.png differ diff --git a/projects/Slice2/kodi/ledpatterns/startup.png b/projects/Slice2/kodi/ledpatterns/startup.png new file mode 100644 index 00000000000..282954b4a8e Binary files /dev/null and b/projects/Slice2/kodi/ledpatterns/startup.png differ diff --git a/projects/Slice2/kodi/ledpatterns/stop.png b/projects/Slice2/kodi/ledpatterns/stop.png new file mode 100644 index 00000000000..e02589b8136 Binary files /dev/null and b/projects/Slice2/kodi/ledpatterns/stop.png differ diff --git a/projects/Slice2/kodi/ledpatterns/wake.png b/projects/Slice2/kodi/ledpatterns/wake.png new file mode 100644 index 00000000000..31944073b09 Binary files /dev/null and b/projects/Slice2/kodi/ledpatterns/wake.png differ diff --git a/projects/Slice2/linux/linux.arm.conf b/projects/Slice2/linux/linux.arm.conf new file mode 100644 index 00000000000..eac76b1e685 --- /dev/null +++ b/projects/Slice2/linux/linux.arm.conf @@ -0,0 +1,4066 @@ +# +# Automatically generated file; DO NOT EDIT. +# Linux/arm 4.6.0-rc5 Kernel Configuration +# +CONFIG_ARM=y +CONFIG_SYS_SUPPORTS_APM_EMULATION=y +CONFIG_HAVE_PROC_CPU=y +CONFIG_STACKTRACE_SUPPORT=y +CONFIG_LOCKDEP_SUPPORT=y +CONFIG_TRACE_IRQFLAGS_SUPPORT=y +CONFIG_RWSEM_XCHGADD_ALGORITHM=y +CONFIG_FIX_EARLYCON_MEM=y +CONFIG_GENERIC_HWEIGHT=y +CONFIG_GENERIC_CALIBRATE_DELAY=y +CONFIG_NEED_DMA_MAP_STATE=y +CONFIG_ARCH_SUPPORTS_UPROBES=y +CONFIG_FIQ=y +CONFIG_VECTORS_BASE=0xffff0000 +CONFIG_ARM_PATCH_PHYS_VIRT=y +CONFIG_NEED_MACH_IO_H=y +CONFIG_NEED_MACH_MEMORY_H=y +CONFIG_GENERIC_BUG=y +CONFIG_PGTABLE_LEVELS=2 +CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" +CONFIG_IRQ_WORK=y +CONFIG_BUILDTIME_EXTABLE_SORT=y + +# +# General setup +# +CONFIG_INIT_ENV_ARG_LIMIT=32 +CONFIG_CROSS_COMPILE="" +# CONFIG_COMPILE_TEST is not set +CONFIG_LOCALVERSION="" +# CONFIG_LOCALVERSION_AUTO is not set +CONFIG_HAVE_KERNEL_GZIP=y +CONFIG_HAVE_KERNEL_LZMA=y +CONFIG_HAVE_KERNEL_XZ=y +CONFIG_HAVE_KERNEL_LZO=y +CONFIG_HAVE_KERNEL_LZ4=y +CONFIG_KERNEL_GZIP=y +# CONFIG_KERNEL_LZMA is not set +# CONFIG_KERNEL_XZ is not set +# CONFIG_KERNEL_LZO is not set +# CONFIG_KERNEL_LZ4 is not set +CONFIG_DEFAULT_HOSTNAME="@DISTRONAME@" +CONFIG_SWAP=y +CONFIG_SYSVIPC=y +CONFIG_SYSVIPC_SYSCTL=y +CONFIG_POSIX_MQUEUE=y +CONFIG_POSIX_MQUEUE_SYSCTL=y +CONFIG_CROSS_MEMORY_ATTACH=y +CONFIG_FHANDLE=y +# CONFIG_USELIB is not set +# CONFIG_AUDIT is not set +CONFIG_HAVE_ARCH_AUDITSYSCALL=y + +# +# IRQ subsystem +# +CONFIG_GENERIC_IRQ_PROBE=y +CONFIG_GENERIC_IRQ_SHOW=y +CONFIG_GENERIC_IRQ_SHOW_LEVEL=y +CONFIG_HARDIRQS_SW_RESEND=y +CONFIG_IRQ_DOMAIN=y +CONFIG_HANDLE_DOMAIN_IRQ=y +# CONFIG_IRQ_DOMAIN_DEBUG is not set +CONFIG_IRQ_FORCED_THREADING=y +CONFIG_SPARSE_IRQ=y +CONFIG_GENERIC_TIME_VSYSCALL=y +CONFIG_GENERIC_CLOCKEVENTS=y +CONFIG_ARCH_HAS_TICK_BROADCAST=y +CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y + +# +# Timers subsystem +# +CONFIG_TICK_ONESHOT=y +CONFIG_NO_HZ_COMMON=y +# CONFIG_HZ_PERIODIC is not set +CONFIG_NO_HZ_IDLE=y +# CONFIG_NO_HZ_FULL is not set +CONFIG_NO_HZ=y +CONFIG_HIGH_RES_TIMERS=y + +# +# CPU/Task time and stats accounting +# +CONFIG_TICK_CPU_ACCOUNTING=y +# CONFIG_VIRT_CPU_ACCOUNTING_GEN is not set +# CONFIG_IRQ_TIME_ACCOUNTING is not set +# CONFIG_BSD_PROCESS_ACCT is not set +# CONFIG_TASKSTATS is not set + +# +# RCU Subsystem +# +CONFIG_TREE_RCU=y +# CONFIG_RCU_EXPERT is not set +CONFIG_SRCU=y +# CONFIG_TASKS_RCU is not set +CONFIG_RCU_STALL_COMMON=y +# CONFIG_TREE_RCU_TRACE is not set +# CONFIG_RCU_EXPEDITE_BOOT is not set +CONFIG_BUILD_BIN2C=y +CONFIG_IKCONFIG=m +CONFIG_IKCONFIG_PROC=y +CONFIG_LOG_BUF_SHIFT=17 +CONFIG_LOG_CPU_MAX_BUF_SHIFT=12 +CONFIG_GENERIC_SCHED_CLOCK=y +CONFIG_CGROUPS=y +CONFIG_PAGE_COUNTER=y +CONFIG_MEMCG=y +# CONFIG_MEMCG_SWAP is not set +CONFIG_BLK_CGROUP=y +# CONFIG_DEBUG_BLK_CGROUP is not set +CONFIG_CGROUP_WRITEBACK=y +CONFIG_CGROUP_SCHED=y +# CONFIG_FAIR_GROUP_SCHED is not set +# CONFIG_RT_GROUP_SCHED is not set +# CONFIG_CGROUP_PIDS is not set +CONFIG_CGROUP_FREEZER=y +CONFIG_CPUSETS=y +CONFIG_PROC_PID_CPUSET=y +CONFIG_CGROUP_DEVICE=y +CONFIG_CGROUP_CPUACCT=y +# CONFIG_CGROUP_DEBUG is not set +# CONFIG_CHECKPOINT_RESTORE is not set +CONFIG_NAMESPACES=y +CONFIG_UTS_NS=y +CONFIG_IPC_NS=y +# CONFIG_USER_NS is not set +CONFIG_PID_NS=y +CONFIG_NET_NS=y +# CONFIG_SCHED_AUTOGROUP is not set +# CONFIG_SYSFS_DEPRECATED is not set +CONFIG_RELAY=y +CONFIG_BLK_DEV_INITRD=y +CONFIG_INITRAMFS_SOURCE=" " +CONFIG_INITRAMFS_ROOT_UID=0 +CONFIG_INITRAMFS_ROOT_GID=0 +CONFIG_RD_GZIP=y +# CONFIG_RD_BZIP2 is not set +# CONFIG_RD_LZMA is not set +# CONFIG_RD_XZ is not set +# CONFIG_RD_LZO is not set +# CONFIG_RD_LZ4 is not set +# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set +CONFIG_SYSCTL=y +CONFIG_ANON_INODES=y +CONFIG_HAVE_UID16=y +CONFIG_BPF=y +CONFIG_EXPERT=y +# CONFIG_UID16 is not set +CONFIG_MULTIUSER=y +# CONFIG_SGETMASK_SYSCALL is not set +# CONFIG_SYSFS_SYSCALL is not set +CONFIG_SYSCTL_SYSCALL=y +CONFIG_KALLSYMS=y +# CONFIG_KALLSYMS_ALL is not set +# CONFIG_KALLSYMS_ABSOLUTE_PERCPU is not set +CONFIG_KALLSYMS_BASE_RELATIVE=y +CONFIG_PRINTK=y +CONFIG_BUG=y +CONFIG_ELF_CORE=y +CONFIG_BASE_FULL=y +CONFIG_FUTEX=y +CONFIG_EPOLL=y +CONFIG_SIGNALFD=y +CONFIG_TIMERFD=y +CONFIG_EVENTFD=y +# CONFIG_BPF_SYSCALL is not set +CONFIG_SHMEM=y +# CONFIG_AIO is not set +CONFIG_ADVISE_SYSCALLS=y +# CONFIG_USERFAULTFD is not set +CONFIG_MEMBARRIER=y +CONFIG_EMBEDDED=y +CONFIG_HAVE_PERF_EVENTS=y +CONFIG_PERF_USE_VMALLOC=y + +# +# Kernel Performance Events And Counters +# +# CONFIG_PERF_EVENTS is not set +# CONFIG_VM_EVENT_COUNTERS is not set +CONFIG_SLUB_DEBUG=y +# CONFIG_COMPAT_BRK is not set +# CONFIG_SLAB is not set +CONFIG_SLUB=y +# CONFIG_SLOB is not set +CONFIG_SLUB_CPU_PARTIAL=y +# CONFIG_SYSTEM_DATA_VERIFICATION is not set +# CONFIG_PROFILING is not set +CONFIG_HAVE_OPROFILE=y +# CONFIG_KPROBES is not set +CONFIG_JUMP_LABEL=y +# CONFIG_STATIC_KEYS_SELFTEST is not set +# CONFIG_UPROBES is not set +# CONFIG_HAVE_64BIT_ALIGNED_ACCESS is not set +CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y +CONFIG_ARCH_USE_BUILTIN_BSWAP=y +CONFIG_HAVE_KPROBES=y +CONFIG_HAVE_KRETPROBES=y +CONFIG_HAVE_OPTPROBES=y +CONFIG_HAVE_ARCH_TRACEHOOK=y +CONFIG_HAVE_DMA_CONTIGUOUS=y +CONFIG_GENERIC_SMP_IDLE_THREAD=y +CONFIG_GENERIC_IDLE_POLL_SETUP=y +CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y +CONFIG_HAVE_CLK=y +CONFIG_HAVE_DMA_API_DEBUG=y +CONFIG_HAVE_PERF_REGS=y +CONFIG_HAVE_PERF_USER_STACK_DUMP=y +CONFIG_HAVE_ARCH_JUMP_LABEL=y +CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y +CONFIG_HAVE_ARCH_SECCOMP_FILTER=y +CONFIG_HAVE_CC_STACKPROTECTOR=y +# CONFIG_CC_STACKPROTECTOR is not set +CONFIG_CC_STACKPROTECTOR_NONE=y +# CONFIG_CC_STACKPROTECTOR_REGULAR is not set +# CONFIG_CC_STACKPROTECTOR_STRONG is not set +CONFIG_HAVE_CONTEXT_TRACKING=y +CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y +CONFIG_HAVE_IRQ_TIME_ACCOUNTING=y +CONFIG_HAVE_MOD_ARCH_SPECIFIC=y +CONFIG_MODULES_USE_ELF_REL=y +CONFIG_ARCH_HAS_ELF_RANDOMIZE=y +CONFIG_HAVE_ARCH_MMAP_RND_BITS=y +CONFIG_ARCH_MMAP_RND_BITS_MIN=8 +CONFIG_ARCH_MMAP_RND_BITS_MAX=15 +CONFIG_ARCH_MMAP_RND_BITS=8 +CONFIG_CLONE_BACKWARDS=y +CONFIG_OLD_SIGSUSPEND3=y +CONFIG_OLD_SIGACTION=y + +# +# GCOV-based kernel profiling +# +# CONFIG_GCOV_KERNEL is not set +CONFIG_ARCH_HAS_GCOV_PROFILE_ALL=y +CONFIG_HAVE_GENERIC_DMA_COHERENT=y +CONFIG_SLABINFO=y +CONFIG_RT_MUTEXES=y +CONFIG_BASE_SMALL=0 +CONFIG_MODULES=y +# CONFIG_MODULE_FORCE_LOAD is not set +CONFIG_MODULE_UNLOAD=y +# CONFIG_MODULE_FORCE_UNLOAD is not set +# CONFIG_MODVERSIONS is not set +# CONFIG_MODULE_SRCVERSION_ALL is not set +# CONFIG_MODULE_SIG is not set +# CONFIG_MODULE_COMPRESS is not set +CONFIG_BLOCK=y +CONFIG_LBDAF=y +CONFIG_BLK_DEV_BSG=y +CONFIG_BLK_DEV_BSGLIB=y +# CONFIG_BLK_DEV_INTEGRITY is not set +# CONFIG_BLK_DEV_THROTTLING is not set +# CONFIG_BLK_CMDLINE_PARSER is not set + +# +# Partition Types +# +CONFIG_PARTITION_ADVANCED=y +# CONFIG_ACORN_PARTITION is not set +# CONFIG_AIX_PARTITION is not set +# CONFIG_OSF_PARTITION is not set +# CONFIG_AMIGA_PARTITION is not set +# CONFIG_ATARI_PARTITION is not set +CONFIG_MAC_PARTITION=y +CONFIG_MSDOS_PARTITION=y +# CONFIG_BSD_DISKLABEL is not set +# CONFIG_MINIX_SUBPARTITION is not set +# CONFIG_SOLARIS_X86_PARTITION is not set +# CONFIG_UNIXWARE_DISKLABEL is not set +CONFIG_LDM_PARTITION=y +# CONFIG_LDM_DEBUG is not set +# CONFIG_SGI_PARTITION is not set +# CONFIG_ULTRIX_PARTITION is not set +# CONFIG_SUN_PARTITION is not set +# CONFIG_KARMA_PARTITION is not set +CONFIG_EFI_PARTITION=y +# CONFIG_SYSV68_PARTITION is not set +# CONFIG_CMDLINE_PARTITION is not set + +# +# IO Schedulers +# +CONFIG_IOSCHED_NOOP=y +CONFIG_IOSCHED_DEADLINE=y +CONFIG_IOSCHED_CFQ=y +# CONFIG_CFQ_GROUP_IOSCHED is not set +# CONFIG_DEFAULT_DEADLINE is not set +# CONFIG_DEFAULT_CFQ is not set +CONFIG_DEFAULT_NOOP=y +CONFIG_DEFAULT_IOSCHED="noop" +CONFIG_INLINE_SPIN_UNLOCK_IRQ=y +CONFIG_INLINE_READ_UNLOCK=y +CONFIG_INLINE_READ_UNLOCK_IRQ=y +CONFIG_INLINE_WRITE_UNLOCK=y +CONFIG_INLINE_WRITE_UNLOCK_IRQ=y +CONFIG_ARCH_SUPPORTS_ATOMIC_RMW=y +CONFIG_MUTEX_SPIN_ON_OWNER=y +CONFIG_RWSEM_SPIN_ON_OWNER=y +CONFIG_LOCK_SPIN_ON_OWNER=y +CONFIG_FREEZER=y + +# +# System Type +# +CONFIG_MMU=y +# CONFIG_ARCH_BCM2708 is not set +CONFIG_ARCH_BCM2709=y +# CONFIG_ARCH_MULTIPLATFORM is not set +# CONFIG_ARCH_CLPS711X is not set +# CONFIG_ARCH_GEMINI is not set +# CONFIG_ARCH_EBSA110 is not set +# CONFIG_ARCH_EP93XX is not set +# CONFIG_ARCH_FOOTBRIDGE is not set +# CONFIG_ARCH_NETX is not set +# CONFIG_ARCH_IOP13XX is not set +# CONFIG_ARCH_IOP32X is not set +# CONFIG_ARCH_IOP33X is not set +# CONFIG_ARCH_IXP4XX is not set +# CONFIG_ARCH_DOVE is not set +# CONFIG_ARCH_KS8695 is not set +# CONFIG_ARCH_W90X900 is not set +# CONFIG_ARCH_LPC32XX is not set +# CONFIG_ARCH_PXA is not set +# CONFIG_ARCH_RPC is not set +# CONFIG_ARCH_SA1100 is not set +# CONFIG_ARCH_S3C24XX is not set +# CONFIG_ARCH_DAVINCI is not set +# CONFIG_ARCH_OMAP1 is not set +CONFIG_BCM2708_NOL2CACHE=y + +# +# Broadcom BCM2709 Implementations +# +CONFIG_MACH_BCM2709=y + +# +# Processor Type +# +CONFIG_CPU_V7=y +CONFIG_CPU_32v6K=y +CONFIG_CPU_32v7=y +CONFIG_CPU_ABRT_EV7=y +CONFIG_CPU_PABRT_V7=y +CONFIG_CPU_CACHE_V7=y +CONFIG_CPU_CACHE_VIPT=y +CONFIG_CPU_COPY_V6=y +CONFIG_CPU_TLB_V7=y +CONFIG_CPU_HAS_ASID=y +CONFIG_CPU_CP15=y +CONFIG_CPU_CP15_MMU=y + +# +# Processor Features +# +# CONFIG_ARM_LPAE is not set +# CONFIG_ARCH_PHYS_ADDR_T_64BIT is not set +CONFIG_ARM_THUMB=y +# CONFIG_ARM_THUMBEE is not set +CONFIG_ARM_VIRT_EXT=y +CONFIG_SWP_EMULATE=y +# CONFIG_CPU_ICACHE_DISABLE is not set +# CONFIG_CPU_BPREDICT_DISABLE is not set +CONFIG_KUSER_HELPERS=y +CONFIG_VDSO=y +CONFIG_MIGHT_HAVE_CACHE_L2X0=y +# CONFIG_CACHE_L2X0 is not set +CONFIG_ARM_L1_CACHE_SHIFT_6=y +CONFIG_ARM_L1_CACHE_SHIFT=6 +CONFIG_ARM_DMA_MEM_BUFFERABLE=y +CONFIG_DEBUG_RODATA=y +CONFIG_DEBUG_ALIGN_RODATA=y +CONFIG_MULTI_IRQ_HANDLER=y +# CONFIG_ARM_ERRATA_430973 is not set +# CONFIG_ARM_ERRATA_458693 is not set +# CONFIG_ARM_ERRATA_460075 is not set +# CONFIG_ARM_ERRATA_742230 is not set +# CONFIG_ARM_ERRATA_742231 is not set +# CONFIG_ARM_ERRATA_643719 is not set +# CONFIG_ARM_ERRATA_720789 is not set +# CONFIG_ARM_ERRATA_743622 is not set +# CONFIG_ARM_ERRATA_751472 is not set +# CONFIG_ARM_ERRATA_754322 is not set +# CONFIG_ARM_ERRATA_754327 is not set +# CONFIG_ARM_ERRATA_764369 is not set +# CONFIG_ARM_ERRATA_775420 is not set +# CONFIG_ARM_ERRATA_798181 is not set +# CONFIG_ARM_ERRATA_773022 is not set + +# +# Bus support +# +# CONFIG_PCI_DOMAINS_GENERIC is not set +# CONFIG_PCI_SYSCALL is not set +# CONFIG_PCCARD is not set + +# +# Kernel Features +# +CONFIG_HAVE_SMP=y +CONFIG_SMP=y +CONFIG_SMP_ON_UP=y +CONFIG_ARM_CPU_TOPOLOGY=y +# CONFIG_SCHED_MC is not set +# CONFIG_SCHED_SMT is not set +CONFIG_HAVE_ARM_ARCH_TIMER=y +# CONFIG_MCPM is not set +# CONFIG_BIG_LITTLE is not set +# CONFIG_VMSPLIT_3G is not set +# CONFIG_VMSPLIT_3G_OPT is not set +CONFIG_VMSPLIT_2G=y +# CONFIG_VMSPLIT_1G is not set +CONFIG_PAGE_OFFSET=0x80000000 +CONFIG_NR_CPUS=4 +# CONFIG_HOTPLUG_CPU is not set +# CONFIG_ARM_PSCI is not set +CONFIG_ARCH_NR_GPIO=0 +# CONFIG_PREEMPT_NONE is not set +CONFIG_PREEMPT_VOLUNTARY=y +# CONFIG_PREEMPT is not set +CONFIG_HZ_FIXED=0 +# CONFIG_HZ_100 is not set +# CONFIG_HZ_200 is not set +# CONFIG_HZ_250 is not set +CONFIG_HZ_300=y +# CONFIG_HZ_500 is not set +# CONFIG_HZ_1000 is not set +CONFIG_HZ=300 +CONFIG_SCHED_HRTICK=y +# CONFIG_THUMB2_KERNEL is not set +CONFIG_ARM_PATCH_IDIV=y +CONFIG_AEABI=y +# CONFIG_OABI_COMPAT is not set +# CONFIG_ARCH_SPARSEMEM_DEFAULT is not set +# CONFIG_ARCH_SELECT_MEMORY_MODEL is not set +CONFIG_HAVE_ARCH_PFN_VALID=y +# CONFIG_HIGHMEM is not set +# CONFIG_CPU_SW_DOMAIN_PAN is not set +CONFIG_ARCH_WANT_GENERAL_HUGETLB=y +# CONFIG_ARM_MODULE_PLTS is not set +CONFIG_FLATMEM=y +CONFIG_FLAT_NODE_MEM_MAP=y +CONFIG_HAVE_MEMBLOCK=y +CONFIG_NO_BOOTMEM=y +CONFIG_MEMORY_ISOLATION=y +# CONFIG_HAVE_BOOTMEM_INFO_NODE is not set +CONFIG_SPLIT_PTLOCK_CPUS=4 +CONFIG_COMPACTION=y +CONFIG_MIGRATION=y +# CONFIG_PHYS_ADDR_T_64BIT is not set +CONFIG_ZONE_DMA_FLAG=0 +# CONFIG_KSM is not set +CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 +CONFIG_CLEANCACHE=y +CONFIG_FRONTSWAP=y +CONFIG_CMA=y +# CONFIG_CMA_DEBUG is not set +# CONFIG_CMA_DEBUGFS is not set +CONFIG_CMA_AREAS=7 +# CONFIG_ZSWAP is not set +# CONFIG_ZPOOL is not set +# CONFIG_ZBUD is not set +# CONFIG_ZSMALLOC is not set +CONFIG_GENERIC_EARLY_IOREMAP=y +# CONFIG_IDLE_PAGE_TRACKING is not set +CONFIG_FRAME_VECTOR=y +CONFIG_FORCE_MAX_ZONEORDER=11 +CONFIG_ALIGNMENT_TRAP=y +CONFIG_UACCESS_WITH_MEMCPY=y +# CONFIG_SECCOMP is not set +CONFIG_SWIOTLB=y +CONFIG_IOMMU_HELPER=y +# CONFIG_PARAVIRT is not set +# CONFIG_PARAVIRT_TIME_ACCOUNTING is not set +# CONFIG_XEN is not set + +# +# Boot options +# +CONFIG_USE_OF=y +CONFIG_ATAGS=y +# CONFIG_DEPRECATED_PARAM_STRUCT is not set +CONFIG_ZBOOT_ROM_TEXT=0x0 +CONFIG_ZBOOT_ROM_BSS=0x0 +# CONFIG_ARM_APPENDED_DTB is not set +CONFIG_CMDLINE="root=/dev/ram0 rdinit=/init BOOT_IMAGE=/kernel.img usbcore.autosuspend=-1" +# CONFIG_CMDLINE_FROM_BOOTLOADER is not set +CONFIG_CMDLINE_EXTEND=y +# CONFIG_CMDLINE_FORCE is not set +# CONFIG_XIP_KERNEL is not set +# CONFIG_CRASH_DUMP is not set +# CONFIG_AUTO_ZRELADDR is not set + +# +# CPU Power Management +# + +# +# CPU Frequency scaling +# +CONFIG_CPU_FREQ=y +CONFIG_CPU_FREQ_GOV_COMMON=y +# CONFIG_CPU_FREQ_STAT is not set +# CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set +# CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE is not set +# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set +CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y +# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set +CONFIG_CPU_FREQ_GOV_PERFORMANCE=y +CONFIG_CPU_FREQ_GOV_POWERSAVE=y +# CONFIG_CPU_FREQ_GOV_USERSPACE is not set +CONFIG_CPU_FREQ_GOV_ONDEMAND=y +# CONFIG_CPU_FREQ_GOV_CONSERVATIVE is not set + +# +# CPU frequency scaling drivers +# +# CONFIG_CPUFREQ_DT is not set +# CONFIG_ARM_BIG_LITTLE_CPUFREQ is not set +# CONFIG_ARM_KIRKWOOD_CPUFREQ is not set +CONFIG_ARM_BCM2835_CPUFREQ=y +# CONFIG_QORIQ_CPUFREQ is not set + +# +# CPU Idle +# +CONFIG_CPU_IDLE=y +CONFIG_CPU_IDLE_GOV_LADDER=y +CONFIG_CPU_IDLE_GOV_MENU=y + +# +# ARM CPU Idle Drivers +# +# CONFIG_ARM_CPUIDLE is not set +# CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED is not set + +# +# Floating point emulation +# + +# +# At least one emulation must be selected +# +CONFIG_VFP=y +CONFIG_VFPv3=y +CONFIG_NEON=y +# CONFIG_KERNEL_MODE_NEON is not set + +# +# Userspace binary formats +# +CONFIG_BINFMT_ELF=y +CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS=y +CONFIG_BINFMT_SCRIPT=y +# CONFIG_HAVE_AOUT is not set +# CONFIG_BINFMT_MISC is not set +CONFIG_COREDUMP=y + +# +# Power management options +# +# CONFIG_SUSPEND is not set +# CONFIG_HIBERNATION is not set +# CONFIG_PM is not set +# CONFIG_APM_EMULATION is not set +CONFIG_CPU_PM=y +CONFIG_ARCH_SUSPEND_POSSIBLE=y +# CONFIG_ARM_CPU_SUSPEND is not set +CONFIG_ARCH_HIBERNATION_POSSIBLE=y +CONFIG_NET=y + +# +# Networking options +# +CONFIG_PACKET=y +# CONFIG_PACKET_DIAG is not set +CONFIG_UNIX=y +# CONFIG_UNIX_DIAG is not set +# CONFIG_XFRM_USER is not set +# CONFIG_NET_KEY is not set +CONFIG_INET=y +CONFIG_IP_MULTICAST=y +# CONFIG_IP_ADVANCED_ROUTER is not set +CONFIG_IP_PNP=y +CONFIG_IP_PNP_DHCP=y +CONFIG_IP_PNP_BOOTP=y +# CONFIG_IP_PNP_RARP is not set +# CONFIG_NET_IPIP is not set +# CONFIG_NET_IPGRE_DEMUX is not set +CONFIG_NET_IP_TUNNEL=m +CONFIG_IP_MROUTE=y +# CONFIG_IP_PIMSM_V1 is not set +# CONFIG_IP_PIMSM_V2 is not set +# CONFIG_SYN_COOKIES is not set +# CONFIG_NET_UDP_TUNNEL is not set +# CONFIG_NET_FOU is not set +# CONFIG_NET_FOU_IP_TUNNELS is not set +# CONFIG_INET_AH is not set +# CONFIG_INET_ESP is not set +# CONFIG_INET_IPCOMP is not set +# CONFIG_INET_XFRM_TUNNEL is not set +CONFIG_INET_TUNNEL=m +# CONFIG_INET_XFRM_MODE_TRANSPORT is not set +# CONFIG_INET_XFRM_MODE_TUNNEL is not set +# CONFIG_INET_XFRM_MODE_BEET is not set +# CONFIG_INET_DIAG is not set +# CONFIG_TCP_CONG_ADVANCED is not set +CONFIG_TCP_CONG_CUBIC=y +CONFIG_DEFAULT_TCP_CONG="cubic" +# CONFIG_TCP_MD5SIG is not set +CONFIG_IPV6=y +# CONFIG_IPV6_ROUTER_PREF is not set +# CONFIG_IPV6_OPTIMISTIC_DAD is not set +# CONFIG_INET6_AH is not set +# CONFIG_INET6_ESP is not set +# CONFIG_INET6_IPCOMP is not set +# CONFIG_IPV6_MIP6 is not set +# CONFIG_IPV6_ILA is not set +# CONFIG_INET6_XFRM_TUNNEL is not set +# CONFIG_INET6_TUNNEL is not set +# CONFIG_INET6_XFRM_MODE_TRANSPORT is not set +# CONFIG_INET6_XFRM_MODE_TUNNEL is not set +# CONFIG_INET6_XFRM_MODE_BEET is not set +# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set +CONFIG_IPV6_SIT=m +# CONFIG_IPV6_SIT_6RD is not set +CONFIG_IPV6_NDISC_NODETYPE=y +# CONFIG_IPV6_TUNNEL is not set +# CONFIG_IPV6_GRE is not set +# CONFIG_IPV6_MULTIPLE_TABLES is not set +# CONFIG_IPV6_MROUTE is not set +# CONFIG_NETWORK_SECMARK is not set +# CONFIG_NET_PTP_CLASSIFY is not set +# CONFIG_NETWORK_PHY_TIMESTAMPING is not set +CONFIG_NETFILTER=y +# CONFIG_NETFILTER_DEBUG is not set +CONFIG_NETFILTER_ADVANCED=y +CONFIG_BRIDGE_NETFILTER=m + +# +# Core Netfilter Configuration +# +# CONFIG_NETFILTER_INGRESS is not set +CONFIG_NETFILTER_NETLINK=m +# CONFIG_NETFILTER_NETLINK_ACCT is not set +# CONFIG_NETFILTER_NETLINK_QUEUE is not set +CONFIG_NETFILTER_NETLINK_LOG=m +CONFIG_NF_CONNTRACK=m +# CONFIG_NF_CONNTRACK_MARK is not set +# CONFIG_NF_CONNTRACK_PROCFS is not set +# CONFIG_NF_CONNTRACK_EVENTS is not set +# CONFIG_NF_CONNTRACK_TIMEOUT is not set +# CONFIG_NF_CONNTRACK_TIMESTAMP is not set +# CONFIG_NF_CT_PROTO_DCCP is not set +# CONFIG_NF_CT_PROTO_SCTP is not set +# CONFIG_NF_CT_PROTO_UDPLITE is not set +# CONFIG_NF_CONNTRACK_AMANDA is not set +CONFIG_NF_CONNTRACK_FTP=m +# CONFIG_NF_CONNTRACK_H323 is not set +CONFIG_NF_CONNTRACK_IRC=m +CONFIG_NF_CONNTRACK_BROADCAST=m +CONFIG_NF_CONNTRACK_NETBIOS_NS=m +# CONFIG_NF_CONNTRACK_SNMP is not set +# CONFIG_NF_CONNTRACK_PPTP is not set +# CONFIG_NF_CONNTRACK_SANE is not set +CONFIG_NF_CONNTRACK_SIP=m +# CONFIG_NF_CONNTRACK_TFTP is not set +CONFIG_NF_CT_NETLINK=m +# CONFIG_NF_CT_NETLINK_TIMEOUT is not set +# CONFIG_NETFILTER_NETLINK_GLUE_CT is not set +CONFIG_NF_NAT=m +CONFIG_NF_NAT_NEEDED=y +# CONFIG_NF_NAT_AMANDA is not set +CONFIG_NF_NAT_FTP=m +CONFIG_NF_NAT_IRC=m +CONFIG_NF_NAT_SIP=m +# CONFIG_NF_NAT_TFTP is not set +# CONFIG_NF_NAT_REDIRECT is not set +# CONFIG_NF_TABLES is not set +CONFIG_NETFILTER_XTABLES=m + +# +# Xtables combined modules +# +# CONFIG_NETFILTER_XT_MARK is not set +# CONFIG_NETFILTER_XT_CONNMARK is not set + +# +# Xtables targets +# +# CONFIG_NETFILTER_XT_TARGET_CHECKSUM is not set +# CONFIG_NETFILTER_XT_TARGET_CLASSIFY is not set +# CONFIG_NETFILTER_XT_TARGET_CONNMARK is not set +# CONFIG_NETFILTER_XT_TARGET_DSCP is not set +# CONFIG_NETFILTER_XT_TARGET_HL is not set +# CONFIG_NETFILTER_XT_TARGET_HMARK is not set +# CONFIG_NETFILTER_XT_TARGET_IDLETIMER is not set +# CONFIG_NETFILTER_XT_TARGET_LED is not set +# CONFIG_NETFILTER_XT_TARGET_LOG is not set +# CONFIG_NETFILTER_XT_TARGET_MARK is not set +CONFIG_NETFILTER_XT_NAT=m +# CONFIG_NETFILTER_XT_TARGET_NETMAP is not set +# CONFIG_NETFILTER_XT_TARGET_NFLOG is not set +# CONFIG_NETFILTER_XT_TARGET_NFQUEUE is not set +# CONFIG_NETFILTER_XT_TARGET_RATEEST is not set +# CONFIG_NETFILTER_XT_TARGET_REDIRECT is not set +# CONFIG_NETFILTER_XT_TARGET_TEE is not set +# CONFIG_NETFILTER_XT_TARGET_TPROXY is not set +# CONFIG_NETFILTER_XT_TARGET_TCPMSS is not set +# CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP is not set + +# +# Xtables matches +# +CONFIG_NETFILTER_XT_MATCH_ADDRTYPE=m +# CONFIG_NETFILTER_XT_MATCH_BPF is not set +# CONFIG_NETFILTER_XT_MATCH_CGROUP is not set +# CONFIG_NETFILTER_XT_MATCH_CLUSTER is not set +# CONFIG_NETFILTER_XT_MATCH_COMMENT is not set +# CONFIG_NETFILTER_XT_MATCH_CONNBYTES is not set +# CONFIG_NETFILTER_XT_MATCH_CONNLABEL is not set +# CONFIG_NETFILTER_XT_MATCH_CONNLIMIT is not set +# CONFIG_NETFILTER_XT_MATCH_CONNMARK is not set +CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m +# CONFIG_NETFILTER_XT_MATCH_CPU is not set +# CONFIG_NETFILTER_XT_MATCH_DCCP is not set +# CONFIG_NETFILTER_XT_MATCH_DEVGROUP is not set +# CONFIG_NETFILTER_XT_MATCH_DSCP is not set +# CONFIG_NETFILTER_XT_MATCH_ECN is not set +# CONFIG_NETFILTER_XT_MATCH_ESP is not set +# CONFIG_NETFILTER_XT_MATCH_HASHLIMIT is not set +# CONFIG_NETFILTER_XT_MATCH_HELPER is not set +# CONFIG_NETFILTER_XT_MATCH_HL is not set +# CONFIG_NETFILTER_XT_MATCH_IPCOMP is not set +CONFIG_NETFILTER_XT_MATCH_IPRANGE=m +# CONFIG_NETFILTER_XT_MATCH_L2TP is not set +# CONFIG_NETFILTER_XT_MATCH_LENGTH is not set +# CONFIG_NETFILTER_XT_MATCH_LIMIT is not set +# CONFIG_NETFILTER_XT_MATCH_MAC is not set +# CONFIG_NETFILTER_XT_MATCH_MARK is not set +# CONFIG_NETFILTER_XT_MATCH_MULTIPORT is not set +# CONFIG_NETFILTER_XT_MATCH_NFACCT is not set +# CONFIG_NETFILTER_XT_MATCH_OSF is not set +CONFIG_NETFILTER_XT_MATCH_OWNER=m +# CONFIG_NETFILTER_XT_MATCH_PHYSDEV is not set +# CONFIG_NETFILTER_XT_MATCH_PKTTYPE is not set +# CONFIG_NETFILTER_XT_MATCH_QUOTA is not set +# CONFIG_NETFILTER_XT_MATCH_RATEEST is not set +# CONFIG_NETFILTER_XT_MATCH_REALM is not set +# CONFIG_NETFILTER_XT_MATCH_RECENT is not set +# CONFIG_NETFILTER_XT_MATCH_SCTP is not set +# CONFIG_NETFILTER_XT_MATCH_SOCKET is not set +CONFIG_NETFILTER_XT_MATCH_STATE=m +# CONFIG_NETFILTER_XT_MATCH_STATISTIC is not set +# CONFIG_NETFILTER_XT_MATCH_STRING is not set +# CONFIG_NETFILTER_XT_MATCH_TCPMSS is not set +# CONFIG_NETFILTER_XT_MATCH_TIME is not set +# CONFIG_NETFILTER_XT_MATCH_U32 is not set +# CONFIG_IP_SET is not set +# CONFIG_IP_VS is not set + +# +# IP: Netfilter Configuration +# +CONFIG_NF_DEFRAG_IPV4=m +CONFIG_NF_CONNTRACK_IPV4=m +# CONFIG_NF_DUP_IPV4 is not set +# CONFIG_NF_LOG_ARP is not set +# CONFIG_NF_LOG_IPV4 is not set +CONFIG_NF_REJECT_IPV4=m +CONFIG_NF_NAT_IPV4=m +CONFIG_NF_NAT_MASQUERADE_IPV4=m +# CONFIG_NF_NAT_PPTP is not set +# CONFIG_NF_NAT_H323 is not set +CONFIG_IP_NF_IPTABLES=m +# CONFIG_IP_NF_MATCH_AH is not set +# CONFIG_IP_NF_MATCH_ECN is not set +# CONFIG_IP_NF_MATCH_RPFILTER is not set +# CONFIG_IP_NF_MATCH_TTL is not set +CONFIG_IP_NF_FILTER=m +CONFIG_IP_NF_TARGET_REJECT=m +# CONFIG_IP_NF_TARGET_SYNPROXY is not set +CONFIG_IP_NF_NAT=m +CONFIG_IP_NF_TARGET_MASQUERADE=m +# CONFIG_IP_NF_TARGET_NETMAP is not set +# CONFIG_IP_NF_TARGET_REDIRECT is not set +CONFIG_IP_NF_MANGLE=m +# CONFIG_IP_NF_TARGET_CLUSTERIP is not set +# CONFIG_IP_NF_TARGET_ECN is not set +# CONFIG_IP_NF_TARGET_TTL is not set +# CONFIG_IP_NF_RAW is not set +# CONFIG_IP_NF_ARPTABLES is not set + +# +# IPv6: Netfilter Configuration +# +CONFIG_NF_DEFRAG_IPV6=m +CONFIG_NF_CONNTRACK_IPV6=m +# CONFIG_NF_DUP_IPV6 is not set +CONFIG_NF_REJECT_IPV6=m +# CONFIG_NF_LOG_IPV6 is not set +CONFIG_NF_NAT_IPV6=m +# CONFIG_NF_NAT_MASQUERADE_IPV6 is not set +CONFIG_IP6_NF_IPTABLES=m +# CONFIG_IP6_NF_MATCH_AH is not set +# CONFIG_IP6_NF_MATCH_EUI64 is not set +# CONFIG_IP6_NF_MATCH_FRAG is not set +# CONFIG_IP6_NF_MATCH_OPTS is not set +# CONFIG_IP6_NF_MATCH_HL is not set +# CONFIG_IP6_NF_MATCH_IPV6HEADER is not set +# CONFIG_IP6_NF_MATCH_MH is not set +# CONFIG_IP6_NF_MATCH_RPFILTER is not set +# CONFIG_IP6_NF_MATCH_RT is not set +# CONFIG_IP6_NF_TARGET_HL is not set +CONFIG_IP6_NF_FILTER=m +CONFIG_IP6_NF_TARGET_REJECT=m +# CONFIG_IP6_NF_TARGET_SYNPROXY is not set +CONFIG_IP6_NF_MANGLE=m +# CONFIG_IP6_NF_RAW is not set +CONFIG_IP6_NF_NAT=m +# CONFIG_IP6_NF_TARGET_MASQUERADE is not set +# CONFIG_IP6_NF_TARGET_NPT is not set +# CONFIG_BRIDGE_NF_EBTABLES is not set +# CONFIG_IP_DCCP is not set +# CONFIG_IP_SCTP is not set +# CONFIG_RDS is not set +# CONFIG_TIPC is not set +# CONFIG_ATM is not set +# CONFIG_L2TP is not set +CONFIG_STP=m +CONFIG_BRIDGE=m +CONFIG_BRIDGE_IGMP_SNOOPING=y +# CONFIG_BRIDGE_VLAN_FILTERING is not set +CONFIG_HAVE_NET_DSA=y +CONFIG_VLAN_8021Q=m +# CONFIG_VLAN_8021Q_GVRP is not set +# CONFIG_VLAN_8021Q_MVRP is not set +# CONFIG_DECNET is not set +CONFIG_LLC=m +# CONFIG_LLC2 is not set +# CONFIG_IPX is not set +# CONFIG_ATALK is not set +# CONFIG_X25 is not set +# CONFIG_LAPB is not set +# CONFIG_PHONET is not set +# CONFIG_6LOWPAN is not set +# CONFIG_IEEE802154 is not set +# CONFIG_NET_SCHED is not set +# CONFIG_DCB is not set +CONFIG_DNS_RESOLVER=y +# CONFIG_BATMAN_ADV is not set +# CONFIG_OPENVSWITCH is not set +# CONFIG_VSOCKETS is not set +# CONFIG_NETLINK_DIAG is not set +# CONFIG_MPLS is not set +# CONFIG_HSR is not set +# CONFIG_NET_SWITCHDEV is not set +# CONFIG_NET_L3_MASTER_DEV is not set +CONFIG_RPS=y +CONFIG_RFS_ACCEL=y +CONFIG_XPS=y +# CONFIG_SOCK_CGROUP_DATA is not set +# CONFIG_CGROUP_NET_PRIO is not set +# CONFIG_CGROUP_NET_CLASSID is not set +CONFIG_NET_RX_BUSY_POLL=y +CONFIG_BQL=y +# CONFIG_BPF_JIT is not set +CONFIG_NET_FLOW_LIMIT=y + +# +# Network testing +# +# CONFIG_NET_PKTGEN is not set +# CONFIG_HAMRADIO is not set +# CONFIG_CAN is not set +# CONFIG_IRDA is not set +CONFIG_BT=m +CONFIG_BT_BREDR=y +CONFIG_BT_RFCOMM=m +CONFIG_BT_RFCOMM_TTY=y +# CONFIG_BT_BNEP is not set +CONFIG_BT_HIDP=m +CONFIG_BT_HS=y +CONFIG_BT_LE=y +# CONFIG_BT_LEDS is not set +# CONFIG_BT_SELFTEST is not set +# CONFIG_BT_DEBUGFS is not set + +# +# Bluetooth device drivers +# +CONFIG_BT_INTEL=m +CONFIG_BT_BCM=m +CONFIG_BT_RTL=m +CONFIG_BT_HCIBTUSB=m +CONFIG_BT_HCIBTUSB_BCM=y +CONFIG_BT_HCIBTUSB_RTL=y +# CONFIG_BT_HCIBTSDIO is not set +CONFIG_BT_HCIUART=m +CONFIG_BT_HCIUART_H4=y +# CONFIG_BT_HCIUART_BCSP is not set +# CONFIG_BT_HCIUART_ATH3K is not set +# CONFIG_BT_HCIUART_LL is not set +CONFIG_BT_HCIUART_3WIRE=y +# CONFIG_BT_HCIUART_INTEL is not set +CONFIG_BT_HCIUART_BCM=y +# CONFIG_BT_HCIUART_QCA is not set +# CONFIG_BT_HCIUART_AG6XX is not set +CONFIG_BT_HCIBCM203X=m +# CONFIG_BT_HCIBPA10X is not set +CONFIG_BT_HCIBFUSB=m +# CONFIG_BT_HCIVHCI is not set +# CONFIG_BT_MRVL is not set +CONFIG_BT_ATH3K=m +# CONFIG_AF_RXRPC is not set +# CONFIG_AF_KCM is not set +CONFIG_WIRELESS=y +CONFIG_WIRELESS_EXT=y +CONFIG_WEXT_CORE=y +CONFIG_WEXT_PROC=y +CONFIG_WEXT_PRIV=y +CONFIG_CFG80211=m +# CONFIG_NL80211_TESTMODE is not set +# CONFIG_CFG80211_DEVELOPER_WARNINGS is not set +# CONFIG_CFG80211_CERTIFICATION_ONUS is not set +CONFIG_CFG80211_DEFAULT_PS=y +# CONFIG_CFG80211_DEBUGFS is not set +CONFIG_CFG80211_INTERNAL_REGDB=y +# CONFIG_CFG80211_CRDA_SUPPORT is not set +CONFIG_CFG80211_WEXT=y +# CONFIG_LIB80211 is not set +CONFIG_MAC80211=m +CONFIG_MAC80211_HAS_RC=y +CONFIG_MAC80211_RC_MINSTREL=y +CONFIG_MAC80211_RC_MINSTREL_HT=y +CONFIG_MAC80211_RC_MINSTREL_VHT=y +CONFIG_MAC80211_RC_DEFAULT_MINSTREL=y +CONFIG_MAC80211_RC_DEFAULT="minstrel_ht" +# CONFIG_MAC80211_MESH is not set +CONFIG_MAC80211_LEDS=y +# CONFIG_MAC80211_DEBUGFS is not set +# CONFIG_MAC80211_MESSAGE_TRACING is not set +# CONFIG_MAC80211_DEBUG_MENU is not set +CONFIG_MAC80211_STA_HASH_MAX_SIZE=0 +# CONFIG_WIMAX is not set +# CONFIG_RFKILL is not set +# CONFIG_NET_9P is not set +# CONFIG_CAIF is not set +# CONFIG_CEPH_LIB is not set +# CONFIG_NFC is not set +# CONFIG_LWTUNNEL is not set +CONFIG_DST_CACHE=y +# CONFIG_NET_DEVLINK is not set +CONFIG_MAY_USE_DEVLINK=y +CONFIG_HAVE_BPF_JIT=y + +# +# Device Drivers +# +CONFIG_ARM_AMBA=y + +# +# Generic Driver Options +# +# CONFIG_UEVENT_HELPER is not set +CONFIG_DEVTMPFS=y +CONFIG_DEVTMPFS_MOUNT=y +CONFIG_STANDALONE=y +CONFIG_PREVENT_FIRMWARE_BUILD=y +CONFIG_FW_LOADER=y +CONFIG_FIRMWARE_IN_KERNEL=y +CONFIG_EXTRA_FIRMWARE="" +# CONFIG_FW_LOADER_USER_HELPER_FALLBACK is not set +# CONFIG_ALLOW_DEV_COREDUMP is not set +# CONFIG_DEBUG_DRIVER is not set +# CONFIG_DEBUG_DEVRES is not set +# CONFIG_SYS_HYPERVISOR is not set +# CONFIG_GENERIC_CPU_DEVICES is not set +CONFIG_REGMAP=y +CONFIG_REGMAP_I2C=y +CONFIG_REGMAP_SPI=y +CONFIG_REGMAP_MMIO=y +CONFIG_REGMAP_IRQ=y +CONFIG_DMA_SHARED_BUFFER=y +# CONFIG_FENCE_TRACE is not set +CONFIG_DMA_CMA=y + +# +# Default contiguous memory area size: +# +CONFIG_CMA_SIZE_MBYTES=5 +CONFIG_CMA_SIZE_SEL_MBYTES=y +# CONFIG_CMA_SIZE_SEL_PERCENTAGE is not set +# CONFIG_CMA_SIZE_SEL_MIN is not set +# CONFIG_CMA_SIZE_SEL_MAX is not set +CONFIG_CMA_ALIGNMENT=8 + +# +# Bus devices +# +# CONFIG_BRCMSTB_GISB_ARB is not set +# CONFIG_VEXPRESS_CONFIG is not set +# CONFIG_CONNECTOR is not set +# CONFIG_MTD is not set +CONFIG_DTC=y +CONFIG_OF=y +# CONFIG_OF_UNITTEST is not set +CONFIG_OF_FLATTREE=y +CONFIG_OF_EARLY_FLATTREE=y +CONFIG_OF_DYNAMIC=y +CONFIG_OF_ADDRESS=y +CONFIG_OF_IRQ=y +CONFIG_OF_NET=y +CONFIG_OF_MDIO=y +CONFIG_OF_RESERVED_MEM=y +CONFIG_OF_RESOLVE=y +CONFIG_OF_OVERLAY=y +CONFIG_OF_CONFIGFS=y +CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y +# CONFIG_PARPORT is not set +CONFIG_BLK_DEV=y +# CONFIG_BLK_DEV_NULL_BLK is not set +# CONFIG_BLK_DEV_COW_COMMON is not set +CONFIG_BLK_DEV_LOOP=y +CONFIG_BLK_DEV_LOOP_MIN_COUNT=0 +# CONFIG_BLK_DEV_CRYPTOLOOP is not set +# CONFIG_BLK_DEV_DRBD is not set +CONFIG_BLK_DEV_NBD=y +CONFIG_BLK_DEV_RAM=y +CONFIG_BLK_DEV_RAM_COUNT=16 +CONFIG_BLK_DEV_RAM_SIZE=4096 +# CONFIG_CDROM_PKTCDVD is not set +# CONFIG_ATA_OVER_ETH is not set +# CONFIG_MG_DISK is not set +# CONFIG_BLK_DEV_RBD is not set + +# +# Misc devices +# +# CONFIG_SENSORS_LIS3LV02D is not set +CONFIG_BCM2835_SMI=m +# CONFIG_AD525X_DPOT is not set +# CONFIG_DUMMY_IRQ is not set +# CONFIG_ICS932S401 is not set +# CONFIG_ENCLOSURE_SERVICES is not set +# CONFIG_APDS9802ALS is not set +# CONFIG_ISL29003 is not set +# CONFIG_ISL29020 is not set +# CONFIG_SENSORS_TSL2550 is not set +# CONFIG_SENSORS_BH1780 is not set +# CONFIG_SENSORS_BH1770 is not set +# CONFIG_SENSORS_APDS990X is not set +# CONFIG_HMC6352 is not set +# CONFIG_DS1682 is not set +# CONFIG_TI_DAC7512 is not set +# CONFIG_BMP085_I2C is not set +# CONFIG_BMP085_SPI is not set +# CONFIG_USB_SWITCH_FSA9480 is not set +# CONFIG_LATTICE_ECP3_CONFIG is not set +# CONFIG_SRAM is not set +# CONFIG_C2PORT is not set + +# +# EEPROM support +# +# CONFIG_EEPROM_AT24 is not set +# CONFIG_EEPROM_AT25 is not set +# CONFIG_EEPROM_LEGACY is not set +# CONFIG_EEPROM_MAX6875 is not set +CONFIG_EEPROM_93CX6=m +# CONFIG_EEPROM_93XX46 is not set + +# +# Texas Instruments shared transport line discipline +# +# CONFIG_TI_ST is not set +# CONFIG_SENSORS_LIS3_SPI is not set +# CONFIG_SENSORS_LIS3_I2C is not set + +# +# Altera FPGA firmware download module +# +# CONFIG_ALTERA_STAPL is not set +CONFIG_BCM2708_VCHIQ=y + +# +# Intel MIC Bus Driver +# + +# +# SCIF Bus Driver +# + +# +# VOP Bus Driver +# + +# +# Intel MIC Host Driver +# + +# +# Intel MIC Card Driver +# + +# +# SCIF Driver +# + +# +# Intel MIC Coprocessor State Management (COSM) Drivers +# + +# +# VOP Driver +# +# CONFIG_ECHO is not set +# CONFIG_CXL_BASE is not set +# CONFIG_CXL_KERNEL_API is not set +# CONFIG_CXL_EEH is not set + +# +# SCSI device support +# +CONFIG_SCSI_MOD=y +# CONFIG_RAID_ATTRS is not set +CONFIG_SCSI=y +CONFIG_SCSI_DMA=y +# CONFIG_SCSI_NETLINK is not set +# CONFIG_SCSI_MQ_DEFAULT is not set +# CONFIG_SCSI_PROC_FS is not set + +# +# SCSI support type (disk, tape, CD-ROM) +# +CONFIG_BLK_DEV_SD=y +# CONFIG_CHR_DEV_ST is not set +# CONFIG_CHR_DEV_OSST is not set +CONFIG_BLK_DEV_SR=y +# CONFIG_BLK_DEV_SR_VENDOR is not set +# CONFIG_CHR_DEV_SG is not set +# CONFIG_CHR_DEV_SCH is not set +# CONFIG_SCSI_CONSTANTS is not set +# CONFIG_SCSI_LOGGING is not set +# CONFIG_SCSI_SCAN_ASYNC is not set + +# +# SCSI Transports +# +# CONFIG_SCSI_SPI_ATTRS is not set +# CONFIG_SCSI_FC_ATTRS is not set +CONFIG_SCSI_ISCSI_ATTRS=y +# CONFIG_SCSI_SAS_ATTRS is not set +# CONFIG_SCSI_SAS_LIBSAS is not set +# CONFIG_SCSI_SRP_ATTRS is not set +CONFIG_SCSI_LOWLEVEL=y +CONFIG_ISCSI_TCP=y +CONFIG_ISCSI_BOOT_SYSFS=y +# CONFIG_SCSI_UFSHCD is not set +# CONFIG_SCSI_DEBUG is not set +# CONFIG_SCSI_DH is not set +# CONFIG_SCSI_OSD_INITIATOR is not set +# CONFIG_ATA is not set +# CONFIG_MD is not set +# CONFIG_TARGET_CORE is not set +CONFIG_NETDEVICES=y +CONFIG_MII=y +CONFIG_NET_CORE=y +# CONFIG_BONDING is not set +# CONFIG_DUMMY is not set +# CONFIG_EQUALIZER is not set +# CONFIG_NET_TEAM is not set +CONFIG_MACVLAN=m +# CONFIG_MACVTAP is not set +# CONFIG_IPVLAN is not set +# CONFIG_VXLAN is not set +# CONFIG_MACSEC is not set +CONFIG_NETCONSOLE=y +# CONFIG_NETCONSOLE_DYNAMIC is not set +CONFIG_NETPOLL=y +CONFIG_NET_POLL_CONTROLLER=y +CONFIG_TUN=y +# CONFIG_TUN_VNET_CROSS_LE is not set +CONFIG_VETH=m +# CONFIG_NLMON is not set + +# +# CAIF transport drivers +# + +# +# Distributed Switch Architecture drivers +# +# CONFIG_NET_DSA_MV88E6XXX is not set +# CONFIG_NET_DSA_MV88E6XXX_NEED_PPU is not set +# CONFIG_ETHERNET is not set +CONFIG_PHYLIB=y + +# +# MII PHY device drivers +# +# CONFIG_AQUANTIA_PHY is not set +# CONFIG_AT803X_PHY is not set +# CONFIG_AMD_PHY is not set +# CONFIG_MARVELL_PHY is not set +# CONFIG_DAVICOM_PHY is not set +# CONFIG_QSEMI_PHY is not set +# CONFIG_LXT_PHY is not set +# CONFIG_CICADA_PHY is not set +# CONFIG_VITESSE_PHY is not set +# CONFIG_TERANETICS_PHY is not set +# CONFIG_SMSC_PHY is not set +# CONFIG_BROADCOM_PHY is not set +# CONFIG_BCM7XXX_PHY is not set +# CONFIG_BCM87XX_PHY is not set +# CONFIG_ICPLUS_PHY is not set +# CONFIG_REALTEK_PHY is not set +# CONFIG_NATIONAL_PHY is not set +# CONFIG_STE10XP is not set +# CONFIG_LSI_ET1011C_PHY is not set +# CONFIG_MICREL_PHY is not set +# CONFIG_DP83848_PHY is not set +# CONFIG_DP83867_PHY is not set +# CONFIG_MICROCHIP_PHY is not set +# CONFIG_FIXED_PHY is not set +# CONFIG_MDIO_BITBANG is not set +# CONFIG_MDIO_BUS_MUX_GPIO is not set +# CONFIG_MDIO_BUS_MUX_MMIOREG is not set +# CONFIG_MDIO_BCM_UNIMAC is not set +# CONFIG_MICREL_KS8995MA is not set +CONFIG_PPP=m +CONFIG_PPP_BSDCOMP=m +CONFIG_PPP_DEFLATE=m +# CONFIG_PPP_FILTER is not set +CONFIG_PPP_MPPE=m +# CONFIG_PPP_MULTILINK is not set +CONFIG_PPPOE=m +CONFIG_PPP_ASYNC=m +# CONFIG_PPP_SYNC_TTY is not set +# CONFIG_SLIP is not set +CONFIG_SLHC=m +CONFIG_USB_NET_DRIVERS=y +# CONFIG_USB_CATC is not set +# CONFIG_USB_KAWETH is not set +# CONFIG_USB_PEGASUS is not set +# CONFIG_USB_RTL8150 is not set +CONFIG_USB_RTL8152=m +# CONFIG_USB_LAN78XX is not set +CONFIG_USB_USBNET=y +CONFIG_USB_NET_AX8817X=m +CONFIG_USB_NET_AX88179_178A=m +CONFIG_USB_NET_CDCETHER=m +# CONFIG_USB_NET_CDC_EEM is not set +# CONFIG_USB_NET_CDC_NCM is not set +# CONFIG_USB_NET_HUAWEI_CDC_NCM is not set +# CONFIG_USB_NET_CDC_MBIM is not set +CONFIG_USB_NET_DM9601=y +# CONFIG_USB_NET_SR9700 is not set +# CONFIG_USB_NET_SR9800 is not set +CONFIG_USB_NET_SMSC75XX=m +CONFIG_USB_NET_SMSC95XX=y +# CONFIG_USB_NET_GL620A is not set +# CONFIG_USB_NET_NET1080 is not set +# CONFIG_USB_NET_PLUSB is not set +CONFIG_USB_NET_MCS7830=m +CONFIG_USB_NET_RNDIS_HOST=m +# CONFIG_USB_NET_CDC_SUBSET is not set +# CONFIG_USB_NET_ZAURUS is not set +# CONFIG_USB_NET_CX82310_ETH is not set +# CONFIG_USB_NET_KALMIA is not set +# CONFIG_USB_NET_QMI_WWAN is not set +# CONFIG_USB_NET_INT51X1 is not set +CONFIG_USB_IPHETH=m +# CONFIG_USB_SIERRA_NET is not set +# CONFIG_USB_VL600 is not set +# CONFIG_USB_NET_CH9200 is not set +CONFIG_WLAN=y +CONFIG_WLAN_VENDOR_ADMTEK=y +CONFIG_ATH_COMMON=m +CONFIG_WLAN_VENDOR_ATH=y +# CONFIG_ATH_DEBUG is not set +CONFIG_ATH9K_HW=m +CONFIG_ATH9K_COMMON=m +CONFIG_ATH9K_BTCOEX_SUPPORT=y +CONFIG_ATH9K=m +CONFIG_ATH9K_AHB=y +# CONFIG_ATH9K_DEBUGFS is not set +# CONFIG_ATH9K_DYNACK is not set +# CONFIG_ATH9K_CHANNEL_CONTEXT is not set +CONFIG_ATH9K_PCOEM=y +CONFIG_ATH9K_HTC=m +# CONFIG_ATH9K_HTC_DEBUGFS is not set +CONFIG_ATH9K_HWRNG=y +CONFIG_CARL9170=m +CONFIG_CARL9170_LEDS=y +CONFIG_CARL9170_WPC=y +CONFIG_CARL9170_HWRNG=y +CONFIG_ATH6KL=m +# CONFIG_ATH6KL_SDIO is not set +CONFIG_ATH6KL_USB=m +# CONFIG_ATH6KL_DEBUG is not set +CONFIG_AR5523=m +# CONFIG_ATH10K is not set +CONFIG_WCN36XX=m +# CONFIG_WCN36XX_DEBUGFS is not set +CONFIG_WLAN_VENDOR_ATMEL=y +# CONFIG_AT76C50X_USB is not set +CONFIG_WLAN_VENDOR_BROADCOM=y +CONFIG_B43=m +CONFIG_B43_BCMA=y +CONFIG_B43_SSB=y +CONFIG_B43_BUSES_BCMA_AND_SSB=y +# CONFIG_B43_BUSES_BCMA is not set +# CONFIG_B43_BUSES_SSB is not set +# CONFIG_B43_SDIO is not set +CONFIG_B43_BCMA_PIO=y +CONFIG_B43_PIO=y +CONFIG_B43_PHY_G=y +CONFIG_B43_PHY_N=y +CONFIG_B43_PHY_LP=y +CONFIG_B43_PHY_HT=y +CONFIG_B43_LEDS=y +CONFIG_B43_HWRNG=y +# CONFIG_B43_DEBUG is not set +# CONFIG_B43LEGACY is not set +CONFIG_BRCMUTIL=m +# CONFIG_BRCMSMAC is not set +CONFIG_BRCMFMAC=m +CONFIG_BRCMFMAC_PROTO_BCDC=y +CONFIG_BRCMFMAC_SDIO=y +CONFIG_BRCMFMAC_USB=y +# CONFIG_BRCM_TRACING is not set +# CONFIG_BRCMDBG is not set +CONFIG_WLAN_VENDOR_CISCO=y +CONFIG_WLAN_VENDOR_INTEL=y +CONFIG_WLAN_VENDOR_INTERSIL=y +# CONFIG_HOSTAP is not set +CONFIG_P54_COMMON=m +CONFIG_P54_USB=m +# CONFIG_P54_SPI is not set +CONFIG_P54_LEDS=y +CONFIG_WLAN_VENDOR_MARVELL=y +# CONFIG_LIBERTAS is not set +# CONFIG_LIBERTAS_THINFIRM is not set +# CONFIG_MWIFIEX is not set +CONFIG_WLAN_VENDOR_MEDIATEK=y +CONFIG_MT7601U=m +CONFIG_WLAN_VENDOR_RALINK=y +CONFIG_RT2X00=m +CONFIG_RT2500USB=m +CONFIG_RT73USB=m +CONFIG_RT2800USB=m +CONFIG_RT2800USB_RT33XX=y +CONFIG_RT2800USB_RT35XX=y +CONFIG_RT2800USB_RT3573=y +CONFIG_RT2800USB_RT53XX=y +CONFIG_RT2800USB_RT55XX=y +CONFIG_RT2800USB_UNKNOWN=y +CONFIG_RT2800_LIB=m +CONFIG_RT2X00_LIB_USB=m +CONFIG_RT2X00_LIB=m +CONFIG_RT2X00_LIB_FIRMWARE=y +CONFIG_RT2X00_LIB_CRYPTO=y +CONFIG_RT2X00_LIB_LEDS=y +# CONFIG_RT2X00_DEBUG is not set +CONFIG_WLAN_VENDOR_REALTEK=y +CONFIG_RTL8187=m +CONFIG_RTL8187_LEDS=y +# CONFIG_RTL_CARDS is not set +# CONFIG_RTL8XXXU is not set +CONFIG_WLAN_VENDOR_RSI=y +# CONFIG_RSI_91X is not set +CONFIG_WLAN_VENDOR_ST=y +# CONFIG_CW1200 is not set +CONFIG_WLAN_VENDOR_TI=y +# CONFIG_WL1251 is not set +# CONFIG_WL12XX is not set +# CONFIG_WL18XX is not set +# CONFIG_WLCORE is not set +CONFIG_WLAN_VENDOR_ZYDAS=y +CONFIG_USB_ZD1201=m +CONFIG_ZD1211RW=m +# CONFIG_ZD1211RW_DEBUG is not set +# CONFIG_MAC80211_HWSIM is not set +CONFIG_USB_NET_RNDIS_WLAN=m + +# +# Enable WiMAX (Networking options) to see the WiMAX drivers +# +# CONFIG_WAN is not set +# CONFIG_ISDN is not set +# CONFIG_NVM is not set + +# +# Input device support +# +CONFIG_INPUT=y +CONFIG_INPUT_LEDS=y +CONFIG_INPUT_FF_MEMLESS=y +# CONFIG_INPUT_POLLDEV is not set +# CONFIG_INPUT_SPARSEKMAP is not set +# CONFIG_INPUT_MATRIXKMAP is not set + +# +# Userland interfaces +# +CONFIG_INPUT_MOUSEDEV=y +# CONFIG_INPUT_MOUSEDEV_PSAUX is not set +CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 +CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 +CONFIG_INPUT_JOYDEV=y +CONFIG_INPUT_EVDEV=y +# CONFIG_INPUT_EVBUG is not set + +# +# Input Device Drivers +# +# CONFIG_INPUT_KEYBOARD is not set +# CONFIG_INPUT_MOUSE is not set +CONFIG_INPUT_JOYSTICK=y +# CONFIG_JOYSTICK_ANALOG is not set +# CONFIG_JOYSTICK_A3D is not set +# CONFIG_JOYSTICK_ADI is not set +# CONFIG_JOYSTICK_COBRA is not set +# CONFIG_JOYSTICK_GF2K is not set +# CONFIG_JOYSTICK_GRIP is not set +# CONFIG_JOYSTICK_GRIP_MP is not set +# CONFIG_JOYSTICK_GUILLEMOT is not set +# CONFIG_JOYSTICK_INTERACT is not set +# CONFIG_JOYSTICK_SIDEWINDER is not set +# CONFIG_JOYSTICK_TMDC is not set +# CONFIG_JOYSTICK_IFORCE is not set +# CONFIG_JOYSTICK_WARRIOR is not set +# CONFIG_JOYSTICK_MAGELLAN is not set +# CONFIG_JOYSTICK_SPACEORB is not set +# CONFIG_JOYSTICK_SPACEBALL is not set +# CONFIG_JOYSTICK_STINGER is not set +# CONFIG_JOYSTICK_TWIDJOY is not set +# CONFIG_JOYSTICK_ZHENHUA is not set +# CONFIG_JOYSTICK_AS5011 is not set +# CONFIG_JOYSTICK_JOYDUMP is not set +CONFIG_JOYSTICK_XPAD=m +CONFIG_JOYSTICK_XPAD_FF=y +CONFIG_JOYSTICK_XPAD_LEDS=y +# CONFIG_JOYSTICK_RPISENSE is not set +# CONFIG_INPUT_TABLET is not set +CONFIG_INPUT_TOUCHSCREEN=y +CONFIG_TOUCHSCREEN_PROPERTIES=y +CONFIG_TOUCHSCREEN_ADS7846=m +# CONFIG_TOUCHSCREEN_AD7877 is not set +# CONFIG_TOUCHSCREEN_AD7879 is not set +# CONFIG_TOUCHSCREEN_AR1021_I2C is not set +# CONFIG_TOUCHSCREEN_ATMEL_MXT is not set +# CONFIG_TOUCHSCREEN_AUO_PIXCIR is not set +# CONFIG_TOUCHSCREEN_BU21013 is not set +# CONFIG_TOUCHSCREEN_CHIPONE_ICN8318 is not set +# CONFIG_TOUCHSCREEN_CY8CTMG110 is not set +# CONFIG_TOUCHSCREEN_CYTTSP_CORE is not set +# CONFIG_TOUCHSCREEN_CYTTSP4_CORE is not set +# CONFIG_TOUCHSCREEN_DYNAPRO is not set +# CONFIG_TOUCHSCREEN_HAMPSHIRE is not set +# CONFIG_TOUCHSCREEN_EETI is not set +CONFIG_TOUCHSCREEN_EGALAX=m +# CONFIG_TOUCHSCREEN_EGALAX_SERIAL is not set +# CONFIG_TOUCHSCREEN_FT6236 is not set +# CONFIG_TOUCHSCREEN_FUJITSU is not set +# CONFIG_TOUCHSCREEN_GOODIX is not set +# CONFIG_TOUCHSCREEN_ILI210X is not set +# CONFIG_TOUCHSCREEN_GUNZE is not set +# CONFIG_TOUCHSCREEN_ELAN is not set +# CONFIG_TOUCHSCREEN_ELO is not set +# CONFIG_TOUCHSCREEN_WACOM_W8001 is not set +# CONFIG_TOUCHSCREEN_WACOM_I2C is not set +# CONFIG_TOUCHSCREEN_MAX11801 is not set +# CONFIG_TOUCHSCREEN_MCS5000 is not set +# CONFIG_TOUCHSCREEN_MMS114 is not set +# CONFIG_TOUCHSCREEN_MELFAS_MIP4 is not set +# CONFIG_TOUCHSCREEN_MTOUCH is not set +# CONFIG_TOUCHSCREEN_IMX6UL_TSC is not set +# CONFIG_TOUCHSCREEN_INEXIO is not set +# CONFIG_TOUCHSCREEN_MK712 is not set +# CONFIG_TOUCHSCREEN_PENMOUNT is not set +# CONFIG_TOUCHSCREEN_EDT_FT5X06 is not set +CONFIG_TOUCHSCREEN_RPI_FT5406=m +# CONFIG_TOUCHSCREEN_TOUCHRIGHT is not set +# CONFIG_TOUCHSCREEN_TOUCHWIN is not set +# CONFIG_TOUCHSCREEN_PIXCIR is not set +# CONFIG_TOUCHSCREEN_WDT87XX_I2C is not set +# CONFIG_TOUCHSCREEN_WM97XX is not set +CONFIG_TOUCHSCREEN_USB_COMPOSITE=m +CONFIG_TOUCHSCREEN_USB_EGALAX=y +# CONFIG_TOUCHSCREEN_USB_PANJIT is not set +CONFIG_TOUCHSCREEN_USB_3M=y +# CONFIG_TOUCHSCREEN_USB_ITM is not set +# CONFIG_TOUCHSCREEN_USB_ETURBO is not set +# CONFIG_TOUCHSCREEN_USB_GUNZE is not set +# CONFIG_TOUCHSCREEN_USB_DMC_TSC10 is not set +# CONFIG_TOUCHSCREEN_USB_IRTOUCH is not set +# CONFIG_TOUCHSCREEN_USB_IDEALTEK is not set +# CONFIG_TOUCHSCREEN_USB_GENERAL_TOUCH is not set +# CONFIG_TOUCHSCREEN_USB_GOTOP is not set +# CONFIG_TOUCHSCREEN_USB_JASTEC is not set +# CONFIG_TOUCHSCREEN_USB_ELO is not set +# CONFIG_TOUCHSCREEN_USB_E2I is not set +# CONFIG_TOUCHSCREEN_USB_ZYTRONIC is not set +# CONFIG_TOUCHSCREEN_USB_ETT_TC45USB is not set +# CONFIG_TOUCHSCREEN_USB_NEXIO is not set +# CONFIG_TOUCHSCREEN_USB_EASYTOUCH is not set +# CONFIG_TOUCHSCREEN_TOUCHIT213 is not set +# CONFIG_TOUCHSCREEN_TSC_SERIO is not set +# CONFIG_TOUCHSCREEN_TSC2004 is not set +# CONFIG_TOUCHSCREEN_TSC2005 is not set +# CONFIG_TOUCHSCREEN_TSC2007 is not set +CONFIG_TOUCHSCREEN_ST1232=m +# CONFIG_TOUCHSCREEN_SUR40 is not set +# CONFIG_TOUCHSCREEN_SX8654 is not set +# CONFIG_TOUCHSCREEN_TPS6507X is not set +# CONFIG_TOUCHSCREEN_ZFORCE is not set +# CONFIG_TOUCHSCREEN_ROHM_BU21023 is not set +CONFIG_INPUT_MISC=y +# CONFIG_INPUT_AD714X is not set +# CONFIG_INPUT_ARIZONA_HAPTICS is not set +# CONFIG_INPUT_BMA150 is not set +# CONFIG_INPUT_E3X0_BUTTON is not set +# CONFIG_INPUT_MMA8450 is not set +# CONFIG_INPUT_MPU3050 is not set +# CONFIG_INPUT_GP2A is not set +# CONFIG_INPUT_GPIO_BEEPER is not set +# CONFIG_INPUT_GPIO_TILT_POLLED is not set +# CONFIG_INPUT_ATI_REMOTE2 is not set +# CONFIG_INPUT_KEYSPAN_REMOTE is not set +# CONFIG_INPUT_KXTJ9 is not set +# CONFIG_INPUT_POWERMATE is not set +# CONFIG_INPUT_YEALINK is not set +# CONFIG_INPUT_CM109 is not set +CONFIG_INPUT_UINPUT=y +# CONFIG_INPUT_PCF8574 is not set +# CONFIG_INPUT_GPIO_ROTARY_ENCODER is not set +# CONFIG_INPUT_ADXL34X is not set +# CONFIG_INPUT_IMS_PCU is not set +# CONFIG_INPUT_CMA3000 is not set +# CONFIG_INPUT_DRV260X_HAPTICS is not set +# CONFIG_INPUT_DRV2665_HAPTICS is not set +# CONFIG_INPUT_DRV2667_HAPTICS is not set +# CONFIG_RMI4_CORE is not set + +# +# Hardware I/O ports +# +# CONFIG_SERIO is not set +# CONFIG_GAMEPORT is not set + +# +# Character devices +# +CONFIG_BRCM_CHAR_DRIVERS=y +CONFIG_BCM_VC_CMA=y +CONFIG_BCM2708_VCMEM=y +CONFIG_BCM_VCIO=y +CONFIG_BCM_VC_SM=y +CONFIG_BCM2835_DEVGPIOMEM=m +CONFIG_BCM2835_SMI_DEV=m +CONFIG_TTY=y +CONFIG_VT=y +CONFIG_CONSOLE_TRANSLATIONS=y +CONFIG_VT_CONSOLE=y +CONFIG_HW_CONSOLE=y +CONFIG_VT_HW_CONSOLE_BINDING=y +CONFIG_UNIX98_PTYS=y +CONFIG_DEVPTS_MULTIPLE_INSTANCES=y +# CONFIG_LEGACY_PTYS is not set +# CONFIG_SERIAL_NONSTANDARD is not set +# CONFIG_N_GSM is not set +# CONFIG_TRACE_SINK is not set +CONFIG_DEVMEM=y +# CONFIG_DEVKMEM is not set + +# +# Serial drivers +# +CONFIG_SERIAL_EARLYCON=y +CONFIG_SERIAL_8250=y +# CONFIG_SERIAL_8250_DEPRECATED_OPTIONS is not set +CONFIG_SERIAL_8250_CONSOLE=y +# CONFIG_SERIAL_8250_DMA is not set +CONFIG_SERIAL_8250_NR_UARTS=1 +CONFIG_SERIAL_8250_RUNTIME_UARTS=0 +# CONFIG_SERIAL_8250_EXTENDED is not set +CONFIG_SERIAL_8250_FSL=y +# CONFIG_SERIAL_8250_DW is not set +# CONFIG_SERIAL_8250_EM is not set +# CONFIG_SERIAL_8250_RT288X is not set +CONFIG_SERIAL_OF_PLATFORM=y + +# +# Non-8250 serial port support +# +# CONFIG_SERIAL_AMBA_PL010 is not set +CONFIG_SERIAL_AMBA_PL011=y +CONFIG_SERIAL_AMBA_PL011_CONSOLE=y +# CONFIG_SERIAL_EARLYCON_ARM_SEMIHOST is not set +# CONFIG_SERIAL_MAX3100 is not set +# CONFIG_SERIAL_MAX310X is not set +# CONFIG_SERIAL_UARTLITE is not set +CONFIG_SERIAL_CORE=y +CONFIG_SERIAL_CORE_CONSOLE=y +# CONFIG_SERIAL_SCCNXP is not set +# CONFIG_SERIAL_SC16IS7XX is not set +# CONFIG_SERIAL_BCM63XX is not set +# CONFIG_SERIAL_ALTERA_JTAGUART is not set +# CONFIG_SERIAL_ALTERA_UART is not set +# CONFIG_SERIAL_IFX6X60 is not set +# CONFIG_SERIAL_XILINX_PS_UART is not set +# CONFIG_SERIAL_ARC is not set +# CONFIG_SERIAL_FSL_LPUART is not set +# CONFIG_SERIAL_CONEXANT_DIGICOLOR is not set +# CONFIG_SERIAL_ST_ASC is not set +# CONFIG_SERIAL_STM32 is not set +# CONFIG_SERIAL_MVEBU_UART is not set +# CONFIG_TTY_PRINTK is not set +# CONFIG_HVC_DCC is not set +# CONFIG_IPMI_HANDLER is not set +CONFIG_HW_RANDOM=y +# CONFIG_HW_RANDOM_TIMERIOMEM is not set +CONFIG_HW_RANDOM_BCM2835=y +# CONFIG_R3964 is not set +# CONFIG_RAW_DRIVER is not set +# CONFIG_TCG_TPM is not set +# CONFIG_XILLYBUS is not set + +# +# I2C support +# +CONFIG_I2C=y +CONFIG_I2C_BOARDINFO=y +# CONFIG_I2C_COMPAT is not set +CONFIG_I2C_CHARDEV=y +CONFIG_I2C_MUX=m + +# +# Multiplexer I2C Chip support +# +# CONFIG_I2C_ARB_GPIO_CHALLENGE is not set +# CONFIG_I2C_MUX_GPIO is not set +# CONFIG_I2C_MUX_PCA9541 is not set +# CONFIG_I2C_MUX_PCA954x is not set +# CONFIG_I2C_MUX_PINCTRL is not set +# CONFIG_I2C_MUX_REG is not set +# CONFIG_I2C_DEMUX_PINCTRL is not set +CONFIG_I2C_HELPER_AUTO=y +CONFIG_I2C_ALGOBIT=y + +# +# I2C Hardware Bus support +# +CONFIG_I2C_BCM2708=y +CONFIG_I2C_BCM2708_BAUDRATE=100000 + +# +# I2C system bus drivers (mostly embedded / system-on-chip) +# +# CONFIG_I2C_BCM2835 is not set +# CONFIG_I2C_CBUS_GPIO is not set +# CONFIG_I2C_DESIGNWARE_PLATFORM is not set +# CONFIG_I2C_EMEV2 is not set +CONFIG_I2C_GPIO=y +# CONFIG_I2C_NOMADIK is not set +# CONFIG_I2C_OCORES is not set +# CONFIG_I2C_PCA_PLATFORM is not set +# CONFIG_I2C_PXA_PCI is not set +# CONFIG_I2C_RK3X is not set +# CONFIG_I2C_SIMTEC is not set +# CONFIG_I2C_XILINX is not set + +# +# External I2C/SMBus adapter drivers +# +# CONFIG_I2C_DIOLAN_U2C is not set +# CONFIG_I2C_PARPORT_LIGHT is not set +# CONFIG_I2C_ROBOTFUZZ_OSIF is not set +# CONFIG_I2C_TAOS_EVM is not set +# CONFIG_I2C_TINY_USB is not set + +# +# Other I2C/SMBus bus drivers +# +# CONFIG_I2C_STUB is not set +# CONFIG_I2C_SLAVE is not set +# CONFIG_I2C_DEBUG_CORE is not set +# CONFIG_I2C_DEBUG_ALGO is not set +# CONFIG_I2C_DEBUG_BUS is not set +CONFIG_SPI=y +# CONFIG_SPI_DEBUG is not set +CONFIG_SPI_MASTER=y + +# +# SPI Master Controller Drivers +# +# CONFIG_SPI_ALTERA is not set +# CONFIG_SPI_AXI_SPI_ENGINE is not set +CONFIG_SPI_BCM2835=m +CONFIG_SPI_BCM2835AUX=m +# CONFIG_SPI_BITBANG is not set +# CONFIG_SPI_CADENCE is not set +# CONFIG_SPI_DESIGNWARE is not set +# CONFIG_SPI_GPIO is not set +# CONFIG_SPI_FSL_SPI is not set +# CONFIG_SPI_OC_TINY is not set +# CONFIG_SPI_PL022 is not set +# CONFIG_SPI_PXA2XX_PCI is not set +# CONFIG_SPI_ROCKCHIP is not set +# CONFIG_SPI_SC18IS602 is not set +# CONFIG_SPI_XCOMM is not set +# CONFIG_SPI_XILINX is not set +# CONFIG_SPI_ZYNQMP_GQSPI is not set + +# +# SPI Protocol Masters +# +CONFIG_SPI_SPIDEV=y +# CONFIG_SPI_LOOPBACK_TEST is not set +# CONFIG_SPI_TLE62X0 is not set +# CONFIG_SPMI is not set +# CONFIG_HSI is not set + +# +# PPS support +# +# CONFIG_PPS is not set + +# +# PPS generators support +# + +# +# PTP clock support +# +# CONFIG_PTP_1588_CLOCK is not set + +# +# Enable PHYLIB and NETWORK_PHY_TIMESTAMPING to see the additional clocks. +# +CONFIG_PINCTRL=y + +# +# Pin controllers +# +CONFIG_PINMUX=y +CONFIG_PINCONF=y +# CONFIG_DEBUG_PINCTRL is not set +# CONFIG_PINCTRL_AMD is not set +# CONFIG_PINCTRL_SINGLE is not set +CONFIG_PINCTRL_BCM2835=y +CONFIG_ARCH_HAVE_CUSTOM_GPIO_H=y +CONFIG_ARCH_REQUIRE_GPIOLIB=y +CONFIG_GPIOLIB=y +CONFIG_GPIO_DEVRES=y +CONFIG_OF_GPIO=y +# CONFIG_DEBUG_GPIO is not set +CONFIG_GPIO_SYSFS=y + +# +# Memory mapped GPIO drivers +# +# CONFIG_GPIO_74XX_MMIO is not set +# CONFIG_GPIO_ALTERA is not set +CONFIG_GPIO_BCM_VIRT=y +# CONFIG_GPIO_DWAPB is not set +# CONFIG_GPIO_EM is not set +# CONFIG_GPIO_GENERIC_PLATFORM is not set +# CONFIG_GPIO_GRGPIO is not set +# CONFIG_GPIO_MPC8XXX is not set +# CONFIG_GPIO_PL061 is not set +# CONFIG_GPIO_SYSCON is not set +# CONFIG_GPIO_XILINX is not set +# CONFIG_GPIO_ZEVIO is not set +# CONFIG_GPIO_ZX is not set + +# +# I2C GPIO expanders +# +# CONFIG_GPIO_ADP5588 is not set +# CONFIG_GPIO_ADNP is not set +# CONFIG_GPIO_MAX7300 is not set +# CONFIG_GPIO_MAX732X is not set +# CONFIG_GPIO_PCA953X is not set +# CONFIG_GPIO_PCF857X is not set +# CONFIG_GPIO_SX150X is not set +# CONFIG_GPIO_TPIC2810 is not set + +# +# MFD GPIO expanders +# +CONFIG_GPIO_ARIZONA=m + +# +# SPI GPIO expanders +# +# CONFIG_GPIO_74X164 is not set +# CONFIG_GPIO_MAX7301 is not set +# CONFIG_GPIO_MC33880 is not set +# CONFIG_GPIO_PISOSR is not set + +# +# SPI or I2C GPIO expanders +# +# CONFIG_GPIO_MCP23S08 is not set + +# +# USB GPIO expanders +# +CONFIG_W1=m + +# +# 1-wire Bus Masters +# +# CONFIG_W1_MASTER_DS2490 is not set +# CONFIG_W1_MASTER_DS2482 is not set +# CONFIG_W1_MASTER_DS1WM is not set +CONFIG_W1_MASTER_GPIO=m + +# +# 1-wire Slaves +# +CONFIG_W1_SLAVE_THERM=m +# CONFIG_W1_SLAVE_SMEM is not set +# CONFIG_W1_SLAVE_DS2408 is not set +# CONFIG_W1_SLAVE_DS2413 is not set +# CONFIG_W1_SLAVE_DS2406 is not set +# CONFIG_W1_SLAVE_DS2423 is not set +# CONFIG_W1_SLAVE_DS2431 is not set +# CONFIG_W1_SLAVE_DS2433 is not set +# CONFIG_W1_SLAVE_DS2760 is not set +# CONFIG_W1_SLAVE_DS2780 is not set +# CONFIG_W1_SLAVE_DS2781 is not set +# CONFIG_W1_SLAVE_DS28E04 is not set +# CONFIG_W1_SLAVE_BQ27000 is not set +CONFIG_POWER_SUPPLY=y +# CONFIG_POWER_SUPPLY_DEBUG is not set +# CONFIG_PDA_POWER is not set +# CONFIG_TEST_POWER is not set +# CONFIG_BATTERY_DS2780 is not set +# CONFIG_BATTERY_DS2781 is not set +# CONFIG_BATTERY_DS2782 is not set +# CONFIG_BATTERY_SBS is not set +# CONFIG_BATTERY_BQ27XXX is not set +# CONFIG_BATTERY_MAX17040 is not set +# CONFIG_BATTERY_MAX17042 is not set +# CONFIG_CHARGER_MAX8903 is not set +# CONFIG_CHARGER_LP8727 is not set +# CONFIG_CHARGER_GPIO is not set +# CONFIG_CHARGER_BQ2415X is not set +# CONFIG_CHARGER_BQ24190 is not set +# CONFIG_CHARGER_BQ24257 is not set +# CONFIG_CHARGER_BQ24735 is not set +# CONFIG_CHARGER_BQ25890 is not set +# CONFIG_CHARGER_SMB347 is not set +# CONFIG_BATTERY_GAUGE_LTC2941 is not set +# CONFIG_CHARGER_RT9455 is not set +CONFIG_POWER_RESET=y +# CONFIG_POWER_RESET_BRCMSTB is not set +CONFIG_POWER_RESET_GPIO=y +CONFIG_POWER_RESET_GPIO_RESTART=y +# CONFIG_POWER_RESET_LTC2952 is not set +CONFIG_POWER_RESET_RESTART=y +# CONFIG_POWER_RESET_VERSATILE is not set +# CONFIG_POWER_RESET_SYSCON is not set +# CONFIG_POWER_RESET_SYSCON_POWEROFF is not set +# CONFIG_POWER_AVS is not set +CONFIG_HWMON=y +# CONFIG_HWMON_VID is not set +# CONFIG_HWMON_DEBUG_CHIP is not set + +# +# Native drivers +# +# CONFIG_SENSORS_AD7314 is not set +# CONFIG_SENSORS_AD7414 is not set +# CONFIG_SENSORS_AD7418 is not set +# CONFIG_SENSORS_ADM1021 is not set +# CONFIG_SENSORS_ADM1025 is not set +# CONFIG_SENSORS_ADM1026 is not set +# CONFIG_SENSORS_ADM1029 is not set +# CONFIG_SENSORS_ADM1031 is not set +# CONFIG_SENSORS_ADM9240 is not set +# CONFIG_SENSORS_ADT7310 is not set +# CONFIG_SENSORS_ADT7410 is not set +# CONFIG_SENSORS_ADT7411 is not set +# CONFIG_SENSORS_ADT7462 is not set +# CONFIG_SENSORS_ADT7470 is not set +# CONFIG_SENSORS_ADT7475 is not set +# CONFIG_SENSORS_ASC7621 is not set +# CONFIG_SENSORS_ATXP1 is not set +# CONFIG_SENSORS_DS620 is not set +# CONFIG_SENSORS_DS1621 is not set +# CONFIG_SENSORS_F71805F is not set +# CONFIG_SENSORS_F71882FG is not set +# CONFIG_SENSORS_F75375S is not set +# CONFIG_SENSORS_GL518SM is not set +# CONFIG_SENSORS_GL520SM is not set +# CONFIG_SENSORS_G760A is not set +# CONFIG_SENSORS_G762 is not set +# CONFIG_SENSORS_GPIO_FAN is not set +# CONFIG_SENSORS_HIH6130 is not set +# CONFIG_SENSORS_IT87 is not set +# CONFIG_SENSORS_JC42 is not set +# CONFIG_SENSORS_POWR1220 is not set +# CONFIG_SENSORS_LINEAGE is not set +# CONFIG_SENSORS_LTC2945 is not set +# CONFIG_SENSORS_LTC2990 is not set +# CONFIG_SENSORS_LTC4151 is not set +# CONFIG_SENSORS_LTC4215 is not set +# CONFIG_SENSORS_LTC4222 is not set +# CONFIG_SENSORS_LTC4245 is not set +# CONFIG_SENSORS_LTC4260 is not set +# CONFIG_SENSORS_LTC4261 is not set +# CONFIG_SENSORS_MAX1111 is not set +# CONFIG_SENSORS_MAX16065 is not set +# CONFIG_SENSORS_MAX1619 is not set +# CONFIG_SENSORS_MAX1668 is not set +# CONFIG_SENSORS_MAX197 is not set +# CONFIG_SENSORS_MAX6639 is not set +# CONFIG_SENSORS_MAX6642 is not set +# CONFIG_SENSORS_MAX6650 is not set +# CONFIG_SENSORS_MAX6697 is not set +# CONFIG_SENSORS_MAX31790 is not set +# CONFIG_SENSORS_MCP3021 is not set +# CONFIG_SENSORS_ADCXX is not set +# CONFIG_SENSORS_LM63 is not set +# CONFIG_SENSORS_LM70 is not set +# CONFIG_SENSORS_LM73 is not set +# CONFIG_SENSORS_LM75 is not set +# CONFIG_SENSORS_LM77 is not set +# CONFIG_SENSORS_LM78 is not set +# CONFIG_SENSORS_LM80 is not set +# CONFIG_SENSORS_LM83 is not set +# CONFIG_SENSORS_LM85 is not set +# CONFIG_SENSORS_LM87 is not set +# CONFIG_SENSORS_LM90 is not set +# CONFIG_SENSORS_LM92 is not set +# CONFIG_SENSORS_LM93 is not set +# CONFIG_SENSORS_LM95234 is not set +# CONFIG_SENSORS_LM95241 is not set +# CONFIG_SENSORS_LM95245 is not set +# CONFIG_SENSORS_PC87360 is not set +# CONFIG_SENSORS_PC87427 is not set +# CONFIG_SENSORS_NTC_THERMISTOR is not set +# CONFIG_SENSORS_NCT6683 is not set +# CONFIG_SENSORS_NCT6775 is not set +# CONFIG_SENSORS_NCT7802 is not set +# CONFIG_SENSORS_NCT7904 is not set +# CONFIG_SENSORS_PCF8591 is not set +# CONFIG_PMBUS is not set +# CONFIG_SENSORS_SHT15 is not set +# CONFIG_SENSORS_SHT21 is not set +# CONFIG_SENSORS_SHTC1 is not set +# CONFIG_SENSORS_DME1737 is not set +# CONFIG_SENSORS_EMC1403 is not set +# CONFIG_SENSORS_EMC2103 is not set +# CONFIG_SENSORS_EMC6W201 is not set +# CONFIG_SENSORS_SMSC47M1 is not set +# CONFIG_SENSORS_SMSC47M192 is not set +# CONFIG_SENSORS_SMSC47B397 is not set +# CONFIG_SENSORS_SCH56XX_COMMON is not set +# CONFIG_SENSORS_SCH5627 is not set +# CONFIG_SENSORS_SCH5636 is not set +# CONFIG_SENSORS_SMM665 is not set +# CONFIG_SENSORS_ADC128D818 is not set +# CONFIG_SENSORS_ADS1015 is not set +# CONFIG_SENSORS_ADS7828 is not set +# CONFIG_SENSORS_ADS7871 is not set +# CONFIG_SENSORS_AMC6821 is not set +# CONFIG_SENSORS_INA209 is not set +# CONFIG_SENSORS_INA2XX is not set +# CONFIG_SENSORS_TC74 is not set +# CONFIG_SENSORS_THMC50 is not set +# CONFIG_SENSORS_TMP102 is not set +# CONFIG_SENSORS_TMP103 is not set +# CONFIG_SENSORS_TMP401 is not set +# CONFIG_SENSORS_TMP421 is not set +# CONFIG_SENSORS_VT1211 is not set +# CONFIG_SENSORS_W83781D is not set +# CONFIG_SENSORS_W83791D is not set +# CONFIG_SENSORS_W83792D is not set +# CONFIG_SENSORS_W83793 is not set +# CONFIG_SENSORS_W83795 is not set +# CONFIG_SENSORS_W83L785TS is not set +# CONFIG_SENSORS_W83L786NG is not set +# CONFIG_SENSORS_W83627HF is not set +# CONFIG_SENSORS_W83627EHF is not set +CONFIG_THERMAL=y +CONFIG_THERMAL_HWMON=y +CONFIG_THERMAL_OF=y +# CONFIG_THERMAL_WRITABLE_TRIPS is not set +CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE=y +# CONFIG_THERMAL_DEFAULT_GOV_FAIR_SHARE is not set +# CONFIG_THERMAL_DEFAULT_GOV_USER_SPACE is not set +# CONFIG_THERMAL_DEFAULT_GOV_POWER_ALLOCATOR is not set +# CONFIG_THERMAL_GOV_FAIR_SHARE is not set +CONFIG_THERMAL_GOV_STEP_WISE=y +# CONFIG_THERMAL_GOV_BANG_BANG is not set +# CONFIG_THERMAL_GOV_USER_SPACE is not set +# CONFIG_THERMAL_GOV_POWER_ALLOCATOR is not set +# CONFIG_CPU_THERMAL is not set +# CONFIG_THERMAL_EMULATION is not set +CONFIG_THERMAL_BCM2835=y +CONFIG_WATCHDOG=y +CONFIG_WATCHDOG_CORE=y +# CONFIG_WATCHDOG_NOWAYOUT is not set +# CONFIG_WATCHDOG_SYSFS is not set + +# +# Watchdog Device Drivers +# +# CONFIG_SOFT_WATCHDOG is not set +# CONFIG_GPIO_WATCHDOG is not set +# CONFIG_XILINX_WATCHDOG is not set +# CONFIG_ZIIRAVE_WATCHDOG is not set +# CONFIG_ARM_SP805_WATCHDOG is not set +# CONFIG_CADENCE_WATCHDOG is not set +# CONFIG_DW_WATCHDOG is not set +# CONFIG_MAX63XX_WATCHDOG is not set +CONFIG_BCM2835_WDT=m +# CONFIG_MEN_A21_WDT is not set + +# +# USB-based Watchdog Cards +# +# CONFIG_USBPCWATCHDOG is not set +CONFIG_SSB_POSSIBLE=y + +# +# Sonics Silicon Backplane +# +CONFIG_SSB=m +CONFIG_SSB_BLOCKIO=y +CONFIG_SSB_SDIOHOST_POSSIBLE=y +# CONFIG_SSB_SDIOHOST is not set +# CONFIG_SSB_SILENT is not set +# CONFIG_SSB_DEBUG is not set +# CONFIG_SSB_DRIVER_GPIO is not set +CONFIG_BCMA_POSSIBLE=y + +# +# Broadcom specific AMBA +# +CONFIG_BCMA=m +CONFIG_BCMA_BLOCKIO=y +# CONFIG_BCMA_HOST_SOC is not set +CONFIG_BCMA_DRIVER_GMAC_CMN=y +# CONFIG_BCMA_DRIVER_GPIO is not set +# CONFIG_BCMA_DEBUG is not set + +# +# Multifunction device drivers +# +CONFIG_MFD_CORE=y +# CONFIG_MFD_RPISENSE_CORE is not set +# CONFIG_MFD_ACT8945A is not set +# CONFIG_MFD_AS3711 is not set +# CONFIG_MFD_AS3722 is not set +# CONFIG_PMIC_ADP5520 is not set +# CONFIG_MFD_AAT2870_CORE is not set +# CONFIG_MFD_ATMEL_FLEXCOM is not set +# CONFIG_MFD_ATMEL_HLCDC is not set +# CONFIG_MFD_BCM590XX is not set +# CONFIG_MFD_AXP20X_I2C is not set +# CONFIG_MFD_CROS_EC is not set +# CONFIG_MFD_ASIC3 is not set +# CONFIG_PMIC_DA903X is not set +# CONFIG_MFD_DA9052_SPI is not set +# CONFIG_MFD_DA9052_I2C is not set +# CONFIG_MFD_DA9055 is not set +# CONFIG_MFD_DA9062 is not set +# CONFIG_MFD_DA9063 is not set +# CONFIG_MFD_DA9150 is not set +# CONFIG_MFD_DLN2 is not set +# CONFIG_MFD_MC13XXX_SPI is not set +# CONFIG_MFD_MC13XXX_I2C is not set +# CONFIG_MFD_HI6421_PMIC is not set +# CONFIG_HTC_EGPIO is not set +# CONFIG_HTC_PASIC3 is not set +# CONFIG_HTC_I2CPLD is not set +# CONFIG_INTEL_SOC_PMIC is not set +# CONFIG_MFD_KEMPLD is not set +# CONFIG_MFD_88PM800 is not set +# CONFIG_MFD_88PM805 is not set +# CONFIG_MFD_88PM860X is not set +# CONFIG_MFD_MAX14577 is not set +# CONFIG_MFD_MAX77686 is not set +# CONFIG_MFD_MAX77693 is not set +# CONFIG_MFD_MAX77843 is not set +# CONFIG_MFD_MAX8907 is not set +# CONFIG_MFD_MAX8925 is not set +# CONFIG_MFD_MAX8997 is not set +# CONFIG_MFD_MAX8998 is not set +# CONFIG_MFD_MT6397 is not set +# CONFIG_MFD_MENF21BMC is not set +# CONFIG_EZX_PCAP is not set +# CONFIG_MFD_VIPERBOARD is not set +# CONFIG_MFD_RETU is not set +# CONFIG_MFD_PCF50633 is not set +# CONFIG_UCB1400_CORE is not set +# CONFIG_MFD_PM8921_CORE is not set +# CONFIG_MFD_RT5033 is not set +CONFIG_MFD_RTSX_USB=y +# CONFIG_MFD_RC5T583 is not set +# CONFIG_MFD_RK808 is not set +# CONFIG_MFD_RN5T618 is not set +# CONFIG_MFD_SEC_CORE is not set +# CONFIG_MFD_SI476X_CORE is not set +# CONFIG_MFD_SM501 is not set +# CONFIG_MFD_SKY81452 is not set +# CONFIG_MFD_SMSC is not set +# CONFIG_ABX500_CORE is not set +# CONFIG_MFD_STMPE is not set +CONFIG_MFD_SYSCON=y +# CONFIG_MFD_TI_AM335X_TSCADC is not set +# CONFIG_MFD_LP3943 is not set +# CONFIG_MFD_LP8788 is not set +# CONFIG_MFD_PALMAS is not set +# CONFIG_TPS6105X is not set +# CONFIG_TPS65010 is not set +# CONFIG_TPS6507X is not set +# CONFIG_MFD_TPS65086 is not set +# CONFIG_MFD_TPS65090 is not set +# CONFIG_MFD_TPS65217 is not set +# CONFIG_MFD_TPS65218 is not set +# CONFIG_MFD_TPS6586X is not set +# CONFIG_MFD_TPS65910 is not set +# CONFIG_MFD_TPS65912_I2C is not set +# CONFIG_MFD_TPS65912_SPI is not set +# CONFIG_MFD_TPS80031 is not set +# CONFIG_TWL4030_CORE is not set +# CONFIG_TWL6040_CORE is not set +# CONFIG_MFD_WL1273_CORE is not set +# CONFIG_MFD_LM3533 is not set +# CONFIG_MFD_TC3589X is not set +# CONFIG_MFD_TMIO is not set +# CONFIG_MFD_T7L66XB is not set +# CONFIG_MFD_TC6387XB is not set +# CONFIG_MFD_TC6393XB is not set +CONFIG_MFD_ARIZONA=y +CONFIG_MFD_ARIZONA_I2C=m +CONFIG_MFD_ARIZONA_SPI=m +# CONFIG_MFD_CS47L24 is not set +CONFIG_MFD_WM5102=y +# CONFIG_MFD_WM5110 is not set +# CONFIG_MFD_WM8997 is not set +# CONFIG_MFD_WM8998 is not set +# CONFIG_MFD_WM8400 is not set +# CONFIG_MFD_WM831X_I2C is not set +# CONFIG_MFD_WM831X_SPI is not set +# CONFIG_MFD_WM8350_I2C is not set +# CONFIG_MFD_WM8994 is not set +# CONFIG_REGULATOR is not set +CONFIG_MEDIA_SUPPORT=m + +# +# Multimedia core support +# +CONFIG_MEDIA_CAMERA_SUPPORT=y +CONFIG_MEDIA_ANALOG_TV_SUPPORT=y +CONFIG_MEDIA_DIGITAL_TV_SUPPORT=y +CONFIG_MEDIA_RADIO_SUPPORT=y +# CONFIG_MEDIA_SDR_SUPPORT is not set +CONFIG_MEDIA_RC_SUPPORT=y +# CONFIG_MEDIA_CONTROLLER is not set +CONFIG_VIDEO_DEV=m +CONFIG_VIDEO_V4L2=m +# CONFIG_VIDEO_ADV_DEBUG is not set +# CONFIG_VIDEO_FIXED_MINOR_RANGES is not set +CONFIG_VIDEO_TUNER=m +CONFIG_VIDEOBUF_GEN=m +CONFIG_VIDEOBUF_VMALLOC=m +CONFIG_VIDEOBUF_DVB=m +CONFIG_VIDEOBUF2_CORE=m +CONFIG_VIDEOBUF2_MEMOPS=m +CONFIG_VIDEOBUF2_VMALLOC=m +CONFIG_DVB_CORE=m +CONFIG_DVB_NET=y +CONFIG_TTPCI_EEPROM=m +CONFIG_DVB_MAX_ADAPTERS=8 +# CONFIG_DVB_DYNAMIC_MINORS is not set + +# +# Media drivers +# +CONFIG_RC_CORE=m +CONFIG_RC_MAP=m +CONFIG_RC_DECODERS=y +CONFIG_LIRC=m +CONFIG_IR_LIRC_CODEC=m +CONFIG_IR_NEC_DECODER=m +CONFIG_IR_RC5_DECODER=m +CONFIG_IR_RC6_DECODER=m +CONFIG_IR_JVC_DECODER=m +CONFIG_IR_SONY_DECODER=m +CONFIG_IR_SANYO_DECODER=m +CONFIG_IR_SHARP_DECODER=m +CONFIG_IR_MCE_KBD_DECODER=m +CONFIG_IR_XMP_DECODER=m +CONFIG_RC_DEVICES=y +CONFIG_RC_ATI_REMOTE=m +# CONFIG_IR_HIX5HD2 is not set +CONFIG_IR_IMON=m +CONFIG_IR_MCEUSB=m +CONFIG_IR_REDRAT3=m +CONFIG_IR_STREAMZAP=m +CONFIG_IR_IGORPLUGUSB=m +CONFIG_IR_IGUANA=m +CONFIG_IR_TTUSBIR=m +# CONFIG_RC_LOOPBACK is not set +CONFIG_IR_GPIO_CIR=m +CONFIG_MEDIA_USB_SUPPORT=y + +# +# Webcam devices +# +# CONFIG_USB_VIDEO_CLASS is not set +# CONFIG_USB_GSPCA is not set +# CONFIG_USB_PWC is not set +# CONFIG_VIDEO_CPIA2 is not set +# CONFIG_USB_ZR364XX is not set +# CONFIG_USB_STKWEBCAM is not set +# CONFIG_USB_S2255 is not set +CONFIG_VIDEO_USBTV=m + +# +# Analog TV USB devices +# +CONFIG_VIDEO_PVRUSB2=m +CONFIG_VIDEO_PVRUSB2_SYSFS=y +CONFIG_VIDEO_PVRUSB2_DVB=y +# CONFIG_VIDEO_PVRUSB2_DEBUGIFC is not set +# CONFIG_VIDEO_HDPVR is not set +# CONFIG_VIDEO_USBVISION is not set +CONFIG_VIDEO_STK1160_COMMON=m +# CONFIG_VIDEO_STK1160_AC97 is not set +CONFIG_VIDEO_STK1160=m +# CONFIG_VIDEO_GO7007 is not set + +# +# Analog/digital TV USB devices +# +CONFIG_VIDEO_AU0828=m +CONFIG_VIDEO_AU0828_V4L2=y +CONFIG_VIDEO_AU0828_RC=y +CONFIG_VIDEO_CX231XX=m +CONFIG_VIDEO_CX231XX_RC=y +# CONFIG_VIDEO_CX231XX_ALSA is not set +CONFIG_VIDEO_CX231XX_DVB=m +CONFIG_VIDEO_TM6000=m +# CONFIG_VIDEO_TM6000_ALSA is not set +CONFIG_VIDEO_TM6000_DVB=m + +# +# Digital TV USB devices +# +CONFIG_DVB_USB=m +# CONFIG_DVB_USB_DEBUG is not set +# CONFIG_DVB_USB_A800 is not set +CONFIG_DVB_USB_DIBUSB_MB=m +CONFIG_DVB_USB_DIBUSB_MB_FAULTY=y +CONFIG_DVB_USB_DIBUSB_MC=m +CONFIG_DVB_USB_DIB0700=m +# CONFIG_DVB_USB_UMT_010 is not set +CONFIG_DVB_USB_CXUSB=m +# CONFIG_DVB_USB_M920X is not set +# CONFIG_DVB_USB_DIGITV is not set +CONFIG_DVB_USB_VP7045=m +# CONFIG_DVB_USB_VP702X is not set +# CONFIG_DVB_USB_GP8PSK is not set +CONFIG_DVB_USB_NOVA_T_USB2=m +CONFIG_DVB_USB_TTUSB2=m +CONFIG_DVB_USB_DTT200U=m +CONFIG_DVB_USB_OPERA1=m +CONFIG_DVB_USB_AF9005=m +CONFIG_DVB_USB_AF9005_REMOTE=m +CONFIG_DVB_USB_PCTV452E=m +CONFIG_DVB_USB_DW2102=m +CONFIG_DVB_USB_CINERGY_T2=m +CONFIG_DVB_USB_DTV5100=m +# CONFIG_DVB_USB_FRIIO is not set +CONFIG_DVB_USB_AZ6027=m +CONFIG_DVB_USB_TECHNISAT_USB2=m +CONFIG_DVB_USB_V2=m +CONFIG_DVB_USB_AF9015=m +CONFIG_DVB_USB_AF9035=m +CONFIG_DVB_USB_ANYSEE=m +# CONFIG_DVB_USB_AU6610 is not set +CONFIG_DVB_USB_AZ6007=m +CONFIG_DVB_USB_CE6230=m +CONFIG_DVB_USB_EC168=m +# CONFIG_DVB_USB_GL861 is not set +CONFIG_DVB_USB_LME2510=m +# CONFIG_DVB_USB_MXL111SF is not set +CONFIG_DVB_USB_RTL28XXU=m +CONFIG_DVB_USB_DVBSKY=m +CONFIG_SMS_USB_DRV=m +CONFIG_DVB_B2C2_FLEXCOP_USB=m +# CONFIG_DVB_B2C2_FLEXCOP_USB_DEBUG is not set +CONFIG_DVB_AS102=m + +# +# Webcam, TV (analog/digital) USB devices +# +CONFIG_VIDEO_EM28XX=m +# CONFIG_VIDEO_EM28XX_V4L2 is not set +# CONFIG_VIDEO_EM28XX_ALSA is not set +CONFIG_VIDEO_EM28XX_DVB=m +CONFIG_VIDEO_EM28XX_RC=m +# CONFIG_V4L_PLATFORM_DRIVERS is not set +# CONFIG_V4L_MEM2MEM_DRIVERS is not set +# CONFIG_V4L_TEST_DRIVERS is not set +# CONFIG_DVB_PLATFORM_DRIVERS is not set + +# +# Supported MMC/SDIO adapters +# +CONFIG_SMS_SDIO_DRV=m +# CONFIG_RADIO_ADAPTERS is not set +CONFIG_MEDIA_COMMON_OPTIONS=y + +# +# common driver options +# +CONFIG_VIDEO_CX2341X=m +CONFIG_VIDEO_TVEEPROM=m +CONFIG_CYPRESS_FIRMWARE=m +CONFIG_DVB_B2C2_FLEXCOP=m +CONFIG_SMS_SIANO_MDTV=m +CONFIG_SMS_SIANO_RC=y +# CONFIG_SMS_SIANO_DEBUGFS is not set + +# +# Media ancillary drivers (tuners, sensors, i2c, frontends) +# +CONFIG_MEDIA_SUBDRV_AUTOSELECT=y +CONFIG_MEDIA_ATTACH=y +CONFIG_VIDEO_IR_I2C=m + +# +# Audio decoders, processors and mixers +# +CONFIG_VIDEO_MSP3400=m +CONFIG_VIDEO_CS53L32A=m +CONFIG_VIDEO_WM8775=m + +# +# RDS decoders +# + +# +# Video decoders +# +CONFIG_VIDEO_SAA711X=m + +# +# Video and audio decoders +# +CONFIG_VIDEO_CX25840=m + +# +# Video encoders +# + +# +# Camera sensor devices +# + +# +# Flash devices +# + +# +# Video improvement chips +# + +# +# Audio/Video compression chips +# + +# +# Miscellaneous helper chips +# + +# +# Sensors used on soc_camera driver +# +CONFIG_MEDIA_TUNER=m +CONFIG_MEDIA_TUNER_SIMPLE=m +CONFIG_MEDIA_TUNER_TDA8290=m +CONFIG_MEDIA_TUNER_TDA827X=m +CONFIG_MEDIA_TUNER_TDA18271=m +CONFIG_MEDIA_TUNER_TDA9887=m +CONFIG_MEDIA_TUNER_TEA5761=m +CONFIG_MEDIA_TUNER_TEA5767=m +CONFIG_MEDIA_TUNER_MT20XX=m +CONFIG_MEDIA_TUNER_MT2060=m +CONFIG_MEDIA_TUNER_MT2063=m +CONFIG_MEDIA_TUNER_MT2266=m +CONFIG_MEDIA_TUNER_QT1010=m +CONFIG_MEDIA_TUNER_XC2028=m +CONFIG_MEDIA_TUNER_XC5000=m +CONFIG_MEDIA_TUNER_XC4000=m +CONFIG_MEDIA_TUNER_MXL5005S=m +CONFIG_MEDIA_TUNER_MXL5007T=m +CONFIG_MEDIA_TUNER_MC44S803=m +CONFIG_MEDIA_TUNER_MAX2165=m +CONFIG_MEDIA_TUNER_TDA18218=m +CONFIG_MEDIA_TUNER_FC0011=m +CONFIG_MEDIA_TUNER_FC0012=m +CONFIG_MEDIA_TUNER_FC0013=m +CONFIG_MEDIA_TUNER_TDA18212=m +CONFIG_MEDIA_TUNER_E4000=m +CONFIG_MEDIA_TUNER_FC2580=m +CONFIG_MEDIA_TUNER_TUA9001=m +CONFIG_MEDIA_TUNER_SI2157=m +CONFIG_MEDIA_TUNER_IT913X=m +CONFIG_MEDIA_TUNER_R820T=m + +# +# Multistandard (satellite) frontends +# +CONFIG_DVB_STB0899=m +CONFIG_DVB_STB6100=m +CONFIG_DVB_STV090x=m +CONFIG_DVB_STV6110x=m +CONFIG_DVB_M88DS3103=m + +# +# Multistandard (cable + terrestrial) frontends +# +CONFIG_DVB_DRXK=m +CONFIG_DVB_TDA18271C2DD=m +CONFIG_DVB_SI2165=m + +# +# DVB-S (satellite) frontends +# +CONFIG_DVB_CX24123=m +CONFIG_DVB_MT312=m +CONFIG_DVB_ZL10039=m +CONFIG_DVB_S5H1420=m +CONFIG_DVB_STV0288=m +CONFIG_DVB_STB6000=m +CONFIG_DVB_STV0299=m +CONFIG_DVB_STV6110=m +CONFIG_DVB_STV0900=m +CONFIG_DVB_TDA10086=m +CONFIG_DVB_TUNER_ITD1000=m +CONFIG_DVB_TUNER_CX24113=m +CONFIG_DVB_TDA826X=m +CONFIG_DVB_CX24116=m +CONFIG_DVB_CX24120=m +CONFIG_DVB_SI21XX=m +CONFIG_DVB_TS2020=m +CONFIG_DVB_DS3000=m +CONFIG_DVB_TDA10071=m + +# +# DVB-T (terrestrial) frontends +# +CONFIG_DVB_CX22702=m +CONFIG_DVB_DRXD=m +CONFIG_DVB_MT352=m +CONFIG_DVB_ZL10353=m +CONFIG_DVB_DIB3000MB=m +CONFIG_DVB_DIB3000MC=m +CONFIG_DVB_DIB7000M=m +CONFIG_DVB_DIB7000P=m +CONFIG_DVB_TDA10048=m +CONFIG_DVB_AF9013=m +CONFIG_DVB_EC100=m +CONFIG_DVB_CXD2820R=m +CONFIG_DVB_RTL2830=m +CONFIG_DVB_RTL2832=m +CONFIG_DVB_SI2168=m +CONFIG_DVB_AS102_FE=m + +# +# DVB-C (cable) frontends +# +CONFIG_DVB_TDA10023=m +CONFIG_DVB_STV0297=m + +# +# ATSC (North American/Korean Terrestrial/Cable DTV) frontends +# +CONFIG_DVB_NXT200X=m +CONFIG_DVB_BCM3510=m +CONFIG_DVB_LGDT330X=m +CONFIG_DVB_LGDT3305=m +CONFIG_DVB_LGDT3306A=m +CONFIG_DVB_S5H1409=m +CONFIG_DVB_AU8522=m +CONFIG_DVB_AU8522_DTV=m +CONFIG_DVB_AU8522_V4L=m +CONFIG_DVB_S5H1411=m + +# +# ISDB-T (terrestrial) frontends +# +CONFIG_DVB_S921=m +CONFIG_DVB_DIB8000=m +CONFIG_DVB_MB86A20S=m + +# +# ISDB-S (satellite) & ISDB-T (terrestrial) frontends +# + +# +# Digital terrestrial only tuners/PLL +# +CONFIG_DVB_PLL=m +CONFIG_DVB_TUNER_DIB0070=m +CONFIG_DVB_TUNER_DIB0090=m + +# +# SEC control devices for DVB-S +# +CONFIG_DVB_DRX39XYJ=m +CONFIG_DVB_LNBP21=m +CONFIG_DVB_LNBP22=m +CONFIG_DVB_ISL6421=m +CONFIG_DVB_ISL6423=m +CONFIG_DVB_A8293=m +CONFIG_DVB_SP2=m +CONFIG_DVB_LGS8GXX=m +CONFIG_DVB_ATBM8830=m +CONFIG_DVB_IX2505V=m +CONFIG_DVB_M88RS2000=m +CONFIG_DVB_AF9033=m + +# +# Tools to develop new frontends +# +# CONFIG_DVB_DUMMY_FE is not set + +# +# Graphics support +# +# CONFIG_DRM is not set + +# +# ACP (Audio CoProcessor) Configuration +# +# CONFIG_DRM_AMD_ACP is not set + +# +# Frame buffer Devices +# +CONFIG_FB=y +# CONFIG_FIRMWARE_EDID is not set +CONFIG_FB_CMDLINE=y +CONFIG_FB_NOTIFY=y +# CONFIG_FB_DDC is not set +# CONFIG_FB_BOOT_VESA_SUPPORT is not set +CONFIG_FB_CFB_FILLRECT=y +CONFIG_FB_CFB_COPYAREA=y +CONFIG_FB_CFB_IMAGEBLIT=y +# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set +# CONFIG_FB_SYS_FILLRECT is not set +# CONFIG_FB_SYS_COPYAREA is not set +# CONFIG_FB_SYS_IMAGEBLIT is not set +# CONFIG_FB_FOREIGN_ENDIAN is not set +# CONFIG_FB_SYS_FOPS is not set +# CONFIG_FB_SVGALIB is not set +# CONFIG_FB_MACMODES is not set +# CONFIG_FB_BACKLIGHT is not set +# CONFIG_FB_MODE_HELPERS is not set +# CONFIG_FB_TILEBLITTING is not set + +# +# Frame buffer hardware drivers +# +CONFIG_FB_BCM2708=y +# CONFIG_FB_ARMCLCD is not set +# CONFIG_FB_OPENCORES is not set +# CONFIG_FB_S1D13XXX is not set +# CONFIG_FB_SMSCUFX is not set +# CONFIG_FB_UDL is not set +# CONFIG_FB_IBM_GXT4500 is not set +# CONFIG_FB_VIRTUAL is not set +# CONFIG_FB_METRONOME is not set +# CONFIG_FB_BROADSHEET is not set +# CONFIG_FB_AUO_K190X is not set +# CONFIG_FB_SIMPLE is not set +# CONFIG_FB_SSD1307 is not set +# CONFIG_FB_RPISENSE is not set +CONFIG_BACKLIGHT_LCD_SUPPORT=y +CONFIG_LCD_CLASS_DEVICE=m +# CONFIG_LCD_L4F00242T03 is not set +# CONFIG_LCD_LMS283GF05 is not set +# CONFIG_LCD_LTV350QV is not set +# CONFIG_LCD_ILI922X is not set +# CONFIG_LCD_ILI9320 is not set +# CONFIG_LCD_TDO24M is not set +# CONFIG_LCD_VGG2432A4 is not set +# CONFIG_LCD_PLATFORM is not set +# CONFIG_LCD_S6E63M0 is not set +# CONFIG_LCD_LD9040 is not set +# CONFIG_LCD_AMS369FG06 is not set +# CONFIG_LCD_LMS501KF03 is not set +# CONFIG_LCD_HX8357 is not set +CONFIG_BACKLIGHT_CLASS_DEVICE=y +# CONFIG_BACKLIGHT_GENERIC is not set +CONFIG_BACKLIGHT_RPI=y +# CONFIG_BACKLIGHT_PM8941_WLED is not set +# CONFIG_BACKLIGHT_ADP8860 is not set +# CONFIG_BACKLIGHT_ADP8870 is not set +# CONFIG_BACKLIGHT_LM3639 is not set +CONFIG_BACKLIGHT_GPIO=y +# CONFIG_BACKLIGHT_LV5207LP is not set +# CONFIG_BACKLIGHT_BD6107 is not set +# CONFIG_VGASTATE is not set + +# +# Console display driver support +# +CONFIG_DUMMY_CONSOLE=y +CONFIG_FRAMEBUFFER_CONSOLE=y +# CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set +# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set +# CONFIG_LOGO is not set +CONFIG_SOUND=y +# CONFIG_SOUND_OSS_CORE is not set +CONFIG_SND=m +CONFIG_SND_TIMER=m +CONFIG_SND_PCM=m +CONFIG_SND_DMAENGINE_PCM=m +CONFIG_SND_HWDEP=m +CONFIG_SND_RAWMIDI=m +CONFIG_SND_JACK=y +CONFIG_SND_JACK_INPUT_DEV=y +# CONFIG_SND_SEQUENCER is not set +# CONFIG_SND_MIXER_OSS is not set +# CONFIG_SND_PCM_OSS is not set +CONFIG_SND_PCM_TIMER=y +CONFIG_SND_HRTIMER=m +CONFIG_SND_DYNAMIC_MINORS=y +CONFIG_SND_MAX_CARDS=32 +# CONFIG_SND_SUPPORT_OLD_API is not set +CONFIG_SND_PROC_FS=y +CONFIG_SND_VERBOSE_PROCFS=y +# CONFIG_SND_VERBOSE_PRINTK is not set +# CONFIG_SND_DEBUG is not set +CONFIG_SND_VMASTER=y +# CONFIG_SND_RAWMIDI_SEQ is not set +# CONFIG_SND_OPL3_LIB_SEQ is not set +# CONFIG_SND_OPL4_LIB_SEQ is not set +# CONFIG_SND_SBAWE_SEQ is not set +# CONFIG_SND_EMU10K1_SEQ is not set +CONFIG_SND_AC97_CODEC=m +# CONFIG_SND_DRIVERS is not set + +# +# HD-Audio +# +CONFIG_SND_HDA_PREALLOC_SIZE=2048 +CONFIG_SND_ARM=y +# CONFIG_SND_ARMAACI is not set +CONFIG_SND_BCM2835=m +CONFIG_SND_SPI=y +CONFIG_SND_USB=y +CONFIG_SND_USB_AUDIO=m +CONFIG_SND_USB_UA101=m +CONFIG_SND_USB_CAIAQ=m +CONFIG_SND_USB_CAIAQ_INPUT=y +CONFIG_SND_USB_6FIRE=m +CONFIG_SND_USB_HIFACE=m +CONFIG_SND_BCD2000=m +CONFIG_SND_USB_LINE6=m +CONFIG_SND_USB_POD=m +CONFIG_SND_USB_PODHD=m +CONFIG_SND_USB_TONEPORT=m +CONFIG_SND_USB_VARIAX=m +CONFIG_SND_SOC=m +CONFIG_SND_SOC_GENERIC_DMAENGINE_PCM=y +# CONFIG_SND_SOC_AMD_ACP is not set +# CONFIG_SND_ATMEL_SOC is not set +CONFIG_SND_BCM2835_SOC_I2S=m +CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC=m +CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS=m +CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI=m +CONFIG_SND_BCM2708_SOC_HIFIBERRY_AMP=m +CONFIG_SND_BCM2708_SOC_RPI_DAC=m +CONFIG_SND_BCM2708_SOC_RPI_PROTO=m +CONFIG_SND_BCM2708_SOC_BOOMBERRY_DAC=m +CONFIG_SND_BCM2708_SOC_BOOMBERRY_DIGI=m +CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC=m +CONFIG_SND_BCM2708_SOC_RASPIDAC3=m +# CONFIG_SND_DESIGNWARE_I2S is not set + +# +# SoC Audio for Freescale CPUs +# + +# +# Common SoC Audio options for Freescale CPUs: +# +# CONFIG_SND_SOC_FSL_ASRC is not set +# CONFIG_SND_SOC_FSL_SAI is not set +# CONFIG_SND_SOC_FSL_SSI is not set +# CONFIG_SND_SOC_FSL_SPDIF is not set +# CONFIG_SND_SOC_FSL_ESAI is not set +# CONFIG_SND_SOC_IMX_AUDMUX is not set +# CONFIG_SND_SOC_IMG is not set + +# +# Allwinner SoC Audio support +# +# CONFIG_SND_SUN4I_CODEC is not set +# CONFIG_SND_SUN4I_SPDIF is not set +# CONFIG_SND_SOC_XTFPGA_I2S is not set +CONFIG_SND_SOC_I2C_AND_SPI=m + +# +# CODEC drivers +# +# CONFIG_SND_SOC_AC97_CODEC is not set +# CONFIG_SND_SOC_ADAU1701 is not set +# CONFIG_SND_SOC_AK4104 is not set +# CONFIG_SND_SOC_AK4554 is not set +# CONFIG_SND_SOC_AK4613 is not set +# CONFIG_SND_SOC_AK4642 is not set +# CONFIG_SND_SOC_AK5386 is not set +# CONFIG_SND_SOC_ALC5623 is not set +# CONFIG_SND_SOC_CS35L32 is not set +# CONFIG_SND_SOC_CS42L51_I2C is not set +# CONFIG_SND_SOC_CS42L52 is not set +# CONFIG_SND_SOC_CS42L56 is not set +# CONFIG_SND_SOC_CS42L73 is not set +# CONFIG_SND_SOC_CS4265 is not set +# CONFIG_SND_SOC_CS4270 is not set +# CONFIG_SND_SOC_CS4271_I2C is not set +# CONFIG_SND_SOC_CS4271_SPI is not set +# CONFIG_SND_SOC_CS42XX8_I2C is not set +# CONFIG_SND_SOC_CS4349 is not set +# CONFIG_SND_SOC_ES8328 is not set +# CONFIG_SND_SOC_GTM601 is not set +# CONFIG_SND_SOC_INNO_RK3036 is not set +# CONFIG_SND_SOC_PCM1681 is not set +# CONFIG_SND_SOC_PCM179X_I2C is not set +# CONFIG_SND_SOC_PCM179X_SPI is not set +# CONFIG_SND_SOC_PCM3168A_I2C is not set +# CONFIG_SND_SOC_PCM3168A_SPI is not set +CONFIG_SND_SOC_PCM512x=m +CONFIG_SND_SOC_PCM512x_I2C=m +# CONFIG_SND_SOC_PCM512x_SPI is not set +# CONFIG_SND_SOC_RT5616 is not set +CONFIG_SND_SOC_PCM1794A=m +CONFIG_SND_SOC_PCM5102A=m +# CONFIG_SND_SOC_RT5631 is not set +# CONFIG_SND_SOC_RT5677_SPI is not set +# CONFIG_SND_SOC_SGTL5000 is not set +# CONFIG_SND_SOC_SIRF_AUDIO_CODEC is not set +# CONFIG_SND_SOC_SPDIF is not set +# CONFIG_SND_SOC_SSM2602_SPI is not set +# CONFIG_SND_SOC_SSM2602_I2C is not set +# CONFIG_SND_SOC_SSM4567 is not set +CONFIG_SND_SOC_STA32X=m +# CONFIG_SND_SOC_STA350 is not set +# CONFIG_SND_SOC_STI_SAS is not set +# CONFIG_SND_SOC_TAS2552 is not set +# CONFIG_SND_SOC_TAS5086 is not set +# CONFIG_SND_SOC_TAS571X is not set +# CONFIG_SND_SOC_TFA9879 is not set +CONFIG_SND_SOC_TAS5713=m +# CONFIG_SND_SOC_TLV320AIC23_I2C is not set +# CONFIG_SND_SOC_TLV320AIC23_SPI is not set +# CONFIG_SND_SOC_TLV320AIC31XX is not set +# CONFIG_SND_SOC_TLV320AIC3X is not set +# CONFIG_SND_SOC_TS3A227E is not set +# CONFIG_SND_SOC_WM8510 is not set +# CONFIG_SND_SOC_WM8523 is not set +# CONFIG_SND_SOC_WM8580 is not set +# CONFIG_SND_SOC_WM8711 is not set +# CONFIG_SND_SOC_WM8728 is not set +CONFIG_SND_SOC_WM8731=m +# CONFIG_SND_SOC_WM8737 is not set +# CONFIG_SND_SOC_WM8741 is not set +# CONFIG_SND_SOC_WM8750 is not set +# CONFIG_SND_SOC_WM8753 is not set +# CONFIG_SND_SOC_WM8770 is not set +# CONFIG_SND_SOC_WM8776 is not set +CONFIG_SND_SOC_WM8804=m +CONFIG_SND_SOC_WM8804_I2C=m +# CONFIG_SND_SOC_WM8804_SPI is not set +# CONFIG_SND_SOC_WM8903 is not set +# CONFIG_SND_SOC_WM8962 is not set +# CONFIG_SND_SOC_WM8974 is not set +# CONFIG_SND_SOC_WM8978 is not set +CONFIG_SND_SOC_TPA6130A2=m +# CONFIG_SND_SIMPLE_CARD is not set +# CONFIG_SOUND_PRIME is not set +CONFIG_AC97_BUS=m + +# +# HID support +# +CONFIG_HID=y +# CONFIG_HID_BATTERY_STRENGTH is not set +CONFIG_HIDRAW=y +CONFIG_UHID=y +CONFIG_HID_GENERIC=y + +# +# Special HID drivers +# +CONFIG_HID_A4TECH=y +# CONFIG_HID_ACRUX is not set +CONFIG_HID_APPLE=y +# CONFIG_HID_APPLEIR is not set +CONFIG_HID_AUREAL=y +CONFIG_HID_BELKIN=y +# CONFIG_HID_BETOP_FF is not set +CONFIG_HID_CHERRY=y +CONFIG_HID_CHICONY=y +# CONFIG_HID_CORSAIR is not set +# CONFIG_HID_PRODIKEYS is not set +# CONFIG_HID_CMEDIA is not set +# CONFIG_HID_CP2112 is not set +CONFIG_HID_CYPRESS=y +CONFIG_HID_DRAGONRISE=m +CONFIG_DRAGONRISE_FF=y +# CONFIG_HID_EMS_FF is not set +# CONFIG_HID_ELECOM is not set +# CONFIG_HID_ELO is not set +CONFIG_HID_EZKEY=y +# CONFIG_HID_GEMBIRD is not set +# CONFIG_HID_GFRM is not set +# CONFIG_HID_HOLTEK is not set +# CONFIG_HID_GT683R is not set +# CONFIG_HID_KEYTOUCH is not set +CONFIG_HID_KYE=y +# CONFIG_HID_UCLOGIC is not set +# CONFIG_HID_WALTOP is not set +CONFIG_HID_GYRATION=y +# CONFIG_HID_ICADE is not set +CONFIG_HID_TWINHAN=y +CONFIG_HID_KENSINGTON=y +CONFIG_HID_LCPOWER=y +CONFIG_HID_LENOVO=y +CONFIG_HID_LOGITECH=y +CONFIG_HID_LOGITECH_DJ=y +CONFIG_HID_LOGITECH_HIDPP=y +CONFIG_LOGITECH_FF=y +CONFIG_LOGIRUMBLEPAD2_FF=y +CONFIG_LOGIG940_FF=y +CONFIG_LOGIWHEELS_FF=y +# CONFIG_HID_MAGICMOUSE is not set +CONFIG_HID_MICROSOFT=y +CONFIG_HID_MONTEREY=y +# CONFIG_HID_MULTITOUCH is not set +# CONFIG_HID_NTRIG is not set +CONFIG_HID_ORTEK=y +CONFIG_HID_OUYA=y +CONFIG_HID_PANTHERLORD=y +CONFIG_PANTHERLORD_FF=y +CONFIG_HID_PENMOUNT=y +CONFIG_HID_PETALYNX=y +# CONFIG_HID_PICOLCD is not set +# CONFIG_HID_PLANTRONICS is not set +# CONFIG_HID_PRIMAX is not set +# CONFIG_HID_ROCCAT is not set +# CONFIG_HID_SAITEK is not set +CONFIG_HID_SAMSUNG=y +CONFIG_HID_SONY=y +CONFIG_SONY_FF=y +# CONFIG_HID_SPEEDLINK is not set +# CONFIG_HID_STEELSERIES is not set +CONFIG_HID_SPINELPLUS=y +CONFIG_HID_SUNPLUS=y +CONFIG_HID_RMI=y +# CONFIG_HID_GREENASIA is not set +CONFIG_HID_SMARTJOYPLUS=m +CONFIG_SMARTJOYPLUS_FF=y +CONFIG_HID_TIVO=y +CONFIG_HID_TOPSEED=y +# CONFIG_HID_THINGM is not set +# CONFIG_HID_THRUSTMASTER is not set +# CONFIG_HID_WACOM is not set +CONFIG_HID_WIIMOTE=m +CONFIG_HID_XINMO=y +# CONFIG_HID_ZEROPLUS is not set +CONFIG_HID_ZYDACRON=y +# CONFIG_HID_SENSOR_HUB is not set + +# +# USB HID support +# +CONFIG_USB_HID=y +# CONFIG_HID_PID is not set +CONFIG_USB_HIDDEV=y + +# +# I2C HID support +# +# CONFIG_I2C_HID is not set +CONFIG_USB_OHCI_LITTLE_ENDIAN=y +CONFIG_USB_SUPPORT=y +CONFIG_USB_COMMON=y +CONFIG_USB_ARCH_HAS_HCD=y +CONFIG_USB=y +CONFIG_USB_ANNOUNCE_NEW_DEVICES=y + +# +# Miscellaneous USB options +# +CONFIG_USB_DEFAULT_PERSIST=y +# CONFIG_USB_DYNAMIC_MINORS is not set +# CONFIG_USB_OTG_WHITELIST is not set +# CONFIG_USB_OTG_BLACKLIST_HUB is not set +# CONFIG_USB_ULPI_BUS is not set +CONFIG_USB_MON=m +# CONFIG_USB_WUSB_CBAF is not set + +# +# USB Host Controller Drivers +# +# CONFIG_USB_C67X00_HCD is not set +# CONFIG_USB_XHCI_HCD is not set +# CONFIG_USB_EHCI_HCD is not set +# CONFIG_USB_OXU210HP_HCD is not set +# CONFIG_USB_ISP116X_HCD is not set +# CONFIG_USB_ISP1362_HCD is not set +# CONFIG_USB_FOTG210_HCD is not set +# CONFIG_USB_MAX3421_HCD is not set +# CONFIG_USB_OHCI_HCD is not set +# CONFIG_USB_SL811_HCD is not set +# CONFIG_USB_R8A66597_HCD is not set +CONFIG_USB_DWCOTG=y +# CONFIG_USB_HCD_BCMA is not set +# CONFIG_USB_HCD_SSB is not set +# CONFIG_USB_HCD_TEST_MODE is not set + +# +# USB Device Class drivers +# +CONFIG_USB_ACM=m +# CONFIG_USB_PRINTER is not set +# CONFIG_USB_WDM is not set +# CONFIG_USB_TMC is not set + +# +# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may +# + +# +# also be needed; see USB_STORAGE Help for more info +# +CONFIG_USB_STORAGE=y +# CONFIG_USB_STORAGE_DEBUG is not set +# CONFIG_USB_STORAGE_REALTEK is not set +# CONFIG_USB_STORAGE_DATAFAB is not set +# CONFIG_USB_STORAGE_FREECOM is not set +# CONFIG_USB_STORAGE_ISD200 is not set +# CONFIG_USB_STORAGE_USBAT is not set +# CONFIG_USB_STORAGE_SDDR09 is not set +# CONFIG_USB_STORAGE_SDDR55 is not set +# CONFIG_USB_STORAGE_JUMPSHOT is not set +# CONFIG_USB_STORAGE_ALAUDA is not set +# CONFIG_USB_STORAGE_ONETOUCH is not set +# CONFIG_USB_STORAGE_KARMA is not set +# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set +# CONFIG_USB_STORAGE_ENE_UB6250 is not set +CONFIG_USB_UAS=y + +# +# USB Imaging devices +# +# CONFIG_USB_MDC800 is not set +# CONFIG_USB_MICROTEK is not set +# CONFIG_USBIP_CORE is not set +# CONFIG_USB_MUSB_HDRC is not set +# CONFIG_USB_DWC3 is not set +# CONFIG_USB_DWC2 is not set +# CONFIG_USB_ISP1760 is not set + +# +# USB port drivers +# +CONFIG_USB_SERIAL=m +CONFIG_USB_SERIAL_GENERIC=y +# CONFIG_USB_SERIAL_SIMPLE is not set +# CONFIG_USB_SERIAL_AIRCABLE is not set +# CONFIG_USB_SERIAL_ARK3116 is not set +# CONFIG_USB_SERIAL_BELKIN is not set +CONFIG_USB_SERIAL_CH341=m +# CONFIG_USB_SERIAL_WHITEHEAT is not set +# CONFIG_USB_SERIAL_DIGI_ACCELEPORT is not set +CONFIG_USB_SERIAL_CP210X=m +# CONFIG_USB_SERIAL_CYPRESS_M8 is not set +# CONFIG_USB_SERIAL_EMPEG is not set +CONFIG_USB_SERIAL_FTDI_SIO=m +# CONFIG_USB_SERIAL_VISOR is not set +# CONFIG_USB_SERIAL_IPAQ is not set +# CONFIG_USB_SERIAL_IR is not set +# CONFIG_USB_SERIAL_EDGEPORT is not set +# CONFIG_USB_SERIAL_EDGEPORT_TI is not set +# CONFIG_USB_SERIAL_F81232 is not set +# CONFIG_USB_SERIAL_GARMIN is not set +# CONFIG_USB_SERIAL_IPW is not set +CONFIG_USB_SERIAL_IUU=m +# CONFIG_USB_SERIAL_KEYSPAN_PDA is not set +# CONFIG_USB_SERIAL_KEYSPAN is not set +# CONFIG_USB_SERIAL_KLSI is not set +# CONFIG_USB_SERIAL_KOBIL_SCT is not set +# CONFIG_USB_SERIAL_MCT_U232 is not set +# CONFIG_USB_SERIAL_METRO is not set +# CONFIG_USB_SERIAL_MOS7720 is not set +# CONFIG_USB_SERIAL_MOS7840 is not set +# CONFIG_USB_SERIAL_MXUPORT is not set +# CONFIG_USB_SERIAL_NAVMAN is not set +CONFIG_USB_SERIAL_PL2303=m +# CONFIG_USB_SERIAL_OTI6858 is not set +# CONFIG_USB_SERIAL_QCAUX is not set +# CONFIG_USB_SERIAL_QUALCOMM is not set +# CONFIG_USB_SERIAL_SPCP8X5 is not set +# CONFIG_USB_SERIAL_SAFE is not set +# CONFIG_USB_SERIAL_SIERRAWIRELESS is not set +# CONFIG_USB_SERIAL_SYMBOL is not set +# CONFIG_USB_SERIAL_TI is not set +# CONFIG_USB_SERIAL_CYBERJACK is not set +# CONFIG_USB_SERIAL_XIRCOM is not set +# CONFIG_USB_SERIAL_OPTION is not set +# CONFIG_USB_SERIAL_OMNINET is not set +# CONFIG_USB_SERIAL_OPTICON is not set +# CONFIG_USB_SERIAL_XSENS_MT is not set +# CONFIG_USB_SERIAL_WISHBONE is not set +# CONFIG_USB_SERIAL_SSU100 is not set +# CONFIG_USB_SERIAL_QT2 is not set +# CONFIG_USB_SERIAL_DEBUG is not set + +# +# USB Miscellaneous drivers +# +# CONFIG_USB_EMI62 is not set +# CONFIG_USB_EMI26 is not set +# CONFIG_USB_ADUTUX is not set +# CONFIG_USB_SEVSEG is not set +# CONFIG_USB_RIO500 is not set +# CONFIG_USB_LEGOTOWER is not set +# CONFIG_USB_LCD is not set +# CONFIG_USB_LED is not set +# CONFIG_USB_CYPRESS_CY7C63 is not set +# CONFIG_USB_CYTHERM is not set +# CONFIG_USB_IDMOUSE is not set +# CONFIG_USB_FTDI_ELAN is not set +# CONFIG_USB_APPLEDISPLAY is not set +# CONFIG_USB_LD is not set +# CONFIG_USB_TRANCEVIBRATOR is not set +# CONFIG_USB_IOWARRIOR is not set +# CONFIG_USB_TEST is not set +# CONFIG_USB_EHSET_TEST_FIXTURE is not set +# CONFIG_USB_ISIGHTFW is not set +# CONFIG_USB_YUREX is not set +# CONFIG_USB_EZUSB_FX2 is not set +# CONFIG_USB_HSIC_USB3503 is not set +# CONFIG_USB_LINK_LAYER_TEST is not set +# CONFIG_USB_CHAOSKEY is not set + +# +# USB Physical Layer drivers +# +# CONFIG_USB_PHY is not set +# CONFIG_NOP_USB_XCEIV is not set +# CONFIG_AM335X_PHY_USB is not set +# CONFIG_USB_GPIO_VBUS is not set +# CONFIG_USB_ISP1301 is not set +# CONFIG_USB_ULPI is not set +# CONFIG_USB_GADGET is not set +# CONFIG_USB_LED_TRIG is not set +# CONFIG_UWB is not set +CONFIG_MMC=y +# CONFIG_MMC_DEBUG is not set + +# +# MMC/SD/SDIO Card Drivers +# +CONFIG_MMC_BLOCK=y +CONFIG_MMC_BLOCK_MINORS=32 +CONFIG_MMC_BLOCK_BOUNCE=y +# CONFIG_SDIO_UART is not set +# CONFIG_MMC_TEST is not set + +# +# MMC/SD/SDIO Host Controller Drivers +# +CONFIG_MMC_BCM2835=y +CONFIG_MMC_BCM2835_DMA=y +CONFIG_MMC_BCM2835_PIO_DMA_BARRIER=2 +CONFIG_MMC_BCM2835_SDHOST=y +# CONFIG_MMC_ARMMMCI is not set +CONFIG_MMC_SDHCI=y +CONFIG_MMC_SDHCI_PLTFM=y +# CONFIG_MMC_SDHCI_OF_ARASAN is not set +# CONFIG_MMC_SDHCI_OF_AT91 is not set +# CONFIG_MMC_SDHCI_F_SDH30 is not set +# CONFIG_MMC_SPI is not set +# CONFIG_MMC_DW is not set +# CONFIG_MMC_VUB300 is not set +# CONFIG_MMC_USHC is not set +# CONFIG_MMC_USDHI6ROL0 is not set +CONFIG_MMC_REALTEK_USB=m +# CONFIG_MMC_MTK is not set +# CONFIG_MEMSTICK is not set +CONFIG_NEW_LEDS=y +CONFIG_LEDS_CLASS=y +CONFIG_LEDS_CLASS_FLASH=y + +# +# LED drivers +# +# CONFIG_LEDS_AAT1290 is not set +# CONFIG_LEDS_BCM6328 is not set +# CONFIG_LEDS_BCM6358 is not set +# CONFIG_LEDS_LM3530 is not set +# CONFIG_LEDS_LM3642 is not set +# CONFIG_LEDS_PCA9532 is not set +CONFIG_LEDS_GPIO=y +# CONFIG_LEDS_LP3944 is not set +# CONFIG_LEDS_LP5521 is not set +# CONFIG_LEDS_LP5523 is not set +# CONFIG_LEDS_LP5562 is not set +# CONFIG_LEDS_LP8501 is not set +# CONFIG_LEDS_LP8860 is not set +# CONFIG_LEDS_PCA955X is not set +# CONFIG_LEDS_PCA963X is not set +# CONFIG_LEDS_DAC124S085 is not set +# CONFIG_LEDS_BD2802 is not set +# CONFIG_LEDS_LT3593 is not set +# CONFIG_LEDS_TCA6507 is not set +# CONFIG_LEDS_TLC591XX is not set +# CONFIG_LEDS_LM355x is not set +# CONFIG_LEDS_KTD2692 is not set +# CONFIG_LEDS_IS31FL32XX is not set + +# +# LED driver for blink(1) USB RGB LED is under Special HID drivers (HID_THINGM) +# +# CONFIG_LEDS_BLINKM is not set +# CONFIG_LEDS_SYSCON is not set + +# +# LED Triggers +# +CONFIG_LEDS_TRIGGERS=y +CONFIG_LEDS_TRIGGER_TIMER=y +CONFIG_LEDS_TRIGGER_ONESHOT=y +CONFIG_LEDS_TRIGGER_HEARTBEAT=y +CONFIG_LEDS_TRIGGER_BACKLIGHT=y +CONFIG_LEDS_TRIGGER_CPU=y +CONFIG_LEDS_TRIGGER_GPIO=y +CONFIG_LEDS_TRIGGER_DEFAULT_ON=y + +# +# iptables trigger is under Netfilter config (LED target) +# +CONFIG_LEDS_TRIGGER_TRANSIENT=y +CONFIG_LEDS_TRIGGER_CAMERA=y +CONFIG_LEDS_TRIGGER_INPUT=y +# CONFIG_ACCESSIBILITY is not set +CONFIG_EDAC_ATOMIC_SCRUB=y +CONFIG_EDAC_SUPPORT=y +# CONFIG_EDAC is not set +CONFIG_RTC_LIB=y +CONFIG_RTC_CLASS=y +# CONFIG_RTC_HCTOSYS is not set +CONFIG_RTC_SYSTOHC=y +CONFIG_RTC_SYSTOHC_DEVICE="rtc0" +# CONFIG_RTC_DEBUG is not set + +# +# RTC interfaces +# +CONFIG_RTC_INTF_SYSFS=y +CONFIG_RTC_INTF_PROC=y +CONFIG_RTC_INTF_DEV=y +# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set +# CONFIG_RTC_DRV_TEST is not set + +# +# I2C RTC drivers +# +# CONFIG_RTC_DRV_ABB5ZES3 is not set +# CONFIG_RTC_DRV_ABX80X is not set +CONFIG_RTC_DRV_DS1307=m +CONFIG_RTC_DRV_DS1307_HWMON=y +# CONFIG_RTC_DRV_DS1374 is not set +# CONFIG_RTC_DRV_DS1672 is not set +# CONFIG_RTC_DRV_HYM8563 is not set +# CONFIG_RTC_DRV_MAX6900 is not set +# CONFIG_RTC_DRV_RS5C372 is not set +# CONFIG_RTC_DRV_ISL1208 is not set +# CONFIG_RTC_DRV_ISL12022 is not set +# CONFIG_RTC_DRV_ISL12057 is not set +# CONFIG_RTC_DRV_X1205 is not set +CONFIG_RTC_DRV_PCF8523=m +# CONFIG_RTC_DRV_PCF85063 is not set +CONFIG_RTC_DRV_PCF8563=m +# CONFIG_RTC_DRV_PCF8583 is not set +# CONFIG_RTC_DRV_M41T80 is not set +# CONFIG_RTC_DRV_BQ32K is not set +# CONFIG_RTC_DRV_S35390A is not set +# CONFIG_RTC_DRV_FM3130 is not set +# CONFIG_RTC_DRV_RX8010 is not set +# CONFIG_RTC_DRV_RX8581 is not set +# CONFIG_RTC_DRV_RX8025 is not set +# CONFIG_RTC_DRV_EM3027 is not set +# CONFIG_RTC_DRV_RV3029C2 is not set +# CONFIG_RTC_DRV_RV8803 is not set + +# +# SPI RTC drivers +# +# CONFIG_RTC_DRV_M41T93 is not set +# CONFIG_RTC_DRV_M41T94 is not set +# CONFIG_RTC_DRV_DS1305 is not set +# CONFIG_RTC_DRV_DS1343 is not set +# CONFIG_RTC_DRV_DS1347 is not set +# CONFIG_RTC_DRV_DS1390 is not set +# CONFIG_RTC_DRV_R9701 is not set +# CONFIG_RTC_DRV_RX4581 is not set +# CONFIG_RTC_DRV_RX6110 is not set +# CONFIG_RTC_DRV_RS5C348 is not set +# CONFIG_RTC_DRV_MAX6902 is not set +# CONFIG_RTC_DRV_PCF2123 is not set +# CONFIG_RTC_DRV_MCP795 is not set +CONFIG_RTC_I2C_AND_SPI=y + +# +# SPI and I2C RTC drivers +# +CONFIG_RTC_DRV_DS3232=m +CONFIG_RTC_DRV_PCF2127=m + +# +# Platform RTC drivers +# +# CONFIG_RTC_DRV_CMOS is not set +# CONFIG_RTC_DRV_DS1286 is not set +# CONFIG_RTC_DRV_DS1511 is not set +# CONFIG_RTC_DRV_DS1553 is not set +# CONFIG_RTC_DRV_DS1685_FAMILY is not set +# CONFIG_RTC_DRV_DS1742 is not set +# CONFIG_RTC_DRV_DS2404 is not set +# CONFIG_RTC_DRV_STK17TA8 is not set +# CONFIG_RTC_DRV_M48T86 is not set +# CONFIG_RTC_DRV_M48T35 is not set +# CONFIG_RTC_DRV_M48T59 is not set +# CONFIG_RTC_DRV_MSM6242 is not set +# CONFIG_RTC_DRV_BQ4802 is not set +# CONFIG_RTC_DRV_RP5C01 is not set +# CONFIG_RTC_DRV_V3020 is not set +# CONFIG_RTC_DRV_ZYNQMP is not set + +# +# on-CPU RTC drivers +# +# CONFIG_RTC_DRV_PL030 is not set +# CONFIG_RTC_DRV_PL031 is not set +# CONFIG_RTC_DRV_SNVS is not set + +# +# HID Sensor RTC drivers +# +# CONFIG_RTC_DRV_HID_SENSOR_TIME is not set +CONFIG_DMADEVICES=y +# CONFIG_DMADEVICES_DEBUG is not set + +# +# DMA Devices +# +CONFIG_DMA_ENGINE=y +CONFIG_DMA_VIRTUAL_CHANNELS=y +CONFIG_DMA_OF=y +# CONFIG_AMBA_PL08X is not set +CONFIG_DMA_BCM2835=y +# CONFIG_FSL_EDMA is not set +# CONFIG_INTEL_IDMA64 is not set +# CONFIG_NBPFAXI_DMA is not set +# CONFIG_PL330_DMA is not set +CONFIG_DMA_BCM2708=y +# CONFIG_QCOM_HIDMA_MGMT is not set +# CONFIG_QCOM_HIDMA is not set +# CONFIG_DW_DMAC is not set + +# +# DMA Clients +# +# CONFIG_ASYNC_TX_DMA is not set +# CONFIG_DMATEST is not set +# CONFIG_AUXDISPLAY is not set +# CONFIG_UIO is not set +# CONFIG_VIRT_DRIVERS is not set + +# +# Virtio drivers +# +# CONFIG_VIRTIO_MMIO is not set + +# +# Microsoft Hyper-V guest support +# +CONFIG_STAGING=y +# CONFIG_PRISM2_USB is not set +# CONFIG_COMEDI is not set +# CONFIG_RTLLIB is not set +CONFIG_R8712U=m +# CONFIG_R8188EU is not set +CONFIG_VT6656=m + +# +# Speakup console speech +# +# CONFIG_SPEAKUP is not set +CONFIG_STAGING_MEDIA=y +CONFIG_DVB_MN88472=m +CONFIG_LIRC_STAGING=y +# CONFIG_LIRC_IMON is not set +CONFIG_LIRC_RPI=m +# CONFIG_LIRC_SASEM is not set +# CONFIG_LIRC_SERIAL is not set +# CONFIG_LIRC_SIR is not set +# CONFIG_LIRC_XBOX is not set +# CONFIG_LIRC_ZILOG is not set + +# +# Android +# +# CONFIG_STAGING_BOARD is not set +# CONFIG_LTE_GDM724X is not set +# CONFIG_LNET is not set +# CONFIG_GS_FPGABOOT is not set +# CONFIG_COMMON_CLK_XLNX_CLKWZRD is not set +# CONFIG_FB_TFT is not set +# CONFIG_WILC1000_SDIO is not set +# CONFIG_WILC1000_SPI is not set +# CONFIG_MOST is not set +# CONFIG_GOLDFISH is not set +# CONFIG_CHROME_PLATFORMS is not set +CONFIG_CLKDEV_LOOKUP=y +CONFIG_HAVE_CLK_PREPARE=y +CONFIG_COMMON_CLK=y + +# +# Common Clock Framework +# +# CONFIG_COMMON_CLK_SI5351 is not set +# CONFIG_COMMON_CLK_SI514 is not set +# CONFIG_COMMON_CLK_SI570 is not set +# CONFIG_COMMON_CLK_CDCE706 is not set +# CONFIG_COMMON_CLK_CDCE925 is not set +# CONFIG_COMMON_CLK_CS2000_CP is not set +# CONFIG_CLK_QORIQ is not set +# CONFIG_COMMON_CLK_NXP is not set +# CONFIG_COMMON_CLK_PXA is not set + +# +# Hardware Spinlock drivers +# + +# +# Clock Source drivers +# +CONFIG_CLKSRC_OF=y +CONFIG_CLKSRC_PROBE=y +CONFIG_ARM_ARCH_TIMER=y +CONFIG_ARM_ARCH_TIMER_EVTSTREAM=y +# CONFIG_ARM_TIMER_SP804 is not set +# CONFIG_ATMEL_PIT is not set +# CONFIG_SH_TIMER_CMT is not set +# CONFIG_SH_TIMER_MTU2 is not set +# CONFIG_SH_TIMER_TMU is not set +# CONFIG_EM_TIMER_STI is not set +CONFIG_MAILBOX=y +# CONFIG_ARM_MHU is not set +# CONFIG_PL320_MBOX is not set +# CONFIG_ALTERA_MBOX is not set +CONFIG_BCM2835_MBOX=y +# CONFIG_MAILBOX_TEST is not set +# CONFIG_IOMMU_SUPPORT is not set + +# +# Remoteproc drivers +# +# CONFIG_STE_MODEM_RPROC is not set + +# +# Rpmsg drivers +# + +# +# SOC (System On Chip) specific Drivers +# +# CONFIG_SOC_BRCMSTB is not set +# CONFIG_SUNXI_SRAM is not set +# CONFIG_SOC_TI is not set +# CONFIG_PM_DEVFREQ is not set +CONFIG_EXTCON=m + +# +# Extcon Device Drivers +# +CONFIG_EXTCON_ARIZONA=m +# CONFIG_EXTCON_GPIO is not set +# CONFIG_EXTCON_MAX3355 is not set +# CONFIG_EXTCON_RT8973A is not set +# CONFIG_EXTCON_SM5502 is not set +# CONFIG_EXTCON_USB_GPIO is not set +# CONFIG_MEMORY is not set +# CONFIG_IIO is not set +# CONFIG_PWM is not set +CONFIG_IRQCHIP=y +CONFIG_ARM_GIC_MAX_NR=1 +# CONFIG_IPACK_BUS is not set +# CONFIG_RESET_CONTROLLER is not set +# CONFIG_FMC is not set + +# +# PHY Subsystem +# +# CONFIG_GENERIC_PHY is not set +# CONFIG_PHY_PXA_28NM_HSIC is not set +# CONFIG_PHY_PXA_28NM_USB2 is not set +# CONFIG_BCM_KONA_USB2_PHY is not set +# CONFIG_POWERCAP is not set +# CONFIG_MCB is not set + +# +# Performance monitor support +# +# CONFIG_RAS is not set + +# +# Android +# +# CONFIG_ANDROID is not set +# CONFIG_NVMEM is not set +# CONFIG_STM is not set +# CONFIG_INTEL_TH is not set + +# +# FPGA Configuration Support +# +# CONFIG_FPGA is not set + +# +# Firmware Drivers +# +# CONFIG_FIRMWARE_MEMMAP is not set +CONFIG_RASPBERRYPI_FIRMWARE=y +# CONFIG_FW_CFG_SYSFS is not set +CONFIG_HAVE_ARM_SMCCC=y + +# +# File systems +# +CONFIG_DCACHE_WORD_ACCESS=y +# CONFIG_EXT2_FS is not set +# CONFIG_EXT3_FS is not set +CONFIG_EXT4_FS=y +CONFIG_EXT4_USE_FOR_EXT2=y +CONFIG_EXT4_FS_POSIX_ACL=y +CONFIG_EXT4_FS_SECURITY=y +# CONFIG_EXT4_ENCRYPTION is not set +# CONFIG_EXT4_DEBUG is not set +CONFIG_JBD2=y +# CONFIG_JBD2_DEBUG is not set +CONFIG_FS_MBCACHE=y +CONFIG_REISERFS_FS=m +# CONFIG_REISERFS_CHECK is not set +# CONFIG_REISERFS_PROC_INFO is not set +# CONFIG_REISERFS_FS_XATTR is not set +CONFIG_JFS_FS=m +# CONFIG_JFS_POSIX_ACL is not set +# CONFIG_JFS_SECURITY is not set +# CONFIG_JFS_DEBUG is not set +# CONFIG_JFS_STATISTICS is not set +CONFIG_XFS_FS=m +# CONFIG_XFS_QUOTA is not set +# CONFIG_XFS_POSIX_ACL is not set +# CONFIG_XFS_RT is not set +# CONFIG_XFS_WARN is not set +# CONFIG_XFS_DEBUG is not set +# CONFIG_GFS2_FS is not set +# CONFIG_OCFS2_FS is not set +CONFIG_BTRFS_FS=m +# CONFIG_BTRFS_FS_POSIX_ACL is not set +# CONFIG_BTRFS_FS_CHECK_INTEGRITY is not set +# CONFIG_BTRFS_FS_RUN_SANITY_TESTS is not set +# CONFIG_BTRFS_DEBUG is not set +# CONFIG_BTRFS_ASSERT is not set +# CONFIG_NILFS2_FS is not set +CONFIG_F2FS_FS=y +CONFIG_F2FS_STAT_FS=y +# CONFIG_F2FS_FS_XATTR is not set +CONFIG_F2FS_CHECK_FS=y +CONFIG_FS_POSIX_ACL=y +CONFIG_EXPORTFS=y +CONFIG_FILE_LOCKING=y +CONFIG_MANDATORY_FILE_LOCKING=y +# CONFIG_FS_ENCRYPTION is not set +CONFIG_FSNOTIFY=y +CONFIG_DNOTIFY=y +CONFIG_INOTIFY_USER=y +CONFIG_FANOTIFY=y +# CONFIG_QUOTA is not set +# CONFIG_QUOTACTL is not set +CONFIG_AUTOFS4_FS=y +CONFIG_FUSE_FS=m +# CONFIG_CUSE is not set +CONFIG_OVERLAY_FS=m + +# +# Caches +# +# CONFIG_FSCACHE is not set + +# +# CD-ROM/DVD Filesystems +# +CONFIG_ISO9660_FS=y +CONFIG_JOLIET=y +CONFIG_ZISOFS=y +CONFIG_UDF_FS=y +CONFIG_UDF_NLS=y + +# +# DOS/FAT/NT Filesystems +# +CONFIG_FAT_FS=y +# CONFIG_MSDOS_FS is not set +CONFIG_VFAT_FS=y +CONFIG_FAT_DEFAULT_CODEPAGE=437 +CONFIG_FAT_DEFAULT_IOCHARSET="ascii" +# CONFIG_FAT_DEFAULT_UTF8 is not set +# CONFIG_NTFS_FS is not set + +# +# Pseudo filesystems +# +CONFIG_PROC_FS=y +CONFIG_PROC_SYSCTL=y +CONFIG_PROC_PAGE_MONITOR=y +# CONFIG_PROC_CHILDREN is not set +CONFIG_KERNFS=y +CONFIG_SYSFS=y +CONFIG_TMPFS=y +CONFIG_TMPFS_POSIX_ACL=y +CONFIG_TMPFS_XATTR=y +# CONFIG_HUGETLB_PAGE is not set +CONFIG_CONFIGFS_FS=y +CONFIG_MISC_FILESYSTEMS=y +# CONFIG_ORANGEFS_FS is not set +# CONFIG_ADFS_FS is not set +# CONFIG_AFFS_FS is not set +# CONFIG_ECRYPT_FS is not set +CONFIG_HFS_FS=y +CONFIG_HFSPLUS_FS=y +# CONFIG_HFSPLUS_FS_POSIX_ACL is not set +# CONFIG_BEFS_FS is not set +# CONFIG_BFS_FS is not set +# CONFIG_EFS_FS is not set +# CONFIG_LOGFS is not set +# CONFIG_CRAMFS is not set +CONFIG_SQUASHFS=y +# CONFIG_SQUASHFS_FILE_CACHE is not set +CONFIG_SQUASHFS_FILE_DIRECT=y +# CONFIG_SQUASHFS_DECOMP_SINGLE is not set +# CONFIG_SQUASHFS_DECOMP_MULTI is not set +CONFIG_SQUASHFS_DECOMP_MULTI_PERCPU=y +# CONFIG_SQUASHFS_XATTR is not set +CONFIG_SQUASHFS_ZLIB=y +CONFIG_SQUASHFS_LZ4=y +CONFIG_SQUASHFS_LZO=y +CONFIG_SQUASHFS_XZ=y +# CONFIG_SQUASHFS_4K_DEVBLK_SIZE is not set +# CONFIG_SQUASHFS_EMBEDDED is not set +CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE=3 +# CONFIG_VXFS_FS is not set +# CONFIG_MINIX_FS is not set +# CONFIG_OMFS_FS is not set +# CONFIG_HPFS_FS is not set +# CONFIG_QNX4FS_FS is not set +# CONFIG_QNX6FS_FS is not set +# CONFIG_ROMFS_FS is not set +# CONFIG_PSTORE is not set +# CONFIG_SYSV_FS is not set +# CONFIG_UFS_FS is not set +CONFIG_NETWORK_FILESYSTEMS=y +CONFIG_NFS_FS=y +CONFIG_NFS_V2=y +CONFIG_NFS_V3=y +# CONFIG_NFS_V3_ACL is not set +CONFIG_NFS_V4=y +CONFIG_NFS_SWAP=y +CONFIG_NFS_V4_1=y +CONFIG_NFS_V4_2=y +CONFIG_PNFS_FILE_LAYOUT=y +CONFIG_PNFS_FLEXFILE_LAYOUT=m +CONFIG_NFS_V4_1_IMPLEMENTATION_ID_DOMAIN="kernel.org" +CONFIG_NFS_V4_1_MIGRATION=y +CONFIG_ROOT_NFS=y +# CONFIG_NFS_USE_LEGACY_DNS is not set +CONFIG_NFS_USE_KERNEL_DNS=y +# CONFIG_NFSD is not set +CONFIG_GRACE_PERIOD=y +CONFIG_LOCKD=y +CONFIG_LOCKD_V4=y +CONFIG_NFS_COMMON=y +CONFIG_SUNRPC=y +CONFIG_SUNRPC_GSS=y +CONFIG_SUNRPC_BACKCHANNEL=y +CONFIG_SUNRPC_SWAP=y +CONFIG_RPCSEC_GSS_KRB5=m +# CONFIG_SUNRPC_DEBUG is not set +# CONFIG_CEPH_FS is not set +CONFIG_CIFS=y +CONFIG_CIFS_STATS=y +CONFIG_CIFS_STATS2=y +# CONFIG_CIFS_WEAK_PW_HASH is not set +# CONFIG_CIFS_UPCALL is not set +# CONFIG_CIFS_XATTR is not set +# CONFIG_CIFS_DEBUG is not set +# CONFIG_CIFS_DFS_UPCALL is not set +# CONFIG_CIFS_SMB2 is not set +# CONFIG_NCP_FS is not set +# CONFIG_CODA_FS is not set +# CONFIG_AFS_FS is not set +CONFIG_NLS=y +CONFIG_NLS_DEFAULT="utf8" +CONFIG_NLS_CODEPAGE_437=y +# CONFIG_NLS_CODEPAGE_737 is not set +# CONFIG_NLS_CODEPAGE_775 is not set +# CONFIG_NLS_CODEPAGE_850 is not set +# CONFIG_NLS_CODEPAGE_852 is not set +# CONFIG_NLS_CODEPAGE_855 is not set +# CONFIG_NLS_CODEPAGE_857 is not set +# CONFIG_NLS_CODEPAGE_860 is not set +# CONFIG_NLS_CODEPAGE_861 is not set +# CONFIG_NLS_CODEPAGE_862 is not set +# CONFIG_NLS_CODEPAGE_863 is not set +# CONFIG_NLS_CODEPAGE_864 is not set +# CONFIG_NLS_CODEPAGE_865 is not set +# CONFIG_NLS_CODEPAGE_866 is not set +# CONFIG_NLS_CODEPAGE_869 is not set +# CONFIG_NLS_CODEPAGE_936 is not set +# CONFIG_NLS_CODEPAGE_950 is not set +# CONFIG_NLS_CODEPAGE_932 is not set +# CONFIG_NLS_CODEPAGE_949 is not set +# CONFIG_NLS_CODEPAGE_874 is not set +# CONFIG_NLS_ISO8859_8 is not set +# CONFIG_NLS_CODEPAGE_1250 is not set +# CONFIG_NLS_CODEPAGE_1251 is not set +CONFIG_NLS_ASCII=y +CONFIG_NLS_ISO8859_1=y +# CONFIG_NLS_ISO8859_2 is not set +# CONFIG_NLS_ISO8859_3 is not set +# CONFIG_NLS_ISO8859_4 is not set +# CONFIG_NLS_ISO8859_5 is not set +# CONFIG_NLS_ISO8859_6 is not set +# CONFIG_NLS_ISO8859_7 is not set +# CONFIG_NLS_ISO8859_9 is not set +# CONFIG_NLS_ISO8859_13 is not set +# CONFIG_NLS_ISO8859_14 is not set +# CONFIG_NLS_ISO8859_15 is not set +# CONFIG_NLS_KOI8_R is not set +# CONFIG_NLS_KOI8_U is not set +# CONFIG_NLS_MAC_ROMAN is not set +# CONFIG_NLS_MAC_CELTIC is not set +# CONFIG_NLS_MAC_CENTEURO is not set +# CONFIG_NLS_MAC_CROATIAN is not set +# CONFIG_NLS_MAC_CYRILLIC is not set +# CONFIG_NLS_MAC_GAELIC is not set +# CONFIG_NLS_MAC_GREEK is not set +# CONFIG_NLS_MAC_ICELAND is not set +# CONFIG_NLS_MAC_INUIT is not set +# CONFIG_NLS_MAC_ROMANIAN is not set +# CONFIG_NLS_MAC_TURKISH is not set +CONFIG_NLS_UTF8=y +# CONFIG_DLM is not set + +# +# Kernel hacking +# + +# +# printk and dmesg options +# +CONFIG_PRINTK_TIME=y +CONFIG_MESSAGE_LOGLEVEL_DEFAULT=4 +# CONFIG_BOOT_PRINTK_DELAY is not set +# CONFIG_DYNAMIC_DEBUG is not set + +# +# Compile-time checks and compiler options +# +# CONFIG_DEBUG_INFO is not set +CONFIG_ENABLE_WARN_DEPRECATED=y +CONFIG_ENABLE_MUST_CHECK=y +CONFIG_FRAME_WARN=1024 +CONFIG_STRIP_ASM_SYMS=y +# CONFIG_READABLE_ASM is not set +# CONFIG_UNUSED_SYMBOLS is not set +# CONFIG_PAGE_OWNER is not set +CONFIG_DEBUG_FS=y +# CONFIG_HEADERS_CHECK is not set +# CONFIG_DEBUG_SECTION_MISMATCH is not set +CONFIG_SECTION_MISMATCH_WARN_ONLY=y +CONFIG_FRAME_POINTER=y +# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set +CONFIG_MAGIC_SYSRQ=y +CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE=0x1 +CONFIG_DEBUG_KERNEL=y + +# +# Memory Debugging +# +# CONFIG_PAGE_EXTENSION is not set +# CONFIG_DEBUG_PAGEALLOC is not set +# CONFIG_PAGE_POISONING is not set +# CONFIG_DEBUG_OBJECTS is not set +# CONFIG_SLUB_DEBUG_ON is not set +# CONFIG_SLUB_STATS is not set +CONFIG_HAVE_DEBUG_KMEMLEAK=y +# CONFIG_DEBUG_KMEMLEAK is not set +# CONFIG_DEBUG_STACK_USAGE is not set +# CONFIG_DEBUG_VM is not set +# CONFIG_DEBUG_MEMORY_INIT is not set +# CONFIG_DEBUG_PER_CPU_MAPS is not set +# CONFIG_DEBUG_SHIRQ is not set + +# +# Debug Lockups and Hangs +# +CONFIG_LOCKUP_DETECTOR=y +# CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set +CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0 +# CONFIG_DETECT_HUNG_TASK is not set +# CONFIG_WQ_WATCHDOG is not set +# CONFIG_PANIC_ON_OOPS is not set +CONFIG_PANIC_ON_OOPS_VALUE=0 +CONFIG_PANIC_TIMEOUT=0 +# CONFIG_SCHED_DEBUG is not set +# CONFIG_SCHED_INFO is not set +# CONFIG_SCHEDSTATS is not set +# CONFIG_SCHED_STACK_END_CHECK is not set +# CONFIG_DEBUG_TIMEKEEPING is not set +# CONFIG_TIMER_STATS is not set + +# +# Lock Debugging (spinlocks, mutexes, etc...) +# +# CONFIG_DEBUG_RT_MUTEXES is not set +# CONFIG_DEBUG_SPINLOCK is not set +# CONFIG_DEBUG_MUTEXES is not set +# CONFIG_DEBUG_WW_MUTEX_SLOWPATH is not set +# CONFIG_DEBUG_LOCK_ALLOC is not set +# CONFIG_PROVE_LOCKING is not set +# CONFIG_LOCK_STAT is not set +# CONFIG_DEBUG_ATOMIC_SLEEP is not set +# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set +# CONFIG_LOCK_TORTURE_TEST is not set +# CONFIG_STACKTRACE is not set +# CONFIG_DEBUG_KOBJECT is not set +# CONFIG_DEBUG_BUGVERBOSE is not set +# CONFIG_DEBUG_LIST is not set +# CONFIG_DEBUG_PI_LIST is not set +# CONFIG_DEBUG_SG is not set +# CONFIG_DEBUG_NOTIFIERS is not set +# CONFIG_DEBUG_CREDENTIALS is not set + +# +# RCU Debugging +# +# CONFIG_PROVE_RCU is not set +# CONFIG_SPARSE_RCU_POINTER is not set +# CONFIG_TORTURE_TEST is not set +# CONFIG_RCU_TORTURE_TEST is not set +CONFIG_RCU_CPU_STALL_TIMEOUT=21 +# CONFIG_RCU_TRACE is not set +# CONFIG_RCU_EQS_DEBUG is not set +# CONFIG_DEBUG_WQ_FORCE_RR_CPU is not set +# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set +# CONFIG_NOTIFIER_ERROR_INJECTION is not set +# CONFIG_FAULT_INJECTION is not set +# CONFIG_LATENCYTOP is not set +CONFIG_HAVE_FUNCTION_TRACER=y +CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y +CONFIG_HAVE_DYNAMIC_FTRACE=y +CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y +CONFIG_HAVE_SYSCALL_TRACEPOINTS=y +CONFIG_HAVE_C_RECORDMCOUNT=y +CONFIG_TRACING_SUPPORT=y +# CONFIG_FTRACE is not set + +# +# Runtime Testing +# +# CONFIG_LKDTM is not set +# CONFIG_TEST_LIST_SORT is not set +# CONFIG_BACKTRACE_SELF_TEST is not set +# CONFIG_RBTREE_TEST is not set +# CONFIG_INTERVAL_TREE_TEST is not set +# CONFIG_PERCPU_TEST is not set +# CONFIG_ATOMIC64_SELFTEST is not set +# CONFIG_TEST_HEXDUMP is not set +# CONFIG_TEST_STRING_HELPERS is not set +# CONFIG_TEST_KSTRTOX is not set +# CONFIG_TEST_PRINTF is not set +# CONFIG_TEST_BITMAP is not set +# CONFIG_TEST_RHASHTABLE is not set +# CONFIG_DMA_API_DEBUG is not set +# CONFIG_TEST_LKM is not set +# CONFIG_TEST_USER_COPY is not set +# CONFIG_TEST_BPF is not set +# CONFIG_TEST_FIRMWARE is not set +# CONFIG_TEST_UDELAY is not set +# CONFIG_MEMTEST is not set +# CONFIG_TEST_STATIC_KEYS is not set +# CONFIG_SAMPLES is not set +CONFIG_HAVE_ARCH_KGDB=y +# CONFIG_KGDB is not set +# CONFIG_UBSAN is not set +CONFIG_ARCH_HAS_DEVMEM_IS_ALLOWED=y +# CONFIG_STRICT_DEVMEM is not set +# CONFIG_ARM_PTDUMP is not set +# CONFIG_ARM_UNWIND is not set +# CONFIG_DEBUG_USER is not set +# CONFIG_DEBUG_LL is not set +CONFIG_DEBUG_LL_INCLUDE="mach/debug-macro.S" +# CONFIG_DEBUG_UART_8250 is not set +CONFIG_UNCOMPRESS_INCLUDE="mach/uncompress.h" +# CONFIG_PID_IN_CONTEXTIDR is not set +# CONFIG_DEBUG_SET_MODULE_RONX is not set +# CONFIG_CORESIGHT is not set + +# +# Security options +# +CONFIG_KEYS=y +# CONFIG_PERSISTENT_KEYRINGS is not set +# CONFIG_BIG_KEYS is not set +# CONFIG_ENCRYPTED_KEYS is not set +# CONFIG_SECURITY_DMESG_RESTRICT is not set +# CONFIG_SECURITY is not set +# CONFIG_SECURITYFS is not set +CONFIG_DEFAULT_SECURITY_DAC=y +CONFIG_DEFAULT_SECURITY="" +CONFIG_XOR_BLOCKS=m +CONFIG_CRYPTO=y + +# +# Crypto core or helper +# +CONFIG_CRYPTO_ALGAPI=y +CONFIG_CRYPTO_ALGAPI2=y +CONFIG_CRYPTO_AEAD=m +CONFIG_CRYPTO_AEAD2=y +CONFIG_CRYPTO_BLKCIPHER=y +CONFIG_CRYPTO_BLKCIPHER2=y +CONFIG_CRYPTO_HASH=y +CONFIG_CRYPTO_HASH2=y +CONFIG_CRYPTO_RNG=m +CONFIG_CRYPTO_RNG2=y +CONFIG_CRYPTO_RNG_DEFAULT=m +CONFIG_CRYPTO_AKCIPHER2=y +# CONFIG_CRYPTO_RSA is not set +CONFIG_CRYPTO_MANAGER=y +CONFIG_CRYPTO_MANAGER2=y +# CONFIG_CRYPTO_USER is not set +CONFIG_CRYPTO_MANAGER_DISABLE_TESTS=y +CONFIG_CRYPTO_GF128MUL=m +CONFIG_CRYPTO_NULL=m +CONFIG_CRYPTO_NULL2=y +# CONFIG_CRYPTO_PCRYPT is not set +CONFIG_CRYPTO_WORKQUEUE=y +# CONFIG_CRYPTO_CRYPTD is not set +# CONFIG_CRYPTO_MCRYPTD is not set +# CONFIG_CRYPTO_AUTHENC is not set +# CONFIG_CRYPTO_TEST is not set + +# +# Authenticated Encryption with Associated Data +# +CONFIG_CRYPTO_CCM=m +CONFIG_CRYPTO_GCM=m +# CONFIG_CRYPTO_CHACHA20POLY1305 is not set +CONFIG_CRYPTO_SEQIV=m +CONFIG_CRYPTO_ECHAINIV=m + +# +# Block modes +# +CONFIG_CRYPTO_CBC=m +CONFIG_CRYPTO_CTR=m +CONFIG_CRYPTO_CTS=m +CONFIG_CRYPTO_ECB=y +# CONFIG_CRYPTO_LRW is not set +# CONFIG_CRYPTO_PCBC is not set +# CONFIG_CRYPTO_XTS is not set +# CONFIG_CRYPTO_KEYWRAP is not set + +# +# Hash modes +# +CONFIG_CRYPTO_CMAC=y +CONFIG_CRYPTO_HMAC=y +# CONFIG_CRYPTO_XCBC is not set +# CONFIG_CRYPTO_VMAC is not set + +# +# Digest +# +CONFIG_CRYPTO_CRC32C=y +CONFIG_CRYPTO_CRC32=y +# CONFIG_CRYPTO_CRCT10DIF is not set +CONFIG_CRYPTO_GHASH=m +# CONFIG_CRYPTO_POLY1305 is not set +CONFIG_CRYPTO_MD4=y +CONFIG_CRYPTO_MD5=y +# CONFIG_CRYPTO_MICHAEL_MIC is not set +# CONFIG_CRYPTO_RMD128 is not set +# CONFIG_CRYPTO_RMD160 is not set +# CONFIG_CRYPTO_RMD256 is not set +# CONFIG_CRYPTO_RMD320 is not set +CONFIG_CRYPTO_SHA1=m +CONFIG_CRYPTO_SHA256=y +# CONFIG_CRYPTO_SHA512 is not set +# CONFIG_CRYPTO_TGR192 is not set +# CONFIG_CRYPTO_WP512 is not set + +# +# Ciphers +# +CONFIG_CRYPTO_AES=y +# CONFIG_CRYPTO_ANUBIS is not set +CONFIG_CRYPTO_ARC4=y +# CONFIG_CRYPTO_BLOWFISH is not set +# CONFIG_CRYPTO_CAMELLIA is not set +# CONFIG_CRYPTO_CAST5 is not set +# CONFIG_CRYPTO_CAST6 is not set +CONFIG_CRYPTO_DES=y +# CONFIG_CRYPTO_FCRYPT is not set +# CONFIG_CRYPTO_KHAZAD is not set +# CONFIG_CRYPTO_SALSA20 is not set +# CONFIG_CRYPTO_CHACHA20 is not set +# CONFIG_CRYPTO_SEED is not set +# CONFIG_CRYPTO_SERPENT is not set +# CONFIG_CRYPTO_TEA is not set +# CONFIG_CRYPTO_TWOFISH is not set + +# +# Compression +# +# CONFIG_CRYPTO_DEFLATE is not set +CONFIG_CRYPTO_LZO=m +# CONFIG_CRYPTO_842 is not set +# CONFIG_CRYPTO_LZ4 is not set +# CONFIG_CRYPTO_LZ4HC is not set + +# +# Random Number Generation +# +# CONFIG_CRYPTO_ANSI_CPRNG is not set +CONFIG_CRYPTO_DRBG_MENU=m +CONFIG_CRYPTO_DRBG_HMAC=y +# CONFIG_CRYPTO_DRBG_HASH is not set +# CONFIG_CRYPTO_DRBG_CTR is not set +CONFIG_CRYPTO_DRBG=m +CONFIG_CRYPTO_JITTERENTROPY=m +# CONFIG_CRYPTO_USER_API_HASH is not set +# CONFIG_CRYPTO_USER_API_SKCIPHER is not set +# CONFIG_CRYPTO_USER_API_RNG is not set +# CONFIG_CRYPTO_USER_API_AEAD is not set +# CONFIG_CRYPTO_HW is not set +# CONFIG_ASYMMETRIC_KEY_TYPE is not set + +# +# Certificates for signature checking +# +# CONFIG_SYSTEM_TRUSTED_KEYRING is not set +CONFIG_ARM_CRYPTO=y +CONFIG_CRYPTO_SHA1_ARM=m +CONFIG_CRYPTO_SHA256_ARM=m +# CONFIG_CRYPTO_SHA512_ARM is not set +CONFIG_CRYPTO_AES_ARM=m +# CONFIG_BINARY_PRINTF is not set + +# +# Library routines +# +CONFIG_RAID6_PQ=m +CONFIG_BITREVERSE=y +CONFIG_HAVE_ARCH_BITREVERSE=y +CONFIG_RATIONAL=y +CONFIG_GENERIC_STRNCPY_FROM_USER=y +CONFIG_GENERIC_STRNLEN_USER=y +CONFIG_GENERIC_NET_UTILS=y +CONFIG_GENERIC_PCI_IOMAP=y +CONFIG_GENERIC_IO=y +CONFIG_ARCH_USE_CMPXCHG_LOCKREF=y +CONFIG_CRC_CCITT=m +CONFIG_CRC16=y +# CONFIG_CRC_T10DIF is not set +CONFIG_CRC_ITU_T=y +CONFIG_CRC32=y +# CONFIG_CRC32_SELFTEST is not set +CONFIG_CRC32_SLICEBY8=y +# CONFIG_CRC32_SLICEBY4 is not set +# CONFIG_CRC32_SARWATE is not set +# CONFIG_CRC32_BIT is not set +# CONFIG_CRC7 is not set +CONFIG_LIBCRC32C=m +# CONFIG_CRC8 is not set +# CONFIG_AUDIT_ARCH_COMPAT_GENERIC is not set +# CONFIG_RANDOM32_SELFTEST is not set +CONFIG_ZLIB_INFLATE=y +CONFIG_ZLIB_DEFLATE=m +CONFIG_LZO_COMPRESS=y +CONFIG_LZO_DECOMPRESS=y +CONFIG_LZ4_DECOMPRESS=y +CONFIG_XZ_DEC=y +# CONFIG_XZ_DEC_X86 is not set +# CONFIG_XZ_DEC_POWERPC is not set +# CONFIG_XZ_DEC_IA64 is not set +# CONFIG_XZ_DEC_ARM is not set +# CONFIG_XZ_DEC_ARMTHUMB is not set +# CONFIG_XZ_DEC_SPARC is not set +# CONFIG_XZ_DEC_BCJ is not set +# CONFIG_XZ_DEC_TEST is not set +CONFIG_DECOMPRESS_GZIP=y +CONFIG_GENERIC_ALLOCATOR=y +CONFIG_ASSOCIATIVE_ARRAY=y +CONFIG_HAS_IOMEM=y +CONFIG_HAS_IOPORT_MAP=y +CONFIG_HAS_DMA=y +CONFIG_CPU_RMAP=y +CONFIG_DQL=y +CONFIG_NLATTR=y +CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE=y +# CONFIG_CORDIC is not set +# CONFIG_DDR is not set +# CONFIG_IRQ_POLL is not set +CONFIG_LIBFDT=y +CONFIG_OID_REGISTRY=y +CONFIG_FONT_SUPPORT=y +# CONFIG_FONTS is not set +CONFIG_FONT_8x8=y +CONFIG_FONT_8x16=y +# CONFIG_SG_SPLIT is not set +# CONFIG_ARCH_HAS_SG_CHAIN is not set +# CONFIG_VIRTUALIZATION is not set +CONFIG_BCM2835_WS2812=m +CONFIG_SND_BCM2708_SOC_SLICE=m +CONFIG_SND_SOC_CS4265=m diff --git a/projects/Slice2/options b/projects/Slice2/options new file mode 100644 index 00000000000..ccca477e3c1 --- /dev/null +++ b/projects/Slice2/options @@ -0,0 +1,151 @@ +################################################################################ +# setup system defaults +################################################################################ + + # The TARGET_CPU variable controls which processor should be targeted for + # generated code. + case $TARGET_ARCH in + arm) + # TARGET_CPU: + # arm2 arm250 arm3 arm6 arm60 arm600 arm610 arm620 arm7 arm7m arm7d + # arm7dm arm7di arm7dmi arm70 arm700 arm700i arm710 arm710c + # arm7100 arm720 arm7500 arm7500fe arm7tdmi arm7tdmi-s arm710t + # arm720t arm740t strongarm strongarm110 strongarm1100 + # strongarm1110 arm8 arm810 arm9 arm9e arm920 arm920t arm922t + # arm946e-s arm966e-s arm968e-s arm926ej-s arm940t arm9tdmi + # arm10tdmi arm1020t arm1026ej-s arm10e arm1020e arm1022e + # arm1136j-s arm1136jf-s mpcore mpcorenovfp arm1156t2-s + # arm1176jz-s arm1176jzf-s cortex-a8 cortex-a9 cortex-r4 + # cortex-r4f cortex-m3 cortex-m1 xscale iwmmxt iwmmxt2 ep9312. + TARGET_CPU="cortex-a7" + + # TARGET_FLOAT: + # Specifies which floating-point ABI to use. Permissible values are: + # soft softfp hard + TARGET_FLOAT="hard" + + # TARGET_FPU: + # This specifies what floating point hardware (or hardware emulation) is + # available on the target. Permissible names are: + # fpa fpe2 fpe3 maverick vfp vfpv3 vfpv3-fp16 vfpv3-d16 vfpv3-d16-fp16 + # vfpv3xd vfpv3xd-fp16 neon neon-fp16 vfpv4 vfpv4-d16 fpv4-sp-d16 + # neon-vfpv4. + TARGET_FPU="neon-vfpv4" + ;; + esac + + # Bootloader to use (syslinux / u-boot / bcm2835-bootloader) + BOOTLOADER="bcm2835-bootloader" + + # u-boot version to use (default) + UBOOT_VERSION="default" + + # Configuration for u-boot + UBOOT_CONFIG="" + + # Target Configfile for u-boot + UBOOT_CONFIGFILE="" + + # Kernel target + KERNEL_TARGET="zImage" + + # Kernel extra targets to build + KERNEL_UBOOT_EXTRA_TARGET="" + + # Additional kernel make parameters (for example to specify the u-boot loadaddress) + KERNEL_MAKE_EXTRACMD="dtbs" + + # Kernel to use. values can be: + # default: default mainline kernel + LINUX="default" + + # NOOBS supported hex versions (legacy) + NOOBS_HEX="1040,1041,2082" + + # NOOBS supported model versions + NOOBS_SUPPORTED_MODELS='"Pi 2","Pi 3"' + +################################################################################ +# setup build defaults +################################################################################ + + # Build optimizations (size/normal) + OPTIMIZATIONS="size" + + # Project CFLAGS + PROJECT_CFLAGS="" + + # LTO (Link Time Optimization) support + LTO_SUPPORT="yes" + + # GOLD (Google Linker) support + GOLD_SUPPORT="yes" + + # SquashFS compression method (gzip / lzo / xz) + SQUASHFS_COMPRESSION="lzo" + + +################################################################################ +# setup project defaults +################################################################################ + + # build and install ALSA Audio support (yes / no) + ALSA_SUPPORT="yes" + + # OpenGL(X) implementation to use (no / mesa) + OPENGL="no" + + # OpenGL-ES implementation to use (no / bcm2835-driver / gpu-viv-bin-mx6q) + OPENGLES="bcm2835-driver" + + # include uvesafb support (yes / no) + UVESAFB_SUPPORT="no" + + # Displayserver to use (x11 / no) + DISPLAYSERVER="no" + + # Windowmanager to use (ratpoison / fluxbox / none) + WINDOWMANAGER="none" + + # Xorg Graphic drivers to use (all / i915,i965,r200,r300,r600,nvidia) + # Space separated list is supported, + # e.g. GRAPHIC_DRIVERS="i915 i965 r300 r600 radeonsi nvidia" + GRAPHIC_DRIVERS="" + + # KODI Player implementation to use (default / bcm2835-driver / libfslvpuwrap) + KODIPLAYER_DRIVER="bcm2835-driver" + + # Modules to install in initramfs for early boot + INITRAMFS_MODULES="" + + # additional Firmware to use (dvb-firmware, misc-firmware, wlan-firmware) + # Space separated list is supported, + # e.g. FIRMWARE="dvb-firmware misc-firmware wlan-firmware" + FIRMWARE="misc-firmware wlan-firmware dvb-firmware brcmfmac_sdio-firmware-rpi" + + # build and install ATV IR remote support (yes / no) + ATVCLIENT_SUPPORT="no" + + # build and install IRServer IR/LCD support (yes / no) + IRSERVER_SUPPORT="no" + + # build with swap support (yes / no) + SWAP_SUPPORT="yes" + + # swap support enabled per default (yes / no) + SWAP_ENABLED_DEFAULT="no" + + # swapfile size if SWAP_SUPPORT=yes in MB + SWAPFILESIZE="128" + + # build with installer (yes / no) + INSTALLER_SUPPORT="no" + + # kernel image name + KERNEL_NAME="kernel.img" + + # additional drivers to install: + # for a list of additinoal drivers see packages/linux-drivers + # Space separated list is supported, + # e.g. ADDITIONAL_DRIVERS="DRIVER1 DRIVER2" + ADDITIONAL_DRIVERS="$ADDITIONAL_DRIVERS" diff --git a/projects/Slice2/patches/LibreELEC-settings/LibreELEC-settings-01-slice.patch b/projects/Slice2/patches/LibreELEC-settings/LibreELEC-settings-01-slice.patch new file mode 100644 index 00000000000..43a0f6c5ebb --- /dev/null +++ b/projects/Slice2/patches/LibreELEC-settings/LibreELEC-settings-01-slice.patch @@ -0,0 +1,371 @@ +diff -ru build.Slice-Slice.arm-8.0-devel/LibreELEC-settings-c0aa38f/language/English/strings.po projects/Slice/patches/LibreELEC-settings/LibreELEC-settings-01-slice.patch/language/English/strings.po +--- LibreELEC-settings-c0aa38f/language/English/strings.po 2016-05-19 03:12:57.000000000 +0000 ++++ LibreELEC-settings-01-slice.patch/language/English/strings.po 2016-06-14 17:47:52.923107411 +0000 +@@ -112,10 +112,22 @@ + msgid "If you have an small LCD or VFD attached to your @DISTRONAME@ system you must configure the correct display driver" + msgstr "" + ++msgctxt "#718" ++msgid "This specifies the build type you are checking for, stable is the default and preferred" ++msgstr "" ++ ++msgctxt "#719" ++msgid "Execute a script as stored on sprunge.us" ++msgstr "" ++ + msgctxt "#720" + msgid "Set to ON and Bluetooth devices will be disabled during power-saving modes" + msgstr "" + ++msgctxt "#721" ++msgid "Output config.txt, cmdline.txt, shutdown.sh, autostart.sh, kodi.log and kodi.old.log to pastebin and show a link to copy" ++msgstr "" ++ + msgctxt "#722" + msgid "Create a tar archive containing all @DISTRONAME@ and Kodi configuration settings, databases and thumbnail content. Backup files will be stored in /storage/backups" + msgstr "" +@@ -189,7 +201,7 @@ + msgstr "" + + msgctxt "#742" +-msgid "Set to ON to enable the embedded SSH server. The SSH console can be accessed with username 'root' and password '@ROOT_PASSWORD@'." ++msgid "Set to ON to enable the embedded SSH server. The SSH console can be accessed with username 'root' and password 'openelec'." + msgstr "" + + msgctxt "#743" +@@ -268,6 +280,18 @@ + msgid "Automatic Updates" + msgstr "" + ++msgctxt "#32015" ++msgid "Infra red contol" ++msgstr "" ++ ++msgctxt "#32016" ++msgid "Enable Infra Red Sensor" ++msgstr "" ++ ++msgctxt "#32017" ++msgid "Disable here if you're having trouble with an IR remote" ++msgstr "" ++ + msgctxt "#32100" + msgid "Connections" + msgstr "" +@@ -565,7 +589,7 @@ + msgstr "" + + msgctxt "#32312" +-msgid "@DISTRONAME@ also supports SSH for remote access. This is for advanced users who wish to interact with @DISTRONAME@'s underlying operating system. The default user is [COLOR blue]root[/COLOR] and the default password is [COLOR blue]@ROOT_PASSWORD@[/COLOR]." ++msgid "@DISTRONAME@ also supports SSH for remote access. This is for advanced users who wish to interact with @DISTRONAME@'s underlying operating system. The default user is [COLOR blue]root[/COLOR] and the default password is [COLOR blue]openelec[/COLOR]." + msgstr "" + + msgctxt "#32313" +@@ -660,6 +684,10 @@ + msgid "Trust and Connect" + msgstr "" + ++msgctxt "#32361" ++msgid "Update Type" ++msgstr "" ++ + msgctxt "#32362" + msgid "Check for updates now:" + msgstr "" +@@ -712,6 +740,18 @@ + msgid "Backup Progress" + msgstr "" + ++msgctxt "#32376" ++msgid "Debug" ++msgstr "" ++ ++msgctxt "#32377" ++msgid "Paste debug to pastebin" ++msgstr "" ++ ++msgctxt "#32378" ++msgid "Execute script" ++msgstr "" ++ + msgctxt "#32379" + msgid "There is not enough free storage space to continue!" + msgstr "" +diff -ru build.Slice-Slice.arm-8.0-devel/LibreELEC-settings-c0aa38f/src/defaults.py projects/Slice/patches/LibreELEC-settings/LibreELEC-settings-01-slice.patch/src/defaults.py +--- LibreELEC-settings-c0aa38f/src/defaults.py 2016-05-19 03:12:57.000000000 +0000 ++++ LibreELEC-settings-01-slice.patch/src/defaults.py 2016-06-14 17:40:07.547107411 +0000 +@@ -82,8 +82,8 @@ + 'ENABLED': True, + 'KERNEL_CMD': '/proc/cmdline', + 'SET_CLOCK_CMD': '/sbin/hwclock --systohc --utc', +- 'UPDATE_REQUEST_URL': 'http://update.libreelec.tv/updates.php', +- 'UPDATE_DOWNLOAD_URL': 'http://%s.libreelec.tv/%s', ++ 'UPDATE_REQUEST_URL': 'http://updates.fiveninjas.com/updates.php', ++ 'UPDATE_DOWNLOAD_URL': 'http://%s.fiveninjas.com/%s', + 'LOCAL_UPDATE_DIR': '/storage/.update/', + 'GET_CPU_FLAG': "cat /proc/cpuinfo | grep -q 'flags.* lm ' && echo '1' || echo '0'", + 'XBMC_RESET_FILE': '%s/reset_xbmc' % CONFIG_CACHE, +diff -ru build.Slice-Slice.arm-8.0-devel/LibreELEC-settings-c0aa38f/src/resources/lib/modules/system.py projects/Slice/patches/LibreELEC-settings/LibreELEC-settings-01-slice.patch/src/resources/lib/modules/system.py +--- LibreELEC-settings-c0aa38f/src/resources/lib/modules/system.py 2016-05-19 03:12:57.000000000 +0000 ++++ LibreELEC-settings-01-slice.patch/src/resources/lib/modules/system.py 2016-06-14 17:46:40.723107411 +0000 +@@ -132,8 +132,24 @@ + }, + }, + }, +- 'update': { ++ ++ 'lirc': { + 'order': 3, ++ 'name' : 32015, ++ 'settings' : { ++ 'LIRCEnable' : { ++ 'name' : 32016, ++ 'value': '1', ++ 'action': 'set_ir_enable', ++ 'type': 'bool', ++ 'InfoText': 32017, ++ 'order': 1, ++ }, ++ }, ++ }, ++ ++ 'update': { ++ 'order': 4, + 'name': 32013, + 'settings': { + 'AutoUpdate': { +@@ -161,10 +177,19 @@ + 'InfoText': 716, + 'order': 3, + }, +- }, ++ 'UpdateType': { ++ 'name': 32361, ++ 'value': 'stable', ++ 'action': 'set_update_type', ++ 'type': 'multivalue', ++ 'values': ['stable', 'nightly', 'bloody'], ++ 'InfoText': 718, ++ 'order': 4, ++ }, ++ }, + }, + 'backup': { +- 'order': 7, ++ 'order': 5, + 'name': 32371, + 'settings': { + 'backup': { +@@ -185,8 +210,32 @@ + }, + }, + }, ++ ++ 'debug': { ++ 'order': 6, ++ 'name': 32376, ++ 'settings': { ++ 'paste': { ++ 'name': 32377, ++ 'value': '0', ++ 'action': 'do_pastebin', ++ 'type': 'button', ++ 'InfoText': 721, ++ 'order': 1, ++ }, ++ 'execute': { ++ 'name': 32378, ++ 'value': '0', ++ 'action': 'do_execscript', ++ 'type': 'button', ++ 'InfoText': 719, ++ 'order': 1, ++ }, ++ }, ++ }, ++ + 'reset': { +- 'order': 8, ++ 'order': 7, + 'name': 32323, + 'settings': { + 'xbmc_reset': { +@@ -305,6 +354,13 @@ + else: + self.struct['ident']['settings']['hostname']['value'] = self.oe.DISTRIBUTION + ++ # LIRC enable ++ value = self.oe.read_setting('system', 'LIRCEnable') ++ if not value is None: ++ self.struct['lirc']['settings']['LIRCEnable']['value'] = value ++ else: ++ self.struct['lirc']['settings']['LIRCEnable']['value'] = '0' if os.path.exists('/storage/.config/modprobe.d/disable-lirc.conf') else '1' ++ + # AutoUpdate + + value = self.oe.read_setting('system', 'AutoUpdate') +@@ -316,6 +372,12 @@ + if os.path.isfile('%s/SYSTEM' % self.LOCAL_UPDATE_DIR): + self.update_in_progress = True + ++ value = self.oe.read_setting('system', 'UpdateType') ++ if not value is None: ++ self.struct['update']['settings']['UpdateType']['value'] = value ++ else: ++ self.struct['update']['settings']['UpdateType']['value'] = self.get_os_type() ++ + # AutoUpdate = manual by environment var. + + if os.path.exists('/dev/.update_disabled'): +@@ -344,6 +406,50 @@ + except Exception, e: + self.oe.dbg_log('system::set_value', 'ERROR: (' + repr(e) + ')') + ++ def set_update_type(self, listItem=None): ++ try: ++ self.oe.dbg_log('system::set_update_type', 'enter_function ', 0) ++ self.set_value(listItem) ++ updateType = listItem.getProperty('value') ++ xbmcDialog = xbmcgui.Dialog() ++ answer = xbmcDialog.yesno('Slice Update', 'Switching update type to ' + updateType + ' requires a forced update, do you want to update now?') ++ if answer == 1: ++ self.check_updates_v2(True, True) ++ self.oe.dbg_log('system::set_update_type', 'exit_function', 0) ++ except Exception, e: ++ self.oe.dbg_log('system::set_update_type', 'ERROR: (' + repr(e) + ')') ++ ++ def set_ir_enable(self, listItem=None): ++ try: ++ self.oe.dbg_log('system::set_ir_enable', 'enter_function ', 0) ++ self.set_value(listItem) ++ enable = listItem.getProperty('value') == '1' ++ self.oe.dbg_log('system::set_ir_enable', 'enable', 0) ++ if enable and os.path.exists('/storage/.config/modprobe.d/disable-lirc.conf'): ++ self.oe.dbg_log('system::set_ir_enable', 'remove file', 0) ++ os.remove('/storage/.config/modprobe.d/disable-lirc.conf') ++ xbmcDialog = xbmcgui.Dialog() ++ answer = xbmcDialog.yesno('Enable LIRC', 'Needs reboot to enable') ++ if answer == 1 : ++ self.oe.winOeMain.close() ++ time.sleep(1) ++ xbmc.executebuiltin('Reboot') ++ if not enable: ++ self.oe.dbg_log('system::set_ir_enable', 'do command', 0) ++ f = open('/storage/.config/modprobe.d/disable-lirc.conf', 'w') ++ f.write('blacklist lirc_rpi\n') ++ f.close() ++ xbmcDialog = xbmcgui.Dialog() ++ answer = xbmcDialog.yesno('Disable LIRC', 'Needs reboot to disable') ++ if answer == 1: ++ self.oe.winOeMain.close() ++ time.sleep(1) ++ xbmc.executebuiltin('Reboot') ++ self.oe.dbg_log('system::set_ir_enable', 'exit_function', 0) ++ except Exception, e: ++ self.oe.dbg_log('system::set_ir_enable', 'ERROR: (' + repr(e) + ')') ++ ++ + def set_keyboard_layout(self, listItem=None): + try: + self.oe.dbg_log('system::set_keyboard_layout', 'enter_function', 0) +@@ -516,18 +622,29 @@ + except Exception, e: + self.oe.dbg_log('system::get_keyboard_layouts', 'ERROR: (' + repr(e) + ')') + +- def check_updates_v2(self, force=False): ++ def get_os_type(self): ++ typ = 'stable' ++ with open('/storage/installed_os.json') as fd: ++ name = json.load(fd)[0]["name"] ++ typ = name.split('(')[1].split(')')[0] ++ return str(typ) ++ ++ def check_updates_v2(self, force=False, ignore_version=False): + try: + self.oe.dbg_log('system::check_updates_v2', 'enter_function', 0) + if hasattr(self, 'update_in_progress'): + self.oe.dbg_log('system::check_updates_v2', 'Update in progress (exit)', 0) + return +- url = '%s?i=%s&d=%s&pa=%s&v=%s&l=%s' % ( ++ version = self.oe.VERSION ++ if ignore_version: ++ version = 'devel-0-nothing' ++ url = '%s?i=%s&d=%s&pa=%s&v=%s&t=%s&l=%s' % ( + self.UPDATE_REQUEST_URL, + self.oe.SYSTEMID, + self.oe.DISTRIBUTION, + self.oe.ARCHITECTURE, +- self.oe.VERSION, ++ version, ++ self.struct['update']['settings']['UpdateType']['value'], + self.cpu_lm_flag, + ) + self.oe.dbg_log('system::check_updates_v2', 'URL: %s' % url, 0) +@@ -614,7 +731,7 @@ + self.oe.dbg_log('system::reset_oe', 'enter_function', 0) + if self.ask_sure_reset('Hard') == 1: + self.oe.set_busy(1) +- reset_file = open(self.LIBREELEC_RESET_FILE, 'w') ++ reset_file = open(self.XBMC_RESET_FILE, 'w') + reset_file.write('reset') + reset_file.close() + self.oe.winOeMain.close() +@@ -744,6 +861,46 @@ + except Exception, e: + self.oe.dbg_log('system::do_restore', 'ERROR: (' + repr(e) + ')') + ++ def cat_file(self, tmp, filen): ++ self.oe.execute('echo "======== ' + filen + ' ==============" >> ' + tmp) ++ self.oe.execute('cat ' + filen + ' >> ' + tmp) ++ ++ def do_pastebin(self, listItem=None): ++ try: ++ paste_dlg = xbmcgui.DialogProgress() ++ paste_dlg.create('Pasting log files', 'Pasting...', ' ', ' ') ++ self.oe.execute('echo "Paste output" > /storage/.kodi/temp/paste.tmp') ++ self.cat_file('/storage/.kodi/temp/paste.tmp', '/flash/config.txt') ++ self.cat_file('/storage/.kodi/temp/paste.tmp', '/flash/cmdline.txt') ++ self.cat_file('/storage/.kodi/temp/paste.tmp', '/storage/.kodi/temp/kodi.log') ++ self.cat_file('/storage/.kodi/temp/paste.tmp', '/storage/.kodi/temp/kodi.old.log') ++ self.oe.execute('dmesg > /storage/.kodi/temp/dmesg.txt') ++ self.cat_file('/storage/.kodi/temp/paste.tmp', '/storage/.kodi/temp/dmesg.txt') ++ ++ result = self.oe.execute('paste /storage/.kodi/temp/paste.tmp', 1) ++ if not paste_dlg.iscanceled(): ++ paste_dlg.close() ++ link = result.find('http') ++ done_dlg = xbmcgui.Dialog() ++ if link > 0: ++ done_dlg.ok('Debug pasted', 'Log files pasted to ' + result[link:]) ++ self.oe.dbg_log('system::do_pastebin', result[link:]) ++ else: ++ done_dlg.ok('Failed paste', 'Failed to paste log files, try again') ++ except Exception, e: ++ self.oe.dbg_log('system::do_pastebin', 'ERROR: (' + repr(e) + ')') ++ ++ def do_execscript(self, listItem=None): ++ try: ++ editfield = xbmcgui.Dialog() ++ link = editfield.input('Enter link for script', 'http://sprunge.us/') ++ self.oe.dbg_log('link', 'link is ' + link) ++ self.oe.execute('curl ' + link + ' > /storage/.kodi/temp/script.sh') ++ self.oe.execute('chmod +x /storage/.kodi/temp/script.sh') ++ self.oe.execute('/storage/.kodi/temp/script.sh > /storage/.kodi/temp/paste.tmp') ++ except Exception, e: ++ self.oe.dbg_log('system::do_executescript', 'ERROR: (' + repr(e) + ')') ++ + def tar_add_folder(self, tar, folder): + try: + for item in os.listdir(folder): +diff -ru LibreELEC-settings-c0aa38f/Makefile LibreELEC-settings-c0aa38f-new/Makefile +--- LibreELEC-settings-c0aa38f/Makefile 2016-05-19 03:12:57.000000000 +0000 ++++ LibreELEC-settings-c0aa38f-new/Makefile 2016-06-25 11:33:37.811107411 +0000 +@@ -71,7 +71,7 @@ + + $(BUILDDIR)/$(ADDON_NAME)/resources/skins/Default/media/default: + mkdir -p $(BUILDDIR)/$(ADDON_NAME)/resources/skins/Default/media/default +- cp textures/$(DISTRONAME)/*.png $(BUILDDIR)/$(ADDON_NAME)/resources/skins/Default/media/default ++ cp textures/LibreELEC/*.png $(BUILDDIR)/$(ADDON_NAME)/resources/skins/Default/media/default + + $(BUILDDIR)/$(ADDON_NAME)/resources/skins/Default/media/icons: + mkdir -p $(BUILDDIR)/$(ADDON_NAME)/resources/skins/Default/media/icons diff --git a/projects/Slice2/patches/kodi/kodi-003-slice-led.patch b/projects/Slice2/patches/kodi/kodi-003-slice-led.patch new file mode 100644 index 00000000000..21ee3ab3b0e --- /dev/null +++ b/projects/Slice2/patches/kodi/kodi-003-slice-led.patch @@ -0,0 +1,950 @@ +diff -ruN kodi-16.0-beta5-19fc4fa/xbmc/windows/GUIWindowHome.cpp kodi-16.0-beta5-19fc4fa-new/xbmc/windows/GUIWindowHome.cpp +--- kodi-16.0-beta5-19fc4fa/xbmc/windows/GUIWindowHome.cpp 2015-12-14 23:07:12.000000000 +0000 ++++ kodi-16.0-beta5-19fc4fa-new/xbmc/windows/GUIWindowHome.cpp 2016-01-08 06:51:31.177652775 +0000 +@@ -30,9 +30,243 @@ + #include "guilib/GUIWindowManager.h" + #include "Application.h" + #include "utils/StringUtils.h" ++extern "C" ++{ ++ #include "readpng.h" ++} + + using namespace ANNOUNCEMENT; + ++int g_pattern = 0; ++int g_halt = 0; ++int g_pattern_playing = 0; ++int g_speed = 30000; ++int g_repeat = 0; ++ ++enum pattern_e { ++ PAT_PLAY, PAT_PAUSE, PAT_STOP, PAT_SLEEP, PAT_WAKE, PAT_FFWD, PAT_REW, PAT_SKIPF, PAT_SKIPR, PAT_STARTUP, PAT_NONE ++}; ++#define NUM_PATTERNS 10 ++const char *patterns[NUM_PATTERNS] = { ++ "play" , "pause", "stop", "sleep", "wake", "ffwd", "rew", "skipf", "skipr", "startup" ++}; ++ ++void on_speed_changed(const char *message, const CVariant &data) ++{ ++ int speed = data["player"]["speed"].asInteger(); ++ ++ CLog::Log(LOGDEBUG, "speed changed %d", speed); ++ ++ switch(abs(speed)) ++ { ++ case 1: g_speed = 60000; break; ++ case 2: g_speed = 40000; break; ++ case 4: g_speed = 35000; break; ++ case 8: g_speed = 30000; break; ++ case 16: g_speed = 25000; break; ++ case 32: g_speed = 15000; break; ++ } ++ ++ if(speed > 0) ++ g_pattern = PAT_FFWD; ++ else ++ g_pattern = PAT_REW; ++ ++ if(speed != 1) ++ g_repeat = 1; ++ else ++ { ++ g_repeat = 0; ++ g_pattern = PAT_NONE; ++ } ++} ++ ++void on_seek(const char *message, const CVariant &data) ++{ ++ int seek_time = data["player"]["seekoffset"]["seconds"].asInteger() + ++ data["player"]["seekoffset"]["minutes"].asInteger() * 60; ++ ++ CLog::Log(LOGDEBUG, "Seek offset = %d", seek_time); ++ if(seek_time > 0) ++ { ++ g_pattern = PAT_SKIPF; ++ } ++ else ++ { ++ g_pattern = PAT_SKIPR; ++ } ++ ++ g_repeat = 0; ++} ++ ++enum action_e { ++ ACTION_DO, ACTION_FN ++ }; ++ ++enum led_state_e { ++ LED_STATE_INVALID = 0, ++ LED_STATE_IDLE, ++ LED_STATE_PLAYING, ++ LED_STATE_PAUSED, ++ LED_STATE_SLEEP ++}; ++ ++struct led_action_s { ++ const char * event_name; ++ enum action_e action; ++ enum pattern_e action_data; ++ void (*action_fn)(const char *, const CVariant &); ++ led_state_e action_state; ++} led_actions[] = { ++ { "OnPlay", ACTION_DO, PAT_PLAY, NULL, LED_STATE_PLAYING }, ++ { "OnPause", ACTION_DO, PAT_PAUSE, NULL, LED_STATE_PAUSED }, ++ { "OnStop", ACTION_DO, PAT_STOP, NULL, LED_STATE_IDLE }, ++ { "OnSpeedChanged", ACTION_FN, PAT_NONE, on_speed_changed, LED_STATE_INVALID }, ++ { "OnSeek", ACTION_FN, PAT_NONE, on_seek, LED_STATE_INVALID }, ++ { "OnScreensaverActivated", ACTION_DO, PAT_SLEEP, NULL, LED_STATE_SLEEP }, ++ { "OnScreensaverDeactivated", ACTION_DO, PAT_WAKE, NULL, LED_STATE_IDLE }, ++}; ++ ++int zeroes[25] = { 0,}; ++ ++class CLedPattern : public IRunnable ++{ ++ int m_going; ++ CEvent *m_ev; ++ struct pattern { ++ unsigned long w; ++ unsigned long h; ++ unsigned long rowbytes; ++ unsigned char * img; ++ } m_pattern[NUM_PATTERNS]; ++ ++ void open_patterns() ++ { ++ unsigned int i; ++ for(i = 0; i < sizeof(patterns)/sizeof(patterns[0]); i++) ++ { ++ FILE * fp; ++ char filename[256]; ++ int channels; ++ ++ m_pattern[i].img = NULL; ++ sprintf(filename, "/storage/.kodi/media/ledpatterns/%s.png", patterns[i]); ++ fp = fopen(filename , "rb"); ++ if(fp == NULL) ++ { ++ sprintf(filename, "/usr/share/kodi/media/ledpatterns/%s.png", patterns[i]); ++ fp = fopen(filename, "rb"); ++ if(fp == NULL) ++ { ++ CLog::Log(LOGDEBUG, "Unable to open file %s", filename); ++ goto drop_out; ++ } ++ } ++ ++ if(readpng_init(fp, &m_pattern[i].w, &m_pattern[i].h) != 0) ++ { ++ CLog::Log(LOGERROR, "Unable to parse png files %s", filename); ++ goto drop_out; ++ } ++ ++ m_pattern[i].img = readpng_get_image(1.0, &channels, &m_pattern[i].rowbytes); ++ if(m_pattern[i].img == NULL || channels != 4) ++ { ++ CLog::Log(LOGERROR, "Invalid png %s, width = %lu, height = %lu, channels = %d, rowbytes = %lu", ++ filename, m_pattern[i].w, m_pattern[i].h, channels, m_pattern[i].rowbytes); ++ goto drop_out; ++ } ++ ++ CLog::Log(LOGDEBUG, "Opened %s: (%lu x %lu)", filename, m_pattern[i].w, m_pattern[i].h); ++ ++drop_out: ++ if(fp) ++ fclose(fp); ++ ++ } ++ } ++ ++ void play_pattern(int pat) ++ { ++ int fd = open("/dev/ws2812", O_WRONLY, 0); ++ if(fd < 0) ++ { ++ CLog::Log(LOGERROR, "Unable to open /dev/ws2812"); ++ } ++ else ++ { ++ if(pat < PAT_NONE && m_pattern[pat].img != NULL) ++ { ++ CLog::Log(LOGDEBUG, "playing pattern"); ++ g_pattern_playing = 1; ++ do ++ { ++ unsigned char * p_line = m_pattern[pat].img; ++ unsigned int i; ++ ++ for(i = 0; i < m_pattern[pat].h; i++) ++ { ++ write(fd, p_line, m_pattern[pat].w * 4); ++ if(m_pattern[pat].w == 26) ++ { ++ int *p = (int *) (p_line + (25 * 4)); ++ usleep(*p); ++ } ++ else ++ { ++ usleep(g_speed); ++ } ++ p_line += m_pattern[pat].rowbytes; ++ // If we get the g_halt signal then stop repeating ++ // the pattern ++ if(g_halt) ++ { ++ g_halt = 0; ++ g_repeat = 0; ++ break; ++ } ++ } ++ p_line += m_pattern[pat].rowbytes; ++ } ++ while(g_repeat); ++ g_pattern_playing = 0; ++ ++ write(fd, zeroes, sizeof(zeroes)); ++ } ++ else ++ { ++ CLog::Log(LOGDEBUG, "No img for LED pattern %d", pat); ++ } ++ close(fd); ++ } ++ } ++ ++public: ++ CLedPattern(CEvent *ev) ++ { ++ CLog::Log(LOGDEBUG, "Initialising CLedPattern"); ++ open_patterns(); ++ m_ev = ev; ++ } ++ ++ void Run() ++ { ++ m_going = 1; ++ while(m_going) ++ { ++ m_ev->Wait(); ++ CLog::Log(LOGDEBUG, "Led Pattern %d triggered", g_pattern); ++ play_pattern(g_pattern); ++ } ++ } ++ ++ void Stop() ++ { ++ m_going = 0; ++ m_ev->Set(); ++ } ++}; ++ + CGUIWindowHome::CGUIWindowHome(void) : CGUIWindow(WINDOW_HOME, "Home.xml"), + m_recentlyAddedRunning(false), + m_cumulativeUpdateFlag(0) +@@ -40,6 +274,14 @@ + m_updateRA = (Audio | Video | Totals); + m_loadType = KEEP_IN_MEMORY; + ++ m_ledevent = new CEvent(); ++ m_ledthread = new CThread(new CLedPattern(m_ledevent), "LedThread"); ++ m_ledthread->Create(); ++ g_pattern = PAT_STARTUP; ++ g_speed = 30000; ++ g_repeat = 0; ++ m_ledevent->Set(); ++ + CAnnouncementManager::GetInstance().AddAnnouncer(this); + } + +@@ -75,10 +317,48 @@ + + void CGUIWindowHome::Announce(AnnouncementFlag flag, const char *sender, const char *message, const CVariant &data) + { ++ unsigned int i; + int ra_flag = 0; + + CLog::Log(LOGDEBUG, "GOT ANNOUNCEMENT, type: %i, from %s, message %s",(int)flag, sender, message); + ++ for(i = 0; i < sizeof(led_actions)/sizeof(led_actions[0]); i++) ++ { ++ if(strcmp(message, led_actions[i].event_name) == 0) ++ { ++ switch(led_actions[i].action) { ++ case ACTION_DO: ++ { ++ g_halt = 1; ++ while(g_pattern_playing) ++ usleep(10); ++ g_halt = 0; ++ g_repeat = 0; ++ g_speed = 30000; ++ g_pattern = (int) led_actions[i].action_data; ++ m_ledevent->Set(); ++ break; ++ } ++ case ACTION_FN: ++ { ++ g_halt = 1; ++ while(g_pattern_playing) ++ usleep(10); ++ g_halt = 0; ++ g_repeat = 0; ++ g_speed = 30000; ++ led_actions[i].action_fn(message, data); ++ m_ledevent->Set(); ++ break; ++ } ++ default: ++ { ++ CLog::Log(LOGERROR, "Failed to execute LED action %d for event %s\n", i, led_actions[i].event_name); ++ } ++ } ++ } ++ } ++ + // we are only interested in library changes + if ((flag & (VideoLibrary | AudioLibrary)) == 0) + return; +diff -ruN kodi-16.0-beta5-19fc4fa/xbmc/windows/GUIWindowHome.cpp.orig kodi-16.0-beta5-19fc4fa-new/xbmc/windows/GUIWindowHome.cpp.orig +--- kodi-16.0-beta5-19fc4fa/xbmc/windows/GUIWindowHome.cpp.orig 1970-01-01 00:00:00.000000000 +0000 ++++ kodi-16.0-beta5-19fc4fa-new/xbmc/windows/GUIWindowHome.cpp.orig 2016-01-08 06:49:23.757652775 +0000 +@@ -0,0 +1,182 @@ ++/* ++ * Copyright (C) 2005-2013 Team XBMC ++ * http://xbmc.org ++ * ++ * This Program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2, or (at your option) ++ * any later version. ++ * ++ * This Program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with XBMC; see the file COPYING. If not, see ++ * <http://www.gnu.org/licenses/>. ++ * ++ */ ++ ++#include "GUIWindowHome.h" ++#include "input/Key.h" ++#include "guilib/WindowIDs.h" ++#include "utils/JobManager.h" ++#include "utils/RecentlyAddedJob.h" ++#include "interfaces/AnnouncementManager.h" ++#include "utils/log.h" ++#include "settings/AdvancedSettings.h" ++#include "utils/Variant.h" ++#include "guilib/GUIWindowManager.h" ++#include "Application.h" ++#include "utils/StringUtils.h" ++ ++using namespace ANNOUNCEMENT; ++ ++CGUIWindowHome::CGUIWindowHome(void) : CGUIWindow(WINDOW_HOME, "Home.xml"), ++ m_recentlyAddedRunning(false), ++ m_cumulativeUpdateFlag(0) ++{ ++ m_updateRA = (Audio | Video | Totals); ++ m_loadType = KEEP_IN_MEMORY; ++ ++ CAnnouncementManager::GetInstance().AddAnnouncer(this); ++} ++ ++CGUIWindowHome::~CGUIWindowHome(void) ++{ ++ CAnnouncementManager::GetInstance().RemoveAnnouncer(this); ++} ++ ++bool CGUIWindowHome::OnAction(const CAction &action) ++{ ++ static unsigned int min_hold_time = 1000; ++ if (action.GetID() == ACTION_NAV_BACK && ++ action.GetHoldTime() < min_hold_time && ++ g_application.m_pPlayer->IsPlaying()) ++ { ++ g_application.SwitchToFullScreen(); ++ return true; ++ } ++ return CGUIWindow::OnAction(action); ++} ++ ++void CGUIWindowHome::OnInitWindow() ++{ ++ // for shared databases (ie mysql) always force an update on return to home ++ // this is a temporary solution until remote announcements can be delivered ++ if (StringUtils::EqualsNoCase(g_advancedSettings.m_databaseVideo.type, "mysql") || ++ StringUtils::EqualsNoCase(g_advancedSettings.m_databaseMusic.type, "mysql") ) ++ m_updateRA = (Audio | Video | Totals); ++ AddRecentlyAddedJobs( m_updateRA ); ++ ++ CGUIWindow::OnInitWindow(); ++} ++ ++void CGUIWindowHome::Announce(AnnouncementFlag flag, const char *sender, const char *message, const CVariant &data) ++{ ++ int ra_flag = 0; ++ ++ CLog::Log(LOGDEBUG, "GOT ANNOUNCEMENT, type: %i, from %s, message %s",(int)flag, sender, message); ++ ++ // we are only interested in library changes ++ if ((flag & (VideoLibrary | AudioLibrary)) == 0) ++ return; ++ ++ if (data.isMember("transaction") && data["transaction"].asBoolean()) ++ return; ++ ++ if (strcmp(message, "OnScanStarted") == 0 || ++ strcmp(message, "OnCleanStarted") == 0) ++ return; ++ ++ bool onUpdate = strcmp(message, "OnUpdate") == 0; ++ // always update Totals except on an OnUpdate with no playcount update ++ if (!onUpdate || data.isMember("playcount")) ++ ra_flag |= Totals; ++ ++ // always update the full list except on an OnUpdate ++ if (!onUpdate) ++ { ++ if (flag & VideoLibrary) ++ ra_flag |= Video; ++ else if (flag & AudioLibrary) ++ ra_flag |= Audio; ++ } ++ ++ CGUIMessage reload(GUI_MSG_NOTIFY_ALL, GetID(), 0, GUI_MSG_REFRESH_THUMBS, ra_flag); ++ g_windowManager.SendThreadMessage(reload, GetID()); ++} ++ ++void CGUIWindowHome::AddRecentlyAddedJobs(int flag) ++{ ++ bool getAJob = false; ++ ++ // this block checks to see if another one is running ++ // and keeps track of the flag ++ { ++ CSingleLock lockMe(*this); ++ if (!m_recentlyAddedRunning) ++ { ++ getAJob = true; ++ ++ flag |= m_cumulativeUpdateFlag; // add the flags from previous calls to AddRecentlyAddedJobs ++ ++ m_cumulativeUpdateFlag = 0; // now taken care of in flag. ++ // reset this since we're going to execute a job ++ ++ // we're about to add one so set the indicator ++ if (flag) ++ m_recentlyAddedRunning = true; // this will happen in the if clause below ++ } ++ else ++ // since we're going to skip a job, mark that one came in and ... ++ m_cumulativeUpdateFlag |= flag; // this will be used later ++ } ++ ++ if (flag && getAJob) ++ CJobManager::GetInstance().AddJob(new CRecentlyAddedJob(flag), this); ++ ++ m_updateRA = 0; ++} ++ ++void CGUIWindowHome::OnJobComplete(unsigned int jobID, bool success, CJob *job) ++{ ++ int flag = 0; ++ ++ { ++ CSingleLock lockMe(*this); ++ ++ // the job is finished. ++ // did one come in in the meantime? ++ flag = m_cumulativeUpdateFlag; ++ m_recentlyAddedRunning = false; /// we're done. ++ } ++ ++ if (flag) ++ AddRecentlyAddedJobs(0 /* the flag will be set inside AddRecentlyAddedJobs via m_cumulativeUpdateFlag */ ); ++} ++ ++ ++bool CGUIWindowHome::OnMessage(CGUIMessage& message) ++{ ++ switch ( message.GetMessage() ) ++ { ++ case GUI_MSG_NOTIFY_ALL: ++ if (message.GetParam1() == GUI_MSG_WINDOW_RESET || message.GetParam1() == GUI_MSG_REFRESH_THUMBS) ++ { ++ int updateRA = (message.GetSenderId() == GetID()) ? message.GetParam2() : (Video | Audio | Totals); ++ ++ if (IsActive()) ++ AddRecentlyAddedJobs(updateRA); ++ else ++ m_updateRA |= updateRA; ++ } ++ break; ++ ++ default: ++ break; ++ } ++ ++ return CGUIWindow::OnMessage(message); ++} +diff -ruN kodi-16.0-beta5-19fc4fa/xbmc/windows/GUIWindowHome.h kodi-16.0-beta5-19fc4fa-new/xbmc/windows/GUIWindowHome.h +--- kodi-16.0-beta5-19fc4fa/xbmc/windows/GUIWindowHome.h 2015-12-14 23:07:12.000000000 +0000 ++++ kodi-16.0-beta5-19fc4fa-new/xbmc/windows/GUIWindowHome.h 2016-01-08 06:49:51.049652775 +0000 +@@ -23,6 +23,8 @@ + #include "guilib/GUIWindow.h" + #include "interfaces/IAnnouncer.h" + #include "utils/Job.h" ++#include "threads/Thread.h" ++#include "threads/Event.h" + + class CVariant; + +@@ -47,4 +49,7 @@ + + bool m_recentlyAddedRunning; + int m_cumulativeUpdateFlag; ++ ++ CThread *m_ledthread; ++ CEvent *m_ledevent; + }; +diff -ruN kodi-16.0-beta5-19fc4fa/xbmc/windows/GUIWindowHome.h.orig kodi-16.0-beta5-19fc4fa-new/xbmc/windows/GUIWindowHome.h.orig +--- kodi-16.0-beta5-19fc4fa/xbmc/windows/GUIWindowHome.h.orig 1970-01-01 00:00:00.000000000 +0000 ++++ kodi-16.0-beta5-19fc4fa-new/xbmc/windows/GUIWindowHome.h.orig 2016-01-08 06:49:23.757652775 +0000 +@@ -0,0 +1,50 @@ ++#pragma once ++ ++/* ++ * Copyright (C) 2005-2013 Team XBMC ++ * http://xbmc.org ++ * ++ * This Program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2, or (at your option) ++ * any later version. ++ * ++ * This Program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with XBMC; see the file COPYING. If not, see ++ * <http://www.gnu.org/licenses/>. ++ * ++ */ ++ ++#include "guilib/GUIWindow.h" ++#include "interfaces/IAnnouncer.h" ++#include "utils/Job.h" ++ ++class CVariant; ++ ++class CGUIWindowHome : ++ public CGUIWindow, ++ public ANNOUNCEMENT::IAnnouncer, ++ public IJobCallback ++{ ++public: ++ CGUIWindowHome(void); ++ virtual ~CGUIWindowHome(void); ++ virtual void OnInitWindow(); ++ virtual void Announce(ANNOUNCEMENT::AnnouncementFlag flag, const char *sender, const char *message, const CVariant &data); ++ ++ virtual bool OnMessage(CGUIMessage& message); ++ virtual bool OnAction(const CAction &action); ++ ++ virtual void OnJobComplete(unsigned int jobID, bool success, CJob *job); ++private: ++ int m_updateRA; // flag for which recently added items needs to be queried ++ void AddRecentlyAddedJobs(int flag); ++ ++ bool m_recentlyAddedRunning; ++ int m_cumulativeUpdateFlag; ++}; +diff -ruN kodi-16.0-beta5-19fc4fa/xbmc/windows/Makefile kodi-16.0-beta5-19fc4fa-new/xbmc/windows/Makefile +--- kodi-16.0-beta5-19fc4fa/xbmc/windows/Makefile 2015-12-14 23:07:12.000000000 +0000 ++++ kodi-16.0-beta5-19fc4fa-new/xbmc/windows/Makefile 2016-01-08 06:49:51.049652775 +0000 +@@ -10,6 +10,7 @@ + GUIWindowStartup.cpp \ + GUIWindowSystemInfo.cpp \ + GUIWindowWeather.cpp \ ++ readpng.c + + LIB=windows.a + +diff -ruN kodi-16.0-beta5-19fc4fa/xbmc/windows/Makefile.orig kodi-16.0-beta5-19fc4fa-new/xbmc/windows/Makefile.orig +--- kodi-16.0-beta5-19fc4fa/xbmc/windows/Makefile.orig 1970-01-01 00:00:00.000000000 +0000 ++++ kodi-16.0-beta5-19fc4fa-new/xbmc/windows/Makefile.orig 2016-01-08 06:49:23.757652775 +0000 +@@ -0,0 +1,17 @@ ++SRCS=GUIMediaWindow.cpp \ ++ GUIWindowDebugInfo.cpp \ ++ GUIWindowFileManager.cpp \ ++ GUIWindowHome.cpp \ ++ GUIWindowLoginScreen.cpp \ ++ GUIWindowPointer.cpp \ ++ GUIWindowScreensaver.cpp \ ++ GUIWindowScreensaverDim.cpp \ ++ GUIWindowSplash.cpp \ ++ GUIWindowStartup.cpp \ ++ GUIWindowSystemInfo.cpp \ ++ GUIWindowWeather.cpp \ ++ ++LIB=windows.a ++ ++include ../../Makefile.include ++-include $(patsubst %.cpp,%.P,$(patsubst %.c,%.P,$(SRCS))) +diff -ruN kodi-16.0-beta5-19fc4fa/xbmc/windows/readpng.c kodi-16.0-beta5-19fc4fa-new/xbmc/windows/readpng.c +--- kodi-16.0-beta5-19fc4fa/xbmc/windows/readpng.c 1970-01-01 00:00:00.000000000 +0000 ++++ kodi-16.0-beta5-19fc4fa-new/xbmc/windows/readpng.c 2016-01-08 06:49:51.049652775 +0000 +@@ -0,0 +1,274 @@ ++/*--------------------------------------------------------------------------- ++ ++ rpng - simple PNG display program readpng.c ++ ++ --------------------------------------------------------------------------- ++ ++ Copyright (c) 1998-2000 Greg Roelofs. All rights reserved. ++ ++ This software is provided "as is," without warranty of any kind, ++ express or implied. In no event shall the author or contributors ++ be held liable for any damages arising in any way from the use of ++ this software. ++ ++ Permission is granted to anyone to use this software for any purpose, ++ including commercial applications, and to alter it and redistribute ++ it freely, subject to the following restrictions: ++ ++ 1. Redistributions of source code must retain the above copyright ++ notice, disclaimer, and this list of conditions. ++ 2. Redistributions in binary form must reproduce the above copyright ++ notice, disclaimer, and this list of conditions in the documenta- ++ tion and/or other materials provided with the distribution. ++ 3. All advertising materials mentioning features or use of this ++ software must display the following acknowledgment: ++ ++ This product includes software developed by Greg Roelofs ++ and contributors for the book, "PNG: The Definitive Guide," ++ published by O'Reilly and Associates. ++ ++ ---------------------------------------------------------------------------*/ ++ ++#include <stdio.h> ++#include <stdlib.h> ++ ++#include "png.h" /* libpng header; includes zlib.h */ ++#include "readpng.h" /* typedefs, common macros, public prototypes */ ++ ++ ++static png_structp png_ptr = NULL; ++static png_infop info_ptr = NULL; ++ ++png_uint_32 width, height; ++int bit_depth, color_type; ++uch *image_data = NULL; ++ ++ ++void readpng_version_info(void) ++{ ++ fprintf(stderr, " Compiled with libpng %s; using libpng %s.\n", ++ PNG_LIBPNG_VER_STRING, png_libpng_ver); ++} ++ ++ ++/* return value = 0 for success, 1 for bad sig, 2 for bad IHDR, 4 for no mem */ ++ ++int readpng_init(FILE *infile, ulg *pWidth, ulg *pHeight) ++{ ++ uch sig[8]; ++ ++ ++ /* first do a quick check that the file really is a PNG image; could ++ * have used slightly more general png_sig_cmp() function instead */ ++ ++ fread(sig, 1, 8, infile); ++ if(png_sig_cmp(sig, 0, 8)) ++ return 1; /* bad signature */ ++ ++ ++ /* could pass pointers to user-defined error handlers instead of NULLs: */ ++ ++ png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); ++ if (!png_ptr) ++ return 4; /* out of memory */ ++ ++ info_ptr = png_create_info_struct(png_ptr); ++ if (!info_ptr) { ++ png_destroy_read_struct(&png_ptr, NULL, NULL); ++ return 4; /* out of memory */ ++ } ++ ++ ++ /* we could create a second info struct here (end_info), but it's only ++ * useful if we want to keep pre- and post-IDAT chunk info separated ++ * (mainly for PNG-aware image editors and converters) */ ++ ++ ++ /* setjmp() must be called in every function that calls a PNG-reading ++ * libpng function */ ++ ++ if (setjmp(png_jmpbuf(png_ptr))) { ++ png_destroy_read_struct(&png_ptr, &info_ptr, NULL); ++ return 2; ++ } ++ ++ ++ png_init_io(png_ptr, infile); ++ png_set_sig_bytes(png_ptr, 8); /* we already read the 8 signature bytes */ ++ ++ png_read_info(png_ptr, info_ptr); /* read all PNG info up to image data */ ++ ++ ++ /* alternatively, could make separate calls to png_get_image_width(), ++ * etc., but want bit_depth and color_type for later [don't care about ++ * compression_type and filter_type => NULLs] */ ++ ++ png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, ++ NULL, NULL, NULL); ++ *pWidth = width; ++ *pHeight = height; ++ ++ ++ /* OK, that's all we need for now; return happy */ ++ ++ return 0; ++} ++ ++ ++ ++ ++/* returns 0 if succeeds, 1 if fails due to no bKGD chunk, 2 if libpng error; ++ * scales values to 8-bit if necessary */ ++ ++int readpng_get_bgcolor(uch *red, uch *green, uch *blue) ++{ ++ png_color_16p pBackground; ++ ++ ++ /* setjmp() must be called in every function that calls a PNG-reading ++ * libpng function */ ++ ++ if (setjmp(png_jmpbuf(png_ptr))) { ++ png_destroy_read_struct(&png_ptr, &info_ptr, NULL); ++ return 2; ++ } ++ ++ ++ if (!png_get_valid(png_ptr, info_ptr, PNG_INFO_bKGD)) ++ return 1; ++ ++ /* it is not obvious from the libpng documentation, but this function ++ * takes a pointer to a pointer, and it always returns valid red, green ++ * and blue values, regardless of color_type: */ ++ ++ png_get_bKGD(png_ptr, info_ptr, &pBackground); ++ ++ ++ /* however, it always returns the raw bKGD data, regardless of any ++ * bit-depth transformations, so check depth and adjust if necessary */ ++ ++ if (bit_depth == 16) { ++ *red = pBackground->red >> 8; ++ *green = pBackground->green >> 8; ++ *blue = pBackground->blue >> 8; ++ } else if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8) { ++ if (bit_depth == 1) ++ *red = *green = *blue = pBackground->gray? 255 : 0; ++ else if (bit_depth == 2) ++ *red = *green = *blue = (255/3) * pBackground->gray; ++ else /* bit_depth == 4 */ ++ *red = *green = *blue = (255/15) * pBackground->gray; ++ } else { ++ *red = (uch)pBackground->red; ++ *green = (uch)pBackground->green; ++ *blue = (uch)pBackground->blue; ++ } ++ ++ return 0; ++} ++ ++ ++ ++ ++/* display_exponent == LUT_exponent * CRT_exponent */ ++ ++uch *readpng_get_image(double display_exponent, int *pChannels, ulg *pRowbytes) ++{ ++ double gamma; ++ png_uint_32 i, rowbytes; ++ png_bytepp row_pointers = NULL; ++ ++ ++ /* setjmp() must be called in every function that calls a PNG-reading ++ * libpng function */ ++ ++ if (setjmp(png_jmpbuf(png_ptr))) { ++ png_destroy_read_struct(&png_ptr, &info_ptr, NULL); ++ return NULL; ++ } ++ ++ ++ /* expand palette images to RGB, low-bit-depth grayscale images to 8 bits, ++ * transparency chunks to full alpha channel; strip 16-bit-per-sample ++ * images to 8 bits per sample; and convert grayscale to RGB[A] */ ++ ++ if (color_type == PNG_COLOR_TYPE_PALETTE) ++ png_set_expand(png_ptr); ++ if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8) ++ png_set_expand(png_ptr); ++ if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) ++ png_set_expand(png_ptr); ++ if (bit_depth == 16) ++ png_set_strip_16(png_ptr); ++ if (color_type == PNG_COLOR_TYPE_GRAY || ++ color_type == PNG_COLOR_TYPE_GRAY_ALPHA) ++ png_set_gray_to_rgb(png_ptr); ++ ++ ++ /* unlike the example in the libpng documentation, we have *no* idea where ++ * this file may have come from--so if it doesn't have a file gamma, don't ++ * do any correction ("do no harm") */ ++ ++ if (png_get_gAMA(png_ptr, info_ptr, &gamma)) ++ png_set_gamma(png_ptr, display_exponent, gamma); ++ ++ ++ /* all transformations have been registered; now update info_ptr data, ++ * get rowbytes and channels, and allocate image memory */ ++ ++ png_read_update_info(png_ptr, info_ptr); ++ ++ *pRowbytes = rowbytes = png_get_rowbytes(png_ptr, info_ptr); ++ *pChannels = (int)png_get_channels(png_ptr, info_ptr); ++ ++ if ((image_data = (uch *)malloc(rowbytes*height)) == NULL) { ++ png_destroy_read_struct(&png_ptr, &info_ptr, NULL); ++ return NULL; ++ } ++ if ((row_pointers = (png_bytepp)malloc(height*sizeof(png_bytep))) == NULL) { ++ png_destroy_read_struct(&png_ptr, &info_ptr, NULL); ++ free(image_data); ++ image_data = NULL; ++ return NULL; ++ } ++ ++ Trace((stderr, "readpng_get_image: rowbytes = %ld, height = %ld\n", rowbytes, height)); ++ ++ ++ /* set the individual row_pointers to point at the correct offsets */ ++ ++ for (i = 0; i < height; ++i) ++ row_pointers[i] = image_data + i*rowbytes; ++ ++ ++ /* now we can go ahead and just read the whole image */ ++ ++ png_read_image(png_ptr, row_pointers); ++ ++ ++ /* and we're done! (png_read_end() can be omitted if no processing of ++ * post-IDAT text/time/etc. is desired) */ ++ ++ free(row_pointers); ++ row_pointers = NULL; ++ ++ png_read_end(png_ptr, NULL); ++ ++ return image_data; ++} ++ ++ ++void readpng_cleanup(int free_image_data) ++{ ++ if (free_image_data && image_data) { ++ free(image_data); ++ image_data = NULL; ++ } ++ ++ if (png_ptr && info_ptr) { ++ png_destroy_read_struct(&png_ptr, &info_ptr, NULL); ++ png_ptr = NULL; ++ info_ptr = NULL; ++ } ++} ++ +diff -ruN kodi-16.0-beta5-19fc4fa/xbmc/windows/readpng.h kodi-16.0-beta5-19fc4fa-new/xbmc/windows/readpng.h +--- kodi-16.0-beta5-19fc4fa/xbmc/windows/readpng.h 1970-01-01 00:00:00.000000000 +0000 ++++ kodi-16.0-beta5-19fc4fa-new/xbmc/windows/readpng.h 2016-01-08 06:49:51.049652775 +0000 +@@ -0,0 +1,65 @@ ++/*--------------------------------------------------------------------------- ++ ++ rpng - simple PNG display program readpng.h ++ ++ --------------------------------------------------------------------------- ++ ++ Copyright (c) 1998-2000 Greg Roelofs. All rights reserved. ++ ++ This software is provided "as is," without warranty of any kind, ++ express or implied. In no event shall the author or contributors ++ be held liable for any damages arising in any way from the use of ++ this software. ++ ++ Permission is granted to anyone to use this software for any purpose, ++ including commercial applications, and to alter it and redistribute ++ it freely, subject to the following restrictions: ++ ++ 1. Redistributions of source code must retain the above copyright ++ notice, disclaimer, and this list of conditions. ++ 2. Redistributions in binary form must reproduce the above copyright ++ notice, disclaimer, and this list of conditions in the documenta- ++ tion and/or other materials provided with the distribution. ++ 3. All advertising materials mentioning features or use of this ++ software must display the following acknowledgment: ++ ++ This product includes software developed by Greg Roelofs ++ and contributors for the book, "PNG: The Definitive Guide," ++ published by O'Reilly and Associates. ++ ++ ---------------------------------------------------------------------------*/ ++ ++#ifndef TRUE ++# define TRUE 1 ++# define FALSE 0 ++#endif ++ ++#ifndef MAX ++# define MAX(a,b) ((a) > (b)? (a) : (b)) ++# define MIN(a,b) ((a) < (b)? (a) : (b)) ++#endif ++ ++#ifdef DEBUG ++# define Trace(x) {fprintf x ; fflush(stderr); fflush(stdout);} ++#else ++# define Trace(x) ; ++#endif ++ ++typedef unsigned char uch; ++typedef unsigned short ush; ++typedef unsigned long ulg; ++ ++ ++/* prototypes for public functions in readpng.c */ ++ ++void readpng_version_info(void); ++ ++int readpng_init(FILE *infile, ulg *pWidth, ulg *pHeight); ++ ++int readpng_get_bgcolor(uch *bg_red, uch *bg_green, uch *bg_blue); ++ ++uch *readpng_get_image(double display_exponent, int *pChannels, ++ ulg *pRowbytes); ++ ++void readpng_cleanup(int free_image_data); ++ diff --git a/projects/Slice2/patches/kodi/kodi-004-slice-audio.patch b/projects/Slice2/patches/kodi/kodi-004-slice-audio.patch new file mode 100644 index 00000000000..37991775943 --- /dev/null +++ b/projects/Slice2/patches/kodi/kodi-004-slice-audio.patch @@ -0,0 +1,20 @@ +diff -ur kodi-15.0-rc3-284f66a/xbmc/cores/AudioEngine/Sinks/AESinkPi.cpp kodi-15.0-rc3-284f66a-new/xbmc/cores/AudioEngine/Sinks/AESinkPi.cpp +--- kodi-15.0-rc3-284f66a/xbmc/cores/AudioEngine/Sinks/AESinkPi.cpp 2015-07-18 09:08:17.000000000 +0000 ++++ kodi-15.0-rc3-284f66a-new/xbmc/cores/AudioEngine/Sinks/AESinkPi.cpp 2015-07-23 21:11:39.501652775 +0000 +@@ -520,7 +520,7 @@ + m_info.m_dataFormats.push_back(AE_FMT_EAC3); + + list.push_back(m_info); +- ++#if 0 + m_info.m_channels.Reset(); + m_info.m_dataFormats.clear(); + m_info.m_sampleRates.clear(); +@@ -560,6 +560,7 @@ + m_info.m_dataFormats.push_back(AE_FMT_S16NEP); + + list.push_back(m_info); ++#endif + } + + #endif diff --git a/projects/Slice2/patches/kodi/kodi-005-slice-spdif.patch b/projects/Slice2/patches/kodi/kodi-005-slice-spdif.patch new file mode 100644 index 00000000000..a799b27fe25 --- /dev/null +++ b/projects/Slice2/patches/kodi/kodi-005-slice-spdif.patch @@ -0,0 +1,14 @@ +diff -ru kodi-16.0-beta5-19fc4fa/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp kodi-16.0-beta5-19fc4fa-new/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp +--- kodi-16.0-beta5-19fc4fa/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp 2015-12-14 23:07:12.000000000 +0000 ++++ kodi-16.0-beta5-19fc4fa-new/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp 2016-01-08 07:14:48.313652775 +0000 +@@ -1342,6 +1342,10 @@ + if (snd_card_get_name(cardNr, &cardName) == 0) + info.m_displayName = cardName; + ++ // hack: hifiberry digi doesn't correctly report as iec958 device. Needs fixing in kernel driver ++ //if (info.m_displayName == "snd_rpi_hifiberry_digi") ++ info.m_deviceType = AE_DEVTYPE_IEC958; ++ + if (info.m_deviceType == AE_DEVTYPE_HDMI && info.m_displayName.size() > 5 && + info.m_displayName.substr(info.m_displayName.size()-5) == " HDMI") + { diff --git a/projects/Slice2/patches/kodi/kodi-006-simon-pendantic.patch b/projects/Slice2/patches/kodi/kodi-006-simon-pendantic.patch new file mode 100644 index 00000000000..ebbf9d7b6b8 --- /dev/null +++ b/projects/Slice2/patches/kodi/kodi-006-simon-pendantic.patch @@ -0,0 +1,12 @@ +diff -ru kodi-15.1-f4dda26/addons/resource.language.en_gb/resources/strings.po kodi-15.1-f4dda26-new/addons/resource.language.en_gb/resources/strings.po +--- kodi-15.1-f4dda26/addons/resource.language.en_gb/resources/strings.po 2015-08-17 16:46:17.000000000 +0000 ++++ kodi-15.1-f4dda26-new/addons/resource.language.en_gb/resources/strings.po 2015-09-19 09:13:52.889652775 +0000 +@@ -10594,7 +10594,7 @@ + #: xbmc/dialogs/GUIDialogSmartPlaylistEditor.cpp + #: xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeOverview.cpp + msgctxt "#20343" +-msgid "TV shows" ++msgid "TV Shows" + msgstr "" + + msgctxt "#20344" diff --git a/projects/Slice2/patches/kodi/kodi-007-playpause.patch b/projects/Slice2/patches/kodi/kodi-007-playpause.patch new file mode 100644 index 00000000000..d60ff89daaf --- /dev/null +++ b/projects/Slice2/patches/kodi/kodi-007-playpause.patch @@ -0,0 +1,12 @@ +diff -ru kodi-16.0-beta5-19fc4fa/system/keymaps/keyboard.xml kodi-16.0-beta5-19fc4fa-new/system/keymaps/keyboard.xml +--- kodi-16.0-beta5-19fc4fa/system/keymaps/keyboard.xml 2016-01-08 07:16:35.489652775 +0000 ++++ kodi-16.0-beta5-19fc4fa-new/system/keymaps/keyboard.xml 2016-01-08 07:17:43.713652775 +0000 +@@ -74,7 +74,7 @@ + <menu mod="longpress">Menu</menu> + <c>ContextMenu</c> + <c mod="longpress">Menu</c> +- <space>Pause</space> ++ <space>PlayPause</space> + <x>Stop</x> + <period>SkipNext</period> + <comma>SkipPrevious</comma> diff --git a/projects/Slice2/patches/kodi/kodi-008-ledquit.patch b/projects/Slice2/patches/kodi/kodi-008-ledquit.patch new file mode 100644 index 00000000000..ff938382216 --- /dev/null +++ b/projects/Slice2/patches/kodi/kodi-008-ledquit.patch @@ -0,0 +1,62 @@ +diff -ru kodi-15.2-02e7013/xbmc/windows/GUIWindowHome.cpp kodi-15.2-02e7013-new/xbmc/windows/GUIWindowHome.cpp +--- kodi-15.2-02e7013/xbmc/windows/GUIWindowHome.cpp 2015-11-04 20:19:49.941652775 +0000 ++++ kodi-15.2-02e7013-new/xbmc/windows/GUIWindowHome.cpp 2015-12-09 07:00:38.613652775 +0000 +@@ -44,11 +44,11 @@ + int g_repeat = 0; + + enum pattern_e { +- PAT_PLAY, PAT_PAUSE, PAT_STOP, PAT_SLEEP, PAT_WAKE, PAT_FFWD, PAT_REW, PAT_SKIPF, PAT_SKIPR, PAT_STARTUP, PAT_NONE ++ PAT_PLAY, PAT_PAUSE, PAT_STOP, PAT_SLEEP, PAT_WAKE, PAT_FFWD, PAT_REW, PAT_SKIPF, PAT_SKIPR, PAT_STARTUP, PAT_QUIT, PAT_NONE + }; +-#define NUM_PATTERNS 10 ++#define NUM_PATTERNS 11 + const char *patterns[NUM_PATTERNS] = { +- "play" , "pause", "stop", "sleep", "wake", "ffwd", "rew", "skipf", "skipr", "startup" ++ "play" , "pause", "stop", "sleep", "wake", "ffwd", "rew", "skipf", "skipr", "startup", "quit" + }; + + void on_speed_changed(const char *message, const CVariant &data) +@@ -100,7 +100,7 @@ + } + + enum action_e { +- ACTION_DO, ACTION_FN ++ ACTION_DO, ACTION_REPEAT, ACTION_FN + }; + + enum led_state_e { +@@ -125,6 +125,7 @@ + { "OnSeek", ACTION_FN, PAT_NONE, on_seek, LED_STATE_INVALID }, + { "OnScreensaverActivated", ACTION_DO, PAT_SLEEP, NULL, LED_STATE_SLEEP }, + { "OnScreensaverDeactivated", ACTION_DO, PAT_WAKE, NULL, LED_STATE_IDLE }, ++ { "OnQuit", ACTION_REPEAT, PAT_QUIT, NULL, LED_STATE_IDLE }, + }; + + int zeroes[25] = { 0,}; +@@ -231,7 +232,8 @@ + while(g_repeat); + g_pattern_playing = 0; + +- write(fd, zeroes, sizeof(zeroes)); ++ if(pat != PAT_QUIT) ++ write(fd, zeroes, sizeof(zeroes)); + } + else + { +@@ -327,12 +329,13 @@ + { + switch(led_actions[i].action) { + case ACTION_DO: ++ case ACTION_REPEAT: + { + g_halt = 1; + while(g_pattern_playing) + usleep(10); + g_halt = 0; +- g_repeat = 0; ++ g_repeat = (led_actions[i].action == ACTION_DO) ? 0 : 1; + g_speed = 30000; + g_pattern = (int) led_actions[i].action_data; + m_ledevent->Set(); +Only in kodi-15.2-02e7013-new/xbmc/windows: GUIWindowHome.cpp.orig +Only in kodi-15.2-02e7013-new/xbmc/windows: GUIWindowHome.cpp.rej diff --git a/projects/Slice2/patches/linux/linux-01-RPi_support.patch b/projects/Slice2/patches/linux/linux-01-RPi_support.patch new file mode 100644 index 00000000000..27eeea44d11 --- /dev/null +++ b/projects/Slice2/patches/linux/linux-01-RPi_support.patch @@ -0,0 +1,134274 @@ +From ca75e975f8f57caa637e9cc52b3ff6feb869b74a Mon Sep 17 00:00:00 2001 +From: popcornmix <popcornmix@gmail.com> +Date: Wed, 27 Apr 2016 17:43:28 +0100 +Subject: [PATCH 001/112] Revert "SUNRPC: Make NFS swap work with multipath" + +This reverts commit 15001e5a7e1e207b6bd258cd8f187814cd15b6dc. +--- + net/sunrpc/clnt.c | 66 +++++++++++++++++++++++++++++++++++-------------------- + 1 file changed, 42 insertions(+), 24 deletions(-) + +diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c +index 7e0c9bf..0693685 100644 +--- a/net/sunrpc/clnt.c ++++ b/net/sunrpc/clnt.c +@@ -2683,39 +2683,57 @@ void rpc_show_tasks(struct net *net) + #endif + + #if IS_ENABLED(CONFIG_SUNRPC_SWAP) +-static int +-rpc_clnt_swap_activate_callback(struct rpc_clnt *clnt, +- struct rpc_xprt *xprt, +- void *dummy) +-{ +- return xprt_enable_swap(xprt); +-} +- + int + rpc_clnt_swap_activate(struct rpc_clnt *clnt) + { +- if (atomic_inc_return(&clnt->cl_swapper) == 1) +- return rpc_clnt_iterate_for_each_xprt(clnt, +- rpc_clnt_swap_activate_callback, NULL); +- return 0; +-} +-EXPORT_SYMBOL_GPL(rpc_clnt_swap_activate); ++ int ret = 0; ++ struct rpc_xprt *xprt; + +-static int +-rpc_clnt_swap_deactivate_callback(struct rpc_clnt *clnt, +- struct rpc_xprt *xprt, +- void *dummy) +-{ +- xprt_disable_swap(xprt); +- return 0; ++ if (atomic_inc_return(&clnt->cl_swapper) == 1) { ++retry: ++ rcu_read_lock(); ++ xprt = xprt_get(rcu_dereference(clnt->cl_xprt)); ++ rcu_read_unlock(); ++ if (!xprt) { ++ /* ++ * If we didn't get a reference, then we likely are ++ * racing with a migration event. Wait for a grace ++ * period and try again. ++ */ ++ synchronize_rcu(); ++ goto retry; ++ } ++ ++ ret = xprt_enable_swap(xprt); ++ xprt_put(xprt); ++ } ++ return ret; + } ++EXPORT_SYMBOL_GPL(rpc_clnt_swap_activate); + + void + rpc_clnt_swap_deactivate(struct rpc_clnt *clnt) + { +- if (atomic_dec_if_positive(&clnt->cl_swapper) == 0) +- rpc_clnt_iterate_for_each_xprt(clnt, +- rpc_clnt_swap_deactivate_callback, NULL); ++ struct rpc_xprt *xprt; ++ ++ if (atomic_dec_if_positive(&clnt->cl_swapper) == 0) { ++retry: ++ rcu_read_lock(); ++ xprt = xprt_get(rcu_dereference(clnt->cl_xprt)); ++ rcu_read_unlock(); ++ if (!xprt) { ++ /* ++ * If we didn't get a reference, then we likely are ++ * racing with a migration event. Wait for a grace ++ * period and try again. ++ */ ++ synchronize_rcu(); ++ goto retry; ++ } ++ ++ xprt_disable_swap(xprt); ++ xprt_put(xprt); ++ } + } + EXPORT_SYMBOL_GPL(rpc_clnt_swap_deactivate); + #endif /* CONFIG_SUNRPC_SWAP */ + +From 7ff74cfdea35caefc11486c463819aa0a559d032 Mon Sep 17 00:00:00 2001 +From: Steve Glendinning <steve.glendinning@smsc.com> +Date: Thu, 19 Feb 2015 18:47:12 +0000 +Subject: [PATCH 002/112] smsx95xx: fix crimes against truesize + +smsc95xx is adjusting truesize when it shouldn't, and following a recent patch from Eric this is now triggering warnings. + +This patch stops smsc95xx from changing truesize. + +Signed-off-by: Steve Glendinning <steve.glendinning@smsc.com> +--- + drivers/net/usb/smsc95xx.c | 10 ++++++++-- + 1 file changed, 8 insertions(+), 2 deletions(-) + +diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c +index 2edc2bc..2ce8d2b 100644 +--- a/drivers/net/usb/smsc95xx.c ++++ b/drivers/net/usb/smsc95xx.c +@@ -75,6 +75,10 @@ static bool turbo_mode = true; + module_param(turbo_mode, bool, 0644); + MODULE_PARM_DESC(turbo_mode, "Enable multiple frames per Rx transaction"); + ++static bool truesize_mode = false; ++module_param(truesize_mode, bool, 0644); ++MODULE_PARM_DESC(truesize_mode, "Report larger truesize value"); ++ + static int __must_check __smsc95xx_read_reg(struct usbnet *dev, u32 index, + u32 *data, int in_pm) + { +@@ -1795,7 +1799,8 @@ static int smsc95xx_rx_fixup(struct usbnet *dev, struct sk_buff *skb) + if (dev->net->features & NETIF_F_RXCSUM) + smsc95xx_rx_csum_offload(skb); + skb_trim(skb, skb->len - 4); /* remove fcs */ +- skb->truesize = size + sizeof(struct sk_buff); ++ if (truesize_mode) ++ skb->truesize = size + sizeof(struct sk_buff); + + return 1; + } +@@ -1813,7 +1818,8 @@ static int smsc95xx_rx_fixup(struct usbnet *dev, struct sk_buff *skb) + if (dev->net->features & NETIF_F_RXCSUM) + smsc95xx_rx_csum_offload(ax_skb); + skb_trim(ax_skb, ax_skb->len - 4); /* remove fcs */ +- ax_skb->truesize = size + sizeof(struct sk_buff); ++ if (truesize_mode) ++ ax_skb->truesize = size + sizeof(struct sk_buff); + + usbnet_skb_return(dev, ax_skb); + } + +From 1772115b52b325a46fafc57611663584bc9aef41 Mon Sep 17 00:00:00 2001 +From: popcornmix <popcornmix@gmail.com> +Date: Fri, 17 Apr 2015 16:58:45 +0100 +Subject: [PATCH 003/112] smsc95xx: Disable turbo mode by default + +--- + drivers/net/usb/smsc95xx.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c +index 2ce8d2b..35ebf75 100644 +--- a/drivers/net/usb/smsc95xx.c ++++ b/drivers/net/usb/smsc95xx.c +@@ -71,7 +71,7 @@ struct smsc95xx_priv { + u8 suspend_flags; + }; + +-static bool turbo_mode = true; ++static bool turbo_mode = false; + module_param(turbo_mode, bool, 0644); + MODULE_PARM_DESC(turbo_mode, "Enable multiple frames per Rx transaction"); + + +From 0174c345e5904dd88065c5512082f92e5bac390c Mon Sep 17 00:00:00 2001 +From: Sam Nazarko <email@samnazarko.co.uk> +Date: Fri, 1 Apr 2016 17:27:21 +0100 +Subject: [PATCH 004/112] add smsc95xx packetsize module_param + +Signed-off-by: Sam Nazarko <email@samnazarko.co.uk> +--- + drivers/net/usb/smsc95xx.c | 14 +++++++++----- + 1 file changed, 9 insertions(+), 5 deletions(-) + +diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c +index 35ebf75..3cac3c9 100644 +--- a/drivers/net/usb/smsc95xx.c ++++ b/drivers/net/usb/smsc95xx.c +@@ -79,6 +79,10 @@ static bool truesize_mode = false; + module_param(truesize_mode, bool, 0644); + MODULE_PARM_DESC(truesize_mode, "Report larger truesize value"); + ++static int packetsize = 0; ++module_param(packetsize, int, 0644); ++MODULE_PARM_DESC(packetsize, "Override the RX URB packet size"); ++ + static int __must_check __smsc95xx_read_reg(struct usbnet *dev, u32 index, + u32 *data, int in_pm) + { +@@ -960,13 +964,13 @@ static int smsc95xx_reset(struct usbnet *dev) + + if (!turbo_mode) { + burst_cap = 0; +- dev->rx_urb_size = MAX_SINGLE_PACKET_SIZE; ++ dev->rx_urb_size = packetsize ? packetsize : MAX_SINGLE_PACKET_SIZE; + } else if (dev->udev->speed == USB_SPEED_HIGH) { +- burst_cap = DEFAULT_HS_BURST_CAP_SIZE / HS_USB_PKT_SIZE; +- dev->rx_urb_size = DEFAULT_HS_BURST_CAP_SIZE; ++ dev->rx_urb_size = packetsize ? packetsize : DEFAULT_HS_BURST_CAP_SIZE; ++ burst_cap = dev->rx_urb_size / HS_USB_PKT_SIZE; + } else { +- burst_cap = DEFAULT_FS_BURST_CAP_SIZE / FS_USB_PKT_SIZE; +- dev->rx_urb_size = DEFAULT_FS_BURST_CAP_SIZE; ++ dev->rx_urb_size = packetsize ? packetsize : DEFAULT_FS_BURST_CAP_SIZE; ++ burst_cap = dev->rx_urb_size / FS_USB_PKT_SIZE; + } + + netif_dbg(dev, ifup, dev->net, "rx_urb_size=%ld\n", + +From be730bbaaddeb27448477933ffc1ddf37491c897 Mon Sep 17 00:00:00 2001 +From: popcornmix <popcornmix@gmail.com> +Date: Tue, 26 Mar 2013 17:26:38 +0000 +Subject: [PATCH 005/112] Allow mac address to be set in smsc95xx + +Signed-off-by: popcornmix <popcornmix@gmail.com> +--- + drivers/net/usb/smsc95xx.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 56 insertions(+) + +diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c +index 3cac3c9..d9bdc74 100644 +--- a/drivers/net/usb/smsc95xx.c ++++ b/drivers/net/usb/smsc95xx.c +@@ -60,6 +60,7 @@ + #define SUSPEND_SUSPEND3 (0x08) + #define SUSPEND_ALLMODES (SUSPEND_SUSPEND0 | SUSPEND_SUSPEND1 | \ + SUSPEND_SUSPEND2 | SUSPEND_SUSPEND3) ++#define MAC_ADDR_LEN (6) + + struct smsc95xx_priv { + u32 mac_cr; +@@ -83,6 +84,10 @@ static int packetsize = 0; + module_param(packetsize, int, 0644); + MODULE_PARM_DESC(packetsize, "Override the RX URB packet size"); + ++static char *macaddr = ":"; ++module_param(macaddr, charp, 0); ++MODULE_PARM_DESC(macaddr, "MAC address"); ++ + static int __must_check __smsc95xx_read_reg(struct usbnet *dev, u32 index, + u32 *data, int in_pm) + { +@@ -772,6 +777,53 @@ static int smsc95xx_ioctl(struct net_device *netdev, struct ifreq *rq, int cmd) + return generic_mii_ioctl(&dev->mii, if_mii(rq), cmd, NULL); + } + ++/* Check the macaddr module parameter for a MAC address */ ++static int smsc95xx_is_macaddr_param(struct usbnet *dev, u8 *dev_mac) ++{ ++ int i, j, got_num, num; ++ u8 mtbl[MAC_ADDR_LEN]; ++ ++ if (macaddr[0] == ':') ++ return 0; ++ ++ i = 0; ++ j = 0; ++ num = 0; ++ got_num = 0; ++ while (j < MAC_ADDR_LEN) { ++ if (macaddr[i] && macaddr[i] != ':') { ++ got_num++; ++ if ('0' <= macaddr[i] && macaddr[i] <= '9') ++ num = num * 16 + macaddr[i] - '0'; ++ else if ('A' <= macaddr[i] && macaddr[i] <= 'F') ++ num = num * 16 + 10 + macaddr[i] - 'A'; ++ else if ('a' <= macaddr[i] && macaddr[i] <= 'f') ++ num = num * 16 + 10 + macaddr[i] - 'a'; ++ else ++ break; ++ i++; ++ } else if (got_num == 2) { ++ mtbl[j++] = (u8) num; ++ num = 0; ++ got_num = 0; ++ i++; ++ } else { ++ break; ++ } ++ } ++ ++ if (j == MAC_ADDR_LEN) { ++ netif_dbg(dev, ifup, dev->net, "Overriding MAC address with: " ++ "%02x:%02x:%02x:%02x:%02x:%02x\n", mtbl[0], mtbl[1], mtbl[2], ++ mtbl[3], mtbl[4], mtbl[5]); ++ for (i = 0; i < MAC_ADDR_LEN; i++) ++ dev_mac[i] = mtbl[i]; ++ return 1; ++ } else { ++ return 0; ++ } ++} ++ + static void smsc95xx_init_mac_address(struct usbnet *dev) + { + const u8 *mac_addr; +@@ -793,6 +845,10 @@ static void smsc95xx_init_mac_address(struct usbnet *dev) + } + } + ++ /* Check module parameters */ ++ if (smsc95xx_is_macaddr_param(dev, dev->net->dev_addr)) ++ return; ++ + /* no useful static MAC address found. generate a random one */ + eth_hw_addr_random(dev->net); + netif_dbg(dev, ifup, dev->net, "MAC address set to eth_random_addr\n"); + +From 2f4a1d4938769ec3951b779bb607a841d6abdf7b Mon Sep 17 00:00:00 2001 +From: Nicolas Boullis <nboullis@debian.org> +Date: Sun, 10 Apr 2016 13:23:05 +0200 +Subject: [PATCH 006/112] rtc: ds1307: ensure that any pending alarm is cleared + before a new alarm is enabled +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +If a previously-set alarm was disabled and then triggered, it may still +be pending when a new alarm is configured. + +Then, if the alarm is enabled before the pending alarm is cleared, then +an interrupt is immediately raised. + +Unfortunately, when the alarm is cleared and enabled during the same I²C +block write, the chip (at least the DS1339 I have) considers that the +alarm is enabled before it is cleared, and raises an interrupt. + +This patch ensures that the pending alarm is cleared before the alarm is +enabled. + +Signed-off-by: Nicolas Boullis <nboullis@debian.org> +Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com> +--- + drivers/rtc/rtc-ds1307.c | 13 ++++++++----- + 1 file changed, 8 insertions(+), 5 deletions(-) + +diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c +index ecb7dba..e94eb09 100644 +--- a/drivers/rtc/rtc-ds1307.c ++++ b/drivers/rtc/rtc-ds1307.c +@@ -538,12 +538,8 @@ static int ds1337_set_alarm(struct device *dev, struct rtc_wkalrm *t) + buf[5] = 0; + buf[6] = 0; + +- /* optionally enable ALARM1 */ ++ /* disable alarms */ + buf[7] = control & ~(DS1337_BIT_A1IE | DS1337_BIT_A2IE); +- if (t->enabled) { +- dev_dbg(dev, "alarm IRQ armed\n"); +- buf[7] |= DS1337_BIT_A1IE; /* only ALARM1 is used */ +- } + buf[8] = status & ~(DS1337_BIT_A1I | DS1337_BIT_A2I); + + ret = ds1307->write_block_data(client, +@@ -553,6 +549,13 @@ static int ds1337_set_alarm(struct device *dev, struct rtc_wkalrm *t) + return ret; + } + ++ /* optionally enable ALARM1 */ ++ if (t->enabled) { ++ dev_dbg(dev, "alarm IRQ armed\n"); ++ buf[7] |= DS1337_BIT_A1IE; /* only ALARM1 is used */ ++ i2c_smbus_write_byte_data(client, DS1337_REG_CONTROL, buf[7]); ++ } ++ + return 0; + } + + +From c28f0cf7c000000c6af92915e49b11b3a0b5db55 Mon Sep 17 00:00:00 2001 +From: Phil Elwell <phil@raspberrypi.org> +Date: Wed, 9 Mar 2016 13:28:24 +0000 +Subject: [PATCH 007/112] serial: Take care starting a hung-up tty's port + +tty_port_hangup sets a port's tty field to NULL (holding the port lock), +but uart_tx_stopped, called from __uart_start (with the port lock), +uses the tty field without checking for NULL. + +Change uart_tx_stopped to treat a NULL tty field as another stopped +indication. + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> +--- + include/linux/serial_core.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h +index cbfcf38..96bc15a 100644 +--- a/include/linux/serial_core.h ++++ b/include/linux/serial_core.h +@@ -403,7 +403,7 @@ int uart_resume_port(struct uart_driver *reg, struct uart_port *port); + static inline int uart_tx_stopped(struct uart_port *port) + { + struct tty_struct *tty = port->state->port.tty; +- if (tty->stopped || port->hw_stopped) ++ if (!tty || tty->stopped || port->hw_stopped) + return 1; + return 0; + } + +From c6d7c03c674161544d9cb391acc3bbf18bc3ac95 Mon Sep 17 00:00:00 2001 +From: popcornmix <popcornmix@gmail.com> +Date: Wed, 18 Jun 2014 13:42:01 +0100 +Subject: [PATCH 008/112] vmstat: Workaround for issue where dirty page count + goes negative + +See: +https://github.com/raspberrypi/linux/issues/617 +http://www.spinics.net/lists/linux-mm/msg72236.html +--- + include/linux/vmstat.h | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h +index 73fae8c..5dd1278 100644 +--- a/include/linux/vmstat.h ++++ b/include/linux/vmstat.h +@@ -220,7 +220,11 @@ static inline void __inc_zone_state(struct zone *zone, enum zone_stat_item item) + static inline void __dec_zone_state(struct zone *zone, enum zone_stat_item item) + { + atomic_long_dec(&zone->vm_stat[item]); ++ if (item == NR_FILE_DIRTY && unlikely(atomic_long_read(&zone->vm_stat[item]) < 0)) ++ atomic_long_set(&zone->vm_stat[item], 0); + atomic_long_dec(&vm_stat[item]); ++ if (item == NR_FILE_DIRTY && unlikely(atomic_long_read(&vm_stat[item]) < 0)) ++ atomic_long_set(&vm_stat[item], 0); + } + + static inline void __inc_zone_page_state(struct page *page, + +From 31b90174e46b5e1eb81aa8c29e7f42fdf6c74f2b Mon Sep 17 00:00:00 2001 +From: Phil Elwell <phil@raspberrypi.org> +Date: Fri, 13 Mar 2015 12:43:36 +0000 +Subject: [PATCH 009/112] Protect __release_resource against resources without + parents + +Without this patch, removing a device tree overlay can crash here. + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> +--- + kernel/resource.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/kernel/resource.c b/kernel/resource.c +index 9b5f044..f8a9af6 100644 +--- a/kernel/resource.c ++++ b/kernel/resource.c +@@ -246,6 +246,12 @@ static int __release_resource(struct resource *old, bool release_child) + { + struct resource *tmp, **p, *chd; + ++ if (!old->parent) { ++ WARN(old->sibling, "sibling but no parent"); ++ if (old->sibling) ++ return -EINVAL; ++ return 0; ++ } + p = &old->parent->child; + for (;;) { + tmp = *p; + +From 40f5929ab19a370adb498aa3249ca28942127d9b Mon Sep 17 00:00:00 2001 +From: Eric Anholt <eric@anholt.net> +Date: Thu, 18 Dec 2014 16:07:15 -0800 +Subject: [PATCH 010/112] mm: Remove the PFN busy warning + +See commit dae803e165a11bc88ca8dbc07a11077caf97bbcb -- the warning is +expected sometimes when using CMA. However, that commit still spams +my kernel log with these warnings. + +Signed-off-by: Eric Anholt <eric@anholt.net> +--- + mm/page_alloc.c | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/mm/page_alloc.c b/mm/page_alloc.c +index c1069ef..fe21be6 100644 +--- a/mm/page_alloc.c ++++ b/mm/page_alloc.c +@@ -7101,8 +7101,6 @@ int alloc_contig_range(unsigned long start, unsigned long end, + + /* Make sure the range is really isolated. */ + if (test_pages_isolated(outer_start, end, false)) { +- pr_info("%s: [%lx, %lx) PFNs busy\n", +- __func__, outer_start, end); + ret = -EBUSY; + goto done; + } + +From d7c3a06d1bace2ac531e73c63b5fa08117ed7826 Mon Sep 17 00:00:00 2001 +From: Robert Tiemann <rtie@gmx.de> +Date: Mon, 20 Jul 2015 11:01:25 +0200 +Subject: [PATCH 011/112] BCM2835_DT: Fix I2S register map + +--- + Documentation/devicetree/bindings/dma/brcm,bcm2835-dma.txt | 4 ++-- + Documentation/devicetree/bindings/sound/brcm,bcm2835-i2s.txt | 4 ++-- + 2 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/Documentation/devicetree/bindings/dma/brcm,bcm2835-dma.txt b/Documentation/devicetree/bindings/dma/brcm,bcm2835-dma.txt +index 1396078..2db8294 100644 +--- a/Documentation/devicetree/bindings/dma/brcm,bcm2835-dma.txt ++++ b/Documentation/devicetree/bindings/dma/brcm,bcm2835-dma.txt +@@ -48,8 +48,8 @@ Example: + + bcm2835_i2s: i2s@7e203000 { + compatible = "brcm,bcm2835-i2s"; +- reg = < 0x7e203000 0x20>, +- < 0x7e101098 0x02>; ++ reg = < 0x7e203000 0x24>, ++ < 0x7e101098 0x08>; + + dmas = <&dma 2>, + <&dma 3>; +diff --git a/Documentation/devicetree/bindings/sound/brcm,bcm2835-i2s.txt b/Documentation/devicetree/bindings/sound/brcm,bcm2835-i2s.txt +index 65783de..a89fe42 100644 +--- a/Documentation/devicetree/bindings/sound/brcm,bcm2835-i2s.txt ++++ b/Documentation/devicetree/bindings/sound/brcm,bcm2835-i2s.txt +@@ -16,8 +16,8 @@ Example: + + bcm2835_i2s: i2s@7e203000 { + compatible = "brcm,bcm2835-i2s"; +- reg = <0x7e203000 0x20>, +- <0x7e101098 0x02>; ++ reg = <0x7e203000 0x24>, ++ <0x7e101098 0x08>; + + dmas = <&dma 2>, + <&dma 3>; + +From 4c752b5cd3a5486b9fcba5d591175e5b742cfbef Mon Sep 17 00:00:00 2001 +From: Phil Elwell <phil@raspberrypi.org> +Date: Fri, 4 Dec 2015 17:41:50 +0000 +Subject: [PATCH 012/112] irq-bcm2836: Prevent spurious interrupts, and trap + them early + +The old arch-specific IRQ macros included a dsb to ensure the +write to clear the mailbox interrupt completed before returning +from the interrupt. The BCM2836 irqchip driver needs the same +precaution to avoid spurious interrupts. + +Spurious interrupts are still possible for other reasons, +though, so trap them early. +--- + drivers/irqchip/irq-bcm2836.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/irqchip/irq-bcm2836.c b/drivers/irqchip/irq-bcm2836.c +index b6e950d..bbb92c2 100644 +--- a/drivers/irqchip/irq-bcm2836.c ++++ b/drivers/irqchip/irq-bcm2836.c +@@ -175,6 +175,7 @@ __exception_irq_entry bcm2836_arm_irqchip_handle_irq(struct pt_regs *regs) + u32 ipi = ffs(mbox_val) - 1; + + writel(1 << ipi, mailbox0); ++ dsb(); + handle_IPI(ipi, regs); + #endif + } else if (stat) { + +From 035dd0ae04e88afb2133082dce4c15527f5fb0ca Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= <noralf@tronnes.org> +Date: Fri, 12 Jun 2015 19:01:05 +0200 +Subject: [PATCH 013/112] irqchip: bcm2835: Add FIQ support +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Add a duplicate irq range with an offset on the hwirq's so the +driver can detect that enable_fiq() is used. +Tested with downstream dwc_otg USB controller driver. + +Signed-off-by: Noralf Trønnes <noralf@tronnes.org> +Reviewed-by: Eric Anholt <eric@anholt.net> +Acked-by: Stephen Warren <swarren@wwwdotorg.org> +--- + arch/arm/mach-bcm/Kconfig | 1 + + drivers/irqchip/irq-bcm2835.c | 51 ++++++++++++++++++++++++++++++++++++++----- + 2 files changed, 47 insertions(+), 5 deletions(-) + +diff --git a/arch/arm/mach-bcm/Kconfig b/arch/arm/mach-bcm/Kconfig +index 7ef1214..b1a5a7b 100644 +--- a/arch/arm/mach-bcm/Kconfig ++++ b/arch/arm/mach-bcm/Kconfig +@@ -143,6 +143,7 @@ config ARCH_BCM2835 + select ARM_TIMER_SP804 + select HAVE_ARM_ARCH_TIMER if ARCH_MULTI_V7 + select CLKSRC_OF ++ select FIQ + select PINCTRL + select PINCTRL_BCM2835 + help +diff --git a/drivers/irqchip/irq-bcm2835.c b/drivers/irqchip/irq-bcm2835.c +index bf9cc5f..3f601f9 100644 +--- a/drivers/irqchip/irq-bcm2835.c ++++ b/drivers/irqchip/irq-bcm2835.c +@@ -55,7 +55,7 @@ + #include <asm/mach/irq.h> + + /* Put the bank and irq (32 bits) into the hwirq */ +-#define MAKE_HWIRQ(b, n) ((b << 5) | (n)) ++#define MAKE_HWIRQ(b, n) (((b) << 5) | (n)) + #define HWIRQ_BANK(i) (i >> 5) + #define HWIRQ_BIT(i) BIT(i & 0x1f) + +@@ -71,9 +71,13 @@ + | SHORTCUT1_MASK | SHORTCUT2_MASK) + + #define REG_FIQ_CONTROL 0x0c ++#define REG_FIQ_ENABLE 0x80 ++#define REG_FIQ_DISABLE 0 + + #define NR_BANKS 3 + #define IRQS_PER_BANK 32 ++#define NUMBER_IRQS MAKE_HWIRQ(NR_BANKS, 0) ++#define FIQ_START (NR_IRQS_BANK0 + MAKE_HWIRQ(NR_BANKS - 1, 0)) + + static const int reg_pending[] __initconst = { 0x00, 0x04, 0x08 }; + static const int reg_enable[] __initconst = { 0x18, 0x10, 0x14 }; +@@ -98,14 +102,38 @@ static void __exception_irq_entry bcm2835_handle_irq( + struct pt_regs *regs); + static void bcm2836_chained_handle_irq(struct irq_desc *desc); + ++static inline unsigned int hwirq_to_fiq(unsigned long hwirq) ++{ ++ hwirq -= NUMBER_IRQS; ++ /* ++ * The hwirq numbering used in this driver is: ++ * BASE (0-7) GPU1 (32-63) GPU2 (64-95). ++ * This differ from the one used in the FIQ register: ++ * GPU1 (0-31) GPU2 (32-63) BASE (64-71) ++ */ ++ if (hwirq >= 32) ++ return hwirq - 32; ++ ++ return hwirq + 64; ++} ++ + static void armctrl_mask_irq(struct irq_data *d) + { +- writel_relaxed(HWIRQ_BIT(d->hwirq), intc.disable[HWIRQ_BANK(d->hwirq)]); ++ if (d->hwirq >= NUMBER_IRQS) ++ writel_relaxed(REG_FIQ_DISABLE, intc.base + REG_FIQ_CONTROL); ++ else ++ writel_relaxed(HWIRQ_BIT(d->hwirq), ++ intc.disable[HWIRQ_BANK(d->hwirq)]); + } + + static void armctrl_unmask_irq(struct irq_data *d) + { +- writel_relaxed(HWIRQ_BIT(d->hwirq), intc.enable[HWIRQ_BANK(d->hwirq)]); ++ if (d->hwirq >= NUMBER_IRQS) ++ writel_relaxed(REG_FIQ_ENABLE | hwirq_to_fiq(d->hwirq), ++ intc.base + REG_FIQ_CONTROL); ++ else ++ writel_relaxed(HWIRQ_BIT(d->hwirq), ++ intc.enable[HWIRQ_BANK(d->hwirq)]); + } + + static struct irq_chip armctrl_chip = { +@@ -151,8 +179,9 @@ static int __init armctrl_of_init(struct device_node *node, + panic("%s: unable to map IC registers\n", + node->full_name); + +- intc.domain = irq_domain_add_linear(node, MAKE_HWIRQ(NR_BANKS, 0), +- &armctrl_ops, NULL); ++ intc.base = base; ++ intc.domain = irq_domain_add_linear(node, NUMBER_IRQS * 2, ++ &armctrl_ops, NULL); + if (!intc.domain) + panic("%s: unable to create IRQ domain\n", node->full_name); + +@@ -182,6 +211,18 @@ static int __init armctrl_of_init(struct device_node *node, + set_handle_irq(bcm2835_handle_irq); + } + ++ /* Make a duplicate irq range which is used to enable FIQ */ ++ for (b = 0; b < NR_BANKS; b++) { ++ for (i = 0; i < bank_irqs[b]; i++) { ++ irq = irq_create_mapping(intc.domain, ++ MAKE_HWIRQ(b, i) + NUMBER_IRQS); ++ BUG_ON(irq <= 0); ++ irq_set_chip(irq, &armctrl_chip); ++ set_irq_flags(irq, IRQF_VALID | IRQF_PROBE); ++ } ++ } ++ init_FIQ(FIQ_START); ++ + return 0; + } + + +From bfbf2463f40ebf7f80ce73ad7b15ea4ca2e446a4 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= <noralf@tronnes.org> +Date: Fri, 23 Oct 2015 16:26:55 +0200 +Subject: [PATCH 014/112] irqchip: irq-bcm2835: Add 2836 FIQ support +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Noralf Trønnes <noralf@tronnes.org> +--- + drivers/irqchip/irq-bcm2835.c | 42 ++++++++++++++++++++++++++++++++++++++++-- + 1 file changed, 40 insertions(+), 2 deletions(-) + +diff --git a/drivers/irqchip/irq-bcm2835.c b/drivers/irqchip/irq-bcm2835.c +index 3f601f9..20deb28 100644 +--- a/drivers/irqchip/irq-bcm2835.c ++++ b/drivers/irqchip/irq-bcm2835.c +@@ -50,6 +50,8 @@ + #include <linux/of_irq.h> + #include <linux/irqchip.h> + #include <linux/irqdomain.h> ++#include <linux/mfd/syscon.h> ++#include <linux/regmap.h> + + #include <asm/exception.h> + #include <asm/mach/irq.h> +@@ -70,6 +72,9 @@ + #define BANK0_VALID_MASK (BANK0_HWIRQ_MASK | BANK1_HWIRQ | BANK2_HWIRQ \ + | SHORTCUT1_MASK | SHORTCUT2_MASK) + ++#undef ARM_LOCAL_GPU_INT_ROUTING ++#define ARM_LOCAL_GPU_INT_ROUTING 0x0c ++ + #define REG_FIQ_CONTROL 0x0c + #define REG_FIQ_ENABLE 0x80 + #define REG_FIQ_DISABLE 0 +@@ -95,6 +100,7 @@ struct armctrl_ic { + void __iomem *enable[NR_BANKS]; + void __iomem *disable[NR_BANKS]; + struct irq_domain *domain; ++ struct regmap *local_regmap; + }; + + static struct armctrl_ic intc __read_mostly; +@@ -128,12 +134,35 @@ static void armctrl_mask_irq(struct irq_data *d) + + static void armctrl_unmask_irq(struct irq_data *d) + { +- if (d->hwirq >= NUMBER_IRQS) ++ if (d->hwirq >= NUMBER_IRQS) { ++ if (num_online_cpus() > 1) { ++ unsigned int data; ++ int ret; ++ ++ if (!intc.local_regmap) { ++ pr_err("FIQ is disabled due to missing regmap\n"); ++ return; ++ } ++ ++ ret = regmap_read(intc.local_regmap, ++ ARM_LOCAL_GPU_INT_ROUTING, &data); ++ if (ret) { ++ pr_err("Failed to read int routing %d\n", ret); ++ return; ++ } ++ ++ data &= ~0xc; ++ data |= (1 << 2); ++ regmap_write(intc.local_regmap, ++ ARM_LOCAL_GPU_INT_ROUTING, data); ++ } ++ + writel_relaxed(REG_FIQ_ENABLE | hwirq_to_fiq(d->hwirq), + intc.base + REG_FIQ_CONTROL); +- else ++ } else { + writel_relaxed(HWIRQ_BIT(d->hwirq), + intc.enable[HWIRQ_BANK(d->hwirq)]); ++ } + } + + static struct irq_chip armctrl_chip = { +@@ -211,6 +240,15 @@ static int __init armctrl_of_init(struct device_node *node, + set_handle_irq(bcm2835_handle_irq); + } + ++ if (is_2836) { ++ intc.local_regmap = ++ syscon_regmap_lookup_by_compatible("brcm,bcm2836-arm-local"); ++ if (IS_ERR(intc.local_regmap)) { ++ pr_err("Failed to get local register map. FIQ is disabled for cpus > 1\n"); ++ intc.local_regmap = NULL; ++ } ++ } ++ + /* Make a duplicate irq range which is used to enable FIQ */ + for (b = 0; b < NR_BANKS; b++) { + for (i = 0; i < bank_irqs[b]; i++) { + +From 18707aacc4b3f082193c87f86edfaeaeed90f56a Mon Sep 17 00:00:00 2001 +From: Phil Elwell <phil@raspberrypi.org> +Date: Tue, 14 Jul 2015 10:26:09 +0100 +Subject: [PATCH 015/112] spidev: Add "spidev" compatible string to silence + warning + +See: https://github.com/raspberrypi/linux/issues/1054 +--- + drivers/spi/spidev.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c +index e3c19f3..f4963e3 100644 +--- a/drivers/spi/spidev.c ++++ b/drivers/spi/spidev.c +@@ -695,6 +695,7 @@ static struct class *spidev_class; + static const struct of_device_id spidev_dt_ids[] = { + { .compatible = "rohm,dh2228fv" }, + { .compatible = "lineartechnology,ltc2488" }, ++ { .compatible = "spidev" }, + {}, + }; + MODULE_DEVICE_TABLE(of, spidev_dt_ids); + +From 9a451703f2138a4c8543033879948e3e167a0c26 Mon Sep 17 00:00:00 2001 +From: Phil Elwell <phil@raspberrypi.org> +Date: Tue, 30 Jun 2015 14:12:42 +0100 +Subject: [PATCH 016/112] serial: 8250: Don't crash when nr_uarts is 0 + +--- + drivers/tty/serial/8250/8250_core.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c +index 2f4f5ee..edc1355 100644 +--- a/drivers/tty/serial/8250/8250_core.c ++++ b/drivers/tty/serial/8250/8250_core.c +@@ -509,6 +509,8 @@ static void __init serial8250_isa_init_ports(void) + + if (nr_uarts > UART_NR) + nr_uarts = UART_NR; ++ if (!nr_uarts) ++ return; + + for (i = 0; i < nr_uarts; i++) { + struct uart_8250_port *up = &serial8250_ports[i]; + +From 888e562b188603c0fd16585155bb5393bd1a5704 Mon Sep 17 00:00:00 2001 +From: notro <notro@tronnes.org> +Date: Thu, 10 Jul 2014 13:59:47 +0200 +Subject: [PATCH 017/112] pinctrl-bcm2835: Set base to 0 give expected gpio + numbering + +Signed-off-by: Noralf Tronnes <notro@tronnes.org> +--- + drivers/pinctrl/bcm/pinctrl-bcm2835.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/pinctrl/bcm/pinctrl-bcm2835.c b/drivers/pinctrl/bcm/pinctrl-bcm2835.c +index 08b1d93..0a23c81 100644 +--- a/drivers/pinctrl/bcm/pinctrl-bcm2835.c ++++ b/drivers/pinctrl/bcm/pinctrl-bcm2835.c +@@ -373,7 +373,7 @@ static struct gpio_chip bcm2835_gpio_chip = { + .get = bcm2835_gpio_get, + .set = bcm2835_gpio_set, + .to_irq = bcm2835_gpio_to_irq, +- .base = -1, ++ .base = 0, + .ngpio = BCM2835_NUM_GPIOS, + .can_sleep = false, + }; + +From 44235a003f98fa50a4a03958bc6f224675dd1aea Mon Sep 17 00:00:00 2001 +From: Phil Elwell <phil@raspberrypi.org> +Date: Tue, 24 Feb 2015 13:40:50 +0000 +Subject: [PATCH 018/112] pinctrl-bcm2835: Fix interrupt handling for GPIOs + 28-31 and 46-53 + +Contrary to the documentation, the BCM2835 GPIO controller actually has +four interrupt lines - one each for the three IRQ groups and one common. Rather +confusingly, the GPIO interrupt groups don't correspond directly with the GPIO +control banks. Instead, GPIOs 0-27 generate IRQ GPIO0, 28-45 GPIO1 and +46-53 GPIO2. + +Awkwardly, the GPIOS for IRQ GPIO1 straddle two 32-entry GPIO banks, so it is +cleaner to split out a function to process the interrupts for a single GPIO +bank. + +This bug has only just been observed because GPIOs above 27 can only be +accessed on an old Raspberry Pi with the optional P5 header fitted, where +the pins are often used for I2S instead. +--- + drivers/pinctrl/bcm/pinctrl-bcm2835.c | 51 ++++++++++++++++++++++++++--------- + 1 file changed, 39 insertions(+), 12 deletions(-) + +diff --git a/drivers/pinctrl/bcm/pinctrl-bcm2835.c b/drivers/pinctrl/bcm/pinctrl-bcm2835.c +index 0a23c81..b793bbd 100644 +--- a/drivers/pinctrl/bcm/pinctrl-bcm2835.c ++++ b/drivers/pinctrl/bcm/pinctrl-bcm2835.c +@@ -47,6 +47,7 @@ + #define MODULE_NAME "pinctrl-bcm2835" + #define BCM2835_NUM_GPIOS 54 + #define BCM2835_NUM_BANKS 2 ++#define BCM2835_NUM_IRQS 3 + + #define BCM2835_PIN_BITMAP_SZ \ + DIV_ROUND_UP(BCM2835_NUM_GPIOS, sizeof(unsigned long) * 8) +@@ -88,13 +89,13 @@ enum bcm2835_pinconf_pull { + + struct bcm2835_gpio_irqdata { + struct bcm2835_pinctrl *pc; +- int bank; ++ int irqgroup; + }; + + struct bcm2835_pinctrl { + struct device *dev; + void __iomem *base; +- int irq[BCM2835_NUM_BANKS]; ++ int irq[BCM2835_NUM_IRQS]; + + /* note: locking assumes each bank will have its own unsigned long */ + unsigned long enabled_irq_map[BCM2835_NUM_BANKS]; +@@ -105,7 +106,7 @@ struct bcm2835_pinctrl { + struct gpio_chip gpio_chip; + struct pinctrl_gpio_range gpio_range; + +- struct bcm2835_gpio_irqdata irq_data[BCM2835_NUM_BANKS]; ++ struct bcm2835_gpio_irqdata irq_data[BCM2835_NUM_IRQS]; + spinlock_t irq_lock[BCM2835_NUM_BANKS]; + }; + +@@ -378,17 +379,16 @@ static struct gpio_chip bcm2835_gpio_chip = { + .can_sleep = false, + }; + +-static irqreturn_t bcm2835_gpio_irq_handler(int irq, void *dev_id) ++static int bcm2835_gpio_irq_handle_bank(struct bcm2835_pinctrl *pc, ++ unsigned int bank, u32 mask) + { +- struct bcm2835_gpio_irqdata *irqdata = dev_id; +- struct bcm2835_pinctrl *pc = irqdata->pc; +- int bank = irqdata->bank; + unsigned long events; + unsigned offset; + unsigned gpio; + unsigned int type; + + events = bcm2835_gpio_rd(pc, GPEDS0 + bank * 4); ++ events &= mask; + events &= pc->enabled_irq_map[bank]; + for_each_set_bit(offset, &events, 32) { + gpio = (32 * bank) + offset; +@@ -396,7 +396,30 @@ static irqreturn_t bcm2835_gpio_irq_handler(int irq, void *dev_id) + + generic_handle_irq(irq_linear_revmap(pc->irq_domain, gpio)); + } +- return events ? IRQ_HANDLED : IRQ_NONE; ++ ++ return (events != 0); ++} ++ ++static irqreturn_t bcm2835_gpio_irq_handler(int irq, void *dev_id) ++{ ++ struct bcm2835_gpio_irqdata *irqdata = dev_id; ++ struct bcm2835_pinctrl *pc = irqdata->pc; ++ int handled = 0; ++ ++ switch (irqdata->irqgroup) { ++ case 0: /* IRQ0 covers GPIOs 0-27 */ ++ handled = bcm2835_gpio_irq_handle_bank(pc, 0, 0x0fffffff); ++ break; ++ case 1: /* IRQ1 covers GPIOs 28-45 */ ++ handled = bcm2835_gpio_irq_handle_bank(pc, 0, 0xf0000000) | ++ bcm2835_gpio_irq_handle_bank(pc, 1, 0x00003fff); ++ break; ++ case 2: /* IRQ2 covers GPIOs 46-53 */ ++ handled = bcm2835_gpio_irq_handle_bank(pc, 1, 0x003fc000); ++ break; ++ } ++ ++ return handled ? IRQ_HANDLED : IRQ_NONE; + } + + static inline void __bcm2835_gpio_irq_config(struct bcm2835_pinctrl *pc, +@@ -985,8 +1008,6 @@ static int bcm2835_pinctrl_probe(struct platform_device *pdev) + for (i = 0; i < BCM2835_NUM_BANKS; i++) { + unsigned long events; + unsigned offset; +- int len; +- char *name; + + /* clear event detection flags */ + bcm2835_gpio_wr(pc, GPREN0 + i * 4, 0); +@@ -1001,10 +1022,15 @@ static int bcm2835_pinctrl_probe(struct platform_device *pdev) + for_each_set_bit(offset, &events, 32) + bcm2835_gpio_wr(pc, GPEDS0 + i * 4, BIT(offset)); + ++ spin_lock_init(&pc->irq_lock[i]); ++ } ++ ++ for (i = 0; i < BCM2835_NUM_IRQS; i++) { ++ int len; ++ char *name; + pc->irq[i] = irq_of_parse_and_map(np, i); + pc->irq_data[i].pc = pc; +- pc->irq_data[i].bank = i; +- spin_lock_init(&pc->irq_lock[i]); ++ pc->irq_data[i].irqgroup = i; + + len = strlen(dev_name(pc->dev)) + 16; + name = devm_kzalloc(pc->dev, len, GFP_KERNEL); +@@ -1062,6 +1088,7 @@ static struct platform_driver bcm2835_pinctrl_driver = { + .remove = bcm2835_pinctrl_remove, + .driver = { + .name = MODULE_NAME, ++ .owner = THIS_MODULE, + .of_match_table = bcm2835_pinctrl_match, + }, + }; + +From 338386be825f60aefee3d3613778b6233d3759b3 Mon Sep 17 00:00:00 2001 +From: Phil Elwell <phil@raspberrypi.org> +Date: Thu, 26 Feb 2015 09:58:22 +0000 +Subject: [PATCH 019/112] pinctrl-bcm2835: Only request the interrupts listed + in the DTB + +Although the GPIO controller can generate three interrupts (four counting +the common one), the device tree files currently only specify two. In the +absence of the third, simply don't register that interrupt (as opposed to +registering 0), which has the effect of making it impossible to generate +interrupts for GPIOs 46-53 which, since they share pins with the SD card +interface, is unlikely to be a problem. +--- + drivers/pinctrl/bcm/pinctrl-bcm2835.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/pinctrl/bcm/pinctrl-bcm2835.c b/drivers/pinctrl/bcm/pinctrl-bcm2835.c +index b793bbd..8683a1b 100644 +--- a/drivers/pinctrl/bcm/pinctrl-bcm2835.c ++++ b/drivers/pinctrl/bcm/pinctrl-bcm2835.c +@@ -1029,6 +1029,8 @@ static int bcm2835_pinctrl_probe(struct platform_device *pdev) + int len; + char *name; + pc->irq[i] = irq_of_parse_and_map(np, i); ++ if (pc->irq[i] == 0) ++ break; + pc->irq_data[i].pc = pc; + pc->irq_data[i].irqgroup = i; + + +From 74dbec2e38b6b8b6fb046a161cc86b835eadbde4 Mon Sep 17 00:00:00 2001 +From: Phil Elwell <phil@raspberrypi.org> +Date: Fri, 6 May 2016 12:32:47 +0100 +Subject: [PATCH 020/112] pinctrl-bcm2835: Return pins to inputs when freed + +When dynamically unloading overlays, it is important that freed pins are +restored to being inputs to prevent functions from being enabled in +multiple places at once. + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> +--- + drivers/pinctrl/bcm/pinctrl-bcm2835.c | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/drivers/pinctrl/bcm/pinctrl-bcm2835.c b/drivers/pinctrl/bcm/pinctrl-bcm2835.c +index 8683a1b..6327122 100644 +--- a/drivers/pinctrl/bcm/pinctrl-bcm2835.c ++++ b/drivers/pinctrl/bcm/pinctrl-bcm2835.c +@@ -831,6 +831,16 @@ static const struct pinctrl_ops bcm2835_pctl_ops = { + .dt_free_map = bcm2835_pctl_dt_free_map, + }; + ++static int bcm2835_pmx_free(struct pinctrl_dev *pctldev, ++ unsigned offset) ++{ ++ struct bcm2835_pinctrl *pc = pinctrl_dev_get_drvdata(pctldev); ++ ++ /* disable by setting to GPIO_IN */ ++ bcm2835_pinctrl_fsel_set(pc, offset, BCM2835_FSEL_GPIO_IN); ++ return 0; ++} ++ + static int bcm2835_pmx_get_functions_count(struct pinctrl_dev *pctldev) + { + return BCM2835_FSEL_COUNT; +@@ -890,6 +900,7 @@ static int bcm2835_pmx_gpio_set_direction(struct pinctrl_dev *pctldev, + } + + static const struct pinmux_ops bcm2835_pmx_ops = { ++ .free = bcm2835_pmx_free, + .get_functions_count = bcm2835_pmx_get_functions_count, + .get_function_name = bcm2835_pmx_get_function_name, + .get_function_groups = bcm2835_pmx_get_function_groups, + +From 1dc43cf973493169b270cba5302c4cbbdf940a3f Mon Sep 17 00:00:00 2001 +From: Phil Elwell <phil@raspberrypi.org> +Date: Wed, 24 Jun 2015 14:10:44 +0100 +Subject: [PATCH 021/112] spi-bcm2835: Support pin groups other than 7-11 + +The spi-bcm2835 driver automatically uses GPIO chip-selects due to +some unreliability of the native ones. In doing so it chooses the +same pins as the native chip-selects would use, but the existing +code always uses pins 7 and 8, wherever the SPI function is mapped. + +Search the pinctrl group assigned to the driver for pins that +correspond to native chip-selects, and use those for GPIO chip- +selects. + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> +--- + drivers/spi/spi-bcm2835.c | 45 +++++++++++++++++++++++++++++++++++++-------- + 1 file changed, 37 insertions(+), 8 deletions(-) + +diff --git a/drivers/spi/spi-bcm2835.c b/drivers/spi/spi-bcm2835.c +index f35cc10..5dfe20f 100644 +--- a/drivers/spi/spi-bcm2835.c ++++ b/drivers/spi/spi-bcm2835.c +@@ -688,6 +688,8 @@ static int bcm2835_spi_setup(struct spi_device *spi) + { + int err; + struct gpio_chip *chip; ++ struct device_node *pins; ++ u32 pingroup_index; + /* + * sanity checking the native-chipselects + */ +@@ -704,15 +706,42 @@ static int bcm2835_spi_setup(struct spi_device *spi) + "setup: only two native chip-selects are supported\n"); + return -EINVAL; + } +- /* now translate native cs to GPIO */ +- +- /* get the gpio chip for the base */ +- chip = gpiochip_find("pinctrl-bcm2835", chip_match_name); +- if (!chip) +- return 0; + +- /* and calculate the real CS */ +- spi->cs_gpio = chip->base + 8 - spi->chip_select; ++ /* now translate native cs to GPIO */ ++ /* first look for chip select pins in the devices pin groups */ ++ for (pingroup_index = 0; ++ (pins = of_parse_phandle(spi->master->dev.of_node, ++ "pinctrl-0", ++ pingroup_index)) != 0; ++ pingroup_index++) { ++ u32 pin; ++ u32 pin_index; ++ for (pin_index = 0; ++ of_property_read_u32_index(pins, ++ "brcm,pins", ++ pin_index, ++ &pin) == 0; ++ pin_index++) { ++ if (((spi->chip_select == 0) && ++ ((pin == 8) || (pin == 36) || (pin == 46))) || ++ ((spi->chip_select == 1) && ++ ((pin == 7) || (pin == 35)))) { ++ spi->cs_gpio = pin; ++ break; ++ } ++ } ++ of_node_put(pins); ++ } ++ /* if that fails, assume GPIOs 7-11 are used */ ++ if (!gpio_is_valid(spi->cs_gpio) ) { ++ /* get the gpio chip for the base */ ++ chip = gpiochip_find("pinctrl-bcm2835", chip_match_name); ++ if (!chip) ++ return 0; ++ ++ /* and calculate the real CS */ ++ spi->cs_gpio = chip->base + 8 - spi->chip_select; ++ } + + /* and set up the "mode" and level */ + dev_info(&spi->dev, "setting up native-CS%i as GPIO %i\n", + +From fa44a350bfe28a2ee33e460c4710036241db1054 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= <noralf@tronnes.org> +Date: Wed, 3 Jun 2015 12:26:13 +0200 +Subject: [PATCH 022/112] ARM: bcm2835: Set Serial number and Revision +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +The VideoCore bootloader passes in Serial number and +Revision number through Device Tree. Make these available to +userspace through /proc/cpuinfo. + +Mainline status: + +There is a commit in linux-next that standardize passing the serial +number through Device Tree (string: /serial-number): +ARM: 8355/1: arch: Show the serial number from devicetree in cpuinfo + +There was an attempt to do the same with the revision number, but it +didn't get in: +[PATCH v2 1/2] arm: devtree: Set system_rev from DT revision + +Signed-off-by: Noralf Trønnes <noralf@tronnes.org> +--- + arch/arm/mach-bcm/board_bcm2835.c | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/arch/arm/mach-bcm/board_bcm2835.c b/arch/arm/mach-bcm/board_bcm2835.c +index 834d676..3b68a8d 100644 +--- a/arch/arm/mach-bcm/board_bcm2835.c ++++ b/arch/arm/mach-bcm/board_bcm2835.c +@@ -17,12 +17,16 @@ + #include <linux/of_address.h> + #include <linux/of_platform.h> + #include <linux/clk/bcm2835.h> ++#include <asm/system_info.h> + + #include <asm/mach/arch.h> + #include <asm/mach/map.h> + + static void __init bcm2835_init(void) + { ++ struct device_node *np = of_find_node_by_path("/system"); ++ u32 val; ++ u64 val64; + int ret; + + bcm2835_init_clocks(); +@@ -33,6 +37,11 @@ static void __init bcm2835_init(void) + pr_err("of_platform_populate failed: %d\n", ret); + BUG(); + } ++ ++ if (!of_property_read_u32(np, "linux,revision", &val)) ++ system_rev = val; ++ if (!of_property_read_u64(np, "linux,serial", &val64)) ++ system_serial_low = val64; + } + + static const char * const bcm2835_compat[] = { + +From 52ab2f4e1b211feaf4f5be19022bc08e5cea6ec9 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= <noralf@tronnes.org> +Date: Thu, 9 Apr 2015 12:34:11 +0200 +Subject: [PATCH 023/112] dmaengine: bcm2835: Add slave dma support +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Add slave transfer capability to BCM2835 dmaengine driver. +This patch is pulled from the bcm2708-dmaengine driver in the +Raspberry Pi repo. The work was done by Gellert Weisz. + +Tested using the bcm2835-mmc driver from the same repo. + +Signed-off-by: Noralf Trønnes <noralf@tronnes.org> +--- + drivers/dma/bcm2835-dma.c | 206 ++++++++++++++++++++++++++++++++++++++++++---- + 1 file changed, 192 insertions(+), 14 deletions(-) + +diff --git a/drivers/dma/bcm2835-dma.c b/drivers/dma/bcm2835-dma.c +index 996c4b0..b278c66 100644 +--- a/drivers/dma/bcm2835-dma.c ++++ b/drivers/dma/bcm2835-dma.c +@@ -1,11 +1,10 @@ + /* + * BCM2835 DMA engine support + * +- * This driver only supports cyclic DMA transfers +- * as needed for the I2S module. +- * + * Author: Florian Meier <florian.meier@koalo.de> + * Copyright 2013 ++ * Gellert Weisz <gellert@raspberrypi.org> ++ * Copyright 2013-2014 + * + * Based on + * OMAP DMAengine support by Russell King +@@ -95,6 +94,8 @@ struct bcm2835_desc { + size_t size; + }; + ++#define BCM2835_DMA_WAIT_CYCLES 0 /* Slow down DMA transfers: 0-31 */ ++ + #define BCM2835_DMA_CS 0x00 + #define BCM2835_DMA_ADDR 0x04 + #define BCM2835_DMA_SOURCE_AD 0x0c +@@ -111,12 +112,16 @@ struct bcm2835_desc { + #define BCM2835_DMA_RESET BIT(31) /* WO, self clearing */ + + #define BCM2835_DMA_INT_EN BIT(0) ++#define BCM2835_DMA_WAIT_RESP BIT(3) + #define BCM2835_DMA_D_INC BIT(4) ++#define BCM2835_DMA_D_WIDTH BIT(5) + #define BCM2835_DMA_D_DREQ BIT(6) + #define BCM2835_DMA_S_INC BIT(8) ++#define BCM2835_DMA_S_WIDTH BIT(9) + #define BCM2835_DMA_S_DREQ BIT(10) + + #define BCM2835_DMA_PER_MAP(x) ((x) << 16) ++#define BCM2835_DMA_WAITS(x) (((x) & 0x1f) << 21) + + #define BCM2835_DMA_DATA_TYPE_S8 1 + #define BCM2835_DMA_DATA_TYPE_S16 2 +@@ -130,6 +135,14 @@ struct bcm2835_desc { + #define BCM2835_DMA_CHAN(n) ((n) << 8) /* Base address */ + #define BCM2835_DMA_CHANIO(base, n) ((base) + BCM2835_DMA_CHAN(n)) + ++#define MAX_NORMAL_TRANSFER SZ_1G ++/* ++ * Max length on a Lite channel is 65535 bytes. ++ * DMA handles byte-enables on SDRAM reads and writes even on 128-bit accesses, ++ * but byte-enables don't exist on peripheral addresses, so align to 32-bit. ++ */ ++#define MAX_LITE_TRANSFER (SZ_64K - 4) ++ + static inline struct bcm2835_dmadev *to_bcm2835_dma_dev(struct dma_device *d) + { + return container_of(d, struct bcm2835_dmadev, ddev); +@@ -226,12 +239,18 @@ static irqreturn_t bcm2835_dma_callback(int irq, void *data) + d = c->desc; + + if (d) { +- /* TODO Only works for cyclic DMA */ +- vchan_cyclic_callback(&d->vd); +- } ++ if (c->cyclic) { ++ vchan_cyclic_callback(&d->vd); + +- /* Keep the DMA engine running */ +- writel(BCM2835_DMA_ACTIVE, c->chan_base + BCM2835_DMA_CS); ++ /* Keep the DMA engine running */ ++ writel(BCM2835_DMA_ACTIVE, ++ c->chan_base + BCM2835_DMA_CS); ++ ++ } else { ++ vchan_cookie_complete(&c->desc->vd); ++ bcm2835_dma_start_desc(c); ++ } ++ } + + spin_unlock_irqrestore(&c->vc.lock, flags); + +@@ -339,8 +358,6 @@ static void bcm2835_dma_issue_pending(struct dma_chan *chan) + struct bcm2835_chan *c = to_bcm2835_dma_chan(chan); + unsigned long flags; + +- c->cyclic = true; /* Nothing else is implemented */ +- + spin_lock_irqsave(&c->vc.lock, flags); + if (vchan_issue_pending(&c->vc) && !c->desc) + bcm2835_dma_start_desc(c); +@@ -358,7 +375,7 @@ static struct dma_async_tx_descriptor *bcm2835_dma_prep_dma_cyclic( + struct bcm2835_desc *d; + dma_addr_t dev_addr; + unsigned int es, sync_type; +- unsigned int frame; ++ unsigned int frame, max_size; + int i; + + /* Grab configuration */ +@@ -393,7 +410,12 @@ static struct dma_async_tx_descriptor *bcm2835_dma_prep_dma_cyclic( + + d->c = c; + d->dir = direction; +- d->frames = buf_len / period_len; ++ if (c->ch >= 8) /* LITE channel */ ++ max_size = MAX_LITE_TRANSFER; ++ else ++ max_size = MAX_NORMAL_TRANSFER; ++ period_len = min(period_len, max_size); ++ d->frames = (buf_len - 1) / (period_len + 1); + + d->cb_list = kcalloc(d->frames, sizeof(*d->cb_list), GFP_KERNEL); + if (!d->cb_list) { +@@ -441,17 +463,171 @@ static struct dma_async_tx_descriptor *bcm2835_dma_prep_dma_cyclic( + BCM2835_DMA_PER_MAP(c->dreq); + + /* Length of a frame */ +- control_block->length = period_len; ++ if (frame != d->frames - 1) ++ control_block->length = period_len; ++ else ++ control_block->length = buf_len - (d->frames - 1) * ++ period_len; + d->size += control_block->length; + + /* + * Next block is the next frame. +- * This DMA engine driver currently only supports cyclic DMA. ++ * This function is called on cyclic DMA transfers. + * Therefore, wrap around at number of frames. + */ + control_block->next = d->cb_list[((frame + 1) % d->frames)].paddr; + } + ++ c->cyclic = true; ++ ++ return vchan_tx_prep(&c->vc, &d->vd, flags); ++} ++ ++static struct dma_async_tx_descriptor * ++bcm2835_dma_prep_slave_sg(struct dma_chan *chan, ++ struct scatterlist *sgl, ++ unsigned int sg_len, ++ enum dma_transfer_direction direction, ++ unsigned long flags, void *context) ++{ ++ struct bcm2835_chan *c = to_bcm2835_dma_chan(chan); ++ enum dma_slave_buswidth dev_width; ++ struct bcm2835_desc *d; ++ dma_addr_t dev_addr; ++ struct scatterlist *sgent; ++ unsigned int i, sync_type, split_cnt, max_size; ++ ++ if (!is_slave_direction(direction)) { ++ dev_err(chan->device->dev, "direction not supported\n"); ++ return NULL; ++ } ++ ++ if (direction == DMA_DEV_TO_MEM) { ++ dev_addr = c->cfg.src_addr; ++ dev_width = c->cfg.src_addr_width; ++ sync_type = BCM2835_DMA_S_DREQ; ++ } else { ++ dev_addr = c->cfg.dst_addr; ++ dev_width = c->cfg.dst_addr_width; ++ sync_type = BCM2835_DMA_D_DREQ; ++ } ++ ++ /* Bus width translates to the element size (ES) */ ++ switch (dev_width) { ++ case DMA_SLAVE_BUSWIDTH_4_BYTES: ++ break; ++ default: ++ dev_err(chan->device->dev, "buswidth not supported: %i\n", ++ dev_width); ++ return NULL; ++ } ++ ++ /* Allocate and setup the descriptor. */ ++ d = kzalloc(sizeof(*d), GFP_NOWAIT); ++ if (!d) ++ return NULL; ++ ++ d->dir = direction; ++ ++ if (c->ch >= 8) /* LITE channel */ ++ max_size = MAX_LITE_TRANSFER; ++ else ++ max_size = MAX_NORMAL_TRANSFER; ++ ++ /* ++ * Store the length of the SG list in d->frames ++ * taking care to account for splitting up transfers ++ * too large for a LITE channel ++ */ ++ d->frames = 0; ++ for_each_sg(sgl, sgent, sg_len, i) { ++ unsigned int len = sg_dma_len(sgent); ++ ++ d->frames += len / max_size + 1; ++ } ++ ++ /* Allocate memory for control blocks */ ++ d->control_block_size = d->frames * sizeof(struct bcm2835_dma_cb); ++ d->control_block_base = dma_zalloc_coherent(chan->device->dev, ++ d->control_block_size, &d->control_block_base_phys, ++ GFP_NOWAIT); ++ if (!d->control_block_base) { ++ kfree(d); ++ return NULL; ++ } ++ ++ /* ++ * Iterate over all SG entries, create a control block ++ * for each frame and link them together. ++ * Count the number of times an SG entry had to be split ++ * as a result of using a LITE channel ++ */ ++ split_cnt = 0; ++ ++ for_each_sg(sgl, sgent, sg_len, i) { ++ unsigned int j; ++ dma_addr_t addr = sg_dma_address(sgent); ++ unsigned int len = sg_dma_len(sgent); ++ ++ for (j = 0; j < len; j += max_size) { ++ struct bcm2835_dma_cb *control_block = ++ &d->control_block_base[i + split_cnt]; ++ ++ /* Setup addresses */ ++ if (d->dir == DMA_DEV_TO_MEM) { ++ control_block->info = BCM2835_DMA_D_INC | ++ BCM2835_DMA_D_WIDTH | ++ BCM2835_DMA_S_DREQ; ++ control_block->src = dev_addr; ++ control_block->dst = addr + (dma_addr_t)j; ++ } else { ++ control_block->info = BCM2835_DMA_S_INC | ++ BCM2835_DMA_S_WIDTH | ++ BCM2835_DMA_D_DREQ; ++ control_block->src = addr + (dma_addr_t)j; ++ control_block->dst = dev_addr; ++ } ++ ++ /* Common part */ ++ control_block->info |= ++ BCM2835_DMA_WAITS(BCM2835_DMA_WAIT_CYCLES); ++ control_block->info |= BCM2835_DMA_WAIT_RESP; ++ ++ /* Enable */ ++ if (i == sg_len - 1 && len - j <= max_size) ++ control_block->info |= BCM2835_DMA_INT_EN; ++ ++ /* Setup synchronization */ ++ if (sync_type) ++ control_block->info |= sync_type; ++ ++ /* Setup DREQ channel */ ++ if (c->dreq) ++ control_block->info |= ++ BCM2835_DMA_PER_MAP(c->dreq); ++ ++ /* Length of a frame */ ++ control_block->length = min(len - j, max_size); ++ d->size += control_block->length; ++ ++ if (i < sg_len - 1 || len - j > max_size) { ++ /* Next block is the next frame. */ ++ control_block->next = ++ d->control_block_base_phys + ++ sizeof(struct bcm2835_dma_cb) * ++ (i + split_cnt + 1); ++ } else { ++ /* Next block is empty. */ ++ control_block->next = 0; ++ } ++ ++ if (len - j > max_size) ++ split_cnt++; ++ } ++ } ++ ++ c->cyclic = false; ++ + return vchan_tx_prep(&c->vc, &d->vd, flags); + error_cb: + i--; +@@ -620,6 +796,7 @@ static int bcm2835_dma_probe(struct platform_device *pdev) + od->ddev.device_tx_status = bcm2835_dma_tx_status; + od->ddev.device_issue_pending = bcm2835_dma_issue_pending; + od->ddev.device_prep_dma_cyclic = bcm2835_dma_prep_dma_cyclic; ++ od->ddev.device_prep_slave_sg = bcm2835_dma_prep_slave_sg; + od->ddev.device_config = bcm2835_dma_slave_config; + od->ddev.device_terminate_all = bcm2835_dma_terminate_all; + od->ddev.src_addr_widths = BIT(DMA_SLAVE_BUSWIDTH_4_BYTES); +@@ -708,4 +885,5 @@ module_platform_driver(bcm2835_dma_driver); + MODULE_ALIAS("platform:bcm2835-dma"); + MODULE_DESCRIPTION("BCM2835 DMA engine driver"); + MODULE_AUTHOR("Florian Meier <florian.meier@koalo.de>"); ++MODULE_AUTHOR("Gellert Weisz <gellert@raspberrypi.org>"); + MODULE_LICENSE("GPL v2"); + +From 160840d9d207155501ca02d2bc97eba91747839c Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= <noralf@tronnes.org> +Date: Sat, 3 Oct 2015 15:58:59 +0200 +Subject: [PATCH 024/112] dmaengine: bcm2835: set residue_granularity field +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +bcm2835-dma supports residue reporting at burst level but didn't report +this via the residue_granularity field. + +Without this field set properly we get playback issues with I2S cards. + +[by HiassofT, taken from bcm2708-dmaengine] +Signed-off-by: Noralf Trønnes <noralf@tronnes.org> +--- + drivers/dma/bcm2835-dma.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/dma/bcm2835-dma.c b/drivers/dma/bcm2835-dma.c +index b278c66..696fb30 100644 +--- a/drivers/dma/bcm2835-dma.c ++++ b/drivers/dma/bcm2835-dma.c +@@ -802,6 +802,7 @@ static int bcm2835_dma_probe(struct platform_device *pdev) + od->ddev.src_addr_widths = BIT(DMA_SLAVE_BUSWIDTH_4_BYTES); + od->ddev.dst_addr_widths = BIT(DMA_SLAVE_BUSWIDTH_4_BYTES); + od->ddev.directions = BIT(DMA_DEV_TO_MEM) | BIT(DMA_MEM_TO_DEV); ++ od->ddev.residue_granularity = DMA_RESIDUE_GRANULARITY_BURST; + od->ddev.dev = &pdev->dev; + INIT_LIST_HEAD(&od->ddev.channels); + spin_lock_init(&od->lock); + +From 84ae1b4ea9964f0152d06115b8ed12c30dbb2366 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= <noralf@tronnes.org> +Date: Sat, 3 Oct 2015 22:22:55 +0200 +Subject: [PATCH 025/112] dmaengine: bcm2835: Load driver early and support + legacy API +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Load driver early since at least bcm2708_fb doesn't support deferred +probing and even if it did, we don't want the video driver deferred. +Support the legacy DMA API which is needed by bcm2708_fb. +Don't mask out channel 2. + +Signed-off-by: Noralf Trønnes <noralf@tronnes.org> +--- + drivers/dma/Kconfig | 2 +- + drivers/dma/bcm2835-dma.c | 30 ++++++++++++++++++++++++------ + 2 files changed, 25 insertions(+), 7 deletions(-) + +diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig +index d96d87c..4d0425c 100644 +--- a/drivers/dma/Kconfig ++++ b/drivers/dma/Kconfig +@@ -108,7 +108,7 @@ config COH901318 + + config DMA_BCM2835 + tristate "BCM2835 DMA engine support" +- depends on ARCH_BCM2835 ++ depends on ARCH_BCM2835 || ARCH_BCM2708 || ARCH_BCM2709 + select DMA_ENGINE + select DMA_VIRTUAL_CHANNELS + +diff --git a/drivers/dma/bcm2835-dma.c b/drivers/dma/bcm2835-dma.c +index 696fb30..5db0a95 100644 +--- a/drivers/dma/bcm2835-dma.c ++++ b/drivers/dma/bcm2835-dma.c +@@ -36,6 +36,7 @@ + #include <linux/interrupt.h> + #include <linux/list.h> + #include <linux/module.h> ++#include <linux/platform_data/dma-bcm2708.h> + #include <linux/platform_device.h> + #include <linux/slab.h> + #include <linux/io.h> +@@ -786,6 +787,10 @@ static int bcm2835_dma_probe(struct platform_device *pdev) + if (IS_ERR(base)) + return PTR_ERR(base); + ++ rc = bcm_dmaman_probe(pdev, base, BCM2835_DMA_BULK_MASK); ++ if (rc) ++ dev_err(&pdev->dev, "Failed to initialize the legacy API\n"); ++ + od->base = base; + + dma_cap_set(DMA_SLAVE, od->ddev.cap_mask); +@@ -818,11 +823,8 @@ static int bcm2835_dma_probe(struct platform_device *pdev) + goto err_no_dma; + } + +- /* +- * Do not use the FIQ and BULK channels, +- * because they are used by the GPU. +- */ +- chans_available &= ~(BCM2835_DMA_FIQ_MASK | BCM2835_DMA_BULK_MASK); ++ /* Channel 0 is used by the legacy API */ ++ chans_available &= ~BCM2835_DMA_BULK_MASK; + + for (i = 0; i < pdev->num_resources; i++) { + irq = platform_get_irq(pdev, i); +@@ -866,6 +868,7 @@ static int bcm2835_dma_remove(struct platform_device *pdev) + { + struct bcm2835_dmadev *od = platform_get_drvdata(pdev); + ++ bcm_dmaman_remove(pdev); + dma_async_device_unregister(&od->ddev); + bcm2835_dma_free(od); + +@@ -881,7 +884,22 @@ static struct platform_driver bcm2835_dma_driver = { + }, + }; + +-module_platform_driver(bcm2835_dma_driver); ++static int bcm2835_dma_init(void) ++{ ++ return platform_driver_register(&bcm2835_dma_driver); ++} ++ ++static void bcm2835_dma_exit(void) ++{ ++ platform_driver_unregister(&bcm2835_dma_driver); ++} ++ ++/* ++ * Load after serial driver (arch_initcall) so we see the messages if it fails, ++ * but before drivers (module_init) that need a DMA channel. ++ */ ++subsys_initcall(bcm2835_dma_init); ++module_exit(bcm2835_dma_exit); + + MODULE_ALIAS("platform:bcm2835-dma"); + MODULE_DESCRIPTION("BCM2835 DMA engine driver"); + +From ccc5b14a95ee999444d995c565a7e631cae946dd Mon Sep 17 00:00:00 2001 +From: Matthias Reichl <hias@horus.com> +Date: Sun, 11 Oct 2015 12:28:30 +0200 +Subject: [PATCH 026/112] bcm2835-dma: Limit cyclic transfers on lite channels + to 32k + +Transfers larger than 32k cause repeated clicking with I2S soundcards. +The exact reason is yet unknown, so limit to 32k as bcm2708-dmaengine +did as an intermediate fix. +--- + drivers/dma/bcm2835-dma.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/drivers/dma/bcm2835-dma.c b/drivers/dma/bcm2835-dma.c +index 5db0a95..6b87ce2 100644 +--- a/drivers/dma/bcm2835-dma.c ++++ b/drivers/dma/bcm2835-dma.c +@@ -144,6 +144,12 @@ struct bcm2835_desc { + */ + #define MAX_LITE_TRANSFER (SZ_64K - 4) + ++/* ++ * Transfers larger than 32k cause issues with the bcm2708-i2s driver, ++ * so limit transfer size to 32k as bcm2708-dmaengine did. ++ */ ++#define MAX_CYCLIC_LITE_TRANSFER SZ_32K ++ + static inline struct bcm2835_dmadev *to_bcm2835_dma_dev(struct dma_device *d) + { + return container_of(d, struct bcm2835_dmadev, ddev); +@@ -412,7 +418,7 @@ static struct dma_async_tx_descriptor *bcm2835_dma_prep_dma_cyclic( + d->c = c; + d->dir = direction; + if (c->ch >= 8) /* LITE channel */ +- max_size = MAX_LITE_TRANSFER; ++ max_size = MAX_CYCLIC_LITE_TRANSFER; + else + max_size = MAX_NORMAL_TRANSFER; + period_len = min(period_len, max_size); + +From 7ecbf96abab7daa1e09881d457ea72d4756037ba Mon Sep 17 00:00:00 2001 +From: Matthias Reichl <hias@horus.com> +Date: Mon, 16 Nov 2015 14:05:35 +0000 +Subject: [PATCH 027/112] bcm2835-dma: Fix up convert to DMA pool + +--- + drivers/dma/bcm2835-dma.c | 36 ++++++++++++++++++++++++++---------- + 1 file changed, 26 insertions(+), 10 deletions(-) + +diff --git a/drivers/dma/bcm2835-dma.c b/drivers/dma/bcm2835-dma.c +index 6b87ce2..d26b6bd 100644 +--- a/drivers/dma/bcm2835-dma.c ++++ b/drivers/dma/bcm2835-dma.c +@@ -488,6 +488,17 @@ static struct dma_async_tx_descriptor *bcm2835_dma_prep_dma_cyclic( + c->cyclic = true; + + return vchan_tx_prep(&c->vc, &d->vd, flags); ++error_cb: ++ i--; ++ for (; i >= 0; i--) { ++ struct bcm2835_cb_entry *cb_entry = &d->cb_list[i]; ++ ++ dma_pool_free(c->cb_pool, cb_entry->cb, cb_entry->paddr); ++ } ++ ++ kfree(d->cb_list); ++ kfree(d); ++ return NULL; + } + + static struct dma_async_tx_descriptor * +@@ -534,6 +545,7 @@ bcm2835_dma_prep_slave_sg(struct dma_chan *chan, + if (!d) + return NULL; + ++ d->c = c; + d->dir = direction; + + if (c->ch >= 8) /* LITE channel */ +@@ -553,15 +565,21 @@ bcm2835_dma_prep_slave_sg(struct dma_chan *chan, + d->frames += len / max_size + 1; + } + +- /* Allocate memory for control blocks */ +- d->control_block_size = d->frames * sizeof(struct bcm2835_dma_cb); +- d->control_block_base = dma_zalloc_coherent(chan->device->dev, +- d->control_block_size, &d->control_block_base_phys, +- GFP_NOWAIT); +- if (!d->control_block_base) { ++ d->cb_list = kcalloc(d->frames, sizeof(*d->cb_list), GFP_KERNEL); ++ if (!d->cb_list) { + kfree(d); + return NULL; + } ++ /* Allocate memory for control blocks */ ++ for (i = 0; i < d->frames; i++) { ++ struct bcm2835_cb_entry *cb_entry = &d->cb_list[i]; ++ ++ cb_entry->cb = dma_pool_zalloc(c->cb_pool, GFP_ATOMIC, ++ &cb_entry->paddr); ++ ++ if (!cb_entry->cb) ++ goto error_cb; ++ } + + /* + * Iterate over all SG entries, create a control block +@@ -578,7 +596,7 @@ bcm2835_dma_prep_slave_sg(struct dma_chan *chan, + + for (j = 0; j < len; j += max_size) { + struct bcm2835_dma_cb *control_block = +- &d->control_block_base[i + split_cnt]; ++ d->cb_list[i + split_cnt].cb; + + /* Setup addresses */ + if (d->dir == DMA_DEV_TO_MEM) { +@@ -620,9 +638,7 @@ bcm2835_dma_prep_slave_sg(struct dma_chan *chan, + if (i < sg_len - 1 || len - j > max_size) { + /* Next block is the next frame. */ + control_block->next = +- d->control_block_base_phys + +- sizeof(struct bcm2835_dma_cb) * +- (i + split_cnt + 1); ++ d->cb_list[i + split_cnt + 1].paddr; + } else { + /* Next block is empty. */ + control_block->next = 0; + +From 16a0a53f8ce5f32ac79b204ff05efd91bf770be9 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= <noralf@tronnes.org> +Date: Sat, 15 Aug 2015 20:50:02 +0200 +Subject: [PATCH 028/112] bcm2835: Add support for uart1 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This is a hack until a proper solution is agreed upon. +Martin Sperl is doing some work in this area. + +Signed-off-by: Noralf Trønnes <noralf@tronnes.org> +--- + arch/arm/mach-bcm/board_bcm2835.c | 25 +++++++++++++++++++++++++ + 1 file changed, 25 insertions(+) + +diff --git a/arch/arm/mach-bcm/board_bcm2835.c b/arch/arm/mach-bcm/board_bcm2835.c +index 3b68a8d..e72e522 100644 +--- a/arch/arm/mach-bcm/board_bcm2835.c ++++ b/arch/arm/mach-bcm/board_bcm2835.c +@@ -22,6 +22,29 @@ + #include <asm/mach/arch.h> + #include <asm/mach/map.h> + ++/* Use this hack until a proper solution is agreed upon */ ++static void __init bcm2835_init_uart1(void) ++{ ++ struct device_node *np; ++ ++ np = of_find_compatible_node(NULL, NULL, "brcm,bcm2835-aux-uart"); ++ if (of_device_is_available(np)) { ++ np = of_find_compatible_node(NULL, NULL, ++ "bcrm,bcm2835-aux-enable"); ++ if (np) { ++ void __iomem *base = of_iomap(np, 0); ++ ++ if (!base) { ++ pr_err("bcm2835: Failed enabling Mini UART\n"); ++ return; ++ } ++ ++ writel(1, base); ++ pr_info("bcm2835: Mini UART enabled\n"); ++ } ++ } ++} ++ + static void __init bcm2835_init(void) + { + struct device_node *np = of_find_node_by_path("/system"); +@@ -42,6 +65,8 @@ static void __init bcm2835_init(void) + system_rev = val; + if (!of_property_read_u64(np, "linux,serial", &val64)) + system_serial_low = val64; ++ ++ bcm2835_init_uart1(); + } + + static const char * const bcm2835_compat[] = { + +From 6d0faf9fef879b1ba6ee3796d07a63fac5984151 Mon Sep 17 00:00:00 2001 +From: popcornmix <popcornmix@gmail.com> +Date: Mon, 25 Jan 2016 17:25:12 +0000 +Subject: [PATCH 029/112] firmware: Updated mailbox header + +--- + include/soc/bcm2835/raspberrypi-firmware.h | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/include/soc/bcm2835/raspberrypi-firmware.h b/include/soc/bcm2835/raspberrypi-firmware.h +index 3fb3571..227a107 100644 +--- a/include/soc/bcm2835/raspberrypi-firmware.h ++++ b/include/soc/bcm2835/raspberrypi-firmware.h +@@ -63,6 +63,7 @@ enum rpi_firmware_property_tag { + RPI_FIRMWARE_GET_MIN_VOLTAGE = 0x00030008, + RPI_FIRMWARE_GET_TURBO = 0x00030009, + RPI_FIRMWARE_GET_MAX_TEMPERATURE = 0x0003000a, ++ RPI_FIRMWARE_GET_STC = 0x0003000b, + RPI_FIRMWARE_ALLOCATE_MEMORY = 0x0003000c, + RPI_FIRMWARE_LOCK_MEMORY = 0x0003000d, + RPI_FIRMWARE_UNLOCK_MEMORY = 0x0003000e, +@@ -72,12 +73,15 @@ enum rpi_firmware_property_tag { + RPI_FIRMWARE_SET_ENABLE_QPU = 0x00030012, + RPI_FIRMWARE_GET_DISPMANX_RESOURCE_MEM_HANDLE = 0x00030014, + RPI_FIRMWARE_GET_EDID_BLOCK = 0x00030020, ++ RPI_FIRMWARE_GET_CUSTOMER_OTP = 0x00030021, + RPI_FIRMWARE_GET_DOMAIN_STATE = 0x00030030, + RPI_FIRMWARE_SET_CLOCK_STATE = 0x00038001, + RPI_FIRMWARE_SET_CLOCK_RATE = 0x00038002, + RPI_FIRMWARE_SET_VOLTAGE = 0x00038003, + RPI_FIRMWARE_SET_TURBO = 0x00038009, ++ RPI_FIRMWARE_SET_CUSTOMER_OTP = 0x00038021, + RPI_FIRMWARE_SET_DOMAIN_STATE = 0x00038030, ++ RPI_FIRMWARE_SET_SDHOST_CLOCK = 0x00038042, + + /* Dispmanx TAGS */ + RPI_FIRMWARE_FRAMEBUFFER_ALLOCATE = 0x00040001, +@@ -91,6 +95,8 @@ enum rpi_firmware_property_tag { + RPI_FIRMWARE_FRAMEBUFFER_GET_VIRTUAL_OFFSET = 0x00040009, + RPI_FIRMWARE_FRAMEBUFFER_GET_OVERSCAN = 0x0004000a, + RPI_FIRMWARE_FRAMEBUFFER_GET_PALETTE = 0x0004000b, ++ RPI_FIRMWARE_FRAMEBUFFER_GET_TOUCHBUF = 0x0004000f, ++ RPI_FIRMWARE_FRAMEBUFFER_GET_GPIOVIRTBUF = 0x00040010, + RPI_FIRMWARE_FRAMEBUFFER_RELEASE = 0x00048001, + RPI_FIRMWARE_FRAMEBUFFER_TEST_PHYSICAL_WIDTH_HEIGHT = 0x00044003, + RPI_FIRMWARE_FRAMEBUFFER_TEST_VIRTUAL_WIDTH_HEIGHT = 0x00044004, +@@ -100,6 +106,7 @@ enum rpi_firmware_property_tag { + RPI_FIRMWARE_FRAMEBUFFER_TEST_VIRTUAL_OFFSET = 0x00044009, + RPI_FIRMWARE_FRAMEBUFFER_TEST_OVERSCAN = 0x0004400a, + RPI_FIRMWARE_FRAMEBUFFER_TEST_PALETTE = 0x0004400b, ++ RPI_FIRMWARE_FRAMEBUFFER_TEST_VSYNC = 0x0004400e, + RPI_FIRMWARE_FRAMEBUFFER_SET_PHYSICAL_WIDTH_HEIGHT = 0x00048003, + RPI_FIRMWARE_FRAMEBUFFER_SET_VIRTUAL_WIDTH_HEIGHT = 0x00048004, + RPI_FIRMWARE_FRAMEBUFFER_SET_DEPTH = 0x00048005, +@@ -108,6 +115,10 @@ enum rpi_firmware_property_tag { + RPI_FIRMWARE_FRAMEBUFFER_SET_VIRTUAL_OFFSET = 0x00048009, + RPI_FIRMWARE_FRAMEBUFFER_SET_OVERSCAN = 0x0004800a, + RPI_FIRMWARE_FRAMEBUFFER_SET_PALETTE = 0x0004800b, ++ RPI_FIRMWARE_FRAMEBUFFER_SET_VSYNC = 0x0004800e, ++ RPI_FIRMWARE_FRAMEBUFFER_SET_BACKLIGHT = 0x0004800f, ++ ++ RPI_FIRMWARE_VCHIQ_INIT = 0x00048010, + + RPI_FIRMWARE_GET_COMMAND_LINE = 0x00050001, + RPI_FIRMWARE_GET_DMA_CHANNELS = 0x00060001, + +From a29233f17de884f942e0d232deb042796dcb5788 Mon Sep 17 00:00:00 2001 +From: popcornmix <popcornmix@gmail.com> +Date: Sun, 12 May 2013 12:24:19 +0100 +Subject: [PATCH 030/112] Main bcm2708/bcm2709 linux port +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: popcornmix <popcornmix@gmail.com> +Signed-off-by: Noralf Trønnes <noralf@tronnes.org> +--- + arch/arm/Kconfig | 49 +++ + arch/arm/Kconfig.debug | 8 + + arch/arm/Makefile | 2 + + arch/arm/kernel/head.S | 8 + + arch/arm/kernel/process.c | 10 + + arch/arm/mach-bcm2708/Kconfig | 23 ++ + arch/arm/mach-bcm2708/Makefile | 5 + + arch/arm/mach-bcm2708/Makefile.boot | 3 + + arch/arm/mach-bcm2708/bcm2708.c | 231 ++++++++++++ + arch/arm/mach-bcm2708/include/mach/debug-macro.S | 22 ++ + arch/arm/mach-bcm2708/include/mach/io.h | 27 ++ + arch/arm/mach-bcm2708/include/mach/memory.h | 57 +++ + arch/arm/mach-bcm2708/include/mach/platform.h | 112 ++++++ + arch/arm/mach-bcm2708/include/mach/system.h | 37 ++ + arch/arm/mach-bcm2708/include/mach/uncompress.h | 84 +++++ + arch/arm/mach-bcm2708/include/mach/vmalloc.h | 20 ++ + arch/arm/mach-bcm2709/Kconfig | 16 + + arch/arm/mach-bcm2709/Makefile | 5 + + arch/arm/mach-bcm2709/Makefile.boot | 3 + + arch/arm/mach-bcm2709/bcm2709.c | 380 ++++++++++++++++++++ + arch/arm/mach-bcm2709/include/mach/debug-macro.S | 22 ++ + arch/arm/mach-bcm2709/include/mach/entry-macro.S | 123 +++++++ + arch/arm/mach-bcm2709/include/mach/io.h | 27 ++ + arch/arm/mach-bcm2709/include/mach/memory.h | 57 +++ + arch/arm/mach-bcm2709/include/mach/platform.h | 188 ++++++++++ + arch/arm/mach-bcm2709/include/mach/system.h | 37 ++ + arch/arm/mach-bcm2709/include/mach/uncompress.h | 84 +++++ + arch/arm/mach-bcm2709/include/mach/vc_mem.h | 35 ++ + arch/arm/mach-bcm2709/include/mach/vmalloc.h | 20 ++ + arch/arm/mach-bcm2709/vc_mem.c | 431 +++++++++++++++++++++++ + arch/arm/mm/proc-v6.S | 15 +- + arch/arm/tools/mach-types | 2 + + drivers/clocksource/Makefile | 2 +- + drivers/irqchip/Makefile | 3 + + drivers/irqchip/irq-bcm2835.c | 3 +- + include/linux/mmc/host.h | 1 + + 36 files changed, 2147 insertions(+), 5 deletions(-) + create mode 100644 arch/arm/mach-bcm2708/Kconfig + create mode 100644 arch/arm/mach-bcm2708/Makefile + create mode 100644 arch/arm/mach-bcm2708/Makefile.boot + create mode 100644 arch/arm/mach-bcm2708/bcm2708.c + create mode 100644 arch/arm/mach-bcm2708/include/mach/debug-macro.S + create mode 100644 arch/arm/mach-bcm2708/include/mach/io.h + create mode 100644 arch/arm/mach-bcm2708/include/mach/memory.h + create mode 100644 arch/arm/mach-bcm2708/include/mach/platform.h + create mode 100644 arch/arm/mach-bcm2708/include/mach/system.h + create mode 100644 arch/arm/mach-bcm2708/include/mach/uncompress.h + create mode 100644 arch/arm/mach-bcm2708/include/mach/vmalloc.h + create mode 100644 arch/arm/mach-bcm2709/Kconfig + create mode 100644 arch/arm/mach-bcm2709/Makefile + create mode 100644 arch/arm/mach-bcm2709/Makefile.boot + create mode 100644 arch/arm/mach-bcm2709/bcm2709.c + create mode 100644 arch/arm/mach-bcm2709/include/mach/debug-macro.S + create mode 100644 arch/arm/mach-bcm2709/include/mach/entry-macro.S + create mode 100644 arch/arm/mach-bcm2709/include/mach/io.h + create mode 100644 arch/arm/mach-bcm2709/include/mach/memory.h + create mode 100644 arch/arm/mach-bcm2709/include/mach/platform.h + create mode 100644 arch/arm/mach-bcm2709/include/mach/system.h + create mode 100644 arch/arm/mach-bcm2709/include/mach/uncompress.h + create mode 100644 arch/arm/mach-bcm2709/include/mach/vc_mem.h + create mode 100644 arch/arm/mach-bcm2709/include/mach/vmalloc.h + create mode 100644 arch/arm/mach-bcm2709/vc_mem.c + +diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig +index cdfa6c2..aad7157 100644 +--- a/arch/arm/Kconfig ++++ b/arch/arm/Kconfig +@@ -322,6 +322,52 @@ choice + default ARM_SINGLE_ARMV7M if !MMU + default ARCH_MULTIPLATFORM if MMU + ++config ARCH_BCM2708 ++ bool "Broadcom BCM2708 family" ++ select CPU_V6 ++ select ARM_AMBA ++ select CLKSRC_MMIO ++ select CLKSRC_OF if OF ++ select HAVE_SCHED_CLOCK ++ select NEED_MACH_GPIO_H ++ select NEED_MACH_MEMORY_H ++ select COMMON_CLK ++ select ARCH_HAS_CPUFREQ ++ select GENERIC_CLOCKEVENTS ++ select ARM_ERRATA_411920 ++ select MACH_BCM2708 ++ select MULTI_IRQ_HANDLER ++ select SPARSE_IRQ ++ select VC4 ++ select FIQ ++ help ++ This enables support for Broadcom BCM2708 boards. ++ ++config ARCH_BCM2709 ++ bool "Broadcom BCM2709 family" ++ select CPU_V7 ++ select HAVE_SMP ++ select ARM_AMBA ++ select MIGHT_HAVE_CACHE_L2X0 ++ select HAVE_SCHED_CLOCK ++ select NEED_MACH_MEMORY_H ++ select NEED_MACH_IO_H ++ select COMMON_CLK ++ select ARCH_HAS_CPUFREQ ++ select GENERIC_CLOCKEVENTS ++ select MACH_BCM2709 ++ select MULTI_IRQ_HANDLER ++ select SPARSE_IRQ ++ select MFD_SYSCON ++ select VC4 ++ select FIQ ++ select USE_OF ++ select ARCH_REQUIRE_GPIOLIB ++ select PINCTRL ++ select PINCTRL_BCM2835 ++ help ++ This enables support for Broadcom BCM2709 boards. ++ + config ARCH_MULTIPLATFORM + bool "Allow multiple platforms to be selected" + depends on MMU +@@ -721,6 +767,9 @@ config ARCH_VIRT + # Kconfigs may be included either alphabetically (according to the + # plat- suffix) or along side the corresponding mach-* source. + # ++source "arch/arm/mach-bcm2708/Kconfig" ++source "arch/arm/mach-bcm2709/Kconfig" ++ + source "arch/arm/mach-mvebu/Kconfig" + + source "arch/arm/mach-alpine/Kconfig" +diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug +index 1098e91..e119675 100644 +--- a/arch/arm/Kconfig.debug ++++ b/arch/arm/Kconfig.debug +@@ -1302,6 +1302,14 @@ choice + options; the platform specific options are deprecated + and will be soon removed. + ++ config DEBUG_BCM2708_UART0 ++ bool "Broadcom BCM270X UART0 (PL011)" ++ depends on ARCH_BCM2708 || ARCH_BCM2709 ++ help ++ Say Y here if you want the debug print routines to direct ++ their output to UART 0. The port must have been initialised ++ by the boot-loader before use. ++ + endchoice + + config DEBUG_EXYNOS_UART +diff --git a/arch/arm/Makefile b/arch/arm/Makefile +index 8c3ce2a..c4d7d10 100644 +--- a/arch/arm/Makefile ++++ b/arch/arm/Makefile +@@ -153,6 +153,8 @@ textofs-$(CONFIG_ARCH_AXXIA) := 0x00308000 + + # Machine directory name. This list is sorted alphanumerically + # by CONFIG_* macro name. ++machine-$(CONFIG_ARCH_BCM2708) += bcm2708 ++machine-$(CONFIG_ARCH_BCM2709) += bcm2709 + machine-$(CONFIG_ARCH_ALPINE) += alpine + machine-$(CONFIG_ARCH_ARTPEC) += artpec + machine-$(CONFIG_ARCH_AT91) += at91 +diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S +index 04286fd..ed82628 100644 +--- a/arch/arm/kernel/head.S ++++ b/arch/arm/kernel/head.S +@@ -700,6 +700,14 @@ ARM_BE8(rev16 ip, ip) + ldrcc r7, [r4], #4 @ use branch for delay slot + bcc 1b + ret lr ++ nop ++ nop ++ nop ++ nop ++ nop ++ nop ++ nop ++ nop + #endif + ENDPROC(__fixup_a_pv_table) + +diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c +index 4adfb46..69aad0e 100644 +--- a/arch/arm/kernel/process.c ++++ b/arch/arm/kernel/process.c +@@ -91,6 +91,16 @@ void arch_cpu_idle_exit(void) + ledtrig_cpu(CPU_LED_IDLE_END); + } + ++char bcm2708_reboot_mode = 'h'; ++ ++int __init reboot_setup(char *str) ++{ ++ bcm2708_reboot_mode = str[0]; ++ return 1; ++} ++ ++__setup("reboot=", reboot_setup); ++ + void __show_regs(struct pt_regs *regs) + { + unsigned long flags; +diff --git a/arch/arm/mach-bcm2708/Kconfig b/arch/arm/mach-bcm2708/Kconfig +new file mode 100644 +index 0000000..6eabe84 +--- /dev/null ++++ b/arch/arm/mach-bcm2708/Kconfig +@@ -0,0 +1,23 @@ ++menu "Broadcom BCM2708 Implementations" ++ depends on ARCH_BCM2708 ++ ++config MACH_BCM2708 ++ bool "Broadcom BCM2708 Development Platform" ++ select NEED_MACH_MEMORY_H ++ select NEED_MACH_IO_H ++ select CPU_V6 ++ select USE_OF ++ select ARCH_REQUIRE_GPIOLIB ++ select PINCTRL ++ select PINCTRL_BCM2835 ++ help ++ Include support for the Broadcom(R) BCM2708 platform. ++ ++config BCM2708_NOL2CACHE ++ bool "Videocore L2 cache disable" ++ depends on MACH_BCM2708 ++ default n ++ help ++ Do not allow ARM to use GPU's L2 cache. Requires disable_l2cache in config.txt. ++ ++endmenu +diff --git a/arch/arm/mach-bcm2708/Makefile b/arch/arm/mach-bcm2708/Makefile +new file mode 100644 +index 0000000..3da1a1b +--- /dev/null ++++ b/arch/arm/mach-bcm2708/Makefile +@@ -0,0 +1,5 @@ ++# ++# Makefile for the linux kernel. ++# ++ ++obj-$(CONFIG_MACH_BCM2708) += bcm2708.o +diff --git a/arch/arm/mach-bcm2708/Makefile.boot b/arch/arm/mach-bcm2708/Makefile.boot +new file mode 100644 +index 0000000..67039c3 +--- /dev/null ++++ b/arch/arm/mach-bcm2708/Makefile.boot +@@ -0,0 +1,3 @@ ++ zreladdr-y := 0x00008000 ++params_phys-y := 0x00000100 ++initrd_phys-y := 0x00800000 +diff --git a/arch/arm/mach-bcm2708/bcm2708.c b/arch/arm/mach-bcm2708/bcm2708.c +new file mode 100644 +index 0000000..280628b +--- /dev/null ++++ b/arch/arm/mach-bcm2708/bcm2708.c +@@ -0,0 +1,231 @@ ++/* ++ * linux/arch/arm/mach-bcm2708/bcm2708.c ++ * ++ * Copyright (C) 2010 Broadcom ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ */ ++ ++#include <linux/init.h> ++#include <linux/dma-mapping.h> ++#include <linux/module.h> ++#include <linux/of_platform.h> ++#include <asm/system_info.h> ++#include <asm/mach-types.h> ++#include <asm/mach/arch.h> ++#include <asm/mach/map.h> ++ ++#include <mach/system.h> ++ ++#include <linux/broadcom/vc_cma.h> ++ ++/* Effectively we have an IOMMU (ARM<->VideoCore map) that is set up to ++ * give us IO access only to 64Mbytes of physical memory (26 bits). We could ++ * represent this window by setting our dmamasks to 26 bits but, in fact ++ * we're not going to use addresses outside this range (they're not in real ++ * memory) so we don't bother. ++ * ++ * In the future we might include code to use this IOMMU to remap other ++ * physical addresses onto VideoCore memory then the use of 32-bits would be ++ * more legitimate. ++ */ ++ ++/* command line parameters */ ++static unsigned boardrev, serial; ++static unsigned reboot_part = 0; ++ ++static struct map_desc bcm2708_io_desc[] __initdata = { ++ { ++ .virtual = IO_ADDRESS(ARMCTRL_BASE), ++ .pfn = __phys_to_pfn(ARMCTRL_BASE), ++ .length = SZ_4K, ++ .type = MT_DEVICE}, ++ { ++ .virtual = IO_ADDRESS(UART0_BASE), ++ .pfn = __phys_to_pfn(UART0_BASE), ++ .length = SZ_4K, ++ .type = MT_DEVICE}, ++ { ++ .virtual = IO_ADDRESS(UART1_BASE), ++ .pfn = __phys_to_pfn(UART1_BASE), ++ .length = SZ_4K, ++ .type = MT_DEVICE}, ++ { ++ .virtual = IO_ADDRESS(DMA_BASE), ++ .pfn = __phys_to_pfn(DMA_BASE), ++ .length = SZ_4K, ++ .type = MT_DEVICE}, ++ { ++ .virtual = IO_ADDRESS(MCORE_BASE), ++ .pfn = __phys_to_pfn(MCORE_BASE), ++ .length = SZ_4K, ++ .type = MT_DEVICE}, ++ { ++ .virtual = IO_ADDRESS(ST_BASE), ++ .pfn = __phys_to_pfn(ST_BASE), ++ .length = SZ_4K, ++ .type = MT_DEVICE}, ++ { ++ .virtual = IO_ADDRESS(USB_BASE), ++ .pfn = __phys_to_pfn(USB_BASE), ++ .length = SZ_128K, ++ .type = MT_DEVICE}, ++ { ++ .virtual = IO_ADDRESS(PM_BASE), ++ .pfn = __phys_to_pfn(PM_BASE), ++ .length = SZ_4K, ++ .type = MT_DEVICE}, ++ { ++ .virtual = IO_ADDRESS(GPIO_BASE), ++ .pfn = __phys_to_pfn(GPIO_BASE), ++ .length = SZ_4K, ++ .type = MT_DEVICE} ++}; ++ ++void __init bcm2708_map_io(void) ++{ ++ iotable_init(bcm2708_io_desc, ARRAY_SIZE(bcm2708_io_desc)); ++} ++ ++int calc_rsts(int partition) ++{ ++ return PM_PASSWORD | ++ ((partition & (1 << 0)) << 0) | ++ ((partition & (1 << 1)) << 1) | ++ ((partition & (1 << 2)) << 2) | ++ ((partition & (1 << 3)) << 3) | ++ ((partition & (1 << 4)) << 4) | ++ ((partition & (1 << 5)) << 5); ++} ++ ++static void bcm2708_restart(enum reboot_mode mode, const char *cmd) ++{ ++ extern char bcm2708_reboot_mode; ++ uint32_t pm_rstc, pm_wdog; ++ uint32_t timeout = 10; ++ uint32_t pm_rsts = 0; ++ ++ if(bcm2708_reboot_mode == 'q') ++ { ++ // NOOBS < 1.3 booting with reboot=q ++ pm_rsts = readl(__io_address(PM_RSTS)); ++ pm_rsts = PM_PASSWORD | pm_rsts | PM_RSTS_HADWRQ_SET; ++ } ++ else if(bcm2708_reboot_mode == 'p') ++ { ++ // NOOBS < 1.3 halting ++ pm_rsts = readl(__io_address(PM_RSTS)); ++ pm_rsts = PM_PASSWORD | pm_rsts | PM_RSTS_HADWRH_SET; ++ } ++ else ++ { ++ pm_rsts = calc_rsts(reboot_part); ++ } ++ ++ writel(pm_rsts, __io_address(PM_RSTS)); ++ ++ /* Setup watchdog for reset */ ++ pm_rstc = readl(__io_address(PM_RSTC)); ++ ++ pm_wdog = PM_PASSWORD | (timeout & PM_WDOG_TIME_SET); // watchdog timer = timer clock / 16; need password (31:16) + value (11:0) ++ pm_rstc = PM_PASSWORD | (pm_rstc & PM_RSTC_WRCFG_CLR) | PM_RSTC_WRCFG_FULL_RESET; ++ ++ writel(pm_wdog, __io_address(PM_WDOG)); ++ writel(pm_rstc, __io_address(PM_RSTC)); ++} ++ ++/* We can't really power off, but if we do the normal reset scheme, and indicate to bootcode.bin not to reboot, then most of the chip will be powered off */ ++static void bcm2708_power_off(void) ++{ ++ extern char bcm2708_reboot_mode; ++ if(bcm2708_reboot_mode == 'q') ++ { ++ // NOOBS < v1.3 ++ bcm2708_restart('p', ""); ++ } ++ else ++ { ++ /* partition 63 is special code for HALT the bootloader knows not to boot*/ ++ reboot_part = 63; ++ /* continue with normal reset mechanism */ ++ bcm2708_restart(0, ""); ++ } ++} ++ ++static void __init bcm2708_init_uart1(void) ++{ ++ struct device_node *np; ++ ++ np = of_find_compatible_node(NULL, NULL, "brcm,bcm2835-aux-uart"); ++ if (of_device_is_available(np)) { ++ pr_info("bcm2708: Mini UART enabled\n"); ++ writel(1, __io_address(UART1_BASE + 0x4)); ++ } ++} ++ ++void __init bcm2708_init(void) ++{ ++ int ret; ++ ++ vc_cma_early_init(); ++ ++ pm_power_off = bcm2708_power_off; ++ ++ ret = of_platform_populate(NULL, of_default_bus_match_table, NULL, ++ NULL); ++ if (ret) { ++ pr_err("of_platform_populate failed: %d\n", ret); ++ BUG(); ++ } ++ ++ bcm2708_init_uart1(); ++ ++ system_rev = boardrev; ++ system_serial_low = serial; ++} ++ ++void __init bcm2708_init_early(void) ++{ ++ /* ++ * Some devices allocate their coherent buffers from atomic ++ * context. Increase size of atomic coherent pool to make sure such ++ * the allocations won't fail. ++ */ ++ init_dma_coherent_pool_size(SZ_4M); ++} ++ ++static void __init board_reserve(void) ++{ ++ vc_cma_reserve(); ++} ++ ++static const char * const bcm2708_compat[] = { ++ "brcm,bcm2708", ++ NULL ++}; ++ ++MACHINE_START(BCM2708, "BCM2708") ++ /* Maintainer: Broadcom Europe Ltd. */ ++ .map_io = bcm2708_map_io, ++ .init_machine = bcm2708_init, ++ .init_early = bcm2708_init_early, ++ .reserve = board_reserve, ++ .restart = bcm2708_restart, ++ .dt_compat = bcm2708_compat, ++MACHINE_END ++ ++module_param(boardrev, uint, 0644); ++module_param(serial, uint, 0644); ++module_param(reboot_part, uint, 0644); +diff --git a/arch/arm/mach-bcm2708/include/mach/debug-macro.S b/arch/arm/mach-bcm2708/include/mach/debug-macro.S +new file mode 100644 +index 0000000..b24304a +--- /dev/null ++++ b/arch/arm/mach-bcm2708/include/mach/debug-macro.S +@@ -0,0 +1,22 @@ ++/* arch/arm/mach-bcm2708/include/mach/debug-macro.S ++ * ++ * Debugging macro include header ++ * ++ * Copyright (C) 2010 Broadcom ++ * Copyright (C) 1994-1999 Russell King ++ * Moved from linux/arch/arm/kernel/debug.S by Ben Dooks ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 as ++ * published by the Free Software Foundation. ++ * ++*/ ++ ++#include <mach/platform.h> ++ ++ .macro addruart, rp, rv, tmp ++ ldr \rp, =UART0_BASE ++ ldr \rv, =IO_ADDRESS(UART0_BASE) ++ .endm ++ ++#include <debug/pl01x.S> +diff --git a/arch/arm/mach-bcm2708/include/mach/io.h b/arch/arm/mach-bcm2708/include/mach/io.h +new file mode 100644 +index 0000000..e6eb84d +--- /dev/null ++++ b/arch/arm/mach-bcm2708/include/mach/io.h +@@ -0,0 +1,27 @@ ++/* ++ * arch/arm/mach-bcm2708/include/mach/io.h ++ * ++ * Copyright (C) 2003 ARM Limited ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ */ ++#ifndef __ASM_ARM_ARCH_IO_H ++#define __ASM_ARM_ARCH_IO_H ++ ++#define IO_SPACE_LIMIT 0xffffffff ++ ++#define __io(a) __typesafe_io(a) ++ ++#endif +diff --git a/arch/arm/mach-bcm2708/include/mach/memory.h b/arch/arm/mach-bcm2708/include/mach/memory.h +new file mode 100644 +index 0000000..7548a52 +--- /dev/null ++++ b/arch/arm/mach-bcm2708/include/mach/memory.h +@@ -0,0 +1,57 @@ ++/* ++ * arch/arm/mach-bcm2708/include/mach/memory.h ++ * ++ * Copyright (C) 2010 Broadcom ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ */ ++#ifndef __ASM_ARCH_MEMORY_H ++#define __ASM_ARCH_MEMORY_H ++ ++/* Memory overview: ++ ++ [ARMcore] <--virtual addr--> ++ [ARMmmu] <--physical addr--> ++ [GERTmap] <--bus add--> ++ [VCperiph] ++ ++*/ ++ ++/* ++ * Physical DRAM offset. ++ */ ++#define BCM_PLAT_PHYS_OFFSET UL(0x00000000) ++#define VC_ARMMEM_OFFSET UL(0x00000000) /* offset in VC of ARM memory */ ++ ++#ifdef CONFIG_BCM2708_NOL2CACHE ++ #define _REAL_BUS_OFFSET UL(0xC0000000) /* don't use L1 or L2 caches */ ++#else ++ #define _REAL_BUS_OFFSET UL(0x40000000) /* use L2 cache */ ++#endif ++ ++/* We're using the memory at 64M in the VideoCore for Linux - this adjustment ++ * will provide the offset into this area as well as setting the bits that ++ * stop the L1 and L2 cache from being used ++ * ++ * WARNING: this only works because the ARM is given memory at a fixed location ++ * (ARMMEM_OFFSET) ++ */ ++#define BUS_OFFSET (VC_ARMMEM_OFFSET + _REAL_BUS_OFFSET) ++#define __virt_to_bus(x) ((x) + (BUS_OFFSET - PAGE_OFFSET)) ++#define __bus_to_virt(x) ((x) - (BUS_OFFSET - PAGE_OFFSET)) ++#define __pfn_to_bus(x) (__pfn_to_phys(x) + (BUS_OFFSET - BCM_PLAT_PHYS_OFFSET)) ++#define __bus_to_pfn(x) __phys_to_pfn((x) - (BUS_OFFSET - BCM_PLAT_PHYS_OFFSET)) ++ ++#endif +diff --git a/arch/arm/mach-bcm2708/include/mach/platform.h b/arch/arm/mach-bcm2708/include/mach/platform.h +new file mode 100644 +index 0000000..4fb43cf +--- /dev/null ++++ b/arch/arm/mach-bcm2708/include/mach/platform.h +@@ -0,0 +1,112 @@ ++/* ++ * arch/arm/mach-bcm2708/include/mach/platform.h ++ * ++ * Copyright (C) 2010 Broadcom ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ */ ++ ++#ifndef _BCM2708_PLATFORM_H ++#define _BCM2708_PLATFORM_H ++ ++ ++/* macros to get at IO space when running virtually */ ++#define IO_ADDRESS(x) (((x) & 0x0fffffff) + (((x) >> 4) & 0x0f000000) + 0xf0000000) ++ ++#define __io_address(n) IOMEM(IO_ADDRESS(n)) ++ ++ ++/* ++ * SDRAM ++ */ ++#define BCM2708_SDRAM_BASE 0x00000000 ++ ++/* ++ * Logic expansion modules ++ * ++ */ ++ ++ ++/* ------------------------------------------------------------------------ ++ * BCM2708 ARMCTRL Registers ++ * ------------------------------------------------------------------------ ++ */ ++ ++#define HW_REGISTER_RW(addr) (addr) ++#define HW_REGISTER_RO(addr) (addr) ++ ++/* ++ * Definitions and addresses for the ARM CONTROL logic ++ * This file is manually generated. ++ */ ++ ++#define BCM2708_PERI_BASE 0x20000000 ++#define IC0_BASE (BCM2708_PERI_BASE + 0x2000) ++#define ST_BASE (BCM2708_PERI_BASE + 0x3000) /* System Timer */ ++#define MPHI_BASE (BCM2708_PERI_BASE + 0x6000) /* Message -based Parallel Host Interface */ ++#define DMA_BASE (BCM2708_PERI_BASE + 0x7000) /* DMA controller */ ++#define ARM_BASE (BCM2708_PERI_BASE + 0xB000) /* BCM2708 ARM control block */ ++#define PM_BASE (BCM2708_PERI_BASE + 0x100000) /* Power Management, Reset controller and Watchdog registers */ ++#define PCM_CLOCK_BASE (BCM2708_PERI_BASE + 0x101098) /* PCM Clock */ ++#define RNG_BASE (BCM2708_PERI_BASE + 0x104000) /* Hardware RNG */ ++#define GPIO_BASE (BCM2708_PERI_BASE + 0x200000) /* GPIO */ ++#define UART0_BASE (BCM2708_PERI_BASE + 0x201000) /* Uart 0 */ ++#define MMCI0_BASE (BCM2708_PERI_BASE + 0x202000) /* MMC interface */ ++#define I2S_BASE (BCM2708_PERI_BASE + 0x203000) /* I2S */ ++#define SPI0_BASE (BCM2708_PERI_BASE + 0x204000) /* SPI0 */ ++#define BSC0_BASE (BCM2708_PERI_BASE + 0x205000) /* BSC0 I2C/TWI */ ++#define UART1_BASE (BCM2708_PERI_BASE + 0x215000) /* Uart 1 */ ++#define EMMC_BASE (BCM2708_PERI_BASE + 0x300000) /* eMMC interface */ ++#define SMI_BASE (BCM2708_PERI_BASE + 0x600000) /* SMI */ ++#define BSC1_BASE (BCM2708_PERI_BASE + 0x804000) /* BSC1 I2C/TWI */ ++#define USB_BASE (BCM2708_PERI_BASE + 0x980000) /* DTC_OTG USB controller */ ++#define MCORE_BASE (BCM2708_PERI_BASE + 0x0000) /* Fake frame buffer device (actually the multicore sync block*/ ++ ++#define ARMCTRL_BASE (ARM_BASE + 0x000) ++#define ARMCTRL_IC_BASE (ARM_BASE + 0x200) /* ARM interrupt controller */ ++#define ARMCTRL_TIMER0_1_BASE (ARM_BASE + 0x400) /* Timer 0 and 1 */ ++#define ARMCTRL_0_SBM_BASE (ARM_BASE + 0x800) /* User 0 (ARM)'s Semaphores Doorbells and Mailboxes */ ++ ++/* ++ * Watchdog ++ */ ++#define PM_RSTC (PM_BASE+0x1c) ++#define PM_RSTS (PM_BASE+0x20) ++#define PM_WDOG (PM_BASE+0x24) ++ ++#define PM_WDOG_RESET 0000000000 ++#define PM_PASSWORD 0x5a000000 ++#define PM_WDOG_TIME_SET 0x000fffff ++#define PM_RSTC_WRCFG_CLR 0xffffffcf ++#define PM_RSTC_WRCFG_SET 0x00000030 ++#define PM_RSTC_WRCFG_FULL_RESET 0x00000020 ++#define PM_RSTC_RESET 0x00000102 ++ ++#define PM_RSTS_HADPOR_SET 0x00001000 ++#define PM_RSTS_HADSRH_SET 0x00000400 ++#define PM_RSTS_HADSRF_SET 0x00000200 ++#define PM_RSTS_HADSRQ_SET 0x00000100 ++#define PM_RSTS_HADWRH_SET 0x00000040 ++#define PM_RSTS_HADWRF_SET 0x00000020 ++#define PM_RSTS_HADWRQ_SET 0x00000010 ++#define PM_RSTS_HADDRH_SET 0x00000004 ++#define PM_RSTS_HADDRF_SET 0x00000002 ++#define PM_RSTS_HADDRQ_SET 0x00000001 ++ ++#define UART0_CLOCK 3000000 ++ ++#endif ++ ++/* END */ +diff --git a/arch/arm/mach-bcm2708/include/mach/system.h b/arch/arm/mach-bcm2708/include/mach/system.h +new file mode 100644 +index 0000000..c9a9c9a +--- /dev/null ++++ b/arch/arm/mach-bcm2708/include/mach/system.h +@@ -0,0 +1,37 @@ ++/* ++ * arch/arm/mach-bcm2708/include/mach/system.h ++ * ++ * Copyright (C) 2010 Broadcom ++ * Copyright (C) 2003 ARM Limited ++ * Copyright (C) 2000 Deep Blue Solutions Ltd ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ */ ++#ifndef __ASM_ARCH_SYSTEM_H ++#define __ASM_ARCH_SYSTEM_H ++ ++#include <linux/io.h> ++#include <mach/platform.h> ++ ++static inline void arch_idle(void) ++{ ++ /* ++ * This should do all the clock switching ++ * and wait for interrupt tricks ++ */ ++ cpu_do_idle(); ++} ++ ++#endif +diff --git a/arch/arm/mach-bcm2708/include/mach/uncompress.h b/arch/arm/mach-bcm2708/include/mach/uncompress.h +new file mode 100644 +index 0000000..de7504b +--- /dev/null ++++ b/arch/arm/mach-bcm2708/include/mach/uncompress.h +@@ -0,0 +1,84 @@ ++/* ++ * arch/arm/mach-bcn2708/include/mach/uncompress.h ++ * ++ * Copyright (C) 2010 Broadcom ++ * Copyright (C) 2003 ARM Limited ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ */ ++ ++#include <linux/io.h> ++#include <linux/amba/serial.h> ++#include <mach/platform.h> ++ ++#define UART_BAUD 115200 ++ ++#define BCM2708_UART_DR __io(UART0_BASE + UART01x_DR) ++#define BCM2708_UART_FR __io(UART0_BASE + UART01x_FR) ++#define BCM2708_UART_IBRD __io(UART0_BASE + UART011_IBRD) ++#define BCM2708_UART_FBRD __io(UART0_BASE + UART011_FBRD) ++#define BCM2708_UART_LCRH __io(UART0_BASE + UART011_LCRH) ++#define BCM2708_UART_CR __io(UART0_BASE + UART011_CR) ++ ++/* ++ * This does not append a newline ++ */ ++static inline void putc(int c) ++{ ++ while (__raw_readl(BCM2708_UART_FR) & UART01x_FR_TXFF) ++ barrier(); ++ ++ __raw_writel(c, BCM2708_UART_DR); ++} ++ ++static inline void flush(void) ++{ ++ int fr; ++ ++ do { ++ fr = __raw_readl(BCM2708_UART_FR); ++ barrier(); ++ } while ((fr & (UART011_FR_TXFE | UART01x_FR_BUSY)) != UART011_FR_TXFE); ++} ++ ++static inline void arch_decomp_setup(void) ++{ ++ int temp, div, rem, frac; ++ ++ temp = 16 * UART_BAUD; ++ div = UART0_CLOCK / temp; ++ rem = UART0_CLOCK % temp; ++ temp = (8 * rem) / UART_BAUD; ++ frac = (temp >> 1) + (temp & 1); ++ ++ /* Make sure the UART is disabled before we start */ ++ __raw_writel(0, BCM2708_UART_CR); ++ ++ /* Set the baud rate */ ++ __raw_writel(div, BCM2708_UART_IBRD); ++ __raw_writel(frac, BCM2708_UART_FBRD); ++ ++ /* Set the UART to 8n1, FIFO enabled */ ++ __raw_writel(UART01x_LCRH_WLEN_8 | UART01x_LCRH_FEN, BCM2708_UART_LCRH); ++ ++ /* Enable the UART */ ++ __raw_writel(UART01x_CR_UARTEN | UART011_CR_TXE | UART011_CR_RXE, ++ BCM2708_UART_CR); ++} ++ ++/* ++ * nothing to do ++ */ ++#define arch_decomp_wdog() +diff --git a/arch/arm/mach-bcm2708/include/mach/vmalloc.h b/arch/arm/mach-bcm2708/include/mach/vmalloc.h +new file mode 100644 +index 0000000..502c617 +--- /dev/null ++++ b/arch/arm/mach-bcm2708/include/mach/vmalloc.h +@@ -0,0 +1,20 @@ ++/* ++ * arch/arm/mach-bcm2708/include/mach/vmalloc.h ++ * ++ * Copyright (C) 2010 Broadcom ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ */ ++#define VMALLOC_END (0xe8000000) +diff --git a/arch/arm/mach-bcm2709/Kconfig b/arch/arm/mach-bcm2709/Kconfig +new file mode 100644 +index 0000000..643b4b9 +--- /dev/null ++++ b/arch/arm/mach-bcm2709/Kconfig +@@ -0,0 +1,16 @@ ++menu "Broadcom BCM2709 Implementations" ++ depends on ARCH_BCM2709 ++ ++config MACH_BCM2709 ++ bool "Broadcom BCM2709 Development Platform" ++ help ++ Include support for the Broadcom(R) BCM2709 platform. ++ ++config BCM2708_NOL2CACHE ++ bool "Videocore L2 cache disable" ++ depends on MACH_BCM2709 ++ default y ++ help ++ Do not allow ARM to use GPU's L2 cache. Requires disable_l2cache in config.txt. ++ ++endmenu +diff --git a/arch/arm/mach-bcm2709/Makefile b/arch/arm/mach-bcm2709/Makefile +new file mode 100644 +index 0000000..26cd67d +--- /dev/null ++++ b/arch/arm/mach-bcm2709/Makefile +@@ -0,0 +1,5 @@ ++# ++# Makefile for the linux kernel. ++# ++ ++obj-$(CONFIG_MACH_BCM2709) += bcm2709.o +diff --git a/arch/arm/mach-bcm2709/Makefile.boot b/arch/arm/mach-bcm2709/Makefile.boot +new file mode 100644 +index 0000000..67039c3 +--- /dev/null ++++ b/arch/arm/mach-bcm2709/Makefile.boot +@@ -0,0 +1,3 @@ ++ zreladdr-y := 0x00008000 ++params_phys-y := 0x00000100 ++initrd_phys-y := 0x00800000 +diff --git a/arch/arm/mach-bcm2709/bcm2709.c b/arch/arm/mach-bcm2709/bcm2709.c +new file mode 100644 +index 0000000..90773a3 +--- /dev/null ++++ b/arch/arm/mach-bcm2709/bcm2709.c +@@ -0,0 +1,380 @@ ++/* ++ * linux/arch/arm/mach-bcm2709/bcm2709.c ++ * ++ * Copyright (C) 2010 Broadcom ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ */ ++ ++#include <linux/init.h> ++#include <linux/dma-mapping.h> ++#include <linux/interrupt.h> ++#include <linux/clk-provider.h> ++#include <linux/clocksource.h> ++#include <linux/io.h> ++#include <linux/module.h> ++#include <linux/of_platform.h> ++ ++#include <asm/system_info.h> ++#include <asm/mach-types.h> ++#include <asm/cputype.h> ++ ++#include <asm/mach/arch.h> ++#include <asm/mach/map.h> ++ ++#include <mach/system.h> ++ ++#include <linux/broadcom/vc_cma.h> ++ ++/* Effectively we have an IOMMU (ARM<->VideoCore map) that is set up to ++ * give us IO access only to 64Mbytes of physical memory (26 bits). We could ++ * represent this window by setting our dmamasks to 26 bits but, in fact ++ * we're not going to use addresses outside this range (they're not in real ++ * memory) so we don't bother. ++ * ++ * In the future we might include code to use this IOMMU to remap other ++ * physical addresses onto VideoCore memory then the use of 32-bits would be ++ * more legitimate. ++ */ ++ ++/* command line parameters */ ++static unsigned boardrev, serial; ++static unsigned reboot_part = 0; ++ ++static struct map_desc bcm2709_io_desc[] __initdata = { ++ { ++ .virtual = IO_ADDRESS(ARMCTRL_BASE), ++ .pfn = __phys_to_pfn(ARMCTRL_BASE), ++ .length = SZ_4K, ++ .type = MT_DEVICE}, ++ { ++ .virtual = IO_ADDRESS(UART0_BASE), ++ .pfn = __phys_to_pfn(UART0_BASE), ++ .length = SZ_4K, ++ .type = MT_DEVICE}, ++ { ++ .virtual = IO_ADDRESS(UART1_BASE), ++ .pfn = __phys_to_pfn(UART1_BASE), ++ .length = SZ_4K, ++ .type = MT_DEVICE}, ++ { ++ .virtual = IO_ADDRESS(DMA_BASE), ++ .pfn = __phys_to_pfn(DMA_BASE), ++ .length = SZ_4K, ++ .type = MT_DEVICE}, ++ { ++ .virtual = IO_ADDRESS(MCORE_BASE), ++ .pfn = __phys_to_pfn(MCORE_BASE), ++ .length = SZ_4K, ++ .type = MT_DEVICE}, ++ { ++ .virtual = IO_ADDRESS(ST_BASE), ++ .pfn = __phys_to_pfn(ST_BASE), ++ .length = SZ_4K, ++ .type = MT_DEVICE}, ++ { ++ .virtual = IO_ADDRESS(USB_BASE), ++ .pfn = __phys_to_pfn(USB_BASE), ++ .length = SZ_128K, ++ .type = MT_DEVICE}, ++ { ++ .virtual = IO_ADDRESS(PM_BASE), ++ .pfn = __phys_to_pfn(PM_BASE), ++ .length = SZ_4K, ++ .type = MT_DEVICE}, ++ { ++ .virtual = IO_ADDRESS(GPIO_BASE), ++ .pfn = __phys_to_pfn(GPIO_BASE), ++ .length = SZ_4K, ++ .type = MT_DEVICE}, ++ { ++ .virtual = IO_ADDRESS(ARM_LOCAL_BASE), ++ .pfn = __phys_to_pfn(ARM_LOCAL_BASE), ++ .length = SZ_4K, ++ .type = MT_DEVICE}, ++}; ++ ++void __init bcm2709_map_io(void) ++{ ++ iotable_init(bcm2709_io_desc, ARRAY_SIZE(bcm2709_io_desc)); ++} ++ ++int calc_rsts(int partition) ++{ ++ return PM_PASSWORD | ++ ((partition & (1 << 0)) << 0) | ++ ((partition & (1 << 1)) << 1) | ++ ((partition & (1 << 2)) << 2) | ++ ((partition & (1 << 3)) << 3) | ++ ((partition & (1 << 4)) << 4) | ++ ((partition & (1 << 5)) << 5); ++} ++ ++static void bcm2709_restart(enum reboot_mode mode, const char *cmd) ++{ ++ extern char bcm2708_reboot_mode; ++ uint32_t pm_rstc, pm_wdog; ++ uint32_t timeout = 10; ++ uint32_t pm_rsts = 0; ++ ++ if(bcm2708_reboot_mode == 'q') ++ { ++ // NOOBS < 1.3 booting with reboot=q ++ pm_rsts = readl(__io_address(PM_RSTS)); ++ pm_rsts = PM_PASSWORD | pm_rsts | PM_RSTS_HADWRQ_SET; ++ } ++ else if(bcm2708_reboot_mode == 'p') ++ { ++ // NOOBS < 1.3 halting ++ pm_rsts = readl(__io_address(PM_RSTS)); ++ pm_rsts = PM_PASSWORD | pm_rsts | PM_RSTS_HADWRH_SET; ++ } ++ else ++ { ++ pm_rsts = calc_rsts(reboot_part); ++ } ++ ++ writel(pm_rsts, __io_address(PM_RSTS)); ++ ++ /* Setup watchdog for reset */ ++ pm_rstc = readl(__io_address(PM_RSTC)); ++ ++ pm_wdog = PM_PASSWORD | (timeout & PM_WDOG_TIME_SET); // watchdog timer = timer clock / 16; need password (31:16) + value (11:0) ++ pm_rstc = PM_PASSWORD | (pm_rstc & PM_RSTC_WRCFG_CLR) | PM_RSTC_WRCFG_FULL_RESET; ++ ++ writel(pm_wdog, __io_address(PM_WDOG)); ++ writel(pm_rstc, __io_address(PM_RSTC)); ++} ++ ++/* We can't really power off, but if we do the normal reset scheme, and indicate to bootcode.bin not to reboot, then most of the chip will be powered off */ ++static void bcm2709_power_off(void) ++{ ++ extern char bcm2708_reboot_mode; ++ if(bcm2708_reboot_mode == 'q') ++ { ++ // NOOBS < v1.3 ++ bcm2709_restart('p', ""); ++ } ++ else ++ { ++ /* partition 63 is special code for HALT the bootloader knows not to boot*/ ++ reboot_part = 63; ++ /* continue with normal reset mechanism */ ++ bcm2709_restart(0, ""); ++ } ++} ++ ++static void __init bcm2709_init_uart1(void) ++{ ++ struct device_node *np; ++ ++ np = of_find_compatible_node(NULL, NULL, "brcm,bcm2835-aux-uart"); ++ if (of_device_is_available(np)) { ++ pr_info("bcm2709: Mini UART enabled\n"); ++ writel(1, __io_address(UART1_BASE + 0x4)); ++ } ++} ++ ++void __init bcm2709_init(void) ++{ ++ int ret; ++ ++ vc_cma_early_init(); ++ ++ pm_power_off = bcm2709_power_off; ++ ++ ret = of_platform_populate(NULL, of_default_bus_match_table, NULL, ++ NULL); ++ if (ret) { ++ pr_err("of_platform_populate failed: %d\n", ret); ++ BUG(); ++ } ++ ++ bcm2709_init_uart1(); ++ ++ system_rev = boardrev; ++ system_serial_low = serial; ++} ++ ++static void __init bcm2709_timer_init(void) ++{ ++ // timer control ++ writel(0, __io_address(ARM_LOCAL_CONTROL)); ++ // timer pre_scaler ++ writel(0x80000000, __io_address(ARM_LOCAL_PRESCALER)); // 19.2MHz ++ //writel(0x06AAAAAB, __io_address(ARM_LOCAL_PRESCALER)); // 1MHz ++ ++ of_clk_init(NULL); ++ clocksource_probe(); ++} ++ ++ ++void __init bcm2709_init_early(void) ++{ ++ /* ++ * Some devices allocate their coherent buffers from atomic ++ * context. Increase size of atomic coherent pool to make sure such ++ * the allocations won't fail. ++ */ ++ init_dma_coherent_pool_size(SZ_4M); ++} ++ ++static void __init board_reserve(void) ++{ ++ vc_cma_reserve(); ++} ++ ++ ++#ifdef CONFIG_SMP ++#include <linux/smp.h> ++ ++#include <asm/cacheflush.h> ++#include <asm/smp_plat.h> ++int dc4=0; ++//void dc4_log(unsigned x) { if (dc4) writel((x), __io_address(ST_BASE+10 + raw_smp_processor_id()*4)); } ++void dc4_log_dead(unsigned x) { if (dc4) writel((readl(__io_address(ST_BASE+0x10 + raw_smp_processor_id()*4)) & 0xffff) | ((x)<<16), __io_address(ST_BASE+0x10 + raw_smp_processor_id()*4)); } ++ ++static void bcm2835_send_doorbell(const struct cpumask *mask, unsigned int irq) ++{ ++ int cpu; ++ /* ++ * Ensure that stores to Normal memory are visible to the ++ * other CPUs before issuing the IPI. ++ */ ++ dsb(); ++ ++ /* Convert our logical CPU mask into a physical one. */ ++ for_each_cpu(cpu, mask) ++ { ++ /* submit softirq */ ++ writel(1<<irq, __io_address(ARM_LOCAL_MAILBOX0_SET0 + 0x10 * MPIDR_AFFINITY_LEVEL(cpu_logical_map(cpu), 0))); ++ } ++} ++ ++void __init bcm2709_smp_init_cpus(void) ++{ ++ void secondary_startup(void); ++ unsigned int i, ncores; ++ ++ ncores = 4; // xxx scu_get_core_count(NULL); ++ printk("[%s] enter (%x->%x)\n", __FUNCTION__, (unsigned)virt_to_phys((void *)secondary_startup), (unsigned)__io_address(ST_BASE + 0x10)); ++ printk("[%s] ncores=%d\n", __FUNCTION__, ncores); ++ ++ for (i = 0; i < ncores; i++) { ++ set_cpu_possible(i, true); ++ /* enable IRQ (not FIQ) */ ++ writel(0x1, __io_address(ARM_LOCAL_MAILBOX_INT_CONTROL0 + 0x4 * i)); ++ //writel(0xf, __io_address(ARM_LOCAL_TIMER_INT_CONTROL0 + 0x4 * i)); ++ } ++ set_smp_cross_call(bcm2835_send_doorbell); ++} ++ ++/* ++ * for arch/arm/kernel/smp.c:smp_prepare_cpus(unsigned int max_cpus) ++ */ ++void __init bcm2709_smp_prepare_cpus(unsigned int max_cpus) ++{ ++ //void __iomem *scu_base; ++ ++ printk("[%s] enter\n", __FUNCTION__); ++ //scu_base = scu_base_addr(); ++ //scu_enable(scu_base); ++} ++ ++/* ++ * for linux/arch/arm/kernel/smp.c:secondary_start_kernel(void) ++ */ ++void __init bcm2709_secondary_init(unsigned int cpu) ++{ ++ printk("[%s] enter cpu:%d\n", __FUNCTION__, cpu); ++ //gic_secondary_init(0); ++} ++ ++/* ++ * for linux/arch/arm/kernel/smp.c:__cpu_up(..) ++ */ ++int __init bcm2709_boot_secondary(unsigned int cpu, struct task_struct *idle) ++{ ++ void secondary_startup(void); ++ void *mbox_set = __io_address(ARM_LOCAL_MAILBOX3_SET0 + 0x10 * MPIDR_AFFINITY_LEVEL(cpu_logical_map(cpu), 0)); ++ void *mbox_clr = __io_address(ARM_LOCAL_MAILBOX3_CLR0 + 0x10 * MPIDR_AFFINITY_LEVEL(cpu_logical_map(cpu), 0)); ++ unsigned secondary_boot = (unsigned)virt_to_phys((void *)secondary_startup); ++ int timeout=20; ++ unsigned t = -1; ++ //printk("[%s] enter cpu:%d (%x->%p) %x\n", __FUNCTION__, cpu, secondary_boot, wake, readl(wake)); ++ ++ dsb(); ++ BUG_ON(readl(mbox_clr) != 0); ++ writel(secondary_boot, mbox_set); ++ ++ while (--timeout > 0) { ++ t = readl(mbox_clr); ++ if (t == 0) break; ++ cpu_relax(); ++ } ++ if (timeout==0) ++ printk("[%s] cpu:%d failed to start (%x)\n", __FUNCTION__, cpu, t); ++ else ++ printk("[%s] cpu:%d started (%x) %d\n", __FUNCTION__, cpu, t, timeout); ++ ++ return 0; ++} ++ ++ ++struct smp_operations bcm2709_smp_ops __initdata = { ++ .smp_init_cpus = bcm2709_smp_init_cpus, ++ .smp_prepare_cpus = bcm2709_smp_prepare_cpus, ++ .smp_secondary_init = bcm2709_secondary_init, ++ .smp_boot_secondary = bcm2709_boot_secondary, ++}; ++#endif ++ ++static const char * const bcm2709_compat[] = { ++ "brcm,bcm2709", ++ "brcm,bcm2708", /* Could use bcm2708 in a pinch */ ++ NULL ++}; ++ ++MACHINE_START(BCM2709, "BCM2709") ++ /* Maintainer: Broadcom Europe Ltd. */ ++#ifdef CONFIG_SMP ++ .smp = smp_ops(bcm2709_smp_ops), ++#endif ++ .map_io = bcm2709_map_io, ++ .init_time = bcm2709_timer_init, ++ .init_machine = bcm2709_init, ++ .init_early = bcm2709_init_early, ++ .reserve = board_reserve, ++ .restart = bcm2709_restart, ++ .dt_compat = bcm2709_compat, ++MACHINE_END ++ ++MACHINE_START(BCM2708, "BCM2709") ++ /* Maintainer: Broadcom Europe Ltd. */ ++#ifdef CONFIG_SMP ++ .smp = smp_ops(bcm2709_smp_ops), ++#endif ++ .map_io = bcm2709_map_io, ++ .init_time = bcm2709_timer_init, ++ .init_machine = bcm2709_init, ++ .init_early = bcm2709_init_early, ++ .reserve = board_reserve, ++ .restart = bcm2709_restart, ++ .dt_compat = bcm2709_compat, ++MACHINE_END ++ ++module_param(boardrev, uint, 0644); ++module_param(serial, uint, 0644); ++module_param(reboot_part, uint, 0644); +diff --git a/arch/arm/mach-bcm2709/include/mach/debug-macro.S b/arch/arm/mach-bcm2709/include/mach/debug-macro.S +new file mode 100644 +index 0000000..b24304a +--- /dev/null ++++ b/arch/arm/mach-bcm2709/include/mach/debug-macro.S +@@ -0,0 +1,22 @@ ++/* arch/arm/mach-bcm2708/include/mach/debug-macro.S ++ * ++ * Debugging macro include header ++ * ++ * Copyright (C) 2010 Broadcom ++ * Copyright (C) 1994-1999 Russell King ++ * Moved from linux/arch/arm/kernel/debug.S by Ben Dooks ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 as ++ * published by the Free Software Foundation. ++ * ++*/ ++ ++#include <mach/platform.h> ++ ++ .macro addruart, rp, rv, tmp ++ ldr \rp, =UART0_BASE ++ ldr \rv, =IO_ADDRESS(UART0_BASE) ++ .endm ++ ++#include <debug/pl01x.S> +diff --git a/arch/arm/mach-bcm2709/include/mach/entry-macro.S b/arch/arm/mach-bcm2709/include/mach/entry-macro.S +new file mode 100644 +index 0000000..d08591b +--- /dev/null ++++ b/arch/arm/mach-bcm2709/include/mach/entry-macro.S +@@ -0,0 +1,123 @@ ++/* ++ * arch/arm/mach-bcm2708/include/mach/entry-macro.S ++ * ++ * Low-level IRQ helper macros for BCM2708 platforms ++ * ++ * Copyright (C) 2010 Broadcom ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ */ ++#include <mach/hardware.h> ++#include <mach/irqs.h> ++ ++ .macro disable_fiq ++ .endm ++ ++ .macro get_irqnr_preamble, base, tmp ++ ldr \base, =IO_ADDRESS(ARMCTRL_IC_BASE) ++ .endm ++ ++ .macro arch_ret_to_user, tmp1, tmp2 ++ .endm ++ ++ .macro get_irqnr_and_base, irqnr, irqstat, base, tmp ++ /* get core number */ ++ mrc p15, 0, \tmp, c0, c0, 5 ++ ubfx \tmp, \tmp, #0, #2 ++ ++ /* get core's local interrupt controller */ ++ ldr \irqstat, = __io_address(ARM_LOCAL_IRQ_PENDING0) @ local interrupt source ++ add \irqstat, \irqstat, \tmp, lsl #2 ++ ldr \tmp, [\irqstat] ++ /* ignore gpu interrupt */ ++ bic \tmp, #0x100 ++ /* ignore mailbox interrupts */ ++ bics \tmp, #0xf0 ++ beq 1005f ++ ++ @ For non-zero x, LSB(x) = 31 - CLZ(x^(x-1)) ++ @ N.B. CLZ is an ARM5 instruction. ++ mov \irqnr, #(ARM_IRQ_LOCAL_BASE + 31) ++ sub \irqstat, \tmp, #1 ++ eor \irqstat, \irqstat, \tmp ++ clz \tmp, \irqstat ++ sub \irqnr, \tmp ++ b 1020f ++1005: ++ /* get core number */ ++ mrc p15, 0, \tmp, c0, c0, 5 ++ ubfx \tmp, \tmp, #0, #2 ++ ++ cmp \tmp, #1 ++ beq 1020f ++ cmp \tmp, #2 ++ beq 1020f ++ cmp \tmp, #3 ++ beq 1020f ++ ++ /* get masked status */ ++ ldr \irqstat, [\base, #(ARM_IRQ_PEND0 - ARMCTRL_IC_BASE)] ++ mov \irqnr, #(ARM_IRQ0_BASE + 31) ++ and \tmp, \irqstat, #0x300 @ save bits 8 and 9 ++ /* clear bits 8 and 9, and test */ ++ bics \irqstat, \irqstat, #0x300 ++ bne 1010f ++ ++ tst \tmp, #0x100 ++ ldrne \irqstat, [\base, #(ARM_IRQ_PEND1 - ARMCTRL_IC_BASE)] ++ movne \irqnr, #(ARM_IRQ1_BASE + 31) ++ @ Mask out the interrupts also present in PEND0 - see SW-5809 ++ bicne \irqstat, #((1<<7) | (1<<9) | (1<<10)) ++ bicne \irqstat, #((1<<18) | (1<<19)) ++ bne 1010f ++ ++ tst \tmp, #0x200 ++ ldrne \irqstat, [\base, #(ARM_IRQ_PEND2 - ARMCTRL_IC_BASE)] ++ movne \irqnr, #(ARM_IRQ2_BASE + 31) ++ @ Mask out the interrupts also present in PEND0 - see SW-5809 ++ bicne \irqstat, #((1<<21) | (1<<22) | (1<<23) | (1<<24) | (1<<25)) ++ bicne \irqstat, #((1<<30)) ++ beq 1020f ++ ++1010: ++ @ For non-zero x, LSB(x) = 31 - CLZ(x^(x-1)) ++ @ N.B. CLZ is an ARM5 instruction. ++ sub \tmp, \irqstat, #1 ++ eor \irqstat, \irqstat, \tmp ++ clz \tmp, \irqstat ++ sub \irqnr, \tmp ++ ++1020: @ EQ will be set if no irqs pending ++ ++ .endm ++ ++ .macro test_for_ipi, irqnr, irqstat, base, tmp ++ /* get core number */ ++ mrc p15, 0, \tmp, c0, c0, 5 ++ ubfx \tmp, \tmp, #0, #2 ++ /* get core's mailbox interrupt control */ ++ ldr \irqstat, = __io_address(ARM_LOCAL_MAILBOX0_CLR0) @ mbox_clr ++ add \irqstat, \irqstat, \tmp, lsl #4 ++ ldr \tmp, [\irqstat] ++ cmp \tmp, #0 ++ beq 1030f ++ clz \tmp, \tmp ++ rsb \irqnr, \tmp, #31 ++ mov \tmp, #1 ++ lsl \tmp, \irqnr ++ str \tmp, [\irqstat] @ clear interrupt source ++ dsb ++1030: @ EQ will be set if no irqs pending ++ .endm +diff --git a/arch/arm/mach-bcm2709/include/mach/io.h b/arch/arm/mach-bcm2709/include/mach/io.h +new file mode 100644 +index 0000000..e6eb84d +--- /dev/null ++++ b/arch/arm/mach-bcm2709/include/mach/io.h +@@ -0,0 +1,27 @@ ++/* ++ * arch/arm/mach-bcm2708/include/mach/io.h ++ * ++ * Copyright (C) 2003 ARM Limited ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ */ ++#ifndef __ASM_ARM_ARCH_IO_H ++#define __ASM_ARM_ARCH_IO_H ++ ++#define IO_SPACE_LIMIT 0xffffffff ++ ++#define __io(a) __typesafe_io(a) ++ ++#endif +diff --git a/arch/arm/mach-bcm2709/include/mach/memory.h b/arch/arm/mach-bcm2709/include/mach/memory.h +new file mode 100644 +index 0000000..7548a52 +--- /dev/null ++++ b/arch/arm/mach-bcm2709/include/mach/memory.h +@@ -0,0 +1,57 @@ ++/* ++ * arch/arm/mach-bcm2708/include/mach/memory.h ++ * ++ * Copyright (C) 2010 Broadcom ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ */ ++#ifndef __ASM_ARCH_MEMORY_H ++#define __ASM_ARCH_MEMORY_H ++ ++/* Memory overview: ++ ++ [ARMcore] <--virtual addr--> ++ [ARMmmu] <--physical addr--> ++ [GERTmap] <--bus add--> ++ [VCperiph] ++ ++*/ ++ ++/* ++ * Physical DRAM offset. ++ */ ++#define BCM_PLAT_PHYS_OFFSET UL(0x00000000) ++#define VC_ARMMEM_OFFSET UL(0x00000000) /* offset in VC of ARM memory */ ++ ++#ifdef CONFIG_BCM2708_NOL2CACHE ++ #define _REAL_BUS_OFFSET UL(0xC0000000) /* don't use L1 or L2 caches */ ++#else ++ #define _REAL_BUS_OFFSET UL(0x40000000) /* use L2 cache */ ++#endif ++ ++/* We're using the memory at 64M in the VideoCore for Linux - this adjustment ++ * will provide the offset into this area as well as setting the bits that ++ * stop the L1 and L2 cache from being used ++ * ++ * WARNING: this only works because the ARM is given memory at a fixed location ++ * (ARMMEM_OFFSET) ++ */ ++#define BUS_OFFSET (VC_ARMMEM_OFFSET + _REAL_BUS_OFFSET) ++#define __virt_to_bus(x) ((x) + (BUS_OFFSET - PAGE_OFFSET)) ++#define __bus_to_virt(x) ((x) - (BUS_OFFSET - PAGE_OFFSET)) ++#define __pfn_to_bus(x) (__pfn_to_phys(x) + (BUS_OFFSET - BCM_PLAT_PHYS_OFFSET)) ++#define __bus_to_pfn(x) __phys_to_pfn((x) - (BUS_OFFSET - BCM_PLAT_PHYS_OFFSET)) ++ ++#endif +diff --git a/arch/arm/mach-bcm2709/include/mach/platform.h b/arch/arm/mach-bcm2709/include/mach/platform.h +new file mode 100644 +index 0000000..311b9f2 +--- /dev/null ++++ b/arch/arm/mach-bcm2709/include/mach/platform.h +@@ -0,0 +1,188 @@ ++/* ++ * arch/arm/mach-bcm2708/include/mach/platform.h ++ * ++ * Copyright (C) 2010 Broadcom ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ */ ++ ++#ifndef _BCM2708_PLATFORM_H ++#define _BCM2708_PLATFORM_H ++ ++ ++/* macros to get at IO space when running virtually */ ++#define IO_ADDRESS(x) (((x) & 0x00ffffff) + (((x) >> 4) & 0x0f000000) + 0xf0000000) ++ ++#define __io_address(n) IOMEM(IO_ADDRESS(n)) ++ ++ ++/* ++ * SDRAM ++ */ ++#define BCM2708_SDRAM_BASE 0x00000000 ++ ++/* ++ * Logic expansion modules ++ * ++ */ ++ ++ ++/* ------------------------------------------------------------------------ ++ * BCM2708 ARMCTRL Registers ++ * ------------------------------------------------------------------------ ++ */ ++ ++#define HW_REGISTER_RW(addr) (addr) ++#define HW_REGISTER_RO(addr) (addr) ++ ++/* ++ * Definitions and addresses for the ARM CONTROL logic ++ * This file is manually generated. ++ */ ++ ++#define BCM2708_PERI_BASE 0x3F000000 ++#define IC0_BASE (BCM2708_PERI_BASE + 0x2000) ++#define ST_BASE (BCM2708_PERI_BASE + 0x3000) /* System Timer */ ++#define MPHI_BASE (BCM2708_PERI_BASE + 0x6000) /* Message -based Parallel Host Interface */ ++#define DMA_BASE (BCM2708_PERI_BASE + 0x7000) /* DMA controller */ ++#define ARM_BASE (BCM2708_PERI_BASE + 0xB000) /* BCM2708 ARM control block */ ++#define PM_BASE (BCM2708_PERI_BASE + 0x100000) /* Power Management, Reset controller and Watchdog registers */ ++#define PCM_CLOCK_BASE (BCM2708_PERI_BASE + 0x101098) /* PCM Clock */ ++#define RNG_BASE (BCM2708_PERI_BASE + 0x104000) /* Hardware RNG */ ++#define GPIO_BASE (BCM2708_PERI_BASE + 0x200000) /* GPIO */ ++#define UART0_BASE (BCM2708_PERI_BASE + 0x201000) /* Uart 0 */ ++#define MMCI0_BASE (BCM2708_PERI_BASE + 0x202000) /* MMC interface */ ++#define I2S_BASE (BCM2708_PERI_BASE + 0x203000) /* I2S */ ++#define SPI0_BASE (BCM2708_PERI_BASE + 0x204000) /* SPI0 */ ++#define BSC0_BASE (BCM2708_PERI_BASE + 0x205000) /* BSC0 I2C/TWI */ ++#define UART1_BASE (BCM2708_PERI_BASE + 0x215000) /* Uart 1 */ ++#define EMMC_BASE (BCM2708_PERI_BASE + 0x300000) /* eMMC interface */ ++#define SMI_BASE (BCM2708_PERI_BASE + 0x600000) /* SMI */ ++#define BSC1_BASE (BCM2708_PERI_BASE + 0x804000) /* BSC1 I2C/TWI */ ++#define USB_BASE (BCM2708_PERI_BASE + 0x980000) /* DTC_OTG USB controller */ ++#define MCORE_BASE (BCM2708_PERI_BASE + 0x0000) /* Fake frame buffer device (actually the multicore sync block*/ ++ ++#define ARMCTRL_BASE (ARM_BASE + 0x000) ++#define ARMCTRL_IC_BASE (ARM_BASE + 0x200) /* ARM interrupt controller */ ++#define ARMCTRL_TIMER0_1_BASE (ARM_BASE + 0x400) /* Timer 0 and 1 */ ++#define ARMCTRL_0_SBM_BASE (ARM_BASE + 0x800) /* User 0 (ARM)'s Semaphores Doorbells and Mailboxes */ ++ ++/* ++ * Watchdog ++ */ ++#define PM_RSTC (PM_BASE+0x1c) ++#define PM_RSTS (PM_BASE+0x20) ++#define PM_WDOG (PM_BASE+0x24) ++ ++#define PM_WDOG_RESET 0000000000 ++#define PM_PASSWORD 0x5a000000 ++#define PM_WDOG_TIME_SET 0x000fffff ++#define PM_RSTC_WRCFG_CLR 0xffffffcf ++#define PM_RSTC_WRCFG_SET 0x00000030 ++#define PM_RSTC_WRCFG_FULL_RESET 0x00000020 ++#define PM_RSTC_RESET 0x00000102 ++ ++#define PM_RSTS_HADPOR_SET 0x00001000 ++#define PM_RSTS_HADSRH_SET 0x00000400 ++#define PM_RSTS_HADSRF_SET 0x00000200 ++#define PM_RSTS_HADSRQ_SET 0x00000100 ++#define PM_RSTS_HADWRH_SET 0x00000040 ++#define PM_RSTS_HADWRF_SET 0x00000020 ++#define PM_RSTS_HADWRQ_SET 0x00000010 ++#define PM_RSTS_HADDRH_SET 0x00000004 ++#define PM_RSTS_HADDRF_SET 0x00000002 ++#define PM_RSTS_HADDRQ_SET 0x00000001 ++ ++#define UART0_CLOCK 3000000 ++ ++#define ARM_LOCAL_BASE 0x40000000 ++#define ARM_LOCAL_CONTROL HW_REGISTER_RW(ARM_LOCAL_BASE+0x000) ++ ++#define ARM_LOCAL_CONTROL HW_REGISTER_RW(ARM_LOCAL_BASE+0x000) ++#define ARM_LOCAL_PRESCALER HW_REGISTER_RW(ARM_LOCAL_BASE+0x008) ++#define ARM_LOCAL_GPU_INT_ROUTING HW_REGISTER_RW(ARM_LOCAL_BASE+0x00C) ++#define ARM_LOCAL_PM_ROUTING_SET HW_REGISTER_RW(ARM_LOCAL_BASE+0x010) ++#define ARM_LOCAL_PM_ROUTING_CLR HW_REGISTER_RW(ARM_LOCAL_BASE+0x014) ++#define ARM_LOCAL_TIMER_LS HW_REGISTER_RW(ARM_LOCAL_BASE+0x01C) ++#define ARM_LOCAL_TIMER_MS HW_REGISTER_RW(ARM_LOCAL_BASE+0x020) ++#define ARM_LOCAL_INT_ROUTING HW_REGISTER_RW(ARM_LOCAL_BASE+0x024) ++#define ARM_LOCAL_AXI_COUNT HW_REGISTER_RW(ARM_LOCAL_BASE+0x02C) ++#define ARM_LOCAL_AXI_IRQ HW_REGISTER_RW(ARM_LOCAL_BASE+0x030) ++#define ARM_LOCAL_TIMER_CONTROL HW_REGISTER_RW(ARM_LOCAL_BASE+0x034) ++#define ARM_LOCAL_TIMER_WRITE HW_REGISTER_RW(ARM_LOCAL_BASE+0x038) ++ ++#define ARM_LOCAL_TIMER_INT_CONTROL0 HW_REGISTER_RW(ARM_LOCAL_BASE+0x040) ++#define ARM_LOCAL_TIMER_INT_CONTROL1 HW_REGISTER_RW(ARM_LOCAL_BASE+0x044) ++#define ARM_LOCAL_TIMER_INT_CONTROL2 HW_REGISTER_RW(ARM_LOCAL_BASE+0x048) ++#define ARM_LOCAL_TIMER_INT_CONTROL3 HW_REGISTER_RW(ARM_LOCAL_BASE+0x04C) ++ ++#define ARM_LOCAL_MAILBOX_INT_CONTROL0 HW_REGISTER_RW(ARM_LOCAL_BASE+0x050) ++#define ARM_LOCAL_MAILBOX_INT_CONTROL1 HW_REGISTER_RW(ARM_LOCAL_BASE+0x054) ++#define ARM_LOCAL_MAILBOX_INT_CONTROL2 HW_REGISTER_RW(ARM_LOCAL_BASE+0x058) ++#define ARM_LOCAL_MAILBOX_INT_CONTROL3 HW_REGISTER_RW(ARM_LOCAL_BASE+0x05C) ++ ++#define ARM_LOCAL_IRQ_PENDING0 HW_REGISTER_RW(ARM_LOCAL_BASE+0x060) ++#define ARM_LOCAL_IRQ_PENDING1 HW_REGISTER_RW(ARM_LOCAL_BASE+0x064) ++#define ARM_LOCAL_IRQ_PENDING2 HW_REGISTER_RW(ARM_LOCAL_BASE+0x068) ++#define ARM_LOCAL_IRQ_PENDING3 HW_REGISTER_RW(ARM_LOCAL_BASE+0x06C) ++ ++#define ARM_LOCAL_FIQ_PENDING0 HW_REGISTER_RW(ARM_LOCAL_BASE+0x070) ++#define ARM_LOCAL_FIQ_PENDING1 HW_REGISTER_RW(ARM_LOCAL_BASE+0x074) ++#define ARM_LOCAL_FIQ_PENDING2 HW_REGISTER_RW(ARM_LOCAL_BASE+0x078) ++#define ARM_LOCAL_FIQ_PENDING3 HW_REGISTER_RW(ARM_LOCAL_BASE+0x07C) ++ ++#define ARM_LOCAL_MAILBOX0_SET0 HW_REGISTER_RW(ARM_LOCAL_BASE+0x080) ++#define ARM_LOCAL_MAILBOX1_SET0 HW_REGISTER_RW(ARM_LOCAL_BASE+0x084) ++#define ARM_LOCAL_MAILBOX2_SET0 HW_REGISTER_RW(ARM_LOCAL_BASE+0x088) ++#define ARM_LOCAL_MAILBOX3_SET0 HW_REGISTER_RW(ARM_LOCAL_BASE+0x08C) ++ ++#define ARM_LOCAL_MAILBOX0_SET1 HW_REGISTER_RW(ARM_LOCAL_BASE+0x090) ++#define ARM_LOCAL_MAILBOX1_SET1 HW_REGISTER_RW(ARM_LOCAL_BASE+0x094) ++#define ARM_LOCAL_MAILBOX2_SET1 HW_REGISTER_RW(ARM_LOCAL_BASE+0x098) ++#define ARM_LOCAL_MAILBOX3_SET1 HW_REGISTER_RW(ARM_LOCAL_BASE+0x09C) ++ ++#define ARM_LOCAL_MAILBOX0_SET2 HW_REGISTER_RW(ARM_LOCAL_BASE+0x0A0) ++#define ARM_LOCAL_MAILBOX1_SET2 HW_REGISTER_RW(ARM_LOCAL_BASE+0x0A4) ++#define ARM_LOCAL_MAILBOX2_SET2 HW_REGISTER_RW(ARM_LOCAL_BASE+0x0A8) ++#define ARM_LOCAL_MAILBOX3_SET2 HW_REGISTER_RW(ARM_LOCAL_BASE+0x0AC) ++ ++#define ARM_LOCAL_MAILBOX0_SET3 HW_REGISTER_RW(ARM_LOCAL_BASE+0x0B0) ++#define ARM_LOCAL_MAILBOX1_SET3 HW_REGISTER_RW(ARM_LOCAL_BASE+0x0B4) ++#define ARM_LOCAL_MAILBOX2_SET3 HW_REGISTER_RW(ARM_LOCAL_BASE+0x0B8) ++#define ARM_LOCAL_MAILBOX3_SET3 HW_REGISTER_RW(ARM_LOCAL_BASE+0x0BC) ++ ++#define ARM_LOCAL_MAILBOX0_CLR0 HW_REGISTER_RW(ARM_LOCAL_BASE+0x0C0) ++#define ARM_LOCAL_MAILBOX1_CLR0 HW_REGISTER_RW(ARM_LOCAL_BASE+0x0C4) ++#define ARM_LOCAL_MAILBOX2_CLR0 HW_REGISTER_RW(ARM_LOCAL_BASE+0x0C8) ++#define ARM_LOCAL_MAILBOX3_CLR0 HW_REGISTER_RW(ARM_LOCAL_BASE+0x0CC) ++ ++#define ARM_LOCAL_MAILBOX0_CLR1 HW_REGISTER_RW(ARM_LOCAL_BASE+0x0D0) ++#define ARM_LOCAL_MAILBOX1_CLR1 HW_REGISTER_RW(ARM_LOCAL_BASE+0x0D4) ++#define ARM_LOCAL_MAILBOX2_CLR1 HW_REGISTER_RW(ARM_LOCAL_BASE+0x0D8) ++#define ARM_LOCAL_MAILBOX3_CLR1 HW_REGISTER_RW(ARM_LOCAL_BASE+0x0DC) ++ ++#define ARM_LOCAL_MAILBOX0_CLR2 HW_REGISTER_RW(ARM_LOCAL_BASE+0x0E0) ++#define ARM_LOCAL_MAILBOX1_CLR2 HW_REGISTER_RW(ARM_LOCAL_BASE+0x0E4) ++#define ARM_LOCAL_MAILBOX2_CLR2 HW_REGISTER_RW(ARM_LOCAL_BASE+0x0E8) ++#define ARM_LOCAL_MAILBOX3_CLR2 HW_REGISTER_RW(ARM_LOCAL_BASE+0x0EC) ++ ++#define ARM_LOCAL_MAILBOX0_CLR3 HW_REGISTER_RW(ARM_LOCAL_BASE+0x0F0) ++#define ARM_LOCAL_MAILBOX1_CLR3 HW_REGISTER_RW(ARM_LOCAL_BASE+0x0F4) ++#define ARM_LOCAL_MAILBOX2_CLR3 HW_REGISTER_RW(ARM_LOCAL_BASE+0x0F8) ++#define ARM_LOCAL_MAILBOX3_CLR3 HW_REGISTER_RW(ARM_LOCAL_BASE+0x0FC) ++ ++#endif ++ ++/* END */ +diff --git a/arch/arm/mach-bcm2709/include/mach/system.h b/arch/arm/mach-bcm2709/include/mach/system.h +new file mode 100644 +index 0000000..c9a9c9a +--- /dev/null ++++ b/arch/arm/mach-bcm2709/include/mach/system.h +@@ -0,0 +1,37 @@ ++/* ++ * arch/arm/mach-bcm2708/include/mach/system.h ++ * ++ * Copyright (C) 2010 Broadcom ++ * Copyright (C) 2003 ARM Limited ++ * Copyright (C) 2000 Deep Blue Solutions Ltd ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ */ ++#ifndef __ASM_ARCH_SYSTEM_H ++#define __ASM_ARCH_SYSTEM_H ++ ++#include <linux/io.h> ++#include <mach/platform.h> ++ ++static inline void arch_idle(void) ++{ ++ /* ++ * This should do all the clock switching ++ * and wait for interrupt tricks ++ */ ++ cpu_do_idle(); ++} ++ ++#endif +diff --git a/arch/arm/mach-bcm2709/include/mach/uncompress.h b/arch/arm/mach-bcm2709/include/mach/uncompress.h +new file mode 100644 +index 0000000..de7504b +--- /dev/null ++++ b/arch/arm/mach-bcm2709/include/mach/uncompress.h +@@ -0,0 +1,84 @@ ++/* ++ * arch/arm/mach-bcn2708/include/mach/uncompress.h ++ * ++ * Copyright (C) 2010 Broadcom ++ * Copyright (C) 2003 ARM Limited ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ */ ++ ++#include <linux/io.h> ++#include <linux/amba/serial.h> ++#include <mach/platform.h> ++ ++#define UART_BAUD 115200 ++ ++#define BCM2708_UART_DR __io(UART0_BASE + UART01x_DR) ++#define BCM2708_UART_FR __io(UART0_BASE + UART01x_FR) ++#define BCM2708_UART_IBRD __io(UART0_BASE + UART011_IBRD) ++#define BCM2708_UART_FBRD __io(UART0_BASE + UART011_FBRD) ++#define BCM2708_UART_LCRH __io(UART0_BASE + UART011_LCRH) ++#define BCM2708_UART_CR __io(UART0_BASE + UART011_CR) ++ ++/* ++ * This does not append a newline ++ */ ++static inline void putc(int c) ++{ ++ while (__raw_readl(BCM2708_UART_FR) & UART01x_FR_TXFF) ++ barrier(); ++ ++ __raw_writel(c, BCM2708_UART_DR); ++} ++ ++static inline void flush(void) ++{ ++ int fr; ++ ++ do { ++ fr = __raw_readl(BCM2708_UART_FR); ++ barrier(); ++ } while ((fr & (UART011_FR_TXFE | UART01x_FR_BUSY)) != UART011_FR_TXFE); ++} ++ ++static inline void arch_decomp_setup(void) ++{ ++ int temp, div, rem, frac; ++ ++ temp = 16 * UART_BAUD; ++ div = UART0_CLOCK / temp; ++ rem = UART0_CLOCK % temp; ++ temp = (8 * rem) / UART_BAUD; ++ frac = (temp >> 1) + (temp & 1); ++ ++ /* Make sure the UART is disabled before we start */ ++ __raw_writel(0, BCM2708_UART_CR); ++ ++ /* Set the baud rate */ ++ __raw_writel(div, BCM2708_UART_IBRD); ++ __raw_writel(frac, BCM2708_UART_FBRD); ++ ++ /* Set the UART to 8n1, FIFO enabled */ ++ __raw_writel(UART01x_LCRH_WLEN_8 | UART01x_LCRH_FEN, BCM2708_UART_LCRH); ++ ++ /* Enable the UART */ ++ __raw_writel(UART01x_CR_UARTEN | UART011_CR_TXE | UART011_CR_RXE, ++ BCM2708_UART_CR); ++} ++ ++/* ++ * nothing to do ++ */ ++#define arch_decomp_wdog() +diff --git a/arch/arm/mach-bcm2709/include/mach/vc_mem.h b/arch/arm/mach-bcm2709/include/mach/vc_mem.h +new file mode 100644 +index 0000000..4a4a338 +--- /dev/null ++++ b/arch/arm/mach-bcm2709/include/mach/vc_mem.h +@@ -0,0 +1,35 @@ ++/***************************************************************************** ++* Copyright 2010 - 2011 Broadcom Corporation. All rights reserved. ++* ++* Unless you and Broadcom execute a separate written software license ++* agreement governing use of this software, this software is licensed to you ++* under the terms of the GNU General Public License version 2, available at ++* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). ++* ++* Notwithstanding the above, under no circumstances may you combine this ++* software in any way with any other Broadcom software provided under a ++* license other than the GPL, without Broadcom's express prior written ++* consent. ++*****************************************************************************/ ++ ++#if !defined( VC_MEM_H ) ++#define VC_MEM_H ++ ++#include <linux/ioctl.h> ++ ++#define VC_MEM_IOC_MAGIC 'v' ++ ++#define VC_MEM_IOC_MEM_PHYS_ADDR _IOR( VC_MEM_IOC_MAGIC, 0, unsigned long ) ++#define VC_MEM_IOC_MEM_SIZE _IOR( VC_MEM_IOC_MAGIC, 1, unsigned int ) ++#define VC_MEM_IOC_MEM_BASE _IOR( VC_MEM_IOC_MAGIC, 2, unsigned int ) ++#define VC_MEM_IOC_MEM_LOAD _IOR( VC_MEM_IOC_MAGIC, 3, unsigned int ) ++ ++#if defined( __KERNEL__ ) ++#define VC_MEM_TO_ARM_ADDR_MASK 0x3FFFFFFF ++ ++extern unsigned long mm_vc_mem_phys_addr; ++extern unsigned int mm_vc_mem_size; ++extern int vc_mem_get_current_size( void ); ++#endif ++ ++#endif /* VC_MEM_H */ +diff --git a/arch/arm/mach-bcm2709/include/mach/vmalloc.h b/arch/arm/mach-bcm2709/include/mach/vmalloc.h +new file mode 100644 +index 0000000..6aa6826 +--- /dev/null ++++ b/arch/arm/mach-bcm2709/include/mach/vmalloc.h +@@ -0,0 +1,20 @@ ++/* ++ * arch/arm/mach-bcm2708/include/mach/vmalloc.h ++ * ++ * Copyright (C) 2010 Broadcom ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ */ ++#define VMALLOC_END (0xff000000) +diff --git a/arch/arm/mach-bcm2709/vc_mem.c b/arch/arm/mach-bcm2709/vc_mem.c +new file mode 100644 +index 0000000..d2adfd1 +--- /dev/null ++++ b/arch/arm/mach-bcm2709/vc_mem.c +@@ -0,0 +1,431 @@ ++/***************************************************************************** ++* Copyright 2010 - 2011 Broadcom Corporation. All rights reserved. ++* ++* Unless you and Broadcom execute a separate written software license ++* agreement governing use of this software, this software is licensed to you ++* under the terms of the GNU General Public License version 2, available at ++* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). ++* ++* Notwithstanding the above, under no circumstances may you combine this ++* software in any way with any other Broadcom software provided under a ++* license other than the GPL, without Broadcom's express prior written ++* consent. ++*****************************************************************************/ ++ ++#include <linux/kernel.h> ++#include <linux/module.h> ++#include <linux/fs.h> ++#include <linux/device.h> ++#include <linux/cdev.h> ++#include <linux/mm.h> ++#include <linux/slab.h> ++#include <linux/debugfs.h> ++#include <asm/uaccess.h> ++#include <linux/dma-mapping.h> ++#include <linux/platform_data/mailbox-bcm2708.h> ++ ++#ifdef CONFIG_ARCH_KONA ++#include <chal/chal_ipc.h> ++#elif defined(CONFIG_ARCH_BCM2708) || defined(CONFIG_ARCH_BCM2709) ++#else ++#include <csp/chal_ipc.h> ++#endif ++ ++#include "mach/vc_mem.h" ++ ++#define DRIVER_NAME "vc-mem" ++ ++// Device (/dev) related variables ++static dev_t vc_mem_devnum = 0; ++static struct class *vc_mem_class = NULL; ++static struct cdev vc_mem_cdev; ++static int vc_mem_inited = 0; ++ ++#ifdef CONFIG_DEBUG_FS ++static struct dentry *vc_mem_debugfs_entry; ++#endif ++ ++/* ++ * Videocore memory addresses and size ++ * ++ * Drivers that wish to know the videocore memory addresses and sizes should ++ * use these variables instead of the MM_IO_BASE and MM_ADDR_IO defines in ++ * headers. This allows the other drivers to not be tied down to a a certain ++ * address/size at compile time. ++ * ++ * In the future, the goal is to have the videocore memory virtual address and ++ * size be calculated at boot time rather than at compile time. The decision of ++ * where the videocore memory resides and its size would be in the hands of the ++ * bootloader (and/or kernel). When that happens, the values of these variables ++ * would be calculated and assigned in the init function. ++ */ ++// in the 2835 VC in mapped above ARM, but ARM has full access to VC space ++unsigned long mm_vc_mem_phys_addr = 0x00000000; ++unsigned int mm_vc_mem_size = 0; ++unsigned int mm_vc_mem_base = 0; ++ ++EXPORT_SYMBOL(mm_vc_mem_phys_addr); ++EXPORT_SYMBOL(mm_vc_mem_size); ++EXPORT_SYMBOL(mm_vc_mem_base); ++ ++static uint phys_addr = 0; ++static uint mem_size = 0; ++static uint mem_base = 0; ++ ++ ++/**************************************************************************** ++* ++* vc_mem_open ++* ++***************************************************************************/ ++ ++static int ++vc_mem_open(struct inode *inode, struct file *file) ++{ ++ (void) inode; ++ (void) file; ++ ++ pr_debug("%s: called file = 0x%p\n", __func__, file); ++ ++ return 0; ++} ++ ++/**************************************************************************** ++* ++* vc_mem_release ++* ++***************************************************************************/ ++ ++static int ++vc_mem_release(struct inode *inode, struct file *file) ++{ ++ (void) inode; ++ (void) file; ++ ++ pr_debug("%s: called file = 0x%p\n", __func__, file); ++ ++ return 0; ++} ++ ++/**************************************************************************** ++* ++* vc_mem_get_size ++* ++***************************************************************************/ ++ ++static void ++vc_mem_get_size(void) ++{ ++} ++ ++/**************************************************************************** ++* ++* vc_mem_get_base ++* ++***************************************************************************/ ++ ++static void ++vc_mem_get_base(void) ++{ ++} ++ ++/**************************************************************************** ++* ++* vc_mem_get_current_size ++* ++***************************************************************************/ ++ ++int ++vc_mem_get_current_size(void) ++{ ++ return mm_vc_mem_size; ++} ++ ++EXPORT_SYMBOL_GPL(vc_mem_get_current_size); ++ ++/**************************************************************************** ++* ++* vc_mem_ioctl ++* ++***************************************************************************/ ++ ++static long ++vc_mem_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ++{ ++ int rc = 0; ++ ++ (void) cmd; ++ (void) arg; ++ ++ pr_debug("%s: called file = 0x%p\n", __func__, file); ++ ++ switch (cmd) { ++ case VC_MEM_IOC_MEM_PHYS_ADDR: ++ { ++ pr_debug("%s: VC_MEM_IOC_MEM_PHYS_ADDR=0x%p\n", ++ __func__, (void *) mm_vc_mem_phys_addr); ++ ++ if (copy_to_user((void *) arg, &mm_vc_mem_phys_addr, ++ sizeof (mm_vc_mem_phys_addr)) != 0) { ++ rc = -EFAULT; ++ } ++ break; ++ } ++ case VC_MEM_IOC_MEM_SIZE: ++ { ++ // Get the videocore memory size first ++ vc_mem_get_size(); ++ ++ pr_debug("%s: VC_MEM_IOC_MEM_SIZE=%u\n", __func__, ++ mm_vc_mem_size); ++ ++ if (copy_to_user((void *) arg, &mm_vc_mem_size, ++ sizeof (mm_vc_mem_size)) != 0) { ++ rc = -EFAULT; ++ } ++ break; ++ } ++ case VC_MEM_IOC_MEM_BASE: ++ { ++ // Get the videocore memory base ++ vc_mem_get_base(); ++ ++ pr_debug("%s: VC_MEM_IOC_MEM_BASE=%u\n", __func__, ++ mm_vc_mem_base); ++ ++ if (copy_to_user((void *) arg, &mm_vc_mem_base, ++ sizeof (mm_vc_mem_base)) != 0) { ++ rc = -EFAULT; ++ } ++ break; ++ } ++ case VC_MEM_IOC_MEM_LOAD: ++ { ++ // Get the videocore memory base ++ vc_mem_get_base(); ++ ++ pr_debug("%s: VC_MEM_IOC_MEM_LOAD=%u\n", __func__, ++ mm_vc_mem_base); ++ ++ if (copy_to_user((void *) arg, &mm_vc_mem_base, ++ sizeof (mm_vc_mem_base)) != 0) { ++ rc = -EFAULT; ++ } ++ break; ++ } ++ default: ++ { ++ return -ENOTTY; ++ } ++ } ++ pr_debug("%s: file = 0x%p returning %d\n", __func__, file, rc); ++ ++ return rc; ++} ++ ++/**************************************************************************** ++* ++* vc_mem_mmap ++* ++***************************************************************************/ ++ ++static int ++vc_mem_mmap(struct file *filp, struct vm_area_struct *vma) ++{ ++ int rc = 0; ++ unsigned long length = vma->vm_end - vma->vm_start; ++ unsigned long offset = vma->vm_pgoff << PAGE_SHIFT; ++ ++ pr_debug("%s: vm_start = 0x%08lx vm_end = 0x%08lx vm_pgoff = 0x%08lx\n", ++ __func__, (long) vma->vm_start, (long) vma->vm_end, ++ (long) vma->vm_pgoff); ++ ++ if (offset + length > mm_vc_mem_size) { ++ pr_err("%s: length %ld is too big\n", __func__, length); ++ return -EINVAL; ++ } ++ // Do not cache the memory map ++ vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); ++ ++ rc = remap_pfn_range(vma, vma->vm_start, ++ (mm_vc_mem_phys_addr >> PAGE_SHIFT) + ++ vma->vm_pgoff, length, vma->vm_page_prot); ++ if (rc != 0) { ++ pr_err("%s: remap_pfn_range failed (rc=%d)\n", __func__, rc); ++ } ++ ++ return rc; ++} ++ ++/**************************************************************************** ++* ++* File Operations for the driver. ++* ++***************************************************************************/ ++ ++static const struct file_operations vc_mem_fops = { ++ .owner = THIS_MODULE, ++ .open = vc_mem_open, ++ .release = vc_mem_release, ++ .unlocked_ioctl = vc_mem_ioctl, ++ .mmap = vc_mem_mmap, ++}; ++ ++#ifdef CONFIG_DEBUG_FS ++static void vc_mem_debugfs_deinit(void) ++{ ++ debugfs_remove_recursive(vc_mem_debugfs_entry); ++ vc_mem_debugfs_entry = NULL; ++} ++ ++ ++static int vc_mem_debugfs_init( ++ struct device *dev) ++{ ++ vc_mem_debugfs_entry = debugfs_create_dir(DRIVER_NAME, NULL); ++ if (!vc_mem_debugfs_entry) { ++ dev_warn(dev, "could not create debugfs entry\n"); ++ return -EFAULT; ++ } ++ ++ if (!debugfs_create_x32("vc_mem_phys_addr", ++ 0444, ++ vc_mem_debugfs_entry, ++ (u32 *)&mm_vc_mem_phys_addr)) { ++ dev_warn(dev, "%s:could not create vc_mem_phys entry\n", ++ __func__); ++ goto fail; ++ } ++ ++ if (!debugfs_create_x32("vc_mem_size", ++ 0444, ++ vc_mem_debugfs_entry, ++ (u32 *)&mm_vc_mem_size)) { ++ dev_warn(dev, "%s:could not create vc_mem_size entry\n", ++ __func__); ++ goto fail; ++ } ++ ++ if (!debugfs_create_x32("vc_mem_base", ++ 0444, ++ vc_mem_debugfs_entry, ++ (u32 *)&mm_vc_mem_base)) { ++ dev_warn(dev, "%s:could not create vc_mem_base entry\n", ++ __func__); ++ goto fail; ++ } ++ ++ return 0; ++ ++fail: ++ vc_mem_debugfs_deinit(); ++ return -EFAULT; ++} ++ ++#endif /* CONFIG_DEBUG_FS */ ++ ++ ++/**************************************************************************** ++* ++* vc_mem_init ++* ++***************************************************************************/ ++ ++static int __init ++vc_mem_init(void) ++{ ++ int rc = -EFAULT; ++ struct device *dev; ++ ++ pr_debug("%s: called\n", __func__); ++ ++ mm_vc_mem_phys_addr = phys_addr; ++ mm_vc_mem_size = mem_size; ++ mm_vc_mem_base = mem_base; ++ ++ vc_mem_get_size(); ++ ++ pr_info("vc-mem: phys_addr:0x%08lx mem_base=0x%08x mem_size:0x%08x(%u MiB)\n", ++ mm_vc_mem_phys_addr, mm_vc_mem_base, mm_vc_mem_size, mm_vc_mem_size / (1024 * 1024)); ++ ++ if ((rc = alloc_chrdev_region(&vc_mem_devnum, 0, 1, DRIVER_NAME)) < 0) { ++ pr_err("%s: alloc_chrdev_region failed (rc=%d)\n", ++ __func__, rc); ++ goto out_err; ++ } ++ ++ cdev_init(&vc_mem_cdev, &vc_mem_fops); ++ if ((rc = cdev_add(&vc_mem_cdev, vc_mem_devnum, 1)) != 0) { ++ pr_err("%s: cdev_add failed (rc=%d)\n", __func__, rc); ++ goto out_unregister; ++ } ++ ++ vc_mem_class = class_create(THIS_MODULE, DRIVER_NAME); ++ if (IS_ERR(vc_mem_class)) { ++ rc = PTR_ERR(vc_mem_class); ++ pr_err("%s: class_create failed (rc=%d)\n", __func__, rc); ++ goto out_cdev_del; ++ } ++ ++ dev = device_create(vc_mem_class, NULL, vc_mem_devnum, NULL, ++ DRIVER_NAME); ++ if (IS_ERR(dev)) { ++ rc = PTR_ERR(dev); ++ pr_err("%s: device_create failed (rc=%d)\n", __func__, rc); ++ goto out_class_destroy; ++ } ++ ++#ifdef CONFIG_DEBUG_FS ++ /* don't fail if the debug entries cannot be created */ ++ vc_mem_debugfs_init(dev); ++#endif ++ ++ vc_mem_inited = 1; ++ return 0; ++ ++ device_destroy(vc_mem_class, vc_mem_devnum); ++ ++ out_class_destroy: ++ class_destroy(vc_mem_class); ++ vc_mem_class = NULL; ++ ++ out_cdev_del: ++ cdev_del(&vc_mem_cdev); ++ ++ out_unregister: ++ unregister_chrdev_region(vc_mem_devnum, 1); ++ ++ out_err: ++ return -1; ++} ++ ++/**************************************************************************** ++* ++* vc_mem_exit ++* ++***************************************************************************/ ++ ++static void __exit ++vc_mem_exit(void) ++{ ++ pr_debug("%s: called\n", __func__); ++ ++ if (vc_mem_inited) { ++#if CONFIG_DEBUG_FS ++ vc_mem_debugfs_deinit(); ++#endif ++ device_destroy(vc_mem_class, vc_mem_devnum); ++ class_destroy(vc_mem_class); ++ cdev_del(&vc_mem_cdev); ++ unregister_chrdev_region(vc_mem_devnum, 1); ++ } ++} ++ ++module_init(vc_mem_init); ++module_exit(vc_mem_exit); ++MODULE_LICENSE("GPL"); ++MODULE_AUTHOR("Broadcom Corporation"); ++ ++module_param(phys_addr, uint, 0644); ++module_param(mem_size, uint, 0644); ++module_param(mem_base, uint, 0644); +diff --git a/arch/arm/mm/proc-v6.S b/arch/arm/mm/proc-v6.S +index 06d890a..30d96e8 100644 +--- a/arch/arm/mm/proc-v6.S ++++ b/arch/arm/mm/proc-v6.S +@@ -73,10 +73,19 @@ ENDPROC(cpu_v6_reset) + * + * IRQs are already disabled. + */ ++ ++/* See jira SW-5991 for details of this workaround */ + ENTRY(cpu_v6_do_idle) +- mov r1, #0 +- mcr p15, 0, r1, c7, c10, 4 @ DWB - WFI may enter a low-power mode +- mcr p15, 0, r1, c7, c0, 4 @ wait for interrupt ++ .align 5 ++ mov r1, #2 ++1: subs r1, #1 ++ nop ++ mcreq p15, 0, r1, c7, c10, 4 @ DWB - WFI may enter a low-power mode ++ mcreq p15, 0, r1, c7, c0, 4 @ wait for interrupt ++ nop ++ nop ++ nop ++ bne 1b + ret lr + + ENTRY(cpu_v6_dcache_clean_area) +diff --git a/arch/arm/tools/mach-types b/arch/arm/tools/mach-types +index 2ed1b8a..b52d949 100644 +--- a/arch/arm/tools/mach-types ++++ b/arch/arm/tools/mach-types +@@ -522,6 +522,8 @@ torbreck MACH_TORBRECK TORBRECK 3090 + prima2_evb MACH_PRIMA2_EVB PRIMA2_EVB 3103 + paz00 MACH_PAZ00 PAZ00 3128 + acmenetusfoxg20 MACH_ACMENETUSFOXG20 ACMENETUSFOXG20 3129 ++bcm2708 MACH_BCM2708 BCM2708 3138 ++bcm2709 MACH_BCM2709 BCM2709 3139 + ag5evm MACH_AG5EVM AG5EVM 3189 + ics_if_voip MACH_ICS_IF_VOIP ICS_IF_VOIP 3206 + wlf_cragg_6410 MACH_WLF_CRAGG_6410 WLF_CRAGG_6410 3207 +diff --git a/drivers/clocksource/Makefile b/drivers/clocksource/Makefile +index dc2b899..c38fb1a 100644 +--- a/drivers/clocksource/Makefile ++++ b/drivers/clocksource/Makefile +@@ -19,7 +19,7 @@ obj-$(CONFIG_CLKSRC_NOMADIK_MTU) += nomadik-mtu.o + obj-$(CONFIG_CLKSRC_DBX500_PRCMU) += clksrc-dbx500-prcmu.o + obj-$(CONFIG_ARMADA_370_XP_TIMER) += time-armada-370-xp.o + obj-$(CONFIG_ORION_TIMER) += time-orion.o +-obj-$(CONFIG_ARCH_BCM2835) += bcm2835_timer.o ++obj-$(CONFIG_ARCH_BCM2835)$(CONFIG_ARCH_BCM2708) += bcm2835_timer.o + obj-$(CONFIG_ARCH_CLPS711X) += clps711x-timer.o + obj-$(CONFIG_ARCH_ATLAS7) += timer-atlas7.o + obj-$(CONFIG_ARCH_MOXART) += moxart_timer.o +diff --git a/drivers/irqchip/Makefile b/drivers/irqchip/Makefile +index b03cfcb..70cad6b 100644 +--- a/drivers/irqchip/Makefile ++++ b/drivers/irqchip/Makefile +@@ -5,6 +5,9 @@ obj-$(CONFIG_ATH79) += irq-ath79-cpu.o + obj-$(CONFIG_ATH79) += irq-ath79-misc.o + obj-$(CONFIG_ARCH_BCM2835) += irq-bcm2835.o + obj-$(CONFIG_ARCH_BCM2835) += irq-bcm2836.o ++obj-$(CONFIG_ARCH_BCM2708) += irq-bcm2835.o ++obj-$(CONFIG_ARCH_BCM2709) += irq-bcm2835.o ++obj-$(CONFIG_ARCH_BCM2709) += irq-bcm2836.o + obj-$(CONFIG_ARCH_EXYNOS) += exynos-combiner.o + obj-$(CONFIG_ARCH_HIP04) += irq-hip04.o + obj-$(CONFIG_ARCH_MMP) += irq-mmp.o +diff --git a/drivers/irqchip/irq-bcm2835.c b/drivers/irqchip/irq-bcm2835.c +index 20deb28..c02bf8a 100644 +--- a/drivers/irqchip/irq-bcm2835.c ++++ b/drivers/irqchip/irq-bcm2835.c +@@ -82,6 +82,7 @@ + #define NR_BANKS 3 + #define IRQS_PER_BANK 32 + #define NUMBER_IRQS MAKE_HWIRQ(NR_BANKS, 0) ++#undef FIQ_START + #define FIQ_START (NR_IRQS_BANK0 + MAKE_HWIRQ(NR_BANKS - 1, 0)) + + static const int reg_pending[] __initconst = { 0x00, 0x04, 0x08 }; +@@ -256,7 +257,7 @@ static int __init armctrl_of_init(struct device_node *node, + MAKE_HWIRQ(b, i) + NUMBER_IRQS); + BUG_ON(irq <= 0); + irq_set_chip(irq, &armctrl_chip); +- set_irq_flags(irq, IRQF_VALID | IRQF_PROBE); ++ irq_set_probe(irq); + } + } + init_FIQ(FIQ_START); +diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h +index 8dd4d29..f7fe8bd 100644 +--- a/include/linux/mmc/host.h ++++ b/include/linux/mmc/host.h +@@ -291,6 +291,7 @@ struct mmc_host { + #define MMC_CAP2_SDIO_IRQ_NOTHREAD (1 << 17) + #define MMC_CAP2_NO_WRITE_PROTECT (1 << 18) /* No physical write protect pin, assume that card is always read-write */ + #define MMC_CAP2_NO_SDIO (1 << 19) /* Do not send SDIO commands during initialization */ ++#define MMC_CAP2_FORCE_MULTIBLOCK (1 << 31) /* Always use multiblock transfers */ + + mmc_pm_flag_t pm_caps; /* supported pm features */ + + +From 3d28cd3bfb43f8c4a9b722532c63f54823ae6136 Mon Sep 17 00:00:00 2001 +From: popcornmix <popcornmix@gmail.com> +Date: Tue, 5 Apr 2016 19:40:12 +0100 +Subject: [PATCH 031/112] reboot: Use power off rather than busy spinning when + halt is requested + +--- + arch/arm/kernel/reboot.c | 6 +----- + 1 file changed, 1 insertion(+), 5 deletions(-) + +diff --git a/arch/arm/kernel/reboot.c b/arch/arm/kernel/reboot.c +index 71a2ff9..812c15e 100644 +--- a/arch/arm/kernel/reboot.c ++++ b/arch/arm/kernel/reboot.c +@@ -102,11 +102,7 @@ void machine_shutdown(void) + */ + void machine_halt(void) + { +- local_irq_disable(); +- smp_send_stop(); +- +- local_irq_disable(); +- while (1); ++ machine_power_off(); + } + + /* + +From 9a84e16b5bda0ca0a5c55ea67e923f13fa63a172 Mon Sep 17 00:00:00 2001 +From: popcornmix <popcornmix@gmail.com> +Date: Wed, 11 Nov 2015 21:01:15 +0000 +Subject: [PATCH 032/112] squash: include ARCH_BCM2708 / ARCH_BCM2709 + +--- + drivers/char/hw_random/Kconfig | 2 +- + drivers/clk/bcm/Makefile | 4 ++-- + drivers/mailbox/Kconfig | 2 +- + drivers/mailbox/bcm2835-mailbox.c | 18 ++++++++++++++++-- + drivers/pinctrl/Makefile | 1 + + drivers/pwm/Kconfig | 2 +- + drivers/spi/Kconfig | 4 ++-- + drivers/watchdog/Kconfig | 2 +- + sound/soc/bcm/Kconfig | 2 +- + 9 files changed, 26 insertions(+), 11 deletions(-) + +diff --git a/drivers/char/hw_random/Kconfig b/drivers/char/hw_random/Kconfig +index 67ee8b0..b3ca2ee 100644 +--- a/drivers/char/hw_random/Kconfig ++++ b/drivers/char/hw_random/Kconfig +@@ -90,7 +90,7 @@ config HW_RANDOM_BCM63XX + + config HW_RANDOM_BCM2835 + tristate "Broadcom BCM2835 Random Number Generator support" +- depends on ARCH_BCM2835 ++ depends on ARCH_BCM2835 || ARCH_BCM2708 || ARCH_BCM2709 + default HW_RANDOM + ---help--- + This driver provides kernel-side support for the Random Number +diff --git a/drivers/clk/bcm/Makefile b/drivers/clk/bcm/Makefile +index 1d79bd2..fcf1bb5 100644 +--- a/drivers/clk/bcm/Makefile ++++ b/drivers/clk/bcm/Makefile +@@ -4,8 +4,8 @@ obj-$(CONFIG_CLK_BCM_KONA) += clk-kona-setup.o + obj-$(CONFIG_CLK_BCM_KONA) += clk-bcm281xx.o + obj-$(CONFIG_CLK_BCM_KONA) += clk-bcm21664.o + obj-$(CONFIG_COMMON_CLK_IPROC) += clk-iproc-armpll.o clk-iproc-pll.o clk-iproc-asiu.o +-obj-$(CONFIG_ARCH_BCM2835) += clk-bcm2835.o +-obj-$(CONFIG_ARCH_BCM2835) += clk-bcm2835-aux.o ++obj-$(CONFIG_ARCH_BCM2835)$(CONFIG_ARCH_BCM2708)$(CONFIG_ARCH_BCM2709) += clk-bcm2835.o ++obj-$(CONFIG_ARCH_BCM2835)$(CONFIG_ARCH_BCM2708)$(CONFIG_ARCH_BCM2709) += clk-bcm2835-aux.o + obj-$(CONFIG_COMMON_CLK_IPROC) += clk-ns2.o + obj-$(CONFIG_ARCH_BCM_CYGNUS) += clk-cygnus.o + obj-$(CONFIG_ARCH_BCM_NSP) += clk-nsp.o +diff --git a/drivers/mailbox/Kconfig b/drivers/mailbox/Kconfig +index 5305923..3de0dcb 100644 +--- a/drivers/mailbox/Kconfig ++++ b/drivers/mailbox/Kconfig +@@ -74,7 +74,7 @@ config ALTERA_MBOX + + config BCM2835_MBOX + tristate "BCM2835 Mailbox" +- depends on ARCH_BCM2835 ++ depends on ARCH_BCM2835 || ARCH_BCM2708 || ARCH_BCM2709 + help + An implementation of the BCM2385 Mailbox. It is used to invoke + the services of the Videocore. Say Y here if you want to use the +diff --git a/drivers/mailbox/bcm2835-mailbox.c b/drivers/mailbox/bcm2835-mailbox.c +index cfb4b44..d9c6c21 100644 +--- a/drivers/mailbox/bcm2835-mailbox.c ++++ b/drivers/mailbox/bcm2835-mailbox.c +@@ -51,12 +51,15 @@ + #define MAIL1_WRT (ARM_0_MAIL1 + 0x00) + #define MAIL1_STA (ARM_0_MAIL1 + 0x18) + ++/* On ARCH_BCM270x these come through <linux/interrupt.h> (arm_control.h ) */ ++#ifndef ARM_MS_FULL + /* Status register: FIFO state. */ + #define ARM_MS_FULL BIT(31) + #define ARM_MS_EMPTY BIT(30) + + /* Configuration register: Enable interrupts. */ + #define ARM_MC_IHAVEDATAIRQEN BIT(0) ++#endif + + struct bcm2835_mbox { + void __iomem *regs; +@@ -151,7 +154,7 @@ static int bcm2835_mbox_probe(struct platform_device *pdev) + return -ENOMEM; + spin_lock_init(&mbox->lock); + +- ret = devm_request_irq(dev, irq_of_parse_and_map(dev->of_node, 0), ++ ret = devm_request_irq(dev, platform_get_irq(pdev, 0), + bcm2835_mbox_irq, 0, dev_name(dev), mbox); + if (ret) { + dev_err(dev, "Failed to register a mailbox IRQ handler: %d\n", +@@ -209,7 +212,18 @@ static struct platform_driver bcm2835_mbox_driver = { + .probe = bcm2835_mbox_probe, + .remove = bcm2835_mbox_remove, + }; +-module_platform_driver(bcm2835_mbox_driver); ++ ++static int __init bcm2835_mbox_init(void) ++{ ++ return platform_driver_register(&bcm2835_mbox_driver); ++} ++arch_initcall(bcm2835_mbox_init); ++ ++static void __init bcm2835_mbox_exit(void) ++{ ++ platform_driver_unregister(&bcm2835_mbox_driver); ++} ++module_exit(bcm2835_mbox_exit); + + MODULE_AUTHOR("Lubomir Rintel <lkundrak@v3.sk>"); + MODULE_DESCRIPTION("BCM2835 mailbox IPC driver"); +diff --git a/drivers/pinctrl/Makefile b/drivers/pinctrl/Makefile +index e4bc115..d996fe7 100644 +--- a/drivers/pinctrl/Makefile ++++ b/drivers/pinctrl/Makefile +@@ -35,6 +35,7 @@ obj-$(CONFIG_PINCTRL_TB10X) += pinctrl-tb10x.o + obj-$(CONFIG_PINCTRL_ST) += pinctrl-st.o + obj-$(CONFIG_PINCTRL_ZYNQ) += pinctrl-zynq.o + ++obj-$(CONFIG_ARCH_BCM2708)$(CONFIG_ARCH_BCM2709) += bcm/ + obj-$(CONFIG_ARCH_BCM) += bcm/ + obj-$(CONFIG_PINCTRL_BERLIN) += berlin/ + obj-y += freescale/ +diff --git a/drivers/pwm/Kconfig b/drivers/pwm/Kconfig +index c182efc..fe0f845 100644 +--- a/drivers/pwm/Kconfig ++++ b/drivers/pwm/Kconfig +@@ -85,7 +85,7 @@ config PWM_BCM_KONA + + config PWM_BCM2835 + tristate "BCM2835 PWM support" +- depends on ARCH_BCM2835 ++ depends on ARCH_BCM2835 || ARCH_BCM2708 || ARCH_BCM2709 + help + PWM framework driver for BCM2835 controller (Raspberry Pi) + +diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig +index 9d8c84b..2a27a37 100644 +--- a/drivers/spi/Kconfig ++++ b/drivers/spi/Kconfig +@@ -94,7 +94,7 @@ config SPI_AXI_SPI_ENGINE + config SPI_BCM2835 + tristate "BCM2835 SPI controller" + depends on GPIOLIB +- depends on ARCH_BCM2835 || COMPILE_TEST ++ depends on ARCH_BCM2835 || ARCH_BCM2708 || ARCH_BCM2709 || COMPILE_TEST + help + This selects a driver for the Broadcom BCM2835 SPI master. + +@@ -105,7 +105,7 @@ config SPI_BCM2835 + + config SPI_BCM2835AUX + tristate "BCM2835 SPI auxiliary controller" +- depends on (ARCH_BCM2835 && GPIOLIB) || COMPILE_TEST ++ depends on ((ARCH_BCM2835 || ARCH_BCM2708 || ARCH_BCM2709) && GPIOLIB) || COMPILE_TEST + help + This selects a driver for the Broadcom BCM2835 SPI aux master. + +diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig +index fb94765..8b2de7f 100644 +--- a/drivers/watchdog/Kconfig ++++ b/drivers/watchdog/Kconfig +@@ -1401,7 +1401,7 @@ config BCM63XX_WDT + + config BCM2835_WDT + tristate "Broadcom BCM2835 hardware watchdog" +- depends on ARCH_BCM2835 ++ depends on ARCH_BCM2835 || ARCH_BCM2708 || ARCH_BCM2709 + select WATCHDOG_CORE + help + Watchdog driver for the built in watchdog hardware in Broadcom +diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig +index 6a834e1..c5070ae 100644 +--- a/sound/soc/bcm/Kconfig ++++ b/sound/soc/bcm/Kconfig +@@ -1,6 +1,6 @@ + config SND_BCM2835_SOC_I2S + tristate "SoC Audio support for the Broadcom BCM2835 I2S module" +- depends on ARCH_BCM2835 || COMPILE_TEST ++ depends on ARCH_BCM2835 || MACH_BCM2708 || MACH_BCM2709 || COMPILE_TEST + select SND_SOC_GENERIC_DMAENGINE_PCM + select REGMAP_MMIO + help + +From 153b5f0f1f31e246cfc43ff80c07df63ca16cd31 Mon Sep 17 00:00:00 2001 +From: popcornmix <popcornmix@gmail.com> +Date: Wed, 1 May 2013 19:46:17 +0100 +Subject: [PATCH 033/112] Add dwc_otg driver +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: popcornmix <popcornmix@gmail.com> + +usb: dwc: fix lockdep false positive + +Signed-off-by: Kari Suvanto <karis79@gmail.com> + +usb: dwc: fix inconsistent lock state + +Signed-off-by: Kari Suvanto <karis79@gmail.com> + +Add FIQ patch to dwc_otg driver. Enable with dwc_otg.fiq_fix_enable=1. Should give about 10% more ARM performance. +Thanks to Gordon and Costas + +Avoid dynamic memory allocation for channel lock in USB driver. Thanks ddv2005. + +Add NAK holdoff scheme. Enabled by default, disable with dwc_otg.nak_holdoff_enable=0. Thanks gsh + +Make sure we wait for the reset to finish + +dwc_otg: fix bug in dwc_otg_hcd.c resulting in silent kernel + memory corruption, escalating to OOPS under high USB load. + +dwc_otg: Fix unsafe access of QTD during URB enqueue + +In dwc_otg_hcd_urb_enqueue during qtd creation, it was possible that the +transaction could complete almost immediately after the qtd was assigned +to a host channel during URB enqueue, which meant the qtd pointer was no +longer valid having been completed and removed. Usually, this resulted in +an OOPS during URB submission. By predetermining whether transactions +need to be queued or not, this unsafe pointer access is avoided. + +This bug was only evident on the Pi model A where a device was attached +that had no periodic endpoints (e.g. USB pendrive or some wlan devices). + +dwc_otg: Fix incorrect URB allocation error handling + +If the memory allocation for a dwc_otg_urb failed, the kernel would OOPS +because for some reason a member of the *unallocated* struct was set to +zero. Error handling changed to fail correctly. + +dwc_otg: fix potential use-after-free case in interrupt handler + +If a transaction had previously aborted, certain interrupts are +enabled to track error counts and reset where necessary. On IN +endpoints the host generates an ACK interrupt near-simultaneously +with completion of transfer. In the case where this transfer had +previously had an error, this results in a use-after-free on +the QTD memory space with a 1-byte length being overwritten to +0x00. + +dwc_otg: add handling of SPLIT transaction data toggle errors + +Previously a data toggle error on packets from a USB1.1 device behind +a TT would result in the Pi locking up as the driver never handled +the associated interrupt. Patch adds basic retry mechanism and +interrupt acknowledgement to cater for either a chance toggle error or +for devices that have a broken initial toggle state (FT8U232/FT232BM). + +dwc_otg: implement tasklet for returning URBs to usbcore hcd layer + +The dwc_otg driver interrupt handler for transfer completion will spend +a very long time with interrupts disabled when a URB is completed - +this is because usb_hcd_giveback_urb is called from within the handler +which for a USB device driver with complicated processing (e.g. webcam) +will take an exorbitant amount of time to complete. This results in +missed completion interrupts for other USB packets which lead to them +being dropped due to microframe overruns. + +This patch splits returning the URB to the usb hcd layer into a +high-priority tasklet. This will have most benefit for isochronous IN +transfers but will also have incidental benefit where multiple periodic +devices are active at once. + +dwc_otg: fix NAK holdoff and allow on split transactions only + +This corrects a bug where if a single active non-periodic endpoint +had at least one transaction in its qh, on frnum == MAX_FRNUM the qh +would get skipped and never get queued again. This would result in +a silent device until error detection (automatic or otherwise) would +either reset the device or flush and requeue the URBs. + +Additionally the NAK holdoff was enabled for all transactions - this +would potentially stall a HS endpoint for 1ms if a previous error state +enabled this interrupt and the next response was a NAK. Fix so that +only split transactions get held off. + +dwc_otg: Call usb_hcd_unlink_urb_from_ep with lock held in completion handler + +usb_hcd_unlink_urb_from_ep must be called with the HCD lock held. Calling it +asynchronously in the tasklet was not safe (regression in +c4564d4a1a0a9b10d4419e48239f5d99e88d2667). + +This change unlinks it from the endpoint prior to queueing it for handling in +the tasklet, and also adds a check to ensure the urb is OK to be unlinked +before doing so. + +NULL pointer dereference kernel oopses had been observed in usb_hcd_giveback_urb +when a USB device was unplugged/replugged during data transfer. This effect +was reproduced using automated USB port power control, hundreds of replug +events were performed during active transfers to confirm that the problem was +eliminated. + +USB fix using a FIQ to implement split transactions + +This commit adds a FIQ implementaion that schedules +the split transactions using a FIQ so we don't get +held off by the interrupt latency of Linux + +dwc_otg: fix device attributes and avoid kernel warnings on boot + +dcw_otg: avoid logging function that can cause panics + +See: https://github.com/raspberrypi/firmware/issues/21 +Thanks to cleverca22 for fix + +dwc_otg: mask correct interrupts after transaction error recovery + +The dwc_otg driver will unmask certain interrupts on a transaction +that previously halted in the error state in order to reset the +QTD error count. The various fine-grained interrupt handlers do not +consider that other interrupts besides themselves were unmasked. + +By disabling the two other interrupts only ever enabled in DMA mode +for this purpose, we can avoid unnecessary function calls in the +IRQ handler. This will also prevent an unneccesary FIQ interrupt +from being generated if the FIQ is enabled. + +dwc_otg: fiq: prevent FIQ thrash and incorrect state passing to IRQ + +In the case of a transaction to a device that had previously aborted +due to an error, several interrupts are enabled to reset the error +count when a device responds. This has the side-effect of making the +FIQ thrash because the hardware will generate multiple instances of +a NAK on an IN bulk/interrupt endpoint and multiple instances of ACK +on an OUT bulk/interrupt endpoint. Make the FIQ mask and clear the +associated interrupts. + +Additionally, on non-split transactions make sure that only unmasked +interrupts are cleared. This caused a hard-to-trigger but serious +race condition when you had the combination of an endpoint awaiting +error recovery and a transaction completed on an endpoint - due to +the sequencing and timing of interrupts generated by the dwc_otg core, +it was possible to confuse the IRQ handler. + +Fix function tracing + +dwc_otg: whitespace cleanup in dwc_otg_urb_enqueue + +dwc_otg: prevent OOPSes during device disconnects + +The dwc_otg_urb_enqueue function is thread-unsafe. In particular the +access of urb->hcpriv, usb_hcd_link_urb_to_ep, dwc_otg_urb->qtd and +friends does not occur within a critical section and so if a device +was unplugged during activity there was a high chance that the +usbcore hub_thread would try to disable the endpoint with partially- +formed entries in the URB queue. This would result in BUG() or null +pointer dereferences. + +Fix so that access of urb->hcpriv, enqueuing to the hardware and +adding to usbcore endpoint URB lists is contained within a single +critical section. + +dwc_otg: prevent BUG() in TT allocation if hub address is > 16 + +A fixed-size array is used to track TT allocation. This was +previously set to 16 which caused a crash because +dwc_otg_hcd_allocate_port would read past the end of the array. + +This was hit if a hub was plugged in which enumerated as addr > 16, +due to previous device resets or unplugs. + +Also add #ifdef FIQ_DEBUG around hcd->hub_port_alloc[], which grows +to a large size if 128 hub addresses are supported. This field is +for debug only for tracking which frame an allocate happened in. + +dwc_otg: make channel halts with unknown state less damaging + +If the IRQ received a channel halt interrupt through the FIQ +with no other bits set, the IRQ would not release the host +channel and never complete the URB. + +Add catchall handling to treat as a transaction error and retry. + +dwc_otg: fiq_split: use TTs with more granularity + +This fixes certain issues with split transaction scheduling. + +- Isochronous multi-packet OUT transactions now hog the TT until + they are completed - this prevents hubs aborting transactions + if they get a periodic start-split out-of-order +- Don't perform TT allocation on non-periodic endpoints - this + allows simultaneous use of the TT's bulk/control and periodic + transaction buffers + +This commit will mainly affect USB audio playback. + +dwc_otg: fix potential sleep while atomic during urb enqueue + +Fixes a regression introduced with eb1b482a. Kmalloc called from +dwc_otg_hcd_qtd_add / dwc_otg_hcd_qtd_create did not always have +the GPF_ATOMIC flag set. Force this flag when inside the larger +critical section. + +dwc_otg: make fiq_split_enable imply fiq_fix_enable + +Failing to set up the FIQ correctly would result in +"IRQ 32: nobody cared" errors in dmesg. + +dwc_otg: prevent crashes on host port disconnects + +Fix several issues resulting in crashes or inconsistent state +if a Model A root port was disconnected. + +- Clean up queue heads properly in kill_urbs_in_qh_list by + removing the empty QHs from the schedule lists +- Set the halt status properly to prevent IRQ handlers from + using freed memory +- Add fiq_split related cleanup for saved registers +- Make microframe scheduling reclaim host channels if + active during a disconnect +- Abort URBs with -ESHUTDOWN status response, informing + device drivers so they respond in a more correct fashion + and don't try to resubmit URBs +- Prevent IRQ handlers from attempting to handle channel + interrupts if the associated URB was dequeued (and the + driver state was cleared) + +dwc_otg: prevent leaking URBs during enqueue + +A dwc_otg_urb would get leaked if the HCD enqueue function +failed for any reason. Free the URB at the appropriate points. + +dwc_otg: Enable NAK holdoff for control split transactions + +Certain low-speed devices take a very long time to complete a +data or status stage of a control transaction, producing NAK +responses until they complete internal processing - the USB2.0 +spec limit is up to 500mS. This causes the same type of interrupt +storm as seen with USB-serial dongles prior to c8edb238. + +In certain circumstances, usually while booting, this interrupt +storm could cause SD card timeouts. + +dwc_otg: Fix for occasional lockup on boot when doing a USB reset + +dwc_otg: Don't issue traffic to LS devices in FS mode + +Issuing low-speed packets when the root port is in full-speed mode +causes the root port to stop responding. Explicitly fail when +enqueuing URBs to a LS endpoint on a FS bus. + +Fix ARM architecture issue with local_irq_restore() + +If local_fiq_enable() is called before a local_irq_restore(flags) where +the flags variable has the F bit set, the FIQ will be erroneously disabled. + +Fixup arch_local_irq_restore to avoid trampling the F bit in CPSR. + +Also fix some of the hacks previously implemented for previous dwc_otg +incarnations. + +dwc_otg: fiq_fsm: Base commit for driver rewrite + +This commit removes the previous FIQ fixes entirely and adds fiq_fsm. + +This rewrite features much more complete support for split transactions +and takes into account several OTG hardware bugs. High-speed +isochronous transactions are also capable of being performed by fiq_fsm. + +All driver options have been removed and replaced with: + - dwc_otg.fiq_enable (bool) + - dwc_otg.fiq_fsm_enable (bool) + - dwc_otg.fiq_fsm_mask (bitmask) + - dwc_otg.nak_holdoff (unsigned int) + +Defaults are specified such that fiq_fsm behaves similarly to the +previously implemented FIQ fixes. + +fiq_fsm: Push error recovery into the FIQ when fiq_fsm is used + +If the transfer associated with a QTD failed due to a bus error, the HCD +would retry the transfer up to 3 times (implementing the USB2.0 +three-strikes retry in software). + +Due to the masking mechanism used by fiq_fsm, it is only possible to pass +a single interrupt through to the HCD per-transfer. + +In this instance host channels would fall off the radar because the error +reset would function, but the subsequent channel halt would be lost. + +Push the error count reset into the FIQ handler. + +fiq_fsm: Implement timeout mechanism + +For full-speed endpoints with a large packet size, interrupt latency +runs the risk of the FIQ starting a transaction too late in a full-speed +frame. If the device is still transmitting data when EOF2 for the +downstream frame occurs, the hub will disable the port. This change is +not reflected in the hub status endpoint and the device becomes +unresponsive. + +Prevent high-bandwidth transactions from being started too late in a +frame. The mechanism is not guaranteed: a combination of bit stuffing +and hub latency may still result in a device overrunning. + +fiq_fsm: fix bounce buffer utilisation for Isochronous OUT + +Multi-packet isochronous OUT transactions were subject to a few bounday +bugs. Fix them. + +Audio playback is now much more robust: however, an issue stands with +devices that have adaptive sinks - ALSA plays samples too fast. + +dwc_otg: Return full-speed frame numbers in HS mode + +The frame counter increments on every *microframe* in high-speed mode. +Most device drivers expect this number to be in full-speed frames - this +caused considerable confusion to e.g. snd_usb_audio which uses the +frame counter to estimate the number of samples played. + +fiq_fsm: save PID on completion of interrupt OUT transfers + +Also add edge case handling for interrupt transports. + +Note that for periodic split IN, data toggles are unimplemented in the +OTG host hardware - it unconditionally accepts any PID. + +fiq_fsm: add missing case for fiq_fsm_tt_in_use() + +Certain combinations of bitrate and endpoint activity could +result in a periodic transaction erroneously getting started +while the previous Isochronous OUT was still active. + +fiq_fsm: clear hcintmsk for aborted transactions + +Prevents the FIQ from erroneously handling interrupts +on a timed out channel. + +fiq_fsm: enable by default + +fiq_fsm: fix dequeues for non-periodic split transactions + +If a dequeue happened between the SSPLIT and CSPLIT phases of the +transaction, the HCD would never receive an interrupt. + +fiq_fsm: Disable by default + +fiq_fsm: Handle HC babble errors + +The HCTSIZ transfer size field raises a babble interrupt if +the counter wraps. Handle the resulting interrupt in this case. + +dwc_otg: fix interrupt registration for fiq_enable=0 + +Additionally make the module parameter conditional for wherever +hcd->fiq_state is touched. + +fiq_fsm: Enable by default + +dwc_otg: Fix various issues with root port and transaction errors + +Process the host port interrupts correctly (and don't trample them). +Root port hotplug now functional again. + +Fix a few thinkos with the transaction error passthrough for fiq_fsm. + +fiq_fsm: Implement hack for Split Interrupt transactions + +Hubs aren't too picky about which endpoint we send Control type split +transactions to. By treating Interrupt transfers as Control, it is +possible to use the non-periodic queue in the OTG core as well as the +non-periodic FIFOs in the hub itself. This massively reduces the +microframe exclusivity/contention that periodic split transactions +otherwise have to enforce. + +It goes without saying that this is a fairly egregious USB specification +violation, but it works. + +Original idea by Hans Petter Selasky @ FreeBSD.org. + +dwc_otg: FIQ support on SMP. Set up FIQ stack and handler on Core 0 only. + +dwc_otg: introduce fiq_fsm_spin(un|)lock() + +SMP safety for the FIQ relies on register read-modify write cycles being +completed in the correct order. Several places in the DWC code modify +registers also touched by the FIQ. Protect these by a bare-bones lock +mechanism. + +This also makes it possible to run the FIQ and IRQ handlers on different +cores. + +fiq_fsm: fix build on bcm2708 and bcm2709 platforms + +dwc_otg: put some barriers back where they should be for UP + +bcm2709/dwc_otg: Setup FIQ on core 1 if >1 core active + +dwc_otg: fixup read-modify-write in critical paths + +Be more careful about read-modify-write on registers that the FIQ +also touches. + +Guard fiq_fsm_spin_lock with fiq_enable check + +fiq_fsm: Falling out of the state machine isn't fatal + +This edge case can be hit if the port is disabled while the FIQ is +in the middle of a transaction. Make the effects less severe. + +Also get rid of the useless return value. + +squash: dwc_otg: Allow to build without SMP + +usb: core: make overcurrent messages more prominent + +Hub overcurrent messages are more serious than "debug". Increase loglevel. + +usb: dwc_otg: Don't use dma_to_virt() + +Commit 6ce0d20 changes dma_to_virt() which breaks this driver. +Open code the old dma_to_virt() implementation to work around this. + +Limit the use of __bus_to_virt() to cases where transfer_buffer_length +is set and transfer_buffer is not set. This is done to increase the +chance that this driver will also work on ARCH_BCM2835. + +transfer_buffer should not be NULL if the length is set, but the +comment in the code indicates that there are situations where this +might happen. drivers/usb/isp1760/isp1760-hcd.c also has a similar +comment pointing to a possible: 'usb storage / SCSI bug'. + +Signed-off-by: Noralf Trønnes <noralf@tronnes.org> + +dwc_otg: Fix crash when fiq_enable=0 + +dwc_otg: fiq_fsm: Make high-speed isochronous strided transfers work properly + +Certain low-bandwidth high-speed USB devices (specialist audio devices, +compressed-frame webcams) have packet intervals > 1 microframe. + +Stride these transfers in the FIQ by using the start-of-frame interrupt +to restart the channel at the right time. + +dwc_otg: Force host mode to fix incorrect compute module boards + +dwc_otg: Add ARCH_BCM2835 support + +Signed-off-by: Noralf Trønnes <noralf@tronnes.org> + +dwc_otg: Simplify FIQ irq number code + +Dropping ATAGS means we can simplify the FIQ irq number code. +Also add error checking on the returned irq number. + +Signed-off-by: Noralf Trønnes <noralf@tronnes.org> + +dwc_otg: Remove duplicate gadget probe/unregister function + +dwc_otg: Properly set the HFIR + +Douglas Anderson reported: + +According to the most up to date version of the dwc2 databook, the FRINT +field of the HFIR register should be programmed to: +* 125 us * (PHY clock freq for HS) - 1 +* 1000 us * (PHY clock freq for FS/LS) - 1 + +This is opposed to older versions of the doc that claimed it should be: +* 125 us * (PHY clock freq for HS) +* 1000 us * (PHY clock freq for FS/LS) + +and reported lower timing jitter on a USB analyser + +dcw_otg: trim xfer length when buffer larger than allocated size is received + +dwc_otg: Don't free qh align buffers in atomic context + +dwc_otg: Enable the hack for Split Interrupt transactions by default + +dwc_otg.fiq_fsm_mask=0xF has long been a suggestion for users with audio stutters or other USB bandwidth issues. +So far we are aware of many success stories but no failure caused by this setting. +Make it a default to learn more. + +See: https://www.raspberrypi.org/forums/viewtopic.php?f=28&t=70437 + +Signed-off-by: popcornmix <popcornmix@gmail.com> +--- + arch/arm/include/asm/irqflags.h | 16 +- + arch/arm/kernel/fiqasm.S | 4 + + drivers/usb/Makefile | 1 + + drivers/usb/core/generic.c | 1 + + drivers/usb/core/hub.c | 2 +- + drivers/usb/core/message.c | 79 + + drivers/usb/core/otg_whitelist.h | 114 +- + drivers/usb/gadget/file_storage.c | 3676 ++++++++++ + drivers/usb/host/Kconfig | 13 + + drivers/usb/host/Makefile | 2 + + drivers/usb/host/dwc_common_port/Makefile | 58 + + drivers/usb/host/dwc_common_port/Makefile.fbsd | 17 + + drivers/usb/host/dwc_common_port/Makefile.linux | 49 + + drivers/usb/host/dwc_common_port/changes.txt | 174 + + drivers/usb/host/dwc_common_port/doc/doxygen.cfg | 270 + + drivers/usb/host/dwc_common_port/dwc_cc.c | 532 ++ + drivers/usb/host/dwc_common_port/dwc_cc.h | 224 + + drivers/usb/host/dwc_common_port/dwc_common_fbsd.c | 1308 ++++ + .../usb/host/dwc_common_port/dwc_common_linux.c | 1433 ++++ + drivers/usb/host/dwc_common_port/dwc_common_nbsd.c | 1275 ++++ + drivers/usb/host/dwc_common_port/dwc_crypto.c | 308 + + drivers/usb/host/dwc_common_port/dwc_crypto.h | 111 + + drivers/usb/host/dwc_common_port/dwc_dh.c | 291 + + drivers/usb/host/dwc_common_port/dwc_dh.h | 106 + + drivers/usb/host/dwc_common_port/dwc_list.h | 594 ++ + drivers/usb/host/dwc_common_port/dwc_mem.c | 245 + + drivers/usb/host/dwc_common_port/dwc_modpow.c | 636 ++ + drivers/usb/host/dwc_common_port/dwc_modpow.h | 34 + + drivers/usb/host/dwc_common_port/dwc_notifier.c | 319 + + drivers/usb/host/dwc_common_port/dwc_notifier.h | 122 + + drivers/usb/host/dwc_common_port/dwc_os.h | 1276 ++++ + drivers/usb/host/dwc_common_port/usb.h | 946 +++ + drivers/usb/host/dwc_otg/Makefile | 82 + + drivers/usb/host/dwc_otg/doc/doxygen.cfg | 224 + + drivers/usb/host/dwc_otg/dummy_audio.c | 1575 +++++ + drivers/usb/host/dwc_otg/dwc_cfi_common.h | 142 + + drivers/usb/host/dwc_otg/dwc_otg_adp.c | 854 +++ + drivers/usb/host/dwc_otg/dwc_otg_adp.h | 80 + + drivers/usb/host/dwc_otg/dwc_otg_attr.c | 1210 ++++ + drivers/usb/host/dwc_otg/dwc_otg_attr.h | 89 + + drivers/usb/host/dwc_otg/dwc_otg_cfi.c | 1876 +++++ + drivers/usb/host/dwc_otg/dwc_otg_cfi.h | 320 + + drivers/usb/host/dwc_otg/dwc_otg_cil.c | 7141 ++++++++++++++++++++ + drivers/usb/host/dwc_otg/dwc_otg_cil.h | 1464 ++++ + drivers/usb/host/dwc_otg/dwc_otg_cil_intr.c | 1594 +++++ + drivers/usb/host/dwc_otg/dwc_otg_core_if.h | 705 ++ + drivers/usb/host/dwc_otg/dwc_otg_dbg.h | 117 + + drivers/usb/host/dwc_otg/dwc_otg_driver.c | 1757 +++++ + drivers/usb/host/dwc_otg/dwc_otg_driver.h | 86 + + drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c | 1355 ++++ + drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.h | 370 + + drivers/usb/host/dwc_otg/dwc_otg_fiq_stub.S | 80 + + drivers/usb/host/dwc_otg/dwc_otg_hcd.c | 4257 ++++++++++++ + drivers/usb/host/dwc_otg/dwc_otg_hcd.h | 862 +++ + drivers/usb/host/dwc_otg/dwc_otg_hcd_ddma.c | 1132 ++++ + drivers/usb/host/dwc_otg/dwc_otg_hcd_if.h | 417 ++ + drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c | 2727 ++++++++ + drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c | 1005 +++ + drivers/usb/host/dwc_otg/dwc_otg_hcd_queue.c | 962 +++ + drivers/usb/host/dwc_otg/dwc_otg_os_dep.h | 188 + + drivers/usb/host/dwc_otg/dwc_otg_pcd.c | 2712 ++++++++ + drivers/usb/host/dwc_otg/dwc_otg_pcd.h | 266 + + drivers/usb/host/dwc_otg/dwc_otg_pcd_if.h | 360 + + drivers/usb/host/dwc_otg/dwc_otg_pcd_intr.c | 5147 ++++++++++++++ + drivers/usb/host/dwc_otg/dwc_otg_pcd_linux.c | 1280 ++++ + drivers/usb/host/dwc_otg/dwc_otg_regs.h | 2550 +++++++ + drivers/usb/host/dwc_otg/test/Makefile | 16 + + drivers/usb/host/dwc_otg/test/dwc_otg_test.pm | 337 + + drivers/usb/host/dwc_otg/test/test_mod_param.pl | 133 + + drivers/usb/host/dwc_otg/test/test_sysfs.pl | 193 + + 70 files changed, 59885 insertions(+), 16 deletions(-) + create mode 100644 drivers/usb/gadget/file_storage.c + create mode 100644 drivers/usb/host/dwc_common_port/Makefile + create mode 100644 drivers/usb/host/dwc_common_port/Makefile.fbsd + create mode 100644 drivers/usb/host/dwc_common_port/Makefile.linux + create mode 100644 drivers/usb/host/dwc_common_port/changes.txt + create mode 100644 drivers/usb/host/dwc_common_port/doc/doxygen.cfg + create mode 100644 drivers/usb/host/dwc_common_port/dwc_cc.c + create mode 100644 drivers/usb/host/dwc_common_port/dwc_cc.h + create mode 100644 drivers/usb/host/dwc_common_port/dwc_common_fbsd.c + create mode 100644 drivers/usb/host/dwc_common_port/dwc_common_linux.c + create mode 100644 drivers/usb/host/dwc_common_port/dwc_common_nbsd.c + create mode 100644 drivers/usb/host/dwc_common_port/dwc_crypto.c + create mode 100644 drivers/usb/host/dwc_common_port/dwc_crypto.h + create mode 100644 drivers/usb/host/dwc_common_port/dwc_dh.c + create mode 100644 drivers/usb/host/dwc_common_port/dwc_dh.h + create mode 100644 drivers/usb/host/dwc_common_port/dwc_list.h + create mode 100644 drivers/usb/host/dwc_common_port/dwc_mem.c + create mode 100644 drivers/usb/host/dwc_common_port/dwc_modpow.c + create mode 100644 drivers/usb/host/dwc_common_port/dwc_modpow.h + create mode 100644 drivers/usb/host/dwc_common_port/dwc_notifier.c + create mode 100644 drivers/usb/host/dwc_common_port/dwc_notifier.h + create mode 100644 drivers/usb/host/dwc_common_port/dwc_os.h + create mode 100644 drivers/usb/host/dwc_common_port/usb.h + create mode 100644 drivers/usb/host/dwc_otg/Makefile + create mode 100644 drivers/usb/host/dwc_otg/doc/doxygen.cfg + create mode 100644 drivers/usb/host/dwc_otg/dummy_audio.c + create mode 100644 drivers/usb/host/dwc_otg/dwc_cfi_common.h + create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_adp.c + create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_adp.h + create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_attr.c + create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_attr.h + create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_cfi.c + create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_cfi.h + create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_cil.c + create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_cil.h + create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_cil_intr.c + create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_core_if.h + create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_dbg.h + create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_driver.c + create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_driver.h + create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c + create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.h + create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_fiq_stub.S + create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_hcd.c + create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_hcd.h + create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_hcd_ddma.c + create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_hcd_if.h + create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c + create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c + create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_hcd_queue.c + create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_os_dep.h + create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_pcd.c + create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_pcd.h + create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_pcd_if.h + create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_pcd_intr.c + create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_pcd_linux.c + create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_regs.h + create mode 100644 drivers/usb/host/dwc_otg/test/Makefile + create mode 100644 drivers/usb/host/dwc_otg/test/dwc_otg_test.pm + create mode 100644 drivers/usb/host/dwc_otg/test/test_mod_param.pl + create mode 100644 drivers/usb/host/dwc_otg/test/test_sysfs.pl + +diff --git a/arch/arm/include/asm/irqflags.h b/arch/arm/include/asm/irqflags.h +index e6b70d9..a48ccf7 100644 +--- a/arch/arm/include/asm/irqflags.h ++++ b/arch/arm/include/asm/irqflags.h +@@ -162,13 +162,23 @@ static inline unsigned long arch_local_save_flags(void) + } + + /* +- * restore saved IRQ & FIQ state ++ * restore saved IRQ state + */ + #define arch_local_irq_restore arch_local_irq_restore + static inline void arch_local_irq_restore(unsigned long flags) + { +- asm volatile( +- " msr " IRQMASK_REG_NAME_W ", %0 @ local_irq_restore" ++ unsigned long temp = 0; ++ flags &= ~(1 << 6); ++ asm volatile ( ++ " mrs %0, cpsr" ++ : "=r" (temp) ++ : ++ : "memory", "cc"); ++ /* Preserve FIQ bit */ ++ temp &= (1 << 6); ++ flags = flags | temp; ++ asm volatile ( ++ " msr cpsr_c, %0 @ local_irq_restore" + : + : "r" (flags) + : "memory", "cc"); +diff --git a/arch/arm/kernel/fiqasm.S b/arch/arm/kernel/fiqasm.S +index 8dd26e1..eef4847 100644 +--- a/arch/arm/kernel/fiqasm.S ++++ b/arch/arm/kernel/fiqasm.S +@@ -47,3 +47,7 @@ ENTRY(__get_fiq_regs) + mov r0, r0 @ avoid hazard prior to ARMv4 + ret lr + ENDPROC(__get_fiq_regs) ++ ++ENTRY(__FIQ_Branch) ++ mov pc, r8 ++ENDPROC(__FIQ_Branch) +diff --git a/drivers/usb/Makefile b/drivers/usb/Makefile +index dca7856..5c467de 100644 +--- a/drivers/usb/Makefile ++++ b/drivers/usb/Makefile +@@ -7,6 +7,7 @@ + obj-$(CONFIG_USB) += core/ + obj-$(CONFIG_USB_SUPPORT) += phy/ + ++obj-$(CONFIG_USB_DWCOTG) += host/ + obj-$(CONFIG_USB_DWC3) += dwc3/ + obj-$(CONFIG_USB_DWC2) += dwc2/ + obj-$(CONFIG_USB_ISP1760) += isp1760/ +diff --git a/drivers/usb/core/generic.c b/drivers/usb/core/generic.c +index 358ca8d..abaac7c 100644 +--- a/drivers/usb/core/generic.c ++++ b/drivers/usb/core/generic.c +@@ -152,6 +152,7 @@ int usb_choose_configuration(struct usb_device *udev) + dev_warn(&udev->dev, + "no configuration chosen from %d choice%s\n", + num_configs, plural(num_configs)); ++ dev_warn(&udev->dev, "No support over %dmA\n", udev->bus_mA); + } + return i; + } +diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c +index 1ab42bf..292a26c 100644 +--- a/drivers/usb/core/hub.c ++++ b/drivers/usb/core/hub.c +@@ -5044,7 +5044,7 @@ static void port_event(struct usb_hub *hub, int port1) + if (portchange & USB_PORT_STAT_C_OVERCURRENT) { + u16 status = 0, unused; + +- dev_dbg(&port_dev->dev, "over-current change\n"); ++ dev_notice(&port_dev->dev, "over-current change\n"); + usb_clear_port_feature(hdev, port1, + USB_PORT_FEAT_C_OVER_CURRENT); + msleep(100); /* Cool down */ +diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c +index 8e641b5..de3ed7d 100644 +--- a/drivers/usb/core/message.c ++++ b/drivers/usb/core/message.c +@@ -1909,6 +1909,85 @@ free_interfaces: + if (cp->string == NULL && + !(dev->quirks & USB_QUIRK_CONFIG_INTF_STRINGS)) + cp->string = usb_cache_string(dev, cp->desc.iConfiguration); ++/* Uncomment this define to enable the HS Electrical Test support */ ++#define DWC_HS_ELECT_TST 1 ++#ifdef DWC_HS_ELECT_TST ++ /* Here we implement the HS Electrical Test support. The ++ * tester uses a vendor ID of 0x1A0A to indicate we should ++ * run a special test sequence. The product ID tells us ++ * which sequence to run. We invoke the test sequence by ++ * sending a non-standard SetFeature command to our root ++ * hub port. Our dwc_otg_hcd_hub_control() routine will ++ * recognize the command and perform the desired test ++ * sequence. ++ */ ++ if (dev->descriptor.idVendor == 0x1A0A) { ++ /* HSOTG Electrical Test */ ++ dev_warn(&dev->dev, "VID from HSOTG Electrical Test Fixture\n"); ++ ++ if (dev->bus && dev->bus->root_hub) { ++ struct usb_device *hdev = dev->bus->root_hub; ++ dev_warn(&dev->dev, "Got PID 0x%x\n", dev->descriptor.idProduct); ++ ++ switch (dev->descriptor.idProduct) { ++ case 0x0101: /* TEST_SE0_NAK */ ++ dev_warn(&dev->dev, "TEST_SE0_NAK\n"); ++ usb_control_msg(hdev, usb_sndctrlpipe(hdev, 0), ++ USB_REQ_SET_FEATURE, USB_RT_PORT, ++ USB_PORT_FEAT_TEST, 0x300, NULL, 0, HZ); ++ break; ++ ++ case 0x0102: /* TEST_J */ ++ dev_warn(&dev->dev, "TEST_J\n"); ++ usb_control_msg(hdev, usb_sndctrlpipe(hdev, 0), ++ USB_REQ_SET_FEATURE, USB_RT_PORT, ++ USB_PORT_FEAT_TEST, 0x100, NULL, 0, HZ); ++ break; ++ ++ case 0x0103: /* TEST_K */ ++ dev_warn(&dev->dev, "TEST_K\n"); ++ usb_control_msg(hdev, usb_sndctrlpipe(hdev, 0), ++ USB_REQ_SET_FEATURE, USB_RT_PORT, ++ USB_PORT_FEAT_TEST, 0x200, NULL, 0, HZ); ++ break; ++ ++ case 0x0104: /* TEST_PACKET */ ++ dev_warn(&dev->dev, "TEST_PACKET\n"); ++ usb_control_msg(hdev, usb_sndctrlpipe(hdev, 0), ++ USB_REQ_SET_FEATURE, USB_RT_PORT, ++ USB_PORT_FEAT_TEST, 0x400, NULL, 0, HZ); ++ break; ++ ++ case 0x0105: /* TEST_FORCE_ENABLE */ ++ dev_warn(&dev->dev, "TEST_FORCE_ENABLE\n"); ++ usb_control_msg(hdev, usb_sndctrlpipe(hdev, 0), ++ USB_REQ_SET_FEATURE, USB_RT_PORT, ++ USB_PORT_FEAT_TEST, 0x500, NULL, 0, HZ); ++ break; ++ ++ case 0x0106: /* HS_HOST_PORT_SUSPEND_RESUME */ ++ dev_warn(&dev->dev, "HS_HOST_PORT_SUSPEND_RESUME\n"); ++ usb_control_msg(hdev, usb_sndctrlpipe(hdev, 0), ++ USB_REQ_SET_FEATURE, USB_RT_PORT, ++ USB_PORT_FEAT_TEST, 0x600, NULL, 0, 40 * HZ); ++ break; ++ ++ case 0x0107: /* SINGLE_STEP_GET_DEVICE_DESCRIPTOR setup */ ++ dev_warn(&dev->dev, "SINGLE_STEP_GET_DEVICE_DESCRIPTOR setup\n"); ++ usb_control_msg(hdev, usb_sndctrlpipe(hdev, 0), ++ USB_REQ_SET_FEATURE, USB_RT_PORT, ++ USB_PORT_FEAT_TEST, 0x700, NULL, 0, 40 * HZ); ++ break; ++ ++ case 0x0108: /* SINGLE_STEP_GET_DEVICE_DESCRIPTOR execute */ ++ dev_warn(&dev->dev, "SINGLE_STEP_GET_DEVICE_DESCRIPTOR execute\n"); ++ usb_control_msg(hdev, usb_sndctrlpipe(hdev, 0), ++ USB_REQ_SET_FEATURE, USB_RT_PORT, ++ USB_PORT_FEAT_TEST, 0x800, NULL, 0, 40 * HZ); ++ } ++ } ++ } ++#endif /* DWC_HS_ELECT_TST */ + + /* Now that the interfaces are installed, re-enable LPM. */ + usb_unlocked_enable_lpm(dev); +diff --git a/drivers/usb/core/otg_whitelist.h b/drivers/usb/core/otg_whitelist.h +index a95b0c9..17b605f 100644 +--- a/drivers/usb/core/otg_whitelist.h ++++ b/drivers/usb/core/otg_whitelist.h +@@ -19,33 +19,82 @@ + static struct usb_device_id whitelist_table[] = { + + /* hubs are optional in OTG, but very handy ... */ ++#define CERT_WITHOUT_HUBS ++#if defined(CERT_WITHOUT_HUBS) ++{ USB_DEVICE( 0x0000, 0x0000 ), }, /* Root HUB Only*/ ++#else + { USB_DEVICE_INFO(USB_CLASS_HUB, 0, 0), }, + { USB_DEVICE_INFO(USB_CLASS_HUB, 0, 1), }, ++{ USB_DEVICE_INFO(USB_CLASS_HUB, 0, 2), }, ++#endif + + #ifdef CONFIG_USB_PRINTER /* ignoring nonstatic linkage! */ + /* FIXME actually, printers are NOT supposed to use device classes; + * they're supposed to use interface classes... + */ +-{ USB_DEVICE_INFO(7, 1, 1) }, +-{ USB_DEVICE_INFO(7, 1, 2) }, +-{ USB_DEVICE_INFO(7, 1, 3) }, ++//{ USB_DEVICE_INFO(7, 1, 1) }, ++//{ USB_DEVICE_INFO(7, 1, 2) }, ++//{ USB_DEVICE_INFO(7, 1, 3) }, + #endif + + #ifdef CONFIG_USB_NET_CDCETHER + /* Linux-USB CDC Ethernet gadget */ +-{ USB_DEVICE(0x0525, 0xa4a1), }, ++//{ USB_DEVICE(0x0525, 0xa4a1), }, + /* Linux-USB CDC Ethernet + RNDIS gadget */ +-{ USB_DEVICE(0x0525, 0xa4a2), }, ++//{ USB_DEVICE(0x0525, 0xa4a2), }, + #endif + + #if defined(CONFIG_USB_TEST) || defined(CONFIG_USB_TEST_MODULE) + /* gadget zero, for testing */ +-{ USB_DEVICE(0x0525, 0xa4a0), }, ++//{ USB_DEVICE(0x0525, 0xa4a0), }, + #endif + ++/* OPT Tester */ ++{ USB_DEVICE( 0x1a0a, 0x0101 ), }, /* TEST_SE0_NAK */ ++{ USB_DEVICE( 0x1a0a, 0x0102 ), }, /* Test_J */ ++{ USB_DEVICE( 0x1a0a, 0x0103 ), }, /* Test_K */ ++{ USB_DEVICE( 0x1a0a, 0x0104 ), }, /* Test_PACKET */ ++{ USB_DEVICE( 0x1a0a, 0x0105 ), }, /* Test_FORCE_ENABLE */ ++{ USB_DEVICE( 0x1a0a, 0x0106 ), }, /* HS_PORT_SUSPEND_RESUME */ ++{ USB_DEVICE( 0x1a0a, 0x0107 ), }, /* SINGLE_STEP_GET_DESCRIPTOR setup */ ++{ USB_DEVICE( 0x1a0a, 0x0108 ), }, /* SINGLE_STEP_GET_DESCRIPTOR execute */ ++ ++/* Sony cameras */ ++{ USB_DEVICE_VER(0x054c,0x0010,0x0410, 0x0500), }, ++ ++/* Memory Devices */ ++//{ USB_DEVICE( 0x0781, 0x5150 ), }, /* SanDisk */ ++//{ USB_DEVICE( 0x05DC, 0x0080 ), }, /* Lexar */ ++//{ USB_DEVICE( 0x4146, 0x9281 ), }, /* IOMEGA */ ++//{ USB_DEVICE( 0x067b, 0x2507 ), }, /* Hammer 20GB External HD */ ++{ USB_DEVICE( 0x0EA0, 0x2168 ), }, /* Ours Technology Inc. (BUFFALO ClipDrive)*/ ++//{ USB_DEVICE( 0x0457, 0x0150 ), }, /* Silicon Integrated Systems Corp. */ ++ ++/* HP Printers */ ++//{ USB_DEVICE( 0x03F0, 0x1102 ), }, /* HP Photosmart 245 */ ++//{ USB_DEVICE( 0x03F0, 0x1302 ), }, /* HP Photosmart 370 Series */ ++ ++/* Speakers */ ++//{ USB_DEVICE( 0x0499, 0x3002 ), }, /* YAMAHA YST-MS35D USB Speakers */ ++//{ USB_DEVICE( 0x0672, 0x1041 ), }, /* Labtec USB Headset */ ++ + { } /* Terminating entry */ + }; + ++static inline void report_errors(struct usb_device *dev) ++{ ++ /* OTG MESSAGE: report errors here, customize to match your product */ ++ dev_info(&dev->dev, "device Vendor:%04x Product:%04x is not supported\n", ++ le16_to_cpu(dev->descriptor.idVendor), ++ le16_to_cpu(dev->descriptor.idProduct)); ++ if (USB_CLASS_HUB == dev->descriptor.bDeviceClass){ ++ dev_printk(KERN_CRIT, &dev->dev, "Unsupported Hub Topology\n"); ++ } else { ++ dev_printk(KERN_CRIT, &dev->dev, "Attached Device is not Supported\n"); ++ } ++} ++ ++ + static int is_targeted(struct usb_device *dev) + { + struct usb_device_id *id = whitelist_table; +@@ -95,16 +144,57 @@ static int is_targeted(struct usb_device *dev) + continue; + + return 1; +- } ++ /* NOTE: can't use usb_match_id() since interface caches ++ * aren't set up yet. this is cut/paste from that code. ++ */ ++ for (id = whitelist_table; id->match_flags; id++) { ++#ifdef DEBUG ++ dev_dbg(&dev->dev, ++ "ID: V:%04x P:%04x DC:%04x SC:%04x PR:%04x \n", ++ id->idVendor, ++ id->idProduct, ++ id->bDeviceClass, ++ id->bDeviceSubClass, ++ id->bDeviceProtocol); ++#endif + +- /* add other match criteria here ... */ ++ if ((id->match_flags & USB_DEVICE_ID_MATCH_VENDOR) && ++ id->idVendor != le16_to_cpu(dev->descriptor.idVendor)) ++ continue; + ++ if ((id->match_flags & USB_DEVICE_ID_MATCH_PRODUCT) && ++ id->idProduct != le16_to_cpu(dev->descriptor.idProduct)) ++ continue; + +- /* OTG MESSAGE: report errors here, customize to match your product */ +- dev_err(&dev->dev, "device v%04x p%04x is not supported\n", +- le16_to_cpu(dev->descriptor.idVendor), +- le16_to_cpu(dev->descriptor.idProduct)); ++ /* No need to test id->bcdDevice_lo != 0, since 0 is never ++ greater than any unsigned number. */ ++ if ((id->match_flags & USB_DEVICE_ID_MATCH_DEV_LO) && ++ (id->bcdDevice_lo > le16_to_cpu(dev->descriptor.bcdDevice))) ++ continue; ++ ++ if ((id->match_flags & USB_DEVICE_ID_MATCH_DEV_HI) && ++ (id->bcdDevice_hi < le16_to_cpu(dev->descriptor.bcdDevice))) ++ continue; ++ ++ if ((id->match_flags & USB_DEVICE_ID_MATCH_DEV_CLASS) && ++ (id->bDeviceClass != dev->descriptor.bDeviceClass)) ++ continue; ++ ++ if ((id->match_flags & USB_DEVICE_ID_MATCH_DEV_SUBCLASS) && ++ (id->bDeviceSubClass != dev->descriptor.bDeviceSubClass)) ++ continue; ++ ++ if ((id->match_flags & USB_DEVICE_ID_MATCH_DEV_PROTOCOL) && ++ (id->bDeviceProtocol != dev->descriptor.bDeviceProtocol)) ++ continue; ++ ++ return 1; ++ } ++ } ++ ++ /* add other match criteria here ... */ + ++ report_errors(dev); + return 0; + } + +diff --git a/drivers/usb/gadget/file_storage.c b/drivers/usb/gadget/file_storage.c +new file mode 100644 +index 0000000..a896d73 +--- /dev/null ++++ b/drivers/usb/gadget/file_storage.c +@@ -0,0 +1,3676 @@ ++/* ++ * file_storage.c -- File-backed USB Storage Gadget, for USB development ++ * ++ * Copyright (C) 2003-2008 Alan Stern ++ * 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, ++ * without modification. ++ * 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. ++ * 3. The names of the above-listed copyright holders may not be used ++ * to endorse or promote products derived from this software without ++ * specific prior written permission. ++ * ++ * ALTERNATIVELY, this software may be distributed under the terms of the ++ * GNU General Public License ("GPL") as published by the Free Software ++ * Foundation, either version 2 of that License or (at your option) any ++ * later version. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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. ++ */ ++ ++ ++/* ++ * The File-backed Storage Gadget acts as a USB Mass Storage device, ++ * appearing to the host as a disk drive or as a CD-ROM drive. In addition ++ * to providing an example of a genuinely useful gadget driver for a USB ++ * device, it also illustrates a technique of double-buffering for increased ++ * throughput. Last but not least, it gives an easy way to probe the ++ * behavior of the Mass Storage drivers in a USB host. ++ * ++ * Backing storage is provided by a regular file or a block device, specified ++ * by the "file" module parameter. Access can be limited to read-only by ++ * setting the optional "ro" module parameter. (For CD-ROM emulation, ++ * access is always read-only.) The gadget will indicate that it has ++ * removable media if the optional "removable" module parameter is set. ++ * ++ * The gadget supports the Control-Bulk (CB), Control-Bulk-Interrupt (CBI), ++ * and Bulk-Only (also known as Bulk-Bulk-Bulk or BBB) transports, selected ++ * by the optional "transport" module parameter. It also supports the ++ * following protocols: RBC (0x01), ATAPI or SFF-8020i (0x02), QIC-157 (0c03), ++ * UFI (0x04), SFF-8070i (0x05), and transparent SCSI (0x06), selected by ++ * the optional "protocol" module parameter. In addition, the default ++ * Vendor ID, Product ID, release number and serial number can be overridden. ++ * ++ * There is support for multiple logical units (LUNs), each of which has ++ * its own backing file. The number of LUNs can be set using the optional ++ * "luns" module parameter (anywhere from 1 to 8), and the corresponding ++ * files are specified using comma-separated lists for "file" and "ro". ++ * The default number of LUNs is taken from the number of "file" elements; ++ * it is 1 if "file" is not given. If "removable" is not set then a backing ++ * file must be specified for each LUN. If it is set, then an unspecified ++ * or empty backing filename means the LUN's medium is not loaded. Ideally ++ * each LUN would be settable independently as a disk drive or a CD-ROM ++ * drive, but currently all LUNs have to be the same type. The CD-ROM ++ * emulation includes a single data track and no audio tracks; hence there ++ * need be only one backing file per LUN. ++ * ++ * Requirements are modest; only a bulk-in and a bulk-out endpoint are ++ * needed (an interrupt-out endpoint is also needed for CBI). The memory ++ * requirement amounts to two 16K buffers, size configurable by a parameter. ++ * Support is included for both full-speed and high-speed operation. ++ * ++ * Note that the driver is slightly non-portable in that it assumes a ++ * single memory/DMA buffer will be useable for bulk-in, bulk-out, and ++ * interrupt-in endpoints. With most device controllers this isn't an ++ * issue, but there may be some with hardware restrictions that prevent ++ * a buffer from being used by more than one endpoint. ++ * ++ * Module options: ++ * ++ * file=filename[,filename...] ++ * Required if "removable" is not set, names of ++ * the files or block devices used for ++ * backing storage ++ * serial=HHHH... Required serial number (string of hex chars) ++ * ro=b[,b...] Default false, booleans for read-only access ++ * removable Default false, boolean for removable media ++ * luns=N Default N = number of filenames, number of ++ * LUNs to support ++ * nofua=b[,b...] Default false, booleans for ignore FUA flag ++ * in SCSI WRITE(10,12) commands ++ * stall Default determined according to the type of ++ * USB device controller (usually true), ++ * boolean to permit the driver to halt ++ * bulk endpoints ++ * cdrom Default false, boolean for whether to emulate ++ * a CD-ROM drive ++ * transport=XXX Default BBB, transport name (CB, CBI, or BBB) ++ * protocol=YYY Default SCSI, protocol name (RBC, 8020 or ++ * ATAPI, QIC, UFI, 8070, or SCSI; ++ * also 1 - 6) ++ * vendor=0xVVVV Default 0x0525 (NetChip), USB Vendor ID ++ * product=0xPPPP Default 0xa4a5 (FSG), USB Product ID ++ * release=0xRRRR Override the USB release number (bcdDevice) ++ * buflen=N Default N=16384, buffer size used (will be ++ * rounded down to a multiple of ++ * PAGE_CACHE_SIZE) ++ * ++ * If CONFIG_USB_FILE_STORAGE_TEST is not set, only the "file", "serial", "ro", ++ * "removable", "luns", "nofua", "stall", and "cdrom" options are available; ++ * default values are used for everything else. ++ * ++ * The pathnames of the backing files and the ro settings are available in ++ * the attribute files "file", "nofua", and "ro" in the lun<n> subdirectory of ++ * the gadget's sysfs directory. If the "removable" option is set, writing to ++ * these files will simulate ejecting/loading the medium (writing an empty ++ * line means eject) and adjusting a write-enable tab. Changes to the ro ++ * setting are not allowed when the medium is loaded or if CD-ROM emulation ++ * is being used. ++ * ++ * This gadget driver is heavily based on "Gadget Zero" by David Brownell. ++ * The driver's SCSI command interface was based on the "Information ++ * technology - Small Computer System Interface - 2" document from ++ * X3T9.2 Project 375D, Revision 10L, 7-SEP-93, available at ++ * <http://www.t10.org/ftp/t10/drafts/s2/s2-r10l.pdf>. The single exception ++ * is opcode 0x23 (READ FORMAT CAPACITIES), which was based on the ++ * "Universal Serial Bus Mass Storage Class UFI Command Specification" ++ * document, Revision 1.0, December 14, 1998, available at ++ * <http://www.usb.org/developers/devclass_docs/usbmass-ufi10.pdf>. ++ */ ++ ++ ++/* ++ * Driver Design ++ * ++ * The FSG driver is fairly straightforward. There is a main kernel ++ * thread that handles most of the work. Interrupt routines field ++ * callbacks from the controller driver: bulk- and interrupt-request ++ * completion notifications, endpoint-0 events, and disconnect events. ++ * Completion events are passed to the main thread by wakeup calls. Many ++ * ep0 requests are handled at interrupt time, but SetInterface, ++ * SetConfiguration, and device reset requests are forwarded to the ++ * thread in the form of "exceptions" using SIGUSR1 signals (since they ++ * should interrupt any ongoing file I/O operations). ++ * ++ * The thread's main routine implements the standard command/data/status ++ * parts of a SCSI interaction. It and its subroutines are full of tests ++ * for pending signals/exceptions -- all this polling is necessary since ++ * the kernel has no setjmp/longjmp equivalents. (Maybe this is an ++ * indication that the driver really wants to be running in userspace.) ++ * An important point is that so long as the thread is alive it keeps an ++ * open reference to the backing file. This will prevent unmounting ++ * the backing file's underlying filesystem and could cause problems ++ * during system shutdown, for example. To prevent such problems, the ++ * thread catches INT, TERM, and KILL signals and converts them into ++ * an EXIT exception. ++ * ++ * In normal operation the main thread is started during the gadget's ++ * fsg_bind() callback and stopped during fsg_unbind(). But it can also ++ * exit when it receives a signal, and there's no point leaving the ++ * gadget running when the thread is dead. So just before the thread ++ * exits, it deregisters the gadget driver. This makes things a little ++ * tricky: The driver is deregistered at two places, and the exiting ++ * thread can indirectly call fsg_unbind() which in turn can tell the ++ * thread to exit. The first problem is resolved through the use of the ++ * REGISTERED atomic bitflag; the driver will only be deregistered once. ++ * The second problem is resolved by having fsg_unbind() check ++ * fsg->state; it won't try to stop the thread if the state is already ++ * FSG_STATE_TERMINATED. ++ * ++ * To provide maximum throughput, the driver uses a circular pipeline of ++ * buffer heads (struct fsg_buffhd). In principle the pipeline can be ++ * arbitrarily long; in practice the benefits don't justify having more ++ * than 2 stages (i.e., double buffering). But it helps to think of the ++ * pipeline as being a long one. Each buffer head contains a bulk-in and ++ * a bulk-out request pointer (since the buffer can be used for both ++ * output and input -- directions always are given from the host's ++ * point of view) as well as a pointer to the buffer and various state ++ * variables. ++ * ++ * Use of the pipeline follows a simple protocol. There is a variable ++ * (fsg->next_buffhd_to_fill) that points to the next buffer head to use. ++ * At any time that buffer head may still be in use from an earlier ++ * request, so each buffer head has a state variable indicating whether ++ * it is EMPTY, FULL, or BUSY. Typical use involves waiting for the ++ * buffer head to be EMPTY, filling the buffer either by file I/O or by ++ * USB I/O (during which the buffer head is BUSY), and marking the buffer ++ * head FULL when the I/O is complete. Then the buffer will be emptied ++ * (again possibly by USB I/O, during which it is marked BUSY) and ++ * finally marked EMPTY again (possibly by a completion routine). ++ * ++ * A module parameter tells the driver to avoid stalling the bulk ++ * endpoints wherever the transport specification allows. This is ++ * necessary for some UDCs like the SuperH, which cannot reliably clear a ++ * halt on a bulk endpoint. However, under certain circumstances the ++ * Bulk-only specification requires a stall. In such cases the driver ++ * will halt the endpoint and set a flag indicating that it should clear ++ * the halt in software during the next device reset. Hopefully this ++ * will permit everything to work correctly. Furthermore, although the ++ * specification allows the bulk-out endpoint to halt when the host sends ++ * too much data, implementing this would cause an unavoidable race. ++ * The driver will always use the "no-stall" approach for OUT transfers. ++ * ++ * One subtle point concerns sending status-stage responses for ep0 ++ * requests. Some of these requests, such as device reset, can involve ++ * interrupting an ongoing file I/O operation, which might take an ++ * arbitrarily long time. During that delay the host might give up on ++ * the original ep0 request and issue a new one. When that happens the ++ * driver should not notify the host about completion of the original ++ * request, as the host will no longer be waiting for it. So the driver ++ * assigns to each ep0 request a unique tag, and it keeps track of the ++ * tag value of the request associated with a long-running exception ++ * (device-reset, interface-change, or configuration-change). When the ++ * exception handler is finished, the status-stage response is submitted ++ * only if the current ep0 request tag is equal to the exception request ++ * tag. Thus only the most recently received ep0 request will get a ++ * status-stage response. ++ * ++ * Warning: This driver source file is too long. It ought to be split up ++ * into a header file plus about 3 separate .c files, to handle the details ++ * of the Gadget, USB Mass Storage, and SCSI protocols. ++ */ ++ ++ ++/* #define VERBOSE_DEBUG */ ++/* #define DUMP_MSGS */ ++ ++ ++#include <linux/blkdev.h> ++#include <linux/completion.h> ++#include <linux/dcache.h> ++#include <linux/delay.h> ++#include <linux/device.h> ++#include <linux/fcntl.h> ++#include <linux/file.h> ++#include <linux/fs.h> ++#include <linux/kref.h> ++#include <linux/kthread.h> ++#include <linux/limits.h> ++#include <linux/module.h> ++#include <linux/rwsem.h> ++#include <linux/slab.h> ++#include <linux/spinlock.h> ++#include <linux/string.h> ++#include <linux/freezer.h> ++#include <linux/utsname.h> ++ ++#include <linux/usb/ch9.h> ++#include <linux/usb/gadget.h> ++ ++#include "gadget_chips.h" ++ ++ ++ ++/* ++ * Kbuild is not very cooperative with respect to linking separately ++ * compiled library objects into one module. So for now we won't use ++ * separate compilation ... ensuring init/exit sections work to shrink ++ * the runtime footprint, and giving us at least some parts of what ++ * a "gcc --combine ... part1.c part2.c part3.c ... " build would. ++ */ ++#include "usbstring.c" ++#include "config.c" ++#include "epautoconf.c" ++ ++/*-------------------------------------------------------------------------*/ ++ ++#define DRIVER_DESC "File-backed Storage Gadget" ++#define DRIVER_NAME "g_file_storage" ++#define DRIVER_VERSION "1 September 2010" ++ ++static char fsg_string_manufacturer[64]; ++static const char fsg_string_product[] = DRIVER_DESC; ++static const char fsg_string_config[] = "Self-powered"; ++static const char fsg_string_interface[] = "Mass Storage"; ++ ++ ++#include "storage_common.c" ++ ++ ++MODULE_DESCRIPTION(DRIVER_DESC); ++MODULE_AUTHOR("Alan Stern"); ++MODULE_LICENSE("Dual BSD/GPL"); ++ ++/* ++ * This driver assumes self-powered hardware and has no way for users to ++ * trigger remote wakeup. It uses autoconfiguration to select endpoints ++ * and endpoint addresses. ++ */ ++ ++ ++/*-------------------------------------------------------------------------*/ ++ ++ ++/* Encapsulate the module parameter settings */ ++ ++static struct { ++ char *file[FSG_MAX_LUNS]; ++ char *serial; ++ bool ro[FSG_MAX_LUNS]; ++ bool nofua[FSG_MAX_LUNS]; ++ unsigned int num_filenames; ++ unsigned int num_ros; ++ unsigned int num_nofuas; ++ unsigned int nluns; ++ ++ bool removable; ++ bool can_stall; ++ bool cdrom; ++ ++ char *transport_parm; ++ char *protocol_parm; ++ unsigned short vendor; ++ unsigned short product; ++ unsigned short release; ++ unsigned int buflen; ++ ++ int transport_type; ++ char *transport_name; ++ int protocol_type; ++ char *protocol_name; ++ ++} mod_data = { // Default values ++ .transport_parm = "BBB", ++ .protocol_parm = "SCSI", ++ .removable = 0, ++ .can_stall = 1, ++ .cdrom = 0, ++ .vendor = FSG_VENDOR_ID, ++ .product = FSG_PRODUCT_ID, ++ .release = 0xffff, // Use controller chip type ++ .buflen = 16384, ++ }; ++ ++ ++module_param_array_named(file, mod_data.file, charp, &mod_data.num_filenames, ++ S_IRUGO); ++MODULE_PARM_DESC(file, "names of backing files or devices"); ++ ++module_param_named(serial, mod_data.serial, charp, S_IRUGO); ++MODULE_PARM_DESC(serial, "USB serial number"); ++ ++module_param_array_named(ro, mod_data.ro, bool, &mod_data.num_ros, S_IRUGO); ++MODULE_PARM_DESC(ro, "true to force read-only"); ++ ++module_param_array_named(nofua, mod_data.nofua, bool, &mod_data.num_nofuas, ++ S_IRUGO); ++MODULE_PARM_DESC(nofua, "true to ignore SCSI WRITE(10,12) FUA bit"); ++ ++module_param_named(luns, mod_data.nluns, uint, S_IRUGO); ++MODULE_PARM_DESC(luns, "number of LUNs"); ++ ++module_param_named(removable, mod_data.removable, bool, S_IRUGO); ++MODULE_PARM_DESC(removable, "true to simulate removable media"); ++ ++module_param_named(stall, mod_data.can_stall, bool, S_IRUGO); ++MODULE_PARM_DESC(stall, "false to prevent bulk stalls"); ++ ++module_param_named(cdrom, mod_data.cdrom, bool, S_IRUGO); ++MODULE_PARM_DESC(cdrom, "true to emulate cdrom instead of disk"); ++ ++/* In the non-TEST version, only the module parameters listed above ++ * are available. */ ++#ifdef CONFIG_USB_FILE_STORAGE_TEST ++ ++module_param_named(transport, mod_data.transport_parm, charp, S_IRUGO); ++MODULE_PARM_DESC(transport, "type of transport (BBB, CBI, or CB)"); ++ ++module_param_named(protocol, mod_data.protocol_parm, charp, S_IRUGO); ++MODULE_PARM_DESC(protocol, "type of protocol (RBC, 8020, QIC, UFI, " ++ "8070, or SCSI)"); ++ ++module_param_named(vendor, mod_data.vendor, ushort, S_IRUGO); ++MODULE_PARM_DESC(vendor, "USB Vendor ID"); ++ ++module_param_named(product, mod_data.product, ushort, S_IRUGO); ++MODULE_PARM_DESC(product, "USB Product ID"); ++ ++module_param_named(release, mod_data.release, ushort, S_IRUGO); ++MODULE_PARM_DESC(release, "USB release number"); ++ ++module_param_named(buflen, mod_data.buflen, uint, S_IRUGO); ++MODULE_PARM_DESC(buflen, "I/O buffer size"); ++ ++#endif /* CONFIG_USB_FILE_STORAGE_TEST */ ++ ++ ++/* ++ * These definitions will permit the compiler to avoid generating code for ++ * parts of the driver that aren't used in the non-TEST version. Even gcc ++ * can recognize when a test of a constant expression yields a dead code ++ * path. ++ */ ++ ++#ifdef CONFIG_USB_FILE_STORAGE_TEST ++ ++#define transport_is_bbb() (mod_data.transport_type == USB_PR_BULK) ++#define transport_is_cbi() (mod_data.transport_type == USB_PR_CBI) ++#define protocol_is_scsi() (mod_data.protocol_type == USB_SC_SCSI) ++ ++#else ++ ++#define transport_is_bbb() 1 ++#define transport_is_cbi() 0 ++#define protocol_is_scsi() 1 ++ ++#endif /* CONFIG_USB_FILE_STORAGE_TEST */ ++ ++ ++/*-------------------------------------------------------------------------*/ ++ ++ ++struct fsg_dev { ++ /* lock protects: state, all the req_busy's, and cbbuf_cmnd */ ++ spinlock_t lock; ++ struct usb_gadget *gadget; ++ ++ /* filesem protects: backing files in use */ ++ struct rw_semaphore filesem; ++ ++ /* reference counting: wait until all LUNs are released */ ++ struct kref ref; ++ ++ struct usb_ep *ep0; // Handy copy of gadget->ep0 ++ struct usb_request *ep0req; // For control responses ++ unsigned int ep0_req_tag; ++ const char *ep0req_name; ++ ++ struct usb_request *intreq; // For interrupt responses ++ int intreq_busy; ++ struct fsg_buffhd *intr_buffhd; ++ ++ unsigned int bulk_out_maxpacket; ++ enum fsg_state state; // For exception handling ++ unsigned int exception_req_tag; ++ ++ u8 config, new_config; ++ ++ unsigned int running : 1; ++ unsigned int bulk_in_enabled : 1; ++ unsigned int bulk_out_enabled : 1; ++ unsigned int intr_in_enabled : 1; ++ unsigned int phase_error : 1; ++ unsigned int short_packet_received : 1; ++ unsigned int bad_lun_okay : 1; ++ ++ unsigned long atomic_bitflags; ++#define REGISTERED 0 ++#define IGNORE_BULK_OUT 1 ++#define SUSPENDED 2 ++ ++ struct usb_ep *bulk_in; ++ struct usb_ep *bulk_out; ++ struct usb_ep *intr_in; ++ ++ struct fsg_buffhd *next_buffhd_to_fill; ++ struct fsg_buffhd *next_buffhd_to_drain; ++ ++ int thread_wakeup_needed; ++ struct completion thread_notifier; ++ struct task_struct *thread_task; ++ ++ int cmnd_size; ++ u8 cmnd[MAX_COMMAND_SIZE]; ++ enum data_direction data_dir; ++ u32 data_size; ++ u32 data_size_from_cmnd; ++ u32 tag; ++ unsigned int lun; ++ u32 residue; ++ u32 usb_amount_left; ++ ++ /* The CB protocol offers no way for a host to know when a command ++ * has completed. As a result the next command may arrive early, ++ * and we will still have to handle it. For that reason we need ++ * a buffer to store new commands when using CB (or CBI, which ++ * does not oblige a host to wait for command completion either). */ ++ int cbbuf_cmnd_size; ++ u8 cbbuf_cmnd[MAX_COMMAND_SIZE]; ++ ++ unsigned int nluns; ++ struct fsg_lun *luns; ++ struct fsg_lun *curlun; ++ /* Must be the last entry */ ++ struct fsg_buffhd buffhds[]; ++}; ++ ++typedef void (*fsg_routine_t)(struct fsg_dev *); ++ ++static int exception_in_progress(struct fsg_dev *fsg) ++{ ++ return (fsg->state > FSG_STATE_IDLE); ++} ++ ++/* Make bulk-out requests be divisible by the maxpacket size */ ++static void set_bulk_out_req_length(struct fsg_dev *fsg, ++ struct fsg_buffhd *bh, unsigned int length) ++{ ++ unsigned int rem; ++ ++ bh->bulk_out_intended_length = length; ++ rem = length % fsg->bulk_out_maxpacket; ++ if (rem > 0) ++ length += fsg->bulk_out_maxpacket - rem; ++ bh->outreq->length = length; ++} ++ ++static struct fsg_dev *the_fsg; ++static struct usb_gadget_driver fsg_driver; ++ ++ ++/*-------------------------------------------------------------------------*/ ++ ++static int fsg_set_halt(struct fsg_dev *fsg, struct usb_ep *ep) ++{ ++ const char *name; ++ ++ if (ep == fsg->bulk_in) ++ name = "bulk-in"; ++ else if (ep == fsg->bulk_out) ++ name = "bulk-out"; ++ else ++ name = ep->name; ++ DBG(fsg, "%s set halt\n", name); ++ return usb_ep_set_halt(ep); ++} ++ ++ ++/*-------------------------------------------------------------------------*/ ++ ++/* ++ * DESCRIPTORS ... most are static, but strings and (full) configuration ++ * descriptors are built on demand. Also the (static) config and interface ++ * descriptors are adjusted during fsg_bind(). ++ */ ++ ++/* There is only one configuration. */ ++#define CONFIG_VALUE 1 ++ ++static struct usb_device_descriptor ++device_desc = { ++ .bLength = sizeof device_desc, ++ .bDescriptorType = USB_DT_DEVICE, ++ ++ .bcdUSB = cpu_to_le16(0x0200), ++ .bDeviceClass = USB_CLASS_PER_INTERFACE, ++ ++ /* The next three values can be overridden by module parameters */ ++ .idVendor = cpu_to_le16(FSG_VENDOR_ID), ++ .idProduct = cpu_to_le16(FSG_PRODUCT_ID), ++ .bcdDevice = cpu_to_le16(0xffff), ++ ++ .iManufacturer = FSG_STRING_MANUFACTURER, ++ .iProduct = FSG_STRING_PRODUCT, ++ .iSerialNumber = FSG_STRING_SERIAL, ++ .bNumConfigurations = 1, ++}; ++ ++static struct usb_config_descriptor ++config_desc = { ++ .bLength = sizeof config_desc, ++ .bDescriptorType = USB_DT_CONFIG, ++ ++ /* wTotalLength computed by usb_gadget_config_buf() */ ++ .bNumInterfaces = 1, ++ .bConfigurationValue = CONFIG_VALUE, ++ .iConfiguration = FSG_STRING_CONFIG, ++ .bmAttributes = USB_CONFIG_ATT_ONE | USB_CONFIG_ATT_SELFPOWER, ++ .bMaxPower = CONFIG_USB_GADGET_VBUS_DRAW / 2, ++}; ++ ++ ++static struct usb_qualifier_descriptor ++dev_qualifier = { ++ .bLength = sizeof dev_qualifier, ++ .bDescriptorType = USB_DT_DEVICE_QUALIFIER, ++ ++ .bcdUSB = cpu_to_le16(0x0200), ++ .bDeviceClass = USB_CLASS_PER_INTERFACE, ++ ++ .bNumConfigurations = 1, ++}; ++ ++static int populate_bos(struct fsg_dev *fsg, u8 *buf) ++{ ++ memcpy(buf, &fsg_bos_desc, USB_DT_BOS_SIZE); ++ buf += USB_DT_BOS_SIZE; ++ ++ memcpy(buf, &fsg_ext_cap_desc, USB_DT_USB_EXT_CAP_SIZE); ++ buf += USB_DT_USB_EXT_CAP_SIZE; ++ ++ memcpy(buf, &fsg_ss_cap_desc, USB_DT_USB_SS_CAP_SIZE); ++ ++ return USB_DT_BOS_SIZE + USB_DT_USB_SS_CAP_SIZE ++ + USB_DT_USB_EXT_CAP_SIZE; ++} ++ ++/* ++ * Config descriptors must agree with the code that sets configurations ++ * and with code managing interfaces and their altsettings. They must ++ * also handle different speeds and other-speed requests. ++ */ ++static int populate_config_buf(struct usb_gadget *gadget, ++ u8 *buf, u8 type, unsigned index) ++{ ++ enum usb_device_speed speed = gadget->speed; ++ int len; ++ const struct usb_descriptor_header **function; ++ ++ if (index > 0) ++ return -EINVAL; ++ ++ if (gadget_is_dualspeed(gadget) && type == USB_DT_OTHER_SPEED_CONFIG) ++ speed = (USB_SPEED_FULL + USB_SPEED_HIGH) - speed; ++ function = gadget_is_dualspeed(gadget) && speed == USB_SPEED_HIGH ++ ? (const struct usb_descriptor_header **)fsg_hs_function ++ : (const struct usb_descriptor_header **)fsg_fs_function; ++ ++ /* for now, don't advertise srp-only devices */ ++ if (!gadget_is_otg(gadget)) ++ function++; ++ ++ len = usb_gadget_config_buf(&config_desc, buf, EP0_BUFSIZE, function); ++ ((struct usb_config_descriptor *) buf)->bDescriptorType = type; ++ return len; ++} ++ ++ ++/*-------------------------------------------------------------------------*/ ++ ++/* These routines may be called in process context or in_irq */ ++ ++/* Caller must hold fsg->lock */ ++static void wakeup_thread(struct fsg_dev *fsg) ++{ ++ /* Tell the main thread that something has happened */ ++ fsg->thread_wakeup_needed = 1; ++ if (fsg->thread_task) ++ wake_up_process(fsg->thread_task); ++} ++ ++ ++static void raise_exception(struct fsg_dev *fsg, enum fsg_state new_state) ++{ ++ unsigned long flags; ++ ++ /* Do nothing if a higher-priority exception is already in progress. ++ * If a lower-or-equal priority exception is in progress, preempt it ++ * and notify the main thread by sending it a signal. */ ++ spin_lock_irqsave(&fsg->lock, flags); ++ if (fsg->state <= new_state) { ++ fsg->exception_req_tag = fsg->ep0_req_tag; ++ fsg->state = new_state; ++ if (fsg->thread_task) ++ send_sig_info(SIGUSR1, SEND_SIG_FORCED, ++ fsg->thread_task); ++ } ++ spin_unlock_irqrestore(&fsg->lock, flags); ++} ++ ++ ++/*-------------------------------------------------------------------------*/ ++ ++/* The disconnect callback and ep0 routines. These always run in_irq, ++ * except that ep0_queue() is called in the main thread to acknowledge ++ * completion of various requests: set config, set interface, and ++ * Bulk-only device reset. */ ++ ++static void fsg_disconnect(struct usb_gadget *gadget) ++{ ++ struct fsg_dev *fsg = get_gadget_data(gadget); ++ ++ DBG(fsg, "disconnect or port reset\n"); ++ raise_exception(fsg, FSG_STATE_DISCONNECT); ++} ++ ++ ++static int ep0_queue(struct fsg_dev *fsg) ++{ ++ int rc; ++ ++ rc = usb_ep_queue(fsg->ep0, fsg->ep0req, GFP_ATOMIC); ++ if (rc != 0 && rc != -ESHUTDOWN) { ++ ++ /* We can't do much more than wait for a reset */ ++ WARNING(fsg, "error in submission: %s --> %d\n", ++ fsg->ep0->name, rc); ++ } ++ return rc; ++} ++ ++static void ep0_complete(struct usb_ep *ep, struct usb_request *req) ++{ ++ struct fsg_dev *fsg = ep->driver_data; ++ ++ if (req->actual > 0) ++ dump_msg(fsg, fsg->ep0req_name, req->buf, req->actual); ++ if (req->status || req->actual != req->length) ++ DBG(fsg, "%s --> %d, %u/%u\n", __func__, ++ req->status, req->actual, req->length); ++ if (req->status == -ECONNRESET) // Request was cancelled ++ usb_ep_fifo_flush(ep); ++ ++ if (req->status == 0 && req->context) ++ ((fsg_routine_t) (req->context))(fsg); ++} ++ ++ ++/*-------------------------------------------------------------------------*/ ++ ++/* Bulk and interrupt endpoint completion handlers. ++ * These always run in_irq. */ ++ ++static void bulk_in_complete(struct usb_ep *ep, struct usb_request *req) ++{ ++ struct fsg_dev *fsg = ep->driver_data; ++ struct fsg_buffhd *bh = req->context; ++ ++ if (req->status || req->actual != req->length) ++ DBG(fsg, "%s --> %d, %u/%u\n", __func__, ++ req->status, req->actual, req->length); ++ if (req->status == -ECONNRESET) // Request was cancelled ++ usb_ep_fifo_flush(ep); ++ ++ /* Hold the lock while we update the request and buffer states */ ++ smp_wmb(); ++ spin_lock(&fsg->lock); ++ bh->inreq_busy = 0; ++ bh->state = BUF_STATE_EMPTY; ++ wakeup_thread(fsg); ++ spin_unlock(&fsg->lock); ++} ++ ++static void bulk_out_complete(struct usb_ep *ep, struct usb_request *req) ++{ ++ struct fsg_dev *fsg = ep->driver_data; ++ struct fsg_buffhd *bh = req->context; ++ ++ dump_msg(fsg, "bulk-out", req->buf, req->actual); ++ if (req->status || req->actual != bh->bulk_out_intended_length) ++ DBG(fsg, "%s --> %d, %u/%u\n", __func__, ++ req->status, req->actual, ++ bh->bulk_out_intended_length); ++ if (req->status == -ECONNRESET) // Request was cancelled ++ usb_ep_fifo_flush(ep); ++ ++ /* Hold the lock while we update the request and buffer states */ ++ smp_wmb(); ++ spin_lock(&fsg->lock); ++ bh->outreq_busy = 0; ++ bh->state = BUF_STATE_FULL; ++ wakeup_thread(fsg); ++ spin_unlock(&fsg->lock); ++} ++ ++ ++#ifdef CONFIG_USB_FILE_STORAGE_TEST ++static void intr_in_complete(struct usb_ep *ep, struct usb_request *req) ++{ ++ struct fsg_dev *fsg = ep->driver_data; ++ struct fsg_buffhd *bh = req->context; ++ ++ if (req->status || req->actual != req->length) ++ DBG(fsg, "%s --> %d, %u/%u\n", __func__, ++ req->status, req->actual, req->length); ++ if (req->status == -ECONNRESET) // Request was cancelled ++ usb_ep_fifo_flush(ep); ++ ++ /* Hold the lock while we update the request and buffer states */ ++ smp_wmb(); ++ spin_lock(&fsg->lock); ++ fsg->intreq_busy = 0; ++ bh->state = BUF_STATE_EMPTY; ++ wakeup_thread(fsg); ++ spin_unlock(&fsg->lock); ++} ++ ++#else ++static void intr_in_complete(struct usb_ep *ep, struct usb_request *req) ++{} ++#endif /* CONFIG_USB_FILE_STORAGE_TEST */ ++ ++ ++/*-------------------------------------------------------------------------*/ ++ ++/* Ep0 class-specific handlers. These always run in_irq. */ ++ ++#ifdef CONFIG_USB_FILE_STORAGE_TEST ++static void received_cbi_adsc(struct fsg_dev *fsg, struct fsg_buffhd *bh) ++{ ++ struct usb_request *req = fsg->ep0req; ++ static u8 cbi_reset_cmnd[6] = { ++ SEND_DIAGNOSTIC, 4, 0xff, 0xff, 0xff, 0xff}; ++ ++ /* Error in command transfer? */ ++ if (req->status || req->length != req->actual || ++ req->actual < 6 || req->actual > MAX_COMMAND_SIZE) { ++ ++ /* Not all controllers allow a protocol stall after ++ * receiving control-out data, but we'll try anyway. */ ++ fsg_set_halt(fsg, fsg->ep0); ++ return; // Wait for reset ++ } ++ ++ /* Is it the special reset command? */ ++ if (req->actual >= sizeof cbi_reset_cmnd && ++ memcmp(req->buf, cbi_reset_cmnd, ++ sizeof cbi_reset_cmnd) == 0) { ++ ++ /* Raise an exception to stop the current operation ++ * and reinitialize our state. */ ++ DBG(fsg, "cbi reset request\n"); ++ raise_exception(fsg, FSG_STATE_RESET); ++ return; ++ } ++ ++ VDBG(fsg, "CB[I] accept device-specific command\n"); ++ spin_lock(&fsg->lock); ++ ++ /* Save the command for later */ ++ if (fsg->cbbuf_cmnd_size) ++ WARNING(fsg, "CB[I] overwriting previous command\n"); ++ fsg->cbbuf_cmnd_size = req->actual; ++ memcpy(fsg->cbbuf_cmnd, req->buf, fsg->cbbuf_cmnd_size); ++ ++ wakeup_thread(fsg); ++ spin_unlock(&fsg->lock); ++} ++ ++#else ++static void received_cbi_adsc(struct fsg_dev *fsg, struct fsg_buffhd *bh) ++{} ++#endif /* CONFIG_USB_FILE_STORAGE_TEST */ ++ ++ ++static int class_setup_req(struct fsg_dev *fsg, ++ const struct usb_ctrlrequest *ctrl) ++{ ++ struct usb_request *req = fsg->ep0req; ++ int value = -EOPNOTSUPP; ++ u16 w_index = le16_to_cpu(ctrl->wIndex); ++ u16 w_value = le16_to_cpu(ctrl->wValue); ++ u16 w_length = le16_to_cpu(ctrl->wLength); ++ ++ if (!fsg->config) ++ return value; ++ ++ /* Handle Bulk-only class-specific requests */ ++ if (transport_is_bbb()) { ++ switch (ctrl->bRequest) { ++ ++ case US_BULK_RESET_REQUEST: ++ if (ctrl->bRequestType != (USB_DIR_OUT | ++ USB_TYPE_CLASS | USB_RECIP_INTERFACE)) ++ break; ++ if (w_index != 0 || w_value != 0 || w_length != 0) { ++ value = -EDOM; ++ break; ++ } ++ ++ /* Raise an exception to stop the current operation ++ * and reinitialize our state. */ ++ DBG(fsg, "bulk reset request\n"); ++ raise_exception(fsg, FSG_STATE_RESET); ++ value = DELAYED_STATUS; ++ break; ++ ++ case US_BULK_GET_MAX_LUN: ++ if (ctrl->bRequestType != (USB_DIR_IN | ++ USB_TYPE_CLASS | USB_RECIP_INTERFACE)) ++ break; ++ if (w_index != 0 || w_value != 0 || w_length != 1) { ++ value = -EDOM; ++ break; ++ } ++ VDBG(fsg, "get max LUN\n"); ++ *(u8 *) req->buf = fsg->nluns - 1; ++ value = 1; ++ break; ++ } ++ } ++ ++ /* Handle CBI class-specific requests */ ++ else { ++ switch (ctrl->bRequest) { ++ ++ case USB_CBI_ADSC_REQUEST: ++ if (ctrl->bRequestType != (USB_DIR_OUT | ++ USB_TYPE_CLASS | USB_RECIP_INTERFACE)) ++ break; ++ if (w_index != 0 || w_value != 0) { ++ value = -EDOM; ++ break; ++ } ++ if (w_length > MAX_COMMAND_SIZE) { ++ value = -EOVERFLOW; ++ break; ++ } ++ value = w_length; ++ fsg->ep0req->context = received_cbi_adsc; ++ break; ++ } ++ } ++ ++ if (value == -EOPNOTSUPP) ++ VDBG(fsg, ++ "unknown class-specific control req " ++ "%02x.%02x v%04x i%04x l%u\n", ++ ctrl->bRequestType, ctrl->bRequest, ++ le16_to_cpu(ctrl->wValue), w_index, w_length); ++ return value; ++} ++ ++ ++/*-------------------------------------------------------------------------*/ ++ ++/* Ep0 standard request handlers. These always run in_irq. */ ++ ++static int standard_setup_req(struct fsg_dev *fsg, ++ const struct usb_ctrlrequest *ctrl) ++{ ++ struct usb_request *req = fsg->ep0req; ++ int value = -EOPNOTSUPP; ++ u16 w_index = le16_to_cpu(ctrl->wIndex); ++ u16 w_value = le16_to_cpu(ctrl->wValue); ++ ++ /* Usually this just stores reply data in the pre-allocated ep0 buffer, ++ * but config change events will also reconfigure hardware. */ ++ switch (ctrl->bRequest) { ++ ++ case USB_REQ_GET_DESCRIPTOR: ++ if (ctrl->bRequestType != (USB_DIR_IN | USB_TYPE_STANDARD | ++ USB_RECIP_DEVICE)) ++ break; ++ switch (w_value >> 8) { ++ ++ case USB_DT_DEVICE: ++ VDBG(fsg, "get device descriptor\n"); ++ device_desc.bMaxPacketSize0 = fsg->ep0->maxpacket; ++ value = sizeof device_desc; ++ memcpy(req->buf, &device_desc, value); ++ break; ++ case USB_DT_DEVICE_QUALIFIER: ++ VDBG(fsg, "get device qualifier\n"); ++ if (!gadget_is_dualspeed(fsg->gadget) || ++ fsg->gadget->speed == USB_SPEED_SUPER) ++ break; ++ /* ++ * Assume ep0 uses the same maxpacket value for both ++ * speeds ++ */ ++ dev_qualifier.bMaxPacketSize0 = fsg->ep0->maxpacket; ++ value = sizeof dev_qualifier; ++ memcpy(req->buf, &dev_qualifier, value); ++ break; ++ ++ case USB_DT_OTHER_SPEED_CONFIG: ++ VDBG(fsg, "get other-speed config descriptor\n"); ++ if (!gadget_is_dualspeed(fsg->gadget) || ++ fsg->gadget->speed == USB_SPEED_SUPER) ++ break; ++ goto get_config; ++ case USB_DT_CONFIG: ++ VDBG(fsg, "get configuration descriptor\n"); ++get_config: ++ value = populate_config_buf(fsg->gadget, ++ req->buf, ++ w_value >> 8, ++ w_value & 0xff); ++ break; ++ ++ case USB_DT_STRING: ++ VDBG(fsg, "get string descriptor\n"); ++ ++ /* wIndex == language code */ ++ value = usb_gadget_get_string(&fsg_stringtab, ++ w_value & 0xff, req->buf); ++ break; ++ ++ case USB_DT_BOS: ++ VDBG(fsg, "get bos descriptor\n"); ++ ++ if (gadget_is_superspeed(fsg->gadget)) ++ value = populate_bos(fsg, req->buf); ++ break; ++ } ++ ++ break; ++ ++ /* One config, two speeds */ ++ case USB_REQ_SET_CONFIGURATION: ++ if (ctrl->bRequestType != (USB_DIR_OUT | USB_TYPE_STANDARD | ++ USB_RECIP_DEVICE)) ++ break; ++ VDBG(fsg, "set configuration\n"); ++ if (w_value == CONFIG_VALUE || w_value == 0) { ++ fsg->new_config = w_value; ++ ++ /* Raise an exception to wipe out previous transaction ++ * state (queued bufs, etc) and set the new config. */ ++ raise_exception(fsg, FSG_STATE_CONFIG_CHANGE); ++ value = DELAYED_STATUS; ++ } ++ break; ++ case USB_REQ_GET_CONFIGURATION: ++ if (ctrl->bRequestType != (USB_DIR_IN | USB_TYPE_STANDARD | ++ USB_RECIP_DEVICE)) ++ break; ++ VDBG(fsg, "get configuration\n"); ++ *(u8 *) req->buf = fsg->config; ++ value = 1; ++ break; ++ ++ case USB_REQ_SET_INTERFACE: ++ if (ctrl->bRequestType != (USB_DIR_OUT| USB_TYPE_STANDARD | ++ USB_RECIP_INTERFACE)) ++ break; ++ if (fsg->config && w_index == 0) { ++ ++ /* Raise an exception to wipe out previous transaction ++ * state (queued bufs, etc) and install the new ++ * interface altsetting. */ ++ raise_exception(fsg, FSG_STATE_INTERFACE_CHANGE); ++ value = DELAYED_STATUS; ++ } ++ break; ++ case USB_REQ_GET_INTERFACE: ++ if (ctrl->bRequestType != (USB_DIR_IN | USB_TYPE_STANDARD | ++ USB_RECIP_INTERFACE)) ++ break; ++ if (!fsg->config) ++ break; ++ if (w_index != 0) { ++ value = -EDOM; ++ break; ++ } ++ VDBG(fsg, "get interface\n"); ++ *(u8 *) req->buf = 0; ++ value = 1; ++ break; ++ ++ default: ++ VDBG(fsg, ++ "unknown control req %02x.%02x v%04x i%04x l%u\n", ++ ctrl->bRequestType, ctrl->bRequest, ++ w_value, w_index, le16_to_cpu(ctrl->wLength)); ++ } ++ ++ return value; ++} ++ ++ ++static int fsg_setup(struct usb_gadget *gadget, ++ const struct usb_ctrlrequest *ctrl) ++{ ++ struct fsg_dev *fsg = get_gadget_data(gadget); ++ int rc; ++ int w_length = le16_to_cpu(ctrl->wLength); ++ ++ ++fsg->ep0_req_tag; // Record arrival of a new request ++ fsg->ep0req->context = NULL; ++ fsg->ep0req->length = 0; ++ dump_msg(fsg, "ep0-setup", (u8 *) ctrl, sizeof(*ctrl)); ++ ++ if ((ctrl->bRequestType & USB_TYPE_MASK) == USB_TYPE_CLASS) ++ rc = class_setup_req(fsg, ctrl); ++ else ++ rc = standard_setup_req(fsg, ctrl); ++ ++ /* Respond with data/status or defer until later? */ ++ if (rc >= 0 && rc != DELAYED_STATUS) { ++ rc = min(rc, w_length); ++ fsg->ep0req->length = rc; ++ fsg->ep0req->zero = rc < w_length; ++ fsg->ep0req_name = (ctrl->bRequestType & USB_DIR_IN ? ++ "ep0-in" : "ep0-out"); ++ rc = ep0_queue(fsg); ++ } ++ ++ /* Device either stalls (rc < 0) or reports success */ ++ return rc; ++} ++ ++ ++/*-------------------------------------------------------------------------*/ ++ ++/* All the following routines run in process context */ ++ ++ ++/* Use this for bulk or interrupt transfers, not ep0 */ ++static void start_transfer(struct fsg_dev *fsg, struct usb_ep *ep, ++ struct usb_request *req, int *pbusy, ++ enum fsg_buffer_state *state) ++{ ++ int rc; ++ ++ if (ep == fsg->bulk_in) ++ dump_msg(fsg, "bulk-in", req->buf, req->length); ++ else if (ep == fsg->intr_in) ++ dump_msg(fsg, "intr-in", req->buf, req->length); ++ ++ spin_lock_irq(&fsg->lock); ++ *pbusy = 1; ++ *state = BUF_STATE_BUSY; ++ spin_unlock_irq(&fsg->lock); ++ rc = usb_ep_queue(ep, req, GFP_KERNEL); ++ if (rc != 0) { ++ *pbusy = 0; ++ *state = BUF_STATE_EMPTY; ++ ++ /* We can't do much more than wait for a reset */ ++ ++ /* Note: currently the net2280 driver fails zero-length ++ * submissions if DMA is enabled. */ ++ if (rc != -ESHUTDOWN && !(rc == -EOPNOTSUPP && ++ req->length == 0)) ++ WARNING(fsg, "error in submission: %s --> %d\n", ++ ep->name, rc); ++ } ++} ++ ++ ++static int sleep_thread(struct fsg_dev *fsg) ++{ ++ int rc = 0; ++ ++ /* Wait until a signal arrives or we are woken up */ ++ for (;;) { ++ try_to_freeze(); ++ set_current_state(TASK_INTERRUPTIBLE); ++ if (signal_pending(current)) { ++ rc = -EINTR; ++ break; ++ } ++ if (fsg->thread_wakeup_needed) ++ break; ++ schedule(); ++ } ++ __set_current_state(TASK_RUNNING); ++ fsg->thread_wakeup_needed = 0; ++ return rc; ++} ++ ++ ++/*-------------------------------------------------------------------------*/ ++ ++static int do_read(struct fsg_dev *fsg) ++{ ++ struct fsg_lun *curlun = fsg->curlun; ++ u32 lba; ++ struct fsg_buffhd *bh; ++ int rc; ++ u32 amount_left; ++ loff_t file_offset, file_offset_tmp; ++ unsigned int amount; ++ ssize_t nread; ++ ++ /* Get the starting Logical Block Address and check that it's ++ * not too big */ ++ if (fsg->cmnd[0] == READ_6) ++ lba = get_unaligned_be24(&fsg->cmnd[1]); ++ else { ++ lba = get_unaligned_be32(&fsg->cmnd[2]); ++ ++ /* We allow DPO (Disable Page Out = don't save data in the ++ * cache) and FUA (Force Unit Access = don't read from the ++ * cache), but we don't implement them. */ ++ if ((fsg->cmnd[1] & ~0x18) != 0) { ++ curlun->sense_data = SS_INVALID_FIELD_IN_CDB; ++ return -EINVAL; ++ } ++ } ++ if (lba >= curlun->num_sectors) { ++ curlun->sense_data = SS_LOGICAL_BLOCK_ADDRESS_OUT_OF_RANGE; ++ return -EINVAL; ++ } ++ file_offset = ((loff_t) lba) << curlun->blkbits; ++ ++ /* Carry out the file reads */ ++ amount_left = fsg->data_size_from_cmnd; ++ if (unlikely(amount_left == 0)) ++ return -EIO; // No default reply ++ ++ for (;;) { ++ ++ /* Figure out how much we need to read: ++ * Try to read the remaining amount. ++ * But don't read more than the buffer size. ++ * And don't try to read past the end of the file. ++ */ ++ amount = min((unsigned int) amount_left, mod_data.buflen); ++ amount = min((loff_t) amount, ++ curlun->file_length - file_offset); ++ ++ /* Wait for the next buffer to become available */ ++ bh = fsg->next_buffhd_to_fill; ++ while (bh->state != BUF_STATE_EMPTY) { ++ rc = sleep_thread(fsg); ++ if (rc) ++ return rc; ++ } ++ ++ /* If we were asked to read past the end of file, ++ * end with an empty buffer. */ ++ if (amount == 0) { ++ curlun->sense_data = ++ SS_LOGICAL_BLOCK_ADDRESS_OUT_OF_RANGE; ++ curlun->sense_data_info = file_offset >> curlun->blkbits; ++ curlun->info_valid = 1; ++ bh->inreq->length = 0; ++ bh->state = BUF_STATE_FULL; ++ break; ++ } ++ ++ /* Perform the read */ ++ file_offset_tmp = file_offset; ++ nread = vfs_read(curlun->filp, ++ (char __user *) bh->buf, ++ amount, &file_offset_tmp); ++ VLDBG(curlun, "file read %u @ %llu -> %d\n", amount, ++ (unsigned long long) file_offset, ++ (int) nread); ++ if (signal_pending(current)) ++ return -EINTR; ++ ++ if (nread < 0) { ++ LDBG(curlun, "error in file read: %d\n", ++ (int) nread); ++ nread = 0; ++ } else if (nread < amount) { ++ LDBG(curlun, "partial file read: %d/%u\n", ++ (int) nread, amount); ++ nread = round_down(nread, curlun->blksize); ++ } ++ file_offset += nread; ++ amount_left -= nread; ++ fsg->residue -= nread; ++ ++ /* Except at the end of the transfer, nread will be ++ * equal to the buffer size, which is divisible by the ++ * bulk-in maxpacket size. ++ */ ++ bh->inreq->length = nread; ++ bh->state = BUF_STATE_FULL; ++ ++ /* If an error occurred, report it and its position */ ++ if (nread < amount) { ++ curlun->sense_data = SS_UNRECOVERED_READ_ERROR; ++ curlun->sense_data_info = file_offset >> curlun->blkbits; ++ curlun->info_valid = 1; ++ break; ++ } ++ ++ if (amount_left == 0) ++ break; // No more left to read ++ ++ /* Send this buffer and go read some more */ ++ bh->inreq->zero = 0; ++ start_transfer(fsg, fsg->bulk_in, bh->inreq, ++ &bh->inreq_busy, &bh->state); ++ fsg->next_buffhd_to_fill = bh->next; ++ } ++ ++ return -EIO; // No default reply ++} ++ ++ ++/*-------------------------------------------------------------------------*/ ++ ++static int do_write(struct fsg_dev *fsg) ++{ ++ struct fsg_lun *curlun = fsg->curlun; ++ u32 lba; ++ struct fsg_buffhd *bh; ++ int get_some_more; ++ u32 amount_left_to_req, amount_left_to_write; ++ loff_t usb_offset, file_offset, file_offset_tmp; ++ unsigned int amount; ++ ssize_t nwritten; ++ int rc; ++ ++ if (curlun->ro) { ++ curlun->sense_data = SS_WRITE_PROTECTED; ++ return -EINVAL; ++ } ++ spin_lock(&curlun->filp->f_lock); ++ curlun->filp->f_flags &= ~O_SYNC; // Default is not to wait ++ spin_unlock(&curlun->filp->f_lock); ++ ++ /* Get the starting Logical Block Address and check that it's ++ * not too big */ ++ if (fsg->cmnd[0] == WRITE_6) ++ lba = get_unaligned_be24(&fsg->cmnd[1]); ++ else { ++ lba = get_unaligned_be32(&fsg->cmnd[2]); ++ ++ /* We allow DPO (Disable Page Out = don't save data in the ++ * cache) and FUA (Force Unit Access = write directly to the ++ * medium). We don't implement DPO; we implement FUA by ++ * performing synchronous output. */ ++ if ((fsg->cmnd[1] & ~0x18) != 0) { ++ curlun->sense_data = SS_INVALID_FIELD_IN_CDB; ++ return -EINVAL; ++ } ++ /* FUA */ ++ if (!curlun->nofua && (fsg->cmnd[1] & 0x08)) { ++ spin_lock(&curlun->filp->f_lock); ++ curlun->filp->f_flags |= O_DSYNC; ++ spin_unlock(&curlun->filp->f_lock); ++ } ++ } ++ if (lba >= curlun->num_sectors) { ++ curlun->sense_data = SS_LOGICAL_BLOCK_ADDRESS_OUT_OF_RANGE; ++ return -EINVAL; ++ } ++ ++ /* Carry out the file writes */ ++ get_some_more = 1; ++ file_offset = usb_offset = ((loff_t) lba) << curlun->blkbits; ++ amount_left_to_req = amount_left_to_write = fsg->data_size_from_cmnd; ++ ++ while (amount_left_to_write > 0) { ++ ++ /* Queue a request for more data from the host */ ++ bh = fsg->next_buffhd_to_fill; ++ if (bh->state == BUF_STATE_EMPTY && get_some_more) { ++ ++ /* Figure out how much we want to get: ++ * Try to get the remaining amount, ++ * but not more than the buffer size. ++ */ ++ amount = min(amount_left_to_req, mod_data.buflen); ++ ++ /* Beyond the end of the backing file? */ ++ if (usb_offset >= curlun->file_length) { ++ get_some_more = 0; ++ curlun->sense_data = ++ SS_LOGICAL_BLOCK_ADDRESS_OUT_OF_RANGE; ++ curlun->sense_data_info = usb_offset >> curlun->blkbits; ++ curlun->info_valid = 1; ++ continue; ++ } ++ ++ /* Get the next buffer */ ++ usb_offset += amount; ++ fsg->usb_amount_left -= amount; ++ amount_left_to_req -= amount; ++ if (amount_left_to_req == 0) ++ get_some_more = 0; ++ ++ /* Except at the end of the transfer, amount will be ++ * equal to the buffer size, which is divisible by ++ * the bulk-out maxpacket size. ++ */ ++ set_bulk_out_req_length(fsg, bh, amount); ++ start_transfer(fsg, fsg->bulk_out, bh->outreq, ++ &bh->outreq_busy, &bh->state); ++ fsg->next_buffhd_to_fill = bh->next; ++ continue; ++ } ++ ++ /* Write the received data to the backing file */ ++ bh = fsg->next_buffhd_to_drain; ++ if (bh->state == BUF_STATE_EMPTY && !get_some_more) ++ break; // We stopped early ++ if (bh->state == BUF_STATE_FULL) { ++ smp_rmb(); ++ fsg->next_buffhd_to_drain = bh->next; ++ bh->state = BUF_STATE_EMPTY; ++ ++ /* Did something go wrong with the transfer? */ ++ if (bh->outreq->status != 0) { ++ curlun->sense_data = SS_COMMUNICATION_FAILURE; ++ curlun->sense_data_info = file_offset >> curlun->blkbits; ++ curlun->info_valid = 1; ++ break; ++ } ++ ++ amount = bh->outreq->actual; ++ if (curlun->file_length - file_offset < amount) { ++ LERROR(curlun, ++ "write %u @ %llu beyond end %llu\n", ++ amount, (unsigned long long) file_offset, ++ (unsigned long long) curlun->file_length); ++ amount = curlun->file_length - file_offset; ++ } ++ ++ /* Don't accept excess data. The spec doesn't say ++ * what to do in this case. We'll ignore the error. ++ */ ++ amount = min(amount, bh->bulk_out_intended_length); ++ ++ /* Don't write a partial block */ ++ amount = round_down(amount, curlun->blksize); ++ if (amount == 0) ++ goto empty_write; ++ ++ /* Perform the write */ ++ file_offset_tmp = file_offset; ++ nwritten = vfs_write(curlun->filp, ++ (char __user *) bh->buf, ++ amount, &file_offset_tmp); ++ VLDBG(curlun, "file write %u @ %llu -> %d\n", amount, ++ (unsigned long long) file_offset, ++ (int) nwritten); ++ if (signal_pending(current)) ++ return -EINTR; // Interrupted! ++ ++ if (nwritten < 0) { ++ LDBG(curlun, "error in file write: %d\n", ++ (int) nwritten); ++ nwritten = 0; ++ } else if (nwritten < amount) { ++ LDBG(curlun, "partial file write: %d/%u\n", ++ (int) nwritten, amount); ++ nwritten = round_down(nwritten, curlun->blksize); ++ } ++ file_offset += nwritten; ++ amount_left_to_write -= nwritten; ++ fsg->residue -= nwritten; ++ ++ /* If an error occurred, report it and its position */ ++ if (nwritten < amount) { ++ curlun->sense_data = SS_WRITE_ERROR; ++ curlun->sense_data_info = file_offset >> curlun->blkbits; ++ curlun->info_valid = 1; ++ break; ++ } ++ ++ empty_write: ++ /* Did the host decide to stop early? */ ++ if (bh->outreq->actual < bh->bulk_out_intended_length) { ++ fsg->short_packet_received = 1; ++ break; ++ } ++ continue; ++ } ++ ++ /* Wait for something to happen */ ++ rc = sleep_thread(fsg); ++ if (rc) ++ return rc; ++ } ++ ++ return -EIO; // No default reply ++} ++ ++ ++/*-------------------------------------------------------------------------*/ ++ ++static int do_synchronize_cache(struct fsg_dev *fsg) ++{ ++ struct fsg_lun *curlun = fsg->curlun; ++ int rc; ++ ++ /* We ignore the requested LBA and write out all file's ++ * dirty data buffers. */ ++ rc = fsg_lun_fsync_sub(curlun); ++ if (rc) ++ curlun->sense_data = SS_WRITE_ERROR; ++ return 0; ++} ++ ++ ++/*-------------------------------------------------------------------------*/ ++ ++static void invalidate_sub(struct fsg_lun *curlun) ++{ ++ struct file *filp = curlun->filp; ++ struct inode *inode = filp->f_path.dentry->d_inode; ++ unsigned long rc; ++ ++ rc = invalidate_mapping_pages(inode->i_mapping, 0, -1); ++ VLDBG(curlun, "invalidate_mapping_pages -> %ld\n", rc); ++} ++ ++static int do_verify(struct fsg_dev *fsg) ++{ ++ struct fsg_lun *curlun = fsg->curlun; ++ u32 lba; ++ u32 verification_length; ++ struct fsg_buffhd *bh = fsg->next_buffhd_to_fill; ++ loff_t file_offset, file_offset_tmp; ++ u32 amount_left; ++ unsigned int amount; ++ ssize_t nread; ++ ++ /* Get the starting Logical Block Address and check that it's ++ * not too big */ ++ lba = get_unaligned_be32(&fsg->cmnd[2]); ++ if (lba >= curlun->num_sectors) { ++ curlun->sense_data = SS_LOGICAL_BLOCK_ADDRESS_OUT_OF_RANGE; ++ return -EINVAL; ++ } ++ ++ /* We allow DPO (Disable Page Out = don't save data in the ++ * cache) but we don't implement it. */ ++ if ((fsg->cmnd[1] & ~0x10) != 0) { ++ curlun->sense_data = SS_INVALID_FIELD_IN_CDB; ++ return -EINVAL; ++ } ++ ++ verification_length = get_unaligned_be16(&fsg->cmnd[7]); ++ if (unlikely(verification_length == 0)) ++ return -EIO; // No default reply ++ ++ /* Prepare to carry out the file verify */ ++ amount_left = verification_length << curlun->blkbits; ++ file_offset = ((loff_t) lba) << curlun->blkbits; ++ ++ /* Write out all the dirty buffers before invalidating them */ ++ fsg_lun_fsync_sub(curlun); ++ if (signal_pending(current)) ++ return -EINTR; ++ ++ invalidate_sub(curlun); ++ if (signal_pending(current)) ++ return -EINTR; ++ ++ /* Just try to read the requested blocks */ ++ while (amount_left > 0) { ++ ++ /* Figure out how much we need to read: ++ * Try to read the remaining amount, but not more than ++ * the buffer size. ++ * And don't try to read past the end of the file. ++ */ ++ amount = min((unsigned int) amount_left, mod_data.buflen); ++ amount = min((loff_t) amount, ++ curlun->file_length - file_offset); ++ if (amount == 0) { ++ curlun->sense_data = ++ SS_LOGICAL_BLOCK_ADDRESS_OUT_OF_RANGE; ++ curlun->sense_data_info = file_offset >> curlun->blkbits; ++ curlun->info_valid = 1; ++ break; ++ } ++ ++ /* Perform the read */ ++ file_offset_tmp = file_offset; ++ nread = vfs_read(curlun->filp, ++ (char __user *) bh->buf, ++ amount, &file_offset_tmp); ++ VLDBG(curlun, "file read %u @ %llu -> %d\n", amount, ++ (unsigned long long) file_offset, ++ (int) nread); ++ if (signal_pending(current)) ++ return -EINTR; ++ ++ if (nread < 0) { ++ LDBG(curlun, "error in file verify: %d\n", ++ (int) nread); ++ nread = 0; ++ } else if (nread < amount) { ++ LDBG(curlun, "partial file verify: %d/%u\n", ++ (int) nread, amount); ++ nread = round_down(nread, curlun->blksize); ++ } ++ if (nread == 0) { ++ curlun->sense_data = SS_UNRECOVERED_READ_ERROR; ++ curlun->sense_data_info = file_offset >> curlun->blkbits; ++ curlun->info_valid = 1; ++ break; ++ } ++ file_offset += nread; ++ amount_left -= nread; ++ } ++ return 0; ++} ++ ++ ++/*-------------------------------------------------------------------------*/ ++ ++static int do_inquiry(struct fsg_dev *fsg, struct fsg_buffhd *bh) ++{ ++ u8 *buf = (u8 *) bh->buf; ++ ++ static char vendor_id[] = "Linux "; ++ static char product_disk_id[] = "File-Stor Gadget"; ++ static char product_cdrom_id[] = "File-CD Gadget "; ++ ++ if (!fsg->curlun) { // Unsupported LUNs are okay ++ fsg->bad_lun_okay = 1; ++ memset(buf, 0, 36); ++ buf[0] = 0x7f; // Unsupported, no device-type ++ buf[4] = 31; // Additional length ++ return 36; ++ } ++ ++ memset(buf, 0, 8); ++ buf[0] = (mod_data.cdrom ? TYPE_ROM : TYPE_DISK); ++ if (mod_data.removable) ++ buf[1] = 0x80; ++ buf[2] = 2; // ANSI SCSI level 2 ++ buf[3] = 2; // SCSI-2 INQUIRY data format ++ buf[4] = 31; // Additional length ++ // No special options ++ sprintf(buf + 8, "%-8s%-16s%04x", vendor_id, ++ (mod_data.cdrom ? product_cdrom_id : ++ product_disk_id), ++ mod_data.release); ++ return 36; ++} ++ ++ ++static int do_request_sense(struct fsg_dev *fsg, struct fsg_buffhd *bh) ++{ ++ struct fsg_lun *curlun = fsg->curlun; ++ u8 *buf = (u8 *) bh->buf; ++ u32 sd, sdinfo; ++ int valid; ++ ++ /* ++ * From the SCSI-2 spec., section 7.9 (Unit attention condition): ++ * ++ * If a REQUEST SENSE command is received from an initiator ++ * with a pending unit attention condition (before the target ++ * generates the contingent allegiance condition), then the ++ * target shall either: ++ * a) report any pending sense data and preserve the unit ++ * attention condition on the logical unit, or, ++ * b) report the unit attention condition, may discard any ++ * pending sense data, and clear the unit attention ++ * condition on the logical unit for that initiator. ++ * ++ * FSG normally uses option a); enable this code to use option b). ++ */ ++#if 0 ++ if (curlun && curlun->unit_attention_data != SS_NO_SENSE) { ++ curlun->sense_data = curlun->unit_attention_data; ++ curlun->unit_attention_data = SS_NO_SENSE; ++ } ++#endif ++ ++ if (!curlun) { // Unsupported LUNs are okay ++ fsg->bad_lun_okay = 1; ++ sd = SS_LOGICAL_UNIT_NOT_SUPPORTED; ++ sdinfo = 0; ++ valid = 0; ++ } else { ++ sd = curlun->sense_data; ++ sdinfo = curlun->sense_data_info; ++ valid = curlun->info_valid << 7; ++ curlun->sense_data = SS_NO_SENSE; ++ curlun->sense_data_info = 0; ++ curlun->info_valid = 0; ++ } ++ ++ memset(buf, 0, 18); ++ buf[0] = valid | 0x70; // Valid, current error ++ buf[2] = SK(sd); ++ put_unaligned_be32(sdinfo, &buf[3]); /* Sense information */ ++ buf[7] = 18 - 8; // Additional sense length ++ buf[12] = ASC(sd); ++ buf[13] = ASCQ(sd); ++ return 18; ++} ++ ++ ++static int do_read_capacity(struct fsg_dev *fsg, struct fsg_buffhd *bh) ++{ ++ struct fsg_lun *curlun = fsg->curlun; ++ u32 lba = get_unaligned_be32(&fsg->cmnd[2]); ++ int pmi = fsg->cmnd[8]; ++ u8 *buf = (u8 *) bh->buf; ++ ++ /* Check the PMI and LBA fields */ ++ if (pmi > 1 || (pmi == 0 && lba != 0)) { ++ curlun->sense_data = SS_INVALID_FIELD_IN_CDB; ++ return -EINVAL; ++ } ++ ++ put_unaligned_be32(curlun->num_sectors - 1, &buf[0]); ++ /* Max logical block */ ++ put_unaligned_be32(curlun->blksize, &buf[4]); /* Block length */ ++ return 8; ++} ++ ++ ++static int do_read_header(struct fsg_dev *fsg, struct fsg_buffhd *bh) ++{ ++ struct fsg_lun *curlun = fsg->curlun; ++ int msf = fsg->cmnd[1] & 0x02; ++ u32 lba = get_unaligned_be32(&fsg->cmnd[2]); ++ u8 *buf = (u8 *) bh->buf; ++ ++ if ((fsg->cmnd[1] & ~0x02) != 0) { /* Mask away MSF */ ++ curlun->sense_data = SS_INVALID_FIELD_IN_CDB; ++ return -EINVAL; ++ } ++ if (lba >= curlun->num_sectors) { ++ curlun->sense_data = SS_LOGICAL_BLOCK_ADDRESS_OUT_OF_RANGE; ++ return -EINVAL; ++ } ++ ++ memset(buf, 0, 8); ++ buf[0] = 0x01; /* 2048 bytes of user data, rest is EC */ ++ store_cdrom_address(&buf[4], msf, lba); ++ return 8; ++} ++ ++ ++static int do_read_toc(struct fsg_dev *fsg, struct fsg_buffhd *bh) ++{ ++ struct fsg_lun *curlun = fsg->curlun; ++ int msf = fsg->cmnd[1] & 0x02; ++ int start_track = fsg->cmnd[6]; ++ u8 *buf = (u8 *) bh->buf; ++ ++ if ((fsg->cmnd[1] & ~0x02) != 0 || /* Mask away MSF */ ++ start_track > 1) { ++ curlun->sense_data = SS_INVALID_FIELD_IN_CDB; ++ return -EINVAL; ++ } ++ ++ memset(buf, 0, 20); ++ buf[1] = (20-2); /* TOC data length */ ++ buf[2] = 1; /* First track number */ ++ buf[3] = 1; /* Last track number */ ++ buf[5] = 0x16; /* Data track, copying allowed */ ++ buf[6] = 0x01; /* Only track is number 1 */ ++ store_cdrom_address(&buf[8], msf, 0); ++ ++ buf[13] = 0x16; /* Lead-out track is data */ ++ buf[14] = 0xAA; /* Lead-out track number */ ++ store_cdrom_address(&buf[16], msf, curlun->num_sectors); ++ return 20; ++} ++ ++ ++static int do_mode_sense(struct fsg_dev *fsg, struct fsg_buffhd *bh) ++{ ++ struct fsg_lun *curlun = fsg->curlun; ++ int mscmnd = fsg->cmnd[0]; ++ u8 *buf = (u8 *) bh->buf; ++ u8 *buf0 = buf; ++ int pc, page_code; ++ int changeable_values, all_pages; ++ int valid_page = 0; ++ int len, limit; ++ ++ if ((fsg->cmnd[1] & ~0x08) != 0) { // Mask away DBD ++ curlun->sense_data = SS_INVALID_FIELD_IN_CDB; ++ return -EINVAL; ++ } ++ pc = fsg->cmnd[2] >> 6; ++ page_code = fsg->cmnd[2] & 0x3f; ++ if (pc == 3) { ++ curlun->sense_data = SS_SAVING_PARAMETERS_NOT_SUPPORTED; ++ return -EINVAL; ++ } ++ changeable_values = (pc == 1); ++ all_pages = (page_code == 0x3f); ++ ++ /* Write the mode parameter header. Fixed values are: default ++ * medium type, no cache control (DPOFUA), and no block descriptors. ++ * The only variable value is the WriteProtect bit. We will fill in ++ * the mode data length later. */ ++ memset(buf, 0, 8); ++ if (mscmnd == MODE_SENSE) { ++ buf[2] = (curlun->ro ? 0x80 : 0x00); // WP, DPOFUA ++ buf += 4; ++ limit = 255; ++ } else { // MODE_SENSE_10 ++ buf[3] = (curlun->ro ? 0x80 : 0x00); // WP, DPOFUA ++ buf += 8; ++ limit = 65535; // Should really be mod_data.buflen ++ } ++ ++ /* No block descriptors */ ++ ++ /* The mode pages, in numerical order. The only page we support ++ * is the Caching page. */ ++ if (page_code == 0x08 || all_pages) { ++ valid_page = 1; ++ buf[0] = 0x08; // Page code ++ buf[1] = 10; // Page length ++ memset(buf+2, 0, 10); // None of the fields are changeable ++ ++ if (!changeable_values) { ++ buf[2] = 0x04; // Write cache enable, ++ // Read cache not disabled ++ // No cache retention priorities ++ put_unaligned_be16(0xffff, &buf[4]); ++ /* Don't disable prefetch */ ++ /* Minimum prefetch = 0 */ ++ put_unaligned_be16(0xffff, &buf[8]); ++ /* Maximum prefetch */ ++ put_unaligned_be16(0xffff, &buf[10]); ++ /* Maximum prefetch ceiling */ ++ } ++ buf += 12; ++ } ++ ++ /* Check that a valid page was requested and the mode data length ++ * isn't too long. */ ++ len = buf - buf0; ++ if (!valid_page || len > limit) { ++ curlun->sense_data = SS_INVALID_FIELD_IN_CDB; ++ return -EINVAL; ++ } ++ ++ /* Store the mode data length */ ++ if (mscmnd == MODE_SENSE) ++ buf0[0] = len - 1; ++ else ++ put_unaligned_be16(len - 2, buf0); ++ return len; ++} ++ ++ ++static int do_start_stop(struct fsg_dev *fsg) ++{ ++ struct fsg_lun *curlun = fsg->curlun; ++ int loej, start; ++ ++ if (!mod_data.removable) { ++ curlun->sense_data = SS_INVALID_COMMAND; ++ return -EINVAL; ++ } ++ ++ // int immed = fsg->cmnd[1] & 0x01; ++ loej = fsg->cmnd[4] & 0x02; ++ start = fsg->cmnd[4] & 0x01; ++ ++#ifdef CONFIG_USB_FILE_STORAGE_TEST ++ if ((fsg->cmnd[1] & ~0x01) != 0 || // Mask away Immed ++ (fsg->cmnd[4] & ~0x03) != 0) { // Mask LoEj, Start ++ curlun->sense_data = SS_INVALID_FIELD_IN_CDB; ++ return -EINVAL; ++ } ++ ++ if (!start) { ++ ++ /* Are we allowed to unload the media? */ ++ if (curlun->prevent_medium_removal) { ++ LDBG(curlun, "unload attempt prevented\n"); ++ curlun->sense_data = SS_MEDIUM_REMOVAL_PREVENTED; ++ return -EINVAL; ++ } ++ if (loej) { // Simulate an unload/eject ++ up_read(&fsg->filesem); ++ down_write(&fsg->filesem); ++ fsg_lun_close(curlun); ++ up_write(&fsg->filesem); ++ down_read(&fsg->filesem); ++ } ++ } else { ++ ++ /* Our emulation doesn't support mounting; the medium is ++ * available for use as soon as it is loaded. */ ++ if (!fsg_lun_is_open(curlun)) { ++ curlun->sense_data = SS_MEDIUM_NOT_PRESENT; ++ return -EINVAL; ++ } ++ } ++#endif ++ return 0; ++} ++ ++ ++static int do_prevent_allow(struct fsg_dev *fsg) ++{ ++ struct fsg_lun *curlun = fsg->curlun; ++ int prevent; ++ ++ if (!mod_data.removable) { ++ curlun->sense_data = SS_INVALID_COMMAND; ++ return -EINVAL; ++ } ++ ++ prevent = fsg->cmnd[4] & 0x01; ++ if ((fsg->cmnd[4] & ~0x01) != 0) { // Mask away Prevent ++ curlun->sense_data = SS_INVALID_FIELD_IN_CDB; ++ return -EINVAL; ++ } ++ ++ if (curlun->prevent_medium_removal && !prevent) ++ fsg_lun_fsync_sub(curlun); ++ curlun->prevent_medium_removal = prevent; ++ return 0; ++} ++ ++ ++static int do_read_format_capacities(struct fsg_dev *fsg, ++ struct fsg_buffhd *bh) ++{ ++ struct fsg_lun *curlun = fsg->curlun; ++ u8 *buf = (u8 *) bh->buf; ++ ++ buf[0] = buf[1] = buf[2] = 0; ++ buf[3] = 8; // Only the Current/Maximum Capacity Descriptor ++ buf += 4; ++ ++ put_unaligned_be32(curlun->num_sectors, &buf[0]); ++ /* Number of blocks */ ++ put_unaligned_be32(curlun->blksize, &buf[4]); /* Block length */ ++ buf[4] = 0x02; /* Current capacity */ ++ return 12; ++} ++ ++ ++static int do_mode_select(struct fsg_dev *fsg, struct fsg_buffhd *bh) ++{ ++ struct fsg_lun *curlun = fsg->curlun; ++ ++ /* We don't support MODE SELECT */ ++ curlun->sense_data = SS_INVALID_COMMAND; ++ return -EINVAL; ++} ++ ++ ++/*-------------------------------------------------------------------------*/ ++ ++static int halt_bulk_in_endpoint(struct fsg_dev *fsg) ++{ ++ int rc; ++ ++ rc = fsg_set_halt(fsg, fsg->bulk_in); ++ if (rc == -EAGAIN) ++ VDBG(fsg, "delayed bulk-in endpoint halt\n"); ++ while (rc != 0) { ++ if (rc != -EAGAIN) { ++ WARNING(fsg, "usb_ep_set_halt -> %d\n", rc); ++ rc = 0; ++ break; ++ } ++ ++ /* Wait for a short time and then try again */ ++ if (msleep_interruptible(100) != 0) ++ return -EINTR; ++ rc = usb_ep_set_halt(fsg->bulk_in); ++ } ++ return rc; ++} ++ ++static int wedge_bulk_in_endpoint(struct fsg_dev *fsg) ++{ ++ int rc; ++ ++ DBG(fsg, "bulk-in set wedge\n"); ++ rc = usb_ep_set_wedge(fsg->bulk_in); ++ if (rc == -EAGAIN) ++ VDBG(fsg, "delayed bulk-in endpoint wedge\n"); ++ while (rc != 0) { ++ if (rc != -EAGAIN) { ++ WARNING(fsg, "usb_ep_set_wedge -> %d\n", rc); ++ rc = 0; ++ break; ++ } ++ ++ /* Wait for a short time and then try again */ ++ if (msleep_interruptible(100) != 0) ++ return -EINTR; ++ rc = usb_ep_set_wedge(fsg->bulk_in); ++ } ++ return rc; ++} ++ ++static int throw_away_data(struct fsg_dev *fsg) ++{ ++ struct fsg_buffhd *bh; ++ u32 amount; ++ int rc; ++ ++ while ((bh = fsg->next_buffhd_to_drain)->state != BUF_STATE_EMPTY || ++ fsg->usb_amount_left > 0) { ++ ++ /* Throw away the data in a filled buffer */ ++ if (bh->state == BUF_STATE_FULL) { ++ smp_rmb(); ++ bh->state = BUF_STATE_EMPTY; ++ fsg->next_buffhd_to_drain = bh->next; ++ ++ /* A short packet or an error ends everything */ ++ if (bh->outreq->actual < bh->bulk_out_intended_length || ++ bh->outreq->status != 0) { ++ raise_exception(fsg, FSG_STATE_ABORT_BULK_OUT); ++ return -EINTR; ++ } ++ continue; ++ } ++ ++ /* Try to submit another request if we need one */ ++ bh = fsg->next_buffhd_to_fill; ++ if (bh->state == BUF_STATE_EMPTY && fsg->usb_amount_left > 0) { ++ amount = min(fsg->usb_amount_left, ++ (u32) mod_data.buflen); ++ ++ /* Except at the end of the transfer, amount will be ++ * equal to the buffer size, which is divisible by ++ * the bulk-out maxpacket size. ++ */ ++ set_bulk_out_req_length(fsg, bh, amount); ++ start_transfer(fsg, fsg->bulk_out, bh->outreq, ++ &bh->outreq_busy, &bh->state); ++ fsg->next_buffhd_to_fill = bh->next; ++ fsg->usb_amount_left -= amount; ++ continue; ++ } ++ ++ /* Otherwise wait for something to happen */ ++ rc = sleep_thread(fsg); ++ if (rc) ++ return rc; ++ } ++ return 0; ++} ++ ++ ++static int finish_reply(struct fsg_dev *fsg) ++{ ++ struct fsg_buffhd *bh = fsg->next_buffhd_to_fill; ++ int rc = 0; ++ ++ switch (fsg->data_dir) { ++ case DATA_DIR_NONE: ++ break; // Nothing to send ++ ++ /* If we don't know whether the host wants to read or write, ++ * this must be CB or CBI with an unknown command. We mustn't ++ * try to send or receive any data. So stall both bulk pipes ++ * if we can and wait for a reset. */ ++ case DATA_DIR_UNKNOWN: ++ if (mod_data.can_stall) { ++ fsg_set_halt(fsg, fsg->bulk_out); ++ rc = halt_bulk_in_endpoint(fsg); ++ } ++ break; ++ ++ /* All but the last buffer of data must have already been sent */ ++ case DATA_DIR_TO_HOST: ++ if (fsg->data_size == 0) ++ ; // Nothing to send ++ ++ /* If there's no residue, simply send the last buffer */ ++ else if (fsg->residue == 0) { ++ bh->inreq->zero = 0; ++ start_transfer(fsg, fsg->bulk_in, bh->inreq, ++ &bh->inreq_busy, &bh->state); ++ fsg->next_buffhd_to_fill = bh->next; ++ } ++ ++ /* There is a residue. For CB and CBI, simply mark the end ++ * of the data with a short packet. However, if we are ++ * allowed to stall, there was no data at all (residue == ++ * data_size), and the command failed (invalid LUN or ++ * sense data is set), then halt the bulk-in endpoint ++ * instead. */ ++ else if (!transport_is_bbb()) { ++ if (mod_data.can_stall && ++ fsg->residue == fsg->data_size && ++ (!fsg->curlun || fsg->curlun->sense_data != SS_NO_SENSE)) { ++ bh->state = BUF_STATE_EMPTY; ++ rc = halt_bulk_in_endpoint(fsg); ++ } else { ++ bh->inreq->zero = 1; ++ start_transfer(fsg, fsg->bulk_in, bh->inreq, ++ &bh->inreq_busy, &bh->state); ++ fsg->next_buffhd_to_fill = bh->next; ++ } ++ } ++ ++ /* ++ * For Bulk-only, mark the end of the data with a short ++ * packet. If we are allowed to stall, halt the bulk-in ++ * endpoint. (Note: This violates the Bulk-Only Transport ++ * specification, which requires us to pad the data if we ++ * don't halt the endpoint. Presumably nobody will mind.) ++ */ ++ else { ++ bh->inreq->zero = 1; ++ start_transfer(fsg, fsg->bulk_in, bh->inreq, ++ &bh->inreq_busy, &bh->state); ++ fsg->next_buffhd_to_fill = bh->next; ++ if (mod_data.can_stall) ++ rc = halt_bulk_in_endpoint(fsg); ++ } ++ break; ++ ++ /* We have processed all we want from the data the host has sent. ++ * There may still be outstanding bulk-out requests. */ ++ case DATA_DIR_FROM_HOST: ++ if (fsg->residue == 0) ++ ; // Nothing to receive ++ ++ /* Did the host stop sending unexpectedly early? */ ++ else if (fsg->short_packet_received) { ++ raise_exception(fsg, FSG_STATE_ABORT_BULK_OUT); ++ rc = -EINTR; ++ } ++ ++ /* We haven't processed all the incoming data. Even though ++ * we may be allowed to stall, doing so would cause a race. ++ * The controller may already have ACK'ed all the remaining ++ * bulk-out packets, in which case the host wouldn't see a ++ * STALL. Not realizing the endpoint was halted, it wouldn't ++ * clear the halt -- leading to problems later on. */ ++#if 0 ++ else if (mod_data.can_stall) { ++ fsg_set_halt(fsg, fsg->bulk_out); ++ raise_exception(fsg, FSG_STATE_ABORT_BULK_OUT); ++ rc = -EINTR; ++ } ++#endif ++ ++ /* We can't stall. Read in the excess data and throw it ++ * all away. */ ++ else ++ rc = throw_away_data(fsg); ++ break; ++ } ++ return rc; ++} ++ ++ ++static int send_status(struct fsg_dev *fsg) ++{ ++ struct fsg_lun *curlun = fsg->curlun; ++ struct fsg_buffhd *bh; ++ int rc; ++ u8 status = US_BULK_STAT_OK; ++ u32 sd, sdinfo = 0; ++ ++ /* Wait for the next buffer to become available */ ++ bh = fsg->next_buffhd_to_fill; ++ while (bh->state != BUF_STATE_EMPTY) { ++ rc = sleep_thread(fsg); ++ if (rc) ++ return rc; ++ } ++ ++ if (curlun) { ++ sd = curlun->sense_data; ++ sdinfo = curlun->sense_data_info; ++ } else if (fsg->bad_lun_okay) ++ sd = SS_NO_SENSE; ++ else ++ sd = SS_LOGICAL_UNIT_NOT_SUPPORTED; ++ ++ if (fsg->phase_error) { ++ DBG(fsg, "sending phase-error status\n"); ++ status = US_BULK_STAT_PHASE; ++ sd = SS_INVALID_COMMAND; ++ } else if (sd != SS_NO_SENSE) { ++ DBG(fsg, "sending command-failure status\n"); ++ status = US_BULK_STAT_FAIL; ++ VDBG(fsg, " sense data: SK x%02x, ASC x%02x, ASCQ x%02x;" ++ " info x%x\n", ++ SK(sd), ASC(sd), ASCQ(sd), sdinfo); ++ } ++ ++ if (transport_is_bbb()) { ++ struct bulk_cs_wrap *csw = bh->buf; ++ ++ /* Store and send the Bulk-only CSW */ ++ csw->Signature = cpu_to_le32(US_BULK_CS_SIGN); ++ csw->Tag = fsg->tag; ++ csw->Residue = cpu_to_le32(fsg->residue); ++ csw->Status = status; ++ ++ bh->inreq->length = US_BULK_CS_WRAP_LEN; ++ bh->inreq->zero = 0; ++ start_transfer(fsg, fsg->bulk_in, bh->inreq, ++ &bh->inreq_busy, &bh->state); ++ ++ } else if (mod_data.transport_type == USB_PR_CB) { ++ ++ /* Control-Bulk transport has no status phase! */ ++ return 0; ++ ++ } else { // USB_PR_CBI ++ struct interrupt_data *buf = bh->buf; ++ ++ /* Store and send the Interrupt data. UFI sends the ASC ++ * and ASCQ bytes. Everything else sends a Type (which ++ * is always 0) and the status Value. */ ++ if (mod_data.protocol_type == USB_SC_UFI) { ++ buf->bType = ASC(sd); ++ buf->bValue = ASCQ(sd); ++ } else { ++ buf->bType = 0; ++ buf->bValue = status; ++ } ++ fsg->intreq->length = CBI_INTERRUPT_DATA_LEN; ++ ++ fsg->intr_buffhd = bh; // Point to the right buffhd ++ fsg->intreq->buf = bh->inreq->buf; ++ fsg->intreq->context = bh; ++ start_transfer(fsg, fsg->intr_in, fsg->intreq, ++ &fsg->intreq_busy, &bh->state); ++ } ++ ++ fsg->next_buffhd_to_fill = bh->next; ++ return 0; ++} ++ ++ ++/*-------------------------------------------------------------------------*/ ++ ++/* Check whether the command is properly formed and whether its data size ++ * and direction agree with the values we already have. */ ++static int check_command(struct fsg_dev *fsg, int cmnd_size, ++ enum data_direction data_dir, unsigned int mask, ++ int needs_medium, const char *name) ++{ ++ int i; ++ int lun = fsg->cmnd[1] >> 5; ++ static const char dirletter[4] = {'u', 'o', 'i', 'n'}; ++ char hdlen[20]; ++ struct fsg_lun *curlun; ++ ++ /* Adjust the expected cmnd_size for protocol encapsulation padding. ++ * Transparent SCSI doesn't pad. */ ++ if (protocol_is_scsi()) ++ ; ++ ++ /* There's some disagreement as to whether RBC pads commands or not. ++ * We'll play it safe and accept either form. */ ++ else if (mod_data.protocol_type == USB_SC_RBC) { ++ if (fsg->cmnd_size == 12) ++ cmnd_size = 12; ++ ++ /* All the other protocols pad to 12 bytes */ ++ } else ++ cmnd_size = 12; ++ ++ hdlen[0] = 0; ++ if (fsg->data_dir != DATA_DIR_UNKNOWN) ++ sprintf(hdlen, ", H%c=%u", dirletter[(int) fsg->data_dir], ++ fsg->data_size); ++ VDBG(fsg, "SCSI command: %s; Dc=%d, D%c=%u; Hc=%d%s\n", ++ name, cmnd_size, dirletter[(int) data_dir], ++ fsg->data_size_from_cmnd, fsg->cmnd_size, hdlen); ++ ++ /* We can't reply at all until we know the correct data direction ++ * and size. */ ++ if (fsg->data_size_from_cmnd == 0) ++ data_dir = DATA_DIR_NONE; ++ if (fsg->data_dir == DATA_DIR_UNKNOWN) { // CB or CBI ++ fsg->data_dir = data_dir; ++ fsg->data_size = fsg->data_size_from_cmnd; ++ ++ } else { // Bulk-only ++ if (fsg->data_size < fsg->data_size_from_cmnd) { ++ ++ /* Host data size < Device data size is a phase error. ++ * Carry out the command, but only transfer as much ++ * as we are allowed. */ ++ fsg->data_size_from_cmnd = fsg->data_size; ++ fsg->phase_error = 1; ++ } ++ } ++ fsg->residue = fsg->usb_amount_left = fsg->data_size; ++ ++ /* Conflicting data directions is a phase error */ ++ if (fsg->data_dir != data_dir && fsg->data_size_from_cmnd > 0) { ++ fsg->phase_error = 1; ++ return -EINVAL; ++ } ++ ++ /* Verify the length of the command itself */ ++ if (cmnd_size != fsg->cmnd_size) { ++ ++ /* Special case workaround: There are plenty of buggy SCSI ++ * implementations. Many have issues with cbw->Length ++ * field passing a wrong command size. For those cases we ++ * always try to work around the problem by using the length ++ * sent by the host side provided it is at least as large ++ * as the correct command length. ++ * Examples of such cases would be MS-Windows, which issues ++ * REQUEST SENSE with cbw->Length == 12 where it should ++ * be 6, and xbox360 issuing INQUIRY, TEST UNIT READY and ++ * REQUEST SENSE with cbw->Length == 10 where it should ++ * be 6 as well. ++ */ ++ if (cmnd_size <= fsg->cmnd_size) { ++ DBG(fsg, "%s is buggy! Expected length %d " ++ "but we got %d\n", name, ++ cmnd_size, fsg->cmnd_size); ++ cmnd_size = fsg->cmnd_size; ++ } else { ++ fsg->phase_error = 1; ++ return -EINVAL; ++ } ++ } ++ ++ /* Check that the LUN values are consistent */ ++ if (transport_is_bbb()) { ++ if (fsg->lun != lun) ++ DBG(fsg, "using LUN %d from CBW, " ++ "not LUN %d from CDB\n", ++ fsg->lun, lun); ++ } ++ ++ /* Check the LUN */ ++ curlun = fsg->curlun; ++ if (curlun) { ++ if (fsg->cmnd[0] != REQUEST_SENSE) { ++ curlun->sense_data = SS_NO_SENSE; ++ curlun->sense_data_info = 0; ++ curlun->info_valid = 0; ++ } ++ } else { ++ fsg->bad_lun_okay = 0; ++ ++ /* INQUIRY and REQUEST SENSE commands are explicitly allowed ++ * to use unsupported LUNs; all others may not. */ ++ if (fsg->cmnd[0] != INQUIRY && ++ fsg->cmnd[0] != REQUEST_SENSE) { ++ DBG(fsg, "unsupported LUN %d\n", fsg->lun); ++ return -EINVAL; ++ } ++ } ++ ++ /* If a unit attention condition exists, only INQUIRY and ++ * REQUEST SENSE commands are allowed; anything else must fail. */ ++ if (curlun && curlun->unit_attention_data != SS_NO_SENSE && ++ fsg->cmnd[0] != INQUIRY && ++ fsg->cmnd[0] != REQUEST_SENSE) { ++ curlun->sense_data = curlun->unit_attention_data; ++ curlun->unit_attention_data = SS_NO_SENSE; ++ return -EINVAL; ++ } ++ ++ /* Check that only command bytes listed in the mask are non-zero */ ++ fsg->cmnd[1] &= 0x1f; // Mask away the LUN ++ for (i = 1; i < cmnd_size; ++i) { ++ if (fsg->cmnd[i] && !(mask & (1 << i))) { ++ if (curlun) ++ curlun->sense_data = SS_INVALID_FIELD_IN_CDB; ++ return -EINVAL; ++ } ++ } ++ ++ /* If the medium isn't mounted and the command needs to access ++ * it, return an error. */ ++ if (curlun && !fsg_lun_is_open(curlun) && needs_medium) { ++ curlun->sense_data = SS_MEDIUM_NOT_PRESENT; ++ return -EINVAL; ++ } ++ ++ return 0; ++} ++ ++/* wrapper of check_command for data size in blocks handling */ ++static int check_command_size_in_blocks(struct fsg_dev *fsg, int cmnd_size, ++ enum data_direction data_dir, unsigned int mask, ++ int needs_medium, const char *name) ++{ ++ if (fsg->curlun) ++ fsg->data_size_from_cmnd <<= fsg->curlun->blkbits; ++ return check_command(fsg, cmnd_size, data_dir, ++ mask, needs_medium, name); ++} ++ ++static int do_scsi_command(struct fsg_dev *fsg) ++{ ++ struct fsg_buffhd *bh; ++ int rc; ++ int reply = -EINVAL; ++ int i; ++ static char unknown[16]; ++ ++ dump_cdb(fsg); ++ ++ /* Wait for the next buffer to become available for data or status */ ++ bh = fsg->next_buffhd_to_drain = fsg->next_buffhd_to_fill; ++ while (bh->state != BUF_STATE_EMPTY) { ++ rc = sleep_thread(fsg); ++ if (rc) ++ return rc; ++ } ++ fsg->phase_error = 0; ++ fsg->short_packet_received = 0; ++ ++ down_read(&fsg->filesem); // We're using the backing file ++ switch (fsg->cmnd[0]) { ++ ++ case INQUIRY: ++ fsg->data_size_from_cmnd = fsg->cmnd[4]; ++ if ((reply = check_command(fsg, 6, DATA_DIR_TO_HOST, ++ (1<<4), 0, ++ "INQUIRY")) == 0) ++ reply = do_inquiry(fsg, bh); ++ break; ++ ++ case MODE_SELECT: ++ fsg->data_size_from_cmnd = fsg->cmnd[4]; ++ if ((reply = check_command(fsg, 6, DATA_DIR_FROM_HOST, ++ (1<<1) | (1<<4), 0, ++ "MODE SELECT(6)")) == 0) ++ reply = do_mode_select(fsg, bh); ++ break; ++ ++ case MODE_SELECT_10: ++ fsg->data_size_from_cmnd = get_unaligned_be16(&fsg->cmnd[7]); ++ if ((reply = check_command(fsg, 10, DATA_DIR_FROM_HOST, ++ (1<<1) | (3<<7), 0, ++ "MODE SELECT(10)")) == 0) ++ reply = do_mode_select(fsg, bh); ++ break; ++ ++ case MODE_SENSE: ++ fsg->data_size_from_cmnd = fsg->cmnd[4]; ++ if ((reply = check_command(fsg, 6, DATA_DIR_TO_HOST, ++ (1<<1) | (1<<2) | (1<<4), 0, ++ "MODE SENSE(6)")) == 0) ++ reply = do_mode_sense(fsg, bh); ++ break; ++ ++ case MODE_SENSE_10: ++ fsg->data_size_from_cmnd = get_unaligned_be16(&fsg->cmnd[7]); ++ if ((reply = check_command(fsg, 10, DATA_DIR_TO_HOST, ++ (1<<1) | (1<<2) | (3<<7), 0, ++ "MODE SENSE(10)")) == 0) ++ reply = do_mode_sense(fsg, bh); ++ break; ++ ++ case ALLOW_MEDIUM_REMOVAL: ++ fsg->data_size_from_cmnd = 0; ++ if ((reply = check_command(fsg, 6, DATA_DIR_NONE, ++ (1<<4), 0, ++ "PREVENT-ALLOW MEDIUM REMOVAL")) == 0) ++ reply = do_prevent_allow(fsg); ++ break; ++ ++ case READ_6: ++ i = fsg->cmnd[4]; ++ fsg->data_size_from_cmnd = (i == 0) ? 256 : i; ++ if ((reply = check_command_size_in_blocks(fsg, 6, ++ DATA_DIR_TO_HOST, ++ (7<<1) | (1<<4), 1, ++ "READ(6)")) == 0) ++ reply = do_read(fsg); ++ break; ++ ++ case READ_10: ++ fsg->data_size_from_cmnd = get_unaligned_be16(&fsg->cmnd[7]); ++ if ((reply = check_command_size_in_blocks(fsg, 10, ++ DATA_DIR_TO_HOST, ++ (1<<1) | (0xf<<2) | (3<<7), 1, ++ "READ(10)")) == 0) ++ reply = do_read(fsg); ++ break; ++ ++ case READ_12: ++ fsg->data_size_from_cmnd = get_unaligned_be32(&fsg->cmnd[6]); ++ if ((reply = check_command_size_in_blocks(fsg, 12, ++ DATA_DIR_TO_HOST, ++ (1<<1) | (0xf<<2) | (0xf<<6), 1, ++ "READ(12)")) == 0) ++ reply = do_read(fsg); ++ break; ++ ++ case READ_CAPACITY: ++ fsg->data_size_from_cmnd = 8; ++ if ((reply = check_command(fsg, 10, DATA_DIR_TO_HOST, ++ (0xf<<2) | (1<<8), 1, ++ "READ CAPACITY")) == 0) ++ reply = do_read_capacity(fsg, bh); ++ break; ++ ++ case READ_HEADER: ++ if (!mod_data.cdrom) ++ goto unknown_cmnd; ++ fsg->data_size_from_cmnd = get_unaligned_be16(&fsg->cmnd[7]); ++ if ((reply = check_command(fsg, 10, DATA_DIR_TO_HOST, ++ (3<<7) | (0x1f<<1), 1, ++ "READ HEADER")) == 0) ++ reply = do_read_header(fsg, bh); ++ break; ++ ++ case READ_TOC: ++ if (!mod_data.cdrom) ++ goto unknown_cmnd; ++ fsg->data_size_from_cmnd = get_unaligned_be16(&fsg->cmnd[7]); ++ if ((reply = check_command(fsg, 10, DATA_DIR_TO_HOST, ++ (7<<6) | (1<<1), 1, ++ "READ TOC")) == 0) ++ reply = do_read_toc(fsg, bh); ++ break; ++ ++ case READ_FORMAT_CAPACITIES: ++ fsg->data_size_from_cmnd = get_unaligned_be16(&fsg->cmnd[7]); ++ if ((reply = check_command(fsg, 10, DATA_DIR_TO_HOST, ++ (3<<7), 1, ++ "READ FORMAT CAPACITIES")) == 0) ++ reply = do_read_format_capacities(fsg, bh); ++ break; ++ ++ case REQUEST_SENSE: ++ fsg->data_size_from_cmnd = fsg->cmnd[4]; ++ if ((reply = check_command(fsg, 6, DATA_DIR_TO_HOST, ++ (1<<4), 0, ++ "REQUEST SENSE")) == 0) ++ reply = do_request_sense(fsg, bh); ++ break; ++ ++ case START_STOP: ++ fsg->data_size_from_cmnd = 0; ++ if ((reply = check_command(fsg, 6, DATA_DIR_NONE, ++ (1<<1) | (1<<4), 0, ++ "START-STOP UNIT")) == 0) ++ reply = do_start_stop(fsg); ++ break; ++ ++ case SYNCHRONIZE_CACHE: ++ fsg->data_size_from_cmnd = 0; ++ if ((reply = check_command(fsg, 10, DATA_DIR_NONE, ++ (0xf<<2) | (3<<7), 1, ++ "SYNCHRONIZE CACHE")) == 0) ++ reply = do_synchronize_cache(fsg); ++ break; ++ ++ case TEST_UNIT_READY: ++ fsg->data_size_from_cmnd = 0; ++ reply = check_command(fsg, 6, DATA_DIR_NONE, ++ 0, 1, ++ "TEST UNIT READY"); ++ break; ++ ++ /* Although optional, this command is used by MS-Windows. We ++ * support a minimal version: BytChk must be 0. */ ++ case VERIFY: ++ fsg->data_size_from_cmnd = 0; ++ if ((reply = check_command(fsg, 10, DATA_DIR_NONE, ++ (1<<1) | (0xf<<2) | (3<<7), 1, ++ "VERIFY")) == 0) ++ reply = do_verify(fsg); ++ break; ++ ++ case WRITE_6: ++ i = fsg->cmnd[4]; ++ fsg->data_size_from_cmnd = (i == 0) ? 256 : i; ++ if ((reply = check_command_size_in_blocks(fsg, 6, ++ DATA_DIR_FROM_HOST, ++ (7<<1) | (1<<4), 1, ++ "WRITE(6)")) == 0) ++ reply = do_write(fsg); ++ break; ++ ++ case WRITE_10: ++ fsg->data_size_from_cmnd = get_unaligned_be16(&fsg->cmnd[7]); ++ if ((reply = check_command_size_in_blocks(fsg, 10, ++ DATA_DIR_FROM_HOST, ++ (1<<1) | (0xf<<2) | (3<<7), 1, ++ "WRITE(10)")) == 0) ++ reply = do_write(fsg); ++ break; ++ ++ case WRITE_12: ++ fsg->data_size_from_cmnd = get_unaligned_be32(&fsg->cmnd[6]); ++ if ((reply = check_command_size_in_blocks(fsg, 12, ++ DATA_DIR_FROM_HOST, ++ (1<<1) | (0xf<<2) | (0xf<<6), 1, ++ "WRITE(12)")) == 0) ++ reply = do_write(fsg); ++ break; ++ ++ /* Some mandatory commands that we recognize but don't implement. ++ * They don't mean much in this setting. It's left as an exercise ++ * for anyone interested to implement RESERVE and RELEASE in terms ++ * of Posix locks. */ ++ case FORMAT_UNIT: ++ case RELEASE: ++ case RESERVE: ++ case SEND_DIAGNOSTIC: ++ // Fall through ++ ++ default: ++ unknown_cmnd: ++ fsg->data_size_from_cmnd = 0; ++ sprintf(unknown, "Unknown x%02x", fsg->cmnd[0]); ++ if ((reply = check_command(fsg, fsg->cmnd_size, ++ DATA_DIR_UNKNOWN, ~0, 0, unknown)) == 0) { ++ fsg->curlun->sense_data = SS_INVALID_COMMAND; ++ reply = -EINVAL; ++ } ++ break; ++ } ++ up_read(&fsg->filesem); ++ ++ if (reply == -EINTR || signal_pending(current)) ++ return -EINTR; ++ ++ /* Set up the single reply buffer for finish_reply() */ ++ if (reply == -EINVAL) ++ reply = 0; // Error reply length ++ if (reply >= 0 && fsg->data_dir == DATA_DIR_TO_HOST) { ++ reply = min((u32) reply, fsg->data_size_from_cmnd); ++ bh->inreq->length = reply; ++ bh->state = BUF_STATE_FULL; ++ fsg->residue -= reply; ++ } // Otherwise it's already set ++ ++ return 0; ++} ++ ++ ++/*-------------------------------------------------------------------------*/ ++ ++static int received_cbw(struct fsg_dev *fsg, struct fsg_buffhd *bh) ++{ ++ struct usb_request *req = bh->outreq; ++ struct bulk_cb_wrap *cbw = req->buf; ++ ++ /* Was this a real packet? Should it be ignored? */ ++ if (req->status || test_bit(IGNORE_BULK_OUT, &fsg->atomic_bitflags)) ++ return -EINVAL; ++ ++ /* Is the CBW valid? */ ++ if (req->actual != US_BULK_CB_WRAP_LEN || ++ cbw->Signature != cpu_to_le32( ++ US_BULK_CB_SIGN)) { ++ DBG(fsg, "invalid CBW: len %u sig 0x%x\n", ++ req->actual, ++ le32_to_cpu(cbw->Signature)); ++ ++ /* The Bulk-only spec says we MUST stall the IN endpoint ++ * (6.6.1), so it's unavoidable. It also says we must ++ * retain this state until the next reset, but there's ++ * no way to tell the controller driver it should ignore ++ * Clear-Feature(HALT) requests. ++ * ++ * We aren't required to halt the OUT endpoint; instead ++ * we can simply accept and discard any data received ++ * until the next reset. */ ++ wedge_bulk_in_endpoint(fsg); ++ set_bit(IGNORE_BULK_OUT, &fsg->atomic_bitflags); ++ return -EINVAL; ++ } ++ ++ /* Is the CBW meaningful? */ ++ if (cbw->Lun >= FSG_MAX_LUNS || cbw->Flags & ~US_BULK_FLAG_IN || ++ cbw->Length <= 0 || cbw->Length > MAX_COMMAND_SIZE) { ++ DBG(fsg, "non-meaningful CBW: lun = %u, flags = 0x%x, " ++ "cmdlen %u\n", ++ cbw->Lun, cbw->Flags, cbw->Length); ++ ++ /* We can do anything we want here, so let's stall the ++ * bulk pipes if we are allowed to. */ ++ if (mod_data.can_stall) { ++ fsg_set_halt(fsg, fsg->bulk_out); ++ halt_bulk_in_endpoint(fsg); ++ } ++ return -EINVAL; ++ } ++ ++ /* Save the command for later */ ++ fsg->cmnd_size = cbw->Length; ++ memcpy(fsg->cmnd, cbw->CDB, fsg->cmnd_size); ++ if (cbw->Flags & US_BULK_FLAG_IN) ++ fsg->data_dir = DATA_DIR_TO_HOST; ++ else ++ fsg->data_dir = DATA_DIR_FROM_HOST; ++ fsg->data_size = le32_to_cpu(cbw->DataTransferLength); ++ if (fsg->data_size == 0) ++ fsg->data_dir = DATA_DIR_NONE; ++ fsg->lun = cbw->Lun; ++ fsg->tag = cbw->Tag; ++ return 0; ++} ++ ++ ++static int get_next_command(struct fsg_dev *fsg) ++{ ++ struct fsg_buffhd *bh; ++ int rc = 0; ++ ++ if (transport_is_bbb()) { ++ ++ /* Wait for the next buffer to become available */ ++ bh = fsg->next_buffhd_to_fill; ++ while (bh->state != BUF_STATE_EMPTY) { ++ rc = sleep_thread(fsg); ++ if (rc) ++ return rc; ++ } ++ ++ /* Queue a request to read a Bulk-only CBW */ ++ set_bulk_out_req_length(fsg, bh, US_BULK_CB_WRAP_LEN); ++ start_transfer(fsg, fsg->bulk_out, bh->outreq, ++ &bh->outreq_busy, &bh->state); ++ ++ /* We will drain the buffer in software, which means we ++ * can reuse it for the next filling. No need to advance ++ * next_buffhd_to_fill. */ ++ ++ /* Wait for the CBW to arrive */ ++ while (bh->state != BUF_STATE_FULL) { ++ rc = sleep_thread(fsg); ++ if (rc) ++ return rc; ++ } ++ smp_rmb(); ++ rc = received_cbw(fsg, bh); ++ bh->state = BUF_STATE_EMPTY; ++ ++ } else { // USB_PR_CB or USB_PR_CBI ++ ++ /* Wait for the next command to arrive */ ++ while (fsg->cbbuf_cmnd_size == 0) { ++ rc = sleep_thread(fsg); ++ if (rc) ++ return rc; ++ } ++ ++ /* Is the previous status interrupt request still busy? ++ * The host is allowed to skip reading the status, ++ * so we must cancel it. */ ++ if (fsg->intreq_busy) ++ usb_ep_dequeue(fsg->intr_in, fsg->intreq); ++ ++ /* Copy the command and mark the buffer empty */ ++ fsg->data_dir = DATA_DIR_UNKNOWN; ++ spin_lock_irq(&fsg->lock); ++ fsg->cmnd_size = fsg->cbbuf_cmnd_size; ++ memcpy(fsg->cmnd, fsg->cbbuf_cmnd, fsg->cmnd_size); ++ fsg->cbbuf_cmnd_size = 0; ++ spin_unlock_irq(&fsg->lock); ++ ++ /* Use LUN from the command */ ++ fsg->lun = fsg->cmnd[1] >> 5; ++ } ++ ++ /* Update current lun */ ++ if (fsg->lun >= 0 && fsg->lun < fsg->nluns) ++ fsg->curlun = &fsg->luns[fsg->lun]; ++ else ++ fsg->curlun = NULL; ++ ++ return rc; ++} ++ ++ ++/*-------------------------------------------------------------------------*/ ++ ++static int enable_endpoint(struct fsg_dev *fsg, struct usb_ep *ep, ++ const struct usb_endpoint_descriptor *d) ++{ ++ int rc; ++ ++ ep->driver_data = fsg; ++ ep->desc = d; ++ rc = usb_ep_enable(ep); ++ if (rc) ++ ERROR(fsg, "can't enable %s, result %d\n", ep->name, rc); ++ return rc; ++} ++ ++static int alloc_request(struct fsg_dev *fsg, struct usb_ep *ep, ++ struct usb_request **preq) ++{ ++ *preq = usb_ep_alloc_request(ep, GFP_ATOMIC); ++ if (*preq) ++ return 0; ++ ERROR(fsg, "can't allocate request for %s\n", ep->name); ++ return -ENOMEM; ++} ++ ++/* ++ * Reset interface setting and re-init endpoint state (toggle etc). ++ * Call with altsetting < 0 to disable the interface. The only other ++ * available altsetting is 0, which enables the interface. ++ */ ++static int do_set_interface(struct fsg_dev *fsg, int altsetting) ++{ ++ int rc = 0; ++ int i; ++ const struct usb_endpoint_descriptor *d; ++ ++ if (fsg->running) ++ DBG(fsg, "reset interface\n"); ++ ++reset: ++ /* Deallocate the requests */ ++ for (i = 0; i < fsg_num_buffers; ++i) { ++ struct fsg_buffhd *bh = &fsg->buffhds[i]; ++ ++ if (bh->inreq) { ++ usb_ep_free_request(fsg->bulk_in, bh->inreq); ++ bh->inreq = NULL; ++ } ++ if (bh->outreq) { ++ usb_ep_free_request(fsg->bulk_out, bh->outreq); ++ bh->outreq = NULL; ++ } ++ } ++ if (fsg->intreq) { ++ usb_ep_free_request(fsg->intr_in, fsg->intreq); ++ fsg->intreq = NULL; ++ } ++ ++ /* Disable the endpoints */ ++ if (fsg->bulk_in_enabled) { ++ usb_ep_disable(fsg->bulk_in); ++ fsg->bulk_in_enabled = 0; ++ } ++ if (fsg->bulk_out_enabled) { ++ usb_ep_disable(fsg->bulk_out); ++ fsg->bulk_out_enabled = 0; ++ } ++ if (fsg->intr_in_enabled) { ++ usb_ep_disable(fsg->intr_in); ++ fsg->intr_in_enabled = 0; ++ } ++ ++ fsg->running = 0; ++ if (altsetting < 0 || rc != 0) ++ return rc; ++ ++ DBG(fsg, "set interface %d\n", altsetting); ++ ++ /* Enable the endpoints */ ++ d = fsg_ep_desc(fsg->gadget, ++ &fsg_fs_bulk_in_desc, &fsg_hs_bulk_in_desc, ++ &fsg_ss_bulk_in_desc); ++ if ((rc = enable_endpoint(fsg, fsg->bulk_in, d)) != 0) ++ goto reset; ++ fsg->bulk_in_enabled = 1; ++ ++ d = fsg_ep_desc(fsg->gadget, ++ &fsg_fs_bulk_out_desc, &fsg_hs_bulk_out_desc, ++ &fsg_ss_bulk_out_desc); ++ if ((rc = enable_endpoint(fsg, fsg->bulk_out, d)) != 0) ++ goto reset; ++ fsg->bulk_out_enabled = 1; ++ fsg->bulk_out_maxpacket = usb_endpoint_maxp(d); ++ clear_bit(IGNORE_BULK_OUT, &fsg->atomic_bitflags); ++ ++ if (transport_is_cbi()) { ++ d = fsg_ep_desc(fsg->gadget, ++ &fsg_fs_intr_in_desc, &fsg_hs_intr_in_desc, ++ &fsg_ss_intr_in_desc); ++ if ((rc = enable_endpoint(fsg, fsg->intr_in, d)) != 0) ++ goto reset; ++ fsg->intr_in_enabled = 1; ++ } ++ ++ /* Allocate the requests */ ++ for (i = 0; i < fsg_num_buffers; ++i) { ++ struct fsg_buffhd *bh = &fsg->buffhds[i]; ++ ++ if ((rc = alloc_request(fsg, fsg->bulk_in, &bh->inreq)) != 0) ++ goto reset; ++ if ((rc = alloc_request(fsg, fsg->bulk_out, &bh->outreq)) != 0) ++ goto reset; ++ bh->inreq->buf = bh->outreq->buf = bh->buf; ++ bh->inreq->context = bh->outreq->context = bh; ++ bh->inreq->complete = bulk_in_complete; ++ bh->outreq->complete = bulk_out_complete; ++ } ++ if (transport_is_cbi()) { ++ if ((rc = alloc_request(fsg, fsg->intr_in, &fsg->intreq)) != 0) ++ goto reset; ++ fsg->intreq->complete = intr_in_complete; ++ } ++ ++ fsg->running = 1; ++ for (i = 0; i < fsg->nluns; ++i) ++ fsg->luns[i].unit_attention_data = SS_RESET_OCCURRED; ++ return rc; ++} ++ ++ ++/* ++ * Change our operational configuration. This code must agree with the code ++ * that returns config descriptors, and with interface altsetting code. ++ * ++ * It's also responsible for power management interactions. Some ++ * configurations might not work with our current power sources. ++ * For now we just assume the gadget is always self-powered. ++ */ ++static int do_set_config(struct fsg_dev *fsg, u8 new_config) ++{ ++ int rc = 0; ++ ++ /* Disable the single interface */ ++ if (fsg->config != 0) { ++ DBG(fsg, "reset config\n"); ++ fsg->config = 0; ++ rc = do_set_interface(fsg, -1); ++ } ++ ++ /* Enable the interface */ ++ if (new_config != 0) { ++ fsg->config = new_config; ++ if ((rc = do_set_interface(fsg, 0)) != 0) ++ fsg->config = 0; // Reset on errors ++ else ++ INFO(fsg, "%s config #%d\n", ++ usb_speed_string(fsg->gadget->speed), ++ fsg->config); ++ } ++ return rc; ++} ++ ++ ++/*-------------------------------------------------------------------------*/ ++ ++static void handle_exception(struct fsg_dev *fsg) ++{ ++ siginfo_t info; ++ int sig; ++ int i; ++ int num_active; ++ struct fsg_buffhd *bh; ++ enum fsg_state old_state; ++ u8 new_config; ++ struct fsg_lun *curlun; ++ unsigned int exception_req_tag; ++ int rc; ++ ++ /* Clear the existing signals. Anything but SIGUSR1 is converted ++ * into a high-priority EXIT exception. */ ++ for (;;) { ++ sig = dequeue_signal_lock(current, &current->blocked, &info); ++ if (!sig) ++ break; ++ if (sig != SIGUSR1) { ++ if (fsg->state < FSG_STATE_EXIT) ++ DBG(fsg, "Main thread exiting on signal\n"); ++ raise_exception(fsg, FSG_STATE_EXIT); ++ } ++ } ++ ++ /* Cancel all the pending transfers */ ++ if (fsg->intreq_busy) ++ usb_ep_dequeue(fsg->intr_in, fsg->intreq); ++ for (i = 0; i < fsg_num_buffers; ++i) { ++ bh = &fsg->buffhds[i]; ++ if (bh->inreq_busy) ++ usb_ep_dequeue(fsg->bulk_in, bh->inreq); ++ if (bh->outreq_busy) ++ usb_ep_dequeue(fsg->bulk_out, bh->outreq); ++ } ++ ++ /* Wait until everything is idle */ ++ for (;;) { ++ num_active = fsg->intreq_busy; ++ for (i = 0; i < fsg_num_buffers; ++i) { ++ bh = &fsg->buffhds[i]; ++ num_active += bh->inreq_busy + bh->outreq_busy; ++ } ++ if (num_active == 0) ++ break; ++ if (sleep_thread(fsg)) ++ return; ++ } ++ ++ /* Clear out the controller's fifos */ ++ if (fsg->bulk_in_enabled) ++ usb_ep_fifo_flush(fsg->bulk_in); ++ if (fsg->bulk_out_enabled) ++ usb_ep_fifo_flush(fsg->bulk_out); ++ if (fsg->intr_in_enabled) ++ usb_ep_fifo_flush(fsg->intr_in); ++ ++ /* Reset the I/O buffer states and pointers, the SCSI ++ * state, and the exception. Then invoke the handler. */ ++ spin_lock_irq(&fsg->lock); ++ ++ for (i = 0; i < fsg_num_buffers; ++i) { ++ bh = &fsg->buffhds[i]; ++ bh->state = BUF_STATE_EMPTY; ++ } ++ fsg->next_buffhd_to_fill = fsg->next_buffhd_to_drain = ++ &fsg->buffhds[0]; ++ ++ exception_req_tag = fsg->exception_req_tag; ++ new_config = fsg->new_config; ++ old_state = fsg->state; ++ ++ if (old_state == FSG_STATE_ABORT_BULK_OUT) ++ fsg->state = FSG_STATE_STATUS_PHASE; ++ else { ++ for (i = 0; i < fsg->nluns; ++i) { ++ curlun = &fsg->luns[i]; ++ curlun->prevent_medium_removal = 0; ++ curlun->sense_data = curlun->unit_attention_data = ++ SS_NO_SENSE; ++ curlun->sense_data_info = 0; ++ curlun->info_valid = 0; ++ } ++ fsg->state = FSG_STATE_IDLE; ++ } ++ spin_unlock_irq(&fsg->lock); ++ ++ /* Carry out any extra actions required for the exception */ ++ switch (old_state) { ++ default: ++ break; ++ ++ case FSG_STATE_ABORT_BULK_OUT: ++ send_status(fsg); ++ spin_lock_irq(&fsg->lock); ++ if (fsg->state == FSG_STATE_STATUS_PHASE) ++ fsg->state = FSG_STATE_IDLE; ++ spin_unlock_irq(&fsg->lock); ++ break; ++ ++ case FSG_STATE_RESET: ++ /* In case we were forced against our will to halt a ++ * bulk endpoint, clear the halt now. (The SuperH UDC ++ * requires this.) */ ++ if (test_and_clear_bit(IGNORE_BULK_OUT, &fsg->atomic_bitflags)) ++ usb_ep_clear_halt(fsg->bulk_in); ++ ++ if (transport_is_bbb()) { ++ if (fsg->ep0_req_tag == exception_req_tag) ++ ep0_queue(fsg); // Complete the status stage ++ ++ } else if (transport_is_cbi()) ++ send_status(fsg); // Status by interrupt pipe ++ ++ /* Technically this should go here, but it would only be ++ * a waste of time. Ditto for the INTERFACE_CHANGE and ++ * CONFIG_CHANGE cases. */ ++ // for (i = 0; i < fsg->nluns; ++i) ++ // fsg->luns[i].unit_attention_data = SS_RESET_OCCURRED; ++ break; ++ ++ case FSG_STATE_INTERFACE_CHANGE: ++ rc = do_set_interface(fsg, 0); ++ if (fsg->ep0_req_tag != exception_req_tag) ++ break; ++ if (rc != 0) // STALL on errors ++ fsg_set_halt(fsg, fsg->ep0); ++ else // Complete the status stage ++ ep0_queue(fsg); ++ break; ++ ++ case FSG_STATE_CONFIG_CHANGE: ++ rc = do_set_config(fsg, new_config); ++ if (fsg->ep0_req_tag != exception_req_tag) ++ break; ++ if (rc != 0) // STALL on errors ++ fsg_set_halt(fsg, fsg->ep0); ++ else // Complete the status stage ++ ep0_queue(fsg); ++ break; ++ ++ case FSG_STATE_DISCONNECT: ++ for (i = 0; i < fsg->nluns; ++i) ++ fsg_lun_fsync_sub(fsg->luns + i); ++ do_set_config(fsg, 0); // Unconfigured state ++ break; ++ ++ case FSG_STATE_EXIT: ++ case FSG_STATE_TERMINATED: ++ do_set_config(fsg, 0); // Free resources ++ spin_lock_irq(&fsg->lock); ++ fsg->state = FSG_STATE_TERMINATED; // Stop the thread ++ spin_unlock_irq(&fsg->lock); ++ break; ++ } ++} ++ ++ ++/*-------------------------------------------------------------------------*/ ++ ++static int fsg_main_thread(void *fsg_) ++{ ++ struct fsg_dev *fsg = fsg_; ++ ++ /* Allow the thread to be killed by a signal, but set the signal mask ++ * to block everything but INT, TERM, KILL, and USR1. */ ++ allow_signal(SIGINT); ++ allow_signal(SIGTERM); ++ allow_signal(SIGKILL); ++ allow_signal(SIGUSR1); ++ ++ /* Allow the thread to be frozen */ ++ set_freezable(); ++ ++ /* Arrange for userspace references to be interpreted as kernel ++ * pointers. That way we can pass a kernel pointer to a routine ++ * that expects a __user pointer and it will work okay. */ ++ set_fs(get_ds()); ++ ++ /* The main loop */ ++ while (fsg->state != FSG_STATE_TERMINATED) { ++ if (exception_in_progress(fsg) || signal_pending(current)) { ++ handle_exception(fsg); ++ continue; ++ } ++ ++ if (!fsg->running) { ++ sleep_thread(fsg); ++ continue; ++ } ++ ++ if (get_next_command(fsg)) ++ continue; ++ ++ spin_lock_irq(&fsg->lock); ++ if (!exception_in_progress(fsg)) ++ fsg->state = FSG_STATE_DATA_PHASE; ++ spin_unlock_irq(&fsg->lock); ++ ++ if (do_scsi_command(fsg) || finish_reply(fsg)) ++ continue; ++ ++ spin_lock_irq(&fsg->lock); ++ if (!exception_in_progress(fsg)) ++ fsg->state = FSG_STATE_STATUS_PHASE; ++ spin_unlock_irq(&fsg->lock); ++ ++ if (send_status(fsg)) ++ continue; ++ ++ spin_lock_irq(&fsg->lock); ++ if (!exception_in_progress(fsg)) ++ fsg->state = FSG_STATE_IDLE; ++ spin_unlock_irq(&fsg->lock); ++ } ++ ++ spin_lock_irq(&fsg->lock); ++ fsg->thread_task = NULL; ++ spin_unlock_irq(&fsg->lock); ++ ++ /* If we are exiting because of a signal, unregister the ++ * gadget driver. */ ++ if (test_and_clear_bit(REGISTERED, &fsg->atomic_bitflags)) ++ usb_gadget_unregister_driver(&fsg_driver); ++ ++ /* Let the unbind and cleanup routines know the thread has exited */ ++ complete_and_exit(&fsg->thread_notifier, 0); ++} ++ ++ ++/*-------------------------------------------------------------------------*/ ++ ++ ++/* The write permissions and store_xxx pointers are set in fsg_bind() */ ++static DEVICE_ATTR(ro, 0444, fsg_show_ro, NULL); ++static DEVICE_ATTR(nofua, 0644, fsg_show_nofua, NULL); ++static DEVICE_ATTR(file, 0444, fsg_show_file, NULL); ++ ++ ++/*-------------------------------------------------------------------------*/ ++ ++static void fsg_release(struct kref *ref) ++{ ++ struct fsg_dev *fsg = container_of(ref, struct fsg_dev, ref); ++ ++ kfree(fsg->luns); ++ kfree(fsg); ++} ++ ++static void lun_release(struct device *dev) ++{ ++ struct rw_semaphore *filesem = dev_get_drvdata(dev); ++ struct fsg_dev *fsg = ++ container_of(filesem, struct fsg_dev, filesem); ++ ++ kref_put(&fsg->ref, fsg_release); ++} ++ ++static void /* __init_or_exit */ fsg_unbind(struct usb_gadget *gadget) ++{ ++ struct fsg_dev *fsg = get_gadget_data(gadget); ++ int i; ++ struct fsg_lun *curlun; ++ struct usb_request *req = fsg->ep0req; ++ ++ DBG(fsg, "unbind\n"); ++ clear_bit(REGISTERED, &fsg->atomic_bitflags); ++ ++ /* If the thread isn't already dead, tell it to exit now */ ++ if (fsg->state != FSG_STATE_TERMINATED) { ++ raise_exception(fsg, FSG_STATE_EXIT); ++ wait_for_completion(&fsg->thread_notifier); ++ ++ /* The cleanup routine waits for this completion also */ ++ complete(&fsg->thread_notifier); ++ } ++ ++ /* Unregister the sysfs attribute files and the LUNs */ ++ for (i = 0; i < fsg->nluns; ++i) { ++ curlun = &fsg->luns[i]; ++ if (curlun->registered) { ++ device_remove_file(&curlun->dev, &dev_attr_nofua); ++ device_remove_file(&curlun->dev, &dev_attr_ro); ++ device_remove_file(&curlun->dev, &dev_attr_file); ++ fsg_lun_close(curlun); ++ device_unregister(&curlun->dev); ++ curlun->registered = 0; ++ } ++ } ++ ++ /* Free the data buffers */ ++ for (i = 0; i < fsg_num_buffers; ++i) ++ kfree(fsg->buffhds[i].buf); ++ ++ /* Free the request and buffer for endpoint 0 */ ++ if (req) { ++ kfree(req->buf); ++ usb_ep_free_request(fsg->ep0, req); ++ } ++ ++ set_gadget_data(gadget, NULL); ++} ++ ++ ++static int __init check_parameters(struct fsg_dev *fsg) ++{ ++ int prot; ++ int gcnum; ++ ++ /* Store the default values */ ++ mod_data.transport_type = USB_PR_BULK; ++ mod_data.transport_name = "Bulk-only"; ++ mod_data.protocol_type = USB_SC_SCSI; ++ mod_data.protocol_name = "Transparent SCSI"; ++ ++ /* Some peripheral controllers are known not to be able to ++ * halt bulk endpoints correctly. If one of them is present, ++ * disable stalls. ++ */ ++ if (gadget_is_at91(fsg->gadget)) ++ mod_data.can_stall = 0; ++ ++ if (mod_data.release == 0xffff) { // Parameter wasn't set ++ gcnum = usb_gadget_controller_number(fsg->gadget); ++ if (gcnum >= 0) ++ mod_data.release = 0x0300 + gcnum; ++ else { ++ WARNING(fsg, "controller '%s' not recognized\n", ++ fsg->gadget->name); ++ mod_data.release = 0x0399; ++ } ++ } ++ ++ prot = simple_strtol(mod_data.protocol_parm, NULL, 0); ++ ++#ifdef CONFIG_USB_FILE_STORAGE_TEST ++ if (strnicmp(mod_data.transport_parm, "BBB", 10) == 0) { ++ ; // Use default setting ++ } else if (strnicmp(mod_data.transport_parm, "CB", 10) == 0) { ++ mod_data.transport_type = USB_PR_CB; ++ mod_data.transport_name = "Control-Bulk"; ++ } else if (strnicmp(mod_data.transport_parm, "CBI", 10) == 0) { ++ mod_data.transport_type = USB_PR_CBI; ++ mod_data.transport_name = "Control-Bulk-Interrupt"; ++ } else { ++ ERROR(fsg, "invalid transport: %s\n", mod_data.transport_parm); ++ return -EINVAL; ++ } ++ ++ if (strnicmp(mod_data.protocol_parm, "SCSI", 10) == 0 || ++ prot == USB_SC_SCSI) { ++ ; // Use default setting ++ } else if (strnicmp(mod_data.protocol_parm, "RBC", 10) == 0 || ++ prot == USB_SC_RBC) { ++ mod_data.protocol_type = USB_SC_RBC; ++ mod_data.protocol_name = "RBC"; ++ } else if (strnicmp(mod_data.protocol_parm, "8020", 4) == 0 || ++ strnicmp(mod_data.protocol_parm, "ATAPI", 10) == 0 || ++ prot == USB_SC_8020) { ++ mod_data.protocol_type = USB_SC_8020; ++ mod_data.protocol_name = "8020i (ATAPI)"; ++ } else if (strnicmp(mod_data.protocol_parm, "QIC", 3) == 0 || ++ prot == USB_SC_QIC) { ++ mod_data.protocol_type = USB_SC_QIC; ++ mod_data.protocol_name = "QIC-157"; ++ } else if (strnicmp(mod_data.protocol_parm, "UFI", 10) == 0 || ++ prot == USB_SC_UFI) { ++ mod_data.protocol_type = USB_SC_UFI; ++ mod_data.protocol_name = "UFI"; ++ } else if (strnicmp(mod_data.protocol_parm, "8070", 4) == 0 || ++ prot == USB_SC_8070) { ++ mod_data.protocol_type = USB_SC_8070; ++ mod_data.protocol_name = "8070i"; ++ } else { ++ ERROR(fsg, "invalid protocol: %s\n", mod_data.protocol_parm); ++ return -EINVAL; ++ } ++ ++ mod_data.buflen &= PAGE_CACHE_MASK; ++ if (mod_data.buflen <= 0) { ++ ERROR(fsg, "invalid buflen\n"); ++ return -ETOOSMALL; ++ } ++ ++#endif /* CONFIG_USB_FILE_STORAGE_TEST */ ++ ++ /* Serial string handling. ++ * On a real device, the serial string would be loaded ++ * from permanent storage. */ ++ if (mod_data.serial) { ++ const char *ch; ++ unsigned len = 0; ++ ++ /* Sanity check : ++ * The CB[I] specification limits the serial string to ++ * 12 uppercase hexadecimal characters. ++ * BBB need at least 12 uppercase hexadecimal characters, ++ * with a maximum of 126. */ ++ for (ch = mod_data.serial; *ch; ++ch) { ++ ++len; ++ if ((*ch < '0' || *ch > '9') && ++ (*ch < 'A' || *ch > 'F')) { /* not uppercase hex */ ++ WARNING(fsg, ++ "Invalid serial string character: %c\n", ++ *ch); ++ goto no_serial; ++ } ++ } ++ if (len > 126 || ++ (mod_data.transport_type == USB_PR_BULK && len < 12) || ++ (mod_data.transport_type != USB_PR_BULK && len > 12)) { ++ WARNING(fsg, "Invalid serial string length!\n"); ++ goto no_serial; ++ } ++ fsg_strings[FSG_STRING_SERIAL - 1].s = mod_data.serial; ++ } else { ++ WARNING(fsg, "No serial-number string provided!\n"); ++ no_serial: ++ device_desc.iSerialNumber = 0; ++ } ++ ++ return 0; ++} ++ ++ ++static int __init fsg_bind(struct usb_gadget *gadget) ++{ ++ struct fsg_dev *fsg = the_fsg; ++ int rc; ++ int i; ++ struct fsg_lun *curlun; ++ struct usb_ep *ep; ++ struct usb_request *req; ++ char *pathbuf, *p; ++ ++ fsg->gadget = gadget; ++ set_gadget_data(gadget, fsg); ++ fsg->ep0 = gadget->ep0; ++ fsg->ep0->driver_data = fsg; ++ ++ if ((rc = check_parameters(fsg)) != 0) ++ goto out; ++ ++ if (mod_data.removable) { // Enable the store_xxx attributes ++ dev_attr_file.attr.mode = 0644; ++ dev_attr_file.store = fsg_store_file; ++ if (!mod_data.cdrom) { ++ dev_attr_ro.attr.mode = 0644; ++ dev_attr_ro.store = fsg_store_ro; ++ } ++ } ++ ++ /* Only for removable media? */ ++ dev_attr_nofua.attr.mode = 0644; ++ dev_attr_nofua.store = fsg_store_nofua; ++ ++ /* Find out how many LUNs there should be */ ++ i = mod_data.nluns; ++ if (i == 0) ++ i = max(mod_data.num_filenames, 1u); ++ if (i > FSG_MAX_LUNS) { ++ ERROR(fsg, "invalid number of LUNs: %d\n", i); ++ rc = -EINVAL; ++ goto out; ++ } ++ ++ /* Create the LUNs, open their backing files, and register the ++ * LUN devices in sysfs. */ ++ fsg->luns = kzalloc(i * sizeof(struct fsg_lun), GFP_KERNEL); ++ if (!fsg->luns) { ++ rc = -ENOMEM; ++ goto out; ++ } ++ fsg->nluns = i; ++ ++ for (i = 0; i < fsg->nluns; ++i) { ++ curlun = &fsg->luns[i]; ++ curlun->cdrom = !!mod_data.cdrom; ++ curlun->ro = mod_data.cdrom || mod_data.ro[i]; ++ curlun->initially_ro = curlun->ro; ++ curlun->removable = mod_data.removable; ++ curlun->nofua = mod_data.nofua[i]; ++ curlun->dev.release = lun_release; ++ curlun->dev.parent = &gadget->dev; ++ curlun->dev.driver = &fsg_driver.driver; ++ dev_set_drvdata(&curlun->dev, &fsg->filesem); ++ dev_set_name(&curlun->dev,"%s-lun%d", ++ dev_name(&gadget->dev), i); ++ ++ kref_get(&fsg->ref); ++ rc = device_register(&curlun->dev); ++ if (rc) { ++ INFO(fsg, "failed to register LUN%d: %d\n", i, rc); ++ put_device(&curlun->dev); ++ goto out; ++ } ++ curlun->registered = 1; ++ ++ rc = device_create_file(&curlun->dev, &dev_attr_ro); ++ if (rc) ++ goto out; ++ rc = device_create_file(&curlun->dev, &dev_attr_nofua); ++ if (rc) ++ goto out; ++ rc = device_create_file(&curlun->dev, &dev_attr_file); ++ if (rc) ++ goto out; ++ ++ if (mod_data.file[i] && *mod_data.file[i]) { ++ rc = fsg_lun_open(curlun, mod_data.file[i]); ++ if (rc) ++ goto out; ++ } else if (!mod_data.removable) { ++ ERROR(fsg, "no file given for LUN%d\n", i); ++ rc = -EINVAL; ++ goto out; ++ } ++ } ++ ++ /* Find all the endpoints we will use */ ++ usb_ep_autoconfig_reset(gadget); ++ ep = usb_ep_autoconfig(gadget, &fsg_fs_bulk_in_desc); ++ if (!ep) ++ goto autoconf_fail; ++ ep->driver_data = fsg; // claim the endpoint ++ fsg->bulk_in = ep; ++ ++ ep = usb_ep_autoconfig(gadget, &fsg_fs_bulk_out_desc); ++ if (!ep) ++ goto autoconf_fail; ++ ep->driver_data = fsg; // claim the endpoint ++ fsg->bulk_out = ep; ++ ++ if (transport_is_cbi()) { ++ ep = usb_ep_autoconfig(gadget, &fsg_fs_intr_in_desc); ++ if (!ep) ++ goto autoconf_fail; ++ ep->driver_data = fsg; // claim the endpoint ++ fsg->intr_in = ep; ++ } ++ ++ /* Fix up the descriptors */ ++ device_desc.idVendor = cpu_to_le16(mod_data.vendor); ++ device_desc.idProduct = cpu_to_le16(mod_data.product); ++ device_desc.bcdDevice = cpu_to_le16(mod_data.release); ++ ++ i = (transport_is_cbi() ? 3 : 2); // Number of endpoints ++ fsg_intf_desc.bNumEndpoints = i; ++ fsg_intf_desc.bInterfaceSubClass = mod_data.protocol_type; ++ fsg_intf_desc.bInterfaceProtocol = mod_data.transport_type; ++ fsg_fs_function[i + FSG_FS_FUNCTION_PRE_EP_ENTRIES] = NULL; ++ ++ if (gadget_is_dualspeed(gadget)) { ++ fsg_hs_function[i + FSG_HS_FUNCTION_PRE_EP_ENTRIES] = NULL; ++ ++ /* Assume endpoint addresses are the same for both speeds */ ++ fsg_hs_bulk_in_desc.bEndpointAddress = ++ fsg_fs_bulk_in_desc.bEndpointAddress; ++ fsg_hs_bulk_out_desc.bEndpointAddress = ++ fsg_fs_bulk_out_desc.bEndpointAddress; ++ fsg_hs_intr_in_desc.bEndpointAddress = ++ fsg_fs_intr_in_desc.bEndpointAddress; ++ } ++ ++ if (gadget_is_superspeed(gadget)) { ++ unsigned max_burst; ++ ++ fsg_ss_function[i + FSG_SS_FUNCTION_PRE_EP_ENTRIES] = NULL; ++ ++ /* Calculate bMaxBurst, we know packet size is 1024 */ ++ max_burst = min_t(unsigned, mod_data.buflen / 1024, 15); ++ ++ /* Assume endpoint addresses are the same for both speeds */ ++ fsg_ss_bulk_in_desc.bEndpointAddress = ++ fsg_fs_bulk_in_desc.bEndpointAddress; ++ fsg_ss_bulk_in_comp_desc.bMaxBurst = max_burst; ++ ++ fsg_ss_bulk_out_desc.bEndpointAddress = ++ fsg_fs_bulk_out_desc.bEndpointAddress; ++ fsg_ss_bulk_out_comp_desc.bMaxBurst = max_burst; ++ } ++ ++ if (gadget_is_otg(gadget)) ++ fsg_otg_desc.bmAttributes |= USB_OTG_HNP; ++ ++ rc = -ENOMEM; ++ ++ /* Allocate the request and buffer for endpoint 0 */ ++ fsg->ep0req = req = usb_ep_alloc_request(fsg->ep0, GFP_KERNEL); ++ if (!req) ++ goto out; ++ req->buf = kmalloc(EP0_BUFSIZE, GFP_KERNEL); ++ if (!req->buf) ++ goto out; ++ req->complete = ep0_complete; ++ ++ /* Allocate the data buffers */ ++ for (i = 0; i < fsg_num_buffers; ++i) { ++ struct fsg_buffhd *bh = &fsg->buffhds[i]; ++ ++ /* Allocate for the bulk-in endpoint. We assume that ++ * the buffer will also work with the bulk-out (and ++ * interrupt-in) endpoint. */ ++ bh->buf = kmalloc(mod_data.buflen, GFP_KERNEL); ++ if (!bh->buf) ++ goto out; ++ bh->next = bh + 1; ++ } ++ fsg->buffhds[fsg_num_buffers - 1].next = &fsg->buffhds[0]; ++ ++ /* This should reflect the actual gadget power source */ ++ usb_gadget_set_selfpowered(gadget); ++ ++ snprintf(fsg_string_manufacturer, sizeof fsg_string_manufacturer, ++ "%s %s with %s", ++ init_utsname()->sysname, init_utsname()->release, ++ gadget->name); ++ ++ fsg->thread_task = kthread_create(fsg_main_thread, fsg, ++ "file-storage-gadget"); ++ if (IS_ERR(fsg->thread_task)) { ++ rc = PTR_ERR(fsg->thread_task); ++ goto out; ++ } ++ ++ INFO(fsg, DRIVER_DESC ", version: " DRIVER_VERSION "\n"); ++ INFO(fsg, "NOTE: This driver is deprecated. " ++ "Consider using g_mass_storage instead.\n"); ++ INFO(fsg, "Number of LUNs=%d\n", fsg->nluns); ++ ++ pathbuf = kmalloc(PATH_MAX, GFP_KERNEL); ++ for (i = 0; i < fsg->nluns; ++i) { ++ curlun = &fsg->luns[i]; ++ if (fsg_lun_is_open(curlun)) { ++ p = NULL; ++ if (pathbuf) { ++ p = d_path(&curlun->filp->f_path, ++ pathbuf, PATH_MAX); ++ if (IS_ERR(p)) ++ p = NULL; ++ } ++ LINFO(curlun, "ro=%d, nofua=%d, file: %s\n", ++ curlun->ro, curlun->nofua, (p ? p : "(error)")); ++ } ++ } ++ kfree(pathbuf); ++ ++ DBG(fsg, "transport=%s (x%02x)\n", ++ mod_data.transport_name, mod_data.transport_type); ++ DBG(fsg, "protocol=%s (x%02x)\n", ++ mod_data.protocol_name, mod_data.protocol_type); ++ DBG(fsg, "VendorID=x%04x, ProductID=x%04x, Release=x%04x\n", ++ mod_data.vendor, mod_data.product, mod_data.release); ++ DBG(fsg, "removable=%d, stall=%d, cdrom=%d, buflen=%u\n", ++ mod_data.removable, mod_data.can_stall, ++ mod_data.cdrom, mod_data.buflen); ++ DBG(fsg, "I/O thread pid: %d\n", task_pid_nr(fsg->thread_task)); ++ ++ set_bit(REGISTERED, &fsg->atomic_bitflags); ++ ++ /* Tell the thread to start working */ ++ wake_up_process(fsg->thread_task); ++ return 0; ++ ++autoconf_fail: ++ ERROR(fsg, "unable to autoconfigure all endpoints\n"); ++ rc = -ENOTSUPP; ++ ++out: ++ fsg->state = FSG_STATE_TERMINATED; // The thread is dead ++ fsg_unbind(gadget); ++ complete(&fsg->thread_notifier); ++ return rc; ++} ++ ++ ++/*-------------------------------------------------------------------------*/ ++ ++static void fsg_suspend(struct usb_gadget *gadget) ++{ ++ struct fsg_dev *fsg = get_gadget_data(gadget); ++ ++ DBG(fsg, "suspend\n"); ++ set_bit(SUSPENDED, &fsg->atomic_bitflags); ++} ++ ++static void fsg_resume(struct usb_gadget *gadget) ++{ ++ struct fsg_dev *fsg = get_gadget_data(gadget); ++ ++ DBG(fsg, "resume\n"); ++ clear_bit(SUSPENDED, &fsg->atomic_bitflags); ++} ++ ++ ++/*-------------------------------------------------------------------------*/ ++ ++static struct usb_gadget_driver fsg_driver = { ++ .max_speed = USB_SPEED_SUPER, ++ .function = (char *) fsg_string_product, ++ .unbind = fsg_unbind, ++ .disconnect = fsg_disconnect, ++ .setup = fsg_setup, ++ .suspend = fsg_suspend, ++ .resume = fsg_resume, ++ ++ .driver = { ++ .name = DRIVER_NAME, ++ .owner = THIS_MODULE, ++ // .release = ... ++ // .suspend = ... ++ // .resume = ... ++ }, ++}; ++ ++ ++static int __init fsg_alloc(void) ++{ ++ struct fsg_dev *fsg; ++ ++ fsg = kzalloc(sizeof *fsg + ++ fsg_num_buffers * sizeof *(fsg->buffhds), GFP_KERNEL); ++ ++ if (!fsg) ++ return -ENOMEM; ++ spin_lock_init(&fsg->lock); ++ init_rwsem(&fsg->filesem); ++ kref_init(&fsg->ref); ++ init_completion(&fsg->thread_notifier); ++ ++ the_fsg = fsg; ++ return 0; ++} ++ ++ ++static int __init fsg_init(void) ++{ ++ int rc; ++ struct fsg_dev *fsg; ++ ++ rc = fsg_num_buffers_validate(); ++ if (rc != 0) ++ return rc; ++ ++ if ((rc = fsg_alloc()) != 0) ++ return rc; ++ fsg = the_fsg; ++ if ((rc = usb_gadget_probe_driver(&fsg_driver, fsg_bind)) != 0) ++ kref_put(&fsg->ref, fsg_release); ++ return rc; ++} ++module_init(fsg_init); ++ ++ ++static void __exit fsg_cleanup(void) ++{ ++ struct fsg_dev *fsg = the_fsg; ++ ++ /* Unregister the driver iff the thread hasn't already done so */ ++ if (test_and_clear_bit(REGISTERED, &fsg->atomic_bitflags)) ++ usb_gadget_unregister_driver(&fsg_driver); ++ ++ /* Wait for the thread to finish up */ ++ wait_for_completion(&fsg->thread_notifier); ++ ++ kref_put(&fsg->ref, fsg_release); ++} ++module_exit(fsg_cleanup); +diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig +index e9d4dde..867dc98 100644 +--- a/drivers/usb/host/Kconfig ++++ b/drivers/usb/host/Kconfig +@@ -753,6 +753,19 @@ config USB_HWA_HCD + To compile this driver a module, choose M here: the module + will be called "hwa-hc". + ++config USB_DWCOTG ++ tristate "Synopsis DWC host support" ++ depends on USB ++ help ++ The Synopsis DWC controller is a dual-role ++ host/peripheral/OTG ("On The Go") USB controllers. ++ ++ Enable this option to support this IP in host controller mode. ++ If unsure, say N. ++ ++ To compile this driver as a module, choose M here: the ++ modules built will be called dwc_otg and dwc_common_port. ++ + config USB_IMX21_HCD + tristate "i.MX21 HCD support" + depends on ARM && ARCH_MXC +diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile +index a9ddd3c..11d7761 100644 +--- a/drivers/usb/host/Makefile ++++ b/drivers/usb/host/Makefile +@@ -73,6 +73,8 @@ obj-$(CONFIG_USB_SL811_CS) += sl811_cs.o + obj-$(CONFIG_USB_U132_HCD) += u132-hcd.o + obj-$(CONFIG_USB_R8A66597_HCD) += r8a66597-hcd.o + obj-$(CONFIG_USB_HWA_HCD) += hwa-hc.o ++ ++obj-$(CONFIG_USB_DWCOTG) += dwc_otg/ dwc_common_port/ + obj-$(CONFIG_USB_IMX21_HCD) += imx21-hcd.o + obj-$(CONFIG_USB_FSL_USB2) += fsl-mph-dr-of.o + obj-$(CONFIG_USB_EHCI_FSL) += fsl-mph-dr-of.o +diff --git a/drivers/usb/host/dwc_common_port/Makefile b/drivers/usb/host/dwc_common_port/Makefile +new file mode 100644 +index 0000000..f10d466 +--- /dev/null ++++ b/drivers/usb/host/dwc_common_port/Makefile +@@ -0,0 +1,58 @@ ++# ++# Makefile for DWC_common library ++# ++ ++ifneq ($(KERNELRELEASE),) ++ ++ccflags-y += -DDWC_LINUX ++#ccflags-y += -DDEBUG ++#ccflags-y += -DDWC_DEBUG_REGS ++#ccflags-y += -DDWC_DEBUG_MEMORY ++ ++ccflags-y += -DDWC_LIBMODULE ++ccflags-y += -DDWC_CCLIB ++#ccflags-y += -DDWC_CRYPTOLIB ++ccflags-y += -DDWC_NOTIFYLIB ++ccflags-y += -DDWC_UTFLIB ++ ++obj-$(CONFIG_USB_DWCOTG) += dwc_common_port_lib.o ++dwc_common_port_lib-objs := dwc_cc.o dwc_modpow.o dwc_dh.o \ ++ dwc_crypto.o dwc_notifier.o \ ++ dwc_common_linux.o dwc_mem.o ++ ++kernrelwd := $(subst ., ,$(KERNELRELEASE)) ++kernrel3 := $(word 1,$(kernrelwd)).$(word 2,$(kernrelwd)).$(word 3,$(kernrelwd)) ++ ++ifneq ($(kernrel3),2.6.20) ++# grayg - I only know that we use ccflags-y in 2.6.31 actually ++ccflags-y += $(CPPFLAGS) ++endif ++ ++else ++ ++#ifeq ($(KDIR),) ++#$(error Must give "KDIR=/path/to/kernel/source" on command line or in environment) ++#endif ++ ++ifeq ($(ARCH),) ++$(error Must give "ARCH=<arch>" on command line or in environment. Also, if \ ++ cross-compiling, must give "CROSS_COMPILE=/path/to/compiler/plus/tool-prefix-") ++endif ++ ++ifeq ($(DOXYGEN),) ++DOXYGEN := doxygen ++endif ++ ++default: ++ $(MAKE) -C$(KDIR) M=$(PWD) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) modules ++ ++docs: $(wildcard *.[hc]) doc/doxygen.cfg ++ $(DOXYGEN) doc/doxygen.cfg ++ ++tags: $(wildcard *.[hc]) ++ $(CTAGS) -e $(wildcard *.[hc]) $(wildcard linux/*.[hc]) $(wildcard $(KDIR)/include/linux/usb*.h) ++ ++endif ++ ++clean: ++ rm -rf *.o *.ko .*.cmd *.mod.c .*.o.d .*.o.tmp modules.order Module.markers Module.symvers .tmp_versions/ +diff --git a/drivers/usb/host/dwc_common_port/Makefile.fbsd b/drivers/usb/host/dwc_common_port/Makefile.fbsd +new file mode 100644 +index 0000000..45db991 +--- /dev/null ++++ b/drivers/usb/host/dwc_common_port/Makefile.fbsd +@@ -0,0 +1,17 @@ ++CFLAGS += -I/sys/i386/compile/GENERIC -I/sys/i386/include -I/usr/include ++CFLAGS += -DDWC_FREEBSD ++CFLAGS += -DDEBUG ++#CFLAGS += -DDWC_DEBUG_REGS ++#CFLAGS += -DDWC_DEBUG_MEMORY ++ ++#CFLAGS += -DDWC_LIBMODULE ++#CFLAGS += -DDWC_CCLIB ++#CFLAGS += -DDWC_CRYPTOLIB ++#CFLAGS += -DDWC_NOTIFYLIB ++#CFLAGS += -DDWC_UTFLIB ++ ++KMOD = dwc_common_port_lib ++SRCS = dwc_cc.c dwc_modpow.c dwc_dh.c dwc_crypto.c dwc_notifier.c \ ++ dwc_common_fbsd.c dwc_mem.c ++ ++.include <bsd.kmod.mk> +diff --git a/drivers/usb/host/dwc_common_port/Makefile.linux b/drivers/usb/host/dwc_common_port/Makefile.linux +new file mode 100644 +index 0000000..0cef7b4 +--- /dev/null ++++ b/drivers/usb/host/dwc_common_port/Makefile.linux +@@ -0,0 +1,49 @@ ++# ++# Makefile for DWC_common library ++# ++ifneq ($(KERNELRELEASE),) ++ ++ccflags-y += -DDWC_LINUX ++#ccflags-y += -DDEBUG ++#ccflags-y += -DDWC_DEBUG_REGS ++#ccflags-y += -DDWC_DEBUG_MEMORY ++ ++ccflags-y += -DDWC_LIBMODULE ++ccflags-y += -DDWC_CCLIB ++ccflags-y += -DDWC_CRYPTOLIB ++ccflags-y += -DDWC_NOTIFYLIB ++ccflags-y += -DDWC_UTFLIB ++ ++obj-m := dwc_common_port_lib.o ++dwc_common_port_lib-objs := dwc_cc.o dwc_modpow.o dwc_dh.o \ ++ dwc_crypto.o dwc_notifier.o \ ++ dwc_common_linux.o dwc_mem.o ++ ++else ++ ++ifeq ($(KDIR),) ++$(error Must give "KDIR=/path/to/kernel/source" on command line or in environment) ++endif ++ ++ifeq ($(ARCH),) ++$(error Must give "ARCH=<arch>" on command line or in environment. Also, if \ ++ cross-compiling, must give "CROSS_COMPILE=/path/to/compiler/plus/tool-prefix-") ++endif ++ ++ifeq ($(DOXYGEN),) ++DOXYGEN := doxygen ++endif ++ ++default: ++ $(MAKE) -C$(KDIR) M=$(PWD) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) modules ++ ++docs: $(wildcard *.[hc]) doc/doxygen.cfg ++ $(DOXYGEN) doc/doxygen.cfg ++ ++tags: $(wildcard *.[hc]) ++ $(CTAGS) -e $(wildcard *.[hc]) $(wildcard linux/*.[hc]) $(wildcard $(KDIR)/include/linux/usb*.h) ++ ++endif ++ ++clean: ++ rm -rf *.o *.ko .*.cmd *.mod.c .*.o.d .*.o.tmp modules.order Module.markers Module.symvers .tmp_versions/ +diff --git a/drivers/usb/host/dwc_common_port/changes.txt b/drivers/usb/host/dwc_common_port/changes.txt +new file mode 100644 +index 0000000..f6839f9 +--- /dev/null ++++ b/drivers/usb/host/dwc_common_port/changes.txt +@@ -0,0 +1,174 @@ ++ ++dwc_read_reg32() and friends now take an additional parameter, a pointer to an ++IO context struct. The IO context struct should live in an os-dependent struct ++in your driver. As an example, the dwc_usb3 driver has an os-dependent struct ++named 'os_dep' embedded in the main device struct. So there these calls look ++like this: ++ ++ dwc_read_reg32(&usb3_dev->os_dep.ioctx, &pcd->dev_global_regs->dcfg); ++ ++ dwc_write_reg32(&usb3_dev->os_dep.ioctx, ++ &pcd->dev_global_regs->dcfg, 0); ++ ++Note that for the existing Linux driver ports, it is not necessary to actually ++define the 'ioctx' member in the os-dependent struct. Since Linux does not ++require an IO context, its macros for dwc_read_reg32() and friends do not ++use the context pointer, so it is optimized away by the compiler. But it is ++necessary to add the pointer parameter to all of the call sites, to be ready ++for any future ports (such as FreeBSD) which do require an IO context. ++ ++ ++Similarly, dwc_alloc(), dwc_alloc_atomic(), dwc_strdup(), and dwc_free() now ++take an additional parameter, a pointer to a memory context. Examples: ++ ++ addr = dwc_alloc(&usb3_dev->os_dep.memctx, size); ++ ++ dwc_free(&usb3_dev->os_dep.memctx, addr); ++ ++Again, for the Linux ports, it is not necessary to actually define the memctx ++member, but it is necessary to add the pointer parameter to all of the call ++sites. ++ ++ ++Same for dwc_dma_alloc() and dwc_dma_free(). Examples: ++ ++ virt_addr = dwc_dma_alloc(&usb3_dev->os_dep.dmactx, size, &phys_addr); ++ ++ dwc_dma_free(&usb3_dev->os_dep.dmactx, size, virt_addr, phys_addr); ++ ++ ++Same for dwc_mutex_alloc() and dwc_mutex_free(). Examples: ++ ++ mutex = dwc_mutex_alloc(&usb3_dev->os_dep.mtxctx); ++ ++ dwc_mutex_free(&usb3_dev->os_dep.mtxctx, mutex); ++ ++ ++Same for dwc_spinlock_alloc() and dwc_spinlock_free(). Examples: ++ ++ lock = dwc_spinlock_alloc(&usb3_dev->osdep.splctx); ++ ++ dwc_spinlock_free(&usb3_dev->osdep.splctx, lock); ++ ++ ++Same for dwc_timer_alloc(). Example: ++ ++ timer = dwc_timer_alloc(&usb3_dev->os_dep.tmrctx, "dwc_usb3_tmr1", ++ cb_func, cb_data); ++ ++ ++Same for dwc_waitq_alloc(). Example: ++ ++ waitq = dwc_waitq_alloc(&usb3_dev->os_dep.wtqctx); ++ ++ ++Same for dwc_thread_run(). Example: ++ ++ thread = dwc_thread_run(&usb3_dev->os_dep.thdctx, func, ++ "dwc_usb3_thd1", data); ++ ++ ++Same for dwc_workq_alloc(). Example: ++ ++ workq = dwc_workq_alloc(&usb3_dev->osdep.wkqctx, "dwc_usb3_wkq1"); ++ ++ ++Same for dwc_task_alloc(). Example: ++ ++ task = dwc_task_alloc(&usb3_dev->os_dep.tskctx, "dwc_usb3_tsk1", ++ cb_func, cb_data); ++ ++ ++In addition to the context pointer additions, a few core functions have had ++other changes made to their parameters: ++ ++The 'flags' parameter to dwc_spinlock_irqsave() and dwc_spinunlock_irqrestore() ++has been changed from a uint64_t to a dwc_irqflags_t. ++ ++dwc_thread_should_stop() now takes a 'dwc_thread_t *' parameter, because the ++FreeBSD equivalent of that function requires it. ++ ++And, in addition to the context pointer, dwc_task_alloc() also adds a ++'char *name' parameter, to be consistent with dwc_thread_run() and ++dwc_workq_alloc(), and because the FreeBSD equivalent of that function ++requires a unique name. ++ ++ ++Here is a complete list of the core functions that now take a pointer to a ++context as their first parameter: ++ ++ dwc_read_reg32 ++ dwc_read_reg64 ++ dwc_write_reg32 ++ dwc_write_reg64 ++ dwc_modify_reg32 ++ dwc_modify_reg64 ++ dwc_alloc ++ dwc_alloc_atomic ++ dwc_strdup ++ dwc_free ++ dwc_dma_alloc ++ dwc_dma_free ++ dwc_mutex_alloc ++ dwc_mutex_free ++ dwc_spinlock_alloc ++ dwc_spinlock_free ++ dwc_timer_alloc ++ dwc_waitq_alloc ++ dwc_thread_run ++ dwc_workq_alloc ++ dwc_task_alloc Also adds a 'char *name' as its 2nd parameter ++ ++And here are the core functions that have other changes to their parameters: ++ ++ dwc_spinlock_irqsave 'flags' param is now a 'dwc_irqflags_t *' ++ dwc_spinunlock_irqrestore 'flags' param is now a 'dwc_irqflags_t' ++ dwc_thread_should_stop Adds a 'dwc_thread_t *' parameter ++ ++ ++ ++The changes to the core functions also require some of the other library ++functions to change: ++ ++ dwc_cc_if_alloc() and dwc_cc_if_free() now take a 'void *memctx' ++ (for memory allocation) as the 1st param and a 'void *mtxctx' ++ (for mutex allocation) as the 2nd param. ++ ++ dwc_cc_clear(), dwc_cc_add(), dwc_cc_change(), dwc_cc_remove(), ++ dwc_cc_data_for_save(), and dwc_cc_restore_from_data() now take a ++ 'void *memctx' as the 1st param. ++ ++ dwc_dh_modpow(), dwc_dh_pk(), and dwc_dh_derive_keys() now take a ++ 'void *memctx' as the 1st param. ++ ++ dwc_modpow() now takes a 'void *memctx' as the 1st param. ++ ++ dwc_alloc_notification_manager() now takes a 'void *memctx' as the ++ 1st param and a 'void *wkqctx' (for work queue allocation) as the 2nd ++ param, and also now returns an integer value that is non-zero if ++ allocation of its data structures or work queue fails. ++ ++ dwc_register_notifier() now takes a 'void *memctx' as the 1st param. ++ ++ dwc_memory_debug_start() now takes a 'void *mem_ctx' as the first ++ param, and also now returns an integer value that is non-zero if ++ allocation of its data structures fails. ++ ++ ++ ++Other miscellaneous changes: ++ ++The DEBUG_MEMORY and DEBUG_REGS #define's have been renamed to ++DWC_DEBUG_MEMORY and DWC_DEBUG_REGS. ++ ++The following #define's have been added to allow selectively compiling library ++features: ++ ++ DWC_CCLIB ++ DWC_CRYPTOLIB ++ DWC_NOTIFYLIB ++ DWC_UTFLIB ++ ++A DWC_LIBMODULE #define has also been added. If this is not defined, then the ++module code in dwc_common_linux.c is not compiled in. This allows linking the ++library code directly into a driver module, instead of as a standalone module. +diff --git a/drivers/usb/host/dwc_common_port/doc/doxygen.cfg b/drivers/usb/host/dwc_common_port/doc/doxygen.cfg +new file mode 100644 +index 0000000..89aa887 +--- /dev/null ++++ b/drivers/usb/host/dwc_common_port/doc/doxygen.cfg +@@ -0,0 +1,270 @@ ++# Doxyfile 1.4.5 ++ ++#--------------------------------------------------------------------------- ++# Project related configuration options ++#--------------------------------------------------------------------------- ++PROJECT_NAME = "Synopsys DWC Portability and Common Library for UWB" ++PROJECT_NUMBER = ++OUTPUT_DIRECTORY = doc ++CREATE_SUBDIRS = NO ++OUTPUT_LANGUAGE = English ++BRIEF_MEMBER_DESC = YES ++REPEAT_BRIEF = YES ++ABBREVIATE_BRIEF = "The $name class" \ ++ "The $name widget" \ ++ "The $name file" \ ++ is \ ++ provides \ ++ specifies \ ++ contains \ ++ represents \ ++ a \ ++ an \ ++ the ++ALWAYS_DETAILED_SEC = YES ++INLINE_INHERITED_MEMB = NO ++FULL_PATH_NAMES = NO ++STRIP_FROM_PATH = .. ++STRIP_FROM_INC_PATH = ++SHORT_NAMES = NO ++JAVADOC_AUTOBRIEF = YES ++MULTILINE_CPP_IS_BRIEF = NO ++DETAILS_AT_TOP = YES ++INHERIT_DOCS = YES ++SEPARATE_MEMBER_PAGES = NO ++TAB_SIZE = 8 ++ALIASES = ++OPTIMIZE_OUTPUT_FOR_C = YES ++OPTIMIZE_OUTPUT_JAVA = NO ++BUILTIN_STL_SUPPORT = NO ++DISTRIBUTE_GROUP_DOC = NO ++SUBGROUPING = NO ++#--------------------------------------------------------------------------- ++# Build related configuration options ++#--------------------------------------------------------------------------- ++EXTRACT_ALL = NO ++EXTRACT_PRIVATE = NO ++EXTRACT_STATIC = YES ++EXTRACT_LOCAL_CLASSES = NO ++EXTRACT_LOCAL_METHODS = NO ++HIDE_UNDOC_MEMBERS = NO ++HIDE_UNDOC_CLASSES = NO ++HIDE_FRIEND_COMPOUNDS = NO ++HIDE_IN_BODY_DOCS = NO ++INTERNAL_DOCS = NO ++CASE_SENSE_NAMES = YES ++HIDE_SCOPE_NAMES = NO ++SHOW_INCLUDE_FILES = NO ++INLINE_INFO = YES ++SORT_MEMBER_DOCS = NO ++SORT_BRIEF_DOCS = NO ++SORT_BY_SCOPE_NAME = NO ++GENERATE_TODOLIST = YES ++GENERATE_TESTLIST = YES ++GENERATE_BUGLIST = YES ++GENERATE_DEPRECATEDLIST= YES ++ENABLED_SECTIONS = ++MAX_INITIALIZER_LINES = 30 ++SHOW_USED_FILES = YES ++SHOW_DIRECTORIES = YES ++FILE_VERSION_FILTER = ++#--------------------------------------------------------------------------- ++# configuration options related to warning and progress messages ++#--------------------------------------------------------------------------- ++QUIET = YES ++WARNINGS = YES ++WARN_IF_UNDOCUMENTED = NO ++WARN_IF_DOC_ERROR = YES ++WARN_NO_PARAMDOC = YES ++WARN_FORMAT = "$file:$line: $text" ++WARN_LOGFILE = ++#--------------------------------------------------------------------------- ++# configuration options related to the input files ++#--------------------------------------------------------------------------- ++INPUT = . ++FILE_PATTERNS = *.c \ ++ *.cc \ ++ *.cxx \ ++ *.cpp \ ++ *.c++ \ ++ *.d \ ++ *.java \ ++ *.ii \ ++ *.ixx \ ++ *.ipp \ ++ *.i++ \ ++ *.inl \ ++ *.h \ ++ *.hh \ ++ *.hxx \ ++ *.hpp \ ++ *.h++ \ ++ *.idl \ ++ *.odl \ ++ *.cs \ ++ *.php \ ++ *.php3 \ ++ *.inc \ ++ *.m \ ++ *.mm \ ++ *.dox \ ++ *.py \ ++ *.C \ ++ *.CC \ ++ *.C++ \ ++ *.II \ ++ *.I++ \ ++ *.H \ ++ *.HH \ ++ *.H++ \ ++ *.CS \ ++ *.PHP \ ++ *.PHP3 \ ++ *.M \ ++ *.MM \ ++ *.PY ++RECURSIVE = NO ++EXCLUDE = ++EXCLUDE_SYMLINKS = NO ++EXCLUDE_PATTERNS = ++EXAMPLE_PATH = ++EXAMPLE_PATTERNS = * ++EXAMPLE_RECURSIVE = NO ++IMAGE_PATH = ++INPUT_FILTER = ++FILTER_PATTERNS = ++FILTER_SOURCE_FILES = NO ++#--------------------------------------------------------------------------- ++# configuration options related to source browsing ++#--------------------------------------------------------------------------- ++SOURCE_BROWSER = NO ++INLINE_SOURCES = NO ++STRIP_CODE_COMMENTS = YES ++REFERENCED_BY_RELATION = YES ++REFERENCES_RELATION = YES ++USE_HTAGS = NO ++VERBATIM_HEADERS = NO ++#--------------------------------------------------------------------------- ++# configuration options related to the alphabetical class index ++#--------------------------------------------------------------------------- ++ALPHABETICAL_INDEX = NO ++COLS_IN_ALPHA_INDEX = 5 ++IGNORE_PREFIX = ++#--------------------------------------------------------------------------- ++# configuration options related to the HTML output ++#--------------------------------------------------------------------------- ++GENERATE_HTML = YES ++HTML_OUTPUT = html ++HTML_FILE_EXTENSION = .html ++HTML_HEADER = ++HTML_FOOTER = ++HTML_STYLESHEET = ++HTML_ALIGN_MEMBERS = YES ++GENERATE_HTMLHELP = NO ++CHM_FILE = ++HHC_LOCATION = ++GENERATE_CHI = NO ++BINARY_TOC = NO ++TOC_EXPAND = NO ++DISABLE_INDEX = NO ++ENUM_VALUES_PER_LINE = 4 ++GENERATE_TREEVIEW = YES ++TREEVIEW_WIDTH = 250 ++#--------------------------------------------------------------------------- ++# configuration options related to the LaTeX output ++#--------------------------------------------------------------------------- ++GENERATE_LATEX = NO ++LATEX_OUTPUT = latex ++LATEX_CMD_NAME = latex ++MAKEINDEX_CMD_NAME = makeindex ++COMPACT_LATEX = NO ++PAPER_TYPE = a4wide ++EXTRA_PACKAGES = ++LATEX_HEADER = ++PDF_HYPERLINKS = NO ++USE_PDFLATEX = NO ++LATEX_BATCHMODE = NO ++LATEX_HIDE_INDICES = NO ++#--------------------------------------------------------------------------- ++# configuration options related to the RTF output ++#--------------------------------------------------------------------------- ++GENERATE_RTF = NO ++RTF_OUTPUT = rtf ++COMPACT_RTF = NO ++RTF_HYPERLINKS = NO ++RTF_STYLESHEET_FILE = ++RTF_EXTENSIONS_FILE = ++#--------------------------------------------------------------------------- ++# configuration options related to the man page output ++#--------------------------------------------------------------------------- ++GENERATE_MAN = NO ++MAN_OUTPUT = man ++MAN_EXTENSION = .3 ++MAN_LINKS = NO ++#--------------------------------------------------------------------------- ++# configuration options related to the XML output ++#--------------------------------------------------------------------------- ++GENERATE_XML = NO ++XML_OUTPUT = xml ++XML_SCHEMA = ++XML_DTD = ++XML_PROGRAMLISTING = YES ++#--------------------------------------------------------------------------- ++# configuration options for the AutoGen Definitions output ++#--------------------------------------------------------------------------- ++GENERATE_AUTOGEN_DEF = NO ++#--------------------------------------------------------------------------- ++# configuration options related to the Perl module output ++#--------------------------------------------------------------------------- ++GENERATE_PERLMOD = NO ++PERLMOD_LATEX = NO ++PERLMOD_PRETTY = YES ++PERLMOD_MAKEVAR_PREFIX = ++#--------------------------------------------------------------------------- ++# Configuration options related to the preprocessor ++#--------------------------------------------------------------------------- ++ENABLE_PREPROCESSING = YES ++MACRO_EXPANSION = NO ++EXPAND_ONLY_PREDEF = NO ++SEARCH_INCLUDES = YES ++INCLUDE_PATH = ++INCLUDE_FILE_PATTERNS = ++PREDEFINED = DEBUG DEBUG_MEMORY ++EXPAND_AS_DEFINED = ++SKIP_FUNCTION_MACROS = YES ++#--------------------------------------------------------------------------- ++# Configuration::additions related to external references ++#--------------------------------------------------------------------------- ++TAGFILES = ++GENERATE_TAGFILE = ++ALLEXTERNALS = NO ++EXTERNAL_GROUPS = YES ++PERL_PATH = /usr/bin/perl ++#--------------------------------------------------------------------------- ++# Configuration options related to the dot tool ++#--------------------------------------------------------------------------- ++CLASS_DIAGRAMS = YES ++HIDE_UNDOC_RELATIONS = YES ++HAVE_DOT = NO ++CLASS_GRAPH = YES ++COLLABORATION_GRAPH = YES ++GROUP_GRAPHS = YES ++UML_LOOK = NO ++TEMPLATE_RELATIONS = NO ++INCLUDE_GRAPH = NO ++INCLUDED_BY_GRAPH = YES ++CALL_GRAPH = NO ++GRAPHICAL_HIERARCHY = YES ++DIRECTORY_GRAPH = YES ++DOT_IMAGE_FORMAT = png ++DOT_PATH = ++DOTFILE_DIRS = ++MAX_DOT_GRAPH_DEPTH = 1000 ++DOT_TRANSPARENT = NO ++DOT_MULTI_TARGETS = NO ++GENERATE_LEGEND = YES ++DOT_CLEANUP = YES ++#--------------------------------------------------------------------------- ++# Configuration::additions related to the search engine ++#--------------------------------------------------------------------------- ++SEARCHENGINE = NO +diff --git a/drivers/usb/host/dwc_common_port/dwc_cc.c b/drivers/usb/host/dwc_common_port/dwc_cc.c +new file mode 100644 +index 0000000..5ec2ae2 +--- /dev/null ++++ b/drivers/usb/host/dwc_common_port/dwc_cc.c +@@ -0,0 +1,532 @@ ++/* ========================================================================= ++ * $File: //dwh/usb_iip/dev/software/dwc_common_port_2/dwc_cc.c $ ++ * $Revision: #4 $ ++ * $Date: 2010/11/04 $ ++ * $Change: 1621692 $ ++ * ++ * Synopsys Portability Library Software and documentation ++ * (hereinafter, "Software") is an Unsupported proprietary work of ++ * Synopsys, Inc. unless otherwise expressly agreed to in writing ++ * between Synopsys and you. ++ * ++ * The Software IS NOT an item of Licensed Software or Licensed Product ++ * under any End User Software License Agreement or Agreement for ++ * Licensed Product with Synopsys or any supplement thereto. You are ++ * permitted to use and redistribute this Software in source and binary ++ * forms, with or without modification, provided that redistributions ++ * of source code must retain this notice. You may not view, use, ++ * disclose, copy or distribute this file or any information contained ++ * herein except pursuant to this license grant from Synopsys. If you ++ * do not agree with this notice, including the disclaimer below, then ++ * you are not authorized to use the Software. ++ * ++ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" ++ * BASIS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ++ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS ++ * FOR A PARTICULAR PURPOSE ARE HEREBY DISCLAIMED. IN NO EVENT SHALL ++ * SYNOPSYS 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. ++ * ========================================================================= */ ++#ifdef DWC_CCLIB ++ ++#include "dwc_cc.h" ++ ++typedef struct dwc_cc ++{ ++ uint32_t uid; ++ uint8_t chid[16]; ++ uint8_t cdid[16]; ++ uint8_t ck[16]; ++ uint8_t *name; ++ uint8_t length; ++ DWC_CIRCLEQ_ENTRY(dwc_cc) list_entry; ++} dwc_cc_t; ++ ++DWC_CIRCLEQ_HEAD(context_list, dwc_cc); ++ ++/** The main structure for CC management. */ ++struct dwc_cc_if ++{ ++ dwc_mutex_t *mutex; ++ char *filename; ++ ++ unsigned is_host:1; ++ ++ dwc_notifier_t *notifier; ++ ++ struct context_list list; ++}; ++ ++#ifdef DEBUG ++static inline void dump_bytes(char *name, uint8_t *bytes, int len) ++{ ++ int i; ++ DWC_PRINTF("%s: ", name); ++ for (i=0; i<len; i++) { ++ DWC_PRINTF("%02x ", bytes[i]); ++ } ++ DWC_PRINTF("\n"); ++} ++#else ++#define dump_bytes(x...) ++#endif ++ ++static dwc_cc_t *alloc_cc(void *mem_ctx, uint8_t *name, uint32_t length) ++{ ++ dwc_cc_t *cc = dwc_alloc(mem_ctx, sizeof(dwc_cc_t)); ++ if (!cc) { ++ return NULL; ++ } ++ DWC_MEMSET(cc, 0, sizeof(dwc_cc_t)); ++ ++ if (name) { ++ cc->length = length; ++ cc->name = dwc_alloc(mem_ctx, length); ++ if (!cc->name) { ++ dwc_free(mem_ctx, cc); ++ return NULL; ++ } ++ ++ DWC_MEMCPY(cc->name, name, length); ++ } ++ ++ return cc; ++} ++ ++static void free_cc(void *mem_ctx, dwc_cc_t *cc) ++{ ++ if (cc->name) { ++ dwc_free(mem_ctx, cc->name); ++ } ++ dwc_free(mem_ctx, cc); ++} ++ ++static uint32_t next_uid(dwc_cc_if_t *cc_if) ++{ ++ uint32_t uid = 0; ++ dwc_cc_t *cc; ++ DWC_CIRCLEQ_FOREACH(cc, &cc_if->list, list_entry) { ++ if (cc->uid > uid) { ++ uid = cc->uid; ++ } ++ } ++ ++ if (uid == 0) { ++ uid = 255; ++ } ++ ++ return uid + 1; ++} ++ ++static dwc_cc_t *cc_find(dwc_cc_if_t *cc_if, uint32_t uid) ++{ ++ dwc_cc_t *cc; ++ DWC_CIRCLEQ_FOREACH(cc, &cc_if->list, list_entry) { ++ if (cc->uid == uid) { ++ return cc; ++ } ++ } ++ return NULL; ++} ++ ++static unsigned int cc_data_size(dwc_cc_if_t *cc_if) ++{ ++ unsigned int size = 0; ++ dwc_cc_t *cc; ++ DWC_CIRCLEQ_FOREACH(cc, &cc_if->list, list_entry) { ++ size += (48 + 1); ++ if (cc->name) { ++ size += cc->length; ++ } ++ } ++ return size; ++} ++ ++static uint32_t cc_match_chid(dwc_cc_if_t *cc_if, uint8_t *chid) ++{ ++ uint32_t uid = 0; ++ dwc_cc_t *cc; ++ ++ DWC_CIRCLEQ_FOREACH(cc, &cc_if->list, list_entry) { ++ if (DWC_MEMCMP(cc->chid, chid, 16) == 0) { ++ uid = cc->uid; ++ break; ++ } ++ } ++ return uid; ++} ++static uint32_t cc_match_cdid(dwc_cc_if_t *cc_if, uint8_t *cdid) ++{ ++ uint32_t uid = 0; ++ dwc_cc_t *cc; ++ ++ DWC_CIRCLEQ_FOREACH(cc, &cc_if->list, list_entry) { ++ if (DWC_MEMCMP(cc->cdid, cdid, 16) == 0) { ++ uid = cc->uid; ++ break; ++ } ++ } ++ return uid; ++} ++ ++/* Internal cc_add */ ++static int32_t cc_add(void *mem_ctx, dwc_cc_if_t *cc_if, uint8_t *chid, ++ uint8_t *cdid, uint8_t *ck, uint8_t *name, uint8_t length) ++{ ++ dwc_cc_t *cc; ++ uint32_t uid; ++ ++ if (cc_if->is_host) { ++ uid = cc_match_cdid(cc_if, cdid); ++ } ++ else { ++ uid = cc_match_chid(cc_if, chid); ++ } ++ ++ if (uid) { ++ DWC_DEBUGC("Replacing previous connection context id=%d name=%p name_len=%d", uid, name, length); ++ cc = cc_find(cc_if, uid); ++ } ++ else { ++ cc = alloc_cc(mem_ctx, name, length); ++ cc->uid = next_uid(cc_if); ++ DWC_CIRCLEQ_INSERT_TAIL(&cc_if->list, cc, list_entry); ++ } ++ ++ DWC_MEMCPY(&(cc->chid[0]), chid, 16); ++ DWC_MEMCPY(&(cc->cdid[0]), cdid, 16); ++ DWC_MEMCPY(&(cc->ck[0]), ck, 16); ++ ++ DWC_DEBUGC("Added connection context id=%d name=%p name_len=%d", cc->uid, name, length); ++ dump_bytes("CHID", cc->chid, 16); ++ dump_bytes("CDID", cc->cdid, 16); ++ dump_bytes("CK", cc->ck, 16); ++ return cc->uid; ++} ++ ++/* Internal cc_clear */ ++static void cc_clear(void *mem_ctx, dwc_cc_if_t *cc_if) ++{ ++ while (!DWC_CIRCLEQ_EMPTY(&cc_if->list)) { ++ dwc_cc_t *cc = DWC_CIRCLEQ_FIRST(&cc_if->list); ++ DWC_CIRCLEQ_REMOVE_INIT(&cc_if->list, cc, list_entry); ++ free_cc(mem_ctx, cc); ++ } ++} ++ ++dwc_cc_if_t *dwc_cc_if_alloc(void *mem_ctx, void *mtx_ctx, ++ dwc_notifier_t *notifier, unsigned is_host) ++{ ++ dwc_cc_if_t *cc_if = NULL; ++ ++ /* Allocate a common_cc_if structure */ ++ cc_if = dwc_alloc(mem_ctx, sizeof(dwc_cc_if_t)); ++ ++ if (!cc_if) ++ return NULL; ++ ++#if (defined(DWC_LINUX) && defined(CONFIG_DEBUG_MUTEXES)) ++ DWC_MUTEX_ALLOC_LINUX_DEBUG(cc_if->mutex); ++#else ++ cc_if->mutex = dwc_mutex_alloc(mtx_ctx); ++#endif ++ if (!cc_if->mutex) { ++ dwc_free(mem_ctx, cc_if); ++ return NULL; ++ } ++ ++ DWC_CIRCLEQ_INIT(&cc_if->list); ++ cc_if->is_host = is_host; ++ cc_if->notifier = notifier; ++ return cc_if; ++} ++ ++void dwc_cc_if_free(void *mem_ctx, void *mtx_ctx, dwc_cc_if_t *cc_if) ++{ ++#if (defined(DWC_LINUX) && defined(CONFIG_DEBUG_MUTEXES)) ++ DWC_MUTEX_FREE(cc_if->mutex); ++#else ++ dwc_mutex_free(mtx_ctx, cc_if->mutex); ++#endif ++ cc_clear(mem_ctx, cc_if); ++ dwc_free(mem_ctx, cc_if); ++} ++ ++static void cc_changed(dwc_cc_if_t *cc_if) ++{ ++ if (cc_if->notifier) { ++ dwc_notify(cc_if->notifier, DWC_CC_LIST_CHANGED_NOTIFICATION, cc_if); ++ } ++} ++ ++void dwc_cc_clear(void *mem_ctx, dwc_cc_if_t *cc_if) ++{ ++ DWC_MUTEX_LOCK(cc_if->mutex); ++ cc_clear(mem_ctx, cc_if); ++ DWC_MUTEX_UNLOCK(cc_if->mutex); ++ cc_changed(cc_if); ++} ++ ++int32_t dwc_cc_add(void *mem_ctx, dwc_cc_if_t *cc_if, uint8_t *chid, ++ uint8_t *cdid, uint8_t *ck, uint8_t *name, uint8_t length) ++{ ++ uint32_t uid; ++ ++ DWC_MUTEX_LOCK(cc_if->mutex); ++ uid = cc_add(mem_ctx, cc_if, chid, cdid, ck, name, length); ++ DWC_MUTEX_UNLOCK(cc_if->mutex); ++ cc_changed(cc_if); ++ ++ return uid; ++} ++ ++void dwc_cc_change(void *mem_ctx, dwc_cc_if_t *cc_if, int32_t id, uint8_t *chid, ++ uint8_t *cdid, uint8_t *ck, uint8_t *name, uint8_t length) ++{ ++ dwc_cc_t* cc; ++ ++ DWC_DEBUGC("Change connection context %d", id); ++ ++ DWC_MUTEX_LOCK(cc_if->mutex); ++ cc = cc_find(cc_if, id); ++ if (!cc) { ++ DWC_ERROR("Uid %d not found in cc list\n", id); ++ DWC_MUTEX_UNLOCK(cc_if->mutex); ++ return; ++ } ++ ++ if (chid) { ++ DWC_MEMCPY(&(cc->chid[0]), chid, 16); ++ } ++ if (cdid) { ++ DWC_MEMCPY(&(cc->cdid[0]), cdid, 16); ++ } ++ if (ck) { ++ DWC_MEMCPY(&(cc->ck[0]), ck, 16); ++ } ++ ++ if (name) { ++ if (cc->name) { ++ dwc_free(mem_ctx, cc->name); ++ } ++ cc->name = dwc_alloc(mem_ctx, length); ++ if (!cc->name) { ++ DWC_ERROR("Out of memory in dwc_cc_change()\n"); ++ DWC_MUTEX_UNLOCK(cc_if->mutex); ++ return; ++ } ++ cc->length = length; ++ DWC_MEMCPY(cc->name, name, length); ++ } ++ ++ DWC_MUTEX_UNLOCK(cc_if->mutex); ++ ++ cc_changed(cc_if); ++ ++ DWC_DEBUGC("Changed connection context id=%d\n", id); ++ dump_bytes("New CHID", cc->chid, 16); ++ dump_bytes("New CDID", cc->cdid, 16); ++ dump_bytes("New CK", cc->ck, 16); ++} ++ ++void dwc_cc_remove(void *mem_ctx, dwc_cc_if_t *cc_if, int32_t id) ++{ ++ dwc_cc_t *cc; ++ ++ DWC_DEBUGC("Removing connection context %d", id); ++ ++ DWC_MUTEX_LOCK(cc_if->mutex); ++ cc = cc_find(cc_if, id); ++ if (!cc) { ++ DWC_ERROR("Uid %d not found in cc list\n", id); ++ DWC_MUTEX_UNLOCK(cc_if->mutex); ++ return; ++ } ++ ++ DWC_CIRCLEQ_REMOVE_INIT(&cc_if->list, cc, list_entry); ++ DWC_MUTEX_UNLOCK(cc_if->mutex); ++ free_cc(mem_ctx, cc); ++ ++ cc_changed(cc_if); ++} ++ ++uint8_t *dwc_cc_data_for_save(void *mem_ctx, dwc_cc_if_t *cc_if, unsigned int *length) ++{ ++ uint8_t *buf, *x; ++ uint8_t zero = 0; ++ dwc_cc_t *cc; ++ ++ DWC_MUTEX_LOCK(cc_if->mutex); ++ *length = cc_data_size(cc_if); ++ if (!(*length)) { ++ DWC_MUTEX_UNLOCK(cc_if->mutex); ++ return NULL; ++ } ++ ++ DWC_DEBUGC("Creating data for saving (length=%d)", *length); ++ ++ buf = dwc_alloc(mem_ctx, *length); ++ if (!buf) { ++ *length = 0; ++ DWC_MUTEX_UNLOCK(cc_if->mutex); ++ return NULL; ++ } ++ ++ x = buf; ++ DWC_CIRCLEQ_FOREACH(cc, &cc_if->list, list_entry) { ++ DWC_MEMCPY(x, cc->chid, 16); ++ x += 16; ++ DWC_MEMCPY(x, cc->cdid, 16); ++ x += 16; ++ DWC_MEMCPY(x, cc->ck, 16); ++ x += 16; ++ if (cc->name) { ++ DWC_MEMCPY(x, &cc->length, 1); ++ x += 1; ++ DWC_MEMCPY(x, cc->name, cc->length); ++ x += cc->length; ++ } ++ else { ++ DWC_MEMCPY(x, &zero, 1); ++ x += 1; ++ } ++ } ++ DWC_MUTEX_UNLOCK(cc_if->mutex); ++ ++ return buf; ++} ++ ++void dwc_cc_restore_from_data(void *mem_ctx, dwc_cc_if_t *cc_if, uint8_t *data, uint32_t length) ++{ ++ uint8_t name_length; ++ uint8_t *name; ++ uint8_t *chid; ++ uint8_t *cdid; ++ uint8_t *ck; ++ uint32_t i = 0; ++ ++ DWC_MUTEX_LOCK(cc_if->mutex); ++ cc_clear(mem_ctx, cc_if); ++ ++ while (i < length) { ++ chid = &data[i]; ++ i += 16; ++ cdid = &data[i]; ++ i += 16; ++ ck = &data[i]; ++ i += 16; ++ ++ name_length = data[i]; ++ i ++; ++ ++ if (name_length) { ++ name = &data[i]; ++ i += name_length; ++ } ++ else { ++ name = NULL; ++ } ++ ++ /* check to see if we haven't overflown the buffer */ ++ if (i > length) { ++ DWC_ERROR("Data format error while attempting to load CCs " ++ "(nlen=%d, iter=%d, buflen=%d).\n", name_length, i, length); ++ break; ++ } ++ ++ cc_add(mem_ctx, cc_if, chid, cdid, ck, name, name_length); ++ } ++ DWC_MUTEX_UNLOCK(cc_if->mutex); ++ ++ cc_changed(cc_if); ++} ++ ++uint32_t dwc_cc_match_chid(dwc_cc_if_t *cc_if, uint8_t *chid) ++{ ++ uint32_t uid = 0; ++ ++ DWC_MUTEX_LOCK(cc_if->mutex); ++ uid = cc_match_chid(cc_if, chid); ++ DWC_MUTEX_UNLOCK(cc_if->mutex); ++ return uid; ++} ++uint32_t dwc_cc_match_cdid(dwc_cc_if_t *cc_if, uint8_t *cdid) ++{ ++ uint32_t uid = 0; ++ ++ DWC_MUTEX_LOCK(cc_if->mutex); ++ uid = cc_match_cdid(cc_if, cdid); ++ DWC_MUTEX_UNLOCK(cc_if->mutex); ++ return uid; ++} ++ ++uint8_t *dwc_cc_ck(dwc_cc_if_t *cc_if, int32_t id) ++{ ++ uint8_t *ck = NULL; ++ dwc_cc_t *cc; ++ ++ DWC_MUTEX_LOCK(cc_if->mutex); ++ cc = cc_find(cc_if, id); ++ if (cc) { ++ ck = cc->ck; ++ } ++ DWC_MUTEX_UNLOCK(cc_if->mutex); ++ ++ return ck; ++ ++} ++ ++uint8_t *dwc_cc_chid(dwc_cc_if_t *cc_if, int32_t id) ++{ ++ uint8_t *retval = NULL; ++ dwc_cc_t *cc; ++ ++ DWC_MUTEX_LOCK(cc_if->mutex); ++ cc = cc_find(cc_if, id); ++ if (cc) { ++ retval = cc->chid; ++ } ++ DWC_MUTEX_UNLOCK(cc_if->mutex); ++ ++ return retval; ++} ++ ++uint8_t *dwc_cc_cdid(dwc_cc_if_t *cc_if, int32_t id) ++{ ++ uint8_t *retval = NULL; ++ dwc_cc_t *cc; ++ ++ DWC_MUTEX_LOCK(cc_if->mutex); ++ cc = cc_find(cc_if, id); ++ if (cc) { ++ retval = cc->cdid; ++ } ++ DWC_MUTEX_UNLOCK(cc_if->mutex); ++ ++ return retval; ++} ++ ++uint8_t *dwc_cc_name(dwc_cc_if_t *cc_if, int32_t id, uint8_t *length) ++{ ++ uint8_t *retval = NULL; ++ dwc_cc_t *cc; ++ ++ DWC_MUTEX_LOCK(cc_if->mutex); ++ *length = 0; ++ cc = cc_find(cc_if, id); ++ if (cc) { ++ *length = cc->length; ++ retval = cc->name; ++ } ++ DWC_MUTEX_UNLOCK(cc_if->mutex); ++ ++ return retval; ++} ++ ++#endif /* DWC_CCLIB */ +diff --git a/drivers/usb/host/dwc_common_port/dwc_cc.h b/drivers/usb/host/dwc_common_port/dwc_cc.h +new file mode 100644 +index 0000000..f86e6f2 +--- /dev/null ++++ b/drivers/usb/host/dwc_common_port/dwc_cc.h +@@ -0,0 +1,224 @@ ++/* ========================================================================= ++ * $File: //dwh/usb_iip/dev/software/dwc_common_port_2/dwc_cc.h $ ++ * $Revision: #4 $ ++ * $Date: 2010/09/28 $ ++ * $Change: 1596182 $ ++ * ++ * Synopsys Portability Library Software and documentation ++ * (hereinafter, "Software") is an Unsupported proprietary work of ++ * Synopsys, Inc. unless otherwise expressly agreed to in writing ++ * between Synopsys and you. ++ * ++ * The Software IS NOT an item of Licensed Software or Licensed Product ++ * under any End User Software License Agreement or Agreement for ++ * Licensed Product with Synopsys or any supplement thereto. You are ++ * permitted to use and redistribute this Software in source and binary ++ * forms, with or without modification, provided that redistributions ++ * of source code must retain this notice. You may not view, use, ++ * disclose, copy or distribute this file or any information contained ++ * herein except pursuant to this license grant from Synopsys. If you ++ * do not agree with this notice, including the disclaimer below, then ++ * you are not authorized to use the Software. ++ * ++ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" ++ * BASIS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ++ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS ++ * FOR A PARTICULAR PURPOSE ARE HEREBY DISCLAIMED. IN NO EVENT SHALL ++ * SYNOPSYS 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. ++ * ========================================================================= */ ++#ifndef _DWC_CC_H_ ++#define _DWC_CC_H_ ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++/** @file ++ * ++ * This file defines the Context Context library. ++ * ++ * The main data structure is dwc_cc_if_t which is returned by either the ++ * dwc_cc_if_alloc function or returned by the module to the user via a provided ++ * function. The data structure is opaque and should only be manipulated via the ++ * functions provied in this API. ++ * ++ * It manages a list of connection contexts and operations can be performed to ++ * add, remove, query, search, and change, those contexts. Additionally, ++ * a dwc_notifier_t object can be requested from the manager so that ++ * the user can be notified whenever the context list has changed. ++ */ ++ ++#include "dwc_os.h" ++#include "dwc_list.h" ++#include "dwc_notifier.h" ++ ++ ++/* Notifications */ ++#define DWC_CC_LIST_CHANGED_NOTIFICATION "DWC_CC_LIST_CHANGED_NOTIFICATION" ++ ++struct dwc_cc_if; ++typedef struct dwc_cc_if dwc_cc_if_t; ++ ++ ++/** @name Connection Context Operations */ ++/** @{ */ ++ ++/** This function allocates memory for a dwc_cc_if_t structure, initializes ++ * fields to default values, and returns a pointer to the structure or NULL on ++ * error. */ ++extern dwc_cc_if_t *dwc_cc_if_alloc(void *mem_ctx, void *mtx_ctx, ++ dwc_notifier_t *notifier, unsigned is_host); ++ ++/** Frees the memory for the specified CC structure allocated from ++ * dwc_cc_if_alloc(). */ ++extern void dwc_cc_if_free(void *mem_ctx, void *mtx_ctx, dwc_cc_if_t *cc_if); ++ ++/** Removes all contexts from the connection context list */ ++extern void dwc_cc_clear(void *mem_ctx, dwc_cc_if_t *cc_if); ++ ++/** Adds a connection context (CHID, CK, CDID, Name) to the connection context list. ++ * If a CHID already exists, the CK and name are overwritten. Statistics are ++ * not overwritten. ++ * ++ * @param cc_if The cc_if structure. ++ * @param chid A pointer to the 16-byte CHID. This value will be copied. ++ * @param ck A pointer to the 16-byte CK. This value will be copied. ++ * @param cdid A pointer to the 16-byte CDID. This value will be copied. ++ * @param name An optional host friendly name as defined in the association model ++ * spec. Must be a UTF16-LE unicode string. Can be NULL to indicated no name. ++ * @param length The length othe unicode string. ++ * @return A unique identifier used to refer to this context that is valid for ++ * as long as this context is still in the list. */ ++extern int32_t dwc_cc_add(void *mem_ctx, dwc_cc_if_t *cc_if, uint8_t *chid, ++ uint8_t *cdid, uint8_t *ck, uint8_t *name, ++ uint8_t length); ++ ++/** Changes the CHID, CK, CDID, or Name values of a connection context in the ++ * list, preserving any accumulated statistics. This would typically be called ++ * if the host decideds to change the context with a SET_CONNECTION request. ++ * ++ * @param cc_if The cc_if structure. ++ * @param id The identifier of the connection context. ++ * @param chid A pointer to the 16-byte CHID. This value will be copied. NULL ++ * indicates no change. ++ * @param cdid A pointer to the 16-byte CDID. This value will be copied. NULL ++ * indicates no change. ++ * @param ck A pointer to the 16-byte CK. This value will be copied. NULL ++ * indicates no change. ++ * @param name Host friendly name UTF16-LE. NULL indicates no change. ++ * @param length Length of name. */ ++extern void dwc_cc_change(void *mem_ctx, dwc_cc_if_t *cc_if, int32_t id, ++ uint8_t *chid, uint8_t *cdid, uint8_t *ck, ++ uint8_t *name, uint8_t length); ++ ++/** Remove the specified connection context. ++ * @param cc_if The cc_if structure. ++ * @param id The identifier of the connection context to remove. */ ++extern void dwc_cc_remove(void *mem_ctx, dwc_cc_if_t *cc_if, int32_t id); ++ ++/** Get a binary block of data for the connection context list and attributes. ++ * This data can be used by the OS specific driver to save the connection ++ * context list into non-volatile memory. ++ * ++ * @param cc_if The cc_if structure. ++ * @param length Return the length of the data buffer. ++ * @return A pointer to the data buffer. The memory for this buffer should be ++ * freed with DWC_FREE() after use. */ ++extern uint8_t *dwc_cc_data_for_save(void *mem_ctx, dwc_cc_if_t *cc_if, ++ unsigned int *length); ++ ++/** Restore the connection context list from the binary data that was previously ++ * returned from a call to dwc_cc_data_for_save. This can be used by the OS specific ++ * driver to load a connection context list from non-volatile memory. ++ * ++ * @param cc_if The cc_if structure. ++ * @param data The data bytes as returned from dwc_cc_data_for_save. ++ * @param length The length of the data. */ ++extern void dwc_cc_restore_from_data(void *mem_ctx, dwc_cc_if_t *cc_if, ++ uint8_t *data, unsigned int length); ++ ++/** Find the connection context from the specified CHID. ++ * ++ * @param cc_if The cc_if structure. ++ * @param chid A pointer to the CHID data. ++ * @return A non-zero identifier of the connection context if the CHID matches. ++ * Otherwise returns 0. */ ++extern uint32_t dwc_cc_match_chid(dwc_cc_if_t *cc_if, uint8_t *chid); ++ ++/** Find the connection context from the specified CDID. ++ * ++ * @param cc_if The cc_if structure. ++ * @param cdid A pointer to the CDID data. ++ * @return A non-zero identifier of the connection context if the CHID matches. ++ * Otherwise returns 0. */ ++extern uint32_t dwc_cc_match_cdid(dwc_cc_if_t *cc_if, uint8_t *cdid); ++ ++/** Retrieve the CK from the specified connection context. ++ * ++ * @param cc_if The cc_if structure. ++ * @param id The identifier of the connection context. ++ * @return A pointer to the CK data. The memory does not need to be freed. */ ++extern uint8_t *dwc_cc_ck(dwc_cc_if_t *cc_if, int32_t id); ++ ++/** Retrieve the CHID from the specified connection context. ++ * ++ * @param cc_if The cc_if structure. ++ * @param id The identifier of the connection context. ++ * @return A pointer to the CHID data. The memory does not need to be freed. */ ++extern uint8_t *dwc_cc_chid(dwc_cc_if_t *cc_if, int32_t id); ++ ++/** Retrieve the CDID from the specified connection context. ++ * ++ * @param cc_if The cc_if structure. ++ * @param id The identifier of the connection context. ++ * @return A pointer to the CDID data. The memory does not need to be freed. */ ++extern uint8_t *dwc_cc_cdid(dwc_cc_if_t *cc_if, int32_t id); ++ ++extern uint8_t *dwc_cc_name(dwc_cc_if_t *cc_if, int32_t id, uint8_t *length); ++ ++/** Checks a buffer for non-zero. ++ * @param id A pointer to a 16 byte buffer. ++ * @return true if the 16 byte value is non-zero. */ ++static inline unsigned dwc_assoc_is_not_zero_id(uint8_t *id) { ++ int i; ++ for (i=0; i<16; i++) { ++ if (id[i]) return 1; ++ } ++ return 0; ++} ++ ++/** Checks a buffer for zero. ++ * @param id A pointer to a 16 byte buffer. ++ * @return true if the 16 byte value is zero. */ ++static inline unsigned dwc_assoc_is_zero_id(uint8_t *id) { ++ return !dwc_assoc_is_not_zero_id(id); ++} ++ ++/** Prints an ASCII representation for the 16-byte chid, cdid, or ck, into ++ * buffer. */ ++static inline int dwc_print_id_string(char *buffer, uint8_t *id) { ++ char *ptr = buffer; ++ int i; ++ for (i=0; i<16; i++) { ++ ptr += DWC_SPRINTF(ptr, "%02x", id[i]); ++ if (i < 15) { ++ ptr += DWC_SPRINTF(ptr, " "); ++ } ++ } ++ return ptr - buffer; ++} ++ ++/** @} */ ++ ++#ifdef __cplusplus ++} ++#endif ++ ++#endif /* _DWC_CC_H_ */ +diff --git a/drivers/usb/host/dwc_common_port/dwc_common_fbsd.c b/drivers/usb/host/dwc_common_port/dwc_common_fbsd.c +new file mode 100644 +index 0000000..6dd04b5 +--- /dev/null ++++ b/drivers/usb/host/dwc_common_port/dwc_common_fbsd.c +@@ -0,0 +1,1308 @@ ++#include "dwc_os.h" ++#include "dwc_list.h" ++ ++#ifdef DWC_CCLIB ++# include "dwc_cc.h" ++#endif ++ ++#ifdef DWC_CRYPTOLIB ++# include "dwc_modpow.h" ++# include "dwc_dh.h" ++# include "dwc_crypto.h" ++#endif ++ ++#ifdef DWC_NOTIFYLIB ++# include "dwc_notifier.h" ++#endif ++ ++/* OS-Level Implementations */ ++ ++/* This is the FreeBSD 7.0 kernel implementation of the DWC platform library. */ ++ ++ ++/* MISC */ ++ ++void *DWC_MEMSET(void *dest, uint8_t byte, uint32_t size) ++{ ++ return memset(dest, byte, size); ++} ++ ++void *DWC_MEMCPY(void *dest, void const *src, uint32_t size) ++{ ++ return memcpy(dest, src, size); ++} ++ ++void *DWC_MEMMOVE(void *dest, void *src, uint32_t size) ++{ ++ bcopy(src, dest, size); ++ return dest; ++} ++ ++int DWC_MEMCMP(void *m1, void *m2, uint32_t size) ++{ ++ return memcmp(m1, m2, size); ++} ++ ++int DWC_STRNCMP(void *s1, void *s2, uint32_t size) ++{ ++ return strncmp(s1, s2, size); ++} ++ ++int DWC_STRCMP(void *s1, void *s2) ++{ ++ return strcmp(s1, s2); ++} ++ ++int DWC_STRLEN(char const *str) ++{ ++ return strlen(str); ++} ++ ++char *DWC_STRCPY(char *to, char const *from) ++{ ++ return strcpy(to, from); ++} ++ ++char *DWC_STRDUP(char const *str) ++{ ++ int len = DWC_STRLEN(str) + 1; ++ char *new = DWC_ALLOC_ATOMIC(len); ++ ++ if (!new) { ++ return NULL; ++ } ++ ++ DWC_MEMCPY(new, str, len); ++ return new; ++} ++ ++int DWC_ATOI(char *str, int32_t *value) ++{ ++ char *end = NULL; ++ ++ *value = strtol(str, &end, 0); ++ if (*end == '\0') { ++ return 0; ++ } ++ ++ return -1; ++} ++ ++int DWC_ATOUI(char *str, uint32_t *value) ++{ ++ char *end = NULL; ++ ++ *value = strtoul(str, &end, 0); ++ if (*end == '\0') { ++ return 0; ++ } ++ ++ return -1; ++} ++ ++ ++#ifdef DWC_UTFLIB ++/* From usbstring.c */ ++ ++int DWC_UTF8_TO_UTF16LE(uint8_t const *s, uint16_t *cp, unsigned len) ++{ ++ int count = 0; ++ u8 c; ++ u16 uchar; ++ ++ /* this insists on correct encodings, though not minimal ones. ++ * BUT it currently rejects legit 4-byte UTF-8 code points, ++ * which need surrogate pairs. (Unicode 3.1 can use them.) ++ */ ++ while (len != 0 && (c = (u8) *s++) != 0) { ++ if (unlikely(c & 0x80)) { ++ // 2-byte sequence: ++ // 00000yyyyyxxxxxx = 110yyyyy 10xxxxxx ++ if ((c & 0xe0) == 0xc0) { ++ uchar = (c & 0x1f) << 6; ++ ++ c = (u8) *s++; ++ if ((c & 0xc0) != 0xc0) ++ goto fail; ++ c &= 0x3f; ++ uchar |= c; ++ ++ // 3-byte sequence (most CJKV characters): ++ // zzzzyyyyyyxxxxxx = 1110zzzz 10yyyyyy 10xxxxxx ++ } else if ((c & 0xf0) == 0xe0) { ++ uchar = (c & 0x0f) << 12; ++ ++ c = (u8) *s++; ++ if ((c & 0xc0) != 0xc0) ++ goto fail; ++ c &= 0x3f; ++ uchar |= c << 6; ++ ++ c = (u8) *s++; ++ if ((c & 0xc0) != 0xc0) ++ goto fail; ++ c &= 0x3f; ++ uchar |= c; ++ ++ /* no bogus surrogates */ ++ if (0xd800 <= uchar && uchar <= 0xdfff) ++ goto fail; ++ ++ // 4-byte sequence (surrogate pairs, currently rare): ++ // 11101110wwwwzzzzyy + 110111yyyyxxxxxx ++ // = 11110uuu 10uuzzzz 10yyyyyy 10xxxxxx ++ // (uuuuu = wwww + 1) ++ // FIXME accept the surrogate code points (only) ++ } else ++ goto fail; ++ } else ++ uchar = c; ++ put_unaligned (cpu_to_le16 (uchar), cp++); ++ count++; ++ len--; ++ } ++ return count; ++fail: ++ return -1; ++} ++ ++#endif /* DWC_UTFLIB */ ++ ++ ++/* dwc_debug.h */ ++ ++dwc_bool_t DWC_IN_IRQ(void) ++{ ++// return in_irq(); ++ return 0; ++} ++ ++dwc_bool_t DWC_IN_BH(void) ++{ ++// return in_softirq(); ++ return 0; ++} ++ ++void DWC_VPRINTF(char *format, va_list args) ++{ ++ vprintf(format, args); ++} ++ ++int DWC_VSNPRINTF(char *str, int size, char *format, va_list args) ++{ ++ return vsnprintf(str, size, format, args); ++} ++ ++void DWC_PRINTF(char *format, ...) ++{ ++ va_list args; ++ ++ va_start(args, format); ++ DWC_VPRINTF(format, args); ++ va_end(args); ++} ++ ++int DWC_SPRINTF(char *buffer, char *format, ...) ++{ ++ int retval; ++ va_list args; ++ ++ va_start(args, format); ++ retval = vsprintf(buffer, format, args); ++ va_end(args); ++ return retval; ++} ++ ++int DWC_SNPRINTF(char *buffer, int size, char *format, ...) ++{ ++ int retval; ++ va_list args; ++ ++ va_start(args, format); ++ retval = vsnprintf(buffer, size, format, args); ++ va_end(args); ++ return retval; ++} ++ ++void __DWC_WARN(char *format, ...) ++{ ++ va_list args; ++ ++ va_start(args, format); ++ DWC_VPRINTF(format, args); ++ va_end(args); ++} ++ ++void __DWC_ERROR(char *format, ...) ++{ ++ va_list args; ++ ++ va_start(args, format); ++ DWC_VPRINTF(format, args); ++ va_end(args); ++} ++ ++void DWC_EXCEPTION(char *format, ...) ++{ ++ va_list args; ++ ++ va_start(args, format); ++ DWC_VPRINTF(format, args); ++ va_end(args); ++// BUG_ON(1); ??? ++} ++ ++#ifdef DEBUG ++void __DWC_DEBUG(char *format, ...) ++{ ++ va_list args; ++ ++ va_start(args, format); ++ DWC_VPRINTF(format, args); ++ va_end(args); ++} ++#endif ++ ++ ++/* dwc_mem.h */ ++ ++#if 0 ++dwc_pool_t *DWC_DMA_POOL_CREATE(uint32_t size, ++ uint32_t align, ++ uint32_t alloc) ++{ ++ struct dma_pool *pool = dma_pool_create("Pool", NULL, ++ size, align, alloc); ++ return (dwc_pool_t *)pool; ++} ++ ++void DWC_DMA_POOL_DESTROY(dwc_pool_t *pool) ++{ ++ dma_pool_destroy((struct dma_pool *)pool); ++} ++ ++void *DWC_DMA_POOL_ALLOC(dwc_pool_t *pool, uint64_t *dma_addr) ++{ ++// return dma_pool_alloc((struct dma_pool *)pool, GFP_KERNEL, dma_addr); ++ return dma_pool_alloc((struct dma_pool *)pool, M_WAITOK, dma_addr); ++} ++ ++void *DWC_DMA_POOL_ZALLOC(dwc_pool_t *pool, uint64_t *dma_addr) ++{ ++ void *vaddr = DWC_DMA_POOL_ALLOC(pool, dma_addr); ++ memset(..); ++} ++ ++void DWC_DMA_POOL_FREE(dwc_pool_t *pool, void *vaddr, void *daddr) ++{ ++ dma_pool_free(pool, vaddr, daddr); ++} ++#endif ++ ++static void dmamap_cb(void *arg, bus_dma_segment_t *segs, int nseg, int error) ++{ ++ if (error) ++ return; ++ *(bus_addr_t *)arg = segs[0].ds_addr; ++} ++ ++void *__DWC_DMA_ALLOC(void *dma_ctx, uint32_t size, dwc_dma_t *dma_addr) ++{ ++ dwc_dmactx_t *dma = (dwc_dmactx_t *)dma_ctx; ++ int error; ++ ++ error = bus_dma_tag_create( ++#if __FreeBSD_version >= 700000 ++ bus_get_dma_tag(dma->dev), /* parent */ ++#else ++ NULL, /* parent */ ++#endif ++ 4, 0, /* alignment, bounds */ ++ BUS_SPACE_MAXADDR_32BIT, /* lowaddr */ ++ BUS_SPACE_MAXADDR, /* highaddr */ ++ NULL, NULL, /* filter, filterarg */ ++ size, /* maxsize */ ++ 1, /* nsegments */ ++ size, /* maxsegsize */ ++ 0, /* flags */ ++ NULL, /* lockfunc */ ++ NULL, /* lockarg */ ++ &dma->dma_tag); ++ if (error) { ++ device_printf(dma->dev, "%s: bus_dma_tag_create failed: %d\n", ++ __func__, error); ++ goto fail_0; ++ } ++ ++ error = bus_dmamem_alloc(dma->dma_tag, &dma->dma_vaddr, ++ BUS_DMA_NOWAIT | BUS_DMA_COHERENT, &dma->dma_map); ++ if (error) { ++ device_printf(dma->dev, "%s: bus_dmamem_alloc(%ju) failed: %d\n", ++ __func__, (uintmax_t)size, error); ++ goto fail_1; ++ } ++ ++ dma->dma_paddr = 0; ++ error = bus_dmamap_load(dma->dma_tag, dma->dma_map, dma->dma_vaddr, size, ++ dmamap_cb, &dma->dma_paddr, BUS_DMA_NOWAIT); ++ if (error || dma->dma_paddr == 0) { ++ device_printf(dma->dev, "%s: bus_dmamap_load failed: %d\n", ++ __func__, error); ++ goto fail_2; ++ } ++ ++ *dma_addr = dma->dma_paddr; ++ return dma->dma_vaddr; ++ ++fail_2: ++ bus_dmamap_unload(dma->dma_tag, dma->dma_map); ++fail_1: ++ bus_dmamem_free(dma->dma_tag, dma->dma_vaddr, dma->dma_map); ++ bus_dma_tag_destroy(dma->dma_tag); ++fail_0: ++ dma->dma_map = NULL; ++ dma->dma_tag = NULL; ++ ++ return NULL; ++} ++ ++void __DWC_DMA_FREE(void *dma_ctx, uint32_t size, void *virt_addr, dwc_dma_t dma_addr) ++{ ++ dwc_dmactx_t *dma = (dwc_dmactx_t *)dma_ctx; ++ ++ if (dma->dma_tag == NULL) ++ return; ++ if (dma->dma_map != NULL) { ++ bus_dmamap_sync(dma->dma_tag, dma->dma_map, ++ BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); ++ bus_dmamap_unload(dma->dma_tag, dma->dma_map); ++ bus_dmamem_free(dma->dma_tag, dma->dma_vaddr, dma->dma_map); ++ dma->dma_map = NULL; ++ } ++ ++ bus_dma_tag_destroy(dma->dma_tag); ++ dma->dma_tag = NULL; ++} ++ ++void *__DWC_ALLOC(void *mem_ctx, uint32_t size) ++{ ++ return malloc(size, M_DEVBUF, M_WAITOK | M_ZERO); ++} ++ ++void *__DWC_ALLOC_ATOMIC(void *mem_ctx, uint32_t size) ++{ ++ return malloc(size, M_DEVBUF, M_NOWAIT | M_ZERO); ++} ++ ++void __DWC_FREE(void *mem_ctx, void *addr) ++{ ++ free(addr, M_DEVBUF); ++} ++ ++ ++#ifdef DWC_CRYPTOLIB ++/* dwc_crypto.h */ ++ ++void DWC_RANDOM_BYTES(uint8_t *buffer, uint32_t length) ++{ ++ get_random_bytes(buffer, length); ++} ++ ++int DWC_AES_CBC(uint8_t *message, uint32_t messagelen, uint8_t *key, uint32_t keylen, uint8_t iv[16], uint8_t *out) ++{ ++ struct crypto_blkcipher *tfm; ++ struct blkcipher_desc desc; ++ struct scatterlist sgd; ++ struct scatterlist sgs; ++ ++ tfm = crypto_alloc_blkcipher("cbc(aes)", 0, CRYPTO_ALG_ASYNC); ++ if (tfm == NULL) { ++ printk("failed to load transform for aes CBC\n"); ++ return -1; ++ } ++ ++ crypto_blkcipher_setkey(tfm, key, keylen); ++ crypto_blkcipher_set_iv(tfm, iv, 16); ++ ++ sg_init_one(&sgd, out, messagelen); ++ sg_init_one(&sgs, message, messagelen); ++ ++ desc.tfm = tfm; ++ desc.flags = 0; ++ ++ if (crypto_blkcipher_encrypt(&desc, &sgd, &sgs, messagelen)) { ++ crypto_free_blkcipher(tfm); ++ DWC_ERROR("AES CBC encryption failed"); ++ return -1; ++ } ++ ++ crypto_free_blkcipher(tfm); ++ return 0; ++} ++ ++int DWC_SHA256(uint8_t *message, uint32_t len, uint8_t *out) ++{ ++ struct crypto_hash *tfm; ++ struct hash_desc desc; ++ struct scatterlist sg; ++ ++ tfm = crypto_alloc_hash("sha256", 0, CRYPTO_ALG_ASYNC); ++ if (IS_ERR(tfm)) { ++ DWC_ERROR("Failed to load transform for sha256: %ld", PTR_ERR(tfm)); ++ return 0; ++ } ++ desc.tfm = tfm; ++ desc.flags = 0; ++ ++ sg_init_one(&sg, message, len); ++ crypto_hash_digest(&desc, &sg, len, out); ++ crypto_free_hash(tfm); ++ ++ return 1; ++} ++ ++int DWC_HMAC_SHA256(uint8_t *message, uint32_t messagelen, ++ uint8_t *key, uint32_t keylen, uint8_t *out) ++{ ++ struct crypto_hash *tfm; ++ struct hash_desc desc; ++ struct scatterlist sg; ++ ++ tfm = crypto_alloc_hash("hmac(sha256)", 0, CRYPTO_ALG_ASYNC); ++ if (IS_ERR(tfm)) { ++ DWC_ERROR("Failed to load transform for hmac(sha256): %ld", PTR_ERR(tfm)); ++ return 0; ++ } ++ desc.tfm = tfm; ++ desc.flags = 0; ++ ++ sg_init_one(&sg, message, messagelen); ++ crypto_hash_setkey(tfm, key, keylen); ++ crypto_hash_digest(&desc, &sg, messagelen, out); ++ crypto_free_hash(tfm); ++ ++ return 1; ++} ++ ++#endif /* DWC_CRYPTOLIB */ ++ ++ ++/* Byte Ordering Conversions */ ++ ++uint32_t DWC_CPU_TO_LE32(uint32_t *p) ++{ ++#ifdef __LITTLE_ENDIAN ++ return *p; ++#else ++ uint8_t *u_p = (uint8_t *)p; ++ ++ return (u_p[3] | (u_p[2] << 8) | (u_p[1] << 16) | (u_p[0] << 24)); ++#endif ++} ++ ++uint32_t DWC_CPU_TO_BE32(uint32_t *p) ++{ ++#ifdef __BIG_ENDIAN ++ return *p; ++#else ++ uint8_t *u_p = (uint8_t *)p; ++ ++ return (u_p[3] | (u_p[2] << 8) | (u_p[1] << 16) | (u_p[0] << 24)); ++#endif ++} ++ ++uint32_t DWC_LE32_TO_CPU(uint32_t *p) ++{ ++#ifdef __LITTLE_ENDIAN ++ return *p; ++#else ++ uint8_t *u_p = (uint8_t *)p; ++ ++ return (u_p[3] | (u_p[2] << 8) | (u_p[1] << 16) | (u_p[0] << 24)); ++#endif ++} ++ ++uint32_t DWC_BE32_TO_CPU(uint32_t *p) ++{ ++#ifdef __BIG_ENDIAN ++ return *p; ++#else ++ uint8_t *u_p = (uint8_t *)p; ++ ++ return (u_p[3] | (u_p[2] << 8) | (u_p[1] << 16) | (u_p[0] << 24)); ++#endif ++} ++ ++uint16_t DWC_CPU_TO_LE16(uint16_t *p) ++{ ++#ifdef __LITTLE_ENDIAN ++ return *p; ++#else ++ uint8_t *u_p = (uint8_t *)p; ++ return (u_p[1] | (u_p[0] << 8)); ++#endif ++} ++ ++uint16_t DWC_CPU_TO_BE16(uint16_t *p) ++{ ++#ifdef __BIG_ENDIAN ++ return *p; ++#else ++ uint8_t *u_p = (uint8_t *)p; ++ return (u_p[1] | (u_p[0] << 8)); ++#endif ++} ++ ++uint16_t DWC_LE16_TO_CPU(uint16_t *p) ++{ ++#ifdef __LITTLE_ENDIAN ++ return *p; ++#else ++ uint8_t *u_p = (uint8_t *)p; ++ return (u_p[1] | (u_p[0] << 8)); ++#endif ++} ++ ++uint16_t DWC_BE16_TO_CPU(uint16_t *p) ++{ ++#ifdef __BIG_ENDIAN ++ return *p; ++#else ++ uint8_t *u_p = (uint8_t *)p; ++ return (u_p[1] | (u_p[0] << 8)); ++#endif ++} ++ ++ ++/* Registers */ ++ ++uint32_t DWC_READ_REG32(void *io_ctx, uint32_t volatile *reg) ++{ ++ dwc_ioctx_t *io = (dwc_ioctx_t *)io_ctx; ++ bus_size_t ior = (bus_size_t)reg; ++ ++ return bus_space_read_4(io->iot, io->ioh, ior); ++} ++ ++#if 0 ++uint64_t DWC_READ_REG64(void *io_ctx, uint64_t volatile *reg) ++{ ++ dwc_ioctx_t *io = (dwc_ioctx_t *)io_ctx; ++ bus_size_t ior = (bus_size_t)reg; ++ ++ return bus_space_read_8(io->iot, io->ioh, ior); ++} ++#endif ++ ++void DWC_WRITE_REG32(void *io_ctx, uint32_t volatile *reg, uint32_t value) ++{ ++ dwc_ioctx_t *io = (dwc_ioctx_t *)io_ctx; ++ bus_size_t ior = (bus_size_t)reg; ++ ++ bus_space_write_4(io->iot, io->ioh, ior, value); ++} ++ ++#if 0 ++void DWC_WRITE_REG64(void *io_ctx, uint64_t volatile *reg, uint64_t value) ++{ ++ dwc_ioctx_t *io = (dwc_ioctx_t *)io_ctx; ++ bus_size_t ior = (bus_size_t)reg; ++ ++ bus_space_write_8(io->iot, io->ioh, ior, value); ++} ++#endif ++ ++void DWC_MODIFY_REG32(void *io_ctx, uint32_t volatile *reg, uint32_t clear_mask, ++ uint32_t set_mask) ++{ ++ dwc_ioctx_t *io = (dwc_ioctx_t *)io_ctx; ++ bus_size_t ior = (bus_size_t)reg; ++ ++ bus_space_write_4(io->iot, io->ioh, ior, ++ (bus_space_read_4(io->iot, io->ioh, ior) & ++ ~clear_mask) | set_mask); ++} ++ ++#if 0 ++void DWC_MODIFY_REG64(void *io_ctx, uint64_t volatile *reg, uint64_t clear_mask, ++ uint64_t set_mask) ++{ ++ dwc_ioctx_t *io = (dwc_ioctx_t *)io_ctx; ++ bus_size_t ior = (bus_size_t)reg; ++ ++ bus_space_write_8(io->iot, io->ioh, ior, ++ (bus_space_read_8(io->iot, io->ioh, ior) & ++ ~clear_mask) | set_mask); ++} ++#endif ++ ++ ++/* Locking */ ++ ++dwc_spinlock_t *DWC_SPINLOCK_ALLOC(void) ++{ ++ struct mtx *sl = DWC_ALLOC(sizeof(*sl)); ++ ++ if (!sl) { ++ DWC_ERROR("Cannot allocate memory for spinlock"); ++ return NULL; ++ } ++ ++ mtx_init(sl, "dw3spn", NULL, MTX_SPIN); ++ return (dwc_spinlock_t *)sl; ++} ++ ++void DWC_SPINLOCK_FREE(dwc_spinlock_t *lock) ++{ ++ struct mtx *sl = (struct mtx *)lock; ++ ++ mtx_destroy(sl); ++ DWC_FREE(sl); ++} ++ ++void DWC_SPINLOCK(dwc_spinlock_t *lock) ++{ ++ mtx_lock_spin((struct mtx *)lock); // ??? ++} ++ ++void DWC_SPINUNLOCK(dwc_spinlock_t *lock) ++{ ++ mtx_unlock_spin((struct mtx *)lock); // ??? ++} ++ ++void DWC_SPINLOCK_IRQSAVE(dwc_spinlock_t *lock, dwc_irqflags_t *flags) ++{ ++ mtx_lock_spin((struct mtx *)lock); ++} ++ ++void DWC_SPINUNLOCK_IRQRESTORE(dwc_spinlock_t *lock, dwc_irqflags_t flags) ++{ ++ mtx_unlock_spin((struct mtx *)lock); ++} ++ ++dwc_mutex_t *DWC_MUTEX_ALLOC(void) ++{ ++ struct mtx *m; ++ dwc_mutex_t *mutex = (dwc_mutex_t *)DWC_ALLOC(sizeof(struct mtx)); ++ ++ if (!mutex) { ++ DWC_ERROR("Cannot allocate memory for mutex"); ++ return NULL; ++ } ++ ++ m = (struct mtx *)mutex; ++ mtx_init(m, "dw3mtx", NULL, MTX_DEF); ++ return mutex; ++} ++ ++#if (defined(DWC_LINUX) && defined(CONFIG_DEBUG_MUTEXES)) ++#else ++void DWC_MUTEX_FREE(dwc_mutex_t *mutex) ++{ ++ mtx_destroy((struct mtx *)mutex); ++ DWC_FREE(mutex); ++} ++#endif ++ ++void DWC_MUTEX_LOCK(dwc_mutex_t *mutex) ++{ ++ struct mtx *m = (struct mtx *)mutex; ++ ++ mtx_lock(m); ++} ++ ++int DWC_MUTEX_TRYLOCK(dwc_mutex_t *mutex) ++{ ++ struct mtx *m = (struct mtx *)mutex; ++ ++ return mtx_trylock(m); ++} ++ ++void DWC_MUTEX_UNLOCK(dwc_mutex_t *mutex) ++{ ++ struct mtx *m = (struct mtx *)mutex; ++ ++ mtx_unlock(m); ++} ++ ++ ++/* Timing */ ++ ++void DWC_UDELAY(uint32_t usecs) ++{ ++ DELAY(usecs); ++} ++ ++void DWC_MDELAY(uint32_t msecs) ++{ ++ do { ++ DELAY(1000); ++ } while (--msecs); ++} ++ ++void DWC_MSLEEP(uint32_t msecs) ++{ ++ struct timeval tv; ++ ++ tv.tv_sec = msecs / 1000; ++ tv.tv_usec = (msecs - tv.tv_sec * 1000) * 1000; ++ pause("dw3slp", tvtohz(&tv)); ++} ++ ++uint32_t DWC_TIME(void) ++{ ++ struct timeval tv; ++ ++ microuptime(&tv); // or getmicrouptime? (less precise, but faster) ++ return tv.tv_sec * 1000 + tv.tv_usec / 1000; ++} ++ ++ ++/* Timers */ ++ ++struct dwc_timer { ++ struct callout t; ++ char *name; ++ dwc_spinlock_t *lock; ++ dwc_timer_callback_t cb; ++ void *data; ++}; ++ ++dwc_timer_t *DWC_TIMER_ALLOC(char *name, dwc_timer_callback_t cb, void *data) ++{ ++ dwc_timer_t *t = DWC_ALLOC(sizeof(*t)); ++ ++ if (!t) { ++ DWC_ERROR("Cannot allocate memory for timer"); ++ return NULL; ++ } ++ ++ callout_init(&t->t, 1); ++ ++ t->name = DWC_STRDUP(name); ++ if (!t->name) { ++ DWC_ERROR("Cannot allocate memory for timer->name"); ++ goto no_name; ++ } ++ ++ t->lock = DWC_SPINLOCK_ALLOC(); ++ if (!t->lock) { ++ DWC_ERROR("Cannot allocate memory for lock"); ++ goto no_lock; ++ } ++ ++ t->cb = cb; ++ t->data = data; ++ ++ return t; ++ ++ no_lock: ++ DWC_FREE(t->name); ++ no_name: ++ DWC_FREE(t); ++ ++ return NULL; ++} ++ ++void DWC_TIMER_FREE(dwc_timer_t *timer) ++{ ++ callout_stop(&timer->t); ++ DWC_SPINLOCK_FREE(timer->lock); ++ DWC_FREE(timer->name); ++ DWC_FREE(timer); ++} ++ ++void DWC_TIMER_SCHEDULE(dwc_timer_t *timer, uint32_t time) ++{ ++ struct timeval tv; ++ ++ tv.tv_sec = time / 1000; ++ tv.tv_usec = (time - tv.tv_sec * 1000) * 1000; ++ callout_reset(&timer->t, tvtohz(&tv), timer->cb, timer->data); ++} ++ ++void DWC_TIMER_CANCEL(dwc_timer_t *timer) ++{ ++ callout_stop(&timer->t); ++} ++ ++ ++/* Wait Queues */ ++ ++struct dwc_waitq { ++ struct mtx lock; ++ int abort; ++}; ++ ++dwc_waitq_t *DWC_WAITQ_ALLOC(void) ++{ ++ dwc_waitq_t *wq = DWC_ALLOC(sizeof(*wq)); ++ ++ if (!wq) { ++ DWC_ERROR("Cannot allocate memory for waitqueue"); ++ return NULL; ++ } ++ ++ mtx_init(&wq->lock, "dw3wtq", NULL, MTX_DEF); ++ wq->abort = 0; ++ ++ return wq; ++} ++ ++void DWC_WAITQ_FREE(dwc_waitq_t *wq) ++{ ++ mtx_destroy(&wq->lock); ++ DWC_FREE(wq); ++} ++ ++int32_t DWC_WAITQ_WAIT(dwc_waitq_t *wq, dwc_waitq_condition_t cond, void *data) ++{ ++// intrmask_t ipl; ++ int result = 0; ++ ++ mtx_lock(&wq->lock); ++// ipl = splbio(); ++ ++ /* Skip the sleep if already aborted or triggered */ ++ if (!wq->abort && !cond(data)) { ++// splx(ipl); ++ result = msleep(wq, &wq->lock, PCATCH, "dw3wat", 0); // infinite timeout ++// ipl = splbio(); ++ } ++ ++ if (result == ERESTART) { // signaled - restart ++ result = -DWC_E_RESTART; ++ ++ } else if (result == EINTR) { // signaled - interrupt ++ result = -DWC_E_ABORT; ++ ++ } else if (wq->abort) { ++ result = -DWC_E_ABORT; ++ ++ } else { ++ result = 0; ++ } ++ ++ wq->abort = 0; ++// splx(ipl); ++ mtx_unlock(&wq->lock); ++ return result; ++} ++ ++int32_t DWC_WAITQ_WAIT_TIMEOUT(dwc_waitq_t *wq, dwc_waitq_condition_t cond, ++ void *data, int32_t msecs) ++{ ++ struct timeval tv, tv1, tv2; ++// intrmask_t ipl; ++ int result = 0; ++ ++ tv.tv_sec = msecs / 1000; ++ tv.tv_usec = (msecs - tv.tv_sec * 1000) * 1000; ++ ++ mtx_lock(&wq->lock); ++// ipl = splbio(); ++ ++ /* Skip the sleep if already aborted or triggered */ ++ if (!wq->abort && !cond(data)) { ++// splx(ipl); ++ getmicrouptime(&tv1); ++ result = msleep(wq, &wq->lock, PCATCH, "dw3wto", tvtohz(&tv)); ++ getmicrouptime(&tv2); ++// ipl = splbio(); ++ } ++ ++ if (result == 0) { // awoken ++ if (wq->abort) { ++ result = -DWC_E_ABORT; ++ } else { ++ tv2.tv_usec -= tv1.tv_usec; ++ if (tv2.tv_usec < 0) { ++ tv2.tv_usec += 1000000; ++ tv2.tv_sec--; ++ } ++ ++ tv2.tv_sec -= tv1.tv_sec; ++ result = tv2.tv_sec * 1000 + tv2.tv_usec / 1000; ++ result = msecs - result; ++ if (result <= 0) ++ result = 1; ++ } ++ } else if (result == ERESTART) { // signaled - restart ++ result = -DWC_E_RESTART; ++ ++ } else if (result == EINTR) { // signaled - interrupt ++ result = -DWC_E_ABORT; ++ ++ } else { // timed out ++ result = -DWC_E_TIMEOUT; ++ } ++ ++ wq->abort = 0; ++// splx(ipl); ++ mtx_unlock(&wq->lock); ++ return result; ++} ++ ++void DWC_WAITQ_TRIGGER(dwc_waitq_t *wq) ++{ ++ wakeup(wq); ++} ++ ++void DWC_WAITQ_ABORT(dwc_waitq_t *wq) ++{ ++// intrmask_t ipl; ++ ++ mtx_lock(&wq->lock); ++// ipl = splbio(); ++ wq->abort = 1; ++ wakeup(wq); ++// splx(ipl); ++ mtx_unlock(&wq->lock); ++} ++ ++ ++/* Threading */ ++ ++struct dwc_thread { ++ struct proc *proc; ++ int abort; ++}; ++ ++dwc_thread_t *DWC_THREAD_RUN(dwc_thread_function_t func, char *name, void *data) ++{ ++ int retval; ++ dwc_thread_t *thread = DWC_ALLOC(sizeof(*thread)); ++ ++ if (!thread) { ++ return NULL; ++ } ++ ++ thread->abort = 0; ++ retval = kthread_create((void (*)(void *))func, data, &thread->proc, ++ RFPROC | RFNOWAIT, 0, "%s", name); ++ if (retval) { ++ DWC_FREE(thread); ++ return NULL; ++ } ++ ++ return thread; ++} ++ ++int DWC_THREAD_STOP(dwc_thread_t *thread) ++{ ++ int retval; ++ ++ thread->abort = 1; ++ retval = tsleep(&thread->abort, 0, "dw3stp", 60 * hz); ++ ++ if (retval == 0) { ++ /* DWC_THREAD_EXIT() will free the thread struct */ ++ return 0; ++ } ++ ++ /* NOTE: We leak the thread struct if thread doesn't die */ ++ ++ if (retval == EWOULDBLOCK) { ++ return -DWC_E_TIMEOUT; ++ } ++ ++ return -DWC_E_UNKNOWN; ++} ++ ++dwc_bool_t DWC_THREAD_SHOULD_STOP(dwc_thread_t *thread) ++{ ++ return thread->abort; ++} ++ ++void DWC_THREAD_EXIT(dwc_thread_t *thread) ++{ ++ wakeup(&thread->abort); ++ DWC_FREE(thread); ++ kthread_exit(0); ++} ++ ++ ++/* tasklets ++ - Runs in interrupt context (cannot sleep) ++ - Each tasklet runs on a single CPU [ How can we ensure this on FreeBSD? Does it matter? ] ++ - Different tasklets can be running simultaneously on different CPUs [ shouldn't matter ] ++ */ ++struct dwc_tasklet { ++ struct task t; ++ dwc_tasklet_callback_t cb; ++ void *data; ++}; ++ ++static void tasklet_callback(void *data, int pending) // what to do with pending ??? ++{ ++ dwc_tasklet_t *task = (dwc_tasklet_t *)data; ++ ++ task->cb(task->data); ++} ++ ++dwc_tasklet_t *DWC_TASK_ALLOC(char *name, dwc_tasklet_callback_t cb, void *data) ++{ ++ dwc_tasklet_t *task = DWC_ALLOC(sizeof(*task)); ++ ++ if (task) { ++ task->cb = cb; ++ task->data = data; ++ TASK_INIT(&task->t, 0, tasklet_callback, task); ++ } else { ++ DWC_ERROR("Cannot allocate memory for tasklet"); ++ } ++ ++ return task; ++} ++ ++void DWC_TASK_FREE(dwc_tasklet_t *task) ++{ ++ taskqueue_drain(taskqueue_fast, &task->t); // ??? ++ DWC_FREE(task); ++} ++ ++void DWC_TASK_SCHEDULE(dwc_tasklet_t *task) ++{ ++ /* Uses predefined system queue */ ++ taskqueue_enqueue_fast(taskqueue_fast, &task->t); ++} ++ ++ ++/* workqueues ++ - Runs in process context (can sleep) ++ */ ++typedef struct work_container { ++ dwc_work_callback_t cb; ++ void *data; ++ dwc_workq_t *wq; ++ char *name; ++ int hz; ++ ++#ifdef DEBUG ++ DWC_CIRCLEQ_ENTRY(work_container) entry; ++#endif ++ struct task task; ++} work_container_t; ++ ++#ifdef DEBUG ++DWC_CIRCLEQ_HEAD(work_container_queue, work_container); ++#endif ++ ++struct dwc_workq { ++ struct taskqueue *taskq; ++ dwc_spinlock_t *lock; ++ dwc_waitq_t *waitq; ++ int pending; ++ ++#ifdef DEBUG ++ struct work_container_queue entries; ++#endif ++}; ++ ++static void do_work(void *data, int pending) // what to do with pending ??? ++{ ++ work_container_t *container = (work_container_t *)data; ++ dwc_workq_t *wq = container->wq; ++ dwc_irqflags_t flags; ++ ++ if (container->hz) { ++ pause("dw3wrk", container->hz); ++ } ++ ++ container->cb(container->data); ++ DWC_DEBUG("Work done: %s, container=%p", container->name, container); ++ ++ DWC_SPINLOCK_IRQSAVE(wq->lock, &flags); ++ ++#ifdef DEBUG ++ DWC_CIRCLEQ_REMOVE(&wq->entries, container, entry); ++#endif ++ if (container->name) ++ DWC_FREE(container->name); ++ DWC_FREE(container); ++ wq->pending--; ++ DWC_SPINUNLOCK_IRQRESTORE(wq->lock, flags); ++ DWC_WAITQ_TRIGGER(wq->waitq); ++} ++ ++static int work_done(void *data) ++{ ++ dwc_workq_t *workq = (dwc_workq_t *)data; ++ ++ return workq->pending == 0; ++} ++ ++int DWC_WORKQ_WAIT_WORK_DONE(dwc_workq_t *workq, int timeout) ++{ ++ return DWC_WAITQ_WAIT_TIMEOUT(workq->waitq, work_done, workq, timeout); ++} ++ ++dwc_workq_t *DWC_WORKQ_ALLOC(char *name) ++{ ++ dwc_workq_t *wq = DWC_ALLOC(sizeof(*wq)); ++ ++ if (!wq) { ++ DWC_ERROR("Cannot allocate memory for workqueue"); ++ return NULL; ++ } ++ ++ wq->taskq = taskqueue_create(name, M_NOWAIT, taskqueue_thread_enqueue, &wq->taskq); ++ if (!wq->taskq) { ++ DWC_ERROR("Cannot allocate memory for taskqueue"); ++ goto no_taskq; ++ } ++ ++ wq->pending = 0; ++ ++ wq->lock = DWC_SPINLOCK_ALLOC(); ++ if (!wq->lock) { ++ DWC_ERROR("Cannot allocate memory for spinlock"); ++ goto no_lock; ++ } ++ ++ wq->waitq = DWC_WAITQ_ALLOC(); ++ if (!wq->waitq) { ++ DWC_ERROR("Cannot allocate memory for waitqueue"); ++ goto no_waitq; ++ } ++ ++ taskqueue_start_threads(&wq->taskq, 1, PWAIT, "%s taskq", "dw3tsk"); ++ ++#ifdef DEBUG ++ DWC_CIRCLEQ_INIT(&wq->entries); ++#endif ++ return wq; ++ ++ no_waitq: ++ DWC_SPINLOCK_FREE(wq->lock); ++ no_lock: ++ taskqueue_free(wq->taskq); ++ no_taskq: ++ DWC_FREE(wq); ++ ++ return NULL; ++} ++ ++void DWC_WORKQ_FREE(dwc_workq_t *wq) ++{ ++#ifdef DEBUG ++ dwc_irqflags_t flags; ++ ++ DWC_SPINLOCK_IRQSAVE(wq->lock, &flags); ++ ++ if (wq->pending != 0) { ++ struct work_container *container; ++ ++ DWC_ERROR("Destroying work queue with pending work"); ++ ++ DWC_CIRCLEQ_FOREACH(container, &wq->entries, entry) { ++ DWC_ERROR("Work %s still pending", container->name); ++ } ++ } ++ ++ DWC_SPINUNLOCK_IRQRESTORE(wq->lock, flags); ++#endif ++ DWC_WAITQ_FREE(wq->waitq); ++ DWC_SPINLOCK_FREE(wq->lock); ++ taskqueue_free(wq->taskq); ++ DWC_FREE(wq); ++} ++ ++void DWC_WORKQ_SCHEDULE(dwc_workq_t *wq, dwc_work_callback_t cb, void *data, ++ char *format, ...) ++{ ++ dwc_irqflags_t flags; ++ work_container_t *container; ++ static char name[128]; ++ va_list args; ++ ++ va_start(args, format); ++ DWC_VSNPRINTF(name, 128, format, args); ++ va_end(args); ++ ++ DWC_SPINLOCK_IRQSAVE(wq->lock, &flags); ++ wq->pending++; ++ DWC_SPINUNLOCK_IRQRESTORE(wq->lock, flags); ++ DWC_WAITQ_TRIGGER(wq->waitq); ++ ++ container = DWC_ALLOC_ATOMIC(sizeof(*container)); ++ if (!container) { ++ DWC_ERROR("Cannot allocate memory for container"); ++ return; ++ } ++ ++ container->name = DWC_STRDUP(name); ++ if (!container->name) { ++ DWC_ERROR("Cannot allocate memory for container->name"); ++ DWC_FREE(container); ++ return; ++ } ++ ++ container->cb = cb; ++ container->data = data; ++ container->wq = wq; ++ container->hz = 0; ++ ++ DWC_DEBUG("Queueing work: %s, container=%p", container->name, container); ++ ++ TASK_INIT(&container->task, 0, do_work, container); ++ ++#ifdef DEBUG ++ DWC_CIRCLEQ_INSERT_TAIL(&wq->entries, container, entry); ++#endif ++ taskqueue_enqueue_fast(wq->taskq, &container->task); ++} ++ ++void DWC_WORKQ_SCHEDULE_DELAYED(dwc_workq_t *wq, dwc_work_callback_t cb, ++ void *data, uint32_t time, char *format, ...) ++{ ++ dwc_irqflags_t flags; ++ work_container_t *container; ++ static char name[128]; ++ struct timeval tv; ++ va_list args; ++ ++ va_start(args, format); ++ DWC_VSNPRINTF(name, 128, format, args); ++ va_end(args); ++ ++ DWC_SPINLOCK_IRQSAVE(wq->lock, &flags); ++ wq->pending++; ++ DWC_SPINUNLOCK_IRQRESTORE(wq->lock, flags); ++ DWC_WAITQ_TRIGGER(wq->waitq); ++ ++ container = DWC_ALLOC_ATOMIC(sizeof(*container)); ++ if (!container) { ++ DWC_ERROR("Cannot allocate memory for container"); ++ return; ++ } ++ ++ container->name = DWC_STRDUP(name); ++ if (!container->name) { ++ DWC_ERROR("Cannot allocate memory for container->name"); ++ DWC_FREE(container); ++ return; ++ } ++ ++ container->cb = cb; ++ container->data = data; ++ container->wq = wq; ++ ++ tv.tv_sec = time / 1000; ++ tv.tv_usec = (time - tv.tv_sec * 1000) * 1000; ++ container->hz = tvtohz(&tv); ++ ++ DWC_DEBUG("Queueing work: %s, container=%p", container->name, container); ++ ++ TASK_INIT(&container->task, 0, do_work, container); ++ ++#ifdef DEBUG ++ DWC_CIRCLEQ_INSERT_TAIL(&wq->entries, container, entry); ++#endif ++ taskqueue_enqueue_fast(wq->taskq, &container->task); ++} ++ ++int DWC_WORKQ_PENDING(dwc_workq_t *wq) ++{ ++ return wq->pending; ++} +diff --git a/drivers/usb/host/dwc_common_port/dwc_common_linux.c b/drivers/usb/host/dwc_common_port/dwc_common_linux.c +new file mode 100644 +index 0000000..4664684 +--- /dev/null ++++ b/drivers/usb/host/dwc_common_port/dwc_common_linux.c +@@ -0,0 +1,1433 @@ ++#include <linux/kernel.h> ++#include <linux/init.h> ++#include <linux/module.h> ++#include <linux/kthread.h> ++ ++#ifdef DWC_CCLIB ++# include "dwc_cc.h" ++#endif ++ ++#ifdef DWC_CRYPTOLIB ++# include "dwc_modpow.h" ++# include "dwc_dh.h" ++# include "dwc_crypto.h" ++#endif ++ ++#ifdef DWC_NOTIFYLIB ++# include "dwc_notifier.h" ++#endif ++ ++/* OS-Level Implementations */ ++ ++/* This is the Linux kernel implementation of the DWC platform library. */ ++#include <linux/moduleparam.h> ++#include <linux/ctype.h> ++#include <linux/crypto.h> ++#include <linux/delay.h> ++#include <linux/device.h> ++#include <linux/dma-mapping.h> ++#include <linux/cdev.h> ++#include <linux/errno.h> ++#include <linux/interrupt.h> ++#include <linux/jiffies.h> ++#include <linux/list.h> ++#include <linux/pci.h> ++#include <linux/random.h> ++#include <linux/scatterlist.h> ++#include <linux/slab.h> ++#include <linux/stat.h> ++#include <linux/string.h> ++#include <linux/timer.h> ++#include <linux/usb.h> ++ ++#include <linux/version.h> ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24) ++# include <linux/usb/gadget.h> ++#else ++# include <linux/usb_gadget.h> ++#endif ++ ++#include <asm/io.h> ++#include <asm/page.h> ++#include <asm/uaccess.h> ++#include <asm/unaligned.h> ++ ++#include "dwc_os.h" ++#include "dwc_list.h" ++ ++ ++/* MISC */ ++ ++void *DWC_MEMSET(void *dest, uint8_t byte, uint32_t size) ++{ ++ return memset(dest, byte, size); ++} ++ ++void *DWC_MEMCPY(void *dest, void const *src, uint32_t size) ++{ ++ return memcpy(dest, src, size); ++} ++ ++void *DWC_MEMMOVE(void *dest, void *src, uint32_t size) ++{ ++ return memmove(dest, src, size); ++} ++ ++int DWC_MEMCMP(void *m1, void *m2, uint32_t size) ++{ ++ return memcmp(m1, m2, size); ++} ++ ++int DWC_STRNCMP(void *s1, void *s2, uint32_t size) ++{ ++ return strncmp(s1, s2, size); ++} ++ ++int DWC_STRCMP(void *s1, void *s2) ++{ ++ return strcmp(s1, s2); ++} ++ ++int DWC_STRLEN(char const *str) ++{ ++ return strlen(str); ++} ++ ++char *DWC_STRCPY(char *to, char const *from) ++{ ++ return strcpy(to, from); ++} ++ ++char *DWC_STRDUP(char const *str) ++{ ++ int len = DWC_STRLEN(str) + 1; ++ char *new = DWC_ALLOC_ATOMIC(len); ++ ++ if (!new) { ++ return NULL; ++ } ++ ++ DWC_MEMCPY(new, str, len); ++ return new; ++} ++ ++int DWC_ATOI(const char *str, int32_t *value) ++{ ++ char *end = NULL; ++ ++ *value = simple_strtol(str, &end, 0); ++ if (*end == '\0') { ++ return 0; ++ } ++ ++ return -1; ++} ++ ++int DWC_ATOUI(const char *str, uint32_t *value) ++{ ++ char *end = NULL; ++ ++ *value = simple_strtoul(str, &end, 0); ++ if (*end == '\0') { ++ return 0; ++ } ++ ++ return -1; ++} ++ ++ ++#ifdef DWC_UTFLIB ++/* From usbstring.c */ ++ ++int DWC_UTF8_TO_UTF16LE(uint8_t const *s, uint16_t *cp, unsigned len) ++{ ++ int count = 0; ++ u8 c; ++ u16 uchar; ++ ++ /* this insists on correct encodings, though not minimal ones. ++ * BUT it currently rejects legit 4-byte UTF-8 code points, ++ * which need surrogate pairs. (Unicode 3.1 can use them.) ++ */ ++ while (len != 0 && (c = (u8) *s++) != 0) { ++ if (unlikely(c & 0x80)) { ++ // 2-byte sequence: ++ // 00000yyyyyxxxxxx = 110yyyyy 10xxxxxx ++ if ((c & 0xe0) == 0xc0) { ++ uchar = (c & 0x1f) << 6; ++ ++ c = (u8) *s++; ++ if ((c & 0xc0) != 0xc0) ++ goto fail; ++ c &= 0x3f; ++ uchar |= c; ++ ++ // 3-byte sequence (most CJKV characters): ++ // zzzzyyyyyyxxxxxx = 1110zzzz 10yyyyyy 10xxxxxx ++ } else if ((c & 0xf0) == 0xe0) { ++ uchar = (c & 0x0f) << 12; ++ ++ c = (u8) *s++; ++ if ((c & 0xc0) != 0xc0) ++ goto fail; ++ c &= 0x3f; ++ uchar |= c << 6; ++ ++ c = (u8) *s++; ++ if ((c & 0xc0) != 0xc0) ++ goto fail; ++ c &= 0x3f; ++ uchar |= c; ++ ++ /* no bogus surrogates */ ++ if (0xd800 <= uchar && uchar <= 0xdfff) ++ goto fail; ++ ++ // 4-byte sequence (surrogate pairs, currently rare): ++ // 11101110wwwwzzzzyy + 110111yyyyxxxxxx ++ // = 11110uuu 10uuzzzz 10yyyyyy 10xxxxxx ++ // (uuuuu = wwww + 1) ++ // FIXME accept the surrogate code points (only) ++ } else ++ goto fail; ++ } else ++ uchar = c; ++ put_unaligned (cpu_to_le16 (uchar), cp++); ++ count++; ++ len--; ++ } ++ return count; ++fail: ++ return -1; ++} ++#endif /* DWC_UTFLIB */ ++ ++ ++/* dwc_debug.h */ ++ ++dwc_bool_t DWC_IN_IRQ(void) ++{ ++ return in_irq(); ++} ++ ++dwc_bool_t DWC_IN_BH(void) ++{ ++ return in_softirq(); ++} ++ ++void DWC_VPRINTF(char *format, va_list args) ++{ ++ vprintk(format, args); ++} ++ ++int DWC_VSNPRINTF(char *str, int size, char *format, va_list args) ++{ ++ return vsnprintf(str, size, format, args); ++} ++ ++void DWC_PRINTF(char *format, ...) ++{ ++ va_list args; ++ ++ va_start(args, format); ++ DWC_VPRINTF(format, args); ++ va_end(args); ++} ++ ++int DWC_SPRINTF(char *buffer, char *format, ...) ++{ ++ int retval; ++ va_list args; ++ ++ va_start(args, format); ++ retval = vsprintf(buffer, format, args); ++ va_end(args); ++ return retval; ++} ++ ++int DWC_SNPRINTF(char *buffer, int size, char *format, ...) ++{ ++ int retval; ++ va_list args; ++ ++ va_start(args, format); ++ retval = vsnprintf(buffer, size, format, args); ++ va_end(args); ++ return retval; ++} ++ ++void __DWC_WARN(char *format, ...) ++{ ++ va_list args; ++ ++ va_start(args, format); ++ DWC_PRINTF(KERN_WARNING); ++ DWC_VPRINTF(format, args); ++ va_end(args); ++} ++ ++void __DWC_ERROR(char *format, ...) ++{ ++ va_list args; ++ ++ va_start(args, format); ++ DWC_PRINTF(KERN_ERR); ++ DWC_VPRINTF(format, args); ++ va_end(args); ++} ++ ++void DWC_EXCEPTION(char *format, ...) ++{ ++ va_list args; ++ ++ va_start(args, format); ++ DWC_PRINTF(KERN_ERR); ++ DWC_VPRINTF(format, args); ++ va_end(args); ++ BUG_ON(1); ++} ++ ++#ifdef DEBUG ++void __DWC_DEBUG(char *format, ...) ++{ ++ va_list args; ++ ++ va_start(args, format); ++ DWC_PRINTF(KERN_DEBUG); ++ DWC_VPRINTF(format, args); ++ va_end(args); ++} ++#endif ++ ++ ++/* dwc_mem.h */ ++ ++#if 0 ++dwc_pool_t *DWC_DMA_POOL_CREATE(uint32_t size, ++ uint32_t align, ++ uint32_t alloc) ++{ ++ struct dma_pool *pool = dma_pool_create("Pool", NULL, ++ size, align, alloc); ++ return (dwc_pool_t *)pool; ++} ++ ++void DWC_DMA_POOL_DESTROY(dwc_pool_t *pool) ++{ ++ dma_pool_destroy((struct dma_pool *)pool); ++} ++ ++void *DWC_DMA_POOL_ALLOC(dwc_pool_t *pool, uint64_t *dma_addr) ++{ ++ return dma_pool_alloc((struct dma_pool *)pool, GFP_KERNEL, dma_addr); ++} ++ ++void *DWC_DMA_POOL_ZALLOC(dwc_pool_t *pool, uint64_t *dma_addr) ++{ ++ void *vaddr = DWC_DMA_POOL_ALLOC(pool, dma_addr); ++ memset(..); ++} ++ ++void DWC_DMA_POOL_FREE(dwc_pool_t *pool, void *vaddr, void *daddr) ++{ ++ dma_pool_free(pool, vaddr, daddr); ++} ++#endif ++ ++void *__DWC_DMA_ALLOC(void *dma_ctx, uint32_t size, dwc_dma_t *dma_addr) ++{ ++#ifdef xxCOSIM /* Only works for 32-bit cosim */ ++ void *buf = dma_alloc_coherent(dma_ctx, (size_t)size, dma_addr, GFP_KERNEL); ++#else ++ void *buf = dma_alloc_coherent(dma_ctx, (size_t)size, dma_addr, GFP_KERNEL | GFP_DMA32); ++#endif ++ if (!buf) { ++ return NULL; ++ } ++ ++ memset(buf, 0, (size_t)size); ++ return buf; ++} ++ ++void *__DWC_DMA_ALLOC_ATOMIC(void *dma_ctx, uint32_t size, dwc_dma_t *dma_addr) ++{ ++ void *buf = dma_alloc_coherent(NULL, (size_t)size, dma_addr, GFP_ATOMIC); ++ if (!buf) { ++ return NULL; ++ } ++ memset(buf, 0, (size_t)size); ++ return buf; ++} ++ ++void __DWC_DMA_FREE(void *dma_ctx, uint32_t size, void *virt_addr, dwc_dma_t dma_addr) ++{ ++ dma_free_coherent(dma_ctx, size, virt_addr, dma_addr); ++} ++ ++void *__DWC_ALLOC(void *mem_ctx, uint32_t size) ++{ ++ return kzalloc(size, GFP_KERNEL); ++} ++ ++void *__DWC_ALLOC_ATOMIC(void *mem_ctx, uint32_t size) ++{ ++ return kzalloc(size, GFP_ATOMIC); ++} ++ ++void __DWC_FREE(void *mem_ctx, void *addr) ++{ ++ kfree(addr); ++} ++ ++ ++#ifdef DWC_CRYPTOLIB ++/* dwc_crypto.h */ ++ ++void DWC_RANDOM_BYTES(uint8_t *buffer, uint32_t length) ++{ ++ get_random_bytes(buffer, length); ++} ++ ++int DWC_AES_CBC(uint8_t *message, uint32_t messagelen, uint8_t *key, uint32_t keylen, uint8_t iv[16], uint8_t *out) ++{ ++ struct crypto_blkcipher *tfm; ++ struct blkcipher_desc desc; ++ struct scatterlist sgd; ++ struct scatterlist sgs; ++ ++ tfm = crypto_alloc_blkcipher("cbc(aes)", 0, CRYPTO_ALG_ASYNC); ++ if (tfm == NULL) { ++ printk("failed to load transform for aes CBC\n"); ++ return -1; ++ } ++ ++ crypto_blkcipher_setkey(tfm, key, keylen); ++ crypto_blkcipher_set_iv(tfm, iv, 16); ++ ++ sg_init_one(&sgd, out, messagelen); ++ sg_init_one(&sgs, message, messagelen); ++ ++ desc.tfm = tfm; ++ desc.flags = 0; ++ ++ if (crypto_blkcipher_encrypt(&desc, &sgd, &sgs, messagelen)) { ++ crypto_free_blkcipher(tfm); ++ DWC_ERROR("AES CBC encryption failed"); ++ return -1; ++ } ++ ++ crypto_free_blkcipher(tfm); ++ return 0; ++} ++ ++int DWC_SHA256(uint8_t *message, uint32_t len, uint8_t *out) ++{ ++ struct crypto_hash *tfm; ++ struct hash_desc desc; ++ struct scatterlist sg; ++ ++ tfm = crypto_alloc_hash("sha256", 0, CRYPTO_ALG_ASYNC); ++ if (IS_ERR(tfm)) { ++ DWC_ERROR("Failed to load transform for sha256: %ld\n", PTR_ERR(tfm)); ++ return 0; ++ } ++ desc.tfm = tfm; ++ desc.flags = 0; ++ ++ sg_init_one(&sg, message, len); ++ crypto_hash_digest(&desc, &sg, len, out); ++ crypto_free_hash(tfm); ++ ++ return 1; ++} ++ ++int DWC_HMAC_SHA256(uint8_t *message, uint32_t messagelen, ++ uint8_t *key, uint32_t keylen, uint8_t *out) ++{ ++ struct crypto_hash *tfm; ++ struct hash_desc desc; ++ struct scatterlist sg; ++ ++ tfm = crypto_alloc_hash("hmac(sha256)", 0, CRYPTO_ALG_ASYNC); ++ if (IS_ERR(tfm)) { ++ DWC_ERROR("Failed to load transform for hmac(sha256): %ld\n", PTR_ERR(tfm)); ++ return 0; ++ } ++ desc.tfm = tfm; ++ desc.flags = 0; ++ ++ sg_init_one(&sg, message, messagelen); ++ crypto_hash_setkey(tfm, key, keylen); ++ crypto_hash_digest(&desc, &sg, messagelen, out); ++ crypto_free_hash(tfm); ++ ++ return 1; ++} ++#endif /* DWC_CRYPTOLIB */ ++ ++ ++/* Byte Ordering Conversions */ ++ ++uint32_t DWC_CPU_TO_LE32(uint32_t *p) ++{ ++#ifdef __LITTLE_ENDIAN ++ return *p; ++#else ++ uint8_t *u_p = (uint8_t *)p; ++ ++ return (u_p[3] | (u_p[2] << 8) | (u_p[1] << 16) | (u_p[0] << 24)); ++#endif ++} ++ ++uint32_t DWC_CPU_TO_BE32(uint32_t *p) ++{ ++#ifdef __BIG_ENDIAN ++ return *p; ++#else ++ uint8_t *u_p = (uint8_t *)p; ++ ++ return (u_p[3] | (u_p[2] << 8) | (u_p[1] << 16) | (u_p[0] << 24)); ++#endif ++} ++ ++uint32_t DWC_LE32_TO_CPU(uint32_t *p) ++{ ++#ifdef __LITTLE_ENDIAN ++ return *p; ++#else ++ uint8_t *u_p = (uint8_t *)p; ++ ++ return (u_p[3] | (u_p[2] << 8) | (u_p[1] << 16) | (u_p[0] << 24)); ++#endif ++} ++ ++uint32_t DWC_BE32_TO_CPU(uint32_t *p) ++{ ++#ifdef __BIG_ENDIAN ++ return *p; ++#else ++ uint8_t *u_p = (uint8_t *)p; ++ ++ return (u_p[3] | (u_p[2] << 8) | (u_p[1] << 16) | (u_p[0] << 24)); ++#endif ++} ++ ++uint16_t DWC_CPU_TO_LE16(uint16_t *p) ++{ ++#ifdef __LITTLE_ENDIAN ++ return *p; ++#else ++ uint8_t *u_p = (uint8_t *)p; ++ return (u_p[1] | (u_p[0] << 8)); ++#endif ++} ++ ++uint16_t DWC_CPU_TO_BE16(uint16_t *p) ++{ ++#ifdef __BIG_ENDIAN ++ return *p; ++#else ++ uint8_t *u_p = (uint8_t *)p; ++ return (u_p[1] | (u_p[0] << 8)); ++#endif ++} ++ ++uint16_t DWC_LE16_TO_CPU(uint16_t *p) ++{ ++#ifdef __LITTLE_ENDIAN ++ return *p; ++#else ++ uint8_t *u_p = (uint8_t *)p; ++ return (u_p[1] | (u_p[0] << 8)); ++#endif ++} ++ ++uint16_t DWC_BE16_TO_CPU(uint16_t *p) ++{ ++#ifdef __BIG_ENDIAN ++ return *p; ++#else ++ uint8_t *u_p = (uint8_t *)p; ++ return (u_p[1] | (u_p[0] << 8)); ++#endif ++} ++ ++ ++/* Registers */ ++ ++uint32_t DWC_READ_REG32(uint32_t volatile *reg) ++{ ++ return readl(reg); ++} ++ ++#if 0 ++uint64_t DWC_READ_REG64(uint64_t volatile *reg) ++{ ++} ++#endif ++ ++void DWC_WRITE_REG32(uint32_t volatile *reg, uint32_t value) ++{ ++ writel(value, reg); ++} ++ ++#if 0 ++void DWC_WRITE_REG64(uint64_t volatile *reg, uint64_t value) ++{ ++} ++#endif ++ ++void DWC_MODIFY_REG32(uint32_t volatile *reg, uint32_t clear_mask, uint32_t set_mask) ++{ ++ writel((readl(reg) & ~clear_mask) | set_mask, reg); ++} ++ ++#if 0 ++void DWC_MODIFY_REG64(uint64_t volatile *reg, uint64_t clear_mask, uint64_t set_mask) ++{ ++} ++#endif ++ ++ ++/* Locking */ ++ ++dwc_spinlock_t *DWC_SPINLOCK_ALLOC(void) ++{ ++ spinlock_t *sl = (spinlock_t *)1; ++ ++#if defined(CONFIG_PREEMPT) || defined(CONFIG_SMP) ++ sl = DWC_ALLOC(sizeof(*sl)); ++ if (!sl) { ++ DWC_ERROR("Cannot allocate memory for spinlock\n"); ++ return NULL; ++ } ++ ++ spin_lock_init(sl); ++#endif ++ return (dwc_spinlock_t *)sl; ++} ++ ++void DWC_SPINLOCK_FREE(dwc_spinlock_t *lock) ++{ ++#if defined(CONFIG_PREEMPT) || defined(CONFIG_SMP) ++ DWC_FREE(lock); ++#endif ++} ++ ++void DWC_SPINLOCK(dwc_spinlock_t *lock) ++{ ++#if defined(CONFIG_PREEMPT) || defined(CONFIG_SMP) ++ spin_lock((spinlock_t *)lock); ++#endif ++} ++ ++void DWC_SPINUNLOCK(dwc_spinlock_t *lock) ++{ ++#if defined(CONFIG_PREEMPT) || defined(CONFIG_SMP) ++ spin_unlock((spinlock_t *)lock); ++#endif ++} ++ ++void DWC_SPINLOCK_IRQSAVE(dwc_spinlock_t *lock, dwc_irqflags_t *flags) ++{ ++ dwc_irqflags_t f; ++ ++#if defined(CONFIG_PREEMPT) || defined(CONFIG_SMP) ++ spin_lock_irqsave((spinlock_t *)lock, f); ++#else ++ local_irq_save(f); ++#endif ++ *flags = f; ++} ++ ++void DWC_SPINUNLOCK_IRQRESTORE(dwc_spinlock_t *lock, dwc_irqflags_t flags) ++{ ++#if defined(CONFIG_PREEMPT) || defined(CONFIG_SMP) ++ spin_unlock_irqrestore((spinlock_t *)lock, flags); ++#else ++ local_irq_restore(flags); ++#endif ++} ++ ++dwc_mutex_t *DWC_MUTEX_ALLOC(void) ++{ ++ struct mutex *m; ++ dwc_mutex_t *mutex = (dwc_mutex_t *)DWC_ALLOC(sizeof(struct mutex)); ++ ++ if (!mutex) { ++ DWC_ERROR("Cannot allocate memory for mutex\n"); ++ return NULL; ++ } ++ ++ m = (struct mutex *)mutex; ++ mutex_init(m); ++ return mutex; ++} ++ ++#if (defined(DWC_LINUX) && defined(CONFIG_DEBUG_MUTEXES)) ++#else ++void DWC_MUTEX_FREE(dwc_mutex_t *mutex) ++{ ++ mutex_destroy((struct mutex *)mutex); ++ DWC_FREE(mutex); ++} ++#endif ++ ++void DWC_MUTEX_LOCK(dwc_mutex_t *mutex) ++{ ++ struct mutex *m = (struct mutex *)mutex; ++ mutex_lock(m); ++} ++ ++int DWC_MUTEX_TRYLOCK(dwc_mutex_t *mutex) ++{ ++ struct mutex *m = (struct mutex *)mutex; ++ return mutex_trylock(m); ++} ++ ++void DWC_MUTEX_UNLOCK(dwc_mutex_t *mutex) ++{ ++ struct mutex *m = (struct mutex *)mutex; ++ mutex_unlock(m); ++} ++ ++ ++/* Timing */ ++ ++void DWC_UDELAY(uint32_t usecs) ++{ ++ udelay(usecs); ++} ++ ++void DWC_MDELAY(uint32_t msecs) ++{ ++ mdelay(msecs); ++} ++ ++void DWC_MSLEEP(uint32_t msecs) ++{ ++ msleep(msecs); ++} ++ ++uint32_t DWC_TIME(void) ++{ ++ return jiffies_to_msecs(jiffies); ++} ++ ++ ++/* Timers */ ++ ++struct dwc_timer { ++ struct timer_list *t; ++ char *name; ++ dwc_timer_callback_t cb; ++ void *data; ++ uint8_t scheduled; ++ dwc_spinlock_t *lock; ++}; ++ ++static void timer_callback(unsigned long data) ++{ ++ dwc_timer_t *timer = (dwc_timer_t *)data; ++ dwc_irqflags_t flags; ++ ++ DWC_SPINLOCK_IRQSAVE(timer->lock, &flags); ++ timer->scheduled = 0; ++ DWC_SPINUNLOCK_IRQRESTORE(timer->lock, flags); ++ DWC_DEBUGC("Timer %s callback", timer->name); ++ timer->cb(timer->data); ++} ++ ++dwc_timer_t *DWC_TIMER_ALLOC(char *name, dwc_timer_callback_t cb, void *data) ++{ ++ dwc_timer_t *t = DWC_ALLOC(sizeof(*t)); ++ ++ if (!t) { ++ DWC_ERROR("Cannot allocate memory for timer"); ++ return NULL; ++ } ++ ++ t->t = DWC_ALLOC(sizeof(*t->t)); ++ if (!t->t) { ++ DWC_ERROR("Cannot allocate memory for timer->t"); ++ goto no_timer; ++ } ++ ++ t->name = DWC_STRDUP(name); ++ if (!t->name) { ++ DWC_ERROR("Cannot allocate memory for timer->name"); ++ goto no_name; ++ } ++ ++#if (defined(DWC_LINUX) && defined(CONFIG_DEBUG_SPINLOCK)) ++ DWC_SPINLOCK_ALLOC_LINUX_DEBUG(t->lock); ++#else ++ t->lock = DWC_SPINLOCK_ALLOC(); ++#endif ++ if (!t->lock) { ++ DWC_ERROR("Cannot allocate memory for lock"); ++ goto no_lock; ++ } ++ ++ t->scheduled = 0; ++ t->t->expires = jiffies; ++ setup_timer(t->t, timer_callback, (unsigned long)t); ++ ++ t->cb = cb; ++ t->data = data; ++ ++ return t; ++ ++ no_lock: ++ DWC_FREE(t->name); ++ no_name: ++ DWC_FREE(t->t); ++ no_timer: ++ DWC_FREE(t); ++ return NULL; ++} ++ ++void DWC_TIMER_FREE(dwc_timer_t *timer) ++{ ++ dwc_irqflags_t flags; ++ ++ DWC_SPINLOCK_IRQSAVE(timer->lock, &flags); ++ ++ if (timer->scheduled) { ++ del_timer(timer->t); ++ timer->scheduled = 0; ++ } ++ ++ DWC_SPINUNLOCK_IRQRESTORE(timer->lock, flags); ++ DWC_SPINLOCK_FREE(timer->lock); ++ DWC_FREE(timer->t); ++ DWC_FREE(timer->name); ++ DWC_FREE(timer); ++} ++ ++void DWC_TIMER_SCHEDULE(dwc_timer_t *timer, uint32_t time) ++{ ++ dwc_irqflags_t flags; ++ ++ DWC_SPINLOCK_IRQSAVE(timer->lock, &flags); ++ ++ if (!timer->scheduled) { ++ timer->scheduled = 1; ++ DWC_DEBUGC("Scheduling timer %s to expire in +%d msec", timer->name, time); ++ timer->t->expires = jiffies + msecs_to_jiffies(time); ++ add_timer(timer->t); ++ } else { ++ DWC_DEBUGC("Modifying timer %s to expire in +%d msec", timer->name, time); ++ mod_timer(timer->t, jiffies + msecs_to_jiffies(time)); ++ } ++ ++ DWC_SPINUNLOCK_IRQRESTORE(timer->lock, flags); ++} ++ ++void DWC_TIMER_CANCEL(dwc_timer_t *timer) ++{ ++ del_timer(timer->t); ++} ++ ++ ++/* Wait Queues */ ++ ++struct dwc_waitq { ++ wait_queue_head_t queue; ++ int abort; ++}; ++ ++dwc_waitq_t *DWC_WAITQ_ALLOC(void) ++{ ++ dwc_waitq_t *wq = DWC_ALLOC(sizeof(*wq)); ++ ++ if (!wq) { ++ DWC_ERROR("Cannot allocate memory for waitqueue\n"); ++ return NULL; ++ } ++ ++ init_waitqueue_head(&wq->queue); ++ wq->abort = 0; ++ return wq; ++} ++ ++void DWC_WAITQ_FREE(dwc_waitq_t *wq) ++{ ++ DWC_FREE(wq); ++} ++ ++int32_t DWC_WAITQ_WAIT(dwc_waitq_t *wq, dwc_waitq_condition_t cond, void *data) ++{ ++ int result = wait_event_interruptible(wq->queue, ++ cond(data) || wq->abort); ++ if (result == -ERESTARTSYS) { ++ wq->abort = 0; ++ return -DWC_E_RESTART; ++ } ++ ++ if (wq->abort == 1) { ++ wq->abort = 0; ++ return -DWC_E_ABORT; ++ } ++ ++ wq->abort = 0; ++ ++ if (result == 0) { ++ return 0; ++ } ++ ++ return -DWC_E_UNKNOWN; ++} ++ ++int32_t DWC_WAITQ_WAIT_TIMEOUT(dwc_waitq_t *wq, dwc_waitq_condition_t cond, ++ void *data, int32_t msecs) ++{ ++ int32_t tmsecs; ++ int result = wait_event_interruptible_timeout(wq->queue, ++ cond(data) || wq->abort, ++ msecs_to_jiffies(msecs)); ++ if (result == -ERESTARTSYS) { ++ wq->abort = 0; ++ return -DWC_E_RESTART; ++ } ++ ++ if (wq->abort == 1) { ++ wq->abort = 0; ++ return -DWC_E_ABORT; ++ } ++ ++ wq->abort = 0; ++ ++ if (result > 0) { ++ tmsecs = jiffies_to_msecs(result); ++ if (!tmsecs) { ++ return 1; ++ } ++ ++ return tmsecs; ++ } ++ ++ if (result == 0) { ++ return -DWC_E_TIMEOUT; ++ } ++ ++ return -DWC_E_UNKNOWN; ++} ++ ++void DWC_WAITQ_TRIGGER(dwc_waitq_t *wq) ++{ ++ wq->abort = 0; ++ wake_up_interruptible(&wq->queue); ++} ++ ++void DWC_WAITQ_ABORT(dwc_waitq_t *wq) ++{ ++ wq->abort = 1; ++ wake_up_interruptible(&wq->queue); ++} ++ ++ ++/* Threading */ ++ ++dwc_thread_t *DWC_THREAD_RUN(dwc_thread_function_t func, char *name, void *data) ++{ ++ struct task_struct *thread = kthread_run(func, data, name); ++ ++ if (thread == ERR_PTR(-ENOMEM)) { ++ return NULL; ++ } ++ ++ return (dwc_thread_t *)thread; ++} ++ ++int DWC_THREAD_STOP(dwc_thread_t *thread) ++{ ++ return kthread_stop((struct task_struct *)thread); ++} ++ ++dwc_bool_t DWC_THREAD_SHOULD_STOP(void) ++{ ++ return kthread_should_stop(); ++} ++ ++ ++/* tasklets ++ - run in interrupt context (cannot sleep) ++ - each tasklet runs on a single CPU ++ - different tasklets can be running simultaneously on different CPUs ++ */ ++struct dwc_tasklet { ++ struct tasklet_struct t; ++ dwc_tasklet_callback_t cb; ++ void *data; ++}; ++ ++static void tasklet_callback(unsigned long data) ++{ ++ dwc_tasklet_t *t = (dwc_tasklet_t *)data; ++ t->cb(t->data); ++} ++ ++dwc_tasklet_t *DWC_TASK_ALLOC(char *name, dwc_tasklet_callback_t cb, void *data) ++{ ++ dwc_tasklet_t *t = DWC_ALLOC(sizeof(*t)); ++ ++ if (t) { ++ t->cb = cb; ++ t->data = data; ++ tasklet_init(&t->t, tasklet_callback, (unsigned long)t); ++ } else { ++ DWC_ERROR("Cannot allocate memory for tasklet\n"); ++ } ++ ++ return t; ++} ++ ++void DWC_TASK_FREE(dwc_tasklet_t *task) ++{ ++ DWC_FREE(task); ++} ++ ++void DWC_TASK_SCHEDULE(dwc_tasklet_t *task) ++{ ++ tasklet_schedule(&task->t); ++} ++ ++void DWC_TASK_HI_SCHEDULE(dwc_tasklet_t *task) ++{ ++ tasklet_hi_schedule(&task->t); ++} ++ ++ ++/* workqueues ++ - run in process context (can sleep) ++ */ ++typedef struct work_container { ++ dwc_work_callback_t cb; ++ void *data; ++ dwc_workq_t *wq; ++ char *name; ++ ++#ifdef DEBUG ++ DWC_CIRCLEQ_ENTRY(work_container) entry; ++#endif ++ struct delayed_work work; ++} work_container_t; ++ ++#ifdef DEBUG ++DWC_CIRCLEQ_HEAD(work_container_queue, work_container); ++#endif ++ ++struct dwc_workq { ++ struct workqueue_struct *wq; ++ dwc_spinlock_t *lock; ++ dwc_waitq_t *waitq; ++ int pending; ++ ++#ifdef DEBUG ++ struct work_container_queue entries; ++#endif ++}; ++ ++static void do_work(struct work_struct *work) ++{ ++ dwc_irqflags_t flags; ++ struct delayed_work *dw = container_of(work, struct delayed_work, work); ++ work_container_t *container = container_of(dw, struct work_container, work); ++ dwc_workq_t *wq = container->wq; ++ ++ container->cb(container->data); ++ ++#ifdef DEBUG ++ DWC_CIRCLEQ_REMOVE(&wq->entries, container, entry); ++#endif ++ DWC_DEBUGC("Work done: %s, container=%p", container->name, container); ++ if (container->name) { ++ DWC_FREE(container->name); ++ } ++ DWC_FREE(container); ++ ++ DWC_SPINLOCK_IRQSAVE(wq->lock, &flags); ++ wq->pending--; ++ DWC_SPINUNLOCK_IRQRESTORE(wq->lock, flags); ++ DWC_WAITQ_TRIGGER(wq->waitq); ++} ++ ++static int work_done(void *data) ++{ ++ dwc_workq_t *workq = (dwc_workq_t *)data; ++ return workq->pending == 0; ++} ++ ++int DWC_WORKQ_WAIT_WORK_DONE(dwc_workq_t *workq, int timeout) ++{ ++ return DWC_WAITQ_WAIT_TIMEOUT(workq->waitq, work_done, workq, timeout); ++} ++ ++dwc_workq_t *DWC_WORKQ_ALLOC(char *name) ++{ ++ dwc_workq_t *wq = DWC_ALLOC(sizeof(*wq)); ++ ++ if (!wq) { ++ return NULL; ++ } ++ ++ wq->wq = create_singlethread_workqueue(name); ++ if (!wq->wq) { ++ goto no_wq; ++ } ++ ++ wq->pending = 0; ++ ++#if (defined(DWC_LINUX) && defined(CONFIG_DEBUG_SPINLOCK)) ++ DWC_SPINLOCK_ALLOC_LINUX_DEBUG(wq->lock); ++#else ++ wq->lock = DWC_SPINLOCK_ALLOC(); ++#endif ++ if (!wq->lock) { ++ goto no_lock; ++ } ++ ++ wq->waitq = DWC_WAITQ_ALLOC(); ++ if (!wq->waitq) { ++ goto no_waitq; ++ } ++ ++#ifdef DEBUG ++ DWC_CIRCLEQ_INIT(&wq->entries); ++#endif ++ return wq; ++ ++ no_waitq: ++ DWC_SPINLOCK_FREE(wq->lock); ++ no_lock: ++ destroy_workqueue(wq->wq); ++ no_wq: ++ DWC_FREE(wq); ++ ++ return NULL; ++} ++ ++void DWC_WORKQ_FREE(dwc_workq_t *wq) ++{ ++#ifdef DEBUG ++ if (wq->pending != 0) { ++ struct work_container *wc; ++ DWC_ERROR("Destroying work queue with pending work"); ++ DWC_CIRCLEQ_FOREACH(wc, &wq->entries, entry) { ++ DWC_ERROR("Work %s still pending", wc->name); ++ } ++ } ++#endif ++ destroy_workqueue(wq->wq); ++ DWC_SPINLOCK_FREE(wq->lock); ++ DWC_WAITQ_FREE(wq->waitq); ++ DWC_FREE(wq); ++} ++ ++void DWC_WORKQ_SCHEDULE(dwc_workq_t *wq, dwc_work_callback_t cb, void *data, ++ char *format, ...) ++{ ++ dwc_irqflags_t flags; ++ work_container_t *container; ++ static char name[128]; ++ va_list args; ++ ++ va_start(args, format); ++ DWC_VSNPRINTF(name, 128, format, args); ++ va_end(args); ++ ++ DWC_SPINLOCK_IRQSAVE(wq->lock, &flags); ++ wq->pending++; ++ DWC_SPINUNLOCK_IRQRESTORE(wq->lock, flags); ++ DWC_WAITQ_TRIGGER(wq->waitq); ++ ++ container = DWC_ALLOC_ATOMIC(sizeof(*container)); ++ if (!container) { ++ DWC_ERROR("Cannot allocate memory for container\n"); ++ return; ++ } ++ ++ container->name = DWC_STRDUP(name); ++ if (!container->name) { ++ DWC_ERROR("Cannot allocate memory for container->name\n"); ++ DWC_FREE(container); ++ return; ++ } ++ ++ container->cb = cb; ++ container->data = data; ++ container->wq = wq; ++ DWC_DEBUGC("Queueing work: %s, container=%p", container->name, container); ++ INIT_WORK(&container->work.work, do_work); ++ ++#ifdef DEBUG ++ DWC_CIRCLEQ_INSERT_TAIL(&wq->entries, container, entry); ++#endif ++ queue_work(wq->wq, &container->work.work); ++} ++ ++void DWC_WORKQ_SCHEDULE_DELAYED(dwc_workq_t *wq, dwc_work_callback_t cb, ++ void *data, uint32_t time, char *format, ...) ++{ ++ dwc_irqflags_t flags; ++ work_container_t *container; ++ static char name[128]; ++ va_list args; ++ ++ va_start(args, format); ++ DWC_VSNPRINTF(name, 128, format, args); ++ va_end(args); ++ ++ DWC_SPINLOCK_IRQSAVE(wq->lock, &flags); ++ wq->pending++; ++ DWC_SPINUNLOCK_IRQRESTORE(wq->lock, flags); ++ DWC_WAITQ_TRIGGER(wq->waitq); ++ ++ container = DWC_ALLOC_ATOMIC(sizeof(*container)); ++ if (!container) { ++ DWC_ERROR("Cannot allocate memory for container\n"); ++ return; ++ } ++ ++ container->name = DWC_STRDUP(name); ++ if (!container->name) { ++ DWC_ERROR("Cannot allocate memory for container->name\n"); ++ DWC_FREE(container); ++ return; ++ } ++ ++ container->cb = cb; ++ container->data = data; ++ container->wq = wq; ++ DWC_DEBUGC("Queueing work: %s, container=%p", container->name, container); ++ INIT_DELAYED_WORK(&container->work, do_work); ++ ++#ifdef DEBUG ++ DWC_CIRCLEQ_INSERT_TAIL(&wq->entries, container, entry); ++#endif ++ queue_delayed_work(wq->wq, &container->work, msecs_to_jiffies(time)); ++} ++ ++int DWC_WORKQ_PENDING(dwc_workq_t *wq) ++{ ++ return wq->pending; ++} ++ ++ ++#ifdef DWC_LIBMODULE ++ ++#ifdef DWC_CCLIB ++/* CC */ ++EXPORT_SYMBOL(dwc_cc_if_alloc); ++EXPORT_SYMBOL(dwc_cc_if_free); ++EXPORT_SYMBOL(dwc_cc_clear); ++EXPORT_SYMBOL(dwc_cc_add); ++EXPORT_SYMBOL(dwc_cc_remove); ++EXPORT_SYMBOL(dwc_cc_change); ++EXPORT_SYMBOL(dwc_cc_data_for_save); ++EXPORT_SYMBOL(dwc_cc_restore_from_data); ++EXPORT_SYMBOL(dwc_cc_match_chid); ++EXPORT_SYMBOL(dwc_cc_match_cdid); ++EXPORT_SYMBOL(dwc_cc_ck); ++EXPORT_SYMBOL(dwc_cc_chid); ++EXPORT_SYMBOL(dwc_cc_cdid); ++EXPORT_SYMBOL(dwc_cc_name); ++#endif /* DWC_CCLIB */ ++ ++#ifdef DWC_CRYPTOLIB ++# ifndef CONFIG_MACH_IPMATE ++/* Modpow */ ++EXPORT_SYMBOL(dwc_modpow); ++ ++/* DH */ ++EXPORT_SYMBOL(dwc_dh_modpow); ++EXPORT_SYMBOL(dwc_dh_derive_keys); ++EXPORT_SYMBOL(dwc_dh_pk); ++# endif /* CONFIG_MACH_IPMATE */ ++ ++/* Crypto */ ++EXPORT_SYMBOL(dwc_wusb_aes_encrypt); ++EXPORT_SYMBOL(dwc_wusb_cmf); ++EXPORT_SYMBOL(dwc_wusb_prf); ++EXPORT_SYMBOL(dwc_wusb_fill_ccm_nonce); ++EXPORT_SYMBOL(dwc_wusb_gen_nonce); ++EXPORT_SYMBOL(dwc_wusb_gen_key); ++EXPORT_SYMBOL(dwc_wusb_gen_mic); ++#endif /* DWC_CRYPTOLIB */ ++ ++/* Notification */ ++#ifdef DWC_NOTIFYLIB ++EXPORT_SYMBOL(dwc_alloc_notification_manager); ++EXPORT_SYMBOL(dwc_free_notification_manager); ++EXPORT_SYMBOL(dwc_register_notifier); ++EXPORT_SYMBOL(dwc_unregister_notifier); ++EXPORT_SYMBOL(dwc_add_observer); ++EXPORT_SYMBOL(dwc_remove_observer); ++EXPORT_SYMBOL(dwc_notify); ++#endif ++ ++/* Memory Debugging Routines */ ++#ifdef DWC_DEBUG_MEMORY ++EXPORT_SYMBOL(dwc_alloc_debug); ++EXPORT_SYMBOL(dwc_alloc_atomic_debug); ++EXPORT_SYMBOL(dwc_free_debug); ++EXPORT_SYMBOL(dwc_dma_alloc_debug); ++EXPORT_SYMBOL(dwc_dma_free_debug); ++#endif ++ ++EXPORT_SYMBOL(DWC_MEMSET); ++EXPORT_SYMBOL(DWC_MEMCPY); ++EXPORT_SYMBOL(DWC_MEMMOVE); ++EXPORT_SYMBOL(DWC_MEMCMP); ++EXPORT_SYMBOL(DWC_STRNCMP); ++EXPORT_SYMBOL(DWC_STRCMP); ++EXPORT_SYMBOL(DWC_STRLEN); ++EXPORT_SYMBOL(DWC_STRCPY); ++EXPORT_SYMBOL(DWC_STRDUP); ++EXPORT_SYMBOL(DWC_ATOI); ++EXPORT_SYMBOL(DWC_ATOUI); ++ ++#ifdef DWC_UTFLIB ++EXPORT_SYMBOL(DWC_UTF8_TO_UTF16LE); ++#endif /* DWC_UTFLIB */ ++ ++EXPORT_SYMBOL(DWC_IN_IRQ); ++EXPORT_SYMBOL(DWC_IN_BH); ++EXPORT_SYMBOL(DWC_VPRINTF); ++EXPORT_SYMBOL(DWC_VSNPRINTF); ++EXPORT_SYMBOL(DWC_PRINTF); ++EXPORT_SYMBOL(DWC_SPRINTF); ++EXPORT_SYMBOL(DWC_SNPRINTF); ++EXPORT_SYMBOL(__DWC_WARN); ++EXPORT_SYMBOL(__DWC_ERROR); ++EXPORT_SYMBOL(DWC_EXCEPTION); ++ ++#ifdef DEBUG ++EXPORT_SYMBOL(__DWC_DEBUG); ++#endif ++ ++EXPORT_SYMBOL(__DWC_DMA_ALLOC); ++EXPORT_SYMBOL(__DWC_DMA_ALLOC_ATOMIC); ++EXPORT_SYMBOL(__DWC_DMA_FREE); ++EXPORT_SYMBOL(__DWC_ALLOC); ++EXPORT_SYMBOL(__DWC_ALLOC_ATOMIC); ++EXPORT_SYMBOL(__DWC_FREE); ++ ++#ifdef DWC_CRYPTOLIB ++EXPORT_SYMBOL(DWC_RANDOM_BYTES); ++EXPORT_SYMBOL(DWC_AES_CBC); ++EXPORT_SYMBOL(DWC_SHA256); ++EXPORT_SYMBOL(DWC_HMAC_SHA256); ++#endif ++ ++EXPORT_SYMBOL(DWC_CPU_TO_LE32); ++EXPORT_SYMBOL(DWC_CPU_TO_BE32); ++EXPORT_SYMBOL(DWC_LE32_TO_CPU); ++EXPORT_SYMBOL(DWC_BE32_TO_CPU); ++EXPORT_SYMBOL(DWC_CPU_TO_LE16); ++EXPORT_SYMBOL(DWC_CPU_TO_BE16); ++EXPORT_SYMBOL(DWC_LE16_TO_CPU); ++EXPORT_SYMBOL(DWC_BE16_TO_CPU); ++EXPORT_SYMBOL(DWC_READ_REG32); ++EXPORT_SYMBOL(DWC_WRITE_REG32); ++EXPORT_SYMBOL(DWC_MODIFY_REG32); ++ ++#if 0 ++EXPORT_SYMBOL(DWC_READ_REG64); ++EXPORT_SYMBOL(DWC_WRITE_REG64); ++EXPORT_SYMBOL(DWC_MODIFY_REG64); ++#endif ++ ++EXPORT_SYMBOL(DWC_SPINLOCK_ALLOC); ++EXPORT_SYMBOL(DWC_SPINLOCK_FREE); ++EXPORT_SYMBOL(DWC_SPINLOCK); ++EXPORT_SYMBOL(DWC_SPINUNLOCK); ++EXPORT_SYMBOL(DWC_SPINLOCK_IRQSAVE); ++EXPORT_SYMBOL(DWC_SPINUNLOCK_IRQRESTORE); ++EXPORT_SYMBOL(DWC_MUTEX_ALLOC); ++ ++#if (!defined(DWC_LINUX) || !defined(CONFIG_DEBUG_MUTEXES)) ++EXPORT_SYMBOL(DWC_MUTEX_FREE); ++#endif ++ ++EXPORT_SYMBOL(DWC_MUTEX_LOCK); ++EXPORT_SYMBOL(DWC_MUTEX_TRYLOCK); ++EXPORT_SYMBOL(DWC_MUTEX_UNLOCK); ++EXPORT_SYMBOL(DWC_UDELAY); ++EXPORT_SYMBOL(DWC_MDELAY); ++EXPORT_SYMBOL(DWC_MSLEEP); ++EXPORT_SYMBOL(DWC_TIME); ++EXPORT_SYMBOL(DWC_TIMER_ALLOC); ++EXPORT_SYMBOL(DWC_TIMER_FREE); ++EXPORT_SYMBOL(DWC_TIMER_SCHEDULE); ++EXPORT_SYMBOL(DWC_TIMER_CANCEL); ++EXPORT_SYMBOL(DWC_WAITQ_ALLOC); ++EXPORT_SYMBOL(DWC_WAITQ_FREE); ++EXPORT_SYMBOL(DWC_WAITQ_WAIT); ++EXPORT_SYMBOL(DWC_WAITQ_WAIT_TIMEOUT); ++EXPORT_SYMBOL(DWC_WAITQ_TRIGGER); ++EXPORT_SYMBOL(DWC_WAITQ_ABORT); ++EXPORT_SYMBOL(DWC_THREAD_RUN); ++EXPORT_SYMBOL(DWC_THREAD_STOP); ++EXPORT_SYMBOL(DWC_THREAD_SHOULD_STOP); ++EXPORT_SYMBOL(DWC_TASK_ALLOC); ++EXPORT_SYMBOL(DWC_TASK_FREE); ++EXPORT_SYMBOL(DWC_TASK_SCHEDULE); ++EXPORT_SYMBOL(DWC_WORKQ_WAIT_WORK_DONE); ++EXPORT_SYMBOL(DWC_WORKQ_ALLOC); ++EXPORT_SYMBOL(DWC_WORKQ_FREE); ++EXPORT_SYMBOL(DWC_WORKQ_SCHEDULE); ++EXPORT_SYMBOL(DWC_WORKQ_SCHEDULE_DELAYED); ++EXPORT_SYMBOL(DWC_WORKQ_PENDING); ++ ++static int dwc_common_port_init_module(void) ++{ ++ int result = 0; ++ ++ printk(KERN_DEBUG "Module dwc_common_port init\n" ); ++ ++#ifdef DWC_DEBUG_MEMORY ++ result = dwc_memory_debug_start(NULL); ++ if (result) { ++ printk(KERN_ERR ++ "dwc_memory_debug_start() failed with error %d\n", ++ result); ++ return result; ++ } ++#endif ++ ++#ifdef DWC_NOTIFYLIB ++ result = dwc_alloc_notification_manager(NULL, NULL); ++ if (result) { ++ printk(KERN_ERR ++ "dwc_alloc_notification_manager() failed with error %d\n", ++ result); ++ return result; ++ } ++#endif ++ return result; ++} ++ ++static void dwc_common_port_exit_module(void) ++{ ++ printk(KERN_DEBUG "Module dwc_common_port exit\n" ); ++ ++#ifdef DWC_NOTIFYLIB ++ dwc_free_notification_manager(); ++#endif ++ ++#ifdef DWC_DEBUG_MEMORY ++ dwc_memory_debug_stop(); ++#endif ++} ++ ++module_init(dwc_common_port_init_module); ++module_exit(dwc_common_port_exit_module); ++ ++MODULE_DESCRIPTION("DWC Common Library - Portable version"); ++MODULE_AUTHOR("Synopsys Inc."); ++MODULE_LICENSE ("GPL"); ++ ++#endif /* DWC_LIBMODULE */ +diff --git a/drivers/usb/host/dwc_common_port/dwc_common_nbsd.c b/drivers/usb/host/dwc_common_port/dwc_common_nbsd.c +new file mode 100644 +index 0000000..49b07e1 +--- /dev/null ++++ b/drivers/usb/host/dwc_common_port/dwc_common_nbsd.c +@@ -0,0 +1,1275 @@ ++#include "dwc_os.h" ++#include "dwc_list.h" ++ ++#ifdef DWC_CCLIB ++# include "dwc_cc.h" ++#endif ++ ++#ifdef DWC_CRYPTOLIB ++# include "dwc_modpow.h" ++# include "dwc_dh.h" ++# include "dwc_crypto.h" ++#endif ++ ++#ifdef DWC_NOTIFYLIB ++# include "dwc_notifier.h" ++#endif ++ ++/* OS-Level Implementations */ ++ ++/* This is the NetBSD 4.0.1 kernel implementation of the DWC platform library. */ ++ ++ ++/* MISC */ ++ ++void *DWC_MEMSET(void *dest, uint8_t byte, uint32_t size) ++{ ++ return memset(dest, byte, size); ++} ++ ++void *DWC_MEMCPY(void *dest, void const *src, uint32_t size) ++{ ++ return memcpy(dest, src, size); ++} ++ ++void *DWC_MEMMOVE(void *dest, void *src, uint32_t size) ++{ ++ bcopy(src, dest, size); ++ return dest; ++} ++ ++int DWC_MEMCMP(void *m1, void *m2, uint32_t size) ++{ ++ return memcmp(m1, m2, size); ++} ++ ++int DWC_STRNCMP(void *s1, void *s2, uint32_t size) ++{ ++ return strncmp(s1, s2, size); ++} ++ ++int DWC_STRCMP(void *s1, void *s2) ++{ ++ return strcmp(s1, s2); ++} ++ ++int DWC_STRLEN(char const *str) ++{ ++ return strlen(str); ++} ++ ++char *DWC_STRCPY(char *to, char const *from) ++{ ++ return strcpy(to, from); ++} ++ ++char *DWC_STRDUP(char const *str) ++{ ++ int len = DWC_STRLEN(str) + 1; ++ char *new = DWC_ALLOC_ATOMIC(len); ++ ++ if (!new) { ++ return NULL; ++ } ++ ++ DWC_MEMCPY(new, str, len); ++ return new; ++} ++ ++int DWC_ATOI(char *str, int32_t *value) ++{ ++ char *end = NULL; ++ ++ /* NetBSD doesn't have 'strtol' in the kernel, but 'strtoul' ++ * should be equivalent on 2's complement machines ++ */ ++ *value = strtoul(str, &end, 0); ++ if (*end == '\0') { ++ return 0; ++ } ++ ++ return -1; ++} ++ ++int DWC_ATOUI(char *str, uint32_t *value) ++{ ++ char *end = NULL; ++ ++ *value = strtoul(str, &end, 0); ++ if (*end == '\0') { ++ return 0; ++ } ++ ++ return -1; ++} ++ ++ ++#ifdef DWC_UTFLIB ++/* From usbstring.c */ ++ ++int DWC_UTF8_TO_UTF16LE(uint8_t const *s, uint16_t *cp, unsigned len) ++{ ++ int count = 0; ++ u8 c; ++ u16 uchar; ++ ++ /* this insists on correct encodings, though not minimal ones. ++ * BUT it currently rejects legit 4-byte UTF-8 code points, ++ * which need surrogate pairs. (Unicode 3.1 can use them.) ++ */ ++ while (len != 0 && (c = (u8) *s++) != 0) { ++ if (unlikely(c & 0x80)) { ++ // 2-byte sequence: ++ // 00000yyyyyxxxxxx = 110yyyyy 10xxxxxx ++ if ((c & 0xe0) == 0xc0) { ++ uchar = (c & 0x1f) << 6; ++ ++ c = (u8) *s++; ++ if ((c & 0xc0) != 0xc0) ++ goto fail; ++ c &= 0x3f; ++ uchar |= c; ++ ++ // 3-byte sequence (most CJKV characters): ++ // zzzzyyyyyyxxxxxx = 1110zzzz 10yyyyyy 10xxxxxx ++ } else if ((c & 0xf0) == 0xe0) { ++ uchar = (c & 0x0f) << 12; ++ ++ c = (u8) *s++; ++ if ((c & 0xc0) != 0xc0) ++ goto fail; ++ c &= 0x3f; ++ uchar |= c << 6; ++ ++ c = (u8) *s++; ++ if ((c & 0xc0) != 0xc0) ++ goto fail; ++ c &= 0x3f; ++ uchar |= c; ++ ++ /* no bogus surrogates */ ++ if (0xd800 <= uchar && uchar <= 0xdfff) ++ goto fail; ++ ++ // 4-byte sequence (surrogate pairs, currently rare): ++ // 11101110wwwwzzzzyy + 110111yyyyxxxxxx ++ // = 11110uuu 10uuzzzz 10yyyyyy 10xxxxxx ++ // (uuuuu = wwww + 1) ++ // FIXME accept the surrogate code points (only) ++ } else ++ goto fail; ++ } else ++ uchar = c; ++ put_unaligned (cpu_to_le16 (uchar), cp++); ++ count++; ++ len--; ++ } ++ return count; ++fail: ++ return -1; ++} ++ ++#endif /* DWC_UTFLIB */ ++ ++ ++/* dwc_debug.h */ ++ ++dwc_bool_t DWC_IN_IRQ(void) ++{ ++// return in_irq(); ++ return 0; ++} ++ ++dwc_bool_t DWC_IN_BH(void) ++{ ++// return in_softirq(); ++ return 0; ++} ++ ++void DWC_VPRINTF(char *format, va_list args) ++{ ++ vprintf(format, args); ++} ++ ++int DWC_VSNPRINTF(char *str, int size, char *format, va_list args) ++{ ++ return vsnprintf(str, size, format, args); ++} ++ ++void DWC_PRINTF(char *format, ...) ++{ ++ va_list args; ++ ++ va_start(args, format); ++ DWC_VPRINTF(format, args); ++ va_end(args); ++} ++ ++int DWC_SPRINTF(char *buffer, char *format, ...) ++{ ++ int retval; ++ va_list args; ++ ++ va_start(args, format); ++ retval = vsprintf(buffer, format, args); ++ va_end(args); ++ return retval; ++} ++ ++int DWC_SNPRINTF(char *buffer, int size, char *format, ...) ++{ ++ int retval; ++ va_list args; ++ ++ va_start(args, format); ++ retval = vsnprintf(buffer, size, format, args); ++ va_end(args); ++ return retval; ++} ++ ++void __DWC_WARN(char *format, ...) ++{ ++ va_list args; ++ ++ va_start(args, format); ++ DWC_VPRINTF(format, args); ++ va_end(args); ++} ++ ++void __DWC_ERROR(char *format, ...) ++{ ++ va_list args; ++ ++ va_start(args, format); ++ DWC_VPRINTF(format, args); ++ va_end(args); ++} ++ ++void DWC_EXCEPTION(char *format, ...) ++{ ++ va_list args; ++ ++ va_start(args, format); ++ DWC_VPRINTF(format, args); ++ va_end(args); ++// BUG_ON(1); ??? ++} ++ ++#ifdef DEBUG ++void __DWC_DEBUG(char *format, ...) ++{ ++ va_list args; ++ ++ va_start(args, format); ++ DWC_VPRINTF(format, args); ++ va_end(args); ++} ++#endif ++ ++ ++/* dwc_mem.h */ ++ ++#if 0 ++dwc_pool_t *DWC_DMA_POOL_CREATE(uint32_t size, ++ uint32_t align, ++ uint32_t alloc) ++{ ++ struct dma_pool *pool = dma_pool_create("Pool", NULL, ++ size, align, alloc); ++ return (dwc_pool_t *)pool; ++} ++ ++void DWC_DMA_POOL_DESTROY(dwc_pool_t *pool) ++{ ++ dma_pool_destroy((struct dma_pool *)pool); ++} ++ ++void *DWC_DMA_POOL_ALLOC(dwc_pool_t *pool, uint64_t *dma_addr) ++{ ++// return dma_pool_alloc((struct dma_pool *)pool, GFP_KERNEL, dma_addr); ++ return dma_pool_alloc((struct dma_pool *)pool, M_WAITOK, dma_addr); ++} ++ ++void *DWC_DMA_POOL_ZALLOC(dwc_pool_t *pool, uint64_t *dma_addr) ++{ ++ void *vaddr = DWC_DMA_POOL_ALLOC(pool, dma_addr); ++ memset(..); ++} ++ ++void DWC_DMA_POOL_FREE(dwc_pool_t *pool, void *vaddr, void *daddr) ++{ ++ dma_pool_free(pool, vaddr, daddr); ++} ++#endif ++ ++void *__DWC_DMA_ALLOC(void *dma_ctx, uint32_t size, dwc_dma_t *dma_addr) ++{ ++ dwc_dmactx_t *dma = (dwc_dmactx_t *)dma_ctx; ++ int error; ++ ++ error = bus_dmamem_alloc(dma->dma_tag, size, 1, size, dma->segs, ++ sizeof(dma->segs) / sizeof(dma->segs[0]), ++ &dma->nsegs, BUS_DMA_NOWAIT); ++ if (error) { ++ printf("%s: bus_dmamem_alloc(%ju) failed: %d\n", __func__, ++ (uintmax_t)size, error); ++ goto fail_0; ++ } ++ ++ error = bus_dmamem_map(dma->dma_tag, dma->segs, dma->nsegs, size, ++ (caddr_t *)&dma->dma_vaddr, ++ BUS_DMA_NOWAIT | BUS_DMA_COHERENT); ++ if (error) { ++ printf("%s: bus_dmamem_map failed: %d\n", __func__, error); ++ goto fail_1; ++ } ++ ++ error = bus_dmamap_create(dma->dma_tag, size, 1, size, 0, ++ BUS_DMA_NOWAIT, &dma->dma_map); ++ if (error) { ++ printf("%s: bus_dmamap_create failed: %d\n", __func__, error); ++ goto fail_2; ++ } ++ ++ error = bus_dmamap_load(dma->dma_tag, dma->dma_map, dma->dma_vaddr, ++ size, NULL, BUS_DMA_NOWAIT); ++ if (error) { ++ printf("%s: bus_dmamap_load failed: %d\n", __func__, error); ++ goto fail_3; ++ } ++ ++ dma->dma_paddr = (bus_addr_t)dma->segs[0].ds_addr; ++ *dma_addr = dma->dma_paddr; ++ return dma->dma_vaddr; ++ ++fail_3: ++ bus_dmamap_destroy(dma->dma_tag, dma->dma_map); ++fail_2: ++ bus_dmamem_unmap(dma->dma_tag, dma->dma_vaddr, size); ++fail_1: ++ bus_dmamem_free(dma->dma_tag, dma->segs, dma->nsegs); ++fail_0: ++ dma->dma_map = NULL; ++ dma->dma_vaddr = NULL; ++ dma->nsegs = 0; ++ ++ return NULL; ++} ++ ++void __DWC_DMA_FREE(void *dma_ctx, uint32_t size, void *virt_addr, dwc_dma_t dma_addr) ++{ ++ dwc_dmactx_t *dma = (dwc_dmactx_t *)dma_ctx; ++ ++ if (dma->dma_map != NULL) { ++ bus_dmamap_sync(dma->dma_tag, dma->dma_map, 0, size, ++ BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); ++ bus_dmamap_unload(dma->dma_tag, dma->dma_map); ++ bus_dmamap_destroy(dma->dma_tag, dma->dma_map); ++ bus_dmamem_unmap(dma->dma_tag, dma->dma_vaddr, size); ++ bus_dmamem_free(dma->dma_tag, dma->segs, dma->nsegs); ++ dma->dma_paddr = 0; ++ dma->dma_map = NULL; ++ dma->dma_vaddr = NULL; ++ dma->nsegs = 0; ++ } ++} ++ ++void *__DWC_ALLOC(void *mem_ctx, uint32_t size) ++{ ++ return malloc(size, M_DEVBUF, M_WAITOK | M_ZERO); ++} ++ ++void *__DWC_ALLOC_ATOMIC(void *mem_ctx, uint32_t size) ++{ ++ return malloc(size, M_DEVBUF, M_NOWAIT | M_ZERO); ++} ++ ++void __DWC_FREE(void *mem_ctx, void *addr) ++{ ++ free(addr, M_DEVBUF); ++} ++ ++ ++#ifdef DWC_CRYPTOLIB ++/* dwc_crypto.h */ ++ ++void DWC_RANDOM_BYTES(uint8_t *buffer, uint32_t length) ++{ ++ get_random_bytes(buffer, length); ++} ++ ++int DWC_AES_CBC(uint8_t *message, uint32_t messagelen, uint8_t *key, uint32_t keylen, uint8_t iv[16], uint8_t *out) ++{ ++ struct crypto_blkcipher *tfm; ++ struct blkcipher_desc desc; ++ struct scatterlist sgd; ++ struct scatterlist sgs; ++ ++ tfm = crypto_alloc_blkcipher("cbc(aes)", 0, CRYPTO_ALG_ASYNC); ++ if (tfm == NULL) { ++ printk("failed to load transform for aes CBC\n"); ++ return -1; ++ } ++ ++ crypto_blkcipher_setkey(tfm, key, keylen); ++ crypto_blkcipher_set_iv(tfm, iv, 16); ++ ++ sg_init_one(&sgd, out, messagelen); ++ sg_init_one(&sgs, message, messagelen); ++ ++ desc.tfm = tfm; ++ desc.flags = 0; ++ ++ if (crypto_blkcipher_encrypt(&desc, &sgd, &sgs, messagelen)) { ++ crypto_free_blkcipher(tfm); ++ DWC_ERROR("AES CBC encryption failed"); ++ return -1; ++ } ++ ++ crypto_free_blkcipher(tfm); ++ return 0; ++} ++ ++int DWC_SHA256(uint8_t *message, uint32_t len, uint8_t *out) ++{ ++ struct crypto_hash *tfm; ++ struct hash_desc desc; ++ struct scatterlist sg; ++ ++ tfm = crypto_alloc_hash("sha256", 0, CRYPTO_ALG_ASYNC); ++ if (IS_ERR(tfm)) { ++ DWC_ERROR("Failed to load transform for sha256: %ld", PTR_ERR(tfm)); ++ return 0; ++ } ++ desc.tfm = tfm; ++ desc.flags = 0; ++ ++ sg_init_one(&sg, message, len); ++ crypto_hash_digest(&desc, &sg, len, out); ++ crypto_free_hash(tfm); ++ ++ return 1; ++} ++ ++int DWC_HMAC_SHA256(uint8_t *message, uint32_t messagelen, ++ uint8_t *key, uint32_t keylen, uint8_t *out) ++{ ++ struct crypto_hash *tfm; ++ struct hash_desc desc; ++ struct scatterlist sg; ++ ++ tfm = crypto_alloc_hash("hmac(sha256)", 0, CRYPTO_ALG_ASYNC); ++ if (IS_ERR(tfm)) { ++ DWC_ERROR("Failed to load transform for hmac(sha256): %ld", PTR_ERR(tfm)); ++ return 0; ++ } ++ desc.tfm = tfm; ++ desc.flags = 0; ++ ++ sg_init_one(&sg, message, messagelen); ++ crypto_hash_setkey(tfm, key, keylen); ++ crypto_hash_digest(&desc, &sg, messagelen, out); ++ crypto_free_hash(tfm); ++ ++ return 1; ++} ++ ++#endif /* DWC_CRYPTOLIB */ ++ ++ ++/* Byte Ordering Conversions */ ++ ++uint32_t DWC_CPU_TO_LE32(uint32_t *p) ++{ ++#ifdef __LITTLE_ENDIAN ++ return *p; ++#else ++ uint8_t *u_p = (uint8_t *)p; ++ ++ return (u_p[3] | (u_p[2] << 8) | (u_p[1] << 16) | (u_p[0] << 24)); ++#endif ++} ++ ++uint32_t DWC_CPU_TO_BE32(uint32_t *p) ++{ ++#ifdef __BIG_ENDIAN ++ return *p; ++#else ++ uint8_t *u_p = (uint8_t *)p; ++ ++ return (u_p[3] | (u_p[2] << 8) | (u_p[1] << 16) | (u_p[0] << 24)); ++#endif ++} ++ ++uint32_t DWC_LE32_TO_CPU(uint32_t *p) ++{ ++#ifdef __LITTLE_ENDIAN ++ return *p; ++#else ++ uint8_t *u_p = (uint8_t *)p; ++ ++ return (u_p[3] | (u_p[2] << 8) | (u_p[1] << 16) | (u_p[0] << 24)); ++#endif ++} ++ ++uint32_t DWC_BE32_TO_CPU(uint32_t *p) ++{ ++#ifdef __BIG_ENDIAN ++ return *p; ++#else ++ uint8_t *u_p = (uint8_t *)p; ++ ++ return (u_p[3] | (u_p[2] << 8) | (u_p[1] << 16) | (u_p[0] << 24)); ++#endif ++} ++ ++uint16_t DWC_CPU_TO_LE16(uint16_t *p) ++{ ++#ifdef __LITTLE_ENDIAN ++ return *p; ++#else ++ uint8_t *u_p = (uint8_t *)p; ++ return (u_p[1] | (u_p[0] << 8)); ++#endif ++} ++ ++uint16_t DWC_CPU_TO_BE16(uint16_t *p) ++{ ++#ifdef __BIG_ENDIAN ++ return *p; ++#else ++ uint8_t *u_p = (uint8_t *)p; ++ return (u_p[1] | (u_p[0] << 8)); ++#endif ++} ++ ++uint16_t DWC_LE16_TO_CPU(uint16_t *p) ++{ ++#ifdef __LITTLE_ENDIAN ++ return *p; ++#else ++ uint8_t *u_p = (uint8_t *)p; ++ return (u_p[1] | (u_p[0] << 8)); ++#endif ++} ++ ++uint16_t DWC_BE16_TO_CPU(uint16_t *p) ++{ ++#ifdef __BIG_ENDIAN ++ return *p; ++#else ++ uint8_t *u_p = (uint8_t *)p; ++ return (u_p[1] | (u_p[0] << 8)); ++#endif ++} ++ ++ ++/* Registers */ ++ ++uint32_t DWC_READ_REG32(void *io_ctx, uint32_t volatile *reg) ++{ ++ dwc_ioctx_t *io = (dwc_ioctx_t *)io_ctx; ++ bus_size_t ior = (bus_size_t)reg; ++ ++ return bus_space_read_4(io->iot, io->ioh, ior); ++} ++ ++#if 0 ++uint64_t DWC_READ_REG64(void *io_ctx, uint64_t volatile *reg) ++{ ++ dwc_ioctx_t *io = (dwc_ioctx_t *)io_ctx; ++ bus_size_t ior = (bus_size_t)reg; ++ ++ return bus_space_read_8(io->iot, io->ioh, ior); ++} ++#endif ++ ++void DWC_WRITE_REG32(void *io_ctx, uint32_t volatile *reg, uint32_t value) ++{ ++ dwc_ioctx_t *io = (dwc_ioctx_t *)io_ctx; ++ bus_size_t ior = (bus_size_t)reg; ++ ++ bus_space_write_4(io->iot, io->ioh, ior, value); ++} ++ ++#if 0 ++void DWC_WRITE_REG64(void *io_ctx, uint64_t volatile *reg, uint64_t value) ++{ ++ dwc_ioctx_t *io = (dwc_ioctx_t *)io_ctx; ++ bus_size_t ior = (bus_size_t)reg; ++ ++ bus_space_write_8(io->iot, io->ioh, ior, value); ++} ++#endif ++ ++void DWC_MODIFY_REG32(void *io_ctx, uint32_t volatile *reg, uint32_t clear_mask, ++ uint32_t set_mask) ++{ ++ dwc_ioctx_t *io = (dwc_ioctx_t *)io_ctx; ++ bus_size_t ior = (bus_size_t)reg; ++ ++ bus_space_write_4(io->iot, io->ioh, ior, ++ (bus_space_read_4(io->iot, io->ioh, ior) & ++ ~clear_mask) | set_mask); ++} ++ ++#if 0 ++void DWC_MODIFY_REG64(void *io_ctx, uint64_t volatile *reg, uint64_t clear_mask, ++ uint64_t set_mask) ++{ ++ dwc_ioctx_t *io = (dwc_ioctx_t *)io_ctx; ++ bus_size_t ior = (bus_size_t)reg; ++ ++ bus_space_write_8(io->iot, io->ioh, ior, ++ (bus_space_read_8(io->iot, io->ioh, ior) & ++ ~clear_mask) | set_mask); ++} ++#endif ++ ++ ++/* Locking */ ++ ++dwc_spinlock_t *DWC_SPINLOCK_ALLOC(void) ++{ ++ struct simplelock *sl = DWC_ALLOC(sizeof(*sl)); ++ ++ if (!sl) { ++ DWC_ERROR("Cannot allocate memory for spinlock"); ++ return NULL; ++ } ++ ++ simple_lock_init(sl); ++ return (dwc_spinlock_t *)sl; ++} ++ ++void DWC_SPINLOCK_FREE(dwc_spinlock_t *lock) ++{ ++ struct simplelock *sl = (struct simplelock *)lock; ++ ++ DWC_FREE(sl); ++} ++ ++void DWC_SPINLOCK(dwc_spinlock_t *lock) ++{ ++ simple_lock((struct simplelock *)lock); ++} ++ ++void DWC_SPINUNLOCK(dwc_spinlock_t *lock) ++{ ++ simple_unlock((struct simplelock *)lock); ++} ++ ++void DWC_SPINLOCK_IRQSAVE(dwc_spinlock_t *lock, dwc_irqflags_t *flags) ++{ ++ simple_lock((struct simplelock *)lock); ++ *flags = splbio(); ++} ++ ++void DWC_SPINUNLOCK_IRQRESTORE(dwc_spinlock_t *lock, dwc_irqflags_t flags) ++{ ++ splx(flags); ++ simple_unlock((struct simplelock *)lock); ++} ++ ++dwc_mutex_t *DWC_MUTEX_ALLOC(void) ++{ ++ dwc_mutex_t *mutex = DWC_ALLOC(sizeof(struct lock)); ++ ++ if (!mutex) { ++ DWC_ERROR("Cannot allocate memory for mutex"); ++ return NULL; ++ } ++ ++ lockinit((struct lock *)mutex, 0, "dw3mtx", 0, 0); ++ return mutex; ++} ++ ++#if (defined(DWC_LINUX) && defined(CONFIG_DEBUG_MUTEXES)) ++#else ++void DWC_MUTEX_FREE(dwc_mutex_t *mutex) ++{ ++ DWC_FREE(mutex); ++} ++#endif ++ ++void DWC_MUTEX_LOCK(dwc_mutex_t *mutex) ++{ ++ lockmgr((struct lock *)mutex, LK_EXCLUSIVE, NULL); ++} ++ ++int DWC_MUTEX_TRYLOCK(dwc_mutex_t *mutex) ++{ ++ int status; ++ ++ status = lockmgr((struct lock *)mutex, LK_EXCLUSIVE | LK_NOWAIT, NULL); ++ return status == 0; ++} ++ ++void DWC_MUTEX_UNLOCK(dwc_mutex_t *mutex) ++{ ++ lockmgr((struct lock *)mutex, LK_RELEASE, NULL); ++} ++ ++ ++/* Timing */ ++ ++void DWC_UDELAY(uint32_t usecs) ++{ ++ DELAY(usecs); ++} ++ ++void DWC_MDELAY(uint32_t msecs) ++{ ++ do { ++ DELAY(1000); ++ } while (--msecs); ++} ++ ++void DWC_MSLEEP(uint32_t msecs) ++{ ++ struct timeval tv; ++ ++ tv.tv_sec = msecs / 1000; ++ tv.tv_usec = (msecs - tv.tv_sec * 1000) * 1000; ++ tsleep(&tv, 0, "dw3slp", tvtohz(&tv)); ++} ++ ++uint32_t DWC_TIME(void) ++{ ++ struct timeval tv; ++ ++ microuptime(&tv); // or getmicrouptime? (less precise, but faster) ++ return tv.tv_sec * 1000 + tv.tv_usec / 1000; ++} ++ ++ ++/* Timers */ ++ ++struct dwc_timer { ++ struct callout t; ++ char *name; ++ dwc_spinlock_t *lock; ++ dwc_timer_callback_t cb; ++ void *data; ++}; ++ ++dwc_timer_t *DWC_TIMER_ALLOC(char *name, dwc_timer_callback_t cb, void *data) ++{ ++ dwc_timer_t *t = DWC_ALLOC(sizeof(*t)); ++ ++ if (!t) { ++ DWC_ERROR("Cannot allocate memory for timer"); ++ return NULL; ++ } ++ ++ callout_init(&t->t); ++ ++ t->name = DWC_STRDUP(name); ++ if (!t->name) { ++ DWC_ERROR("Cannot allocate memory for timer->name"); ++ goto no_name; ++ } ++ ++ t->lock = DWC_SPINLOCK_ALLOC(); ++ if (!t->lock) { ++ DWC_ERROR("Cannot allocate memory for timer->lock"); ++ goto no_lock; ++ } ++ ++ t->cb = cb; ++ t->data = data; ++ ++ return t; ++ ++ no_lock: ++ DWC_FREE(t->name); ++ no_name: ++ DWC_FREE(t); ++ ++ return NULL; ++} ++ ++void DWC_TIMER_FREE(dwc_timer_t *timer) ++{ ++ callout_stop(&timer->t); ++ DWC_SPINLOCK_FREE(timer->lock); ++ DWC_FREE(timer->name); ++ DWC_FREE(timer); ++} ++ ++void DWC_TIMER_SCHEDULE(dwc_timer_t *timer, uint32_t time) ++{ ++ struct timeval tv; ++ ++ tv.tv_sec = time / 1000; ++ tv.tv_usec = (time - tv.tv_sec * 1000) * 1000; ++ callout_reset(&timer->t, tvtohz(&tv), timer->cb, timer->data); ++} ++ ++void DWC_TIMER_CANCEL(dwc_timer_t *timer) ++{ ++ callout_stop(&timer->t); ++} ++ ++ ++/* Wait Queues */ ++ ++struct dwc_waitq { ++ struct simplelock lock; ++ int abort; ++}; ++ ++dwc_waitq_t *DWC_WAITQ_ALLOC(void) ++{ ++ dwc_waitq_t *wq = DWC_ALLOC(sizeof(*wq)); ++ ++ if (!wq) { ++ DWC_ERROR("Cannot allocate memory for waitqueue"); ++ return NULL; ++ } ++ ++ simple_lock_init(&wq->lock); ++ wq->abort = 0; ++ ++ return wq; ++} ++ ++void DWC_WAITQ_FREE(dwc_waitq_t *wq) ++{ ++ DWC_FREE(wq); ++} ++ ++int32_t DWC_WAITQ_WAIT(dwc_waitq_t *wq, dwc_waitq_condition_t cond, void *data) ++{ ++ int ipl; ++ int result = 0; ++ ++ simple_lock(&wq->lock); ++ ipl = splbio(); ++ ++ /* Skip the sleep if already aborted or triggered */ ++ if (!wq->abort && !cond(data)) { ++ splx(ipl); ++ result = ltsleep(wq, PCATCH, "dw3wat", 0, &wq->lock); // infinite timeout ++ ipl = splbio(); ++ } ++ ++ if (result == 0) { // awoken ++ if (wq->abort) { ++ wq->abort = 0; ++ result = -DWC_E_ABORT; ++ } else { ++ result = 0; ++ } ++ ++ splx(ipl); ++ simple_unlock(&wq->lock); ++ } else { ++ wq->abort = 0; ++ splx(ipl); ++ simple_unlock(&wq->lock); ++ ++ if (result == ERESTART) { // signaled - restart ++ result = -DWC_E_RESTART; ++ } else { // signaled - must be EINTR ++ result = -DWC_E_ABORT; ++ } ++ } ++ ++ return result; ++} ++ ++int32_t DWC_WAITQ_WAIT_TIMEOUT(dwc_waitq_t *wq, dwc_waitq_condition_t cond, ++ void *data, int32_t msecs) ++{ ++ struct timeval tv, tv1, tv2; ++ int ipl; ++ int result = 0; ++ ++ tv.tv_sec = msecs / 1000; ++ tv.tv_usec = (msecs - tv.tv_sec * 1000) * 1000; ++ ++ simple_lock(&wq->lock); ++ ipl = splbio(); ++ ++ /* Skip the sleep if already aborted or triggered */ ++ if (!wq->abort && !cond(data)) { ++ splx(ipl); ++ getmicrouptime(&tv1); ++ result = ltsleep(wq, PCATCH, "dw3wto", tvtohz(&tv), &wq->lock); ++ getmicrouptime(&tv2); ++ ipl = splbio(); ++ } ++ ++ if (result == 0) { // awoken ++ if (wq->abort) { ++ wq->abort = 0; ++ splx(ipl); ++ simple_unlock(&wq->lock); ++ result = -DWC_E_ABORT; ++ } else { ++ splx(ipl); ++ simple_unlock(&wq->lock); ++ ++ tv2.tv_usec -= tv1.tv_usec; ++ if (tv2.tv_usec < 0) { ++ tv2.tv_usec += 1000000; ++ tv2.tv_sec--; ++ } ++ ++ tv2.tv_sec -= tv1.tv_sec; ++ result = tv2.tv_sec * 1000 + tv2.tv_usec / 1000; ++ result = msecs - result; ++ if (result <= 0) ++ result = 1; ++ } ++ } else { ++ wq->abort = 0; ++ splx(ipl); ++ simple_unlock(&wq->lock); ++ ++ if (result == ERESTART) { // signaled - restart ++ result = -DWC_E_RESTART; ++ ++ } else if (result == EINTR) { // signaled - interrupt ++ result = -DWC_E_ABORT; ++ ++ } else { // timed out ++ result = -DWC_E_TIMEOUT; ++ } ++ } ++ ++ return result; ++} ++ ++void DWC_WAITQ_TRIGGER(dwc_waitq_t *wq) ++{ ++ wakeup(wq); ++} ++ ++void DWC_WAITQ_ABORT(dwc_waitq_t *wq) ++{ ++ int ipl; ++ ++ simple_lock(&wq->lock); ++ ipl = splbio(); ++ wq->abort = 1; ++ wakeup(wq); ++ splx(ipl); ++ simple_unlock(&wq->lock); ++} ++ ++ ++/* Threading */ ++ ++struct dwc_thread { ++ struct proc *proc; ++ int abort; ++}; ++ ++dwc_thread_t *DWC_THREAD_RUN(dwc_thread_function_t func, char *name, void *data) ++{ ++ int retval; ++ dwc_thread_t *thread = DWC_ALLOC(sizeof(*thread)); ++ ++ if (!thread) { ++ return NULL; ++ } ++ ++ thread->abort = 0; ++ retval = kthread_create1((void (*)(void *))func, data, &thread->proc, ++ "%s", name); ++ if (retval) { ++ DWC_FREE(thread); ++ return NULL; ++ } ++ ++ return thread; ++} ++ ++int DWC_THREAD_STOP(dwc_thread_t *thread) ++{ ++ int retval; ++ ++ thread->abort = 1; ++ retval = tsleep(&thread->abort, 0, "dw3stp", 60 * hz); ++ ++ if (retval == 0) { ++ /* DWC_THREAD_EXIT() will free the thread struct */ ++ return 0; ++ } ++ ++ /* NOTE: We leak the thread struct if thread doesn't die */ ++ ++ if (retval == EWOULDBLOCK) { ++ return -DWC_E_TIMEOUT; ++ } ++ ++ return -DWC_E_UNKNOWN; ++} ++ ++dwc_bool_t DWC_THREAD_SHOULD_STOP(dwc_thread_t *thread) ++{ ++ return thread->abort; ++} ++ ++void DWC_THREAD_EXIT(dwc_thread_t *thread) ++{ ++ wakeup(&thread->abort); ++ DWC_FREE(thread); ++ kthread_exit(0); ++} ++ ++/* tasklets ++ - Runs in interrupt context (cannot sleep) ++ - Each tasklet runs on a single CPU ++ - Different tasklets can be running simultaneously on different CPUs ++ [ On NetBSD there is no corresponding mechanism, drivers don't have bottom- ++ halves. So we just call the callback directly from DWC_TASK_SCHEDULE() ] ++ */ ++struct dwc_tasklet { ++ dwc_tasklet_callback_t cb; ++ void *data; ++}; ++ ++static void tasklet_callback(void *data) ++{ ++ dwc_tasklet_t *task = (dwc_tasklet_t *)data; ++ ++ task->cb(task->data); ++} ++ ++dwc_tasklet_t *DWC_TASK_ALLOC(char *name, dwc_tasklet_callback_t cb, void *data) ++{ ++ dwc_tasklet_t *task = DWC_ALLOC(sizeof(*task)); ++ ++ if (task) { ++ task->cb = cb; ++ task->data = data; ++ } else { ++ DWC_ERROR("Cannot allocate memory for tasklet"); ++ } ++ ++ return task; ++} ++ ++void DWC_TASK_FREE(dwc_tasklet_t *task) ++{ ++ DWC_FREE(task); ++} ++ ++void DWC_TASK_SCHEDULE(dwc_tasklet_t *task) ++{ ++ tasklet_callback(task); ++} ++ ++ ++/* workqueues ++ - Runs in process context (can sleep) ++ */ ++typedef struct work_container { ++ dwc_work_callback_t cb; ++ void *data; ++ dwc_workq_t *wq; ++ char *name; ++ int hz; ++ struct work task; ++} work_container_t; ++ ++struct dwc_workq { ++ struct workqueue *taskq; ++ dwc_spinlock_t *lock; ++ dwc_waitq_t *waitq; ++ int pending; ++ struct work_container *container; ++}; ++ ++static void do_work(struct work *task, void *data) ++{ ++ dwc_workq_t *wq = (dwc_workq_t *)data; ++ work_container_t *container = wq->container; ++ dwc_irqflags_t flags; ++ ++ if (container->hz) { ++ tsleep(container, 0, "dw3wrk", container->hz); ++ } ++ ++ container->cb(container->data); ++ DWC_DEBUG("Work done: %s, container=%p", container->name, container); ++ ++ DWC_SPINLOCK_IRQSAVE(wq->lock, &flags); ++ if (container->name) ++ DWC_FREE(container->name); ++ DWC_FREE(container); ++ wq->pending--; ++ DWC_SPINUNLOCK_IRQRESTORE(wq->lock, flags); ++ DWC_WAITQ_TRIGGER(wq->waitq); ++} ++ ++static int work_done(void *data) ++{ ++ dwc_workq_t *workq = (dwc_workq_t *)data; ++ ++ return workq->pending == 0; ++} ++ ++int DWC_WORKQ_WAIT_WORK_DONE(dwc_workq_t *workq, int timeout) ++{ ++ return DWC_WAITQ_WAIT_TIMEOUT(workq->waitq, work_done, workq, timeout); ++} ++ ++dwc_workq_t *DWC_WORKQ_ALLOC(char *name) ++{ ++ int result; ++ dwc_workq_t *wq = DWC_ALLOC(sizeof(*wq)); ++ ++ if (!wq) { ++ DWC_ERROR("Cannot allocate memory for workqueue"); ++ return NULL; ++ } ++ ++ result = workqueue_create(&wq->taskq, name, do_work, wq, 0 /*PWAIT*/, ++ IPL_BIO, 0); ++ if (result) { ++ DWC_ERROR("Cannot create workqueue"); ++ goto no_taskq; ++ } ++ ++ wq->pending = 0; ++ ++ wq->lock = DWC_SPINLOCK_ALLOC(); ++ if (!wq->lock) { ++ DWC_ERROR("Cannot allocate memory for spinlock"); ++ goto no_lock; ++ } ++ ++ wq->waitq = DWC_WAITQ_ALLOC(); ++ if (!wq->waitq) { ++ DWC_ERROR("Cannot allocate memory for waitqueue"); ++ goto no_waitq; ++ } ++ ++ return wq; ++ ++ no_waitq: ++ DWC_SPINLOCK_FREE(wq->lock); ++ no_lock: ++ workqueue_destroy(wq->taskq); ++ no_taskq: ++ DWC_FREE(wq); ++ ++ return NULL; ++} ++ ++void DWC_WORKQ_FREE(dwc_workq_t *wq) ++{ ++#ifdef DEBUG ++ dwc_irqflags_t flags; ++ ++ DWC_SPINLOCK_IRQSAVE(wq->lock, &flags); ++ ++ if (wq->pending != 0) { ++ struct work_container *container = wq->container; ++ ++ DWC_ERROR("Destroying work queue with pending work"); ++ ++ if (container && container->name) { ++ DWC_ERROR("Work %s still pending", container->name); ++ } ++ } ++ ++ DWC_SPINUNLOCK_IRQRESTORE(wq->lock, flags); ++#endif ++ DWC_WAITQ_FREE(wq->waitq); ++ DWC_SPINLOCK_FREE(wq->lock); ++ workqueue_destroy(wq->taskq); ++ DWC_FREE(wq); ++} ++ ++void DWC_WORKQ_SCHEDULE(dwc_workq_t *wq, dwc_work_callback_t cb, void *data, ++ char *format, ...) ++{ ++ dwc_irqflags_t flags; ++ work_container_t *container; ++ static char name[128]; ++ va_list args; ++ ++ va_start(args, format); ++ DWC_VSNPRINTF(name, 128, format, args); ++ va_end(args); ++ ++ DWC_SPINLOCK_IRQSAVE(wq->lock, &flags); ++ wq->pending++; ++ DWC_SPINUNLOCK_IRQRESTORE(wq->lock, flags); ++ DWC_WAITQ_TRIGGER(wq->waitq); ++ ++ container = DWC_ALLOC_ATOMIC(sizeof(*container)); ++ if (!container) { ++ DWC_ERROR("Cannot allocate memory for container"); ++ return; ++ } ++ ++ container->name = DWC_STRDUP(name); ++ if (!container->name) { ++ DWC_ERROR("Cannot allocate memory for container->name"); ++ DWC_FREE(container); ++ return; ++ } ++ ++ container->cb = cb; ++ container->data = data; ++ container->wq = wq; ++ container->hz = 0; ++ wq->container = container; ++ ++ DWC_DEBUG("Queueing work: %s, container=%p", container->name, container); ++ workqueue_enqueue(wq->taskq, &container->task); ++} ++ ++void DWC_WORKQ_SCHEDULE_DELAYED(dwc_workq_t *wq, dwc_work_callback_t cb, ++ void *data, uint32_t time, char *format, ...) ++{ ++ dwc_irqflags_t flags; ++ work_container_t *container; ++ static char name[128]; ++ struct timeval tv; ++ va_list args; ++ ++ va_start(args, format); ++ DWC_VSNPRINTF(name, 128, format, args); ++ va_end(args); ++ ++ DWC_SPINLOCK_IRQSAVE(wq->lock, &flags); ++ wq->pending++; ++ DWC_SPINUNLOCK_IRQRESTORE(wq->lock, flags); ++ DWC_WAITQ_TRIGGER(wq->waitq); ++ ++ container = DWC_ALLOC_ATOMIC(sizeof(*container)); ++ if (!container) { ++ DWC_ERROR("Cannot allocate memory for container"); ++ return; ++ } ++ ++ container->name = DWC_STRDUP(name); ++ if (!container->name) { ++ DWC_ERROR("Cannot allocate memory for container->name"); ++ DWC_FREE(container); ++ return; ++ } ++ ++ container->cb = cb; ++ container->data = data; ++ container->wq = wq; ++ tv.tv_sec = time / 1000; ++ tv.tv_usec = (time - tv.tv_sec * 1000) * 1000; ++ container->hz = tvtohz(&tv); ++ wq->container = container; ++ ++ DWC_DEBUG("Queueing work: %s, container=%p", container->name, container); ++ workqueue_enqueue(wq->taskq, &container->task); ++} ++ ++int DWC_WORKQ_PENDING(dwc_workq_t *wq) ++{ ++ return wq->pending; ++} +diff --git a/drivers/usb/host/dwc_common_port/dwc_crypto.c b/drivers/usb/host/dwc_common_port/dwc_crypto.c +new file mode 100644 +index 0000000..3b03532 +--- /dev/null ++++ b/drivers/usb/host/dwc_common_port/dwc_crypto.c +@@ -0,0 +1,308 @@ ++/* ========================================================================= ++ * $File: //dwh/usb_iip/dev/software/dwc_common_port_2/dwc_crypto.c $ ++ * $Revision: #5 $ ++ * $Date: 2010/09/28 $ ++ * $Change: 1596182 $ ++ * ++ * Synopsys Portability Library Software and documentation ++ * (hereinafter, "Software") is an Unsupported proprietary work of ++ * Synopsys, Inc. unless otherwise expressly agreed to in writing ++ * between Synopsys and you. ++ * ++ * The Software IS NOT an item of Licensed Software or Licensed Product ++ * under any End User Software License Agreement or Agreement for ++ * Licensed Product with Synopsys or any supplement thereto. You are ++ * permitted to use and redistribute this Software in source and binary ++ * forms, with or without modification, provided that redistributions ++ * of source code must retain this notice. You may not view, use, ++ * disclose, copy or distribute this file or any information contained ++ * herein except pursuant to this license grant from Synopsys. If you ++ * do not agree with this notice, including the disclaimer below, then ++ * you are not authorized to use the Software. ++ * ++ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" ++ * BASIS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ++ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS ++ * FOR A PARTICULAR PURPOSE ARE HEREBY DISCLAIMED. IN NO EVENT SHALL ++ * SYNOPSYS 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. ++ * ========================================================================= */ ++ ++/** @file ++ * This file contains the WUSB cryptographic routines. ++ */ ++ ++#ifdef DWC_CRYPTOLIB ++ ++#include "dwc_crypto.h" ++#include "usb.h" ++ ++#ifdef DEBUG ++static inline void dump_bytes(char *name, uint8_t *bytes, int len) ++{ ++ int i; ++ DWC_PRINTF("%s: ", name); ++ for (i=0; i<len; i++) { ++ DWC_PRINTF("%02x ", bytes[i]); ++ } ++ DWC_PRINTF("\n"); ++} ++#else ++#define dump_bytes(x...) ++#endif ++ ++/* Display a block */ ++void show_block(const u8 *blk, const char *prefix, const char *suffix, int a) ++{ ++#ifdef DWC_DEBUG_CRYPTO ++ int i, blksize = 16; ++ ++ DWC_DEBUG("%s", prefix); ++ ++ if (suffix == NULL) { ++ suffix = "\n"; ++ blksize = a; ++ } ++ ++ for (i = 0; i < blksize; i++) ++ DWC_PRINT("%02x%s", *blk++, ((i & 3) == 3) ? " " : " "); ++ DWC_PRINT(suffix); ++#endif ++} ++ ++/** ++ * Encrypts an array of bytes using the AES encryption engine. ++ * If <code>dst</code> == <code>src</code>, then the bytes will be encrypted ++ * in-place. ++ * ++ * @return 0 on success, negative error code on error. ++ */ ++int dwc_wusb_aes_encrypt(u8 *src, u8 *key, u8 *dst) ++{ ++ u8 block_t[16]; ++ DWC_MEMSET(block_t, 0, 16); ++ ++ return DWC_AES_CBC(src, 16, key, 16, block_t, dst); ++} ++ ++/** ++ * The CCM-MAC-FUNCTION described in section 6.5 of the WUSB spec. ++ * This function takes a data string and returns the encrypted CBC ++ * Counter-mode MIC. ++ * ++ * @param key The 128-bit symmetric key. ++ * @param nonce The CCM nonce. ++ * @param label The unique 14-byte ASCII text label. ++ * @param bytes The byte array to be encrypted. ++ * @param len Length of the byte array. ++ * @param result Byte array to receive the 8-byte encrypted MIC. ++ */ ++void dwc_wusb_cmf(u8 *key, u8 *nonce, ++ char *label, u8 *bytes, int len, u8 *result) ++{ ++ u8 block_m[16]; ++ u8 block_x[16]; ++ u8 block_t[8]; ++ int idx, blkNum; ++ u16 la = (u16)(len + 14); ++ ++ /* Set the AES-128 key */ ++ //dwc_aes_setkey(tfm, key, 16); ++ ++ /* Fill block B0 from flags = 0x59, N, and l(m) = 0 */ ++ block_m[0] = 0x59; ++ for (idx = 0; idx < 13; idx++) ++ block_m[idx + 1] = nonce[idx]; ++ block_m[14] = 0; ++ block_m[15] = 0; ++ ++ /* Produce the CBC IV */ ++ dwc_wusb_aes_encrypt(block_m, key, block_x); ++ show_block(block_m, "CBC IV in: ", "\n", 0); ++ show_block(block_x, "CBC IV out:", "\n", 0); ++ ++ /* Fill block B1 from l(a) = Blen + 14, and A */ ++ block_x[0] ^= (u8)(la >> 8); ++ block_x[1] ^= (u8)la; ++ for (idx = 0; idx < 14; idx++) ++ block_x[idx + 2] ^= label[idx]; ++ show_block(block_x, "After xor: ", "b1\n", 16); ++ ++ dwc_wusb_aes_encrypt(block_x, key, block_x); ++ show_block(block_x, "After AES: ", "b1\n", 16); ++ ++ idx = 0; ++ blkNum = 0; ++ ++ /* Fill remaining blocks with B */ ++ while (len-- > 0) { ++ block_x[idx] ^= *bytes++; ++ if (++idx >= 16) { ++ idx = 0; ++ show_block(block_x, "After xor: ", "\n", blkNum); ++ dwc_wusb_aes_encrypt(block_x, key, block_x); ++ show_block(block_x, "After AES: ", "\n", blkNum); ++ blkNum++; ++ } ++ } ++ ++ /* Handle partial last block */ ++ if (idx > 0) { ++ show_block(block_x, "After xor: ", "\n", blkNum); ++ dwc_wusb_aes_encrypt(block_x, key, block_x); ++ show_block(block_x, "After AES: ", "\n", blkNum); ++ } ++ ++ /* Save the MIC tag */ ++ DWC_MEMCPY(block_t, block_x, 8); ++ show_block(block_t, "MIC tag : ", NULL, 8); ++ ++ /* Fill block A0 from flags = 0x01, N, and counter = 0 */ ++ block_m[0] = 0x01; ++ block_m[14] = 0; ++ block_m[15] = 0; ++ ++ /* Encrypt the counter */ ++ dwc_wusb_aes_encrypt(block_m, key, block_x); ++ show_block(block_x, "CTR[MIC] : ", NULL, 8); ++ ++ /* XOR with MIC tag */ ++ for (idx = 0; idx < 8; idx++) { ++ block_t[idx] ^= block_x[idx]; ++ } ++ ++ /* Return result to caller */ ++ DWC_MEMCPY(result, block_t, 8); ++ show_block(result, "CCM-MIC : ", NULL, 8); ++ ++} ++ ++/** ++ * The PRF function described in section 6.5 of the WUSB spec. This function ++ * concatenates MIC values returned from dwc_cmf() to create a value of ++ * the requested length. ++ * ++ * @param prf_len Length of the PRF function in bits (64, 128, or 256). ++ * @param key, nonce, label, bytes, len Same as for dwc_cmf(). ++ * @param result Byte array to receive the result. ++ */ ++void dwc_wusb_prf(int prf_len, u8 *key, ++ u8 *nonce, char *label, u8 *bytes, int len, u8 *result) ++{ ++ int i; ++ ++ nonce[0] = 0; ++ for (i = 0; i < prf_len >> 6; i++, nonce[0]++) { ++ dwc_wusb_cmf(key, nonce, label, bytes, len, result); ++ result += 8; ++ } ++} ++ ++/** ++ * Fills in CCM Nonce per the WUSB spec. ++ * ++ * @param[in] haddr Host address. ++ * @param[in] daddr Device address. ++ * @param[in] tkid Session Key(PTK) identifier. ++ * @param[out] nonce Pointer to where the CCM Nonce output is to be written. ++ */ ++void dwc_wusb_fill_ccm_nonce(uint16_t haddr, uint16_t daddr, uint8_t *tkid, ++ uint8_t *nonce) ++{ ++ ++ DWC_DEBUG("%s %x %x\n", __func__, daddr, haddr); ++ ++ DWC_MEMSET(&nonce[0], 0, 16); ++ ++ DWC_MEMCPY(&nonce[6], tkid, 3); ++ nonce[9] = daddr & 0xFF; ++ nonce[10] = (daddr >> 8) & 0xFF; ++ nonce[11] = haddr & 0xFF; ++ nonce[12] = (haddr >> 8) & 0xFF; ++ ++ dump_bytes("CCM nonce", nonce, 16); ++} ++ ++/** ++ * Generates a 16-byte cryptographic-grade random number for the Host/Device ++ * Nonce. ++ */ ++void dwc_wusb_gen_nonce(uint16_t addr, uint8_t *nonce) ++{ ++ uint8_t inonce[16]; ++ uint32_t temp[4]; ++ ++ /* Fill in the Nonce */ ++ DWC_MEMSET(&inonce[0], 0, sizeof(inonce)); ++ inonce[9] = addr & 0xFF; ++ inonce[10] = (addr >> 8) & 0xFF; ++ inonce[11] = inonce[9]; ++ inonce[12] = inonce[10]; ++ ++ /* Collect "randomness samples" */ ++ DWC_RANDOM_BYTES((uint8_t *)temp, 16); ++ ++ dwc_wusb_prf_128((uint8_t *)temp, nonce, ++ "Random Numbers", (uint8_t *)temp, sizeof(temp), ++ nonce); ++} ++ ++/** ++ * Generates the Session Key (PTK) and Key Confirmation Key (KCK) per the ++ * WUSB spec. ++ * ++ * @param[in] ccm_nonce Pointer to CCM Nonce. ++ * @param[in] mk Master Key to derive the session from ++ * @param[in] hnonce Pointer to Host Nonce. ++ * @param[in] dnonce Pointer to Device Nonce. ++ * @param[out] kck Pointer to where the KCK output is to be written. ++ * @param[out] ptk Pointer to where the PTK output is to be written. ++ */ ++void dwc_wusb_gen_key(uint8_t *ccm_nonce, uint8_t *mk, uint8_t *hnonce, ++ uint8_t *dnonce, uint8_t *kck, uint8_t *ptk) ++{ ++ uint8_t idata[32]; ++ uint8_t odata[32]; ++ ++ dump_bytes("ck", mk, 16); ++ dump_bytes("hnonce", hnonce, 16); ++ dump_bytes("dnonce", dnonce, 16); ++ ++ /* The data is the HNonce and DNonce concatenated */ ++ DWC_MEMCPY(&idata[0], hnonce, 16); ++ DWC_MEMCPY(&idata[16], dnonce, 16); ++ ++ dwc_wusb_prf_256(mk, ccm_nonce, "Pair-wise keys", idata, 32, odata); ++ ++ /* Low 16 bytes of the result is the KCK, high 16 is the PTK */ ++ DWC_MEMCPY(kck, &odata[0], 16); ++ DWC_MEMCPY(ptk, &odata[16], 16); ++ ++ dump_bytes("kck", kck, 16); ++ dump_bytes("ptk", ptk, 16); ++} ++ ++/** ++ * Generates the Message Integrity Code over the Handshake data per the ++ * WUSB spec. ++ * ++ * @param ccm_nonce Pointer to CCM Nonce. ++ * @param kck Pointer to Key Confirmation Key. ++ * @param data Pointer to Handshake data to be checked. ++ * @param mic Pointer to where the MIC output is to be written. ++ */ ++void dwc_wusb_gen_mic(uint8_t *ccm_nonce, uint8_t *kck, ++ uint8_t *data, uint8_t *mic) ++{ ++ ++ dwc_wusb_prf_64(kck, ccm_nonce, "out-of-bandMIC", ++ data, WUSB_HANDSHAKE_LEN_FOR_MIC, mic); ++} ++ ++#endif /* DWC_CRYPTOLIB */ +diff --git a/drivers/usb/host/dwc_common_port/dwc_crypto.h b/drivers/usb/host/dwc_common_port/dwc_crypto.h +new file mode 100644 +index 0000000..26fcddc +--- /dev/null ++++ b/drivers/usb/host/dwc_common_port/dwc_crypto.h +@@ -0,0 +1,111 @@ ++/* ========================================================================= ++ * $File: //dwh/usb_iip/dev/software/dwc_common_port_2/dwc_crypto.h $ ++ * $Revision: #3 $ ++ * $Date: 2010/09/28 $ ++ * $Change: 1596182 $ ++ * ++ * Synopsys Portability Library Software and documentation ++ * (hereinafter, "Software") is an Unsupported proprietary work of ++ * Synopsys, Inc. unless otherwise expressly agreed to in writing ++ * between Synopsys and you. ++ * ++ * The Software IS NOT an item of Licensed Software or Licensed Product ++ * under any End User Software License Agreement or Agreement for ++ * Licensed Product with Synopsys or any supplement thereto. You are ++ * permitted to use and redistribute this Software in source and binary ++ * forms, with or without modification, provided that redistributions ++ * of source code must retain this notice. You may not view, use, ++ * disclose, copy or distribute this file or any information contained ++ * herein except pursuant to this license grant from Synopsys. If you ++ * do not agree with this notice, including the disclaimer below, then ++ * you are not authorized to use the Software. ++ * ++ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" ++ * BASIS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ++ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS ++ * FOR A PARTICULAR PURPOSE ARE HEREBY DISCLAIMED. IN NO EVENT SHALL ++ * SYNOPSYS 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. ++ * ========================================================================= */ ++ ++#ifndef _DWC_CRYPTO_H_ ++#define _DWC_CRYPTO_H_ ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++/** @file ++ * ++ * This file contains declarations for the WUSB Cryptographic routines as ++ * defined in the WUSB spec. They are only to be used internally by the DWC UWB ++ * modules. ++ */ ++ ++#include "dwc_os.h" ++ ++int dwc_wusb_aes_encrypt(u8 *src, u8 *key, u8 *dst); ++ ++void dwc_wusb_cmf(u8 *key, u8 *nonce, ++ char *label, u8 *bytes, int len, u8 *result); ++void dwc_wusb_prf(int prf_len, u8 *key, ++ u8 *nonce, char *label, u8 *bytes, int len, u8 *result); ++ ++/** ++ * The PRF-64 function described in section 6.5 of the WUSB spec. ++ * ++ * @param key, nonce, label, bytes, len, result Same as for dwc_prf(). ++ */ ++static inline void dwc_wusb_prf_64(u8 *key, u8 *nonce, ++ char *label, u8 *bytes, int len, u8 *result) ++{ ++ dwc_wusb_prf(64, key, nonce, label, bytes, len, result); ++} ++ ++/** ++ * The PRF-128 function described in section 6.5 of the WUSB spec. ++ * ++ * @param key, nonce, label, bytes, len, result Same as for dwc_prf(). ++ */ ++static inline void dwc_wusb_prf_128(u8 *key, u8 *nonce, ++ char *label, u8 *bytes, int len, u8 *result) ++{ ++ dwc_wusb_prf(128, key, nonce, label, bytes, len, result); ++} ++ ++/** ++ * The PRF-256 function described in section 6.5 of the WUSB spec. ++ * ++ * @param key, nonce, label, bytes, len, result Same as for dwc_prf(). ++ */ ++static inline void dwc_wusb_prf_256(u8 *key, u8 *nonce, ++ char *label, u8 *bytes, int len, u8 *result) ++{ ++ dwc_wusb_prf(256, key, nonce, label, bytes, len, result); ++} ++ ++ ++void dwc_wusb_fill_ccm_nonce(uint16_t haddr, uint16_t daddr, uint8_t *tkid, ++ uint8_t *nonce); ++void dwc_wusb_gen_nonce(uint16_t addr, ++ uint8_t *nonce); ++ ++void dwc_wusb_gen_key(uint8_t *ccm_nonce, uint8_t *mk, ++ uint8_t *hnonce, uint8_t *dnonce, ++ uint8_t *kck, uint8_t *ptk); ++ ++ ++void dwc_wusb_gen_mic(uint8_t *ccm_nonce, uint8_t ++ *kck, uint8_t *data, uint8_t *mic); ++ ++#ifdef __cplusplus ++} ++#endif ++ ++#endif /* _DWC_CRYPTO_H_ */ +diff --git a/drivers/usb/host/dwc_common_port/dwc_dh.c b/drivers/usb/host/dwc_common_port/dwc_dh.c +new file mode 100644 +index 0000000..2b429a3 +--- /dev/null ++++ b/drivers/usb/host/dwc_common_port/dwc_dh.c +@@ -0,0 +1,291 @@ ++/* ========================================================================= ++ * $File: //dwh/usb_iip/dev/software/dwc_common_port_2/dwc_dh.c $ ++ * $Revision: #3 $ ++ * $Date: 2010/09/28 $ ++ * $Change: 1596182 $ ++ * ++ * Synopsys Portability Library Software and documentation ++ * (hereinafter, "Software") is an Unsupported proprietary work of ++ * Synopsys, Inc. unless otherwise expressly agreed to in writing ++ * between Synopsys and you. ++ * ++ * The Software IS NOT an item of Licensed Software or Licensed Product ++ * under any End User Software License Agreement or Agreement for ++ * Licensed Product with Synopsys or any supplement thereto. You are ++ * permitted to use and redistribute this Software in source and binary ++ * forms, with or without modification, provided that redistributions ++ * of source code must retain this notice. You may not view, use, ++ * disclose, copy or distribute this file or any information contained ++ * herein except pursuant to this license grant from Synopsys. If you ++ * do not agree with this notice, including the disclaimer below, then ++ * you are not authorized to use the Software. ++ * ++ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" ++ * BASIS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ++ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS ++ * FOR A PARTICULAR PURPOSE ARE HEREBY DISCLAIMED. IN NO EVENT SHALL ++ * SYNOPSYS 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. ++ * ========================================================================= */ ++#ifdef DWC_CRYPTOLIB ++ ++#ifndef CONFIG_MACH_IPMATE ++ ++#include "dwc_dh.h" ++#include "dwc_modpow.h" ++ ++#ifdef DEBUG ++/* This function prints out a buffer in the format described in the Association ++ * Model specification. */ ++static void dh_dump(char *str, void *_num, int len) ++{ ++ uint8_t *num = _num; ++ int i; ++ DWC_PRINTF("%s\n", str); ++ for (i = 0; i < len; i ++) { ++ DWC_PRINTF("%02x", num[i]); ++ if (((i + 1) % 2) == 0) DWC_PRINTF(" "); ++ if (((i + 1) % 26) == 0) DWC_PRINTF("\n"); ++ } ++ ++ DWC_PRINTF("\n"); ++} ++#else ++#define dh_dump(_x...) do {; } while(0) ++#endif ++ ++/* Constant g value */ ++static __u32 dh_g[] = { ++ 0x02000000, ++}; ++ ++/* Constant p value */ ++static __u32 dh_p[] = { ++ 0xFFFFFFFF, 0xFFFFFFFF, 0xA2DA0FC9, 0x34C26821, 0x8B62C6C4, 0xD11CDC80, 0x084E0229, 0x74CC678A, ++ 0xA6BE0B02, 0x229B133B, 0x79084A51, 0xDD04348E, 0xB31995EF, 0x1B433ACD, 0x6D0A2B30, 0x37145FF2, ++ 0x6D35E14F, 0x45C2516D, 0x76B585E4, 0xC67E5E62, 0xE9424CF4, 0x6BED37A6, 0xB65CFF0B, 0xEDB706F4, ++ 0xFB6B38EE, 0xA59F895A, 0x11249FAE, 0xE61F4B7C, 0x51662849, 0x3D5BE4EC, 0xB87C00C2, 0x05BF63A1, ++ 0x3648DA98, 0x9AD3551C, 0xA83F1669, 0x5FCF24FD, 0x235D6583, 0x96ADA3DC, 0x56F3621C, 0xBB528520, ++ 0x0729D59E, 0x6D969670, 0x4E350C67, 0x0498BC4A, 0x086C74F1, 0x7C2118CA, 0x465E9032, 0x3BCE362E, ++ 0x2C779EE3, 0x03860E18, 0xA283279B, 0x8FA207EC, 0xF05DC5B5, 0xC9524C6F, 0xF6CB2BDE, 0x18175895, ++ 0x7C499539, 0xE56A95EA, 0x1826D215, 0x1005FA98, 0x5A8E7215, 0x2DC4AA8A, 0x0D1733AD, 0x337A5004, ++ 0xAB2155A8, 0x64BA1CDF, 0x0485FBEC, 0x0AEFDB58, 0x5771EA8A, 0x7D0C065D, 0x850F97B3, 0xC7E4E1A6, ++ 0x8CAEF5AB, 0xD73309DB, 0xE0948C1E, 0x9D61254A, 0x26D2E3CE, 0x6BEED21A, 0x06FA2FF1, 0x64088AD9, ++ 0x730276D8, 0x646AC83E, 0x182B1F52, 0x0C207B17, 0x5717E1BB, 0x6C5D617A, 0xC0880977, 0xE246D9BA, ++ 0xA04FE208, 0x31ABE574, 0xFC5BDB43, 0x8E10FDE0, 0x20D1824B, 0xCAD23AA9, 0xFFFFFFFF, 0xFFFFFFFF, ++}; ++ ++static void dh_swap_bytes(void *_in, void *_out, uint32_t len) ++{ ++ uint8_t *in = _in; ++ uint8_t *out = _out; ++ int i; ++ for (i=0; i<len; i++) { ++ out[i] = in[len-1-i]; ++ } ++} ++ ++/* Computes the modular exponentiation (num^exp % mod). num, exp, and mod are ++ * big endian numbers of size len, in bytes. Each len value must be a multiple ++ * of 4. */ ++int dwc_dh_modpow(void *mem_ctx, void *num, uint32_t num_len, ++ void *exp, uint32_t exp_len, ++ void *mod, uint32_t mod_len, ++ void *out) ++{ ++ /* modpow() takes little endian numbers. AM uses big-endian. This ++ * function swaps bytes of numbers before passing onto modpow. */ ++ ++ int retval = 0; ++ uint32_t *result; ++ ++ uint32_t *bignum_num = dwc_alloc(mem_ctx, num_len + 4); ++ uint32_t *bignum_exp = dwc_alloc(mem_ctx, exp_len + 4); ++ uint32_t *bignum_mod = dwc_alloc(mem_ctx, mod_len + 4); ++ ++ dh_swap_bytes(num, &bignum_num[1], num_len); ++ bignum_num[0] = num_len / 4; ++ ++ dh_swap_bytes(exp, &bignum_exp[1], exp_len); ++ bignum_exp[0] = exp_len / 4; ++ ++ dh_swap_bytes(mod, &bignum_mod[1], mod_len); ++ bignum_mod[0] = mod_len / 4; ++ ++ result = dwc_modpow(mem_ctx, bignum_num, bignum_exp, bignum_mod); ++ if (!result) { ++ retval = -1; ++ goto dh_modpow_nomem; ++ } ++ ++ dh_swap_bytes(&result[1], out, result[0] * 4); ++ dwc_free(mem_ctx, result); ++ ++ dh_modpow_nomem: ++ dwc_free(mem_ctx, bignum_num); ++ dwc_free(mem_ctx, bignum_exp); ++ dwc_free(mem_ctx, bignum_mod); ++ return retval; ++} ++ ++ ++int dwc_dh_pk(void *mem_ctx, uint8_t nd, uint8_t *exp, uint8_t *pk, uint8_t *hash) ++{ ++ int retval; ++ uint8_t m3[385]; ++ ++#ifndef DH_TEST_VECTORS ++ DWC_RANDOM_BYTES(exp, 32); ++#endif ++ ++ /* Compute the pkd */ ++ if ((retval = dwc_dh_modpow(mem_ctx, dh_g, 4, ++ exp, 32, ++ dh_p, 384, pk))) { ++ return retval; ++ } ++ ++ m3[384] = nd; ++ DWC_MEMCPY(&m3[0], pk, 384); ++ DWC_SHA256(m3, 385, hash); ++ ++ dh_dump("PK", pk, 384); ++ dh_dump("SHA-256(M3)", hash, 32); ++ return 0; ++} ++ ++int dwc_dh_derive_keys(void *mem_ctx, uint8_t nd, uint8_t *pkh, uint8_t *pkd, ++ uint8_t *exp, int is_host, ++ char *dd, uint8_t *ck, uint8_t *kdk) ++{ ++ int retval; ++ uint8_t mv[784]; ++ uint8_t sha_result[32]; ++ uint8_t dhkey[384]; ++ uint8_t shared_secret[384]; ++ char *message; ++ uint32_t vd; ++ ++ uint8_t *pk; ++ ++ if (is_host) { ++ pk = pkd; ++ } ++ else { ++ pk = pkh; ++ } ++ ++ if ((retval = dwc_dh_modpow(mem_ctx, pk, 384, ++ exp, 32, ++ dh_p, 384, shared_secret))) { ++ return retval; ++ } ++ dh_dump("Shared Secret", shared_secret, 384); ++ ++ DWC_SHA256(shared_secret, 384, dhkey); ++ dh_dump("DHKEY", dhkey, 384); ++ ++ DWC_MEMCPY(&mv[0], pkd, 384); ++ DWC_MEMCPY(&mv[384], pkh, 384); ++ DWC_MEMCPY(&mv[768], "displayed digest", 16); ++ dh_dump("MV", mv, 784); ++ ++ DWC_SHA256(mv, 784, sha_result); ++ dh_dump("SHA-256(MV)", sha_result, 32); ++ dh_dump("First 32-bits of SHA-256(MV)", sha_result, 4); ++ ++ dh_swap_bytes(sha_result, &vd, 4); ++#ifdef DEBUG ++ DWC_PRINTF("Vd (decimal) = %d\n", vd); ++#endif ++ ++ switch (nd) { ++ case 2: ++ vd = vd % 100; ++ DWC_SPRINTF(dd, "%02d", vd); ++ break; ++ case 3: ++ vd = vd % 1000; ++ DWC_SPRINTF(dd, "%03d", vd); ++ break; ++ case 4: ++ vd = vd % 10000; ++ DWC_SPRINTF(dd, "%04d", vd); ++ break; ++ } ++#ifdef DEBUG ++ DWC_PRINTF("Display Digits: %s\n", dd); ++#endif ++ ++ message = "connection key"; ++ DWC_HMAC_SHA256(message, DWC_STRLEN(message), dhkey, 32, sha_result); ++ dh_dump("HMAC(SHA-256, DHKey, connection key)", sha_result, 32); ++ DWC_MEMCPY(ck, sha_result, 16); ++ ++ message = "key derivation key"; ++ DWC_HMAC_SHA256(message, DWC_STRLEN(message), dhkey, 32, sha_result); ++ dh_dump("HMAC(SHA-256, DHKey, key derivation key)", sha_result, 32); ++ DWC_MEMCPY(kdk, sha_result, 32); ++ ++ return 0; ++} ++ ++ ++#ifdef DH_TEST_VECTORS ++ ++static __u8 dh_a[] = { ++ 0x44, 0x00, 0x51, 0xd6, ++ 0xf0, 0xb5, 0x5e, 0xa9, ++ 0x67, 0xab, 0x31, 0xc6, ++ 0x8a, 0x8b, 0x5e, 0x37, ++ 0xd9, 0x10, 0xda, 0xe0, ++ 0xe2, 0xd4, 0x59, 0xa4, ++ 0x86, 0x45, 0x9c, 0xaa, ++ 0xdf, 0x36, 0x75, 0x16, ++}; ++ ++static __u8 dh_b[] = { ++ 0x5d, 0xae, 0xc7, 0x86, ++ 0x79, 0x80, 0xa3, 0x24, ++ 0x8c, 0xe3, 0x57, 0x8f, ++ 0xc7, 0x5f, 0x1b, 0x0f, ++ 0x2d, 0xf8, 0x9d, 0x30, ++ 0x6f, 0xa4, 0x52, 0xcd, ++ 0xe0, 0x7a, 0x04, 0x8a, ++ 0xde, 0xd9, 0x26, 0x56, ++}; ++ ++void dwc_run_dh_test_vectors(void *mem_ctx) ++{ ++ uint8_t pkd[384]; ++ uint8_t pkh[384]; ++ uint8_t hashd[32]; ++ uint8_t hashh[32]; ++ uint8_t ck[16]; ++ uint8_t kdk[32]; ++ char dd[5]; ++ ++ DWC_PRINTF("\n\n\nDH_TEST_VECTORS\n\n"); ++ ++ /* compute the PKd and SHA-256(PKd || Nd) */ ++ DWC_PRINTF("Computing PKd\n"); ++ dwc_dh_pk(mem_ctx, 2, dh_a, pkd, hashd); ++ ++ /* compute the PKd and SHA-256(PKh || Nd) */ ++ DWC_PRINTF("Computing PKh\n"); ++ dwc_dh_pk(mem_ctx, 2, dh_b, pkh, hashh); ++ ++ /* compute the dhkey */ ++ dwc_dh_derive_keys(mem_ctx, 2, pkh, pkd, dh_a, 0, dd, ck, kdk); ++} ++#endif /* DH_TEST_VECTORS */ ++ ++#endif /* !CONFIG_MACH_IPMATE */ ++ ++#endif /* DWC_CRYPTOLIB */ +diff --git a/drivers/usb/host/dwc_common_port/dwc_dh.h b/drivers/usb/host/dwc_common_port/dwc_dh.h +new file mode 100644 +index 0000000..25c1cc0 +--- /dev/null ++++ b/drivers/usb/host/dwc_common_port/dwc_dh.h +@@ -0,0 +1,106 @@ ++/* ========================================================================= ++ * $File: //dwh/usb_iip/dev/software/dwc_common_port_2/dwc_dh.h $ ++ * $Revision: #4 $ ++ * $Date: 2010/09/28 $ ++ * $Change: 1596182 $ ++ * ++ * Synopsys Portability Library Software and documentation ++ * (hereinafter, "Software") is an Unsupported proprietary work of ++ * Synopsys, Inc. unless otherwise expressly agreed to in writing ++ * between Synopsys and you. ++ * ++ * The Software IS NOT an item of Licensed Software or Licensed Product ++ * under any End User Software License Agreement or Agreement for ++ * Licensed Product with Synopsys or any supplement thereto. You are ++ * permitted to use and redistribute this Software in source and binary ++ * forms, with or without modification, provided that redistributions ++ * of source code must retain this notice. You may not view, use, ++ * disclose, copy or distribute this file or any information contained ++ * herein except pursuant to this license grant from Synopsys. If you ++ * do not agree with this notice, including the disclaimer below, then ++ * you are not authorized to use the Software. ++ * ++ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" ++ * BASIS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ++ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS ++ * FOR A PARTICULAR PURPOSE ARE HEREBY DISCLAIMED. IN NO EVENT SHALL ++ * SYNOPSYS 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. ++ * ========================================================================= */ ++#ifndef _DWC_DH_H_ ++#define _DWC_DH_H_ ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++#include "dwc_os.h" ++ ++/** @file ++ * ++ * This file defines the common functions on device and host for performing ++ * numeric association as defined in the WUSB spec. They are only to be ++ * used internally by the DWC UWB modules. */ ++ ++extern int dwc_dh_sha256(uint8_t *message, uint32_t len, uint8_t *out); ++extern int dwc_dh_hmac_sha256(uint8_t *message, uint32_t messagelen, ++ uint8_t *key, uint32_t keylen, ++ uint8_t *out); ++extern int dwc_dh_modpow(void *mem_ctx, void *num, uint32_t num_len, ++ void *exp, uint32_t exp_len, ++ void *mod, uint32_t mod_len, ++ void *out); ++ ++/** Computes PKD or PKH, and SHA-256(PKd || Nd) ++ * ++ * PK = g^exp mod p. ++ * ++ * Input: ++ * Nd = Number of digits on the device. ++ * ++ * Output: ++ * exp = A 32-byte buffer to be filled with a randomly generated number. ++ * used as either A or B. ++ * pk = A 384-byte buffer to be filled with the PKH or PKD. ++ * hash = A 32-byte buffer to be filled with SHA-256(PK || ND). ++ */ ++extern int dwc_dh_pk(void *mem_ctx, uint8_t nd, uint8_t *exp, uint8_t *pkd, uint8_t *hash); ++ ++/** Computes the DHKEY, and VD. ++ * ++ * If called from host, then it will comput DHKEY=PKD^exp % p. ++ * If called from device, then it will comput DHKEY=PKH^exp % p. ++ * ++ * Input: ++ * pkd = The PKD value. ++ * pkh = The PKH value. ++ * exp = The A value (if device) or B value (if host) generated in dwc_wudev_dh_pk. ++ * is_host = Set to non zero if a WUSB host is calling this function. ++ * ++ * Output: ++ ++ * dd = A pointer to an buffer to be set to the displayed digits string to be shown ++ * to the user. This buffer should be at 5 bytes long to hold 4 digits plus a ++ * null termination character. This buffer can be used directly for display. ++ * ck = A 16-byte buffer to be filled with the CK. ++ * kdk = A 32-byte buffer to be filled with the KDK. ++ */ ++extern int dwc_dh_derive_keys(void *mem_ctx, uint8_t nd, uint8_t *pkh, uint8_t *pkd, ++ uint8_t *exp, int is_host, ++ char *dd, uint8_t *ck, uint8_t *kdk); ++ ++#ifdef DH_TEST_VECTORS ++extern void dwc_run_dh_test_vectors(void); ++#endif ++ ++#ifdef __cplusplus ++} ++#endif ++ ++#endif /* _DWC_DH_H_ */ +diff --git a/drivers/usb/host/dwc_common_port/dwc_list.h b/drivers/usb/host/dwc_common_port/dwc_list.h +new file mode 100644 +index 0000000..4ce560d +--- /dev/null ++++ b/drivers/usb/host/dwc_common_port/dwc_list.h +@@ -0,0 +1,594 @@ ++/* $OpenBSD: queue.h,v 1.26 2004/05/04 16:59:32 grange Exp $ */ ++/* $NetBSD: queue.h,v 1.11 1996/05/16 05:17:14 mycroft Exp $ */ ++ ++/* ++ * Copyright (c) 1991, 1993 ++ * The Regents of the University of California. 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. ++ * 3. Neither the name of the University nor the names of its contributors ++ * may be used to endorse or promote products derived from this software ++ * without specific prior written permission. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. ++ * ++ * @(#)queue.h 8.5 (Berkeley) 8/20/94 ++ */ ++ ++#ifndef _DWC_LIST_H_ ++#define _DWC_LIST_H_ ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++/** @file ++ * ++ * This file defines linked list operations. It is derived from BSD with ++ * only the MACRO names being prefixed with DWC_. This is because a few of ++ * these names conflict with those on Linux. For documentation on use, see the ++ * inline comments in the source code. The original license for this source ++ * code applies and is preserved in the dwc_list.h source file. ++ */ ++ ++/* ++ * This file defines five types of data structures: singly-linked lists, ++ * lists, simple queues, tail queues, and circular queues. ++ * ++ * ++ * A singly-linked list is headed by a single forward pointer. The elements ++ * are singly linked for minimum space and pointer manipulation overhead at ++ * the expense of O(n) removal for arbitrary elements. New elements can be ++ * added to the list after an existing element or at the head of the list. ++ * Elements being removed from the head of the list should use the explicit ++ * macro for this purpose for optimum efficiency. A singly-linked list may ++ * only be traversed in the forward direction. Singly-linked lists are ideal ++ * for applications with large datasets and few or no removals or for ++ * implementing a LIFO queue. ++ * ++ * A list is headed by a single forward pointer (or an array of forward ++ * pointers for a hash table header). The elements are doubly linked ++ * so that an arbitrary element can be removed without a need to ++ * traverse the list. New elements can be added to the list before ++ * or after an existing element or at the head of the list. A list ++ * may only be traversed in the forward direction. ++ * ++ * A simple queue is headed by a pair of pointers, one the head of the ++ * list and the other to the tail of the list. The elements are singly ++ * linked to save space, so elements can only be removed from the ++ * head of the list. New elements can be added to the list before or after ++ * an existing element, at the head of the list, or at the end of the ++ * list. A simple queue may only be traversed in the forward direction. ++ * ++ * A tail queue is headed by a pair of pointers, one to the head of the ++ * list and the other to the tail of the list. The elements are doubly ++ * linked so that an arbitrary element can be removed without a need to ++ * traverse the list. New elements can be added to the list before or ++ * after an existing element, at the head of the list, or at the end of ++ * the list. A tail queue may be traversed in either direction. ++ * ++ * A circle queue is headed by a pair of pointers, one to the head of the ++ * list and the other to the tail of the list. The elements are doubly ++ * linked so that an arbitrary element can be removed without a need to ++ * traverse the list. New elements can be added to the list before or after ++ * an existing element, at the head of the list, or at the end of the list. ++ * A circle queue may be traversed in either direction, but has a more ++ * complex end of list detection. ++ * ++ * For details on the use of these macros, see the queue(3) manual page. ++ */ ++ ++/* ++ * Double-linked List. ++ */ ++ ++typedef struct dwc_list_link { ++ struct dwc_list_link *next; ++ struct dwc_list_link *prev; ++} dwc_list_link_t; ++ ++#define DWC_LIST_INIT(link) do { \ ++ (link)->next = (link); \ ++ (link)->prev = (link); \ ++} while (0) ++ ++#define DWC_LIST_FIRST(link) ((link)->next) ++#define DWC_LIST_LAST(link) ((link)->prev) ++#define DWC_LIST_END(link) (link) ++#define DWC_LIST_NEXT(link) ((link)->next) ++#define DWC_LIST_PREV(link) ((link)->prev) ++#define DWC_LIST_EMPTY(link) \ ++ (DWC_LIST_FIRST(link) == DWC_LIST_END(link)) ++#define DWC_LIST_ENTRY(link, type, field) \ ++ (type *)((uint8_t *)(link) - (size_t)(&((type *)0)->field)) ++ ++#if 0 ++#define DWC_LIST_INSERT_HEAD(list, link) do { \ ++ (link)->next = (list)->next; \ ++ (link)->prev = (list); \ ++ (list)->next->prev = (link); \ ++ (list)->next = (link); \ ++} while (0) ++ ++#define DWC_LIST_INSERT_TAIL(list, link) do { \ ++ (link)->next = (list); \ ++ (link)->prev = (list)->prev; \ ++ (list)->prev->next = (link); \ ++ (list)->prev = (link); \ ++} while (0) ++#else ++#define DWC_LIST_INSERT_HEAD(list, link) do { \ ++ dwc_list_link_t *__next__ = (list)->next; \ ++ __next__->prev = (link); \ ++ (link)->next = __next__; \ ++ (link)->prev = (list); \ ++ (list)->next = (link); \ ++} while (0) ++ ++#define DWC_LIST_INSERT_TAIL(list, link) do { \ ++ dwc_list_link_t *__prev__ = (list)->prev; \ ++ (list)->prev = (link); \ ++ (link)->next = (list); \ ++ (link)->prev = __prev__; \ ++ __prev__->next = (link); \ ++} while (0) ++#endif ++ ++#if 0 ++static inline void __list_add(struct list_head *new, ++ struct list_head *prev, ++ struct list_head *next) ++{ ++ next->prev = new; ++ new->next = next; ++ new->prev = prev; ++ prev->next = new; ++} ++ ++static inline void list_add(struct list_head *new, struct list_head *head) ++{ ++ __list_add(new, head, head->next); ++} ++ ++static inline void list_add_tail(struct list_head *new, struct list_head *head) ++{ ++ __list_add(new, head->prev, head); ++} ++ ++static inline void __list_del(struct list_head * prev, struct list_head * next) ++{ ++ next->prev = prev; ++ prev->next = next; ++} ++ ++static inline void list_del(struct list_head *entry) ++{ ++ __list_del(entry->prev, entry->next); ++ entry->next = LIST_POISON1; ++ entry->prev = LIST_POISON2; ++} ++#endif ++ ++#define DWC_LIST_REMOVE(link) do { \ ++ (link)->next->prev = (link)->prev; \ ++ (link)->prev->next = (link)->next; \ ++} while (0) ++ ++#define DWC_LIST_REMOVE_INIT(link) do { \ ++ DWC_LIST_REMOVE(link); \ ++ DWC_LIST_INIT(link); \ ++} while (0) ++ ++#define DWC_LIST_MOVE_HEAD(list, link) do { \ ++ DWC_LIST_REMOVE(link); \ ++ DWC_LIST_INSERT_HEAD(list, link); \ ++} while (0) ++ ++#define DWC_LIST_MOVE_TAIL(list, link) do { \ ++ DWC_LIST_REMOVE(link); \ ++ DWC_LIST_INSERT_TAIL(list, link); \ ++} while (0) ++ ++#define DWC_LIST_FOREACH(var, list) \ ++ for((var) = DWC_LIST_FIRST(list); \ ++ (var) != DWC_LIST_END(list); \ ++ (var) = DWC_LIST_NEXT(var)) ++ ++#define DWC_LIST_FOREACH_SAFE(var, var2, list) \ ++ for((var) = DWC_LIST_FIRST(list), (var2) = DWC_LIST_NEXT(var); \ ++ (var) != DWC_LIST_END(list); \ ++ (var) = (var2), (var2) = DWC_LIST_NEXT(var2)) ++ ++#define DWC_LIST_FOREACH_REVERSE(var, list) \ ++ for((var) = DWC_LIST_LAST(list); \ ++ (var) != DWC_LIST_END(list); \ ++ (var) = DWC_LIST_PREV(var)) ++ ++/* ++ * Singly-linked List definitions. ++ */ ++#define DWC_SLIST_HEAD(name, type) \ ++struct name { \ ++ struct type *slh_first; /* first element */ \ ++} ++ ++#define DWC_SLIST_HEAD_INITIALIZER(head) \ ++ { NULL } ++ ++#define DWC_SLIST_ENTRY(type) \ ++struct { \ ++ struct type *sle_next; /* next element */ \ ++} ++ ++/* ++ * Singly-linked List access methods. ++ */ ++#define DWC_SLIST_FIRST(head) ((head)->slh_first) ++#define DWC_SLIST_END(head) NULL ++#define DWC_SLIST_EMPTY(head) (SLIST_FIRST(head) == SLIST_END(head)) ++#define DWC_SLIST_NEXT(elm, field) ((elm)->field.sle_next) ++ ++#define DWC_SLIST_FOREACH(var, head, field) \ ++ for((var) = SLIST_FIRST(head); \ ++ (var) != SLIST_END(head); \ ++ (var) = SLIST_NEXT(var, field)) ++ ++#define DWC_SLIST_FOREACH_PREVPTR(var, varp, head, field) \ ++ for((varp) = &SLIST_FIRST((head)); \ ++ ((var) = *(varp)) != SLIST_END(head); \ ++ (varp) = &SLIST_NEXT((var), field)) ++ ++/* ++ * Singly-linked List functions. ++ */ ++#define DWC_SLIST_INIT(head) { \ ++ SLIST_FIRST(head) = SLIST_END(head); \ ++} ++ ++#define DWC_SLIST_INSERT_AFTER(slistelm, elm, field) do { \ ++ (elm)->field.sle_next = (slistelm)->field.sle_next; \ ++ (slistelm)->field.sle_next = (elm); \ ++} while (0) ++ ++#define DWC_SLIST_INSERT_HEAD(head, elm, field) do { \ ++ (elm)->field.sle_next = (head)->slh_first; \ ++ (head)->slh_first = (elm); \ ++} while (0) ++ ++#define DWC_SLIST_REMOVE_NEXT(head, elm, field) do { \ ++ (elm)->field.sle_next = (elm)->field.sle_next->field.sle_next; \ ++} while (0) ++ ++#define DWC_SLIST_REMOVE_HEAD(head, field) do { \ ++ (head)->slh_first = (head)->slh_first->field.sle_next; \ ++} while (0) ++ ++#define DWC_SLIST_REMOVE(head, elm, type, field) do { \ ++ if ((head)->slh_first == (elm)) { \ ++ SLIST_REMOVE_HEAD((head), field); \ ++ } \ ++ else { \ ++ struct type *curelm = (head)->slh_first; \ ++ while( curelm->field.sle_next != (elm) ) \ ++ curelm = curelm->field.sle_next; \ ++ curelm->field.sle_next = \ ++ curelm->field.sle_next->field.sle_next; \ ++ } \ ++} while (0) ++ ++/* ++ * Simple queue definitions. ++ */ ++#define DWC_SIMPLEQ_HEAD(name, type) \ ++struct name { \ ++ struct type *sqh_first; /* first element */ \ ++ struct type **sqh_last; /* addr of last next element */ \ ++} ++ ++#define DWC_SIMPLEQ_HEAD_INITIALIZER(head) \ ++ { NULL, &(head).sqh_first } ++ ++#define DWC_SIMPLEQ_ENTRY(type) \ ++struct { \ ++ struct type *sqe_next; /* next element */ \ ++} ++ ++/* ++ * Simple queue access methods. ++ */ ++#define DWC_SIMPLEQ_FIRST(head) ((head)->sqh_first) ++#define DWC_SIMPLEQ_END(head) NULL ++#define DWC_SIMPLEQ_EMPTY(head) (SIMPLEQ_FIRST(head) == SIMPLEQ_END(head)) ++#define DWC_SIMPLEQ_NEXT(elm, field) ((elm)->field.sqe_next) ++ ++#define DWC_SIMPLEQ_FOREACH(var, head, field) \ ++ for((var) = SIMPLEQ_FIRST(head); \ ++ (var) != SIMPLEQ_END(head); \ ++ (var) = SIMPLEQ_NEXT(var, field)) ++ ++/* ++ * Simple queue functions. ++ */ ++#define DWC_SIMPLEQ_INIT(head) do { \ ++ (head)->sqh_first = NULL; \ ++ (head)->sqh_last = &(head)->sqh_first; \ ++} while (0) ++ ++#define DWC_SIMPLEQ_INSERT_HEAD(head, elm, field) do { \ ++ if (((elm)->field.sqe_next = (head)->sqh_first) == NULL) \ ++ (head)->sqh_last = &(elm)->field.sqe_next; \ ++ (head)->sqh_first = (elm); \ ++} while (0) ++ ++#define DWC_SIMPLEQ_INSERT_TAIL(head, elm, field) do { \ ++ (elm)->field.sqe_next = NULL; \ ++ *(head)->sqh_last = (elm); \ ++ (head)->sqh_last = &(elm)->field.sqe_next; \ ++} while (0) ++ ++#define DWC_SIMPLEQ_INSERT_AFTER(head, listelm, elm, field) do { \ ++ if (((elm)->field.sqe_next = (listelm)->field.sqe_next) == NULL)\ ++ (head)->sqh_last = &(elm)->field.sqe_next; \ ++ (listelm)->field.sqe_next = (elm); \ ++} while (0) ++ ++#define DWC_SIMPLEQ_REMOVE_HEAD(head, field) do { \ ++ if (((head)->sqh_first = (head)->sqh_first->field.sqe_next) == NULL) \ ++ (head)->sqh_last = &(head)->sqh_first; \ ++} while (0) ++ ++/* ++ * Tail queue definitions. ++ */ ++#define DWC_TAILQ_HEAD(name, type) \ ++struct name { \ ++ struct type *tqh_first; /* first element */ \ ++ struct type **tqh_last; /* addr of last next element */ \ ++} ++ ++#define DWC_TAILQ_HEAD_INITIALIZER(head) \ ++ { NULL, &(head).tqh_first } ++ ++#define DWC_TAILQ_ENTRY(type) \ ++struct { \ ++ struct type *tqe_next; /* next element */ \ ++ struct type **tqe_prev; /* address of previous next element */ \ ++} ++ ++/* ++ * tail queue access methods ++ */ ++#define DWC_TAILQ_FIRST(head) ((head)->tqh_first) ++#define DWC_TAILQ_END(head) NULL ++#define DWC_TAILQ_NEXT(elm, field) ((elm)->field.tqe_next) ++#define DWC_TAILQ_LAST(head, headname) \ ++ (*(((struct headname *)((head)->tqh_last))->tqh_last)) ++/* XXX */ ++#define DWC_TAILQ_PREV(elm, headname, field) \ ++ (*(((struct headname *)((elm)->field.tqe_prev))->tqh_last)) ++#define DWC_TAILQ_EMPTY(head) \ ++ (DWC_TAILQ_FIRST(head) == DWC_TAILQ_END(head)) ++ ++#define DWC_TAILQ_FOREACH(var, head, field) \ ++ for ((var) = DWC_TAILQ_FIRST(head); \ ++ (var) != DWC_TAILQ_END(head); \ ++ (var) = DWC_TAILQ_NEXT(var, field)) ++ ++#define DWC_TAILQ_FOREACH_REVERSE(var, head, headname, field) \ ++ for ((var) = DWC_TAILQ_LAST(head, headname); \ ++ (var) != DWC_TAILQ_END(head); \ ++ (var) = DWC_TAILQ_PREV(var, headname, field)) ++ ++/* ++ * Tail queue functions. ++ */ ++#define DWC_TAILQ_INIT(head) do { \ ++ (head)->tqh_first = NULL; \ ++ (head)->tqh_last = &(head)->tqh_first; \ ++} while (0) ++ ++#define DWC_TAILQ_INSERT_HEAD(head, elm, field) do { \ ++ if (((elm)->field.tqe_next = (head)->tqh_first) != NULL) \ ++ (head)->tqh_first->field.tqe_prev = \ ++ &(elm)->field.tqe_next; \ ++ else \ ++ (head)->tqh_last = &(elm)->field.tqe_next; \ ++ (head)->tqh_first = (elm); \ ++ (elm)->field.tqe_prev = &(head)->tqh_first; \ ++} while (0) ++ ++#define DWC_TAILQ_INSERT_TAIL(head, elm, field) do { \ ++ (elm)->field.tqe_next = NULL; \ ++ (elm)->field.tqe_prev = (head)->tqh_last; \ ++ *(head)->tqh_last = (elm); \ ++ (head)->tqh_last = &(elm)->field.tqe_next; \ ++} while (0) ++ ++#define DWC_TAILQ_INSERT_AFTER(head, listelm, elm, field) do { \ ++ if (((elm)->field.tqe_next = (listelm)->field.tqe_next) != NULL)\ ++ (elm)->field.tqe_next->field.tqe_prev = \ ++ &(elm)->field.tqe_next; \ ++ else \ ++ (head)->tqh_last = &(elm)->field.tqe_next; \ ++ (listelm)->field.tqe_next = (elm); \ ++ (elm)->field.tqe_prev = &(listelm)->field.tqe_next; \ ++} while (0) ++ ++#define DWC_TAILQ_INSERT_BEFORE(listelm, elm, field) do { \ ++ (elm)->field.tqe_prev = (listelm)->field.tqe_prev; \ ++ (elm)->field.tqe_next = (listelm); \ ++ *(listelm)->field.tqe_prev = (elm); \ ++ (listelm)->field.tqe_prev = &(elm)->field.tqe_next; \ ++} while (0) ++ ++#define DWC_TAILQ_REMOVE(head, elm, field) do { \ ++ if (((elm)->field.tqe_next) != NULL) \ ++ (elm)->field.tqe_next->field.tqe_prev = \ ++ (elm)->field.tqe_prev; \ ++ else \ ++ (head)->tqh_last = (elm)->field.tqe_prev; \ ++ *(elm)->field.tqe_prev = (elm)->field.tqe_next; \ ++} while (0) ++ ++#define DWC_TAILQ_REPLACE(head, elm, elm2, field) do { \ ++ if (((elm2)->field.tqe_next = (elm)->field.tqe_next) != NULL) \ ++ (elm2)->field.tqe_next->field.tqe_prev = \ ++ &(elm2)->field.tqe_next; \ ++ else \ ++ (head)->tqh_last = &(elm2)->field.tqe_next; \ ++ (elm2)->field.tqe_prev = (elm)->field.tqe_prev; \ ++ *(elm2)->field.tqe_prev = (elm2); \ ++} while (0) ++ ++/* ++ * Circular queue definitions. ++ */ ++#define DWC_CIRCLEQ_HEAD(name, type) \ ++struct name { \ ++ struct type *cqh_first; /* first element */ \ ++ struct type *cqh_last; /* last element */ \ ++} ++ ++#define DWC_CIRCLEQ_HEAD_INITIALIZER(head) \ ++ { DWC_CIRCLEQ_END(&head), DWC_CIRCLEQ_END(&head) } ++ ++#define DWC_CIRCLEQ_ENTRY(type) \ ++struct { \ ++ struct type *cqe_next; /* next element */ \ ++ struct type *cqe_prev; /* previous element */ \ ++} ++ ++/* ++ * Circular queue access methods ++ */ ++#define DWC_CIRCLEQ_FIRST(head) ((head)->cqh_first) ++#define DWC_CIRCLEQ_LAST(head) ((head)->cqh_last) ++#define DWC_CIRCLEQ_END(head) ((void *)(head)) ++#define DWC_CIRCLEQ_NEXT(elm, field) ((elm)->field.cqe_next) ++#define DWC_CIRCLEQ_PREV(elm, field) ((elm)->field.cqe_prev) ++#define DWC_CIRCLEQ_EMPTY(head) \ ++ (DWC_CIRCLEQ_FIRST(head) == DWC_CIRCLEQ_END(head)) ++ ++#define DWC_CIRCLEQ_EMPTY_ENTRY(elm, field) (((elm)->field.cqe_next == NULL) && ((elm)->field.cqe_prev == NULL)) ++ ++#define DWC_CIRCLEQ_FOREACH(var, head, field) \ ++ for((var) = DWC_CIRCLEQ_FIRST(head); \ ++ (var) != DWC_CIRCLEQ_END(head); \ ++ (var) = DWC_CIRCLEQ_NEXT(var, field)) ++ ++#define DWC_CIRCLEQ_FOREACH_SAFE(var, var2, head, field) \ ++ for((var) = DWC_CIRCLEQ_FIRST(head), var2 = DWC_CIRCLEQ_NEXT(var, field); \ ++ (var) != DWC_CIRCLEQ_END(head); \ ++ (var) = var2, var2 = DWC_CIRCLEQ_NEXT(var, field)) ++ ++#define DWC_CIRCLEQ_FOREACH_REVERSE(var, head, field) \ ++ for((var) = DWC_CIRCLEQ_LAST(head); \ ++ (var) != DWC_CIRCLEQ_END(head); \ ++ (var) = DWC_CIRCLEQ_PREV(var, field)) ++ ++/* ++ * Circular queue functions. ++ */ ++#define DWC_CIRCLEQ_INIT(head) do { \ ++ (head)->cqh_first = DWC_CIRCLEQ_END(head); \ ++ (head)->cqh_last = DWC_CIRCLEQ_END(head); \ ++} while (0) ++ ++#define DWC_CIRCLEQ_INIT_ENTRY(elm, field) do { \ ++ (elm)->field.cqe_next = NULL; \ ++ (elm)->field.cqe_prev = NULL; \ ++} while (0) ++ ++#define DWC_CIRCLEQ_INSERT_AFTER(head, listelm, elm, field) do { \ ++ (elm)->field.cqe_next = (listelm)->field.cqe_next; \ ++ (elm)->field.cqe_prev = (listelm); \ ++ if ((listelm)->field.cqe_next == DWC_CIRCLEQ_END(head)) \ ++ (head)->cqh_last = (elm); \ ++ else \ ++ (listelm)->field.cqe_next->field.cqe_prev = (elm); \ ++ (listelm)->field.cqe_next = (elm); \ ++} while (0) ++ ++#define DWC_CIRCLEQ_INSERT_BEFORE(head, listelm, elm, field) do { \ ++ (elm)->field.cqe_next = (listelm); \ ++ (elm)->field.cqe_prev = (listelm)->field.cqe_prev; \ ++ if ((listelm)->field.cqe_prev == DWC_CIRCLEQ_END(head)) \ ++ (head)->cqh_first = (elm); \ ++ else \ ++ (listelm)->field.cqe_prev->field.cqe_next = (elm); \ ++ (listelm)->field.cqe_prev = (elm); \ ++} while (0) ++ ++#define DWC_CIRCLEQ_INSERT_HEAD(head, elm, field) do { \ ++ (elm)->field.cqe_next = (head)->cqh_first; \ ++ (elm)->field.cqe_prev = DWC_CIRCLEQ_END(head); \ ++ if ((head)->cqh_last == DWC_CIRCLEQ_END(head)) \ ++ (head)->cqh_last = (elm); \ ++ else \ ++ (head)->cqh_first->field.cqe_prev = (elm); \ ++ (head)->cqh_first = (elm); \ ++} while (0) ++ ++#define DWC_CIRCLEQ_INSERT_TAIL(head, elm, field) do { \ ++ (elm)->field.cqe_next = DWC_CIRCLEQ_END(head); \ ++ (elm)->field.cqe_prev = (head)->cqh_last; \ ++ if ((head)->cqh_first == DWC_CIRCLEQ_END(head)) \ ++ (head)->cqh_first = (elm); \ ++ else \ ++ (head)->cqh_last->field.cqe_next = (elm); \ ++ (head)->cqh_last = (elm); \ ++} while (0) ++ ++#define DWC_CIRCLEQ_REMOVE(head, elm, field) do { \ ++ if ((elm)->field.cqe_next == DWC_CIRCLEQ_END(head)) \ ++ (head)->cqh_last = (elm)->field.cqe_prev; \ ++ else \ ++ (elm)->field.cqe_next->field.cqe_prev = \ ++ (elm)->field.cqe_prev; \ ++ if ((elm)->field.cqe_prev == DWC_CIRCLEQ_END(head)) \ ++ (head)->cqh_first = (elm)->field.cqe_next; \ ++ else \ ++ (elm)->field.cqe_prev->field.cqe_next = \ ++ (elm)->field.cqe_next; \ ++} while (0) ++ ++#define DWC_CIRCLEQ_REMOVE_INIT(head, elm, field) do { \ ++ DWC_CIRCLEQ_REMOVE(head, elm, field); \ ++ DWC_CIRCLEQ_INIT_ENTRY(elm, field); \ ++} while (0) ++ ++#define DWC_CIRCLEQ_REPLACE(head, elm, elm2, field) do { \ ++ if (((elm2)->field.cqe_next = (elm)->field.cqe_next) == \ ++ DWC_CIRCLEQ_END(head)) \ ++ (head).cqh_last = (elm2); \ ++ else \ ++ (elm2)->field.cqe_next->field.cqe_prev = (elm2); \ ++ if (((elm2)->field.cqe_prev = (elm)->field.cqe_prev) == \ ++ DWC_CIRCLEQ_END(head)) \ ++ (head).cqh_first = (elm2); \ ++ else \ ++ (elm2)->field.cqe_prev->field.cqe_next = (elm2); \ ++} while (0) ++ ++#ifdef __cplusplus ++} ++#endif ++ ++#endif /* _DWC_LIST_H_ */ +diff --git a/drivers/usb/host/dwc_common_port/dwc_mem.c b/drivers/usb/host/dwc_common_port/dwc_mem.c +new file mode 100644 +index 0000000..ad645ff +--- /dev/null ++++ b/drivers/usb/host/dwc_common_port/dwc_mem.c +@@ -0,0 +1,245 @@ ++/* Memory Debugging */ ++#ifdef DWC_DEBUG_MEMORY ++ ++#include "dwc_os.h" ++#include "dwc_list.h" ++ ++struct allocation { ++ void *addr; ++ void *ctx; ++ char *func; ++ int line; ++ uint32_t size; ++ int dma; ++ DWC_CIRCLEQ_ENTRY(allocation) entry; ++}; ++ ++DWC_CIRCLEQ_HEAD(allocation_queue, allocation); ++ ++struct allocation_manager { ++ void *mem_ctx; ++ struct allocation_queue allocations; ++ ++ /* statistics */ ++ int num; ++ int num_freed; ++ int num_active; ++ uint32_t total; ++ uint32_t cur; ++ uint32_t max; ++}; ++ ++static struct allocation_manager *manager = NULL; ++ ++static int add_allocation(void *ctx, uint32_t size, char const *func, int line, void *addr, ++ int dma) ++{ ++ struct allocation *a; ++ ++ DWC_ASSERT(manager != NULL, "manager not allocated"); ++ ++ a = __DWC_ALLOC_ATOMIC(manager->mem_ctx, sizeof(*a)); ++ if (!a) { ++ return -DWC_E_NO_MEMORY; ++ } ++ ++ a->func = __DWC_ALLOC_ATOMIC(manager->mem_ctx, DWC_STRLEN(func) + 1); ++ if (!a->func) { ++ __DWC_FREE(manager->mem_ctx, a); ++ return -DWC_E_NO_MEMORY; ++ } ++ ++ DWC_MEMCPY(a->func, func, DWC_STRLEN(func) + 1); ++ a->addr = addr; ++ a->ctx = ctx; ++ a->line = line; ++ a->size = size; ++ a->dma = dma; ++ DWC_CIRCLEQ_INSERT_TAIL(&manager->allocations, a, entry); ++ ++ /* Update stats */ ++ manager->num++; ++ manager->num_active++; ++ manager->total += size; ++ manager->cur += size; ++ ++ if (manager->max < manager->cur) { ++ manager->max = manager->cur; ++ } ++ ++ return 0; ++} ++ ++static struct allocation *find_allocation(void *ctx, void *addr) ++{ ++ struct allocation *a; ++ ++ DWC_CIRCLEQ_FOREACH(a, &manager->allocations, entry) { ++ if (a->ctx == ctx && a->addr == addr) { ++ return a; ++ } ++ } ++ ++ return NULL; ++} ++ ++static void free_allocation(void *ctx, void *addr, char const *func, int line) ++{ ++ struct allocation *a = find_allocation(ctx, addr); ++ ++ if (!a) { ++ DWC_ASSERT(0, ++ "Free of address %p that was never allocated or already freed %s:%d", ++ addr, func, line); ++ return; ++ } ++ ++ DWC_CIRCLEQ_REMOVE(&manager->allocations, a, entry); ++ ++ manager->num_active--; ++ manager->num_freed++; ++ manager->cur -= a->size; ++ __DWC_FREE(manager->mem_ctx, a->func); ++ __DWC_FREE(manager->mem_ctx, a); ++} ++ ++int dwc_memory_debug_start(void *mem_ctx) ++{ ++ DWC_ASSERT(manager == NULL, "Memory debugging has already started\n"); ++ ++ if (manager) { ++ return -DWC_E_BUSY; ++ } ++ ++ manager = __DWC_ALLOC(mem_ctx, sizeof(*manager)); ++ if (!manager) { ++ return -DWC_E_NO_MEMORY; ++ } ++ ++ DWC_CIRCLEQ_INIT(&manager->allocations); ++ manager->mem_ctx = mem_ctx; ++ manager->num = 0; ++ manager->num_freed = 0; ++ manager->num_active = 0; ++ manager->total = 0; ++ manager->cur = 0; ++ manager->max = 0; ++ ++ return 0; ++} ++ ++void dwc_memory_debug_stop(void) ++{ ++ struct allocation *a; ++ ++ dwc_memory_debug_report(); ++ ++ DWC_CIRCLEQ_FOREACH(a, &manager->allocations, entry) { ++ DWC_ERROR("Memory leaked from %s:%d\n", a->func, a->line); ++ free_allocation(a->ctx, a->addr, NULL, -1); ++ } ++ ++ __DWC_FREE(manager->mem_ctx, manager); ++} ++ ++void dwc_memory_debug_report(void) ++{ ++ struct allocation *a; ++ ++ DWC_PRINTF("\n\n\n----------------- Memory Debugging Report -----------------\n\n"); ++ DWC_PRINTF("Num Allocations = %d\n", manager->num); ++ DWC_PRINTF("Freed = %d\n", manager->num_freed); ++ DWC_PRINTF("Active = %d\n", manager->num_active); ++ DWC_PRINTF("Current Memory Used = %d\n", manager->cur); ++ DWC_PRINTF("Total Memory Used = %d\n", manager->total); ++ DWC_PRINTF("Maximum Memory Used at Once = %d\n", manager->max); ++ DWC_PRINTF("Unfreed allocations:\n"); ++ ++ DWC_CIRCLEQ_FOREACH(a, &manager->allocations, entry) { ++ DWC_PRINTF(" addr=%p, size=%d from %s:%d, DMA=%d\n", ++ a->addr, a->size, a->func, a->line, a->dma); ++ } ++} ++ ++/* The replacement functions */ ++void *dwc_alloc_debug(void *mem_ctx, uint32_t size, char const *func, int line) ++{ ++ void *addr = __DWC_ALLOC(mem_ctx, size); ++ ++ if (!addr) { ++ return NULL; ++ } ++ ++ if (add_allocation(mem_ctx, size, func, line, addr, 0)) { ++ __DWC_FREE(mem_ctx, addr); ++ return NULL; ++ } ++ ++ return addr; ++} ++ ++void *dwc_alloc_atomic_debug(void *mem_ctx, uint32_t size, char const *func, ++ int line) ++{ ++ void *addr = __DWC_ALLOC_ATOMIC(mem_ctx, size); ++ ++ if (!addr) { ++ return NULL; ++ } ++ ++ if (add_allocation(mem_ctx, size, func, line, addr, 0)) { ++ __DWC_FREE(mem_ctx, addr); ++ return NULL; ++ } ++ ++ return addr; ++} ++ ++void dwc_free_debug(void *mem_ctx, void *addr, char const *func, int line) ++{ ++ free_allocation(mem_ctx, addr, func, line); ++ __DWC_FREE(mem_ctx, addr); ++} ++ ++void *dwc_dma_alloc_debug(void *dma_ctx, uint32_t size, dwc_dma_t *dma_addr, ++ char const *func, int line) ++{ ++ void *addr = __DWC_DMA_ALLOC(dma_ctx, size, dma_addr); ++ ++ if (!addr) { ++ return NULL; ++ } ++ ++ if (add_allocation(dma_ctx, size, func, line, addr, 1)) { ++ __DWC_DMA_FREE(dma_ctx, size, addr, *dma_addr); ++ return NULL; ++ } ++ ++ return addr; ++} ++ ++void *dwc_dma_alloc_atomic_debug(void *dma_ctx, uint32_t size, ++ dwc_dma_t *dma_addr, char const *func, int line) ++{ ++ void *addr = __DWC_DMA_ALLOC_ATOMIC(dma_ctx, size, dma_addr); ++ ++ if (!addr) { ++ return NULL; ++ } ++ ++ if (add_allocation(dma_ctx, size, func, line, addr, 1)) { ++ __DWC_DMA_FREE(dma_ctx, size, addr, *dma_addr); ++ return NULL; ++ } ++ ++ return addr; ++} ++ ++void dwc_dma_free_debug(void *dma_ctx, uint32_t size, void *virt_addr, ++ dwc_dma_t dma_addr, char const *func, int line) ++{ ++ free_allocation(dma_ctx, virt_addr, func, line); ++ __DWC_DMA_FREE(dma_ctx, size, virt_addr, dma_addr); ++} ++ ++#endif /* DWC_DEBUG_MEMORY */ +diff --git a/drivers/usb/host/dwc_common_port/dwc_modpow.c b/drivers/usb/host/dwc_common_port/dwc_modpow.c +new file mode 100644 +index 0000000..2004538 +--- /dev/null ++++ b/drivers/usb/host/dwc_common_port/dwc_modpow.c +@@ -0,0 +1,636 @@ ++/* Bignum routines adapted from PUTTY sources. PuTTY copyright notice follows. ++ * ++ * PuTTY is copyright 1997-2007 Simon Tatham. ++ * ++ * Portions copyright Robert de Bath, Joris van Rantwijk, Delian ++ * Delchev, Andreas Schultz, Jeroen Massar, Wez Furlong, Nicolas Barry, ++ * Justin Bradford, Ben Harris, Malcolm Smith, Ahmad Khalifa, Markus ++ * Kuhn, and CORE SDI S.A. ++ * ++ * Permission is hereby granted, free of charge, to any person ++ * obtaining a copy of this software and associated documentation files ++ * (the "Software"), to deal in the Software without restriction, ++ * including without limitation the rights to use, copy, modify, merge, ++ * publish, distribute, sublicense, and/or sell copies of the Software, ++ * and to permit persons to whom the Software is furnished to do so, ++ * subject to the following conditions: ++ * ++ * The above copyright notice and this permission notice shall be ++ * included in all copies or substantial portions of the Software. ++ ++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ++ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF ++ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND ++ * NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE ++ * FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF ++ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION ++ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ++ * ++ */ ++#ifdef DWC_CRYPTOLIB ++ ++#ifndef CONFIG_MACH_IPMATE ++ ++#include "dwc_modpow.h" ++ ++#define BIGNUM_INT_MASK 0xFFFFFFFFUL ++#define BIGNUM_TOP_BIT 0x80000000UL ++#define BIGNUM_INT_BITS 32 ++ ++ ++static void *snmalloc(void *mem_ctx, size_t n, size_t size) ++{ ++ void *p; ++ size *= n; ++ if (size == 0) size = 1; ++ p = dwc_alloc(mem_ctx, size); ++ return p; ++} ++ ++#define snewn(ctx, n, type) ((type *)snmalloc((ctx), (n), sizeof(type))) ++#define sfree dwc_free ++ ++/* ++ * Usage notes: ++ * * Do not call the DIVMOD_WORD macro with expressions such as array ++ * subscripts, as some implementations object to this (see below). ++ * * Note that none of the division methods below will cope if the ++ * quotient won't fit into BIGNUM_INT_BITS. Callers should be careful ++ * to avoid this case. ++ * If this condition occurs, in the case of the x86 DIV instruction, ++ * an overflow exception will occur, which (according to a correspondent) ++ * will manifest on Windows as something like ++ * 0xC0000095: Integer overflow ++ * The C variant won't give the right answer, either. ++ */ ++ ++#define MUL_WORD(w1, w2) ((BignumDblInt)w1 * w2) ++ ++#if defined __GNUC__ && defined __i386__ ++#define DIVMOD_WORD(q, r, hi, lo, w) \ ++ __asm__("div %2" : \ ++ "=d" (r), "=a" (q) : \ ++ "r" (w), "d" (hi), "a" (lo)) ++#else ++#define DIVMOD_WORD(q, r, hi, lo, w) do { \ ++ BignumDblInt n = (((BignumDblInt)hi) << BIGNUM_INT_BITS) | lo; \ ++ q = n / w; \ ++ r = n % w; \ ++} while (0) ++#endif ++ ++// q = n / w; ++// r = n % w; ++ ++#define BIGNUM_INT_BYTES (BIGNUM_INT_BITS / 8) ++ ++#define BIGNUM_INTERNAL ++ ++static Bignum newbn(void *mem_ctx, int length) ++{ ++ Bignum b = snewn(mem_ctx, length + 1, BignumInt); ++ //if (!b) ++ //abort(); /* FIXME */ ++ DWC_MEMSET(b, 0, (length + 1) * sizeof(*b)); ++ b[0] = length; ++ return b; ++} ++ ++void freebn(void *mem_ctx, Bignum b) ++{ ++ /* ++ * Burn the evidence, just in case. ++ */ ++ DWC_MEMSET(b, 0, sizeof(b[0]) * (b[0] + 1)); ++ sfree(mem_ctx, b); ++} ++ ++/* ++ * Compute c = a * b. ++ * Input is in the first len words of a and b. ++ * Result is returned in the first 2*len words of c. ++ */ ++static void internal_mul(BignumInt *a, BignumInt *b, ++ BignumInt *c, int len) ++{ ++ int i, j; ++ BignumDblInt t; ++ ++ for (j = 0; j < 2 * len; j++) ++ c[j] = 0; ++ ++ for (i = len - 1; i >= 0; i--) { ++ t = 0; ++ for (j = len - 1; j >= 0; j--) { ++ t += MUL_WORD(a[i], (BignumDblInt) b[j]); ++ t += (BignumDblInt) c[i + j + 1]; ++ c[i + j + 1] = (BignumInt) t; ++ t = t >> BIGNUM_INT_BITS; ++ } ++ c[i] = (BignumInt) t; ++ } ++} ++ ++static void internal_add_shifted(BignumInt *number, ++ unsigned n, int shift) ++{ ++ int word = 1 + (shift / BIGNUM_INT_BITS); ++ int bshift = shift % BIGNUM_INT_BITS; ++ BignumDblInt addend; ++ ++ addend = (BignumDblInt)n << bshift; ++ ++ while (addend) { ++ addend += number[word]; ++ number[word] = (BignumInt) addend & BIGNUM_INT_MASK; ++ addend >>= BIGNUM_INT_BITS; ++ word++; ++ } ++} ++ ++/* ++ * Compute a = a % m. ++ * Input in first alen words of a and first mlen words of m. ++ * Output in first alen words of a ++ * (of which first alen-mlen words will be zero). ++ * The MSW of m MUST have its high bit set. ++ * Quotient is accumulated in the `quotient' array, which is a Bignum ++ * rather than the internal bigendian format. Quotient parts are shifted ++ * left by `qshift' before adding into quot. ++ */ ++static void internal_mod(BignumInt *a, int alen, ++ BignumInt *m, int mlen, ++ BignumInt *quot, int qshift) ++{ ++ BignumInt m0, m1; ++ unsigned int h; ++ int i, k; ++ ++ m0 = m[0]; ++ if (mlen > 1) ++ m1 = m[1]; ++ else ++ m1 = 0; ++ ++ for (i = 0; i <= alen - mlen; i++) { ++ BignumDblInt t; ++ unsigned int q, r, c, ai1; ++ ++ if (i == 0) { ++ h = 0; ++ } else { ++ h = a[i - 1]; ++ a[i - 1] = 0; ++ } ++ ++ if (i == alen - 1) ++ ai1 = 0; ++ else ++ ai1 = a[i + 1]; ++ ++ /* Find q = h:a[i] / m0 */ ++ if (h >= m0) { ++ /* ++ * Special case. ++ * ++ * To illustrate it, suppose a BignumInt is 8 bits, and ++ * we are dividing (say) A1:23:45:67 by A1:B2:C3. Then ++ * our initial division will be 0xA123 / 0xA1, which ++ * will give a quotient of 0x100 and a divide overflow. ++ * However, the invariants in this division algorithm ++ * are not violated, since the full number A1:23:... is ++ * _less_ than the quotient prefix A1:B2:... and so the ++ * following correction loop would have sorted it out. ++ * ++ * In this situation we set q to be the largest ++ * quotient we _can_ stomach (0xFF, of course). ++ */ ++ q = BIGNUM_INT_MASK; ++ } else { ++ /* Macro doesn't want an array subscript expression passed ++ * into it (see definition), so use a temporary. */ ++ BignumInt tmplo = a[i]; ++ DIVMOD_WORD(q, r, h, tmplo, m0); ++ ++ /* Refine our estimate of q by looking at ++ h:a[i]:a[i+1] / m0:m1 */ ++ t = MUL_WORD(m1, q); ++ if (t > ((BignumDblInt) r << BIGNUM_INT_BITS) + ai1) { ++ q--; ++ t -= m1; ++ r = (r + m0) & BIGNUM_INT_MASK; /* overflow? */ ++ if (r >= (BignumDblInt) m0 && ++ t > ((BignumDblInt) r << BIGNUM_INT_BITS) + ai1) q--; ++ } ++ } ++ ++ /* Subtract q * m from a[i...] */ ++ c = 0; ++ for (k = mlen - 1; k >= 0; k--) { ++ t = MUL_WORD(q, m[k]); ++ t += c; ++ c = (unsigned)(t >> BIGNUM_INT_BITS); ++ if ((BignumInt) t > a[i + k]) ++ c++; ++ a[i + k] -= (BignumInt) t; ++ } ++ ++ /* Add back m in case of borrow */ ++ if (c != h) { ++ t = 0; ++ for (k = mlen - 1; k >= 0; k--) { ++ t += m[k]; ++ t += a[i + k]; ++ a[i + k] = (BignumInt) t; ++ t = t >> BIGNUM_INT_BITS; ++ } ++ q--; ++ } ++ if (quot) ++ internal_add_shifted(quot, q, qshift + BIGNUM_INT_BITS * (alen - mlen - i)); ++ } ++} ++ ++/* ++ * Compute p % mod. ++ * The most significant word of mod MUST be non-zero. ++ * We assume that the result array is the same size as the mod array. ++ * We optionally write out a quotient if `quotient' is non-NULL. ++ * We can avoid writing out the result if `result' is NULL. ++ */ ++void bigdivmod(void *mem_ctx, Bignum p, Bignum mod, Bignum result, Bignum quotient) ++{ ++ BignumInt *n, *m; ++ int mshift; ++ int plen, mlen, i, j; ++ ++ /* Allocate m of size mlen, copy mod to m */ ++ /* We use big endian internally */ ++ mlen = mod[0]; ++ m = snewn(mem_ctx, mlen, BignumInt); ++ //if (!m) ++ //abort(); /* FIXME */ ++ for (j = 0; j < mlen; j++) ++ m[j] = mod[mod[0] - j]; ++ ++ /* Shift m left to make msb bit set */ ++ for (mshift = 0; mshift < BIGNUM_INT_BITS-1; mshift++) ++ if ((m[0] << mshift) & BIGNUM_TOP_BIT) ++ break; ++ if (mshift) { ++ for (i = 0; i < mlen - 1; i++) ++ m[i] = (m[i] << mshift) | (m[i + 1] >> (BIGNUM_INT_BITS - mshift)); ++ m[mlen - 1] = m[mlen - 1] << mshift; ++ } ++ ++ plen = p[0]; ++ /* Ensure plen > mlen */ ++ if (plen <= mlen) ++ plen = mlen + 1; ++ ++ /* Allocate n of size plen, copy p to n */ ++ n = snewn(mem_ctx, plen, BignumInt); ++ //if (!n) ++ //abort(); /* FIXME */ ++ for (j = 0; j < plen; j++) ++ n[j] = 0; ++ for (j = 1; j <= (int)p[0]; j++) ++ n[plen - j] = p[j]; ++ ++ /* Main computation */ ++ internal_mod(n, plen, m, mlen, quotient, mshift); ++ ++ /* Fixup result in case the modulus was shifted */ ++ if (mshift) { ++ for (i = plen - mlen - 1; i < plen - 1; i++) ++ n[i] = (n[i] << mshift) | (n[i + 1] >> (BIGNUM_INT_BITS - mshift)); ++ n[plen - 1] = n[plen - 1] << mshift; ++ internal_mod(n, plen, m, mlen, quotient, 0); ++ for (i = plen - 1; i >= plen - mlen; i--) ++ n[i] = (n[i] >> mshift) | (n[i - 1] << (BIGNUM_INT_BITS - mshift)); ++ } ++ ++ /* Copy result to buffer */ ++ if (result) { ++ for (i = 1; i <= (int)result[0]; i++) { ++ int j = plen - i; ++ result[i] = j >= 0 ? n[j] : 0; ++ } ++ } ++ ++ /* Free temporary arrays */ ++ for (i = 0; i < mlen; i++) ++ m[i] = 0; ++ sfree(mem_ctx, m); ++ for (i = 0; i < plen; i++) ++ n[i] = 0; ++ sfree(mem_ctx, n); ++} ++ ++/* ++ * Simple remainder. ++ */ ++Bignum bigmod(void *mem_ctx, Bignum a, Bignum b) ++{ ++ Bignum r = newbn(mem_ctx, b[0]); ++ bigdivmod(mem_ctx, a, b, r, NULL); ++ return r; ++} ++ ++/* ++ * Compute (base ^ exp) % mod. ++ */ ++Bignum dwc_modpow(void *mem_ctx, Bignum base_in, Bignum exp, Bignum mod) ++{ ++ BignumInt *a, *b, *n, *m; ++ int mshift; ++ int mlen, i, j; ++ Bignum base, result; ++ ++ /* ++ * The most significant word of mod needs to be non-zero. It ++ * should already be, but let's make sure. ++ */ ++ //assert(mod[mod[0]] != 0); ++ ++ /* ++ * Make sure the base is smaller than the modulus, by reducing ++ * it modulo the modulus if not. ++ */ ++ base = bigmod(mem_ctx, base_in, mod); ++ ++ /* Allocate m of size mlen, copy mod to m */ ++ /* We use big endian internally */ ++ mlen = mod[0]; ++ m = snewn(mem_ctx, mlen, BignumInt); ++ //if (!m) ++ //abort(); /* FIXME */ ++ for (j = 0; j < mlen; j++) ++ m[j] = mod[mod[0] - j]; ++ ++ /* Shift m left to make msb bit set */ ++ for (mshift = 0; mshift < BIGNUM_INT_BITS - 1; mshift++) ++ if ((m[0] << mshift) & BIGNUM_TOP_BIT) ++ break; ++ if (mshift) { ++ for (i = 0; i < mlen - 1; i++) ++ m[i] = ++ (m[i] << mshift) | (m[i + 1] >> ++ (BIGNUM_INT_BITS - mshift)); ++ m[mlen - 1] = m[mlen - 1] << mshift; ++ } ++ ++ /* Allocate n of size mlen, copy base to n */ ++ n = snewn(mem_ctx, mlen, BignumInt); ++ //if (!n) ++ //abort(); /* FIXME */ ++ i = mlen - base[0]; ++ for (j = 0; j < i; j++) ++ n[j] = 0; ++ for (j = 0; j < base[0]; j++) ++ n[i + j] = base[base[0] - j]; ++ ++ /* Allocate a and b of size 2*mlen. Set a = 1 */ ++ a = snewn(mem_ctx, 2 * mlen, BignumInt); ++ //if (!a) ++ //abort(); /* FIXME */ ++ b = snewn(mem_ctx, 2 * mlen, BignumInt); ++ //if (!b) ++ //abort(); /* FIXME */ ++ for (i = 0; i < 2 * mlen; i++) ++ a[i] = 0; ++ a[2 * mlen - 1] = 1; ++ ++ /* Skip leading zero bits of exp. */ ++ i = 0; ++ j = BIGNUM_INT_BITS - 1; ++ while (i < exp[0] && (exp[exp[0] - i] & (1 << j)) == 0) { ++ j--; ++ if (j < 0) { ++ i++; ++ j = BIGNUM_INT_BITS - 1; ++ } ++ } ++ ++ /* Main computation */ ++ while (i < exp[0]) { ++ while (j >= 0) { ++ internal_mul(a + mlen, a + mlen, b, mlen); ++ internal_mod(b, mlen * 2, m, mlen, NULL, 0); ++ if ((exp[exp[0] - i] & (1 << j)) != 0) { ++ internal_mul(b + mlen, n, a, mlen); ++ internal_mod(a, mlen * 2, m, mlen, NULL, 0); ++ } else { ++ BignumInt *t; ++ t = a; ++ a = b; ++ b = t; ++ } ++ j--; ++ } ++ i++; ++ j = BIGNUM_INT_BITS - 1; ++ } ++ ++ /* Fixup result in case the modulus was shifted */ ++ if (mshift) { ++ for (i = mlen - 1; i < 2 * mlen - 1; i++) ++ a[i] = ++ (a[i] << mshift) | (a[i + 1] >> ++ (BIGNUM_INT_BITS - mshift)); ++ a[2 * mlen - 1] = a[2 * mlen - 1] << mshift; ++ internal_mod(a, mlen * 2, m, mlen, NULL, 0); ++ for (i = 2 * mlen - 1; i >= mlen; i--) ++ a[i] = ++ (a[i] >> mshift) | (a[i - 1] << ++ (BIGNUM_INT_BITS - mshift)); ++ } ++ ++ /* Copy result to buffer */ ++ result = newbn(mem_ctx, mod[0]); ++ for (i = 0; i < mlen; i++) ++ result[result[0] - i] = a[i + mlen]; ++ while (result[0] > 1 && result[result[0]] == 0) ++ result[0]--; ++ ++ /* Free temporary arrays */ ++ for (i = 0; i < 2 * mlen; i++) ++ a[i] = 0; ++ sfree(mem_ctx, a); ++ for (i = 0; i < 2 * mlen; i++) ++ b[i] = 0; ++ sfree(mem_ctx, b); ++ for (i = 0; i < mlen; i++) ++ m[i] = 0; ++ sfree(mem_ctx, m); ++ for (i = 0; i < mlen; i++) ++ n[i] = 0; ++ sfree(mem_ctx, n); ++ ++ freebn(mem_ctx, base); ++ ++ return result; ++} ++ ++ ++#ifdef UNITTEST ++ ++static __u32 dh_p[] = { ++ 96, ++ 0xFFFFFFFF, ++ 0xFFFFFFFF, ++ 0xA93AD2CA, ++ 0x4B82D120, ++ 0xE0FD108E, ++ 0x43DB5BFC, ++ 0x74E5AB31, ++ 0x08E24FA0, ++ 0xBAD946E2, ++ 0x770988C0, ++ 0x7A615D6C, ++ 0xBBE11757, ++ 0x177B200C, ++ 0x521F2B18, ++ 0x3EC86A64, ++ 0xD8760273, ++ 0xD98A0864, ++ 0xF12FFA06, ++ 0x1AD2EE6B, ++ 0xCEE3D226, ++ 0x4A25619D, ++ 0x1E8C94E0, ++ 0xDB0933D7, ++ 0xABF5AE8C, ++ 0xA6E1E4C7, ++ 0xB3970F85, ++ 0x5D060C7D, ++ 0x8AEA7157, ++ 0x58DBEF0A, ++ 0xECFB8504, ++ 0xDF1CBA64, ++ 0xA85521AB, ++ 0x04507A33, ++ 0xAD33170D, ++ 0x8AAAC42D, ++ 0x15728E5A, ++ 0x98FA0510, ++ 0x15D22618, ++ 0xEA956AE5, ++ 0x3995497C, ++ 0x95581718, ++ 0xDE2BCBF6, ++ 0x6F4C52C9, ++ 0xB5C55DF0, ++ 0xEC07A28F, ++ 0x9B2783A2, ++ 0x180E8603, ++ 0xE39E772C, ++ 0x2E36CE3B, ++ 0x32905E46, ++ 0xCA18217C, ++ 0xF1746C08, ++ 0x4ABC9804, ++ 0x670C354E, ++ 0x7096966D, ++ 0x9ED52907, ++ 0x208552BB, ++ 0x1C62F356, ++ 0xDCA3AD96, ++ 0x83655D23, ++ 0xFD24CF5F, ++ 0x69163FA8, ++ 0x1C55D39A, ++ 0x98DA4836, ++ 0xA163BF05, ++ 0xC2007CB8, ++ 0xECE45B3D, ++ 0x49286651, ++ 0x7C4B1FE6, ++ 0xAE9F2411, ++ 0x5A899FA5, ++ 0xEE386BFB, ++ 0xF406B7ED, ++ 0x0BFF5CB6, ++ 0xA637ED6B, ++ 0xF44C42E9, ++ 0x625E7EC6, ++ 0xE485B576, ++ 0x6D51C245, ++ 0x4FE1356D, ++ 0xF25F1437, ++ 0x302B0A6D, ++ 0xCD3A431B, ++ 0xEF9519B3, ++ 0x8E3404DD, ++ 0x514A0879, ++ 0x3B139B22, ++ 0x020BBEA6, ++ 0x8A67CC74, ++ 0x29024E08, ++ 0x80DC1CD1, ++ 0xC4C6628B, ++ 0x2168C234, ++ 0xC90FDAA2, ++ 0xFFFFFFFF, ++ 0xFFFFFFFF, ++}; ++ ++static __u32 dh_a[] = { ++ 8, ++ 0xdf367516, ++ 0x86459caa, ++ 0xe2d459a4, ++ 0xd910dae0, ++ 0x8a8b5e37, ++ 0x67ab31c6, ++ 0xf0b55ea9, ++ 0x440051d6, ++}; ++ ++static __u32 dh_b[] = { ++ 8, ++ 0xded92656, ++ 0xe07a048a, ++ 0x6fa452cd, ++ 0x2df89d30, ++ 0xc75f1b0f, ++ 0x8ce3578f, ++ 0x7980a324, ++ 0x5daec786, ++}; ++ ++static __u32 dh_g[] = { ++ 1, ++ 2, ++}; ++ ++int main(void) ++{ ++ int i; ++ __u32 *k; ++ k = dwc_modpow(NULL, dh_g, dh_a, dh_p); ++ ++ printf("\n\n"); ++ for (i=0; i<k[0]; i++) { ++ __u32 word32 = k[k[0] - i]; ++ __u16 l = word32 & 0xffff; ++ __u16 m = (word32 & 0xffff0000) >> 16; ++ printf("%04x %04x ", m, l); ++ if (!((i + 1)%13)) printf("\n"); ++ } ++ printf("\n\n"); ++ ++ if ((k[0] == 0x60) && (k[1] == 0x28e490e5) && (k[0x60] == 0x5a0d3d4e)) { ++ printf("PASS\n\n"); ++ } ++ else { ++ printf("FAIL\n\n"); ++ } ++ ++} ++ ++#endif /* UNITTEST */ ++ ++#endif /* CONFIG_MACH_IPMATE */ ++ ++#endif /*DWC_CRYPTOLIB */ +diff --git a/drivers/usb/host/dwc_common_port/dwc_modpow.h b/drivers/usb/host/dwc_common_port/dwc_modpow.h +new file mode 100644 +index 0000000..64f00c2 +--- /dev/null ++++ b/drivers/usb/host/dwc_common_port/dwc_modpow.h +@@ -0,0 +1,34 @@ ++/* ++ * dwc_modpow.h ++ * See dwc_modpow.c for license and changes ++ */ ++#ifndef _DWC_MODPOW_H ++#define _DWC_MODPOW_H ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++#include "dwc_os.h" ++ ++/** @file ++ * ++ * This file defines the module exponentiation function which is only used ++ * internally by the DWC UWB modules for calculation of PKs during numeric ++ * association. The routine is taken from the PUTTY, an open source terminal ++ * emulator. The PUTTY License is preserved in the dwc_modpow.c file. ++ * ++ */ ++ ++typedef uint32_t BignumInt; ++typedef uint64_t BignumDblInt; ++typedef BignumInt *Bignum; ++ ++/* Compute modular exponentiaion */ ++extern Bignum dwc_modpow(void *mem_ctx, Bignum base_in, Bignum exp, Bignum mod); ++ ++#ifdef __cplusplus ++} ++#endif ++ ++#endif /* _LINUX_BIGNUM_H */ +diff --git a/drivers/usb/host/dwc_common_port/dwc_notifier.c b/drivers/usb/host/dwc_common_port/dwc_notifier.c +new file mode 100644 +index 0000000..8b3772a +--- /dev/null ++++ b/drivers/usb/host/dwc_common_port/dwc_notifier.c +@@ -0,0 +1,319 @@ ++#ifdef DWC_NOTIFYLIB ++ ++#include "dwc_notifier.h" ++#include "dwc_list.h" ++ ++typedef struct dwc_observer { ++ void *observer; ++ dwc_notifier_callback_t callback; ++ void *data; ++ char *notification; ++ DWC_CIRCLEQ_ENTRY(dwc_observer) list_entry; ++} observer_t; ++ ++DWC_CIRCLEQ_HEAD(observer_queue, dwc_observer); ++ ++typedef struct dwc_notifier { ++ void *mem_ctx; ++ void *object; ++ struct observer_queue observers; ++ DWC_CIRCLEQ_ENTRY(dwc_notifier) list_entry; ++} notifier_t; ++ ++DWC_CIRCLEQ_HEAD(notifier_queue, dwc_notifier); ++ ++typedef struct manager { ++ void *mem_ctx; ++ void *wkq_ctx; ++ dwc_workq_t *wq; ++// dwc_mutex_t *mutex; ++ struct notifier_queue notifiers; ++} manager_t; ++ ++static manager_t *manager = NULL; ++ ++static int create_manager(void *mem_ctx, void *wkq_ctx) ++{ ++ manager = dwc_alloc(mem_ctx, sizeof(manager_t)); ++ if (!manager) { ++ return -DWC_E_NO_MEMORY; ++ } ++ ++ DWC_CIRCLEQ_INIT(&manager->notifiers); ++ ++ manager->wq = dwc_workq_alloc(wkq_ctx, "DWC Notification WorkQ"); ++ if (!manager->wq) { ++ return -DWC_E_NO_MEMORY; ++ } ++ ++ return 0; ++} ++ ++static void free_manager(void) ++{ ++ dwc_workq_free(manager->wq); ++ ++ /* All notifiers must have unregistered themselves before this module ++ * can be removed. Hitting this assertion indicates a programmer ++ * error. */ ++ DWC_ASSERT(DWC_CIRCLEQ_EMPTY(&manager->notifiers), ++ "Notification manager being freed before all notifiers have been removed"); ++ dwc_free(manager->mem_ctx, manager); ++} ++ ++#ifdef DEBUG ++static void dump_manager(void) ++{ ++ notifier_t *n; ++ observer_t *o; ++ ++ DWC_ASSERT(manager, "Notification manager not found"); ++ ++ DWC_DEBUG("List of all notifiers and observers:\n"); ++ DWC_CIRCLEQ_FOREACH(n, &manager->notifiers, list_entry) { ++ DWC_DEBUG("Notifier %p has observers:\n", n->object); ++ DWC_CIRCLEQ_FOREACH(o, &n->observers, list_entry) { ++ DWC_DEBUG(" %p watching %s\n", o->observer, o->notification); ++ } ++ } ++} ++#else ++#define dump_manager(...) ++#endif ++ ++static observer_t *alloc_observer(void *mem_ctx, void *observer, char *notification, ++ dwc_notifier_callback_t callback, void *data) ++{ ++ observer_t *new_observer = dwc_alloc(mem_ctx, sizeof(observer_t)); ++ ++ if (!new_observer) { ++ return NULL; ++ } ++ ++ DWC_CIRCLEQ_INIT_ENTRY(new_observer, list_entry); ++ new_observer->observer = observer; ++ new_observer->notification = notification; ++ new_observer->callback = callback; ++ new_observer->data = data; ++ return new_observer; ++} ++ ++static void free_observer(void *mem_ctx, observer_t *observer) ++{ ++ dwc_free(mem_ctx, observer); ++} ++ ++static notifier_t *alloc_notifier(void *mem_ctx, void *object) ++{ ++ notifier_t *notifier; ++ ++ if (!object) { ++ return NULL; ++ } ++ ++ notifier = dwc_alloc(mem_ctx, sizeof(notifier_t)); ++ if (!notifier) { ++ return NULL; ++ } ++ ++ DWC_CIRCLEQ_INIT(&notifier->observers); ++ DWC_CIRCLEQ_INIT_ENTRY(notifier, list_entry); ++ ++ notifier->mem_ctx = mem_ctx; ++ notifier->object = object; ++ return notifier; ++} ++ ++static void free_notifier(notifier_t *notifier) ++{ ++ observer_t *observer; ++ ++ DWC_CIRCLEQ_FOREACH(observer, &notifier->observers, list_entry) { ++ free_observer(notifier->mem_ctx, observer); ++ } ++ ++ dwc_free(notifier->mem_ctx, notifier); ++} ++ ++static notifier_t *find_notifier(void *object) ++{ ++ notifier_t *notifier; ++ ++ DWC_ASSERT(manager, "Notification manager not found"); ++ ++ if (!object) { ++ return NULL; ++ } ++ ++ DWC_CIRCLEQ_FOREACH(notifier, &manager->notifiers, list_entry) { ++ if (notifier->object == object) { ++ return notifier; ++ } ++ } ++ ++ return NULL; ++} ++ ++int dwc_alloc_notification_manager(void *mem_ctx, void *wkq_ctx) ++{ ++ return create_manager(mem_ctx, wkq_ctx); ++} ++ ++void dwc_free_notification_manager(void) ++{ ++ free_manager(); ++} ++ ++dwc_notifier_t *dwc_register_notifier(void *mem_ctx, void *object) ++{ ++ notifier_t *notifier; ++ ++ DWC_ASSERT(manager, "Notification manager not found"); ++ ++ notifier = find_notifier(object); ++ if (notifier) { ++ DWC_ERROR("Notifier %p is already registered\n", object); ++ return NULL; ++ } ++ ++ notifier = alloc_notifier(mem_ctx, object); ++ if (!notifier) { ++ return NULL; ++ } ++ ++ DWC_CIRCLEQ_INSERT_TAIL(&manager->notifiers, notifier, list_entry); ++ ++ DWC_INFO("Notifier %p registered", object); ++ dump_manager(); ++ ++ return notifier; ++} ++ ++void dwc_unregister_notifier(dwc_notifier_t *notifier) ++{ ++ DWC_ASSERT(manager, "Notification manager not found"); ++ ++ if (!DWC_CIRCLEQ_EMPTY(&notifier->observers)) { ++ observer_t *o; ++ ++ DWC_ERROR("Notifier %p has active observers when removing\n", notifier->object); ++ DWC_CIRCLEQ_FOREACH(o, &notifier->observers, list_entry) { ++ DWC_DEBUGC(" %p watching %s\n", o->observer, o->notification); ++ } ++ ++ DWC_ASSERT(DWC_CIRCLEQ_EMPTY(&notifier->observers), ++ "Notifier %p has active observers when removing", notifier); ++ } ++ ++ DWC_CIRCLEQ_REMOVE_INIT(&manager->notifiers, notifier, list_entry); ++ free_notifier(notifier); ++ ++ DWC_INFO("Notifier unregistered"); ++ dump_manager(); ++} ++ ++/* Add an observer to observe the notifier for a particular state, event, or notification. */ ++int dwc_add_observer(void *observer, void *object, char *notification, ++ dwc_notifier_callback_t callback, void *data) ++{ ++ notifier_t *notifier = find_notifier(object); ++ observer_t *new_observer; ++ ++ if (!notifier) { ++ DWC_ERROR("Notifier %p is not found when adding observer\n", object); ++ return -DWC_E_INVALID; ++ } ++ ++ new_observer = alloc_observer(notifier->mem_ctx, observer, notification, callback, data); ++ if (!new_observer) { ++ return -DWC_E_NO_MEMORY; ++ } ++ ++ DWC_CIRCLEQ_INSERT_TAIL(&notifier->observers, new_observer, list_entry); ++ ++ DWC_INFO("Added observer %p to notifier %p observing notification %s, callback=%p, data=%p", ++ observer, object, notification, callback, data); ++ ++ dump_manager(); ++ return 0; ++} ++ ++int dwc_remove_observer(void *observer) ++{ ++ notifier_t *n; ++ ++ DWC_ASSERT(manager, "Notification manager not found"); ++ ++ DWC_CIRCLEQ_FOREACH(n, &manager->notifiers, list_entry) { ++ observer_t *o; ++ observer_t *o2; ++ ++ DWC_CIRCLEQ_FOREACH_SAFE(o, o2, &n->observers, list_entry) { ++ if (o->observer == observer) { ++ DWC_CIRCLEQ_REMOVE_INIT(&n->observers, o, list_entry); ++ DWC_INFO("Removing observer %p from notifier %p watching notification %s:", ++ o->observer, n->object, o->notification); ++ free_observer(n->mem_ctx, o); ++ } ++ } ++ } ++ ++ dump_manager(); ++ return 0; ++} ++ ++typedef struct callback_data { ++ void *mem_ctx; ++ dwc_notifier_callback_t cb; ++ void *observer; ++ void *data; ++ void *object; ++ char *notification; ++ void *notification_data; ++} cb_data_t; ++ ++static void cb_task(void *data) ++{ ++ cb_data_t *cb = (cb_data_t *)data; ++ ++ cb->cb(cb->object, cb->notification, cb->observer, cb->notification_data, cb->data); ++ dwc_free(cb->mem_ctx, cb); ++} ++ ++void dwc_notify(dwc_notifier_t *notifier, char *notification, void *notification_data) ++{ ++ observer_t *o; ++ ++ DWC_ASSERT(manager, "Notification manager not found"); ++ ++ DWC_CIRCLEQ_FOREACH(o, &notifier->observers, list_entry) { ++ int len = DWC_STRLEN(notification); ++ ++ if (DWC_STRLEN(o->notification) != len) { ++ continue; ++ } ++ ++ if (DWC_STRNCMP(o->notification, notification, len) == 0) { ++ cb_data_t *cb_data = dwc_alloc(notifier->mem_ctx, sizeof(cb_data_t)); ++ ++ if (!cb_data) { ++ DWC_ERROR("Failed to allocate callback data\n"); ++ return; ++ } ++ ++ cb_data->mem_ctx = notifier->mem_ctx; ++ cb_data->cb = o->callback; ++ cb_data->observer = o->observer; ++ cb_data->data = o->data; ++ cb_data->object = notifier->object; ++ cb_data->notification = notification; ++ cb_data->notification_data = notification_data; ++ DWC_DEBUGC("Observer found %p for notification %s\n", o->observer, notification); ++ DWC_WORKQ_SCHEDULE(manager->wq, cb_task, cb_data, ++ "Notify callback from %p for Notification %s, to observer %p", ++ cb_data->object, notification, cb_data->observer); ++ } ++ } ++} ++ ++#endif /* DWC_NOTIFYLIB */ +diff --git a/drivers/usb/host/dwc_common_port/dwc_notifier.h b/drivers/usb/host/dwc_common_port/dwc_notifier.h +new file mode 100644 +index 0000000..4a8cdfe +--- /dev/null ++++ b/drivers/usb/host/dwc_common_port/dwc_notifier.h +@@ -0,0 +1,122 @@ ++ ++#ifndef __DWC_NOTIFIER_H__ ++#define __DWC_NOTIFIER_H__ ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++#include "dwc_os.h" ++ ++/** @file ++ * ++ * A simple implementation of the Observer pattern. Any "module" can ++ * register as an observer or notifier. The notion of "module" is abstract and ++ * can mean anything used to identify either an observer or notifier. Usually ++ * it will be a pointer to a data structure which contains some state, ie an ++ * object. ++ * ++ * Before any notifiers can be added, the global notification manager must be ++ * brought up with dwc_alloc_notification_manager(). ++ * dwc_free_notification_manager() will bring it down and free all resources. ++ * These would typically be called upon module load and unload. The ++ * notification manager is a single global instance that handles all registered ++ * observable modules and observers so this should be done only once. ++ * ++ * A module can be observable by using Notifications to publicize some general ++ * information about it's state or operation. It does not care who listens, or ++ * even if anyone listens, or what they do with the information. The observable ++ * modules do not need to know any information about it's observers or their ++ * interface, or their state or data. ++ * ++ * Any module can register to emit Notifications. It should publish a list of ++ * notifications that it can emit and their behavior, such as when they will get ++ * triggered, and what information will be provided to the observer. Then it ++ * should register itself as an observable module. See dwc_register_notifier(). ++ * ++ * Any module can observe any observable, registered module, provided it has a ++ * handle to the other module and knows what notifications to observe. See ++ * dwc_add_observer(). ++ * ++ * A function of type dwc_notifier_callback_t is called whenever a notification ++ * is triggered with one or more observers observing it. This function is ++ * called in it's own process so it may sleep or block if needed. It is ++ * guaranteed to be called sometime after the notification has occurred and will ++ * be called once per each time the notification is triggered. It will NOT be ++ * called in the same process context used to trigger the notification. ++ * ++ * @section Limitiations ++ * ++ * Keep in mind that Notifications that can be triggered in rapid sucession may ++ * schedule too many processes too handle. Be aware of this limitation when ++ * designing to use notifications, and only add notifications for appropriate ++ * observable information. ++ * ++ * Also Notification callbacks are not synchronous. If you need to synchronize ++ * the behavior between module/observer you must use other means. And perhaps ++ * that will mean Notifications are not the proper solution. ++ */ ++ ++struct dwc_notifier; ++typedef struct dwc_notifier dwc_notifier_t; ++ ++/** The callback function must be of this type. ++ * ++ * @param object This is the object that is being observed. ++ * @param notification This is the notification that was triggered. ++ * @param observer This is the observer ++ * @param notification_data This is notification-specific data that the notifier ++ * has included in this notification. The value of this should be published in ++ * the documentation of the observable module with the notifications. ++ * @param user_data This is any custom data that the observer provided when ++ * adding itself as an observer to the notification. */ ++typedef void (*dwc_notifier_callback_t)(void *object, char *notification, void *observer, ++ void *notification_data, void *user_data); ++ ++/** Brings up the notification manager. */ ++extern int dwc_alloc_notification_manager(void *mem_ctx, void *wkq_ctx); ++/** Brings down the notification manager. */ ++extern void dwc_free_notification_manager(void); ++ ++/** This function registers an observable module. A dwc_notifier_t object is ++ * returned to the observable module. This is an opaque object that is used by ++ * the observable module to trigger notifications. This object should only be ++ * accessible to functions that are authorized to trigger notifications for this ++ * module. Observers do not need this object. */ ++extern dwc_notifier_t *dwc_register_notifier(void *mem_ctx, void *object); ++ ++/** This function unregisters an observable module. All observers have to be ++ * removed prior to unregistration. */ ++extern void dwc_unregister_notifier(dwc_notifier_t *notifier); ++ ++/** Add a module as an observer to the observable module. The observable module ++ * needs to have previously registered with the notification manager. ++ * ++ * @param observer The observer module ++ * @param object The module to observe ++ * @param notification The notification to observe ++ * @param callback The callback function to call ++ * @param user_data Any additional user data to pass into the callback function */ ++extern int dwc_add_observer(void *observer, void *object, char *notification, ++ dwc_notifier_callback_t callback, void *user_data); ++ ++/** Removes the specified observer from all notifications that it is currently ++ * observing. */ ++extern int dwc_remove_observer(void *observer); ++ ++/** This function triggers a Notification. It should be called by the ++ * observable module, or any module or library which the observable module ++ * allows to trigger notification on it's behalf. Such as the dwc_cc_t. ++ * ++ * dwc_notify is a non-blocking function. Callbacks are scheduled called in ++ * their own process context for each trigger. Callbacks can be blocking. ++ * dwc_notify can be called from interrupt context if needed. ++ * ++ */ ++void dwc_notify(dwc_notifier_t *notifier, char *notification, void *notification_data); ++ ++#ifdef __cplusplus ++} ++#endif ++ ++#endif /* __DWC_NOTIFIER_H__ */ +diff --git a/drivers/usb/host/dwc_common_port/dwc_os.h b/drivers/usb/host/dwc_common_port/dwc_os.h +new file mode 100644 +index 0000000..a2bbe23 +--- /dev/null ++++ b/drivers/usb/host/dwc_common_port/dwc_os.h +@@ -0,0 +1,1276 @@ ++/* ========================================================================= ++ * $File: //dwh/usb_iip/dev/software/dwc_common_port_2/dwc_os.h $ ++ * $Revision: #14 $ ++ * $Date: 2010/11/04 $ ++ * $Change: 1621695 $ ++ * ++ * Synopsys Portability Library Software and documentation ++ * (hereinafter, "Software") is an Unsupported proprietary work of ++ * Synopsys, Inc. unless otherwise expressly agreed to in writing ++ * between Synopsys and you. ++ * ++ * The Software IS NOT an item of Licensed Software or Licensed Product ++ * under any End User Software License Agreement or Agreement for ++ * Licensed Product with Synopsys or any supplement thereto. You are ++ * permitted to use and redistribute this Software in source and binary ++ * forms, with or without modification, provided that redistributions ++ * of source code must retain this notice. You may not view, use, ++ * disclose, copy or distribute this file or any information contained ++ * herein except pursuant to this license grant from Synopsys. If you ++ * do not agree with this notice, including the disclaimer below, then ++ * you are not authorized to use the Software. ++ * ++ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" ++ * BASIS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ++ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS ++ * FOR A PARTICULAR PURPOSE ARE HEREBY DISCLAIMED. IN NO EVENT SHALL ++ * SYNOPSYS 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. ++ * ========================================================================= */ ++#ifndef _DWC_OS_H_ ++#define _DWC_OS_H_ ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++/** @file ++ * ++ * DWC portability library, low level os-wrapper functions ++ * ++ */ ++ ++/* These basic types need to be defined by some OS header file or custom header ++ * file for your specific target architecture. ++ * ++ * uint8_t, int8_t, uint16_t, int16_t, uint32_t, int32_t, uint64_t, int64_t ++ * ++ * Any custom or alternate header file must be added and enabled here. ++ */ ++ ++#ifdef DWC_LINUX ++# include <linux/types.h> ++# ifdef CONFIG_DEBUG_MUTEXES ++# include <linux/mutex.h> ++# endif ++# include <linux/spinlock.h> ++# include <linux/errno.h> ++# include <stdarg.h> ++#endif ++ ++#if defined(DWC_FREEBSD) || defined(DWC_NETBSD) ++# include <os_dep.h> ++#endif ++ ++ ++/** @name Primitive Types and Values */ ++ ++/** We define a boolean type for consistency. Can be either YES or NO */ ++typedef uint8_t dwc_bool_t; ++#define YES 1 ++#define NO 0 ++ ++#ifdef DWC_LINUX ++ ++/** @name Error Codes */ ++#define DWC_E_INVALID EINVAL ++#define DWC_E_NO_MEMORY ENOMEM ++#define DWC_E_NO_DEVICE ENODEV ++#define DWC_E_NOT_SUPPORTED EOPNOTSUPP ++#define DWC_E_TIMEOUT ETIMEDOUT ++#define DWC_E_BUSY EBUSY ++#define DWC_E_AGAIN EAGAIN ++#define DWC_E_RESTART ERESTART ++#define DWC_E_ABORT ECONNABORTED ++#define DWC_E_SHUTDOWN ESHUTDOWN ++#define DWC_E_NO_DATA ENODATA ++#define DWC_E_DISCONNECT ECONNRESET ++#define DWC_E_UNKNOWN EINVAL ++#define DWC_E_NO_STREAM_RES ENOSR ++#define DWC_E_COMMUNICATION ECOMM ++#define DWC_E_OVERFLOW EOVERFLOW ++#define DWC_E_PROTOCOL EPROTO ++#define DWC_E_IN_PROGRESS EINPROGRESS ++#define DWC_E_PIPE EPIPE ++#define DWC_E_IO EIO ++#define DWC_E_NO_SPACE ENOSPC ++ ++#else ++ ++/** @name Error Codes */ ++#define DWC_E_INVALID 1001 ++#define DWC_E_NO_MEMORY 1002 ++#define DWC_E_NO_DEVICE 1003 ++#define DWC_E_NOT_SUPPORTED 1004 ++#define DWC_E_TIMEOUT 1005 ++#define DWC_E_BUSY 1006 ++#define DWC_E_AGAIN 1007 ++#define DWC_E_RESTART 1008 ++#define DWC_E_ABORT 1009 ++#define DWC_E_SHUTDOWN 1010 ++#define DWC_E_NO_DATA 1011 ++#define DWC_E_DISCONNECT 2000 ++#define DWC_E_UNKNOWN 3000 ++#define DWC_E_NO_STREAM_RES 4001 ++#define DWC_E_COMMUNICATION 4002 ++#define DWC_E_OVERFLOW 4003 ++#define DWC_E_PROTOCOL 4004 ++#define DWC_E_IN_PROGRESS 4005 ++#define DWC_E_PIPE 4006 ++#define DWC_E_IO 4007 ++#define DWC_E_NO_SPACE 4008 ++ ++#endif ++ ++ ++/** @name Tracing/Logging Functions ++ * ++ * These function provide the capability to add tracing, debugging, and error ++ * messages, as well exceptions as assertions. The WUDEV uses these ++ * extensively. These could be logged to the main console, the serial port, an ++ * internal buffer, etc. These functions could also be no-op if they are too ++ * expensive on your system. By default undefining the DEBUG macro already ++ * no-ops some of these functions. */ ++ ++/** Returns non-zero if in interrupt context. */ ++extern dwc_bool_t DWC_IN_IRQ(void); ++#define dwc_in_irq DWC_IN_IRQ ++ ++/** Returns "IRQ" if DWC_IN_IRQ is true. */ ++static inline char *dwc_irq(void) { ++ return DWC_IN_IRQ() ? "IRQ" : ""; ++} ++ ++/** Returns non-zero if in bottom-half context. */ ++extern dwc_bool_t DWC_IN_BH(void); ++#define dwc_in_bh DWC_IN_BH ++ ++/** Returns "BH" if DWC_IN_BH is true. */ ++static inline char *dwc_bh(void) { ++ return DWC_IN_BH() ? "BH" : ""; ++} ++ ++/** ++ * A vprintf() clone. Just call vprintf if you've got it. ++ */ ++extern void DWC_VPRINTF(char *format, va_list args); ++#define dwc_vprintf DWC_VPRINTF ++ ++/** ++ * A vsnprintf() clone. Just call vprintf if you've got it. ++ */ ++extern int DWC_VSNPRINTF(char *str, int size, char *format, va_list args); ++#define dwc_vsnprintf DWC_VSNPRINTF ++ ++/** ++ * printf() clone. Just call printf if you've go it. ++ */ ++extern void DWC_PRINTF(char *format, ...) ++/* This provides compiler level static checking of the parameters if you're ++ * using GCC. */ ++#ifdef __GNUC__ ++ __attribute__ ((format(printf, 1, 2))); ++#else ++ ; ++#endif ++#define dwc_printf DWC_PRINTF ++ ++/** ++ * sprintf() clone. Just call sprintf if you've got it. ++ */ ++extern int DWC_SPRINTF(char *string, char *format, ...) ++#ifdef __GNUC__ ++ __attribute__ ((format(printf, 2, 3))); ++#else ++ ; ++#endif ++#define dwc_sprintf DWC_SPRINTF ++ ++/** ++ * snprintf() clone. Just call snprintf if you've got it. ++ */ ++extern int DWC_SNPRINTF(char *string, int size, char *format, ...) ++#ifdef __GNUC__ ++ __attribute__ ((format(printf, 3, 4))); ++#else ++ ; ++#endif ++#define dwc_snprintf DWC_SNPRINTF ++ ++/** ++ * Prints a WARNING message. On systems that don't differentiate between ++ * warnings and regular log messages, just print it. Indicates that something ++ * may be wrong with the driver. Works like printf(). ++ * ++ * Use the DWC_WARN macro to call this function. ++ */ ++extern void __DWC_WARN(char *format, ...) ++#ifdef __GNUC__ ++ __attribute__ ((format(printf, 1, 2))); ++#else ++ ; ++#endif ++ ++/** ++ * Prints an error message. On systems that don't differentiate between errors ++ * and regular log messages, just print it. Indicates that something went wrong ++ * with the driver. Works like printf(). ++ * ++ * Use the DWC_ERROR macro to call this function. ++ */ ++extern void __DWC_ERROR(char *format, ...) ++#ifdef __GNUC__ ++ __attribute__ ((format(printf, 1, 2))); ++#else ++ ; ++#endif ++ ++/** ++ * Prints an exception error message and takes some user-defined action such as ++ * print out a backtrace or trigger a breakpoint. Indicates that something went ++ * abnormally wrong with the driver such as programmer error, or other ++ * exceptional condition. It should not be ignored so even on systems without ++ * printing capability, some action should be taken to notify the developer of ++ * it. Works like printf(). ++ */ ++extern void DWC_EXCEPTION(char *format, ...) ++#ifdef __GNUC__ ++ __attribute__ ((format(printf, 1, 2))); ++#else ++ ; ++#endif ++#define dwc_exception DWC_EXCEPTION ++ ++#ifndef DWC_OTG_DEBUG_LEV ++#define DWC_OTG_DEBUG_LEV 0 ++#endif ++ ++#ifdef DEBUG ++/** ++ * Prints out a debug message. Used for logging/trace messages. ++ * ++ * Use the DWC_DEBUG macro to call this function ++ */ ++extern void __DWC_DEBUG(char *format, ...) ++#ifdef __GNUC__ ++ __attribute__ ((format(printf, 1, 2))); ++#else ++ ; ++#endif ++#else ++#define __DWC_DEBUG printk ++#endif ++ ++/** ++ * Prints out a Debug message. ++ */ ++#define DWC_DEBUG(_format, _args...) __DWC_DEBUG("DEBUG:%s:%s: " _format "\n", \ ++ __func__, dwc_irq(), ## _args) ++#define dwc_debug DWC_DEBUG ++/** ++ * Prints out a Debug message if enabled at compile time. ++ */ ++#if DWC_OTG_DEBUG_LEV > 0 ++#define DWC_DEBUGC(_format, _args...) DWC_DEBUG(_format, ##_args ) ++#else ++#define DWC_DEBUGC(_format, _args...) ++#endif ++#define dwc_debugc DWC_DEBUGC ++/** ++ * Prints out an informative message. ++ */ ++#define DWC_INFO(_format, _args...) DWC_PRINTF("INFO:%s: " _format "\n", \ ++ dwc_irq(), ## _args) ++#define dwc_info DWC_INFO ++/** ++ * Prints out an informative message if enabled at compile time. ++ */ ++#if DWC_OTG_DEBUG_LEV > 1 ++#define DWC_INFOC(_format, _args...) DWC_INFO(_format, ##_args ) ++#else ++#define DWC_INFOC(_format, _args...) ++#endif ++#define dwc_infoc DWC_INFOC ++/** ++ * Prints out a warning message. ++ */ ++#define DWC_WARN(_format, _args...) __DWC_WARN("WARN:%s:%s:%d: " _format "\n", \ ++ dwc_irq(), __func__, __LINE__, ## _args) ++#define dwc_warn DWC_WARN ++/** ++ * Prints out an error message. ++ */ ++#define DWC_ERROR(_format, _args...) __DWC_ERROR("ERROR:%s:%s:%d: " _format "\n", \ ++ dwc_irq(), __func__, __LINE__, ## _args) ++#define dwc_error DWC_ERROR ++ ++#define DWC_PROTO_ERROR(_format, _args...) __DWC_WARN("ERROR:%s:%s:%d: " _format "\n", \ ++ dwc_irq(), __func__, __LINE__, ## _args) ++#define dwc_proto_error DWC_PROTO_ERROR ++ ++#ifdef DEBUG ++/** Prints out a exception error message if the _expr expression fails. Disabled ++ * if DEBUG is not enabled. */ ++#define DWC_ASSERT(_expr, _format, _args...) do { \ ++ if (!(_expr)) { DWC_EXCEPTION("%s:%s:%d: " _format "\n", dwc_irq(), \ ++ __FILE__, __LINE__, ## _args); } \ ++ } while (0) ++#else ++#define DWC_ASSERT(_x...) ++#endif ++#define dwc_assert DWC_ASSERT ++ ++ ++/** @name Byte Ordering ++ * The following functions are for conversions between processor's byte ordering ++ * and specific ordering you want. ++ */ ++ ++/** Converts 32 bit data in CPU byte ordering to little endian. */ ++extern uint32_t DWC_CPU_TO_LE32(uint32_t *p); ++#define dwc_cpu_to_le32 DWC_CPU_TO_LE32 ++ ++/** Converts 32 bit data in CPU byte orderint to big endian. */ ++extern uint32_t DWC_CPU_TO_BE32(uint32_t *p); ++#define dwc_cpu_to_be32 DWC_CPU_TO_BE32 ++ ++/** Converts 32 bit little endian data to CPU byte ordering. */ ++extern uint32_t DWC_LE32_TO_CPU(uint32_t *p); ++#define dwc_le32_to_cpu DWC_LE32_TO_CPU ++ ++/** Converts 32 bit big endian data to CPU byte ordering. */ ++extern uint32_t DWC_BE32_TO_CPU(uint32_t *p); ++#define dwc_be32_to_cpu DWC_BE32_TO_CPU ++ ++/** Converts 16 bit data in CPU byte ordering to little endian. */ ++extern uint16_t DWC_CPU_TO_LE16(uint16_t *p); ++#define dwc_cpu_to_le16 DWC_CPU_TO_LE16 ++ ++/** Converts 16 bit data in CPU byte orderint to big endian. */ ++extern uint16_t DWC_CPU_TO_BE16(uint16_t *p); ++#define dwc_cpu_to_be16 DWC_CPU_TO_BE16 ++ ++/** Converts 16 bit little endian data to CPU byte ordering. */ ++extern uint16_t DWC_LE16_TO_CPU(uint16_t *p); ++#define dwc_le16_to_cpu DWC_LE16_TO_CPU ++ ++/** Converts 16 bit bi endian data to CPU byte ordering. */ ++extern uint16_t DWC_BE16_TO_CPU(uint16_t *p); ++#define dwc_be16_to_cpu DWC_BE16_TO_CPU ++ ++ ++/** @name Register Read/Write ++ * ++ * The following six functions should be implemented to read/write registers of ++ * 32-bit and 64-bit sizes. All modules use this to read/write register values. ++ * The reg value is a pointer to the register calculated from the void *base ++ * variable passed into the driver when it is started. */ ++ ++#ifdef DWC_LINUX ++/* Linux doesn't need any extra parameters for register read/write, so we ++ * just throw away the IO context parameter. ++ */ ++/** Reads the content of a 32-bit register. */ ++extern uint32_t DWC_READ_REG32(uint32_t volatile *reg); ++#define dwc_read_reg32(_ctx_,_reg_) DWC_READ_REG32(_reg_) ++ ++/** Reads the content of a 64-bit register. */ ++extern uint64_t DWC_READ_REG64(uint64_t volatile *reg); ++#define dwc_read_reg64(_ctx_,_reg_) DWC_READ_REG64(_reg_) ++ ++/** Writes to a 32-bit register. */ ++extern void DWC_WRITE_REG32(uint32_t volatile *reg, uint32_t value); ++#define dwc_write_reg32(_ctx_,_reg_,_val_) DWC_WRITE_REG32(_reg_, _val_) ++ ++/** Writes to a 64-bit register. */ ++extern void DWC_WRITE_REG64(uint64_t volatile *reg, uint64_t value); ++#define dwc_write_reg64(_ctx_,_reg_,_val_) DWC_WRITE_REG64(_reg_, _val_) ++ ++/** ++ * Modify bit values in a register. Using the ++ * algorithm: (reg_contents & ~clear_mask) | set_mask. ++ */ ++extern void DWC_MODIFY_REG32(uint32_t volatile *reg, uint32_t clear_mask, uint32_t set_mask); ++#define dwc_modify_reg32(_ctx_,_reg_,_cmsk_,_smsk_) DWC_MODIFY_REG32(_reg_,_cmsk_,_smsk_) ++extern void DWC_MODIFY_REG64(uint64_t volatile *reg, uint64_t clear_mask, uint64_t set_mask); ++#define dwc_modify_reg64(_ctx_,_reg_,_cmsk_,_smsk_) DWC_MODIFY_REG64(_reg_,_cmsk_,_smsk_) ++ ++#endif /* DWC_LINUX */ ++ ++#if defined(DWC_FREEBSD) || defined(DWC_NETBSD) ++typedef struct dwc_ioctx { ++ struct device *dev; ++ bus_space_tag_t iot; ++ bus_space_handle_t ioh; ++} dwc_ioctx_t; ++ ++/** BSD needs two extra parameters for register read/write, so we pass ++ * them in using the IO context parameter. ++ */ ++/** Reads the content of a 32-bit register. */ ++extern uint32_t DWC_READ_REG32(void *io_ctx, uint32_t volatile *reg); ++#define dwc_read_reg32 DWC_READ_REG32 ++ ++/** Reads the content of a 64-bit register. */ ++extern uint64_t DWC_READ_REG64(void *io_ctx, uint64_t volatile *reg); ++#define dwc_read_reg64 DWC_READ_REG64 ++ ++/** Writes to a 32-bit register. */ ++extern void DWC_WRITE_REG32(void *io_ctx, uint32_t volatile *reg, uint32_t value); ++#define dwc_write_reg32 DWC_WRITE_REG32 ++ ++/** Writes to a 64-bit register. */ ++extern void DWC_WRITE_REG64(void *io_ctx, uint64_t volatile *reg, uint64_t value); ++#define dwc_write_reg64 DWC_WRITE_REG64 ++ ++/** ++ * Modify bit values in a register. Using the ++ * algorithm: (reg_contents & ~clear_mask) | set_mask. ++ */ ++extern void DWC_MODIFY_REG32(void *io_ctx, uint32_t volatile *reg, uint32_t clear_mask, uint32_t set_mask); ++#define dwc_modify_reg32 DWC_MODIFY_REG32 ++extern void DWC_MODIFY_REG64(void *io_ctx, uint64_t volatile *reg, uint64_t clear_mask, uint64_t set_mask); ++#define dwc_modify_reg64 DWC_MODIFY_REG64 ++ ++#endif /* DWC_FREEBSD || DWC_NETBSD */ ++ ++/** @cond */ ++ ++/** @name Some convenience MACROS used internally. Define DWC_DEBUG_REGS to log the ++ * register writes. */ ++ ++#ifdef DWC_LINUX ++ ++# ifdef DWC_DEBUG_REGS ++ ++#define dwc_define_read_write_reg_n(_reg,_container_type) \ ++static inline uint32_t dwc_read_##_reg##_n(_container_type *container, int num) { \ ++ return DWC_READ_REG32(&container->regs->_reg[num]); \ ++} \ ++static inline void dwc_write_##_reg##_n(_container_type *container, int num, uint32_t data) { \ ++ DWC_DEBUG("WRITING %8s[%d]: %p: %08x", #_reg, num, \ ++ &(((uint32_t*)container->regs->_reg)[num]), data); \ ++ DWC_WRITE_REG32(&(((uint32_t*)container->regs->_reg)[num]), data); \ ++} ++ ++#define dwc_define_read_write_reg(_reg,_container_type) \ ++static inline uint32_t dwc_read_##_reg(_container_type *container) { \ ++ return DWC_READ_REG32(&container->regs->_reg); \ ++} \ ++static inline void dwc_write_##_reg(_container_type *container, uint32_t data) { \ ++ DWC_DEBUG("WRITING %11s: %p: %08x", #_reg, &container->regs->_reg, data); \ ++ DWC_WRITE_REG32(&container->regs->_reg, data); \ ++} ++ ++# else /* DWC_DEBUG_REGS */ ++ ++#define dwc_define_read_write_reg_n(_reg,_container_type) \ ++static inline uint32_t dwc_read_##_reg##_n(_container_type *container, int num) { \ ++ return DWC_READ_REG32(&container->regs->_reg[num]); \ ++} \ ++static inline void dwc_write_##_reg##_n(_container_type *container, int num, uint32_t data) { \ ++ DWC_WRITE_REG32(&(((uint32_t*)container->regs->_reg)[num]), data); \ ++} ++ ++#define dwc_define_read_write_reg(_reg,_container_type) \ ++static inline uint32_t dwc_read_##_reg(_container_type *container) { \ ++ return DWC_READ_REG32(&container->regs->_reg); \ ++} \ ++static inline void dwc_write_##_reg(_container_type *container, uint32_t data) { \ ++ DWC_WRITE_REG32(&container->regs->_reg, data); \ ++} ++ ++# endif /* DWC_DEBUG_REGS */ ++ ++#endif /* DWC_LINUX */ ++ ++#if defined(DWC_FREEBSD) || defined(DWC_NETBSD) ++ ++# ifdef DWC_DEBUG_REGS ++ ++#define dwc_define_read_write_reg_n(_reg,_container_type) \ ++static inline uint32_t dwc_read_##_reg##_n(void *io_ctx, _container_type *container, int num) { \ ++ return DWC_READ_REG32(io_ctx, &container->regs->_reg[num]); \ ++} \ ++static inline void dwc_write_##_reg##_n(void *io_ctx, _container_type *container, int num, uint32_t data) { \ ++ DWC_DEBUG("WRITING %8s[%d]: %p: %08x", #_reg, num, \ ++ &(((uint32_t*)container->regs->_reg)[num]), data); \ ++ DWC_WRITE_REG32(io_ctx, &(((uint32_t*)container->regs->_reg)[num]), data); \ ++} ++ ++#define dwc_define_read_write_reg(_reg,_container_type) \ ++static inline uint32_t dwc_read_##_reg(void *io_ctx, _container_type *container) { \ ++ return DWC_READ_REG32(io_ctx, &container->regs->_reg); \ ++} \ ++static inline void dwc_write_##_reg(void *io_ctx, _container_type *container, uint32_t data) { \ ++ DWC_DEBUG("WRITING %11s: %p: %08x", #_reg, &container->regs->_reg, data); \ ++ DWC_WRITE_REG32(io_ctx, &container->regs->_reg, data); \ ++} ++ ++# else /* DWC_DEBUG_REGS */ ++ ++#define dwc_define_read_write_reg_n(_reg,_container_type) \ ++static inline uint32_t dwc_read_##_reg##_n(void *io_ctx, _container_type *container, int num) { \ ++ return DWC_READ_REG32(io_ctx, &container->regs->_reg[num]); \ ++} \ ++static inline void dwc_write_##_reg##_n(void *io_ctx, _container_type *container, int num, uint32_t data) { \ ++ DWC_WRITE_REG32(io_ctx, &(((uint32_t*)container->regs->_reg)[num]), data); \ ++} ++ ++#define dwc_define_read_write_reg(_reg,_container_type) \ ++static inline uint32_t dwc_read_##_reg(void *io_ctx, _container_type *container) { \ ++ return DWC_READ_REG32(io_ctx, &container->regs->_reg); \ ++} \ ++static inline void dwc_write_##_reg(void *io_ctx, _container_type *container, uint32_t data) { \ ++ DWC_WRITE_REG32(io_ctx, &container->regs->_reg, data); \ ++} ++ ++# endif /* DWC_DEBUG_REGS */ ++ ++#endif /* DWC_FREEBSD || DWC_NETBSD */ ++ ++/** @endcond */ ++ ++ ++#ifdef DWC_CRYPTOLIB ++/** @name Crypto Functions ++ * ++ * These are the low-level cryptographic functions used by the driver. */ ++ ++/** Perform AES CBC */ ++extern int DWC_AES_CBC(uint8_t *message, uint32_t messagelen, uint8_t *key, uint32_t keylen, uint8_t iv[16], uint8_t *out); ++#define dwc_aes_cbc DWC_AES_CBC ++ ++/** Fill the provided buffer with random bytes. These should be cryptographic grade random numbers. */ ++extern void DWC_RANDOM_BYTES(uint8_t *buffer, uint32_t length); ++#define dwc_random_bytes DWC_RANDOM_BYTES ++ ++/** Perform the SHA-256 hash function */ ++extern int DWC_SHA256(uint8_t *message, uint32_t len, uint8_t *out); ++#define dwc_sha256 DWC_SHA256 ++ ++/** Calculated the HMAC-SHA256 */ ++extern int DWC_HMAC_SHA256(uint8_t *message, uint32_t messagelen, uint8_t *key, uint32_t keylen, uint8_t *out); ++#define dwc_hmac_sha256 DWC_HMAC_SHA256 ++ ++#endif /* DWC_CRYPTOLIB */ ++ ++ ++/** @name Memory Allocation ++ * ++ * These function provide access to memory allocation. There are only 2 DMA ++ * functions and 3 Regular memory functions that need to be implemented. None ++ * of the memory debugging routines need to be implemented. The allocation ++ * routines all ZERO the contents of the memory. ++ * ++ * Defining DWC_DEBUG_MEMORY turns on memory debugging and statistic gathering. ++ * This checks for memory leaks, keeping track of alloc/free pairs. It also ++ * keeps track of how much memory the driver is using at any given time. */ ++ ++#define DWC_PAGE_SIZE 4096 ++#define DWC_PAGE_OFFSET(addr) (((uint32_t)addr) & 0xfff) ++#define DWC_PAGE_ALIGNED(addr) ((((uint32_t)addr) & 0xfff) == 0) ++ ++#define DWC_INVALID_DMA_ADDR 0x0 ++ ++#ifdef DWC_LINUX ++/** Type for a DMA address */ ++typedef dma_addr_t dwc_dma_t; ++#endif ++ ++#if defined(DWC_FREEBSD) || defined(DWC_NETBSD) ++typedef bus_addr_t dwc_dma_t; ++#endif ++ ++#ifdef DWC_FREEBSD ++typedef struct dwc_dmactx { ++ struct device *dev; ++ bus_dma_tag_t dma_tag; ++ bus_dmamap_t dma_map; ++ bus_addr_t dma_paddr; ++ void *dma_vaddr; ++} dwc_dmactx_t; ++#endif ++ ++#ifdef DWC_NETBSD ++typedef struct dwc_dmactx { ++ struct device *dev; ++ bus_dma_tag_t dma_tag; ++ bus_dmamap_t dma_map; ++ bus_dma_segment_t segs[1]; ++ int nsegs; ++ bus_addr_t dma_paddr; ++ void *dma_vaddr; ++} dwc_dmactx_t; ++#endif ++ ++/* @todo these functions will be added in the future */ ++#if 0 ++/** ++ * Creates a DMA pool from which you can allocate DMA buffers. Buffers ++ * allocated from this pool will be guaranteed to meet the size, alignment, and ++ * boundary requirements specified. ++ * ++ * @param[in] size Specifies the size of the buffers that will be allocated from ++ * this pool. ++ * @param[in] align Specifies the byte alignment requirements of the buffers ++ * allocated from this pool. Must be a power of 2. ++ * @param[in] boundary Specifies the N-byte boundary that buffers allocated from ++ * this pool must not cross. ++ * ++ * @returns A pointer to an internal opaque structure which is not to be ++ * accessed outside of these library functions. Use this handle to specify ++ * which pools to allocate/free DMA buffers from and also to destroy the pool, ++ * when you are done with it. ++ */ ++extern dwc_pool_t *DWC_DMA_POOL_CREATE(uint32_t size, uint32_t align, uint32_t boundary); ++ ++/** ++ * Destroy a DMA pool. All buffers allocated from that pool must be freed first. ++ */ ++extern void DWC_DMA_POOL_DESTROY(dwc_pool_t *pool); ++ ++/** ++ * Allocate a buffer from the specified DMA pool and zeros its contents. ++ */ ++extern void *DWC_DMA_POOL_ALLOC(dwc_pool_t *pool, uint64_t *dma_addr); ++ ++/** ++ * Free a previously allocated buffer from the DMA pool. ++ */ ++extern void DWC_DMA_POOL_FREE(dwc_pool_t *pool, void *vaddr, void *daddr); ++#endif ++ ++/** Allocates a DMA capable buffer and zeroes its contents. */ ++extern void *__DWC_DMA_ALLOC(void *dma_ctx, uint32_t size, dwc_dma_t *dma_addr); ++ ++/** Allocates a DMA capable buffer and zeroes its contents in atomic contest */ ++extern void *__DWC_DMA_ALLOC_ATOMIC(void *dma_ctx, uint32_t size, dwc_dma_t *dma_addr); ++ ++/** Frees a previously allocated buffer. */ ++extern void __DWC_DMA_FREE(void *dma_ctx, uint32_t size, void *virt_addr, dwc_dma_t dma_addr); ++ ++/** Allocates a block of memory and zeroes its contents. */ ++extern void *__DWC_ALLOC(void *mem_ctx, uint32_t size); ++ ++/** Allocates a block of memory and zeroes its contents, in an atomic manner ++ * which can be used inside interrupt context. The size should be sufficiently ++ * small, a few KB at most, such that failures are not likely to occur. Can just call ++ * __DWC_ALLOC if it is atomic. */ ++extern void *__DWC_ALLOC_ATOMIC(void *mem_ctx, uint32_t size); ++ ++/** Frees a previously allocated buffer. */ ++extern void __DWC_FREE(void *mem_ctx, void *addr); ++ ++#ifndef DWC_DEBUG_MEMORY ++ ++#define DWC_ALLOC(_size_) __DWC_ALLOC(NULL, _size_) ++#define DWC_ALLOC_ATOMIC(_size_) __DWC_ALLOC_ATOMIC(NULL, _size_) ++#define DWC_FREE(_addr_) __DWC_FREE(NULL, _addr_) ++ ++# ifdef DWC_LINUX ++#define DWC_DMA_ALLOC(_size_,_dma_) __DWC_DMA_ALLOC(NULL, _size_, _dma_) ++#define DWC_DMA_ALLOC_ATOMIC(_size_,_dma_) __DWC_DMA_ALLOC_ATOMIC(NULL, _size_,_dma_) ++#define DWC_DMA_FREE(_size_,_virt_,_dma_) __DWC_DMA_FREE(NULL, _size_, _virt_, _dma_) ++# endif ++ ++# if defined(DWC_FREEBSD) || defined(DWC_NETBSD) ++#define DWC_DMA_ALLOC __DWC_DMA_ALLOC ++#define DWC_DMA_FREE __DWC_DMA_FREE ++# endif ++extern void *dwc_dma_alloc_atomic_debug(uint32_t size, dwc_dma_t *dma_addr, char const *func, int line); ++ ++#else /* DWC_DEBUG_MEMORY */ ++ ++extern void *dwc_alloc_debug(void *mem_ctx, uint32_t size, char const *func, int line); ++extern void *dwc_alloc_atomic_debug(void *mem_ctx, uint32_t size, char const *func, int line); ++extern void dwc_free_debug(void *mem_ctx, void *addr, char const *func, int line); ++extern void *dwc_dma_alloc_debug(void *dma_ctx, uint32_t size, dwc_dma_t *dma_addr, ++ char const *func, int line); ++extern void *dwc_dma_alloc_atomic_debug(void *dma_ctx, uint32_t size, dwc_dma_t *dma_addr, ++ char const *func, int line); ++extern void dwc_dma_free_debug(void *dma_ctx, uint32_t size, void *virt_addr, ++ dwc_dma_t dma_addr, char const *func, int line); ++ ++extern int dwc_memory_debug_start(void *mem_ctx); ++extern void dwc_memory_debug_stop(void); ++extern void dwc_memory_debug_report(void); ++ ++#define DWC_ALLOC(_size_) dwc_alloc_debug(NULL, _size_, __func__, __LINE__) ++#define DWC_ALLOC_ATOMIC(_size_) dwc_alloc_atomic_debug(NULL, _size_, \ ++ __func__, __LINE__) ++#define DWC_FREE(_addr_) dwc_free_debug(NULL, _addr_, __func__, __LINE__) ++ ++# ifdef DWC_LINUX ++#define DWC_DMA_ALLOC(_size_,_dma_) dwc_dma_alloc_debug(NULL, _size_, \ ++ _dma_, __func__, __LINE__) ++#define DWC_DMA_ALLOC_ATOMIC(_size_,_dma_) dwc_dma_alloc_atomic_debug(NULL, _size_, \ ++ _dma_, __func__, __LINE__) ++#define DWC_DMA_FREE(_size_,_virt_,_dma_) dwc_dma_free_debug(NULL, _size_, \ ++ _virt_, _dma_, __func__, __LINE__) ++# endif ++ ++# if defined(DWC_FREEBSD) || defined(DWC_NETBSD) ++#define DWC_DMA_ALLOC(_ctx_,_size_,_dma_) dwc_dma_alloc_debug(_ctx_, _size_, \ ++ _dma_, __func__, __LINE__) ++#define DWC_DMA_FREE(_ctx_,_size_,_virt_,_dma_) dwc_dma_free_debug(_ctx_, _size_, \ ++ _virt_, _dma_, __func__, __LINE__) ++# endif ++ ++#endif /* DWC_DEBUG_MEMORY */ ++ ++#define dwc_alloc(_ctx_,_size_) DWC_ALLOC(_size_) ++#define dwc_alloc_atomic(_ctx_,_size_) DWC_ALLOC_ATOMIC(_size_) ++#define dwc_free(_ctx_,_addr_) DWC_FREE(_addr_) ++ ++#ifdef DWC_LINUX ++/* Linux doesn't need any extra parameters for DMA buffer allocation, so we ++ * just throw away the DMA context parameter. ++ */ ++#define dwc_dma_alloc(_ctx_,_size_,_dma_) DWC_DMA_ALLOC(_size_, _dma_) ++#define dwc_dma_alloc_atomic(_ctx_,_size_,_dma_) DWC_DMA_ALLOC_ATOMIC(_size_, _dma_) ++#define dwc_dma_free(_ctx_,_size_,_virt_,_dma_) DWC_DMA_FREE(_size_, _virt_, _dma_) ++#endif ++ ++#if defined(DWC_FREEBSD) || defined(DWC_NETBSD) ++/** BSD needs several extra parameters for DMA buffer allocation, so we pass ++ * them in using the DMA context parameter. ++ */ ++#define dwc_dma_alloc DWC_DMA_ALLOC ++#define dwc_dma_free DWC_DMA_FREE ++#endif ++ ++ ++/** @name Memory and String Processing */ ++ ++/** memset() clone */ ++extern void *DWC_MEMSET(void *dest, uint8_t byte, uint32_t size); ++#define dwc_memset DWC_MEMSET ++ ++/** memcpy() clone */ ++extern void *DWC_MEMCPY(void *dest, void const *src, uint32_t size); ++#define dwc_memcpy DWC_MEMCPY ++ ++/** memmove() clone */ ++extern void *DWC_MEMMOVE(void *dest, void *src, uint32_t size); ++#define dwc_memmove DWC_MEMMOVE ++ ++/** memcmp() clone */ ++extern int DWC_MEMCMP(void *m1, void *m2, uint32_t size); ++#define dwc_memcmp DWC_MEMCMP ++ ++/** strcmp() clone */ ++extern int DWC_STRCMP(void *s1, void *s2); ++#define dwc_strcmp DWC_STRCMP ++ ++/** strncmp() clone */ ++extern int DWC_STRNCMP(void *s1, void *s2, uint32_t size); ++#define dwc_strncmp DWC_STRNCMP ++ ++/** strlen() clone, for NULL terminated ASCII strings */ ++extern int DWC_STRLEN(char const *str); ++#define dwc_strlen DWC_STRLEN ++ ++/** strcpy() clone, for NULL terminated ASCII strings */ ++extern char *DWC_STRCPY(char *to, const char *from); ++#define dwc_strcpy DWC_STRCPY ++ ++/** strdup() clone. If you wish to use memory allocation debugging, this ++ * implementation of strdup should use the DWC_* memory routines instead of ++ * calling a predefined strdup. Otherwise the memory allocated by this routine ++ * will not be seen by the debugging routines. */ ++extern char *DWC_STRDUP(char const *str); ++#define dwc_strdup(_ctx_,_str_) DWC_STRDUP(_str_) ++ ++/** NOT an atoi() clone. Read the description carefully. Returns an integer ++ * converted from the string str in base 10 unless the string begins with a "0x" ++ * in which case it is base 16. String must be a NULL terminated sequence of ++ * ASCII characters and may optionally begin with whitespace, a + or -, and a ++ * "0x" prefix if base 16. The remaining characters must be valid digits for ++ * the number and end with a NULL character. If any invalid characters are ++ * encountered or it returns with a negative error code and the results of the ++ * conversion are undefined. On sucess it returns 0. Overflow conditions are ++ * undefined. An example implementation using atoi() can be referenced from the ++ * Linux implementation. */ ++extern int DWC_ATOI(const char *str, int32_t *value); ++#define dwc_atoi DWC_ATOI ++ ++/** Same as above but for unsigned. */ ++extern int DWC_ATOUI(const char *str, uint32_t *value); ++#define dwc_atoui DWC_ATOUI ++ ++#ifdef DWC_UTFLIB ++/** This routine returns a UTF16LE unicode encoded string from a UTF8 string. */ ++extern int DWC_UTF8_TO_UTF16LE(uint8_t const *utf8string, uint16_t *utf16string, unsigned len); ++#define dwc_utf8_to_utf16le DWC_UTF8_TO_UTF16LE ++#endif ++ ++ ++/** @name Wait queues ++ * ++ * Wait queues provide a means of synchronizing between threads or processes. A ++ * process can block on a waitq if some condition is not true, waiting for it to ++ * become true. When the waitq is triggered all waiting process will get ++ * unblocked and the condition will be check again. Waitqs should be triggered ++ * every time a condition can potentially change.*/ ++struct dwc_waitq; ++ ++/** Type for a waitq */ ++typedef struct dwc_waitq dwc_waitq_t; ++ ++/** The type of waitq condition callback function. This is called every time ++ * condition is evaluated. */ ++typedef int (*dwc_waitq_condition_t)(void *data); ++ ++/** Allocate a waitq */ ++extern dwc_waitq_t *DWC_WAITQ_ALLOC(void); ++#define dwc_waitq_alloc(_ctx_) DWC_WAITQ_ALLOC() ++ ++/** Free a waitq */ ++extern void DWC_WAITQ_FREE(dwc_waitq_t *wq); ++#define dwc_waitq_free DWC_WAITQ_FREE ++ ++/** Check the condition and if it is false, block on the waitq. When unblocked, check the ++ * condition again. The function returns when the condition becomes true. The return value ++ * is 0 on condition true, DWC_WAITQ_ABORTED on abort or killed, or DWC_WAITQ_UNKNOWN on error. */ ++extern int32_t DWC_WAITQ_WAIT(dwc_waitq_t *wq, dwc_waitq_condition_t cond, void *data); ++#define dwc_waitq_wait DWC_WAITQ_WAIT ++ ++/** Check the condition and if it is false, block on the waitq. When unblocked, ++ * check the condition again. The function returns when the condition become ++ * true or the timeout has passed. The return value is 0 on condition true or ++ * DWC_TIMED_OUT on timeout, or DWC_WAITQ_ABORTED, or DWC_WAITQ_UNKNOWN on ++ * error. */ ++extern int32_t DWC_WAITQ_WAIT_TIMEOUT(dwc_waitq_t *wq, dwc_waitq_condition_t cond, ++ void *data, int32_t msecs); ++#define dwc_waitq_wait_timeout DWC_WAITQ_WAIT_TIMEOUT ++ ++/** Trigger a waitq, unblocking all processes. This should be called whenever a condition ++ * has potentially changed. */ ++extern void DWC_WAITQ_TRIGGER(dwc_waitq_t *wq); ++#define dwc_waitq_trigger DWC_WAITQ_TRIGGER ++ ++/** Unblock all processes waiting on the waitq with an ABORTED result. */ ++extern void DWC_WAITQ_ABORT(dwc_waitq_t *wq); ++#define dwc_waitq_abort DWC_WAITQ_ABORT ++ ++ ++/** @name Threads ++ * ++ * A thread must be explicitly stopped. It must check DWC_THREAD_SHOULD_STOP ++ * whenever it is woken up, and then return. The DWC_THREAD_STOP function ++ * returns the value from the thread. ++ */ ++ ++struct dwc_thread; ++ ++/** Type for a thread */ ++typedef struct dwc_thread dwc_thread_t; ++ ++/** The thread function */ ++typedef int (*dwc_thread_function_t)(void *data); ++ ++/** Create a thread and start it running the thread_function. Returns a handle ++ * to the thread */ ++extern dwc_thread_t *DWC_THREAD_RUN(dwc_thread_function_t func, char *name, void *data); ++#define dwc_thread_run(_ctx_,_func_,_name_,_data_) DWC_THREAD_RUN(_func_, _name_, _data_) ++ ++/** Stops a thread. Return the value returned by the thread. Or will return ++ * DWC_ABORT if the thread never started. */ ++extern int DWC_THREAD_STOP(dwc_thread_t *thread); ++#define dwc_thread_stop DWC_THREAD_STOP ++ ++/** Signifies to the thread that it must stop. */ ++#ifdef DWC_LINUX ++/* Linux doesn't need any parameters for kthread_should_stop() */ ++extern dwc_bool_t DWC_THREAD_SHOULD_STOP(void); ++#define dwc_thread_should_stop(_thrd_) DWC_THREAD_SHOULD_STOP() ++ ++/* No thread_exit function in Linux */ ++#define dwc_thread_exit(_thrd_) ++#endif ++ ++#if defined(DWC_FREEBSD) || defined(DWC_NETBSD) ++/** BSD needs the thread pointer for kthread_suspend_check() */ ++extern dwc_bool_t DWC_THREAD_SHOULD_STOP(dwc_thread_t *thread); ++#define dwc_thread_should_stop DWC_THREAD_SHOULD_STOP ++ ++/** The thread must call this to exit. */ ++extern void DWC_THREAD_EXIT(dwc_thread_t *thread); ++#define dwc_thread_exit DWC_THREAD_EXIT ++#endif ++ ++ ++/** @name Work queues ++ * ++ * Workqs are used to queue a callback function to be called at some later time, ++ * in another thread. */ ++struct dwc_workq; ++ ++/** Type for a workq */ ++typedef struct dwc_workq dwc_workq_t; ++ ++/** The type of the callback function to be called. */ ++typedef void (*dwc_work_callback_t)(void *data); ++ ++/** Allocate a workq */ ++extern dwc_workq_t *DWC_WORKQ_ALLOC(char *name); ++#define dwc_workq_alloc(_ctx_,_name_) DWC_WORKQ_ALLOC(_name_) ++ ++/** Free a workq. All work must be completed before being freed. */ ++extern void DWC_WORKQ_FREE(dwc_workq_t *workq); ++#define dwc_workq_free DWC_WORKQ_FREE ++ ++/** Schedule a callback on the workq, passing in data. The function will be ++ * scheduled at some later time. */ ++extern void DWC_WORKQ_SCHEDULE(dwc_workq_t *workq, dwc_work_callback_t cb, ++ void *data, char *format, ...) ++#ifdef __GNUC__ ++ __attribute__ ((format(printf, 4, 5))); ++#else ++ ; ++#endif ++#define dwc_workq_schedule DWC_WORKQ_SCHEDULE ++ ++/** Schedule a callback on the workq, that will be called until at least ++ * given number miliseconds have passed. */ ++extern void DWC_WORKQ_SCHEDULE_DELAYED(dwc_workq_t *workq, dwc_work_callback_t cb, ++ void *data, uint32_t time, char *format, ...) ++#ifdef __GNUC__ ++ __attribute__ ((format(printf, 5, 6))); ++#else ++ ; ++#endif ++#define dwc_workq_schedule_delayed DWC_WORKQ_SCHEDULE_DELAYED ++ ++/** The number of processes in the workq */ ++extern int DWC_WORKQ_PENDING(dwc_workq_t *workq); ++#define dwc_workq_pending DWC_WORKQ_PENDING ++ ++/** Blocks until all the work in the workq is complete or timed out. Returns < ++ * 0 on timeout. */ ++extern int DWC_WORKQ_WAIT_WORK_DONE(dwc_workq_t *workq, int timeout); ++#define dwc_workq_wait_work_done DWC_WORKQ_WAIT_WORK_DONE ++ ++ ++/** @name Tasklets ++ * ++ */ ++struct dwc_tasklet; ++ ++/** Type for a tasklet */ ++typedef struct dwc_tasklet dwc_tasklet_t; ++ ++/** The type of the callback function to be called */ ++typedef void (*dwc_tasklet_callback_t)(void *data); ++ ++/** Allocates a tasklet */ ++extern dwc_tasklet_t *DWC_TASK_ALLOC(char *name, dwc_tasklet_callback_t cb, void *data); ++#define dwc_task_alloc(_ctx_,_name_,_cb_,_data_) DWC_TASK_ALLOC(_name_, _cb_, _data_) ++ ++/** Frees a tasklet */ ++extern void DWC_TASK_FREE(dwc_tasklet_t *task); ++#define dwc_task_free DWC_TASK_FREE ++ ++/** Schedules a tasklet to run */ ++extern void DWC_TASK_SCHEDULE(dwc_tasklet_t *task); ++#define dwc_task_schedule DWC_TASK_SCHEDULE ++ ++extern void DWC_TASK_HI_SCHEDULE(dwc_tasklet_t *task); ++#define dwc_task_hi_schedule DWC_TASK_HI_SCHEDULE ++ ++/** @name Timer ++ * ++ * Callbacks must be small and atomic. ++ */ ++struct dwc_timer; ++ ++/** Type for a timer */ ++typedef struct dwc_timer dwc_timer_t; ++ ++/** The type of the callback function to be called */ ++typedef void (*dwc_timer_callback_t)(void *data); ++ ++/** Allocates a timer */ ++extern dwc_timer_t *DWC_TIMER_ALLOC(char *name, dwc_timer_callback_t cb, void *data); ++#define dwc_timer_alloc(_ctx_,_name_,_cb_,_data_) DWC_TIMER_ALLOC(_name_,_cb_,_data_) ++ ++/** Frees a timer */ ++extern void DWC_TIMER_FREE(dwc_timer_t *timer); ++#define dwc_timer_free DWC_TIMER_FREE ++ ++/** Schedules the timer to run at time ms from now. And will repeat at every ++ * repeat_interval msec therafter ++ * ++ * Modifies a timer that is still awaiting execution to a new expiration time. ++ * The mod_time is added to the old time. */ ++extern void DWC_TIMER_SCHEDULE(dwc_timer_t *timer, uint32_t time); ++#define dwc_timer_schedule DWC_TIMER_SCHEDULE ++ ++/** Disables the timer from execution. */ ++extern void DWC_TIMER_CANCEL(dwc_timer_t *timer); ++#define dwc_timer_cancel DWC_TIMER_CANCEL ++ ++ ++/** @name Spinlocks ++ * ++ * These locks are used when the work between the lock/unlock is atomic and ++ * short. Interrupts are also disabled during the lock/unlock and thus they are ++ * suitable to lock between interrupt/non-interrupt context. They also lock ++ * between processes if you have multiple CPUs or Preemption. If you don't have ++ * multiple CPUS or Preemption, then the you can simply implement the ++ * DWC_SPINLOCK and DWC_SPINUNLOCK to disable and enable interrupts. Because ++ * the work between the lock/unlock is atomic, the process context will never ++ * change, and so you never have to lock between processes. */ ++ ++struct dwc_spinlock; ++ ++/** Type for a spinlock */ ++typedef struct dwc_spinlock dwc_spinlock_t; ++ ++/** Type for the 'flags' argument to spinlock funtions */ ++typedef unsigned long dwc_irqflags_t; ++ ++/** Returns an initialized lock variable. This function should allocate and ++ * initialize the OS-specific data structure used for locking. This data ++ * structure is to be used for the DWC_LOCK and DWC_UNLOCK functions and should ++ * be freed by the DWC_FREE_LOCK when it is no longer used. ++ * ++ * For Linux Spinlock Debugging make it macro because the debugging routines use ++ * the symbol name to determine recursive locking. Using a wrapper function ++ * makes it falsely think recursive locking occurs. */ ++#if defined(DWC_LINUX) && defined(CONFIG_DEBUG_SPINLOCK) ++#define DWC_SPINLOCK_ALLOC_LINUX_DEBUG(lock) ({ \ ++ lock = DWC_ALLOC(sizeof(spinlock_t)); \ ++ if (lock) { \ ++ spin_lock_init((spinlock_t *)lock); \ ++ } \ ++}) ++#else ++extern dwc_spinlock_t *DWC_SPINLOCK_ALLOC(void); ++#define dwc_spinlock_alloc(_ctx_) DWC_SPINLOCK_ALLOC() ++#endif ++ ++/** Frees an initialized lock variable. */ ++extern void DWC_SPINLOCK_FREE(dwc_spinlock_t *lock); ++#define dwc_spinlock_free(_ctx_,_lock_) DWC_SPINLOCK_FREE(_lock_) ++ ++/** Disables interrupts and blocks until it acquires the lock. ++ * ++ * @param lock Pointer to the spinlock. ++ * @param flags Unsigned long for irq flags storage. ++ */ ++extern void DWC_SPINLOCK_IRQSAVE(dwc_spinlock_t *lock, dwc_irqflags_t *flags); ++#define dwc_spinlock_irqsave DWC_SPINLOCK_IRQSAVE ++ ++/** Re-enables the interrupt and releases the lock. ++ * ++ * @param lock Pointer to the spinlock. ++ * @param flags Unsigned long for irq flags storage. Must be the same as was ++ * passed into DWC_LOCK. ++ */ ++extern void DWC_SPINUNLOCK_IRQRESTORE(dwc_spinlock_t *lock, dwc_irqflags_t flags); ++#define dwc_spinunlock_irqrestore DWC_SPINUNLOCK_IRQRESTORE ++ ++/** Blocks until it acquires the lock. ++ * ++ * @param lock Pointer to the spinlock. ++ */ ++extern void DWC_SPINLOCK(dwc_spinlock_t *lock); ++#define dwc_spinlock DWC_SPINLOCK ++ ++/** Releases the lock. ++ * ++ * @param lock Pointer to the spinlock. ++ */ ++extern void DWC_SPINUNLOCK(dwc_spinlock_t *lock); ++#define dwc_spinunlock DWC_SPINUNLOCK ++ ++ ++/** @name Mutexes ++ * ++ * Unlike spinlocks Mutexes lock only between processes and the work between the ++ * lock/unlock CAN block, therefore it CANNOT be called from interrupt context. ++ */ ++ ++struct dwc_mutex; ++ ++/** Type for a mutex */ ++typedef struct dwc_mutex dwc_mutex_t; ++ ++/* For Linux Mutex Debugging make it inline because the debugging routines use ++ * the symbol to determine recursive locking. This makes it falsely think ++ * recursive locking occurs. */ ++#if defined(DWC_LINUX) && defined(CONFIG_DEBUG_MUTEXES) ++#define DWC_MUTEX_ALLOC_LINUX_DEBUG(__mutexp) ({ \ ++ __mutexp = (dwc_mutex_t *)DWC_ALLOC(sizeof(struct mutex)); \ ++ mutex_init((struct mutex *)__mutexp); \ ++}) ++#endif ++ ++/** Allocate a mutex */ ++extern dwc_mutex_t *DWC_MUTEX_ALLOC(void); ++#define dwc_mutex_alloc(_ctx_) DWC_MUTEX_ALLOC() ++ ++/* For memory leak debugging when using Linux Mutex Debugging */ ++#if defined(DWC_LINUX) && defined(CONFIG_DEBUG_MUTEXES) ++#define DWC_MUTEX_FREE(__mutexp) do { \ ++ mutex_destroy((struct mutex *)__mutexp); \ ++ DWC_FREE(__mutexp); \ ++} while(0) ++#else ++/** Free a mutex */ ++extern void DWC_MUTEX_FREE(dwc_mutex_t *mutex); ++#define dwc_mutex_free(_ctx_,_mutex_) DWC_MUTEX_FREE(_mutex_) ++#endif ++ ++/** Lock a mutex */ ++extern void DWC_MUTEX_LOCK(dwc_mutex_t *mutex); ++#define dwc_mutex_lock DWC_MUTEX_LOCK ++ ++/** Non-blocking lock returns 1 on successful lock. */ ++extern int DWC_MUTEX_TRYLOCK(dwc_mutex_t *mutex); ++#define dwc_mutex_trylock DWC_MUTEX_TRYLOCK ++ ++/** Unlock a mutex */ ++extern void DWC_MUTEX_UNLOCK(dwc_mutex_t *mutex); ++#define dwc_mutex_unlock DWC_MUTEX_UNLOCK ++ ++ ++/** @name Time */ ++ ++/** Microsecond delay. ++ * ++ * @param usecs Microseconds to delay. ++ */ ++extern void DWC_UDELAY(uint32_t usecs); ++#define dwc_udelay DWC_UDELAY ++ ++/** Millisecond delay. ++ * ++ * @param msecs Milliseconds to delay. ++ */ ++extern void DWC_MDELAY(uint32_t msecs); ++#define dwc_mdelay DWC_MDELAY ++ ++/** Non-busy waiting. ++ * Sleeps for specified number of milliseconds. ++ * ++ * @param msecs Milliseconds to sleep. ++ */ ++extern void DWC_MSLEEP(uint32_t msecs); ++#define dwc_msleep DWC_MSLEEP ++ ++/** ++ * Returns number of milliseconds since boot. ++ */ ++extern uint32_t DWC_TIME(void); ++#define dwc_time DWC_TIME ++ ++ ++ ++ ++/* @mainpage DWC Portability and Common Library ++ * ++ * This is the documentation for the DWC Portability and Common Library. ++ * ++ * @section intro Introduction ++ * ++ * The DWC Portability library consists of wrapper calls and data structures to ++ * all low-level functions which are typically provided by the OS. The WUDEV ++ * driver uses only these functions. In order to port the WUDEV driver, only ++ * the functions in this library need to be re-implemented, with the same ++ * behavior as documented here. ++ * ++ * The Common library consists of higher level functions, which rely only on ++ * calling the functions from the DWC Portability library. These common ++ * routines are shared across modules. Some of the common libraries need to be ++ * used directly by the driver programmer when porting WUDEV. Such as the ++ * parameter and notification libraries. ++ * ++ * @section low Portability Library OS Wrapper Functions ++ * ++ * Any function starting with DWC and in all CAPS is a low-level OS-wrapper that ++ * needs to be implemented when porting, for example DWC_MUTEX_ALLOC(). All of ++ * these functions are included in the dwc_os.h file. ++ * ++ * There are many functions here covering a wide array of OS services. Please ++ * see dwc_os.h for details, and implementation notes for each function. ++ * ++ * @section common Common Library Functions ++ * ++ * Any function starting with dwc and in all lowercase is a common library ++ * routine. These functions have a portable implementation and do not need to ++ * be reimplemented when porting. The common routines can be used by any ++ * driver, and some must be used by the end user to control the drivers. For ++ * example, you must use the Parameter common library in order to set the ++ * parameters in the WUDEV module. ++ * ++ * The common libraries consist of the following: ++ * ++ * - Connection Contexts - Used internally and can be used by end-user. See dwc_cc.h ++ * - Parameters - Used internally and can be used by end-user. See dwc_params.h ++ * - Notifications - Used internally and can be used by end-user. See dwc_notifier.h ++ * - Lists - Used internally and can be used by end-user. See dwc_list.h ++ * - Memory Debugging - Used internally and can be used by end-user. See dwc_os.h ++ * - Modpow - Used internally only. See dwc_modpow.h ++ * - DH - Used internally only. See dwc_dh.h ++ * - Crypto - Used internally only. See dwc_crypto.h ++ * ++ * ++ * @section prereq Prerequistes For dwc_os.h ++ * @subsection types Data Types ++ * ++ * The dwc_os.h file assumes that several low-level data types are pre defined for the ++ * compilation environment. These data types are: ++ * ++ * - uint8_t - unsigned 8-bit data type ++ * - int8_t - signed 8-bit data type ++ * - uint16_t - unsigned 16-bit data type ++ * - int16_t - signed 16-bit data type ++ * - uint32_t - unsigned 32-bit data type ++ * - int32_t - signed 32-bit data type ++ * - uint64_t - unsigned 64-bit data type ++ * - int64_t - signed 64-bit data type ++ * ++ * Ensure that these are defined before using dwc_os.h. The easiest way to do ++ * that is to modify the top of the file to include the appropriate header. ++ * This is already done for the Linux environment. If the DWC_LINUX macro is ++ * defined, the correct header will be added. A standard header <stdint.h> is ++ * also used for environments where standard C headers are available. ++ * ++ * @subsection stdarg Variable Arguments ++ * ++ * Variable arguments are provided by a standard C header <stdarg.h>. it is ++ * available in Both the Linux and ANSI C enviornment. An equivalent must be ++ * provided in your enviornment in order to use dwc_os.h with the debug and ++ * tracing message functionality. ++ * ++ * @subsection thread Threading ++ * ++ * WUDEV Core must be run on an operating system that provides for multiple ++ * threads/processes. Threading can be implemented in many ways, even in ++ * embedded systems without an operating system. At the bare minimum, the ++ * system should be able to start any number of processes at any time to handle ++ * special work. It need not be a pre-emptive system. Process context can ++ * change upon a call to a blocking function. The hardware interrupt context ++ * that calls the module's ISR() function must be differentiable from process ++ * context, even if your processes are impemented via a hardware interrupt. ++ * Further locking mechanism between process must exist (or be implemented), and ++ * process context must have a way to disable interrupts for a period of time to ++ * lock them out. If all of this exists, the functions in dwc_os.h related to ++ * threading should be able to be implemented with the defined behavior. ++ * ++ */ ++ ++#ifdef __cplusplus ++} ++#endif ++ ++#endif /* _DWC_OS_H_ */ +diff --git a/drivers/usb/host/dwc_common_port/usb.h b/drivers/usb/host/dwc_common_port/usb.h +new file mode 100644 +index 0000000..27bda82 +--- /dev/null ++++ b/drivers/usb/host/dwc_common_port/usb.h +@@ -0,0 +1,946 @@ ++/* ++ * Copyright (c) 1998 The NetBSD Foundation, Inc. ++ * All rights reserved. ++ * ++ * This code is derived from software contributed to The NetBSD Foundation ++ * by Lennart Augustsson (lennart@augustsson.net) at ++ * Carlstedt Research & Technology. ++ * ++ * 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. ++ * 3. All advertising materials mentioning features or use of this software ++ * must display the following acknowledgement: ++ * This product includes software developed by the NetBSD ++ * Foundation, Inc. and its contributors. ++ * 4. Neither the name of The NetBSD Foundation nor the names of its ++ * contributors may be used to endorse or promote products derived ++ * from this software without specific prior written permission. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS ++ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED ++ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR ++ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS ++ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR ++ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF ++ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS ++ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN ++ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ++ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ++ * POSSIBILITY OF SUCH DAMAGE. ++ */ ++ ++/* Modified by Synopsys, Inc, 12/12/2007 */ ++ ++ ++#ifndef _USB_H_ ++#define _USB_H_ ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++/* ++ * The USB records contain some unaligned little-endian word ++ * components. The U[SG]ETW macros take care of both the alignment ++ * and endian problem and should always be used to access non-byte ++ * values. ++ */ ++typedef u_int8_t uByte; ++typedef u_int8_t uWord[2]; ++typedef u_int8_t uDWord[4]; ++ ++#define USETW2(w,h,l) ((w)[0] = (u_int8_t)(l), (w)[1] = (u_int8_t)(h)) ++#define UCONSTW(x) { (x) & 0xff, ((x) >> 8) & 0xff } ++#define UCONSTDW(x) { (x) & 0xff, ((x) >> 8) & 0xff, \ ++ ((x) >> 16) & 0xff, ((x) >> 24) & 0xff } ++ ++#if 1 ++#define UGETW(w) ((w)[0] | ((w)[1] << 8)) ++#define USETW(w,v) ((w)[0] = (u_int8_t)(v), (w)[1] = (u_int8_t)((v) >> 8)) ++#define UGETDW(w) ((w)[0] | ((w)[1] << 8) | ((w)[2] << 16) | ((w)[3] << 24)) ++#define USETDW(w,v) ((w)[0] = (u_int8_t)(v), \ ++ (w)[1] = (u_int8_t)((v) >> 8), \ ++ (w)[2] = (u_int8_t)((v) >> 16), \ ++ (w)[3] = (u_int8_t)((v) >> 24)) ++#else ++/* ++ * On little-endian machines that can handle unanliged accesses ++ * (e.g. i386) these macros can be replaced by the following. ++ */ ++#define UGETW(w) (*(u_int16_t *)(w)) ++#define USETW(w,v) (*(u_int16_t *)(w) = (v)) ++#define UGETDW(w) (*(u_int32_t *)(w)) ++#define USETDW(w,v) (*(u_int32_t *)(w) = (v)) ++#endif ++ ++/* ++ * Macros for accessing UAS IU fields, which are big-endian ++ */ ++#define IUSETW2(w,h,l) ((w)[0] = (u_int8_t)(h), (w)[1] = (u_int8_t)(l)) ++#define IUCONSTW(x) { ((x) >> 8) & 0xff, (x) & 0xff } ++#define IUCONSTDW(x) { ((x) >> 24) & 0xff, ((x) >> 16) & 0xff, \ ++ ((x) >> 8) & 0xff, (x) & 0xff } ++#define IUGETW(w) (((w)[0] << 8) | (w)[1]) ++#define IUSETW(w,v) ((w)[0] = (u_int8_t)((v) >> 8), (w)[1] = (u_int8_t)(v)) ++#define IUGETDW(w) (((w)[0] << 24) | ((w)[1] << 16) | ((w)[2] << 8) | (w)[3]) ++#define IUSETDW(w,v) ((w)[0] = (u_int8_t)((v) >> 24), \ ++ (w)[1] = (u_int8_t)((v) >> 16), \ ++ (w)[2] = (u_int8_t)((v) >> 8), \ ++ (w)[3] = (u_int8_t)(v)) ++ ++#define UPACKED __attribute__((__packed__)) ++ ++typedef struct { ++ uByte bmRequestType; ++ uByte bRequest; ++ uWord wValue; ++ uWord wIndex; ++ uWord wLength; ++} UPACKED usb_device_request_t; ++ ++#define UT_GET_DIR(a) ((a) & 0x80) ++#define UT_WRITE 0x00 ++#define UT_READ 0x80 ++ ++#define UT_GET_TYPE(a) ((a) & 0x60) ++#define UT_STANDARD 0x00 ++#define UT_CLASS 0x20 ++#define UT_VENDOR 0x40 ++ ++#define UT_GET_RECIPIENT(a) ((a) & 0x1f) ++#define UT_DEVICE 0x00 ++#define UT_INTERFACE 0x01 ++#define UT_ENDPOINT 0x02 ++#define UT_OTHER 0x03 ++ ++#define UT_READ_DEVICE (UT_READ | UT_STANDARD | UT_DEVICE) ++#define UT_READ_INTERFACE (UT_READ | UT_STANDARD | UT_INTERFACE) ++#define UT_READ_ENDPOINT (UT_READ | UT_STANDARD | UT_ENDPOINT) ++#define UT_WRITE_DEVICE (UT_WRITE | UT_STANDARD | UT_DEVICE) ++#define UT_WRITE_INTERFACE (UT_WRITE | UT_STANDARD | UT_INTERFACE) ++#define UT_WRITE_ENDPOINT (UT_WRITE | UT_STANDARD | UT_ENDPOINT) ++#define UT_READ_CLASS_DEVICE (UT_READ | UT_CLASS | UT_DEVICE) ++#define UT_READ_CLASS_INTERFACE (UT_READ | UT_CLASS | UT_INTERFACE) ++#define UT_READ_CLASS_OTHER (UT_READ | UT_CLASS | UT_OTHER) ++#define UT_READ_CLASS_ENDPOINT (UT_READ | UT_CLASS | UT_ENDPOINT) ++#define UT_WRITE_CLASS_DEVICE (UT_WRITE | UT_CLASS | UT_DEVICE) ++#define UT_WRITE_CLASS_INTERFACE (UT_WRITE | UT_CLASS | UT_INTERFACE) ++#define UT_WRITE_CLASS_OTHER (UT_WRITE | UT_CLASS | UT_OTHER) ++#define UT_WRITE_CLASS_ENDPOINT (UT_WRITE | UT_CLASS | UT_ENDPOINT) ++#define UT_READ_VENDOR_DEVICE (UT_READ | UT_VENDOR | UT_DEVICE) ++#define UT_READ_VENDOR_INTERFACE (UT_READ | UT_VENDOR | UT_INTERFACE) ++#define UT_READ_VENDOR_OTHER (UT_READ | UT_VENDOR | UT_OTHER) ++#define UT_READ_VENDOR_ENDPOINT (UT_READ | UT_VENDOR | UT_ENDPOINT) ++#define UT_WRITE_VENDOR_DEVICE (UT_WRITE | UT_VENDOR | UT_DEVICE) ++#define UT_WRITE_VENDOR_INTERFACE (UT_WRITE | UT_VENDOR | UT_INTERFACE) ++#define UT_WRITE_VENDOR_OTHER (UT_WRITE | UT_VENDOR | UT_OTHER) ++#define UT_WRITE_VENDOR_ENDPOINT (UT_WRITE | UT_VENDOR | UT_ENDPOINT) ++ ++/* Requests */ ++#define UR_GET_STATUS 0x00 ++#define USTAT_STANDARD_STATUS 0x00 ++#define WUSTAT_WUSB_FEATURE 0x01 ++#define WUSTAT_CHANNEL_INFO 0x02 ++#define WUSTAT_RECEIVED_DATA 0x03 ++#define WUSTAT_MAS_AVAILABILITY 0x04 ++#define WUSTAT_CURRENT_TRANSMIT_POWER 0x05 ++#define UR_CLEAR_FEATURE 0x01 ++#define UR_SET_FEATURE 0x03 ++#define UR_SET_AND_TEST_FEATURE 0x0c ++#define UR_SET_ADDRESS 0x05 ++#define UR_GET_DESCRIPTOR 0x06 ++#define UDESC_DEVICE 0x01 ++#define UDESC_CONFIG 0x02 ++#define UDESC_STRING 0x03 ++#define UDESC_INTERFACE 0x04 ++#define UDESC_ENDPOINT 0x05 ++#define UDESC_SS_USB_COMPANION 0x30 ++#define UDESC_DEVICE_QUALIFIER 0x06 ++#define UDESC_OTHER_SPEED_CONFIGURATION 0x07 ++#define UDESC_INTERFACE_POWER 0x08 ++#define UDESC_OTG 0x09 ++#define WUDESC_SECURITY 0x0c ++#define WUDESC_KEY 0x0d ++#define WUD_GET_KEY_INDEX(_wValue_) ((_wValue_) & 0xf) ++#define WUD_GET_KEY_TYPE(_wValue_) (((_wValue_) & 0x30) >> 4) ++#define WUD_KEY_TYPE_ASSOC 0x01 ++#define WUD_KEY_TYPE_GTK 0x02 ++#define WUD_GET_KEY_ORIGIN(_wValue_) (((_wValue_) & 0x40) >> 6) ++#define WUD_KEY_ORIGIN_HOST 0x00 ++#define WUD_KEY_ORIGIN_DEVICE 0x01 ++#define WUDESC_ENCRYPTION_TYPE 0x0e ++#define WUDESC_BOS 0x0f ++#define WUDESC_DEVICE_CAPABILITY 0x10 ++#define WUDESC_WIRELESS_ENDPOINT_COMPANION 0x11 ++#define UDESC_BOS 0x0f ++#define UDESC_DEVICE_CAPABILITY 0x10 ++#define UDESC_CS_DEVICE 0x21 /* class specific */ ++#define UDESC_CS_CONFIG 0x22 ++#define UDESC_CS_STRING 0x23 ++#define UDESC_CS_INTERFACE 0x24 ++#define UDESC_CS_ENDPOINT 0x25 ++#define UDESC_HUB 0x29 ++#define UR_SET_DESCRIPTOR 0x07 ++#define UR_GET_CONFIG 0x08 ++#define UR_SET_CONFIG 0x09 ++#define UR_GET_INTERFACE 0x0a ++#define UR_SET_INTERFACE 0x0b ++#define UR_SYNCH_FRAME 0x0c ++#define WUR_SET_ENCRYPTION 0x0d ++#define WUR_GET_ENCRYPTION 0x0e ++#define WUR_SET_HANDSHAKE 0x0f ++#define WUR_GET_HANDSHAKE 0x10 ++#define WUR_SET_CONNECTION 0x11 ++#define WUR_SET_SECURITY_DATA 0x12 ++#define WUR_GET_SECURITY_DATA 0x13 ++#define WUR_SET_WUSB_DATA 0x14 ++#define WUDATA_DRPIE_INFO 0x01 ++#define WUDATA_TRANSMIT_DATA 0x02 ++#define WUDATA_TRANSMIT_PARAMS 0x03 ++#define WUDATA_RECEIVE_PARAMS 0x04 ++#define WUDATA_TRANSMIT_POWER 0x05 ++#define WUR_LOOPBACK_DATA_WRITE 0x15 ++#define WUR_LOOPBACK_DATA_READ 0x16 ++#define WUR_SET_INTERFACE_DS 0x17 ++ ++/* Feature numbers */ ++#define UF_ENDPOINT_HALT 0 ++#define UF_DEVICE_REMOTE_WAKEUP 1 ++#define UF_TEST_MODE 2 ++#define UF_DEVICE_B_HNP_ENABLE 3 ++#define UF_DEVICE_A_HNP_SUPPORT 4 ++#define UF_DEVICE_A_ALT_HNP_SUPPORT 5 ++#define WUF_WUSB 3 ++#define WUF_TX_DRPIE 0x0 ++#define WUF_DEV_XMIT_PACKET 0x1 ++#define WUF_COUNT_PACKETS 0x2 ++#define WUF_CAPTURE_PACKETS 0x3 ++#define UF_FUNCTION_SUSPEND 0 ++#define UF_U1_ENABLE 48 ++#define UF_U2_ENABLE 49 ++#define UF_LTM_ENABLE 50 ++ ++/* Class requests from the USB 2.0 hub spec, table 11-15 */ ++#define UCR_CLEAR_HUB_FEATURE (0x2000 | UR_CLEAR_FEATURE) ++#define UCR_CLEAR_PORT_FEATURE (0x2300 | UR_CLEAR_FEATURE) ++#define UCR_GET_HUB_DESCRIPTOR (0xa000 | UR_GET_DESCRIPTOR) ++#define UCR_GET_HUB_STATUS (0xa000 | UR_GET_STATUS) ++#define UCR_GET_PORT_STATUS (0xa300 | UR_GET_STATUS) ++#define UCR_SET_HUB_FEATURE (0x2000 | UR_SET_FEATURE) ++#define UCR_SET_PORT_FEATURE (0x2300 | UR_SET_FEATURE) ++#define UCR_SET_AND_TEST_PORT_FEATURE (0xa300 | UR_SET_AND_TEST_FEATURE) ++ ++#ifdef _MSC_VER ++#include <pshpack1.h> ++#endif ++ ++typedef struct { ++ uByte bLength; ++ uByte bDescriptorType; ++ uByte bDescriptorSubtype; ++} UPACKED usb_descriptor_t; ++ ++typedef struct { ++ uByte bLength; ++ uByte bDescriptorType; ++} UPACKED usb_descriptor_header_t; ++ ++typedef struct { ++ uByte bLength; ++ uByte bDescriptorType; ++ uWord bcdUSB; ++#define UD_USB_2_0 0x0200 ++#define UD_IS_USB2(d) (UGETW((d)->bcdUSB) >= UD_USB_2_0) ++ uByte bDeviceClass; ++ uByte bDeviceSubClass; ++ uByte bDeviceProtocol; ++ uByte bMaxPacketSize; ++ /* The fields below are not part of the initial descriptor. */ ++ uWord idVendor; ++ uWord idProduct; ++ uWord bcdDevice; ++ uByte iManufacturer; ++ uByte iProduct; ++ uByte iSerialNumber; ++ uByte bNumConfigurations; ++} UPACKED usb_device_descriptor_t; ++#define USB_DEVICE_DESCRIPTOR_SIZE 18 ++ ++typedef struct { ++ uByte bLength; ++ uByte bDescriptorType; ++ uWord wTotalLength; ++ uByte bNumInterface; ++ uByte bConfigurationValue; ++ uByte iConfiguration; ++#define UC_ATT_ONE (1 << 7) /* must be set */ ++#define UC_ATT_SELFPOWER (1 << 6) /* self powered */ ++#define UC_ATT_WAKEUP (1 << 5) /* can wakeup */ ++#define UC_ATT_BATTERY (1 << 4) /* battery powered */ ++ uByte bmAttributes; ++#define UC_BUS_POWERED 0x80 ++#define UC_SELF_POWERED 0x40 ++#define UC_REMOTE_WAKEUP 0x20 ++ uByte bMaxPower; /* max current in 2 mA units */ ++#define UC_POWER_FACTOR 2 ++} UPACKED usb_config_descriptor_t; ++#define USB_CONFIG_DESCRIPTOR_SIZE 9 ++ ++typedef struct { ++ uByte bLength; ++ uByte bDescriptorType; ++ uByte bInterfaceNumber; ++ uByte bAlternateSetting; ++ uByte bNumEndpoints; ++ uByte bInterfaceClass; ++ uByte bInterfaceSubClass; ++ uByte bInterfaceProtocol; ++ uByte iInterface; ++} UPACKED usb_interface_descriptor_t; ++#define USB_INTERFACE_DESCRIPTOR_SIZE 9 ++ ++typedef struct { ++ uByte bLength; ++ uByte bDescriptorType; ++ uByte bEndpointAddress; ++#define UE_GET_DIR(a) ((a) & 0x80) ++#define UE_SET_DIR(a,d) ((a) | (((d)&1) << 7)) ++#define UE_DIR_IN 0x80 ++#define UE_DIR_OUT 0x00 ++#define UE_ADDR 0x0f ++#define UE_GET_ADDR(a) ((a) & UE_ADDR) ++ uByte bmAttributes; ++#define UE_XFERTYPE 0x03 ++#define UE_CONTROL 0x00 ++#define UE_ISOCHRONOUS 0x01 ++#define UE_BULK 0x02 ++#define UE_INTERRUPT 0x03 ++#define UE_GET_XFERTYPE(a) ((a) & UE_XFERTYPE) ++#define UE_ISO_TYPE 0x0c ++#define UE_ISO_ASYNC 0x04 ++#define UE_ISO_ADAPT 0x08 ++#define UE_ISO_SYNC 0x0c ++#define UE_GET_ISO_TYPE(a) ((a) & UE_ISO_TYPE) ++ uWord wMaxPacketSize; ++ uByte bInterval; ++} UPACKED usb_endpoint_descriptor_t; ++#define USB_ENDPOINT_DESCRIPTOR_SIZE 7 ++ ++typedef struct ss_endpoint_companion_descriptor { ++ uByte bLength; ++ uByte bDescriptorType; ++ uByte bMaxBurst; ++#define USSE_GET_MAX_STREAMS(a) ((a) & 0x1f) ++#define USSE_SET_MAX_STREAMS(a, b) ((a) | ((b) & 0x1f)) ++#define USSE_GET_MAX_PACKET_NUM(a) ((a) & 0x03) ++#define USSE_SET_MAX_PACKET_NUM(a, b) ((a) | ((b) & 0x03)) ++ uByte bmAttributes; ++ uWord wBytesPerInterval; ++} UPACKED ss_endpoint_companion_descriptor_t; ++#define USB_SS_ENDPOINT_COMPANION_DESCRIPTOR_SIZE 6 ++ ++typedef struct { ++ uByte bLength; ++ uByte bDescriptorType; ++ uWord bString[127]; ++} UPACKED usb_string_descriptor_t; ++#define USB_MAX_STRING_LEN 128 ++#define USB_LANGUAGE_TABLE 0 /* # of the string language id table */ ++ ++/* Hub specific request */ ++#define UR_GET_BUS_STATE 0x02 ++#define UR_CLEAR_TT_BUFFER 0x08 ++#define UR_RESET_TT 0x09 ++#define UR_GET_TT_STATE 0x0a ++#define UR_STOP_TT 0x0b ++ ++/* Hub features */ ++#define UHF_C_HUB_LOCAL_POWER 0 ++#define UHF_C_HUB_OVER_CURRENT 1 ++#define UHF_PORT_CONNECTION 0 ++#define UHF_PORT_ENABLE 1 ++#define UHF_PORT_SUSPEND 2 ++#define UHF_PORT_OVER_CURRENT 3 ++#define UHF_PORT_RESET 4 ++#define UHF_PORT_L1 5 ++#define UHF_PORT_POWER 8 ++#define UHF_PORT_LOW_SPEED 9 ++#define UHF_PORT_HIGH_SPEED 10 ++#define UHF_C_PORT_CONNECTION 16 ++#define UHF_C_PORT_ENABLE 17 ++#define UHF_C_PORT_SUSPEND 18 ++#define UHF_C_PORT_OVER_CURRENT 19 ++#define UHF_C_PORT_RESET 20 ++#define UHF_C_PORT_L1 23 ++#define UHF_PORT_TEST 21 ++#define UHF_PORT_INDICATOR 22 ++ ++typedef struct { ++ uByte bDescLength; ++ uByte bDescriptorType; ++ uByte bNbrPorts; ++ uWord wHubCharacteristics; ++#define UHD_PWR 0x0003 ++#define UHD_PWR_GANGED 0x0000 ++#define UHD_PWR_INDIVIDUAL 0x0001 ++#define UHD_PWR_NO_SWITCH 0x0002 ++#define UHD_COMPOUND 0x0004 ++#define UHD_OC 0x0018 ++#define UHD_OC_GLOBAL 0x0000 ++#define UHD_OC_INDIVIDUAL 0x0008 ++#define UHD_OC_NONE 0x0010 ++#define UHD_TT_THINK 0x0060 ++#define UHD_TT_THINK_8 0x0000 ++#define UHD_TT_THINK_16 0x0020 ++#define UHD_TT_THINK_24 0x0040 ++#define UHD_TT_THINK_32 0x0060 ++#define UHD_PORT_IND 0x0080 ++ uByte bPwrOn2PwrGood; /* delay in 2 ms units */ ++#define UHD_PWRON_FACTOR 2 ++ uByte bHubContrCurrent; ++ uByte DeviceRemovable[32]; /* max 255 ports */ ++#define UHD_NOT_REMOV(desc, i) \ ++ (((desc)->DeviceRemovable[(i)/8] >> ((i) % 8)) & 1) ++ /* deprecated */ uByte PortPowerCtrlMask[1]; ++} UPACKED usb_hub_descriptor_t; ++#define USB_HUB_DESCRIPTOR_SIZE 9 /* includes deprecated PortPowerCtrlMask */ ++ ++typedef struct { ++ uByte bLength; ++ uByte bDescriptorType; ++ uWord bcdUSB; ++ uByte bDeviceClass; ++ uByte bDeviceSubClass; ++ uByte bDeviceProtocol; ++ uByte bMaxPacketSize0; ++ uByte bNumConfigurations; ++ uByte bReserved; ++} UPACKED usb_device_qualifier_t; ++#define USB_DEVICE_QUALIFIER_SIZE 10 ++ ++typedef struct { ++ uByte bLength; ++ uByte bDescriptorType; ++ uByte bmAttributes; ++#define UOTG_SRP 0x01 ++#define UOTG_HNP 0x02 ++} UPACKED usb_otg_descriptor_t; ++ ++/* OTG feature selectors */ ++#define UOTG_B_HNP_ENABLE 3 ++#define UOTG_A_HNP_SUPPORT 4 ++#define UOTG_A_ALT_HNP_SUPPORT 5 ++ ++typedef struct { ++ uWord wStatus; ++/* Device status flags */ ++#define UDS_SELF_POWERED 0x0001 ++#define UDS_REMOTE_WAKEUP 0x0002 ++/* Endpoint status flags */ ++#define UES_HALT 0x0001 ++} UPACKED usb_status_t; ++ ++typedef struct { ++ uWord wHubStatus; ++#define UHS_LOCAL_POWER 0x0001 ++#define UHS_OVER_CURRENT 0x0002 ++ uWord wHubChange; ++} UPACKED usb_hub_status_t; ++ ++typedef struct { ++ uWord wPortStatus; ++#define UPS_CURRENT_CONNECT_STATUS 0x0001 ++#define UPS_PORT_ENABLED 0x0002 ++#define UPS_SUSPEND 0x0004 ++#define UPS_OVERCURRENT_INDICATOR 0x0008 ++#define UPS_RESET 0x0010 ++#define UPS_PORT_POWER 0x0100 ++#define UPS_LOW_SPEED 0x0200 ++#define UPS_HIGH_SPEED 0x0400 ++#define UPS_PORT_TEST 0x0800 ++#define UPS_PORT_INDICATOR 0x1000 ++ uWord wPortChange; ++#define UPS_C_CONNECT_STATUS 0x0001 ++#define UPS_C_PORT_ENABLED 0x0002 ++#define UPS_C_SUSPEND 0x0004 ++#define UPS_C_OVERCURRENT_INDICATOR 0x0008 ++#define UPS_C_PORT_RESET 0x0010 ++} UPACKED usb_port_status_t; ++ ++#ifdef _MSC_VER ++#include <poppack.h> ++#endif ++ ++/* Device class codes */ ++#define UDCLASS_IN_INTERFACE 0x00 ++#define UDCLASS_COMM 0x02 ++#define UDCLASS_HUB 0x09 ++#define UDSUBCLASS_HUB 0x00 ++#define UDPROTO_FSHUB 0x00 ++#define UDPROTO_HSHUBSTT 0x01 ++#define UDPROTO_HSHUBMTT 0x02 ++#define UDCLASS_DIAGNOSTIC 0xdc ++#define UDCLASS_WIRELESS 0xe0 ++#define UDSUBCLASS_RF 0x01 ++#define UDPROTO_BLUETOOTH 0x01 ++#define UDCLASS_VENDOR 0xff ++ ++/* Interface class codes */ ++#define UICLASS_UNSPEC 0x00 ++ ++#define UICLASS_AUDIO 0x01 ++#define UISUBCLASS_AUDIOCONTROL 1 ++#define UISUBCLASS_AUDIOSTREAM 2 ++#define UISUBCLASS_MIDISTREAM 3 ++ ++#define UICLASS_CDC 0x02 /* communication */ ++#define UISUBCLASS_DIRECT_LINE_CONTROL_MODEL 1 ++#define UISUBCLASS_ABSTRACT_CONTROL_MODEL 2 ++#define UISUBCLASS_TELEPHONE_CONTROL_MODEL 3 ++#define UISUBCLASS_MULTICHANNEL_CONTROL_MODEL 4 ++#define UISUBCLASS_CAPI_CONTROLMODEL 5 ++#define UISUBCLASS_ETHERNET_NETWORKING_CONTROL_MODEL 6 ++#define UISUBCLASS_ATM_NETWORKING_CONTROL_MODEL 7 ++#define UIPROTO_CDC_AT 1 ++ ++#define UICLASS_HID 0x03 ++#define UISUBCLASS_BOOT 1 ++#define UIPROTO_BOOT_KEYBOARD 1 ++ ++#define UICLASS_PHYSICAL 0x05 ++ ++#define UICLASS_IMAGE 0x06 ++ ++#define UICLASS_PRINTER 0x07 ++#define UISUBCLASS_PRINTER 1 ++#define UIPROTO_PRINTER_UNI 1 ++#define UIPROTO_PRINTER_BI 2 ++#define UIPROTO_PRINTER_1284 3 ++ ++#define UICLASS_MASS 0x08 ++#define UISUBCLASS_RBC 1 ++#define UISUBCLASS_SFF8020I 2 ++#define UISUBCLASS_QIC157 3 ++#define UISUBCLASS_UFI 4 ++#define UISUBCLASS_SFF8070I 5 ++#define UISUBCLASS_SCSI 6 ++#define UIPROTO_MASS_CBI_I 0 ++#define UIPROTO_MASS_CBI 1 ++#define UIPROTO_MASS_BBB_OLD 2 /* Not in the spec anymore */ ++#define UIPROTO_MASS_BBB 80 /* 'P' for the Iomega Zip drive */ ++ ++#define UICLASS_HUB 0x09 ++#define UISUBCLASS_HUB 0 ++#define UIPROTO_FSHUB 0 ++#define UIPROTO_HSHUBSTT 0 /* Yes, same as previous */ ++#define UIPROTO_HSHUBMTT 1 ++ ++#define UICLASS_CDC_DATA 0x0a ++#define UISUBCLASS_DATA 0 ++#define UIPROTO_DATA_ISDNBRI 0x30 /* Physical iface */ ++#define UIPROTO_DATA_HDLC 0x31 /* HDLC */ ++#define UIPROTO_DATA_TRANSPARENT 0x32 /* Transparent */ ++#define UIPROTO_DATA_Q921M 0x50 /* Management for Q921 */ ++#define UIPROTO_DATA_Q921 0x51 /* Data for Q921 */ ++#define UIPROTO_DATA_Q921TM 0x52 /* TEI multiplexer for Q921 */ ++#define UIPROTO_DATA_V42BIS 0x90 /* Data compression */ ++#define UIPROTO_DATA_Q931 0x91 /* Euro-ISDN */ ++#define UIPROTO_DATA_V120 0x92 /* V.24 rate adaption */ ++#define UIPROTO_DATA_CAPI 0x93 /* CAPI 2.0 commands */ ++#define UIPROTO_DATA_HOST_BASED 0xfd /* Host based driver */ ++#define UIPROTO_DATA_PUF 0xfe /* see Prot. Unit Func. Desc.*/ ++#define UIPROTO_DATA_VENDOR 0xff /* Vendor specific */ ++ ++#define UICLASS_SMARTCARD 0x0b ++ ++/*#define UICLASS_FIRM_UPD 0x0c*/ ++ ++#define UICLASS_SECURITY 0x0d ++ ++#define UICLASS_DIAGNOSTIC 0xdc ++ ++#define UICLASS_WIRELESS 0xe0 ++#define UISUBCLASS_RF 0x01 ++#define UIPROTO_BLUETOOTH 0x01 ++ ++#define UICLASS_APPL_SPEC 0xfe ++#define UISUBCLASS_FIRMWARE_DOWNLOAD 1 ++#define UISUBCLASS_IRDA 2 ++#define UIPROTO_IRDA 0 ++ ++#define UICLASS_VENDOR 0xff ++ ++#define USB_HUB_MAX_DEPTH 5 ++ ++/* ++ * Minimum time a device needs to be powered down to go through ++ * a power cycle. XXX Are these time in the spec? ++ */ ++#define USB_POWER_DOWN_TIME 200 /* ms */ ++#define USB_PORT_POWER_DOWN_TIME 100 /* ms */ ++ ++#if 0 ++/* These are the values from the spec. */ ++#define USB_PORT_RESET_DELAY 10 /* ms */ ++#define USB_PORT_ROOT_RESET_DELAY 50 /* ms */ ++#define USB_PORT_RESET_RECOVERY 10 /* ms */ ++#define USB_PORT_POWERUP_DELAY 100 /* ms */ ++#define USB_SET_ADDRESS_SETTLE 2 /* ms */ ++#define USB_RESUME_DELAY (20*5) /* ms */ ++#define USB_RESUME_WAIT 10 /* ms */ ++#define USB_RESUME_RECOVERY 10 /* ms */ ++#define USB_EXTRA_POWER_UP_TIME 0 /* ms */ ++#else ++/* Allow for marginal (i.e. non-conforming) devices. */ ++#define USB_PORT_RESET_DELAY 50 /* ms */ ++#define USB_PORT_ROOT_RESET_DELAY 250 /* ms */ ++#define USB_PORT_RESET_RECOVERY 250 /* ms */ ++#define USB_PORT_POWERUP_DELAY 300 /* ms */ ++#define USB_SET_ADDRESS_SETTLE 10 /* ms */ ++#define USB_RESUME_DELAY (50*5) /* ms */ ++#define USB_RESUME_WAIT 50 /* ms */ ++#define USB_RESUME_RECOVERY 50 /* ms */ ++#define USB_EXTRA_POWER_UP_TIME 20 /* ms */ ++#endif ++ ++#define USB_MIN_POWER 100 /* mA */ ++#define USB_MAX_POWER 500 /* mA */ ++ ++#define USB_BUS_RESET_DELAY 100 /* ms XXX?*/ ++ ++#define USB_UNCONFIG_NO 0 ++#define USB_UNCONFIG_INDEX (-1) ++ ++/*** ioctl() related stuff ***/ ++ ++struct usb_ctl_request { ++ int ucr_addr; ++ usb_device_request_t ucr_request; ++ void *ucr_data; ++ int ucr_flags; ++#define USBD_SHORT_XFER_OK 0x04 /* allow short reads */ ++ int ucr_actlen; /* actual length transferred */ ++}; ++ ++struct usb_alt_interface { ++ int uai_config_index; ++ int uai_interface_index; ++ int uai_alt_no; ++}; ++ ++#define USB_CURRENT_CONFIG_INDEX (-1) ++#define USB_CURRENT_ALT_INDEX (-1) ++ ++struct usb_config_desc { ++ int ucd_config_index; ++ usb_config_descriptor_t ucd_desc; ++}; ++ ++struct usb_interface_desc { ++ int uid_config_index; ++ int uid_interface_index; ++ int uid_alt_index; ++ usb_interface_descriptor_t uid_desc; ++}; ++ ++struct usb_endpoint_desc { ++ int ued_config_index; ++ int ued_interface_index; ++ int ued_alt_index; ++ int ued_endpoint_index; ++ usb_endpoint_descriptor_t ued_desc; ++}; ++ ++struct usb_full_desc { ++ int ufd_config_index; ++ u_int ufd_size; ++ u_char *ufd_data; ++}; ++ ++struct usb_string_desc { ++ int usd_string_index; ++ int usd_language_id; ++ usb_string_descriptor_t usd_desc; ++}; ++ ++struct usb_ctl_report_desc { ++ int ucrd_size; ++ u_char ucrd_data[1024]; /* filled data size will vary */ ++}; ++ ++typedef struct { u_int32_t cookie; } usb_event_cookie_t; ++ ++#define USB_MAX_DEVNAMES 4 ++#define USB_MAX_DEVNAMELEN 16 ++struct usb_device_info { ++ u_int8_t udi_bus; ++ u_int8_t udi_addr; /* device address */ ++ usb_event_cookie_t udi_cookie; ++ char udi_product[USB_MAX_STRING_LEN]; ++ char udi_vendor[USB_MAX_STRING_LEN]; ++ char udi_release[8]; ++ u_int16_t udi_productNo; ++ u_int16_t udi_vendorNo; ++ u_int16_t udi_releaseNo; ++ u_int8_t udi_class; ++ u_int8_t udi_subclass; ++ u_int8_t udi_protocol; ++ u_int8_t udi_config; ++ u_int8_t udi_speed; ++#define USB_SPEED_UNKNOWN 0 ++#define USB_SPEED_LOW 1 ++#define USB_SPEED_FULL 2 ++#define USB_SPEED_HIGH 3 ++#define USB_SPEED_VARIABLE 4 ++#define USB_SPEED_SUPER 5 ++ int udi_power; /* power consumption in mA, 0 if selfpowered */ ++ int udi_nports; ++ char udi_devnames[USB_MAX_DEVNAMES][USB_MAX_DEVNAMELEN]; ++ u_int8_t udi_ports[16];/* hub only: addresses of devices on ports */ ++#define USB_PORT_ENABLED 0xff ++#define USB_PORT_SUSPENDED 0xfe ++#define USB_PORT_POWERED 0xfd ++#define USB_PORT_DISABLED 0xfc ++}; ++ ++struct usb_ctl_report { ++ int ucr_report; ++ u_char ucr_data[1024]; /* filled data size will vary */ ++}; ++ ++struct usb_device_stats { ++ u_long uds_requests[4]; /* indexed by transfer type UE_* */ ++}; ++ ++#define WUSB_MIN_IE 0x80 ++#define WUSB_WCTA_IE 0x80 ++#define WUSB_WCONNECTACK_IE 0x81 ++#define WUSB_WHOSTINFO_IE 0x82 ++#define WUHI_GET_CA(_bmAttributes_) ((_bmAttributes_) & 0x3) ++#define WUHI_CA_RECONN 0x00 ++#define WUHI_CA_LIMITED 0x01 ++#define WUHI_CA_ALL 0x03 ++#define WUHI_GET_MLSI(_bmAttributes_) (((_bmAttributes_) & 0x38) >> 3) ++#define WUSB_WCHCHANGEANNOUNCE_IE 0x83 ++#define WUSB_WDEV_DISCONNECT_IE 0x84 ++#define WUSB_WHOST_DISCONNECT_IE 0x85 ++#define WUSB_WRELEASE_CHANNEL_IE 0x86 ++#define WUSB_WWORK_IE 0x87 ++#define WUSB_WCHANNEL_STOP_IE 0x88 ++#define WUSB_WDEV_KEEPALIVE_IE 0x89 ++#define WUSB_WISOCH_DISCARD_IE 0x8A ++#define WUSB_WRESETDEVICE_IE 0x8B ++#define WUSB_WXMIT_PACKET_ADJUST_IE 0x8C ++#define WUSB_MAX_IE 0x8C ++ ++/* Device Notification Types */ ++ ++#define WUSB_DN_MIN 0x01 ++#define WUSB_DN_CONNECT 0x01 ++# define WUSB_DA_OLDCONN 0x00 ++# define WUSB_DA_NEWCONN 0x01 ++# define WUSB_DA_SELF_BEACON 0x02 ++# define WUSB_DA_DIR_BEACON 0x04 ++# define WUSB_DA_NO_BEACON 0x06 ++#define WUSB_DN_DISCONNECT 0x02 ++#define WUSB_DN_EPRDY 0x03 ++#define WUSB_DN_MASAVAILCHANGED 0x04 ++#define WUSB_DN_REMOTEWAKEUP 0x05 ++#define WUSB_DN_SLEEP 0x06 ++#define WUSB_DN_ALIVE 0x07 ++#define WUSB_DN_MAX 0x07 ++ ++#ifdef _MSC_VER ++#include <pshpack1.h> ++#endif ++ ++/* WUSB Handshake Data. Used during the SET/GET HANDSHAKE requests */ ++typedef struct wusb_hndshk_data { ++ uByte bMessageNumber; ++ uByte bStatus; ++ uByte tTKID[3]; ++ uByte bReserved; ++ uByte CDID[16]; ++ uByte Nonce[16]; ++ uByte MIC[8]; ++} UPACKED wusb_hndshk_data_t; ++#define WUSB_HANDSHAKE_LEN_FOR_MIC 38 ++ ++/* WUSB Connection Context */ ++typedef struct wusb_conn_context { ++ uByte CHID [16]; ++ uByte CDID [16]; ++ uByte CK [16]; ++} UPACKED wusb_conn_context_t; ++ ++/* WUSB Security Descriptor */ ++typedef struct wusb_security_desc { ++ uByte bLength; ++ uByte bDescriptorType; ++ uWord wTotalLength; ++ uByte bNumEncryptionTypes; ++} UPACKED wusb_security_desc_t; ++ ++/* WUSB Encryption Type Descriptor */ ++typedef struct wusb_encrypt_type_desc { ++ uByte bLength; ++ uByte bDescriptorType; ++ ++ uByte bEncryptionType; ++#define WUETD_UNSECURE 0 ++#define WUETD_WIRED 1 ++#define WUETD_CCM_1 2 ++#define WUETD_RSA_1 3 ++ ++ uByte bEncryptionValue; ++ uByte bAuthKeyIndex; ++} UPACKED wusb_encrypt_type_desc_t; ++ ++/* WUSB Key Descriptor */ ++typedef struct wusb_key_desc { ++ uByte bLength; ++ uByte bDescriptorType; ++ uByte tTKID[3]; ++ uByte bReserved; ++ uByte KeyData[1]; /* variable length */ ++} UPACKED wusb_key_desc_t; ++ ++/* WUSB BOS Descriptor (Binary device Object Store) */ ++typedef struct wusb_bos_desc { ++ uByte bLength; ++ uByte bDescriptorType; ++ uWord wTotalLength; ++ uByte bNumDeviceCaps; ++} UPACKED wusb_bos_desc_t; ++ ++#define USB_DEVICE_CAPABILITY_20_EXTENSION 0x02 ++typedef struct usb_dev_cap_20_ext_desc { ++ uByte bLength; ++ uByte bDescriptorType; ++ uByte bDevCapabilityType; ++#define USB_20_EXT_LPM 0x02 ++ uDWord bmAttributes; ++} UPACKED usb_dev_cap_20_ext_desc_t; ++ ++#define USB_DEVICE_CAPABILITY_SS_USB 0x03 ++typedef struct usb_dev_cap_ss_usb { ++ uByte bLength; ++ uByte bDescriptorType; ++ uByte bDevCapabilityType; ++#define USB_DC_SS_USB_LTM_CAPABLE 0x02 ++ uByte bmAttributes; ++#define USB_DC_SS_USB_SPEED_SUPPORT_LOW 0x01 ++#define USB_DC_SS_USB_SPEED_SUPPORT_FULL 0x02 ++#define USB_DC_SS_USB_SPEED_SUPPORT_HIGH 0x04 ++#define USB_DC_SS_USB_SPEED_SUPPORT_SS 0x08 ++ uWord wSpeedsSupported; ++ uByte bFunctionalitySupport; ++ uByte bU1DevExitLat; ++ uWord wU2DevExitLat; ++} UPACKED usb_dev_cap_ss_usb_t; ++ ++#define USB_DEVICE_CAPABILITY_CONTAINER_ID 0x04 ++typedef struct usb_dev_cap_container_id { ++ uByte bLength; ++ uByte bDescriptorType; ++ uByte bDevCapabilityType; ++ uByte bReserved; ++ uByte containerID[16]; ++} UPACKED usb_dev_cap_container_id_t; ++ ++/* Device Capability Type Codes */ ++#define WUSB_DEVICE_CAPABILITY_WIRELESS_USB 0x01 ++ ++/* Device Capability Descriptor */ ++typedef struct wusb_dev_cap_desc { ++ uByte bLength; ++ uByte bDescriptorType; ++ uByte bDevCapabilityType; ++ uByte caps[1]; /* Variable length */ ++} UPACKED wusb_dev_cap_desc_t; ++ ++/* Device Capability Descriptor */ ++typedef struct wusb_dev_cap_uwb_desc { ++ uByte bLength; ++ uByte bDescriptorType; ++ uByte bDevCapabilityType; ++ uByte bmAttributes; ++ uWord wPHYRates; /* Bitmap */ ++ uByte bmTFITXPowerInfo; ++ uByte bmFFITXPowerInfo; ++ uWord bmBandGroup; ++ uByte bReserved; ++} UPACKED wusb_dev_cap_uwb_desc_t; ++ ++/* Wireless USB Endpoint Companion Descriptor */ ++typedef struct wusb_endpoint_companion_desc { ++ uByte bLength; ++ uByte bDescriptorType; ++ uByte bMaxBurst; ++ uByte bMaxSequence; ++ uWord wMaxStreamDelay; ++ uWord wOverTheAirPacketSize; ++ uByte bOverTheAirInterval; ++ uByte bmCompAttributes; ++} UPACKED wusb_endpoint_companion_desc_t; ++ ++/* Wireless USB Numeric Association M1 Data Structure */ ++typedef struct wusb_m1_data { ++ uByte version; ++ uWord langId; ++ uByte deviceFriendlyNameLength; ++ uByte sha_256_m3[32]; ++ uByte deviceFriendlyName[256]; ++} UPACKED wusb_m1_data_t; ++ ++typedef struct wusb_m2_data { ++ uByte version; ++ uWord langId; ++ uByte hostFriendlyNameLength; ++ uByte pkh[384]; ++ uByte hostFriendlyName[256]; ++} UPACKED wusb_m2_data_t; ++ ++typedef struct wusb_m3_data { ++ uByte pkd[384]; ++ uByte nd; ++} UPACKED wusb_m3_data_t; ++ ++typedef struct wusb_m4_data { ++ uDWord _attributeTypeIdAndLength_1; ++ uWord associationTypeId; ++ ++ uDWord _attributeTypeIdAndLength_2; ++ uWord associationSubTypeId; ++ ++ uDWord _attributeTypeIdAndLength_3; ++ uDWord length; ++ ++ uDWord _attributeTypeIdAndLength_4; ++ uDWord associationStatus; ++ ++ uDWord _attributeTypeIdAndLength_5; ++ uByte chid[16]; ++ ++ uDWord _attributeTypeIdAndLength_6; ++ uByte cdid[16]; ++ ++ uDWord _attributeTypeIdAndLength_7; ++ uByte bandGroups[2]; ++} UPACKED wusb_m4_data_t; ++ ++#ifdef _MSC_VER ++#include <poppack.h> ++#endif ++ ++#ifdef __cplusplus ++} ++#endif ++ ++#endif /* _USB_H_ */ +diff --git a/drivers/usb/host/dwc_otg/Makefile b/drivers/usb/host/dwc_otg/Makefile +new file mode 100644 +index 0000000..e7bdd12 +--- /dev/null ++++ b/drivers/usb/host/dwc_otg/Makefile +@@ -0,0 +1,82 @@ ++# ++# Makefile for DWC_otg Highspeed USB controller driver ++# ++ ++ifneq ($(KERNELRELEASE),) ++ ++# Use the BUS_INTERFACE variable to compile the software for either ++# PCI(PCI_INTERFACE) or LM(LM_INTERFACE) bus. ++ifeq ($(BUS_INTERFACE),) ++# BUS_INTERFACE = -DPCI_INTERFACE ++# BUS_INTERFACE = -DLM_INTERFACE ++ BUS_INTERFACE = -DPLATFORM_INTERFACE ++endif ++ ++#ccflags-y += -DDEBUG ++#ccflags-y += -DDWC_OTG_DEBUGLEV=1 # reduce common debug msgs ++ ++# Use one of the following flags to compile the software in host-only or ++# device-only mode. ++#ccflags-y += -DDWC_HOST_ONLY ++#ccflags-y += -DDWC_DEVICE_ONLY ++ ++ccflags-y += -Dlinux -DDWC_HS_ELECT_TST ++#ccflags-y += -DDWC_EN_ISOC ++ccflags-y += -I$(obj)/../dwc_common_port ++#ccflags-y += -I$(PORTLIB) ++ccflags-y += -DDWC_LINUX ++ccflags-y += $(CFI) ++ccflags-y += $(BUS_INTERFACE) ++#ccflags-y += -DDWC_DEV_SRPCAP ++ ++obj-$(CONFIG_USB_DWCOTG) += dwc_otg.o ++ ++dwc_otg-objs := dwc_otg_driver.o dwc_otg_attr.o ++dwc_otg-objs += dwc_otg_cil.o dwc_otg_cil_intr.o ++dwc_otg-objs += dwc_otg_pcd_linux.o dwc_otg_pcd.o dwc_otg_pcd_intr.o ++dwc_otg-objs += dwc_otg_hcd.o dwc_otg_hcd_linux.o dwc_otg_hcd_intr.o dwc_otg_hcd_queue.o dwc_otg_hcd_ddma.o ++dwc_otg-objs += dwc_otg_adp.o ++dwc_otg-objs += dwc_otg_fiq_fsm.o ++dwc_otg-objs += dwc_otg_fiq_stub.o ++ifneq ($(CFI),) ++dwc_otg-objs += dwc_otg_cfi.o ++endif ++ ++kernrelwd := $(subst ., ,$(KERNELRELEASE)) ++kernrel3 := $(word 1,$(kernrelwd)).$(word 2,$(kernrelwd)).$(word 3,$(kernrelwd)) ++ ++ifneq ($(kernrel3),2.6.20) ++ccflags-y += $(CPPFLAGS) ++endif ++ ++else ++ ++PWD := $(shell pwd) ++PORTLIB := $(PWD)/../dwc_common_port ++ ++# Command paths ++CTAGS := $(CTAGS) ++DOXYGEN := $(DOXYGEN) ++ ++default: portlib ++ $(MAKE) -C$(KDIR) M=$(PWD) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) modules ++ ++install: default ++ $(MAKE) -C$(KDIR) M=$(PORTLIB) modules_install ++ $(MAKE) -C$(KDIR) M=$(PWD) modules_install ++ ++portlib: ++ $(MAKE) -C$(KDIR) M=$(PORTLIB) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) modules ++ cp $(PORTLIB)/Module.symvers $(PWD)/ ++ ++docs: $(wildcard *.[hc]) doc/doxygen.cfg ++ $(DOXYGEN) doc/doxygen.cfg ++ ++tags: $(wildcard *.[hc]) ++ $(CTAGS) -e $(wildcard *.[hc]) $(wildcard linux/*.[hc]) $(wildcard $(KDIR)/include/linux/usb*.h) ++ ++ ++clean: ++ rm -rf *.o *.ko .*cmd *.mod.c .tmp_versions Module.symvers ++ ++endif +diff --git a/drivers/usb/host/dwc_otg/doc/doxygen.cfg b/drivers/usb/host/dwc_otg/doc/doxygen.cfg +new file mode 100644 +index 0000000..712b057 +--- /dev/null ++++ b/drivers/usb/host/dwc_otg/doc/doxygen.cfg +@@ -0,0 +1,224 @@ ++# Doxyfile 1.3.9.1 ++ ++#--------------------------------------------------------------------------- ++# Project related configuration options ++#--------------------------------------------------------------------------- ++PROJECT_NAME = "DesignWare USB 2.0 OTG Controller (DWC_otg) Device Driver" ++PROJECT_NUMBER = v3.00a ++OUTPUT_DIRECTORY = ./doc/ ++CREATE_SUBDIRS = NO ++OUTPUT_LANGUAGE = English ++BRIEF_MEMBER_DESC = YES ++REPEAT_BRIEF = YES ++ABBREVIATE_BRIEF = "The $name class" \ ++ "The $name widget" \ ++ "The $name file" \ ++ is \ ++ provides \ ++ specifies \ ++ contains \ ++ represents \ ++ a \ ++ an \ ++ the ++ALWAYS_DETAILED_SEC = NO ++INLINE_INHERITED_MEMB = NO ++FULL_PATH_NAMES = NO ++STRIP_FROM_PATH = ++STRIP_FROM_INC_PATH = ++SHORT_NAMES = NO ++JAVADOC_AUTOBRIEF = YES ++MULTILINE_CPP_IS_BRIEF = NO ++INHERIT_DOCS = YES ++DISTRIBUTE_GROUP_DOC = NO ++TAB_SIZE = 8 ++ALIASES = ++OPTIMIZE_OUTPUT_FOR_C = YES ++OPTIMIZE_OUTPUT_JAVA = NO ++SUBGROUPING = YES ++#--------------------------------------------------------------------------- ++# Build related configuration options ++#--------------------------------------------------------------------------- ++EXTRACT_ALL = NO ++EXTRACT_PRIVATE = YES ++EXTRACT_STATIC = YES ++EXTRACT_LOCAL_CLASSES = YES ++EXTRACT_LOCAL_METHODS = NO ++HIDE_UNDOC_MEMBERS = NO ++HIDE_UNDOC_CLASSES = NO ++HIDE_FRIEND_COMPOUNDS = NO ++HIDE_IN_BODY_DOCS = NO ++INTERNAL_DOCS = NO ++CASE_SENSE_NAMES = NO ++HIDE_SCOPE_NAMES = NO ++SHOW_INCLUDE_FILES = YES ++INLINE_INFO = YES ++SORT_MEMBER_DOCS = NO ++SORT_BRIEF_DOCS = NO ++SORT_BY_SCOPE_NAME = NO ++GENERATE_TODOLIST = YES ++GENERATE_TESTLIST = YES ++GENERATE_BUGLIST = YES ++GENERATE_DEPRECATEDLIST= YES ++ENABLED_SECTIONS = ++MAX_INITIALIZER_LINES = 30 ++SHOW_USED_FILES = YES ++SHOW_DIRECTORIES = YES ++#--------------------------------------------------------------------------- ++# configuration options related to warning and progress messages ++#--------------------------------------------------------------------------- ++QUIET = YES ++WARNINGS = YES ++WARN_IF_UNDOCUMENTED = NO ++WARN_IF_DOC_ERROR = YES ++WARN_FORMAT = "$file:$line: $text" ++WARN_LOGFILE = ++#--------------------------------------------------------------------------- ++# configuration options related to the input files ++#--------------------------------------------------------------------------- ++INPUT = . ++FILE_PATTERNS = *.c \ ++ *.h \ ++ ./linux/*.c \ ++ ./linux/*.h ++RECURSIVE = NO ++EXCLUDE = ./test/ \ ++ ./dwc_otg/.AppleDouble/ ++EXCLUDE_SYMLINKS = YES ++EXCLUDE_PATTERNS = *.mod.* ++EXAMPLE_PATH = ++EXAMPLE_PATTERNS = * ++EXAMPLE_RECURSIVE = NO ++IMAGE_PATH = ++INPUT_FILTER = ++FILTER_PATTERNS = ++FILTER_SOURCE_FILES = NO ++#--------------------------------------------------------------------------- ++# configuration options related to source browsing ++#--------------------------------------------------------------------------- ++SOURCE_BROWSER = YES ++INLINE_SOURCES = NO ++STRIP_CODE_COMMENTS = YES ++REFERENCED_BY_RELATION = NO ++REFERENCES_RELATION = NO ++VERBATIM_HEADERS = NO ++#--------------------------------------------------------------------------- ++# configuration options related to the alphabetical class index ++#--------------------------------------------------------------------------- ++ALPHABETICAL_INDEX = NO ++COLS_IN_ALPHA_INDEX = 5 ++IGNORE_PREFIX = ++#--------------------------------------------------------------------------- ++# configuration options related to the HTML output ++#--------------------------------------------------------------------------- ++GENERATE_HTML = YES ++HTML_OUTPUT = html ++HTML_FILE_EXTENSION = .html ++HTML_HEADER = ++HTML_FOOTER = ++HTML_STYLESHEET = ++HTML_ALIGN_MEMBERS = YES ++GENERATE_HTMLHELP = NO ++CHM_FILE = ++HHC_LOCATION = ++GENERATE_CHI = NO ++BINARY_TOC = NO ++TOC_EXPAND = NO ++DISABLE_INDEX = NO ++ENUM_VALUES_PER_LINE = 4 ++GENERATE_TREEVIEW = YES ++TREEVIEW_WIDTH = 250 ++#--------------------------------------------------------------------------- ++# configuration options related to the LaTeX output ++#--------------------------------------------------------------------------- ++GENERATE_LATEX = NO ++LATEX_OUTPUT = latex ++LATEX_CMD_NAME = latex ++MAKEINDEX_CMD_NAME = makeindex ++COMPACT_LATEX = NO ++PAPER_TYPE = a4wide ++EXTRA_PACKAGES = ++LATEX_HEADER = ++PDF_HYPERLINKS = NO ++USE_PDFLATEX = NO ++LATEX_BATCHMODE = NO ++LATEX_HIDE_INDICES = NO ++#--------------------------------------------------------------------------- ++# configuration options related to the RTF output ++#--------------------------------------------------------------------------- ++GENERATE_RTF = NO ++RTF_OUTPUT = rtf ++COMPACT_RTF = NO ++RTF_HYPERLINKS = NO ++RTF_STYLESHEET_FILE = ++RTF_EXTENSIONS_FILE = ++#--------------------------------------------------------------------------- ++# configuration options related to the man page output ++#--------------------------------------------------------------------------- ++GENERATE_MAN = NO ++MAN_OUTPUT = man ++MAN_EXTENSION = .3 ++MAN_LINKS = NO ++#--------------------------------------------------------------------------- ++# configuration options related to the XML output ++#--------------------------------------------------------------------------- ++GENERATE_XML = NO ++XML_OUTPUT = xml ++XML_SCHEMA = ++XML_DTD = ++XML_PROGRAMLISTING = YES ++#--------------------------------------------------------------------------- ++# configuration options for the AutoGen Definitions output ++#--------------------------------------------------------------------------- ++GENERATE_AUTOGEN_DEF = NO ++#--------------------------------------------------------------------------- ++# configuration options related to the Perl module output ++#--------------------------------------------------------------------------- ++GENERATE_PERLMOD = NO ++PERLMOD_LATEX = NO ++PERLMOD_PRETTY = YES ++PERLMOD_MAKEVAR_PREFIX = ++#--------------------------------------------------------------------------- ++# Configuration options related to the preprocessor ++#--------------------------------------------------------------------------- ++ENABLE_PREPROCESSING = YES ++MACRO_EXPANSION = YES ++EXPAND_ONLY_PREDEF = YES ++SEARCH_INCLUDES = YES ++INCLUDE_PATH = ++INCLUDE_FILE_PATTERNS = ++PREDEFINED = DEVICE_ATTR DWC_EN_ISOC ++EXPAND_AS_DEFINED = DWC_OTG_DEVICE_ATTR_BITFIELD_SHOW DWC_OTG_DEVICE_ATTR_BITFIELD_STORE DWC_OTG_DEVICE_ATTR_BITFIELD_RW DWC_OTG_DEVICE_ATTR_BITFIELD_RO DWC_OTG_DEVICE_ATTR_REG_SHOW DWC_OTG_DEVICE_ATTR_REG_STORE DWC_OTG_DEVICE_ATTR_REG32_RW DWC_OTG_DEVICE_ATTR_REG32_RO DWC_EN_ISOC ++SKIP_FUNCTION_MACROS = NO ++#--------------------------------------------------------------------------- ++# Configuration::additions related to external references ++#--------------------------------------------------------------------------- ++TAGFILES = ++GENERATE_TAGFILE = ++ALLEXTERNALS = NO ++EXTERNAL_GROUPS = YES ++PERL_PATH = /usr/bin/perl ++#--------------------------------------------------------------------------- ++# Configuration options related to the dot tool ++#--------------------------------------------------------------------------- ++CLASS_DIAGRAMS = YES ++HIDE_UNDOC_RELATIONS = YES ++HAVE_DOT = NO ++CLASS_GRAPH = YES ++COLLABORATION_GRAPH = YES ++UML_LOOK = NO ++TEMPLATE_RELATIONS = NO ++INCLUDE_GRAPH = YES ++INCLUDED_BY_GRAPH = YES ++CALL_GRAPH = NO ++GRAPHICAL_HIERARCHY = YES ++DOT_IMAGE_FORMAT = png ++DOT_PATH = ++DOTFILE_DIRS = ++MAX_DOT_GRAPH_DEPTH = 1000 ++GENERATE_LEGEND = YES ++DOT_CLEANUP = YES ++#--------------------------------------------------------------------------- ++# Configuration::additions related to the search engine ++#--------------------------------------------------------------------------- ++SEARCHENGINE = NO +diff --git a/drivers/usb/host/dwc_otg/dummy_audio.c b/drivers/usb/host/dwc_otg/dummy_audio.c +new file mode 100644 +index 0000000..225decf +--- /dev/null ++++ b/drivers/usb/host/dwc_otg/dummy_audio.c +@@ -0,0 +1,1575 @@ ++/* ++ * zero.c -- Gadget Zero, for USB development ++ * ++ * Copyright (C) 2003-2004 David Brownell ++ * 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, ++ * without modification. ++ * 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. ++ * 3. The names of the above-listed copyright holders may not be used ++ * to endorse or promote products derived from this software without ++ * specific prior written permission. ++ * ++ * ALTERNATIVELY, this software may be distributed under the terms of the ++ * GNU General Public License ("GPL") as published by the Free Software ++ * Foundation, either version 2 of that License or (at your option) any ++ * later version. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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. ++ */ ++ ++ ++/* ++ * Gadget Zero only needs two bulk endpoints, and is an example of how you ++ * can write a hardware-agnostic gadget driver running inside a USB device. ++ * ++ * Hardware details are visible (see CONFIG_USB_ZERO_* below) but don't ++ * affect most of the driver. ++ * ++ * Use it with the Linux host/master side "usbtest" driver to get a basic ++ * functional test of your device-side usb stack, or with "usb-skeleton". ++ * ++ * It supports two similar configurations. One sinks whatever the usb host ++ * writes, and in return sources zeroes. The other loops whatever the host ++ * writes back, so the host can read it. Module options include: ++ * ++ * buflen=N default N=4096, buffer size used ++ * qlen=N default N=32, how many buffers in the loopback queue ++ * loopdefault default false, list loopback config first ++ * ++ * Many drivers will only have one configuration, letting them be much ++ * simpler if they also don't support high speed operation (like this ++ * driver does). ++ */ ++ ++#include <linux/config.h> ++#include <linux/module.h> ++#include <linux/kernel.h> ++#include <linux/delay.h> ++#include <linux/ioport.h> ++#include <linux/sched.h> ++#include <linux/slab.h> ++#include <linux/smp_lock.h> ++#include <linux/errno.h> ++#include <linux/init.h> ++#include <linux/timer.h> ++#include <linux/list.h> ++#include <linux/interrupt.h> ++#include <linux/uts.h> ++#include <linux/version.h> ++#include <linux/device.h> ++#include <linux/moduleparam.h> ++#include <linux/proc_fs.h> ++ ++#include <asm/byteorder.h> ++#include <asm/io.h> ++#include <asm/irq.h> ++#include <asm/system.h> ++#include <asm/unaligned.h> ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21) ++# include <linux/usb/ch9.h> ++#else ++# include <linux/usb_ch9.h> ++#endif ++ ++#include <linux/usb_gadget.h> ++ ++ ++/*-------------------------------------------------------------------------*/ ++/*-------------------------------------------------------------------------*/ ++ ++ ++static int utf8_to_utf16le(const char *s, u16 *cp, unsigned len) ++{ ++ int count = 0; ++ u8 c; ++ u16 uchar; ++ ++ /* this insists on correct encodings, though not minimal ones. ++ * BUT it currently rejects legit 4-byte UTF-8 code points, ++ * which need surrogate pairs. (Unicode 3.1 can use them.) ++ */ ++ while (len != 0 && (c = (u8) *s++) != 0) { ++ if (unlikely(c & 0x80)) { ++ // 2-byte sequence: ++ // 00000yyyyyxxxxxx = 110yyyyy 10xxxxxx ++ if ((c & 0xe0) == 0xc0) { ++ uchar = (c & 0x1f) << 6; ++ ++ c = (u8) *s++; ++ if ((c & 0xc0) != 0xc0) ++ goto fail; ++ c &= 0x3f; ++ uchar |= c; ++ ++ // 3-byte sequence (most CJKV characters): ++ // zzzzyyyyyyxxxxxx = 1110zzzz 10yyyyyy 10xxxxxx ++ } else if ((c & 0xf0) == 0xe0) { ++ uchar = (c & 0x0f) << 12; ++ ++ c = (u8) *s++; ++ if ((c & 0xc0) != 0xc0) ++ goto fail; ++ c &= 0x3f; ++ uchar |= c << 6; ++ ++ c = (u8) *s++; ++ if ((c & 0xc0) != 0xc0) ++ goto fail; ++ c &= 0x3f; ++ uchar |= c; ++ ++ /* no bogus surrogates */ ++ if (0xd800 <= uchar && uchar <= 0xdfff) ++ goto fail; ++ ++ // 4-byte sequence (surrogate pairs, currently rare): ++ // 11101110wwwwzzzzyy + 110111yyyyxxxxxx ++ // = 11110uuu 10uuzzzz 10yyyyyy 10xxxxxx ++ // (uuuuu = wwww + 1) ++ // FIXME accept the surrogate code points (only) ++ ++ } else ++ goto fail; ++ } else ++ uchar = c; ++ put_unaligned (cpu_to_le16 (uchar), cp++); ++ count++; ++ len--; ++ } ++ return count; ++fail: ++ return -1; ++} ++ ++ ++/** ++ * usb_gadget_get_string - fill out a string descriptor ++ * @table: of c strings encoded using UTF-8 ++ * @id: string id, from low byte of wValue in get string descriptor ++ * @buf: at least 256 bytes ++ * ++ * Finds the UTF-8 string matching the ID, and converts it into a ++ * string descriptor in utf16-le. ++ * Returns length of descriptor (always even) or negative errno ++ * ++ * If your driver needs stings in multiple languages, you'll probably ++ * "switch (wIndex) { ... }" in your ep0 string descriptor logic, ++ * using this routine after choosing which set of UTF-8 strings to use. ++ * Note that US-ASCII is a strict subset of UTF-8; any string bytes with ++ * the eighth bit set will be multibyte UTF-8 characters, not ISO-8859/1 ++ * characters (which are also widely used in C strings). ++ */ ++int ++usb_gadget_get_string (struct usb_gadget_strings *table, int id, u8 *buf) ++{ ++ struct usb_string *s; ++ int len; ++ ++ /* descriptor 0 has the language id */ ++ if (id == 0) { ++ buf [0] = 4; ++ buf [1] = USB_DT_STRING; ++ buf [2] = (u8) table->language; ++ buf [3] = (u8) (table->language >> 8); ++ return 4; ++ } ++ for (s = table->strings; s && s->s; s++) ++ if (s->id == id) ++ break; ++ ++ /* unrecognized: stall. */ ++ if (!s || !s->s) ++ return -EINVAL; ++ ++ /* string descriptors have length, tag, then UTF16-LE text */ ++ len = min ((size_t) 126, strlen (s->s)); ++ memset (buf + 2, 0, 2 * len); /* zero all the bytes */ ++ len = utf8_to_utf16le(s->s, (u16 *)&buf[2], len); ++ if (len < 0) ++ return -EINVAL; ++ buf [0] = (len + 1) * 2; ++ buf [1] = USB_DT_STRING; ++ return buf [0]; ++} ++ ++ ++/*-------------------------------------------------------------------------*/ ++/*-------------------------------------------------------------------------*/ ++ ++ ++/** ++ * usb_descriptor_fillbuf - fill buffer with descriptors ++ * @buf: Buffer to be filled ++ * @buflen: Size of buf ++ * @src: Array of descriptor pointers, terminated by null pointer. ++ * ++ * Copies descriptors into the buffer, returning the length or a ++ * negative error code if they can't all be copied. Useful when ++ * assembling descriptors for an associated set of interfaces used ++ * as part of configuring a composite device; or in other cases where ++ * sets of descriptors need to be marshaled. ++ */ ++int ++usb_descriptor_fillbuf(void *buf, unsigned buflen, ++ const struct usb_descriptor_header **src) ++{ ++ u8 *dest = buf; ++ ++ if (!src) ++ return -EINVAL; ++ ++ /* fill buffer from src[] until null descriptor ptr */ ++ for (; 0 != *src; src++) { ++ unsigned len = (*src)->bLength; ++ ++ if (len > buflen) ++ return -EINVAL; ++ memcpy(dest, *src, len); ++ buflen -= len; ++ dest += len; ++ } ++ return dest - (u8 *)buf; ++} ++ ++ ++/** ++ * usb_gadget_config_buf - builts a complete configuration descriptor ++ * @config: Header for the descriptor, including characteristics such ++ * as power requirements and number of interfaces. ++ * @desc: Null-terminated vector of pointers to the descriptors (interface, ++ * endpoint, etc) defining all functions in this device configuration. ++ * @buf: Buffer for the resulting configuration descriptor. ++ * @length: Length of buffer. If this is not big enough to hold the ++ * entire configuration descriptor, an error code will be returned. ++ * ++ * This copies descriptors into the response buffer, building a descriptor ++ * for that configuration. It returns the buffer length or a negative ++ * status code. The config.wTotalLength field is set to match the length ++ * of the result, but other descriptor fields (including power usage and ++ * interface count) must be set by the caller. ++ * ++ * Gadget drivers could use this when constructing a config descriptor ++ * in response to USB_REQ_GET_DESCRIPTOR. They will need to patch the ++ * resulting bDescriptorType value if USB_DT_OTHER_SPEED_CONFIG is needed. ++ */ ++int usb_gadget_config_buf( ++ const struct usb_config_descriptor *config, ++ void *buf, ++ unsigned length, ++ const struct usb_descriptor_header **desc ++) ++{ ++ struct usb_config_descriptor *cp = buf; ++ int len; ++ ++ /* config descriptor first */ ++ if (length < USB_DT_CONFIG_SIZE || !desc) ++ return -EINVAL; ++ *cp = *config; ++ ++ /* then interface/endpoint/class/vendor/... */ ++ len = usb_descriptor_fillbuf(USB_DT_CONFIG_SIZE + (u8*)buf, ++ length - USB_DT_CONFIG_SIZE, desc); ++ if (len < 0) ++ return len; ++ len += USB_DT_CONFIG_SIZE; ++ if (len > 0xffff) ++ return -EINVAL; ++ ++ /* patch up the config descriptor */ ++ cp->bLength = USB_DT_CONFIG_SIZE; ++ cp->bDescriptorType = USB_DT_CONFIG; ++ cp->wTotalLength = cpu_to_le16(len); ++ cp->bmAttributes |= USB_CONFIG_ATT_ONE; ++ return len; ++} ++ ++/*-------------------------------------------------------------------------*/ ++/*-------------------------------------------------------------------------*/ ++ ++ ++#define RBUF_LEN (1024*1024) ++static int rbuf_start; ++static int rbuf_len; ++static __u8 rbuf[RBUF_LEN]; ++ ++/*-------------------------------------------------------------------------*/ ++ ++#define DRIVER_VERSION "St Patrick's Day 2004" ++ ++static const char shortname [] = "zero"; ++static const char longname [] = "YAMAHA YST-MS35D USB Speaker "; ++ ++static const char source_sink [] = "source and sink data"; ++static const char loopback [] = "loop input to output"; ++ ++/*-------------------------------------------------------------------------*/ ++ ++/* ++ * driver assumes self-powered hardware, and ++ * has no way for users to trigger remote wakeup. ++ * ++ * this version autoconfigures as much as possible, ++ * which is reasonable for most "bulk-only" drivers. ++ */ ++static const char *EP_IN_NAME; /* source */ ++static const char *EP_OUT_NAME; /* sink */ ++ ++/*-------------------------------------------------------------------------*/ ++ ++/* big enough to hold our biggest descriptor */ ++#define USB_BUFSIZ 512 ++ ++struct zero_dev { ++ spinlock_t lock; ++ struct usb_gadget *gadget; ++ struct usb_request *req; /* for control responses */ ++ ++ /* when configured, we have one of two configs: ++ * - source data (in to host) and sink it (out from host) ++ * - or loop it back (out from host back in to host) ++ */ ++ u8 config; ++ struct usb_ep *in_ep, *out_ep; ++ ++ /* autoresume timer */ ++ struct timer_list resume; ++}; ++ ++#define xprintk(d,level,fmt,args...) \ ++ dev_printk(level , &(d)->gadget->dev , fmt , ## args) ++ ++#ifdef DEBUG ++#define DBG(dev,fmt,args...) \ ++ xprintk(dev , KERN_DEBUG , fmt , ## args) ++#else ++#define DBG(dev,fmt,args...) \ ++ do { } while (0) ++#endif /* DEBUG */ ++ ++#ifdef VERBOSE ++#define VDBG DBG ++#else ++#define VDBG(dev,fmt,args...) \ ++ do { } while (0) ++#endif /* VERBOSE */ ++ ++#define ERROR(dev,fmt,args...) \ ++ xprintk(dev , KERN_ERR , fmt , ## args) ++#define WARN(dev,fmt,args...) \ ++ xprintk(dev , KERN_WARNING , fmt , ## args) ++#define INFO(dev,fmt,args...) \ ++ xprintk(dev , KERN_INFO , fmt , ## args) ++ ++/*-------------------------------------------------------------------------*/ ++ ++static unsigned buflen = 4096; ++static unsigned qlen = 32; ++static unsigned pattern = 0; ++ ++module_param (buflen, uint, S_IRUGO|S_IWUSR); ++module_param (qlen, uint, S_IRUGO|S_IWUSR); ++module_param (pattern, uint, S_IRUGO|S_IWUSR); ++ ++/* ++ * if it's nonzero, autoresume says how many seconds to wait ++ * before trying to wake up the host after suspend. ++ */ ++static unsigned autoresume = 0; ++module_param (autoresume, uint, 0); ++ ++/* ++ * Normally the "loopback" configuration is second (index 1) so ++ * it's not the default. Here's where to change that order, to ++ * work better with hosts where config changes are problematic. ++ * Or controllers (like superh) that only support one config. ++ */ ++static int loopdefault = 0; ++ ++module_param (loopdefault, bool, S_IRUGO|S_IWUSR); ++ ++/*-------------------------------------------------------------------------*/ ++ ++/* Thanks to NetChip Technologies for donating this product ID. ++ * ++ * DO NOT REUSE THESE IDs with a protocol-incompatible driver!! Ever!! ++ * Instead: allocate your own, using normal USB-IF procedures. ++ */ ++#ifndef CONFIG_USB_ZERO_HNPTEST ++#define DRIVER_VENDOR_NUM 0x0525 /* NetChip */ ++#define DRIVER_PRODUCT_NUM 0xa4a0 /* Linux-USB "Gadget Zero" */ ++#else ++#define DRIVER_VENDOR_NUM 0x1a0a /* OTG test device IDs */ ++#define DRIVER_PRODUCT_NUM 0xbadd ++#endif ++ ++/*-------------------------------------------------------------------------*/ ++ ++/* ++ * DESCRIPTORS ... most are static, but strings and (full) ++ * configuration descriptors are built on demand. ++ */ ++ ++/* ++#define STRING_MANUFACTURER 25 ++#define STRING_PRODUCT 42 ++#define STRING_SERIAL 101 ++*/ ++#define STRING_MANUFACTURER 1 ++#define STRING_PRODUCT 2 ++#define STRING_SERIAL 3 ++ ++#define STRING_SOURCE_SINK 250 ++#define STRING_LOOPBACK 251 ++ ++/* ++ * This device advertises two configurations; these numbers work ++ * on a pxa250 as well as more flexible hardware. ++ */ ++#define CONFIG_SOURCE_SINK 3 ++#define CONFIG_LOOPBACK 2 ++ ++/* ++static struct usb_device_descriptor ++device_desc = { ++ .bLength = sizeof device_desc, ++ .bDescriptorType = USB_DT_DEVICE, ++ ++ .bcdUSB = __constant_cpu_to_le16 (0x0200), ++ .bDeviceClass = USB_CLASS_VENDOR_SPEC, ++ ++ .idVendor = __constant_cpu_to_le16 (DRIVER_VENDOR_NUM), ++ .idProduct = __constant_cpu_to_le16 (DRIVER_PRODUCT_NUM), ++ .iManufacturer = STRING_MANUFACTURER, ++ .iProduct = STRING_PRODUCT, ++ .iSerialNumber = STRING_SERIAL, ++ .bNumConfigurations = 2, ++}; ++*/ ++static struct usb_device_descriptor ++device_desc = { ++ .bLength = sizeof device_desc, ++ .bDescriptorType = USB_DT_DEVICE, ++ .bcdUSB = __constant_cpu_to_le16 (0x0100), ++ .bDeviceClass = USB_CLASS_PER_INTERFACE, ++ .bDeviceSubClass = 0, ++ .bDeviceProtocol = 0, ++ .bMaxPacketSize0 = 64, ++ .bcdDevice = __constant_cpu_to_le16 (0x0100), ++ .idVendor = __constant_cpu_to_le16 (0x0499), ++ .idProduct = __constant_cpu_to_le16 (0x3002), ++ .iManufacturer = STRING_MANUFACTURER, ++ .iProduct = STRING_PRODUCT, ++ .iSerialNumber = STRING_SERIAL, ++ .bNumConfigurations = 1, ++}; ++ ++static struct usb_config_descriptor ++z_config = { ++ .bLength = sizeof z_config, ++ .bDescriptorType = USB_DT_CONFIG, ++ ++ /* compute wTotalLength on the fly */ ++ .bNumInterfaces = 2, ++ .bConfigurationValue = 1, ++ .iConfiguration = 0, ++ .bmAttributes = 0x40, ++ .bMaxPower = 0, /* self-powered */ ++}; ++ ++ ++static struct usb_otg_descriptor ++otg_descriptor = { ++ .bLength = sizeof otg_descriptor, ++ .bDescriptorType = USB_DT_OTG, ++ ++ .bmAttributes = USB_OTG_SRP, ++}; ++ ++/* one interface in each configuration */ ++#ifdef CONFIG_USB_GADGET_DUALSPEED ++ ++/* ++ * usb 2.0 devices need to expose both high speed and full speed ++ * descriptors, unless they only run at full speed. ++ * ++ * that means alternate endpoint descriptors (bigger packets) ++ * and a "device qualifier" ... plus more construction options ++ * for the config descriptor. ++ */ ++ ++static struct usb_qualifier_descriptor ++dev_qualifier = { ++ .bLength = sizeof dev_qualifier, ++ .bDescriptorType = USB_DT_DEVICE_QUALIFIER, ++ ++ .bcdUSB = __constant_cpu_to_le16 (0x0200), ++ .bDeviceClass = USB_CLASS_VENDOR_SPEC, ++ ++ .bNumConfigurations = 2, ++}; ++ ++ ++struct usb_cs_as_general_descriptor { ++ __u8 bLength; ++ __u8 bDescriptorType; ++ ++ __u8 bDescriptorSubType; ++ __u8 bTerminalLink; ++ __u8 bDelay; ++ __u16 wFormatTag; ++} __attribute__ ((packed)); ++ ++struct usb_cs_as_format_descriptor { ++ __u8 bLength; ++ __u8 bDescriptorType; ++ ++ __u8 bDescriptorSubType; ++ __u8 bFormatType; ++ __u8 bNrChannels; ++ __u8 bSubframeSize; ++ __u8 bBitResolution; ++ __u8 bSamfreqType; ++ __u8 tLowerSamFreq[3]; ++ __u8 tUpperSamFreq[3]; ++} __attribute__ ((packed)); ++ ++static const struct usb_interface_descriptor ++z_audio_control_if_desc = { ++ .bLength = sizeof z_audio_control_if_desc, ++ .bDescriptorType = USB_DT_INTERFACE, ++ .bInterfaceNumber = 0, ++ .bAlternateSetting = 0, ++ .bNumEndpoints = 0, ++ .bInterfaceClass = USB_CLASS_AUDIO, ++ .bInterfaceSubClass = 0x1, ++ .bInterfaceProtocol = 0, ++ .iInterface = 0, ++}; ++ ++static const struct usb_interface_descriptor ++z_audio_if_desc = { ++ .bLength = sizeof z_audio_if_desc, ++ .bDescriptorType = USB_DT_INTERFACE, ++ .bInterfaceNumber = 1, ++ .bAlternateSetting = 0, ++ .bNumEndpoints = 0, ++ .bInterfaceClass = USB_CLASS_AUDIO, ++ .bInterfaceSubClass = 0x2, ++ .bInterfaceProtocol = 0, ++ .iInterface = 0, ++}; ++ ++static const struct usb_interface_descriptor ++z_audio_if_desc2 = { ++ .bLength = sizeof z_audio_if_desc, ++ .bDescriptorType = USB_DT_INTERFACE, ++ .bInterfaceNumber = 1, ++ .bAlternateSetting = 1, ++ .bNumEndpoints = 1, ++ .bInterfaceClass = USB_CLASS_AUDIO, ++ .bInterfaceSubClass = 0x2, ++ .bInterfaceProtocol = 0, ++ .iInterface = 0, ++}; ++ ++static const struct usb_cs_as_general_descriptor ++z_audio_cs_as_if_desc = { ++ .bLength = 7, ++ .bDescriptorType = 0x24, ++ ++ .bDescriptorSubType = 0x01, ++ .bTerminalLink = 0x01, ++ .bDelay = 0x0, ++ .wFormatTag = __constant_cpu_to_le16 (0x0001) ++}; ++ ++ ++static const struct usb_cs_as_format_descriptor ++z_audio_cs_as_format_desc = { ++ .bLength = 0xe, ++ .bDescriptorType = 0x24, ++ ++ .bDescriptorSubType = 2, ++ .bFormatType = 1, ++ .bNrChannels = 1, ++ .bSubframeSize = 1, ++ .bBitResolution = 8, ++ .bSamfreqType = 0, ++ .tLowerSamFreq = {0x7e, 0x13, 0x00}, ++ .tUpperSamFreq = {0xe2, 0xd6, 0x00}, ++}; ++ ++static const struct usb_endpoint_descriptor ++z_iso_ep = { ++ .bLength = 0x09, ++ .bDescriptorType = 0x05, ++ .bEndpointAddress = 0x04, ++ .bmAttributes = 0x09, ++ .wMaxPacketSize = 0x0038, ++ .bInterval = 0x01, ++ .bRefresh = 0x00, ++ .bSynchAddress = 0x00, ++}; ++ ++static char z_iso_ep2[] = {0x07, 0x25, 0x01, 0x00, 0x02, 0x00, 0x02}; ++ ++// 9 bytes ++static char z_ac_interface_header_desc[] = ++{ 0x09, 0x24, 0x01, 0x00, 0x01, 0x2b, 0x00, 0x01, 0x01 }; ++ ++// 12 bytes ++static char z_0[] = {0x0c, 0x24, 0x02, 0x01, 0x01, 0x01, 0x00, 0x02, ++ 0x03, 0x00, 0x00, 0x00}; ++// 13 bytes ++static char z_1[] = {0x0d, 0x24, 0x06, 0x02, 0x01, 0x02, 0x15, 0x00, ++ 0x02, 0x00, 0x02, 0x00, 0x00}; ++// 9 bytes ++static char z_2[] = {0x09, 0x24, 0x03, 0x03, 0x01, 0x03, 0x00, 0x02, ++ 0x00}; ++ ++static char za_0[] = {0x09, 0x04, 0x01, 0x02, 0x01, 0x01, 0x02, 0x00, ++ 0x00}; ++ ++static char za_1[] = {0x07, 0x24, 0x01, 0x01, 0x00, 0x01, 0x00}; ++ ++static char za_2[] = {0x0e, 0x24, 0x02, 0x01, 0x02, 0x01, 0x08, 0x00, ++ 0x7e, 0x13, 0x00, 0xe2, 0xd6, 0x00}; ++ ++static char za_3[] = {0x09, 0x05, 0x04, 0x09, 0x70, 0x00, 0x01, 0x00, ++ 0x00}; ++ ++static char za_4[] = {0x07, 0x25, 0x01, 0x00, 0x02, 0x00, 0x02}; ++ ++static char za_5[] = {0x09, 0x04, 0x01, 0x03, 0x01, 0x01, 0x02, 0x00, ++ 0x00}; ++ ++static char za_6[] = {0x07, 0x24, 0x01, 0x01, 0x00, 0x01, 0x00}; ++ ++static char za_7[] = {0x0e, 0x24, 0x02, 0x01, 0x01, 0x02, 0x10, 0x00, ++ 0x7e, 0x13, 0x00, 0xe2, 0xd6, 0x00}; ++ ++static char za_8[] = {0x09, 0x05, 0x04, 0x09, 0x70, 0x00, 0x01, 0x00, ++ 0x00}; ++ ++static char za_9[] = {0x07, 0x25, 0x01, 0x00, 0x02, 0x00, 0x02}; ++ ++static char za_10[] = {0x09, 0x04, 0x01, 0x04, 0x01, 0x01, 0x02, 0x00, ++ 0x00}; ++ ++static char za_11[] = {0x07, 0x24, 0x01, 0x01, 0x00, 0x01, 0x00}; ++ ++static char za_12[] = {0x0e, 0x24, 0x02, 0x01, 0x02, 0x02, 0x10, 0x00, ++ 0x73, 0x13, 0x00, 0xe2, 0xd6, 0x00}; ++ ++static char za_13[] = {0x09, 0x05, 0x04, 0x09, 0xe0, 0x00, 0x01, 0x00, ++ 0x00}; ++ ++static char za_14[] = {0x07, 0x25, 0x01, 0x00, 0x02, 0x00, 0x02}; ++ ++static char za_15[] = {0x09, 0x04, 0x01, 0x05, 0x01, 0x01, 0x02, 0x00, ++ 0x00}; ++ ++static char za_16[] = {0x07, 0x24, 0x01, 0x01, 0x00, 0x01, 0x00}; ++ ++static char za_17[] = {0x0e, 0x24, 0x02, 0x01, 0x01, 0x03, 0x14, 0x00, ++ 0x7e, 0x13, 0x00, 0xe2, 0xd6, 0x00}; ++ ++static char za_18[] = {0x09, 0x05, 0x04, 0x09, 0xa8, 0x00, 0x01, 0x00, ++ 0x00}; ++ ++static char za_19[] = {0x07, 0x25, 0x01, 0x00, 0x02, 0x00, 0x02}; ++ ++static char za_20[] = {0x09, 0x04, 0x01, 0x06, 0x01, 0x01, 0x02, 0x00, ++ 0x00}; ++ ++static char za_21[] = {0x07, 0x24, 0x01, 0x01, 0x00, 0x01, 0x00}; ++ ++static char za_22[] = {0x0e, 0x24, 0x02, 0x01, 0x02, 0x03, 0x14, 0x00, ++ 0x7e, 0x13, 0x00, 0xe2, 0xd6, 0x00}; ++ ++static char za_23[] = {0x09, 0x05, 0x04, 0x09, 0x50, 0x01, 0x01, 0x00, ++ 0x00}; ++ ++static char za_24[] = {0x07, 0x25, 0x01, 0x00, 0x02, 0x00, 0x02}; ++ ++ ++ ++static const struct usb_descriptor_header *z_function [] = { ++ (struct usb_descriptor_header *) &z_audio_control_if_desc, ++ (struct usb_descriptor_header *) &z_ac_interface_header_desc, ++ (struct usb_descriptor_header *) &z_0, ++ (struct usb_descriptor_header *) &z_1, ++ (struct usb_descriptor_header *) &z_2, ++ (struct usb_descriptor_header *) &z_audio_if_desc, ++ (struct usb_descriptor_header *) &z_audio_if_desc2, ++ (struct usb_descriptor_header *) &z_audio_cs_as_if_desc, ++ (struct usb_descriptor_header *) &z_audio_cs_as_format_desc, ++ (struct usb_descriptor_header *) &z_iso_ep, ++ (struct usb_descriptor_header *) &z_iso_ep2, ++ (struct usb_descriptor_header *) &za_0, ++ (struct usb_descriptor_header *) &za_1, ++ (struct usb_descriptor_header *) &za_2, ++ (struct usb_descriptor_header *) &za_3, ++ (struct usb_descriptor_header *) &za_4, ++ (struct usb_descriptor_header *) &za_5, ++ (struct usb_descriptor_header *) &za_6, ++ (struct usb_descriptor_header *) &za_7, ++ (struct usb_descriptor_header *) &za_8, ++ (struct usb_descriptor_header *) &za_9, ++ (struct usb_descriptor_header *) &za_10, ++ (struct usb_descriptor_header *) &za_11, ++ (struct usb_descriptor_header *) &za_12, ++ (struct usb_descriptor_header *) &za_13, ++ (struct usb_descriptor_header *) &za_14, ++ (struct usb_descriptor_header *) &za_15, ++ (struct usb_descriptor_header *) &za_16, ++ (struct usb_descriptor_header *) &za_17, ++ (struct usb_descriptor_header *) &za_18, ++ (struct usb_descriptor_header *) &za_19, ++ (struct usb_descriptor_header *) &za_20, ++ (struct usb_descriptor_header *) &za_21, ++ (struct usb_descriptor_header *) &za_22, ++ (struct usb_descriptor_header *) &za_23, ++ (struct usb_descriptor_header *) &za_24, ++ NULL, ++}; ++ ++/* maxpacket and other transfer characteristics vary by speed. */ ++#define ep_desc(g,hs,fs) (((g)->speed==USB_SPEED_HIGH)?(hs):(fs)) ++ ++#else ++ ++/* if there's no high speed support, maxpacket doesn't change. */ ++#define ep_desc(g,hs,fs) fs ++ ++#endif /* !CONFIG_USB_GADGET_DUALSPEED */ ++ ++static char manufacturer [40]; ++//static char serial [40]; ++static char serial [] = "Ser 00 em"; ++ ++/* static strings, in UTF-8 */ ++static struct usb_string strings [] = { ++ { STRING_MANUFACTURER, manufacturer, }, ++ { STRING_PRODUCT, longname, }, ++ { STRING_SERIAL, serial, }, ++ { STRING_LOOPBACK, loopback, }, ++ { STRING_SOURCE_SINK, source_sink, }, ++ { } /* end of list */ ++}; ++ ++static struct usb_gadget_strings stringtab = { ++ .language = 0x0409, /* en-us */ ++ .strings = strings, ++}; ++ ++/* ++ * config descriptors are also handcrafted. these must agree with code ++ * that sets configurations, and with code managing interfaces and their ++ * altsettings. other complexity may come from: ++ * ++ * - high speed support, including "other speed config" rules ++ * - multiple configurations ++ * - interfaces with alternate settings ++ * - embedded class or vendor-specific descriptors ++ * ++ * this handles high speed, and has a second config that could as easily ++ * have been an alternate interface setting (on most hardware). ++ * ++ * NOTE: to demonstrate (and test) more USB capabilities, this driver ++ * should include an altsetting to test interrupt transfers, including ++ * high bandwidth modes at high speed. (Maybe work like Intel's test ++ * device?) ++ */ ++static int ++config_buf (struct usb_gadget *gadget, u8 *buf, u8 type, unsigned index) ++{ ++ int len; ++ const struct usb_descriptor_header **function; ++ ++ function = z_function; ++ len = usb_gadget_config_buf (&z_config, buf, USB_BUFSIZ, function); ++ if (len < 0) ++ return len; ++ ((struct usb_config_descriptor *) buf)->bDescriptorType = type; ++ return len; ++} ++ ++/*-------------------------------------------------------------------------*/ ++ ++static struct usb_request * ++alloc_ep_req (struct usb_ep *ep, unsigned length) ++{ ++ struct usb_request *req; ++ ++ req = usb_ep_alloc_request (ep, GFP_ATOMIC); ++ if (req) { ++ req->length = length; ++ req->buf = usb_ep_alloc_buffer (ep, length, ++ &req->dma, GFP_ATOMIC); ++ if (!req->buf) { ++ usb_ep_free_request (ep, req); ++ req = NULL; ++ } ++ } ++ return req; ++} ++ ++static void free_ep_req (struct usb_ep *ep, struct usb_request *req) ++{ ++ if (req->buf) ++ usb_ep_free_buffer (ep, req->buf, req->dma, req->length); ++ usb_ep_free_request (ep, req); ++} ++ ++/*-------------------------------------------------------------------------*/ ++ ++/* optionally require specific source/sink data patterns */ ++ ++static int ++check_read_data ( ++ struct zero_dev *dev, ++ struct usb_ep *ep, ++ struct usb_request *req ++) ++{ ++ unsigned i; ++ u8 *buf = req->buf; ++ ++ for (i = 0; i < req->actual; i++, buf++) { ++ switch (pattern) { ++ /* all-zeroes has no synchronization issues */ ++ case 0: ++ if (*buf == 0) ++ continue; ++ break; ++ /* mod63 stays in sync with short-terminated transfers, ++ * or otherwise when host and gadget agree on how large ++ * each usb transfer request should be. resync is done ++ * with set_interface or set_config. ++ */ ++ case 1: ++ if (*buf == (u8)(i % 63)) ++ continue; ++ break; ++ } ++ ERROR (dev, "bad OUT byte, buf [%d] = %d\n", i, *buf); ++ usb_ep_set_halt (ep); ++ return -EINVAL; ++ } ++ return 0; ++} ++ ++/*-------------------------------------------------------------------------*/ ++ ++static void zero_reset_config (struct zero_dev *dev) ++{ ++ if (dev->config == 0) ++ return; ++ ++ DBG (dev, "reset config\n"); ++ ++ /* just disable endpoints, forcing completion of pending i/o. ++ * all our completion handlers free their requests in this case. ++ */ ++ if (dev->in_ep) { ++ usb_ep_disable (dev->in_ep); ++ dev->in_ep = NULL; ++ } ++ if (dev->out_ep) { ++ usb_ep_disable (dev->out_ep); ++ dev->out_ep = NULL; ++ } ++ dev->config = 0; ++ del_timer (&dev->resume); ++} ++ ++#define _write(f, buf, sz) (f->f_op->write(f, buf, sz, &f->f_pos)) ++ ++static void ++zero_isoc_complete (struct usb_ep *ep, struct usb_request *req) ++{ ++ struct zero_dev *dev = ep->driver_data; ++ int status = req->status; ++ int i, j; ++ ++ switch (status) { ++ ++ case 0: /* normal completion? */ ++ //printk ("\nzero ---------------> isoc normal completion %d bytes\n", req->actual); ++ for (i=0, j=rbuf_start; i<req->actual; i++) { ++ //printk ("%02x ", ((__u8*)req->buf)[i]); ++ rbuf[j] = ((__u8*)req->buf)[i]; ++ j++; ++ if (j >= RBUF_LEN) j=0; ++ } ++ rbuf_start = j; ++ //printk ("\n\n"); ++ ++ if (rbuf_len < RBUF_LEN) { ++ rbuf_len += req->actual; ++ if (rbuf_len > RBUF_LEN) { ++ rbuf_len = RBUF_LEN; ++ } ++ } ++ ++ break; ++ ++ /* this endpoint is normally active while we're configured */ ++ case -ECONNABORTED: /* hardware forced ep reset */ ++ case -ECONNRESET: /* request dequeued */ ++ case -ESHUTDOWN: /* disconnect from host */ ++ VDBG (dev, "%s gone (%d), %d/%d\n", ep->name, status, ++ req->actual, req->length); ++ if (ep == dev->out_ep) ++ check_read_data (dev, ep, req); ++ free_ep_req (ep, req); ++ return; ++ ++ case -EOVERFLOW: /* buffer overrun on read means that ++ * we didn't provide a big enough ++ * buffer. ++ */ ++ default: ++#if 1 ++ DBG (dev, "%s complete --> %d, %d/%d\n", ep->name, ++ status, req->actual, req->length); ++#endif ++ case -EREMOTEIO: /* short read */ ++ break; ++ } ++ ++ status = usb_ep_queue (ep, req, GFP_ATOMIC); ++ if (status) { ++ ERROR (dev, "kill %s: resubmit %d bytes --> %d\n", ++ ep->name, req->length, status); ++ usb_ep_set_halt (ep); ++ /* FIXME recover later ... somehow */ ++ } ++} ++ ++static struct usb_request * ++zero_start_isoc_ep (struct usb_ep *ep, int gfp_flags) ++{ ++ struct usb_request *req; ++ int status; ++ ++ req = alloc_ep_req (ep, 512); ++ if (!req) ++ return NULL; ++ ++ req->complete = zero_isoc_complete; ++ ++ status = usb_ep_queue (ep, req, gfp_flags); ++ if (status) { ++ struct zero_dev *dev = ep->driver_data; ++ ++ ERROR (dev, "start %s --> %d\n", ep->name, status); ++ free_ep_req (ep, req); ++ req = NULL; ++ } ++ ++ return req; ++} ++ ++/* change our operational config. this code must agree with the code ++ * that returns config descriptors, and altsetting code. ++ * ++ * it's also responsible for power management interactions. some ++ * configurations might not work with our current power sources. ++ * ++ * note that some device controller hardware will constrain what this ++ * code can do, perhaps by disallowing more than one configuration or ++ * by limiting configuration choices (like the pxa2xx). ++ */ ++static int ++zero_set_config (struct zero_dev *dev, unsigned number, int gfp_flags) ++{ ++ int result = 0; ++ struct usb_gadget *gadget = dev->gadget; ++ const struct usb_endpoint_descriptor *d; ++ struct usb_ep *ep; ++ ++ if (number == dev->config) ++ return 0; ++ ++ zero_reset_config (dev); ++ ++ gadget_for_each_ep (ep, gadget) { ++ ++ if (strcmp (ep->name, "ep4") == 0) { ++ ++ d = (struct usb_endpoint_descripter *)&za_23; // isoc ep desc for audio i/f alt setting 6 ++ result = usb_ep_enable (ep, d); ++ ++ if (result == 0) { ++ ep->driver_data = dev; ++ dev->in_ep = ep; ++ ++ if (zero_start_isoc_ep (ep, gfp_flags) != 0) { ++ ++ dev->in_ep = ep; ++ continue; ++ } ++ ++ usb_ep_disable (ep); ++ result = -EIO; ++ } ++ } ++ ++ } ++ ++ dev->config = number; ++ return result; ++} ++ ++/*-------------------------------------------------------------------------*/ ++ ++static void zero_setup_complete (struct usb_ep *ep, struct usb_request *req) ++{ ++ if (req->status || req->actual != req->length) ++ DBG ((struct zero_dev *) ep->driver_data, ++ "setup complete --> %d, %d/%d\n", ++ req->status, req->actual, req->length); ++} ++ ++/* ++ * The setup() callback implements all the ep0 functionality that's ++ * not handled lower down, in hardware or the hardware driver (like ++ * device and endpoint feature flags, and their status). It's all ++ * housekeeping for the gadget function we're implementing. Most of ++ * the work is in config-specific setup. ++ */ ++static int ++zero_setup (struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl) ++{ ++ struct zero_dev *dev = get_gadget_data (gadget); ++ struct usb_request *req = dev->req; ++ int value = -EOPNOTSUPP; ++ ++ /* usually this stores reply data in the pre-allocated ep0 buffer, ++ * but config change events will reconfigure hardware. ++ */ ++ req->zero = 0; ++ switch (ctrl->bRequest) { ++ ++ case USB_REQ_GET_DESCRIPTOR: ++ ++ switch (ctrl->wValue >> 8) { ++ ++ case USB_DT_DEVICE: ++ value = min (ctrl->wLength, (u16) sizeof device_desc); ++ memcpy (req->buf, &device_desc, value); ++ break; ++#ifdef CONFIG_USB_GADGET_DUALSPEED ++ case USB_DT_DEVICE_QUALIFIER: ++ if (!gadget->is_dualspeed) ++ break; ++ value = min (ctrl->wLength, (u16) sizeof dev_qualifier); ++ memcpy (req->buf, &dev_qualifier, value); ++ break; ++ ++ case USB_DT_OTHER_SPEED_CONFIG: ++ if (!gadget->is_dualspeed) ++ break; ++ // FALLTHROUGH ++#endif /* CONFIG_USB_GADGET_DUALSPEED */ ++ case USB_DT_CONFIG: ++ value = config_buf (gadget, req->buf, ++ ctrl->wValue >> 8, ++ ctrl->wValue & 0xff); ++ if (value >= 0) ++ value = min (ctrl->wLength, (u16) value); ++ break; ++ ++ case USB_DT_STRING: ++ /* wIndex == language code. ++ * this driver only handles one language, you can ++ * add string tables for other languages, using ++ * any UTF-8 characters ++ */ ++ value = usb_gadget_get_string (&stringtab, ++ ctrl->wValue & 0xff, req->buf); ++ if (value >= 0) { ++ value = min (ctrl->wLength, (u16) value); ++ } ++ break; ++ } ++ break; ++ ++ /* currently two configs, two speeds */ ++ case USB_REQ_SET_CONFIGURATION: ++ if (ctrl->bRequestType != 0) ++ goto unknown; ++ ++ spin_lock (&dev->lock); ++ value = zero_set_config (dev, ctrl->wValue, GFP_ATOMIC); ++ spin_unlock (&dev->lock); ++ break; ++ case USB_REQ_GET_CONFIGURATION: ++ if (ctrl->bRequestType != USB_DIR_IN) ++ goto unknown; ++ *(u8 *)req->buf = dev->config; ++ value = min (ctrl->wLength, (u16) 1); ++ break; ++ ++ /* until we add altsetting support, or other interfaces, ++ * only 0/0 are possible. pxa2xx only supports 0/0 (poorly) ++ * and already killed pending endpoint I/O. ++ */ ++ case USB_REQ_SET_INTERFACE: ++ ++ if (ctrl->bRequestType != USB_RECIP_INTERFACE) ++ goto unknown; ++ spin_lock (&dev->lock); ++ if (dev->config) { ++ u8 config = dev->config; ++ ++ /* resets interface configuration, forgets about ++ * previous transaction state (queued bufs, etc) ++ * and re-inits endpoint state (toggle etc) ++ * no response queued, just zero status == success. ++ * if we had more than one interface we couldn't ++ * use this "reset the config" shortcut. ++ */ ++ zero_reset_config (dev); ++ zero_set_config (dev, config, GFP_ATOMIC); ++ value = 0; ++ } ++ spin_unlock (&dev->lock); ++ break; ++ case USB_REQ_GET_INTERFACE: ++ if ((ctrl->bRequestType == 0x21) && (ctrl->wIndex == 0x02)) { ++ value = ctrl->wLength; ++ break; ++ } ++ else { ++ if (ctrl->bRequestType != (USB_DIR_IN|USB_RECIP_INTERFACE)) ++ goto unknown; ++ if (!dev->config) ++ break; ++ if (ctrl->wIndex != 0) { ++ value = -EDOM; ++ break; ++ } ++ *(u8 *)req->buf = 0; ++ value = min (ctrl->wLength, (u16) 1); ++ } ++ break; ++ ++ /* ++ * These are the same vendor-specific requests supported by ++ * Intel's USB 2.0 compliance test devices. We exceed that ++ * device spec by allowing multiple-packet requests. ++ */ ++ case 0x5b: /* control WRITE test -- fill the buffer */ ++ if (ctrl->bRequestType != (USB_DIR_OUT|USB_TYPE_VENDOR)) ++ goto unknown; ++ if (ctrl->wValue || ctrl->wIndex) ++ break; ++ /* just read that many bytes into the buffer */ ++ if (ctrl->wLength > USB_BUFSIZ) ++ break; ++ value = ctrl->wLength; ++ break; ++ case 0x5c: /* control READ test -- return the buffer */ ++ if (ctrl->bRequestType != (USB_DIR_IN|USB_TYPE_VENDOR)) ++ goto unknown; ++ if (ctrl->wValue || ctrl->wIndex) ++ break; ++ /* expect those bytes are still in the buffer; send back */ ++ if (ctrl->wLength > USB_BUFSIZ ++ || ctrl->wLength != req->length) ++ break; ++ value = ctrl->wLength; ++ break; ++ ++ case 0x01: // SET_CUR ++ case 0x02: ++ case 0x03: ++ case 0x04: ++ case 0x05: ++ value = ctrl->wLength; ++ break; ++ case 0x81: ++ switch (ctrl->wValue) { ++ case 0x0201: ++ case 0x0202: ++ ((u8*)req->buf)[0] = 0x00; ++ ((u8*)req->buf)[1] = 0xe3; ++ break; ++ case 0x0300: ++ case 0x0500: ++ ((u8*)req->buf)[0] = 0x00; ++ break; ++ } ++ //((u8*)req->buf)[0] = 0x81; ++ //((u8*)req->buf)[1] = 0x81; ++ value = ctrl->wLength; ++ break; ++ case 0x82: ++ switch (ctrl->wValue) { ++ case 0x0201: ++ case 0x0202: ++ ((u8*)req->buf)[0] = 0x00; ++ ((u8*)req->buf)[1] = 0xc3; ++ break; ++ case 0x0300: ++ case 0x0500: ++ ((u8*)req->buf)[0] = 0x00; ++ break; ++ } ++ //((u8*)req->buf)[0] = 0x82; ++ //((u8*)req->buf)[1] = 0x82; ++ value = ctrl->wLength; ++ break; ++ case 0x83: ++ switch (ctrl->wValue) { ++ case 0x0201: ++ case 0x0202: ++ ((u8*)req->buf)[0] = 0x00; ++ ((u8*)req->buf)[1] = 0x00; ++ break; ++ case 0x0300: ++ ((u8*)req->buf)[0] = 0x60; ++ break; ++ case 0x0500: ++ ((u8*)req->buf)[0] = 0x18; ++ break; ++ } ++ //((u8*)req->buf)[0] = 0x83; ++ //((u8*)req->buf)[1] = 0x83; ++ value = ctrl->wLength; ++ break; ++ case 0x84: ++ switch (ctrl->wValue) { ++ case 0x0201: ++ case 0x0202: ++ ((u8*)req->buf)[0] = 0x00; ++ ((u8*)req->buf)[1] = 0x01; ++ break; ++ case 0x0300: ++ case 0x0500: ++ ((u8*)req->buf)[0] = 0x08; ++ break; ++ } ++ //((u8*)req->buf)[0] = 0x84; ++ //((u8*)req->buf)[1] = 0x84; ++ value = ctrl->wLength; ++ break; ++ case 0x85: ++ ((u8*)req->buf)[0] = 0x85; ++ ((u8*)req->buf)[1] = 0x85; ++ value = ctrl->wLength; ++ break; ++ ++ ++ default: ++unknown: ++ printk("unknown control req%02x.%02x v%04x i%04x l%d\n", ++ ctrl->bRequestType, ctrl->bRequest, ++ ctrl->wValue, ctrl->wIndex, ctrl->wLength); ++ } ++ ++ /* respond with data transfer before status phase? */ ++ if (value >= 0) { ++ req->length = value; ++ req->zero = value < ctrl->wLength ++ && (value % gadget->ep0->maxpacket) == 0; ++ value = usb_ep_queue (gadget->ep0, req, GFP_ATOMIC); ++ if (value < 0) { ++ DBG (dev, "ep_queue < 0 --> %d\n", value); ++ req->status = 0; ++ zero_setup_complete (gadget->ep0, req); ++ } ++ } ++ ++ /* device either stalls (value < 0) or reports success */ ++ return value; ++} ++ ++static void ++zero_disconnect (struct usb_gadget *gadget) ++{ ++ struct zero_dev *dev = get_gadget_data (gadget); ++ unsigned long flags; ++ ++ spin_lock_irqsave (&dev->lock, flags); ++ zero_reset_config (dev); ++ ++ /* a more significant application might have some non-usb ++ * activities to quiesce here, saving resources like power ++ * or pushing the notification up a network stack. ++ */ ++ spin_unlock_irqrestore (&dev->lock, flags); ++ ++ /* next we may get setup() calls to enumerate new connections; ++ * or an unbind() during shutdown (including removing module). ++ */ ++} ++ ++static void ++zero_autoresume (unsigned long _dev) ++{ ++ struct zero_dev *dev = (struct zero_dev *) _dev; ++ int status; ++ ++ /* normally the host would be woken up for something ++ * more significant than just a timer firing... ++ */ ++ if (dev->gadget->speed != USB_SPEED_UNKNOWN) { ++ status = usb_gadget_wakeup (dev->gadget); ++ DBG (dev, "wakeup --> %d\n", status); ++ } ++} ++ ++/*-------------------------------------------------------------------------*/ ++ ++static void ++zero_unbind (struct usb_gadget *gadget) ++{ ++ struct zero_dev *dev = get_gadget_data (gadget); ++ ++ DBG (dev, "unbind\n"); ++ ++ /* we've already been disconnected ... no i/o is active */ ++ if (dev->req) ++ free_ep_req (gadget->ep0, dev->req); ++ del_timer_sync (&dev->resume); ++ kfree (dev); ++ set_gadget_data (gadget, NULL); ++} ++ ++static int ++zero_bind (struct usb_gadget *gadget) ++{ ++ struct zero_dev *dev; ++ //struct usb_ep *ep; ++ ++ printk("binding\n"); ++ /* ++ * DRIVER POLICY CHOICE: you may want to do this differently. ++ * One thing to avoid is reusing a bcdDevice revision code ++ * with different host-visible configurations or behavior ++ * restrictions -- using ep1in/ep2out vs ep1out/ep3in, etc ++ */ ++ //device_desc.bcdDevice = __constant_cpu_to_le16 (0x0201); ++ ++ ++ /* ok, we made sense of the hardware ... */ ++ dev = kmalloc (sizeof *dev, SLAB_KERNEL); ++ if (!dev) ++ return -ENOMEM; ++ memset (dev, 0, sizeof *dev); ++ spin_lock_init (&dev->lock); ++ dev->gadget = gadget; ++ set_gadget_data (gadget, dev); ++ ++ /* preallocate control response and buffer */ ++ dev->req = usb_ep_alloc_request (gadget->ep0, GFP_KERNEL); ++ if (!dev->req) ++ goto enomem; ++ dev->req->buf = usb_ep_alloc_buffer (gadget->ep0, USB_BUFSIZ, ++ &dev->req->dma, GFP_KERNEL); ++ if (!dev->req->buf) ++ goto enomem; ++ ++ dev->req->complete = zero_setup_complete; ++ ++ device_desc.bMaxPacketSize0 = gadget->ep0->maxpacket; ++ ++#ifdef CONFIG_USB_GADGET_DUALSPEED ++ /* assume ep0 uses the same value for both speeds ... */ ++ dev_qualifier.bMaxPacketSize0 = device_desc.bMaxPacketSize0; ++ ++ /* and that all endpoints are dual-speed */ ++ //hs_source_desc.bEndpointAddress = fs_source_desc.bEndpointAddress; ++ //hs_sink_desc.bEndpointAddress = fs_sink_desc.bEndpointAddress; ++#endif ++ ++ usb_gadget_set_selfpowered (gadget); ++ ++ init_timer (&dev->resume); ++ dev->resume.function = zero_autoresume; ++ dev->resume.data = (unsigned long) dev; ++ ++ gadget->ep0->driver_data = dev; ++ ++ INFO (dev, "%s, version: " DRIVER_VERSION "\n", longname); ++ INFO (dev, "using %s, OUT %s IN %s\n", gadget->name, ++ EP_OUT_NAME, EP_IN_NAME); ++ ++ snprintf (manufacturer, sizeof manufacturer, ++ UTS_SYSNAME " " UTS_RELEASE " with %s", ++ gadget->name); ++ ++ return 0; ++ ++enomem: ++ zero_unbind (gadget); ++ return -ENOMEM; ++} ++ ++/*-------------------------------------------------------------------------*/ ++ ++static void ++zero_suspend (struct usb_gadget *gadget) ++{ ++ struct zero_dev *dev = get_gadget_data (gadget); ++ ++ if (gadget->speed == USB_SPEED_UNKNOWN) ++ return; ++ ++ if (autoresume) { ++ mod_timer (&dev->resume, jiffies + (HZ * autoresume)); ++ DBG (dev, "suspend, wakeup in %d seconds\n", autoresume); ++ } else ++ DBG (dev, "suspend\n"); ++} ++ ++static void ++zero_resume (struct usb_gadget *gadget) ++{ ++ struct zero_dev *dev = get_gadget_data (gadget); ++ ++ DBG (dev, "resume\n"); ++ del_timer (&dev->resume); ++} ++ ++ ++/*-------------------------------------------------------------------------*/ ++ ++static struct usb_gadget_driver zero_driver = { ++#ifdef CONFIG_USB_GADGET_DUALSPEED ++ .speed = USB_SPEED_HIGH, ++#else ++ .speed = USB_SPEED_FULL, ++#endif ++ .function = (char *) longname, ++ .bind = zero_bind, ++ .unbind = zero_unbind, ++ ++ .setup = zero_setup, ++ .disconnect = zero_disconnect, ++ ++ .suspend = zero_suspend, ++ .resume = zero_resume, ++ ++ .driver = { ++ .name = (char *) shortname, ++ // .shutdown = ... ++ // .suspend = ... ++ // .resume = ... ++ }, ++}; ++ ++MODULE_AUTHOR ("David Brownell"); ++MODULE_LICENSE ("Dual BSD/GPL"); ++ ++static struct proc_dir_entry *pdir, *pfile; ++ ++static int isoc_read_data (char *page, char **start, ++ off_t off, int count, ++ int *eof, void *data) ++{ ++ int i; ++ static int c = 0; ++ static int done = 0; ++ static int s = 0; ++ ++/* ++ printk ("\ncount: %d\n", count); ++ printk ("rbuf_start: %d\n", rbuf_start); ++ printk ("rbuf_len: %d\n", rbuf_len); ++ printk ("off: %d\n", off); ++ printk ("start: %p\n\n", *start); ++*/ ++ if (done) { ++ c = 0; ++ done = 0; ++ *eof = 1; ++ return 0; ++ } ++ ++ if (c == 0) { ++ if (rbuf_len == RBUF_LEN) ++ s = rbuf_start; ++ else s = 0; ++ } ++ ++ for (i=0; i<count && c<rbuf_len; i++, c++) { ++ page[i] = rbuf[(c+s) % RBUF_LEN]; ++ } ++ *start = page; ++ ++ if (c >= rbuf_len) { ++ *eof = 1; ++ done = 1; ++ } ++ ++ ++ return i; ++} ++ ++static int __init init (void) ++{ ++ ++ int retval = 0; ++ ++ pdir = proc_mkdir("isoc_test", NULL); ++ if(pdir == NULL) { ++ retval = -ENOMEM; ++ printk("Error creating dir\n"); ++ goto done; ++ } ++ pdir->owner = THIS_MODULE; ++ ++ pfile = create_proc_read_entry("isoc_data", ++ 0444, pdir, ++ isoc_read_data, ++ NULL); ++ if (pfile == NULL) { ++ retval = -ENOMEM; ++ printk("Error creating file\n"); ++ goto no_file; ++ } ++ pfile->owner = THIS_MODULE; ++ ++ return usb_gadget_register_driver (&zero_driver); ++ ++ no_file: ++ remove_proc_entry("isoc_data", NULL); ++ done: ++ return retval; ++} ++module_init (init); ++ ++static void __exit cleanup (void) ++{ ++ ++ usb_gadget_unregister_driver (&zero_driver); ++ ++ remove_proc_entry("isoc_data", pdir); ++ remove_proc_entry("isoc_test", NULL); ++} ++module_exit (cleanup); +diff --git a/drivers/usb/host/dwc_otg/dwc_cfi_common.h b/drivers/usb/host/dwc_otg/dwc_cfi_common.h +new file mode 100644 +index 0000000..7770e20 +--- /dev/null ++++ b/drivers/usb/host/dwc_otg/dwc_cfi_common.h +@@ -0,0 +1,142 @@ ++/* ========================================================================== ++ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, ++ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless ++ * otherwise expressly agreed to in writing between Synopsys and you. ++ * ++ * The Software IS NOT an item of Licensed Software or Licensed Product under ++ * any End User Software License Agreement or Agreement for Licensed Product ++ * with Synopsys or any supplement thereto. You are permitted to use and ++ * redistribute this Software in source and binary forms, with or without ++ * modification, provided that redistributions of source code must retain this ++ * notice. You may not view, use, disclose, copy or distribute this file or ++ * any information contained herein except pursuant to this license grant from ++ * Synopsys. If you do not agree with this notice, including the disclaimer ++ * below, then you are not authorized to use the Software. ++ * ++ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS ++ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS 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. ++ * ========================================================================== */ ++ ++#if !defined(__DWC_CFI_COMMON_H__) ++#define __DWC_CFI_COMMON_H__ ++ ++//#include <linux/types.h> ++ ++/** ++ * @file ++ * ++ * This file contains the CFI specific common constants, interfaces ++ * (functions and macros) and structures for Linux. No PCD specific ++ * data structure or definition is to be included in this file. ++ * ++ */ ++ ++/** This is a request for all Core Features */ ++#define VEN_CORE_GET_FEATURES 0xB1 ++ ++/** This is a request to get the value of a specific Core Feature */ ++#define VEN_CORE_GET_FEATURE 0xB2 ++ ++/** This command allows the host to set the value of a specific Core Feature */ ++#define VEN_CORE_SET_FEATURE 0xB3 ++ ++/** This command allows the host to set the default values of ++ * either all or any specific Core Feature ++ */ ++#define VEN_CORE_RESET_FEATURES 0xB4 ++ ++/** This command forces the PCD to write the deferred values of a Core Features */ ++#define VEN_CORE_ACTIVATE_FEATURES 0xB5 ++ ++/** This request reads a DWORD value from a register at the specified offset */ ++#define VEN_CORE_READ_REGISTER 0xB6 ++ ++/** This request writes a DWORD value into a register at the specified offset */ ++#define VEN_CORE_WRITE_REGISTER 0xB7 ++ ++/** This structure is the header of the Core Features dataset returned to ++ * the Host ++ */ ++struct cfi_all_features_header { ++/** The features header structure length is */ ++#define CFI_ALL_FEATURES_HDR_LEN 8 ++ /** ++ * The total length of the features dataset returned to the Host ++ */ ++ uint16_t wTotalLen; ++ ++ /** ++ * CFI version number inBinary-Coded Decimal (i.e., 1.00 is 100H). ++ * This field identifies the version of the CFI Specification with which ++ * the device is compliant. ++ */ ++ uint16_t wVersion; ++ ++ /** The ID of the Core */ ++ uint16_t wCoreID; ++#define CFI_CORE_ID_UDC 1 ++#define CFI_CORE_ID_OTG 2 ++#define CFI_CORE_ID_WUDEV 3 ++ ++ /** Number of features returned by VEN_CORE_GET_FEATURES request */ ++ uint16_t wNumFeatures; ++} UPACKED; ++ ++typedef struct cfi_all_features_header cfi_all_features_header_t; ++ ++/** This structure is a header of the Core Feature descriptor dataset returned to ++ * the Host after the VEN_CORE_GET_FEATURES request ++ */ ++struct cfi_feature_desc_header { ++#define CFI_FEATURE_DESC_HDR_LEN 8 ++ ++ /** The feature ID */ ++ uint16_t wFeatureID; ++ ++ /** Length of this feature descriptor in bytes - including the ++ * length of the feature name string ++ */ ++ uint16_t wLength; ++ ++ /** The data length of this feature in bytes */ ++ uint16_t wDataLength; ++ ++ /** ++ * Attributes of this features ++ * D0: Access rights ++ * 0 - Read/Write ++ * 1 - Read only ++ */ ++ uint8_t bmAttributes; ++#define CFI_FEATURE_ATTR_RO 1 ++#define CFI_FEATURE_ATTR_RW 0 ++ ++ /** Length of the feature name in bytes */ ++ uint8_t bNameLen; ++ ++ /** The feature name buffer */ ++ //uint8_t *name; ++} UPACKED; ++ ++typedef struct cfi_feature_desc_header cfi_feature_desc_header_t; ++ ++/** ++ * This structure describes a NULL terminated string referenced by its id field. ++ * It is very similar to usb_string structure but has the id field type set to 16-bit. ++ */ ++struct cfi_string { ++ uint16_t id; ++ const uint8_t *s; ++}; ++typedef struct cfi_string cfi_string_t; ++ ++#endif +diff --git a/drivers/usb/host/dwc_otg/dwc_otg_adp.c b/drivers/usb/host/dwc_otg/dwc_otg_adp.c +new file mode 100644 +index 0000000..ce0618d +--- /dev/null ++++ b/drivers/usb/host/dwc_otg/dwc_otg_adp.c +@@ -0,0 +1,854 @@ ++/* ========================================================================== ++ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_adp.c $ ++ * $Revision: #12 $ ++ * $Date: 2011/10/26 $ ++ * $Change: 1873028 $ ++ * ++ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, ++ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless ++ * otherwise expressly agreed to in writing between Synopsys and you. ++ * ++ * The Software IS NOT an item of Licensed Software or Licensed Product under ++ * any End User Software License Agreement or Agreement for Licensed Product ++ * with Synopsys or any supplement thereto. You are permitted to use and ++ * redistribute this Software in source and binary forms, with or without ++ * modification, provided that redistributions of source code must retain this ++ * notice. You may not view, use, disclose, copy or distribute this file or ++ * any information contained herein except pursuant to this license grant from ++ * Synopsys. If you do not agree with this notice, including the disclaimer ++ * below, then you are not authorized to use the Software. ++ * ++ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS ++ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS BE LIABLE FOR ANY DIRECT, ++ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ++ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR ++ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER ++ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT ++ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY ++ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH ++ * DAMAGE. ++ * ========================================================================== */ ++ ++#include "dwc_os.h" ++#include "dwc_otg_regs.h" ++#include "dwc_otg_cil.h" ++#include "dwc_otg_adp.h" ++ ++/** @file ++ * ++ * This file contains the most of the Attach Detect Protocol implementation for ++ * the driver to support OTG Rev2.0. ++ * ++ */ ++ ++void dwc_otg_adp_write_reg(dwc_otg_core_if_t * core_if, uint32_t value) ++{ ++ adpctl_data_t adpctl; ++ ++ adpctl.d32 = value; ++ adpctl.b.ar = 0x2; ++ ++ DWC_WRITE_REG32(&core_if->core_global_regs->adpctl, adpctl.d32); ++ ++ while (adpctl.b.ar) { ++ adpctl.d32 = DWC_READ_REG32(&core_if->core_global_regs->adpctl); ++ } ++ ++} ++ ++/** ++ * Function is called to read ADP registers ++ */ ++uint32_t dwc_otg_adp_read_reg(dwc_otg_core_if_t * core_if) ++{ ++ adpctl_data_t adpctl; ++ ++ adpctl.d32 = 0; ++ adpctl.b.ar = 0x1; ++ ++ DWC_WRITE_REG32(&core_if->core_global_regs->adpctl, adpctl.d32); ++ ++ while (adpctl.b.ar) { ++ adpctl.d32 = DWC_READ_REG32(&core_if->core_global_regs->adpctl); ++ } ++ ++ return adpctl.d32; ++} ++ ++/** ++ * Function is called to read ADPCTL register and filter Write-clear bits ++ */ ++uint32_t dwc_otg_adp_read_reg_filter(dwc_otg_core_if_t * core_if) ++{ ++ adpctl_data_t adpctl; ++ ++ adpctl.d32 = dwc_otg_adp_read_reg(core_if); ++ adpctl.b.adp_tmout_int = 0; ++ adpctl.b.adp_prb_int = 0; ++ adpctl.b.adp_tmout_int = 0; ++ ++ return adpctl.d32; ++} ++ ++/** ++ * Function is called to write ADP registers ++ */ ++void dwc_otg_adp_modify_reg(dwc_otg_core_if_t * core_if, uint32_t clr, ++ uint32_t set) ++{ ++ dwc_otg_adp_write_reg(core_if, ++ (dwc_otg_adp_read_reg(core_if) & (~clr)) | set); ++} ++ ++static void adp_sense_timeout(void *ptr) ++{ ++ dwc_otg_core_if_t *core_if = (dwc_otg_core_if_t *) ptr; ++ core_if->adp.sense_timer_started = 0; ++ DWC_PRINTF("ADP SENSE TIMEOUT\n"); ++ if (core_if->adp_enable) { ++ dwc_otg_adp_sense_stop(core_if); ++ dwc_otg_adp_probe_start(core_if); ++ } ++} ++ ++/** ++ * This function is called when the ADP vbus timer expires. Timeout is 1.1s. ++ */ ++static void adp_vbuson_timeout(void *ptr) ++{ ++ gpwrdn_data_t gpwrdn; ++ dwc_otg_core_if_t *core_if = (dwc_otg_core_if_t *) ptr; ++ hprt0_data_t hprt0 = {.d32 = 0 }; ++ pcgcctl_data_t pcgcctl = {.d32 = 0 }; ++ DWC_PRINTF("%s: 1.1 seconds expire after turning on VBUS\n",__FUNCTION__); ++ if (core_if) { ++ core_if->adp.vbuson_timer_started = 0; ++ /* Turn off vbus */ ++ hprt0.b.prtpwr = 1; ++ DWC_MODIFY_REG32(core_if->host_if->hprt0, hprt0.d32, 0); ++ gpwrdn.d32 = 0; ++ ++ /* Power off the core */ ++ if (core_if->power_down == 2) { ++ /* Enable Wakeup Logic */ ++// gpwrdn.b.wkupactiv = 1; ++ gpwrdn.b.pmuactv = 0; ++ gpwrdn.b.pwrdnrstn = 1; ++ gpwrdn.b.pwrdnclmp = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, 0, ++ gpwrdn.d32); ++ ++ /* Suspend the Phy Clock */ ++ pcgcctl.b.stoppclk = 1; ++ DWC_MODIFY_REG32(core_if->pcgcctl, 0, pcgcctl.d32); ++ ++ /* Switch on VDD */ ++// gpwrdn.b.wkupactiv = 1; ++ gpwrdn.b.pmuactv = 1; ++ gpwrdn.b.pwrdnrstn = 1; ++ gpwrdn.b.pwrdnclmp = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, 0, ++ gpwrdn.d32); ++ } else { ++ /* Enable Power Down Logic */ ++ gpwrdn.b.pmuintsel = 1; ++ gpwrdn.b.pmuactv = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, 0, gpwrdn.d32); ++ } ++ ++ /* Power off the core */ ++ if (core_if->power_down == 2) { ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pwrdnswtch = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, ++ gpwrdn.d32, 0); ++ } ++ ++ /* Unmask SRP detected interrupt from Power Down Logic */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.srp_det_msk = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, 0, gpwrdn.d32); ++ ++ dwc_otg_adp_probe_start(core_if); ++ dwc_otg_dump_global_registers(core_if); ++ dwc_otg_dump_host_registers(core_if); ++ } ++ ++} ++ ++/** ++ * Start the ADP Initial Probe timer to detect if Port Connected interrupt is ++ * not asserted within 1.1 seconds. ++ * ++ * @param core_if the pointer to core_if strucure. ++ */ ++void dwc_otg_adp_vbuson_timer_start(dwc_otg_core_if_t * core_if) ++{ ++ core_if->adp.vbuson_timer_started = 1; ++ if (core_if->adp.vbuson_timer) ++ { ++ DWC_PRINTF("SCHEDULING VBUSON TIMER\n"); ++ /* 1.1 secs + 60ms necessary for cil_hcd_start*/ ++ DWC_TIMER_SCHEDULE(core_if->adp.vbuson_timer, 1160); ++ } else { ++ DWC_WARN("VBUSON_TIMER = %p\n",core_if->adp.vbuson_timer); ++ } ++} ++ ++#if 0 ++/** ++ * Masks all DWC OTG core interrupts ++ * ++ */ ++static void mask_all_interrupts(dwc_otg_core_if_t * core_if) ++{ ++ int i; ++ gahbcfg_data_t ahbcfg = {.d32 = 0 }; ++ ++ /* Mask Host Interrupts */ ++ ++ /* Clear and disable HCINTs */ ++ for (i = 0; i < core_if->core_params->host_channels; i++) { ++ DWC_WRITE_REG32(&core_if->host_if->hc_regs[i]->hcintmsk, 0); ++ DWC_WRITE_REG32(&core_if->host_if->hc_regs[i]->hcint, 0xFFFFFFFF); ++ ++ } ++ ++ /* Clear and disable HAINT */ ++ DWC_WRITE_REG32(&core_if->host_if->host_global_regs->haintmsk, 0x0000); ++ DWC_WRITE_REG32(&core_if->host_if->host_global_regs->haint, 0xFFFFFFFF); ++ ++ /* Mask Device Interrupts */ ++ if (!core_if->multiproc_int_enable) { ++ /* Clear and disable IN Endpoint interrupts */ ++ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->diepmsk, 0); ++ for (i = 0; i <= core_if->dev_if->num_in_eps; i++) { ++ DWC_WRITE_REG32(&core_if->dev_if->in_ep_regs[i]-> ++ diepint, 0xFFFFFFFF); ++ } ++ ++ /* Clear and disable OUT Endpoint interrupts */ ++ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->doepmsk, 0); ++ for (i = 0; i <= core_if->dev_if->num_out_eps; i++) { ++ DWC_WRITE_REG32(&core_if->dev_if->out_ep_regs[i]-> ++ doepint, 0xFFFFFFFF); ++ } ++ ++ /* Clear and disable DAINT */ ++ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->daint, ++ 0xFFFFFFFF); ++ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->daintmsk, 0); ++ } else { ++ for (i = 0; i < core_if->dev_if->num_in_eps; ++i) { ++ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs-> ++ diepeachintmsk[i], 0); ++ DWC_WRITE_REG32(&core_if->dev_if->in_ep_regs[i]-> ++ diepint, 0xFFFFFFFF); ++ } ++ ++ for (i = 0; i < core_if->dev_if->num_out_eps; ++i) { ++ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs-> ++ doepeachintmsk[i], 0); ++ DWC_WRITE_REG32(&core_if->dev_if->out_ep_regs[i]-> ++ doepint, 0xFFFFFFFF); ++ } ++ ++ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->deachintmsk, ++ 0); ++ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->deachint, ++ 0xFFFFFFFF); ++ ++ } ++ ++ /* Disable interrupts */ ++ ahbcfg.b.glblintrmsk = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gahbcfg, ahbcfg.d32, 0); ++ ++ /* Disable all interrupts. */ ++ DWC_WRITE_REG32(&core_if->core_global_regs->gintmsk, 0); ++ ++ /* Clear any pending interrupts */ ++ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, 0xFFFFFFFF); ++ ++ /* Clear any pending OTG Interrupts */ ++ DWC_WRITE_REG32(&core_if->core_global_regs->gotgint, 0xFFFFFFFF); ++} ++ ++/** ++ * Unmask Port Connection Detected interrupt ++ * ++ */ ++static void unmask_conn_det_intr(dwc_otg_core_if_t * core_if) ++{ ++ gintmsk_data_t gintmsk = {.d32 = 0,.b.portintr = 1 }; ++ ++ DWC_WRITE_REG32(&core_if->core_global_regs->gintmsk, gintmsk.d32); ++} ++#endif ++ ++/** ++ * Starts the ADP Probing ++ * ++ * @param core_if the pointer to core_if structure. ++ */ ++uint32_t dwc_otg_adp_probe_start(dwc_otg_core_if_t * core_if) ++{ ++ ++ adpctl_data_t adpctl = {.d32 = 0}; ++ gpwrdn_data_t gpwrdn; ++#if 0 ++ adpctl_data_t adpctl_int = {.d32 = 0, .b.adp_prb_int = 1, ++ .b.adp_sns_int = 1, b.adp_tmout_int}; ++#endif ++ dwc_otg_disable_global_interrupts(core_if); ++ DWC_PRINTF("ADP Probe Start\n"); ++ core_if->adp.probe_enabled = 1; ++ ++ adpctl.b.adpres = 1; ++ dwc_otg_adp_write_reg(core_if, adpctl.d32); ++ ++ while (adpctl.b.adpres) { ++ adpctl.d32 = dwc_otg_adp_read_reg(core_if); ++ } ++ ++ adpctl.d32 = 0; ++ gpwrdn.d32 = DWC_READ_REG32(&core_if->core_global_regs->gpwrdn); ++ ++ /* In Host mode unmask SRP detected interrupt */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.sts_chngint_msk = 1; ++ if (!gpwrdn.b.idsts) { ++ gpwrdn.b.srp_det_msk = 1; ++ } ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, 0, gpwrdn.d32); ++ ++ adpctl.b.adp_tmout_int_msk = 1; ++ adpctl.b.adp_prb_int_msk = 1; ++ adpctl.b.prb_dschg = 1; ++ adpctl.b.prb_delta = 1; ++ adpctl.b.prb_per = 1; ++ adpctl.b.adpen = 1; ++ adpctl.b.enaprb = 1; ++ ++ dwc_otg_adp_write_reg(core_if, adpctl.d32); ++ DWC_PRINTF("ADP Probe Finish\n"); ++ return 0; ++} ++ ++/** ++ * Starts the ADP Sense timer to detect if ADP Sense interrupt is not asserted ++ * within 3 seconds. ++ * ++ * @param core_if the pointer to core_if strucure. ++ */ ++void dwc_otg_adp_sense_timer_start(dwc_otg_core_if_t * core_if) ++{ ++ core_if->adp.sense_timer_started = 1; ++ DWC_TIMER_SCHEDULE(core_if->adp.sense_timer, 3000 /* 3 secs */ ); ++} ++ ++/** ++ * Starts the ADP Sense ++ * ++ * @param core_if the pointer to core_if strucure. ++ */ ++uint32_t dwc_otg_adp_sense_start(dwc_otg_core_if_t * core_if) ++{ ++ adpctl_data_t adpctl; ++ ++ DWC_PRINTF("ADP Sense Start\n"); ++ ++ /* Unmask ADP sense interrupt and mask all other from the core */ ++ adpctl.d32 = dwc_otg_adp_read_reg_filter(core_if); ++ adpctl.b.adp_sns_int_msk = 1; ++ dwc_otg_adp_write_reg(core_if, adpctl.d32); ++ dwc_otg_disable_global_interrupts(core_if); // vahrama ++ ++ /* Set ADP reset bit*/ ++ adpctl.d32 = dwc_otg_adp_read_reg_filter(core_if); ++ adpctl.b.adpres = 1; ++ dwc_otg_adp_write_reg(core_if, adpctl.d32); ++ ++ while (adpctl.b.adpres) { ++ adpctl.d32 = dwc_otg_adp_read_reg(core_if); ++ } ++ ++ adpctl.b.adpres = 0; ++ adpctl.b.adpen = 1; ++ adpctl.b.enasns = 1; ++ dwc_otg_adp_write_reg(core_if, adpctl.d32); ++ ++ dwc_otg_adp_sense_timer_start(core_if); ++ ++ return 0; ++} ++ ++/** ++ * Stops the ADP Probing ++ * ++ * @param core_if the pointer to core_if strucure. ++ */ ++uint32_t dwc_otg_adp_probe_stop(dwc_otg_core_if_t * core_if) ++{ ++ ++ adpctl_data_t adpctl; ++ DWC_PRINTF("Stop ADP probe\n"); ++ core_if->adp.probe_enabled = 0; ++ core_if->adp.probe_counter = 0; ++ adpctl.d32 = dwc_otg_adp_read_reg(core_if); ++ ++ adpctl.b.adpen = 0; ++ adpctl.b.adp_prb_int = 1; ++ adpctl.b.adp_tmout_int = 1; ++ adpctl.b.adp_sns_int = 1; ++ dwc_otg_adp_write_reg(core_if, adpctl.d32); ++ ++ return 0; ++} ++ ++/** ++ * Stops the ADP Sensing ++ * ++ * @param core_if the pointer to core_if strucure. ++ */ ++uint32_t dwc_otg_adp_sense_stop(dwc_otg_core_if_t * core_if) ++{ ++ adpctl_data_t adpctl; ++ ++ core_if->adp.sense_enabled = 0; ++ ++ adpctl.d32 = dwc_otg_adp_read_reg_filter(core_if); ++ adpctl.b.enasns = 0; ++ adpctl.b.adp_sns_int = 1; ++ dwc_otg_adp_write_reg(core_if, adpctl.d32); ++ ++ return 0; ++} ++ ++/** ++ * Called to turn on the VBUS after initial ADP probe in host mode. ++ * If port power was already enabled in cil_hcd_start function then ++ * only schedule a timer. ++ * ++ * @param core_if the pointer to core_if structure. ++ */ ++void dwc_otg_adp_turnon_vbus(dwc_otg_core_if_t * core_if) ++{ ++ hprt0_data_t hprt0 = {.d32 = 0 }; ++ hprt0.d32 = dwc_otg_read_hprt0(core_if); ++ DWC_PRINTF("Turn on VBUS for 1.1s, port power is %d\n", hprt0.b.prtpwr); ++ ++ if (hprt0.b.prtpwr == 0) { ++ hprt0.b.prtpwr = 1; ++ //DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); ++ } ++ ++ dwc_otg_adp_vbuson_timer_start(core_if); ++} ++ ++/** ++ * Called right after driver is loaded ++ * to perform initial actions for ADP ++ * ++ * @param core_if the pointer to core_if structure. ++ * @param is_host - flag for current mode of operation either from GINTSTS or GPWRDN ++ */ ++void dwc_otg_adp_start(dwc_otg_core_if_t * core_if, uint8_t is_host) ++{ ++ gpwrdn_data_t gpwrdn; ++ ++ DWC_PRINTF("ADP Initial Start\n"); ++ core_if->adp.adp_started = 1; ++ ++ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, 0xFFFFFFFF); ++ dwc_otg_disable_global_interrupts(core_if); ++ if (is_host) { ++ DWC_PRINTF("HOST MODE\n"); ++ /* Enable Power Down Logic Interrupt*/ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pmuintsel = 1; ++ gpwrdn.b.pmuactv = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, 0, gpwrdn.d32); ++ /* Initialize first ADP probe to obtain Ramp Time value */ ++ core_if->adp.initial_probe = 1; ++ dwc_otg_adp_probe_start(core_if); ++ } else { ++ gotgctl_data_t gotgctl; ++ gotgctl.d32 = DWC_READ_REG32(&core_if->core_global_regs->gotgctl); ++ DWC_PRINTF("DEVICE MODE\n"); ++ if (gotgctl.b.bsesvld == 0) { ++ /* Enable Power Down Logic Interrupt*/ ++ gpwrdn.d32 = 0; ++ DWC_PRINTF("VBUS is not valid - start ADP probe\n"); ++ gpwrdn.b.pmuintsel = 1; ++ gpwrdn.b.pmuactv = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, 0, gpwrdn.d32); ++ core_if->adp.initial_probe = 1; ++ dwc_otg_adp_probe_start(core_if); ++ } else { ++ DWC_PRINTF("VBUS is valid - initialize core as a Device\n"); ++ core_if->op_state = B_PERIPHERAL; ++ dwc_otg_core_init(core_if); ++ dwc_otg_enable_global_interrupts(core_if); ++ cil_pcd_start(core_if); ++ dwc_otg_dump_global_registers(core_if); ++ dwc_otg_dump_dev_registers(core_if); ++ } ++ } ++} ++ ++void dwc_otg_adp_init(dwc_otg_core_if_t * core_if) ++{ ++ core_if->adp.adp_started = 0; ++ core_if->adp.initial_probe = 0; ++ core_if->adp.probe_timer_values[0] = -1; ++ core_if->adp.probe_timer_values[1] = -1; ++ core_if->adp.probe_enabled = 0; ++ core_if->adp.sense_enabled = 0; ++ core_if->adp.sense_timer_started = 0; ++ core_if->adp.vbuson_timer_started = 0; ++ core_if->adp.probe_counter = 0; ++ core_if->adp.gpwrdn = 0; ++ core_if->adp.attached = DWC_OTG_ADP_UNKOWN; ++ /* Initialize timers */ ++ core_if->adp.sense_timer = ++ DWC_TIMER_ALLOC("ADP SENSE TIMER", adp_sense_timeout, core_if); ++ core_if->adp.vbuson_timer = ++ DWC_TIMER_ALLOC("ADP VBUS ON TIMER", adp_vbuson_timeout, core_if); ++ if (!core_if->adp.sense_timer || !core_if->adp.vbuson_timer) ++ { ++ DWC_ERROR("Could not allocate memory for ADP timers\n"); ++ } ++} ++ ++void dwc_otg_adp_remove(dwc_otg_core_if_t * core_if) ++{ ++ gpwrdn_data_t gpwrdn = { .d32 = 0 }; ++ gpwrdn.b.pmuintsel = 1; ++ gpwrdn.b.pmuactv = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ ++ if (core_if->adp.probe_enabled) ++ dwc_otg_adp_probe_stop(core_if); ++ if (core_if->adp.sense_enabled) ++ dwc_otg_adp_sense_stop(core_if); ++ if (core_if->adp.sense_timer_started) ++ DWC_TIMER_CANCEL(core_if->adp.sense_timer); ++ if (core_if->adp.vbuson_timer_started) ++ DWC_TIMER_CANCEL(core_if->adp.vbuson_timer); ++ DWC_TIMER_FREE(core_if->adp.sense_timer); ++ DWC_TIMER_FREE(core_if->adp.vbuson_timer); ++} ++ ++///////////////////////////////////////////////////////////////////// ++////////////// ADP Interrupt Handlers /////////////////////////////// ++///////////////////////////////////////////////////////////////////// ++/** ++ * This function sets Ramp Timer values ++ */ ++static uint32_t set_timer_value(dwc_otg_core_if_t * core_if, uint32_t val) ++{ ++ if (core_if->adp.probe_timer_values[0] == -1) { ++ core_if->adp.probe_timer_values[0] = val; ++ core_if->adp.probe_timer_values[1] = -1; ++ return 1; ++ } else { ++ core_if->adp.probe_timer_values[1] = ++ core_if->adp.probe_timer_values[0]; ++ core_if->adp.probe_timer_values[0] = val; ++ return 0; ++ } ++} ++ ++/** ++ * This function compares Ramp Timer values ++ */ ++static uint32_t compare_timer_values(dwc_otg_core_if_t * core_if) ++{ ++ uint32_t diff; ++ if (core_if->adp.probe_timer_values[0]>=core_if->adp.probe_timer_values[1]) ++ diff = core_if->adp.probe_timer_values[0]-core_if->adp.probe_timer_values[1]; ++ else ++ diff = core_if->adp.probe_timer_values[1]-core_if->adp.probe_timer_values[0]; ++ if(diff < 2) { ++ return 0; ++ } else { ++ return 1; ++ } ++} ++ ++/** ++ * This function handles ADP Probe Interrupts ++ */ ++static int32_t dwc_otg_adp_handle_prb_intr(dwc_otg_core_if_t * core_if, ++ uint32_t val) ++{ ++ adpctl_data_t adpctl = {.d32 = 0 }; ++ gpwrdn_data_t gpwrdn, temp; ++ adpctl.d32 = val; ++ ++ temp.d32 = DWC_READ_REG32(&core_if->core_global_regs->gpwrdn); ++ core_if->adp.probe_counter++; ++ core_if->adp.gpwrdn = DWC_READ_REG32(&core_if->core_global_regs->gpwrdn); ++ if (adpctl.b.rtim == 0 && !temp.b.idsts){ ++ DWC_PRINTF("RTIM value is 0\n"); ++ goto exit; ++ } ++ if (set_timer_value(core_if, adpctl.b.rtim) && ++ core_if->adp.initial_probe) { ++ core_if->adp.initial_probe = 0; ++ dwc_otg_adp_probe_stop(core_if); ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pmuactv = 1; ++ gpwrdn.b.pmuintsel = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, 0xFFFFFFFF); ++ ++ /* check which value is for device mode and which for Host mode */ ++ if (!temp.b.idsts) { /* considered host mode value is 0 */ ++ /* ++ * Turn on VBUS after initial ADP probe. ++ */ ++ core_if->op_state = A_HOST; ++ dwc_otg_enable_global_interrupts(core_if); ++ DWC_SPINUNLOCK(core_if->lock); ++ cil_hcd_start(core_if); ++ dwc_otg_adp_turnon_vbus(core_if); ++ DWC_SPINLOCK(core_if->lock); ++ } else { ++ /* ++ * Initiate SRP after initial ADP probe. ++ */ ++ dwc_otg_enable_global_interrupts(core_if); ++ dwc_otg_initiate_srp(core_if); ++ } ++ } else if (core_if->adp.probe_counter > 2){ ++ gpwrdn.d32 = DWC_READ_REG32(&core_if->core_global_regs->gpwrdn); ++ if (compare_timer_values(core_if)) { ++ DWC_PRINTF("Difference in timer values !!! \n"); ++// core_if->adp.attached = DWC_OTG_ADP_ATTACHED; ++ dwc_otg_adp_probe_stop(core_if); ++ ++ /* Power on the core */ ++ if (core_if->power_down == 2) { ++ gpwrdn.b.pwrdnswtch = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs-> ++ gpwrdn, 0, gpwrdn.d32); ++ } ++ ++ /* check which value is for device mode and which for Host mode */ ++ if (!temp.b.idsts) { /* considered host mode value is 0 */ ++ /* Disable Interrupt from Power Down Logic */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pmuintsel = 1; ++ gpwrdn.b.pmuactv = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs-> ++ gpwrdn, gpwrdn.d32, 0); ++ ++ /* ++ * Initialize the Core for Host mode. ++ */ ++ core_if->op_state = A_HOST; ++ dwc_otg_core_init(core_if); ++ dwc_otg_enable_global_interrupts(core_if); ++ cil_hcd_start(core_if); ++ } else { ++ gotgctl_data_t gotgctl; ++ /* Mask SRP detected interrupt from Power Down Logic */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.srp_det_msk = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs-> ++ gpwrdn, gpwrdn.d32, 0); ++ ++ /* Disable Power Down Logic */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pmuintsel = 1; ++ gpwrdn.b.pmuactv = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs-> ++ gpwrdn, gpwrdn.d32, 0); ++ ++ /* ++ * Initialize the Core for Device mode. ++ */ ++ core_if->op_state = B_PERIPHERAL; ++ dwc_otg_core_init(core_if); ++ dwc_otg_enable_global_interrupts(core_if); ++ cil_pcd_start(core_if); ++ ++ gotgctl.d32 = DWC_READ_REG32(&core_if->core_global_regs->gotgctl); ++ if (!gotgctl.b.bsesvld) { ++ dwc_otg_initiate_srp(core_if); ++ } ++ } ++ } ++ if (core_if->power_down == 2) { ++ if (gpwrdn.b.bsessvld) { ++ /* Mask SRP detected interrupt from Power Down Logic */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.srp_det_msk = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ ++ /* Disable Power Down Logic */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pmuactv = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ ++ /* ++ * Initialize the Core for Device mode. ++ */ ++ core_if->op_state = B_PERIPHERAL; ++ dwc_otg_core_init(core_if); ++ dwc_otg_enable_global_interrupts(core_if); ++ cil_pcd_start(core_if); ++ } ++ } ++ } ++exit: ++ /* Clear interrupt */ ++ adpctl.d32 = dwc_otg_adp_read_reg(core_if); ++ adpctl.b.adp_prb_int = 1; ++ dwc_otg_adp_write_reg(core_if, adpctl.d32); ++ ++ return 0; ++} ++ ++/** ++ * This function hadles ADP Sense Interrupt ++ */ ++static int32_t dwc_otg_adp_handle_sns_intr(dwc_otg_core_if_t * core_if) ++{ ++ adpctl_data_t adpctl; ++ /* Stop ADP Sense timer */ ++ DWC_TIMER_CANCEL(core_if->adp.sense_timer); ++ ++ /* Restart ADP Sense timer */ ++ dwc_otg_adp_sense_timer_start(core_if); ++ ++ /* Clear interrupt */ ++ adpctl.d32 = dwc_otg_adp_read_reg(core_if); ++ adpctl.b.adp_sns_int = 1; ++ dwc_otg_adp_write_reg(core_if, adpctl.d32); ++ ++ return 0; ++} ++ ++/** ++ * This function handles ADP Probe Interrupts ++ */ ++static int32_t dwc_otg_adp_handle_prb_tmout_intr(dwc_otg_core_if_t * core_if, ++ uint32_t val) ++{ ++ adpctl_data_t adpctl = {.d32 = 0 }; ++ adpctl.d32 = val; ++ set_timer_value(core_if, adpctl.b.rtim); ++ ++ /* Clear interrupt */ ++ adpctl.d32 = dwc_otg_adp_read_reg(core_if); ++ adpctl.b.adp_tmout_int = 1; ++ dwc_otg_adp_write_reg(core_if, adpctl.d32); ++ ++ return 0; ++} ++ ++/** ++ * ADP Interrupt handler. ++ * ++ */ ++int32_t dwc_otg_adp_handle_intr(dwc_otg_core_if_t * core_if) ++{ ++ int retval = 0; ++ adpctl_data_t adpctl = {.d32 = 0}; ++ ++ adpctl.d32 = dwc_otg_adp_read_reg(core_if); ++ DWC_PRINTF("ADPCTL = %08x\n",adpctl.d32); ++ ++ if (adpctl.b.adp_sns_int & adpctl.b.adp_sns_int_msk) { ++ DWC_PRINTF("ADP Sense interrupt\n"); ++ retval |= dwc_otg_adp_handle_sns_intr(core_if); ++ } ++ if (adpctl.b.adp_tmout_int & adpctl.b.adp_tmout_int_msk) { ++ DWC_PRINTF("ADP timeout interrupt\n"); ++ retval |= dwc_otg_adp_handle_prb_tmout_intr(core_if, adpctl.d32); ++ } ++ if (adpctl.b.adp_prb_int & adpctl.b.adp_prb_int_msk) { ++ DWC_PRINTF("ADP Probe interrupt\n"); ++ adpctl.b.adp_prb_int = 1; ++ retval |= dwc_otg_adp_handle_prb_intr(core_if, adpctl.d32); ++ } ++ ++// dwc_otg_adp_modify_reg(core_if, adpctl.d32, 0); ++ //dwc_otg_adp_write_reg(core_if, adpctl.d32); ++ DWC_PRINTF("RETURN FROM ADP ISR\n"); ++ ++ return retval; ++} ++ ++/** ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ */ ++int32_t dwc_otg_adp_handle_srp_intr(dwc_otg_core_if_t * core_if) ++{ ++ ++#ifndef DWC_HOST_ONLY ++ hprt0_data_t hprt0; ++ gpwrdn_data_t gpwrdn; ++ DWC_DEBUGPL(DBG_ANY, "++ Power Down Logic Session Request Interrupt++\n"); ++ ++ gpwrdn.d32 = DWC_READ_REG32(&core_if->core_global_regs->gpwrdn); ++ /* check which value is for device mode and which for Host mode */ ++ if (!gpwrdn.b.idsts) { /* considered host mode value is 0 */ ++ DWC_PRINTF("SRP: Host mode\n"); ++ ++ if (core_if->adp_enable) { ++ dwc_otg_adp_probe_stop(core_if); ++ ++ /* Power on the core */ ++ if (core_if->power_down == 2) { ++ gpwrdn.b.pwrdnswtch = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs-> ++ gpwrdn, 0, gpwrdn.d32); ++ } ++ ++ core_if->op_state = A_HOST; ++ dwc_otg_core_init(core_if); ++ dwc_otg_enable_global_interrupts(core_if); ++ cil_hcd_start(core_if); ++ } ++ ++ /* Turn on the port power bit. */ ++ hprt0.d32 = dwc_otg_read_hprt0(core_if); ++ hprt0.b.prtpwr = 1; ++ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); ++ ++ /* Start the Connection timer. So a message can be displayed ++ * if connect does not occur within 10 seconds. */ ++ cil_hcd_session_start(core_if); ++ } else { ++ DWC_PRINTF("SRP: Device mode %s\n", __FUNCTION__); ++ if (core_if->adp_enable) { ++ dwc_otg_adp_probe_stop(core_if); ++ ++ /* Power on the core */ ++ if (core_if->power_down == 2) { ++ gpwrdn.b.pwrdnswtch = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs-> ++ gpwrdn, 0, gpwrdn.d32); ++ } ++ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pmuactv = 0; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, 0, ++ gpwrdn.d32); ++ ++ core_if->op_state = B_PERIPHERAL; ++ dwc_otg_core_init(core_if); ++ dwc_otg_enable_global_interrupts(core_if); ++ cil_pcd_start(core_if); ++ } ++ } ++#endif ++ return 1; ++} +diff --git a/drivers/usb/host/dwc_otg/dwc_otg_adp.h b/drivers/usb/host/dwc_otg/dwc_otg_adp.h +new file mode 100644 +index 0000000..4110b25 +--- /dev/null ++++ b/drivers/usb/host/dwc_otg/dwc_otg_adp.h +@@ -0,0 +1,80 @@ ++/* ========================================================================== ++ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_adp.h $ ++ * $Revision: #7 $ ++ * $Date: 2011/10/24 $ ++ * $Change: 1871159 $ ++ * ++ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, ++ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless ++ * otherwise expressly agreed to in writing between Synopsys and you. ++ * ++ * The Software IS NOT an item of Licensed Software or Licensed Product under ++ * any End User Software License Agreement or Agreement for Licensed Product ++ * with Synopsys or any supplement thereto. You are permitted to use and ++ * redistribute this Software in source and binary forms, with or without ++ * modification, provided that redistributions of source code must retain this ++ * notice. You may not view, use, disclose, copy or distribute this file or ++ * any information contained herein except pursuant to this license grant from ++ * Synopsys. If you do not agree with this notice, including the disclaimer ++ * below, then you are not authorized to use the Software. ++ * ++ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS ++ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS 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. ++ * ========================================================================== */ ++ ++#ifndef __DWC_OTG_ADP_H__ ++#define __DWC_OTG_ADP_H__ ++ ++/** ++ * @file ++ * ++ * This file contains the Attach Detect Protocol interfaces and defines ++ * (functions) and structures for Linux. ++ * ++ */ ++ ++#define DWC_OTG_ADP_UNATTACHED 0 ++#define DWC_OTG_ADP_ATTACHED 1 ++#define DWC_OTG_ADP_UNKOWN 2 ++ ++typedef struct dwc_otg_adp { ++ uint32_t adp_started; ++ uint32_t initial_probe; ++ int32_t probe_timer_values[2]; ++ uint32_t probe_enabled; ++ uint32_t sense_enabled; ++ dwc_timer_t *sense_timer; ++ uint32_t sense_timer_started; ++ dwc_timer_t *vbuson_timer; ++ uint32_t vbuson_timer_started; ++ uint32_t attached; ++ uint32_t probe_counter; ++ uint32_t gpwrdn; ++} dwc_otg_adp_t; ++ ++/** ++ * Attach Detect Protocol functions ++ */ ++ ++extern void dwc_otg_adp_write_reg(dwc_otg_core_if_t * core_if, uint32_t value); ++extern uint32_t dwc_otg_adp_read_reg(dwc_otg_core_if_t * core_if); ++extern uint32_t dwc_otg_adp_probe_start(dwc_otg_core_if_t * core_if); ++extern uint32_t dwc_otg_adp_sense_start(dwc_otg_core_if_t * core_if); ++extern uint32_t dwc_otg_adp_probe_stop(dwc_otg_core_if_t * core_if); ++extern uint32_t dwc_otg_adp_sense_stop(dwc_otg_core_if_t * core_if); ++extern void dwc_otg_adp_start(dwc_otg_core_if_t * core_if, uint8_t is_host); ++extern void dwc_otg_adp_init(dwc_otg_core_if_t * core_if); ++extern void dwc_otg_adp_remove(dwc_otg_core_if_t * core_if); ++extern int32_t dwc_otg_adp_handle_intr(dwc_otg_core_if_t * core_if); ++extern int32_t dwc_otg_adp_handle_srp_intr(dwc_otg_core_if_t * core_if); ++ ++#endif //__DWC_OTG_ADP_H__ +diff --git a/drivers/usb/host/dwc_otg/dwc_otg_attr.c b/drivers/usb/host/dwc_otg/dwc_otg_attr.c +new file mode 100644 +index 0000000..9da0c92 +--- /dev/null ++++ b/drivers/usb/host/dwc_otg/dwc_otg_attr.c +@@ -0,0 +1,1210 @@ ++/* ========================================================================== ++ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_attr.c $ ++ * $Revision: #44 $ ++ * $Date: 2010/11/29 $ ++ * $Change: 1636033 $ ++ * ++ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, ++ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless ++ * otherwise expressly agreed to in writing between Synopsys and you. ++ * ++ * The Software IS NOT an item of Licensed Software or Licensed Product under ++ * any End User Software License Agreement or Agreement for Licensed Product ++ * with Synopsys or any supplement thereto. You are permitted to use and ++ * redistribute this Software in source and binary forms, with or without ++ * modification, provided that redistributions of source code must retain this ++ * notice. You may not view, use, disclose, copy or distribute this file or ++ * any information contained herein except pursuant to this license grant from ++ * Synopsys. If you do not agree with this notice, including the disclaimer ++ * below, then you are not authorized to use the Software. ++ * ++ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS ++ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS 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. ++ * ========================================================================== */ ++ ++/** @file ++ * ++ * The diagnostic interface will provide access to the controller for ++ * bringing up the hardware and testing. The Linux driver attributes ++ * feature will be used to provide the Linux Diagnostic ++ * Interface. These attributes are accessed through sysfs. ++ */ ++ ++/** @page "Linux Module Attributes" ++ * ++ * The Linux module attributes feature is used to provide the Linux ++ * Diagnostic Interface. These attributes are accessed through sysfs. ++ * The diagnostic interface will provide access to the controller for ++ * bringing up the hardware and testing. ++ ++ The following table shows the attributes. ++ <table> ++ <tr> ++ <td><b> Name</b></td> ++ <td><b> Description</b></td> ++ <td><b> Access</b></td> ++ </tr> ++ ++ <tr> ++ <td> mode </td> ++ <td> Returns the current mode: 0 for device mode, 1 for host mode</td> ++ <td> Read</td> ++ </tr> ++ ++ <tr> ++ <td> hnpcapable </td> ++ <td> Gets or sets the "HNP-capable" bit in the Core USB Configuraton Register. ++ Read returns the current value.</td> ++ <td> Read/Write</td> ++ </tr> ++ ++ <tr> ++ <td> srpcapable </td> ++ <td> Gets or sets the "SRP-capable" bit in the Core USB Configuraton Register. ++ Read returns the current value.</td> ++ <td> Read/Write</td> ++ </tr> ++ ++ <tr> ++ <td> hsic_connect </td> ++ <td> Gets or sets the "HSIC-Connect" bit in the GLPMCFG Register. ++ Read returns the current value.</td> ++ <td> Read/Write</td> ++ </tr> ++ ++ <tr> ++ <td> inv_sel_hsic </td> ++ <td> Gets or sets the "Invert Select HSIC" bit in the GLPMFG Register. ++ Read returns the current value.</td> ++ <td> Read/Write</td> ++ </tr> ++ ++ <tr> ++ <td> hnp </td> ++ <td> Initiates the Host Negotiation Protocol. Read returns the status.</td> ++ <td> Read/Write</td> ++ </tr> ++ ++ <tr> ++ <td> srp </td> ++ <td> Initiates the Session Request Protocol. Read returns the status.</td> ++ <td> Read/Write</td> ++ </tr> ++ ++ <tr> ++ <td> buspower </td> ++ <td> Gets or sets the Power State of the bus (0 - Off or 1 - On)</td> ++ <td> Read/Write</td> ++ </tr> ++ ++ <tr> ++ <td> bussuspend </td> ++ <td> Suspends the USB bus.</td> ++ <td> Read/Write</td> ++ </tr> ++ ++ <tr> ++ <td> busconnected </td> ++ <td> Gets the connection status of the bus</td> ++ <td> Read</td> ++ </tr> ++ ++ <tr> ++ <td> gotgctl </td> ++ <td> Gets or sets the Core Control Status Register.</td> ++ <td> Read/Write</td> ++ </tr> ++ ++ <tr> ++ <td> gusbcfg </td> ++ <td> Gets or sets the Core USB Configuration Register</td> ++ <td> Read/Write</td> ++ </tr> ++ ++ <tr> ++ <td> grxfsiz </td> ++ <td> Gets or sets the Receive FIFO Size Register</td> ++ <td> Read/Write</td> ++ </tr> ++ ++ <tr> ++ <td> gnptxfsiz </td> ++ <td> Gets or sets the non-periodic Transmit Size Register</td> ++ <td> Read/Write</td> ++ </tr> ++ ++ <tr> ++ <td> gpvndctl </td> ++ <td> Gets or sets the PHY Vendor Control Register</td> ++ <td> Read/Write</td> ++ </tr> ++ ++ <tr> ++ <td> ggpio </td> ++ <td> Gets the value in the lower 16-bits of the General Purpose IO Register ++ or sets the upper 16 bits.</td> ++ <td> Read/Write</td> ++ </tr> ++ ++ <tr> ++ <td> guid </td> ++ <td> Gets or sets the value of the User ID Register</td> ++ <td> Read/Write</td> ++ </tr> ++ ++ <tr> ++ <td> gsnpsid </td> ++ <td> Gets the value of the Synopsys ID Regester</td> ++ <td> Read</td> ++ </tr> ++ ++ <tr> ++ <td> devspeed </td> ++ <td> Gets or sets the device speed setting in the DCFG register</td> ++ <td> Read/Write</td> ++ </tr> ++ ++ <tr> ++ <td> enumspeed </td> ++ <td> Gets the device enumeration Speed.</td> ++ <td> Read</td> ++ </tr> ++ ++ <tr> ++ <td> hptxfsiz </td> ++ <td> Gets the value of the Host Periodic Transmit FIFO</td> ++ <td> Read</td> ++ </tr> ++ ++ <tr> ++ <td> hprt0 </td> ++ <td> Gets or sets the value in the Host Port Control and Status Register</td> ++ <td> Read/Write</td> ++ </tr> ++ ++ <tr> ++ <td> regoffset </td> ++ <td> Sets the register offset for the next Register Access</td> ++ <td> Read/Write</td> ++ </tr> ++ ++ <tr> ++ <td> regvalue </td> ++ <td> Gets or sets the value of the register at the offset in the regoffset attribute.</td> ++ <td> Read/Write</td> ++ </tr> ++ ++ <tr> ++ <td> remote_wakeup </td> ++ <td> On read, shows the status of Remote Wakeup. On write, initiates a remote ++ wakeup of the host. When bit 0 is 1 and Remote Wakeup is enabled, the Remote ++ Wakeup signalling bit in the Device Control Register is set for 1 ++ milli-second.</td> ++ <td> Read/Write</td> ++ </tr> ++ ++ <tr> ++ <td> rem_wakeup_pwrdn </td> ++ <td> On read, shows the status core - hibernated or not. On write, initiates ++ a remote wakeup of the device from Hibernation. </td> ++ <td> Read/Write</td> ++ </tr> ++ ++ <tr> ++ <td> mode_ch_tim_en </td> ++ <td> This bit is used to enable or disable the host core to wait for 200 PHY ++ clock cycles at the end of Resume to change the opmode signal to the PHY to 00 ++ after Suspend or LPM. </td> ++ <td> Read/Write</td> ++ </tr> ++ ++ <tr> ++ <td> fr_interval </td> ++ <td> On read, shows the value of HFIR Frame Interval. On write, dynamically ++ reload HFIR register during runtime. The application can write a value to this ++ register only after the Port Enable bit of the Host Port Control and Status ++ register (HPRT.PrtEnaPort) has been set </td> ++ <td> Read/Write</td> ++ </tr> ++ ++ <tr> ++ <td> disconnect_us </td> ++ <td> On read, shows the status of disconnect_device_us. On write, sets disconnect_us ++ which causes soft disconnect for 100us. Applicable only for device mode of operation.</td> ++ <td> Read/Write</td> ++ </tr> ++ ++ <tr> ++ <td> regdump </td> ++ <td> Dumps the contents of core registers.</td> ++ <td> Read</td> ++ </tr> ++ ++ <tr> ++ <td> spramdump </td> ++ <td> Dumps the contents of core registers.</td> ++ <td> Read</td> ++ </tr> ++ ++ <tr> ++ <td> hcddump </td> ++ <td> Dumps the current HCD state.</td> ++ <td> Read</td> ++ </tr> ++ ++ <tr> ++ <td> hcd_frrem </td> ++ <td> Shows the average value of the Frame Remaining ++ field in the Host Frame Number/Frame Remaining register when an SOF interrupt ++ occurs. This can be used to determine the average interrupt latency. Also ++ shows the average Frame Remaining value for start_transfer and the "a" and ++ "b" sample points. The "a" and "b" sample points may be used during debugging ++ bto determine how long it takes to execute a section of the HCD code.</td> ++ <td> Read</td> ++ </tr> ++ ++ <tr> ++ <td> rd_reg_test </td> ++ <td> Displays the time required to read the GNPTXFSIZ register many times ++ (the output shows the number of times the register is read). ++ <td> Read</td> ++ </tr> ++ ++ <tr> ++ <td> wr_reg_test </td> ++ <td> Displays the time required to write the GNPTXFSIZ register many times ++ (the output shows the number of times the register is written). ++ <td> Read</td> ++ </tr> ++ ++ <tr> ++ <td> lpm_response </td> ++ <td> Gets or sets lpm_response mode. Applicable only in device mode. ++ <td> Write</td> ++ </tr> ++ ++ <tr> ++ <td> sleep_status </td> ++ <td> Shows sleep status of device. ++ <td> Read</td> ++ </tr> ++ ++ </table> ++ ++ Example usage: ++ To get the current mode: ++ cat /sys/devices/lm0/mode ++ ++ To power down the USB: ++ echo 0 > /sys/devices/lm0/buspower ++ */ ++ ++#include "dwc_otg_os_dep.h" ++#include "dwc_os.h" ++#include "dwc_otg_driver.h" ++#include "dwc_otg_attr.h" ++#include "dwc_otg_core_if.h" ++#include "dwc_otg_pcd_if.h" ++#include "dwc_otg_hcd_if.h" ++ ++/* ++ * MACROs for defining sysfs attribute ++ */ ++#ifdef LM_INTERFACE ++ ++#define DWC_OTG_DEVICE_ATTR_BITFIELD_SHOW(_otg_attr_name_,_string_) \ ++static ssize_t _otg_attr_name_##_show (struct device *_dev, struct device_attribute *attr, char *buf) \ ++{ \ ++ struct lm_device *lm_dev = container_of(_dev, struct lm_device, dev); \ ++ dwc_otg_device_t *otg_dev = lm_get_drvdata(lm_dev); \ ++ uint32_t val; \ ++ val = dwc_otg_get_##_otg_attr_name_ (otg_dev->core_if); \ ++ return sprintf (buf, "%s = 0x%x\n", _string_, val); \ ++} ++#define DWC_OTG_DEVICE_ATTR_BITFIELD_STORE(_otg_attr_name_,_string_) \ ++static ssize_t _otg_attr_name_##_store (struct device *_dev, struct device_attribute *attr, \ ++ const char *buf, size_t count) \ ++{ \ ++ struct lm_device *lm_dev = container_of(_dev, struct lm_device, dev); \ ++ dwc_otg_device_t *otg_dev = lm_get_drvdata(lm_dev); \ ++ uint32_t set = simple_strtoul(buf, NULL, 16); \ ++ dwc_otg_set_##_otg_attr_name_(otg_dev->core_if, set);\ ++ return count; \ ++} ++ ++#elif defined(PCI_INTERFACE) ++ ++#define DWC_OTG_DEVICE_ATTR_BITFIELD_SHOW(_otg_attr_name_,_string_) \ ++static ssize_t _otg_attr_name_##_show (struct device *_dev, struct device_attribute *attr, char *buf) \ ++{ \ ++ dwc_otg_device_t *otg_dev = dev_get_drvdata(_dev); \ ++ uint32_t val; \ ++ val = dwc_otg_get_##_otg_attr_name_ (otg_dev->core_if); \ ++ return sprintf (buf, "%s = 0x%x\n", _string_, val); \ ++} ++#define DWC_OTG_DEVICE_ATTR_BITFIELD_STORE(_otg_attr_name_,_string_) \ ++static ssize_t _otg_attr_name_##_store (struct device *_dev, struct device_attribute *attr, \ ++ const char *buf, size_t count) \ ++{ \ ++ dwc_otg_device_t *otg_dev = dev_get_drvdata(_dev); \ ++ uint32_t set = simple_strtoul(buf, NULL, 16); \ ++ dwc_otg_set_##_otg_attr_name_(otg_dev->core_if, set);\ ++ return count; \ ++} ++ ++#elif defined(PLATFORM_INTERFACE) ++ ++#define DWC_OTG_DEVICE_ATTR_BITFIELD_SHOW(_otg_attr_name_,_string_) \ ++static ssize_t _otg_attr_name_##_show (struct device *_dev, struct device_attribute *attr, char *buf) \ ++{ \ ++ struct platform_device *platform_dev = \ ++ container_of(_dev, struct platform_device, dev); \ ++ dwc_otg_device_t *otg_dev = platform_get_drvdata(platform_dev); \ ++ uint32_t val; \ ++ DWC_PRINTF("%s(%p) -> platform_dev %p, otg_dev %p\n", \ ++ __func__, _dev, platform_dev, otg_dev); \ ++ val = dwc_otg_get_##_otg_attr_name_ (otg_dev->core_if); \ ++ return sprintf (buf, "%s = 0x%x\n", _string_, val); \ ++} ++#define DWC_OTG_DEVICE_ATTR_BITFIELD_STORE(_otg_attr_name_,_string_) \ ++static ssize_t _otg_attr_name_##_store (struct device *_dev, struct device_attribute *attr, \ ++ const char *buf, size_t count) \ ++{ \ ++ struct platform_device *platform_dev = container_of(_dev, struct platform_device, dev); \ ++ dwc_otg_device_t *otg_dev = platform_get_drvdata(platform_dev); \ ++ uint32_t set = simple_strtoul(buf, NULL, 16); \ ++ dwc_otg_set_##_otg_attr_name_(otg_dev->core_if, set);\ ++ return count; \ ++} ++#endif ++ ++/* ++ * MACROs for defining sysfs attribute for 32-bit registers ++ */ ++#ifdef LM_INTERFACE ++#define DWC_OTG_DEVICE_ATTR_REG_SHOW(_otg_attr_name_,_string_) \ ++static ssize_t _otg_attr_name_##_show (struct device *_dev, struct device_attribute *attr, char *buf) \ ++{ \ ++ struct lm_device *lm_dev = container_of(_dev, struct lm_device, dev); \ ++ dwc_otg_device_t *otg_dev = lm_get_drvdata(lm_dev); \ ++ uint32_t val; \ ++ val = dwc_otg_get_##_otg_attr_name_ (otg_dev->core_if); \ ++ return sprintf (buf, "%s = 0x%08x\n", _string_, val); \ ++} ++#define DWC_OTG_DEVICE_ATTR_REG_STORE(_otg_attr_name_,_string_) \ ++static ssize_t _otg_attr_name_##_store (struct device *_dev, struct device_attribute *attr, \ ++ const char *buf, size_t count) \ ++{ \ ++ struct lm_device *lm_dev = container_of(_dev, struct lm_device, dev); \ ++ dwc_otg_device_t *otg_dev = lm_get_drvdata(lm_dev); \ ++ uint32_t val = simple_strtoul(buf, NULL, 16); \ ++ dwc_otg_set_##_otg_attr_name_ (otg_dev->core_if, val); \ ++ return count; \ ++} ++#elif defined(PCI_INTERFACE) ++#define DWC_OTG_DEVICE_ATTR_REG_SHOW(_otg_attr_name_,_string_) \ ++static ssize_t _otg_attr_name_##_show (struct device *_dev, struct device_attribute *attr, char *buf) \ ++{ \ ++ dwc_otg_device_t *otg_dev = dev_get_drvdata(_dev); \ ++ uint32_t val; \ ++ val = dwc_otg_get_##_otg_attr_name_ (otg_dev->core_if); \ ++ return sprintf (buf, "%s = 0x%08x\n", _string_, val); \ ++} ++#define DWC_OTG_DEVICE_ATTR_REG_STORE(_otg_attr_name_,_string_) \ ++static ssize_t _otg_attr_name_##_store (struct device *_dev, struct device_attribute *attr, \ ++ const char *buf, size_t count) \ ++{ \ ++ dwc_otg_device_t *otg_dev = dev_get_drvdata(_dev); \ ++ uint32_t val = simple_strtoul(buf, NULL, 16); \ ++ dwc_otg_set_##_otg_attr_name_ (otg_dev->core_if, val); \ ++ return count; \ ++} ++ ++#elif defined(PLATFORM_INTERFACE) ++#include "dwc_otg_dbg.h" ++#define DWC_OTG_DEVICE_ATTR_REG_SHOW(_otg_attr_name_,_string_) \ ++static ssize_t _otg_attr_name_##_show (struct device *_dev, struct device_attribute *attr, char *buf) \ ++{ \ ++ struct platform_device *platform_dev = container_of(_dev, struct platform_device, dev); \ ++ dwc_otg_device_t *otg_dev = platform_get_drvdata(platform_dev); \ ++ uint32_t val; \ ++ DWC_PRINTF("%s(%p) -> platform_dev %p, otg_dev %p\n", \ ++ __func__, _dev, platform_dev, otg_dev); \ ++ val = dwc_otg_get_##_otg_attr_name_ (otg_dev->core_if); \ ++ return sprintf (buf, "%s = 0x%08x\n", _string_, val); \ ++} ++#define DWC_OTG_DEVICE_ATTR_REG_STORE(_otg_attr_name_,_string_) \ ++static ssize_t _otg_attr_name_##_store (struct device *_dev, struct device_attribute *attr, \ ++ const char *buf, size_t count) \ ++{ \ ++ struct platform_device *platform_dev = container_of(_dev, struct platform_device, dev); \ ++ dwc_otg_device_t *otg_dev = platform_get_drvdata(platform_dev); \ ++ uint32_t val = simple_strtoul(buf, NULL, 16); \ ++ dwc_otg_set_##_otg_attr_name_ (otg_dev->core_if, val); \ ++ return count; \ ++} ++ ++#endif ++ ++#define DWC_OTG_DEVICE_ATTR_BITFIELD_RW(_otg_attr_name_,_string_) \ ++DWC_OTG_DEVICE_ATTR_BITFIELD_SHOW(_otg_attr_name_,_string_) \ ++DWC_OTG_DEVICE_ATTR_BITFIELD_STORE(_otg_attr_name_,_string_) \ ++DEVICE_ATTR(_otg_attr_name_,0644,_otg_attr_name_##_show,_otg_attr_name_##_store); ++ ++#define DWC_OTG_DEVICE_ATTR_BITFIELD_RO(_otg_attr_name_,_string_) \ ++DWC_OTG_DEVICE_ATTR_BITFIELD_SHOW(_otg_attr_name_,_string_) \ ++DEVICE_ATTR(_otg_attr_name_,0444,_otg_attr_name_##_show,NULL); ++ ++#define DWC_OTG_DEVICE_ATTR_REG32_RW(_otg_attr_name_,_addr_,_string_) \ ++DWC_OTG_DEVICE_ATTR_REG_SHOW(_otg_attr_name_,_string_) \ ++DWC_OTG_DEVICE_ATTR_REG_STORE(_otg_attr_name_,_string_) \ ++DEVICE_ATTR(_otg_attr_name_,0644,_otg_attr_name_##_show,_otg_attr_name_##_store); ++ ++#define DWC_OTG_DEVICE_ATTR_REG32_RO(_otg_attr_name_,_addr_,_string_) \ ++DWC_OTG_DEVICE_ATTR_REG_SHOW(_otg_attr_name_,_string_) \ ++DEVICE_ATTR(_otg_attr_name_,0444,_otg_attr_name_##_show,NULL); ++ ++/** @name Functions for Show/Store of Attributes */ ++/**@{*/ ++ ++/** ++ * Helper function returning the otg_device structure of the given device ++ */ ++static dwc_otg_device_t *dwc_otg_drvdev(struct device *_dev) ++{ ++ dwc_otg_device_t *otg_dev; ++ DWC_OTG_GETDRVDEV(otg_dev, _dev); ++ return otg_dev; ++} ++ ++/** ++ * Show the register offset of the Register Access. ++ */ ++static ssize_t regoffset_show(struct device *_dev, ++ struct device_attribute *attr, char *buf) ++{ ++ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); ++ return snprintf(buf, sizeof("0xFFFFFFFF\n") + 1, "0x%08x\n", ++ otg_dev->os_dep.reg_offset); ++} ++ ++/** ++ * Set the register offset for the next Register Access Read/Write ++ */ ++static ssize_t regoffset_store(struct device *_dev, ++ struct device_attribute *attr, ++ const char *buf, size_t count) ++{ ++ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); ++ uint32_t offset = simple_strtoul(buf, NULL, 16); ++#if defined(LM_INTERFACE) || defined(PLATFORM_INTERFACE) ++ if (offset < SZ_256K) { ++#elif defined(PCI_INTERFACE) ++ if (offset < 0x00040000) { ++#endif ++ otg_dev->os_dep.reg_offset = offset; ++ } else { ++ dev_err(_dev, "invalid offset\n"); ++ } ++ ++ return count; ++} ++ ++DEVICE_ATTR(regoffset, S_IRUGO | S_IWUSR, regoffset_show, regoffset_store); ++ ++/** ++ * Show the value of the register at the offset in the reg_offset ++ * attribute. ++ */ ++static ssize_t regvalue_show(struct device *_dev, ++ struct device_attribute *attr, char *buf) ++{ ++ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); ++ uint32_t val; ++ volatile uint32_t *addr; ++ ++ if (otg_dev->os_dep.reg_offset != 0xFFFFFFFF && 0 != otg_dev->os_dep.base) { ++ /* Calculate the address */ ++ addr = (uint32_t *) (otg_dev->os_dep.reg_offset + ++ (uint8_t *) otg_dev->os_dep.base); ++ val = DWC_READ_REG32(addr); ++ return snprintf(buf, ++ sizeof("Reg@0xFFFFFFFF = 0xFFFFFFFF\n") + 1, ++ "Reg@0x%06x = 0x%08x\n", otg_dev->os_dep.reg_offset, ++ val); ++ } else { ++ dev_err(_dev, "Invalid offset (0x%0x)\n", otg_dev->os_dep.reg_offset); ++ return sprintf(buf, "invalid offset\n"); ++ } ++} ++ ++/** ++ * Store the value in the register at the offset in the reg_offset ++ * attribute. ++ * ++ */ ++static ssize_t regvalue_store(struct device *_dev, ++ struct device_attribute *attr, ++ const char *buf, size_t count) ++{ ++ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); ++ volatile uint32_t *addr; ++ uint32_t val = simple_strtoul(buf, NULL, 16); ++ //dev_dbg(_dev, "Offset=0x%08x Val=0x%08x\n", otg_dev->reg_offset, val); ++ if (otg_dev->os_dep.reg_offset != 0xFFFFFFFF && 0 != otg_dev->os_dep.base) { ++ /* Calculate the address */ ++ addr = (uint32_t *) (otg_dev->os_dep.reg_offset + ++ (uint8_t *) otg_dev->os_dep.base); ++ DWC_WRITE_REG32(addr, val); ++ } else { ++ dev_err(_dev, "Invalid Register Offset (0x%08x)\n", ++ otg_dev->os_dep.reg_offset); ++ } ++ return count; ++} ++ ++DEVICE_ATTR(regvalue, S_IRUGO | S_IWUSR, regvalue_show, regvalue_store); ++ ++/* ++ * Attributes ++ */ ++DWC_OTG_DEVICE_ATTR_BITFIELD_RO(mode, "Mode"); ++DWC_OTG_DEVICE_ATTR_BITFIELD_RW(hnpcapable, "HNPCapable"); ++DWC_OTG_DEVICE_ATTR_BITFIELD_RW(srpcapable, "SRPCapable"); ++DWC_OTG_DEVICE_ATTR_BITFIELD_RW(hsic_connect, "HSIC Connect"); ++DWC_OTG_DEVICE_ATTR_BITFIELD_RW(inv_sel_hsic, "Invert Select HSIC"); ++ ++//DWC_OTG_DEVICE_ATTR_BITFIELD_RW(buspower,&(otg_dev->core_if->core_global_regs->gotgctl),(1<<8),8,"Mode"); ++//DWC_OTG_DEVICE_ATTR_BITFIELD_RW(bussuspend,&(otg_dev->core_if->core_global_regs->gotgctl),(1<<8),8,"Mode"); ++DWC_OTG_DEVICE_ATTR_BITFIELD_RO(busconnected, "Bus Connected"); ++ ++DWC_OTG_DEVICE_ATTR_REG32_RW(gotgctl, 0, "GOTGCTL"); ++DWC_OTG_DEVICE_ATTR_REG32_RW(gusbcfg, ++ &(otg_dev->core_if->core_global_regs->gusbcfg), ++ "GUSBCFG"); ++DWC_OTG_DEVICE_ATTR_REG32_RW(grxfsiz, ++ &(otg_dev->core_if->core_global_regs->grxfsiz), ++ "GRXFSIZ"); ++DWC_OTG_DEVICE_ATTR_REG32_RW(gnptxfsiz, ++ &(otg_dev->core_if->core_global_regs->gnptxfsiz), ++ "GNPTXFSIZ"); ++DWC_OTG_DEVICE_ATTR_REG32_RW(gpvndctl, ++ &(otg_dev->core_if->core_global_regs->gpvndctl), ++ "GPVNDCTL"); ++DWC_OTG_DEVICE_ATTR_REG32_RW(ggpio, ++ &(otg_dev->core_if->core_global_regs->ggpio), ++ "GGPIO"); ++DWC_OTG_DEVICE_ATTR_REG32_RW(guid, &(otg_dev->core_if->core_global_regs->guid), ++ "GUID"); ++DWC_OTG_DEVICE_ATTR_REG32_RO(gsnpsid, ++ &(otg_dev->core_if->core_global_regs->gsnpsid), ++ "GSNPSID"); ++DWC_OTG_DEVICE_ATTR_BITFIELD_RW(devspeed, "Device Speed"); ++DWC_OTG_DEVICE_ATTR_BITFIELD_RO(enumspeed, "Device Enumeration Speed"); ++ ++DWC_OTG_DEVICE_ATTR_REG32_RO(hptxfsiz, ++ &(otg_dev->core_if->core_global_regs->hptxfsiz), ++ "HPTXFSIZ"); ++DWC_OTG_DEVICE_ATTR_REG32_RW(hprt0, otg_dev->core_if->host_if->hprt0, "HPRT0"); ++ ++/** ++ * @todo Add code to initiate the HNP. ++ */ ++/** ++ * Show the HNP status bit ++ */ ++static ssize_t hnp_show(struct device *_dev, ++ struct device_attribute *attr, char *buf) ++{ ++ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); ++ return sprintf(buf, "HstNegScs = 0x%x\n", ++ dwc_otg_get_hnpstatus(otg_dev->core_if)); ++} ++ ++/** ++ * Set the HNP Request bit ++ */ ++static ssize_t hnp_store(struct device *_dev, ++ struct device_attribute *attr, ++ const char *buf, size_t count) ++{ ++ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); ++ uint32_t in = simple_strtoul(buf, NULL, 16); ++ dwc_otg_set_hnpreq(otg_dev->core_if, in); ++ return count; ++} ++ ++DEVICE_ATTR(hnp, 0644, hnp_show, hnp_store); ++ ++/** ++ * @todo Add code to initiate the SRP. ++ */ ++/** ++ * Show the SRP status bit ++ */ ++static ssize_t srp_show(struct device *_dev, ++ struct device_attribute *attr, char *buf) ++{ ++#ifndef DWC_HOST_ONLY ++ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); ++ return sprintf(buf, "SesReqScs = 0x%x\n", ++ dwc_otg_get_srpstatus(otg_dev->core_if)); ++#else ++ return sprintf(buf, "Host Only Mode!\n"); ++#endif ++} ++ ++/** ++ * Set the SRP Request bit ++ */ ++static ssize_t srp_store(struct device *_dev, ++ struct device_attribute *attr, ++ const char *buf, size_t count) ++{ ++#ifndef DWC_HOST_ONLY ++ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); ++ dwc_otg_pcd_initiate_srp(otg_dev->pcd); ++#endif ++ return count; ++} ++ ++DEVICE_ATTR(srp, 0644, srp_show, srp_store); ++ ++/** ++ * @todo Need to do more for power on/off? ++ */ ++/** ++ * Show the Bus Power status ++ */ ++static ssize_t buspower_show(struct device *_dev, ++ struct device_attribute *attr, char *buf) ++{ ++ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); ++ return sprintf(buf, "Bus Power = 0x%x\n", ++ dwc_otg_get_prtpower(otg_dev->core_if)); ++} ++ ++/** ++ * Set the Bus Power status ++ */ ++static ssize_t buspower_store(struct device *_dev, ++ struct device_attribute *attr, ++ const char *buf, size_t count) ++{ ++ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); ++ uint32_t on = simple_strtoul(buf, NULL, 16); ++ dwc_otg_set_prtpower(otg_dev->core_if, on); ++ return count; ++} ++ ++DEVICE_ATTR(buspower, 0644, buspower_show, buspower_store); ++ ++/** ++ * @todo Need to do more for suspend? ++ */ ++/** ++ * Show the Bus Suspend status ++ */ ++static ssize_t bussuspend_show(struct device *_dev, ++ struct device_attribute *attr, char *buf) ++{ ++ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); ++ return sprintf(buf, "Bus Suspend = 0x%x\n", ++ dwc_otg_get_prtsuspend(otg_dev->core_if)); ++} ++ ++/** ++ * Set the Bus Suspend status ++ */ ++static ssize_t bussuspend_store(struct device *_dev, ++ struct device_attribute *attr, ++ const char *buf, size_t count) ++{ ++ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); ++ uint32_t in = simple_strtoul(buf, NULL, 16); ++ dwc_otg_set_prtsuspend(otg_dev->core_if, in); ++ return count; ++} ++ ++DEVICE_ATTR(bussuspend, 0644, bussuspend_show, bussuspend_store); ++ ++/** ++ * Show the Mode Change Ready Timer status ++ */ ++static ssize_t mode_ch_tim_en_show(struct device *_dev, ++ struct device_attribute *attr, char *buf) ++{ ++ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); ++ return sprintf(buf, "Mode Change Ready Timer Enable = 0x%x\n", ++ dwc_otg_get_mode_ch_tim(otg_dev->core_if)); ++} ++ ++/** ++ * Set the Mode Change Ready Timer status ++ */ ++static ssize_t mode_ch_tim_en_store(struct device *_dev, ++ struct device_attribute *attr, ++ const char *buf, size_t count) ++{ ++ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); ++ uint32_t in = simple_strtoul(buf, NULL, 16); ++ dwc_otg_set_mode_ch_tim(otg_dev->core_if, in); ++ return count; ++} ++ ++DEVICE_ATTR(mode_ch_tim_en, 0644, mode_ch_tim_en_show, mode_ch_tim_en_store); ++ ++/** ++ * Show the value of HFIR Frame Interval bitfield ++ */ ++static ssize_t fr_interval_show(struct device *_dev, ++ struct device_attribute *attr, char *buf) ++{ ++ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); ++ return sprintf(buf, "Frame Interval = 0x%x\n", ++ dwc_otg_get_fr_interval(otg_dev->core_if)); ++} ++ ++/** ++ * Set the HFIR Frame Interval value ++ */ ++static ssize_t fr_interval_store(struct device *_dev, ++ struct device_attribute *attr, ++ const char *buf, size_t count) ++{ ++ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); ++ uint32_t in = simple_strtoul(buf, NULL, 10); ++ dwc_otg_set_fr_interval(otg_dev->core_if, in); ++ return count; ++} ++ ++DEVICE_ATTR(fr_interval, 0644, fr_interval_show, fr_interval_store); ++ ++/** ++ * Show the status of Remote Wakeup. ++ */ ++static ssize_t remote_wakeup_show(struct device *_dev, ++ struct device_attribute *attr, char *buf) ++{ ++#ifndef DWC_HOST_ONLY ++ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); ++ ++ return sprintf(buf, ++ "Remote Wakeup Sig = %d Enabled = %d LPM Remote Wakeup = %d\n", ++ dwc_otg_get_remotewakesig(otg_dev->core_if), ++ dwc_otg_pcd_get_rmwkup_enable(otg_dev->pcd), ++ dwc_otg_get_lpm_remotewakeenabled(otg_dev->core_if)); ++#else ++ return sprintf(buf, "Host Only Mode!\n"); ++#endif /* DWC_HOST_ONLY */ ++} ++ ++/** ++ * Initiate a remote wakeup of the host. The Device control register ++ * Remote Wakeup Signal bit is written if the PCD Remote wakeup enable ++ * flag is set. ++ * ++ */ ++static ssize_t remote_wakeup_store(struct device *_dev, ++ struct device_attribute *attr, ++ const char *buf, size_t count) ++{ ++#ifndef DWC_HOST_ONLY ++ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); ++ uint32_t val = simple_strtoul(buf, NULL, 16); ++ ++ if (val & 1) { ++ dwc_otg_pcd_remote_wakeup(otg_dev->pcd, 1); ++ } else { ++ dwc_otg_pcd_remote_wakeup(otg_dev->pcd, 0); ++ } ++#endif /* DWC_HOST_ONLY */ ++ return count; ++} ++ ++DEVICE_ATTR(remote_wakeup, S_IRUGO | S_IWUSR, remote_wakeup_show, ++ remote_wakeup_store); ++ ++/** ++ * Show the whether core is hibernated or not. ++ */ ++static ssize_t rem_wakeup_pwrdn_show(struct device *_dev, ++ struct device_attribute *attr, char *buf) ++{ ++#ifndef DWC_HOST_ONLY ++ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); ++ ++ if (dwc_otg_get_core_state(otg_dev->core_if)) { ++ DWC_PRINTF("Core is in hibernation\n"); ++ } else { ++ DWC_PRINTF("Core is not in hibernation\n"); ++ } ++#endif /* DWC_HOST_ONLY */ ++ return 0; ++} ++ ++extern int dwc_otg_device_hibernation_restore(dwc_otg_core_if_t * core_if, ++ int rem_wakeup, int reset); ++ ++/** ++ * Initiate a remote wakeup of the device to exit from hibernation. ++ */ ++static ssize_t rem_wakeup_pwrdn_store(struct device *_dev, ++ struct device_attribute *attr, ++ const char *buf, size_t count) ++{ ++#ifndef DWC_HOST_ONLY ++ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); ++ dwc_otg_device_hibernation_restore(otg_dev->core_if, 1, 0); ++#endif ++ return count; ++} ++ ++DEVICE_ATTR(rem_wakeup_pwrdn, S_IRUGO | S_IWUSR, rem_wakeup_pwrdn_show, ++ rem_wakeup_pwrdn_store); ++ ++static ssize_t disconnect_us(struct device *_dev, ++ struct device_attribute *attr, ++ const char *buf, size_t count) ++{ ++ ++#ifndef DWC_HOST_ONLY ++ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); ++ uint32_t val = simple_strtoul(buf, NULL, 16); ++ DWC_PRINTF("The Passed value is %04x\n", val); ++ ++ dwc_otg_pcd_disconnect_us(otg_dev->pcd, 50); ++ ++#endif /* DWC_HOST_ONLY */ ++ return count; ++} ++ ++DEVICE_ATTR(disconnect_us, S_IWUSR, 0, disconnect_us); ++ ++/** ++ * Dump global registers and either host or device registers (depending on the ++ * current mode of the core). ++ */ ++static ssize_t regdump_show(struct device *_dev, ++ struct device_attribute *attr, char *buf) ++{ ++ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); ++ ++ dwc_otg_dump_global_registers(otg_dev->core_if); ++ if (dwc_otg_is_host_mode(otg_dev->core_if)) { ++ dwc_otg_dump_host_registers(otg_dev->core_if); ++ } else { ++ dwc_otg_dump_dev_registers(otg_dev->core_if); ++ ++ } ++ return sprintf(buf, "Register Dump\n"); ++} ++ ++DEVICE_ATTR(regdump, S_IRUGO, regdump_show, 0); ++ ++/** ++ * Dump global registers and either host or device registers (depending on the ++ * current mode of the core). ++ */ ++static ssize_t spramdump_show(struct device *_dev, ++ struct device_attribute *attr, char *buf) ++{ ++ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); ++ ++ //dwc_otg_dump_spram(otg_dev->core_if); ++ ++ return sprintf(buf, "SPRAM Dump\n"); ++} ++ ++DEVICE_ATTR(spramdump, S_IRUGO, spramdump_show, 0); ++ ++/** ++ * Dump the current hcd state. ++ */ ++static ssize_t hcddump_show(struct device *_dev, ++ struct device_attribute *attr, char *buf) ++{ ++#ifndef DWC_DEVICE_ONLY ++ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); ++ dwc_otg_hcd_dump_state(otg_dev->hcd); ++#endif /* DWC_DEVICE_ONLY */ ++ return sprintf(buf, "HCD Dump\n"); ++} ++ ++DEVICE_ATTR(hcddump, S_IRUGO, hcddump_show, 0); ++ ++/** ++ * Dump the average frame remaining at SOF. This can be used to ++ * determine average interrupt latency. Frame remaining is also shown for ++ * start transfer and two additional sample points. ++ */ ++static ssize_t hcd_frrem_show(struct device *_dev, ++ struct device_attribute *attr, char *buf) ++{ ++#ifndef DWC_DEVICE_ONLY ++ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); ++ ++ dwc_otg_hcd_dump_frrem(otg_dev->hcd); ++#endif /* DWC_DEVICE_ONLY */ ++ return sprintf(buf, "HCD Dump Frame Remaining\n"); ++} ++ ++DEVICE_ATTR(hcd_frrem, S_IRUGO, hcd_frrem_show, 0); ++ ++/** ++ * Displays the time required to read the GNPTXFSIZ register many times (the ++ * output shows the number of times the register is read). ++ */ ++#define RW_REG_COUNT 10000000 ++#define MSEC_PER_JIFFIE 1000/HZ ++static ssize_t rd_reg_test_show(struct device *_dev, ++ struct device_attribute *attr, char *buf) ++{ ++ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); ++ int i; ++ int time; ++ int start_jiffies; ++ ++ printk("HZ %d, MSEC_PER_JIFFIE %d, loops_per_jiffy %lu\n", ++ HZ, MSEC_PER_JIFFIE, loops_per_jiffy); ++ start_jiffies = jiffies; ++ for (i = 0; i < RW_REG_COUNT; i++) { ++ dwc_otg_get_gnptxfsiz(otg_dev->core_if); ++ } ++ time = jiffies - start_jiffies; ++ return sprintf(buf, ++ "Time to read GNPTXFSIZ reg %d times: %d msecs (%d jiffies)\n", ++ RW_REG_COUNT, time * MSEC_PER_JIFFIE, time); ++} ++ ++DEVICE_ATTR(rd_reg_test, S_IRUGO, rd_reg_test_show, 0); ++ ++/** ++ * Displays the time required to write the GNPTXFSIZ register many times (the ++ * output shows the number of times the register is written). ++ */ ++static ssize_t wr_reg_test_show(struct device *_dev, ++ struct device_attribute *attr, char *buf) ++{ ++ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); ++ uint32_t reg_val; ++ int i; ++ int time; ++ int start_jiffies; ++ ++ printk("HZ %d, MSEC_PER_JIFFIE %d, loops_per_jiffy %lu\n", ++ HZ, MSEC_PER_JIFFIE, loops_per_jiffy); ++ reg_val = dwc_otg_get_gnptxfsiz(otg_dev->core_if); ++ start_jiffies = jiffies; ++ for (i = 0; i < RW_REG_COUNT; i++) { ++ dwc_otg_set_gnptxfsiz(otg_dev->core_if, reg_val); ++ } ++ time = jiffies - start_jiffies; ++ return sprintf(buf, ++ "Time to write GNPTXFSIZ reg %d times: %d msecs (%d jiffies)\n", ++ RW_REG_COUNT, time * MSEC_PER_JIFFIE, time); ++} ++ ++DEVICE_ATTR(wr_reg_test, S_IRUGO, wr_reg_test_show, 0); ++ ++#ifdef CONFIG_USB_DWC_OTG_LPM ++ ++/** ++* Show the lpm_response attribute. ++*/ ++static ssize_t lpmresp_show(struct device *_dev, ++ struct device_attribute *attr, char *buf) ++{ ++ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); ++ ++ if (!dwc_otg_get_param_lpm_enable(otg_dev->core_if)) ++ return sprintf(buf, "** LPM is DISABLED **\n"); ++ ++ if (!dwc_otg_is_device_mode(otg_dev->core_if)) { ++ return sprintf(buf, "** Current mode is not device mode\n"); ++ } ++ return sprintf(buf, "lpm_response = %d\n", ++ dwc_otg_get_lpmresponse(otg_dev->core_if)); ++} ++ ++/** ++* Store the lpm_response attribute. ++*/ ++static ssize_t lpmresp_store(struct device *_dev, ++ struct device_attribute *attr, ++ const char *buf, size_t count) ++{ ++ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); ++ uint32_t val = simple_strtoul(buf, NULL, 16); ++ ++ if (!dwc_otg_get_param_lpm_enable(otg_dev->core_if)) { ++ return 0; ++ } ++ ++ if (!dwc_otg_is_device_mode(otg_dev->core_if)) { ++ return 0; ++ } ++ ++ dwc_otg_set_lpmresponse(otg_dev->core_if, val); ++ return count; ++} ++ ++DEVICE_ATTR(lpm_response, S_IRUGO | S_IWUSR, lpmresp_show, lpmresp_store); ++ ++/** ++* Show the sleep_status attribute. ++*/ ++static ssize_t sleepstatus_show(struct device *_dev, ++ struct device_attribute *attr, char *buf) ++{ ++ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); ++ return sprintf(buf, "Sleep Status = %d\n", ++ dwc_otg_get_lpm_portsleepstatus(otg_dev->core_if)); ++} ++ ++/** ++ * Store the sleep_status attribure. ++ */ ++static ssize_t sleepstatus_store(struct device *_dev, ++ struct device_attribute *attr, ++ const char *buf, size_t count) ++{ ++ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); ++ dwc_otg_core_if_t *core_if = otg_dev->core_if; ++ ++ if (dwc_otg_get_lpm_portsleepstatus(otg_dev->core_if)) { ++ if (dwc_otg_is_host_mode(core_if)) { ++ ++ DWC_PRINTF("Host initiated resume\n"); ++ dwc_otg_set_prtresume(otg_dev->core_if, 1); ++ } ++ } ++ ++ return count; ++} ++ ++DEVICE_ATTR(sleep_status, S_IRUGO | S_IWUSR, sleepstatus_show, ++ sleepstatus_store); ++ ++#endif /* CONFIG_USB_DWC_OTG_LPM_ENABLE */ ++ ++/**@}*/ ++ ++/** ++ * Create the device files ++ */ ++void dwc_otg_attr_create( ++#ifdef LM_INTERFACE ++ struct lm_device *dev ++#elif defined(PCI_INTERFACE) ++ struct pci_dev *dev ++#elif defined(PLATFORM_INTERFACE) ++ struct platform_device *dev ++#endif ++ ) ++{ ++ int error; ++ ++ error = device_create_file(&dev->dev, &dev_attr_regoffset); ++ error = device_create_file(&dev->dev, &dev_attr_regvalue); ++ error = device_create_file(&dev->dev, &dev_attr_mode); ++ error = device_create_file(&dev->dev, &dev_attr_hnpcapable); ++ error = device_create_file(&dev->dev, &dev_attr_srpcapable); ++ error = device_create_file(&dev->dev, &dev_attr_hsic_connect); ++ error = device_create_file(&dev->dev, &dev_attr_inv_sel_hsic); ++ error = device_create_file(&dev->dev, &dev_attr_hnp); ++ error = device_create_file(&dev->dev, &dev_attr_srp); ++ error = device_create_file(&dev->dev, &dev_attr_buspower); ++ error = device_create_file(&dev->dev, &dev_attr_bussuspend); ++ error = device_create_file(&dev->dev, &dev_attr_mode_ch_tim_en); ++ error = device_create_file(&dev->dev, &dev_attr_fr_interval); ++ error = device_create_file(&dev->dev, &dev_attr_busconnected); ++ error = device_create_file(&dev->dev, &dev_attr_gotgctl); ++ error = device_create_file(&dev->dev, &dev_attr_gusbcfg); ++ error = device_create_file(&dev->dev, &dev_attr_grxfsiz); ++ error = device_create_file(&dev->dev, &dev_attr_gnptxfsiz); ++ error = device_create_file(&dev->dev, &dev_attr_gpvndctl); ++ error = device_create_file(&dev->dev, &dev_attr_ggpio); ++ error = device_create_file(&dev->dev, &dev_attr_guid); ++ error = device_create_file(&dev->dev, &dev_attr_gsnpsid); ++ error = device_create_file(&dev->dev, &dev_attr_devspeed); ++ error = device_create_file(&dev->dev, &dev_attr_enumspeed); ++ error = device_create_file(&dev->dev, &dev_attr_hptxfsiz); ++ error = device_create_file(&dev->dev, &dev_attr_hprt0); ++ error = device_create_file(&dev->dev, &dev_attr_remote_wakeup); ++ error = device_create_file(&dev->dev, &dev_attr_rem_wakeup_pwrdn); ++ error = device_create_file(&dev->dev, &dev_attr_disconnect_us); ++ error = device_create_file(&dev->dev, &dev_attr_regdump); ++ error = device_create_file(&dev->dev, &dev_attr_spramdump); ++ error = device_create_file(&dev->dev, &dev_attr_hcddump); ++ error = device_create_file(&dev->dev, &dev_attr_hcd_frrem); ++ error = device_create_file(&dev->dev, &dev_attr_rd_reg_test); ++ error = device_create_file(&dev->dev, &dev_attr_wr_reg_test); ++#ifdef CONFIG_USB_DWC_OTG_LPM ++ error = device_create_file(&dev->dev, &dev_attr_lpm_response); ++ error = device_create_file(&dev->dev, &dev_attr_sleep_status); ++#endif ++} ++ ++/** ++ * Remove the device files ++ */ ++void dwc_otg_attr_remove( ++#ifdef LM_INTERFACE ++ struct lm_device *dev ++#elif defined(PCI_INTERFACE) ++ struct pci_dev *dev ++#elif defined(PLATFORM_INTERFACE) ++ struct platform_device *dev ++#endif ++ ) ++{ ++ device_remove_file(&dev->dev, &dev_attr_regoffset); ++ device_remove_file(&dev->dev, &dev_attr_regvalue); ++ device_remove_file(&dev->dev, &dev_attr_mode); ++ device_remove_file(&dev->dev, &dev_attr_hnpcapable); ++ device_remove_file(&dev->dev, &dev_attr_srpcapable); ++ device_remove_file(&dev->dev, &dev_attr_hsic_connect); ++ device_remove_file(&dev->dev, &dev_attr_inv_sel_hsic); ++ device_remove_file(&dev->dev, &dev_attr_hnp); ++ device_remove_file(&dev->dev, &dev_attr_srp); ++ device_remove_file(&dev->dev, &dev_attr_buspower); ++ device_remove_file(&dev->dev, &dev_attr_bussuspend); ++ device_remove_file(&dev->dev, &dev_attr_mode_ch_tim_en); ++ device_remove_file(&dev->dev, &dev_attr_fr_interval); ++ device_remove_file(&dev->dev, &dev_attr_busconnected); ++ device_remove_file(&dev->dev, &dev_attr_gotgctl); ++ device_remove_file(&dev->dev, &dev_attr_gusbcfg); ++ device_remove_file(&dev->dev, &dev_attr_grxfsiz); ++ device_remove_file(&dev->dev, &dev_attr_gnptxfsiz); ++ device_remove_file(&dev->dev, &dev_attr_gpvndctl); ++ device_remove_file(&dev->dev, &dev_attr_ggpio); ++ device_remove_file(&dev->dev, &dev_attr_guid); ++ device_remove_file(&dev->dev, &dev_attr_gsnpsid); ++ device_remove_file(&dev->dev, &dev_attr_devspeed); ++ device_remove_file(&dev->dev, &dev_attr_enumspeed); ++ device_remove_file(&dev->dev, &dev_attr_hptxfsiz); ++ device_remove_file(&dev->dev, &dev_attr_hprt0); ++ device_remove_file(&dev->dev, &dev_attr_remote_wakeup); ++ device_remove_file(&dev->dev, &dev_attr_rem_wakeup_pwrdn); ++ device_remove_file(&dev->dev, &dev_attr_disconnect_us); ++ device_remove_file(&dev->dev, &dev_attr_regdump); ++ device_remove_file(&dev->dev, &dev_attr_spramdump); ++ device_remove_file(&dev->dev, &dev_attr_hcddump); ++ device_remove_file(&dev->dev, &dev_attr_hcd_frrem); ++ device_remove_file(&dev->dev, &dev_attr_rd_reg_test); ++ device_remove_file(&dev->dev, &dev_attr_wr_reg_test); ++#ifdef CONFIG_USB_DWC_OTG_LPM ++ device_remove_file(&dev->dev, &dev_attr_lpm_response); ++ device_remove_file(&dev->dev, &dev_attr_sleep_status); ++#endif ++} +diff --git a/drivers/usb/host/dwc_otg/dwc_otg_attr.h b/drivers/usb/host/dwc_otg/dwc_otg_attr.h +new file mode 100644 +index 0000000..e10b67f +--- /dev/null ++++ b/drivers/usb/host/dwc_otg/dwc_otg_attr.h +@@ -0,0 +1,89 @@ ++/* ========================================================================== ++ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_attr.h $ ++ * $Revision: #13 $ ++ * $Date: 2010/06/21 $ ++ * $Change: 1532021 $ ++ * ++ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, ++ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless ++ * otherwise expressly agreed to in writing between Synopsys and you. ++ * ++ * The Software IS NOT an item of Licensed Software or Licensed Product under ++ * any End User Software License Agreement or Agreement for Licensed Product ++ * with Synopsys or any supplement thereto. You are permitted to use and ++ * redistribute this Software in source and binary forms, with or without ++ * modification, provided that redistributions of source code must retain this ++ * notice. You may not view, use, disclose, copy or distribute this file or ++ * any information contained herein except pursuant to this license grant from ++ * Synopsys. If you do not agree with this notice, including the disclaimer ++ * below, then you are not authorized to use the Software. ++ * ++ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS ++ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS 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. ++ * ========================================================================== */ ++ ++#if !defined(__DWC_OTG_ATTR_H__) ++#define __DWC_OTG_ATTR_H__ ++ ++/** @file ++ * This file contains the interface to the Linux device attributes. ++ */ ++extern struct device_attribute dev_attr_regoffset; ++extern struct device_attribute dev_attr_regvalue; ++ ++extern struct device_attribute dev_attr_mode; ++extern struct device_attribute dev_attr_hnpcapable; ++extern struct device_attribute dev_attr_srpcapable; ++extern struct device_attribute dev_attr_hnp; ++extern struct device_attribute dev_attr_srp; ++extern struct device_attribute dev_attr_buspower; ++extern struct device_attribute dev_attr_bussuspend; ++extern struct device_attribute dev_attr_mode_ch_tim_en; ++extern struct device_attribute dev_attr_fr_interval; ++extern struct device_attribute dev_attr_busconnected; ++extern struct device_attribute dev_attr_gotgctl; ++extern struct device_attribute dev_attr_gusbcfg; ++extern struct device_attribute dev_attr_grxfsiz; ++extern struct device_attribute dev_attr_gnptxfsiz; ++extern struct device_attribute dev_attr_gpvndctl; ++extern struct device_attribute dev_attr_ggpio; ++extern struct device_attribute dev_attr_guid; ++extern struct device_attribute dev_attr_gsnpsid; ++extern struct device_attribute dev_attr_devspeed; ++extern struct device_attribute dev_attr_enumspeed; ++extern struct device_attribute dev_attr_hptxfsiz; ++extern struct device_attribute dev_attr_hprt0; ++#ifdef CONFIG_USB_DWC_OTG_LPM ++extern struct device_attribute dev_attr_lpm_response; ++extern struct device_attribute devi_attr_sleep_status; ++#endif ++ ++void dwc_otg_attr_create( ++#ifdef LM_INTERFACE ++ struct lm_device *dev ++#elif defined(PCI_INTERFACE) ++ struct pci_dev *dev ++#elif defined(PLATFORM_INTERFACE) ++ struct platform_device *dev ++#endif ++ ); ++ ++void dwc_otg_attr_remove( ++#ifdef LM_INTERFACE ++ struct lm_device *dev ++#elif defined(PCI_INTERFACE) ++ struct pci_dev *dev ++#elif defined(PLATFORM_INTERFACE) ++ struct platform_device *dev ++#endif ++ ); ++#endif +diff --git a/drivers/usb/host/dwc_otg/dwc_otg_cfi.c b/drivers/usb/host/dwc_otg/dwc_otg_cfi.c +new file mode 100644 +index 0000000..bbb3d32 +--- /dev/null ++++ b/drivers/usb/host/dwc_otg/dwc_otg_cfi.c +@@ -0,0 +1,1876 @@ ++/* ========================================================================== ++ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, ++ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless ++ * otherwise expressly agreed to in writing between Synopsys and you. ++ * ++ * The Software IS NOT an item of Licensed Software or Licensed Product under ++ * any End User Software License Agreement or Agreement for Licensed Product ++ * with Synopsys or any supplement thereto. You are permitted to use and ++ * redistribute this Software in source and binary forms, with or without ++ * modification, provided that redistributions of source code must retain this ++ * notice. You may not view, use, disclose, copy or distribute this file or ++ * any information contained herein except pursuant to this license grant from ++ * Synopsys. If you do not agree with this notice, including the disclaimer ++ * below, then you are not authorized to use the Software. ++ * ++ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS ++ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS 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. ++ * ========================================================================== */ ++ ++/** @file ++ * ++ * This file contains the most of the CFI(Core Feature Interface) ++ * implementation for the OTG. ++ */ ++ ++#ifdef DWC_UTE_CFI ++ ++#include "dwc_otg_pcd.h" ++#include "dwc_otg_cfi.h" ++ ++/** This definition should actually migrate to the Portability Library */ ++#define DWC_CONSTANT_CPU_TO_LE16(x) (x) ++ ++extern dwc_otg_pcd_ep_t *get_ep_by_addr(dwc_otg_pcd_t * pcd, u16 wIndex); ++ ++static int cfi_core_features_buf(uint8_t * buf, uint16_t buflen); ++static int cfi_get_feature_value(uint8_t * buf, uint16_t buflen, ++ struct dwc_otg_pcd *pcd, ++ struct cfi_usb_ctrlrequest *ctrl_req); ++static int cfi_set_feature_value(struct dwc_otg_pcd *pcd); ++static int cfi_ep_get_sg_val(uint8_t * buf, struct dwc_otg_pcd *pcd, ++ struct cfi_usb_ctrlrequest *req); ++static int cfi_ep_get_concat_val(uint8_t * buf, struct dwc_otg_pcd *pcd, ++ struct cfi_usb_ctrlrequest *req); ++static int cfi_ep_get_align_val(uint8_t * buf, struct dwc_otg_pcd *pcd, ++ struct cfi_usb_ctrlrequest *req); ++static int cfi_preproc_reset(struct dwc_otg_pcd *pcd, ++ struct cfi_usb_ctrlrequest *req); ++static void cfi_free_ep_bs_dyn_data(cfi_ep_t * cfiep); ++ ++static uint16_t get_dfifo_size(dwc_otg_core_if_t * core_if); ++static int32_t get_rxfifo_size(dwc_otg_core_if_t * core_if, uint16_t wValue); ++static int32_t get_txfifo_size(struct dwc_otg_pcd *pcd, uint16_t wValue); ++ ++static uint8_t resize_fifos(dwc_otg_core_if_t * core_if); ++ ++/** This is the header of the all features descriptor */ ++static cfi_all_features_header_t all_props_desc_header = { ++ .wVersion = DWC_CONSTANT_CPU_TO_LE16(0x100), ++ .wCoreID = DWC_CONSTANT_CPU_TO_LE16(CFI_CORE_ID_OTG), ++ .wNumFeatures = DWC_CONSTANT_CPU_TO_LE16(9), ++}; ++ ++/** This is an array of statically allocated feature descriptors */ ++static cfi_feature_desc_header_t prop_descs[] = { ++ ++ /* FT_ID_DMA_MODE */ ++ { ++ .wFeatureID = DWC_CONSTANT_CPU_TO_LE16(FT_ID_DMA_MODE), ++ .bmAttributes = CFI_FEATURE_ATTR_RW, ++ .wDataLength = DWC_CONSTANT_CPU_TO_LE16(1), ++ }, ++ ++ /* FT_ID_DMA_BUFFER_SETUP */ ++ { ++ .wFeatureID = DWC_CONSTANT_CPU_TO_LE16(FT_ID_DMA_BUFFER_SETUP), ++ .bmAttributes = CFI_FEATURE_ATTR_RW, ++ .wDataLength = DWC_CONSTANT_CPU_TO_LE16(6), ++ }, ++ ++ /* FT_ID_DMA_BUFF_ALIGN */ ++ { ++ .wFeatureID = DWC_CONSTANT_CPU_TO_LE16(FT_ID_DMA_BUFF_ALIGN), ++ .bmAttributes = CFI_FEATURE_ATTR_RW, ++ .wDataLength = DWC_CONSTANT_CPU_TO_LE16(2), ++ }, ++ ++ /* FT_ID_DMA_CONCAT_SETUP */ ++ { ++ .wFeatureID = DWC_CONSTANT_CPU_TO_LE16(FT_ID_DMA_CONCAT_SETUP), ++ .bmAttributes = CFI_FEATURE_ATTR_RW, ++ //.wDataLength = DWC_CONSTANT_CPU_TO_LE16(6), ++ }, ++ ++ /* FT_ID_DMA_CIRCULAR */ ++ { ++ .wFeatureID = DWC_CONSTANT_CPU_TO_LE16(FT_ID_DMA_CIRCULAR), ++ .bmAttributes = CFI_FEATURE_ATTR_RW, ++ .wDataLength = DWC_CONSTANT_CPU_TO_LE16(6), ++ }, ++ ++ /* FT_ID_THRESHOLD_SETUP */ ++ { ++ .wFeatureID = DWC_CONSTANT_CPU_TO_LE16(FT_ID_THRESHOLD_SETUP), ++ .bmAttributes = CFI_FEATURE_ATTR_RW, ++ .wDataLength = DWC_CONSTANT_CPU_TO_LE16(6), ++ }, ++ ++ /* FT_ID_DFIFO_DEPTH */ ++ { ++ .wFeatureID = DWC_CONSTANT_CPU_TO_LE16(FT_ID_DFIFO_DEPTH), ++ .bmAttributes = CFI_FEATURE_ATTR_RO, ++ .wDataLength = DWC_CONSTANT_CPU_TO_LE16(2), ++ }, ++ ++ /* FT_ID_TX_FIFO_DEPTH */ ++ { ++ .wFeatureID = DWC_CONSTANT_CPU_TO_LE16(FT_ID_TX_FIFO_DEPTH), ++ .bmAttributes = CFI_FEATURE_ATTR_RW, ++ .wDataLength = DWC_CONSTANT_CPU_TO_LE16(2), ++ }, ++ ++ /* FT_ID_RX_FIFO_DEPTH */ ++ { ++ .wFeatureID = DWC_CONSTANT_CPU_TO_LE16(FT_ID_RX_FIFO_DEPTH), ++ .bmAttributes = CFI_FEATURE_ATTR_RW, ++ .wDataLength = DWC_CONSTANT_CPU_TO_LE16(2), ++ } ++}; ++ ++/** The table of feature names */ ++cfi_string_t prop_name_table[] = { ++ {FT_ID_DMA_MODE, "dma_mode"}, ++ {FT_ID_DMA_BUFFER_SETUP, "buffer_setup"}, ++ {FT_ID_DMA_BUFF_ALIGN, "buffer_align"}, ++ {FT_ID_DMA_CONCAT_SETUP, "concat_setup"}, ++ {FT_ID_DMA_CIRCULAR, "buffer_circular"}, ++ {FT_ID_THRESHOLD_SETUP, "threshold_setup"}, ++ {FT_ID_DFIFO_DEPTH, "dfifo_depth"}, ++ {FT_ID_TX_FIFO_DEPTH, "txfifo_depth"}, ++ {FT_ID_RX_FIFO_DEPTH, "rxfifo_depth"}, ++ {} ++}; ++ ++/************************************************************************/ ++ ++/** ++ * Returns the name of the feature by its ID ++ * or NULL if no featute ID matches. ++ * ++ */ ++const uint8_t *get_prop_name(uint16_t prop_id, int *len) ++{ ++ cfi_string_t *pstr; ++ *len = 0; ++ ++ for (pstr = prop_name_table; pstr && pstr->s; pstr++) { ++ if (pstr->id == prop_id) { ++ *len = DWC_STRLEN(pstr->s); ++ return pstr->s; ++ } ++ } ++ return NULL; ++} ++ ++/** ++ * This function handles all CFI specific control requests. ++ * ++ * Return a negative value to stall the DCE. ++ */ ++int cfi_setup(struct dwc_otg_pcd *pcd, struct cfi_usb_ctrlrequest *ctrl) ++{ ++ int retval = 0; ++ dwc_otg_pcd_ep_t *ep = NULL; ++ cfiobject_t *cfi = pcd->cfi; ++ struct dwc_otg_core_if *coreif = GET_CORE_IF(pcd); ++ uint16_t wLen = DWC_LE16_TO_CPU(&ctrl->wLength); ++ uint16_t wValue = DWC_LE16_TO_CPU(&ctrl->wValue); ++ uint16_t wIndex = DWC_LE16_TO_CPU(&ctrl->wIndex); ++ uint32_t regaddr = 0; ++ uint32_t regval = 0; ++ ++ /* Save this Control Request in the CFI object. ++ * The data field will be assigned in the data stage completion CB function. ++ */ ++ cfi->ctrl_req = *ctrl; ++ cfi->ctrl_req.data = NULL; ++ ++ cfi->need_gadget_att = 0; ++ cfi->need_status_in_complete = 0; ++ ++ switch (ctrl->bRequest) { ++ case VEN_CORE_GET_FEATURES: ++ retval = cfi_core_features_buf(cfi->buf_in.buf, CFI_IN_BUF_LEN); ++ if (retval >= 0) { ++ //dump_msg(cfi->buf_in.buf, retval); ++ ep = &pcd->ep0; ++ ++ retval = min((uint16_t) retval, wLen); ++ /* Transfer this buffer to the host through the EP0-IN EP */ ++ ep->dwc_ep.dma_addr = cfi->buf_in.addr; ++ ep->dwc_ep.start_xfer_buff = cfi->buf_in.buf; ++ ep->dwc_ep.xfer_buff = cfi->buf_in.buf; ++ ep->dwc_ep.xfer_len = retval; ++ ep->dwc_ep.xfer_count = 0; ++ ep->dwc_ep.sent_zlp = 0; ++ ep->dwc_ep.total_len = ep->dwc_ep.xfer_len; ++ ++ pcd->ep0_pending = 1; ++ dwc_otg_ep0_start_transfer(coreif, &ep->dwc_ep); ++ } ++ retval = 0; ++ break; ++ ++ case VEN_CORE_GET_FEATURE: ++ CFI_INFO("VEN_CORE_GET_FEATURE\n"); ++ retval = cfi_get_feature_value(cfi->buf_in.buf, CFI_IN_BUF_LEN, ++ pcd, ctrl); ++ if (retval >= 0) { ++ ep = &pcd->ep0; ++ ++ retval = min((uint16_t) retval, wLen); ++ /* Transfer this buffer to the host through the EP0-IN EP */ ++ ep->dwc_ep.dma_addr = cfi->buf_in.addr; ++ ep->dwc_ep.start_xfer_buff = cfi->buf_in.buf; ++ ep->dwc_ep.xfer_buff = cfi->buf_in.buf; ++ ep->dwc_ep.xfer_len = retval; ++ ep->dwc_ep.xfer_count = 0; ++ ep->dwc_ep.sent_zlp = 0; ++ ep->dwc_ep.total_len = ep->dwc_ep.xfer_len; ++ ++ pcd->ep0_pending = 1; ++ dwc_otg_ep0_start_transfer(coreif, &ep->dwc_ep); ++ } ++ CFI_INFO("VEN_CORE_GET_FEATURE=%d\n", retval); ++ dump_msg(cfi->buf_in.buf, retval); ++ break; ++ ++ case VEN_CORE_SET_FEATURE: ++ CFI_INFO("VEN_CORE_SET_FEATURE\n"); ++ /* Set up an XFER to get the data stage of the control request, ++ * which is the new value of the feature to be modified. ++ */ ++ ep = &pcd->ep0; ++ ep->dwc_ep.is_in = 0; ++ ep->dwc_ep.dma_addr = cfi->buf_out.addr; ++ ep->dwc_ep.start_xfer_buff = cfi->buf_out.buf; ++ ep->dwc_ep.xfer_buff = cfi->buf_out.buf; ++ ep->dwc_ep.xfer_len = wLen; ++ ep->dwc_ep.xfer_count = 0; ++ ep->dwc_ep.sent_zlp = 0; ++ ep->dwc_ep.total_len = ep->dwc_ep.xfer_len; ++ ++ pcd->ep0_pending = 1; ++ /* Read the control write's data stage */ ++ dwc_otg_ep0_start_transfer(coreif, &ep->dwc_ep); ++ retval = 0; ++ break; ++ ++ case VEN_CORE_RESET_FEATURES: ++ CFI_INFO("VEN_CORE_RESET_FEATURES\n"); ++ cfi->need_gadget_att = 1; ++ cfi->need_status_in_complete = 1; ++ retval = cfi_preproc_reset(pcd, ctrl); ++ CFI_INFO("VEN_CORE_RESET_FEATURES = (%d)\n", retval); ++ break; ++ ++ case VEN_CORE_ACTIVATE_FEATURES: ++ CFI_INFO("VEN_CORE_ACTIVATE_FEATURES\n"); ++ break; ++ ++ case VEN_CORE_READ_REGISTER: ++ CFI_INFO("VEN_CORE_READ_REGISTER\n"); ++ /* wValue optionally contains the HI WORD of the register offset and ++ * wIndex contains the LOW WORD of the register offset ++ */ ++ if (wValue == 0) { ++ /* @TODO - MAS - fix the access to the base field */ ++ regaddr = 0; ++ //regaddr = (uint32_t) pcd->otg_dev->os_dep.base; ++ //GET_CORE_IF(pcd)->co ++ regaddr |= wIndex; ++ } else { ++ regaddr = (wValue << 16) | wIndex; ++ } ++ ++ /* Read a 32-bit value of the memory at the regaddr */ ++ regval = DWC_READ_REG32((uint32_t *) regaddr); ++ ++ ep = &pcd->ep0; ++ dwc_memcpy(cfi->buf_in.buf, &regval, sizeof(uint32_t)); ++ ep->dwc_ep.is_in = 1; ++ ep->dwc_ep.dma_addr = cfi->buf_in.addr; ++ ep->dwc_ep.start_xfer_buff = cfi->buf_in.buf; ++ ep->dwc_ep.xfer_buff = cfi->buf_in.buf; ++ ep->dwc_ep.xfer_len = wLen; ++ ep->dwc_ep.xfer_count = 0; ++ ep->dwc_ep.sent_zlp = 0; ++ ep->dwc_ep.total_len = ep->dwc_ep.xfer_len; ++ ++ pcd->ep0_pending = 1; ++ dwc_otg_ep0_start_transfer(coreif, &ep->dwc_ep); ++ cfi->need_gadget_att = 0; ++ retval = 0; ++ break; ++ ++ case VEN_CORE_WRITE_REGISTER: ++ CFI_INFO("VEN_CORE_WRITE_REGISTER\n"); ++ /* Set up an XFER to get the data stage of the control request, ++ * which is the new value of the register to be modified. ++ */ ++ ep = &pcd->ep0; ++ ep->dwc_ep.is_in = 0; ++ ep->dwc_ep.dma_addr = cfi->buf_out.addr; ++ ep->dwc_ep.start_xfer_buff = cfi->buf_out.buf; ++ ep->dwc_ep.xfer_buff = cfi->buf_out.buf; ++ ep->dwc_ep.xfer_len = wLen; ++ ep->dwc_ep.xfer_count = 0; ++ ep->dwc_ep.sent_zlp = 0; ++ ep->dwc_ep.total_len = ep->dwc_ep.xfer_len; ++ ++ pcd->ep0_pending = 1; ++ /* Read the control write's data stage */ ++ dwc_otg_ep0_start_transfer(coreif, &ep->dwc_ep); ++ retval = 0; ++ break; ++ ++ default: ++ retval = -DWC_E_NOT_SUPPORTED; ++ break; ++ } ++ ++ return retval; ++} ++ ++/** ++ * This function prepares the core features descriptors and copies its ++ * raw representation into the buffer <buf>. ++ * ++ * The buffer structure is as follows: ++ * all_features_header (8 bytes) ++ * features_#1 (8 bytes + feature name string length) ++ * features_#2 (8 bytes + feature name string length) ++ * ..... ++ * features_#n - where n=the total count of feature descriptors ++ */ ++static int cfi_core_features_buf(uint8_t * buf, uint16_t buflen) ++{ ++ cfi_feature_desc_header_t *prop_hdr = prop_descs; ++ cfi_feature_desc_header_t *prop; ++ cfi_all_features_header_t *all_props_hdr = &all_props_desc_header; ++ cfi_all_features_header_t *tmp; ++ uint8_t *tmpbuf = buf; ++ const uint8_t *pname = NULL; ++ int i, j, namelen = 0, totlen; ++ ++ /* Prepare and copy the core features into the buffer */ ++ CFI_INFO("%s:\n", __func__); ++ ++ tmp = (cfi_all_features_header_t *) tmpbuf; ++ *tmp = *all_props_hdr; ++ tmpbuf += CFI_ALL_FEATURES_HDR_LEN; ++ ++ j = sizeof(prop_descs) / sizeof(cfi_all_features_header_t); ++ for (i = 0; i < j; i++, prop_hdr++) { ++ pname = get_prop_name(prop_hdr->wFeatureID, &namelen); ++ prop = (cfi_feature_desc_header_t *) tmpbuf; ++ *prop = *prop_hdr; ++ ++ prop->bNameLen = namelen; ++ prop->wLength = ++ DWC_CONSTANT_CPU_TO_LE16(CFI_FEATURE_DESC_HDR_LEN + ++ namelen); ++ ++ tmpbuf += CFI_FEATURE_DESC_HDR_LEN; ++ dwc_memcpy(tmpbuf, pname, namelen); ++ tmpbuf += namelen; ++ } ++ ++ totlen = tmpbuf - buf; ++ ++ if (totlen > 0) { ++ tmp = (cfi_all_features_header_t *) buf; ++ tmp->wTotalLen = DWC_CONSTANT_CPU_TO_LE16(totlen); ++ } ++ ++ return totlen; ++} ++ ++/** ++ * This function releases all the dynamic memory in the CFI object. ++ */ ++static void cfi_release(cfiobject_t * cfiobj) ++{ ++ cfi_ep_t *cfiep; ++ dwc_list_link_t *tmp; ++ ++ CFI_INFO("%s\n", __func__); ++ ++ if (cfiobj->buf_in.buf) { ++ DWC_DMA_FREE(CFI_IN_BUF_LEN, cfiobj->buf_in.buf, ++ cfiobj->buf_in.addr); ++ cfiobj->buf_in.buf = NULL; ++ } ++ ++ if (cfiobj->buf_out.buf) { ++ DWC_DMA_FREE(CFI_OUT_BUF_LEN, cfiobj->buf_out.buf, ++ cfiobj->buf_out.addr); ++ cfiobj->buf_out.buf = NULL; ++ } ++ ++ /* Free the Buffer Setup values for each EP */ ++ //list_for_each_entry(cfiep, &cfiobj->active_eps, lh) { ++ DWC_LIST_FOREACH(tmp, &cfiobj->active_eps) { ++ cfiep = DWC_LIST_ENTRY(tmp, struct cfi_ep, lh); ++ cfi_free_ep_bs_dyn_data(cfiep); ++ } ++} ++ ++/** ++ * This function frees the dynamically allocated EP buffer setup data. ++ */ ++static void cfi_free_ep_bs_dyn_data(cfi_ep_t * cfiep) ++{ ++ if (cfiep->bm_sg) { ++ DWC_FREE(cfiep->bm_sg); ++ cfiep->bm_sg = NULL; ++ } ++ ++ if (cfiep->bm_align) { ++ DWC_FREE(cfiep->bm_align); ++ cfiep->bm_align = NULL; ++ } ++ ++ if (cfiep->bm_concat) { ++ if (NULL != cfiep->bm_concat->wTxBytes) { ++ DWC_FREE(cfiep->bm_concat->wTxBytes); ++ cfiep->bm_concat->wTxBytes = NULL; ++ } ++ DWC_FREE(cfiep->bm_concat); ++ cfiep->bm_concat = NULL; ++ } ++} ++ ++/** ++ * This function initializes the default values of the features ++ * for a specific endpoint and should be called only once when ++ * the EP is enabled first time. ++ */ ++static int cfi_ep_init_defaults(struct dwc_otg_pcd *pcd, cfi_ep_t * cfiep) ++{ ++ int retval = 0; ++ ++ cfiep->bm_sg = DWC_ALLOC(sizeof(ddma_sg_buffer_setup_t)); ++ if (NULL == cfiep->bm_sg) { ++ CFI_INFO("Failed to allocate memory for SG feature value\n"); ++ return -DWC_E_NO_MEMORY; ++ } ++ dwc_memset(cfiep->bm_sg, 0, sizeof(ddma_sg_buffer_setup_t)); ++ ++ /* For the Concatenation feature's default value we do not allocate ++ * memory for the wTxBytes field - it will be done in the set_feature_value ++ * request handler. ++ */ ++ cfiep->bm_concat = DWC_ALLOC(sizeof(ddma_concat_buffer_setup_t)); ++ if (NULL == cfiep->bm_concat) { ++ CFI_INFO ++ ("Failed to allocate memory for CONCATENATION feature value\n"); ++ DWC_FREE(cfiep->bm_sg); ++ return -DWC_E_NO_MEMORY; ++ } ++ dwc_memset(cfiep->bm_concat, 0, sizeof(ddma_concat_buffer_setup_t)); ++ ++ cfiep->bm_align = DWC_ALLOC(sizeof(ddma_align_buffer_setup_t)); ++ if (NULL == cfiep->bm_align) { ++ CFI_INFO ++ ("Failed to allocate memory for Alignment feature value\n"); ++ DWC_FREE(cfiep->bm_sg); ++ DWC_FREE(cfiep->bm_concat); ++ return -DWC_E_NO_MEMORY; ++ } ++ dwc_memset(cfiep->bm_align, 0, sizeof(ddma_align_buffer_setup_t)); ++ ++ return retval; ++} ++ ++/** ++ * The callback function that notifies the CFI on the activation of ++ * an endpoint in the PCD. The following steps are done in this function: ++ * ++ * Create a dynamically allocated cfi_ep_t object (a CFI wrapper to the PCD's ++ * active endpoint) ++ * Create MAX_DMA_DESCS_PER_EP count DMA Descriptors for the EP ++ * Set the Buffer Mode to standard ++ * Initialize the default values for all EP modes (SG, Circular, Concat, Align) ++ * Add the cfi_ep_t object to the list of active endpoints in the CFI object ++ */ ++static int cfi_ep_enable(struct cfiobject *cfi, struct dwc_otg_pcd *pcd, ++ struct dwc_otg_pcd_ep *ep) ++{ ++ cfi_ep_t *cfiep; ++ int retval = -DWC_E_NOT_SUPPORTED; ++ ++ CFI_INFO("%s: epname=%s; epnum=0x%02x\n", __func__, ++ "EP_" /*ep->ep.name */ , ep->desc->bEndpointAddress); ++ /* MAS - Check whether this endpoint already is in the list */ ++ cfiep = get_cfi_ep_by_pcd_ep(cfi, ep); ++ ++ if (NULL == cfiep) { ++ /* Allocate a cfi_ep_t object */ ++ cfiep = DWC_ALLOC(sizeof(cfi_ep_t)); ++ if (NULL == cfiep) { ++ CFI_INFO ++ ("Unable to allocate memory for <cfiep> in function %s\n", ++ __func__); ++ return -DWC_E_NO_MEMORY; ++ } ++ dwc_memset(cfiep, 0, sizeof(cfi_ep_t)); ++ ++ /* Save the dwc_otg_pcd_ep pointer in the cfiep object */ ++ cfiep->ep = ep; ++ ++ /* Allocate the DMA Descriptors chain of MAX_DMA_DESCS_PER_EP count */ ++ ep->dwc_ep.descs = ++ DWC_DMA_ALLOC(MAX_DMA_DESCS_PER_EP * ++ sizeof(dwc_otg_dma_desc_t), ++ &ep->dwc_ep.descs_dma_addr); ++ ++ if (NULL == ep->dwc_ep.descs) { ++ DWC_FREE(cfiep); ++ return -DWC_E_NO_MEMORY; ++ } ++ ++ DWC_LIST_INIT(&cfiep->lh); ++ ++ /* Set the buffer mode to BM_STANDARD. It will be modified ++ * when building descriptors for a specific buffer mode */ ++ ep->dwc_ep.buff_mode = BM_STANDARD; ++ ++ /* Create and initialize the default values for this EP's Buffer modes */ ++ if ((retval = cfi_ep_init_defaults(pcd, cfiep)) < 0) ++ return retval; ++ ++ /* Add the cfi_ep_t object to the CFI object's list of active endpoints */ ++ DWC_LIST_INSERT_TAIL(&cfi->active_eps, &cfiep->lh); ++ retval = 0; ++ } else { /* The sought EP already is in the list */ ++ CFI_INFO("%s: The sought EP already is in the list\n", ++ __func__); ++ } ++ ++ return retval; ++} ++ ++/** ++ * This function is called when the data stage of a 3-stage Control Write request ++ * is complete. ++ * ++ */ ++static int cfi_ctrl_write_complete(struct cfiobject *cfi, ++ struct dwc_otg_pcd *pcd) ++{ ++ uint32_t addr, reg_value; ++ uint16_t wIndex, wValue; ++ uint8_t bRequest; ++ uint8_t *buf = cfi->buf_out.buf; ++ //struct usb_ctrlrequest *ctrl_req = &cfi->ctrl_req_saved; ++ struct cfi_usb_ctrlrequest *ctrl_req = &cfi->ctrl_req; ++ int retval = -DWC_E_NOT_SUPPORTED; ++ ++ CFI_INFO("%s\n", __func__); ++ ++ bRequest = ctrl_req->bRequest; ++ wIndex = DWC_CONSTANT_CPU_TO_LE16(ctrl_req->wIndex); ++ wValue = DWC_CONSTANT_CPU_TO_LE16(ctrl_req->wValue); ++ ++ /* ++ * Save the pointer to the data stage in the ctrl_req's <data> field. ++ * The request should be already saved in the command stage by now. ++ */ ++ ctrl_req->data = cfi->buf_out.buf; ++ cfi->need_status_in_complete = 0; ++ cfi->need_gadget_att = 0; ++ ++ switch (bRequest) { ++ case VEN_CORE_WRITE_REGISTER: ++ /* The buffer contains raw data of the new value for the register */ ++ reg_value = *((uint32_t *) buf); ++ if (wValue == 0) { ++ addr = 0; ++ //addr = (uint32_t) pcd->otg_dev->os_dep.base; ++ addr += wIndex; ++ } else { ++ addr = (wValue << 16) | wIndex; ++ } ++ ++ //writel(reg_value, addr); ++ ++ retval = 0; ++ cfi->need_status_in_complete = 1; ++ break; ++ ++ case VEN_CORE_SET_FEATURE: ++ /* The buffer contains raw data of the new value of the feature */ ++ retval = cfi_set_feature_value(pcd); ++ if (retval < 0) ++ return retval; ++ ++ cfi->need_status_in_complete = 1; ++ break; ++ ++ default: ++ break; ++ } ++ ++ return retval; ++} ++ ++/** ++ * This function builds the DMA descriptors for the SG buffer mode. ++ */ ++static void cfi_build_sg_descs(struct cfiobject *cfi, cfi_ep_t * cfiep, ++ dwc_otg_pcd_request_t * req) ++{ ++ struct dwc_otg_pcd_ep *ep = cfiep->ep; ++ ddma_sg_buffer_setup_t *sgval = cfiep->bm_sg; ++ struct dwc_otg_dma_desc *desc = cfiep->ep->dwc_ep.descs; ++ struct dwc_otg_dma_desc *desc_last = cfiep->ep->dwc_ep.descs; ++ dma_addr_t buff_addr = req->dma; ++ int i; ++ uint32_t txsize, off; ++ ++ txsize = sgval->wSize; ++ off = sgval->bOffset; ++ ++// CFI_INFO("%s: %s TXSIZE=0x%08x; OFFSET=0x%08x\n", ++// __func__, cfiep->ep->ep.name, txsize, off); ++ ++ for (i = 0; i < sgval->bCount; i++) { ++ desc->status.b.bs = BS_HOST_BUSY; ++ desc->buf = buff_addr; ++ desc->status.b.l = 0; ++ desc->status.b.ioc = 0; ++ desc->status.b.sp = 0; ++ desc->status.b.bytes = txsize; ++ desc->status.b.bs = BS_HOST_READY; ++ ++ /* Set the next address of the buffer */ ++ buff_addr += txsize + off; ++ desc_last = desc; ++ desc++; ++ } ++ ++ /* Set the last, ioc and sp bits on the Last DMA Descriptor */ ++ desc_last->status.b.l = 1; ++ desc_last->status.b.ioc = 1; ++ desc_last->status.b.sp = ep->dwc_ep.sent_zlp; ++ /* Save the last DMA descriptor pointer */ ++ cfiep->dma_desc_last = desc_last; ++ cfiep->desc_count = sgval->bCount; ++} ++ ++/** ++ * This function builds the DMA descriptors for the Concatenation buffer mode. ++ */ ++static void cfi_build_concat_descs(struct cfiobject *cfi, cfi_ep_t * cfiep, ++ dwc_otg_pcd_request_t * req) ++{ ++ struct dwc_otg_pcd_ep *ep = cfiep->ep; ++ ddma_concat_buffer_setup_t *concatval = cfiep->bm_concat; ++ struct dwc_otg_dma_desc *desc = cfiep->ep->dwc_ep.descs; ++ struct dwc_otg_dma_desc *desc_last = cfiep->ep->dwc_ep.descs; ++ dma_addr_t buff_addr = req->dma; ++ int i; ++ uint16_t *txsize; ++ ++ txsize = concatval->wTxBytes; ++ ++ for (i = 0; i < concatval->hdr.bDescCount; i++) { ++ desc->buf = buff_addr; ++ desc->status.b.bs = BS_HOST_BUSY; ++ desc->status.b.l = 0; ++ desc->status.b.ioc = 0; ++ desc->status.b.sp = 0; ++ desc->status.b.bytes = *txsize; ++ desc->status.b.bs = BS_HOST_READY; ++ ++ txsize++; ++ /* Set the next address of the buffer */ ++ buff_addr += UGETW(ep->desc->wMaxPacketSize); ++ desc_last = desc; ++ desc++; ++ } ++ ++ /* Set the last, ioc and sp bits on the Last DMA Descriptor */ ++ desc_last->status.b.l = 1; ++ desc_last->status.b.ioc = 1; ++ desc_last->status.b.sp = ep->dwc_ep.sent_zlp; ++ cfiep->dma_desc_last = desc_last; ++ cfiep->desc_count = concatval->hdr.bDescCount; ++} ++ ++/** ++ * This function builds the DMA descriptors for the Circular buffer mode ++ */ ++static void cfi_build_circ_descs(struct cfiobject *cfi, cfi_ep_t * cfiep, ++ dwc_otg_pcd_request_t * req) ++{ ++ /* @todo: MAS - add implementation when this feature needs to be tested */ ++} ++ ++/** ++ * This function builds the DMA descriptors for the Alignment buffer mode ++ */ ++static void cfi_build_align_descs(struct cfiobject *cfi, cfi_ep_t * cfiep, ++ dwc_otg_pcd_request_t * req) ++{ ++ struct dwc_otg_pcd_ep *ep = cfiep->ep; ++ ddma_align_buffer_setup_t *alignval = cfiep->bm_align; ++ struct dwc_otg_dma_desc *desc = cfiep->ep->dwc_ep.descs; ++ dma_addr_t buff_addr = req->dma; ++ ++ desc->status.b.bs = BS_HOST_BUSY; ++ desc->status.b.l = 1; ++ desc->status.b.ioc = 1; ++ desc->status.b.sp = ep->dwc_ep.sent_zlp; ++ desc->status.b.bytes = req->length; ++ /* Adjust the buffer alignment */ ++ desc->buf = (buff_addr + alignval->bAlign); ++ desc->status.b.bs = BS_HOST_READY; ++ cfiep->dma_desc_last = desc; ++ cfiep->desc_count = 1; ++} ++ ++/** ++ * This function builds the DMA descriptors chain for different modes of the ++ * buffer setup of an endpoint. ++ */ ++static void cfi_build_descriptors(struct cfiobject *cfi, ++ struct dwc_otg_pcd *pcd, ++ struct dwc_otg_pcd_ep *ep, ++ dwc_otg_pcd_request_t * req) ++{ ++ cfi_ep_t *cfiep; ++ ++ /* Get the cfiep by the dwc_otg_pcd_ep */ ++ cfiep = get_cfi_ep_by_pcd_ep(cfi, ep); ++ if (NULL == cfiep) { ++ CFI_INFO("%s: Unable to find a matching active endpoint\n", ++ __func__); ++ return; ++ } ++ ++ cfiep->xfer_len = req->length; ++ ++ /* Iterate through all the DMA descriptors */ ++ switch (cfiep->ep->dwc_ep.buff_mode) { ++ case BM_SG: ++ cfi_build_sg_descs(cfi, cfiep, req); ++ break; ++ ++ case BM_CONCAT: ++ cfi_build_concat_descs(cfi, cfiep, req); ++ break; ++ ++ case BM_CIRCULAR: ++ cfi_build_circ_descs(cfi, cfiep, req); ++ break; ++ ++ case BM_ALIGN: ++ cfi_build_align_descs(cfi, cfiep, req); ++ break; ++ ++ default: ++ break; ++ } ++} ++ ++/** ++ * Allocate DMA buffer for different Buffer modes. ++ */ ++static void *cfi_ep_alloc_buf(struct cfiobject *cfi, struct dwc_otg_pcd *pcd, ++ struct dwc_otg_pcd_ep *ep, dma_addr_t * dma, ++ unsigned size, gfp_t flags) ++{ ++ return DWC_DMA_ALLOC(size, dma); ++} ++ ++/** ++ * This function initializes the CFI object. ++ */ ++int init_cfi(cfiobject_t * cfiobj) ++{ ++ CFI_INFO("%s\n", __func__); ++ ++ /* Allocate a buffer for IN XFERs */ ++ cfiobj->buf_in.buf = ++ DWC_DMA_ALLOC(CFI_IN_BUF_LEN, &cfiobj->buf_in.addr); ++ if (NULL == cfiobj->buf_in.buf) { ++ CFI_INFO("Unable to allocate buffer for INs\n"); ++ return -DWC_E_NO_MEMORY; ++ } ++ ++ /* Allocate a buffer for OUT XFERs */ ++ cfiobj->buf_out.buf = ++ DWC_DMA_ALLOC(CFI_OUT_BUF_LEN, &cfiobj->buf_out.addr); ++ if (NULL == cfiobj->buf_out.buf) { ++ CFI_INFO("Unable to allocate buffer for OUT\n"); ++ return -DWC_E_NO_MEMORY; ++ } ++ ++ /* Initialize the callback function pointers */ ++ cfiobj->ops.release = cfi_release; ++ cfiobj->ops.ep_enable = cfi_ep_enable; ++ cfiobj->ops.ctrl_write_complete = cfi_ctrl_write_complete; ++ cfiobj->ops.build_descriptors = cfi_build_descriptors; ++ cfiobj->ops.ep_alloc_buf = cfi_ep_alloc_buf; ++ ++ /* Initialize the list of active endpoints in the CFI object */ ++ DWC_LIST_INIT(&cfiobj->active_eps); ++ ++ return 0; ++} ++ ++/** ++ * This function reads the required feature's current value into the buffer ++ * ++ * @retval: Returns negative as error, or the data length of the feature ++ */ ++static int cfi_get_feature_value(uint8_t * buf, uint16_t buflen, ++ struct dwc_otg_pcd *pcd, ++ struct cfi_usb_ctrlrequest *ctrl_req) ++{ ++ int retval = -DWC_E_NOT_SUPPORTED; ++ struct dwc_otg_core_if *coreif = GET_CORE_IF(pcd); ++ uint16_t dfifo, rxfifo, txfifo; ++ ++ switch (ctrl_req->wIndex) { ++ /* Whether the DDMA is enabled or not */ ++ case FT_ID_DMA_MODE: ++ *buf = (coreif->dma_enable && coreif->dma_desc_enable) ? 1 : 0; ++ retval = 1; ++ break; ++ ++ case FT_ID_DMA_BUFFER_SETUP: ++ retval = cfi_ep_get_sg_val(buf, pcd, ctrl_req); ++ break; ++ ++ case FT_ID_DMA_BUFF_ALIGN: ++ retval = cfi_ep_get_align_val(buf, pcd, ctrl_req); ++ break; ++ ++ case FT_ID_DMA_CONCAT_SETUP: ++ retval = cfi_ep_get_concat_val(buf, pcd, ctrl_req); ++ break; ++ ++ case FT_ID_DMA_CIRCULAR: ++ CFI_INFO("GetFeature value (FT_ID_DMA_CIRCULAR)\n"); ++ break; ++ ++ case FT_ID_THRESHOLD_SETUP: ++ CFI_INFO("GetFeature value (FT_ID_THRESHOLD_SETUP)\n"); ++ break; ++ ++ case FT_ID_DFIFO_DEPTH: ++ dfifo = get_dfifo_size(coreif); ++ *((uint16_t *) buf) = dfifo; ++ retval = sizeof(uint16_t); ++ break; ++ ++ case FT_ID_TX_FIFO_DEPTH: ++ retval = get_txfifo_size(pcd, ctrl_req->wValue); ++ if (retval >= 0) { ++ txfifo = retval; ++ *((uint16_t *) buf) = txfifo; ++ retval = sizeof(uint16_t); ++ } ++ break; ++ ++ case FT_ID_RX_FIFO_DEPTH: ++ retval = get_rxfifo_size(coreif, ctrl_req->wValue); ++ if (retval >= 0) { ++ rxfifo = retval; ++ *((uint16_t *) buf) = rxfifo; ++ retval = sizeof(uint16_t); ++ } ++ break; ++ } ++ ++ return retval; ++} ++ ++/** ++ * This function resets the SG for the specified EP to its default value ++ */ ++static int cfi_reset_sg_val(cfi_ep_t * cfiep) ++{ ++ dwc_memset(cfiep->bm_sg, 0, sizeof(ddma_sg_buffer_setup_t)); ++ return 0; ++} ++ ++/** ++ * This function resets the Alignment for the specified EP to its default value ++ */ ++static int cfi_reset_align_val(cfi_ep_t * cfiep) ++{ ++ dwc_memset(cfiep->bm_sg, 0, sizeof(ddma_sg_buffer_setup_t)); ++ return 0; ++} ++ ++/** ++ * This function resets the Concatenation for the specified EP to its default value ++ * This function will also set the value of the wTxBytes field to NULL after ++ * freeing the memory previously allocated for this field. ++ */ ++static int cfi_reset_concat_val(cfi_ep_t * cfiep) ++{ ++ /* First we need to free the wTxBytes field */ ++ if (cfiep->bm_concat->wTxBytes) { ++ DWC_FREE(cfiep->bm_concat->wTxBytes); ++ cfiep->bm_concat->wTxBytes = NULL; ++ } ++ ++ dwc_memset(cfiep->bm_concat, 0, sizeof(ddma_concat_buffer_setup_t)); ++ return 0; ++} ++ ++/** ++ * This function resets all the buffer setups of the specified endpoint ++ */ ++static int cfi_ep_reset_all_setup_vals(cfi_ep_t * cfiep) ++{ ++ cfi_reset_sg_val(cfiep); ++ cfi_reset_align_val(cfiep); ++ cfi_reset_concat_val(cfiep); ++ return 0; ++} ++ ++static int cfi_handle_reset_fifo_val(struct dwc_otg_pcd *pcd, uint8_t ep_addr, ++ uint8_t rx_rst, uint8_t tx_rst) ++{ ++ int retval = -DWC_E_INVALID; ++ uint16_t tx_siz[15]; ++ uint16_t rx_siz = 0; ++ dwc_otg_pcd_ep_t *ep = NULL; ++ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); ++ dwc_otg_core_params_t *params = GET_CORE_IF(pcd)->core_params; ++ ++ if (rx_rst) { ++ rx_siz = params->dev_rx_fifo_size; ++ params->dev_rx_fifo_size = GET_CORE_IF(pcd)->init_rxfsiz; ++ } ++ ++ if (tx_rst) { ++ if (ep_addr == 0) { ++ int i; ++ ++ for (i = 0; i < core_if->hwcfg4.b.num_in_eps; i++) { ++ tx_siz[i] = ++ core_if->core_params->dev_tx_fifo_size[i]; ++ core_if->core_params->dev_tx_fifo_size[i] = ++ core_if->init_txfsiz[i]; ++ } ++ } else { ++ ++ ep = get_ep_by_addr(pcd, ep_addr); ++ ++ if (NULL == ep) { ++ CFI_INFO ++ ("%s: Unable to get the endpoint addr=0x%02x\n", ++ __func__, ep_addr); ++ return -DWC_E_INVALID; ++ } ++ ++ tx_siz[0] = ++ params->dev_tx_fifo_size[ep->dwc_ep.tx_fifo_num - ++ 1]; ++ params->dev_tx_fifo_size[ep->dwc_ep.tx_fifo_num - 1] = ++ GET_CORE_IF(pcd)->init_txfsiz[ep-> ++ dwc_ep.tx_fifo_num - ++ 1]; ++ } ++ } ++ ++ if (resize_fifos(GET_CORE_IF(pcd))) { ++ retval = 0; ++ } else { ++ CFI_INFO ++ ("%s: Error resetting the feature Reset All(FIFO size)\n", ++ __func__); ++ if (rx_rst) { ++ params->dev_rx_fifo_size = rx_siz; ++ } ++ ++ if (tx_rst) { ++ if (ep_addr == 0) { ++ int i; ++ for (i = 0; i < core_if->hwcfg4.b.num_in_eps; ++ i++) { ++ core_if-> ++ core_params->dev_tx_fifo_size[i] = ++ tx_siz[i]; ++ } ++ } else { ++ params->dev_tx_fifo_size[ep-> ++ dwc_ep.tx_fifo_num - ++ 1] = tx_siz[0]; ++ } ++ } ++ retval = -DWC_E_INVALID; ++ } ++ return retval; ++} ++ ++static int cfi_handle_reset_all(struct dwc_otg_pcd *pcd, uint8_t addr) ++{ ++ int retval = 0; ++ cfi_ep_t *cfiep; ++ cfiobject_t *cfi = pcd->cfi; ++ dwc_list_link_t *tmp; ++ ++ retval = cfi_handle_reset_fifo_val(pcd, addr, 1, 1); ++ if (retval < 0) { ++ return retval; ++ } ++ ++ /* If the EP address is known then reset the features for only that EP */ ++ if (addr) { ++ cfiep = get_cfi_ep_by_addr(pcd->cfi, addr); ++ if (NULL == cfiep) { ++ CFI_INFO("%s: Error getting the EP address 0x%02x\n", ++ __func__, addr); ++ return -DWC_E_INVALID; ++ } ++ retval = cfi_ep_reset_all_setup_vals(cfiep); ++ cfiep->ep->dwc_ep.buff_mode = BM_STANDARD; ++ } ++ /* Otherwise (wValue == 0), reset all features of all EP's */ ++ else { ++ /* Traverse all the active EP's and reset the feature(s) value(s) */ ++ //list_for_each_entry(cfiep, &cfi->active_eps, lh) { ++ DWC_LIST_FOREACH(tmp, &cfi->active_eps) { ++ cfiep = DWC_LIST_ENTRY(tmp, struct cfi_ep, lh); ++ retval = cfi_ep_reset_all_setup_vals(cfiep); ++ cfiep->ep->dwc_ep.buff_mode = BM_STANDARD; ++ if (retval < 0) { ++ CFI_INFO ++ ("%s: Error resetting the feature Reset All\n", ++ __func__); ++ return retval; ++ } ++ } ++ } ++ return retval; ++} ++ ++static int cfi_handle_reset_dma_buff_setup(struct dwc_otg_pcd *pcd, ++ uint8_t addr) ++{ ++ int retval = 0; ++ cfi_ep_t *cfiep; ++ cfiobject_t *cfi = pcd->cfi; ++ dwc_list_link_t *tmp; ++ ++ /* If the EP address is known then reset the features for only that EP */ ++ if (addr) { ++ cfiep = get_cfi_ep_by_addr(pcd->cfi, addr); ++ if (NULL == cfiep) { ++ CFI_INFO("%s: Error getting the EP address 0x%02x\n", ++ __func__, addr); ++ return -DWC_E_INVALID; ++ } ++ retval = cfi_reset_sg_val(cfiep); ++ } ++ /* Otherwise (wValue == 0), reset all features of all EP's */ ++ else { ++ /* Traverse all the active EP's and reset the feature(s) value(s) */ ++ //list_for_each_entry(cfiep, &cfi->active_eps, lh) { ++ DWC_LIST_FOREACH(tmp, &cfi->active_eps) { ++ cfiep = DWC_LIST_ENTRY(tmp, struct cfi_ep, lh); ++ retval = cfi_reset_sg_val(cfiep); ++ if (retval < 0) { ++ CFI_INFO ++ ("%s: Error resetting the feature Buffer Setup\n", ++ __func__); ++ return retval; ++ } ++ } ++ } ++ return retval; ++} ++ ++static int cfi_handle_reset_concat_val(struct dwc_otg_pcd *pcd, uint8_t addr) ++{ ++ int retval = 0; ++ cfi_ep_t *cfiep; ++ cfiobject_t *cfi = pcd->cfi; ++ dwc_list_link_t *tmp; ++ ++ /* If the EP address is known then reset the features for only that EP */ ++ if (addr) { ++ cfiep = get_cfi_ep_by_addr(pcd->cfi, addr); ++ if (NULL == cfiep) { ++ CFI_INFO("%s: Error getting the EP address 0x%02x\n", ++ __func__, addr); ++ return -DWC_E_INVALID; ++ } ++ retval = cfi_reset_concat_val(cfiep); ++ } ++ /* Otherwise (wValue == 0), reset all features of all EP's */ ++ else { ++ /* Traverse all the active EP's and reset the feature(s) value(s) */ ++ //list_for_each_entry(cfiep, &cfi->active_eps, lh) { ++ DWC_LIST_FOREACH(tmp, &cfi->active_eps) { ++ cfiep = DWC_LIST_ENTRY(tmp, struct cfi_ep, lh); ++ retval = cfi_reset_concat_val(cfiep); ++ if (retval < 0) { ++ CFI_INFO ++ ("%s: Error resetting the feature Concatenation Value\n", ++ __func__); ++ return retval; ++ } ++ } ++ } ++ return retval; ++} ++ ++static int cfi_handle_reset_align_val(struct dwc_otg_pcd *pcd, uint8_t addr) ++{ ++ int retval = 0; ++ cfi_ep_t *cfiep; ++ cfiobject_t *cfi = pcd->cfi; ++ dwc_list_link_t *tmp; ++ ++ /* If the EP address is known then reset the features for only that EP */ ++ if (addr) { ++ cfiep = get_cfi_ep_by_addr(pcd->cfi, addr); ++ if (NULL == cfiep) { ++ CFI_INFO("%s: Error getting the EP address 0x%02x\n", ++ __func__, addr); ++ return -DWC_E_INVALID; ++ } ++ retval = cfi_reset_align_val(cfiep); ++ } ++ /* Otherwise (wValue == 0), reset all features of all EP's */ ++ else { ++ /* Traverse all the active EP's and reset the feature(s) value(s) */ ++ //list_for_each_entry(cfiep, &cfi->active_eps, lh) { ++ DWC_LIST_FOREACH(tmp, &cfi->active_eps) { ++ cfiep = DWC_LIST_ENTRY(tmp, struct cfi_ep, lh); ++ retval = cfi_reset_align_val(cfiep); ++ if (retval < 0) { ++ CFI_INFO ++ ("%s: Error resetting the feature Aliignment Value\n", ++ __func__); ++ return retval; ++ } ++ } ++ } ++ return retval; ++ ++} ++ ++static int cfi_preproc_reset(struct dwc_otg_pcd *pcd, ++ struct cfi_usb_ctrlrequest *req) ++{ ++ int retval = 0; ++ ++ switch (req->wIndex) { ++ case 0: ++ /* Reset all features */ ++ retval = cfi_handle_reset_all(pcd, req->wValue & 0xff); ++ break; ++ ++ case FT_ID_DMA_BUFFER_SETUP: ++ /* Reset the SG buffer setup */ ++ retval = ++ cfi_handle_reset_dma_buff_setup(pcd, req->wValue & 0xff); ++ break; ++ ++ case FT_ID_DMA_CONCAT_SETUP: ++ /* Reset the Concatenation buffer setup */ ++ retval = cfi_handle_reset_concat_val(pcd, req->wValue & 0xff); ++ break; ++ ++ case FT_ID_DMA_BUFF_ALIGN: ++ /* Reset the Alignment buffer setup */ ++ retval = cfi_handle_reset_align_val(pcd, req->wValue & 0xff); ++ break; ++ ++ case FT_ID_TX_FIFO_DEPTH: ++ retval = ++ cfi_handle_reset_fifo_val(pcd, req->wValue & 0xff, 0, 1); ++ pcd->cfi->need_gadget_att = 0; ++ break; ++ ++ case FT_ID_RX_FIFO_DEPTH: ++ retval = cfi_handle_reset_fifo_val(pcd, 0, 1, 0); ++ pcd->cfi->need_gadget_att = 0; ++ break; ++ default: ++ break; ++ } ++ return retval; ++} ++ ++/** ++ * This function sets a new value for the SG buffer setup. ++ */ ++static int cfi_ep_set_sg_val(uint8_t * buf, struct dwc_otg_pcd *pcd) ++{ ++ uint8_t inaddr, outaddr; ++ cfi_ep_t *epin, *epout; ++ ddma_sg_buffer_setup_t *psgval; ++ uint32_t desccount, size; ++ ++ CFI_INFO("%s\n", __func__); ++ ++ psgval = (ddma_sg_buffer_setup_t *) buf; ++ desccount = (uint32_t) psgval->bCount; ++ size = (uint32_t) psgval->wSize; ++ ++ /* Check the DMA descriptor count */ ++ if ((desccount > MAX_DMA_DESCS_PER_EP) || (desccount == 0)) { ++ CFI_INFO ++ ("%s: The count of DMA Descriptors should be between 1 and %d\n", ++ __func__, MAX_DMA_DESCS_PER_EP); ++ return -DWC_E_INVALID; ++ } ++ ++ /* Check the DMA descriptor count */ ++ ++ if (size == 0) { ++ ++ CFI_INFO("%s: The transfer size should be at least 1 byte\n", ++ __func__); ++ ++ return -DWC_E_INVALID; ++ ++ } ++ ++ inaddr = psgval->bInEndpointAddress; ++ outaddr = psgval->bOutEndpointAddress; ++ ++ epin = get_cfi_ep_by_addr(pcd->cfi, inaddr); ++ epout = get_cfi_ep_by_addr(pcd->cfi, outaddr); ++ ++ if (NULL == epin || NULL == epout) { ++ CFI_INFO ++ ("%s: Unable to get the endpoints inaddr=0x%02x outaddr=0x%02x\n", ++ __func__, inaddr, outaddr); ++ return -DWC_E_INVALID; ++ } ++ ++ epin->ep->dwc_ep.buff_mode = BM_SG; ++ dwc_memcpy(epin->bm_sg, psgval, sizeof(ddma_sg_buffer_setup_t)); ++ ++ epout->ep->dwc_ep.buff_mode = BM_SG; ++ dwc_memcpy(epout->bm_sg, psgval, sizeof(ddma_sg_buffer_setup_t)); ++ ++ return 0; ++} ++ ++/** ++ * This function sets a new value for the buffer Alignment setup. ++ */ ++static int cfi_ep_set_alignment_val(uint8_t * buf, struct dwc_otg_pcd *pcd) ++{ ++ cfi_ep_t *ep; ++ uint8_t addr; ++ ddma_align_buffer_setup_t *palignval; ++ ++ palignval = (ddma_align_buffer_setup_t *) buf; ++ addr = palignval->bEndpointAddress; ++ ++ ep = get_cfi_ep_by_addr(pcd->cfi, addr); ++ ++ if (NULL == ep) { ++ CFI_INFO("%s: Unable to get the endpoint addr=0x%02x\n", ++ __func__, addr); ++ return -DWC_E_INVALID; ++ } ++ ++ ep->ep->dwc_ep.buff_mode = BM_ALIGN; ++ dwc_memcpy(ep->bm_align, palignval, sizeof(ddma_align_buffer_setup_t)); ++ ++ return 0; ++} ++ ++/** ++ * This function sets a new value for the Concatenation buffer setup. ++ */ ++static int cfi_ep_set_concat_val(uint8_t * buf, struct dwc_otg_pcd *pcd) ++{ ++ uint8_t addr; ++ cfi_ep_t *ep; ++ struct _ddma_concat_buffer_setup_hdr *pConcatValHdr; ++ uint16_t *pVals; ++ uint32_t desccount; ++ int i; ++ uint16_t mps; ++ ++ pConcatValHdr = (struct _ddma_concat_buffer_setup_hdr *)buf; ++ desccount = (uint32_t) pConcatValHdr->bDescCount; ++ pVals = (uint16_t *) (buf + BS_CONCAT_VAL_HDR_LEN); ++ ++ /* Check the DMA descriptor count */ ++ if (desccount > MAX_DMA_DESCS_PER_EP) { ++ CFI_INFO("%s: Maximum DMA Descriptor count should be %d\n", ++ __func__, MAX_DMA_DESCS_PER_EP); ++ return -DWC_E_INVALID; ++ } ++ ++ addr = pConcatValHdr->bEndpointAddress; ++ ep = get_cfi_ep_by_addr(pcd->cfi, addr); ++ if (NULL == ep) { ++ CFI_INFO("%s: Unable to get the endpoint addr=0x%02x\n", ++ __func__, addr); ++ return -DWC_E_INVALID; ++ } ++ ++ mps = UGETW(ep->ep->desc->wMaxPacketSize); ++ ++#if 0 ++ for (i = 0; i < desccount; i++) { ++ CFI_INFO("%s: wTxSize[%d]=0x%04x\n", __func__, i, pVals[i]); ++ } ++ CFI_INFO("%s: epname=%s; mps=%d\n", __func__, ep->ep->ep.name, mps); ++#endif ++ ++ /* Check the wTxSizes to be less than or equal to the mps */ ++ for (i = 0; i < desccount; i++) { ++ if (pVals[i] > mps) { ++ CFI_INFO ++ ("%s: ERROR - the wTxSize[%d] should be <= MPS (wTxSize=%d)\n", ++ __func__, i, pVals[i]); ++ return -DWC_E_INVALID; ++ } ++ } ++ ++ ep->ep->dwc_ep.buff_mode = BM_CONCAT; ++ dwc_memcpy(ep->bm_concat, pConcatValHdr, BS_CONCAT_VAL_HDR_LEN); ++ ++ /* Free the previously allocated storage for the wTxBytes */ ++ if (ep->bm_concat->wTxBytes) { ++ DWC_FREE(ep->bm_concat->wTxBytes); ++ } ++ ++ /* Allocate a new storage for the wTxBytes field */ ++ ep->bm_concat->wTxBytes = ++ DWC_ALLOC(sizeof(uint16_t) * pConcatValHdr->bDescCount); ++ if (NULL == ep->bm_concat->wTxBytes) { ++ CFI_INFO("%s: Unable to allocate memory\n", __func__); ++ return -DWC_E_NO_MEMORY; ++ } ++ ++ /* Copy the new values into the wTxBytes filed */ ++ dwc_memcpy(ep->bm_concat->wTxBytes, buf + BS_CONCAT_VAL_HDR_LEN, ++ sizeof(uint16_t) * pConcatValHdr->bDescCount); ++ ++ return 0; ++} ++ ++/** ++ * This function calculates the total of all FIFO sizes ++ * ++ * @param core_if Programming view of DWC_otg controller ++ * ++ * @return The total of data FIFO sizes. ++ * ++ */ ++static uint16_t get_dfifo_size(dwc_otg_core_if_t * core_if) ++{ ++ dwc_otg_core_params_t *params = core_if->core_params; ++ uint16_t dfifo_total = 0; ++ int i; ++ ++ /* The shared RxFIFO size */ ++ dfifo_total = ++ params->dev_rx_fifo_size + params->dev_nperio_tx_fifo_size; ++ ++ /* Add up each TxFIFO size to the total */ ++ for (i = 0; i < core_if->hwcfg4.b.num_in_eps; i++) { ++ dfifo_total += params->dev_tx_fifo_size[i]; ++ } ++ ++ return dfifo_total; ++} ++ ++/** ++ * This function returns Rx FIFO size ++ * ++ * @param core_if Programming view of DWC_otg controller ++ * ++ * @return The total of data FIFO sizes. ++ * ++ */ ++static int32_t get_rxfifo_size(dwc_otg_core_if_t * core_if, uint16_t wValue) ++{ ++ switch (wValue >> 8) { ++ case 0: ++ return (core_if->pwron_rxfsiz < ++ 32768) ? core_if->pwron_rxfsiz : 32768; ++ break; ++ case 1: ++ return core_if->core_params->dev_rx_fifo_size; ++ break; ++ default: ++ return -DWC_E_INVALID; ++ break; ++ } ++} ++ ++/** ++ * This function returns Tx FIFO size for IN EP ++ * ++ * @param core_if Programming view of DWC_otg controller ++ * ++ * @return The total of data FIFO sizes. ++ * ++ */ ++static int32_t get_txfifo_size(struct dwc_otg_pcd *pcd, uint16_t wValue) ++{ ++ dwc_otg_pcd_ep_t *ep; ++ ++ ep = get_ep_by_addr(pcd, wValue & 0xff); ++ ++ if (NULL == ep) { ++ CFI_INFO("%s: Unable to get the endpoint addr=0x%02x\n", ++ __func__, wValue & 0xff); ++ return -DWC_E_INVALID; ++ } ++ ++ if (!ep->dwc_ep.is_in) { ++ CFI_INFO ++ ("%s: No Tx FIFO assingned to the Out endpoint addr=0x%02x\n", ++ __func__, wValue & 0xff); ++ return -DWC_E_INVALID; ++ } ++ ++ switch (wValue >> 8) { ++ case 0: ++ return (GET_CORE_IF(pcd)->pwron_txfsiz ++ [ep->dwc_ep.tx_fifo_num - 1] < ++ 768) ? GET_CORE_IF(pcd)->pwron_txfsiz[ep-> ++ dwc_ep.tx_fifo_num ++ - 1] : 32768; ++ break; ++ case 1: ++ return GET_CORE_IF(pcd)->core_params-> ++ dev_tx_fifo_size[ep->dwc_ep.num - 1]; ++ break; ++ default: ++ return -DWC_E_INVALID; ++ break; ++ } ++} ++ ++/** ++ * This function checks if the submitted combination of ++ * device mode FIFO sizes is possible or not. ++ * ++ * @param core_if Programming view of DWC_otg controller ++ * ++ * @return 1 if possible, 0 otherwise. ++ * ++ */ ++static uint8_t check_fifo_sizes(dwc_otg_core_if_t * core_if) ++{ ++ uint16_t dfifo_actual = 0; ++ dwc_otg_core_params_t *params = core_if->core_params; ++ uint16_t start_addr = 0; ++ int i; ++ ++ dfifo_actual = ++ params->dev_rx_fifo_size + params->dev_nperio_tx_fifo_size; ++ ++ for (i = 0; i < core_if->hwcfg4.b.num_in_eps; i++) { ++ dfifo_actual += params->dev_tx_fifo_size[i]; ++ } ++ ++ if (dfifo_actual > core_if->total_fifo_size) { ++ return 0; ++ } ++ ++ if (params->dev_rx_fifo_size > 32768 || params->dev_rx_fifo_size < 16) ++ return 0; ++ ++ if (params->dev_nperio_tx_fifo_size > 32768 ++ || params->dev_nperio_tx_fifo_size < 16) ++ return 0; ++ ++ for (i = 0; i < core_if->hwcfg4.b.num_in_eps; i++) { ++ ++ if (params->dev_tx_fifo_size[i] > 768 ++ || params->dev_tx_fifo_size[i] < 4) ++ return 0; ++ } ++ ++ if (params->dev_rx_fifo_size > core_if->pwron_rxfsiz) ++ return 0; ++ start_addr = params->dev_rx_fifo_size; ++ ++ if (params->dev_nperio_tx_fifo_size > core_if->pwron_gnptxfsiz) ++ return 0; ++ start_addr += params->dev_nperio_tx_fifo_size; ++ ++ for (i = 0; i < core_if->hwcfg4.b.num_in_eps; i++) { ++ ++ if (params->dev_tx_fifo_size[i] > core_if->pwron_txfsiz[i]) ++ return 0; ++ start_addr += params->dev_tx_fifo_size[i]; ++ } ++ ++ return 1; ++} ++ ++/** ++ * This function resizes Device mode FIFOs ++ * ++ * @param core_if Programming view of DWC_otg controller ++ * ++ * @return 1 if successful, 0 otherwise ++ * ++ */ ++static uint8_t resize_fifos(dwc_otg_core_if_t * core_if) ++{ ++ int i = 0; ++ dwc_otg_core_global_regs_t *global_regs = core_if->core_global_regs; ++ dwc_otg_core_params_t *params = core_if->core_params; ++ uint32_t rx_fifo_size; ++ fifosize_data_t nptxfifosize; ++ fifosize_data_t txfifosize[15]; ++ ++ uint32_t rx_fsz_bak; ++ uint32_t nptxfsz_bak; ++ uint32_t txfsz_bak[15]; ++ ++ uint16_t start_address; ++ uint8_t retval = 1; ++ ++ if (!check_fifo_sizes(core_if)) { ++ return 0; ++ } ++ ++ /* Configure data FIFO sizes */ ++ if (core_if->hwcfg2.b.dynamic_fifo && params->enable_dynamic_fifo) { ++ rx_fsz_bak = DWC_READ_REG32(&global_regs->grxfsiz); ++ rx_fifo_size = params->dev_rx_fifo_size; ++ DWC_WRITE_REG32(&global_regs->grxfsiz, rx_fifo_size); ++ ++ /* ++ * Tx FIFOs These FIFOs are numbered from 1 to 15. ++ * Indexes of the FIFO size module parameters in the ++ * dev_tx_fifo_size array and the FIFO size registers in ++ * the dtxfsiz array run from 0 to 14. ++ */ ++ ++ /* Non-periodic Tx FIFO */ ++ nptxfsz_bak = DWC_READ_REG32(&global_regs->gnptxfsiz); ++ nptxfifosize.b.depth = params->dev_nperio_tx_fifo_size; ++ start_address = params->dev_rx_fifo_size; ++ nptxfifosize.b.startaddr = start_address; ++ ++ DWC_WRITE_REG32(&global_regs->gnptxfsiz, nptxfifosize.d32); ++ ++ start_address += nptxfifosize.b.depth; ++ ++ for (i = 0; i < core_if->hwcfg4.b.num_in_eps; i++) { ++ txfsz_bak[i] = DWC_READ_REG32(&global_regs->dtxfsiz[i]); ++ ++ txfifosize[i].b.depth = params->dev_tx_fifo_size[i]; ++ txfifosize[i].b.startaddr = start_address; ++ DWC_WRITE_REG32(&global_regs->dtxfsiz[i], ++ txfifosize[i].d32); ++ ++ start_address += txfifosize[i].b.depth; ++ } ++ ++ /** Check if register values are set correctly */ ++ if (rx_fifo_size != DWC_READ_REG32(&global_regs->grxfsiz)) { ++ retval = 0; ++ } ++ ++ if (nptxfifosize.d32 != DWC_READ_REG32(&global_regs->gnptxfsiz)) { ++ retval = 0; ++ } ++ ++ for (i = 0; i < core_if->hwcfg4.b.num_in_eps; i++) { ++ if (txfifosize[i].d32 != ++ DWC_READ_REG32(&global_regs->dtxfsiz[i])) { ++ retval = 0; ++ } ++ } ++ ++ /** If register values are not set correctly, reset old values */ ++ if (retval == 0) { ++ DWC_WRITE_REG32(&global_regs->grxfsiz, rx_fsz_bak); ++ ++ /* Non-periodic Tx FIFO */ ++ DWC_WRITE_REG32(&global_regs->gnptxfsiz, nptxfsz_bak); ++ ++ for (i = 0; i < core_if->hwcfg4.b.num_in_eps; i++) { ++ DWC_WRITE_REG32(&global_regs->dtxfsiz[i], ++ txfsz_bak[i]); ++ } ++ } ++ } else { ++ return 0; ++ } ++ ++ /* Flush the FIFOs */ ++ dwc_otg_flush_tx_fifo(core_if, 0x10); /* all Tx FIFOs */ ++ dwc_otg_flush_rx_fifo(core_if); ++ ++ return retval; ++} ++ ++/** ++ * This function sets a new value for the buffer Alignment setup. ++ */ ++static int cfi_ep_set_tx_fifo_val(uint8_t * buf, dwc_otg_pcd_t * pcd) ++{ ++ int retval; ++ uint32_t fsiz; ++ uint16_t size; ++ uint16_t ep_addr; ++ dwc_otg_pcd_ep_t *ep; ++ dwc_otg_core_params_t *params = GET_CORE_IF(pcd)->core_params; ++ tx_fifo_size_setup_t *ptxfifoval; ++ ++ ptxfifoval = (tx_fifo_size_setup_t *) buf; ++ ep_addr = ptxfifoval->bEndpointAddress; ++ size = ptxfifoval->wDepth; ++ ++ ep = get_ep_by_addr(pcd, ep_addr); ++ ++ CFI_INFO ++ ("%s: Set Tx FIFO size: endpoint addr=0x%02x, depth=%d, FIFO Num=%d\n", ++ __func__, ep_addr, size, ep->dwc_ep.tx_fifo_num); ++ ++ if (NULL == ep) { ++ CFI_INFO("%s: Unable to get the endpoint addr=0x%02x\n", ++ __func__, ep_addr); ++ return -DWC_E_INVALID; ++ } ++ ++ fsiz = params->dev_tx_fifo_size[ep->dwc_ep.tx_fifo_num - 1]; ++ params->dev_tx_fifo_size[ep->dwc_ep.tx_fifo_num - 1] = size; ++ ++ if (resize_fifos(GET_CORE_IF(pcd))) { ++ retval = 0; ++ } else { ++ CFI_INFO ++ ("%s: Error setting the feature Tx FIFO Size for EP%d\n", ++ __func__, ep_addr); ++ params->dev_tx_fifo_size[ep->dwc_ep.tx_fifo_num - 1] = fsiz; ++ retval = -DWC_E_INVALID; ++ } ++ ++ return retval; ++} ++ ++/** ++ * This function sets a new value for the buffer Alignment setup. ++ */ ++static int cfi_set_rx_fifo_val(uint8_t * buf, dwc_otg_pcd_t * pcd) ++{ ++ int retval; ++ uint32_t fsiz; ++ uint16_t size; ++ dwc_otg_core_params_t *params = GET_CORE_IF(pcd)->core_params; ++ rx_fifo_size_setup_t *prxfifoval; ++ ++ prxfifoval = (rx_fifo_size_setup_t *) buf; ++ size = prxfifoval->wDepth; ++ ++ fsiz = params->dev_rx_fifo_size; ++ params->dev_rx_fifo_size = size; ++ ++ if (resize_fifos(GET_CORE_IF(pcd))) { ++ retval = 0; ++ } else { ++ CFI_INFO("%s: Error setting the feature Rx FIFO Size\n", ++ __func__); ++ params->dev_rx_fifo_size = fsiz; ++ retval = -DWC_E_INVALID; ++ } ++ ++ return retval; ++} ++ ++/** ++ * This function reads the SG of an EP's buffer setup into the buffer buf ++ */ ++static int cfi_ep_get_sg_val(uint8_t * buf, struct dwc_otg_pcd *pcd, ++ struct cfi_usb_ctrlrequest *req) ++{ ++ int retval = -DWC_E_INVALID; ++ uint8_t addr; ++ cfi_ep_t *ep; ++ ++ /* The Low Byte of the wValue contains a non-zero address of the endpoint */ ++ addr = req->wValue & 0xFF; ++ if (addr == 0) /* The address should be non-zero */ ++ return retval; ++ ++ ep = get_cfi_ep_by_addr(pcd->cfi, addr); ++ if (NULL == ep) { ++ CFI_INFO("%s: Unable to get the endpoint address(0x%02x)\n", ++ __func__, addr); ++ return retval; ++ } ++ ++ dwc_memcpy(buf, ep->bm_sg, BS_SG_VAL_DESC_LEN); ++ retval = BS_SG_VAL_DESC_LEN; ++ return retval; ++} ++ ++/** ++ * This function reads the Concatenation value of an EP's buffer mode into ++ * the buffer buf ++ */ ++static int cfi_ep_get_concat_val(uint8_t * buf, struct dwc_otg_pcd *pcd, ++ struct cfi_usb_ctrlrequest *req) ++{ ++ int retval = -DWC_E_INVALID; ++ uint8_t addr; ++ cfi_ep_t *ep; ++ uint8_t desc_count; ++ ++ /* The Low Byte of the wValue contains a non-zero address of the endpoint */ ++ addr = req->wValue & 0xFF; ++ if (addr == 0) /* The address should be non-zero */ ++ return retval; ++ ++ ep = get_cfi_ep_by_addr(pcd->cfi, addr); ++ if (NULL == ep) { ++ CFI_INFO("%s: Unable to get the endpoint address(0x%02x)\n", ++ __func__, addr); ++ return retval; ++ } ++ ++ /* Copy the header to the buffer */ ++ dwc_memcpy(buf, ep->bm_concat, BS_CONCAT_VAL_HDR_LEN); ++ /* Advance the buffer pointer by the header size */ ++ buf += BS_CONCAT_VAL_HDR_LEN; ++ ++ desc_count = ep->bm_concat->hdr.bDescCount; ++ /* Copy alll the wTxBytes to the buffer */ ++ dwc_memcpy(buf, ep->bm_concat->wTxBytes, sizeof(uid16_t) * desc_count); ++ ++ retval = BS_CONCAT_VAL_HDR_LEN + sizeof(uid16_t) * desc_count; ++ return retval; ++} ++ ++/** ++ * This function reads the buffer Alignment value of an EP's buffer mode into ++ * the buffer buf ++ * ++ * @return The total number of bytes copied to the buffer or negative error code. ++ */ ++static int cfi_ep_get_align_val(uint8_t * buf, struct dwc_otg_pcd *pcd, ++ struct cfi_usb_ctrlrequest *req) ++{ ++ int retval = -DWC_E_INVALID; ++ uint8_t addr; ++ cfi_ep_t *ep; ++ ++ /* The Low Byte of the wValue contains a non-zero address of the endpoint */ ++ addr = req->wValue & 0xFF; ++ if (addr == 0) /* The address should be non-zero */ ++ return retval; ++ ++ ep = get_cfi_ep_by_addr(pcd->cfi, addr); ++ if (NULL == ep) { ++ CFI_INFO("%s: Unable to get the endpoint address(0x%02x)\n", ++ __func__, addr); ++ return retval; ++ } ++ ++ dwc_memcpy(buf, ep->bm_align, BS_ALIGN_VAL_HDR_LEN); ++ retval = BS_ALIGN_VAL_HDR_LEN; ++ ++ return retval; ++} ++ ++/** ++ * This function sets a new value for the specified feature ++ * ++ * @param pcd A pointer to the PCD object ++ * ++ * @return 0 if successful, negative error code otherwise to stall the DCE. ++ */ ++static int cfi_set_feature_value(struct dwc_otg_pcd *pcd) ++{ ++ int retval = -DWC_E_NOT_SUPPORTED; ++ uint16_t wIndex, wValue; ++ uint8_t bRequest; ++ struct dwc_otg_core_if *coreif; ++ cfiobject_t *cfi = pcd->cfi; ++ struct cfi_usb_ctrlrequest *ctrl_req; ++ uint8_t *buf; ++ ctrl_req = &cfi->ctrl_req; ++ ++ buf = pcd->cfi->ctrl_req.data; ++ ++ coreif = GET_CORE_IF(pcd); ++ bRequest = ctrl_req->bRequest; ++ wIndex = DWC_CONSTANT_CPU_TO_LE16(ctrl_req->wIndex); ++ wValue = DWC_CONSTANT_CPU_TO_LE16(ctrl_req->wValue); ++ ++ /* See which feature is to be modified */ ++ switch (wIndex) { ++ case FT_ID_DMA_BUFFER_SETUP: ++ /* Modify the feature */ ++ if ((retval = cfi_ep_set_sg_val(buf, pcd)) < 0) ++ return retval; ++ ++ /* And send this request to the gadget */ ++ cfi->need_gadget_att = 1; ++ break; ++ ++ case FT_ID_DMA_BUFF_ALIGN: ++ if ((retval = cfi_ep_set_alignment_val(buf, pcd)) < 0) ++ return retval; ++ cfi->need_gadget_att = 1; ++ break; ++ ++ case FT_ID_DMA_CONCAT_SETUP: ++ /* Modify the feature */ ++ if ((retval = cfi_ep_set_concat_val(buf, pcd)) < 0) ++ return retval; ++ cfi->need_gadget_att = 1; ++ break; ++ ++ case FT_ID_DMA_CIRCULAR: ++ CFI_INFO("FT_ID_DMA_CIRCULAR\n"); ++ break; ++ ++ case FT_ID_THRESHOLD_SETUP: ++ CFI_INFO("FT_ID_THRESHOLD_SETUP\n"); ++ break; ++ ++ case FT_ID_DFIFO_DEPTH: ++ CFI_INFO("FT_ID_DFIFO_DEPTH\n"); ++ break; ++ ++ case FT_ID_TX_FIFO_DEPTH: ++ CFI_INFO("FT_ID_TX_FIFO_DEPTH\n"); ++ if ((retval = cfi_ep_set_tx_fifo_val(buf, pcd)) < 0) ++ return retval; ++ cfi->need_gadget_att = 0; ++ break; ++ ++ case FT_ID_RX_FIFO_DEPTH: ++ CFI_INFO("FT_ID_RX_FIFO_DEPTH\n"); ++ if ((retval = cfi_set_rx_fifo_val(buf, pcd)) < 0) ++ return retval; ++ cfi->need_gadget_att = 0; ++ break; ++ } ++ ++ return retval; ++} ++ ++#endif //DWC_UTE_CFI +diff --git a/drivers/usb/host/dwc_otg/dwc_otg_cfi.h b/drivers/usb/host/dwc_otg/dwc_otg_cfi.h +new file mode 100644 +index 0000000..55fd337 +--- /dev/null ++++ b/drivers/usb/host/dwc_otg/dwc_otg_cfi.h +@@ -0,0 +1,320 @@ ++/* ========================================================================== ++ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, ++ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless ++ * otherwise expressly agreed to in writing between Synopsys and you. ++ * ++ * The Software IS NOT an item of Licensed Software or Licensed Product under ++ * any End User Software License Agreement or Agreement for Licensed Product ++ * with Synopsys or any supplement thereto. You are permitted to use and ++ * redistribute this Software in source and binary forms, with or without ++ * modification, provided that redistributions of source code must retain this ++ * notice. You may not view, use, disclose, copy or distribute this file or ++ * any information contained herein except pursuant to this license grant from ++ * Synopsys. If you do not agree with this notice, including the disclaimer ++ * below, then you are not authorized to use the Software. ++ * ++ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS ++ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS 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. ++ * ========================================================================== */ ++ ++#if !defined(__DWC_OTG_CFI_H__) ++#define __DWC_OTG_CFI_H__ ++ ++#include "dwc_otg_pcd.h" ++#include "dwc_cfi_common.h" ++ ++/** ++ * @file ++ * This file contains the CFI related OTG PCD specific common constants, ++ * interfaces(functions and macros) and data structures.The CFI Protocol is an ++ * optional interface for internal testing purposes that a DUT may implement to ++ * support testing of configurable features. ++ * ++ */ ++ ++struct dwc_otg_pcd; ++struct dwc_otg_pcd_ep; ++ ++/** OTG CFI Features (properties) ID constants */ ++/** This is a request for all Core Features */ ++#define FT_ID_DMA_MODE 0x0001 ++#define FT_ID_DMA_BUFFER_SETUP 0x0002 ++#define FT_ID_DMA_BUFF_ALIGN 0x0003 ++#define FT_ID_DMA_CONCAT_SETUP 0x0004 ++#define FT_ID_DMA_CIRCULAR 0x0005 ++#define FT_ID_THRESHOLD_SETUP 0x0006 ++#define FT_ID_DFIFO_DEPTH 0x0007 ++#define FT_ID_TX_FIFO_DEPTH 0x0008 ++#define FT_ID_RX_FIFO_DEPTH 0x0009 ++ ++/**********************************************************/ ++#define CFI_INFO_DEF ++ ++#ifdef CFI_INFO_DEF ++#define CFI_INFO(fmt...) DWC_PRINTF("CFI: " fmt); ++#else ++#define CFI_INFO(fmt...) ++#endif ++ ++#define min(x,y) ({ \ ++ x < y ? x : y; }) ++ ++#define max(x,y) ({ \ ++ x > y ? x : y; }) ++ ++/** ++ * Descriptor DMA SG Buffer setup structure (SG buffer). This structure is ++ * also used for setting up a buffer for Circular DDMA. ++ */ ++struct _ddma_sg_buffer_setup { ++#define BS_SG_VAL_DESC_LEN 6 ++ /* The OUT EP address */ ++ uint8_t bOutEndpointAddress; ++ /* The IN EP address */ ++ uint8_t bInEndpointAddress; ++ /* Number of bytes to put between transfer segments (must be DWORD boundaries) */ ++ uint8_t bOffset; ++ /* The number of transfer segments (a DMA descriptors per each segment) */ ++ uint8_t bCount; ++ /* Size (in byte) of each transfer segment */ ++ uint16_t wSize; ++} __attribute__ ((packed)); ++typedef struct _ddma_sg_buffer_setup ddma_sg_buffer_setup_t; ++ ++/** Descriptor DMA Concatenation Buffer setup structure */ ++struct _ddma_concat_buffer_setup_hdr { ++#define BS_CONCAT_VAL_HDR_LEN 4 ++ /* The endpoint for which the buffer is to be set up */ ++ uint8_t bEndpointAddress; ++ /* The count of descriptors to be used */ ++ uint8_t bDescCount; ++ /* The total size of the transfer */ ++ uint16_t wSize; ++} __attribute__ ((packed)); ++typedef struct _ddma_concat_buffer_setup_hdr ddma_concat_buffer_setup_hdr_t; ++ ++/** Descriptor DMA Concatenation Buffer setup structure */ ++struct _ddma_concat_buffer_setup { ++ /* The SG header */ ++ ddma_concat_buffer_setup_hdr_t hdr; ++ ++ /* The XFER sizes pointer (allocated dynamically) */ ++ uint16_t *wTxBytes; ++} __attribute__ ((packed)); ++typedef struct _ddma_concat_buffer_setup ddma_concat_buffer_setup_t; ++ ++/** Descriptor DMA Alignment Buffer setup structure */ ++struct _ddma_align_buffer_setup { ++#define BS_ALIGN_VAL_HDR_LEN 2 ++ uint8_t bEndpointAddress; ++ uint8_t bAlign; ++} __attribute__ ((packed)); ++typedef struct _ddma_align_buffer_setup ddma_align_buffer_setup_t; ++ ++/** Transmit FIFO Size setup structure */ ++struct _tx_fifo_size_setup { ++ uint8_t bEndpointAddress; ++ uint16_t wDepth; ++} __attribute__ ((packed)); ++typedef struct _tx_fifo_size_setup tx_fifo_size_setup_t; ++ ++/** Transmit FIFO Size setup structure */ ++struct _rx_fifo_size_setup { ++ uint16_t wDepth; ++} __attribute__ ((packed)); ++typedef struct _rx_fifo_size_setup rx_fifo_size_setup_t; ++ ++/** ++ * struct cfi_usb_ctrlrequest - the CFI implementation of the struct usb_ctrlrequest ++ * This structure encapsulates the standard usb_ctrlrequest and adds a pointer ++ * to the data returned in the data stage of a 3-stage Control Write requests. ++ */ ++struct cfi_usb_ctrlrequest { ++ uint8_t bRequestType; ++ uint8_t bRequest; ++ uint16_t wValue; ++ uint16_t wIndex; ++ uint16_t wLength; ++ uint8_t *data; ++} UPACKED; ++ ++/*---------------------------------------------------------------------------*/ ++ ++/** ++ * The CFI wrapper of the enabled and activated dwc_otg_pcd_ep structures. ++ * This structure is used to store the buffer setup data for any ++ * enabled endpoint in the PCD. ++ */ ++struct cfi_ep { ++ /* Entry for the list container */ ++ dwc_list_link_t lh; ++ /* Pointer to the active PCD endpoint structure */ ++ struct dwc_otg_pcd_ep *ep; ++ /* The last descriptor in the chain of DMA descriptors of the endpoint */ ++ struct dwc_otg_dma_desc *dma_desc_last; ++ /* The SG feature value */ ++ ddma_sg_buffer_setup_t *bm_sg; ++ /* The Circular feature value */ ++ ddma_sg_buffer_setup_t *bm_circ; ++ /* The Concatenation feature value */ ++ ddma_concat_buffer_setup_t *bm_concat; ++ /* The Alignment feature value */ ++ ddma_align_buffer_setup_t *bm_align; ++ /* XFER length */ ++ uint32_t xfer_len; ++ /* ++ * Count of DMA descriptors currently used. ++ * The total should not exceed the MAX_DMA_DESCS_PER_EP value ++ * defined in the dwc_otg_cil.h ++ */ ++ uint32_t desc_count; ++}; ++typedef struct cfi_ep cfi_ep_t; ++ ++typedef struct cfi_dma_buff { ++#define CFI_IN_BUF_LEN 1024 ++#define CFI_OUT_BUF_LEN 1024 ++ dma_addr_t addr; ++ uint8_t *buf; ++} cfi_dma_buff_t; ++ ++struct cfiobject; ++ ++/** ++ * This is the interface for the CFI operations. ++ * ++ * @param ep_enable Called when any endpoint is enabled and activated. ++ * @param release Called when the CFI object is released and it needs to correctly ++ * deallocate the dynamic memory ++ * @param ctrl_write_complete Called when the data stage of the request is complete ++ */ ++typedef struct cfi_ops { ++ int (*ep_enable) (struct cfiobject * cfi, struct dwc_otg_pcd * pcd, ++ struct dwc_otg_pcd_ep * ep); ++ void *(*ep_alloc_buf) (struct cfiobject * cfi, struct dwc_otg_pcd * pcd, ++ struct dwc_otg_pcd_ep * ep, dma_addr_t * dma, ++ unsigned size, gfp_t flags); ++ void (*release) (struct cfiobject * cfi); ++ int (*ctrl_write_complete) (struct cfiobject * cfi, ++ struct dwc_otg_pcd * pcd); ++ void (*build_descriptors) (struct cfiobject * cfi, ++ struct dwc_otg_pcd * pcd, ++ struct dwc_otg_pcd_ep * ep, ++ dwc_otg_pcd_request_t * req); ++} cfi_ops_t; ++ ++struct cfiobject { ++ cfi_ops_t ops; ++ struct dwc_otg_pcd *pcd; ++ struct usb_gadget *gadget; ++ ++ /* Buffers used to send/receive CFI-related request data */ ++ cfi_dma_buff_t buf_in; ++ cfi_dma_buff_t buf_out; ++ ++ /* CFI specific Control request wrapper */ ++ struct cfi_usb_ctrlrequest ctrl_req; ++ ++ /* The list of active EP's in the PCD of type cfi_ep_t */ ++ dwc_list_link_t active_eps; ++ ++ /* This flag shall control the propagation of a specific request ++ * to the gadget's processing routines. ++ * 0 - no gadget handling ++ * 1 - the gadget needs to know about this request (w/o completing a status ++ * phase - just return a 0 to the _setup callback) ++ */ ++ uint8_t need_gadget_att; ++ ++ /* Flag indicating whether the status IN phase needs to be ++ * completed by the PCD ++ */ ++ uint8_t need_status_in_complete; ++}; ++typedef struct cfiobject cfiobject_t; ++ ++#define DUMP_MSG ++ ++#if defined(DUMP_MSG) ++static inline void dump_msg(const u8 * buf, unsigned int length) ++{ ++ unsigned int start, num, i; ++ char line[52], *p; ++ ++ if (length >= 512) ++ return; ++ ++ start = 0; ++ while (length > 0) { ++ num = min(length, 16u); ++ p = line; ++ for (i = 0; i < num; ++i) { ++ if (i == 8) ++ *p++ = ' '; ++ DWC_SPRINTF(p, " %02x", buf[i]); ++ p += 3; ++ } ++ *p = 0; ++ DWC_DEBUG("%6x: %s\n", start, line); ++ buf += num; ++ start += num; ++ length -= num; ++ } ++} ++#else ++static inline void dump_msg(const u8 * buf, unsigned int length) ++{ ++} ++#endif ++ ++/** ++ * This function returns a pointer to cfi_ep_t object with the addr address. ++ */ ++static inline struct cfi_ep *get_cfi_ep_by_addr(struct cfiobject *cfi, ++ uint8_t addr) ++{ ++ struct cfi_ep *pcfiep; ++ dwc_list_link_t *tmp; ++ ++ DWC_LIST_FOREACH(tmp, &cfi->active_eps) { ++ pcfiep = DWC_LIST_ENTRY(tmp, struct cfi_ep, lh); ++ ++ if (pcfiep->ep->desc->bEndpointAddress == addr) { ++ return pcfiep; ++ } ++ } ++ ++ return NULL; ++} ++ ++/** ++ * This function returns a pointer to cfi_ep_t object that matches ++ * the dwc_otg_pcd_ep object. ++ */ ++static inline struct cfi_ep *get_cfi_ep_by_pcd_ep(struct cfiobject *cfi, ++ struct dwc_otg_pcd_ep *ep) ++{ ++ struct cfi_ep *pcfiep = NULL; ++ dwc_list_link_t *tmp; ++ ++ DWC_LIST_FOREACH(tmp, &cfi->active_eps) { ++ pcfiep = DWC_LIST_ENTRY(tmp, struct cfi_ep, lh); ++ if (pcfiep->ep == ep) { ++ return pcfiep; ++ } ++ } ++ return NULL; ++} ++ ++int cfi_setup(struct dwc_otg_pcd *pcd, struct cfi_usb_ctrlrequest *ctrl); ++ ++#endif /* (__DWC_OTG_CFI_H__) */ +diff --git a/drivers/usb/host/dwc_otg/dwc_otg_cil.c b/drivers/usb/host/dwc_otg/dwc_otg_cil.c +new file mode 100644 +index 0000000..38abd0b +--- /dev/null ++++ b/drivers/usb/host/dwc_otg/dwc_otg_cil.c +@@ -0,0 +1,7141 @@ ++/* ========================================================================== ++ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_cil.c $ ++ * $Revision: #191 $ ++ * $Date: 2012/08/10 $ ++ * $Change: 2047372 $ ++ * ++ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, ++ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless ++ * otherwise expressly agreed to in writing between Synopsys and you. ++ * ++ * The Software IS NOT an item of Licensed Software or Licensed Product under ++ * any End User Software License Agreement or Agreement for Licensed Product ++ * with Synopsys or any supplement thereto. You are permitted to use and ++ * redistribute this Software in source and binary forms, with or without ++ * modification, provided that redistributions of source code must retain this ++ * notice. You may not view, use, disclose, copy or distribute this file or ++ * any information contained herein except pursuant to this license grant from ++ * Synopsys. If you do not agree with this notice, including the disclaimer ++ * below, then you are not authorized to use the Software. ++ * ++ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS ++ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS 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. ++ * ========================================================================== */ ++ ++/** @file ++ * ++ * The Core Interface Layer provides basic services for accessing and ++ * managing the DWC_otg hardware. These services are used by both the ++ * Host Controller Driver and the Peripheral Controller Driver. ++ * ++ * The CIL manages the memory map for the core so that the HCD and PCD ++ * don't have to do this separately. It also handles basic tasks like ++ * reading/writing the registers and data FIFOs in the controller. ++ * Some of the data access functions provide encapsulation of several ++ * operations required to perform a task, such as writing multiple ++ * registers to start a transfer. Finally, the CIL performs basic ++ * services that are not specific to either the host or device modes ++ * of operation. These services include management of the OTG Host ++ * Negotiation Protocol (HNP) and Session Request Protocol (SRP). A ++ * Diagnostic API is also provided to allow testing of the controller ++ * hardware. ++ * ++ * The Core Interface Layer has the following requirements: ++ * - Provides basic controller operations. ++ * - Minimal use of OS services. ++ * - The OS services used will be abstracted by using inline functions ++ * or macros. ++ * ++ */ ++ ++#include "dwc_os.h" ++#include "dwc_otg_regs.h" ++#include "dwc_otg_cil.h" ++ ++static int dwc_otg_setup_params(dwc_otg_core_if_t * core_if); ++ ++/** ++ * This function is called to initialize the DWC_otg CSR data ++ * structures. The register addresses in the device and host ++ * structures are initialized from the base address supplied by the ++ * caller. The calling function must make the OS calls to get the ++ * base address of the DWC_otg controller registers. The core_params ++ * argument holds the parameters that specify how the core should be ++ * configured. ++ * ++ * @param reg_base_addr Base address of DWC_otg core registers ++ * ++ */ ++dwc_otg_core_if_t *dwc_otg_cil_init(const uint32_t * reg_base_addr) ++{ ++ dwc_otg_core_if_t *core_if = 0; ++ dwc_otg_dev_if_t *dev_if = 0; ++ dwc_otg_host_if_t *host_if = 0; ++ uint8_t *reg_base = (uint8_t *) reg_base_addr; ++ int i = 0; ++ ++ DWC_DEBUGPL(DBG_CILV, "%s(%p)\n", __func__, reg_base_addr); ++ ++ core_if = DWC_ALLOC(sizeof(dwc_otg_core_if_t)); ++ ++ if (core_if == NULL) { ++ DWC_DEBUGPL(DBG_CIL, ++ "Allocation of dwc_otg_core_if_t failed\n"); ++ return 0; ++ } ++ core_if->core_global_regs = (dwc_otg_core_global_regs_t *) reg_base; ++ ++ /* ++ * Allocate the Device Mode structures. ++ */ ++ dev_if = DWC_ALLOC(sizeof(dwc_otg_dev_if_t)); ++ ++ if (dev_if == NULL) { ++ DWC_DEBUGPL(DBG_CIL, "Allocation of dwc_otg_dev_if_t failed\n"); ++ DWC_FREE(core_if); ++ return 0; ++ } ++ ++ dev_if->dev_global_regs = ++ (dwc_otg_device_global_regs_t *) (reg_base + ++ DWC_DEV_GLOBAL_REG_OFFSET); ++ ++ for (i = 0; i < MAX_EPS_CHANNELS; i++) { ++ dev_if->in_ep_regs[i] = (dwc_otg_dev_in_ep_regs_t *) ++ (reg_base + DWC_DEV_IN_EP_REG_OFFSET + ++ (i * DWC_EP_REG_OFFSET)); ++ ++ dev_if->out_ep_regs[i] = (dwc_otg_dev_out_ep_regs_t *) ++ (reg_base + DWC_DEV_OUT_EP_REG_OFFSET + ++ (i * DWC_EP_REG_OFFSET)); ++ DWC_DEBUGPL(DBG_CILV, "in_ep_regs[%d]->diepctl=%p\n", ++ i, &dev_if->in_ep_regs[i]->diepctl); ++ DWC_DEBUGPL(DBG_CILV, "out_ep_regs[%d]->doepctl=%p\n", ++ i, &dev_if->out_ep_regs[i]->doepctl); ++ } ++ ++ dev_if->speed = 0; // unknown ++ ++ core_if->dev_if = dev_if; ++ ++ /* ++ * Allocate the Host Mode structures. ++ */ ++ host_if = DWC_ALLOC(sizeof(dwc_otg_host_if_t)); ++ ++ if (host_if == NULL) { ++ DWC_DEBUGPL(DBG_CIL, ++ "Allocation of dwc_otg_host_if_t failed\n"); ++ DWC_FREE(dev_if); ++ DWC_FREE(core_if); ++ return 0; ++ } ++ ++ host_if->host_global_regs = (dwc_otg_host_global_regs_t *) ++ (reg_base + DWC_OTG_HOST_GLOBAL_REG_OFFSET); ++ ++ host_if->hprt0 = ++ (uint32_t *) (reg_base + DWC_OTG_HOST_PORT_REGS_OFFSET); ++ ++ for (i = 0; i < MAX_EPS_CHANNELS; i++) { ++ host_if->hc_regs[i] = (dwc_otg_hc_regs_t *) ++ (reg_base + DWC_OTG_HOST_CHAN_REGS_OFFSET + ++ (i * DWC_OTG_CHAN_REGS_OFFSET)); ++ DWC_DEBUGPL(DBG_CILV, "hc_reg[%d]->hcchar=%p\n", ++ i, &host_if->hc_regs[i]->hcchar); ++ } ++ ++ host_if->num_host_channels = MAX_EPS_CHANNELS; ++ core_if->host_if = host_if; ++ ++ for (i = 0; i < MAX_EPS_CHANNELS; i++) { ++ core_if->data_fifo[i] = ++ (uint32_t *) (reg_base + DWC_OTG_DATA_FIFO_OFFSET + ++ (i * DWC_OTG_DATA_FIFO_SIZE)); ++ DWC_DEBUGPL(DBG_CILV, "data_fifo[%d]=0x%08lx\n", ++ i, (unsigned long)core_if->data_fifo[i]); ++ } ++ ++ core_if->pcgcctl = (uint32_t *) (reg_base + DWC_OTG_PCGCCTL_OFFSET); ++ ++ /* Initiate lx_state to L3 disconnected state */ ++ core_if->lx_state = DWC_OTG_L3; ++ /* ++ * Store the contents of the hardware configuration registers here for ++ * easy access later. ++ */ ++ core_if->hwcfg1.d32 = ++ DWC_READ_REG32(&core_if->core_global_regs->ghwcfg1); ++ core_if->hwcfg2.d32 = ++ DWC_READ_REG32(&core_if->core_global_regs->ghwcfg2); ++ core_if->hwcfg3.d32 = ++ DWC_READ_REG32(&core_if->core_global_regs->ghwcfg3); ++ core_if->hwcfg4.d32 = ++ DWC_READ_REG32(&core_if->core_global_regs->ghwcfg4); ++ ++ /* Force host mode to get HPTXFSIZ exact power on value */ ++ { ++ gusbcfg_data_t gusbcfg = {.d32 = 0 }; ++ gusbcfg.d32 = DWC_READ_REG32(&core_if->core_global_regs->gusbcfg); ++ gusbcfg.b.force_host_mode = 1; ++ DWC_WRITE_REG32(&core_if->core_global_regs->gusbcfg, gusbcfg.d32); ++ dwc_mdelay(100); ++ core_if->hptxfsiz.d32 = ++ DWC_READ_REG32(&core_if->core_global_regs->hptxfsiz); ++ gusbcfg.d32 = DWC_READ_REG32(&core_if->core_global_regs->gusbcfg); ++ gusbcfg.b.force_host_mode = 1; ++ DWC_WRITE_REG32(&core_if->core_global_regs->gusbcfg, gusbcfg.d32); ++ dwc_mdelay(100); ++ } ++ ++ DWC_DEBUGPL(DBG_CILV, "hwcfg1=%08x\n", core_if->hwcfg1.d32); ++ DWC_DEBUGPL(DBG_CILV, "hwcfg2=%08x\n", core_if->hwcfg2.d32); ++ DWC_DEBUGPL(DBG_CILV, "hwcfg3=%08x\n", core_if->hwcfg3.d32); ++ DWC_DEBUGPL(DBG_CILV, "hwcfg4=%08x\n", core_if->hwcfg4.d32); ++ ++ core_if->hcfg.d32 = ++ DWC_READ_REG32(&core_if->host_if->host_global_regs->hcfg); ++ core_if->dcfg.d32 = ++ DWC_READ_REG32(&core_if->dev_if->dev_global_regs->dcfg); ++ ++ DWC_DEBUGPL(DBG_CILV, "hcfg=%08x\n", core_if->hcfg.d32); ++ DWC_DEBUGPL(DBG_CILV, "dcfg=%08x\n", core_if->dcfg.d32); ++ ++ DWC_DEBUGPL(DBG_CILV, "op_mode=%0x\n", core_if->hwcfg2.b.op_mode); ++ DWC_DEBUGPL(DBG_CILV, "arch=%0x\n", core_if->hwcfg2.b.architecture); ++ DWC_DEBUGPL(DBG_CILV, "num_dev_ep=%d\n", core_if->hwcfg2.b.num_dev_ep); ++ DWC_DEBUGPL(DBG_CILV, "num_host_chan=%d\n", ++ core_if->hwcfg2.b.num_host_chan); ++ DWC_DEBUGPL(DBG_CILV, "nonperio_tx_q_depth=0x%0x\n", ++ core_if->hwcfg2.b.nonperio_tx_q_depth); ++ DWC_DEBUGPL(DBG_CILV, "host_perio_tx_q_depth=0x%0x\n", ++ core_if->hwcfg2.b.host_perio_tx_q_depth); ++ DWC_DEBUGPL(DBG_CILV, "dev_token_q_depth=0x%0x\n", ++ core_if->hwcfg2.b.dev_token_q_depth); ++ ++ DWC_DEBUGPL(DBG_CILV, "Total FIFO SZ=%d\n", ++ core_if->hwcfg3.b.dfifo_depth); ++ DWC_DEBUGPL(DBG_CILV, "xfer_size_cntr_width=%0x\n", ++ core_if->hwcfg3.b.xfer_size_cntr_width); ++ ++ /* ++ * Set the SRP sucess bit for FS-I2c ++ */ ++ core_if->srp_success = 0; ++ core_if->srp_timer_started = 0; ++ ++ /* ++ * Create new workqueue and init works ++ */ ++ core_if->wq_otg = DWC_WORKQ_ALLOC("dwc_otg"); ++ if (core_if->wq_otg == 0) { ++ DWC_WARN("DWC_WORKQ_ALLOC failed\n"); ++ DWC_FREE(host_if); ++ DWC_FREE(dev_if); ++ DWC_FREE(core_if); ++ return 0; ++ } ++ ++ core_if->snpsid = DWC_READ_REG32(&core_if->core_global_regs->gsnpsid); ++ ++ DWC_PRINTF("Core Release: %x.%x%x%x\n", ++ (core_if->snpsid >> 12 & 0xF), ++ (core_if->snpsid >> 8 & 0xF), ++ (core_if->snpsid >> 4 & 0xF), (core_if->snpsid & 0xF)); ++ ++ core_if->wkp_timer = DWC_TIMER_ALLOC("Wake Up Timer", ++ w_wakeup_detected, core_if); ++ if (core_if->wkp_timer == 0) { ++ DWC_WARN("DWC_TIMER_ALLOC failed\n"); ++ DWC_FREE(host_if); ++ DWC_FREE(dev_if); ++ DWC_WORKQ_FREE(core_if->wq_otg); ++ DWC_FREE(core_if); ++ return 0; ++ } ++ ++ if (dwc_otg_setup_params(core_if)) { ++ DWC_WARN("Error while setting core params\n"); ++ } ++ ++ core_if->hibernation_suspend = 0; ++ ++ /** ADP initialization */ ++ dwc_otg_adp_init(core_if); ++ ++ return core_if; ++} ++ ++/** ++ * This function frees the structures allocated by dwc_otg_cil_init(). ++ * ++ * @param core_if The core interface pointer returned from ++ * dwc_otg_cil_init(). ++ * ++ */ ++void dwc_otg_cil_remove(dwc_otg_core_if_t * core_if) ++{ ++ dctl_data_t dctl = {.d32 = 0 }; ++ DWC_DEBUGPL(DBG_CILV, "%s(%p)\n", __func__, core_if); ++ ++ /* Disable all interrupts */ ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gahbcfg, 1, 0); ++ DWC_WRITE_REG32(&core_if->core_global_regs->gintmsk, 0); ++ ++ dctl.b.sftdiscon = 1; ++ if (core_if->snpsid >= OTG_CORE_REV_3_00a) { ++ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs->dctl, 0, ++ dctl.d32); ++ } ++ ++ if (core_if->wq_otg) { ++ DWC_WORKQ_WAIT_WORK_DONE(core_if->wq_otg, 500); ++ DWC_WORKQ_FREE(core_if->wq_otg); ++ } ++ if (core_if->dev_if) { ++ DWC_FREE(core_if->dev_if); ++ } ++ if (core_if->host_if) { ++ DWC_FREE(core_if->host_if); ++ } ++ ++ /** Remove ADP Stuff */ ++ dwc_otg_adp_remove(core_if); ++ if (core_if->core_params) { ++ DWC_FREE(core_if->core_params); ++ } ++ if (core_if->wkp_timer) { ++ DWC_TIMER_FREE(core_if->wkp_timer); ++ } ++ if (core_if->srp_timer) { ++ DWC_TIMER_FREE(core_if->srp_timer); ++ } ++ DWC_FREE(core_if); ++} ++ ++/** ++ * This function enables the controller's Global Interrupt in the AHB Config ++ * register. ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ */ ++void dwc_otg_enable_global_interrupts(dwc_otg_core_if_t * core_if) ++{ ++ gahbcfg_data_t ahbcfg = {.d32 = 0 }; ++ ahbcfg.b.glblintrmsk = 1; /* Enable interrupts */ ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gahbcfg, 0, ahbcfg.d32); ++} ++ ++/** ++ * This function disables the controller's Global Interrupt in the AHB Config ++ * register. ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ */ ++void dwc_otg_disable_global_interrupts(dwc_otg_core_if_t * core_if) ++{ ++ gahbcfg_data_t ahbcfg = {.d32 = 0 }; ++ ahbcfg.b.glblintrmsk = 1; /* Disable interrupts */ ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gahbcfg, ahbcfg.d32, 0); ++} ++ ++/** ++ * This function initializes the commmon interrupts, used in both ++ * device and host modes. ++ * ++ * @param core_if Programming view of the DWC_otg controller ++ * ++ */ ++static void dwc_otg_enable_common_interrupts(dwc_otg_core_if_t * core_if) ++{ ++ dwc_otg_core_global_regs_t *global_regs = core_if->core_global_regs; ++ gintmsk_data_t intr_mask = {.d32 = 0 }; ++ ++ /* Clear any pending OTG Interrupts */ ++ DWC_WRITE_REG32(&global_regs->gotgint, 0xFFFFFFFF); ++ ++ /* Clear any pending interrupts */ ++ DWC_WRITE_REG32(&global_regs->gintsts, 0xFFFFFFFF); ++ ++ /* ++ * Enable the interrupts in the GINTMSK. ++ */ ++ intr_mask.b.modemismatch = 1; ++ intr_mask.b.otgintr = 1; ++ ++ if (!core_if->dma_enable) { ++ intr_mask.b.rxstsqlvl = 1; ++ } ++ ++ intr_mask.b.conidstschng = 1; ++ intr_mask.b.wkupintr = 1; ++ intr_mask.b.disconnect = 0; ++ intr_mask.b.usbsuspend = 1; ++ intr_mask.b.sessreqintr = 1; ++#ifdef CONFIG_USB_DWC_OTG_LPM ++ if (core_if->core_params->lpm_enable) { ++ intr_mask.b.lpmtranrcvd = 1; ++ } ++#endif ++ DWC_WRITE_REG32(&global_regs->gintmsk, intr_mask.d32); ++} ++ ++/* ++ * The restore operation is modified to support Synopsys Emulated Powerdown and ++ * Hibernation. This function is for exiting from Device mode hibernation by ++ * Host Initiated Resume/Reset and Device Initiated Remote-Wakeup. ++ * @param core_if Programming view of DWC_otg controller. ++ * @param rem_wakeup - indicates whether resume is initiated by Device or Host. ++ * @param reset - indicates whether resume is initiated by Reset. ++ */ ++int dwc_otg_device_hibernation_restore(dwc_otg_core_if_t * core_if, ++ int rem_wakeup, int reset) ++{ ++ gpwrdn_data_t gpwrdn = {.d32 = 0 }; ++ pcgcctl_data_t pcgcctl = {.d32 = 0 }; ++ dctl_data_t dctl = {.d32 = 0 }; ++ ++ int timeout = 2000; ++ ++ if (!core_if->hibernation_suspend) { ++ DWC_PRINTF("Already exited from Hibernation\n"); ++ return 1; ++ } ++ ++ DWC_DEBUGPL(DBG_PCD, "%s called\n", __FUNCTION__); ++ /* Switch-on voltage to the core */ ++ gpwrdn.b.pwrdnswtch = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ dwc_udelay(10); ++ ++ /* Reset core */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pwrdnrstn = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ dwc_udelay(10); ++ ++ /* Assert Restore signal */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.restore = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, 0, gpwrdn.d32); ++ dwc_udelay(10); ++ ++ /* Disable power clamps */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pwrdnclmp = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ ++ if (rem_wakeup) { ++ dwc_udelay(70); ++ } ++ ++ /* Deassert Reset core */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pwrdnrstn = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, 0, gpwrdn.d32); ++ dwc_udelay(10); ++ ++ /* Disable PMU interrupt */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pmuintsel = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ ++ /* Mask interrupts from gpwrdn */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.connect_det_msk = 1; ++ gpwrdn.b.srp_det_msk = 1; ++ gpwrdn.b.disconn_det_msk = 1; ++ gpwrdn.b.rst_det_msk = 1; ++ gpwrdn.b.lnstchng_msk = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ ++ /* Indicates that we are going out from hibernation */ ++ core_if->hibernation_suspend = 0; ++ ++ /* ++ * Set Restore Essential Regs bit in PCGCCTL register, restore_mode = 1 ++ * indicates restore from remote_wakeup ++ */ ++ restore_essential_regs(core_if, rem_wakeup, 0); ++ ++ /* ++ * Wait a little for seeing new value of variable hibernation_suspend if ++ * Restore done interrupt received before polling ++ */ ++ dwc_udelay(10); ++ ++ if (core_if->hibernation_suspend == 0) { ++ /* ++ * Wait For Restore_done Interrupt. This mechanism of polling the ++ * interrupt is introduced to avoid any possible race conditions ++ */ ++ do { ++ gintsts_data_t gintsts; ++ gintsts.d32 = ++ DWC_READ_REG32(&core_if->core_global_regs->gintsts); ++ if (gintsts.b.restoredone) { ++ gintsts.d32 = 0; ++ gintsts.b.restoredone = 1; ++ DWC_WRITE_REG32(&core_if->core_global_regs-> ++ gintsts, gintsts.d32); ++ DWC_PRINTF("Restore Done Interrupt seen\n"); ++ break; ++ } ++ dwc_udelay(10); ++ } while (--timeout); ++ if (!timeout) { ++ DWC_PRINTF("Restore Done interrupt wasn't generated here\n"); ++ } ++ } ++ /* Clear all pending interupts */ ++ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, 0xFFFFFFFF); ++ ++ /* De-assert Restore */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.restore = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ dwc_udelay(10); ++ ++ if (!rem_wakeup) { ++ pcgcctl.d32 = 0; ++ pcgcctl.b.rstpdwnmodule = 1; ++ DWC_MODIFY_REG32(core_if->pcgcctl, pcgcctl.d32, 0); ++ } ++ ++ /* Restore GUSBCFG and DCFG */ ++ DWC_WRITE_REG32(&core_if->core_global_regs->gusbcfg, ++ core_if->gr_backup->gusbcfg_local); ++ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->dcfg, ++ core_if->dr_backup->dcfg); ++ ++ /* De-assert Wakeup Logic */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pmuactv = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ dwc_udelay(10); ++ ++ if (!rem_wakeup) { ++ /* Set Device programming done bit */ ++ dctl.b.pwronprgdone = 1; ++ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs->dctl, 0, dctl.d32); ++ } else { ++ /* Start Remote Wakeup Signaling */ ++ dctl.d32 = core_if->dr_backup->dctl; ++ dctl.b.rmtwkupsig = 1; ++ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->dctl, dctl.d32); ++ } ++ ++ dwc_mdelay(2); ++ /* Clear all pending interupts */ ++ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, 0xFFFFFFFF); ++ ++ /* Restore global registers */ ++ dwc_otg_restore_global_regs(core_if); ++ /* Restore device global registers */ ++ dwc_otg_restore_dev_regs(core_if, rem_wakeup); ++ ++ if (rem_wakeup) { ++ dwc_mdelay(7); ++ dctl.d32 = 0; ++ dctl.b.rmtwkupsig = 1; ++ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs->dctl, dctl.d32, 0); ++ } ++ ++ core_if->hibernation_suspend = 0; ++ /* The core will be in ON STATE */ ++ core_if->lx_state = DWC_OTG_L0; ++ DWC_PRINTF("Hibernation recovery completes here\n"); ++ ++ return 1; ++} ++ ++/* ++ * The restore operation is modified to support Synopsys Emulated Powerdown and ++ * Hibernation. This function is for exiting from Host mode hibernation by ++ * Host Initiated Resume/Reset and Device Initiated Remote-Wakeup. ++ * @param core_if Programming view of DWC_otg controller. ++ * @param rem_wakeup - indicates whether resume is initiated by Device or Host. ++ * @param reset - indicates whether resume is initiated by Reset. ++ */ ++int dwc_otg_host_hibernation_restore(dwc_otg_core_if_t * core_if, ++ int rem_wakeup, int reset) ++{ ++ gpwrdn_data_t gpwrdn = {.d32 = 0 }; ++ hprt0_data_t hprt0 = {.d32 = 0 }; ++ ++ int timeout = 2000; ++ ++ DWC_DEBUGPL(DBG_HCD, "%s called\n", __FUNCTION__); ++ /* Switch-on voltage to the core */ ++ gpwrdn.b.pwrdnswtch = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ dwc_udelay(10); ++ ++ /* Reset core */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pwrdnrstn = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ dwc_udelay(10); ++ ++ /* Assert Restore signal */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.restore = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, 0, gpwrdn.d32); ++ dwc_udelay(10); ++ ++ /* Disable power clamps */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pwrdnclmp = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ ++ if (!rem_wakeup) { ++ dwc_udelay(50); ++ } ++ ++ /* Deassert Reset core */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pwrdnrstn = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, 0, gpwrdn.d32); ++ dwc_udelay(10); ++ ++ /* Disable PMU interrupt */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pmuintsel = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.connect_det_msk = 1; ++ gpwrdn.b.srp_det_msk = 1; ++ gpwrdn.b.disconn_det_msk = 1; ++ gpwrdn.b.rst_det_msk = 1; ++ gpwrdn.b.lnstchng_msk = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ ++ /* Indicates that we are going out from hibernation */ ++ core_if->hibernation_suspend = 0; ++ ++ /* Set Restore Essential Regs bit in PCGCCTL register */ ++ restore_essential_regs(core_if, rem_wakeup, 1); ++ ++ /* Wait a little for seeing new value of variable hibernation_suspend if ++ * Restore done interrupt received before polling */ ++ dwc_udelay(10); ++ ++ if (core_if->hibernation_suspend == 0) { ++ /* Wait For Restore_done Interrupt. This mechanism of polling the ++ * interrupt is introduced to avoid any possible race conditions ++ */ ++ do { ++ gintsts_data_t gintsts; ++ gintsts.d32 = DWC_READ_REG32(&core_if->core_global_regs->gintsts); ++ if (gintsts.b.restoredone) { ++ gintsts.d32 = 0; ++ gintsts.b.restoredone = 1; ++ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, gintsts.d32); ++ DWC_DEBUGPL(DBG_HCD,"Restore Done Interrupt seen\n"); ++ break; ++ } ++ dwc_udelay(10); ++ } while (--timeout); ++ if (!timeout) { ++ DWC_WARN("Restore Done interrupt wasn't generated\n"); ++ } ++ } ++ ++ /* Set the flag's value to 0 again after receiving restore done interrupt */ ++ core_if->hibernation_suspend = 0; ++ ++ /* This step is not described in functional spec but if not wait for this ++ * delay, mismatch interrupts occurred because just after restore core is ++ * in Device mode(gintsts.curmode == 0) */ ++ dwc_mdelay(100); ++ ++ /* Clear all pending interrupts */ ++ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, 0xFFFFFFFF); ++ ++ /* De-assert Restore */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.restore = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ dwc_udelay(10); ++ ++ /* Restore GUSBCFG and HCFG */ ++ DWC_WRITE_REG32(&core_if->core_global_regs->gusbcfg, ++ core_if->gr_backup->gusbcfg_local); ++ DWC_WRITE_REG32(&core_if->host_if->host_global_regs->hcfg, ++ core_if->hr_backup->hcfg_local); ++ ++ /* De-assert Wakeup Logic */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pmuactv = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ dwc_udelay(10); ++ ++ /* Start the Resume operation by programming HPRT0 */ ++ hprt0.d32 = core_if->hr_backup->hprt0_local; ++ hprt0.b.prtpwr = 1; ++ hprt0.b.prtena = 0; ++ hprt0.b.prtsusp = 0; ++ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); ++ ++ DWC_PRINTF("Resume Starts Now\n"); ++ if (!reset) { // Indicates it is Resume Operation ++ hprt0.d32 = core_if->hr_backup->hprt0_local; ++ hprt0.b.prtres = 1; ++ hprt0.b.prtpwr = 1; ++ hprt0.b.prtena = 0; ++ hprt0.b.prtsusp = 0; ++ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); ++ ++ if (!rem_wakeup) ++ hprt0.b.prtres = 0; ++ /* Wait for Resume time and then program HPRT again */ ++ dwc_mdelay(100); ++ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); ++ ++ } else { // Indicates it is Reset Operation ++ hprt0.d32 = core_if->hr_backup->hprt0_local; ++ hprt0.b.prtrst = 1; ++ hprt0.b.prtpwr = 1; ++ hprt0.b.prtena = 0; ++ hprt0.b.prtsusp = 0; ++ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); ++ /* Wait for Reset time and then program HPRT again */ ++ dwc_mdelay(60); ++ hprt0.b.prtrst = 0; ++ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); ++ } ++ /* Clear all interrupt status */ ++ hprt0.d32 = dwc_otg_read_hprt0(core_if); ++ hprt0.b.prtconndet = 1; ++ hprt0.b.prtenchng = 1; ++ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); ++ ++ /* Clear all pending interupts */ ++ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, 0xFFFFFFFF); ++ ++ /* Restore global registers */ ++ dwc_otg_restore_global_regs(core_if); ++ /* Restore host global registers */ ++ dwc_otg_restore_host_regs(core_if, reset); ++ ++ /* The core will be in ON STATE */ ++ core_if->lx_state = DWC_OTG_L0; ++ DWC_PRINTF("Hibernation recovery is complete here\n"); ++ return 0; ++} ++ ++/** Saves some register values into system memory. */ ++int dwc_otg_save_global_regs(dwc_otg_core_if_t * core_if) ++{ ++ struct dwc_otg_global_regs_backup *gr; ++ int i; ++ ++ gr = core_if->gr_backup; ++ if (!gr) { ++ gr = DWC_ALLOC(sizeof(*gr)); ++ if (!gr) { ++ return -DWC_E_NO_MEMORY; ++ } ++ core_if->gr_backup = gr; ++ } ++ ++ gr->gotgctl_local = DWC_READ_REG32(&core_if->core_global_regs->gotgctl); ++ gr->gintmsk_local = DWC_READ_REG32(&core_if->core_global_regs->gintmsk); ++ gr->gahbcfg_local = DWC_READ_REG32(&core_if->core_global_regs->gahbcfg); ++ gr->gusbcfg_local = DWC_READ_REG32(&core_if->core_global_regs->gusbcfg); ++ gr->grxfsiz_local = DWC_READ_REG32(&core_if->core_global_regs->grxfsiz); ++ gr->gnptxfsiz_local = DWC_READ_REG32(&core_if->core_global_regs->gnptxfsiz); ++ gr->hptxfsiz_local = DWC_READ_REG32(&core_if->core_global_regs->hptxfsiz); ++#ifdef CONFIG_USB_DWC_OTG_LPM ++ gr->glpmcfg_local = DWC_READ_REG32(&core_if->core_global_regs->glpmcfg); ++#endif ++ gr->gi2cctl_local = DWC_READ_REG32(&core_if->core_global_regs->gi2cctl); ++ gr->pcgcctl_local = DWC_READ_REG32(core_if->pcgcctl); ++ gr->gdfifocfg_local = ++ DWC_READ_REG32(&core_if->core_global_regs->gdfifocfg); ++ for (i = 0; i < MAX_EPS_CHANNELS; i++) { ++ gr->dtxfsiz_local[i] = ++ DWC_READ_REG32(&(core_if->core_global_regs->dtxfsiz[i])); ++ } ++ ++ DWC_DEBUGPL(DBG_ANY, "===========Backing Global registers==========\n"); ++ DWC_DEBUGPL(DBG_ANY, "Backed up gotgctl = %08x\n", gr->gotgctl_local); ++ DWC_DEBUGPL(DBG_ANY, "Backed up gintmsk = %08x\n", gr->gintmsk_local); ++ DWC_DEBUGPL(DBG_ANY, "Backed up gahbcfg = %08x\n", gr->gahbcfg_local); ++ DWC_DEBUGPL(DBG_ANY, "Backed up gusbcfg = %08x\n", gr->gusbcfg_local); ++ DWC_DEBUGPL(DBG_ANY, "Backed up grxfsiz = %08x\n", gr->grxfsiz_local); ++ DWC_DEBUGPL(DBG_ANY, "Backed up gnptxfsiz = %08x\n", ++ gr->gnptxfsiz_local); ++ DWC_DEBUGPL(DBG_ANY, "Backed up hptxfsiz = %08x\n", ++ gr->hptxfsiz_local); ++#ifdef CONFIG_USB_DWC_OTG_LPM ++ DWC_DEBUGPL(DBG_ANY, "Backed up glpmcfg = %08x\n", gr->glpmcfg_local); ++#endif ++ DWC_DEBUGPL(DBG_ANY, "Backed up gi2cctl = %08x\n", gr->gi2cctl_local); ++ DWC_DEBUGPL(DBG_ANY, "Backed up pcgcctl = %08x\n", gr->pcgcctl_local); ++ DWC_DEBUGPL(DBG_ANY,"Backed up gdfifocfg = %08x\n",gr->gdfifocfg_local); ++ ++ return 0; ++} ++ ++/** Saves GINTMSK register before setting the msk bits. */ ++int dwc_otg_save_gintmsk_reg(dwc_otg_core_if_t * core_if) ++{ ++ struct dwc_otg_global_regs_backup *gr; ++ ++ gr = core_if->gr_backup; ++ if (!gr) { ++ gr = DWC_ALLOC(sizeof(*gr)); ++ if (!gr) { ++ return -DWC_E_NO_MEMORY; ++ } ++ core_if->gr_backup = gr; ++ } ++ ++ gr->gintmsk_local = DWC_READ_REG32(&core_if->core_global_regs->gintmsk); ++ ++ DWC_DEBUGPL(DBG_ANY,"=============Backing GINTMSK registers============\n"); ++ DWC_DEBUGPL(DBG_ANY, "Backed up gintmsk = %08x\n", gr->gintmsk_local); ++ ++ return 0; ++} ++ ++int dwc_otg_save_dev_regs(dwc_otg_core_if_t * core_if) ++{ ++ struct dwc_otg_dev_regs_backup *dr; ++ int i; ++ ++ dr = core_if->dr_backup; ++ if (!dr) { ++ dr = DWC_ALLOC(sizeof(*dr)); ++ if (!dr) { ++ return -DWC_E_NO_MEMORY; ++ } ++ core_if->dr_backup = dr; ++ } ++ ++ dr->dcfg = DWC_READ_REG32(&core_if->dev_if->dev_global_regs->dcfg); ++ dr->dctl = DWC_READ_REG32(&core_if->dev_if->dev_global_regs->dctl); ++ dr->daintmsk = ++ DWC_READ_REG32(&core_if->dev_if->dev_global_regs->daintmsk); ++ dr->diepmsk = ++ DWC_READ_REG32(&core_if->dev_if->dev_global_regs->diepmsk); ++ dr->doepmsk = ++ DWC_READ_REG32(&core_if->dev_if->dev_global_regs->doepmsk); ++ ++ for (i = 0; i < core_if->dev_if->num_in_eps; ++i) { ++ dr->diepctl[i] = ++ DWC_READ_REG32(&core_if->dev_if->in_ep_regs[i]->diepctl); ++ dr->dieptsiz[i] = ++ DWC_READ_REG32(&core_if->dev_if->in_ep_regs[i]->dieptsiz); ++ dr->diepdma[i] = ++ DWC_READ_REG32(&core_if->dev_if->in_ep_regs[i]->diepdma); ++ } ++ ++ DWC_DEBUGPL(DBG_ANY, ++ "=============Backing Host registers==============\n"); ++ DWC_DEBUGPL(DBG_ANY, "Backed up dcfg = %08x\n", dr->dcfg); ++ DWC_DEBUGPL(DBG_ANY, "Backed up dctl = %08x\n", dr->dctl); ++ DWC_DEBUGPL(DBG_ANY, "Backed up daintmsk = %08x\n", ++ dr->daintmsk); ++ DWC_DEBUGPL(DBG_ANY, "Backed up diepmsk = %08x\n", dr->diepmsk); ++ DWC_DEBUGPL(DBG_ANY, "Backed up doepmsk = %08x\n", dr->doepmsk); ++ for (i = 0; i < core_if->dev_if->num_in_eps; ++i) { ++ DWC_DEBUGPL(DBG_ANY, "Backed up diepctl[%d] = %08x\n", i, ++ dr->diepctl[i]); ++ DWC_DEBUGPL(DBG_ANY, "Backed up dieptsiz[%d] = %08x\n", ++ i, dr->dieptsiz[i]); ++ DWC_DEBUGPL(DBG_ANY, "Backed up diepdma[%d] = %08x\n", i, ++ dr->diepdma[i]); ++ } ++ ++ return 0; ++} ++ ++int dwc_otg_save_host_regs(dwc_otg_core_if_t * core_if) ++{ ++ struct dwc_otg_host_regs_backup *hr; ++ int i; ++ ++ hr = core_if->hr_backup; ++ if (!hr) { ++ hr = DWC_ALLOC(sizeof(*hr)); ++ if (!hr) { ++ return -DWC_E_NO_MEMORY; ++ } ++ core_if->hr_backup = hr; ++ } ++ ++ hr->hcfg_local = ++ DWC_READ_REG32(&core_if->host_if->host_global_regs->hcfg); ++ hr->haintmsk_local = ++ DWC_READ_REG32(&core_if->host_if->host_global_regs->haintmsk); ++ for (i = 0; i < dwc_otg_get_param_host_channels(core_if); ++i) { ++ hr->hcintmsk_local[i] = ++ DWC_READ_REG32(&core_if->host_if->hc_regs[i]->hcintmsk); ++ } ++ hr->hprt0_local = DWC_READ_REG32(core_if->host_if->hprt0); ++ hr->hfir_local = ++ DWC_READ_REG32(&core_if->host_if->host_global_regs->hfir); ++ ++ DWC_DEBUGPL(DBG_ANY, ++ "=============Backing Host registers===============\n"); ++ DWC_DEBUGPL(DBG_ANY, "Backed up hcfg = %08x\n", ++ hr->hcfg_local); ++ DWC_DEBUGPL(DBG_ANY, "Backed up haintmsk = %08x\n", hr->haintmsk_local); ++ for (i = 0; i < dwc_otg_get_param_host_channels(core_if); ++i) { ++ DWC_DEBUGPL(DBG_ANY, "Backed up hcintmsk[%02d]=%08x\n", i, ++ hr->hcintmsk_local[i]); ++ } ++ DWC_DEBUGPL(DBG_ANY, "Backed up hprt0 = %08x\n", ++ hr->hprt0_local); ++ DWC_DEBUGPL(DBG_ANY, "Backed up hfir = %08x\n", ++ hr->hfir_local); ++ ++ return 0; ++} ++ ++int dwc_otg_restore_global_regs(dwc_otg_core_if_t *core_if) ++{ ++ struct dwc_otg_global_regs_backup *gr; ++ int i; ++ ++ gr = core_if->gr_backup; ++ if (!gr) { ++ return -DWC_E_INVALID; ++ } ++ ++ DWC_WRITE_REG32(&core_if->core_global_regs->gotgctl, gr->gotgctl_local); ++ DWC_WRITE_REG32(&core_if->core_global_regs->gintmsk, gr->gintmsk_local); ++ DWC_WRITE_REG32(&core_if->core_global_regs->gusbcfg, gr->gusbcfg_local); ++ DWC_WRITE_REG32(&core_if->core_global_regs->gahbcfg, gr->gahbcfg_local); ++ DWC_WRITE_REG32(&core_if->core_global_regs->grxfsiz, gr->grxfsiz_local); ++ DWC_WRITE_REG32(&core_if->core_global_regs->gnptxfsiz, ++ gr->gnptxfsiz_local); ++ DWC_WRITE_REG32(&core_if->core_global_regs->hptxfsiz, ++ gr->hptxfsiz_local); ++ DWC_WRITE_REG32(&core_if->core_global_regs->gdfifocfg, ++ gr->gdfifocfg_local); ++ for (i = 0; i < MAX_EPS_CHANNELS; i++) { ++ DWC_WRITE_REG32(&core_if->core_global_regs->dtxfsiz[i], ++ gr->dtxfsiz_local[i]); ++ } ++ ++ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, 0xFFFFFFFF); ++ DWC_WRITE_REG32(core_if->host_if->hprt0, 0x0000100A); ++ DWC_WRITE_REG32(&core_if->core_global_regs->gahbcfg, ++ (gr->gahbcfg_local)); ++ return 0; ++} ++ ++int dwc_otg_restore_dev_regs(dwc_otg_core_if_t * core_if, int rem_wakeup) ++{ ++ struct dwc_otg_dev_regs_backup *dr; ++ int i; ++ ++ dr = core_if->dr_backup; ++ ++ if (!dr) { ++ return -DWC_E_INVALID; ++ } ++ ++ if (!rem_wakeup) { ++ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->dctl, ++ dr->dctl); ++ } ++ ++ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->daintmsk, dr->daintmsk); ++ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->diepmsk, dr->diepmsk); ++ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->doepmsk, dr->doepmsk); ++ ++ for (i = 0; i < core_if->dev_if->num_in_eps; ++i) { ++ DWC_WRITE_REG32(&core_if->dev_if->in_ep_regs[i]->dieptsiz, dr->dieptsiz[i]); ++ DWC_WRITE_REG32(&core_if->dev_if->in_ep_regs[i]->diepdma, dr->diepdma[i]); ++ DWC_WRITE_REG32(&core_if->dev_if->in_ep_regs[i]->diepctl, dr->diepctl[i]); ++ } ++ ++ return 0; ++} ++ ++int dwc_otg_restore_host_regs(dwc_otg_core_if_t * core_if, int reset) ++{ ++ struct dwc_otg_host_regs_backup *hr; ++ int i; ++ hr = core_if->hr_backup; ++ ++ if (!hr) { ++ return -DWC_E_INVALID; ++ } ++ ++ DWC_WRITE_REG32(&core_if->host_if->host_global_regs->hcfg, hr->hcfg_local); ++ //if (!reset) ++ //{ ++ // DWC_WRITE_REG32(&core_if->host_if->host_global_regs->hfir, hr->hfir_local); ++ //} ++ ++ DWC_WRITE_REG32(&core_if->host_if->host_global_regs->haintmsk, ++ hr->haintmsk_local); ++ for (i = 0; i < dwc_otg_get_param_host_channels(core_if); ++i) { ++ DWC_WRITE_REG32(&core_if->host_if->hc_regs[i]->hcintmsk, ++ hr->hcintmsk_local[i]); ++ } ++ ++ return 0; ++} ++ ++int restore_lpm_i2c_regs(dwc_otg_core_if_t * core_if) ++{ ++ struct dwc_otg_global_regs_backup *gr; ++ ++ gr = core_if->gr_backup; ++ ++ /* Restore values for LPM and I2C */ ++#ifdef CONFIG_USB_DWC_OTG_LPM ++ DWC_WRITE_REG32(&core_if->core_global_regs->glpmcfg, gr->glpmcfg_local); ++#endif ++ DWC_WRITE_REG32(&core_if->core_global_regs->gi2cctl, gr->gi2cctl_local); ++ ++ return 0; ++} ++ ++int restore_essential_regs(dwc_otg_core_if_t * core_if, int rmode, int is_host) ++{ ++ struct dwc_otg_global_regs_backup *gr; ++ pcgcctl_data_t pcgcctl = {.d32 = 0 }; ++ gahbcfg_data_t gahbcfg = {.d32 = 0 }; ++ gusbcfg_data_t gusbcfg = {.d32 = 0 }; ++ gintmsk_data_t gintmsk = {.d32 = 0 }; ++ ++ /* Restore LPM and I2C registers */ ++ restore_lpm_i2c_regs(core_if); ++ ++ /* Set PCGCCTL to 0 */ ++ DWC_WRITE_REG32(core_if->pcgcctl, 0x00000000); ++ ++ gr = core_if->gr_backup; ++ /* Load restore values for [31:14] bits */ ++ DWC_WRITE_REG32(core_if->pcgcctl, ++ ((gr->pcgcctl_local & 0xffffc000) | 0x00020000)); ++ ++ /* Umnask global Interrupt in GAHBCFG and restore it */ ++ gahbcfg.d32 = gr->gahbcfg_local; ++ gahbcfg.b.glblintrmsk = 1; ++ DWC_WRITE_REG32(&core_if->core_global_regs->gahbcfg, gahbcfg.d32); ++ ++ /* Clear all pending interupts */ ++ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, 0xFFFFFFFF); ++ ++ /* Unmask restore done interrupt */ ++ gintmsk.b.restoredone = 1; ++ DWC_WRITE_REG32(&core_if->core_global_regs->gintmsk, gintmsk.d32); ++ ++ /* Restore GUSBCFG and HCFG/DCFG */ ++ gusbcfg.d32 = core_if->gr_backup->gusbcfg_local; ++ DWC_WRITE_REG32(&core_if->core_global_regs->gusbcfg, gusbcfg.d32); ++ ++ if (is_host) { ++ hcfg_data_t hcfg = {.d32 = 0 }; ++ hcfg.d32 = core_if->hr_backup->hcfg_local; ++ DWC_WRITE_REG32(&core_if->host_if->host_global_regs->hcfg, ++ hcfg.d32); ++ ++ /* Load restore values for [31:14] bits */ ++ pcgcctl.d32 = gr->pcgcctl_local & 0xffffc000; ++ pcgcctl.d32 = gr->pcgcctl_local | 0x00020000; ++ ++ if (rmode) ++ pcgcctl.b.restoremode = 1; ++ DWC_WRITE_REG32(core_if->pcgcctl, pcgcctl.d32); ++ dwc_udelay(10); ++ ++ /* Load restore values for [31:14] bits and set EssRegRestored bit */ ++ pcgcctl.d32 = gr->pcgcctl_local | 0xffffc000; ++ pcgcctl.d32 = gr->pcgcctl_local & 0xffffc000; ++ pcgcctl.b.ess_reg_restored = 1; ++ if (rmode) ++ pcgcctl.b.restoremode = 1; ++ DWC_WRITE_REG32(core_if->pcgcctl, pcgcctl.d32); ++ } else { ++ dcfg_data_t dcfg = {.d32 = 0 }; ++ dcfg.d32 = core_if->dr_backup->dcfg; ++ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->dcfg, dcfg.d32); ++ ++ /* Load restore values for [31:14] bits */ ++ pcgcctl.d32 = gr->pcgcctl_local & 0xffffc000; ++ pcgcctl.d32 = gr->pcgcctl_local | 0x00020000; ++ if (!rmode) { ++ pcgcctl.d32 |= 0x208; ++ } ++ DWC_WRITE_REG32(core_if->pcgcctl, pcgcctl.d32); ++ dwc_udelay(10); ++ ++ /* Load restore values for [31:14] bits */ ++ pcgcctl.d32 = gr->pcgcctl_local & 0xffffc000; ++ pcgcctl.d32 = gr->pcgcctl_local | 0x00020000; ++ pcgcctl.b.ess_reg_restored = 1; ++ if (!rmode) ++ pcgcctl.d32 |= 0x208; ++ DWC_WRITE_REG32(core_if->pcgcctl, pcgcctl.d32); ++ } ++ ++ return 0; ++} ++ ++/** ++ * Initializes the FSLSPClkSel field of the HCFG register depending on the PHY ++ * type. ++ */ ++static void init_fslspclksel(dwc_otg_core_if_t * core_if) ++{ ++ uint32_t val; ++ hcfg_data_t hcfg; ++ ++ if (((core_if->hwcfg2.b.hs_phy_type == 2) && ++ (core_if->hwcfg2.b.fs_phy_type == 1) && ++ (core_if->core_params->ulpi_fs_ls)) || ++ (core_if->core_params->phy_type == DWC_PHY_TYPE_PARAM_FS)) { ++ /* Full speed PHY */ ++ val = DWC_HCFG_48_MHZ; ++ } else { ++ /* High speed PHY running at full speed or high speed */ ++ val = DWC_HCFG_30_60_MHZ; ++ } ++ ++ DWC_DEBUGPL(DBG_CIL, "Initializing HCFG.FSLSPClkSel to 0x%1x\n", val); ++ hcfg.d32 = DWC_READ_REG32(&core_if->host_if->host_global_regs->hcfg); ++ hcfg.b.fslspclksel = val; ++ DWC_WRITE_REG32(&core_if->host_if->host_global_regs->hcfg, hcfg.d32); ++} ++ ++/** ++ * Initializes the DevSpd field of the DCFG register depending on the PHY type ++ * and the enumeration speed of the device. ++ */ ++static void init_devspd(dwc_otg_core_if_t * core_if) ++{ ++ uint32_t val; ++ dcfg_data_t dcfg; ++ ++ if (((core_if->hwcfg2.b.hs_phy_type == 2) && ++ (core_if->hwcfg2.b.fs_phy_type == 1) && ++ (core_if->core_params->ulpi_fs_ls)) || ++ (core_if->core_params->phy_type == DWC_PHY_TYPE_PARAM_FS)) { ++ /* Full speed PHY */ ++ val = 0x3; ++ } else if (core_if->core_params->speed == DWC_SPEED_PARAM_FULL) { ++ /* High speed PHY running at full speed */ ++ val = 0x1; ++ } else { ++ /* High speed PHY running at high speed */ ++ val = 0x0; ++ } ++ ++ DWC_DEBUGPL(DBG_CIL, "Initializing DCFG.DevSpd to 0x%1x\n", val); ++ ++ dcfg.d32 = DWC_READ_REG32(&core_if->dev_if->dev_global_regs->dcfg); ++ dcfg.b.devspd = val; ++ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->dcfg, dcfg.d32); ++} ++ ++/** ++ * This function calculates the number of IN EPS ++ * using GHWCFG1 and GHWCFG2 registers values ++ * ++ * @param core_if Programming view of the DWC_otg controller ++ */ ++static uint32_t calc_num_in_eps(dwc_otg_core_if_t * core_if) ++{ ++ uint32_t num_in_eps = 0; ++ uint32_t num_eps = core_if->hwcfg2.b.num_dev_ep; ++ uint32_t hwcfg1 = core_if->hwcfg1.d32 >> 3; ++ uint32_t num_tx_fifos = core_if->hwcfg4.b.num_in_eps; ++ int i; ++ ++ for (i = 0; i < num_eps; ++i) { ++ if (!(hwcfg1 & 0x1)) ++ num_in_eps++; ++ ++ hwcfg1 >>= 2; ++ } ++ ++ if (core_if->hwcfg4.b.ded_fifo_en) { ++ num_in_eps = ++ (num_in_eps > num_tx_fifos) ? num_tx_fifos : num_in_eps; ++ } ++ ++ return num_in_eps; ++} ++ ++/** ++ * This function calculates the number of OUT EPS ++ * using GHWCFG1 and GHWCFG2 registers values ++ * ++ * @param core_if Programming view of the DWC_otg controller ++ */ ++static uint32_t calc_num_out_eps(dwc_otg_core_if_t * core_if) ++{ ++ uint32_t num_out_eps = 0; ++ uint32_t num_eps = core_if->hwcfg2.b.num_dev_ep; ++ uint32_t hwcfg1 = core_if->hwcfg1.d32 >> 2; ++ int i; ++ ++ for (i = 0; i < num_eps; ++i) { ++ if (!(hwcfg1 & 0x1)) ++ num_out_eps++; ++ ++ hwcfg1 >>= 2; ++ } ++ return num_out_eps; ++} ++ ++/** ++ * This function initializes the DWC_otg controller registers and ++ * prepares the core for device mode or host mode operation. ++ * ++ * @param core_if Programming view of the DWC_otg controller ++ * ++ */ ++void dwc_otg_core_init(dwc_otg_core_if_t * core_if) ++{ ++ int i = 0; ++ dwc_otg_core_global_regs_t *global_regs = core_if->core_global_regs; ++ dwc_otg_dev_if_t *dev_if = core_if->dev_if; ++ gahbcfg_data_t ahbcfg = {.d32 = 0 }; ++ gusbcfg_data_t usbcfg = {.d32 = 0 }; ++ gi2cctl_data_t i2cctl = {.d32 = 0 }; ++ ++ DWC_DEBUGPL(DBG_CILV, "dwc_otg_core_init(%p) regs at %p\n", ++ core_if, global_regs); ++ ++ /* Common Initialization */ ++ usbcfg.d32 = DWC_READ_REG32(&global_regs->gusbcfg); ++ ++ /* Program the ULPI External VBUS bit if needed */ ++ usbcfg.b.ulpi_ext_vbus_drv = ++ (core_if->core_params->phy_ulpi_ext_vbus == ++ DWC_PHY_ULPI_EXTERNAL_VBUS) ? 1 : 0; ++ ++ /* Set external TS Dline pulsing */ ++ usbcfg.b.term_sel_dl_pulse = ++ (core_if->core_params->ts_dline == 1) ? 1 : 0; ++ DWC_WRITE_REG32(&global_regs->gusbcfg, usbcfg.d32); ++ ++ /* Reset the Controller */ ++ dwc_otg_core_reset(core_if); ++ ++ core_if->adp_enable = core_if->core_params->adp_supp_enable; ++ core_if->power_down = core_if->core_params->power_down; ++ core_if->otg_sts = 0; ++ ++ /* Initialize parameters from Hardware configuration registers. */ ++ dev_if->num_in_eps = calc_num_in_eps(core_if); ++ dev_if->num_out_eps = calc_num_out_eps(core_if); ++ ++ DWC_DEBUGPL(DBG_CIL, "num_dev_perio_in_ep=%d\n", ++ core_if->hwcfg4.b.num_dev_perio_in_ep); ++ ++ for (i = 0; i < core_if->hwcfg4.b.num_dev_perio_in_ep; i++) { ++ dev_if->perio_tx_fifo_size[i] = ++ DWC_READ_REG32(&global_regs->dtxfsiz[i]) >> 16; ++ DWC_DEBUGPL(DBG_CIL, "Periodic Tx FIFO SZ #%d=0x%0x\n", ++ i, dev_if->perio_tx_fifo_size[i]); ++ } ++ ++ for (i = 0; i < core_if->hwcfg4.b.num_in_eps; i++) { ++ dev_if->tx_fifo_size[i] = ++ DWC_READ_REG32(&global_regs->dtxfsiz[i]) >> 16; ++ DWC_DEBUGPL(DBG_CIL, "Tx FIFO SZ #%d=0x%0x\n", ++ i, dev_if->tx_fifo_size[i]); ++ } ++ ++ core_if->total_fifo_size = core_if->hwcfg3.b.dfifo_depth; ++ core_if->rx_fifo_size = DWC_READ_REG32(&global_regs->grxfsiz); ++ core_if->nperio_tx_fifo_size = ++ DWC_READ_REG32(&global_regs->gnptxfsiz) >> 16; ++ ++ DWC_DEBUGPL(DBG_CIL, "Total FIFO SZ=%d\n", core_if->total_fifo_size); ++ DWC_DEBUGPL(DBG_CIL, "Rx FIFO SZ=%d\n", core_if->rx_fifo_size); ++ DWC_DEBUGPL(DBG_CIL, "NP Tx FIFO SZ=%d\n", ++ core_if->nperio_tx_fifo_size); ++ ++ /* This programming sequence needs to happen in FS mode before any other ++ * programming occurs */ ++ if ((core_if->core_params->speed == DWC_SPEED_PARAM_FULL) && ++ (core_if->core_params->phy_type == DWC_PHY_TYPE_PARAM_FS)) { ++ /* If FS mode with FS PHY */ ++ ++ /* core_init() is now called on every switch so only call the ++ * following for the first time through. */ ++ if (!core_if->phy_init_done) { ++ core_if->phy_init_done = 1; ++ DWC_DEBUGPL(DBG_CIL, "FS_PHY detected\n"); ++ usbcfg.d32 = DWC_READ_REG32(&global_regs->gusbcfg); ++ usbcfg.b.physel = 1; ++ DWC_WRITE_REG32(&global_regs->gusbcfg, usbcfg.d32); ++ ++ /* Reset after a PHY select */ ++ dwc_otg_core_reset(core_if); ++ } ++ ++ /* Program DCFG.DevSpd or HCFG.FSLSPclkSel to 48Mhz in FS. Also ++ * do this on HNP Dev/Host mode switches (done in dev_init and ++ * host_init). */ ++ if (dwc_otg_is_host_mode(core_if)) { ++ init_fslspclksel(core_if); ++ } else { ++ init_devspd(core_if); ++ } ++ ++ if (core_if->core_params->i2c_enable) { ++ DWC_DEBUGPL(DBG_CIL, "FS_PHY Enabling I2c\n"); ++ /* Program GUSBCFG.OtgUtmifsSel to I2C */ ++ usbcfg.d32 = DWC_READ_REG32(&global_regs->gusbcfg); ++ usbcfg.b.otgutmifssel = 1; ++ DWC_WRITE_REG32(&global_regs->gusbcfg, usbcfg.d32); ++ ++ /* Program GI2CCTL.I2CEn */ ++ i2cctl.d32 = DWC_READ_REG32(&global_regs->gi2cctl); ++ i2cctl.b.i2cdevaddr = 1; ++ i2cctl.b.i2cen = 0; ++ DWC_WRITE_REG32(&global_regs->gi2cctl, i2cctl.d32); ++ i2cctl.b.i2cen = 1; ++ DWC_WRITE_REG32(&global_regs->gi2cctl, i2cctl.d32); ++ } ++ ++ } /* endif speed == DWC_SPEED_PARAM_FULL */ ++ else { ++ /* High speed PHY. */ ++ if (!core_if->phy_init_done) { ++ core_if->phy_init_done = 1; ++ /* HS PHY parameters. These parameters are preserved ++ * during soft reset so only program the first time. Do ++ * a soft reset immediately after setting phyif. */ ++ ++ if (core_if->core_params->phy_type == 2) { ++ /* ULPI interface */ ++ usbcfg.b.ulpi_utmi_sel = 1; ++ usbcfg.b.phyif = 0; ++ usbcfg.b.ddrsel = ++ core_if->core_params->phy_ulpi_ddr; ++ } else if (core_if->core_params->phy_type == 1) { ++ /* UTMI+ interface */ ++ usbcfg.b.ulpi_utmi_sel = 0; ++ if (core_if->core_params->phy_utmi_width == 16) { ++ usbcfg.b.phyif = 1; ++ ++ } else { ++ usbcfg.b.phyif = 0; ++ } ++ } else { ++ DWC_ERROR("FS PHY TYPE\n"); ++ } ++ DWC_WRITE_REG32(&global_regs->gusbcfg, usbcfg.d32); ++ /* Reset after setting the PHY parameters */ ++ dwc_otg_core_reset(core_if); ++ } ++ } ++ ++ if ((core_if->hwcfg2.b.hs_phy_type == 2) && ++ (core_if->hwcfg2.b.fs_phy_type == 1) && ++ (core_if->core_params->ulpi_fs_ls)) { ++ DWC_DEBUGPL(DBG_CIL, "Setting ULPI FSLS\n"); ++ usbcfg.d32 = DWC_READ_REG32(&global_regs->gusbcfg); ++ usbcfg.b.ulpi_fsls = 1; ++ usbcfg.b.ulpi_clk_sus_m = 1; ++ DWC_WRITE_REG32(&global_regs->gusbcfg, usbcfg.d32); ++ } else { ++ usbcfg.d32 = DWC_READ_REG32(&global_regs->gusbcfg); ++ usbcfg.b.ulpi_fsls = 0; ++ usbcfg.b.ulpi_clk_sus_m = 0; ++ DWC_WRITE_REG32(&global_regs->gusbcfg, usbcfg.d32); ++ } ++ ++ /* Program the GAHBCFG Register. */ ++ switch (core_if->hwcfg2.b.architecture) { ++ ++ case DWC_SLAVE_ONLY_ARCH: ++ DWC_DEBUGPL(DBG_CIL, "Slave Only Mode\n"); ++ ahbcfg.b.nptxfemplvl_txfemplvl = ++ DWC_GAHBCFG_TXFEMPTYLVL_HALFEMPTY; ++ ahbcfg.b.ptxfemplvl = DWC_GAHBCFG_TXFEMPTYLVL_HALFEMPTY; ++ core_if->dma_enable = 0; ++ core_if->dma_desc_enable = 0; ++ break; ++ ++ case DWC_EXT_DMA_ARCH: ++ DWC_DEBUGPL(DBG_CIL, "External DMA Mode\n"); ++ { ++ uint8_t brst_sz = core_if->core_params->dma_burst_size; ++ ahbcfg.b.hburstlen = 0; ++ while (brst_sz > 1) { ++ ahbcfg.b.hburstlen++; ++ brst_sz >>= 1; ++ } ++ } ++ core_if->dma_enable = (core_if->core_params->dma_enable != 0); ++ core_if->dma_desc_enable = ++ (core_if->core_params->dma_desc_enable != 0); ++ break; ++ ++ case DWC_INT_DMA_ARCH: ++ DWC_DEBUGPL(DBG_CIL, "Internal DMA Mode\n"); ++ /* Old value was DWC_GAHBCFG_INT_DMA_BURST_INCR - done for ++ Host mode ISOC in issue fix - vahrama */ ++ /* Broadcom had altered to (1<<3)|(0<<0) - WRESP=1, max 4 beats */ ++ ahbcfg.b.hburstlen = (1<<3)|(0<<0);//DWC_GAHBCFG_INT_DMA_BURST_INCR4; ++ core_if->dma_enable = (core_if->core_params->dma_enable != 0); ++ core_if->dma_desc_enable = ++ (core_if->core_params->dma_desc_enable != 0); ++ break; ++ ++ } ++ if (core_if->dma_enable) { ++ if (core_if->dma_desc_enable) { ++ DWC_PRINTF("Using Descriptor DMA mode\n"); ++ } else { ++ DWC_PRINTF("Using Buffer DMA mode\n"); ++ ++ } ++ } else { ++ DWC_PRINTF("Using Slave mode\n"); ++ core_if->dma_desc_enable = 0; ++ } ++ ++ if (core_if->core_params->ahb_single) { ++ ahbcfg.b.ahbsingle = 1; ++ } ++ ++ ahbcfg.b.dmaenable = core_if->dma_enable; ++ DWC_WRITE_REG32(&global_regs->gahbcfg, ahbcfg.d32); ++ ++ core_if->en_multiple_tx_fifo = core_if->hwcfg4.b.ded_fifo_en; ++ ++ core_if->pti_enh_enable = core_if->core_params->pti_enable != 0; ++ core_if->multiproc_int_enable = core_if->core_params->mpi_enable; ++ DWC_PRINTF("Periodic Transfer Interrupt Enhancement - %s\n", ++ ((core_if->pti_enh_enable) ? "enabled" : "disabled")); ++ DWC_PRINTF("Multiprocessor Interrupt Enhancement - %s\n", ++ ((core_if->multiproc_int_enable) ? "enabled" : "disabled")); ++ ++ /* ++ * Program the GUSBCFG register. ++ */ ++ usbcfg.d32 = DWC_READ_REG32(&global_regs->gusbcfg); ++ ++ switch (core_if->hwcfg2.b.op_mode) { ++ case DWC_MODE_HNP_SRP_CAPABLE: ++ usbcfg.b.hnpcap = (core_if->core_params->otg_cap == ++ DWC_OTG_CAP_PARAM_HNP_SRP_CAPABLE); ++ usbcfg.b.srpcap = (core_if->core_params->otg_cap != ++ DWC_OTG_CAP_PARAM_NO_HNP_SRP_CAPABLE); ++ break; ++ ++ case DWC_MODE_SRP_ONLY_CAPABLE: ++ usbcfg.b.hnpcap = 0; ++ usbcfg.b.srpcap = (core_if->core_params->otg_cap != ++ DWC_OTG_CAP_PARAM_NO_HNP_SRP_CAPABLE); ++ break; ++ ++ case DWC_MODE_NO_HNP_SRP_CAPABLE: ++ usbcfg.b.hnpcap = 0; ++ usbcfg.b.srpcap = 0; ++ break; ++ ++ case DWC_MODE_SRP_CAPABLE_DEVICE: ++ usbcfg.b.hnpcap = 0; ++ usbcfg.b.srpcap = (core_if->core_params->otg_cap != ++ DWC_OTG_CAP_PARAM_NO_HNP_SRP_CAPABLE); ++ break; ++ ++ case DWC_MODE_NO_SRP_CAPABLE_DEVICE: ++ usbcfg.b.hnpcap = 0; ++ usbcfg.b.srpcap = 0; ++ break; ++ ++ case DWC_MODE_SRP_CAPABLE_HOST: ++ usbcfg.b.hnpcap = 0; ++ usbcfg.b.srpcap = (core_if->core_params->otg_cap != ++ DWC_OTG_CAP_PARAM_NO_HNP_SRP_CAPABLE); ++ break; ++ ++ case DWC_MODE_NO_SRP_CAPABLE_HOST: ++ usbcfg.b.hnpcap = 0; ++ usbcfg.b.srpcap = 0; ++ break; ++ } ++ ++ DWC_WRITE_REG32(&global_regs->gusbcfg, usbcfg.d32); ++ ++#ifdef CONFIG_USB_DWC_OTG_LPM ++ if (core_if->core_params->lpm_enable) { ++ glpmcfg_data_t lpmcfg = {.d32 = 0 }; ++ ++ /* To enable LPM support set lpm_cap_en bit */ ++ lpmcfg.b.lpm_cap_en = 1; ++ ++ /* Make AppL1Res ACK */ ++ lpmcfg.b.appl_resp = 1; ++ ++ /* Retry 3 times */ ++ lpmcfg.b.retry_count = 3; ++ ++ DWC_MODIFY_REG32(&core_if->core_global_regs->glpmcfg, ++ 0, lpmcfg.d32); ++ ++ } ++#endif ++ if (core_if->core_params->ic_usb_cap) { ++ gusbcfg_data_t gusbcfg = {.d32 = 0 }; ++ gusbcfg.b.ic_usb_cap = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gusbcfg, ++ 0, gusbcfg.d32); ++ } ++ { ++ gotgctl_data_t gotgctl = {.d32 = 0 }; ++ gotgctl.b.otgver = core_if->core_params->otg_ver; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gotgctl, 0, ++ gotgctl.d32); ++ /* Set OTG version supported */ ++ core_if->otg_ver = core_if->core_params->otg_ver; ++ DWC_PRINTF("OTG VER PARAM: %d, OTG VER FLAG: %d\n", ++ core_if->core_params->otg_ver, core_if->otg_ver); ++ } ++ ++ ++ /* Enable common interrupts */ ++ dwc_otg_enable_common_interrupts(core_if); ++ ++ /* Do device or host intialization based on mode during PCD ++ * and HCD initialization */ ++ if (dwc_otg_is_host_mode(core_if)) { ++ DWC_DEBUGPL(DBG_ANY, "Host Mode\n"); ++ core_if->op_state = A_HOST; ++ } else { ++ DWC_DEBUGPL(DBG_ANY, "Device Mode\n"); ++ core_if->op_state = B_PERIPHERAL; ++#ifdef DWC_DEVICE_ONLY ++ dwc_otg_core_dev_init(core_if); ++#endif ++ } ++} ++ ++/** ++ * This function enables the Device mode interrupts. ++ * ++ * @param core_if Programming view of DWC_otg controller ++ */ ++void dwc_otg_enable_device_interrupts(dwc_otg_core_if_t * core_if) ++{ ++ gintmsk_data_t intr_mask = {.d32 = 0 }; ++ dwc_otg_core_global_regs_t *global_regs = core_if->core_global_regs; ++ ++ DWC_DEBUGPL(DBG_CIL, "%s()\n", __func__); ++ ++ /* Disable all interrupts. */ ++ DWC_WRITE_REG32(&global_regs->gintmsk, 0); ++ ++ /* Clear any pending interrupts */ ++ DWC_WRITE_REG32(&global_regs->gintsts, 0xFFFFFFFF); ++ ++ /* Enable the common interrupts */ ++ dwc_otg_enable_common_interrupts(core_if); ++ ++ /* Enable interrupts */ ++ intr_mask.b.usbreset = 1; ++ intr_mask.b.enumdone = 1; ++ /* Disable Disconnect interrupt in Device mode */ ++ intr_mask.b.disconnect = 0; ++ ++ if (!core_if->multiproc_int_enable) { ++ intr_mask.b.inepintr = 1; ++ intr_mask.b.outepintr = 1; ++ } ++ ++ intr_mask.b.erlysuspend = 1; ++ ++ if (core_if->en_multiple_tx_fifo == 0) { ++ intr_mask.b.epmismatch = 1; ++ } ++ ++ //intr_mask.b.incomplisoout = 1; ++ intr_mask.b.incomplisoin = 1; ++ ++/* Enable the ignore frame number for ISOC xfers - MAS */ ++/* Disable to support high bandwith ISOC transfers - manukz */ ++#if 0 ++#ifdef DWC_UTE_PER_IO ++ if (core_if->dma_enable) { ++ if (core_if->dma_desc_enable) { ++ dctl_data_t dctl1 = {.d32 = 0 }; ++ dctl1.b.ifrmnum = 1; ++ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs-> ++ dctl, 0, dctl1.d32); ++ DWC_DEBUG("----Enabled Ignore frame number (0x%08x)", ++ DWC_READ_REG32(&core_if->dev_if-> ++ dev_global_regs->dctl)); ++ } ++ } ++#endif ++#endif ++#ifdef DWC_EN_ISOC ++ if (core_if->dma_enable) { ++ if (core_if->dma_desc_enable == 0) { ++ if (core_if->pti_enh_enable) { ++ dctl_data_t dctl = {.d32 = 0 }; ++ dctl.b.ifrmnum = 1; ++ DWC_MODIFY_REG32(&core_if-> ++ dev_if->dev_global_regs->dctl, ++ 0, dctl.d32); ++ } else { ++ intr_mask.b.incomplisoin = 1; ++ intr_mask.b.incomplisoout = 1; ++ } ++ } ++ } else { ++ intr_mask.b.incomplisoin = 1; ++ intr_mask.b.incomplisoout = 1; ++ } ++#endif /* DWC_EN_ISOC */ ++ ++ /** @todo NGS: Should this be a module parameter? */ ++#ifdef USE_PERIODIC_EP ++ intr_mask.b.isooutdrop = 1; ++ intr_mask.b.eopframe = 1; ++ intr_mask.b.incomplisoin = 1; ++ intr_mask.b.incomplisoout = 1; ++#endif ++ ++ DWC_MODIFY_REG32(&global_regs->gintmsk, intr_mask.d32, intr_mask.d32); ++ ++ DWC_DEBUGPL(DBG_CIL, "%s() gintmsk=%0x\n", __func__, ++ DWC_READ_REG32(&global_regs->gintmsk)); ++} ++ ++/** ++ * This function initializes the DWC_otg controller registers for ++ * device mode. ++ * ++ * @param core_if Programming view of DWC_otg controller ++ * ++ */ ++void dwc_otg_core_dev_init(dwc_otg_core_if_t * core_if) ++{ ++ int i; ++ dwc_otg_core_global_regs_t *global_regs = core_if->core_global_regs; ++ dwc_otg_dev_if_t *dev_if = core_if->dev_if; ++ dwc_otg_core_params_t *params = core_if->core_params; ++ dcfg_data_t dcfg = {.d32 = 0 }; ++ depctl_data_t diepctl = {.d32 = 0 }; ++ grstctl_t resetctl = {.d32 = 0 }; ++ uint32_t rx_fifo_size; ++ fifosize_data_t nptxfifosize; ++ fifosize_data_t txfifosize; ++ dthrctl_data_t dthrctl; ++ fifosize_data_t ptxfifosize; ++ uint16_t rxfsiz, nptxfsiz; ++ gdfifocfg_data_t gdfifocfg = {.d32 = 0 }; ++ hwcfg3_data_t hwcfg3 = {.d32 = 0 }; ++ ++ /* Restart the Phy Clock */ ++ DWC_WRITE_REG32(core_if->pcgcctl, 0); ++ ++ /* Device configuration register */ ++ init_devspd(core_if); ++ dcfg.d32 = DWC_READ_REG32(&dev_if->dev_global_regs->dcfg); ++ dcfg.b.descdma = (core_if->dma_desc_enable) ? 1 : 0; ++ dcfg.b.perfrint = DWC_DCFG_FRAME_INTERVAL_80; ++ /* Enable Device OUT NAK in case of DDMA mode*/ ++ if (core_if->core_params->dev_out_nak) { ++ dcfg.b.endevoutnak = 1; ++ } ++ ++ if (core_if->core_params->cont_on_bna) { ++ dctl_data_t dctl = {.d32 = 0 }; ++ dctl.b.encontonbna = 1; ++ DWC_MODIFY_REG32(&dev_if->dev_global_regs->dctl, 0, dctl.d32); ++ } ++ ++ ++ DWC_WRITE_REG32(&dev_if->dev_global_regs->dcfg, dcfg.d32); ++ ++ /* Configure data FIFO sizes */ ++ if (core_if->hwcfg2.b.dynamic_fifo && params->enable_dynamic_fifo) { ++ DWC_DEBUGPL(DBG_CIL, "Total FIFO Size=%d\n", ++ core_if->total_fifo_size); ++ DWC_DEBUGPL(DBG_CIL, "Rx FIFO Size=%d\n", ++ params->dev_rx_fifo_size); ++ DWC_DEBUGPL(DBG_CIL, "NP Tx FIFO Size=%d\n", ++ params->dev_nperio_tx_fifo_size); ++ ++ /* Rx FIFO */ ++ DWC_DEBUGPL(DBG_CIL, "initial grxfsiz=%08x\n", ++ DWC_READ_REG32(&global_regs->grxfsiz)); ++ ++#ifdef DWC_UTE_CFI ++ core_if->pwron_rxfsiz = DWC_READ_REG32(&global_regs->grxfsiz); ++ core_if->init_rxfsiz = params->dev_rx_fifo_size; ++#endif ++ rx_fifo_size = params->dev_rx_fifo_size; ++ DWC_WRITE_REG32(&global_regs->grxfsiz, rx_fifo_size); ++ ++ DWC_DEBUGPL(DBG_CIL, "new grxfsiz=%08x\n", ++ DWC_READ_REG32(&global_regs->grxfsiz)); ++ ++ /** Set Periodic Tx FIFO Mask all bits 0 */ ++ core_if->p_tx_msk = 0; ++ ++ /** Set Tx FIFO Mask all bits 0 */ ++ core_if->tx_msk = 0; ++ ++ if (core_if->en_multiple_tx_fifo == 0) { ++ /* Non-periodic Tx FIFO */ ++ DWC_DEBUGPL(DBG_CIL, "initial gnptxfsiz=%08x\n", ++ DWC_READ_REG32(&global_regs->gnptxfsiz)); ++ ++ nptxfifosize.b.depth = params->dev_nperio_tx_fifo_size; ++ nptxfifosize.b.startaddr = params->dev_rx_fifo_size; ++ ++ DWC_WRITE_REG32(&global_regs->gnptxfsiz, ++ nptxfifosize.d32); ++ ++ DWC_DEBUGPL(DBG_CIL, "new gnptxfsiz=%08x\n", ++ DWC_READ_REG32(&global_regs->gnptxfsiz)); ++ ++ /**@todo NGS: Fix Periodic FIFO Sizing! */ ++ /* ++ * Periodic Tx FIFOs These FIFOs are numbered from 1 to 15. ++ * Indexes of the FIFO size module parameters in the ++ * dev_perio_tx_fifo_size array and the FIFO size registers in ++ * the dptxfsiz array run from 0 to 14. ++ */ ++ /** @todo Finish debug of this */ ++ ptxfifosize.b.startaddr = ++ nptxfifosize.b.startaddr + nptxfifosize.b.depth; ++ for (i = 0; i < core_if->hwcfg4.b.num_dev_perio_in_ep; i++) { ++ ptxfifosize.b.depth = ++ params->dev_perio_tx_fifo_size[i]; ++ DWC_DEBUGPL(DBG_CIL, ++ "initial dtxfsiz[%d]=%08x\n", i, ++ DWC_READ_REG32(&global_regs->dtxfsiz ++ [i])); ++ DWC_WRITE_REG32(&global_regs->dtxfsiz[i], ++ ptxfifosize.d32); ++ DWC_DEBUGPL(DBG_CIL, "new dtxfsiz[%d]=%08x\n", ++ i, ++ DWC_READ_REG32(&global_regs->dtxfsiz ++ [i])); ++ ptxfifosize.b.startaddr += ptxfifosize.b.depth; ++ } ++ } else { ++ /* ++ * Tx FIFOs These FIFOs are numbered from 1 to 15. ++ * Indexes of the FIFO size module parameters in the ++ * dev_tx_fifo_size array and the FIFO size registers in ++ * the dtxfsiz array run from 0 to 14. ++ */ ++ ++ /* Non-periodic Tx FIFO */ ++ DWC_DEBUGPL(DBG_CIL, "initial gnptxfsiz=%08x\n", ++ DWC_READ_REG32(&global_regs->gnptxfsiz)); ++ ++#ifdef DWC_UTE_CFI ++ core_if->pwron_gnptxfsiz = ++ (DWC_READ_REG32(&global_regs->gnptxfsiz) >> 16); ++ core_if->init_gnptxfsiz = ++ params->dev_nperio_tx_fifo_size; ++#endif ++ nptxfifosize.b.depth = params->dev_nperio_tx_fifo_size; ++ nptxfifosize.b.startaddr = params->dev_rx_fifo_size; ++ ++ DWC_WRITE_REG32(&global_regs->gnptxfsiz, ++ nptxfifosize.d32); ++ ++ DWC_DEBUGPL(DBG_CIL, "new gnptxfsiz=%08x\n", ++ DWC_READ_REG32(&global_regs->gnptxfsiz)); ++ ++ txfifosize.b.startaddr = ++ nptxfifosize.b.startaddr + nptxfifosize.b.depth; ++ ++ for (i = 0; i < core_if->hwcfg4.b.num_in_eps; i++) { ++ ++ txfifosize.b.depth = ++ params->dev_tx_fifo_size[i]; ++ ++ DWC_DEBUGPL(DBG_CIL, ++ "initial dtxfsiz[%d]=%08x\n", ++ i, ++ DWC_READ_REG32(&global_regs->dtxfsiz ++ [i])); ++ ++#ifdef DWC_UTE_CFI ++ core_if->pwron_txfsiz[i] = ++ (DWC_READ_REG32 ++ (&global_regs->dtxfsiz[i]) >> 16); ++ core_if->init_txfsiz[i] = ++ params->dev_tx_fifo_size[i]; ++#endif ++ DWC_WRITE_REG32(&global_regs->dtxfsiz[i], ++ txfifosize.d32); ++ ++ DWC_DEBUGPL(DBG_CIL, ++ "new dtxfsiz[%d]=%08x\n", ++ i, ++ DWC_READ_REG32(&global_regs->dtxfsiz ++ [i])); ++ ++ txfifosize.b.startaddr += txfifosize.b.depth; ++ } ++ if (core_if->snpsid <= OTG_CORE_REV_2_94a) { ++ /* Calculating DFIFOCFG for Device mode to include RxFIFO and NPTXFIFO */ ++ gdfifocfg.d32 = DWC_READ_REG32(&global_regs->gdfifocfg); ++ hwcfg3.d32 = DWC_READ_REG32(&global_regs->ghwcfg3); ++ gdfifocfg.b.gdfifocfg = (DWC_READ_REG32(&global_regs->ghwcfg3) >> 16); ++ DWC_WRITE_REG32(&global_regs->gdfifocfg, gdfifocfg.d32); ++ rxfsiz = (DWC_READ_REG32(&global_regs->grxfsiz) & 0x0000ffff); ++ nptxfsiz = (DWC_READ_REG32(&global_regs->gnptxfsiz) >> 16); ++ gdfifocfg.b.epinfobase = rxfsiz + nptxfsiz; ++ DWC_WRITE_REG32(&global_regs->gdfifocfg, gdfifocfg.d32); ++ } ++ } ++ ++ /* Flush the FIFOs */ ++ dwc_otg_flush_tx_fifo(core_if, 0x10); /* all Tx FIFOs */ ++ dwc_otg_flush_rx_fifo(core_if); ++ ++ /* Flush the Learning Queue. */ ++ resetctl.b.intknqflsh = 1; ++ DWC_WRITE_REG32(&core_if->core_global_regs->grstctl, resetctl.d32); ++ ++ if (!core_if->core_params->en_multiple_tx_fifo && core_if->dma_enable) { ++ core_if->start_predict = 0; ++ for (i = 0; i<= core_if->dev_if->num_in_eps; ++i) { ++ core_if->nextep_seq[i] = 0xff; // 0xff - EP not active ++ } ++ core_if->nextep_seq[0] = 0; ++ core_if->first_in_nextep_seq = 0; ++ diepctl.d32 = DWC_READ_REG32(&dev_if->in_ep_regs[0]->diepctl); ++ diepctl.b.nextep = 0; ++ DWC_WRITE_REG32(&dev_if->in_ep_regs[0]->diepctl, diepctl.d32); ++ ++ /* Update IN Endpoint Mismatch Count by active IN NP EP count + 1 */ ++ dcfg.d32 = DWC_READ_REG32(&dev_if->dev_global_regs->dcfg); ++ dcfg.b.epmscnt = 2; ++ DWC_WRITE_REG32(&dev_if->dev_global_regs->dcfg, dcfg.d32); ++ ++ DWC_DEBUGPL(DBG_CILV,"%s first_in_nextep_seq= %2d; nextep_seq[]:\n", ++ __func__, core_if->first_in_nextep_seq); ++ for (i=0; i <= core_if->dev_if->num_in_eps; i++) { ++ DWC_DEBUGPL(DBG_CILV, "%2d ", core_if->nextep_seq[i]); ++ } ++ DWC_DEBUGPL(DBG_CILV,"\n"); ++ } ++ ++ /* Clear all pending Device Interrupts */ ++ /** @todo - if the condition needed to be checked ++ * or in any case all pending interrutps should be cleared? ++ */ ++ if (core_if->multiproc_int_enable) { ++ for (i = 0; i < core_if->dev_if->num_in_eps; ++i) { ++ DWC_WRITE_REG32(&dev_if-> ++ dev_global_regs->diepeachintmsk[i], 0); ++ } ++ } ++ ++ for (i = 0; i < core_if->dev_if->num_out_eps; ++i) { ++ DWC_WRITE_REG32(&dev_if-> ++ dev_global_regs->doepeachintmsk[i], 0); ++ } ++ ++ DWC_WRITE_REG32(&dev_if->dev_global_regs->deachint, 0xFFFFFFFF); ++ DWC_WRITE_REG32(&dev_if->dev_global_regs->deachintmsk, 0); ++ } else { ++ DWC_WRITE_REG32(&dev_if->dev_global_regs->diepmsk, 0); ++ DWC_WRITE_REG32(&dev_if->dev_global_regs->doepmsk, 0); ++ DWC_WRITE_REG32(&dev_if->dev_global_regs->daint, 0xFFFFFFFF); ++ DWC_WRITE_REG32(&dev_if->dev_global_regs->daintmsk, 0); ++ } ++ ++ for (i = 0; i <= dev_if->num_in_eps; i++) { ++ depctl_data_t depctl; ++ depctl.d32 = DWC_READ_REG32(&dev_if->in_ep_regs[i]->diepctl); ++ if (depctl.b.epena) { ++ depctl.d32 = 0; ++ depctl.b.epdis = 1; ++ depctl.b.snak = 1; ++ } else { ++ depctl.d32 = 0; ++ } ++ ++ DWC_WRITE_REG32(&dev_if->in_ep_regs[i]->diepctl, depctl.d32); ++ ++ DWC_WRITE_REG32(&dev_if->in_ep_regs[i]->dieptsiz, 0); ++ DWC_WRITE_REG32(&dev_if->in_ep_regs[i]->diepdma, 0); ++ DWC_WRITE_REG32(&dev_if->in_ep_regs[i]->diepint, 0xFF); ++ } ++ ++ for (i = 0; i <= dev_if->num_out_eps; i++) { ++ depctl_data_t depctl; ++ depctl.d32 = DWC_READ_REG32(&dev_if->out_ep_regs[i]->doepctl); ++ if (depctl.b.epena) { ++ dctl_data_t dctl = {.d32 = 0 }; ++ gintmsk_data_t gintsts = {.d32 = 0 }; ++ doepint_data_t doepint = {.d32 = 0 }; ++ dctl.b.sgoutnak = 1; ++ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs->dctl, 0, dctl.d32); ++ do { ++ dwc_udelay(10); ++ gintsts.d32 = DWC_READ_REG32(&core_if->core_global_regs->gintsts); ++ } while (!gintsts.b.goutnakeff); ++ gintsts.d32 = 0; ++ gintsts.b.goutnakeff = 1; ++ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, gintsts.d32); ++ ++ depctl.d32 = 0; ++ depctl.b.epdis = 1; ++ depctl.b.snak = 1; ++ DWC_WRITE_REG32(&core_if->dev_if->out_ep_regs[i]->doepctl, depctl.d32); ++ do { ++ dwc_udelay(10); ++ doepint.d32 = DWC_READ_REG32(&core_if->dev_if-> ++ out_ep_regs[i]->doepint); ++ } while (!doepint.b.epdisabled); ++ ++ doepint.b.epdisabled = 1; ++ DWC_WRITE_REG32(&core_if->dev_if->out_ep_regs[i]->doepint, doepint.d32); ++ ++ dctl.d32 = 0; ++ dctl.b.cgoutnak = 1; ++ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs->dctl, 0, dctl.d32); ++ } else { ++ depctl.d32 = 0; ++ } ++ ++ DWC_WRITE_REG32(&dev_if->out_ep_regs[i]->doepctl, depctl.d32); ++ ++ DWC_WRITE_REG32(&dev_if->out_ep_regs[i]->doeptsiz, 0); ++ DWC_WRITE_REG32(&dev_if->out_ep_regs[i]->doepdma, 0); ++ DWC_WRITE_REG32(&dev_if->out_ep_regs[i]->doepint, 0xFF); ++ } ++ ++ if (core_if->en_multiple_tx_fifo && core_if->dma_enable) { ++ dev_if->non_iso_tx_thr_en = params->thr_ctl & 0x1; ++ dev_if->iso_tx_thr_en = (params->thr_ctl >> 1) & 0x1; ++ dev_if->rx_thr_en = (params->thr_ctl >> 2) & 0x1; ++ ++ dev_if->rx_thr_length = params->rx_thr_length; ++ dev_if->tx_thr_length = params->tx_thr_length; ++ ++ dev_if->setup_desc_index = 0; ++ ++ dthrctl.d32 = 0; ++ dthrctl.b.non_iso_thr_en = dev_if->non_iso_tx_thr_en; ++ dthrctl.b.iso_thr_en = dev_if->iso_tx_thr_en; ++ dthrctl.b.tx_thr_len = dev_if->tx_thr_length; ++ dthrctl.b.rx_thr_en = dev_if->rx_thr_en; ++ dthrctl.b.rx_thr_len = dev_if->rx_thr_length; ++ dthrctl.b.ahb_thr_ratio = params->ahb_thr_ratio; ++ ++ DWC_WRITE_REG32(&dev_if->dev_global_regs->dtknqr3_dthrctl, ++ dthrctl.d32); ++ ++ DWC_DEBUGPL(DBG_CIL, ++ "Non ISO Tx Thr - %d\nISO Tx Thr - %d\nRx Thr - %d\nTx Thr Len - %d\nRx Thr Len - %d\n", ++ dthrctl.b.non_iso_thr_en, dthrctl.b.iso_thr_en, ++ dthrctl.b.rx_thr_en, dthrctl.b.tx_thr_len, ++ dthrctl.b.rx_thr_len); ++ ++ } ++ ++ dwc_otg_enable_device_interrupts(core_if); ++ ++ { ++ diepmsk_data_t msk = {.d32 = 0 }; ++ msk.b.txfifoundrn = 1; ++ if (core_if->multiproc_int_enable) { ++ DWC_MODIFY_REG32(&dev_if->dev_global_regs-> ++ diepeachintmsk[0], msk.d32, msk.d32); ++ } else { ++ DWC_MODIFY_REG32(&dev_if->dev_global_regs->diepmsk, ++ msk.d32, msk.d32); ++ } ++ } ++ ++ if (core_if->multiproc_int_enable) { ++ /* Set NAK on Babble */ ++ dctl_data_t dctl = {.d32 = 0 }; ++ dctl.b.nakonbble = 1; ++ DWC_MODIFY_REG32(&dev_if->dev_global_regs->dctl, 0, dctl.d32); ++ } ++ ++ if (core_if->snpsid >= OTG_CORE_REV_2_94a) { ++ dctl_data_t dctl = {.d32 = 0 }; ++ dctl.d32 = DWC_READ_REG32(&dev_if->dev_global_regs->dctl); ++ dctl.b.sftdiscon = 0; ++ DWC_WRITE_REG32(&dev_if->dev_global_regs->dctl, dctl.d32); ++ } ++} ++ ++/** ++ * This function enables the Host mode interrupts. ++ * ++ * @param core_if Programming view of DWC_otg controller ++ */ ++void dwc_otg_enable_host_interrupts(dwc_otg_core_if_t * core_if) ++{ ++ dwc_otg_core_global_regs_t *global_regs = core_if->core_global_regs; ++ gintmsk_data_t intr_mask = {.d32 = 0 }; ++ ++ DWC_DEBUGPL(DBG_CIL, "%s(%p)\n", __func__, core_if); ++ ++ /* Disable all interrupts. */ ++ DWC_WRITE_REG32(&global_regs->gintmsk, 0); ++ ++ /* Clear any pending interrupts. */ ++ DWC_WRITE_REG32(&global_regs->gintsts, 0xFFFFFFFF); ++ ++ /* Enable the common interrupts */ ++ dwc_otg_enable_common_interrupts(core_if); ++ ++ /* ++ * Enable host mode interrupts without disturbing common ++ * interrupts. ++ */ ++ ++ intr_mask.b.disconnect = 1; ++ intr_mask.b.portintr = 1; ++ intr_mask.b.hcintr = 1; ++ ++ DWC_MODIFY_REG32(&global_regs->gintmsk, intr_mask.d32, intr_mask.d32); ++} ++ ++/** ++ * This function disables the Host Mode interrupts. ++ * ++ * @param core_if Programming view of DWC_otg controller ++ */ ++void dwc_otg_disable_host_interrupts(dwc_otg_core_if_t * core_if) ++{ ++ dwc_otg_core_global_regs_t *global_regs = core_if->core_global_regs; ++ gintmsk_data_t intr_mask = {.d32 = 0 }; ++ ++ DWC_DEBUGPL(DBG_CILV, "%s()\n", __func__); ++ ++ /* ++ * Disable host mode interrupts without disturbing common ++ * interrupts. ++ */ ++ intr_mask.b.sofintr = 1; ++ intr_mask.b.portintr = 1; ++ intr_mask.b.hcintr = 1; ++ intr_mask.b.ptxfempty = 1; ++ intr_mask.b.nptxfempty = 1; ++ ++ DWC_MODIFY_REG32(&global_regs->gintmsk, intr_mask.d32, 0); ++} ++ ++/** ++ * This function initializes the DWC_otg controller registers for ++ * host mode. ++ * ++ * This function flushes the Tx and Rx FIFOs and it flushes any entries in the ++ * request queues. Host channels are reset to ensure that they are ready for ++ * performing transfers. ++ * ++ * @param core_if Programming view of DWC_otg controller ++ * ++ */ ++void dwc_otg_core_host_init(dwc_otg_core_if_t * core_if) ++{ ++ dwc_otg_core_global_regs_t *global_regs = core_if->core_global_regs; ++ dwc_otg_host_if_t *host_if = core_if->host_if; ++ dwc_otg_core_params_t *params = core_if->core_params; ++ hprt0_data_t hprt0 = {.d32 = 0 }; ++ fifosize_data_t nptxfifosize; ++ fifosize_data_t ptxfifosize; ++ uint16_t rxfsiz, nptxfsiz, hptxfsiz; ++ gdfifocfg_data_t gdfifocfg = {.d32 = 0 }; ++ int i; ++ hcchar_data_t hcchar; ++ hcfg_data_t hcfg; ++ hfir_data_t hfir; ++ dwc_otg_hc_regs_t *hc_regs; ++ int num_channels; ++ gotgctl_data_t gotgctl = {.d32 = 0 }; ++ ++ DWC_DEBUGPL(DBG_CILV, "%s(%p)\n", __func__, core_if); ++ ++ /* Restart the Phy Clock */ ++ DWC_WRITE_REG32(core_if->pcgcctl, 0); ++ ++ /* Initialize Host Configuration Register */ ++ init_fslspclksel(core_if); ++ if (core_if->core_params->speed == DWC_SPEED_PARAM_FULL) { ++ hcfg.d32 = DWC_READ_REG32(&host_if->host_global_regs->hcfg); ++ hcfg.b.fslssupp = 1; ++ DWC_WRITE_REG32(&host_if->host_global_regs->hcfg, hcfg.d32); ++ ++ } ++ ++ /* This bit allows dynamic reloading of the HFIR register ++ * during runtime. This bit needs to be programmed during ++ * initial configuration and its value must not be changed ++ * during runtime.*/ ++ if (core_if->core_params->reload_ctl == 1) { ++ hfir.d32 = DWC_READ_REG32(&host_if->host_global_regs->hfir); ++ hfir.b.hfirrldctrl = 1; ++ DWC_WRITE_REG32(&host_if->host_global_regs->hfir, hfir.d32); ++ } ++ ++ if (core_if->core_params->dma_desc_enable) { ++ uint8_t op_mode = core_if->hwcfg2.b.op_mode; ++ if (! ++ (core_if->hwcfg4.b.desc_dma ++ && (core_if->snpsid >= OTG_CORE_REV_2_90a) ++ && ((op_mode == DWC_HWCFG2_OP_MODE_HNP_SRP_CAPABLE_OTG) ++ || (op_mode == DWC_HWCFG2_OP_MODE_SRP_ONLY_CAPABLE_OTG) ++ || (op_mode == ++ DWC_HWCFG2_OP_MODE_NO_HNP_SRP_CAPABLE_OTG) ++ || (op_mode == DWC_HWCFG2_OP_MODE_SRP_CAPABLE_HOST) ++ || (op_mode == ++ DWC_HWCFG2_OP_MODE_NO_SRP_CAPABLE_HOST)))) { ++ ++ DWC_ERROR("Host can't operate in Descriptor DMA mode.\n" ++ "Either core version is below 2.90a or " ++ "GHWCFG2, GHWCFG4 registers' values do not allow Descriptor DMA in host mode.\n" ++ "To run the driver in Buffer DMA host mode set dma_desc_enable " ++ "module parameter to 0.\n"); ++ return; ++ } ++ hcfg.d32 = DWC_READ_REG32(&host_if->host_global_regs->hcfg); ++ hcfg.b.descdma = 1; ++ DWC_WRITE_REG32(&host_if->host_global_regs->hcfg, hcfg.d32); ++ } ++ ++ /* Configure data FIFO sizes */ ++ if (core_if->hwcfg2.b.dynamic_fifo && params->enable_dynamic_fifo) { ++ DWC_DEBUGPL(DBG_CIL, "Total FIFO Size=%d\n", ++ core_if->total_fifo_size); ++ DWC_DEBUGPL(DBG_CIL, "Rx FIFO Size=%d\n", ++ params->host_rx_fifo_size); ++ DWC_DEBUGPL(DBG_CIL, "NP Tx FIFO Size=%d\n", ++ params->host_nperio_tx_fifo_size); ++ DWC_DEBUGPL(DBG_CIL, "P Tx FIFO Size=%d\n", ++ params->host_perio_tx_fifo_size); ++ ++ /* Rx FIFO */ ++ DWC_DEBUGPL(DBG_CIL, "initial grxfsiz=%08x\n", ++ DWC_READ_REG32(&global_regs->grxfsiz)); ++ DWC_WRITE_REG32(&global_regs->grxfsiz, ++ params->host_rx_fifo_size); ++ DWC_DEBUGPL(DBG_CIL, "new grxfsiz=%08x\n", ++ DWC_READ_REG32(&global_regs->grxfsiz)); ++ ++ /* Non-periodic Tx FIFO */ ++ DWC_DEBUGPL(DBG_CIL, "initial gnptxfsiz=%08x\n", ++ DWC_READ_REG32(&global_regs->gnptxfsiz)); ++ nptxfifosize.b.depth = params->host_nperio_tx_fifo_size; ++ nptxfifosize.b.startaddr = params->host_rx_fifo_size; ++ DWC_WRITE_REG32(&global_regs->gnptxfsiz, nptxfifosize.d32); ++ DWC_DEBUGPL(DBG_CIL, "new gnptxfsiz=%08x\n", ++ DWC_READ_REG32(&global_regs->gnptxfsiz)); ++ ++ /* Periodic Tx FIFO */ ++ DWC_DEBUGPL(DBG_CIL, "initial hptxfsiz=%08x\n", ++ DWC_READ_REG32(&global_regs->hptxfsiz)); ++ ptxfifosize.b.depth = params->host_perio_tx_fifo_size; ++ ptxfifosize.b.startaddr = ++ nptxfifosize.b.startaddr + nptxfifosize.b.depth; ++ DWC_WRITE_REG32(&global_regs->hptxfsiz, ptxfifosize.d32); ++ DWC_DEBUGPL(DBG_CIL, "new hptxfsiz=%08x\n", ++ DWC_READ_REG32(&global_regs->hptxfsiz)); ++ ++ if (core_if->en_multiple_tx_fifo ++ && core_if->snpsid <= OTG_CORE_REV_2_94a) { ++ /* Global DFIFOCFG calculation for Host mode - include RxFIFO, NPTXFIFO and HPTXFIFO */ ++ gdfifocfg.d32 = DWC_READ_REG32(&global_regs->gdfifocfg); ++ rxfsiz = (DWC_READ_REG32(&global_regs->grxfsiz) & 0x0000ffff); ++ nptxfsiz = (DWC_READ_REG32(&global_regs->gnptxfsiz) >> 16); ++ hptxfsiz = (DWC_READ_REG32(&global_regs->hptxfsiz) >> 16); ++ gdfifocfg.b.epinfobase = rxfsiz + nptxfsiz + hptxfsiz; ++ DWC_WRITE_REG32(&global_regs->gdfifocfg, gdfifocfg.d32); ++ } ++ } ++ ++ /* TODO - check this */ ++ /* Clear Host Set HNP Enable in the OTG Control Register */ ++ gotgctl.b.hstsethnpen = 1; ++ DWC_MODIFY_REG32(&global_regs->gotgctl, gotgctl.d32, 0); ++ /* Make sure the FIFOs are flushed. */ ++ dwc_otg_flush_tx_fifo(core_if, 0x10 /* all TX FIFOs */ ); ++ dwc_otg_flush_rx_fifo(core_if); ++ ++ /* Clear Host Set HNP Enable in the OTG Control Register */ ++ gotgctl.b.hstsethnpen = 1; ++ DWC_MODIFY_REG32(&global_regs->gotgctl, gotgctl.d32, 0); ++ ++ if (!core_if->core_params->dma_desc_enable) { ++ /* Flush out any leftover queued requests. */ ++ num_channels = core_if->core_params->host_channels; ++ ++ for (i = 0; i < num_channels; i++) { ++ hc_regs = core_if->host_if->hc_regs[i]; ++ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); ++ hcchar.b.chen = 0; ++ hcchar.b.chdis = 1; ++ hcchar.b.epdir = 0; ++ DWC_WRITE_REG32(&hc_regs->hcchar, hcchar.d32); ++ } ++ ++ /* Halt all channels to put them into a known state. */ ++ for (i = 0; i < num_channels; i++) { ++ int count = 0; ++ hc_regs = core_if->host_if->hc_regs[i]; ++ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); ++ hcchar.b.chen = 1; ++ hcchar.b.chdis = 1; ++ hcchar.b.epdir = 0; ++ DWC_WRITE_REG32(&hc_regs->hcchar, hcchar.d32); ++ DWC_DEBUGPL(DBG_HCDV, "%s: Halt channel %d regs %p\n", __func__, i, hc_regs); ++ do { ++ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); ++ if (++count > 1000) { ++ DWC_ERROR ++ ("%s: Unable to clear halt on channel %d (timeout HCCHAR 0x%X @%p)\n", ++ __func__, i, hcchar.d32, &hc_regs->hcchar); ++ break; ++ } ++ dwc_udelay(1); ++ } while (hcchar.b.chen); ++ } ++ } ++ ++ /* Turn on the vbus power. */ ++ DWC_PRINTF("Init: Port Power? op_state=%d\n", core_if->op_state); ++ if (core_if->op_state == A_HOST) { ++ hprt0.d32 = dwc_otg_read_hprt0(core_if); ++ DWC_PRINTF("Init: Power Port (%d)\n", hprt0.b.prtpwr); ++ if (hprt0.b.prtpwr == 0) { ++ hprt0.b.prtpwr = 1; ++ DWC_WRITE_REG32(host_if->hprt0, hprt0.d32); ++ } ++ } ++ ++ dwc_otg_enable_host_interrupts(core_if); ++} ++ ++/** ++ * Prepares a host channel for transferring packets to/from a specific ++ * endpoint. The HCCHARn register is set up with the characteristics specified ++ * in _hc. Host channel interrupts that may need to be serviced while this ++ * transfer is in progress are enabled. ++ * ++ * @param core_if Programming view of DWC_otg controller ++ * @param hc Information needed to initialize the host channel ++ */ ++void dwc_otg_hc_init(dwc_otg_core_if_t * core_if, dwc_hc_t * hc) ++{ ++ hcintmsk_data_t hc_intr_mask; ++ hcchar_data_t hcchar; ++ hcsplt_data_t hcsplt; ++ ++ uint8_t hc_num = hc->hc_num; ++ dwc_otg_host_if_t *host_if = core_if->host_if; ++ dwc_otg_hc_regs_t *hc_regs = host_if->hc_regs[hc_num]; ++ ++ /* Clear old interrupt conditions for this host channel. */ ++ hc_intr_mask.d32 = 0xFFFFFFFF; ++ hc_intr_mask.b.reserved14_31 = 0; ++ DWC_WRITE_REG32(&hc_regs->hcint, hc_intr_mask.d32); ++ ++ /* Enable channel interrupts required for this transfer. */ ++ hc_intr_mask.d32 = 0; ++ hc_intr_mask.b.chhltd = 1; ++ if (core_if->dma_enable) { ++ /* For Descriptor DMA mode core halts the channel on AHB error. Interrupt is not required */ ++ if (!core_if->dma_desc_enable) ++ hc_intr_mask.b.ahberr = 1; ++ else { ++ if (hc->ep_type == DWC_OTG_EP_TYPE_ISOC) ++ hc_intr_mask.b.xfercompl = 1; ++ } ++ ++ if (hc->error_state && !hc->do_split && ++ hc->ep_type != DWC_OTG_EP_TYPE_ISOC) { ++ hc_intr_mask.b.ack = 1; ++ if (hc->ep_is_in) { ++ hc_intr_mask.b.datatglerr = 1; ++ if (hc->ep_type != DWC_OTG_EP_TYPE_INTR) { ++ hc_intr_mask.b.nak = 1; ++ } ++ } ++ } ++ } else { ++ switch (hc->ep_type) { ++ case DWC_OTG_EP_TYPE_CONTROL: ++ case DWC_OTG_EP_TYPE_BULK: ++ hc_intr_mask.b.xfercompl = 1; ++ hc_intr_mask.b.stall = 1; ++ hc_intr_mask.b.xacterr = 1; ++ hc_intr_mask.b.datatglerr = 1; ++ if (hc->ep_is_in) { ++ hc_intr_mask.b.bblerr = 1; ++ } else { ++ hc_intr_mask.b.nak = 1; ++ hc_intr_mask.b.nyet = 1; ++ if (hc->do_ping) { ++ hc_intr_mask.b.ack = 1; ++ } ++ } ++ ++ if (hc->do_split) { ++ hc_intr_mask.b.nak = 1; ++ if (hc->complete_split) { ++ hc_intr_mask.b.nyet = 1; ++ } else { ++ hc_intr_mask.b.ack = 1; ++ } ++ } ++ ++ if (hc->error_state) { ++ hc_intr_mask.b.ack = 1; ++ } ++ break; ++ case DWC_OTG_EP_TYPE_INTR: ++ hc_intr_mask.b.xfercompl = 1; ++ hc_intr_mask.b.nak = 1; ++ hc_intr_mask.b.stall = 1; ++ hc_intr_mask.b.xacterr = 1; ++ hc_intr_mask.b.datatglerr = 1; ++ hc_intr_mask.b.frmovrun = 1; ++ ++ if (hc->ep_is_in) { ++ hc_intr_mask.b.bblerr = 1; ++ } ++ if (hc->error_state) { ++ hc_intr_mask.b.ack = 1; ++ } ++ if (hc->do_split) { ++ if (hc->complete_split) { ++ hc_intr_mask.b.nyet = 1; ++ } else { ++ hc_intr_mask.b.ack = 1; ++ } ++ } ++ break; ++ case DWC_OTG_EP_TYPE_ISOC: ++ hc_intr_mask.b.xfercompl = 1; ++ hc_intr_mask.b.frmovrun = 1; ++ hc_intr_mask.b.ack = 1; ++ ++ if (hc->ep_is_in) { ++ hc_intr_mask.b.xacterr = 1; ++ hc_intr_mask.b.bblerr = 1; ++ } ++ break; ++ } ++ } ++ DWC_WRITE_REG32(&hc_regs->hcintmsk, hc_intr_mask.d32); ++ ++ /* ++ * Program the HCCHARn register with the endpoint characteristics for ++ * the current transfer. ++ */ ++ hcchar.d32 = 0; ++ hcchar.b.devaddr = hc->dev_addr; ++ hcchar.b.epnum = hc->ep_num; ++ hcchar.b.epdir = hc->ep_is_in; ++ hcchar.b.lspddev = (hc->speed == DWC_OTG_EP_SPEED_LOW); ++ hcchar.b.eptype = hc->ep_type; ++ hcchar.b.mps = hc->max_packet; ++ ++ DWC_WRITE_REG32(&host_if->hc_regs[hc_num]->hcchar, hcchar.d32); ++ ++ DWC_DEBUGPL(DBG_HCDV, "%s: Channel %d, Dev Addr %d, EP #%d\n", ++ __func__, hc->hc_num, hcchar.b.devaddr, hcchar.b.epnum); ++ DWC_DEBUGPL(DBG_HCDV, " Is In %d, Is Low Speed %d, EP Type %d, " ++ "Max Pkt %d, Multi Cnt %d\n", ++ hcchar.b.epdir, hcchar.b.lspddev, hcchar.b.eptype, ++ hcchar.b.mps, hcchar.b.multicnt); ++ ++ /* ++ * Program the HCSPLIT register for SPLITs ++ */ ++ hcsplt.d32 = 0; ++ if (hc->do_split) { ++ DWC_DEBUGPL(DBG_HCDV, "Programming HC %d with split --> %s\n", ++ hc->hc_num, ++ hc->complete_split ? "CSPLIT" : "SSPLIT"); ++ hcsplt.b.compsplt = hc->complete_split; ++ hcsplt.b.xactpos = hc->xact_pos; ++ hcsplt.b.hubaddr = hc->hub_addr; ++ hcsplt.b.prtaddr = hc->port_addr; ++ DWC_DEBUGPL(DBG_HCDV, "\t comp split %d\n", hc->complete_split); ++ DWC_DEBUGPL(DBG_HCDV, "\t xact pos %d\n", hc->xact_pos); ++ DWC_DEBUGPL(DBG_HCDV, "\t hub addr %d\n", hc->hub_addr); ++ DWC_DEBUGPL(DBG_HCDV, "\t port addr %d\n", hc->port_addr); ++ DWC_DEBUGPL(DBG_HCDV, "\t is_in %d\n", hc->ep_is_in); ++ DWC_DEBUGPL(DBG_HCDV, "\t Max Pkt: %d\n", hcchar.b.mps); ++ DWC_DEBUGPL(DBG_HCDV, "\t xferlen: %d\n", hc->xfer_len); ++ } ++ DWC_WRITE_REG32(&host_if->hc_regs[hc_num]->hcsplt, hcsplt.d32); ++ ++} ++ ++/** ++ * Attempts to halt a host channel. This function should only be called in ++ * Slave mode or to abort a transfer in either Slave mode or DMA mode. Under ++ * normal circumstances in DMA mode, the controller halts the channel when the ++ * transfer is complete or a condition occurs that requires application ++ * intervention. ++ * ++ * In slave mode, checks for a free request queue entry, then sets the Channel ++ * Enable and Channel Disable bits of the Host Channel Characteristics ++ * register of the specified channel to intiate the halt. If there is no free ++ * request queue entry, sets only the Channel Disable bit of the HCCHARn ++ * register to flush requests for this channel. In the latter case, sets a ++ * flag to indicate that the host channel needs to be halted when a request ++ * queue slot is open. ++ * ++ * In DMA mode, always sets the Channel Enable and Channel Disable bits of the ++ * HCCHARn register. The controller ensures there is space in the request ++ * queue before submitting the halt request. ++ * ++ * Some time may elapse before the core flushes any posted requests for this ++ * host channel and halts. The Channel Halted interrupt handler completes the ++ * deactivation of the host channel. ++ * ++ * @param core_if Controller register interface. ++ * @param hc Host channel to halt. ++ * @param halt_status Reason for halting the channel. ++ */ ++void dwc_otg_hc_halt(dwc_otg_core_if_t * core_if, ++ dwc_hc_t * hc, dwc_otg_halt_status_e halt_status) ++{ ++ gnptxsts_data_t nptxsts; ++ hptxsts_data_t hptxsts; ++ hcchar_data_t hcchar; ++ dwc_otg_hc_regs_t *hc_regs; ++ dwc_otg_core_global_regs_t *global_regs; ++ dwc_otg_host_global_regs_t *host_global_regs; ++ ++ hc_regs = core_if->host_if->hc_regs[hc->hc_num]; ++ global_regs = core_if->core_global_regs; ++ host_global_regs = core_if->host_if->host_global_regs; ++ ++ DWC_ASSERT(!(halt_status == DWC_OTG_HC_XFER_NO_HALT_STATUS), ++ "halt_status = %d\n", halt_status); ++ ++ if (halt_status == DWC_OTG_HC_XFER_URB_DEQUEUE || ++ halt_status == DWC_OTG_HC_XFER_AHB_ERR) { ++ /* ++ * Disable all channel interrupts except Ch Halted. The QTD ++ * and QH state associated with this transfer has been cleared ++ * (in the case of URB_DEQUEUE), so the channel needs to be ++ * shut down carefully to prevent crashes. ++ */ ++ hcintmsk_data_t hcintmsk; ++ hcintmsk.d32 = 0; ++ hcintmsk.b.chhltd = 1; ++ DWC_WRITE_REG32(&hc_regs->hcintmsk, hcintmsk.d32); ++ ++ /* ++ * Make sure no other interrupts besides halt are currently ++ * pending. Handling another interrupt could cause a crash due ++ * to the QTD and QH state. ++ */ ++ DWC_WRITE_REG32(&hc_regs->hcint, ~hcintmsk.d32); ++ ++ /* ++ * Make sure the halt status is set to URB_DEQUEUE or AHB_ERR ++ * even if the channel was already halted for some other ++ * reason. ++ */ ++ hc->halt_status = halt_status; ++ ++ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); ++ if (hcchar.b.chen == 0) { ++ /* ++ * The channel is either already halted or it hasn't ++ * started yet. In DMA mode, the transfer may halt if ++ * it finishes normally or a condition occurs that ++ * requires driver intervention. Don't want to halt ++ * the channel again. In either Slave or DMA mode, ++ * it's possible that the transfer has been assigned ++ * to a channel, but not started yet when an URB is ++ * dequeued. Don't want to halt a channel that hasn't ++ * started yet. ++ */ ++ return; ++ } ++ } ++ if (hc->halt_pending) { ++ /* ++ * A halt has already been issued for this channel. This might ++ * happen when a transfer is aborted by a higher level in ++ * the stack. ++ */ ++#ifdef DEBUG ++ DWC_PRINTF ++ ("*** %s: Channel %d, _hc->halt_pending already set ***\n", ++ __func__, hc->hc_num); ++ ++#endif ++ return; ++ } ++ ++ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); ++ ++ /* No need to set the bit in DDMA for disabling the channel */ ++ //TODO check it everywhere channel is disabled ++ if (!core_if->core_params->dma_desc_enable) ++ hcchar.b.chen = 1; ++ hcchar.b.chdis = 1; ++ ++ if (!core_if->dma_enable) { ++ /* Check for space in the request queue to issue the halt. */ ++ if (hc->ep_type == DWC_OTG_EP_TYPE_CONTROL || ++ hc->ep_type == DWC_OTG_EP_TYPE_BULK) { ++ nptxsts.d32 = DWC_READ_REG32(&global_regs->gnptxsts); ++ if (nptxsts.b.nptxqspcavail == 0) { ++ hcchar.b.chen = 0; ++ } ++ } else { ++ hptxsts.d32 = ++ DWC_READ_REG32(&host_global_regs->hptxsts); ++ if ((hptxsts.b.ptxqspcavail == 0) ++ || (core_if->queuing_high_bandwidth)) { ++ hcchar.b.chen = 0; ++ } ++ } ++ } ++ DWC_WRITE_REG32(&hc_regs->hcchar, hcchar.d32); ++ ++ hc->halt_status = halt_status; ++ ++ if (hcchar.b.chen) { ++ hc->halt_pending = 1; ++ hc->halt_on_queue = 0; ++ } else { ++ hc->halt_on_queue = 1; ++ } ++ ++ DWC_DEBUGPL(DBG_HCDV, "%s: Channel %d\n", __func__, hc->hc_num); ++ DWC_DEBUGPL(DBG_HCDV, " hcchar: 0x%08x\n", hcchar.d32); ++ DWC_DEBUGPL(DBG_HCDV, " halt_pending: %d\n", hc->halt_pending); ++ DWC_DEBUGPL(DBG_HCDV, " halt_on_queue: %d\n", hc->halt_on_queue); ++ DWC_DEBUGPL(DBG_HCDV, " halt_status: %d\n", hc->halt_status); ++ ++ return; ++} ++ ++/** ++ * Clears the transfer state for a host channel. This function is normally ++ * called after a transfer is done and the host channel is being released. ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ * @param hc Identifies the host channel to clean up. ++ */ ++void dwc_otg_hc_cleanup(dwc_otg_core_if_t * core_if, dwc_hc_t * hc) ++{ ++ dwc_otg_hc_regs_t *hc_regs; ++ ++ hc->xfer_started = 0; ++ ++ /* ++ * Clear channel interrupt enables and any unhandled channel interrupt ++ * conditions. ++ */ ++ hc_regs = core_if->host_if->hc_regs[hc->hc_num]; ++ DWC_WRITE_REG32(&hc_regs->hcintmsk, 0); ++ DWC_WRITE_REG32(&hc_regs->hcint, 0xFFFFFFFF); ++#ifdef DEBUG ++ DWC_TIMER_CANCEL(core_if->hc_xfer_timer[hc->hc_num]); ++#endif ++} ++ ++/** ++ * Sets the channel property that indicates in which frame a periodic transfer ++ * should occur. This is always set to the _next_ frame. This function has no ++ * effect on non-periodic transfers. ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ * @param hc Identifies the host channel to set up and its properties. ++ * @param hcchar Current value of the HCCHAR register for the specified host ++ * channel. ++ */ ++static inline void hc_set_even_odd_frame(dwc_otg_core_if_t * core_if, ++ dwc_hc_t * hc, hcchar_data_t * hcchar) ++{ ++ if (hc->ep_type == DWC_OTG_EP_TYPE_INTR || ++ hc->ep_type == DWC_OTG_EP_TYPE_ISOC) { ++ hfnum_data_t hfnum; ++ hfnum.d32 = ++ DWC_READ_REG32(&core_if->host_if->host_global_regs->hfnum); ++ ++ /* 1 if _next_ frame is odd, 0 if it's even */ ++ hcchar->b.oddfrm = (hfnum.b.frnum & 0x1) ? 0 : 1; ++#ifdef DEBUG ++ if (hc->ep_type == DWC_OTG_EP_TYPE_INTR && hc->do_split ++ && !hc->complete_split) { ++ switch (hfnum.b.frnum & 0x7) { ++ case 7: ++ core_if->hfnum_7_samples++; ++ core_if->hfnum_7_frrem_accum += hfnum.b.frrem; ++ break; ++ case 0: ++ core_if->hfnum_0_samples++; ++ core_if->hfnum_0_frrem_accum += hfnum.b.frrem; ++ break; ++ default: ++ core_if->hfnum_other_samples++; ++ core_if->hfnum_other_frrem_accum += ++ hfnum.b.frrem; ++ break; ++ } ++ } ++#endif ++ } ++} ++ ++#ifdef DEBUG ++void hc_xfer_timeout(void *ptr) ++{ ++ hc_xfer_info_t *xfer_info = NULL; ++ int hc_num = 0; ++ ++ if (ptr) ++ xfer_info = (hc_xfer_info_t *) ptr; ++ ++ if (!xfer_info->hc) { ++ DWC_ERROR("xfer_info->hc = %p\n", xfer_info->hc); ++ return; ++ } ++ ++ hc_num = xfer_info->hc->hc_num; ++ DWC_WARN("%s: timeout on channel %d\n", __func__, hc_num); ++ DWC_WARN(" start_hcchar_val 0x%08x\n", ++ xfer_info->core_if->start_hcchar_val[hc_num]); ++} ++#endif ++ ++void ep_xfer_timeout(void *ptr) ++{ ++ ep_xfer_info_t *xfer_info = NULL; ++ int ep_num = 0; ++ dctl_data_t dctl = {.d32 = 0 }; ++ gintsts_data_t gintsts = {.d32 = 0 }; ++ gintmsk_data_t gintmsk = {.d32 = 0 }; ++ ++ if (ptr) ++ xfer_info = (ep_xfer_info_t *) ptr; ++ ++ if (!xfer_info->ep) { ++ DWC_ERROR("xfer_info->ep = %p\n", xfer_info->ep); ++ return; ++ } ++ ++ ep_num = xfer_info->ep->num; ++ DWC_WARN("%s: timeout on endpoit %d\n", __func__, ep_num); ++ /* Put the sate to 2 as it was time outed */ ++ xfer_info->state = 2; ++ ++ dctl.d32 = ++ DWC_READ_REG32(&xfer_info->core_if->dev_if->dev_global_regs->dctl); ++ gintsts.d32 = ++ DWC_READ_REG32(&xfer_info->core_if->core_global_regs->gintsts); ++ gintmsk.d32 = ++ DWC_READ_REG32(&xfer_info->core_if->core_global_regs->gintmsk); ++ ++ if (!gintmsk.b.goutnakeff) { ++ /* Unmask it */ ++ gintmsk.b.goutnakeff = 1; ++ DWC_WRITE_REG32(&xfer_info->core_if->core_global_regs->gintmsk, ++ gintmsk.d32); ++ ++ } ++ ++ if (!gintsts.b.goutnakeff) { ++ dctl.b.sgoutnak = 1; ++ } ++ DWC_WRITE_REG32(&xfer_info->core_if->dev_if->dev_global_regs->dctl, ++ dctl.d32); ++ ++} ++ ++void set_pid_isoc(dwc_hc_t * hc) ++{ ++ /* Set up the initial PID for the transfer. */ ++ if (hc->speed == DWC_OTG_EP_SPEED_HIGH) { ++ if (hc->ep_is_in) { ++ if (hc->multi_count == 1) { ++ hc->data_pid_start = DWC_OTG_HC_PID_DATA0; ++ } else if (hc->multi_count == 2) { ++ hc->data_pid_start = DWC_OTG_HC_PID_DATA1; ++ } else { ++ hc->data_pid_start = DWC_OTG_HC_PID_DATA2; ++ } ++ } else { ++ if (hc->multi_count == 1) { ++ hc->data_pid_start = DWC_OTG_HC_PID_DATA0; ++ } else { ++ hc->data_pid_start = DWC_OTG_HC_PID_MDATA; ++ } ++ } ++ } else { ++ hc->data_pid_start = DWC_OTG_HC_PID_DATA0; ++ } ++} ++ ++/** ++ * This function does the setup for a data transfer for a host channel and ++ * starts the transfer. May be called in either Slave mode or DMA mode. In ++ * Slave mode, the caller must ensure that there is sufficient space in the ++ * request queue and Tx Data FIFO. ++ * ++ * For an OUT transfer in Slave mode, it loads a data packet into the ++ * appropriate FIFO. If necessary, additional data packets will be loaded in ++ * the Host ISR. ++ * ++ * For an IN transfer in Slave mode, a data packet is requested. The data ++ * packets are unloaded from the Rx FIFO in the Host ISR. If necessary, ++ * additional data packets are requested in the Host ISR. ++ * ++ * For a PING transfer in Slave mode, the Do Ping bit is set in the HCTSIZ ++ * register along with a packet count of 1 and the channel is enabled. This ++ * causes a single PING transaction to occur. Other fields in HCTSIZ are ++ * simply set to 0 since no data transfer occurs in this case. ++ * ++ * For a PING transfer in DMA mode, the HCTSIZ register is initialized with ++ * all the information required to perform the subsequent data transfer. In ++ * addition, the Do Ping bit is set in the HCTSIZ register. In this case, the ++ * controller performs the entire PING protocol, then starts the data ++ * transfer. ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ * @param hc Information needed to initialize the host channel. The xfer_len ++ * value may be reduced to accommodate the max widths of the XferSize and ++ * PktCnt fields in the HCTSIZn register. The multi_count value may be changed ++ * to reflect the final xfer_len value. ++ */ ++void dwc_otg_hc_start_transfer(dwc_otg_core_if_t * core_if, dwc_hc_t * hc) ++{ ++ hcchar_data_t hcchar; ++ hctsiz_data_t hctsiz; ++ uint16_t num_packets; ++ uint32_t max_hc_xfer_size = core_if->core_params->max_transfer_size; ++ uint16_t max_hc_pkt_count = core_if->core_params->max_packet_count; ++ dwc_otg_hc_regs_t *hc_regs = core_if->host_if->hc_regs[hc->hc_num]; ++ ++ hctsiz.d32 = 0; ++ ++ if (hc->do_ping) { ++ if (!core_if->dma_enable) { ++ dwc_otg_hc_do_ping(core_if, hc); ++ hc->xfer_started = 1; ++ return; ++ } else { ++ hctsiz.b.dopng = 1; ++ } ++ } ++ ++ if (hc->do_split) { ++ num_packets = 1; ++ ++ if (hc->complete_split && !hc->ep_is_in) { ++ /* For CSPLIT OUT Transfer, set the size to 0 so the ++ * core doesn't expect any data written to the FIFO */ ++ hc->xfer_len = 0; ++ } else if (hc->ep_is_in || (hc->xfer_len > hc->max_packet)) { ++ hc->xfer_len = hc->max_packet; ++ } else if (!hc->ep_is_in && (hc->xfer_len > 188)) { ++ hc->xfer_len = 188; ++ } ++ ++ hctsiz.b.xfersize = hc->xfer_len; ++ } else { ++ /* ++ * Ensure that the transfer length and packet count will fit ++ * in the widths allocated for them in the HCTSIZn register. ++ */ ++ if (hc->ep_type == DWC_OTG_EP_TYPE_INTR || ++ hc->ep_type == DWC_OTG_EP_TYPE_ISOC) { ++ /* ++ * Make sure the transfer size is no larger than one ++ * (micro)frame's worth of data. (A check was done ++ * when the periodic transfer was accepted to ensure ++ * that a (micro)frame's worth of data can be ++ * programmed into a channel.) ++ */ ++ uint32_t max_periodic_len = ++ hc->multi_count * hc->max_packet; ++ if (hc->xfer_len > max_periodic_len) { ++ hc->xfer_len = max_periodic_len; ++ } else { ++ } ++ } else if (hc->xfer_len > max_hc_xfer_size) { ++ /* Make sure that xfer_len is a multiple of max packet size. */ ++ hc->xfer_len = max_hc_xfer_size - hc->max_packet + 1; ++ } ++ ++ if (hc->xfer_len > 0) { ++ num_packets = ++ (hc->xfer_len + hc->max_packet - ++ 1) / hc->max_packet; ++ if (num_packets > max_hc_pkt_count) { ++ num_packets = max_hc_pkt_count; ++ hc->xfer_len = num_packets * hc->max_packet; ++ } ++ } else { ++ /* Need 1 packet for transfer length of 0. */ ++ num_packets = 1; ++ } ++ ++ if (hc->ep_is_in) { ++ /* Always program an integral # of max packets for IN transfers. */ ++ hc->xfer_len = num_packets * hc->max_packet; ++ } ++ ++ if (hc->ep_type == DWC_OTG_EP_TYPE_INTR || ++ hc->ep_type == DWC_OTG_EP_TYPE_ISOC) { ++ /* ++ * Make sure that the multi_count field matches the ++ * actual transfer length. ++ */ ++ hc->multi_count = num_packets; ++ } ++ ++ if (hc->ep_type == DWC_OTG_EP_TYPE_ISOC) ++ set_pid_isoc(hc); ++ ++ hctsiz.b.xfersize = hc->xfer_len; ++ } ++ ++ hc->start_pkt_count = num_packets; ++ hctsiz.b.pktcnt = num_packets; ++ hctsiz.b.pid = hc->data_pid_start; ++ DWC_WRITE_REG32(&hc_regs->hctsiz, hctsiz.d32); ++ ++ DWC_DEBUGPL(DBG_HCDV, "%s: Channel %d\n", __func__, hc->hc_num); ++ DWC_DEBUGPL(DBG_HCDV, " Xfer Size: %d\n", hctsiz.b.xfersize); ++ DWC_DEBUGPL(DBG_HCDV, " Num Pkts: %d\n", hctsiz.b.pktcnt); ++ DWC_DEBUGPL(DBG_HCDV, " Start PID: %d\n", hctsiz.b.pid); ++ ++ if (core_if->dma_enable) { ++ dwc_dma_t dma_addr; ++ if (hc->align_buff) { ++ dma_addr = hc->align_buff; ++ } else { ++ dma_addr = ((unsigned long)hc->xfer_buff & 0xffffffff); ++ } ++ DWC_WRITE_REG32(&hc_regs->hcdma, dma_addr); ++ } ++ ++ /* Start the split */ ++ if (hc->do_split) { ++ hcsplt_data_t hcsplt; ++ hcsplt.d32 = DWC_READ_REG32(&hc_regs->hcsplt); ++ hcsplt.b.spltena = 1; ++ DWC_WRITE_REG32(&hc_regs->hcsplt, hcsplt.d32); ++ } ++ ++ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); ++ hcchar.b.multicnt = hc->multi_count; ++ hc_set_even_odd_frame(core_if, hc, &hcchar); ++#ifdef DEBUG ++ core_if->start_hcchar_val[hc->hc_num] = hcchar.d32; ++ if (hcchar.b.chdis) { ++ DWC_WARN("%s: chdis set, channel %d, hcchar 0x%08x\n", ++ __func__, hc->hc_num, hcchar.d32); ++ } ++#endif ++ ++ /* Set host channel enable after all other setup is complete. */ ++ hcchar.b.chen = 1; ++ hcchar.b.chdis = 0; ++ DWC_WRITE_REG32(&hc_regs->hcchar, hcchar.d32); ++ ++ hc->xfer_started = 1; ++ hc->requests++; ++ ++ if (!core_if->dma_enable && !hc->ep_is_in && hc->xfer_len > 0) { ++ /* Load OUT packet into the appropriate Tx FIFO. */ ++ dwc_otg_hc_write_packet(core_if, hc); ++ } ++#ifdef DEBUG ++ if (hc->ep_type != DWC_OTG_EP_TYPE_INTR) { ++ DWC_DEBUGPL(DBG_HCDV, "transfer %d from core_if %p\n", ++ hc->hc_num, core_if);//GRAYG ++ core_if->hc_xfer_info[hc->hc_num].core_if = core_if; ++ core_if->hc_xfer_info[hc->hc_num].hc = hc; ++ ++ /* Start a timer for this transfer. */ ++ DWC_TIMER_SCHEDULE(core_if->hc_xfer_timer[hc->hc_num], 10000); ++ } ++#endif ++} ++ ++/** ++ * This function does the setup for a data transfer for a host channel ++ * and starts the transfer in Descriptor DMA mode. ++ * ++ * Initializes HCTSIZ register. For a PING transfer the Do Ping bit is set. ++ * Sets PID and NTD values. For periodic transfers ++ * initializes SCHED_INFO field with micro-frame bitmap. ++ * ++ * Initializes HCDMA register with descriptor list address and CTD value ++ * then starts the transfer via enabling the channel. ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ * @param hc Information needed to initialize the host channel. ++ */ ++void dwc_otg_hc_start_transfer_ddma(dwc_otg_core_if_t * core_if, dwc_hc_t * hc) ++{ ++ dwc_otg_hc_regs_t *hc_regs = core_if->host_if->hc_regs[hc->hc_num]; ++ hcchar_data_t hcchar; ++ hctsiz_data_t hctsiz; ++ hcdma_data_t hcdma; ++ ++ hctsiz.d32 = 0; ++ ++ if (hc->do_ping) ++ hctsiz.b_ddma.dopng = 1; ++ ++ if (hc->ep_type == DWC_OTG_EP_TYPE_ISOC) ++ set_pid_isoc(hc); ++ ++ /* Packet Count and Xfer Size are not used in Descriptor DMA mode */ ++ hctsiz.b_ddma.pid = hc->data_pid_start; ++ hctsiz.b_ddma.ntd = hc->ntd - 1; /* 0 - 1 descriptor, 1 - 2 descriptors, etc. */ ++ hctsiz.b_ddma.schinfo = hc->schinfo; /* Non-zero only for high-speed interrupt endpoints */ ++ ++ DWC_DEBUGPL(DBG_HCDV, "%s: Channel %d\n", __func__, hc->hc_num); ++ DWC_DEBUGPL(DBG_HCDV, " Start PID: %d\n", hctsiz.b.pid); ++ DWC_DEBUGPL(DBG_HCDV, " NTD: %d\n", hctsiz.b_ddma.ntd); ++ ++ DWC_WRITE_REG32(&hc_regs->hctsiz, hctsiz.d32); ++ ++ hcdma.d32 = 0; ++ hcdma.b.dma_addr = ((uint32_t) hc->desc_list_addr) >> 11; ++ ++ /* Always start from first descriptor. */ ++ hcdma.b.ctd = 0; ++ DWC_WRITE_REG32(&hc_regs->hcdma, hcdma.d32); ++ ++ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); ++ hcchar.b.multicnt = hc->multi_count; ++ ++#ifdef DEBUG ++ core_if->start_hcchar_val[hc->hc_num] = hcchar.d32; ++ if (hcchar.b.chdis) { ++ DWC_WARN("%s: chdis set, channel %d, hcchar 0x%08x\n", ++ __func__, hc->hc_num, hcchar.d32); ++ } ++#endif ++ ++ /* Set host channel enable after all other setup is complete. */ ++ hcchar.b.chen = 1; ++ hcchar.b.chdis = 0; ++ ++ DWC_WRITE_REG32(&hc_regs->hcchar, hcchar.d32); ++ ++ hc->xfer_started = 1; ++ hc->requests++; ++ ++#ifdef DEBUG ++ if ((hc->ep_type != DWC_OTG_EP_TYPE_INTR) ++ && (hc->ep_type != DWC_OTG_EP_TYPE_ISOC)) { ++ DWC_DEBUGPL(DBG_HCDV, "DMA transfer %d from core_if %p\n", ++ hc->hc_num, core_if);//GRAYG ++ core_if->hc_xfer_info[hc->hc_num].core_if = core_if; ++ core_if->hc_xfer_info[hc->hc_num].hc = hc; ++ /* Start a timer for this transfer. */ ++ DWC_TIMER_SCHEDULE(core_if->hc_xfer_timer[hc->hc_num], 10000); ++ } ++#endif ++ ++} ++ ++/** ++ * This function continues a data transfer that was started by previous call ++ * to <code>dwc_otg_hc_start_transfer</code>. The caller must ensure there is ++ * sufficient space in the request queue and Tx Data FIFO. This function ++ * should only be called in Slave mode. In DMA mode, the controller acts ++ * autonomously to complete transfers programmed to a host channel. ++ * ++ * For an OUT transfer, a new data packet is loaded into the appropriate FIFO ++ * if there is any data remaining to be queued. For an IN transfer, another ++ * data packet is always requested. For the SETUP phase of a control transfer, ++ * this function does nothing. ++ * ++ * @return 1 if a new request is queued, 0 if no more requests are required ++ * for this transfer. ++ */ ++int dwc_otg_hc_continue_transfer(dwc_otg_core_if_t * core_if, dwc_hc_t * hc) ++{ ++ DWC_DEBUGPL(DBG_HCDV, "%s: Channel %d\n", __func__, hc->hc_num); ++ ++ if (hc->do_split) { ++ /* SPLITs always queue just once per channel */ ++ return 0; ++ } else if (hc->data_pid_start == DWC_OTG_HC_PID_SETUP) { ++ /* SETUPs are queued only once since they can't be NAKed. */ ++ return 0; ++ } else if (hc->ep_is_in) { ++ /* ++ * Always queue another request for other IN transfers. If ++ * back-to-back INs are issued and NAKs are received for both, ++ * the driver may still be processing the first NAK when the ++ * second NAK is received. When the interrupt handler clears ++ * the NAK interrupt for the first NAK, the second NAK will ++ * not be seen. So we can't depend on the NAK interrupt ++ * handler to requeue a NAKed request. Instead, IN requests ++ * are issued each time this function is called. When the ++ * transfer completes, the extra requests for the channel will ++ * be flushed. ++ */ ++ hcchar_data_t hcchar; ++ dwc_otg_hc_regs_t *hc_regs = ++ core_if->host_if->hc_regs[hc->hc_num]; ++ ++ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); ++ hc_set_even_odd_frame(core_if, hc, &hcchar); ++ hcchar.b.chen = 1; ++ hcchar.b.chdis = 0; ++ DWC_DEBUGPL(DBG_HCDV, " IN xfer: hcchar = 0x%08x\n", ++ hcchar.d32); ++ DWC_WRITE_REG32(&hc_regs->hcchar, hcchar.d32); ++ hc->requests++; ++ return 1; ++ } else { ++ /* OUT transfers. */ ++ if (hc->xfer_count < hc->xfer_len) { ++ if (hc->ep_type == DWC_OTG_EP_TYPE_INTR || ++ hc->ep_type == DWC_OTG_EP_TYPE_ISOC) { ++ hcchar_data_t hcchar; ++ dwc_otg_hc_regs_t *hc_regs; ++ hc_regs = core_if->host_if->hc_regs[hc->hc_num]; ++ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); ++ hc_set_even_odd_frame(core_if, hc, &hcchar); ++ } ++ ++ /* Load OUT packet into the appropriate Tx FIFO. */ ++ dwc_otg_hc_write_packet(core_if, hc); ++ hc->requests++; ++ return 1; ++ } else { ++ return 0; ++ } ++ } ++} ++ ++/** ++ * Starts a PING transfer. This function should only be called in Slave mode. ++ * The Do Ping bit is set in the HCTSIZ register, then the channel is enabled. ++ */ ++void dwc_otg_hc_do_ping(dwc_otg_core_if_t * core_if, dwc_hc_t * hc) ++{ ++ hcchar_data_t hcchar; ++ hctsiz_data_t hctsiz; ++ dwc_otg_hc_regs_t *hc_regs = core_if->host_if->hc_regs[hc->hc_num]; ++ ++ DWC_DEBUGPL(DBG_HCDV, "%s: Channel %d\n", __func__, hc->hc_num); ++ ++ hctsiz.d32 = 0; ++ hctsiz.b.dopng = 1; ++ hctsiz.b.pktcnt = 1; ++ DWC_WRITE_REG32(&hc_regs->hctsiz, hctsiz.d32); ++ ++ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); ++ hcchar.b.chen = 1; ++ hcchar.b.chdis = 0; ++ DWC_WRITE_REG32(&hc_regs->hcchar, hcchar.d32); ++} ++ ++/* ++ * This function writes a packet into the Tx FIFO associated with the Host ++ * Channel. For a channel associated with a non-periodic EP, the non-periodic ++ * Tx FIFO is written. For a channel associated with a periodic EP, the ++ * periodic Tx FIFO is written. This function should only be called in Slave ++ * mode. ++ * ++ * Upon return the xfer_buff and xfer_count fields in _hc are incremented by ++ * then number of bytes written to the Tx FIFO. ++ */ ++void dwc_otg_hc_write_packet(dwc_otg_core_if_t * core_if, dwc_hc_t * hc) ++{ ++ uint32_t i; ++ uint32_t remaining_count; ++ uint32_t byte_count; ++ uint32_t dword_count; ++ ++ uint32_t *data_buff = (uint32_t *) (hc->xfer_buff); ++ uint32_t *data_fifo = core_if->data_fifo[hc->hc_num]; ++ ++ remaining_count = hc->xfer_len - hc->xfer_count; ++ if (remaining_count > hc->max_packet) { ++ byte_count = hc->max_packet; ++ } else { ++ byte_count = remaining_count; ++ } ++ ++ dword_count = (byte_count + 3) / 4; ++ ++ if ((((unsigned long)data_buff) & 0x3) == 0) { ++ /* xfer_buff is DWORD aligned. */ ++ for (i = 0; i < dword_count; i++, data_buff++) { ++ DWC_WRITE_REG32(data_fifo, *data_buff); ++ } ++ } else { ++ /* xfer_buff is not DWORD aligned. */ ++ for (i = 0; i < dword_count; i++, data_buff++) { ++ uint32_t data; ++ data = ++ (data_buff[0] | data_buff[1] << 8 | data_buff[2] << ++ 16 | data_buff[3] << 24); ++ DWC_WRITE_REG32(data_fifo, data); ++ } ++ } ++ ++ hc->xfer_count += byte_count; ++ hc->xfer_buff += byte_count; ++} ++ ++/** ++ * Gets the current USB frame number. This is the frame number from the last ++ * SOF packet. ++ */ ++uint32_t dwc_otg_get_frame_number(dwc_otg_core_if_t * core_if) ++{ ++ dsts_data_t dsts; ++ dsts.d32 = DWC_READ_REG32(&core_if->dev_if->dev_global_regs->dsts); ++ ++ /* read current frame/microframe number from DSTS register */ ++ return dsts.b.soffn; ++} ++ ++/** ++ * Calculates and gets the frame Interval value of HFIR register according PHY ++ * type and speed.The application can modify a value of HFIR register only after ++ * the Port Enable bit of the Host Port Control and Status register ++ * (HPRT.PrtEnaPort) has been set. ++*/ ++ ++uint32_t calc_frame_interval(dwc_otg_core_if_t * core_if) ++{ ++ gusbcfg_data_t usbcfg; ++ hwcfg2_data_t hwcfg2; ++ hprt0_data_t hprt0; ++ int clock = 60; // default value ++ usbcfg.d32 = DWC_READ_REG32(&core_if->core_global_regs->gusbcfg); ++ hwcfg2.d32 = DWC_READ_REG32(&core_if->core_global_regs->ghwcfg2); ++ hprt0.d32 = DWC_READ_REG32(core_if->host_if->hprt0); ++ if (!usbcfg.b.physel && usbcfg.b.ulpi_utmi_sel && !usbcfg.b.phyif) ++ clock = 60; ++ if (usbcfg.b.physel && hwcfg2.b.fs_phy_type == 3) ++ clock = 48; ++ if (!usbcfg.b.phylpwrclksel && !usbcfg.b.physel && ++ !usbcfg.b.ulpi_utmi_sel && usbcfg.b.phyif) ++ clock = 30; ++ if (!usbcfg.b.phylpwrclksel && !usbcfg.b.physel && ++ !usbcfg.b.ulpi_utmi_sel && !usbcfg.b.phyif) ++ clock = 60; ++ if (usbcfg.b.phylpwrclksel && !usbcfg.b.physel && ++ !usbcfg.b.ulpi_utmi_sel && usbcfg.b.phyif) ++ clock = 48; ++ if (usbcfg.b.physel && !usbcfg.b.phyif && hwcfg2.b.fs_phy_type == 2) ++ clock = 48; ++ if (usbcfg.b.physel && hwcfg2.b.fs_phy_type == 1) ++ clock = 48; ++ if (hprt0.b.prtspd == 0) ++ /* High speed case */ ++ return 125 * clock - 1; ++ else ++ /* FS/LS case */ ++ return 1000 * clock - 1; ++} ++ ++/** ++ * This function reads a setup packet from the Rx FIFO into the destination ++ * buffer. This function is called from the Rx Status Queue Level (RxStsQLvl) ++ * Interrupt routine when a SETUP packet has been received in Slave mode. ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ * @param dest Destination buffer for packet data. ++ */ ++void dwc_otg_read_setup_packet(dwc_otg_core_if_t * core_if, uint32_t * dest) ++{ ++ device_grxsts_data_t status; ++ /* Get the 8 bytes of a setup transaction data */ ++ ++ /* Pop 2 DWORDS off the receive data FIFO into memory */ ++ dest[0] = DWC_READ_REG32(core_if->data_fifo[0]); ++ dest[1] = DWC_READ_REG32(core_if->data_fifo[0]); ++ if (core_if->snpsid >= OTG_CORE_REV_3_00a) { ++ status.d32 = ++ DWC_READ_REG32(&core_if->core_global_regs->grxstsp); ++ DWC_DEBUGPL(DBG_ANY, ++ "EP:%d BCnt:%d " "pktsts:%x Frame:%d(0x%0x)\n", ++ status.b.epnum, status.b.bcnt, status.b.pktsts, ++ status.b.fn, status.b.fn); ++ } ++} ++ ++/** ++ * This function enables EP0 OUT to receive SETUP packets and configures EP0 ++ * IN for transmitting packets. It is normally called when the ++ * "Enumeration Done" interrupt occurs. ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ * @param ep The EP0 data. ++ */ ++void dwc_otg_ep0_activate(dwc_otg_core_if_t * core_if, dwc_ep_t * ep) ++{ ++ dwc_otg_dev_if_t *dev_if = core_if->dev_if; ++ dsts_data_t dsts; ++ depctl_data_t diepctl; ++ depctl_data_t doepctl; ++ dctl_data_t dctl = {.d32 = 0 }; ++ ++ ep->stp_rollover = 0; ++ /* Read the Device Status and Endpoint 0 Control registers */ ++ dsts.d32 = DWC_READ_REG32(&dev_if->dev_global_regs->dsts); ++ diepctl.d32 = DWC_READ_REG32(&dev_if->in_ep_regs[0]->diepctl); ++ doepctl.d32 = DWC_READ_REG32(&dev_if->out_ep_regs[0]->doepctl); ++ ++ /* Set the MPS of the IN EP based on the enumeration speed */ ++ switch (dsts.b.enumspd) { ++ case DWC_DSTS_ENUMSPD_HS_PHY_30MHZ_OR_60MHZ: ++ case DWC_DSTS_ENUMSPD_FS_PHY_30MHZ_OR_60MHZ: ++ case DWC_DSTS_ENUMSPD_FS_PHY_48MHZ: ++ diepctl.b.mps = DWC_DEP0CTL_MPS_64; ++ break; ++ case DWC_DSTS_ENUMSPD_LS_PHY_6MHZ: ++ diepctl.b.mps = DWC_DEP0CTL_MPS_8; ++ break; ++ } ++ ++ DWC_WRITE_REG32(&dev_if->in_ep_regs[0]->diepctl, diepctl.d32); ++ ++ /* Enable OUT EP for receive */ ++ if (core_if->snpsid <= OTG_CORE_REV_2_94a) { ++ doepctl.b.epena = 1; ++ DWC_WRITE_REG32(&dev_if->out_ep_regs[0]->doepctl, doepctl.d32); ++ } ++#ifdef VERBOSE ++ DWC_DEBUGPL(DBG_PCDV, "doepctl0=%0x\n", ++ DWC_READ_REG32(&dev_if->out_ep_regs[0]->doepctl)); ++ DWC_DEBUGPL(DBG_PCDV, "diepctl0=%0x\n", ++ DWC_READ_REG32(&dev_if->in_ep_regs[0]->diepctl)); ++#endif ++ dctl.b.cgnpinnak = 1; ++ ++ DWC_MODIFY_REG32(&dev_if->dev_global_regs->dctl, dctl.d32, dctl.d32); ++ DWC_DEBUGPL(DBG_PCDV, "dctl=%0x\n", ++ DWC_READ_REG32(&dev_if->dev_global_regs->dctl)); ++ ++} ++ ++/** ++ * This function activates an EP. The Device EP control register for ++ * the EP is configured as defined in the ep structure. Note: This ++ * function is not used for EP0. ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ * @param ep The EP to activate. ++ */ ++void dwc_otg_ep_activate(dwc_otg_core_if_t * core_if, dwc_ep_t * ep) ++{ ++ dwc_otg_dev_if_t *dev_if = core_if->dev_if; ++ depctl_data_t depctl; ++ volatile uint32_t *addr; ++ daint_data_t daintmsk = {.d32 = 0 }; ++ dcfg_data_t dcfg; ++ uint8_t i; ++ ++ DWC_DEBUGPL(DBG_PCDV, "%s() EP%d-%s\n", __func__, ep->num, ++ (ep->is_in ? "IN" : "OUT")); ++ ++#ifdef DWC_UTE_PER_IO ++ ep->xiso_frame_num = 0xFFFFFFFF; ++ ep->xiso_active_xfers = 0; ++ ep->xiso_queued_xfers = 0; ++#endif ++ /* Read DEPCTLn register */ ++ if (ep->is_in == 1) { ++ addr = &dev_if->in_ep_regs[ep->num]->diepctl; ++ daintmsk.ep.in = 1 << ep->num; ++ } else { ++ addr = &dev_if->out_ep_regs[ep->num]->doepctl; ++ daintmsk.ep.out = 1 << ep->num; ++ } ++ ++ /* If the EP is already active don't change the EP Control ++ * register. */ ++ depctl.d32 = DWC_READ_REG32(addr); ++ if (!depctl.b.usbactep) { ++ depctl.b.mps = ep->maxpacket; ++ depctl.b.eptype = ep->type; ++ depctl.b.txfnum = ep->tx_fifo_num; ++ ++ if (ep->type == DWC_OTG_EP_TYPE_ISOC) { ++ depctl.b.setd0pid = 1; // ??? ++ } else { ++ depctl.b.setd0pid = 1; ++ } ++ depctl.b.usbactep = 1; ++ ++ /* Update nextep_seq array and EPMSCNT in DCFG*/ ++ if (!(depctl.b.eptype & 1) && (ep->is_in == 1)) { // NP IN EP ++ for (i = 0; i <= core_if->dev_if->num_in_eps; i++) { ++ if (core_if->nextep_seq[i] == core_if->first_in_nextep_seq) ++ break; ++ } ++ core_if->nextep_seq[i] = ep->num; ++ core_if->nextep_seq[ep->num] = core_if->first_in_nextep_seq; ++ depctl.b.nextep = core_if->nextep_seq[ep->num]; ++ dcfg.d32 = DWC_READ_REG32(&dev_if->dev_global_regs->dcfg); ++ dcfg.b.epmscnt++; ++ DWC_WRITE_REG32(&dev_if->dev_global_regs->dcfg, dcfg.d32); ++ ++ DWC_DEBUGPL(DBG_PCDV, ++ "%s first_in_nextep_seq= %2d; nextep_seq[]:\n", ++ __func__, core_if->first_in_nextep_seq); ++ for (i=0; i <= core_if->dev_if->num_in_eps; i++) { ++ DWC_DEBUGPL(DBG_PCDV, "%2d\n", ++ core_if->nextep_seq[i]); ++ } ++ ++ } ++ ++ ++ DWC_WRITE_REG32(addr, depctl.d32); ++ DWC_DEBUGPL(DBG_PCDV, "DEPCTL=%08x\n", DWC_READ_REG32(addr)); ++ } ++ ++ /* Enable the Interrupt for this EP */ ++ if (core_if->multiproc_int_enable) { ++ if (ep->is_in == 1) { ++ diepmsk_data_t diepmsk = {.d32 = 0 }; ++ diepmsk.b.xfercompl = 1; ++ diepmsk.b.timeout = 1; ++ diepmsk.b.epdisabled = 1; ++ diepmsk.b.ahberr = 1; ++ diepmsk.b.intknepmis = 1; ++ if (!core_if->en_multiple_tx_fifo && core_if->dma_enable) ++ diepmsk.b.intknepmis = 0; ++ diepmsk.b.txfifoundrn = 1; //????? ++ if (ep->type == DWC_OTG_EP_TYPE_ISOC) { ++ diepmsk.b.nak = 1; ++ } ++ ++ ++ ++/* ++ if (core_if->dma_desc_enable) { ++ diepmsk.b.bna = 1; ++ } ++*/ ++/* ++ if (core_if->dma_enable) { ++ doepmsk.b.nak = 1; ++ } ++*/ ++ DWC_WRITE_REG32(&dev_if->dev_global_regs-> ++ diepeachintmsk[ep->num], diepmsk.d32); ++ ++ } else { ++ doepmsk_data_t doepmsk = {.d32 = 0 }; ++ doepmsk.b.xfercompl = 1; ++ doepmsk.b.ahberr = 1; ++ doepmsk.b.epdisabled = 1; ++ if (ep->type == DWC_OTG_EP_TYPE_ISOC) ++ doepmsk.b.outtknepdis = 1; ++ ++/* ++ ++ if (core_if->dma_desc_enable) { ++ doepmsk.b.bna = 1; ++ } ++*/ ++/* ++ doepmsk.b.babble = 1; ++ doepmsk.b.nyet = 1; ++ doepmsk.b.nak = 1; ++*/ ++ DWC_WRITE_REG32(&dev_if->dev_global_regs-> ++ doepeachintmsk[ep->num], doepmsk.d32); ++ } ++ DWC_MODIFY_REG32(&dev_if->dev_global_regs->deachintmsk, ++ 0, daintmsk.d32); ++ } else { ++ if (ep->type == DWC_OTG_EP_TYPE_ISOC) { ++ if (ep->is_in) { ++ diepmsk_data_t diepmsk = {.d32 = 0 }; ++ diepmsk.b.nak = 1; ++ DWC_MODIFY_REG32(&dev_if->dev_global_regs->diepmsk, 0, diepmsk.d32); ++ } else { ++ doepmsk_data_t doepmsk = {.d32 = 0 }; ++ doepmsk.b.outtknepdis = 1; ++ DWC_MODIFY_REG32(&dev_if->dev_global_regs->doepmsk, 0, doepmsk.d32); ++ } ++ } ++ DWC_MODIFY_REG32(&dev_if->dev_global_regs->daintmsk, ++ 0, daintmsk.d32); ++ } ++ ++ DWC_DEBUGPL(DBG_PCDV, "DAINTMSK=%0x\n", ++ DWC_READ_REG32(&dev_if->dev_global_regs->daintmsk)); ++ ++ ep->stall_clear_flag = 0; ++ ++ return; ++} ++ ++/** ++ * This function deactivates an EP. This is done by clearing the USB Active ++ * EP bit in the Device EP control register. Note: This function is not used ++ * for EP0. EP0 cannot be deactivated. ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ * @param ep The EP to deactivate. ++ */ ++void dwc_otg_ep_deactivate(dwc_otg_core_if_t * core_if, dwc_ep_t * ep) ++{ ++ depctl_data_t depctl = {.d32 = 0 }; ++ volatile uint32_t *addr; ++ daint_data_t daintmsk = {.d32 = 0 }; ++ dcfg_data_t dcfg; ++ uint8_t i = 0; ++ ++#ifdef DWC_UTE_PER_IO ++ ep->xiso_frame_num = 0xFFFFFFFF; ++ ep->xiso_active_xfers = 0; ++ ep->xiso_queued_xfers = 0; ++#endif ++ ++ /* Read DEPCTLn register */ ++ if (ep->is_in == 1) { ++ addr = &core_if->dev_if->in_ep_regs[ep->num]->diepctl; ++ daintmsk.ep.in = 1 << ep->num; ++ } else { ++ addr = &core_if->dev_if->out_ep_regs[ep->num]->doepctl; ++ daintmsk.ep.out = 1 << ep->num; ++ } ++ ++ depctl.d32 = DWC_READ_REG32(addr); ++ ++ depctl.b.usbactep = 0; ++ ++ /* Update nextep_seq array and EPMSCNT in DCFG*/ ++ if (!(depctl.b.eptype & 1) && ep->is_in == 1) { // NP EP IN ++ for (i = 0; i <= core_if->dev_if->num_in_eps; i++) { ++ if (core_if->nextep_seq[i] == ep->num) ++ break; ++ } ++ core_if->nextep_seq[i] = core_if->nextep_seq[ep->num]; ++ if (core_if->first_in_nextep_seq == ep->num) ++ core_if->first_in_nextep_seq = i; ++ core_if->nextep_seq[ep->num] = 0xff; ++ depctl.b.nextep = 0; ++ dcfg.d32 = ++ DWC_READ_REG32(&core_if->dev_if->dev_global_regs->dcfg); ++ dcfg.b.epmscnt--; ++ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->dcfg, ++ dcfg.d32); ++ ++ DWC_DEBUGPL(DBG_PCDV, ++ "%s first_in_nextep_seq= %2d; nextep_seq[]:\n", ++ __func__, core_if->first_in_nextep_seq); ++ for (i=0; i <= core_if->dev_if->num_in_eps; i++) { ++ DWC_DEBUGPL(DBG_PCDV, "%2d\n", core_if->nextep_seq[i]); ++ } ++ } ++ ++ if (ep->is_in == 1) ++ depctl.b.txfnum = 0; ++ ++ if (core_if->dma_desc_enable) ++ depctl.b.epdis = 1; ++ ++ DWC_WRITE_REG32(addr, depctl.d32); ++ depctl.d32 = DWC_READ_REG32(addr); ++ if (core_if->dma_enable && ep->type == DWC_OTG_EP_TYPE_ISOC ++ && depctl.b.epena) { ++ depctl_data_t depctl = {.d32 = 0}; ++ if (ep->is_in) { ++ diepint_data_t diepint = {.d32 = 0}; ++ ++ depctl.b.snak = 1; ++ DWC_WRITE_REG32(&core_if->dev_if->in_ep_regs[ep->num]-> ++ diepctl, depctl.d32); ++ do { ++ dwc_udelay(10); ++ diepint.d32 = ++ DWC_READ_REG32(&core_if-> ++ dev_if->in_ep_regs[ep->num]-> ++ diepint); ++ } while (!diepint.b.inepnakeff); ++ diepint.b.inepnakeff = 1; ++ DWC_WRITE_REG32(&core_if->dev_if->in_ep_regs[ep->num]-> ++ diepint, diepint.d32); ++ depctl.d32 = 0; ++ depctl.b.epdis = 1; ++ DWC_WRITE_REG32(&core_if->dev_if->in_ep_regs[ep->num]-> ++ diepctl, depctl.d32); ++ do { ++ dwc_udelay(10); ++ diepint.d32 = ++ DWC_READ_REG32(&core_if-> ++ dev_if->in_ep_regs[ep->num]-> ++ diepint); ++ } while (!diepint.b.epdisabled); ++ diepint.b.epdisabled = 1; ++ DWC_WRITE_REG32(&core_if->dev_if->in_ep_regs[ep->num]-> ++ diepint, diepint.d32); ++ } else { ++ dctl_data_t dctl = {.d32 = 0}; ++ gintmsk_data_t gintsts = {.d32 = 0}; ++ doepint_data_t doepint = {.d32 = 0}; ++ dctl.b.sgoutnak = 1; ++ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs-> ++ dctl, 0, dctl.d32); ++ do { ++ dwc_udelay(10); ++ gintsts.d32 = DWC_READ_REG32(&core_if->core_global_regs->gintsts); ++ } while (!gintsts.b.goutnakeff); ++ gintsts.d32 = 0; ++ gintsts.b.goutnakeff = 1; ++ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, gintsts.d32); ++ ++ depctl.d32 = 0; ++ depctl.b.epdis = 1; ++ depctl.b.snak = 1; ++ DWC_WRITE_REG32(&core_if->dev_if->out_ep_regs[ep->num]->doepctl, depctl.d32); ++ do ++ { ++ dwc_udelay(10); ++ doepint.d32 = DWC_READ_REG32(&core_if->dev_if-> ++ out_ep_regs[ep->num]->doepint); ++ } while (!doepint.b.epdisabled); ++ ++ doepint.b.epdisabled = 1; ++ DWC_WRITE_REG32(&core_if->dev_if->out_ep_regs[ep->num]->doepint, doepint.d32); ++ ++ dctl.d32 = 0; ++ dctl.b.cgoutnak = 1; ++ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs->dctl, 0, dctl.d32); ++ } ++ } ++ ++ /* Disable the Interrupt for this EP */ ++ if (core_if->multiproc_int_enable) { ++ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs->deachintmsk, ++ daintmsk.d32, 0); ++ ++ if (ep->is_in == 1) { ++ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs-> ++ diepeachintmsk[ep->num], 0); ++ } else { ++ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs-> ++ doepeachintmsk[ep->num], 0); ++ } ++ } else { ++ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs->daintmsk, ++ daintmsk.d32, 0); ++ } ++ ++} ++ ++/** ++ * This function initializes dma descriptor chain. ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ * @param ep The EP to start the transfer on. ++ */ ++static void init_dma_desc_chain(dwc_otg_core_if_t * core_if, dwc_ep_t * ep) ++{ ++ dwc_otg_dev_dma_desc_t *dma_desc; ++ uint32_t offset; ++ uint32_t xfer_est; ++ int i; ++ unsigned maxxfer_local, total_len; ++ ++ if (!ep->is_in && ep->type == DWC_OTG_EP_TYPE_INTR && ++ (ep->maxpacket%4)) { ++ maxxfer_local = ep->maxpacket; ++ total_len = ep->xfer_len; ++ } else { ++ maxxfer_local = ep->maxxfer; ++ total_len = ep->total_len; ++ } ++ ++ ep->desc_cnt = (total_len / maxxfer_local) + ++ ((total_len % maxxfer_local) ? 1 : 0); ++ ++ if (!ep->desc_cnt) ++ ep->desc_cnt = 1; ++ ++ if (ep->desc_cnt > MAX_DMA_DESC_CNT) ++ ep->desc_cnt = MAX_DMA_DESC_CNT; ++ ++ dma_desc = ep->desc_addr; ++ if (maxxfer_local == ep->maxpacket) { ++ if ((total_len % maxxfer_local) && ++ (total_len/maxxfer_local < MAX_DMA_DESC_CNT)) { ++ xfer_est = (ep->desc_cnt - 1) * maxxfer_local + ++ (total_len % maxxfer_local); ++ } else ++ xfer_est = ep->desc_cnt * maxxfer_local; ++ } else ++ xfer_est = total_len; ++ offset = 0; ++ for (i = 0; i < ep->desc_cnt; ++i) { ++ /** DMA Descriptor Setup */ ++ if (xfer_est > maxxfer_local) { ++ dma_desc->status.b.bs = BS_HOST_BUSY; ++ dma_desc->status.b.l = 0; ++ dma_desc->status.b.ioc = 0; ++ dma_desc->status.b.sp = 0; ++ dma_desc->status.b.bytes = maxxfer_local; ++ dma_desc->buf = ep->dma_addr + offset; ++ dma_desc->status.b.sts = 0; ++ dma_desc->status.b.bs = BS_HOST_READY; ++ ++ xfer_est -= maxxfer_local; ++ offset += maxxfer_local; ++ } else { ++ dma_desc->status.b.bs = BS_HOST_BUSY; ++ dma_desc->status.b.l = 1; ++ dma_desc->status.b.ioc = 1; ++ if (ep->is_in) { ++ dma_desc->status.b.sp = ++ (xfer_est % ++ ep->maxpacket) ? 1 : ((ep-> ++ sent_zlp) ? 1 : 0); ++ dma_desc->status.b.bytes = xfer_est; ++ } else { ++ if (maxxfer_local == ep->maxpacket) ++ dma_desc->status.b.bytes = xfer_est; ++ else ++ dma_desc->status.b.bytes = ++ xfer_est + ((4 - (xfer_est & 0x3)) & 0x3); ++ } ++ ++ dma_desc->buf = ep->dma_addr + offset; ++ dma_desc->status.b.sts = 0; ++ dma_desc->status.b.bs = BS_HOST_READY; ++ } ++ dma_desc++; ++ } ++} ++/** ++ * This function is called when to write ISOC data into appropriate dedicated ++ * periodic FIFO. ++ */ ++static int32_t write_isoc_tx_fifo(dwc_otg_core_if_t * core_if, dwc_ep_t * dwc_ep) ++{ ++ dwc_otg_dev_if_t *dev_if = core_if->dev_if; ++ dwc_otg_dev_in_ep_regs_t *ep_regs; ++ dtxfsts_data_t txstatus = {.d32 = 0 }; ++ uint32_t len = 0; ++ int epnum = dwc_ep->num; ++ int dwords; ++ ++ DWC_DEBUGPL(DBG_PCD, "Dedicated TxFifo Empty: %d \n", epnum); ++ ++ ep_regs = core_if->dev_if->in_ep_regs[epnum]; ++ ++ len = dwc_ep->xfer_len - dwc_ep->xfer_count; ++ ++ if (len > dwc_ep->maxpacket) { ++ len = dwc_ep->maxpacket; ++ } ++ ++ dwords = (len + 3) / 4; ++ ++ /* While there is space in the queue and space in the FIFO and ++ * More data to tranfer, Write packets to the Tx FIFO */ ++ txstatus.d32 = DWC_READ_REG32(&dev_if->in_ep_regs[epnum]->dtxfsts); ++ DWC_DEBUGPL(DBG_PCDV, "b4 dtxfsts[%d]=0x%08x\n", epnum, txstatus.d32); ++ ++ while (txstatus.b.txfspcavail > dwords && ++ dwc_ep->xfer_count < dwc_ep->xfer_len && dwc_ep->xfer_len != 0) { ++ /* Write the FIFO */ ++ dwc_otg_ep_write_packet(core_if, dwc_ep, 0); ++ ++ len = dwc_ep->xfer_len - dwc_ep->xfer_count; ++ if (len > dwc_ep->maxpacket) { ++ len = dwc_ep->maxpacket; ++ } ++ ++ dwords = (len + 3) / 4; ++ txstatus.d32 = ++ DWC_READ_REG32(&dev_if->in_ep_regs[epnum]->dtxfsts); ++ DWC_DEBUGPL(DBG_PCDV, "dtxfsts[%d]=0x%08x\n", epnum, ++ txstatus.d32); ++ } ++ ++ DWC_DEBUGPL(DBG_PCDV, "b4 dtxfsts[%d]=0x%08x\n", epnum, ++ DWC_READ_REG32(&dev_if->in_ep_regs[epnum]->dtxfsts)); ++ ++ return 1; ++} ++/** ++ * This function does the setup for a data transfer for an EP and ++ * starts the transfer. For an IN transfer, the packets will be ++ * loaded into the appropriate Tx FIFO in the ISR. For OUT transfers, ++ * the packets are unloaded from the Rx FIFO in the ISR. the ISR. ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ * @param ep The EP to start the transfer on. ++ */ ++ ++void dwc_otg_ep_start_transfer(dwc_otg_core_if_t * core_if, dwc_ep_t * ep) ++{ ++ depctl_data_t depctl; ++ deptsiz_data_t deptsiz; ++ gintmsk_data_t intr_mask = {.d32 = 0 }; ++ ++ DWC_DEBUGPL((DBG_PCDV | DBG_CILV), "%s()\n", __func__); ++ DWC_DEBUGPL(DBG_PCD, "ep%d-%s xfer_len=%d xfer_cnt=%d " ++ "xfer_buff=%p start_xfer_buff=%p, total_len = %d\n", ++ ep->num, (ep->is_in ? "IN" : "OUT"), ep->xfer_len, ++ ep->xfer_count, ep->xfer_buff, ep->start_xfer_buff, ++ ep->total_len); ++ /* IN endpoint */ ++ if (ep->is_in == 1) { ++ dwc_otg_dev_in_ep_regs_t *in_regs = ++ core_if->dev_if->in_ep_regs[ep->num]; ++ ++ gnptxsts_data_t gtxstatus; ++ ++ gtxstatus.d32 = ++ DWC_READ_REG32(&core_if->core_global_regs->gnptxsts); ++ ++ if (core_if->en_multiple_tx_fifo == 0 ++ && gtxstatus.b.nptxqspcavail == 0 && !core_if->dma_enable) { ++#ifdef DEBUG ++ DWC_PRINTF("TX Queue Full (0x%0x)\n", gtxstatus.d32); ++#endif ++ return; ++ } ++ ++ depctl.d32 = DWC_READ_REG32(&(in_regs->diepctl)); ++ deptsiz.d32 = DWC_READ_REG32(&(in_regs->dieptsiz)); ++ ++ if (ep->maxpacket > ep->maxxfer / MAX_PKT_CNT) ++ ep->xfer_len += (ep->maxxfer < (ep->total_len - ep->xfer_len)) ? ++ ep->maxxfer : (ep->total_len - ep->xfer_len); ++ else ++ ep->xfer_len += (MAX_PKT_CNT * ep->maxpacket < (ep->total_len - ep->xfer_len)) ? ++ MAX_PKT_CNT * ep->maxpacket : (ep->total_len - ep->xfer_len); ++ ++ ++ /* Zero Length Packet? */ ++ if ((ep->xfer_len - ep->xfer_count) == 0) { ++ deptsiz.b.xfersize = 0; ++ deptsiz.b.pktcnt = 1; ++ } else { ++ /* Program the transfer size and packet count ++ * as follows: xfersize = N * maxpacket + ++ * short_packet pktcnt = N + (short_packet ++ * exist ? 1 : 0) ++ */ ++ deptsiz.b.xfersize = ep->xfer_len - ep->xfer_count; ++ deptsiz.b.pktcnt = ++ (ep->xfer_len - ep->xfer_count - 1 + ++ ep->maxpacket) / ep->maxpacket; ++ if (deptsiz.b.pktcnt > MAX_PKT_CNT) { ++ deptsiz.b.pktcnt = MAX_PKT_CNT; ++ deptsiz.b.xfersize = deptsiz.b.pktcnt * ep->maxpacket; ++ } ++ if (ep->type == DWC_OTG_EP_TYPE_ISOC) ++ deptsiz.b.mc = deptsiz.b.pktcnt; ++ } ++ ++ /* Write the DMA register */ ++ if (core_if->dma_enable) { ++ if (core_if->dma_desc_enable == 0) { ++ if (ep->type != DWC_OTG_EP_TYPE_ISOC) ++ deptsiz.b.mc = 1; ++ DWC_WRITE_REG32(&in_regs->dieptsiz, ++ deptsiz.d32); ++ DWC_WRITE_REG32(&(in_regs->diepdma), ++ (uint32_t) ep->dma_addr); ++ } else { ++#ifdef DWC_UTE_CFI ++ /* The descriptor chain should be already initialized by now */ ++ if (ep->buff_mode != BM_STANDARD) { ++ DWC_WRITE_REG32(&in_regs->diepdma, ++ ep->descs_dma_addr); ++ } else { ++#endif ++ init_dma_desc_chain(core_if, ep); ++ /** DIEPDMAn Register write */ ++ DWC_WRITE_REG32(&in_regs->diepdma, ++ ep->dma_desc_addr); ++#ifdef DWC_UTE_CFI ++ } ++#endif ++ } ++ } else { ++ DWC_WRITE_REG32(&in_regs->dieptsiz, deptsiz.d32); ++ if (ep->type != DWC_OTG_EP_TYPE_ISOC) { ++ /** ++ * Enable the Non-Periodic Tx FIFO empty interrupt, ++ * or the Tx FIFO epmty interrupt in dedicated Tx FIFO mode, ++ * the data will be written into the fifo by the ISR. ++ */ ++ if (core_if->en_multiple_tx_fifo == 0) { ++ intr_mask.b.nptxfempty = 1; ++ DWC_MODIFY_REG32 ++ (&core_if->core_global_regs->gintmsk, ++ intr_mask.d32, intr_mask.d32); ++ } else { ++ /* Enable the Tx FIFO Empty Interrupt for this EP */ ++ if (ep->xfer_len > 0) { ++ uint32_t fifoemptymsk = 0; ++ fifoemptymsk = 1 << ep->num; ++ DWC_MODIFY_REG32 ++ (&core_if->dev_if->dev_global_regs->dtknqr4_fifoemptymsk, ++ 0, fifoemptymsk); ++ ++ } ++ } ++ } else { ++ write_isoc_tx_fifo(core_if, ep); ++ } ++ } ++ if (!core_if->core_params->en_multiple_tx_fifo && core_if->dma_enable) ++ depctl.b.nextep = core_if->nextep_seq[ep->num]; ++ ++ if (ep->type == DWC_OTG_EP_TYPE_ISOC) { ++ dsts_data_t dsts = {.d32 = 0}; ++ if (ep->bInterval == 1) { ++ dsts.d32 = ++ DWC_READ_REG32(&core_if->dev_if-> ++ dev_global_regs->dsts); ++ ep->frame_num = dsts.b.soffn + ep->bInterval; ++ if (ep->frame_num > 0x3FFF) { ++ ep->frm_overrun = 1; ++ ep->frame_num &= 0x3FFF; ++ } else ++ ep->frm_overrun = 0; ++ if (ep->frame_num & 0x1) { ++ depctl.b.setd1pid = 1; ++ } else { ++ depctl.b.setd0pid = 1; ++ } ++ } ++ } ++ /* EP enable, IN data in FIFO */ ++ depctl.b.cnak = 1; ++ depctl.b.epena = 1; ++ DWC_WRITE_REG32(&in_regs->diepctl, depctl.d32); ++ ++ } else { ++ /* OUT endpoint */ ++ dwc_otg_dev_out_ep_regs_t *out_regs = ++ core_if->dev_if->out_ep_regs[ep->num]; ++ ++ depctl.d32 = DWC_READ_REG32(&(out_regs->doepctl)); ++ deptsiz.d32 = DWC_READ_REG32(&(out_regs->doeptsiz)); ++ ++ if (!core_if->dma_desc_enable) { ++ if (ep->maxpacket > ep->maxxfer / MAX_PKT_CNT) ++ ep->xfer_len += (ep->maxxfer < (ep->total_len - ep->xfer_len)) ? ++ ep->maxxfer : (ep->total_len - ep->xfer_len); ++ else ++ ep->xfer_len += (MAX_PKT_CNT * ep->maxpacket < (ep->total_len ++ - ep->xfer_len)) ? MAX_PKT_CNT * ep->maxpacket : (ep->total_len - ep->xfer_len); ++ } ++ ++ /* Program the transfer size and packet count as follows: ++ * ++ * pktcnt = N ++ * xfersize = N * maxpacket ++ */ ++ if ((ep->xfer_len - ep->xfer_count) == 0) { ++ /* Zero Length Packet */ ++ deptsiz.b.xfersize = ep->maxpacket; ++ deptsiz.b.pktcnt = 1; ++ } else { ++ deptsiz.b.pktcnt = ++ (ep->xfer_len - ep->xfer_count + ++ (ep->maxpacket - 1)) / ep->maxpacket; ++ if (deptsiz.b.pktcnt > MAX_PKT_CNT) { ++ deptsiz.b.pktcnt = MAX_PKT_CNT; ++ } ++ if (!core_if->dma_desc_enable) { ++ ep->xfer_len = ++ deptsiz.b.pktcnt * ep->maxpacket + ep->xfer_count; ++ } ++ deptsiz.b.xfersize = ep->xfer_len - ep->xfer_count; ++ } ++ ++ DWC_DEBUGPL(DBG_PCDV, "ep%d xfersize=%d pktcnt=%d\n", ++ ep->num, deptsiz.b.xfersize, deptsiz.b.pktcnt); ++ ++ if (core_if->dma_enable) { ++ if (!core_if->dma_desc_enable) { ++ DWC_WRITE_REG32(&out_regs->doeptsiz, ++ deptsiz.d32); ++ ++ DWC_WRITE_REG32(&(out_regs->doepdma), ++ (uint32_t) ep->dma_addr); ++ } else { ++#ifdef DWC_UTE_CFI ++ /* The descriptor chain should be already initialized by now */ ++ if (ep->buff_mode != BM_STANDARD) { ++ DWC_WRITE_REG32(&out_regs->doepdma, ++ ep->descs_dma_addr); ++ } else { ++#endif ++ /** This is used for interrupt out transfers*/ ++ if (!ep->xfer_len) ++ ep->xfer_len = ep->total_len; ++ init_dma_desc_chain(core_if, ep); ++ ++ if (core_if->core_params->dev_out_nak) { ++ if (ep->type == DWC_OTG_EP_TYPE_BULK) { ++ deptsiz.b.pktcnt = (ep->total_len + ++ (ep->maxpacket - 1)) / ep->maxpacket; ++ deptsiz.b.xfersize = ep->total_len; ++ /* Remember initial value of doeptsiz */ ++ core_if->start_doeptsiz_val[ep->num] = deptsiz.d32; ++ DWC_WRITE_REG32(&out_regs->doeptsiz, ++ deptsiz.d32); ++ } ++ } ++ /** DOEPDMAn Register write */ ++ DWC_WRITE_REG32(&out_regs->doepdma, ++ ep->dma_desc_addr); ++#ifdef DWC_UTE_CFI ++ } ++#endif ++ } ++ } else { ++ DWC_WRITE_REG32(&out_regs->doeptsiz, deptsiz.d32); ++ } ++ ++ if (ep->type == DWC_OTG_EP_TYPE_ISOC) { ++ dsts_data_t dsts = {.d32 = 0}; ++ if (ep->bInterval == 1) { ++ dsts.d32 = ++ DWC_READ_REG32(&core_if->dev_if-> ++ dev_global_regs->dsts); ++ ep->frame_num = dsts.b.soffn + ep->bInterval; ++ if (ep->frame_num > 0x3FFF) { ++ ep->frm_overrun = 1; ++ ep->frame_num &= 0x3FFF; ++ } else ++ ep->frm_overrun = 0; ++ ++ if (ep->frame_num & 0x1) { ++ depctl.b.setd1pid = 1; ++ } else { ++ depctl.b.setd0pid = 1; ++ } ++ } ++ } ++ ++ /* EP enable */ ++ depctl.b.cnak = 1; ++ depctl.b.epena = 1; ++ ++ DWC_WRITE_REG32(&out_regs->doepctl, depctl.d32); ++ ++ DWC_DEBUGPL(DBG_PCD, "DOEPCTL=%08x DOEPTSIZ=%08x\n", ++ DWC_READ_REG32(&out_regs->doepctl), ++ DWC_READ_REG32(&out_regs->doeptsiz)); ++ DWC_DEBUGPL(DBG_PCD, "DAINTMSK=%08x GINTMSK=%08x\n", ++ DWC_READ_REG32(&core_if->dev_if->dev_global_regs-> ++ daintmsk), ++ DWC_READ_REG32(&core_if->core_global_regs-> ++ gintmsk)); ++ ++ /* Timer is scheduling only for out bulk transfers for ++ * "Device DDMA OUT NAK Enhancement" feature to inform user ++ * about received data payload in case of timeout ++ */ ++ if (core_if->core_params->dev_out_nak) { ++ if (ep->type == DWC_OTG_EP_TYPE_BULK) { ++ core_if->ep_xfer_info[ep->num].core_if = core_if; ++ core_if->ep_xfer_info[ep->num].ep = ep; ++ core_if->ep_xfer_info[ep->num].state = 1; ++ ++ /* Start a timer for this transfer. */ ++ DWC_TIMER_SCHEDULE(core_if->ep_xfer_timer[ep->num], 10000); ++ } ++ } ++ } ++} ++ ++/** ++ * This function setup a zero length transfer in Buffer DMA and ++ * Slave modes for usb requests with zero field set ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ * @param ep The EP to start the transfer on. ++ * ++ */ ++void dwc_otg_ep_start_zl_transfer(dwc_otg_core_if_t * core_if, dwc_ep_t * ep) ++{ ++ ++ depctl_data_t depctl; ++ deptsiz_data_t deptsiz; ++ gintmsk_data_t intr_mask = {.d32 = 0 }; ++ ++ DWC_DEBUGPL((DBG_PCDV | DBG_CILV), "%s()\n", __func__); ++ DWC_PRINTF("zero length transfer is called\n"); ++ ++ /* IN endpoint */ ++ if (ep->is_in == 1) { ++ dwc_otg_dev_in_ep_regs_t *in_regs = ++ core_if->dev_if->in_ep_regs[ep->num]; ++ ++ depctl.d32 = DWC_READ_REG32(&(in_regs->diepctl)); ++ deptsiz.d32 = DWC_READ_REG32(&(in_regs->dieptsiz)); ++ ++ deptsiz.b.xfersize = 0; ++ deptsiz.b.pktcnt = 1; ++ ++ /* Write the DMA register */ ++ if (core_if->dma_enable) { ++ if (core_if->dma_desc_enable == 0) { ++ deptsiz.b.mc = 1; ++ DWC_WRITE_REG32(&in_regs->dieptsiz, ++ deptsiz.d32); ++ DWC_WRITE_REG32(&(in_regs->diepdma), ++ (uint32_t) ep->dma_addr); ++ } ++ } else { ++ DWC_WRITE_REG32(&in_regs->dieptsiz, deptsiz.d32); ++ /** ++ * Enable the Non-Periodic Tx FIFO empty interrupt, ++ * or the Tx FIFO epmty interrupt in dedicated Tx FIFO mode, ++ * the data will be written into the fifo by the ISR. ++ */ ++ if (core_if->en_multiple_tx_fifo == 0) { ++ intr_mask.b.nptxfempty = 1; ++ DWC_MODIFY_REG32(&core_if-> ++ core_global_regs->gintmsk, ++ intr_mask.d32, intr_mask.d32); ++ } else { ++ /* Enable the Tx FIFO Empty Interrupt for this EP */ ++ if (ep->xfer_len > 0) { ++ uint32_t fifoemptymsk = 0; ++ fifoemptymsk = 1 << ep->num; ++ DWC_MODIFY_REG32(&core_if-> ++ dev_if->dev_global_regs->dtknqr4_fifoemptymsk, ++ 0, fifoemptymsk); ++ } ++ } ++ } ++ ++ if (!core_if->core_params->en_multiple_tx_fifo && core_if->dma_enable) ++ depctl.b.nextep = core_if->nextep_seq[ep->num]; ++ /* EP enable, IN data in FIFO */ ++ depctl.b.cnak = 1; ++ depctl.b.epena = 1; ++ DWC_WRITE_REG32(&in_regs->diepctl, depctl.d32); ++ ++ } else { ++ /* OUT endpoint */ ++ dwc_otg_dev_out_ep_regs_t *out_regs = ++ core_if->dev_if->out_ep_regs[ep->num]; ++ ++ depctl.d32 = DWC_READ_REG32(&(out_regs->doepctl)); ++ deptsiz.d32 = DWC_READ_REG32(&(out_regs->doeptsiz)); ++ ++ /* Zero Length Packet */ ++ deptsiz.b.xfersize = ep->maxpacket; ++ deptsiz.b.pktcnt = 1; ++ ++ if (core_if->dma_enable) { ++ if (!core_if->dma_desc_enable) { ++ DWC_WRITE_REG32(&out_regs->doeptsiz, ++ deptsiz.d32); ++ ++ DWC_WRITE_REG32(&(out_regs->doepdma), ++ (uint32_t) ep->dma_addr); ++ } ++ } else { ++ DWC_WRITE_REG32(&out_regs->doeptsiz, deptsiz.d32); ++ } ++ ++ /* EP enable */ ++ depctl.b.cnak = 1; ++ depctl.b.epena = 1; ++ ++ DWC_WRITE_REG32(&out_regs->doepctl, depctl.d32); ++ ++ } ++} ++ ++/** ++ * This function does the setup for a data transfer for EP0 and starts ++ * the transfer. For an IN transfer, the packets will be loaded into ++ * the appropriate Tx FIFO in the ISR. For OUT transfers, the packets are ++ * unloaded from the Rx FIFO in the ISR. ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ * @param ep The EP0 data. ++ */ ++void dwc_otg_ep0_start_transfer(dwc_otg_core_if_t * core_if, dwc_ep_t * ep) ++{ ++ depctl_data_t depctl; ++ deptsiz0_data_t deptsiz; ++ gintmsk_data_t intr_mask = {.d32 = 0 }; ++ dwc_otg_dev_dma_desc_t *dma_desc; ++ ++ DWC_DEBUGPL(DBG_PCD, "ep%d-%s xfer_len=%d xfer_cnt=%d " ++ "xfer_buff=%p start_xfer_buff=%p \n", ++ ep->num, (ep->is_in ? "IN" : "OUT"), ep->xfer_len, ++ ep->xfer_count, ep->xfer_buff, ep->start_xfer_buff); ++ ++ ep->total_len = ep->xfer_len; ++ ++ /* IN endpoint */ ++ if (ep->is_in == 1) { ++ dwc_otg_dev_in_ep_regs_t *in_regs = ++ core_if->dev_if->in_ep_regs[0]; ++ ++ gnptxsts_data_t gtxstatus; ++ ++ if (core_if->snpsid >= OTG_CORE_REV_3_00a) { ++ depctl.d32 = DWC_READ_REG32(&in_regs->diepctl); ++ if (depctl.b.epena) ++ return; ++ } ++ ++ gtxstatus.d32 = ++ DWC_READ_REG32(&core_if->core_global_regs->gnptxsts); ++ ++ /* If dedicated FIFO every time flush fifo before enable ep*/ ++ if (core_if->en_multiple_tx_fifo && core_if->snpsid >= OTG_CORE_REV_3_00a) ++ dwc_otg_flush_tx_fifo(core_if, ep->tx_fifo_num); ++ ++ if (core_if->en_multiple_tx_fifo == 0 ++ && gtxstatus.b.nptxqspcavail == 0 ++ && !core_if->dma_enable) { ++#ifdef DEBUG ++ deptsiz.d32 = DWC_READ_REG32(&in_regs->dieptsiz); ++ DWC_DEBUGPL(DBG_PCD, "DIEPCTL0=%0x\n", ++ DWC_READ_REG32(&in_regs->diepctl)); ++ DWC_DEBUGPL(DBG_PCD, "DIEPTSIZ0=%0x (sz=%d, pcnt=%d)\n", ++ deptsiz.d32, ++ deptsiz.b.xfersize, deptsiz.b.pktcnt); ++ DWC_PRINTF("TX Queue or FIFO Full (0x%0x)\n", ++ gtxstatus.d32); ++#endif ++ return; ++ } ++ ++ depctl.d32 = DWC_READ_REG32(&in_regs->diepctl); ++ deptsiz.d32 = DWC_READ_REG32(&in_regs->dieptsiz); ++ ++ /* Zero Length Packet? */ ++ if (ep->xfer_len == 0) { ++ deptsiz.b.xfersize = 0; ++ deptsiz.b.pktcnt = 1; ++ } else { ++ /* Program the transfer size and packet count ++ * as follows: xfersize = N * maxpacket + ++ * short_packet pktcnt = N + (short_packet ++ * exist ? 1 : 0) ++ */ ++ if (ep->xfer_len > ep->maxpacket) { ++ ep->xfer_len = ep->maxpacket; ++ deptsiz.b.xfersize = ep->maxpacket; ++ } else { ++ deptsiz.b.xfersize = ep->xfer_len; ++ } ++ deptsiz.b.pktcnt = 1; ++ ++ } ++ DWC_DEBUGPL(DBG_PCDV, ++ "IN len=%d xfersize=%d pktcnt=%d [%08x]\n", ++ ep->xfer_len, deptsiz.b.xfersize, deptsiz.b.pktcnt, ++ deptsiz.d32); ++ ++ /* Write the DMA register */ ++ if (core_if->dma_enable) { ++ if (core_if->dma_desc_enable == 0) { ++ DWC_WRITE_REG32(&in_regs->dieptsiz, ++ deptsiz.d32); ++ ++ DWC_WRITE_REG32(&(in_regs->diepdma), ++ (uint32_t) ep->dma_addr); ++ } else { ++ dma_desc = core_if->dev_if->in_desc_addr; ++ ++ /** DMA Descriptor Setup */ ++ dma_desc->status.b.bs = BS_HOST_BUSY; ++ dma_desc->status.b.l = 1; ++ dma_desc->status.b.ioc = 1; ++ dma_desc->status.b.sp = ++ (ep->xfer_len == ep->maxpacket) ? 0 : 1; ++ dma_desc->status.b.bytes = ep->xfer_len; ++ dma_desc->buf = ep->dma_addr; ++ dma_desc->status.b.sts = 0; ++ dma_desc->status.b.bs = BS_HOST_READY; ++ ++ /** DIEPDMA0 Register write */ ++ DWC_WRITE_REG32(&in_regs->diepdma, ++ core_if-> ++ dev_if->dma_in_desc_addr); ++ } ++ } else { ++ DWC_WRITE_REG32(&in_regs->dieptsiz, deptsiz.d32); ++ } ++ ++ if (!core_if->core_params->en_multiple_tx_fifo && core_if->dma_enable) ++ depctl.b.nextep = core_if->nextep_seq[ep->num]; ++ /* EP enable, IN data in FIFO */ ++ depctl.b.cnak = 1; ++ depctl.b.epena = 1; ++ DWC_WRITE_REG32(&in_regs->diepctl, depctl.d32); ++ ++ /** ++ * Enable the Non-Periodic Tx FIFO empty interrupt, the ++ * data will be written into the fifo by the ISR. ++ */ ++ if (!core_if->dma_enable) { ++ if (core_if->en_multiple_tx_fifo == 0) { ++ intr_mask.b.nptxfempty = 1; ++ DWC_MODIFY_REG32(&core_if-> ++ core_global_regs->gintmsk, ++ intr_mask.d32, intr_mask.d32); ++ } else { ++ /* Enable the Tx FIFO Empty Interrupt for this EP */ ++ if (ep->xfer_len > 0) { ++ uint32_t fifoemptymsk = 0; ++ fifoemptymsk |= 1 << ep->num; ++ DWC_MODIFY_REG32(&core_if-> ++ dev_if->dev_global_regs->dtknqr4_fifoemptymsk, ++ 0, fifoemptymsk); ++ } ++ } ++ } ++ } else { ++ /* OUT endpoint */ ++ dwc_otg_dev_out_ep_regs_t *out_regs = ++ core_if->dev_if->out_ep_regs[0]; ++ ++ depctl.d32 = DWC_READ_REG32(&out_regs->doepctl); ++ deptsiz.d32 = DWC_READ_REG32(&out_regs->doeptsiz); ++ ++ /* Program the transfer size and packet count as follows: ++ * xfersize = N * (maxpacket + 4 - (maxpacket % 4)) ++ * pktcnt = N */ ++ /* Zero Length Packet */ ++ deptsiz.b.xfersize = ep->maxpacket; ++ deptsiz.b.pktcnt = 1; ++ if (core_if->snpsid >= OTG_CORE_REV_3_00a) ++ deptsiz.b.supcnt = 3; ++ ++ DWC_DEBUGPL(DBG_PCDV, "len=%d xfersize=%d pktcnt=%d\n", ++ ep->xfer_len, deptsiz.b.xfersize, deptsiz.b.pktcnt); ++ ++ if (core_if->dma_enable) { ++ if (!core_if->dma_desc_enable) { ++ DWC_WRITE_REG32(&out_regs->doeptsiz, ++ deptsiz.d32); ++ ++ DWC_WRITE_REG32(&(out_regs->doepdma), ++ (uint32_t) ep->dma_addr); ++ } else { ++ dma_desc = core_if->dev_if->out_desc_addr; ++ ++ /** DMA Descriptor Setup */ ++ dma_desc->status.b.bs = BS_HOST_BUSY; ++ if (core_if->snpsid >= OTG_CORE_REV_3_00a) { ++ dma_desc->status.b.mtrf = 0; ++ dma_desc->status.b.sr = 0; ++ } ++ dma_desc->status.b.l = 1; ++ dma_desc->status.b.ioc = 1; ++ dma_desc->status.b.bytes = ep->maxpacket; ++ dma_desc->buf = ep->dma_addr; ++ dma_desc->status.b.sts = 0; ++ dma_desc->status.b.bs = BS_HOST_READY; ++ ++ /** DOEPDMA0 Register write */ ++ DWC_WRITE_REG32(&out_regs->doepdma, ++ core_if->dev_if-> ++ dma_out_desc_addr); ++ } ++ } else { ++ DWC_WRITE_REG32(&out_regs->doeptsiz, deptsiz.d32); ++ } ++ ++ /* EP enable */ ++ depctl.b.cnak = 1; ++ depctl.b.epena = 1; ++ DWC_WRITE_REG32(&(out_regs->doepctl), depctl.d32); ++ } ++} ++ ++/** ++ * This function continues control IN transfers started by ++ * dwc_otg_ep0_start_transfer, when the transfer does not fit in a ++ * single packet. NOTE: The DIEPCTL0/DOEPCTL0 registers only have one ++ * bit for the packet count. ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ * @param ep The EP0 data. ++ */ ++void dwc_otg_ep0_continue_transfer(dwc_otg_core_if_t * core_if, dwc_ep_t * ep) ++{ ++ depctl_data_t depctl; ++ deptsiz0_data_t deptsiz; ++ gintmsk_data_t intr_mask = {.d32 = 0 }; ++ dwc_otg_dev_dma_desc_t *dma_desc; ++ ++ if (ep->is_in == 1) { ++ dwc_otg_dev_in_ep_regs_t *in_regs = ++ core_if->dev_if->in_ep_regs[0]; ++ gnptxsts_data_t tx_status = {.d32 = 0 }; ++ ++ tx_status.d32 = ++ DWC_READ_REG32(&core_if->core_global_regs->gnptxsts); ++ /** @todo Should there be check for room in the Tx ++ * Status Queue. If not remove the code above this comment. */ ++ ++ depctl.d32 = DWC_READ_REG32(&in_regs->diepctl); ++ deptsiz.d32 = DWC_READ_REG32(&in_regs->dieptsiz); ++ ++ /* Program the transfer size and packet count ++ * as follows: xfersize = N * maxpacket + ++ * short_packet pktcnt = N + (short_packet ++ * exist ? 1 : 0) ++ */ ++ ++ if (core_if->dma_desc_enable == 0) { ++ deptsiz.b.xfersize = ++ (ep->total_len - ep->xfer_count) > ++ ep->maxpacket ? ep->maxpacket : (ep->total_len - ++ ep->xfer_count); ++ deptsiz.b.pktcnt = 1; ++ if (core_if->dma_enable == 0) { ++ ep->xfer_len += deptsiz.b.xfersize; ++ } else { ++ ep->xfer_len = deptsiz.b.xfersize; ++ } ++ DWC_WRITE_REG32(&in_regs->dieptsiz, deptsiz.d32); ++ } else { ++ ep->xfer_len = ++ (ep->total_len - ep->xfer_count) > ++ ep->maxpacket ? ep->maxpacket : (ep->total_len - ++ ep->xfer_count); ++ ++ dma_desc = core_if->dev_if->in_desc_addr; ++ ++ /** DMA Descriptor Setup */ ++ dma_desc->status.b.bs = BS_HOST_BUSY; ++ dma_desc->status.b.l = 1; ++ dma_desc->status.b.ioc = 1; ++ dma_desc->status.b.sp = ++ (ep->xfer_len == ep->maxpacket) ? 0 : 1; ++ dma_desc->status.b.bytes = ep->xfer_len; ++ dma_desc->buf = ep->dma_addr; ++ dma_desc->status.b.sts = 0; ++ dma_desc->status.b.bs = BS_HOST_READY; ++ ++ /** DIEPDMA0 Register write */ ++ DWC_WRITE_REG32(&in_regs->diepdma, ++ core_if->dev_if->dma_in_desc_addr); ++ } ++ ++ DWC_DEBUGPL(DBG_PCDV, ++ "IN len=%d xfersize=%d pktcnt=%d [%08x]\n", ++ ep->xfer_len, deptsiz.b.xfersize, deptsiz.b.pktcnt, ++ deptsiz.d32); ++ ++ /* Write the DMA register */ ++ if (core_if->hwcfg2.b.architecture == DWC_INT_DMA_ARCH) { ++ if (core_if->dma_desc_enable == 0) ++ DWC_WRITE_REG32(&(in_regs->diepdma), ++ (uint32_t) ep->dma_addr); ++ } ++ if (!core_if->core_params->en_multiple_tx_fifo && core_if->dma_enable) ++ depctl.b.nextep = core_if->nextep_seq[ep->num]; ++ /* EP enable, IN data in FIFO */ ++ depctl.b.cnak = 1; ++ depctl.b.epena = 1; ++ DWC_WRITE_REG32(&in_regs->diepctl, depctl.d32); ++ ++ /** ++ * Enable the Non-Periodic Tx FIFO empty interrupt, the ++ * data will be written into the fifo by the ISR. ++ */ ++ if (!core_if->dma_enable) { ++ if (core_if->en_multiple_tx_fifo == 0) { ++ /* First clear it from GINTSTS */ ++ intr_mask.b.nptxfempty = 1; ++ DWC_MODIFY_REG32(&core_if-> ++ core_global_regs->gintmsk, ++ intr_mask.d32, intr_mask.d32); ++ ++ } else { ++ /* Enable the Tx FIFO Empty Interrupt for this EP */ ++ if (ep->xfer_len > 0) { ++ uint32_t fifoemptymsk = 0; ++ fifoemptymsk |= 1 << ep->num; ++ DWC_MODIFY_REG32(&core_if-> ++ dev_if->dev_global_regs->dtknqr4_fifoemptymsk, ++ 0, fifoemptymsk); ++ } ++ } ++ } ++ } else { ++ dwc_otg_dev_out_ep_regs_t *out_regs = ++ core_if->dev_if->out_ep_regs[0]; ++ ++ depctl.d32 = DWC_READ_REG32(&out_regs->doepctl); ++ deptsiz.d32 = DWC_READ_REG32(&out_regs->doeptsiz); ++ ++ /* Program the transfer size and packet count ++ * as follows: xfersize = N * maxpacket + ++ * short_packet pktcnt = N + (short_packet ++ * exist ? 1 : 0) ++ */ ++ deptsiz.b.xfersize = ep->maxpacket; ++ deptsiz.b.pktcnt = 1; ++ ++ if (core_if->dma_desc_enable == 0) { ++ DWC_WRITE_REG32(&out_regs->doeptsiz, deptsiz.d32); ++ } else { ++ dma_desc = core_if->dev_if->out_desc_addr; ++ ++ /** DMA Descriptor Setup */ ++ dma_desc->status.b.bs = BS_HOST_BUSY; ++ dma_desc->status.b.l = 1; ++ dma_desc->status.b.ioc = 1; ++ dma_desc->status.b.bytes = ep->maxpacket; ++ dma_desc->buf = ep->dma_addr; ++ dma_desc->status.b.sts = 0; ++ dma_desc->status.b.bs = BS_HOST_READY; ++ ++ /** DOEPDMA0 Register write */ ++ DWC_WRITE_REG32(&out_regs->doepdma, ++ core_if->dev_if->dma_out_desc_addr); ++ } ++ ++ DWC_DEBUGPL(DBG_PCDV, ++ "IN len=%d xfersize=%d pktcnt=%d [%08x]\n", ++ ep->xfer_len, deptsiz.b.xfersize, deptsiz.b.pktcnt, ++ deptsiz.d32); ++ ++ /* Write the DMA register */ ++ if (core_if->hwcfg2.b.architecture == DWC_INT_DMA_ARCH) { ++ if (core_if->dma_desc_enable == 0) ++ DWC_WRITE_REG32(&(out_regs->doepdma), ++ (uint32_t) ep->dma_addr); ++ ++ } ++ ++ /* EP enable, IN data in FIFO */ ++ depctl.b.cnak = 1; ++ depctl.b.epena = 1; ++ DWC_WRITE_REG32(&out_regs->doepctl, depctl.d32); ++ ++ } ++} ++ ++#ifdef DEBUG ++void dump_msg(const u8 * buf, unsigned int length) ++{ ++ unsigned int start, num, i; ++ char line[52], *p; ++ ++ if (length >= 512) ++ return; ++ start = 0; ++ while (length > 0) { ++ num = length < 16u ? length : 16u; ++ p = line; ++ for (i = 0; i < num; ++i) { ++ if (i == 8) ++ *p++ = ' '; ++ DWC_SPRINTF(p, " %02x", buf[i]); ++ p += 3; ++ } ++ *p = 0; ++ DWC_PRINTF("%6x: %s\n", start, line); ++ buf += num; ++ start += num; ++ length -= num; ++ } ++} ++#else ++static inline void dump_msg(const u8 * buf, unsigned int length) ++{ ++} ++#endif ++ ++/** ++ * This function writes a packet into the Tx FIFO associated with the ++ * EP. For non-periodic EPs the non-periodic Tx FIFO is written. For ++ * periodic EPs the periodic Tx FIFO associated with the EP is written ++ * with all packets for the next micro-frame. ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ * @param ep The EP to write packet for. ++ * @param dma Indicates if DMA is being used. ++ */ ++void dwc_otg_ep_write_packet(dwc_otg_core_if_t * core_if, dwc_ep_t * ep, ++ int dma) ++{ ++ /** ++ * The buffer is padded to DWORD on a per packet basis in ++ * slave/dma mode if the MPS is not DWORD aligned. The last ++ * packet, if short, is also padded to a multiple of DWORD. ++ * ++ * ep->xfer_buff always starts DWORD aligned in memory and is a ++ * multiple of DWORD in length ++ * ++ * ep->xfer_len can be any number of bytes ++ * ++ * ep->xfer_count is a multiple of ep->maxpacket until the last ++ * packet ++ * ++ * FIFO access is DWORD */ ++ ++ uint32_t i; ++ uint32_t byte_count; ++ uint32_t dword_count; ++ uint32_t *fifo; ++ uint32_t *data_buff = (uint32_t *) ep->xfer_buff; ++ ++ DWC_DEBUGPL((DBG_PCDV | DBG_CILV), "%s(%p,%p)\n", __func__, core_if, ++ ep); ++ if (ep->xfer_count >= ep->xfer_len) { ++ DWC_WARN("%s() No data for EP%d!!!\n", __func__, ep->num); ++ return; ++ } ++ ++ /* Find the byte length of the packet either short packet or MPS */ ++ if ((ep->xfer_len - ep->xfer_count) < ep->maxpacket) { ++ byte_count = ep->xfer_len - ep->xfer_count; ++ } else { ++ byte_count = ep->maxpacket; ++ } ++ ++ /* Find the DWORD length, padded by extra bytes as neccessary if MPS ++ * is not a multiple of DWORD */ ++ dword_count = (byte_count + 3) / 4; ++ ++#ifdef VERBOSE ++ dump_msg(ep->xfer_buff, byte_count); ++#endif ++ ++ /**@todo NGS Where are the Periodic Tx FIFO addresses ++ * intialized? What should this be? */ ++ ++ fifo = core_if->data_fifo[ep->num]; ++ ++ DWC_DEBUGPL((DBG_PCDV | DBG_CILV), "fifo=%p buff=%p *p=%08x bc=%d\n", ++ fifo, data_buff, *data_buff, byte_count); ++ ++ if (!dma) { ++ for (i = 0; i < dword_count; i++, data_buff++) { ++ DWC_WRITE_REG32(fifo, *data_buff); ++ } ++ } ++ ++ ep->xfer_count += byte_count; ++ ep->xfer_buff += byte_count; ++ ep->dma_addr += byte_count; ++} ++ ++/** ++ * Set the EP STALL. ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ * @param ep The EP to set the stall on. ++ */ ++void dwc_otg_ep_set_stall(dwc_otg_core_if_t * core_if, dwc_ep_t * ep) ++{ ++ depctl_data_t depctl; ++ volatile uint32_t *depctl_addr; ++ ++ DWC_DEBUGPL(DBG_PCD, "%s ep%d-%s\n", __func__, ep->num, ++ (ep->is_in ? "IN" : "OUT")); ++ ++ if (ep->is_in == 1) { ++ depctl_addr = &(core_if->dev_if->in_ep_regs[ep->num]->diepctl); ++ depctl.d32 = DWC_READ_REG32(depctl_addr); ++ ++ /* set the disable and stall bits */ ++ if (depctl.b.epena) { ++ depctl.b.epdis = 1; ++ } ++ depctl.b.stall = 1; ++ DWC_WRITE_REG32(depctl_addr, depctl.d32); ++ } else { ++ depctl_addr = &(core_if->dev_if->out_ep_regs[ep->num]->doepctl); ++ depctl.d32 = DWC_READ_REG32(depctl_addr); ++ ++ /* set the stall bit */ ++ depctl.b.stall = 1; ++ DWC_WRITE_REG32(depctl_addr, depctl.d32); ++ } ++ ++ DWC_DEBUGPL(DBG_PCD, "DEPCTL=%0x\n", DWC_READ_REG32(depctl_addr)); ++ ++ return; ++} ++ ++/** ++ * Clear the EP STALL. ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ * @param ep The EP to clear stall from. ++ */ ++void dwc_otg_ep_clear_stall(dwc_otg_core_if_t * core_if, dwc_ep_t * ep) ++{ ++ depctl_data_t depctl; ++ volatile uint32_t *depctl_addr; ++ ++ DWC_DEBUGPL(DBG_PCD, "%s ep%d-%s\n", __func__, ep->num, ++ (ep->is_in ? "IN" : "OUT")); ++ ++ if (ep->is_in == 1) { ++ depctl_addr = &(core_if->dev_if->in_ep_regs[ep->num]->diepctl); ++ } else { ++ depctl_addr = &(core_if->dev_if->out_ep_regs[ep->num]->doepctl); ++ } ++ ++ depctl.d32 = DWC_READ_REG32(depctl_addr); ++ ++ /* clear the stall bits */ ++ depctl.b.stall = 0; ++ ++ /* ++ * USB Spec 9.4.5: For endpoints using data toggle, regardless ++ * of whether an endpoint has the Halt feature set, a ++ * ClearFeature(ENDPOINT_HALT) request always results in the ++ * data toggle being reinitialized to DATA0. ++ */ ++ if (ep->type == DWC_OTG_EP_TYPE_INTR || ++ ep->type == DWC_OTG_EP_TYPE_BULK) { ++ depctl.b.setd0pid = 1; /* DATA0 */ ++ } ++ ++ DWC_WRITE_REG32(depctl_addr, depctl.d32); ++ DWC_DEBUGPL(DBG_PCD, "DEPCTL=%0x\n", DWC_READ_REG32(depctl_addr)); ++ return; ++} ++ ++/** ++ * This function reads a packet from the Rx FIFO into the destination ++ * buffer. To read SETUP data use dwc_otg_read_setup_packet. ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ * @param dest Destination buffer for the packet. ++ * @param bytes Number of bytes to copy to the destination. ++ */ ++void dwc_otg_read_packet(dwc_otg_core_if_t * core_if, ++ uint8_t * dest, uint16_t bytes) ++{ ++ int i; ++ int word_count = (bytes + 3) / 4; ++ ++ volatile uint32_t *fifo = core_if->data_fifo[0]; ++ uint32_t *data_buff = (uint32_t *) dest; ++ ++ /** ++ * @todo Account for the case where _dest is not dword aligned. This ++ * requires reading data from the FIFO into a uint32_t temp buffer, ++ * then moving it into the data buffer. ++ */ ++ ++ DWC_DEBUGPL((DBG_PCDV | DBG_CILV), "%s(%p,%p,%d)\n", __func__, ++ core_if, dest, bytes); ++ ++ for (i = 0; i < word_count; i++, data_buff++) { ++ *data_buff = DWC_READ_REG32(fifo); ++ } ++ ++ return; ++} ++ ++/** ++ * This functions reads the device registers and prints them ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ */ ++void dwc_otg_dump_dev_registers(dwc_otg_core_if_t * core_if) ++{ ++ int i; ++ volatile uint32_t *addr; ++ ++ DWC_PRINTF("Device Global Registers\n"); ++ addr = &core_if->dev_if->dev_global_regs->dcfg; ++ DWC_PRINTF("DCFG @0x%08lX : 0x%08X\n", ++ (unsigned long)addr, DWC_READ_REG32(addr)); ++ addr = &core_if->dev_if->dev_global_regs->dctl; ++ DWC_PRINTF("DCTL @0x%08lX : 0x%08X\n", ++ (unsigned long)addr, DWC_READ_REG32(addr)); ++ addr = &core_if->dev_if->dev_global_regs->dsts; ++ DWC_PRINTF("DSTS @0x%08lX : 0x%08X\n", ++ (unsigned long)addr, DWC_READ_REG32(addr)); ++ addr = &core_if->dev_if->dev_global_regs->diepmsk; ++ DWC_PRINTF("DIEPMSK @0x%08lX : 0x%08X\n", (unsigned long)addr, ++ DWC_READ_REG32(addr)); ++ addr = &core_if->dev_if->dev_global_regs->doepmsk; ++ DWC_PRINTF("DOEPMSK @0x%08lX : 0x%08X\n", (unsigned long)addr, ++ DWC_READ_REG32(addr)); ++ addr = &core_if->dev_if->dev_global_regs->daint; ++ DWC_PRINTF("DAINT @0x%08lX : 0x%08X\n", (unsigned long)addr, ++ DWC_READ_REG32(addr)); ++ addr = &core_if->dev_if->dev_global_regs->daintmsk; ++ DWC_PRINTF("DAINTMSK @0x%08lX : 0x%08X\n", (unsigned long)addr, ++ DWC_READ_REG32(addr)); ++ addr = &core_if->dev_if->dev_global_regs->dtknqr1; ++ DWC_PRINTF("DTKNQR1 @0x%08lX : 0x%08X\n", (unsigned long)addr, ++ DWC_READ_REG32(addr)); ++ if (core_if->hwcfg2.b.dev_token_q_depth > 6) { ++ addr = &core_if->dev_if->dev_global_regs->dtknqr2; ++ DWC_PRINTF("DTKNQR2 @0x%08lX : 0x%08X\n", ++ (unsigned long)addr, DWC_READ_REG32(addr)); ++ } ++ ++ addr = &core_if->dev_if->dev_global_regs->dvbusdis; ++ DWC_PRINTF("DVBUSID @0x%08lX : 0x%08X\n", (unsigned long)addr, ++ DWC_READ_REG32(addr)); ++ ++ addr = &core_if->dev_if->dev_global_regs->dvbuspulse; ++ DWC_PRINTF("DVBUSPULSE @0x%08lX : 0x%08X\n", ++ (unsigned long)addr, DWC_READ_REG32(addr)); ++ ++ addr = &core_if->dev_if->dev_global_regs->dtknqr3_dthrctl; ++ DWC_PRINTF("DTKNQR3_DTHRCTL @0x%08lX : 0x%08X\n", ++ (unsigned long)addr, DWC_READ_REG32(addr)); ++ ++ if (core_if->hwcfg2.b.dev_token_q_depth > 22) { ++ addr = &core_if->dev_if->dev_global_regs->dtknqr4_fifoemptymsk; ++ DWC_PRINTF("DTKNQR4 @0x%08lX : 0x%08X\n", ++ (unsigned long)addr, DWC_READ_REG32(addr)); ++ } ++ ++ addr = &core_if->dev_if->dev_global_regs->dtknqr4_fifoemptymsk; ++ DWC_PRINTF("FIFOEMPMSK @0x%08lX : 0x%08X\n", (unsigned long)addr, ++ DWC_READ_REG32(addr)); ++ ++ if (core_if->hwcfg2.b.multi_proc_int) { ++ ++ addr = &core_if->dev_if->dev_global_regs->deachint; ++ DWC_PRINTF("DEACHINT @0x%08lX : 0x%08X\n", ++ (unsigned long)addr, DWC_READ_REG32(addr)); ++ addr = &core_if->dev_if->dev_global_regs->deachintmsk; ++ DWC_PRINTF("DEACHINTMSK @0x%08lX : 0x%08X\n", ++ (unsigned long)addr, DWC_READ_REG32(addr)); ++ ++ for (i = 0; i <= core_if->dev_if->num_in_eps; i++) { ++ addr = ++ &core_if->dev_if-> ++ dev_global_regs->diepeachintmsk[i]; ++ DWC_PRINTF("DIEPEACHINTMSK[%d] @0x%08lX : 0x%08X\n", ++ i, (unsigned long)addr, ++ DWC_READ_REG32(addr)); ++ } ++ ++ for (i = 0; i <= core_if->dev_if->num_out_eps; i++) { ++ addr = ++ &core_if->dev_if-> ++ dev_global_regs->doepeachintmsk[i]; ++ DWC_PRINTF("DOEPEACHINTMSK[%d] @0x%08lX : 0x%08X\n", ++ i, (unsigned long)addr, ++ DWC_READ_REG32(addr)); ++ } ++ } ++ ++ for (i = 0; i <= core_if->dev_if->num_in_eps; i++) { ++ DWC_PRINTF("Device IN EP %d Registers\n", i); ++ addr = &core_if->dev_if->in_ep_regs[i]->diepctl; ++ DWC_PRINTF("DIEPCTL @0x%08lX : 0x%08X\n", ++ (unsigned long)addr, DWC_READ_REG32(addr)); ++ addr = &core_if->dev_if->in_ep_regs[i]->diepint; ++ DWC_PRINTF("DIEPINT @0x%08lX : 0x%08X\n", ++ (unsigned long)addr, DWC_READ_REG32(addr)); ++ addr = &core_if->dev_if->in_ep_regs[i]->dieptsiz; ++ DWC_PRINTF("DIETSIZ @0x%08lX : 0x%08X\n", ++ (unsigned long)addr, DWC_READ_REG32(addr)); ++ addr = &core_if->dev_if->in_ep_regs[i]->diepdma; ++ DWC_PRINTF("DIEPDMA @0x%08lX : 0x%08X\n", ++ (unsigned long)addr, DWC_READ_REG32(addr)); ++ addr = &core_if->dev_if->in_ep_regs[i]->dtxfsts; ++ DWC_PRINTF("DTXFSTS @0x%08lX : 0x%08X\n", ++ (unsigned long)addr, DWC_READ_REG32(addr)); ++ addr = &core_if->dev_if->in_ep_regs[i]->diepdmab; ++ DWC_PRINTF("DIEPDMAB @0x%08lX : 0x%08X\n", ++ (unsigned long)addr, 0 /*DWC_READ_REG32(addr) */ ); ++ } ++ ++ for (i = 0; i <= core_if->dev_if->num_out_eps; i++) { ++ DWC_PRINTF("Device OUT EP %d Registers\n", i); ++ addr = &core_if->dev_if->out_ep_regs[i]->doepctl; ++ DWC_PRINTF("DOEPCTL @0x%08lX : 0x%08X\n", ++ (unsigned long)addr, DWC_READ_REG32(addr)); ++ addr = &core_if->dev_if->out_ep_regs[i]->doepint; ++ DWC_PRINTF("DOEPINT @0x%08lX : 0x%08X\n", ++ (unsigned long)addr, DWC_READ_REG32(addr)); ++ addr = &core_if->dev_if->out_ep_regs[i]->doeptsiz; ++ DWC_PRINTF("DOETSIZ @0x%08lX : 0x%08X\n", ++ (unsigned long)addr, DWC_READ_REG32(addr)); ++ addr = &core_if->dev_if->out_ep_regs[i]->doepdma; ++ DWC_PRINTF("DOEPDMA @0x%08lX : 0x%08X\n", ++ (unsigned long)addr, DWC_READ_REG32(addr)); ++ if (core_if->dma_enable) { /* Don't access this register in SLAVE mode */ ++ addr = &core_if->dev_if->out_ep_regs[i]->doepdmab; ++ DWC_PRINTF("DOEPDMAB @0x%08lX : 0x%08X\n", ++ (unsigned long)addr, DWC_READ_REG32(addr)); ++ } ++ ++ } ++} ++ ++/** ++ * This functions reads the SPRAM and prints its content ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ */ ++void dwc_otg_dump_spram(dwc_otg_core_if_t * core_if) ++{ ++ volatile uint8_t *addr, *start_addr, *end_addr; ++ ++ DWC_PRINTF("SPRAM Data:\n"); ++ start_addr = (void *)core_if->core_global_regs; ++ DWC_PRINTF("Base Address: 0x%8lX\n", (unsigned long)start_addr); ++ start_addr += 0x00028000; ++ end_addr = (void *)core_if->core_global_regs; ++ end_addr += 0x000280e0; ++ ++ for (addr = start_addr; addr < end_addr; addr += 16) { ++ DWC_PRINTF ++ ("0x%8lX:\t%2X %2X %2X %2X %2X %2X %2X %2X %2X %2X %2X %2X %2X %2X %2X %2X\n", ++ (unsigned long)addr, addr[0], addr[1], addr[2], addr[3], ++ addr[4], addr[5], addr[6], addr[7], addr[8], addr[9], ++ addr[10], addr[11], addr[12], addr[13], addr[14], addr[15] ++ ); ++ } ++ ++ return; ++} ++ ++/** ++ * This function reads the host registers and prints them ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ */ ++void dwc_otg_dump_host_registers(dwc_otg_core_if_t * core_if) ++{ ++ int i; ++ volatile uint32_t *addr; ++ ++ DWC_PRINTF("Host Global Registers\n"); ++ addr = &core_if->host_if->host_global_regs->hcfg; ++ DWC_PRINTF("HCFG @0x%08lX : 0x%08X\n", ++ (unsigned long)addr, DWC_READ_REG32(addr)); ++ addr = &core_if->host_if->host_global_regs->hfir; ++ DWC_PRINTF("HFIR @0x%08lX : 0x%08X\n", ++ (unsigned long)addr, DWC_READ_REG32(addr)); ++ addr = &core_if->host_if->host_global_regs->hfnum; ++ DWC_PRINTF("HFNUM @0x%08lX : 0x%08X\n", (unsigned long)addr, ++ DWC_READ_REG32(addr)); ++ addr = &core_if->host_if->host_global_regs->hptxsts; ++ DWC_PRINTF("HPTXSTS @0x%08lX : 0x%08X\n", (unsigned long)addr, ++ DWC_READ_REG32(addr)); ++ addr = &core_if->host_if->host_global_regs->haint; ++ DWC_PRINTF("HAINT @0x%08lX : 0x%08X\n", (unsigned long)addr, ++ DWC_READ_REG32(addr)); ++ addr = &core_if->host_if->host_global_regs->haintmsk; ++ DWC_PRINTF("HAINTMSK @0x%08lX : 0x%08X\n", (unsigned long)addr, ++ DWC_READ_REG32(addr)); ++ if (core_if->dma_desc_enable) { ++ addr = &core_if->host_if->host_global_regs->hflbaddr; ++ DWC_PRINTF("HFLBADDR @0x%08lX : 0x%08X\n", ++ (unsigned long)addr, DWC_READ_REG32(addr)); ++ } ++ ++ addr = core_if->host_if->hprt0; ++ DWC_PRINTF("HPRT0 @0x%08lX : 0x%08X\n", (unsigned long)addr, ++ DWC_READ_REG32(addr)); ++ ++ for (i = 0; i < core_if->core_params->host_channels; i++) { ++ DWC_PRINTF("Host Channel %d Specific Registers\n", i); ++ addr = &core_if->host_if->hc_regs[i]->hcchar; ++ DWC_PRINTF("HCCHAR @0x%08lX : 0x%08X\n", ++ (unsigned long)addr, DWC_READ_REG32(addr)); ++ addr = &core_if->host_if->hc_regs[i]->hcsplt; ++ DWC_PRINTF("HCSPLT @0x%08lX : 0x%08X\n", ++ (unsigned long)addr, DWC_READ_REG32(addr)); ++ addr = &core_if->host_if->hc_regs[i]->hcint; ++ DWC_PRINTF("HCINT @0x%08lX : 0x%08X\n", ++ (unsigned long)addr, DWC_READ_REG32(addr)); ++ addr = &core_if->host_if->hc_regs[i]->hcintmsk; ++ DWC_PRINTF("HCINTMSK @0x%08lX : 0x%08X\n", ++ (unsigned long)addr, DWC_READ_REG32(addr)); ++ addr = &core_if->host_if->hc_regs[i]->hctsiz; ++ DWC_PRINTF("HCTSIZ @0x%08lX : 0x%08X\n", ++ (unsigned long)addr, DWC_READ_REG32(addr)); ++ addr = &core_if->host_if->hc_regs[i]->hcdma; ++ DWC_PRINTF("HCDMA @0x%08lX : 0x%08X\n", ++ (unsigned long)addr, DWC_READ_REG32(addr)); ++ if (core_if->dma_desc_enable) { ++ addr = &core_if->host_if->hc_regs[i]->hcdmab; ++ DWC_PRINTF("HCDMAB @0x%08lX : 0x%08X\n", ++ (unsigned long)addr, DWC_READ_REG32(addr)); ++ } ++ ++ } ++ return; ++} ++ ++/** ++ * This function reads the core global registers and prints them ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ */ ++void dwc_otg_dump_global_registers(dwc_otg_core_if_t * core_if) ++{ ++ int i, ep_num; ++ volatile uint32_t *addr; ++ char *txfsiz; ++ ++ DWC_PRINTF("Core Global Registers\n"); ++ addr = &core_if->core_global_regs->gotgctl; ++ DWC_PRINTF("GOTGCTL @0x%08lX : 0x%08X\n", (unsigned long)addr, ++ DWC_READ_REG32(addr)); ++ addr = &core_if->core_global_regs->gotgint; ++ DWC_PRINTF("GOTGINT @0x%08lX : 0x%08X\n", (unsigned long)addr, ++ DWC_READ_REG32(addr)); ++ addr = &core_if->core_global_regs->gahbcfg; ++ DWC_PRINTF("GAHBCFG @0x%08lX : 0x%08X\n", (unsigned long)addr, ++ DWC_READ_REG32(addr)); ++ addr = &core_if->core_global_regs->gusbcfg; ++ DWC_PRINTF("GUSBCFG @0x%08lX : 0x%08X\n", (unsigned long)addr, ++ DWC_READ_REG32(addr)); ++ addr = &core_if->core_global_regs->grstctl; ++ DWC_PRINTF("GRSTCTL @0x%08lX : 0x%08X\n", (unsigned long)addr, ++ DWC_READ_REG32(addr)); ++ addr = &core_if->core_global_regs->gintsts; ++ DWC_PRINTF("GINTSTS @0x%08lX : 0x%08X\n", (unsigned long)addr, ++ DWC_READ_REG32(addr)); ++ addr = &core_if->core_global_regs->gintmsk; ++ DWC_PRINTF("GINTMSK @0x%08lX : 0x%08X\n", (unsigned long)addr, ++ DWC_READ_REG32(addr)); ++ addr = &core_if->core_global_regs->grxstsr; ++ DWC_PRINTF("GRXSTSR @0x%08lX : 0x%08X\n", (unsigned long)addr, ++ DWC_READ_REG32(addr)); ++ addr = &core_if->core_global_regs->grxfsiz; ++ DWC_PRINTF("GRXFSIZ @0x%08lX : 0x%08X\n", (unsigned long)addr, ++ DWC_READ_REG32(addr)); ++ addr = &core_if->core_global_regs->gnptxfsiz; ++ DWC_PRINTF("GNPTXFSIZ @0x%08lX : 0x%08X\n", (unsigned long)addr, ++ DWC_READ_REG32(addr)); ++ addr = &core_if->core_global_regs->gnptxsts; ++ DWC_PRINTF("GNPTXSTS @0x%08lX : 0x%08X\n", (unsigned long)addr, ++ DWC_READ_REG32(addr)); ++ addr = &core_if->core_global_regs->gi2cctl; ++ DWC_PRINTF("GI2CCTL @0x%08lX : 0x%08X\n", (unsigned long)addr, ++ DWC_READ_REG32(addr)); ++ addr = &core_if->core_global_regs->gpvndctl; ++ DWC_PRINTF("GPVNDCTL @0x%08lX : 0x%08X\n", (unsigned long)addr, ++ DWC_READ_REG32(addr)); ++ addr = &core_if->core_global_regs->ggpio; ++ DWC_PRINTF("GGPIO @0x%08lX : 0x%08X\n", (unsigned long)addr, ++ DWC_READ_REG32(addr)); ++ addr = &core_if->core_global_regs->guid; ++ DWC_PRINTF("GUID @0x%08lX : 0x%08X\n", ++ (unsigned long)addr, DWC_READ_REG32(addr)); ++ addr = &core_if->core_global_regs->gsnpsid; ++ DWC_PRINTF("GSNPSID @0x%08lX : 0x%08X\n", (unsigned long)addr, ++ DWC_READ_REG32(addr)); ++ addr = &core_if->core_global_regs->ghwcfg1; ++ DWC_PRINTF("GHWCFG1 @0x%08lX : 0x%08X\n", (unsigned long)addr, ++ DWC_READ_REG32(addr)); ++ addr = &core_if->core_global_regs->ghwcfg2; ++ DWC_PRINTF("GHWCFG2 @0x%08lX : 0x%08X\n", (unsigned long)addr, ++ DWC_READ_REG32(addr)); ++ addr = &core_if->core_global_regs->ghwcfg3; ++ DWC_PRINTF("GHWCFG3 @0x%08lX : 0x%08X\n", (unsigned long)addr, ++ DWC_READ_REG32(addr)); ++ addr = &core_if->core_global_regs->ghwcfg4; ++ DWC_PRINTF("GHWCFG4 @0x%08lX : 0x%08X\n", (unsigned long)addr, ++ DWC_READ_REG32(addr)); ++ addr = &core_if->core_global_regs->glpmcfg; ++ DWC_PRINTF("GLPMCFG @0x%08lX : 0x%08X\n", (unsigned long)addr, ++ DWC_READ_REG32(addr)); ++ addr = &core_if->core_global_regs->gpwrdn; ++ DWC_PRINTF("GPWRDN @0x%08lX : 0x%08X\n", (unsigned long)addr, ++ DWC_READ_REG32(addr)); ++ addr = &core_if->core_global_regs->gdfifocfg; ++ DWC_PRINTF("GDFIFOCFG @0x%08lX : 0x%08X\n", (unsigned long)addr, ++ DWC_READ_REG32(addr)); ++ addr = &core_if->core_global_regs->adpctl; ++ DWC_PRINTF("ADPCTL @0x%08lX : 0x%08X\n", (unsigned long)addr, ++ dwc_otg_adp_read_reg(core_if)); ++ addr = &core_if->core_global_regs->hptxfsiz; ++ DWC_PRINTF("HPTXFSIZ @0x%08lX : 0x%08X\n", (unsigned long)addr, ++ DWC_READ_REG32(addr)); ++ ++ if (core_if->en_multiple_tx_fifo == 0) { ++ ep_num = core_if->hwcfg4.b.num_dev_perio_in_ep; ++ txfsiz = "DPTXFSIZ"; ++ } else { ++ ep_num = core_if->hwcfg4.b.num_in_eps; ++ txfsiz = "DIENPTXF"; ++ } ++ for (i = 0; i < ep_num; i++) { ++ addr = &core_if->core_global_regs->dtxfsiz[i]; ++ DWC_PRINTF("%s[%d] @0x%08lX : 0x%08X\n", txfsiz, i + 1, ++ (unsigned long)addr, DWC_READ_REG32(addr)); ++ } ++ addr = core_if->pcgcctl; ++ DWC_PRINTF("PCGCCTL @0x%08lX : 0x%08X\n", (unsigned long)addr, ++ DWC_READ_REG32(addr)); ++} ++ ++/** ++ * Flush a Tx FIFO. ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ * @param num Tx FIFO to flush. ++ */ ++void dwc_otg_flush_tx_fifo(dwc_otg_core_if_t * core_if, const int num) ++{ ++ dwc_otg_core_global_regs_t *global_regs = core_if->core_global_regs; ++ volatile grstctl_t greset = {.d32 = 0 }; ++ int count = 0; ++ ++ DWC_DEBUGPL((DBG_CIL | DBG_PCDV), "Flush Tx FIFO %d\n", num); ++ ++ greset.b.txfflsh = 1; ++ greset.b.txfnum = num; ++ DWC_WRITE_REG32(&global_regs->grstctl, greset.d32); ++ ++ do { ++ greset.d32 = DWC_READ_REG32(&global_regs->grstctl); ++ if (++count > 10000) { ++ DWC_WARN("%s() HANG! GRSTCTL=%0x GNPTXSTS=0x%08x\n", ++ __func__, greset.d32, ++ DWC_READ_REG32(&global_regs->gnptxsts)); ++ break; ++ } ++ dwc_udelay(1); ++ } while (greset.b.txfflsh == 1); ++ ++ /* Wait for 3 PHY Clocks */ ++ dwc_udelay(1); ++} ++ ++/** ++ * Flush Rx FIFO. ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ */ ++void dwc_otg_flush_rx_fifo(dwc_otg_core_if_t * core_if) ++{ ++ dwc_otg_core_global_regs_t *global_regs = core_if->core_global_regs; ++ volatile grstctl_t greset = {.d32 = 0 }; ++ int count = 0; ++ ++ DWC_DEBUGPL((DBG_CIL | DBG_PCDV), "%s\n", __func__); ++ /* ++ * ++ */ ++ greset.b.rxfflsh = 1; ++ DWC_WRITE_REG32(&global_regs->grstctl, greset.d32); ++ ++ do { ++ greset.d32 = DWC_READ_REG32(&global_regs->grstctl); ++ if (++count > 10000) { ++ DWC_WARN("%s() HANG! GRSTCTL=%0x\n", __func__, ++ greset.d32); ++ break; ++ } ++ dwc_udelay(1); ++ } while (greset.b.rxfflsh == 1); ++ ++ /* Wait for 3 PHY Clocks */ ++ dwc_udelay(1); ++} ++ ++/** ++ * Do core a soft reset of the core. Be careful with this because it ++ * resets all the internal state machines of the core. ++ */ ++void dwc_otg_core_reset(dwc_otg_core_if_t * core_if) ++{ ++ dwc_otg_core_global_regs_t *global_regs = core_if->core_global_regs; ++ volatile grstctl_t greset = {.d32 = 0 }; ++ int count = 0; ++ ++ DWC_DEBUGPL(DBG_CILV, "%s\n", __func__); ++ /* Wait for AHB master IDLE state. */ ++ do { ++ dwc_udelay(10); ++ greset.d32 = DWC_READ_REG32(&global_regs->grstctl); ++ if (++count > 100000) { ++ DWC_WARN("%s() HANG! AHB Idle GRSTCTL=%0x\n", __func__, ++ greset.d32); ++ return; ++ } ++ } ++ while (greset.b.ahbidle == 0); ++ ++ /* Core Soft Reset */ ++ count = 0; ++ greset.b.csftrst = 1; ++ DWC_WRITE_REG32(&global_regs->grstctl, greset.d32); ++ do { ++ greset.d32 = DWC_READ_REG32(&global_regs->grstctl); ++ if (++count > 10000) { ++ DWC_WARN("%s() HANG! Soft Reset GRSTCTL=%0x\n", ++ __func__, greset.d32); ++ break; ++ } ++ dwc_udelay(1); ++ } ++ while (greset.b.csftrst == 1); ++ ++ /* Wait for 3 PHY Clocks */ ++ dwc_mdelay(100); ++} ++ ++uint8_t dwc_otg_is_device_mode(dwc_otg_core_if_t * _core_if) ++{ ++ return (dwc_otg_mode(_core_if) != DWC_HOST_MODE); ++} ++ ++uint8_t dwc_otg_is_host_mode(dwc_otg_core_if_t * _core_if) ++{ ++ return (dwc_otg_mode(_core_if) == DWC_HOST_MODE); ++} ++ ++/** ++ * Register HCD callbacks. The callbacks are used to start and stop ++ * the HCD for interrupt processing. ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ * @param cb the HCD callback structure. ++ * @param p pointer to be passed to callback function (usb_hcd*). ++ */ ++void dwc_otg_cil_register_hcd_callbacks(dwc_otg_core_if_t * core_if, ++ dwc_otg_cil_callbacks_t * cb, void *p) ++{ ++ core_if->hcd_cb = cb; ++ cb->p = p; ++} ++ ++/** ++ * Register PCD callbacks. The callbacks are used to start and stop ++ * the PCD for interrupt processing. ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ * @param cb the PCD callback structure. ++ * @param p pointer to be passed to callback function (pcd*). ++ */ ++void dwc_otg_cil_register_pcd_callbacks(dwc_otg_core_if_t * core_if, ++ dwc_otg_cil_callbacks_t * cb, void *p) ++{ ++ core_if->pcd_cb = cb; ++ cb->p = p; ++} ++ ++#ifdef DWC_EN_ISOC ++ ++/** ++ * This function writes isoc data per 1 (micro)frame into tx fifo ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ * @param ep The EP to start the transfer on. ++ * ++ */ ++void write_isoc_frame_data(dwc_otg_core_if_t * core_if, dwc_ep_t * ep) ++{ ++ dwc_otg_dev_in_ep_regs_t *ep_regs; ++ dtxfsts_data_t txstatus = {.d32 = 0 }; ++ uint32_t len = 0; ++ uint32_t dwords; ++ ++ ep->xfer_len = ep->data_per_frame; ++ ep->xfer_count = 0; ++ ++ ep_regs = core_if->dev_if->in_ep_regs[ep->num]; ++ ++ len = ep->xfer_len - ep->xfer_count; ++ ++ if (len > ep->maxpacket) { ++ len = ep->maxpacket; ++ } ++ ++ dwords = (len + 3) / 4; ++ ++ /* While there is space in the queue and space in the FIFO and ++ * More data to tranfer, Write packets to the Tx FIFO */ ++ txstatus.d32 = ++ DWC_READ_REG32(&core_if->dev_if->in_ep_regs[ep->num]->dtxfsts); ++ DWC_DEBUGPL(DBG_PCDV, "b4 dtxfsts[%d]=0x%08x\n", ep->num, txstatus.d32); ++ ++ while (txstatus.b.txfspcavail > dwords && ++ ep->xfer_count < ep->xfer_len && ep->xfer_len != 0) { ++ /* Write the FIFO */ ++ dwc_otg_ep_write_packet(core_if, ep, 0); ++ ++ len = ep->xfer_len - ep->xfer_count; ++ if (len > ep->maxpacket) { ++ len = ep->maxpacket; ++ } ++ ++ dwords = (len + 3) / 4; ++ txstatus.d32 = ++ DWC_READ_REG32(&core_if->dev_if->in_ep_regs[ep->num]-> ++ dtxfsts); ++ DWC_DEBUGPL(DBG_PCDV, "dtxfsts[%d]=0x%08x\n", ep->num, ++ txstatus.d32); ++ } ++} ++ ++/** ++ * This function initializes a descriptor chain for Isochronous transfer ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ * @param ep The EP to start the transfer on. ++ * ++ */ ++void dwc_otg_iso_ep_start_frm_transfer(dwc_otg_core_if_t * core_if, ++ dwc_ep_t * ep) ++{ ++ deptsiz_data_t deptsiz = {.d32 = 0 }; ++ depctl_data_t depctl = {.d32 = 0 }; ++ dsts_data_t dsts = {.d32 = 0 }; ++ volatile uint32_t *addr; ++ ++ if (ep->is_in) { ++ addr = &core_if->dev_if->in_ep_regs[ep->num]->diepctl; ++ } else { ++ addr = &core_if->dev_if->out_ep_regs[ep->num]->doepctl; ++ } ++ ++ ep->xfer_len = ep->data_per_frame; ++ ep->xfer_count = 0; ++ ep->xfer_buff = ep->cur_pkt_addr; ++ ep->dma_addr = ep->cur_pkt_dma_addr; ++ ++ if (ep->is_in) { ++ /* Program the transfer size and packet count ++ * as follows: xfersize = N * maxpacket + ++ * short_packet pktcnt = N + (short_packet ++ * exist ? 1 : 0) ++ */ ++ deptsiz.b.xfersize = ep->xfer_len; ++ deptsiz.b.pktcnt = ++ (ep->xfer_len - 1 + ep->maxpacket) / ep->maxpacket; ++ deptsiz.b.mc = deptsiz.b.pktcnt; ++ DWC_WRITE_REG32(&core_if->dev_if->in_ep_regs[ep->num]->dieptsiz, ++ deptsiz.d32); ++ ++ /* Write the DMA register */ ++ if (core_if->dma_enable) { ++ DWC_WRITE_REG32(& ++ (core_if->dev_if->in_ep_regs[ep->num]-> ++ diepdma), (uint32_t) ep->dma_addr); ++ } ++ } else { ++ deptsiz.b.pktcnt = ++ (ep->xfer_len + (ep->maxpacket - 1)) / ep->maxpacket; ++ deptsiz.b.xfersize = deptsiz.b.pktcnt * ep->maxpacket; ++ ++ DWC_WRITE_REG32(&core_if->dev_if-> ++ out_ep_regs[ep->num]->doeptsiz, deptsiz.d32); ++ ++ if (core_if->dma_enable) { ++ DWC_WRITE_REG32(& ++ (core_if->dev_if-> ++ out_ep_regs[ep->num]->doepdma), ++ (uint32_t) ep->dma_addr); ++ } ++ } ++ ++ /** Enable endpoint, clear nak */ ++ ++ depctl.d32 = 0; ++ if (ep->bInterval == 1) { ++ dsts.d32 = ++ DWC_READ_REG32(&core_if->dev_if->dev_global_regs->dsts); ++ ep->next_frame = dsts.b.soffn + ep->bInterval; ++ ++ if (ep->next_frame & 0x1) { ++ depctl.b.setd1pid = 1; ++ } else { ++ depctl.b.setd0pid = 1; ++ } ++ } else { ++ ep->next_frame += ep->bInterval; ++ ++ if (ep->next_frame & 0x1) { ++ depctl.b.setd1pid = 1; ++ } else { ++ depctl.b.setd0pid = 1; ++ } ++ } ++ depctl.b.epena = 1; ++ depctl.b.cnak = 1; ++ ++ DWC_MODIFY_REG32(addr, 0, depctl.d32); ++ depctl.d32 = DWC_READ_REG32(addr); ++ ++ if (ep->is_in && core_if->dma_enable == 0) { ++ write_isoc_frame_data(core_if, ep); ++ } ++ ++} ++#endif /* DWC_EN_ISOC */ ++ ++static void dwc_otg_set_uninitialized(int32_t * p, int size) ++{ ++ int i; ++ for (i = 0; i < size; i++) { ++ p[i] = -1; ++ } ++} ++ ++static int dwc_otg_param_initialized(int32_t val) ++{ ++ return val != -1; ++} ++ ++static int dwc_otg_setup_params(dwc_otg_core_if_t * core_if) ++{ ++ int i; ++ core_if->core_params = DWC_ALLOC(sizeof(*core_if->core_params)); ++ if (!core_if->core_params) { ++ return -DWC_E_NO_MEMORY; ++ } ++ dwc_otg_set_uninitialized((int32_t *) core_if->core_params, ++ sizeof(*core_if->core_params) / ++ sizeof(int32_t)); ++ DWC_PRINTF("Setting default values for core params\n"); ++ dwc_otg_set_param_otg_cap(core_if, dwc_param_otg_cap_default); ++ dwc_otg_set_param_dma_enable(core_if, dwc_param_dma_enable_default); ++ dwc_otg_set_param_dma_desc_enable(core_if, ++ dwc_param_dma_desc_enable_default); ++ dwc_otg_set_param_opt(core_if, dwc_param_opt_default); ++ dwc_otg_set_param_dma_burst_size(core_if, ++ dwc_param_dma_burst_size_default); ++ dwc_otg_set_param_host_support_fs_ls_low_power(core_if, ++ dwc_param_host_support_fs_ls_low_power_default); ++ dwc_otg_set_param_enable_dynamic_fifo(core_if, ++ dwc_param_enable_dynamic_fifo_default); ++ dwc_otg_set_param_data_fifo_size(core_if, ++ dwc_param_data_fifo_size_default); ++ dwc_otg_set_param_dev_rx_fifo_size(core_if, ++ dwc_param_dev_rx_fifo_size_default); ++ dwc_otg_set_param_dev_nperio_tx_fifo_size(core_if, ++ dwc_param_dev_nperio_tx_fifo_size_default); ++ dwc_otg_set_param_host_rx_fifo_size(core_if, ++ dwc_param_host_rx_fifo_size_default); ++ dwc_otg_set_param_host_nperio_tx_fifo_size(core_if, ++ dwc_param_host_nperio_tx_fifo_size_default); ++ dwc_otg_set_param_host_perio_tx_fifo_size(core_if, ++ dwc_param_host_perio_tx_fifo_size_default); ++ dwc_otg_set_param_max_transfer_size(core_if, ++ dwc_param_max_transfer_size_default); ++ dwc_otg_set_param_max_packet_count(core_if, ++ dwc_param_max_packet_count_default); ++ dwc_otg_set_param_host_channels(core_if, ++ dwc_param_host_channels_default); ++ dwc_otg_set_param_dev_endpoints(core_if, ++ dwc_param_dev_endpoints_default); ++ dwc_otg_set_param_phy_type(core_if, dwc_param_phy_type_default); ++ dwc_otg_set_param_speed(core_if, dwc_param_speed_default); ++ dwc_otg_set_param_host_ls_low_power_phy_clk(core_if, ++ dwc_param_host_ls_low_power_phy_clk_default); ++ dwc_otg_set_param_phy_ulpi_ddr(core_if, dwc_param_phy_ulpi_ddr_default); ++ dwc_otg_set_param_phy_ulpi_ext_vbus(core_if, ++ dwc_param_phy_ulpi_ext_vbus_default); ++ dwc_otg_set_param_phy_utmi_width(core_if, ++ dwc_param_phy_utmi_width_default); ++ dwc_otg_set_param_ts_dline(core_if, dwc_param_ts_dline_default); ++ dwc_otg_set_param_i2c_enable(core_if, dwc_param_i2c_enable_default); ++ dwc_otg_set_param_ulpi_fs_ls(core_if, dwc_param_ulpi_fs_ls_default); ++ dwc_otg_set_param_en_multiple_tx_fifo(core_if, ++ dwc_param_en_multiple_tx_fifo_default); ++ for (i = 0; i < 15; i++) { ++ dwc_otg_set_param_dev_perio_tx_fifo_size(core_if, ++ dwc_param_dev_perio_tx_fifo_size_default, ++ i); ++ } ++ ++ for (i = 0; i < 15; i++) { ++ dwc_otg_set_param_dev_tx_fifo_size(core_if, ++ dwc_param_dev_tx_fifo_size_default, ++ i); ++ } ++ dwc_otg_set_param_thr_ctl(core_if, dwc_param_thr_ctl_default); ++ dwc_otg_set_param_mpi_enable(core_if, dwc_param_mpi_enable_default); ++ dwc_otg_set_param_pti_enable(core_if, dwc_param_pti_enable_default); ++ dwc_otg_set_param_lpm_enable(core_if, dwc_param_lpm_enable_default); ++ dwc_otg_set_param_ic_usb_cap(core_if, dwc_param_ic_usb_cap_default); ++ dwc_otg_set_param_tx_thr_length(core_if, ++ dwc_param_tx_thr_length_default); ++ dwc_otg_set_param_rx_thr_length(core_if, ++ dwc_param_rx_thr_length_default); ++ dwc_otg_set_param_ahb_thr_ratio(core_if, ++ dwc_param_ahb_thr_ratio_default); ++ dwc_otg_set_param_power_down(core_if, dwc_param_power_down_default); ++ dwc_otg_set_param_reload_ctl(core_if, dwc_param_reload_ctl_default); ++ dwc_otg_set_param_dev_out_nak(core_if, dwc_param_dev_out_nak_default); ++ dwc_otg_set_param_cont_on_bna(core_if, dwc_param_cont_on_bna_default); ++ dwc_otg_set_param_ahb_single(core_if, dwc_param_ahb_single_default); ++ dwc_otg_set_param_otg_ver(core_if, dwc_param_otg_ver_default); ++ dwc_otg_set_param_adp_enable(core_if, dwc_param_adp_enable_default); ++ DWC_PRINTF("Finished setting default values for core params\n"); ++ ++ return 0; ++} ++ ++uint8_t dwc_otg_is_dma_enable(dwc_otg_core_if_t * core_if) ++{ ++ return core_if->dma_enable; ++} ++ ++/* Checks if the parameter is outside of its valid range of values */ ++#define DWC_OTG_PARAM_TEST(_param_, _low_, _high_) \ ++ (((_param_) < (_low_)) || \ ++ ((_param_) > (_high_))) ++ ++/* Parameter access functions */ ++int dwc_otg_set_param_otg_cap(dwc_otg_core_if_t * core_if, int32_t val) ++{ ++ int valid; ++ int retval = 0; ++ if (DWC_OTG_PARAM_TEST(val, 0, 2)) { ++ DWC_WARN("Wrong value for otg_cap parameter\n"); ++ DWC_WARN("otg_cap parameter must be 0,1 or 2\n"); ++ retval = -DWC_E_INVALID; ++ goto out; ++ } ++ ++ valid = 1; ++ switch (val) { ++ case DWC_OTG_CAP_PARAM_HNP_SRP_CAPABLE: ++ if (core_if->hwcfg2.b.op_mode != ++ DWC_HWCFG2_OP_MODE_HNP_SRP_CAPABLE_OTG) ++ valid = 0; ++ break; ++ case DWC_OTG_CAP_PARAM_SRP_ONLY_CAPABLE: ++ if ((core_if->hwcfg2.b.op_mode != ++ DWC_HWCFG2_OP_MODE_HNP_SRP_CAPABLE_OTG) ++ && (core_if->hwcfg2.b.op_mode != ++ DWC_HWCFG2_OP_MODE_SRP_ONLY_CAPABLE_OTG) ++ && (core_if->hwcfg2.b.op_mode != ++ DWC_HWCFG2_OP_MODE_SRP_CAPABLE_DEVICE) ++ && (core_if->hwcfg2.b.op_mode != ++ DWC_HWCFG2_OP_MODE_SRP_CAPABLE_HOST)) { ++ valid = 0; ++ } ++ break; ++ case DWC_OTG_CAP_PARAM_NO_HNP_SRP_CAPABLE: ++ /* always valid */ ++ break; ++ } ++ if (!valid) { ++ if (dwc_otg_param_initialized(core_if->core_params->otg_cap)) { ++ DWC_ERROR ++ ("%d invalid for otg_cap paremter. Check HW configuration.\n", ++ val); ++ } ++ val = ++ (((core_if->hwcfg2.b.op_mode == ++ DWC_HWCFG2_OP_MODE_HNP_SRP_CAPABLE_OTG) ++ || (core_if->hwcfg2.b.op_mode == ++ DWC_HWCFG2_OP_MODE_SRP_ONLY_CAPABLE_OTG) ++ || (core_if->hwcfg2.b.op_mode == ++ DWC_HWCFG2_OP_MODE_SRP_CAPABLE_DEVICE) ++ || (core_if->hwcfg2.b.op_mode == ++ DWC_HWCFG2_OP_MODE_SRP_CAPABLE_HOST)) ? ++ DWC_OTG_CAP_PARAM_SRP_ONLY_CAPABLE : ++ DWC_OTG_CAP_PARAM_NO_HNP_SRP_CAPABLE); ++ retval = -DWC_E_INVALID; ++ } ++ ++ core_if->core_params->otg_cap = val; ++out: ++ return retval; ++} ++ ++int32_t dwc_otg_get_param_otg_cap(dwc_otg_core_if_t * core_if) ++{ ++ return core_if->core_params->otg_cap; ++} ++ ++int dwc_otg_set_param_opt(dwc_otg_core_if_t * core_if, int32_t val) ++{ ++ if (DWC_OTG_PARAM_TEST(val, 0, 1)) { ++ DWC_WARN("Wrong value for opt parameter\n"); ++ return -DWC_E_INVALID; ++ } ++ core_if->core_params->opt = val; ++ return 0; ++} ++ ++int32_t dwc_otg_get_param_opt(dwc_otg_core_if_t * core_if) ++{ ++ return core_if->core_params->opt; ++} ++ ++int dwc_otg_set_param_dma_enable(dwc_otg_core_if_t * core_if, int32_t val) ++{ ++ int retval = 0; ++ if (DWC_OTG_PARAM_TEST(val, 0, 1)) { ++ DWC_WARN("Wrong value for dma enable\n"); ++ return -DWC_E_INVALID; ++ } ++ ++ if ((val == 1) && (core_if->hwcfg2.b.architecture == 0)) { ++ if (dwc_otg_param_initialized(core_if->core_params->dma_enable)) { ++ DWC_ERROR ++ ("%d invalid for dma_enable paremter. Check HW configuration.\n", ++ val); ++ } ++ val = 0; ++ retval = -DWC_E_INVALID; ++ } ++ ++ core_if->core_params->dma_enable = val; ++ if (val == 0) { ++ dwc_otg_set_param_dma_desc_enable(core_if, 0); ++ } ++ return retval; ++} ++ ++int32_t dwc_otg_get_param_dma_enable(dwc_otg_core_if_t * core_if) ++{ ++ return core_if->core_params->dma_enable; ++} ++ ++int dwc_otg_set_param_dma_desc_enable(dwc_otg_core_if_t * core_if, int32_t val) ++{ ++ int retval = 0; ++ if (DWC_OTG_PARAM_TEST(val, 0, 1)) { ++ DWC_WARN("Wrong value for dma_enable\n"); ++ DWC_WARN("dma_desc_enable must be 0 or 1\n"); ++ return -DWC_E_INVALID; ++ } ++ ++ if ((val == 1) ++ && ((dwc_otg_get_param_dma_enable(core_if) == 0) ++ || (core_if->hwcfg4.b.desc_dma == 0))) { ++ if (dwc_otg_param_initialized ++ (core_if->core_params->dma_desc_enable)) { ++ DWC_ERROR ++ ("%d invalid for dma_desc_enable paremter. Check HW configuration.\n", ++ val); ++ } ++ val = 0; ++ retval = -DWC_E_INVALID; ++ } ++ core_if->core_params->dma_desc_enable = val; ++ return retval; ++} ++ ++int32_t dwc_otg_get_param_dma_desc_enable(dwc_otg_core_if_t * core_if) ++{ ++ return core_if->core_params->dma_desc_enable; ++} ++ ++int dwc_otg_set_param_host_support_fs_ls_low_power(dwc_otg_core_if_t * core_if, ++ int32_t val) ++{ ++ if (DWC_OTG_PARAM_TEST(val, 0, 1)) { ++ DWC_WARN("Wrong value for host_support_fs_low_power\n"); ++ DWC_WARN("host_support_fs_low_power must be 0 or 1\n"); ++ return -DWC_E_INVALID; ++ } ++ core_if->core_params->host_support_fs_ls_low_power = val; ++ return 0; ++} ++ ++int32_t dwc_otg_get_param_host_support_fs_ls_low_power(dwc_otg_core_if_t * ++ core_if) ++{ ++ return core_if->core_params->host_support_fs_ls_low_power; ++} ++ ++int dwc_otg_set_param_enable_dynamic_fifo(dwc_otg_core_if_t * core_if, ++ int32_t val) ++{ ++ int retval = 0; ++ if (DWC_OTG_PARAM_TEST(val, 0, 1)) { ++ DWC_WARN("Wrong value for enable_dynamic_fifo\n"); ++ DWC_WARN("enable_dynamic_fifo must be 0 or 1\n"); ++ return -DWC_E_INVALID; ++ } ++ ++ if ((val == 1) && (core_if->hwcfg2.b.dynamic_fifo == 0)) { ++ if (dwc_otg_param_initialized ++ (core_if->core_params->enable_dynamic_fifo)) { ++ DWC_ERROR ++ ("%d invalid for enable_dynamic_fifo paremter. Check HW configuration.\n", ++ val); ++ } ++ val = 0; ++ retval = -DWC_E_INVALID; ++ } ++ core_if->core_params->enable_dynamic_fifo = val; ++ return retval; ++} ++ ++int32_t dwc_otg_get_param_enable_dynamic_fifo(dwc_otg_core_if_t * core_if) ++{ ++ return core_if->core_params->enable_dynamic_fifo; ++} ++ ++int dwc_otg_set_param_data_fifo_size(dwc_otg_core_if_t * core_if, int32_t val) ++{ ++ int retval = 0; ++ if (DWC_OTG_PARAM_TEST(val, 32, 32768)) { ++ DWC_WARN("Wrong value for data_fifo_size\n"); ++ DWC_WARN("data_fifo_size must be 32-32768\n"); ++ return -DWC_E_INVALID; ++ } ++ ++ if (val > core_if->hwcfg3.b.dfifo_depth) { ++ if (dwc_otg_param_initialized ++ (core_if->core_params->data_fifo_size)) { ++ DWC_ERROR ++ ("%d invalid for data_fifo_size parameter. Check HW configuration.\n", ++ val); ++ } ++ val = core_if->hwcfg3.b.dfifo_depth; ++ retval = -DWC_E_INVALID; ++ } ++ ++ core_if->core_params->data_fifo_size = val; ++ return retval; ++} ++ ++int32_t dwc_otg_get_param_data_fifo_size(dwc_otg_core_if_t * core_if) ++{ ++ return core_if->core_params->data_fifo_size; ++} ++ ++int dwc_otg_set_param_dev_rx_fifo_size(dwc_otg_core_if_t * core_if, int32_t val) ++{ ++ int retval = 0; ++ if (DWC_OTG_PARAM_TEST(val, 16, 32768)) { ++ DWC_WARN("Wrong value for dev_rx_fifo_size\n"); ++ DWC_WARN("dev_rx_fifo_size must be 16-32768\n"); ++ return -DWC_E_INVALID; ++ } ++ ++ if (val > DWC_READ_REG32(&core_if->core_global_regs->grxfsiz)) { ++ if (dwc_otg_param_initialized(core_if->core_params->dev_rx_fifo_size)) { ++ DWC_WARN("%d invalid for dev_rx_fifo_size parameter\n", val); ++ } ++ val = DWC_READ_REG32(&core_if->core_global_regs->grxfsiz); ++ retval = -DWC_E_INVALID; ++ } ++ ++ core_if->core_params->dev_rx_fifo_size = val; ++ return retval; ++} ++ ++int32_t dwc_otg_get_param_dev_rx_fifo_size(dwc_otg_core_if_t * core_if) ++{ ++ return core_if->core_params->dev_rx_fifo_size; ++} ++ ++int dwc_otg_set_param_dev_nperio_tx_fifo_size(dwc_otg_core_if_t * core_if, ++ int32_t val) ++{ ++ int retval = 0; ++ ++ if (DWC_OTG_PARAM_TEST(val, 16, 32768)) { ++ DWC_WARN("Wrong value for dev_nperio_tx_fifo\n"); ++ DWC_WARN("dev_nperio_tx_fifo must be 16-32768\n"); ++ return -DWC_E_INVALID; ++ } ++ ++ if (val > (DWC_READ_REG32(&core_if->core_global_regs->gnptxfsiz) >> 16)) { ++ if (dwc_otg_param_initialized ++ (core_if->core_params->dev_nperio_tx_fifo_size)) { ++ DWC_ERROR ++ ("%d invalid for dev_nperio_tx_fifo_size. Check HW configuration.\n", ++ val); ++ } ++ val = ++ (DWC_READ_REG32(&core_if->core_global_regs->gnptxfsiz) >> ++ 16); ++ retval = -DWC_E_INVALID; ++ } ++ ++ core_if->core_params->dev_nperio_tx_fifo_size = val; ++ return retval; ++} ++ ++int32_t dwc_otg_get_param_dev_nperio_tx_fifo_size(dwc_otg_core_if_t * core_if) ++{ ++ return core_if->core_params->dev_nperio_tx_fifo_size; ++} ++ ++int dwc_otg_set_param_host_rx_fifo_size(dwc_otg_core_if_t * core_if, ++ int32_t val) ++{ ++ int retval = 0; ++ ++ if (DWC_OTG_PARAM_TEST(val, 16, 32768)) { ++ DWC_WARN("Wrong value for host_rx_fifo_size\n"); ++ DWC_WARN("host_rx_fifo_size must be 16-32768\n"); ++ return -DWC_E_INVALID; ++ } ++ ++ if (val > DWC_READ_REG32(&core_if->core_global_regs->grxfsiz)) { ++ if (dwc_otg_param_initialized ++ (core_if->core_params->host_rx_fifo_size)) { ++ DWC_ERROR ++ ("%d invalid for host_rx_fifo_size. Check HW configuration.\n", ++ val); ++ } ++ val = DWC_READ_REG32(&core_if->core_global_regs->grxfsiz); ++ retval = -DWC_E_INVALID; ++ } ++ ++ core_if->core_params->host_rx_fifo_size = val; ++ return retval; ++ ++} ++ ++int32_t dwc_otg_get_param_host_rx_fifo_size(dwc_otg_core_if_t * core_if) ++{ ++ return core_if->core_params->host_rx_fifo_size; ++} ++ ++int dwc_otg_set_param_host_nperio_tx_fifo_size(dwc_otg_core_if_t * core_if, ++ int32_t val) ++{ ++ int retval = 0; ++ ++ if (DWC_OTG_PARAM_TEST(val, 16, 32768)) { ++ DWC_WARN("Wrong value for host_nperio_tx_fifo_size\n"); ++ DWC_WARN("host_nperio_tx_fifo_size must be 16-32768\n"); ++ return -DWC_E_INVALID; ++ } ++ ++ if (val > (DWC_READ_REG32(&core_if->core_global_regs->gnptxfsiz) >> 16)) { ++ if (dwc_otg_param_initialized ++ (core_if->core_params->host_nperio_tx_fifo_size)) { ++ DWC_ERROR ++ ("%d invalid for host_nperio_tx_fifo_size. Check HW configuration.\n", ++ val); ++ } ++ val = ++ (DWC_READ_REG32(&core_if->core_global_regs->gnptxfsiz) >> ++ 16); ++ retval = -DWC_E_INVALID; ++ } ++ ++ core_if->core_params->host_nperio_tx_fifo_size = val; ++ return retval; ++} ++ ++int32_t dwc_otg_get_param_host_nperio_tx_fifo_size(dwc_otg_core_if_t * core_if) ++{ ++ return core_if->core_params->host_nperio_tx_fifo_size; ++} ++ ++int dwc_otg_set_param_host_perio_tx_fifo_size(dwc_otg_core_if_t * core_if, ++ int32_t val) ++{ ++ int retval = 0; ++ if (DWC_OTG_PARAM_TEST(val, 16, 32768)) { ++ DWC_WARN("Wrong value for host_perio_tx_fifo_size\n"); ++ DWC_WARN("host_perio_tx_fifo_size must be 16-32768\n"); ++ return -DWC_E_INVALID; ++ } ++ ++ if (val > ((core_if->hptxfsiz.d32) >> 16)) { ++ if (dwc_otg_param_initialized ++ (core_if->core_params->host_perio_tx_fifo_size)) { ++ DWC_ERROR ++ ("%d invalid for host_perio_tx_fifo_size. Check HW configuration.\n", ++ val); ++ } ++ val = (core_if->hptxfsiz.d32) >> 16; ++ retval = -DWC_E_INVALID; ++ } ++ ++ core_if->core_params->host_perio_tx_fifo_size = val; ++ return retval; ++} ++ ++int32_t dwc_otg_get_param_host_perio_tx_fifo_size(dwc_otg_core_if_t * core_if) ++{ ++ return core_if->core_params->host_perio_tx_fifo_size; ++} ++ ++int dwc_otg_set_param_max_transfer_size(dwc_otg_core_if_t * core_if, ++ int32_t val) ++{ ++ int retval = 0; ++ ++ if (DWC_OTG_PARAM_TEST(val, 2047, 524288)) { ++ DWC_WARN("Wrong value for max_transfer_size\n"); ++ DWC_WARN("max_transfer_size must be 2047-524288\n"); ++ return -DWC_E_INVALID; ++ } ++ ++ if (val >= (1 << (core_if->hwcfg3.b.xfer_size_cntr_width + 11))) { ++ if (dwc_otg_param_initialized ++ (core_if->core_params->max_transfer_size)) { ++ DWC_ERROR ++ ("%d invalid for max_transfer_size. Check HW configuration.\n", ++ val); ++ } ++ val = ++ ((1 << (core_if->hwcfg3.b.packet_size_cntr_width + 11)) - ++ 1); ++ retval = -DWC_E_INVALID; ++ } ++ ++ core_if->core_params->max_transfer_size = val; ++ return retval; ++} ++ ++int32_t dwc_otg_get_param_max_transfer_size(dwc_otg_core_if_t * core_if) ++{ ++ return core_if->core_params->max_transfer_size; ++} ++ ++int dwc_otg_set_param_max_packet_count(dwc_otg_core_if_t * core_if, int32_t val) ++{ ++ int retval = 0; ++ ++ if (DWC_OTG_PARAM_TEST(val, 15, 511)) { ++ DWC_WARN("Wrong value for max_packet_count\n"); ++ DWC_WARN("max_packet_count must be 15-511\n"); ++ return -DWC_E_INVALID; ++ } ++ ++ if (val > (1 << (core_if->hwcfg3.b.packet_size_cntr_width + 4))) { ++ if (dwc_otg_param_initialized ++ (core_if->core_params->max_packet_count)) { ++ DWC_ERROR ++ ("%d invalid for max_packet_count. Check HW configuration.\n", ++ val); ++ } ++ val = ++ ((1 << (core_if->hwcfg3.b.packet_size_cntr_width + 4)) - 1); ++ retval = -DWC_E_INVALID; ++ } ++ ++ core_if->core_params->max_packet_count = val; ++ return retval; ++} ++ ++int32_t dwc_otg_get_param_max_packet_count(dwc_otg_core_if_t * core_if) ++{ ++ return core_if->core_params->max_packet_count; ++} ++ ++int dwc_otg_set_param_host_channels(dwc_otg_core_if_t * core_if, int32_t val) ++{ ++ int retval = 0; ++ ++ if (DWC_OTG_PARAM_TEST(val, 1, 16)) { ++ DWC_WARN("Wrong value for host_channels\n"); ++ DWC_WARN("host_channels must be 1-16\n"); ++ return -DWC_E_INVALID; ++ } ++ ++ if (val > (core_if->hwcfg2.b.num_host_chan + 1)) { ++ if (dwc_otg_param_initialized ++ (core_if->core_params->host_channels)) { ++ DWC_ERROR ++ ("%d invalid for host_channels. Check HW configurations.\n", ++ val); ++ } ++ val = (core_if->hwcfg2.b.num_host_chan + 1); ++ retval = -DWC_E_INVALID; ++ } ++ ++ core_if->core_params->host_channels = val; ++ return retval; ++} ++ ++int32_t dwc_otg_get_param_host_channels(dwc_otg_core_if_t * core_if) ++{ ++ return core_if->core_params->host_channels; ++} ++ ++int dwc_otg_set_param_dev_endpoints(dwc_otg_core_if_t * core_if, int32_t val) ++{ ++ int retval = 0; ++ ++ if (DWC_OTG_PARAM_TEST(val, 1, 15)) { ++ DWC_WARN("Wrong value for dev_endpoints\n"); ++ DWC_WARN("dev_endpoints must be 1-15\n"); ++ return -DWC_E_INVALID; ++ } ++ ++ if (val > (core_if->hwcfg2.b.num_dev_ep)) { ++ if (dwc_otg_param_initialized ++ (core_if->core_params->dev_endpoints)) { ++ DWC_ERROR ++ ("%d invalid for dev_endpoints. Check HW configurations.\n", ++ val); ++ } ++ val = core_if->hwcfg2.b.num_dev_ep; ++ retval = -DWC_E_INVALID; ++ } ++ ++ core_if->core_params->dev_endpoints = val; ++ return retval; ++} ++ ++int32_t dwc_otg_get_param_dev_endpoints(dwc_otg_core_if_t * core_if) ++{ ++ return core_if->core_params->dev_endpoints; ++} ++ ++int dwc_otg_set_param_phy_type(dwc_otg_core_if_t * core_if, int32_t val) ++{ ++ int retval = 0; ++ int valid = 0; ++ ++ if (DWC_OTG_PARAM_TEST(val, 0, 2)) { ++ DWC_WARN("Wrong value for phy_type\n"); ++ DWC_WARN("phy_type must be 0,1 or 2\n"); ++ return -DWC_E_INVALID; ++ } ++#ifndef NO_FS_PHY_HW_CHECKS ++ if ((val == DWC_PHY_TYPE_PARAM_UTMI) && ++ ((core_if->hwcfg2.b.hs_phy_type == 1) || ++ (core_if->hwcfg2.b.hs_phy_type == 3))) { ++ valid = 1; ++ } else if ((val == DWC_PHY_TYPE_PARAM_ULPI) && ++ ((core_if->hwcfg2.b.hs_phy_type == 2) || ++ (core_if->hwcfg2.b.hs_phy_type == 3))) { ++ valid = 1; ++ } else if ((val == DWC_PHY_TYPE_PARAM_FS) && ++ (core_if->hwcfg2.b.fs_phy_type == 1)) { ++ valid = 1; ++ } ++ if (!valid) { ++ if (dwc_otg_param_initialized(core_if->core_params->phy_type)) { ++ DWC_ERROR ++ ("%d invalid for phy_type. Check HW configurations.\n", ++ val); ++ } ++ if (core_if->hwcfg2.b.hs_phy_type) { ++ if ((core_if->hwcfg2.b.hs_phy_type == 3) || ++ (core_if->hwcfg2.b.hs_phy_type == 1)) { ++ val = DWC_PHY_TYPE_PARAM_UTMI; ++ } else { ++ val = DWC_PHY_TYPE_PARAM_ULPI; ++ } ++ } ++ retval = -DWC_E_INVALID; ++ } ++#endif ++ core_if->core_params->phy_type = val; ++ return retval; ++} ++ ++int32_t dwc_otg_get_param_phy_type(dwc_otg_core_if_t * core_if) ++{ ++ return core_if->core_params->phy_type; ++} ++ ++int dwc_otg_set_param_speed(dwc_otg_core_if_t * core_if, int32_t val) ++{ ++ int retval = 0; ++ if (DWC_OTG_PARAM_TEST(val, 0, 1)) { ++ DWC_WARN("Wrong value for speed parameter\n"); ++ DWC_WARN("max_speed parameter must be 0 or 1\n"); ++ return -DWC_E_INVALID; ++ } ++ if ((val == 0) ++ && dwc_otg_get_param_phy_type(core_if) == DWC_PHY_TYPE_PARAM_FS) { ++ if (dwc_otg_param_initialized(core_if->core_params->speed)) { ++ DWC_ERROR ++ ("%d invalid for speed paremter. Check HW configuration.\n", ++ val); ++ } ++ val = ++ (dwc_otg_get_param_phy_type(core_if) == ++ DWC_PHY_TYPE_PARAM_FS ? 1 : 0); ++ retval = -DWC_E_INVALID; ++ } ++ core_if->core_params->speed = val; ++ return retval; ++} ++ ++int32_t dwc_otg_get_param_speed(dwc_otg_core_if_t * core_if) ++{ ++ return core_if->core_params->speed; ++} ++ ++int dwc_otg_set_param_host_ls_low_power_phy_clk(dwc_otg_core_if_t * core_if, ++ int32_t val) ++{ ++ int retval = 0; ++ ++ if (DWC_OTG_PARAM_TEST(val, 0, 1)) { ++ DWC_WARN ++ ("Wrong value for host_ls_low_power_phy_clk parameter\n"); ++ DWC_WARN("host_ls_low_power_phy_clk must be 0 or 1\n"); ++ return -DWC_E_INVALID; ++ } ++ ++ if ((val == DWC_HOST_LS_LOW_POWER_PHY_CLK_PARAM_48MHZ) ++ && (dwc_otg_get_param_phy_type(core_if) == DWC_PHY_TYPE_PARAM_FS)) { ++ if (dwc_otg_param_initialized ++ (core_if->core_params->host_ls_low_power_phy_clk)) { ++ DWC_ERROR ++ ("%d invalid for host_ls_low_power_phy_clk. Check HW configuration.\n", ++ val); ++ } ++ val = ++ (dwc_otg_get_param_phy_type(core_if) == ++ DWC_PHY_TYPE_PARAM_FS) ? ++ DWC_HOST_LS_LOW_POWER_PHY_CLK_PARAM_6MHZ : ++ DWC_HOST_LS_LOW_POWER_PHY_CLK_PARAM_48MHZ; ++ retval = -DWC_E_INVALID; ++ } ++ ++ core_if->core_params->host_ls_low_power_phy_clk = val; ++ return retval; ++} ++ ++int32_t dwc_otg_get_param_host_ls_low_power_phy_clk(dwc_otg_core_if_t * core_if) ++{ ++ return core_if->core_params->host_ls_low_power_phy_clk; ++} ++ ++int dwc_otg_set_param_phy_ulpi_ddr(dwc_otg_core_if_t * core_if, int32_t val) ++{ ++ if (DWC_OTG_PARAM_TEST(val, 0, 1)) { ++ DWC_WARN("Wrong value for phy_ulpi_ddr\n"); ++ DWC_WARN("phy_upli_ddr must be 0 or 1\n"); ++ return -DWC_E_INVALID; ++ } ++ ++ core_if->core_params->phy_ulpi_ddr = val; ++ return 0; ++} ++ ++int32_t dwc_otg_get_param_phy_ulpi_ddr(dwc_otg_core_if_t * core_if) ++{ ++ return core_if->core_params->phy_ulpi_ddr; ++} ++ ++int dwc_otg_set_param_phy_ulpi_ext_vbus(dwc_otg_core_if_t * core_if, ++ int32_t val) ++{ ++ if (DWC_OTG_PARAM_TEST(val, 0, 1)) { ++ DWC_WARN("Wrong valaue for phy_ulpi_ext_vbus\n"); ++ DWC_WARN("phy_ulpi_ext_vbus must be 0 or 1\n"); ++ return -DWC_E_INVALID; ++ } ++ ++ core_if->core_params->phy_ulpi_ext_vbus = val; ++ return 0; ++} ++ ++int32_t dwc_otg_get_param_phy_ulpi_ext_vbus(dwc_otg_core_if_t * core_if) ++{ ++ return core_if->core_params->phy_ulpi_ext_vbus; ++} ++ ++int dwc_otg_set_param_phy_utmi_width(dwc_otg_core_if_t * core_if, int32_t val) ++{ ++ if (DWC_OTG_PARAM_TEST(val, 8, 8) && DWC_OTG_PARAM_TEST(val, 16, 16)) { ++ DWC_WARN("Wrong valaue for phy_utmi_width\n"); ++ DWC_WARN("phy_utmi_width must be 8 or 16\n"); ++ return -DWC_E_INVALID; ++ } ++ ++ core_if->core_params->phy_utmi_width = val; ++ return 0; ++} ++ ++int32_t dwc_otg_get_param_phy_utmi_width(dwc_otg_core_if_t * core_if) ++{ ++ return core_if->core_params->phy_utmi_width; ++} ++ ++int dwc_otg_set_param_ulpi_fs_ls(dwc_otg_core_if_t * core_if, int32_t val) ++{ ++ if (DWC_OTG_PARAM_TEST(val, 0, 1)) { ++ DWC_WARN("Wrong valaue for ulpi_fs_ls\n"); ++ DWC_WARN("ulpi_fs_ls must be 0 or 1\n"); ++ return -DWC_E_INVALID; ++ } ++ ++ core_if->core_params->ulpi_fs_ls = val; ++ return 0; ++} ++ ++int32_t dwc_otg_get_param_ulpi_fs_ls(dwc_otg_core_if_t * core_if) ++{ ++ return core_if->core_params->ulpi_fs_ls; ++} ++ ++int dwc_otg_set_param_ts_dline(dwc_otg_core_if_t * core_if, int32_t val) ++{ ++ if (DWC_OTG_PARAM_TEST(val, 0, 1)) { ++ DWC_WARN("Wrong valaue for ts_dline\n"); ++ DWC_WARN("ts_dline must be 0 or 1\n"); ++ return -DWC_E_INVALID; ++ } ++ ++ core_if->core_params->ts_dline = val; ++ return 0; ++} ++ ++int32_t dwc_otg_get_param_ts_dline(dwc_otg_core_if_t * core_if) ++{ ++ return core_if->core_params->ts_dline; ++} ++ ++int dwc_otg_set_param_i2c_enable(dwc_otg_core_if_t * core_if, int32_t val) ++{ ++ int retval = 0; ++ if (DWC_OTG_PARAM_TEST(val, 0, 1)) { ++ DWC_WARN("Wrong valaue for i2c_enable\n"); ++ DWC_WARN("i2c_enable must be 0 or 1\n"); ++ return -DWC_E_INVALID; ++ } ++#ifndef NO_FS_PHY_HW_CHECK ++ if (val == 1 && core_if->hwcfg3.b.i2c == 0) { ++ if (dwc_otg_param_initialized(core_if->core_params->i2c_enable)) { ++ DWC_ERROR ++ ("%d invalid for i2c_enable. Check HW configuration.\n", ++ val); ++ } ++ val = 0; ++ retval = -DWC_E_INVALID; ++ } ++#endif ++ ++ core_if->core_params->i2c_enable = val; ++ return retval; ++} ++ ++int32_t dwc_otg_get_param_i2c_enable(dwc_otg_core_if_t * core_if) ++{ ++ return core_if->core_params->i2c_enable; ++} ++ ++int dwc_otg_set_param_dev_perio_tx_fifo_size(dwc_otg_core_if_t * core_if, ++ int32_t val, int fifo_num) ++{ ++ int retval = 0; ++ ++ if (DWC_OTG_PARAM_TEST(val, 4, 768)) { ++ DWC_WARN("Wrong value for dev_perio_tx_fifo_size\n"); ++ DWC_WARN("dev_perio_tx_fifo_size must be 4-768\n"); ++ return -DWC_E_INVALID; ++ } ++ ++ if (val > ++ (DWC_READ_REG32(&core_if->core_global_regs->dtxfsiz[fifo_num]))) { ++ if (dwc_otg_param_initialized ++ (core_if->core_params->dev_perio_tx_fifo_size[fifo_num])) { ++ DWC_ERROR ++ ("`%d' invalid for parameter `dev_perio_fifo_size_%d'. Check HW configuration.\n", ++ val, fifo_num); ++ } ++ val = (DWC_READ_REG32(&core_if->core_global_regs->dtxfsiz[fifo_num])); ++ retval = -DWC_E_INVALID; ++ } ++ ++ core_if->core_params->dev_perio_tx_fifo_size[fifo_num] = val; ++ return retval; ++} ++ ++int32_t dwc_otg_get_param_dev_perio_tx_fifo_size(dwc_otg_core_if_t * core_if, ++ int fifo_num) ++{ ++ return core_if->core_params->dev_perio_tx_fifo_size[fifo_num]; ++} ++ ++int dwc_otg_set_param_en_multiple_tx_fifo(dwc_otg_core_if_t * core_if, ++ int32_t val) ++{ ++ int retval = 0; ++ if (DWC_OTG_PARAM_TEST(val, 0, 1)) { ++ DWC_WARN("Wrong valaue for en_multiple_tx_fifo,\n"); ++ DWC_WARN("en_multiple_tx_fifo must be 0 or 1\n"); ++ return -DWC_E_INVALID; ++ } ++ ++ if (val == 1 && core_if->hwcfg4.b.ded_fifo_en == 0) { ++ if (dwc_otg_param_initialized ++ (core_if->core_params->en_multiple_tx_fifo)) { ++ DWC_ERROR ++ ("%d invalid for parameter en_multiple_tx_fifo. Check HW configuration.\n", ++ val); ++ } ++ val = 0; ++ retval = -DWC_E_INVALID; ++ } ++ ++ core_if->core_params->en_multiple_tx_fifo = val; ++ return retval; ++} ++ ++int32_t dwc_otg_get_param_en_multiple_tx_fifo(dwc_otg_core_if_t * core_if) ++{ ++ return core_if->core_params->en_multiple_tx_fifo; ++} ++ ++int dwc_otg_set_param_dev_tx_fifo_size(dwc_otg_core_if_t * core_if, int32_t val, ++ int fifo_num) ++{ ++ int retval = 0; ++ ++ if (DWC_OTG_PARAM_TEST(val, 4, 768)) { ++ DWC_WARN("Wrong value for dev_tx_fifo_size\n"); ++ DWC_WARN("dev_tx_fifo_size must be 4-768\n"); ++ return -DWC_E_INVALID; ++ } ++ ++ if (val > ++ (DWC_READ_REG32(&core_if->core_global_regs->dtxfsiz[fifo_num]))) { ++ if (dwc_otg_param_initialized ++ (core_if->core_params->dev_tx_fifo_size[fifo_num])) { ++ DWC_ERROR ++ ("`%d' invalid for parameter `dev_tx_fifo_size_%d'. Check HW configuration.\n", ++ val, fifo_num); ++ } ++ val = (DWC_READ_REG32(&core_if->core_global_regs->dtxfsiz[fifo_num])); ++ retval = -DWC_E_INVALID; ++ } ++ ++ core_if->core_params->dev_tx_fifo_size[fifo_num] = val; ++ return retval; ++} ++ ++int32_t dwc_otg_get_param_dev_tx_fifo_size(dwc_otg_core_if_t * core_if, ++ int fifo_num) ++{ ++ return core_if->core_params->dev_tx_fifo_size[fifo_num]; ++} ++ ++int dwc_otg_set_param_thr_ctl(dwc_otg_core_if_t * core_if, int32_t val) ++{ ++ int retval = 0; ++ ++ if (DWC_OTG_PARAM_TEST(val, 0, 7)) { ++ DWC_WARN("Wrong value for thr_ctl\n"); ++ DWC_WARN("thr_ctl must be 0-7\n"); ++ return -DWC_E_INVALID; ++ } ++ ++ if ((val != 0) && ++ (!dwc_otg_get_param_dma_enable(core_if) || ++ !core_if->hwcfg4.b.ded_fifo_en)) { ++ if (dwc_otg_param_initialized(core_if->core_params->thr_ctl)) { ++ DWC_ERROR ++ ("%d invalid for parameter thr_ctl. Check HW configuration.\n", ++ val); ++ } ++ val = 0; ++ retval = -DWC_E_INVALID; ++ } ++ ++ core_if->core_params->thr_ctl = val; ++ return retval; ++} ++ ++int32_t dwc_otg_get_param_thr_ctl(dwc_otg_core_if_t * core_if) ++{ ++ return core_if->core_params->thr_ctl; ++} ++ ++int dwc_otg_set_param_lpm_enable(dwc_otg_core_if_t * core_if, int32_t val) ++{ ++ int retval = 0; ++ ++ if (DWC_OTG_PARAM_TEST(val, 0, 1)) { ++ DWC_WARN("Wrong value for lpm_enable\n"); ++ DWC_WARN("lpm_enable must be 0 or 1\n"); ++ return -DWC_E_INVALID; ++ } ++ ++ if (val && !core_if->hwcfg3.b.otg_lpm_en) { ++ if (dwc_otg_param_initialized(core_if->core_params->lpm_enable)) { ++ DWC_ERROR ++ ("%d invalid for parameter lpm_enable. Check HW configuration.\n", ++ val); ++ } ++ val = 0; ++ retval = -DWC_E_INVALID; ++ } ++ ++ core_if->core_params->lpm_enable = val; ++ return retval; ++} ++ ++int32_t dwc_otg_get_param_lpm_enable(dwc_otg_core_if_t * core_if) ++{ ++ return core_if->core_params->lpm_enable; ++} ++ ++int dwc_otg_set_param_tx_thr_length(dwc_otg_core_if_t * core_if, int32_t val) ++{ ++ if (DWC_OTG_PARAM_TEST(val, 8, 128)) { ++ DWC_WARN("Wrong valaue for tx_thr_length\n"); ++ DWC_WARN("tx_thr_length must be 8 - 128\n"); ++ return -DWC_E_INVALID; ++ } ++ ++ core_if->core_params->tx_thr_length = val; ++ return 0; ++} ++ ++int32_t dwc_otg_get_param_tx_thr_length(dwc_otg_core_if_t * core_if) ++{ ++ return core_if->core_params->tx_thr_length; ++} ++ ++int dwc_otg_set_param_rx_thr_length(dwc_otg_core_if_t * core_if, int32_t val) ++{ ++ if (DWC_OTG_PARAM_TEST(val, 8, 128)) { ++ DWC_WARN("Wrong valaue for rx_thr_length\n"); ++ DWC_WARN("rx_thr_length must be 8 - 128\n"); ++ return -DWC_E_INVALID; ++ } ++ ++ core_if->core_params->rx_thr_length = val; ++ return 0; ++} ++ ++int32_t dwc_otg_get_param_rx_thr_length(dwc_otg_core_if_t * core_if) ++{ ++ return core_if->core_params->rx_thr_length; ++} ++ ++int dwc_otg_set_param_dma_burst_size(dwc_otg_core_if_t * core_if, int32_t val) ++{ ++ if (DWC_OTG_PARAM_TEST(val, 1, 1) && ++ DWC_OTG_PARAM_TEST(val, 4, 4) && ++ DWC_OTG_PARAM_TEST(val, 8, 8) && ++ DWC_OTG_PARAM_TEST(val, 16, 16) && ++ DWC_OTG_PARAM_TEST(val, 32, 32) && ++ DWC_OTG_PARAM_TEST(val, 64, 64) && ++ DWC_OTG_PARAM_TEST(val, 128, 128) && ++ DWC_OTG_PARAM_TEST(val, 256, 256)) { ++ DWC_WARN("`%d' invalid for parameter `dma_burst_size'\n", val); ++ return -DWC_E_INVALID; ++ } ++ core_if->core_params->dma_burst_size = val; ++ return 0; ++} ++ ++int32_t dwc_otg_get_param_dma_burst_size(dwc_otg_core_if_t * core_if) ++{ ++ return core_if->core_params->dma_burst_size; ++} ++ ++int dwc_otg_set_param_pti_enable(dwc_otg_core_if_t * core_if, int32_t val) ++{ ++ int retval = 0; ++ if (DWC_OTG_PARAM_TEST(val, 0, 1)) { ++ DWC_WARN("`%d' invalid for parameter `pti_enable'\n", val); ++ return -DWC_E_INVALID; ++ } ++ if (val && (core_if->snpsid < OTG_CORE_REV_2_72a)) { ++ if (dwc_otg_param_initialized(core_if->core_params->pti_enable)) { ++ DWC_ERROR ++ ("%d invalid for parameter pti_enable. Check HW configuration.\n", ++ val); ++ } ++ retval = -DWC_E_INVALID; ++ val = 0; ++ } ++ core_if->core_params->pti_enable = val; ++ return retval; ++} ++ ++int32_t dwc_otg_get_param_pti_enable(dwc_otg_core_if_t * core_if) ++{ ++ return core_if->core_params->pti_enable; ++} ++ ++int dwc_otg_set_param_mpi_enable(dwc_otg_core_if_t * core_if, int32_t val) ++{ ++ int retval = 0; ++ if (DWC_OTG_PARAM_TEST(val, 0, 1)) { ++ DWC_WARN("`%d' invalid for parameter `mpi_enable'\n", val); ++ return -DWC_E_INVALID; ++ } ++ if (val && (core_if->hwcfg2.b.multi_proc_int == 0)) { ++ if (dwc_otg_param_initialized(core_if->core_params->mpi_enable)) { ++ DWC_ERROR ++ ("%d invalid for parameter mpi_enable. Check HW configuration.\n", ++ val); ++ } ++ retval = -DWC_E_INVALID; ++ val = 0; ++ } ++ core_if->core_params->mpi_enable = val; ++ return retval; ++} ++ ++int32_t dwc_otg_get_param_mpi_enable(dwc_otg_core_if_t * core_if) ++{ ++ return core_if->core_params->mpi_enable; ++} ++ ++int dwc_otg_set_param_adp_enable(dwc_otg_core_if_t * core_if, int32_t val) ++{ ++ int retval = 0; ++ if (DWC_OTG_PARAM_TEST(val, 0, 1)) { ++ DWC_WARN("`%d' invalid for parameter `adp_enable'\n", val); ++ return -DWC_E_INVALID; ++ } ++ if (val && (core_if->hwcfg3.b.adp_supp == 0)) { ++ if (dwc_otg_param_initialized ++ (core_if->core_params->adp_supp_enable)) { ++ DWC_ERROR ++ ("%d invalid for parameter adp_enable. Check HW configuration.\n", ++ val); ++ } ++ retval = -DWC_E_INVALID; ++ val = 0; ++ } ++ core_if->core_params->adp_supp_enable = val; ++ /*Set OTG version 2.0 in case of enabling ADP*/ ++ if (val) ++ dwc_otg_set_param_otg_ver(core_if, 1); ++ ++ return retval; ++} ++ ++int32_t dwc_otg_get_param_adp_enable(dwc_otg_core_if_t * core_if) ++{ ++ return core_if->core_params->adp_supp_enable; ++} ++ ++int dwc_otg_set_param_ic_usb_cap(dwc_otg_core_if_t * core_if, int32_t val) ++{ ++ int retval = 0; ++ if (DWC_OTG_PARAM_TEST(val, 0, 1)) { ++ DWC_WARN("`%d' invalid for parameter `ic_usb_cap'\n", val); ++ DWC_WARN("ic_usb_cap must be 0 or 1\n"); ++ return -DWC_E_INVALID; ++ } ++ ++ if (val && (core_if->hwcfg2.b.otg_enable_ic_usb == 0)) { ++ if (dwc_otg_param_initialized(core_if->core_params->ic_usb_cap)) { ++ DWC_ERROR ++ ("%d invalid for parameter ic_usb_cap. Check HW configuration.\n", ++ val); ++ } ++ retval = -DWC_E_INVALID; ++ val = 0; ++ } ++ core_if->core_params->ic_usb_cap = val; ++ return retval; ++} ++ ++int32_t dwc_otg_get_param_ic_usb_cap(dwc_otg_core_if_t * core_if) ++{ ++ return core_if->core_params->ic_usb_cap; ++} ++ ++int dwc_otg_set_param_ahb_thr_ratio(dwc_otg_core_if_t * core_if, int32_t val) ++{ ++ int retval = 0; ++ int valid = 1; ++ ++ if (DWC_OTG_PARAM_TEST(val, 0, 3)) { ++ DWC_WARN("`%d' invalid for parameter `ahb_thr_ratio'\n", val); ++ DWC_WARN("ahb_thr_ratio must be 0 - 3\n"); ++ return -DWC_E_INVALID; ++ } ++ ++ if (val ++ && (core_if->snpsid < OTG_CORE_REV_2_81a ++ || !dwc_otg_get_param_thr_ctl(core_if))) { ++ valid = 0; ++ } else if (val ++ && ((dwc_otg_get_param_tx_thr_length(core_if) / (1 << val)) < ++ 4)) { ++ valid = 0; ++ } ++ if (valid == 0) { ++ if (dwc_otg_param_initialized ++ (core_if->core_params->ahb_thr_ratio)) { ++ DWC_ERROR ++ ("%d invalid for parameter ahb_thr_ratio. Check HW configuration.\n", ++ val); ++ } ++ retval = -DWC_E_INVALID; ++ val = 0; ++ } ++ ++ core_if->core_params->ahb_thr_ratio = val; ++ return retval; ++} ++ ++int32_t dwc_otg_get_param_ahb_thr_ratio(dwc_otg_core_if_t * core_if) ++{ ++ return core_if->core_params->ahb_thr_ratio; ++} ++ ++int dwc_otg_set_param_power_down(dwc_otg_core_if_t * core_if, int32_t val) ++{ ++ int retval = 0; ++ int valid = 1; ++ hwcfg4_data_t hwcfg4 = {.d32 = 0 }; ++ hwcfg4.d32 = DWC_READ_REG32(&core_if->core_global_regs->ghwcfg4); ++ ++ if (DWC_OTG_PARAM_TEST(val, 0, 3)) { ++ DWC_WARN("`%d' invalid for parameter `power_down'\n", val); ++ DWC_WARN("power_down must be 0 - 2\n"); ++ return -DWC_E_INVALID; ++ } ++ ++ if ((val == 2) && (core_if->snpsid < OTG_CORE_REV_2_91a)) { ++ valid = 0; ++ } ++ if ((val == 3) ++ && ((core_if->snpsid < OTG_CORE_REV_3_00a) ++ || (hwcfg4.b.xhiber == 0))) { ++ valid = 0; ++ } ++ if (valid == 0) { ++ if (dwc_otg_param_initialized(core_if->core_params->power_down)) { ++ DWC_ERROR ++ ("%d invalid for parameter power_down. Check HW configuration.\n", ++ val); ++ } ++ retval = -DWC_E_INVALID; ++ val = 0; ++ } ++ core_if->core_params->power_down = val; ++ return retval; ++} ++ ++int32_t dwc_otg_get_param_power_down(dwc_otg_core_if_t * core_if) ++{ ++ return core_if->core_params->power_down; ++} ++ ++int dwc_otg_set_param_reload_ctl(dwc_otg_core_if_t * core_if, int32_t val) ++{ ++ int retval = 0; ++ int valid = 1; ++ ++ if (DWC_OTG_PARAM_TEST(val, 0, 1)) { ++ DWC_WARN("`%d' invalid for parameter `reload_ctl'\n", val); ++ DWC_WARN("reload_ctl must be 0 or 1\n"); ++ return -DWC_E_INVALID; ++ } ++ ++ if ((val == 1) && (core_if->snpsid < OTG_CORE_REV_2_92a)) { ++ valid = 0; ++ } ++ if (valid == 0) { ++ if (dwc_otg_param_initialized(core_if->core_params->reload_ctl)) { ++ DWC_ERROR("%d invalid for parameter reload_ctl." ++ "Check HW configuration.\n", val); ++ } ++ retval = -DWC_E_INVALID; ++ val = 0; ++ } ++ core_if->core_params->reload_ctl = val; ++ return retval; ++} ++ ++int32_t dwc_otg_get_param_reload_ctl(dwc_otg_core_if_t * core_if) ++{ ++ return core_if->core_params->reload_ctl; ++} ++ ++int dwc_otg_set_param_dev_out_nak(dwc_otg_core_if_t * core_if, int32_t val) ++{ ++ int retval = 0; ++ int valid = 1; ++ ++ if (DWC_OTG_PARAM_TEST(val, 0, 1)) { ++ DWC_WARN("`%d' invalid for parameter `dev_out_nak'\n", val); ++ DWC_WARN("dev_out_nak must be 0 or 1\n"); ++ return -DWC_E_INVALID; ++ } ++ ++ if ((val == 1) && ((core_if->snpsid < OTG_CORE_REV_2_93a) || ++ !(core_if->core_params->dma_desc_enable))) { ++ valid = 0; ++ } ++ if (valid == 0) { ++ if (dwc_otg_param_initialized(core_if->core_params->dev_out_nak)) { ++ DWC_ERROR("%d invalid for parameter dev_out_nak." ++ "Check HW configuration.\n", val); ++ } ++ retval = -DWC_E_INVALID; ++ val = 0; ++ } ++ core_if->core_params->dev_out_nak = val; ++ return retval; ++} ++ ++int32_t dwc_otg_get_param_dev_out_nak(dwc_otg_core_if_t * core_if) ++{ ++ return core_if->core_params->dev_out_nak; ++} ++ ++int dwc_otg_set_param_cont_on_bna(dwc_otg_core_if_t * core_if, int32_t val) ++{ ++ int retval = 0; ++ int valid = 1; ++ ++ if (DWC_OTG_PARAM_TEST(val, 0, 1)) { ++ DWC_WARN("`%d' invalid for parameter `cont_on_bna'\n", val); ++ DWC_WARN("cont_on_bna must be 0 or 1\n"); ++ return -DWC_E_INVALID; ++ } ++ ++ if ((val == 1) && ((core_if->snpsid < OTG_CORE_REV_2_94a) || ++ !(core_if->core_params->dma_desc_enable))) { ++ valid = 0; ++ } ++ if (valid == 0) { ++ if (dwc_otg_param_initialized(core_if->core_params->cont_on_bna)) { ++ DWC_ERROR("%d invalid for parameter cont_on_bna." ++ "Check HW configuration.\n", val); ++ } ++ retval = -DWC_E_INVALID; ++ val = 0; ++ } ++ core_if->core_params->cont_on_bna = val; ++ return retval; ++} ++ ++int32_t dwc_otg_get_param_cont_on_bna(dwc_otg_core_if_t * core_if) ++{ ++ return core_if->core_params->cont_on_bna; ++} ++ ++int dwc_otg_set_param_ahb_single(dwc_otg_core_if_t * core_if, int32_t val) ++{ ++ int retval = 0; ++ int valid = 1; ++ ++ if (DWC_OTG_PARAM_TEST(val, 0, 1)) { ++ DWC_WARN("`%d' invalid for parameter `ahb_single'\n", val); ++ DWC_WARN("ahb_single must be 0 or 1\n"); ++ return -DWC_E_INVALID; ++ } ++ ++ if ((val == 1) && (core_if->snpsid < OTG_CORE_REV_2_94a)) { ++ valid = 0; ++ } ++ if (valid == 0) { ++ if (dwc_otg_param_initialized(core_if->core_params->ahb_single)) { ++ DWC_ERROR("%d invalid for parameter ahb_single." ++ "Check HW configuration.\n", val); ++ } ++ retval = -DWC_E_INVALID; ++ val = 0; ++ } ++ core_if->core_params->ahb_single = val; ++ return retval; ++} ++ ++int32_t dwc_otg_get_param_ahb_single(dwc_otg_core_if_t * core_if) ++{ ++ return core_if->core_params->ahb_single; ++} ++ ++int dwc_otg_set_param_otg_ver(dwc_otg_core_if_t * core_if, int32_t val) ++{ ++ int retval = 0; ++ ++ if (DWC_OTG_PARAM_TEST(val, 0, 1)) { ++ DWC_WARN("`%d' invalid for parameter `otg_ver'\n", val); ++ DWC_WARN ++ ("otg_ver must be 0(for OTG 1.3 support) or 1(for OTG 2.0 support)\n"); ++ return -DWC_E_INVALID; ++ } ++ ++ core_if->core_params->otg_ver = val; ++ return retval; ++} ++ ++int32_t dwc_otg_get_param_otg_ver(dwc_otg_core_if_t * core_if) ++{ ++ return core_if->core_params->otg_ver; ++} ++ ++uint32_t dwc_otg_get_hnpstatus(dwc_otg_core_if_t * core_if) ++{ ++ gotgctl_data_t otgctl; ++ otgctl.d32 = DWC_READ_REG32(&core_if->core_global_regs->gotgctl); ++ return otgctl.b.hstnegscs; ++} ++ ++uint32_t dwc_otg_get_srpstatus(dwc_otg_core_if_t * core_if) ++{ ++ gotgctl_data_t otgctl; ++ otgctl.d32 = DWC_READ_REG32(&core_if->core_global_regs->gotgctl); ++ return otgctl.b.sesreqscs; ++} ++ ++void dwc_otg_set_hnpreq(dwc_otg_core_if_t * core_if, uint32_t val) ++{ ++ if(core_if->otg_ver == 0) { ++ gotgctl_data_t otgctl; ++ otgctl.d32 = DWC_READ_REG32(&core_if->core_global_regs->gotgctl); ++ otgctl.b.hnpreq = val; ++ DWC_WRITE_REG32(&core_if->core_global_regs->gotgctl, otgctl.d32); ++ } else { ++ core_if->otg_sts = val; ++ } ++} ++ ++uint32_t dwc_otg_get_gsnpsid(dwc_otg_core_if_t * core_if) ++{ ++ return core_if->snpsid; ++} ++ ++uint32_t dwc_otg_get_mode(dwc_otg_core_if_t * core_if) ++{ ++ gintsts_data_t gintsts; ++ gintsts.d32 = DWC_READ_REG32(&core_if->core_global_regs->gintsts); ++ return gintsts.b.curmode; ++} ++ ++uint32_t dwc_otg_get_hnpcapable(dwc_otg_core_if_t * core_if) ++{ ++ gusbcfg_data_t usbcfg; ++ usbcfg.d32 = DWC_READ_REG32(&core_if->core_global_regs->gusbcfg); ++ return usbcfg.b.hnpcap; ++} ++ ++void dwc_otg_set_hnpcapable(dwc_otg_core_if_t * core_if, uint32_t val) ++{ ++ gusbcfg_data_t usbcfg; ++ usbcfg.d32 = DWC_READ_REG32(&core_if->core_global_regs->gusbcfg); ++ usbcfg.b.hnpcap = val; ++ DWC_WRITE_REG32(&core_if->core_global_regs->gusbcfg, usbcfg.d32); ++} ++ ++uint32_t dwc_otg_get_srpcapable(dwc_otg_core_if_t * core_if) ++{ ++ gusbcfg_data_t usbcfg; ++ usbcfg.d32 = DWC_READ_REG32(&core_if->core_global_regs->gusbcfg); ++ return usbcfg.b.srpcap; ++} ++ ++void dwc_otg_set_srpcapable(dwc_otg_core_if_t * core_if, uint32_t val) ++{ ++ gusbcfg_data_t usbcfg; ++ usbcfg.d32 = DWC_READ_REG32(&core_if->core_global_regs->gusbcfg); ++ usbcfg.b.srpcap = val; ++ DWC_WRITE_REG32(&core_if->core_global_regs->gusbcfg, usbcfg.d32); ++} ++ ++uint32_t dwc_otg_get_devspeed(dwc_otg_core_if_t * core_if) ++{ ++ dcfg_data_t dcfg; ++ /* originally: dcfg.d32 = DWC_READ_REG32(&core_if->dev_if->dev_global_regs->dcfg); */ ++ ++ dcfg.d32 = -1; //GRAYG ++ DWC_DEBUGPL(DBG_CILV, "%s - core_if(%p)\n", __func__, core_if); ++ if (NULL == core_if) ++ DWC_ERROR("reg request with NULL core_if\n"); ++ DWC_DEBUGPL(DBG_CILV, "%s - core_if(%p)->dev_if(%p)\n", __func__, ++ core_if, core_if->dev_if); ++ if (NULL == core_if->dev_if) ++ DWC_ERROR("reg request with NULL dev_if\n"); ++ DWC_DEBUGPL(DBG_CILV, "%s - core_if(%p)->dev_if(%p)->" ++ "dev_global_regs(%p)\n", __func__, ++ core_if, core_if->dev_if, ++ core_if->dev_if->dev_global_regs); ++ if (NULL == core_if->dev_if->dev_global_regs) ++ DWC_ERROR("reg request with NULL dev_global_regs\n"); ++ else { ++ DWC_DEBUGPL(DBG_CILV, "%s - &core_if(%p)->dev_if(%p)->" ++ "dev_global_regs(%p)->dcfg = %p\n", __func__, ++ core_if, core_if->dev_if, ++ core_if->dev_if->dev_global_regs, ++ &core_if->dev_if->dev_global_regs->dcfg); ++ dcfg.d32 = DWC_READ_REG32(&core_if->dev_if->dev_global_regs->dcfg); ++ } ++ return dcfg.b.devspd; ++} ++ ++void dwc_otg_set_devspeed(dwc_otg_core_if_t * core_if, uint32_t val) ++{ ++ dcfg_data_t dcfg; ++ dcfg.d32 = DWC_READ_REG32(&core_if->dev_if->dev_global_regs->dcfg); ++ dcfg.b.devspd = val; ++ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->dcfg, dcfg.d32); ++} ++ ++uint32_t dwc_otg_get_busconnected(dwc_otg_core_if_t * core_if) ++{ ++ hprt0_data_t hprt0; ++ hprt0.d32 = DWC_READ_REG32(core_if->host_if->hprt0); ++ return hprt0.b.prtconnsts; ++} ++ ++uint32_t dwc_otg_get_enumspeed(dwc_otg_core_if_t * core_if) ++{ ++ dsts_data_t dsts; ++ dsts.d32 = DWC_READ_REG32(&core_if->dev_if->dev_global_regs->dsts); ++ return dsts.b.enumspd; ++} ++ ++uint32_t dwc_otg_get_prtpower(dwc_otg_core_if_t * core_if) ++{ ++ hprt0_data_t hprt0; ++ hprt0.d32 = DWC_READ_REG32(core_if->host_if->hprt0); ++ return hprt0.b.prtpwr; ++ ++} ++ ++uint32_t dwc_otg_get_core_state(dwc_otg_core_if_t * core_if) ++{ ++ return core_if->hibernation_suspend; ++} ++ ++void dwc_otg_set_prtpower(dwc_otg_core_if_t * core_if, uint32_t val) ++{ ++ hprt0_data_t hprt0; ++ hprt0.d32 = dwc_otg_read_hprt0(core_if); ++ hprt0.b.prtpwr = val; ++ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); ++} ++ ++uint32_t dwc_otg_get_prtsuspend(dwc_otg_core_if_t * core_if) ++{ ++ hprt0_data_t hprt0; ++ hprt0.d32 = DWC_READ_REG32(core_if->host_if->hprt0); ++ return hprt0.b.prtsusp; ++ ++} ++ ++void dwc_otg_set_prtsuspend(dwc_otg_core_if_t * core_if, uint32_t val) ++{ ++ hprt0_data_t hprt0; ++ hprt0.d32 = dwc_otg_read_hprt0(core_if); ++ hprt0.b.prtsusp = val; ++ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); ++} ++ ++uint32_t dwc_otg_get_fr_interval(dwc_otg_core_if_t * core_if) ++{ ++ hfir_data_t hfir; ++ hfir.d32 = DWC_READ_REG32(&core_if->host_if->host_global_regs->hfir); ++ return hfir.b.frint; ++ ++} ++ ++void dwc_otg_set_fr_interval(dwc_otg_core_if_t * core_if, uint32_t val) ++{ ++ hfir_data_t hfir; ++ uint32_t fram_int; ++ fram_int = calc_frame_interval(core_if); ++ hfir.d32 = DWC_READ_REG32(&core_if->host_if->host_global_regs->hfir); ++ if (!core_if->core_params->reload_ctl) { ++ DWC_WARN("\nCannot reload HFIR register.HFIR.HFIRRldCtrl bit is" ++ "not set to 1.\nShould load driver with reload_ctl=1" ++ " module parameter\n"); ++ return; ++ } ++ switch (fram_int) { ++ case 3750: ++ if ((val < 3350) || (val > 4150)) { ++ DWC_WARN("HFIR interval for HS core and 30 MHz" ++ "clock freq should be from 3350 to 4150\n"); ++ return; ++ } ++ break; ++ case 30000: ++ if ((val < 26820) || (val > 33180)) { ++ DWC_WARN("HFIR interval for FS/LS core and 30 MHz" ++ "clock freq should be from 26820 to 33180\n"); ++ return; ++ } ++ break; ++ case 6000: ++ if ((val < 5360) || (val > 6640)) { ++ DWC_WARN("HFIR interval for HS core and 48 MHz" ++ "clock freq should be from 5360 to 6640\n"); ++ return; ++ } ++ break; ++ case 48000: ++ if ((val < 42912) || (val > 53088)) { ++ DWC_WARN("HFIR interval for FS/LS core and 48 MHz" ++ "clock freq should be from 42912 to 53088\n"); ++ return; ++ } ++ break; ++ case 7500: ++ if ((val < 6700) || (val > 8300)) { ++ DWC_WARN("HFIR interval for HS core and 60 MHz" ++ "clock freq should be from 6700 to 8300\n"); ++ return; ++ } ++ break; ++ case 60000: ++ if ((val < 53640) || (val > 65536)) { ++ DWC_WARN("HFIR interval for FS/LS core and 60 MHz" ++ "clock freq should be from 53640 to 65536\n"); ++ return; ++ } ++ break; ++ default: ++ DWC_WARN("Unknown frame interval\n"); ++ return; ++ break; ++ ++ } ++ hfir.b.frint = val; ++ DWC_WRITE_REG32(&core_if->host_if->host_global_regs->hfir, hfir.d32); ++} ++ ++uint32_t dwc_otg_get_mode_ch_tim(dwc_otg_core_if_t * core_if) ++{ ++ hcfg_data_t hcfg; ++ hcfg.d32 = DWC_READ_REG32(&core_if->host_if->host_global_regs->hcfg); ++ return hcfg.b.modechtimen; ++ ++} ++ ++void dwc_otg_set_mode_ch_tim(dwc_otg_core_if_t * core_if, uint32_t val) ++{ ++ hcfg_data_t hcfg; ++ hcfg.d32 = DWC_READ_REG32(&core_if->host_if->host_global_regs->hcfg); ++ hcfg.b.modechtimen = val; ++ DWC_WRITE_REG32(&core_if->host_if->host_global_regs->hcfg, hcfg.d32); ++} ++ ++void dwc_otg_set_prtresume(dwc_otg_core_if_t * core_if, uint32_t val) ++{ ++ hprt0_data_t hprt0; ++ hprt0.d32 = dwc_otg_read_hprt0(core_if); ++ hprt0.b.prtres = val; ++ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); ++} ++ ++uint32_t dwc_otg_get_remotewakesig(dwc_otg_core_if_t * core_if) ++{ ++ dctl_data_t dctl; ++ dctl.d32 = DWC_READ_REG32(&core_if->dev_if->dev_global_regs->dctl); ++ return dctl.b.rmtwkupsig; ++} ++ ++uint32_t dwc_otg_get_lpm_portsleepstatus(dwc_otg_core_if_t * core_if) ++{ ++ glpmcfg_data_t lpmcfg; ++ lpmcfg.d32 = DWC_READ_REG32(&core_if->core_global_regs->glpmcfg); ++ ++ DWC_ASSERT(! ++ ((core_if->lx_state == DWC_OTG_L1) ^ lpmcfg.b.prt_sleep_sts), ++ "lx_state = %d, lmpcfg.prt_sleep_sts = %d\n", ++ core_if->lx_state, lpmcfg.b.prt_sleep_sts); ++ ++ return lpmcfg.b.prt_sleep_sts; ++} ++ ++uint32_t dwc_otg_get_lpm_remotewakeenabled(dwc_otg_core_if_t * core_if) ++{ ++ glpmcfg_data_t lpmcfg; ++ lpmcfg.d32 = DWC_READ_REG32(&core_if->core_global_regs->glpmcfg); ++ return lpmcfg.b.rem_wkup_en; ++} ++ ++uint32_t dwc_otg_get_lpmresponse(dwc_otg_core_if_t * core_if) ++{ ++ glpmcfg_data_t lpmcfg; ++ lpmcfg.d32 = DWC_READ_REG32(&core_if->core_global_regs->glpmcfg); ++ return lpmcfg.b.appl_resp; ++} ++ ++void dwc_otg_set_lpmresponse(dwc_otg_core_if_t * core_if, uint32_t val) ++{ ++ glpmcfg_data_t lpmcfg; ++ lpmcfg.d32 = DWC_READ_REG32(&core_if->core_global_regs->glpmcfg); ++ lpmcfg.b.appl_resp = val; ++ DWC_WRITE_REG32(&core_if->core_global_regs->glpmcfg, lpmcfg.d32); ++} ++ ++uint32_t dwc_otg_get_hsic_connect(dwc_otg_core_if_t * core_if) ++{ ++ glpmcfg_data_t lpmcfg; ++ lpmcfg.d32 = DWC_READ_REG32(&core_if->core_global_regs->glpmcfg); ++ return lpmcfg.b.hsic_connect; ++} ++ ++void dwc_otg_set_hsic_connect(dwc_otg_core_if_t * core_if, uint32_t val) ++{ ++ glpmcfg_data_t lpmcfg; ++ lpmcfg.d32 = DWC_READ_REG32(&core_if->core_global_regs->glpmcfg); ++ lpmcfg.b.hsic_connect = val; ++ DWC_WRITE_REG32(&core_if->core_global_regs->glpmcfg, lpmcfg.d32); ++} ++ ++uint32_t dwc_otg_get_inv_sel_hsic(dwc_otg_core_if_t * core_if) ++{ ++ glpmcfg_data_t lpmcfg; ++ lpmcfg.d32 = DWC_READ_REG32(&core_if->core_global_regs->glpmcfg); ++ return lpmcfg.b.inv_sel_hsic; ++ ++} ++ ++void dwc_otg_set_inv_sel_hsic(dwc_otg_core_if_t * core_if, uint32_t val) ++{ ++ glpmcfg_data_t lpmcfg; ++ lpmcfg.d32 = DWC_READ_REG32(&core_if->core_global_regs->glpmcfg); ++ lpmcfg.b.inv_sel_hsic = val; ++ DWC_WRITE_REG32(&core_if->core_global_regs->glpmcfg, lpmcfg.d32); ++} ++ ++uint32_t dwc_otg_get_gotgctl(dwc_otg_core_if_t * core_if) ++{ ++ return DWC_READ_REG32(&core_if->core_global_regs->gotgctl); ++} ++ ++void dwc_otg_set_gotgctl(dwc_otg_core_if_t * core_if, uint32_t val) ++{ ++ DWC_WRITE_REG32(&core_if->core_global_regs->gotgctl, val); ++} ++ ++uint32_t dwc_otg_get_gusbcfg(dwc_otg_core_if_t * core_if) ++{ ++ return DWC_READ_REG32(&core_if->core_global_regs->gusbcfg); ++} ++ ++void dwc_otg_set_gusbcfg(dwc_otg_core_if_t * core_if, uint32_t val) ++{ ++ DWC_WRITE_REG32(&core_if->core_global_regs->gusbcfg, val); ++} ++ ++uint32_t dwc_otg_get_grxfsiz(dwc_otg_core_if_t * core_if) ++{ ++ return DWC_READ_REG32(&core_if->core_global_regs->grxfsiz); ++} ++ ++void dwc_otg_set_grxfsiz(dwc_otg_core_if_t * core_if, uint32_t val) ++{ ++ DWC_WRITE_REG32(&core_if->core_global_regs->grxfsiz, val); ++} ++ ++uint32_t dwc_otg_get_gnptxfsiz(dwc_otg_core_if_t * core_if) ++{ ++ return DWC_READ_REG32(&core_if->core_global_regs->gnptxfsiz); ++} ++ ++void dwc_otg_set_gnptxfsiz(dwc_otg_core_if_t * core_if, uint32_t val) ++{ ++ DWC_WRITE_REG32(&core_if->core_global_regs->gnptxfsiz, val); ++} ++ ++uint32_t dwc_otg_get_gpvndctl(dwc_otg_core_if_t * core_if) ++{ ++ return DWC_READ_REG32(&core_if->core_global_regs->gpvndctl); ++} ++ ++void dwc_otg_set_gpvndctl(dwc_otg_core_if_t * core_if, uint32_t val) ++{ ++ DWC_WRITE_REG32(&core_if->core_global_regs->gpvndctl, val); ++} ++ ++uint32_t dwc_otg_get_ggpio(dwc_otg_core_if_t * core_if) ++{ ++ return DWC_READ_REG32(&core_if->core_global_regs->ggpio); ++} ++ ++void dwc_otg_set_ggpio(dwc_otg_core_if_t * core_if, uint32_t val) ++{ ++ DWC_WRITE_REG32(&core_if->core_global_regs->ggpio, val); ++} ++ ++uint32_t dwc_otg_get_hprt0(dwc_otg_core_if_t * core_if) ++{ ++ return DWC_READ_REG32(core_if->host_if->hprt0); ++ ++} ++ ++void dwc_otg_set_hprt0(dwc_otg_core_if_t * core_if, uint32_t val) ++{ ++ DWC_WRITE_REG32(core_if->host_if->hprt0, val); ++} ++ ++uint32_t dwc_otg_get_guid(dwc_otg_core_if_t * core_if) ++{ ++ return DWC_READ_REG32(&core_if->core_global_regs->guid); ++} ++ ++void dwc_otg_set_guid(dwc_otg_core_if_t * core_if, uint32_t val) ++{ ++ DWC_WRITE_REG32(&core_if->core_global_regs->guid, val); ++} ++ ++uint32_t dwc_otg_get_hptxfsiz(dwc_otg_core_if_t * core_if) ++{ ++ return DWC_READ_REG32(&core_if->core_global_regs->hptxfsiz); ++} ++ ++uint16_t dwc_otg_get_otg_version(dwc_otg_core_if_t * core_if) ++{ ++ return ((core_if->otg_ver == 1) ? (uint16_t)0x0200 : (uint16_t)0x0103); ++} ++ ++/** ++ * Start the SRP timer to detect when the SRP does not complete within ++ * 6 seconds. ++ * ++ * @param core_if the pointer to core_if strucure. ++ */ ++void dwc_otg_pcd_start_srp_timer(dwc_otg_core_if_t * core_if) ++{ ++ core_if->srp_timer_started = 1; ++ DWC_TIMER_SCHEDULE(core_if->srp_timer, 6000 /* 6 secs */ ); ++} ++ ++void dwc_otg_initiate_srp(dwc_otg_core_if_t * core_if) ++{ ++ uint32_t *addr = (uint32_t *) & (core_if->core_global_regs->gotgctl); ++ gotgctl_data_t mem; ++ gotgctl_data_t val; ++ ++ val.d32 = DWC_READ_REG32(addr); ++ if (val.b.sesreq) { ++ DWC_ERROR("Session Request Already active!\n"); ++ return; ++ } ++ ++ DWC_INFO("Session Request Initated\n"); //NOTICE ++ mem.d32 = DWC_READ_REG32(addr); ++ mem.b.sesreq = 1; ++ DWC_WRITE_REG32(addr, mem.d32); ++ ++ /* Start the SRP timer */ ++ dwc_otg_pcd_start_srp_timer(core_if); ++ return; ++} +diff --git a/drivers/usb/host/dwc_otg/dwc_otg_cil.h b/drivers/usb/host/dwc_otg/dwc_otg_cil.h +new file mode 100644 +index 0000000..79dbf83 +--- /dev/null ++++ b/drivers/usb/host/dwc_otg/dwc_otg_cil.h +@@ -0,0 +1,1464 @@ ++/* ========================================================================== ++ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_cil.h $ ++ * $Revision: #123 $ ++ * $Date: 2012/08/10 $ ++ * $Change: 2047372 $ ++ * ++ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, ++ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless ++ * otherwise expressly agreed to in writing between Synopsys and you. ++ * ++ * The Software IS NOT an item of Licensed Software or Licensed Product under ++ * any End User Software License Agreement or Agreement for Licensed Product ++ * with Synopsys or any supplement thereto. You are permitted to use and ++ * redistribute this Software in source and binary forms, with or without ++ * modification, provided that redistributions of source code must retain this ++ * notice. You may not view, use, disclose, copy or distribute this file or ++ * any information contained herein except pursuant to this license grant from ++ * Synopsys. If you do not agree with this notice, including the disclaimer ++ * below, then you are not authorized to use the Software. ++ * ++ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS ++ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS 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. ++ * ========================================================================== */ ++ ++#if !defined(__DWC_CIL_H__) ++#define __DWC_CIL_H__ ++ ++#include "dwc_list.h" ++#include "dwc_otg_dbg.h" ++#include "dwc_otg_regs.h" ++ ++#include "dwc_otg_core_if.h" ++#include "dwc_otg_adp.h" ++ ++/** ++ * @file ++ * This file contains the interface to the Core Interface Layer. ++ */ ++ ++#ifdef DWC_UTE_CFI ++ ++#define MAX_DMA_DESCS_PER_EP 256 ++ ++/** ++ * Enumeration for the data buffer mode ++ */ ++typedef enum _data_buffer_mode { ++ BM_STANDARD = 0, /* data buffer is in normal mode */ ++ BM_SG = 1, /* data buffer uses the scatter/gather mode */ ++ BM_CONCAT = 2, /* data buffer uses the concatenation mode */ ++ BM_CIRCULAR = 3, /* data buffer uses the circular DMA mode */ ++ BM_ALIGN = 4 /* data buffer is in buffer alignment mode */ ++} data_buffer_mode_e; ++#endif //DWC_UTE_CFI ++ ++/** Macros defined for DWC OTG HW Release version */ ++ ++#define OTG_CORE_REV_2_60a 0x4F54260A ++#define OTG_CORE_REV_2_71a 0x4F54271A ++#define OTG_CORE_REV_2_72a 0x4F54272A ++#define OTG_CORE_REV_2_80a 0x4F54280A ++#define OTG_CORE_REV_2_81a 0x4F54281A ++#define OTG_CORE_REV_2_90a 0x4F54290A ++#define OTG_CORE_REV_2_91a 0x4F54291A ++#define OTG_CORE_REV_2_92a 0x4F54292A ++#define OTG_CORE_REV_2_93a 0x4F54293A ++#define OTG_CORE_REV_2_94a 0x4F54294A ++#define OTG_CORE_REV_3_00a 0x4F54300A ++ ++/** ++ * Information for each ISOC packet. ++ */ ++typedef struct iso_pkt_info { ++ uint32_t offset; ++ uint32_t length; ++ int32_t status; ++} iso_pkt_info_t; ++ ++/** ++ * The <code>dwc_ep</code> structure represents the state of a single ++ * endpoint when acting in device mode. It contains the data items ++ * needed for an endpoint to be activated and transfer packets. ++ */ ++typedef struct dwc_ep { ++ /** EP number used for register address lookup */ ++ uint8_t num; ++ /** EP direction 0 = OUT */ ++ unsigned is_in:1; ++ /** EP active. */ ++ unsigned active:1; ++ ++ /** ++ * Periodic Tx FIFO # for IN EPs For INTR EP set to 0 to use non-periodic ++ * Tx FIFO. If dedicated Tx FIFOs are enabled Tx FIFO # FOR IN EPs*/ ++ unsigned tx_fifo_num:4; ++ /** EP type: 0 - Control, 1 - ISOC, 2 - BULK, 3 - INTR */ ++ unsigned type:2; ++#define DWC_OTG_EP_TYPE_CONTROL 0 ++#define DWC_OTG_EP_TYPE_ISOC 1 ++#define DWC_OTG_EP_TYPE_BULK 2 ++#define DWC_OTG_EP_TYPE_INTR 3 ++ ++ /** DATA start PID for INTR and BULK EP */ ++ unsigned data_pid_start:1; ++ /** Frame (even/odd) for ISOC EP */ ++ unsigned even_odd_frame:1; ++ /** Max Packet bytes */ ++ unsigned maxpacket:11; ++ ++ /** Max Transfer size */ ++ uint32_t maxxfer; ++ ++ /** @name Transfer state */ ++ /** @{ */ ++ ++ /** ++ * Pointer to the beginning of the transfer buffer -- do not modify ++ * during transfer. ++ */ ++ ++ dwc_dma_t dma_addr; ++ ++ dwc_dma_t dma_desc_addr; ++ dwc_otg_dev_dma_desc_t *desc_addr; ++ ++ uint8_t *start_xfer_buff; ++ /** pointer to the transfer buffer */ ++ uint8_t *xfer_buff; ++ /** Number of bytes to transfer */ ++ unsigned xfer_len:19; ++ /** Number of bytes transferred. */ ++ unsigned xfer_count:19; ++ /** Sent ZLP */ ++ unsigned sent_zlp:1; ++ /** Total len for control transfer */ ++ unsigned total_len:19; ++ ++ /** stall clear flag */ ++ unsigned stall_clear_flag:1; ++ ++ /** SETUP pkt cnt rollover flag for EP0 out*/ ++ unsigned stp_rollover; ++ ++#ifdef DWC_UTE_CFI ++ /* The buffer mode */ ++ data_buffer_mode_e buff_mode; ++ ++ /* The chain of DMA descriptors. ++ * MAX_DMA_DESCS_PER_EP will be allocated for each active EP. ++ */ ++ dwc_otg_dma_desc_t *descs; ++ ++ /* The DMA address of the descriptors chain start */ ++ dma_addr_t descs_dma_addr; ++ /** This variable stores the length of the last enqueued request */ ++ uint32_t cfi_req_len; ++#endif //DWC_UTE_CFI ++ ++/** Max DMA Descriptor count for any EP */ ++#define MAX_DMA_DESC_CNT 256 ++ /** Allocated DMA Desc count */ ++ uint32_t desc_cnt; ++ ++ /** bInterval */ ++ uint32_t bInterval; ++ /** Next frame num to setup next ISOC transfer */ ++ uint32_t frame_num; ++ /** Indicates SOF number overrun in DSTS */ ++ uint8_t frm_overrun; ++ ++#ifdef DWC_UTE_PER_IO ++ /** Next frame num for which will be setup DMA Desc */ ++ uint32_t xiso_frame_num; ++ /** bInterval */ ++ uint32_t xiso_bInterval; ++ /** Count of currently active transfers - shall be either 0 or 1 */ ++ int xiso_active_xfers; ++ int xiso_queued_xfers; ++#endif ++#ifdef DWC_EN_ISOC ++ /** ++ * Variables specific for ISOC EPs ++ * ++ */ ++ /** DMA addresses of ISOC buffers */ ++ dwc_dma_t dma_addr0; ++ dwc_dma_t dma_addr1; ++ ++ dwc_dma_t iso_dma_desc_addr; ++ dwc_otg_dev_dma_desc_t *iso_desc_addr; ++ ++ /** pointer to the transfer buffers */ ++ uint8_t *xfer_buff0; ++ uint8_t *xfer_buff1; ++ ++ /** number of ISOC Buffer is processing */ ++ uint32_t proc_buf_num; ++ /** Interval of ISOC Buffer processing */ ++ uint32_t buf_proc_intrvl; ++ /** Data size for regular frame */ ++ uint32_t data_per_frame; ++ ++ /* todo - pattern data support is to be implemented in the future */ ++ /** Data size for pattern frame */ ++ uint32_t data_pattern_frame; ++ /** Frame number of pattern data */ ++ uint32_t sync_frame; ++ ++ /** bInterval */ ++ uint32_t bInterval; ++ /** ISO Packet number per frame */ ++ uint32_t pkt_per_frm; ++ /** Next frame num for which will be setup DMA Desc */ ++ uint32_t next_frame; ++ /** Number of packets per buffer processing */ ++ uint32_t pkt_cnt; ++ /** Info for all isoc packets */ ++ iso_pkt_info_t *pkt_info; ++ /** current pkt number */ ++ uint32_t cur_pkt; ++ /** current pkt number */ ++ uint8_t *cur_pkt_addr; ++ /** current pkt number */ ++ uint32_t cur_pkt_dma_addr; ++#endif /* DWC_EN_ISOC */ ++ ++/** @} */ ++} dwc_ep_t; ++ ++/* ++ * Reasons for halting a host channel. ++ */ ++typedef enum dwc_otg_halt_status { ++ DWC_OTG_HC_XFER_NO_HALT_STATUS, ++ DWC_OTG_HC_XFER_COMPLETE, ++ DWC_OTG_HC_XFER_URB_COMPLETE, ++ DWC_OTG_HC_XFER_ACK, ++ DWC_OTG_HC_XFER_NAK, ++ DWC_OTG_HC_XFER_NYET, ++ DWC_OTG_HC_XFER_STALL, ++ DWC_OTG_HC_XFER_XACT_ERR, ++ DWC_OTG_HC_XFER_FRAME_OVERRUN, ++ DWC_OTG_HC_XFER_BABBLE_ERR, ++ DWC_OTG_HC_XFER_DATA_TOGGLE_ERR, ++ DWC_OTG_HC_XFER_AHB_ERR, ++ DWC_OTG_HC_XFER_PERIODIC_INCOMPLETE, ++ DWC_OTG_HC_XFER_URB_DEQUEUE ++} dwc_otg_halt_status_e; ++ ++/** ++ * Host channel descriptor. This structure represents the state of a single ++ * host channel when acting in host mode. It contains the data items needed to ++ * transfer packets to an endpoint via a host channel. ++ */ ++typedef struct dwc_hc { ++ /** Host channel number used for register address lookup */ ++ uint8_t hc_num; ++ ++ /** Device to access */ ++ unsigned dev_addr:7; ++ ++ /** EP to access */ ++ unsigned ep_num:4; ++ ++ /** EP direction. 0: OUT, 1: IN */ ++ unsigned ep_is_in:1; ++ ++ /** ++ * EP speed. ++ * One of the following values: ++ * - DWC_OTG_EP_SPEED_LOW ++ * - DWC_OTG_EP_SPEED_FULL ++ * - DWC_OTG_EP_SPEED_HIGH ++ */ ++ unsigned speed:2; ++#define DWC_OTG_EP_SPEED_LOW 0 ++#define DWC_OTG_EP_SPEED_FULL 1 ++#define DWC_OTG_EP_SPEED_HIGH 2 ++ ++ /** ++ * Endpoint type. ++ * One of the following values: ++ * - DWC_OTG_EP_TYPE_CONTROL: 0 ++ * - DWC_OTG_EP_TYPE_ISOC: 1 ++ * - DWC_OTG_EP_TYPE_BULK: 2 ++ * - DWC_OTG_EP_TYPE_INTR: 3 ++ */ ++ unsigned ep_type:2; ++ ++ /** Max packet size in bytes */ ++ unsigned max_packet:11; ++ ++ /** ++ * PID for initial transaction. ++ * 0: DATA0,<br> ++ * 1: DATA2,<br> ++ * 2: DATA1,<br> ++ * 3: MDATA (non-Control EP), ++ * SETUP (Control EP) ++ */ ++ unsigned data_pid_start:2; ++#define DWC_OTG_HC_PID_DATA0 0 ++#define DWC_OTG_HC_PID_DATA2 1 ++#define DWC_OTG_HC_PID_DATA1 2 ++#define DWC_OTG_HC_PID_MDATA 3 ++#define DWC_OTG_HC_PID_SETUP 3 ++ ++ /** Number of periodic transactions per (micro)frame */ ++ unsigned multi_count:2; ++ ++ /** @name Transfer State */ ++ /** @{ */ ++ ++ /** Pointer to the current transfer buffer position. */ ++ uint8_t *xfer_buff; ++ /** ++ * In Buffer DMA mode this buffer will be used ++ * if xfer_buff is not DWORD aligned. ++ */ ++ dwc_dma_t align_buff; ++ /** Total number of bytes to transfer. */ ++ uint32_t xfer_len; ++ /** Number of bytes transferred so far. */ ++ uint32_t xfer_count; ++ /** Packet count at start of transfer.*/ ++ uint16_t start_pkt_count; ++ ++ /** ++ * Flag to indicate whether the transfer has been started. Set to 1 if ++ * it has been started, 0 otherwise. ++ */ ++ uint8_t xfer_started; ++ ++ /** ++ * Set to 1 to indicate that a PING request should be issued on this ++ * channel. If 0, process normally. ++ */ ++ uint8_t do_ping; ++ ++ /** ++ * Set to 1 to indicate that the error count for this transaction is ++ * non-zero. Set to 0 if the error count is 0. ++ */ ++ uint8_t error_state; ++ ++ /** ++ * Set to 1 to indicate that this channel should be halted the next ++ * time a request is queued for the channel. This is necessary in ++ * slave mode if no request queue space is available when an attempt ++ * is made to halt the channel. ++ */ ++ uint8_t halt_on_queue; ++ ++ /** ++ * Set to 1 if the host channel has been halted, but the core is not ++ * finished flushing queued requests. Otherwise 0. ++ */ ++ uint8_t halt_pending; ++ ++ /** ++ * Reason for halting the host channel. ++ */ ++ dwc_otg_halt_status_e halt_status; ++ ++ /* ++ * Split settings for the host channel ++ */ ++ uint8_t do_split; /**< Enable split for the channel */ ++ uint8_t complete_split; /**< Enable complete split */ ++ uint8_t hub_addr; /**< Address of high speed hub */ ++ ++ uint8_t port_addr; /**< Port of the low/full speed device */ ++ /** Split transaction position ++ * One of the following values: ++ * - DWC_HCSPLIT_XACTPOS_MID ++ * - DWC_HCSPLIT_XACTPOS_BEGIN ++ * - DWC_HCSPLIT_XACTPOS_END ++ * - DWC_HCSPLIT_XACTPOS_ALL */ ++ uint8_t xact_pos; ++ ++ /** Set when the host channel does a short read. */ ++ uint8_t short_read; ++ ++ /** ++ * Number of requests issued for this channel since it was assigned to ++ * the current transfer (not counting PINGs). ++ */ ++ uint8_t requests; ++ ++ /** ++ * Queue Head for the transfer being processed by this channel. ++ */ ++ struct dwc_otg_qh *qh; ++ ++ /** @} */ ++ ++ /** Entry in list of host channels. */ ++ DWC_CIRCLEQ_ENTRY(dwc_hc) hc_list_entry; ++ ++ /** @name Descriptor DMA support */ ++ /** @{ */ ++ ++ /** Number of Transfer Descriptors */ ++ uint16_t ntd; ++ ++ /** Descriptor List DMA address */ ++ dwc_dma_t desc_list_addr; ++ ++ /** Scheduling micro-frame bitmap. */ ++ uint8_t schinfo; ++ ++ /** @} */ ++} dwc_hc_t; ++ ++/** ++ * The following parameters may be specified when starting the module. These ++ * parameters define how the DWC_otg controller should be configured. ++ */ ++typedef struct dwc_otg_core_params { ++ int32_t opt; ++ ++ /** ++ * Specifies the OTG capabilities. The driver will automatically ++ * detect the value for this parameter if none is specified. ++ * 0 - HNP and SRP capable (default) ++ * 1 - SRP Only capable ++ * 2 - No HNP/SRP capable ++ */ ++ int32_t otg_cap; ++ ++ /** ++ * Specifies whether to use slave or DMA mode for accessing the data ++ * FIFOs. The driver will automatically detect the value for this ++ * parameter if none is specified. ++ * 0 - Slave ++ * 1 - DMA (default, if available) ++ */ ++ int32_t dma_enable; ++ ++ /** ++ * When DMA mode is enabled specifies whether to use address DMA or DMA ++ * Descriptor mode for accessing the data FIFOs in device mode. The driver ++ * will automatically detect the value for this if none is specified. ++ * 0 - address DMA ++ * 1 - DMA Descriptor(default, if available) ++ */ ++ int32_t dma_desc_enable; ++ /** The DMA Burst size (applicable only for External DMA ++ * Mode). 1, 4, 8 16, 32, 64, 128, 256 (default 32) ++ */ ++ int32_t dma_burst_size; /* Translate this to GAHBCFG values */ ++ ++ /** ++ * Specifies the maximum speed of operation in host and device mode. ++ * The actual speed depends on the speed of the attached device and ++ * the value of phy_type. The actual speed depends on the speed of the ++ * attached device. ++ * 0 - High Speed (default) ++ * 1 - Full Speed ++ */ ++ int32_t speed; ++ /** Specifies whether low power mode is supported when attached ++ * to a Full Speed or Low Speed device in host mode. ++ * 0 - Don't support low power mode (default) ++ * 1 - Support low power mode ++ */ ++ int32_t host_support_fs_ls_low_power; ++ ++ /** Specifies the PHY clock rate in low power mode when connected to a ++ * Low Speed device in host mode. This parameter is applicable only if ++ * HOST_SUPPORT_FS_LS_LOW_POWER is enabled. If PHY_TYPE is set to FS ++ * then defaults to 6 MHZ otherwise 48 MHZ. ++ * ++ * 0 - 48 MHz ++ * 1 - 6 MHz ++ */ ++ int32_t host_ls_low_power_phy_clk; ++ ++ /** ++ * 0 - Use cC FIFO size parameters ++ * 1 - Allow dynamic FIFO sizing (default) ++ */ ++ int32_t enable_dynamic_fifo; ++ ++ /** Total number of 4-byte words in the data FIFO memory. This ++ * memory includes the Rx FIFO, non-periodic Tx FIFO, and periodic ++ * Tx FIFOs. ++ * 32 to 32768 (default 8192) ++ * Note: The total FIFO memory depth in the FPGA configuration is 8192. ++ */ ++ int32_t data_fifo_size; ++ ++ /** Number of 4-byte words in the Rx FIFO in device mode when dynamic ++ * FIFO sizing is enabled. ++ * 16 to 32768 (default 1064) ++ */ ++ int32_t dev_rx_fifo_size; ++ ++ /** Number of 4-byte words in the non-periodic Tx FIFO in device mode ++ * when dynamic FIFO sizing is enabled. ++ * 16 to 32768 (default 1024) ++ */ ++ int32_t dev_nperio_tx_fifo_size; ++ ++ /** Number of 4-byte words in each of the periodic Tx FIFOs in device ++ * mode when dynamic FIFO sizing is enabled. ++ * 4 to 768 (default 256) ++ */ ++ uint32_t dev_perio_tx_fifo_size[MAX_PERIO_FIFOS]; ++ ++ /** Number of 4-byte words in the Rx FIFO in host mode when dynamic ++ * FIFO sizing is enabled. ++ * 16 to 32768 (default 1024) ++ */ ++ int32_t host_rx_fifo_size; ++ ++ /** Number of 4-byte words in the non-periodic Tx FIFO in host mode ++ * when Dynamic FIFO sizing is enabled in the core. ++ * 16 to 32768 (default 1024) ++ */ ++ int32_t host_nperio_tx_fifo_size; ++ ++ /** Number of 4-byte words in the host periodic Tx FIFO when dynamic ++ * FIFO sizing is enabled. ++ * 16 to 32768 (default 1024) ++ */ ++ int32_t host_perio_tx_fifo_size; ++ ++ /** The maximum transfer size supported in bytes. ++ * 2047 to 65,535 (default 65,535) ++ */ ++ int32_t max_transfer_size; ++ ++ /** The maximum number of packets in a transfer. ++ * 15 to 511 (default 511) ++ */ ++ int32_t max_packet_count; ++ ++ /** The number of host channel registers to use. ++ * 1 to 16 (default 12) ++ * Note: The FPGA configuration supports a maximum of 12 host channels. ++ */ ++ int32_t host_channels; ++ ++ /** The number of endpoints in addition to EP0 available for device ++ * mode operations. ++ * 1 to 15 (default 6 IN and OUT) ++ * Note: The FPGA configuration supports a maximum of 6 IN and OUT ++ * endpoints in addition to EP0. ++ */ ++ int32_t dev_endpoints; ++ ++ /** ++ * Specifies the type of PHY interface to use. By default, the driver ++ * will automatically detect the phy_type. ++ * ++ * 0 - Full Speed PHY ++ * 1 - UTMI+ (default) ++ * 2 - ULPI ++ */ ++ int32_t phy_type; ++ ++ /** ++ * Specifies the UTMI+ Data Width. This parameter is ++ * applicable for a PHY_TYPE of UTMI+ or ULPI. (For a ULPI ++ * PHY_TYPE, this parameter indicates the data width between ++ * the MAC and the ULPI Wrapper.) Also, this parameter is ++ * applicable only if the OTG_HSPHY_WIDTH cC parameter was set ++ * to "8 and 16 bits", meaning that the core has been ++ * configured to work at either data path width. ++ * ++ * 8 or 16 bits (default 16) ++ */ ++ int32_t phy_utmi_width; ++ ++ /** ++ * Specifies whether the ULPI operates at double or single ++ * data rate. This parameter is only applicable if PHY_TYPE is ++ * ULPI. ++ * ++ * 0 - single data rate ULPI interface with 8 bit wide data ++ * bus (default) ++ * 1 - double data rate ULPI interface with 4 bit wide data ++ * bus ++ */ ++ int32_t phy_ulpi_ddr; ++ ++ /** ++ * Specifies whether to use the internal or external supply to ++ * drive the vbus with a ULPI phy. ++ */ ++ int32_t phy_ulpi_ext_vbus; ++ ++ /** ++ * Specifies whether to use the I2Cinterface for full speed PHY. This ++ * parameter is only applicable if PHY_TYPE is FS. ++ * 0 - No (default) ++ * 1 - Yes ++ */ ++ int32_t i2c_enable; ++ ++ int32_t ulpi_fs_ls; ++ ++ int32_t ts_dline; ++ ++ /** ++ * Specifies whether dedicated transmit FIFOs are ++ * enabled for non periodic IN endpoints in device mode ++ * 0 - No ++ * 1 - Yes ++ */ ++ int32_t en_multiple_tx_fifo; ++ ++ /** Number of 4-byte words in each of the Tx FIFOs in device ++ * mode when dynamic FIFO sizing is enabled. ++ * 4 to 768 (default 256) ++ */ ++ uint32_t dev_tx_fifo_size[MAX_TX_FIFOS]; ++ ++ /** Thresholding enable flag- ++ * bit 0 - enable non-ISO Tx thresholding ++ * bit 1 - enable ISO Tx thresholding ++ * bit 2 - enable Rx thresholding ++ */ ++ uint32_t thr_ctl; ++ ++ /** Thresholding length for Tx ++ * FIFOs in 32 bit DWORDs ++ */ ++ uint32_t tx_thr_length; ++ ++ /** Thresholding length for Rx ++ * FIFOs in 32 bit DWORDs ++ */ ++ uint32_t rx_thr_length; ++ ++ /** ++ * Specifies whether LPM (Link Power Management) support is enabled ++ */ ++ int32_t lpm_enable; ++ ++ /** Per Transfer Interrupt ++ * mode enable flag ++ * 1 - Enabled ++ * 0 - Disabled ++ */ ++ int32_t pti_enable; ++ ++ /** Multi Processor Interrupt ++ * mode enable flag ++ * 1 - Enabled ++ * 0 - Disabled ++ */ ++ int32_t mpi_enable; ++ ++ /** IS_USB Capability ++ * 1 - Enabled ++ * 0 - Disabled ++ */ ++ int32_t ic_usb_cap; ++ ++ /** AHB Threshold Ratio ++ * 2'b00 AHB Threshold = MAC Threshold ++ * 2'b01 AHB Threshold = 1/2 MAC Threshold ++ * 2'b10 AHB Threshold = 1/4 MAC Threshold ++ * 2'b11 AHB Threshold = 1/8 MAC Threshold ++ */ ++ int32_t ahb_thr_ratio; ++ ++ /** ADP Support ++ * 1 - Enabled ++ * 0 - Disabled ++ */ ++ int32_t adp_supp_enable; ++ ++ /** HFIR Reload Control ++ * 0 - The HFIR cannot be reloaded dynamically. ++ * 1 - Allow dynamic reloading of the HFIR register during runtime. ++ */ ++ int32_t reload_ctl; ++ ++ /** DCFG: Enable device Out NAK ++ * 0 - The core does not set NAK after Bulk Out transfer complete. ++ * 1 - The core sets NAK after Bulk OUT transfer complete. ++ */ ++ int32_t dev_out_nak; ++ ++ /** DCFG: Enable Continue on BNA ++ * After receiving BNA interrupt the core disables the endpoint,when the ++ * endpoint is re-enabled by the application the core starts processing ++ * 0 - from the DOEPDMA descriptor ++ * 1 - from the descriptor which received the BNA. ++ */ ++ int32_t cont_on_bna; ++ ++ /** GAHBCFG: AHB Single Support ++ * This bit when programmed supports SINGLE transfers for remainder ++ * data in a transfer for DMA mode of operation. ++ * 0 - in this case the remainder data will be sent using INCR burst size. ++ * 1 - in this case the remainder data will be sent using SINGLE burst size. ++ */ ++ int32_t ahb_single; ++ ++ /** Core Power down mode ++ * 0 - No Power Down is enabled ++ * 1 - Reserved ++ * 2 - Complete Power Down (Hibernation) ++ */ ++ int32_t power_down; ++ ++ /** OTG revision supported ++ * 0 - OTG 1.3 revision ++ * 1 - OTG 2.0 revision ++ */ ++ int32_t otg_ver; ++ ++} dwc_otg_core_params_t; ++ ++#ifdef DEBUG ++struct dwc_otg_core_if; ++typedef struct hc_xfer_info { ++ struct dwc_otg_core_if *core_if; ++ dwc_hc_t *hc; ++} hc_xfer_info_t; ++#endif ++ ++typedef struct ep_xfer_info { ++ struct dwc_otg_core_if *core_if; ++ dwc_ep_t *ep; ++ uint8_t state; ++} ep_xfer_info_t; ++/* ++ * Device States ++ */ ++typedef enum dwc_otg_lx_state { ++ /** On state */ ++ DWC_OTG_L0, ++ /** LPM sleep state*/ ++ DWC_OTG_L1, ++ /** USB suspend state*/ ++ DWC_OTG_L2, ++ /** Off state*/ ++ DWC_OTG_L3 ++} dwc_otg_lx_state_e; ++ ++struct dwc_otg_global_regs_backup { ++ uint32_t gotgctl_local; ++ uint32_t gintmsk_local; ++ uint32_t gahbcfg_local; ++ uint32_t gusbcfg_local; ++ uint32_t grxfsiz_local; ++ uint32_t gnptxfsiz_local; ++#ifdef CONFIG_USB_DWC_OTG_LPM ++ uint32_t glpmcfg_local; ++#endif ++ uint32_t gi2cctl_local; ++ uint32_t hptxfsiz_local; ++ uint32_t pcgcctl_local; ++ uint32_t gdfifocfg_local; ++ uint32_t dtxfsiz_local[MAX_EPS_CHANNELS]; ++ uint32_t gpwrdn_local; ++ uint32_t xhib_pcgcctl; ++ uint32_t xhib_gpwrdn; ++}; ++ ++struct dwc_otg_host_regs_backup { ++ uint32_t hcfg_local; ++ uint32_t haintmsk_local; ++ uint32_t hcintmsk_local[MAX_EPS_CHANNELS]; ++ uint32_t hprt0_local; ++ uint32_t hfir_local; ++}; ++ ++struct dwc_otg_dev_regs_backup { ++ uint32_t dcfg; ++ uint32_t dctl; ++ uint32_t daintmsk; ++ uint32_t diepmsk; ++ uint32_t doepmsk; ++ uint32_t diepctl[MAX_EPS_CHANNELS]; ++ uint32_t dieptsiz[MAX_EPS_CHANNELS]; ++ uint32_t diepdma[MAX_EPS_CHANNELS]; ++}; ++/** ++ * The <code>dwc_otg_core_if</code> structure contains information needed to manage ++ * the DWC_otg controller acting in either host or device mode. It ++ * represents the programming view of the controller as a whole. ++ */ ++struct dwc_otg_core_if { ++ /** Parameters that define how the core should be configured.*/ ++ dwc_otg_core_params_t *core_params; ++ ++ /** Core Global registers starting at offset 000h. */ ++ dwc_otg_core_global_regs_t *core_global_regs; ++ ++ /** Device-specific information */ ++ dwc_otg_dev_if_t *dev_if; ++ /** Host-specific information */ ++ dwc_otg_host_if_t *host_if; ++ ++ /** Value from SNPSID register */ ++ uint32_t snpsid; ++ ++ /* ++ * Set to 1 if the core PHY interface bits in USBCFG have been ++ * initialized. ++ */ ++ uint8_t phy_init_done; ++ ++ /* ++ * SRP Success flag, set by srp success interrupt in FS I2C mode ++ */ ++ uint8_t srp_success; ++ uint8_t srp_timer_started; ++ /** Timer for SRP. If it expires before SRP is successful ++ * clear the SRP. */ ++ dwc_timer_t *srp_timer; ++ ++#ifdef DWC_DEV_SRPCAP ++ /* This timer is needed to power on the hibernated host core if SRP is not ++ * initiated on connected SRP capable device for limited period of time ++ */ ++ uint8_t pwron_timer_started; ++ dwc_timer_t *pwron_timer; ++#endif ++ /* Common configuration information */ ++ /** Power and Clock Gating Control Register */ ++ volatile uint32_t *pcgcctl; ++#define DWC_OTG_PCGCCTL_OFFSET 0xE00 ++ ++ /** Push/pop addresses for endpoints or host channels.*/ ++ uint32_t *data_fifo[MAX_EPS_CHANNELS]; ++#define DWC_OTG_DATA_FIFO_OFFSET 0x1000 ++#define DWC_OTG_DATA_FIFO_SIZE 0x1000 ++ ++ /** Total RAM for FIFOs (Bytes) */ ++ uint16_t total_fifo_size; ++ /** Size of Rx FIFO (Bytes) */ ++ uint16_t rx_fifo_size; ++ /** Size of Non-periodic Tx FIFO (Bytes) */ ++ uint16_t nperio_tx_fifo_size; ++ ++ /** 1 if DMA is enabled, 0 otherwise. */ ++ uint8_t dma_enable; ++ ++ /** 1 if DMA descriptor is enabled, 0 otherwise. */ ++ uint8_t dma_desc_enable; ++ ++ /** 1 if PTI Enhancement mode is enabled, 0 otherwise. */ ++ uint8_t pti_enh_enable; ++ ++ /** 1 if MPI Enhancement mode is enabled, 0 otherwise. */ ++ uint8_t multiproc_int_enable; ++ ++ /** 1 if dedicated Tx FIFOs are enabled, 0 otherwise. */ ++ uint8_t en_multiple_tx_fifo; ++ ++ /** Set to 1 if multiple packets of a high-bandwidth transfer is in ++ * process of being queued */ ++ uint8_t queuing_high_bandwidth; ++ ++ /** Hardware Configuration -- stored here for convenience.*/ ++ hwcfg1_data_t hwcfg1; ++ hwcfg2_data_t hwcfg2; ++ hwcfg3_data_t hwcfg3; ++ hwcfg4_data_t hwcfg4; ++ fifosize_data_t hptxfsiz; ++ ++ /** Host and Device Configuration -- stored here for convenience.*/ ++ hcfg_data_t hcfg; ++ dcfg_data_t dcfg; ++ ++ /** The operational State, during transations ++ * (a_host>>a_peripherial and b_device=>b_host) this may not ++ * match the core but allows the software to determine ++ * transitions. ++ */ ++ uint8_t op_state; ++ ++ /** ++ * Set to 1 if the HCD needs to be restarted on a session request ++ * interrupt. This is required if no connector ID status change has ++ * occurred since the HCD was last disconnected. ++ */ ++ uint8_t restart_hcd_on_session_req; ++ ++ /** HCD callbacks */ ++ /** A-Device is a_host */ ++#define A_HOST (1) ++ /** A-Device is a_suspend */ ++#define A_SUSPEND (2) ++ /** A-Device is a_peripherial */ ++#define A_PERIPHERAL (3) ++ /** B-Device is operating as a Peripheral. */ ++#define B_PERIPHERAL (4) ++ /** B-Device is operating as a Host. */ ++#define B_HOST (5) ++ ++ /** HCD callbacks */ ++ struct dwc_otg_cil_callbacks *hcd_cb; ++ /** PCD callbacks */ ++ struct dwc_otg_cil_callbacks *pcd_cb; ++ ++ /** Device mode Periodic Tx FIFO Mask */ ++ uint32_t p_tx_msk; ++ /** Device mode Periodic Tx FIFO Mask */ ++ uint32_t tx_msk; ++ ++ /** Workqueue object used for handling several interrupts */ ++ dwc_workq_t *wq_otg; ++ ++ /** Timer object used for handling "Wakeup Detected" Interrupt */ ++ dwc_timer_t *wkp_timer; ++ /** This arrays used for debug purposes for DEV OUT NAK enhancement */ ++ uint32_t start_doeptsiz_val[MAX_EPS_CHANNELS]; ++ ep_xfer_info_t ep_xfer_info[MAX_EPS_CHANNELS]; ++ dwc_timer_t *ep_xfer_timer[MAX_EPS_CHANNELS]; ++#ifdef DEBUG ++ uint32_t start_hcchar_val[MAX_EPS_CHANNELS]; ++ ++ hc_xfer_info_t hc_xfer_info[MAX_EPS_CHANNELS]; ++ dwc_timer_t *hc_xfer_timer[MAX_EPS_CHANNELS]; ++ ++ uint32_t hfnum_7_samples; ++ uint64_t hfnum_7_frrem_accum; ++ uint32_t hfnum_0_samples; ++ uint64_t hfnum_0_frrem_accum; ++ uint32_t hfnum_other_samples; ++ uint64_t hfnum_other_frrem_accum; ++#endif ++ ++#ifdef DWC_UTE_CFI ++ uint16_t pwron_rxfsiz; ++ uint16_t pwron_gnptxfsiz; ++ uint16_t pwron_txfsiz[15]; ++ ++ uint16_t init_rxfsiz; ++ uint16_t init_gnptxfsiz; ++ uint16_t init_txfsiz[15]; ++#endif ++ ++ /** Lx state of device */ ++ dwc_otg_lx_state_e lx_state; ++ ++ /** Saved Core Global registers */ ++ struct dwc_otg_global_regs_backup *gr_backup; ++ /** Saved Host registers */ ++ struct dwc_otg_host_regs_backup *hr_backup; ++ /** Saved Device registers */ ++ struct dwc_otg_dev_regs_backup *dr_backup; ++ ++ /** Power Down Enable */ ++ uint32_t power_down; ++ ++ /** ADP support Enable */ ++ uint32_t adp_enable; ++ ++ /** ADP structure object */ ++ dwc_otg_adp_t adp; ++ ++ /** hibernation/suspend flag */ ++ int hibernation_suspend; ++ ++ /** Device mode extended hibernation flag */ ++ int xhib; ++ ++ /** OTG revision supported */ ++ uint32_t otg_ver; ++ ++ /** OTG status flag used for HNP polling */ ++ uint8_t otg_sts; ++ ++ /** Pointer to either hcd->lock or pcd->lock */ ++ dwc_spinlock_t *lock; ++ ++ /** Start predict NextEP based on Learning Queue if equal 1, ++ * also used as counter of disabled NP IN EP's */ ++ uint8_t start_predict; ++ ++ /** NextEp sequence, including EP0: nextep_seq[] = EP if non-periodic and ++ * active, 0xff otherwise */ ++ uint8_t nextep_seq[MAX_EPS_CHANNELS]; ++ ++ /** Index of fisrt EP in nextep_seq array which should be re-enabled **/ ++ uint8_t first_in_nextep_seq; ++ ++ /** Frame number while entering to ISR - needed for ISOCs **/ ++ uint32_t frame_num; ++ ++}; ++ ++#ifdef DEBUG ++/* ++ * This function is called when transfer is timed out. ++ */ ++extern void hc_xfer_timeout(void *ptr); ++#endif ++ ++/* ++ * This function is called when transfer is timed out on endpoint. ++ */ ++extern void ep_xfer_timeout(void *ptr); ++ ++/* ++ * The following functions are functions for works ++ * using during handling some interrupts ++ */ ++extern void w_conn_id_status_change(void *p); ++ ++extern void w_wakeup_detected(void *p); ++ ++/** Saves global register values into system memory. */ ++extern int dwc_otg_save_global_regs(dwc_otg_core_if_t * core_if); ++/** Saves device register values into system memory. */ ++extern int dwc_otg_save_dev_regs(dwc_otg_core_if_t * core_if); ++/** Saves host register values into system memory. */ ++extern int dwc_otg_save_host_regs(dwc_otg_core_if_t * core_if); ++/** Restore global register values. */ ++extern int dwc_otg_restore_global_regs(dwc_otg_core_if_t * core_if); ++/** Restore host register values. */ ++extern int dwc_otg_restore_host_regs(dwc_otg_core_if_t * core_if, int reset); ++/** Restore device register values. */ ++extern int dwc_otg_restore_dev_regs(dwc_otg_core_if_t * core_if, ++ int rem_wakeup); ++extern int restore_lpm_i2c_regs(dwc_otg_core_if_t * core_if); ++extern int restore_essential_regs(dwc_otg_core_if_t * core_if, int rmode, ++ int is_host); ++ ++extern int dwc_otg_host_hibernation_restore(dwc_otg_core_if_t * core_if, ++ int restore_mode, int reset); ++extern int dwc_otg_device_hibernation_restore(dwc_otg_core_if_t * core_if, ++ int rem_wakeup, int reset); ++ ++/* ++ * The following functions support initialization of the CIL driver component ++ * and the DWC_otg controller. ++ */ ++extern void dwc_otg_core_host_init(dwc_otg_core_if_t * _core_if); ++extern void dwc_otg_core_dev_init(dwc_otg_core_if_t * _core_if); ++ ++/** @name Device CIL Functions ++ * The following functions support managing the DWC_otg controller in device ++ * mode. ++ */ ++/**@{*/ ++extern void dwc_otg_wakeup(dwc_otg_core_if_t * _core_if); ++extern void dwc_otg_read_setup_packet(dwc_otg_core_if_t * _core_if, ++ uint32_t * _dest); ++extern uint32_t dwc_otg_get_frame_number(dwc_otg_core_if_t * _core_if); ++extern void dwc_otg_ep0_activate(dwc_otg_core_if_t * _core_if, dwc_ep_t * _ep); ++extern void dwc_otg_ep_activate(dwc_otg_core_if_t * _core_if, dwc_ep_t * _ep); ++extern void dwc_otg_ep_deactivate(dwc_otg_core_if_t * _core_if, dwc_ep_t * _ep); ++extern void dwc_otg_ep_start_transfer(dwc_otg_core_if_t * _core_if, ++ dwc_ep_t * _ep); ++extern void dwc_otg_ep_start_zl_transfer(dwc_otg_core_if_t * _core_if, ++ dwc_ep_t * _ep); ++extern void dwc_otg_ep0_start_transfer(dwc_otg_core_if_t * _core_if, ++ dwc_ep_t * _ep); ++extern void dwc_otg_ep0_continue_transfer(dwc_otg_core_if_t * _core_if, ++ dwc_ep_t * _ep); ++extern void dwc_otg_ep_write_packet(dwc_otg_core_if_t * _core_if, ++ dwc_ep_t * _ep, int _dma); ++extern void dwc_otg_ep_set_stall(dwc_otg_core_if_t * _core_if, dwc_ep_t * _ep); ++extern void dwc_otg_ep_clear_stall(dwc_otg_core_if_t * _core_if, ++ dwc_ep_t * _ep); ++extern void dwc_otg_enable_device_interrupts(dwc_otg_core_if_t * _core_if); ++ ++#ifdef DWC_EN_ISOC ++extern void dwc_otg_iso_ep_start_frm_transfer(dwc_otg_core_if_t * core_if, ++ dwc_ep_t * ep); ++extern void dwc_otg_iso_ep_start_buf_transfer(dwc_otg_core_if_t * core_if, ++ dwc_ep_t * ep); ++#endif /* DWC_EN_ISOC */ ++/**@}*/ ++ ++/** @name Host CIL Functions ++ * The following functions support managing the DWC_otg controller in host ++ * mode. ++ */ ++/**@{*/ ++extern void dwc_otg_hc_init(dwc_otg_core_if_t * _core_if, dwc_hc_t * _hc); ++extern void dwc_otg_hc_halt(dwc_otg_core_if_t * _core_if, ++ dwc_hc_t * _hc, dwc_otg_halt_status_e _halt_status); ++extern void dwc_otg_hc_cleanup(dwc_otg_core_if_t * _core_if, dwc_hc_t * _hc); ++extern void dwc_otg_hc_start_transfer(dwc_otg_core_if_t * _core_if, ++ dwc_hc_t * _hc); ++extern int dwc_otg_hc_continue_transfer(dwc_otg_core_if_t * _core_if, ++ dwc_hc_t * _hc); ++extern void dwc_otg_hc_do_ping(dwc_otg_core_if_t * _core_if, dwc_hc_t * _hc); ++extern void dwc_otg_hc_write_packet(dwc_otg_core_if_t * _core_if, ++ dwc_hc_t * _hc); ++extern void dwc_otg_enable_host_interrupts(dwc_otg_core_if_t * _core_if); ++extern void dwc_otg_disable_host_interrupts(dwc_otg_core_if_t * _core_if); ++ ++extern void dwc_otg_hc_start_transfer_ddma(dwc_otg_core_if_t * core_if, ++ dwc_hc_t * hc); ++ ++extern uint32_t calc_frame_interval(dwc_otg_core_if_t * core_if); ++ ++/* Macro used to clear one channel interrupt */ ++#define clear_hc_int(_hc_regs_, _intr_) \ ++do { \ ++ hcint_data_t hcint_clear = {.d32 = 0}; \ ++ hcint_clear.b._intr_ = 1; \ ++ DWC_WRITE_REG32(&(_hc_regs_)->hcint, hcint_clear.d32); \ ++} while (0) ++ ++/* ++ * Macro used to disable one channel interrupt. Channel interrupts are ++ * disabled when the channel is halted or released by the interrupt handler. ++ * There is no need to handle further interrupts of that type until the ++ * channel is re-assigned. In fact, subsequent handling may cause crashes ++ * because the channel structures are cleaned up when the channel is released. ++ */ ++#define disable_hc_int(_hc_regs_, _intr_) \ ++do { \ ++ hcintmsk_data_t hcintmsk = {.d32 = 0}; \ ++ hcintmsk.b._intr_ = 1; \ ++ DWC_MODIFY_REG32(&(_hc_regs_)->hcintmsk, hcintmsk.d32, 0); \ ++} while (0) ++ ++/** ++ * This function Reads HPRT0 in preparation to modify. It keeps the ++ * WC bits 0 so that if they are read as 1, they won't clear when you ++ * write it back ++ */ ++static inline uint32_t dwc_otg_read_hprt0(dwc_otg_core_if_t * _core_if) ++{ ++ hprt0_data_t hprt0; ++ hprt0.d32 = DWC_READ_REG32(_core_if->host_if->hprt0); ++ hprt0.b.prtena = 0; ++ hprt0.b.prtconndet = 0; ++ hprt0.b.prtenchng = 0; ++ hprt0.b.prtovrcurrchng = 0; ++ return hprt0.d32; ++} ++ ++/**@}*/ ++ ++/** @name Common CIL Functions ++ * The following functions support managing the DWC_otg controller in either ++ * device or host mode. ++ */ ++/**@{*/ ++ ++extern void dwc_otg_read_packet(dwc_otg_core_if_t * core_if, ++ uint8_t * dest, uint16_t bytes); ++ ++extern void dwc_otg_flush_tx_fifo(dwc_otg_core_if_t * _core_if, const int _num); ++extern void dwc_otg_flush_rx_fifo(dwc_otg_core_if_t * _core_if); ++extern void dwc_otg_core_reset(dwc_otg_core_if_t * _core_if); ++ ++/** ++ * This function returns the Core Interrupt register. ++ */ ++static inline uint32_t dwc_otg_read_core_intr(dwc_otg_core_if_t * core_if) ++{ ++ return (DWC_READ_REG32(&core_if->core_global_regs->gintsts) & ++ DWC_READ_REG32(&core_if->core_global_regs->gintmsk)); ++} ++ ++/** ++ * This function returns the OTG Interrupt register. ++ */ ++static inline uint32_t dwc_otg_read_otg_intr(dwc_otg_core_if_t * core_if) ++{ ++ return (DWC_READ_REG32(&core_if->core_global_regs->gotgint)); ++} ++ ++/** ++ * This function reads the Device All Endpoints Interrupt register and ++ * returns the IN endpoint interrupt bits. ++ */ ++static inline uint32_t dwc_otg_read_dev_all_in_ep_intr(dwc_otg_core_if_t * ++ core_if) ++{ ++ ++ uint32_t v; ++ ++ if (core_if->multiproc_int_enable) { ++ v = DWC_READ_REG32(&core_if->dev_if-> ++ dev_global_regs->deachint) & ++ DWC_READ_REG32(&core_if-> ++ dev_if->dev_global_regs->deachintmsk); ++ } else { ++ v = DWC_READ_REG32(&core_if->dev_if->dev_global_regs->daint) & ++ DWC_READ_REG32(&core_if->dev_if->dev_global_regs->daintmsk); ++ } ++ return (v & 0xffff); ++} ++ ++/** ++ * This function reads the Device All Endpoints Interrupt register and ++ * returns the OUT endpoint interrupt bits. ++ */ ++static inline uint32_t dwc_otg_read_dev_all_out_ep_intr(dwc_otg_core_if_t * ++ core_if) ++{ ++ uint32_t v; ++ ++ if (core_if->multiproc_int_enable) { ++ v = DWC_READ_REG32(&core_if->dev_if-> ++ dev_global_regs->deachint) & ++ DWC_READ_REG32(&core_if-> ++ dev_if->dev_global_regs->deachintmsk); ++ } else { ++ v = DWC_READ_REG32(&core_if->dev_if->dev_global_regs->daint) & ++ DWC_READ_REG32(&core_if->dev_if->dev_global_regs->daintmsk); ++ } ++ ++ return ((v & 0xffff0000) >> 16); ++} ++ ++/** ++ * This function returns the Device IN EP Interrupt register ++ */ ++static inline uint32_t dwc_otg_read_dev_in_ep_intr(dwc_otg_core_if_t * core_if, ++ dwc_ep_t * ep) ++{ ++ dwc_otg_dev_if_t *dev_if = core_if->dev_if; ++ uint32_t v, msk, emp; ++ ++ if (core_if->multiproc_int_enable) { ++ msk = ++ DWC_READ_REG32(&dev_if-> ++ dev_global_regs->diepeachintmsk[ep->num]); ++ emp = ++ DWC_READ_REG32(&dev_if-> ++ dev_global_regs->dtknqr4_fifoemptymsk); ++ msk |= ((emp >> ep->num) & 0x1) << 7; ++ v = DWC_READ_REG32(&dev_if->in_ep_regs[ep->num]->diepint) & msk; ++ } else { ++ msk = DWC_READ_REG32(&dev_if->dev_global_regs->diepmsk); ++ emp = ++ DWC_READ_REG32(&dev_if-> ++ dev_global_regs->dtknqr4_fifoemptymsk); ++ msk |= ((emp >> ep->num) & 0x1) << 7; ++ v = DWC_READ_REG32(&dev_if->in_ep_regs[ep->num]->diepint) & msk; ++ } ++ ++ return v; ++} ++ ++/** ++ * This function returns the Device OUT EP Interrupt register ++ */ ++static inline uint32_t dwc_otg_read_dev_out_ep_intr(dwc_otg_core_if_t * ++ _core_if, dwc_ep_t * _ep) ++{ ++ dwc_otg_dev_if_t *dev_if = _core_if->dev_if; ++ uint32_t v; ++ doepmsk_data_t msk = {.d32 = 0 }; ++ ++ if (_core_if->multiproc_int_enable) { ++ msk.d32 = ++ DWC_READ_REG32(&dev_if-> ++ dev_global_regs->doepeachintmsk[_ep->num]); ++ if (_core_if->pti_enh_enable) { ++ msk.b.pktdrpsts = 1; ++ } ++ v = DWC_READ_REG32(&dev_if-> ++ out_ep_regs[_ep->num]->doepint) & msk.d32; ++ } else { ++ msk.d32 = DWC_READ_REG32(&dev_if->dev_global_regs->doepmsk); ++ if (_core_if->pti_enh_enable) { ++ msk.b.pktdrpsts = 1; ++ } ++ v = DWC_READ_REG32(&dev_if-> ++ out_ep_regs[_ep->num]->doepint) & msk.d32; ++ } ++ return v; ++} ++ ++/** ++ * This function returns the Host All Channel Interrupt register ++ */ ++static inline uint32_t dwc_otg_read_host_all_channels_intr(dwc_otg_core_if_t * ++ _core_if) ++{ ++ return (DWC_READ_REG32(&_core_if->host_if->host_global_regs->haint)); ++} ++ ++static inline uint32_t dwc_otg_read_host_channel_intr(dwc_otg_core_if_t * ++ _core_if, dwc_hc_t * _hc) ++{ ++ return (DWC_READ_REG32 ++ (&_core_if->host_if->hc_regs[_hc->hc_num]->hcint)); ++} ++ ++/** ++ * This function returns the mode of the operation, host or device. ++ * ++ * @return 0 - Device Mode, 1 - Host Mode ++ */ ++static inline uint32_t dwc_otg_mode(dwc_otg_core_if_t * _core_if) ++{ ++ return (DWC_READ_REG32(&_core_if->core_global_regs->gintsts) & 0x1); ++} ++ ++/**@}*/ ++ ++/** ++ * DWC_otg CIL callback structure. This structure allows the HCD and ++ * PCD to register functions used for starting and stopping the PCD ++ * and HCD for role change on for a DRD. ++ */ ++typedef struct dwc_otg_cil_callbacks { ++ /** Start function for role change */ ++ int (*start) (void *_p); ++ /** Stop Function for role change */ ++ int (*stop) (void *_p); ++ /** Disconnect Function for role change */ ++ int (*disconnect) (void *_p); ++ /** Resume/Remote wakeup Function */ ++ int (*resume_wakeup) (void *_p); ++ /** Suspend function */ ++ int (*suspend) (void *_p); ++ /** Session Start (SRP) */ ++ int (*session_start) (void *_p); ++#ifdef CONFIG_USB_DWC_OTG_LPM ++ /** Sleep (switch to L0 state) */ ++ int (*sleep) (void *_p); ++#endif ++ /** Pointer passed to start() and stop() */ ++ void *p; ++} dwc_otg_cil_callbacks_t; ++ ++extern void dwc_otg_cil_register_pcd_callbacks(dwc_otg_core_if_t * _core_if, ++ dwc_otg_cil_callbacks_t * _cb, ++ void *_p); ++extern void dwc_otg_cil_register_hcd_callbacks(dwc_otg_core_if_t * _core_if, ++ dwc_otg_cil_callbacks_t * _cb, ++ void *_p); ++ ++void dwc_otg_initiate_srp(dwc_otg_core_if_t * core_if); ++ ++////////////////////////////////////////////////////////////////////// ++/** Start the HCD. Helper function for using the HCD callbacks. ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ */ ++static inline void cil_hcd_start(dwc_otg_core_if_t * core_if) ++{ ++ if (core_if->hcd_cb && core_if->hcd_cb->start) { ++ core_if->hcd_cb->start(core_if->hcd_cb->p); ++ } ++} ++ ++/** Stop the HCD. Helper function for using the HCD callbacks. ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ */ ++static inline void cil_hcd_stop(dwc_otg_core_if_t * core_if) ++{ ++ if (core_if->hcd_cb && core_if->hcd_cb->stop) { ++ core_if->hcd_cb->stop(core_if->hcd_cb->p); ++ } ++} ++ ++/** Disconnect the HCD. Helper function for using the HCD callbacks. ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ */ ++static inline void cil_hcd_disconnect(dwc_otg_core_if_t * core_if) ++{ ++ if (core_if->hcd_cb && core_if->hcd_cb->disconnect) { ++ core_if->hcd_cb->disconnect(core_if->hcd_cb->p); ++ } ++} ++ ++/** Inform the HCD the a New Session has begun. Helper function for ++ * using the HCD callbacks. ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ */ ++static inline void cil_hcd_session_start(dwc_otg_core_if_t * core_if) ++{ ++ if (core_if->hcd_cb && core_if->hcd_cb->session_start) { ++ core_if->hcd_cb->session_start(core_if->hcd_cb->p); ++ } ++} ++ ++#ifdef CONFIG_USB_DWC_OTG_LPM ++/** ++ * Inform the HCD about LPM sleep. ++ * Helper function for using the HCD callbacks. ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ */ ++static inline void cil_hcd_sleep(dwc_otg_core_if_t * core_if) ++{ ++ if (core_if->hcd_cb && core_if->hcd_cb->sleep) { ++ core_if->hcd_cb->sleep(core_if->hcd_cb->p); ++ } ++} ++#endif ++ ++/** Resume the HCD. Helper function for using the HCD callbacks. ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ */ ++static inline void cil_hcd_resume(dwc_otg_core_if_t * core_if) ++{ ++ if (core_if->hcd_cb && core_if->hcd_cb->resume_wakeup) { ++ core_if->hcd_cb->resume_wakeup(core_if->hcd_cb->p); ++ } ++} ++ ++/** Start the PCD. Helper function for using the PCD callbacks. ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ */ ++static inline void cil_pcd_start(dwc_otg_core_if_t * core_if) ++{ ++ if (core_if->pcd_cb && core_if->pcd_cb->start) { ++ core_if->pcd_cb->start(core_if->pcd_cb->p); ++ } ++} ++ ++/** Stop the PCD. Helper function for using the PCD callbacks. ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ */ ++static inline void cil_pcd_stop(dwc_otg_core_if_t * core_if) ++{ ++ if (core_if->pcd_cb && core_if->pcd_cb->stop) { ++ core_if->pcd_cb->stop(core_if->pcd_cb->p); ++ } ++} ++ ++/** Suspend the PCD. Helper function for using the PCD callbacks. ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ */ ++static inline void cil_pcd_suspend(dwc_otg_core_if_t * core_if) ++{ ++ if (core_if->pcd_cb && core_if->pcd_cb->suspend) { ++ core_if->pcd_cb->suspend(core_if->pcd_cb->p); ++ } ++} ++ ++/** Resume the PCD. Helper function for using the PCD callbacks. ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ */ ++static inline void cil_pcd_resume(dwc_otg_core_if_t * core_if) ++{ ++ if (core_if->pcd_cb && core_if->pcd_cb->resume_wakeup) { ++ core_if->pcd_cb->resume_wakeup(core_if->pcd_cb->p); ++ } ++} ++ ++////////////////////////////////////////////////////////////////////// ++ ++#endif +diff --git a/drivers/usb/host/dwc_otg/dwc_otg_cil_intr.c b/drivers/usb/host/dwc_otg/dwc_otg_cil_intr.c +new file mode 100644 +index 0000000..96c76e3 +--- /dev/null ++++ b/drivers/usb/host/dwc_otg/dwc_otg_cil_intr.c +@@ -0,0 +1,1594 @@ ++/* ========================================================================== ++ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_cil_intr.c $ ++ * $Revision: #32 $ ++ * $Date: 2012/08/10 $ ++ * $Change: 2047372 $ ++ * ++ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, ++ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless ++ * otherwise expressly agreed to in writing between Synopsys and you. ++ * ++ * The Software IS NOT an item of Licensed Software or Licensed Product under ++ * any End User Software License Agreement or Agreement for Licensed Product ++ * with Synopsys or any supplement thereto. You are permitted to use and ++ * redistribute this Software in source and binary forms, with or without ++ * modification, provided that redistributions of source code must retain this ++ * notice. You may not view, use, disclose, copy or distribute this file or ++ * any information contained herein except pursuant to this license grant from ++ * Synopsys. If you do not agree with this notice, including the disclaimer ++ * below, then you are not authorized to use the Software. ++ * ++ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS ++ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS 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. ++ * ========================================================================== */ ++ ++/** @file ++ * ++ * The Core Interface Layer provides basic services for accessing and ++ * managing the DWC_otg hardware. These services are used by both the ++ * Host Controller Driver and the Peripheral Controller Driver. ++ * ++ * This file contains the Common Interrupt handlers. ++ */ ++#include "dwc_os.h" ++#include "dwc_otg_regs.h" ++#include "dwc_otg_cil.h" ++#include "dwc_otg_driver.h" ++#include "dwc_otg_pcd.h" ++#include "dwc_otg_hcd.h" ++ ++#ifdef DEBUG ++inline const char *op_state_str(dwc_otg_core_if_t * core_if) ++{ ++ return (core_if->op_state == A_HOST ? "a_host" : ++ (core_if->op_state == A_SUSPEND ? "a_suspend" : ++ (core_if->op_state == A_PERIPHERAL ? "a_peripheral" : ++ (core_if->op_state == B_PERIPHERAL ? "b_peripheral" : ++ (core_if->op_state == B_HOST ? "b_host" : "unknown"))))); ++} ++#endif ++ ++/** This function will log a debug message ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ */ ++int32_t dwc_otg_handle_mode_mismatch_intr(dwc_otg_core_if_t * core_if) ++{ ++ gintsts_data_t gintsts; ++ DWC_WARN("Mode Mismatch Interrupt: currently in %s mode\n", ++ dwc_otg_mode(core_if) ? "Host" : "Device"); ++ ++ /* Clear interrupt */ ++ gintsts.d32 = 0; ++ gintsts.b.modemismatch = 1; ++ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, gintsts.d32); ++ return 1; ++} ++ ++/** ++ * This function handles the OTG Interrupts. It reads the OTG ++ * Interrupt Register (GOTGINT) to determine what interrupt has ++ * occurred. ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ */ ++int32_t dwc_otg_handle_otg_intr(dwc_otg_core_if_t * core_if) ++{ ++ dwc_otg_core_global_regs_t *global_regs = core_if->core_global_regs; ++ gotgint_data_t gotgint; ++ gotgctl_data_t gotgctl; ++ gintmsk_data_t gintmsk; ++ gpwrdn_data_t gpwrdn; ++ ++ gotgint.d32 = DWC_READ_REG32(&global_regs->gotgint); ++ gotgctl.d32 = DWC_READ_REG32(&global_regs->gotgctl); ++ DWC_DEBUGPL(DBG_CIL, "++OTG Interrupt gotgint=%0x [%s]\n", gotgint.d32, ++ op_state_str(core_if)); ++ ++ if (gotgint.b.sesenddet) { ++ DWC_DEBUGPL(DBG_ANY, " ++OTG Interrupt: " ++ "Session End Detected++ (%s)\n", ++ op_state_str(core_if)); ++ gotgctl.d32 = DWC_READ_REG32(&global_regs->gotgctl); ++ ++ if (core_if->op_state == B_HOST) { ++ cil_pcd_start(core_if); ++ core_if->op_state = B_PERIPHERAL; ++ } else { ++ /* If not B_HOST and Device HNP still set. HNP ++ * Did not succeed!*/ ++ if (gotgctl.b.devhnpen) { ++ DWC_DEBUGPL(DBG_ANY, "Session End Detected\n"); ++ __DWC_ERROR("Device Not Connected/Responding!\n"); ++ } ++ ++ /* If Session End Detected the B-Cable has ++ * been disconnected. */ ++ /* Reset PCD and Gadget driver to a ++ * clean state. */ ++ core_if->lx_state = DWC_OTG_L0; ++ DWC_SPINUNLOCK(core_if->lock); ++ cil_pcd_stop(core_if); ++ DWC_SPINLOCK(core_if->lock); ++ ++ if (core_if->adp_enable) { ++ if (core_if->power_down == 2) { ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pwrdnswtch = 1; ++ DWC_MODIFY_REG32(&core_if-> ++ core_global_regs-> ++ gpwrdn, gpwrdn.d32, 0); ++ } ++ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pmuintsel = 1; ++ gpwrdn.b.pmuactv = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs-> ++ gpwrdn, 0, gpwrdn.d32); ++ ++ dwc_otg_adp_sense_start(core_if); ++ } ++ } ++ ++ gotgctl.d32 = 0; ++ gotgctl.b.devhnpen = 1; ++ DWC_MODIFY_REG32(&global_regs->gotgctl, gotgctl.d32, 0); ++ } ++ if (gotgint.b.sesreqsucstschng) { ++ DWC_DEBUGPL(DBG_ANY, " ++OTG Interrupt: " ++ "Session Reqeust Success Status Change++\n"); ++ gotgctl.d32 = DWC_READ_REG32(&global_regs->gotgctl); ++ if (gotgctl.b.sesreqscs) { ++ ++ if ((core_if->core_params->phy_type == ++ DWC_PHY_TYPE_PARAM_FS) && (core_if->core_params->i2c_enable)) { ++ core_if->srp_success = 1; ++ } else { ++ DWC_SPINUNLOCK(core_if->lock); ++ cil_pcd_resume(core_if); ++ DWC_SPINLOCK(core_if->lock); ++ /* Clear Session Request */ ++ gotgctl.d32 = 0; ++ gotgctl.b.sesreq = 1; ++ DWC_MODIFY_REG32(&global_regs->gotgctl, ++ gotgctl.d32, 0); ++ } ++ } ++ } ++ if (gotgint.b.hstnegsucstschng) { ++ /* Print statements during the HNP interrupt handling ++ * can cause it to fail.*/ ++ gotgctl.d32 = DWC_READ_REG32(&global_regs->gotgctl); ++ /* WA for 3.00a- HW is not setting cur_mode, even sometimes ++ * this does not help*/ ++ if (core_if->snpsid >= OTG_CORE_REV_3_00a) ++ dwc_udelay(100); ++ if (gotgctl.b.hstnegscs) { ++ if (dwc_otg_is_host_mode(core_if)) { ++ core_if->op_state = B_HOST; ++ /* ++ * Need to disable SOF interrupt immediately. ++ * When switching from device to host, the PCD ++ * interrupt handler won't handle the ++ * interrupt if host mode is already set. The ++ * HCD interrupt handler won't get called if ++ * the HCD state is HALT. This means that the ++ * interrupt does not get handled and Linux ++ * complains loudly. ++ */ ++ gintmsk.d32 = 0; ++ gintmsk.b.sofintr = 1; ++ DWC_MODIFY_REG32(&global_regs->gintmsk, ++ gintmsk.d32, 0); ++ /* Call callback function with spin lock released */ ++ DWC_SPINUNLOCK(core_if->lock); ++ cil_pcd_stop(core_if); ++ /* ++ * Initialize the Core for Host mode. ++ */ ++ cil_hcd_start(core_if); ++ DWC_SPINLOCK(core_if->lock); ++ core_if->op_state = B_HOST; ++ } ++ } else { ++ gotgctl.d32 = 0; ++ gotgctl.b.hnpreq = 1; ++ gotgctl.b.devhnpen = 1; ++ DWC_MODIFY_REG32(&global_regs->gotgctl, gotgctl.d32, 0); ++ DWC_DEBUGPL(DBG_ANY, "HNP Failed\n"); ++ __DWC_ERROR("Device Not Connected/Responding\n"); ++ } ++ } ++ if (gotgint.b.hstnegdet) { ++ /* The disconnect interrupt is set at the same time as ++ * Host Negotiation Detected. During the mode ++ * switch all interrupts are cleared so the disconnect ++ * interrupt handler will not get executed. ++ */ ++ DWC_DEBUGPL(DBG_ANY, " ++OTG Interrupt: " ++ "Host Negotiation Detected++ (%s)\n", ++ (dwc_otg_is_host_mode(core_if) ? "Host" : ++ "Device")); ++ if (dwc_otg_is_device_mode(core_if)) { ++ DWC_DEBUGPL(DBG_ANY, "a_suspend->a_peripheral (%d)\n", ++ core_if->op_state); ++ DWC_SPINUNLOCK(core_if->lock); ++ cil_hcd_disconnect(core_if); ++ cil_pcd_start(core_if); ++ DWC_SPINLOCK(core_if->lock); ++ core_if->op_state = A_PERIPHERAL; ++ } else { ++ /* ++ * Need to disable SOF interrupt immediately. When ++ * switching from device to host, the PCD interrupt ++ * handler won't handle the interrupt if host mode is ++ * already set. The HCD interrupt handler won't get ++ * called if the HCD state is HALT. This means that ++ * the interrupt does not get handled and Linux ++ * complains loudly. ++ */ ++ gintmsk.d32 = 0; ++ gintmsk.b.sofintr = 1; ++ DWC_MODIFY_REG32(&global_regs->gintmsk, gintmsk.d32, 0); ++ DWC_SPINUNLOCK(core_if->lock); ++ cil_pcd_stop(core_if); ++ cil_hcd_start(core_if); ++ DWC_SPINLOCK(core_if->lock); ++ core_if->op_state = A_HOST; ++ } ++ } ++ if (gotgint.b.adevtoutchng) { ++ DWC_DEBUGPL(DBG_ANY, " ++OTG Interrupt: " ++ "A-Device Timeout Change++\n"); ++ } ++ if (gotgint.b.debdone) { ++ DWC_DEBUGPL(DBG_ANY, " ++OTG Interrupt: " "Debounce Done++\n"); ++ } ++ ++ /* Clear GOTGINT */ ++ DWC_WRITE_REG32(&core_if->core_global_regs->gotgint, gotgint.d32); ++ ++ return 1; ++} ++ ++void w_conn_id_status_change(void *p) ++{ ++ dwc_otg_core_if_t *core_if = p; ++ uint32_t count = 0; ++ gotgctl_data_t gotgctl = {.d32 = 0 }; ++ ++ gotgctl.d32 = DWC_READ_REG32(&core_if->core_global_regs->gotgctl); ++ DWC_DEBUGPL(DBG_CIL, "gotgctl=%0x\n", gotgctl.d32); ++ DWC_DEBUGPL(DBG_CIL, "gotgctl.b.conidsts=%d\n", gotgctl.b.conidsts); ++ ++ /* B-Device connector (Device Mode) */ ++ if (gotgctl.b.conidsts) { ++ /* Wait for switch to device mode. */ ++ while (!dwc_otg_is_device_mode(core_if)) { ++ DWC_PRINTF("Waiting for Peripheral Mode, Mode=%s\n", ++ (dwc_otg_is_host_mode(core_if) ? "Host" : ++ "Peripheral")); ++ dwc_mdelay(100); ++ if (++count > 10000) ++ break; ++ } ++ DWC_ASSERT(++count < 10000, ++ "Connection id status change timed out"); ++ core_if->op_state = B_PERIPHERAL; ++ dwc_otg_core_init(core_if); ++ dwc_otg_enable_global_interrupts(core_if); ++ cil_pcd_start(core_if); ++ } else { ++ /* A-Device connector (Host Mode) */ ++ while (!dwc_otg_is_host_mode(core_if)) { ++ DWC_PRINTF("Waiting for Host Mode, Mode=%s\n", ++ (dwc_otg_is_host_mode(core_if) ? "Host" : ++ "Peripheral")); ++ dwc_mdelay(100); ++ if (++count > 10000) ++ break; ++ } ++ DWC_ASSERT(++count < 10000, ++ "Connection id status change timed out"); ++ core_if->op_state = A_HOST; ++ /* ++ * Initialize the Core for Host mode. ++ */ ++ dwc_otg_core_init(core_if); ++ dwc_otg_enable_global_interrupts(core_if); ++ cil_hcd_start(core_if); ++ } ++} ++ ++/** ++ * This function handles the Connector ID Status Change Interrupt. It ++ * reads the OTG Interrupt Register (GOTCTL) to determine whether this ++ * is a Device to Host Mode transition or a Host Mode to Device ++ * Transition. ++ * ++ * This only occurs when the cable is connected/removed from the PHY ++ * connector. ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ */ ++int32_t dwc_otg_handle_conn_id_status_change_intr(dwc_otg_core_if_t * core_if) ++{ ++ ++ /* ++ * Need to disable SOF interrupt immediately. If switching from device ++ * to host, the PCD interrupt handler won't handle the interrupt if ++ * host mode is already set. The HCD interrupt handler won't get ++ * called if the HCD state is HALT. This means that the interrupt does ++ * not get handled and Linux complains loudly. ++ */ ++ gintmsk_data_t gintmsk = {.d32 = 0 }; ++ gintsts_data_t gintsts = {.d32 = 0 }; ++ ++ gintmsk.b.sofintr = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gintmsk, gintmsk.d32, 0); ++ ++ DWC_DEBUGPL(DBG_CIL, ++ " ++Connector ID Status Change Interrupt++ (%s)\n", ++ (dwc_otg_is_host_mode(core_if) ? "Host" : "Device")); ++ ++ DWC_SPINUNLOCK(core_if->lock); ++ ++ /* ++ * Need to schedule a work, as there are possible DELAY function calls ++ * Release lock before scheduling workq as it holds spinlock during scheduling ++ */ ++ ++ DWC_WORKQ_SCHEDULE(core_if->wq_otg, w_conn_id_status_change, ++ core_if, "connection id status change"); ++ DWC_SPINLOCK(core_if->lock); ++ ++ /* Set flag and clear interrupt */ ++ gintsts.b.conidstschng = 1; ++ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, gintsts.d32); ++ ++ return 1; ++} ++ ++/** ++ * This interrupt indicates that a device is initiating the Session ++ * Request Protocol to request the host to turn on bus power so a new ++ * session can begin. The handler responds by turning on bus power. If ++ * the DWC_otg controller is in low power mode, the handler brings the ++ * controller out of low power mode before turning on bus power. ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ */ ++int32_t dwc_otg_handle_session_req_intr(dwc_otg_core_if_t * core_if) ++{ ++ gintsts_data_t gintsts; ++ ++#ifndef DWC_HOST_ONLY ++ DWC_DEBUGPL(DBG_ANY, "++Session Request Interrupt++\n"); ++ ++ if (dwc_otg_is_device_mode(core_if)) { ++ DWC_PRINTF("SRP: Device mode\n"); ++ } else { ++ hprt0_data_t hprt0; ++ DWC_PRINTF("SRP: Host mode\n"); ++ ++ /* Turn on the port power bit. */ ++ hprt0.d32 = dwc_otg_read_hprt0(core_if); ++ hprt0.b.prtpwr = 1; ++ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); ++ ++ /* Start the Connection timer. So a message can be displayed ++ * if connect does not occur within 10 seconds. */ ++ cil_hcd_session_start(core_if); ++ } ++#endif ++ ++ /* Clear interrupt */ ++ gintsts.d32 = 0; ++ gintsts.b.sessreqintr = 1; ++ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, gintsts.d32); ++ ++ return 1; ++} ++ ++void w_wakeup_detected(void *p) ++{ ++ dwc_otg_core_if_t *core_if = (dwc_otg_core_if_t *) p; ++ /* ++ * Clear the Resume after 70ms. (Need 20 ms minimum. Use 70 ms ++ * so that OPT tests pass with all PHYs). ++ */ ++ hprt0_data_t hprt0 = {.d32 = 0 }; ++#if 0 ++ pcgcctl_data_t pcgcctl = {.d32 = 0 }; ++ /* Restart the Phy Clock */ ++ pcgcctl.b.stoppclk = 1; ++ DWC_MODIFY_REG32(core_if->pcgcctl, pcgcctl.d32, 0); ++ dwc_udelay(10); ++#endif //0 ++ hprt0.d32 = dwc_otg_read_hprt0(core_if); ++ DWC_DEBUGPL(DBG_ANY, "Resume: HPRT0=%0x\n", hprt0.d32); ++// dwc_mdelay(70); ++ hprt0.b.prtres = 0; /* Resume */ ++ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); ++ DWC_DEBUGPL(DBG_ANY, "Clear Resume: HPRT0=%0x\n", ++ DWC_READ_REG32(core_if->host_if->hprt0)); ++ ++ cil_hcd_resume(core_if); ++ ++ /** Change to L0 state*/ ++ core_if->lx_state = DWC_OTG_L0; ++} ++ ++/** ++ * This interrupt indicates that the DWC_otg controller has detected a ++ * resume or remote wakeup sequence. If the DWC_otg controller is in ++ * low power mode, the handler must brings the controller out of low ++ * power mode. The controller automatically begins resume ++ * signaling. The handler schedules a time to stop resume signaling. ++ */ ++int32_t dwc_otg_handle_wakeup_detected_intr(dwc_otg_core_if_t * core_if) ++{ ++ gintsts_data_t gintsts; ++ ++ DWC_DEBUGPL(DBG_ANY, ++ "++Resume and Remote Wakeup Detected Interrupt++\n"); ++ ++ DWC_PRINTF("%s lxstate = %d\n", __func__, core_if->lx_state); ++ ++ if (dwc_otg_is_device_mode(core_if)) { ++ dctl_data_t dctl = {.d32 = 0 }; ++ DWC_DEBUGPL(DBG_PCD, "DSTS=0x%0x\n", ++ DWC_READ_REG32(&core_if->dev_if->dev_global_regs-> ++ dsts)); ++ if (core_if->lx_state == DWC_OTG_L2) { ++#ifdef PARTIAL_POWER_DOWN ++ if (core_if->hwcfg4.b.power_optimiz) { ++ pcgcctl_data_t power = {.d32 = 0 }; ++ ++ power.d32 = DWC_READ_REG32(core_if->pcgcctl); ++ DWC_DEBUGPL(DBG_CIL, "PCGCCTL=%0x\n", ++ power.d32); ++ ++ power.b.stoppclk = 0; ++ DWC_WRITE_REG32(core_if->pcgcctl, power.d32); ++ ++ power.b.pwrclmp = 0; ++ DWC_WRITE_REG32(core_if->pcgcctl, power.d32); ++ ++ power.b.rstpdwnmodule = 0; ++ DWC_WRITE_REG32(core_if->pcgcctl, power.d32); ++ } ++#endif ++ /* Clear the Remote Wakeup Signaling */ ++ dctl.b.rmtwkupsig = 1; ++ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs-> ++ dctl, dctl.d32, 0); ++ ++ DWC_SPINUNLOCK(core_if->lock); ++ if (core_if->pcd_cb && core_if->pcd_cb->resume_wakeup) { ++ core_if->pcd_cb->resume_wakeup(core_if->pcd_cb->p); ++ } ++ DWC_SPINLOCK(core_if->lock); ++ } else { ++ glpmcfg_data_t lpmcfg; ++ lpmcfg.d32 = ++ DWC_READ_REG32(&core_if->core_global_regs->glpmcfg); ++ lpmcfg.b.hird_thres &= (~(1 << 4)); ++ DWC_WRITE_REG32(&core_if->core_global_regs->glpmcfg, ++ lpmcfg.d32); ++ } ++ /** Change to L0 state*/ ++ core_if->lx_state = DWC_OTG_L0; ++ } else { ++ if (core_if->lx_state != DWC_OTG_L1) { ++ pcgcctl_data_t pcgcctl = {.d32 = 0 }; ++ ++ /* Restart the Phy Clock */ ++ pcgcctl.b.stoppclk = 1; ++ DWC_MODIFY_REG32(core_if->pcgcctl, pcgcctl.d32, 0); ++ DWC_TIMER_SCHEDULE(core_if->wkp_timer, 71); ++ } else { ++ /** Change to L0 state*/ ++ core_if->lx_state = DWC_OTG_L0; ++ } ++ } ++ ++ /* Clear interrupt */ ++ gintsts.d32 = 0; ++ gintsts.b.wkupintr = 1; ++ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, gintsts.d32); ++ ++ return 1; ++} ++ ++/** ++ * This interrupt indicates that the Wakeup Logic has detected a ++ * Device disconnect. ++ */ ++static int32_t dwc_otg_handle_pwrdn_disconnect_intr(dwc_otg_core_if_t *core_if) ++{ ++ gpwrdn_data_t gpwrdn = { .d32 = 0 }; ++ gpwrdn_data_t gpwrdn_temp = { .d32 = 0 }; ++ gpwrdn_temp.d32 = DWC_READ_REG32(&core_if->core_global_regs->gpwrdn); ++ ++ DWC_PRINTF("%s called\n", __FUNCTION__); ++ ++ if (!core_if->hibernation_suspend) { ++ DWC_PRINTF("Already exited from Hibernation\n"); ++ return 1; ++ } ++ ++ /* Switch on the voltage to the core */ ++ gpwrdn.b.pwrdnswtch = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ dwc_udelay(10); ++ ++ /* Reset the core */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pwrdnrstn = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ dwc_udelay(10); ++ ++ /* Disable power clamps*/ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pwrdnclmp = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ ++ /* Remove reset the core signal */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pwrdnrstn = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, 0, gpwrdn.d32); ++ dwc_udelay(10); ++ ++ /* Disable PMU interrupt */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pmuintsel = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ ++ core_if->hibernation_suspend = 0; ++ ++ /* Disable PMU */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pmuactv = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ dwc_udelay(10); ++ ++ if (gpwrdn_temp.b.idsts) { ++ core_if->op_state = B_PERIPHERAL; ++ dwc_otg_core_init(core_if); ++ dwc_otg_enable_global_interrupts(core_if); ++ cil_pcd_start(core_if); ++ } else { ++ core_if->op_state = A_HOST; ++ dwc_otg_core_init(core_if); ++ dwc_otg_enable_global_interrupts(core_if); ++ cil_hcd_start(core_if); ++ } ++ ++ return 1; ++} ++ ++/** ++ * This interrupt indicates that the Wakeup Logic has detected a ++ * remote wakeup sequence. ++ */ ++static int32_t dwc_otg_handle_pwrdn_wakeup_detected_intr(dwc_otg_core_if_t * core_if) ++{ ++ gpwrdn_data_t gpwrdn = {.d32 = 0 }; ++ DWC_DEBUGPL(DBG_ANY, ++ "++Powerdown Remote Wakeup Detected Interrupt++\n"); ++ ++ if (!core_if->hibernation_suspend) { ++ DWC_PRINTF("Already exited from Hibernation\n"); ++ return 1; ++ } ++ ++ gpwrdn.d32 = DWC_READ_REG32(&core_if->core_global_regs->gpwrdn); ++ if (gpwrdn.b.idsts) { // Device Mode ++ if ((core_if->power_down == 2) ++ && (core_if->hibernation_suspend == 1)) { ++ dwc_otg_device_hibernation_restore(core_if, 0, 0); ++ } ++ } else { ++ if ((core_if->power_down == 2) ++ && (core_if->hibernation_suspend == 1)) { ++ dwc_otg_host_hibernation_restore(core_if, 1, 0); ++ } ++ } ++ return 1; ++} ++ ++static int32_t dwc_otg_handle_pwrdn_idsts_change(dwc_otg_device_t *otg_dev) ++{ ++ gpwrdn_data_t gpwrdn = {.d32 = 0 }; ++ gpwrdn_data_t gpwrdn_temp = {.d32 = 0 }; ++ dwc_otg_core_if_t *core_if = otg_dev->core_if; ++ ++ DWC_DEBUGPL(DBG_ANY, "%s called\n", __FUNCTION__); ++ gpwrdn_temp.d32 = DWC_READ_REG32(&core_if->core_global_regs->gpwrdn); ++ if (core_if->power_down == 2) { ++ if (!core_if->hibernation_suspend) { ++ DWC_PRINTF("Already exited from Hibernation\n"); ++ return 1; ++ } ++ DWC_DEBUGPL(DBG_ANY, "Exit from hibernation on ID sts change\n"); ++ /* Switch on the voltage to the core */ ++ gpwrdn.b.pwrdnswtch = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ dwc_udelay(10); ++ ++ /* Reset the core */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pwrdnrstn = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ dwc_udelay(10); ++ ++ /* Disable power clamps */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pwrdnclmp = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ ++ /* Remove reset the core signal */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pwrdnrstn = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, 0, gpwrdn.d32); ++ dwc_udelay(10); ++ ++ /* Disable PMU interrupt */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pmuintsel = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ ++ /*Indicates that we are exiting from hibernation */ ++ core_if->hibernation_suspend = 0; ++ ++ /* Disable PMU */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pmuactv = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ dwc_udelay(10); ++ ++ gpwrdn.d32 = core_if->gr_backup->gpwrdn_local; ++ if (gpwrdn.b.dis_vbus == 1) { ++ gpwrdn.d32 = 0; ++ gpwrdn.b.dis_vbus = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ } ++ ++ if (gpwrdn_temp.b.idsts) { ++ core_if->op_state = B_PERIPHERAL; ++ dwc_otg_core_init(core_if); ++ dwc_otg_enable_global_interrupts(core_if); ++ cil_pcd_start(core_if); ++ } else { ++ core_if->op_state = A_HOST; ++ dwc_otg_core_init(core_if); ++ dwc_otg_enable_global_interrupts(core_if); ++ cil_hcd_start(core_if); ++ } ++ } ++ ++ if (core_if->adp_enable) { ++ uint8_t is_host = 0; ++ DWC_SPINUNLOCK(core_if->lock); ++ /* Change the core_if's lock to hcd/pcd lock depend on mode? */ ++#ifndef DWC_HOST_ONLY ++ if (gpwrdn_temp.b.idsts) ++ core_if->lock = otg_dev->pcd->lock; ++#endif ++#ifndef DWC_DEVICE_ONLY ++ if (!gpwrdn_temp.b.idsts) { ++ core_if->lock = otg_dev->hcd->lock; ++ is_host = 1; ++ } ++#endif ++ DWC_PRINTF("RESTART ADP\n"); ++ if (core_if->adp.probe_enabled) ++ dwc_otg_adp_probe_stop(core_if); ++ if (core_if->adp.sense_enabled) ++ dwc_otg_adp_sense_stop(core_if); ++ if (core_if->adp.sense_timer_started) ++ DWC_TIMER_CANCEL(core_if->adp.sense_timer); ++ if (core_if->adp.vbuson_timer_started) ++ DWC_TIMER_CANCEL(core_if->adp.vbuson_timer); ++ core_if->adp.probe_timer_values[0] = -1; ++ core_if->adp.probe_timer_values[1] = -1; ++ core_if->adp.sense_timer_started = 0; ++ core_if->adp.vbuson_timer_started = 0; ++ core_if->adp.probe_counter = 0; ++ core_if->adp.gpwrdn = 0; ++ ++ /* Disable PMU and restart ADP */ ++ gpwrdn_temp.d32 = 0; ++ gpwrdn_temp.b.pmuactv = 1; ++ gpwrdn_temp.b.pmuintsel = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ DWC_PRINTF("Check point 1\n"); ++ dwc_mdelay(110); ++ dwc_otg_adp_start(core_if, is_host); ++ DWC_SPINLOCK(core_if->lock); ++ } ++ ++ ++ return 1; ++} ++ ++static int32_t dwc_otg_handle_pwrdn_session_change(dwc_otg_core_if_t * core_if) ++{ ++ gpwrdn_data_t gpwrdn = {.d32 = 0 }; ++ int32_t otg_cap_param = core_if->core_params->otg_cap; ++ DWC_DEBUGPL(DBG_ANY, "%s called\n", __FUNCTION__); ++ ++ gpwrdn.d32 = DWC_READ_REG32(&core_if->core_global_regs->gpwrdn); ++ if (core_if->power_down == 2) { ++ if (!core_if->hibernation_suspend) { ++ DWC_PRINTF("Already exited from Hibernation\n"); ++ return 1; ++ } ++ ++ if ((otg_cap_param != DWC_OTG_CAP_PARAM_HNP_SRP_CAPABLE || ++ otg_cap_param != DWC_OTG_CAP_PARAM_SRP_ONLY_CAPABLE) && ++ gpwrdn.b.bsessvld == 0) { ++ /* Save gpwrdn register for further usage if stschng interrupt */ ++ core_if->gr_backup->gpwrdn_local = ++ DWC_READ_REG32(&core_if->core_global_regs->gpwrdn); ++ /*Exit from ISR and wait for stschng interrupt with bsessvld = 1 */ ++ return 1; ++ } ++ ++ /* Switch on the voltage to the core */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pwrdnswtch = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ dwc_udelay(10); ++ ++ /* Reset the core */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pwrdnrstn = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ dwc_udelay(10); ++ ++ /* Disable power clamps */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pwrdnclmp = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ ++ /* Remove reset the core signal */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pwrdnrstn = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, 0, gpwrdn.d32); ++ dwc_udelay(10); ++ ++ /* Disable PMU interrupt */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pmuintsel = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ dwc_udelay(10); ++ ++ /*Indicates that we are exiting from hibernation */ ++ core_if->hibernation_suspend = 0; ++ ++ /* Disable PMU */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pmuactv = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ dwc_udelay(10); ++ ++ core_if->op_state = B_PERIPHERAL; ++ dwc_otg_core_init(core_if); ++ dwc_otg_enable_global_interrupts(core_if); ++ cil_pcd_start(core_if); ++ ++ if (otg_cap_param == DWC_OTG_CAP_PARAM_HNP_SRP_CAPABLE || ++ otg_cap_param == DWC_OTG_CAP_PARAM_SRP_ONLY_CAPABLE) { ++ /* ++ * Initiate SRP after initial ADP probe. ++ */ ++ dwc_otg_initiate_srp(core_if); ++ } ++ } ++ ++ return 1; ++} ++/** ++ * This interrupt indicates that the Wakeup Logic has detected a ++ * status change either on IDDIG or BSessVld. ++ */ ++static uint32_t dwc_otg_handle_pwrdn_stschng_intr(dwc_otg_device_t *otg_dev) ++{ ++ int retval; ++ gpwrdn_data_t gpwrdn = {.d32 = 0 }; ++ gpwrdn_data_t gpwrdn_temp = {.d32 = 0 }; ++ dwc_otg_core_if_t *core_if = otg_dev->core_if; ++ ++ DWC_PRINTF("%s called\n", __FUNCTION__); ++ ++ if (core_if->power_down == 2) { ++ if (core_if->hibernation_suspend <= 0) { ++ DWC_PRINTF("Already exited from Hibernation\n"); ++ return 1; ++ } else ++ gpwrdn_temp.d32 = core_if->gr_backup->gpwrdn_local; ++ ++ } else { ++ gpwrdn_temp.d32 = core_if->adp.gpwrdn; ++ } ++ ++ gpwrdn.d32 = DWC_READ_REG32(&core_if->core_global_regs->gpwrdn); ++ ++ if (gpwrdn.b.idsts ^ gpwrdn_temp.b.idsts) { ++ retval = dwc_otg_handle_pwrdn_idsts_change(otg_dev); ++ } else if (gpwrdn.b.bsessvld ^ gpwrdn_temp.b.bsessvld) { ++ retval = dwc_otg_handle_pwrdn_session_change(core_if); ++ } ++ ++ return retval; ++} ++ ++/** ++ * This interrupt indicates that the Wakeup Logic has detected a ++ * SRP. ++ */ ++static int32_t dwc_otg_handle_pwrdn_srp_intr(dwc_otg_core_if_t * core_if) ++{ ++ gpwrdn_data_t gpwrdn = {.d32 = 0 }; ++ ++ DWC_PRINTF("%s called\n", __FUNCTION__); ++ ++ if (!core_if->hibernation_suspend) { ++ DWC_PRINTF("Already exited from Hibernation\n"); ++ return 1; ++ } ++#ifdef DWC_DEV_SRPCAP ++ if (core_if->pwron_timer_started) { ++ core_if->pwron_timer_started = 0; ++ DWC_TIMER_CANCEL(core_if->pwron_timer); ++ } ++#endif ++ ++ /* Switch on the voltage to the core */ ++ gpwrdn.b.pwrdnswtch = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ dwc_udelay(10); ++ ++ /* Reset the core */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pwrdnrstn = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ dwc_udelay(10); ++ ++ /* Disable power clamps */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pwrdnclmp = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ ++ /* Remove reset the core signal */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pwrdnrstn = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, 0, gpwrdn.d32); ++ dwc_udelay(10); ++ ++ /* Disable PMU interrupt */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pmuintsel = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ ++ /* Indicates that we are exiting from hibernation */ ++ core_if->hibernation_suspend = 0; ++ ++ /* Disable PMU */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pmuactv = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ dwc_udelay(10); ++ ++ /* Programm Disable VBUS to 0 */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.dis_vbus = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ ++ /*Initialize the core as Host */ ++ core_if->op_state = A_HOST; ++ dwc_otg_core_init(core_if); ++ dwc_otg_enable_global_interrupts(core_if); ++ cil_hcd_start(core_if); ++ ++ return 1; ++} ++ ++/** This interrupt indicates that restore command after Hibernation ++ * was completed by the core. */ ++int32_t dwc_otg_handle_restore_done_intr(dwc_otg_core_if_t * core_if) ++{ ++ pcgcctl_data_t pcgcctl; ++ DWC_DEBUGPL(DBG_ANY, "++Restore Done Interrupt++\n"); ++ ++ //TODO De-assert restore signal. 8.a ++ pcgcctl.d32 = DWC_READ_REG32(core_if->pcgcctl); ++ if (pcgcctl.b.restoremode == 1) { ++ gintmsk_data_t gintmsk = {.d32 = 0 }; ++ /* ++ * If restore mode is Remote Wakeup, ++ * unmask Remote Wakeup interrupt. ++ */ ++ gintmsk.b.wkupintr = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gintmsk, ++ 0, gintmsk.d32); ++ } ++ ++ return 1; ++} ++ ++/** ++ * This interrupt indicates that a device has been disconnected from ++ * the root port. ++ */ ++int32_t dwc_otg_handle_disconnect_intr(dwc_otg_core_if_t * core_if) ++{ ++ gintsts_data_t gintsts; ++ ++ DWC_DEBUGPL(DBG_ANY, "++Disconnect Detected Interrupt++ (%s) %s\n", ++ (dwc_otg_is_host_mode(core_if) ? "Host" : "Device"), ++ op_state_str(core_if)); ++ ++/** @todo Consolidate this if statement. */ ++#ifndef DWC_HOST_ONLY ++ if (core_if->op_state == B_HOST) { ++ /* If in device mode Disconnect and stop the HCD, then ++ * start the PCD. */ ++ DWC_SPINUNLOCK(core_if->lock); ++ cil_hcd_disconnect(core_if); ++ cil_pcd_start(core_if); ++ DWC_SPINLOCK(core_if->lock); ++ core_if->op_state = B_PERIPHERAL; ++ } else if (dwc_otg_is_device_mode(core_if)) { ++ gotgctl_data_t gotgctl = {.d32 = 0 }; ++ gotgctl.d32 = ++ DWC_READ_REG32(&core_if->core_global_regs->gotgctl); ++ if (gotgctl.b.hstsethnpen == 1) { ++ /* Do nothing, if HNP in process the OTG ++ * interrupt "Host Negotiation Detected" ++ * interrupt will do the mode switch. ++ */ ++ } else if (gotgctl.b.devhnpen == 0) { ++ /* If in device mode Disconnect and stop the HCD, then ++ * start the PCD. */ ++ DWC_SPINUNLOCK(core_if->lock); ++ cil_hcd_disconnect(core_if); ++ cil_pcd_start(core_if); ++ DWC_SPINLOCK(core_if->lock); ++ core_if->op_state = B_PERIPHERAL; ++ } else { ++ DWC_DEBUGPL(DBG_ANY, "!a_peripheral && !devhnpen\n"); ++ } ++ } else { ++ if (core_if->op_state == A_HOST) { ++ /* A-Cable still connected but device disconnected. */ ++ cil_hcd_disconnect(core_if); ++ if (core_if->adp_enable) { ++ gpwrdn_data_t gpwrdn = { .d32 = 0 }; ++ cil_hcd_stop(core_if); ++ /* Enable Power Down Logic */ ++ gpwrdn.b.pmuintsel = 1; ++ gpwrdn.b.pmuactv = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs-> ++ gpwrdn, 0, gpwrdn.d32); ++ dwc_otg_adp_probe_start(core_if); ++ ++ /* Power off the core */ ++ if (core_if->power_down == 2) { ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pwrdnswtch = 1; ++ DWC_MODIFY_REG32 ++ (&core_if->core_global_regs->gpwrdn, ++ gpwrdn.d32, 0); ++ } ++ } ++ } ++ } ++#endif ++ /* Change to L3(OFF) state */ ++ core_if->lx_state = DWC_OTG_L3; ++ ++ gintsts.d32 = 0; ++ gintsts.b.disconnect = 1; ++ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, gintsts.d32); ++ return 1; ++} ++ ++/** ++ * This interrupt indicates that SUSPEND state has been detected on ++ * the USB. ++ * ++ * For HNP the USB Suspend interrupt signals the change from ++ * "a_peripheral" to "a_host". ++ * ++ * When power management is enabled the core will be put in low power ++ * mode. ++ */ ++int32_t dwc_otg_handle_usb_suspend_intr(dwc_otg_core_if_t * core_if) ++{ ++ dsts_data_t dsts; ++ gintsts_data_t gintsts; ++ dcfg_data_t dcfg; ++ ++ DWC_DEBUGPL(DBG_ANY, "USB SUSPEND\n"); ++ ++ if (dwc_otg_is_device_mode(core_if)) { ++ /* Check the Device status register to determine if the Suspend ++ * state is active. */ ++ dsts.d32 = ++ DWC_READ_REG32(&core_if->dev_if->dev_global_regs->dsts); ++ DWC_DEBUGPL(DBG_PCD, "DSTS=0x%0x\n", dsts.d32); ++ DWC_DEBUGPL(DBG_PCD, "DSTS.Suspend Status=%d " ++ "HWCFG4.power Optimize=%d\n", ++ dsts.b.suspsts, core_if->hwcfg4.b.power_optimiz); ++ ++#ifdef PARTIAL_POWER_DOWN ++/** @todo Add a module parameter for power management. */ ++ ++ if (dsts.b.suspsts && core_if->hwcfg4.b.power_optimiz) { ++ pcgcctl_data_t power = {.d32 = 0 }; ++ DWC_DEBUGPL(DBG_CIL, "suspend\n"); ++ ++ power.b.pwrclmp = 1; ++ DWC_WRITE_REG32(core_if->pcgcctl, power.d32); ++ ++ power.b.rstpdwnmodule = 1; ++ DWC_MODIFY_REG32(core_if->pcgcctl, 0, power.d32); ++ ++ power.b.stoppclk = 1; ++ DWC_MODIFY_REG32(core_if->pcgcctl, 0, power.d32); ++ ++ } else { ++ DWC_DEBUGPL(DBG_ANY, "disconnect?\n"); ++ } ++#endif ++ /* PCD callback for suspend. Release the lock inside of callback function */ ++ cil_pcd_suspend(core_if); ++ if (core_if->power_down == 2) ++ { ++ dcfg.d32 = DWC_READ_REG32(&core_if->dev_if->dev_global_regs->dcfg); ++ DWC_DEBUGPL(DBG_ANY,"lx_state = %08x\n",core_if->lx_state); ++ DWC_DEBUGPL(DBG_ANY," device address = %08d\n",dcfg.b.devaddr); ++ ++ if (core_if->lx_state != DWC_OTG_L3 && dcfg.b.devaddr) { ++ pcgcctl_data_t pcgcctl = {.d32 = 0 }; ++ gpwrdn_data_t gpwrdn = {.d32 = 0 }; ++ gusbcfg_data_t gusbcfg = {.d32 = 0 }; ++ ++ /* Change to L2(suspend) state */ ++ core_if->lx_state = DWC_OTG_L2; ++ ++ /* Clear interrupt in gintsts */ ++ gintsts.d32 = 0; ++ gintsts.b.usbsuspend = 1; ++ DWC_WRITE_REG32(&core_if->core_global_regs-> ++ gintsts, gintsts.d32); ++ DWC_PRINTF("Start of hibernation completed\n"); ++ dwc_otg_save_global_regs(core_if); ++ dwc_otg_save_dev_regs(core_if); ++ ++ gusbcfg.d32 = ++ DWC_READ_REG32(&core_if->core_global_regs-> ++ gusbcfg); ++ if (gusbcfg.b.ulpi_utmi_sel == 1) { ++ /* ULPI interface */ ++ /* Suspend the Phy Clock */ ++ pcgcctl.d32 = 0; ++ pcgcctl.b.stoppclk = 1; ++ DWC_MODIFY_REG32(core_if->pcgcctl, 0, ++ pcgcctl.d32); ++ dwc_udelay(10); ++ gpwrdn.b.pmuactv = 1; ++ DWC_MODIFY_REG32(&core_if-> ++ core_global_regs-> ++ gpwrdn, 0, gpwrdn.d32); ++ } else { ++ /* UTMI+ Interface */ ++ gpwrdn.b.pmuactv = 1; ++ DWC_MODIFY_REG32(&core_if-> ++ core_global_regs-> ++ gpwrdn, 0, gpwrdn.d32); ++ dwc_udelay(10); ++ pcgcctl.b.stoppclk = 1; ++ DWC_MODIFY_REG32(core_if->pcgcctl, 0, ++ pcgcctl.d32); ++ dwc_udelay(10); ++ } ++ ++ /* Set flag to indicate that we are in hibernation */ ++ core_if->hibernation_suspend = 1; ++ /* Enable interrupts from wake up logic */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pmuintsel = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs-> ++ gpwrdn, 0, gpwrdn.d32); ++ dwc_udelay(10); ++ ++ /* Unmask device mode interrupts in GPWRDN */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.rst_det_msk = 1; ++ gpwrdn.b.lnstchng_msk = 1; ++ gpwrdn.b.sts_chngint_msk = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs-> ++ gpwrdn, 0, gpwrdn.d32); ++ dwc_udelay(10); ++ ++ /* Enable Power Down Clamp */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pwrdnclmp = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs-> ++ gpwrdn, 0, gpwrdn.d32); ++ dwc_udelay(10); ++ ++ /* Switch off VDD */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pwrdnswtch = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs-> ++ gpwrdn, 0, gpwrdn.d32); ++ ++ /* Save gpwrdn register for further usage if stschng interrupt */ ++ core_if->gr_backup->gpwrdn_local = ++ DWC_READ_REG32(&core_if->core_global_regs->gpwrdn); ++ DWC_PRINTF("Hibernation completed\n"); ++ ++ return 1; ++ } ++ } else if (core_if->power_down == 3) { ++ pcgcctl_data_t pcgcctl = {.d32 = 0 }; ++ dcfg.d32 = DWC_READ_REG32(&core_if->dev_if->dev_global_regs->dcfg); ++ DWC_DEBUGPL(DBG_ANY, "lx_state = %08x\n",core_if->lx_state); ++ DWC_DEBUGPL(DBG_ANY, " device address = %08d\n",dcfg.b.devaddr); ++ ++ if (core_if->lx_state != DWC_OTG_L3 && dcfg.b.devaddr) { ++ DWC_DEBUGPL(DBG_ANY, "Start entering to extended hibernation\n"); ++ core_if->xhib = 1; ++ ++ /* Clear interrupt in gintsts */ ++ gintsts.d32 = 0; ++ gintsts.b.usbsuspend = 1; ++ DWC_WRITE_REG32(&core_if->core_global_regs-> ++ gintsts, gintsts.d32); ++ ++ dwc_otg_save_global_regs(core_if); ++ dwc_otg_save_dev_regs(core_if); ++ ++ /* Wait for 10 PHY clocks */ ++ dwc_udelay(10); ++ ++ /* Program GPIO register while entering to xHib */ ++ DWC_WRITE_REG32(&core_if->core_global_regs->ggpio, 0x1); ++ ++ pcgcctl.b.enbl_extnd_hiber = 1; ++ DWC_MODIFY_REG32(core_if->pcgcctl, 0, pcgcctl.d32); ++ DWC_MODIFY_REG32(core_if->pcgcctl, 0, pcgcctl.d32); ++ ++ pcgcctl.d32 = 0; ++ pcgcctl.b.extnd_hiber_pwrclmp = 1; ++ DWC_MODIFY_REG32(core_if->pcgcctl, 0, pcgcctl.d32); ++ ++ pcgcctl.d32 = 0; ++ pcgcctl.b.extnd_hiber_switch = 1; ++ core_if->gr_backup->xhib_gpwrdn = DWC_READ_REG32(&core_if->core_global_regs->gpwrdn); ++ core_if->gr_backup->xhib_pcgcctl = DWC_READ_REG32(core_if->pcgcctl) | pcgcctl.d32; ++ DWC_MODIFY_REG32(core_if->pcgcctl, 0, pcgcctl.d32); ++ ++ DWC_DEBUGPL(DBG_ANY, "Finished entering to extended hibernation\n"); ++ ++ return 1; ++ } ++ } ++ } else { ++ if (core_if->op_state == A_PERIPHERAL) { ++ DWC_DEBUGPL(DBG_ANY, "a_peripheral->a_host\n"); ++ /* Clear the a_peripheral flag, back to a_host. */ ++ DWC_SPINUNLOCK(core_if->lock); ++ cil_pcd_stop(core_if); ++ cil_hcd_start(core_if); ++ DWC_SPINLOCK(core_if->lock); ++ core_if->op_state = A_HOST; ++ } ++ } ++ ++ /* Change to L2(suspend) state */ ++ core_if->lx_state = DWC_OTG_L2; ++ ++ /* Clear interrupt */ ++ gintsts.d32 = 0; ++ gintsts.b.usbsuspend = 1; ++ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, gintsts.d32); ++ ++ return 1; ++} ++ ++static int32_t dwc_otg_handle_xhib_exit_intr(dwc_otg_core_if_t * core_if) ++{ ++ gpwrdn_data_t gpwrdn = {.d32 = 0 }; ++ pcgcctl_data_t pcgcctl = {.d32 = 0 }; ++ gahbcfg_data_t gahbcfg = {.d32 = 0 }; ++ ++ dwc_udelay(10); ++ ++ /* Program GPIO register while entering to xHib */ ++ DWC_WRITE_REG32(&core_if->core_global_regs->ggpio, 0x0); ++ ++ pcgcctl.d32 = core_if->gr_backup->xhib_pcgcctl; ++ pcgcctl.b.extnd_hiber_pwrclmp = 0; ++ DWC_WRITE_REG32(core_if->pcgcctl, pcgcctl.d32); ++ dwc_udelay(10); ++ ++ gpwrdn.d32 = core_if->gr_backup->xhib_gpwrdn; ++ gpwrdn.b.restore = 1; ++ DWC_WRITE_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32); ++ dwc_udelay(10); ++ ++ restore_lpm_i2c_regs(core_if); ++ ++ pcgcctl.d32 = core_if->gr_backup->pcgcctl_local & (0x3FFFF << 14); ++ pcgcctl.b.max_xcvrselect = 1; ++ pcgcctl.b.ess_reg_restored = 0; ++ pcgcctl.b.extnd_hiber_switch = 0; ++ pcgcctl.b.extnd_hiber_pwrclmp = 0; ++ pcgcctl.b.enbl_extnd_hiber = 1; ++ DWC_WRITE_REG32(core_if->pcgcctl, pcgcctl.d32); ++ ++ gahbcfg.d32 = core_if->gr_backup->gahbcfg_local; ++ gahbcfg.b.glblintrmsk = 1; ++ DWC_WRITE_REG32(&core_if->core_global_regs->gahbcfg, gahbcfg.d32); ++ ++ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, 0xFFFFFFFF); ++ DWC_WRITE_REG32(&core_if->core_global_regs->gintmsk, 0x1 << 16); ++ ++ DWC_WRITE_REG32(&core_if->core_global_regs->gusbcfg, ++ core_if->gr_backup->gusbcfg_local); ++ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->dcfg, ++ core_if->dr_backup->dcfg); ++ ++ pcgcctl.d32 = 0; ++ pcgcctl.d32 = core_if->gr_backup->pcgcctl_local & (0x3FFFF << 14); ++ pcgcctl.b.max_xcvrselect = 1; ++ pcgcctl.d32 |= 0x608; ++ DWC_WRITE_REG32(core_if->pcgcctl, pcgcctl.d32); ++ dwc_udelay(10); ++ ++ pcgcctl.d32 = 0; ++ pcgcctl.d32 = core_if->gr_backup->pcgcctl_local & (0x3FFFF << 14); ++ pcgcctl.b.max_xcvrselect = 1; ++ pcgcctl.b.ess_reg_restored = 1; ++ pcgcctl.b.enbl_extnd_hiber = 1; ++ pcgcctl.b.rstpdwnmodule = 1; ++ pcgcctl.b.restoremode = 1; ++ DWC_WRITE_REG32(core_if->pcgcctl, pcgcctl.d32); ++ ++ DWC_DEBUGPL(DBG_ANY, "%s called\n", __FUNCTION__); ++ ++ return 1; ++} ++ ++#ifdef CONFIG_USB_DWC_OTG_LPM ++/** ++ * This function hadles LPM transaction received interrupt. ++ */ ++static int32_t dwc_otg_handle_lpm_intr(dwc_otg_core_if_t * core_if) ++{ ++ glpmcfg_data_t lpmcfg; ++ gintsts_data_t gintsts; ++ ++ if (!core_if->core_params->lpm_enable) { ++ DWC_PRINTF("Unexpected LPM interrupt\n"); ++ } ++ ++ lpmcfg.d32 = DWC_READ_REG32(&core_if->core_global_regs->glpmcfg); ++ DWC_PRINTF("LPM config register = 0x%08x\n", lpmcfg.d32); ++ ++ if (dwc_otg_is_host_mode(core_if)) { ++ cil_hcd_sleep(core_if); ++ } else { ++ lpmcfg.b.hird_thres |= (1 << 4); ++ DWC_WRITE_REG32(&core_if->core_global_regs->glpmcfg, ++ lpmcfg.d32); ++ } ++ ++ /* Examine prt_sleep_sts after TL1TokenTetry period max (10 us) */ ++ dwc_udelay(10); ++ lpmcfg.d32 = DWC_READ_REG32(&core_if->core_global_regs->glpmcfg); ++ if (lpmcfg.b.prt_sleep_sts) { ++ /* Save the current state */ ++ core_if->lx_state = DWC_OTG_L1; ++ } ++ ++ /* Clear interrupt */ ++ gintsts.d32 = 0; ++ gintsts.b.lpmtranrcvd = 1; ++ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, gintsts.d32); ++ return 1; ++} ++#endif /* CONFIG_USB_DWC_OTG_LPM */ ++ ++/** ++ * This function returns the Core Interrupt register. ++ */ ++static inline uint32_t dwc_otg_read_common_intr(dwc_otg_core_if_t * core_if, gintmsk_data_t *reenable_gintmsk, dwc_otg_hcd_t *hcd) ++{ ++ gahbcfg_data_t gahbcfg = {.d32 = 0 }; ++ gintsts_data_t gintsts; ++ gintmsk_data_t gintmsk; ++ gintmsk_data_t gintmsk_common = {.d32 = 0 }; ++ gintmsk_common.b.wkupintr = 1; ++ gintmsk_common.b.sessreqintr = 1; ++ gintmsk_common.b.conidstschng = 1; ++ gintmsk_common.b.otgintr = 1; ++ gintmsk_common.b.modemismatch = 1; ++ gintmsk_common.b.disconnect = 1; ++ gintmsk_common.b.usbsuspend = 1; ++#ifdef CONFIG_USB_DWC_OTG_LPM ++ gintmsk_common.b.lpmtranrcvd = 1; ++#endif ++ gintmsk_common.b.restoredone = 1; ++ if(dwc_otg_is_device_mode(core_if)) ++ { ++ /** @todo: The port interrupt occurs while in device ++ * mode. Added code to CIL to clear the interrupt for now! ++ */ ++ gintmsk_common.b.portintr = 1; ++ } ++ gintsts.d32 = DWC_READ_REG32(&core_if->core_global_regs->gintsts); ++ gintmsk.d32 = DWC_READ_REG32(&core_if->core_global_regs->gintmsk); ++ if(fiq_enable) { ++ local_fiq_disable(); ++ /* Pull in the interrupts that the FIQ has masked */ ++ gintmsk.d32 |= ~(hcd->fiq_state->gintmsk_saved.d32); ++ gintmsk.d32 |= gintmsk_common.d32; ++ /* for the upstairs function to reenable - have to read it here in case FIQ triggers again */ ++ reenable_gintmsk->d32 = gintmsk.d32; ++ local_fiq_enable(); ++ } ++ ++ gahbcfg.d32 = DWC_READ_REG32(&core_if->core_global_regs->gahbcfg); ++ ++#ifdef DEBUG ++ /* if any common interrupts set */ ++ if (gintsts.d32 & gintmsk_common.d32) { ++ DWC_DEBUGPL(DBG_ANY, "common_intr: gintsts=%08x gintmsk=%08x\n", ++ gintsts.d32, gintmsk.d32); ++ } ++#endif ++ if (!fiq_enable){ ++ if (gahbcfg.b.glblintrmsk) ++ return ((gintsts.d32 & gintmsk.d32) & gintmsk_common.d32); ++ else ++ return 0; ++ } else { ++ /* Our IRQ kicker is no longer the USB hardware, it's the MPHI interface. ++ * Can't trust the global interrupt mask bit in this case. ++ */ ++ return ((gintsts.d32 & gintmsk.d32) & gintmsk_common.d32); ++ } ++ ++} ++ ++/* MACRO for clearing interupt bits in GPWRDN register */ ++#define CLEAR_GPWRDN_INTR(__core_if,__intr) \ ++do { \ ++ gpwrdn_data_t gpwrdn = {.d32=0}; \ ++ gpwrdn.b.__intr = 1; \ ++ DWC_MODIFY_REG32(&__core_if->core_global_regs->gpwrdn, \ ++ 0, gpwrdn.d32); \ ++} while (0) ++ ++/** ++ * Common interrupt handler. ++ * ++ * The common interrupts are those that occur in both Host and Device mode. ++ * This handler handles the following interrupts: ++ * - Mode Mismatch Interrupt ++ * - Disconnect Interrupt ++ * - OTG Interrupt ++ * - Connector ID Status Change Interrupt ++ * - Session Request Interrupt. ++ * - Resume / Remote Wakeup Detected Interrupt. ++ * - LPM Transaction Received Interrupt ++ * - ADP Transaction Received Interrupt ++ * ++ */ ++int32_t dwc_otg_handle_common_intr(void *dev) ++{ ++ int retval = 0; ++ gintsts_data_t gintsts; ++ gintmsk_data_t gintmsk_reenable = { .d32 = 0 }; ++ gpwrdn_data_t gpwrdn = {.d32 = 0 }; ++ dwc_otg_device_t *otg_dev = dev; ++ dwc_otg_core_if_t *core_if = otg_dev->core_if; ++ gpwrdn.d32 = DWC_READ_REG32(&core_if->core_global_regs->gpwrdn); ++ if (dwc_otg_is_device_mode(core_if)) ++ core_if->frame_num = dwc_otg_get_frame_number(core_if); ++ ++ if (core_if->lock) ++ DWC_SPINLOCK(core_if->lock); ++ ++ if (core_if->power_down == 3 && core_if->xhib == 1) { ++ DWC_DEBUGPL(DBG_ANY, "Exiting from xHIB state\n"); ++ retval |= dwc_otg_handle_xhib_exit_intr(core_if); ++ core_if->xhib = 2; ++ if (core_if->lock) ++ DWC_SPINUNLOCK(core_if->lock); ++ ++ return retval; ++ } ++ ++ if (core_if->hibernation_suspend <= 0) { ++ /* read_common will have to poke the FIQ's saved mask. We must then clear this mask at the end ++ * of this handler - god only knows why it's done like this ++ */ ++ gintsts.d32 = dwc_otg_read_common_intr(core_if, &gintmsk_reenable, otg_dev->hcd); ++ ++ if (gintsts.b.modemismatch) { ++ retval |= dwc_otg_handle_mode_mismatch_intr(core_if); ++ } ++ if (gintsts.b.otgintr) { ++ retval |= dwc_otg_handle_otg_intr(core_if); ++ } ++ if (gintsts.b.conidstschng) { ++ retval |= ++ dwc_otg_handle_conn_id_status_change_intr(core_if); ++ } ++ if (gintsts.b.disconnect) { ++ retval |= dwc_otg_handle_disconnect_intr(core_if); ++ } ++ if (gintsts.b.sessreqintr) { ++ retval |= dwc_otg_handle_session_req_intr(core_if); ++ } ++ if (gintsts.b.wkupintr) { ++ retval |= dwc_otg_handle_wakeup_detected_intr(core_if); ++ } ++ if (gintsts.b.usbsuspend) { ++ retval |= dwc_otg_handle_usb_suspend_intr(core_if); ++ } ++#ifdef CONFIG_USB_DWC_OTG_LPM ++ if (gintsts.b.lpmtranrcvd) { ++ retval |= dwc_otg_handle_lpm_intr(core_if); ++ } ++#endif ++ if (gintsts.b.restoredone) { ++ gintsts.d32 = 0; ++ if (core_if->power_down == 2) ++ core_if->hibernation_suspend = -1; ++ else if (core_if->power_down == 3 && core_if->xhib == 2) { ++ gpwrdn_data_t gpwrdn = {.d32 = 0 }; ++ pcgcctl_data_t pcgcctl = {.d32 = 0 }; ++ dctl_data_t dctl = {.d32 = 0 }; ++ ++ DWC_WRITE_REG32(&core_if->core_global_regs-> ++ gintsts, 0xFFFFFFFF); ++ ++ DWC_DEBUGPL(DBG_ANY, ++ "RESTORE DONE generated\n"); ++ ++ gpwrdn.b.restore = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ dwc_udelay(10); ++ ++ pcgcctl.b.rstpdwnmodule = 1; ++ DWC_MODIFY_REG32(core_if->pcgcctl, pcgcctl.d32, 0); ++ ++ DWC_WRITE_REG32(&core_if->core_global_regs->gusbcfg, core_if->gr_backup->gusbcfg_local); ++ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->dcfg, core_if->dr_backup->dcfg); ++ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->dctl, core_if->dr_backup->dctl); ++ dwc_udelay(50); ++ ++ dctl.b.pwronprgdone = 1; ++ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs->dctl, 0, dctl.d32); ++ dwc_udelay(10); ++ ++ dwc_otg_restore_global_regs(core_if); ++ dwc_otg_restore_dev_regs(core_if, 0); ++ ++ dctl.d32 = 0; ++ dctl.b.pwronprgdone = 1; ++ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs->dctl, dctl.d32, 0); ++ dwc_udelay(10); ++ ++ pcgcctl.d32 = 0; ++ pcgcctl.b.enbl_extnd_hiber = 1; ++ DWC_MODIFY_REG32(core_if->pcgcctl, pcgcctl.d32, 0); ++ ++ /* The core will be in ON STATE */ ++ core_if->lx_state = DWC_OTG_L0; ++ core_if->xhib = 0; ++ ++ DWC_SPINUNLOCK(core_if->lock); ++ if (core_if->pcd_cb && core_if->pcd_cb->resume_wakeup) { ++ core_if->pcd_cb->resume_wakeup(core_if->pcd_cb->p); ++ } ++ DWC_SPINLOCK(core_if->lock); ++ ++ } ++ ++ gintsts.b.restoredone = 1; ++ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts,gintsts.d32); ++ DWC_PRINTF(" --Restore done interrupt received-- \n"); ++ retval |= 1; ++ } ++ if (gintsts.b.portintr && dwc_otg_is_device_mode(core_if)) { ++ /* The port interrupt occurs while in device mode with HPRT0 ++ * Port Enable/Disable. ++ */ ++ gintsts.d32 = 0; ++ gintsts.b.portintr = 1; ++ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts,gintsts.d32); ++ retval |= 1; ++ gintmsk_reenable.b.portintr = 1; ++ ++ } ++ /* Did we actually handle anything? if so, unmask the interrupt */ ++// fiq_print(FIQDBG_INT, otg_dev->hcd->fiq_state, "CILOUT %1d", retval); ++// fiq_print(FIQDBG_INT, otg_dev->hcd->fiq_state, "%08x", gintsts.d32); ++// fiq_print(FIQDBG_INT, otg_dev->hcd->fiq_state, "%08x", gintmsk_reenable.d32); ++ if (retval && fiq_enable) { ++ DWC_WRITE_REG32(&core_if->core_global_regs->gintmsk, gintmsk_reenable.d32); ++ } ++ ++ } else { ++ DWC_DEBUGPL(DBG_ANY, "gpwrdn=%08x\n", gpwrdn.d32); ++ ++ if (gpwrdn.b.disconn_det && gpwrdn.b.disconn_det_msk) { ++ CLEAR_GPWRDN_INTR(core_if, disconn_det); ++ if (gpwrdn.b.linestate == 0) { ++ dwc_otg_handle_pwrdn_disconnect_intr(core_if); ++ } else { ++ DWC_PRINTF("Disconnect detected while linestate is not 0\n"); ++ } ++ ++ retval |= 1; ++ } ++ if (gpwrdn.b.lnstschng && gpwrdn.b.lnstchng_msk) { ++ CLEAR_GPWRDN_INTR(core_if, lnstschng); ++ /* remote wakeup from hibernation */ ++ if (gpwrdn.b.linestate == 2 || gpwrdn.b.linestate == 1) { ++ dwc_otg_handle_pwrdn_wakeup_detected_intr(core_if); ++ } else { ++ DWC_PRINTF("gpwrdn.linestate = %d\n", gpwrdn.b.linestate); ++ } ++ retval |= 1; ++ } ++ if (gpwrdn.b.rst_det && gpwrdn.b.rst_det_msk) { ++ CLEAR_GPWRDN_INTR(core_if, rst_det); ++ if (gpwrdn.b.linestate == 0) { ++ DWC_PRINTF("Reset detected\n"); ++ retval |= dwc_otg_device_hibernation_restore(core_if, 0, 1); ++ } ++ } ++ if (gpwrdn.b.srp_det && gpwrdn.b.srp_det_msk) { ++ CLEAR_GPWRDN_INTR(core_if, srp_det); ++ dwc_otg_handle_pwrdn_srp_intr(core_if); ++ retval |= 1; ++ } ++ } ++ /* Handle ADP interrupt here */ ++ if (gpwrdn.b.adp_int) { ++ DWC_PRINTF("ADP interrupt\n"); ++ CLEAR_GPWRDN_INTR(core_if, adp_int); ++ dwc_otg_adp_handle_intr(core_if); ++ retval |= 1; ++ } ++ if (gpwrdn.b.sts_chngint && gpwrdn.b.sts_chngint_msk) { ++ DWC_PRINTF("STS CHNG interrupt asserted\n"); ++ CLEAR_GPWRDN_INTR(core_if, sts_chngint); ++ dwc_otg_handle_pwrdn_stschng_intr(otg_dev); ++ ++ retval |= 1; ++ } ++ if (core_if->lock) ++ DWC_SPINUNLOCK(core_if->lock); ++ return retval; ++} +diff --git a/drivers/usb/host/dwc_otg/dwc_otg_core_if.h b/drivers/usb/host/dwc_otg/dwc_otg_core_if.h +new file mode 100644 +index 0000000..4138fd1 +--- /dev/null ++++ b/drivers/usb/host/dwc_otg/dwc_otg_core_if.h +@@ -0,0 +1,705 @@ ++/* ========================================================================== ++ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_core_if.h $ ++ * $Revision: #13 $ ++ * $Date: 2012/08/10 $ ++ * $Change: 2047372 $ ++ * ++ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, ++ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless ++ * otherwise expressly agreed to in writing between Synopsys and you. ++ * ++ * The Software IS NOT an item of Licensed Software or Licensed Product under ++ * any End User Software License Agreement or Agreement for Licensed Product ++ * with Synopsys or any supplement thereto. You are permitted to use and ++ * redistribute this Software in source and binary forms, with or without ++ * modification, provided that redistributions of source code must retain this ++ * notice. You may not view, use, disclose, copy or distribute this file or ++ * any information contained herein except pursuant to this license grant from ++ * Synopsys. If you do not agree with this notice, including the disclaimer ++ * below, then you are not authorized to use the Software. ++ * ++ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS ++ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS 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. ++ * ========================================================================== */ ++#if !defined(__DWC_CORE_IF_H__) ++#define __DWC_CORE_IF_H__ ++ ++#include "dwc_os.h" ++ ++/** @file ++ * This file defines DWC_OTG Core API ++ */ ++ ++struct dwc_otg_core_if; ++typedef struct dwc_otg_core_if dwc_otg_core_if_t; ++ ++/** Maximum number of Periodic FIFOs */ ++#define MAX_PERIO_FIFOS 15 ++/** Maximum number of Periodic FIFOs */ ++#define MAX_TX_FIFOS 15 ++ ++/** Maximum number of Endpoints/HostChannels */ ++#define MAX_EPS_CHANNELS 16 ++ ++extern dwc_otg_core_if_t *dwc_otg_cil_init(const uint32_t * _reg_base_addr); ++extern void dwc_otg_core_init(dwc_otg_core_if_t * _core_if); ++extern void dwc_otg_cil_remove(dwc_otg_core_if_t * _core_if); ++ ++extern void dwc_otg_enable_global_interrupts(dwc_otg_core_if_t * _core_if); ++extern void dwc_otg_disable_global_interrupts(dwc_otg_core_if_t * _core_if); ++ ++extern uint8_t dwc_otg_is_device_mode(dwc_otg_core_if_t * _core_if); ++extern uint8_t dwc_otg_is_host_mode(dwc_otg_core_if_t * _core_if); ++ ++extern uint8_t dwc_otg_is_dma_enable(dwc_otg_core_if_t * core_if); ++ ++/** This function should be called on every hardware interrupt. */ ++extern int32_t dwc_otg_handle_common_intr(void *otg_dev); ++ ++/** @name OTG Core Parameters */ ++/** @{ */ ++ ++/** ++ * Specifies the OTG capabilities. The driver will automatically ++ * detect the value for this parameter if none is specified. ++ * 0 - HNP and SRP capable (default) ++ * 1 - SRP Only capable ++ * 2 - No HNP/SRP capable ++ */ ++extern int dwc_otg_set_param_otg_cap(dwc_otg_core_if_t * core_if, int32_t val); ++extern int32_t dwc_otg_get_param_otg_cap(dwc_otg_core_if_t * core_if); ++#define DWC_OTG_CAP_PARAM_HNP_SRP_CAPABLE 0 ++#define DWC_OTG_CAP_PARAM_SRP_ONLY_CAPABLE 1 ++#define DWC_OTG_CAP_PARAM_NO_HNP_SRP_CAPABLE 2 ++#define dwc_param_otg_cap_default DWC_OTG_CAP_PARAM_HNP_SRP_CAPABLE ++ ++extern int dwc_otg_set_param_opt(dwc_otg_core_if_t * core_if, int32_t val); ++extern int32_t dwc_otg_get_param_opt(dwc_otg_core_if_t * core_if); ++#define dwc_param_opt_default 1 ++ ++/** ++ * Specifies whether to use slave or DMA mode for accessing the data ++ * FIFOs. The driver will automatically detect the value for this ++ * parameter if none is specified. ++ * 0 - Slave ++ * 1 - DMA (default, if available) ++ */ ++extern int dwc_otg_set_param_dma_enable(dwc_otg_core_if_t * core_if, ++ int32_t val); ++extern int32_t dwc_otg_get_param_dma_enable(dwc_otg_core_if_t * core_if); ++#define dwc_param_dma_enable_default 1 ++ ++/** ++ * When DMA mode is enabled specifies whether to use ++ * address DMA or DMA Descritor mode for accessing the data ++ * FIFOs in device mode. The driver will automatically detect ++ * the value for this parameter if none is specified. ++ * 0 - address DMA ++ * 1 - DMA Descriptor(default, if available) ++ */ ++extern int dwc_otg_set_param_dma_desc_enable(dwc_otg_core_if_t * core_if, ++ int32_t val); ++extern int32_t dwc_otg_get_param_dma_desc_enable(dwc_otg_core_if_t * core_if); ++//#define dwc_param_dma_desc_enable_default 1 ++#define dwc_param_dma_desc_enable_default 0 // Broadcom BCM2708 ++ ++/** The DMA Burst size (applicable only for External DMA ++ * Mode). 1, 4, 8 16, 32, 64, 128, 256 (default 32) ++ */ ++extern int dwc_otg_set_param_dma_burst_size(dwc_otg_core_if_t * core_if, ++ int32_t val); ++extern int32_t dwc_otg_get_param_dma_burst_size(dwc_otg_core_if_t * core_if); ++#define dwc_param_dma_burst_size_default 32 ++ ++/** ++ * Specifies the maximum speed of operation in host and device mode. ++ * The actual speed depends on the speed of the attached device and ++ * the value of phy_type. The actual speed depends on the speed of the ++ * attached device. ++ * 0 - High Speed (default) ++ * 1 - Full Speed ++ */ ++extern int dwc_otg_set_param_speed(dwc_otg_core_if_t * core_if, int32_t val); ++extern int32_t dwc_otg_get_param_speed(dwc_otg_core_if_t * core_if); ++#define dwc_param_speed_default 0 ++#define DWC_SPEED_PARAM_HIGH 0 ++#define DWC_SPEED_PARAM_FULL 1 ++ ++/** Specifies whether low power mode is supported when attached ++ * to a Full Speed or Low Speed device in host mode. ++ * 0 - Don't support low power mode (default) ++ * 1 - Support low power mode ++ */ ++extern int dwc_otg_set_param_host_support_fs_ls_low_power(dwc_otg_core_if_t * ++ core_if, int32_t val); ++extern int32_t dwc_otg_get_param_host_support_fs_ls_low_power(dwc_otg_core_if_t ++ * core_if); ++#define dwc_param_host_support_fs_ls_low_power_default 0 ++ ++/** Specifies the PHY clock rate in low power mode when connected to a ++ * Low Speed device in host mode. This parameter is applicable only if ++ * HOST_SUPPORT_FS_LS_LOW_POWER is enabled. If PHY_TYPE is set to FS ++ * then defaults to 6 MHZ otherwise 48 MHZ. ++ * ++ * 0 - 48 MHz ++ * 1 - 6 MHz ++ */ ++extern int dwc_otg_set_param_host_ls_low_power_phy_clk(dwc_otg_core_if_t * ++ core_if, int32_t val); ++extern int32_t dwc_otg_get_param_host_ls_low_power_phy_clk(dwc_otg_core_if_t * ++ core_if); ++#define dwc_param_host_ls_low_power_phy_clk_default 0 ++#define DWC_HOST_LS_LOW_POWER_PHY_CLK_PARAM_48MHZ 0 ++#define DWC_HOST_LS_LOW_POWER_PHY_CLK_PARAM_6MHZ 1 ++ ++/** ++ * 0 - Use cC FIFO size parameters ++ * 1 - Allow dynamic FIFO sizing (default) ++ */ ++extern int dwc_otg_set_param_enable_dynamic_fifo(dwc_otg_core_if_t * core_if, ++ int32_t val); ++extern int32_t dwc_otg_get_param_enable_dynamic_fifo(dwc_otg_core_if_t * ++ core_if); ++#define dwc_param_enable_dynamic_fifo_default 1 ++ ++/** Total number of 4-byte words in the data FIFO memory. This ++ * memory includes the Rx FIFO, non-periodic Tx FIFO, and periodic ++ * Tx FIFOs. ++ * 32 to 32768 (default 8192) ++ * Note: The total FIFO memory depth in the FPGA configuration is 8192. ++ */ ++extern int dwc_otg_set_param_data_fifo_size(dwc_otg_core_if_t * core_if, ++ int32_t val); ++extern int32_t dwc_otg_get_param_data_fifo_size(dwc_otg_core_if_t * core_if); ++//#define dwc_param_data_fifo_size_default 8192 ++#define dwc_param_data_fifo_size_default 0xFF0 // Broadcom BCM2708 ++ ++/** Number of 4-byte words in the Rx FIFO in device mode when dynamic ++ * FIFO sizing is enabled. ++ * 16 to 32768 (default 1064) ++ */ ++extern int dwc_otg_set_param_dev_rx_fifo_size(dwc_otg_core_if_t * core_if, ++ int32_t val); ++extern int32_t dwc_otg_get_param_dev_rx_fifo_size(dwc_otg_core_if_t * core_if); ++#define dwc_param_dev_rx_fifo_size_default 1064 ++ ++/** Number of 4-byte words in the non-periodic Tx FIFO in device mode ++ * when dynamic FIFO sizing is enabled. ++ * 16 to 32768 (default 1024) ++ */ ++extern int dwc_otg_set_param_dev_nperio_tx_fifo_size(dwc_otg_core_if_t * ++ core_if, int32_t val); ++extern int32_t dwc_otg_get_param_dev_nperio_tx_fifo_size(dwc_otg_core_if_t * ++ core_if); ++#define dwc_param_dev_nperio_tx_fifo_size_default 1024 ++ ++/** Number of 4-byte words in each of the periodic Tx FIFOs in device ++ * mode when dynamic FIFO sizing is enabled. ++ * 4 to 768 (default 256) ++ */ ++extern int dwc_otg_set_param_dev_perio_tx_fifo_size(dwc_otg_core_if_t * core_if, ++ int32_t val, int fifo_num); ++extern int32_t dwc_otg_get_param_dev_perio_tx_fifo_size(dwc_otg_core_if_t * ++ core_if, int fifo_num); ++#define dwc_param_dev_perio_tx_fifo_size_default 256 ++ ++/** Number of 4-byte words in the Rx FIFO in host mode when dynamic ++ * FIFO sizing is enabled. ++ * 16 to 32768 (default 1024) ++ */ ++extern int dwc_otg_set_param_host_rx_fifo_size(dwc_otg_core_if_t * core_if, ++ int32_t val); ++extern int32_t dwc_otg_get_param_host_rx_fifo_size(dwc_otg_core_if_t * core_if); ++//#define dwc_param_host_rx_fifo_size_default 1024 ++#define dwc_param_host_rx_fifo_size_default 774 // Broadcom BCM2708 ++ ++/** Number of 4-byte words in the non-periodic Tx FIFO in host mode ++ * when Dynamic FIFO sizing is enabled in the core. ++ * 16 to 32768 (default 1024) ++ */ ++extern int dwc_otg_set_param_host_nperio_tx_fifo_size(dwc_otg_core_if_t * ++ core_if, int32_t val); ++extern int32_t dwc_otg_get_param_host_nperio_tx_fifo_size(dwc_otg_core_if_t * ++ core_if); ++//#define dwc_param_host_nperio_tx_fifo_size_default 1024 ++#define dwc_param_host_nperio_tx_fifo_size_default 0x100 // Broadcom BCM2708 ++ ++/** Number of 4-byte words in the host periodic Tx FIFO when dynamic ++ * FIFO sizing is enabled. ++ * 16 to 32768 (default 1024) ++ */ ++extern int dwc_otg_set_param_host_perio_tx_fifo_size(dwc_otg_core_if_t * ++ core_if, int32_t val); ++extern int32_t dwc_otg_get_param_host_perio_tx_fifo_size(dwc_otg_core_if_t * ++ core_if); ++//#define dwc_param_host_perio_tx_fifo_size_default 1024 ++#define dwc_param_host_perio_tx_fifo_size_default 0x200 // Broadcom BCM2708 ++ ++/** The maximum transfer size supported in bytes. ++ * 2047 to 65,535 (default 65,535) ++ */ ++extern int dwc_otg_set_param_max_transfer_size(dwc_otg_core_if_t * core_if, ++ int32_t val); ++extern int32_t dwc_otg_get_param_max_transfer_size(dwc_otg_core_if_t * core_if); ++#define dwc_param_max_transfer_size_default 65535 ++ ++/** The maximum number of packets in a transfer. ++ * 15 to 511 (default 511) ++ */ ++extern int dwc_otg_set_param_max_packet_count(dwc_otg_core_if_t * core_if, ++ int32_t val); ++extern int32_t dwc_otg_get_param_max_packet_count(dwc_otg_core_if_t * core_if); ++#define dwc_param_max_packet_count_default 511 ++ ++/** The number of host channel registers to use. ++ * 1 to 16 (default 12) ++ * Note: The FPGA configuration supports a maximum of 12 host channels. ++ */ ++extern int dwc_otg_set_param_host_channels(dwc_otg_core_if_t * core_if, ++ int32_t val); ++extern int32_t dwc_otg_get_param_host_channels(dwc_otg_core_if_t * core_if); ++//#define dwc_param_host_channels_default 12 ++#define dwc_param_host_channels_default 8 // Broadcom BCM2708 ++ ++/** The number of endpoints in addition to EP0 available for device ++ * mode operations. ++ * 1 to 15 (default 6 IN and OUT) ++ * Note: The FPGA configuration supports a maximum of 6 IN and OUT ++ * endpoints in addition to EP0. ++ */ ++extern int dwc_otg_set_param_dev_endpoints(dwc_otg_core_if_t * core_if, ++ int32_t val); ++extern int32_t dwc_otg_get_param_dev_endpoints(dwc_otg_core_if_t * core_if); ++#define dwc_param_dev_endpoints_default 6 ++ ++/** ++ * Specifies the type of PHY interface to use. By default, the driver ++ * will automatically detect the phy_type. ++ * ++ * 0 - Full Speed PHY ++ * 1 - UTMI+ (default) ++ * 2 - ULPI ++ */ ++extern int dwc_otg_set_param_phy_type(dwc_otg_core_if_t * core_if, int32_t val); ++extern int32_t dwc_otg_get_param_phy_type(dwc_otg_core_if_t * core_if); ++#define DWC_PHY_TYPE_PARAM_FS 0 ++#define DWC_PHY_TYPE_PARAM_UTMI 1 ++#define DWC_PHY_TYPE_PARAM_ULPI 2 ++#define dwc_param_phy_type_default DWC_PHY_TYPE_PARAM_UTMI ++ ++/** ++ * Specifies the UTMI+ Data Width. This parameter is ++ * applicable for a PHY_TYPE of UTMI+ or ULPI. (For a ULPI ++ * PHY_TYPE, this parameter indicates the data width between ++ * the MAC and the ULPI Wrapper.) Also, this parameter is ++ * applicable only if the OTG_HSPHY_WIDTH cC parameter was set ++ * to "8 and 16 bits", meaning that the core has been ++ * configured to work at either data path width. ++ * ++ * 8 or 16 bits (default 16) ++ */ ++extern int dwc_otg_set_param_phy_utmi_width(dwc_otg_core_if_t * core_if, ++ int32_t val); ++extern int32_t dwc_otg_get_param_phy_utmi_width(dwc_otg_core_if_t * core_if); ++//#define dwc_param_phy_utmi_width_default 16 ++#define dwc_param_phy_utmi_width_default 8 // Broadcom BCM2708 ++ ++/** ++ * Specifies whether the ULPI operates at double or single ++ * data rate. This parameter is only applicable if PHY_TYPE is ++ * ULPI. ++ * ++ * 0 - single data rate ULPI interface with 8 bit wide data ++ * bus (default) ++ * 1 - double data rate ULPI interface with 4 bit wide data ++ * bus ++ */ ++extern int dwc_otg_set_param_phy_ulpi_ddr(dwc_otg_core_if_t * core_if, ++ int32_t val); ++extern int32_t dwc_otg_get_param_phy_ulpi_ddr(dwc_otg_core_if_t * core_if); ++#define dwc_param_phy_ulpi_ddr_default 0 ++ ++/** ++ * Specifies whether to use the internal or external supply to ++ * drive the vbus with a ULPI phy. ++ */ ++extern int dwc_otg_set_param_phy_ulpi_ext_vbus(dwc_otg_core_if_t * core_if, ++ int32_t val); ++extern int32_t dwc_otg_get_param_phy_ulpi_ext_vbus(dwc_otg_core_if_t * core_if); ++#define DWC_PHY_ULPI_INTERNAL_VBUS 0 ++#define DWC_PHY_ULPI_EXTERNAL_VBUS 1 ++#define dwc_param_phy_ulpi_ext_vbus_default DWC_PHY_ULPI_INTERNAL_VBUS ++ ++/** ++ * Specifies whether to use the I2Cinterface for full speed PHY. This ++ * parameter is only applicable if PHY_TYPE is FS. ++ * 0 - No (default) ++ * 1 - Yes ++ */ ++extern int dwc_otg_set_param_i2c_enable(dwc_otg_core_if_t * core_if, ++ int32_t val); ++extern int32_t dwc_otg_get_param_i2c_enable(dwc_otg_core_if_t * core_if); ++#define dwc_param_i2c_enable_default 0 ++ ++extern int dwc_otg_set_param_ulpi_fs_ls(dwc_otg_core_if_t * core_if, ++ int32_t val); ++extern int32_t dwc_otg_get_param_ulpi_fs_ls(dwc_otg_core_if_t * core_if); ++#define dwc_param_ulpi_fs_ls_default 0 ++ ++extern int dwc_otg_set_param_ts_dline(dwc_otg_core_if_t * core_if, int32_t val); ++extern int32_t dwc_otg_get_param_ts_dline(dwc_otg_core_if_t * core_if); ++#define dwc_param_ts_dline_default 0 ++ ++/** ++ * Specifies whether dedicated transmit FIFOs are ++ * enabled for non periodic IN endpoints in device mode ++ * 0 - No ++ * 1 - Yes ++ */ ++extern int dwc_otg_set_param_en_multiple_tx_fifo(dwc_otg_core_if_t * core_if, ++ int32_t val); ++extern int32_t dwc_otg_get_param_en_multiple_tx_fifo(dwc_otg_core_if_t * ++ core_if); ++#define dwc_param_en_multiple_tx_fifo_default 1 ++ ++/** Number of 4-byte words in each of the Tx FIFOs in device ++ * mode when dynamic FIFO sizing is enabled. ++ * 4 to 768 (default 256) ++ */ ++extern int dwc_otg_set_param_dev_tx_fifo_size(dwc_otg_core_if_t * core_if, ++ int fifo_num, int32_t val); ++extern int32_t dwc_otg_get_param_dev_tx_fifo_size(dwc_otg_core_if_t * core_if, ++ int fifo_num); ++#define dwc_param_dev_tx_fifo_size_default 768 ++ ++/** Thresholding enable flag- ++ * bit 0 - enable non-ISO Tx thresholding ++ * bit 1 - enable ISO Tx thresholding ++ * bit 2 - enable Rx thresholding ++ */ ++extern int dwc_otg_set_param_thr_ctl(dwc_otg_core_if_t * core_if, int32_t val); ++extern int32_t dwc_otg_get_thr_ctl(dwc_otg_core_if_t * core_if, int fifo_num); ++#define dwc_param_thr_ctl_default 0 ++ ++/** Thresholding length for Tx ++ * FIFOs in 32 bit DWORDs ++ */ ++extern int dwc_otg_set_param_tx_thr_length(dwc_otg_core_if_t * core_if, ++ int32_t val); ++extern int32_t dwc_otg_get_tx_thr_length(dwc_otg_core_if_t * core_if); ++#define dwc_param_tx_thr_length_default 64 ++ ++/** Thresholding length for Rx ++ * FIFOs in 32 bit DWORDs ++ */ ++extern int dwc_otg_set_param_rx_thr_length(dwc_otg_core_if_t * core_if, ++ int32_t val); ++extern int32_t dwc_otg_get_rx_thr_length(dwc_otg_core_if_t * core_if); ++#define dwc_param_rx_thr_length_default 64 ++ ++/** ++ * Specifies whether LPM (Link Power Management) support is enabled ++ */ ++extern int dwc_otg_set_param_lpm_enable(dwc_otg_core_if_t * core_if, ++ int32_t val); ++extern int32_t dwc_otg_get_param_lpm_enable(dwc_otg_core_if_t * core_if); ++#define dwc_param_lpm_enable_default 1 ++ ++/** ++ * Specifies whether PTI enhancement is enabled ++ */ ++extern int dwc_otg_set_param_pti_enable(dwc_otg_core_if_t * core_if, ++ int32_t val); ++extern int32_t dwc_otg_get_param_pti_enable(dwc_otg_core_if_t * core_if); ++#define dwc_param_pti_enable_default 0 ++ ++/** ++ * Specifies whether MPI enhancement is enabled ++ */ ++extern int dwc_otg_set_param_mpi_enable(dwc_otg_core_if_t * core_if, ++ int32_t val); ++extern int32_t dwc_otg_get_param_mpi_enable(dwc_otg_core_if_t * core_if); ++#define dwc_param_mpi_enable_default 0 ++ ++/** ++ * Specifies whether ADP capability is enabled ++ */ ++extern int dwc_otg_set_param_adp_enable(dwc_otg_core_if_t * core_if, ++ int32_t val); ++extern int32_t dwc_otg_get_param_adp_enable(dwc_otg_core_if_t * core_if); ++#define dwc_param_adp_enable_default 0 ++ ++/** ++ * Specifies whether IC_USB capability is enabled ++ */ ++ ++extern int dwc_otg_set_param_ic_usb_cap(dwc_otg_core_if_t * core_if, ++ int32_t val); ++extern int32_t dwc_otg_get_param_ic_usb_cap(dwc_otg_core_if_t * core_if); ++#define dwc_param_ic_usb_cap_default 0 ++ ++extern int dwc_otg_set_param_ahb_thr_ratio(dwc_otg_core_if_t * core_if, ++ int32_t val); ++extern int32_t dwc_otg_get_param_ahb_thr_ratio(dwc_otg_core_if_t * core_if); ++#define dwc_param_ahb_thr_ratio_default 0 ++ ++extern int dwc_otg_set_param_power_down(dwc_otg_core_if_t * core_if, ++ int32_t val); ++extern int32_t dwc_otg_get_param_power_down(dwc_otg_core_if_t * core_if); ++#define dwc_param_power_down_default 0 ++ ++extern int dwc_otg_set_param_reload_ctl(dwc_otg_core_if_t * core_if, ++ int32_t val); ++extern int32_t dwc_otg_get_param_reload_ctl(dwc_otg_core_if_t * core_if); ++#define dwc_param_reload_ctl_default 0 ++ ++extern int dwc_otg_set_param_dev_out_nak(dwc_otg_core_if_t * core_if, ++ int32_t val); ++extern int32_t dwc_otg_get_param_dev_out_nak(dwc_otg_core_if_t * core_if); ++#define dwc_param_dev_out_nak_default 0 ++ ++extern int dwc_otg_set_param_cont_on_bna(dwc_otg_core_if_t * core_if, ++ int32_t val); ++extern int32_t dwc_otg_get_param_cont_on_bna(dwc_otg_core_if_t * core_if); ++#define dwc_param_cont_on_bna_default 0 ++ ++extern int dwc_otg_set_param_ahb_single(dwc_otg_core_if_t * core_if, ++ int32_t val); ++extern int32_t dwc_otg_get_param_ahb_single(dwc_otg_core_if_t * core_if); ++#define dwc_param_ahb_single_default 0 ++ ++extern int dwc_otg_set_param_otg_ver(dwc_otg_core_if_t * core_if, int32_t val); ++extern int32_t dwc_otg_get_param_otg_ver(dwc_otg_core_if_t * core_if); ++#define dwc_param_otg_ver_default 0 ++ ++/** @} */ ++ ++/** @name Access to registers and bit-fields */ ++ ++/** ++ * Dump core registers and SPRAM ++ */ ++extern void dwc_otg_dump_dev_registers(dwc_otg_core_if_t * _core_if); ++extern void dwc_otg_dump_spram(dwc_otg_core_if_t * _core_if); ++extern void dwc_otg_dump_host_registers(dwc_otg_core_if_t * _core_if); ++extern void dwc_otg_dump_global_registers(dwc_otg_core_if_t * _core_if); ++ ++/** ++ * Get host negotiation status. ++ */ ++extern uint32_t dwc_otg_get_hnpstatus(dwc_otg_core_if_t * core_if); ++ ++/** ++ * Get srp status ++ */ ++extern uint32_t dwc_otg_get_srpstatus(dwc_otg_core_if_t * core_if); ++ ++/** ++ * Set hnpreq bit in the GOTGCTL register. ++ */ ++extern void dwc_otg_set_hnpreq(dwc_otg_core_if_t * core_if, uint32_t val); ++ ++/** ++ * Get Content of SNPSID register. ++ */ ++extern uint32_t dwc_otg_get_gsnpsid(dwc_otg_core_if_t * core_if); ++ ++/** ++ * Get current mode. ++ * Returns 0 if in device mode, and 1 if in host mode. ++ */ ++extern uint32_t dwc_otg_get_mode(dwc_otg_core_if_t * core_if); ++ ++/** ++ * Get value of hnpcapable field in the GUSBCFG register ++ */ ++extern uint32_t dwc_otg_get_hnpcapable(dwc_otg_core_if_t * core_if); ++/** ++ * Set value of hnpcapable field in the GUSBCFG register ++ */ ++extern void dwc_otg_set_hnpcapable(dwc_otg_core_if_t * core_if, uint32_t val); ++ ++/** ++ * Get value of srpcapable field in the GUSBCFG register ++ */ ++extern uint32_t dwc_otg_get_srpcapable(dwc_otg_core_if_t * core_if); ++/** ++ * Set value of srpcapable field in the GUSBCFG register ++ */ ++extern void dwc_otg_set_srpcapable(dwc_otg_core_if_t * core_if, uint32_t val); ++ ++/** ++ * Get value of devspeed field in the DCFG register ++ */ ++extern uint32_t dwc_otg_get_devspeed(dwc_otg_core_if_t * core_if); ++/** ++ * Set value of devspeed field in the DCFG register ++ */ ++extern void dwc_otg_set_devspeed(dwc_otg_core_if_t * core_if, uint32_t val); ++ ++/** ++ * Get the value of busconnected field from the HPRT0 register ++ */ ++extern uint32_t dwc_otg_get_busconnected(dwc_otg_core_if_t * core_if); ++ ++/** ++ * Gets the device enumeration Speed. ++ */ ++extern uint32_t dwc_otg_get_enumspeed(dwc_otg_core_if_t * core_if); ++ ++/** ++ * Get value of prtpwr field from the HPRT0 register ++ */ ++extern uint32_t dwc_otg_get_prtpower(dwc_otg_core_if_t * core_if); ++ ++/** ++ * Get value of flag indicating core state - hibernated or not ++ */ ++extern uint32_t dwc_otg_get_core_state(dwc_otg_core_if_t * core_if); ++ ++/** ++ * Set value of prtpwr field from the HPRT0 register ++ */ ++extern void dwc_otg_set_prtpower(dwc_otg_core_if_t * core_if, uint32_t val); ++ ++/** ++ * Get value of prtsusp field from the HPRT0 regsiter ++ */ ++extern uint32_t dwc_otg_get_prtsuspend(dwc_otg_core_if_t * core_if); ++/** ++ * Set value of prtpwr field from the HPRT0 register ++ */ ++extern void dwc_otg_set_prtsuspend(dwc_otg_core_if_t * core_if, uint32_t val); ++ ++/** ++ * Get value of ModeChTimEn field from the HCFG regsiter ++ */ ++extern uint32_t dwc_otg_get_mode_ch_tim(dwc_otg_core_if_t * core_if); ++/** ++ * Set value of ModeChTimEn field from the HCFG regsiter ++ */ ++extern void dwc_otg_set_mode_ch_tim(dwc_otg_core_if_t * core_if, uint32_t val); ++ ++/** ++ * Get value of Fram Interval field from the HFIR regsiter ++ */ ++extern uint32_t dwc_otg_get_fr_interval(dwc_otg_core_if_t * core_if); ++/** ++ * Set value of Frame Interval field from the HFIR regsiter ++ */ ++extern void dwc_otg_set_fr_interval(dwc_otg_core_if_t * core_if, uint32_t val); ++ ++/** ++ * Set value of prtres field from the HPRT0 register ++ *FIXME Remove? ++ */ ++extern void dwc_otg_set_prtresume(dwc_otg_core_if_t * core_if, uint32_t val); ++ ++/** ++ * Get value of rmtwkupsig bit in DCTL register ++ */ ++extern uint32_t dwc_otg_get_remotewakesig(dwc_otg_core_if_t * core_if); ++ ++/** ++ * Get value of prt_sleep_sts field from the GLPMCFG register ++ */ ++extern uint32_t dwc_otg_get_lpm_portsleepstatus(dwc_otg_core_if_t * core_if); ++ ++/** ++ * Get value of rem_wkup_en field from the GLPMCFG register ++ */ ++extern uint32_t dwc_otg_get_lpm_remotewakeenabled(dwc_otg_core_if_t * core_if); ++ ++/** ++ * Get value of appl_resp field from the GLPMCFG register ++ */ ++extern uint32_t dwc_otg_get_lpmresponse(dwc_otg_core_if_t * core_if); ++/** ++ * Set value of appl_resp field from the GLPMCFG register ++ */ ++extern void dwc_otg_set_lpmresponse(dwc_otg_core_if_t * core_if, uint32_t val); ++ ++/** ++ * Get value of hsic_connect field from the GLPMCFG register ++ */ ++extern uint32_t dwc_otg_get_hsic_connect(dwc_otg_core_if_t * core_if); ++/** ++ * Set value of hsic_connect field from the GLPMCFG register ++ */ ++extern void dwc_otg_set_hsic_connect(dwc_otg_core_if_t * core_if, uint32_t val); ++ ++/** ++ * Get value of inv_sel_hsic field from the GLPMCFG register. ++ */ ++extern uint32_t dwc_otg_get_inv_sel_hsic(dwc_otg_core_if_t * core_if); ++/** ++ * Set value of inv_sel_hsic field from the GLPMFG register. ++ */ ++extern void dwc_otg_set_inv_sel_hsic(dwc_otg_core_if_t * core_if, uint32_t val); ++ ++/* ++ * Some functions for accessing registers ++ */ ++ ++/** ++ * GOTGCTL register ++ */ ++extern uint32_t dwc_otg_get_gotgctl(dwc_otg_core_if_t * core_if); ++extern void dwc_otg_set_gotgctl(dwc_otg_core_if_t * core_if, uint32_t val); ++ ++/** ++ * GUSBCFG register ++ */ ++extern uint32_t dwc_otg_get_gusbcfg(dwc_otg_core_if_t * core_if); ++extern void dwc_otg_set_gusbcfg(dwc_otg_core_if_t * core_if, uint32_t val); ++ ++/** ++ * GRXFSIZ register ++ */ ++extern uint32_t dwc_otg_get_grxfsiz(dwc_otg_core_if_t * core_if); ++extern void dwc_otg_set_grxfsiz(dwc_otg_core_if_t * core_if, uint32_t val); ++ ++/** ++ * GNPTXFSIZ register ++ */ ++extern uint32_t dwc_otg_get_gnptxfsiz(dwc_otg_core_if_t * core_if); ++extern void dwc_otg_set_gnptxfsiz(dwc_otg_core_if_t * core_if, uint32_t val); ++ ++extern uint32_t dwc_otg_get_gpvndctl(dwc_otg_core_if_t * core_if); ++extern void dwc_otg_set_gpvndctl(dwc_otg_core_if_t * core_if, uint32_t val); ++ ++/** ++ * GGPIO register ++ */ ++extern uint32_t dwc_otg_get_ggpio(dwc_otg_core_if_t * core_if); ++extern void dwc_otg_set_ggpio(dwc_otg_core_if_t * core_if, uint32_t val); ++ ++/** ++ * GUID register ++ */ ++extern uint32_t dwc_otg_get_guid(dwc_otg_core_if_t * core_if); ++extern void dwc_otg_set_guid(dwc_otg_core_if_t * core_if, uint32_t val); ++ ++/** ++ * HPRT0 register ++ */ ++extern uint32_t dwc_otg_get_hprt0(dwc_otg_core_if_t * core_if); ++extern void dwc_otg_set_hprt0(dwc_otg_core_if_t * core_if, uint32_t val); ++ ++/** ++ * GHPTXFSIZE ++ */ ++extern uint32_t dwc_otg_get_hptxfsiz(dwc_otg_core_if_t * core_if); ++ ++/** @} */ ++ ++#endif /* __DWC_CORE_IF_H__ */ +diff --git a/drivers/usb/host/dwc_otg/dwc_otg_dbg.h b/drivers/usb/host/dwc_otg/dwc_otg_dbg.h +new file mode 100644 +index 0000000..ccc24e0 +--- /dev/null ++++ b/drivers/usb/host/dwc_otg/dwc_otg_dbg.h +@@ -0,0 +1,117 @@ ++/* ========================================================================== ++ * ++ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, ++ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless ++ * otherwise expressly agreed to in writing between Synopsys and you. ++ * ++ * The Software IS NOT an item of Licensed Software or Licensed Product under ++ * any End User Software License Agreement or Agreement for Licensed Product ++ * with Synopsys or any supplement thereto. You are permitted to use and ++ * redistribute this Software in source and binary forms, with or without ++ * modification, provided that redistributions of source code must retain this ++ * notice. You may not view, use, disclose, copy or distribute this file or ++ * any information contained herein except pursuant to this license grant from ++ * Synopsys. If you do not agree with this notice, including the disclaimer ++ * below, then you are not authorized to use the Software. ++ * ++ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS ++ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS 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. ++ * ========================================================================== */ ++ ++#ifndef __DWC_OTG_DBG_H__ ++#define __DWC_OTG_DBG_H__ ++ ++/** @file ++ * This file defines debug levels. ++ * Debugging support vanishes in non-debug builds. ++ */ ++ ++/** ++ * The Debug Level bit-mask variable. ++ */ ++extern uint32_t g_dbg_lvl; ++/** ++ * Set the Debug Level variable. ++ */ ++static inline uint32_t SET_DEBUG_LEVEL(const uint32_t new) ++{ ++ uint32_t old = g_dbg_lvl; ++ g_dbg_lvl = new; ++ return old; ++} ++ ++#define DBG_USER (0x1) ++/** When debug level has the DBG_CIL bit set, display CIL Debug messages. */ ++#define DBG_CIL (0x2) ++/** When debug level has the DBG_CILV bit set, display CIL Verbose debug ++ * messages */ ++#define DBG_CILV (0x20) ++/** When debug level has the DBG_PCD bit set, display PCD (Device) debug ++ * messages */ ++#define DBG_PCD (0x4) ++/** When debug level has the DBG_PCDV set, display PCD (Device) Verbose debug ++ * messages */ ++#define DBG_PCDV (0x40) ++/** When debug level has the DBG_HCD bit set, display Host debug messages */ ++#define DBG_HCD (0x8) ++/** When debug level has the DBG_HCDV bit set, display Verbose Host debug ++ * messages */ ++#define DBG_HCDV (0x80) ++/** When debug level has the DBG_HCD_URB bit set, display enqueued URBs in host ++ * mode. */ ++#define DBG_HCD_URB (0x800) ++/** When debug level has the DBG_HCDI bit set, display host interrupt ++ * messages. */ ++#define DBG_HCDI (0x1000) ++ ++/** When debug level has any bit set, display debug messages */ ++#define DBG_ANY (0xFF) ++ ++/** All debug messages off */ ++#define DBG_OFF 0 ++ ++/** Prefix string for DWC_DEBUG print macros. */ ++#define USB_DWC "DWC_otg: " ++ ++/** ++ * Print a debug message when the Global debug level variable contains ++ * the bit defined in <code>lvl</code>. ++ * ++ * @param[in] lvl - Debug level, use one of the DBG_ constants above. ++ * @param[in] x - like printf ++ * ++ * Example:<p> ++ * <code> ++ * DWC_DEBUGPL( DBG_ANY, "%s(%p)\n", __func__, _reg_base_addr); ++ * </code> ++ * <br> ++ * results in:<br> ++ * <code> ++ * usb-DWC_otg: dwc_otg_cil_init(ca867000) ++ * </code> ++ */ ++#ifdef DEBUG ++ ++# define DWC_DEBUGPL(lvl, x...) do{ if ((lvl)&g_dbg_lvl)__DWC_DEBUG(USB_DWC x ); }while(0) ++# define DWC_DEBUGP(x...) DWC_DEBUGPL(DBG_ANY, x ) ++ ++# define CHK_DEBUG_LEVEL(level) ((level) & g_dbg_lvl) ++ ++#else ++ ++# define DWC_DEBUGPL(lvl, x...) do{}while(0) ++# define DWC_DEBUGP(x...) ++ ++# define CHK_DEBUG_LEVEL(level) (0) ++ ++#endif /*DEBUG*/ ++#endif +diff --git a/drivers/usb/host/dwc_otg/dwc_otg_driver.c b/drivers/usb/host/dwc_otg/dwc_otg_driver.c +new file mode 100644 +index 0000000..cb060a7 +--- /dev/null ++++ b/drivers/usb/host/dwc_otg/dwc_otg_driver.c +@@ -0,0 +1,1757 @@ ++/* ========================================================================== ++ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_driver.c $ ++ * $Revision: #92 $ ++ * $Date: 2012/08/10 $ ++ * $Change: 2047372 $ ++ * ++ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, ++ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless ++ * otherwise expressly agreed to in writing between Synopsys and you. ++ * ++ * The Software IS NOT an item of Licensed Software or Licensed Product under ++ * any End User Software License Agreement or Agreement for Licensed Product ++ * with Synopsys or any supplement thereto. You are permitted to use and ++ * redistribute this Software in source and binary forms, with or without ++ * modification, provided that redistributions of source code must retain this ++ * notice. You may not view, use, disclose, copy or distribute this file or ++ * any information contained herein except pursuant to this license grant from ++ * Synopsys. If you do not agree with this notice, including the disclaimer ++ * below, then you are not authorized to use the Software. ++ * ++ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS ++ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS 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. ++ * ========================================================================== */ ++ ++/** @file ++ * The dwc_otg_driver module provides the initialization and cleanup entry ++ * points for the DWC_otg driver. This module will be dynamically installed ++ * after Linux is booted using the insmod command. When the module is ++ * installed, the dwc_otg_driver_init function is called. When the module is ++ * removed (using rmmod), the dwc_otg_driver_cleanup function is called. ++ * ++ * This module also defines a data structure for the dwc_otg_driver, which is ++ * used in conjunction with the standard ARM lm_device structure. These ++ * structures allow the OTG driver to comply with the standard Linux driver ++ * model in which devices and drivers are registered with a bus driver. This ++ * has the benefit that Linux can expose attributes of the driver and device ++ * in its special sysfs file system. Users can then read or write files in ++ * this file system to perform diagnostics on the driver components or the ++ * device. ++ */ ++ ++#include "dwc_otg_os_dep.h" ++#include "dwc_os.h" ++#include "dwc_otg_dbg.h" ++#include "dwc_otg_driver.h" ++#include "dwc_otg_attr.h" ++#include "dwc_otg_core_if.h" ++#include "dwc_otg_pcd_if.h" ++#include "dwc_otg_hcd_if.h" ++#include "dwc_otg_fiq_fsm.h" ++ ++#define DWC_DRIVER_VERSION "3.00a 10-AUG-2012" ++#define DWC_DRIVER_DESC "HS OTG USB Controller driver" ++ ++bool microframe_schedule=true; ++ ++static const char dwc_driver_name[] = "dwc_otg"; ++ ++ ++extern int pcd_init( ++#ifdef LM_INTERFACE ++ struct lm_device *_dev ++#elif defined(PCI_INTERFACE) ++ struct pci_dev *_dev ++#elif defined(PLATFORM_INTERFACE) ++ struct platform_device *dev ++#endif ++ ); ++extern int hcd_init( ++#ifdef LM_INTERFACE ++ struct lm_device *_dev ++#elif defined(PCI_INTERFACE) ++ struct pci_dev *_dev ++#elif defined(PLATFORM_INTERFACE) ++ struct platform_device *dev ++#endif ++ ); ++ ++extern int pcd_remove( ++#ifdef LM_INTERFACE ++ struct lm_device *_dev ++#elif defined(PCI_INTERFACE) ++ struct pci_dev *_dev ++#elif defined(PLATFORM_INTERFACE) ++ struct platform_device *_dev ++#endif ++ ); ++ ++extern void hcd_remove( ++#ifdef LM_INTERFACE ++ struct lm_device *_dev ++#elif defined(PCI_INTERFACE) ++ struct pci_dev *_dev ++#elif defined(PLATFORM_INTERFACE) ++ struct platform_device *_dev ++#endif ++ ); ++ ++extern void dwc_otg_adp_start(dwc_otg_core_if_t * core_if, uint8_t is_host); ++ ++/*-------------------------------------------------------------------------*/ ++/* Encapsulate the module parameter settings */ ++ ++struct dwc_otg_driver_module_params { ++ int32_t opt; ++ int32_t otg_cap; ++ int32_t dma_enable; ++ int32_t dma_desc_enable; ++ int32_t dma_burst_size; ++ int32_t speed; ++ int32_t host_support_fs_ls_low_power; ++ int32_t host_ls_low_power_phy_clk; ++ int32_t enable_dynamic_fifo; ++ int32_t data_fifo_size; ++ int32_t dev_rx_fifo_size; ++ int32_t dev_nperio_tx_fifo_size; ++ uint32_t dev_perio_tx_fifo_size[MAX_PERIO_FIFOS]; ++ int32_t host_rx_fifo_size; ++ int32_t host_nperio_tx_fifo_size; ++ int32_t host_perio_tx_fifo_size; ++ int32_t max_transfer_size; ++ int32_t max_packet_count; ++ int32_t host_channels; ++ int32_t dev_endpoints; ++ int32_t phy_type; ++ int32_t phy_utmi_width; ++ int32_t phy_ulpi_ddr; ++ int32_t phy_ulpi_ext_vbus; ++ int32_t i2c_enable; ++ int32_t ulpi_fs_ls; ++ int32_t ts_dline; ++ int32_t en_multiple_tx_fifo; ++ uint32_t dev_tx_fifo_size[MAX_TX_FIFOS]; ++ uint32_t thr_ctl; ++ uint32_t tx_thr_length; ++ uint32_t rx_thr_length; ++ int32_t pti_enable; ++ int32_t mpi_enable; ++ int32_t lpm_enable; ++ int32_t ic_usb_cap; ++ int32_t ahb_thr_ratio; ++ int32_t power_down; ++ int32_t reload_ctl; ++ int32_t dev_out_nak; ++ int32_t cont_on_bna; ++ int32_t ahb_single; ++ int32_t otg_ver; ++ int32_t adp_enable; ++}; ++ ++static struct dwc_otg_driver_module_params dwc_otg_module_params = { ++ .opt = -1, ++ .otg_cap = -1, ++ .dma_enable = -1, ++ .dma_desc_enable = -1, ++ .dma_burst_size = -1, ++ .speed = -1, ++ .host_support_fs_ls_low_power = -1, ++ .host_ls_low_power_phy_clk = -1, ++ .enable_dynamic_fifo = -1, ++ .data_fifo_size = -1, ++ .dev_rx_fifo_size = -1, ++ .dev_nperio_tx_fifo_size = -1, ++ .dev_perio_tx_fifo_size = { ++ /* dev_perio_tx_fifo_size_1 */ ++ -1, ++ -1, ++ -1, ++ -1, ++ -1, ++ -1, ++ -1, ++ -1, ++ -1, ++ -1, ++ -1, ++ -1, ++ -1, ++ -1, ++ -1 ++ /* 15 */ ++ }, ++ .host_rx_fifo_size = -1, ++ .host_nperio_tx_fifo_size = -1, ++ .host_perio_tx_fifo_size = -1, ++ .max_transfer_size = -1, ++ .max_packet_count = -1, ++ .host_channels = -1, ++ .dev_endpoints = -1, ++ .phy_type = -1, ++ .phy_utmi_width = -1, ++ .phy_ulpi_ddr = -1, ++ .phy_ulpi_ext_vbus = -1, ++ .i2c_enable = -1, ++ .ulpi_fs_ls = -1, ++ .ts_dline = -1, ++ .en_multiple_tx_fifo = -1, ++ .dev_tx_fifo_size = { ++ /* dev_tx_fifo_size */ ++ -1, ++ -1, ++ -1, ++ -1, ++ -1, ++ -1, ++ -1, ++ -1, ++ -1, ++ -1, ++ -1, ++ -1, ++ -1, ++ -1, ++ -1 ++ /* 15 */ ++ }, ++ .thr_ctl = -1, ++ .tx_thr_length = -1, ++ .rx_thr_length = -1, ++ .pti_enable = -1, ++ .mpi_enable = -1, ++ .lpm_enable = 0, ++ .ic_usb_cap = -1, ++ .ahb_thr_ratio = -1, ++ .power_down = -1, ++ .reload_ctl = -1, ++ .dev_out_nak = -1, ++ .cont_on_bna = -1, ++ .ahb_single = -1, ++ .otg_ver = -1, ++ .adp_enable = -1, ++}; ++ ++//Global variable to switch the fiq fix on or off ++bool fiq_enable = 1; ++// Global variable to enable the split transaction fix ++bool fiq_fsm_enable = true; ++//Bulk split-transaction NAK holdoff in microframes ++uint16_t nak_holdoff = 8; ++ ++unsigned short fiq_fsm_mask = 0x0F; ++ ++/** ++ * This function shows the Driver Version. ++ */ ++static ssize_t version_show(struct device_driver *dev, char *buf) ++{ ++ return snprintf(buf, sizeof(DWC_DRIVER_VERSION) + 2, "%s\n", ++ DWC_DRIVER_VERSION); ++} ++ ++static DRIVER_ATTR(version, S_IRUGO, version_show, NULL); ++ ++/** ++ * Global Debug Level Mask. ++ */ ++uint32_t g_dbg_lvl = 0; /* OFF */ ++ ++/** ++ * This function shows the driver Debug Level. ++ */ ++static ssize_t dbg_level_show(struct device_driver *drv, char *buf) ++{ ++ return sprintf(buf, "0x%0x\n", g_dbg_lvl); ++} ++ ++/** ++ * This function stores the driver Debug Level. ++ */ ++static ssize_t dbg_level_store(struct device_driver *drv, const char *buf, ++ size_t count) ++{ ++ g_dbg_lvl = simple_strtoul(buf, NULL, 16); ++ return count; ++} ++ ++static DRIVER_ATTR(debuglevel, S_IRUGO | S_IWUSR, dbg_level_show, ++ dbg_level_store); ++ ++/** ++ * This function is called during module intialization ++ * to pass module parameters to the DWC_OTG CORE. ++ */ ++static int set_parameters(dwc_otg_core_if_t * core_if) ++{ ++ int retval = 0; ++ int i; ++ ++ if (dwc_otg_module_params.otg_cap != -1) { ++ retval += ++ dwc_otg_set_param_otg_cap(core_if, ++ dwc_otg_module_params.otg_cap); ++ } ++ if (dwc_otg_module_params.dma_enable != -1) { ++ retval += ++ dwc_otg_set_param_dma_enable(core_if, ++ dwc_otg_module_params. ++ dma_enable); ++ } ++ if (dwc_otg_module_params.dma_desc_enable != -1) { ++ retval += ++ dwc_otg_set_param_dma_desc_enable(core_if, ++ dwc_otg_module_params. ++ dma_desc_enable); ++ } ++ if (dwc_otg_module_params.opt != -1) { ++ retval += ++ dwc_otg_set_param_opt(core_if, dwc_otg_module_params.opt); ++ } ++ if (dwc_otg_module_params.dma_burst_size != -1) { ++ retval += ++ dwc_otg_set_param_dma_burst_size(core_if, ++ dwc_otg_module_params. ++ dma_burst_size); ++ } ++ if (dwc_otg_module_params.host_support_fs_ls_low_power != -1) { ++ retval += ++ dwc_otg_set_param_host_support_fs_ls_low_power(core_if, ++ dwc_otg_module_params. ++ host_support_fs_ls_low_power); ++ } ++ if (dwc_otg_module_params.enable_dynamic_fifo != -1) { ++ retval += ++ dwc_otg_set_param_enable_dynamic_fifo(core_if, ++ dwc_otg_module_params. ++ enable_dynamic_fifo); ++ } ++ if (dwc_otg_module_params.data_fifo_size != -1) { ++ retval += ++ dwc_otg_set_param_data_fifo_size(core_if, ++ dwc_otg_module_params. ++ data_fifo_size); ++ } ++ if (dwc_otg_module_params.dev_rx_fifo_size != -1) { ++ retval += ++ dwc_otg_set_param_dev_rx_fifo_size(core_if, ++ dwc_otg_module_params. ++ dev_rx_fifo_size); ++ } ++ if (dwc_otg_module_params.dev_nperio_tx_fifo_size != -1) { ++ retval += ++ dwc_otg_set_param_dev_nperio_tx_fifo_size(core_if, ++ dwc_otg_module_params. ++ dev_nperio_tx_fifo_size); ++ } ++ if (dwc_otg_module_params.host_rx_fifo_size != -1) { ++ retval += ++ dwc_otg_set_param_host_rx_fifo_size(core_if, ++ dwc_otg_module_params.host_rx_fifo_size); ++ } ++ if (dwc_otg_module_params.host_nperio_tx_fifo_size != -1) { ++ retval += ++ dwc_otg_set_param_host_nperio_tx_fifo_size(core_if, ++ dwc_otg_module_params. ++ host_nperio_tx_fifo_size); ++ } ++ if (dwc_otg_module_params.host_perio_tx_fifo_size != -1) { ++ retval += ++ dwc_otg_set_param_host_perio_tx_fifo_size(core_if, ++ dwc_otg_module_params. ++ host_perio_tx_fifo_size); ++ } ++ if (dwc_otg_module_params.max_transfer_size != -1) { ++ retval += ++ dwc_otg_set_param_max_transfer_size(core_if, ++ dwc_otg_module_params. ++ max_transfer_size); ++ } ++ if (dwc_otg_module_params.max_packet_count != -1) { ++ retval += ++ dwc_otg_set_param_max_packet_count(core_if, ++ dwc_otg_module_params. ++ max_packet_count); ++ } ++ if (dwc_otg_module_params.host_channels != -1) { ++ retval += ++ dwc_otg_set_param_host_channels(core_if, ++ dwc_otg_module_params. ++ host_channels); ++ } ++ if (dwc_otg_module_params.dev_endpoints != -1) { ++ retval += ++ dwc_otg_set_param_dev_endpoints(core_if, ++ dwc_otg_module_params. ++ dev_endpoints); ++ } ++ if (dwc_otg_module_params.phy_type != -1) { ++ retval += ++ dwc_otg_set_param_phy_type(core_if, ++ dwc_otg_module_params.phy_type); ++ } ++ if (dwc_otg_module_params.speed != -1) { ++ retval += ++ dwc_otg_set_param_speed(core_if, ++ dwc_otg_module_params.speed); ++ } ++ if (dwc_otg_module_params.host_ls_low_power_phy_clk != -1) { ++ retval += ++ dwc_otg_set_param_host_ls_low_power_phy_clk(core_if, ++ dwc_otg_module_params. ++ host_ls_low_power_phy_clk); ++ } ++ if (dwc_otg_module_params.phy_ulpi_ddr != -1) { ++ retval += ++ dwc_otg_set_param_phy_ulpi_ddr(core_if, ++ dwc_otg_module_params. ++ phy_ulpi_ddr); ++ } ++ if (dwc_otg_module_params.phy_ulpi_ext_vbus != -1) { ++ retval += ++ dwc_otg_set_param_phy_ulpi_ext_vbus(core_if, ++ dwc_otg_module_params. ++ phy_ulpi_ext_vbus); ++ } ++ if (dwc_otg_module_params.phy_utmi_width != -1) { ++ retval += ++ dwc_otg_set_param_phy_utmi_width(core_if, ++ dwc_otg_module_params. ++ phy_utmi_width); ++ } ++ if (dwc_otg_module_params.ulpi_fs_ls != -1) { ++ retval += ++ dwc_otg_set_param_ulpi_fs_ls(core_if, ++ dwc_otg_module_params.ulpi_fs_ls); ++ } ++ if (dwc_otg_module_params.ts_dline != -1) { ++ retval += ++ dwc_otg_set_param_ts_dline(core_if, ++ dwc_otg_module_params.ts_dline); ++ } ++ if (dwc_otg_module_params.i2c_enable != -1) { ++ retval += ++ dwc_otg_set_param_i2c_enable(core_if, ++ dwc_otg_module_params. ++ i2c_enable); ++ } ++ if (dwc_otg_module_params.en_multiple_tx_fifo != -1) { ++ retval += ++ dwc_otg_set_param_en_multiple_tx_fifo(core_if, ++ dwc_otg_module_params. ++ en_multiple_tx_fifo); ++ } ++ for (i = 0; i < 15; i++) { ++ if (dwc_otg_module_params.dev_perio_tx_fifo_size[i] != -1) { ++ retval += ++ dwc_otg_set_param_dev_perio_tx_fifo_size(core_if, ++ dwc_otg_module_params. ++ dev_perio_tx_fifo_size ++ [i], i); ++ } ++ } ++ ++ for (i = 0; i < 15; i++) { ++ if (dwc_otg_module_params.dev_tx_fifo_size[i] != -1) { ++ retval += dwc_otg_set_param_dev_tx_fifo_size(core_if, ++ dwc_otg_module_params. ++ dev_tx_fifo_size ++ [i], i); ++ } ++ } ++ if (dwc_otg_module_params.thr_ctl != -1) { ++ retval += ++ dwc_otg_set_param_thr_ctl(core_if, ++ dwc_otg_module_params.thr_ctl); ++ } ++ if (dwc_otg_module_params.mpi_enable != -1) { ++ retval += ++ dwc_otg_set_param_mpi_enable(core_if, ++ dwc_otg_module_params. ++ mpi_enable); ++ } ++ if (dwc_otg_module_params.pti_enable != -1) { ++ retval += ++ dwc_otg_set_param_pti_enable(core_if, ++ dwc_otg_module_params. ++ pti_enable); ++ } ++ if (dwc_otg_module_params.lpm_enable != -1) { ++ retval += ++ dwc_otg_set_param_lpm_enable(core_if, ++ dwc_otg_module_params. ++ lpm_enable); ++ } ++ if (dwc_otg_module_params.ic_usb_cap != -1) { ++ retval += ++ dwc_otg_set_param_ic_usb_cap(core_if, ++ dwc_otg_module_params. ++ ic_usb_cap); ++ } ++ if (dwc_otg_module_params.tx_thr_length != -1) { ++ retval += ++ dwc_otg_set_param_tx_thr_length(core_if, ++ dwc_otg_module_params.tx_thr_length); ++ } ++ if (dwc_otg_module_params.rx_thr_length != -1) { ++ retval += ++ dwc_otg_set_param_rx_thr_length(core_if, ++ dwc_otg_module_params. ++ rx_thr_length); ++ } ++ if (dwc_otg_module_params.ahb_thr_ratio != -1) { ++ retval += ++ dwc_otg_set_param_ahb_thr_ratio(core_if, ++ dwc_otg_module_params.ahb_thr_ratio); ++ } ++ if (dwc_otg_module_params.power_down != -1) { ++ retval += ++ dwc_otg_set_param_power_down(core_if, ++ dwc_otg_module_params.power_down); ++ } ++ if (dwc_otg_module_params.reload_ctl != -1) { ++ retval += ++ dwc_otg_set_param_reload_ctl(core_if, ++ dwc_otg_module_params.reload_ctl); ++ } ++ ++ if (dwc_otg_module_params.dev_out_nak != -1) { ++ retval += ++ dwc_otg_set_param_dev_out_nak(core_if, ++ dwc_otg_module_params.dev_out_nak); ++ } ++ ++ if (dwc_otg_module_params.cont_on_bna != -1) { ++ retval += ++ dwc_otg_set_param_cont_on_bna(core_if, ++ dwc_otg_module_params.cont_on_bna); ++ } ++ ++ if (dwc_otg_module_params.ahb_single != -1) { ++ retval += ++ dwc_otg_set_param_ahb_single(core_if, ++ dwc_otg_module_params.ahb_single); ++ } ++ ++ if (dwc_otg_module_params.otg_ver != -1) { ++ retval += ++ dwc_otg_set_param_otg_ver(core_if, ++ dwc_otg_module_params.otg_ver); ++ } ++ if (dwc_otg_module_params.adp_enable != -1) { ++ retval += ++ dwc_otg_set_param_adp_enable(core_if, ++ dwc_otg_module_params. ++ adp_enable); ++ } ++ return retval; ++} ++ ++/** ++ * This function is the top level interrupt handler for the Common ++ * (Device and host modes) interrupts. ++ */ ++static irqreturn_t dwc_otg_common_irq(int irq, void *dev) ++{ ++ int32_t retval = IRQ_NONE; ++ ++ retval = dwc_otg_handle_common_intr(dev); ++ if (retval != 0) { ++ S3C2410X_CLEAR_EINTPEND(); ++ } ++ return IRQ_RETVAL(retval); ++} ++ ++/** ++ * This function is called when a lm_device is unregistered with the ++ * dwc_otg_driver. This happens, for example, when the rmmod command is ++ * executed. The device may or may not be electrically present. If it is ++ * present, the driver stops device processing. Any resources used on behalf ++ * of this device are freed. ++ * ++ * @param _dev ++ */ ++#ifdef LM_INTERFACE ++#define REM_RETVAL(n) ++static void dwc_otg_driver_remove( struct lm_device *_dev ) ++{ dwc_otg_device_t *otg_dev = lm_get_drvdata(_dev); ++#elif defined(PCI_INTERFACE) ++#define REM_RETVAL(n) ++static void dwc_otg_driver_remove( struct pci_dev *_dev ) ++{ dwc_otg_device_t *otg_dev = pci_get_drvdata(_dev); ++#elif defined(PLATFORM_INTERFACE) ++#define REM_RETVAL(n) n ++static int dwc_otg_driver_remove( struct platform_device *_dev ) ++{ dwc_otg_device_t *otg_dev = platform_get_drvdata(_dev); ++#endif ++ ++ DWC_DEBUGPL(DBG_ANY, "%s(%p) otg_dev %p\n", __func__, _dev, otg_dev); ++ ++ if (!otg_dev) { ++ /* Memory allocation for the dwc_otg_device failed. */ ++ DWC_DEBUGPL(DBG_ANY, "%s: otg_dev NULL!\n", __func__); ++ return REM_RETVAL(-ENOMEM); ++ } ++#ifndef DWC_DEVICE_ONLY ++ if (otg_dev->hcd) { ++ hcd_remove(_dev); ++ } else { ++ DWC_DEBUGPL(DBG_ANY, "%s: otg_dev->hcd NULL!\n", __func__); ++ return REM_RETVAL(-EINVAL); ++ } ++#endif ++ ++#ifndef DWC_HOST_ONLY ++ if (otg_dev->pcd) { ++ pcd_remove(_dev); ++ } else { ++ DWC_DEBUGPL(DBG_ANY, "%s: otg_dev->pcd NULL!\n", __func__); ++ return REM_RETVAL(-EINVAL); ++ } ++#endif ++ /* ++ * Free the IRQ ++ */ ++ if (otg_dev->common_irq_installed) { ++#ifdef PLATFORM_INTERFACE ++ free_irq(platform_get_irq(_dev, 0), otg_dev); ++#else ++ free_irq(_dev->irq, otg_dev); ++#endif ++ } else { ++ DWC_DEBUGPL(DBG_ANY, "%s: There is no installed irq!\n", __func__); ++ return REM_RETVAL(-ENXIO); ++ } ++ ++ if (otg_dev->core_if) { ++ dwc_otg_cil_remove(otg_dev->core_if); ++ } else { ++ DWC_DEBUGPL(DBG_ANY, "%s: otg_dev->core_if NULL!\n", __func__); ++ return REM_RETVAL(-ENXIO); ++ } ++ ++ /* ++ * Remove the device attributes ++ */ ++ dwc_otg_attr_remove(_dev); ++ ++ /* ++ * Return the memory. ++ */ ++ if (otg_dev->os_dep.base) { ++ iounmap(otg_dev->os_dep.base); ++ } ++ DWC_FREE(otg_dev); ++ ++ /* ++ * Clear the drvdata pointer. ++ */ ++#ifdef LM_INTERFACE ++ lm_set_drvdata(_dev, 0); ++#elif defined(PCI_INTERFACE) ++ release_mem_region(otg_dev->os_dep.rsrc_start, ++ otg_dev->os_dep.rsrc_len); ++ pci_set_drvdata(_dev, 0); ++#elif defined(PLATFORM_INTERFACE) ++ platform_set_drvdata(_dev, 0); ++#endif ++ return REM_RETVAL(0); ++} ++ ++/** ++ * This function is called when an lm_device is bound to a ++ * dwc_otg_driver. It creates the driver components required to ++ * control the device (CIL, HCD, and PCD) and it initializes the ++ * device. The driver components are stored in a dwc_otg_device ++ * structure. A reference to the dwc_otg_device is saved in the ++ * lm_device. This allows the driver to access the dwc_otg_device ++ * structure on subsequent calls to driver methods for this device. ++ * ++ * @param _dev Bus device ++ */ ++static int dwc_otg_driver_probe( ++#ifdef LM_INTERFACE ++ struct lm_device *_dev ++#elif defined(PCI_INTERFACE) ++ struct pci_dev *_dev, ++ const struct pci_device_id *id ++#elif defined(PLATFORM_INTERFACE) ++ struct platform_device *_dev ++#endif ++ ) ++{ ++ int retval = 0; ++ dwc_otg_device_t *dwc_otg_device; ++ int devirq; ++ ++ dev_dbg(&_dev->dev, "dwc_otg_driver_probe(%p)\n", _dev); ++#ifdef LM_INTERFACE ++ dev_dbg(&_dev->dev, "start=0x%08x\n", (unsigned)_dev->resource.start); ++#elif defined(PCI_INTERFACE) ++ if (!id) { ++ DWC_ERROR("Invalid pci_device_id %p", id); ++ return -EINVAL; ++ } ++ ++ if (!_dev || (pci_enable_device(_dev) < 0)) { ++ DWC_ERROR("Invalid pci_device %p", _dev); ++ return -ENODEV; ++ } ++ dev_dbg(&_dev->dev, "start=0x%08x\n", (unsigned)pci_resource_start(_dev,0)); ++ /* other stuff needed as well? */ ++ ++#elif defined(PLATFORM_INTERFACE) ++ dev_dbg(&_dev->dev, "start=0x%08x (len 0x%x)\n", ++ (unsigned)_dev->resource->start, ++ (unsigned)(_dev->resource->end - _dev->resource->start)); ++#endif ++ ++ dwc_otg_device = DWC_ALLOC(sizeof(dwc_otg_device_t)); ++ ++ if (!dwc_otg_device) { ++ dev_err(&_dev->dev, "kmalloc of dwc_otg_device failed\n"); ++ return -ENOMEM; ++ } ++ ++ memset(dwc_otg_device, 0, sizeof(*dwc_otg_device)); ++ dwc_otg_device->os_dep.reg_offset = 0xFFFFFFFF; ++ dwc_otg_device->os_dep.platformdev = _dev; ++ ++ /* ++ * Map the DWC_otg Core memory into virtual address space. ++ */ ++#ifdef LM_INTERFACE ++ dwc_otg_device->os_dep.base = ioremap(_dev->resource.start, SZ_256K); ++ ++ if (!dwc_otg_device->os_dep.base) { ++ dev_err(&_dev->dev, "ioremap() failed\n"); ++ DWC_FREE(dwc_otg_device); ++ return -ENOMEM; ++ } ++ dev_dbg(&_dev->dev, "base=0x%08x\n", ++ (unsigned)dwc_otg_device->os_dep.base); ++#elif defined(PCI_INTERFACE) ++ _dev->current_state = PCI_D0; ++ _dev->dev.power.power_state = PMSG_ON; ++ ++ if (!_dev->irq) { ++ DWC_ERROR("Found HC with no IRQ. Check BIOS/PCI %s setup!", ++ pci_name(_dev)); ++ iounmap(dwc_otg_device->os_dep.base); ++ DWC_FREE(dwc_otg_device); ++ return -ENODEV; ++ } ++ ++ dwc_otg_device->os_dep.rsrc_start = pci_resource_start(_dev, 0); ++ dwc_otg_device->os_dep.rsrc_len = pci_resource_len(_dev, 0); ++ DWC_DEBUGPL(DBG_ANY, "PCI resource: start=%08x, len=%08x\n", ++ (unsigned)dwc_otg_device->os_dep.rsrc_start, ++ (unsigned)dwc_otg_device->os_dep.rsrc_len); ++ if (!request_mem_region ++ (dwc_otg_device->os_dep.rsrc_start, dwc_otg_device->os_dep.rsrc_len, ++ "dwc_otg")) { ++ dev_dbg(&_dev->dev, "error requesting memory\n"); ++ iounmap(dwc_otg_device->os_dep.base); ++ DWC_FREE(dwc_otg_device); ++ return -EFAULT; ++ } ++ ++ dwc_otg_device->os_dep.base = ++ ioremap_nocache(dwc_otg_device->os_dep.rsrc_start, ++ dwc_otg_device->os_dep.rsrc_len); ++ if (dwc_otg_device->os_dep.base == NULL) { ++ dev_dbg(&_dev->dev, "error mapping memory\n"); ++ release_mem_region(dwc_otg_device->os_dep.rsrc_start, ++ dwc_otg_device->os_dep.rsrc_len); ++ iounmap(dwc_otg_device->os_dep.base); ++ DWC_FREE(dwc_otg_device); ++ return -EFAULT; ++ } ++ dev_dbg(&_dev->dev, "base=0x%p (before adjust) \n", ++ dwc_otg_device->os_dep.base); ++ dwc_otg_device->os_dep.base = (char *)dwc_otg_device->os_dep.base; ++ dev_dbg(&_dev->dev, "base=0x%p (after adjust) \n", ++ dwc_otg_device->os_dep.base); ++ dev_dbg(&_dev->dev, "%s: mapped PA 0x%x to VA 0x%p\n", __func__, ++ (unsigned)dwc_otg_device->os_dep.rsrc_start, ++ dwc_otg_device->os_dep.base); ++ ++ pci_set_master(_dev); ++ pci_set_drvdata(_dev, dwc_otg_device); ++#elif defined(PLATFORM_INTERFACE) ++ DWC_DEBUGPL(DBG_ANY,"Platform resource: start=%08x, len=%08x\n", ++ _dev->resource->start, ++ _dev->resource->end - _dev->resource->start + 1); ++#if 1 ++ if (!request_mem_region(_dev->resource[0].start, ++ _dev->resource[0].end - _dev->resource[0].start + 1, ++ "dwc_otg")) { ++ dev_dbg(&_dev->dev, "error reserving mapped memory\n"); ++ retval = -EFAULT; ++ goto fail; ++ } ++ ++ dwc_otg_device->os_dep.base = ioremap_nocache(_dev->resource[0].start, ++ _dev->resource[0].end - ++ _dev->resource[0].start+1); ++ if (fiq_enable) ++ { ++ if (!request_mem_region(_dev->resource[1].start, ++ _dev->resource[1].end - _dev->resource[1].start + 1, ++ "dwc_otg")) { ++ dev_dbg(&_dev->dev, "error reserving mapped memory\n"); ++ retval = -EFAULT; ++ goto fail; ++ } ++ ++ dwc_otg_device->os_dep.mphi_base = ioremap_nocache(_dev->resource[1].start, ++ _dev->resource[1].end - ++ _dev->resource[1].start + 1); ++ } ++ ++#else ++ { ++ struct map_desc desc = { ++ .virtual = IO_ADDRESS((unsigned)_dev->resource->start), ++ .pfn = __phys_to_pfn((unsigned)_dev->resource->start), ++ .length = SZ_128K, ++ .type = MT_DEVICE ++ }; ++ iotable_init(&desc, 1); ++ dwc_otg_device->os_dep.base = (void *)desc.virtual; ++ } ++#endif ++ if (!dwc_otg_device->os_dep.base) { ++ dev_err(&_dev->dev, "ioremap() failed\n"); ++ retval = -ENOMEM; ++ goto fail; ++ } ++ dev_dbg(&_dev->dev, "base=0x%08x\n", ++ (unsigned)dwc_otg_device->os_dep.base); ++#endif ++ ++ /* ++ * Initialize driver data to point to the global DWC_otg ++ * Device structure. ++ */ ++#ifdef LM_INTERFACE ++ lm_set_drvdata(_dev, dwc_otg_device); ++#elif defined(PLATFORM_INTERFACE) ++ platform_set_drvdata(_dev, dwc_otg_device); ++#endif ++ dev_dbg(&_dev->dev, "dwc_otg_device=0x%p\n", dwc_otg_device); ++ ++ dwc_otg_device->core_if = dwc_otg_cil_init(dwc_otg_device->os_dep.base); ++ DWC_DEBUGPL(DBG_HCDV, "probe of device %p given core_if %p\n", ++ dwc_otg_device, dwc_otg_device->core_if);//GRAYG ++ ++ if (!dwc_otg_device->core_if) { ++ dev_err(&_dev->dev, "CIL initialization failed!\n"); ++ retval = -ENOMEM; ++ goto fail; ++ } ++ ++ dev_dbg(&_dev->dev, "Calling get_gsnpsid\n"); ++ /* ++ * Attempt to ensure this device is really a DWC_otg Controller. ++ * Read and verify the SNPSID register contents. The value should be ++ * 0x45F42XXX or 0x45F42XXX, which corresponds to either "OT2" or "OTG3", ++ * as in "OTG version 2.XX" or "OTG version 3.XX". ++ */ ++ ++ if (((dwc_otg_get_gsnpsid(dwc_otg_device->core_if) & 0xFFFFF000) != 0x4F542000) && ++ ((dwc_otg_get_gsnpsid(dwc_otg_device->core_if) & 0xFFFFF000) != 0x4F543000)) { ++ dev_err(&_dev->dev, "Bad value for SNPSID: 0x%08x\n", ++ dwc_otg_get_gsnpsid(dwc_otg_device->core_if)); ++ retval = -EINVAL; ++ goto fail; ++ } ++ ++ /* ++ * Validate parameter values. ++ */ ++ dev_dbg(&_dev->dev, "Calling set_parameters\n"); ++ if (set_parameters(dwc_otg_device->core_if)) { ++ retval = -EINVAL; ++ goto fail; ++ } ++ ++ /* ++ * Create Device Attributes in sysfs ++ */ ++ dev_dbg(&_dev->dev, "Calling attr_create\n"); ++ dwc_otg_attr_create(_dev); ++ ++ /* ++ * Disable the global interrupt until all the interrupt ++ * handlers are installed. ++ */ ++ dev_dbg(&_dev->dev, "Calling disable_global_interrupts\n"); ++ dwc_otg_disable_global_interrupts(dwc_otg_device->core_if); ++ ++ /* ++ * Install the interrupt handler for the common interrupts before ++ * enabling common interrupts in core_init below. ++ */ ++ ++#if defined(PLATFORM_INTERFACE) ++ devirq = platform_get_irq(_dev, fiq_enable ? 0 : 1); ++#else ++ devirq = _dev->irq; ++#endif ++ DWC_DEBUGPL(DBG_CIL, "registering (common) handler for irq%d\n", ++ devirq); ++ dev_dbg(&_dev->dev, "Calling request_irq(%d)\n", devirq); ++ retval = request_irq(devirq, dwc_otg_common_irq, ++ IRQF_SHARED, ++ "dwc_otg", dwc_otg_device); ++ if (retval) { ++ DWC_ERROR("request of irq%d failed\n", devirq); ++ retval = -EBUSY; ++ goto fail; ++ } else { ++ dwc_otg_device->common_irq_installed = 1; ++ } ++ ++#ifndef IRQF_TRIGGER_LOW ++#if defined(LM_INTERFACE) || defined(PLATFORM_INTERFACE) ++ dev_dbg(&_dev->dev, "Calling set_irq_type\n"); ++ set_irq_type(devirq, ++#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30)) ++ IRQT_LOW ++#else ++ IRQ_TYPE_LEVEL_LOW ++#endif ++ ); ++#endif ++#endif /*IRQF_TRIGGER_LOW*/ ++ ++ /* ++ * Initialize the DWC_otg core. ++ */ ++ dev_dbg(&_dev->dev, "Calling dwc_otg_core_init\n"); ++ dwc_otg_core_init(dwc_otg_device->core_if); ++ ++#ifndef DWC_HOST_ONLY ++ /* ++ * Initialize the PCD ++ */ ++ dev_dbg(&_dev->dev, "Calling pcd_init\n"); ++ retval = pcd_init(_dev); ++ if (retval != 0) { ++ DWC_ERROR("pcd_init failed\n"); ++ dwc_otg_device->pcd = NULL; ++ goto fail; ++ } ++#endif ++#ifndef DWC_DEVICE_ONLY ++ /* ++ * Initialize the HCD ++ */ ++ dev_dbg(&_dev->dev, "Calling hcd_init\n"); ++ retval = hcd_init(_dev); ++ if (retval != 0) { ++ DWC_ERROR("hcd_init failed\n"); ++ dwc_otg_device->hcd = NULL; ++ goto fail; ++ } ++#endif ++ /* Recover from drvdata having been overwritten by hcd_init() */ ++#ifdef LM_INTERFACE ++ lm_set_drvdata(_dev, dwc_otg_device); ++#elif defined(PLATFORM_INTERFACE) ++ platform_set_drvdata(_dev, dwc_otg_device); ++#elif defined(PCI_INTERFACE) ++ pci_set_drvdata(_dev, dwc_otg_device); ++ dwc_otg_device->os_dep.pcidev = _dev; ++#endif ++ ++ /* ++ * Enable the global interrupt after all the interrupt ++ * handlers are installed if there is no ADP support else ++ * perform initial actions required for Internal ADP logic. ++ */ ++ if (!dwc_otg_get_param_adp_enable(dwc_otg_device->core_if)) { ++ dev_dbg(&_dev->dev, "Calling enable_global_interrupts\n"); ++ dwc_otg_enable_global_interrupts(dwc_otg_device->core_if); ++ dev_dbg(&_dev->dev, "Done\n"); ++ } else ++ dwc_otg_adp_start(dwc_otg_device->core_if, ++ dwc_otg_is_host_mode(dwc_otg_device->core_if)); ++ ++ return 0; ++ ++fail: ++ dwc_otg_driver_remove(_dev); ++ return retval; ++} ++ ++/** ++ * This structure defines the methods to be called by a bus driver ++ * during the lifecycle of a device on that bus. Both drivers and ++ * devices are registered with a bus driver. The bus driver matches ++ * devices to drivers based on information in the device and driver ++ * structures. ++ * ++ * The probe function is called when the bus driver matches a device ++ * to this driver. The remove function is called when a device is ++ * unregistered with the bus driver. ++ */ ++#ifdef LM_INTERFACE ++static struct lm_driver dwc_otg_driver = { ++ .drv = {.name = (char *)dwc_driver_name,}, ++ .probe = dwc_otg_driver_probe, ++ .remove = dwc_otg_driver_remove, ++ // 'suspend' and 'resume' absent ++}; ++#elif defined(PCI_INTERFACE) ++static const struct pci_device_id pci_ids[] = { { ++ PCI_DEVICE(0x16c3, 0xabcd), ++ .driver_data = ++ (unsigned long)0xdeadbeef, ++ }, { /* end: all zeroes */ } ++}; ++ ++MODULE_DEVICE_TABLE(pci, pci_ids); ++ ++/* pci driver glue; this is a "new style" PCI driver module */ ++static struct pci_driver dwc_otg_driver = { ++ .name = "dwc_otg", ++ .id_table = pci_ids, ++ ++ .probe = dwc_otg_driver_probe, ++ .remove = dwc_otg_driver_remove, ++ ++ .driver = { ++ .name = (char *)dwc_driver_name, ++ }, ++}; ++#elif defined(PLATFORM_INTERFACE) ++static struct platform_device_id platform_ids[] = { ++ { ++ .name = "bcm2708_usb", ++ .driver_data = (kernel_ulong_t) 0xdeadbeef, ++ }, ++ { /* end: all zeroes */ } ++}; ++MODULE_DEVICE_TABLE(platform, platform_ids); ++ ++static const struct of_device_id dwc_otg_of_match_table[] = { ++ { .compatible = "brcm,bcm2708-usb", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, dwc_otg_of_match_table); ++ ++static struct platform_driver dwc_otg_driver = { ++ .driver = { ++ .name = (char *)dwc_driver_name, ++ .of_match_table = dwc_otg_of_match_table, ++ }, ++ .id_table = platform_ids, ++ ++ .probe = dwc_otg_driver_probe, ++ .remove = dwc_otg_driver_remove, ++ // no 'shutdown', 'suspend', 'resume', 'suspend_late' or 'resume_early' ++}; ++#endif ++ ++/** ++ * This function is called when the dwc_otg_driver is installed with the ++ * insmod command. It registers the dwc_otg_driver structure with the ++ * appropriate bus driver. This will cause the dwc_otg_driver_probe function ++ * to be called. In addition, the bus driver will automatically expose ++ * attributes defined for the device and driver in the special sysfs file ++ * system. ++ * ++ * @return ++ */ ++static int __init dwc_otg_driver_init(void) ++{ ++ int retval = 0; ++ int error; ++ struct device_driver *drv; ++ ++ if(fiq_fsm_enable && !fiq_enable) { ++ printk(KERN_WARNING "dwc_otg: fiq_fsm_enable was set without fiq_enable! Correcting.\n"); ++ fiq_enable = 1; ++ } ++ ++ printk(KERN_INFO "%s: version %s (%s bus)\n", dwc_driver_name, ++ DWC_DRIVER_VERSION, ++#ifdef LM_INTERFACE ++ "logicmodule"); ++ retval = lm_driver_register(&dwc_otg_driver); ++ drv = &dwc_otg_driver.drv; ++#elif defined(PCI_INTERFACE) ++ "pci"); ++ retval = pci_register_driver(&dwc_otg_driver); ++ drv = &dwc_otg_driver.driver; ++#elif defined(PLATFORM_INTERFACE) ++ "platform"); ++ retval = platform_driver_register(&dwc_otg_driver); ++ drv = &dwc_otg_driver.driver; ++#endif ++ if (retval < 0) { ++ printk(KERN_ERR "%s retval=%d\n", __func__, retval); ++ return retval; ++ } ++ printk(KERN_DEBUG "dwc_otg: FIQ %s\n", fiq_enable ? "enabled":"disabled"); ++ printk(KERN_DEBUG "dwc_otg: NAK holdoff %s\n", nak_holdoff ? "enabled":"disabled"); ++ printk(KERN_DEBUG "dwc_otg: FIQ split-transaction FSM %s\n", fiq_fsm_enable ? "enabled":"disabled"); ++ ++ error = driver_create_file(drv, &driver_attr_version); ++#ifdef DEBUG ++ error = driver_create_file(drv, &driver_attr_debuglevel); ++#endif ++ return retval; ++} ++ ++module_init(dwc_otg_driver_init); ++ ++/** ++ * This function is called when the driver is removed from the kernel ++ * with the rmmod command. The driver unregisters itself with its bus ++ * driver. ++ * ++ */ ++static void __exit dwc_otg_driver_cleanup(void) ++{ ++ printk(KERN_DEBUG "dwc_otg_driver_cleanup()\n"); ++ ++#ifdef LM_INTERFACE ++ driver_remove_file(&dwc_otg_driver.drv, &driver_attr_debuglevel); ++ driver_remove_file(&dwc_otg_driver.drv, &driver_attr_version); ++ lm_driver_unregister(&dwc_otg_driver); ++#elif defined(PCI_INTERFACE) ++ driver_remove_file(&dwc_otg_driver.driver, &driver_attr_debuglevel); ++ driver_remove_file(&dwc_otg_driver.driver, &driver_attr_version); ++ pci_unregister_driver(&dwc_otg_driver); ++#elif defined(PLATFORM_INTERFACE) ++ driver_remove_file(&dwc_otg_driver.driver, &driver_attr_debuglevel); ++ driver_remove_file(&dwc_otg_driver.driver, &driver_attr_version); ++ platform_driver_unregister(&dwc_otg_driver); ++#endif ++ ++ printk(KERN_INFO "%s module removed\n", dwc_driver_name); ++} ++ ++module_exit(dwc_otg_driver_cleanup); ++ ++MODULE_DESCRIPTION(DWC_DRIVER_DESC); ++MODULE_AUTHOR("Synopsys Inc."); ++MODULE_LICENSE("GPL"); ++ ++module_param_named(otg_cap, dwc_otg_module_params.otg_cap, int, 0444); ++MODULE_PARM_DESC(otg_cap, "OTG Capabilities 0=HNP&SRP 1=SRP Only 2=None"); ++module_param_named(opt, dwc_otg_module_params.opt, int, 0444); ++MODULE_PARM_DESC(opt, "OPT Mode"); ++module_param_named(dma_enable, dwc_otg_module_params.dma_enable, int, 0444); ++MODULE_PARM_DESC(dma_enable, "DMA Mode 0=Slave 1=DMA enabled"); ++ ++module_param_named(dma_desc_enable, dwc_otg_module_params.dma_desc_enable, int, ++ 0444); ++MODULE_PARM_DESC(dma_desc_enable, ++ "DMA Desc Mode 0=Address DMA 1=DMA Descriptor enabled"); ++ ++module_param_named(dma_burst_size, dwc_otg_module_params.dma_burst_size, int, ++ 0444); ++MODULE_PARM_DESC(dma_burst_size, ++ "DMA Burst Size 1, 4, 8, 16, 32, 64, 128, 256"); ++module_param_named(speed, dwc_otg_module_params.speed, int, 0444); ++MODULE_PARM_DESC(speed, "Speed 0=High Speed 1=Full Speed"); ++module_param_named(host_support_fs_ls_low_power, ++ dwc_otg_module_params.host_support_fs_ls_low_power, int, ++ 0444); ++MODULE_PARM_DESC(host_support_fs_ls_low_power, ++ "Support Low Power w/FS or LS 0=Support 1=Don't Support"); ++module_param_named(host_ls_low_power_phy_clk, ++ dwc_otg_module_params.host_ls_low_power_phy_clk, int, 0444); ++MODULE_PARM_DESC(host_ls_low_power_phy_clk, ++ "Low Speed Low Power Clock 0=48Mhz 1=6Mhz"); ++module_param_named(enable_dynamic_fifo, ++ dwc_otg_module_params.enable_dynamic_fifo, int, 0444); ++MODULE_PARM_DESC(enable_dynamic_fifo, "0=cC Setting 1=Allow Dynamic Sizing"); ++module_param_named(data_fifo_size, dwc_otg_module_params.data_fifo_size, int, ++ 0444); ++MODULE_PARM_DESC(data_fifo_size, ++ "Total number of words in the data FIFO memory 32-32768"); ++module_param_named(dev_rx_fifo_size, dwc_otg_module_params.dev_rx_fifo_size, ++ int, 0444); ++MODULE_PARM_DESC(dev_rx_fifo_size, "Number of words in the Rx FIFO 16-32768"); ++module_param_named(dev_nperio_tx_fifo_size, ++ dwc_otg_module_params.dev_nperio_tx_fifo_size, int, 0444); ++MODULE_PARM_DESC(dev_nperio_tx_fifo_size, ++ "Number of words in the non-periodic Tx FIFO 16-32768"); ++module_param_named(dev_perio_tx_fifo_size_1, ++ dwc_otg_module_params.dev_perio_tx_fifo_size[0], int, 0444); ++MODULE_PARM_DESC(dev_perio_tx_fifo_size_1, ++ "Number of words in the periodic Tx FIFO 4-768"); ++module_param_named(dev_perio_tx_fifo_size_2, ++ dwc_otg_module_params.dev_perio_tx_fifo_size[1], int, 0444); ++MODULE_PARM_DESC(dev_perio_tx_fifo_size_2, ++ "Number of words in the periodic Tx FIFO 4-768"); ++module_param_named(dev_perio_tx_fifo_size_3, ++ dwc_otg_module_params.dev_perio_tx_fifo_size[2], int, 0444); ++MODULE_PARM_DESC(dev_perio_tx_fifo_size_3, ++ "Number of words in the periodic Tx FIFO 4-768"); ++module_param_named(dev_perio_tx_fifo_size_4, ++ dwc_otg_module_params.dev_perio_tx_fifo_size[3], int, 0444); ++MODULE_PARM_DESC(dev_perio_tx_fifo_size_4, ++ "Number of words in the periodic Tx FIFO 4-768"); ++module_param_named(dev_perio_tx_fifo_size_5, ++ dwc_otg_module_params.dev_perio_tx_fifo_size[4], int, 0444); ++MODULE_PARM_DESC(dev_perio_tx_fifo_size_5, ++ "Number of words in the periodic Tx FIFO 4-768"); ++module_param_named(dev_perio_tx_fifo_size_6, ++ dwc_otg_module_params.dev_perio_tx_fifo_size[5], int, 0444); ++MODULE_PARM_DESC(dev_perio_tx_fifo_size_6, ++ "Number of words in the periodic Tx FIFO 4-768"); ++module_param_named(dev_perio_tx_fifo_size_7, ++ dwc_otg_module_params.dev_perio_tx_fifo_size[6], int, 0444); ++MODULE_PARM_DESC(dev_perio_tx_fifo_size_7, ++ "Number of words in the periodic Tx FIFO 4-768"); ++module_param_named(dev_perio_tx_fifo_size_8, ++ dwc_otg_module_params.dev_perio_tx_fifo_size[7], int, 0444); ++MODULE_PARM_DESC(dev_perio_tx_fifo_size_8, ++ "Number of words in the periodic Tx FIFO 4-768"); ++module_param_named(dev_perio_tx_fifo_size_9, ++ dwc_otg_module_params.dev_perio_tx_fifo_size[8], int, 0444); ++MODULE_PARM_DESC(dev_perio_tx_fifo_size_9, ++ "Number of words in the periodic Tx FIFO 4-768"); ++module_param_named(dev_perio_tx_fifo_size_10, ++ dwc_otg_module_params.dev_perio_tx_fifo_size[9], int, 0444); ++MODULE_PARM_DESC(dev_perio_tx_fifo_size_10, ++ "Number of words in the periodic Tx FIFO 4-768"); ++module_param_named(dev_perio_tx_fifo_size_11, ++ dwc_otg_module_params.dev_perio_tx_fifo_size[10], int, 0444); ++MODULE_PARM_DESC(dev_perio_tx_fifo_size_11, ++ "Number of words in the periodic Tx FIFO 4-768"); ++module_param_named(dev_perio_tx_fifo_size_12, ++ dwc_otg_module_params.dev_perio_tx_fifo_size[11], int, 0444); ++MODULE_PARM_DESC(dev_perio_tx_fifo_size_12, ++ "Number of words in the periodic Tx FIFO 4-768"); ++module_param_named(dev_perio_tx_fifo_size_13, ++ dwc_otg_module_params.dev_perio_tx_fifo_size[12], int, 0444); ++MODULE_PARM_DESC(dev_perio_tx_fifo_size_13, ++ "Number of words in the periodic Tx FIFO 4-768"); ++module_param_named(dev_perio_tx_fifo_size_14, ++ dwc_otg_module_params.dev_perio_tx_fifo_size[13], int, 0444); ++MODULE_PARM_DESC(dev_perio_tx_fifo_size_14, ++ "Number of words in the periodic Tx FIFO 4-768"); ++module_param_named(dev_perio_tx_fifo_size_15, ++ dwc_otg_module_params.dev_perio_tx_fifo_size[14], int, 0444); ++MODULE_PARM_DESC(dev_perio_tx_fifo_size_15, ++ "Number of words in the periodic Tx FIFO 4-768"); ++module_param_named(host_rx_fifo_size, dwc_otg_module_params.host_rx_fifo_size, ++ int, 0444); ++MODULE_PARM_DESC(host_rx_fifo_size, "Number of words in the Rx FIFO 16-32768"); ++module_param_named(host_nperio_tx_fifo_size, ++ dwc_otg_module_params.host_nperio_tx_fifo_size, int, 0444); ++MODULE_PARM_DESC(host_nperio_tx_fifo_size, ++ "Number of words in the non-periodic Tx FIFO 16-32768"); ++module_param_named(host_perio_tx_fifo_size, ++ dwc_otg_module_params.host_perio_tx_fifo_size, int, 0444); ++MODULE_PARM_DESC(host_perio_tx_fifo_size, ++ "Number of words in the host periodic Tx FIFO 16-32768"); ++module_param_named(max_transfer_size, dwc_otg_module_params.max_transfer_size, ++ int, 0444); ++/** @todo Set the max to 512K, modify checks */ ++MODULE_PARM_DESC(max_transfer_size, ++ "The maximum transfer size supported in bytes 2047-65535"); ++module_param_named(max_packet_count, dwc_otg_module_params.max_packet_count, ++ int, 0444); ++MODULE_PARM_DESC(max_packet_count, ++ "The maximum number of packets in a transfer 15-511"); ++module_param_named(host_channels, dwc_otg_module_params.host_channels, int, ++ 0444); ++MODULE_PARM_DESC(host_channels, ++ "The number of host channel registers to use 1-16"); ++module_param_named(dev_endpoints, dwc_otg_module_params.dev_endpoints, int, ++ 0444); ++MODULE_PARM_DESC(dev_endpoints, ++ "The number of endpoints in addition to EP0 available for device mode 1-15"); ++module_param_named(phy_type, dwc_otg_module_params.phy_type, int, 0444); ++MODULE_PARM_DESC(phy_type, "0=Reserved 1=UTMI+ 2=ULPI"); ++module_param_named(phy_utmi_width, dwc_otg_module_params.phy_utmi_width, int, ++ 0444); ++MODULE_PARM_DESC(phy_utmi_width, "Specifies the UTMI+ Data Width 8 or 16 bits"); ++module_param_named(phy_ulpi_ddr, dwc_otg_module_params.phy_ulpi_ddr, int, 0444); ++MODULE_PARM_DESC(phy_ulpi_ddr, ++ "ULPI at double or single data rate 0=Single 1=Double"); ++module_param_named(phy_ulpi_ext_vbus, dwc_otg_module_params.phy_ulpi_ext_vbus, ++ int, 0444); ++MODULE_PARM_DESC(phy_ulpi_ext_vbus, ++ "ULPI PHY using internal or external vbus 0=Internal"); ++module_param_named(i2c_enable, dwc_otg_module_params.i2c_enable, int, 0444); ++MODULE_PARM_DESC(i2c_enable, "FS PHY Interface"); ++module_param_named(ulpi_fs_ls, dwc_otg_module_params.ulpi_fs_ls, int, 0444); ++MODULE_PARM_DESC(ulpi_fs_ls, "ULPI PHY FS/LS mode only"); ++module_param_named(ts_dline, dwc_otg_module_params.ts_dline, int, 0444); ++MODULE_PARM_DESC(ts_dline, "Term select Dline pulsing for all PHYs"); ++module_param_named(debug, g_dbg_lvl, int, 0444); ++MODULE_PARM_DESC(debug, ""); ++ ++module_param_named(en_multiple_tx_fifo, ++ dwc_otg_module_params.en_multiple_tx_fifo, int, 0444); ++MODULE_PARM_DESC(en_multiple_tx_fifo, ++ "Dedicated Non Periodic Tx FIFOs 0=disabled 1=enabled"); ++module_param_named(dev_tx_fifo_size_1, ++ dwc_otg_module_params.dev_tx_fifo_size[0], int, 0444); ++MODULE_PARM_DESC(dev_tx_fifo_size_1, "Number of words in the Tx FIFO 4-768"); ++module_param_named(dev_tx_fifo_size_2, ++ dwc_otg_module_params.dev_tx_fifo_size[1], int, 0444); ++MODULE_PARM_DESC(dev_tx_fifo_size_2, "Number of words in the Tx FIFO 4-768"); ++module_param_named(dev_tx_fifo_size_3, ++ dwc_otg_module_params.dev_tx_fifo_size[2], int, 0444); ++MODULE_PARM_DESC(dev_tx_fifo_size_3, "Number of words in the Tx FIFO 4-768"); ++module_param_named(dev_tx_fifo_size_4, ++ dwc_otg_module_params.dev_tx_fifo_size[3], int, 0444); ++MODULE_PARM_DESC(dev_tx_fifo_size_4, "Number of words in the Tx FIFO 4-768"); ++module_param_named(dev_tx_fifo_size_5, ++ dwc_otg_module_params.dev_tx_fifo_size[4], int, 0444); ++MODULE_PARM_DESC(dev_tx_fifo_size_5, "Number of words in the Tx FIFO 4-768"); ++module_param_named(dev_tx_fifo_size_6, ++ dwc_otg_module_params.dev_tx_fifo_size[5], int, 0444); ++MODULE_PARM_DESC(dev_tx_fifo_size_6, "Number of words in the Tx FIFO 4-768"); ++module_param_named(dev_tx_fifo_size_7, ++ dwc_otg_module_params.dev_tx_fifo_size[6], int, 0444); ++MODULE_PARM_DESC(dev_tx_fifo_size_7, "Number of words in the Tx FIFO 4-768"); ++module_param_named(dev_tx_fifo_size_8, ++ dwc_otg_module_params.dev_tx_fifo_size[7], int, 0444); ++MODULE_PARM_DESC(dev_tx_fifo_size_8, "Number of words in the Tx FIFO 4-768"); ++module_param_named(dev_tx_fifo_size_9, ++ dwc_otg_module_params.dev_tx_fifo_size[8], int, 0444); ++MODULE_PARM_DESC(dev_tx_fifo_size_9, "Number of words in the Tx FIFO 4-768"); ++module_param_named(dev_tx_fifo_size_10, ++ dwc_otg_module_params.dev_tx_fifo_size[9], int, 0444); ++MODULE_PARM_DESC(dev_tx_fifo_size_10, "Number of words in the Tx FIFO 4-768"); ++module_param_named(dev_tx_fifo_size_11, ++ dwc_otg_module_params.dev_tx_fifo_size[10], int, 0444); ++MODULE_PARM_DESC(dev_tx_fifo_size_11, "Number of words in the Tx FIFO 4-768"); ++module_param_named(dev_tx_fifo_size_12, ++ dwc_otg_module_params.dev_tx_fifo_size[11], int, 0444); ++MODULE_PARM_DESC(dev_tx_fifo_size_12, "Number of words in the Tx FIFO 4-768"); ++module_param_named(dev_tx_fifo_size_13, ++ dwc_otg_module_params.dev_tx_fifo_size[12], int, 0444); ++MODULE_PARM_DESC(dev_tx_fifo_size_13, "Number of words in the Tx FIFO 4-768"); ++module_param_named(dev_tx_fifo_size_14, ++ dwc_otg_module_params.dev_tx_fifo_size[13], int, 0444); ++MODULE_PARM_DESC(dev_tx_fifo_size_14, "Number of words in the Tx FIFO 4-768"); ++module_param_named(dev_tx_fifo_size_15, ++ dwc_otg_module_params.dev_tx_fifo_size[14], int, 0444); ++MODULE_PARM_DESC(dev_tx_fifo_size_15, "Number of words in the Tx FIFO 4-768"); ++ ++module_param_named(thr_ctl, dwc_otg_module_params.thr_ctl, int, 0444); ++MODULE_PARM_DESC(thr_ctl, ++ "Thresholding enable flag bit 0 - non ISO Tx thr., 1 - ISO Tx thr., 2 - Rx thr.- bit 0=disabled 1=enabled"); ++module_param_named(tx_thr_length, dwc_otg_module_params.tx_thr_length, int, ++ 0444); ++MODULE_PARM_DESC(tx_thr_length, "Tx Threshold length in 32 bit DWORDs"); ++module_param_named(rx_thr_length, dwc_otg_module_params.rx_thr_length, int, ++ 0444); ++MODULE_PARM_DESC(rx_thr_length, "Rx Threshold length in 32 bit DWORDs"); ++ ++module_param_named(pti_enable, dwc_otg_module_params.pti_enable, int, 0444); ++module_param_named(mpi_enable, dwc_otg_module_params.mpi_enable, int, 0444); ++module_param_named(lpm_enable, dwc_otg_module_params.lpm_enable, int, 0444); ++MODULE_PARM_DESC(lpm_enable, "LPM Enable 0=LPM Disabled 1=LPM Enabled"); ++module_param_named(ic_usb_cap, dwc_otg_module_params.ic_usb_cap, int, 0444); ++MODULE_PARM_DESC(ic_usb_cap, ++ "IC_USB Capability 0=IC_USB Disabled 1=IC_USB Enabled"); ++module_param_named(ahb_thr_ratio, dwc_otg_module_params.ahb_thr_ratio, int, ++ 0444); ++MODULE_PARM_DESC(ahb_thr_ratio, "AHB Threshold Ratio"); ++module_param_named(power_down, dwc_otg_module_params.power_down, int, 0444); ++MODULE_PARM_DESC(power_down, "Power Down Mode"); ++module_param_named(reload_ctl, dwc_otg_module_params.reload_ctl, int, 0444); ++MODULE_PARM_DESC(reload_ctl, "HFIR Reload Control"); ++module_param_named(dev_out_nak, dwc_otg_module_params.dev_out_nak, int, 0444); ++MODULE_PARM_DESC(dev_out_nak, "Enable Device OUT NAK"); ++module_param_named(cont_on_bna, dwc_otg_module_params.cont_on_bna, int, 0444); ++MODULE_PARM_DESC(cont_on_bna, "Enable Enable Continue on BNA"); ++module_param_named(ahb_single, dwc_otg_module_params.ahb_single, int, 0444); ++MODULE_PARM_DESC(ahb_single, "Enable AHB Single Support"); ++module_param_named(adp_enable, dwc_otg_module_params.adp_enable, int, 0444); ++MODULE_PARM_DESC(adp_enable, "ADP Enable 0=ADP Disabled 1=ADP Enabled"); ++module_param_named(otg_ver, dwc_otg_module_params.otg_ver, int, 0444); ++MODULE_PARM_DESC(otg_ver, "OTG revision supported 0=OTG 1.3 1=OTG 2.0"); ++module_param(microframe_schedule, bool, 0444); ++MODULE_PARM_DESC(microframe_schedule, "Enable the microframe scheduler"); ++ ++module_param(fiq_enable, bool, 0444); ++MODULE_PARM_DESC(fiq_enable, "Enable the FIQ"); ++module_param(nak_holdoff, ushort, 0644); ++MODULE_PARM_DESC(nak_holdoff, "Throttle duration for bulk split-transaction endpoints on a NAK. Default 8"); ++module_param(fiq_fsm_enable, bool, 0444); ++MODULE_PARM_DESC(fiq_fsm_enable, "Enable the FIQ to perform split transactions as defined by fiq_fsm_mask"); ++module_param(fiq_fsm_mask, ushort, 0444); ++MODULE_PARM_DESC(fiq_fsm_mask, "Bitmask of transactions to perform in the FIQ.\n" ++ "Bit 0 : Non-periodic split transactions\n" ++ "Bit 1 : Periodic split transactions\n" ++ "Bit 2 : High-speed multi-transfer isochronous\n" ++ "All other bits should be set 0."); ++ ++ ++/** @page "Module Parameters" ++ * ++ * The following parameters may be specified when starting the module. ++ * These parameters define how the DWC_otg controller should be ++ * configured. Parameter values are passed to the CIL initialization ++ * function dwc_otg_cil_init ++ * ++ * Example: <code>modprobe dwc_otg speed=1 otg_cap=1</code> ++ * ++ ++ <table> ++ <tr><td>Parameter Name</td><td>Meaning</td></tr> ++ ++ <tr> ++ <td>otg_cap</td> ++ <td>Specifies the OTG capabilities. The driver will automatically detect the ++ value for this parameter if none is specified. ++ - 0: HNP and SRP capable (default, if available) ++ - 1: SRP Only capable ++ - 2: No HNP/SRP capable ++ </td></tr> ++ ++ <tr> ++ <td>dma_enable</td> ++ <td>Specifies whether to use slave or DMA mode for accessing the data FIFOs. ++ The driver will automatically detect the value for this parameter if none is ++ specified. ++ - 0: Slave ++ - 1: DMA (default, if available) ++ </td></tr> ++ ++ <tr> ++ <td>dma_burst_size</td> ++ <td>The DMA Burst size (applicable only for External DMA Mode). ++ - Values: 1, 4, 8 16, 32, 64, 128, 256 (default 32) ++ </td></tr> ++ ++ <tr> ++ <td>speed</td> ++ <td>Specifies the maximum speed of operation in host and device mode. The ++ actual speed depends on the speed of the attached device and the value of ++ phy_type. ++ - 0: High Speed (default) ++ - 1: Full Speed ++ </td></tr> ++ ++ <tr> ++ <td>host_support_fs_ls_low_power</td> ++ <td>Specifies whether low power mode is supported when attached to a Full ++ Speed or Low Speed device in host mode. ++ - 0: Don't support low power mode (default) ++ - 1: Support low power mode ++ </td></tr> ++ ++ <tr> ++ <td>host_ls_low_power_phy_clk</td> ++ <td>Specifies the PHY clock rate in low power mode when connected to a Low ++ Speed device in host mode. This parameter is applicable only if ++ HOST_SUPPORT_FS_LS_LOW_POWER is enabled. ++ - 0: 48 MHz (default) ++ - 1: 6 MHz ++ </td></tr> ++ ++ <tr> ++ <td>enable_dynamic_fifo</td> ++ <td> Specifies whether FIFOs may be resized by the driver software. ++ - 0: Use cC FIFO size parameters ++ - 1: Allow dynamic FIFO sizing (default) ++ </td></tr> ++ ++ <tr> ++ <td>data_fifo_size</td> ++ <td>Total number of 4-byte words in the data FIFO memory. This memory ++ includes the Rx FIFO, non-periodic Tx FIFO, and periodic Tx FIFOs. ++ - Values: 32 to 32768 (default 8192) ++ ++ Note: The total FIFO memory depth in the FPGA configuration is 8192. ++ </td></tr> ++ ++ <tr> ++ <td>dev_rx_fifo_size</td> ++ <td>Number of 4-byte words in the Rx FIFO in device mode when dynamic ++ FIFO sizing is enabled. ++ - Values: 16 to 32768 (default 1064) ++ </td></tr> ++ ++ <tr> ++ <td>dev_nperio_tx_fifo_size</td> ++ <td>Number of 4-byte words in the non-periodic Tx FIFO in device mode when ++ dynamic FIFO sizing is enabled. ++ - Values: 16 to 32768 (default 1024) ++ </td></tr> ++ ++ <tr> ++ <td>dev_perio_tx_fifo_size_n (n = 1 to 15)</td> ++ <td>Number of 4-byte words in each of the periodic Tx FIFOs in device mode ++ when dynamic FIFO sizing is enabled. ++ - Values: 4 to 768 (default 256) ++ </td></tr> ++ ++ <tr> ++ <td>host_rx_fifo_size</td> ++ <td>Number of 4-byte words in the Rx FIFO in host mode when dynamic FIFO ++ sizing is enabled. ++ - Values: 16 to 32768 (default 1024) ++ </td></tr> ++ ++ <tr> ++ <td>host_nperio_tx_fifo_size</td> ++ <td>Number of 4-byte words in the non-periodic Tx FIFO in host mode when ++ dynamic FIFO sizing is enabled in the core. ++ - Values: 16 to 32768 (default 1024) ++ </td></tr> ++ ++ <tr> ++ <td>host_perio_tx_fifo_size</td> ++ <td>Number of 4-byte words in the host periodic Tx FIFO when dynamic FIFO ++ sizing is enabled. ++ - Values: 16 to 32768 (default 1024) ++ </td></tr> ++ ++ <tr> ++ <td>max_transfer_size</td> ++ <td>The maximum transfer size supported in bytes. ++ - Values: 2047 to 65,535 (default 65,535) ++ </td></tr> ++ ++ <tr> ++ <td>max_packet_count</td> ++ <td>The maximum number of packets in a transfer. ++ - Values: 15 to 511 (default 511) ++ </td></tr> ++ ++ <tr> ++ <td>host_channels</td> ++ <td>The number of host channel registers to use. ++ - Values: 1 to 16 (default 12) ++ ++ Note: The FPGA configuration supports a maximum of 12 host channels. ++ </td></tr> ++ ++ <tr> ++ <td>dev_endpoints</td> ++ <td>The number of endpoints in addition to EP0 available for device mode ++ operations. ++ - Values: 1 to 15 (default 6 IN and OUT) ++ ++ Note: The FPGA configuration supports a maximum of 6 IN and OUT endpoints in ++ addition to EP0. ++ </td></tr> ++ ++ <tr> ++ <td>phy_type</td> ++ <td>Specifies the type of PHY interface to use. By default, the driver will ++ automatically detect the phy_type. ++ - 0: Full Speed ++ - 1: UTMI+ (default, if available) ++ - 2: ULPI ++ </td></tr> ++ ++ <tr> ++ <td>phy_utmi_width</td> ++ <td>Specifies the UTMI+ Data Width. This parameter is applicable for a ++ phy_type of UTMI+. Also, this parameter is applicable only if the ++ OTG_HSPHY_WIDTH cC parameter was set to "8 and 16 bits", meaning that the ++ core has been configured to work at either data path width. ++ - Values: 8 or 16 bits (default 16) ++ </td></tr> ++ ++ <tr> ++ <td>phy_ulpi_ddr</td> ++ <td>Specifies whether the ULPI operates at double or single data rate. This ++ parameter is only applicable if phy_type is ULPI. ++ - 0: single data rate ULPI interface with 8 bit wide data bus (default) ++ - 1: double data rate ULPI interface with 4 bit wide data bus ++ </td></tr> ++ ++ <tr> ++ <td>i2c_enable</td> ++ <td>Specifies whether to use the I2C interface for full speed PHY. This ++ parameter is only applicable if PHY_TYPE is FS. ++ - 0: Disabled (default) ++ - 1: Enabled ++ </td></tr> ++ ++ <tr> ++ <td>ulpi_fs_ls</td> ++ <td>Specifies whether to use ULPI FS/LS mode only. ++ - 0: Disabled (default) ++ - 1: Enabled ++ </td></tr> ++ ++ <tr> ++ <td>ts_dline</td> ++ <td>Specifies whether term select D-Line pulsing for all PHYs is enabled. ++ - 0: Disabled (default) ++ - 1: Enabled ++ </td></tr> ++ ++ <tr> ++ <td>en_multiple_tx_fifo</td> ++ <td>Specifies whether dedicatedto tx fifos are enabled for non periodic IN EPs. ++ The driver will automatically detect the value for this parameter if none is ++ specified. ++ - 0: Disabled ++ - 1: Enabled (default, if available) ++ </td></tr> ++ ++ <tr> ++ <td>dev_tx_fifo_size_n (n = 1 to 15)</td> ++ <td>Number of 4-byte words in each of the Tx FIFOs in device mode ++ when dynamic FIFO sizing is enabled. ++ - Values: 4 to 768 (default 256) ++ </td></tr> ++ ++ <tr> ++ <td>tx_thr_length</td> ++ <td>Transmit Threshold length in 32 bit double words ++ - Values: 8 to 128 (default 64) ++ </td></tr> ++ ++ <tr> ++ <td>rx_thr_length</td> ++ <td>Receive Threshold length in 32 bit double words ++ - Values: 8 to 128 (default 64) ++ </td></tr> ++ ++<tr> ++ <td>thr_ctl</td> ++ <td>Specifies whether to enable Thresholding for Device mode. Bits 0, 1, 2 of ++ this parmater specifies if thresholding is enabled for non-Iso Tx, Iso Tx and ++ Rx transfers accordingly. ++ The driver will automatically detect the value for this parameter if none is ++ specified. ++ - Values: 0 to 7 (default 0) ++ Bit values indicate: ++ - 0: Thresholding disabled ++ - 1: Thresholding enabled ++ </td></tr> ++ ++<tr> ++ <td>dma_desc_enable</td> ++ <td>Specifies whether to enable Descriptor DMA mode. ++ The driver will automatically detect the value for this parameter if none is ++ specified. ++ - 0: Descriptor DMA disabled ++ - 1: Descriptor DMA (default, if available) ++ </td></tr> ++ ++<tr> ++ <td>mpi_enable</td> ++ <td>Specifies whether to enable MPI enhancement mode. ++ The driver will automatically detect the value for this parameter if none is ++ specified. ++ - 0: MPI disabled (default) ++ - 1: MPI enable ++ </td></tr> ++ ++<tr> ++ <td>pti_enable</td> ++ <td>Specifies whether to enable PTI enhancement support. ++ The driver will automatically detect the value for this parameter if none is ++ specified. ++ - 0: PTI disabled (default) ++ - 1: PTI enable ++ </td></tr> ++ ++<tr> ++ <td>lpm_enable</td> ++ <td>Specifies whether to enable LPM support. ++ The driver will automatically detect the value for this parameter if none is ++ specified. ++ - 0: LPM disabled ++ - 1: LPM enable (default, if available) ++ </td></tr> ++ ++<tr> ++ <td>ic_usb_cap</td> ++ <td>Specifies whether to enable IC_USB capability. ++ The driver will automatically detect the value for this parameter if none is ++ specified. ++ - 0: IC_USB disabled (default, if available) ++ - 1: IC_USB enable ++ </td></tr> ++ ++<tr> ++ <td>ahb_thr_ratio</td> ++ <td>Specifies AHB Threshold ratio. ++ - Values: 0 to 3 (default 0) ++ </td></tr> ++ ++<tr> ++ <td>power_down</td> ++ <td>Specifies Power Down(Hibernation) Mode. ++ The driver will automatically detect the value for this parameter if none is ++ specified. ++ - 0: Power Down disabled (default) ++ - 2: Power Down enabled ++ </td></tr> ++ ++ <tr> ++ <td>reload_ctl</td> ++ <td>Specifies whether dynamic reloading of the HFIR register is allowed during ++ run time. The driver will automatically detect the value for this parameter if ++ none is specified. In case the HFIR value is reloaded when HFIR.RldCtrl == 1'b0 ++ the core might misbehave. ++ - 0: Reload Control disabled (default) ++ - 1: Reload Control enabled ++ </td></tr> ++ ++ <tr> ++ <td>dev_out_nak</td> ++ <td>Specifies whether Device OUT NAK enhancement enabled or no. ++ The driver will automatically detect the value for this parameter if ++ none is specified. This parameter is valid only when OTG_EN_DESC_DMA == 1b1. ++ - 0: The core does not set NAK after Bulk OUT transfer complete (default) ++ - 1: The core sets NAK after Bulk OUT transfer complete ++ </td></tr> ++ ++ <tr> ++ <td>cont_on_bna</td> ++ <td>Specifies whether Enable Continue on BNA enabled or no. ++ After receiving BNA interrupt the core disables the endpoint,when the ++ endpoint is re-enabled by the application the ++ - 0: Core starts processing from the DOEPDMA descriptor (default) ++ - 1: Core starts processing from the descriptor which received the BNA. ++ This parameter is valid only when OTG_EN_DESC_DMA == 1b1. ++ </td></tr> ++ ++ <tr> ++ <td>ahb_single</td> ++ <td>This bit when programmed supports SINGLE transfers for remainder data ++ in a transfer for DMA mode of operation. ++ - 0: The remainder data will be sent using INCR burst size (default) ++ - 1: The remainder data will be sent using SINGLE burst size. ++ </td></tr> ++ ++<tr> ++ <td>adp_enable</td> ++ <td>Specifies whether ADP feature is enabled. ++ The driver will automatically detect the value for this parameter if none is ++ specified. ++ - 0: ADP feature disabled (default) ++ - 1: ADP feature enabled ++ </td></tr> ++ ++ <tr> ++ <td>otg_ver</td> ++ <td>Specifies whether OTG is performing as USB OTG Revision 2.0 or Revision 1.3 ++ USB OTG device. ++ - 0: OTG 2.0 support disabled (default) ++ - 1: OTG 2.0 support enabled ++ </td></tr> ++ ++*/ +diff --git a/drivers/usb/host/dwc_otg/dwc_otg_driver.h b/drivers/usb/host/dwc_otg/dwc_otg_driver.h +new file mode 100644 +index 0000000..6a8be63 +--- /dev/null ++++ b/drivers/usb/host/dwc_otg/dwc_otg_driver.h +@@ -0,0 +1,86 @@ ++/* ========================================================================== ++ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_driver.h $ ++ * $Revision: #19 $ ++ * $Date: 2010/11/15 $ ++ * $Change: 1627671 $ ++ * ++ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, ++ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless ++ * otherwise expressly agreed to in writing between Synopsys and you. ++ * ++ * The Software IS NOT an item of Licensed Software or Licensed Product under ++ * any End User Software License Agreement or Agreement for Licensed Product ++ * with Synopsys or any supplement thereto. You are permitted to use and ++ * redistribute this Software in source and binary forms, with or without ++ * modification, provided that redistributions of source code must retain this ++ * notice. You may not view, use, disclose, copy or distribute this file or ++ * any information contained herein except pursuant to this license grant from ++ * Synopsys. If you do not agree with this notice, including the disclaimer ++ * below, then you are not authorized to use the Software. ++ * ++ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS ++ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS 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. ++ * ========================================================================== */ ++ ++#ifndef __DWC_OTG_DRIVER_H__ ++#define __DWC_OTG_DRIVER_H__ ++ ++/** @file ++ * This file contains the interface to the Linux driver. ++ */ ++#include "dwc_otg_os_dep.h" ++#include "dwc_otg_core_if.h" ++ ++/* Type declarations */ ++struct dwc_otg_pcd; ++struct dwc_otg_hcd; ++ ++/** ++ * This structure is a wrapper that encapsulates the driver components used to ++ * manage a single DWC_otg controller. ++ */ ++typedef struct dwc_otg_device { ++ /** Structure containing OS-dependent stuff. KEEP THIS STRUCT AT THE ++ * VERY BEGINNING OF THE DEVICE STRUCT. OSes such as FreeBSD and NetBSD ++ * require this. */ ++ struct os_dependent os_dep; ++ ++ /** Pointer to the core interface structure. */ ++ dwc_otg_core_if_t *core_if; ++ ++ /** Pointer to the PCD structure. */ ++ struct dwc_otg_pcd *pcd; ++ ++ /** Pointer to the HCD structure. */ ++ struct dwc_otg_hcd *hcd; ++ ++ /** Flag to indicate whether the common IRQ handler is installed. */ ++ uint8_t common_irq_installed; ++ ++} dwc_otg_device_t; ++ ++/*We must clear S3C24XX_EINTPEND external interrupt register ++ * because after clearing in this register trigerred IRQ from ++ * H/W core in kernel interrupt can be occured again before OTG ++ * handlers clear all IRQ sources of Core registers because of ++ * timing latencies and Low Level IRQ Type. ++ */ ++#ifdef CONFIG_MACH_IPMATE ++#define S3C2410X_CLEAR_EINTPEND() \ ++do { \ ++ __raw_writel(1UL << 11,S3C24XX_EINTPEND); \ ++} while (0) ++#else ++#define S3C2410X_CLEAR_EINTPEND() do { } while (0) ++#endif ++ ++#endif +diff --git a/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c b/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c +new file mode 100644 +index 0000000..85d82f3 +--- /dev/null ++++ b/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c +@@ -0,0 +1,1355 @@ ++/* ++ * dwc_otg_fiq_fsm.c - The finite state machine FIQ ++ * ++ * Copyright (c) 2013 Raspberry Pi Foundation ++ * ++ * Author: Jonathan Bell <jonathan@raspberrypi.org> ++ * All rights reserved. ++ * ++ * Redistribution and use in source and binary forms, with or without ++ * modification, are permitted provided that the following conditions are met: ++ * * Redistributions of source code must retain the above copyright ++ * notice, this list of conditions and the following disclaimer. ++ * * 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. ++ * * Neither the name of Raspberry Pi nor the ++ * names of its contributors may be used to endorse or promote products ++ * derived from this software without specific prior written permission. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 <COPYRIGHT HOLDER> 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. ++ * ++ * This FIQ implements functionality that performs split transactions on ++ * the dwc_otg hardware without any outside intervention. A split transaction ++ * is "queued" by nominating a specific host channel to perform the entirety ++ * of a split transaction. This FIQ will then perform the microframe-precise ++ * scheduling required in each phase of the transaction until completion. ++ * ++ * The FIQ functionality is glued into the Synopsys driver via the entry point ++ * in the FSM enqueue function, and at the exit point in handling a HC interrupt ++ * for a FSM-enabled channel. ++ * ++ * NB: Large parts of this implementation have architecture-specific code. ++ * For porting this functionality to other ARM machines, the minimum is required: ++ * - An interrupt controller allowing the top-level dwc USB interrupt to be routed ++ * to the FIQ ++ * - A method of forcing a software generated interrupt from FIQ mode that then ++ * triggers an IRQ entry (with the dwc USB handler called by this IRQ number) ++ * - Guaranteed interrupt routing such that both the FIQ and SGI occur on the same ++ * processor core - there is no locking between the FIQ and IRQ (aside from ++ * local_fiq_disable) ++ * ++ */ ++ ++#include "dwc_otg_fiq_fsm.h" ++ ++ ++char buffer[1000*16]; ++int wptr; ++void notrace _fiq_print(enum fiq_debug_level dbg_lvl, volatile struct fiq_state *state, char *fmt, ...) ++{ ++ enum fiq_debug_level dbg_lvl_req = FIQDBG_ERR; ++ va_list args; ++ char text[17]; ++ hfnum_data_t hfnum = { .d32 = FIQ_READ(state->dwc_regs_base + 0x408) }; ++ ++ if((dbg_lvl & dbg_lvl_req) || dbg_lvl == FIQDBG_ERR) ++ { ++ snprintf(text, 9, " %4d:%1u ", hfnum.b.frnum/8, hfnum.b.frnum & 7); ++ va_start(args, fmt); ++ vsnprintf(text+8, 9, fmt, args); ++ va_end(args); ++ ++ memcpy(buffer + wptr, text, 16); ++ wptr = (wptr + 16) % sizeof(buffer); ++ } ++} ++ ++/** ++ * fiq_fsm_spin_lock() - ARMv6+ bare bones spinlock ++ * Must be called with local interrupts and FIQ disabled. ++ */ ++#if defined(CONFIG_ARCH_BCM2709) && defined(CONFIG_SMP) ++inline void fiq_fsm_spin_lock(fiq_lock_t *lock) ++{ ++ unsigned long tmp; ++ uint32_t newval; ++ fiq_lock_t lockval; ++ smp_mb__before_spinlock(); ++ /* Nested locking, yay. If we are on the same CPU as the fiq, then the disable ++ * will be sufficient. If we are on a different CPU, then the lock protects us. */ ++ prefetchw(&lock->slock); ++ asm volatile ( ++ "1: ldrex %0, [%3]\n" ++ " add %1, %0, %4\n" ++ " strex %2, %1, [%3]\n" ++ " teq %2, #0\n" ++ " bne 1b" ++ : "=&r" (lockval), "=&r" (newval), "=&r" (tmp) ++ : "r" (&lock->slock), "I" (1 << 16) ++ : "cc"); ++ ++ while (lockval.tickets.next != lockval.tickets.owner) { ++ wfe(); ++ lockval.tickets.owner = ACCESS_ONCE(lock->tickets.owner); ++ } ++ smp_mb(); ++} ++#else ++inline void fiq_fsm_spin_lock(fiq_lock_t *lock) { } ++#endif ++ ++/** ++ * fiq_fsm_spin_unlock() - ARMv6+ bare bones spinunlock ++ */ ++#if defined(CONFIG_ARCH_BCM2709) && defined(CONFIG_SMP) ++inline void fiq_fsm_spin_unlock(fiq_lock_t *lock) ++{ ++ smp_mb(); ++ lock->tickets.owner++; ++ dsb_sev(); ++} ++#else ++inline void fiq_fsm_spin_unlock(fiq_lock_t *lock) { } ++#endif ++ ++/** ++ * fiq_fsm_restart_channel() - Poke channel enable bit for a split transaction ++ * @channel: channel to re-enable ++ */ ++static void fiq_fsm_restart_channel(struct fiq_state *st, int n, int force) ++{ ++ hcchar_data_t hcchar = { .d32 = FIQ_READ(st->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCCHAR) }; ++ ++ hcchar.b.chen = 0; ++ if (st->channel[n].hcchar_copy.b.eptype & 0x1) { ++ hfnum_data_t hfnum = { .d32 = FIQ_READ(st->dwc_regs_base + HFNUM) }; ++ /* Hardware bug workaround: update the ssplit index */ ++ if (st->channel[n].hcsplt_copy.b.spltena) ++ st->channel[n].expected_uframe = (hfnum.b.frnum + 1) & 0x3FFF; ++ ++ hcchar.b.oddfrm = (hfnum.b.frnum & 0x1) ? 0 : 1; ++ } ++ ++ FIQ_WRITE(st->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCCHAR, hcchar.d32); ++ hcchar.d32 = FIQ_READ(st->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCCHAR); ++ hcchar.b.chen = 1; ++ ++ FIQ_WRITE(st->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCCHAR, hcchar.d32); ++ fiq_print(FIQDBG_INT, st, "HCGO %01d %01d", n, force); ++} ++ ++/** ++ * fiq_fsm_setup_csplit() - Prepare a host channel for a CSplit transaction stage ++ * @st: Pointer to the channel's state ++ * @n : channel number ++ * ++ * Change host channel registers to perform a complete-split transaction. Being mindful of the ++ * endpoint direction, set control regs up correctly. ++ */ ++static void notrace fiq_fsm_setup_csplit(struct fiq_state *st, int n) ++{ ++ hcsplt_data_t hcsplt = { .d32 = FIQ_READ(st->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCSPLT) }; ++ hctsiz_data_t hctsiz = { .d32 = FIQ_READ(st->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCTSIZ) }; ++ ++ hcsplt.b.compsplt = 1; ++ if (st->channel[n].hcchar_copy.b.epdir == 1) { ++ // If IN, the CSPLIT result contains the data or a hub handshake. hctsiz = maxpacket. ++ hctsiz.b.xfersize = st->channel[n].hctsiz_copy.b.xfersize; ++ } else { ++ // If OUT, the CSPLIT result contains handshake only. ++ hctsiz.b.xfersize = 0; ++ } ++ FIQ_WRITE(st->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCSPLT, hcsplt.d32); ++ FIQ_WRITE(st->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCTSIZ, hctsiz.d32); ++ mb(); ++} ++ ++static inline int notrace fiq_get_xfer_len(struct fiq_state *st, int n) ++{ ++ /* The xfersize register is a bit wonky. For IN transfers, it decrements by the packet size. */ ++ hctsiz_data_t hctsiz = { .d32 = FIQ_READ(st->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCTSIZ) }; ++ ++ if (st->channel[n].hcchar_copy.b.epdir == 0) { ++ return st->channel[n].hctsiz_copy.b.xfersize; ++ } else { ++ return st->channel[n].hctsiz_copy.b.xfersize - hctsiz.b.xfersize; ++ } ++ ++} ++ ++ ++/** ++ * fiq_increment_dma_buf() - update DMA address for bounce buffers after a CSPLIT ++ * ++ * Of use only for IN periodic transfers. ++ */ ++static int notrace fiq_increment_dma_buf(struct fiq_state *st, int num_channels, int n) ++{ ++ hcdma_data_t hcdma; ++ int i = st->channel[n].dma_info.index; ++ int len; ++ struct fiq_dma_blob *blob = (struct fiq_dma_blob *) st->dma_base; ++ ++ len = fiq_get_xfer_len(st, n); ++ fiq_print(FIQDBG_INT, st, "LEN: %03d", len); ++ st->channel[n].dma_info.slot_len[i] = len; ++ i++; ++ if (i > 6) ++ BUG(); ++ ++ hcdma.d32 = (dma_addr_t) &blob->channel[n].index[i].buf[0]; ++ FIQ_WRITE(st->dwc_regs_base + HC_DMA + (HC_OFFSET * n), hcdma.d32); ++ st->channel[n].dma_info.index = i; ++ return 0; ++} ++ ++/** ++ * fiq_reload_hctsiz() - for IN transactions, reset HCTSIZ ++ */ ++static void notrace fiq_fsm_reload_hctsiz(struct fiq_state *st, int n) ++{ ++ hctsiz_data_t hctsiz = { .d32 = FIQ_READ(st->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCTSIZ) }; ++ hctsiz.b.xfersize = st->channel[n].hctsiz_copy.b.xfersize; ++ hctsiz.b.pktcnt = 1; ++ FIQ_WRITE(st->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCTSIZ, hctsiz.d32); ++} ++ ++/** ++ * fiq_iso_out_advance() - update DMA address and split position bits ++ * for isochronous OUT transactions. ++ * ++ * Returns 1 if this is the last packet queued, 0 otherwise. Split-ALL and ++ * Split-BEGIN states are not handled - this is done when the transaction was queued. ++ * ++ * This function must only be called from the FIQ_ISO_OUT_ACTIVE state. ++ */ ++static int notrace fiq_iso_out_advance(struct fiq_state *st, int num_channels, int n) ++{ ++ hcsplt_data_t hcsplt; ++ hctsiz_data_t hctsiz; ++ hcdma_data_t hcdma; ++ struct fiq_dma_blob *blob = (struct fiq_dma_blob *) st->dma_base; ++ int last = 0; ++ int i = st->channel[n].dma_info.index; ++ ++ fiq_print(FIQDBG_INT, st, "ADV %01d %01d ", n, i); ++ i++; ++ if (i == 4) ++ last = 1; ++ if (st->channel[n].dma_info.slot_len[i+1] == 255) ++ last = 1; ++ ++ /* New DMA address - address of bounce buffer referred to in index */ ++ hcdma.d32 = (uint32_t) &blob->channel[n].index[i].buf[0]; ++ //hcdma.d32 = FIQ_READ(st->dwc_regs_base + HC_DMA + (HC_OFFSET * n)); ++ //hcdma.d32 += st->channel[n].dma_info.slot_len[i]; ++ fiq_print(FIQDBG_INT, st, "LAST: %01d ", last); ++ fiq_print(FIQDBG_INT, st, "LEN: %03d", st->channel[n].dma_info.slot_len[i]); ++ hcsplt.d32 = FIQ_READ(st->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCSPLT); ++ hctsiz.d32 = FIQ_READ(st->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCTSIZ); ++ hcsplt.b.xactpos = (last) ? ISOC_XACTPOS_END : ISOC_XACTPOS_MID; ++ /* Set up new packet length */ ++ hctsiz.b.pktcnt = 1; ++ hctsiz.b.xfersize = st->channel[n].dma_info.slot_len[i]; ++ fiq_print(FIQDBG_INT, st, "%08x", hctsiz.d32); ++ ++ st->channel[n].dma_info.index++; ++ FIQ_WRITE(st->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCSPLT, hcsplt.d32); ++ FIQ_WRITE(st->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCTSIZ, hctsiz.d32); ++ FIQ_WRITE(st->dwc_regs_base + HC_DMA + (HC_OFFSET * n), hcdma.d32); ++ return last; ++} ++ ++/** ++ * fiq_fsm_tt_next_isoc() - queue next pending isochronous out start-split on a TT ++ * ++ * Despite the limitations of the DWC core, we can force a microframe pipeline of ++ * isochronous OUT start-split transactions while waiting for a corresponding other-type ++ * of endpoint to finish its CSPLITs. TTs have big periodic buffers therefore it ++ * is very unlikely that filling the start-split FIFO will cause data loss. ++ * This allows much better interleaving of transactions in an order-independent way- ++ * there is no requirement to prioritise isochronous, just a state-space search has ++ * to be performed on each periodic start-split complete interrupt. ++ */ ++static int notrace fiq_fsm_tt_next_isoc(struct fiq_state *st, int num_channels, int n) ++{ ++ int hub_addr = st->channel[n].hub_addr; ++ int port_addr = st->channel[n].port_addr; ++ int i, poked = 0; ++ for (i = 0; i < num_channels; i++) { ++ if (i == n || st->channel[i].fsm == FIQ_PASSTHROUGH) ++ continue; ++ if (st->channel[i].hub_addr == hub_addr && ++ st->channel[i].port_addr == port_addr) { ++ switch (st->channel[i].fsm) { ++ case FIQ_PER_ISO_OUT_PENDING: ++ if (st->channel[i].nrpackets == 1) { ++ st->channel[i].fsm = FIQ_PER_ISO_OUT_LAST; ++ } else { ++ st->channel[i].fsm = FIQ_PER_ISO_OUT_ACTIVE; ++ } ++ fiq_fsm_restart_channel(st, i, 0); ++ poked = 1; ++ break; ++ ++ default: ++ break; ++ } ++ } ++ if (poked) ++ break; ++ } ++ return poked; ++} ++ ++/** ++ * fiq_fsm_tt_in_use() - search for host channels using this TT ++ * @n: Channel to use as reference ++ * ++ */ ++int notrace noinline fiq_fsm_tt_in_use(struct fiq_state *st, int num_channels, int n) ++{ ++ int hub_addr = st->channel[n].hub_addr; ++ int port_addr = st->channel[n].port_addr; ++ int i, in_use = 0; ++ for (i = 0; i < num_channels; i++) { ++ if (i == n || st->channel[i].fsm == FIQ_PASSTHROUGH) ++ continue; ++ switch (st->channel[i].fsm) { ++ /* TT is reserved for channels that are in the middle of a periodic ++ * split transaction. ++ */ ++ case FIQ_PER_SSPLIT_STARTED: ++ case FIQ_PER_CSPLIT_WAIT: ++ case FIQ_PER_CSPLIT_NYET1: ++ //case FIQ_PER_CSPLIT_POLL: ++ case FIQ_PER_ISO_OUT_ACTIVE: ++ case FIQ_PER_ISO_OUT_LAST: ++ if (st->channel[i].hub_addr == hub_addr && ++ st->channel[i].port_addr == port_addr) { ++ in_use = 1; ++ } ++ break; ++ default: ++ break; ++ } ++ if (in_use) ++ break; ++ } ++ return in_use; ++} ++ ++/** ++ * fiq_fsm_more_csplits() - determine whether additional CSPLITs need ++ * to be issued for this IN transaction. ++ * ++ * We cannot tell the inbound PID of a data packet due to hardware limitations. ++ * we need to make an educated guess as to whether we need to queue another CSPLIT ++ * or not. A no-brainer is when we have received enough data to fill the endpoint ++ * size, but for endpoints that give variable-length data then we have to resort ++ * to heuristics. ++ * ++ * We also return whether this is the last CSPLIT to be queued, again based on ++ * heuristics. This is to allow a 1-uframe overlap of periodic split transactions. ++ * Note: requires at least 1 CSPLIT to have been performed prior to being called. ++ */ ++ ++/* ++ * We need some way of guaranteeing if a returned periodic packet of size X ++ * has a DATA0 PID. ++ * The heuristic value of 144 bytes assumes that the received data has maximal ++ * bit-stuffing and the clock frequency of the transmitting device is at the lowest ++ * permissible limit. If the transfer length results in a final packet size ++ * 144 < p <= 188, then an erroneous CSPLIT will be issued. ++ * Also used to ensure that an endpoint will nominally only return a single ++ * complete-split worth of data. ++ */ ++#define DATA0_PID_HEURISTIC 144 ++ ++static int notrace noinline fiq_fsm_more_csplits(struct fiq_state *state, int n, int *probably_last) ++{ ++ ++ int i; ++ int total_len = 0; ++ int more_needed = 1; ++ struct fiq_channel_state *st = &state->channel[n]; ++ ++ for (i = 0; i < st->dma_info.index; i++) { ++ total_len += st->dma_info.slot_len[i]; ++ } ++ ++ *probably_last = 0; ++ ++ if (st->hcchar_copy.b.eptype == 0x3) { ++ /* ++ * An interrupt endpoint will take max 2 CSPLITs. if we are receiving data ++ * then this is definitely the last CSPLIT. ++ */ ++ *probably_last = 1; ++ } else { ++ /* Isoc IN. This is a bit risky if we are the first transaction: ++ * we may have been held off slightly. */ ++ if (i > 1 && st->dma_info.slot_len[st->dma_info.index-1] <= DATA0_PID_HEURISTIC) { ++ more_needed = 0; ++ } ++ /* If in the next uframe we will receive enough data to fill the endpoint, ++ * then only issue 1 more csplit. ++ */ ++ if (st->hctsiz_copy.b.xfersize - total_len <= DATA0_PID_HEURISTIC) ++ *probably_last = 1; ++ } ++ ++ if (total_len >= st->hctsiz_copy.b.xfersize || ++ i == 6 || total_len == 0) ++ /* Note: due to bit stuffing it is possible to have > 6 CSPLITs for ++ * a single endpoint. Accepting more would completely break our scheduling mechanism though ++ * - in these extreme cases we will pass through a truncated packet. ++ */ ++ more_needed = 0; ++ ++ return more_needed; ++} ++ ++/** ++ * fiq_fsm_too_late() - Test transaction for lateness ++ * ++ * If a SSPLIT for a large IN transaction is issued too late in a frame, ++ * the hub will disable the port to the device and respond with ERR handshakes. ++ * The hub status endpoint will not reflect this change. ++ * Returns 1 if we will issue a SSPLIT that will result in a device babble. ++ */ ++int notrace fiq_fsm_too_late(struct fiq_state *st, int n) ++{ ++ int uframe; ++ hfnum_data_t hfnum = { .d32 = FIQ_READ(st->dwc_regs_base + HFNUM) }; ++ uframe = hfnum.b.frnum & 0x7; ++ if ((uframe < 6) && (st->channel[n].nrpackets + 1 + uframe > 7)) { ++ return 1; ++ } else { ++ return 0; ++ } ++} ++ ++ ++/** ++ * fiq_fsm_start_next_periodic() - A half-arsed attempt at a microframe pipeline ++ * ++ * Search pending transactions in the start-split pending state and queue them. ++ * Don't queue packets in uframe .5 (comes out in .6) (USB2.0 11.18.4). ++ * Note: we specifically don't do isochronous OUT transactions first because better ++ * use of the TT's start-split fifo can be achieved by pipelining an IN before an OUT. ++ */ ++static void notrace noinline fiq_fsm_start_next_periodic(struct fiq_state *st, int num_channels) ++{ ++ int n; ++ hfnum_data_t hfnum = { .d32 = FIQ_READ(st->dwc_regs_base + HFNUM) }; ++ if ((hfnum.b.frnum & 0x7) == 5) ++ return; ++ for (n = 0; n < num_channels; n++) { ++ if (st->channel[n].fsm == FIQ_PER_SSPLIT_QUEUED) { ++ /* Check to see if any other transactions are using this TT */ ++ if(!fiq_fsm_tt_in_use(st, num_channels, n)) { ++ if (!fiq_fsm_too_late(st, n)) { ++ st->channel[n].fsm = FIQ_PER_SSPLIT_STARTED; ++ fiq_print(FIQDBG_INT, st, "NEXTPER "); ++ fiq_fsm_restart_channel(st, n, 0); ++ } else { ++ st->channel[n].fsm = FIQ_PER_SPLIT_TIMEOUT; ++ } ++ break; ++ } ++ } ++ } ++ for (n = 0; n < num_channels; n++) { ++ if (st->channel[n].fsm == FIQ_PER_ISO_OUT_PENDING) { ++ if (!fiq_fsm_tt_in_use(st, num_channels, n)) { ++ fiq_print(FIQDBG_INT, st, "NEXTISO "); ++ st->channel[n].fsm = FIQ_PER_ISO_OUT_ACTIVE; ++ fiq_fsm_restart_channel(st, n, 0); ++ break; ++ } ++ } ++ } ++} ++ ++/** ++ * fiq_fsm_update_hs_isoc() - update isochronous frame and transfer data ++ * @state: Pointer to fiq_state ++ * @n: Channel transaction is active on ++ * @hcint: Copy of host channel interrupt register ++ * ++ * Returns 0 if there are no more transactions for this HC to do, 1 ++ * otherwise. ++ */ ++static int notrace noinline fiq_fsm_update_hs_isoc(struct fiq_state *state, int n, hcint_data_t hcint) ++{ ++ struct fiq_channel_state *st = &state->channel[n]; ++ int xfer_len = 0, nrpackets = 0; ++ hcdma_data_t hcdma; ++ fiq_print(FIQDBG_INT, state, "HSISO %02d", n); ++ ++ xfer_len = fiq_get_xfer_len(state, n); ++ st->hs_isoc_info.iso_desc[st->hs_isoc_info.index].actual_length = xfer_len; ++ ++ st->hs_isoc_info.iso_desc[st->hs_isoc_info.index].status = hcint.d32; ++ ++ st->hs_isoc_info.index++; ++ if (st->hs_isoc_info.index == st->hs_isoc_info.nrframes) { ++ return 0; ++ } ++ ++ /* grab the next DMA address offset from the array */ ++ hcdma.d32 = st->hcdma_copy.d32 + st->hs_isoc_info.iso_desc[st->hs_isoc_info.index].offset; ++ FIQ_WRITE(state->dwc_regs_base + HC_DMA + (HC_OFFSET * n), hcdma.d32); ++ ++ /* We need to set multi_count. This is a bit tricky - has to be set per-transaction as ++ * the core needs to be told to send the correct number. Caution: for IN transfers, ++ * this is always set to the maximum size of the endpoint. */ ++ xfer_len = st->hs_isoc_info.iso_desc[st->hs_isoc_info.index].length; ++ /* Integer divide in a FIQ: fun. FIXME: make this not suck */ ++ nrpackets = (xfer_len + st->hcchar_copy.b.mps - 1) / st->hcchar_copy.b.mps; ++ if (nrpackets == 0) ++ nrpackets = 1; ++ st->hcchar_copy.b.multicnt = nrpackets; ++ st->hctsiz_copy.b.pktcnt = nrpackets; ++ ++ /* Initial PID also needs to be set */ ++ if (st->hcchar_copy.b.epdir == 0) { ++ st->hctsiz_copy.b.xfersize = xfer_len; ++ switch (st->hcchar_copy.b.multicnt) { ++ case 1: ++ st->hctsiz_copy.b.pid = DWC_PID_DATA0; ++ break; ++ case 2: ++ case 3: ++ st->hctsiz_copy.b.pid = DWC_PID_MDATA; ++ break; ++ } ++ ++ } else { ++ switch (st->hcchar_copy.b.multicnt) { ++ st->hctsiz_copy.b.xfersize = nrpackets * st->hcchar_copy.b.mps; ++ case 1: ++ st->hctsiz_copy.b.pid = DWC_PID_DATA0; ++ break; ++ case 2: ++ st->hctsiz_copy.b.pid = DWC_PID_DATA1; ++ break; ++ case 3: ++ st->hctsiz_copy.b.pid = DWC_PID_DATA2; ++ break; ++ } ++ } ++ FIQ_WRITE(state->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCTSIZ, st->hctsiz_copy.d32); ++ FIQ_WRITE(state->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCCHAR, st->hcchar_copy.d32); ++ /* Channel is enabled on hcint handler exit */ ++ fiq_print(FIQDBG_INT, state, "HSISOOUT"); ++ return 1; ++} ++ ++ ++/** ++ * fiq_fsm_do_sof() - FSM start-of-frame interrupt handler ++ * @state: Pointer to the state struct passed from banked FIQ mode registers. ++ * @num_channels: set according to the DWC hardware configuration ++ * ++ * The SOF handler in FSM mode has two functions ++ * 1. Hold off SOF from causing schedule advancement in IRQ context if there's ++ * nothing to do ++ * 2. Advance certain FSM states that require either a microframe delay, or a microframe ++ * of holdoff. ++ * ++ * The second part is architecture-specific to mach-bcm2835 - ++ * a sane interrupt controller would have a mask register for ARM interrupt sources ++ * to be promoted to the nFIQ line, but it doesn't. Instead a single interrupt ++ * number (USB) can be enabled. This means that certain parts of the USB specification ++ * that require "wait a little while, then issue another packet" cannot be fulfilled with ++ * the timing granularity required to achieve optimal throughout. The workaround is to use ++ * the SOF "timer" (125uS) to perform this task. ++ */ ++static int notrace noinline fiq_fsm_do_sof(struct fiq_state *state, int num_channels) ++{ ++ hfnum_data_t hfnum = { .d32 = FIQ_READ(state->dwc_regs_base + HFNUM) }; ++ int n; ++ int kick_irq = 0; ++ ++ if ((hfnum.b.frnum & 0x7) == 1) { ++ /* We cannot issue csplits for transactions in the last frame past (n+1).1 ++ * Check to see if there are any transactions that are stale. ++ * Boot them out. ++ */ ++ for (n = 0; n < num_channels; n++) { ++ switch (state->channel[n].fsm) { ++ case FIQ_PER_CSPLIT_WAIT: ++ case FIQ_PER_CSPLIT_NYET1: ++ case FIQ_PER_CSPLIT_POLL: ++ case FIQ_PER_CSPLIT_LAST: ++ /* Check if we are no longer in the same full-speed frame. */ ++ if (((state->channel[n].expected_uframe & 0x3FFF) & ~0x7) < ++ (hfnum.b.frnum & ~0x7)) ++ state->channel[n].fsm = FIQ_PER_SPLIT_TIMEOUT; ++ break; ++ default: ++ break; ++ } ++ } ++ } ++ ++ for (n = 0; n < num_channels; n++) { ++ switch (state->channel[n].fsm) { ++ ++ case FIQ_NP_SSPLIT_RETRY: ++ case FIQ_NP_IN_CSPLIT_RETRY: ++ case FIQ_NP_OUT_CSPLIT_RETRY: ++ fiq_fsm_restart_channel(state, n, 0); ++ break; ++ ++ case FIQ_HS_ISOC_SLEEPING: ++ /* Is it time to wake this channel yet? */ ++ if (--state->channel[n].uframe_sleeps == 0) { ++ state->channel[n].fsm = FIQ_HS_ISOC_TURBO; ++ fiq_fsm_restart_channel(state, n, 0); ++ } ++ break; ++ ++ case FIQ_PER_SSPLIT_QUEUED: ++ if ((hfnum.b.frnum & 0x7) == 5) ++ break; ++ if(!fiq_fsm_tt_in_use(state, num_channels, n)) { ++ if (!fiq_fsm_too_late(state, n)) { ++ fiq_print(FIQDBG_INT, state, "SOF GO %01d", n); ++ fiq_fsm_restart_channel(state, n, 0); ++ state->channel[n].fsm = FIQ_PER_SSPLIT_STARTED; ++ } else { ++ /* Transaction cannot be started without risking a device babble error */ ++ state->channel[n].fsm = FIQ_PER_SPLIT_TIMEOUT; ++ state->haintmsk_saved.b2.chint &= ~(1 << n); ++ FIQ_WRITE(state->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCINTMSK, 0); ++ kick_irq |= 1; ++ } ++ } ++ break; ++ ++ case FIQ_PER_ISO_OUT_PENDING: ++ /* Ordinarily, this should be poked after the SSPLIT ++ * complete interrupt for a competing transfer on the same ++ * TT. Doesn't happen for aborted transactions though. ++ */ ++ if ((hfnum.b.frnum & 0x7) >= 5) ++ break; ++ if (!fiq_fsm_tt_in_use(state, num_channels, n)) { ++ /* Hardware bug. SOF can sometimes occur after the channel halt interrupt ++ * that caused this. ++ */ ++ fiq_fsm_restart_channel(state, n, 0); ++ fiq_print(FIQDBG_INT, state, "SOF ISOC"); ++ if (state->channel[n].nrpackets == 1) { ++ state->channel[n].fsm = FIQ_PER_ISO_OUT_LAST; ++ } else { ++ state->channel[n].fsm = FIQ_PER_ISO_OUT_ACTIVE; ++ } ++ } ++ break; ++ ++ case FIQ_PER_CSPLIT_WAIT: ++ /* we are guaranteed to be in this state if and only if the SSPLIT interrupt ++ * occurred when the bus transaction occurred. The SOF interrupt reversal bug ++ * will utterly bugger this up though. ++ */ ++ if (hfnum.b.frnum != state->channel[n].expected_uframe) { ++ fiq_print(FIQDBG_INT, state, "SOFCS %d ", n); ++ state->channel[n].fsm = FIQ_PER_CSPLIT_POLL; ++ fiq_fsm_restart_channel(state, n, 0); ++ fiq_fsm_start_next_periodic(state, num_channels); ++ ++ } ++ break; ++ ++ case FIQ_PER_SPLIT_TIMEOUT: ++ case FIQ_DEQUEUE_ISSUED: ++ /* Ugly: we have to force a HCD interrupt. ++ * Poke the mask for the channel in question. ++ * We will take a fake SOF because of this, but ++ * that's OK. ++ */ ++ state->haintmsk_saved.b2.chint &= ~(1 << n); ++ FIQ_WRITE(state->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCINTMSK, 0); ++ kick_irq |= 1; ++ break; ++ ++ default: ++ break; ++ } ++ } ++ ++ if (state->kick_np_queues || ++ dwc_frame_num_le(state->next_sched_frame, hfnum.b.frnum)) ++ kick_irq |= 1; ++ ++ return !kick_irq; ++} ++ ++ ++/** ++ * fiq_fsm_do_hcintr() - FSM host channel interrupt handler ++ * @state: Pointer to the FIQ state struct ++ * @num_channels: Number of channels as per hardware config ++ * @n: channel for which HAINT(i) was raised ++ * ++ * An important property is that only the CHHLT interrupt is unmasked. Unfortunately, AHBerr is as well. ++ */ ++static int notrace noinline fiq_fsm_do_hcintr(struct fiq_state *state, int num_channels, int n) ++{ ++ hcint_data_t hcint; ++ hcintmsk_data_t hcintmsk; ++ hcint_data_t hcint_probe; ++ hcchar_data_t hcchar; ++ int handled = 0; ++ int restart = 0; ++ int last_csplit = 0; ++ int start_next_periodic = 0; ++ struct fiq_channel_state *st = &state->channel[n]; ++ hfnum_data_t hfnum; ++ ++ hcint.d32 = FIQ_READ(state->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCINT); ++ hcintmsk.d32 = FIQ_READ(state->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCINTMSK); ++ hcint_probe.d32 = hcint.d32 & hcintmsk.d32; ++ ++ if (st->fsm != FIQ_PASSTHROUGH) { ++ fiq_print(FIQDBG_INT, state, "HC%01d ST%02d", n, st->fsm); ++ fiq_print(FIQDBG_INT, state, "%08x", hcint.d32); ++ } ++ ++ switch (st->fsm) { ++ ++ case FIQ_PASSTHROUGH: ++ case FIQ_DEQUEUE_ISSUED: ++ /* doesn't belong to us, kick it upstairs */ ++ break; ++ ++ case FIQ_PASSTHROUGH_ERRORSTATE: ++ /* We are here to emulate the error recovery mechanism of the dwc HCD. ++ * Several interrupts are unmasked if a previous transaction failed - it's ++ * death for the FIQ to attempt to handle them as the channel isn't halted. ++ * Emulate what the HCD does in this situation: mask and continue. ++ * The FSM has no other state setup so this has to be handled out-of-band. ++ */ ++ fiq_print(FIQDBG_ERR, state, "ERRST %02d", n); ++ if (hcint_probe.b.nak || hcint_probe.b.ack || hcint_probe.b.datatglerr) { ++ fiq_print(FIQDBG_ERR, state, "RESET %02d", n); ++ /* In some random cases we can get a NAK interrupt coincident with a Xacterr ++ * interrupt, after the device has disappeared. ++ */ ++ if (!hcint.b.xacterr) ++ st->nr_errors = 0; ++ hcintmsk.b.nak = 0; ++ hcintmsk.b.ack = 0; ++ hcintmsk.b.datatglerr = 0; ++ FIQ_WRITE(state->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCINTMSK, hcintmsk.d32); ++ return 1; ++ } ++ if (hcint_probe.b.chhltd) { ++ fiq_print(FIQDBG_ERR, state, "CHHLT %02d", n); ++ fiq_print(FIQDBG_ERR, state, "%08x", hcint.d32); ++ return 0; ++ } ++ break; ++ ++ /* Non-periodic state groups */ ++ case FIQ_NP_SSPLIT_STARTED: ++ case FIQ_NP_SSPLIT_RETRY: ++ /* Got a HCINT for a NP SSPLIT. Expected ACK / NAK / fail */ ++ if (hcint.b.ack) { ++ /* SSPLIT complete. For OUT, the data has been sent. For IN, the LS transaction ++ * will start shortly. SOF needs to kick the transaction to prevent a NYET flood. ++ */ ++ if(st->hcchar_copy.b.epdir == 1) ++ st->fsm = FIQ_NP_IN_CSPLIT_RETRY; ++ else ++ st->fsm = FIQ_NP_OUT_CSPLIT_RETRY; ++ st->nr_errors = 0; ++ handled = 1; ++ fiq_fsm_setup_csplit(state, n); ++ } else if (hcint.b.nak) { ++ // No buffer space in TT. Retry on a uframe boundary. ++ st->fsm = FIQ_NP_SSPLIT_RETRY; ++ handled = 1; ++ } else if (hcint.b.xacterr) { ++ // The only other one we care about is xacterr. This implies HS bus error - retry. ++ st->nr_errors++; ++ st->fsm = FIQ_NP_SSPLIT_RETRY; ++ if (st->nr_errors >= 3) { ++ st->fsm = FIQ_NP_SPLIT_HS_ABORTED; ++ } else { ++ handled = 1; ++ restart = 1; ++ } ++ } else { ++ st->fsm = FIQ_NP_SPLIT_LS_ABORTED; ++ handled = 0; ++ restart = 0; ++ } ++ break; ++ ++ case FIQ_NP_IN_CSPLIT_RETRY: ++ /* Received a CSPLIT done interrupt. ++ * Expected Data/NAK/STALL/NYET for IN. ++ */ ++ if (hcint.b.xfercomp) { ++ /* For IN, data is present. */ ++ st->fsm = FIQ_NP_SPLIT_DONE; ++ } else if (hcint.b.nak) { ++ /* no endpoint data. Punt it upstairs */ ++ st->fsm = FIQ_NP_SPLIT_DONE; ++ } else if (hcint.b.nyet) { ++ /* CSPLIT NYET - retry on a uframe boundary. */ ++ handled = 1; ++ st->nr_errors = 0; ++ } else if (hcint.b.datatglerr) { ++ /* data toggle errors do not set the xfercomp bit. */ ++ st->fsm = FIQ_NP_SPLIT_LS_ABORTED; ++ } else if (hcint.b.xacterr) { ++ /* HS error. Retry immediate */ ++ st->fsm = FIQ_NP_IN_CSPLIT_RETRY; ++ st->nr_errors++; ++ if (st->nr_errors >= 3) { ++ st->fsm = FIQ_NP_SPLIT_HS_ABORTED; ++ } else { ++ handled = 1; ++ restart = 1; ++ } ++ } else if (hcint.b.stall || hcint.b.bblerr) { ++ /* A STALL implies either a LS bus error or a genuine STALL. */ ++ st->fsm = FIQ_NP_SPLIT_LS_ABORTED; ++ } else { ++ /* Hardware bug. It's possible in some cases to ++ * get a channel halt with nothing else set when ++ * the response was a NYET. Treat as local 3-strikes retry. ++ */ ++ hcint_data_t hcint_test = hcint; ++ hcint_test.b.chhltd = 0; ++ if (!hcint_test.d32) { ++ st->nr_errors++; ++ if (st->nr_errors >= 3) { ++ st->fsm = FIQ_NP_SPLIT_HS_ABORTED; ++ } else { ++ handled = 1; ++ } ++ } else { ++ /* Bail out if something unexpected happened */ ++ st->fsm = FIQ_NP_SPLIT_HS_ABORTED; ++ } ++ } ++ break; ++ ++ case FIQ_NP_OUT_CSPLIT_RETRY: ++ /* Received a CSPLIT done interrupt. ++ * Expected ACK/NAK/STALL/NYET/XFERCOMP for OUT.*/ ++ if (hcint.b.xfercomp) { ++ st->fsm = FIQ_NP_SPLIT_DONE; ++ } else if (hcint.b.nak) { ++ // The HCD will implement the holdoff on frame boundaries. ++ st->fsm = FIQ_NP_SPLIT_DONE; ++ } else if (hcint.b.nyet) { ++ // Hub still processing. ++ st->fsm = FIQ_NP_OUT_CSPLIT_RETRY; ++ handled = 1; ++ st->nr_errors = 0; ++ //restart = 1; ++ } else if (hcint.b.xacterr) { ++ /* HS error. retry immediate */ ++ st->fsm = FIQ_NP_OUT_CSPLIT_RETRY; ++ st->nr_errors++; ++ if (st->nr_errors >= 3) { ++ st->fsm = FIQ_NP_SPLIT_HS_ABORTED; ++ } else { ++ handled = 1; ++ restart = 1; ++ } ++ } else if (hcint.b.stall) { ++ /* LS bus error or genuine stall */ ++ st->fsm = FIQ_NP_SPLIT_LS_ABORTED; ++ } else { ++ /* ++ * Hardware bug. It's possible in some cases to get a ++ * channel halt with nothing else set when the response was a NYET. ++ * Treat as local 3-strikes retry. ++ */ ++ hcint_data_t hcint_test = hcint; ++ hcint_test.b.chhltd = 0; ++ if (!hcint_test.d32) { ++ st->nr_errors++; ++ if (st->nr_errors >= 3) { ++ st->fsm = FIQ_NP_SPLIT_HS_ABORTED; ++ } else { ++ handled = 1; ++ } ++ } else { ++ // Something unexpected happened. AHBerror or babble perhaps. Let the IRQ deal with it. ++ st->fsm = FIQ_NP_SPLIT_HS_ABORTED; ++ } ++ } ++ break; ++ ++ /* Periodic split states (except isoc out) */ ++ case FIQ_PER_SSPLIT_STARTED: ++ /* Expect an ACK or failure for SSPLIT */ ++ if (hcint.b.ack) { ++ /* ++ * SSPLIT transfer complete interrupt - the generation of this interrupt is fraught with bugs. ++ * For a packet queued in microframe n-3 to appear in n-2, if the channel is enabled near the EOF1 ++ * point for microframe n-3, the packet will not appear on the bus until microframe n. ++ * Additionally, the generation of the actual interrupt is dodgy. For a packet appearing on the bus ++ * in microframe n, sometimes the interrupt is generated immediately. Sometimes, it appears in n+1 ++ * coincident with SOF for n+1. ++ * SOF is also buggy. It can sometimes be raised AFTER the first bus transaction has taken place. ++ * These appear to be caused by timing/clock crossing bugs within the core itself. ++ * State machine workaround. ++ */ ++ hfnum.d32 = FIQ_READ(state->dwc_regs_base + HFNUM); ++ hcchar.d32 = FIQ_READ(state->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCCHAR); ++ fiq_fsm_setup_csplit(state, n); ++ /* Poke the oddfrm bit. If we are equivalent, we received the interrupt at the correct ++ * time. If not, then we're in the next SOF. ++ */ ++ if ((hfnum.b.frnum & 0x1) == hcchar.b.oddfrm) { ++ fiq_print(FIQDBG_INT, state, "CSWAIT %01d", n); ++ st->expected_uframe = hfnum.b.frnum; ++ st->fsm = FIQ_PER_CSPLIT_WAIT; ++ } else { ++ fiq_print(FIQDBG_INT, state, "CSPOL %01d", n); ++ /* For isochronous IN endpoints, ++ * we need to hold off if we are expecting a lot of data */ ++ if (st->hcchar_copy.b.mps < DATA0_PID_HEURISTIC) { ++ start_next_periodic = 1; ++ } ++ /* Danger will robinson: we are in a broken state. If our first interrupt after ++ * this is a NYET, it will be delayed by 1 uframe and result in an unrecoverable ++ * lag. Unmask the NYET interrupt. ++ */ ++ st->expected_uframe = (hfnum.b.frnum + 1) & 0x3FFF; ++ st->fsm = FIQ_PER_CSPLIT_BROKEN_NYET1; ++ restart = 1; ++ } ++ handled = 1; ++ } else if (hcint.b.xacterr) { ++ /* 3-strikes retry is enabled, we have hit our max nr_errors */ ++ st->fsm = FIQ_PER_SPLIT_HS_ABORTED; ++ start_next_periodic = 1; ++ } else { ++ st->fsm = FIQ_PER_SPLIT_HS_ABORTED; ++ start_next_periodic = 1; ++ } ++ /* We can now queue the next isochronous OUT transaction, if one is pending. */ ++ if(fiq_fsm_tt_next_isoc(state, num_channels, n)) { ++ fiq_print(FIQDBG_INT, state, "NEXTISO "); ++ } ++ break; ++ ++ case FIQ_PER_CSPLIT_NYET1: ++ /* First CSPLIT attempt was a NYET. If we get a subsequent NYET, ++ * we are too late and the TT has dropped its CSPLIT fifo. ++ */ ++ hfnum.d32 = FIQ_READ(state->dwc_regs_base + HFNUM); ++ hcchar.d32 = FIQ_READ(state->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCCHAR); ++ start_next_periodic = 1; ++ if (hcint.b.nak) { ++ st->fsm = FIQ_PER_SPLIT_DONE; ++ } else if (hcint.b.xfercomp) { ++ fiq_increment_dma_buf(state, num_channels, n); ++ st->fsm = FIQ_PER_CSPLIT_POLL; ++ st->nr_errors = 0; ++ if (fiq_fsm_more_csplits(state, n, &last_csplit)) { ++ handled = 1; ++ restart = 1; ++ if (!last_csplit) ++ start_next_periodic = 0; ++ } else { ++ st->fsm = FIQ_PER_SPLIT_DONE; ++ } ++ } else if (hcint.b.nyet) { ++ /* Doh. Data lost. */ ++ st->fsm = FIQ_PER_SPLIT_NYET_ABORTED; ++ } else if (hcint.b.xacterr || hcint.b.stall || hcint.b.bblerr) { ++ st->fsm = FIQ_PER_SPLIT_LS_ABORTED; ++ } else { ++ st->fsm = FIQ_PER_SPLIT_HS_ABORTED; ++ } ++ break; ++ ++ case FIQ_PER_CSPLIT_BROKEN_NYET1: ++ /* ++ * we got here because our host channel is in the delayed-interrupt ++ * state and we cannot take a NYET interrupt any later than when it ++ * occurred. Disable then re-enable the channel if this happens to force ++ * CSPLITs to occur at the right time. ++ */ ++ hfnum.d32 = FIQ_READ(state->dwc_regs_base + HFNUM); ++ hcchar.d32 = FIQ_READ(state->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCCHAR); ++ fiq_print(FIQDBG_INT, state, "BROK: %01d ", n); ++ if (hcint.b.nak) { ++ st->fsm = FIQ_PER_SPLIT_DONE; ++ start_next_periodic = 1; ++ } else if (hcint.b.xfercomp) { ++ fiq_increment_dma_buf(state, num_channels, n); ++ if (fiq_fsm_more_csplits(state, n, &last_csplit)) { ++ st->fsm = FIQ_PER_CSPLIT_POLL; ++ handled = 1; ++ restart = 1; ++ start_next_periodic = 1; ++ /* Reload HCTSIZ for the next transfer */ ++ fiq_fsm_reload_hctsiz(state, n); ++ if (!last_csplit) ++ start_next_periodic = 0; ++ } else { ++ st->fsm = FIQ_PER_SPLIT_DONE; ++ } ++ } else if (hcint.b.nyet) { ++ st->fsm = FIQ_PER_SPLIT_NYET_ABORTED; ++ start_next_periodic = 1; ++ } else if (hcint.b.xacterr || hcint.b.stall || hcint.b.bblerr) { ++ /* Local 3-strikes retry is handled by the core. This is a ERR response.*/ ++ st->fsm = FIQ_PER_SPLIT_LS_ABORTED; ++ } else { ++ st->fsm = FIQ_PER_SPLIT_HS_ABORTED; ++ } ++ break; ++ ++ case FIQ_PER_CSPLIT_POLL: ++ hfnum.d32 = FIQ_READ(state->dwc_regs_base + HFNUM); ++ hcchar.d32 = FIQ_READ(state->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCCHAR); ++ start_next_periodic = 1; ++ if (hcint.b.nak) { ++ st->fsm = FIQ_PER_SPLIT_DONE; ++ } else if (hcint.b.xfercomp) { ++ fiq_increment_dma_buf(state, num_channels, n); ++ if (fiq_fsm_more_csplits(state, n, &last_csplit)) { ++ handled = 1; ++ restart = 1; ++ /* Reload HCTSIZ for the next transfer */ ++ fiq_fsm_reload_hctsiz(state, n); ++ if (!last_csplit) ++ start_next_periodic = 0; ++ } else { ++ st->fsm = FIQ_PER_SPLIT_DONE; ++ } ++ } else if (hcint.b.nyet) { ++ /* Are we a NYET after the first data packet? */ ++ if (st->nrpackets == 0) { ++ st->fsm = FIQ_PER_CSPLIT_NYET1; ++ handled = 1; ++ restart = 1; ++ } else { ++ /* We got a NYET when polling CSPLITs. Can happen ++ * if our heuristic fails, or if someone disables us ++ * for any significant length of time. ++ */ ++ if (st->nr_errors >= 3) { ++ st->fsm = FIQ_PER_SPLIT_NYET_ABORTED; ++ } else { ++ st->fsm = FIQ_PER_SPLIT_DONE; ++ } ++ } ++ } else if (hcint.b.xacterr || hcint.b.stall || hcint.b.bblerr) { ++ /* For xacterr, Local 3-strikes retry is handled by the core. This is a ERR response.*/ ++ st->fsm = FIQ_PER_SPLIT_LS_ABORTED; ++ } else { ++ st->fsm = FIQ_PER_SPLIT_HS_ABORTED; ++ } ++ break; ++ ++ case FIQ_HS_ISOC_TURBO: ++ if (fiq_fsm_update_hs_isoc(state, n, hcint)) { ++ /* more transactions to come */ ++ handled = 1; ++ fiq_print(FIQDBG_INT, state, "HSISO M "); ++ /* For strided transfers, put ourselves to sleep */ ++ if (st->hs_isoc_info.stride > 1) { ++ st->uframe_sleeps = st->hs_isoc_info.stride - 1; ++ st->fsm = FIQ_HS_ISOC_SLEEPING; ++ } else { ++ restart = 1; ++ } ++ } else { ++ st->fsm = FIQ_HS_ISOC_DONE; ++ fiq_print(FIQDBG_INT, state, "HSISO F "); ++ } ++ break; ++ ++ case FIQ_HS_ISOC_ABORTED: ++ /* This abort is called by the driver rewriting the state mid-transaction ++ * which allows the dequeue mechanism to work more effectively. ++ */ ++ break; ++ ++ case FIQ_PER_ISO_OUT_ACTIVE: ++ if (hcint.b.ack) { ++ if(fiq_iso_out_advance(state, num_channels, n)) { ++ /* last OUT transfer */ ++ st->fsm = FIQ_PER_ISO_OUT_LAST; ++ /* ++ * Assuming the periodic FIFO in the dwc core ++ * actually does its job properly, we can queue ++ * the next ssplit now and in theory, the wire ++ * transactions will be in-order. ++ */ ++ // No it doesn't. It appears to process requests in host channel order. ++ //start_next_periodic = 1; ++ } ++ handled = 1; ++ restart = 1; ++ } else { ++ /* ++ * Isochronous transactions carry on regardless. Log the error ++ * and continue. ++ */ ++ //explode += 1; ++ st->nr_errors++; ++ if(fiq_iso_out_advance(state, num_channels, n)) { ++ st->fsm = FIQ_PER_ISO_OUT_LAST; ++ //start_next_periodic = 1; ++ } ++ handled = 1; ++ restart = 1; ++ } ++ break; ++ ++ case FIQ_PER_ISO_OUT_LAST: ++ if (hcint.b.ack) { ++ /* All done here */ ++ st->fsm = FIQ_PER_ISO_OUT_DONE; ++ } else { ++ st->fsm = FIQ_PER_ISO_OUT_DONE; ++ st->nr_errors++; ++ } ++ start_next_periodic = 1; ++ break; ++ ++ case FIQ_PER_SPLIT_TIMEOUT: ++ /* SOF kicked us because we overran. */ ++ start_next_periodic = 1; ++ break; ++ ++ default: ++ break; ++ } ++ ++ if (handled) { ++ FIQ_WRITE(state->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCINT, hcint.d32); ++ } else { ++ /* Copy the regs into the state so the IRQ knows what to do */ ++ st->hcint_copy.d32 = hcint.d32; ++ } ++ ++ if (restart) { ++ /* Restart always implies handled. */ ++ if (restart == 2) { ++ /* For complete-split INs, the show must go on. ++ * Force a channel restart */ ++ fiq_fsm_restart_channel(state, n, 1); ++ } else { ++ fiq_fsm_restart_channel(state, n, 0); ++ } ++ } ++ if (start_next_periodic) { ++ fiq_fsm_start_next_periodic(state, num_channels); ++ } ++ if (st->fsm != FIQ_PASSTHROUGH) ++ fiq_print(FIQDBG_INT, state, "FSMOUT%02d", st->fsm); ++ ++ return handled; ++} ++ ++ ++/** ++ * dwc_otg_fiq_fsm() - Flying State Machine (monster) FIQ ++ * @state: pointer to state struct passed from the banked FIQ mode registers. ++ * @num_channels: set according to the DWC hardware configuration ++ * @dma: pointer to DMA bounce buffers for split transaction slots ++ * ++ * The FSM FIQ performs the low-level tasks that normally would be performed by the microcode ++ * inside an EHCI or similar host controller regarding split transactions. The DWC core ++ * interrupts each and every time a split transaction packet is received or sent successfully. ++ * This results in either an interrupt storm when everything is working "properly", or ++ * the interrupt latency of the system in general breaks time-sensitive periodic split ++ * transactions. Pushing the low-level, but relatively easy state machine work into the FIQ ++ * solves these problems. ++ * ++ * Return: void ++ */ ++void notrace dwc_otg_fiq_fsm(struct fiq_state *state, int num_channels) ++{ ++ gintsts_data_t gintsts, gintsts_handled; ++ gintmsk_data_t gintmsk; ++ //hfnum_data_t hfnum; ++ haint_data_t haint, haint_handled; ++ haintmsk_data_t haintmsk; ++ int kick_irq = 0; ++ ++ gintsts_handled.d32 = 0; ++ haint_handled.d32 = 0; ++ ++ fiq_fsm_spin_lock(&state->lock); ++ gintsts.d32 = FIQ_READ(state->dwc_regs_base + GINTSTS); ++ gintmsk.d32 = FIQ_READ(state->dwc_regs_base + GINTMSK); ++ gintsts.d32 &= gintmsk.d32; ++ ++ if (gintsts.b.sofintr) { ++ /* For FSM mode, SOF is required to keep the state machine advance for ++ * certain stages of the periodic pipeline. It's death to mask this ++ * interrupt in that case. ++ */ ++ ++ if (!fiq_fsm_do_sof(state, num_channels)) { ++ /* Kick IRQ once. Queue advancement means that all pending transactions ++ * will get serviced when the IRQ finally executes. ++ */ ++ if (state->gintmsk_saved.b.sofintr == 1) ++ kick_irq |= 1; ++ state->gintmsk_saved.b.sofintr = 0; ++ } ++ gintsts_handled.b.sofintr = 1; ++ } ++ ++ if (gintsts.b.hcintr) { ++ int i; ++ haint.d32 = FIQ_READ(state->dwc_regs_base + HAINT); ++ haintmsk.d32 = FIQ_READ(state->dwc_regs_base + HAINTMSK); ++ haint.d32 &= haintmsk.d32; ++ haint_handled.d32 = 0; ++ for (i=0; i<num_channels; i++) { ++ if (haint.b2.chint & (1 << i)) { ++ if(!fiq_fsm_do_hcintr(state, num_channels, i)) { ++ /* HCINT was not handled in FIQ ++ * HAINT is level-sensitive, leading to level-sensitive ginststs.b.hcint bit. ++ * Mask HAINT(i) but keep top-level hcint unmasked. ++ */ ++ state->haintmsk_saved.b2.chint &= ~(1 << i); ++ } else { ++ /* do_hcintr cleaned up after itself, but clear haint */ ++ haint_handled.b2.chint |= (1 << i); ++ } ++ } ++ } ++ ++ if (haint_handled.b2.chint) { ++ FIQ_WRITE(state->dwc_regs_base + HAINT, haint_handled.d32); ++ } ++ ++ if (haintmsk.d32 != (haintmsk.d32 & state->haintmsk_saved.d32)) { ++ /* ++ * This is necessary to avoid multiple retriggers of the MPHI in the case ++ * where interrupts are held off and HCINTs start to pile up. ++ * Only wake up the IRQ if a new interrupt came in, was not handled and was ++ * masked. ++ */ ++ haintmsk.d32 &= state->haintmsk_saved.d32; ++ FIQ_WRITE(state->dwc_regs_base + HAINTMSK, haintmsk.d32); ++ kick_irq |= 1; ++ } ++ /* Top-Level interrupt - always handled because it's level-sensitive */ ++ gintsts_handled.b.hcintr = 1; ++ } ++ ++ ++ /* Clear the bits in the saved register that were not handled but were triggered. */ ++ state->gintmsk_saved.d32 &= ~(gintsts.d32 & ~gintsts_handled.d32); ++ ++ /* FIQ didn't handle something - mask has changed - write new mask */ ++ if (gintmsk.d32 != (gintmsk.d32 & state->gintmsk_saved.d32)) { ++ gintmsk.d32 &= state->gintmsk_saved.d32; ++ gintmsk.b.sofintr = 1; ++ FIQ_WRITE(state->dwc_regs_base + GINTMSK, gintmsk.d32); ++// fiq_print(FIQDBG_INT, state, "KICKGINT"); ++// fiq_print(FIQDBG_INT, state, "%08x", gintmsk.d32); ++// fiq_print(FIQDBG_INT, state, "%08x", state->gintmsk_saved.d32); ++ kick_irq |= 1; ++ } ++ ++ if (gintsts_handled.d32) { ++ /* Only applies to edge-sensitive bits in GINTSTS */ ++ FIQ_WRITE(state->dwc_regs_base + GINTSTS, gintsts_handled.d32); ++ } ++ ++ /* We got an interrupt, didn't handle it. */ ++ if (kick_irq) { ++ state->mphi_int_count++; ++ FIQ_WRITE(state->mphi_regs.outdda, (int) state->dummy_send); ++ FIQ_WRITE(state->mphi_regs.outddb, (1<<29)); ++ ++ } ++ state->fiq_done++; ++ mb(); ++ fiq_fsm_spin_unlock(&state->lock); ++} ++ ++ ++/** ++ * dwc_otg_fiq_nop() - FIQ "lite" ++ * @state: pointer to state struct passed from the banked FIQ mode registers. ++ * ++ * The "nop" handler does not intervene on any interrupts other than SOF. ++ * It is limited in scope to deciding at each SOF if the IRQ SOF handler (which deals ++ * with non-periodic/periodic queues) needs to be kicked. ++ * ++ * This is done to hold off the SOF interrupt, which occurs at a rate of 8000 per second. ++ * ++ * Return: void ++ */ ++void notrace dwc_otg_fiq_nop(struct fiq_state *state) ++{ ++ gintsts_data_t gintsts, gintsts_handled; ++ gintmsk_data_t gintmsk; ++ hfnum_data_t hfnum; ++ ++ fiq_fsm_spin_lock(&state->lock); ++ hfnum.d32 = FIQ_READ(state->dwc_regs_base + HFNUM); ++ gintsts.d32 = FIQ_READ(state->dwc_regs_base + GINTSTS); ++ gintmsk.d32 = FIQ_READ(state->dwc_regs_base + GINTMSK); ++ gintsts.d32 &= gintmsk.d32; ++ gintsts_handled.d32 = 0; ++ ++ if (gintsts.b.sofintr) { ++ if (!state->kick_np_queues && ++ dwc_frame_num_gt(state->next_sched_frame, hfnum.b.frnum)) { ++ /* SOF handled, no work to do, just ACK interrupt */ ++ gintsts_handled.b.sofintr = 1; ++ } else { ++ /* Kick IRQ */ ++ state->gintmsk_saved.b.sofintr = 0; ++ } ++ } ++ ++ /* Reset handled interrupts */ ++ if(gintsts_handled.d32) { ++ FIQ_WRITE(state->dwc_regs_base + GINTSTS, gintsts_handled.d32); ++ } ++ ++ /* Clear the bits in the saved register that were not handled but were triggered. */ ++ state->gintmsk_saved.d32 &= ~(gintsts.d32 & ~gintsts_handled.d32); ++ ++ /* We got an interrupt, didn't handle it and want to mask it */ ++ if (~(state->gintmsk_saved.d32)) { ++ state->mphi_int_count++; ++ gintmsk.d32 &= state->gintmsk_saved.d32; ++ FIQ_WRITE(state->dwc_regs_base + GINTMSK, gintmsk.d32); ++ /* Force a clear before another dummy send */ ++ FIQ_WRITE(state->mphi_regs.intstat, (1<<29)); ++ FIQ_WRITE(state->mphi_regs.outdda, (int) state->dummy_send); ++ FIQ_WRITE(state->mphi_regs.outddb, (1<<29)); ++ ++ } ++ state->fiq_done++; ++ mb(); ++ fiq_fsm_spin_unlock(&state->lock); ++} +diff --git a/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.h b/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.h +new file mode 100644 +index 0000000..f9fddfb +--- /dev/null ++++ b/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.h +@@ -0,0 +1,370 @@ ++/* ++ * dwc_otg_fiq_fsm.h - Finite state machine FIQ header definitions ++ * ++ * Copyright (c) 2013 Raspberry Pi Foundation ++ * ++ * Author: Jonathan Bell <jonathan@raspberrypi.org> ++ * All rights reserved. ++ * ++ * Redistribution and use in source and binary forms, with or without ++ * modification, are permitted provided that the following conditions are met: ++ * * Redistributions of source code must retain the above copyright ++ * notice, this list of conditions and the following disclaimer. ++ * * 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. ++ * * Neither the name of Raspberry Pi nor the ++ * names of its contributors may be used to endorse or promote products ++ * derived from this software without specific prior written permission. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 <COPYRIGHT HOLDER> 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. ++ * ++ * This FIQ implements functionality that performs split transactions on ++ * the dwc_otg hardware without any outside intervention. A split transaction ++ * is "queued" by nominating a specific host channel to perform the entirety ++ * of a split transaction. This FIQ will then perform the microframe-precise ++ * scheduling required in each phase of the transaction until completion. ++ * ++ * The FIQ functionality has been surgically implanted into the Synopsys ++ * vendor-provided driver. ++ * ++ */ ++ ++#ifndef DWC_OTG_FIQ_FSM_H_ ++#define DWC_OTG_FIQ_FSM_H_ ++ ++#include "dwc_otg_regs.h" ++#include "dwc_otg_cil.h" ++#include "dwc_otg_hcd.h" ++#include <linux/kernel.h> ++#include <linux/irqflags.h> ++#include <linux/string.h> ++#include <asm/barrier.h> ++ ++#if 0 ++#define FLAME_ON(x) \ ++do { \ ++ int gpioreg; \ ++ \ ++ gpioreg = readl(__io_address(0x20200000+0x8)); \ ++ gpioreg &= ~(7 << (x-20)*3); \ ++ gpioreg |= 0x1 << (x-20)*3; \ ++ writel(gpioreg, __io_address(0x20200000+0x8)); \ ++ \ ++ writel(1<<x, __io_address(0x20200000+(0x1C))); \ ++} while (0) ++ ++#define FLAME_OFF(x) \ ++do { \ ++ writel(1<<x, __io_address(0x20200000+(0x28))); \ ++} while (0) ++#else ++#define FLAME_ON(x) do { } while (0) ++#define FLAME_OFF(X) do { } while (0) ++#endif ++ ++/* This is a quick-and-dirty arch-specific register read/write. We know that ++ * writes to a peripheral on BCM2835 will always arrive in-order, also that ++ * reads and writes are executed in-order therefore the need for memory barriers ++ * is obviated if we're only talking to USB. ++ */ ++#define FIQ_WRITE(_addr_,_data_) (*(volatile unsigned int *) (_addr_) = (_data_)) ++#define FIQ_READ(_addr_) (*(volatile unsigned int *) (_addr_)) ++ ++/* FIQ-ified register definitions. Offsets are from dwc_regs_base. */ ++#define GINTSTS 0x014 ++#define GINTMSK 0x018 ++/* Debug register. Poll the top of the received packets FIFO. */ ++#define GRXSTSR 0x01C ++#define HFNUM 0x408 ++#define HAINT 0x414 ++#define HAINTMSK 0x418 ++#define HPRT0 0x440 ++ ++/* HC_regs start from an offset of 0x500 */ ++#define HC_START 0x500 ++#define HC_OFFSET 0x020 ++ ++#define HC_DMA 0x514 ++ ++#define HCCHAR 0x00 ++#define HCSPLT 0x04 ++#define HCINT 0x08 ++#define HCINTMSK 0x0C ++#define HCTSIZ 0x10 ++ ++#define ISOC_XACTPOS_ALL 0b11 ++#define ISOC_XACTPOS_BEGIN 0b10 ++#define ISOC_XACTPOS_MID 0b00 ++#define ISOC_XACTPOS_END 0b01 ++ ++#define DWC_PID_DATA2 0b01 ++#define DWC_PID_MDATA 0b11 ++#define DWC_PID_DATA1 0b10 ++#define DWC_PID_DATA0 0b00 ++ ++typedef struct { ++ volatile void* base; ++ volatile void* ctrl; ++ volatile void* outdda; ++ volatile void* outddb; ++ volatile void* intstat; ++} mphi_regs_t; ++ ++enum fiq_debug_level { ++ FIQDBG_SCHED = (1 << 0), ++ FIQDBG_INT = (1 << 1), ++ FIQDBG_ERR = (1 << 2), ++ FIQDBG_PORTHUB = (1 << 3), ++}; ++ ++typedef struct { ++ union { ++ uint32_t slock; ++ struct _tickets { ++ uint16_t owner; ++ uint16_t next; ++ } tickets; ++ }; ++} fiq_lock_t; ++ ++struct fiq_state; ++ ++extern void _fiq_print (enum fiq_debug_level dbg_lvl, volatile struct fiq_state *state, char *fmt, ...); ++#if 0 ++#define fiq_print _fiq_print ++#else ++#define fiq_print(x, y, ...) ++#endif ++ ++extern bool fiq_enable, fiq_fsm_enable; ++extern ushort nak_holdoff; ++ ++/** ++ * enum fiq_fsm_state - The FIQ FSM states. ++ * ++ * This is the "core" of the FIQ FSM. Broadly, the FSM states follow the ++ * USB2.0 specification for host responses to various transaction states. ++ * There are modifications to this host state machine because of a variety of ++ * quirks and limitations in the dwc_otg hardware. ++ * ++ * The fsm state is also used to communicate back to the driver on completion of ++ * a split transaction. The end states are used in conjunction with the interrupts ++ * raised by the final transaction. ++ */ ++enum fiq_fsm_state { ++ /* FIQ isn't enabled for this host channel */ ++ FIQ_PASSTHROUGH = 0, ++ /* For the first interrupt received for this channel, ++ * the FIQ has to ack any interrupts indicating success. */ ++ FIQ_PASSTHROUGH_ERRORSTATE = 31, ++ /* Nonperiodic state groups */ ++ FIQ_NP_SSPLIT_STARTED = 1, ++ FIQ_NP_SSPLIT_RETRY = 2, ++ FIQ_NP_OUT_CSPLIT_RETRY = 3, ++ FIQ_NP_IN_CSPLIT_RETRY = 4, ++ FIQ_NP_SPLIT_DONE = 5, ++ FIQ_NP_SPLIT_LS_ABORTED = 6, ++ /* This differentiates a HS transaction error from a LS one ++ * (handling the hub state is different) */ ++ FIQ_NP_SPLIT_HS_ABORTED = 7, ++ ++ /* Periodic state groups */ ++ /* Periodic transactions are either started directly by the IRQ handler ++ * or deferred if the TT is already in use. ++ */ ++ FIQ_PER_SSPLIT_QUEUED = 8, ++ FIQ_PER_SSPLIT_STARTED = 9, ++ FIQ_PER_SSPLIT_LAST = 10, ++ ++ ++ FIQ_PER_ISO_OUT_PENDING = 11, ++ FIQ_PER_ISO_OUT_ACTIVE = 12, ++ FIQ_PER_ISO_OUT_LAST = 13, ++ FIQ_PER_ISO_OUT_DONE = 27, ++ ++ FIQ_PER_CSPLIT_WAIT = 14, ++ FIQ_PER_CSPLIT_NYET1 = 15, ++ FIQ_PER_CSPLIT_BROKEN_NYET1 = 28, ++ FIQ_PER_CSPLIT_NYET_FAFF = 29, ++ /* For multiple CSPLITs (large isoc IN, or delayed interrupt) */ ++ FIQ_PER_CSPLIT_POLL = 16, ++ /* The last CSPLIT for a transaction has been issued, differentiates ++ * for the state machine to queue the next packet. ++ */ ++ FIQ_PER_CSPLIT_LAST = 17, ++ ++ FIQ_PER_SPLIT_DONE = 18, ++ FIQ_PER_SPLIT_LS_ABORTED = 19, ++ FIQ_PER_SPLIT_HS_ABORTED = 20, ++ FIQ_PER_SPLIT_NYET_ABORTED = 21, ++ /* Frame rollover has occurred without the transaction finishing. */ ++ FIQ_PER_SPLIT_TIMEOUT = 22, ++ ++ /* FIQ-accelerated HS Isochronous state groups */ ++ FIQ_HS_ISOC_TURBO = 23, ++ /* For interval > 1, SOF wakes up the isochronous FSM */ ++ FIQ_HS_ISOC_SLEEPING = 24, ++ FIQ_HS_ISOC_DONE = 25, ++ FIQ_HS_ISOC_ABORTED = 26, ++ FIQ_DEQUEUE_ISSUED = 30, ++ FIQ_TEST = 32, ++}; ++ ++struct fiq_stack { ++ int magic1; ++ uint8_t stack[2048]; ++ int magic2; ++}; ++ ++ ++/** ++ * struct fiq_dma_info - DMA bounce buffer utilisation information (per-channel) ++ * @index: Number of slots reported used for IN transactions / number of slots ++ * transmitted for an OUT transaction ++ * @slot_len[6]: Number of actual transfer bytes in each slot (255 if unused) ++ * ++ * Split transaction transfers can have variable length depending on other bus ++ * traffic. The OTG core DMA engine requires 4-byte aligned addresses therefore ++ * each transaction needs a guaranteed aligned address. A maximum of 6 split transfers ++ * can happen per-frame. ++ */ ++struct fiq_dma_info { ++ u8 index; ++ u8 slot_len[6]; ++}; ++ ++struct __attribute__((packed)) fiq_split_dma_slot { ++ u8 buf[188]; ++}; ++ ++struct fiq_dma_channel { ++ struct __attribute__((packed)) fiq_split_dma_slot index[6]; ++}; ++ ++struct fiq_dma_blob { ++ struct __attribute__((packed)) fiq_dma_channel channel[0]; ++}; ++ ++/** ++ * struct fiq_hs_isoc_info - USB2.0 isochronous data ++ * @iso_frame: Pointer to the array of OTG URB iso_frame_descs. ++ * @nrframes: Total length of iso_frame_desc array ++ * @index: Current index (FIQ-maintained) ++ * @stride: Interval in uframes between HS isoc transactions ++ */ ++struct fiq_hs_isoc_info { ++ struct dwc_otg_hcd_iso_packet_desc *iso_desc; ++ unsigned int nrframes; ++ unsigned int index; ++ unsigned int stride; ++}; ++ ++/** ++ * struct fiq_channel_state - FIQ state machine storage ++ * @fsm: Current state of the channel as understood by the FIQ ++ * @nr_errors: Number of transaction errors on this split-transaction ++ * @hub_addr: SSPLIT/CSPLIT destination hub ++ * @port_addr: SSPLIT/CSPLIT destination port - always 1 if single TT hub ++ * @nrpackets: For isoc OUT, the number of split-OUT packets to transmit. For ++ * split-IN, number of CSPLIT data packets that were received. ++ * @hcchar_copy: ++ * @hcsplt_copy: ++ * @hcintmsk_copy: ++ * @hctsiz_copy: Copies of the host channel registers. ++ * For use as scratch, or for returning state. ++ * ++ * The fiq_channel_state is state storage between interrupts for a host channel. The ++ * FSM state is stored here. Members of this structure must only be set up by the ++ * driver prior to enabling the FIQ for this host channel, and not touched until the FIQ ++ * has updated the state to either a COMPLETE state group or ABORT state group. ++ */ ++ ++struct fiq_channel_state { ++ enum fiq_fsm_state fsm; ++ unsigned int nr_errors; ++ unsigned int hub_addr; ++ unsigned int port_addr; ++ /* Hardware bug workaround: sometimes channel halt interrupts are ++ * delayed until the next SOF. Keep track of when we expected to get interrupted. */ ++ unsigned int expected_uframe; ++ /* number of uframes remaining (for interval > 1 HS isoc transfers) before next transfer */ ++ unsigned int uframe_sleeps; ++ /* in/out for communicating number of dma buffers used, or number of ISOC to do */ ++ unsigned int nrpackets; ++ struct fiq_dma_info dma_info; ++ struct fiq_hs_isoc_info hs_isoc_info; ++ /* Copies of HC registers - in/out communication from/to IRQ handler ++ * and for ease of channel setup. A bit of mungeing is performed - for ++ * example the hctsiz.b.maxp is _always_ the max packet size of the endpoint. ++ */ ++ hcchar_data_t hcchar_copy; ++ hcsplt_data_t hcsplt_copy; ++ hcint_data_t hcint_copy; ++ hcintmsk_data_t hcintmsk_copy; ++ hctsiz_data_t hctsiz_copy; ++ hcdma_data_t hcdma_copy; ++}; ++ ++/** ++ * struct fiq_state - top-level FIQ state machine storage ++ * @mphi_regs: virtual address of the MPHI peripheral register file ++ * @dwc_regs_base: virtual address of the base of the DWC core register file ++ * @dma_base: physical address for the base of the DMA bounce buffers ++ * @dummy_send: Scratch area for sending a fake message to the MPHI peripheral ++ * @gintmsk_saved: Top-level mask of interrupts that the FIQ has not handled. ++ * Used for determining which interrupts fired to set off the IRQ handler. ++ * @haintmsk_saved: Mask of interrupts from host channels that the FIQ did not handle internally. ++ * @np_count: Non-periodic transactions in the active queue ++ * @np_sent: Count of non-periodic transactions that have completed ++ * @next_sched_frame: For periodic transactions handled by the driver's SOF-driven queuing mechanism, ++ * this is the next frame on which a SOF interrupt is required. Used to hold off ++ * passing SOF through to the driver until necessary. ++ * @channel[n]: Per-channel FIQ state. Allocated during init depending on the number of host ++ * channels configured into the core logic. ++ * ++ * This is passed as the first argument to the dwc_otg_fiq_fsm top-level FIQ handler from the asm stub. ++ * It contains top-level state information. ++ */ ++struct fiq_state { ++ fiq_lock_t lock; ++ mphi_regs_t mphi_regs; ++ void *dwc_regs_base; ++ dma_addr_t dma_base; ++ struct fiq_dma_blob *fiq_dmab; ++ void *dummy_send; ++ gintmsk_data_t gintmsk_saved; ++ haintmsk_data_t haintmsk_saved; ++ int mphi_int_count; ++ unsigned int fiq_done; ++ unsigned int kick_np_queues; ++ unsigned int next_sched_frame; ++#ifdef FIQ_DEBUG ++ char * buffer; ++ unsigned int bufsiz; ++#endif ++ struct fiq_channel_state channel[0]; ++}; ++ ++extern void fiq_fsm_spin_lock(fiq_lock_t *lock); ++ ++extern void fiq_fsm_spin_unlock(fiq_lock_t *lock); ++ ++extern int fiq_fsm_too_late(struct fiq_state *st, int n); ++ ++extern int fiq_fsm_tt_in_use(struct fiq_state *st, int num_channels, int n); ++ ++extern void dwc_otg_fiq_fsm(struct fiq_state *state, int num_channels); ++ ++extern void dwc_otg_fiq_nop(struct fiq_state *state); ++ ++#endif /* DWC_OTG_FIQ_FSM_H_ */ +diff --git a/drivers/usb/host/dwc_otg/dwc_otg_fiq_stub.S b/drivers/usb/host/dwc_otg/dwc_otg_fiq_stub.S +new file mode 100644 +index 0000000..ffa8d21 +--- /dev/null ++++ b/drivers/usb/host/dwc_otg/dwc_otg_fiq_stub.S +@@ -0,0 +1,80 @@ ++/* ++ * dwc_otg_fiq_fsm.S - assembly stub for the FSM FIQ ++ * ++ * Copyright (c) 2013 Raspberry Pi Foundation ++ * ++ * Author: Jonathan Bell <jonathan@raspberrypi.org> ++ * All rights reserved. ++ * ++ * Redistribution and use in source and binary forms, with or without ++ * modification, are permitted provided that the following conditions are met: ++ * * Redistributions of source code must retain the above copyright ++ * notice, this list of conditions and the following disclaimer. ++ * * 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. ++ * * Neither the name of Raspberry Pi nor the ++ * names of its contributors may be used to endorse or promote products ++ * derived from this software without specific prior written permission. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 <COPYRIGHT HOLDER> BE LIABLE FOR ANY ++ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ++ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; ++ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ++ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ++ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ */ ++ ++ ++#include <asm/assembler.h> ++#include <linux/linkage.h> ++ ++ ++.text ++ ++.global _dwc_otg_fiq_stub_end; ++ ++/** ++ * _dwc_otg_fiq_stub() - entry copied to the FIQ vector page to allow ++ * a C-style function call with arguments from the FIQ banked registers. ++ * r0 = &hcd->fiq_state ++ * r1 = &hcd->num_channels ++ * r2 = &hcd->dma_buffers ++ * Tramples: r0, r1, r2, r4, fp, ip ++ */ ++ ++ENTRY(_dwc_otg_fiq_stub) ++ /* Stash unbanked regs - SP will have been set up for us */ ++ mov ip, sp; ++ stmdb sp!, {r0-r12, lr}; ++#ifdef FIQ_DEBUG ++ // Cycle profiling - read cycle counter at start ++ mrc p15, 0, r5, c15, c12, 1; ++#endif ++ /* r11 = fp, don't trample it */ ++ mov r4, fp; ++ /* set EABI frame size */ ++ sub fp, ip, #512; ++ ++ /* for fiq NOP mode - just need state */ ++ mov r0, r8; ++ /* r9 = num_channels */ ++ mov r1, r9; ++ /* r10 = struct *dma_bufs */ ++// mov r2, r10; ++ ++ /* r4 = &fiq_c_function */ ++ blx r4; ++#ifdef FIQ_DEBUG ++ mrc p15, 0, r4, c15, c12, 1; ++ subs r5, r5, r4; ++ // r5 is now the cycle count time for executing the FIQ. Store it somewhere? ++#endif ++ ldmia sp!, {r0-r12, lr}; ++ subs pc, lr, #4; ++_dwc_otg_fiq_stub_end: ++END(_dwc_otg_fiq_stub) +diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd.c b/drivers/usb/host/dwc_otg/dwc_otg_hcd.c +new file mode 100644 +index 0000000..135b611 +--- /dev/null ++++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd.c +@@ -0,0 +1,4257 @@ ++ ++/* ========================================================================== ++ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_hcd.c $ ++ * $Revision: #104 $ ++ * $Date: 2011/10/24 $ ++ * $Change: 1871159 $ ++ * ++ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, ++ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless ++ * otherwise expressly agreed to in writing between Synopsys and you. ++ * ++ * The Software IS NOT an item of Licensed Software or Licensed Product under ++ * any End User Software License Agreement or Agreement for Licensed Product ++ * with Synopsys or any supplement thereto. You are permitted to use and ++ * redistribute this Software in source and binary forms, with or without ++ * modification, provided that redistributions of source code must retain this ++ * notice. You may not view, use, disclose, copy or distribute this file or ++ * any information contained herein except pursuant to this license grant from ++ * Synopsys. If you do not agree with this notice, including the disclaimer ++ * below, then you are not authorized to use the Software. ++ * ++ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS ++ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS 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. ++ * ========================================================================== */ ++#ifndef DWC_DEVICE_ONLY ++ ++/** @file ++ * This file implements HCD Core. All code in this file is portable and doesn't ++ * use any OS specific functions. ++ * Interface provided by HCD Core is defined in <code><hcd_if.h></code> ++ * header file. ++ */ ++ ++#include <linux/usb.h> ++#include <linux/usb/hcd.h> ++ ++#include "dwc_otg_hcd.h" ++#include "dwc_otg_regs.h" ++#include "dwc_otg_fiq_fsm.h" ++ ++extern bool microframe_schedule; ++extern uint16_t fiq_fsm_mask, nak_holdoff; ++ ++//#define DEBUG_HOST_CHANNELS ++#ifdef DEBUG_HOST_CHANNELS ++static int last_sel_trans_num_per_scheduled = 0; ++static int last_sel_trans_num_nonper_scheduled = 0; ++static int last_sel_trans_num_avail_hc_at_start = 0; ++static int last_sel_trans_num_avail_hc_at_end = 0; ++#endif /* DEBUG_HOST_CHANNELS */ ++ ++ ++dwc_otg_hcd_t *dwc_otg_hcd_alloc_hcd(void) ++{ ++ return DWC_ALLOC(sizeof(dwc_otg_hcd_t)); ++} ++ ++/** ++ * Connection timeout function. An OTG host is required to display a ++ * message if the device does not connect within 10 seconds. ++ */ ++void dwc_otg_hcd_connect_timeout(void *ptr) ++{ ++ DWC_DEBUGPL(DBG_HCDV, "%s(%p)\n", __func__, ptr); ++ DWC_PRINTF("Connect Timeout\n"); ++ __DWC_ERROR("Device Not Connected/Responding\n"); ++} ++ ++#if defined(DEBUG) ++static void dump_channel_info(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh) ++{ ++ if (qh->channel != NULL) { ++ dwc_hc_t *hc = qh->channel; ++ dwc_list_link_t *item; ++ dwc_otg_qh_t *qh_item; ++ int num_channels = hcd->core_if->core_params->host_channels; ++ int i; ++ ++ dwc_otg_hc_regs_t *hc_regs; ++ hcchar_data_t hcchar; ++ hcsplt_data_t hcsplt; ++ hctsiz_data_t hctsiz; ++ uint32_t hcdma; ++ ++ hc_regs = hcd->core_if->host_if->hc_regs[hc->hc_num]; ++ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); ++ hcsplt.d32 = DWC_READ_REG32(&hc_regs->hcsplt); ++ hctsiz.d32 = DWC_READ_REG32(&hc_regs->hctsiz); ++ hcdma = DWC_READ_REG32(&hc_regs->hcdma); ++ ++ DWC_PRINTF(" Assigned to channel %p:\n", hc); ++ DWC_PRINTF(" hcchar 0x%08x, hcsplt 0x%08x\n", hcchar.d32, ++ hcsplt.d32); ++ DWC_PRINTF(" hctsiz 0x%08x, hcdma 0x%08x\n", hctsiz.d32, ++ hcdma); ++ DWC_PRINTF(" dev_addr: %d, ep_num: %d, ep_is_in: %d\n", ++ hc->dev_addr, hc->ep_num, hc->ep_is_in); ++ DWC_PRINTF(" ep_type: %d\n", hc->ep_type); ++ DWC_PRINTF(" max_packet: %d\n", hc->max_packet); ++ DWC_PRINTF(" data_pid_start: %d\n", hc->data_pid_start); ++ DWC_PRINTF(" xfer_started: %d\n", hc->xfer_started); ++ DWC_PRINTF(" halt_status: %d\n", hc->halt_status); ++ DWC_PRINTF(" xfer_buff: %p\n", hc->xfer_buff); ++ DWC_PRINTF(" xfer_len: %d\n", hc->xfer_len); ++ DWC_PRINTF(" qh: %p\n", hc->qh); ++ DWC_PRINTF(" NP inactive sched:\n"); ++ DWC_LIST_FOREACH(item, &hcd->non_periodic_sched_inactive) { ++ qh_item = ++ DWC_LIST_ENTRY(item, dwc_otg_qh_t, qh_list_entry); ++ DWC_PRINTF(" %p\n", qh_item); ++ } ++ DWC_PRINTF(" NP active sched:\n"); ++ DWC_LIST_FOREACH(item, &hcd->non_periodic_sched_active) { ++ qh_item = ++ DWC_LIST_ENTRY(item, dwc_otg_qh_t, qh_list_entry); ++ DWC_PRINTF(" %p\n", qh_item); ++ } ++ DWC_PRINTF(" Channels: \n"); ++ for (i = 0; i < num_channels; i++) { ++ dwc_hc_t *hc = hcd->hc_ptr_array[i]; ++ DWC_PRINTF(" %2d: %p\n", i, hc); ++ } ++ } ++} ++#else ++#define dump_channel_info(hcd, qh) ++#endif /* DEBUG */ ++ ++/** ++ * Work queue function for starting the HCD when A-Cable is connected. ++ * The hcd_start() must be called in a process context. ++ */ ++static void hcd_start_func(void *_vp) ++{ ++ dwc_otg_hcd_t *hcd = (dwc_otg_hcd_t *) _vp; ++ ++ DWC_DEBUGPL(DBG_HCDV, "%s() %p\n", __func__, hcd); ++ if (hcd) { ++ hcd->fops->start(hcd); ++ } ++} ++ ++static void del_xfer_timers(dwc_otg_hcd_t * hcd) ++{ ++#ifdef DEBUG ++ int i; ++ int num_channels = hcd->core_if->core_params->host_channels; ++ for (i = 0; i < num_channels; i++) { ++ DWC_TIMER_CANCEL(hcd->core_if->hc_xfer_timer[i]); ++ } ++#endif ++} ++ ++static void del_timers(dwc_otg_hcd_t * hcd) ++{ ++ del_xfer_timers(hcd); ++ DWC_TIMER_CANCEL(hcd->conn_timer); ++} ++ ++/** ++ * Processes all the URBs in a single list of QHs. Completes them with ++ * -ESHUTDOWN and frees the QTD. ++ */ ++static void kill_urbs_in_qh_list(dwc_otg_hcd_t * hcd, dwc_list_link_t * qh_list) ++{ ++ dwc_list_link_t *qh_item, *qh_tmp; ++ dwc_otg_qh_t *qh; ++ dwc_otg_qtd_t *qtd, *qtd_tmp; ++ ++ DWC_LIST_FOREACH_SAFE(qh_item, qh_tmp, qh_list) { ++ qh = DWC_LIST_ENTRY(qh_item, dwc_otg_qh_t, qh_list_entry); ++ DWC_CIRCLEQ_FOREACH_SAFE(qtd, qtd_tmp, ++ &qh->qtd_list, qtd_list_entry) { ++ qtd = DWC_CIRCLEQ_FIRST(&qh->qtd_list); ++ if (qtd->urb != NULL) { ++ hcd->fops->complete(hcd, qtd->urb->priv, ++ qtd->urb, -DWC_E_SHUTDOWN); ++ dwc_otg_hcd_qtd_remove_and_free(hcd, qtd, qh); ++ } ++ ++ } ++ if(qh->channel) { ++ /* Using hcchar.chen == 1 is not a reliable test. ++ * It is possible that the channel has already halted ++ * but not yet been through the IRQ handler. ++ */ ++ dwc_otg_hc_halt(hcd->core_if, qh->channel, ++ DWC_OTG_HC_XFER_URB_DEQUEUE); ++ if(microframe_schedule) ++ hcd->available_host_channels++; ++ qh->channel = NULL; ++ } ++ dwc_otg_hcd_qh_remove(hcd, qh); ++ } ++} ++ ++/** ++ * Responds with an error status of ESHUTDOWN to all URBs in the non-periodic ++ * and periodic schedules. The QTD associated with each URB is removed from ++ * the schedule and freed. This function may be called when a disconnect is ++ * detected or when the HCD is being stopped. ++ */ ++static void kill_all_urbs(dwc_otg_hcd_t * hcd) ++{ ++ kill_urbs_in_qh_list(hcd, &hcd->non_periodic_sched_inactive); ++ kill_urbs_in_qh_list(hcd, &hcd->non_periodic_sched_active); ++ kill_urbs_in_qh_list(hcd, &hcd->periodic_sched_inactive); ++ kill_urbs_in_qh_list(hcd, &hcd->periodic_sched_ready); ++ kill_urbs_in_qh_list(hcd, &hcd->periodic_sched_assigned); ++ kill_urbs_in_qh_list(hcd, &hcd->periodic_sched_queued); ++} ++ ++/** ++ * Start the connection timer. An OTG host is required to display a ++ * message if the device does not connect within 10 seconds. The ++ * timer is deleted if a port connect interrupt occurs before the ++ * timer expires. ++ */ ++static void dwc_otg_hcd_start_connect_timer(dwc_otg_hcd_t * hcd) ++{ ++ DWC_TIMER_SCHEDULE(hcd->conn_timer, 10000 /* 10 secs */ ); ++} ++ ++/** ++ * HCD Callback function for disconnect of the HCD. ++ * ++ * @param p void pointer to the <code>struct usb_hcd</code> ++ */ ++static int32_t dwc_otg_hcd_session_start_cb(void *p) ++{ ++ dwc_otg_hcd_t *dwc_otg_hcd; ++ DWC_DEBUGPL(DBG_HCDV, "%s(%p)\n", __func__, p); ++ dwc_otg_hcd = p; ++ dwc_otg_hcd_start_connect_timer(dwc_otg_hcd); ++ return 1; ++} ++ ++/** ++ * HCD Callback function for starting the HCD when A-Cable is ++ * connected. ++ * ++ * @param p void pointer to the <code>struct usb_hcd</code> ++ */ ++static int32_t dwc_otg_hcd_start_cb(void *p) ++{ ++ dwc_otg_hcd_t *dwc_otg_hcd = p; ++ dwc_otg_core_if_t *core_if; ++ hprt0_data_t hprt0; ++ ++ core_if = dwc_otg_hcd->core_if; ++ ++ if (core_if->op_state == B_HOST) { ++ /* ++ * Reset the port. During a HNP mode switch the reset ++ * needs to occur within 1ms and have a duration of at ++ * least 50ms. ++ */ ++ hprt0.d32 = dwc_otg_read_hprt0(core_if); ++ hprt0.b.prtrst = 1; ++ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); ++ } ++ DWC_WORKQ_SCHEDULE_DELAYED(core_if->wq_otg, ++ hcd_start_func, dwc_otg_hcd, 50, ++ "start hcd"); ++ ++ return 1; ++} ++ ++/** ++ * HCD Callback function for disconnect of the HCD. ++ * ++ * @param p void pointer to the <code>struct usb_hcd</code> ++ */ ++static int32_t dwc_otg_hcd_disconnect_cb(void *p) ++{ ++ gintsts_data_t intr; ++ dwc_otg_hcd_t *dwc_otg_hcd = p; ++ ++ /* ++ * Set status flags for the hub driver. ++ */ ++ dwc_otg_hcd->flags.b.port_connect_status_change = 1; ++ dwc_otg_hcd->flags.b.port_connect_status = 0; ++ if(fiq_enable) ++ local_fiq_disable(); ++ /* ++ * Shutdown any transfers in process by clearing the Tx FIFO Empty ++ * interrupt mask and status bits and disabling subsequent host ++ * channel interrupts. ++ */ ++ intr.d32 = 0; ++ intr.b.nptxfempty = 1; ++ intr.b.ptxfempty = 1; ++ intr.b.hcintr = 1; ++ DWC_MODIFY_REG32(&dwc_otg_hcd->core_if->core_global_regs->gintmsk, ++ intr.d32, 0); ++ DWC_MODIFY_REG32(&dwc_otg_hcd->core_if->core_global_regs->gintsts, ++ intr.d32, 0); ++ ++ del_timers(dwc_otg_hcd); ++ ++ /* ++ * Turn off the vbus power only if the core has transitioned to device ++ * mode. If still in host mode, need to keep power on to detect a ++ * reconnection. ++ */ ++ if (dwc_otg_is_device_mode(dwc_otg_hcd->core_if)) { ++ if (dwc_otg_hcd->core_if->op_state != A_SUSPEND) { ++ hprt0_data_t hprt0 = {.d32 = 0 }; ++ DWC_PRINTF("Disconnect: PortPower off\n"); ++ hprt0.b.prtpwr = 0; ++ DWC_WRITE_REG32(dwc_otg_hcd->core_if->host_if->hprt0, ++ hprt0.d32); ++ } ++ ++ dwc_otg_disable_host_interrupts(dwc_otg_hcd->core_if); ++ } ++ ++ /* Respond with an error status to all URBs in the schedule. */ ++ kill_all_urbs(dwc_otg_hcd); ++ ++ if (dwc_otg_is_host_mode(dwc_otg_hcd->core_if)) { ++ /* Clean up any host channels that were in use. */ ++ int num_channels; ++ int i; ++ dwc_hc_t *channel; ++ dwc_otg_hc_regs_t *hc_regs; ++ hcchar_data_t hcchar; ++ ++ num_channels = dwc_otg_hcd->core_if->core_params->host_channels; ++ ++ if (!dwc_otg_hcd->core_if->dma_enable) { ++ /* Flush out any channel requests in slave mode. */ ++ for (i = 0; i < num_channels; i++) { ++ channel = dwc_otg_hcd->hc_ptr_array[i]; ++ if (DWC_CIRCLEQ_EMPTY_ENTRY ++ (channel, hc_list_entry)) { ++ hc_regs = ++ dwc_otg_hcd->core_if-> ++ host_if->hc_regs[i]; ++ hcchar.d32 = ++ DWC_READ_REG32(&hc_regs->hcchar); ++ if (hcchar.b.chen) { ++ hcchar.b.chen = 0; ++ hcchar.b.chdis = 1; ++ hcchar.b.epdir = 0; ++ DWC_WRITE_REG32 ++ (&hc_regs->hcchar, ++ hcchar.d32); ++ } ++ } ++ } ++ } ++ ++ for (i = 0; i < num_channels; i++) { ++ channel = dwc_otg_hcd->hc_ptr_array[i]; ++ if (DWC_CIRCLEQ_EMPTY_ENTRY(channel, hc_list_entry)) { ++ hc_regs = ++ dwc_otg_hcd->core_if->host_if->hc_regs[i]; ++ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); ++ if (hcchar.b.chen) { ++ /* Halt the channel. */ ++ hcchar.b.chdis = 1; ++ DWC_WRITE_REG32(&hc_regs->hcchar, ++ hcchar.d32); ++ } ++ ++ dwc_otg_hc_cleanup(dwc_otg_hcd->core_if, ++ channel); ++ DWC_CIRCLEQ_INSERT_TAIL ++ (&dwc_otg_hcd->free_hc_list, channel, ++ hc_list_entry); ++ /* ++ * Added for Descriptor DMA to prevent channel double cleanup ++ * in release_channel_ddma(). Which called from ep_disable ++ * when device disconnect. ++ */ ++ channel->qh = NULL; ++ } ++ } ++ if(fiq_fsm_enable) { ++ for(i=0; i < 128; i++) { ++ dwc_otg_hcd->hub_port[i] = 0; ++ } ++ } ++ ++ } ++ ++ if(fiq_enable) ++ local_fiq_enable(); ++ ++ if (dwc_otg_hcd->fops->disconnect) { ++ dwc_otg_hcd->fops->disconnect(dwc_otg_hcd); ++ } ++ ++ return 1; ++} ++ ++/** ++ * HCD Callback function for stopping the HCD. ++ * ++ * @param p void pointer to the <code>struct usb_hcd</code> ++ */ ++static int32_t dwc_otg_hcd_stop_cb(void *p) ++{ ++ dwc_otg_hcd_t *dwc_otg_hcd = p; ++ ++ DWC_DEBUGPL(DBG_HCDV, "%s(%p)\n", __func__, p); ++ dwc_otg_hcd_stop(dwc_otg_hcd); ++ return 1; ++} ++ ++#ifdef CONFIG_USB_DWC_OTG_LPM ++/** ++ * HCD Callback function for sleep of HCD. ++ * ++ * @param p void pointer to the <code>struct usb_hcd</code> ++ */ ++static int dwc_otg_hcd_sleep_cb(void *p) ++{ ++ dwc_otg_hcd_t *hcd = p; ++ ++ dwc_otg_hcd_free_hc_from_lpm(hcd); ++ ++ return 0; ++} ++#endif ++ ++ ++/** ++ * HCD Callback function for Remote Wakeup. ++ * ++ * @param p void pointer to the <code>struct usb_hcd</code> ++ */ ++static int dwc_otg_hcd_rem_wakeup_cb(void *p) ++{ ++ dwc_otg_hcd_t *hcd = p; ++ ++ if (hcd->core_if->lx_state == DWC_OTG_L2) { ++ hcd->flags.b.port_suspend_change = 1; ++ } ++#ifdef CONFIG_USB_DWC_OTG_LPM ++ else { ++ hcd->flags.b.port_l1_change = 1; ++ } ++#endif ++ return 0; ++} ++ ++/** ++ * Halts the DWC_otg host mode operations in a clean manner. USB transfers are ++ * stopped. ++ */ ++void dwc_otg_hcd_stop(dwc_otg_hcd_t * hcd) ++{ ++ hprt0_data_t hprt0 = {.d32 = 0 }; ++ ++ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD STOP\n"); ++ ++ /* ++ * The root hub should be disconnected before this function is called. ++ * The disconnect will clear the QTD lists (via ..._hcd_urb_dequeue) ++ * and the QH lists (via ..._hcd_endpoint_disable). ++ */ ++ ++ /* Turn off all host-specific interrupts. */ ++ dwc_otg_disable_host_interrupts(hcd->core_if); ++ ++ /* Turn off the vbus power */ ++ DWC_PRINTF("PortPower off\n"); ++ hprt0.b.prtpwr = 0; ++ DWC_WRITE_REG32(hcd->core_if->host_if->hprt0, hprt0.d32); ++ dwc_mdelay(1); ++} ++ ++int dwc_otg_hcd_urb_enqueue(dwc_otg_hcd_t * hcd, ++ dwc_otg_hcd_urb_t * dwc_otg_urb, void **ep_handle, ++ int atomic_alloc) ++{ ++ int retval = 0; ++ uint8_t needs_scheduling = 0; ++ dwc_otg_transaction_type_e tr_type; ++ dwc_otg_qtd_t *qtd; ++ gintmsk_data_t intr_mask = {.d32 = 0 }; ++ hprt0_data_t hprt0 = { .d32 = 0 }; ++ ++#ifdef DEBUG /* integrity checks (Broadcom) */ ++ if (NULL == hcd->core_if) { ++ DWC_ERROR("**** DWC OTG HCD URB Enqueue - HCD has NULL core_if\n"); ++ /* No longer connected. */ ++ return -DWC_E_INVALID; ++ } ++#endif ++ if (!hcd->flags.b.port_connect_status) { ++ /* No longer connected. */ ++ DWC_ERROR("Not connected\n"); ++ return -DWC_E_NO_DEVICE; ++ } ++ ++ /* Some core configurations cannot support LS traffic on a FS root port */ ++ if ((hcd->fops->speed(hcd, dwc_otg_urb->priv) == USB_SPEED_LOW) && ++ (hcd->core_if->hwcfg2.b.fs_phy_type == 1) && ++ (hcd->core_if->hwcfg2.b.hs_phy_type == 1)) { ++ hprt0.d32 = DWC_READ_REG32(hcd->core_if->host_if->hprt0); ++ if (hprt0.b.prtspd == DWC_HPRT0_PRTSPD_FULL_SPEED) { ++ return -DWC_E_NO_DEVICE; ++ } ++ } ++ ++ qtd = dwc_otg_hcd_qtd_create(dwc_otg_urb, atomic_alloc); ++ if (qtd == NULL) { ++ DWC_ERROR("DWC OTG HCD URB Enqueue failed creating QTD\n"); ++ return -DWC_E_NO_MEMORY; ++ } ++#ifdef DEBUG /* integrity checks (Broadcom) */ ++ if (qtd->urb == NULL) { ++ DWC_ERROR("**** DWC OTG HCD URB Enqueue created QTD with no URBs\n"); ++ return -DWC_E_NO_MEMORY; ++ } ++ if (qtd->urb->priv == NULL) { ++ DWC_ERROR("**** DWC OTG HCD URB Enqueue created QTD URB with no URB handle\n"); ++ return -DWC_E_NO_MEMORY; ++ } ++#endif ++ intr_mask.d32 = DWC_READ_REG32(&hcd->core_if->core_global_regs->gintmsk); ++ if(!intr_mask.b.sofintr || fiq_enable) needs_scheduling = 1; ++ if((((dwc_otg_qh_t *)ep_handle)->ep_type == UE_BULK) && !(qtd->urb->flags & URB_GIVEBACK_ASAP)) ++ /* Do not schedule SG transactions until qtd has URB_GIVEBACK_ASAP set */ ++ needs_scheduling = 0; ++ ++ retval = dwc_otg_hcd_qtd_add(qtd, hcd, (dwc_otg_qh_t **) ep_handle, atomic_alloc); ++ // creates a new queue in ep_handle if it doesn't exist already ++ if (retval < 0) { ++ DWC_ERROR("DWC OTG HCD URB Enqueue failed adding QTD. " ++ "Error status %d\n", retval); ++ dwc_otg_hcd_qtd_free(qtd); ++ return retval; ++ } ++ ++ if(needs_scheduling) { ++ tr_type = dwc_otg_hcd_select_transactions(hcd); ++ if (tr_type != DWC_OTG_TRANSACTION_NONE) { ++ dwc_otg_hcd_queue_transactions(hcd, tr_type); ++ } ++ } ++ return retval; ++} ++ ++int dwc_otg_hcd_urb_dequeue(dwc_otg_hcd_t * hcd, ++ dwc_otg_hcd_urb_t * dwc_otg_urb) ++{ ++ dwc_otg_qh_t *qh; ++ dwc_otg_qtd_t *urb_qtd; ++ BUG_ON(!hcd); ++ BUG_ON(!dwc_otg_urb); ++ ++#ifdef DEBUG /* integrity checks (Broadcom) */ ++ ++ if (hcd == NULL) { ++ DWC_ERROR("**** DWC OTG HCD URB Dequeue has NULL HCD\n"); ++ return -DWC_E_INVALID; ++ } ++ if (dwc_otg_urb == NULL) { ++ DWC_ERROR("**** DWC OTG HCD URB Dequeue has NULL URB\n"); ++ return -DWC_E_INVALID; ++ } ++ if (dwc_otg_urb->qtd == NULL) { ++ DWC_ERROR("**** DWC OTG HCD URB Dequeue with NULL QTD\n"); ++ return -DWC_E_INVALID; ++ } ++ urb_qtd = dwc_otg_urb->qtd; ++ BUG_ON(!urb_qtd); ++ if (urb_qtd->qh == NULL) { ++ DWC_ERROR("**** DWC OTG HCD URB Dequeue with QTD with NULL Q handler\n"); ++ return -DWC_E_INVALID; ++ } ++#else ++ urb_qtd = dwc_otg_urb->qtd; ++ BUG_ON(!urb_qtd); ++#endif ++ qh = urb_qtd->qh; ++ BUG_ON(!qh); ++ if (CHK_DEBUG_LEVEL(DBG_HCDV | DBG_HCD_URB)) { ++ if (urb_qtd->in_process) { ++ dump_channel_info(hcd, qh); ++ } ++ } ++#ifdef DEBUG /* integrity checks (Broadcom) */ ++ if (hcd->core_if == NULL) { ++ DWC_ERROR("**** DWC OTG HCD URB Dequeue HCD has NULL core_if\n"); ++ return -DWC_E_INVALID; ++ } ++#endif ++ if (urb_qtd->in_process && qh->channel) { ++ /* The QTD is in process (it has been assigned to a channel). */ ++ if (hcd->flags.b.port_connect_status) { ++ int n = qh->channel->hc_num; ++ /* ++ * If still connected (i.e. in host mode), halt the ++ * channel so it can be used for other transfers. If ++ * no longer connected, the host registers can't be ++ * written to halt the channel since the core is in ++ * device mode. ++ */ ++ /* In FIQ FSM mode, we need to shut down carefully. ++ * The FIQ may attempt to restart a disabled channel */ ++ if (fiq_fsm_enable && (hcd->fiq_state->channel[n].fsm != FIQ_PASSTHROUGH)) { ++ qh->channel->halt_status = DWC_OTG_HC_XFER_URB_DEQUEUE; ++ qh->channel->halt_pending = 1; ++ hcd->fiq_state->channel[n].fsm = FIQ_DEQUEUE_ISSUED; ++ } else { ++ dwc_otg_hc_halt(hcd->core_if, qh->channel, ++ DWC_OTG_HC_XFER_URB_DEQUEUE); ++ } ++ } ++ } ++ ++ /* ++ * Free the QTD and clean up the associated QH. Leave the QH in the ++ * schedule if it has any remaining QTDs. ++ */ ++ ++ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD URB Dequeue - " ++ "delete %sQueue handler\n", ++ hcd->core_if->dma_desc_enable?"DMA ":""); ++ if (!hcd->core_if->dma_desc_enable) { ++ uint8_t b = urb_qtd->in_process; ++ dwc_otg_hcd_qtd_remove_and_free(hcd, urb_qtd, qh); ++ if (b) { ++ dwc_otg_hcd_qh_deactivate(hcd, qh, 0); ++ qh->channel = NULL; ++ } else if (DWC_CIRCLEQ_EMPTY(&qh->qtd_list)) { ++ dwc_otg_hcd_qh_remove(hcd, qh); ++ } ++ } else { ++ dwc_otg_hcd_qtd_remove_and_free(hcd, urb_qtd, qh); ++ } ++ return 0; ++} ++ ++int dwc_otg_hcd_endpoint_disable(dwc_otg_hcd_t * hcd, void *ep_handle, ++ int retry) ++{ ++ dwc_otg_qh_t *qh = (dwc_otg_qh_t *) ep_handle; ++ int retval = 0; ++ dwc_irqflags_t flags; ++ ++ if (retry < 0) { ++ retval = -DWC_E_INVALID; ++ goto done; ++ } ++ ++ if (!qh) { ++ retval = -DWC_E_INVALID; ++ goto done; ++ } ++ ++ DWC_SPINLOCK_IRQSAVE(hcd->lock, &flags); ++ ++ while (!DWC_CIRCLEQ_EMPTY(&qh->qtd_list) && retry) { ++ DWC_SPINUNLOCK_IRQRESTORE(hcd->lock, flags); ++ retry--; ++ dwc_msleep(5); ++ DWC_SPINLOCK_IRQSAVE(hcd->lock, &flags); ++ } ++ ++ dwc_otg_hcd_qh_remove(hcd, qh); ++ ++ DWC_SPINUNLOCK_IRQRESTORE(hcd->lock, flags); ++ /* ++ * Split dwc_otg_hcd_qh_remove_and_free() into qh_remove ++ * and qh_free to prevent stack dump on DWC_DMA_FREE() with ++ * irq_disabled (spinlock_irqsave) in dwc_otg_hcd_desc_list_free() ++ * and dwc_otg_hcd_frame_list_alloc(). ++ */ ++ dwc_otg_hcd_qh_free(hcd, qh); ++ ++done: ++ return retval; ++} ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,30) ++int dwc_otg_hcd_endpoint_reset(dwc_otg_hcd_t * hcd, void *ep_handle) ++{ ++ int retval = 0; ++ dwc_otg_qh_t *qh = (dwc_otg_qh_t *) ep_handle; ++ if (!qh) ++ return -DWC_E_INVALID; ++ ++ qh->data_toggle = DWC_OTG_HC_PID_DATA0; ++ return retval; ++} ++#endif ++ ++/** ++ * HCD Callback structure for handling mode switching. ++ */ ++static dwc_otg_cil_callbacks_t hcd_cil_callbacks = { ++ .start = dwc_otg_hcd_start_cb, ++ .stop = dwc_otg_hcd_stop_cb, ++ .disconnect = dwc_otg_hcd_disconnect_cb, ++ .session_start = dwc_otg_hcd_session_start_cb, ++ .resume_wakeup = dwc_otg_hcd_rem_wakeup_cb, ++#ifdef CONFIG_USB_DWC_OTG_LPM ++ .sleep = dwc_otg_hcd_sleep_cb, ++#endif ++ .p = 0, ++}; ++ ++/** ++ * Reset tasklet function ++ */ ++static void reset_tasklet_func(void *data) ++{ ++ dwc_otg_hcd_t *dwc_otg_hcd = (dwc_otg_hcd_t *) data; ++ dwc_otg_core_if_t *core_if = dwc_otg_hcd->core_if; ++ hprt0_data_t hprt0; ++ ++ DWC_DEBUGPL(DBG_HCDV, "USB RESET tasklet called\n"); ++ ++ hprt0.d32 = dwc_otg_read_hprt0(core_if); ++ hprt0.b.prtrst = 1; ++ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); ++ dwc_mdelay(60); ++ ++ hprt0.b.prtrst = 0; ++ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); ++ dwc_otg_hcd->flags.b.port_reset_change = 1; ++} ++ ++static void completion_tasklet_func(void *ptr) ++{ ++ dwc_otg_hcd_t *hcd = (dwc_otg_hcd_t *) ptr; ++ struct urb *urb; ++ urb_tq_entry_t *item; ++ dwc_irqflags_t flags; ++ ++ /* This could just be spin_lock_irq */ ++ DWC_SPINLOCK_IRQSAVE(hcd->lock, &flags); ++ while (!DWC_TAILQ_EMPTY(&hcd->completed_urb_list)) { ++ item = DWC_TAILQ_FIRST(&hcd->completed_urb_list); ++ urb = item->urb; ++ DWC_TAILQ_REMOVE(&hcd->completed_urb_list, item, ++ urb_tq_entries); ++ DWC_SPINUNLOCK_IRQRESTORE(hcd->lock, flags); ++ DWC_FREE(item); ++ ++ usb_hcd_giveback_urb(hcd->priv, urb, urb->status); ++ ++ ++ DWC_SPINLOCK_IRQSAVE(hcd->lock, &flags); ++ } ++ DWC_SPINUNLOCK_IRQRESTORE(hcd->lock, flags); ++ return; ++} ++ ++static void qh_list_free(dwc_otg_hcd_t * hcd, dwc_list_link_t * qh_list) ++{ ++ dwc_list_link_t *item; ++ dwc_otg_qh_t *qh; ++ dwc_irqflags_t flags; ++ ++ if (!qh_list->next) { ++ /* The list hasn't been initialized yet. */ ++ return; ++ } ++ /* ++ * Hold spinlock here. Not needed in that case if bellow ++ * function is being called from ISR ++ */ ++ DWC_SPINLOCK_IRQSAVE(hcd->lock, &flags); ++ /* Ensure there are no QTDs or URBs left. */ ++ kill_urbs_in_qh_list(hcd, qh_list); ++ DWC_SPINUNLOCK_IRQRESTORE(hcd->lock, flags); ++ ++ DWC_LIST_FOREACH(item, qh_list) { ++ qh = DWC_LIST_ENTRY(item, dwc_otg_qh_t, qh_list_entry); ++ dwc_otg_hcd_qh_remove_and_free(hcd, qh); ++ } ++} ++ ++/** ++ * Exit from Hibernation if Host did not detect SRP from connected SRP capable ++ * Device during SRP time by host power up. ++ */ ++void dwc_otg_hcd_power_up(void *ptr) ++{ ++ gpwrdn_data_t gpwrdn = {.d32 = 0 }; ++ dwc_otg_core_if_t *core_if = (dwc_otg_core_if_t *) ptr; ++ ++ DWC_PRINTF("%s called\n", __FUNCTION__); ++ ++ if (!core_if->hibernation_suspend) { ++ DWC_PRINTF("Already exited from Hibernation\n"); ++ return; ++ } ++ ++ /* Switch on the voltage to the core */ ++ gpwrdn.b.pwrdnswtch = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ dwc_udelay(10); ++ ++ /* Reset the core */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pwrdnrstn = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ dwc_udelay(10); ++ ++ /* Disable power clamps */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pwrdnclmp = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ ++ /* Remove reset the core signal */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pwrdnrstn = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, 0, gpwrdn.d32); ++ dwc_udelay(10); ++ ++ /* Disable PMU interrupt */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pmuintsel = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ ++ core_if->hibernation_suspend = 0; ++ ++ /* Disable PMU */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pmuactv = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ dwc_udelay(10); ++ ++ /* Enable VBUS */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.dis_vbus = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); ++ ++ core_if->op_state = A_HOST; ++ dwc_otg_core_init(core_if); ++ dwc_otg_enable_global_interrupts(core_if); ++ cil_hcd_start(core_if); ++} ++ ++void dwc_otg_cleanup_fiq_channel(dwc_otg_hcd_t *hcd, uint32_t num) ++{ ++ struct fiq_channel_state *st = &hcd->fiq_state->channel[num]; ++ struct fiq_dma_blob *blob = hcd->fiq_dmab; ++ int i; ++ ++ st->fsm = FIQ_PASSTHROUGH; ++ st->hcchar_copy.d32 = 0; ++ st->hcsplt_copy.d32 = 0; ++ st->hcint_copy.d32 = 0; ++ st->hcintmsk_copy.d32 = 0; ++ st->hctsiz_copy.d32 = 0; ++ st->hcdma_copy.d32 = 0; ++ st->nr_errors = 0; ++ st->hub_addr = 0; ++ st->port_addr = 0; ++ st->expected_uframe = 0; ++ st->nrpackets = 0; ++ st->dma_info.index = 0; ++ for (i = 0; i < 6; i++) ++ st->dma_info.slot_len[i] = 255; ++ st->hs_isoc_info.index = 0; ++ st->hs_isoc_info.iso_desc = NULL; ++ st->hs_isoc_info.nrframes = 0; ++ ++ DWC_MEMSET(&blob->channel[num].index[0], 0x6b, 1128); ++} ++ ++/** ++ * Frees secondary storage associated with the dwc_otg_hcd structure contained ++ * in the struct usb_hcd field. ++ */ ++static void dwc_otg_hcd_free(dwc_otg_hcd_t * dwc_otg_hcd) ++{ ++ int i; ++ ++ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD FREE\n"); ++ ++ del_timers(dwc_otg_hcd); ++ ++ /* Free memory for QH/QTD lists */ ++ qh_list_free(dwc_otg_hcd, &dwc_otg_hcd->non_periodic_sched_inactive); ++ qh_list_free(dwc_otg_hcd, &dwc_otg_hcd->non_periodic_sched_active); ++ qh_list_free(dwc_otg_hcd, &dwc_otg_hcd->periodic_sched_inactive); ++ qh_list_free(dwc_otg_hcd, &dwc_otg_hcd->periodic_sched_ready); ++ qh_list_free(dwc_otg_hcd, &dwc_otg_hcd->periodic_sched_assigned); ++ qh_list_free(dwc_otg_hcd, &dwc_otg_hcd->periodic_sched_queued); ++ ++ /* Free memory for the host channels. */ ++ for (i = 0; i < MAX_EPS_CHANNELS; i++) { ++ dwc_hc_t *hc = dwc_otg_hcd->hc_ptr_array[i]; ++ ++#ifdef DEBUG ++ if (dwc_otg_hcd->core_if->hc_xfer_timer[i]) { ++ DWC_TIMER_FREE(dwc_otg_hcd->core_if->hc_xfer_timer[i]); ++ } ++#endif ++ if (hc != NULL) { ++ DWC_DEBUGPL(DBG_HCDV, "HCD Free channel #%i, hc=%p\n", ++ i, hc); ++ DWC_FREE(hc); ++ } ++ } ++ ++ if (dwc_otg_hcd->core_if->dma_enable) { ++ if (dwc_otg_hcd->status_buf_dma) { ++ DWC_DMA_FREE(DWC_OTG_HCD_STATUS_BUF_SIZE, ++ dwc_otg_hcd->status_buf, ++ dwc_otg_hcd->status_buf_dma); ++ } ++ } else if (dwc_otg_hcd->status_buf != NULL) { ++ DWC_FREE(dwc_otg_hcd->status_buf); ++ } ++ DWC_SPINLOCK_FREE(dwc_otg_hcd->channel_lock); ++ DWC_SPINLOCK_FREE(dwc_otg_hcd->lock); ++ /* Set core_if's lock pointer to NULL */ ++ dwc_otg_hcd->core_if->lock = NULL; ++ ++ DWC_TIMER_FREE(dwc_otg_hcd->conn_timer); ++ DWC_TASK_FREE(dwc_otg_hcd->reset_tasklet); ++ DWC_TASK_FREE(dwc_otg_hcd->completion_tasklet); ++ DWC_FREE(dwc_otg_hcd->fiq_state); ++ ++#ifdef DWC_DEV_SRPCAP ++ if (dwc_otg_hcd->core_if->power_down == 2 && ++ dwc_otg_hcd->core_if->pwron_timer) { ++ DWC_TIMER_FREE(dwc_otg_hcd->core_if->pwron_timer); ++ } ++#endif ++ DWC_FREE(dwc_otg_hcd); ++} ++ ++int init_hcd_usecs(dwc_otg_hcd_t *_hcd); ++ ++int dwc_otg_hcd_init(dwc_otg_hcd_t * hcd, dwc_otg_core_if_t * core_if) ++{ ++ int retval = 0; ++ int num_channels; ++ int i; ++ dwc_hc_t *channel; ++ ++#if (defined(DWC_LINUX) && defined(CONFIG_DEBUG_SPINLOCK)) ++ DWC_SPINLOCK_ALLOC_LINUX_DEBUG(hcd->lock); ++ DWC_SPINLOCK_ALLOC_LINUX_DEBUG(hcd->channel_lock); ++#else ++ hcd->lock = DWC_SPINLOCK_ALLOC(); ++ hcd->channel_lock = DWC_SPINLOCK_ALLOC(); ++#endif ++ DWC_DEBUGPL(DBG_HCDV, "init of HCD %p given core_if %p\n", ++ hcd, core_if); ++ if (!hcd->lock) { ++ DWC_ERROR("Could not allocate lock for pcd"); ++ DWC_FREE(hcd); ++ retval = -DWC_E_NO_MEMORY; ++ goto out; ++ } ++ hcd->core_if = core_if; ++ ++ /* Register the HCD CIL Callbacks */ ++ dwc_otg_cil_register_hcd_callbacks(hcd->core_if, ++ &hcd_cil_callbacks, hcd); ++ ++ /* Initialize the non-periodic schedule. */ ++ DWC_LIST_INIT(&hcd->non_periodic_sched_inactive); ++ DWC_LIST_INIT(&hcd->non_periodic_sched_active); ++ ++ /* Initialize the periodic schedule. */ ++ DWC_LIST_INIT(&hcd->periodic_sched_inactive); ++ DWC_LIST_INIT(&hcd->periodic_sched_ready); ++ DWC_LIST_INIT(&hcd->periodic_sched_assigned); ++ DWC_LIST_INIT(&hcd->periodic_sched_queued); ++ DWC_TAILQ_INIT(&hcd->completed_urb_list); ++ /* ++ * Create a host channel descriptor for each host channel implemented ++ * in the controller. Initialize the channel descriptor array. ++ */ ++ DWC_CIRCLEQ_INIT(&hcd->free_hc_list); ++ num_channels = hcd->core_if->core_params->host_channels; ++ DWC_MEMSET(hcd->hc_ptr_array, 0, sizeof(hcd->hc_ptr_array)); ++ for (i = 0; i < num_channels; i++) { ++ channel = DWC_ALLOC(sizeof(dwc_hc_t)); ++ if (channel == NULL) { ++ retval = -DWC_E_NO_MEMORY; ++ DWC_ERROR("%s: host channel allocation failed\n", ++ __func__); ++ dwc_otg_hcd_free(hcd); ++ goto out; ++ } ++ channel->hc_num = i; ++ hcd->hc_ptr_array[i] = channel; ++#ifdef DEBUG ++ hcd->core_if->hc_xfer_timer[i] = ++ DWC_TIMER_ALLOC("hc timer", hc_xfer_timeout, ++ &hcd->core_if->hc_xfer_info[i]); ++#endif ++ DWC_DEBUGPL(DBG_HCDV, "HCD Added channel #%d, hc=%p\n", i, ++ channel); ++ } ++ ++ if (fiq_enable) { ++ hcd->fiq_state = DWC_ALLOC(sizeof(struct fiq_state) + (sizeof(struct fiq_channel_state) * num_channels)); ++ if (!hcd->fiq_state) { ++ retval = -DWC_E_NO_MEMORY; ++ DWC_ERROR("%s: cannot allocate fiq_state structure\n", __func__); ++ dwc_otg_hcd_free(hcd); ++ goto out; ++ } ++ DWC_MEMSET(hcd->fiq_state, 0, (sizeof(struct fiq_state) + (sizeof(struct fiq_channel_state) * num_channels))); ++ ++ for (i = 0; i < num_channels; i++) { ++ hcd->fiq_state->channel[i].fsm = FIQ_PASSTHROUGH; ++ } ++ hcd->fiq_state->dummy_send = DWC_ALLOC_ATOMIC(16); ++ ++ hcd->fiq_stack = DWC_ALLOC(sizeof(struct fiq_stack)); ++ if (!hcd->fiq_stack) { ++ retval = -DWC_E_NO_MEMORY; ++ DWC_ERROR("%s: cannot allocate fiq_stack structure\n", __func__); ++ dwc_otg_hcd_free(hcd); ++ goto out; ++ } ++ hcd->fiq_stack->magic1 = 0xDEADBEEF; ++ hcd->fiq_stack->magic2 = 0xD00DFEED; ++ hcd->fiq_state->gintmsk_saved.d32 = ~0; ++ hcd->fiq_state->haintmsk_saved.b2.chint = ~0; ++ ++ /* This bit is terrible and uses no API, but necessary. The FIQ has no concept of DMA pools ++ * (and if it did, would be a lot slower). This allocates a chunk of memory (~9kiB for 8 host channels) ++ * for use as transaction bounce buffers in a 2-D array. Our access into this chunk is done by some ++ * moderately readable array casts. ++ */ ++ hcd->fiq_dmab = DWC_DMA_ALLOC((sizeof(struct fiq_dma_channel) * num_channels), &hcd->fiq_state->dma_base); ++ DWC_WARN("FIQ DMA bounce buffers: virt = 0x%08x dma = 0x%08x len=%d", ++ (unsigned int)hcd->fiq_dmab, (unsigned int)hcd->fiq_state->dma_base, ++ sizeof(struct fiq_dma_channel) * num_channels); ++ ++ DWC_MEMSET(hcd->fiq_dmab, 0x6b, 9024); ++ ++ /* pointer for debug in fiq_print */ ++ hcd->fiq_state->fiq_dmab = hcd->fiq_dmab; ++ if (fiq_fsm_enable) { ++ int i; ++ for (i=0; i < hcd->core_if->core_params->host_channels; i++) { ++ dwc_otg_cleanup_fiq_channel(hcd, i); ++ } ++ DWC_PRINTF("FIQ FSM acceleration enabled for :\n%s%s%s%s", ++ (fiq_fsm_mask & 0x1) ? "Non-periodic Split Transactions\n" : "", ++ (fiq_fsm_mask & 0x2) ? "Periodic Split Transactions\n" : "", ++ (fiq_fsm_mask & 0x4) ? "High-Speed Isochronous Endpoints\n" : "", ++ (fiq_fsm_mask & 0x8) ? "Interrupt/Control Split Transaction hack enabled\n" : ""); ++ } ++ } ++ ++ /* Initialize the Connection timeout timer. */ ++ hcd->conn_timer = DWC_TIMER_ALLOC("Connection timer", ++ dwc_otg_hcd_connect_timeout, 0); ++ ++ printk(KERN_DEBUG "dwc_otg: Microframe scheduler %s\n", microframe_schedule ? "enabled":"disabled"); ++ if (microframe_schedule) ++ init_hcd_usecs(hcd); ++ ++ /* Initialize reset tasklet. */ ++ hcd->reset_tasklet = DWC_TASK_ALLOC("reset_tasklet", reset_tasklet_func, hcd); ++ ++ hcd->completion_tasklet = DWC_TASK_ALLOC("completion_tasklet", ++ completion_tasklet_func, hcd); ++#ifdef DWC_DEV_SRPCAP ++ if (hcd->core_if->power_down == 2) { ++ /* Initialize Power on timer for Host power up in case hibernation */ ++ hcd->core_if->pwron_timer = DWC_TIMER_ALLOC("PWRON TIMER", ++ dwc_otg_hcd_power_up, core_if); ++ } ++#endif ++ ++ /* ++ * Allocate space for storing data on status transactions. Normally no ++ * data is sent, but this space acts as a bit bucket. This must be ++ * done after usb_add_hcd since that function allocates the DMA buffer ++ * pool. ++ */ ++ if (hcd->core_if->dma_enable) { ++ hcd->status_buf = ++ DWC_DMA_ALLOC(DWC_OTG_HCD_STATUS_BUF_SIZE, ++ &hcd->status_buf_dma); ++ } else { ++ hcd->status_buf = DWC_ALLOC(DWC_OTG_HCD_STATUS_BUF_SIZE); ++ } ++ if (!hcd->status_buf) { ++ retval = -DWC_E_NO_MEMORY; ++ DWC_ERROR("%s: status_buf allocation failed\n", __func__); ++ dwc_otg_hcd_free(hcd); ++ goto out; ++ } ++ ++ hcd->otg_port = 1; ++ hcd->frame_list = NULL; ++ hcd->frame_list_dma = 0; ++ hcd->periodic_qh_count = 0; ++ ++ DWC_MEMSET(hcd->hub_port, 0, sizeof(hcd->hub_port)); ++#ifdef FIQ_DEBUG ++ DWC_MEMSET(hcd->hub_port_alloc, -1, sizeof(hcd->hub_port_alloc)); ++#endif ++ ++out: ++ return retval; ++} ++ ++void dwc_otg_hcd_remove(dwc_otg_hcd_t * hcd) ++{ ++ /* Turn off all host-specific interrupts. */ ++ dwc_otg_disable_host_interrupts(hcd->core_if); ++ ++ dwc_otg_hcd_free(hcd); ++} ++ ++/** ++ * Initializes dynamic portions of the DWC_otg HCD state. ++ */ ++static void dwc_otg_hcd_reinit(dwc_otg_hcd_t * hcd) ++{ ++ int num_channels; ++ int i; ++ dwc_hc_t *channel; ++ dwc_hc_t *channel_tmp; ++ ++ hcd->flags.d32 = 0; ++ ++ hcd->non_periodic_qh_ptr = &hcd->non_periodic_sched_active; ++ if (!microframe_schedule) { ++ hcd->non_periodic_channels = 0; ++ hcd->periodic_channels = 0; ++ } else { ++ hcd->available_host_channels = hcd->core_if->core_params->host_channels; ++ } ++ /* ++ * Put all channels in the free channel list and clean up channel ++ * states. ++ */ ++ DWC_CIRCLEQ_FOREACH_SAFE(channel, channel_tmp, ++ &hcd->free_hc_list, hc_list_entry) { ++ DWC_CIRCLEQ_REMOVE(&hcd->free_hc_list, channel, hc_list_entry); ++ } ++ ++ num_channels = hcd->core_if->core_params->host_channels; ++ for (i = 0; i < num_channels; i++) { ++ channel = hcd->hc_ptr_array[i]; ++ DWC_CIRCLEQ_INSERT_TAIL(&hcd->free_hc_list, channel, ++ hc_list_entry); ++ dwc_otg_hc_cleanup(hcd->core_if, channel); ++ } ++ ++ /* Initialize the DWC core for host mode operation. */ ++ dwc_otg_core_host_init(hcd->core_if); ++ ++ /* Set core_if's lock pointer to the hcd->lock */ ++ hcd->core_if->lock = hcd->lock; ++} ++ ++/** ++ * Assigns transactions from a QTD to a free host channel and initializes the ++ * host channel to perform the transactions. The host channel is removed from ++ * the free list. ++ * ++ * @param hcd The HCD state structure. ++ * @param qh Transactions from the first QTD for this QH are selected and ++ * assigned to a free host channel. ++ */ ++static void assign_and_init_hc(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh) ++{ ++ dwc_hc_t *hc; ++ dwc_otg_qtd_t *qtd; ++ dwc_otg_hcd_urb_t *urb; ++ void* ptr = NULL; ++ uint32_t intr_enable; ++ unsigned long flags; ++ gintmsk_data_t gintmsk = { .d32 = 0, }; ++ ++ qtd = DWC_CIRCLEQ_FIRST(&qh->qtd_list); ++ ++ urb = qtd->urb; ++ ++ DWC_DEBUGPL(DBG_HCDV, "%s(%p,%p) - urb %x, actual_length %d\n", __func__, hcd, qh, (unsigned int)urb, urb->actual_length); ++ ++ if (((urb->actual_length < 0) || (urb->actual_length > urb->length)) && !dwc_otg_hcd_is_pipe_in(&urb->pipe_info)) ++ urb->actual_length = urb->length; ++ ++ ++ hc = DWC_CIRCLEQ_FIRST(&hcd->free_hc_list); ++ ++ /* Remove the host channel from the free list. */ ++ DWC_CIRCLEQ_REMOVE_INIT(&hcd->free_hc_list, hc, hc_list_entry); ++ ++ qh->channel = hc; ++ ++ qtd->in_process = 1; ++ ++ /* ++ * Use usb_pipedevice to determine device address. This address is ++ * 0 before the SET_ADDRESS command and the correct address afterward. ++ */ ++ hc->dev_addr = dwc_otg_hcd_get_dev_addr(&urb->pipe_info); ++ hc->ep_num = dwc_otg_hcd_get_ep_num(&urb->pipe_info); ++ hc->speed = qh->dev_speed; ++ hc->max_packet = dwc_max_packet(qh->maxp); ++ ++ hc->xfer_started = 0; ++ hc->halt_status = DWC_OTG_HC_XFER_NO_HALT_STATUS; ++ hc->error_state = (qtd->error_count > 0); ++ hc->halt_on_queue = 0; ++ hc->halt_pending = 0; ++ hc->requests = 0; ++ ++ /* ++ * The following values may be modified in the transfer type section ++ * below. The xfer_len value may be reduced when the transfer is ++ * started to accommodate the max widths of the XferSize and PktCnt ++ * fields in the HCTSIZn register. ++ */ ++ ++ hc->ep_is_in = (dwc_otg_hcd_is_pipe_in(&urb->pipe_info) != 0); ++ if (hc->ep_is_in) { ++ hc->do_ping = 0; ++ } else { ++ hc->do_ping = qh->ping_state; ++ } ++ ++ hc->data_pid_start = qh->data_toggle; ++ hc->multi_count = 1; ++ ++ if (hcd->core_if->dma_enable) { ++ hc->xfer_buff = (uint8_t *) urb->dma + urb->actual_length; ++ ++ /* For non-dword aligned case */ ++ if (((unsigned long)hc->xfer_buff & 0x3) ++ && !hcd->core_if->dma_desc_enable) { ++ ptr = (uint8_t *) urb->buf + urb->actual_length; ++ } ++ } else { ++ hc->xfer_buff = (uint8_t *) urb->buf + urb->actual_length; ++ } ++ hc->xfer_len = urb->length - urb->actual_length; ++ hc->xfer_count = 0; ++ ++ /* ++ * Set the split attributes ++ */ ++ hc->do_split = 0; ++ if (qh->do_split) { ++ uint32_t hub_addr, port_addr; ++ hc->do_split = 1; ++ hc->xact_pos = qtd->isoc_split_pos; ++ /* We don't need to do complete splits anymore */ ++// if(fiq_fsm_enable) ++ if (0) ++ hc->complete_split = qtd->complete_split = 0; ++ else ++ hc->complete_split = qtd->complete_split; ++ ++ hcd->fops->hub_info(hcd, urb->priv, &hub_addr, &port_addr); ++ hc->hub_addr = (uint8_t) hub_addr; ++ hc->port_addr = (uint8_t) port_addr; ++ } ++ ++ switch (dwc_otg_hcd_get_pipe_type(&urb->pipe_info)) { ++ case UE_CONTROL: ++ hc->ep_type = DWC_OTG_EP_TYPE_CONTROL; ++ switch (qtd->control_phase) { ++ case DWC_OTG_CONTROL_SETUP: ++ DWC_DEBUGPL(DBG_HCDV, " Control setup transaction\n"); ++ hc->do_ping = 0; ++ hc->ep_is_in = 0; ++ hc->data_pid_start = DWC_OTG_HC_PID_SETUP; ++ if (hcd->core_if->dma_enable) { ++ hc->xfer_buff = (uint8_t *) urb->setup_dma; ++ } else { ++ hc->xfer_buff = (uint8_t *) urb->setup_packet; ++ } ++ hc->xfer_len = 8; ++ ptr = NULL; ++ break; ++ case DWC_OTG_CONTROL_DATA: ++ DWC_DEBUGPL(DBG_HCDV, " Control data transaction\n"); ++ hc->data_pid_start = qtd->data_toggle; ++ break; ++ case DWC_OTG_CONTROL_STATUS: ++ /* ++ * Direction is opposite of data direction or IN if no ++ * data. ++ */ ++ DWC_DEBUGPL(DBG_HCDV, " Control status transaction\n"); ++ if (urb->length == 0) { ++ hc->ep_is_in = 1; ++ } else { ++ hc->ep_is_in = ++ dwc_otg_hcd_is_pipe_out(&urb->pipe_info); ++ } ++ if (hc->ep_is_in) { ++ hc->do_ping = 0; ++ } ++ ++ hc->data_pid_start = DWC_OTG_HC_PID_DATA1; ++ ++ hc->xfer_len = 0; ++ if (hcd->core_if->dma_enable) { ++ hc->xfer_buff = (uint8_t *) hcd->status_buf_dma; ++ } else { ++ hc->xfer_buff = (uint8_t *) hcd->status_buf; ++ } ++ ptr = NULL; ++ break; ++ } ++ break; ++ case UE_BULK: ++ hc->ep_type = DWC_OTG_EP_TYPE_BULK; ++ break; ++ case UE_INTERRUPT: ++ hc->ep_type = DWC_OTG_EP_TYPE_INTR; ++ break; ++ case UE_ISOCHRONOUS: ++ { ++ struct dwc_otg_hcd_iso_packet_desc *frame_desc; ++ ++ hc->ep_type = DWC_OTG_EP_TYPE_ISOC; ++ ++ if (hcd->core_if->dma_desc_enable) ++ break; ++ ++ frame_desc = &urb->iso_descs[qtd->isoc_frame_index]; ++ ++ frame_desc->status = 0; ++ ++ if (hcd->core_if->dma_enable) { ++ hc->xfer_buff = (uint8_t *) urb->dma; ++ } else { ++ hc->xfer_buff = (uint8_t *) urb->buf; ++ } ++ hc->xfer_buff += ++ frame_desc->offset + qtd->isoc_split_offset; ++ hc->xfer_len = ++ frame_desc->length - qtd->isoc_split_offset; ++ ++ /* For non-dword aligned buffers */ ++ if (((unsigned long)hc->xfer_buff & 0x3) ++ && hcd->core_if->dma_enable) { ++ ptr = ++ (uint8_t *) urb->buf + frame_desc->offset + ++ qtd->isoc_split_offset; ++ } else ++ ptr = NULL; ++ ++ if (hc->xact_pos == DWC_HCSPLIT_XACTPOS_ALL) { ++ if (hc->xfer_len <= 188) { ++ hc->xact_pos = DWC_HCSPLIT_XACTPOS_ALL; ++ } else { ++ hc->xact_pos = ++ DWC_HCSPLIT_XACTPOS_BEGIN; ++ } ++ } ++ } ++ break; ++ } ++ /* non DWORD-aligned buffer case */ ++ if (ptr) { ++ uint32_t buf_size; ++ if (hc->ep_type != DWC_OTG_EP_TYPE_ISOC) { ++ buf_size = hcd->core_if->core_params->max_transfer_size; ++ } else { ++ buf_size = 4096; ++ } ++ if (!qh->dw_align_buf) { ++ qh->dw_align_buf = DWC_DMA_ALLOC_ATOMIC(buf_size, ++ &qh->dw_align_buf_dma); ++ if (!qh->dw_align_buf) { ++ DWC_ERROR ++ ("%s: Failed to allocate memory to handle " ++ "non-dword aligned buffer case\n", ++ __func__); ++ return; ++ } ++ } ++ if (!hc->ep_is_in) { ++ dwc_memcpy(qh->dw_align_buf, ptr, hc->xfer_len); ++ } ++ hc->align_buff = qh->dw_align_buf_dma; ++ } else { ++ hc->align_buff = 0; ++ } ++ ++ if (hc->ep_type == DWC_OTG_EP_TYPE_INTR || ++ hc->ep_type == DWC_OTG_EP_TYPE_ISOC) { ++ /* ++ * This value may be modified when the transfer is started to ++ * reflect the actual transfer length. ++ */ ++ hc->multi_count = dwc_hb_mult(qh->maxp); ++ } ++ ++ if (hcd->core_if->dma_desc_enable) ++ hc->desc_list_addr = qh->desc_list_dma; ++ ++ dwc_otg_hc_init(hcd->core_if, hc); ++ ++ local_irq_save(flags); ++ ++ if (fiq_enable) { ++ local_fiq_disable(); ++ fiq_fsm_spin_lock(&hcd->fiq_state->lock); ++ } ++ ++ /* Enable the top level host channel interrupt. */ ++ intr_enable = (1 << hc->hc_num); ++ DWC_MODIFY_REG32(&hcd->core_if->host_if->host_global_regs->haintmsk, 0, intr_enable); ++ ++ /* Make sure host channel interrupts are enabled. */ ++ gintmsk.b.hcintr = 1; ++ DWC_MODIFY_REG32(&hcd->core_if->core_global_regs->gintmsk, 0, gintmsk.d32); ++ ++ if (fiq_enable) { ++ fiq_fsm_spin_unlock(&hcd->fiq_state->lock); ++ local_fiq_enable(); ++ } ++ ++ local_irq_restore(flags); ++ hc->qh = qh; ++} ++ ++ ++/** ++ * fiq_fsm_transaction_suitable() - Test a QH for compatibility with the FIQ ++ * @qh: pointer to the endpoint's queue head ++ * ++ * Transaction start/end control flow is grafted onto the existing dwc_otg ++ * mechanisms, to avoid spaghettifying the functions more than they already are. ++ * This function's eligibility check is altered by debug parameter. ++ * ++ * Returns: 0 for unsuitable, 1 implies the FIQ can be enabled for this transaction. ++ */ ++ ++int fiq_fsm_transaction_suitable(dwc_otg_qh_t *qh) ++{ ++ if (qh->do_split) { ++ switch (qh->ep_type) { ++ case UE_CONTROL: ++ case UE_BULK: ++ if (fiq_fsm_mask & (1 << 0)) ++ return 1; ++ break; ++ case UE_INTERRUPT: ++ case UE_ISOCHRONOUS: ++ if (fiq_fsm_mask & (1 << 1)) ++ return 1; ++ break; ++ default: ++ break; ++ } ++ } else if (qh->ep_type == UE_ISOCHRONOUS) { ++ if (fiq_fsm_mask & (1 << 2)) { ++ /* HS ISOCH support. We test for compatibility: ++ * - DWORD aligned buffers ++ * - Must be at least 2 transfers (otherwise pointless to use the FIQ) ++ * If yes, then the fsm enqueue function will handle the state machine setup. ++ */ ++ dwc_otg_qtd_t *qtd = DWC_CIRCLEQ_FIRST(&qh->qtd_list); ++ dwc_otg_hcd_urb_t *urb = qtd->urb; ++ struct dwc_otg_hcd_iso_packet_desc (*iso_descs)[0] = &urb->iso_descs; ++ int nr_iso_frames = urb->packet_count; ++ int i; ++ uint32_t ptr; ++ ++ if (nr_iso_frames < 2) ++ return 0; ++ for (i = 0; i < nr_iso_frames; i++) { ++ ptr = urb->dma + iso_descs[i]->offset; ++ if (ptr & 0x3) { ++ printk_ratelimited("%s: Non-Dword aligned isochronous frame offset." ++ " Cannot queue FIQ-accelerated transfer to device %d endpoint %d\n", ++ __FUNCTION__, qh->channel->dev_addr, qh->channel->ep_num); ++ return 0; ++ } ++ } ++ return 1; ++ } ++ } ++ return 0; ++} ++ ++/** ++ * fiq_fsm_setup_periodic_dma() - Set up DMA bounce buffers ++ * @hcd: Pointer to the dwc_otg_hcd struct ++ * @qh: Pointer to the endpoint's queue head ++ * ++ * Periodic split transactions are transmitted modulo 188 bytes. ++ * This necessitates slicing data up into buckets for isochronous out ++ * and fixing up the DMA address for all IN transfers. ++ * ++ * Returns 1 if the DMA bounce buffers have been used, 0 if the default ++ * HC buffer has been used. ++ */ ++int fiq_fsm_setup_periodic_dma(dwc_otg_hcd_t *hcd, struct fiq_channel_state *st, dwc_otg_qh_t *qh) ++ { ++ int frame_length, i = 0; ++ uint8_t *ptr = NULL; ++ dwc_hc_t *hc = qh->channel; ++ struct fiq_dma_blob *blob; ++ struct dwc_otg_hcd_iso_packet_desc *frame_desc; ++ ++ for (i = 0; i < 6; i++) { ++ st->dma_info.slot_len[i] = 255; ++ } ++ st->dma_info.index = 0; ++ i = 0; ++ if (hc->ep_is_in) { ++ /* ++ * Set dma_regs to bounce buffer. FIQ will update the ++ * state depending on transaction progress. ++ */ ++ blob = (struct fiq_dma_blob *) hcd->fiq_state->dma_base; ++ st->hcdma_copy.d32 = (uint32_t) &blob->channel[hc->hc_num].index[0].buf[0]; ++ /* Calculate the max number of CSPLITS such that the FIQ can time out ++ * a transaction if it fails. ++ */ ++ frame_length = st->hcchar_copy.b.mps; ++ do { ++ i++; ++ frame_length -= 188; ++ } while (frame_length >= 0); ++ st->nrpackets = i; ++ return 1; ++ } else { ++ if (qh->ep_type == UE_ISOCHRONOUS) { ++ ++ dwc_otg_qtd_t *qtd = DWC_CIRCLEQ_FIRST(&qh->qtd_list); ++ ++ frame_desc = &qtd->urb->iso_descs[qtd->isoc_frame_index]; ++ frame_length = frame_desc->length; ++ ++ /* Virtual address for bounce buffers */ ++ blob = hcd->fiq_dmab; ++ ++ ptr = qtd->urb->buf + frame_desc->offset; ++ if (frame_length == 0) { ++ /* ++ * for isochronous transactions, we must still transmit a packet ++ * even if the length is zero. ++ */ ++ st->dma_info.slot_len[0] = 0; ++ st->nrpackets = 1; ++ } else { ++ do { ++ if (frame_length <= 188) { ++ dwc_memcpy(&blob->channel[hc->hc_num].index[i].buf[0], ptr, frame_length); ++ st->dma_info.slot_len[i] = frame_length; ++ ptr += frame_length; ++ } else { ++ dwc_memcpy(&blob->channel[hc->hc_num].index[i].buf[0], ptr, 188); ++ st->dma_info.slot_len[i] = 188; ++ ptr += 188; ++ } ++ i++; ++ frame_length -= 188; ++ } while (frame_length > 0); ++ st->nrpackets = i; ++ } ++ ptr = qtd->urb->buf + frame_desc->offset; ++ /* Point the HC at the DMA address of the bounce buffers */ ++ blob = (struct fiq_dma_blob *) hcd->fiq_state->dma_base; ++ st->hcdma_copy.d32 = (uint32_t) &blob->channel[hc->hc_num].index[0].buf[0]; ++ ++ /* fixup xfersize to the actual packet size */ ++ st->hctsiz_copy.b.pid = 0; ++ st->hctsiz_copy.b.xfersize = st->dma_info.slot_len[0]; ++ return 1; ++ } else { ++ /* For interrupt, single OUT packet required, goes in the SSPLIT from hc_buff. */ ++ return 0; ++ } ++ } ++} ++ ++/* ++ * Pushing a periodic request into the queue near the EOF1 point ++ * in a microframe causes erroneous behaviour (frmovrun) interrupt. ++ * Usually, the request goes out on the bus causing a transfer but ++ * the core does not transfer the data to memory. ++ * This guard interval (in number of 60MHz clocks) is required which ++ * must cater for CPU latency between reading the value and enabling ++ * the channel. ++ */ ++#define PERIODIC_FRREM_BACKOFF 1000 ++ ++int fiq_fsm_queue_isoc_transaction(dwc_otg_hcd_t *hcd, dwc_otg_qh_t *qh) ++{ ++ dwc_hc_t *hc = qh->channel; ++ dwc_otg_hc_regs_t *hc_regs = hcd->core_if->host_if->hc_regs[hc->hc_num]; ++ dwc_otg_qtd_t *qtd = DWC_CIRCLEQ_FIRST(&qh->qtd_list); ++ int frame; ++ struct fiq_channel_state *st = &hcd->fiq_state->channel[hc->hc_num]; ++ int xfer_len, nrpackets; ++ hcdma_data_t hcdma; ++ hfnum_data_t hfnum; ++ ++ if (st->fsm != FIQ_PASSTHROUGH) ++ return 0; ++ ++ st->nr_errors = 0; ++ ++ st->hcchar_copy.d32 = 0; ++ st->hcchar_copy.b.mps = hc->max_packet; ++ st->hcchar_copy.b.epdir = hc->ep_is_in; ++ st->hcchar_copy.b.devaddr = hc->dev_addr; ++ st->hcchar_copy.b.epnum = hc->ep_num; ++ st->hcchar_copy.b.eptype = hc->ep_type; ++ ++ st->hcintmsk_copy.b.chhltd = 1; ++ ++ frame = dwc_otg_hcd_get_frame_number(hcd); ++ st->hcchar_copy.b.oddfrm = (frame & 0x1) ? 0 : 1; ++ ++ st->hcchar_copy.b.lspddev = 0; ++ /* Enable the channel later as a final register write. */ ++ ++ st->hcsplt_copy.d32 = 0; ++ ++ st->hs_isoc_info.iso_desc = (struct dwc_otg_hcd_iso_packet_desc *) &qtd->urb->iso_descs; ++ st->hs_isoc_info.nrframes = qtd->urb->packet_count; ++ /* grab the next DMA address offset from the array */ ++ st->hcdma_copy.d32 = qtd->urb->dma; ++ hcdma.d32 = st->hcdma_copy.d32 + st->hs_isoc_info.iso_desc[0].offset; ++ ++ /* We need to set multi_count. This is a bit tricky - has to be set per-transaction as ++ * the core needs to be told to send the correct number. Caution: for IN transfers, ++ * this is always set to the maximum size of the endpoint. */ ++ xfer_len = st->hs_isoc_info.iso_desc[0].length; ++ nrpackets = (xfer_len + st->hcchar_copy.b.mps - 1) / st->hcchar_copy.b.mps; ++ if (nrpackets == 0) ++ nrpackets = 1; ++ st->hcchar_copy.b.multicnt = nrpackets; ++ st->hctsiz_copy.b.pktcnt = nrpackets; ++ ++ /* Initial PID also needs to be set */ ++ if (st->hcchar_copy.b.epdir == 0) { ++ st->hctsiz_copy.b.xfersize = xfer_len; ++ switch (st->hcchar_copy.b.multicnt) { ++ case 1: ++ st->hctsiz_copy.b.pid = DWC_PID_DATA0; ++ break; ++ case 2: ++ case 3: ++ st->hctsiz_copy.b.pid = DWC_PID_MDATA; ++ break; ++ } ++ ++ } else { ++ st->hctsiz_copy.b.xfersize = nrpackets * st->hcchar_copy.b.mps; ++ switch (st->hcchar_copy.b.multicnt) { ++ case 1: ++ st->hctsiz_copy.b.pid = DWC_PID_DATA0; ++ break; ++ case 2: ++ st->hctsiz_copy.b.pid = DWC_PID_DATA1; ++ break; ++ case 3: ++ st->hctsiz_copy.b.pid = DWC_PID_DATA2; ++ break; ++ } ++ } ++ ++ st->hs_isoc_info.stride = qh->interval; ++ st->uframe_sleeps = 0; ++ ++ fiq_print(FIQDBG_INT, hcd->fiq_state, "FSMQ %01d ", hc->hc_num); ++ fiq_print(FIQDBG_INT, hcd->fiq_state, "%08x", st->hcchar_copy.d32); ++ fiq_print(FIQDBG_INT, hcd->fiq_state, "%08x", st->hctsiz_copy.d32); ++ fiq_print(FIQDBG_INT, hcd->fiq_state, "%08x", st->hcdma_copy.d32); ++ hfnum.d32 = DWC_READ_REG32(&hcd->core_if->host_if->host_global_regs->hfnum); ++ local_fiq_disable(); ++ fiq_fsm_spin_lock(&hcd->fiq_state->lock); ++ DWC_WRITE_REG32(&hc_regs->hctsiz, st->hctsiz_copy.d32); ++ DWC_WRITE_REG32(&hc_regs->hcsplt, st->hcsplt_copy.d32); ++ DWC_WRITE_REG32(&hc_regs->hcdma, st->hcdma_copy.d32); ++ DWC_WRITE_REG32(&hc_regs->hcchar, st->hcchar_copy.d32); ++ DWC_WRITE_REG32(&hc_regs->hcintmsk, st->hcintmsk_copy.d32); ++ if (hfnum.b.frrem < PERIODIC_FRREM_BACKOFF) { ++ /* Prevent queueing near EOF1. Bad things happen if a periodic ++ * split transaction is queued very close to EOF. SOF interrupt handler ++ * will wake this channel at the next interrupt. ++ */ ++ st->fsm = FIQ_HS_ISOC_SLEEPING; ++ st->uframe_sleeps = 1; ++ } else { ++ st->fsm = FIQ_HS_ISOC_TURBO; ++ st->hcchar_copy.b.chen = 1; ++ DWC_WRITE_REG32(&hc_regs->hcchar, st->hcchar_copy.d32); ++ } ++ mb(); ++ st->hcchar_copy.b.chen = 0; ++ fiq_fsm_spin_unlock(&hcd->fiq_state->lock); ++ local_fiq_enable(); ++ return 0; ++} ++ ++ ++/** ++ * fiq_fsm_queue_split_transaction() - Set up a host channel and FIQ state ++ * @hcd: Pointer to the dwc_otg_hcd struct ++ * @qh: Pointer to the endpoint's queue head ++ * ++ * This overrides the dwc_otg driver's normal method of queueing a transaction. ++ * Called from dwc_otg_hcd_queue_transactions(), this performs specific setup ++ * for the nominated host channel. ++ * ++ * For periodic transfers, it also peeks at the FIQ state to see if an immediate ++ * start is possible. If not, then the FIQ is left to start the transfer. ++ */ ++int fiq_fsm_queue_split_transaction(dwc_otg_hcd_t *hcd, dwc_otg_qh_t *qh) ++{ ++ int start_immediate = 1, i; ++ hfnum_data_t hfnum; ++ dwc_hc_t *hc = qh->channel; ++ dwc_otg_hc_regs_t *hc_regs = hcd->core_if->host_if->hc_regs[hc->hc_num]; ++ /* Program HC registers, setup FIQ_state, examine FIQ if periodic, start transfer (not if uframe 5) */ ++ int hub_addr, port_addr, frame, uframe; ++ struct fiq_channel_state *st = &hcd->fiq_state->channel[hc->hc_num]; ++ ++ if (st->fsm != FIQ_PASSTHROUGH) ++ return 0; ++ st->nr_errors = 0; ++ ++ st->hcchar_copy.d32 = 0; ++ st->hcchar_copy.b.mps = hc->max_packet; ++ st->hcchar_copy.b.epdir = hc->ep_is_in; ++ st->hcchar_copy.b.devaddr = hc->dev_addr; ++ st->hcchar_copy.b.epnum = hc->ep_num; ++ st->hcchar_copy.b.eptype = hc->ep_type; ++ if (hc->ep_type & 0x1) { ++ if (hc->ep_is_in) ++ st->hcchar_copy.b.multicnt = 3; ++ else ++ /* Docs say set this to 1, but driver sets to 0! */ ++ st->hcchar_copy.b.multicnt = 0; ++ } else { ++ st->hcchar_copy.b.multicnt = 1; ++ st->hcchar_copy.b.oddfrm = 0; ++ } ++ st->hcchar_copy.b.lspddev = (hc->speed == DWC_OTG_EP_SPEED_LOW) ? 1 : 0; ++ /* Enable the channel later as a final register write. */ ++ ++ st->hcsplt_copy.d32 = 0; ++ if(qh->do_split) { ++ hcd->fops->hub_info(hcd, DWC_CIRCLEQ_FIRST(&qh->qtd_list)->urb->priv, &hub_addr, &port_addr); ++ st->hcsplt_copy.b.compsplt = 0; ++ st->hcsplt_copy.b.spltena = 1; ++ // XACTPOS is for isoc-out only but needs initialising anyway. ++ st->hcsplt_copy.b.xactpos = ISOC_XACTPOS_ALL; ++ if((qh->ep_type == DWC_OTG_EP_TYPE_ISOC) && (!qh->ep_is_in)) { ++ /* For packetsize 0 < L < 188, ISOC_XACTPOS_ALL. ++ * for longer than this, ISOC_XACTPOS_BEGIN and the FIQ ++ * will update as necessary. ++ */ ++ if (hc->xfer_len > 188) { ++ st->hcsplt_copy.b.xactpos = ISOC_XACTPOS_BEGIN; ++ } ++ } ++ st->hcsplt_copy.b.hubaddr = (uint8_t) hub_addr; ++ st->hcsplt_copy.b.prtaddr = (uint8_t) port_addr; ++ st->hub_addr = hub_addr; ++ st->port_addr = port_addr; ++ } ++ ++ st->hctsiz_copy.d32 = 0; ++ st->hctsiz_copy.b.dopng = 0; ++ st->hctsiz_copy.b.pid = hc->data_pid_start; ++ ++ if (hc->ep_is_in || (hc->xfer_len > hc->max_packet)) { ++ hc->xfer_len = hc->max_packet; ++ } else if (!hc->ep_is_in && (hc->xfer_len > 188)) { ++ hc->xfer_len = 188; ++ } ++ st->hctsiz_copy.b.xfersize = hc->xfer_len; ++ ++ st->hctsiz_copy.b.pktcnt = 1; ++ ++ if (hc->ep_type & 0x1) { ++ /* ++ * For potentially multi-packet transfers, must use the DMA bounce buffers. For IN transfers, ++ * the DMA address is the address of the first 188byte slot buffer in the bounce buffer array. ++ * For multi-packet OUT transfers, we need to copy the data into the bounce buffer array so the FIQ can punt ++ * the right address out as necessary. hc->xfer_buff and hc->xfer_len have already been set ++ * in assign_and_init_hc(), but this is for the eventual transaction completion only. The FIQ ++ * must not touch internal driver state. ++ */ ++ if(!fiq_fsm_setup_periodic_dma(hcd, st, qh)) { ++ if (hc->align_buff) { ++ st->hcdma_copy.d32 = hc->align_buff; ++ } else { ++ st->hcdma_copy.d32 = ((unsigned long) hc->xfer_buff & 0xFFFFFFFF); ++ } ++ } ++ } else { ++ if (hc->align_buff) { ++ st->hcdma_copy.d32 = hc->align_buff; ++ } else { ++ st->hcdma_copy.d32 = ((unsigned long) hc->xfer_buff & 0xFFFFFFFF); ++ } ++ } ++ /* The FIQ depends upon no other interrupts being enabled except channel halt. ++ * Fixup channel interrupt mask. */ ++ st->hcintmsk_copy.d32 = 0; ++ st->hcintmsk_copy.b.chhltd = 1; ++ st->hcintmsk_copy.b.ahberr = 1; ++ ++ /* Hack courtesy of FreeBSD: apparently forcing Interrupt Split transactions ++ * as Control puts the transfer into the non-periodic request queue and the ++ * non-periodic handler in the hub. Makes things lots easier. ++ */ ++ if ((fiq_fsm_mask & 0x8) && hc->ep_type == UE_INTERRUPT) { ++ st->hcchar_copy.b.multicnt = 0; ++ st->hcchar_copy.b.oddfrm = 0; ++ st->hcchar_copy.b.eptype = UE_CONTROL; ++ if (hc->align_buff) { ++ st->hcdma_copy.d32 = hc->align_buff; ++ } else { ++ st->hcdma_copy.d32 = ((unsigned long) hc->xfer_buff & 0xFFFFFFFF); ++ } ++ } ++ DWC_WRITE_REG32(&hc_regs->hcdma, st->hcdma_copy.d32); ++ DWC_WRITE_REG32(&hc_regs->hctsiz, st->hctsiz_copy.d32); ++ DWC_WRITE_REG32(&hc_regs->hcsplt, st->hcsplt_copy.d32); ++ DWC_WRITE_REG32(&hc_regs->hcchar, st->hcchar_copy.d32); ++ DWC_WRITE_REG32(&hc_regs->hcintmsk, st->hcintmsk_copy.d32); ++ ++ local_fiq_disable(); ++ fiq_fsm_spin_lock(&hcd->fiq_state->lock); ++ ++ if (hc->ep_type & 0x1) { ++ hfnum.d32 = DWC_READ_REG32(&hcd->core_if->host_if->host_global_regs->hfnum); ++ frame = (hfnum.b.frnum & ~0x7) >> 3; ++ uframe = hfnum.b.frnum & 0x7; ++ if (hfnum.b.frrem < PERIODIC_FRREM_BACKOFF) { ++ /* Prevent queueing near EOF1. Bad things happen if a periodic ++ * split transaction is queued very close to EOF. ++ */ ++ start_immediate = 0; ++ } else if (uframe == 5) { ++ start_immediate = 0; ++ } else if (hc->ep_type == UE_ISOCHRONOUS && !hc->ep_is_in) { ++ start_immediate = 0; ++ } else if (hc->ep_is_in && fiq_fsm_too_late(hcd->fiq_state, hc->hc_num)) { ++ start_immediate = 0; ++ } else { ++ /* Search through all host channels to determine if a transaction ++ * is currently in progress */ ++ for (i = 0; i < hcd->core_if->core_params->host_channels; i++) { ++ if (i == hc->hc_num || hcd->fiq_state->channel[i].fsm == FIQ_PASSTHROUGH) ++ continue; ++ switch (hcd->fiq_state->channel[i].fsm) { ++ /* TT is reserved for channels that are in the middle of a periodic ++ * split transaction. ++ */ ++ case FIQ_PER_SSPLIT_STARTED: ++ case FIQ_PER_CSPLIT_WAIT: ++ case FIQ_PER_CSPLIT_NYET1: ++ case FIQ_PER_CSPLIT_POLL: ++ case FIQ_PER_ISO_OUT_ACTIVE: ++ case FIQ_PER_ISO_OUT_LAST: ++ if (hcd->fiq_state->channel[i].hub_addr == hub_addr && ++ hcd->fiq_state->channel[i].port_addr == port_addr) { ++ start_immediate = 0; ++ } ++ break; ++ default: ++ break; ++ } ++ if (!start_immediate) ++ break; ++ } ++ } ++ } ++ if ((fiq_fsm_mask & 0x8) && hc->ep_type == UE_INTERRUPT) ++ start_immediate = 1; ++ ++ fiq_print(FIQDBG_INT, hcd->fiq_state, "FSMQ %01d %01d", hc->hc_num, start_immediate); ++ fiq_print(FIQDBG_INT, hcd->fiq_state, "%08d", hfnum.b.frrem); ++ //fiq_print(FIQDBG_INT, hcd->fiq_state, "H:%02dP:%02d", hub_addr, port_addr); ++ //fiq_print(FIQDBG_INT, hcd->fiq_state, "%08x", st->hctsiz_copy.d32); ++ //fiq_print(FIQDBG_INT, hcd->fiq_state, "%08x", st->hcdma_copy.d32); ++ switch (hc->ep_type) { ++ case UE_CONTROL: ++ case UE_BULK: ++ st->fsm = FIQ_NP_SSPLIT_STARTED; ++ break; ++ case UE_ISOCHRONOUS: ++ if (hc->ep_is_in) { ++ if (start_immediate) { ++ st->fsm = FIQ_PER_SSPLIT_STARTED; ++ } else { ++ st->fsm = FIQ_PER_SSPLIT_QUEUED; ++ } ++ } else { ++ if (start_immediate) { ++ /* Single-isoc OUT packets don't require FIQ involvement */ ++ if (st->nrpackets == 1) { ++ st->fsm = FIQ_PER_ISO_OUT_LAST; ++ } else { ++ st->fsm = FIQ_PER_ISO_OUT_ACTIVE; ++ } ++ } else { ++ st->fsm = FIQ_PER_ISO_OUT_PENDING; ++ } ++ } ++ break; ++ case UE_INTERRUPT: ++ if (fiq_fsm_mask & 0x8) { ++ st->fsm = FIQ_NP_SSPLIT_STARTED; ++ } else if (start_immediate) { ++ st->fsm = FIQ_PER_SSPLIT_STARTED; ++ } else { ++ st->fsm = FIQ_PER_SSPLIT_QUEUED; ++ } ++ default: ++ break; ++ } ++ if (start_immediate) { ++ /* Set the oddfrm bit as close as possible to actual queueing */ ++ frame = dwc_otg_hcd_get_frame_number(hcd); ++ st->expected_uframe = (frame + 1) & 0x3FFF; ++ st->hcchar_copy.b.oddfrm = (frame & 0x1) ? 0 : 1; ++ st->hcchar_copy.b.chen = 1; ++ DWC_WRITE_REG32(&hc_regs->hcchar, st->hcchar_copy.d32); ++ } ++ mb(); ++ fiq_fsm_spin_unlock(&hcd->fiq_state->lock); ++ local_fiq_enable(); ++ return 0; ++} ++ ++ ++/** ++ * This function selects transactions from the HCD transfer schedule and ++ * assigns them to available host channels. It is called from HCD interrupt ++ * handler functions. ++ * ++ * @param hcd The HCD state structure. ++ * ++ * @return The types of new transactions that were assigned to host channels. ++ */ ++dwc_otg_transaction_type_e dwc_otg_hcd_select_transactions(dwc_otg_hcd_t * hcd) ++{ ++ dwc_list_link_t *qh_ptr; ++ dwc_otg_qh_t *qh; ++ int num_channels; ++ dwc_irqflags_t flags; ++ dwc_spinlock_t *channel_lock = hcd->channel_lock; ++ dwc_otg_transaction_type_e ret_val = DWC_OTG_TRANSACTION_NONE; ++ ++#ifdef DEBUG_HOST_CHANNELS ++ last_sel_trans_num_per_scheduled = 0; ++ last_sel_trans_num_nonper_scheduled = 0; ++ last_sel_trans_num_avail_hc_at_start = hcd->available_host_channels; ++#endif /* DEBUG_HOST_CHANNELS */ ++ ++ /* Process entries in the periodic ready list. */ ++ qh_ptr = DWC_LIST_FIRST(&hcd->periodic_sched_ready); ++ ++ while (qh_ptr != &hcd->periodic_sched_ready && ++ !DWC_CIRCLEQ_EMPTY(&hcd->free_hc_list)) { ++ ++ qh = DWC_LIST_ENTRY(qh_ptr, dwc_otg_qh_t, qh_list_entry); ++ ++ if (microframe_schedule) { ++ // Make sure we leave one channel for non periodic transactions. ++ DWC_SPINLOCK_IRQSAVE(channel_lock, &flags); ++ if (hcd->available_host_channels <= 1) { ++ DWC_SPINUNLOCK_IRQRESTORE(channel_lock, flags); ++ break; ++ } ++ hcd->available_host_channels--; ++ DWC_SPINUNLOCK_IRQRESTORE(channel_lock, flags); ++#ifdef DEBUG_HOST_CHANNELS ++ last_sel_trans_num_per_scheduled++; ++#endif /* DEBUG_HOST_CHANNELS */ ++ } ++ qh = DWC_LIST_ENTRY(qh_ptr, dwc_otg_qh_t, qh_list_entry); ++ assign_and_init_hc(hcd, qh); ++ ++ /* ++ * Move the QH from the periodic ready schedule to the ++ * periodic assigned schedule. ++ */ ++ qh_ptr = DWC_LIST_NEXT(qh_ptr); ++ DWC_SPINLOCK_IRQSAVE(channel_lock, &flags); ++ DWC_LIST_MOVE_HEAD(&hcd->periodic_sched_assigned, ++ &qh->qh_list_entry); ++ DWC_SPINUNLOCK_IRQRESTORE(channel_lock, flags); ++ } ++ ++ /* ++ * Process entries in the inactive portion of the non-periodic ++ * schedule. Some free host channels may not be used if they are ++ * reserved for periodic transfers. ++ */ ++ qh_ptr = hcd->non_periodic_sched_inactive.next; ++ num_channels = hcd->core_if->core_params->host_channels; ++ while (qh_ptr != &hcd->non_periodic_sched_inactive && ++ (microframe_schedule || hcd->non_periodic_channels < ++ num_channels - hcd->periodic_channels) && ++ !DWC_CIRCLEQ_EMPTY(&hcd->free_hc_list)) { ++ ++ qh = DWC_LIST_ENTRY(qh_ptr, dwc_otg_qh_t, qh_list_entry); ++ /* ++ * Check to see if this is a NAK'd retransmit, in which case ignore for retransmission ++ * we hold off on bulk retransmissions to reduce NAK interrupt overhead for full-speed ++ * cheeky devices that just hold off using NAKs ++ */ ++ if (fiq_enable && nak_holdoff && qh->do_split) { ++ if (qh->nak_frame != 0xffff) { ++ uint16_t next_frame = dwc_frame_num_inc(qh->nak_frame, (qh->ep_type == UE_BULK) ? nak_holdoff : 8); ++ uint16_t frame = dwc_otg_hcd_get_frame_number(hcd); ++ if (dwc_frame_num_le(frame, next_frame)) { ++ if(dwc_frame_num_le(next_frame, hcd->fiq_state->next_sched_frame)) { ++ hcd->fiq_state->next_sched_frame = next_frame; ++ } ++ qh_ptr = DWC_LIST_NEXT(qh_ptr); ++ continue; ++ } else { ++ qh->nak_frame = 0xFFFF; ++ } ++ } ++ } ++ ++ if (microframe_schedule) { ++ DWC_SPINLOCK_IRQSAVE(channel_lock, &flags); ++ if (hcd->available_host_channels < 1) { ++ DWC_SPINUNLOCK_IRQRESTORE(channel_lock, flags); ++ break; ++ } ++ hcd->available_host_channels--; ++ DWC_SPINUNLOCK_IRQRESTORE(channel_lock, flags); ++#ifdef DEBUG_HOST_CHANNELS ++ last_sel_trans_num_nonper_scheduled++; ++#endif /* DEBUG_HOST_CHANNELS */ ++ } ++ ++ assign_and_init_hc(hcd, qh); ++ ++ /* ++ * Move the QH from the non-periodic inactive schedule to the ++ * non-periodic active schedule. ++ */ ++ qh_ptr = DWC_LIST_NEXT(qh_ptr); ++ DWC_SPINLOCK_IRQSAVE(channel_lock, &flags); ++ DWC_LIST_MOVE_HEAD(&hcd->non_periodic_sched_active, ++ &qh->qh_list_entry); ++ DWC_SPINUNLOCK_IRQRESTORE(channel_lock, flags); ++ ++ ++ if (!microframe_schedule) ++ hcd->non_periodic_channels++; ++ } ++ /* we moved a non-periodic QH to the active schedule. If the inactive queue is empty, ++ * stop the FIQ from kicking us. We could potentially still have elements here if we ++ * ran out of host channels. ++ */ ++ if (fiq_enable) { ++ if (DWC_LIST_EMPTY(&hcd->non_periodic_sched_inactive)) { ++ hcd->fiq_state->kick_np_queues = 0; ++ } else { ++ /* For each entry remaining in the NP inactive queue, ++ * if this a NAK'd retransmit then don't set the kick flag. ++ */ ++ if(nak_holdoff) { ++ DWC_LIST_FOREACH(qh_ptr, &hcd->non_periodic_sched_inactive) { ++ qh = DWC_LIST_ENTRY(qh_ptr, dwc_otg_qh_t, qh_list_entry); ++ if (qh->nak_frame == 0xFFFF) { ++ hcd->fiq_state->kick_np_queues = 1; ++ } ++ } ++ } ++ } ++ } ++ if(!DWC_LIST_EMPTY(&hcd->periodic_sched_assigned)) ++ ret_val |= DWC_OTG_TRANSACTION_PERIODIC; ++ ++ if(!DWC_LIST_EMPTY(&hcd->non_periodic_sched_active)) ++ ret_val |= DWC_OTG_TRANSACTION_NON_PERIODIC; ++ ++ ++#ifdef DEBUG_HOST_CHANNELS ++ last_sel_trans_num_avail_hc_at_end = hcd->available_host_channels; ++#endif /* DEBUG_HOST_CHANNELS */ ++ return ret_val; ++} ++ ++/** ++ * Attempts to queue a single transaction request for a host channel ++ * associated with either a periodic or non-periodic transfer. This function ++ * assumes that there is space available in the appropriate request queue. For ++ * an OUT transfer or SETUP transaction in Slave mode, it checks whether space ++ * is available in the appropriate Tx FIFO. ++ * ++ * @param hcd The HCD state structure. ++ * @param hc Host channel descriptor associated with either a periodic or ++ * non-periodic transfer. ++ * @param fifo_dwords_avail Number of DWORDs available in the periodic Tx ++ * FIFO for periodic transfers or the non-periodic Tx FIFO for non-periodic ++ * transfers. ++ * ++ * @return 1 if a request is queued and more requests may be needed to ++ * complete the transfer, 0 if no more requests are required for this ++ * transfer, -1 if there is insufficient space in the Tx FIFO. ++ */ ++static int queue_transaction(dwc_otg_hcd_t * hcd, ++ dwc_hc_t * hc, uint16_t fifo_dwords_avail) ++{ ++ int retval; ++ ++ if (hcd->core_if->dma_enable) { ++ if (hcd->core_if->dma_desc_enable) { ++ if (!hc->xfer_started ++ || (hc->ep_type == DWC_OTG_EP_TYPE_ISOC)) { ++ dwc_otg_hcd_start_xfer_ddma(hcd, hc->qh); ++ hc->qh->ping_state = 0; ++ } ++ } else if (!hc->xfer_started) { ++ if (fiq_fsm_enable && hc->error_state) { ++ hcd->fiq_state->channel[hc->hc_num].nr_errors = ++ DWC_CIRCLEQ_FIRST(&hc->qh->qtd_list)->error_count; ++ hcd->fiq_state->channel[hc->hc_num].fsm = ++ FIQ_PASSTHROUGH_ERRORSTATE; ++ } ++ dwc_otg_hc_start_transfer(hcd->core_if, hc); ++ hc->qh->ping_state = 0; ++ } ++ retval = 0; ++ } else if (hc->halt_pending) { ++ /* Don't queue a request if the channel has been halted. */ ++ retval = 0; ++ } else if (hc->halt_on_queue) { ++ dwc_otg_hc_halt(hcd->core_if, hc, hc->halt_status); ++ retval = 0; ++ } else if (hc->do_ping) { ++ if (!hc->xfer_started) { ++ dwc_otg_hc_start_transfer(hcd->core_if, hc); ++ } ++ retval = 0; ++ } else if (!hc->ep_is_in || hc->data_pid_start == DWC_OTG_HC_PID_SETUP) { ++ if ((fifo_dwords_avail * 4) >= hc->max_packet) { ++ if (!hc->xfer_started) { ++ dwc_otg_hc_start_transfer(hcd->core_if, hc); ++ retval = 1; ++ } else { ++ retval = ++ dwc_otg_hc_continue_transfer(hcd->core_if, ++ hc); ++ } ++ } else { ++ retval = -1; ++ } ++ } else { ++ if (!hc->xfer_started) { ++ dwc_otg_hc_start_transfer(hcd->core_if, hc); ++ retval = 1; ++ } else { ++ retval = dwc_otg_hc_continue_transfer(hcd->core_if, hc); ++ } ++ } ++ ++ return retval; ++} ++ ++/** ++ * Processes periodic channels for the next frame and queues transactions for ++ * these channels to the DWC_otg controller. After queueing transactions, the ++ * Periodic Tx FIFO Empty interrupt is enabled if there are more transactions ++ * to queue as Periodic Tx FIFO or request queue space becomes available. ++ * Otherwise, the Periodic Tx FIFO Empty interrupt is disabled. ++ */ ++static void process_periodic_channels(dwc_otg_hcd_t * hcd) ++{ ++ hptxsts_data_t tx_status; ++ dwc_list_link_t *qh_ptr; ++ dwc_otg_qh_t *qh; ++ int status = 0; ++ int no_queue_space = 0; ++ int no_fifo_space = 0; ++ ++ dwc_otg_host_global_regs_t *host_regs; ++ host_regs = hcd->core_if->host_if->host_global_regs; ++ ++ DWC_DEBUGPL(DBG_HCDV, "Queue periodic transactions\n"); ++#ifdef DEBUG ++ tx_status.d32 = DWC_READ_REG32(&host_regs->hptxsts); ++ DWC_DEBUGPL(DBG_HCDV, ++ " P Tx Req Queue Space Avail (before queue): %d\n", ++ tx_status.b.ptxqspcavail); ++ DWC_DEBUGPL(DBG_HCDV, " P Tx FIFO Space Avail (before queue): %d\n", ++ tx_status.b.ptxfspcavail); ++#endif ++ ++ qh_ptr = hcd->periodic_sched_assigned.next; ++ while (qh_ptr != &hcd->periodic_sched_assigned) { ++ tx_status.d32 = DWC_READ_REG32(&host_regs->hptxsts); ++ if (tx_status.b.ptxqspcavail == 0) { ++ no_queue_space = 1; ++ break; ++ } ++ ++ qh = DWC_LIST_ENTRY(qh_ptr, dwc_otg_qh_t, qh_list_entry); ++ ++ // Do not send a split start transaction any later than frame .6 ++ // Note, we have to schedule a periodic in .5 to make it go in .6 ++ if(fiq_fsm_enable && qh->do_split && ((dwc_otg_hcd_get_frame_number(hcd) + 1) & 7) > 6) ++ { ++ qh_ptr = qh_ptr->next; ++ hcd->fiq_state->next_sched_frame = dwc_otg_hcd_get_frame_number(hcd) | 7; ++ continue; ++ } ++ ++ if (fiq_fsm_enable && fiq_fsm_transaction_suitable(qh)) { ++ if (qh->do_split) ++ fiq_fsm_queue_split_transaction(hcd, qh); ++ else ++ fiq_fsm_queue_isoc_transaction(hcd, qh); ++ } else { ++ ++ /* ++ * Set a flag if we're queueing high-bandwidth in slave mode. ++ * The flag prevents any halts to get into the request queue in ++ * the middle of multiple high-bandwidth packets getting queued. ++ */ ++ if (!hcd->core_if->dma_enable && qh->channel->multi_count > 1) { ++ hcd->core_if->queuing_high_bandwidth = 1; ++ } ++ status = queue_transaction(hcd, qh->channel, ++ tx_status.b.ptxfspcavail); ++ if (status < 0) { ++ no_fifo_space = 1; ++ break; ++ } ++ } ++ ++ /* ++ * In Slave mode, stay on the current transfer until there is ++ * nothing more to do or the high-bandwidth request count is ++ * reached. In DMA mode, only need to queue one request. The ++ * controller automatically handles multiple packets for ++ * high-bandwidth transfers. ++ */ ++ if (hcd->core_if->dma_enable || status == 0 || ++ qh->channel->requests == qh->channel->multi_count) { ++ qh_ptr = qh_ptr->next; ++ /* ++ * Move the QH from the periodic assigned schedule to ++ * the periodic queued schedule. ++ */ ++ DWC_LIST_MOVE_HEAD(&hcd->periodic_sched_queued, ++ &qh->qh_list_entry); ++ ++ /* done queuing high bandwidth */ ++ hcd->core_if->queuing_high_bandwidth = 0; ++ } ++ } ++ ++ if (!hcd->core_if->dma_enable) { ++ dwc_otg_core_global_regs_t *global_regs; ++ gintmsk_data_t intr_mask = {.d32 = 0 }; ++ ++ global_regs = hcd->core_if->core_global_regs; ++ intr_mask.b.ptxfempty = 1; ++#ifdef DEBUG ++ tx_status.d32 = DWC_READ_REG32(&host_regs->hptxsts); ++ DWC_DEBUGPL(DBG_HCDV, ++ " P Tx Req Queue Space Avail (after queue): %d\n", ++ tx_status.b.ptxqspcavail); ++ DWC_DEBUGPL(DBG_HCDV, ++ " P Tx FIFO Space Avail (after queue): %d\n", ++ tx_status.b.ptxfspcavail); ++#endif ++ if (!DWC_LIST_EMPTY(&hcd->periodic_sched_assigned) || ++ no_queue_space || no_fifo_space) { ++ /* ++ * May need to queue more transactions as the request ++ * queue or Tx FIFO empties. Enable the periodic Tx ++ * FIFO empty interrupt. (Always use the half-empty ++ * level to ensure that new requests are loaded as ++ * soon as possible.) ++ */ ++ DWC_MODIFY_REG32(&global_regs->gintmsk, 0, ++ intr_mask.d32); ++ } else { ++ /* ++ * Disable the Tx FIFO empty interrupt since there are ++ * no more transactions that need to be queued right ++ * now. This function is called from interrupt ++ * handlers to queue more transactions as transfer ++ * states change. ++ */ ++ DWC_MODIFY_REG32(&global_regs->gintmsk, intr_mask.d32, ++ 0); ++ } ++ } ++} ++ ++/** ++ * Processes active non-periodic channels and queues transactions for these ++ * channels to the DWC_otg controller. After queueing transactions, the NP Tx ++ * FIFO Empty interrupt is enabled if there are more transactions to queue as ++ * NP Tx FIFO or request queue space becomes available. Otherwise, the NP Tx ++ * FIFO Empty interrupt is disabled. ++ */ ++static void process_non_periodic_channels(dwc_otg_hcd_t * hcd) ++{ ++ gnptxsts_data_t tx_status; ++ dwc_list_link_t *orig_qh_ptr; ++ dwc_otg_qh_t *qh; ++ int status; ++ int no_queue_space = 0; ++ int no_fifo_space = 0; ++ int more_to_do = 0; ++ ++ dwc_otg_core_global_regs_t *global_regs = ++ hcd->core_if->core_global_regs; ++ ++ DWC_DEBUGPL(DBG_HCDV, "Queue non-periodic transactions\n"); ++#ifdef DEBUG ++ tx_status.d32 = DWC_READ_REG32(&global_regs->gnptxsts); ++ DWC_DEBUGPL(DBG_HCDV, ++ " NP Tx Req Queue Space Avail (before queue): %d\n", ++ tx_status.b.nptxqspcavail); ++ DWC_DEBUGPL(DBG_HCDV, " NP Tx FIFO Space Avail (before queue): %d\n", ++ tx_status.b.nptxfspcavail); ++#endif ++ /* ++ * Keep track of the starting point. Skip over the start-of-list ++ * entry. ++ */ ++ if (hcd->non_periodic_qh_ptr == &hcd->non_periodic_sched_active) { ++ hcd->non_periodic_qh_ptr = hcd->non_periodic_qh_ptr->next; ++ } ++ orig_qh_ptr = hcd->non_periodic_qh_ptr; ++ ++ /* ++ * Process once through the active list or until no more space is ++ * available in the request queue or the Tx FIFO. ++ */ ++ do { ++ tx_status.d32 = DWC_READ_REG32(&global_regs->gnptxsts); ++ if (!hcd->core_if->dma_enable && tx_status.b.nptxqspcavail == 0) { ++ no_queue_space = 1; ++ break; ++ } ++ ++ qh = DWC_LIST_ENTRY(hcd->non_periodic_qh_ptr, dwc_otg_qh_t, ++ qh_list_entry); ++ ++ if(fiq_fsm_enable && fiq_fsm_transaction_suitable(qh)) { ++ fiq_fsm_queue_split_transaction(hcd, qh); ++ } else { ++ status = queue_transaction(hcd, qh->channel, ++ tx_status.b.nptxfspcavail); ++ ++ if (status > 0) { ++ more_to_do = 1; ++ } else if (status < 0) { ++ no_fifo_space = 1; ++ break; ++ } ++ } ++ /* Advance to next QH, skipping start-of-list entry. */ ++ hcd->non_periodic_qh_ptr = hcd->non_periodic_qh_ptr->next; ++ if (hcd->non_periodic_qh_ptr == &hcd->non_periodic_sched_active) { ++ hcd->non_periodic_qh_ptr = ++ hcd->non_periodic_qh_ptr->next; ++ } ++ ++ } while (hcd->non_periodic_qh_ptr != orig_qh_ptr); ++ ++ if (!hcd->core_if->dma_enable) { ++ gintmsk_data_t intr_mask = {.d32 = 0 }; ++ intr_mask.b.nptxfempty = 1; ++ ++#ifdef DEBUG ++ tx_status.d32 = DWC_READ_REG32(&global_regs->gnptxsts); ++ DWC_DEBUGPL(DBG_HCDV, ++ " NP Tx Req Queue Space Avail (after queue): %d\n", ++ tx_status.b.nptxqspcavail); ++ DWC_DEBUGPL(DBG_HCDV, ++ " NP Tx FIFO Space Avail (after queue): %d\n", ++ tx_status.b.nptxfspcavail); ++#endif ++ if (more_to_do || no_queue_space || no_fifo_space) { ++ /* ++ * May need to queue more transactions as the request ++ * queue or Tx FIFO empties. Enable the non-periodic ++ * Tx FIFO empty interrupt. (Always use the half-empty ++ * level to ensure that new requests are loaded as ++ * soon as possible.) ++ */ ++ DWC_MODIFY_REG32(&global_regs->gintmsk, 0, ++ intr_mask.d32); ++ } else { ++ /* ++ * Disable the Tx FIFO empty interrupt since there are ++ * no more transactions that need to be queued right ++ * now. This function is called from interrupt ++ * handlers to queue more transactions as transfer ++ * states change. ++ */ ++ DWC_MODIFY_REG32(&global_regs->gintmsk, intr_mask.d32, ++ 0); ++ } ++ } ++} ++ ++/** ++ * This function processes the currently active host channels and queues ++ * transactions for these channels to the DWC_otg controller. It is called ++ * from HCD interrupt handler functions. ++ * ++ * @param hcd The HCD state structure. ++ * @param tr_type The type(s) of transactions to queue (non-periodic, ++ * periodic, or both). ++ */ ++void dwc_otg_hcd_queue_transactions(dwc_otg_hcd_t * hcd, ++ dwc_otg_transaction_type_e tr_type) ++{ ++#ifdef DEBUG_SOF ++ DWC_DEBUGPL(DBG_HCD, "Queue Transactions\n"); ++#endif ++ /* Process host channels associated with periodic transfers. */ ++ if ((tr_type == DWC_OTG_TRANSACTION_PERIODIC || ++ tr_type == DWC_OTG_TRANSACTION_ALL) && ++ !DWC_LIST_EMPTY(&hcd->periodic_sched_assigned)) { ++ ++ process_periodic_channels(hcd); ++ } ++ ++ /* Process host channels associated with non-periodic transfers. */ ++ if (tr_type == DWC_OTG_TRANSACTION_NON_PERIODIC || ++ tr_type == DWC_OTG_TRANSACTION_ALL) { ++ if (!DWC_LIST_EMPTY(&hcd->non_periodic_sched_active)) { ++ process_non_periodic_channels(hcd); ++ } else { ++ /* ++ * Ensure NP Tx FIFO empty interrupt is disabled when ++ * there are no non-periodic transfers to process. ++ */ ++ gintmsk_data_t gintmsk = {.d32 = 0 }; ++ gintmsk.b.nptxfempty = 1; ++ ++ if (fiq_enable) { ++ local_fiq_disable(); ++ fiq_fsm_spin_lock(&hcd->fiq_state->lock); ++ DWC_MODIFY_REG32(&hcd->core_if->core_global_regs->gintmsk, gintmsk.d32, 0); ++ fiq_fsm_spin_unlock(&hcd->fiq_state->lock); ++ local_fiq_enable(); ++ } else { ++ DWC_MODIFY_REG32(&hcd->core_if->core_global_regs->gintmsk, gintmsk.d32, 0); ++ } ++ } ++ } ++} ++ ++#ifdef DWC_HS_ELECT_TST ++/* ++ * Quick and dirty hack to implement the HS Electrical Test ++ * SINGLE_STEP_GET_DEVICE_DESCRIPTOR feature. ++ * ++ * This code was copied from our userspace app "hset". It sends a ++ * Get Device Descriptor control sequence in two parts, first the ++ * Setup packet by itself, followed some time later by the In and ++ * Ack packets. Rather than trying to figure out how to add this ++ * functionality to the normal driver code, we just hijack the ++ * hardware, using these two function to drive the hardware ++ * directly. ++ */ ++ ++static dwc_otg_core_global_regs_t *global_regs; ++static dwc_otg_host_global_regs_t *hc_global_regs; ++static dwc_otg_hc_regs_t *hc_regs; ++static uint32_t *data_fifo; ++ ++static void do_setup(void) ++{ ++ gintsts_data_t gintsts; ++ hctsiz_data_t hctsiz; ++ hcchar_data_t hcchar; ++ haint_data_t haint; ++ hcint_data_t hcint; ++ ++ /* Enable HAINTs */ ++ DWC_WRITE_REG32(&hc_global_regs->haintmsk, 0x0001); ++ ++ /* Enable HCINTs */ ++ DWC_WRITE_REG32(&hc_regs->hcintmsk, 0x04a3); ++ ++ /* Read GINTSTS */ ++ gintsts.d32 = DWC_READ_REG32(&global_regs->gintsts); ++ ++ /* Read HAINT */ ++ haint.d32 = DWC_READ_REG32(&hc_global_regs->haint); ++ ++ /* Read HCINT */ ++ hcint.d32 = DWC_READ_REG32(&hc_regs->hcint); ++ ++ /* Read HCCHAR */ ++ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); ++ ++ /* Clear HCINT */ ++ DWC_WRITE_REG32(&hc_regs->hcint, hcint.d32); ++ ++ /* Clear HAINT */ ++ DWC_WRITE_REG32(&hc_global_regs->haint, haint.d32); ++ ++ /* Clear GINTSTS */ ++ DWC_WRITE_REG32(&global_regs->gintsts, gintsts.d32); ++ ++ /* Read GINTSTS */ ++ gintsts.d32 = DWC_READ_REG32(&global_regs->gintsts); ++ ++ /* ++ * Send Setup packet (Get Device Descriptor) ++ */ ++ ++ /* Make sure channel is disabled */ ++ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); ++ if (hcchar.b.chen) { ++ hcchar.b.chdis = 1; ++// hcchar.b.chen = 1; ++ DWC_WRITE_REG32(&hc_regs->hcchar, hcchar.d32); ++ //sleep(1); ++ dwc_mdelay(1000); ++ ++ /* Read GINTSTS */ ++ gintsts.d32 = DWC_READ_REG32(&global_regs->gintsts); ++ ++ /* Read HAINT */ ++ haint.d32 = DWC_READ_REG32(&hc_global_regs->haint); ++ ++ /* Read HCINT */ ++ hcint.d32 = DWC_READ_REG32(&hc_regs->hcint); ++ ++ /* Read HCCHAR */ ++ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); ++ ++ /* Clear HCINT */ ++ DWC_WRITE_REG32(&hc_regs->hcint, hcint.d32); ++ ++ /* Clear HAINT */ ++ DWC_WRITE_REG32(&hc_global_regs->haint, haint.d32); ++ ++ /* Clear GINTSTS */ ++ DWC_WRITE_REG32(&global_regs->gintsts, gintsts.d32); ++ ++ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); ++ } ++ ++ /* Set HCTSIZ */ ++ hctsiz.d32 = 0; ++ hctsiz.b.xfersize = 8; ++ hctsiz.b.pktcnt = 1; ++ hctsiz.b.pid = DWC_OTG_HC_PID_SETUP; ++ DWC_WRITE_REG32(&hc_regs->hctsiz, hctsiz.d32); ++ ++ /* Set HCCHAR */ ++ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); ++ hcchar.b.eptype = DWC_OTG_EP_TYPE_CONTROL; ++ hcchar.b.epdir = 0; ++ hcchar.b.epnum = 0; ++ hcchar.b.mps = 8; ++ hcchar.b.chen = 1; ++ DWC_WRITE_REG32(&hc_regs->hcchar, hcchar.d32); ++ ++ /* Fill FIFO with Setup data for Get Device Descriptor */ ++ data_fifo = (uint32_t *) ((char *)global_regs + 0x1000); ++ DWC_WRITE_REG32(data_fifo++, 0x01000680); ++ DWC_WRITE_REG32(data_fifo++, 0x00080000); ++ ++ gintsts.d32 = DWC_READ_REG32(&global_regs->gintsts); ++ ++ /* Wait for host channel interrupt */ ++ do { ++ gintsts.d32 = DWC_READ_REG32(&global_regs->gintsts); ++ } while (gintsts.b.hcintr == 0); ++ ++ /* Disable HCINTs */ ++ DWC_WRITE_REG32(&hc_regs->hcintmsk, 0x0000); ++ ++ /* Disable HAINTs */ ++ DWC_WRITE_REG32(&hc_global_regs->haintmsk, 0x0000); ++ ++ /* Read HAINT */ ++ haint.d32 = DWC_READ_REG32(&hc_global_regs->haint); ++ ++ /* Read HCINT */ ++ hcint.d32 = DWC_READ_REG32(&hc_regs->hcint); ++ ++ /* Read HCCHAR */ ++ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); ++ ++ /* Clear HCINT */ ++ DWC_WRITE_REG32(&hc_regs->hcint, hcint.d32); ++ ++ /* Clear HAINT */ ++ DWC_WRITE_REG32(&hc_global_regs->haint, haint.d32); ++ ++ /* Clear GINTSTS */ ++ DWC_WRITE_REG32(&global_regs->gintsts, gintsts.d32); ++ ++ /* Read GINTSTS */ ++ gintsts.d32 = DWC_READ_REG32(&global_regs->gintsts); ++} ++ ++static void do_in_ack(void) ++{ ++ gintsts_data_t gintsts; ++ hctsiz_data_t hctsiz; ++ hcchar_data_t hcchar; ++ haint_data_t haint; ++ hcint_data_t hcint; ++ host_grxsts_data_t grxsts; ++ ++ /* Enable HAINTs */ ++ DWC_WRITE_REG32(&hc_global_regs->haintmsk, 0x0001); ++ ++ /* Enable HCINTs */ ++ DWC_WRITE_REG32(&hc_regs->hcintmsk, 0x04a3); ++ ++ /* Read GINTSTS */ ++ gintsts.d32 = DWC_READ_REG32(&global_regs->gintsts); ++ ++ /* Read HAINT */ ++ haint.d32 = DWC_READ_REG32(&hc_global_regs->haint); ++ ++ /* Read HCINT */ ++ hcint.d32 = DWC_READ_REG32(&hc_regs->hcint); ++ ++ /* Read HCCHAR */ ++ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); ++ ++ /* Clear HCINT */ ++ DWC_WRITE_REG32(&hc_regs->hcint, hcint.d32); ++ ++ /* Clear HAINT */ ++ DWC_WRITE_REG32(&hc_global_regs->haint, haint.d32); ++ ++ /* Clear GINTSTS */ ++ DWC_WRITE_REG32(&global_regs->gintsts, gintsts.d32); ++ ++ /* Read GINTSTS */ ++ gintsts.d32 = DWC_READ_REG32(&global_regs->gintsts); ++ ++ /* ++ * Receive Control In packet ++ */ ++ ++ /* Make sure channel is disabled */ ++ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); ++ if (hcchar.b.chen) { ++ hcchar.b.chdis = 1; ++ hcchar.b.chen = 1; ++ DWC_WRITE_REG32(&hc_regs->hcchar, hcchar.d32); ++ //sleep(1); ++ dwc_mdelay(1000); ++ ++ /* Read GINTSTS */ ++ gintsts.d32 = DWC_READ_REG32(&global_regs->gintsts); ++ ++ /* Read HAINT */ ++ haint.d32 = DWC_READ_REG32(&hc_global_regs->haint); ++ ++ /* Read HCINT */ ++ hcint.d32 = DWC_READ_REG32(&hc_regs->hcint); ++ ++ /* Read HCCHAR */ ++ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); ++ ++ /* Clear HCINT */ ++ DWC_WRITE_REG32(&hc_regs->hcint, hcint.d32); ++ ++ /* Clear HAINT */ ++ DWC_WRITE_REG32(&hc_global_regs->haint, haint.d32); ++ ++ /* Clear GINTSTS */ ++ DWC_WRITE_REG32(&global_regs->gintsts, gintsts.d32); ++ ++ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); ++ } ++ ++ /* Set HCTSIZ */ ++ hctsiz.d32 = 0; ++ hctsiz.b.xfersize = 8; ++ hctsiz.b.pktcnt = 1; ++ hctsiz.b.pid = DWC_OTG_HC_PID_DATA1; ++ DWC_WRITE_REG32(&hc_regs->hctsiz, hctsiz.d32); ++ ++ /* Set HCCHAR */ ++ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); ++ hcchar.b.eptype = DWC_OTG_EP_TYPE_CONTROL; ++ hcchar.b.epdir = 1; ++ hcchar.b.epnum = 0; ++ hcchar.b.mps = 8; ++ hcchar.b.chen = 1; ++ DWC_WRITE_REG32(&hc_regs->hcchar, hcchar.d32); ++ ++ gintsts.d32 = DWC_READ_REG32(&global_regs->gintsts); ++ ++ /* Wait for receive status queue interrupt */ ++ do { ++ gintsts.d32 = DWC_READ_REG32(&global_regs->gintsts); ++ } while (gintsts.b.rxstsqlvl == 0); ++ ++ /* Read RXSTS */ ++ grxsts.d32 = DWC_READ_REG32(&global_regs->grxstsp); ++ ++ /* Clear RXSTSQLVL in GINTSTS */ ++ gintsts.d32 = 0; ++ gintsts.b.rxstsqlvl = 1; ++ DWC_WRITE_REG32(&global_regs->gintsts, gintsts.d32); ++ ++ switch (grxsts.b.pktsts) { ++ case DWC_GRXSTS_PKTSTS_IN: ++ /* Read the data into the host buffer */ ++ if (grxsts.b.bcnt > 0) { ++ int i; ++ int word_count = (grxsts.b.bcnt + 3) / 4; ++ ++ data_fifo = (uint32_t *) ((char *)global_regs + 0x1000); ++ ++ for (i = 0; i < word_count; i++) { ++ (void)DWC_READ_REG32(data_fifo++); ++ } ++ } ++ break; ++ ++ default: ++ break; ++ } ++ ++ gintsts.d32 = DWC_READ_REG32(&global_regs->gintsts); ++ ++ /* Wait for receive status queue interrupt */ ++ do { ++ gintsts.d32 = DWC_READ_REG32(&global_regs->gintsts); ++ } while (gintsts.b.rxstsqlvl == 0); ++ ++ /* Read RXSTS */ ++ grxsts.d32 = DWC_READ_REG32(&global_regs->grxstsp); ++ ++ /* Clear RXSTSQLVL in GINTSTS */ ++ gintsts.d32 = 0; ++ gintsts.b.rxstsqlvl = 1; ++ DWC_WRITE_REG32(&global_regs->gintsts, gintsts.d32); ++ ++ switch (grxsts.b.pktsts) { ++ case DWC_GRXSTS_PKTSTS_IN_XFER_COMP: ++ break; ++ ++ default: ++ break; ++ } ++ ++ gintsts.d32 = DWC_READ_REG32(&global_regs->gintsts); ++ ++ /* Wait for host channel interrupt */ ++ do { ++ gintsts.d32 = DWC_READ_REG32(&global_regs->gintsts); ++ } while (gintsts.b.hcintr == 0); ++ ++ /* Read HAINT */ ++ haint.d32 = DWC_READ_REG32(&hc_global_regs->haint); ++ ++ /* Read HCINT */ ++ hcint.d32 = DWC_READ_REG32(&hc_regs->hcint); ++ ++ /* Read HCCHAR */ ++ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); ++ ++ /* Clear HCINT */ ++ DWC_WRITE_REG32(&hc_regs->hcint, hcint.d32); ++ ++ /* Clear HAINT */ ++ DWC_WRITE_REG32(&hc_global_regs->haint, haint.d32); ++ ++ /* Clear GINTSTS */ ++ DWC_WRITE_REG32(&global_regs->gintsts, gintsts.d32); ++ ++ /* Read GINTSTS */ ++ gintsts.d32 = DWC_READ_REG32(&global_regs->gintsts); ++ ++// usleep(100000); ++// mdelay(100); ++ dwc_mdelay(1); ++ ++ /* ++ * Send handshake packet ++ */ ++ ++ /* Read HAINT */ ++ haint.d32 = DWC_READ_REG32(&hc_global_regs->haint); ++ ++ /* Read HCINT */ ++ hcint.d32 = DWC_READ_REG32(&hc_regs->hcint); ++ ++ /* Read HCCHAR */ ++ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); ++ ++ /* Clear HCINT */ ++ DWC_WRITE_REG32(&hc_regs->hcint, hcint.d32); ++ ++ /* Clear HAINT */ ++ DWC_WRITE_REG32(&hc_global_regs->haint, haint.d32); ++ ++ /* Clear GINTSTS */ ++ DWC_WRITE_REG32(&global_regs->gintsts, gintsts.d32); ++ ++ /* Read GINTSTS */ ++ gintsts.d32 = DWC_READ_REG32(&global_regs->gintsts); ++ ++ /* Make sure channel is disabled */ ++ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); ++ if (hcchar.b.chen) { ++ hcchar.b.chdis = 1; ++ hcchar.b.chen = 1; ++ DWC_WRITE_REG32(&hc_regs->hcchar, hcchar.d32); ++ //sleep(1); ++ dwc_mdelay(1000); ++ ++ /* Read GINTSTS */ ++ gintsts.d32 = DWC_READ_REG32(&global_regs->gintsts); ++ ++ /* Read HAINT */ ++ haint.d32 = DWC_READ_REG32(&hc_global_regs->haint); ++ ++ /* Read HCINT */ ++ hcint.d32 = DWC_READ_REG32(&hc_regs->hcint); ++ ++ /* Read HCCHAR */ ++ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); ++ ++ /* Clear HCINT */ ++ DWC_WRITE_REG32(&hc_regs->hcint, hcint.d32); ++ ++ /* Clear HAINT */ ++ DWC_WRITE_REG32(&hc_global_regs->haint, haint.d32); ++ ++ /* Clear GINTSTS */ ++ DWC_WRITE_REG32(&global_regs->gintsts, gintsts.d32); ++ ++ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); ++ } ++ ++ /* Set HCTSIZ */ ++ hctsiz.d32 = 0; ++ hctsiz.b.xfersize = 0; ++ hctsiz.b.pktcnt = 1; ++ hctsiz.b.pid = DWC_OTG_HC_PID_DATA1; ++ DWC_WRITE_REG32(&hc_regs->hctsiz, hctsiz.d32); ++ ++ /* Set HCCHAR */ ++ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); ++ hcchar.b.eptype = DWC_OTG_EP_TYPE_CONTROL; ++ hcchar.b.epdir = 0; ++ hcchar.b.epnum = 0; ++ hcchar.b.mps = 8; ++ hcchar.b.chen = 1; ++ DWC_WRITE_REG32(&hc_regs->hcchar, hcchar.d32); ++ ++ gintsts.d32 = DWC_READ_REG32(&global_regs->gintsts); ++ ++ /* Wait for host channel interrupt */ ++ do { ++ gintsts.d32 = DWC_READ_REG32(&global_regs->gintsts); ++ } while (gintsts.b.hcintr == 0); ++ ++ /* Disable HCINTs */ ++ DWC_WRITE_REG32(&hc_regs->hcintmsk, 0x0000); ++ ++ /* Disable HAINTs */ ++ DWC_WRITE_REG32(&hc_global_regs->haintmsk, 0x0000); ++ ++ /* Read HAINT */ ++ haint.d32 = DWC_READ_REG32(&hc_global_regs->haint); ++ ++ /* Read HCINT */ ++ hcint.d32 = DWC_READ_REG32(&hc_regs->hcint); ++ ++ /* Read HCCHAR */ ++ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); ++ ++ /* Clear HCINT */ ++ DWC_WRITE_REG32(&hc_regs->hcint, hcint.d32); ++ ++ /* Clear HAINT */ ++ DWC_WRITE_REG32(&hc_global_regs->haint, haint.d32); ++ ++ /* Clear GINTSTS */ ++ DWC_WRITE_REG32(&global_regs->gintsts, gintsts.d32); ++ ++ /* Read GINTSTS */ ++ gintsts.d32 = DWC_READ_REG32(&global_regs->gintsts); ++} ++#endif ++ ++/** Handles hub class-specific requests. */ ++int dwc_otg_hcd_hub_control(dwc_otg_hcd_t * dwc_otg_hcd, ++ uint16_t typeReq, ++ uint16_t wValue, ++ uint16_t wIndex, uint8_t * buf, uint16_t wLength) ++{ ++ int retval = 0; ++ ++ dwc_otg_core_if_t *core_if = dwc_otg_hcd->core_if; ++ usb_hub_descriptor_t *hub_desc; ++ hprt0_data_t hprt0 = {.d32 = 0 }; ++ ++ uint32_t port_status; ++ ++ switch (typeReq) { ++ case UCR_CLEAR_HUB_FEATURE: ++ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD HUB CONTROL - " ++ "ClearHubFeature 0x%x\n", wValue); ++ switch (wValue) { ++ case UHF_C_HUB_LOCAL_POWER: ++ case UHF_C_HUB_OVER_CURRENT: ++ /* Nothing required here */ ++ break; ++ default: ++ retval = -DWC_E_INVALID; ++ DWC_ERROR("DWC OTG HCD - " ++ "ClearHubFeature request %xh unknown\n", ++ wValue); ++ } ++ break; ++ case UCR_CLEAR_PORT_FEATURE: ++#ifdef CONFIG_USB_DWC_OTG_LPM ++ if (wValue != UHF_PORT_L1) ++#endif ++ if (!wIndex || wIndex > 1) ++ goto error; ++ ++ switch (wValue) { ++ case UHF_PORT_ENABLE: ++ DWC_DEBUGPL(DBG_ANY, "DWC OTG HCD HUB CONTROL - " ++ "ClearPortFeature USB_PORT_FEAT_ENABLE\n"); ++ hprt0.d32 = dwc_otg_read_hprt0(core_if); ++ hprt0.b.prtena = 1; ++ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); ++ break; ++ case UHF_PORT_SUSPEND: ++ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD HUB CONTROL - " ++ "ClearPortFeature USB_PORT_FEAT_SUSPEND\n"); ++ ++ if (core_if->power_down == 2) { ++ dwc_otg_host_hibernation_restore(core_if, 0, 0); ++ } else { ++ DWC_WRITE_REG32(core_if->pcgcctl, 0); ++ dwc_mdelay(5); ++ ++ hprt0.d32 = dwc_otg_read_hprt0(core_if); ++ hprt0.b.prtres = 1; ++ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); ++ hprt0.b.prtsusp = 0; ++ /* Clear Resume bit */ ++ dwc_mdelay(100); ++ hprt0.b.prtres = 0; ++ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); ++ } ++ break; ++#ifdef CONFIG_USB_DWC_OTG_LPM ++ case UHF_PORT_L1: ++ { ++ pcgcctl_data_t pcgcctl = {.d32 = 0 }; ++ glpmcfg_data_t lpmcfg = {.d32 = 0 }; ++ ++ lpmcfg.d32 = ++ DWC_READ_REG32(&core_if-> ++ core_global_regs->glpmcfg); ++ lpmcfg.b.en_utmi_sleep = 0; ++ lpmcfg.b.hird_thres &= (~(1 << 4)); ++ lpmcfg.b.prt_sleep_sts = 1; ++ DWC_WRITE_REG32(&core_if-> ++ core_global_regs->glpmcfg, ++ lpmcfg.d32); ++ ++ /* Clear Enbl_L1Gating bit. */ ++ pcgcctl.b.enbl_sleep_gating = 1; ++ DWC_MODIFY_REG32(core_if->pcgcctl, pcgcctl.d32, ++ 0); ++ ++ dwc_mdelay(5); ++ ++ hprt0.d32 = dwc_otg_read_hprt0(core_if); ++ hprt0.b.prtres = 1; ++ DWC_WRITE_REG32(core_if->host_if->hprt0, ++ hprt0.d32); ++ /* This bit will be cleared in wakeup interrupt handle */ ++ break; ++ } ++#endif ++ case UHF_PORT_POWER: ++ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD HUB CONTROL - " ++ "ClearPortFeature USB_PORT_FEAT_POWER\n"); ++ hprt0.d32 = dwc_otg_read_hprt0(core_if); ++ hprt0.b.prtpwr = 0; ++ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); ++ break; ++ case UHF_PORT_INDICATOR: ++ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD HUB CONTROL - " ++ "ClearPortFeature USB_PORT_FEAT_INDICATOR\n"); ++ /* Port inidicator not supported */ ++ break; ++ case UHF_C_PORT_CONNECTION: ++ /* Clears drivers internal connect status change ++ * flag */ ++ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD HUB CONTROL - " ++ "ClearPortFeature USB_PORT_FEAT_C_CONNECTION\n"); ++ dwc_otg_hcd->flags.b.port_connect_status_change = 0; ++ break; ++ case UHF_C_PORT_RESET: ++ /* Clears the driver's internal Port Reset Change ++ * flag */ ++ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD HUB CONTROL - " ++ "ClearPortFeature USB_PORT_FEAT_C_RESET\n"); ++ dwc_otg_hcd->flags.b.port_reset_change = 0; ++ break; ++ case UHF_C_PORT_ENABLE: ++ /* Clears the driver's internal Port ++ * Enable/Disable Change flag */ ++ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD HUB CONTROL - " ++ "ClearPortFeature USB_PORT_FEAT_C_ENABLE\n"); ++ dwc_otg_hcd->flags.b.port_enable_change = 0; ++ break; ++ case UHF_C_PORT_SUSPEND: ++ /* Clears the driver's internal Port Suspend ++ * Change flag, which is set when resume signaling on ++ * the host port is complete */ ++ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD HUB CONTROL - " ++ "ClearPortFeature USB_PORT_FEAT_C_SUSPEND\n"); ++ dwc_otg_hcd->flags.b.port_suspend_change = 0; ++ break; ++#ifdef CONFIG_USB_DWC_OTG_LPM ++ case UHF_C_PORT_L1: ++ dwc_otg_hcd->flags.b.port_l1_change = 0; ++ break; ++#endif ++ case UHF_C_PORT_OVER_CURRENT: ++ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD HUB CONTROL - " ++ "ClearPortFeature USB_PORT_FEAT_C_OVER_CURRENT\n"); ++ dwc_otg_hcd->flags.b.port_over_current_change = 0; ++ break; ++ default: ++ retval = -DWC_E_INVALID; ++ DWC_ERROR("DWC OTG HCD - " ++ "ClearPortFeature request %xh " ++ "unknown or unsupported\n", wValue); ++ } ++ break; ++ case UCR_GET_HUB_DESCRIPTOR: ++ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD HUB CONTROL - " ++ "GetHubDescriptor\n"); ++ hub_desc = (usb_hub_descriptor_t *) buf; ++ hub_desc->bDescLength = 9; ++ hub_desc->bDescriptorType = 0x29; ++ hub_desc->bNbrPorts = 1; ++ USETW(hub_desc->wHubCharacteristics, 0x08); ++ hub_desc->bPwrOn2PwrGood = 1; ++ hub_desc->bHubContrCurrent = 0; ++ hub_desc->DeviceRemovable[0] = 0; ++ hub_desc->DeviceRemovable[1] = 0xff; ++ break; ++ case UCR_GET_HUB_STATUS: ++ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD HUB CONTROL - " ++ "GetHubStatus\n"); ++ DWC_MEMSET(buf, 0, 4); ++ break; ++ case UCR_GET_PORT_STATUS: ++ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD HUB CONTROL - " ++ "GetPortStatus wIndex = 0x%04x FLAGS=0x%08x\n", ++ wIndex, dwc_otg_hcd->flags.d32); ++ if (!wIndex || wIndex > 1) ++ goto error; ++ ++ port_status = 0; ++ ++ if (dwc_otg_hcd->flags.b.port_connect_status_change) ++ port_status |= (1 << UHF_C_PORT_CONNECTION); ++ ++ if (dwc_otg_hcd->flags.b.port_enable_change) ++ port_status |= (1 << UHF_C_PORT_ENABLE); ++ ++ if (dwc_otg_hcd->flags.b.port_suspend_change) ++ port_status |= (1 << UHF_C_PORT_SUSPEND); ++ ++ if (dwc_otg_hcd->flags.b.port_l1_change) ++ port_status |= (1 << UHF_C_PORT_L1); ++ ++ if (dwc_otg_hcd->flags.b.port_reset_change) { ++ port_status |= (1 << UHF_C_PORT_RESET); ++ } ++ ++ if (dwc_otg_hcd->flags.b.port_over_current_change) { ++ DWC_WARN("Overcurrent change detected\n"); ++ port_status |= (1 << UHF_C_PORT_OVER_CURRENT); ++ } ++ ++ if (!dwc_otg_hcd->flags.b.port_connect_status) { ++ /* ++ * The port is disconnected, which means the core is ++ * either in device mode or it soon will be. Just ++ * return 0's for the remainder of the port status ++ * since the port register can't be read if the core ++ * is in device mode. ++ */ ++ *((__le32 *) buf) = dwc_cpu_to_le32(&port_status); ++ break; ++ } ++ ++ hprt0.d32 = DWC_READ_REG32(core_if->host_if->hprt0); ++ DWC_DEBUGPL(DBG_HCDV, " HPRT0: 0x%08x\n", hprt0.d32); ++ ++ if (hprt0.b.prtconnsts) ++ port_status |= (1 << UHF_PORT_CONNECTION); ++ ++ if (hprt0.b.prtena) ++ port_status |= (1 << UHF_PORT_ENABLE); ++ ++ if (hprt0.b.prtsusp) ++ port_status |= (1 << UHF_PORT_SUSPEND); ++ ++ if (hprt0.b.prtovrcurract) ++ port_status |= (1 << UHF_PORT_OVER_CURRENT); ++ ++ if (hprt0.b.prtrst) ++ port_status |= (1 << UHF_PORT_RESET); ++ ++ if (hprt0.b.prtpwr) ++ port_status |= (1 << UHF_PORT_POWER); ++ ++ if (hprt0.b.prtspd == DWC_HPRT0_PRTSPD_HIGH_SPEED) ++ port_status |= (1 << UHF_PORT_HIGH_SPEED); ++ else if (hprt0.b.prtspd == DWC_HPRT0_PRTSPD_LOW_SPEED) ++ port_status |= (1 << UHF_PORT_LOW_SPEED); ++ ++ if (hprt0.b.prttstctl) ++ port_status |= (1 << UHF_PORT_TEST); ++ if (dwc_otg_get_lpm_portsleepstatus(dwc_otg_hcd->core_if)) { ++ port_status |= (1 << UHF_PORT_L1); ++ } ++ /* ++ For Synopsys HW emulation of Power down wkup_control asserts the ++ hreset_n and prst_n on suspned. This causes the HPRT0 to be zero. ++ We intentionally tell the software that port is in L2Suspend state. ++ Only for STE. ++ */ ++ if ((core_if->power_down == 2) ++ && (core_if->hibernation_suspend == 1)) { ++ port_status |= (1 << UHF_PORT_SUSPEND); ++ } ++ /* USB_PORT_FEAT_INDICATOR unsupported always 0 */ ++ ++ *((__le32 *) buf) = dwc_cpu_to_le32(&port_status); ++ ++ break; ++ case UCR_SET_HUB_FEATURE: ++ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD HUB CONTROL - " ++ "SetHubFeature\n"); ++ /* No HUB features supported */ ++ break; ++ case UCR_SET_PORT_FEATURE: ++ if (wValue != UHF_PORT_TEST && (!wIndex || wIndex > 1)) ++ goto error; ++ ++ if (!dwc_otg_hcd->flags.b.port_connect_status) { ++ /* ++ * The port is disconnected, which means the core is ++ * either in device mode or it soon will be. Just ++ * return without doing anything since the port ++ * register can't be written if the core is in device ++ * mode. ++ */ ++ break; ++ } ++ ++ switch (wValue) { ++ case UHF_PORT_SUSPEND: ++ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD HUB CONTROL - " ++ "SetPortFeature - USB_PORT_FEAT_SUSPEND\n"); ++ if (dwc_otg_hcd_otg_port(dwc_otg_hcd) != wIndex) { ++ goto error; ++ } ++ if (core_if->power_down == 2) { ++ int timeout = 300; ++ dwc_irqflags_t flags; ++ pcgcctl_data_t pcgcctl = {.d32 = 0 }; ++ gpwrdn_data_t gpwrdn = {.d32 = 0 }; ++ gusbcfg_data_t gusbcfg = {.d32 = 0 }; ++#ifdef DWC_DEV_SRPCAP ++ int32_t otg_cap_param = core_if->core_params->otg_cap; ++#endif ++ DWC_PRINTF("Preparing for complete power-off\n"); ++ ++ /* Save registers before hibernation */ ++ dwc_otg_save_global_regs(core_if); ++ dwc_otg_save_host_regs(core_if); ++ ++ hprt0.d32 = dwc_otg_read_hprt0(core_if); ++ hprt0.b.prtsusp = 1; ++ hprt0.b.prtena = 0; ++ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); ++ /* Spin hprt0.b.prtsusp to became 1 */ ++ do { ++ hprt0.d32 = dwc_otg_read_hprt0(core_if); ++ if (hprt0.b.prtsusp) { ++ break; ++ } ++ dwc_mdelay(1); ++ } while (--timeout); ++ if (!timeout) { ++ DWC_WARN("Suspend wasn't genereted\n"); ++ } ++ dwc_udelay(10); ++ ++ /* ++ * We need to disable interrupts to prevent servicing of any IRQ ++ * during going to hibernation ++ */ ++ DWC_SPINLOCK_IRQSAVE(dwc_otg_hcd->lock, &flags); ++ core_if->lx_state = DWC_OTG_L2; ++#ifdef DWC_DEV_SRPCAP ++ hprt0.d32 = dwc_otg_read_hprt0(core_if); ++ hprt0.b.prtpwr = 0; ++ hprt0.b.prtena = 0; ++ DWC_WRITE_REG32(core_if->host_if->hprt0, ++ hprt0.d32); ++#endif ++ gusbcfg.d32 = ++ DWC_READ_REG32(&core_if->core_global_regs-> ++ gusbcfg); ++ if (gusbcfg.b.ulpi_utmi_sel == 1) { ++ /* ULPI interface */ ++ /* Suspend the Phy Clock */ ++ pcgcctl.d32 = 0; ++ pcgcctl.b.stoppclk = 1; ++ DWC_MODIFY_REG32(core_if->pcgcctl, 0, ++ pcgcctl.d32); ++ dwc_udelay(10); ++ gpwrdn.b.pmuactv = 1; ++ DWC_MODIFY_REG32(&core_if-> ++ core_global_regs-> ++ gpwrdn, 0, gpwrdn.d32); ++ } else { ++ /* UTMI+ Interface */ ++ gpwrdn.b.pmuactv = 1; ++ DWC_MODIFY_REG32(&core_if-> ++ core_global_regs-> ++ gpwrdn, 0, gpwrdn.d32); ++ dwc_udelay(10); ++ pcgcctl.b.stoppclk = 1; ++ DWC_MODIFY_REG32(core_if->pcgcctl, 0, pcgcctl.d32); ++ dwc_udelay(10); ++ } ++#ifdef DWC_DEV_SRPCAP ++ gpwrdn.d32 = 0; ++ gpwrdn.b.dis_vbus = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs-> ++ gpwrdn, 0, gpwrdn.d32); ++#endif ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pmuintsel = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs-> ++ gpwrdn, 0, gpwrdn.d32); ++ dwc_udelay(10); ++ ++ gpwrdn.d32 = 0; ++#ifdef DWC_DEV_SRPCAP ++ gpwrdn.b.srp_det_msk = 1; ++#endif ++ gpwrdn.b.disconn_det_msk = 1; ++ gpwrdn.b.lnstchng_msk = 1; ++ gpwrdn.b.sts_chngint_msk = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs-> ++ gpwrdn, 0, gpwrdn.d32); ++ dwc_udelay(10); ++ ++ /* Enable Power Down Clamp and all interrupts in GPWRDN */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pwrdnclmp = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs-> ++ gpwrdn, 0, gpwrdn.d32); ++ dwc_udelay(10); ++ ++ /* Switch off VDD */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pwrdnswtch = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs-> ++ gpwrdn, 0, gpwrdn.d32); ++ ++#ifdef DWC_DEV_SRPCAP ++ if (otg_cap_param == DWC_OTG_CAP_PARAM_HNP_SRP_CAPABLE) ++ { ++ core_if->pwron_timer_started = 1; ++ DWC_TIMER_SCHEDULE(core_if->pwron_timer, 6000 /* 6 secs */ ); ++ } ++#endif ++ /* Save gpwrdn register for further usage if stschng interrupt */ ++ core_if->gr_backup->gpwrdn_local = ++ DWC_READ_REG32(&core_if->core_global_regs->gpwrdn); ++ ++ /* Set flag to indicate that we are in hibernation */ ++ core_if->hibernation_suspend = 1; ++ DWC_SPINUNLOCK_IRQRESTORE(dwc_otg_hcd->lock,flags); ++ ++ DWC_PRINTF("Host hibernation completed\n"); ++ // Exit from case statement ++ break; ++ ++ } ++ if (dwc_otg_hcd_otg_port(dwc_otg_hcd) == wIndex && ++ dwc_otg_hcd->fops->get_b_hnp_enable(dwc_otg_hcd)) { ++ gotgctl_data_t gotgctl = {.d32 = 0 }; ++ gotgctl.b.hstsethnpen = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs-> ++ gotgctl, 0, gotgctl.d32); ++ core_if->op_state = A_SUSPEND; ++ } ++ hprt0.d32 = dwc_otg_read_hprt0(core_if); ++ hprt0.b.prtsusp = 1; ++ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); ++ { ++ dwc_irqflags_t flags; ++ /* Update lx_state */ ++ DWC_SPINLOCK_IRQSAVE(dwc_otg_hcd->lock, &flags); ++ core_if->lx_state = DWC_OTG_L2; ++ DWC_SPINUNLOCK_IRQRESTORE(dwc_otg_hcd->lock, flags); ++ } ++ /* Suspend the Phy Clock */ ++ { ++ pcgcctl_data_t pcgcctl = {.d32 = 0 }; ++ pcgcctl.b.stoppclk = 1; ++ DWC_MODIFY_REG32(core_if->pcgcctl, 0, ++ pcgcctl.d32); ++ dwc_udelay(10); ++ } ++ ++ /* For HNP the bus must be suspended for at least 200ms. */ ++ if (dwc_otg_hcd->fops->get_b_hnp_enable(dwc_otg_hcd)) { ++ pcgcctl_data_t pcgcctl = {.d32 = 0 }; ++ pcgcctl.b.stoppclk = 1; ++ DWC_MODIFY_REG32(core_if->pcgcctl, pcgcctl.d32, 0); ++ dwc_mdelay(200); ++ } ++ ++ /** @todo - check how sw can wait for 1 sec to check asesvld??? */ ++#if 0 //vahrama !!!!!!!!!!!!!!!!!! ++ if (core_if->adp_enable) { ++ gotgctl_data_t gotgctl = {.d32 = 0 }; ++ gpwrdn_data_t gpwrdn; ++ ++ while (gotgctl.b.asesvld == 1) { ++ gotgctl.d32 = ++ DWC_READ_REG32(&core_if-> ++ core_global_regs-> ++ gotgctl); ++ dwc_mdelay(100); ++ } ++ ++ /* Enable Power Down Logic */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pmuactv = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs-> ++ gpwrdn, 0, gpwrdn.d32); ++ ++ /* Unmask SRP detected interrupt from Power Down Logic */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.srp_det_msk = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs-> ++ gpwrdn, 0, gpwrdn.d32); ++ ++ dwc_otg_adp_probe_start(core_if); ++ } ++#endif ++ break; ++ case UHF_PORT_POWER: ++ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD HUB CONTROL - " ++ "SetPortFeature - USB_PORT_FEAT_POWER\n"); ++ hprt0.d32 = dwc_otg_read_hprt0(core_if); ++ hprt0.b.prtpwr = 1; ++ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); ++ break; ++ case UHF_PORT_RESET: ++ if ((core_if->power_down == 2) ++ && (core_if->hibernation_suspend == 1)) { ++ /* If we are going to exit from Hibernated ++ * state via USB RESET. ++ */ ++ dwc_otg_host_hibernation_restore(core_if, 0, 1); ++ } else { ++ hprt0.d32 = dwc_otg_read_hprt0(core_if); ++ ++ DWC_DEBUGPL(DBG_HCD, ++ "DWC OTG HCD HUB CONTROL - " ++ "SetPortFeature - USB_PORT_FEAT_RESET\n"); ++ { ++ pcgcctl_data_t pcgcctl = {.d32 = 0 }; ++ pcgcctl.b.enbl_sleep_gating = 1; ++ pcgcctl.b.stoppclk = 1; ++ DWC_MODIFY_REG32(core_if->pcgcctl, pcgcctl.d32, 0); ++ DWC_WRITE_REG32(core_if->pcgcctl, 0); ++ } ++#ifdef CONFIG_USB_DWC_OTG_LPM ++ { ++ glpmcfg_data_t lpmcfg; ++ lpmcfg.d32 = ++ DWC_READ_REG32(&core_if->core_global_regs->glpmcfg); ++ if (lpmcfg.b.prt_sleep_sts) { ++ lpmcfg.b.en_utmi_sleep = 0; ++ lpmcfg.b.hird_thres &= (~(1 << 4)); ++ DWC_WRITE_REG32 ++ (&core_if->core_global_regs->glpmcfg, ++ lpmcfg.d32); ++ dwc_mdelay(1); ++ } ++ } ++#endif ++ hprt0.d32 = dwc_otg_read_hprt0(core_if); ++ /* Clear suspend bit if resetting from suspended state. */ ++ hprt0.b.prtsusp = 0; ++ /* When B-Host the Port reset bit is set in ++ * the Start HCD Callback function, so that ++ * the reset is started within 1ms of the HNP ++ * success interrupt. */ ++ if (!dwc_otg_hcd_is_b_host(dwc_otg_hcd)) { ++ hprt0.b.prtpwr = 1; ++ hprt0.b.prtrst = 1; ++ DWC_PRINTF("Indeed it is in host mode hprt0 = %08x\n",hprt0.d32); ++ DWC_WRITE_REG32(core_if->host_if->hprt0, ++ hprt0.d32); ++ } ++ /* Clear reset bit in 10ms (FS/LS) or 50ms (HS) */ ++ dwc_mdelay(60); ++ hprt0.b.prtrst = 0; ++ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); ++ core_if->lx_state = DWC_OTG_L0; /* Now back to the on state */ ++ } ++ break; ++#ifdef DWC_HS_ELECT_TST ++ case UHF_PORT_TEST: ++ { ++ uint32_t t; ++ gintmsk_data_t gintmsk; ++ ++ t = (wIndex >> 8); /* MSB wIndex USB */ ++ DWC_DEBUGPL(DBG_HCD, ++ "DWC OTG HCD HUB CONTROL - " ++ "SetPortFeature - USB_PORT_FEAT_TEST %d\n", ++ t); ++ DWC_WARN("USB_PORT_FEAT_TEST %d\n", t); ++ if (t < 6) { ++ hprt0.d32 = dwc_otg_read_hprt0(core_if); ++ hprt0.b.prttstctl = t; ++ DWC_WRITE_REG32(core_if->host_if->hprt0, ++ hprt0.d32); ++ } else { ++ /* Setup global vars with reg addresses (quick and ++ * dirty hack, should be cleaned up) ++ */ ++ global_regs = core_if->core_global_regs; ++ hc_global_regs = ++ core_if->host_if->host_global_regs; ++ hc_regs = ++ (dwc_otg_hc_regs_t *) ((char *) ++ global_regs + ++ 0x500); ++ data_fifo = ++ (uint32_t *) ((char *)global_regs + ++ 0x1000); ++ ++ if (t == 6) { /* HS_HOST_PORT_SUSPEND_RESUME */ ++ /* Save current interrupt mask */ ++ gintmsk.d32 = ++ DWC_READ_REG32 ++ (&global_regs->gintmsk); ++ ++ /* Disable all interrupts while we muck with ++ * the hardware directly ++ */ ++ DWC_WRITE_REG32(&global_regs->gintmsk, 0); ++ ++ /* 15 second delay per the test spec */ ++ dwc_mdelay(15000); ++ ++ /* Drive suspend on the root port */ ++ hprt0.d32 = ++ dwc_otg_read_hprt0(core_if); ++ hprt0.b.prtsusp = 1; ++ hprt0.b.prtres = 0; ++ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); ++ ++ /* 15 second delay per the test spec */ ++ dwc_mdelay(15000); ++ ++ /* Drive resume on the root port */ ++ hprt0.d32 = ++ dwc_otg_read_hprt0(core_if); ++ hprt0.b.prtsusp = 0; ++ hprt0.b.prtres = 1; ++ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); ++ dwc_mdelay(100); ++ ++ /* Clear the resume bit */ ++ hprt0.b.prtres = 0; ++ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); ++ ++ /* Restore interrupts */ ++ DWC_WRITE_REG32(&global_regs->gintmsk, gintmsk.d32); ++ } else if (t == 7) { /* SINGLE_STEP_GET_DEVICE_DESCRIPTOR setup */ ++ /* Save current interrupt mask */ ++ gintmsk.d32 = ++ DWC_READ_REG32 ++ (&global_regs->gintmsk); ++ ++ /* Disable all interrupts while we muck with ++ * the hardware directly ++ */ ++ DWC_WRITE_REG32(&global_regs->gintmsk, 0); ++ ++ /* 15 second delay per the test spec */ ++ dwc_mdelay(15000); ++ ++ /* Send the Setup packet */ ++ do_setup(); ++ ++ /* 15 second delay so nothing else happens for awhile */ ++ dwc_mdelay(15000); ++ ++ /* Restore interrupts */ ++ DWC_WRITE_REG32(&global_regs->gintmsk, gintmsk.d32); ++ } else if (t == 8) { /* SINGLE_STEP_GET_DEVICE_DESCRIPTOR execute */ ++ /* Save current interrupt mask */ ++ gintmsk.d32 = ++ DWC_READ_REG32 ++ (&global_regs->gintmsk); ++ ++ /* Disable all interrupts while we muck with ++ * the hardware directly ++ */ ++ DWC_WRITE_REG32(&global_regs->gintmsk, 0); ++ ++ /* Send the Setup packet */ ++ do_setup(); ++ ++ /* 15 second delay so nothing else happens for awhile */ ++ dwc_mdelay(15000); ++ ++ /* Send the In and Ack packets */ ++ do_in_ack(); ++ ++ /* 15 second delay so nothing else happens for awhile */ ++ dwc_mdelay(15000); ++ ++ /* Restore interrupts */ ++ DWC_WRITE_REG32(&global_regs->gintmsk, gintmsk.d32); ++ } ++ } ++ break; ++ } ++#endif /* DWC_HS_ELECT_TST */ ++ ++ case UHF_PORT_INDICATOR: ++ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD HUB CONTROL - " ++ "SetPortFeature - USB_PORT_FEAT_INDICATOR\n"); ++ /* Not supported */ ++ break; ++ default: ++ retval = -DWC_E_INVALID; ++ DWC_ERROR("DWC OTG HCD - " ++ "SetPortFeature request %xh " ++ "unknown or unsupported\n", wValue); ++ break; ++ } ++ break; ++#ifdef CONFIG_USB_DWC_OTG_LPM ++ case UCR_SET_AND_TEST_PORT_FEATURE: ++ if (wValue != UHF_PORT_L1) { ++ goto error; ++ } ++ { ++ int portnum, hird, devaddr, remwake; ++ glpmcfg_data_t lpmcfg; ++ uint32_t time_usecs; ++ gintsts_data_t gintsts; ++ gintmsk_data_t gintmsk; ++ ++ if (!dwc_otg_get_param_lpm_enable(core_if)) { ++ goto error; ++ } ++ if (wValue != UHF_PORT_L1 || wLength != 1) { ++ goto error; ++ } ++ /* Check if the port currently is in SLEEP state */ ++ lpmcfg.d32 = ++ DWC_READ_REG32(&core_if->core_global_regs->glpmcfg); ++ if (lpmcfg.b.prt_sleep_sts) { ++ DWC_INFO("Port is already in sleep mode\n"); ++ buf[0] = 0; /* Return success */ ++ break; ++ } ++ ++ portnum = wIndex & 0xf; ++ hird = (wIndex >> 4) & 0xf; ++ devaddr = (wIndex >> 8) & 0x7f; ++ remwake = (wIndex >> 15); ++ ++ if (portnum != 1) { ++ retval = -DWC_E_INVALID; ++ DWC_WARN ++ ("Wrong port number(%d) in SetandTestPortFeature request\n", ++ portnum); ++ break; ++ } ++ ++ DWC_PRINTF ++ ("SetandTestPortFeature request: portnum = %d, hird = %d, devaddr = %d, rewake = %d\n", ++ portnum, hird, devaddr, remwake); ++ /* Disable LPM interrupt */ ++ gintmsk.d32 = 0; ++ gintmsk.b.lpmtranrcvd = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gintmsk, ++ gintmsk.d32, 0); ++ ++ if (dwc_otg_hcd_send_lpm ++ (dwc_otg_hcd, devaddr, hird, remwake)) { ++ retval = -DWC_E_INVALID; ++ break; ++ } ++ ++ time_usecs = 10 * (lpmcfg.b.retry_count + 1); ++ /* We will consider timeout if time_usecs microseconds pass, ++ * and we don't receive LPM transaction status. ++ * After receiving non-error responce(ACK/NYET/STALL) from device, ++ * core will set lpmtranrcvd bit. ++ */ ++ do { ++ gintsts.d32 = ++ DWC_READ_REG32(&core_if->core_global_regs->gintsts); ++ if (gintsts.b.lpmtranrcvd) { ++ break; ++ } ++ dwc_udelay(1); ++ } while (--time_usecs); ++ /* lpm_int bit will be cleared in LPM interrupt handler */ ++ ++ /* Now fill status ++ * 0x00 - Success ++ * 0x10 - NYET ++ * 0x11 - Timeout ++ */ ++ if (!gintsts.b.lpmtranrcvd) { ++ buf[0] = 0x3; /* Completion code is Timeout */ ++ dwc_otg_hcd_free_hc_from_lpm(dwc_otg_hcd); ++ } else { ++ lpmcfg.d32 = ++ DWC_READ_REG32(&core_if->core_global_regs->glpmcfg); ++ if (lpmcfg.b.lpm_resp == 0x3) { ++ /* ACK responce from the device */ ++ buf[0] = 0x00; /* Success */ ++ } else if (lpmcfg.b.lpm_resp == 0x2) { ++ /* NYET responce from the device */ ++ buf[0] = 0x2; ++ } else { ++ /* Otherwise responce with Timeout */ ++ buf[0] = 0x3; ++ } ++ } ++ DWC_PRINTF("Device responce to LPM trans is %x\n", ++ lpmcfg.b.lpm_resp); ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gintmsk, 0, ++ gintmsk.d32); ++ ++ break; ++ } ++#endif /* CONFIG_USB_DWC_OTG_LPM */ ++ default: ++error: ++ retval = -DWC_E_INVALID; ++ DWC_WARN("DWC OTG HCD - " ++ "Unknown hub control request type or invalid typeReq: %xh wIndex: %xh wValue: %xh\n", ++ typeReq, wIndex, wValue); ++ break; ++ } ++ ++ return retval; ++} ++ ++#ifdef CONFIG_USB_DWC_OTG_LPM ++/** Returns index of host channel to perform LPM transaction. */ ++int dwc_otg_hcd_get_hc_for_lpm_tran(dwc_otg_hcd_t * hcd, uint8_t devaddr) ++{ ++ dwc_otg_core_if_t *core_if = hcd->core_if; ++ dwc_hc_t *hc; ++ hcchar_data_t hcchar; ++ gintmsk_data_t gintmsk = {.d32 = 0 }; ++ ++ if (DWC_CIRCLEQ_EMPTY(&hcd->free_hc_list)) { ++ DWC_PRINTF("No free channel to select for LPM transaction\n"); ++ return -1; ++ } ++ ++ hc = DWC_CIRCLEQ_FIRST(&hcd->free_hc_list); ++ ++ /* Mask host channel interrupts. */ ++ gintmsk.b.hcintr = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gintmsk, gintmsk.d32, 0); ++ ++ /* Fill fields that core needs for LPM transaction */ ++ hcchar.b.devaddr = devaddr; ++ hcchar.b.epnum = 0; ++ hcchar.b.eptype = DWC_OTG_EP_TYPE_CONTROL; ++ hcchar.b.mps = 64; ++ hcchar.b.lspddev = (hc->speed == DWC_OTG_EP_SPEED_LOW); ++ hcchar.b.epdir = 0; /* OUT */ ++ DWC_WRITE_REG32(&core_if->host_if->hc_regs[hc->hc_num]->hcchar, ++ hcchar.d32); ++ ++ /* Remove the host channel from the free list. */ ++ DWC_CIRCLEQ_REMOVE_INIT(&hcd->free_hc_list, hc, hc_list_entry); ++ ++ DWC_PRINTF("hcnum = %d devaddr = %d\n", hc->hc_num, devaddr); ++ ++ return hc->hc_num; ++} ++ ++/** Release hc after performing LPM transaction */ ++void dwc_otg_hcd_free_hc_from_lpm(dwc_otg_hcd_t * hcd) ++{ ++ dwc_hc_t *hc; ++ glpmcfg_data_t lpmcfg; ++ uint8_t hc_num; ++ ++ lpmcfg.d32 = DWC_READ_REG32(&hcd->core_if->core_global_regs->glpmcfg); ++ hc_num = lpmcfg.b.lpm_chan_index; ++ ++ hc = hcd->hc_ptr_array[hc_num]; ++ ++ DWC_PRINTF("Freeing channel %d after LPM\n", hc_num); ++ /* Return host channel to free list */ ++ DWC_CIRCLEQ_INSERT_TAIL(&hcd->free_hc_list, hc, hc_list_entry); ++} ++ ++int dwc_otg_hcd_send_lpm(dwc_otg_hcd_t * hcd, uint8_t devaddr, uint8_t hird, ++ uint8_t bRemoteWake) ++{ ++ glpmcfg_data_t lpmcfg; ++ pcgcctl_data_t pcgcctl = {.d32 = 0 }; ++ int channel; ++ ++ channel = dwc_otg_hcd_get_hc_for_lpm_tran(hcd, devaddr); ++ if (channel < 0) { ++ return channel; ++ } ++ ++ pcgcctl.b.enbl_sleep_gating = 1; ++ DWC_MODIFY_REG32(hcd->core_if->pcgcctl, 0, pcgcctl.d32); ++ ++ /* Read LPM config register */ ++ lpmcfg.d32 = DWC_READ_REG32(&hcd->core_if->core_global_regs->glpmcfg); ++ ++ /* Program LPM transaction fields */ ++ lpmcfg.b.rem_wkup_en = bRemoteWake; ++ lpmcfg.b.hird = hird; ++ lpmcfg.b.hird_thres = 0x1c; ++ lpmcfg.b.lpm_chan_index = channel; ++ lpmcfg.b.en_utmi_sleep = 1; ++ /* Program LPM config register */ ++ DWC_WRITE_REG32(&hcd->core_if->core_global_regs->glpmcfg, lpmcfg.d32); ++ ++ /* Send LPM transaction */ ++ lpmcfg.b.send_lpm = 1; ++ DWC_WRITE_REG32(&hcd->core_if->core_global_regs->glpmcfg, lpmcfg.d32); ++ ++ return 0; ++} ++ ++#endif /* CONFIG_USB_DWC_OTG_LPM */ ++ ++int dwc_otg_hcd_is_status_changed(dwc_otg_hcd_t * hcd, int port) ++{ ++ int retval; ++ ++ if (port != 1) { ++ return -DWC_E_INVALID; ++ } ++ ++ retval = (hcd->flags.b.port_connect_status_change || ++ hcd->flags.b.port_reset_change || ++ hcd->flags.b.port_enable_change || ++ hcd->flags.b.port_suspend_change || ++ hcd->flags.b.port_over_current_change); ++#ifdef DEBUG ++ if (retval) { ++ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD HUB STATUS DATA:" ++ " Root port status changed\n"); ++ DWC_DEBUGPL(DBG_HCDV, " port_connect_status_change: %d\n", ++ hcd->flags.b.port_connect_status_change); ++ DWC_DEBUGPL(DBG_HCDV, " port_reset_change: %d\n", ++ hcd->flags.b.port_reset_change); ++ DWC_DEBUGPL(DBG_HCDV, " port_enable_change: %d\n", ++ hcd->flags.b.port_enable_change); ++ DWC_DEBUGPL(DBG_HCDV, " port_suspend_change: %d\n", ++ hcd->flags.b.port_suspend_change); ++ DWC_DEBUGPL(DBG_HCDV, " port_over_current_change: %d\n", ++ hcd->flags.b.port_over_current_change); ++ } ++#endif ++ return retval; ++} ++ ++int dwc_otg_hcd_get_frame_number(dwc_otg_hcd_t * dwc_otg_hcd) ++{ ++ hfnum_data_t hfnum; ++ hfnum.d32 = ++ DWC_READ_REG32(&dwc_otg_hcd->core_if->host_if->host_global_regs-> ++ hfnum); ++ ++#ifdef DEBUG_SOF ++ DWC_DEBUGPL(DBG_HCDV, "DWC OTG HCD GET FRAME NUMBER %d\n", ++ hfnum.b.frnum); ++#endif ++ return hfnum.b.frnum; ++} ++ ++int dwc_otg_hcd_start(dwc_otg_hcd_t * hcd, ++ struct dwc_otg_hcd_function_ops *fops) ++{ ++ int retval = 0; ++ ++ hcd->fops = fops; ++ if (!dwc_otg_is_device_mode(hcd->core_if) && ++ (!hcd->core_if->adp_enable || hcd->core_if->adp.adp_started)) { ++ dwc_otg_hcd_reinit(hcd); ++ } else { ++ retval = -DWC_E_NO_DEVICE; ++ } ++ ++ return retval; ++} ++ ++void *dwc_otg_hcd_get_priv_data(dwc_otg_hcd_t * hcd) ++{ ++ return hcd->priv; ++} ++ ++void dwc_otg_hcd_set_priv_data(dwc_otg_hcd_t * hcd, void *priv_data) ++{ ++ hcd->priv = priv_data; ++} ++ ++uint32_t dwc_otg_hcd_otg_port(dwc_otg_hcd_t * hcd) ++{ ++ return hcd->otg_port; ++} ++ ++uint32_t dwc_otg_hcd_is_b_host(dwc_otg_hcd_t * hcd) ++{ ++ uint32_t is_b_host; ++ if (hcd->core_if->op_state == B_HOST) { ++ is_b_host = 1; ++ } else { ++ is_b_host = 0; ++ } ++ ++ return is_b_host; ++} ++ ++dwc_otg_hcd_urb_t *dwc_otg_hcd_urb_alloc(dwc_otg_hcd_t * hcd, ++ int iso_desc_count, int atomic_alloc) ++{ ++ dwc_otg_hcd_urb_t *dwc_otg_urb; ++ uint32_t size; ++ ++ size = ++ sizeof(*dwc_otg_urb) + ++ iso_desc_count * sizeof(struct dwc_otg_hcd_iso_packet_desc); ++ if (atomic_alloc) ++ dwc_otg_urb = DWC_ALLOC_ATOMIC(size); ++ else ++ dwc_otg_urb = DWC_ALLOC(size); ++ ++ if (dwc_otg_urb) ++ dwc_otg_urb->packet_count = iso_desc_count; ++ else { ++ DWC_ERROR("**** DWC OTG HCD URB alloc - " ++ "%salloc of %db failed\n", ++ atomic_alloc?"atomic ":"", size); ++ } ++ return dwc_otg_urb; ++} ++ ++void dwc_otg_hcd_urb_set_pipeinfo(dwc_otg_hcd_urb_t * dwc_otg_urb, ++ uint8_t dev_addr, uint8_t ep_num, ++ uint8_t ep_type, uint8_t ep_dir, uint16_t mps) ++{ ++ dwc_otg_hcd_fill_pipe(&dwc_otg_urb->pipe_info, dev_addr, ep_num, ++ ep_type, ep_dir, mps); ++#if 0 ++ DWC_PRINTF ++ ("addr = %d, ep_num = %d, ep_dir = 0x%x, ep_type = 0x%x, mps = %d\n", ++ dev_addr, ep_num, ep_dir, ep_type, mps); ++#endif ++} ++ ++void dwc_otg_hcd_urb_set_params(dwc_otg_hcd_urb_t * dwc_otg_urb, ++ void *urb_handle, void *buf, dwc_dma_t dma, ++ uint32_t buflen, void *setup_packet, ++ dwc_dma_t setup_dma, uint32_t flags, ++ uint16_t interval) ++{ ++ dwc_otg_urb->priv = urb_handle; ++ dwc_otg_urb->buf = buf; ++ dwc_otg_urb->dma = dma; ++ dwc_otg_urb->length = buflen; ++ dwc_otg_urb->setup_packet = setup_packet; ++ dwc_otg_urb->setup_dma = setup_dma; ++ dwc_otg_urb->flags = flags; ++ dwc_otg_urb->interval = interval; ++ dwc_otg_urb->status = -DWC_E_IN_PROGRESS; ++} ++ ++uint32_t dwc_otg_hcd_urb_get_status(dwc_otg_hcd_urb_t * dwc_otg_urb) ++{ ++ return dwc_otg_urb->status; ++} ++ ++uint32_t dwc_otg_hcd_urb_get_actual_length(dwc_otg_hcd_urb_t * dwc_otg_urb) ++{ ++ return dwc_otg_urb->actual_length; ++} ++ ++uint32_t dwc_otg_hcd_urb_get_error_count(dwc_otg_hcd_urb_t * dwc_otg_urb) ++{ ++ return dwc_otg_urb->error_count; ++} ++ ++void dwc_otg_hcd_urb_set_iso_desc_params(dwc_otg_hcd_urb_t * dwc_otg_urb, ++ int desc_num, uint32_t offset, ++ uint32_t length) ++{ ++ dwc_otg_urb->iso_descs[desc_num].offset = offset; ++ dwc_otg_urb->iso_descs[desc_num].length = length; ++} ++ ++uint32_t dwc_otg_hcd_urb_get_iso_desc_status(dwc_otg_hcd_urb_t * dwc_otg_urb, ++ int desc_num) ++{ ++ return dwc_otg_urb->iso_descs[desc_num].status; ++} ++ ++uint32_t dwc_otg_hcd_urb_get_iso_desc_actual_length(dwc_otg_hcd_urb_t * ++ dwc_otg_urb, int desc_num) ++{ ++ return dwc_otg_urb->iso_descs[desc_num].actual_length; ++} ++ ++int dwc_otg_hcd_is_bandwidth_allocated(dwc_otg_hcd_t * hcd, void *ep_handle) ++{ ++ int allocated = 0; ++ dwc_otg_qh_t *qh = (dwc_otg_qh_t *) ep_handle; ++ ++ if (qh) { ++ if (!DWC_LIST_EMPTY(&qh->qh_list_entry)) { ++ allocated = 1; ++ } ++ } ++ return allocated; ++} ++ ++int dwc_otg_hcd_is_bandwidth_freed(dwc_otg_hcd_t * hcd, void *ep_handle) ++{ ++ dwc_otg_qh_t *qh = (dwc_otg_qh_t *) ep_handle; ++ int freed = 0; ++ DWC_ASSERT(qh, "qh is not allocated\n"); ++ ++ if (DWC_LIST_EMPTY(&qh->qh_list_entry)) { ++ freed = 1; ++ } ++ ++ return freed; ++} ++ ++uint8_t dwc_otg_hcd_get_ep_bandwidth(dwc_otg_hcd_t * hcd, void *ep_handle) ++{ ++ dwc_otg_qh_t *qh = (dwc_otg_qh_t *) ep_handle; ++ DWC_ASSERT(qh, "qh is not allocated\n"); ++ return qh->usecs; ++} ++ ++void dwc_otg_hcd_dump_state(dwc_otg_hcd_t * hcd) ++{ ++#ifdef DEBUG ++ int num_channels; ++ int i; ++ gnptxsts_data_t np_tx_status; ++ hptxsts_data_t p_tx_status; ++ ++ num_channels = hcd->core_if->core_params->host_channels; ++ DWC_PRINTF("\n"); ++ DWC_PRINTF ++ ("************************************************************\n"); ++ DWC_PRINTF("HCD State:\n"); ++ DWC_PRINTF(" Num channels: %d\n", num_channels); ++ for (i = 0; i < num_channels; i++) { ++ dwc_hc_t *hc = hcd->hc_ptr_array[i]; ++ DWC_PRINTF(" Channel %d:\n", i); ++ DWC_PRINTF(" dev_addr: %d, ep_num: %d, ep_is_in: %d\n", ++ hc->dev_addr, hc->ep_num, hc->ep_is_in); ++ DWC_PRINTF(" speed: %d\n", hc->speed); ++ DWC_PRINTF(" ep_type: %d\n", hc->ep_type); ++ DWC_PRINTF(" max_packet: %d\n", hc->max_packet); ++ DWC_PRINTF(" data_pid_start: %d\n", hc->data_pid_start); ++ DWC_PRINTF(" multi_count: %d\n", hc->multi_count); ++ DWC_PRINTF(" xfer_started: %d\n", hc->xfer_started); ++ DWC_PRINTF(" xfer_buff: %p\n", hc->xfer_buff); ++ DWC_PRINTF(" xfer_len: %d\n", hc->xfer_len); ++ DWC_PRINTF(" xfer_count: %d\n", hc->xfer_count); ++ DWC_PRINTF(" halt_on_queue: %d\n", hc->halt_on_queue); ++ DWC_PRINTF(" halt_pending: %d\n", hc->halt_pending); ++ DWC_PRINTF(" halt_status: %d\n", hc->halt_status); ++ DWC_PRINTF(" do_split: %d\n", hc->do_split); ++ DWC_PRINTF(" complete_split: %d\n", hc->complete_split); ++ DWC_PRINTF(" hub_addr: %d\n", hc->hub_addr); ++ DWC_PRINTF(" port_addr: %d\n", hc->port_addr); ++ DWC_PRINTF(" xact_pos: %d\n", hc->xact_pos); ++ DWC_PRINTF(" requests: %d\n", hc->requests); ++ DWC_PRINTF(" qh: %p\n", hc->qh); ++ if (hc->xfer_started) { ++ hfnum_data_t hfnum; ++ hcchar_data_t hcchar; ++ hctsiz_data_t hctsiz; ++ hcint_data_t hcint; ++ hcintmsk_data_t hcintmsk; ++ hfnum.d32 = ++ DWC_READ_REG32(&hcd->core_if-> ++ host_if->host_global_regs->hfnum); ++ hcchar.d32 = ++ DWC_READ_REG32(&hcd->core_if->host_if-> ++ hc_regs[i]->hcchar); ++ hctsiz.d32 = ++ DWC_READ_REG32(&hcd->core_if->host_if-> ++ hc_regs[i]->hctsiz); ++ hcint.d32 = ++ DWC_READ_REG32(&hcd->core_if->host_if-> ++ hc_regs[i]->hcint); ++ hcintmsk.d32 = ++ DWC_READ_REG32(&hcd->core_if->host_if-> ++ hc_regs[i]->hcintmsk); ++ DWC_PRINTF(" hfnum: 0x%08x\n", hfnum.d32); ++ DWC_PRINTF(" hcchar: 0x%08x\n", hcchar.d32); ++ DWC_PRINTF(" hctsiz: 0x%08x\n", hctsiz.d32); ++ DWC_PRINTF(" hcint: 0x%08x\n", hcint.d32); ++ DWC_PRINTF(" hcintmsk: 0x%08x\n", hcintmsk.d32); ++ } ++ if (hc->xfer_started && hc->qh) { ++ dwc_otg_qtd_t *qtd; ++ dwc_otg_hcd_urb_t *urb; ++ ++ DWC_CIRCLEQ_FOREACH(qtd, &hc->qh->qtd_list, qtd_list_entry) { ++ if (!qtd->in_process) ++ break; ++ ++ urb = qtd->urb; ++ DWC_PRINTF(" URB Info:\n"); ++ DWC_PRINTF(" qtd: %p, urb: %p\n", qtd, urb); ++ if (urb) { ++ DWC_PRINTF(" Dev: %d, EP: %d %s\n", ++ dwc_otg_hcd_get_dev_addr(&urb-> ++ pipe_info), ++ dwc_otg_hcd_get_ep_num(&urb-> ++ pipe_info), ++ dwc_otg_hcd_is_pipe_in(&urb-> ++ pipe_info) ? ++ "IN" : "OUT"); ++ DWC_PRINTF(" Max packet size: %d\n", ++ dwc_otg_hcd_get_mps(&urb-> ++ pipe_info)); ++ DWC_PRINTF(" transfer_buffer: %p\n", ++ urb->buf); ++ DWC_PRINTF(" transfer_dma: %p\n", ++ (void *)urb->dma); ++ DWC_PRINTF(" transfer_buffer_length: %d\n", ++ urb->length); ++ DWC_PRINTF(" actual_length: %d\n", ++ urb->actual_length); ++ } ++ } ++ } ++ } ++ DWC_PRINTF(" non_periodic_channels: %d\n", hcd->non_periodic_channels); ++ DWC_PRINTF(" periodic_channels: %d\n", hcd->periodic_channels); ++ DWC_PRINTF(" periodic_usecs: %d\n", hcd->periodic_usecs); ++ np_tx_status.d32 = ++ DWC_READ_REG32(&hcd->core_if->core_global_regs->gnptxsts); ++ DWC_PRINTF(" NP Tx Req Queue Space Avail: %d\n", ++ np_tx_status.b.nptxqspcavail); ++ DWC_PRINTF(" NP Tx FIFO Space Avail: %d\n", ++ np_tx_status.b.nptxfspcavail); ++ p_tx_status.d32 = ++ DWC_READ_REG32(&hcd->core_if->host_if->host_global_regs->hptxsts); ++ DWC_PRINTF(" P Tx Req Queue Space Avail: %d\n", ++ p_tx_status.b.ptxqspcavail); ++ DWC_PRINTF(" P Tx FIFO Space Avail: %d\n", p_tx_status.b.ptxfspcavail); ++ dwc_otg_hcd_dump_frrem(hcd); ++ dwc_otg_dump_global_registers(hcd->core_if); ++ dwc_otg_dump_host_registers(hcd->core_if); ++ DWC_PRINTF ++ ("************************************************************\n"); ++ DWC_PRINTF("\n"); ++#endif ++} ++ ++#ifdef DEBUG ++void dwc_print_setup_data(uint8_t * setup) ++{ ++ int i; ++ if (CHK_DEBUG_LEVEL(DBG_HCD)) { ++ DWC_PRINTF("Setup Data = MSB "); ++ for (i = 7; i >= 0; i--) ++ DWC_PRINTF("%02x ", setup[i]); ++ DWC_PRINTF("\n"); ++ DWC_PRINTF(" bmRequestType Tranfer = %s\n", ++ (setup[0] & 0x80) ? "Device-to-Host" : ++ "Host-to-Device"); ++ DWC_PRINTF(" bmRequestType Type = "); ++ switch ((setup[0] & 0x60) >> 5) { ++ case 0: ++ DWC_PRINTF("Standard\n"); ++ break; ++ case 1: ++ DWC_PRINTF("Class\n"); ++ break; ++ case 2: ++ DWC_PRINTF("Vendor\n"); ++ break; ++ case 3: ++ DWC_PRINTF("Reserved\n"); ++ break; ++ } ++ DWC_PRINTF(" bmRequestType Recipient = "); ++ switch (setup[0] & 0x1f) { ++ case 0: ++ DWC_PRINTF("Device\n"); ++ break; ++ case 1: ++ DWC_PRINTF("Interface\n"); ++ break; ++ case 2: ++ DWC_PRINTF("Endpoint\n"); ++ break; ++ case 3: ++ DWC_PRINTF("Other\n"); ++ break; ++ default: ++ DWC_PRINTF("Reserved\n"); ++ break; ++ } ++ DWC_PRINTF(" bRequest = 0x%0x\n", setup[1]); ++ DWC_PRINTF(" wValue = 0x%0x\n", *((uint16_t *) & setup[2])); ++ DWC_PRINTF(" wIndex = 0x%0x\n", *((uint16_t *) & setup[4])); ++ DWC_PRINTF(" wLength = 0x%0x\n\n", *((uint16_t *) & setup[6])); ++ } ++} ++#endif ++ ++void dwc_otg_hcd_dump_frrem(dwc_otg_hcd_t * hcd) ++{ ++#if 0 ++ DWC_PRINTF("Frame remaining at SOF:\n"); ++ DWC_PRINTF(" samples %u, accum %llu, avg %llu\n", ++ hcd->frrem_samples, hcd->frrem_accum, ++ (hcd->frrem_samples > 0) ? ++ hcd->frrem_accum / hcd->frrem_samples : 0); ++ ++ DWC_PRINTF("\n"); ++ DWC_PRINTF("Frame remaining at start_transfer (uframe 7):\n"); ++ DWC_PRINTF(" samples %u, accum %llu, avg %llu\n", ++ hcd->core_if->hfnum_7_samples, ++ hcd->core_if->hfnum_7_frrem_accum, ++ (hcd->core_if->hfnum_7_samples > ++ 0) ? hcd->core_if->hfnum_7_frrem_accum / ++ hcd->core_if->hfnum_7_samples : 0); ++ DWC_PRINTF("Frame remaining at start_transfer (uframe 0):\n"); ++ DWC_PRINTF(" samples %u, accum %llu, avg %llu\n", ++ hcd->core_if->hfnum_0_samples, ++ hcd->core_if->hfnum_0_frrem_accum, ++ (hcd->core_if->hfnum_0_samples > ++ 0) ? hcd->core_if->hfnum_0_frrem_accum / ++ hcd->core_if->hfnum_0_samples : 0); ++ DWC_PRINTF("Frame remaining at start_transfer (uframe 1-6):\n"); ++ DWC_PRINTF(" samples %u, accum %llu, avg %llu\n", ++ hcd->core_if->hfnum_other_samples, ++ hcd->core_if->hfnum_other_frrem_accum, ++ (hcd->core_if->hfnum_other_samples > ++ 0) ? hcd->core_if->hfnum_other_frrem_accum / ++ hcd->core_if->hfnum_other_samples : 0); ++ ++ DWC_PRINTF("\n"); ++ DWC_PRINTF("Frame remaining at sample point A (uframe 7):\n"); ++ DWC_PRINTF(" samples %u, accum %llu, avg %llu\n", ++ hcd->hfnum_7_samples_a, hcd->hfnum_7_frrem_accum_a, ++ (hcd->hfnum_7_samples_a > 0) ? ++ hcd->hfnum_7_frrem_accum_a / hcd->hfnum_7_samples_a : 0); ++ DWC_PRINTF("Frame remaining at sample point A (uframe 0):\n"); ++ DWC_PRINTF(" samples %u, accum %llu, avg %llu\n", ++ hcd->hfnum_0_samples_a, hcd->hfnum_0_frrem_accum_a, ++ (hcd->hfnum_0_samples_a > 0) ? ++ hcd->hfnum_0_frrem_accum_a / hcd->hfnum_0_samples_a : 0); ++ DWC_PRINTF("Frame remaining at sample point A (uframe 1-6):\n"); ++ DWC_PRINTF(" samples %u, accum %llu, avg %llu\n", ++ hcd->hfnum_other_samples_a, hcd->hfnum_other_frrem_accum_a, ++ (hcd->hfnum_other_samples_a > 0) ? ++ hcd->hfnum_other_frrem_accum_a / ++ hcd->hfnum_other_samples_a : 0); ++ ++ DWC_PRINTF("\n"); ++ DWC_PRINTF("Frame remaining at sample point B (uframe 7):\n"); ++ DWC_PRINTF(" samples %u, accum %llu, avg %llu\n", ++ hcd->hfnum_7_samples_b, hcd->hfnum_7_frrem_accum_b, ++ (hcd->hfnum_7_samples_b > 0) ? ++ hcd->hfnum_7_frrem_accum_b / hcd->hfnum_7_samples_b : 0); ++ DWC_PRINTF("Frame remaining at sample point B (uframe 0):\n"); ++ DWC_PRINTF(" samples %u, accum %llu, avg %llu\n", ++ hcd->hfnum_0_samples_b, hcd->hfnum_0_frrem_accum_b, ++ (hcd->hfnum_0_samples_b > 0) ? ++ hcd->hfnum_0_frrem_accum_b / hcd->hfnum_0_samples_b : 0); ++ DWC_PRINTF("Frame remaining at sample point B (uframe 1-6):\n"); ++ DWC_PRINTF(" samples %u, accum %llu, avg %llu\n", ++ hcd->hfnum_other_samples_b, hcd->hfnum_other_frrem_accum_b, ++ (hcd->hfnum_other_samples_b > 0) ? ++ hcd->hfnum_other_frrem_accum_b / ++ hcd->hfnum_other_samples_b : 0); ++#endif ++} ++ ++#endif /* DWC_DEVICE_ONLY */ +diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd.h b/drivers/usb/host/dwc_otg/dwc_otg_hcd.h +new file mode 100644 +index 0000000..43dbed9 +--- /dev/null ++++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd.h +@@ -0,0 +1,862 @@ ++/* ========================================================================== ++ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_hcd.h $ ++ * $Revision: #58 $ ++ * $Date: 2011/09/15 $ ++ * $Change: 1846647 $ ++ * ++ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, ++ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless ++ * otherwise expressly agreed to in writing between Synopsys and you. ++ * ++ * The Software IS NOT an item of Licensed Software or Licensed Product under ++ * any End User Software License Agreement or Agreement for Licensed Product ++ * with Synopsys or any supplement thereto. You are permitted to use and ++ * redistribute this Software in source and binary forms, with or without ++ * modification, provided that redistributions of source code must retain this ++ * notice. You may not view, use, disclose, copy or distribute this file or ++ * any information contained herein except pursuant to this license grant from ++ * Synopsys. If you do not agree with this notice, including the disclaimer ++ * below, then you are not authorized to use the Software. ++ * ++ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS ++ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS 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. ++ * ========================================================================== */ ++#ifndef DWC_DEVICE_ONLY ++#ifndef __DWC_HCD_H__ ++#define __DWC_HCD_H__ ++ ++#include "dwc_otg_os_dep.h" ++#include "usb.h" ++#include "dwc_otg_hcd_if.h" ++#include "dwc_otg_core_if.h" ++#include "dwc_list.h" ++#include "dwc_otg_cil.h" ++#include "dwc_otg_fiq_fsm.h" ++ ++ ++/** ++ * @file ++ * ++ * This file contains the structures, constants, and interfaces for ++ * the Host Contoller Driver (HCD). ++ * ++ * The Host Controller Driver (HCD) is responsible for translating requests ++ * from the USB Driver into the appropriate actions on the DWC_otg controller. ++ * It isolates the USBD from the specifics of the controller by providing an ++ * API to the USBD. ++ */ ++ ++struct dwc_otg_hcd_pipe_info { ++ uint8_t dev_addr; ++ uint8_t ep_num; ++ uint8_t pipe_type; ++ uint8_t pipe_dir; ++ uint16_t mps; ++}; ++ ++struct dwc_otg_hcd_iso_packet_desc { ++ uint32_t offset; ++ uint32_t length; ++ uint32_t actual_length; ++ uint32_t status; ++}; ++ ++struct dwc_otg_qtd; ++ ++struct dwc_otg_hcd_urb { ++ void *priv; ++ struct dwc_otg_qtd *qtd; ++ void *buf; ++ dwc_dma_t dma; ++ void *setup_packet; ++ dwc_dma_t setup_dma; ++ uint32_t length; ++ uint32_t actual_length; ++ uint32_t status; ++ uint32_t error_count; ++ uint32_t packet_count; ++ uint32_t flags; ++ uint16_t interval; ++ struct dwc_otg_hcd_pipe_info pipe_info; ++ struct dwc_otg_hcd_iso_packet_desc iso_descs[0]; ++}; ++ ++static inline uint8_t dwc_otg_hcd_get_ep_num(struct dwc_otg_hcd_pipe_info *pipe) ++{ ++ return pipe->ep_num; ++} ++ ++static inline uint8_t dwc_otg_hcd_get_pipe_type(struct dwc_otg_hcd_pipe_info ++ *pipe) ++{ ++ return pipe->pipe_type; ++} ++ ++static inline uint16_t dwc_otg_hcd_get_mps(struct dwc_otg_hcd_pipe_info *pipe) ++{ ++ return pipe->mps; ++} ++ ++static inline uint8_t dwc_otg_hcd_get_dev_addr(struct dwc_otg_hcd_pipe_info ++ *pipe) ++{ ++ return pipe->dev_addr; ++} ++ ++static inline uint8_t dwc_otg_hcd_is_pipe_isoc(struct dwc_otg_hcd_pipe_info ++ *pipe) ++{ ++ return (pipe->pipe_type == UE_ISOCHRONOUS); ++} ++ ++static inline uint8_t dwc_otg_hcd_is_pipe_int(struct dwc_otg_hcd_pipe_info ++ *pipe) ++{ ++ return (pipe->pipe_type == UE_INTERRUPT); ++} ++ ++static inline uint8_t dwc_otg_hcd_is_pipe_bulk(struct dwc_otg_hcd_pipe_info ++ *pipe) ++{ ++ return (pipe->pipe_type == UE_BULK); ++} ++ ++static inline uint8_t dwc_otg_hcd_is_pipe_control(struct dwc_otg_hcd_pipe_info ++ *pipe) ++{ ++ return (pipe->pipe_type == UE_CONTROL); ++} ++ ++static inline uint8_t dwc_otg_hcd_is_pipe_in(struct dwc_otg_hcd_pipe_info *pipe) ++{ ++ return (pipe->pipe_dir == UE_DIR_IN); ++} ++ ++static inline uint8_t dwc_otg_hcd_is_pipe_out(struct dwc_otg_hcd_pipe_info ++ *pipe) ++{ ++ return (!dwc_otg_hcd_is_pipe_in(pipe)); ++} ++ ++static inline void dwc_otg_hcd_fill_pipe(struct dwc_otg_hcd_pipe_info *pipe, ++ uint8_t devaddr, uint8_t ep_num, ++ uint8_t pipe_type, uint8_t pipe_dir, ++ uint16_t mps) ++{ ++ pipe->dev_addr = devaddr; ++ pipe->ep_num = ep_num; ++ pipe->pipe_type = pipe_type; ++ pipe->pipe_dir = pipe_dir; ++ pipe->mps = mps; ++} ++ ++/** ++ * Phases for control transfers. ++ */ ++typedef enum dwc_otg_control_phase { ++ DWC_OTG_CONTROL_SETUP, ++ DWC_OTG_CONTROL_DATA, ++ DWC_OTG_CONTROL_STATUS ++} dwc_otg_control_phase_e; ++ ++/** Transaction types. */ ++typedef enum dwc_otg_transaction_type { ++ DWC_OTG_TRANSACTION_NONE = 0, ++ DWC_OTG_TRANSACTION_PERIODIC = 1, ++ DWC_OTG_TRANSACTION_NON_PERIODIC = 2, ++ DWC_OTG_TRANSACTION_ALL = DWC_OTG_TRANSACTION_PERIODIC + DWC_OTG_TRANSACTION_NON_PERIODIC ++} dwc_otg_transaction_type_e; ++ ++struct dwc_otg_qh; ++ ++/** ++ * A Queue Transfer Descriptor (QTD) holds the state of a bulk, control, ++ * interrupt, or isochronous transfer. A single QTD is created for each URB ++ * (of one of these types) submitted to the HCD. The transfer associated with ++ * a QTD may require one or multiple transactions. ++ * ++ * A QTD is linked to a Queue Head, which is entered in either the ++ * non-periodic or periodic schedule for execution. When a QTD is chosen for ++ * execution, some or all of its transactions may be executed. After ++ * execution, the state of the QTD is updated. The QTD may be retired if all ++ * its transactions are complete or if an error occurred. Otherwise, it ++ * remains in the schedule so more transactions can be executed later. ++ */ ++typedef struct dwc_otg_qtd { ++ /** ++ * Determines the PID of the next data packet for the data phase of ++ * control transfers. Ignored for other transfer types.<br> ++ * One of the following values: ++ * - DWC_OTG_HC_PID_DATA0 ++ * - DWC_OTG_HC_PID_DATA1 ++ */ ++ uint8_t data_toggle; ++ ++ /** Current phase for control transfers (Setup, Data, or Status). */ ++ dwc_otg_control_phase_e control_phase; ++ ++ /** Keep track of the current split type ++ * for FS/LS endpoints on a HS Hub */ ++ uint8_t complete_split; ++ ++ /** How many bytes transferred during SSPLIT OUT */ ++ uint32_t ssplit_out_xfer_count; ++ ++ /** ++ * Holds the number of bus errors that have occurred for a transaction ++ * within this transfer. ++ */ ++ uint8_t error_count; ++ ++ /** ++ * Index of the next frame descriptor for an isochronous transfer. A ++ * frame descriptor describes the buffer position and length of the ++ * data to be transferred in the next scheduled (micro)frame of an ++ * isochronous transfer. It also holds status for that transaction. ++ * The frame index starts at 0. ++ */ ++ uint16_t isoc_frame_index; ++ ++ /** Position of the ISOC split on full/low speed */ ++ uint8_t isoc_split_pos; ++ ++ /** Position of the ISOC split in the buffer for the current frame */ ++ uint16_t isoc_split_offset; ++ ++ /** URB for this transfer */ ++ struct dwc_otg_hcd_urb *urb; ++ ++ struct dwc_otg_qh *qh; ++ ++ /** This list of QTDs */ ++ DWC_CIRCLEQ_ENTRY(dwc_otg_qtd) qtd_list_entry; ++ ++ /** Indicates if this QTD is currently processed by HW. */ ++ uint8_t in_process; ++ ++ /** Number of DMA descriptors for this QTD */ ++ uint8_t n_desc; ++ ++ /** ++ * Last activated frame(packet) index. ++ * Used in Descriptor DMA mode only. ++ */ ++ uint16_t isoc_frame_index_last; ++ ++} dwc_otg_qtd_t; ++ ++DWC_CIRCLEQ_HEAD(dwc_otg_qtd_list, dwc_otg_qtd); ++ ++/** ++ * A Queue Head (QH) holds the static characteristics of an endpoint and ++ * maintains a list of transfers (QTDs) for that endpoint. A QH structure may ++ * be entered in either the non-periodic or periodic schedule. ++ */ ++typedef struct dwc_otg_qh { ++ /** ++ * Endpoint type. ++ * One of the following values: ++ * - UE_CONTROL ++ * - UE_BULK ++ * - UE_INTERRUPT ++ * - UE_ISOCHRONOUS ++ */ ++ uint8_t ep_type; ++ uint8_t ep_is_in; ++ ++ /** wMaxPacketSize Field of Endpoint Descriptor. */ ++ uint16_t maxp; ++ ++ /** ++ * Device speed. ++ * One of the following values: ++ * - DWC_OTG_EP_SPEED_LOW ++ * - DWC_OTG_EP_SPEED_FULL ++ * - DWC_OTG_EP_SPEED_HIGH ++ */ ++ uint8_t dev_speed; ++ ++ /** ++ * Determines the PID of the next data packet for non-control ++ * transfers. Ignored for control transfers.<br> ++ * One of the following values: ++ * - DWC_OTG_HC_PID_DATA0 ++ * - DWC_OTG_HC_PID_DATA1 ++ */ ++ uint8_t data_toggle; ++ ++ /** Ping state if 1. */ ++ uint8_t ping_state; ++ ++ /** ++ * List of QTDs for this QH. ++ */ ++ struct dwc_otg_qtd_list qtd_list; ++ ++ /** Host channel currently processing transfers for this QH. */ ++ struct dwc_hc *channel; ++ ++ /** Full/low speed endpoint on high-speed hub requires split. */ ++ uint8_t do_split; ++ ++ /** @name Periodic schedule information */ ++ /** @{ */ ++ ++ /** Bandwidth in microseconds per (micro)frame. */ ++ uint16_t usecs; ++ ++ /** Interval between transfers in (micro)frames. */ ++ uint16_t interval; ++ ++ /** ++ * (micro)frame to initialize a periodic transfer. The transfer ++ * executes in the following (micro)frame. ++ */ ++ uint16_t sched_frame; ++ ++ /* ++ ** Frame a NAK was received on this queue head, used to minimise NAK retransmission ++ */ ++ uint16_t nak_frame; ++ ++ /** (micro)frame at which last start split was initialized. */ ++ uint16_t start_split_frame; ++ ++ /** @} */ ++ ++ /** ++ * Used instead of original buffer if ++ * it(physical address) is not dword-aligned. ++ */ ++ uint8_t *dw_align_buf; ++ dwc_dma_t dw_align_buf_dma; ++ ++ /** Entry for QH in either the periodic or non-periodic schedule. */ ++ dwc_list_link_t qh_list_entry; ++ ++ /** @name Descriptor DMA support */ ++ /** @{ */ ++ ++ /** Descriptor List. */ ++ dwc_otg_host_dma_desc_t *desc_list; ++ ++ /** Descriptor List physical address. */ ++ dwc_dma_t desc_list_dma; ++ ++ /** ++ * Xfer Bytes array. ++ * Each element corresponds to a descriptor and indicates ++ * original XferSize size value for the descriptor. ++ */ ++ uint32_t *n_bytes; ++ ++ /** Actual number of transfer descriptors in a list. */ ++ uint16_t ntd; ++ ++ /** First activated isochronous transfer descriptor index. */ ++ uint8_t td_first; ++ /** Last activated isochronous transfer descriptor index. */ ++ uint8_t td_last; ++ ++ /** @} */ ++ ++ ++ uint16_t speed; ++ uint16_t frame_usecs[8]; ++ ++ uint32_t skip_count; ++} dwc_otg_qh_t; ++ ++DWC_CIRCLEQ_HEAD(hc_list, dwc_hc); ++ ++typedef struct urb_tq_entry { ++ struct urb *urb; ++ DWC_TAILQ_ENTRY(urb_tq_entry) urb_tq_entries; ++} urb_tq_entry_t; ++ ++DWC_TAILQ_HEAD(urb_list, urb_tq_entry); ++ ++/** ++ * This structure holds the state of the HCD, including the non-periodic and ++ * periodic schedules. ++ */ ++struct dwc_otg_hcd { ++ /** The DWC otg device pointer */ ++ struct dwc_otg_device *otg_dev; ++ /** DWC OTG Core Interface Layer */ ++ dwc_otg_core_if_t *core_if; ++ ++ /** Function HCD driver callbacks */ ++ struct dwc_otg_hcd_function_ops *fops; ++ ++ /** Internal DWC HCD Flags */ ++ volatile union dwc_otg_hcd_internal_flags { ++ uint32_t d32; ++ struct { ++ unsigned port_connect_status_change:1; ++ unsigned port_connect_status:1; ++ unsigned port_reset_change:1; ++ unsigned port_enable_change:1; ++ unsigned port_suspend_change:1; ++ unsigned port_over_current_change:1; ++ unsigned port_l1_change:1; ++ unsigned reserved:26; ++ } b; ++ } flags; ++ ++ /** ++ * Inactive items in the non-periodic schedule. This is a list of ++ * Queue Heads. Transfers associated with these Queue Heads are not ++ * currently assigned to a host channel. ++ */ ++ dwc_list_link_t non_periodic_sched_inactive; ++ ++ /** ++ * Active items in the non-periodic schedule. This is a list of ++ * Queue Heads. Transfers associated with these Queue Heads are ++ * currently assigned to a host channel. ++ */ ++ dwc_list_link_t non_periodic_sched_active; ++ ++ /** ++ * Pointer to the next Queue Head to process in the active ++ * non-periodic schedule. ++ */ ++ dwc_list_link_t *non_periodic_qh_ptr; ++ ++ /** ++ * Inactive items in the periodic schedule. This is a list of QHs for ++ * periodic transfers that are _not_ scheduled for the next frame. ++ * Each QH in the list has an interval counter that determines when it ++ * needs to be scheduled for execution. This scheduling mechanism ++ * allows only a simple calculation for periodic bandwidth used (i.e. ++ * must assume that all periodic transfers may need to execute in the ++ * same frame). However, it greatly simplifies scheduling and should ++ * be sufficient for the vast majority of OTG hosts, which need to ++ * connect to a small number of peripherals at one time. ++ * ++ * Items move from this list to periodic_sched_ready when the QH ++ * interval counter is 0 at SOF. ++ */ ++ dwc_list_link_t periodic_sched_inactive; ++ ++ /** ++ * List of periodic QHs that are ready for execution in the next ++ * frame, but have not yet been assigned to host channels. ++ * ++ * Items move from this list to periodic_sched_assigned as host ++ * channels become available during the current frame. ++ */ ++ dwc_list_link_t periodic_sched_ready; ++ ++ /** ++ * List of periodic QHs to be executed in the next frame that are ++ * assigned to host channels. ++ * ++ * Items move from this list to periodic_sched_queued as the ++ * transactions for the QH are queued to the DWC_otg controller. ++ */ ++ dwc_list_link_t periodic_sched_assigned; ++ ++ /** ++ * List of periodic QHs that have been queued for execution. ++ * ++ * Items move from this list to either periodic_sched_inactive or ++ * periodic_sched_ready when the channel associated with the transfer ++ * is released. If the interval for the QH is 1, the item moves to ++ * periodic_sched_ready because it must be rescheduled for the next ++ * frame. Otherwise, the item moves to periodic_sched_inactive. ++ */ ++ dwc_list_link_t periodic_sched_queued; ++ ++ /** ++ * Total bandwidth claimed so far for periodic transfers. This value ++ * is in microseconds per (micro)frame. The assumption is that all ++ * periodic transfers may occur in the same (micro)frame. ++ */ ++ uint16_t periodic_usecs; ++ ++ /** ++ * Total bandwidth claimed so far for all periodic transfers ++ * in a frame. ++ * This will include a mixture of HS and FS transfers. ++ * Units are microseconds per (micro)frame. ++ * We have a budget per frame and have to schedule ++ * transactions accordingly. ++ * Watch out for the fact that things are actually scheduled for the ++ * "next frame". ++ */ ++ uint16_t frame_usecs[8]; ++ ++ ++ /** ++ * Frame number read from the core at SOF. The value ranges from 0 to ++ * DWC_HFNUM_MAX_FRNUM. ++ */ ++ uint16_t frame_number; ++ ++ /** ++ * Count of periodic QHs, if using several eps. For SOF enable/disable. ++ */ ++ uint16_t periodic_qh_count; ++ ++ /** ++ * Free host channels in the controller. This is a list of ++ * dwc_hc_t items. ++ */ ++ struct hc_list free_hc_list; ++ /** ++ * Number of host channels assigned to periodic transfers. Currently ++ * assuming that there is a dedicated host channel for each periodic ++ * transaction and at least one host channel available for ++ * non-periodic transactions. ++ */ ++ int periodic_channels; /* microframe_schedule==0 */ ++ ++ /** ++ * Number of host channels assigned to non-periodic transfers. ++ */ ++ int non_periodic_channels; /* microframe_schedule==0 */ ++ ++ /** ++ * Number of host channels assigned to non-periodic transfers. ++ */ ++ int available_host_channels; ++ ++ /** ++ * Array of pointers to the host channel descriptors. Allows accessing ++ * a host channel descriptor given the host channel number. This is ++ * useful in interrupt handlers. ++ */ ++ struct dwc_hc *hc_ptr_array[MAX_EPS_CHANNELS]; ++ ++ /** ++ * Buffer to use for any data received during the status phase of a ++ * control transfer. Normally no data is transferred during the status ++ * phase. This buffer is used as a bit bucket. ++ */ ++ uint8_t *status_buf; ++ ++ /** ++ * DMA address for status_buf. ++ */ ++ dma_addr_t status_buf_dma; ++#define DWC_OTG_HCD_STATUS_BUF_SIZE 64 ++ ++ /** ++ * Connection timer. An OTG host must display a message if the device ++ * does not connect. Started when the VBus power is turned on via ++ * sysfs attribute "buspower". ++ */ ++ dwc_timer_t *conn_timer; ++ ++ /* Tasket to do a reset */ ++ dwc_tasklet_t *reset_tasklet; ++ ++ dwc_tasklet_t *completion_tasklet; ++ struct urb_list completed_urb_list; ++ ++ /* */ ++ dwc_spinlock_t *lock; ++ dwc_spinlock_t *channel_lock; ++ /** ++ * Private data that could be used by OS wrapper. ++ */ ++ void *priv; ++ ++ uint8_t otg_port; ++ ++ /** Frame List */ ++ uint32_t *frame_list; ++ ++ /** Hub - Port assignment */ ++ int hub_port[128]; ++#ifdef FIQ_DEBUG ++ int hub_port_alloc[2048]; ++#endif ++ ++ /** Frame List DMA address */ ++ dma_addr_t frame_list_dma; ++ ++ struct fiq_stack *fiq_stack; ++ struct fiq_state *fiq_state; ++ ++ /** Virtual address for split transaction DMA bounce buffers */ ++ struct fiq_dma_blob *fiq_dmab; ++ ++#ifdef DEBUG ++ uint32_t frrem_samples; ++ uint64_t frrem_accum; ++ ++ uint32_t hfnum_7_samples_a; ++ uint64_t hfnum_7_frrem_accum_a; ++ uint32_t hfnum_0_samples_a; ++ uint64_t hfnum_0_frrem_accum_a; ++ uint32_t hfnum_other_samples_a; ++ uint64_t hfnum_other_frrem_accum_a; ++ ++ uint32_t hfnum_7_samples_b; ++ uint64_t hfnum_7_frrem_accum_b; ++ uint32_t hfnum_0_samples_b; ++ uint64_t hfnum_0_frrem_accum_b; ++ uint32_t hfnum_other_samples_b; ++ uint64_t hfnum_other_frrem_accum_b; ++#endif ++}; ++ ++/** @name Transaction Execution Functions */ ++/** @{ */ ++extern dwc_otg_transaction_type_e dwc_otg_hcd_select_transactions(dwc_otg_hcd_t ++ * hcd); ++extern void dwc_otg_hcd_queue_transactions(dwc_otg_hcd_t * hcd, ++ dwc_otg_transaction_type_e tr_type); ++ ++int dwc_otg_hcd_allocate_port(dwc_otg_hcd_t * hcd, dwc_otg_qh_t *qh); ++void dwc_otg_hcd_release_port(dwc_otg_hcd_t * dwc_otg_hcd, dwc_otg_qh_t *qh); ++ ++extern int fiq_fsm_queue_transaction(dwc_otg_hcd_t *hcd, dwc_otg_qh_t *qh); ++extern int fiq_fsm_transaction_suitable(dwc_otg_qh_t *qh); ++extern void dwc_otg_cleanup_fiq_channel(dwc_otg_hcd_t *hcd, uint32_t num); ++ ++/** @} */ ++ ++/** @name Interrupt Handler Functions */ ++/** @{ */ ++extern int32_t dwc_otg_hcd_handle_intr(dwc_otg_hcd_t * dwc_otg_hcd); ++extern int32_t dwc_otg_hcd_handle_sof_intr(dwc_otg_hcd_t * dwc_otg_hcd); ++extern int32_t dwc_otg_hcd_handle_rx_status_q_level_intr(dwc_otg_hcd_t * ++ dwc_otg_hcd); ++extern int32_t dwc_otg_hcd_handle_np_tx_fifo_empty_intr(dwc_otg_hcd_t * ++ dwc_otg_hcd); ++extern int32_t dwc_otg_hcd_handle_perio_tx_fifo_empty_intr(dwc_otg_hcd_t * ++ dwc_otg_hcd); ++extern int32_t dwc_otg_hcd_handle_incomplete_periodic_intr(dwc_otg_hcd_t * ++ dwc_otg_hcd); ++extern int32_t dwc_otg_hcd_handle_port_intr(dwc_otg_hcd_t * dwc_otg_hcd); ++extern int32_t dwc_otg_hcd_handle_conn_id_status_change_intr(dwc_otg_hcd_t * ++ dwc_otg_hcd); ++extern int32_t dwc_otg_hcd_handle_disconnect_intr(dwc_otg_hcd_t * dwc_otg_hcd); ++extern int32_t dwc_otg_hcd_handle_hc_intr(dwc_otg_hcd_t * dwc_otg_hcd); ++extern int32_t dwc_otg_hcd_handle_hc_n_intr(dwc_otg_hcd_t * dwc_otg_hcd, ++ uint32_t num); ++extern int32_t dwc_otg_hcd_handle_session_req_intr(dwc_otg_hcd_t * dwc_otg_hcd); ++extern int32_t dwc_otg_hcd_handle_wakeup_detected_intr(dwc_otg_hcd_t * ++ dwc_otg_hcd); ++/** @} */ ++ ++/** @name Schedule Queue Functions */ ++/** @{ */ ++ ++/* Implemented in dwc_otg_hcd_queue.c */ ++extern dwc_otg_qh_t *dwc_otg_hcd_qh_create(dwc_otg_hcd_t * hcd, ++ dwc_otg_hcd_urb_t * urb, int atomic_alloc); ++extern void dwc_otg_hcd_qh_free(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh); ++extern int dwc_otg_hcd_qh_add(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh); ++extern void dwc_otg_hcd_qh_remove(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh); ++extern void dwc_otg_hcd_qh_deactivate(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh, ++ int sched_csplit); ++ ++/** Remove and free a QH */ ++static inline void dwc_otg_hcd_qh_remove_and_free(dwc_otg_hcd_t * hcd, ++ dwc_otg_qh_t * qh) ++{ ++ dwc_irqflags_t flags; ++ DWC_SPINLOCK_IRQSAVE(hcd->lock, &flags); ++ dwc_otg_hcd_qh_remove(hcd, qh); ++ DWC_SPINUNLOCK_IRQRESTORE(hcd->lock, flags); ++ dwc_otg_hcd_qh_free(hcd, qh); ++} ++ ++/** Allocates memory for a QH structure. ++ * @return Returns the memory allocate or NULL on error. */ ++static inline dwc_otg_qh_t *dwc_otg_hcd_qh_alloc(int atomic_alloc) ++{ ++ if (atomic_alloc) ++ return (dwc_otg_qh_t *) DWC_ALLOC_ATOMIC(sizeof(dwc_otg_qh_t)); ++ else ++ return (dwc_otg_qh_t *) DWC_ALLOC(sizeof(dwc_otg_qh_t)); ++} ++ ++extern dwc_otg_qtd_t *dwc_otg_hcd_qtd_create(dwc_otg_hcd_urb_t * urb, ++ int atomic_alloc); ++extern void dwc_otg_hcd_qtd_init(dwc_otg_qtd_t * qtd, dwc_otg_hcd_urb_t * urb); ++extern int dwc_otg_hcd_qtd_add(dwc_otg_qtd_t * qtd, dwc_otg_hcd_t * dwc_otg_hcd, ++ dwc_otg_qh_t ** qh, int atomic_alloc); ++ ++/** Allocates memory for a QTD structure. ++ * @return Returns the memory allocate or NULL on error. */ ++static inline dwc_otg_qtd_t *dwc_otg_hcd_qtd_alloc(int atomic_alloc) ++{ ++ if (atomic_alloc) ++ return (dwc_otg_qtd_t *) DWC_ALLOC_ATOMIC(sizeof(dwc_otg_qtd_t)); ++ else ++ return (dwc_otg_qtd_t *) DWC_ALLOC(sizeof(dwc_otg_qtd_t)); ++} ++ ++/** Frees the memory for a QTD structure. QTD should already be removed from ++ * list. ++ * @param qtd QTD to free.*/ ++static inline void dwc_otg_hcd_qtd_free(dwc_otg_qtd_t * qtd) ++{ ++ DWC_FREE(qtd); ++} ++ ++/** Removes a QTD from list. ++ * @param hcd HCD instance. ++ * @param qtd QTD to remove from list. ++ * @param qh QTD belongs to. ++ */ ++static inline void dwc_otg_hcd_qtd_remove(dwc_otg_hcd_t * hcd, ++ dwc_otg_qtd_t * qtd, ++ dwc_otg_qh_t * qh) ++{ ++ DWC_CIRCLEQ_REMOVE(&qh->qtd_list, qtd, qtd_list_entry); ++} ++ ++/** Remove and free a QTD ++ * Need to disable IRQ and hold hcd lock while calling this function out of ++ * interrupt servicing chain */ ++static inline void dwc_otg_hcd_qtd_remove_and_free(dwc_otg_hcd_t * hcd, ++ dwc_otg_qtd_t * qtd, ++ dwc_otg_qh_t * qh) ++{ ++ dwc_otg_hcd_qtd_remove(hcd, qtd, qh); ++ dwc_otg_hcd_qtd_free(qtd); ++} ++ ++/** @} */ ++ ++/** @name Descriptor DMA Supporting Functions */ ++/** @{ */ ++ ++extern void dwc_otg_hcd_start_xfer_ddma(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh); ++extern void dwc_otg_hcd_complete_xfer_ddma(dwc_otg_hcd_t * hcd, ++ dwc_hc_t * hc, ++ dwc_otg_hc_regs_t * hc_regs, ++ dwc_otg_halt_status_e halt_status); ++ ++extern int dwc_otg_hcd_qh_init_ddma(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh); ++extern void dwc_otg_hcd_qh_free_ddma(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh); ++ ++/** @} */ ++ ++/** @name Internal Functions */ ++/** @{ */ ++dwc_otg_qh_t *dwc_urb_to_qh(dwc_otg_hcd_urb_t * urb); ++/** @} */ ++ ++#ifdef CONFIG_USB_DWC_OTG_LPM ++extern int dwc_otg_hcd_get_hc_for_lpm_tran(dwc_otg_hcd_t * hcd, ++ uint8_t devaddr); ++extern void dwc_otg_hcd_free_hc_from_lpm(dwc_otg_hcd_t * hcd); ++#endif ++ ++/** Gets the QH that contains the list_head */ ++#define dwc_list_to_qh(_list_head_ptr_) container_of(_list_head_ptr_, dwc_otg_qh_t, qh_list_entry) ++ ++/** Gets the QTD that contains the list_head */ ++#define dwc_list_to_qtd(_list_head_ptr_) container_of(_list_head_ptr_, dwc_otg_qtd_t, qtd_list_entry) ++ ++/** Check if QH is non-periodic */ ++#define dwc_qh_is_non_per(_qh_ptr_) ((_qh_ptr_->ep_type == UE_BULK) || \ ++ (_qh_ptr_->ep_type == UE_CONTROL)) ++ ++/** High bandwidth multiplier as encoded in highspeed endpoint descriptors */ ++#define dwc_hb_mult(wMaxPacketSize) (1 + (((wMaxPacketSize) >> 11) & 0x03)) ++ ++/** Packet size for any kind of endpoint descriptor */ ++#define dwc_max_packet(wMaxPacketSize) ((wMaxPacketSize) & 0x07ff) ++ ++/** ++ * Returns true if _frame1 is less than or equal to _frame2. The comparison is ++ * done modulo DWC_HFNUM_MAX_FRNUM. This accounts for the rollover of the ++ * frame number when the max frame number is reached. ++ */ ++static inline int dwc_frame_num_le(uint16_t frame1, uint16_t frame2) ++{ ++ return ((frame2 - frame1) & DWC_HFNUM_MAX_FRNUM) <= ++ (DWC_HFNUM_MAX_FRNUM >> 1); ++} ++ ++/** ++ * Returns true if _frame1 is greater than _frame2. The comparison is done ++ * modulo DWC_HFNUM_MAX_FRNUM. This accounts for the rollover of the frame ++ * number when the max frame number is reached. ++ */ ++static inline int dwc_frame_num_gt(uint16_t frame1, uint16_t frame2) ++{ ++ return (frame1 != frame2) && ++ (((frame1 - frame2) & DWC_HFNUM_MAX_FRNUM) < ++ (DWC_HFNUM_MAX_FRNUM >> 1)); ++} ++ ++/** ++ * Increments _frame by the amount specified by _inc. The addition is done ++ * modulo DWC_HFNUM_MAX_FRNUM. Returns the incremented value. ++ */ ++static inline uint16_t dwc_frame_num_inc(uint16_t frame, uint16_t inc) ++{ ++ return (frame + inc) & DWC_HFNUM_MAX_FRNUM; ++} ++ ++static inline uint16_t dwc_full_frame_num(uint16_t frame) ++{ ++ return (frame & DWC_HFNUM_MAX_FRNUM) >> 3; ++} ++ ++static inline uint16_t dwc_micro_frame_num(uint16_t frame) ++{ ++ return frame & 0x7; ++} ++ ++void dwc_otg_hcd_save_data_toggle(dwc_hc_t * hc, ++ dwc_otg_hc_regs_t * hc_regs, ++ dwc_otg_qtd_t * qtd); ++ ++#ifdef DEBUG ++/** ++ * Macro to sample the remaining PHY clocks left in the current frame. This ++ * may be used during debugging to determine the average time it takes to ++ * execute sections of code. There are two possible sample points, "a" and ++ * "b", so the _letter argument must be one of these values. ++ * ++ * To dump the average sample times, read the "hcd_frrem" sysfs attribute. For ++ * example, "cat /sys/devices/lm0/hcd_frrem". ++ */ ++#define dwc_sample_frrem(_hcd, _qh, _letter) \ ++{ \ ++ hfnum_data_t hfnum; \ ++ dwc_otg_qtd_t *qtd; \ ++ qtd = list_entry(_qh->qtd_list.next, dwc_otg_qtd_t, qtd_list_entry); \ ++ if (usb_pipeint(qtd->urb->pipe) && _qh->start_split_frame != 0 && !qtd->complete_split) { \ ++ hfnum.d32 = DWC_READ_REG32(&_hcd->core_if->host_if->host_global_regs->hfnum); \ ++ switch (hfnum.b.frnum & 0x7) { \ ++ case 7: \ ++ _hcd->hfnum_7_samples_##_letter++; \ ++ _hcd->hfnum_7_frrem_accum_##_letter += hfnum.b.frrem; \ ++ break; \ ++ case 0: \ ++ _hcd->hfnum_0_samples_##_letter++; \ ++ _hcd->hfnum_0_frrem_accum_##_letter += hfnum.b.frrem; \ ++ break; \ ++ default: \ ++ _hcd->hfnum_other_samples_##_letter++; \ ++ _hcd->hfnum_other_frrem_accum_##_letter += hfnum.b.frrem; \ ++ break; \ ++ } \ ++ } \ ++} ++#else ++#define dwc_sample_frrem(_hcd, _qh, _letter) ++#endif ++#endif ++#endif /* DWC_DEVICE_ONLY */ +diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd_ddma.c b/drivers/usb/host/dwc_otg/dwc_otg_hcd_ddma.c +new file mode 100644 +index 0000000..ee920c4 +--- /dev/null ++++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd_ddma.c +@@ -0,0 +1,1132 @@ ++/*========================================================================== ++ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_hcd_ddma.c $ ++ * $Revision: #10 $ ++ * $Date: 2011/10/20 $ ++ * $Change: 1869464 $ ++ * ++ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, ++ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless ++ * otherwise expressly agreed to in writing between Synopsys and you. ++ * ++ * The Software IS NOT an item of Licensed Software or Licensed Product under ++ * any End User Software License Agreement or Agreement for Licensed Product ++ * with Synopsys or any supplement thereto. You are permitted to use and ++ * redistribute this Software in source and binary forms, with or without ++ * modification, provided that redistributions of source code must retain this ++ * notice. You may not view, use, disclose, copy or distribute this file or ++ * any information contained herein except pursuant to this license grant from ++ * Synopsys. If you do not agree with this notice, including the disclaimer ++ * below, then you are not authorized to use the Software. ++ * ++ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS ++ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS 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. ++ * ========================================================================== */ ++#ifndef DWC_DEVICE_ONLY ++ ++/** @file ++ * This file contains Descriptor DMA support implementation for host mode. ++ */ ++ ++#include "dwc_otg_hcd.h" ++#include "dwc_otg_regs.h" ++ ++extern bool microframe_schedule; ++ ++static inline uint8_t frame_list_idx(uint16_t frame) ++{ ++ return (frame & (MAX_FRLIST_EN_NUM - 1)); ++} ++ ++static inline uint16_t desclist_idx_inc(uint16_t idx, uint16_t inc, uint8_t speed) ++{ ++ return (idx + inc) & ++ (((speed == ++ DWC_OTG_EP_SPEED_HIGH) ? MAX_DMA_DESC_NUM_HS_ISOC : ++ MAX_DMA_DESC_NUM_GENERIC) - 1); ++} ++ ++static inline uint16_t desclist_idx_dec(uint16_t idx, uint16_t inc, uint8_t speed) ++{ ++ return (idx - inc) & ++ (((speed == ++ DWC_OTG_EP_SPEED_HIGH) ? MAX_DMA_DESC_NUM_HS_ISOC : ++ MAX_DMA_DESC_NUM_GENERIC) - 1); ++} ++ ++static inline uint16_t max_desc_num(dwc_otg_qh_t * qh) ++{ ++ return (((qh->ep_type == UE_ISOCHRONOUS) ++ && (qh->dev_speed == DWC_OTG_EP_SPEED_HIGH)) ++ ? MAX_DMA_DESC_NUM_HS_ISOC : MAX_DMA_DESC_NUM_GENERIC); ++} ++static inline uint16_t frame_incr_val(dwc_otg_qh_t * qh) ++{ ++ return ((qh->dev_speed == DWC_OTG_EP_SPEED_HIGH) ++ ? ((qh->interval + 8 - 1) / 8) ++ : qh->interval); ++} ++ ++static int desc_list_alloc(dwc_otg_qh_t * qh) ++{ ++ int retval = 0; ++ ++ qh->desc_list = (dwc_otg_host_dma_desc_t *) ++ DWC_DMA_ALLOC(sizeof(dwc_otg_host_dma_desc_t) * max_desc_num(qh), ++ &qh->desc_list_dma); ++ ++ if (!qh->desc_list) { ++ retval = -DWC_E_NO_MEMORY; ++ DWC_ERROR("%s: DMA descriptor list allocation failed\n", __func__); ++ ++ } ++ ++ dwc_memset(qh->desc_list, 0x00, ++ sizeof(dwc_otg_host_dma_desc_t) * max_desc_num(qh)); ++ ++ qh->n_bytes = ++ (uint32_t *) DWC_ALLOC(sizeof(uint32_t) * max_desc_num(qh)); ++ ++ if (!qh->n_bytes) { ++ retval = -DWC_E_NO_MEMORY; ++ DWC_ERROR ++ ("%s: Failed to allocate array for descriptors' size actual values\n", ++ __func__); ++ ++ } ++ return retval; ++ ++} ++ ++static void desc_list_free(dwc_otg_qh_t * qh) ++{ ++ if (qh->desc_list) { ++ DWC_DMA_FREE(max_desc_num(qh), qh->desc_list, ++ qh->desc_list_dma); ++ qh->desc_list = NULL; ++ } ++ ++ if (qh->n_bytes) { ++ DWC_FREE(qh->n_bytes); ++ qh->n_bytes = NULL; ++ } ++} ++ ++static int frame_list_alloc(dwc_otg_hcd_t * hcd) ++{ ++ int retval = 0; ++ if (hcd->frame_list) ++ return 0; ++ ++ hcd->frame_list = DWC_DMA_ALLOC(4 * MAX_FRLIST_EN_NUM, ++ &hcd->frame_list_dma); ++ if (!hcd->frame_list) { ++ retval = -DWC_E_NO_MEMORY; ++ DWC_ERROR("%s: Frame List allocation failed\n", __func__); ++ } ++ ++ dwc_memset(hcd->frame_list, 0x00, 4 * MAX_FRLIST_EN_NUM); ++ ++ return retval; ++} ++ ++static void frame_list_free(dwc_otg_hcd_t * hcd) ++{ ++ if (!hcd->frame_list) ++ return; ++ ++ DWC_DMA_FREE(4 * MAX_FRLIST_EN_NUM, hcd->frame_list, hcd->frame_list_dma); ++ hcd->frame_list = NULL; ++} ++ ++static void per_sched_enable(dwc_otg_hcd_t * hcd, uint16_t fr_list_en) ++{ ++ ++ hcfg_data_t hcfg; ++ ++ hcfg.d32 = DWC_READ_REG32(&hcd->core_if->host_if->host_global_regs->hcfg); ++ ++ if (hcfg.b.perschedena) { ++ /* already enabled */ ++ return; ++ } ++ ++ DWC_WRITE_REG32(&hcd->core_if->host_if->host_global_regs->hflbaddr, ++ hcd->frame_list_dma); ++ ++ switch (fr_list_en) { ++ case 64: ++ hcfg.b.frlisten = 3; ++ break; ++ case 32: ++ hcfg.b.frlisten = 2; ++ break; ++ case 16: ++ hcfg.b.frlisten = 1; ++ break; ++ case 8: ++ hcfg.b.frlisten = 0; ++ break; ++ default: ++ break; ++ } ++ ++ hcfg.b.perschedena = 1; ++ ++ DWC_DEBUGPL(DBG_HCD, "Enabling Periodic schedule\n"); ++ DWC_WRITE_REG32(&hcd->core_if->host_if->host_global_regs->hcfg, hcfg.d32); ++ ++} ++ ++static void per_sched_disable(dwc_otg_hcd_t * hcd) ++{ ++ hcfg_data_t hcfg; ++ ++ hcfg.d32 = DWC_READ_REG32(&hcd->core_if->host_if->host_global_regs->hcfg); ++ ++ if (!hcfg.b.perschedena) { ++ /* already disabled */ ++ return; ++ } ++ hcfg.b.perschedena = 0; ++ ++ DWC_DEBUGPL(DBG_HCD, "Disabling Periodic schedule\n"); ++ DWC_WRITE_REG32(&hcd->core_if->host_if->host_global_regs->hcfg, hcfg.d32); ++} ++ ++/* ++ * Activates/Deactivates FrameList entries for the channel ++ * based on endpoint servicing period. ++ */ ++void update_frame_list(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh, uint8_t enable) ++{ ++ uint16_t i, j, inc; ++ dwc_hc_t *hc = NULL; ++ ++ if (!qh->channel) { ++ DWC_ERROR("qh->channel = %p", qh->channel); ++ return; ++ } ++ ++ if (!hcd) { ++ DWC_ERROR("------hcd = %p", hcd); ++ return; ++ } ++ ++ if (!hcd->frame_list) { ++ DWC_ERROR("-------hcd->frame_list = %p", hcd->frame_list); ++ return; ++ } ++ ++ hc = qh->channel; ++ inc = frame_incr_val(qh); ++ if (qh->ep_type == UE_ISOCHRONOUS) ++ i = frame_list_idx(qh->sched_frame); ++ else ++ i = 0; ++ ++ j = i; ++ do { ++ if (enable) ++ hcd->frame_list[j] |= (1 << hc->hc_num); ++ else ++ hcd->frame_list[j] &= ~(1 << hc->hc_num); ++ j = (j + inc) & (MAX_FRLIST_EN_NUM - 1); ++ } ++ while (j != i); ++ if (!enable) ++ return; ++ hc->schinfo = 0; ++ if (qh->channel->speed == DWC_OTG_EP_SPEED_HIGH) { ++ j = 1; ++ /* TODO - check this */ ++ inc = (8 + qh->interval - 1) / qh->interval; ++ for (i = 0; i < inc; i++) { ++ hc->schinfo |= j; ++ j = j << qh->interval; ++ } ++ } else { ++ hc->schinfo = 0xff; ++ } ++} ++ ++#if 1 ++void dump_frame_list(dwc_otg_hcd_t * hcd) ++{ ++ int i = 0; ++ DWC_PRINTF("--FRAME LIST (hex) --\n"); ++ for (i = 0; i < MAX_FRLIST_EN_NUM; i++) { ++ DWC_PRINTF("%x\t", hcd->frame_list[i]); ++ if (!(i % 8) && i) ++ DWC_PRINTF("\n"); ++ } ++ DWC_PRINTF("\n----\n"); ++ ++} ++#endif ++ ++static void release_channel_ddma(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh) ++{ ++ dwc_irqflags_t flags; ++ dwc_spinlock_t *channel_lock = hcd->channel_lock; ++ ++ dwc_hc_t *hc = qh->channel; ++ if (dwc_qh_is_non_per(qh)) { ++ DWC_SPINLOCK_IRQSAVE(channel_lock, &flags); ++ if (!microframe_schedule) ++ hcd->non_periodic_channels--; ++ else ++ hcd->available_host_channels++; ++ DWC_SPINUNLOCK_IRQRESTORE(channel_lock, flags); ++ } else ++ update_frame_list(hcd, qh, 0); ++ ++ /* ++ * The condition is added to prevent double cleanup try in case of device ++ * disconnect. See channel cleanup in dwc_otg_hcd_disconnect_cb(). ++ */ ++ if (hc->qh) { ++ dwc_otg_hc_cleanup(hcd->core_if, hc); ++ DWC_CIRCLEQ_INSERT_TAIL(&hcd->free_hc_list, hc, hc_list_entry); ++ hc->qh = NULL; ++ } ++ ++ qh->channel = NULL; ++ qh->ntd = 0; ++ ++ if (qh->desc_list) { ++ dwc_memset(qh->desc_list, 0x00, ++ sizeof(dwc_otg_host_dma_desc_t) * max_desc_num(qh)); ++ } ++} ++ ++/** ++ * Initializes a QH structure's Descriptor DMA related members. ++ * Allocates memory for descriptor list. ++ * On first periodic QH, allocates memory for FrameList ++ * and enables periodic scheduling. ++ * ++ * @param hcd The HCD state structure for the DWC OTG controller. ++ * @param qh The QH to init. ++ * ++ * @return 0 if successful, negative error code otherwise. ++ */ ++int dwc_otg_hcd_qh_init_ddma(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh) ++{ ++ int retval = 0; ++ ++ if (qh->do_split) { ++ DWC_ERROR("SPLIT Transfers are not supported in Descriptor DMA.\n"); ++ return -1; ++ } ++ ++ retval = desc_list_alloc(qh); ++ ++ if ((retval == 0) ++ && (qh->ep_type == UE_ISOCHRONOUS || qh->ep_type == UE_INTERRUPT)) { ++ if (!hcd->frame_list) { ++ retval = frame_list_alloc(hcd); ++ /* Enable periodic schedule on first periodic QH */ ++ if (retval == 0) ++ per_sched_enable(hcd, MAX_FRLIST_EN_NUM); ++ } ++ } ++ ++ qh->ntd = 0; ++ ++ return retval; ++} ++ ++/** ++ * Frees descriptor list memory associated with the QH. ++ * If QH is periodic and the last, frees FrameList memory ++ * and disables periodic scheduling. ++ * ++ * @param hcd The HCD state structure for the DWC OTG controller. ++ * @param qh The QH to init. ++ */ ++void dwc_otg_hcd_qh_free_ddma(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh) ++{ ++ desc_list_free(qh); ++ ++ /* ++ * Channel still assigned due to some reasons. ++ * Seen on Isoc URB dequeue. Channel halted but no subsequent ++ * ChHalted interrupt to release the channel. Afterwards ++ * when it comes here from endpoint disable routine ++ * channel remains assigned. ++ */ ++ if (qh->channel) ++ release_channel_ddma(hcd, qh); ++ ++ if ((qh->ep_type == UE_ISOCHRONOUS || qh->ep_type == UE_INTERRUPT) ++ && (microframe_schedule || !hcd->periodic_channels) && hcd->frame_list) { ++ ++ per_sched_disable(hcd); ++ frame_list_free(hcd); ++ } ++} ++ ++static uint8_t frame_to_desc_idx(dwc_otg_qh_t * qh, uint16_t frame_idx) ++{ ++ if (qh->dev_speed == DWC_OTG_EP_SPEED_HIGH) { ++ /* ++ * Descriptor set(8 descriptors) index ++ * which is 8-aligned. ++ */ ++ return (frame_idx & ((MAX_DMA_DESC_NUM_HS_ISOC / 8) - 1)) * 8; ++ } else { ++ return (frame_idx & (MAX_DMA_DESC_NUM_GENERIC - 1)); ++ } ++} ++ ++/* ++ * Determine starting frame for Isochronous transfer. ++ * Few frames skipped to prevent race condition with HC. ++ */ ++static uint8_t calc_starting_frame(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh, ++ uint8_t * skip_frames) ++{ ++ uint16_t frame = 0; ++ hcd->frame_number = dwc_otg_hcd_get_frame_number(hcd); ++ ++ /* sched_frame is always frame number(not uFrame) both in FS and HS !! */ ++ ++ /* ++ * skip_frames is used to limit activated descriptors number ++ * to avoid the situation when HC services the last activated ++ * descriptor firstly. ++ * Example for FS: ++ * Current frame is 1, scheduled frame is 3. Since HC always fetches the descriptor ++ * corresponding to curr_frame+1, the descriptor corresponding to frame 2 ++ * will be fetched. If the number of descriptors is max=64 (or greather) the ++ * list will be fully programmed with Active descriptors and it is possible ++ * case(rare) that the latest descriptor(considering rollback) corresponding ++ * to frame 2 will be serviced first. HS case is more probable because, in fact, ++ * up to 11 uframes(16 in the code) may be skipped. ++ */ ++ if (qh->dev_speed == DWC_OTG_EP_SPEED_HIGH) { ++ /* ++ * Consider uframe counter also, to start xfer asap. ++ * If half of the frame elapsed skip 2 frames otherwise ++ * just 1 frame. ++ * Starting descriptor index must be 8-aligned, so ++ * if the current frame is near to complete the next one ++ * is skipped as well. ++ */ ++ ++ if (dwc_micro_frame_num(hcd->frame_number) >= 5) { ++ *skip_frames = 2 * 8; ++ frame = dwc_frame_num_inc(hcd->frame_number, *skip_frames); ++ } else { ++ *skip_frames = 1 * 8; ++ frame = dwc_frame_num_inc(hcd->frame_number, *skip_frames); ++ } ++ ++ frame = dwc_full_frame_num(frame); ++ } else { ++ /* ++ * Two frames are skipped for FS - the current and the next. ++ * But for descriptor programming, 1 frame(descriptor) is enough, ++ * see example above. ++ */ ++ *skip_frames = 1; ++ frame = dwc_frame_num_inc(hcd->frame_number, 2); ++ } ++ ++ return frame; ++} ++ ++/* ++ * Calculate initial descriptor index for isochronous transfer ++ * based on scheduled frame. ++ */ ++static uint8_t recalc_initial_desc_idx(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh) ++{ ++ uint16_t frame = 0, fr_idx, fr_idx_tmp; ++ uint8_t skip_frames = 0; ++ /* ++ * With current ISOC processing algorithm the channel is being ++ * released when no more QTDs in the list(qh->ntd == 0). ++ * Thus this function is called only when qh->ntd == 0 and qh->channel == 0. ++ * ++ * So qh->channel != NULL branch is not used and just not removed from the ++ * source file. It is required for another possible approach which is, ++ * do not disable and release the channel when ISOC session completed, ++ * just move QH to inactive schedule until new QTD arrives. ++ * On new QTD, the QH moved back to 'ready' schedule, ++ * starting frame and therefore starting desc_index are recalculated. ++ * In this case channel is released only on ep_disable. ++ */ ++ ++ /* Calculate starting descriptor index. For INTERRUPT endpoint it is always 0. */ ++ if (qh->channel) { ++ frame = calc_starting_frame(hcd, qh, &skip_frames); ++ /* ++ * Calculate initial descriptor index based on FrameList current bitmap ++ * and servicing period. ++ */ ++ fr_idx_tmp = frame_list_idx(frame); ++ fr_idx = ++ (MAX_FRLIST_EN_NUM + frame_list_idx(qh->sched_frame) - ++ fr_idx_tmp) ++ % frame_incr_val(qh); ++ fr_idx = (fr_idx + fr_idx_tmp) % MAX_FRLIST_EN_NUM; ++ } else { ++ qh->sched_frame = calc_starting_frame(hcd, qh, &skip_frames); ++ fr_idx = frame_list_idx(qh->sched_frame); ++ } ++ ++ qh->td_first = qh->td_last = frame_to_desc_idx(qh, fr_idx); ++ ++ return skip_frames; ++} ++ ++#define ISOC_URB_GIVEBACK_ASAP ++ ++#define MAX_ISOC_XFER_SIZE_FS 1023 ++#define MAX_ISOC_XFER_SIZE_HS 3072 ++#define DESCNUM_THRESHOLD 4 ++ ++static void init_isoc_dma_desc(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh, ++ uint8_t skip_frames) ++{ ++ struct dwc_otg_hcd_iso_packet_desc *frame_desc; ++ dwc_otg_qtd_t *qtd; ++ dwc_otg_host_dma_desc_t *dma_desc; ++ uint16_t idx, inc, n_desc, ntd_max, max_xfer_size; ++ ++ idx = qh->td_last; ++ inc = qh->interval; ++ n_desc = 0; ++ ++ ntd_max = (max_desc_num(qh) + qh->interval - 1) / qh->interval; ++ if (skip_frames && !qh->channel) ++ ntd_max = ntd_max - skip_frames / qh->interval; ++ ++ max_xfer_size = ++ (qh->dev_speed == ++ DWC_OTG_EP_SPEED_HIGH) ? MAX_ISOC_XFER_SIZE_HS : ++ MAX_ISOC_XFER_SIZE_FS; ++ ++ DWC_CIRCLEQ_FOREACH(qtd, &qh->qtd_list, qtd_list_entry) { ++ while ((qh->ntd < ntd_max) ++ && (qtd->isoc_frame_index_last < ++ qtd->urb->packet_count)) { ++ ++ dma_desc = &qh->desc_list[idx]; ++ dwc_memset(dma_desc, 0x00, sizeof(dwc_otg_host_dma_desc_t)); ++ ++ frame_desc = &qtd->urb->iso_descs[qtd->isoc_frame_index_last]; ++ ++ if (frame_desc->length > max_xfer_size) ++ qh->n_bytes[idx] = max_xfer_size; ++ else ++ qh->n_bytes[idx] = frame_desc->length; ++ dma_desc->status.b_isoc.n_bytes = qh->n_bytes[idx]; ++ dma_desc->status.b_isoc.a = 1; ++ dma_desc->status.b_isoc.sts = 0; ++ ++ dma_desc->buf = qtd->urb->dma + frame_desc->offset; ++ ++ qh->ntd++; ++ ++ qtd->isoc_frame_index_last++; ++ ++#ifdef ISOC_URB_GIVEBACK_ASAP ++ /* ++ * Set IOC for each descriptor corresponding to the ++ * last frame of the URB. ++ */ ++ if (qtd->isoc_frame_index_last == ++ qtd->urb->packet_count) ++ dma_desc->status.b_isoc.ioc = 1; ++ ++#endif ++ idx = desclist_idx_inc(idx, inc, qh->dev_speed); ++ n_desc++; ++ ++ } ++ qtd->in_process = 1; ++ } ++ ++ qh->td_last = idx; ++ ++#ifdef ISOC_URB_GIVEBACK_ASAP ++ /* Set IOC for the last descriptor if descriptor list is full */ ++ if (qh->ntd == ntd_max) { ++ idx = desclist_idx_dec(qh->td_last, inc, qh->dev_speed); ++ qh->desc_list[idx].status.b_isoc.ioc = 1; ++ } ++#else ++ /* ++ * Set IOC bit only for one descriptor. ++ * Always try to be ahead of HW processing, ++ * i.e. on IOC generation driver activates next descriptors but ++ * core continues to process descriptors followed the one with IOC set. ++ */ ++ ++ if (n_desc > DESCNUM_THRESHOLD) { ++ /* ++ * Move IOC "up". Required even if there is only one QTD ++ * in the list, cause QTDs migth continue to be queued, ++ * but during the activation it was only one queued. ++ * Actually more than one QTD might be in the list if this function called ++ * from XferCompletion - QTDs was queued during HW processing of the previous ++ * descriptor chunk. ++ */ ++ idx = dwc_desclist_idx_dec(idx, inc * ((qh->ntd + 1) / 2), qh->dev_speed); ++ } else { ++ /* ++ * Set the IOC for the latest descriptor ++ * if either number of descriptor is not greather than threshold ++ * or no more new descriptors activated. ++ */ ++ idx = dwc_desclist_idx_dec(qh->td_last, inc, qh->dev_speed); ++ } ++ ++ qh->desc_list[idx].status.b_isoc.ioc = 1; ++#endif ++} ++ ++static void init_non_isoc_dma_desc(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh) ++{ ++ ++ dwc_hc_t *hc; ++ dwc_otg_host_dma_desc_t *dma_desc; ++ dwc_otg_qtd_t *qtd; ++ int num_packets, len, n_desc = 0; ++ ++ hc = qh->channel; ++ ++ /* ++ * Start with hc->xfer_buff initialized in ++ * assign_and_init_hc(), then if SG transfer consists of multiple URBs, ++ * this pointer re-assigned to the buffer of the currently processed QTD. ++ * For non-SG request there is always one QTD active. ++ */ ++ ++ DWC_CIRCLEQ_FOREACH(qtd, &qh->qtd_list, qtd_list_entry) { ++ ++ if (n_desc) { ++ /* SG request - more than 1 QTDs */ ++ hc->xfer_buff = (uint8_t *)qtd->urb->dma + qtd->urb->actual_length; ++ hc->xfer_len = qtd->urb->length - qtd->urb->actual_length; ++ } ++ ++ qtd->n_desc = 0; ++ ++ do { ++ dma_desc = &qh->desc_list[n_desc]; ++ len = hc->xfer_len; ++ ++ if (len > MAX_DMA_DESC_SIZE) ++ len = MAX_DMA_DESC_SIZE - hc->max_packet + 1; ++ ++ if (hc->ep_is_in) { ++ if (len > 0) { ++ num_packets = (len + hc->max_packet - 1) / hc->max_packet; ++ } else { ++ /* Need 1 packet for transfer length of 0. */ ++ num_packets = 1; ++ } ++ /* Always program an integral # of max packets for IN transfers. */ ++ len = num_packets * hc->max_packet; ++ } ++ ++ dma_desc->status.b.n_bytes = len; ++ ++ qh->n_bytes[n_desc] = len; ++ ++ if ((qh->ep_type == UE_CONTROL) ++ && (qtd->control_phase == DWC_OTG_CONTROL_SETUP)) ++ dma_desc->status.b.sup = 1; /* Setup Packet */ ++ ++ dma_desc->status.b.a = 1; /* Active descriptor */ ++ dma_desc->status.b.sts = 0; ++ ++ dma_desc->buf = ++ ((unsigned long)hc->xfer_buff & 0xffffffff); ++ ++ /* ++ * Last descriptor(or single) of IN transfer ++ * with actual size less than MaxPacket. ++ */ ++ if (len > hc->xfer_len) { ++ hc->xfer_len = 0; ++ } else { ++ hc->xfer_buff += len; ++ hc->xfer_len -= len; ++ } ++ ++ qtd->n_desc++; ++ n_desc++; ++ } ++ while ((hc->xfer_len > 0) && (n_desc != MAX_DMA_DESC_NUM_GENERIC)); ++ ++ ++ qtd->in_process = 1; ++ ++ if (qh->ep_type == UE_CONTROL) ++ break; ++ ++ if (n_desc == MAX_DMA_DESC_NUM_GENERIC) ++ break; ++ } ++ ++ if (n_desc) { ++ /* Request Transfer Complete interrupt for the last descriptor */ ++ qh->desc_list[n_desc - 1].status.b.ioc = 1; ++ /* End of List indicator */ ++ qh->desc_list[n_desc - 1].status.b.eol = 1; ++ ++ hc->ntd = n_desc; ++ } ++} ++ ++/** ++ * For Control and Bulk endpoints initializes descriptor list ++ * and starts the transfer. ++ * ++ * For Interrupt and Isochronous endpoints initializes descriptor list ++ * then updates FrameList, marking appropriate entries as active. ++ * In case of Isochronous, the starting descriptor index is calculated based ++ * on the scheduled frame, but only on the first transfer descriptor within a session. ++ * Then starts the transfer via enabling the channel. ++ * For Isochronous endpoint the channel is not halted on XferComplete ++ * interrupt so remains assigned to the endpoint(QH) until session is done. ++ * ++ * @param hcd The HCD state structure for the DWC OTG controller. ++ * @param qh The QH to init. ++ * ++ * @return 0 if successful, negative error code otherwise. ++ */ ++void dwc_otg_hcd_start_xfer_ddma(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh) ++{ ++ /* Channel is already assigned */ ++ dwc_hc_t *hc = qh->channel; ++ uint8_t skip_frames = 0; ++ ++ switch (hc->ep_type) { ++ case DWC_OTG_EP_TYPE_CONTROL: ++ case DWC_OTG_EP_TYPE_BULK: ++ init_non_isoc_dma_desc(hcd, qh); ++ ++ dwc_otg_hc_start_transfer_ddma(hcd->core_if, hc); ++ break; ++ case DWC_OTG_EP_TYPE_INTR: ++ init_non_isoc_dma_desc(hcd, qh); ++ ++ update_frame_list(hcd, qh, 1); ++ ++ dwc_otg_hc_start_transfer_ddma(hcd->core_if, hc); ++ break; ++ case DWC_OTG_EP_TYPE_ISOC: ++ ++ if (!qh->ntd) ++ skip_frames = recalc_initial_desc_idx(hcd, qh); ++ ++ init_isoc_dma_desc(hcd, qh, skip_frames); ++ ++ if (!hc->xfer_started) { ++ ++ update_frame_list(hcd, qh, 1); ++ ++ /* ++ * Always set to max, instead of actual size. ++ * Otherwise ntd will be changed with ++ * channel being enabled. Not recommended. ++ * ++ */ ++ hc->ntd = max_desc_num(qh); ++ /* Enable channel only once for ISOC */ ++ dwc_otg_hc_start_transfer_ddma(hcd->core_if, hc); ++ } ++ ++ break; ++ default: ++ ++ break; ++ } ++} ++ ++static void complete_isoc_xfer_ddma(dwc_otg_hcd_t * hcd, ++ dwc_hc_t * hc, ++ dwc_otg_hc_regs_t * hc_regs, ++ dwc_otg_halt_status_e halt_status) ++{ ++ struct dwc_otg_hcd_iso_packet_desc *frame_desc; ++ dwc_otg_qtd_t *qtd, *qtd_tmp; ++ dwc_otg_qh_t *qh; ++ dwc_otg_host_dma_desc_t *dma_desc; ++ uint16_t idx, remain; ++ uint8_t urb_compl; ++ ++ qh = hc->qh; ++ idx = qh->td_first; ++ ++ if (hc->halt_status == DWC_OTG_HC_XFER_URB_DEQUEUE) { ++ DWC_CIRCLEQ_FOREACH_SAFE(qtd, qtd_tmp, &hc->qh->qtd_list, qtd_list_entry) ++ qtd->in_process = 0; ++ return; ++ } else if ((halt_status == DWC_OTG_HC_XFER_AHB_ERR) || ++ (halt_status == DWC_OTG_HC_XFER_BABBLE_ERR)) { ++ /* ++ * Channel is halted in these error cases. ++ * Considered as serious issues. ++ * Complete all URBs marking all frames as failed, ++ * irrespective whether some of the descriptors(frames) succeeded or no. ++ * Pass error code to completion routine as well, to ++ * update urb->status, some of class drivers might use it to stop ++ * queing transfer requests. ++ */ ++ int err = (halt_status == DWC_OTG_HC_XFER_AHB_ERR) ++ ? (-DWC_E_IO) ++ : (-DWC_E_OVERFLOW); ++ ++ DWC_CIRCLEQ_FOREACH_SAFE(qtd, qtd_tmp, &hc->qh->qtd_list, qtd_list_entry) { ++ for (idx = 0; idx < qtd->urb->packet_count; idx++) { ++ frame_desc = &qtd->urb->iso_descs[idx]; ++ frame_desc->status = err; ++ } ++ hcd->fops->complete(hcd, qtd->urb->priv, qtd->urb, err); ++ dwc_otg_hcd_qtd_remove_and_free(hcd, qtd, qh); ++ } ++ return; ++ } ++ ++ DWC_CIRCLEQ_FOREACH_SAFE(qtd, qtd_tmp, &hc->qh->qtd_list, qtd_list_entry) { ++ ++ if (!qtd->in_process) ++ break; ++ ++ urb_compl = 0; ++ ++ do { ++ ++ dma_desc = &qh->desc_list[idx]; ++ ++ frame_desc = &qtd->urb->iso_descs[qtd->isoc_frame_index]; ++ remain = hc->ep_is_in ? dma_desc->status.b_isoc.n_bytes : 0; ++ ++ if (dma_desc->status.b_isoc.sts == DMA_DESC_STS_PKTERR) { ++ /* ++ * XactError or, unable to complete all the transactions ++ * in the scheduled micro-frame/frame, ++ * both indicated by DMA_DESC_STS_PKTERR. ++ */ ++ qtd->urb->error_count++; ++ frame_desc->actual_length = qh->n_bytes[idx] - remain; ++ frame_desc->status = -DWC_E_PROTOCOL; ++ } else { ++ /* Success */ ++ ++ frame_desc->actual_length = qh->n_bytes[idx] - remain; ++ frame_desc->status = 0; ++ } ++ ++ if (++qtd->isoc_frame_index == qtd->urb->packet_count) { ++ /* ++ * urb->status is not used for isoc transfers here. ++ * The individual frame_desc status are used instead. ++ */ ++ ++ hcd->fops->complete(hcd, qtd->urb->priv, qtd->urb, 0); ++ dwc_otg_hcd_qtd_remove_and_free(hcd, qtd, qh); ++ ++ /* ++ * This check is necessary because urb_dequeue can be called ++ * from urb complete callback(sound driver example). ++ * All pending URBs are dequeued there, so no need for ++ * further processing. ++ */ ++ if (hc->halt_status == DWC_OTG_HC_XFER_URB_DEQUEUE) { ++ return; ++ } ++ ++ urb_compl = 1; ++ ++ } ++ ++ qh->ntd--; ++ ++ /* Stop if IOC requested descriptor reached */ ++ if (dma_desc->status.b_isoc.ioc) { ++ idx = desclist_idx_inc(idx, qh->interval, hc->speed); ++ goto stop_scan; ++ } ++ ++ idx = desclist_idx_inc(idx, qh->interval, hc->speed); ++ ++ if (urb_compl) ++ break; ++ } ++ while (idx != qh->td_first); ++ } ++stop_scan: ++ qh->td_first = idx; ++} ++ ++uint8_t update_non_isoc_urb_state_ddma(dwc_otg_hcd_t * hcd, ++ dwc_hc_t * hc, ++ dwc_otg_qtd_t * qtd, ++ dwc_otg_host_dma_desc_t * dma_desc, ++ dwc_otg_halt_status_e halt_status, ++ uint32_t n_bytes, uint8_t * xfer_done) ++{ ++ ++ uint16_t remain = hc->ep_is_in ? dma_desc->status.b.n_bytes : 0; ++ dwc_otg_hcd_urb_t *urb = qtd->urb; ++ ++ if (halt_status == DWC_OTG_HC_XFER_AHB_ERR) { ++ urb->status = -DWC_E_IO; ++ return 1; ++ } ++ if (dma_desc->status.b.sts == DMA_DESC_STS_PKTERR) { ++ switch (halt_status) { ++ case DWC_OTG_HC_XFER_STALL: ++ urb->status = -DWC_E_PIPE; ++ break; ++ case DWC_OTG_HC_XFER_BABBLE_ERR: ++ urb->status = -DWC_E_OVERFLOW; ++ break; ++ case DWC_OTG_HC_XFER_XACT_ERR: ++ urb->status = -DWC_E_PROTOCOL; ++ break; ++ default: ++ DWC_ERROR("%s: Unhandled descriptor error status (%d)\n", __func__, ++ halt_status); ++ break; ++ } ++ return 1; ++ } ++ ++ if (dma_desc->status.b.a == 1) { ++ DWC_DEBUGPL(DBG_HCDV, ++ "Active descriptor encountered on channel %d\n", ++ hc->hc_num); ++ return 0; ++ } ++ ++ if (hc->ep_type == DWC_OTG_EP_TYPE_CONTROL) { ++ if (qtd->control_phase == DWC_OTG_CONTROL_DATA) { ++ urb->actual_length += n_bytes - remain; ++ if (remain || urb->actual_length == urb->length) { ++ /* ++ * For Control Data stage do not set urb->status=0 to prevent ++ * URB callback. Set it when Status phase done. See below. ++ */ ++ *xfer_done = 1; ++ } ++ ++ } else if (qtd->control_phase == DWC_OTG_CONTROL_STATUS) { ++ urb->status = 0; ++ *xfer_done = 1; ++ } ++ /* No handling for SETUP stage */ ++ } else { ++ /* BULK and INTR */ ++ urb->actual_length += n_bytes - remain; ++ if (remain || urb->actual_length == urb->length) { ++ urb->status = 0; ++ *xfer_done = 1; ++ } ++ } ++ ++ return 0; ++} ++ ++static void complete_non_isoc_xfer_ddma(dwc_otg_hcd_t * hcd, ++ dwc_hc_t * hc, ++ dwc_otg_hc_regs_t * hc_regs, ++ dwc_otg_halt_status_e halt_status) ++{ ++ dwc_otg_hcd_urb_t *urb = NULL; ++ dwc_otg_qtd_t *qtd, *qtd_tmp; ++ dwc_otg_qh_t *qh; ++ dwc_otg_host_dma_desc_t *dma_desc; ++ uint32_t n_bytes, n_desc, i; ++ uint8_t failed = 0, xfer_done; ++ ++ n_desc = 0; ++ ++ qh = hc->qh; ++ ++ if (hc->halt_status == DWC_OTG_HC_XFER_URB_DEQUEUE) { ++ DWC_CIRCLEQ_FOREACH_SAFE(qtd, qtd_tmp, &hc->qh->qtd_list, qtd_list_entry) { ++ qtd->in_process = 0; ++ } ++ return; ++ } ++ ++ DWC_CIRCLEQ_FOREACH_SAFE(qtd, qtd_tmp, &qh->qtd_list, qtd_list_entry) { ++ ++ urb = qtd->urb; ++ ++ n_bytes = 0; ++ xfer_done = 0; ++ ++ for (i = 0; i < qtd->n_desc; i++) { ++ dma_desc = &qh->desc_list[n_desc]; ++ ++ n_bytes = qh->n_bytes[n_desc]; ++ ++ failed = ++ update_non_isoc_urb_state_ddma(hcd, hc, qtd, ++ dma_desc, ++ halt_status, n_bytes, ++ &xfer_done); ++ ++ if (failed ++ || (xfer_done ++ && (urb->status != -DWC_E_IN_PROGRESS))) { ++ ++ hcd->fops->complete(hcd, urb->priv, urb, ++ urb->status); ++ dwc_otg_hcd_qtd_remove_and_free(hcd, qtd, qh); ++ ++ if (failed) ++ goto stop_scan; ++ } else if (qh->ep_type == UE_CONTROL) { ++ if (qtd->control_phase == DWC_OTG_CONTROL_SETUP) { ++ if (urb->length > 0) { ++ qtd->control_phase = DWC_OTG_CONTROL_DATA; ++ } else { ++ qtd->control_phase = DWC_OTG_CONTROL_STATUS; ++ } ++ DWC_DEBUGPL(DBG_HCDV, " Control setup transaction done\n"); ++ } else if (qtd->control_phase == DWC_OTG_CONTROL_DATA) { ++ if (xfer_done) { ++ qtd->control_phase = DWC_OTG_CONTROL_STATUS; ++ DWC_DEBUGPL(DBG_HCDV, " Control data transfer done\n"); ++ } else if (i + 1 == qtd->n_desc) { ++ /* ++ * Last descriptor for Control data stage which is ++ * not completed yet. ++ */ ++ dwc_otg_hcd_save_data_toggle(hc, hc_regs, qtd); ++ } ++ } ++ } ++ ++ n_desc++; ++ } ++ ++ } ++ ++stop_scan: ++ ++ if (qh->ep_type != UE_CONTROL) { ++ /* ++ * Resetting the data toggle for bulk ++ * and interrupt endpoints in case of stall. See handle_hc_stall_intr() ++ */ ++ if (halt_status == DWC_OTG_HC_XFER_STALL) ++ qh->data_toggle = DWC_OTG_HC_PID_DATA0; ++ else ++ dwc_otg_hcd_save_data_toggle(hc, hc_regs, qtd); ++ } ++ ++ if (halt_status == DWC_OTG_HC_XFER_COMPLETE) { ++ hcint_data_t hcint; ++ hcint.d32 = DWC_READ_REG32(&hc_regs->hcint); ++ if (hcint.b.nyet) { ++ /* ++ * Got a NYET on the last transaction of the transfer. It ++ * means that the endpoint should be in the PING state at the ++ * beginning of the next transfer. ++ */ ++ qh->ping_state = 1; ++ clear_hc_int(hc_regs, nyet); ++ } ++ ++ } ++ ++} ++ ++/** ++ * This function is called from interrupt handlers. ++ * Scans the descriptor list, updates URB's status and ++ * calls completion routine for the URB if it's done. ++ * Releases the channel to be used by other transfers. ++ * In case of Isochronous endpoint the channel is not halted until ++ * the end of the session, i.e. QTD list is empty. ++ * If periodic channel released the FrameList is updated accordingly. ++ * ++ * Calls transaction selection routines to activate pending transfers. ++ * ++ * @param hcd The HCD state structure for the DWC OTG controller. ++ * @param hc Host channel, the transfer is completed on. ++ * @param hc_regs Host channel registers. ++ * @param halt_status Reason the channel is being halted, ++ * or just XferComplete for isochronous transfer ++ */ ++void dwc_otg_hcd_complete_xfer_ddma(dwc_otg_hcd_t * hcd, ++ dwc_hc_t * hc, ++ dwc_otg_hc_regs_t * hc_regs, ++ dwc_otg_halt_status_e halt_status) ++{ ++ uint8_t continue_isoc_xfer = 0; ++ dwc_otg_transaction_type_e tr_type; ++ dwc_otg_qh_t *qh = hc->qh; ++ ++ if (hc->ep_type == DWC_OTG_EP_TYPE_ISOC) { ++ ++ complete_isoc_xfer_ddma(hcd, hc, hc_regs, halt_status); ++ ++ /* Release the channel if halted or session completed */ ++ if (halt_status != DWC_OTG_HC_XFER_COMPLETE || ++ DWC_CIRCLEQ_EMPTY(&qh->qtd_list)) { ++ ++ /* Halt the channel if session completed */ ++ if (halt_status == DWC_OTG_HC_XFER_COMPLETE) { ++ dwc_otg_hc_halt(hcd->core_if, hc, halt_status); ++ } ++ ++ release_channel_ddma(hcd, qh); ++ dwc_otg_hcd_qh_remove(hcd, qh); ++ } else { ++ /* Keep in assigned schedule to continue transfer */ ++ DWC_LIST_MOVE_HEAD(&hcd->periodic_sched_assigned, ++ &qh->qh_list_entry); ++ continue_isoc_xfer = 1; ++ ++ } ++ /** @todo Consider the case when period exceeds FrameList size. ++ * Frame Rollover interrupt should be used. ++ */ ++ } else { ++ /* Scan descriptor list to complete the URB(s), then release the channel */ ++ complete_non_isoc_xfer_ddma(hcd, hc, hc_regs, halt_status); ++ ++ release_channel_ddma(hcd, qh); ++ dwc_otg_hcd_qh_remove(hcd, qh); ++ ++ if (!DWC_CIRCLEQ_EMPTY(&qh->qtd_list)) { ++ /* Add back to inactive non-periodic schedule on normal completion */ ++ dwc_otg_hcd_qh_add(hcd, qh); ++ } ++ ++ } ++ tr_type = dwc_otg_hcd_select_transactions(hcd); ++ if (tr_type != DWC_OTG_TRANSACTION_NONE || continue_isoc_xfer) { ++ if (continue_isoc_xfer) { ++ if (tr_type == DWC_OTG_TRANSACTION_NONE) { ++ tr_type = DWC_OTG_TRANSACTION_PERIODIC; ++ } else if (tr_type == DWC_OTG_TRANSACTION_NON_PERIODIC) { ++ tr_type = DWC_OTG_TRANSACTION_ALL; ++ } ++ } ++ dwc_otg_hcd_queue_transactions(hcd, tr_type); ++ } ++} ++ ++#endif /* DWC_DEVICE_ONLY */ +diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd_if.h b/drivers/usb/host/dwc_otg/dwc_otg_hcd_if.h +new file mode 100644 +index 0000000..fb57db0 +--- /dev/null ++++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd_if.h +@@ -0,0 +1,417 @@ ++/* ========================================================================== ++ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_hcd_if.h $ ++ * $Revision: #12 $ ++ * $Date: 2011/10/26 $ ++ * $Change: 1873028 $ ++ * ++ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, ++ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless ++ * otherwise expressly agreed to in writing between Synopsys and you. ++ * ++ * The Software IS NOT an item of Licensed Software or Licensed Product under ++ * any End User Software License Agreement or Agreement for Licensed Product ++ * with Synopsys or any supplement thereto. You are permitted to use and ++ * redistribute this Software in source and binary forms, with or without ++ * modification, provided that redistributions of source code must retain this ++ * notice. You may not view, use, disclose, copy or distribute this file or ++ * any information contained herein except pursuant to this license grant from ++ * Synopsys. If you do not agree with this notice, including the disclaimer ++ * below, then you are not authorized to use the Software. ++ * ++ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS ++ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS 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. ++ * ========================================================================== */ ++#ifndef DWC_DEVICE_ONLY ++#ifndef __DWC_HCD_IF_H__ ++#define __DWC_HCD_IF_H__ ++ ++#include "dwc_otg_core_if.h" ++ ++/** @file ++ * This file defines DWC_OTG HCD Core API. ++ */ ++ ++struct dwc_otg_hcd; ++typedef struct dwc_otg_hcd dwc_otg_hcd_t; ++ ++struct dwc_otg_hcd_urb; ++typedef struct dwc_otg_hcd_urb dwc_otg_hcd_urb_t; ++ ++/** @name HCD Function Driver Callbacks */ ++/** @{ */ ++ ++/** This function is called whenever core switches to host mode. */ ++typedef int (*dwc_otg_hcd_start_cb_t) (dwc_otg_hcd_t * hcd); ++ ++/** This function is called when device has been disconnected */ ++typedef int (*dwc_otg_hcd_disconnect_cb_t) (dwc_otg_hcd_t * hcd); ++ ++/** Wrapper provides this function to HCD to core, so it can get hub information to which device is connected */ ++typedef int (*dwc_otg_hcd_hub_info_from_urb_cb_t) (dwc_otg_hcd_t * hcd, ++ void *urb_handle, ++ uint32_t * hub_addr, ++ uint32_t * port_addr); ++/** Via this function HCD core gets device speed */ ++typedef int (*dwc_otg_hcd_speed_from_urb_cb_t) (dwc_otg_hcd_t * hcd, ++ void *urb_handle); ++ ++/** This function is called when urb is completed */ ++typedef int (*dwc_otg_hcd_complete_urb_cb_t) (dwc_otg_hcd_t * hcd, ++ void *urb_handle, ++ dwc_otg_hcd_urb_t * dwc_otg_urb, ++ int32_t status); ++ ++/** Via this function HCD core gets b_hnp_enable parameter */ ++typedef int (*dwc_otg_hcd_get_b_hnp_enable) (dwc_otg_hcd_t * hcd); ++ ++struct dwc_otg_hcd_function_ops { ++ dwc_otg_hcd_start_cb_t start; ++ dwc_otg_hcd_disconnect_cb_t disconnect; ++ dwc_otg_hcd_hub_info_from_urb_cb_t hub_info; ++ dwc_otg_hcd_speed_from_urb_cb_t speed; ++ dwc_otg_hcd_complete_urb_cb_t complete; ++ dwc_otg_hcd_get_b_hnp_enable get_b_hnp_enable; ++}; ++/** @} */ ++ ++/** @name HCD Core API */ ++/** @{ */ ++/** This function allocates dwc_otg_hcd structure and returns pointer on it. */ ++extern dwc_otg_hcd_t *dwc_otg_hcd_alloc_hcd(void); ++ ++/** This function should be called to initiate HCD Core. ++ * ++ * @param hcd The HCD ++ * @param core_if The DWC_OTG Core ++ * ++ * Returns -DWC_E_NO_MEMORY if no enough memory. ++ * Returns 0 on success ++ */ ++extern int dwc_otg_hcd_init(dwc_otg_hcd_t * hcd, dwc_otg_core_if_t * core_if); ++ ++/** Frees HCD ++ * ++ * @param hcd The HCD ++ */ ++extern void dwc_otg_hcd_remove(dwc_otg_hcd_t * hcd); ++ ++/** This function should be called on every hardware interrupt. ++ * ++ * @param dwc_otg_hcd The HCD ++ * ++ * Returns non zero if interrupt is handled ++ * Return 0 if interrupt is not handled ++ */ ++extern int32_t dwc_otg_hcd_handle_intr(dwc_otg_hcd_t * dwc_otg_hcd); ++ ++/** This function is used to handle the fast interrupt ++ * ++ */ ++extern void __attribute__ ((naked)) dwc_otg_hcd_handle_fiq(void); ++ ++/** ++ * Returns private data set by ++ * dwc_otg_hcd_set_priv_data function. ++ * ++ * @param hcd The HCD ++ */ ++extern void *dwc_otg_hcd_get_priv_data(dwc_otg_hcd_t * hcd); ++ ++/** ++ * Set private data. ++ * ++ * @param hcd The HCD ++ * @param priv_data pointer to be stored in private data ++ */ ++extern void dwc_otg_hcd_set_priv_data(dwc_otg_hcd_t * hcd, void *priv_data); ++ ++/** ++ * This function initializes the HCD Core. ++ * ++ * @param hcd The HCD ++ * @param fops The Function Driver Operations data structure containing pointers to all callbacks. ++ * ++ * Returns -DWC_E_NO_DEVICE if Core is currently is in device mode. ++ * Returns 0 on success ++ */ ++extern int dwc_otg_hcd_start(dwc_otg_hcd_t * hcd, ++ struct dwc_otg_hcd_function_ops *fops); ++ ++/** ++ * Halts the DWC_otg host mode operations in a clean manner. USB transfers are ++ * stopped. ++ * ++ * @param hcd The HCD ++ */ ++extern void dwc_otg_hcd_stop(dwc_otg_hcd_t * hcd); ++ ++/** ++ * Handles hub class-specific requests. ++ * ++ * @param dwc_otg_hcd The HCD ++ * @param typeReq Request Type ++ * @param wValue wValue from control request ++ * @param wIndex wIndex from control request ++ * @param buf data buffer ++ * @param wLength data buffer length ++ * ++ * Returns -DWC_E_INVALID if invalid argument is passed ++ * Returns 0 on success ++ */ ++extern int dwc_otg_hcd_hub_control(dwc_otg_hcd_t * dwc_otg_hcd, ++ uint16_t typeReq, uint16_t wValue, ++ uint16_t wIndex, uint8_t * buf, ++ uint16_t wLength); ++ ++/** ++ * Returns otg port number. ++ * ++ * @param hcd The HCD ++ */ ++extern uint32_t dwc_otg_hcd_otg_port(dwc_otg_hcd_t * hcd); ++ ++/** ++ * Returns OTG version - either 1.3 or 2.0. ++ * ++ * @param core_if The core_if structure pointer ++ */ ++extern uint16_t dwc_otg_get_otg_version(dwc_otg_core_if_t * core_if); ++ ++/** ++ * Returns 1 if currently core is acting as B host, and 0 otherwise. ++ * ++ * @param hcd The HCD ++ */ ++extern uint32_t dwc_otg_hcd_is_b_host(dwc_otg_hcd_t * hcd); ++ ++/** ++ * Returns current frame number. ++ * ++ * @param hcd The HCD ++ */ ++extern int dwc_otg_hcd_get_frame_number(dwc_otg_hcd_t * hcd); ++ ++/** ++ * Dumps hcd state. ++ * ++ * @param hcd The HCD ++ */ ++extern void dwc_otg_hcd_dump_state(dwc_otg_hcd_t * hcd); ++ ++/** ++ * Dump the average frame remaining at SOF. This can be used to ++ * determine average interrupt latency. Frame remaining is also shown for ++ * start transfer and two additional sample points. ++ * Currently this function is not implemented. ++ * ++ * @param hcd The HCD ++ */ ++extern void dwc_otg_hcd_dump_frrem(dwc_otg_hcd_t * hcd); ++ ++/** ++ * Sends LPM transaction to the local device. ++ * ++ * @param hcd The HCD ++ * @param devaddr Device Address ++ * @param hird Host initiated resume duration ++ * @param bRemoteWake Value of bRemoteWake field in LPM transaction ++ * ++ * Returns negative value if sending LPM transaction was not succeeded. ++ * Returns 0 on success. ++ */ ++extern int dwc_otg_hcd_send_lpm(dwc_otg_hcd_t * hcd, uint8_t devaddr, ++ uint8_t hird, uint8_t bRemoteWake); ++ ++/* URB interface */ ++ ++/** ++ * Allocates memory for dwc_otg_hcd_urb structure. ++ * Allocated memory should be freed by call of DWC_FREE. ++ * ++ * @param hcd The HCD ++ * @param iso_desc_count Count of ISOC descriptors ++ * @param atomic_alloc Specefies whether to perform atomic allocation. ++ */ ++extern dwc_otg_hcd_urb_t *dwc_otg_hcd_urb_alloc(dwc_otg_hcd_t * hcd, ++ int iso_desc_count, ++ int atomic_alloc); ++ ++/** ++ * Set pipe information in URB. ++ * ++ * @param hcd_urb DWC_OTG URB ++ * @param devaddr Device Address ++ * @param ep_num Endpoint Number ++ * @param ep_type Endpoint Type ++ * @param ep_dir Endpoint Direction ++ * @param mps Max Packet Size ++ */ ++extern void dwc_otg_hcd_urb_set_pipeinfo(dwc_otg_hcd_urb_t * hcd_urb, ++ uint8_t devaddr, uint8_t ep_num, ++ uint8_t ep_type, uint8_t ep_dir, ++ uint16_t mps); ++ ++/* Transfer flags */ ++#define URB_GIVEBACK_ASAP 0x1 ++#define URB_SEND_ZERO_PACKET 0x2 ++ ++/** ++ * Sets dwc_otg_hcd_urb parameters. ++ * ++ * @param urb DWC_OTG URB allocated by dwc_otg_hcd_urb_alloc function. ++ * @param urb_handle Unique handle for request, this will be passed back ++ * to function driver in completion callback. ++ * @param buf The buffer for the data ++ * @param dma The DMA buffer for the data ++ * @param buflen Transfer length ++ * @param sp Buffer for setup data ++ * @param sp_dma DMA address of setup data buffer ++ * @param flags Transfer flags ++ * @param interval Polling interval for interrupt or isochronous transfers. ++ */ ++extern void dwc_otg_hcd_urb_set_params(dwc_otg_hcd_urb_t * urb, ++ void *urb_handle, void *buf, ++ dwc_dma_t dma, uint32_t buflen, void *sp, ++ dwc_dma_t sp_dma, uint32_t flags, ++ uint16_t interval); ++ ++/** Gets status from dwc_otg_hcd_urb ++ * ++ * @param dwc_otg_urb DWC_OTG URB ++ */ ++extern uint32_t dwc_otg_hcd_urb_get_status(dwc_otg_hcd_urb_t * dwc_otg_urb); ++ ++/** Gets actual length from dwc_otg_hcd_urb ++ * ++ * @param dwc_otg_urb DWC_OTG URB ++ */ ++extern uint32_t dwc_otg_hcd_urb_get_actual_length(dwc_otg_hcd_urb_t * ++ dwc_otg_urb); ++ ++/** Gets error count from dwc_otg_hcd_urb. Only for ISOC URBs ++ * ++ * @param dwc_otg_urb DWC_OTG URB ++ */ ++extern uint32_t dwc_otg_hcd_urb_get_error_count(dwc_otg_hcd_urb_t * ++ dwc_otg_urb); ++ ++/** Set ISOC descriptor offset and length ++ * ++ * @param dwc_otg_urb DWC_OTG URB ++ * @param desc_num ISOC descriptor number ++ * @param offset Offset from beginig of buffer. ++ * @param length Transaction length ++ */ ++extern void dwc_otg_hcd_urb_set_iso_desc_params(dwc_otg_hcd_urb_t * dwc_otg_urb, ++ int desc_num, uint32_t offset, ++ uint32_t length); ++ ++/** Get status of ISOC descriptor, specified by desc_num ++ * ++ * @param dwc_otg_urb DWC_OTG URB ++ * @param desc_num ISOC descriptor number ++ */ ++extern uint32_t dwc_otg_hcd_urb_get_iso_desc_status(dwc_otg_hcd_urb_t * ++ dwc_otg_urb, int desc_num); ++ ++/** Get actual length of ISOC descriptor, specified by desc_num ++ * ++ * @param dwc_otg_urb DWC_OTG URB ++ * @param desc_num ISOC descriptor number ++ */ ++extern uint32_t dwc_otg_hcd_urb_get_iso_desc_actual_length(dwc_otg_hcd_urb_t * ++ dwc_otg_urb, ++ int desc_num); ++ ++/** Queue URB. After transfer is completes, the complete callback will be called with the URB status ++ * ++ * @param dwc_otg_hcd The HCD ++ * @param dwc_otg_urb DWC_OTG URB ++ * @param ep_handle Out parameter for returning endpoint handle ++ * @param atomic_alloc Flag to do atomic allocation if needed ++ * ++ * Returns -DWC_E_NO_DEVICE if no device is connected. ++ * Returns -DWC_E_NO_MEMORY if there is no enough memory. ++ * Returns 0 on success. ++ */ ++extern int dwc_otg_hcd_urb_enqueue(dwc_otg_hcd_t * dwc_otg_hcd, ++ dwc_otg_hcd_urb_t * dwc_otg_urb, ++ void **ep_handle, int atomic_alloc); ++ ++/** De-queue the specified URB ++ * ++ * @param dwc_otg_hcd The HCD ++ * @param dwc_otg_urb DWC_OTG URB ++ */ ++extern int dwc_otg_hcd_urb_dequeue(dwc_otg_hcd_t * dwc_otg_hcd, ++ dwc_otg_hcd_urb_t * dwc_otg_urb); ++ ++/** Frees resources in the DWC_otg controller related to a given endpoint. ++ * Any URBs for the endpoint must already be dequeued. ++ * ++ * @param hcd The HCD ++ * @param ep_handle Endpoint handle, returned by dwc_otg_hcd_urb_enqueue function ++ * @param retry Number of retries if there are queued transfers. ++ * ++ * Returns -DWC_E_INVALID if invalid arguments are passed. ++ * Returns 0 on success ++ */ ++extern int dwc_otg_hcd_endpoint_disable(dwc_otg_hcd_t * hcd, void *ep_handle, ++ int retry); ++ ++/* Resets the data toggle in qh structure. This function can be called from ++ * usb_clear_halt routine. ++ * ++ * @param hcd The HCD ++ * @param ep_handle Endpoint handle, returned by dwc_otg_hcd_urb_enqueue function ++ * ++ * Returns -DWC_E_INVALID if invalid arguments are passed. ++ * Returns 0 on success ++ */ ++extern int dwc_otg_hcd_endpoint_reset(dwc_otg_hcd_t * hcd, void *ep_handle); ++ ++/** Returns 1 if status of specified port is changed and 0 otherwise. ++ * ++ * @param hcd The HCD ++ * @param port Port number ++ */ ++extern int dwc_otg_hcd_is_status_changed(dwc_otg_hcd_t * hcd, int port); ++ ++/** Call this function to check if bandwidth was allocated for specified endpoint. ++ * Only for ISOC and INTERRUPT endpoints. ++ * ++ * @param hcd The HCD ++ * @param ep_handle Endpoint handle ++ */ ++extern int dwc_otg_hcd_is_bandwidth_allocated(dwc_otg_hcd_t * hcd, ++ void *ep_handle); ++ ++/** Call this function to check if bandwidth was freed for specified endpoint. ++ * ++ * @param hcd The HCD ++ * @param ep_handle Endpoint handle ++ */ ++extern int dwc_otg_hcd_is_bandwidth_freed(dwc_otg_hcd_t * hcd, void *ep_handle); ++ ++/** Returns bandwidth allocated for specified endpoint in microseconds. ++ * Only for ISOC and INTERRUPT endpoints. ++ * ++ * @param hcd The HCD ++ * @param ep_handle Endpoint handle ++ */ ++extern uint8_t dwc_otg_hcd_get_ep_bandwidth(dwc_otg_hcd_t * hcd, ++ void *ep_handle); ++ ++/** @} */ ++ ++#endif /* __DWC_HCD_IF_H__ */ ++#endif /* DWC_DEVICE_ONLY */ +diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c b/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c +new file mode 100644 +index 0000000..e6b38ac +--- /dev/null ++++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c +@@ -0,0 +1,2727 @@ ++/* ========================================================================== ++ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_hcd_intr.c $ ++ * $Revision: #89 $ ++ * $Date: 2011/10/20 $ ++ * $Change: 1869487 $ ++ * ++ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, ++ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless ++ * otherwise expressly agreed to in writing between Synopsys and you. ++ * ++ * The Software IS NOT an item of Licensed Software or Licensed Product under ++ * any End User Software License Agreement or Agreement for Licensed Product ++ * with Synopsys or any supplement thereto. You are permitted to use and ++ * redistribute this Software in source and binary forms, with or without ++ * modification, provided that redistributions of source code must retain this ++ * notice. You may not view, use, disclose, copy or distribute this file or ++ * any information contained herein except pursuant to this license grant from ++ * Synopsys. If you do not agree with this notice, including the disclaimer ++ * below, then you are not authorized to use the Software. ++ * ++ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS ++ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS 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. ++ * ========================================================================== */ ++#ifndef DWC_DEVICE_ONLY ++ ++#include "dwc_otg_hcd.h" ++#include "dwc_otg_regs.h" ++ ++#include <linux/jiffies.h> ++#include <asm/fiq.h> ++ ++ ++extern bool microframe_schedule; ++ ++/** @file ++ * This file contains the implementation of the HCD Interrupt handlers. ++ */ ++ ++int fiq_done, int_done; ++ ++#ifdef FIQ_DEBUG ++char buffer[1000*16]; ++int wptr; ++void notrace _fiq_print(FIQDBG_T dbg_lvl, char *fmt, ...) ++{ ++ FIQDBG_T dbg_lvl_req = FIQDBG_PORTHUB; ++ va_list args; ++ char text[17]; ++ hfnum_data_t hfnum = { .d32 = FIQ_READ(dwc_regs_base + 0x408) }; ++ ++ if(dbg_lvl & dbg_lvl_req || dbg_lvl == FIQDBG_ERR) ++ { ++ local_fiq_disable(); ++ snprintf(text, 9, "%4d%d:%d ", hfnum.b.frnum/8, hfnum.b.frnum%8, 8 - hfnum.b.frrem/937); ++ va_start(args, fmt); ++ vsnprintf(text+8, 9, fmt, args); ++ va_end(args); ++ ++ memcpy(buffer + wptr, text, 16); ++ wptr = (wptr + 16) % sizeof(buffer); ++ local_fiq_enable(); ++ } ++} ++#endif ++ ++/** This function handles interrupts for the HCD. */ ++int32_t dwc_otg_hcd_handle_intr(dwc_otg_hcd_t * dwc_otg_hcd) ++{ ++ int retval = 0; ++ static int last_time; ++ dwc_otg_core_if_t *core_if = dwc_otg_hcd->core_if; ++ gintsts_data_t gintsts; ++ gintmsk_data_t gintmsk; ++ hfnum_data_t hfnum; ++ haintmsk_data_t haintmsk; ++ ++#ifdef DEBUG ++ dwc_otg_core_global_regs_t *global_regs = core_if->core_global_regs; ++ ++#endif ++ ++ gintsts.d32 = DWC_READ_REG32(&core_if->core_global_regs->gintsts); ++ gintmsk.d32 = DWC_READ_REG32(&core_if->core_global_regs->gintmsk); ++ ++ /* Exit from ISR if core is hibernated */ ++ if (core_if->hibernation_suspend == 1) { ++ goto exit_handler_routine; ++ } ++ DWC_SPINLOCK(dwc_otg_hcd->lock); ++ /* Check if HOST Mode */ ++ if (dwc_otg_is_host_mode(core_if)) { ++ if (fiq_enable) { ++ local_fiq_disable(); ++ fiq_fsm_spin_lock(&dwc_otg_hcd->fiq_state->lock); ++ /* Pull in from the FIQ's disabled mask */ ++ gintmsk.d32 = gintmsk.d32 | ~(dwc_otg_hcd->fiq_state->gintmsk_saved.d32); ++ dwc_otg_hcd->fiq_state->gintmsk_saved.d32 = ~0; ++ } ++ ++ if (fiq_fsm_enable && ( 0x0000FFFF & ~(dwc_otg_hcd->fiq_state->haintmsk_saved.b2.chint))) { ++ gintsts.b.hcintr = 1; ++ } ++ ++ /* Danger will robinson: fake a SOF if necessary */ ++ if (fiq_fsm_enable && (dwc_otg_hcd->fiq_state->gintmsk_saved.b.sofintr == 1)) { ++ gintsts.b.sofintr = 1; ++ } ++ gintsts.d32 &= gintmsk.d32; ++ ++ if (fiq_enable) { ++ fiq_fsm_spin_unlock(&dwc_otg_hcd->fiq_state->lock); ++ local_fiq_enable(); ++ } ++ ++ if (!gintsts.d32) { ++ goto exit_handler_routine; ++ } ++ ++#ifdef DEBUG ++ // We should be OK doing this because the common interrupts should already have been serviced ++ /* Don't print debug message in the interrupt handler on SOF */ ++#ifndef DEBUG_SOF ++ if (gintsts.d32 != DWC_SOF_INTR_MASK) ++#endif ++ DWC_DEBUGPL(DBG_HCDI, "\n"); ++#endif ++ ++#ifdef DEBUG ++#ifndef DEBUG_SOF ++ if (gintsts.d32 != DWC_SOF_INTR_MASK) ++#endif ++ DWC_DEBUGPL(DBG_HCDI, ++ "DWC OTG HCD Interrupt Detected gintsts&gintmsk=0x%08x core_if=%p\n", ++ gintsts.d32, core_if); ++#endif ++ hfnum.d32 = DWC_READ_REG32(&dwc_otg_hcd->core_if->host_if->host_global_regs->hfnum); ++ if (gintsts.b.sofintr) { ++ retval |= dwc_otg_hcd_handle_sof_intr(dwc_otg_hcd); ++ } ++ ++ if (gintsts.b.rxstsqlvl) { ++ retval |= ++ dwc_otg_hcd_handle_rx_status_q_level_intr ++ (dwc_otg_hcd); ++ } ++ if (gintsts.b.nptxfempty) { ++ retval |= ++ dwc_otg_hcd_handle_np_tx_fifo_empty_intr ++ (dwc_otg_hcd); ++ } ++ if (gintsts.b.i2cintr) { ++ /** @todo Implement i2cintr handler. */ ++ } ++ if (gintsts.b.portintr) { ++ ++ gintmsk_data_t gintmsk = { .b.portintr = 1}; ++ retval |= dwc_otg_hcd_handle_port_intr(dwc_otg_hcd); ++ if (fiq_enable) { ++ local_fiq_disable(); ++ fiq_fsm_spin_lock(&dwc_otg_hcd->fiq_state->lock); ++ DWC_MODIFY_REG32(&dwc_otg_hcd->core_if->core_global_regs->gintmsk, 0, gintmsk.d32); ++ fiq_fsm_spin_unlock(&dwc_otg_hcd->fiq_state->lock); ++ local_fiq_enable(); ++ } else { ++ DWC_MODIFY_REG32(&dwc_otg_hcd->core_if->core_global_regs->gintmsk, 0, gintmsk.d32); ++ } ++ } ++ if (gintsts.b.hcintr) { ++ retval |= dwc_otg_hcd_handle_hc_intr(dwc_otg_hcd); ++ } ++ if (gintsts.b.ptxfempty) { ++ retval |= ++ dwc_otg_hcd_handle_perio_tx_fifo_empty_intr ++ (dwc_otg_hcd); ++ } ++#ifdef DEBUG ++#ifndef DEBUG_SOF ++ if (gintsts.d32 != DWC_SOF_INTR_MASK) ++#endif ++ { ++ DWC_DEBUGPL(DBG_HCDI, ++ "DWC OTG HCD Finished Servicing Interrupts\n"); ++ DWC_DEBUGPL(DBG_HCDV, "DWC OTG HCD gintsts=0x%08x\n", ++ DWC_READ_REG32(&global_regs->gintsts)); ++ DWC_DEBUGPL(DBG_HCDV, "DWC OTG HCD gintmsk=0x%08x\n", ++ DWC_READ_REG32(&global_regs->gintmsk)); ++ } ++#endif ++ ++#ifdef DEBUG ++#ifndef DEBUG_SOF ++ if (gintsts.d32 != DWC_SOF_INTR_MASK) ++#endif ++ DWC_DEBUGPL(DBG_HCDI, "\n"); ++#endif ++ ++ } ++ ++exit_handler_routine: ++ if (fiq_enable) { ++ gintmsk_data_t gintmsk_new; ++ haintmsk_data_t haintmsk_new; ++ local_fiq_disable(); ++ fiq_fsm_spin_lock(&dwc_otg_hcd->fiq_state->lock); ++ gintmsk_new.d32 = *(volatile uint32_t *)&dwc_otg_hcd->fiq_state->gintmsk_saved.d32; ++ if(fiq_fsm_enable) ++ haintmsk_new.d32 = *(volatile uint32_t *)&dwc_otg_hcd->fiq_state->haintmsk_saved.d32; ++ else ++ haintmsk_new.d32 = 0x0000FFFF; ++ ++ /* The FIQ could have sneaked another interrupt in. If so, don't clear MPHI */ ++ if ((gintmsk_new.d32 == ~0) && (haintmsk_new.d32 == 0x0000FFFF)) { ++ DWC_WRITE_REG32(dwc_otg_hcd->fiq_state->mphi_regs.intstat, (1<<16)); ++ if (dwc_otg_hcd->fiq_state->mphi_int_count >= 50) { ++ fiq_print(FIQDBG_INT, dwc_otg_hcd->fiq_state, "MPHI CLR"); ++ DWC_WRITE_REG32(dwc_otg_hcd->fiq_state->mphi_regs.ctrl, ((1<<31) + (1<<16))); ++ while (!(DWC_READ_REG32(dwc_otg_hcd->fiq_state->mphi_regs.ctrl) & (1 << 17))) ++ ; ++ DWC_WRITE_REG32(dwc_otg_hcd->fiq_state->mphi_regs.ctrl, (1<<31)); ++ dwc_otg_hcd->fiq_state->mphi_int_count = 0; ++ } ++ int_done++; ++ } ++ haintmsk.d32 = DWC_READ_REG32(&core_if->host_if->host_global_regs->haintmsk); ++ /* Re-enable interrupts that the FIQ masked (first time round) */ ++ FIQ_WRITE(dwc_otg_hcd->fiq_state->dwc_regs_base + GINTMSK, gintmsk.d32); ++ fiq_fsm_spin_unlock(&dwc_otg_hcd->fiq_state->lock); ++ local_fiq_enable(); ++ ++ if ((jiffies / HZ) > last_time) { ++ //dwc_otg_qh_t *qh; ++ //dwc_list_link_t *cur; ++ /* Once a second output the fiq and irq numbers, useful for debug */ ++ last_time = jiffies / HZ; ++ // DWC_WARN("np_kick=%d AHC=%d sched_frame=%d cur_frame=%d int_done=%d fiq_done=%d", ++ // dwc_otg_hcd->fiq_state->kick_np_queues, dwc_otg_hcd->available_host_channels, ++ // dwc_otg_hcd->fiq_state->next_sched_frame, hfnum.b.frnum, int_done, dwc_otg_hcd->fiq_state->fiq_done); ++ //printk(KERN_WARNING "Periodic queues:\n"); ++ } ++ } ++ ++ DWC_SPINUNLOCK(dwc_otg_hcd->lock); ++ return retval; ++} ++ ++#ifdef DWC_TRACK_MISSED_SOFS ++ ++#warning Compiling code to track missed SOFs ++#define FRAME_NUM_ARRAY_SIZE 1000 ++/** ++ * This function is for debug only. ++ */ ++static inline void track_missed_sofs(uint16_t curr_frame_number) ++{ ++ static uint16_t frame_num_array[FRAME_NUM_ARRAY_SIZE]; ++ static uint16_t last_frame_num_array[FRAME_NUM_ARRAY_SIZE]; ++ static int frame_num_idx = 0; ++ static uint16_t last_frame_num = DWC_HFNUM_MAX_FRNUM; ++ static int dumped_frame_num_array = 0; ++ ++ if (frame_num_idx < FRAME_NUM_ARRAY_SIZE) { ++ if (((last_frame_num + 1) & DWC_HFNUM_MAX_FRNUM) != ++ curr_frame_number) { ++ frame_num_array[frame_num_idx] = curr_frame_number; ++ last_frame_num_array[frame_num_idx++] = last_frame_num; ++ } ++ } else if (!dumped_frame_num_array) { ++ int i; ++ DWC_PRINTF("Frame Last Frame\n"); ++ DWC_PRINTF("----- ----------\n"); ++ for (i = 0; i < FRAME_NUM_ARRAY_SIZE; i++) { ++ DWC_PRINTF("0x%04x 0x%04x\n", ++ frame_num_array[i], last_frame_num_array[i]); ++ } ++ dumped_frame_num_array = 1; ++ } ++ last_frame_num = curr_frame_number; ++} ++#endif ++ ++/** ++ * Handles the start-of-frame interrupt in host mode. Non-periodic ++ * transactions may be queued to the DWC_otg controller for the current ++ * (micro)frame. Periodic transactions may be queued to the controller for the ++ * next (micro)frame. ++ */ ++int32_t dwc_otg_hcd_handle_sof_intr(dwc_otg_hcd_t * hcd) ++{ ++ hfnum_data_t hfnum; ++ gintsts_data_t gintsts = { .d32 = 0 }; ++ dwc_list_link_t *qh_entry; ++ dwc_otg_qh_t *qh; ++ dwc_otg_transaction_type_e tr_type; ++ int did_something = 0; ++ int32_t next_sched_frame = -1; ++ ++ hfnum.d32 = ++ DWC_READ_REG32(&hcd->core_if->host_if->host_global_regs->hfnum); ++ ++#ifdef DEBUG_SOF ++ DWC_DEBUGPL(DBG_HCD, "--Start of Frame Interrupt--\n"); ++#endif ++ hcd->frame_number = hfnum.b.frnum; ++ ++#ifdef DEBUG ++ hcd->frrem_accum += hfnum.b.frrem; ++ hcd->frrem_samples++; ++#endif ++ ++#ifdef DWC_TRACK_MISSED_SOFS ++ track_missed_sofs(hcd->frame_number); ++#endif ++ /* Determine whether any periodic QHs should be executed. */ ++ qh_entry = DWC_LIST_FIRST(&hcd->periodic_sched_inactive); ++ while (qh_entry != &hcd->periodic_sched_inactive) { ++ qh = DWC_LIST_ENTRY(qh_entry, dwc_otg_qh_t, qh_list_entry); ++ qh_entry = qh_entry->next; ++ if (dwc_frame_num_le(qh->sched_frame, hcd->frame_number)) { ++ ++ /* ++ * Move QH to the ready list to be executed next ++ * (micro)frame. ++ */ ++ DWC_LIST_MOVE_HEAD(&hcd->periodic_sched_ready, ++ &qh->qh_list_entry); ++ ++ did_something = 1; ++ } ++ else ++ { ++ if(next_sched_frame < 0 || dwc_frame_num_le(qh->sched_frame, next_sched_frame)) ++ { ++ next_sched_frame = qh->sched_frame; ++ } ++ } ++ } ++ if (fiq_enable) ++ hcd->fiq_state->next_sched_frame = next_sched_frame; ++ ++ tr_type = dwc_otg_hcd_select_transactions(hcd); ++ if (tr_type != DWC_OTG_TRANSACTION_NONE) { ++ dwc_otg_hcd_queue_transactions(hcd, tr_type); ++ did_something = 1; ++ } ++ ++ /* Clear interrupt - but do not trample on the FIQ sof */ ++ if (!fiq_fsm_enable) { ++ gintsts.b.sofintr = 1; ++ DWC_WRITE_REG32(&hcd->core_if->core_global_regs->gintsts, gintsts.d32); ++ } ++ return 1; ++} ++ ++/** Handles the Rx Status Queue Level Interrupt, which indicates that there is at ++ * least one packet in the Rx FIFO. The packets are moved from the FIFO to ++ * memory if the DWC_otg controller is operating in Slave mode. */ ++int32_t dwc_otg_hcd_handle_rx_status_q_level_intr(dwc_otg_hcd_t * dwc_otg_hcd) ++{ ++ host_grxsts_data_t grxsts; ++ dwc_hc_t *hc = NULL; ++ ++ DWC_DEBUGPL(DBG_HCD, "--RxStsQ Level Interrupt--\n"); ++ ++ grxsts.d32 = ++ DWC_READ_REG32(&dwc_otg_hcd->core_if->core_global_regs->grxstsp); ++ ++ hc = dwc_otg_hcd->hc_ptr_array[grxsts.b.chnum]; ++ if (!hc) { ++ DWC_ERROR("Unable to get corresponding channel\n"); ++ return 0; ++ } ++ ++ /* Packet Status */ ++ DWC_DEBUGPL(DBG_HCDV, " Ch num = %d\n", grxsts.b.chnum); ++ DWC_DEBUGPL(DBG_HCDV, " Count = %d\n", grxsts.b.bcnt); ++ DWC_DEBUGPL(DBG_HCDV, " DPID = %d, hc.dpid = %d\n", grxsts.b.dpid, ++ hc->data_pid_start); ++ DWC_DEBUGPL(DBG_HCDV, " PStatus = %d\n", grxsts.b.pktsts); ++ ++ switch (grxsts.b.pktsts) { ++ case DWC_GRXSTS_PKTSTS_IN: ++ /* Read the data into the host buffer. */ ++ if (grxsts.b.bcnt > 0) { ++ dwc_otg_read_packet(dwc_otg_hcd->core_if, ++ hc->xfer_buff, grxsts.b.bcnt); ++ ++ /* Update the HC fields for the next packet received. */ ++ hc->xfer_count += grxsts.b.bcnt; ++ hc->xfer_buff += grxsts.b.bcnt; ++ } ++ ++ case DWC_GRXSTS_PKTSTS_IN_XFER_COMP: ++ case DWC_GRXSTS_PKTSTS_DATA_TOGGLE_ERR: ++ case DWC_GRXSTS_PKTSTS_CH_HALTED: ++ /* Handled in interrupt, just ignore data */ ++ break; ++ default: ++ DWC_ERROR("RX_STS_Q Interrupt: Unknown status %d\n", ++ grxsts.b.pktsts); ++ break; ++ } ++ ++ return 1; ++} ++ ++/** This interrupt occurs when the non-periodic Tx FIFO is half-empty. More ++ * data packets may be written to the FIFO for OUT transfers. More requests ++ * may be written to the non-periodic request queue for IN transfers. This ++ * interrupt is enabled only in Slave mode. */ ++int32_t dwc_otg_hcd_handle_np_tx_fifo_empty_intr(dwc_otg_hcd_t * dwc_otg_hcd) ++{ ++ DWC_DEBUGPL(DBG_HCD, "--Non-Periodic TxFIFO Empty Interrupt--\n"); ++ dwc_otg_hcd_queue_transactions(dwc_otg_hcd, ++ DWC_OTG_TRANSACTION_NON_PERIODIC); ++ return 1; ++} ++ ++/** This interrupt occurs when the periodic Tx FIFO is half-empty. More data ++ * packets may be written to the FIFO for OUT transfers. More requests may be ++ * written to the periodic request queue for IN transfers. This interrupt is ++ * enabled only in Slave mode. */ ++int32_t dwc_otg_hcd_handle_perio_tx_fifo_empty_intr(dwc_otg_hcd_t * dwc_otg_hcd) ++{ ++ DWC_DEBUGPL(DBG_HCD, "--Periodic TxFIFO Empty Interrupt--\n"); ++ dwc_otg_hcd_queue_transactions(dwc_otg_hcd, ++ DWC_OTG_TRANSACTION_PERIODIC); ++ return 1; ++} ++ ++/** There are multiple conditions that can cause a port interrupt. This function ++ * determines which interrupt conditions have occurred and handles them ++ * appropriately. */ ++int32_t dwc_otg_hcd_handle_port_intr(dwc_otg_hcd_t * dwc_otg_hcd) ++{ ++ int retval = 0; ++ hprt0_data_t hprt0; ++ hprt0_data_t hprt0_modify; ++ ++ hprt0.d32 = DWC_READ_REG32(dwc_otg_hcd->core_if->host_if->hprt0); ++ hprt0_modify.d32 = DWC_READ_REG32(dwc_otg_hcd->core_if->host_if->hprt0); ++ ++ /* Clear appropriate bits in HPRT0 to clear the interrupt bit in ++ * GINTSTS */ ++ ++ hprt0_modify.b.prtena = 0; ++ hprt0_modify.b.prtconndet = 0; ++ hprt0_modify.b.prtenchng = 0; ++ hprt0_modify.b.prtovrcurrchng = 0; ++ ++ /* Port Connect Detected ++ * Set flag and clear if detected */ ++ if (dwc_otg_hcd->core_if->hibernation_suspend == 1) { ++ // Dont modify port status if we are in hibernation state ++ hprt0_modify.b.prtconndet = 1; ++ hprt0_modify.b.prtenchng = 1; ++ DWC_WRITE_REG32(dwc_otg_hcd->core_if->host_if->hprt0, hprt0_modify.d32); ++ hprt0.d32 = DWC_READ_REG32(dwc_otg_hcd->core_if->host_if->hprt0); ++ return retval; ++ } ++ ++ if (hprt0.b.prtconndet) { ++ /** @todo - check if steps performed in 'else' block should be perfromed regardles adp */ ++ if (dwc_otg_hcd->core_if->adp_enable && ++ dwc_otg_hcd->core_if->adp.vbuson_timer_started == 1) { ++ DWC_PRINTF("PORT CONNECT DETECTED ----------------\n"); ++ DWC_TIMER_CANCEL(dwc_otg_hcd->core_if->adp.vbuson_timer); ++ dwc_otg_hcd->core_if->adp.vbuson_timer_started = 0; ++ /* TODO - check if this is required, as ++ * host initialization was already performed ++ * after initial ADP probing ++ */ ++ /*dwc_otg_hcd->core_if->adp.vbuson_timer_started = 0; ++ dwc_otg_core_init(dwc_otg_hcd->core_if); ++ dwc_otg_enable_global_interrupts(dwc_otg_hcd->core_if); ++ cil_hcd_start(dwc_otg_hcd->core_if);*/ ++ } else { ++ ++ DWC_DEBUGPL(DBG_HCD, "--Port Interrupt HPRT0=0x%08x " ++ "Port Connect Detected--\n", hprt0.d32); ++ dwc_otg_hcd->flags.b.port_connect_status_change = 1; ++ dwc_otg_hcd->flags.b.port_connect_status = 1; ++ hprt0_modify.b.prtconndet = 1; ++ ++ /* B-Device has connected, Delete the connection timer. */ ++ DWC_TIMER_CANCEL(dwc_otg_hcd->conn_timer); ++ } ++ /* The Hub driver asserts a reset when it sees port connect ++ * status change flag */ ++ retval |= 1; ++ } ++ ++ /* Port Enable Changed ++ * Clear if detected - Set internal flag if disabled */ ++ if (hprt0.b.prtenchng) { ++ DWC_DEBUGPL(DBG_HCD, " --Port Interrupt HPRT0=0x%08x " ++ "Port Enable Changed--\n", hprt0.d32); ++ hprt0_modify.b.prtenchng = 1; ++ if (hprt0.b.prtena == 1) { ++ hfir_data_t hfir; ++ int do_reset = 0; ++ dwc_otg_core_params_t *params = ++ dwc_otg_hcd->core_if->core_params; ++ dwc_otg_core_global_regs_t *global_regs = ++ dwc_otg_hcd->core_if->core_global_regs; ++ dwc_otg_host_if_t *host_if = ++ dwc_otg_hcd->core_if->host_if; ++ ++ /* Every time when port enables calculate ++ * HFIR.FrInterval ++ */ ++ hfir.d32 = DWC_READ_REG32(&host_if->host_global_regs->hfir); ++ hfir.b.frint = calc_frame_interval(dwc_otg_hcd->core_if); ++ DWC_WRITE_REG32(&host_if->host_global_regs->hfir, hfir.d32); ++ ++ /* Check if we need to adjust the PHY clock speed for ++ * low power and adjust it */ ++ if (params->host_support_fs_ls_low_power) { ++ gusbcfg_data_t usbcfg; ++ ++ usbcfg.d32 = ++ DWC_READ_REG32(&global_regs->gusbcfg); ++ ++ if (hprt0.b.prtspd == DWC_HPRT0_PRTSPD_LOW_SPEED ++ || hprt0.b.prtspd == ++ DWC_HPRT0_PRTSPD_FULL_SPEED) { ++ /* ++ * Low power ++ */ ++ hcfg_data_t hcfg; ++ if (usbcfg.b.phylpwrclksel == 0) { ++ /* Set PHY low power clock select for FS/LS devices */ ++ usbcfg.b.phylpwrclksel = 1; ++ DWC_WRITE_REG32 ++ (&global_regs->gusbcfg, ++ usbcfg.d32); ++ do_reset = 1; ++ } ++ ++ hcfg.d32 = ++ DWC_READ_REG32 ++ (&host_if->host_global_regs->hcfg); ++ ++ if (hprt0.b.prtspd == ++ DWC_HPRT0_PRTSPD_LOW_SPEED ++ && params->host_ls_low_power_phy_clk ++ == ++ DWC_HOST_LS_LOW_POWER_PHY_CLK_PARAM_6MHZ) ++ { ++ /* 6 MHZ */ ++ DWC_DEBUGPL(DBG_CIL, ++ "FS_PHY programming HCFG to 6 MHz (Low Power)\n"); ++ if (hcfg.b.fslspclksel != ++ DWC_HCFG_6_MHZ) { ++ hcfg.b.fslspclksel = ++ DWC_HCFG_6_MHZ; ++ DWC_WRITE_REG32 ++ (&host_if->host_global_regs->hcfg, ++ hcfg.d32); ++ do_reset = 1; ++ } ++ } else { ++ /* 48 MHZ */ ++ DWC_DEBUGPL(DBG_CIL, ++ "FS_PHY programming HCFG to 48 MHz ()\n"); ++ if (hcfg.b.fslspclksel != ++ DWC_HCFG_48_MHZ) { ++ hcfg.b.fslspclksel = ++ DWC_HCFG_48_MHZ; ++ DWC_WRITE_REG32 ++ (&host_if->host_global_regs->hcfg, ++ hcfg.d32); ++ do_reset = 1; ++ } ++ } ++ } else { ++ /* ++ * Not low power ++ */ ++ if (usbcfg.b.phylpwrclksel == 1) { ++ usbcfg.b.phylpwrclksel = 0; ++ DWC_WRITE_REG32 ++ (&global_regs->gusbcfg, ++ usbcfg.d32); ++ do_reset = 1; ++ } ++ } ++ ++ if (do_reset) { ++ DWC_TASK_SCHEDULE(dwc_otg_hcd->reset_tasklet); ++ } ++ } ++ ++ if (!do_reset) { ++ /* Port has been enabled set the reset change flag */ ++ dwc_otg_hcd->flags.b.port_reset_change = 1; ++ } ++ } else { ++ dwc_otg_hcd->flags.b.port_enable_change = 1; ++ } ++ retval |= 1; ++ } ++ ++ /** Overcurrent Change Interrupt */ ++ if (hprt0.b.prtovrcurrchng) { ++ DWC_DEBUGPL(DBG_HCD, " --Port Interrupt HPRT0=0x%08x " ++ "Port Overcurrent Changed--\n", hprt0.d32); ++ dwc_otg_hcd->flags.b.port_over_current_change = 1; ++ hprt0_modify.b.prtovrcurrchng = 1; ++ retval |= 1; ++ } ++ ++ /* Clear Port Interrupts */ ++ DWC_WRITE_REG32(dwc_otg_hcd->core_if->host_if->hprt0, hprt0_modify.d32); ++ ++ return retval; ++} ++ ++/** This interrupt indicates that one or more host channels has a pending ++ * interrupt. There are multiple conditions that can cause each host channel ++ * interrupt. This function determines which conditions have occurred for each ++ * host channel interrupt and handles them appropriately. */ ++int32_t dwc_otg_hcd_handle_hc_intr(dwc_otg_hcd_t * dwc_otg_hcd) ++{ ++ int i; ++ int retval = 0; ++ haint_data_t haint = { .d32 = 0 } ; ++ ++ /* Clear appropriate bits in HCINTn to clear the interrupt bit in ++ * GINTSTS */ ++ ++ if (!fiq_fsm_enable) ++ haint.d32 = dwc_otg_read_host_all_channels_intr(dwc_otg_hcd->core_if); ++ ++ // Overwrite with saved interrupts from fiq handler ++ if(fiq_fsm_enable) ++ { ++ /* check the mask? */ ++ local_fiq_disable(); ++ fiq_fsm_spin_lock(&dwc_otg_hcd->fiq_state->lock); ++ haint.b2.chint |= ~(dwc_otg_hcd->fiq_state->haintmsk_saved.b2.chint); ++ dwc_otg_hcd->fiq_state->haintmsk_saved.b2.chint = ~0; ++ fiq_fsm_spin_unlock(&dwc_otg_hcd->fiq_state->lock); ++ local_fiq_enable(); ++ } ++ ++ for (i = 0; i < dwc_otg_hcd->core_if->core_params->host_channels; i++) { ++ if (haint.b2.chint & (1 << i)) { ++ retval |= dwc_otg_hcd_handle_hc_n_intr(dwc_otg_hcd, i); ++ } ++ } ++ ++ return retval; ++} ++ ++/** ++ * Gets the actual length of a transfer after the transfer halts. _halt_status ++ * holds the reason for the halt. ++ * ++ * For IN transfers where halt_status is DWC_OTG_HC_XFER_COMPLETE, ++ * *short_read is set to 1 upon return if less than the requested ++ * number of bytes were transferred. Otherwise, *short_read is set to 0 upon ++ * return. short_read may also be NULL on entry, in which case it remains ++ * unchanged. ++ */ ++static uint32_t get_actual_xfer_length(dwc_hc_t * hc, ++ dwc_otg_hc_regs_t * hc_regs, ++ dwc_otg_qtd_t * qtd, ++ dwc_otg_halt_status_e halt_status, ++ int *short_read) ++{ ++ hctsiz_data_t hctsiz; ++ uint32_t length; ++ ++ if (short_read != NULL) { ++ *short_read = 0; ++ } ++ hctsiz.d32 = DWC_READ_REG32(&hc_regs->hctsiz); ++ ++ if (halt_status == DWC_OTG_HC_XFER_COMPLETE) { ++ if (hc->ep_is_in) { ++ length = hc->xfer_len - hctsiz.b.xfersize; ++ if (short_read != NULL) { ++ *short_read = (hctsiz.b.xfersize != 0); ++ } ++ } else if (hc->qh->do_split) { ++ //length = split_out_xfersize[hc->hc_num]; ++ length = qtd->ssplit_out_xfer_count; ++ } else { ++ length = hc->xfer_len; ++ } ++ } else { ++ /* ++ * Must use the hctsiz.pktcnt field to determine how much data ++ * has been transferred. This field reflects the number of ++ * packets that have been transferred via the USB. This is ++ * always an integral number of packets if the transfer was ++ * halted before its normal completion. (Can't use the ++ * hctsiz.xfersize field because that reflects the number of ++ * bytes transferred via the AHB, not the USB). ++ */ ++ length = ++ (hc->start_pkt_count - hctsiz.b.pktcnt) * hc->max_packet; ++ } ++ ++ return length; ++} ++ ++/** ++ * Updates the state of the URB after a Transfer Complete interrupt on the ++ * host channel. Updates the actual_length field of the URB based on the ++ * number of bytes transferred via the host channel. Sets the URB status ++ * if the data transfer is finished. ++ * ++ * @return 1 if the data transfer specified by the URB is completely finished, ++ * 0 otherwise. ++ */ ++static int update_urb_state_xfer_comp(dwc_hc_t * hc, ++ dwc_otg_hc_regs_t * hc_regs, ++ dwc_otg_hcd_urb_t * urb, ++ dwc_otg_qtd_t * qtd) ++{ ++ int xfer_done = 0; ++ int short_read = 0; ++ ++ int xfer_length; ++ ++ xfer_length = get_actual_xfer_length(hc, hc_regs, qtd, ++ DWC_OTG_HC_XFER_COMPLETE, ++ &short_read); ++ ++ if (urb->actual_length + xfer_length > urb->length) { ++ printk_once(KERN_DEBUG "dwc_otg: DEVICE:%03d : %s:%d:trimming xfer length\n", ++ hc->dev_addr, __func__, __LINE__); ++ xfer_length = urb->length - urb->actual_length; ++ } ++ ++ /* non DWORD-aligned buffer case handling. */ ++ if (hc->align_buff && xfer_length && hc->ep_is_in) { ++ dwc_memcpy(urb->buf + urb->actual_length, hc->qh->dw_align_buf, ++ xfer_length); ++ } ++ ++ urb->actual_length += xfer_length; ++ ++ if (xfer_length && (hc->ep_type == DWC_OTG_EP_TYPE_BULK) && ++ (urb->flags & URB_SEND_ZERO_PACKET) ++ && (urb->actual_length == urb->length) ++ && !(urb->length % hc->max_packet)) { ++ xfer_done = 0; ++ } else if (short_read || urb->actual_length >= urb->length) { ++ xfer_done = 1; ++ urb->status = 0; ++ } ++ ++#ifdef DEBUG ++ { ++ hctsiz_data_t hctsiz; ++ hctsiz.d32 = DWC_READ_REG32(&hc_regs->hctsiz); ++ DWC_DEBUGPL(DBG_HCDV, "DWC_otg: %s: %s, channel %d\n", ++ __func__, (hc->ep_is_in ? "IN" : "OUT"), ++ hc->hc_num); ++ DWC_DEBUGPL(DBG_HCDV, " hc->xfer_len %d\n", hc->xfer_len); ++ DWC_DEBUGPL(DBG_HCDV, " hctsiz.xfersize %d\n", ++ hctsiz.b.xfersize); ++ DWC_DEBUGPL(DBG_HCDV, " urb->transfer_buffer_length %d\n", ++ urb->length); ++ DWC_DEBUGPL(DBG_HCDV, " urb->actual_length %d\n", ++ urb->actual_length); ++ DWC_DEBUGPL(DBG_HCDV, " short_read %d, xfer_done %d\n", ++ short_read, xfer_done); ++ } ++#endif ++ ++ return xfer_done; ++} ++ ++/* ++ * Save the starting data toggle for the next transfer. The data toggle is ++ * saved in the QH for non-control transfers and it's saved in the QTD for ++ * control transfers. ++ */ ++void dwc_otg_hcd_save_data_toggle(dwc_hc_t * hc, ++ dwc_otg_hc_regs_t * hc_regs, dwc_otg_qtd_t * qtd) ++{ ++ hctsiz_data_t hctsiz; ++ hctsiz.d32 = DWC_READ_REG32(&hc_regs->hctsiz); ++ ++ if (hc->ep_type != DWC_OTG_EP_TYPE_CONTROL) { ++ dwc_otg_qh_t *qh = hc->qh; ++ if (hctsiz.b.pid == DWC_HCTSIZ_DATA0) { ++ qh->data_toggle = DWC_OTG_HC_PID_DATA0; ++ } else { ++ qh->data_toggle = DWC_OTG_HC_PID_DATA1; ++ } ++ } else { ++ if (hctsiz.b.pid == DWC_HCTSIZ_DATA0) { ++ qtd->data_toggle = DWC_OTG_HC_PID_DATA0; ++ } else { ++ qtd->data_toggle = DWC_OTG_HC_PID_DATA1; ++ } ++ } ++} ++ ++/** ++ * Updates the state of an Isochronous URB when the transfer is stopped for ++ * any reason. The fields of the current entry in the frame descriptor array ++ * are set based on the transfer state and the input _halt_status. Completes ++ * the Isochronous URB if all the URB frames have been completed. ++ * ++ * @return DWC_OTG_HC_XFER_COMPLETE if there are more frames remaining to be ++ * transferred in the URB. Otherwise return DWC_OTG_HC_XFER_URB_COMPLETE. ++ */ ++static dwc_otg_halt_status_e ++update_isoc_urb_state(dwc_otg_hcd_t * hcd, ++ dwc_hc_t * hc, ++ dwc_otg_hc_regs_t * hc_regs, ++ dwc_otg_qtd_t * qtd, dwc_otg_halt_status_e halt_status) ++{ ++ dwc_otg_hcd_urb_t *urb = qtd->urb; ++ dwc_otg_halt_status_e ret_val = halt_status; ++ struct dwc_otg_hcd_iso_packet_desc *frame_desc; ++ ++ frame_desc = &urb->iso_descs[qtd->isoc_frame_index]; ++ switch (halt_status) { ++ case DWC_OTG_HC_XFER_COMPLETE: ++ frame_desc->status = 0; ++ frame_desc->actual_length = ++ get_actual_xfer_length(hc, hc_regs, qtd, halt_status, NULL); ++ ++ /* non DWORD-aligned buffer case handling. */ ++ if (hc->align_buff && frame_desc->actual_length && hc->ep_is_in) { ++ dwc_memcpy(urb->buf + frame_desc->offset + qtd->isoc_split_offset, ++ hc->qh->dw_align_buf, frame_desc->actual_length); ++ } ++ ++ break; ++ case DWC_OTG_HC_XFER_FRAME_OVERRUN: ++ urb->error_count++; ++ if (hc->ep_is_in) { ++ frame_desc->status = -DWC_E_NO_STREAM_RES; ++ } else { ++ frame_desc->status = -DWC_E_COMMUNICATION; ++ } ++ frame_desc->actual_length = 0; ++ break; ++ case DWC_OTG_HC_XFER_BABBLE_ERR: ++ urb->error_count++; ++ frame_desc->status = -DWC_E_OVERFLOW; ++ /* Don't need to update actual_length in this case. */ ++ break; ++ case DWC_OTG_HC_XFER_XACT_ERR: ++ urb->error_count++; ++ frame_desc->status = -DWC_E_PROTOCOL; ++ frame_desc->actual_length = ++ get_actual_xfer_length(hc, hc_regs, qtd, halt_status, NULL); ++ ++ /* non DWORD-aligned buffer case handling. */ ++ if (hc->align_buff && frame_desc->actual_length && hc->ep_is_in) { ++ dwc_memcpy(urb->buf + frame_desc->offset + qtd->isoc_split_offset, ++ hc->qh->dw_align_buf, frame_desc->actual_length); ++ } ++ /* Skip whole frame */ ++ if (hc->qh->do_split && (hc->ep_type == DWC_OTG_EP_TYPE_ISOC) && ++ hc->ep_is_in && hcd->core_if->dma_enable) { ++ qtd->complete_split = 0; ++ qtd->isoc_split_offset = 0; ++ } ++ ++ break; ++ default: ++ DWC_ASSERT(1, "Unhandled _halt_status (%d)\n", halt_status); ++ break; ++ } ++ if (++qtd->isoc_frame_index == urb->packet_count) { ++ /* ++ * urb->status is not used for isoc transfers. ++ * The individual frame_desc statuses are used instead. ++ */ ++ hcd->fops->complete(hcd, urb->priv, urb, 0); ++ ret_val = DWC_OTG_HC_XFER_URB_COMPLETE; ++ } else { ++ ret_val = DWC_OTG_HC_XFER_COMPLETE; ++ } ++ return ret_val; ++} ++ ++/** ++ * Frees the first QTD in the QH's list if free_qtd is 1. For non-periodic ++ * QHs, removes the QH from the active non-periodic schedule. If any QTDs are ++ * still linked to the QH, the QH is added to the end of the inactive ++ * non-periodic schedule. For periodic QHs, removes the QH from the periodic ++ * schedule if no more QTDs are linked to the QH. ++ */ ++static void deactivate_qh(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh, int free_qtd) ++{ ++ int continue_split = 0; ++ dwc_otg_qtd_t *qtd; ++ ++ DWC_DEBUGPL(DBG_HCDV, " %s(%p,%p,%d)\n", __func__, hcd, qh, free_qtd); ++ ++ qtd = DWC_CIRCLEQ_FIRST(&qh->qtd_list); ++ ++ if (qtd->complete_split) { ++ continue_split = 1; ++ } else if (qtd->isoc_split_pos == DWC_HCSPLIT_XACTPOS_MID || ++ qtd->isoc_split_pos == DWC_HCSPLIT_XACTPOS_END) { ++ continue_split = 1; ++ } ++ ++ if (free_qtd) { ++ dwc_otg_hcd_qtd_remove_and_free(hcd, qtd, qh); ++ continue_split = 0; ++ } ++ ++ qh->channel = NULL; ++ dwc_otg_hcd_qh_deactivate(hcd, qh, continue_split); ++} ++ ++/** ++ * Releases a host channel for use by other transfers. Attempts to select and ++ * queue more transactions since at least one host channel is available. ++ * ++ * @param hcd The HCD state structure. ++ * @param hc The host channel to release. ++ * @param qtd The QTD associated with the host channel. This QTD may be freed ++ * if the transfer is complete or an error has occurred. ++ * @param halt_status Reason the channel is being released. This status ++ * determines the actions taken by this function. ++ */ ++static void release_channel(dwc_otg_hcd_t * hcd, ++ dwc_hc_t * hc, ++ dwc_otg_qtd_t * qtd, ++ dwc_otg_halt_status_e halt_status) ++{ ++ dwc_otg_transaction_type_e tr_type; ++ int free_qtd; ++ dwc_irqflags_t flags; ++ dwc_spinlock_t *channel_lock = hcd->channel_lock; ++ ++ int hog_port = 0; ++ ++ DWC_DEBUGPL(DBG_HCDV, " %s: channel %d, halt_status %d, xfer_len %d\n", ++ __func__, hc->hc_num, halt_status, hc->xfer_len); ++ ++ if(fiq_fsm_enable && hc->do_split) { ++ if(!hc->ep_is_in && hc->ep_type == UE_ISOCHRONOUS) { ++ if(hc->xact_pos == DWC_HCSPLIT_XACTPOS_MID || ++ hc->xact_pos == DWC_HCSPLIT_XACTPOS_BEGIN) { ++ hog_port = 0; ++ } ++ } ++ } ++ ++ switch (halt_status) { ++ case DWC_OTG_HC_XFER_URB_COMPLETE: ++ free_qtd = 1; ++ break; ++ case DWC_OTG_HC_XFER_AHB_ERR: ++ case DWC_OTG_HC_XFER_STALL: ++ case DWC_OTG_HC_XFER_BABBLE_ERR: ++ free_qtd = 1; ++ break; ++ case DWC_OTG_HC_XFER_XACT_ERR: ++ if (qtd->error_count >= 3) { ++ DWC_DEBUGPL(DBG_HCDV, ++ " Complete URB with transaction error\n"); ++ free_qtd = 1; ++ qtd->urb->status = -DWC_E_PROTOCOL; ++ hcd->fops->complete(hcd, qtd->urb->priv, ++ qtd->urb, -DWC_E_PROTOCOL); ++ } else { ++ free_qtd = 0; ++ } ++ break; ++ case DWC_OTG_HC_XFER_URB_DEQUEUE: ++ /* ++ * The QTD has already been removed and the QH has been ++ * deactivated. Don't want to do anything except release the ++ * host channel and try to queue more transfers. ++ */ ++ goto cleanup; ++ case DWC_OTG_HC_XFER_NO_HALT_STATUS: ++ free_qtd = 0; ++ break; ++ case DWC_OTG_HC_XFER_PERIODIC_INCOMPLETE: ++ DWC_DEBUGPL(DBG_HCDV, ++ " Complete URB with I/O error\n"); ++ free_qtd = 1; ++ qtd->urb->status = -DWC_E_IO; ++ hcd->fops->complete(hcd, qtd->urb->priv, ++ qtd->urb, -DWC_E_IO); ++ break; ++ default: ++ free_qtd = 0; ++ break; ++ } ++ ++ deactivate_qh(hcd, hc->qh, free_qtd); ++ ++cleanup: ++ /* ++ * Release the host channel for use by other transfers. The cleanup ++ * function clears the channel interrupt enables and conditions, so ++ * there's no need to clear the Channel Halted interrupt separately. ++ */ ++ if (fiq_fsm_enable && hcd->fiq_state->channel[hc->hc_num].fsm != FIQ_PASSTHROUGH) ++ dwc_otg_cleanup_fiq_channel(hcd, hc->hc_num); ++ dwc_otg_hc_cleanup(hcd->core_if, hc); ++ DWC_CIRCLEQ_INSERT_TAIL(&hcd->free_hc_list, hc, hc_list_entry); ++ ++ if (!microframe_schedule) { ++ switch (hc->ep_type) { ++ case DWC_OTG_EP_TYPE_CONTROL: ++ case DWC_OTG_EP_TYPE_BULK: ++ hcd->non_periodic_channels--; ++ break; ++ ++ default: ++ /* ++ * Don't release reservations for periodic channels here. ++ * That's done when a periodic transfer is descheduled (i.e. ++ * when the QH is removed from the periodic schedule). ++ */ ++ break; ++ } ++ } else { ++ ++ DWC_SPINLOCK_IRQSAVE(channel_lock, &flags); ++ hcd->available_host_channels++; ++ fiq_print(FIQDBG_INT, hcd->fiq_state, "AHC = %d ", hcd->available_host_channels); ++ DWC_SPINUNLOCK_IRQRESTORE(channel_lock, flags); ++ } ++ ++ /* Try to queue more transfers now that there's a free channel. */ ++ tr_type = dwc_otg_hcd_select_transactions(hcd); ++ if (tr_type != DWC_OTG_TRANSACTION_NONE) { ++ dwc_otg_hcd_queue_transactions(hcd, tr_type); ++ } ++} ++ ++/** ++ * Halts a host channel. If the channel cannot be halted immediately because ++ * the request queue is full, this function ensures that the FIFO empty ++ * interrupt for the appropriate queue is enabled so that the halt request can ++ * be queued when there is space in the request queue. ++ * ++ * This function may also be called in DMA mode. In that case, the channel is ++ * simply released since the core always halts the channel automatically in ++ * DMA mode. ++ */ ++static void halt_channel(dwc_otg_hcd_t * hcd, ++ dwc_hc_t * hc, ++ dwc_otg_qtd_t * qtd, dwc_otg_halt_status_e halt_status) ++{ ++ if (hcd->core_if->dma_enable) { ++ release_channel(hcd, hc, qtd, halt_status); ++ return; ++ } ++ ++ /* Slave mode processing... */ ++ dwc_otg_hc_halt(hcd->core_if, hc, halt_status); ++ ++ if (hc->halt_on_queue) { ++ gintmsk_data_t gintmsk = {.d32 = 0 }; ++ dwc_otg_core_global_regs_t *global_regs; ++ global_regs = hcd->core_if->core_global_regs; ++ ++ if (hc->ep_type == DWC_OTG_EP_TYPE_CONTROL || ++ hc->ep_type == DWC_OTG_EP_TYPE_BULK) { ++ /* ++ * Make sure the Non-periodic Tx FIFO empty interrupt ++ * is enabled so that the non-periodic schedule will ++ * be processed. ++ */ ++ gintmsk.b.nptxfempty = 1; ++ if (fiq_enable) { ++ local_fiq_disable(); ++ fiq_fsm_spin_lock(&hcd->fiq_state->lock); ++ DWC_MODIFY_REG32(&global_regs->gintmsk, 0, gintmsk.d32); ++ fiq_fsm_spin_unlock(&hcd->fiq_state->lock); ++ local_fiq_enable(); ++ } else { ++ DWC_MODIFY_REG32(&global_regs->gintmsk, 0, gintmsk.d32); ++ } ++ } else { ++ /* ++ * Move the QH from the periodic queued schedule to ++ * the periodic assigned schedule. This allows the ++ * halt to be queued when the periodic schedule is ++ * processed. ++ */ ++ DWC_LIST_MOVE_HEAD(&hcd->periodic_sched_assigned, ++ &hc->qh->qh_list_entry); ++ ++ /* ++ * Make sure the Periodic Tx FIFO Empty interrupt is ++ * enabled so that the periodic schedule will be ++ * processed. ++ */ ++ gintmsk.b.ptxfempty = 1; ++ if (fiq_enable) { ++ local_fiq_disable(); ++ fiq_fsm_spin_lock(&hcd->fiq_state->lock); ++ DWC_MODIFY_REG32(&global_regs->gintmsk, 0, gintmsk.d32); ++ fiq_fsm_spin_unlock(&hcd->fiq_state->lock); ++ local_fiq_enable(); ++ } else { ++ DWC_MODIFY_REG32(&global_regs->gintmsk, 0, gintmsk.d32); ++ } ++ } ++ } ++} ++ ++/** ++ * Performs common cleanup for non-periodic transfers after a Transfer ++ * Complete interrupt. This function should be called after any endpoint type ++ * specific handling is finished to release the host channel. ++ */ ++static void complete_non_periodic_xfer(dwc_otg_hcd_t * hcd, ++ dwc_hc_t * hc, ++ dwc_otg_hc_regs_t * hc_regs, ++ dwc_otg_qtd_t * qtd, ++ dwc_otg_halt_status_e halt_status) ++{ ++ hcint_data_t hcint; ++ ++ qtd->error_count = 0; ++ ++ hcint.d32 = DWC_READ_REG32(&hc_regs->hcint); ++ if (hcint.b.nyet) { ++ /* ++ * Got a NYET on the last transaction of the transfer. This ++ * means that the endpoint should be in the PING state at the ++ * beginning of the next transfer. ++ */ ++ hc->qh->ping_state = 1; ++ clear_hc_int(hc_regs, nyet); ++ } ++ ++ /* ++ * Always halt and release the host channel to make it available for ++ * more transfers. There may still be more phases for a control ++ * transfer or more data packets for a bulk transfer at this point, ++ * but the host channel is still halted. A channel will be reassigned ++ * to the transfer when the non-periodic schedule is processed after ++ * the channel is released. This allows transactions to be queued ++ * properly via dwc_otg_hcd_queue_transactions, which also enables the ++ * Tx FIFO Empty interrupt if necessary. ++ */ ++ if (hc->ep_is_in) { ++ /* ++ * IN transfers in Slave mode require an explicit disable to ++ * halt the channel. (In DMA mode, this call simply releases ++ * the channel.) ++ */ ++ halt_channel(hcd, hc, qtd, halt_status); ++ } else { ++ /* ++ * The channel is automatically disabled by the core for OUT ++ * transfers in Slave mode. ++ */ ++ release_channel(hcd, hc, qtd, halt_status); ++ } ++} ++ ++/** ++ * Performs common cleanup for periodic transfers after a Transfer Complete ++ * interrupt. This function should be called after any endpoint type specific ++ * handling is finished to release the host channel. ++ */ ++static void complete_periodic_xfer(dwc_otg_hcd_t * hcd, ++ dwc_hc_t * hc, ++ dwc_otg_hc_regs_t * hc_regs, ++ dwc_otg_qtd_t * qtd, ++ dwc_otg_halt_status_e halt_status) ++{ ++ hctsiz_data_t hctsiz; ++ qtd->error_count = 0; ++ ++ hctsiz.d32 = DWC_READ_REG32(&hc_regs->hctsiz); ++ if (!hc->ep_is_in || hctsiz.b.pktcnt == 0) { ++ /* Core halts channel in these cases. */ ++ release_channel(hcd, hc, qtd, halt_status); ++ } else { ++ /* Flush any outstanding requests from the Tx queue. */ ++ halt_channel(hcd, hc, qtd, halt_status); ++ } ++} ++ ++static int32_t handle_xfercomp_isoc_split_in(dwc_otg_hcd_t * hcd, ++ dwc_hc_t * hc, ++ dwc_otg_hc_regs_t * hc_regs, ++ dwc_otg_qtd_t * qtd) ++{ ++ uint32_t len; ++ struct dwc_otg_hcd_iso_packet_desc *frame_desc; ++ frame_desc = &qtd->urb->iso_descs[qtd->isoc_frame_index]; ++ ++ len = get_actual_xfer_length(hc, hc_regs, qtd, ++ DWC_OTG_HC_XFER_COMPLETE, NULL); ++ ++ if (!len) { ++ qtd->complete_split = 0; ++ qtd->isoc_split_offset = 0; ++ return 0; ++ } ++ frame_desc->actual_length += len; ++ ++ if (hc->align_buff && len) ++ dwc_memcpy(qtd->urb->buf + frame_desc->offset + ++ qtd->isoc_split_offset, hc->qh->dw_align_buf, len); ++ qtd->isoc_split_offset += len; ++ ++ if (frame_desc->length == frame_desc->actual_length) { ++ frame_desc->status = 0; ++ qtd->isoc_frame_index++; ++ qtd->complete_split = 0; ++ qtd->isoc_split_offset = 0; ++ } ++ ++ if (qtd->isoc_frame_index == qtd->urb->packet_count) { ++ hcd->fops->complete(hcd, qtd->urb->priv, qtd->urb, 0); ++ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_URB_COMPLETE); ++ } else { ++ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_NO_HALT_STATUS); ++ } ++ ++ return 1; /* Indicates that channel released */ ++} ++ ++/** ++ * Handles a host channel Transfer Complete interrupt. This handler may be ++ * called in either DMA mode or Slave mode. ++ */ ++static int32_t handle_hc_xfercomp_intr(dwc_otg_hcd_t * hcd, ++ dwc_hc_t * hc, ++ dwc_otg_hc_regs_t * hc_regs, ++ dwc_otg_qtd_t * qtd) ++{ ++ int urb_xfer_done; ++ dwc_otg_halt_status_e halt_status = DWC_OTG_HC_XFER_COMPLETE; ++ dwc_otg_hcd_urb_t *urb = qtd->urb; ++ int pipe_type = dwc_otg_hcd_get_pipe_type(&urb->pipe_info); ++ ++ DWC_DEBUGPL(DBG_HCDI, "--Host Channel %d Interrupt: " ++ "Transfer Complete--\n", hc->hc_num); ++ ++ if (hcd->core_if->dma_desc_enable) { ++ dwc_otg_hcd_complete_xfer_ddma(hcd, hc, hc_regs, halt_status); ++ if (pipe_type == UE_ISOCHRONOUS) { ++ /* Do not disable the interrupt, just clear it */ ++ clear_hc_int(hc_regs, xfercomp); ++ return 1; ++ } ++ goto handle_xfercomp_done; ++ } ++ ++ /* ++ * Handle xfer complete on CSPLIT. ++ */ ++ ++ if (hc->qh->do_split) { ++ if ((hc->ep_type == DWC_OTG_EP_TYPE_ISOC) && hc->ep_is_in ++ && hcd->core_if->dma_enable) { ++ if (qtd->complete_split ++ && handle_xfercomp_isoc_split_in(hcd, hc, hc_regs, ++ qtd)) ++ goto handle_xfercomp_done; ++ } else { ++ qtd->complete_split = 0; ++ } ++ } ++ ++ /* Update the QTD and URB states. */ ++ switch (pipe_type) { ++ case UE_CONTROL: ++ switch (qtd->control_phase) { ++ case DWC_OTG_CONTROL_SETUP: ++ if (urb->length > 0) { ++ qtd->control_phase = DWC_OTG_CONTROL_DATA; ++ } else { ++ qtd->control_phase = DWC_OTG_CONTROL_STATUS; ++ } ++ DWC_DEBUGPL(DBG_HCDV, ++ " Control setup transaction done\n"); ++ halt_status = DWC_OTG_HC_XFER_COMPLETE; ++ break; ++ case DWC_OTG_CONTROL_DATA:{ ++ urb_xfer_done = ++ update_urb_state_xfer_comp(hc, hc_regs, urb, ++ qtd); ++ if (urb_xfer_done) { ++ qtd->control_phase = ++ DWC_OTG_CONTROL_STATUS; ++ DWC_DEBUGPL(DBG_HCDV, ++ " Control data transfer done\n"); ++ } else { ++ dwc_otg_hcd_save_data_toggle(hc, hc_regs, qtd); ++ } ++ halt_status = DWC_OTG_HC_XFER_COMPLETE; ++ break; ++ } ++ case DWC_OTG_CONTROL_STATUS: ++ DWC_DEBUGPL(DBG_HCDV, " Control transfer complete\n"); ++ if (urb->status == -DWC_E_IN_PROGRESS) { ++ urb->status = 0; ++ } ++ hcd->fops->complete(hcd, urb->priv, urb, urb->status); ++ halt_status = DWC_OTG_HC_XFER_URB_COMPLETE; ++ break; ++ } ++ ++ complete_non_periodic_xfer(hcd, hc, hc_regs, qtd, halt_status); ++ break; ++ case UE_BULK: ++ DWC_DEBUGPL(DBG_HCDV, " Bulk transfer complete\n"); ++ urb_xfer_done = ++ update_urb_state_xfer_comp(hc, hc_regs, urb, qtd); ++ if (urb_xfer_done) { ++ hcd->fops->complete(hcd, urb->priv, urb, urb->status); ++ halt_status = DWC_OTG_HC_XFER_URB_COMPLETE; ++ } else { ++ halt_status = DWC_OTG_HC_XFER_COMPLETE; ++ } ++ ++ dwc_otg_hcd_save_data_toggle(hc, hc_regs, qtd); ++ complete_non_periodic_xfer(hcd, hc, hc_regs, qtd, halt_status); ++ break; ++ case UE_INTERRUPT: ++ DWC_DEBUGPL(DBG_HCDV, " Interrupt transfer complete\n"); ++ urb_xfer_done = ++ update_urb_state_xfer_comp(hc, hc_regs, urb, qtd); ++ ++ /* ++ * Interrupt URB is done on the first transfer complete ++ * interrupt. ++ */ ++ if (urb_xfer_done) { ++ hcd->fops->complete(hcd, urb->priv, urb, urb->status); ++ halt_status = DWC_OTG_HC_XFER_URB_COMPLETE; ++ } else { ++ halt_status = DWC_OTG_HC_XFER_COMPLETE; ++ } ++ ++ dwc_otg_hcd_save_data_toggle(hc, hc_regs, qtd); ++ complete_periodic_xfer(hcd, hc, hc_regs, qtd, halt_status); ++ break; ++ case UE_ISOCHRONOUS: ++ DWC_DEBUGPL(DBG_HCDV, " Isochronous transfer complete\n"); ++ if (qtd->isoc_split_pos == DWC_HCSPLIT_XACTPOS_ALL) { ++ halt_status = ++ update_isoc_urb_state(hcd, hc, hc_regs, qtd, ++ DWC_OTG_HC_XFER_COMPLETE); ++ } ++ complete_periodic_xfer(hcd, hc, hc_regs, qtd, halt_status); ++ break; ++ } ++ ++handle_xfercomp_done: ++ disable_hc_int(hc_regs, xfercompl); ++ ++ return 1; ++} ++ ++/** ++ * Handles a host channel STALL interrupt. This handler may be called in ++ * either DMA mode or Slave mode. ++ */ ++static int32_t handle_hc_stall_intr(dwc_otg_hcd_t * hcd, ++ dwc_hc_t * hc, ++ dwc_otg_hc_regs_t * hc_regs, ++ dwc_otg_qtd_t * qtd) ++{ ++ dwc_otg_hcd_urb_t *urb = qtd->urb; ++ int pipe_type = dwc_otg_hcd_get_pipe_type(&urb->pipe_info); ++ ++ DWC_DEBUGPL(DBG_HCD, "--Host Channel %d Interrupt: " ++ "STALL Received--\n", hc->hc_num); ++ ++ if (hcd->core_if->dma_desc_enable) { ++ dwc_otg_hcd_complete_xfer_ddma(hcd, hc, hc_regs, DWC_OTG_HC_XFER_STALL); ++ goto handle_stall_done; ++ } ++ ++ if (pipe_type == UE_CONTROL) { ++ hcd->fops->complete(hcd, urb->priv, urb, -DWC_E_PIPE); ++ } ++ ++ if (pipe_type == UE_BULK || pipe_type == UE_INTERRUPT) { ++ hcd->fops->complete(hcd, urb->priv, urb, -DWC_E_PIPE); ++ /* ++ * USB protocol requires resetting the data toggle for bulk ++ * and interrupt endpoints when a CLEAR_FEATURE(ENDPOINT_HALT) ++ * setup command is issued to the endpoint. Anticipate the ++ * CLEAR_FEATURE command since a STALL has occurred and reset ++ * the data toggle now. ++ */ ++ hc->qh->data_toggle = 0; ++ } ++ ++ halt_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_STALL); ++ ++handle_stall_done: ++ disable_hc_int(hc_regs, stall); ++ ++ return 1; ++} ++ ++/* ++ * Updates the state of the URB when a transfer has been stopped due to an ++ * abnormal condition before the transfer completes. Modifies the ++ * actual_length field of the URB to reflect the number of bytes that have ++ * actually been transferred via the host channel. ++ */ ++static void update_urb_state_xfer_intr(dwc_hc_t * hc, ++ dwc_otg_hc_regs_t * hc_regs, ++ dwc_otg_hcd_urb_t * urb, ++ dwc_otg_qtd_t * qtd, ++ dwc_otg_halt_status_e halt_status) ++{ ++ uint32_t bytes_transferred = get_actual_xfer_length(hc, hc_regs, qtd, ++ halt_status, NULL); ++ ++ if (urb->actual_length + bytes_transferred > urb->length) { ++ printk_once(KERN_DEBUG "dwc_otg: DEVICE:%03d : %s:%d:trimming xfer length\n", ++ hc->dev_addr, __func__, __LINE__); ++ bytes_transferred = urb->length - urb->actual_length; ++ } ++ ++ /* non DWORD-aligned buffer case handling. */ ++ if (hc->align_buff && bytes_transferred && hc->ep_is_in) { ++ dwc_memcpy(urb->buf + urb->actual_length, hc->qh->dw_align_buf, ++ bytes_transferred); ++ } ++ ++ urb->actual_length += bytes_transferred; ++ ++#ifdef DEBUG ++ { ++ hctsiz_data_t hctsiz; ++ hctsiz.d32 = DWC_READ_REG32(&hc_regs->hctsiz); ++ DWC_DEBUGPL(DBG_HCDV, "DWC_otg: %s: %s, channel %d\n", ++ __func__, (hc->ep_is_in ? "IN" : "OUT"), ++ hc->hc_num); ++ DWC_DEBUGPL(DBG_HCDV, " hc->start_pkt_count %d\n", ++ hc->start_pkt_count); ++ DWC_DEBUGPL(DBG_HCDV, " hctsiz.pktcnt %d\n", hctsiz.b.pktcnt); ++ DWC_DEBUGPL(DBG_HCDV, " hc->max_packet %d\n", hc->max_packet); ++ DWC_DEBUGPL(DBG_HCDV, " bytes_transferred %d\n", ++ bytes_transferred); ++ DWC_DEBUGPL(DBG_HCDV, " urb->actual_length %d\n", ++ urb->actual_length); ++ DWC_DEBUGPL(DBG_HCDV, " urb->transfer_buffer_length %d\n", ++ urb->length); ++ } ++#endif ++} ++ ++/** ++ * Handles a host channel NAK interrupt. This handler may be called in either ++ * DMA mode or Slave mode. ++ */ ++static int32_t handle_hc_nak_intr(dwc_otg_hcd_t * hcd, ++ dwc_hc_t * hc, ++ dwc_otg_hc_regs_t * hc_regs, ++ dwc_otg_qtd_t * qtd) ++{ ++ DWC_DEBUGPL(DBG_HCDI, "--Host Channel %d Interrupt: " ++ "NAK Received--\n", hc->hc_num); ++ ++ /* ++ * When we get bulk NAKs then remember this so we holdoff on this qh until ++ * the beginning of the next frame ++ */ ++ switch(dwc_otg_hcd_get_pipe_type(&qtd->urb->pipe_info)) { ++ case UE_BULK: ++ case UE_CONTROL: ++ if (nak_holdoff && qtd->qh->do_split) ++ hc->qh->nak_frame = dwc_otg_hcd_get_frame_number(hcd); ++ } ++ ++ /* ++ * Handle NAK for IN/OUT SSPLIT/CSPLIT transfers, bulk, control, and ++ * interrupt. Re-start the SSPLIT transfer. ++ */ ++ if (hc->do_split) { ++ if (hc->complete_split) { ++ qtd->error_count = 0; ++ } ++ qtd->complete_split = 0; ++ halt_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_NAK); ++ goto handle_nak_done; ++ } ++ ++ switch (dwc_otg_hcd_get_pipe_type(&qtd->urb->pipe_info)) { ++ case UE_CONTROL: ++ case UE_BULK: ++ if (hcd->core_if->dma_enable && hc->ep_is_in) { ++ /* ++ * NAK interrupts are enabled on bulk/control IN ++ * transfers in DMA mode for the sole purpose of ++ * resetting the error count after a transaction error ++ * occurs. The core will continue transferring data. ++ * Disable other interrupts unmasked for the same ++ * reason. ++ */ ++ disable_hc_int(hc_regs, datatglerr); ++ disable_hc_int(hc_regs, ack); ++ qtd->error_count = 0; ++ goto handle_nak_done; ++ } ++ ++ /* ++ * NAK interrupts normally occur during OUT transfers in DMA ++ * or Slave mode. For IN transfers, more requests will be ++ * queued as request queue space is available. ++ */ ++ qtd->error_count = 0; ++ ++ if (!hc->qh->ping_state) { ++ update_urb_state_xfer_intr(hc, hc_regs, ++ qtd->urb, qtd, ++ DWC_OTG_HC_XFER_NAK); ++ dwc_otg_hcd_save_data_toggle(hc, hc_regs, qtd); ++ ++ if (hc->speed == DWC_OTG_EP_SPEED_HIGH) ++ hc->qh->ping_state = 1; ++ } ++ ++ /* ++ * Halt the channel so the transfer can be re-started from ++ * the appropriate point or the PING protocol will ++ * start/continue. ++ */ ++ halt_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_NAK); ++ break; ++ case UE_INTERRUPT: ++ qtd->error_count = 0; ++ halt_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_NAK); ++ break; ++ case UE_ISOCHRONOUS: ++ /* Should never get called for isochronous transfers. */ ++ DWC_ASSERT(1, "NACK interrupt for ISOC transfer\n"); ++ break; ++ } ++ ++handle_nak_done: ++ disable_hc_int(hc_regs, nak); ++ ++ return 1; ++} ++ ++/** ++ * Handles a host channel ACK interrupt. This interrupt is enabled when ++ * performing the PING protocol in Slave mode, when errors occur during ++ * either Slave mode or DMA mode, and during Start Split transactions. ++ */ ++static int32_t handle_hc_ack_intr(dwc_otg_hcd_t * hcd, ++ dwc_hc_t * hc, ++ dwc_otg_hc_regs_t * hc_regs, ++ dwc_otg_qtd_t * qtd) ++{ ++ DWC_DEBUGPL(DBG_HCDI, "--Host Channel %d Interrupt: " ++ "ACK Received--\n", hc->hc_num); ++ ++ if (hc->do_split) { ++ /* ++ * Handle ACK on SSPLIT. ++ * ACK should not occur in CSPLIT. ++ */ ++ if (!hc->ep_is_in && hc->data_pid_start != DWC_OTG_HC_PID_SETUP) { ++ qtd->ssplit_out_xfer_count = hc->xfer_len; ++ } ++ if (!(hc->ep_type == DWC_OTG_EP_TYPE_ISOC && !hc->ep_is_in)) { ++ /* Don't need complete for isochronous out transfers. */ ++ qtd->complete_split = 1; ++ } ++ ++ /* ISOC OUT */ ++ if (hc->ep_type == DWC_OTG_EP_TYPE_ISOC && !hc->ep_is_in) { ++ switch (hc->xact_pos) { ++ case DWC_HCSPLIT_XACTPOS_ALL: ++ break; ++ case DWC_HCSPLIT_XACTPOS_END: ++ qtd->isoc_split_pos = DWC_HCSPLIT_XACTPOS_ALL; ++ qtd->isoc_split_offset = 0; ++ break; ++ case DWC_HCSPLIT_XACTPOS_BEGIN: ++ case DWC_HCSPLIT_XACTPOS_MID: ++ /* ++ * For BEGIN or MID, calculate the length for ++ * the next microframe to determine the correct ++ * SSPLIT token, either MID or END. ++ */ ++ { ++ struct dwc_otg_hcd_iso_packet_desc ++ *frame_desc; ++ ++ frame_desc = ++ &qtd->urb-> ++ iso_descs[qtd->isoc_frame_index]; ++ qtd->isoc_split_offset += 188; ++ ++ if ((frame_desc->length - ++ qtd->isoc_split_offset) <= 188) { ++ qtd->isoc_split_pos = ++ DWC_HCSPLIT_XACTPOS_END; ++ } else { ++ qtd->isoc_split_pos = ++ DWC_HCSPLIT_XACTPOS_MID; ++ } ++ ++ } ++ break; ++ } ++ } else { ++ halt_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_ACK); ++ } ++ } else { ++ /* ++ * An unmasked ACK on a non-split DMA transaction is ++ * for the sole purpose of resetting error counts. Disable other ++ * interrupts unmasked for the same reason. ++ */ ++ if(hcd->core_if->dma_enable) { ++ disable_hc_int(hc_regs, datatglerr); ++ disable_hc_int(hc_regs, nak); ++ } ++ qtd->error_count = 0; ++ ++ if (hc->qh->ping_state) { ++ hc->qh->ping_state = 0; ++ /* ++ * Halt the channel so the transfer can be re-started ++ * from the appropriate point. This only happens in ++ * Slave mode. In DMA mode, the ping_state is cleared ++ * when the transfer is started because the core ++ * automatically executes the PING, then the transfer. ++ */ ++ halt_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_ACK); ++ } ++ } ++ ++ /* ++ * If the ACK occurred when _not_ in the PING state, let the channel ++ * continue transferring data after clearing the error count. ++ */ ++ ++ disable_hc_int(hc_regs, ack); ++ ++ return 1; ++} ++ ++/** ++ * Handles a host channel NYET interrupt. This interrupt should only occur on ++ * Bulk and Control OUT endpoints and for complete split transactions. If a ++ * NYET occurs at the same time as a Transfer Complete interrupt, it is ++ * handled in the xfercomp interrupt handler, not here. This handler may be ++ * called in either DMA mode or Slave mode. ++ */ ++static int32_t handle_hc_nyet_intr(dwc_otg_hcd_t * hcd, ++ dwc_hc_t * hc, ++ dwc_otg_hc_regs_t * hc_regs, ++ dwc_otg_qtd_t * qtd) ++{ ++ DWC_DEBUGPL(DBG_HCDI, "--Host Channel %d Interrupt: " ++ "NYET Received--\n", hc->hc_num); ++ ++ /* ++ * NYET on CSPLIT ++ * re-do the CSPLIT immediately on non-periodic ++ */ ++ if (hc->do_split && hc->complete_split) { ++ if (hc->ep_is_in && (hc->ep_type == DWC_OTG_EP_TYPE_ISOC) ++ && hcd->core_if->dma_enable) { ++ qtd->complete_split = 0; ++ qtd->isoc_split_offset = 0; ++ if (++qtd->isoc_frame_index == qtd->urb->packet_count) { ++ hcd->fops->complete(hcd, qtd->urb->priv, qtd->urb, 0); ++ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_URB_COMPLETE); ++ } ++ else ++ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_NO_HALT_STATUS); ++ goto handle_nyet_done; ++ } ++ ++ if (hc->ep_type == DWC_OTG_EP_TYPE_INTR || ++ hc->ep_type == DWC_OTG_EP_TYPE_ISOC) { ++ int frnum = dwc_otg_hcd_get_frame_number(hcd); ++ ++ // With the FIQ running we only ever see the failed NYET ++ if (dwc_full_frame_num(frnum) != ++ dwc_full_frame_num(hc->qh->sched_frame) || ++ fiq_fsm_enable) { ++ /* ++ * No longer in the same full speed frame. ++ * Treat this as a transaction error. ++ */ ++#if 0 ++ /** @todo Fix system performance so this can ++ * be treated as an error. Right now complete ++ * splits cannot be scheduled precisely enough ++ * due to other system activity, so this error ++ * occurs regularly in Slave mode. ++ */ ++ qtd->error_count++; ++#endif ++ qtd->complete_split = 0; ++ halt_channel(hcd, hc, qtd, ++ DWC_OTG_HC_XFER_XACT_ERR); ++ /** @todo add support for isoc release */ ++ goto handle_nyet_done; ++ } ++ } ++ ++ halt_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_NYET); ++ goto handle_nyet_done; ++ } ++ ++ hc->qh->ping_state = 1; ++ qtd->error_count = 0; ++ ++ update_urb_state_xfer_intr(hc, hc_regs, qtd->urb, qtd, ++ DWC_OTG_HC_XFER_NYET); ++ dwc_otg_hcd_save_data_toggle(hc, hc_regs, qtd); ++ ++ /* ++ * Halt the channel and re-start the transfer so the PING ++ * protocol will start. ++ */ ++ halt_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_NYET); ++ ++handle_nyet_done: ++ disable_hc_int(hc_regs, nyet); ++ return 1; ++} ++ ++/** ++ * Handles a host channel babble interrupt. This handler may be called in ++ * either DMA mode or Slave mode. ++ */ ++static int32_t handle_hc_babble_intr(dwc_otg_hcd_t * hcd, ++ dwc_hc_t * hc, ++ dwc_otg_hc_regs_t * hc_regs, ++ dwc_otg_qtd_t * qtd) ++{ ++ DWC_DEBUGPL(DBG_HCDI, "--Host Channel %d Interrupt: " ++ "Babble Error--\n", hc->hc_num); ++ ++ if (hcd->core_if->dma_desc_enable) { ++ dwc_otg_hcd_complete_xfer_ddma(hcd, hc, hc_regs, ++ DWC_OTG_HC_XFER_BABBLE_ERR); ++ goto handle_babble_done; ++ } ++ ++ if (hc->ep_type != DWC_OTG_EP_TYPE_ISOC) { ++ hcd->fops->complete(hcd, qtd->urb->priv, ++ qtd->urb, -DWC_E_OVERFLOW); ++ halt_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_BABBLE_ERR); ++ } else { ++ dwc_otg_halt_status_e halt_status; ++ halt_status = update_isoc_urb_state(hcd, hc, hc_regs, qtd, ++ DWC_OTG_HC_XFER_BABBLE_ERR); ++ halt_channel(hcd, hc, qtd, halt_status); ++ } ++ ++handle_babble_done: ++ disable_hc_int(hc_regs, bblerr); ++ return 1; ++} ++ ++/** ++ * Handles a host channel AHB error interrupt. This handler is only called in ++ * DMA mode. ++ */ ++static int32_t handle_hc_ahberr_intr(dwc_otg_hcd_t * hcd, ++ dwc_hc_t * hc, ++ dwc_otg_hc_regs_t * hc_regs, ++ dwc_otg_qtd_t * qtd) ++{ ++ hcchar_data_t hcchar; ++ hcsplt_data_t hcsplt; ++ hctsiz_data_t hctsiz; ++ uint32_t hcdma; ++ char *pipetype, *speed; ++ ++ dwc_otg_hcd_urb_t *urb = qtd->urb; ++ ++ DWC_DEBUGPL(DBG_HCDI, "--Host Channel %d Interrupt: " ++ "AHB Error--\n", hc->hc_num); ++ ++ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); ++ hcsplt.d32 = DWC_READ_REG32(&hc_regs->hcsplt); ++ hctsiz.d32 = DWC_READ_REG32(&hc_regs->hctsiz); ++ hcdma = DWC_READ_REG32(&hc_regs->hcdma); ++ ++ DWC_ERROR("AHB ERROR, Channel %d\n", hc->hc_num); ++ DWC_ERROR(" hcchar 0x%08x, hcsplt 0x%08x\n", hcchar.d32, hcsplt.d32); ++ DWC_ERROR(" hctsiz 0x%08x, hcdma 0x%08x\n", hctsiz.d32, hcdma); ++ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD URB Enqueue\n"); ++ DWC_ERROR(" Device address: %d\n", ++ dwc_otg_hcd_get_dev_addr(&urb->pipe_info)); ++ DWC_ERROR(" Endpoint: %d, %s\n", ++ dwc_otg_hcd_get_ep_num(&urb->pipe_info), ++ (dwc_otg_hcd_is_pipe_in(&urb->pipe_info) ? "IN" : "OUT")); ++ ++ switch (dwc_otg_hcd_get_pipe_type(&urb->pipe_info)) { ++ case UE_CONTROL: ++ pipetype = "CONTROL"; ++ break; ++ case UE_BULK: ++ pipetype = "BULK"; ++ break; ++ case UE_INTERRUPT: ++ pipetype = "INTERRUPT"; ++ break; ++ case UE_ISOCHRONOUS: ++ pipetype = "ISOCHRONOUS"; ++ break; ++ default: ++ pipetype = "UNKNOWN"; ++ break; ++ } ++ ++ DWC_ERROR(" Endpoint type: %s\n", pipetype); ++ ++ switch (hc->speed) { ++ case DWC_OTG_EP_SPEED_HIGH: ++ speed = "HIGH"; ++ break; ++ case DWC_OTG_EP_SPEED_FULL: ++ speed = "FULL"; ++ break; ++ case DWC_OTG_EP_SPEED_LOW: ++ speed = "LOW"; ++ break; ++ default: ++ speed = "UNKNOWN"; ++ break; ++ }; ++ ++ DWC_ERROR(" Speed: %s\n", speed); ++ ++ DWC_ERROR(" Max packet size: %d\n", ++ dwc_otg_hcd_get_mps(&urb->pipe_info)); ++ DWC_ERROR(" Data buffer length: %d\n", urb->length); ++ DWC_ERROR(" Transfer buffer: %p, Transfer DMA: %p\n", ++ urb->buf, (void *)urb->dma); ++ DWC_ERROR(" Setup buffer: %p, Setup DMA: %p\n", ++ urb->setup_packet, (void *)urb->setup_dma); ++ DWC_ERROR(" Interval: %d\n", urb->interval); ++ ++ /* Core haltes the channel for Descriptor DMA mode */ ++ if (hcd->core_if->dma_desc_enable) { ++ dwc_otg_hcd_complete_xfer_ddma(hcd, hc, hc_regs, ++ DWC_OTG_HC_XFER_AHB_ERR); ++ goto handle_ahberr_done; ++ } ++ ++ hcd->fops->complete(hcd, urb->priv, urb, -DWC_E_IO); ++ ++ /* ++ * Force a channel halt. Don't call halt_channel because that won't ++ * write to the HCCHARn register in DMA mode to force the halt. ++ */ ++ dwc_otg_hc_halt(hcd->core_if, hc, DWC_OTG_HC_XFER_AHB_ERR); ++handle_ahberr_done: ++ disable_hc_int(hc_regs, ahberr); ++ return 1; ++} ++ ++/** ++ * Handles a host channel transaction error interrupt. This handler may be ++ * called in either DMA mode or Slave mode. ++ */ ++static int32_t handle_hc_xacterr_intr(dwc_otg_hcd_t * hcd, ++ dwc_hc_t * hc, ++ dwc_otg_hc_regs_t * hc_regs, ++ dwc_otg_qtd_t * qtd) ++{ ++ DWC_DEBUGPL(DBG_HCDI, "--Host Channel %d Interrupt: " ++ "Transaction Error--\n", hc->hc_num); ++ ++ if (hcd->core_if->dma_desc_enable) { ++ dwc_otg_hcd_complete_xfer_ddma(hcd, hc, hc_regs, ++ DWC_OTG_HC_XFER_XACT_ERR); ++ goto handle_xacterr_done; ++ } ++ ++ switch (dwc_otg_hcd_get_pipe_type(&qtd->urb->pipe_info)) { ++ case UE_CONTROL: ++ case UE_BULK: ++ qtd->error_count++; ++ if (!hc->qh->ping_state) { ++ ++ update_urb_state_xfer_intr(hc, hc_regs, ++ qtd->urb, qtd, ++ DWC_OTG_HC_XFER_XACT_ERR); ++ dwc_otg_hcd_save_data_toggle(hc, hc_regs, qtd); ++ if (!hc->ep_is_in && hc->speed == DWC_OTG_EP_SPEED_HIGH) { ++ hc->qh->ping_state = 1; ++ } ++ } ++ ++ /* ++ * Halt the channel so the transfer can be re-started from ++ * the appropriate point or the PING protocol will start. ++ */ ++ halt_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_XACT_ERR); ++ break; ++ case UE_INTERRUPT: ++ qtd->error_count++; ++ if (hc->do_split && hc->complete_split) { ++ qtd->complete_split = 0; ++ } ++ halt_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_XACT_ERR); ++ break; ++ case UE_ISOCHRONOUS: ++ { ++ dwc_otg_halt_status_e halt_status; ++ halt_status = ++ update_isoc_urb_state(hcd, hc, hc_regs, qtd, ++ DWC_OTG_HC_XFER_XACT_ERR); ++ ++ halt_channel(hcd, hc, qtd, halt_status); ++ } ++ break; ++ } ++handle_xacterr_done: ++ disable_hc_int(hc_regs, xacterr); ++ ++ return 1; ++} ++ ++/** ++ * Handles a host channel frame overrun interrupt. This handler may be called ++ * in either DMA mode or Slave mode. ++ */ ++static int32_t handle_hc_frmovrun_intr(dwc_otg_hcd_t * hcd, ++ dwc_hc_t * hc, ++ dwc_otg_hc_regs_t * hc_regs, ++ dwc_otg_qtd_t * qtd) ++{ ++ DWC_DEBUGPL(DBG_HCDI, "--Host Channel %d Interrupt: " ++ "Frame Overrun--\n", hc->hc_num); ++ ++ switch (dwc_otg_hcd_get_pipe_type(&qtd->urb->pipe_info)) { ++ case UE_CONTROL: ++ case UE_BULK: ++ break; ++ case UE_INTERRUPT: ++ halt_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_FRAME_OVERRUN); ++ break; ++ case UE_ISOCHRONOUS: ++ { ++ dwc_otg_halt_status_e halt_status; ++ halt_status = ++ update_isoc_urb_state(hcd, hc, hc_regs, qtd, ++ DWC_OTG_HC_XFER_FRAME_OVERRUN); ++ ++ halt_channel(hcd, hc, qtd, halt_status); ++ } ++ break; ++ } ++ ++ disable_hc_int(hc_regs, frmovrun); ++ ++ return 1; ++} ++ ++/** ++ * Handles a host channel data toggle error interrupt. This handler may be ++ * called in either DMA mode or Slave mode. ++ */ ++static int32_t handle_hc_datatglerr_intr(dwc_otg_hcd_t * hcd, ++ dwc_hc_t * hc, ++ dwc_otg_hc_regs_t * hc_regs, ++ dwc_otg_qtd_t * qtd) ++{ ++ DWC_DEBUGPL(DBG_HCDI, "--Host Channel %d Interrupt: " ++ "Data Toggle Error on %s transfer--\n", ++ hc->hc_num, (hc->ep_is_in ? "IN" : "OUT")); ++ ++ /* Data toggles on split transactions cause the hc to halt. ++ * restart transfer */ ++ if(hc->qh->do_split) ++ { ++ qtd->error_count++; ++ dwc_otg_hcd_save_data_toggle(hc, hc_regs, qtd); ++ update_urb_state_xfer_intr(hc, hc_regs, ++ qtd->urb, qtd, DWC_OTG_HC_XFER_XACT_ERR); ++ halt_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_XACT_ERR); ++ } else if (hc->ep_is_in) { ++ /* An unmasked data toggle error on a non-split DMA transaction is ++ * for the sole purpose of resetting error counts. Disable other ++ * interrupts unmasked for the same reason. ++ */ ++ if(hcd->core_if->dma_enable) { ++ disable_hc_int(hc_regs, ack); ++ disable_hc_int(hc_regs, nak); ++ } ++ qtd->error_count = 0; ++ } ++ ++ disable_hc_int(hc_regs, datatglerr); ++ ++ return 1; ++} ++ ++#ifdef DEBUG ++/** ++ * This function is for debug only. It checks that a valid halt status is set ++ * and that HCCHARn.chdis is clear. If there's a problem, corrective action is ++ * taken and a warning is issued. ++ * @return 1 if halt status is ok, 0 otherwise. ++ */ ++static inline int halt_status_ok(dwc_otg_hcd_t * hcd, ++ dwc_hc_t * hc, ++ dwc_otg_hc_regs_t * hc_regs, ++ dwc_otg_qtd_t * qtd) ++{ ++ hcchar_data_t hcchar; ++ hctsiz_data_t hctsiz; ++ hcint_data_t hcint; ++ hcintmsk_data_t hcintmsk; ++ hcsplt_data_t hcsplt; ++ ++ if (hc->halt_status == DWC_OTG_HC_XFER_NO_HALT_STATUS) { ++ /* ++ * This code is here only as a check. This condition should ++ * never happen. Ignore the halt if it does occur. ++ */ ++ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); ++ hctsiz.d32 = DWC_READ_REG32(&hc_regs->hctsiz); ++ hcint.d32 = DWC_READ_REG32(&hc_regs->hcint); ++ hcintmsk.d32 = DWC_READ_REG32(&hc_regs->hcintmsk); ++ hcsplt.d32 = DWC_READ_REG32(&hc_regs->hcsplt); ++ DWC_WARN ++ ("%s: hc->halt_status == DWC_OTG_HC_XFER_NO_HALT_STATUS, " ++ "channel %d, hcchar 0x%08x, hctsiz 0x%08x, " ++ "hcint 0x%08x, hcintmsk 0x%08x, " ++ "hcsplt 0x%08x, qtd->complete_split %d\n", __func__, ++ hc->hc_num, hcchar.d32, hctsiz.d32, hcint.d32, ++ hcintmsk.d32, hcsplt.d32, qtd->complete_split); ++ ++ DWC_WARN("%s: no halt status, channel %d, ignoring interrupt\n", ++ __func__, hc->hc_num); ++ DWC_WARN("\n"); ++ clear_hc_int(hc_regs, chhltd); ++ return 0; ++ } ++ ++ /* ++ * This code is here only as a check. hcchar.chdis should ++ * never be set when the halt interrupt occurs. Halt the ++ * channel again if it does occur. ++ */ ++ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); ++ if (hcchar.b.chdis) { ++ DWC_WARN("%s: hcchar.chdis set unexpectedly, " ++ "hcchar 0x%08x, trying to halt again\n", ++ __func__, hcchar.d32); ++ clear_hc_int(hc_regs, chhltd); ++ hc->halt_pending = 0; ++ halt_channel(hcd, hc, qtd, hc->halt_status); ++ return 0; ++ } ++ ++ return 1; ++} ++#endif ++ ++/** ++ * Handles a host Channel Halted interrupt in DMA mode. This handler ++ * determines the reason the channel halted and proceeds accordingly. ++ */ ++static void handle_hc_chhltd_intr_dma(dwc_otg_hcd_t * hcd, ++ dwc_hc_t * hc, ++ dwc_otg_hc_regs_t * hc_regs, ++ dwc_otg_qtd_t * qtd) ++{ ++ int out_nak_enh = 0; ++ hcint_data_t hcint; ++ hcintmsk_data_t hcintmsk; ++ /* For core with OUT NAK enhancement, the flow for high- ++ * speed CONTROL/BULK OUT is handled a little differently. ++ */ ++ if (hcd->core_if->snpsid >= OTG_CORE_REV_2_71a) { ++ if (hc->speed == DWC_OTG_EP_SPEED_HIGH && !hc->ep_is_in && ++ (hc->ep_type == DWC_OTG_EP_TYPE_CONTROL || ++ hc->ep_type == DWC_OTG_EP_TYPE_BULK)) { ++ out_nak_enh = 1; ++ } ++ } ++ ++ if (hc->halt_status == DWC_OTG_HC_XFER_URB_DEQUEUE || ++ (hc->halt_status == DWC_OTG_HC_XFER_AHB_ERR ++ && !hcd->core_if->dma_desc_enable)) { ++ /* ++ * Just release the channel. A dequeue can happen on a ++ * transfer timeout. In the case of an AHB Error, the channel ++ * was forced to halt because there's no way to gracefully ++ * recover. ++ */ ++ if (hcd->core_if->dma_desc_enable) ++ dwc_otg_hcd_complete_xfer_ddma(hcd, hc, hc_regs, ++ hc->halt_status); ++ else ++ release_channel(hcd, hc, qtd, hc->halt_status); ++ return; ++ } ++ ++ /* Read the HCINTn register to determine the cause for the halt. */ ++ ++ hcint.d32 = DWC_READ_REG32(&hc_regs->hcint); ++ hcintmsk.d32 = DWC_READ_REG32(&hc_regs->hcintmsk); ++ ++ if (hcint.b.xfercomp) { ++ /** @todo This is here because of a possible hardware bug. Spec ++ * says that on SPLIT-ISOC OUT transfers in DMA mode that a HALT ++ * interrupt w/ACK bit set should occur, but I only see the ++ * XFERCOMP bit, even with it masked out. This is a workaround ++ * for that behavior. Should fix this when hardware is fixed. ++ */ ++ if (hc->ep_type == DWC_OTG_EP_TYPE_ISOC && !hc->ep_is_in) { ++ handle_hc_ack_intr(hcd, hc, hc_regs, qtd); ++ } ++ handle_hc_xfercomp_intr(hcd, hc, hc_regs, qtd); ++ } else if (hcint.b.stall) { ++ handle_hc_stall_intr(hcd, hc, hc_regs, qtd); ++ } else if (hcint.b.xacterr && !hcd->core_if->dma_desc_enable) { ++ if (out_nak_enh) { ++ if (hcint.b.nyet || hcint.b.nak || hcint.b.ack) { ++ DWC_DEBUGPL(DBG_HCD, "XactErr with NYET/NAK/ACK\n"); ++ qtd->error_count = 0; ++ } else { ++ DWC_DEBUGPL(DBG_HCD, "XactErr without NYET/NAK/ACK\n"); ++ } ++ } ++ ++ /* ++ * Must handle xacterr before nak or ack. Could get a xacterr ++ * at the same time as either of these on a BULK/CONTROL OUT ++ * that started with a PING. The xacterr takes precedence. ++ */ ++ handle_hc_xacterr_intr(hcd, hc, hc_regs, qtd); ++ } else if (hcint.b.xcs_xact && hcd->core_if->dma_desc_enable) { ++ handle_hc_xacterr_intr(hcd, hc, hc_regs, qtd); ++ } else if (hcint.b.ahberr && hcd->core_if->dma_desc_enable) { ++ handle_hc_ahberr_intr(hcd, hc, hc_regs, qtd); ++ } else if (hcint.b.bblerr) { ++ handle_hc_babble_intr(hcd, hc, hc_regs, qtd); ++ } else if (hcint.b.frmovrun) { ++ handle_hc_frmovrun_intr(hcd, hc, hc_regs, qtd); ++ } else if (hcint.b.datatglerr) { ++ handle_hc_datatglerr_intr(hcd, hc, hc_regs, qtd); ++ } else if (!out_nak_enh) { ++ if (hcint.b.nyet) { ++ /* ++ * Must handle nyet before nak or ack. Could get a nyet at the ++ * same time as either of those on a BULK/CONTROL OUT that ++ * started with a PING. The nyet takes precedence. ++ */ ++ handle_hc_nyet_intr(hcd, hc, hc_regs, qtd); ++ } else if (hcint.b.nak && !hcintmsk.b.nak) { ++ /* ++ * If nak is not masked, it's because a non-split IN transfer ++ * is in an error state. In that case, the nak is handled by ++ * the nak interrupt handler, not here. Handle nak here for ++ * BULK/CONTROL OUT transfers, which halt on a NAK to allow ++ * rewinding the buffer pointer. ++ */ ++ handle_hc_nak_intr(hcd, hc, hc_regs, qtd); ++ } else if (hcint.b.ack && !hcintmsk.b.ack) { ++ /* ++ * If ack is not masked, it's because a non-split IN transfer ++ * is in an error state. In that case, the ack is handled by ++ * the ack interrupt handler, not here. Handle ack here for ++ * split transfers. Start splits halt on ACK. ++ */ ++ handle_hc_ack_intr(hcd, hc, hc_regs, qtd); ++ } else { ++ if (hc->ep_type == DWC_OTG_EP_TYPE_INTR || ++ hc->ep_type == DWC_OTG_EP_TYPE_ISOC) { ++ /* ++ * A periodic transfer halted with no other channel ++ * interrupts set. Assume it was halted by the core ++ * because it could not be completed in its scheduled ++ * (micro)frame. ++ */ ++#ifdef DEBUG ++ DWC_PRINTF ++ ("%s: Halt channel %d (assume incomplete periodic transfer)\n", ++ __func__, hc->hc_num); ++#endif ++ halt_channel(hcd, hc, qtd, ++ DWC_OTG_HC_XFER_PERIODIC_INCOMPLETE); ++ } else { ++ DWC_ERROR ++ ("%s: Channel %d, DMA Mode -- ChHltd set, but reason " ++ "for halting is unknown, hcint 0x%08x, intsts 0x%08x\n", ++ __func__, hc->hc_num, hcint.d32, ++ DWC_READ_REG32(&hcd-> ++ core_if->core_global_regs-> ++ gintsts)); ++ /* Failthrough: use 3-strikes rule */ ++ qtd->error_count++; ++ dwc_otg_hcd_save_data_toggle(hc, hc_regs, qtd); ++ update_urb_state_xfer_intr(hc, hc_regs, ++ qtd->urb, qtd, DWC_OTG_HC_XFER_XACT_ERR); ++ halt_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_XACT_ERR); ++ } ++ ++ } ++ } else { ++ DWC_PRINTF("NYET/NAK/ACK/other in non-error case, 0x%08x\n", ++ hcint.d32); ++ /* Failthrough: use 3-strikes rule */ ++ qtd->error_count++; ++ dwc_otg_hcd_save_data_toggle(hc, hc_regs, qtd); ++ update_urb_state_xfer_intr(hc, hc_regs, ++ qtd->urb, qtd, DWC_OTG_HC_XFER_XACT_ERR); ++ halt_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_XACT_ERR); ++ } ++} ++ ++/** ++ * Handles a host channel Channel Halted interrupt. ++ * ++ * In slave mode, this handler is called only when the driver specifically ++ * requests a halt. This occurs during handling other host channel interrupts ++ * (e.g. nak, xacterr, stall, nyet, etc.). ++ * ++ * In DMA mode, this is the interrupt that occurs when the core has finished ++ * processing a transfer on a channel. Other host channel interrupts (except ++ * ahberr) are disabled in DMA mode. ++ */ ++static int32_t handle_hc_chhltd_intr(dwc_otg_hcd_t * hcd, ++ dwc_hc_t * hc, ++ dwc_otg_hc_regs_t * hc_regs, ++ dwc_otg_qtd_t * qtd) ++{ ++ DWC_DEBUGPL(DBG_HCDI, "--Host Channel %d Interrupt: " ++ "Channel Halted--\n", hc->hc_num); ++ ++ if (hcd->core_if->dma_enable) { ++ handle_hc_chhltd_intr_dma(hcd, hc, hc_regs, qtd); ++ } else { ++#ifdef DEBUG ++ if (!halt_status_ok(hcd, hc, hc_regs, qtd)) { ++ return 1; ++ } ++#endif ++ release_channel(hcd, hc, qtd, hc->halt_status); ++ } ++ ++ return 1; ++} ++ ++ ++/** ++ * dwc_otg_fiq_unmangle_isoc() - Update the iso_frame_desc structure on ++ * FIQ transfer completion ++ * @hcd: Pointer to dwc_otg_hcd struct ++ * @num: Host channel number ++ * ++ * 1. Un-mangle the status as recorded in each iso_frame_desc status ++ * 2. Copy it from the dwc_otg_urb into the real URB ++ */ ++void dwc_otg_fiq_unmangle_isoc(dwc_otg_hcd_t *hcd, dwc_otg_qh_t *qh, dwc_otg_qtd_t *qtd, uint32_t num) ++{ ++ struct dwc_otg_hcd_urb *dwc_urb = qtd->urb; ++ int nr_frames = dwc_urb->packet_count; ++ int i; ++ hcint_data_t frame_hcint; ++ ++ for (i = 0; i < nr_frames; i++) { ++ frame_hcint.d32 = dwc_urb->iso_descs[i].status; ++ if (frame_hcint.b.xfercomp) { ++ dwc_urb->iso_descs[i].status = 0; ++ dwc_urb->actual_length += dwc_urb->iso_descs[i].actual_length; ++ } else if (frame_hcint.b.frmovrun) { ++ if (qh->ep_is_in) ++ dwc_urb->iso_descs[i].status = -DWC_E_NO_STREAM_RES; ++ else ++ dwc_urb->iso_descs[i].status = -DWC_E_COMMUNICATION; ++ dwc_urb->error_count++; ++ dwc_urb->iso_descs[i].actual_length = 0; ++ } else if (frame_hcint.b.xacterr) { ++ dwc_urb->iso_descs[i].status = -DWC_E_PROTOCOL; ++ dwc_urb->error_count++; ++ dwc_urb->iso_descs[i].actual_length = 0; ++ } else if (frame_hcint.b.bblerr) { ++ dwc_urb->iso_descs[i].status = -DWC_E_OVERFLOW; ++ dwc_urb->error_count++; ++ dwc_urb->iso_descs[i].actual_length = 0; ++ } else { ++ /* Something went wrong */ ++ dwc_urb->iso_descs[i].status = -1; ++ dwc_urb->iso_descs[i].actual_length = 0; ++ dwc_urb->error_count++; ++ } ++ } ++ qh->sched_frame = dwc_frame_num_inc(qh->sched_frame, qh->interval * (nr_frames - 1)); ++ ++ //printk_ratelimited(KERN_INFO "%s: HS isochronous of %d/%d frames with %d errors complete\n", ++ // __FUNCTION__, i, dwc_urb->packet_count, dwc_urb->error_count); ++} ++ ++/** ++ * dwc_otg_fiq_unsetup_per_dma() - Remove data from bounce buffers for split transactions ++ * @hcd: Pointer to dwc_otg_hcd struct ++ * @num: Host channel number ++ * ++ * Copies data from the FIQ bounce buffers into the URB's transfer buffer. Does not modify URB state. ++ * Returns total length of data or -1 if the buffers were not used. ++ * ++ */ ++int dwc_otg_fiq_unsetup_per_dma(dwc_otg_hcd_t *hcd, dwc_otg_qh_t *qh, dwc_otg_qtd_t *qtd, uint32_t num) ++{ ++ dwc_hc_t *hc = qh->channel; ++ struct fiq_dma_blob *blob = hcd->fiq_dmab; ++ struct fiq_channel_state *st = &hcd->fiq_state->channel[num]; ++ uint8_t *ptr = NULL; ++ int index = 0, len = 0; ++ int i = 0; ++ if (hc->ep_is_in) { ++ /* Copy data out of the DMA bounce buffers to the URB's buffer. ++ * The align_buf is ignored as this is ignored on FSM enqueue. */ ++ ptr = qtd->urb->buf; ++ if (qh->ep_type == UE_ISOCHRONOUS) { ++ /* Isoc IN transactions - grab the offset of the iso_frame_desc into the URB transfer buffer */ ++ index = qtd->isoc_frame_index; ++ ptr += qtd->urb->iso_descs[index].offset; ++ } else { ++ /* Need to increment by actual_length for interrupt IN */ ++ ptr += qtd->urb->actual_length; ++ } ++ ++ for (i = 0; i < st->dma_info.index; i++) { ++ len += st->dma_info.slot_len[i]; ++ dwc_memcpy(ptr, &blob->channel[num].index[i].buf[0], st->dma_info.slot_len[i]); ++ ptr += st->dma_info.slot_len[i]; ++ } ++ return len; ++ } else { ++ /* OUT endpoints - nothing to do. */ ++ return -1; ++ } ++ ++} ++/** ++ * dwc_otg_hcd_handle_hc_fsm() - handle an unmasked channel interrupt ++ * from a channel handled in the FIQ ++ * @hcd: Pointer to dwc_otg_hcd struct ++ * @num: Host channel number ++ * ++ * If a host channel interrupt was received by the IRQ and this was a channel ++ * used by the FIQ, the execution flow for transfer completion is substantially ++ * different from the normal (messy) path. This function and its friends handles ++ * channel cleanup and transaction completion from a FIQ transaction. ++ */ ++void dwc_otg_hcd_handle_hc_fsm(dwc_otg_hcd_t *hcd, uint32_t num) ++{ ++ struct fiq_channel_state *st = &hcd->fiq_state->channel[num]; ++ dwc_hc_t *hc = hcd->hc_ptr_array[num]; ++ dwc_otg_qtd_t *qtd = DWC_CIRCLEQ_FIRST(&hc->qh->qtd_list); ++ dwc_otg_qh_t *qh = hc->qh; ++ dwc_otg_hc_regs_t *hc_regs = hcd->core_if->host_if->hc_regs[num]; ++ hcint_data_t hcint = hcd->fiq_state->channel[num].hcint_copy; ++ int hostchannels = 0; ++ fiq_print(FIQDBG_INT, hcd->fiq_state, "OUT %01d %01d ", num , st->fsm); ++ ++ hostchannels = hcd->available_host_channels; ++ switch (st->fsm) { ++ case FIQ_TEST: ++ break; ++ ++ case FIQ_DEQUEUE_ISSUED: ++ /* hc_halt was called. QTD no longer exists. */ ++ /* TODO: for a nonperiodic split transaction, need to issue a ++ * CLEAR_TT_BUFFER hub command if we were in the start-split phase. ++ */ ++ release_channel(hcd, hc, NULL, hc->halt_status); ++ break; ++ ++ case FIQ_NP_SPLIT_DONE: ++ /* Nonperiodic transaction complete. */ ++ if (!hc->ep_is_in) { ++ qtd->ssplit_out_xfer_count = hc->xfer_len; ++ } ++ if (hcint.b.xfercomp) { ++ handle_hc_xfercomp_intr(hcd, hc, hc_regs, qtd); ++ } else if (hcint.b.nak) { ++ handle_hc_nak_intr(hcd, hc, hc_regs, qtd); ++ } ++ break; ++ ++ case FIQ_NP_SPLIT_HS_ABORTED: ++ /* A HS abort is a 3-strikes on the HS bus at any point in the transaction. ++ * Normally a CLEAR_TT_BUFFER hub command would be required: we can't do that ++ * because there's no guarantee which order a non-periodic split happened in. ++ * We could end up clearing a perfectly good transaction out of the buffer. ++ */ ++ if (hcint.b.xacterr) { ++ qtd->error_count += st->nr_errors; ++ handle_hc_xacterr_intr(hcd, hc, hc_regs, qtd); ++ } else if (hcint.b.ahberr) { ++ handle_hc_ahberr_intr(hcd, hc, hc_regs, qtd); ++ } else { ++ local_fiq_disable(); ++ BUG(); ++ } ++ break; ++ ++ case FIQ_NP_SPLIT_LS_ABORTED: ++ /* A few cases can cause this - either an unknown state on a SSPLIT or ++ * STALL/data toggle error response on a CSPLIT */ ++ if (hcint.b.stall) { ++ handle_hc_stall_intr(hcd, hc, hc_regs, qtd); ++ } else if (hcint.b.datatglerr) { ++ handle_hc_datatglerr_intr(hcd, hc, hc_regs, qtd); ++ } else if (hcint.b.bblerr) { ++ handle_hc_babble_intr(hcd, hc, hc_regs, qtd); ++ } else if (hcint.b.ahberr) { ++ handle_hc_ahberr_intr(hcd, hc, hc_regs, qtd); ++ } else { ++ local_fiq_disable(); ++ BUG(); ++ } ++ break; ++ ++ case FIQ_PER_SPLIT_DONE: ++ /* Isoc IN or Interrupt IN/OUT */ ++ ++ /* Flow control here is different from the normal execution by the driver. ++ * We need to completely ignore most of the driver's method of handling ++ * split transactions and do it ourselves. ++ */ ++ if (hc->ep_type == UE_INTERRUPT) { ++ if (hcint.b.nak) { ++ handle_hc_nak_intr(hcd, hc, hc_regs, qtd); ++ } else if (hc->ep_is_in) { ++ int len; ++ len = dwc_otg_fiq_unsetup_per_dma(hcd, hc->qh, qtd, num); ++ //printk(KERN_NOTICE "FIQ Transaction: hc=%d len=%d urb_len = %d\n", num, len, qtd->urb->length); ++ qtd->urb->actual_length += len; ++ if (qtd->urb->actual_length >= qtd->urb->length) { ++ qtd->urb->status = 0; ++ hcd->fops->complete(hcd, qtd->urb->priv, qtd->urb, qtd->urb->status); ++ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_URB_COMPLETE); ++ } else { ++ /* Interrupt transfer not complete yet - is it a short read? */ ++ if (len < hc->max_packet) { ++ /* Interrupt transaction complete */ ++ qtd->urb->status = 0; ++ hcd->fops->complete(hcd, qtd->urb->priv, qtd->urb, qtd->urb->status); ++ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_URB_COMPLETE); ++ } else { ++ /* Further transactions required */ ++ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_COMPLETE); ++ } ++ } ++ } else { ++ /* Interrupt OUT complete. */ ++ dwc_otg_hcd_save_data_toggle(hc, hc_regs, qtd); ++ qtd->urb->actual_length += hc->xfer_len; ++ if (qtd->urb->actual_length >= qtd->urb->length) { ++ qtd->urb->status = 0; ++ hcd->fops->complete(hcd, qtd->urb->priv, qtd->urb, qtd->urb->status); ++ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_URB_COMPLETE); ++ } else { ++ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_COMPLETE); ++ } ++ } ++ } else { ++ /* ISOC IN complete. */ ++ struct dwc_otg_hcd_iso_packet_desc *frame_desc = &qtd->urb->iso_descs[qtd->isoc_frame_index]; ++ int len = 0; ++ /* Record errors, update qtd. */ ++ if (st->nr_errors) { ++ frame_desc->actual_length = 0; ++ frame_desc->status = -DWC_E_PROTOCOL; ++ } else { ++ frame_desc->status = 0; ++ /* Unswizzle dma */ ++ len = dwc_otg_fiq_unsetup_per_dma(hcd, qh, qtd, num); ++ frame_desc->actual_length = len; ++ } ++ qtd->isoc_frame_index++; ++ if (qtd->isoc_frame_index == qtd->urb->packet_count) { ++ hcd->fops->complete(hcd, qtd->urb->priv, qtd->urb, 0); ++ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_URB_COMPLETE); ++ } else { ++ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_COMPLETE); ++ } ++ } ++ break; ++ ++ case FIQ_PER_ISO_OUT_DONE: { ++ struct dwc_otg_hcd_iso_packet_desc *frame_desc = &qtd->urb->iso_descs[qtd->isoc_frame_index]; ++ /* Record errors, update qtd. */ ++ if (st->nr_errors) { ++ frame_desc->actual_length = 0; ++ frame_desc->status = -DWC_E_PROTOCOL; ++ } else { ++ frame_desc->status = 0; ++ frame_desc->actual_length = frame_desc->length; ++ } ++ qtd->isoc_frame_index++; ++ qtd->isoc_split_offset = 0; ++ if (qtd->isoc_frame_index == qtd->urb->packet_count) { ++ hcd->fops->complete(hcd, qtd->urb->priv, qtd->urb, 0); ++ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_URB_COMPLETE); ++ } else { ++ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_COMPLETE); ++ } ++ } ++ break; ++ ++ case FIQ_PER_SPLIT_NYET_ABORTED: ++ /* Doh. lost the data. */ ++ printk_ratelimited(KERN_INFO "Transfer to device %d endpoint 0x%x frame %d failed " ++ "- FIQ reported NYET. Data may have been lost.\n", ++ hc->dev_addr, hc->ep_num, dwc_otg_hcd_get_frame_number(hcd) >> 3); ++ if (hc->ep_type == UE_ISOCHRONOUS) { ++ struct dwc_otg_hcd_iso_packet_desc *frame_desc = &qtd->urb->iso_descs[qtd->isoc_frame_index]; ++ /* Record errors, update qtd. */ ++ frame_desc->actual_length = 0; ++ frame_desc->status = -DWC_E_PROTOCOL; ++ qtd->isoc_frame_index++; ++ qtd->isoc_split_offset = 0; ++ if (qtd->isoc_frame_index == qtd->urb->packet_count) { ++ hcd->fops->complete(hcd, qtd->urb->priv, qtd->urb, 0); ++ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_URB_COMPLETE); ++ } else { ++ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_COMPLETE); ++ } ++ } else { ++ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_NO_HALT_STATUS); ++ } ++ break; ++ ++ case FIQ_HS_ISOC_DONE: ++ /* The FIQ has performed a whole pile of isochronous transactions. ++ * The status is recorded as the interrupt state should the transaction ++ * fail. ++ */ ++ dwc_otg_fiq_unmangle_isoc(hcd, qh, qtd, num); ++ hcd->fops->complete(hcd, qtd->urb->priv, qtd->urb, 0); ++ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_URB_COMPLETE); ++ break; ++ ++ case FIQ_PER_SPLIT_LS_ABORTED: ++ if (hcint.b.xacterr) { ++ /* Hub has responded with an ERR packet. Device ++ * has been unplugged or the port has been disabled. ++ * TODO: need to issue a reset to the hub port. */ ++ qtd->error_count += 3; ++ handle_hc_xacterr_intr(hcd, hc, hc_regs, qtd); ++ } else if (hcint.b.stall) { ++ handle_hc_stall_intr(hcd, hc, hc_regs, qtd); ++ } else if (hcint.b.bblerr) { ++ handle_hc_babble_intr(hcd, hc, hc_regs, qtd); ++ } else { ++ printk_ratelimited(KERN_INFO "Transfer to device %d endpoint 0x%x failed " ++ "- FIQ reported FSM=%d. Data may have been lost.\n", ++ st->fsm, hc->dev_addr, hc->ep_num); ++ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_NO_HALT_STATUS); ++ } ++ break; ++ ++ case FIQ_PER_SPLIT_HS_ABORTED: ++ /* Either the SSPLIT phase suffered transaction errors or something ++ * unexpected happened. ++ */ ++ qtd->error_count += 3; ++ handle_hc_xacterr_intr(hcd, hc, hc_regs, qtd); ++ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_NO_HALT_STATUS); ++ break; ++ ++ case FIQ_PER_SPLIT_TIMEOUT: ++ /* Couldn't complete in the nominated frame */ ++ printk(KERN_INFO "Transfer to device %d endpoint 0x%x frame %d failed " ++ "- FIQ timed out. Data may have been lost.\n", ++ hc->dev_addr, hc->ep_num, dwc_otg_hcd_get_frame_number(hcd) >> 3); ++ if (hc->ep_type == UE_ISOCHRONOUS) { ++ struct dwc_otg_hcd_iso_packet_desc *frame_desc = &qtd->urb->iso_descs[qtd->isoc_frame_index]; ++ /* Record errors, update qtd. */ ++ frame_desc->actual_length = 0; ++ if (hc->ep_is_in) { ++ frame_desc->status = -DWC_E_NO_STREAM_RES; ++ } else { ++ frame_desc->status = -DWC_E_COMMUNICATION; ++ } ++ qtd->isoc_frame_index++; ++ if (qtd->isoc_frame_index == qtd->urb->packet_count) { ++ hcd->fops->complete(hcd, qtd->urb->priv, qtd->urb, 0); ++ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_URB_COMPLETE); ++ } else { ++ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_COMPLETE); ++ } ++ } else { ++ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_NO_HALT_STATUS); ++ } ++ break; ++ ++ default: ++ DWC_WARN("Unexpected state received on hc=%d fsm=%d on transfer to device %d ep 0x%x", ++ hc->hc_num, st->fsm, hc->dev_addr, hc->ep_num); ++ qtd->error_count++; ++ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_NO_HALT_STATUS); ++ } ++ return; ++} ++ ++/** Handles interrupt for a specific Host Channel */ ++int32_t dwc_otg_hcd_handle_hc_n_intr(dwc_otg_hcd_t * dwc_otg_hcd, uint32_t num) ++{ ++ int retval = 0; ++ hcint_data_t hcint; ++ hcintmsk_data_t hcintmsk; ++ dwc_hc_t *hc; ++ dwc_otg_hc_regs_t *hc_regs; ++ dwc_otg_qtd_t *qtd; ++ ++ DWC_DEBUGPL(DBG_HCDV, "--Host Channel Interrupt--, Channel %d\n", num); ++ ++ hc = dwc_otg_hcd->hc_ptr_array[num]; ++ hc_regs = dwc_otg_hcd->core_if->host_if->hc_regs[num]; ++ if(hc->halt_status == DWC_OTG_HC_XFER_URB_DEQUEUE) { ++ /* We are responding to a channel disable. Driver ++ * state is cleared - our qtd has gone away. ++ */ ++ release_channel(dwc_otg_hcd, hc, NULL, hc->halt_status); ++ return 1; ++ } ++ qtd = DWC_CIRCLEQ_FIRST(&hc->qh->qtd_list); ++ ++ /* ++ * FSM mode: Check to see if this is a HC interrupt from a channel handled by the FIQ. ++ * Execution path is fundamentally different for the channels after a FIQ has completed ++ * a split transaction. ++ */ ++ if (fiq_fsm_enable) { ++ switch (dwc_otg_hcd->fiq_state->channel[num].fsm) { ++ case FIQ_PASSTHROUGH: ++ break; ++ case FIQ_PASSTHROUGH_ERRORSTATE: ++ /* Hook into the error count */ ++ fiq_print(FIQDBG_ERR, dwc_otg_hcd->fiq_state, "HCDERR%02d", num); ++ if (!dwc_otg_hcd->fiq_state->channel[num].nr_errors) { ++ qtd->error_count = 0; ++ fiq_print(FIQDBG_ERR, dwc_otg_hcd->fiq_state, "RESET "); ++ } ++ break; ++ default: ++ dwc_otg_hcd_handle_hc_fsm(dwc_otg_hcd, num); ++ return 1; ++ } ++ } ++ ++ hcint.d32 = DWC_READ_REG32(&hc_regs->hcint); ++ hcintmsk.d32 = DWC_READ_REG32(&hc_regs->hcintmsk); ++ hcint.d32 = hcint.d32 & hcintmsk.d32; ++ if (!dwc_otg_hcd->core_if->dma_enable) { ++ if (hcint.b.chhltd && hcint.d32 != 0x2) { ++ hcint.b.chhltd = 0; ++ } ++ } ++ ++ if (hcint.b.xfercomp) { ++ retval |= ++ handle_hc_xfercomp_intr(dwc_otg_hcd, hc, hc_regs, qtd); ++ /* ++ * If NYET occurred at same time as Xfer Complete, the NYET is ++ * handled by the Xfer Complete interrupt handler. Don't want ++ * to call the NYET interrupt handler in this case. ++ */ ++ hcint.b.nyet = 0; ++ } ++ if (hcint.b.chhltd) { ++ retval |= handle_hc_chhltd_intr(dwc_otg_hcd, hc, hc_regs, qtd); ++ } ++ if (hcint.b.ahberr) { ++ retval |= handle_hc_ahberr_intr(dwc_otg_hcd, hc, hc_regs, qtd); ++ } ++ if (hcint.b.stall) { ++ retval |= handle_hc_stall_intr(dwc_otg_hcd, hc, hc_regs, qtd); ++ } ++ if (hcint.b.nak) { ++ retval |= handle_hc_nak_intr(dwc_otg_hcd, hc, hc_regs, qtd); ++ } ++ if (hcint.b.ack) { ++ if(!hcint.b.chhltd) ++ retval |= handle_hc_ack_intr(dwc_otg_hcd, hc, hc_regs, qtd); ++ } ++ if (hcint.b.nyet) { ++ retval |= handle_hc_nyet_intr(dwc_otg_hcd, hc, hc_regs, qtd); ++ } ++ if (hcint.b.xacterr) { ++ retval |= handle_hc_xacterr_intr(dwc_otg_hcd, hc, hc_regs, qtd); ++ } ++ if (hcint.b.bblerr) { ++ retval |= handle_hc_babble_intr(dwc_otg_hcd, hc, hc_regs, qtd); ++ } ++ if (hcint.b.frmovrun) { ++ retval |= ++ handle_hc_frmovrun_intr(dwc_otg_hcd, hc, hc_regs, qtd); ++ } ++ if (hcint.b.datatglerr) { ++ retval |= ++ handle_hc_datatglerr_intr(dwc_otg_hcd, hc, hc_regs, qtd); ++ } ++ ++ return retval; ++} ++#endif /* DWC_DEVICE_ONLY */ +diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c b/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c +new file mode 100644 +index 0000000..2ceed42 +--- /dev/null ++++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c +@@ -0,0 +1,1005 @@ ++ ++/* ========================================================================== ++ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_hcd_linux.c $ ++ * $Revision: #20 $ ++ * $Date: 2011/10/26 $ ++ * $Change: 1872981 $ ++ * ++ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, ++ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless ++ * otherwise expressly agreed to in writing between Synopsys and you. ++ * ++ * The Software IS NOT an item of Licensed Software or Licensed Product under ++ * any End User Software License Agreement or Agreement for Licensed Product ++ * with Synopsys or any supplement thereto. You are permitted to use and ++ * redistribute this Software in source and binary forms, with or without ++ * modification, provided that redistributions of source code must retain this ++ * notice. You may not view, use, disclose, copy or distribute this file or ++ * any information contained herein except pursuant to this license grant from ++ * Synopsys. If you do not agree with this notice, including the disclaimer ++ * below, then you are not authorized to use the Software. ++ * ++ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS ++ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS 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. ++ * ========================================================================== */ ++#ifndef DWC_DEVICE_ONLY ++ ++/** ++ * @file ++ * ++ * This file contains the implementation of the HCD. In Linux, the HCD ++ * implements the hc_driver API. ++ */ ++#include <linux/kernel.h> ++#include <linux/module.h> ++#include <linux/moduleparam.h> ++#include <linux/init.h> ++#include <linux/device.h> ++#include <linux/errno.h> ++#include <linux/list.h> ++#include <linux/interrupt.h> ++#include <linux/string.h> ++#include <linux/dma-mapping.h> ++#include <linux/version.h> ++#include <asm/io.h> ++#include <asm/fiq.h> ++#include <linux/usb.h> ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35) ++#include <../drivers/usb/core/hcd.h> ++#else ++#include <linux/usb/hcd.h> ++#endif ++#include <asm/bug.h> ++ ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,30)) ++#define USB_URB_EP_LINKING 1 ++#else ++#define USB_URB_EP_LINKING 0 ++#endif ++ ++#include "dwc_otg_hcd_if.h" ++#include "dwc_otg_dbg.h" ++#include "dwc_otg_driver.h" ++#include "dwc_otg_hcd.h" ++ ++extern unsigned char _dwc_otg_fiq_stub, _dwc_otg_fiq_stub_end; ++ ++/** ++ * Gets the endpoint number from a _bEndpointAddress argument. The endpoint is ++ * qualified with its direction (possible 32 endpoints per device). ++ */ ++#define dwc_ep_addr_to_endpoint(_bEndpointAddress_) ((_bEndpointAddress_ & USB_ENDPOINT_NUMBER_MASK) | \ ++ ((_bEndpointAddress_ & USB_DIR_IN) != 0) << 4) ++ ++static const char dwc_otg_hcd_name[] = "dwc_otg_hcd"; ++ ++extern bool fiq_enable; ++ ++/** @name Linux HC Driver API Functions */ ++/** @{ */ ++/* manage i/o requests, device state */ ++static int dwc_otg_urb_enqueue(struct usb_hcd *hcd, ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) ++ struct usb_host_endpoint *ep, ++#endif ++ struct urb *urb, gfp_t mem_flags); ++ ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30) ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) ++static int dwc_otg_urb_dequeue(struct usb_hcd *hcd, struct urb *urb); ++#endif ++#else /* kernels at or post 2.6.30 */ ++static int dwc_otg_urb_dequeue(struct usb_hcd *hcd, ++ struct urb *urb, int status); ++#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30) */ ++ ++static void endpoint_disable(struct usb_hcd *hcd, struct usb_host_endpoint *ep); ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,30) ++static void endpoint_reset(struct usb_hcd *hcd, struct usb_host_endpoint *ep); ++#endif ++static irqreturn_t dwc_otg_hcd_irq(struct usb_hcd *hcd); ++extern int hcd_start(struct usb_hcd *hcd); ++extern void hcd_stop(struct usb_hcd *hcd); ++static int get_frame_number(struct usb_hcd *hcd); ++extern int hub_status_data(struct usb_hcd *hcd, char *buf); ++extern int hub_control(struct usb_hcd *hcd, ++ u16 typeReq, ++ u16 wValue, u16 wIndex, char *buf, u16 wLength); ++ ++struct wrapper_priv_data { ++ dwc_otg_hcd_t *dwc_otg_hcd; ++}; ++ ++/** @} */ ++ ++static struct hc_driver dwc_otg_hc_driver = { ++ ++ .description = dwc_otg_hcd_name, ++ .product_desc = "DWC OTG Controller", ++ .hcd_priv_size = sizeof(struct wrapper_priv_data), ++ ++ .irq = dwc_otg_hcd_irq, ++ ++ .flags = HCD_MEMORY | HCD_USB2, ++ ++ //.reset = ++ .start = hcd_start, ++ //.suspend = ++ //.resume = ++ .stop = hcd_stop, ++ ++ .urb_enqueue = dwc_otg_urb_enqueue, ++ .urb_dequeue = dwc_otg_urb_dequeue, ++ .endpoint_disable = endpoint_disable, ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,30) ++ .endpoint_reset = endpoint_reset, ++#endif ++ .get_frame_number = get_frame_number, ++ ++ .hub_status_data = hub_status_data, ++ .hub_control = hub_control, ++ //.bus_suspend = ++ //.bus_resume = ++}; ++ ++/** Gets the dwc_otg_hcd from a struct usb_hcd */ ++static inline dwc_otg_hcd_t *hcd_to_dwc_otg_hcd(struct usb_hcd *hcd) ++{ ++ struct wrapper_priv_data *p; ++ p = (struct wrapper_priv_data *)(hcd->hcd_priv); ++ return p->dwc_otg_hcd; ++} ++ ++/** Gets the struct usb_hcd that contains a dwc_otg_hcd_t. */ ++static inline struct usb_hcd *dwc_otg_hcd_to_hcd(dwc_otg_hcd_t * dwc_otg_hcd) ++{ ++ return dwc_otg_hcd_get_priv_data(dwc_otg_hcd); ++} ++ ++/** Gets the usb_host_endpoint associated with an URB. */ ++inline struct usb_host_endpoint *dwc_urb_to_endpoint(struct urb *urb) ++{ ++ struct usb_device *dev = urb->dev; ++ int ep_num = usb_pipeendpoint(urb->pipe); ++ ++ if (usb_pipein(urb->pipe)) ++ return dev->ep_in[ep_num]; ++ else ++ return dev->ep_out[ep_num]; ++} ++ ++static int _disconnect(dwc_otg_hcd_t * hcd) ++{ ++ struct usb_hcd *usb_hcd = dwc_otg_hcd_to_hcd(hcd); ++ ++ usb_hcd->self.is_b_host = 0; ++ return 0; ++} ++ ++static int _start(dwc_otg_hcd_t * hcd) ++{ ++ struct usb_hcd *usb_hcd = dwc_otg_hcd_to_hcd(hcd); ++ ++ usb_hcd->self.is_b_host = dwc_otg_hcd_is_b_host(hcd); ++ hcd_start(usb_hcd); ++ ++ return 0; ++} ++ ++static int _hub_info(dwc_otg_hcd_t * hcd, void *urb_handle, uint32_t * hub_addr, ++ uint32_t * port_addr) ++{ ++ struct urb *urb = (struct urb *)urb_handle; ++ struct usb_bus *bus; ++#if 1 //GRAYG - temporary ++ if (NULL == urb_handle) ++ DWC_ERROR("**** %s - NULL URB handle\n", __func__);//GRAYG ++ if (NULL == urb->dev) ++ DWC_ERROR("**** %s - URB has no device\n", __func__);//GRAYG ++ if (NULL == port_addr) ++ DWC_ERROR("**** %s - NULL port_address\n", __func__);//GRAYG ++#endif ++ if (urb->dev->tt) { ++ if (NULL == urb->dev->tt->hub) { ++ DWC_ERROR("**** %s - (URB's transactor has no TT - giving no hub)\n", ++ __func__); //GRAYG ++ //*hub_addr = (u8)usb_pipedevice(urb->pipe); //GRAYG ++ *hub_addr = 0; //GRAYG ++ // we probably shouldn't have a transaction translator if ++ // there's no associated hub? ++ } else { ++ bus = hcd_to_bus(dwc_otg_hcd_to_hcd(hcd)); ++ if (urb->dev->tt->hub == bus->root_hub) ++ *hub_addr = 0; ++ else ++ *hub_addr = urb->dev->tt->hub->devnum; ++ } ++ *port_addr = urb->dev->tt->multi ? urb->dev->ttport : 1; ++ } else { ++ *hub_addr = 0; ++ *port_addr = urb->dev->ttport; ++ } ++ return 0; ++} ++ ++static int _speed(dwc_otg_hcd_t * hcd, void *urb_handle) ++{ ++ struct urb *urb = (struct urb *)urb_handle; ++ return urb->dev->speed; ++} ++ ++static int _get_b_hnp_enable(dwc_otg_hcd_t * hcd) ++{ ++ struct usb_hcd *usb_hcd = dwc_otg_hcd_to_hcd(hcd); ++ return usb_hcd->self.b_hnp_enable; ++} ++ ++static void allocate_bus_bandwidth(struct usb_hcd *hcd, uint32_t bw, ++ struct urb *urb) ++{ ++ hcd_to_bus(hcd)->bandwidth_allocated += bw / urb->interval; ++ if (usb_pipetype(urb->pipe) == PIPE_ISOCHRONOUS) { ++ hcd_to_bus(hcd)->bandwidth_isoc_reqs++; ++ } else { ++ hcd_to_bus(hcd)->bandwidth_int_reqs++; ++ } ++} ++ ++static void free_bus_bandwidth(struct usb_hcd *hcd, uint32_t bw, ++ struct urb *urb) ++{ ++ hcd_to_bus(hcd)->bandwidth_allocated -= bw / urb->interval; ++ if (usb_pipetype(urb->pipe) == PIPE_ISOCHRONOUS) { ++ hcd_to_bus(hcd)->bandwidth_isoc_reqs--; ++ } else { ++ hcd_to_bus(hcd)->bandwidth_int_reqs--; ++ } ++} ++ ++/** ++ * Sets the final status of an URB and returns it to the device driver. Any ++ * required cleanup of the URB is performed. The HCD lock should be held on ++ * entry. ++ */ ++static int _complete(dwc_otg_hcd_t * hcd, void *urb_handle, ++ dwc_otg_hcd_urb_t * dwc_otg_urb, int32_t status) ++{ ++ struct urb *urb = (struct urb *)urb_handle; ++ urb_tq_entry_t *new_entry; ++ int rc = 0; ++ if (CHK_DEBUG_LEVEL(DBG_HCDV | DBG_HCD_URB)) { ++ DWC_PRINTF("%s: urb %p, device %d, ep %d %s, status=%d\n", ++ __func__, urb, usb_pipedevice(urb->pipe), ++ usb_pipeendpoint(urb->pipe), ++ usb_pipein(urb->pipe) ? "IN" : "OUT", status); ++ if (usb_pipetype(urb->pipe) == PIPE_ISOCHRONOUS) { ++ int i; ++ for (i = 0; i < urb->number_of_packets; i++) { ++ DWC_PRINTF(" ISO Desc %d status: %d\n", ++ i, urb->iso_frame_desc[i].status); ++ } ++ } ++ } ++ new_entry = DWC_ALLOC_ATOMIC(sizeof(urb_tq_entry_t)); ++ urb->actual_length = dwc_otg_hcd_urb_get_actual_length(dwc_otg_urb); ++ /* Convert status value. */ ++ switch (status) { ++ case -DWC_E_PROTOCOL: ++ status = -EPROTO; ++ break; ++ case -DWC_E_IN_PROGRESS: ++ status = -EINPROGRESS; ++ break; ++ case -DWC_E_PIPE: ++ status = -EPIPE; ++ break; ++ case -DWC_E_IO: ++ status = -EIO; ++ break; ++ case -DWC_E_TIMEOUT: ++ status = -ETIMEDOUT; ++ break; ++ case -DWC_E_OVERFLOW: ++ status = -EOVERFLOW; ++ break; ++ case -DWC_E_SHUTDOWN: ++ status = -ESHUTDOWN; ++ break; ++ default: ++ if (status) { ++ DWC_PRINTF("Uknown urb status %d\n", status); ++ ++ } ++ } ++ ++ if (usb_pipetype(urb->pipe) == PIPE_ISOCHRONOUS) { ++ int i; ++ ++ urb->error_count = dwc_otg_hcd_urb_get_error_count(dwc_otg_urb); ++ for (i = 0; i < urb->number_of_packets; ++i) { ++ urb->iso_frame_desc[i].actual_length = ++ dwc_otg_hcd_urb_get_iso_desc_actual_length ++ (dwc_otg_urb, i); ++ urb->iso_frame_desc[i].status = ++ dwc_otg_hcd_urb_get_iso_desc_status(dwc_otg_urb, i); ++ } ++ } ++ ++ urb->status = status; ++ urb->hcpriv = NULL; ++ if (!status) { ++ if ((urb->transfer_flags & URB_SHORT_NOT_OK) && ++ (urb->actual_length < urb->transfer_buffer_length)) { ++ urb->status = -EREMOTEIO; ++ } ++ } ++ ++ if ((usb_pipetype(urb->pipe) == PIPE_ISOCHRONOUS) || ++ (usb_pipetype(urb->pipe) == PIPE_INTERRUPT)) { ++ struct usb_host_endpoint *ep = dwc_urb_to_endpoint(urb); ++ if (ep) { ++ free_bus_bandwidth(dwc_otg_hcd_to_hcd(hcd), ++ dwc_otg_hcd_get_ep_bandwidth(hcd, ++ ep->hcpriv), ++ urb); ++ } ++ } ++ DWC_FREE(dwc_otg_urb); ++ if (!new_entry) { ++ DWC_ERROR("dwc_otg_hcd: complete: cannot allocate URB TQ entry\n"); ++ urb->status = -EPROTO; ++ /* don't schedule the tasklet - ++ * directly return the packet here with error. */ ++#if USB_URB_EP_LINKING ++ usb_hcd_unlink_urb_from_ep(dwc_otg_hcd_to_hcd(hcd), urb); ++#endif ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) ++ usb_hcd_giveback_urb(dwc_otg_hcd_to_hcd(hcd), urb); ++#else ++ usb_hcd_giveback_urb(dwc_otg_hcd_to_hcd(hcd), urb, urb->status); ++#endif ++ } else { ++ new_entry->urb = urb; ++#if USB_URB_EP_LINKING ++ rc = usb_hcd_check_unlink_urb(dwc_otg_hcd_to_hcd(hcd), urb, urb->status); ++ if(0 == rc) { ++ usb_hcd_unlink_urb_from_ep(dwc_otg_hcd_to_hcd(hcd), urb); ++ } ++#endif ++ if(0 == rc) { ++ DWC_TAILQ_INSERT_TAIL(&hcd->completed_urb_list, new_entry, ++ urb_tq_entries); ++ DWC_TASK_HI_SCHEDULE(hcd->completion_tasklet); ++ } ++ } ++ return 0; ++} ++ ++static struct dwc_otg_hcd_function_ops hcd_fops = { ++ .start = _start, ++ .disconnect = _disconnect, ++ .hub_info = _hub_info, ++ .speed = _speed, ++ .complete = _complete, ++ .get_b_hnp_enable = _get_b_hnp_enable, ++}; ++ ++static struct fiq_handler fh = { ++ .name = "usb_fiq", ++}; ++ ++static void hcd_init_fiq(void *cookie) ++{ ++ dwc_otg_device_t *otg_dev = cookie; ++ dwc_otg_hcd_t *dwc_otg_hcd = otg_dev->hcd; ++ struct pt_regs regs; ++ int irq; ++ ++ if (claim_fiq(&fh)) { ++ DWC_ERROR("Can't claim FIQ"); ++ BUG(); ++ } ++ DWC_WARN("FIQ on core %d at 0x%08x", ++ smp_processor_id(), ++ (fiq_fsm_enable ? (int)&dwc_otg_fiq_fsm : (int)&dwc_otg_fiq_nop)); ++ DWC_WARN("FIQ ASM at 0x%08x length %d", (int)&_dwc_otg_fiq_stub, (int)(&_dwc_otg_fiq_stub_end - &_dwc_otg_fiq_stub)); ++ set_fiq_handler((void *) &_dwc_otg_fiq_stub, &_dwc_otg_fiq_stub_end - &_dwc_otg_fiq_stub); ++ memset(&regs,0,sizeof(regs)); ++ ++ regs.ARM_r8 = (long) dwc_otg_hcd->fiq_state; ++ if (fiq_fsm_enable) { ++ regs.ARM_r9 = dwc_otg_hcd->core_if->core_params->host_channels; ++ //regs.ARM_r10 = dwc_otg_hcd->dma; ++ regs.ARM_fp = (long) dwc_otg_fiq_fsm; ++ } else { ++ regs.ARM_fp = (long) dwc_otg_fiq_nop; ++ } ++ ++ regs.ARM_sp = (long) dwc_otg_hcd->fiq_stack + (sizeof(struct fiq_stack) - 4); ++ ++// __show_regs(&regs); ++ set_fiq_regs(&regs); ++ ++ //Set the mphi periph to the required registers ++ dwc_otg_hcd->fiq_state->mphi_regs.base = otg_dev->os_dep.mphi_base; ++ dwc_otg_hcd->fiq_state->mphi_regs.ctrl = otg_dev->os_dep.mphi_base + 0x4c; ++ dwc_otg_hcd->fiq_state->mphi_regs.outdda = otg_dev->os_dep.mphi_base + 0x28; ++ dwc_otg_hcd->fiq_state->mphi_regs.outddb = otg_dev->os_dep.mphi_base + 0x2c; ++ dwc_otg_hcd->fiq_state->mphi_regs.intstat = otg_dev->os_dep.mphi_base + 0x50; ++ dwc_otg_hcd->fiq_state->dwc_regs_base = otg_dev->os_dep.base; ++ DWC_WARN("MPHI regs_base at 0x%08x", (int)dwc_otg_hcd->fiq_state->mphi_regs.base); ++ //Enable mphi peripheral ++ writel((1<<31),dwc_otg_hcd->fiq_state->mphi_regs.ctrl); ++#ifdef DEBUG ++ if (readl(dwc_otg_hcd->fiq_state->mphi_regs.ctrl) & 0x80000000) ++ DWC_WARN("MPHI periph has been enabled"); ++ else ++ DWC_WARN("MPHI periph has NOT been enabled"); ++#endif ++ // Enable FIQ interrupt from USB peripheral ++#ifdef CONFIG_MULTI_IRQ_HANDLER ++ irq = platform_get_irq(otg_dev->os_dep.platformdev, 1); ++#else ++ irq = INTERRUPT_VC_USB; ++#endif ++ if (irq < 0) { ++ DWC_ERROR("Can't get FIQ irq"); ++ return; ++ } ++ enable_fiq(irq); ++ local_fiq_enable(); ++} ++ ++/** ++ * Initializes the HCD. This function allocates memory for and initializes the ++ * static parts of the usb_hcd and dwc_otg_hcd structures. It also registers the ++ * USB bus with the core and calls the hc_driver->start() function. It returns ++ * a negative error on failure. ++ */ ++int hcd_init(dwc_bus_dev_t *_dev) ++{ ++ struct usb_hcd *hcd = NULL; ++ dwc_otg_hcd_t *dwc_otg_hcd = NULL; ++ dwc_otg_device_t *otg_dev = DWC_OTG_BUSDRVDATA(_dev); ++ int retval = 0; ++ u64 dmamask; ++ ++ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD INIT otg_dev=%p\n", otg_dev); ++ ++ /* Set device flags indicating whether the HCD supports DMA. */ ++ if (dwc_otg_is_dma_enable(otg_dev->core_if)) ++ dmamask = DMA_BIT_MASK(32); ++ else ++ dmamask = 0; ++ ++#if defined(LM_INTERFACE) || defined(PLATFORM_INTERFACE) ++ dma_set_mask(&_dev->dev, dmamask); ++ dma_set_coherent_mask(&_dev->dev, dmamask); ++#elif defined(PCI_INTERFACE) ++ pci_set_dma_mask(_dev, dmamask); ++ pci_set_consistent_dma_mask(_dev, dmamask); ++#endif ++ ++ /* ++ * Allocate memory for the base HCD plus the DWC OTG HCD. ++ * Initialize the base HCD. ++ */ ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30) ++ hcd = usb_create_hcd(&dwc_otg_hc_driver, &_dev->dev, _dev->dev.bus_id); ++#else ++ hcd = usb_create_hcd(&dwc_otg_hc_driver, &_dev->dev, dev_name(&_dev->dev)); ++ hcd->has_tt = 1; ++// hcd->uses_new_polling = 1; ++// hcd->poll_rh = 0; ++#endif ++ if (!hcd) { ++ retval = -ENOMEM; ++ goto error1; ++ } ++ ++ hcd->regs = otg_dev->os_dep.base; ++ ++ ++ /* Initialize the DWC OTG HCD. */ ++ dwc_otg_hcd = dwc_otg_hcd_alloc_hcd(); ++ if (!dwc_otg_hcd) { ++ goto error2; ++ } ++ ((struct wrapper_priv_data *)(hcd->hcd_priv))->dwc_otg_hcd = ++ dwc_otg_hcd; ++ otg_dev->hcd = dwc_otg_hcd; ++ ++ if (dwc_otg_hcd_init(dwc_otg_hcd, otg_dev->core_if)) { ++ goto error2; ++ } ++ ++ if (fiq_enable) { ++ if (num_online_cpus() > 1) { ++ /* bcm2709: can run the FIQ on a separate core to IRQs */ ++ smp_call_function_single(1, hcd_init_fiq, otg_dev, 1); ++ } else { ++ smp_call_function_single(0, hcd_init_fiq, otg_dev, 1); ++ } ++ } ++ ++ otg_dev->hcd->otg_dev = otg_dev; ++ hcd->self.otg_port = dwc_otg_hcd_otg_port(dwc_otg_hcd); ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33) //don't support for LM(with 2.6.20.1 kernel) ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35) //version field absent later ++ hcd->self.otg_version = dwc_otg_get_otg_version(otg_dev->core_if); ++#endif ++ /* Don't support SG list at this point */ ++ hcd->self.sg_tablesize = 0; ++#endif ++ /* ++ * Finish generic HCD initialization and start the HCD. This function ++ * allocates the DMA buffer pool, registers the USB bus, requests the ++ * IRQ line, and calls hcd_start method. ++ */ ++#ifdef PLATFORM_INTERFACE ++ retval = usb_add_hcd(hcd, platform_get_irq(_dev, fiq_enable ? 0 : 1), IRQF_SHARED); ++#else ++ retval = usb_add_hcd(hcd, _dev->irq, IRQF_SHARED); ++#endif ++ if (retval < 0) { ++ goto error2; ++ } ++ ++ dwc_otg_hcd_set_priv_data(dwc_otg_hcd, hcd); ++ return 0; ++ ++error2: ++ usb_put_hcd(hcd); ++error1: ++ return retval; ++} ++ ++/** ++ * Removes the HCD. ++ * Frees memory and resources associated with the HCD and deregisters the bus. ++ */ ++void hcd_remove(dwc_bus_dev_t *_dev) ++{ ++ dwc_otg_device_t *otg_dev = DWC_OTG_BUSDRVDATA(_dev); ++ dwc_otg_hcd_t *dwc_otg_hcd; ++ struct usb_hcd *hcd; ++ ++ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD REMOVE otg_dev=%p\n", otg_dev); ++ ++ if (!otg_dev) { ++ DWC_DEBUGPL(DBG_ANY, "%s: otg_dev NULL!\n", __func__); ++ return; ++ } ++ ++ dwc_otg_hcd = otg_dev->hcd; ++ ++ if (!dwc_otg_hcd) { ++ DWC_DEBUGPL(DBG_ANY, "%s: otg_dev->hcd NULL!\n", __func__); ++ return; ++ } ++ ++ hcd = dwc_otg_hcd_to_hcd(dwc_otg_hcd); ++ ++ if (!hcd) { ++ DWC_DEBUGPL(DBG_ANY, ++ "%s: dwc_otg_hcd_to_hcd(dwc_otg_hcd) NULL!\n", ++ __func__); ++ return; ++ } ++ usb_remove_hcd(hcd); ++ dwc_otg_hcd_set_priv_data(dwc_otg_hcd, NULL); ++ dwc_otg_hcd_remove(dwc_otg_hcd); ++ usb_put_hcd(hcd); ++} ++ ++/* ========================================================================= ++ * Linux HC Driver Functions ++ * ========================================================================= */ ++ ++/** Initializes the DWC_otg controller and its root hub and prepares it for host ++ * mode operation. Activates the root port. Returns 0 on success and a negative ++ * error code on failure. */ ++int hcd_start(struct usb_hcd *hcd) ++{ ++ dwc_otg_hcd_t *dwc_otg_hcd = hcd_to_dwc_otg_hcd(hcd); ++ struct usb_bus *bus; ++ ++ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD START\n"); ++ bus = hcd_to_bus(hcd); ++ ++ hcd->state = HC_STATE_RUNNING; ++ if (dwc_otg_hcd_start(dwc_otg_hcd, &hcd_fops)) { ++ return 0; ++ } ++ ++ /* Initialize and connect root hub if one is not already attached */ ++ if (bus->root_hub) { ++ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD Has Root Hub\n"); ++ /* Inform the HUB driver to resume. */ ++ usb_hcd_resume_root_hub(hcd); ++ } ++ ++ return 0; ++} ++ ++/** ++ * Halts the DWC_otg host mode operations in a clean manner. USB transfers are ++ * stopped. ++ */ ++void hcd_stop(struct usb_hcd *hcd) ++{ ++ dwc_otg_hcd_t *dwc_otg_hcd = hcd_to_dwc_otg_hcd(hcd); ++ ++ dwc_otg_hcd_stop(dwc_otg_hcd); ++} ++ ++/** Returns the current frame number. */ ++static int get_frame_number(struct usb_hcd *hcd) ++{ ++ hprt0_data_t hprt0; ++ dwc_otg_hcd_t *dwc_otg_hcd = hcd_to_dwc_otg_hcd(hcd); ++ hprt0.d32 = DWC_READ_REG32(dwc_otg_hcd->core_if->host_if->hprt0); ++ if (hprt0.b.prtspd == DWC_HPRT0_PRTSPD_HIGH_SPEED) ++ return dwc_otg_hcd_get_frame_number(dwc_otg_hcd) >> 3; ++ else ++ return dwc_otg_hcd_get_frame_number(dwc_otg_hcd); ++} ++ ++#ifdef DEBUG ++static void dump_urb_info(struct urb *urb, char *fn_name) ++{ ++ DWC_PRINTF("%s, urb %p\n", fn_name, urb); ++ DWC_PRINTF(" Device address: %d\n", usb_pipedevice(urb->pipe)); ++ DWC_PRINTF(" Endpoint: %d, %s\n", usb_pipeendpoint(urb->pipe), ++ (usb_pipein(urb->pipe) ? "IN" : "OUT")); ++ DWC_PRINTF(" Endpoint type: %s\n", ( { ++ char *pipetype; ++ switch (usb_pipetype(urb->pipe)) { ++case PIPE_CONTROL: ++pipetype = "CONTROL"; break; case PIPE_BULK: ++pipetype = "BULK"; break; case PIPE_INTERRUPT: ++pipetype = "INTERRUPT"; break; case PIPE_ISOCHRONOUS: ++pipetype = "ISOCHRONOUS"; break; default: ++ pipetype = "UNKNOWN"; break;}; ++ pipetype;} ++ )) ; ++ DWC_PRINTF(" Speed: %s\n", ( { ++ char *speed; switch (urb->dev->speed) { ++case USB_SPEED_HIGH: ++speed = "HIGH"; break; case USB_SPEED_FULL: ++speed = "FULL"; break; case USB_SPEED_LOW: ++speed = "LOW"; break; default: ++ speed = "UNKNOWN"; break;}; ++ speed;} ++ )) ; ++ DWC_PRINTF(" Max packet size: %d\n", ++ usb_maxpacket(urb->dev, urb->pipe, usb_pipeout(urb->pipe))); ++ DWC_PRINTF(" Data buffer length: %d\n", urb->transfer_buffer_length); ++ DWC_PRINTF(" Transfer buffer: %p, Transfer DMA: %p\n", ++ urb->transfer_buffer, (void *)urb->transfer_dma); ++ DWC_PRINTF(" Setup buffer: %p, Setup DMA: %p\n", ++ urb->setup_packet, (void *)urb->setup_dma); ++ DWC_PRINTF(" Interval: %d\n", urb->interval); ++ if (usb_pipetype(urb->pipe) == PIPE_ISOCHRONOUS) { ++ int i; ++ for (i = 0; i < urb->number_of_packets; i++) { ++ DWC_PRINTF(" ISO Desc %d:\n", i); ++ DWC_PRINTF(" offset: %d, length %d\n", ++ urb->iso_frame_desc[i].offset, ++ urb->iso_frame_desc[i].length); ++ } ++ } ++} ++#endif ++ ++/** Starts processing a USB transfer request specified by a USB Request Block ++ * (URB). mem_flags indicates the type of memory allocation to use while ++ * processing this URB. */ ++static int dwc_otg_urb_enqueue(struct usb_hcd *hcd, ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) ++ struct usb_host_endpoint *ep, ++#endif ++ struct urb *urb, gfp_t mem_flags) ++{ ++ int retval = 0; ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28) ++ struct usb_host_endpoint *ep = urb->ep; ++#endif ++ dwc_irqflags_t irqflags; ++ void **ref_ep_hcpriv = &ep->hcpriv; ++ dwc_otg_hcd_t *dwc_otg_hcd = hcd_to_dwc_otg_hcd(hcd); ++ dwc_otg_hcd_urb_t *dwc_otg_urb; ++ int i; ++ int alloc_bandwidth = 0; ++ uint8_t ep_type = 0; ++ uint32_t flags = 0; ++ void *buf; ++ ++#ifdef DEBUG ++ if (CHK_DEBUG_LEVEL(DBG_HCDV | DBG_HCD_URB)) { ++ dump_urb_info(urb, "dwc_otg_urb_enqueue"); ++ } ++#endif ++ ++ if (!urb->transfer_buffer && urb->transfer_buffer_length) ++ return -EINVAL; ++ ++ if ((usb_pipetype(urb->pipe) == PIPE_ISOCHRONOUS) ++ || (usb_pipetype(urb->pipe) == PIPE_INTERRUPT)) { ++ if (!dwc_otg_hcd_is_bandwidth_allocated ++ (dwc_otg_hcd, ref_ep_hcpriv)) { ++ alloc_bandwidth = 1; ++ } ++ } ++ ++ switch (usb_pipetype(urb->pipe)) { ++ case PIPE_CONTROL: ++ ep_type = USB_ENDPOINT_XFER_CONTROL; ++ break; ++ case PIPE_ISOCHRONOUS: ++ ep_type = USB_ENDPOINT_XFER_ISOC; ++ break; ++ case PIPE_BULK: ++ ep_type = USB_ENDPOINT_XFER_BULK; ++ break; ++ case PIPE_INTERRUPT: ++ ep_type = USB_ENDPOINT_XFER_INT; ++ break; ++ default: ++ DWC_WARN("Wrong EP type - %d\n", usb_pipetype(urb->pipe)); ++ } ++ ++ /* # of packets is often 0 - do we really need to call this then? */ ++ dwc_otg_urb = dwc_otg_hcd_urb_alloc(dwc_otg_hcd, ++ urb->number_of_packets, ++ mem_flags == GFP_ATOMIC ? 1 : 0); ++ ++ if(dwc_otg_urb == NULL) ++ return -ENOMEM; ++ ++ if (!dwc_otg_urb && urb->number_of_packets) ++ return -ENOMEM; ++ ++ dwc_otg_hcd_urb_set_pipeinfo(dwc_otg_urb, usb_pipedevice(urb->pipe), ++ usb_pipeendpoint(urb->pipe), ep_type, ++ usb_pipein(urb->pipe), ++ usb_maxpacket(urb->dev, urb->pipe, ++ !(usb_pipein(urb->pipe)))); ++ ++ buf = urb->transfer_buffer; ++ if (hcd->self.uses_dma && !buf && urb->transfer_buffer_length) { ++ /* ++ * Calculate virtual address from physical address, ++ * because some class driver may not fill transfer_buffer. ++ * In Buffer DMA mode virual address is used, ++ * when handling non DWORD aligned buffers. ++ */ ++ buf = (void *)__bus_to_virt((unsigned long)urb->transfer_dma); ++ dev_warn_once(&urb->dev->dev, ++ "USB transfer_buffer was NULL, will use __bus_to_virt(%pad)=%p\n", ++ &urb->transfer_dma, buf); ++ } ++ ++ if (!(urb->transfer_flags & URB_NO_INTERRUPT)) ++ flags |= URB_GIVEBACK_ASAP; ++ if (urb->transfer_flags & URB_ZERO_PACKET) ++ flags |= URB_SEND_ZERO_PACKET; ++ ++ dwc_otg_hcd_urb_set_params(dwc_otg_urb, urb, buf, ++ urb->transfer_dma, ++ urb->transfer_buffer_length, ++ urb->setup_packet, ++ urb->setup_dma, flags, urb->interval); ++ ++ for (i = 0; i < urb->number_of_packets; ++i) { ++ dwc_otg_hcd_urb_set_iso_desc_params(dwc_otg_urb, i, ++ urb-> ++ iso_frame_desc[i].offset, ++ urb-> ++ iso_frame_desc[i].length); ++ } ++ ++ DWC_SPINLOCK_IRQSAVE(dwc_otg_hcd->lock, &irqflags); ++ urb->hcpriv = dwc_otg_urb; ++#if USB_URB_EP_LINKING ++ retval = usb_hcd_link_urb_to_ep(hcd, urb); ++ if (0 == retval) ++#endif ++ { ++ retval = dwc_otg_hcd_urb_enqueue(dwc_otg_hcd, dwc_otg_urb, ++ /*(dwc_otg_qh_t **)*/ ++ ref_ep_hcpriv, 1); ++ if (0 == retval) { ++ if (alloc_bandwidth) { ++ allocate_bus_bandwidth(hcd, ++ dwc_otg_hcd_get_ep_bandwidth( ++ dwc_otg_hcd, *ref_ep_hcpriv), ++ urb); ++ } ++ } else { ++ DWC_DEBUGPL(DBG_HCD, "DWC OTG dwc_otg_hcd_urb_enqueue failed rc %d\n", retval); ++#if USB_URB_EP_LINKING ++ usb_hcd_unlink_urb_from_ep(hcd, urb); ++#endif ++ DWC_FREE(dwc_otg_urb); ++ urb->hcpriv = NULL; ++ if (retval == -DWC_E_NO_DEVICE) ++ retval = -ENODEV; ++ } ++ } ++#if USB_URB_EP_LINKING ++ else ++ { ++ DWC_FREE(dwc_otg_urb); ++ urb->hcpriv = NULL; ++ } ++#endif ++ DWC_SPINUNLOCK_IRQRESTORE(dwc_otg_hcd->lock, irqflags); ++ return retval; ++} ++ ++/** Aborts/cancels a USB transfer request. Always returns 0 to indicate ++ * success. */ ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) ++static int dwc_otg_urb_dequeue(struct usb_hcd *hcd, struct urb *urb) ++#else ++static int dwc_otg_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status) ++#endif ++{ ++ dwc_irqflags_t flags; ++ dwc_otg_hcd_t *dwc_otg_hcd; ++ int rc; ++ ++ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD URB Dequeue\n"); ++ ++ dwc_otg_hcd = hcd_to_dwc_otg_hcd(hcd); ++ ++#ifdef DEBUG ++ if (CHK_DEBUG_LEVEL(DBG_HCDV | DBG_HCD_URB)) { ++ dump_urb_info(urb, "dwc_otg_urb_dequeue"); ++ } ++#endif ++ ++ DWC_SPINLOCK_IRQSAVE(dwc_otg_hcd->lock, &flags); ++ rc = usb_hcd_check_unlink_urb(hcd, urb, status); ++ if (0 == rc) { ++ if(urb->hcpriv != NULL) { ++ dwc_otg_hcd_urb_dequeue(dwc_otg_hcd, ++ (dwc_otg_hcd_urb_t *)urb->hcpriv); ++ ++ DWC_FREE(urb->hcpriv); ++ urb->hcpriv = NULL; ++ } ++ } ++ ++ if (0 == rc) { ++ /* Higher layer software sets URB status. */ ++#if USB_URB_EP_LINKING ++ usb_hcd_unlink_urb_from_ep(hcd, urb); ++#endif ++ DWC_SPINUNLOCK_IRQRESTORE(dwc_otg_hcd->lock, flags); ++ ++ ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) ++ usb_hcd_giveback_urb(hcd, urb); ++#else ++ usb_hcd_giveback_urb(hcd, urb, status); ++#endif ++ if (CHK_DEBUG_LEVEL(DBG_HCDV | DBG_HCD_URB)) { ++ DWC_PRINTF("Called usb_hcd_giveback_urb() \n"); ++ DWC_PRINTF(" 1urb->status = %d\n", urb->status); ++ } ++ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD URB Dequeue OK\n"); ++ } else { ++ DWC_SPINUNLOCK_IRQRESTORE(dwc_otg_hcd->lock, flags); ++ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD URB Dequeue failed - rc %d\n", ++ rc); ++ } ++ ++ return rc; ++} ++ ++/* Frees resources in the DWC_otg controller related to a given endpoint. Also ++ * clears state in the HCD related to the endpoint. Any URBs for the endpoint ++ * must already be dequeued. */ ++static void endpoint_disable(struct usb_hcd *hcd, struct usb_host_endpoint *ep) ++{ ++ dwc_otg_hcd_t *dwc_otg_hcd = hcd_to_dwc_otg_hcd(hcd); ++ ++ DWC_DEBUGPL(DBG_HCD, ++ "DWC OTG HCD EP DISABLE: _bEndpointAddress=0x%02x, " ++ "endpoint=%d\n", ep->desc.bEndpointAddress, ++ dwc_ep_addr_to_endpoint(ep->desc.bEndpointAddress)); ++ dwc_otg_hcd_endpoint_disable(dwc_otg_hcd, ep->hcpriv, 250); ++ ep->hcpriv = NULL; ++} ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,30) ++/* Resets endpoint specific parameter values, in current version used to reset ++ * the data toggle(as a WA). This function can be called from usb_clear_halt routine */ ++static void endpoint_reset(struct usb_hcd *hcd, struct usb_host_endpoint *ep) ++{ ++ dwc_irqflags_t flags; ++ struct usb_device *udev = NULL; ++ int epnum = usb_endpoint_num(&ep->desc); ++ int is_out = usb_endpoint_dir_out(&ep->desc); ++ int is_control = usb_endpoint_xfer_control(&ep->desc); ++ dwc_otg_hcd_t *dwc_otg_hcd = hcd_to_dwc_otg_hcd(hcd); ++ struct device *dev = DWC_OTG_OS_GETDEV(dwc_otg_hcd->otg_dev->os_dep); ++ ++ if (dev) ++ udev = to_usb_device(dev); ++ else ++ return; ++ ++ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD EP RESET: Endpoint Num=0x%02d\n", epnum); ++ ++ DWC_SPINLOCK_IRQSAVE(dwc_otg_hcd->lock, &flags); ++ usb_settoggle(udev, epnum, is_out, 0); ++ if (is_control) ++ usb_settoggle(udev, epnum, !is_out, 0); ++ ++ if (ep->hcpriv) { ++ dwc_otg_hcd_endpoint_reset(dwc_otg_hcd, ep->hcpriv); ++ } ++ DWC_SPINUNLOCK_IRQRESTORE(dwc_otg_hcd->lock, flags); ++} ++#endif ++ ++/** Handles host mode interrupts for the DWC_otg controller. Returns IRQ_NONE if ++ * there was no interrupt to handle. Returns IRQ_HANDLED if there was a valid ++ * interrupt. ++ * ++ * This function is called by the USB core when an interrupt occurs */ ++static irqreturn_t dwc_otg_hcd_irq(struct usb_hcd *hcd) ++{ ++ dwc_otg_hcd_t *dwc_otg_hcd = hcd_to_dwc_otg_hcd(hcd); ++ int32_t retval = dwc_otg_hcd_handle_intr(dwc_otg_hcd); ++ if (retval != 0) { ++ S3C2410X_CLEAR_EINTPEND(); ++ } ++ return IRQ_RETVAL(retval); ++} ++ ++/** Creates Status Change bitmap for the root hub and root port. The bitmap is ++ * returned in buf. Bit 0 is the status change indicator for the root hub. Bit 1 ++ * is the status change indicator for the single root port. Returns 1 if either ++ * change indicator is 1, otherwise returns 0. */ ++int hub_status_data(struct usb_hcd *hcd, char *buf) ++{ ++ dwc_otg_hcd_t *dwc_otg_hcd = hcd_to_dwc_otg_hcd(hcd); ++ ++ buf[0] = 0; ++ buf[0] |= (dwc_otg_hcd_is_status_changed(dwc_otg_hcd, 1)) << 1; ++ ++ return (buf[0] != 0); ++} ++ ++/** Handles hub class-specific requests. */ ++int hub_control(struct usb_hcd *hcd, ++ u16 typeReq, u16 wValue, u16 wIndex, char *buf, u16 wLength) ++{ ++ int retval; ++ ++ retval = dwc_otg_hcd_hub_control(hcd_to_dwc_otg_hcd(hcd), ++ typeReq, wValue, wIndex, buf, wLength); ++ ++ switch (retval) { ++ case -DWC_E_INVALID: ++ retval = -EINVAL; ++ break; ++ } ++ ++ return retval; ++} ++ ++#endif /* DWC_DEVICE_ONLY */ +diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd_queue.c b/drivers/usb/host/dwc_otg/dwc_otg_hcd_queue.c +new file mode 100644 +index 0000000..3b2a607 +--- /dev/null ++++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd_queue.c +@@ -0,0 +1,962 @@ ++/* ========================================================================== ++ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_hcd_queue.c $ ++ * $Revision: #44 $ ++ * $Date: 2011/10/26 $ ++ * $Change: 1873028 $ ++ * ++ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, ++ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless ++ * otherwise expressly agreed to in writing between Synopsys and you. ++ * ++ * The Software IS NOT an item of Licensed Software or Licensed Product under ++ * any End User Software License Agreement or Agreement for Licensed Product ++ * with Synopsys or any supplement thereto. You are permitted to use and ++ * redistribute this Software in source and binary forms, with or without ++ * modification, provided that redistributions of source code must retain this ++ * notice. You may not view, use, disclose, copy or distribute this file or ++ * any information contained herein except pursuant to this license grant from ++ * Synopsys. If you do not agree with this notice, including the disclaimer ++ * below, then you are not authorized to use the Software. ++ * ++ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS ++ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS 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. ++ * ========================================================================== */ ++#ifndef DWC_DEVICE_ONLY ++ ++/** ++ * @file ++ * ++ * This file contains the functions to manage Queue Heads and Queue ++ * Transfer Descriptors. ++ */ ++ ++#include "dwc_otg_hcd.h" ++#include "dwc_otg_regs.h" ++ ++extern bool microframe_schedule; ++ ++/** ++ * Free each QTD in the QH's QTD-list then free the QH. QH should already be ++ * removed from a list. QTD list should already be empty if called from URB ++ * Dequeue. ++ * ++ * @param hcd HCD instance. ++ * @param qh The QH to free. ++ */ ++void dwc_otg_hcd_qh_free(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh) ++{ ++ dwc_otg_qtd_t *qtd, *qtd_tmp; ++ dwc_irqflags_t flags; ++ uint32_t buf_size = 0; ++ uint8_t *align_buf_virt = NULL; ++ dwc_dma_t align_buf_dma; ++ ++ /* Free each QTD in the QTD list */ ++ DWC_SPINLOCK_IRQSAVE(hcd->lock, &flags); ++ DWC_CIRCLEQ_FOREACH_SAFE(qtd, qtd_tmp, &qh->qtd_list, qtd_list_entry) { ++ DWC_CIRCLEQ_REMOVE(&qh->qtd_list, qtd, qtd_list_entry); ++ dwc_otg_hcd_qtd_free(qtd); ++ } ++ ++ if (hcd->core_if->dma_desc_enable) { ++ dwc_otg_hcd_qh_free_ddma(hcd, qh); ++ } else if (qh->dw_align_buf) { ++ if (qh->ep_type == UE_ISOCHRONOUS) { ++ buf_size = 4096; ++ } else { ++ buf_size = hcd->core_if->core_params->max_transfer_size; ++ } ++ align_buf_virt = qh->dw_align_buf; ++ align_buf_dma = qh->dw_align_buf_dma; ++ } ++ ++ DWC_FREE(qh); ++ DWC_SPINUNLOCK_IRQRESTORE(hcd->lock, flags); ++ if (align_buf_virt) ++ DWC_DMA_FREE(buf_size, align_buf_virt, align_buf_dma); ++ return; ++} ++ ++#define BitStuffTime(bytecount) ((8 * 7* bytecount) / 6) ++#define HS_HOST_DELAY 5 /* nanoseconds */ ++#define FS_LS_HOST_DELAY 1000 /* nanoseconds */ ++#define HUB_LS_SETUP 333 /* nanoseconds */ ++#define NS_TO_US(ns) ((ns + 500) / 1000) ++ /* convert & round nanoseconds to microseconds */ ++ ++static uint32_t calc_bus_time(int speed, int is_in, int is_isoc, int bytecount) ++{ ++ unsigned long retval; ++ ++ switch (speed) { ++ case USB_SPEED_HIGH: ++ if (is_isoc) { ++ retval = ++ ((38 * 8 * 2083) + ++ (2083 * (3 + BitStuffTime(bytecount)))) / 1000 + ++ HS_HOST_DELAY; ++ } else { ++ retval = ++ ((55 * 8 * 2083) + ++ (2083 * (3 + BitStuffTime(bytecount)))) / 1000 + ++ HS_HOST_DELAY; ++ } ++ break; ++ case USB_SPEED_FULL: ++ if (is_isoc) { ++ retval = ++ (8354 * (31 + 10 * BitStuffTime(bytecount))) / 1000; ++ if (is_in) { ++ retval = 7268 + FS_LS_HOST_DELAY + retval; ++ } else { ++ retval = 6265 + FS_LS_HOST_DELAY + retval; ++ } ++ } else { ++ retval = ++ (8354 * (31 + 10 * BitStuffTime(bytecount))) / 1000; ++ retval = 9107 + FS_LS_HOST_DELAY + retval; ++ } ++ break; ++ case USB_SPEED_LOW: ++ if (is_in) { ++ retval = ++ (67667 * (31 + 10 * BitStuffTime(bytecount))) / ++ 1000; ++ retval = ++ 64060 + (2 * HUB_LS_SETUP) + FS_LS_HOST_DELAY + ++ retval; ++ } else { ++ retval = ++ (66700 * (31 + 10 * BitStuffTime(bytecount))) / ++ 1000; ++ retval = ++ 64107 + (2 * HUB_LS_SETUP) + FS_LS_HOST_DELAY + ++ retval; ++ } ++ break; ++ default: ++ DWC_WARN("Unknown device speed\n"); ++ retval = -1; ++ } ++ ++ return NS_TO_US(retval); ++} ++ ++/** ++ * Initializes a QH structure. ++ * ++ * @param hcd The HCD state structure for the DWC OTG controller. ++ * @param qh The QH to init. ++ * @param urb Holds the information about the device/endpoint that we need ++ * to initialize the QH. ++ */ ++#define SCHEDULE_SLOP 10 ++void qh_init(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh, dwc_otg_hcd_urb_t * urb) ++{ ++ char *speed, *type; ++ int dev_speed; ++ uint32_t hub_addr, hub_port; ++ ++ dwc_memset(qh, 0, sizeof(dwc_otg_qh_t)); ++ ++ /* Initialize QH */ ++ qh->ep_type = dwc_otg_hcd_get_pipe_type(&urb->pipe_info); ++ qh->ep_is_in = dwc_otg_hcd_is_pipe_in(&urb->pipe_info) ? 1 : 0; ++ ++ qh->data_toggle = DWC_OTG_HC_PID_DATA0; ++ qh->maxp = dwc_otg_hcd_get_mps(&urb->pipe_info); ++ DWC_CIRCLEQ_INIT(&qh->qtd_list); ++ DWC_LIST_INIT(&qh->qh_list_entry); ++ qh->channel = NULL; ++ ++ /* FS/LS Enpoint on HS Hub ++ * NOT virtual root hub */ ++ dev_speed = hcd->fops->speed(hcd, urb->priv); ++ ++ hcd->fops->hub_info(hcd, urb->priv, &hub_addr, &hub_port); ++ qh->do_split = 0; ++ if (microframe_schedule) ++ qh->speed = dev_speed; ++ ++ qh->nak_frame = 0xffff; ++ ++ if (((dev_speed == USB_SPEED_LOW) || ++ (dev_speed == USB_SPEED_FULL)) && ++ (hub_addr != 0 && hub_addr != 1)) { ++ DWC_DEBUGPL(DBG_HCD, ++ "QH init: EP %d: TT found at hub addr %d, for port %d\n", ++ dwc_otg_hcd_get_ep_num(&urb->pipe_info), hub_addr, ++ hub_port); ++ qh->do_split = 1; ++ qh->skip_count = 0; ++ } ++ ++ if (qh->ep_type == UE_INTERRUPT || qh->ep_type == UE_ISOCHRONOUS) { ++ /* Compute scheduling parameters once and save them. */ ++ hprt0_data_t hprt; ++ ++ /** @todo Account for split transfers in the bus time. */ ++ int bytecount = ++ dwc_hb_mult(qh->maxp) * dwc_max_packet(qh->maxp); ++ ++ qh->usecs = ++ calc_bus_time((qh->do_split ? USB_SPEED_HIGH : dev_speed), ++ qh->ep_is_in, (qh->ep_type == UE_ISOCHRONOUS), ++ bytecount); ++ /* Start in a slightly future (micro)frame. */ ++ qh->sched_frame = dwc_frame_num_inc(hcd->frame_number, ++ SCHEDULE_SLOP); ++ qh->interval = urb->interval; ++ ++#if 0 ++ /* Increase interrupt polling rate for debugging. */ ++ if (qh->ep_type == UE_INTERRUPT) { ++ qh->interval = 8; ++ } ++#endif ++ hprt.d32 = DWC_READ_REG32(hcd->core_if->host_if->hprt0); ++ if ((hprt.b.prtspd == DWC_HPRT0_PRTSPD_HIGH_SPEED) && ++ ((dev_speed == USB_SPEED_LOW) || ++ (dev_speed == USB_SPEED_FULL))) { ++ qh->interval *= 8; ++ qh->sched_frame |= 0x7; ++ qh->start_split_frame = qh->sched_frame; ++ } ++ ++ } ++ ++ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD QH Initialized\n"); ++ DWC_DEBUGPL(DBG_HCDV, "DWC OTG HCD QH - qh = %p\n", qh); ++ DWC_DEBUGPL(DBG_HCDV, "DWC OTG HCD QH - Device Address = %d\n", ++ dwc_otg_hcd_get_dev_addr(&urb->pipe_info)); ++ DWC_DEBUGPL(DBG_HCDV, "DWC OTG HCD QH - Endpoint %d, %s\n", ++ dwc_otg_hcd_get_ep_num(&urb->pipe_info), ++ dwc_otg_hcd_is_pipe_in(&urb->pipe_info) ? "IN" : "OUT"); ++ switch (dev_speed) { ++ case USB_SPEED_LOW: ++ qh->dev_speed = DWC_OTG_EP_SPEED_LOW; ++ speed = "low"; ++ break; ++ case USB_SPEED_FULL: ++ qh->dev_speed = DWC_OTG_EP_SPEED_FULL; ++ speed = "full"; ++ break; ++ case USB_SPEED_HIGH: ++ qh->dev_speed = DWC_OTG_EP_SPEED_HIGH; ++ speed = "high"; ++ break; ++ default: ++ speed = "?"; ++ break; ++ } ++ DWC_DEBUGPL(DBG_HCDV, "DWC OTG HCD QH - Speed = %s\n", speed); ++ ++ switch (qh->ep_type) { ++ case UE_ISOCHRONOUS: ++ type = "isochronous"; ++ break; ++ case UE_INTERRUPT: ++ type = "interrupt"; ++ break; ++ case UE_CONTROL: ++ type = "control"; ++ break; ++ case UE_BULK: ++ type = "bulk"; ++ break; ++ default: ++ type = "?"; ++ break; ++ } ++ ++ DWC_DEBUGPL(DBG_HCDV, "DWC OTG HCD QH - Type = %s\n", type); ++ ++#ifdef DEBUG ++ if (qh->ep_type == UE_INTERRUPT) { ++ DWC_DEBUGPL(DBG_HCDV, "DWC OTG HCD QH - usecs = %d\n", ++ qh->usecs); ++ DWC_DEBUGPL(DBG_HCDV, "DWC OTG HCD QH - interval = %d\n", ++ qh->interval); ++ } ++#endif ++ ++} ++ ++/** ++ * This function allocates and initializes a QH. ++ * ++ * @param hcd The HCD state structure for the DWC OTG controller. ++ * @param urb Holds the information about the device/endpoint that we need ++ * to initialize the QH. ++ * @param atomic_alloc Flag to do atomic allocation if needed ++ * ++ * @return Returns pointer to the newly allocated QH, or NULL on error. */ ++dwc_otg_qh_t *dwc_otg_hcd_qh_create(dwc_otg_hcd_t * hcd, ++ dwc_otg_hcd_urb_t * urb, int atomic_alloc) ++{ ++ dwc_otg_qh_t *qh; ++ ++ /* Allocate memory */ ++ /** @todo add memflags argument */ ++ qh = dwc_otg_hcd_qh_alloc(atomic_alloc); ++ if (qh == NULL) { ++ DWC_ERROR("qh allocation failed"); ++ return NULL; ++ } ++ ++ qh_init(hcd, qh, urb); ++ ++ if (hcd->core_if->dma_desc_enable ++ && (dwc_otg_hcd_qh_init_ddma(hcd, qh) < 0)) { ++ dwc_otg_hcd_qh_free(hcd, qh); ++ return NULL; ++ } ++ ++ return qh; ++} ++ ++/* microframe_schedule=0 start */ ++ ++/** ++ * Checks that a channel is available for a periodic transfer. ++ * ++ * @return 0 if successful, negative error code otherise. ++ */ ++static int periodic_channel_available(dwc_otg_hcd_t * hcd) ++{ ++ /* ++ * Currently assuming that there is a dedicated host channnel for each ++ * periodic transaction plus at least one host channel for ++ * non-periodic transactions. ++ */ ++ int status; ++ int num_channels; ++ ++ num_channels = hcd->core_if->core_params->host_channels; ++ if ((hcd->periodic_channels + hcd->non_periodic_channels < num_channels) ++ && (hcd->periodic_channels < num_channels - 1)) { ++ status = 0; ++ } else { ++ DWC_INFO("%s: Total channels: %d, Periodic: %d, Non-periodic: %d\n", ++ __func__, num_channels, hcd->periodic_channels, hcd->non_periodic_channels); //NOTICE ++ status = -DWC_E_NO_SPACE; ++ } ++ ++ return status; ++} ++ ++/** ++ * Checks that there is sufficient bandwidth for the specified QH in the ++ * periodic schedule. For simplicity, this calculation assumes that all the ++ * transfers in the periodic schedule may occur in the same (micro)frame. ++ * ++ * @param hcd The HCD state structure for the DWC OTG controller. ++ * @param qh QH containing periodic bandwidth required. ++ * ++ * @return 0 if successful, negative error code otherwise. ++ */ ++static int check_periodic_bandwidth(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh) ++{ ++ int status; ++ int16_t max_claimed_usecs; ++ ++ status = 0; ++ ++ if ((qh->dev_speed == DWC_OTG_EP_SPEED_HIGH) || qh->do_split) { ++ /* ++ * High speed mode. ++ * Max periodic usecs is 80% x 125 usec = 100 usec. ++ */ ++ ++ max_claimed_usecs = 100 - qh->usecs; ++ } else { ++ /* ++ * Full speed mode. ++ * Max periodic usecs is 90% x 1000 usec = 900 usec. ++ */ ++ max_claimed_usecs = 900 - qh->usecs; ++ } ++ ++ if (hcd->periodic_usecs > max_claimed_usecs) { ++ DWC_INFO("%s: already claimed usecs %d, required usecs %d\n", __func__, hcd->periodic_usecs, qh->usecs); //NOTICE ++ status = -DWC_E_NO_SPACE; ++ } ++ ++ return status; ++} ++ ++/* microframe_schedule=0 end */ ++ ++/** ++ * Microframe scheduler ++ * track the total use in hcd->frame_usecs ++ * keep each qh use in qh->frame_usecs ++ * when surrendering the qh then donate the time back ++ */ ++const unsigned short max_uframe_usecs[]={ 100, 100, 100, 100, 100, 100, 30, 0 }; ++ ++/* ++ * called from dwc_otg_hcd.c:dwc_otg_hcd_init ++ */ ++int init_hcd_usecs(dwc_otg_hcd_t *_hcd) ++{ ++ int i; ++ for (i=0; i<8; i++) { ++ _hcd->frame_usecs[i] = max_uframe_usecs[i]; ++ } ++ return 0; ++} ++ ++static int find_single_uframe(dwc_otg_hcd_t * _hcd, dwc_otg_qh_t * _qh) ++{ ++ int i; ++ unsigned short utime; ++ int t_left; ++ int ret; ++ int done; ++ ++ ret = -1; ++ utime = _qh->usecs; ++ t_left = utime; ++ i = 0; ++ done = 0; ++ while (done == 0) { ++ /* At the start _hcd->frame_usecs[i] = max_uframe_usecs[i]; */ ++ if (utime <= _hcd->frame_usecs[i]) { ++ _hcd->frame_usecs[i] -= utime; ++ _qh->frame_usecs[i] += utime; ++ t_left -= utime; ++ ret = i; ++ done = 1; ++ return ret; ++ } else { ++ i++; ++ if (i == 8) { ++ done = 1; ++ ret = -1; ++ } ++ } ++ } ++ return ret; ++ } ++ ++/* ++ * use this for FS apps that can span multiple uframes ++ */ ++static int find_multi_uframe(dwc_otg_hcd_t * _hcd, dwc_otg_qh_t * _qh) ++{ ++ int i; ++ int j; ++ unsigned short utime; ++ int t_left; ++ int ret; ++ int done; ++ unsigned short xtime; ++ ++ ret = -1; ++ utime = _qh->usecs; ++ t_left = utime; ++ i = 0; ++ done = 0; ++loop: ++ while (done == 0) { ++ if(_hcd->frame_usecs[i] <= 0) { ++ i++; ++ if (i == 8) { ++ done = 1; ++ ret = -1; ++ } ++ goto loop; ++ } ++ ++ /* ++ * we need n consecutive slots ++ * so use j as a start slot j plus j+1 must be enough time (for now) ++ */ ++ xtime= _hcd->frame_usecs[i]; ++ for (j = i+1 ; j < 8 ; j++ ) { ++ /* ++ * if we add this frame remaining time to xtime we may ++ * be OK, if not we need to test j for a complete frame ++ */ ++ if ((xtime+_hcd->frame_usecs[j]) < utime) { ++ if (_hcd->frame_usecs[j] < max_uframe_usecs[j]) { ++ j = 8; ++ ret = -1; ++ continue; ++ } ++ } ++ if (xtime >= utime) { ++ ret = i; ++ j = 8; /* stop loop with a good value ret */ ++ continue; ++ } ++ /* add the frame time to x time */ ++ xtime += _hcd->frame_usecs[j]; ++ /* we must have a fully available next frame or break */ ++ if ((xtime < utime) ++ && (_hcd->frame_usecs[j] == max_uframe_usecs[j])) { ++ ret = -1; ++ j = 8; /* stop loop with a bad value ret */ ++ continue; ++ } ++ } ++ if (ret >= 0) { ++ t_left = utime; ++ for (j = i; (t_left>0) && (j < 8); j++ ) { ++ t_left -= _hcd->frame_usecs[j]; ++ if ( t_left <= 0 ) { ++ _qh->frame_usecs[j] += _hcd->frame_usecs[j] + t_left; ++ _hcd->frame_usecs[j]= -t_left; ++ ret = i; ++ done = 1; ++ } else { ++ _qh->frame_usecs[j] += _hcd->frame_usecs[j]; ++ _hcd->frame_usecs[j] = 0; ++ } ++ } ++ } else { ++ i++; ++ if (i == 8) { ++ done = 1; ++ ret = -1; ++ } ++ } ++ } ++ return ret; ++} ++ ++static int find_uframe(dwc_otg_hcd_t * _hcd, dwc_otg_qh_t * _qh) ++{ ++ int ret; ++ ret = -1; ++ ++ if (_qh->speed == USB_SPEED_HIGH) { ++ /* if this is a hs transaction we need a full frame */ ++ ret = find_single_uframe(_hcd, _qh); ++ } else { ++ /* if this is a fs transaction we may need a sequence of frames */ ++ ret = find_multi_uframe(_hcd, _qh); ++ } ++ return ret; ++} ++ ++/** ++ * Checks that the max transfer size allowed in a host channel is large enough ++ * to handle the maximum data transfer in a single (micro)frame for a periodic ++ * transfer. ++ * ++ * @param hcd The HCD state structure for the DWC OTG controller. ++ * @param qh QH for a periodic endpoint. ++ * ++ * @return 0 if successful, negative error code otherwise. ++ */ ++static int check_max_xfer_size(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh) ++{ ++ int status; ++ uint32_t max_xfer_size; ++ uint32_t max_channel_xfer_size; ++ ++ status = 0; ++ ++ max_xfer_size = dwc_max_packet(qh->maxp) * dwc_hb_mult(qh->maxp); ++ max_channel_xfer_size = hcd->core_if->core_params->max_transfer_size; ++ ++ if (max_xfer_size > max_channel_xfer_size) { ++ DWC_INFO("%s: Periodic xfer length %d > " "max xfer length for channel %d\n", ++ __func__, max_xfer_size, max_channel_xfer_size); //NOTICE ++ status = -DWC_E_NO_SPACE; ++ } ++ ++ return status; ++} ++ ++ ++ ++/** ++ * Schedules an interrupt or isochronous transfer in the periodic schedule. ++ * ++ * @param hcd The HCD state structure for the DWC OTG controller. ++ * @param qh QH for the periodic transfer. The QH should already contain the ++ * scheduling information. ++ * ++ * @return 0 if successful, negative error code otherwise. ++ */ ++static int schedule_periodic(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh) ++{ ++ int status = 0; ++ ++ if (microframe_schedule) { ++ int frame; ++ status = find_uframe(hcd, qh); ++ frame = -1; ++ if (status == 0) { ++ frame = 7; ++ } else { ++ if (status > 0 ) ++ frame = status-1; ++ } ++ ++ /* Set the new frame up */ ++ if (frame > -1) { ++ qh->sched_frame &= ~0x7; ++ qh->sched_frame |= (frame & 7); ++ } ++ ++ if (status != -1) ++ status = 0; ++ } else { ++ status = periodic_channel_available(hcd); ++ if (status) { ++ DWC_INFO("%s: No host channel available for periodic " "transfer.\n", __func__); //NOTICE ++ return status; ++ } ++ ++ status = check_periodic_bandwidth(hcd, qh); ++ } ++ if (status) { ++ DWC_INFO("%s: Insufficient periodic bandwidth for " ++ "periodic transfer.\n", __func__); ++ return status; ++ } ++ status = check_max_xfer_size(hcd, qh); ++ if (status) { ++ DWC_INFO("%s: Channel max transfer size too small " ++ "for periodic transfer.\n", __func__); ++ return status; ++ } ++ ++ if (hcd->core_if->dma_desc_enable) { ++ /* Don't rely on SOF and start in ready schedule */ ++ DWC_LIST_INSERT_TAIL(&hcd->periodic_sched_ready, &qh->qh_list_entry); ++ } ++ else { ++ if(fiq_enable && (DWC_LIST_EMPTY(&hcd->periodic_sched_inactive) || dwc_frame_num_le(qh->sched_frame, hcd->fiq_state->next_sched_frame))) ++ { ++ hcd->fiq_state->next_sched_frame = qh->sched_frame; ++ ++ } ++ /* Always start in the inactive schedule. */ ++ DWC_LIST_INSERT_TAIL(&hcd->periodic_sched_inactive, &qh->qh_list_entry); ++ } ++ ++ if (!microframe_schedule) { ++ /* Reserve the periodic channel. */ ++ hcd->periodic_channels++; ++ } ++ ++ /* Update claimed usecs per (micro)frame. */ ++ hcd->periodic_usecs += qh->usecs; ++ ++ return status; ++} ++ ++ ++/** ++ * This function adds a QH to either the non periodic or periodic schedule if ++ * it is not already in the schedule. If the QH is already in the schedule, no ++ * action is taken. ++ * ++ * @return 0 if successful, negative error code otherwise. ++ */ ++int dwc_otg_hcd_qh_add(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh) ++{ ++ int status = 0; ++ gintmsk_data_t intr_mask = {.d32 = 0 }; ++ ++ if (!DWC_LIST_EMPTY(&qh->qh_list_entry)) { ++ /* QH already in a schedule. */ ++ return status; ++ } ++ ++ /* Add the new QH to the appropriate schedule */ ++ if (dwc_qh_is_non_per(qh)) { ++ /* Always start in the inactive schedule. */ ++ DWC_LIST_INSERT_TAIL(&hcd->non_periodic_sched_inactive, ++ &qh->qh_list_entry); ++ //hcd->fiq_state->kick_np_queues = 1; ++ } else { ++ status = schedule_periodic(hcd, qh); ++ if ( !hcd->periodic_qh_count ) { ++ intr_mask.b.sofintr = 1; ++ if (fiq_enable) { ++ local_fiq_disable(); ++ fiq_fsm_spin_lock(&hcd->fiq_state->lock); ++ DWC_MODIFY_REG32(&hcd->core_if->core_global_regs->gintmsk, intr_mask.d32, intr_mask.d32); ++ fiq_fsm_spin_unlock(&hcd->fiq_state->lock); ++ local_fiq_enable(); ++ } else { ++ DWC_MODIFY_REG32(&hcd->core_if->core_global_regs->gintmsk, intr_mask.d32, intr_mask.d32); ++ } ++ } ++ hcd->periodic_qh_count++; ++ } ++ ++ return status; ++} ++ ++/** ++ * Removes an interrupt or isochronous transfer from the periodic schedule. ++ * ++ * @param hcd The HCD state structure for the DWC OTG controller. ++ * @param qh QH for the periodic transfer. ++ */ ++static void deschedule_periodic(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh) ++{ ++ int i; ++ DWC_LIST_REMOVE_INIT(&qh->qh_list_entry); ++ ++ /* Update claimed usecs per (micro)frame. */ ++ hcd->periodic_usecs -= qh->usecs; ++ ++ if (!microframe_schedule) { ++ /* Release the periodic channel reservation. */ ++ hcd->periodic_channels--; ++ } else { ++ for (i = 0; i < 8; i++) { ++ hcd->frame_usecs[i] += qh->frame_usecs[i]; ++ qh->frame_usecs[i] = 0; ++ } ++ } ++} ++ ++/** ++ * Removes a QH from either the non-periodic or periodic schedule. Memory is ++ * not freed. ++ * ++ * @param hcd The HCD state structure. ++ * @param qh QH to remove from schedule. */ ++void dwc_otg_hcd_qh_remove(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh) ++{ ++ gintmsk_data_t intr_mask = {.d32 = 0 }; ++ ++ if (DWC_LIST_EMPTY(&qh->qh_list_entry)) { ++ /* QH is not in a schedule. */ ++ return; ++ } ++ ++ if (dwc_qh_is_non_per(qh)) { ++ if (hcd->non_periodic_qh_ptr == &qh->qh_list_entry) { ++ hcd->non_periodic_qh_ptr = ++ hcd->non_periodic_qh_ptr->next; ++ } ++ DWC_LIST_REMOVE_INIT(&qh->qh_list_entry); ++ //if (!DWC_LIST_EMPTY(&hcd->non_periodic_sched_inactive)) ++ // hcd->fiq_state->kick_np_queues = 1; ++ } else { ++ deschedule_periodic(hcd, qh); ++ hcd->periodic_qh_count--; ++ if( !hcd->periodic_qh_count && !fiq_fsm_enable ) { ++ intr_mask.b.sofintr = 1; ++ if (fiq_enable) { ++ local_fiq_disable(); ++ fiq_fsm_spin_lock(&hcd->fiq_state->lock); ++ DWC_MODIFY_REG32(&hcd->core_if->core_global_regs->gintmsk, intr_mask.d32, 0); ++ fiq_fsm_spin_unlock(&hcd->fiq_state->lock); ++ local_fiq_enable(); ++ } else { ++ DWC_MODIFY_REG32(&hcd->core_if->core_global_regs->gintmsk, intr_mask.d32, 0); ++ } ++ } ++ } ++} ++ ++/** ++ * Deactivates a QH. For non-periodic QHs, removes the QH from the active ++ * non-periodic schedule. The QH is added to the inactive non-periodic ++ * schedule if any QTDs are still attached to the QH. ++ * ++ * For periodic QHs, the QH is removed from the periodic queued schedule. If ++ * there are any QTDs still attached to the QH, the QH is added to either the ++ * periodic inactive schedule or the periodic ready schedule and its next ++ * scheduled frame is calculated. The QH is placed in the ready schedule if ++ * the scheduled frame has been reached already. Otherwise it's placed in the ++ * inactive schedule. If there are no QTDs attached to the QH, the QH is ++ * completely removed from the periodic schedule. ++ */ ++void dwc_otg_hcd_qh_deactivate(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh, ++ int sched_next_periodic_split) ++{ ++ if (dwc_qh_is_non_per(qh)) { ++ dwc_otg_hcd_qh_remove(hcd, qh); ++ if (!DWC_CIRCLEQ_EMPTY(&qh->qtd_list)) { ++ /* Add back to inactive non-periodic schedule. */ ++ dwc_otg_hcd_qh_add(hcd, qh); ++ //hcd->fiq_state->kick_np_queues = 1; ++ } ++ } else { ++ uint16_t frame_number = dwc_otg_hcd_get_frame_number(hcd); ++ ++ if (qh->do_split) { ++ /* Schedule the next continuing periodic split transfer */ ++ if (sched_next_periodic_split) { ++ ++ qh->sched_frame = frame_number; ++ ++ if (dwc_frame_num_le(frame_number, ++ dwc_frame_num_inc ++ (qh->start_split_frame, ++ 1))) { ++ /* ++ * Allow one frame to elapse after start ++ * split microframe before scheduling ++ * complete split, but DONT if we are ++ * doing the next start split in the ++ * same frame for an ISOC out. ++ */ ++ if ((qh->ep_type != UE_ISOCHRONOUS) || ++ (qh->ep_is_in != 0)) { ++ qh->sched_frame = ++ dwc_frame_num_inc(qh->sched_frame, 1); ++ } ++ } ++ } else { ++ qh->sched_frame = ++ dwc_frame_num_inc(qh->start_split_frame, ++ qh->interval); ++ if (dwc_frame_num_le ++ (qh->sched_frame, frame_number)) { ++ qh->sched_frame = frame_number; ++ } ++ qh->sched_frame |= 0x7; ++ qh->start_split_frame = qh->sched_frame; ++ } ++ } else { ++ qh->sched_frame = ++ dwc_frame_num_inc(qh->sched_frame, qh->interval); ++ if (dwc_frame_num_le(qh->sched_frame, frame_number)) { ++ qh->sched_frame = frame_number; ++ } ++ } ++ ++ if (DWC_CIRCLEQ_EMPTY(&qh->qtd_list)) { ++ dwc_otg_hcd_qh_remove(hcd, qh); ++ } else { ++ /* ++ * Remove from periodic_sched_queued and move to ++ * appropriate queue. ++ */ ++ if ((microframe_schedule && dwc_frame_num_le(qh->sched_frame, frame_number)) || ++ (!microframe_schedule && qh->sched_frame == frame_number)) { ++ DWC_LIST_MOVE_HEAD(&hcd->periodic_sched_ready, ++ &qh->qh_list_entry); ++ } else { ++ if(fiq_enable && !dwc_frame_num_le(hcd->fiq_state->next_sched_frame, qh->sched_frame)) ++ { ++ hcd->fiq_state->next_sched_frame = qh->sched_frame; ++ } ++ ++ DWC_LIST_MOVE_HEAD ++ (&hcd->periodic_sched_inactive, ++ &qh->qh_list_entry); ++ } ++ } ++ } ++} ++ ++/** ++ * This function allocates and initializes a QTD. ++ * ++ * @param urb The URB to create a QTD from. Each URB-QTD pair will end up ++ * pointing to each other so each pair should have a unique correlation. ++ * @param atomic_alloc Flag to do atomic alloc if needed ++ * ++ * @return Returns pointer to the newly allocated QTD, or NULL on error. */ ++dwc_otg_qtd_t *dwc_otg_hcd_qtd_create(dwc_otg_hcd_urb_t * urb, int atomic_alloc) ++{ ++ dwc_otg_qtd_t *qtd; ++ ++ qtd = dwc_otg_hcd_qtd_alloc(atomic_alloc); ++ if (qtd == NULL) { ++ return NULL; ++ } ++ ++ dwc_otg_hcd_qtd_init(qtd, urb); ++ return qtd; ++} ++ ++/** ++ * Initializes a QTD structure. ++ * ++ * @param qtd The QTD to initialize. ++ * @param urb The URB to use for initialization. */ ++void dwc_otg_hcd_qtd_init(dwc_otg_qtd_t * qtd, dwc_otg_hcd_urb_t * urb) ++{ ++ dwc_memset(qtd, 0, sizeof(dwc_otg_qtd_t)); ++ qtd->urb = urb; ++ if (dwc_otg_hcd_get_pipe_type(&urb->pipe_info) == UE_CONTROL) { ++ /* ++ * The only time the QTD data toggle is used is on the data ++ * phase of control transfers. This phase always starts with ++ * DATA1. ++ */ ++ qtd->data_toggle = DWC_OTG_HC_PID_DATA1; ++ qtd->control_phase = DWC_OTG_CONTROL_SETUP; ++ } ++ ++ /* start split */ ++ qtd->complete_split = 0; ++ qtd->isoc_split_pos = DWC_HCSPLIT_XACTPOS_ALL; ++ qtd->isoc_split_offset = 0; ++ qtd->in_process = 0; ++ ++ /* Store the qtd ptr in the urb to reference what QTD. */ ++ urb->qtd = qtd; ++ return; ++} ++ ++/** ++ * This function adds a QTD to the QTD-list of a QH. It will find the correct ++ * QH to place the QTD into. If it does not find a QH, then it will create a ++ * new QH. If the QH to which the QTD is added is not currently scheduled, it ++ * is placed into the proper schedule based on its EP type. ++ * HCD lock must be held and interrupts must be disabled on entry ++ * ++ * @param[in] qtd The QTD to add ++ * @param[in] hcd The DWC HCD structure ++ * @param[out] qh out parameter to return queue head ++ * @param atomic_alloc Flag to do atomic alloc if needed ++ * ++ * @return 0 if successful, negative error code otherwise. ++ */ ++int dwc_otg_hcd_qtd_add(dwc_otg_qtd_t * qtd, ++ dwc_otg_hcd_t * hcd, dwc_otg_qh_t ** qh, int atomic_alloc) ++{ ++ int retval = 0; ++ dwc_otg_hcd_urb_t *urb = qtd->urb; ++ ++ /* ++ * Get the QH which holds the QTD-list to insert to. Create QH if it ++ * doesn't exist. ++ */ ++ if (*qh == NULL) { ++ *qh = dwc_otg_hcd_qh_create(hcd, urb, atomic_alloc); ++ if (*qh == NULL) { ++ retval = -DWC_E_NO_MEMORY; ++ goto done; ++ } else { ++ if (fiq_enable) ++ hcd->fiq_state->kick_np_queues = 1; ++ } ++ } ++ retval = dwc_otg_hcd_qh_add(hcd, *qh); ++ if (retval == 0) { ++ DWC_CIRCLEQ_INSERT_TAIL(&((*qh)->qtd_list), qtd, ++ qtd_list_entry); ++ qtd->qh = *qh; ++ } ++done: ++ ++ return retval; ++} ++ ++#endif /* DWC_DEVICE_ONLY */ +diff --git a/drivers/usb/host/dwc_otg/dwc_otg_os_dep.h b/drivers/usb/host/dwc_otg/dwc_otg_os_dep.h +new file mode 100644 +index 0000000..6b2c7d0 +--- /dev/null ++++ b/drivers/usb/host/dwc_otg/dwc_otg_os_dep.h +@@ -0,0 +1,188 @@ ++#ifndef _DWC_OS_DEP_H_ ++#define _DWC_OS_DEP_H_ ++ ++/** ++ * @file ++ * ++ * This file contains OS dependent structures. ++ * ++ */ ++ ++#include <linux/kernel.h> ++#include <linux/module.h> ++#include <linux/moduleparam.h> ++#include <linux/init.h> ++#include <linux/device.h> ++#include <linux/errno.h> ++#include <linux/types.h> ++#include <linux/slab.h> ++#include <linux/list.h> ++#include <linux/interrupt.h> ++#include <linux/ctype.h> ++#include <linux/string.h> ++#include <linux/dma-mapping.h> ++#include <linux/jiffies.h> ++#include <linux/delay.h> ++#include <linux/timer.h> ++#include <linux/workqueue.h> ++#include <linux/stat.h> ++#include <linux/pci.h> ++ ++#include <linux/version.h> ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) ++# include <linux/irq.h> ++#endif ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21) ++# include <linux/usb/ch9.h> ++#else ++# include <linux/usb_ch9.h> ++#endif ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24) ++# include <linux/usb/gadget.h> ++#else ++# include <linux/usb_gadget.h> ++#endif ++ ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) ++# include <asm/irq.h> ++#endif ++ ++#ifdef PCI_INTERFACE ++# include <asm/io.h> ++#endif ++ ++#ifdef LM_INTERFACE ++# include <asm/unaligned.h> ++# include <asm/sizes.h> ++# include <asm/param.h> ++# include <asm/io.h> ++# if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30)) ++# include <asm/arch/hardware.h> ++# include <asm/arch/lm.h> ++# include <asm/arch/irqs.h> ++# include <asm/arch/regs-irq.h> ++# else ++/* in 2.6.31, at least, we seem to have lost the generic LM infrastructure - ++ here we assume that the machine architecture provides definitions ++ in its own header ++*/ ++# include <mach/lm.h> ++# include <mach/hardware.h> ++# endif ++#endif ++ ++#ifdef PLATFORM_INTERFACE ++#include <linux/platform_device.h> ++#include <asm/mach/map.h> ++#endif ++ ++/** The OS page size */ ++#define DWC_OS_PAGE_SIZE PAGE_SIZE ++ ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14) ++typedef int gfp_t; ++#endif ++ ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18) ++# define IRQF_SHARED SA_SHIRQ ++#endif ++ ++typedef struct os_dependent { ++ /** Base address returned from ioremap() */ ++ void *base; ++ ++ /** Register offset for Diagnostic API */ ++ uint32_t reg_offset; ++ ++ /** Base address for MPHI peripheral */ ++ void *mphi_base; ++ ++#ifdef LM_INTERFACE ++ struct lm_device *lmdev; ++#elif defined(PCI_INTERFACE) ++ struct pci_dev *pcidev; ++ ++ /** Start address of a PCI region */ ++ resource_size_t rsrc_start; ++ ++ /** Length address of a PCI region */ ++ resource_size_t rsrc_len; ++#elif defined(PLATFORM_INTERFACE) ++ struct platform_device *platformdev; ++#endif ++ ++} os_dependent_t; ++ ++#ifdef __cplusplus ++} ++#endif ++ ++ ++ ++/* Type for the our device on the chosen bus */ ++#if defined(LM_INTERFACE) ++typedef struct lm_device dwc_bus_dev_t; ++#elif defined(PCI_INTERFACE) ++typedef struct pci_dev dwc_bus_dev_t; ++#elif defined(PLATFORM_INTERFACE) ++typedef struct platform_device dwc_bus_dev_t; ++#endif ++ ++/* Helper macro to retrieve drvdata from the device on the chosen bus */ ++#if defined(LM_INTERFACE) ++#define DWC_OTG_BUSDRVDATA(_dev) lm_get_drvdata(_dev) ++#elif defined(PCI_INTERFACE) ++#define DWC_OTG_BUSDRVDATA(_dev) pci_get_drvdata(_dev) ++#elif defined(PLATFORM_INTERFACE) ++#define DWC_OTG_BUSDRVDATA(_dev) platform_get_drvdata(_dev) ++#endif ++ ++/** ++ * Helper macro returning the otg_device structure of a given struct device ++ * ++ * c.f. static dwc_otg_device_t *dwc_otg_drvdev(struct device *_dev) ++ */ ++#ifdef LM_INTERFACE ++#define DWC_OTG_GETDRVDEV(_var, _dev) do { \ ++ struct lm_device *lm_dev = \ ++ container_of(_dev, struct lm_device, dev); \ ++ _var = lm_get_drvdata(lm_dev); \ ++ } while (0) ++ ++#elif defined(PCI_INTERFACE) ++#define DWC_OTG_GETDRVDEV(_var, _dev) do { \ ++ _var = dev_get_drvdata(_dev); \ ++ } while (0) ++ ++#elif defined(PLATFORM_INTERFACE) ++#define DWC_OTG_GETDRVDEV(_var, _dev) do { \ ++ struct platform_device *platform_dev = \ ++ container_of(_dev, struct platform_device, dev); \ ++ _var = platform_get_drvdata(platform_dev); \ ++ } while (0) ++#endif ++ ++ ++/** ++ * Helper macro returning the struct dev of the given struct os_dependent ++ * ++ * c.f. static struct device *dwc_otg_getdev(struct os_dependent *osdep) ++ */ ++#ifdef LM_INTERFACE ++#define DWC_OTG_OS_GETDEV(_osdep) \ ++ ((_osdep).lmdev == NULL? NULL: &(_osdep).lmdev->dev) ++#elif defined(PCI_INTERFACE) ++#define DWC_OTG_OS_GETDEV(_osdep) \ ++ ((_osdep).pci_dev == NULL? NULL: &(_osdep).pci_dev->dev) ++#elif defined(PLATFORM_INTERFACE) ++#define DWC_OTG_OS_GETDEV(_osdep) \ ++ ((_osdep).platformdev == NULL? NULL: &(_osdep).platformdev->dev) ++#endif ++ ++ ++ ++ ++#endif /* _DWC_OS_DEP_H_ */ +diff --git a/drivers/usb/host/dwc_otg/dwc_otg_pcd.c b/drivers/usb/host/dwc_otg/dwc_otg_pcd.c +new file mode 100644 +index 0000000..ae0c72d +--- /dev/null ++++ b/drivers/usb/host/dwc_otg/dwc_otg_pcd.c +@@ -0,0 +1,2712 @@ ++/* ========================================================================== ++ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_pcd.c $ ++ * $Revision: #101 $ ++ * $Date: 2012/08/10 $ ++ * $Change: 2047372 $ ++ * ++ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, ++ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless ++ * otherwise expressly agreed to in writing between Synopsys and you. ++ * ++ * The Software IS NOT an item of Licensed Software or Licensed Product under ++ * any End User Software License Agreement or Agreement for Licensed Product ++ * with Synopsys or any supplement thereto. You are permitted to use and ++ * redistribute this Software in source and binary forms, with or without ++ * modification, provided that redistributions of source code must retain this ++ * notice. You may not view, use, disclose, copy or distribute this file or ++ * any information contained herein except pursuant to this license grant from ++ * Synopsys. If you do not agree with this notice, including the disclaimer ++ * below, then you are not authorized to use the Software. ++ * ++ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS ++ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS 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. ++ * ========================================================================== */ ++#ifndef DWC_HOST_ONLY ++ ++/** @file ++ * This file implements PCD Core. All code in this file is portable and doesn't ++ * use any OS specific functions. ++ * PCD Core provides Interface, defined in <code><dwc_otg_pcd_if.h></code> ++ * header file, which can be used to implement OS specific PCD interface. ++ * ++ * An important function of the PCD is managing interrupts generated ++ * by the DWC_otg controller. The implementation of the DWC_otg device ++ * mode interrupt service routines is in dwc_otg_pcd_intr.c. ++ * ++ * @todo Add Device Mode test modes (Test J mode, Test K mode, etc). ++ * @todo Does it work when the request size is greater than DEPTSIZ ++ * transfer size ++ * ++ */ ++ ++#include "dwc_otg_pcd.h" ++ ++#ifdef DWC_UTE_CFI ++#include "dwc_otg_cfi.h" ++ ++extern int init_cfi(cfiobject_t * cfiobj); ++#endif ++ ++/** ++ * Choose endpoint from ep arrays using usb_ep structure. ++ */ ++static dwc_otg_pcd_ep_t *get_ep_from_handle(dwc_otg_pcd_t * pcd, void *handle) ++{ ++ int i; ++ if (pcd->ep0.priv == handle) { ++ return &pcd->ep0; ++ } ++ for (i = 0; i < MAX_EPS_CHANNELS - 1; i++) { ++ if (pcd->in_ep[i].priv == handle) ++ return &pcd->in_ep[i]; ++ if (pcd->out_ep[i].priv == handle) ++ return &pcd->out_ep[i]; ++ } ++ ++ return NULL; ++} ++ ++/** ++ * This function completes a request. It call's the request call back. ++ */ ++void dwc_otg_request_done(dwc_otg_pcd_ep_t * ep, dwc_otg_pcd_request_t * req, ++ int32_t status) ++{ ++ unsigned stopped = ep->stopped; ++ ++ DWC_DEBUGPL(DBG_PCDV, "%s(ep %p req %p)\n", __func__, ep, req); ++ DWC_CIRCLEQ_REMOVE_INIT(&ep->queue, req, queue_entry); ++ ++ /* don't modify queue heads during completion callback */ ++ ep->stopped = 1; ++ /* spin_unlock/spin_lock now done in fops->complete() */ ++ ep->pcd->fops->complete(ep->pcd, ep->priv, req->priv, status, ++ req->actual); ++ ++ if (ep->pcd->request_pending > 0) { ++ --ep->pcd->request_pending; ++ } ++ ++ ep->stopped = stopped; ++ DWC_FREE(req); ++} ++ ++/** ++ * This function terminates all the requsts in the EP request queue. ++ */ ++void dwc_otg_request_nuke(dwc_otg_pcd_ep_t * ep) ++{ ++ dwc_otg_pcd_request_t *req; ++ ++ ep->stopped = 1; ++ ++ /* called with irqs blocked?? */ ++ while (!DWC_CIRCLEQ_EMPTY(&ep->queue)) { ++ req = DWC_CIRCLEQ_FIRST(&ep->queue); ++ dwc_otg_request_done(ep, req, -DWC_E_SHUTDOWN); ++ } ++} ++ ++void dwc_otg_pcd_start(dwc_otg_pcd_t * pcd, ++ const struct dwc_otg_pcd_function_ops *fops) ++{ ++ pcd->fops = fops; ++} ++ ++/** ++ * PCD Callback function for initializing the PCD when switching to ++ * device mode. ++ * ++ * @param p void pointer to the <code>dwc_otg_pcd_t</code> ++ */ ++static int32_t dwc_otg_pcd_start_cb(void *p) ++{ ++ dwc_otg_pcd_t *pcd = (dwc_otg_pcd_t *) p; ++ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); ++ ++ /* ++ * Initialized the Core for Device mode. ++ */ ++ if (dwc_otg_is_device_mode(core_if)) { ++ dwc_otg_core_dev_init(core_if); ++ /* Set core_if's lock pointer to the pcd->lock */ ++ core_if->lock = pcd->lock; ++ } ++ return 1; ++} ++ ++/** CFI-specific buffer allocation function for EP */ ++#ifdef DWC_UTE_CFI ++uint8_t *cfiw_ep_alloc_buffer(dwc_otg_pcd_t * pcd, void *pep, dwc_dma_t * addr, ++ size_t buflen, int flags) ++{ ++ dwc_otg_pcd_ep_t *ep; ++ ep = get_ep_from_handle(pcd, pep); ++ if (!ep) { ++ DWC_WARN("bad ep\n"); ++ return -DWC_E_INVALID; ++ } ++ ++ return pcd->cfi->ops.ep_alloc_buf(pcd->cfi, pcd, ep, addr, buflen, ++ flags); ++} ++#else ++uint8_t *cfiw_ep_alloc_buffer(dwc_otg_pcd_t * pcd, void *pep, dwc_dma_t * addr, ++ size_t buflen, int flags); ++#endif ++ ++/** ++ * PCD Callback function for notifying the PCD when resuming from ++ * suspend. ++ * ++ * @param p void pointer to the <code>dwc_otg_pcd_t</code> ++ */ ++static int32_t dwc_otg_pcd_resume_cb(void *p) ++{ ++ dwc_otg_pcd_t *pcd = (dwc_otg_pcd_t *) p; ++ ++ if (pcd->fops->resume) { ++ pcd->fops->resume(pcd); ++ } ++ ++ /* Stop the SRP timeout timer. */ ++ if ((GET_CORE_IF(pcd)->core_params->phy_type != DWC_PHY_TYPE_PARAM_FS) ++ || (!GET_CORE_IF(pcd)->core_params->i2c_enable)) { ++ if (GET_CORE_IF(pcd)->srp_timer_started) { ++ GET_CORE_IF(pcd)->srp_timer_started = 0; ++ DWC_TIMER_CANCEL(GET_CORE_IF(pcd)->srp_timer); ++ } ++ } ++ return 1; ++} ++ ++/** ++ * PCD Callback function for notifying the PCD device is suspended. ++ * ++ * @param p void pointer to the <code>dwc_otg_pcd_t</code> ++ */ ++static int32_t dwc_otg_pcd_suspend_cb(void *p) ++{ ++ dwc_otg_pcd_t *pcd = (dwc_otg_pcd_t *) p; ++ ++ if (pcd->fops->suspend) { ++ DWC_SPINUNLOCK(pcd->lock); ++ pcd->fops->suspend(pcd); ++ DWC_SPINLOCK(pcd->lock); ++ } ++ ++ return 1; ++} ++ ++/** ++ * PCD Callback function for stopping the PCD when switching to Host ++ * mode. ++ * ++ * @param p void pointer to the <code>dwc_otg_pcd_t</code> ++ */ ++static int32_t dwc_otg_pcd_stop_cb(void *p) ++{ ++ dwc_otg_pcd_t *pcd = (dwc_otg_pcd_t *) p; ++ extern void dwc_otg_pcd_stop(dwc_otg_pcd_t * _pcd); ++ ++ dwc_otg_pcd_stop(pcd); ++ return 1; ++} ++ ++/** ++ * PCD Callback structure for handling mode switching. ++ */ ++static dwc_otg_cil_callbacks_t pcd_callbacks = { ++ .start = dwc_otg_pcd_start_cb, ++ .stop = dwc_otg_pcd_stop_cb, ++ .suspend = dwc_otg_pcd_suspend_cb, ++ .resume_wakeup = dwc_otg_pcd_resume_cb, ++ .p = 0, /* Set at registration */ ++}; ++ ++/** ++ * This function allocates a DMA Descriptor chain for the Endpoint ++ * buffer to be used for a transfer to/from the specified endpoint. ++ */ ++dwc_otg_dev_dma_desc_t *dwc_otg_ep_alloc_desc_chain(dwc_dma_t * dma_desc_addr, ++ uint32_t count) ++{ ++ return DWC_DMA_ALLOC_ATOMIC(count * sizeof(dwc_otg_dev_dma_desc_t), ++ dma_desc_addr); ++} ++ ++/** ++ * This function frees a DMA Descriptor chain that was allocated by ep_alloc_desc. ++ */ ++void dwc_otg_ep_free_desc_chain(dwc_otg_dev_dma_desc_t * desc_addr, ++ uint32_t dma_desc_addr, uint32_t count) ++{ ++ DWC_DMA_FREE(count * sizeof(dwc_otg_dev_dma_desc_t), desc_addr, ++ dma_desc_addr); ++} ++ ++#ifdef DWC_EN_ISOC ++ ++/** ++ * This function initializes a descriptor chain for Isochronous transfer ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ * @param dwc_ep The EP to start the transfer on. ++ * ++ */ ++void dwc_otg_iso_ep_start_ddma_transfer(dwc_otg_core_if_t * core_if, ++ dwc_ep_t * dwc_ep) ++{ ++ ++ dsts_data_t dsts = {.d32 = 0 }; ++ depctl_data_t depctl = {.d32 = 0 }; ++ volatile uint32_t *addr; ++ int i, j; ++ uint32_t len; ++ ++ if (dwc_ep->is_in) ++ dwc_ep->desc_cnt = dwc_ep->buf_proc_intrvl / dwc_ep->bInterval; ++ else ++ dwc_ep->desc_cnt = ++ dwc_ep->buf_proc_intrvl * dwc_ep->pkt_per_frm / ++ dwc_ep->bInterval; ++ ++ /** Allocate descriptors for double buffering */ ++ dwc_ep->iso_desc_addr = ++ dwc_otg_ep_alloc_desc_chain(&dwc_ep->iso_dma_desc_addr, ++ dwc_ep->desc_cnt * 2); ++ if (dwc_ep->desc_addr) { ++ DWC_WARN("%s, can't allocate DMA descriptor chain\n", __func__); ++ return; ++ } ++ ++ dsts.d32 = DWC_READ_REG32(&core_if->dev_if->dev_global_regs->dsts); ++ ++ /** ISO OUT EP */ ++ if (dwc_ep->is_in == 0) { ++ dev_dma_desc_sts_t sts = {.d32 = 0 }; ++ dwc_otg_dev_dma_desc_t *dma_desc = dwc_ep->iso_desc_addr; ++ dma_addr_t dma_ad; ++ uint32_t data_per_desc; ++ dwc_otg_dev_out_ep_regs_t *out_regs = ++ core_if->dev_if->out_ep_regs[dwc_ep->num]; ++ int offset; ++ ++ addr = &core_if->dev_if->out_ep_regs[dwc_ep->num]->doepctl; ++ dma_ad = (dma_addr_t) DWC_READ_REG32(&(out_regs->doepdma)); ++ ++ /** Buffer 0 descriptors setup */ ++ dma_ad = dwc_ep->dma_addr0; ++ ++ sts.b_iso_out.bs = BS_HOST_READY; ++ sts.b_iso_out.rxsts = 0; ++ sts.b_iso_out.l = 0; ++ sts.b_iso_out.sp = 0; ++ sts.b_iso_out.ioc = 0; ++ sts.b_iso_out.pid = 0; ++ sts.b_iso_out.framenum = 0; ++ ++ offset = 0; ++ for (i = 0; i < dwc_ep->desc_cnt - dwc_ep->pkt_per_frm; ++ i += dwc_ep->pkt_per_frm) { ++ ++ for (j = 0; j < dwc_ep->pkt_per_frm; ++j) { ++ uint32_t len = (j + 1) * dwc_ep->maxpacket; ++ if (len > dwc_ep->data_per_frame) ++ data_per_desc = ++ dwc_ep->data_per_frame - ++ j * dwc_ep->maxpacket; ++ else ++ data_per_desc = dwc_ep->maxpacket; ++ len = data_per_desc % 4; ++ if (len) ++ data_per_desc += 4 - len; ++ ++ sts.b_iso_out.rxbytes = data_per_desc; ++ dma_desc->buf = dma_ad; ++ dma_desc->status.d32 = sts.d32; ++ ++ offset += data_per_desc; ++ dma_desc++; ++ dma_ad += data_per_desc; ++ } ++ } ++ ++ for (j = 0; j < dwc_ep->pkt_per_frm - 1; ++j) { ++ uint32_t len = (j + 1) * dwc_ep->maxpacket; ++ if (len > dwc_ep->data_per_frame) ++ data_per_desc = ++ dwc_ep->data_per_frame - ++ j * dwc_ep->maxpacket; ++ else ++ data_per_desc = dwc_ep->maxpacket; ++ len = data_per_desc % 4; ++ if (len) ++ data_per_desc += 4 - len; ++ sts.b_iso_out.rxbytes = data_per_desc; ++ dma_desc->buf = dma_ad; ++ dma_desc->status.d32 = sts.d32; ++ ++ offset += data_per_desc; ++ dma_desc++; ++ dma_ad += data_per_desc; ++ } ++ ++ sts.b_iso_out.ioc = 1; ++ len = (j + 1) * dwc_ep->maxpacket; ++ if (len > dwc_ep->data_per_frame) ++ data_per_desc = ++ dwc_ep->data_per_frame - j * dwc_ep->maxpacket; ++ else ++ data_per_desc = dwc_ep->maxpacket; ++ len = data_per_desc % 4; ++ if (len) ++ data_per_desc += 4 - len; ++ sts.b_iso_out.rxbytes = data_per_desc; ++ ++ dma_desc->buf = dma_ad; ++ dma_desc->status.d32 = sts.d32; ++ dma_desc++; ++ ++ /** Buffer 1 descriptors setup */ ++ sts.b_iso_out.ioc = 0; ++ dma_ad = dwc_ep->dma_addr1; ++ ++ offset = 0; ++ for (i = 0; i < dwc_ep->desc_cnt - dwc_ep->pkt_per_frm; ++ i += dwc_ep->pkt_per_frm) { ++ for (j = 0; j < dwc_ep->pkt_per_frm; ++j) { ++ uint32_t len = (j + 1) * dwc_ep->maxpacket; ++ if (len > dwc_ep->data_per_frame) ++ data_per_desc = ++ dwc_ep->data_per_frame - ++ j * dwc_ep->maxpacket; ++ else ++ data_per_desc = dwc_ep->maxpacket; ++ len = data_per_desc % 4; ++ if (len) ++ data_per_desc += 4 - len; ++ ++ data_per_desc = ++ sts.b_iso_out.rxbytes = data_per_desc; ++ dma_desc->buf = dma_ad; ++ dma_desc->status.d32 = sts.d32; ++ ++ offset += data_per_desc; ++ dma_desc++; ++ dma_ad += data_per_desc; ++ } ++ } ++ for (j = 0; j < dwc_ep->pkt_per_frm - 1; ++j) { ++ data_per_desc = ++ ((j + 1) * dwc_ep->maxpacket > ++ dwc_ep->data_per_frame) ? dwc_ep->data_per_frame - ++ j * dwc_ep->maxpacket : dwc_ep->maxpacket; ++ data_per_desc += ++ (data_per_desc % 4) ? (4 - data_per_desc % 4) : 0; ++ sts.b_iso_out.rxbytes = data_per_desc; ++ dma_desc->buf = dma_ad; ++ dma_desc->status.d32 = sts.d32; ++ ++ offset += data_per_desc; ++ dma_desc++; ++ dma_ad += data_per_desc; ++ } ++ ++ sts.b_iso_out.ioc = 1; ++ sts.b_iso_out.l = 1; ++ data_per_desc = ++ ((j + 1) * dwc_ep->maxpacket > ++ dwc_ep->data_per_frame) ? dwc_ep->data_per_frame - ++ j * dwc_ep->maxpacket : dwc_ep->maxpacket; ++ data_per_desc += ++ (data_per_desc % 4) ? (4 - data_per_desc % 4) : 0; ++ sts.b_iso_out.rxbytes = data_per_desc; ++ ++ dma_desc->buf = dma_ad; ++ dma_desc->status.d32 = sts.d32; ++ ++ dwc_ep->next_frame = 0; ++ ++ /** Write dma_ad into DOEPDMA register */ ++ DWC_WRITE_REG32(&(out_regs->doepdma), ++ (uint32_t) dwc_ep->iso_dma_desc_addr); ++ ++ } ++ /** ISO IN EP */ ++ else { ++ dev_dma_desc_sts_t sts = {.d32 = 0 }; ++ dwc_otg_dev_dma_desc_t *dma_desc = dwc_ep->iso_desc_addr; ++ dma_addr_t dma_ad; ++ dwc_otg_dev_in_ep_regs_t *in_regs = ++ core_if->dev_if->in_ep_regs[dwc_ep->num]; ++ unsigned int frmnumber; ++ fifosize_data_t txfifosize, rxfifosize; ++ ++ txfifosize.d32 = ++ DWC_READ_REG32(&core_if->dev_if->in_ep_regs[dwc_ep->num]-> ++ dtxfsts); ++ rxfifosize.d32 = ++ DWC_READ_REG32(&core_if->core_global_regs->grxfsiz); ++ ++ addr = &core_if->dev_if->in_ep_regs[dwc_ep->num]->diepctl; ++ ++ dma_ad = dwc_ep->dma_addr0; ++ ++ dsts.d32 = ++ DWC_READ_REG32(&core_if->dev_if->dev_global_regs->dsts); ++ ++ sts.b_iso_in.bs = BS_HOST_READY; ++ sts.b_iso_in.txsts = 0; ++ sts.b_iso_in.sp = ++ (dwc_ep->data_per_frame % dwc_ep->maxpacket) ? 1 : 0; ++ sts.b_iso_in.ioc = 0; ++ sts.b_iso_in.pid = dwc_ep->pkt_per_frm; ++ ++ frmnumber = dwc_ep->next_frame; ++ ++ sts.b_iso_in.framenum = frmnumber; ++ sts.b_iso_in.txbytes = dwc_ep->data_per_frame; ++ sts.b_iso_in.l = 0; ++ ++ /** Buffer 0 descriptors setup */ ++ for (i = 0; i < dwc_ep->desc_cnt - 1; i++) { ++ dma_desc->buf = dma_ad; ++ dma_desc->status.d32 = sts.d32; ++ dma_desc++; ++ ++ dma_ad += dwc_ep->data_per_frame; ++ sts.b_iso_in.framenum += dwc_ep->bInterval; ++ } ++ ++ sts.b_iso_in.ioc = 1; ++ dma_desc->buf = dma_ad; ++ dma_desc->status.d32 = sts.d32; ++ ++dma_desc; ++ ++ /** Buffer 1 descriptors setup */ ++ sts.b_iso_in.ioc = 0; ++ dma_ad = dwc_ep->dma_addr1; ++ ++ for (i = 0; i < dwc_ep->desc_cnt - dwc_ep->pkt_per_frm; ++ i += dwc_ep->pkt_per_frm) { ++ dma_desc->buf = dma_ad; ++ dma_desc->status.d32 = sts.d32; ++ dma_desc++; ++ ++ dma_ad += dwc_ep->data_per_frame; ++ sts.b_iso_in.framenum += dwc_ep->bInterval; ++ ++ sts.b_iso_in.ioc = 0; ++ } ++ sts.b_iso_in.ioc = 1; ++ sts.b_iso_in.l = 1; ++ ++ dma_desc->buf = dma_ad; ++ dma_desc->status.d32 = sts.d32; ++ ++ dwc_ep->next_frame = sts.b_iso_in.framenum + dwc_ep->bInterval; ++ ++ /** Write dma_ad into diepdma register */ ++ DWC_WRITE_REG32(&(in_regs->diepdma), ++ (uint32_t) dwc_ep->iso_dma_desc_addr); ++ } ++ /** Enable endpoint, clear nak */ ++ depctl.d32 = 0; ++ depctl.b.epena = 1; ++ depctl.b.usbactep = 1; ++ depctl.b.cnak = 1; ++ ++ DWC_MODIFY_REG32(addr, depctl.d32, depctl.d32); ++ depctl.d32 = DWC_READ_REG32(addr); ++} ++ ++/** ++ * This function initializes a descriptor chain for Isochronous transfer ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ * @param ep The EP to start the transfer on. ++ * ++ */ ++void dwc_otg_iso_ep_start_buf_transfer(dwc_otg_core_if_t * core_if, ++ dwc_ep_t * ep) ++{ ++ depctl_data_t depctl = {.d32 = 0 }; ++ volatile uint32_t *addr; ++ ++ if (ep->is_in) { ++ addr = &core_if->dev_if->in_ep_regs[ep->num]->diepctl; ++ } else { ++ addr = &core_if->dev_if->out_ep_regs[ep->num]->doepctl; ++ } ++ ++ if (core_if->dma_enable == 0 || core_if->dma_desc_enable != 0) { ++ return; ++ } else { ++ deptsiz_data_t deptsiz = {.d32 = 0 }; ++ ++ ep->xfer_len = ++ ep->data_per_frame * ep->buf_proc_intrvl / ep->bInterval; ++ ep->pkt_cnt = ++ (ep->xfer_len - 1 + ep->maxpacket) / ep->maxpacket; ++ ep->xfer_count = 0; ++ ep->xfer_buff = ++ (ep->proc_buf_num) ? ep->xfer_buff1 : ep->xfer_buff0; ++ ep->dma_addr = ++ (ep->proc_buf_num) ? ep->dma_addr1 : ep->dma_addr0; ++ ++ if (ep->is_in) { ++ /* Program the transfer size and packet count ++ * as follows: xfersize = N * maxpacket + ++ * short_packet pktcnt = N + (short_packet ++ * exist ? 1 : 0) ++ */ ++ deptsiz.b.mc = ep->pkt_per_frm; ++ deptsiz.b.xfersize = ep->xfer_len; ++ deptsiz.b.pktcnt = ++ (ep->xfer_len - 1 + ep->maxpacket) / ep->maxpacket; ++ DWC_WRITE_REG32(&core_if->dev_if->in_ep_regs[ep->num]-> ++ dieptsiz, deptsiz.d32); ++ ++ /* Write the DMA register */ ++ DWC_WRITE_REG32(& ++ (core_if->dev_if->in_ep_regs[ep->num]-> ++ diepdma), (uint32_t) ep->dma_addr); ++ ++ } else { ++ deptsiz.b.pktcnt = ++ (ep->xfer_len + (ep->maxpacket - 1)) / ++ ep->maxpacket; ++ deptsiz.b.xfersize = deptsiz.b.pktcnt * ep->maxpacket; ++ ++ DWC_WRITE_REG32(&core_if->dev_if->out_ep_regs[ep->num]-> ++ doeptsiz, deptsiz.d32); ++ ++ /* Write the DMA register */ ++ DWC_WRITE_REG32(& ++ (core_if->dev_if->out_ep_regs[ep->num]-> ++ doepdma), (uint32_t) ep->dma_addr); ++ ++ } ++ /** Enable endpoint, clear nak */ ++ depctl.d32 = 0; ++ depctl.b.epena = 1; ++ depctl.b.cnak = 1; ++ ++ DWC_MODIFY_REG32(addr, depctl.d32, depctl.d32); ++ } ++} ++ ++/** ++ * This function does the setup for a data transfer for an EP and ++ * starts the transfer. For an IN transfer, the packets will be ++ * loaded into the appropriate Tx FIFO in the ISR. For OUT transfers, ++ * the packets are unloaded from the Rx FIFO in the ISR. ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ * @param ep The EP to start the transfer on. ++ */ ++ ++static void dwc_otg_iso_ep_start_transfer(dwc_otg_core_if_t * core_if, ++ dwc_ep_t * ep) ++{ ++ if (core_if->dma_enable) { ++ if (core_if->dma_desc_enable) { ++ if (ep->is_in) { ++ ep->desc_cnt = ep->pkt_cnt / ep->pkt_per_frm; ++ } else { ++ ep->desc_cnt = ep->pkt_cnt; ++ } ++ dwc_otg_iso_ep_start_ddma_transfer(core_if, ep); ++ } else { ++ if (core_if->pti_enh_enable) { ++ dwc_otg_iso_ep_start_buf_transfer(core_if, ep); ++ } else { ++ ep->cur_pkt_addr = ++ (ep->proc_buf_num) ? ep->xfer_buff1 : ep-> ++ xfer_buff0; ++ ep->cur_pkt_dma_addr = ++ (ep->proc_buf_num) ? ep->dma_addr1 : ep-> ++ dma_addr0; ++ dwc_otg_iso_ep_start_frm_transfer(core_if, ep); ++ } ++ } ++ } else { ++ ep->cur_pkt_addr = ++ (ep->proc_buf_num) ? ep->xfer_buff1 : ep->xfer_buff0; ++ ep->cur_pkt_dma_addr = ++ (ep->proc_buf_num) ? ep->dma_addr1 : ep->dma_addr0; ++ dwc_otg_iso_ep_start_frm_transfer(core_if, ep); ++ } ++} ++ ++/** ++ * This function stops transfer for an EP and ++ * resets the ep's variables. ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ * @param ep The EP to start the transfer on. ++ */ ++ ++void dwc_otg_iso_ep_stop_transfer(dwc_otg_core_if_t * core_if, dwc_ep_t * ep) ++{ ++ depctl_data_t depctl = {.d32 = 0 }; ++ volatile uint32_t *addr; ++ ++ if (ep->is_in == 1) { ++ addr = &core_if->dev_if->in_ep_regs[ep->num]->diepctl; ++ } else { ++ addr = &core_if->dev_if->out_ep_regs[ep->num]->doepctl; ++ } ++ ++ /* disable the ep */ ++ depctl.d32 = DWC_READ_REG32(addr); ++ ++ depctl.b.epdis = 1; ++ depctl.b.snak = 1; ++ ++ DWC_WRITE_REG32(addr, depctl.d32); ++ ++ if (core_if->dma_desc_enable && ++ ep->iso_desc_addr && ep->iso_dma_desc_addr) { ++ dwc_otg_ep_free_desc_chain(ep->iso_desc_addr, ++ ep->iso_dma_desc_addr, ++ ep->desc_cnt * 2); ++ } ++ ++ /* reset varibales */ ++ ep->dma_addr0 = 0; ++ ep->dma_addr1 = 0; ++ ep->xfer_buff0 = 0; ++ ep->xfer_buff1 = 0; ++ ep->data_per_frame = 0; ++ ep->data_pattern_frame = 0; ++ ep->sync_frame = 0; ++ ep->buf_proc_intrvl = 0; ++ ep->bInterval = 0; ++ ep->proc_buf_num = 0; ++ ep->pkt_per_frm = 0; ++ ep->pkt_per_frm = 0; ++ ep->desc_cnt = 0; ++ ep->iso_desc_addr = 0; ++ ep->iso_dma_desc_addr = 0; ++} ++ ++int dwc_otg_pcd_iso_ep_start(dwc_otg_pcd_t * pcd, void *ep_handle, ++ uint8_t * buf0, uint8_t * buf1, dwc_dma_t dma0, ++ dwc_dma_t dma1, int sync_frame, int dp_frame, ++ int data_per_frame, int start_frame, ++ int buf_proc_intrvl, void *req_handle, ++ int atomic_alloc) ++{ ++ dwc_otg_pcd_ep_t *ep; ++ dwc_irqflags_t flags = 0; ++ dwc_ep_t *dwc_ep; ++ int32_t frm_data; ++ dsts_data_t dsts; ++ dwc_otg_core_if_t *core_if; ++ ++ ep = get_ep_from_handle(pcd, ep_handle); ++ ++ if (!ep || !ep->desc || ep->dwc_ep.num == 0) { ++ DWC_WARN("bad ep\n"); ++ return -DWC_E_INVALID; ++ } ++ ++ DWC_SPINLOCK_IRQSAVE(pcd->lock, &flags); ++ core_if = GET_CORE_IF(pcd); ++ dwc_ep = &ep->dwc_ep; ++ ++ if (ep->iso_req_handle) { ++ DWC_WARN("ISO request in progress\n"); ++ } ++ ++ dwc_ep->dma_addr0 = dma0; ++ dwc_ep->dma_addr1 = dma1; ++ ++ dwc_ep->xfer_buff0 = buf0; ++ dwc_ep->xfer_buff1 = buf1; ++ ++ dwc_ep->data_per_frame = data_per_frame; ++ ++ /** @todo - pattern data support is to be implemented in the future */ ++ dwc_ep->data_pattern_frame = dp_frame; ++ dwc_ep->sync_frame = sync_frame; ++ ++ dwc_ep->buf_proc_intrvl = buf_proc_intrvl; ++ ++ dwc_ep->bInterval = 1 << (ep->desc->bInterval - 1); ++ ++ dwc_ep->proc_buf_num = 0; ++ ++ dwc_ep->pkt_per_frm = 0; ++ frm_data = ep->dwc_ep.data_per_frame; ++ while (frm_data > 0) { ++ dwc_ep->pkt_per_frm++; ++ frm_data -= ep->dwc_ep.maxpacket; ++ } ++ ++ dsts.d32 = DWC_READ_REG32(&core_if->dev_if->dev_global_regs->dsts); ++ ++ if (start_frame == -1) { ++ dwc_ep->next_frame = dsts.b.soffn + 1; ++ if (dwc_ep->bInterval != 1) { ++ dwc_ep->next_frame = ++ dwc_ep->next_frame + (dwc_ep->bInterval - 1 - ++ dwc_ep->next_frame % ++ dwc_ep->bInterval); ++ } ++ } else { ++ dwc_ep->next_frame = start_frame; ++ } ++ ++ if (!core_if->pti_enh_enable) { ++ dwc_ep->pkt_cnt = ++ dwc_ep->buf_proc_intrvl * dwc_ep->pkt_per_frm / ++ dwc_ep->bInterval; ++ } else { ++ dwc_ep->pkt_cnt = ++ (dwc_ep->data_per_frame * ++ (dwc_ep->buf_proc_intrvl / dwc_ep->bInterval) ++ - 1 + dwc_ep->maxpacket) / dwc_ep->maxpacket; ++ } ++ ++ if (core_if->dma_desc_enable) { ++ dwc_ep->desc_cnt = ++ dwc_ep->buf_proc_intrvl * dwc_ep->pkt_per_frm / ++ dwc_ep->bInterval; ++ } ++ ++ if (atomic_alloc) { ++ dwc_ep->pkt_info = ++ DWC_ALLOC_ATOMIC(sizeof(iso_pkt_info_t) * dwc_ep->pkt_cnt); ++ } else { ++ dwc_ep->pkt_info = ++ DWC_ALLOC(sizeof(iso_pkt_info_t) * dwc_ep->pkt_cnt); ++ } ++ if (!dwc_ep->pkt_info) { ++ DWC_SPINUNLOCK_IRQRESTORE(pcd->lock, flags); ++ return -DWC_E_NO_MEMORY; ++ } ++ if (core_if->pti_enh_enable) { ++ dwc_memset(dwc_ep->pkt_info, 0, ++ sizeof(iso_pkt_info_t) * dwc_ep->pkt_cnt); ++ } ++ ++ dwc_ep->cur_pkt = 0; ++ ep->iso_req_handle = req_handle; ++ ++ DWC_SPINUNLOCK_IRQRESTORE(pcd->lock, flags); ++ dwc_otg_iso_ep_start_transfer(core_if, dwc_ep); ++ return 0; ++} ++ ++int dwc_otg_pcd_iso_ep_stop(dwc_otg_pcd_t * pcd, void *ep_handle, ++ void *req_handle) ++{ ++ dwc_irqflags_t flags = 0; ++ dwc_otg_pcd_ep_t *ep; ++ dwc_ep_t *dwc_ep; ++ ++ ep = get_ep_from_handle(pcd, ep_handle); ++ if (!ep || !ep->desc || ep->dwc_ep.num == 0) { ++ DWC_WARN("bad ep\n"); ++ return -DWC_E_INVALID; ++ } ++ dwc_ep = &ep->dwc_ep; ++ ++ dwc_otg_iso_ep_stop_transfer(GET_CORE_IF(pcd), dwc_ep); ++ ++ DWC_FREE(dwc_ep->pkt_info); ++ DWC_SPINLOCK_IRQSAVE(pcd->lock, &flags); ++ if (ep->iso_req_handle != req_handle) { ++ DWC_SPINUNLOCK_IRQRESTORE(pcd->lock, flags); ++ return -DWC_E_INVALID; ++ } ++ ++ DWC_SPINUNLOCK_IRQRESTORE(pcd->lock, flags); ++ ++ ep->iso_req_handle = 0; ++ return 0; ++} ++ ++/** ++ * This function is used for perodical data exchnage between PCD and gadget drivers. ++ * for Isochronous EPs ++ * ++ * - Every time a sync period completes this function is called to ++ * perform data exchange between PCD and gadget ++ */ ++void dwc_otg_iso_buffer_done(dwc_otg_pcd_t * pcd, dwc_otg_pcd_ep_t * ep, ++ void *req_handle) ++{ ++ int i; ++ dwc_ep_t *dwc_ep; ++ ++ dwc_ep = &ep->dwc_ep; ++ ++ DWC_SPINUNLOCK(ep->pcd->lock); ++ pcd->fops->isoc_complete(pcd, ep->priv, ep->iso_req_handle, ++ dwc_ep->proc_buf_num ^ 0x1); ++ DWC_SPINLOCK(ep->pcd->lock); ++ ++ for (i = 0; i < dwc_ep->pkt_cnt; ++i) { ++ dwc_ep->pkt_info[i].status = 0; ++ dwc_ep->pkt_info[i].offset = 0; ++ dwc_ep->pkt_info[i].length = 0; ++ } ++} ++ ++int dwc_otg_pcd_get_iso_packet_count(dwc_otg_pcd_t * pcd, void *ep_handle, ++ void *iso_req_handle) ++{ ++ dwc_otg_pcd_ep_t *ep; ++ dwc_ep_t *dwc_ep; ++ ++ ep = get_ep_from_handle(pcd, ep_handle); ++ if (!ep->desc || ep->dwc_ep.num == 0) { ++ DWC_WARN("bad ep\n"); ++ return -DWC_E_INVALID; ++ } ++ dwc_ep = &ep->dwc_ep; ++ ++ return dwc_ep->pkt_cnt; ++} ++ ++void dwc_otg_pcd_get_iso_packet_params(dwc_otg_pcd_t * pcd, void *ep_handle, ++ void *iso_req_handle, int packet, ++ int *status, int *actual, int *offset) ++{ ++ dwc_otg_pcd_ep_t *ep; ++ dwc_ep_t *dwc_ep; ++ ++ ep = get_ep_from_handle(pcd, ep_handle); ++ if (!ep) ++ DWC_WARN("bad ep\n"); ++ ++ dwc_ep = &ep->dwc_ep; ++ ++ *status = dwc_ep->pkt_info[packet].status; ++ *actual = dwc_ep->pkt_info[packet].length; ++ *offset = dwc_ep->pkt_info[packet].offset; ++} ++ ++#endif /* DWC_EN_ISOC */ ++ ++static void dwc_otg_pcd_init_ep(dwc_otg_pcd_t * pcd, dwc_otg_pcd_ep_t * pcd_ep, ++ uint32_t is_in, uint32_t ep_num) ++{ ++ /* Init EP structure */ ++ pcd_ep->desc = 0; ++ pcd_ep->pcd = pcd; ++ pcd_ep->stopped = 1; ++ pcd_ep->queue_sof = 0; ++ ++ /* Init DWC ep structure */ ++ pcd_ep->dwc_ep.is_in = is_in; ++ pcd_ep->dwc_ep.num = ep_num; ++ pcd_ep->dwc_ep.active = 0; ++ pcd_ep->dwc_ep.tx_fifo_num = 0; ++ /* Control until ep is actvated */ ++ pcd_ep->dwc_ep.type = DWC_OTG_EP_TYPE_CONTROL; ++ pcd_ep->dwc_ep.maxpacket = MAX_PACKET_SIZE; ++ pcd_ep->dwc_ep.dma_addr = 0; ++ pcd_ep->dwc_ep.start_xfer_buff = 0; ++ pcd_ep->dwc_ep.xfer_buff = 0; ++ pcd_ep->dwc_ep.xfer_len = 0; ++ pcd_ep->dwc_ep.xfer_count = 0; ++ pcd_ep->dwc_ep.sent_zlp = 0; ++ pcd_ep->dwc_ep.total_len = 0; ++ pcd_ep->dwc_ep.desc_addr = 0; ++ pcd_ep->dwc_ep.dma_desc_addr = 0; ++ DWC_CIRCLEQ_INIT(&pcd_ep->queue); ++} ++ ++/** ++ * Initialize ep's ++ */ ++static void dwc_otg_pcd_reinit(dwc_otg_pcd_t * pcd) ++{ ++ int i; ++ uint32_t hwcfg1; ++ dwc_otg_pcd_ep_t *ep; ++ int in_ep_cntr, out_ep_cntr; ++ uint32_t num_in_eps = (GET_CORE_IF(pcd))->dev_if->num_in_eps; ++ uint32_t num_out_eps = (GET_CORE_IF(pcd))->dev_if->num_out_eps; ++ ++ /** ++ * Initialize the EP0 structure. ++ */ ++ ep = &pcd->ep0; ++ dwc_otg_pcd_init_ep(pcd, ep, 0, 0); ++ ++ in_ep_cntr = 0; ++ hwcfg1 = (GET_CORE_IF(pcd))->hwcfg1.d32 >> 3; ++ for (i = 1; in_ep_cntr < num_in_eps; i++) { ++ if ((hwcfg1 & 0x1) == 0) { ++ dwc_otg_pcd_ep_t *ep = &pcd->in_ep[in_ep_cntr]; ++ in_ep_cntr++; ++ /** ++ * @todo NGS: Add direction to EP, based on contents ++ * of HWCFG1. Need a copy of HWCFG1 in pcd structure? ++ * sprintf(";r ++ */ ++ dwc_otg_pcd_init_ep(pcd, ep, 1 /* IN */ , i); ++ ++ DWC_CIRCLEQ_INIT(&ep->queue); ++ } ++ hwcfg1 >>= 2; ++ } ++ ++ out_ep_cntr = 0; ++ hwcfg1 = (GET_CORE_IF(pcd))->hwcfg1.d32 >> 2; ++ for (i = 1; out_ep_cntr < num_out_eps; i++) { ++ if ((hwcfg1 & 0x1) == 0) { ++ dwc_otg_pcd_ep_t *ep = &pcd->out_ep[out_ep_cntr]; ++ out_ep_cntr++; ++ /** ++ * @todo NGS: Add direction to EP, based on contents ++ * of HWCFG1. Need a copy of HWCFG1 in pcd structure? ++ * sprintf(";r ++ */ ++ dwc_otg_pcd_init_ep(pcd, ep, 0 /* OUT */ , i); ++ DWC_CIRCLEQ_INIT(&ep->queue); ++ } ++ hwcfg1 >>= 2; ++ } ++ ++ pcd->ep0state = EP0_DISCONNECT; ++ pcd->ep0.dwc_ep.maxpacket = MAX_EP0_SIZE; ++ pcd->ep0.dwc_ep.type = DWC_OTG_EP_TYPE_CONTROL; ++} ++ ++/** ++ * This function is called when the SRP timer expires. The SRP should ++ * complete within 6 seconds. ++ */ ++static void srp_timeout(void *ptr) ++{ ++ gotgctl_data_t gotgctl; ++ dwc_otg_core_if_t *core_if = (dwc_otg_core_if_t *) ptr; ++ volatile uint32_t *addr = &core_if->core_global_regs->gotgctl; ++ ++ gotgctl.d32 = DWC_READ_REG32(addr); ++ ++ core_if->srp_timer_started = 0; ++ ++ if (core_if->adp_enable) { ++ if (gotgctl.b.bsesvld == 0) { ++ gpwrdn_data_t gpwrdn = {.d32 = 0 }; ++ DWC_PRINTF("SRP Timeout BSESSVLD = 0\n"); ++ /* Power off the core */ ++ if (core_if->power_down == 2) { ++ gpwrdn.b.pwrdnswtch = 1; ++ DWC_MODIFY_REG32(&core_if-> ++ core_global_regs->gpwrdn, ++ gpwrdn.d32, 0); ++ } ++ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pmuintsel = 1; ++ gpwrdn.b.pmuactv = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, 0, ++ gpwrdn.d32); ++ dwc_otg_adp_probe_start(core_if); ++ } else { ++ DWC_PRINTF("SRP Timeout BSESSVLD = 1\n"); ++ core_if->op_state = B_PERIPHERAL; ++ dwc_otg_core_init(core_if); ++ dwc_otg_enable_global_interrupts(core_if); ++ cil_pcd_start(core_if); ++ } ++ } ++ ++ if ((core_if->core_params->phy_type == DWC_PHY_TYPE_PARAM_FS) && ++ (core_if->core_params->i2c_enable)) { ++ DWC_PRINTF("SRP Timeout\n"); ++ ++ if ((core_if->srp_success) && (gotgctl.b.bsesvld)) { ++ if (core_if->pcd_cb && core_if->pcd_cb->resume_wakeup) { ++ core_if->pcd_cb->resume_wakeup(core_if->pcd_cb->p); ++ } ++ ++ /* Clear Session Request */ ++ gotgctl.d32 = 0; ++ gotgctl.b.sesreq = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gotgctl, ++ gotgctl.d32, 0); ++ ++ core_if->srp_success = 0; ++ } else { ++ __DWC_ERROR("Device not connected/responding\n"); ++ gotgctl.b.sesreq = 0; ++ DWC_WRITE_REG32(addr, gotgctl.d32); ++ } ++ } else if (gotgctl.b.sesreq) { ++ DWC_PRINTF("SRP Timeout\n"); ++ ++ __DWC_ERROR("Device not connected/responding\n"); ++ gotgctl.b.sesreq = 0; ++ DWC_WRITE_REG32(addr, gotgctl.d32); ++ } else { ++ DWC_PRINTF(" SRP GOTGCTL=%0x\n", gotgctl.d32); ++ } ++} ++ ++/** ++ * Tasklet ++ * ++ */ ++extern void start_next_request(dwc_otg_pcd_ep_t * ep); ++ ++static void start_xfer_tasklet_func(void *data) ++{ ++ dwc_otg_pcd_t *pcd = (dwc_otg_pcd_t *) data; ++ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); ++ ++ int i; ++ depctl_data_t diepctl; ++ ++ DWC_DEBUGPL(DBG_PCDV, "Start xfer tasklet\n"); ++ ++ diepctl.d32 = DWC_READ_REG32(&core_if->dev_if->in_ep_regs[0]->diepctl); ++ ++ if (pcd->ep0.queue_sof) { ++ pcd->ep0.queue_sof = 0; ++ start_next_request(&pcd->ep0); ++ // break; ++ } ++ ++ for (i = 0; i < core_if->dev_if->num_in_eps; i++) { ++ depctl_data_t diepctl; ++ diepctl.d32 = ++ DWC_READ_REG32(&core_if->dev_if->in_ep_regs[i]->diepctl); ++ ++ if (pcd->in_ep[i].queue_sof) { ++ pcd->in_ep[i].queue_sof = 0; ++ start_next_request(&pcd->in_ep[i]); ++ // break; ++ } ++ } ++ ++ return; ++} ++ ++/** ++ * This function initialized the PCD portion of the driver. ++ * ++ */ ++dwc_otg_pcd_t *dwc_otg_pcd_init(dwc_otg_core_if_t * core_if) ++{ ++ dwc_otg_pcd_t *pcd = NULL; ++ dwc_otg_dev_if_t *dev_if; ++ int i; ++ ++ /* ++ * Allocate PCD structure ++ */ ++ pcd = DWC_ALLOC(sizeof(dwc_otg_pcd_t)); ++ ++ if (pcd == NULL) { ++ return NULL; ++ } ++ ++#if (defined(DWC_LINUX) && defined(CONFIG_DEBUG_SPINLOCK)) ++ DWC_SPINLOCK_ALLOC_LINUX_DEBUG(pcd->lock); ++#else ++ pcd->lock = DWC_SPINLOCK_ALLOC(); ++#endif ++ DWC_DEBUGPL(DBG_HCDV, "Init of PCD %p given core_if %p\n", ++ pcd, core_if);//GRAYG ++ if (!pcd->lock) { ++ DWC_ERROR("Could not allocate lock for pcd"); ++ DWC_FREE(pcd); ++ return NULL; ++ } ++ /* Set core_if's lock pointer to hcd->lock */ ++ core_if->lock = pcd->lock; ++ pcd->core_if = core_if; ++ ++ dev_if = core_if->dev_if; ++ dev_if->isoc_ep = NULL; ++ ++ if (core_if->hwcfg4.b.ded_fifo_en) { ++ DWC_PRINTF("Dedicated Tx FIFOs mode\n"); ++ } else { ++ DWC_PRINTF("Shared Tx FIFO mode\n"); ++ } ++ ++ /* ++ * Initialized the Core for Device mode here if there is nod ADP support. ++ * Otherwise it will be done later in dwc_otg_adp_start routine. ++ */ ++ if (dwc_otg_is_device_mode(core_if) /*&& !core_if->adp_enable*/) { ++ dwc_otg_core_dev_init(core_if); ++ } ++ ++ /* ++ * Register the PCD Callbacks. ++ */ ++ dwc_otg_cil_register_pcd_callbacks(core_if, &pcd_callbacks, pcd); ++ ++ /* ++ * Initialize the DMA buffer for SETUP packets ++ */ ++ if (GET_CORE_IF(pcd)->dma_enable) { ++ pcd->setup_pkt = ++ DWC_DMA_ALLOC(sizeof(*pcd->setup_pkt) * 5, ++ &pcd->setup_pkt_dma_handle); ++ if (pcd->setup_pkt == NULL) { ++ DWC_FREE(pcd); ++ return NULL; ++ } ++ ++ pcd->status_buf = ++ DWC_DMA_ALLOC(sizeof(uint16_t), ++ &pcd->status_buf_dma_handle); ++ if (pcd->status_buf == NULL) { ++ DWC_DMA_FREE(sizeof(*pcd->setup_pkt) * 5, ++ pcd->setup_pkt, pcd->setup_pkt_dma_handle); ++ DWC_FREE(pcd); ++ return NULL; ++ } ++ ++ if (GET_CORE_IF(pcd)->dma_desc_enable) { ++ dev_if->setup_desc_addr[0] = ++ dwc_otg_ep_alloc_desc_chain ++ (&dev_if->dma_setup_desc_addr[0], 1); ++ dev_if->setup_desc_addr[1] = ++ dwc_otg_ep_alloc_desc_chain ++ (&dev_if->dma_setup_desc_addr[1], 1); ++ dev_if->in_desc_addr = ++ dwc_otg_ep_alloc_desc_chain ++ (&dev_if->dma_in_desc_addr, 1); ++ dev_if->out_desc_addr = ++ dwc_otg_ep_alloc_desc_chain ++ (&dev_if->dma_out_desc_addr, 1); ++ pcd->data_terminated = 0; ++ ++ if (dev_if->setup_desc_addr[0] == 0 ++ || dev_if->setup_desc_addr[1] == 0 ++ || dev_if->in_desc_addr == 0 ++ || dev_if->out_desc_addr == 0) { ++ ++ if (dev_if->out_desc_addr) ++ dwc_otg_ep_free_desc_chain ++ (dev_if->out_desc_addr, ++ dev_if->dma_out_desc_addr, 1); ++ if (dev_if->in_desc_addr) ++ dwc_otg_ep_free_desc_chain ++ (dev_if->in_desc_addr, ++ dev_if->dma_in_desc_addr, 1); ++ if (dev_if->setup_desc_addr[1]) ++ dwc_otg_ep_free_desc_chain ++ (dev_if->setup_desc_addr[1], ++ dev_if->dma_setup_desc_addr[1], 1); ++ if (dev_if->setup_desc_addr[0]) ++ dwc_otg_ep_free_desc_chain ++ (dev_if->setup_desc_addr[0], ++ dev_if->dma_setup_desc_addr[0], 1); ++ ++ DWC_DMA_FREE(sizeof(*pcd->setup_pkt) * 5, ++ pcd->setup_pkt, ++ pcd->setup_pkt_dma_handle); ++ DWC_DMA_FREE(sizeof(*pcd->status_buf), ++ pcd->status_buf, ++ pcd->status_buf_dma_handle); ++ ++ DWC_FREE(pcd); ++ ++ return NULL; ++ } ++ } ++ } else { ++ pcd->setup_pkt = DWC_ALLOC(sizeof(*pcd->setup_pkt) * 5); ++ if (pcd->setup_pkt == NULL) { ++ DWC_FREE(pcd); ++ return NULL; ++ } ++ ++ pcd->status_buf = DWC_ALLOC(sizeof(uint16_t)); ++ if (pcd->status_buf == NULL) { ++ DWC_FREE(pcd->setup_pkt); ++ DWC_FREE(pcd); ++ return NULL; ++ } ++ } ++ ++ dwc_otg_pcd_reinit(pcd); ++ ++ /* Allocate the cfi object for the PCD */ ++#ifdef DWC_UTE_CFI ++ pcd->cfi = DWC_ALLOC(sizeof(cfiobject_t)); ++ if (NULL == pcd->cfi) ++ goto fail; ++ if (init_cfi(pcd->cfi)) { ++ CFI_INFO("%s: Failed to init the CFI object\n", __func__); ++ goto fail; ++ } ++#endif ++ ++ /* Initialize tasklets */ ++ pcd->start_xfer_tasklet = DWC_TASK_ALLOC("xfer_tasklet", ++ start_xfer_tasklet_func, pcd); ++ pcd->test_mode_tasklet = DWC_TASK_ALLOC("test_mode_tasklet", ++ do_test_mode, pcd); ++ ++ /* Initialize SRP timer */ ++ core_if->srp_timer = DWC_TIMER_ALLOC("SRP TIMER", srp_timeout, core_if); ++ ++ if (core_if->core_params->dev_out_nak) { ++ /** ++ * Initialize xfer timeout timer. Implemented for ++ * 2.93a feature "Device DDMA OUT NAK Enhancement" ++ */ ++ for(i = 0; i < MAX_EPS_CHANNELS; i++) { ++ pcd->core_if->ep_xfer_timer[i] = ++ DWC_TIMER_ALLOC("ep timer", ep_xfer_timeout, ++ &pcd->core_if->ep_xfer_info[i]); ++ } ++ } ++ ++ return pcd; ++#ifdef DWC_UTE_CFI ++fail: ++#endif ++ if (pcd->setup_pkt) ++ DWC_FREE(pcd->setup_pkt); ++ if (pcd->status_buf) ++ DWC_FREE(pcd->status_buf); ++#ifdef DWC_UTE_CFI ++ if (pcd->cfi) ++ DWC_FREE(pcd->cfi); ++#endif ++ if (pcd) ++ DWC_FREE(pcd); ++ return NULL; ++ ++} ++ ++/** ++ * Remove PCD specific data ++ */ ++void dwc_otg_pcd_remove(dwc_otg_pcd_t * pcd) ++{ ++ dwc_otg_dev_if_t *dev_if = GET_CORE_IF(pcd)->dev_if; ++ int i; ++ if (pcd->core_if->core_params->dev_out_nak) { ++ for (i = 0; i < MAX_EPS_CHANNELS; i++) { ++ DWC_TIMER_CANCEL(pcd->core_if->ep_xfer_timer[i]); ++ pcd->core_if->ep_xfer_info[i].state = 0; ++ } ++ } ++ ++ if (GET_CORE_IF(pcd)->dma_enable) { ++ DWC_DMA_FREE(sizeof(*pcd->setup_pkt) * 5, pcd->setup_pkt, ++ pcd->setup_pkt_dma_handle); ++ DWC_DMA_FREE(sizeof(uint16_t), pcd->status_buf, ++ pcd->status_buf_dma_handle); ++ if (GET_CORE_IF(pcd)->dma_desc_enable) { ++ dwc_otg_ep_free_desc_chain(dev_if->setup_desc_addr[0], ++ dev_if->dma_setup_desc_addr ++ [0], 1); ++ dwc_otg_ep_free_desc_chain(dev_if->setup_desc_addr[1], ++ dev_if->dma_setup_desc_addr ++ [1], 1); ++ dwc_otg_ep_free_desc_chain(dev_if->in_desc_addr, ++ dev_if->dma_in_desc_addr, 1); ++ dwc_otg_ep_free_desc_chain(dev_if->out_desc_addr, ++ dev_if->dma_out_desc_addr, ++ 1); ++ } ++ } else { ++ DWC_FREE(pcd->setup_pkt); ++ DWC_FREE(pcd->status_buf); ++ } ++ DWC_SPINLOCK_FREE(pcd->lock); ++ /* Set core_if's lock pointer to NULL */ ++ pcd->core_if->lock = NULL; ++ ++ DWC_TASK_FREE(pcd->start_xfer_tasklet); ++ DWC_TASK_FREE(pcd->test_mode_tasklet); ++ if (pcd->core_if->core_params->dev_out_nak) { ++ for (i = 0; i < MAX_EPS_CHANNELS; i++) { ++ if (pcd->core_if->ep_xfer_timer[i]) { ++ DWC_TIMER_FREE(pcd->core_if->ep_xfer_timer[i]); ++ } ++ } ++ } ++ ++/* Release the CFI object's dynamic memory */ ++#ifdef DWC_UTE_CFI ++ if (pcd->cfi->ops.release) { ++ pcd->cfi->ops.release(pcd->cfi); ++ } ++#endif ++ ++ DWC_FREE(pcd); ++} ++ ++/** ++ * Returns whether registered pcd is dual speed or not ++ */ ++uint32_t dwc_otg_pcd_is_dualspeed(dwc_otg_pcd_t * pcd) ++{ ++ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); ++ ++ if ((core_if->core_params->speed == DWC_SPEED_PARAM_FULL) || ++ ((core_if->hwcfg2.b.hs_phy_type == 2) && ++ (core_if->hwcfg2.b.fs_phy_type == 1) && ++ (core_if->core_params->ulpi_fs_ls))) { ++ return 0; ++ } ++ ++ return 1; ++} ++ ++/** ++ * Returns whether registered pcd is OTG capable or not ++ */ ++uint32_t dwc_otg_pcd_is_otg(dwc_otg_pcd_t * pcd) ++{ ++ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); ++ gusbcfg_data_t usbcfg = {.d32 = 0 }; ++ ++ usbcfg.d32 = DWC_READ_REG32(&core_if->core_global_regs->gusbcfg); ++ if (!usbcfg.b.srpcap || !usbcfg.b.hnpcap) { ++ return 0; ++ } ++ ++ return 1; ++} ++ ++/** ++ * This function assigns periodic Tx FIFO to an periodic EP ++ * in shared Tx FIFO mode ++ */ ++static uint32_t assign_tx_fifo(dwc_otg_core_if_t * core_if) ++{ ++ uint32_t TxMsk = 1; ++ int i; ++ ++ for (i = 0; i < core_if->hwcfg4.b.num_in_eps; ++i) { ++ if ((TxMsk & core_if->tx_msk) == 0) { ++ core_if->tx_msk |= TxMsk; ++ return i + 1; ++ } ++ TxMsk <<= 1; ++ } ++ return 0; ++} ++ ++/** ++ * This function assigns periodic Tx FIFO to an periodic EP ++ * in shared Tx FIFO mode ++ */ ++static uint32_t assign_perio_tx_fifo(dwc_otg_core_if_t * core_if) ++{ ++ uint32_t PerTxMsk = 1; ++ int i; ++ for (i = 0; i < core_if->hwcfg4.b.num_dev_perio_in_ep; ++i) { ++ if ((PerTxMsk & core_if->p_tx_msk) == 0) { ++ core_if->p_tx_msk |= PerTxMsk; ++ return i + 1; ++ } ++ PerTxMsk <<= 1; ++ } ++ return 0; ++} ++ ++/** ++ * This function releases periodic Tx FIFO ++ * in shared Tx FIFO mode ++ */ ++static void release_perio_tx_fifo(dwc_otg_core_if_t * core_if, ++ uint32_t fifo_num) ++{ ++ core_if->p_tx_msk = ++ (core_if->p_tx_msk & (1 << (fifo_num - 1))) ^ core_if->p_tx_msk; ++} ++ ++/** ++ * This function releases periodic Tx FIFO ++ * in shared Tx FIFO mode ++ */ ++static void release_tx_fifo(dwc_otg_core_if_t * core_if, uint32_t fifo_num) ++{ ++ core_if->tx_msk = ++ (core_if->tx_msk & (1 << (fifo_num - 1))) ^ core_if->tx_msk; ++} ++ ++/** ++ * This function is being called from gadget ++ * to enable PCD endpoint. ++ */ ++int dwc_otg_pcd_ep_enable(dwc_otg_pcd_t * pcd, ++ const uint8_t * ep_desc, void *usb_ep) ++{ ++ int num, dir; ++ dwc_otg_pcd_ep_t *ep = NULL; ++ const usb_endpoint_descriptor_t *desc; ++ dwc_irqflags_t flags; ++ fifosize_data_t dptxfsiz = {.d32 = 0 }; ++ gdfifocfg_data_t gdfifocfg = {.d32 = 0 }; ++ gdfifocfg_data_t gdfifocfgbase = {.d32 = 0 }; ++ int retval = 0; ++ int i, epcount; ++ ++ desc = (const usb_endpoint_descriptor_t *)ep_desc; ++ ++ if (!desc) { ++ pcd->ep0.priv = usb_ep; ++ ep = &pcd->ep0; ++ retval = -DWC_E_INVALID; ++ goto out; ++ } ++ ++ num = UE_GET_ADDR(desc->bEndpointAddress); ++ dir = UE_GET_DIR(desc->bEndpointAddress); ++ ++ if (!desc->wMaxPacketSize) { ++ DWC_WARN("bad maxpacketsize\n"); ++ retval = -DWC_E_INVALID; ++ goto out; ++ } ++ ++ if (dir == UE_DIR_IN) { ++ epcount = pcd->core_if->dev_if->num_in_eps; ++ for (i = 0; i < epcount; i++) { ++ if (num == pcd->in_ep[i].dwc_ep.num) { ++ ep = &pcd->in_ep[i]; ++ break; ++ } ++ } ++ } else { ++ epcount = pcd->core_if->dev_if->num_out_eps; ++ for (i = 0; i < epcount; i++) { ++ if (num == pcd->out_ep[i].dwc_ep.num) { ++ ep = &pcd->out_ep[i]; ++ break; ++ } ++ } ++ } ++ ++ if (!ep) { ++ DWC_WARN("bad address\n"); ++ retval = -DWC_E_INVALID; ++ goto out; ++ } ++ ++ DWC_SPINLOCK_IRQSAVE(pcd->lock, &flags); ++ ++ ep->desc = desc; ++ ep->priv = usb_ep; ++ ++ /* ++ * Activate the EP ++ */ ++ ep->stopped = 0; ++ ++ ep->dwc_ep.is_in = (dir == UE_DIR_IN); ++ ep->dwc_ep.maxpacket = UGETW(desc->wMaxPacketSize); ++ ++ ep->dwc_ep.type = desc->bmAttributes & UE_XFERTYPE; ++ ++ if (ep->dwc_ep.is_in) { ++ if (!GET_CORE_IF(pcd)->en_multiple_tx_fifo) { ++ ep->dwc_ep.tx_fifo_num = 0; ++ ++ if (ep->dwc_ep.type == UE_ISOCHRONOUS) { ++ /* ++ * if ISOC EP then assign a Periodic Tx FIFO. ++ */ ++ ep->dwc_ep.tx_fifo_num = ++ assign_perio_tx_fifo(GET_CORE_IF(pcd)); ++ } ++ } else { ++ /* ++ * if Dedicated FIFOs mode is on then assign a Tx FIFO. ++ */ ++ ep->dwc_ep.tx_fifo_num = ++ assign_tx_fifo(GET_CORE_IF(pcd)); ++ } ++ ++ /* Calculating EP info controller base address */ ++ if (ep->dwc_ep.tx_fifo_num ++ && GET_CORE_IF(pcd)->en_multiple_tx_fifo) { ++ gdfifocfg.d32 = ++ DWC_READ_REG32(&GET_CORE_IF(pcd)-> ++ core_global_regs->gdfifocfg); ++ gdfifocfgbase.d32 = gdfifocfg.d32 >> 16; ++ dptxfsiz.d32 = ++ (DWC_READ_REG32 ++ (&GET_CORE_IF(pcd)->core_global_regs-> ++ dtxfsiz[ep->dwc_ep.tx_fifo_num - 1]) >> 16); ++ gdfifocfg.b.epinfobase = ++ gdfifocfgbase.d32 + dptxfsiz.d32; ++ if (GET_CORE_IF(pcd)->snpsid <= OTG_CORE_REV_2_94a) { ++ DWC_WRITE_REG32(&GET_CORE_IF(pcd)-> ++ core_global_regs->gdfifocfg, ++ gdfifocfg.d32); ++ } ++ } ++ } ++ /* Set initial data PID. */ ++ if (ep->dwc_ep.type == UE_BULK) { ++ ep->dwc_ep.data_pid_start = 0; ++ } ++ ++ /* Alloc DMA Descriptors */ ++ if (GET_CORE_IF(pcd)->dma_desc_enable) { ++#ifndef DWC_UTE_PER_IO ++ if (ep->dwc_ep.type != UE_ISOCHRONOUS) { ++#endif ++ ep->dwc_ep.desc_addr = ++ dwc_otg_ep_alloc_desc_chain(&ep-> ++ dwc_ep.dma_desc_addr, ++ MAX_DMA_DESC_CNT); ++ if (!ep->dwc_ep.desc_addr) { ++ DWC_WARN("%s, can't allocate DMA descriptor\n", ++ __func__); ++ retval = -DWC_E_SHUTDOWN; ++ DWC_SPINUNLOCK_IRQRESTORE(pcd->lock, flags); ++ goto out; ++ } ++#ifndef DWC_UTE_PER_IO ++ } ++#endif ++ } ++ ++ DWC_DEBUGPL(DBG_PCD, "Activate %s: type=%d, mps=%d desc=%p\n", ++ (ep->dwc_ep.is_in ? "IN" : "OUT"), ++ ep->dwc_ep.type, ep->dwc_ep.maxpacket, ep->desc); ++#ifdef DWC_UTE_PER_IO ++ ep->dwc_ep.xiso_bInterval = 1 << (ep->desc->bInterval - 1); ++#endif ++ if (ep->dwc_ep.type == DWC_OTG_EP_TYPE_ISOC) { ++ ep->dwc_ep.bInterval = 1 << (ep->desc->bInterval - 1); ++ ep->dwc_ep.frame_num = 0xFFFFFFFF; ++ } ++ ++ dwc_otg_ep_activate(GET_CORE_IF(pcd), &ep->dwc_ep); ++ ++#ifdef DWC_UTE_CFI ++ if (pcd->cfi->ops.ep_enable) { ++ pcd->cfi->ops.ep_enable(pcd->cfi, pcd, ep); ++ } ++#endif ++ ++ DWC_SPINUNLOCK_IRQRESTORE(pcd->lock, flags); ++ ++out: ++ return retval; ++} ++ ++/** ++ * This function is being called from gadget ++ * to disable PCD endpoint. ++ */ ++int dwc_otg_pcd_ep_disable(dwc_otg_pcd_t * pcd, void *ep_handle) ++{ ++ dwc_otg_pcd_ep_t *ep; ++ dwc_irqflags_t flags; ++ dwc_otg_dev_dma_desc_t *desc_addr; ++ dwc_dma_t dma_desc_addr; ++ gdfifocfg_data_t gdfifocfgbase = {.d32 = 0 }; ++ gdfifocfg_data_t gdfifocfg = {.d32 = 0 }; ++ fifosize_data_t dptxfsiz = {.d32 = 0 }; ++ ++ ep = get_ep_from_handle(pcd, ep_handle); ++ ++ if (!ep || !ep->desc) { ++ DWC_DEBUGPL(DBG_PCD, "bad ep address\n"); ++ return -DWC_E_INVALID; ++ } ++ ++ DWC_SPINLOCK_IRQSAVE(pcd->lock, &flags); ++ ++ dwc_otg_request_nuke(ep); ++ ++ dwc_otg_ep_deactivate(GET_CORE_IF(pcd), &ep->dwc_ep); ++ if (pcd->core_if->core_params->dev_out_nak) { ++ DWC_TIMER_CANCEL(pcd->core_if->ep_xfer_timer[ep->dwc_ep.num]); ++ pcd->core_if->ep_xfer_info[ep->dwc_ep.num].state = 0; ++ } ++ ep->desc = NULL; ++ ep->stopped = 1; ++ ++ gdfifocfg.d32 = ++ DWC_READ_REG32(&GET_CORE_IF(pcd)->core_global_regs->gdfifocfg); ++ gdfifocfgbase.d32 = gdfifocfg.d32 >> 16; ++ ++ if (ep->dwc_ep.is_in) { ++ if (GET_CORE_IF(pcd)->en_multiple_tx_fifo) { ++ /* Flush the Tx FIFO */ ++ dwc_otg_flush_tx_fifo(GET_CORE_IF(pcd), ++ ep->dwc_ep.tx_fifo_num); ++ } ++ release_perio_tx_fifo(GET_CORE_IF(pcd), ep->dwc_ep.tx_fifo_num); ++ release_tx_fifo(GET_CORE_IF(pcd), ep->dwc_ep.tx_fifo_num); ++ if (GET_CORE_IF(pcd)->en_multiple_tx_fifo) { ++ /* Decreasing EPinfo Base Addr */ ++ dptxfsiz.d32 = ++ (DWC_READ_REG32 ++ (&GET_CORE_IF(pcd)-> ++ core_global_regs->dtxfsiz[ep->dwc_ep.tx_fifo_num-1]) >> 16); ++ gdfifocfg.b.epinfobase = gdfifocfgbase.d32 - dptxfsiz.d32; ++ if (GET_CORE_IF(pcd)->snpsid <= OTG_CORE_REV_2_94a) { ++ DWC_WRITE_REG32(&GET_CORE_IF(pcd)->core_global_regs->gdfifocfg, ++ gdfifocfg.d32); ++ } ++ } ++ } ++ ++ /* Free DMA Descriptors */ ++ if (GET_CORE_IF(pcd)->dma_desc_enable) { ++ if (ep->dwc_ep.type != UE_ISOCHRONOUS) { ++ desc_addr = ep->dwc_ep.desc_addr; ++ dma_desc_addr = ep->dwc_ep.dma_desc_addr; ++ ++ /* Cannot call dma_free_coherent() with IRQs disabled */ ++ DWC_SPINUNLOCK_IRQRESTORE(pcd->lock, flags); ++ dwc_otg_ep_free_desc_chain(desc_addr, dma_desc_addr, ++ MAX_DMA_DESC_CNT); ++ ++ goto out_unlocked; ++ } ++ } ++ DWC_SPINUNLOCK_IRQRESTORE(pcd->lock, flags); ++ ++out_unlocked: ++ DWC_DEBUGPL(DBG_PCD, "%d %s disabled\n", ep->dwc_ep.num, ++ ep->dwc_ep.is_in ? "IN" : "OUT"); ++ return 0; ++ ++} ++ ++/******************************************************************************/ ++#ifdef DWC_UTE_PER_IO ++ ++/** ++ * Free the request and its extended parts ++ * ++ */ ++void dwc_pcd_xiso_ereq_free(dwc_otg_pcd_ep_t * ep, dwc_otg_pcd_request_t * req) ++{ ++ DWC_FREE(req->ext_req.per_io_frame_descs); ++ DWC_FREE(req); ++} ++ ++/** ++ * Start the next request in the endpoint's queue. ++ * ++ */ ++int dwc_otg_pcd_xiso_start_next_request(dwc_otg_pcd_t * pcd, ++ dwc_otg_pcd_ep_t * ep) ++{ ++ int i; ++ dwc_otg_pcd_request_t *req = NULL; ++ dwc_ep_t *dwcep = NULL; ++ struct dwc_iso_xreq_port *ereq = NULL; ++ struct dwc_iso_pkt_desc_port *ddesc_iso; ++ uint16_t nat; ++ depctl_data_t diepctl; ++ ++ dwcep = &ep->dwc_ep; ++ ++ if (dwcep->xiso_active_xfers > 0) { ++#if 0 //Disable this to decrease s/w overhead that is crucial for Isoc transfers ++ DWC_WARN("There are currently active transfers for EP%d \ ++ (active=%d; queued=%d)", dwcep->num, dwcep->xiso_active_xfers, ++ dwcep->xiso_queued_xfers); ++#endif ++ return 0; ++ } ++ ++ nat = UGETW(ep->desc->wMaxPacketSize); ++ nat = (nat >> 11) & 0x03; ++ ++ if (!DWC_CIRCLEQ_EMPTY(&ep->queue)) { ++ req = DWC_CIRCLEQ_FIRST(&ep->queue); ++ ereq = &req->ext_req; ++ ep->stopped = 0; ++ ++ /* Get the frame number */ ++ dwcep->xiso_frame_num = ++ dwc_otg_get_frame_number(GET_CORE_IF(pcd)); ++ DWC_DEBUG("FRM_NUM=%d", dwcep->xiso_frame_num); ++ ++ ddesc_iso = ereq->per_io_frame_descs; ++ ++ if (dwcep->is_in) { ++ /* Setup DMA Descriptor chain for IN Isoc request */ ++ for (i = 0; i < ereq->pio_pkt_count; i++) { ++ //if ((i % (nat + 1)) == 0) ++ if ( i > 0 ) ++ dwcep->xiso_frame_num = ++ (dwcep->xiso_bInterval + ++ dwcep->xiso_frame_num) & 0x3FFF; ++ dwcep->desc_addr[i].buf = ++ req->dma + ddesc_iso[i].offset; ++ dwcep->desc_addr[i].status.b_iso_in.txbytes = ++ ddesc_iso[i].length; ++ dwcep->desc_addr[i].status.b_iso_in.framenum = ++ dwcep->xiso_frame_num; ++ dwcep->desc_addr[i].status.b_iso_in.bs = ++ BS_HOST_READY; ++ dwcep->desc_addr[i].status.b_iso_in.txsts = 0; ++ dwcep->desc_addr[i].status.b_iso_in.sp = ++ (ddesc_iso[i].length % ++ dwcep->maxpacket) ? 1 : 0; ++ dwcep->desc_addr[i].status.b_iso_in.ioc = 0; ++ dwcep->desc_addr[i].status.b_iso_in.pid = nat + 1; ++ dwcep->desc_addr[i].status.b_iso_in.l = 0; ++ ++ /* Process the last descriptor */ ++ if (i == ereq->pio_pkt_count - 1) { ++ dwcep->desc_addr[i].status.b_iso_in.ioc = 1; ++ dwcep->desc_addr[i].status.b_iso_in.l = 1; ++ } ++ } ++ ++ /* Setup and start the transfer for this endpoint */ ++ dwcep->xiso_active_xfers++; ++ DWC_WRITE_REG32(&GET_CORE_IF(pcd)->dev_if-> ++ in_ep_regs[dwcep->num]->diepdma, ++ dwcep->dma_desc_addr); ++ diepctl.d32 = 0; ++ diepctl.b.epena = 1; ++ diepctl.b.cnak = 1; ++ DWC_MODIFY_REG32(&GET_CORE_IF(pcd)->dev_if-> ++ in_ep_regs[dwcep->num]->diepctl, 0, ++ diepctl.d32); ++ } else { ++ /* Setup DMA Descriptor chain for OUT Isoc request */ ++ for (i = 0; i < ereq->pio_pkt_count; i++) { ++ //if ((i % (nat + 1)) == 0) ++ dwcep->xiso_frame_num = (dwcep->xiso_bInterval + ++ dwcep->xiso_frame_num) & 0x3FFF; ++ dwcep->desc_addr[i].buf = ++ req->dma + ddesc_iso[i].offset; ++ dwcep->desc_addr[i].status.b_iso_out.rxbytes = ++ ddesc_iso[i].length; ++ dwcep->desc_addr[i].status.b_iso_out.framenum = ++ dwcep->xiso_frame_num; ++ dwcep->desc_addr[i].status.b_iso_out.bs = ++ BS_HOST_READY; ++ dwcep->desc_addr[i].status.b_iso_out.rxsts = 0; ++ dwcep->desc_addr[i].status.b_iso_out.sp = ++ (ddesc_iso[i].length % ++ dwcep->maxpacket) ? 1 : 0; ++ dwcep->desc_addr[i].status.b_iso_out.ioc = 0; ++ dwcep->desc_addr[i].status.b_iso_out.pid = nat + 1; ++ dwcep->desc_addr[i].status.b_iso_out.l = 0; ++ ++ /* Process the last descriptor */ ++ if (i == ereq->pio_pkt_count - 1) { ++ dwcep->desc_addr[i].status.b_iso_out.ioc = 1; ++ dwcep->desc_addr[i].status.b_iso_out.l = 1; ++ } ++ } ++ ++ /* Setup and start the transfer for this endpoint */ ++ dwcep->xiso_active_xfers++; ++ DWC_WRITE_REG32(&GET_CORE_IF(pcd)-> ++ dev_if->out_ep_regs[dwcep->num]-> ++ doepdma, dwcep->dma_desc_addr); ++ diepctl.d32 = 0; ++ diepctl.b.epena = 1; ++ diepctl.b.cnak = 1; ++ DWC_MODIFY_REG32(&GET_CORE_IF(pcd)-> ++ dev_if->out_ep_regs[dwcep->num]-> ++ doepctl, 0, diepctl.d32); ++ } ++ ++ } else { ++ ep->stopped = 1; ++ } ++ ++ return 0; ++} ++ ++/** ++ * - Remove the request from the queue ++ */ ++void complete_xiso_ep(dwc_otg_pcd_ep_t * ep) ++{ ++ dwc_otg_pcd_request_t *req = NULL; ++ struct dwc_iso_xreq_port *ereq = NULL; ++ struct dwc_iso_pkt_desc_port *ddesc_iso = NULL; ++ dwc_ep_t *dwcep = NULL; ++ int i; ++ ++ //DWC_DEBUG(); ++ dwcep = &ep->dwc_ep; ++ ++ /* Get the first pending request from the queue */ ++ if (!DWC_CIRCLEQ_EMPTY(&ep->queue)) { ++ req = DWC_CIRCLEQ_FIRST(&ep->queue); ++ if (!req) { ++ DWC_PRINTF("complete_ep 0x%p, req = NULL!\n", ep); ++ return; ++ } ++ dwcep->xiso_active_xfers--; ++ dwcep->xiso_queued_xfers--; ++ /* Remove this request from the queue */ ++ DWC_CIRCLEQ_REMOVE_INIT(&ep->queue, req, queue_entry); ++ } else { ++ DWC_PRINTF("complete_ep 0x%p, ep->queue empty!\n", ep); ++ return; ++ } ++ ++ ep->stopped = 1; ++ ereq = &req->ext_req; ++ ddesc_iso = ereq->per_io_frame_descs; ++ ++ if (dwcep->xiso_active_xfers < 0) { ++ DWC_WARN("EP#%d (xiso_active_xfers=%d)", dwcep->num, ++ dwcep->xiso_active_xfers); ++ } ++ ++ /* Fill the Isoc descs of portable extended req from dma descriptors */ ++ for (i = 0; i < ereq->pio_pkt_count; i++) { ++ if (dwcep->is_in) { /* IN endpoints */ ++ ddesc_iso[i].actual_length = ddesc_iso[i].length - ++ dwcep->desc_addr[i].status.b_iso_in.txbytes; ++ ddesc_iso[i].status = ++ dwcep->desc_addr[i].status.b_iso_in.txsts; ++ } else { /* OUT endpoints */ ++ ddesc_iso[i].actual_length = ddesc_iso[i].length - ++ dwcep->desc_addr[i].status.b_iso_out.rxbytes; ++ ddesc_iso[i].status = ++ dwcep->desc_addr[i].status.b_iso_out.rxsts; ++ } ++ } ++ ++ DWC_SPINUNLOCK(ep->pcd->lock); ++ ++ /* Call the completion function in the non-portable logic */ ++ ep->pcd->fops->xisoc_complete(ep->pcd, ep->priv, req->priv, 0, ++ &req->ext_req); ++ ++ DWC_SPINLOCK(ep->pcd->lock); ++ ++ /* Free the request - specific freeing needed for extended request object */ ++ dwc_pcd_xiso_ereq_free(ep, req); ++ ++ /* Start the next request */ ++ dwc_otg_pcd_xiso_start_next_request(ep->pcd, ep); ++ ++ return; ++} ++ ++/** ++ * Create and initialize the Isoc pkt descriptors of the extended request. ++ * ++ */ ++static int dwc_otg_pcd_xiso_create_pkt_descs(dwc_otg_pcd_request_t * req, ++ void *ereq_nonport, ++ int atomic_alloc) ++{ ++ struct dwc_iso_xreq_port *ereq = NULL; ++ struct dwc_iso_xreq_port *req_mapped = NULL; ++ struct dwc_iso_pkt_desc_port *ipds = NULL; /* To be created in this function */ ++ uint32_t pkt_count; ++ int i; ++ ++ ereq = &req->ext_req; ++ req_mapped = (struct dwc_iso_xreq_port *)ereq_nonport; ++ pkt_count = req_mapped->pio_pkt_count; ++ ++ /* Create the isoc descs */ ++ if (atomic_alloc) { ++ ipds = DWC_ALLOC_ATOMIC(sizeof(*ipds) * pkt_count); ++ } else { ++ ipds = DWC_ALLOC(sizeof(*ipds) * pkt_count); ++ } ++ ++ if (!ipds) { ++ DWC_ERROR("Failed to allocate isoc descriptors"); ++ return -DWC_E_NO_MEMORY; ++ } ++ ++ /* Initialize the extended request fields */ ++ ereq->per_io_frame_descs = ipds; ++ ereq->error_count = 0; ++ ereq->pio_alloc_pkt_count = pkt_count; ++ ereq->pio_pkt_count = pkt_count; ++ ereq->tr_sub_flags = req_mapped->tr_sub_flags; ++ ++ /* Init the Isoc descriptors */ ++ for (i = 0; i < pkt_count; i++) { ++ ipds[i].length = req_mapped->per_io_frame_descs[i].length; ++ ipds[i].offset = req_mapped->per_io_frame_descs[i].offset; ++ ipds[i].status = req_mapped->per_io_frame_descs[i].status; /* 0 */ ++ ipds[i].actual_length = ++ req_mapped->per_io_frame_descs[i].actual_length; ++ } ++ ++ return 0; ++} ++ ++static void prn_ext_request(struct dwc_iso_xreq_port *ereq) ++{ ++ struct dwc_iso_pkt_desc_port *xfd = NULL; ++ int i; ++ ++ DWC_DEBUG("per_io_frame_descs=%p", ereq->per_io_frame_descs); ++ DWC_DEBUG("tr_sub_flags=%d", ereq->tr_sub_flags); ++ DWC_DEBUG("error_count=%d", ereq->error_count); ++ DWC_DEBUG("pio_alloc_pkt_count=%d", ereq->pio_alloc_pkt_count); ++ DWC_DEBUG("pio_pkt_count=%d", ereq->pio_pkt_count); ++ DWC_DEBUG("res=%d", ereq->res); ++ ++ for (i = 0; i < ereq->pio_pkt_count; i++) { ++ xfd = &ereq->per_io_frame_descs[0]; ++ DWC_DEBUG("FD #%d", i); ++ ++ DWC_DEBUG("xfd->actual_length=%d", xfd->actual_length); ++ DWC_DEBUG("xfd->length=%d", xfd->length); ++ DWC_DEBUG("xfd->offset=%d", xfd->offset); ++ DWC_DEBUG("xfd->status=%d", xfd->status); ++ } ++} ++ ++/** ++ * ++ */ ++int dwc_otg_pcd_xiso_ep_queue(dwc_otg_pcd_t * pcd, void *ep_handle, ++ uint8_t * buf, dwc_dma_t dma_buf, uint32_t buflen, ++ int zero, void *req_handle, int atomic_alloc, ++ void *ereq_nonport) ++{ ++ dwc_otg_pcd_request_t *req = NULL; ++ dwc_otg_pcd_ep_t *ep; ++ dwc_irqflags_t flags; ++ int res; ++ ++ ep = get_ep_from_handle(pcd, ep_handle); ++ if (!ep) { ++ DWC_WARN("bad ep\n"); ++ return -DWC_E_INVALID; ++ } ++ ++ /* We support this extension only for DDMA mode */ ++ if (ep->dwc_ep.type == DWC_OTG_EP_TYPE_ISOC) ++ if (!GET_CORE_IF(pcd)->dma_desc_enable) ++ return -DWC_E_INVALID; ++ ++ /* Create a dwc_otg_pcd_request_t object */ ++ if (atomic_alloc) { ++ req = DWC_ALLOC_ATOMIC(sizeof(*req)); ++ } else { ++ req = DWC_ALLOC(sizeof(*req)); ++ } ++ ++ if (!req) { ++ return -DWC_E_NO_MEMORY; ++ } ++ ++ /* Create the Isoc descs for this request which shall be the exact match ++ * of the structure sent to us from the non-portable logic */ ++ res = ++ dwc_otg_pcd_xiso_create_pkt_descs(req, ereq_nonport, atomic_alloc); ++ if (res) { ++ DWC_WARN("Failed to init the Isoc descriptors"); ++ DWC_FREE(req); ++ return res; ++ } ++ ++ DWC_SPINLOCK_IRQSAVE(pcd->lock, &flags); ++ ++ DWC_CIRCLEQ_INIT_ENTRY(req, queue_entry); ++ req->buf = buf; ++ req->dma = dma_buf; ++ req->length = buflen; ++ req->sent_zlp = zero; ++ req->priv = req_handle; ++ ++ //DWC_SPINLOCK_IRQSAVE(pcd->lock, &flags); ++ ep->dwc_ep.dma_addr = dma_buf; ++ ep->dwc_ep.start_xfer_buff = buf; ++ ep->dwc_ep.xfer_buff = buf; ++ ep->dwc_ep.xfer_len = 0; ++ ep->dwc_ep.xfer_count = 0; ++ ep->dwc_ep.sent_zlp = 0; ++ ep->dwc_ep.total_len = buflen; ++ ++ /* Add this request to the tail */ ++ DWC_CIRCLEQ_INSERT_TAIL(&ep->queue, req, queue_entry); ++ ep->dwc_ep.xiso_queued_xfers++; ++ ++//DWC_DEBUG("CP_0"); ++//DWC_DEBUG("req->ext_req.tr_sub_flags=%d", req->ext_req.tr_sub_flags); ++//prn_ext_request((struct dwc_iso_xreq_port *) ereq_nonport); ++//prn_ext_request(&req->ext_req); ++ ++ //DWC_SPINUNLOCK_IRQRESTORE(pcd->lock, flags); ++ ++ /* If the req->status == ASAP then check if there is any active transfer ++ * for this endpoint. If no active transfers, then get the first entry ++ * from the queue and start that transfer ++ */ ++ if (req->ext_req.tr_sub_flags == DWC_EREQ_TF_ASAP) { ++ res = dwc_otg_pcd_xiso_start_next_request(pcd, ep); ++ if (res) { ++ DWC_WARN("Failed to start the next Isoc transfer"); ++ DWC_SPINUNLOCK_IRQRESTORE(pcd->lock, flags); ++ DWC_FREE(req); ++ return res; ++ } ++ } ++ ++ DWC_SPINUNLOCK_IRQRESTORE(pcd->lock, flags); ++ return 0; ++} ++ ++#endif ++/* END ifdef DWC_UTE_PER_IO ***************************************************/ ++int dwc_otg_pcd_ep_queue(dwc_otg_pcd_t * pcd, void *ep_handle, ++ uint8_t * buf, dwc_dma_t dma_buf, uint32_t buflen, ++ int zero, void *req_handle, int atomic_alloc) ++{ ++ dwc_irqflags_t flags; ++ dwc_otg_pcd_request_t *req; ++ dwc_otg_pcd_ep_t *ep; ++ uint32_t max_transfer; ++ ++ ep = get_ep_from_handle(pcd, ep_handle); ++ if (!ep || (!ep->desc && ep->dwc_ep.num != 0)) { ++ DWC_WARN("bad ep\n"); ++ return -DWC_E_INVALID; ++ } ++ ++ if (atomic_alloc) { ++ req = DWC_ALLOC_ATOMIC(sizeof(*req)); ++ } else { ++ req = DWC_ALLOC(sizeof(*req)); ++ } ++ ++ if (!req) { ++ return -DWC_E_NO_MEMORY; ++ } ++ DWC_CIRCLEQ_INIT_ENTRY(req, queue_entry); ++ if (!GET_CORE_IF(pcd)->core_params->opt) { ++ if (ep->dwc_ep.num != 0) { ++ DWC_ERROR("queue req %p, len %d buf %p\n", ++ req_handle, buflen, buf); ++ } ++ } ++ ++ req->buf = buf; ++ req->dma = dma_buf; ++ req->length = buflen; ++ req->sent_zlp = zero; ++ req->priv = req_handle; ++ req->dw_align_buf = NULL; ++ if ((dma_buf & 0x3) && GET_CORE_IF(pcd)->dma_enable ++ && !GET_CORE_IF(pcd)->dma_desc_enable) ++ req->dw_align_buf = DWC_DMA_ALLOC(buflen, ++ &req->dw_align_buf_dma); ++ DWC_SPINLOCK_IRQSAVE(pcd->lock, &flags); ++ ++ /* ++ * After adding request to the queue for IN ISOC wait for In Token Received ++ * when TX FIFO is empty interrupt and for OUT ISOC wait for OUT Token ++ * Received when EP is disabled interrupt to obtain starting microframe ++ * (odd/even) start transfer ++ */ ++ if (ep->dwc_ep.type == DWC_OTG_EP_TYPE_ISOC) { ++ if (req != 0) { ++ depctl_data_t depctl = {.d32 = ++ DWC_READ_REG32(&pcd->core_if->dev_if-> ++ in_ep_regs[ep->dwc_ep.num]-> ++ diepctl) }; ++ ++pcd->request_pending; ++ ++ DWC_CIRCLEQ_INSERT_TAIL(&ep->queue, req, queue_entry); ++ if (ep->dwc_ep.is_in) { ++ depctl.b.cnak = 1; ++ DWC_WRITE_REG32(&pcd->core_if->dev_if-> ++ in_ep_regs[ep->dwc_ep.num]-> ++ diepctl, depctl.d32); ++ } ++ ++ DWC_SPINUNLOCK_IRQRESTORE(pcd->lock, flags); ++ } ++ return 0; ++ } ++ ++ /* ++ * For EP0 IN without premature status, zlp is required? ++ */ ++ if (ep->dwc_ep.num == 0 && ep->dwc_ep.is_in) { ++ DWC_DEBUGPL(DBG_PCDV, "%d-OUT ZLP\n", ep->dwc_ep.num); ++ //_req->zero = 1; ++ } ++ ++ /* Start the transfer */ ++ if (DWC_CIRCLEQ_EMPTY(&ep->queue) && !ep->stopped) { ++ /* EP0 Transfer? */ ++ if (ep->dwc_ep.num == 0) { ++ switch (pcd->ep0state) { ++ case EP0_IN_DATA_PHASE: ++ DWC_DEBUGPL(DBG_PCD, ++ "%s ep0: EP0_IN_DATA_PHASE\n", ++ __func__); ++ break; ++ ++ case EP0_OUT_DATA_PHASE: ++ DWC_DEBUGPL(DBG_PCD, ++ "%s ep0: EP0_OUT_DATA_PHASE\n", ++ __func__); ++ if (pcd->request_config) { ++ /* Complete STATUS PHASE */ ++ ep->dwc_ep.is_in = 1; ++ pcd->ep0state = EP0_IN_STATUS_PHASE; ++ } ++ break; ++ ++ case EP0_IN_STATUS_PHASE: ++ DWC_DEBUGPL(DBG_PCD, ++ "%s ep0: EP0_IN_STATUS_PHASE\n", ++ __func__); ++ break; ++ ++ default: ++ DWC_DEBUGPL(DBG_ANY, "ep0: odd state %d\n", ++ pcd->ep0state); ++ DWC_SPINUNLOCK_IRQRESTORE(pcd->lock, flags); ++ return -DWC_E_SHUTDOWN; ++ } ++ ++ ep->dwc_ep.dma_addr = dma_buf; ++ ep->dwc_ep.start_xfer_buff = buf; ++ ep->dwc_ep.xfer_buff = buf; ++ ep->dwc_ep.xfer_len = buflen; ++ ep->dwc_ep.xfer_count = 0; ++ ep->dwc_ep.sent_zlp = 0; ++ ep->dwc_ep.total_len = ep->dwc_ep.xfer_len; ++ ++ if (zero) { ++ if ((ep->dwc_ep.xfer_len % ++ ep->dwc_ep.maxpacket == 0) ++ && (ep->dwc_ep.xfer_len != 0)) { ++ ep->dwc_ep.sent_zlp = 1; ++ } ++ ++ } ++ ++ dwc_otg_ep0_start_transfer(GET_CORE_IF(pcd), ++ &ep->dwc_ep); ++ } // non-ep0 endpoints ++ else { ++#ifdef DWC_UTE_CFI ++ if (ep->dwc_ep.buff_mode != BM_STANDARD) { ++ /* store the request length */ ++ ep->dwc_ep.cfi_req_len = buflen; ++ pcd->cfi->ops.build_descriptors(pcd->cfi, pcd, ++ ep, req); ++ } else { ++#endif ++ max_transfer = ++ GET_CORE_IF(ep->pcd)->core_params-> ++ max_transfer_size; ++ ++ /* Setup and start the Transfer */ ++ if (req->dw_align_buf){ ++ if (ep->dwc_ep.is_in) ++ dwc_memcpy(req->dw_align_buf, ++ buf, buflen); ++ ep->dwc_ep.dma_addr = ++ req->dw_align_buf_dma; ++ ep->dwc_ep.start_xfer_buff = ++ req->dw_align_buf; ++ ep->dwc_ep.xfer_buff = ++ req->dw_align_buf; ++ } else { ++ ep->dwc_ep.dma_addr = dma_buf; ++ ep->dwc_ep.start_xfer_buff = buf; ++ ep->dwc_ep.xfer_buff = buf; ++ } ++ ep->dwc_ep.xfer_len = 0; ++ ep->dwc_ep.xfer_count = 0; ++ ep->dwc_ep.sent_zlp = 0; ++ ep->dwc_ep.total_len = buflen; ++ ++ ep->dwc_ep.maxxfer = max_transfer; ++ if (GET_CORE_IF(pcd)->dma_desc_enable) { ++ uint32_t out_max_xfer = ++ DDMA_MAX_TRANSFER_SIZE - ++ (DDMA_MAX_TRANSFER_SIZE % 4); ++ if (ep->dwc_ep.is_in) { ++ if (ep->dwc_ep.maxxfer > ++ DDMA_MAX_TRANSFER_SIZE) { ++ ep->dwc_ep.maxxfer = ++ DDMA_MAX_TRANSFER_SIZE; ++ } ++ } else { ++ if (ep->dwc_ep.maxxfer > ++ out_max_xfer) { ++ ep->dwc_ep.maxxfer = ++ out_max_xfer; ++ } ++ } ++ } ++ if (ep->dwc_ep.maxxfer < ep->dwc_ep.total_len) { ++ ep->dwc_ep.maxxfer -= ++ (ep->dwc_ep.maxxfer % ++ ep->dwc_ep.maxpacket); ++ } ++ ++ if (zero) { ++ if ((ep->dwc_ep.total_len % ++ ep->dwc_ep.maxpacket == 0) ++ && (ep->dwc_ep.total_len != 0)) { ++ ep->dwc_ep.sent_zlp = 1; ++ } ++ } ++#ifdef DWC_UTE_CFI ++ } ++#endif ++ dwc_otg_ep_start_transfer(GET_CORE_IF(pcd), ++ &ep->dwc_ep); ++ } ++ } ++ ++ if (req != 0) { ++ ++pcd->request_pending; ++ DWC_CIRCLEQ_INSERT_TAIL(&ep->queue, req, queue_entry); ++ if (ep->dwc_ep.is_in && ep->stopped ++ && !(GET_CORE_IF(pcd)->dma_enable)) { ++ /** @todo NGS Create a function for this. */ ++ diepmsk_data_t diepmsk = {.d32 = 0 }; ++ diepmsk.b.intktxfemp = 1; ++ if (GET_CORE_IF(pcd)->multiproc_int_enable) { ++ DWC_MODIFY_REG32(&GET_CORE_IF(pcd)-> ++ dev_if->dev_global_regs->diepeachintmsk ++ [ep->dwc_ep.num], 0, ++ diepmsk.d32); ++ } else { ++ DWC_MODIFY_REG32(&GET_CORE_IF(pcd)-> ++ dev_if->dev_global_regs-> ++ diepmsk, 0, diepmsk.d32); ++ } ++ ++ } ++ } ++ DWC_SPINUNLOCK_IRQRESTORE(pcd->lock, flags); ++ ++ return 0; ++} ++ ++int dwc_otg_pcd_ep_dequeue(dwc_otg_pcd_t * pcd, void *ep_handle, ++ void *req_handle) ++{ ++ dwc_irqflags_t flags; ++ dwc_otg_pcd_request_t *req; ++ dwc_otg_pcd_ep_t *ep; ++ ++ ep = get_ep_from_handle(pcd, ep_handle); ++ if (!ep || (!ep->desc && ep->dwc_ep.num != 0)) { ++ DWC_WARN("bad argument\n"); ++ return -DWC_E_INVALID; ++ } ++ ++ DWC_SPINLOCK_IRQSAVE(pcd->lock, &flags); ++ ++ /* make sure it's actually queued on this endpoint */ ++ DWC_CIRCLEQ_FOREACH(req, &ep->queue, queue_entry) { ++ if (req->priv == (void *)req_handle) { ++ break; ++ } ++ } ++ ++ if (req->priv != (void *)req_handle) { ++ DWC_SPINUNLOCK_IRQRESTORE(pcd->lock, flags); ++ return -DWC_E_INVALID; ++ } ++ ++ if (!DWC_CIRCLEQ_EMPTY_ENTRY(req, queue_entry)) { ++ dwc_otg_request_done(ep, req, -DWC_E_RESTART); ++ } else { ++ req = NULL; ++ } ++ ++ DWC_SPINUNLOCK_IRQRESTORE(pcd->lock, flags); ++ ++ return req ? 0 : -DWC_E_SHUTDOWN; ++ ++} ++ ++/** ++ * dwc_otg_pcd_ep_wedge - sets the halt feature and ignores clear requests ++ * ++ * Use this to stall an endpoint and ignore CLEAR_FEATURE(HALT_ENDPOINT) ++ * requests. If the gadget driver clears the halt status, it will ++ * automatically unwedge the endpoint. ++ * ++ * Returns zero on success, else negative DWC error code. ++ */ ++int dwc_otg_pcd_ep_wedge(dwc_otg_pcd_t * pcd, void *ep_handle) ++{ ++ dwc_otg_pcd_ep_t *ep; ++ dwc_irqflags_t flags; ++ int retval = 0; ++ ++ ep = get_ep_from_handle(pcd, ep_handle); ++ ++ if ((!ep->desc && ep != &pcd->ep0) || ++ (ep->desc && (ep->desc->bmAttributes == UE_ISOCHRONOUS))) { ++ DWC_WARN("%s, bad ep\n", __func__); ++ return -DWC_E_INVALID; ++ } ++ ++ DWC_SPINLOCK_IRQSAVE(pcd->lock, &flags); ++ if (!DWC_CIRCLEQ_EMPTY(&ep->queue)) { ++ DWC_WARN("%d %s XFer In process\n", ep->dwc_ep.num, ++ ep->dwc_ep.is_in ? "IN" : "OUT"); ++ retval = -DWC_E_AGAIN; ++ } else { ++ /* This code needs to be reviewed */ ++ if (ep->dwc_ep.is_in == 1 && GET_CORE_IF(pcd)->dma_desc_enable) { ++ dtxfsts_data_t txstatus; ++ fifosize_data_t txfifosize; ++ ++ txfifosize.d32 = ++ DWC_READ_REG32(&GET_CORE_IF(pcd)-> ++ core_global_regs->dtxfsiz[ep->dwc_ep. ++ tx_fifo_num]); ++ txstatus.d32 = ++ DWC_READ_REG32(&GET_CORE_IF(pcd)-> ++ dev_if->in_ep_regs[ep->dwc_ep.num]-> ++ dtxfsts); ++ ++ if (txstatus.b.txfspcavail < txfifosize.b.depth) { ++ DWC_WARN("%s() Data In Tx Fifo\n", __func__); ++ retval = -DWC_E_AGAIN; ++ } else { ++ if (ep->dwc_ep.num == 0) { ++ pcd->ep0state = EP0_STALL; ++ } ++ ++ ep->stopped = 1; ++ dwc_otg_ep_set_stall(GET_CORE_IF(pcd), ++ &ep->dwc_ep); ++ } ++ } else { ++ if (ep->dwc_ep.num == 0) { ++ pcd->ep0state = EP0_STALL; ++ } ++ ++ ep->stopped = 1; ++ dwc_otg_ep_set_stall(GET_CORE_IF(pcd), &ep->dwc_ep); ++ } ++ } ++ ++ DWC_SPINUNLOCK_IRQRESTORE(pcd->lock, flags); ++ ++ return retval; ++} ++ ++int dwc_otg_pcd_ep_halt(dwc_otg_pcd_t * pcd, void *ep_handle, int value) ++{ ++ dwc_otg_pcd_ep_t *ep; ++ dwc_irqflags_t flags; ++ int retval = 0; ++ ++ ep = get_ep_from_handle(pcd, ep_handle); ++ ++ if (!ep || (!ep->desc && ep != &pcd->ep0) || ++ (ep->desc && (ep->desc->bmAttributes == UE_ISOCHRONOUS))) { ++ DWC_WARN("%s, bad ep\n", __func__); ++ return -DWC_E_INVALID; ++ } ++ ++ DWC_SPINLOCK_IRQSAVE(pcd->lock, &flags); ++ if (!DWC_CIRCLEQ_EMPTY(&ep->queue)) { ++ DWC_WARN("%d %s XFer In process\n", ep->dwc_ep.num, ++ ep->dwc_ep.is_in ? "IN" : "OUT"); ++ retval = -DWC_E_AGAIN; ++ } else if (value == 0) { ++ dwc_otg_ep_clear_stall(GET_CORE_IF(pcd), &ep->dwc_ep); ++ } else if (value == 1) { ++ if (ep->dwc_ep.is_in == 1 && GET_CORE_IF(pcd)->dma_desc_enable) { ++ dtxfsts_data_t txstatus; ++ fifosize_data_t txfifosize; ++ ++ txfifosize.d32 = ++ DWC_READ_REG32(&GET_CORE_IF(pcd)->core_global_regs-> ++ dtxfsiz[ep->dwc_ep.tx_fifo_num]); ++ txstatus.d32 = ++ DWC_READ_REG32(&GET_CORE_IF(pcd)->dev_if-> ++ in_ep_regs[ep->dwc_ep.num]->dtxfsts); ++ ++ if (txstatus.b.txfspcavail < txfifosize.b.depth) { ++ DWC_WARN("%s() Data In Tx Fifo\n", __func__); ++ retval = -DWC_E_AGAIN; ++ } else { ++ if (ep->dwc_ep.num == 0) { ++ pcd->ep0state = EP0_STALL; ++ } ++ ++ ep->stopped = 1; ++ dwc_otg_ep_set_stall(GET_CORE_IF(pcd), ++ &ep->dwc_ep); ++ } ++ } else { ++ if (ep->dwc_ep.num == 0) { ++ pcd->ep0state = EP0_STALL; ++ } ++ ++ ep->stopped = 1; ++ dwc_otg_ep_set_stall(GET_CORE_IF(pcd), &ep->dwc_ep); ++ } ++ } else if (value == 2) { ++ ep->dwc_ep.stall_clear_flag = 0; ++ } else if (value == 3) { ++ ep->dwc_ep.stall_clear_flag = 1; ++ } ++ ++ DWC_SPINUNLOCK_IRQRESTORE(pcd->lock, flags); ++ ++ return retval; ++} ++ ++/** ++ * This function initiates remote wakeup of the host from suspend state. ++ */ ++void dwc_otg_pcd_rem_wkup_from_suspend(dwc_otg_pcd_t * pcd, int set) ++{ ++ dctl_data_t dctl = { 0 }; ++ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); ++ dsts_data_t dsts; ++ ++ dsts.d32 = DWC_READ_REG32(&core_if->dev_if->dev_global_regs->dsts); ++ if (!dsts.b.suspsts) { ++ DWC_WARN("Remote wakeup while is not in suspend state\n"); ++ } ++ /* Check if DEVICE_REMOTE_WAKEUP feature enabled */ ++ if (pcd->remote_wakeup_enable) { ++ if (set) { ++ ++ if (core_if->adp_enable) { ++ gpwrdn_data_t gpwrdn; ++ ++ dwc_otg_adp_probe_stop(core_if); ++ ++ /* Mask SRP detected interrupt from Power Down Logic */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.srp_det_msk = 1; ++ DWC_MODIFY_REG32(&core_if-> ++ core_global_regs->gpwrdn, ++ gpwrdn.d32, 0); ++ ++ /* Disable Power Down Logic */ ++ gpwrdn.d32 = 0; ++ gpwrdn.b.pmuactv = 1; ++ DWC_MODIFY_REG32(&core_if-> ++ core_global_regs->gpwrdn, ++ gpwrdn.d32, 0); ++ ++ /* ++ * Initialize the Core for Device mode. ++ */ ++ core_if->op_state = B_PERIPHERAL; ++ dwc_otg_core_init(core_if); ++ dwc_otg_enable_global_interrupts(core_if); ++ cil_pcd_start(core_if); ++ ++ dwc_otg_initiate_srp(core_if); ++ } ++ ++ dctl.b.rmtwkupsig = 1; ++ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs-> ++ dctl, 0, dctl.d32); ++ DWC_DEBUGPL(DBG_PCD, "Set Remote Wakeup\n"); ++ ++ dwc_mdelay(2); ++ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs-> ++ dctl, dctl.d32, 0); ++ DWC_DEBUGPL(DBG_PCD, "Clear Remote Wakeup\n"); ++ } ++ } else { ++ DWC_DEBUGPL(DBG_PCD, "Remote Wakeup is disabled\n"); ++ } ++} ++ ++#ifdef CONFIG_USB_DWC_OTG_LPM ++/** ++ * This function initiates remote wakeup of the host from L1 sleep state. ++ */ ++void dwc_otg_pcd_rem_wkup_from_sleep(dwc_otg_pcd_t * pcd, int set) ++{ ++ glpmcfg_data_t lpmcfg; ++ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); ++ ++ lpmcfg.d32 = DWC_READ_REG32(&core_if->core_global_regs->glpmcfg); ++ ++ /* Check if we are in L1 state */ ++ if (!lpmcfg.b.prt_sleep_sts) { ++ DWC_DEBUGPL(DBG_PCD, "Device is not in sleep state\n"); ++ return; ++ } ++ ++ /* Check if host allows remote wakeup */ ++ if (!lpmcfg.b.rem_wkup_en) { ++ DWC_DEBUGPL(DBG_PCD, "Host does not allow remote wakeup\n"); ++ return; ++ } ++ ++ /* Check if Resume OK */ ++ if (!lpmcfg.b.sleep_state_resumeok) { ++ DWC_DEBUGPL(DBG_PCD, "Sleep state resume is not OK\n"); ++ return; ++ } ++ ++ lpmcfg.d32 = DWC_READ_REG32(&core_if->core_global_regs->glpmcfg); ++ lpmcfg.b.en_utmi_sleep = 0; ++ lpmcfg.b.hird_thres &= (~(1 << 4)); ++ DWC_WRITE_REG32(&core_if->core_global_regs->glpmcfg, lpmcfg.d32); ++ ++ if (set) { ++ dctl_data_t dctl = {.d32 = 0 }; ++ dctl.b.rmtwkupsig = 1; ++ /* Set RmtWkUpSig bit to start remote wakup signaling. ++ * Hardware will automatically clear this bit. ++ */ ++ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs->dctl, ++ 0, dctl.d32); ++ DWC_DEBUGPL(DBG_PCD, "Set Remote Wakeup\n"); ++ } ++ ++} ++#endif ++ ++/** ++ * Performs remote wakeup. ++ */ ++void dwc_otg_pcd_remote_wakeup(dwc_otg_pcd_t * pcd, int set) ++{ ++ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); ++ dwc_irqflags_t flags; ++ if (dwc_otg_is_device_mode(core_if)) { ++ DWC_SPINLOCK_IRQSAVE(pcd->lock, &flags); ++#ifdef CONFIG_USB_DWC_OTG_LPM ++ if (core_if->lx_state == DWC_OTG_L1) { ++ dwc_otg_pcd_rem_wkup_from_sleep(pcd, set); ++ } else { ++#endif ++ dwc_otg_pcd_rem_wkup_from_suspend(pcd, set); ++#ifdef CONFIG_USB_DWC_OTG_LPM ++ } ++#endif ++ DWC_SPINUNLOCK_IRQRESTORE(pcd->lock, flags); ++ } ++ return; ++} ++ ++void dwc_otg_pcd_disconnect_us(dwc_otg_pcd_t * pcd, int no_of_usecs) ++{ ++ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); ++ dctl_data_t dctl = { 0 }; ++ ++ if (dwc_otg_is_device_mode(core_if)) { ++ dctl.b.sftdiscon = 1; ++ DWC_PRINTF("Soft disconnect for %d useconds\n",no_of_usecs); ++ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs->dctl, 0, dctl.d32); ++ dwc_udelay(no_of_usecs); ++ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs->dctl, dctl.d32,0); ++ ++ } else{ ++ DWC_PRINTF("NOT SUPPORTED IN HOST MODE\n"); ++ } ++ return; ++ ++} ++ ++int dwc_otg_pcd_wakeup(dwc_otg_pcd_t * pcd) ++{ ++ dsts_data_t dsts; ++ gotgctl_data_t gotgctl; ++ ++ /* ++ * This function starts the Protocol if no session is in progress. If ++ * a session is already in progress, but the device is suspended, ++ * remote wakeup signaling is started. ++ */ ++ ++ /* Check if valid session */ ++ gotgctl.d32 = ++ DWC_READ_REG32(&(GET_CORE_IF(pcd)->core_global_regs->gotgctl)); ++ if (gotgctl.b.bsesvld) { ++ /* Check if suspend state */ ++ dsts.d32 = ++ DWC_READ_REG32(& ++ (GET_CORE_IF(pcd)->dev_if-> ++ dev_global_regs->dsts)); ++ if (dsts.b.suspsts) { ++ dwc_otg_pcd_remote_wakeup(pcd, 1); ++ } ++ } else { ++ dwc_otg_pcd_initiate_srp(pcd); ++ } ++ ++ return 0; ++ ++} ++ ++/** ++ * Start the SRP timer to detect when the SRP does not complete within ++ * 6 seconds. ++ * ++ * @param pcd the pcd structure. ++ */ ++void dwc_otg_pcd_initiate_srp(dwc_otg_pcd_t * pcd) ++{ ++ dwc_irqflags_t flags; ++ DWC_SPINLOCK_IRQSAVE(pcd->lock, &flags); ++ dwc_otg_initiate_srp(GET_CORE_IF(pcd)); ++ DWC_SPINUNLOCK_IRQRESTORE(pcd->lock, flags); ++} ++ ++int dwc_otg_pcd_get_frame_number(dwc_otg_pcd_t * pcd) ++{ ++ return dwc_otg_get_frame_number(GET_CORE_IF(pcd)); ++} ++ ++int dwc_otg_pcd_is_lpm_enabled(dwc_otg_pcd_t * pcd) ++{ ++ return GET_CORE_IF(pcd)->core_params->lpm_enable; ++} ++ ++uint32_t get_b_hnp_enable(dwc_otg_pcd_t * pcd) ++{ ++ return pcd->b_hnp_enable; ++} ++ ++uint32_t get_a_hnp_support(dwc_otg_pcd_t * pcd) ++{ ++ return pcd->a_hnp_support; ++} ++ ++uint32_t get_a_alt_hnp_support(dwc_otg_pcd_t * pcd) ++{ ++ return pcd->a_alt_hnp_support; ++} ++ ++int dwc_otg_pcd_get_rmwkup_enable(dwc_otg_pcd_t * pcd) ++{ ++ return pcd->remote_wakeup_enable; ++} ++ ++#endif /* DWC_HOST_ONLY */ +diff --git a/drivers/usb/host/dwc_otg/dwc_otg_pcd.h b/drivers/usb/host/dwc_otg/dwc_otg_pcd.h +new file mode 100644 +index 0000000..8ef7ba6 +--- /dev/null ++++ b/drivers/usb/host/dwc_otg/dwc_otg_pcd.h +@@ -0,0 +1,266 @@ ++/* ========================================================================== ++ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_pcd.h $ ++ * $Revision: #48 $ ++ * $Date: 2012/08/10 $ ++ * $Change: 2047372 $ ++ * ++ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, ++ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless ++ * otherwise expressly agreed to in writing between Synopsys and you. ++ * ++ * The Software IS NOT an item of Licensed Software or Licensed Product under ++ * any End User Software License Agreement or Agreement for Licensed Product ++ * with Synopsys or any supplement thereto. You are permitted to use and ++ * redistribute this Software in source and binary forms, with or without ++ * modification, provided that redistributions of source code must retain this ++ * notice. You may not view, use, disclose, copy or distribute this file or ++ * any information contained herein except pursuant to this license grant from ++ * Synopsys. If you do not agree with this notice, including the disclaimer ++ * below, then you are not authorized to use the Software. ++ * ++ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS ++ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS 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. ++ * ========================================================================== */ ++#ifndef DWC_HOST_ONLY ++#if !defined(__DWC_PCD_H__) ++#define __DWC_PCD_H__ ++ ++#include "dwc_otg_os_dep.h" ++#include "usb.h" ++#include "dwc_otg_cil.h" ++#include "dwc_otg_pcd_if.h" ++struct cfiobject; ++ ++/** ++ * @file ++ * ++ * This file contains the structures, constants, and interfaces for ++ * the Perpherial Contoller Driver (PCD). ++ * ++ * The Peripheral Controller Driver (PCD) for Linux will implement the ++ * Gadget API, so that the existing Gadget drivers can be used. For ++ * the Mass Storage Function driver the File-backed USB Storage Gadget ++ * (FBS) driver will be used. The FBS driver supports the ++ * Control-Bulk (CB), Control-Bulk-Interrupt (CBI), and Bulk-Only ++ * transports. ++ * ++ */ ++ ++/** Invalid DMA Address */ ++#define DWC_DMA_ADDR_INVALID (~(dwc_dma_t)0) ++ ++/** Max Transfer size for any EP */ ++#define DDMA_MAX_TRANSFER_SIZE 65535 ++ ++/** ++ * Get the pointer to the core_if from the pcd pointer. ++ */ ++#define GET_CORE_IF( _pcd ) (_pcd->core_if) ++ ++/** ++ * States of EP0. ++ */ ++typedef enum ep0_state { ++ EP0_DISCONNECT, /* no host */ ++ EP0_IDLE, ++ EP0_IN_DATA_PHASE, ++ EP0_OUT_DATA_PHASE, ++ EP0_IN_STATUS_PHASE, ++ EP0_OUT_STATUS_PHASE, ++ EP0_STALL, ++} ep0state_e; ++ ++/** Fordward declaration.*/ ++struct dwc_otg_pcd; ++ ++/** DWC_otg iso request structure. ++ * ++ */ ++typedef struct usb_iso_request dwc_otg_pcd_iso_request_t; ++ ++#ifdef DWC_UTE_PER_IO ++ ++/** ++ * This shall be the exact analogy of the same type structure defined in the ++ * usb_gadget.h. Each descriptor contains ++ */ ++struct dwc_iso_pkt_desc_port { ++ uint32_t offset; ++ uint32_t length; /* expected length */ ++ uint32_t actual_length; ++ uint32_t status; ++}; ++ ++struct dwc_iso_xreq_port { ++ /** transfer/submission flag */ ++ uint32_t tr_sub_flags; ++ /** Start the request ASAP */ ++#define DWC_EREQ_TF_ASAP 0x00000002 ++ /** Just enqueue the request w/o initiating a transfer */ ++#define DWC_EREQ_TF_ENQUEUE 0x00000004 ++ ++ /** ++ * count of ISO packets attached to this request - shall ++ * not exceed the pio_alloc_pkt_count ++ */ ++ uint32_t pio_pkt_count; ++ /** count of ISO packets allocated for this request */ ++ uint32_t pio_alloc_pkt_count; ++ /** number of ISO packet errors */ ++ uint32_t error_count; ++ /** reserved for future extension */ ++ uint32_t res; ++ /** Will be allocated and freed in the UTE gadget and based on the CFC value */ ++ struct dwc_iso_pkt_desc_port *per_io_frame_descs; ++}; ++#endif ++/** DWC_otg request structure. ++ * This structure is a list of requests. ++ */ ++typedef struct dwc_otg_pcd_request { ++ void *priv; ++ void *buf; ++ dwc_dma_t dma; ++ uint32_t length; ++ uint32_t actual; ++ unsigned sent_zlp:1; ++ /** ++ * Used instead of original buffer if ++ * it(physical address) is not dword-aligned. ++ **/ ++ uint8_t *dw_align_buf; ++ dwc_dma_t dw_align_buf_dma; ++ ++ DWC_CIRCLEQ_ENTRY(dwc_otg_pcd_request) queue_entry; ++#ifdef DWC_UTE_PER_IO ++ struct dwc_iso_xreq_port ext_req; ++ //void *priv_ereq_nport; /* */ ++#endif ++} dwc_otg_pcd_request_t; ++ ++DWC_CIRCLEQ_HEAD(req_list, dwc_otg_pcd_request); ++ ++/** PCD EP structure. ++ * This structure describes an EP, there is an array of EPs in the PCD ++ * structure. ++ */ ++typedef struct dwc_otg_pcd_ep { ++ /** USB EP Descriptor */ ++ const usb_endpoint_descriptor_t *desc; ++ ++ /** queue of dwc_otg_pcd_requests. */ ++ struct req_list queue; ++ unsigned stopped:1; ++ unsigned disabling:1; ++ unsigned dma:1; ++ unsigned queue_sof:1; ++ ++#ifdef DWC_EN_ISOC ++ /** ISOC req handle passed */ ++ void *iso_req_handle; ++#endif //_EN_ISOC_ ++ ++ /** DWC_otg ep data. */ ++ dwc_ep_t dwc_ep; ++ ++ /** Pointer to PCD */ ++ struct dwc_otg_pcd *pcd; ++ ++ void *priv; ++} dwc_otg_pcd_ep_t; ++ ++/** DWC_otg PCD Structure. ++ * This structure encapsulates the data for the dwc_otg PCD. ++ */ ++struct dwc_otg_pcd { ++ const struct dwc_otg_pcd_function_ops *fops; ++ /** The DWC otg device pointer */ ++ struct dwc_otg_device *otg_dev; ++ /** Core Interface */ ++ dwc_otg_core_if_t *core_if; ++ /** State of EP0 */ ++ ep0state_e ep0state; ++ /** EP0 Request is pending */ ++ unsigned ep0_pending:1; ++ /** Indicates when SET CONFIGURATION Request is in process */ ++ unsigned request_config:1; ++ /** The state of the Remote Wakeup Enable. */ ++ unsigned remote_wakeup_enable:1; ++ /** The state of the B-Device HNP Enable. */ ++ unsigned b_hnp_enable:1; ++ /** The state of A-Device HNP Support. */ ++ unsigned a_hnp_support:1; ++ /** The state of the A-Device Alt HNP support. */ ++ unsigned a_alt_hnp_support:1; ++ /** Count of pending Requests */ ++ unsigned request_pending; ++ ++ /** SETUP packet for EP0 ++ * This structure is allocated as a DMA buffer on PCD initialization ++ * with enough space for up to 3 setup packets. ++ */ ++ union { ++ usb_device_request_t req; ++ uint32_t d32[2]; ++ } *setup_pkt; ++ ++ dwc_dma_t setup_pkt_dma_handle; ++ ++ /* Additional buffer and flag for CTRL_WR premature case */ ++ uint8_t *backup_buf; ++ unsigned data_terminated; ++ ++ /** 2-byte dma buffer used to return status from GET_STATUS */ ++ uint16_t *status_buf; ++ dwc_dma_t status_buf_dma_handle; ++ ++ /** EP0 */ ++ dwc_otg_pcd_ep_t ep0; ++ ++ /** Array of IN EPs. */ ++ dwc_otg_pcd_ep_t in_ep[MAX_EPS_CHANNELS - 1]; ++ /** Array of OUT EPs. */ ++ dwc_otg_pcd_ep_t out_ep[MAX_EPS_CHANNELS - 1]; ++ /** number of valid EPs in the above array. */ ++// unsigned num_eps : 4; ++ dwc_spinlock_t *lock; ++ ++ /** Tasklet to defer starting of TEST mode transmissions until ++ * Status Phase has been completed. ++ */ ++ dwc_tasklet_t *test_mode_tasklet; ++ ++ /** Tasklet to delay starting of xfer in DMA mode */ ++ dwc_tasklet_t *start_xfer_tasklet; ++ ++ /** The test mode to enter when the tasklet is executed. */ ++ unsigned test_mode; ++ /** The cfi_api structure that implements most of the CFI API ++ * and OTG specific core configuration functionality ++ */ ++#ifdef DWC_UTE_CFI ++ struct cfiobject *cfi; ++#endif ++ ++}; ++ ++//FIXME this functions should be static, and this prototypes should be removed ++extern void dwc_otg_request_nuke(dwc_otg_pcd_ep_t * ep); ++extern void dwc_otg_request_done(dwc_otg_pcd_ep_t * ep, ++ dwc_otg_pcd_request_t * req, int32_t status); ++ ++void dwc_otg_iso_buffer_done(dwc_otg_pcd_t * pcd, dwc_otg_pcd_ep_t * ep, ++ void *req_handle); ++ ++extern void do_test_mode(void *data); ++#endif ++#endif /* DWC_HOST_ONLY */ +diff --git a/drivers/usb/host/dwc_otg/dwc_otg_pcd_if.h b/drivers/usb/host/dwc_otg/dwc_otg_pcd_if.h +new file mode 100644 +index 0000000..c8d2e0e +--- /dev/null ++++ b/drivers/usb/host/dwc_otg/dwc_otg_pcd_if.h +@@ -0,0 +1,360 @@ ++/* ========================================================================== ++ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_pcd_if.h $ ++ * $Revision: #11 $ ++ * $Date: 2011/10/26 $ ++ * $Change: 1873028 $ ++ * ++ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, ++ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless ++ * otherwise expressly agreed to in writing between Synopsys and you. ++ * ++ * The Software IS NOT an item of Licensed Software or Licensed Product under ++ * any End User Software License Agreement or Agreement for Licensed Product ++ * with Synopsys or any supplement thereto. You are permitted to use and ++ * redistribute this Software in source and binary forms, with or without ++ * modification, provided that redistributions of source code must retain this ++ * notice. You may not view, use, disclose, copy or distribute this file or ++ * any information contained herein except pursuant to this license grant from ++ * Synopsys. If you do not agree with this notice, including the disclaimer ++ * below, then you are not authorized to use the Software. ++ * ++ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS ++ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS 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. ++ * ========================================================================== */ ++#ifndef DWC_HOST_ONLY ++ ++#if !defined(__DWC_PCD_IF_H__) ++#define __DWC_PCD_IF_H__ ++ ++//#include "dwc_os.h" ++#include "dwc_otg_core_if.h" ++ ++/** @file ++ * This file defines DWC_OTG PCD Core API. ++ */ ++ ++struct dwc_otg_pcd; ++typedef struct dwc_otg_pcd dwc_otg_pcd_t; ++ ++/** Maxpacket size for EP0 */ ++#define MAX_EP0_SIZE 64 ++/** Maxpacket size for any EP */ ++#define MAX_PACKET_SIZE 1024 ++ ++/** @name Function Driver Callbacks */ ++/** @{ */ ++ ++/** This function will be called whenever a previously queued request has ++ * completed. The status value will be set to -DWC_E_SHUTDOWN to indicated a ++ * failed or aborted transfer, or -DWC_E_RESTART to indicate the device was reset, ++ * or -DWC_E_TIMEOUT to indicate it timed out, or -DWC_E_INVALID to indicate invalid ++ * parameters. */ ++typedef int (*dwc_completion_cb_t) (dwc_otg_pcd_t * pcd, void *ep_handle, ++ void *req_handle, int32_t status, ++ uint32_t actual); ++/** ++ * This function will be called whenever a previousle queued ISOC request has ++ * completed. Count of ISOC packets could be read using dwc_otg_pcd_get_iso_packet_count ++ * function. ++ * The status of each ISOC packet could be read using dwc_otg_pcd_get_iso_packet_* ++ * functions. ++ */ ++typedef int (*dwc_isoc_completion_cb_t) (dwc_otg_pcd_t * pcd, void *ep_handle, ++ void *req_handle, int proc_buf_num); ++/** This function should handle any SETUP request that cannot be handled by the ++ * PCD Core. This includes most GET_DESCRIPTORs, SET_CONFIGS, Any ++ * class-specific requests, etc. The function must non-blocking. ++ * ++ * Returns 0 on success. ++ * Returns -DWC_E_NOT_SUPPORTED if the request is not supported. ++ * Returns -DWC_E_INVALID if the setup request had invalid parameters or bytes. ++ * Returns -DWC_E_SHUTDOWN on any other error. */ ++typedef int (*dwc_setup_cb_t) (dwc_otg_pcd_t * pcd, uint8_t * bytes); ++/** This is called whenever the device has been disconnected. The function ++ * driver should take appropriate action to clean up all pending requests in the ++ * PCD Core, remove all endpoints (except ep0), and initialize back to reset ++ * state. */ ++typedef int (*dwc_disconnect_cb_t) (dwc_otg_pcd_t * pcd); ++/** This function is called when device has been connected. */ ++typedef int (*dwc_connect_cb_t) (dwc_otg_pcd_t * pcd, int speed); ++/** This function is called when device has been suspended */ ++typedef int (*dwc_suspend_cb_t) (dwc_otg_pcd_t * pcd); ++/** This function is called when device has received LPM tokens, i.e. ++ * device has been sent to sleep state. */ ++typedef int (*dwc_sleep_cb_t) (dwc_otg_pcd_t * pcd); ++/** This function is called when device has been resumed ++ * from suspend(L2) or L1 sleep state. */ ++typedef int (*dwc_resume_cb_t) (dwc_otg_pcd_t * pcd); ++/** This function is called whenever hnp params has been changed. ++ * User can call get_b_hnp_enable, get_a_hnp_support, get_a_alt_hnp_support functions ++ * to get hnp parameters. */ ++typedef int (*dwc_hnp_params_changed_cb_t) (dwc_otg_pcd_t * pcd); ++/** This function is called whenever USB RESET is detected. */ ++typedef int (*dwc_reset_cb_t) (dwc_otg_pcd_t * pcd); ++ ++typedef int (*cfi_setup_cb_t) (dwc_otg_pcd_t * pcd, void *ctrl_req_bytes); ++ ++/** ++ * ++ * @param ep_handle Void pointer to the usb_ep structure ++ * @param ereq_port Pointer to the extended request structure created in the ++ * portable part. ++ */ ++typedef int (*xiso_completion_cb_t) (dwc_otg_pcd_t * pcd, void *ep_handle, ++ void *req_handle, int32_t status, ++ void *ereq_port); ++/** Function Driver Ops Data Structure */ ++struct dwc_otg_pcd_function_ops { ++ dwc_connect_cb_t connect; ++ dwc_disconnect_cb_t disconnect; ++ dwc_setup_cb_t setup; ++ dwc_completion_cb_t complete; ++ dwc_isoc_completion_cb_t isoc_complete; ++ dwc_suspend_cb_t suspend; ++ dwc_sleep_cb_t sleep; ++ dwc_resume_cb_t resume; ++ dwc_reset_cb_t reset; ++ dwc_hnp_params_changed_cb_t hnp_changed; ++ cfi_setup_cb_t cfi_setup; ++#ifdef DWC_UTE_PER_IO ++ xiso_completion_cb_t xisoc_complete; ++#endif ++}; ++/** @} */ ++ ++/** @name Function Driver Functions */ ++/** @{ */ ++ ++/** Call this function to get pointer on dwc_otg_pcd_t, ++ * this pointer will be used for all PCD API functions. ++ * ++ * @param core_if The DWC_OTG Core ++ */ ++extern dwc_otg_pcd_t *dwc_otg_pcd_init(dwc_otg_core_if_t * core_if); ++ ++/** Frees PCD allocated by dwc_otg_pcd_init ++ * ++ * @param pcd The PCD ++ */ ++extern void dwc_otg_pcd_remove(dwc_otg_pcd_t * pcd); ++ ++/** Call this to bind the function driver to the PCD Core. ++ * ++ * @param pcd Pointer on dwc_otg_pcd_t returned by dwc_otg_pcd_init function. ++ * @param fops The Function Driver Ops data structure containing pointers to all callbacks. ++ */ ++extern void dwc_otg_pcd_start(dwc_otg_pcd_t * pcd, ++ const struct dwc_otg_pcd_function_ops *fops); ++ ++/** Enables an endpoint for use. This function enables an endpoint in ++ * the PCD. The endpoint is described by the ep_desc which has the ++ * same format as a USB ep descriptor. The ep_handle parameter is used to refer ++ * to the endpoint from other API functions and in callbacks. Normally this ++ * should be called after a SET_CONFIGURATION/SET_INTERFACE to configure the ++ * core for that interface. ++ * ++ * Returns -DWC_E_INVALID if invalid parameters were passed. ++ * Returns -DWC_E_SHUTDOWN if any other error ocurred. ++ * Returns 0 on success. ++ * ++ * @param pcd The PCD ++ * @param ep_desc Endpoint descriptor ++ * @param usb_ep Handle on endpoint, that will be used to identify endpoint. ++ */ ++extern int dwc_otg_pcd_ep_enable(dwc_otg_pcd_t * pcd, ++ const uint8_t * ep_desc, void *usb_ep); ++ ++/** Disable the endpoint referenced by ep_handle. ++ * ++ * Returns -DWC_E_INVALID if invalid parameters were passed. ++ * Returns -DWC_E_SHUTDOWN if any other error occurred. ++ * Returns 0 on success. */ ++extern int dwc_otg_pcd_ep_disable(dwc_otg_pcd_t * pcd, void *ep_handle); ++ ++/** Queue a data transfer request on the endpoint referenced by ep_handle. ++ * After the transfer is completes, the complete callback will be called with ++ * the request status. ++ * ++ * @param pcd The PCD ++ * @param ep_handle The handle of the endpoint ++ * @param buf The buffer for the data ++ * @param dma_buf The DMA buffer for the data ++ * @param buflen The length of the data transfer ++ * @param zero Specifies whether to send zero length last packet. ++ * @param req_handle Set this handle to any value to use to reference this ++ * request in the ep_dequeue function or from the complete callback ++ * @param atomic_alloc If driver need to perform atomic allocations ++ * for internal data structures. ++ * ++ * Returns -DWC_E_INVALID if invalid parameters were passed. ++ * Returns -DWC_E_SHUTDOWN if any other error ocurred. ++ * Returns 0 on success. */ ++extern int dwc_otg_pcd_ep_queue(dwc_otg_pcd_t * pcd, void *ep_handle, ++ uint8_t * buf, dwc_dma_t dma_buf, ++ uint32_t buflen, int zero, void *req_handle, ++ int atomic_alloc); ++#ifdef DWC_UTE_PER_IO ++/** ++ * ++ * @param ereq_nonport Pointer to the extended request part of the ++ * usb_request structure defined in usb_gadget.h file. ++ */ ++extern int dwc_otg_pcd_xiso_ep_queue(dwc_otg_pcd_t * pcd, void *ep_handle, ++ uint8_t * buf, dwc_dma_t dma_buf, ++ uint32_t buflen, int zero, ++ void *req_handle, int atomic_alloc, ++ void *ereq_nonport); ++ ++#endif ++ ++/** De-queue the specified data transfer that has not yet completed. ++ * ++ * Returns -DWC_E_INVALID if invalid parameters were passed. ++ * Returns -DWC_E_SHUTDOWN if any other error ocurred. ++ * Returns 0 on success. */ ++extern int dwc_otg_pcd_ep_dequeue(dwc_otg_pcd_t * pcd, void *ep_handle, ++ void *req_handle); ++ ++/** Halt (STALL) an endpoint or clear it. ++ * ++ * Returns -DWC_E_INVALID if invalid parameters were passed. ++ * Returns -DWC_E_SHUTDOWN if any other error ocurred. ++ * Returns -DWC_E_AGAIN if the STALL cannot be sent and must be tried again later ++ * Returns 0 on success. */ ++extern int dwc_otg_pcd_ep_halt(dwc_otg_pcd_t * pcd, void *ep_handle, int value); ++ ++/** This function */ ++extern int dwc_otg_pcd_ep_wedge(dwc_otg_pcd_t * pcd, void *ep_handle); ++ ++/** This function should be called on every hardware interrupt */ ++extern int32_t dwc_otg_pcd_handle_intr(dwc_otg_pcd_t * pcd); ++ ++/** This function returns current frame number */ ++extern int dwc_otg_pcd_get_frame_number(dwc_otg_pcd_t * pcd); ++ ++/** ++ * Start isochronous transfers on the endpoint referenced by ep_handle. ++ * For isochronous transfers duble buffering is used. ++ * After processing each of buffers comlete callback will be called with ++ * status for each transaction. ++ * ++ * @param pcd The PCD ++ * @param ep_handle The handle of the endpoint ++ * @param buf0 The virtual address of first data buffer ++ * @param buf1 The virtual address of second data buffer ++ * @param dma0 The DMA address of first data buffer ++ * @param dma1 The DMA address of second data buffer ++ * @param sync_frame Data pattern frame number ++ * @param dp_frame Data size for pattern frame ++ * @param data_per_frame Data size for regular frame ++ * @param start_frame Frame number to start transfers, if -1 then start transfers ASAP. ++ * @param buf_proc_intrvl Interval of ISOC Buffer processing ++ * @param req_handle Handle of ISOC request ++ * @param atomic_alloc Specefies whether to perform atomic allocation for ++ * internal data structures. ++ * ++ * Returns -DWC_E_NO_MEMORY if there is no enough memory. ++ * Returns -DWC_E_INVALID if incorrect arguments are passed to the function. ++ * Returns -DW_E_SHUTDOWN for any other error. ++ * Returns 0 on success ++ */ ++extern int dwc_otg_pcd_iso_ep_start(dwc_otg_pcd_t * pcd, void *ep_handle, ++ uint8_t * buf0, uint8_t * buf1, ++ dwc_dma_t dma0, dwc_dma_t dma1, ++ int sync_frame, int dp_frame, ++ int data_per_frame, int start_frame, ++ int buf_proc_intrvl, void *req_handle, ++ int atomic_alloc); ++ ++/** Stop ISOC transfers on endpoint referenced by ep_handle. ++ * ++ * @param pcd The PCD ++ * @param ep_handle The handle of the endpoint ++ * @param req_handle Handle of ISOC request ++ * ++ * Returns -DWC_E_INVALID if incorrect arguments are passed to the function ++ * Returns 0 on success ++ */ ++int dwc_otg_pcd_iso_ep_stop(dwc_otg_pcd_t * pcd, void *ep_handle, ++ void *req_handle); ++ ++/** Get ISOC packet status. ++ * ++ * @param pcd The PCD ++ * @param ep_handle The handle of the endpoint ++ * @param iso_req_handle Isochronoush request handle ++ * @param packet Number of packet ++ * @param status Out parameter for returning status ++ * @param actual Out parameter for returning actual length ++ * @param offset Out parameter for returning offset ++ * ++ */ ++extern void dwc_otg_pcd_get_iso_packet_params(dwc_otg_pcd_t * pcd, ++ void *ep_handle, ++ void *iso_req_handle, int packet, ++ int *status, int *actual, ++ int *offset); ++ ++/** Get ISOC packet count. ++ * ++ * @param pcd The PCD ++ * @param ep_handle The handle of the endpoint ++ * @param iso_req_handle ++ */ ++extern int dwc_otg_pcd_get_iso_packet_count(dwc_otg_pcd_t * pcd, ++ void *ep_handle, ++ void *iso_req_handle); ++ ++/** This function starts the SRP Protocol if no session is in progress. If ++ * a session is already in progress, but the device is suspended, ++ * remote wakeup signaling is started. ++ */ ++extern int dwc_otg_pcd_wakeup(dwc_otg_pcd_t * pcd); ++ ++/** This function returns 1 if LPM support is enabled, and 0 otherwise. */ ++extern int dwc_otg_pcd_is_lpm_enabled(dwc_otg_pcd_t * pcd); ++ ++/** This function returns 1 if remote wakeup is allowed and 0, otherwise. */ ++extern int dwc_otg_pcd_get_rmwkup_enable(dwc_otg_pcd_t * pcd); ++ ++/** Initiate SRP */ ++extern void dwc_otg_pcd_initiate_srp(dwc_otg_pcd_t * pcd); ++ ++/** Starts remote wakeup signaling. */ ++extern void dwc_otg_pcd_remote_wakeup(dwc_otg_pcd_t * pcd, int set); ++ ++/** Starts micorsecond soft disconnect. */ ++extern void dwc_otg_pcd_disconnect_us(dwc_otg_pcd_t * pcd, int no_of_usecs); ++/** This function returns whether device is dualspeed.*/ ++extern uint32_t dwc_otg_pcd_is_dualspeed(dwc_otg_pcd_t * pcd); ++ ++/** This function returns whether device is otg. */ ++extern uint32_t dwc_otg_pcd_is_otg(dwc_otg_pcd_t * pcd); ++ ++/** These functions allow to get hnp parameters */ ++extern uint32_t get_b_hnp_enable(dwc_otg_pcd_t * pcd); ++extern uint32_t get_a_hnp_support(dwc_otg_pcd_t * pcd); ++extern uint32_t get_a_alt_hnp_support(dwc_otg_pcd_t * pcd); ++ ++/** CFI specific Interface functions */ ++/** Allocate a cfi buffer */ ++extern uint8_t *cfiw_ep_alloc_buffer(dwc_otg_pcd_t * pcd, void *pep, ++ dwc_dma_t * addr, size_t buflen, ++ int flags); ++ ++/******************************************************************************/ ++ ++/** @} */ ++ ++#endif /* __DWC_PCD_IF_H__ */ ++ ++#endif /* DWC_HOST_ONLY */ +diff --git a/drivers/usb/host/dwc_otg/dwc_otg_pcd_intr.c b/drivers/usb/host/dwc_otg/dwc_otg_pcd_intr.c +new file mode 100644 +index 0000000..c8590b5 +--- /dev/null ++++ b/drivers/usb/host/dwc_otg/dwc_otg_pcd_intr.c +@@ -0,0 +1,5147 @@ ++/* ========================================================================== ++ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_pcd_intr.c $ ++ * $Revision: #116 $ ++ * $Date: 2012/08/10 $ ++ * $Change: 2047372 $ ++ * ++ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, ++ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless ++ * otherwise expressly agreed to in writing between Synopsys and you. ++ * ++ * The Software IS NOT an item of Licensed Software or Licensed Product under ++ * any End User Software License Agreement or Agreement for Licensed Product ++ * with Synopsys or any supplement thereto. You are permitted to use and ++ * redistribute this Software in source and binary forms, with or without ++ * modification, provided that redistributions of source code must retain this ++ * notice. You may not view, use, disclose, copy or distribute this file or ++ * any information contained herein except pursuant to this license grant from ++ * Synopsys. If you do not agree with this notice, including the disclaimer ++ * below, then you are not authorized to use the Software. ++ * ++ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS ++ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS 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. ++ * ========================================================================== */ ++#ifndef DWC_HOST_ONLY ++ ++#include "dwc_otg_pcd.h" ++ ++#ifdef DWC_UTE_CFI ++#include "dwc_otg_cfi.h" ++#endif ++ ++#ifdef DWC_UTE_PER_IO ++extern void complete_xiso_ep(dwc_otg_pcd_ep_t * ep); ++#endif ++//#define PRINT_CFI_DMA_DESCS ++ ++#define DEBUG_EP0 ++ ++/** ++ * This function updates OTG. ++ */ ++static void dwc_otg_pcd_update_otg(dwc_otg_pcd_t * pcd, const unsigned reset) ++{ ++ ++ if (reset) { ++ pcd->b_hnp_enable = 0; ++ pcd->a_hnp_support = 0; ++ pcd->a_alt_hnp_support = 0; ++ } ++ ++ if (pcd->fops->hnp_changed) { ++ pcd->fops->hnp_changed(pcd); ++ } ++} ++ ++/** @file ++ * This file contains the implementation of the PCD Interrupt handlers. ++ * ++ * The PCD handles the device interrupts. Many conditions can cause a ++ * device interrupt. When an interrupt occurs, the device interrupt ++ * service routine determines the cause of the interrupt and ++ * dispatches handling to the appropriate function. These interrupt ++ * handling functions are described below. ++ * All interrupt registers are processed from LSB to MSB. ++ */ ++ ++/** ++ * This function prints the ep0 state for debug purposes. ++ */ ++static inline void print_ep0_state(dwc_otg_pcd_t * pcd) ++{ ++#ifdef DEBUG ++ char str[40]; ++ ++ switch (pcd->ep0state) { ++ case EP0_DISCONNECT: ++ dwc_strcpy(str, "EP0_DISCONNECT"); ++ break; ++ case EP0_IDLE: ++ dwc_strcpy(str, "EP0_IDLE"); ++ break; ++ case EP0_IN_DATA_PHASE: ++ dwc_strcpy(str, "EP0_IN_DATA_PHASE"); ++ break; ++ case EP0_OUT_DATA_PHASE: ++ dwc_strcpy(str, "EP0_OUT_DATA_PHASE"); ++ break; ++ case EP0_IN_STATUS_PHASE: ++ dwc_strcpy(str, "EP0_IN_STATUS_PHASE"); ++ break; ++ case EP0_OUT_STATUS_PHASE: ++ dwc_strcpy(str, "EP0_OUT_STATUS_PHASE"); ++ break; ++ case EP0_STALL: ++ dwc_strcpy(str, "EP0_STALL"); ++ break; ++ default: ++ dwc_strcpy(str, "EP0_INVALID"); ++ } ++ ++ DWC_DEBUGPL(DBG_ANY, "%s(%d)\n", str, pcd->ep0state); ++#endif ++} ++ ++/** ++ * This function calculate the size of the payload in the memory ++ * for out endpoints and prints size for debug purposes(used in ++ * 2.93a DevOutNak feature). ++ */ ++static inline void print_memory_payload(dwc_otg_pcd_t * pcd, dwc_ep_t * ep) ++{ ++#ifdef DEBUG ++ deptsiz_data_t deptsiz_init = {.d32 = 0 }; ++ deptsiz_data_t deptsiz_updt = {.d32 = 0 }; ++ int pack_num; ++ unsigned payload; ++ ++ deptsiz_init.d32 = pcd->core_if->start_doeptsiz_val[ep->num]; ++ deptsiz_updt.d32 = ++ DWC_READ_REG32(&pcd->core_if->dev_if-> ++ out_ep_regs[ep->num]->doeptsiz); ++ /* Payload will be */ ++ payload = deptsiz_init.b.xfersize - deptsiz_updt.b.xfersize; ++ /* Packet count is decremented every time a packet ++ * is written to the RxFIFO not in to the external memory ++ * So, if payload == 0, then it means no packet was sent to ext memory*/ ++ pack_num = (!payload) ? 0 : (deptsiz_init.b.pktcnt - deptsiz_updt.b.pktcnt); ++ DWC_DEBUGPL(DBG_PCDV, ++ "Payload for EP%d-%s\n", ++ ep->num, (ep->is_in ? "IN" : "OUT")); ++ DWC_DEBUGPL(DBG_PCDV, ++ "Number of transfered bytes = 0x%08x\n", payload); ++ DWC_DEBUGPL(DBG_PCDV, ++ "Number of transfered packets = %d\n", pack_num); ++#endif ++} ++ ++ ++#ifdef DWC_UTE_CFI ++static inline void print_desc(struct dwc_otg_dma_desc *ddesc, ++ const uint8_t * epname, int descnum) ++{ ++ CFI_INFO ++ ("%s DMA_DESC(%d) buf=0x%08x bytes=0x%04x; sp=0x%x; l=0x%x; sts=0x%02x; bs=0x%02x\n", ++ epname, descnum, ddesc->buf, ddesc->status.b.bytes, ++ ddesc->status.b.sp, ddesc->status.b.l, ddesc->status.b.sts, ++ ddesc->status.b.bs); ++} ++#endif ++ ++/** ++ * This function returns pointer to in ep struct with number ep_num ++ */ ++static inline dwc_otg_pcd_ep_t *get_in_ep(dwc_otg_pcd_t * pcd, uint32_t ep_num) ++{ ++ int i; ++ int num_in_eps = GET_CORE_IF(pcd)->dev_if->num_in_eps; ++ if (ep_num == 0) { ++ return &pcd->ep0; ++ } else { ++ for (i = 0; i < num_in_eps; ++i) { ++ if (pcd->in_ep[i].dwc_ep.num == ep_num) ++ return &pcd->in_ep[i]; ++ } ++ return 0; ++ } ++} ++ ++/** ++ * This function returns pointer to out ep struct with number ep_num ++ */ ++static inline dwc_otg_pcd_ep_t *get_out_ep(dwc_otg_pcd_t * pcd, uint32_t ep_num) ++{ ++ int i; ++ int num_out_eps = GET_CORE_IF(pcd)->dev_if->num_out_eps; ++ if (ep_num == 0) { ++ return &pcd->ep0; ++ } else { ++ for (i = 0; i < num_out_eps; ++i) { ++ if (pcd->out_ep[i].dwc_ep.num == ep_num) ++ return &pcd->out_ep[i]; ++ } ++ return 0; ++ } ++} ++ ++/** ++ * This functions gets a pointer to an EP from the wIndex address ++ * value of the control request. ++ */ ++dwc_otg_pcd_ep_t *get_ep_by_addr(dwc_otg_pcd_t * pcd, u16 wIndex) ++{ ++ dwc_otg_pcd_ep_t *ep; ++ uint32_t ep_num = UE_GET_ADDR(wIndex); ++ ++ if (ep_num == 0) { ++ ep = &pcd->ep0; ++ } else if (UE_GET_DIR(wIndex) == UE_DIR_IN) { /* in ep */ ++ ep = &pcd->in_ep[ep_num - 1]; ++ } else { ++ ep = &pcd->out_ep[ep_num - 1]; ++ } ++ ++ return ep; ++} ++ ++/** ++ * This function checks the EP request queue, if the queue is not ++ * empty the next request is started. ++ */ ++void start_next_request(dwc_otg_pcd_ep_t * ep) ++{ ++ dwc_otg_pcd_request_t *req = 0; ++ uint32_t max_transfer = ++ GET_CORE_IF(ep->pcd)->core_params->max_transfer_size; ++ ++#ifdef DWC_UTE_CFI ++ struct dwc_otg_pcd *pcd; ++ pcd = ep->pcd; ++#endif ++ ++ if (!DWC_CIRCLEQ_EMPTY(&ep->queue)) { ++ req = DWC_CIRCLEQ_FIRST(&ep->queue); ++ ++#ifdef DWC_UTE_CFI ++ if (ep->dwc_ep.buff_mode != BM_STANDARD) { ++ ep->dwc_ep.cfi_req_len = req->length; ++ pcd->cfi->ops.build_descriptors(pcd->cfi, pcd, ep, req); ++ } else { ++#endif ++ /* Setup and start the Transfer */ ++ if (req->dw_align_buf) { ++ ep->dwc_ep.dma_addr = req->dw_align_buf_dma; ++ ep->dwc_ep.start_xfer_buff = req->dw_align_buf; ++ ep->dwc_ep.xfer_buff = req->dw_align_buf; ++ } else { ++ ep->dwc_ep.dma_addr = req->dma; ++ ep->dwc_ep.start_xfer_buff = req->buf; ++ ep->dwc_ep.xfer_buff = req->buf; ++ } ++ ep->dwc_ep.sent_zlp = 0; ++ ep->dwc_ep.total_len = req->length; ++ ep->dwc_ep.xfer_len = 0; ++ ep->dwc_ep.xfer_count = 0; ++ ++ ep->dwc_ep.maxxfer = max_transfer; ++ if (GET_CORE_IF(ep->pcd)->dma_desc_enable) { ++ uint32_t out_max_xfer = DDMA_MAX_TRANSFER_SIZE ++ - (DDMA_MAX_TRANSFER_SIZE % 4); ++ if (ep->dwc_ep.is_in) { ++ if (ep->dwc_ep.maxxfer > ++ DDMA_MAX_TRANSFER_SIZE) { ++ ep->dwc_ep.maxxfer = ++ DDMA_MAX_TRANSFER_SIZE; ++ } ++ } else { ++ if (ep->dwc_ep.maxxfer > out_max_xfer) { ++ ep->dwc_ep.maxxfer = ++ out_max_xfer; ++ } ++ } ++ } ++ if (ep->dwc_ep.maxxfer < ep->dwc_ep.total_len) { ++ ep->dwc_ep.maxxfer -= ++ (ep->dwc_ep.maxxfer % ep->dwc_ep.maxpacket); ++ } ++ if (req->sent_zlp) { ++ if ((ep->dwc_ep.total_len % ++ ep->dwc_ep.maxpacket == 0) ++ && (ep->dwc_ep.total_len != 0)) { ++ ep->dwc_ep.sent_zlp = 1; ++ } ++ ++ } ++#ifdef DWC_UTE_CFI ++ } ++#endif ++ dwc_otg_ep_start_transfer(GET_CORE_IF(ep->pcd), &ep->dwc_ep); ++ } else if (ep->dwc_ep.type == DWC_OTG_EP_TYPE_ISOC) { ++ DWC_PRINTF("There are no more ISOC requests \n"); ++ ep->dwc_ep.frame_num = 0xFFFFFFFF; ++ } ++} ++ ++/** ++ * This function handles the SOF Interrupts. At this time the SOF ++ * Interrupt is disabled. ++ */ ++int32_t dwc_otg_pcd_handle_sof_intr(dwc_otg_pcd_t * pcd) ++{ ++ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); ++ ++ gintsts_data_t gintsts; ++ ++ DWC_DEBUGPL(DBG_PCD, "SOF\n"); ++ ++ /* Clear interrupt */ ++ gintsts.d32 = 0; ++ gintsts.b.sofintr = 1; ++ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, gintsts.d32); ++ ++ return 1; ++} ++ ++/** ++ * This function handles the Rx Status Queue Level Interrupt, which ++ * indicates that there is a least one packet in the Rx FIFO. The ++ * packets are moved from the FIFO to memory, where they will be ++ * processed when the Endpoint Interrupt Register indicates Transfer ++ * Complete or SETUP Phase Done. ++ * ++ * Repeat the following until the Rx Status Queue is empty: ++ * -# Read the Receive Status Pop Register (GRXSTSP) to get Packet ++ * info ++ * -# If Receive FIFO is empty then skip to step Clear the interrupt ++ * and exit ++ * -# If SETUP Packet call dwc_otg_read_setup_packet to copy the ++ * SETUP data to the buffer ++ * -# If OUT Data Packet call dwc_otg_read_packet to copy the data ++ * to the destination buffer ++ */ ++int32_t dwc_otg_pcd_handle_rx_status_q_level_intr(dwc_otg_pcd_t * pcd) ++{ ++ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); ++ dwc_otg_core_global_regs_t *global_regs = core_if->core_global_regs; ++ gintmsk_data_t gintmask = {.d32 = 0 }; ++ device_grxsts_data_t status; ++ dwc_otg_pcd_ep_t *ep; ++ gintsts_data_t gintsts; ++#ifdef DEBUG ++ static char *dpid_str[] = { "D0", "D2", "D1", "MDATA" }; ++#endif ++ ++ //DWC_DEBUGPL(DBG_PCDV, "%s(%p)\n", __func__, _pcd); ++ /* Disable the Rx Status Queue Level interrupt */ ++ gintmask.b.rxstsqlvl = 1; ++ DWC_MODIFY_REG32(&global_regs->gintmsk, gintmask.d32, 0); ++ ++ /* Get the Status from the top of the FIFO */ ++ status.d32 = DWC_READ_REG32(&global_regs->grxstsp); ++ ++ DWC_DEBUGPL(DBG_PCD, "EP:%d BCnt:%d DPID:%s " ++ "pktsts:%x Frame:%d(0x%0x)\n", ++ status.b.epnum, status.b.bcnt, ++ dpid_str[status.b.dpid], ++ status.b.pktsts, status.b.fn, status.b.fn); ++ /* Get pointer to EP structure */ ++ ep = get_out_ep(pcd, status.b.epnum); ++ ++ switch (status.b.pktsts) { ++ case DWC_DSTS_GOUT_NAK: ++ DWC_DEBUGPL(DBG_PCDV, "Global OUT NAK\n"); ++ break; ++ case DWC_STS_DATA_UPDT: ++ DWC_DEBUGPL(DBG_PCDV, "OUT Data Packet\n"); ++ if (status.b.bcnt && ep->dwc_ep.xfer_buff) { ++ /** @todo NGS Check for buffer overflow? */ ++ dwc_otg_read_packet(core_if, ++ ep->dwc_ep.xfer_buff, ++ status.b.bcnt); ++ ep->dwc_ep.xfer_count += status.b.bcnt; ++ ep->dwc_ep.xfer_buff += status.b.bcnt; ++ } ++ break; ++ case DWC_STS_XFER_COMP: ++ DWC_DEBUGPL(DBG_PCDV, "OUT Complete\n"); ++ break; ++ case DWC_DSTS_SETUP_COMP: ++#ifdef DEBUG_EP0 ++ DWC_DEBUGPL(DBG_PCDV, "Setup Complete\n"); ++#endif ++ break; ++ case DWC_DSTS_SETUP_UPDT: ++ dwc_otg_read_setup_packet(core_if, pcd->setup_pkt->d32); ++#ifdef DEBUG_EP0 ++ DWC_DEBUGPL(DBG_PCD, ++ "SETUP PKT: %02x.%02x v%04x i%04x l%04x\n", ++ pcd->setup_pkt->req.bmRequestType, ++ pcd->setup_pkt->req.bRequest, ++ UGETW(pcd->setup_pkt->req.wValue), ++ UGETW(pcd->setup_pkt->req.wIndex), ++ UGETW(pcd->setup_pkt->req.wLength)); ++#endif ++ ep->dwc_ep.xfer_count += status.b.bcnt; ++ break; ++ default: ++ DWC_DEBUGPL(DBG_PCDV, "Invalid Packet Status (0x%0x)\n", ++ status.b.pktsts); ++ break; ++ } ++ ++ /* Enable the Rx Status Queue Level interrupt */ ++ DWC_MODIFY_REG32(&global_regs->gintmsk, 0, gintmask.d32); ++ /* Clear interrupt */ ++ gintsts.d32 = 0; ++ gintsts.b.rxstsqlvl = 1; ++ DWC_WRITE_REG32(&global_regs->gintsts, gintsts.d32); ++ ++ //DWC_DEBUGPL(DBG_PCDV, "EXIT: %s\n", __func__); ++ return 1; ++} ++ ++/** ++ * This function examines the Device IN Token Learning Queue to ++ * determine the EP number of the last IN token received. This ++ * implementation is for the Mass Storage device where there are only ++ * 2 IN EPs (Control-IN and BULK-IN). ++ * ++ * The EP numbers for the first six IN Tokens are in DTKNQR1 and there ++ * are 8 EP Numbers in each of the other possible DTKNQ Registers. ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ * ++ */ ++static inline int get_ep_of_last_in_token(dwc_otg_core_if_t * core_if) ++{ ++ dwc_otg_device_global_regs_t *dev_global_regs = ++ core_if->dev_if->dev_global_regs; ++ const uint32_t TOKEN_Q_DEPTH = core_if->hwcfg2.b.dev_token_q_depth; ++ /* Number of Token Queue Registers */ ++ const int DTKNQ_REG_CNT = (TOKEN_Q_DEPTH + 7) / 8; ++ dtknq1_data_t dtknqr1; ++ uint32_t in_tkn_epnums[4]; ++ int ndx = 0; ++ int i = 0; ++ volatile uint32_t *addr = &dev_global_regs->dtknqr1; ++ int epnum = 0; ++ ++ //DWC_DEBUGPL(DBG_PCD,"dev_token_q_depth=%d\n",TOKEN_Q_DEPTH); ++ ++ /* Read the DTKNQ Registers */ ++ for (i = 0; i < DTKNQ_REG_CNT; i++) { ++ in_tkn_epnums[i] = DWC_READ_REG32(addr); ++ DWC_DEBUGPL(DBG_PCDV, "DTKNQR%d=0x%08x\n", i + 1, ++ in_tkn_epnums[i]); ++ if (addr == &dev_global_regs->dvbusdis) { ++ addr = &dev_global_regs->dtknqr3_dthrctl; ++ } else { ++ ++addr; ++ } ++ ++ } ++ ++ /* Copy the DTKNQR1 data to the bit field. */ ++ dtknqr1.d32 = in_tkn_epnums[0]; ++ /* Get the EP numbers */ ++ in_tkn_epnums[0] = dtknqr1.b.epnums0_5; ++ ndx = dtknqr1.b.intknwptr - 1; ++ ++ //DWC_DEBUGPL(DBG_PCDV,"ndx=%d\n",ndx); ++ if (ndx == -1) { ++ /** @todo Find a simpler way to calculate the max ++ * queue position.*/ ++ int cnt = TOKEN_Q_DEPTH; ++ if (TOKEN_Q_DEPTH <= 6) { ++ cnt = TOKEN_Q_DEPTH - 1; ++ } else if (TOKEN_Q_DEPTH <= 14) { ++ cnt = TOKEN_Q_DEPTH - 7; ++ } else if (TOKEN_Q_DEPTH <= 22) { ++ cnt = TOKEN_Q_DEPTH - 15; ++ } else { ++ cnt = TOKEN_Q_DEPTH - 23; ++ } ++ epnum = (in_tkn_epnums[DTKNQ_REG_CNT - 1] >> (cnt * 4)) & 0xF; ++ } else { ++ if (ndx <= 5) { ++ epnum = (in_tkn_epnums[0] >> (ndx * 4)) & 0xF; ++ } else if (ndx <= 13) { ++ ndx -= 6; ++ epnum = (in_tkn_epnums[1] >> (ndx * 4)) & 0xF; ++ } else if (ndx <= 21) { ++ ndx -= 14; ++ epnum = (in_tkn_epnums[2] >> (ndx * 4)) & 0xF; ++ } else if (ndx <= 29) { ++ ndx -= 22; ++ epnum = (in_tkn_epnums[3] >> (ndx * 4)) & 0xF; ++ } ++ } ++ //DWC_DEBUGPL(DBG_PCD,"epnum=%d\n",epnum); ++ return epnum; ++} ++ ++/** ++ * This interrupt occurs when the non-periodic Tx FIFO is half-empty. ++ * The active request is checked for the next packet to be loaded into ++ * the non-periodic Tx FIFO. ++ */ ++int32_t dwc_otg_pcd_handle_np_tx_fifo_empty_intr(dwc_otg_pcd_t * pcd) ++{ ++ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); ++ dwc_otg_core_global_regs_t *global_regs = core_if->core_global_regs; ++ dwc_otg_dev_in_ep_regs_t *ep_regs; ++ gnptxsts_data_t txstatus = {.d32 = 0 }; ++ gintsts_data_t gintsts; ++ ++ int epnum = 0; ++ dwc_otg_pcd_ep_t *ep = 0; ++ uint32_t len = 0; ++ int dwords; ++ ++ /* Get the epnum from the IN Token Learning Queue. */ ++ epnum = get_ep_of_last_in_token(core_if); ++ ep = get_in_ep(pcd, epnum); ++ ++ DWC_DEBUGPL(DBG_PCD, "NP TxFifo Empty: %d \n", epnum); ++ ++ ep_regs = core_if->dev_if->in_ep_regs[epnum]; ++ ++ len = ep->dwc_ep.xfer_len - ep->dwc_ep.xfer_count; ++ if (len > ep->dwc_ep.maxpacket) { ++ len = ep->dwc_ep.maxpacket; ++ } ++ dwords = (len + 3) / 4; ++ ++ /* While there is space in the queue and space in the FIFO and ++ * More data to tranfer, Write packets to the Tx FIFO */ ++ txstatus.d32 = DWC_READ_REG32(&global_regs->gnptxsts); ++ DWC_DEBUGPL(DBG_PCDV, "b4 GNPTXSTS=0x%08x\n", txstatus.d32); ++ ++ while (txstatus.b.nptxqspcavail > 0 && ++ txstatus.b.nptxfspcavail > dwords && ++ ep->dwc_ep.xfer_count < ep->dwc_ep.xfer_len) { ++ /* Write the FIFO */ ++ dwc_otg_ep_write_packet(core_if, &ep->dwc_ep, 0); ++ len = ep->dwc_ep.xfer_len - ep->dwc_ep.xfer_count; ++ ++ if (len > ep->dwc_ep.maxpacket) { ++ len = ep->dwc_ep.maxpacket; ++ } ++ ++ dwords = (len + 3) / 4; ++ txstatus.d32 = DWC_READ_REG32(&global_regs->gnptxsts); ++ DWC_DEBUGPL(DBG_PCDV, "GNPTXSTS=0x%08x\n", txstatus.d32); ++ } ++ ++ DWC_DEBUGPL(DBG_PCDV, "GNPTXSTS=0x%08x\n", ++ DWC_READ_REG32(&global_regs->gnptxsts)); ++ ++ /* Clear interrupt */ ++ gintsts.d32 = 0; ++ gintsts.b.nptxfempty = 1; ++ DWC_WRITE_REG32(&global_regs->gintsts, gintsts.d32); ++ ++ return 1; ++} ++ ++/** ++ * This function is called when dedicated Tx FIFO Empty interrupt occurs. ++ * The active request is checked for the next packet to be loaded into ++ * apropriate Tx FIFO. ++ */ ++static int32_t write_empty_tx_fifo(dwc_otg_pcd_t * pcd, uint32_t epnum) ++{ ++ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); ++ dwc_otg_dev_if_t *dev_if = core_if->dev_if; ++ dwc_otg_dev_in_ep_regs_t *ep_regs; ++ dtxfsts_data_t txstatus = {.d32 = 0 }; ++ dwc_otg_pcd_ep_t *ep = 0; ++ uint32_t len = 0; ++ int dwords; ++ ++ ep = get_in_ep(pcd, epnum); ++ ++ DWC_DEBUGPL(DBG_PCD, "Dedicated TxFifo Empty: %d \n", epnum); ++ ++ ep_regs = core_if->dev_if->in_ep_regs[epnum]; ++ ++ len = ep->dwc_ep.xfer_len - ep->dwc_ep.xfer_count; ++ ++ if (len > ep->dwc_ep.maxpacket) { ++ len = ep->dwc_ep.maxpacket; ++ } ++ ++ dwords = (len + 3) / 4; ++ ++ /* While there is space in the queue and space in the FIFO and ++ * More data to tranfer, Write packets to the Tx FIFO */ ++ txstatus.d32 = DWC_READ_REG32(&dev_if->in_ep_regs[epnum]->dtxfsts); ++ DWC_DEBUGPL(DBG_PCDV, "b4 dtxfsts[%d]=0x%08x\n", epnum, txstatus.d32); ++ ++ while (txstatus.b.txfspcavail > dwords && ++ ep->dwc_ep.xfer_count < ep->dwc_ep.xfer_len && ++ ep->dwc_ep.xfer_len != 0) { ++ /* Write the FIFO */ ++ dwc_otg_ep_write_packet(core_if, &ep->dwc_ep, 0); ++ ++ len = ep->dwc_ep.xfer_len - ep->dwc_ep.xfer_count; ++ if (len > ep->dwc_ep.maxpacket) { ++ len = ep->dwc_ep.maxpacket; ++ } ++ ++ dwords = (len + 3) / 4; ++ txstatus.d32 = ++ DWC_READ_REG32(&dev_if->in_ep_regs[epnum]->dtxfsts); ++ DWC_DEBUGPL(DBG_PCDV, "dtxfsts[%d]=0x%08x\n", epnum, ++ txstatus.d32); ++ } ++ ++ DWC_DEBUGPL(DBG_PCDV, "b4 dtxfsts[%d]=0x%08x\n", epnum, ++ DWC_READ_REG32(&dev_if->in_ep_regs[epnum]->dtxfsts)); ++ ++ return 1; ++} ++ ++/** ++ * This function is called when the Device is disconnected. It stops ++ * any active requests and informs the Gadget driver of the ++ * disconnect. ++ */ ++void dwc_otg_pcd_stop(dwc_otg_pcd_t * pcd) ++{ ++ int i, num_in_eps, num_out_eps; ++ dwc_otg_pcd_ep_t *ep; ++ ++ gintmsk_data_t intr_mask = {.d32 = 0 }; ++ ++ DWC_SPINLOCK(pcd->lock); ++ ++ num_in_eps = GET_CORE_IF(pcd)->dev_if->num_in_eps; ++ num_out_eps = GET_CORE_IF(pcd)->dev_if->num_out_eps; ++ ++ DWC_DEBUGPL(DBG_PCDV, "%s() \n", __func__); ++ /* don't disconnect drivers more than once */ ++ if (pcd->ep0state == EP0_DISCONNECT) { ++ DWC_DEBUGPL(DBG_ANY, "%s() Already Disconnected\n", __func__); ++ DWC_SPINUNLOCK(pcd->lock); ++ return; ++ } ++ pcd->ep0state = EP0_DISCONNECT; ++ ++ /* Reset the OTG state. */ ++ dwc_otg_pcd_update_otg(pcd, 1); ++ ++ /* Disable the NP Tx Fifo Empty Interrupt. */ ++ intr_mask.b.nptxfempty = 1; ++ DWC_MODIFY_REG32(&GET_CORE_IF(pcd)->core_global_regs->gintmsk, ++ intr_mask.d32, 0); ++ ++ /* Flush the FIFOs */ ++ /**@todo NGS Flush Periodic FIFOs */ ++ dwc_otg_flush_tx_fifo(GET_CORE_IF(pcd), 0x10); ++ dwc_otg_flush_rx_fifo(GET_CORE_IF(pcd)); ++ ++ /* prevent new request submissions, kill any outstanding requests */ ++ ep = &pcd->ep0; ++ dwc_otg_request_nuke(ep); ++ /* prevent new request submissions, kill any outstanding requests */ ++ for (i = 0; i < num_in_eps; i++) { ++ dwc_otg_pcd_ep_t *ep = &pcd->in_ep[i]; ++ dwc_otg_request_nuke(ep); ++ } ++ /* prevent new request submissions, kill any outstanding requests */ ++ for (i = 0; i < num_out_eps; i++) { ++ dwc_otg_pcd_ep_t *ep = &pcd->out_ep[i]; ++ dwc_otg_request_nuke(ep); ++ } ++ ++ /* report disconnect; the driver is already quiesced */ ++ if (pcd->fops->disconnect) { ++ DWC_SPINUNLOCK(pcd->lock); ++ pcd->fops->disconnect(pcd); ++ DWC_SPINLOCK(pcd->lock); ++ } ++ DWC_SPINUNLOCK(pcd->lock); ++} ++ ++/** ++ * This interrupt indicates that ... ++ */ ++int32_t dwc_otg_pcd_handle_i2c_intr(dwc_otg_pcd_t * pcd) ++{ ++ gintmsk_data_t intr_mask = {.d32 = 0 }; ++ gintsts_data_t gintsts; ++ ++ DWC_PRINTF("INTERRUPT Handler not implemented for %s\n", "i2cintr"); ++ intr_mask.b.i2cintr = 1; ++ DWC_MODIFY_REG32(&GET_CORE_IF(pcd)->core_global_regs->gintmsk, ++ intr_mask.d32, 0); ++ ++ /* Clear interrupt */ ++ gintsts.d32 = 0; ++ gintsts.b.i2cintr = 1; ++ DWC_WRITE_REG32(&GET_CORE_IF(pcd)->core_global_regs->gintsts, ++ gintsts.d32); ++ return 1; ++} ++ ++/** ++ * This interrupt indicates that ... ++ */ ++int32_t dwc_otg_pcd_handle_early_suspend_intr(dwc_otg_pcd_t * pcd) ++{ ++ gintsts_data_t gintsts; ++#if defined(VERBOSE) ++ DWC_PRINTF("Early Suspend Detected\n"); ++#endif ++ ++ /* Clear interrupt */ ++ gintsts.d32 = 0; ++ gintsts.b.erlysuspend = 1; ++ DWC_WRITE_REG32(&GET_CORE_IF(pcd)->core_global_regs->gintsts, ++ gintsts.d32); ++ return 1; ++} ++ ++/** ++ * This function configures EPO to receive SETUP packets. ++ * ++ * @todo NGS: Update the comments from the HW FS. ++ * ++ * -# Program the following fields in the endpoint specific registers ++ * for Control OUT EP 0, in order to receive a setup packet ++ * - DOEPTSIZ0.Packet Count = 3 (To receive up to 3 back to back ++ * setup packets) ++ * - DOEPTSIZE0.Transfer Size = 24 Bytes (To receive up to 3 back ++ * to back setup packets) ++ * - In DMA mode, DOEPDMA0 Register with a memory address to ++ * store any setup packets received ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ * @param pcd Programming view of the PCD. ++ */ ++static inline void ep0_out_start(dwc_otg_core_if_t * core_if, ++ dwc_otg_pcd_t * pcd) ++{ ++ dwc_otg_dev_if_t *dev_if = core_if->dev_if; ++ deptsiz0_data_t doeptsize0 = {.d32 = 0 }; ++ dwc_otg_dev_dma_desc_t *dma_desc; ++ depctl_data_t doepctl = {.d32 = 0 }; ++ ++#ifdef VERBOSE ++ DWC_DEBUGPL(DBG_PCDV, "%s() doepctl0=%0x\n", __func__, ++ DWC_READ_REG32(&dev_if->out_ep_regs[0]->doepctl)); ++#endif ++ if (core_if->snpsid >= OTG_CORE_REV_3_00a) { ++ doepctl.d32 = DWC_READ_REG32(&dev_if->out_ep_regs[0]->doepctl); ++ if (doepctl.b.epena) { ++ return; ++ } ++ } ++ ++ doeptsize0.b.supcnt = 3; ++ doeptsize0.b.pktcnt = 1; ++ doeptsize0.b.xfersize = 8 * 3; ++ ++ if (core_if->dma_enable) { ++ if (!core_if->dma_desc_enable) { ++ /** put here as for Hermes mode deptisz register should not be written */ ++ DWC_WRITE_REG32(&dev_if->out_ep_regs[0]->doeptsiz, ++ doeptsize0.d32); ++ ++ /** @todo dma needs to handle multiple setup packets (up to 3) */ ++ DWC_WRITE_REG32(&dev_if->out_ep_regs[0]->doepdma, ++ pcd->setup_pkt_dma_handle); ++ } else { ++ dev_if->setup_desc_index = ++ (dev_if->setup_desc_index + 1) & 1; ++ dma_desc = ++ dev_if->setup_desc_addr[dev_if->setup_desc_index]; ++ ++ /** DMA Descriptor Setup */ ++ dma_desc->status.b.bs = BS_HOST_BUSY; ++ if (core_if->snpsid >= OTG_CORE_REV_3_00a) { ++ dma_desc->status.b.sr = 0; ++ dma_desc->status.b.mtrf = 0; ++ } ++ dma_desc->status.b.l = 1; ++ dma_desc->status.b.ioc = 1; ++ dma_desc->status.b.bytes = pcd->ep0.dwc_ep.maxpacket; ++ dma_desc->buf = pcd->setup_pkt_dma_handle; ++ dma_desc->status.b.sts = 0; ++ dma_desc->status.b.bs = BS_HOST_READY; ++ ++ /** DOEPDMA0 Register write */ ++ DWC_WRITE_REG32(&dev_if->out_ep_regs[0]->doepdma, ++ dev_if->dma_setup_desc_addr ++ [dev_if->setup_desc_index]); ++ } ++ ++ } else { ++ /** put here as for Hermes mode deptisz register should not be written */ ++ DWC_WRITE_REG32(&dev_if->out_ep_regs[0]->doeptsiz, ++ doeptsize0.d32); ++ } ++ ++ /** DOEPCTL0 Register write cnak will be set after setup interrupt */ ++ doepctl.d32 = 0; ++ doepctl.b.epena = 1; ++ if (core_if->snpsid <= OTG_CORE_REV_2_94a) { ++ doepctl.b.cnak = 1; ++ DWC_WRITE_REG32(&dev_if->out_ep_regs[0]->doepctl, doepctl.d32); ++ } else { ++ DWC_MODIFY_REG32(&dev_if->out_ep_regs[0]->doepctl, 0, doepctl.d32); ++ } ++ ++#ifdef VERBOSE ++ DWC_DEBUGPL(DBG_PCDV, "doepctl0=%0x\n", ++ DWC_READ_REG32(&dev_if->out_ep_regs[0]->doepctl)); ++ DWC_DEBUGPL(DBG_PCDV, "diepctl0=%0x\n", ++ DWC_READ_REG32(&dev_if->in_ep_regs[0]->diepctl)); ++#endif ++} ++ ++/** ++ * This interrupt occurs when a USB Reset is detected. When the USB ++ * Reset Interrupt occurs the device state is set to DEFAULT and the ++ * EP0 state is set to IDLE. ++ * -# Set the NAK bit for all OUT endpoints (DOEPCTLn.SNAK = 1) ++ * -# Unmask the following interrupt bits ++ * - DAINTMSK.INEP0 = 1 (Control 0 IN endpoint) ++ * - DAINTMSK.OUTEP0 = 1 (Control 0 OUT endpoint) ++ * - DOEPMSK.SETUP = 1 ++ * - DOEPMSK.XferCompl = 1 ++ * - DIEPMSK.XferCompl = 1 ++ * - DIEPMSK.TimeOut = 1 ++ * -# Program the following fields in the endpoint specific registers ++ * for Control OUT EP 0, in order to receive a setup packet ++ * - DOEPTSIZ0.Packet Count = 3 (To receive up to 3 back to back ++ * setup packets) ++ * - DOEPTSIZE0.Transfer Size = 24 Bytes (To receive up to 3 back ++ * to back setup packets) ++ * - In DMA mode, DOEPDMA0 Register with a memory address to ++ * store any setup packets received ++ * At this point, all the required initialization, except for enabling ++ * the control 0 OUT endpoint is done, for receiving SETUP packets. ++ */ ++int32_t dwc_otg_pcd_handle_usb_reset_intr(dwc_otg_pcd_t * pcd) ++{ ++ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); ++ dwc_otg_dev_if_t *dev_if = core_if->dev_if; ++ depctl_data_t doepctl = {.d32 = 0 }; ++ depctl_data_t diepctl = {.d32 = 0 }; ++ daint_data_t daintmsk = {.d32 = 0 }; ++ doepmsk_data_t doepmsk = {.d32 = 0 }; ++ diepmsk_data_t diepmsk = {.d32 = 0 }; ++ dcfg_data_t dcfg = {.d32 = 0 }; ++ grstctl_t resetctl = {.d32 = 0 }; ++ dctl_data_t dctl = {.d32 = 0 }; ++ int i = 0; ++ gintsts_data_t gintsts; ++ pcgcctl_data_t power = {.d32 = 0 }; ++ ++ power.d32 = DWC_READ_REG32(core_if->pcgcctl); ++ if (power.b.stoppclk) { ++ power.d32 = 0; ++ power.b.stoppclk = 1; ++ DWC_MODIFY_REG32(core_if->pcgcctl, power.d32, 0); ++ ++ power.b.pwrclmp = 1; ++ DWC_MODIFY_REG32(core_if->pcgcctl, power.d32, 0); ++ ++ power.b.rstpdwnmodule = 1; ++ DWC_MODIFY_REG32(core_if->pcgcctl, power.d32, 0); ++ } ++ ++ core_if->lx_state = DWC_OTG_L0; ++ ++ DWC_PRINTF("USB RESET\n"); ++#ifdef DWC_EN_ISOC ++ for (i = 1; i < 16; ++i) { ++ dwc_otg_pcd_ep_t *ep; ++ dwc_ep_t *dwc_ep; ++ ep = get_in_ep(pcd, i); ++ if (ep != 0) { ++ dwc_ep = &ep->dwc_ep; ++ dwc_ep->next_frame = 0xffffffff; ++ } ++ } ++#endif /* DWC_EN_ISOC */ ++ ++ /* reset the HNP settings */ ++ dwc_otg_pcd_update_otg(pcd, 1); ++ ++ /* Clear the Remote Wakeup Signalling */ ++ dctl.b.rmtwkupsig = 1; ++ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs->dctl, dctl.d32, 0); ++ ++ /* Set NAK for all OUT EPs */ ++ doepctl.b.snak = 1; ++ for (i = 0; i <= dev_if->num_out_eps; i++) { ++ DWC_WRITE_REG32(&dev_if->out_ep_regs[i]->doepctl, doepctl.d32); ++ } ++ ++ /* Flush the NP Tx FIFO */ ++ dwc_otg_flush_tx_fifo(core_if, 0x10); ++ /* Flush the Learning Queue */ ++ resetctl.b.intknqflsh = 1; ++ DWC_WRITE_REG32(&core_if->core_global_regs->grstctl, resetctl.d32); ++ ++ if (!core_if->core_params->en_multiple_tx_fifo && core_if->dma_enable) { ++ core_if->start_predict = 0; ++ for (i = 0; i<= core_if->dev_if->num_in_eps; ++i) { ++ core_if->nextep_seq[i] = 0xff; // 0xff - EP not active ++ } ++ core_if->nextep_seq[0] = 0; ++ core_if->first_in_nextep_seq = 0; ++ diepctl.d32 = DWC_READ_REG32(&dev_if->in_ep_regs[0]->diepctl); ++ diepctl.b.nextep = 0; ++ DWC_WRITE_REG32(&dev_if->in_ep_regs[0]->diepctl, diepctl.d32); ++ ++ /* Update IN Endpoint Mismatch Count by active IN NP EP count + 1 */ ++ dcfg.d32 = DWC_READ_REG32(&dev_if->dev_global_regs->dcfg); ++ dcfg.b.epmscnt = 2; ++ DWC_WRITE_REG32(&dev_if->dev_global_regs->dcfg, dcfg.d32); ++ ++ DWC_DEBUGPL(DBG_PCDV, ++ "%s first_in_nextep_seq= %2d; nextep_seq[]:\n", ++ __func__, core_if->first_in_nextep_seq); ++ for (i=0; i <= core_if->dev_if->num_in_eps; i++) { ++ DWC_DEBUGPL(DBG_PCDV, "%2d\n", core_if->nextep_seq[i]); ++ } ++ } ++ ++ if (core_if->multiproc_int_enable) { ++ daintmsk.b.inep0 = 1; ++ daintmsk.b.outep0 = 1; ++ DWC_WRITE_REG32(&dev_if->dev_global_regs->deachintmsk, ++ daintmsk.d32); ++ ++ doepmsk.b.setup = 1; ++ doepmsk.b.xfercompl = 1; ++ doepmsk.b.ahberr = 1; ++ doepmsk.b.epdisabled = 1; ++ ++ if ((core_if->dma_desc_enable) || ++ (core_if->dma_enable ++ && core_if->snpsid >= OTG_CORE_REV_3_00a)) { ++ doepmsk.b.stsphsercvd = 1; ++ } ++ if (core_if->dma_desc_enable) ++ doepmsk.b.bna = 1; ++/* ++ doepmsk.b.babble = 1; ++ doepmsk.b.nyet = 1; ++ ++ if (core_if->dma_enable) { ++ doepmsk.b.nak = 1; ++ } ++*/ ++ DWC_WRITE_REG32(&dev_if->dev_global_regs->doepeachintmsk[0], ++ doepmsk.d32); ++ ++ diepmsk.b.xfercompl = 1; ++ diepmsk.b.timeout = 1; ++ diepmsk.b.epdisabled = 1; ++ diepmsk.b.ahberr = 1; ++ diepmsk.b.intknepmis = 1; ++ if (!core_if->en_multiple_tx_fifo && core_if->dma_enable) ++ diepmsk.b.intknepmis = 0; ++ ++/* if (core_if->dma_desc_enable) { ++ diepmsk.b.bna = 1; ++ } ++*/ ++/* ++ if (core_if->dma_enable) { ++ diepmsk.b.nak = 1; ++ } ++*/ ++ DWC_WRITE_REG32(&dev_if->dev_global_regs->diepeachintmsk[0], ++ diepmsk.d32); ++ } else { ++ daintmsk.b.inep0 = 1; ++ daintmsk.b.outep0 = 1; ++ DWC_WRITE_REG32(&dev_if->dev_global_regs->daintmsk, ++ daintmsk.d32); ++ ++ doepmsk.b.setup = 1; ++ doepmsk.b.xfercompl = 1; ++ doepmsk.b.ahberr = 1; ++ doepmsk.b.epdisabled = 1; ++ ++ if ((core_if->dma_desc_enable) || ++ (core_if->dma_enable ++ && core_if->snpsid >= OTG_CORE_REV_3_00a)) { ++ doepmsk.b.stsphsercvd = 1; ++ } ++ if (core_if->dma_desc_enable) ++ doepmsk.b.bna = 1; ++ DWC_WRITE_REG32(&dev_if->dev_global_regs->doepmsk, doepmsk.d32); ++ ++ diepmsk.b.xfercompl = 1; ++ diepmsk.b.timeout = 1; ++ diepmsk.b.epdisabled = 1; ++ diepmsk.b.ahberr = 1; ++ if (!core_if->en_multiple_tx_fifo && core_if->dma_enable) ++ diepmsk.b.intknepmis = 0; ++/* ++ if (core_if->dma_desc_enable) { ++ diepmsk.b.bna = 1; ++ } ++*/ ++ ++ DWC_WRITE_REG32(&dev_if->dev_global_regs->diepmsk, diepmsk.d32); ++ } ++ ++ /* Reset Device Address */ ++ dcfg.d32 = DWC_READ_REG32(&dev_if->dev_global_regs->dcfg); ++ dcfg.b.devaddr = 0; ++ DWC_WRITE_REG32(&dev_if->dev_global_regs->dcfg, dcfg.d32); ++ ++ /* setup EP0 to receive SETUP packets */ ++ if (core_if->snpsid <= OTG_CORE_REV_2_94a) ++ ep0_out_start(core_if, pcd); ++ ++ /* Clear interrupt */ ++ gintsts.d32 = 0; ++ gintsts.b.usbreset = 1; ++ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, gintsts.d32); ++ ++ return 1; ++} ++ ++/** ++ * Get the device speed from the device status register and convert it ++ * to USB speed constant. ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ */ ++static int get_device_speed(dwc_otg_core_if_t * core_if) ++{ ++ dsts_data_t dsts; ++ int speed = 0; ++ dsts.d32 = DWC_READ_REG32(&core_if->dev_if->dev_global_regs->dsts); ++ ++ switch (dsts.b.enumspd) { ++ case DWC_DSTS_ENUMSPD_HS_PHY_30MHZ_OR_60MHZ: ++ speed = USB_SPEED_HIGH; ++ break; ++ case DWC_DSTS_ENUMSPD_FS_PHY_30MHZ_OR_60MHZ: ++ case DWC_DSTS_ENUMSPD_FS_PHY_48MHZ: ++ speed = USB_SPEED_FULL; ++ break; ++ ++ case DWC_DSTS_ENUMSPD_LS_PHY_6MHZ: ++ speed = USB_SPEED_LOW; ++ break; ++ } ++ ++ return speed; ++} ++ ++/** ++ * Read the device status register and set the device speed in the ++ * data structure. ++ * Set up EP0 to receive SETUP packets by calling dwc_ep0_activate. ++ */ ++int32_t dwc_otg_pcd_handle_enum_done_intr(dwc_otg_pcd_t * pcd) ++{ ++ dwc_otg_pcd_ep_t *ep0 = &pcd->ep0; ++ gintsts_data_t gintsts; ++ gusbcfg_data_t gusbcfg; ++ dwc_otg_core_global_regs_t *global_regs = ++ GET_CORE_IF(pcd)->core_global_regs; ++ uint8_t utmi16b, utmi8b; ++ int speed; ++ DWC_DEBUGPL(DBG_PCD, "SPEED ENUM\n"); ++ ++ if (GET_CORE_IF(pcd)->snpsid >= OTG_CORE_REV_2_60a) { ++ utmi16b = 6; //vahrama old value was 6; ++ utmi8b = 9; ++ } else { ++ utmi16b = 4; ++ utmi8b = 8; ++ } ++ dwc_otg_ep0_activate(GET_CORE_IF(pcd), &ep0->dwc_ep); ++ if (GET_CORE_IF(pcd)->snpsid >= OTG_CORE_REV_3_00a) { ++ ep0_out_start(GET_CORE_IF(pcd), pcd); ++ } ++ ++#ifdef DEBUG_EP0 ++ print_ep0_state(pcd); ++#endif ++ ++ if (pcd->ep0state == EP0_DISCONNECT) { ++ pcd->ep0state = EP0_IDLE; ++ } else if (pcd->ep0state == EP0_STALL) { ++ pcd->ep0state = EP0_IDLE; ++ } ++ ++ pcd->ep0state = EP0_IDLE; ++ ++ ep0->stopped = 0; ++ ++ speed = get_device_speed(GET_CORE_IF(pcd)); ++ pcd->fops->connect(pcd, speed); ++ ++ /* Set USB turnaround time based on device speed and PHY interface. */ ++ gusbcfg.d32 = DWC_READ_REG32(&global_regs->gusbcfg); ++ if (speed == USB_SPEED_HIGH) { ++ if (GET_CORE_IF(pcd)->hwcfg2.b.hs_phy_type == ++ DWC_HWCFG2_HS_PHY_TYPE_ULPI) { ++ /* ULPI interface */ ++ gusbcfg.b.usbtrdtim = 9; ++ } ++ if (GET_CORE_IF(pcd)->hwcfg2.b.hs_phy_type == ++ DWC_HWCFG2_HS_PHY_TYPE_UTMI) { ++ /* UTMI+ interface */ ++ if (GET_CORE_IF(pcd)->hwcfg4.b.utmi_phy_data_width == 0) { ++ gusbcfg.b.usbtrdtim = utmi8b; ++ } else if (GET_CORE_IF(pcd)->hwcfg4. ++ b.utmi_phy_data_width == 1) { ++ gusbcfg.b.usbtrdtim = utmi16b; ++ } else if (GET_CORE_IF(pcd)-> ++ core_params->phy_utmi_width == 8) { ++ gusbcfg.b.usbtrdtim = utmi8b; ++ } else { ++ gusbcfg.b.usbtrdtim = utmi16b; ++ } ++ } ++ if (GET_CORE_IF(pcd)->hwcfg2.b.hs_phy_type == ++ DWC_HWCFG2_HS_PHY_TYPE_UTMI_ULPI) { ++ /* UTMI+ OR ULPI interface */ ++ if (gusbcfg.b.ulpi_utmi_sel == 1) { ++ /* ULPI interface */ ++ gusbcfg.b.usbtrdtim = 9; ++ } else { ++ /* UTMI+ interface */ ++ if (GET_CORE_IF(pcd)-> ++ core_params->phy_utmi_width == 16) { ++ gusbcfg.b.usbtrdtim = utmi16b; ++ } else { ++ gusbcfg.b.usbtrdtim = utmi8b; ++ } ++ } ++ } ++ } else { ++ /* Full or low speed */ ++ gusbcfg.b.usbtrdtim = 9; ++ } ++ DWC_WRITE_REG32(&global_regs->gusbcfg, gusbcfg.d32); ++ ++ /* Clear interrupt */ ++ gintsts.d32 = 0; ++ gintsts.b.enumdone = 1; ++ DWC_WRITE_REG32(&GET_CORE_IF(pcd)->core_global_regs->gintsts, ++ gintsts.d32); ++ return 1; ++} ++ ++/** ++ * This interrupt indicates that the ISO OUT Packet was dropped due to ++ * Rx FIFO full or Rx Status Queue Full. If this interrupt occurs ++ * read all the data from the Rx FIFO. ++ */ ++int32_t dwc_otg_pcd_handle_isoc_out_packet_dropped_intr(dwc_otg_pcd_t * pcd) ++{ ++ gintmsk_data_t intr_mask = {.d32 = 0 }; ++ gintsts_data_t gintsts; ++ ++ DWC_WARN("INTERRUPT Handler not implemented for %s\n", ++ "ISOC Out Dropped"); ++ ++ intr_mask.b.isooutdrop = 1; ++ DWC_MODIFY_REG32(&GET_CORE_IF(pcd)->core_global_regs->gintmsk, ++ intr_mask.d32, 0); ++ ++ /* Clear interrupt */ ++ gintsts.d32 = 0; ++ gintsts.b.isooutdrop = 1; ++ DWC_WRITE_REG32(&GET_CORE_IF(pcd)->core_global_regs->gintsts, ++ gintsts.d32); ++ ++ return 1; ++} ++ ++/** ++ * This interrupt indicates the end of the portion of the micro-frame ++ * for periodic transactions. If there is a periodic transaction for ++ * the next frame, load the packets into the EP periodic Tx FIFO. ++ */ ++int32_t dwc_otg_pcd_handle_end_periodic_frame_intr(dwc_otg_pcd_t * pcd) ++{ ++ gintmsk_data_t intr_mask = {.d32 = 0 }; ++ gintsts_data_t gintsts; ++ DWC_PRINTF("INTERRUPT Handler not implemented for %s\n", "EOP"); ++ ++ intr_mask.b.eopframe = 1; ++ DWC_MODIFY_REG32(&GET_CORE_IF(pcd)->core_global_regs->gintmsk, ++ intr_mask.d32, 0); ++ ++ /* Clear interrupt */ ++ gintsts.d32 = 0; ++ gintsts.b.eopframe = 1; ++ DWC_WRITE_REG32(&GET_CORE_IF(pcd)->core_global_regs->gintsts, ++ gintsts.d32); ++ ++ return 1; ++} ++ ++/** ++ * This interrupt indicates that EP of the packet on the top of the ++ * non-periodic Tx FIFO does not match EP of the IN Token received. ++ * ++ * The "Device IN Token Queue" Registers are read to determine the ++ * order the IN Tokens have been received. The non-periodic Tx FIFO ++ * is flushed, so it can be reloaded in the order seen in the IN Token ++ * Queue. ++ */ ++int32_t dwc_otg_pcd_handle_ep_mismatch_intr(dwc_otg_pcd_t * pcd) ++{ ++ gintsts_data_t gintsts; ++ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); ++ dctl_data_t dctl; ++ gintmsk_data_t intr_mask = {.d32 = 0 }; ++ ++ if (!core_if->en_multiple_tx_fifo && core_if->dma_enable) { ++ core_if->start_predict = 1; ++ ++ DWC_DEBUGPL(DBG_PCDV, "%s(%p)\n", __func__, core_if); ++ ++ gintsts.d32 = DWC_READ_REG32(&core_if->core_global_regs->gintsts); ++ if (!gintsts.b.ginnakeff) { ++ /* Disable EP Mismatch interrupt */ ++ intr_mask.d32 = 0; ++ intr_mask.b.epmismatch = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gintmsk, intr_mask.d32, 0); ++ /* Enable the Global IN NAK Effective Interrupt */ ++ intr_mask.d32 = 0; ++ intr_mask.b.ginnakeff = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gintmsk, 0, intr_mask.d32); ++ /* Set the global non-periodic IN NAK handshake */ ++ dctl.d32 = DWC_READ_REG32(&core_if->dev_if->dev_global_regs->dctl); ++ dctl.b.sgnpinnak = 1; ++ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->dctl, dctl.d32); ++ } else { ++ DWC_PRINTF("gintsts.b.ginnakeff = 1! dctl.b.sgnpinnak not set\n"); ++ } ++ /* Disabling of all EP's will be done in dwc_otg_pcd_handle_in_nak_effective() ++ * handler after Global IN NAK Effective interrupt will be asserted */ ++ } ++ /* Clear interrupt */ ++ gintsts.d32 = 0; ++ gintsts.b.epmismatch = 1; ++ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, gintsts.d32); ++ ++ return 1; ++} ++ ++/** ++ * This interrupt is valid only in DMA mode. This interrupt indicates that the ++ * core has stopped fetching data for IN endpoints due to the unavailability of ++ * TxFIFO space or Request Queue space. This interrupt is used by the ++ * application for an endpoint mismatch algorithm. ++ * ++ * @param pcd The PCD ++ */ ++int32_t dwc_otg_pcd_handle_ep_fetsusp_intr(dwc_otg_pcd_t * pcd) ++{ ++ gintsts_data_t gintsts; ++ gintmsk_data_t gintmsk_data; ++ dctl_data_t dctl; ++ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); ++ DWC_DEBUGPL(DBG_PCDV, "%s(%p)\n", __func__, core_if); ++ ++ /* Clear the global non-periodic IN NAK handshake */ ++ dctl.d32 = 0; ++ dctl.b.cgnpinnak = 1; ++ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs->dctl, dctl.d32, dctl.d32); ++ ++ /* Mask GINTSTS.FETSUSP interrupt */ ++ gintmsk_data.d32 = DWC_READ_REG32(&core_if->core_global_regs->gintmsk); ++ gintmsk_data.b.fetsusp = 0; ++ DWC_WRITE_REG32(&core_if->core_global_regs->gintmsk, gintmsk_data.d32); ++ ++ /* Clear interrupt */ ++ gintsts.d32 = 0; ++ gintsts.b.fetsusp = 1; ++ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, gintsts.d32); ++ ++ return 1; ++} ++/** ++ * This funcion stalls EP0. ++ */ ++static inline void ep0_do_stall(dwc_otg_pcd_t * pcd, const int err_val) ++{ ++ dwc_otg_pcd_ep_t *ep0 = &pcd->ep0; ++ usb_device_request_t *ctrl = &pcd->setup_pkt->req; ++ DWC_WARN("req %02x.%02x protocol STALL; err %d\n", ++ ctrl->bmRequestType, ctrl->bRequest, err_val); ++ ++ ep0->dwc_ep.is_in = 1; ++ dwc_otg_ep_set_stall(GET_CORE_IF(pcd), &ep0->dwc_ep); ++ pcd->ep0.stopped = 1; ++ pcd->ep0state = EP0_IDLE; ++ ep0_out_start(GET_CORE_IF(pcd), pcd); ++} ++ ++/** ++ * This functions delegates the setup command to the gadget driver. ++ */ ++static inline void do_gadget_setup(dwc_otg_pcd_t * pcd, ++ usb_device_request_t * ctrl) ++{ ++ int ret = 0; ++ DWC_SPINUNLOCK(pcd->lock); ++ ret = pcd->fops->setup(pcd, (uint8_t *) ctrl); ++ DWC_SPINLOCK(pcd->lock); ++ if (ret < 0) { ++ ep0_do_stall(pcd, ret); ++ } ++ ++ /** @todo This is a g_file_storage gadget driver specific ++ * workaround: a DELAYED_STATUS result from the fsg_setup ++ * routine will result in the gadget queueing a EP0 IN status ++ * phase for a two-stage control transfer. Exactly the same as ++ * a SET_CONFIGURATION/SET_INTERFACE except that this is a class ++ * specific request. Need a generic way to know when the gadget ++ * driver will queue the status phase. Can we assume when we ++ * call the gadget driver setup() function that it will always ++ * queue and require the following flag? Need to look into ++ * this. ++ */ ++ ++ if (ret == 256 + 999) { ++ pcd->request_config = 1; ++ } ++} ++ ++#ifdef DWC_UTE_CFI ++/** ++ * This functions delegates the CFI setup commands to the gadget driver. ++ * This function will return a negative value to indicate a failure. ++ */ ++static inline int cfi_gadget_setup(dwc_otg_pcd_t * pcd, ++ struct cfi_usb_ctrlrequest *ctrl_req) ++{ ++ int ret = 0; ++ ++ if (pcd->fops && pcd->fops->cfi_setup) { ++ DWC_SPINUNLOCK(pcd->lock); ++ ret = pcd->fops->cfi_setup(pcd, ctrl_req); ++ DWC_SPINLOCK(pcd->lock); ++ if (ret < 0) { ++ ep0_do_stall(pcd, ret); ++ return ret; ++ } ++ } ++ ++ return ret; ++} ++#endif ++ ++/** ++ * This function starts the Zero-Length Packet for the IN status phase ++ * of a 2 stage control transfer. ++ */ ++static inline void do_setup_in_status_phase(dwc_otg_pcd_t * pcd) ++{ ++ dwc_otg_pcd_ep_t *ep0 = &pcd->ep0; ++ if (pcd->ep0state == EP0_STALL) { ++ return; ++ } ++ ++ pcd->ep0state = EP0_IN_STATUS_PHASE; ++ ++ /* Prepare for more SETUP Packets */ ++ DWC_DEBUGPL(DBG_PCD, "EP0 IN ZLP\n"); ++ if ((GET_CORE_IF(pcd)->snpsid >= OTG_CORE_REV_3_00a) ++ && (pcd->core_if->dma_desc_enable) ++ && (ep0->dwc_ep.xfer_count < ep0->dwc_ep.total_len)) { ++ DWC_DEBUGPL(DBG_PCDV, ++ "Data terminated wait next packet in out_desc_addr\n"); ++ pcd->backup_buf = phys_to_virt(ep0->dwc_ep.dma_addr); ++ pcd->data_terminated = 1; ++ } ++ ep0->dwc_ep.xfer_len = 0; ++ ep0->dwc_ep.xfer_count = 0; ++ ep0->dwc_ep.is_in = 1; ++ ep0->dwc_ep.dma_addr = pcd->setup_pkt_dma_handle; ++ dwc_otg_ep0_start_transfer(GET_CORE_IF(pcd), &ep0->dwc_ep); ++ ++ /* Prepare for more SETUP Packets */ ++ //ep0_out_start(GET_CORE_IF(pcd), pcd); ++} ++ ++/** ++ * This function starts the Zero-Length Packet for the OUT status phase ++ * of a 2 stage control transfer. ++ */ ++static inline void do_setup_out_status_phase(dwc_otg_pcd_t * pcd) ++{ ++ dwc_otg_pcd_ep_t *ep0 = &pcd->ep0; ++ if (pcd->ep0state == EP0_STALL) { ++ DWC_DEBUGPL(DBG_PCD, "EP0 STALLED\n"); ++ return; ++ } ++ pcd->ep0state = EP0_OUT_STATUS_PHASE; ++ ++ DWC_DEBUGPL(DBG_PCD, "EP0 OUT ZLP\n"); ++ ep0->dwc_ep.xfer_len = 0; ++ ep0->dwc_ep.xfer_count = 0; ++ ep0->dwc_ep.is_in = 0; ++ ep0->dwc_ep.dma_addr = pcd->setup_pkt_dma_handle; ++ dwc_otg_ep0_start_transfer(GET_CORE_IF(pcd), &ep0->dwc_ep); ++ ++ /* Prepare for more SETUP Packets */ ++ if (GET_CORE_IF(pcd)->dma_enable == 0) { ++ ep0_out_start(GET_CORE_IF(pcd), pcd); ++ } ++} ++ ++/** ++ * Clear the EP halt (STALL) and if pending requests start the ++ * transfer. ++ */ ++static inline void pcd_clear_halt(dwc_otg_pcd_t * pcd, dwc_otg_pcd_ep_t * ep) ++{ ++ if (ep->dwc_ep.stall_clear_flag == 0) ++ dwc_otg_ep_clear_stall(GET_CORE_IF(pcd), &ep->dwc_ep); ++ ++ /* Reactive the EP */ ++ dwc_otg_ep_activate(GET_CORE_IF(pcd), &ep->dwc_ep); ++ if (ep->stopped) { ++ ep->stopped = 0; ++ /* If there is a request in the EP queue start it */ ++ ++ /** @todo FIXME: this causes an EP mismatch in DMA mode. ++ * epmismatch not yet implemented. */ ++ ++ /* ++ * Above fixme is solved by implmenting a tasklet to call the ++ * start_next_request(), outside of interrupt context at some ++ * time after the current time, after a clear-halt setup packet. ++ * Still need to implement ep mismatch in the future if a gadget ++ * ever uses more than one endpoint at once ++ */ ++ ep->queue_sof = 1; ++ DWC_TASK_SCHEDULE(pcd->start_xfer_tasklet); ++ } ++ /* Start Control Status Phase */ ++ do_setup_in_status_phase(pcd); ++} ++ ++/** ++ * This function is called when the SET_FEATURE TEST_MODE Setup packet ++ * is sent from the host. The Device Control register is written with ++ * the Test Mode bits set to the specified Test Mode. This is done as ++ * a tasklet so that the "Status" phase of the control transfer ++ * completes before transmitting the TEST packets. ++ * ++ * @todo This has not been tested since the tasklet struct was put ++ * into the PCD struct! ++ * ++ */ ++void do_test_mode(void *data) ++{ ++ dctl_data_t dctl; ++ dwc_otg_pcd_t *pcd = (dwc_otg_pcd_t *) data; ++ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); ++ int test_mode = pcd->test_mode; ++ ++// DWC_WARN("%s() has not been tested since being rewritten!\n", __func__); ++ ++ dctl.d32 = DWC_READ_REG32(&core_if->dev_if->dev_global_regs->dctl); ++ switch (test_mode) { ++ case 1: // TEST_J ++ dctl.b.tstctl = 1; ++ break; ++ ++ case 2: // TEST_K ++ dctl.b.tstctl = 2; ++ break; ++ ++ case 3: // TEST_SE0_NAK ++ dctl.b.tstctl = 3; ++ break; ++ ++ case 4: // TEST_PACKET ++ dctl.b.tstctl = 4; ++ break; ++ ++ case 5: // TEST_FORCE_ENABLE ++ dctl.b.tstctl = 5; ++ break; ++ } ++ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->dctl, dctl.d32); ++} ++ ++/** ++ * This function process the GET_STATUS Setup Commands. ++ */ ++static inline void do_get_status(dwc_otg_pcd_t * pcd) ++{ ++ usb_device_request_t ctrl = pcd->setup_pkt->req; ++ dwc_otg_pcd_ep_t *ep; ++ dwc_otg_pcd_ep_t *ep0 = &pcd->ep0; ++ uint16_t *status = pcd->status_buf; ++ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); ++ ++#ifdef DEBUG_EP0 ++ DWC_DEBUGPL(DBG_PCD, ++ "GET_STATUS %02x.%02x v%04x i%04x l%04x\n", ++ ctrl.bmRequestType, ctrl.bRequest, ++ UGETW(ctrl.wValue), UGETW(ctrl.wIndex), ++ UGETW(ctrl.wLength)); ++#endif ++ ++ switch (UT_GET_RECIPIENT(ctrl.bmRequestType)) { ++ case UT_DEVICE: ++ if(UGETW(ctrl.wIndex) == 0xF000) { /* OTG Status selector */ ++ DWC_PRINTF("wIndex - %d\n", UGETW(ctrl.wIndex)); ++ DWC_PRINTF("OTG VERSION - %d\n", core_if->otg_ver); ++ DWC_PRINTF("OTG CAP - %d, %d\n", ++ core_if->core_params->otg_cap, ++ DWC_OTG_CAP_PARAM_HNP_SRP_CAPABLE); ++ if (core_if->otg_ver == 1 ++ && core_if->core_params->otg_cap == ++ DWC_OTG_CAP_PARAM_HNP_SRP_CAPABLE) { ++ uint8_t *otgsts = (uint8_t*)pcd->status_buf; ++ *otgsts = (core_if->otg_sts & 0x1); ++ pcd->ep0_pending = 1; ++ ep0->dwc_ep.start_xfer_buff = ++ (uint8_t *) otgsts; ++ ep0->dwc_ep.xfer_buff = (uint8_t *) otgsts; ++ ep0->dwc_ep.dma_addr = ++ pcd->status_buf_dma_handle; ++ ep0->dwc_ep.xfer_len = 1; ++ ep0->dwc_ep.xfer_count = 0; ++ ep0->dwc_ep.total_len = ep0->dwc_ep.xfer_len; ++ dwc_otg_ep0_start_transfer(GET_CORE_IF(pcd), ++ &ep0->dwc_ep); ++ return; ++ } else { ++ ep0_do_stall(pcd, -DWC_E_NOT_SUPPORTED); ++ return; ++ } ++ break; ++ } else { ++ *status = 0x1; /* Self powered */ ++ *status |= pcd->remote_wakeup_enable << 1; ++ break; ++ } ++ case UT_INTERFACE: ++ *status = 0; ++ break; ++ ++ case UT_ENDPOINT: ++ ep = get_ep_by_addr(pcd, UGETW(ctrl.wIndex)); ++ if (ep == 0 || UGETW(ctrl.wLength) > 2) { ++ ep0_do_stall(pcd, -DWC_E_NOT_SUPPORTED); ++ return; ++ } ++ /** @todo check for EP stall */ ++ *status = ep->stopped; ++ break; ++ } ++ pcd->ep0_pending = 1; ++ ep0->dwc_ep.start_xfer_buff = (uint8_t *) status; ++ ep0->dwc_ep.xfer_buff = (uint8_t *) status; ++ ep0->dwc_ep.dma_addr = pcd->status_buf_dma_handle; ++ ep0->dwc_ep.xfer_len = 2; ++ ep0->dwc_ep.xfer_count = 0; ++ ep0->dwc_ep.total_len = ep0->dwc_ep.xfer_len; ++ dwc_otg_ep0_start_transfer(GET_CORE_IF(pcd), &ep0->dwc_ep); ++} ++ ++/** ++ * This function process the SET_FEATURE Setup Commands. ++ */ ++static inline void do_set_feature(dwc_otg_pcd_t * pcd) ++{ ++ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); ++ dwc_otg_core_global_regs_t *global_regs = core_if->core_global_regs; ++ usb_device_request_t ctrl = pcd->setup_pkt->req; ++ dwc_otg_pcd_ep_t *ep = 0; ++ int32_t otg_cap_param = core_if->core_params->otg_cap; ++ gotgctl_data_t gotgctl = {.d32 = 0 }; ++ ++ DWC_DEBUGPL(DBG_PCD, "SET_FEATURE:%02x.%02x v%04x i%04x l%04x\n", ++ ctrl.bmRequestType, ctrl.bRequest, ++ UGETW(ctrl.wValue), UGETW(ctrl.wIndex), ++ UGETW(ctrl.wLength)); ++ DWC_DEBUGPL(DBG_PCD, "otg_cap=%d\n", otg_cap_param); ++ ++ switch (UT_GET_RECIPIENT(ctrl.bmRequestType)) { ++ case UT_DEVICE: ++ switch (UGETW(ctrl.wValue)) { ++ case UF_DEVICE_REMOTE_WAKEUP: ++ pcd->remote_wakeup_enable = 1; ++ break; ++ ++ case UF_TEST_MODE: ++ /* Setup the Test Mode tasklet to do the Test ++ * Packet generation after the SETUP Status ++ * phase has completed. */ ++ ++ /** @todo This has not been tested since the ++ * tasklet struct was put into the PCD ++ * struct! */ ++ pcd->test_mode = UGETW(ctrl.wIndex) >> 8; ++ DWC_TASK_SCHEDULE(pcd->test_mode_tasklet); ++ break; ++ ++ case UF_DEVICE_B_HNP_ENABLE: ++ DWC_DEBUGPL(DBG_PCDV, ++ "SET_FEATURE: USB_DEVICE_B_HNP_ENABLE\n"); ++ ++ /* dev may initiate HNP */ ++ if (otg_cap_param == DWC_OTG_CAP_PARAM_HNP_SRP_CAPABLE) { ++ pcd->b_hnp_enable = 1; ++ dwc_otg_pcd_update_otg(pcd, 0); ++ DWC_DEBUGPL(DBG_PCD, "Request B HNP\n"); ++ /**@todo Is the gotgctl.devhnpen cleared ++ * by a USB Reset? */ ++ gotgctl.b.devhnpen = 1; ++ gotgctl.b.hnpreq = 1; ++ DWC_WRITE_REG32(&global_regs->gotgctl, ++ gotgctl.d32); ++ } else { ++ ep0_do_stall(pcd, -DWC_E_NOT_SUPPORTED); ++ return; ++ } ++ break; ++ ++ case UF_DEVICE_A_HNP_SUPPORT: ++ /* RH port supports HNP */ ++ DWC_DEBUGPL(DBG_PCDV, ++ "SET_FEATURE: USB_DEVICE_A_HNP_SUPPORT\n"); ++ if (otg_cap_param == DWC_OTG_CAP_PARAM_HNP_SRP_CAPABLE) { ++ pcd->a_hnp_support = 1; ++ dwc_otg_pcd_update_otg(pcd, 0); ++ } else { ++ ep0_do_stall(pcd, -DWC_E_NOT_SUPPORTED); ++ return; ++ } ++ break; ++ ++ case UF_DEVICE_A_ALT_HNP_SUPPORT: ++ /* other RH port does */ ++ DWC_DEBUGPL(DBG_PCDV, ++ "SET_FEATURE: USB_DEVICE_A_ALT_HNP_SUPPORT\n"); ++ if (otg_cap_param == DWC_OTG_CAP_PARAM_HNP_SRP_CAPABLE) { ++ pcd->a_alt_hnp_support = 1; ++ dwc_otg_pcd_update_otg(pcd, 0); ++ } else { ++ ep0_do_stall(pcd, -DWC_E_NOT_SUPPORTED); ++ return; ++ } ++ break; ++ ++ default: ++ ep0_do_stall(pcd, -DWC_E_NOT_SUPPORTED); ++ return; ++ ++ } ++ do_setup_in_status_phase(pcd); ++ break; ++ ++ case UT_INTERFACE: ++ do_gadget_setup(pcd, &ctrl); ++ break; ++ ++ case UT_ENDPOINT: ++ if (UGETW(ctrl.wValue) == UF_ENDPOINT_HALT) { ++ ep = get_ep_by_addr(pcd, UGETW(ctrl.wIndex)); ++ if (ep == 0) { ++ ep0_do_stall(pcd, -DWC_E_NOT_SUPPORTED); ++ return; ++ } ++ ep->stopped = 1; ++ dwc_otg_ep_set_stall(core_if, &ep->dwc_ep); ++ } ++ do_setup_in_status_phase(pcd); ++ break; ++ } ++} ++ ++/** ++ * This function process the CLEAR_FEATURE Setup Commands. ++ */ ++static inline void do_clear_feature(dwc_otg_pcd_t * pcd) ++{ ++ usb_device_request_t ctrl = pcd->setup_pkt->req; ++ dwc_otg_pcd_ep_t *ep = 0; ++ ++ DWC_DEBUGPL(DBG_PCD, ++ "CLEAR_FEATURE:%02x.%02x v%04x i%04x l%04x\n", ++ ctrl.bmRequestType, ctrl.bRequest, ++ UGETW(ctrl.wValue), UGETW(ctrl.wIndex), ++ UGETW(ctrl.wLength)); ++ ++ switch (UT_GET_RECIPIENT(ctrl.bmRequestType)) { ++ case UT_DEVICE: ++ switch (UGETW(ctrl.wValue)) { ++ case UF_DEVICE_REMOTE_WAKEUP: ++ pcd->remote_wakeup_enable = 0; ++ break; ++ ++ case UF_TEST_MODE: ++ /** @todo Add CLEAR_FEATURE for TEST modes. */ ++ break; ++ ++ default: ++ ep0_do_stall(pcd, -DWC_E_NOT_SUPPORTED); ++ return; ++ } ++ do_setup_in_status_phase(pcd); ++ break; ++ ++ case UT_ENDPOINT: ++ ep = get_ep_by_addr(pcd, UGETW(ctrl.wIndex)); ++ if (ep == 0) { ++ ep0_do_stall(pcd, -DWC_E_NOT_SUPPORTED); ++ return; ++ } ++ ++ pcd_clear_halt(pcd, ep); ++ ++ break; ++ } ++} ++ ++/** ++ * This function process the SET_ADDRESS Setup Commands. ++ */ ++static inline void do_set_address(dwc_otg_pcd_t * pcd) ++{ ++ dwc_otg_dev_if_t *dev_if = GET_CORE_IF(pcd)->dev_if; ++ usb_device_request_t ctrl = pcd->setup_pkt->req; ++ ++ if (ctrl.bmRequestType == UT_DEVICE) { ++ dcfg_data_t dcfg = {.d32 = 0 }; ++ ++#ifdef DEBUG_EP0 ++// DWC_DEBUGPL(DBG_PCDV, "SET_ADDRESS:%d\n", ctrl.wValue); ++#endif ++ dcfg.b.devaddr = UGETW(ctrl.wValue); ++ DWC_MODIFY_REG32(&dev_if->dev_global_regs->dcfg, 0, dcfg.d32); ++ do_setup_in_status_phase(pcd); ++ } ++} ++ ++/** ++ * This function processes SETUP commands. In Linux, the USB Command ++ * processing is done in two places - the first being the PCD and the ++ * second in the Gadget Driver (for example, the File-Backed Storage ++ * Gadget Driver). ++ * ++ * <table> ++ * <tr><td>Command </td><td>Driver </td><td>Description</td></tr> ++ * ++ * <tr><td>GET_STATUS </td><td>PCD </td><td>Command is processed as ++ * defined in chapter 9 of the USB 2.0 Specification chapter 9 ++ * </td></tr> ++ * ++ * <tr><td>CLEAR_FEATURE </td><td>PCD </td><td>The Device and Endpoint ++ * requests are the ENDPOINT_HALT feature is procesed, all others the ++ * interface requests are ignored.</td></tr> ++ * ++ * <tr><td>SET_FEATURE </td><td>PCD </td><td>The Device and Endpoint ++ * requests are processed by the PCD. Interface requests are passed ++ * to the Gadget Driver.</td></tr> ++ * ++ * <tr><td>SET_ADDRESS </td><td>PCD </td><td>Program the DCFG reg, ++ * with device address received </td></tr> ++ * ++ * <tr><td>GET_DESCRIPTOR </td><td>Gadget Driver </td><td>Return the ++ * requested descriptor</td></tr> ++ * ++ * <tr><td>SET_DESCRIPTOR </td><td>Gadget Driver </td><td>Optional - ++ * not implemented by any of the existing Gadget Drivers.</td></tr> ++ * ++ * <tr><td>SET_CONFIGURATION </td><td>Gadget Driver </td><td>Disable ++ * all EPs and enable EPs for new configuration.</td></tr> ++ * ++ * <tr><td>GET_CONFIGURATION </td><td>Gadget Driver </td><td>Return ++ * the current configuration</td></tr> ++ * ++ * <tr><td>SET_INTERFACE </td><td>Gadget Driver </td><td>Disable all ++ * EPs and enable EPs for new configuration.</td></tr> ++ * ++ * <tr><td>GET_INTERFACE </td><td>Gadget Driver </td><td>Return the ++ * current interface.</td></tr> ++ * ++ * <tr><td>SYNC_FRAME </td><td>PCD </td><td>Display debug ++ * message.</td></tr> ++ * </table> ++ * ++ * When the SETUP Phase Done interrupt occurs, the PCD SETUP commands are ++ * processed by pcd_setup. Calling the Function Driver's setup function from ++ * pcd_setup processes the gadget SETUP commands. ++ */ ++static inline void pcd_setup(dwc_otg_pcd_t * pcd) ++{ ++ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); ++ dwc_otg_dev_if_t *dev_if = core_if->dev_if; ++ usb_device_request_t ctrl = pcd->setup_pkt->req; ++ dwc_otg_pcd_ep_t *ep0 = &pcd->ep0; ++ ++ deptsiz0_data_t doeptsize0 = {.d32 = 0 }; ++ ++#ifdef DWC_UTE_CFI ++ int retval = 0; ++ struct cfi_usb_ctrlrequest cfi_req; ++#endif ++ ++ doeptsize0.d32 = DWC_READ_REG32(&dev_if->out_ep_regs[0]->doeptsiz); ++ ++ /** In BDMA more then 1 setup packet is not supported till 3.00a */ ++ if (core_if->dma_enable && core_if->dma_desc_enable == 0 ++ && (doeptsize0.b.supcnt < 2) ++ && (core_if->snpsid < OTG_CORE_REV_2_94a)) { ++ DWC_ERROR ++ ("\n\n----------- CANNOT handle > 1 setup packet in DMA mode\n\n"); ++ } ++ if ((core_if->snpsid >= OTG_CORE_REV_3_00a) ++ && (core_if->dma_enable == 1) && (core_if->dma_desc_enable == 0)) { ++ ctrl = ++ (pcd->setup_pkt + ++ (3 - doeptsize0.b.supcnt - 1 + ++ ep0->dwc_ep.stp_rollover))->req; ++ } ++#ifdef DEBUG_EP0 ++ DWC_DEBUGPL(DBG_PCD, "SETUP %02x.%02x v%04x i%04x l%04x\n", ++ ctrl.bmRequestType, ctrl.bRequest, ++ UGETW(ctrl.wValue), UGETW(ctrl.wIndex), ++ UGETW(ctrl.wLength)); ++#endif ++ ++ /* Clean up the request queue */ ++ dwc_otg_request_nuke(ep0); ++ ep0->stopped = 0; ++ ++ if (ctrl.bmRequestType & UE_DIR_IN) { ++ ep0->dwc_ep.is_in = 1; ++ pcd->ep0state = EP0_IN_DATA_PHASE; ++ } else { ++ ep0->dwc_ep.is_in = 0; ++ pcd->ep0state = EP0_OUT_DATA_PHASE; ++ } ++ ++ if (UGETW(ctrl.wLength) == 0) { ++ ep0->dwc_ep.is_in = 1; ++ pcd->ep0state = EP0_IN_STATUS_PHASE; ++ } ++ ++ if (UT_GET_TYPE(ctrl.bmRequestType) != UT_STANDARD) { ++ ++#ifdef DWC_UTE_CFI ++ DWC_MEMCPY(&cfi_req, &ctrl, sizeof(usb_device_request_t)); ++ ++ //printk(KERN_ALERT "CFI: req_type=0x%02x; req=0x%02x\n", ++ ctrl.bRequestType, ctrl.bRequest); ++ if (UT_GET_TYPE(cfi_req.bRequestType) == UT_VENDOR) { ++ if (cfi_req.bRequest > 0xB0 && cfi_req.bRequest < 0xBF) { ++ retval = cfi_setup(pcd, &cfi_req); ++ if (retval < 0) { ++ ep0_do_stall(pcd, retval); ++ pcd->ep0_pending = 0; ++ return; ++ } ++ ++ /* if need gadget setup then call it and check the retval */ ++ if (pcd->cfi->need_gadget_att) { ++ retval = ++ cfi_gadget_setup(pcd, ++ &pcd-> ++ cfi->ctrl_req); ++ if (retval < 0) { ++ pcd->ep0_pending = 0; ++ return; ++ } ++ } ++ ++ if (pcd->cfi->need_status_in_complete) { ++ do_setup_in_status_phase(pcd); ++ } ++ return; ++ } ++ } ++#endif ++ ++ /* handle non-standard (class/vendor) requests in the gadget driver */ ++ do_gadget_setup(pcd, &ctrl); ++ return; ++ } ++ ++ /** @todo NGS: Handle bad setup packet? */ ++ ++/////////////////////////////////////////// ++//// --- Standard Request handling --- //// ++ ++ switch (ctrl.bRequest) { ++ case UR_GET_STATUS: ++ do_get_status(pcd); ++ break; ++ ++ case UR_CLEAR_FEATURE: ++ do_clear_feature(pcd); ++ break; ++ ++ case UR_SET_FEATURE: ++ do_set_feature(pcd); ++ break; ++ ++ case UR_SET_ADDRESS: ++ do_set_address(pcd); ++ break; ++ ++ case UR_SET_INTERFACE: ++ case UR_SET_CONFIG: ++// _pcd->request_config = 1; /* Configuration changed */ ++ do_gadget_setup(pcd, &ctrl); ++ break; ++ ++ case UR_SYNCH_FRAME: ++ do_gadget_setup(pcd, &ctrl); ++ break; ++ ++ default: ++ /* Call the Gadget Driver's setup functions */ ++ do_gadget_setup(pcd, &ctrl); ++ break; ++ } ++} ++ ++/** ++ * This function completes the ep0 control transfer. ++ */ ++static int32_t ep0_complete_request(dwc_otg_pcd_ep_t * ep) ++{ ++ dwc_otg_core_if_t *core_if = GET_CORE_IF(ep->pcd); ++ dwc_otg_dev_if_t *dev_if = core_if->dev_if; ++ dwc_otg_dev_in_ep_regs_t *in_ep_regs = ++ dev_if->in_ep_regs[ep->dwc_ep.num]; ++#ifdef DEBUG_EP0 ++ dwc_otg_dev_out_ep_regs_t *out_ep_regs = ++ dev_if->out_ep_regs[ep->dwc_ep.num]; ++#endif ++ deptsiz0_data_t deptsiz; ++ dev_dma_desc_sts_t desc_sts; ++ dwc_otg_pcd_request_t *req; ++ int is_last = 0; ++ dwc_otg_pcd_t *pcd = ep->pcd; ++ ++#ifdef DWC_UTE_CFI ++ struct cfi_usb_ctrlrequest *ctrlreq; ++ int retval = -DWC_E_NOT_SUPPORTED; ++#endif ++ ++ desc_sts.b.bytes = 0; ++ ++ if (pcd->ep0_pending && DWC_CIRCLEQ_EMPTY(&ep->queue)) { ++ if (ep->dwc_ep.is_in) { ++#ifdef DEBUG_EP0 ++ DWC_DEBUGPL(DBG_PCDV, "Do setup OUT status phase\n"); ++#endif ++ do_setup_out_status_phase(pcd); ++ } else { ++#ifdef DEBUG_EP0 ++ DWC_DEBUGPL(DBG_PCDV, "Do setup IN status phase\n"); ++#endif ++ ++#ifdef DWC_UTE_CFI ++ ctrlreq = &pcd->cfi->ctrl_req; ++ ++ if (UT_GET_TYPE(ctrlreq->bRequestType) == UT_VENDOR) { ++ if (ctrlreq->bRequest > 0xB0 ++ && ctrlreq->bRequest < 0xBF) { ++ ++ /* Return if the PCD failed to handle the request */ ++ if ((retval = ++ pcd->cfi->ops. ++ ctrl_write_complete(pcd->cfi, ++ pcd)) < 0) { ++ CFI_INFO ++ ("ERROR setting a new value in the PCD(%d)\n", ++ retval); ++ ep0_do_stall(pcd, retval); ++ pcd->ep0_pending = 0; ++ return 0; ++ } ++ ++ /* If the gadget needs to be notified on the request */ ++ if (pcd->cfi->need_gadget_att == 1) { ++ //retval = do_gadget_setup(pcd, &pcd->cfi->ctrl_req); ++ retval = ++ cfi_gadget_setup(pcd, ++ &pcd->cfi-> ++ ctrl_req); ++ ++ /* Return from the function if the gadget failed to process ++ * the request properly - this should never happen !!! ++ */ ++ if (retval < 0) { ++ CFI_INFO ++ ("ERROR setting a new value in the gadget(%d)\n", ++ retval); ++ pcd->ep0_pending = 0; ++ return 0; ++ } ++ } ++ ++ CFI_INFO("%s: RETVAL=%d\n", __func__, ++ retval); ++ /* If we hit here then the PCD and the gadget has properly ++ * handled the request - so send the ZLP IN to the host. ++ */ ++ /* @todo: MAS - decide whether we need to start the setup ++ * stage based on the need_setup value of the cfi object ++ */ ++ do_setup_in_status_phase(pcd); ++ pcd->ep0_pending = 0; ++ return 1; ++ } ++ } ++#endif ++ ++ do_setup_in_status_phase(pcd); ++ } ++ pcd->ep0_pending = 0; ++ return 1; ++ } ++ ++ if (DWC_CIRCLEQ_EMPTY(&ep->queue)) { ++ return 0; ++ } ++ req = DWC_CIRCLEQ_FIRST(&ep->queue); ++ ++ if (pcd->ep0state == EP0_OUT_STATUS_PHASE ++ || pcd->ep0state == EP0_IN_STATUS_PHASE) { ++ is_last = 1; ++ } else if (ep->dwc_ep.is_in) { ++ deptsiz.d32 = DWC_READ_REG32(&in_ep_regs->dieptsiz); ++ if (core_if->dma_desc_enable != 0) ++ desc_sts = dev_if->in_desc_addr->status; ++#ifdef DEBUG_EP0 ++ DWC_DEBUGPL(DBG_PCDV, "%d len=%d xfersize=%d pktcnt=%d\n", ++ ep->dwc_ep.num, ep->dwc_ep.xfer_len, ++ deptsiz.b.xfersize, deptsiz.b.pktcnt); ++#endif ++ ++ if (((core_if->dma_desc_enable == 0) ++ && (deptsiz.b.xfersize == 0)) ++ || ((core_if->dma_desc_enable != 0) ++ && (desc_sts.b.bytes == 0))) { ++ req->actual = ep->dwc_ep.xfer_count; ++ /* Is a Zero Len Packet needed? */ ++ if (req->sent_zlp) { ++#ifdef DEBUG_EP0 ++ DWC_DEBUGPL(DBG_PCD, "Setup Rx ZLP\n"); ++#endif ++ req->sent_zlp = 0; ++ } ++ do_setup_out_status_phase(pcd); ++ } ++ } else { ++ /* ep0-OUT */ ++#ifdef DEBUG_EP0 ++ deptsiz.d32 = DWC_READ_REG32(&out_ep_regs->doeptsiz); ++ DWC_DEBUGPL(DBG_PCDV, "%d len=%d xsize=%d pktcnt=%d\n", ++ ep->dwc_ep.num, ep->dwc_ep.xfer_len, ++ deptsiz.b.xfersize, deptsiz.b.pktcnt); ++#endif ++ req->actual = ep->dwc_ep.xfer_count; ++ ++ /* Is a Zero Len Packet needed? */ ++ if (req->sent_zlp) { ++#ifdef DEBUG_EP0 ++ DWC_DEBUGPL(DBG_PCDV, "Setup Tx ZLP\n"); ++#endif ++ req->sent_zlp = 0; ++ } ++ /* For older cores do setup in status phase in Slave/BDMA modes, ++ * starting from 3.00 do that only in slave, and for DMA modes ++ * just re-enable ep 0 OUT here*/ ++ if (core_if->dma_enable == 0 ++ || (core_if->dma_desc_enable == 0 ++ && core_if->snpsid <= OTG_CORE_REV_2_94a)) { ++ do_setup_in_status_phase(pcd); ++ } else if (core_if->snpsid >= OTG_CORE_REV_3_00a) { ++ DWC_DEBUGPL(DBG_PCDV, ++ "Enable out ep before in status phase\n"); ++ ep0_out_start(core_if, pcd); ++ } ++ } ++ ++ /* Complete the request */ ++ if (is_last) { ++ dwc_otg_request_done(ep, req, 0); ++ ep->dwc_ep.start_xfer_buff = 0; ++ ep->dwc_ep.xfer_buff = 0; ++ ep->dwc_ep.xfer_len = 0; ++ return 1; ++ } ++ return 0; ++} ++ ++#ifdef DWC_UTE_CFI ++/** ++ * This function calculates traverses all the CFI DMA descriptors and ++ * and accumulates the bytes that are left to be transfered. ++ * ++ * @return The total bytes left to transfered, or a negative value as failure ++ */ ++static inline int cfi_calc_desc_residue(dwc_otg_pcd_ep_t * ep) ++{ ++ int32_t ret = 0; ++ int i; ++ struct dwc_otg_dma_desc *ddesc = NULL; ++ struct cfi_ep *cfiep; ++ ++ /* See if the pcd_ep has its respective cfi_ep mapped */ ++ cfiep = get_cfi_ep_by_pcd_ep(ep->pcd->cfi, ep); ++ if (!cfiep) { ++ CFI_INFO("%s: Failed to find ep\n", __func__); ++ return -1; ++ } ++ ++ ddesc = ep->dwc_ep.descs; ++ ++ for (i = 0; (i < cfiep->desc_count) && (i < MAX_DMA_DESCS_PER_EP); i++) { ++ ++#if defined(PRINT_CFI_DMA_DESCS) ++ print_desc(ddesc, ep->ep.name, i); ++#endif ++ ret += ddesc->status.b.bytes; ++ ddesc++; ++ } ++ ++ if (ret) ++ CFI_INFO("!!!!!!!!!! WARNING (%s) - residue=%d\n", __func__, ++ ret); ++ ++ return ret; ++} ++#endif ++ ++/** ++ * This function completes the request for the EP. If there are ++ * additional requests for the EP in the queue they will be started. ++ */ ++static void complete_ep(dwc_otg_pcd_ep_t * ep) ++{ ++ dwc_otg_core_if_t *core_if = GET_CORE_IF(ep->pcd); ++ dwc_otg_dev_if_t *dev_if = core_if->dev_if; ++ dwc_otg_dev_in_ep_regs_t *in_ep_regs = ++ dev_if->in_ep_regs[ep->dwc_ep.num]; ++ deptsiz_data_t deptsiz; ++ dev_dma_desc_sts_t desc_sts; ++ dwc_otg_pcd_request_t *req = 0; ++ dwc_otg_dev_dma_desc_t *dma_desc; ++ uint32_t byte_count = 0; ++ int is_last = 0; ++ int i; ++ ++ DWC_DEBUGPL(DBG_PCDV, "%s() %d-%s\n", __func__, ep->dwc_ep.num, ++ (ep->dwc_ep.is_in ? "IN" : "OUT")); ++ ++ /* Get any pending requests */ ++ if (!DWC_CIRCLEQ_EMPTY(&ep->queue)) { ++ req = DWC_CIRCLEQ_FIRST(&ep->queue); ++ if (!req) { ++ DWC_PRINTF("complete_ep 0x%p, req = NULL!\n", ep); ++ return; ++ } ++ } else { ++ DWC_PRINTF("complete_ep 0x%p, ep->queue empty!\n", ep); ++ return; ++ } ++ ++ DWC_DEBUGPL(DBG_PCD, "Requests %d\n", ep->pcd->request_pending); ++ ++ if (ep->dwc_ep.is_in) { ++ deptsiz.d32 = DWC_READ_REG32(&in_ep_regs->dieptsiz); ++ ++ if (core_if->dma_enable) { ++ if (core_if->dma_desc_enable == 0) { ++ if (deptsiz.b.xfersize == 0 ++ && deptsiz.b.pktcnt == 0) { ++ byte_count = ++ ep->dwc_ep.xfer_len - ++ ep->dwc_ep.xfer_count; ++ ++ ep->dwc_ep.xfer_buff += byte_count; ++ ep->dwc_ep.dma_addr += byte_count; ++ ep->dwc_ep.xfer_count += byte_count; ++ ++ DWC_DEBUGPL(DBG_PCDV, ++ "%d-%s len=%d xfersize=%d pktcnt=%d\n", ++ ep->dwc_ep.num, ++ (ep->dwc_ep. ++ is_in ? "IN" : "OUT"), ++ ep->dwc_ep.xfer_len, ++ deptsiz.b.xfersize, ++ deptsiz.b.pktcnt); ++ ++ if (ep->dwc_ep.xfer_len < ++ ep->dwc_ep.total_len) { ++ dwc_otg_ep_start_transfer ++ (core_if, &ep->dwc_ep); ++ } else if (ep->dwc_ep.sent_zlp) { ++ /* ++ * This fragment of code should initiate 0 ++ * length transfer in case if it is queued ++ * a transfer with size divisible to EPs max ++ * packet size and with usb_request zero field ++ * is set, which means that after data is transfered, ++ * it is also should be transfered ++ * a 0 length packet at the end. For Slave and ++ * Buffer DMA modes in this case SW has ++ * to initiate 2 transfers one with transfer size, ++ * and the second with 0 size. For Descriptor ++ * DMA mode SW is able to initiate a transfer, ++ * which will handle all the packets including ++ * the last 0 length. ++ */ ++ ep->dwc_ep.sent_zlp = 0; ++ dwc_otg_ep_start_zl_transfer ++ (core_if, &ep->dwc_ep); ++ } else { ++ is_last = 1; ++ } ++ } else { ++ if (ep->dwc_ep.type == ++ DWC_OTG_EP_TYPE_ISOC) { ++ req->actual = 0; ++ dwc_otg_request_done(ep, req, 0); ++ ++ ep->dwc_ep.start_xfer_buff = 0; ++ ep->dwc_ep.xfer_buff = 0; ++ ep->dwc_ep.xfer_len = 0; ++ ++ /* If there is a request in the queue start it. */ ++ start_next_request(ep); ++ } else ++ DWC_WARN ++ ("Incomplete transfer (%d - %s [siz=%d pkt=%d])\n", ++ ep->dwc_ep.num, ++ (ep->dwc_ep.is_in ? "IN" : "OUT"), ++ deptsiz.b.xfersize, ++ deptsiz.b.pktcnt); ++ } ++ } else { ++ dma_desc = ep->dwc_ep.desc_addr; ++ byte_count = 0; ++ ep->dwc_ep.sent_zlp = 0; ++ ++#ifdef DWC_UTE_CFI ++ CFI_INFO("%s: BUFFER_MODE=%d\n", __func__, ++ ep->dwc_ep.buff_mode); ++ if (ep->dwc_ep.buff_mode != BM_STANDARD) { ++ int residue; ++ ++ residue = cfi_calc_desc_residue(ep); ++ if (residue < 0) ++ return; ++ ++ byte_count = residue; ++ } else { ++#endif ++ for (i = 0; i < ep->dwc_ep.desc_cnt; ++ ++i) { ++ desc_sts = dma_desc->status; ++ byte_count += desc_sts.b.bytes; ++ dma_desc++; ++ } ++#ifdef DWC_UTE_CFI ++ } ++#endif ++ if (byte_count == 0) { ++ ep->dwc_ep.xfer_count = ++ ep->dwc_ep.total_len; ++ is_last = 1; ++ } else { ++ DWC_WARN("Incomplete transfer\n"); ++ } ++ } ++ } else { ++ if (deptsiz.b.xfersize == 0 && deptsiz.b.pktcnt == 0) { ++ DWC_DEBUGPL(DBG_PCDV, ++ "%d-%s len=%d xfersize=%d pktcnt=%d\n", ++ ep->dwc_ep.num, ++ ep->dwc_ep.is_in ? "IN" : "OUT", ++ ep->dwc_ep.xfer_len, ++ deptsiz.b.xfersize, ++ deptsiz.b.pktcnt); ++ ++ /* Check if the whole transfer was completed, ++ * if no, setup transfer for next portion of data ++ */ ++ if (ep->dwc_ep.xfer_len < ep->dwc_ep.total_len) { ++ dwc_otg_ep_start_transfer(core_if, ++ &ep->dwc_ep); ++ } else if (ep->dwc_ep.sent_zlp) { ++ /* ++ * This fragment of code should initiate 0 ++ * length trasfer in case if it is queued ++ * a trasfer with size divisible to EPs max ++ * packet size and with usb_request zero field ++ * is set, which means that after data is transfered, ++ * it is also should be transfered ++ * a 0 length packet at the end. For Slave and ++ * Buffer DMA modes in this case SW has ++ * to initiate 2 transfers one with transfer size, ++ * and the second with 0 size. For Desriptor ++ * DMA mode SW is able to initiate a transfer, ++ * which will handle all the packets including ++ * the last 0 legth. ++ */ ++ ep->dwc_ep.sent_zlp = 0; ++ dwc_otg_ep_start_zl_transfer(core_if, ++ &ep->dwc_ep); ++ } else { ++ is_last = 1; ++ } ++ } else { ++ DWC_WARN ++ ("Incomplete transfer (%d-%s [siz=%d pkt=%d])\n", ++ ep->dwc_ep.num, ++ (ep->dwc_ep.is_in ? "IN" : "OUT"), ++ deptsiz.b.xfersize, deptsiz.b.pktcnt); ++ } ++ } ++ } else { ++ dwc_otg_dev_out_ep_regs_t *out_ep_regs = ++ dev_if->out_ep_regs[ep->dwc_ep.num]; ++ desc_sts.d32 = 0; ++ if (core_if->dma_enable) { ++ if (core_if->dma_desc_enable) { ++ dma_desc = ep->dwc_ep.desc_addr; ++ byte_count = 0; ++ ep->dwc_ep.sent_zlp = 0; ++ ++#ifdef DWC_UTE_CFI ++ CFI_INFO("%s: BUFFER_MODE=%d\n", __func__, ++ ep->dwc_ep.buff_mode); ++ if (ep->dwc_ep.buff_mode != BM_STANDARD) { ++ int residue; ++ residue = cfi_calc_desc_residue(ep); ++ if (residue < 0) ++ return; ++ byte_count = residue; ++ } else { ++#endif ++ ++ for (i = 0; i < ep->dwc_ep.desc_cnt; ++ ++i) { ++ desc_sts = dma_desc->status; ++ byte_count += desc_sts.b.bytes; ++ dma_desc++; ++ } ++ ++#ifdef DWC_UTE_CFI ++ } ++#endif ++ /* Checking for interrupt Out transfers with not ++ * dword aligned mps sizes ++ */ ++ if (ep->dwc_ep.type == DWC_OTG_EP_TYPE_INTR && ++ (ep->dwc_ep.maxpacket%4)) { ++ ep->dwc_ep.xfer_count = ++ ep->dwc_ep.total_len - byte_count; ++ if ((ep->dwc_ep.xfer_len % ++ ep->dwc_ep.maxpacket) ++ && (ep->dwc_ep.xfer_len / ++ ep->dwc_ep.maxpacket < ++ MAX_DMA_DESC_CNT)) ++ ep->dwc_ep.xfer_len -= ++ (ep->dwc_ep.desc_cnt - ++ 1) * ep->dwc_ep.maxpacket + ++ ep->dwc_ep.xfer_len % ++ ep->dwc_ep.maxpacket; ++ else ++ ep->dwc_ep.xfer_len -= ++ ep->dwc_ep.desc_cnt * ++ ep->dwc_ep.maxpacket; ++ if (ep->dwc_ep.xfer_len > 0) { ++ dwc_otg_ep_start_transfer ++ (core_if, &ep->dwc_ep); ++ } else { ++ is_last = 1; ++ } ++ } else { ++ ep->dwc_ep.xfer_count = ++ ep->dwc_ep.total_len - byte_count + ++ ((4 - ++ (ep->dwc_ep. ++ total_len & 0x3)) & 0x3); ++ is_last = 1; ++ } ++ } else { ++ deptsiz.d32 = 0; ++ deptsiz.d32 = ++ DWC_READ_REG32(&out_ep_regs->doeptsiz); ++ ++ byte_count = (ep->dwc_ep.xfer_len - ++ ep->dwc_ep.xfer_count - ++ deptsiz.b.xfersize); ++ ep->dwc_ep.xfer_buff += byte_count; ++ ep->dwc_ep.dma_addr += byte_count; ++ ep->dwc_ep.xfer_count += byte_count; ++ ++ /* Check if the whole transfer was completed, ++ * if no, setup transfer for next portion of data ++ */ ++ if (ep->dwc_ep.xfer_len < ep->dwc_ep.total_len) { ++ dwc_otg_ep_start_transfer(core_if, ++ &ep->dwc_ep); ++ } else if (ep->dwc_ep.sent_zlp) { ++ /* ++ * This fragment of code should initiate 0 ++ * length trasfer in case if it is queued ++ * a trasfer with size divisible to EPs max ++ * packet size and with usb_request zero field ++ * is set, which means that after data is transfered, ++ * it is also should be transfered ++ * a 0 length packet at the end. For Slave and ++ * Buffer DMA modes in this case SW has ++ * to initiate 2 transfers one with transfer size, ++ * and the second with 0 size. For Desriptor ++ * DMA mode SW is able to initiate a transfer, ++ * which will handle all the packets including ++ * the last 0 legth. ++ */ ++ ep->dwc_ep.sent_zlp = 0; ++ dwc_otg_ep_start_zl_transfer(core_if, ++ &ep->dwc_ep); ++ } else { ++ is_last = 1; ++ } ++ } ++ } else { ++ /* Check if the whole transfer was completed, ++ * if no, setup transfer for next portion of data ++ */ ++ if (ep->dwc_ep.xfer_len < ep->dwc_ep.total_len) { ++ dwc_otg_ep_start_transfer(core_if, &ep->dwc_ep); ++ } else if (ep->dwc_ep.sent_zlp) { ++ /* ++ * This fragment of code should initiate 0 ++ * length transfer in case if it is queued ++ * a transfer with size divisible to EPs max ++ * packet size and with usb_request zero field ++ * is set, which means that after data is transfered, ++ * it is also should be transfered ++ * a 0 length packet at the end. For Slave and ++ * Buffer DMA modes in this case SW has ++ * to initiate 2 transfers one with transfer size, ++ * and the second with 0 size. For Descriptor ++ * DMA mode SW is able to initiate a transfer, ++ * which will handle all the packets including ++ * the last 0 length. ++ */ ++ ep->dwc_ep.sent_zlp = 0; ++ dwc_otg_ep_start_zl_transfer(core_if, ++ &ep->dwc_ep); ++ } else { ++ is_last = 1; ++ } ++ } ++ ++ DWC_DEBUGPL(DBG_PCDV, ++ "addr %p, %d-%s len=%d cnt=%d xsize=%d pktcnt=%d\n", ++ &out_ep_regs->doeptsiz, ep->dwc_ep.num, ++ ep->dwc_ep.is_in ? "IN" : "OUT", ++ ep->dwc_ep.xfer_len, ep->dwc_ep.xfer_count, ++ deptsiz.b.xfersize, deptsiz.b.pktcnt); ++ } ++ ++ /* Complete the request */ ++ if (is_last) { ++#ifdef DWC_UTE_CFI ++ if (ep->dwc_ep.buff_mode != BM_STANDARD) { ++ req->actual = ep->dwc_ep.cfi_req_len - byte_count; ++ } else { ++#endif ++ req->actual = ep->dwc_ep.xfer_count; ++#ifdef DWC_UTE_CFI ++ } ++#endif ++ if (req->dw_align_buf) { ++ if (!ep->dwc_ep.is_in) { ++ dwc_memcpy(req->buf, req->dw_align_buf, req->length); ++ } ++ DWC_DMA_FREE(req->length, req->dw_align_buf, ++ req->dw_align_buf_dma); ++ } ++ ++ dwc_otg_request_done(ep, req, 0); ++ ++ ep->dwc_ep.start_xfer_buff = 0; ++ ep->dwc_ep.xfer_buff = 0; ++ ep->dwc_ep.xfer_len = 0; ++ ++ /* If there is a request in the queue start it. */ ++ start_next_request(ep); ++ } ++} ++ ++#ifdef DWC_EN_ISOC ++ ++/** ++ * This function BNA interrupt for Isochronous EPs ++ * ++ */ ++static void dwc_otg_pcd_handle_iso_bna(dwc_otg_pcd_ep_t * ep) ++{ ++ dwc_ep_t *dwc_ep = &ep->dwc_ep; ++ volatile uint32_t *addr; ++ depctl_data_t depctl = {.d32 = 0 }; ++ dwc_otg_pcd_t *pcd = ep->pcd; ++ dwc_otg_dev_dma_desc_t *dma_desc; ++ int i; ++ ++ dma_desc = ++ dwc_ep->iso_desc_addr + dwc_ep->desc_cnt * (dwc_ep->proc_buf_num); ++ ++ if (dwc_ep->is_in) { ++ dev_dma_desc_sts_t sts = {.d32 = 0 }; ++ for (i = 0; i < dwc_ep->desc_cnt; ++i, ++dma_desc) { ++ sts.d32 = dma_desc->status.d32; ++ sts.b_iso_in.bs = BS_HOST_READY; ++ dma_desc->status.d32 = sts.d32; ++ } ++ } else { ++ dev_dma_desc_sts_t sts = {.d32 = 0 }; ++ for (i = 0; i < dwc_ep->desc_cnt; ++i, ++dma_desc) { ++ sts.d32 = dma_desc->status.d32; ++ sts.b_iso_out.bs = BS_HOST_READY; ++ dma_desc->status.d32 = sts.d32; ++ } ++ } ++ ++ if (dwc_ep->is_in == 0) { ++ addr = ++ &GET_CORE_IF(pcd)->dev_if->out_ep_regs[dwc_ep-> ++ num]->doepctl; ++ } else { ++ addr = ++ &GET_CORE_IF(pcd)->dev_if->in_ep_regs[dwc_ep->num]->diepctl; ++ } ++ depctl.b.epena = 1; ++ DWC_MODIFY_REG32(addr, depctl.d32, depctl.d32); ++} ++ ++/** ++ * This function sets latest iso packet information(non-PTI mode) ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ * @param ep The EP to start the transfer on. ++ * ++ */ ++void set_current_pkt_info(dwc_otg_core_if_t * core_if, dwc_ep_t * ep) ++{ ++ deptsiz_data_t deptsiz = {.d32 = 0 }; ++ dma_addr_t dma_addr; ++ uint32_t offset; ++ ++ if (ep->proc_buf_num) ++ dma_addr = ep->dma_addr1; ++ else ++ dma_addr = ep->dma_addr0; ++ ++ if (ep->is_in) { ++ deptsiz.d32 = ++ DWC_READ_REG32(&core_if->dev_if-> ++ in_ep_regs[ep->num]->dieptsiz); ++ offset = ep->data_per_frame; ++ } else { ++ deptsiz.d32 = ++ DWC_READ_REG32(&core_if->dev_if-> ++ out_ep_regs[ep->num]->doeptsiz); ++ offset = ++ ep->data_per_frame + ++ (0x4 & (0x4 - (ep->data_per_frame & 0x3))); ++ } ++ ++ if (!deptsiz.b.xfersize) { ++ ep->pkt_info[ep->cur_pkt].length = ep->data_per_frame; ++ ep->pkt_info[ep->cur_pkt].offset = ++ ep->cur_pkt_dma_addr - dma_addr; ++ ep->pkt_info[ep->cur_pkt].status = 0; ++ } else { ++ ep->pkt_info[ep->cur_pkt].length = ep->data_per_frame; ++ ep->pkt_info[ep->cur_pkt].offset = ++ ep->cur_pkt_dma_addr - dma_addr; ++ ep->pkt_info[ep->cur_pkt].status = -DWC_E_NO_DATA; ++ } ++ ep->cur_pkt_addr += offset; ++ ep->cur_pkt_dma_addr += offset; ++ ep->cur_pkt++; ++} ++ ++/** ++ * This function sets latest iso packet information(DDMA mode) ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ * @param dwc_ep The EP to start the transfer on. ++ * ++ */ ++static void set_ddma_iso_pkts_info(dwc_otg_core_if_t * core_if, ++ dwc_ep_t * dwc_ep) ++{ ++ dwc_otg_dev_dma_desc_t *dma_desc; ++ dev_dma_desc_sts_t sts = {.d32 = 0 }; ++ iso_pkt_info_t *iso_packet; ++ uint32_t data_per_desc; ++ uint32_t offset; ++ int i, j; ++ ++ iso_packet = dwc_ep->pkt_info; ++ ++ /** Reinit closed DMA Descriptors*/ ++ /** ISO OUT EP */ ++ if (dwc_ep->is_in == 0) { ++ dma_desc = ++ dwc_ep->iso_desc_addr + ++ dwc_ep->desc_cnt * dwc_ep->proc_buf_num; ++ offset = 0; ++ ++ for (i = 0; i < dwc_ep->desc_cnt - dwc_ep->pkt_per_frm; ++ i += dwc_ep->pkt_per_frm) { ++ for (j = 0; j < dwc_ep->pkt_per_frm; ++j) { ++ data_per_desc = ++ ((j + 1) * dwc_ep->maxpacket > ++ dwc_ep-> ++ data_per_frame) ? dwc_ep->data_per_frame - ++ j * dwc_ep->maxpacket : dwc_ep->maxpacket; ++ data_per_desc += ++ (data_per_desc % 4) ? (4 - ++ data_per_desc % ++ 4) : 0; ++ ++ sts.d32 = dma_desc->status.d32; ++ ++ /* Write status in iso_packet_decsriptor */ ++ iso_packet->status = ++ sts.b_iso_out.rxsts + ++ (sts.b_iso_out.bs ^ BS_DMA_DONE); ++ if (iso_packet->status) { ++ iso_packet->status = -DWC_E_NO_DATA; ++ } ++ ++ /* Received data length */ ++ if (!sts.b_iso_out.rxbytes) { ++ iso_packet->length = ++ data_per_desc - ++ sts.b_iso_out.rxbytes; ++ } else { ++ iso_packet->length = ++ data_per_desc - ++ sts.b_iso_out.rxbytes + (4 - ++ dwc_ep->data_per_frame ++ % 4); ++ } ++ ++ iso_packet->offset = offset; ++ ++ offset += data_per_desc; ++ dma_desc++; ++ iso_packet++; ++ } ++ } ++ ++ for (j = 0; j < dwc_ep->pkt_per_frm - 1; ++j) { ++ data_per_desc = ++ ((j + 1) * dwc_ep->maxpacket > ++ dwc_ep->data_per_frame) ? dwc_ep->data_per_frame - ++ j * dwc_ep->maxpacket : dwc_ep->maxpacket; ++ data_per_desc += ++ (data_per_desc % 4) ? (4 - data_per_desc % 4) : 0; ++ ++ sts.d32 = dma_desc->status.d32; ++ ++ /* Write status in iso_packet_decsriptor */ ++ iso_packet->status = ++ sts.b_iso_out.rxsts + ++ (sts.b_iso_out.bs ^ BS_DMA_DONE); ++ if (iso_packet->status) { ++ iso_packet->status = -DWC_E_NO_DATA; ++ } ++ ++ /* Received data length */ ++ iso_packet->length = ++ dwc_ep->data_per_frame - sts.b_iso_out.rxbytes; ++ ++ iso_packet->offset = offset; ++ ++ offset += data_per_desc; ++ iso_packet++; ++ dma_desc++; ++ } ++ ++ sts.d32 = dma_desc->status.d32; ++ ++ /* Write status in iso_packet_decsriptor */ ++ iso_packet->status = ++ sts.b_iso_out.rxsts + (sts.b_iso_out.bs ^ BS_DMA_DONE); ++ if (iso_packet->status) { ++ iso_packet->status = -DWC_E_NO_DATA; ++ } ++ /* Received data length */ ++ if (!sts.b_iso_out.rxbytes) { ++ iso_packet->length = ++ dwc_ep->data_per_frame - sts.b_iso_out.rxbytes; ++ } else { ++ iso_packet->length = ++ dwc_ep->data_per_frame - sts.b_iso_out.rxbytes + ++ (4 - dwc_ep->data_per_frame % 4); ++ } ++ ++ iso_packet->offset = offset; ++ } else { ++/** ISO IN EP */ ++ ++ dma_desc = ++ dwc_ep->iso_desc_addr + ++ dwc_ep->desc_cnt * dwc_ep->proc_buf_num; ++ ++ for (i = 0; i < dwc_ep->desc_cnt - 1; i++) { ++ sts.d32 = dma_desc->status.d32; ++ ++ /* Write status in iso packet descriptor */ ++ iso_packet->status = ++ sts.b_iso_in.txsts + ++ (sts.b_iso_in.bs ^ BS_DMA_DONE); ++ if (iso_packet->status != 0) { ++ iso_packet->status = -DWC_E_NO_DATA; ++ ++ } ++ /* Bytes has been transfered */ ++ iso_packet->length = ++ dwc_ep->data_per_frame - sts.b_iso_in.txbytes; ++ ++ dma_desc++; ++ iso_packet++; ++ } ++ ++ sts.d32 = dma_desc->status.d32; ++ while (sts.b_iso_in.bs == BS_DMA_BUSY) { ++ sts.d32 = dma_desc->status.d32; ++ } ++ ++ /* Write status in iso packet descriptor ??? do be done with ERROR codes */ ++ iso_packet->status = ++ sts.b_iso_in.txsts + (sts.b_iso_in.bs ^ BS_DMA_DONE); ++ if (iso_packet->status != 0) { ++ iso_packet->status = -DWC_E_NO_DATA; ++ } ++ ++ /* Bytes has been transfered */ ++ iso_packet->length = ++ dwc_ep->data_per_frame - sts.b_iso_in.txbytes; ++ } ++} ++ ++/** ++ * This function reinitialize DMA Descriptors for Isochronous transfer ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ * @param dwc_ep The EP to start the transfer on. ++ * ++ */ ++static void reinit_ddma_iso_xfer(dwc_otg_core_if_t * core_if, dwc_ep_t * dwc_ep) ++{ ++ int i, j; ++ dwc_otg_dev_dma_desc_t *dma_desc; ++ dma_addr_t dma_ad; ++ volatile uint32_t *addr; ++ dev_dma_desc_sts_t sts = {.d32 = 0 }; ++ uint32_t data_per_desc; ++ ++ if (dwc_ep->is_in == 0) { ++ addr = &core_if->dev_if->out_ep_regs[dwc_ep->num]->doepctl; ++ } else { ++ addr = &core_if->dev_if->in_ep_regs[dwc_ep->num]->diepctl; ++ } ++ ++ if (dwc_ep->proc_buf_num == 0) { ++ /** Buffer 0 descriptors setup */ ++ dma_ad = dwc_ep->dma_addr0; ++ } else { ++ /** Buffer 1 descriptors setup */ ++ dma_ad = dwc_ep->dma_addr1; ++ } ++ ++ /** Reinit closed DMA Descriptors*/ ++ /** ISO OUT EP */ ++ if (dwc_ep->is_in == 0) { ++ dma_desc = ++ dwc_ep->iso_desc_addr + ++ dwc_ep->desc_cnt * dwc_ep->proc_buf_num; ++ ++ sts.b_iso_out.bs = BS_HOST_READY; ++ sts.b_iso_out.rxsts = 0; ++ sts.b_iso_out.l = 0; ++ sts.b_iso_out.sp = 0; ++ sts.b_iso_out.ioc = 0; ++ sts.b_iso_out.pid = 0; ++ sts.b_iso_out.framenum = 0; ++ ++ for (i = 0; i < dwc_ep->desc_cnt - dwc_ep->pkt_per_frm; ++ i += dwc_ep->pkt_per_frm) { ++ for (j = 0; j < dwc_ep->pkt_per_frm; ++j) { ++ data_per_desc = ++ ((j + 1) * dwc_ep->maxpacket > ++ dwc_ep-> ++ data_per_frame) ? dwc_ep->data_per_frame - ++ j * dwc_ep->maxpacket : dwc_ep->maxpacket; ++ data_per_desc += ++ (data_per_desc % 4) ? (4 - ++ data_per_desc % ++ 4) : 0; ++ sts.b_iso_out.rxbytes = data_per_desc; ++ dma_desc->buf = dma_ad; ++ dma_desc->status.d32 = sts.d32; ++ ++ dma_ad += data_per_desc; ++ dma_desc++; ++ } ++ } ++ ++ for (j = 0; j < dwc_ep->pkt_per_frm - 1; ++j) { ++ ++ data_per_desc = ++ ((j + 1) * dwc_ep->maxpacket > ++ dwc_ep->data_per_frame) ? dwc_ep->data_per_frame - ++ j * dwc_ep->maxpacket : dwc_ep->maxpacket; ++ data_per_desc += ++ (data_per_desc % 4) ? (4 - data_per_desc % 4) : 0; ++ sts.b_iso_out.rxbytes = data_per_desc; ++ ++ dma_desc->buf = dma_ad; ++ dma_desc->status.d32 = sts.d32; ++ ++ dma_desc++; ++ dma_ad += data_per_desc; ++ } ++ ++ sts.b_iso_out.ioc = 1; ++ sts.b_iso_out.l = dwc_ep->proc_buf_num; ++ ++ data_per_desc = ++ ((j + 1) * dwc_ep->maxpacket > ++ dwc_ep->data_per_frame) ? dwc_ep->data_per_frame - ++ j * dwc_ep->maxpacket : dwc_ep->maxpacket; ++ data_per_desc += ++ (data_per_desc % 4) ? (4 - data_per_desc % 4) : 0; ++ sts.b_iso_out.rxbytes = data_per_desc; ++ ++ dma_desc->buf = dma_ad; ++ dma_desc->status.d32 = sts.d32; ++ } else { ++/** ISO IN EP */ ++ ++ dma_desc = ++ dwc_ep->iso_desc_addr + ++ dwc_ep->desc_cnt * dwc_ep->proc_buf_num; ++ ++ sts.b_iso_in.bs = BS_HOST_READY; ++ sts.b_iso_in.txsts = 0; ++ sts.b_iso_in.sp = 0; ++ sts.b_iso_in.ioc = 0; ++ sts.b_iso_in.pid = dwc_ep->pkt_per_frm; ++ sts.b_iso_in.framenum = dwc_ep->next_frame; ++ sts.b_iso_in.txbytes = dwc_ep->data_per_frame; ++ sts.b_iso_in.l = 0; ++ ++ for (i = 0; i < dwc_ep->desc_cnt - 1; i++) { ++ dma_desc->buf = dma_ad; ++ dma_desc->status.d32 = sts.d32; ++ ++ sts.b_iso_in.framenum += dwc_ep->bInterval; ++ dma_ad += dwc_ep->data_per_frame; ++ dma_desc++; ++ } ++ ++ sts.b_iso_in.ioc = 1; ++ sts.b_iso_in.l = dwc_ep->proc_buf_num; ++ ++ dma_desc->buf = dma_ad; ++ dma_desc->status.d32 = sts.d32; ++ ++ dwc_ep->next_frame = ++ sts.b_iso_in.framenum + dwc_ep->bInterval * 1; ++ } ++ dwc_ep->proc_buf_num = (dwc_ep->proc_buf_num ^ 1) & 0x1; ++} ++ ++/** ++ * This function is to handle Iso EP transfer complete interrupt ++ * in case Iso out packet was dropped ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ * @param dwc_ep The EP for wihich transfer complete was asserted ++ * ++ */ ++static uint32_t handle_iso_out_pkt_dropped(dwc_otg_core_if_t * core_if, ++ dwc_ep_t * dwc_ep) ++{ ++ uint32_t dma_addr; ++ uint32_t drp_pkt; ++ uint32_t drp_pkt_cnt; ++ deptsiz_data_t deptsiz = {.d32 = 0 }; ++ depctl_data_t depctl = {.d32 = 0 }; ++ int i; ++ ++ deptsiz.d32 = ++ DWC_READ_REG32(&core_if->dev_if-> ++ out_ep_regs[dwc_ep->num]->doeptsiz); ++ ++ drp_pkt = dwc_ep->pkt_cnt - deptsiz.b.pktcnt; ++ drp_pkt_cnt = dwc_ep->pkt_per_frm - (drp_pkt % dwc_ep->pkt_per_frm); ++ ++ /* Setting dropped packets status */ ++ for (i = 0; i < drp_pkt_cnt; ++i) { ++ dwc_ep->pkt_info[drp_pkt].status = -DWC_E_NO_DATA; ++ drp_pkt++; ++ deptsiz.b.pktcnt--; ++ } ++ ++ if (deptsiz.b.pktcnt > 0) { ++ deptsiz.b.xfersize = ++ dwc_ep->xfer_len - (dwc_ep->pkt_cnt - ++ deptsiz.b.pktcnt) * dwc_ep->maxpacket; ++ } else { ++ deptsiz.b.xfersize = 0; ++ deptsiz.b.pktcnt = 0; ++ } ++ ++ DWC_WRITE_REG32(&core_if->dev_if->out_ep_regs[dwc_ep->num]->doeptsiz, ++ deptsiz.d32); ++ ++ if (deptsiz.b.pktcnt > 0) { ++ if (dwc_ep->proc_buf_num) { ++ dma_addr = ++ dwc_ep->dma_addr1 + dwc_ep->xfer_len - ++ deptsiz.b.xfersize; ++ } else { ++ dma_addr = ++ dwc_ep->dma_addr0 + dwc_ep->xfer_len - ++ deptsiz.b.xfersize;; ++ } ++ ++ DWC_WRITE_REG32(&core_if->dev_if-> ++ out_ep_regs[dwc_ep->num]->doepdma, dma_addr); ++ ++ /** Re-enable endpoint, clear nak */ ++ depctl.d32 = 0; ++ depctl.b.epena = 1; ++ depctl.b.cnak = 1; ++ ++ DWC_MODIFY_REG32(&core_if->dev_if-> ++ out_ep_regs[dwc_ep->num]->doepctl, depctl.d32, ++ depctl.d32); ++ return 0; ++ } else { ++ return 1; ++ } ++} ++ ++/** ++ * This function sets iso packets information(PTI mode) ++ * ++ * @param core_if Programming view of DWC_otg controller. ++ * @param ep The EP to start the transfer on. ++ * ++ */ ++static uint32_t set_iso_pkts_info(dwc_otg_core_if_t * core_if, dwc_ep_t * ep) ++{ ++ int i, j; ++ dma_addr_t dma_ad; ++ iso_pkt_info_t *packet_info = ep->pkt_info; ++ uint32_t offset; ++ uint32_t frame_data; ++ deptsiz_data_t deptsiz; ++ ++ if (ep->proc_buf_num == 0) { ++ /** Buffer 0 descriptors setup */ ++ dma_ad = ep->dma_addr0; ++ } else { ++ /** Buffer 1 descriptors setup */ ++ dma_ad = ep->dma_addr1; ++ } ++ ++ if (ep->is_in) { ++ deptsiz.d32 = ++ DWC_READ_REG32(&core_if->dev_if->in_ep_regs[ep->num]-> ++ dieptsiz); ++ } else { ++ deptsiz.d32 = ++ DWC_READ_REG32(&core_if->dev_if->out_ep_regs[ep->num]-> ++ doeptsiz); ++ } ++ ++ if (!deptsiz.b.xfersize) { ++ offset = 0; ++ for (i = 0; i < ep->pkt_cnt; i += ep->pkt_per_frm) { ++ frame_data = ep->data_per_frame; ++ for (j = 0; j < ep->pkt_per_frm; ++j) { ++ ++ /* Packet status - is not set as initially ++ * it is set to 0 and if packet was sent ++ successfully, status field will remain 0*/ ++ ++ /* Bytes has been transfered */ ++ packet_info->length = ++ (ep->maxpacket < ++ frame_data) ? ep->maxpacket : frame_data; ++ ++ /* Received packet offset */ ++ packet_info->offset = offset; ++ offset += packet_info->length; ++ frame_data -= packet_info->length; ++ ++ packet_info++; ++ } ++ } ++ return 1; ++ } else { ++ /* This is a workaround for in case of Transfer Complete with ++ * PktDrpSts interrupts merging - in this case Transfer complete ++ * interrupt for Isoc Out Endpoint is asserted without PktDrpSts ++ * set and with DOEPTSIZ register non zero. Investigations showed, ++ * that this happens when Out packet is dropped, but because of ++ * interrupts merging during first interrupt handling PktDrpSts ++ * bit is cleared and for next merged interrupts it is not reset. ++ * In this case SW hadles the interrupt as if PktDrpSts bit is set. ++ */ ++ if (ep->is_in) { ++ return 1; ++ } else { ++ return handle_iso_out_pkt_dropped(core_if, ep); ++ } ++ } ++} ++ ++/** ++ * This function is to handle Iso EP transfer complete interrupt ++ * ++ * @param pcd The PCD ++ * @param ep The EP for which transfer complete was asserted ++ * ++ */ ++static void complete_iso_ep(dwc_otg_pcd_t * pcd, dwc_otg_pcd_ep_t * ep) ++{ ++ dwc_otg_core_if_t *core_if = GET_CORE_IF(ep->pcd); ++ dwc_ep_t *dwc_ep = &ep->dwc_ep; ++ uint8_t is_last = 0; ++ ++ if (ep->dwc_ep.next_frame == 0xffffffff) { ++ DWC_WARN("Next frame is not set!\n"); ++ return; ++ } ++ ++ if (core_if->dma_enable) { ++ if (core_if->dma_desc_enable) { ++ set_ddma_iso_pkts_info(core_if, dwc_ep); ++ reinit_ddma_iso_xfer(core_if, dwc_ep); ++ is_last = 1; ++ } else { ++ if (core_if->pti_enh_enable) { ++ if (set_iso_pkts_info(core_if, dwc_ep)) { ++ dwc_ep->proc_buf_num = ++ (dwc_ep->proc_buf_num ^ 1) & 0x1; ++ dwc_otg_iso_ep_start_buf_transfer ++ (core_if, dwc_ep); ++ is_last = 1; ++ } ++ } else { ++ set_current_pkt_info(core_if, dwc_ep); ++ if (dwc_ep->cur_pkt >= dwc_ep->pkt_cnt) { ++ is_last = 1; ++ dwc_ep->cur_pkt = 0; ++ dwc_ep->proc_buf_num = ++ (dwc_ep->proc_buf_num ^ 1) & 0x1; ++ if (dwc_ep->proc_buf_num) { ++ dwc_ep->cur_pkt_addr = ++ dwc_ep->xfer_buff1; ++ dwc_ep->cur_pkt_dma_addr = ++ dwc_ep->dma_addr1; ++ } else { ++ dwc_ep->cur_pkt_addr = ++ dwc_ep->xfer_buff0; ++ dwc_ep->cur_pkt_dma_addr = ++ dwc_ep->dma_addr0; ++ } ++ ++ } ++ dwc_otg_iso_ep_start_frm_transfer(core_if, ++ dwc_ep); ++ } ++ } ++ } else { ++ set_current_pkt_info(core_if, dwc_ep); ++ if (dwc_ep->cur_pkt >= dwc_ep->pkt_cnt) { ++ is_last = 1; ++ dwc_ep->cur_pkt = 0; ++ dwc_ep->proc_buf_num = (dwc_ep->proc_buf_num ^ 1) & 0x1; ++ if (dwc_ep->proc_buf_num) { ++ dwc_ep->cur_pkt_addr = dwc_ep->xfer_buff1; ++ dwc_ep->cur_pkt_dma_addr = dwc_ep->dma_addr1; ++ } else { ++ dwc_ep->cur_pkt_addr = dwc_ep->xfer_buff0; ++ dwc_ep->cur_pkt_dma_addr = dwc_ep->dma_addr0; ++ } ++ ++ } ++ dwc_otg_iso_ep_start_frm_transfer(core_if, dwc_ep); ++ } ++ if (is_last) ++ dwc_otg_iso_buffer_done(pcd, ep, ep->iso_req_handle); ++} ++#endif /* DWC_EN_ISOC */ ++ ++/** ++ * This function handle BNA interrupt for Non Isochronous EPs ++ * ++ */ ++static void dwc_otg_pcd_handle_noniso_bna(dwc_otg_pcd_ep_t * ep) ++{ ++ dwc_ep_t *dwc_ep = &ep->dwc_ep; ++ volatile uint32_t *addr; ++ depctl_data_t depctl = {.d32 = 0 }; ++ dwc_otg_pcd_t *pcd = ep->pcd; ++ dwc_otg_dev_dma_desc_t *dma_desc; ++ dev_dma_desc_sts_t sts = {.d32 = 0 }; ++ dwc_otg_core_if_t *core_if = ep->pcd->core_if; ++ int i, start; ++ ++ if (!dwc_ep->desc_cnt) ++ DWC_WARN("Ep%d %s Descriptor count = %d \n", dwc_ep->num, ++ (dwc_ep->is_in ? "IN" : "OUT"), dwc_ep->desc_cnt); ++ ++ if (core_if->core_params->cont_on_bna && !dwc_ep->is_in ++ && dwc_ep->type != DWC_OTG_EP_TYPE_CONTROL) { ++ uint32_t doepdma; ++ dwc_otg_dev_out_ep_regs_t *out_regs = ++ core_if->dev_if->out_ep_regs[dwc_ep->num]; ++ doepdma = DWC_READ_REG32(&(out_regs->doepdma)); ++ start = (doepdma - dwc_ep->dma_desc_addr)/sizeof(dwc_otg_dev_dma_desc_t); ++ dma_desc = &(dwc_ep->desc_addr[start]); ++ } else { ++ start = 0; ++ dma_desc = dwc_ep->desc_addr; ++ } ++ ++ ++ for (i = start; i < dwc_ep->desc_cnt; ++i, ++dma_desc) { ++ sts.d32 = dma_desc->status.d32; ++ sts.b.bs = BS_HOST_READY; ++ dma_desc->status.d32 = sts.d32; ++ } ++ ++ if (dwc_ep->is_in == 0) { ++ addr = ++ &GET_CORE_IF(pcd)->dev_if->out_ep_regs[dwc_ep->num]-> ++ doepctl; ++ } else { ++ addr = ++ &GET_CORE_IF(pcd)->dev_if->in_ep_regs[dwc_ep->num]->diepctl; ++ } ++ depctl.b.epena = 1; ++ depctl.b.cnak = 1; ++ DWC_MODIFY_REG32(addr, 0, depctl.d32); ++} ++ ++/** ++ * This function handles EP0 Control transfers. ++ * ++ * The state of the control transfers are tracked in ++ * <code>ep0state</code>. ++ */ ++static void handle_ep0(dwc_otg_pcd_t * pcd) ++{ ++ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); ++ dwc_otg_pcd_ep_t *ep0 = &pcd->ep0; ++ dev_dma_desc_sts_t desc_sts; ++ deptsiz0_data_t deptsiz; ++ uint32_t byte_count; ++ ++#ifdef DEBUG_EP0 ++ DWC_DEBUGPL(DBG_PCDV, "%s()\n", __func__); ++ print_ep0_state(pcd); ++#endif ++ ++// DWC_PRINTF("HANDLE EP0\n"); ++ ++ switch (pcd->ep0state) { ++ case EP0_DISCONNECT: ++ break; ++ ++ case EP0_IDLE: ++ pcd->request_config = 0; ++ ++ pcd_setup(pcd); ++ break; ++ ++ case EP0_IN_DATA_PHASE: ++#ifdef DEBUG_EP0 ++ DWC_DEBUGPL(DBG_PCD, "DATA_IN EP%d-%s: type=%d, mps=%d\n", ++ ep0->dwc_ep.num, (ep0->dwc_ep.is_in ? "IN" : "OUT"), ++ ep0->dwc_ep.type, ep0->dwc_ep.maxpacket); ++#endif ++ ++ if (core_if->dma_enable != 0) { ++ /* ++ * For EP0 we can only program 1 packet at a time so we ++ * need to do the make calculations after each complete. ++ * Call write_packet to make the calculations, as in ++ * slave mode, and use those values to determine if we ++ * can complete. ++ */ ++ if (core_if->dma_desc_enable == 0) { ++ deptsiz.d32 = ++ DWC_READ_REG32(&core_if-> ++ dev_if->in_ep_regs[0]-> ++ dieptsiz); ++ byte_count = ++ ep0->dwc_ep.xfer_len - deptsiz.b.xfersize; ++ } else { ++ desc_sts = ++ core_if->dev_if->in_desc_addr->status; ++ byte_count = ++ ep0->dwc_ep.xfer_len - desc_sts.b.bytes; ++ } ++ ep0->dwc_ep.xfer_count += byte_count; ++ ep0->dwc_ep.xfer_buff += byte_count; ++ ep0->dwc_ep.dma_addr += byte_count; ++ } ++ if (ep0->dwc_ep.xfer_count < ep0->dwc_ep.total_len) { ++ dwc_otg_ep0_continue_transfer(GET_CORE_IF(pcd), ++ &ep0->dwc_ep); ++ DWC_DEBUGPL(DBG_PCD, "CONTINUE TRANSFER\n"); ++ } else if (ep0->dwc_ep.sent_zlp) { ++ dwc_otg_ep0_continue_transfer(GET_CORE_IF(pcd), ++ &ep0->dwc_ep); ++ ep0->dwc_ep.sent_zlp = 0; ++ DWC_DEBUGPL(DBG_PCD, "CONTINUE TRANSFER sent zlp\n"); ++ } else { ++ ep0_complete_request(ep0); ++ DWC_DEBUGPL(DBG_PCD, "COMPLETE TRANSFER\n"); ++ } ++ break; ++ case EP0_OUT_DATA_PHASE: ++#ifdef DEBUG_EP0 ++ DWC_DEBUGPL(DBG_PCD, "DATA_OUT EP%d-%s: type=%d, mps=%d\n", ++ ep0->dwc_ep.num, (ep0->dwc_ep.is_in ? "IN" : "OUT"), ++ ep0->dwc_ep.type, ep0->dwc_ep.maxpacket); ++#endif ++ if (core_if->dma_enable != 0) { ++ if (core_if->dma_desc_enable == 0) { ++ deptsiz.d32 = ++ DWC_READ_REG32(&core_if-> ++ dev_if->out_ep_regs[0]-> ++ doeptsiz); ++ byte_count = ++ ep0->dwc_ep.maxpacket - deptsiz.b.xfersize; ++ } else { ++ desc_sts = ++ core_if->dev_if->out_desc_addr->status; ++ byte_count = ++ ep0->dwc_ep.maxpacket - desc_sts.b.bytes; ++ } ++ ep0->dwc_ep.xfer_count += byte_count; ++ ep0->dwc_ep.xfer_buff += byte_count; ++ ep0->dwc_ep.dma_addr += byte_count; ++ } ++ if (ep0->dwc_ep.xfer_count < ep0->dwc_ep.total_len) { ++ dwc_otg_ep0_continue_transfer(GET_CORE_IF(pcd), ++ &ep0->dwc_ep); ++ DWC_DEBUGPL(DBG_PCD, "CONTINUE TRANSFER\n"); ++ } else if (ep0->dwc_ep.sent_zlp) { ++ dwc_otg_ep0_continue_transfer(GET_CORE_IF(pcd), ++ &ep0->dwc_ep); ++ ep0->dwc_ep.sent_zlp = 0; ++ DWC_DEBUGPL(DBG_PCD, "CONTINUE TRANSFER sent zlp\n"); ++ } else { ++ ep0_complete_request(ep0); ++ DWC_DEBUGPL(DBG_PCD, "COMPLETE TRANSFER\n"); ++ } ++ break; ++ ++ case EP0_IN_STATUS_PHASE: ++ case EP0_OUT_STATUS_PHASE: ++ DWC_DEBUGPL(DBG_PCD, "CASE: EP0_STATUS\n"); ++ ep0_complete_request(ep0); ++ pcd->ep0state = EP0_IDLE; ++ ep0->stopped = 1; ++ ep0->dwc_ep.is_in = 0; /* OUT for next SETUP */ ++ ++ /* Prepare for more SETUP Packets */ ++ if (core_if->dma_enable) { ++ ep0_out_start(core_if, pcd); ++ } ++ break; ++ ++ case EP0_STALL: ++ DWC_ERROR("EP0 STALLed, should not get here pcd_setup()\n"); ++ break; ++ } ++#ifdef DEBUG_EP0 ++ print_ep0_state(pcd); ++#endif ++} ++ ++/** ++ * Restart transfer ++ */ ++static void restart_transfer(dwc_otg_pcd_t * pcd, const uint32_t epnum) ++{ ++ dwc_otg_core_if_t *core_if; ++ dwc_otg_dev_if_t *dev_if; ++ deptsiz_data_t dieptsiz = {.d32 = 0 }; ++ dwc_otg_pcd_ep_t *ep; ++ ++ ep = get_in_ep(pcd, epnum); ++ ++#ifdef DWC_EN_ISOC ++ if (ep->dwc_ep.type == DWC_OTG_EP_TYPE_ISOC) { ++ return; ++ } ++#endif /* DWC_EN_ISOC */ ++ ++ core_if = GET_CORE_IF(pcd); ++ dev_if = core_if->dev_if; ++ ++ dieptsiz.d32 = DWC_READ_REG32(&dev_if->in_ep_regs[epnum]->dieptsiz); ++ ++ DWC_DEBUGPL(DBG_PCD, "xfer_buff=%p xfer_count=%0x xfer_len=%0x" ++ " stopped=%d\n", ep->dwc_ep.xfer_buff, ++ ep->dwc_ep.xfer_count, ep->dwc_ep.xfer_len, ep->stopped); ++ /* ++ * If xfersize is 0 and pktcnt in not 0, resend the last packet. ++ */ ++ if (dieptsiz.b.pktcnt && dieptsiz.b.xfersize == 0 && ++ ep->dwc_ep.start_xfer_buff != 0) { ++ if (ep->dwc_ep.total_len <= ep->dwc_ep.maxpacket) { ++ ep->dwc_ep.xfer_count = 0; ++ ep->dwc_ep.xfer_buff = ep->dwc_ep.start_xfer_buff; ++ ep->dwc_ep.xfer_len = ep->dwc_ep.xfer_count; ++ } else { ++ ep->dwc_ep.xfer_count -= ep->dwc_ep.maxpacket; ++ /* convert packet size to dwords. */ ++ ep->dwc_ep.xfer_buff -= ep->dwc_ep.maxpacket; ++ ep->dwc_ep.xfer_len = ep->dwc_ep.xfer_count; ++ } ++ ep->stopped = 0; ++ DWC_DEBUGPL(DBG_PCD, "xfer_buff=%p xfer_count=%0x " ++ "xfer_len=%0x stopped=%d\n", ++ ep->dwc_ep.xfer_buff, ++ ep->dwc_ep.xfer_count, ep->dwc_ep.xfer_len, ++ ep->stopped); ++ if (epnum == 0) { ++ dwc_otg_ep0_start_transfer(core_if, &ep->dwc_ep); ++ } else { ++ dwc_otg_ep_start_transfer(core_if, &ep->dwc_ep); ++ } ++ } ++} ++ ++/* ++ * This function create new nextep sequnce based on Learn Queue. ++ * ++ * @param core_if Programming view of DWC_otg controller ++ */ ++void predict_nextep_seq( dwc_otg_core_if_t * core_if) ++{ ++ dwc_otg_device_global_regs_t *dev_global_regs = ++ core_if->dev_if->dev_global_regs; ++ const uint32_t TOKEN_Q_DEPTH = core_if->hwcfg2.b.dev_token_q_depth; ++ /* Number of Token Queue Registers */ ++ const int DTKNQ_REG_CNT = (TOKEN_Q_DEPTH + 7) / 8; ++ dtknq1_data_t dtknqr1; ++ uint32_t in_tkn_epnums[4]; ++ uint8_t seqnum[MAX_EPS_CHANNELS]; ++ uint8_t intkn_seq[TOKEN_Q_DEPTH]; ++ grstctl_t resetctl = {.d32 = 0 }; ++ uint8_t temp; ++ int ndx = 0; ++ int start = 0; ++ int end = 0; ++ int sort_done = 0; ++ int i = 0; ++ volatile uint32_t *addr = &dev_global_regs->dtknqr1; ++ ++ ++ DWC_DEBUGPL(DBG_PCD,"dev_token_q_depth=%d\n",TOKEN_Q_DEPTH); ++ ++ /* Read the DTKNQ Registers */ ++ for (i = 0; i < DTKNQ_REG_CNT; i++) { ++ in_tkn_epnums[i] = DWC_READ_REG32(addr); ++ DWC_DEBUGPL(DBG_PCDV, "DTKNQR%d=0x%08x\n", i + 1, ++ in_tkn_epnums[i]); ++ if (addr == &dev_global_regs->dvbusdis) { ++ addr = &dev_global_regs->dtknqr3_dthrctl; ++ } else { ++ ++addr; ++ } ++ ++ } ++ ++ /* Copy the DTKNQR1 data to the bit field. */ ++ dtknqr1.d32 = in_tkn_epnums[0]; ++ if (dtknqr1.b.wrap_bit) { ++ ndx = dtknqr1.b.intknwptr; ++ end = ndx -1; ++ if (end < 0) ++ end = TOKEN_Q_DEPTH -1; ++ } else { ++ ndx = 0; ++ end = dtknqr1.b.intknwptr -1; ++ if (end < 0) ++ end = 0; ++ } ++ start = ndx; ++ ++ /* Fill seqnum[] by initial values: EP number + 31 */ ++ for (i=0; i <= core_if->dev_if->num_in_eps; i++) { ++ seqnum[i] = i +31; ++ } ++ ++ /* Fill intkn_seq[] from in_tkn_epnums[0] */ ++ for (i=0; i < 6; i++) ++ intkn_seq[i] = (in_tkn_epnums[0] >> ((7-i) * 4)) & 0xf; ++ ++ if (TOKEN_Q_DEPTH > 6) { ++ /* Fill intkn_seq[] from in_tkn_epnums[1] */ ++ for (i=6; i < 14; i++) ++ intkn_seq[i] = ++ (in_tkn_epnums[1] >> ((7 - (i - 6)) * 4)) & 0xf; ++ } ++ ++ if (TOKEN_Q_DEPTH > 14) { ++ /* Fill intkn_seq[] from in_tkn_epnums[1] */ ++ for (i=14; i < 22; i++) ++ intkn_seq[i] = ++ (in_tkn_epnums[2] >> ((7 - (i - 14)) * 4)) & 0xf; ++ } ++ ++ if (TOKEN_Q_DEPTH > 22) { ++ /* Fill intkn_seq[] from in_tkn_epnums[1] */ ++ for (i=22; i < 30; i++) ++ intkn_seq[i] = ++ (in_tkn_epnums[3] >> ((7 - (i - 22)) * 4)) & 0xf; ++ } ++ ++ DWC_DEBUGPL(DBG_PCDV, "%s start=%d end=%d intkn_seq[]:\n", __func__, ++ start, end); ++ for (i=0; i<TOKEN_Q_DEPTH; i++) ++ DWC_DEBUGPL(DBG_PCDV,"%d\n", intkn_seq[i]); ++ ++ /* Update seqnum based on intkn_seq[] */ ++ i = 0; ++ do { ++ seqnum[intkn_seq[ndx]] = i; ++ ndx++; ++ i++; ++ if (ndx == TOKEN_Q_DEPTH) ++ ndx = 0; ++ } while ( i < TOKEN_Q_DEPTH ); ++ ++ /* Mark non active EP's in seqnum[] by 0xff */ ++ for (i=0; i<=core_if->dev_if->num_in_eps; i++) { ++ if (core_if->nextep_seq[i] == 0xff ) ++ seqnum[i] = 0xff; ++ } ++ ++ /* Sort seqnum[] */ ++ sort_done = 0; ++ while (!sort_done) { ++ sort_done = 1; ++ for (i=0; i<core_if->dev_if->num_in_eps; i++) { ++ if (seqnum[i] > seqnum[i+1]) { ++ temp = seqnum[i]; ++ seqnum[i] = seqnum[i+1]; ++ seqnum[i+1] = temp; ++ sort_done = 0; ++ } ++ } ++ } ++ ++ ndx = start + seqnum[0]; ++ if (ndx >= TOKEN_Q_DEPTH) ++ ndx = ndx % TOKEN_Q_DEPTH; ++ core_if->first_in_nextep_seq = intkn_seq[ndx]; ++ ++ /* Update seqnum[] by EP numbers */ ++ for (i=0; i<=core_if->dev_if->num_in_eps; i++) { ++ ndx = start + i; ++ if (seqnum[i] < 31) { ++ ndx = start + seqnum[i]; ++ if (ndx >= TOKEN_Q_DEPTH) ++ ndx = ndx % TOKEN_Q_DEPTH; ++ seqnum[i] = intkn_seq[ndx]; ++ } else { ++ if (seqnum[i] < 0xff) { ++ seqnum[i] = seqnum[i] - 31; ++ } else { ++ break; ++ } ++ } ++ } ++ ++ /* Update nextep_seq[] based on seqnum[] */ ++ for (i=0; i<core_if->dev_if->num_in_eps; i++) { ++ if (seqnum[i] != 0xff) { ++ if (seqnum[i+1] != 0xff) { ++ core_if->nextep_seq[seqnum[i]] = seqnum[i+1]; ++ } else { ++ core_if->nextep_seq[seqnum[i]] = core_if->first_in_nextep_seq; ++ break; ++ } ++ } else { ++ break; ++ } ++ } ++ ++ DWC_DEBUGPL(DBG_PCDV, "%s first_in_nextep_seq= %2d; nextep_seq[]:\n", ++ __func__, core_if->first_in_nextep_seq); ++ for (i=0; i <= core_if->dev_if->num_in_eps; i++) { ++ DWC_DEBUGPL(DBG_PCDV,"%2d\n", core_if->nextep_seq[i]); ++ } ++ ++ /* Flush the Learning Queue */ ++ resetctl.d32 = DWC_READ_REG32(&core_if->core_global_regs->grstctl); ++ resetctl.b.intknqflsh = 1; ++ DWC_WRITE_REG32(&core_if->core_global_regs->grstctl, resetctl.d32); ++ ++ ++} ++ ++/** ++ * handle the IN EP disable interrupt. ++ */ ++static inline void handle_in_ep_disable_intr(dwc_otg_pcd_t * pcd, ++ const uint32_t epnum) ++{ ++ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); ++ dwc_otg_dev_if_t *dev_if = core_if->dev_if; ++ deptsiz_data_t dieptsiz = {.d32 = 0 }; ++ dctl_data_t dctl = {.d32 = 0 }; ++ dwc_otg_pcd_ep_t *ep; ++ dwc_ep_t *dwc_ep; ++ gintmsk_data_t gintmsk_data; ++ depctl_data_t depctl; ++ uint32_t diepdma; ++ uint32_t remain_to_transfer = 0; ++ uint8_t i; ++ uint32_t xfer_size; ++ ++ ep = get_in_ep(pcd, epnum); ++ dwc_ep = &ep->dwc_ep; ++ ++ if (dwc_ep->type == DWC_OTG_EP_TYPE_ISOC) { ++ dwc_otg_flush_tx_fifo(core_if, dwc_ep->tx_fifo_num); ++ complete_ep(ep); ++ return; ++ } ++ ++ DWC_DEBUGPL(DBG_PCD, "diepctl%d=%0x\n", epnum, ++ DWC_READ_REG32(&dev_if->in_ep_regs[epnum]->diepctl)); ++ dieptsiz.d32 = DWC_READ_REG32(&dev_if->in_ep_regs[epnum]->dieptsiz); ++ depctl.d32 = DWC_READ_REG32(&dev_if->in_ep_regs[epnum]->diepctl); ++ ++ DWC_DEBUGPL(DBG_ANY, "pktcnt=%d size=%d\n", ++ dieptsiz.b.pktcnt, dieptsiz.b.xfersize); ++ ++ if ((core_if->start_predict == 0) || (depctl.b.eptype & 1)) { ++ if (ep->stopped) { ++ if (core_if->en_multiple_tx_fifo) ++ /* Flush the Tx FIFO */ ++ dwc_otg_flush_tx_fifo(core_if, dwc_ep->tx_fifo_num); ++ /* Clear the Global IN NP NAK */ ++ dctl.d32 = 0; ++ dctl.b.cgnpinnak = 1; ++ DWC_MODIFY_REG32(&dev_if->dev_global_regs->dctl, dctl.d32, dctl.d32); ++ /* Restart the transaction */ ++ if (dieptsiz.b.pktcnt != 0 || dieptsiz.b.xfersize != 0) { ++ restart_transfer(pcd, epnum); ++ } ++ } else { ++ /* Restart the transaction */ ++ if (dieptsiz.b.pktcnt != 0 || dieptsiz.b.xfersize != 0) { ++ restart_transfer(pcd, epnum); ++ } ++ DWC_DEBUGPL(DBG_ANY, "STOPPED!!!\n"); ++ } ++ return; ++ } ++ ++ if (core_if->start_predict > 2) { // NP IN EP ++ core_if->start_predict--; ++ return; ++ } ++ ++ core_if->start_predict--; ++ ++ if (core_if->start_predict == 1) { // All NP IN Ep's disabled now ++ ++ predict_nextep_seq(core_if); ++ ++ /* Update all active IN EP's NextEP field based of nextep_seq[] */ ++ for ( i = 0; i <= core_if->dev_if->num_in_eps; i++) { ++ depctl.d32 = ++ DWC_READ_REG32(&dev_if->in_ep_regs[i]->diepctl); ++ if (core_if->nextep_seq[i] != 0xff) { // Active NP IN EP ++ depctl.b.nextep = core_if->nextep_seq[i]; ++ DWC_WRITE_REG32(&dev_if->in_ep_regs[i]->diepctl, depctl.d32); ++ } ++ } ++ /* Flush Shared NP TxFIFO */ ++ dwc_otg_flush_tx_fifo(core_if, 0); ++ /* Rewind buffers */ ++ if (!core_if->dma_desc_enable) { ++ i = core_if->first_in_nextep_seq; ++ do { ++ ep = get_in_ep(pcd, i); ++ dieptsiz.d32 = DWC_READ_REG32(&dev_if->in_ep_regs[i]->dieptsiz); ++ xfer_size = ep->dwc_ep.total_len - ep->dwc_ep.xfer_count; ++ if (xfer_size > ep->dwc_ep.maxxfer) ++ xfer_size = ep->dwc_ep.maxxfer; ++ depctl.d32 = DWC_READ_REG32(&dev_if->in_ep_regs[i]->diepctl); ++ if (dieptsiz.b.pktcnt != 0) { ++ if (xfer_size == 0) { ++ remain_to_transfer = 0; ++ } else { ++ if ((xfer_size % ep->dwc_ep.maxpacket) == 0) { ++ remain_to_transfer = ++ dieptsiz.b.pktcnt * ep->dwc_ep.maxpacket; ++ } else { ++ remain_to_transfer = ((dieptsiz.b.pktcnt -1) * ep->dwc_ep.maxpacket) ++ + (xfer_size % ep->dwc_ep.maxpacket); ++ } ++ } ++ diepdma = DWC_READ_REG32(&dev_if->in_ep_regs[i]->diepdma); ++ dieptsiz.b.xfersize = remain_to_transfer; ++ DWC_WRITE_REG32(&dev_if->in_ep_regs[i]->dieptsiz, dieptsiz.d32); ++ diepdma = ep->dwc_ep.dma_addr + (xfer_size - remain_to_transfer); ++ DWC_WRITE_REG32(&dev_if->in_ep_regs[i]->diepdma, diepdma); ++ } ++ i = core_if->nextep_seq[i]; ++ } while (i != core_if->first_in_nextep_seq); ++ } else { // dma_desc_enable ++ DWC_PRINTF("%s Learning Queue not supported in DDMA\n", __func__); ++ } ++ ++ /* Restart transfers in predicted sequences */ ++ i = core_if->first_in_nextep_seq; ++ do { ++ dieptsiz.d32 = DWC_READ_REG32(&dev_if->in_ep_regs[i]->dieptsiz); ++ depctl.d32 = DWC_READ_REG32(&dev_if->in_ep_regs[i]->diepctl); ++ if (dieptsiz.b.pktcnt != 0) { ++ depctl.d32 = DWC_READ_REG32(&dev_if->in_ep_regs[i]->diepctl); ++ depctl.b.epena = 1; ++ depctl.b.cnak = 1; ++ DWC_WRITE_REG32(&dev_if->in_ep_regs[i]->diepctl, depctl.d32); ++ } ++ i = core_if->nextep_seq[i]; ++ } while (i != core_if->first_in_nextep_seq); ++ ++ /* Clear the global non-periodic IN NAK handshake */ ++ dctl.d32 = 0; ++ dctl.b.cgnpinnak = 1; ++ DWC_MODIFY_REG32(&dev_if->dev_global_regs->dctl, dctl.d32, dctl.d32); ++ ++ /* Unmask EP Mismatch interrupt */ ++ gintmsk_data.d32 = 0; ++ gintmsk_data.b.epmismatch = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gintmsk, 0, gintmsk_data.d32); ++ ++ core_if->start_predict = 0; ++ ++ } ++} ++ ++/** ++ * Handler for the IN EP timeout handshake interrupt. ++ */ ++static inline void handle_in_ep_timeout_intr(dwc_otg_pcd_t * pcd, ++ const uint32_t epnum) ++{ ++ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); ++ dwc_otg_dev_if_t *dev_if = core_if->dev_if; ++ ++#ifdef DEBUG ++ deptsiz_data_t dieptsiz = {.d32 = 0 }; ++ uint32_t num = 0; ++#endif ++ dctl_data_t dctl = {.d32 = 0 }; ++ dwc_otg_pcd_ep_t *ep; ++ ++ gintmsk_data_t intr_mask = {.d32 = 0 }; ++ ++ ep = get_in_ep(pcd, epnum); ++ ++ /* Disable the NP Tx Fifo Empty Interrrupt */ ++ if (!core_if->dma_enable) { ++ intr_mask.b.nptxfempty = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gintmsk, ++ intr_mask.d32, 0); ++ } ++ /** @todo NGS Check EP type. ++ * Implement for Periodic EPs */ ++ /* ++ * Non-periodic EP ++ */ ++ /* Enable the Global IN NAK Effective Interrupt */ ++ intr_mask.b.ginnakeff = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gintmsk, 0, intr_mask.d32); ++ ++ /* Set Global IN NAK */ ++ dctl.b.sgnpinnak = 1; ++ DWC_MODIFY_REG32(&dev_if->dev_global_regs->dctl, dctl.d32, dctl.d32); ++ ++ ep->stopped = 1; ++ ++#ifdef DEBUG ++ dieptsiz.d32 = DWC_READ_REG32(&dev_if->in_ep_regs[num]->dieptsiz); ++ DWC_DEBUGPL(DBG_ANY, "pktcnt=%d size=%d\n", ++ dieptsiz.b.pktcnt, dieptsiz.b.xfersize); ++#endif ++ ++#ifdef DISABLE_PERIODIC_EP ++ /* ++ * Set the NAK bit for this EP to ++ * start the disable process. ++ */ ++ diepctl.d32 = 0; ++ diepctl.b.snak = 1; ++ DWC_MODIFY_REG32(&dev_if->in_ep_regs[num]->diepctl, diepctl.d32, ++ diepctl.d32); ++ ep->disabling = 1; ++ ep->stopped = 1; ++#endif ++} ++ ++/** ++ * Handler for the IN EP NAK interrupt. ++ */ ++static inline int32_t handle_in_ep_nak_intr(dwc_otg_pcd_t * pcd, ++ const uint32_t epnum) ++{ ++ /** @todo implement ISR */ ++ dwc_otg_core_if_t *core_if; ++ diepmsk_data_t intr_mask = {.d32 = 0 }; ++ ++ DWC_PRINTF("INTERRUPT Handler not implemented for %s\n", "IN EP NAK"); ++ core_if = GET_CORE_IF(pcd); ++ intr_mask.b.nak = 1; ++ ++ if (core_if->multiproc_int_enable) { ++ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs-> ++ diepeachintmsk[epnum], intr_mask.d32, 0); ++ } else { ++ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs->diepmsk, ++ intr_mask.d32, 0); ++ } ++ ++ return 1; ++} ++ ++/** ++ * Handler for the OUT EP Babble interrupt. ++ */ ++static inline int32_t handle_out_ep_babble_intr(dwc_otg_pcd_t * pcd, ++ const uint32_t epnum) ++{ ++ /** @todo implement ISR */ ++ dwc_otg_core_if_t *core_if; ++ doepmsk_data_t intr_mask = {.d32 = 0 }; ++ ++ DWC_PRINTF("INTERRUPT Handler not implemented for %s\n", ++ "OUT EP Babble"); ++ core_if = GET_CORE_IF(pcd); ++ intr_mask.b.babble = 1; ++ ++ if (core_if->multiproc_int_enable) { ++ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs-> ++ doepeachintmsk[epnum], intr_mask.d32, 0); ++ } else { ++ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs->doepmsk, ++ intr_mask.d32, 0); ++ } ++ ++ return 1; ++} ++ ++/** ++ * Handler for the OUT EP NAK interrupt. ++ */ ++static inline int32_t handle_out_ep_nak_intr(dwc_otg_pcd_t * pcd, ++ const uint32_t epnum) ++{ ++ /** @todo implement ISR */ ++ dwc_otg_core_if_t *core_if; ++ doepmsk_data_t intr_mask = {.d32 = 0 }; ++ ++ DWC_DEBUGPL(DBG_ANY, "INTERRUPT Handler not implemented for %s\n", "OUT EP NAK"); ++ core_if = GET_CORE_IF(pcd); ++ intr_mask.b.nak = 1; ++ ++ if (core_if->multiproc_int_enable) { ++ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs-> ++ doepeachintmsk[epnum], intr_mask.d32, 0); ++ } else { ++ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs->doepmsk, ++ intr_mask.d32, 0); ++ } ++ ++ return 1; ++} ++ ++/** ++ * Handler for the OUT EP NYET interrupt. ++ */ ++static inline int32_t handle_out_ep_nyet_intr(dwc_otg_pcd_t * pcd, ++ const uint32_t epnum) ++{ ++ /** @todo implement ISR */ ++ dwc_otg_core_if_t *core_if; ++ doepmsk_data_t intr_mask = {.d32 = 0 }; ++ ++ DWC_PRINTF("INTERRUPT Handler not implemented for %s\n", "OUT EP NYET"); ++ core_if = GET_CORE_IF(pcd); ++ intr_mask.b.nyet = 1; ++ ++ if (core_if->multiproc_int_enable) { ++ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs-> ++ doepeachintmsk[epnum], intr_mask.d32, 0); ++ } else { ++ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs->doepmsk, ++ intr_mask.d32, 0); ++ } ++ ++ return 1; ++} ++ ++/** ++ * This interrupt indicates that an IN EP has a pending Interrupt. ++ * The sequence for handling the IN EP interrupt is shown below: ++ * -# Read the Device All Endpoint Interrupt register ++ * -# Repeat the following for each IN EP interrupt bit set (from ++ * LSB to MSB). ++ * -# Read the Device Endpoint Interrupt (DIEPINTn) register ++ * -# If "Transfer Complete" call the request complete function ++ * -# If "Endpoint Disabled" complete the EP disable procedure. ++ * -# If "AHB Error Interrupt" log error ++ * -# If "Time-out Handshake" log error ++ * -# If "IN Token Received when TxFIFO Empty" write packet to Tx ++ * FIFO. ++ * -# If "IN Token EP Mismatch" (disable, this is handled by EP ++ * Mismatch Interrupt) ++ */ ++static int32_t dwc_otg_pcd_handle_in_ep_intr(dwc_otg_pcd_t * pcd) ++{ ++#define CLEAR_IN_EP_INTR(__core_if,__epnum,__intr) \ ++do { \ ++ diepint_data_t diepint = {.d32=0}; \ ++ diepint.b.__intr = 1; \ ++ DWC_WRITE_REG32(&__core_if->dev_if->in_ep_regs[__epnum]->diepint, \ ++ diepint.d32); \ ++} while (0) ++ ++ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); ++ dwc_otg_dev_if_t *dev_if = core_if->dev_if; ++ diepint_data_t diepint = {.d32 = 0 }; ++ depctl_data_t depctl = {.d32 = 0 }; ++ uint32_t ep_intr; ++ uint32_t epnum = 0; ++ dwc_otg_pcd_ep_t *ep; ++ dwc_ep_t *dwc_ep; ++ gintmsk_data_t intr_mask = {.d32 = 0 }; ++ ++ DWC_DEBUGPL(DBG_PCDV, "%s(%p)\n", __func__, pcd); ++ ++ /* Read in the device interrupt bits */ ++ ep_intr = dwc_otg_read_dev_all_in_ep_intr(core_if); ++ ++ /* Service the Device IN interrupts for each endpoint */ ++ while (ep_intr) { ++ if (ep_intr & 0x1) { ++ uint32_t empty_msk; ++ /* Get EP pointer */ ++ ep = get_in_ep(pcd, epnum); ++ dwc_ep = &ep->dwc_ep; ++ ++ depctl.d32 = ++ DWC_READ_REG32(&dev_if->in_ep_regs[epnum]->diepctl); ++ empty_msk = ++ DWC_READ_REG32(&dev_if-> ++ dev_global_regs->dtknqr4_fifoemptymsk); ++ ++ DWC_DEBUGPL(DBG_PCDV, ++ "IN EP INTERRUPT - %d\nepmty_msk - %8x diepctl - %8x\n", ++ epnum, empty_msk, depctl.d32); ++ ++ DWC_DEBUGPL(DBG_PCD, ++ "EP%d-%s: type=%d, mps=%d\n", ++ dwc_ep->num, (dwc_ep->is_in ? "IN" : "OUT"), ++ dwc_ep->type, dwc_ep->maxpacket); ++ ++ diepint.d32 = ++ dwc_otg_read_dev_in_ep_intr(core_if, dwc_ep); ++ ++ DWC_DEBUGPL(DBG_PCDV, ++ "EP %d Interrupt Register - 0x%x\n", epnum, ++ diepint.d32); ++ /* Transfer complete */ ++ if (diepint.b.xfercompl) { ++ /* Disable the NP Tx FIFO Empty ++ * Interrupt */ ++ if (core_if->en_multiple_tx_fifo == 0) { ++ intr_mask.b.nptxfempty = 1; ++ DWC_MODIFY_REG32 ++ (&core_if->core_global_regs->gintmsk, ++ intr_mask.d32, 0); ++ } else { ++ /* Disable the Tx FIFO Empty Interrupt for this EP */ ++ uint32_t fifoemptymsk = ++ 0x1 << dwc_ep->num; ++ DWC_MODIFY_REG32(&core_if-> ++ dev_if->dev_global_regs->dtknqr4_fifoemptymsk, ++ fifoemptymsk, 0); ++ } ++ /* Clear the bit in DIEPINTn for this interrupt */ ++ CLEAR_IN_EP_INTR(core_if, epnum, xfercompl); ++ ++ /* Complete the transfer */ ++ if (epnum == 0) { ++ handle_ep0(pcd); ++ } ++#ifdef DWC_EN_ISOC ++ else if (dwc_ep->type == DWC_OTG_EP_TYPE_ISOC) { ++ if (!ep->stopped) ++ complete_iso_ep(pcd, ep); ++ } ++#endif /* DWC_EN_ISOC */ ++#ifdef DWC_UTE_PER_IO ++ else if (dwc_ep->type == DWC_OTG_EP_TYPE_ISOC) { ++ if (!ep->stopped) ++ complete_xiso_ep(ep); ++ } ++#endif /* DWC_UTE_PER_IO */ ++ else { ++ if (dwc_ep->type == DWC_OTG_EP_TYPE_ISOC && ++ dwc_ep->bInterval > 1) { ++ dwc_ep->frame_num += dwc_ep->bInterval; ++ if (dwc_ep->frame_num > 0x3FFF) ++ { ++ dwc_ep->frm_overrun = 1; ++ dwc_ep->frame_num &= 0x3FFF; ++ } else ++ dwc_ep->frm_overrun = 0; ++ } ++ complete_ep(ep); ++ if(diepint.b.nak) ++ CLEAR_IN_EP_INTR(core_if, epnum, nak); ++ } ++ } ++ /* Endpoint disable */ ++ if (diepint.b.epdisabled) { ++ DWC_DEBUGPL(DBG_ANY, "EP%d IN disabled\n", ++ epnum); ++ handle_in_ep_disable_intr(pcd, epnum); ++ ++ /* Clear the bit in DIEPINTn for this interrupt */ ++ CLEAR_IN_EP_INTR(core_if, epnum, epdisabled); ++ } ++ /* AHB Error */ ++ if (diepint.b.ahberr) { ++ DWC_ERROR("EP%d IN AHB Error\n", epnum); ++ /* Clear the bit in DIEPINTn for this interrupt */ ++ CLEAR_IN_EP_INTR(core_if, epnum, ahberr); ++ } ++ /* TimeOUT Handshake (non-ISOC IN EPs) */ ++ if (diepint.b.timeout) { ++ DWC_ERROR("EP%d IN Time-out\n", epnum); ++ handle_in_ep_timeout_intr(pcd, epnum); ++ ++ CLEAR_IN_EP_INTR(core_if, epnum, timeout); ++ } ++ /** IN Token received with TxF Empty */ ++ if (diepint.b.intktxfemp) { ++ DWC_DEBUGPL(DBG_ANY, ++ "EP%d IN TKN TxFifo Empty\n", ++ epnum); ++ if (!ep->stopped && epnum != 0) { ++ ++ diepmsk_data_t diepmsk = {.d32 = 0 }; ++ diepmsk.b.intktxfemp = 1; ++ ++ if (core_if->multiproc_int_enable) { ++ DWC_MODIFY_REG32 ++ (&dev_if->dev_global_regs->diepeachintmsk ++ [epnum], diepmsk.d32, 0); ++ } else { ++ DWC_MODIFY_REG32 ++ (&dev_if->dev_global_regs->diepmsk, ++ diepmsk.d32, 0); ++ } ++ } else if (core_if->dma_desc_enable ++ && epnum == 0 ++ && pcd->ep0state == ++ EP0_OUT_STATUS_PHASE) { ++ // EP0 IN set STALL ++ depctl.d32 = ++ DWC_READ_REG32(&dev_if->in_ep_regs ++ [epnum]->diepctl); ++ ++ /* set the disable and stall bits */ ++ if (depctl.b.epena) { ++ depctl.b.epdis = 1; ++ } ++ depctl.b.stall = 1; ++ DWC_WRITE_REG32(&dev_if->in_ep_regs ++ [epnum]->diepctl, ++ depctl.d32); ++ } ++ CLEAR_IN_EP_INTR(core_if, epnum, intktxfemp); ++ } ++ /** IN Token Received with EP mismatch */ ++ if (diepint.b.intknepmis) { ++ DWC_DEBUGPL(DBG_ANY, ++ "EP%d IN TKN EP Mismatch\n", epnum); ++ CLEAR_IN_EP_INTR(core_if, epnum, intknepmis); ++ } ++ /** IN Endpoint NAK Effective */ ++ if (diepint.b.inepnakeff) { ++ DWC_DEBUGPL(DBG_ANY, ++ "EP%d IN EP NAK Effective\n", ++ epnum); ++ /* Periodic EP */ ++ if (ep->disabling) { ++ depctl.d32 = 0; ++ depctl.b.snak = 1; ++ depctl.b.epdis = 1; ++ DWC_MODIFY_REG32(&dev_if->in_ep_regs ++ [epnum]->diepctl, ++ depctl.d32, ++ depctl.d32); ++ } ++ CLEAR_IN_EP_INTR(core_if, epnum, inepnakeff); ++ ++ } ++ ++ /** IN EP Tx FIFO Empty Intr */ ++ if (diepint.b.emptyintr) { ++ DWC_DEBUGPL(DBG_ANY, ++ "EP%d Tx FIFO Empty Intr \n", ++ epnum); ++ write_empty_tx_fifo(pcd, epnum); ++ ++ CLEAR_IN_EP_INTR(core_if, epnum, emptyintr); ++ ++ } ++ ++ /** IN EP BNA Intr */ ++ if (diepint.b.bna) { ++ CLEAR_IN_EP_INTR(core_if, epnum, bna); ++ if (core_if->dma_desc_enable) { ++#ifdef DWC_EN_ISOC ++ if (dwc_ep->type == ++ DWC_OTG_EP_TYPE_ISOC) { ++ /* ++ * This checking is performed to prevent first "false" BNA ++ * handling occuring right after reconnect ++ */ ++ if (dwc_ep->next_frame != ++ 0xffffffff) ++ dwc_otg_pcd_handle_iso_bna(ep); ++ } else ++#endif /* DWC_EN_ISOC */ ++ { ++ dwc_otg_pcd_handle_noniso_bna(ep); ++ } ++ } ++ } ++ /* NAK Interrutp */ ++ if (diepint.b.nak) { ++ DWC_DEBUGPL(DBG_ANY, "EP%d IN NAK Interrupt\n", ++ epnum); ++ if (ep->dwc_ep.type == DWC_OTG_EP_TYPE_ISOC) { ++ depctl_data_t depctl; ++ if (ep->dwc_ep.frame_num == 0xFFFFFFFF) { ++ ep->dwc_ep.frame_num = core_if->frame_num; ++ if (ep->dwc_ep.bInterval > 1) { ++ depctl.d32 = 0; ++ depctl.d32 = DWC_READ_REG32(&dev_if->in_ep_regs[epnum]->diepctl); ++ if (ep->dwc_ep.frame_num & 0x1) { ++ depctl.b.setd1pid = 1; ++ depctl.b.setd0pid = 0; ++ } else { ++ depctl.b.setd0pid = 1; ++ depctl.b.setd1pid = 0; ++ } ++ DWC_WRITE_REG32(&dev_if->in_ep_regs[epnum]->diepctl, depctl.d32); ++ } ++ start_next_request(ep); ++ } ++ ep->dwc_ep.frame_num += ep->dwc_ep.bInterval; ++ if (dwc_ep->frame_num > 0x3FFF) { ++ dwc_ep->frm_overrun = 1; ++ dwc_ep->frame_num &= 0x3FFF; ++ } else ++ dwc_ep->frm_overrun = 0; ++ } ++ ++ CLEAR_IN_EP_INTR(core_if, epnum, nak); ++ } ++ } ++ epnum++; ++ ep_intr >>= 1; ++ } ++ ++ return 1; ++#undef CLEAR_IN_EP_INTR ++} ++ ++/** ++ * This interrupt indicates that an OUT EP has a pending Interrupt. ++ * The sequence for handling the OUT EP interrupt is shown below: ++ * -# Read the Device All Endpoint Interrupt register ++ * -# Repeat the following for each OUT EP interrupt bit set (from ++ * LSB to MSB). ++ * -# Read the Device Endpoint Interrupt (DOEPINTn) register ++ * -# If "Transfer Complete" call the request complete function ++ * -# If "Endpoint Disabled" complete the EP disable procedure. ++ * -# If "AHB Error Interrupt" log error ++ * -# If "Setup Phase Done" process Setup Packet (See Standard USB ++ * Command Processing) ++ */ ++static int32_t dwc_otg_pcd_handle_out_ep_intr(dwc_otg_pcd_t * pcd) ++{ ++#define CLEAR_OUT_EP_INTR(__core_if,__epnum,__intr) \ ++do { \ ++ doepint_data_t doepint = {.d32=0}; \ ++ doepint.b.__intr = 1; \ ++ DWC_WRITE_REG32(&__core_if->dev_if->out_ep_regs[__epnum]->doepint, \ ++ doepint.d32); \ ++} while (0) ++ ++ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); ++ uint32_t ep_intr; ++ doepint_data_t doepint = {.d32 = 0 }; ++ uint32_t epnum = 0; ++ dwc_otg_pcd_ep_t *ep; ++ dwc_ep_t *dwc_ep; ++ dctl_data_t dctl = {.d32 = 0 }; ++ gintmsk_data_t gintmsk = {.d32 = 0 }; ++ ++ ++ DWC_DEBUGPL(DBG_PCDV, "%s()\n", __func__); ++ ++ /* Read in the device interrupt bits */ ++ ep_intr = dwc_otg_read_dev_all_out_ep_intr(core_if); ++ ++ while (ep_intr) { ++ if (ep_intr & 0x1) { ++ /* Get EP pointer */ ++ ep = get_out_ep(pcd, epnum); ++ dwc_ep = &ep->dwc_ep; ++ ++#ifdef VERBOSE ++ DWC_DEBUGPL(DBG_PCDV, ++ "EP%d-%s: type=%d, mps=%d\n", ++ dwc_ep->num, (dwc_ep->is_in ? "IN" : "OUT"), ++ dwc_ep->type, dwc_ep->maxpacket); ++#endif ++ doepint.d32 = ++ dwc_otg_read_dev_out_ep_intr(core_if, dwc_ep); ++ /* Moved this interrupt upper due to core deffect of asserting ++ * OUT EP 0 xfercompl along with stsphsrcvd in BDMA */ ++ if (doepint.b.stsphsercvd) { ++ deptsiz0_data_t deptsiz; ++ CLEAR_OUT_EP_INTR(core_if, epnum, stsphsercvd); ++ deptsiz.d32 = ++ DWC_READ_REG32(&core_if->dev_if-> ++ out_ep_regs[0]->doeptsiz); ++ if (core_if->snpsid >= OTG_CORE_REV_3_00a ++ && core_if->dma_enable ++ && core_if->dma_desc_enable == 0 ++ && doepint.b.xfercompl ++ && deptsiz.b.xfersize == 24) { ++ CLEAR_OUT_EP_INTR(core_if, epnum, ++ xfercompl); ++ doepint.b.xfercompl = 0; ++ ep0_out_start(core_if, pcd); ++ } ++ if ((core_if->dma_desc_enable) || ++ (core_if->dma_enable ++ && core_if->snpsid >= ++ OTG_CORE_REV_3_00a)) { ++ do_setup_in_status_phase(pcd); ++ } ++ } ++ /* Transfer complete */ ++ if (doepint.b.xfercompl) { ++ ++ if (epnum == 0) { ++ /* Clear the bit in DOEPINTn for this interrupt */ ++ CLEAR_OUT_EP_INTR(core_if, epnum, xfercompl); ++ if (core_if->snpsid >= OTG_CORE_REV_3_00a) { ++ DWC_DEBUGPL(DBG_PCDV, "DOEPINT=%x doepint=%x\n", ++ DWC_READ_REG32(&core_if->dev_if->out_ep_regs[0]->doepint), ++ doepint.d32); ++ DWC_DEBUGPL(DBG_PCDV, "DOEPCTL=%x \n", ++ DWC_READ_REG32(&core_if->dev_if->out_ep_regs[0]->doepctl)); ++ ++ if (core_if->snpsid >= OTG_CORE_REV_3_00a ++ && core_if->dma_enable == 0) { ++ doepint_data_t doepint; ++ doepint.d32 = DWC_READ_REG32(&core_if->dev_if-> ++ out_ep_regs[0]->doepint); ++ if (pcd->ep0state == EP0_IDLE && doepint.b.sr) { ++ CLEAR_OUT_EP_INTR(core_if, epnum, sr); ++ goto exit_xfercompl; ++ } ++ } ++ /* In case of DDMA look at SR bit to go to the Data Stage */ ++ if (core_if->dma_desc_enable) { ++ dev_dma_desc_sts_t status = {.d32 = 0}; ++ if (pcd->ep0state == EP0_IDLE) { ++ status.d32 = core_if->dev_if->setup_desc_addr[core_if-> ++ dev_if->setup_desc_index]->status.d32; ++ if(pcd->data_terminated) { ++ pcd->data_terminated = 0; ++ status.d32 = core_if->dev_if->out_desc_addr->status.d32; ++ dwc_memcpy(&pcd->setup_pkt->req, pcd->backup_buf, 8); ++ } ++ if (status.b.sr) { ++ if (doepint.b.setup) { ++ DWC_DEBUGPL(DBG_PCDV, "DMA DESC EP0_IDLE SR=1 setup=1\n"); ++ /* Already started data stage, clear setup */ ++ CLEAR_OUT_EP_INTR(core_if, epnum, setup); ++ doepint.b.setup = 0; ++ handle_ep0(pcd); ++ /* Prepare for more setup packets */ ++ if (pcd->ep0state == EP0_IN_STATUS_PHASE || ++ pcd->ep0state == EP0_IN_DATA_PHASE) { ++ ep0_out_start(core_if, pcd); ++ } ++ ++ goto exit_xfercompl; ++ } else { ++ /* Prepare for more setup packets */ ++ DWC_DEBUGPL(DBG_PCDV, ++ "EP0_IDLE SR=1 setup=0 new setup comes\n"); ++ ep0_out_start(core_if, pcd); ++ } ++ } ++ } else { ++ dwc_otg_pcd_request_t *req; ++ dev_dma_desc_sts_t status = {.d32 = 0}; ++ diepint_data_t diepint0; ++ diepint0.d32 = DWC_READ_REG32(&core_if->dev_if-> ++ in_ep_regs[0]->diepint); ++ ++ if (pcd->ep0state == EP0_STALL || pcd->ep0state == EP0_DISCONNECT) { ++ DWC_ERROR("EP0 is stalled/disconnected\n"); ++ } ++ ++ /* Clear IN xfercompl if set */ ++ if (diepint0.b.xfercompl && (pcd->ep0state == EP0_IN_STATUS_PHASE ++ || pcd->ep0state == EP0_IN_DATA_PHASE)) { ++ DWC_WRITE_REG32(&core_if->dev_if-> ++ in_ep_regs[0]->diepint, diepint0.d32); ++ } ++ ++ status.d32 = core_if->dev_if->setup_desc_addr[core_if-> ++ dev_if->setup_desc_index]->status.d32; ++ ++ if (ep->dwc_ep.xfer_count != ep->dwc_ep.total_len ++ && (pcd->ep0state == EP0_OUT_DATA_PHASE)) ++ status.d32 = core_if->dev_if->out_desc_addr->status.d32; ++ if (pcd->ep0state == EP0_OUT_STATUS_PHASE) ++ status.d32 = core_if->dev_if-> ++ out_desc_addr->status.d32; ++ ++ if (status.b.sr) { ++ if (DWC_CIRCLEQ_EMPTY(&ep->queue)) { ++ DWC_DEBUGPL(DBG_PCDV, "Request queue empty!!\n"); ++ } else { ++ DWC_DEBUGPL(DBG_PCDV, "complete req!!\n"); ++ req = DWC_CIRCLEQ_FIRST(&ep->queue); ++ if (ep->dwc_ep.xfer_count != ep->dwc_ep.total_len && ++ pcd->ep0state == EP0_OUT_DATA_PHASE) { ++ /* Read arrived setup packet from req->buf */ ++ dwc_memcpy(&pcd->setup_pkt->req, ++ req->buf + ep->dwc_ep.xfer_count, 8); ++ } ++ req->actual = ep->dwc_ep.xfer_count; ++ dwc_otg_request_done(ep, req, -ECONNRESET); ++ ep->dwc_ep.start_xfer_buff = 0; ++ ep->dwc_ep.xfer_buff = 0; ++ ep->dwc_ep.xfer_len = 0; ++ } ++ pcd->ep0state = EP0_IDLE; ++ if (doepint.b.setup) { ++ DWC_DEBUGPL(DBG_PCDV, "EP0_IDLE SR=1 setup=1\n"); ++ /* Data stage started, clear setup */ ++ CLEAR_OUT_EP_INTR(core_if, epnum, setup); ++ doepint.b.setup = 0; ++ handle_ep0(pcd); ++ /* Prepare for setup packets if ep0in was enabled*/ ++ if (pcd->ep0state == EP0_IN_STATUS_PHASE) { ++ ep0_out_start(core_if, pcd); ++ } ++ ++ goto exit_xfercompl; ++ } else { ++ /* Prepare for more setup packets */ ++ DWC_DEBUGPL(DBG_PCDV, ++ "EP0_IDLE SR=1 setup=0 new setup comes 2\n"); ++ ep0_out_start(core_if, pcd); ++ } ++ } ++ } ++ } ++ if (core_if->snpsid >= OTG_CORE_REV_2_94a && core_if->dma_enable ++ && core_if->dma_desc_enable == 0) { ++ doepint_data_t doepint_temp = {.d32 = 0}; ++ deptsiz0_data_t doeptsize0 = {.d32 = 0 }; ++ doepint_temp.d32 = DWC_READ_REG32(&core_if->dev_if-> ++ out_ep_regs[ep->dwc_ep.num]->doepint); ++ doeptsize0.d32 = DWC_READ_REG32(&core_if->dev_if-> ++ out_ep_regs[ep->dwc_ep.num]->doeptsiz); ++ if (pcd->ep0state == EP0_IDLE) { ++ if (doepint_temp.b.sr) { ++ CLEAR_OUT_EP_INTR(core_if, epnum, sr); ++ } ++ doepint.d32 = DWC_READ_REG32(&core_if->dev_if-> ++ out_ep_regs[0]->doepint); ++ if (doeptsize0.b.supcnt == 3) { ++ DWC_DEBUGPL(DBG_ANY, "Rolling over!!!!!!!\n"); ++ ep->dwc_ep.stp_rollover = 1; ++ } ++ if (doepint.b.setup) { ++retry: ++ /* Already started data stage, clear setup */ ++ CLEAR_OUT_EP_INTR(core_if, epnum, setup); ++ doepint.b.setup = 0; ++ handle_ep0(pcd); ++ ep->dwc_ep.stp_rollover = 0; ++ /* Prepare for more setup packets */ ++ if (pcd->ep0state == EP0_IN_STATUS_PHASE || ++ pcd->ep0state == EP0_IN_DATA_PHASE) { ++ ep0_out_start(core_if, pcd); ++ } ++ goto exit_xfercompl; ++ } else { ++ /* Prepare for more setup packets */ ++ DWC_DEBUGPL(DBG_ANY, ++ "EP0_IDLE SR=1 setup=0 new setup comes\n"); ++ doepint.d32 = DWC_READ_REG32(&core_if->dev_if-> ++ out_ep_regs[0]->doepint); ++ if(doepint.b.setup) ++ goto retry; ++ ep0_out_start(core_if, pcd); ++ } ++ } else { ++ dwc_otg_pcd_request_t *req; ++ diepint_data_t diepint0 = {.d32 = 0}; ++ doepint_data_t doepint_temp = {.d32 = 0}; ++ depctl_data_t diepctl0; ++ diepint0.d32 = DWC_READ_REG32(&core_if->dev_if-> ++ in_ep_regs[0]->diepint); ++ diepctl0.d32 = DWC_READ_REG32(&core_if->dev_if-> ++ in_ep_regs[0]->diepctl); ++ ++ if (pcd->ep0state == EP0_IN_DATA_PHASE ++ || pcd->ep0state == EP0_IN_STATUS_PHASE) { ++ if (diepint0.b.xfercompl) { ++ DWC_WRITE_REG32(&core_if->dev_if-> ++ in_ep_regs[0]->diepint, diepint0.d32); ++ } ++ if (diepctl0.b.epena) { ++ diepint_data_t diepint = {.d32 = 0}; ++ diepctl0.b.snak = 1; ++ DWC_WRITE_REG32(&core_if->dev_if-> ++ in_ep_regs[0]->diepctl, diepctl0.d32); ++ do { ++ dwc_udelay(10); ++ diepint.d32 = DWC_READ_REG32(&core_if->dev_if-> ++ in_ep_regs[0]->diepint); ++ } while (!diepint.b.inepnakeff); ++ diepint.b.inepnakeff = 1; ++ DWC_WRITE_REG32(&core_if->dev_if-> ++ in_ep_regs[0]->diepint, diepint.d32); ++ diepctl0.d32 = 0; ++ diepctl0.b.epdis = 1; ++ DWC_WRITE_REG32(&core_if->dev_if->in_ep_regs[0]->diepctl, ++ diepctl0.d32); ++ do { ++ dwc_udelay(10); ++ diepint.d32 = DWC_READ_REG32(&core_if->dev_if-> ++ in_ep_regs[0]->diepint); ++ } while (!diepint.b.epdisabled); ++ diepint.b.epdisabled = 1; ++ DWC_WRITE_REG32(&core_if->dev_if->in_ep_regs[0]->diepint, ++ diepint.d32); ++ } ++ } ++ doepint_temp.d32 = DWC_READ_REG32(&core_if->dev_if-> ++ out_ep_regs[ep->dwc_ep.num]->doepint); ++ if (doepint_temp.b.sr) { ++ CLEAR_OUT_EP_INTR(core_if, epnum, sr); ++ if (DWC_CIRCLEQ_EMPTY(&ep->queue)) { ++ DWC_DEBUGPL(DBG_PCDV, "Request queue empty!!\n"); ++ } else { ++ DWC_DEBUGPL(DBG_PCDV, "complete req!!\n"); ++ req = DWC_CIRCLEQ_FIRST(&ep->queue); ++ if (ep->dwc_ep.xfer_count != ep->dwc_ep.total_len && ++ pcd->ep0state == EP0_OUT_DATA_PHASE) { ++ /* Read arrived setup packet from req->buf */ ++ dwc_memcpy(&pcd->setup_pkt->req, ++ req->buf + ep->dwc_ep.xfer_count, 8); ++ } ++ req->actual = ep->dwc_ep.xfer_count; ++ dwc_otg_request_done(ep, req, -ECONNRESET); ++ ep->dwc_ep.start_xfer_buff = 0; ++ ep->dwc_ep.xfer_buff = 0; ++ ep->dwc_ep.xfer_len = 0; ++ } ++ pcd->ep0state = EP0_IDLE; ++ if (doepint.b.setup) { ++ DWC_DEBUGPL(DBG_PCDV, "EP0_IDLE SR=1 setup=1\n"); ++ /* Data stage started, clear setup */ ++ CLEAR_OUT_EP_INTR(core_if, epnum, setup); ++ doepint.b.setup = 0; ++ handle_ep0(pcd); ++ /* Prepare for setup packets if ep0in was enabled*/ ++ if (pcd->ep0state == EP0_IN_STATUS_PHASE) { ++ ep0_out_start(core_if, pcd); ++ } ++ goto exit_xfercompl; ++ } else { ++ /* Prepare for more setup packets */ ++ DWC_DEBUGPL(DBG_PCDV, ++ "EP0_IDLE SR=1 setup=0 new setup comes 2\n"); ++ ep0_out_start(core_if, pcd); ++ } ++ } ++ } ++ } ++ if (core_if->dma_enable == 0 || pcd->ep0state != EP0_IDLE) ++ handle_ep0(pcd); ++exit_xfercompl: ++ DWC_DEBUGPL(DBG_PCDV, "DOEPINT=%x doepint=%x\n", ++ dwc_otg_read_dev_out_ep_intr(core_if, dwc_ep), doepint.d32); ++ } else { ++ if (core_if->dma_desc_enable == 0 ++ || pcd->ep0state != EP0_IDLE) ++ handle_ep0(pcd); ++ } ++#ifdef DWC_EN_ISOC ++ } else if (dwc_ep->type == DWC_OTG_EP_TYPE_ISOC) { ++ if (doepint.b.pktdrpsts == 0) { ++ /* Clear the bit in DOEPINTn for this interrupt */ ++ CLEAR_OUT_EP_INTR(core_if, ++ epnum, ++ xfercompl); ++ complete_iso_ep(pcd, ep); ++ } else { ++ ++ doepint_data_t doepint = {.d32 = 0 }; ++ doepint.b.xfercompl = 1; ++ doepint.b.pktdrpsts = 1; ++ DWC_WRITE_REG32 ++ (&core_if->dev_if->out_ep_regs ++ [epnum]->doepint, ++ doepint.d32); ++ if (handle_iso_out_pkt_dropped ++ (core_if, dwc_ep)) { ++ complete_iso_ep(pcd, ++ ep); ++ } ++ } ++#endif /* DWC_EN_ISOC */ ++#ifdef DWC_UTE_PER_IO ++ } else if (dwc_ep->type == DWC_OTG_EP_TYPE_ISOC) { ++ CLEAR_OUT_EP_INTR(core_if, epnum, xfercompl); ++ if (!ep->stopped) ++ complete_xiso_ep(ep); ++#endif /* DWC_UTE_PER_IO */ ++ } else { ++ /* Clear the bit in DOEPINTn for this interrupt */ ++ CLEAR_OUT_EP_INTR(core_if, epnum, ++ xfercompl); ++ ++ if (core_if->core_params->dev_out_nak) { ++ DWC_TIMER_CANCEL(pcd->core_if->ep_xfer_timer[epnum]); ++ pcd->core_if->ep_xfer_info[epnum].state = 0; ++#ifdef DEBUG ++ print_memory_payload(pcd, dwc_ep); ++#endif ++ } ++ complete_ep(ep); ++ } ++ ++ } ++ ++ /* Endpoint disable */ ++ if (doepint.b.epdisabled) { ++ ++ /* Clear the bit in DOEPINTn for this interrupt */ ++ CLEAR_OUT_EP_INTR(core_if, epnum, epdisabled); ++ if (core_if->core_params->dev_out_nak) { ++#ifdef DEBUG ++ print_memory_payload(pcd, dwc_ep); ++#endif ++ /* In case of timeout condition */ ++ if (core_if->ep_xfer_info[epnum].state == 2) { ++ dctl.d32 = DWC_READ_REG32(&core_if->dev_if-> ++ dev_global_regs->dctl); ++ dctl.b.cgoutnak = 1; ++ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->dctl, ++ dctl.d32); ++ /* Unmask goutnakeff interrupt which was masked ++ * during handle nak out interrupt */ ++ gintmsk.b.goutnakeff = 1; ++ DWC_MODIFY_REG32(&core_if->core_global_regs->gintmsk, ++ 0, gintmsk.d32); ++ ++ complete_ep(ep); ++ } ++ } ++ if (ep->dwc_ep.type == DWC_OTG_EP_TYPE_ISOC) ++ { ++ dctl_data_t dctl; ++ gintmsk_data_t intr_mask = {.d32 = 0}; ++ dwc_otg_pcd_request_t *req = 0; ++ ++ dctl.d32 = DWC_READ_REG32(&core_if->dev_if-> ++ dev_global_regs->dctl); ++ dctl.b.cgoutnak = 1; ++ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->dctl, ++ dctl.d32); ++ ++ intr_mask.d32 = 0; ++ intr_mask.b.incomplisoout = 1; ++ ++ /* Get any pending requests */ ++ if (!DWC_CIRCLEQ_EMPTY(&ep->queue)) { ++ req = DWC_CIRCLEQ_FIRST(&ep->queue); ++ if (!req) { ++ DWC_PRINTF("complete_ep 0x%p, req = NULL!\n", ep); ++ } else { ++ dwc_otg_request_done(ep, req, 0); ++ start_next_request(ep); ++ } ++ } else { ++ DWC_PRINTF("complete_ep 0x%p, ep->queue empty!\n", ep); ++ } ++ } ++ } ++ /* AHB Error */ ++ if (doepint.b.ahberr) { ++ DWC_ERROR("EP%d OUT AHB Error\n", epnum); ++ DWC_ERROR("EP%d DEPDMA=0x%08x \n", ++ epnum, core_if->dev_if->out_ep_regs[epnum]->doepdma); ++ CLEAR_OUT_EP_INTR(core_if, epnum, ahberr); ++ } ++ /* Setup Phase Done (contorl EPs) */ ++ if (doepint.b.setup) { ++#ifdef DEBUG_EP0 ++ DWC_DEBUGPL(DBG_PCD, "EP%d SETUP Done\n", epnum); ++#endif ++ CLEAR_OUT_EP_INTR(core_if, epnum, setup); ++ ++ handle_ep0(pcd); ++ } ++ ++ /** OUT EP BNA Intr */ ++ if (doepint.b.bna) { ++ CLEAR_OUT_EP_INTR(core_if, epnum, bna); ++ if (core_if->dma_desc_enable) { ++#ifdef DWC_EN_ISOC ++ if (dwc_ep->type == ++ DWC_OTG_EP_TYPE_ISOC) { ++ /* ++ * This checking is performed to prevent first "false" BNA ++ * handling occuring right after reconnect ++ */ ++ if (dwc_ep->next_frame != ++ 0xffffffff) ++ dwc_otg_pcd_handle_iso_bna(ep); ++ } else ++#endif /* DWC_EN_ISOC */ ++ { ++ dwc_otg_pcd_handle_noniso_bna(ep); ++ } ++ } ++ } ++ /* Babble Interrupt */ ++ if (doepint.b.babble) { ++ DWC_DEBUGPL(DBG_ANY, "EP%d OUT Babble\n", ++ epnum); ++ handle_out_ep_babble_intr(pcd, epnum); ++ ++ CLEAR_OUT_EP_INTR(core_if, epnum, babble); ++ } ++ if (doepint.b.outtknepdis) { ++ DWC_DEBUGPL(DBG_ANY, "EP%d OUT Token received when EP is \ ++ disabled\n",epnum); ++ if (ep->dwc_ep.type == DWC_OTG_EP_TYPE_ISOC) { ++ doepmsk_data_t doepmsk = {.d32 = 0}; ++ ep->dwc_ep.frame_num = core_if->frame_num; ++ if (ep->dwc_ep.bInterval > 1) { ++ depctl_data_t depctl; ++ depctl.d32 = DWC_READ_REG32(&core_if->dev_if-> ++ out_ep_regs[epnum]->doepctl); ++ if (ep->dwc_ep.frame_num & 0x1) { ++ depctl.b.setd1pid = 1; ++ depctl.b.setd0pid = 0; ++ } else { ++ depctl.b.setd0pid = 1; ++ depctl.b.setd1pid = 0; ++ } ++ DWC_WRITE_REG32(&core_if->dev_if-> ++ out_ep_regs[epnum]->doepctl, depctl.d32); ++ } ++ start_next_request(ep); ++ doepmsk.b.outtknepdis = 1; ++ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs->doepmsk, ++ doepmsk.d32, 0); ++ } ++ CLEAR_OUT_EP_INTR(core_if, epnum, outtknepdis); ++ } ++ ++ /* NAK Interrutp */ ++ if (doepint.b.nak) { ++ DWC_DEBUGPL(DBG_ANY, "EP%d OUT NAK\n", epnum); ++ handle_out_ep_nak_intr(pcd, epnum); ++ ++ CLEAR_OUT_EP_INTR(core_if, epnum, nak); ++ } ++ /* NYET Interrutp */ ++ if (doepint.b.nyet) { ++ DWC_DEBUGPL(DBG_ANY, "EP%d OUT NYET\n", epnum); ++ handle_out_ep_nyet_intr(pcd, epnum); ++ ++ CLEAR_OUT_EP_INTR(core_if, epnum, nyet); ++ } ++ } ++ ++ epnum++; ++ ep_intr >>= 1; ++ } ++ ++ return 1; ++ ++#undef CLEAR_OUT_EP_INTR ++} ++static int drop_transfer(uint32_t trgt_fr, uint32_t curr_fr, uint8_t frm_overrun) ++{ ++ int retval = 0; ++ if(!frm_overrun && curr_fr >= trgt_fr) ++ retval = 1; ++ else if (frm_overrun ++ && (curr_fr >= trgt_fr && ((curr_fr - trgt_fr) < 0x3FFF / 2))) ++ retval = 1; ++ return retval; ++} ++/** ++ * Incomplete ISO IN Transfer Interrupt. ++ * This interrupt indicates one of the following conditions occurred ++ * while transmitting an ISOC transaction. ++ * - Corrupted IN Token for ISOC EP. ++ * - Packet not complete in FIFO. ++ * The follow actions will be taken: ++ * -# Determine the EP ++ * -# Set incomplete flag in dwc_ep structure ++ * -# Disable EP; when "Endpoint Disabled" interrupt is received ++ * Flush FIFO ++ */ ++int32_t dwc_otg_pcd_handle_incomplete_isoc_in_intr(dwc_otg_pcd_t * pcd) ++{ ++ gintsts_data_t gintsts; ++ ++#ifdef DWC_EN_ISOC ++ dwc_otg_dev_if_t *dev_if; ++ deptsiz_data_t deptsiz = {.d32 = 0 }; ++ depctl_data_t depctl = {.d32 = 0 }; ++ dsts_data_t dsts = {.d32 = 0 }; ++ dwc_ep_t *dwc_ep; ++ int i; ++ ++ dev_if = GET_CORE_IF(pcd)->dev_if; ++ ++ for (i = 1; i <= dev_if->num_in_eps; ++i) { ++ dwc_ep = &pcd->in_ep[i].dwc_ep; ++ if (dwc_ep->active && dwc_ep->type == DWC_OTG_EP_TYPE_ISOC) { ++ deptsiz.d32 = ++ DWC_READ_REG32(&dev_if->in_ep_regs[i]->dieptsiz); ++ depctl.d32 = ++ DWC_READ_REG32(&dev_if->in_ep_regs[i]->diepctl); ++ ++ if (depctl.b.epdis && deptsiz.d32) { ++ set_current_pkt_info(GET_CORE_IF(pcd), dwc_ep); ++ if (dwc_ep->cur_pkt >= dwc_ep->pkt_cnt) { ++ dwc_ep->cur_pkt = 0; ++ dwc_ep->proc_buf_num = ++ (dwc_ep->proc_buf_num ^ 1) & 0x1; ++ ++ if (dwc_ep->proc_buf_num) { ++ dwc_ep->cur_pkt_addr = ++ dwc_ep->xfer_buff1; ++ dwc_ep->cur_pkt_dma_addr = ++ dwc_ep->dma_addr1; ++ } else { ++ dwc_ep->cur_pkt_addr = ++ dwc_ep->xfer_buff0; ++ dwc_ep->cur_pkt_dma_addr = ++ dwc_ep->dma_addr0; ++ } ++ ++ } ++ ++ dsts.d32 = ++ DWC_READ_REG32(&GET_CORE_IF(pcd)->dev_if-> ++ dev_global_regs->dsts); ++ dwc_ep->next_frame = dsts.b.soffn; ++ ++ dwc_otg_iso_ep_start_frm_transfer(GET_CORE_IF ++ (pcd), ++ dwc_ep); ++ } ++ } ++ } ++ ++#else ++ depctl_data_t depctl = {.d32 = 0 }; ++ dwc_ep_t *dwc_ep; ++ dwc_otg_dev_if_t *dev_if; ++ int i; ++ dev_if = GET_CORE_IF(pcd)->dev_if; ++ ++ DWC_DEBUGPL(DBG_PCD,"Incomplete ISO IN \n"); ++ ++ for (i = 1; i <= dev_if->num_in_eps; ++i) { ++ dwc_ep = &pcd->in_ep[i-1].dwc_ep; ++ depctl.d32 = ++ DWC_READ_REG32(&dev_if->in_ep_regs[i]->diepctl); ++ if (depctl.b.epena && dwc_ep->type == DWC_OTG_EP_TYPE_ISOC) { ++ if (drop_transfer(dwc_ep->frame_num, GET_CORE_IF(pcd)->frame_num, ++ dwc_ep->frm_overrun)) ++ { ++ depctl.d32 = ++ DWC_READ_REG32(&dev_if->in_ep_regs[i]->diepctl); ++ depctl.b.snak = 1; ++ depctl.b.epdis = 1; ++ DWC_MODIFY_REG32(&dev_if->in_ep_regs[i]->diepctl, depctl.d32, depctl.d32); ++ } ++ } ++ } ++ ++ /*intr_mask.b.incomplisoin = 1; ++ DWC_MODIFY_REG32(&GET_CORE_IF(pcd)->core_global_regs->gintmsk, ++ intr_mask.d32, 0); */ ++#endif //DWC_EN_ISOC ++ ++ /* Clear interrupt */ ++ gintsts.d32 = 0; ++ gintsts.b.incomplisoin = 1; ++ DWC_WRITE_REG32(&GET_CORE_IF(pcd)->core_global_regs->gintsts, ++ gintsts.d32); ++ ++ return 1; ++} ++ ++/** ++ * Incomplete ISO OUT Transfer Interrupt. ++ * ++ * This interrupt indicates that the core has dropped an ISO OUT ++ * packet. The following conditions can be the cause: ++ * - FIFO Full, the entire packet would not fit in the FIFO. ++ * - CRC Error ++ * - Corrupted Token ++ * The follow actions will be taken: ++ * -# Determine the EP ++ * -# Set incomplete flag in dwc_ep structure ++ * -# Read any data from the FIFO ++ * -# Disable EP. When "Endpoint Disabled" interrupt is received ++ * re-enable EP. ++ */ ++int32_t dwc_otg_pcd_handle_incomplete_isoc_out_intr(dwc_otg_pcd_t * pcd) ++{ ++ ++ gintsts_data_t gintsts; ++ ++#ifdef DWC_EN_ISOC ++ dwc_otg_dev_if_t *dev_if; ++ deptsiz_data_t deptsiz = {.d32 = 0 }; ++ depctl_data_t depctl = {.d32 = 0 }; ++ dsts_data_t dsts = {.d32 = 0 }; ++ dwc_ep_t *dwc_ep; ++ int i; ++ ++ dev_if = GET_CORE_IF(pcd)->dev_if; ++ ++ for (i = 1; i <= dev_if->num_out_eps; ++i) { ++ dwc_ep = &pcd->in_ep[i].dwc_ep; ++ if (pcd->out_ep[i].dwc_ep.active && ++ pcd->out_ep[i].dwc_ep.type == DWC_OTG_EP_TYPE_ISOC) { ++ deptsiz.d32 = ++ DWC_READ_REG32(&dev_if->out_ep_regs[i]->doeptsiz); ++ depctl.d32 = ++ DWC_READ_REG32(&dev_if->out_ep_regs[i]->doepctl); ++ ++ if (depctl.b.epdis && deptsiz.d32) { ++ set_current_pkt_info(GET_CORE_IF(pcd), ++ &pcd->out_ep[i].dwc_ep); ++ if (dwc_ep->cur_pkt >= dwc_ep->pkt_cnt) { ++ dwc_ep->cur_pkt = 0; ++ dwc_ep->proc_buf_num = ++ (dwc_ep->proc_buf_num ^ 1) & 0x1; ++ ++ if (dwc_ep->proc_buf_num) { ++ dwc_ep->cur_pkt_addr = ++ dwc_ep->xfer_buff1; ++ dwc_ep->cur_pkt_dma_addr = ++ dwc_ep->dma_addr1; ++ } else { ++ dwc_ep->cur_pkt_addr = ++ dwc_ep->xfer_buff0; ++ dwc_ep->cur_pkt_dma_addr = ++ dwc_ep->dma_addr0; ++ } ++ ++ } ++ ++ dsts.d32 = ++ DWC_READ_REG32(&GET_CORE_IF(pcd)->dev_if-> ++ dev_global_regs->dsts); ++ dwc_ep->next_frame = dsts.b.soffn; ++ ++ dwc_otg_iso_ep_start_frm_transfer(GET_CORE_IF ++ (pcd), ++ dwc_ep); ++ } ++ } ++ } ++#else ++ /** @todo implement ISR */ ++ gintmsk_data_t intr_mask = {.d32 = 0 }; ++ dwc_otg_core_if_t *core_if; ++ deptsiz_data_t deptsiz = {.d32 = 0 }; ++ depctl_data_t depctl = {.d32 = 0 }; ++ dctl_data_t dctl = {.d32 = 0 }; ++ dwc_ep_t *dwc_ep = NULL; ++ int i; ++ core_if = GET_CORE_IF(pcd); ++ ++ for (i = 0; i < core_if->dev_if->num_out_eps; ++i) { ++ dwc_ep = &pcd->out_ep[i].dwc_ep; ++ depctl.d32 = ++ DWC_READ_REG32(&core_if->dev_if->out_ep_regs[dwc_ep->num]->doepctl); ++ if (depctl.b.epena && depctl.b.dpid == (core_if->frame_num & 0x1)) { ++ core_if->dev_if->isoc_ep = dwc_ep; ++ deptsiz.d32 = ++ DWC_READ_REG32(&core_if->dev_if->out_ep_regs[dwc_ep->num]->doeptsiz); ++ break; ++ } ++ } ++ dctl.d32 = DWC_READ_REG32(&core_if->dev_if->dev_global_regs->dctl); ++ gintsts.d32 = DWC_READ_REG32(&core_if->core_global_regs->gintsts); ++ intr_mask.d32 = DWC_READ_REG32(&core_if->core_global_regs->gintmsk); ++ ++ if (!intr_mask.b.goutnakeff) { ++ /* Unmask it */ ++ intr_mask.b.goutnakeff = 1; ++ DWC_WRITE_REG32(&core_if->core_global_regs->gintmsk, intr_mask.d32); ++ } ++ if (!gintsts.b.goutnakeff) { ++ dctl.b.sgoutnak = 1; ++ } ++ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->dctl, dctl.d32); ++ ++ depctl.d32 = DWC_READ_REG32(&core_if->dev_if->out_ep_regs[dwc_ep->num]->doepctl); ++ if (depctl.b.epena) { ++ depctl.b.epdis = 1; ++ depctl.b.snak = 1; ++ } ++ DWC_WRITE_REG32(&core_if->dev_if->out_ep_regs[dwc_ep->num]->doepctl, depctl.d32); ++ ++ intr_mask.d32 = 0; ++ intr_mask.b.incomplisoout = 1; ++ ++#endif /* DWC_EN_ISOC */ ++ ++ /* Clear interrupt */ ++ gintsts.d32 = 0; ++ gintsts.b.incomplisoout = 1; ++ DWC_WRITE_REG32(&GET_CORE_IF(pcd)->core_global_regs->gintsts, ++ gintsts.d32); ++ ++ return 1; ++} ++ ++/** ++ * This function handles the Global IN NAK Effective interrupt. ++ * ++ */ ++int32_t dwc_otg_pcd_handle_in_nak_effective(dwc_otg_pcd_t * pcd) ++{ ++ dwc_otg_dev_if_t *dev_if = GET_CORE_IF(pcd)->dev_if; ++ depctl_data_t diepctl = {.d32 = 0 }; ++ gintmsk_data_t intr_mask = {.d32 = 0 }; ++ gintsts_data_t gintsts; ++ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); ++ int i; ++ ++ DWC_DEBUGPL(DBG_PCD, "Global IN NAK Effective\n"); ++ ++ /* Disable all active IN EPs */ ++ for (i = 0; i <= dev_if->num_in_eps; i++) { ++ diepctl.d32 = DWC_READ_REG32(&dev_if->in_ep_regs[i]->diepctl); ++ if (!(diepctl.b.eptype & 1) && diepctl.b.epena) { ++ if (core_if->start_predict > 0) ++ core_if->start_predict++; ++ diepctl.b.epdis = 1; ++ diepctl.b.snak = 1; ++ DWC_WRITE_REG32(&dev_if->in_ep_regs[i]->diepctl, diepctl.d32); ++ } ++ } ++ ++ ++ /* Disable the Global IN NAK Effective Interrupt */ ++ intr_mask.b.ginnakeff = 1; ++ DWC_MODIFY_REG32(&GET_CORE_IF(pcd)->core_global_regs->gintmsk, ++ intr_mask.d32, 0); ++ ++ /* Clear interrupt */ ++ gintsts.d32 = 0; ++ gintsts.b.ginnakeff = 1; ++ DWC_WRITE_REG32(&GET_CORE_IF(pcd)->core_global_regs->gintsts, ++ gintsts.d32); ++ ++ return 1; ++} ++ ++/** ++ * OUT NAK Effective. ++ * ++ */ ++int32_t dwc_otg_pcd_handle_out_nak_effective(dwc_otg_pcd_t * pcd) ++{ ++ dwc_otg_dev_if_t *dev_if = GET_CORE_IF(pcd)->dev_if; ++ gintmsk_data_t intr_mask = {.d32 = 0 }; ++ gintsts_data_t gintsts; ++ depctl_data_t doepctl; ++ int i; ++ ++ /* Disable the Global OUT NAK Effective Interrupt */ ++ intr_mask.b.goutnakeff = 1; ++ DWC_MODIFY_REG32(&GET_CORE_IF(pcd)->core_global_regs->gintmsk, ++ intr_mask.d32, 0); ++ ++ /* If DEV OUT NAK enabled*/ ++ if (pcd->core_if->core_params->dev_out_nak) { ++ /* Run over all out endpoints to determine the ep number on ++ * which the timeout has happened ++ */ ++ for (i = 0; i <= dev_if->num_out_eps; i++) { ++ if ( pcd->core_if->ep_xfer_info[i].state == 2 ) ++ break; ++ } ++ if (i > dev_if->num_out_eps) { ++ dctl_data_t dctl; ++ dctl.d32 = ++ DWC_READ_REG32(&dev_if->dev_global_regs->dctl); ++ dctl.b.cgoutnak = 1; ++ DWC_WRITE_REG32(&dev_if->dev_global_regs->dctl, ++ dctl.d32); ++ goto out; ++ } ++ ++ /* Disable the endpoint */ ++ doepctl.d32 = DWC_READ_REG32(&dev_if->out_ep_regs[i]->doepctl); ++ if (doepctl.b.epena) { ++ doepctl.b.epdis = 1; ++ doepctl.b.snak = 1; ++ } ++ DWC_WRITE_REG32(&dev_if->out_ep_regs[i]->doepctl, doepctl.d32); ++ return 1; ++ } ++ /* We come here from Incomplete ISO OUT handler */ ++ if (dev_if->isoc_ep) { ++ dwc_ep_t *dwc_ep = (dwc_ep_t *)dev_if->isoc_ep; ++ uint32_t epnum = dwc_ep->num; ++ doepint_data_t doepint; ++ doepint.d32 = ++ DWC_READ_REG32(&dev_if->out_ep_regs[dwc_ep->num]->doepint); ++ dev_if->isoc_ep = NULL; ++ doepctl.d32 = ++ DWC_READ_REG32(&dev_if->out_ep_regs[epnum]->doepctl); ++ DWC_PRINTF("Before disable DOEPCTL = %08x\n", doepctl.d32); ++ if (doepctl.b.epena) { ++ doepctl.b.epdis = 1; ++ doepctl.b.snak = 1; ++ } ++ DWC_WRITE_REG32(&dev_if->out_ep_regs[epnum]->doepctl, ++ doepctl.d32); ++ return 1; ++ } else ++ DWC_PRINTF("INTERRUPT Handler not implemented for %s\n", ++ "Global OUT NAK Effective\n"); ++ ++out: ++ /* Clear interrupt */ ++ gintsts.d32 = 0; ++ gintsts.b.goutnakeff = 1; ++ DWC_WRITE_REG32(&GET_CORE_IF(pcd)->core_global_regs->gintsts, ++ gintsts.d32); ++ ++ return 1; ++} ++ ++/** ++ * PCD interrupt handler. ++ * ++ * The PCD handles the device interrupts. Many conditions can cause a ++ * device interrupt. When an interrupt occurs, the device interrupt ++ * service routine determines the cause of the interrupt and ++ * dispatches handling to the appropriate function. These interrupt ++ * handling functions are described below. ++ * ++ * All interrupt registers are processed from LSB to MSB. ++ * ++ */ ++int32_t dwc_otg_pcd_handle_intr(dwc_otg_pcd_t * pcd) ++{ ++ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); ++#ifdef VERBOSE ++ dwc_otg_core_global_regs_t *global_regs = core_if->core_global_regs; ++#endif ++ gintsts_data_t gintr_status; ++ int32_t retval = 0; ++ ++ /* Exit from ISR if core is hibernated */ ++ if (core_if->hibernation_suspend == 1) { ++ return retval; ++ } ++#ifdef VERBOSE ++ DWC_DEBUGPL(DBG_ANY, "%s() gintsts=%08x gintmsk=%08x\n", ++ __func__, ++ DWC_READ_REG32(&global_regs->gintsts), ++ DWC_READ_REG32(&global_regs->gintmsk)); ++#endif ++ ++ if (dwc_otg_is_device_mode(core_if)) { ++ DWC_SPINLOCK(pcd->lock); ++#ifdef VERBOSE ++ DWC_DEBUGPL(DBG_PCDV, "%s() gintsts=%08x gintmsk=%08x\n", ++ __func__, ++ DWC_READ_REG32(&global_regs->gintsts), ++ DWC_READ_REG32(&global_regs->gintmsk)); ++#endif ++ ++ gintr_status.d32 = dwc_otg_read_core_intr(core_if); ++ ++ DWC_DEBUGPL(DBG_PCDV, "%s: gintsts&gintmsk=%08x\n", ++ __func__, gintr_status.d32); ++ ++ if (gintr_status.b.sofintr) { ++ retval |= dwc_otg_pcd_handle_sof_intr(pcd); ++ } ++ if (gintr_status.b.rxstsqlvl) { ++ retval |= ++ dwc_otg_pcd_handle_rx_status_q_level_intr(pcd); ++ } ++ if (gintr_status.b.nptxfempty) { ++ retval |= dwc_otg_pcd_handle_np_tx_fifo_empty_intr(pcd); ++ } ++ if (gintr_status.b.goutnakeff) { ++ retval |= dwc_otg_pcd_handle_out_nak_effective(pcd); ++ } ++ if (gintr_status.b.i2cintr) { ++ retval |= dwc_otg_pcd_handle_i2c_intr(pcd); ++ } ++ if (gintr_status.b.erlysuspend) { ++ retval |= dwc_otg_pcd_handle_early_suspend_intr(pcd); ++ } ++ if (gintr_status.b.usbreset) { ++ retval |= dwc_otg_pcd_handle_usb_reset_intr(pcd); ++ } ++ if (gintr_status.b.enumdone) { ++ retval |= dwc_otg_pcd_handle_enum_done_intr(pcd); ++ } ++ if (gintr_status.b.isooutdrop) { ++ retval |= ++ dwc_otg_pcd_handle_isoc_out_packet_dropped_intr ++ (pcd); ++ } ++ if (gintr_status.b.eopframe) { ++ retval |= ++ dwc_otg_pcd_handle_end_periodic_frame_intr(pcd); ++ } ++ if (gintr_status.b.inepint) { ++ if (!core_if->multiproc_int_enable) { ++ retval |= dwc_otg_pcd_handle_in_ep_intr(pcd); ++ } ++ } ++ if (gintr_status.b.outepintr) { ++ if (!core_if->multiproc_int_enable) { ++ retval |= dwc_otg_pcd_handle_out_ep_intr(pcd); ++ } ++ } ++ if (gintr_status.b.epmismatch) { ++ retval |= dwc_otg_pcd_handle_ep_mismatch_intr(pcd); ++ } ++ if (gintr_status.b.fetsusp) { ++ retval |= dwc_otg_pcd_handle_ep_fetsusp_intr(pcd); ++ } ++ if (gintr_status.b.ginnakeff) { ++ retval |= dwc_otg_pcd_handle_in_nak_effective(pcd); ++ } ++ if (gintr_status.b.incomplisoin) { ++ retval |= ++ dwc_otg_pcd_handle_incomplete_isoc_in_intr(pcd); ++ } ++ if (gintr_status.b.incomplisoout) { ++ retval |= ++ dwc_otg_pcd_handle_incomplete_isoc_out_intr(pcd); ++ } ++ ++ /* In MPI mode Device Endpoints interrupts are asserted ++ * without setting outepintr and inepint bits set, so these ++ * Interrupt handlers are called without checking these bit-fields ++ */ ++ if (core_if->multiproc_int_enable) { ++ retval |= dwc_otg_pcd_handle_in_ep_intr(pcd); ++ retval |= dwc_otg_pcd_handle_out_ep_intr(pcd); ++ } ++#ifdef VERBOSE ++ DWC_DEBUGPL(DBG_PCDV, "%s() gintsts=%0x\n", __func__, ++ DWC_READ_REG32(&global_regs->gintsts)); ++#endif ++ DWC_SPINUNLOCK(pcd->lock); ++ } ++ return retval; ++} ++ ++#endif /* DWC_HOST_ONLY */ +diff --git a/drivers/usb/host/dwc_otg/dwc_otg_pcd_linux.c b/drivers/usb/host/dwc_otg/dwc_otg_pcd_linux.c +new file mode 100644 +index 0000000..0eb0f35 +--- /dev/null ++++ b/drivers/usb/host/dwc_otg/dwc_otg_pcd_linux.c +@@ -0,0 +1,1280 @@ ++ /* ========================================================================== ++ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_pcd_linux.c $ ++ * $Revision: #21 $ ++ * $Date: 2012/08/10 $ ++ * $Change: 2047372 $ ++ * ++ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, ++ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless ++ * otherwise expressly agreed to in writing between Synopsys and you. ++ * ++ * The Software IS NOT an item of Licensed Software or Licensed Product under ++ * any End User Software License Agreement or Agreement for Licensed Product ++ * with Synopsys or any supplement thereto. You are permitted to use and ++ * redistribute this Software in source and binary forms, with or without ++ * modification, provided that redistributions of source code must retain this ++ * notice. You may not view, use, disclose, copy or distribute this file or ++ * any information contained herein except pursuant to this license grant from ++ * Synopsys. If you do not agree with this notice, including the disclaimer ++ * below, then you are not authorized to use the Software. ++ * ++ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS ++ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS 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. ++ * ========================================================================== */ ++#ifndef DWC_HOST_ONLY ++ ++/** @file ++ * This file implements the Peripheral Controller Driver. ++ * ++ * The Peripheral Controller Driver (PCD) is responsible for ++ * translating requests from the Function Driver into the appropriate ++ * actions on the DWC_otg controller. It isolates the Function Driver ++ * from the specifics of the controller by providing an API to the ++ * Function Driver. ++ * ++ * The Peripheral Controller Driver for Linux will implement the ++ * Gadget API, so that the existing Gadget drivers can be used. ++ * (Gadget Driver is the Linux terminology for a Function Driver.) ++ * ++ * The Linux Gadget API is defined in the header file ++ * <code><linux/usb_gadget.h></code>. The USB EP operations API is ++ * defined in the structure <code>usb_ep_ops</code> and the USB ++ * Controller API is defined in the structure ++ * <code>usb_gadget_ops</code>. ++ * ++ */ ++ ++#include "dwc_otg_os_dep.h" ++#include "dwc_otg_pcd_if.h" ++#include "dwc_otg_pcd.h" ++#include "dwc_otg_driver.h" ++#include "dwc_otg_dbg.h" ++ ++extern bool fiq_enable; ++ ++static struct gadget_wrapper { ++ dwc_otg_pcd_t *pcd; ++ ++ struct usb_gadget gadget; ++ struct usb_gadget_driver *driver; ++ ++ struct usb_ep ep0; ++ struct usb_ep in_ep[16]; ++ struct usb_ep out_ep[16]; ++ ++} *gadget_wrapper; ++ ++/* Display the contents of the buffer */ ++extern void dump_msg(const u8 * buf, unsigned int length); ++/** ++ * Get the dwc_otg_pcd_ep_t* from usb_ep* pointer - NULL in case ++ * if the endpoint is not found ++ */ ++static struct dwc_otg_pcd_ep *ep_from_handle(dwc_otg_pcd_t * pcd, void *handle) ++{ ++ int i; ++ if (pcd->ep0.priv == handle) { ++ return &pcd->ep0; ++ } ++ ++ for (i = 0; i < MAX_EPS_CHANNELS - 1; i++) { ++ if (pcd->in_ep[i].priv == handle) ++ return &pcd->in_ep[i]; ++ if (pcd->out_ep[i].priv == handle) ++ return &pcd->out_ep[i]; ++ } ++ ++ return NULL; ++} ++ ++/* USB Endpoint Operations */ ++/* ++ * The following sections briefly describe the behavior of the Gadget ++ * API endpoint operations implemented in the DWC_otg driver ++ * software. Detailed descriptions of the generic behavior of each of ++ * these functions can be found in the Linux header file ++ * include/linux/usb_gadget.h. ++ * ++ * The Gadget API provides wrapper functions for each of the function ++ * pointers defined in usb_ep_ops. The Gadget Driver calls the wrapper ++ * function, which then calls the underlying PCD function. The ++ * following sections are named according to the wrapper ++ * functions. Within each section, the corresponding DWC_otg PCD ++ * function name is specified. ++ * ++ */ ++ ++/** ++ * This function is called by the Gadget Driver for each EP to be ++ * configured for the current configuration (SET_CONFIGURATION). ++ * ++ * This function initializes the dwc_otg_ep_t data structure, and then ++ * calls dwc_otg_ep_activate. ++ */ ++static int ep_enable(struct usb_ep *usb_ep, ++ const struct usb_endpoint_descriptor *ep_desc) ++{ ++ int retval; ++ ++ DWC_DEBUGPL(DBG_PCDV, "%s(%p,%p)\n", __func__, usb_ep, ep_desc); ++ ++ if (!usb_ep || !ep_desc || ep_desc->bDescriptorType != USB_DT_ENDPOINT) { ++ DWC_WARN("%s, bad ep or descriptor\n", __func__); ++ return -EINVAL; ++ } ++ if (usb_ep == &gadget_wrapper->ep0) { ++ DWC_WARN("%s, bad ep(0)\n", __func__); ++ return -EINVAL; ++ } ++ ++ /* Check FIFO size? */ ++ if (!ep_desc->wMaxPacketSize) { ++ DWC_WARN("%s, bad %s maxpacket\n", __func__, usb_ep->name); ++ return -ERANGE; ++ } ++ ++ if (!gadget_wrapper->driver || ++ gadget_wrapper->gadget.speed == USB_SPEED_UNKNOWN) { ++ DWC_WARN("%s, bogus device state\n", __func__); ++ return -ESHUTDOWN; ++ } ++ ++ /* Delete after check - MAS */ ++#if 0 ++ nat = (uint32_t) ep_desc->wMaxPacketSize; ++ printk(KERN_ALERT "%s: nat (before) =%d\n", __func__, nat); ++ nat = (nat >> 11) & 0x03; ++ printk(KERN_ALERT "%s: nat (after) =%d\n", __func__, nat); ++#endif ++ retval = dwc_otg_pcd_ep_enable(gadget_wrapper->pcd, ++ (const uint8_t *)ep_desc, ++ (void *)usb_ep); ++ if (retval) { ++ DWC_WARN("dwc_otg_pcd_ep_enable failed\n"); ++ return -EINVAL; ++ } ++ ++ usb_ep->maxpacket = le16_to_cpu(ep_desc->wMaxPacketSize); ++ ++ return 0; ++} ++ ++/** ++ * This function is called when an EP is disabled due to disconnect or ++ * change in configuration. Any pending requests will terminate with a ++ * status of -ESHUTDOWN. ++ * ++ * This function modifies the dwc_otg_ep_t data structure for this EP, ++ * and then calls dwc_otg_ep_deactivate. ++ */ ++static int ep_disable(struct usb_ep *usb_ep) ++{ ++ int retval; ++ ++ DWC_DEBUGPL(DBG_PCDV, "%s(%p)\n", __func__, usb_ep); ++ if (!usb_ep) { ++ DWC_DEBUGPL(DBG_PCD, "%s, %s not enabled\n", __func__, ++ usb_ep ? usb_ep->name : NULL); ++ return -EINVAL; ++ } ++ ++ retval = dwc_otg_pcd_ep_disable(gadget_wrapper->pcd, usb_ep); ++ if (retval) { ++ retval = -EINVAL; ++ } ++ ++ return retval; ++} ++ ++/** ++ * This function allocates a request object to use with the specified ++ * endpoint. ++ * ++ * @param ep The endpoint to be used with with the request ++ * @param gfp_flags the GFP_* flags to use. ++ */ ++static struct usb_request *dwc_otg_pcd_alloc_request(struct usb_ep *ep, ++ gfp_t gfp_flags) ++{ ++ struct usb_request *usb_req; ++ ++ DWC_DEBUGPL(DBG_PCDV, "%s(%p,%d)\n", __func__, ep, gfp_flags); ++ if (0 == ep) { ++ DWC_WARN("%s() %s\n", __func__, "Invalid EP!\n"); ++ return 0; ++ } ++ usb_req = kmalloc(sizeof(*usb_req), gfp_flags); ++ if (0 == usb_req) { ++ DWC_WARN("%s() %s\n", __func__, "request allocation failed!\n"); ++ return 0; ++ } ++ memset(usb_req, 0, sizeof(*usb_req)); ++ usb_req->dma = DWC_DMA_ADDR_INVALID; ++ ++ return usb_req; ++} ++ ++/** ++ * This function frees a request object. ++ * ++ * @param ep The endpoint associated with the request ++ * @param req The request being freed ++ */ ++static void dwc_otg_pcd_free_request(struct usb_ep *ep, struct usb_request *req) ++{ ++ DWC_DEBUGPL(DBG_PCDV, "%s(%p,%p)\n", __func__, ep, req); ++ ++ if (0 == ep || 0 == req) { ++ DWC_WARN("%s() %s\n", __func__, ++ "Invalid ep or req argument!\n"); ++ return; ++ } ++ ++ kfree(req); ++} ++ ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) ++/** ++ * This function allocates an I/O buffer to be used for a transfer ++ * to/from the specified endpoint. ++ * ++ * @param usb_ep The endpoint to be used with with the request ++ * @param bytes The desired number of bytes for the buffer ++ * @param dma Pointer to the buffer's DMA address; must be valid ++ * @param gfp_flags the GFP_* flags to use. ++ * @return address of a new buffer or null is buffer could not be allocated. ++ */ ++static void *dwc_otg_pcd_alloc_buffer(struct usb_ep *usb_ep, unsigned bytes, ++ dma_addr_t * dma, gfp_t gfp_flags) ++{ ++ void *buf; ++ dwc_otg_pcd_t *pcd = 0; ++ ++ pcd = gadget_wrapper->pcd; ++ ++ DWC_DEBUGPL(DBG_PCDV, "%s(%p,%d,%p,%0x)\n", __func__, usb_ep, bytes, ++ dma, gfp_flags); ++ ++ /* Check dword alignment */ ++ if ((bytes & 0x3UL) != 0) { ++ DWC_WARN("%s() Buffer size is not a multiple of" ++ "DWORD size (%d)", __func__, bytes); ++ } ++ ++ buf = dma_alloc_coherent(NULL, bytes, dma, gfp_flags); ++ ++ /* Check dword alignment */ ++ if (((int)buf & 0x3UL) != 0) { ++ DWC_WARN("%s() Buffer is not DWORD aligned (%p)", ++ __func__, buf); ++ } ++ ++ return buf; ++} ++ ++/** ++ * This function frees an I/O buffer that was allocated by alloc_buffer. ++ * ++ * @param usb_ep the endpoint associated with the buffer ++ * @param buf address of the buffer ++ * @param dma The buffer's DMA address ++ * @param bytes The number of bytes of the buffer ++ */ ++static void dwc_otg_pcd_free_buffer(struct usb_ep *usb_ep, void *buf, ++ dma_addr_t dma, unsigned bytes) ++{ ++ dwc_otg_pcd_t *pcd = 0; ++ ++ pcd = gadget_wrapper->pcd; ++ ++ DWC_DEBUGPL(DBG_PCDV, "%s(%p,%0x,%d)\n", __func__, buf, dma, bytes); ++ ++ dma_free_coherent(NULL, bytes, buf, dma); ++} ++#endif ++ ++/** ++ * This function is used to submit an I/O Request to an EP. ++ * ++ * - When the request completes the request's completion callback ++ * is called to return the request to the driver. ++ * - An EP, except control EPs, may have multiple requests ++ * pending. ++ * - Once submitted the request cannot be examined or modified. ++ * - Each request is turned into one or more packets. ++ * - A BULK EP can queue any amount of data; the transfer is ++ * packetized. ++ * - Zero length Packets are specified with the request 'zero' ++ * flag. ++ */ ++static int ep_queue(struct usb_ep *usb_ep, struct usb_request *usb_req, ++ gfp_t gfp_flags) ++{ ++ dwc_otg_pcd_t *pcd; ++ struct dwc_otg_pcd_ep *ep = NULL; ++ int retval = 0, is_isoc_ep = 0; ++ dma_addr_t dma_addr = DWC_DMA_ADDR_INVALID; ++ ++ DWC_DEBUGPL(DBG_PCDV, "%s(%p,%p,%d)\n", ++ __func__, usb_ep, usb_req, gfp_flags); ++ ++ if (!usb_req || !usb_req->complete || !usb_req->buf) { ++ DWC_WARN("bad params\n"); ++ return -EINVAL; ++ } ++ ++ if (!usb_ep) { ++ DWC_WARN("bad ep\n"); ++ return -EINVAL; ++ } ++ ++ pcd = gadget_wrapper->pcd; ++ if (!gadget_wrapper->driver || ++ gadget_wrapper->gadget.speed == USB_SPEED_UNKNOWN) { ++ DWC_DEBUGPL(DBG_PCDV, "gadget.speed=%d\n", ++ gadget_wrapper->gadget.speed); ++ DWC_WARN("bogus device state\n"); ++ return -ESHUTDOWN; ++ } ++ ++ DWC_DEBUGPL(DBG_PCD, "%s queue req %p, len %d buf %p\n", ++ usb_ep->name, usb_req, usb_req->length, usb_req->buf); ++ ++ usb_req->status = -EINPROGRESS; ++ usb_req->actual = 0; ++ ++ ep = ep_from_handle(pcd, usb_ep); ++ if (ep == NULL) ++ is_isoc_ep = 0; ++ else ++ is_isoc_ep = (ep->dwc_ep.type == DWC_OTG_EP_TYPE_ISOC) ? 1 : 0; ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) ++ dma_addr = usb_req->dma; ++#else ++ if (GET_CORE_IF(pcd)->dma_enable) { ++ dwc_otg_device_t *otg_dev = gadget_wrapper->pcd->otg_dev; ++ struct device *dev = NULL; ++ ++ if (otg_dev != NULL) ++ dev = DWC_OTG_OS_GETDEV(otg_dev->os_dep); ++ ++ if (usb_req->length != 0 && ++ usb_req->dma == DWC_DMA_ADDR_INVALID) { ++ dma_addr = dma_map_single(dev, usb_req->buf, ++ usb_req->length, ++ ep->dwc_ep.is_in ? ++ DMA_TO_DEVICE: ++ DMA_FROM_DEVICE); ++ } ++ } ++#endif ++ ++#ifdef DWC_UTE_PER_IO ++ if (is_isoc_ep == 1) { ++ retval = dwc_otg_pcd_xiso_ep_queue(pcd, usb_ep, usb_req->buf, dma_addr, ++ usb_req->length, usb_req->zero, usb_req, ++ gfp_flags == GFP_ATOMIC ? 1 : 0, &usb_req->ext_req); ++ if (retval) ++ return -EINVAL; ++ ++ return 0; ++ } ++#endif ++ retval = dwc_otg_pcd_ep_queue(pcd, usb_ep, usb_req->buf, dma_addr, ++ usb_req->length, usb_req->zero, usb_req, ++ gfp_flags == GFP_ATOMIC ? 1 : 0); ++ if (retval) { ++ return -EINVAL; ++ } ++ ++ return 0; ++} ++ ++/** ++ * This function cancels an I/O request from an EP. ++ */ ++static int ep_dequeue(struct usb_ep *usb_ep, struct usb_request *usb_req) ++{ ++ DWC_DEBUGPL(DBG_PCDV, "%s(%p,%p)\n", __func__, usb_ep, usb_req); ++ ++ if (!usb_ep || !usb_req) { ++ DWC_WARN("bad argument\n"); ++ return -EINVAL; ++ } ++ if (!gadget_wrapper->driver || ++ gadget_wrapper->gadget.speed == USB_SPEED_UNKNOWN) { ++ DWC_WARN("bogus device state\n"); ++ return -ESHUTDOWN; ++ } ++ if (dwc_otg_pcd_ep_dequeue(gadget_wrapper->pcd, usb_ep, usb_req)) { ++ return -EINVAL; ++ } ++ ++ return 0; ++} ++ ++/** ++ * usb_ep_set_halt stalls an endpoint. ++ * ++ * usb_ep_clear_halt clears an endpoint halt and resets its data ++ * toggle. ++ * ++ * Both of these functions are implemented with the same underlying ++ * function. The behavior depends on the value argument. ++ * ++ * @param[in] usb_ep the Endpoint to halt or clear halt. ++ * @param[in] value ++ * - 0 means clear_halt. ++ * - 1 means set_halt, ++ * - 2 means clear stall lock flag. ++ * - 3 means set stall lock flag. ++ */ ++static int ep_halt(struct usb_ep *usb_ep, int value) ++{ ++ int retval = 0; ++ ++ DWC_DEBUGPL(DBG_PCD, "HALT %s %d\n", usb_ep->name, value); ++ ++ if (!usb_ep) { ++ DWC_WARN("bad ep\n"); ++ return -EINVAL; ++ } ++ ++ retval = dwc_otg_pcd_ep_halt(gadget_wrapper->pcd, usb_ep, value); ++ if (retval == -DWC_E_AGAIN) { ++ return -EAGAIN; ++ } else if (retval) { ++ retval = -EINVAL; ++ } ++ ++ return retval; ++} ++ ++//#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,30)) ++#if 0 ++/** ++ * ep_wedge: sets the halt feature and ignores clear requests ++ * ++ * @usb_ep: the endpoint being wedged ++ * ++ * Use this to stall an endpoint and ignore CLEAR_FEATURE(HALT_ENDPOINT) ++ * requests. If the gadget driver clears the halt status, it will ++ * automatically unwedge the endpoint. ++ * ++ * Returns zero on success, else negative errno. * ++ * Check usb_ep_set_wedge() at "usb_gadget.h" for details ++ */ ++static int ep_wedge(struct usb_ep *usb_ep) ++{ ++ int retval = 0; ++ ++ DWC_DEBUGPL(DBG_PCD, "WEDGE %s\n", usb_ep->name); ++ ++ if (!usb_ep) { ++ DWC_WARN("bad ep\n"); ++ return -EINVAL; ++ } ++ ++ retval = dwc_otg_pcd_ep_wedge(gadget_wrapper->pcd, usb_ep); ++ if (retval == -DWC_E_AGAIN) { ++ retval = -EAGAIN; ++ } else if (retval) { ++ retval = -EINVAL; ++ } ++ ++ return retval; ++} ++#endif ++ ++#ifdef DWC_EN_ISOC ++/** ++ * This function is used to submit an ISOC Transfer Request to an EP. ++ * ++ * - Every time a sync period completes the request's completion callback ++ * is called to provide data to the gadget driver. ++ * - Once submitted the request cannot be modified. ++ * - Each request is turned into periodic data packets untill ISO ++ * Transfer is stopped.. ++ */ ++static int iso_ep_start(struct usb_ep *usb_ep, struct usb_iso_request *req, ++ gfp_t gfp_flags) ++{ ++ int retval = 0; ++ ++ if (!req || !req->process_buffer || !req->buf0 || !req->buf1) { ++ DWC_WARN("bad params\n"); ++ return -EINVAL; ++ } ++ ++ if (!usb_ep) { ++ DWC_PRINTF("bad params\n"); ++ return -EINVAL; ++ } ++ ++ req->status = -EINPROGRESS; ++ ++ retval = ++ dwc_otg_pcd_iso_ep_start(gadget_wrapper->pcd, usb_ep, req->buf0, ++ req->buf1, req->dma0, req->dma1, ++ req->sync_frame, req->data_pattern_frame, ++ req->data_per_frame, ++ req-> ++ flags & USB_REQ_ISO_ASAP ? -1 : ++ req->start_frame, req->buf_proc_intrvl, ++ req, gfp_flags == GFP_ATOMIC ? 1 : 0); ++ ++ if (retval) { ++ return -EINVAL; ++ } ++ ++ return retval; ++} ++ ++/** ++ * This function stops ISO EP Periodic Data Transfer. ++ */ ++static int iso_ep_stop(struct usb_ep *usb_ep, struct usb_iso_request *req) ++{ ++ int retval = 0; ++ if (!usb_ep) { ++ DWC_WARN("bad ep\n"); ++ } ++ ++ if (!gadget_wrapper->driver || ++ gadget_wrapper->gadget.speed == USB_SPEED_UNKNOWN) { ++ DWC_DEBUGPL(DBG_PCDV, "gadget.speed=%d\n", ++ gadget_wrapper->gadget.speed); ++ DWC_WARN("bogus device state\n"); ++ } ++ ++ dwc_otg_pcd_iso_ep_stop(gadget_wrapper->pcd, usb_ep, req); ++ if (retval) { ++ retval = -EINVAL; ++ } ++ ++ return retval; ++} ++ ++static struct usb_iso_request *alloc_iso_request(struct usb_ep *ep, ++ int packets, gfp_t gfp_flags) ++{ ++ struct usb_iso_request *pReq = NULL; ++ uint32_t req_size; ++ ++ req_size = sizeof(struct usb_iso_request); ++ req_size += ++ (2 * packets * (sizeof(struct usb_gadget_iso_packet_descriptor))); ++ ++ pReq = kmalloc(req_size, gfp_flags); ++ if (!pReq) { ++ DWC_WARN("Can't allocate Iso Request\n"); ++ return 0; ++ } ++ pReq->iso_packet_desc0 = (void *)(pReq + 1); ++ ++ pReq->iso_packet_desc1 = pReq->iso_packet_desc0 + packets; ++ ++ return pReq; ++} ++ ++static void free_iso_request(struct usb_ep *ep, struct usb_iso_request *req) ++{ ++ kfree(req); ++} ++ ++static struct usb_isoc_ep_ops dwc_otg_pcd_ep_ops = { ++ .ep_ops = { ++ .enable = ep_enable, ++ .disable = ep_disable, ++ ++ .alloc_request = dwc_otg_pcd_alloc_request, ++ .free_request = dwc_otg_pcd_free_request, ++ ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) ++ .alloc_buffer = dwc_otg_pcd_alloc_buffer, ++ .free_buffer = dwc_otg_pcd_free_buffer, ++#endif ++ ++ .queue = ep_queue, ++ .dequeue = ep_dequeue, ++ ++ .set_halt = ep_halt, ++ .fifo_status = 0, ++ .fifo_flush = 0, ++ }, ++ .iso_ep_start = iso_ep_start, ++ .iso_ep_stop = iso_ep_stop, ++ .alloc_iso_request = alloc_iso_request, ++ .free_iso_request = free_iso_request, ++}; ++ ++#else ++ ++ int (*enable) (struct usb_ep *ep, ++ const struct usb_endpoint_descriptor *desc); ++ int (*disable) (struct usb_ep *ep); ++ ++ struct usb_request *(*alloc_request) (struct usb_ep *ep, ++ gfp_t gfp_flags); ++ void (*free_request) (struct usb_ep *ep, struct usb_request *req); ++ ++ int (*queue) (struct usb_ep *ep, struct usb_request *req, ++ gfp_t gfp_flags); ++ int (*dequeue) (struct usb_ep *ep, struct usb_request *req); ++ ++ int (*set_halt) (struct usb_ep *ep, int value); ++ int (*set_wedge) (struct usb_ep *ep); ++ ++ int (*fifo_status) (struct usb_ep *ep); ++ void (*fifo_flush) (struct usb_ep *ep); ++static struct usb_ep_ops dwc_otg_pcd_ep_ops = { ++ .enable = ep_enable, ++ .disable = ep_disable, ++ ++ .alloc_request = dwc_otg_pcd_alloc_request, ++ .free_request = dwc_otg_pcd_free_request, ++ ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) ++ .alloc_buffer = dwc_otg_pcd_alloc_buffer, ++ .free_buffer = dwc_otg_pcd_free_buffer, ++#else ++ /* .set_wedge = ep_wedge, */ ++ .set_wedge = NULL, /* uses set_halt instead */ ++#endif ++ ++ .queue = ep_queue, ++ .dequeue = ep_dequeue, ++ ++ .set_halt = ep_halt, ++ .fifo_status = 0, ++ .fifo_flush = 0, ++ ++}; ++ ++#endif /* _EN_ISOC_ */ ++/* Gadget Operations */ ++/** ++ * The following gadget operations will be implemented in the DWC_otg ++ * PCD. Functions in the API that are not described below are not ++ * implemented. ++ * ++ * The Gadget API provides wrapper functions for each of the function ++ * pointers defined in usb_gadget_ops. The Gadget Driver calls the ++ * wrapper function, which then calls the underlying PCD function. The ++ * following sections are named according to the wrapper functions ++ * (except for ioctl, which doesn't have a wrapper function). Within ++ * each section, the corresponding DWC_otg PCD function name is ++ * specified. ++ * ++ */ ++ ++/** ++ *Gets the USB Frame number of the last SOF. ++ */ ++static int get_frame_number(struct usb_gadget *gadget) ++{ ++ struct gadget_wrapper *d; ++ ++ DWC_DEBUGPL(DBG_PCDV, "%s(%p)\n", __func__, gadget); ++ ++ if (gadget == 0) { ++ return -ENODEV; ++ } ++ ++ d = container_of(gadget, struct gadget_wrapper, gadget); ++ return dwc_otg_pcd_get_frame_number(d->pcd); ++} ++ ++#ifdef CONFIG_USB_DWC_OTG_LPM ++static int test_lpm_enabled(struct usb_gadget *gadget) ++{ ++ struct gadget_wrapper *d; ++ ++ d = container_of(gadget, struct gadget_wrapper, gadget); ++ ++ return dwc_otg_pcd_is_lpm_enabled(d->pcd); ++} ++#endif ++ ++/** ++ * Initiates Session Request Protocol (SRP) to wakeup the host if no ++ * session is in progress. If a session is already in progress, but ++ * the device is suspended, remote wakeup signaling is started. ++ * ++ */ ++static int wakeup(struct usb_gadget *gadget) ++{ ++ struct gadget_wrapper *d; ++ ++ DWC_DEBUGPL(DBG_PCDV, "%s(%p)\n", __func__, gadget); ++ ++ if (gadget == 0) { ++ return -ENODEV; ++ } else { ++ d = container_of(gadget, struct gadget_wrapper, gadget); ++ } ++ dwc_otg_pcd_wakeup(d->pcd); ++ return 0; ++} ++ ++static const struct usb_gadget_ops dwc_otg_pcd_ops = { ++ .get_frame = get_frame_number, ++ .wakeup = wakeup, ++#ifdef CONFIG_USB_DWC_OTG_LPM ++ .lpm_support = test_lpm_enabled, ++#endif ++ // current versions must always be self-powered ++}; ++ ++static int _setup(dwc_otg_pcd_t * pcd, uint8_t * bytes) ++{ ++ int retval = -DWC_E_NOT_SUPPORTED; ++ if (gadget_wrapper->driver && gadget_wrapper->driver->setup) { ++ retval = gadget_wrapper->driver->setup(&gadget_wrapper->gadget, ++ (struct usb_ctrlrequest ++ *)bytes); ++ } ++ ++ if (retval == -ENOTSUPP) { ++ retval = -DWC_E_NOT_SUPPORTED; ++ } else if (retval < 0) { ++ retval = -DWC_E_INVALID; ++ } ++ ++ return retval; ++} ++ ++#ifdef DWC_EN_ISOC ++static int _isoc_complete(dwc_otg_pcd_t * pcd, void *ep_handle, ++ void *req_handle, int proc_buf_num) ++{ ++ int i, packet_count; ++ struct usb_gadget_iso_packet_descriptor *iso_packet = 0; ++ struct usb_iso_request *iso_req = req_handle; ++ ++ if (proc_buf_num) { ++ iso_packet = iso_req->iso_packet_desc1; ++ } else { ++ iso_packet = iso_req->iso_packet_desc0; ++ } ++ packet_count = ++ dwc_otg_pcd_get_iso_packet_count(pcd, ep_handle, req_handle); ++ for (i = 0; i < packet_count; ++i) { ++ int status; ++ int actual; ++ int offset; ++ dwc_otg_pcd_get_iso_packet_params(pcd, ep_handle, req_handle, ++ i, &status, &actual, &offset); ++ switch (status) { ++ case -DWC_E_NO_DATA: ++ status = -ENODATA; ++ break; ++ default: ++ if (status) { ++ DWC_PRINTF("unknown status in isoc packet\n"); ++ } ++ ++ } ++ iso_packet[i].status = status; ++ iso_packet[i].offset = offset; ++ iso_packet[i].actual_length = actual; ++ } ++ ++ iso_req->status = 0; ++ iso_req->process_buffer(ep_handle, iso_req); ++ ++ return 0; ++} ++#endif /* DWC_EN_ISOC */ ++ ++#ifdef DWC_UTE_PER_IO ++/** ++ * Copy the contents of the extended request to the Linux usb_request's ++ * extended part and call the gadget's completion. ++ * ++ * @param pcd Pointer to the pcd structure ++ * @param ep_handle Void pointer to the usb_ep structure ++ * @param req_handle Void pointer to the usb_request structure ++ * @param status Request status returned from the portable logic ++ * @param ereq_port Void pointer to the extended request structure ++ * created in the the portable part that contains the ++ * results of the processed iso packets. ++ */ ++static int _xisoc_complete(dwc_otg_pcd_t * pcd, void *ep_handle, ++ void *req_handle, int32_t status, void *ereq_port) ++{ ++ struct dwc_ute_iso_req_ext *ereqorg = NULL; ++ struct dwc_iso_xreq_port *ereqport = NULL; ++ struct dwc_ute_iso_packet_descriptor *desc_org = NULL; ++ int i; ++ struct usb_request *req; ++ //struct dwc_ute_iso_packet_descriptor * ++ //int status = 0; ++ ++ req = (struct usb_request *)req_handle; ++ ereqorg = &req->ext_req; ++ ereqport = (struct dwc_iso_xreq_port *)ereq_port; ++ desc_org = ereqorg->per_io_frame_descs; ++ ++ if (req && req->complete) { ++ /* Copy the request data from the portable logic to our request */ ++ for (i = 0; i < ereqport->pio_pkt_count; i++) { ++ desc_org[i].actual_length = ++ ereqport->per_io_frame_descs[i].actual_length; ++ desc_org[i].status = ++ ereqport->per_io_frame_descs[i].status; ++ } ++ ++ switch (status) { ++ case -DWC_E_SHUTDOWN: ++ req->status = -ESHUTDOWN; ++ break; ++ case -DWC_E_RESTART: ++ req->status = -ECONNRESET; ++ break; ++ case -DWC_E_INVALID: ++ req->status = -EINVAL; ++ break; ++ case -DWC_E_TIMEOUT: ++ req->status = -ETIMEDOUT; ++ break; ++ default: ++ req->status = status; ++ } ++ ++ /* And call the gadget's completion */ ++ req->complete(ep_handle, req); ++ } ++ ++ return 0; ++} ++#endif /* DWC_UTE_PER_IO */ ++ ++static int _complete(dwc_otg_pcd_t * pcd, void *ep_handle, ++ void *req_handle, int32_t status, uint32_t actual) ++{ ++ struct usb_request *req = (struct usb_request *)req_handle; ++#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,27) ++ struct dwc_otg_pcd_ep *ep = NULL; ++#endif ++ ++ if (req && req->complete) { ++ switch (status) { ++ case -DWC_E_SHUTDOWN: ++ req->status = -ESHUTDOWN; ++ break; ++ case -DWC_E_RESTART: ++ req->status = -ECONNRESET; ++ break; ++ case -DWC_E_INVALID: ++ req->status = -EINVAL; ++ break; ++ case -DWC_E_TIMEOUT: ++ req->status = -ETIMEDOUT; ++ break; ++ default: ++ req->status = status; ++ ++ } ++ ++ req->actual = actual; ++ DWC_SPINUNLOCK(pcd->lock); ++ req->complete(ep_handle, req); ++ DWC_SPINLOCK(pcd->lock); ++ } ++#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,27) ++ ep = ep_from_handle(pcd, ep_handle); ++ if (GET_CORE_IF(pcd)->dma_enable) { ++ if (req->length != 0) { ++ dwc_otg_device_t *otg_dev = gadget_wrapper->pcd->otg_dev; ++ struct device *dev = NULL; ++ ++ if (otg_dev != NULL) ++ dev = DWC_OTG_OS_GETDEV(otg_dev->os_dep); ++ ++ dma_unmap_single(dev, req->dma, req->length, ++ ep->dwc_ep.is_in ? ++ DMA_TO_DEVICE: DMA_FROM_DEVICE); ++ } ++ } ++#endif ++ ++ return 0; ++} ++ ++static int _connect(dwc_otg_pcd_t * pcd, int speed) ++{ ++ gadget_wrapper->gadget.speed = speed; ++ return 0; ++} ++ ++static int _disconnect(dwc_otg_pcd_t * pcd) ++{ ++ if (gadget_wrapper->driver && gadget_wrapper->driver->disconnect) { ++ gadget_wrapper->driver->disconnect(&gadget_wrapper->gadget); ++ } ++ return 0; ++} ++ ++static int _resume(dwc_otg_pcd_t * pcd) ++{ ++ if (gadget_wrapper->driver && gadget_wrapper->driver->resume) { ++ gadget_wrapper->driver->resume(&gadget_wrapper->gadget); ++ } ++ ++ return 0; ++} ++ ++static int _suspend(dwc_otg_pcd_t * pcd) ++{ ++ if (gadget_wrapper->driver && gadget_wrapper->driver->suspend) { ++ gadget_wrapper->driver->suspend(&gadget_wrapper->gadget); ++ } ++ return 0; ++} ++ ++/** ++ * This function updates the otg values in the gadget structure. ++ */ ++static int _hnp_changed(dwc_otg_pcd_t * pcd) ++{ ++ ++ if (!gadget_wrapper->gadget.is_otg) ++ return 0; ++ ++ gadget_wrapper->gadget.b_hnp_enable = get_b_hnp_enable(pcd); ++ gadget_wrapper->gadget.a_hnp_support = get_a_hnp_support(pcd); ++ gadget_wrapper->gadget.a_alt_hnp_support = get_a_alt_hnp_support(pcd); ++ return 0; ++} ++ ++static int _reset(dwc_otg_pcd_t * pcd) ++{ ++ return 0; ++} ++ ++#ifdef DWC_UTE_CFI ++static int _cfi_setup(dwc_otg_pcd_t * pcd, void *cfi_req) ++{ ++ int retval = -DWC_E_INVALID; ++ if (gadget_wrapper->driver->cfi_feature_setup) { ++ retval = ++ gadget_wrapper->driver-> ++ cfi_feature_setup(&gadget_wrapper->gadget, ++ (struct cfi_usb_ctrlrequest *)cfi_req); ++ } ++ ++ return retval; ++} ++#endif ++ ++static const struct dwc_otg_pcd_function_ops fops = { ++ .complete = _complete, ++#ifdef DWC_EN_ISOC ++ .isoc_complete = _isoc_complete, ++#endif ++ .setup = _setup, ++ .disconnect = _disconnect, ++ .connect = _connect, ++ .resume = _resume, ++ .suspend = _suspend, ++ .hnp_changed = _hnp_changed, ++ .reset = _reset, ++#ifdef DWC_UTE_CFI ++ .cfi_setup = _cfi_setup, ++#endif ++#ifdef DWC_UTE_PER_IO ++ .xisoc_complete = _xisoc_complete, ++#endif ++}; ++ ++/** ++ * This function is the top level PCD interrupt handler. ++ */ ++static irqreturn_t dwc_otg_pcd_irq(int irq, void *dev) ++{ ++ dwc_otg_pcd_t *pcd = dev; ++ int32_t retval = IRQ_NONE; ++ ++ retval = dwc_otg_pcd_handle_intr(pcd); ++ if (retval != 0) { ++ S3C2410X_CLEAR_EINTPEND(); ++ } ++ return IRQ_RETVAL(retval); ++} ++ ++/** ++ * This function initialized the usb_ep structures to there default ++ * state. ++ * ++ * @param d Pointer on gadget_wrapper. ++ */ ++void gadget_add_eps(struct gadget_wrapper *d) ++{ ++ static const char *names[] = { ++ ++ "ep0", ++ "ep1in", ++ "ep2in", ++ "ep3in", ++ "ep4in", ++ "ep5in", ++ "ep6in", ++ "ep7in", ++ "ep8in", ++ "ep9in", ++ "ep10in", ++ "ep11in", ++ "ep12in", ++ "ep13in", ++ "ep14in", ++ "ep15in", ++ "ep1out", ++ "ep2out", ++ "ep3out", ++ "ep4out", ++ "ep5out", ++ "ep6out", ++ "ep7out", ++ "ep8out", ++ "ep9out", ++ "ep10out", ++ "ep11out", ++ "ep12out", ++ "ep13out", ++ "ep14out", ++ "ep15out" ++ }; ++ ++ int i; ++ struct usb_ep *ep; ++ int8_t dev_endpoints; ++ ++ DWC_DEBUGPL(DBG_PCDV, "%s\n", __func__); ++ ++ INIT_LIST_HEAD(&d->gadget.ep_list); ++ d->gadget.ep0 = &d->ep0; ++ d->gadget.speed = USB_SPEED_UNKNOWN; ++ ++ INIT_LIST_HEAD(&d->gadget.ep0->ep_list); ++ ++ /** ++ * Initialize the EP0 structure. ++ */ ++ ep = &d->ep0; ++ ++ /* Init the usb_ep structure. */ ++ ep->name = names[0]; ++ ep->ops = (struct usb_ep_ops *)&dwc_otg_pcd_ep_ops; ++ ++ /** ++ * @todo NGS: What should the max packet size be set to ++ * here? Before EP type is set? ++ */ ++ ep->maxpacket = MAX_PACKET_SIZE; ++ dwc_otg_pcd_ep_enable(d->pcd, NULL, ep); ++ ++ list_add_tail(&ep->ep_list, &d->gadget.ep_list); ++ ++ /** ++ * Initialize the EP structures. ++ */ ++ dev_endpoints = d->pcd->core_if->dev_if->num_in_eps; ++ ++ for (i = 0; i < dev_endpoints; i++) { ++ ep = &d->in_ep[i]; ++ ++ /* Init the usb_ep structure. */ ++ ep->name = names[d->pcd->in_ep[i].dwc_ep.num]; ++ ep->ops = (struct usb_ep_ops *)&dwc_otg_pcd_ep_ops; ++ ++ /** ++ * @todo NGS: What should the max packet size be set to ++ * here? Before EP type is set? ++ */ ++ ep->maxpacket = MAX_PACKET_SIZE; ++ list_add_tail(&ep->ep_list, &d->gadget.ep_list); ++ } ++ ++ dev_endpoints = d->pcd->core_if->dev_if->num_out_eps; ++ ++ for (i = 0; i < dev_endpoints; i++) { ++ ep = &d->out_ep[i]; ++ ++ /* Init the usb_ep structure. */ ++ ep->name = names[15 + d->pcd->out_ep[i].dwc_ep.num]; ++ ep->ops = (struct usb_ep_ops *)&dwc_otg_pcd_ep_ops; ++ ++ /** ++ * @todo NGS: What should the max packet size be set to ++ * here? Before EP type is set? ++ */ ++ ep->maxpacket = MAX_PACKET_SIZE; ++ ++ list_add_tail(&ep->ep_list, &d->gadget.ep_list); ++ } ++ ++ /* remove ep0 from the list. There is a ep0 pointer. */ ++ list_del_init(&d->ep0.ep_list); ++ ++ d->ep0.maxpacket = MAX_EP0_SIZE; ++} ++ ++/** ++ * This function releases the Gadget device. ++ * required by device_unregister(). ++ * ++ * @todo Should this do something? Should it free the PCD? ++ */ ++static void dwc_otg_pcd_gadget_release(struct device *dev) ++{ ++ DWC_DEBUGPL(DBG_PCDV, "%s(%p)\n", __func__, dev); ++} ++ ++static struct gadget_wrapper *alloc_wrapper(dwc_bus_dev_t *_dev) ++{ ++ static char pcd_name[] = "dwc_otg_pcd"; ++ dwc_otg_device_t *otg_dev = DWC_OTG_BUSDRVDATA(_dev); ++ struct gadget_wrapper *d; ++ int retval; ++ ++ d = DWC_ALLOC(sizeof(*d)); ++ if (d == NULL) { ++ return NULL; ++ } ++ ++ memset(d, 0, sizeof(*d)); ++ ++ d->gadget.name = pcd_name; ++ d->pcd = otg_dev->pcd; ++ ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30) ++ strcpy(d->gadget.dev.bus_id, "gadget"); ++#else ++ dev_set_name(&d->gadget.dev, "%s", "gadget"); ++#endif ++ ++ d->gadget.dev.parent = &_dev->dev; ++ d->gadget.dev.release = dwc_otg_pcd_gadget_release; ++ d->gadget.ops = &dwc_otg_pcd_ops; ++ d->gadget.max_speed = dwc_otg_pcd_is_dualspeed(otg_dev->pcd) ? USB_SPEED_HIGH:USB_SPEED_FULL; ++ d->gadget.is_otg = dwc_otg_pcd_is_otg(otg_dev->pcd); ++ ++ d->driver = 0; ++ /* Register the gadget device */ ++ retval = device_register(&d->gadget.dev); ++ if (retval != 0) { ++ DWC_ERROR("device_register failed\n"); ++ DWC_FREE(d); ++ return NULL; ++ } ++ ++ return d; ++} ++ ++static void free_wrapper(struct gadget_wrapper *d) ++{ ++ if (d->driver) { ++ /* should have been done already by driver model core */ ++ DWC_WARN("driver '%s' is still registered\n", ++ d->driver->driver.name); ++#ifdef CONFIG_USB_GADGET ++ usb_gadget_unregister_driver(d->driver); ++#endif ++ } ++ ++ device_unregister(&d->gadget.dev); ++ DWC_FREE(d); ++} ++ ++/** ++ * This function initialized the PCD portion of the driver. ++ * ++ */ ++int pcd_init(dwc_bus_dev_t *_dev) ++{ ++ dwc_otg_device_t *otg_dev = DWC_OTG_BUSDRVDATA(_dev); ++ int retval = 0; ++ ++ DWC_DEBUGPL(DBG_PCDV, "%s(%p) otg_dev=%p\n", __func__, _dev, otg_dev); ++ ++ otg_dev->pcd = dwc_otg_pcd_init(otg_dev->core_if); ++ ++ if (!otg_dev->pcd) { ++ DWC_ERROR("dwc_otg_pcd_init failed\n"); ++ return -ENOMEM; ++ } ++ ++ otg_dev->pcd->otg_dev = otg_dev; ++ gadget_wrapper = alloc_wrapper(_dev); ++ ++ /* ++ * Initialize EP structures ++ */ ++ gadget_add_eps(gadget_wrapper); ++ /* ++ * Setup interupt handler ++ */ ++#ifdef PLATFORM_INTERFACE ++ DWC_DEBUGPL(DBG_ANY, "registering handler for irq%d\n", ++ platform_get_irq(_dev, fiq_enable ? 0 : 1)); ++ retval = request_irq(platform_get_irq(_dev, fiq_enable ? 0 : 1), dwc_otg_pcd_irq, ++ IRQF_SHARED, gadget_wrapper->gadget.name, ++ otg_dev->pcd); ++ if (retval != 0) { ++ DWC_ERROR("request of irq%d failed\n", ++ platform_get_irq(_dev, fiq_enable ? 0 : 1)); ++ free_wrapper(gadget_wrapper); ++ return -EBUSY; ++ } ++#else ++ DWC_DEBUGPL(DBG_ANY, "registering handler for irq%d\n", ++ _dev->irq); ++ retval = request_irq(_dev->irq, dwc_otg_pcd_irq, ++ IRQF_SHARED | IRQF_DISABLED, ++ gadget_wrapper->gadget.name, otg_dev->pcd); ++ if (retval != 0) { ++ DWC_ERROR("request of irq%d failed\n", _dev->irq); ++ free_wrapper(gadget_wrapper); ++ return -EBUSY; ++ } ++#endif ++ ++ dwc_otg_pcd_start(gadget_wrapper->pcd, &fops); ++ ++ return retval; ++} ++ ++/** ++ * Cleanup the PCD. ++ */ ++void pcd_remove(dwc_bus_dev_t *_dev) ++{ ++ dwc_otg_device_t *otg_dev = DWC_OTG_BUSDRVDATA(_dev); ++ dwc_otg_pcd_t *pcd = otg_dev->pcd; ++ ++ DWC_DEBUGPL(DBG_PCDV, "%s(%p) otg_dev %p\n", __func__, _dev, otg_dev); ++ ++ /* ++ * Free the IRQ ++ */ ++#ifdef PLATFORM_INTERFACE ++ free_irq(platform_get_irq(_dev, 0), pcd); ++#else ++ free_irq(_dev->irq, pcd); ++#endif ++ dwc_otg_pcd_remove(otg_dev->pcd); ++ free_wrapper(gadget_wrapper); ++ otg_dev->pcd = 0; ++} ++ ++#endif /* DWC_HOST_ONLY */ +diff --git a/drivers/usb/host/dwc_otg/dwc_otg_regs.h b/drivers/usb/host/dwc_otg/dwc_otg_regs.h +new file mode 100644 +index 0000000..8e0e7b5 +--- /dev/null ++++ b/drivers/usb/host/dwc_otg/dwc_otg_regs.h +@@ -0,0 +1,2550 @@ ++/* ========================================================================== ++ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_regs.h $ ++ * $Revision: #98 $ ++ * $Date: 2012/08/10 $ ++ * $Change: 2047372 $ ++ * ++ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, ++ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless ++ * otherwise expressly agreed to in writing between Synopsys and you. ++ * ++ * The Software IS NOT an item of Licensed Software or Licensed Product under ++ * any End User Software License Agreement or Agreement for Licensed Product ++ * with Synopsys or any supplement thereto. You are permitted to use and ++ * redistribute this Software in source and binary forms, with or without ++ * modification, provided that redistributions of source code must retain this ++ * notice. You may not view, use, disclose, copy or distribute this file or ++ * any information contained herein except pursuant to this license grant from ++ * Synopsys. If you do not agree with this notice, including the disclaimer ++ * below, then you are not authorized to use the Software. ++ * ++ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS ++ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS 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. ++ * ========================================================================== */ ++ ++#ifndef __DWC_OTG_REGS_H__ ++#define __DWC_OTG_REGS_H__ ++ ++#include "dwc_otg_core_if.h" ++ ++/** ++ * @file ++ * ++ * This file contains the data structures for accessing the DWC_otg core registers. ++ * ++ * The application interfaces with the HS OTG core by reading from and ++ * writing to the Control and Status Register (CSR) space through the ++ * AHB Slave interface. These registers are 32 bits wide, and the ++ * addresses are 32-bit-block aligned. ++ * CSRs are classified as follows: ++ * - Core Global Registers ++ * - Device Mode Registers ++ * - Device Global Registers ++ * - Device Endpoint Specific Registers ++ * - Host Mode Registers ++ * - Host Global Registers ++ * - Host Port CSRs ++ * - Host Channel Specific Registers ++ * ++ * Only the Core Global registers can be accessed in both Device and ++ * Host modes. When the HS OTG core is operating in one mode, either ++ * Device or Host, the application must not access registers from the ++ * other mode. When the core switches from one mode to another, the ++ * registers in the new mode of operation must be reprogrammed as they ++ * would be after a power-on reset. ++ */ ++ ++/****************************************************************************/ ++/** DWC_otg Core registers . ++ * The dwc_otg_core_global_regs structure defines the size ++ * and relative field offsets for the Core Global registers. ++ */ ++typedef struct dwc_otg_core_global_regs { ++ /** OTG Control and Status Register. <i>Offset: 000h</i> */ ++ volatile uint32_t gotgctl; ++ /** OTG Interrupt Register. <i>Offset: 004h</i> */ ++ volatile uint32_t gotgint; ++ /**Core AHB Configuration Register. <i>Offset: 008h</i> */ ++ volatile uint32_t gahbcfg; ++ ++#define DWC_GLBINTRMASK 0x0001 ++#define DWC_DMAENABLE 0x0020 ++#define DWC_NPTXEMPTYLVL_EMPTY 0x0080 ++#define DWC_NPTXEMPTYLVL_HALFEMPTY 0x0000 ++#define DWC_PTXEMPTYLVL_EMPTY 0x0100 ++#define DWC_PTXEMPTYLVL_HALFEMPTY 0x0000 ++ ++ /**Core USB Configuration Register. <i>Offset: 00Ch</i> */ ++ volatile uint32_t gusbcfg; ++ /**Core Reset Register. <i>Offset: 010h</i> */ ++ volatile uint32_t grstctl; ++ /**Core Interrupt Register. <i>Offset: 014h</i> */ ++ volatile uint32_t gintsts; ++ /**Core Interrupt Mask Register. <i>Offset: 018h</i> */ ++ volatile uint32_t gintmsk; ++ /**Receive Status Queue Read Register (Read Only). <i>Offset: 01Ch</i> */ ++ volatile uint32_t grxstsr; ++ /**Receive Status Queue Read & POP Register (Read Only). <i>Offset: 020h</i>*/ ++ volatile uint32_t grxstsp; ++ /**Receive FIFO Size Register. <i>Offset: 024h</i> */ ++ volatile uint32_t grxfsiz; ++ /**Non Periodic Transmit FIFO Size Register. <i>Offset: 028h</i> */ ++ volatile uint32_t gnptxfsiz; ++ /**Non Periodic Transmit FIFO/Queue Status Register (Read ++ * Only). <i>Offset: 02Ch</i> */ ++ volatile uint32_t gnptxsts; ++ /**I2C Access Register. <i>Offset: 030h</i> */ ++ volatile uint32_t gi2cctl; ++ /**PHY Vendor Control Register. <i>Offset: 034h</i> */ ++ volatile uint32_t gpvndctl; ++ /**General Purpose Input/Output Register. <i>Offset: 038h</i> */ ++ volatile uint32_t ggpio; ++ /**User ID Register. <i>Offset: 03Ch</i> */ ++ volatile uint32_t guid; ++ /**Synopsys ID Register (Read Only). <i>Offset: 040h</i> */ ++ volatile uint32_t gsnpsid; ++ /**User HW Config1 Register (Read Only). <i>Offset: 044h</i> */ ++ volatile uint32_t ghwcfg1; ++ /**User HW Config2 Register (Read Only). <i>Offset: 048h</i> */ ++ volatile uint32_t ghwcfg2; ++#define DWC_SLAVE_ONLY_ARCH 0 ++#define DWC_EXT_DMA_ARCH 1 ++#define DWC_INT_DMA_ARCH 2 ++ ++#define DWC_MODE_HNP_SRP_CAPABLE 0 ++#define DWC_MODE_SRP_ONLY_CAPABLE 1 ++#define DWC_MODE_NO_HNP_SRP_CAPABLE 2 ++#define DWC_MODE_SRP_CAPABLE_DEVICE 3 ++#define DWC_MODE_NO_SRP_CAPABLE_DEVICE 4 ++#define DWC_MODE_SRP_CAPABLE_HOST 5 ++#define DWC_MODE_NO_SRP_CAPABLE_HOST 6 ++ ++ /**User HW Config3 Register (Read Only). <i>Offset: 04Ch</i> */ ++ volatile uint32_t ghwcfg3; ++ /**User HW Config4 Register (Read Only). <i>Offset: 050h</i>*/ ++ volatile uint32_t ghwcfg4; ++ /** Core LPM Configuration register <i>Offset: 054h</i>*/ ++ volatile uint32_t glpmcfg; ++ /** Global PowerDn Register <i>Offset: 058h</i> */ ++ volatile uint32_t gpwrdn; ++ /** Global DFIFO SW Config Register <i>Offset: 05Ch</i> */ ++ volatile uint32_t gdfifocfg; ++ /** ADP Control Register <i>Offset: 060h</i> */ ++ volatile uint32_t adpctl; ++ /** Reserved <i>Offset: 064h-0FFh</i> */ ++ volatile uint32_t reserved39[39]; ++ /** Host Periodic Transmit FIFO Size Register. <i>Offset: 100h</i> */ ++ volatile uint32_t hptxfsiz; ++ /** Device Periodic Transmit FIFO#n Register if dedicated fifos are disabled, ++ otherwise Device Transmit FIFO#n Register. ++ * <i>Offset: 104h + (FIFO_Number-1)*04h, 1 <= FIFO Number <= 15 (1<=n<=15).</i> */ ++ volatile uint32_t dtxfsiz[15]; ++} dwc_otg_core_global_regs_t; ++ ++/** ++ * This union represents the bit fields of the Core OTG Control ++ * and Status Register (GOTGCTL). Set the bits using the bit ++ * fields then write the <i>d32</i> value to the register. ++ */ ++typedef union gotgctl_data { ++ /** raw register data */ ++ uint32_t d32; ++ /** register bits */ ++ struct { ++ unsigned sesreqscs:1; ++ unsigned sesreq:1; ++ unsigned vbvalidoven:1; ++ unsigned vbvalidovval:1; ++ unsigned avalidoven:1; ++ unsigned avalidovval:1; ++ unsigned bvalidoven:1; ++ unsigned bvalidovval:1; ++ unsigned hstnegscs:1; ++ unsigned hnpreq:1; ++ unsigned hstsethnpen:1; ++ unsigned devhnpen:1; ++ unsigned reserved12_15:4; ++ unsigned conidsts:1; ++ unsigned dbnctime:1; ++ unsigned asesvld:1; ++ unsigned bsesvld:1; ++ unsigned otgver:1; ++ unsigned reserved1:1; ++ unsigned multvalidbc:5; ++ unsigned chirpen:1; ++ unsigned reserved28_31:4; ++ } b; ++} gotgctl_data_t; ++ ++/** ++ * This union represents the bit fields of the Core OTG Interrupt Register ++ * (GOTGINT). Set/clear the bits using the bit fields then write the <i>d32</i> ++ * value to the register. ++ */ ++typedef union gotgint_data { ++ /** raw register data */ ++ uint32_t d32; ++ /** register bits */ ++ struct { ++ /** Current Mode */ ++ unsigned reserved0_1:2; ++ ++ /** Session End Detected */ ++ unsigned sesenddet:1; ++ ++ unsigned reserved3_7:5; ++ ++ /** Session Request Success Status Change */ ++ unsigned sesreqsucstschng:1; ++ /** Host Negotiation Success Status Change */ ++ unsigned hstnegsucstschng:1; ++ ++ unsigned reserved10_16:7; ++ ++ /** Host Negotiation Detected */ ++ unsigned hstnegdet:1; ++ /** A-Device Timeout Change */ ++ unsigned adevtoutchng:1; ++ /** Debounce Done */ ++ unsigned debdone:1; ++ /** Multi-Valued input changed */ ++ unsigned mvic:1; ++ ++ unsigned reserved31_21:11; ++ ++ } b; ++} gotgint_data_t; ++ ++/** ++ * This union represents the bit fields of the Core AHB Configuration ++ * Register (GAHBCFG). Set/clear the bits using the bit fields then ++ * write the <i>d32</i> value to the register. ++ */ ++typedef union gahbcfg_data { ++ /** raw register data */ ++ uint32_t d32; ++ /** register bits */ ++ struct { ++ unsigned glblintrmsk:1; ++#define DWC_GAHBCFG_GLBINT_ENABLE 1 ++ ++ unsigned hburstlen:4; ++#define DWC_GAHBCFG_INT_DMA_BURST_SINGLE 0 ++#define DWC_GAHBCFG_INT_DMA_BURST_INCR 1 ++#define DWC_GAHBCFG_INT_DMA_BURST_INCR4 3 ++#define DWC_GAHBCFG_INT_DMA_BURST_INCR8 5 ++#define DWC_GAHBCFG_INT_DMA_BURST_INCR16 7 ++ ++ unsigned dmaenable:1; ++#define DWC_GAHBCFG_DMAENABLE 1 ++ unsigned reserved:1; ++ unsigned nptxfemplvl_txfemplvl:1; ++ unsigned ptxfemplvl:1; ++#define DWC_GAHBCFG_TXFEMPTYLVL_EMPTY 1 ++#define DWC_GAHBCFG_TXFEMPTYLVL_HALFEMPTY 0 ++ unsigned reserved9_20:12; ++ unsigned remmemsupp:1; ++ unsigned notialldmawrit:1; ++ unsigned ahbsingle:1; ++ unsigned reserved24_31:8; ++ } b; ++} gahbcfg_data_t; ++ ++/** ++ * This union represents the bit fields of the Core USB Configuration ++ * Register (GUSBCFG). Set the bits using the bit fields then write ++ * the <i>d32</i> value to the register. ++ */ ++typedef union gusbcfg_data { ++ /** raw register data */ ++ uint32_t d32; ++ /** register bits */ ++ struct { ++ unsigned toutcal:3; ++ unsigned phyif:1; ++ unsigned ulpi_utmi_sel:1; ++ unsigned fsintf:1; ++ unsigned physel:1; ++ unsigned ddrsel:1; ++ unsigned srpcap:1; ++ unsigned hnpcap:1; ++ unsigned usbtrdtim:4; ++ unsigned reserved1:1; ++ unsigned phylpwrclksel:1; ++ unsigned otgutmifssel:1; ++ unsigned ulpi_fsls:1; ++ unsigned ulpi_auto_res:1; ++ unsigned ulpi_clk_sus_m:1; ++ unsigned ulpi_ext_vbus_drv:1; ++ unsigned ulpi_int_vbus_indicator:1; ++ unsigned term_sel_dl_pulse:1; ++ unsigned indicator_complement:1; ++ unsigned indicator_pass_through:1; ++ unsigned ulpi_int_prot_dis:1; ++ unsigned ic_usb_cap:1; ++ unsigned ic_traffic_pull_remove:1; ++ unsigned tx_end_delay:1; ++ unsigned force_host_mode:1; ++ unsigned force_dev_mode:1; ++ unsigned reserved31:1; ++ } b; ++} gusbcfg_data_t; ++ ++/** ++ * This union represents the bit fields of the Core Reset Register ++ * (GRSTCTL). Set/clear the bits using the bit fields then write the ++ * <i>d32</i> value to the register. ++ */ ++typedef union grstctl_data { ++ /** raw register data */ ++ uint32_t d32; ++ /** register bits */ ++ struct { ++ /** Core Soft Reset (CSftRst) (Device and Host) ++ * ++ * The application can flush the control logic in the ++ * entire core using this bit. This bit resets the ++ * pipelines in the AHB Clock domain as well as the ++ * PHY Clock domain. ++ * ++ * The state machines are reset to an IDLE state, the ++ * control bits in the CSRs are cleared, all the ++ * transmit FIFOs and the receive FIFO are flushed. ++ * ++ * The status mask bits that control the generation of ++ * the interrupt, are cleared, to clear the ++ * interrupt. The interrupt status bits are not ++ * cleared, so the application can get the status of ++ * any events that occurred in the core after it has ++ * set this bit. ++ * ++ * Any transactions on the AHB are terminated as soon ++ * as possible following the protocol. Any ++ * transactions on the USB are terminated immediately. ++ * ++ * The configuration settings in the CSRs are ++ * unchanged, so the software doesn't have to ++ * reprogram these registers (Device ++ * Configuration/Host Configuration/Core System ++ * Configuration/Core PHY Configuration). ++ * ++ * The application can write to this bit, any time it ++ * wants to reset the core. This is a self clearing ++ * bit and the core clears this bit after all the ++ * necessary logic is reset in the core, which may ++ * take several clocks, depending on the current state ++ * of the core. ++ */ ++ unsigned csftrst:1; ++ /** Hclk Soft Reset ++ * ++ * The application uses this bit to reset the control logic in ++ * the AHB clock domain. Only AHB clock domain pipelines are ++ * reset. ++ */ ++ unsigned hsftrst:1; ++ /** Host Frame Counter Reset (Host Only)<br> ++ * ++ * The application can reset the (micro)frame number ++ * counter inside the core, using this bit. When the ++ * (micro)frame counter is reset, the subsequent SOF ++ * sent out by the core, will have a (micro)frame ++ * number of 0. ++ */ ++ unsigned hstfrm:1; ++ /** In Token Sequence Learning Queue Flush ++ * (INTknQFlsh) (Device Only) ++ */ ++ unsigned intknqflsh:1; ++ /** RxFIFO Flush (RxFFlsh) (Device and Host) ++ * ++ * The application can flush the entire Receive FIFO ++ * using this bit. The application must first ++ * ensure that the core is not in the middle of a ++ * transaction. The application should write into ++ * this bit, only after making sure that neither the ++ * DMA engine is reading from the RxFIFO nor the MAC ++ * is writing the data in to the FIFO. The ++ * application should wait until the bit is cleared ++ * before performing any other operations. This bit ++ * will takes 8 clocks (slowest of PHY or AHB clock) ++ * to clear. ++ */ ++ unsigned rxfflsh:1; ++ /** TxFIFO Flush (TxFFlsh) (Device and Host). ++ * ++ * This bit is used to selectively flush a single or ++ * all transmit FIFOs. The application must first ++ * ensure that the core is not in the middle of a ++ * transaction. The application should write into ++ * this bit, only after making sure that neither the ++ * DMA engine is writing into the TxFIFO nor the MAC ++ * is reading the data out of the FIFO. The ++ * application should wait until the core clears this ++ * bit, before performing any operations. This bit ++ * will takes 8 clocks (slowest of PHY or AHB clock) ++ * to clear. ++ */ ++ unsigned txfflsh:1; ++ ++ /** TxFIFO Number (TxFNum) (Device and Host). ++ * ++ * This is the FIFO number which needs to be flushed, ++ * using the TxFIFO Flush bit. This field should not ++ * be changed until the TxFIFO Flush bit is cleared by ++ * the core. ++ * - 0x0 : Non Periodic TxFIFO Flush ++ * - 0x1 : Periodic TxFIFO #1 Flush in device mode ++ * or Periodic TxFIFO in host mode ++ * - 0x2 : Periodic TxFIFO #2 Flush in device mode. ++ * - ... ++ * - 0xF : Periodic TxFIFO #15 Flush in device mode ++ * - 0x10: Flush all the Transmit NonPeriodic and ++ * Transmit Periodic FIFOs in the core ++ */ ++ unsigned txfnum:5; ++ /** Reserved */ ++ unsigned reserved11_29:19; ++ /** DMA Request Signal. Indicated DMA request is in ++ * probress. Used for debug purpose. */ ++ unsigned dmareq:1; ++ /** AHB Master Idle. Indicates the AHB Master State ++ * Machine is in IDLE condition. */ ++ unsigned ahbidle:1; ++ } b; ++} grstctl_t; ++ ++/** ++ * This union represents the bit fields of the Core Interrupt Mask ++ * Register (GINTMSK). Set/clear the bits using the bit fields then ++ * write the <i>d32</i> value to the register. ++ */ ++typedef union gintmsk_data { ++ /** raw register data */ ++ uint32_t d32; ++ /** register bits */ ++ struct { ++ unsigned reserved0:1; ++ unsigned modemismatch:1; ++ unsigned otgintr:1; ++ unsigned sofintr:1; ++ unsigned rxstsqlvl:1; ++ unsigned nptxfempty:1; ++ unsigned ginnakeff:1; ++ unsigned goutnakeff:1; ++ unsigned ulpickint:1; ++ unsigned i2cintr:1; ++ unsigned erlysuspend:1; ++ unsigned usbsuspend:1; ++ unsigned usbreset:1; ++ unsigned enumdone:1; ++ unsigned isooutdrop:1; ++ unsigned eopframe:1; ++ unsigned restoredone:1; ++ unsigned epmismatch:1; ++ unsigned inepintr:1; ++ unsigned outepintr:1; ++ unsigned incomplisoin:1; ++ unsigned incomplisoout:1; ++ unsigned fetsusp:1; ++ unsigned resetdet:1; ++ unsigned portintr:1; ++ unsigned hcintr:1; ++ unsigned ptxfempty:1; ++ unsigned lpmtranrcvd:1; ++ unsigned conidstschng:1; ++ unsigned disconnect:1; ++ unsigned sessreqintr:1; ++ unsigned wkupintr:1; ++ } b; ++} gintmsk_data_t; ++/** ++ * This union represents the bit fields of the Core Interrupt Register ++ * (GINTSTS). Set/clear the bits using the bit fields then write the ++ * <i>d32</i> value to the register. ++ */ ++typedef union gintsts_data { ++ /** raw register data */ ++ uint32_t d32; ++#define DWC_SOF_INTR_MASK 0x0008 ++ /** register bits */ ++ struct { ++#define DWC_HOST_MODE 1 ++ unsigned curmode:1; ++ unsigned modemismatch:1; ++ unsigned otgintr:1; ++ unsigned sofintr:1; ++ unsigned rxstsqlvl:1; ++ unsigned nptxfempty:1; ++ unsigned ginnakeff:1; ++ unsigned goutnakeff:1; ++ unsigned ulpickint:1; ++ unsigned i2cintr:1; ++ unsigned erlysuspend:1; ++ unsigned usbsuspend:1; ++ unsigned usbreset:1; ++ unsigned enumdone:1; ++ unsigned isooutdrop:1; ++ unsigned eopframe:1; ++ unsigned restoredone:1; ++ unsigned epmismatch:1; ++ unsigned inepint:1; ++ unsigned outepintr:1; ++ unsigned incomplisoin:1; ++ unsigned incomplisoout:1; ++ unsigned fetsusp:1; ++ unsigned resetdet:1; ++ unsigned portintr:1; ++ unsigned hcintr:1; ++ unsigned ptxfempty:1; ++ unsigned lpmtranrcvd:1; ++ unsigned conidstschng:1; ++ unsigned disconnect:1; ++ unsigned sessreqintr:1; ++ unsigned wkupintr:1; ++ } b; ++} gintsts_data_t; ++ ++/** ++ * This union represents the bit fields in the Device Receive Status Read and ++ * Pop Registers (GRXSTSR, GRXSTSP) Read the register into the <i>d32</i> ++ * element then read out the bits using the <i>b</i>it elements. ++ */ ++typedef union device_grxsts_data { ++ /** raw register data */ ++ uint32_t d32; ++ /** register bits */ ++ struct { ++ unsigned epnum:4; ++ unsigned bcnt:11; ++ unsigned dpid:2; ++ ++#define DWC_STS_DATA_UPDT 0x2 // OUT Data Packet ++#define DWC_STS_XFER_COMP 0x3 // OUT Data Transfer Complete ++ ++#define DWC_DSTS_GOUT_NAK 0x1 // Global OUT NAK ++#define DWC_DSTS_SETUP_COMP 0x4 // Setup Phase Complete ++#define DWC_DSTS_SETUP_UPDT 0x6 // SETUP Packet ++ unsigned pktsts:4; ++ unsigned fn:4; ++ unsigned reserved25_31:7; ++ } b; ++} device_grxsts_data_t; ++ ++/** ++ * This union represents the bit fields in the Host Receive Status Read and ++ * Pop Registers (GRXSTSR, GRXSTSP) Read the register into the <i>d32</i> ++ * element then read out the bits using the <i>b</i>it elements. ++ */ ++typedef union host_grxsts_data { ++ /** raw register data */ ++ uint32_t d32; ++ /** register bits */ ++ struct { ++ unsigned chnum:4; ++ unsigned bcnt:11; ++ unsigned dpid:2; ++ ++ unsigned pktsts:4; ++#define DWC_GRXSTS_PKTSTS_IN 0x2 ++#define DWC_GRXSTS_PKTSTS_IN_XFER_COMP 0x3 ++#define DWC_GRXSTS_PKTSTS_DATA_TOGGLE_ERR 0x5 ++#define DWC_GRXSTS_PKTSTS_CH_HALTED 0x7 ++ ++ unsigned reserved21_31:11; ++ } b; ++} host_grxsts_data_t; ++ ++/** ++ * This union represents the bit fields in the FIFO Size Registers (HPTXFSIZ, ++ * GNPTXFSIZ, DPTXFSIZn, DIEPTXFn). Read the register into the <i>d32</i> element ++ * then read out the bits using the <i>b</i>it elements. ++ */ ++typedef union fifosize_data { ++ /** raw register data */ ++ uint32_t d32; ++ /** register bits */ ++ struct { ++ unsigned startaddr:16; ++ unsigned depth:16; ++ } b; ++} fifosize_data_t; ++ ++/** ++ * This union represents the bit fields in the Non-Periodic Transmit ++ * FIFO/Queue Status Register (GNPTXSTS). Read the register into the ++ * <i>d32</i> element then read out the bits using the <i>b</i>it ++ * elements. ++ */ ++typedef union gnptxsts_data { ++ /** raw register data */ ++ uint32_t d32; ++ /** register bits */ ++ struct { ++ unsigned nptxfspcavail:16; ++ unsigned nptxqspcavail:8; ++ /** Top of the Non-Periodic Transmit Request Queue ++ * - bit 24 - Terminate (Last entry for the selected ++ * channel/EP) ++ * - bits 26:25 - Token Type ++ * - 2'b00 - IN/OUT ++ * - 2'b01 - Zero Length OUT ++ * - 2'b10 - PING/Complete Split ++ * - 2'b11 - Channel Halt ++ * - bits 30:27 - Channel/EP Number ++ */ ++ unsigned nptxqtop_terminate:1; ++ unsigned nptxqtop_token:2; ++ unsigned nptxqtop_chnep:4; ++ unsigned reserved:1; ++ } b; ++} gnptxsts_data_t; ++ ++/** ++ * This union represents the bit fields in the Transmit ++ * FIFO Status Register (DTXFSTS). Read the register into the ++ * <i>d32</i> element then read out the bits using the <i>b</i>it ++ * elements. ++ */ ++typedef union dtxfsts_data { ++ /** raw register data */ ++ uint32_t d32; ++ /** register bits */ ++ struct { ++ unsigned txfspcavail:16; ++ unsigned reserved:16; ++ } b; ++} dtxfsts_data_t; ++ ++/** ++ * This union represents the bit fields in the I2C Control Register ++ * (I2CCTL). Read the register into the <i>d32</i> element then read out the ++ * bits using the <i>b</i>it elements. ++ */ ++typedef union gi2cctl_data { ++ /** raw register data */ ++ uint32_t d32; ++ /** register bits */ ++ struct { ++ unsigned rwdata:8; ++ unsigned regaddr:8; ++ unsigned addr:7; ++ unsigned i2cen:1; ++ unsigned ack:1; ++ unsigned i2csuspctl:1; ++ unsigned i2cdevaddr:2; ++ unsigned i2cdatse0:1; ++ unsigned reserved:1; ++ unsigned rw:1; ++ unsigned bsydne:1; ++ } b; ++} gi2cctl_data_t; ++ ++/** ++ * This union represents the bit fields in the PHY Vendor Control Register ++ * (GPVNDCTL). Read the register into the <i>d32</i> element then read out the ++ * bits using the <i>b</i>it elements. ++ */ ++typedef union gpvndctl_data { ++ /** raw register data */ ++ uint32_t d32; ++ /** register bits */ ++ struct { ++ unsigned regdata:8; ++ unsigned vctrl:8; ++ unsigned regaddr16_21:6; ++ unsigned regwr:1; ++ unsigned reserved23_24:2; ++ unsigned newregreq:1; ++ unsigned vstsbsy:1; ++ unsigned vstsdone:1; ++ unsigned reserved28_30:3; ++ unsigned disulpidrvr:1; ++ } b; ++} gpvndctl_data_t; ++ ++/** ++ * This union represents the bit fields in the General Purpose ++ * Input/Output Register (GGPIO). ++ * Read the register into the <i>d32</i> element then read out the ++ * bits using the <i>b</i>it elements. ++ */ ++typedef union ggpio_data { ++ /** raw register data */ ++ uint32_t d32; ++ /** register bits */ ++ struct { ++ unsigned gpi:16; ++ unsigned gpo:16; ++ } b; ++} ggpio_data_t; ++ ++/** ++ * This union represents the bit fields in the User ID Register ++ * (GUID). Read the register into the <i>d32</i> element then read out the ++ * bits using the <i>b</i>it elements. ++ */ ++typedef union guid_data { ++ /** raw register data */ ++ uint32_t d32; ++ /** register bits */ ++ struct { ++ unsigned rwdata:32; ++ } b; ++} guid_data_t; ++ ++/** ++ * This union represents the bit fields in the Synopsys ID Register ++ * (GSNPSID). Read the register into the <i>d32</i> element then read out the ++ * bits using the <i>b</i>it elements. ++ */ ++typedef union gsnpsid_data { ++ /** raw register data */ ++ uint32_t d32; ++ /** register bits */ ++ struct { ++ unsigned rwdata:32; ++ } b; ++} gsnpsid_data_t; ++ ++/** ++ * This union represents the bit fields in the User HW Config1 ++ * Register. Read the register into the <i>d32</i> element then read ++ * out the bits using the <i>b</i>it elements. ++ */ ++typedef union hwcfg1_data { ++ /** raw register data */ ++ uint32_t d32; ++ /** register bits */ ++ struct { ++ unsigned ep_dir0:2; ++ unsigned ep_dir1:2; ++ unsigned ep_dir2:2; ++ unsigned ep_dir3:2; ++ unsigned ep_dir4:2; ++ unsigned ep_dir5:2; ++ unsigned ep_dir6:2; ++ unsigned ep_dir7:2; ++ unsigned ep_dir8:2; ++ unsigned ep_dir9:2; ++ unsigned ep_dir10:2; ++ unsigned ep_dir11:2; ++ unsigned ep_dir12:2; ++ unsigned ep_dir13:2; ++ unsigned ep_dir14:2; ++ unsigned ep_dir15:2; ++ } b; ++} hwcfg1_data_t; ++ ++/** ++ * This union represents the bit fields in the User HW Config2 ++ * Register. Read the register into the <i>d32</i> element then read ++ * out the bits using the <i>b</i>it elements. ++ */ ++typedef union hwcfg2_data { ++ /** raw register data */ ++ uint32_t d32; ++ /** register bits */ ++ struct { ++ /* GHWCFG2 */ ++ unsigned op_mode:3; ++#define DWC_HWCFG2_OP_MODE_HNP_SRP_CAPABLE_OTG 0 ++#define DWC_HWCFG2_OP_MODE_SRP_ONLY_CAPABLE_OTG 1 ++#define DWC_HWCFG2_OP_MODE_NO_HNP_SRP_CAPABLE_OTG 2 ++#define DWC_HWCFG2_OP_MODE_SRP_CAPABLE_DEVICE 3 ++#define DWC_HWCFG2_OP_MODE_NO_SRP_CAPABLE_DEVICE 4 ++#define DWC_HWCFG2_OP_MODE_SRP_CAPABLE_HOST 5 ++#define DWC_HWCFG2_OP_MODE_NO_SRP_CAPABLE_HOST 6 ++ ++ unsigned architecture:2; ++ unsigned point2point:1; ++ unsigned hs_phy_type:2; ++#define DWC_HWCFG2_HS_PHY_TYPE_NOT_SUPPORTED 0 ++#define DWC_HWCFG2_HS_PHY_TYPE_UTMI 1 ++#define DWC_HWCFG2_HS_PHY_TYPE_ULPI 2 ++#define DWC_HWCFG2_HS_PHY_TYPE_UTMI_ULPI 3 ++ ++ unsigned fs_phy_type:2; ++ unsigned num_dev_ep:4; ++ unsigned num_host_chan:4; ++ unsigned perio_ep_supported:1; ++ unsigned dynamic_fifo:1; ++ unsigned multi_proc_int:1; ++ unsigned reserved21:1; ++ unsigned nonperio_tx_q_depth:2; ++ unsigned host_perio_tx_q_depth:2; ++ unsigned dev_token_q_depth:5; ++ unsigned otg_enable_ic_usb:1; ++ } b; ++} hwcfg2_data_t; ++ ++/** ++ * This union represents the bit fields in the User HW Config3 ++ * Register. Read the register into the <i>d32</i> element then read ++ * out the bits using the <i>b</i>it elements. ++ */ ++typedef union hwcfg3_data { ++ /** raw register data */ ++ uint32_t d32; ++ /** register bits */ ++ struct { ++ /* GHWCFG3 */ ++ unsigned xfer_size_cntr_width:4; ++ unsigned packet_size_cntr_width:3; ++ unsigned otg_func:1; ++ unsigned i2c:1; ++ unsigned vendor_ctrl_if:1; ++ unsigned optional_features:1; ++ unsigned synch_reset_type:1; ++ unsigned adp_supp:1; ++ unsigned otg_enable_hsic:1; ++ unsigned bc_support:1; ++ unsigned otg_lpm_en:1; ++ unsigned dfifo_depth:16; ++ } b; ++} hwcfg3_data_t; ++ ++/** ++ * This union represents the bit fields in the User HW Config4 ++ * Register. Read the register into the <i>d32</i> element then read ++ * out the bits using the <i>b</i>it elements. ++ */ ++typedef union hwcfg4_data { ++ /** raw register data */ ++ uint32_t d32; ++ /** register bits */ ++ struct { ++ unsigned num_dev_perio_in_ep:4; ++ unsigned power_optimiz:1; ++ unsigned min_ahb_freq:1; ++ unsigned hiber:1; ++ unsigned xhiber:1; ++ unsigned reserved:6; ++ unsigned utmi_phy_data_width:2; ++ unsigned num_dev_mode_ctrl_ep:4; ++ unsigned iddig_filt_en:1; ++ unsigned vbus_valid_filt_en:1; ++ unsigned a_valid_filt_en:1; ++ unsigned b_valid_filt_en:1; ++ unsigned session_end_filt_en:1; ++ unsigned ded_fifo_en:1; ++ unsigned num_in_eps:4; ++ unsigned desc_dma:1; ++ unsigned desc_dma_dyn:1; ++ } b; ++} hwcfg4_data_t; ++ ++/** ++ * This union represents the bit fields of the Core LPM Configuration ++ * Register (GLPMCFG). Set the bits using bit fields then write ++ * the <i>d32</i> value to the register. ++ */ ++typedef union glpmctl_data { ++ /** raw register data */ ++ uint32_t d32; ++ /** register bits */ ++ struct { ++ /** LPM-Capable (LPMCap) (Device and Host) ++ * The application uses this bit to control ++ * the DWC_otg core LPM capabilities. ++ */ ++ unsigned lpm_cap_en:1; ++ /** LPM response programmed by application (AppL1Res) (Device) ++ * Handshake response to LPM token pre-programmed ++ * by device application software. ++ */ ++ unsigned appl_resp:1; ++ /** Host Initiated Resume Duration (HIRD) (Device and Host) ++ * In Host mode this field indicates the value of HIRD ++ * to be sent in an LPM transaction. ++ * In Device mode this field is updated with the ++ * Received LPM Token HIRD bmAttribute ++ * when an ACK/NYET/STALL response is sent ++ * to an LPM transaction. ++ */ ++ unsigned hird:4; ++ /** RemoteWakeEnable (bRemoteWake) (Device and Host) ++ * In Host mode this bit indicates the value of remote ++ * wake up to be sent in wIndex field of LPM transaction. ++ * In Device mode this field is updated with the ++ * Received LPM Token bRemoteWake bmAttribute ++ * when an ACK/NYET/STALL response is sent ++ * to an LPM transaction. ++ */ ++ unsigned rem_wkup_en:1; ++ /** Enable utmi_sleep_n (EnblSlpM) (Device and Host) ++ * The application uses this bit to control ++ * the utmi_sleep_n assertion to the PHY when in L1 state. ++ */ ++ unsigned en_utmi_sleep:1; ++ /** HIRD Threshold (HIRD_Thres) (Device and Host) ++ */ ++ unsigned hird_thres:5; ++ /** LPM Response (CoreL1Res) (Device and Host) ++ * In Host mode this bit contains handsake response to ++ * LPM transaction. ++ * In Device mode the response of the core to ++ * LPM transaction received is reflected in these two bits. ++ - 0x0 : ERROR (No handshake response) ++ - 0x1 : STALL ++ - 0x2 : NYET ++ - 0x3 : ACK ++ */ ++ unsigned lpm_resp:2; ++ /** Port Sleep Status (SlpSts) (Device and Host) ++ * This bit is set as long as a Sleep condition ++ * is present on the USB bus. ++ */ ++ unsigned prt_sleep_sts:1; ++ /** Sleep State Resume OK (L1ResumeOK) (Device and Host) ++ * Indicates that the application or host ++ * can start resume from Sleep state. ++ */ ++ unsigned sleep_state_resumeok:1; ++ /** LPM channel Index (LPM_Chnl_Indx) (Host) ++ * The channel number on which the LPM transaction ++ * has to be applied while sending ++ * an LPM transaction to the local device. ++ */ ++ unsigned lpm_chan_index:4; ++ /** LPM Retry Count (LPM_Retry_Cnt) (Host) ++ * Number host retries that would be performed ++ * if the device response was not valid response. ++ */ ++ unsigned retry_count:3; ++ /** Send LPM Transaction (SndLPM) (Host) ++ * When set by application software, ++ * an LPM transaction containing two tokens ++ * is sent. ++ */ ++ unsigned send_lpm:1; ++ /** LPM Retry status (LPM_RetryCnt_Sts) (Host) ++ * Number of LPM Host Retries still remaining ++ * to be transmitted for the current LPM sequence ++ */ ++ unsigned retry_count_sts:3; ++ unsigned reserved28_29:2; ++ /** In host mode once this bit is set, the host ++ * configures to drive the HSIC Idle state on the bus. ++ * It then waits for the device to initiate the Connect sequence. ++ * In device mode once this bit is set, the device waits for ++ * the HSIC Idle line state on the bus. Upon receving the Idle ++ * line state, it initiates the HSIC Connect sequence. ++ */ ++ unsigned hsic_connect:1; ++ /** This bit overrides and functionally inverts ++ * the if_select_hsic input port signal. ++ */ ++ unsigned inv_sel_hsic:1; ++ } b; ++} glpmcfg_data_t; ++ ++/** ++ * This union represents the bit fields of the Core ADP Timer, Control and ++ * Status Register (ADPTIMCTLSTS). Set the bits using bit fields then write ++ * the <i>d32</i> value to the register. ++ */ ++typedef union adpctl_data { ++ /** raw register data */ ++ uint32_t d32; ++ /** register bits */ ++ struct { ++ /** Probe Discharge (PRB_DSCHG) ++ * These bits set the times for TADP_DSCHG. ++ * These bits are defined as follows: ++ * 2'b00 - 4 msec ++ * 2'b01 - 8 msec ++ * 2'b10 - 16 msec ++ * 2'b11 - 32 msec ++ */ ++ unsigned prb_dschg:2; ++ /** Probe Delta (PRB_DELTA) ++ * These bits set the resolution for RTIM value. ++ * The bits are defined in units of 32 kHz clock cycles as follows: ++ * 2'b00 - 1 cycles ++ * 2'b01 - 2 cycles ++ * 2'b10 - 3 cycles ++ * 2'b11 - 4 cycles ++ * For example if this value is chosen to 2'b01, it means that RTIM ++ * increments for every 3(three) 32Khz clock cycles. ++ */ ++ unsigned prb_delta:2; ++ /** Probe Period (PRB_PER) ++ * These bits sets the TADP_PRD as shown in Figure 4 as follows: ++ * 2'b00 - 0.625 to 0.925 sec (typical 0.775 sec) ++ * 2'b01 - 1.25 to 1.85 sec (typical 1.55 sec) ++ * 2'b10 - 1.9 to 2.6 sec (typical 2.275 sec) ++ * 2'b11 - Reserved ++ */ ++ unsigned prb_per:2; ++ /** These bits capture the latest time it took for VBUS to ramp from ++ * VADP_SINK to VADP_PRB. ++ * 0x000 - 1 cycles ++ * 0x001 - 2 cycles ++ * 0x002 - 3 cycles ++ * etc ++ * 0x7FF - 2048 cycles ++ * A time of 1024 cycles at 32 kHz corresponds to a time of 32 msec. ++ */ ++ unsigned rtim:11; ++ /** Enable Probe (EnaPrb) ++ * When programmed to 1'b1, the core performs a probe operation. ++ * This bit is valid only if OTG_Ver = 1'b1. ++ */ ++ unsigned enaprb:1; ++ /** Enable Sense (EnaSns) ++ * When programmed to 1'b1, the core performs a Sense operation. ++ * This bit is valid only if OTG_Ver = 1'b1. ++ */ ++ unsigned enasns:1; ++ /** ADP Reset (ADPRes) ++ * When set, ADP controller is reset. ++ * This bit is valid only if OTG_Ver = 1'b1. ++ */ ++ unsigned adpres:1; ++ /** ADP Enable (ADPEn) ++ * When set, the core performs either ADP probing or sensing ++ * based on EnaPrb or EnaSns. ++ * This bit is valid only if OTG_Ver = 1'b1. ++ */ ++ unsigned adpen:1; ++ /** ADP Probe Interrupt (ADP_PRB_INT) ++ * When this bit is set, it means that the VBUS ++ * voltage is greater than VADP_PRB or VADP_PRB is reached. ++ * This bit is valid only if OTG_Ver = 1'b1. ++ */ ++ unsigned adp_prb_int:1; ++ /** ++ * ADP Sense Interrupt (ADP_SNS_INT) ++ * When this bit is set, it means that the VBUS voltage is greater than ++ * VADP_SNS value or VADP_SNS is reached. ++ * This bit is valid only if OTG_Ver = 1'b1. ++ */ ++ unsigned adp_sns_int:1; ++ /** ADP Tomeout Interrupt (ADP_TMOUT_INT) ++ * This bit is relevant only for an ADP probe. ++ * When this bit is set, it means that the ramp time has ++ * completed ie ADPCTL.RTIM has reached its terminal value ++ * of 0x7FF. This is a debug feature that allows software ++ * to read the ramp time after each cycle. ++ * This bit is valid only if OTG_Ver = 1'b1. ++ */ ++ unsigned adp_tmout_int:1; ++ /** ADP Probe Interrupt Mask (ADP_PRB_INT_MSK) ++ * When this bit is set, it unmasks the interrupt due to ADP_PRB_INT. ++ * This bit is valid only if OTG_Ver = 1'b1. ++ */ ++ unsigned adp_prb_int_msk:1; ++ /** ADP Sense Interrupt Mask (ADP_SNS_INT_MSK) ++ * When this bit is set, it unmasks the interrupt due to ADP_SNS_INT. ++ * This bit is valid only if OTG_Ver = 1'b1. ++ */ ++ unsigned adp_sns_int_msk:1; ++ /** ADP Timoeout Interrupt Mask (ADP_TMOUT_MSK) ++ * When this bit is set, it unmasks the interrupt due to ADP_TMOUT_INT. ++ * This bit is valid only if OTG_Ver = 1'b1. ++ */ ++ unsigned adp_tmout_int_msk:1; ++ /** Access Request ++ * 2'b00 - Read/Write Valid (updated by the core) ++ * 2'b01 - Read ++ * 2'b00 - Write ++ * 2'b00 - Reserved ++ */ ++ unsigned ar:2; ++ /** Reserved */ ++ unsigned reserved29_31:3; ++ } b; ++} adpctl_data_t; ++ ++//////////////////////////////////////////// ++// Device Registers ++/** ++ * Device Global Registers. <i>Offsets 800h-BFFh</i> ++ * ++ * The following structures define the size and relative field offsets ++ * for the Device Mode Registers. ++ * ++ * <i>These registers are visible only in Device mode and must not be ++ * accessed in Host mode, as the results are unknown.</i> ++ */ ++typedef struct dwc_otg_dev_global_regs { ++ /** Device Configuration Register. <i>Offset 800h</i> */ ++ volatile uint32_t dcfg; ++ /** Device Control Register. <i>Offset: 804h</i> */ ++ volatile uint32_t dctl; ++ /** Device Status Register (Read Only). <i>Offset: 808h</i> */ ++ volatile uint32_t dsts; ++ /** Reserved. <i>Offset: 80Ch</i> */ ++ uint32_t unused; ++ /** Device IN Endpoint Common Interrupt Mask ++ * Register. <i>Offset: 810h</i> */ ++ volatile uint32_t diepmsk; ++ /** Device OUT Endpoint Common Interrupt Mask ++ * Register. <i>Offset: 814h</i> */ ++ volatile uint32_t doepmsk; ++ /** Device All Endpoints Interrupt Register. <i>Offset: 818h</i> */ ++ volatile uint32_t daint; ++ /** Device All Endpoints Interrupt Mask Register. <i>Offset: ++ * 81Ch</i> */ ++ volatile uint32_t daintmsk; ++ /** Device IN Token Queue Read Register-1 (Read Only). ++ * <i>Offset: 820h</i> */ ++ volatile uint32_t dtknqr1; ++ /** Device IN Token Queue Read Register-2 (Read Only). ++ * <i>Offset: 824h</i> */ ++ volatile uint32_t dtknqr2; ++ /** Device VBUS discharge Register. <i>Offset: 828h</i> */ ++ volatile uint32_t dvbusdis; ++ /** Device VBUS Pulse Register. <i>Offset: 82Ch</i> */ ++ volatile uint32_t dvbuspulse; ++ /** Device IN Token Queue Read Register-3 (Read Only). / ++ * Device Thresholding control register (Read/Write) ++ * <i>Offset: 830h</i> */ ++ volatile uint32_t dtknqr3_dthrctl; ++ /** Device IN Token Queue Read Register-4 (Read Only). / ++ * Device IN EPs empty Inr. Mask Register (Read/Write) ++ * <i>Offset: 834h</i> */ ++ volatile uint32_t dtknqr4_fifoemptymsk; ++ /** Device Each Endpoint Interrupt Register (Read Only). / ++ * <i>Offset: 838h</i> */ ++ volatile uint32_t deachint; ++ /** Device Each Endpoint Interrupt mask Register (Read/Write). / ++ * <i>Offset: 83Ch</i> */ ++ volatile uint32_t deachintmsk; ++ /** Device Each In Endpoint Interrupt mask Register (Read/Write). / ++ * <i>Offset: 840h</i> */ ++ volatile uint32_t diepeachintmsk[MAX_EPS_CHANNELS]; ++ /** Device Each Out Endpoint Interrupt mask Register (Read/Write). / ++ * <i>Offset: 880h</i> */ ++ volatile uint32_t doepeachintmsk[MAX_EPS_CHANNELS]; ++} dwc_otg_device_global_regs_t; ++ ++/** ++ * This union represents the bit fields in the Device Configuration ++ * Register. Read the register into the <i>d32</i> member then ++ * set/clear the bits using the <i>b</i>it elements. Write the ++ * <i>d32</i> member to the dcfg register. ++ */ ++typedef union dcfg_data { ++ /** raw register data */ ++ uint32_t d32; ++ /** register bits */ ++ struct { ++ /** Device Speed */ ++ unsigned devspd:2; ++ /** Non Zero Length Status OUT Handshake */ ++ unsigned nzstsouthshk:1; ++#define DWC_DCFG_SEND_STALL 1 ++ ++ unsigned ena32khzs:1; ++ /** Device Addresses */ ++ unsigned devaddr:7; ++ /** Periodic Frame Interval */ ++ unsigned perfrint:2; ++#define DWC_DCFG_FRAME_INTERVAL_80 0 ++#define DWC_DCFG_FRAME_INTERVAL_85 1 ++#define DWC_DCFG_FRAME_INTERVAL_90 2 ++#define DWC_DCFG_FRAME_INTERVAL_95 3 ++ ++ /** Enable Device OUT NAK for bulk in DDMA mode */ ++ unsigned endevoutnak:1; ++ ++ unsigned reserved14_17:4; ++ /** In Endpoint Mis-match count */ ++ unsigned epmscnt:5; ++ /** Enable Descriptor DMA in Device mode */ ++ unsigned descdma:1; ++ unsigned perschintvl:2; ++ unsigned resvalid:6; ++ } b; ++} dcfg_data_t; ++ ++/** ++ * This union represents the bit fields in the Device Control ++ * Register. Read the register into the <i>d32</i> member then ++ * set/clear the bits using the <i>b</i>it elements. ++ */ ++typedef union dctl_data { ++ /** raw register data */ ++ uint32_t d32; ++ /** register bits */ ++ struct { ++ /** Remote Wakeup */ ++ unsigned rmtwkupsig:1; ++ /** Soft Disconnect */ ++ unsigned sftdiscon:1; ++ /** Global Non-Periodic IN NAK Status */ ++ unsigned gnpinnaksts:1; ++ /** Global OUT NAK Status */ ++ unsigned goutnaksts:1; ++ /** Test Control */ ++ unsigned tstctl:3; ++ /** Set Global Non-Periodic IN NAK */ ++ unsigned sgnpinnak:1; ++ /** Clear Global Non-Periodic IN NAK */ ++ unsigned cgnpinnak:1; ++ /** Set Global OUT NAK */ ++ unsigned sgoutnak:1; ++ /** Clear Global OUT NAK */ ++ unsigned cgoutnak:1; ++ /** Power-On Programming Done */ ++ unsigned pwronprgdone:1; ++ /** Reserved */ ++ unsigned reserved:1; ++ /** Global Multi Count */ ++ unsigned gmc:2; ++ /** Ignore Frame Number for ISOC EPs */ ++ unsigned ifrmnum:1; ++ /** NAK on Babble */ ++ unsigned nakonbble:1; ++ /** Enable Continue on BNA */ ++ unsigned encontonbna:1; ++ ++ unsigned reserved18_31:14; ++ } b; ++} dctl_data_t; ++ ++/** ++ * This union represents the bit fields in the Device Status ++ * Register. Read the register into the <i>d32</i> member then ++ * set/clear the bits using the <i>b</i>it elements. ++ */ ++typedef union dsts_data { ++ /** raw register data */ ++ uint32_t d32; ++ /** register bits */ ++ struct { ++ /** Suspend Status */ ++ unsigned suspsts:1; ++ /** Enumerated Speed */ ++ unsigned enumspd:2; ++#define DWC_DSTS_ENUMSPD_HS_PHY_30MHZ_OR_60MHZ 0 ++#define DWC_DSTS_ENUMSPD_FS_PHY_30MHZ_OR_60MHZ 1 ++#define DWC_DSTS_ENUMSPD_LS_PHY_6MHZ 2 ++#define DWC_DSTS_ENUMSPD_FS_PHY_48MHZ 3 ++ /** Erratic Error */ ++ unsigned errticerr:1; ++ unsigned reserved4_7:4; ++ /** Frame or Microframe Number of the received SOF */ ++ unsigned soffn:14; ++ unsigned reserved22_31:10; ++ } b; ++} dsts_data_t; ++ ++/** ++ * This union represents the bit fields in the Device IN EP Interrupt ++ * Register and the Device IN EP Common Mask Register. ++ * ++ * - Read the register into the <i>d32</i> member then set/clear the ++ * bits using the <i>b</i>it elements. ++ */ ++typedef union diepint_data { ++ /** raw register data */ ++ uint32_t d32; ++ /** register bits */ ++ struct { ++ /** Transfer complete mask */ ++ unsigned xfercompl:1; ++ /** Endpoint disable mask */ ++ unsigned epdisabled:1; ++ /** AHB Error mask */ ++ unsigned ahberr:1; ++ /** TimeOUT Handshake mask (non-ISOC EPs) */ ++ unsigned timeout:1; ++ /** IN Token received with TxF Empty mask */ ++ unsigned intktxfemp:1; ++ /** IN Token Received with EP mismatch mask */ ++ unsigned intknepmis:1; ++ /** IN Endpoint NAK Effective mask */ ++ unsigned inepnakeff:1; ++ /** Reserved */ ++ unsigned emptyintr:1; ++ ++ unsigned txfifoundrn:1; ++ ++ /** BNA Interrupt mask */ ++ unsigned bna:1; ++ ++ unsigned reserved10_12:3; ++ /** BNA Interrupt mask */ ++ unsigned nak:1; ++ ++ unsigned reserved14_31:18; ++ } b; ++} diepint_data_t; ++ ++/** ++ * This union represents the bit fields in the Device IN EP ++ * Common/Dedicated Interrupt Mask Register. ++ */ ++typedef union diepint_data diepmsk_data_t; ++ ++/** ++ * This union represents the bit fields in the Device OUT EP Interrupt ++ * Registerand Device OUT EP Common Interrupt Mask Register. ++ * ++ * - Read the register into the <i>d32</i> member then set/clear the ++ * bits using the <i>b</i>it elements. ++ */ ++typedef union doepint_data { ++ /** raw register data */ ++ uint32_t d32; ++ /** register bits */ ++ struct { ++ /** Transfer complete */ ++ unsigned xfercompl:1; ++ /** Endpoint disable */ ++ unsigned epdisabled:1; ++ /** AHB Error */ ++ unsigned ahberr:1; ++ /** Setup Phase Done (contorl EPs) */ ++ unsigned setup:1; ++ /** OUT Token Received when Endpoint Disabled */ ++ unsigned outtknepdis:1; ++ ++ unsigned stsphsercvd:1; ++ /** Back-to-Back SETUP Packets Received */ ++ unsigned back2backsetup:1; ++ ++ unsigned reserved7:1; ++ /** OUT packet Error */ ++ unsigned outpkterr:1; ++ /** BNA Interrupt */ ++ unsigned bna:1; ++ ++ unsigned reserved10:1; ++ /** Packet Drop Status */ ++ unsigned pktdrpsts:1; ++ /** Babble Interrupt */ ++ unsigned babble:1; ++ /** NAK Interrupt */ ++ unsigned nak:1; ++ /** NYET Interrupt */ ++ unsigned nyet:1; ++ /** Bit indicating setup packet received */ ++ unsigned sr:1; ++ ++ unsigned reserved16_31:16; ++ } b; ++} doepint_data_t; ++ ++/** ++ * This union represents the bit fields in the Device OUT EP ++ * Common/Dedicated Interrupt Mask Register. ++ */ ++typedef union doepint_data doepmsk_data_t; ++ ++/** ++ * This union represents the bit fields in the Device All EP Interrupt ++ * and Mask Registers. ++ * - Read the register into the <i>d32</i> member then set/clear the ++ * bits using the <i>b</i>it elements. ++ */ ++typedef union daint_data { ++ /** raw register data */ ++ uint32_t d32; ++ /** register bits */ ++ struct { ++ /** IN Endpoint bits */ ++ unsigned in:16; ++ /** OUT Endpoint bits */ ++ unsigned out:16; ++ } ep; ++ struct { ++ /** IN Endpoint bits */ ++ unsigned inep0:1; ++ unsigned inep1:1; ++ unsigned inep2:1; ++ unsigned inep3:1; ++ unsigned inep4:1; ++ unsigned inep5:1; ++ unsigned inep6:1; ++ unsigned inep7:1; ++ unsigned inep8:1; ++ unsigned inep9:1; ++ unsigned inep10:1; ++ unsigned inep11:1; ++ unsigned inep12:1; ++ unsigned inep13:1; ++ unsigned inep14:1; ++ unsigned inep15:1; ++ /** OUT Endpoint bits */ ++ unsigned outep0:1; ++ unsigned outep1:1; ++ unsigned outep2:1; ++ unsigned outep3:1; ++ unsigned outep4:1; ++ unsigned outep5:1; ++ unsigned outep6:1; ++ unsigned outep7:1; ++ unsigned outep8:1; ++ unsigned outep9:1; ++ unsigned outep10:1; ++ unsigned outep11:1; ++ unsigned outep12:1; ++ unsigned outep13:1; ++ unsigned outep14:1; ++ unsigned outep15:1; ++ } b; ++} daint_data_t; ++ ++/** ++ * This union represents the bit fields in the Device IN Token Queue ++ * Read Registers. ++ * - Read the register into the <i>d32</i> member. ++ * - READ-ONLY Register ++ */ ++typedef union dtknq1_data { ++ /** raw register data */ ++ uint32_t d32; ++ /** register bits */ ++ struct { ++ /** In Token Queue Write Pointer */ ++ unsigned intknwptr:5; ++ /** Reserved */ ++ unsigned reserved05_06:2; ++ /** write pointer has wrapped. */ ++ unsigned wrap_bit:1; ++ /** EP Numbers of IN Tokens 0 ... 4 */ ++ unsigned epnums0_5:24; ++ } b; ++} dtknq1_data_t; ++ ++/** ++ * This union represents Threshold control Register ++ * - Read and write the register into the <i>d32</i> member. ++ * - READ-WRITABLE Register ++ */ ++typedef union dthrctl_data { ++ /** raw register data */ ++ uint32_t d32; ++ /** register bits */ ++ struct { ++ /** non ISO Tx Thr. Enable */ ++ unsigned non_iso_thr_en:1; ++ /** ISO Tx Thr. Enable */ ++ unsigned iso_thr_en:1; ++ /** Tx Thr. Length */ ++ unsigned tx_thr_len:9; ++ /** AHB Threshold ratio */ ++ unsigned ahb_thr_ratio:2; ++ /** Reserved */ ++ unsigned reserved13_15:3; ++ /** Rx Thr. Enable */ ++ unsigned rx_thr_en:1; ++ /** Rx Thr. Length */ ++ unsigned rx_thr_len:9; ++ unsigned reserved26:1; ++ /** Arbiter Parking Enable*/ ++ unsigned arbprken:1; ++ /** Reserved */ ++ unsigned reserved28_31:4; ++ } b; ++} dthrctl_data_t; ++ ++/** ++ * Device Logical IN Endpoint-Specific Registers. <i>Offsets ++ * 900h-AFCh</i> ++ * ++ * There will be one set of endpoint registers per logical endpoint ++ * implemented. ++ * ++ * <i>These registers are visible only in Device mode and must not be ++ * accessed in Host mode, as the results are unknown.</i> ++ */ ++typedef struct dwc_otg_dev_in_ep_regs { ++ /** Device IN Endpoint Control Register. <i>Offset:900h + ++ * (ep_num * 20h) + 00h</i> */ ++ volatile uint32_t diepctl; ++ /** Reserved. <i>Offset:900h + (ep_num * 20h) + 04h</i> */ ++ uint32_t reserved04; ++ /** Device IN Endpoint Interrupt Register. <i>Offset:900h + ++ * (ep_num * 20h) + 08h</i> */ ++ volatile uint32_t diepint; ++ /** Reserved. <i>Offset:900h + (ep_num * 20h) + 0Ch</i> */ ++ uint32_t reserved0C; ++ /** Device IN Endpoint Transfer Size ++ * Register. <i>Offset:900h + (ep_num * 20h) + 10h</i> */ ++ volatile uint32_t dieptsiz; ++ /** Device IN Endpoint DMA Address Register. <i>Offset:900h + ++ * (ep_num * 20h) + 14h</i> */ ++ volatile uint32_t diepdma; ++ /** Device IN Endpoint Transmit FIFO Status Register. <i>Offset:900h + ++ * (ep_num * 20h) + 18h</i> */ ++ volatile uint32_t dtxfsts; ++ /** Device IN Endpoint DMA Buffer Register. <i>Offset:900h + ++ * (ep_num * 20h) + 1Ch</i> */ ++ volatile uint32_t diepdmab; ++} dwc_otg_dev_in_ep_regs_t; ++ ++/** ++ * Device Logical OUT Endpoint-Specific Registers. <i>Offsets: ++ * B00h-CFCh</i> ++ * ++ * There will be one set of endpoint registers per logical endpoint ++ * implemented. ++ * ++ * <i>These registers are visible only in Device mode and must not be ++ * accessed in Host mode, as the results are unknown.</i> ++ */ ++typedef struct dwc_otg_dev_out_ep_regs { ++ /** Device OUT Endpoint Control Register. <i>Offset:B00h + ++ * (ep_num * 20h) + 00h</i> */ ++ volatile uint32_t doepctl; ++ /** Reserved. <i>Offset:B00h + (ep_num * 20h) + 04h</i> */ ++ uint32_t reserved04; ++ /** Device OUT Endpoint Interrupt Register. <i>Offset:B00h + ++ * (ep_num * 20h) + 08h</i> */ ++ volatile uint32_t doepint; ++ /** Reserved. <i>Offset:B00h + (ep_num * 20h) + 0Ch</i> */ ++ uint32_t reserved0C; ++ /** Device OUT Endpoint Transfer Size Register. <i>Offset: ++ * B00h + (ep_num * 20h) + 10h</i> */ ++ volatile uint32_t doeptsiz; ++ /** Device OUT Endpoint DMA Address Register. <i>Offset:B00h ++ * + (ep_num * 20h) + 14h</i> */ ++ volatile uint32_t doepdma; ++ /** Reserved. <i>Offset:B00h + * (ep_num * 20h) + 18h</i> */ ++ uint32_t unused; ++ /** Device OUT Endpoint DMA Buffer Register. <i>Offset:B00h ++ * + (ep_num * 20h) + 1Ch</i> */ ++ uint32_t doepdmab; ++} dwc_otg_dev_out_ep_regs_t; ++ ++/** ++ * This union represents the bit fields in the Device EP Control ++ * Register. Read the register into the <i>d32</i> member then ++ * set/clear the bits using the <i>b</i>it elements. ++ */ ++typedef union depctl_data { ++ /** raw register data */ ++ uint32_t d32; ++ /** register bits */ ++ struct { ++ /** Maximum Packet Size ++ * IN/OUT EPn ++ * IN/OUT EP0 - 2 bits ++ * 2'b00: 64 Bytes ++ * 2'b01: 32 ++ * 2'b10: 16 ++ * 2'b11: 8 */ ++ unsigned mps:11; ++#define DWC_DEP0CTL_MPS_64 0 ++#define DWC_DEP0CTL_MPS_32 1 ++#define DWC_DEP0CTL_MPS_16 2 ++#define DWC_DEP0CTL_MPS_8 3 ++ ++ /** Next Endpoint ++ * IN EPn/IN EP0 ++ * OUT EPn/OUT EP0 - reserved */ ++ unsigned nextep:4; ++ ++ /** USB Active Endpoint */ ++ unsigned usbactep:1; ++ ++ /** Endpoint DPID (INTR/Bulk IN and OUT endpoints) ++ * This field contains the PID of the packet going to ++ * be received or transmitted on this endpoint. The ++ * application should program the PID of the first ++ * packet going to be received or transmitted on this ++ * endpoint , after the endpoint is ++ * activated. Application use the SetD1PID and ++ * SetD0PID fields of this register to program either ++ * D0 or D1 PID. ++ * ++ * The encoding for this field is ++ * - 0: D0 ++ * - 1: D1 ++ */ ++ unsigned dpid:1; ++ ++ /** NAK Status */ ++ unsigned naksts:1; ++ ++ /** Endpoint Type ++ * 2'b00: Control ++ * 2'b01: Isochronous ++ * 2'b10: Bulk ++ * 2'b11: Interrupt */ ++ unsigned eptype:2; ++ ++ /** Snoop Mode ++ * OUT EPn/OUT EP0 ++ * IN EPn/IN EP0 - reserved */ ++ unsigned snp:1; ++ ++ /** Stall Handshake */ ++ unsigned stall:1; ++ ++ /** Tx Fifo Number ++ * IN EPn/IN EP0 ++ * OUT EPn/OUT EP0 - reserved */ ++ unsigned txfnum:4; ++ ++ /** Clear NAK */ ++ unsigned cnak:1; ++ /** Set NAK */ ++ unsigned snak:1; ++ /** Set DATA0 PID (INTR/Bulk IN and OUT endpoints) ++ * Writing to this field sets the Endpoint DPID (DPID) ++ * field in this register to DATA0. Set Even ++ * (micro)frame (SetEvenFr) (ISO IN and OUT Endpoints) ++ * Writing to this field sets the Even/Odd ++ * (micro)frame (EO_FrNum) field to even (micro) ++ * frame. ++ */ ++ unsigned setd0pid:1; ++ /** Set DATA1 PID (INTR/Bulk IN and OUT endpoints) ++ * Writing to this field sets the Endpoint DPID (DPID) ++ * field in this register to DATA1 Set Odd ++ * (micro)frame (SetOddFr) (ISO IN and OUT Endpoints) ++ * Writing to this field sets the Even/Odd ++ * (micro)frame (EO_FrNum) field to odd (micro) frame. ++ */ ++ unsigned setd1pid:1; ++ ++ /** Endpoint Disable */ ++ unsigned epdis:1; ++ /** Endpoint Enable */ ++ unsigned epena:1; ++ } b; ++} depctl_data_t; ++ ++/** ++ * This union represents the bit fields in the Device EP Transfer ++ * Size Register. Read the register into the <i>d32</i> member then ++ * set/clear the bits using the <i>b</i>it elements. ++ */ ++typedef union deptsiz_data { ++ /** raw register data */ ++ uint32_t d32; ++ /** register bits */ ++ struct { ++ /** Transfer size */ ++ unsigned xfersize:19; ++/** Max packet count for EP (pow(2,10)-1) */ ++#define MAX_PKT_CNT 1023 ++ /** Packet Count */ ++ unsigned pktcnt:10; ++ /** Multi Count - Periodic IN endpoints */ ++ unsigned mc:2; ++ unsigned reserved:1; ++ } b; ++} deptsiz_data_t; ++ ++/** ++ * This union represents the bit fields in the Device EP 0 Transfer ++ * Size Register. Read the register into the <i>d32</i> member then ++ * set/clear the bits using the <i>b</i>it elements. ++ */ ++typedef union deptsiz0_data { ++ /** raw register data */ ++ uint32_t d32; ++ /** register bits */ ++ struct { ++ /** Transfer size */ ++ unsigned xfersize:7; ++ /** Reserved */ ++ unsigned reserved7_18:12; ++ /** Packet Count */ ++ unsigned pktcnt:2; ++ /** Reserved */ ++ unsigned reserved21_28:8; ++ /**Setup Packet Count (DOEPTSIZ0 Only) */ ++ unsigned supcnt:2; ++ unsigned reserved31; ++ } b; ++} deptsiz0_data_t; ++ ++///////////////////////////////////////////////// ++// DMA Descriptor Specific Structures ++// ++ ++/** Buffer status definitions */ ++ ++#define BS_HOST_READY 0x0 ++#define BS_DMA_BUSY 0x1 ++#define BS_DMA_DONE 0x2 ++#define BS_HOST_BUSY 0x3 ++ ++/** Receive/Transmit status definitions */ ++ ++#define RTS_SUCCESS 0x0 ++#define RTS_BUFFLUSH 0x1 ++#define RTS_RESERVED 0x2 ++#define RTS_BUFERR 0x3 ++ ++/** ++ * This union represents the bit fields in the DMA Descriptor ++ * status quadlet. Read the quadlet into the <i>d32</i> member then ++ * set/clear the bits using the <i>b</i>it, <i>b_iso_out</i> and ++ * <i>b_iso_in</i> elements. ++ */ ++typedef union dev_dma_desc_sts { ++ /** raw register data */ ++ uint32_t d32; ++ /** quadlet bits */ ++ struct { ++ /** Received number of bytes */ ++ unsigned bytes:16; ++ /** NAK bit - only for OUT EPs */ ++ unsigned nak:1; ++ unsigned reserved17_22:6; ++ /** Multiple Transfer - only for OUT EPs */ ++ unsigned mtrf:1; ++ /** Setup Packet received - only for OUT EPs */ ++ unsigned sr:1; ++ /** Interrupt On Complete */ ++ unsigned ioc:1; ++ /** Short Packet */ ++ unsigned sp:1; ++ /** Last */ ++ unsigned l:1; ++ /** Receive Status */ ++ unsigned sts:2; ++ /** Buffer Status */ ++ unsigned bs:2; ++ } b; ++ ++//#ifdef DWC_EN_ISOC ++ /** iso out quadlet bits */ ++ struct { ++ /** Received number of bytes */ ++ unsigned rxbytes:11; ++ ++ unsigned reserved11:1; ++ /** Frame Number */ ++ unsigned framenum:11; ++ /** Received ISO Data PID */ ++ unsigned pid:2; ++ /** Interrupt On Complete */ ++ unsigned ioc:1; ++ /** Short Packet */ ++ unsigned sp:1; ++ /** Last */ ++ unsigned l:1; ++ /** Receive Status */ ++ unsigned rxsts:2; ++ /** Buffer Status */ ++ unsigned bs:2; ++ } b_iso_out; ++ ++ /** iso in quadlet bits */ ++ struct { ++ /** Transmited number of bytes */ ++ unsigned txbytes:12; ++ /** Frame Number */ ++ unsigned framenum:11; ++ /** Transmited ISO Data PID */ ++ unsigned pid:2; ++ /** Interrupt On Complete */ ++ unsigned ioc:1; ++ /** Short Packet */ ++ unsigned sp:1; ++ /** Last */ ++ unsigned l:1; ++ /** Transmit Status */ ++ unsigned txsts:2; ++ /** Buffer Status */ ++ unsigned bs:2; ++ } b_iso_in; ++//#endif /* DWC_EN_ISOC */ ++} dev_dma_desc_sts_t; ++ ++/** ++ * DMA Descriptor structure ++ * ++ * DMA Descriptor structure contains two quadlets: ++ * Status quadlet and Data buffer pointer. ++ */ ++typedef struct dwc_otg_dev_dma_desc { ++ /** DMA Descriptor status quadlet */ ++ dev_dma_desc_sts_t status; ++ /** DMA Descriptor data buffer pointer */ ++ uint32_t buf; ++} dwc_otg_dev_dma_desc_t; ++ ++/** ++ * The dwc_otg_dev_if structure contains information needed to manage ++ * the DWC_otg controller acting in device mode. It represents the ++ * programming view of the device-specific aspects of the controller. ++ */ ++typedef struct dwc_otg_dev_if { ++ /** Pointer to device Global registers. ++ * Device Global Registers starting at offset 800h ++ */ ++ dwc_otg_device_global_regs_t *dev_global_regs; ++#define DWC_DEV_GLOBAL_REG_OFFSET 0x800 ++ ++ /** ++ * Device Logical IN Endpoint-Specific Registers 900h-AFCh ++ */ ++ dwc_otg_dev_in_ep_regs_t *in_ep_regs[MAX_EPS_CHANNELS]; ++#define DWC_DEV_IN_EP_REG_OFFSET 0x900 ++#define DWC_EP_REG_OFFSET 0x20 ++ ++ /** Device Logical OUT Endpoint-Specific Registers B00h-CFCh */ ++ dwc_otg_dev_out_ep_regs_t *out_ep_regs[MAX_EPS_CHANNELS]; ++#define DWC_DEV_OUT_EP_REG_OFFSET 0xB00 ++ ++ /* Device configuration information */ ++ uint8_t speed; /**< Device Speed 0: Unknown, 1: LS, 2:FS, 3: HS */ ++ uint8_t num_in_eps; /**< Number # of Tx EP range: 0-15 exept ep0 */ ++ uint8_t num_out_eps; /**< Number # of Rx EP range: 0-15 exept ep 0*/ ++ ++ /** Size of periodic FIFOs (Bytes) */ ++ uint16_t perio_tx_fifo_size[MAX_PERIO_FIFOS]; ++ ++ /** Size of Tx FIFOs (Bytes) */ ++ uint16_t tx_fifo_size[MAX_TX_FIFOS]; ++ ++ /** Thresholding enable flags and length varaiables **/ ++ uint16_t rx_thr_en; ++ uint16_t iso_tx_thr_en; ++ uint16_t non_iso_tx_thr_en; ++ ++ uint16_t rx_thr_length; ++ uint16_t tx_thr_length; ++ ++ /** ++ * Pointers to the DMA Descriptors for EP0 Control ++ * transfers (virtual and physical) ++ */ ++ ++ /** 2 descriptors for SETUP packets */ ++ dwc_dma_t dma_setup_desc_addr[2]; ++ dwc_otg_dev_dma_desc_t *setup_desc_addr[2]; ++ ++ /** Pointer to Descriptor with latest SETUP packet */ ++ dwc_otg_dev_dma_desc_t *psetup; ++ ++ /** Index of current SETUP handler descriptor */ ++ uint32_t setup_desc_index; ++ ++ /** Descriptor for Data In or Status In phases */ ++ dwc_dma_t dma_in_desc_addr; ++ dwc_otg_dev_dma_desc_t *in_desc_addr; ++ ++ /** Descriptor for Data Out or Status Out phases */ ++ dwc_dma_t dma_out_desc_addr; ++ dwc_otg_dev_dma_desc_t *out_desc_addr; ++ ++ /** Setup Packet Detected - if set clear NAK when queueing */ ++ uint32_t spd; ++ /** Isoc ep pointer on which incomplete happens */ ++ void *isoc_ep; ++ ++} dwc_otg_dev_if_t; ++ ++///////////////////////////////////////////////// ++// Host Mode Register Structures ++// ++/** ++ * The Host Global Registers structure defines the size and relative ++ * field offsets for the Host Mode Global Registers. Host Global ++ * Registers offsets 400h-7FFh. ++*/ ++typedef struct dwc_otg_host_global_regs { ++ /** Host Configuration Register. <i>Offset: 400h</i> */ ++ volatile uint32_t hcfg; ++ /** Host Frame Interval Register. <i>Offset: 404h</i> */ ++ volatile uint32_t hfir; ++ /** Host Frame Number / Frame Remaining Register. <i>Offset: 408h</i> */ ++ volatile uint32_t hfnum; ++ /** Reserved. <i>Offset: 40Ch</i> */ ++ uint32_t reserved40C; ++ /** Host Periodic Transmit FIFO/ Queue Status Register. <i>Offset: 410h</i> */ ++ volatile uint32_t hptxsts; ++ /** Host All Channels Interrupt Register. <i>Offset: 414h</i> */ ++ volatile uint32_t haint; ++ /** Host All Channels Interrupt Mask Register. <i>Offset: 418h</i> */ ++ volatile uint32_t haintmsk; ++ /** Host Frame List Base Address Register . <i>Offset: 41Ch</i> */ ++ volatile uint32_t hflbaddr; ++} dwc_otg_host_global_regs_t; ++ ++/** ++ * This union represents the bit fields in the Host Configuration Register. ++ * Read the register into the <i>d32</i> member then set/clear the bits using ++ * the <i>b</i>it elements. Write the <i>d32</i> member to the hcfg register. ++ */ ++typedef union hcfg_data { ++ /** raw register data */ ++ uint32_t d32; ++ ++ /** register bits */ ++ struct { ++ /** FS/LS Phy Clock Select */ ++ unsigned fslspclksel:2; ++#define DWC_HCFG_30_60_MHZ 0 ++#define DWC_HCFG_48_MHZ 1 ++#define DWC_HCFG_6_MHZ 2 ++ ++ /** FS/LS Only Support */ ++ unsigned fslssupp:1; ++ unsigned reserved3_6:4; ++ /** Enable 32-KHz Suspend Mode */ ++ unsigned ena32khzs:1; ++ /** Resume Validation Periiod */ ++ unsigned resvalid:8; ++ unsigned reserved16_22:7; ++ /** Enable Scatter/gather DMA in Host mode */ ++ unsigned descdma:1; ++ /** Frame List Entries */ ++ unsigned frlisten:2; ++ /** Enable Periodic Scheduling */ ++ unsigned perschedena:1; ++ unsigned reserved27_30:4; ++ unsigned modechtimen:1; ++ } b; ++} hcfg_data_t; ++ ++/** ++ * This union represents the bit fields in the Host Frame Remaing/Number ++ * Register. ++ */ ++typedef union hfir_data { ++ /** raw register data */ ++ uint32_t d32; ++ ++ /** register bits */ ++ struct { ++ unsigned frint:16; ++ unsigned hfirrldctrl:1; ++ unsigned reserved:15; ++ } b; ++} hfir_data_t; ++ ++/** ++ * This union represents the bit fields in the Host Frame Remaing/Number ++ * Register. ++ */ ++typedef union hfnum_data { ++ /** raw register data */ ++ uint32_t d32; ++ ++ /** register bits */ ++ struct { ++ unsigned frnum:16; ++#define DWC_HFNUM_MAX_FRNUM 0x3FFF ++ unsigned frrem:16; ++ } b; ++} hfnum_data_t; ++ ++typedef union hptxsts_data { ++ /** raw register data */ ++ uint32_t d32; ++ ++ /** register bits */ ++ struct { ++ unsigned ptxfspcavail:16; ++ unsigned ptxqspcavail:8; ++ /** Top of the Periodic Transmit Request Queue ++ * - bit 24 - Terminate (last entry for the selected channel) ++ * - bits 26:25 - Token Type ++ * - 2'b00 - Zero length ++ * - 2'b01 - Ping ++ * - 2'b10 - Disable ++ * - bits 30:27 - Channel Number ++ * - bit 31 - Odd/even microframe ++ */ ++ unsigned ptxqtop_terminate:1; ++ unsigned ptxqtop_token:2; ++ unsigned ptxqtop_chnum:4; ++ unsigned ptxqtop_odd:1; ++ } b; ++} hptxsts_data_t; ++ ++/** ++ * This union represents the bit fields in the Host Port Control and Status ++ * Register. Read the register into the <i>d32</i> member then set/clear the ++ * bits using the <i>b</i>it elements. Write the <i>d32</i> member to the ++ * hprt0 register. ++ */ ++typedef union hprt0_data { ++ /** raw register data */ ++ uint32_t d32; ++ /** register bits */ ++ struct { ++ unsigned prtconnsts:1; ++ unsigned prtconndet:1; ++ unsigned prtena:1; ++ unsigned prtenchng:1; ++ unsigned prtovrcurract:1; ++ unsigned prtovrcurrchng:1; ++ unsigned prtres:1; ++ unsigned prtsusp:1; ++ unsigned prtrst:1; ++ unsigned reserved9:1; ++ unsigned prtlnsts:2; ++ unsigned prtpwr:1; ++ unsigned prttstctl:4; ++ unsigned prtspd:2; ++#define DWC_HPRT0_PRTSPD_HIGH_SPEED 0 ++#define DWC_HPRT0_PRTSPD_FULL_SPEED 1 ++#define DWC_HPRT0_PRTSPD_LOW_SPEED 2 ++ unsigned reserved19_31:13; ++ } b; ++} hprt0_data_t; ++ ++/** ++ * This union represents the bit fields in the Host All Interrupt ++ * Register. ++ */ ++typedef union haint_data { ++ /** raw register data */ ++ uint32_t d32; ++ /** register bits */ ++ struct { ++ unsigned ch0:1; ++ unsigned ch1:1; ++ unsigned ch2:1; ++ unsigned ch3:1; ++ unsigned ch4:1; ++ unsigned ch5:1; ++ unsigned ch6:1; ++ unsigned ch7:1; ++ unsigned ch8:1; ++ unsigned ch9:1; ++ unsigned ch10:1; ++ unsigned ch11:1; ++ unsigned ch12:1; ++ unsigned ch13:1; ++ unsigned ch14:1; ++ unsigned ch15:1; ++ unsigned reserved:16; ++ } b; ++ ++ struct { ++ unsigned chint:16; ++ unsigned reserved:16; ++ } b2; ++} haint_data_t; ++ ++/** ++ * This union represents the bit fields in the Host All Interrupt ++ * Register. ++ */ ++typedef union haintmsk_data { ++ /** raw register data */ ++ uint32_t d32; ++ /** register bits */ ++ struct { ++ unsigned ch0:1; ++ unsigned ch1:1; ++ unsigned ch2:1; ++ unsigned ch3:1; ++ unsigned ch4:1; ++ unsigned ch5:1; ++ unsigned ch6:1; ++ unsigned ch7:1; ++ unsigned ch8:1; ++ unsigned ch9:1; ++ unsigned ch10:1; ++ unsigned ch11:1; ++ unsigned ch12:1; ++ unsigned ch13:1; ++ unsigned ch14:1; ++ unsigned ch15:1; ++ unsigned reserved:16; ++ } b; ++ ++ struct { ++ unsigned chint:16; ++ unsigned reserved:16; ++ } b2; ++} haintmsk_data_t; ++ ++/** ++ * Host Channel Specific Registers. <i>500h-5FCh</i> ++ */ ++typedef struct dwc_otg_hc_regs { ++ /** Host Channel 0 Characteristic Register. <i>Offset: 500h + (chan_num * 20h) + 00h</i> */ ++ volatile uint32_t hcchar; ++ /** Host Channel 0 Split Control Register. <i>Offset: 500h + (chan_num * 20h) + 04h</i> */ ++ volatile uint32_t hcsplt; ++ /** Host Channel 0 Interrupt Register. <i>Offset: 500h + (chan_num * 20h) + 08h</i> */ ++ volatile uint32_t hcint; ++ /** Host Channel 0 Interrupt Mask Register. <i>Offset: 500h + (chan_num * 20h) + 0Ch</i> */ ++ volatile uint32_t hcintmsk; ++ /** Host Channel 0 Transfer Size Register. <i>Offset: 500h + (chan_num * 20h) + 10h</i> */ ++ volatile uint32_t hctsiz; ++ /** Host Channel 0 DMA Address Register. <i>Offset: 500h + (chan_num * 20h) + 14h</i> */ ++ volatile uint32_t hcdma; ++ volatile uint32_t reserved; ++ /** Host Channel 0 DMA Buffer Address Register. <i>Offset: 500h + (chan_num * 20h) + 1Ch</i> */ ++ volatile uint32_t hcdmab; ++} dwc_otg_hc_regs_t; ++ ++/** ++ * This union represents the bit fields in the Host Channel Characteristics ++ * Register. Read the register into the <i>d32</i> member then set/clear the ++ * bits using the <i>b</i>it elements. Write the <i>d32</i> member to the ++ * hcchar register. ++ */ ++typedef union hcchar_data { ++ /** raw register data */ ++ uint32_t d32; ++ ++ /** register bits */ ++ struct { ++ /** Maximum packet size in bytes */ ++ unsigned mps:11; ++ ++ /** Endpoint number */ ++ unsigned epnum:4; ++ ++ /** 0: OUT, 1: IN */ ++ unsigned epdir:1; ++ ++ unsigned reserved:1; ++ ++ /** 0: Full/high speed device, 1: Low speed device */ ++ unsigned lspddev:1; ++ ++ /** 0: Control, 1: Isoc, 2: Bulk, 3: Intr */ ++ unsigned eptype:2; ++ ++ /** Packets per frame for periodic transfers. 0 is reserved. */ ++ unsigned multicnt:2; ++ ++ /** Device address */ ++ unsigned devaddr:7; ++ ++ /** ++ * Frame to transmit periodic transaction. ++ * 0: even, 1: odd ++ */ ++ unsigned oddfrm:1; ++ ++ /** Channel disable */ ++ unsigned chdis:1; ++ ++ /** Channel enable */ ++ unsigned chen:1; ++ } b; ++} hcchar_data_t; ++ ++typedef union hcsplt_data { ++ /** raw register data */ ++ uint32_t d32; ++ ++ /** register bits */ ++ struct { ++ /** Port Address */ ++ unsigned prtaddr:7; ++ ++ /** Hub Address */ ++ unsigned hubaddr:7; ++ ++ /** Transaction Position */ ++ unsigned xactpos:2; ++#define DWC_HCSPLIT_XACTPOS_MID 0 ++#define DWC_HCSPLIT_XACTPOS_END 1 ++#define DWC_HCSPLIT_XACTPOS_BEGIN 2 ++#define DWC_HCSPLIT_XACTPOS_ALL 3 ++ ++ /** Do Complete Split */ ++ unsigned compsplt:1; ++ ++ /** Reserved */ ++ unsigned reserved:14; ++ ++ /** Split Enble */ ++ unsigned spltena:1; ++ } b; ++} hcsplt_data_t; ++ ++/** ++ * This union represents the bit fields in the Host All Interrupt ++ * Register. ++ */ ++typedef union hcint_data { ++ /** raw register data */ ++ uint32_t d32; ++ /** register bits */ ++ struct { ++ /** Transfer Complete */ ++ unsigned xfercomp:1; ++ /** Channel Halted */ ++ unsigned chhltd:1; ++ /** AHB Error */ ++ unsigned ahberr:1; ++ /** STALL Response Received */ ++ unsigned stall:1; ++ /** NAK Response Received */ ++ unsigned nak:1; ++ /** ACK Response Received */ ++ unsigned ack:1; ++ /** NYET Response Received */ ++ unsigned nyet:1; ++ /** Transaction Err */ ++ unsigned xacterr:1; ++ /** Babble Error */ ++ unsigned bblerr:1; ++ /** Frame Overrun */ ++ unsigned frmovrun:1; ++ /** Data Toggle Error */ ++ unsigned datatglerr:1; ++ /** Buffer Not Available (only for DDMA mode) */ ++ unsigned bna:1; ++ /** Exessive transaction error (only for DDMA mode) */ ++ unsigned xcs_xact:1; ++ /** Frame List Rollover interrupt */ ++ unsigned frm_list_roll:1; ++ /** Reserved */ ++ unsigned reserved14_31:18; ++ } b; ++} hcint_data_t; ++ ++/** ++ * This union represents the bit fields in the Host Channel Interrupt Mask ++ * Register. Read the register into the <i>d32</i> member then set/clear the ++ * bits using the <i>b</i>it elements. Write the <i>d32</i> member to the ++ * hcintmsk register. ++ */ ++typedef union hcintmsk_data { ++ /** raw register data */ ++ uint32_t d32; ++ ++ /** register bits */ ++ struct { ++ unsigned xfercompl:1; ++ unsigned chhltd:1; ++ unsigned ahberr:1; ++ unsigned stall:1; ++ unsigned nak:1; ++ unsigned ack:1; ++ unsigned nyet:1; ++ unsigned xacterr:1; ++ unsigned bblerr:1; ++ unsigned frmovrun:1; ++ unsigned datatglerr:1; ++ unsigned bna:1; ++ unsigned xcs_xact:1; ++ unsigned frm_list_roll:1; ++ unsigned reserved14_31:18; ++ } b; ++} hcintmsk_data_t; ++ ++/** ++ * This union represents the bit fields in the Host Channel Transfer Size ++ * Register. Read the register into the <i>d32</i> member then set/clear the ++ * bits using the <i>b</i>it elements. Write the <i>d32</i> member to the ++ * hcchar register. ++ */ ++ ++typedef union hctsiz_data { ++ /** raw register data */ ++ uint32_t d32; ++ ++ /** register bits */ ++ struct { ++ /** Total transfer size in bytes */ ++ unsigned xfersize:19; ++ ++ /** Data packets to transfer */ ++ unsigned pktcnt:10; ++ ++ /** ++ * Packet ID for next data packet ++ * 0: DATA0 ++ * 1: DATA2 ++ * 2: DATA1 ++ * 3: MDATA (non-Control), SETUP (Control) ++ */ ++ unsigned pid:2; ++#define DWC_HCTSIZ_DATA0 0 ++#define DWC_HCTSIZ_DATA1 2 ++#define DWC_HCTSIZ_DATA2 1 ++#define DWC_HCTSIZ_MDATA 3 ++#define DWC_HCTSIZ_SETUP 3 ++ ++ /** Do PING protocol when 1 */ ++ unsigned dopng:1; ++ } b; ++ ++ /** register bits */ ++ struct { ++ /** Scheduling information */ ++ unsigned schinfo:8; ++ ++ /** Number of transfer descriptors. ++ * Max value: ++ * 64 in general, ++ * 256 only for HS isochronous endpoint. ++ */ ++ unsigned ntd:8; ++ ++ /** Data packets to transfer */ ++ unsigned reserved16_28:13; ++ ++ /** ++ * Packet ID for next data packet ++ * 0: DATA0 ++ * 1: DATA2 ++ * 2: DATA1 ++ * 3: MDATA (non-Control) ++ */ ++ unsigned pid:2; ++ ++ /** Do PING protocol when 1 */ ++ unsigned dopng:1; ++ } b_ddma; ++} hctsiz_data_t; ++ ++/** ++ * This union represents the bit fields in the Host DMA Address ++ * Register used in Descriptor DMA mode. ++ */ ++typedef union hcdma_data { ++ /** raw register data */ ++ uint32_t d32; ++ /** register bits */ ++ struct { ++ unsigned reserved0_2:3; ++ /** Current Transfer Descriptor. Not used for ISOC */ ++ unsigned ctd:8; ++ /** Start Address of Descriptor List */ ++ unsigned dma_addr:21; ++ } b; ++} hcdma_data_t; ++ ++/** ++ * This union represents the bit fields in the DMA Descriptor ++ * status quadlet for host mode. Read the quadlet into the <i>d32</i> member then ++ * set/clear the bits using the <i>b</i>it elements. ++ */ ++typedef union host_dma_desc_sts { ++ /** raw register data */ ++ uint32_t d32; ++ /** quadlet bits */ ++ ++ /* for non-isochronous */ ++ struct { ++ /** Number of bytes */ ++ unsigned n_bytes:17; ++ /** QTD offset to jump when Short Packet received - only for IN EPs */ ++ unsigned qtd_offset:6; ++ /** ++ * Set to request the core to jump to alternate QTD if ++ * Short Packet received - only for IN EPs ++ */ ++ unsigned a_qtd:1; ++ /** ++ * Setup Packet bit. When set indicates that buffer contains ++ * setup packet. ++ */ ++ unsigned sup:1; ++ /** Interrupt On Complete */ ++ unsigned ioc:1; ++ /** End of List */ ++ unsigned eol:1; ++ unsigned reserved27:1; ++ /** Rx/Tx Status */ ++ unsigned sts:2; ++#define DMA_DESC_STS_PKTERR 1 ++ unsigned reserved30:1; ++ /** Active Bit */ ++ unsigned a:1; ++ } b; ++ /* for isochronous */ ++ struct { ++ /** Number of bytes */ ++ unsigned n_bytes:12; ++ unsigned reserved12_24:13; ++ /** Interrupt On Complete */ ++ unsigned ioc:1; ++ unsigned reserved26_27:2; ++ /** Rx/Tx Status */ ++ unsigned sts:2; ++ unsigned reserved30:1; ++ /** Active Bit */ ++ unsigned a:1; ++ } b_isoc; ++} host_dma_desc_sts_t; ++ ++#define MAX_DMA_DESC_SIZE 131071 ++#define MAX_DMA_DESC_NUM_GENERIC 64 ++#define MAX_DMA_DESC_NUM_HS_ISOC 256 ++#define MAX_FRLIST_EN_NUM 64 ++/** ++ * Host-mode DMA Descriptor structure ++ * ++ * DMA Descriptor structure contains two quadlets: ++ * Status quadlet and Data buffer pointer. ++ */ ++typedef struct dwc_otg_host_dma_desc { ++ /** DMA Descriptor status quadlet */ ++ host_dma_desc_sts_t status; ++ /** DMA Descriptor data buffer pointer */ ++ uint32_t buf; ++} dwc_otg_host_dma_desc_t; ++ ++/** OTG Host Interface Structure. ++ * ++ * The OTG Host Interface Structure structure contains information ++ * needed to manage the DWC_otg controller acting in host mode. It ++ * represents the programming view of the host-specific aspects of the ++ * controller. ++ */ ++typedef struct dwc_otg_host_if { ++ /** Host Global Registers starting at offset 400h.*/ ++ dwc_otg_host_global_regs_t *host_global_regs; ++#define DWC_OTG_HOST_GLOBAL_REG_OFFSET 0x400 ++ ++ /** Host Port 0 Control and Status Register */ ++ volatile uint32_t *hprt0; ++#define DWC_OTG_HOST_PORT_REGS_OFFSET 0x440 ++ ++ /** Host Channel Specific Registers at offsets 500h-5FCh. */ ++ dwc_otg_hc_regs_t *hc_regs[MAX_EPS_CHANNELS]; ++#define DWC_OTG_HOST_CHAN_REGS_OFFSET 0x500 ++#define DWC_OTG_CHAN_REGS_OFFSET 0x20 ++ ++ /* Host configuration information */ ++ /** Number of Host Channels (range: 1-16) */ ++ uint8_t num_host_channels; ++ /** Periodic EPs supported (0: no, 1: yes) */ ++ uint8_t perio_eps_supported; ++ /** Periodic Tx FIFO Size (Only 1 host periodic Tx FIFO) */ ++ uint16_t perio_tx_fifo_size; ++ ++} dwc_otg_host_if_t; ++ ++/** ++ * This union represents the bit fields in the Power and Clock Gating Control ++ * Register. Read the register into the <i>d32</i> member then set/clear the ++ * bits using the <i>b</i>it elements. ++ */ ++typedef union pcgcctl_data { ++ /** raw register data */ ++ uint32_t d32; ++ ++ /** register bits */ ++ struct { ++ /** Stop Pclk */ ++ unsigned stoppclk:1; ++ /** Gate Hclk */ ++ unsigned gatehclk:1; ++ /** Power Clamp */ ++ unsigned pwrclmp:1; ++ /** Reset Power Down Modules */ ++ unsigned rstpdwnmodule:1; ++ /** Reserved */ ++ unsigned reserved:1; ++ /** Enable Sleep Clock Gating (Enbl_L1Gating) */ ++ unsigned enbl_sleep_gating:1; ++ /** PHY In Sleep (PhySleep) */ ++ unsigned phy_in_sleep:1; ++ /** Deep Sleep*/ ++ unsigned deep_sleep:1; ++ unsigned resetaftsusp:1; ++ unsigned restoremode:1; ++ unsigned enbl_extnd_hiber:1; ++ unsigned extnd_hiber_pwrclmp:1; ++ unsigned extnd_hiber_switch:1; ++ unsigned ess_reg_restored:1; ++ unsigned prt_clk_sel:2; ++ unsigned port_power:1; ++ unsigned max_xcvrselect:2; ++ unsigned max_termsel:1; ++ unsigned mac_dev_addr:7; ++ unsigned p2hd_dev_enum_spd:2; ++ unsigned p2hd_prt_spd:2; ++ unsigned if_dev_mode:1; ++ } b; ++} pcgcctl_data_t; ++ ++/** ++ * This union represents the bit fields in the Global Data FIFO Software ++ * Configuration Register. Read the register into the <i>d32</i> member then ++ * set/clear the bits using the <i>b</i>it elements. ++ */ ++typedef union gdfifocfg_data { ++ /* raw register data */ ++ uint32_t d32; ++ /** register bits */ ++ struct { ++ /** OTG Data FIFO depth */ ++ unsigned gdfifocfg:16; ++ /** Start address of EP info controller */ ++ unsigned epinfobase:16; ++ } b; ++} gdfifocfg_data_t; ++ ++/** ++ * This union represents the bit fields in the Global Power Down Register ++ * Register. Read the register into the <i>d32</i> member then set/clear the ++ * bits using the <i>b</i>it elements. ++ */ ++typedef union gpwrdn_data { ++ /* raw register data */ ++ uint32_t d32; ++ ++ /** register bits */ ++ struct { ++ /** PMU Interrupt Select */ ++ unsigned pmuintsel:1; ++ /** PMU Active */ ++ unsigned pmuactv:1; ++ /** Restore */ ++ unsigned restore:1; ++ /** Power Down Clamp */ ++ unsigned pwrdnclmp:1; ++ /** Power Down Reset */ ++ unsigned pwrdnrstn:1; ++ /** Power Down Switch */ ++ unsigned pwrdnswtch:1; ++ /** Disable VBUS */ ++ unsigned dis_vbus:1; ++ /** Line State Change */ ++ unsigned lnstschng:1; ++ /** Line state change mask */ ++ unsigned lnstchng_msk:1; ++ /** Reset Detected */ ++ unsigned rst_det:1; ++ /** Reset Detect mask */ ++ unsigned rst_det_msk:1; ++ /** Disconnect Detected */ ++ unsigned disconn_det:1; ++ /** Disconnect Detect mask */ ++ unsigned disconn_det_msk:1; ++ /** Connect Detected*/ ++ unsigned connect_det:1; ++ /** Connect Detected Mask*/ ++ unsigned connect_det_msk:1; ++ /** SRP Detected */ ++ unsigned srp_det:1; ++ /** SRP Detect mask */ ++ unsigned srp_det_msk:1; ++ /** Status Change Interrupt */ ++ unsigned sts_chngint:1; ++ /** Status Change Interrupt Mask */ ++ unsigned sts_chngint_msk:1; ++ /** Line State */ ++ unsigned linestate:2; ++ /** Indicates current mode(status of IDDIG signal) */ ++ unsigned idsts:1; ++ /** B Session Valid signal status*/ ++ unsigned bsessvld:1; ++ /** ADP Event Detected */ ++ unsigned adp_int:1; ++ /** Multi Valued ID pin */ ++ unsigned mult_val_id_bc:5; ++ /** Reserved 24_31 */ ++ unsigned reserved29_31:3; ++ } b; ++} gpwrdn_data_t; ++ ++#endif +diff --git a/drivers/usb/host/dwc_otg/test/Makefile b/drivers/usb/host/dwc_otg/test/Makefile +new file mode 100644 +index 0000000..fc45375 +--- /dev/null ++++ b/drivers/usb/host/dwc_otg/test/Makefile +@@ -0,0 +1,16 @@ ++ ++PERL=/usr/bin/perl ++PL_TESTS=test_sysfs.pl test_mod_param.pl ++ ++.PHONY : test ++test : perl_tests ++ ++perl_tests : ++ @echo ++ @echo Running perl tests ++ @for test in $(PL_TESTS); do \ ++ if $(PERL) ./$$test ; then \ ++ echo "=======> $$test, PASSED" ; \ ++ else echo "=======> $$test, FAILED" ; \ ++ fi \ ++ done +diff --git a/drivers/usb/host/dwc_otg/test/dwc_otg_test.pm b/drivers/usb/host/dwc_otg/test/dwc_otg_test.pm +new file mode 100644 +index 0000000..85e55fd +--- /dev/null ++++ b/drivers/usb/host/dwc_otg/test/dwc_otg_test.pm +@@ -0,0 +1,337 @@ ++package dwc_otg_test; ++ ++use strict; ++use Exporter (); ++ ++use vars qw(@ISA @EXPORT ++$sysfsdir $paramdir $errors $params ++); ++ ++@ISA = qw(Exporter); ++ ++# ++# Globals ++# ++$sysfsdir = "/sys/devices/lm0"; ++$paramdir = "/sys/module/dwc_otg"; ++$errors = 0; ++ ++$params = [ ++ { ++ NAME => "otg_cap", ++ DEFAULT => 0, ++ ENUM => [], ++ LOW => 0, ++ HIGH => 2 ++ }, ++ { ++ NAME => "dma_enable", ++ DEFAULT => 0, ++ ENUM => [], ++ LOW => 0, ++ HIGH => 1 ++ }, ++ { ++ NAME => "dma_burst_size", ++ DEFAULT => 32, ++ ENUM => [1, 4, 8, 16, 32, 64, 128, 256], ++ LOW => 1, ++ HIGH => 256 ++ }, ++ { ++ NAME => "host_speed", ++ DEFAULT => 0, ++ ENUM => [], ++ LOW => 0, ++ HIGH => 1 ++ }, ++ { ++ NAME => "host_support_fs_ls_low_power", ++ DEFAULT => 0, ++ ENUM => [], ++ LOW => 0, ++ HIGH => 1 ++ }, ++ { ++ NAME => "host_ls_low_power_phy_clk", ++ DEFAULT => 0, ++ ENUM => [], ++ LOW => 0, ++ HIGH => 1 ++ }, ++ { ++ NAME => "dev_speed", ++ DEFAULT => 0, ++ ENUM => [], ++ LOW => 0, ++ HIGH => 1 ++ }, ++ { ++ NAME => "enable_dynamic_fifo", ++ DEFAULT => 1, ++ ENUM => [], ++ LOW => 0, ++ HIGH => 1 ++ }, ++ { ++ NAME => "data_fifo_size", ++ DEFAULT => 8192, ++ ENUM => [], ++ LOW => 32, ++ HIGH => 32768 ++ }, ++ { ++ NAME => "dev_rx_fifo_size", ++ DEFAULT => 1064, ++ ENUM => [], ++ LOW => 16, ++ HIGH => 32768 ++ }, ++ { ++ NAME => "dev_nperio_tx_fifo_size", ++ DEFAULT => 1024, ++ ENUM => [], ++ LOW => 16, ++ HIGH => 32768 ++ }, ++ { ++ NAME => "dev_perio_tx_fifo_size_1", ++ DEFAULT => 256, ++ ENUM => [], ++ LOW => 4, ++ HIGH => 768 ++ }, ++ { ++ NAME => "dev_perio_tx_fifo_size_2", ++ DEFAULT => 256, ++ ENUM => [], ++ LOW => 4, ++ HIGH => 768 ++ }, ++ { ++ NAME => "dev_perio_tx_fifo_size_3", ++ DEFAULT => 256, ++ ENUM => [], ++ LOW => 4, ++ HIGH => 768 ++ }, ++ { ++ NAME => "dev_perio_tx_fifo_size_4", ++ DEFAULT => 256, ++ ENUM => [], ++ LOW => 4, ++ HIGH => 768 ++ }, ++ { ++ NAME => "dev_perio_tx_fifo_size_5", ++ DEFAULT => 256, ++ ENUM => [], ++ LOW => 4, ++ HIGH => 768 ++ }, ++ { ++ NAME => "dev_perio_tx_fifo_size_6", ++ DEFAULT => 256, ++ ENUM => [], ++ LOW => 4, ++ HIGH => 768 ++ }, ++ { ++ NAME => "dev_perio_tx_fifo_size_7", ++ DEFAULT => 256, ++ ENUM => [], ++ LOW => 4, ++ HIGH => 768 ++ }, ++ { ++ NAME => "dev_perio_tx_fifo_size_8", ++ DEFAULT => 256, ++ ENUM => [], ++ LOW => 4, ++ HIGH => 768 ++ }, ++ { ++ NAME => "dev_perio_tx_fifo_size_9", ++ DEFAULT => 256, ++ ENUM => [], ++ LOW => 4, ++ HIGH => 768 ++ }, ++ { ++ NAME => "dev_perio_tx_fifo_size_10", ++ DEFAULT => 256, ++ ENUM => [], ++ LOW => 4, ++ HIGH => 768 ++ }, ++ { ++ NAME => "dev_perio_tx_fifo_size_11", ++ DEFAULT => 256, ++ ENUM => [], ++ LOW => 4, ++ HIGH => 768 ++ }, ++ { ++ NAME => "dev_perio_tx_fifo_size_12", ++ DEFAULT => 256, ++ ENUM => [], ++ LOW => 4, ++ HIGH => 768 ++ }, ++ { ++ NAME => "dev_perio_tx_fifo_size_13", ++ DEFAULT => 256, ++ ENUM => [], ++ LOW => 4, ++ HIGH => 768 ++ }, ++ { ++ NAME => "dev_perio_tx_fifo_size_14", ++ DEFAULT => 256, ++ ENUM => [], ++ LOW => 4, ++ HIGH => 768 ++ }, ++ { ++ NAME => "dev_perio_tx_fifo_size_15", ++ DEFAULT => 256, ++ ENUM => [], ++ LOW => 4, ++ HIGH => 768 ++ }, ++ { ++ NAME => "host_rx_fifo_size", ++ DEFAULT => 1024, ++ ENUM => [], ++ LOW => 16, ++ HIGH => 32768 ++ }, ++ { ++ NAME => "host_nperio_tx_fifo_size", ++ DEFAULT => 1024, ++ ENUM => [], ++ LOW => 16, ++ HIGH => 32768 ++ }, ++ { ++ NAME => "host_perio_tx_fifo_size", ++ DEFAULT => 1024, ++ ENUM => [], ++ LOW => 16, ++ HIGH => 32768 ++ }, ++ { ++ NAME => "max_transfer_size", ++ DEFAULT => 65535, ++ ENUM => [], ++ LOW => 2047, ++ HIGH => 65535 ++ }, ++ { ++ NAME => "max_packet_count", ++ DEFAULT => 511, ++ ENUM => [], ++ LOW => 15, ++ HIGH => 511 ++ }, ++ { ++ NAME => "host_channels", ++ DEFAULT => 12, ++ ENUM => [], ++ LOW => 1, ++ HIGH => 16 ++ }, ++ { ++ NAME => "dev_endpoints", ++ DEFAULT => 6, ++ ENUM => [], ++ LOW => 1, ++ HIGH => 15 ++ }, ++ { ++ NAME => "phy_type", ++ DEFAULT => 1, ++ ENUM => [], ++ LOW => 0, ++ HIGH => 2 ++ }, ++ { ++ NAME => "phy_utmi_width", ++ DEFAULT => 16, ++ ENUM => [8, 16], ++ LOW => 8, ++ HIGH => 16 ++ }, ++ { ++ NAME => "phy_ulpi_ddr", ++ DEFAULT => 0, ++ ENUM => [], ++ LOW => 0, ++ HIGH => 1 ++ }, ++ ]; ++ ++ ++# ++# ++sub check_arch { ++ $_ = `uname -m`; ++ chomp; ++ unless (m/armv4tl/) { ++ warn "# \n# Can't execute on $_. Run on integrator platform.\n# \n"; ++ return 0; ++ } ++ return 1; ++} ++ ++# ++# ++sub load_module { ++ my $params = shift; ++ print "\nRemoving Module\n"; ++ system "rmmod dwc_otg"; ++ print "Loading Module\n"; ++ if ($params ne "") { ++ print "Module Parameters: $params\n"; ++ } ++ if (system("modprobe dwc_otg $params")) { ++ warn "Unable to load module\n"; ++ return 0; ++ } ++ return 1; ++} ++ ++# ++# ++sub test_status { ++ my $arg = shift; ++ ++ print "\n"; ++ ++ if (defined $arg) { ++ warn "WARNING: $arg\n"; ++ } ++ ++ if ($errors > 0) { ++ warn "TEST FAILED with $errors errors\n"; ++ return 0; ++ } else { ++ print "TEST PASSED\n"; ++ return 0 if (defined $arg); ++ } ++ return 1; ++} ++ ++# ++# ++@EXPORT = qw( ++$sysfsdir ++$paramdir ++$params ++$errors ++check_arch ++load_module ++test_status ++); ++ ++1; +diff --git a/drivers/usb/host/dwc_otg/test/test_mod_param.pl b/drivers/usb/host/dwc_otg/test/test_mod_param.pl +new file mode 100644 +index 0000000..dc3820d +--- /dev/null ++++ b/drivers/usb/host/dwc_otg/test/test_mod_param.pl +@@ -0,0 +1,133 @@ ++#!/usr/bin/perl -w ++# ++# Run this program on the integrator. ++# ++# - Tests module parameter default values. ++# - Tests setting of valid module parameter values via modprobe. ++# - Tests invalid module parameter values. ++# ----------------------------------------------------------------------------- ++use strict; ++use dwc_otg_test; ++ ++check_arch() or die; ++ ++# ++# ++sub test { ++ my ($param,$expected) = @_; ++ my $value = get($param); ++ ++ if ($value == $expected) { ++ print "$param = $value, okay\n"; ++ } ++ ++ else { ++ warn "ERROR: value of $param != $expected, $value\n"; ++ $errors ++; ++ } ++} ++ ++# ++# ++sub get { ++ my $param = shift; ++ my $tmp = `cat $paramdir/$param`; ++ chomp $tmp; ++ return $tmp; ++} ++ ++# ++# ++sub test_main { ++ ++ print "\nTesting Module Parameters\n"; ++ ++ load_module("") or die; ++ ++ # Test initial values ++ print "\nTesting Default Values\n"; ++ foreach (@{$params}) { ++ test ($_->{NAME}, $_->{DEFAULT}); ++ } ++ ++ # Test low value ++ print "\nTesting Low Value\n"; ++ my $cmd_params = ""; ++ foreach (@{$params}) { ++ $cmd_params = $cmd_params . "$_->{NAME}=$_->{LOW} "; ++ } ++ load_module($cmd_params) or die; ++ ++ foreach (@{$params}) { ++ test ($_->{NAME}, $_->{LOW}); ++ } ++ ++ # Test high value ++ print "\nTesting High Value\n"; ++ $cmd_params = ""; ++ foreach (@{$params}) { ++ $cmd_params = $cmd_params . "$_->{NAME}=$_->{HIGH} "; ++ } ++ load_module($cmd_params) or die; ++ ++ foreach (@{$params}) { ++ test ($_->{NAME}, $_->{HIGH}); ++ } ++ ++ # Test Enum ++ print "\nTesting Enumerated\n"; ++ foreach (@{$params}) { ++ if (defined $_->{ENUM}) { ++ my $value; ++ foreach $value (@{$_->{ENUM}}) { ++ $cmd_params = "$_->{NAME}=$value"; ++ load_module($cmd_params) or die; ++ test ($_->{NAME}, $value); ++ } ++ } ++ } ++ ++ # Test Invalid Values ++ print "\nTesting Invalid Values\n"; ++ $cmd_params = ""; ++ foreach (@{$params}) { ++ $cmd_params = $cmd_params . sprintf "$_->{NAME}=%d ", $_->{LOW}-1; ++ } ++ load_module($cmd_params) or die; ++ ++ foreach (@{$params}) { ++ test ($_->{NAME}, $_->{DEFAULT}); ++ } ++ ++ $cmd_params = ""; ++ foreach (@{$params}) { ++ $cmd_params = $cmd_params . sprintf "$_->{NAME}=%d ", $_->{HIGH}+1; ++ } ++ load_module($cmd_params) or die; ++ ++ foreach (@{$params}) { ++ test ($_->{NAME}, $_->{DEFAULT}); ++ } ++ ++ print "\nTesting Enumerated\n"; ++ foreach (@{$params}) { ++ if (defined $_->{ENUM}) { ++ my $value; ++ foreach $value (@{$_->{ENUM}}) { ++ $value = $value + 1; ++ $cmd_params = "$_->{NAME}=$value"; ++ load_module($cmd_params) or die; ++ test ($_->{NAME}, $_->{DEFAULT}); ++ $value = $value - 2; ++ $cmd_params = "$_->{NAME}=$value"; ++ load_module($cmd_params) or die; ++ test ($_->{NAME}, $_->{DEFAULT}); ++ } ++ } ++ } ++ ++ test_status() or die; ++} ++ ++test_main(); ++0; +diff --git a/drivers/usb/host/dwc_otg/test/test_sysfs.pl b/drivers/usb/host/dwc_otg/test/test_sysfs.pl +new file mode 100644 +index 0000000..cdc9963 +--- /dev/null ++++ b/drivers/usb/host/dwc_otg/test/test_sysfs.pl +@@ -0,0 +1,193 @@ ++#!/usr/bin/perl -w ++# ++# Run this program on the integrator ++# - Tests select sysfs attributes. ++# - Todo ... test more attributes, hnp/srp, buspower/bussuspend, etc. ++# ----------------------------------------------------------------------------- ++use strict; ++use dwc_otg_test; ++ ++check_arch() or die; ++ ++# ++# ++sub test { ++ my ($attr,$expected) = @_; ++ my $string = get($attr); ++ ++ if ($string eq $expected) { ++ printf("$attr = $string, okay\n"); ++ } ++ else { ++ warn "ERROR: value of $attr != $expected, $string\n"; ++ $errors ++; ++ } ++} ++ ++# ++# ++sub set { ++ my ($reg, $value) = @_; ++ system "echo $value > $sysfsdir/$reg"; ++} ++ ++# ++# ++sub get { ++ my $attr = shift; ++ my $string = `cat $sysfsdir/$attr`; ++ chomp $string; ++ if ($string =~ m/\s\=\s/) { ++ my $tmp; ++ ($tmp, $string) = split /\s=\s/, $string; ++ } ++ return $string; ++} ++ ++# ++# ++sub test_main { ++ print("\nTesting Sysfs Attributes\n"); ++ ++ load_module("") or die; ++ ++ # Test initial values of regoffset/regvalue/guid/gsnpsid ++ print("\nTesting Default Values\n"); ++ ++ test("regoffset", "0xffffffff"); ++ test("regvalue", "invalid offset"); ++ test("guid", "0x12345678"); # this will fail if it has been changed ++ test("gsnpsid", "0x4f54200a"); ++ ++ # Test operation of regoffset/regvalue ++ print("\nTesting regoffset\n"); ++ set('regoffset', '5a5a5a5a'); ++ test("regoffset", "0xffffffff"); ++ ++ set('regoffset', '0'); ++ test("regoffset", "0x00000000"); ++ ++ set('regoffset', '40000'); ++ test("regoffset", "0x00000000"); ++ ++ set('regoffset', '3ffff'); ++ test("regoffset", "0x0003ffff"); ++ ++ set('regoffset', '1'); ++ test("regoffset", "0x00000001"); ++ ++ print("\nTesting regvalue\n"); ++ set('regoffset', '3c'); ++ test("regvalue", "0x12345678"); ++ set('regvalue', '5a5a5a5a'); ++ test("regvalue", "0x5a5a5a5a"); ++ set('regvalue','a5a5a5a5'); ++ test("regvalue", "0xa5a5a5a5"); ++ set('guid','12345678'); ++ ++ # Test HNP Capable ++ print("\nTesting HNP Capable bit\n"); ++ set('hnpcapable', '1'); ++ test("hnpcapable", "0x1"); ++ set('hnpcapable','0'); ++ test("hnpcapable", "0x0"); ++ ++ set('regoffset','0c'); ++ ++ my $old = get('gusbcfg'); ++ print("setting hnpcapable\n"); ++ set('hnpcapable', '1'); ++ test("hnpcapable", "0x1"); ++ test('gusbcfg', sprintf "0x%08x", (oct ($old) | (1<<9))); ++ test('regvalue', sprintf "0x%08x", (oct ($old) | (1<<9))); ++ ++ $old = get('gusbcfg'); ++ print("clearing hnpcapable\n"); ++ set('hnpcapable', '0'); ++ test("hnpcapable", "0x0"); ++ test ('gusbcfg', sprintf "0x%08x", oct ($old) & (~(1<<9))); ++ test ('regvalue', sprintf "0x%08x", oct ($old) & (~(1<<9))); ++ ++ # Test SRP Capable ++ print("\nTesting SRP Capable bit\n"); ++ set('srpcapable', '1'); ++ test("srpcapable", "0x1"); ++ set('srpcapable','0'); ++ test("srpcapable", "0x0"); ++ ++ set('regoffset','0c'); ++ ++ $old = get('gusbcfg'); ++ print("setting srpcapable\n"); ++ set('srpcapable', '1'); ++ test("srpcapable", "0x1"); ++ test('gusbcfg', sprintf "0x%08x", (oct ($old) | (1<<8))); ++ test('regvalue', sprintf "0x%08x", (oct ($old) | (1<<8))); ++ ++ $old = get('gusbcfg'); ++ print("clearing srpcapable\n"); ++ set('srpcapable', '0'); ++ test("srpcapable", "0x0"); ++ test('gusbcfg', sprintf "0x%08x", oct ($old) & (~(1<<8))); ++ test('regvalue', sprintf "0x%08x", oct ($old) & (~(1<<8))); ++ ++ # Test GGPIO ++ print("\nTesting GGPIO\n"); ++ set('ggpio','5a5a5a5a'); ++ test('ggpio','0x5a5a0000'); ++ set('ggpio','a5a5a5a5'); ++ test('ggpio','0xa5a50000'); ++ set('ggpio','11110000'); ++ test('ggpio','0x11110000'); ++ set('ggpio','00001111'); ++ test('ggpio','0x00000000'); ++ ++ # Test DEVSPEED ++ print("\nTesting DEVSPEED\n"); ++ set('regoffset','800'); ++ $old = get('regvalue'); ++ set('devspeed','0'); ++ test('devspeed','0x0'); ++ test('regvalue',sprintf("0x%08x", oct($old) & ~(0x3))); ++ set('devspeed','1'); ++ test('devspeed','0x1'); ++ test('regvalue',sprintf("0x%08x", oct($old) & ~(0x3) | 1)); ++ set('devspeed','2'); ++ test('devspeed','0x2'); ++ test('regvalue',sprintf("0x%08x", oct($old) & ~(0x3) | 2)); ++ set('devspeed','3'); ++ test('devspeed','0x3'); ++ test('regvalue',sprintf("0x%08x", oct($old) & ~(0x3) | 3)); ++ set('devspeed','4'); ++ test('devspeed','0x0'); ++ test('regvalue',sprintf("0x%08x", oct($old) & ~(0x3))); ++ set('devspeed','5'); ++ test('devspeed','0x1'); ++ test('regvalue',sprintf("0x%08x", oct($old) & ~(0x3) | 1)); ++ ++ ++ # mode Returns the current mode:0 for device mode1 for host mode Read ++ # hnp Initiate the Host Negotiation Protocol. Read returns the status. Read/Write ++ # srp Initiate the Session Request Protocol. Read returns the status. Read/Write ++ # buspower Get or Set the Power State of the bus (0 - Off or 1 - On) Read/Write ++ # bussuspend Suspend the USB bus. Read/Write ++ # busconnected Get the connection status of the bus Read ++ ++ # gotgctl Get or set the Core Control Status Register. Read/Write ++ ## gusbcfg Get or set the Core USB Configuration Register Read/Write ++ # grxfsiz Get or set the Receive FIFO Size Register Read/Write ++ # gnptxfsiz Get or set the non-periodic Transmit Size Register Read/Write ++ # gpvndctl Get or set the PHY Vendor Control Register Read/Write ++ ## ggpio Get the value in the lower 16-bits of the General Purpose IO Register or Set the upper 16 bits. Read/Write ++ ## guid Get or set the value of the User ID Register Read/Write ++ ## gsnpsid Get the value of the Synopsys ID Regester Read ++ ## devspeed Get or set the device speed setting in the DCFG register Read/Write ++ # enumspeed Gets the device enumeration Speed. Read ++ # hptxfsiz Get the value of the Host Periodic Transmit FIFO Read ++ # hprt0 Get or Set the value in the Host Port Control and Status Register Read/Write ++ ++ test_status("TEST NYI") or die; ++} ++ ++test_main(); ++0; + +From 5eb9e2e749d68100ad84ad874d095e96f7583860 Mon Sep 17 00:00:00 2001 +From: popcornmix <popcornmix@gmail.com> +Date: Wed, 17 Jun 2015 17:06:34 +0100 +Subject: [PATCH 034/112] bcm2708 framebuffer driver +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: popcornmix <popcornmix@gmail.com> + +bcm2708_fb : Implement blanking support using the mailbox property interface + +bcm2708_fb: Add pan and vsync controls + +bcm2708_fb: DMA acceleration for fb_copyarea + +Based on http://www.raspberrypi.org/phpBB3/viewtopic.php?p=62425#p62425 +Also used Simon's dmaer_master module as a reference for tweaking DMA +settings for better performance. + +For now busylooping only. IRQ support might be added later. +With non-overclocked Raspberry Pi, the performance is ~360 MB/s +for simple copy or ~260 MB/s for two-pass copy (used when dragging +windows to the right). + +In the case of using DMA channel 0, the performance improves +to ~440 MB/s. + +For comparison, VFP optimized CPU copy can only do ~114 MB/s in +the same conditions (hindered by reading uncached source buffer). + +Signed-off-by: Siarhei Siamashka <siarhei.siamashka@gmail.com> + +bcm2708_fb: report number of dma copies + +Add a counter (exported via debugfs) reporting the +number of dma copies that the framebuffer driver +has done, in order to help evaluate different +optimization strategies. + +Signed-off-by: Luke Diamand <luked@broadcom.com> + +bcm2708_fb: use IRQ for DMA copies + +The copyarea ioctl() uses DMA to speed things along. This +was busy-waiting for completion. This change supports using +an interrupt instead for larger transfers. For small +transfers, busy-waiting is still likely to be faster. + +Signed-off-by: Luke Diamand <luke@diamand.org> + +bcm2708: Make ioctl logging quieter + +video: fbdev: bcm2708_fb: Don't panic on error + +No need to panic the kernel if the video driver fails. +Just print a message and return an error. + +Signed-off-by: Noralf Trønnes <noralf@tronnes.org> + +fbdev: bcm2708_fb: Add ARCH_BCM2835 support + +Add Device Tree support. +Pass the device to dma_alloc_coherent() in order to get the +correct bus address on ARCH_BCM2835. +Use the new DMA legacy API header file. +Including <mach/platform.h> is not necessary. + +Signed-off-by: Noralf Trønnes <noralf@tronnes.org> + +BCM270x_DT: Add bcm2708-fb device + +Add bcm2708-fb to Device Tree and don't add the +platform device when booting in DT mode. + +Signed-off-by: Noralf Trønnes <noralf@tronnes.org> +--- + drivers/video/fbdev/Kconfig | 14 + + drivers/video/fbdev/Makefile | 1 + + drivers/video/fbdev/bcm2708_fb.c | 844 ++++++++++ + drivers/video/logo/logo_linux_clut224.ppm | 2483 ++++++++++------------------- + 4 files changed, 1740 insertions(+), 1602 deletions(-) + create mode 100644 drivers/video/fbdev/bcm2708_fb.c + +diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig +index 983280e..ee72c3a 100644 +--- a/drivers/video/fbdev/Kconfig ++++ b/drivers/video/fbdev/Kconfig +@@ -228,6 +228,20 @@ config FB_TILEBLITTING + comment "Frame buffer hardware drivers" + depends on FB + ++config FB_BCM2708 ++ tristate "BCM2708 framebuffer support" ++ depends on FB && RASPBERRYPI_FIRMWARE ++ select FB_CFB_FILLRECT ++ select FB_CFB_COPYAREA ++ select FB_CFB_IMAGEBLIT ++ help ++ This framebuffer device driver is for the BCM2708 framebuffer. ++ ++ If you want to compile this as a module (=code which can be ++ inserted into and removed from the running kernel), say M ++ here and read <file:Documentation/kbuild/modules.txt>. The module ++ will be called bcm2708_fb. ++ + config FB_GRVGA + tristate "Aeroflex Gaisler framebuffer support" + depends on FB && SPARC +diff --git a/drivers/video/fbdev/Makefile b/drivers/video/fbdev/Makefile +index 65fb150..df473d8 100644 +--- a/drivers/video/fbdev/Makefile ++++ b/drivers/video/fbdev/Makefile +@@ -12,6 +12,7 @@ obj-$(CONFIG_FB_MACMODES) += macmodes.o + obj-$(CONFIG_FB_WMT_GE_ROPS) += wmt_ge_rops.o + + # Hardware specific drivers go first ++obj-$(CONFIG_FB_BCM2708) += bcm2708_fb.o + obj-$(CONFIG_FB_AMIGA) += amifb.o c2p_planar.o + obj-$(CONFIG_FB_ARC) += arcfb.o + obj-$(CONFIG_FB_CLPS711X) += clps711x-fb.o +diff --git a/drivers/video/fbdev/bcm2708_fb.c b/drivers/video/fbdev/bcm2708_fb.c +new file mode 100644 +index 0000000..cae5aab +--- /dev/null ++++ b/drivers/video/fbdev/bcm2708_fb.c +@@ -0,0 +1,844 @@ ++/* ++ * linux/drivers/video/bcm2708_fb.c ++ * ++ * Copyright (C) 2010 Broadcom ++ * ++ * This file is subject to the terms and conditions of the GNU General Public ++ * License. See the file COPYING in the main directory of this archive ++ * for more details. ++ * ++ * Broadcom simple framebuffer driver ++ * ++ * This file is derived from cirrusfb.c ++ * Copyright 1999-2001 Jeff Garzik <jgarzik@pobox.com> ++ * ++ */ ++#include <linux/module.h> ++#include <linux/kernel.h> ++#include <linux/errno.h> ++#include <linux/string.h> ++#include <linux/slab.h> ++#include <linux/mm.h> ++#include <linux/fb.h> ++#include <linux/init.h> ++#include <linux/interrupt.h> ++#include <linux/ioport.h> ++#include <linux/list.h> ++#include <linux/platform_data/dma-bcm2708.h> ++#include <linux/platform_device.h> ++#include <linux/clk.h> ++#include <linux/printk.h> ++#include <linux/console.h> ++#include <linux/debugfs.h> ++#include <asm/sizes.h> ++#include <linux/io.h> ++#include <linux/dma-mapping.h> ++#include <soc/bcm2835/raspberrypi-firmware.h> ++ ++//#define BCM2708_FB_DEBUG ++#define MODULE_NAME "bcm2708_fb" ++ ++#ifdef BCM2708_FB_DEBUG ++#define print_debug(fmt,...) pr_debug("%s:%s:%d: "fmt, MODULE_NAME, __func__, __LINE__, ##__VA_ARGS__) ++#else ++#define print_debug(fmt,...) ++#endif ++ ++/* This is limited to 16 characters when displayed by X startup */ ++static const char *bcm2708_name = "BCM2708 FB"; ++ ++#define DRIVER_NAME "bcm2708_fb" ++ ++static int fbwidth = 800; /* module parameter */ ++static int fbheight = 480; /* module parameter */ ++static int fbdepth = 16; /* module parameter */ ++static int fbswap = 0; /* module parameter */ ++ ++static u32 dma_busy_wait_threshold = 1<<15; ++module_param(dma_busy_wait_threshold, int, 0644); ++MODULE_PARM_DESC(dma_busy_wait_threshold, "Busy-wait for DMA completion below this area"); ++ ++struct fb_alloc_tags { ++ struct rpi_firmware_property_tag_header tag1; ++ u32 xres, yres; ++ struct rpi_firmware_property_tag_header tag2; ++ u32 xres_virtual, yres_virtual; ++ struct rpi_firmware_property_tag_header tag3; ++ u32 bpp; ++ struct rpi_firmware_property_tag_header tag4; ++ u32 xoffset, yoffset; ++ struct rpi_firmware_property_tag_header tag5; ++ u32 base, screen_size; ++ struct rpi_firmware_property_tag_header tag6; ++ u32 pitch; ++}; ++ ++struct bcm2708_fb_stats { ++ struct debugfs_regset32 regset; ++ u32 dma_copies; ++ u32 dma_irqs; ++}; ++ ++struct bcm2708_fb { ++ struct fb_info fb; ++ struct platform_device *dev; ++ struct rpi_firmware *fw; ++ u32 cmap[16]; ++ u32 gpu_cmap[256]; ++ int dma_chan; ++ int dma_irq; ++ void __iomem *dma_chan_base; ++ void *cb_base; /* DMA control blocks */ ++ dma_addr_t cb_handle; ++ struct dentry *debugfs_dir; ++ wait_queue_head_t dma_waitq; ++ struct bcm2708_fb_stats stats; ++ unsigned long fb_bus_address; ++}; ++ ++#define to_bcm2708(info) container_of(info, struct bcm2708_fb, fb) ++ ++static void bcm2708_fb_debugfs_deinit(struct bcm2708_fb *fb) ++{ ++ debugfs_remove_recursive(fb->debugfs_dir); ++ fb->debugfs_dir = NULL; ++} ++ ++static int bcm2708_fb_debugfs_init(struct bcm2708_fb *fb) ++{ ++ static struct debugfs_reg32 stats_registers[] = { ++ { ++ "dma_copies", ++ offsetof(struct bcm2708_fb_stats, dma_copies) ++ }, ++ { ++ "dma_irqs", ++ offsetof(struct bcm2708_fb_stats, dma_irqs) ++ }, ++ }; ++ ++ fb->debugfs_dir = debugfs_create_dir(DRIVER_NAME, NULL); ++ if (!fb->debugfs_dir) { ++ pr_warn("%s: could not create debugfs entry\n", ++ __func__); ++ return -EFAULT; ++ } ++ ++ fb->stats.regset.regs = stats_registers; ++ fb->stats.regset.nregs = ARRAY_SIZE(stats_registers); ++ fb->stats.regset.base = &fb->stats; ++ ++ if (!debugfs_create_regset32( ++ "stats", 0444, fb->debugfs_dir, &fb->stats.regset)) { ++ pr_warn("%s: could not create statistics registers\n", ++ __func__); ++ goto fail; ++ } ++ return 0; ++ ++fail: ++ bcm2708_fb_debugfs_deinit(fb); ++ return -EFAULT; ++} ++ ++static int bcm2708_fb_set_bitfields(struct fb_var_screeninfo *var) ++{ ++ int ret = 0; ++ ++ memset(&var->transp, 0, sizeof(var->transp)); ++ ++ var->red.msb_right = 0; ++ var->green.msb_right = 0; ++ var->blue.msb_right = 0; ++ ++ switch (var->bits_per_pixel) { ++ case 1: ++ case 2: ++ case 4: ++ case 8: ++ var->red.length = var->bits_per_pixel; ++ var->red.offset = 0; ++ var->green.length = var->bits_per_pixel; ++ var->green.offset = 0; ++ var->blue.length = var->bits_per_pixel; ++ var->blue.offset = 0; ++ break; ++ case 16: ++ var->red.length = 5; ++ var->blue.length = 5; ++ /* ++ * Green length can be 5 or 6 depending whether ++ * we're operating in RGB555 or RGB565 mode. ++ */ ++ if (var->green.length != 5 && var->green.length != 6) ++ var->green.length = 6; ++ break; ++ case 24: ++ var->red.length = 8; ++ var->blue.length = 8; ++ var->green.length = 8; ++ break; ++ case 32: ++ var->red.length = 8; ++ var->green.length = 8; ++ var->blue.length = 8; ++ var->transp.length = 8; ++ break; ++ default: ++ ret = -EINVAL; ++ break; ++ } ++ ++ /* ++ * >= 16bpp displays have separate colour component bitfields ++ * encoded in the pixel data. Calculate their position from ++ * the bitfield length defined above. ++ */ ++ if (ret == 0 && var->bits_per_pixel >= 24 && fbswap) { ++ var->blue.offset = 0; ++ var->green.offset = var->blue.offset + var->blue.length; ++ var->red.offset = var->green.offset + var->green.length; ++ var->transp.offset = var->red.offset + var->red.length; ++ } else if (ret == 0 && var->bits_per_pixel >= 24) { ++ var->red.offset = 0; ++ var->green.offset = var->red.offset + var->red.length; ++ var->blue.offset = var->green.offset + var->green.length; ++ var->transp.offset = var->blue.offset + var->blue.length; ++ } else if (ret == 0 && var->bits_per_pixel >= 16) { ++ var->blue.offset = 0; ++ var->green.offset = var->blue.offset + var->blue.length; ++ var->red.offset = var->green.offset + var->green.length; ++ var->transp.offset = var->red.offset + var->red.length; ++ } ++ ++ return ret; ++} ++ ++static int bcm2708_fb_check_var(struct fb_var_screeninfo *var, ++ struct fb_info *info) ++{ ++ /* info input, var output */ ++ print_debug("bcm2708_fb_check_var info(%p) %dx%d (%dx%d), %d, %d\n", info, ++ info->var.xres, info->var.yres, info->var.xres_virtual, ++ info->var.yres_virtual, (int)info->screen_size, ++ info->var.bits_per_pixel); ++ print_debug("bcm2708_fb_check_var var(%p) %dx%d (%dx%d), %d\n", var, ++ var->xres, var->yres, var->xres_virtual, var->yres_virtual, ++ var->bits_per_pixel); ++ ++ if (!var->bits_per_pixel) ++ var->bits_per_pixel = 16; ++ ++ if (bcm2708_fb_set_bitfields(var) != 0) { ++ pr_err("bcm2708_fb_check_var: invalid bits_per_pixel %d\n", ++ var->bits_per_pixel); ++ return -EINVAL; ++ } ++ ++ ++ if (var->xres_virtual < var->xres) ++ var->xres_virtual = var->xres; ++ /* use highest possible virtual resolution */ ++ if (var->yres_virtual == -1) { ++ var->yres_virtual = 480; ++ ++ pr_err ++ ("bcm2708_fb_check_var: virtual resolution set to maximum of %dx%d\n", ++ var->xres_virtual, var->yres_virtual); ++ } ++ if (var->yres_virtual < var->yres) ++ var->yres_virtual = var->yres; ++ ++ if (var->xoffset < 0) ++ var->xoffset = 0; ++ if (var->yoffset < 0) ++ var->yoffset = 0; ++ ++ /* truncate xoffset and yoffset to maximum if too high */ ++ if (var->xoffset > var->xres_virtual - var->xres) ++ var->xoffset = var->xres_virtual - var->xres - 1; ++ if (var->yoffset > var->yres_virtual - var->yres) ++ var->yoffset = var->yres_virtual - var->yres - 1; ++ ++ return 0; ++} ++ ++static int bcm2708_fb_set_par(struct fb_info *info) ++{ ++ struct bcm2708_fb *fb = to_bcm2708(info); ++ struct fb_alloc_tags fbinfo = { ++ .tag1 = { RPI_FIRMWARE_FRAMEBUFFER_SET_PHYSICAL_WIDTH_HEIGHT, ++ 8, 0, }, ++ .xres = info->var.xres, ++ .yres = info->var.yres, ++ .tag2 = { RPI_FIRMWARE_FRAMEBUFFER_SET_VIRTUAL_WIDTH_HEIGHT, ++ 8, 0, }, ++ .xres_virtual = info->var.xres_virtual, ++ .yres_virtual = info->var.yres_virtual, ++ .tag3 = { RPI_FIRMWARE_FRAMEBUFFER_SET_DEPTH, 4, 0 }, ++ .bpp = info->var.bits_per_pixel, ++ .tag4 = { RPI_FIRMWARE_FRAMEBUFFER_SET_VIRTUAL_OFFSET, 8, 0 }, ++ .xoffset = info->var.xoffset, ++ .yoffset = info->var.yoffset, ++ .tag5 = { RPI_FIRMWARE_FRAMEBUFFER_ALLOCATE, 8, 0 }, ++ .base = 0, ++ .screen_size = 0, ++ .tag6 = { RPI_FIRMWARE_FRAMEBUFFER_GET_PITCH, 4, 0 }, ++ .pitch = 0, ++ }; ++ int ret; ++ ++ print_debug("bcm2708_fb_set_par info(%p) %dx%d (%dx%d), %d, %d\n", info, ++ info->var.xres, info->var.yres, info->var.xres_virtual, ++ info->var.yres_virtual, (int)info->screen_size, ++ info->var.bits_per_pixel); ++ ++ ret = rpi_firmware_property_list(fb->fw, &fbinfo, sizeof(fbinfo)); ++ if (ret) { ++ dev_err(info->device, ++ "Failed to allocate GPU framebuffer (%d)\n", ret); ++ return ret; ++ } ++ ++ if (info->var.bits_per_pixel <= 8) ++ fb->fb.fix.visual = FB_VISUAL_PSEUDOCOLOR; ++ else ++ fb->fb.fix.visual = FB_VISUAL_TRUECOLOR; ++ ++ fb->fb.fix.line_length = fbinfo.pitch; ++ fbinfo.base |= 0x40000000; ++ fb->fb_bus_address = fbinfo.base; ++ fbinfo.base &= ~0xc0000000; ++ fb->fb.fix.smem_start = fbinfo.base; ++ fb->fb.fix.smem_len = fbinfo.pitch * fbinfo.yres_virtual; ++ fb->fb.screen_size = fbinfo.screen_size; ++ if (fb->fb.screen_base) ++ iounmap(fb->fb.screen_base); ++ fb->fb.screen_base = ioremap_wc(fbinfo.base, fb->fb.screen_size); ++ if (!fb->fb.screen_base) { ++ /* the console may currently be locked */ ++ console_trylock(); ++ console_unlock(); ++ dev_err(info->device, "Failed to set screen_base\n"); ++ return -ENOMEM; ++ } ++ ++ print_debug ++ ("BCM2708FB: start = %p,%p width=%d, height=%d, bpp=%d, pitch=%d size=%d\n", ++ (void *)fb->fb.screen_base, (void *)fb->fb_bus_address, ++ fbinfo.xres, fbinfo.yres, fbinfo.bpp, ++ fbinfo.pitch, (int)fb->fb.screen_size); ++ ++ return 0; ++} ++ ++static inline u32 convert_bitfield(int val, struct fb_bitfield *bf) ++{ ++ unsigned int mask = (1 << bf->length) - 1; ++ ++ return (val >> (16 - bf->length) & mask) << bf->offset; ++} ++ ++ ++static int bcm2708_fb_setcolreg(unsigned int regno, unsigned int red, ++ unsigned int green, unsigned int blue, ++ unsigned int transp, struct fb_info *info) ++{ ++ struct bcm2708_fb *fb = to_bcm2708(info); ++ ++ /*print_debug("BCM2708FB: setcolreg %d:(%02x,%02x,%02x,%02x) %x\n", regno, red, green, blue, transp, fb->fb.fix.visual);*/ ++ if (fb->fb.var.bits_per_pixel <= 8) { ++ if (regno < 256) { ++ /* blue [23:16], green [15:8], red [7:0] */ ++ fb->gpu_cmap[regno] = ((red >> 8) & 0xff) << 0 | ++ ((green >> 8) & 0xff) << 8 | ++ ((blue >> 8) & 0xff) << 16; ++ } ++ /* Hack: we need to tell GPU the palette has changed, but currently bcm2708_fb_set_par takes noticable time when called for every (256) colour */ ++ /* So just call it for what looks like the last colour in a list for now. */ ++ if (regno == 15 || regno == 255) { ++ struct packet { ++ u32 offset; ++ u32 length; ++ u32 cmap[256]; ++ } *packet; ++ int ret; ++ ++ packet = kmalloc(sizeof(*packet), GFP_KERNEL); ++ if (!packet) ++ return -ENOMEM; ++ packet->offset = 0; ++ packet->length = regno + 1; ++ memcpy(packet->cmap, fb->gpu_cmap, sizeof(packet->cmap)); ++ ret = rpi_firmware_property(fb->fw, RPI_FIRMWARE_FRAMEBUFFER_SET_PALETTE, ++ packet, (2 + packet->length) * sizeof(u32)); ++ if (ret || packet->offset) ++ dev_err(info->device, "Failed to set palette (%d,%u)\n", ++ ret, packet->offset); ++ kfree(packet); ++ } ++ } else if (regno < 16) { ++ fb->cmap[regno] = convert_bitfield(transp, &fb->fb.var.transp) | ++ convert_bitfield(blue, &fb->fb.var.blue) | ++ convert_bitfield(green, &fb->fb.var.green) | ++ convert_bitfield(red, &fb->fb.var.red); ++ } ++ return regno > 255; ++} ++ ++static int bcm2708_fb_blank(int blank_mode, struct fb_info *info) ++{ ++ struct bcm2708_fb *fb = to_bcm2708(info); ++ u32 value; ++ int ret; ++ ++ switch (blank_mode) { ++ case FB_BLANK_UNBLANK: ++ value = 0; ++ break; ++ case FB_BLANK_NORMAL: ++ case FB_BLANK_VSYNC_SUSPEND: ++ case FB_BLANK_HSYNC_SUSPEND: ++ case FB_BLANK_POWERDOWN: ++ value = 1; ++ break; ++ default: ++ return -EINVAL; ++ } ++ ++ ret = rpi_firmware_property(fb->fw, RPI_FIRMWARE_FRAMEBUFFER_BLANK, ++ &value, sizeof(value)); ++ if (ret) ++ dev_err(info->device, "bcm2708_fb_blank(%d) failed: %d\n", ++ blank_mode, ret); ++ ++ return ret; ++} ++ ++static int bcm2708_fb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info) ++{ ++ s32 result; ++ info->var.xoffset = var->xoffset; ++ info->var.yoffset = var->yoffset; ++ result = bcm2708_fb_set_par(info); ++ if (result != 0) ++ pr_err("bcm2708_fb_pan_display(%d,%d) returns=%d\n", var->xoffset, var->yoffset, result); ++ return result; ++} ++ ++static int bcm2708_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg) ++{ ++ struct bcm2708_fb *fb = to_bcm2708(info); ++ u32 dummy = 0; ++ int ret; ++ ++ switch (cmd) { ++ case FBIO_WAITFORVSYNC: ++ ret = rpi_firmware_property(fb->fw, ++ RPI_FIRMWARE_FRAMEBUFFER_SET_VSYNC, ++ &dummy, sizeof(dummy)); ++ break; ++ default: ++ dev_dbg(info->device, "Unknown ioctl 0x%x\n", cmd); ++ return -ENOTTY; ++ } ++ ++ if (ret) ++ dev_err(info->device, "ioctl 0x%x failed (%d)\n", cmd, ret); ++ ++ return ret; ++} ++static void bcm2708_fb_fillrect(struct fb_info *info, ++ const struct fb_fillrect *rect) ++{ ++ /* (is called) print_debug("bcm2708_fb_fillrect\n"); */ ++ cfb_fillrect(info, rect); ++} ++ ++/* A helper function for configuring dma control block */ ++static void set_dma_cb(struct bcm2708_dma_cb *cb, ++ int burst_size, ++ dma_addr_t dst, ++ int dst_stride, ++ dma_addr_t src, ++ int src_stride, ++ int w, ++ int h) ++{ ++ cb->info = BCM2708_DMA_BURST(burst_size) | BCM2708_DMA_S_WIDTH | ++ BCM2708_DMA_S_INC | BCM2708_DMA_D_WIDTH | ++ BCM2708_DMA_D_INC | BCM2708_DMA_TDMODE; ++ cb->dst = dst; ++ cb->src = src; ++ /* ++ * This is not really obvious from the DMA documentation, ++ * but the top 16 bits must be programmmed to "height -1" ++ * and not "height" in 2D mode. ++ */ ++ cb->length = ((h - 1) << 16) | w; ++ cb->stride = ((dst_stride - w) << 16) | (u16)(src_stride - w); ++ cb->pad[0] = 0; ++ cb->pad[1] = 0; ++} ++ ++static void bcm2708_fb_copyarea(struct fb_info *info, ++ const struct fb_copyarea *region) ++{ ++ struct bcm2708_fb *fb = to_bcm2708(info); ++ struct bcm2708_dma_cb *cb = fb->cb_base; ++ int bytes_per_pixel = (info->var.bits_per_pixel + 7) >> 3; ++ /* Channel 0 supports larger bursts and is a bit faster */ ++ int burst_size = (fb->dma_chan == 0) ? 8 : 2; ++ int pixels = region->width * region->height; ++ ++ /* Fallback to cfb_copyarea() if we don't like something */ ++ if (in_atomic() || ++ bytes_per_pixel > 4 || ++ info->var.xres * info->var.yres > 1920 * 1200 || ++ region->width <= 0 || region->width > info->var.xres || ++ region->height <= 0 || region->height > info->var.yres || ++ region->sx < 0 || region->sx >= info->var.xres || ++ region->sy < 0 || region->sy >= info->var.yres || ++ region->dx < 0 || region->dx >= info->var.xres || ++ region->dy < 0 || region->dy >= info->var.yres || ++ region->sx + region->width > info->var.xres || ++ region->dx + region->width > info->var.xres || ++ region->sy + region->height > info->var.yres || ++ region->dy + region->height > info->var.yres) { ++ cfb_copyarea(info, region); ++ return; ++ } ++ ++ if (region->dy == region->sy && region->dx > region->sx) { ++ /* ++ * A difficult case of overlapped copy. Because DMA can't ++ * copy individual scanlines in backwards direction, we need ++ * two-pass processing. We do it by programming a chain of dma ++ * control blocks in the first 16K part of the buffer and use ++ * the remaining 48K as the intermediate temporary scratch ++ * buffer. The buffer size is sufficient to handle up to ++ * 1920x1200 resolution at 32bpp pixel depth. ++ */ ++ int y; ++ dma_addr_t control_block_pa = fb->cb_handle; ++ dma_addr_t scratchbuf = fb->cb_handle + 16 * 1024; ++ int scanline_size = bytes_per_pixel * region->width; ++ int scanlines_per_cb = (64 * 1024 - 16 * 1024) / scanline_size; ++ ++ for (y = 0; y < region->height; y += scanlines_per_cb) { ++ dma_addr_t src = ++ fb->fb_bus_address + ++ bytes_per_pixel * region->sx + ++ (region->sy + y) * fb->fb.fix.line_length; ++ dma_addr_t dst = ++ fb->fb_bus_address + ++ bytes_per_pixel * region->dx + ++ (region->dy + y) * fb->fb.fix.line_length; ++ ++ if (region->height - y < scanlines_per_cb) ++ scanlines_per_cb = region->height - y; ++ ++ set_dma_cb(cb, burst_size, scratchbuf, scanline_size, ++ src, fb->fb.fix.line_length, ++ scanline_size, scanlines_per_cb); ++ control_block_pa += sizeof(struct bcm2708_dma_cb); ++ cb->next = control_block_pa; ++ cb++; ++ ++ set_dma_cb(cb, burst_size, dst, fb->fb.fix.line_length, ++ scratchbuf, scanline_size, ++ scanline_size, scanlines_per_cb); ++ control_block_pa += sizeof(struct bcm2708_dma_cb); ++ cb->next = control_block_pa; ++ cb++; ++ } ++ /* move the pointer back to the last dma control block */ ++ cb--; ++ } else { ++ /* A single dma control block is enough. */ ++ int sy, dy, stride; ++ if (region->dy <= region->sy) { ++ /* processing from top to bottom */ ++ dy = region->dy; ++ sy = region->sy; ++ stride = fb->fb.fix.line_length; ++ } else { ++ /* processing from bottom to top */ ++ dy = region->dy + region->height - 1; ++ sy = region->sy + region->height - 1; ++ stride = -fb->fb.fix.line_length; ++ } ++ set_dma_cb(cb, burst_size, ++ fb->fb_bus_address + dy * fb->fb.fix.line_length + ++ bytes_per_pixel * region->dx, ++ stride, ++ fb->fb_bus_address + sy * fb->fb.fix.line_length + ++ bytes_per_pixel * region->sx, ++ stride, ++ region->width * bytes_per_pixel, ++ region->height); ++ } ++ ++ /* end of dma control blocks chain */ ++ cb->next = 0; ++ ++ ++ if (pixels < dma_busy_wait_threshold) { ++ bcm_dma_start(fb->dma_chan_base, fb->cb_handle); ++ bcm_dma_wait_idle(fb->dma_chan_base); ++ } else { ++ void __iomem *dma_chan = fb->dma_chan_base; ++ cb->info |= BCM2708_DMA_INT_EN; ++ bcm_dma_start(fb->dma_chan_base, fb->cb_handle); ++ while (bcm_dma_is_busy(dma_chan)) { ++ wait_event_interruptible( ++ fb->dma_waitq, ++ !bcm_dma_is_busy(dma_chan)); ++ } ++ fb->stats.dma_irqs++; ++ } ++ fb->stats.dma_copies++; ++} ++ ++static void bcm2708_fb_imageblit(struct fb_info *info, ++ const struct fb_image *image) ++{ ++ /* (is called) print_debug("bcm2708_fb_imageblit\n"); */ ++ cfb_imageblit(info, image); ++} ++ ++static irqreturn_t bcm2708_fb_dma_irq(int irq, void *cxt) ++{ ++ struct bcm2708_fb *fb = cxt; ++ ++ /* FIXME: should read status register to check if this is ++ * actually interrupting us or not, in case this interrupt ++ * ever becomes shared amongst several DMA channels ++ * ++ * readl(dma_chan_base + BCM2708_DMA_CS) & BCM2708_DMA_IRQ; ++ */ ++ ++ /* acknowledge the interrupt */ ++ writel(BCM2708_DMA_INT, fb->dma_chan_base + BCM2708_DMA_CS); ++ ++ wake_up(&fb->dma_waitq); ++ return IRQ_HANDLED; ++} ++ ++static struct fb_ops bcm2708_fb_ops = { ++ .owner = THIS_MODULE, ++ .fb_check_var = bcm2708_fb_check_var, ++ .fb_set_par = bcm2708_fb_set_par, ++ .fb_setcolreg = bcm2708_fb_setcolreg, ++ .fb_blank = bcm2708_fb_blank, ++ .fb_fillrect = bcm2708_fb_fillrect, ++ .fb_copyarea = bcm2708_fb_copyarea, ++ .fb_imageblit = bcm2708_fb_imageblit, ++ .fb_pan_display = bcm2708_fb_pan_display, ++ .fb_ioctl = bcm2708_ioctl, ++}; ++ ++static int bcm2708_fb_register(struct bcm2708_fb *fb) ++{ ++ int ret; ++ ++ fb->fb.fbops = &bcm2708_fb_ops; ++ fb->fb.flags = FBINFO_FLAG_DEFAULT | FBINFO_HWACCEL_COPYAREA; ++ fb->fb.pseudo_palette = fb->cmap; ++ ++ strncpy(fb->fb.fix.id, bcm2708_name, sizeof(fb->fb.fix.id)); ++ fb->fb.fix.type = FB_TYPE_PACKED_PIXELS; ++ fb->fb.fix.type_aux = 0; ++ fb->fb.fix.xpanstep = 1; ++ fb->fb.fix.ypanstep = 1; ++ fb->fb.fix.ywrapstep = 0; ++ fb->fb.fix.accel = FB_ACCEL_NONE; ++ ++ fb->fb.var.xres = fbwidth; ++ fb->fb.var.yres = fbheight; ++ fb->fb.var.xres_virtual = fbwidth; ++ fb->fb.var.yres_virtual = fbheight; ++ fb->fb.var.bits_per_pixel = fbdepth; ++ fb->fb.var.vmode = FB_VMODE_NONINTERLACED; ++ fb->fb.var.activate = FB_ACTIVATE_NOW; ++ fb->fb.var.nonstd = 0; ++ fb->fb.var.height = -1; /* height of picture in mm */ ++ fb->fb.var.width = -1; /* width of picture in mm */ ++ fb->fb.var.accel_flags = 0; ++ ++ fb->fb.monspecs.hfmin = 0; ++ fb->fb.monspecs.hfmax = 100000; ++ fb->fb.monspecs.vfmin = 0; ++ fb->fb.monspecs.vfmax = 400; ++ fb->fb.monspecs.dclkmin = 1000000; ++ fb->fb.monspecs.dclkmax = 100000000; ++ ++ bcm2708_fb_set_bitfields(&fb->fb.var); ++ init_waitqueue_head(&fb->dma_waitq); ++ ++ /* ++ * Allocate colourmap. ++ */ ++ ++ fb_set_var(&fb->fb, &fb->fb.var); ++ ret = bcm2708_fb_set_par(&fb->fb); ++ if (ret) ++ return ret; ++ ++ print_debug("BCM2708FB: registering framebuffer (%dx%d@%d) (%d)\n", fbwidth, ++ fbheight, fbdepth, fbswap); ++ ++ ret = register_framebuffer(&fb->fb); ++ print_debug("BCM2708FB: register framebuffer (%d)\n", ret); ++ if (ret == 0) ++ goto out; ++ ++ print_debug("BCM2708FB: cannot register framebuffer (%d)\n", ret); ++out: ++ return ret; ++} ++ ++static int bcm2708_fb_probe(struct platform_device *dev) ++{ ++ struct device_node *fw_np; ++ struct rpi_firmware *fw; ++ struct bcm2708_fb *fb; ++ int ret; ++ ++ fw_np = of_parse_phandle(dev->dev.of_node, "firmware", 0); ++/* Remove comment when booting without Device Tree is no longer supported ++ if (!fw_np) { ++ dev_err(&dev->dev, "Missing firmware node\n"); ++ return -ENOENT; ++ } ++*/ ++ fw = rpi_firmware_get(fw_np); ++ if (!fw) ++ return -EPROBE_DEFER; ++ ++ fb = kzalloc(sizeof(struct bcm2708_fb), GFP_KERNEL); ++ if (!fb) { ++ dev_err(&dev->dev, ++ "could not allocate new bcm2708_fb struct\n"); ++ ret = -ENOMEM; ++ goto free_region; ++ } ++ ++ fb->fw = fw; ++ bcm2708_fb_debugfs_init(fb); ++ ++ fb->cb_base = dma_alloc_writecombine(&dev->dev, SZ_64K, ++ &fb->cb_handle, GFP_KERNEL); ++ if (!fb->cb_base) { ++ dev_err(&dev->dev, "cannot allocate DMA CBs\n"); ++ ret = -ENOMEM; ++ goto free_fb; ++ } ++ ++ pr_info("BCM2708FB: allocated DMA memory %08x\n", ++ fb->cb_handle); ++ ++ ret = bcm_dma_chan_alloc(BCM_DMA_FEATURE_BULK, ++ &fb->dma_chan_base, &fb->dma_irq); ++ if (ret < 0) { ++ dev_err(&dev->dev, "couldn't allocate a DMA channel\n"); ++ goto free_cb; ++ } ++ fb->dma_chan = ret; ++ ++ ret = request_irq(fb->dma_irq, bcm2708_fb_dma_irq, ++ 0, "bcm2708_fb dma", fb); ++ if (ret) { ++ pr_err("%s: failed to request DMA irq\n", __func__); ++ goto free_dma_chan; ++ } ++ ++ ++ pr_info("BCM2708FB: allocated DMA channel %d @ %p\n", ++ fb->dma_chan, fb->dma_chan_base); ++ ++ fb->dev = dev; ++ fb->fb.device = &dev->dev; ++ ++ ret = bcm2708_fb_register(fb); ++ if (ret == 0) { ++ platform_set_drvdata(dev, fb); ++ goto out; ++ } ++ ++free_dma_chan: ++ bcm_dma_chan_free(fb->dma_chan); ++free_cb: ++ dma_free_writecombine(&dev->dev, SZ_64K, fb->cb_base, fb->cb_handle); ++free_fb: ++ kfree(fb); ++free_region: ++ dev_err(&dev->dev, "probe failed, err %d\n", ret); ++out: ++ return ret; ++} ++ ++static int bcm2708_fb_remove(struct platform_device *dev) ++{ ++ struct bcm2708_fb *fb = platform_get_drvdata(dev); ++ ++ platform_set_drvdata(dev, NULL); ++ ++ if (fb->fb.screen_base) ++ iounmap(fb->fb.screen_base); ++ unregister_framebuffer(&fb->fb); ++ ++ dma_free_writecombine(&dev->dev, SZ_64K, fb->cb_base, fb->cb_handle); ++ bcm_dma_chan_free(fb->dma_chan); ++ ++ bcm2708_fb_debugfs_deinit(fb); ++ ++ free_irq(fb->dma_irq, fb); ++ ++ kfree(fb); ++ ++ return 0; ++} ++ ++static const struct of_device_id bcm2708_fb_of_match_table[] = { ++ { .compatible = "brcm,bcm2708-fb", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, bcm2708_fb_of_match_table); ++ ++static struct platform_driver bcm2708_fb_driver = { ++ .probe = bcm2708_fb_probe, ++ .remove = bcm2708_fb_remove, ++ .driver = { ++ .name = DRIVER_NAME, ++ .owner = THIS_MODULE, ++ .of_match_table = bcm2708_fb_of_match_table, ++ }, ++}; ++ ++static int __init bcm2708_fb_init(void) ++{ ++ return platform_driver_register(&bcm2708_fb_driver); ++} ++ ++module_init(bcm2708_fb_init); ++ ++static void __exit bcm2708_fb_exit(void) ++{ ++ platform_driver_unregister(&bcm2708_fb_driver); ++} ++ ++module_exit(bcm2708_fb_exit); ++ ++module_param(fbwidth, int, 0644); ++module_param(fbheight, int, 0644); ++module_param(fbdepth, int, 0644); ++module_param(fbswap, int, 0644); ++ ++MODULE_DESCRIPTION("BCM2708 framebuffer driver"); ++MODULE_LICENSE("GPL"); ++ ++MODULE_PARM_DESC(fbwidth, "Width of ARM Framebuffer"); ++MODULE_PARM_DESC(fbheight, "Height of ARM Framebuffer"); ++MODULE_PARM_DESC(fbdepth, "Bit depth of ARM Framebuffer"); ++MODULE_PARM_DESC(fbswap, "Swap order of red and blue in 24 and 32 bit modes"); +diff --git a/drivers/video/logo/logo_linux_clut224.ppm b/drivers/video/logo/logo_linux_clut224.ppm +index 3c14e43..7626beb 100644 +--- a/drivers/video/logo/logo_linux_clut224.ppm ++++ b/drivers/video/logo/logo_linux_clut224.ppm +@@ -1,1604 +1,883 @@ + P3 +-# Standard 224-color Linux logo +-80 80 ++63 80 + 255 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 6 6 6 6 6 6 10 10 10 10 10 10 +- 10 10 10 6 6 6 6 6 6 6 6 6 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 6 6 6 10 10 10 14 14 14 +- 22 22 22 26 26 26 30 30 30 34 34 34 +- 30 30 30 30 30 30 26 26 26 18 18 18 +- 14 14 14 10 10 10 6 6 6 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 1 0 0 1 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 6 6 6 14 14 14 26 26 26 42 42 42 +- 54 54 54 66 66 66 78 78 78 78 78 78 +- 78 78 78 74 74 74 66 66 66 54 54 54 +- 42 42 42 26 26 26 18 18 18 10 10 10 +- 6 6 6 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 1 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 10 10 10 +- 22 22 22 42 42 42 66 66 66 86 86 86 +- 66 66 66 38 38 38 38 38 38 22 22 22 +- 26 26 26 34 34 34 54 54 54 66 66 66 +- 86 86 86 70 70 70 46 46 46 26 26 26 +- 14 14 14 6 6 6 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 1 0 0 1 0 0 1 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 10 10 10 26 26 26 +- 50 50 50 82 82 82 58 58 58 6 6 6 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 6 6 6 54 54 54 86 86 86 66 66 66 +- 38 38 38 18 18 18 6 6 6 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 6 6 6 22 22 22 50 50 50 +- 78 78 78 34 34 34 2 2 6 2 2 6 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 2 2 6 2 2 6 6 6 6 70 70 70 +- 78 78 78 46 46 46 22 22 22 6 6 6 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 1 0 0 1 0 0 1 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 6 6 6 18 18 18 42 42 42 82 82 82 +- 26 26 26 2 2 6 2 2 6 2 2 6 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 2 2 6 2 2 6 2 2 6 14 14 14 +- 46 46 46 34 34 34 6 6 6 2 2 6 +- 42 42 42 78 78 78 42 42 42 18 18 18 +- 6 6 6 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 1 0 0 0 0 0 1 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 10 10 10 30 30 30 66 66 66 58 58 58 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 2 2 6 2 2 6 2 2 6 26 26 26 +- 86 86 86 101 101 101 46 46 46 10 10 10 +- 2 2 6 58 58 58 70 70 70 34 34 34 +- 10 10 10 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 1 0 0 1 0 0 1 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 14 14 14 42 42 42 86 86 86 10 10 10 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 2 2 6 2 2 6 2 2 6 30 30 30 +- 94 94 94 94 94 94 58 58 58 26 26 26 +- 2 2 6 6 6 6 78 78 78 54 54 54 +- 22 22 22 6 6 6 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 6 6 6 +- 22 22 22 62 62 62 62 62 62 2 2 6 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 2 2 6 2 2 6 2 2 6 26 26 26 +- 54 54 54 38 38 38 18 18 18 10 10 10 +- 2 2 6 2 2 6 34 34 34 82 82 82 +- 38 38 38 14 14 14 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 1 0 0 1 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 6 6 6 +- 30 30 30 78 78 78 30 30 30 2 2 6 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 2 2 6 2 2 6 2 2 6 10 10 10 +- 10 10 10 2 2 6 2 2 6 2 2 6 +- 2 2 6 2 2 6 2 2 6 78 78 78 +- 50 50 50 18 18 18 6 6 6 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 1 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 10 10 10 +- 38 38 38 86 86 86 14 14 14 2 2 6 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 2 2 6 2 2 6 2 2 6 54 54 54 +- 66 66 66 26 26 26 6 6 6 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 1 0 0 1 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 14 14 14 +- 42 42 42 82 82 82 2 2 6 2 2 6 +- 2 2 6 6 6 6 10 10 10 2 2 6 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 2 2 6 2 2 6 2 2 6 6 6 6 +- 14 14 14 10 10 10 2 2 6 2 2 6 +- 2 2 6 2 2 6 2 2 6 18 18 18 +- 82 82 82 34 34 34 10 10 10 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 1 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 14 14 14 +- 46 46 46 86 86 86 2 2 6 2 2 6 +- 6 6 6 6 6 6 22 22 22 34 34 34 +- 6 6 6 2 2 6 2 2 6 2 2 6 +- 2 2 6 2 2 6 18 18 18 34 34 34 +- 10 10 10 50 50 50 22 22 22 2 2 6 +- 2 2 6 2 2 6 2 2 6 10 10 10 +- 86 86 86 42 42 42 14 14 14 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 1 0 0 1 0 0 1 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 14 14 14 +- 46 46 46 86 86 86 2 2 6 2 2 6 +- 38 38 38 116 116 116 94 94 94 22 22 22 +- 22 22 22 2 2 6 2 2 6 2 2 6 +- 14 14 14 86 86 86 138 138 138 162 162 162 +-154 154 154 38 38 38 26 26 26 6 6 6 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 86 86 86 46 46 46 14 14 14 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 14 14 14 +- 46 46 46 86 86 86 2 2 6 14 14 14 +-134 134 134 198 198 198 195 195 195 116 116 116 +- 10 10 10 2 2 6 2 2 6 6 6 6 +-101 98 89 187 187 187 210 210 210 218 218 218 +-214 214 214 134 134 134 14 14 14 6 6 6 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 86 86 86 50 50 50 18 18 18 6 6 6 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 1 0 0 0 +- 0 0 1 0 0 1 0 0 1 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 14 14 14 +- 46 46 46 86 86 86 2 2 6 54 54 54 +-218 218 218 195 195 195 226 226 226 246 246 246 +- 58 58 58 2 2 6 2 2 6 30 30 30 +-210 210 210 253 253 253 174 174 174 123 123 123 +-221 221 221 234 234 234 74 74 74 2 2 6 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 70 70 70 58 58 58 22 22 22 6 6 6 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 14 14 14 +- 46 46 46 82 82 82 2 2 6 106 106 106 +-170 170 170 26 26 26 86 86 86 226 226 226 +-123 123 123 10 10 10 14 14 14 46 46 46 +-231 231 231 190 190 190 6 6 6 70 70 70 +- 90 90 90 238 238 238 158 158 158 2 2 6 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 70 70 70 58 58 58 22 22 22 6 6 6 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 1 0 0 0 +- 0 0 1 0 0 1 0 0 1 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 14 14 14 +- 42 42 42 86 86 86 6 6 6 116 116 116 +-106 106 106 6 6 6 70 70 70 149 149 149 +-128 128 128 18 18 18 38 38 38 54 54 54 +-221 221 221 106 106 106 2 2 6 14 14 14 +- 46 46 46 190 190 190 198 198 198 2 2 6 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 74 74 74 62 62 62 22 22 22 6 6 6 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 1 0 0 0 +- 0 0 1 0 0 0 0 0 1 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 14 14 14 +- 42 42 42 94 94 94 14 14 14 101 101 101 +-128 128 128 2 2 6 18 18 18 116 116 116 +-118 98 46 121 92 8 121 92 8 98 78 10 +-162 162 162 106 106 106 2 2 6 2 2 6 +- 2 2 6 195 195 195 195 195 195 6 6 6 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 74 74 74 62 62 62 22 22 22 6 6 6 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 1 0 0 1 +- 0 0 1 0 0 0 0 0 1 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 10 10 10 +- 38 38 38 90 90 90 14 14 14 58 58 58 +-210 210 210 26 26 26 54 38 6 154 114 10 +-226 170 11 236 186 11 225 175 15 184 144 12 +-215 174 15 175 146 61 37 26 9 2 2 6 +- 70 70 70 246 246 246 138 138 138 2 2 6 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 70 70 70 66 66 66 26 26 26 6 6 6 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 10 10 10 +- 38 38 38 86 86 86 14 14 14 10 10 10 +-195 195 195 188 164 115 192 133 9 225 175 15 +-239 182 13 234 190 10 232 195 16 232 200 30 +-245 207 45 241 208 19 232 195 16 184 144 12 +-218 194 134 211 206 186 42 42 42 2 2 6 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 50 50 50 74 74 74 30 30 30 6 6 6 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 10 10 10 +- 34 34 34 86 86 86 14 14 14 2 2 6 +-121 87 25 192 133 9 219 162 10 239 182 13 +-236 186 11 232 195 16 241 208 19 244 214 54 +-246 218 60 246 218 38 246 215 20 241 208 19 +-241 208 19 226 184 13 121 87 25 2 2 6 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 50 50 50 82 82 82 34 34 34 10 10 10 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 10 10 10 +- 34 34 34 82 82 82 30 30 30 61 42 6 +-180 123 7 206 145 10 230 174 11 239 182 13 +-234 190 10 238 202 15 241 208 19 246 218 74 +-246 218 38 246 215 20 246 215 20 246 215 20 +-226 184 13 215 174 15 184 144 12 6 6 6 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 26 26 26 94 94 94 42 42 42 14 14 14 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 10 10 10 +- 30 30 30 78 78 78 50 50 50 104 69 6 +-192 133 9 216 158 10 236 178 12 236 186 11 +-232 195 16 241 208 19 244 214 54 245 215 43 +-246 215 20 246 215 20 241 208 19 198 155 10 +-200 144 11 216 158 10 156 118 10 2 2 6 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 6 6 6 90 90 90 54 54 54 18 18 18 +- 6 6 6 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 10 10 10 +- 30 30 30 78 78 78 46 46 46 22 22 22 +-137 92 6 210 162 10 239 182 13 238 190 10 +-238 202 15 241 208 19 246 215 20 246 215 20 +-241 208 19 203 166 17 185 133 11 210 150 10 +-216 158 10 210 150 10 102 78 10 2 2 6 +- 6 6 6 54 54 54 14 14 14 2 2 6 +- 2 2 6 62 62 62 74 74 74 30 30 30 +- 10 10 10 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 10 10 10 +- 34 34 34 78 78 78 50 50 50 6 6 6 +- 94 70 30 139 102 15 190 146 13 226 184 13 +-232 200 30 232 195 16 215 174 15 190 146 13 +-168 122 10 192 133 9 210 150 10 213 154 11 +-202 150 34 182 157 106 101 98 89 2 2 6 +- 2 2 6 78 78 78 116 116 116 58 58 58 +- 2 2 6 22 22 22 90 90 90 46 46 46 +- 18 18 18 6 6 6 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 10 10 10 +- 38 38 38 86 86 86 50 50 50 6 6 6 +-128 128 128 174 154 114 156 107 11 168 122 10 +-198 155 10 184 144 12 197 138 11 200 144 11 +-206 145 10 206 145 10 197 138 11 188 164 115 +-195 195 195 198 198 198 174 174 174 14 14 14 +- 2 2 6 22 22 22 116 116 116 116 116 116 +- 22 22 22 2 2 6 74 74 74 70 70 70 +- 30 30 30 10 10 10 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 6 6 6 18 18 18 +- 50 50 50 101 101 101 26 26 26 10 10 10 +-138 138 138 190 190 190 174 154 114 156 107 11 +-197 138 11 200 144 11 197 138 11 192 133 9 +-180 123 7 190 142 34 190 178 144 187 187 187 +-202 202 202 221 221 221 214 214 214 66 66 66 +- 2 2 6 2 2 6 50 50 50 62 62 62 +- 6 6 6 2 2 6 10 10 10 90 90 90 +- 50 50 50 18 18 18 6 6 6 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 10 10 10 34 34 34 +- 74 74 74 74 74 74 2 2 6 6 6 6 +-144 144 144 198 198 198 190 190 190 178 166 146 +-154 121 60 156 107 11 156 107 11 168 124 44 +-174 154 114 187 187 187 190 190 190 210 210 210 +-246 246 246 253 253 253 253 253 253 182 182 182 +- 6 6 6 2 2 6 2 2 6 2 2 6 +- 2 2 6 2 2 6 2 2 6 62 62 62 +- 74 74 74 34 34 34 14 14 14 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 10 10 10 22 22 22 54 54 54 +- 94 94 94 18 18 18 2 2 6 46 46 46 +-234 234 234 221 221 221 190 190 190 190 190 190 +-190 190 190 187 187 187 187 187 187 190 190 190 +-190 190 190 195 195 195 214 214 214 242 242 242 +-253 253 253 253 253 253 253 253 253 253 253 253 +- 82 82 82 2 2 6 2 2 6 2 2 6 +- 2 2 6 2 2 6 2 2 6 14 14 14 +- 86 86 86 54 54 54 22 22 22 6 6 6 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 6 6 6 18 18 18 46 46 46 90 90 90 +- 46 46 46 18 18 18 6 6 6 182 182 182 +-253 253 253 246 246 246 206 206 206 190 190 190 +-190 190 190 190 190 190 190 190 190 190 190 190 +-206 206 206 231 231 231 250 250 250 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-202 202 202 14 14 14 2 2 6 2 2 6 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 42 42 42 86 86 86 42 42 42 18 18 18 +- 6 6 6 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 6 6 6 +- 14 14 14 38 38 38 74 74 74 66 66 66 +- 2 2 6 6 6 6 90 90 90 250 250 250 +-253 253 253 253 253 253 238 238 238 198 198 198 +-190 190 190 190 190 190 195 195 195 221 221 221 +-246 246 246 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 82 82 82 2 2 6 2 2 6 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 2 2 6 78 78 78 70 70 70 34 34 34 +- 14 14 14 6 6 6 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 14 14 14 +- 34 34 34 66 66 66 78 78 78 6 6 6 +- 2 2 6 18 18 18 218 218 218 253 253 253 +-253 253 253 253 253 253 253 253 253 246 246 246 +-226 226 226 231 231 231 246 246 246 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 178 178 178 2 2 6 2 2 6 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 2 2 6 18 18 18 90 90 90 62 62 62 +- 30 30 30 10 10 10 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 10 10 10 26 26 26 +- 58 58 58 90 90 90 18 18 18 2 2 6 +- 2 2 6 110 110 110 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-250 250 250 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 231 231 231 18 18 18 2 2 6 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 2 2 6 2 2 6 18 18 18 94 94 94 +- 54 54 54 26 26 26 10 10 10 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 6 6 6 22 22 22 50 50 50 +- 90 90 90 26 26 26 2 2 6 2 2 6 +- 14 14 14 195 195 195 250 250 250 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-250 250 250 242 242 242 54 54 54 2 2 6 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 2 2 6 2 2 6 2 2 6 38 38 38 +- 86 86 86 50 50 50 22 22 22 6 6 6 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 6 6 6 14 14 14 38 38 38 82 82 82 +- 34 34 34 2 2 6 2 2 6 2 2 6 +- 42 42 42 195 195 195 246 246 246 253 253 253 +-253 253 253 253 253 253 253 253 253 250 250 250 +-242 242 242 242 242 242 250 250 250 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 250 250 250 246 246 246 238 238 238 +-226 226 226 231 231 231 101 101 101 6 6 6 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 38 38 38 82 82 82 42 42 42 14 14 14 +- 6 6 6 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 10 10 10 26 26 26 62 62 62 66 66 66 +- 2 2 6 2 2 6 2 2 6 6 6 6 +- 70 70 70 170 170 170 206 206 206 234 234 234 +-246 246 246 250 250 250 250 250 250 238 238 238 +-226 226 226 231 231 231 238 238 238 250 250 250 +-250 250 250 250 250 250 246 246 246 231 231 231 +-214 214 214 206 206 206 202 202 202 202 202 202 +-198 198 198 202 202 202 182 182 182 18 18 18 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 2 2 6 62 62 62 66 66 66 30 30 30 +- 10 10 10 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 14 14 14 42 42 42 82 82 82 18 18 18 +- 2 2 6 2 2 6 2 2 6 10 10 10 +- 94 94 94 182 182 182 218 218 218 242 242 242 +-250 250 250 253 253 253 253 253 253 250 250 250 +-234 234 234 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 246 246 246 +-238 238 238 226 226 226 210 210 210 202 202 202 +-195 195 195 195 195 195 210 210 210 158 158 158 +- 6 6 6 14 14 14 50 50 50 14 14 14 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 2 2 6 6 6 6 86 86 86 46 46 46 +- 18 18 18 6 6 6 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 6 6 6 +- 22 22 22 54 54 54 70 70 70 2 2 6 +- 2 2 6 10 10 10 2 2 6 22 22 22 +-166 166 166 231 231 231 250 250 250 253 253 253 +-253 253 253 253 253 253 253 253 253 250 250 250 +-242 242 242 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 246 246 246 +-231 231 231 206 206 206 198 198 198 226 226 226 +- 94 94 94 2 2 6 6 6 6 38 38 38 +- 30 30 30 2 2 6 2 2 6 2 2 6 +- 2 2 6 2 2 6 62 62 62 66 66 66 +- 26 26 26 10 10 10 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 10 10 10 +- 30 30 30 74 74 74 50 50 50 2 2 6 +- 26 26 26 26 26 26 2 2 6 106 106 106 +-238 238 238 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 246 246 246 218 218 218 202 202 202 +-210 210 210 14 14 14 2 2 6 2 2 6 +- 30 30 30 22 22 22 2 2 6 2 2 6 +- 2 2 6 2 2 6 18 18 18 86 86 86 +- 42 42 42 14 14 14 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 14 14 14 +- 42 42 42 90 90 90 22 22 22 2 2 6 +- 42 42 42 2 2 6 18 18 18 218 218 218 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 250 250 250 221 221 221 +-218 218 218 101 101 101 2 2 6 14 14 14 +- 18 18 18 38 38 38 10 10 10 2 2 6 +- 2 2 6 2 2 6 2 2 6 78 78 78 +- 58 58 58 22 22 22 6 6 6 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 6 6 6 18 18 18 +- 54 54 54 82 82 82 2 2 6 26 26 26 +- 22 22 22 2 2 6 123 123 123 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 250 250 250 +-238 238 238 198 198 198 6 6 6 38 38 38 +- 58 58 58 26 26 26 38 38 38 2 2 6 +- 2 2 6 2 2 6 2 2 6 46 46 46 +- 78 78 78 30 30 30 10 10 10 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 10 10 10 30 30 30 +- 74 74 74 58 58 58 2 2 6 42 42 42 +- 2 2 6 22 22 22 231 231 231 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 250 250 250 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 246 246 246 46 46 46 38 38 38 +- 42 42 42 14 14 14 38 38 38 14 14 14 +- 2 2 6 2 2 6 2 2 6 6 6 6 +- 86 86 86 46 46 46 14 14 14 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 6 6 6 14 14 14 42 42 42 +- 90 90 90 18 18 18 18 18 18 26 26 26 +- 2 2 6 116 116 116 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 250 250 250 238 238 238 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 94 94 94 6 6 6 +- 2 2 6 2 2 6 10 10 10 34 34 34 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 74 74 74 58 58 58 22 22 22 6 6 6 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 10 10 10 26 26 26 66 66 66 +- 82 82 82 2 2 6 38 38 38 6 6 6 +- 14 14 14 210 210 210 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 246 246 246 242 242 242 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 144 144 144 2 2 6 +- 2 2 6 2 2 6 2 2 6 46 46 46 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 42 42 42 74 74 74 30 30 30 10 10 10 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 6 6 6 14 14 14 42 42 42 90 90 90 +- 26 26 26 6 6 6 42 42 42 2 2 6 +- 74 74 74 250 250 250 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 242 242 242 242 242 242 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 182 182 182 2 2 6 +- 2 2 6 2 2 6 2 2 6 46 46 46 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 10 10 10 86 86 86 38 38 38 10 10 10 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 10 10 10 26 26 26 66 66 66 82 82 82 +- 2 2 6 22 22 22 18 18 18 2 2 6 +-149 149 149 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 234 234 234 242 242 242 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 206 206 206 2 2 6 +- 2 2 6 2 2 6 2 2 6 38 38 38 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 6 6 6 86 86 86 46 46 46 14 14 14 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 6 6 6 +- 18 18 18 46 46 46 86 86 86 18 18 18 +- 2 2 6 34 34 34 10 10 10 6 6 6 +-210 210 210 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 234 234 234 242 242 242 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 221 221 221 6 6 6 +- 2 2 6 2 2 6 6 6 6 30 30 30 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 2 2 6 82 82 82 54 54 54 18 18 18 +- 6 6 6 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 10 10 10 +- 26 26 26 66 66 66 62 62 62 2 2 6 +- 2 2 6 38 38 38 10 10 10 26 26 26 +-238 238 238 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 231 231 231 238 238 238 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 231 231 231 6 6 6 +- 2 2 6 2 2 6 10 10 10 30 30 30 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 2 2 6 66 66 66 58 58 58 22 22 22 +- 6 6 6 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 10 10 10 +- 38 38 38 78 78 78 6 6 6 2 2 6 +- 2 2 6 46 46 46 14 14 14 42 42 42 +-246 246 246 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 231 231 231 242 242 242 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 234 234 234 10 10 10 +- 2 2 6 2 2 6 22 22 22 14 14 14 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 2 2 6 66 66 66 62 62 62 22 22 22 +- 6 6 6 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 6 6 6 18 18 18 +- 50 50 50 74 74 74 2 2 6 2 2 6 +- 14 14 14 70 70 70 34 34 34 62 62 62 +-250 250 250 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 231 231 231 246 246 246 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 234 234 234 14 14 14 +- 2 2 6 2 2 6 30 30 30 2 2 6 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 2 2 6 66 66 66 62 62 62 22 22 22 +- 6 6 6 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 6 6 6 18 18 18 +- 54 54 54 62 62 62 2 2 6 2 2 6 +- 2 2 6 30 30 30 46 46 46 70 70 70 +-250 250 250 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 231 231 231 246 246 246 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 226 226 226 10 10 10 +- 2 2 6 6 6 6 30 30 30 2 2 6 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 2 2 6 66 66 66 58 58 58 22 22 22 +- 6 6 6 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 6 6 6 22 22 22 +- 58 58 58 62 62 62 2 2 6 2 2 6 +- 2 2 6 2 2 6 30 30 30 78 78 78 +-250 250 250 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 231 231 231 246 246 246 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 206 206 206 2 2 6 +- 22 22 22 34 34 34 18 14 6 22 22 22 +- 26 26 26 18 18 18 6 6 6 2 2 6 +- 2 2 6 82 82 82 54 54 54 18 18 18 +- 6 6 6 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 6 6 6 26 26 26 +- 62 62 62 106 106 106 74 54 14 185 133 11 +-210 162 10 121 92 8 6 6 6 62 62 62 +-238 238 238 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 231 231 231 246 246 246 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 158 158 158 18 18 18 +- 14 14 14 2 2 6 2 2 6 2 2 6 +- 6 6 6 18 18 18 66 66 66 38 38 38 +- 6 6 6 94 94 94 50 50 50 18 18 18 +- 6 6 6 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 6 6 6 +- 10 10 10 10 10 10 18 18 18 38 38 38 +- 78 78 78 142 134 106 216 158 10 242 186 14 +-246 190 14 246 190 14 156 118 10 10 10 10 +- 90 90 90 238 238 238 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 231 231 231 250 250 250 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 246 230 190 +-238 204 91 238 204 91 181 142 44 37 26 9 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 2 2 6 2 2 6 38 38 38 46 46 46 +- 26 26 26 106 106 106 54 54 54 18 18 18 +- 6 6 6 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 6 6 6 14 14 14 22 22 22 +- 30 30 30 38 38 38 50 50 50 70 70 70 +-106 106 106 190 142 34 226 170 11 242 186 14 +-246 190 14 246 190 14 246 190 14 154 114 10 +- 6 6 6 74 74 74 226 226 226 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 231 231 231 250 250 250 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 228 184 62 +-241 196 14 241 208 19 232 195 16 38 30 10 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 2 2 6 6 6 6 30 30 30 26 26 26 +-203 166 17 154 142 90 66 66 66 26 26 26 +- 6 6 6 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 6 6 6 18 18 18 38 38 38 58 58 58 +- 78 78 78 86 86 86 101 101 101 123 123 123 +-175 146 61 210 150 10 234 174 13 246 186 14 +-246 190 14 246 190 14 246 190 14 238 190 10 +-102 78 10 2 2 6 46 46 46 198 198 198 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 234 234 234 242 242 242 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 224 178 62 +-242 186 14 241 196 14 210 166 10 22 18 6 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 2 2 6 2 2 6 6 6 6 121 92 8 +-238 202 15 232 195 16 82 82 82 34 34 34 +- 10 10 10 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 14 14 14 38 38 38 70 70 70 154 122 46 +-190 142 34 200 144 11 197 138 11 197 138 11 +-213 154 11 226 170 11 242 186 14 246 190 14 +-246 190 14 246 190 14 246 190 14 246 190 14 +-225 175 15 46 32 6 2 2 6 22 22 22 +-158 158 158 250 250 250 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 250 250 250 242 242 242 224 178 62 +-239 182 13 236 186 11 213 154 11 46 32 6 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 2 2 6 2 2 6 61 42 6 225 175 15 +-238 190 10 236 186 11 112 100 78 42 42 42 +- 14 14 14 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 6 6 6 +- 22 22 22 54 54 54 154 122 46 213 154 11 +-226 170 11 230 174 11 226 170 11 226 170 11 +-236 178 12 242 186 14 246 190 14 246 190 14 +-246 190 14 246 190 14 246 190 14 246 190 14 +-241 196 14 184 144 12 10 10 10 2 2 6 +- 6 6 6 116 116 116 242 242 242 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 231 231 231 198 198 198 214 170 54 +-236 178 12 236 178 12 210 150 10 137 92 6 +- 18 14 6 2 2 6 2 2 6 2 2 6 +- 6 6 6 70 47 6 200 144 11 236 178 12 +-239 182 13 239 182 13 124 112 88 58 58 58 +- 22 22 22 6 6 6 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 10 10 10 +- 30 30 30 70 70 70 180 133 36 226 170 11 +-239 182 13 242 186 14 242 186 14 246 186 14 +-246 190 14 246 190 14 246 190 14 246 190 14 +-246 190 14 246 190 14 246 190 14 246 190 14 +-246 190 14 232 195 16 98 70 6 2 2 6 +- 2 2 6 2 2 6 66 66 66 221 221 221 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 206 206 206 198 198 198 214 166 58 +-230 174 11 230 174 11 216 158 10 192 133 9 +-163 110 8 116 81 8 102 78 10 116 81 8 +-167 114 7 197 138 11 226 170 11 239 182 13 +-242 186 14 242 186 14 162 146 94 78 78 78 +- 34 34 34 14 14 14 6 6 6 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 6 6 6 +- 30 30 30 78 78 78 190 142 34 226 170 11 +-239 182 13 246 190 14 246 190 14 246 190 14 +-246 190 14 246 190 14 246 190 14 246 190 14 +-246 190 14 246 190 14 246 190 14 246 190 14 +-246 190 14 241 196 14 203 166 17 22 18 6 +- 2 2 6 2 2 6 2 2 6 38 38 38 +-218 218 218 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-250 250 250 206 206 206 198 198 198 202 162 69 +-226 170 11 236 178 12 224 166 10 210 150 10 +-200 144 11 197 138 11 192 133 9 197 138 11 +-210 150 10 226 170 11 242 186 14 246 190 14 +-246 190 14 246 186 14 225 175 15 124 112 88 +- 62 62 62 30 30 30 14 14 14 6 6 6 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 10 10 10 +- 30 30 30 78 78 78 174 135 50 224 166 10 +-239 182 13 246 190 14 246 190 14 246 190 14 +-246 190 14 246 190 14 246 190 14 246 190 14 +-246 190 14 246 190 14 246 190 14 246 190 14 +-246 190 14 246 190 14 241 196 14 139 102 15 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 78 78 78 250 250 250 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-250 250 250 214 214 214 198 198 198 190 150 46 +-219 162 10 236 178 12 234 174 13 224 166 10 +-216 158 10 213 154 11 213 154 11 216 158 10 +-226 170 11 239 182 13 246 190 14 246 190 14 +-246 190 14 246 190 14 242 186 14 206 162 42 +-101 101 101 58 58 58 30 30 30 14 14 14 +- 6 6 6 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 10 10 10 +- 30 30 30 74 74 74 174 135 50 216 158 10 +-236 178 12 246 190 14 246 190 14 246 190 14 +-246 190 14 246 190 14 246 190 14 246 190 14 +-246 190 14 246 190 14 246 190 14 246 190 14 +-246 190 14 246 190 14 241 196 14 226 184 13 +- 61 42 6 2 2 6 2 2 6 2 2 6 +- 22 22 22 238 238 238 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 226 226 226 187 187 187 180 133 36 +-216 158 10 236 178 12 239 182 13 236 178 12 +-230 174 11 226 170 11 226 170 11 230 174 11 +-236 178 12 242 186 14 246 190 14 246 190 14 +-246 190 14 246 190 14 246 186 14 239 182 13 +-206 162 42 106 106 106 66 66 66 34 34 34 +- 14 14 14 6 6 6 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 6 6 6 +- 26 26 26 70 70 70 163 133 67 213 154 11 +-236 178 12 246 190 14 246 190 14 246 190 14 +-246 190 14 246 190 14 246 190 14 246 190 14 +-246 190 14 246 190 14 246 190 14 246 190 14 +-246 190 14 246 190 14 246 190 14 241 196 14 +-190 146 13 18 14 6 2 2 6 2 2 6 +- 46 46 46 246 246 246 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 221 221 221 86 86 86 156 107 11 +-216 158 10 236 178 12 242 186 14 246 186 14 +-242 186 14 239 182 13 239 182 13 242 186 14 +-242 186 14 246 186 14 246 190 14 246 190 14 +-246 190 14 246 190 14 246 190 14 246 190 14 +-242 186 14 225 175 15 142 122 72 66 66 66 +- 30 30 30 10 10 10 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 6 6 6 +- 26 26 26 70 70 70 163 133 67 210 150 10 +-236 178 12 246 190 14 246 190 14 246 190 14 +-246 190 14 246 190 14 246 190 14 246 190 14 +-246 190 14 246 190 14 246 190 14 246 190 14 +-246 190 14 246 190 14 246 190 14 246 190 14 +-232 195 16 121 92 8 34 34 34 106 106 106 +-221 221 221 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-242 242 242 82 82 82 18 14 6 163 110 8 +-216 158 10 236 178 12 242 186 14 246 190 14 +-246 190 14 246 190 14 246 190 14 246 190 14 +-246 190 14 246 190 14 246 190 14 246 190 14 +-246 190 14 246 190 14 246 190 14 246 190 14 +-246 190 14 246 190 14 242 186 14 163 133 67 +- 46 46 46 18 18 18 6 6 6 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 10 10 10 +- 30 30 30 78 78 78 163 133 67 210 150 10 +-236 178 12 246 186 14 246 190 14 246 190 14 +-246 190 14 246 190 14 246 190 14 246 190 14 +-246 190 14 246 190 14 246 190 14 246 190 14 +-246 190 14 246 190 14 246 190 14 246 190 14 +-241 196 14 215 174 15 190 178 144 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 218 218 218 +- 58 58 58 2 2 6 22 18 6 167 114 7 +-216 158 10 236 178 12 246 186 14 246 190 14 +-246 190 14 246 190 14 246 190 14 246 190 14 +-246 190 14 246 190 14 246 190 14 246 190 14 +-246 190 14 246 190 14 246 190 14 246 190 14 +-246 190 14 246 186 14 242 186 14 190 150 46 +- 54 54 54 22 22 22 6 6 6 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 14 14 14 +- 38 38 38 86 86 86 180 133 36 213 154 11 +-236 178 12 246 186 14 246 190 14 246 190 14 +-246 190 14 246 190 14 246 190 14 246 190 14 +-246 190 14 246 190 14 246 190 14 246 190 14 +-246 190 14 246 190 14 246 190 14 246 190 14 +-246 190 14 232 195 16 190 146 13 214 214 214 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 250 250 250 170 170 170 26 26 26 +- 2 2 6 2 2 6 37 26 9 163 110 8 +-219 162 10 239 182 13 246 186 14 246 190 14 +-246 190 14 246 190 14 246 190 14 246 190 14 +-246 190 14 246 190 14 246 190 14 246 190 14 +-246 190 14 246 190 14 246 190 14 246 190 14 +-246 186 14 236 178 12 224 166 10 142 122 72 +- 46 46 46 18 18 18 6 6 6 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 6 6 6 18 18 18 +- 50 50 50 109 106 95 192 133 9 224 166 10 +-242 186 14 246 190 14 246 190 14 246 190 14 +-246 190 14 246 190 14 246 190 14 246 190 14 +-246 190 14 246 190 14 246 190 14 246 190 14 +-246 190 14 246 190 14 246 190 14 246 190 14 +-242 186 14 226 184 13 210 162 10 142 110 46 +-226 226 226 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-253 253 253 253 253 253 253 253 253 253 253 253 +-198 198 198 66 66 66 2 2 6 2 2 6 +- 2 2 6 2 2 6 50 34 6 156 107 11 +-219 162 10 239 182 13 246 186 14 246 190 14 +-246 190 14 246 190 14 246 190 14 246 190 14 +-246 190 14 246 190 14 246 190 14 246 190 14 +-246 190 14 246 190 14 246 190 14 242 186 14 +-234 174 13 213 154 11 154 122 46 66 66 66 +- 30 30 30 10 10 10 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 6 6 6 22 22 22 +- 58 58 58 154 121 60 206 145 10 234 174 13 +-242 186 14 246 186 14 246 190 14 246 190 14 +-246 190 14 246 190 14 246 190 14 246 190 14 +-246 190 14 246 190 14 246 190 14 246 190 14 +-246 190 14 246 190 14 246 190 14 246 190 14 +-246 186 14 236 178 12 210 162 10 163 110 8 +- 61 42 6 138 138 138 218 218 218 250 250 250 +-253 253 253 253 253 253 253 253 253 250 250 250 +-242 242 242 210 210 210 144 144 144 66 66 66 +- 6 6 6 2 2 6 2 2 6 2 2 6 +- 2 2 6 2 2 6 61 42 6 163 110 8 +-216 158 10 236 178 12 246 190 14 246 190 14 +-246 190 14 246 190 14 246 190 14 246 190 14 +-246 190 14 246 190 14 246 190 14 246 190 14 +-246 190 14 239 182 13 230 174 11 216 158 10 +-190 142 34 124 112 88 70 70 70 38 38 38 +- 18 18 18 6 6 6 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 6 6 6 22 22 22 +- 62 62 62 168 124 44 206 145 10 224 166 10 +-236 178 12 239 182 13 242 186 14 242 186 14 +-246 186 14 246 190 14 246 190 14 246 190 14 +-246 190 14 246 190 14 246 190 14 246 190 14 +-246 190 14 246 190 14 246 190 14 246 190 14 +-246 190 14 236 178 12 216 158 10 175 118 6 +- 80 54 7 2 2 6 6 6 6 30 30 30 +- 54 54 54 62 62 62 50 50 50 38 38 38 +- 14 14 14 2 2 6 2 2 6 2 2 6 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 2 2 6 6 6 6 80 54 7 167 114 7 +-213 154 11 236 178 12 246 190 14 246 190 14 +-246 190 14 246 190 14 246 190 14 246 190 14 +-246 190 14 242 186 14 239 182 13 239 182 13 +-230 174 11 210 150 10 174 135 50 124 112 88 +- 82 82 82 54 54 54 34 34 34 18 18 18 +- 6 6 6 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 6 6 6 18 18 18 +- 50 50 50 158 118 36 192 133 9 200 144 11 +-216 158 10 219 162 10 224 166 10 226 170 11 +-230 174 11 236 178 12 239 182 13 239 182 13 +-242 186 14 246 186 14 246 190 14 246 190 14 +-246 190 14 246 190 14 246 190 14 246 190 14 +-246 186 14 230 174 11 210 150 10 163 110 8 +-104 69 6 10 10 10 2 2 6 2 2 6 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 2 2 6 6 6 6 91 60 6 167 114 7 +-206 145 10 230 174 11 242 186 14 246 190 14 +-246 190 14 246 190 14 246 186 14 242 186 14 +-239 182 13 230 174 11 224 166 10 213 154 11 +-180 133 36 124 112 88 86 86 86 58 58 58 +- 38 38 38 22 22 22 10 10 10 6 6 6 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 14 14 14 +- 34 34 34 70 70 70 138 110 50 158 118 36 +-167 114 7 180 123 7 192 133 9 197 138 11 +-200 144 11 206 145 10 213 154 11 219 162 10 +-224 166 10 230 174 11 239 182 13 242 186 14 +-246 186 14 246 186 14 246 186 14 246 186 14 +-239 182 13 216 158 10 185 133 11 152 99 6 +-104 69 6 18 14 6 2 2 6 2 2 6 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 2 2 6 2 2 6 2 2 6 2 2 6 +- 2 2 6 6 6 6 80 54 7 152 99 6 +-192 133 9 219 162 10 236 178 12 239 182 13 +-246 186 14 242 186 14 239 182 13 236 178 12 +-224 166 10 206 145 10 192 133 9 154 121 60 +- 94 94 94 62 62 62 42 42 42 22 22 22 +- 14 14 14 6 6 6 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 6 6 6 +- 18 18 18 34 34 34 58 58 58 78 78 78 +-101 98 89 124 112 88 142 110 46 156 107 11 +-163 110 8 167 114 7 175 118 6 180 123 7 +-185 133 11 197 138 11 210 150 10 219 162 10 +-226 170 11 236 178 12 236 178 12 234 174 13 +-219 162 10 197 138 11 163 110 8 130 83 6 +- 91 60 6 10 10 10 2 2 6 2 2 6 +- 18 18 18 38 38 38 38 38 38 38 38 38 +- 38 38 38 38 38 38 38 38 38 38 38 38 +- 38 38 38 38 38 38 26 26 26 2 2 6 +- 2 2 6 6 6 6 70 47 6 137 92 6 +-175 118 6 200 144 11 219 162 10 230 174 11 +-234 174 13 230 174 11 219 162 10 210 150 10 +-192 133 9 163 110 8 124 112 88 82 82 82 +- 50 50 50 30 30 30 14 14 14 6 6 6 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 6 6 6 14 14 14 22 22 22 34 34 34 +- 42 42 42 58 58 58 74 74 74 86 86 86 +-101 98 89 122 102 70 130 98 46 121 87 25 +-137 92 6 152 99 6 163 110 8 180 123 7 +-185 133 11 197 138 11 206 145 10 200 144 11 +-180 123 7 156 107 11 130 83 6 104 69 6 +- 50 34 6 54 54 54 110 110 110 101 98 89 +- 86 86 86 82 82 82 78 78 78 78 78 78 +- 78 78 78 78 78 78 78 78 78 78 78 78 +- 78 78 78 82 82 82 86 86 86 94 94 94 +-106 106 106 101 101 101 86 66 34 124 80 6 +-156 107 11 180 123 7 192 133 9 200 144 11 +-206 145 10 200 144 11 192 133 9 175 118 6 +-139 102 15 109 106 95 70 70 70 42 42 42 +- 22 22 22 10 10 10 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 6 6 6 10 10 10 +- 14 14 14 22 22 22 30 30 30 38 38 38 +- 50 50 50 62 62 62 74 74 74 90 90 90 +-101 98 89 112 100 78 121 87 25 124 80 6 +-137 92 6 152 99 6 152 99 6 152 99 6 +-138 86 6 124 80 6 98 70 6 86 66 30 +-101 98 89 82 82 82 58 58 58 46 46 46 +- 38 38 38 34 34 34 34 34 34 34 34 34 +- 34 34 34 34 34 34 34 34 34 34 34 34 +- 34 34 34 34 34 34 38 38 38 42 42 42 +- 54 54 54 82 82 82 94 86 76 91 60 6 +-134 86 6 156 107 11 167 114 7 175 118 6 +-175 118 6 167 114 7 152 99 6 121 87 25 +-101 98 89 62 62 62 34 34 34 18 18 18 +- 6 6 6 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 6 6 6 6 6 6 10 10 10 +- 18 18 18 22 22 22 30 30 30 42 42 42 +- 50 50 50 66 66 66 86 86 86 101 98 89 +-106 86 58 98 70 6 104 69 6 104 69 6 +-104 69 6 91 60 6 82 62 34 90 90 90 +- 62 62 62 38 38 38 22 22 22 14 14 14 +- 10 10 10 10 10 10 10 10 10 10 10 10 +- 10 10 10 10 10 10 6 6 6 10 10 10 +- 10 10 10 10 10 10 10 10 10 14 14 14 +- 22 22 22 42 42 42 70 70 70 89 81 66 +- 80 54 7 104 69 6 124 80 6 137 92 6 +-134 86 6 116 81 8 100 82 52 86 86 86 +- 58 58 58 30 30 30 14 14 14 6 6 6 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 6 6 6 10 10 10 14 14 14 +- 18 18 18 26 26 26 38 38 38 54 54 54 +- 70 70 70 86 86 86 94 86 76 89 81 66 +- 89 81 66 86 86 86 74 74 74 50 50 50 +- 30 30 30 14 14 14 6 6 6 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 6 6 6 18 18 18 34 34 34 58 58 58 +- 82 82 82 89 81 66 89 81 66 89 81 66 +- 94 86 66 94 86 76 74 74 74 50 50 50 +- 26 26 26 14 14 14 6 6 6 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 6 6 6 6 6 6 14 14 14 18 18 18 +- 30 30 30 38 38 38 46 46 46 54 54 54 +- 50 50 50 42 42 42 30 30 30 18 18 18 +- 10 10 10 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 6 6 6 14 14 14 26 26 26 +- 38 38 38 50 50 50 58 58 58 58 58 58 +- 54 54 54 42 42 42 30 30 30 18 18 18 +- 10 10 10 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 6 6 6 +- 6 6 6 10 10 10 14 14 14 18 18 18 +- 18 18 18 14 14 14 10 10 10 6 6 6 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 6 6 6 +- 14 14 14 18 18 18 22 22 22 22 22 22 +- 18 18 18 14 14 14 10 10 10 6 6 6 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 +- 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 1 0 ++0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 ++0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 ++10 15 3 2 3 1 12 18 4 42 61 14 19 27 6 11 16 4 ++38 55 13 10 15 3 3 4 1 10 15 3 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 3 1 ++12 18 4 1 1 0 23 34 8 31 45 11 10 15 3 32 47 11 ++34 49 12 3 4 1 3 4 1 3 4 1 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 10 15 3 29 42 10 26 37 9 12 18 4 ++55 80 19 81 118 28 55 80 19 92 132 31 106 153 36 69 100 23 ++100 144 34 80 116 27 42 61 14 81 118 28 23 34 8 27 40 9 ++15 21 5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 1 1 0 29 42 10 15 21 5 50 72 17 ++74 107 25 45 64 15 102 148 35 80 116 27 84 121 28 111 160 38 ++69 100 23 65 94 22 81 118 28 29 42 10 17 25 6 29 42 10 ++23 34 8 2 3 1 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 4 1 ++15 21 5 15 21 5 34 49 12 101 146 34 111 161 38 97 141 33 ++97 141 33 119 172 41 117 170 40 116 167 40 118 170 40 118 171 40 ++117 169 40 118 170 40 111 160 38 118 170 40 96 138 32 89 128 30 ++81 118 28 11 16 4 10 15 3 1 1 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++3 4 1 3 4 1 34 49 12 101 146 34 79 115 27 111 160 38 ++114 165 39 113 163 39 118 170 40 117 169 40 118 171 40 117 169 40 ++116 167 40 119 172 41 113 163 39 92 132 31 105 151 36 113 163 39 ++75 109 26 19 27 6 16 23 5 11 16 4 0 1 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 10 15 3 ++80 116 27 106 153 36 105 151 36 114 165 39 118 170 40 118 171 40 ++118 171 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 ++117 169 40 117 169 40 117 170 40 117 169 40 118 170 40 118 170 40 ++117 170 40 75 109 26 75 109 26 34 49 12 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 4 1 ++64 92 22 65 94 22 100 144 34 118 171 40 118 170 40 117 169 40 ++117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 ++117 169 40 117 169 40 117 169 40 118 171 41 118 170 40 117 169 40 ++109 158 37 105 151 36 104 150 35 47 69 16 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++42 61 14 115 167 39 118 170 40 117 169 40 117 169 40 117 169 40 ++117 170 40 117 170 40 117 169 40 117 169 40 117 169 40 117 169 40 ++117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 ++117 169 40 117 169 40 118 170 40 96 138 32 17 25 6 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 47 69 16 ++114 165 39 117 168 40 117 170 40 117 169 40 117 169 40 117 169 40 ++117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 ++117 169 40 117 169 40 118 170 40 117 169 40 117 169 40 117 169 40 ++117 170 40 119 172 41 96 138 32 12 18 4 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 10 15 3 ++32 47 11 105 151 36 118 170 40 117 169 40 117 169 40 116 168 40 ++109 157 37 111 160 38 117 169 40 118 171 40 117 169 40 117 169 40 ++117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 ++117 169 40 117 169 40 117 169 40 118 171 40 69 100 23 2 3 1 ++0 0 0 0 0 0 0 0 0 0 0 0 19 27 6 101 146 34 ++118 171 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 ++117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 170 40 ++118 171 40 115 166 39 107 154 36 111 161 38 117 169 40 117 169 40 ++117 169 40 118 171 40 75 109 26 19 27 6 2 3 1 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 16 23 5 ++89 128 30 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 ++111 160 38 92 132 31 79 115 27 96 138 32 115 166 39 119 171 41 ++117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 ++117 169 40 117 169 40 117 169 40 118 170 40 109 157 37 26 37 9 ++0 0 0 0 0 0 0 0 0 0 0 0 64 92 22 118 171 40 ++117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 ++117 169 40 117 169 40 117 169 40 118 170 40 118 171 40 109 157 37 ++89 128 30 81 118 28 100 144 34 115 166 39 117 169 40 117 169 40 ++117 169 40 117 170 40 113 163 39 60 86 20 1 1 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++27 40 9 96 138 32 118 170 40 117 169 40 117 169 40 117 169 40 ++117 170 40 117 169 40 101 146 34 67 96 23 55 80 19 84 121 28 ++113 163 39 119 171 41 117 169 40 117 169 40 117 169 40 117 169 40 ++117 169 40 117 169 40 117 169 40 117 169 40 119 171 41 65 94 22 ++0 0 0 0 0 0 0 0 0 15 21 5 101 146 34 118 171 40 ++117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 ++117 169 40 118 170 40 118 171 40 104 150 35 69 100 23 53 76 18 ++81 118 28 111 160 38 118 170 40 117 169 40 117 169 40 117 169 40 ++117 169 40 114 165 39 69 100 23 10 15 3 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 ++31 45 11 77 111 26 117 169 40 117 169 40 117 169 40 117 169 40 ++117 169 40 117 169 40 118 170 40 116 168 40 92 132 31 47 69 16 ++38 55 13 81 118 28 113 163 39 119 171 41 117 169 40 117 169 40 ++117 169 40 117 169 40 117 169 40 117 169 40 118 171 41 92 132 31 ++10 15 3 0 0 0 0 0 0 36 52 12 115 166 39 117 169 40 ++117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 118 170 40 ++118 171 40 102 148 35 64 92 22 34 49 12 65 94 22 106 153 36 ++118 171 40 117 170 40 117 169 40 117 169 40 117 169 40 117 169 40 ++118 170 40 107 154 36 55 80 19 15 21 5 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++29 42 10 101 146 34 118 171 40 117 169 40 117 169 40 117 169 40 ++117 169 40 117 169 40 117 169 40 117 169 40 118 171 40 113 163 39 ++75 109 26 27 40 9 36 52 12 89 128 30 116 167 40 118 171 40 ++117 169 40 117 169 40 117 169 40 117 169 40 118 170 40 104 150 35 ++16 23 5 0 0 0 0 0 0 53 76 18 118 171 40 117 169 40 ++117 169 40 117 169 40 117 169 40 117 169 40 119 171 41 109 157 37 ++67 96 23 23 34 8 42 61 14 96 138 32 118 170 40 118 170 40 ++117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 ++117 169 40 117 169 40 74 107 25 10 15 3 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 31 45 11 101 146 34 118 170 40 117 169 40 117 169 40 ++117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 ++119 171 41 102 148 35 47 69 16 14 20 5 50 72 17 102 148 35 ++118 171 40 117 169 40 117 169 40 117 169 40 118 170 40 102 148 35 ++15 21 5 0 0 0 0 0 0 50 72 17 118 170 40 117 169 40 ++117 169 40 117 169 40 118 170 40 116 167 40 84 121 28 27 40 9 ++19 27 6 74 107 25 114 165 39 118 171 40 117 169 40 117 169 40 ++117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 ++117 169 40 75 109 26 10 15 4 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 38 55 13 102 148 35 118 171 40 117 169 40 117 169 40 ++117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 ++117 169 40 118 170 40 115 167 39 77 111 26 17 25 6 19 27 6 ++77 111 26 115 166 39 118 170 40 117 169 40 119 172 41 81 118 28 ++3 4 1 0 0 0 0 0 0 27 40 9 111 160 38 118 170 40 ++117 169 40 118 171 40 105 151 36 50 72 17 10 15 3 38 55 13 ++100 144 34 118 171 40 117 169 40 117 169 40 117 169 40 117 169 40 ++117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 ++117 169 40 79 115 27 15 21 5 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 10 15 3 64 92 22 111 160 38 117 169 40 117 169 40 ++117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 ++117 169 40 117 169 40 117 169 40 118 171 40 96 138 32 32 47 11 ++3 4 1 50 72 17 107 154 36 120 173 41 105 151 36 31 45 11 ++0 0 0 0 0 0 0 0 0 3 4 1 65 94 22 117 169 40 ++118 170 40 89 128 30 26 37 9 3 4 1 60 86 20 111 161 38 ++118 171 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 ++117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 ++97 141 33 36 52 12 1 1 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 14 20 5 75 109 26 117 168 40 117 169 40 ++117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 ++117 169 40 117 169 40 117 169 40 117 169 40 118 171 40 107 154 36 ++45 64 15 2 3 1 31 45 11 75 109 26 32 47 11 0 1 0 ++0 0 0 0 0 0 0 0 0 0 0 0 10 15 3 55 80 19 ++65 94 22 11 16 4 11 16 4 75 109 26 116 168 40 118 170 40 ++117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 ++117 169 40 117 169 40 117 169 40 117 169 40 118 170 40 107 154 36 ++47 69 16 3 4 1 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 12 18 4 69 100 23 111 161 38 118 171 40 ++117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 ++117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 118 170 40 ++111 160 38 50 72 17 2 3 1 2 3 1 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 ++1 1 0 12 18 4 81 118 28 118 170 40 117 169 40 117 169 40 ++117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 ++117 169 40 117 169 40 117 169 40 117 170 40 118 171 40 101 146 34 ++42 61 14 2 3 1 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 3 4 1 36 52 12 89 128 30 ++117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 ++117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 ++118 171 41 101 146 34 14 20 5 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 47 69 16 118 170 40 117 169 40 117 169 40 117 169 40 ++117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 ++117 169 40 117 169 40 117 170 40 111 160 38 69 100 23 19 27 6 ++0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 11 16 4 69 100 23 ++115 167 39 119 172 41 117 169 40 117 169 40 117 169 40 117 169 40 ++117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 ++119 172 41 75 109 26 3 4 1 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 23 34 8 106 153 36 118 170 40 117 169 40 117 169 40 ++117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 ++117 169 40 118 170 40 119 172 41 105 151 36 42 61 14 2 3 1 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 15 21 5 ++45 64 15 80 116 27 114 165 39 118 170 40 117 169 40 117 169 40 ++117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 119 172 41 ++97 141 33 20 30 7 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 1 1 0 53 76 18 114 165 39 118 171 40 117 169 40 ++117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 ++118 171 40 104 150 35 64 92 22 31 45 11 10 15 3 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 36 52 12 97 141 33 109 158 37 113 163 39 116 168 40 ++117 169 40 117 170 40 118 170 40 119 172 41 115 167 39 84 121 28 ++23 34 8 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 3 4 1 50 72 17 102 148 35 118 171 40 ++119 171 41 118 170 40 117 169 40 117 169 40 115 166 39 111 161 38 ++109 157 37 79 115 27 12 18 4 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 3 4 1 15 21 5 23 34 8 45 64 15 106 153 36 ++116 167 40 111 160 38 101 146 34 79 115 27 42 61 14 10 15 3 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 1 1 0 20 30 7 60 86 20 ++89 128 30 106 153 36 113 163 39 117 169 40 84 121 28 29 42 10 ++19 27 6 10 15 3 2 3 1 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 16 23 5 38 55 13 ++36 52 12 26 37 9 12 18 4 2 3 1 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 1 0 0 19 2 7 52 5 18 ++78 7 27 88 8 31 81 7 29 56 5 19 25 2 9 3 0 1 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++3 4 1 19 27 6 31 45 11 38 55 13 32 47 11 3 4 1 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 0 1 ++9 0 3 12 1 4 9 0 3 4 0 1 0 0 0 0 0 0 ++0 0 0 0 0 0 28 3 10 99 9 35 156 14 55 182 16 64 ++189 17 66 190 17 67 189 17 66 184 17 65 166 15 58 118 13 41 ++45 4 16 3 0 1 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 11 1 4 52 5 18 101 9 35 134 12 47 ++151 14 53 154 14 54 151 14 53 113 10 40 11 1 4 0 0 0 ++3 0 1 67 6 24 159 14 56 190 17 67 190 17 67 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 190 17 67 191 17 67 ++174 16 61 101 9 35 14 1 5 0 0 0 35 3 12 108 10 38 ++122 11 43 122 11 43 112 10 39 87 8 30 50 5 17 13 1 5 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++3 0 1 56 5 19 141 13 49 182 16 64 191 17 67 191 17 67 ++190 17 67 190 17 67 191 17 67 113 10 40 3 0 1 1 0 0 ++79 7 28 180 16 63 190 17 67 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++189 17 66 188 17 66 122 11 43 11 1 4 41 4 14 176 16 62 ++191 17 67 191 17 67 191 17 67 190 17 67 181 16 63 146 13 51 ++75 7 26 10 1 4 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 1 2 ++90 8 32 178 16 62 191 17 67 188 17 66 188 17 66 188 17 66 ++188 17 66 190 17 67 141 13 49 22 2 8 0 0 0 41 4 14 ++173 16 61 190 17 67 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 88 8 31 1 0 0 89 8 31 ++185 17 65 189 17 66 188 17 66 188 17 66 189 17 66 191 17 67 ++186 17 65 124 11 43 25 2 9 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 2 0 1 89 8 31 ++184 17 65 189 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++190 17 67 151 14 53 34 3 12 0 0 0 0 0 0 79 7 28 ++190 17 67 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 191 17 67 146 13 51 9 1 3 7 1 2 ++108 10 38 187 17 66 189 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 190 17 67 141 13 49 22 2 8 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 52 5 18 176 16 62 ++189 17 66 188 17 66 188 17 66 188 17 66 188 17 66 190 17 67 ++151 14 53 38 3 13 0 0 0 0 0 0 0 0 0 50 5 17 ++180 16 63 189 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 191 17 67 141 13 49 7 1 3 0 0 0 ++11 1 4 112 10 39 187 17 66 189 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 190 17 67 113 10 40 5 0 2 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 7 1 3 132 12 46 191 17 67 ++188 17 66 188 17 66 188 17 66 188 17 66 190 17 67 146 13 51 ++35 3 12 0 0 0 0 0 0 0 0 0 0 0 0 5 0 2 ++101 9 35 185 17 65 190 17 67 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 190 17 67 180 16 63 67 6 24 0 0 0 0 0 0 ++0 0 0 11 1 4 108 10 38 186 17 65 189 17 66 188 17 66 ++188 17 66 188 17 66 189 17 66 180 16 63 56 5 19 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 44 4 15 177 16 62 189 17 66 ++188 17 66 188 17 66 189 17 66 189 17 66 134 12 47 28 3 10 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++8 1 3 79 7 28 159 14 56 188 17 66 191 17 67 190 17 67 ++189 17 66 189 17 66 189 17 66 189 17 66 190 17 67 191 17 67 ++188 17 66 158 14 55 72 7 25 4 0 1 0 0 0 0 0 0 ++0 0 0 0 0 0 8 1 3 95 9 33 182 16 64 189 17 67 ++188 17 66 188 17 66 188 17 66 191 17 67 122 11 43 3 0 1 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 88 8 31 190 17 67 188 17 66 ++188 17 66 189 17 66 185 17 65 113 10 40 18 2 6 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 1 0 0 24 2 8 77 7 27 124 11 43 154 14 54 ++168 15 59 173 16 61 173 16 61 168 15 59 154 14 54 124 11 43 ++77 7 27 22 2 8 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 5 0 2 77 7 27 173 16 61 ++190 17 67 188 17 66 188 17 66 190 17 67 164 15 57 23 2 8 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 1 0 0 118 13 41 191 17 67 188 17 66 ++190 17 67 174 16 61 87 8 30 8 1 3 0 0 0 0 0 0 ++0 0 0 0 0 0 10 1 4 29 3 10 40 4 14 36 3 13 ++18 2 6 2 0 1 0 0 0 0 0 0 3 0 1 14 1 5 ++26 2 9 33 3 11 32 3 11 25 2 9 13 1 5 3 0 1 ++0 0 0 14 1 5 56 5 19 95 9 33 109 10 38 101 9 35 ++77 7 27 35 3 12 5 0 2 0 0 0 1 0 0 56 5 19 ++156 14 55 190 17 67 188 17 66 188 17 66 182 16 64 50 5 17 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 5 0 2 134 12 47 191 17 67 189 17 66 ++151 14 53 52 5 18 2 0 1 0 0 0 0 0 0 1 0 0 ++28 3 10 90 8 32 146 13 51 170 15 60 178 16 62 174 16 61 ++158 14 55 112 10 39 40 4 14 1 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 0 1 ++56 5 19 146 13 51 183 17 64 191 17 67 191 17 67 191 17 67 ++188 17 66 173 16 61 122 11 43 41 4 14 1 0 0 0 0 0 ++30 3 10 124 11 43 185 17 65 190 17 67 187 17 66 67 6 24 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 6 1 2 134 12 47 168 15 59 99 9 35 ++21 2 7 0 0 0 0 0 0 0 0 0 6 1 2 77 7 27 ++162 15 57 190 17 67 191 17 67 189 17 66 189 17 66 189 17 66 ++190 17 67 191 17 67 169 15 59 75 7 26 3 0 1 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 2 0 1 79 7 28 ++178 16 62 191 17 67 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 189 17 66 191 17 67 170 15 60 79 7 28 5 0 2 ++0 0 0 10 1 3 78 7 27 159 14 56 188 17 66 75 7 26 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 1 0 0 35 3 12 29 3 10 2 0 1 ++0 0 0 0 0 0 0 0 0 9 1 3 101 9 35 183 17 64 ++190 17 67 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 190 17 67 178 16 63 67 6 23 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 52 5 18 174 16 61 ++190 17 67 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 190 17 67 182 16 64 89 8 31 ++4 0 1 0 0 0 0 0 0 25 2 9 73 7 26 31 3 11 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 4 0 1 98 9 34 187 17 66 189 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 190 17 67 158 14 55 25 2 9 ++0 0 0 0 0 0 0 0 0 8 1 3 134 12 47 191 17 67 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 189 17 66 180 16 63 ++68 6 24 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 6 1 2 19 2 7 3 0 1 0 0 0 0 0 0 ++0 0 0 0 0 0 65 6 23 180 16 63 189 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 189 17 66 83 8 29 ++0 0 0 0 0 0 0 0 0 41 4 14 177 16 62 189 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 190 17 67 ++159 14 56 28 3 10 0 0 0 0 0 0 0 0 0 23 2 8 ++41 4 14 5 0 2 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++23 2 8 113 10 40 159 14 56 65 6 23 0 0 0 0 0 0 ++0 0 0 16 1 6 146 13 51 191 17 67 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 191 17 67 132 12 46 ++5 0 2 0 0 0 0 0 0 77 7 27 189 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++190 17 67 98 9 34 0 0 0 0 0 0 12 1 4 134 12 47 ++178 16 63 108 10 38 16 1 6 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 30 3 10 ++141 13 49 190 17 67 191 17 67 134 12 47 6 1 2 0 0 0 ++0 0 0 68 6 24 186 17 65 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 190 17 67 156 14 55 ++14 1 5 0 0 0 0 0 0 98 9 34 191 17 67 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++190 17 67 156 14 55 19 2 7 0 0 0 47 4 16 181 16 63 ++190 17 67 189 17 66 126 14 44 17 2 6 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 16 1 6 134 12 47 ++191 17 67 188 17 66 190 17 67 162 15 57 19 2 7 0 0 0 ++3 0 1 123 11 43 191 17 67 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 190 17 67 163 15 57 ++20 2 7 0 0 0 0 0 0 101 9 35 191 17 67 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 182 16 64 52 5 18 0 0 0 73 7 26 188 17 66 ++188 17 66 188 17 66 189 17 66 109 10 38 5 0 2 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 95 9 33 189 17 66 ++188 17 66 188 17 66 189 17 66 171 15 60 29 3 10 0 0 0 ++16 1 6 156 14 55 190 17 67 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 190 17 67 158 14 55 ++17 2 6 0 0 0 0 0 0 85 8 30 190 17 67 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 189 17 66 81 7 29 0 0 0 85 8 30 190 17 67 ++188 17 66 188 17 66 189 17 66 180 16 63 56 5 19 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 25 2 9 162 15 57 190 17 67 ++188 17 66 188 17 66 189 17 66 173 16 61 31 3 11 0 0 0 ++30 3 10 171 15 60 189 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 191 17 67 141 13 49 ++7 1 2 0 0 0 0 0 0 56 5 19 183 17 64 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 191 17 67 98 9 34 0 0 0 88 8 31 190 17 67 ++188 17 66 188 17 66 188 17 66 191 17 67 124 11 43 5 0 2 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 68 6 24 187 17 66 188 17 66 ++188 17 66 188 17 66 189 17 66 170 15 60 28 3 10 0 0 0 ++34 3 12 174 16 61 189 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 191 17 67 101 9 35 ++0 0 0 0 0 0 0 0 0 21 2 7 159 14 56 190 17 67 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 191 17 67 98 9 34 0 0 0 81 7 29 189 17 66 ++188 17 66 188 17 66 188 17 66 189 17 66 168 15 59 28 3 10 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 109 10 38 191 17 67 188 17 66 ++188 17 66 188 17 66 190 17 67 163 15 57 21 2 7 0 0 0 ++26 2 9 168 15 59 189 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 189 17 66 180 16 63 47 4 16 ++0 0 0 0 0 0 0 0 0 0 0 0 108 10 38 190 17 67 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 189 17 66 78 7 27 0 0 0 68 6 24 187 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 183 17 64 56 5 19 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 3 0 1 131 12 46 191 17 67 188 17 66 ++188 17 66 188 17 66 190 17 67 151 14 53 12 1 4 0 0 0 ++11 1 4 146 13 51 190 17 67 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 191 17 67 126 14 44 7 1 2 ++0 0 0 0 0 0 0 0 0 0 0 0 32 3 11 164 15 58 ++190 17 67 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++189 17 66 178 16 62 44 4 15 0 0 0 50 5 17 182 16 64 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 72 7 25 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 5 0 2 134 12 47 191 17 67 188 17 66 ++188 17 66 188 17 66 191 17 67 131 12 46 3 0 1 0 0 0 ++0 0 0 101 9 35 190 17 67 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 190 17 67 170 15 60 44 4 15 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 77 7 27 ++183 17 64 189 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++191 17 67 134 12 47 9 1 3 0 0 0 31 3 11 171 15 60 ++189 17 66 188 17 66 188 17 66 188 17 66 188 17 66 72 7 25 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 2 0 1 124 11 43 191 17 67 188 17 66 ++188 17 66 188 17 66 191 17 67 101 9 35 0 0 0 0 0 0 ++0 0 0 35 3 12 168 15 59 190 17 67 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 189 17 66 182 16 64 77 7 27 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 6 1 2 ++99 9 35 185 17 65 189 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 189 17 66 ++177 16 62 56 5 19 0 0 0 0 0 0 13 1 5 151 14 53 ++190 17 67 188 17 66 188 17 66 188 17 66 185 17 65 56 5 19 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 99 9 35 191 17 67 188 17 66 ++188 17 66 188 17 66 186 17 65 65 6 23 0 0 0 0 0 0 ++0 0 0 0 0 0 79 7 28 182 16 64 190 17 67 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++191 17 67 177 16 62 83 8 29 4 0 1 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++8 1 3 89 8 31 175 16 62 191 17 67 189 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 190 17 67 181 16 63 ++85 8 30 3 0 1 0 0 0 0 0 0 1 0 0 118 13 41 ++191 17 67 188 17 66 188 17 66 189 17 66 173 16 61 34 3 12 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 56 5 19 183 17 64 188 17 66 ++188 17 66 189 17 66 169 15 59 30 3 10 0 0 0 0 0 0 ++0 0 0 0 0 0 5 0 2 83 8 29 173 16 61 191 17 67 ++190 17 67 189 17 66 189 17 66 190 17 67 191 17 67 187 17 66 ++151 14 53 56 5 19 3 0 1 0 0 0 16 1 6 50 5 17 ++79 7 28 95 9 33 95 9 33 75 7 26 41 4 14 10 1 4 ++0 0 0 2 0 1 50 5 17 132 12 46 178 16 62 190 17 67 ++191 17 67 191 17 67 191 17 67 186 17 65 154 14 54 68 6 24 ++4 0 1 0 0 0 0 0 0 0 0 0 0 0 0 72 7 25 ++187 17 66 188 17 66 188 17 66 191 17 67 141 13 49 9 1 3 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 14 1 5 151 14 53 190 17 67 ++188 17 66 191 17 67 131 12 46 5 0 2 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 2 0 1 44 4 15 113 10 40 ++156 14 55 173 16 61 174 16 61 164 15 58 134 12 47 77 7 27 ++18 2 6 0 0 0 16 1 6 85 8 30 151 14 53 182 16 64 ++189 17 66 191 17 67 190 17 67 188 17 66 177 16 62 141 13 49 ++68 6 24 8 1 3 0 0 0 8 1 3 44 4 15 88 8 31 ++113 10 40 122 11 43 108 10 38 67 6 24 20 2 7 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 28 3 10 ++166 15 58 190 17 67 188 17 66 187 17 66 79 7 28 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 73 7 26 185 17 65 ++189 17 66 184 17 65 65 6 23 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 1 ++17 2 6 32 3 11 34 3 12 22 2 8 6 1 2 0 0 0 ++0 0 0 38 3 13 141 13 49 188 17 66 190 17 67 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 189 17 66 191 17 67 ++184 17 65 122 11 43 21 2 7 0 0 0 0 0 0 0 0 0 ++0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 ++108 10 38 191 17 67 191 17 67 141 13 49 16 1 6 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 8 1 3 112 10 39 ++186 17 65 124 11 43 10 1 4 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++36 3 13 156 14 55 191 17 67 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++189 17 66 190 17 67 134 12 47 18 2 6 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 7 1 2 41 4 14 75 7 26 66 5 23 19 2 7 ++26 2 9 144 13 50 154 14 54 40 4 14 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 13 1 5 ++56 5 19 19 2 7 0 0 0 7 1 2 29 3 10 35 3 12 ++19 2 7 2 0 1 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 13 1 5 ++134 12 47 191 17 67 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 189 17 67 108 10 38 3 0 1 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 ++40 4 14 124 11 43 177 16 62 188 17 66 187 17 66 144 13 50 ++24 2 8 17 2 6 22 2 8 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 19 2 7 122 11 43 171 15 60 175 16 62 ++159 14 56 112 10 39 40 4 14 2 0 1 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 72 7 25 ++186 17 65 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 189 17 66 174 16 61 41 4 14 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 3 0 1 72 7 25 ++168 15 59 191 17 67 189 17 66 188 17 66 188 17 66 190 17 67 ++95 9 33 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 95 9 33 191 17 67 189 17 66 189 17 66 ++190 17 67 191 17 67 171 15 60 90 8 32 12 1 4 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 5 0 2 132 12 46 ++191 17 67 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 190 17 67 98 9 34 0 0 0 ++0 0 0 0 0 0 0 0 0 5 0 2 88 8 31 180 16 63 ++190 17 67 188 17 66 188 17 66 188 17 66 188 17 66 191 17 67 ++146 13 51 11 1 4 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 9 1 3 144 13 50 191 17 67 188 17 66 188 17 66 ++188 17 66 188 17 66 189 17 66 187 17 66 123 11 43 20 2 7 ++0 0 0 0 0 0 0 0 0 0 0 0 21 2 7 163 15 57 ++190 17 67 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 191 17 67 134 12 47 5 0 2 ++0 0 0 0 0 0 3 0 1 88 8 31 182 16 64 189 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 189 17 66 ++171 15 60 31 3 11 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 20 2 7 162 15 57 190 17 67 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 190 17 67 132 12 46 ++20 2 7 0 0 0 0 0 0 0 0 0 32 3 11 173 16 61 ++189 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 190 17 67 151 14 53 12 1 4 ++0 0 0 0 0 0 72 7 25 180 16 63 189 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++181 16 63 47 4 16 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 21 2 7 163 15 57 190 17 67 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 190 17 67 ++122 11 43 9 1 3 0 0 0 0 0 0 30 3 10 171 15 60 ++189 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 190 17 67 146 13 51 10 1 4 ++0 0 0 38 3 13 166 15 58 190 17 67 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++183 17 64 52 5 18 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 13 1 5 154 14 54 190 17 67 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++186 17 65 79 7 28 0 0 0 0 0 0 14 1 5 156 14 54 ++190 17 67 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 191 17 67 124 11 43 2 0 1 ++5 0 2 122 11 43 191 17 67 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++182 16 64 47 4 16 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 3 0 1 126 14 44 191 17 67 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++190 17 67 158 14 55 23 2 8 0 0 0 1 0 0 113 10 40 ++191 17 67 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 78 7 27 0 0 0 ++47 4 16 177 16 62 189 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 189 17 66 ++173 16 61 34 3 12 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 85 8 30 189 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 79 7 28 0 0 0 0 0 0 47 4 16 ++175 16 62 189 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 190 17 67 156 14 55 22 2 8 0 0 0 ++109 10 38 191 17 67 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 190 17 67 ++151 14 53 13 1 5 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 35 3 12 173 16 61 189 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 191 17 67 134 12 47 7 1 2 0 0 0 3 0 1 ++99 9 35 188 17 66 189 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 189 17 66 181 16 63 68 6 24 0 0 0 18 2 6 ++156 14 55 190 17 67 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 190 17 67 ++101 9 35 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 3 0 1 118 13 41 191 17 67 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 189 17 66 168 15 59 28 3 10 0 0 0 0 0 0 ++12 1 4 113 10 40 187 17 66 189 17 67 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++190 17 67 180 16 63 88 8 31 4 0 1 0 0 0 47 4 16 ++180 16 63 189 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 190 17 67 168 15 59 ++36 3 13 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 38 3 13 164 15 58 190 17 67 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 182 16 64 50 5 17 0 0 0 0 0 0 ++0 0 0 11 1 4 90 8 32 169 15 59 190 17 67 190 17 67 ++189 17 66 189 17 66 189 17 66 189 17 66 191 17 67 189 17 66 ++158 14 55 68 6 24 4 0 1 0 0 0 0 0 0 73 7 26 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 189 17 66 185 17 65 83 8 29 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 65 6 23 174 16 61 ++190 17 67 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 185 17 65 56 5 19 0 0 0 0 0 0 ++0 0 0 0 0 0 2 0 1 35 3 12 99 9 35 146 13 51 ++170 15 60 177 16 62 177 16 62 166 15 58 141 13 49 85 8 30 ++24 2 8 0 0 0 0 0 0 0 0 0 0 0 0 85 8 30 ++190 17 67 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 189 17 66 112 10 39 8 1 3 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 68 6 24 ++170 15 60 191 17 67 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 182 16 64 50 5 17 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 11 1 4 ++28 3 10 40 4 14 38 3 13 25 2 9 8 1 3 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 78 7 27 ++189 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 189 17 66 187 17 66 113 10 40 14 1 5 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 ++47 4 16 141 13 49 186 17 65 191 17 67 190 17 67 189 17 66 ++189 17 66 191 17 67 156 14 55 20 2 7 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 44 4 15 ++178 16 62 190 17 67 188 17 66 188 17 66 188 17 66 190 17 67 ++191 17 67 173 16 61 90 8 32 10 1 4 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 14 1 5 68 6 24 131 12 46 162 15 57 174 16 61 ++171 15 60 146 13 51 56 5 19 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 3 0 1 14 1 5 29 3 10 ++41 4 14 47 4 16 50 5 17 45 4 16 34 3 12 18 2 6 ++5 0 2 0 0 0 0 0 0 0 0 0 0 0 0 5 0 2 ++90 8 32 169 15 59 185 17 65 187 17 66 182 16 64 163 15 57 ++113 10 40 41 4 14 2 0 1 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 5 0 2 21 2 7 34 3 12 ++29 3 10 11 1 4 0 0 0 0 0 0 0 0 0 0 0 0 ++3 0 1 32 3 11 79 7 28 124 11 43 154 14 54 171 15 60 ++180 16 63 182 16 64 182 16 64 180 16 63 174 16 61 159 14 56 ++132 12 46 88 8 31 34 3 12 3 0 1 0 0 0 0 0 0 ++3 0 1 29 3 10 56 5 19 65 6 23 50 5 17 23 2 8 ++3 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 25 2 9 ++109 10 38 169 15 59 189 17 66 191 17 67 190 17 67 189 17 66 ++189 17 66 188 17 66 188 17 66 188 17 66 189 17 66 190 17 67 ++191 17 67 190 17 67 171 15 60 98 9 34 10 1 3 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 14 1 5 141 13 49 ++191 17 67 189 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 189 17 67 186 17 65 65 6 23 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 23 2 8 166 15 58 ++190 17 67 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 189 17 66 176 16 62 45 4 16 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 83 8 29 ++183 17 64 189 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++188 17 66 189 17 66 185 17 65 95 9 33 3 0 1 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5 0 2 ++85 8 30 176 16 62 191 17 67 188 17 66 188 17 66 188 17 66 ++188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 ++191 17 67 180 16 63 95 9 33 7 1 3 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++2 0 1 52 5 18 141 13 49 185 17 65 191 17 67 189 17 67 ++189 17 66 188 17 66 188 17 66 189 17 66 191 17 67 187 17 66 ++146 13 51 56 5 19 4 0 1 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 14 1 5 68 6 24 131 12 46 166 15 58 ++180 16 63 183 17 64 180 16 63 168 15 59 134 12 47 75 7 26 ++17 2 6 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 5 0 2 24 2 8 ++44 4 15 52 5 18 45 4 16 26 2 9 6 1 2 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ++0 0 0 0 0 0 0 0 0 + +From e25ec90f213f3d1c6437f42059f442c84a997114 Mon Sep 17 00:00:00 2001 +From: Florian Meier <florian.meier@koalo.de> +Date: Fri, 22 Nov 2013 14:22:53 +0100 +Subject: [PATCH 035/112] dmaengine: Add support for BCM2708 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Add support for DMA controller of BCM2708 as used in the Raspberry Pi. +Currently it only supports cyclic DMA. + +Signed-off-by: Florian Meier <florian.meier@koalo.de> + +dmaengine: expand functionality by supporting scatter/gather transfers sdhci-bcm2708 and dma.c: fix for LITE channels + +DMA: fix cyclic LITE length overflow bug + +dmaengine: bcm2708: Remove chancnt affectations + +Mirror bcm2835-dma.c commit 9eba5536a7434c69d8c185d4bd1c70734d92287d: +chancnt is already filled by dma_async_device_register, which uses the channel +list to know how much channels there is. + +Since it's already filled, we can safely remove it from the drivers' probe +function. + +Signed-off-by: Noralf Trønnes <noralf@tronnes.org> + +dmaengine: bcm2708: overwrite dreq only if it is not set + +dreq is set when the DMA channel is fetched from Device Tree. +slave_id is set using dmaengine_slave_config(). +Only overwrite dreq with slave_id if it is not set. + +dreq/slave_id in the cyclic DMA case is not touched, because I don't +have hardware to test with. + +Signed-off-by: Noralf Trønnes <noralf@tronnes.org> + +dmaengine: bcm2708: do device registration in the board file + +Don't register the device in the driver. Do it in the board file. + +Signed-off-by: Noralf Trønnes <noralf@tronnes.org> + +dmaengine: bcm2708: don't restrict DT support to ARCH_BCM2835 + +Both ARCH_BCM2835 and ARCH_BCM270x are built with OF now. +Add Device Tree support to the non ARCH_BCM2835 case. +Use the same driver name regardless of architecture. + +Signed-off-by: Noralf Trønnes <noralf@tronnes.org> + +BCM270x_DT: add bcm2835-dma entry + +Add Device Tree entry for bcm2835-dma. +The entry doesn't contain any resources since they are handled +by the arch/arm/mach-bcm270x/dma.c driver. +In non-DT mode, don't add the device in the board file. + +Signed-off-by: Noralf Trønnes <noralf@tronnes.org> + +bcm2708-dmaengine: Add debug options + +BCM270x: Add memory and irq resources to dmaengine device and DT + +Prepare for merging of the legacy DMA API arch driver dma.c +with bcm2708-dmaengine by adding memory and irq resources both +to platform file device and Device Tree node. +Don't use BCM_DMAMAN_DRIVER_NAME so we don't have to include mach/dma.h + +Signed-off-by: Noralf Trønnes <noralf@tronnes.org> + +dmaengine: bcm2708: Merge with arch dma.c driver and disable dma.c + +Merge the legacy DMA API driver with bcm2708-dmaengine. +This is done so we can use bcm2708_fb on ARCH_BCM2835 (mailbox +driver is also needed). + +Changes to the dma.c code: +- Use BIT() macro. +- Cutdown some comments to one line. +- Add mutex to vc_dmaman and use this, since the dev lock is locked + during probing of the engine part. +- Add global g_dmaman variable since drvdata is used by the engine part. +- Restructure for readability: + vc_dmaman_chan_alloc() + vc_dmaman_chan_free() + bcm_dma_chan_free() +- Restructure bcm_dma_chan_alloc() to simplify error handling. +- Use device irq resources instead of hardcoded bcm_dma_irqs table. +- Remove dev_dmaman_register() and code it directly. +- Remove dev_dmaman_deregister() and code it directly. +- Simplify bcm_dmaman_probe() using devm_* functions. +- Get dmachans from DT if available. +- Keep 'dma.dmachans' module argument name for backwards compatibility. + +Make it available on ARCH_BCM2835 as well. + +Signed-off-by: Noralf Trønnes <noralf@tronnes.org> + +dmaengine: bcm2708: set residue_granularity field + +bcm2708-dmaengine supports residue reporting at burst level +but didn't report this via the residue_granularity field. + +Without this field set properly we get playback issues with I2S cards. + +dmaengine: bcm2708-dmaengine: Fix memory leak when stopping a running transfer + +bcm2708-dmaengine: Use more DMA channels (but not 12) + +1) Only the bcm2708_fb drivers uses the legacy DMA API, and +it requires a BULK-capable channel, so all other types +(FAST, NORMAL and LITE) can be made available to the regular +DMA API. + +2) DMA channels 11-14 share an interrupt. The driver can't +handle this, so don't use channels 12-14 (12 was used, probably +because it appears to have an interrupt, but in reality that +interrupt is for activity on ANY channel). This may explain +a lockup encountered when running out of DMA channels. + +The combined effect of this patch is to leave 7 DMA channels +available + channel 0 for bcm2708_fb via the legacy API. + +See: https://github.com/raspberrypi/linux/issues/1110 + https://github.com/raspberrypi/linux/issues/1108 + +dmaengine: bcm2708: Make legacy API available for bcm2835-dma + +bcm2708_fb uses the legacy DMA API, so in order to start using +bcm2835-dma, bcm2835-dma has to support the legacy API. Make this +possible by exporting bcm_dmaman_probe() and bcm_dmaman_remove(). + +Signed-off-by: Noralf Trønnes <noralf@tronnes.org> + +dmaengine: bcm2708: Change DT compatible string + +Both bcm2835-dma and bcm2708-dmaengine have the same compatible string. +So change compatible to "brcm,bcm2708-dma". + +Signed-off-by: Noralf Trønnes <noralf@tronnes.org> + +dmaengine: bcm2708: Remove driver but keep legacy API + +Dropping non-DT support means we don't need this driver, +but we still need the legacy DMA API. + +Signed-off-by: Noralf Trønnes <noralf@tronnes.org> +--- + drivers/dma/Kconfig | 4 + + drivers/dma/Makefile | 1 + + drivers/dma/bcm2708-dmaengine.c | 281 ++++++++++++++++++++++++++++++ + include/linux/platform_data/dma-bcm2708.h | 143 +++++++++++++++ + 4 files changed, 429 insertions(+) + create mode 100644 drivers/dma/bcm2708-dmaengine.c + create mode 100644 include/linux/platform_data/dma-bcm2708.h + +diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig +index 4d0425c..b7863f0 100644 +--- a/drivers/dma/Kconfig ++++ b/drivers/dma/Kconfig +@@ -474,6 +474,10 @@ config TIMB_DMA + help + Enable support for the Timberdale FPGA DMA engine. + ++config DMA_BCM2708 ++ tristate "BCM2708 DMA legacy API support" ++ depends on DMA_BCM2835 ++ + config TI_CPPI41 + tristate "AM33xx CPPI41 DMA support" + depends on ARCH_OMAP +diff --git a/drivers/dma/Makefile b/drivers/dma/Makefile +index 6084127..8188c36 100644 +--- a/drivers/dma/Makefile ++++ b/drivers/dma/Makefile +@@ -18,6 +18,7 @@ obj-$(CONFIG_AT_HDMAC) += at_hdmac.o + obj-$(CONFIG_AT_XDMAC) += at_xdmac.o + obj-$(CONFIG_AXI_DMAC) += dma-axi-dmac.o + obj-$(CONFIG_COH901318) += coh901318.o coh901318_lli.o ++obj-$(CONFIG_DMA_BCM2708) += bcm2708-dmaengine.o + obj-$(CONFIG_DMA_BCM2835) += bcm2835-dma.o + obj-$(CONFIG_DMA_JZ4740) += dma-jz4740.o + obj-$(CONFIG_DMA_JZ4780) += dma-jz4780.o +diff --git a/drivers/dma/bcm2708-dmaengine.c b/drivers/dma/bcm2708-dmaengine.c +new file mode 100644 +index 0000000..56f18dc +--- /dev/null ++++ b/drivers/dma/bcm2708-dmaengine.c +@@ -0,0 +1,281 @@ ++/* ++ * BCM2708 legacy DMA API ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ */ ++ ++#include <linux/init.h> ++#include <linux/interrupt.h> ++#include <linux/list.h> ++#include <linux/module.h> ++#include <linux/platform_data/dma-bcm2708.h> ++#include <linux/platform_device.h> ++#include <linux/slab.h> ++#include <linux/io.h> ++#include <linux/spinlock.h> ++ ++#include "virt-dma.h" ++ ++#define CACHE_LINE_MASK 31 ++#define DEFAULT_DMACHAN_BITMAP 0x10 /* channel 4 only */ ++ ++/* valid only for channels 0 - 14, 15 has its own base address */ ++#define BCM2708_DMA_CHAN(n) ((n) << 8) /* base address */ ++#define BCM2708_DMA_CHANIO(dma_base, n) \ ++ ((void __iomem *)((char *)(dma_base) + BCM2708_DMA_CHAN(n))) ++ ++struct vc_dmaman { ++ void __iomem *dma_base; ++ u32 chan_available; /* bitmap of available channels */ ++ u32 has_feature[BCM_DMA_FEATURE_COUNT]; /* bitmap of feature presence */ ++ struct mutex lock; ++}; ++ ++static struct device *dmaman_dev; /* we assume there's only one! */ ++static struct vc_dmaman *g_dmaman; /* DMA manager */ ++ ++/* DMA Auxiliary Functions */ ++ ++/* A DMA buffer on an arbitrary boundary may separate a cache line into a ++ section inside the DMA buffer and another section outside it. ++ Even if we flush DMA buffers from the cache there is always the chance that ++ during a DMA someone will access the part of a cache line that is outside ++ the DMA buffer - which will then bring in unwelcome data. ++ Without being able to dictate our own buffer pools we must insist that ++ DMA buffers consist of a whole number of cache lines. ++*/ ++extern int bcm_sg_suitable_for_dma(struct scatterlist *sg_ptr, int sg_len) ++{ ++ int i; ++ ++ for (i = 0; i < sg_len; i++) { ++ if (sg_ptr[i].offset & CACHE_LINE_MASK || ++ sg_ptr[i].length & CACHE_LINE_MASK) ++ return 0; ++ } ++ ++ return 1; ++} ++EXPORT_SYMBOL_GPL(bcm_sg_suitable_for_dma); ++ ++extern void bcm_dma_start(void __iomem *dma_chan_base, ++ dma_addr_t control_block) ++{ ++ dsb(); /* ARM data synchronization (push) operation */ ++ ++ writel(control_block, dma_chan_base + BCM2708_DMA_ADDR); ++ writel(BCM2708_DMA_ACTIVE, dma_chan_base + BCM2708_DMA_CS); ++} ++EXPORT_SYMBOL_GPL(bcm_dma_start); ++ ++extern void bcm_dma_wait_idle(void __iomem *dma_chan_base) ++{ ++ dsb(); ++ ++ /* ugly busy wait only option for now */ ++ while (readl(dma_chan_base + BCM2708_DMA_CS) & BCM2708_DMA_ACTIVE) ++ cpu_relax(); ++} ++EXPORT_SYMBOL_GPL(bcm_dma_wait_idle); ++ ++extern bool bcm_dma_is_busy(void __iomem *dma_chan_base) ++{ ++ dsb(); ++ ++ return readl(dma_chan_base + BCM2708_DMA_CS) & BCM2708_DMA_ACTIVE; ++} ++EXPORT_SYMBOL_GPL(bcm_dma_is_busy); ++ ++/* Complete an ongoing DMA (assuming its results are to be ignored) ++ Does nothing if there is no DMA in progress. ++ This routine waits for the current AXI transfer to complete before ++ terminating the current DMA. If the current transfer is hung on a DREQ used ++ by an uncooperative peripheral the AXI transfer may never complete. In this ++ case the routine times out and return a non-zero error code. ++ Use of this routine doesn't guarantee that the ongoing or aborted DMA ++ does not produce an interrupt. ++*/ ++extern int bcm_dma_abort(void __iomem *dma_chan_base) ++{ ++ unsigned long int cs; ++ int rc = 0; ++ ++ cs = readl(dma_chan_base + BCM2708_DMA_CS); ++ ++ if (BCM2708_DMA_ACTIVE & cs) { ++ long int timeout = 10000; ++ ++ /* write 0 to the active bit - pause the DMA */ ++ writel(0, dma_chan_base + BCM2708_DMA_CS); ++ ++ /* wait for any current AXI transfer to complete */ ++ while (0 != (cs & BCM2708_DMA_ISPAUSED) && --timeout >= 0) ++ cs = readl(dma_chan_base + BCM2708_DMA_CS); ++ ++ if (0 != (cs & BCM2708_DMA_ISPAUSED)) { ++ /* we'll un-pause when we set of our next DMA */ ++ rc = -ETIMEDOUT; ++ ++ } else if (BCM2708_DMA_ACTIVE & cs) { ++ /* terminate the control block chain */ ++ writel(0, dma_chan_base + BCM2708_DMA_NEXTCB); ++ ++ /* abort the whole DMA */ ++ writel(BCM2708_DMA_ABORT | BCM2708_DMA_ACTIVE, ++ dma_chan_base + BCM2708_DMA_CS); ++ } ++ } ++ ++ return rc; ++} ++EXPORT_SYMBOL_GPL(bcm_dma_abort); ++ ++ /* DMA Manager Device Methods */ ++ ++static void vc_dmaman_init(struct vc_dmaman *dmaman, void __iomem *dma_base, ++ u32 chans_available) ++{ ++ dmaman->dma_base = dma_base; ++ dmaman->chan_available = chans_available; ++ dmaman->has_feature[BCM_DMA_FEATURE_FAST_ORD] = 0x0c; /* 2 & 3 */ ++ dmaman->has_feature[BCM_DMA_FEATURE_BULK_ORD] = 0x01; /* 0 */ ++ dmaman->has_feature[BCM_DMA_FEATURE_NORMAL_ORD] = 0xfe; /* 1 to 7 */ ++ dmaman->has_feature[BCM_DMA_FEATURE_LITE_ORD] = 0x7f00; /* 8 to 14 */ ++} ++ ++static int vc_dmaman_chan_alloc(struct vc_dmaman *dmaman, ++ unsigned required_feature_set) ++{ ++ u32 chans; ++ int chan = 0; ++ int feature; ++ ++ chans = dmaman->chan_available; ++ for (feature = 0; feature < BCM_DMA_FEATURE_COUNT; feature++) ++ /* select the subset of available channels with the desired ++ features */ ++ if (required_feature_set & (1 << feature)) ++ chans &= dmaman->has_feature[feature]; ++ ++ if (!chans) ++ return -ENOENT; ++ ++ /* return the ordinal of the first channel in the bitmap */ ++ while (chans != 0 && (chans & 1) == 0) { ++ chans >>= 1; ++ chan++; ++ } ++ /* claim the channel */ ++ dmaman->chan_available &= ~(1 << chan); ++ ++ return chan; ++} ++ ++static int vc_dmaman_chan_free(struct vc_dmaman *dmaman, int chan) ++{ ++ if (chan < 0) ++ return -EINVAL; ++ ++ if ((1 << chan) & dmaman->chan_available) ++ return -EIDRM; ++ ++ dmaman->chan_available |= (1 << chan); ++ ++ return 0; ++} ++ ++/* DMA Manager Monitor */ ++ ++extern int bcm_dma_chan_alloc(unsigned required_feature_set, ++ void __iomem **out_dma_base, int *out_dma_irq) ++{ ++ struct vc_dmaman *dmaman = g_dmaman; ++ struct platform_device *pdev = to_platform_device(dmaman_dev); ++ struct resource *r; ++ int chan; ++ ++ if (!dmaman_dev) ++ return -ENODEV; ++ ++ mutex_lock(&dmaman->lock); ++ chan = vc_dmaman_chan_alloc(dmaman, required_feature_set); ++ if (chan < 0) ++ goto out; ++ ++ r = platform_get_resource(pdev, IORESOURCE_IRQ, (unsigned int)chan); ++ if (!r) { ++ dev_err(dmaman_dev, "failed to get irq for DMA channel %d\n", ++ chan); ++ vc_dmaman_chan_free(dmaman, chan); ++ chan = -ENOENT; ++ goto out; ++ } ++ ++ *out_dma_base = BCM2708_DMA_CHANIO(dmaman->dma_base, chan); ++ *out_dma_irq = r->start; ++ dev_dbg(dmaman_dev, ++ "Legacy API allocated channel=%d, base=%p, irq=%i\n", ++ chan, *out_dma_base, *out_dma_irq); ++ ++out: ++ mutex_unlock(&dmaman->lock); ++ ++ return chan; ++} ++EXPORT_SYMBOL_GPL(bcm_dma_chan_alloc); ++ ++extern int bcm_dma_chan_free(int channel) ++{ ++ struct vc_dmaman *dmaman = g_dmaman; ++ int rc; ++ ++ if (!dmaman_dev) ++ return -ENODEV; ++ ++ mutex_lock(&dmaman->lock); ++ rc = vc_dmaman_chan_free(dmaman, channel); ++ mutex_unlock(&dmaman->lock); ++ ++ return rc; ++} ++EXPORT_SYMBOL_GPL(bcm_dma_chan_free); ++ ++int bcm_dmaman_probe(struct platform_device *pdev, void __iomem *base, ++ u32 chans_available) ++{ ++ struct device *dev = &pdev->dev; ++ struct vc_dmaman *dmaman; ++ ++ dmaman = devm_kzalloc(dev, sizeof(*dmaman), GFP_KERNEL); ++ if (!dmaman) ++ return -ENOMEM; ++ ++ mutex_init(&dmaman->lock); ++ vc_dmaman_init(dmaman, base, chans_available); ++ g_dmaman = dmaman; ++ dmaman_dev = dev; ++ ++ dev_info(dev, "DMA legacy API manager at %p, dmachans=0x%x\n", ++ base, chans_available); ++ ++ return 0; ++} ++EXPORT_SYMBOL(bcm_dmaman_probe); ++ ++int bcm_dmaman_remove(struct platform_device *pdev) ++{ ++ dmaman_dev = NULL; ++ ++ return 0; ++} ++EXPORT_SYMBOL(bcm_dmaman_remove); ++ ++MODULE_LICENSE("GPL"); +diff --git a/include/linux/platform_data/dma-bcm2708.h b/include/linux/platform_data/dma-bcm2708.h +new file mode 100644 +index 0000000..99cc7fd +--- /dev/null ++++ b/include/linux/platform_data/dma-bcm2708.h +@@ -0,0 +1,143 @@ ++/* ++ * Copyright (C) 2010 Broadcom ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 as ++ * published by the Free Software Foundation. ++ */ ++ ++#ifndef _PLAT_BCM2708_DMA_H ++#define _PLAT_BCM2708_DMA_H ++ ++/* DMA CS Control and Status bits */ ++#define BCM2708_DMA_ACTIVE BIT(0) ++#define BCM2708_DMA_INT BIT(2) ++#define BCM2708_DMA_ISPAUSED BIT(4) /* Pause requested or not active */ ++#define BCM2708_DMA_ISHELD BIT(5) /* Is held by DREQ flow control */ ++#define BCM2708_DMA_ERR BIT(8) ++#define BCM2708_DMA_ABORT BIT(30) /* stop current CB, go to next, WO */ ++#define BCM2708_DMA_RESET BIT(31) /* WO, self clearing */ ++ ++/* DMA control block "info" field bits */ ++#define BCM2708_DMA_INT_EN BIT(0) ++#define BCM2708_DMA_TDMODE BIT(1) ++#define BCM2708_DMA_WAIT_RESP BIT(3) ++#define BCM2708_DMA_D_INC BIT(4) ++#define BCM2708_DMA_D_WIDTH BIT(5) ++#define BCM2708_DMA_D_DREQ BIT(6) ++#define BCM2708_DMA_S_INC BIT(8) ++#define BCM2708_DMA_S_WIDTH BIT(9) ++#define BCM2708_DMA_S_DREQ BIT(10) ++ ++#define BCM2708_DMA_BURST(x) (((x) & 0xf) << 12) ++#define BCM2708_DMA_PER_MAP(x) ((x) << 16) ++#define BCM2708_DMA_WAITS(x) (((x) & 0x1f) << 21) ++ ++#define BCM2708_DMA_DREQ_EMMC 11 ++#define BCM2708_DMA_DREQ_SDHOST 13 ++ ++#define BCM2708_DMA_CS 0x00 /* Control and Status */ ++#define BCM2708_DMA_ADDR 0x04 ++/* the current control block appears in the following registers - read only */ ++#define BCM2708_DMA_INFO 0x08 ++#define BCM2708_DMA_SOURCE_AD 0x0c ++#define BCM2708_DMA_DEST_AD 0x10 ++#define BCM2708_DMA_NEXTCB 0x1C ++#define BCM2708_DMA_DEBUG 0x20 ++ ++#define BCM2708_DMA4_CS (BCM2708_DMA_CHAN(4) + BCM2708_DMA_CS) ++#define BCM2708_DMA4_ADDR (BCM2708_DMA_CHAN(4) + BCM2708_DMA_ADDR) ++ ++#define BCM2708_DMA_TDMODE_LEN(w, h) ((h) << 16 | (w)) ++ ++/* When listing features we can ask for when allocating DMA channels give ++ those with higher priority smaller ordinal numbers */ ++#define BCM_DMA_FEATURE_FAST_ORD 0 ++#define BCM_DMA_FEATURE_BULK_ORD 1 ++#define BCM_DMA_FEATURE_NORMAL_ORD 2 ++#define BCM_DMA_FEATURE_LITE_ORD 3 ++#define BCM_DMA_FEATURE_FAST BIT(BCM_DMA_FEATURE_FAST_ORD) ++#define BCM_DMA_FEATURE_BULK BIT(BCM_DMA_FEATURE_BULK_ORD) ++#define BCM_DMA_FEATURE_NORMAL BIT(BCM_DMA_FEATURE_NORMAL_ORD) ++#define BCM_DMA_FEATURE_LITE BIT(BCM_DMA_FEATURE_LITE_ORD) ++#define BCM_DMA_FEATURE_COUNT 4 ++ ++struct bcm2708_dma_cb { ++ unsigned long info; ++ unsigned long src; ++ unsigned long dst; ++ unsigned long length; ++ unsigned long stride; ++ unsigned long next; ++ unsigned long pad[2]; ++}; ++ ++struct scatterlist; ++struct platform_device; ++ ++#ifdef CONFIG_DMA_BCM2708 ++ ++int bcm_sg_suitable_for_dma(struct scatterlist *sg_ptr, int sg_len); ++void bcm_dma_start(void __iomem *dma_chan_base, dma_addr_t control_block); ++void bcm_dma_wait_idle(void __iomem *dma_chan_base); ++bool bcm_dma_is_busy(void __iomem *dma_chan_base); ++int bcm_dma_abort(void __iomem *dma_chan_base); ++ ++/* return channel no or -ve error */ ++int bcm_dma_chan_alloc(unsigned preferred_feature_set, ++ void __iomem **out_dma_base, int *out_dma_irq); ++int bcm_dma_chan_free(int channel); ++ ++int bcm_dmaman_probe(struct platform_device *pdev, void __iomem *base, ++ u32 chans_available); ++int bcm_dmaman_remove(struct platform_device *pdev); ++ ++#else /* CONFIG_DMA_BCM2708 */ ++ ++static inline int bcm_sg_suitable_for_dma(struct scatterlist *sg_ptr, ++ int sg_len) ++{ ++ return 0; ++} ++ ++static inline void bcm_dma_start(void __iomem *dma_chan_base, ++ dma_addr_t control_block) { } ++ ++static inline void bcm_dma_wait_idle(void __iomem *dma_chan_base) { } ++ ++static inline bool bcm_dma_is_busy(void __iomem *dma_chan_base) ++{ ++ return false; ++} ++ ++static inline int bcm_dma_abort(void __iomem *dma_chan_base) ++{ ++ return -EINVAL; ++} ++ ++static inline int bcm_dma_chan_alloc(unsigned preferred_feature_set, ++ void __iomem **out_dma_base, ++ int *out_dma_irq) ++{ ++ return -EINVAL; ++} ++ ++static inline int bcm_dma_chan_free(int channel) ++{ ++ return -EINVAL; ++} ++ ++static inline int bcm_dmaman_probe(struct platform_device *pdev, ++ void __iomem *base, u32 chans_available) ++{ ++ return 0; ++} ++ ++static inline int bcm_dmaman_remove(struct platform_device *pdev) ++{ ++ return 0; ++} ++ ++#endif /* CONFIG_DMA_BCM2708 */ ++ ++#endif /* _PLAT_BCM2708_DMA_H */ + +From 786f8c7793b58831efa8e1ffe5a02723842d3728 Mon Sep 17 00:00:00 2001 +From: gellert <gellert@raspberrypi.org> +Date: Fri, 15 Aug 2014 16:35:06 +0100 +Subject: [PATCH 036/112] MMC: added alternative MMC driver +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +mmc: Disable CMD23 transfers on all cards + +Pending wire-level investigation of these types of transfers +and associated errors on bcm2835-mmc, disable for now. Fallback of +CMD18/CMD25 transfers will be used automatically by the MMC layer. + +Reported/Tested-by: Gellert Weisz <gellert@raspberrypi.org> + +mmc: bcm2835-mmc: enable DT support for all architectures + +Both ARCH_BCM2835 and ARCH_BCM270x are built with OF now. +Enable Device Tree support for all architectures. + +Signed-off-by: Noralf Trønnes <noralf@tronnes.org> + +mmc: bcm2835-mmc: fix probe error handling + +Probe error handling is broken in several places. +Simplify error handling by using device managed functions. +Replace pr_{err,info} with dev_{err,info}. + +Signed-off-by: Noralf Trønnes <noralf@tronnes.org> + +bcm2835-mmc: Add locks when accessing sdhost registers + +bcm2835-mmc: Add range of debug options for slowing things down + +bcm2835-mmc: Add option to disable some delays + +bcm2835-mmc: Add option to disable MMC_QUIRK_BLK_NO_CMD23 + +bcm2835-mmc: Default to disabling MMC_QUIRK_BLK_NO_CMD23 + +bcm2835-mmc: Adding overclocking option + +Allow a different clock speed to be substitued for a requested 50MHz. +This option is exposed using the "overclock_50" DT parameter. +Note that the mmc interface is restricted to EVEN integer divisions of +250MHz, and the highest sensible option is 63 (250/4 = 62.5), the +next being 125 (250/2) which is much too high. + +Use at your own risk. + +bcm2835-mmc: Round up the overclock, so 62 works for 62.5Mhz + +Also only warn once for each overclock setting. + +mmc: bcm2835-mmc: Make available on ARCH_BCM2835 + +Make the bcm2835-mmc driver available for use on ARCH_BCM2835. + +Signed-off-by: Noralf Trønnes <noralf@tronnes.org> + +BCM270x_DT: add bcm2835-mmc entry + +Add Device Tree entry for bcm2835-mmc. +In non-DT mode, don't add the device in the board file. + +Signed-off-by: Noralf Trønnes <noralf@tronnes.org> + +bcm2835-mmc: Don't overwrite MMC capabilities from DT + +bcm2835-mmc: Don't override bus width capabilities from devicetree + +Take out the force setting of the MMC_CAP_4_BIT_DATA host capability +so that the result read from devicetree via mmc_of_parse() is +preserved. + +bcm2835-mmc: Only claim one DMA channel + +With both MMC controllers enabled there are few DMA channels left. The +bcm2835-mmc driver only uses DMA in one direction at a time, so it +doesn't need to claim two channels. + +See: https://github.com/raspberrypi/linux/issues/1327 + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> +--- + drivers/mmc/core/quirks.c | 10 + + drivers/mmc/host/Kconfig | 29 + + drivers/mmc/host/Makefile | 1 + + drivers/mmc/host/bcm2835-mmc.c | 1571 ++++++++++++++++++++++++++++++++++++++++ + 4 files changed, 1611 insertions(+) + create mode 100644 drivers/mmc/host/bcm2835-mmc.c + +diff --git a/drivers/mmc/core/quirks.c b/drivers/mmc/core/quirks.c +index fad660b..b79fe14 100644 +--- a/drivers/mmc/core/quirks.c ++++ b/drivers/mmc/core/quirks.c +@@ -53,6 +53,9 @@ static const struct mmc_fixup mmc_fixup_methods[] = { + + void mmc_fixup_device(struct mmc_card *card, const struct mmc_fixup *table) + { ++#ifdef CONFIG_MMC_BCM2835 ++ extern unsigned mmc_debug; ++#endif + const struct mmc_fixup *f; + u64 rev = cid_rev_card(card); + +@@ -77,5 +80,12 @@ void mmc_fixup_device(struct mmc_card *card, const struct mmc_fixup *table) + f->vendor_fixup(card, f->data); + } + } ++ /* SDHCI on BCM2708 - bug causes a certain sequence of CMD23 operations to fail. ++ * Disable this flag for all cards (fall-back to CMD25/CMD18 multi-block transfers). ++ */ ++#ifdef CONFIG_MMC_BCM2835 ++ if (mmc_debug & (1<<13)) ++ card->quirks |= MMC_QUIRK_BLK_NO_CMD23; ++#endif + } + EXPORT_SYMBOL(mmc_fixup_device); +diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig +index e657af0..0476061 100644 +--- a/drivers/mmc/host/Kconfig ++++ b/drivers/mmc/host/Kconfig +@@ -4,6 +4,35 @@ + + comment "MMC/SD/SDIO Host Controller Drivers" + ++config MMC_BCM2835 ++ tristate "MMC support on BCM2835" ++ depends on MACH_BCM2708 || MACH_BCM2709 || ARCH_BCM2835 ++ help ++ This selects the MMC Interface on BCM2835. ++ ++ If you have a controller with this interface, say Y or M here. ++ ++ If unsure, say N. ++ ++config MMC_BCM2835_DMA ++ bool "DMA support on BCM2835 Arasan controller" ++ depends on MMC_BCM2835 ++ help ++ Enable DMA support on the Arasan SDHCI controller in Broadcom 2708 ++ based chips. ++ ++ If unsure, say N. ++ ++config MMC_BCM2835_PIO_DMA_BARRIER ++ int "Block count limit for PIO transfers" ++ depends on MMC_BCM2835 && MMC_BCM2835_DMA ++ range 0 256 ++ default 2 ++ help ++ The inclusive limit in bytes under which PIO will be used instead of DMA ++ ++ If unsure, say 2 here. ++ + config MMC_ARMMMCI + tristate "ARM AMBA Multimedia Card Interface support" + depends on ARM_AMBA +diff --git a/drivers/mmc/host/Makefile b/drivers/mmc/host/Makefile +index af918d2..3ba94f0 100644 +--- a/drivers/mmc/host/Makefile ++++ b/drivers/mmc/host/Makefile +@@ -18,6 +18,7 @@ obj-$(CONFIG_MMC_SDHCI_S3C) += sdhci-s3c.o + obj-$(CONFIG_MMC_SDHCI_SIRF) += sdhci-sirf.o + obj-$(CONFIG_MMC_SDHCI_F_SDH30) += sdhci_f_sdh30.o + obj-$(CONFIG_MMC_SDHCI_SPEAR) += sdhci-spear.o ++obj-$(CONFIG_MMC_BCM2835) += bcm2835-mmc.o + obj-$(CONFIG_MMC_WBSD) += wbsd.o + obj-$(CONFIG_MMC_AU1X) += au1xmmc.o + obj-$(CONFIG_MMC_MTK) += mtk-sd.o +diff --git a/drivers/mmc/host/bcm2835-mmc.c b/drivers/mmc/host/bcm2835-mmc.c +new file mode 100644 +index 0000000..ceb3793 +--- /dev/null ++++ b/drivers/mmc/host/bcm2835-mmc.c +@@ -0,0 +1,1571 @@ ++/* ++ * BCM2835 MMC host driver. ++ * ++ * Author: Gellert Weisz <gellert@raspberrypi.org> ++ * Copyright 2014 ++ * ++ * Based on ++ * sdhci-bcm2708.c by Broadcom ++ * sdhci-bcm2835.c by Stephen Warren and Oleksandr Tymoshenko ++ * sdhci.c and sdhci-pci.c by Pierre Ossman ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms and conditions of the GNU General Public License, ++ * version 2, as published by the Free Software Foundation. ++ * ++ * This program is distributed in the hope it will be useful, but WITHOUT ++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for ++ * more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program. If not, see <http://www.gnu.org/licenses/>. ++ */ ++ ++#include <linux/delay.h> ++#include <linux/module.h> ++#include <linux/io.h> ++#include <linux/mmc/mmc.h> ++#include <linux/mmc/host.h> ++#include <linux/mmc/sd.h> ++#include <linux/scatterlist.h> ++#include <linux/of_address.h> ++#include <linux/of_irq.h> ++#include <linux/clk.h> ++#include <linux/platform_device.h> ++#include <linux/err.h> ++#include <linux/blkdev.h> ++#include <linux/dmaengine.h> ++#include <linux/dma-mapping.h> ++#include <linux/of_dma.h> ++ ++#include "sdhci.h" ++ ++ ++#define DRIVER_NAME "mmc-bcm2835" ++ ++#define DBG(f, x...) \ ++pr_debug(DRIVER_NAME " [%s()]: " f, __func__, ## x) ++ ++#ifndef CONFIG_MMC_BCM2835_DMA ++ #define FORCE_PIO ++#endif ++ ++ ++/* the inclusive limit in bytes under which PIO will be used instead of DMA */ ++#ifdef CONFIG_MMC_BCM2835_PIO_DMA_BARRIER ++#define PIO_DMA_BARRIER CONFIG_MMC_BCM2835_PIO_DMA_BARRIER ++#else ++#define PIO_DMA_BARRIER 00 ++#endif ++ ++#define MIN_FREQ 400000 ++#define TIMEOUT_VAL 0xE ++#define BCM2835_SDHCI_WRITE_DELAY(f) (((2 * 1000000) / f) + 1) ++ ++ ++unsigned mmc_debug; ++unsigned mmc_debug2; ++ ++struct bcm2835_host { ++ spinlock_t lock; ++ ++ void __iomem *ioaddr; ++ u32 bus_addr; ++ ++ struct mmc_host *mmc; ++ ++ u32 timeout; ++ ++ int clock; /* Current clock speed */ ++ u8 pwr; /* Current voltage */ ++ ++ unsigned int max_clk; /* Max possible freq */ ++ unsigned int timeout_clk; /* Timeout freq (KHz) */ ++ unsigned int clk_mul; /* Clock Muliplier value */ ++ ++ struct tasklet_struct finish_tasklet; /* Tasklet structures */ ++ ++ struct timer_list timer; /* Timer for timeouts */ ++ ++ struct sg_mapping_iter sg_miter; /* SG state for PIO */ ++ unsigned int blocks; /* remaining PIO blocks */ ++ ++ int irq; /* Device IRQ */ ++ ++ ++ u32 ier; /* cached registers */ ++ ++ struct mmc_request *mrq; /* Current request */ ++ struct mmc_command *cmd; /* Current command */ ++ struct mmc_data *data; /* Current data request */ ++ unsigned int data_early:1; /* Data finished before cmd */ ++ ++ wait_queue_head_t buf_ready_int; /* Waitqueue for Buffer Read Ready interrupt */ ++ ++ u32 thread_isr; ++ ++ u32 shadow; ++ ++ /*DMA part*/ ++ struct dma_chan *dma_chan_rxtx; /* DMA channel for reads and writes */ ++ struct dma_slave_config dma_cfg_rx; ++ struct dma_slave_config dma_cfg_tx; ++ struct dma_async_tx_descriptor *tx_desc; /* descriptor */ ++ ++ bool have_dma; ++ bool use_dma; ++ /*end of DMA part*/ ++ ++ int max_delay; /* maximum length of time spent waiting */ ++ ++ int flags; /* Host attributes */ ++#define SDHCI_REQ_USE_DMA (1<<2) /* Use DMA for this req. */ ++#define SDHCI_DEVICE_DEAD (1<<3) /* Device unresponsive */ ++#define SDHCI_AUTO_CMD12 (1<<6) /* Auto CMD12 support */ ++#define SDHCI_AUTO_CMD23 (1<<7) /* Auto CMD23 support */ ++#define SDHCI_SDIO_IRQ_ENABLED (1<<9) /* SDIO irq enabled */ ++ ++ u32 overclock_50; /* frequency to use when 50MHz is requested (in MHz) */ ++ u32 max_overclock; /* Highest reported */ ++}; ++ ++ ++static inline void bcm2835_mmc_writel(struct bcm2835_host *host, u32 val, int reg, int from) ++{ ++ unsigned delay; ++ lockdep_assert_held_once(&host->lock); ++ writel(val, host->ioaddr + reg); ++ udelay(BCM2835_SDHCI_WRITE_DELAY(max(host->clock, MIN_FREQ))); ++ ++ delay = ((mmc_debug >> 16) & 0xf) << ((mmc_debug >> 20) & 0xf); ++ if (delay && !((1<<from) & mmc_debug2)) ++ udelay(delay); ++} ++ ++static inline void mmc_raw_writel(struct bcm2835_host *host, u32 val, int reg) ++{ ++ unsigned delay; ++ lockdep_assert_held_once(&host->lock); ++ writel(val, host->ioaddr + reg); ++ ++ delay = ((mmc_debug >> 24) & 0xf) << ((mmc_debug >> 28) & 0xf); ++ if (delay) ++ udelay(delay); ++} ++ ++static inline u32 bcm2835_mmc_readl(struct bcm2835_host *host, int reg) ++{ ++ lockdep_assert_held_once(&host->lock); ++ return readl(host->ioaddr + reg); ++} ++ ++static inline void bcm2835_mmc_writew(struct bcm2835_host *host, u16 val, int reg) ++{ ++ u32 oldval = (reg == SDHCI_COMMAND) ? host->shadow : ++ bcm2835_mmc_readl(host, reg & ~3); ++ u32 word_num = (reg >> 1) & 1; ++ u32 word_shift = word_num * 16; ++ u32 mask = 0xffff << word_shift; ++ u32 newval = (oldval & ~mask) | (val << word_shift); ++ ++ if (reg == SDHCI_TRANSFER_MODE) ++ host->shadow = newval; ++ else ++ bcm2835_mmc_writel(host, newval, reg & ~3, 0); ++ ++} ++ ++static inline void bcm2835_mmc_writeb(struct bcm2835_host *host, u8 val, int reg) ++{ ++ u32 oldval = bcm2835_mmc_readl(host, reg & ~3); ++ u32 byte_num = reg & 3; ++ u32 byte_shift = byte_num * 8; ++ u32 mask = 0xff << byte_shift; ++ u32 newval = (oldval & ~mask) | (val << byte_shift); ++ ++ bcm2835_mmc_writel(host, newval, reg & ~3, 1); ++} ++ ++ ++static inline u16 bcm2835_mmc_readw(struct bcm2835_host *host, int reg) ++{ ++ u32 val = bcm2835_mmc_readl(host, (reg & ~3)); ++ u32 word_num = (reg >> 1) & 1; ++ u32 word_shift = word_num * 16; ++ u32 word = (val >> word_shift) & 0xffff; ++ ++ return word; ++} ++ ++static inline u8 bcm2835_mmc_readb(struct bcm2835_host *host, int reg) ++{ ++ u32 val = bcm2835_mmc_readl(host, (reg & ~3)); ++ u32 byte_num = reg & 3; ++ u32 byte_shift = byte_num * 8; ++ u32 byte = (val >> byte_shift) & 0xff; ++ ++ return byte; ++} ++ ++static void bcm2835_mmc_unsignal_irqs(struct bcm2835_host *host, u32 clear) ++{ ++ u32 ier; ++ ++ ier = bcm2835_mmc_readl(host, SDHCI_SIGNAL_ENABLE); ++ ier &= ~clear; ++ /* change which requests generate IRQs - makes no difference to ++ the content of SDHCI_INT_STATUS, or the need to acknowledge IRQs */ ++ bcm2835_mmc_writel(host, ier, SDHCI_SIGNAL_ENABLE, 2); ++} ++ ++ ++static void bcm2835_mmc_dumpregs(struct bcm2835_host *host) ++{ ++ pr_debug(DRIVER_NAME ": =========== REGISTER DUMP (%s)===========\n", ++ mmc_hostname(host->mmc)); ++ ++ pr_debug(DRIVER_NAME ": Sys addr: 0x%08x | Version: 0x%08x\n", ++ bcm2835_mmc_readl(host, SDHCI_DMA_ADDRESS), ++ bcm2835_mmc_readw(host, SDHCI_HOST_VERSION)); ++ pr_debug(DRIVER_NAME ": Blk size: 0x%08x | Blk cnt: 0x%08x\n", ++ bcm2835_mmc_readw(host, SDHCI_BLOCK_SIZE), ++ bcm2835_mmc_readw(host, SDHCI_BLOCK_COUNT)); ++ pr_debug(DRIVER_NAME ": Argument: 0x%08x | Trn mode: 0x%08x\n", ++ bcm2835_mmc_readl(host, SDHCI_ARGUMENT), ++ bcm2835_mmc_readw(host, SDHCI_TRANSFER_MODE)); ++ pr_debug(DRIVER_NAME ": Present: 0x%08x | Host ctl: 0x%08x\n", ++ bcm2835_mmc_readl(host, SDHCI_PRESENT_STATE), ++ bcm2835_mmc_readb(host, SDHCI_HOST_CONTROL)); ++ pr_debug(DRIVER_NAME ": Power: 0x%08x | Blk gap: 0x%08x\n", ++ bcm2835_mmc_readb(host, SDHCI_POWER_CONTROL), ++ bcm2835_mmc_readb(host, SDHCI_BLOCK_GAP_CONTROL)); ++ pr_debug(DRIVER_NAME ": Wake-up: 0x%08x | Clock: 0x%08x\n", ++ bcm2835_mmc_readb(host, SDHCI_WAKE_UP_CONTROL), ++ bcm2835_mmc_readw(host, SDHCI_CLOCK_CONTROL)); ++ pr_debug(DRIVER_NAME ": Timeout: 0x%08x | Int stat: 0x%08x\n", ++ bcm2835_mmc_readb(host, SDHCI_TIMEOUT_CONTROL), ++ bcm2835_mmc_readl(host, SDHCI_INT_STATUS)); ++ pr_debug(DRIVER_NAME ": Int enab: 0x%08x | Sig enab: 0x%08x\n", ++ bcm2835_mmc_readl(host, SDHCI_INT_ENABLE), ++ bcm2835_mmc_readl(host, SDHCI_SIGNAL_ENABLE)); ++ pr_debug(DRIVER_NAME ": AC12 err: 0x%08x | Slot int: 0x%08x\n", ++ bcm2835_mmc_readw(host, SDHCI_ACMD12_ERR), ++ bcm2835_mmc_readw(host, SDHCI_SLOT_INT_STATUS)); ++ pr_debug(DRIVER_NAME ": Caps: 0x%08x | Caps_1: 0x%08x\n", ++ bcm2835_mmc_readl(host, SDHCI_CAPABILITIES), ++ bcm2835_mmc_readl(host, SDHCI_CAPABILITIES_1)); ++ pr_debug(DRIVER_NAME ": Cmd: 0x%08x | Max curr: 0x%08x\n", ++ bcm2835_mmc_readw(host, SDHCI_COMMAND), ++ bcm2835_mmc_readl(host, SDHCI_MAX_CURRENT)); ++ pr_debug(DRIVER_NAME ": Host ctl2: 0x%08x\n", ++ bcm2835_mmc_readw(host, SDHCI_HOST_CONTROL2)); ++ ++ pr_debug(DRIVER_NAME ": ===========================================\n"); ++} ++ ++ ++static void bcm2835_mmc_reset(struct bcm2835_host *host, u8 mask) ++{ ++ unsigned long timeout; ++ unsigned long flags; ++ ++ spin_lock_irqsave(&host->lock, flags); ++ bcm2835_mmc_writeb(host, mask, SDHCI_SOFTWARE_RESET); ++ ++ if (mask & SDHCI_RESET_ALL) ++ host->clock = 0; ++ ++ /* Wait max 100 ms */ ++ timeout = 100; ++ ++ /* hw clears the bit when it's done */ ++ while (bcm2835_mmc_readb(host, SDHCI_SOFTWARE_RESET) & mask) { ++ if (timeout == 0) { ++ pr_err("%s: Reset 0x%x never completed.\n", ++ mmc_hostname(host->mmc), (int)mask); ++ bcm2835_mmc_dumpregs(host); ++ return; ++ } ++ timeout--; ++ spin_unlock_irqrestore(&host->lock, flags); ++ mdelay(1); ++ spin_lock_irqsave(&host->lock, flags); ++ } ++ ++ if (100-timeout > 10 && 100-timeout > host->max_delay) { ++ host->max_delay = 100-timeout; ++ pr_warning("Warning: MMC controller hung for %d ms\n", host->max_delay); ++ } ++ spin_unlock_irqrestore(&host->lock, flags); ++} ++ ++static void bcm2835_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios); ++ ++static void bcm2835_mmc_init(struct bcm2835_host *host, int soft) ++{ ++ unsigned long flags; ++ if (soft) ++ bcm2835_mmc_reset(host, SDHCI_RESET_CMD|SDHCI_RESET_DATA); ++ else ++ bcm2835_mmc_reset(host, SDHCI_RESET_ALL); ++ ++ host->ier = SDHCI_INT_BUS_POWER | SDHCI_INT_DATA_END_BIT | ++ SDHCI_INT_DATA_CRC | SDHCI_INT_DATA_TIMEOUT | ++ SDHCI_INT_INDEX | SDHCI_INT_END_BIT | SDHCI_INT_CRC | ++ SDHCI_INT_TIMEOUT | SDHCI_INT_DATA_END | ++ SDHCI_INT_RESPONSE; ++ ++ spin_lock_irqsave(&host->lock, flags); ++ bcm2835_mmc_writel(host, host->ier, SDHCI_INT_ENABLE, 3); ++ bcm2835_mmc_writel(host, host->ier, SDHCI_SIGNAL_ENABLE, 3); ++ spin_unlock_irqrestore(&host->lock, flags); ++ ++ if (soft) { ++ /* force clock reconfiguration */ ++ host->clock = 0; ++ bcm2835_mmc_set_ios(host->mmc, &host->mmc->ios); ++ } ++} ++ ++ ++ ++static void bcm2835_mmc_finish_data(struct bcm2835_host *host); ++ ++static void bcm2835_mmc_dma_complete(void *param) ++{ ++ struct bcm2835_host *host = param; ++ struct dma_chan *dma_chan; ++ unsigned long flags; ++ u32 dir_data; ++ ++ spin_lock_irqsave(&host->lock, flags); ++ ++ if (host->data && !(host->data->flags & MMC_DATA_WRITE)) { ++ /* otherwise handled in SDHCI IRQ */ ++ dma_chan = host->dma_chan_rxtx; ++ dir_data = DMA_FROM_DEVICE; ++ ++ dma_unmap_sg(dma_chan->device->dev, ++ host->data->sg, host->data->sg_len, ++ dir_data); ++ ++ bcm2835_mmc_finish_data(host); ++ } ++ ++ spin_unlock_irqrestore(&host->lock, flags); ++} ++ ++static void bcm2835_bcm2835_mmc_read_block_pio(struct bcm2835_host *host) ++{ ++ unsigned long flags; ++ size_t blksize, len, chunk; ++ ++ u32 uninitialized_var(scratch); ++ u8 *buf; ++ ++ blksize = host->data->blksz; ++ chunk = 0; ++ ++ local_irq_save(flags); ++ ++ while (blksize) { ++ if (!sg_miter_next(&host->sg_miter)) ++ BUG(); ++ ++ len = min(host->sg_miter.length, blksize); ++ ++ blksize -= len; ++ host->sg_miter.consumed = len; ++ ++ buf = host->sg_miter.addr; ++ ++ while (len) { ++ if (chunk == 0) { ++ scratch = bcm2835_mmc_readl(host, SDHCI_BUFFER); ++ chunk = 4; ++ } ++ ++ *buf = scratch & 0xFF; ++ ++ buf++; ++ scratch >>= 8; ++ chunk--; ++ len--; ++ } ++ } ++ ++ sg_miter_stop(&host->sg_miter); ++ ++ local_irq_restore(flags); ++} ++ ++static void bcm2835_bcm2835_mmc_write_block_pio(struct bcm2835_host *host) ++{ ++ unsigned long flags; ++ size_t blksize, len, chunk; ++ u32 scratch; ++ u8 *buf; ++ ++ blksize = host->data->blksz; ++ chunk = 0; ++ chunk = 0; ++ scratch = 0; ++ ++ local_irq_save(flags); ++ ++ while (blksize) { ++ if (!sg_miter_next(&host->sg_miter)) ++ BUG(); ++ ++ len = min(host->sg_miter.length, blksize); ++ ++ blksize -= len; ++ host->sg_miter.consumed = len; ++ ++ buf = host->sg_miter.addr; ++ ++ while (len) { ++ scratch |= (u32)*buf << (chunk * 8); ++ ++ buf++; ++ chunk++; ++ len--; ++ ++ if ((chunk == 4) || ((len == 0) && (blksize == 0))) { ++ mmc_raw_writel(host, scratch, SDHCI_BUFFER); ++ chunk = 0; ++ scratch = 0; ++ } ++ } ++ } ++ ++ sg_miter_stop(&host->sg_miter); ++ ++ local_irq_restore(flags); ++} ++ ++ ++static void bcm2835_mmc_transfer_pio(struct bcm2835_host *host) ++{ ++ u32 mask; ++ ++ BUG_ON(!host->data); ++ ++ if (host->blocks == 0) ++ return; ++ ++ if (host->data->flags & MMC_DATA_READ) ++ mask = SDHCI_DATA_AVAILABLE; ++ else ++ mask = SDHCI_SPACE_AVAILABLE; ++ ++ while (bcm2835_mmc_readl(host, SDHCI_PRESENT_STATE) & mask) { ++ ++ if (host->data->flags & MMC_DATA_READ) ++ bcm2835_bcm2835_mmc_read_block_pio(host); ++ else ++ bcm2835_bcm2835_mmc_write_block_pio(host); ++ ++ host->blocks--; ++ ++ /* QUIRK used in sdhci.c removes the 'if' */ ++ /* but it seems this is unnecessary */ ++ if (host->blocks == 0) ++ break; ++ ++ ++ } ++} ++ ++ ++static void bcm2835_mmc_transfer_dma(struct bcm2835_host *host) ++{ ++ u32 len, dir_data, dir_slave; ++ struct dma_async_tx_descriptor *desc = NULL; ++ struct dma_chan *dma_chan; ++ ++ ++ WARN_ON(!host->data); ++ ++ if (!host->data) ++ return; ++ ++ if (host->blocks == 0) ++ return; ++ ++ dma_chan = host->dma_chan_rxtx; ++ if (host->data->flags & MMC_DATA_READ) { ++ dir_data = DMA_FROM_DEVICE; ++ dir_slave = DMA_DEV_TO_MEM; ++ } else { ++ dir_data = DMA_TO_DEVICE; ++ dir_slave = DMA_MEM_TO_DEV; ++ } ++ ++ /* The parameters have already been validated, so this will not fail */ ++ (void)dmaengine_slave_config(dma_chan, ++ (dir_data == DMA_FROM_DEVICE) ? ++ &host->dma_cfg_rx : ++ &host->dma_cfg_tx); ++ ++ BUG_ON(!dma_chan->device); ++ BUG_ON(!dma_chan->device->dev); ++ BUG_ON(!host->data->sg); ++ ++ len = dma_map_sg(dma_chan->device->dev, host->data->sg, ++ host->data->sg_len, dir_data); ++ if (len > 0) { ++ desc = dmaengine_prep_slave_sg(dma_chan, host->data->sg, ++ len, dir_slave, ++ DMA_PREP_INTERRUPT | DMA_CTRL_ACK); ++ } else { ++ dev_err(mmc_dev(host->mmc), "dma_map_sg returned zero length\n"); ++ } ++ if (desc) { ++ unsigned long flags; ++ spin_lock_irqsave(&host->lock, flags); ++ bcm2835_mmc_unsignal_irqs(host, SDHCI_INT_DATA_AVAIL | ++ SDHCI_INT_SPACE_AVAIL); ++ host->tx_desc = desc; ++ desc->callback = bcm2835_mmc_dma_complete; ++ desc->callback_param = host; ++ spin_unlock_irqrestore(&host->lock, flags); ++ dmaengine_submit(desc); ++ dma_async_issue_pending(dma_chan); ++ } ++ ++} ++ ++ ++ ++static void bcm2835_mmc_set_transfer_irqs(struct bcm2835_host *host) ++{ ++ u32 pio_irqs = SDHCI_INT_DATA_AVAIL | SDHCI_INT_SPACE_AVAIL; ++ u32 dma_irqs = SDHCI_INT_DMA_END | SDHCI_INT_ADMA_ERROR; ++ ++ if (host->use_dma) ++ host->ier = (host->ier & ~pio_irqs) | dma_irqs; ++ else ++ host->ier = (host->ier & ~dma_irqs) | pio_irqs; ++ ++ bcm2835_mmc_writel(host, host->ier, SDHCI_INT_ENABLE, 4); ++ bcm2835_mmc_writel(host, host->ier, SDHCI_SIGNAL_ENABLE, 4); ++} ++ ++ ++static void bcm2835_mmc_prepare_data(struct bcm2835_host *host, struct mmc_command *cmd) ++{ ++ u8 count; ++ struct mmc_data *data = cmd->data; ++ ++ WARN_ON(host->data); ++ ++ if (data || (cmd->flags & MMC_RSP_BUSY)) { ++ count = TIMEOUT_VAL; ++ bcm2835_mmc_writeb(host, count, SDHCI_TIMEOUT_CONTROL); ++ } ++ ++ if (!data) ++ return; ++ ++ /* Sanity checks */ ++ BUG_ON(data->blksz * data->blocks > 524288); ++ BUG_ON(data->blksz > host->mmc->max_blk_size); ++ BUG_ON(data->blocks > 65535); ++ ++ host->data = data; ++ host->data_early = 0; ++ host->data->bytes_xfered = 0; ++ ++ ++ if (!(host->flags & SDHCI_REQ_USE_DMA)) { ++ int flags; ++ ++ flags = SG_MITER_ATOMIC; ++ if (host->data->flags & MMC_DATA_READ) ++ flags |= SG_MITER_TO_SG; ++ else ++ flags |= SG_MITER_FROM_SG; ++ sg_miter_start(&host->sg_miter, data->sg, data->sg_len, flags); ++ host->blocks = data->blocks; ++ } ++ ++ host->use_dma = host->have_dma && data->blocks > PIO_DMA_BARRIER; ++ ++ bcm2835_mmc_set_transfer_irqs(host); ++ ++ /* Set the DMA boundary value and block size */ ++ bcm2835_mmc_writew(host, SDHCI_MAKE_BLKSZ(SDHCI_DEFAULT_BOUNDARY_ARG, ++ data->blksz), SDHCI_BLOCK_SIZE); ++ bcm2835_mmc_writew(host, data->blocks, SDHCI_BLOCK_COUNT); ++ ++ BUG_ON(!host->data); ++} ++ ++static void bcm2835_mmc_set_transfer_mode(struct bcm2835_host *host, ++ struct mmc_command *cmd) ++{ ++ u16 mode; ++ struct mmc_data *data = cmd->data; ++ ++ if (data == NULL) { ++ /* clear Auto CMD settings for no data CMDs */ ++ mode = bcm2835_mmc_readw(host, SDHCI_TRANSFER_MODE); ++ bcm2835_mmc_writew(host, mode & ~(SDHCI_TRNS_AUTO_CMD12 | ++ SDHCI_TRNS_AUTO_CMD23), SDHCI_TRANSFER_MODE); ++ return; ++ } ++ ++ WARN_ON(!host->data); ++ ++ mode = SDHCI_TRNS_BLK_CNT_EN; ++ ++ if ((mmc_op_multi(cmd->opcode) || data->blocks > 1)) { ++ mode |= SDHCI_TRNS_MULTI; ++ ++ /* ++ * If we are sending CMD23, CMD12 never gets sent ++ * on successful completion (so no Auto-CMD12). ++ */ ++ if (!host->mrq->sbc && (host->flags & SDHCI_AUTO_CMD12)) ++ mode |= SDHCI_TRNS_AUTO_CMD12; ++ else if (host->mrq->sbc && (host->flags & SDHCI_AUTO_CMD23)) { ++ mode |= SDHCI_TRNS_AUTO_CMD23; ++ bcm2835_mmc_writel(host, host->mrq->sbc->arg, SDHCI_ARGUMENT2, 5); ++ } ++ } ++ ++ if (data->flags & MMC_DATA_READ) ++ mode |= SDHCI_TRNS_READ; ++ if (host->flags & SDHCI_REQ_USE_DMA) ++ mode |= SDHCI_TRNS_DMA; ++ ++ bcm2835_mmc_writew(host, mode, SDHCI_TRANSFER_MODE); ++} ++ ++void bcm2835_mmc_send_command(struct bcm2835_host *host, struct mmc_command *cmd) ++{ ++ int flags; ++ u32 mask; ++ unsigned long timeout; ++ ++ WARN_ON(host->cmd); ++ ++ /* Wait max 10 ms */ ++ timeout = 1000; ++ ++ mask = SDHCI_CMD_INHIBIT; ++ if ((cmd->data != NULL) || (cmd->flags & MMC_RSP_BUSY)) ++ mask |= SDHCI_DATA_INHIBIT; ++ ++ /* We shouldn't wait for data inihibit for stop commands, even ++ though they might use busy signaling */ ++ if (host->mrq->data && (cmd == host->mrq->data->stop)) ++ mask &= ~SDHCI_DATA_INHIBIT; ++ ++ while (bcm2835_mmc_readl(host, SDHCI_PRESENT_STATE) & mask) { ++ if (timeout == 0) { ++ pr_err("%s: Controller never released inhibit bit(s).\n", ++ mmc_hostname(host->mmc)); ++ bcm2835_mmc_dumpregs(host); ++ cmd->error = -EIO; ++ tasklet_schedule(&host->finish_tasklet); ++ return; ++ } ++ timeout--; ++ udelay(10); ++ } ++ ++ if ((1000-timeout)/100 > 1 && (1000-timeout)/100 > host->max_delay) { ++ host->max_delay = (1000-timeout)/100; ++ pr_warning("Warning: MMC controller hung for %d ms\n", host->max_delay); ++ } ++ ++ timeout = jiffies; ++ if (!cmd->data && cmd->busy_timeout > 9000) ++ timeout += DIV_ROUND_UP(cmd->busy_timeout, 1000) * HZ + HZ; ++ else ++ timeout += 10 * HZ; ++ mod_timer(&host->timer, timeout); ++ ++ host->cmd = cmd; ++ ++ bcm2835_mmc_prepare_data(host, cmd); ++ ++ bcm2835_mmc_writel(host, cmd->arg, SDHCI_ARGUMENT, 6); ++ ++ bcm2835_mmc_set_transfer_mode(host, cmd); ++ ++ if ((cmd->flags & MMC_RSP_136) && (cmd->flags & MMC_RSP_BUSY)) { ++ pr_err("%s: Unsupported response type!\n", ++ mmc_hostname(host->mmc)); ++ cmd->error = -EINVAL; ++ tasklet_schedule(&host->finish_tasklet); ++ return; ++ } ++ ++ if (!(cmd->flags & MMC_RSP_PRESENT)) ++ flags = SDHCI_CMD_RESP_NONE; ++ else if (cmd->flags & MMC_RSP_136) ++ flags = SDHCI_CMD_RESP_LONG; ++ else if (cmd->flags & MMC_RSP_BUSY) ++ flags = SDHCI_CMD_RESP_SHORT_BUSY; ++ else ++ flags = SDHCI_CMD_RESP_SHORT; ++ ++ if (cmd->flags & MMC_RSP_CRC) ++ flags |= SDHCI_CMD_CRC; ++ if (cmd->flags & MMC_RSP_OPCODE) ++ flags |= SDHCI_CMD_INDEX; ++ ++ if (cmd->data) ++ flags |= SDHCI_CMD_DATA; ++ ++ bcm2835_mmc_writew(host, SDHCI_MAKE_CMD(cmd->opcode, flags), SDHCI_COMMAND); ++} ++ ++ ++static void bcm2835_mmc_finish_data(struct bcm2835_host *host) ++{ ++ struct mmc_data *data; ++ ++ BUG_ON(!host->data); ++ ++ data = host->data; ++ host->data = NULL; ++ ++ if (data->error) ++ data->bytes_xfered = 0; ++ else ++ data->bytes_xfered = data->blksz * data->blocks; ++ ++ /* ++ * Need to send CMD12 if - ++ * a) open-ended multiblock transfer (no CMD23) ++ * b) error in multiblock transfer ++ */ ++ if (data->stop && ++ (data->error || ++ !host->mrq->sbc)) { ++ ++ /* ++ * The controller needs a reset of internal state machines ++ * upon error conditions. ++ */ ++ if (data->error) { ++ bcm2835_mmc_reset(host, SDHCI_RESET_CMD); ++ bcm2835_mmc_reset(host, SDHCI_RESET_DATA); ++ } ++ ++ bcm2835_mmc_send_command(host, data->stop); ++ } else ++ tasklet_schedule(&host->finish_tasklet); ++} ++ ++static void bcm2835_mmc_finish_command(struct bcm2835_host *host) ++{ ++ int i; ++ ++ BUG_ON(host->cmd == NULL); ++ ++ if (host->cmd->flags & MMC_RSP_PRESENT) { ++ if (host->cmd->flags & MMC_RSP_136) { ++ /* CRC is stripped so we need to do some shifting. */ ++ for (i = 0; i < 4; i++) { ++ host->cmd->resp[i] = bcm2835_mmc_readl(host, ++ SDHCI_RESPONSE + (3-i)*4) << 8; ++ if (i != 3) ++ host->cmd->resp[i] |= ++ bcm2835_mmc_readb(host, ++ SDHCI_RESPONSE + (3-i)*4-1); ++ } ++ } else { ++ host->cmd->resp[0] = bcm2835_mmc_readl(host, SDHCI_RESPONSE); ++ } ++ } ++ ++ host->cmd->error = 0; ++ ++ /* Finished CMD23, now send actual command. */ ++ if (host->cmd == host->mrq->sbc) { ++ host->cmd = NULL; ++ bcm2835_mmc_send_command(host, host->mrq->cmd); ++ ++ if (host->mrq->cmd->data && host->use_dma) { ++ /* DMA transfer starts now, PIO starts after interrupt */ ++ bcm2835_mmc_transfer_dma(host); ++ } ++ } else { ++ ++ /* Processed actual command. */ ++ if (host->data && host->data_early) ++ bcm2835_mmc_finish_data(host); ++ ++ if (!host->cmd->data) ++ tasklet_schedule(&host->finish_tasklet); ++ ++ host->cmd = NULL; ++ } ++} ++ ++ ++static void bcm2835_mmc_timeout_timer(unsigned long data) ++{ ++ struct bcm2835_host *host; ++ unsigned long flags; ++ ++ host = (struct bcm2835_host *)data; ++ ++ spin_lock_irqsave(&host->lock, flags); ++ ++ if (host->mrq) { ++ pr_err("%s: Timeout waiting for hardware interrupt.\n", ++ mmc_hostname(host->mmc)); ++ bcm2835_mmc_dumpregs(host); ++ ++ if (host->data) { ++ host->data->error = -ETIMEDOUT; ++ bcm2835_mmc_finish_data(host); ++ } else { ++ if (host->cmd) ++ host->cmd->error = -ETIMEDOUT; ++ else ++ host->mrq->cmd->error = -ETIMEDOUT; ++ ++ tasklet_schedule(&host->finish_tasklet); ++ } ++ } ++ ++ mmiowb(); ++ spin_unlock_irqrestore(&host->lock, flags); ++} ++ ++ ++static void bcm2835_mmc_enable_sdio_irq_nolock(struct bcm2835_host *host, int enable) ++{ ++ if (!(host->flags & SDHCI_DEVICE_DEAD)) { ++ if (enable) ++ host->ier |= SDHCI_INT_CARD_INT; ++ else ++ host->ier &= ~SDHCI_INT_CARD_INT; ++ ++ bcm2835_mmc_writel(host, host->ier, SDHCI_INT_ENABLE, 7); ++ bcm2835_mmc_writel(host, host->ier, SDHCI_SIGNAL_ENABLE, 7); ++ mmiowb(); ++ } ++} ++ ++static void bcm2835_mmc_enable_sdio_irq(struct mmc_host *mmc, int enable) ++{ ++ struct bcm2835_host *host = mmc_priv(mmc); ++ unsigned long flags; ++ ++ spin_lock_irqsave(&host->lock, flags); ++ if (enable) ++ host->flags |= SDHCI_SDIO_IRQ_ENABLED; ++ else ++ host->flags &= ~SDHCI_SDIO_IRQ_ENABLED; ++ ++ bcm2835_mmc_enable_sdio_irq_nolock(host, enable); ++ spin_unlock_irqrestore(&host->lock, flags); ++} ++ ++static void bcm2835_mmc_cmd_irq(struct bcm2835_host *host, u32 intmask) ++{ ++ ++ BUG_ON(intmask == 0); ++ ++ if (!host->cmd) { ++ pr_err("%s: Got command interrupt 0x%08x even " ++ "though no command operation was in progress.\n", ++ mmc_hostname(host->mmc), (unsigned)intmask); ++ bcm2835_mmc_dumpregs(host); ++ return; ++ } ++ ++ if (intmask & SDHCI_INT_TIMEOUT) ++ host->cmd->error = -ETIMEDOUT; ++ else if (intmask & (SDHCI_INT_CRC | SDHCI_INT_END_BIT | ++ SDHCI_INT_INDEX)) { ++ host->cmd->error = -EILSEQ; ++ } ++ ++ if (host->cmd->error) { ++ tasklet_schedule(&host->finish_tasklet); ++ return; ++ } ++ ++ if (intmask & SDHCI_INT_RESPONSE) ++ bcm2835_mmc_finish_command(host); ++ ++} ++ ++static void bcm2835_mmc_data_irq(struct bcm2835_host *host, u32 intmask) ++{ ++ struct dma_chan *dma_chan; ++ u32 dir_data; ++ ++ BUG_ON(intmask == 0); ++ ++ if (!host->data) { ++ /* ++ * The "data complete" interrupt is also used to ++ * indicate that a busy state has ended. See comment ++ * above in sdhci_cmd_irq(). ++ */ ++ if (host->cmd && (host->cmd->flags & MMC_RSP_BUSY)) { ++ if (intmask & SDHCI_INT_DATA_END) { ++ bcm2835_mmc_finish_command(host); ++ return; ++ } ++ } ++ ++ pr_debug("%s: Got data interrupt 0x%08x even " ++ "though no data operation was in progress.\n", ++ mmc_hostname(host->mmc), (unsigned)intmask); ++ bcm2835_mmc_dumpregs(host); ++ ++ return; ++ } ++ ++ if (intmask & SDHCI_INT_DATA_TIMEOUT) ++ host->data->error = -ETIMEDOUT; ++ else if (intmask & SDHCI_INT_DATA_END_BIT) ++ host->data->error = -EILSEQ; ++ else if ((intmask & SDHCI_INT_DATA_CRC) && ++ SDHCI_GET_CMD(bcm2835_mmc_readw(host, SDHCI_COMMAND)) ++ != MMC_BUS_TEST_R) ++ host->data->error = -EILSEQ; ++ ++ if (host->use_dma) { ++ if (host->data->flags & MMC_DATA_WRITE) { ++ /* IRQ handled here */ ++ ++ dma_chan = host->dma_chan_rxtx; ++ dir_data = DMA_TO_DEVICE; ++ dma_unmap_sg(dma_chan->device->dev, ++ host->data->sg, host->data->sg_len, ++ dir_data); ++ ++ bcm2835_mmc_finish_data(host); ++ } ++ ++ } else { ++ if (host->data->error) ++ bcm2835_mmc_finish_data(host); ++ else { ++ if (intmask & (SDHCI_INT_DATA_AVAIL | SDHCI_INT_SPACE_AVAIL)) ++ bcm2835_mmc_transfer_pio(host); ++ ++ if (intmask & SDHCI_INT_DATA_END) { ++ if (host->cmd) { ++ /* ++ * Data managed to finish before the ++ * command completed. Make sure we do ++ * things in the proper order. ++ */ ++ host->data_early = 1; ++ } else { ++ bcm2835_mmc_finish_data(host); ++ } ++ } ++ } ++ } ++} ++ ++ ++static irqreturn_t bcm2835_mmc_irq(int irq, void *dev_id) ++{ ++ irqreturn_t result = IRQ_NONE; ++ struct bcm2835_host *host = dev_id; ++ u32 intmask, mask, unexpected = 0; ++ int max_loops = 16; ++ ++ spin_lock(&host->lock); ++ ++ intmask = bcm2835_mmc_readl(host, SDHCI_INT_STATUS); ++ ++ if (!intmask || intmask == 0xffffffff) { ++ result = IRQ_NONE; ++ goto out; ++ } ++ ++ do { ++ /* Clear selected interrupts. */ ++ mask = intmask & (SDHCI_INT_CMD_MASK | SDHCI_INT_DATA_MASK | ++ SDHCI_INT_BUS_POWER); ++ bcm2835_mmc_writel(host, mask, SDHCI_INT_STATUS, 8); ++ ++ ++ if (intmask & SDHCI_INT_CMD_MASK) ++ bcm2835_mmc_cmd_irq(host, intmask & SDHCI_INT_CMD_MASK); ++ ++ if (intmask & SDHCI_INT_DATA_MASK) ++ bcm2835_mmc_data_irq(host, intmask & SDHCI_INT_DATA_MASK); ++ ++ if (intmask & SDHCI_INT_BUS_POWER) ++ pr_err("%s: Card is consuming too much power!\n", ++ mmc_hostname(host->mmc)); ++ ++ if (intmask & SDHCI_INT_CARD_INT) { ++ bcm2835_mmc_enable_sdio_irq_nolock(host, false); ++ host->thread_isr |= SDHCI_INT_CARD_INT; ++ result = IRQ_WAKE_THREAD; ++ } ++ ++ intmask &= ~(SDHCI_INT_CARD_INSERT | SDHCI_INT_CARD_REMOVE | ++ SDHCI_INT_CMD_MASK | SDHCI_INT_DATA_MASK | ++ SDHCI_INT_ERROR | SDHCI_INT_BUS_POWER | ++ SDHCI_INT_CARD_INT); ++ ++ if (intmask) { ++ unexpected |= intmask; ++ bcm2835_mmc_writel(host, intmask, SDHCI_INT_STATUS, 9); ++ } ++ ++ if (result == IRQ_NONE) ++ result = IRQ_HANDLED; ++ ++ intmask = bcm2835_mmc_readl(host, SDHCI_INT_STATUS); ++ } while (intmask && --max_loops); ++out: ++ spin_unlock(&host->lock); ++ ++ if (unexpected) { ++ pr_err("%s: Unexpected interrupt 0x%08x.\n", ++ mmc_hostname(host->mmc), unexpected); ++ bcm2835_mmc_dumpregs(host); ++ } ++ ++ return result; ++} ++ ++static irqreturn_t bcm2835_mmc_thread_irq(int irq, void *dev_id) ++{ ++ struct bcm2835_host *host = dev_id; ++ unsigned long flags; ++ u32 isr; ++ ++ spin_lock_irqsave(&host->lock, flags); ++ isr = host->thread_isr; ++ host->thread_isr = 0; ++ spin_unlock_irqrestore(&host->lock, flags); ++ ++ if (isr & SDHCI_INT_CARD_INT) { ++ sdio_run_irqs(host->mmc); ++ ++ spin_lock_irqsave(&host->lock, flags); ++ if (host->flags & SDHCI_SDIO_IRQ_ENABLED) ++ bcm2835_mmc_enable_sdio_irq_nolock(host, true); ++ spin_unlock_irqrestore(&host->lock, flags); ++ } ++ ++ return isr ? IRQ_HANDLED : IRQ_NONE; ++} ++ ++ ++ ++void bcm2835_mmc_set_clock(struct bcm2835_host *host, unsigned int clock) ++{ ++ int div = 0; /* Initialized for compiler warning */ ++ int real_div = div, clk_mul = 1; ++ u16 clk = 0; ++ unsigned long timeout; ++ unsigned int input_clock = clock; ++ ++ if (host->overclock_50 && (clock == 50000000)) ++ clock = host->overclock_50 * 1000000 + 999999; ++ ++ host->mmc->actual_clock = 0; ++ ++ bcm2835_mmc_writew(host, 0, SDHCI_CLOCK_CONTROL); ++ ++ if (clock == 0) ++ return; ++ ++ /* Version 3.00 divisors must be a multiple of 2. */ ++ if (host->max_clk <= clock) ++ div = 1; ++ else { ++ for (div = 2; div < SDHCI_MAX_DIV_SPEC_300; ++ div += 2) { ++ if ((host->max_clk / div) <= clock) ++ break; ++ } ++ } ++ ++ real_div = div; ++ div >>= 1; ++ ++ if (real_div) ++ clock = (host->max_clk * clk_mul) / real_div; ++ host->mmc->actual_clock = clock; ++ ++ if ((clock > input_clock) && (clock > host->max_overclock)) { ++ pr_warn("%s: Overclocking to %dHz\n", ++ mmc_hostname(host->mmc), clock); ++ host->max_overclock = clock; ++ } ++ ++ clk |= (div & SDHCI_DIV_MASK) << SDHCI_DIVIDER_SHIFT; ++ clk |= ((div & SDHCI_DIV_HI_MASK) >> SDHCI_DIV_MASK_LEN) ++ << SDHCI_DIVIDER_HI_SHIFT; ++ clk |= SDHCI_CLOCK_INT_EN; ++ bcm2835_mmc_writew(host, clk, SDHCI_CLOCK_CONTROL); ++ ++ /* Wait max 20 ms */ ++ timeout = 20; ++ while (!((clk = bcm2835_mmc_readw(host, SDHCI_CLOCK_CONTROL)) ++ & SDHCI_CLOCK_INT_STABLE)) { ++ if (timeout == 0) { ++ pr_err("%s: Internal clock never " ++ "stabilised.\n", mmc_hostname(host->mmc)); ++ bcm2835_mmc_dumpregs(host); ++ return; ++ } ++ timeout--; ++ mdelay(1); ++ } ++ ++ if (20-timeout > 10 && 20-timeout > host->max_delay) { ++ host->max_delay = 20-timeout; ++ pr_warning("Warning: MMC controller hung for %d ms\n", host->max_delay); ++ } ++ ++ clk |= SDHCI_CLOCK_CARD_EN; ++ bcm2835_mmc_writew(host, clk, SDHCI_CLOCK_CONTROL); ++} ++ ++static void bcm2835_mmc_request(struct mmc_host *mmc, struct mmc_request *mrq) ++{ ++ struct bcm2835_host *host; ++ unsigned long flags; ++ ++ host = mmc_priv(mmc); ++ ++ spin_lock_irqsave(&host->lock, flags); ++ ++ WARN_ON(host->mrq != NULL); ++ ++ host->mrq = mrq; ++ ++ if (mrq->sbc && !(host->flags & SDHCI_AUTO_CMD23)) ++ bcm2835_mmc_send_command(host, mrq->sbc); ++ else ++ bcm2835_mmc_send_command(host, mrq->cmd); ++ ++ mmiowb(); ++ spin_unlock_irqrestore(&host->lock, flags); ++ ++ if (!(mrq->sbc && !(host->flags & SDHCI_AUTO_CMD23)) && mrq->cmd->data && host->use_dma) { ++ /* DMA transfer starts now, PIO starts after interrupt */ ++ bcm2835_mmc_transfer_dma(host); ++ } ++} ++ ++ ++static void bcm2835_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) ++{ ++ ++ struct bcm2835_host *host = mmc_priv(mmc); ++ unsigned long flags; ++ u8 ctrl; ++ u16 clk, ctrl_2; ++ ++ pr_debug("bcm2835_mmc_set_ios: clock %d, pwr %d, bus_width %d, timing %d, vdd %d, drv_type %d\n", ++ ios->clock, ios->power_mode, ios->bus_width, ++ ios->timing, ios->signal_voltage, ios->drv_type); ++ ++ spin_lock_irqsave(&host->lock, flags); ++ ++ if (!ios->clock || ios->clock != host->clock) { ++ bcm2835_mmc_set_clock(host, ios->clock); ++ host->clock = ios->clock; ++ } ++ ++ if (host->pwr != SDHCI_POWER_330) { ++ host->pwr = SDHCI_POWER_330; ++ bcm2835_mmc_writeb(host, SDHCI_POWER_330 | SDHCI_POWER_ON, SDHCI_POWER_CONTROL); ++ } ++ ++ ctrl = bcm2835_mmc_readb(host, SDHCI_HOST_CONTROL); ++ ++ /* set bus width */ ++ ctrl &= ~SDHCI_CTRL_8BITBUS; ++ if (ios->bus_width == MMC_BUS_WIDTH_4) ++ ctrl |= SDHCI_CTRL_4BITBUS; ++ else ++ ctrl &= ~SDHCI_CTRL_4BITBUS; ++ ++ ctrl &= ~SDHCI_CTRL_HISPD; /* NO_HISPD_BIT */ ++ ++ ++ bcm2835_mmc_writeb(host, ctrl, SDHCI_HOST_CONTROL); ++ /* ++ * We only need to set Driver Strength if the ++ * preset value enable is not set. ++ */ ++ ctrl_2 = bcm2835_mmc_readw(host, SDHCI_HOST_CONTROL2); ++ ctrl_2 &= ~SDHCI_CTRL_DRV_TYPE_MASK; ++ if (ios->drv_type == MMC_SET_DRIVER_TYPE_A) ++ ctrl_2 |= SDHCI_CTRL_DRV_TYPE_A; ++ else if (ios->drv_type == MMC_SET_DRIVER_TYPE_C) ++ ctrl_2 |= SDHCI_CTRL_DRV_TYPE_C; ++ ++ bcm2835_mmc_writew(host, ctrl_2, SDHCI_HOST_CONTROL2); ++ ++ /* Reset SD Clock Enable */ ++ clk = bcm2835_mmc_readw(host, SDHCI_CLOCK_CONTROL); ++ clk &= ~SDHCI_CLOCK_CARD_EN; ++ bcm2835_mmc_writew(host, clk, SDHCI_CLOCK_CONTROL); ++ ++ /* Re-enable SD Clock */ ++ bcm2835_mmc_set_clock(host, host->clock); ++ bcm2835_mmc_writeb(host, ctrl, SDHCI_HOST_CONTROL); ++ ++ mmiowb(); ++ ++ spin_unlock_irqrestore(&host->lock, flags); ++} ++ ++ ++static struct mmc_host_ops bcm2835_ops = { ++ .request = bcm2835_mmc_request, ++ .set_ios = bcm2835_mmc_set_ios, ++ .enable_sdio_irq = bcm2835_mmc_enable_sdio_irq, ++}; ++ ++ ++static void bcm2835_mmc_tasklet_finish(unsigned long param) ++{ ++ struct bcm2835_host *host; ++ unsigned long flags; ++ struct mmc_request *mrq; ++ ++ host = (struct bcm2835_host *)param; ++ ++ spin_lock_irqsave(&host->lock, flags); ++ ++ /* ++ * If this tasklet gets rescheduled while running, it will ++ * be run again afterwards but without any active request. ++ */ ++ if (!host->mrq) { ++ spin_unlock_irqrestore(&host->lock, flags); ++ return; ++ } ++ ++ del_timer(&host->timer); ++ ++ mrq = host->mrq; ++ ++ /* ++ * The controller needs a reset of internal state machines ++ * upon error conditions. ++ */ ++ if (!(host->flags & SDHCI_DEVICE_DEAD) && ++ ((mrq->cmd && mrq->cmd->error) || ++ (mrq->data && (mrq->data->error || ++ (mrq->data->stop && mrq->data->stop->error))))) { ++ ++ spin_unlock_irqrestore(&host->lock, flags); ++ bcm2835_mmc_reset(host, SDHCI_RESET_CMD); ++ bcm2835_mmc_reset(host, SDHCI_RESET_DATA); ++ spin_lock_irqsave(&host->lock, flags); ++ } ++ ++ host->mrq = NULL; ++ host->cmd = NULL; ++ host->data = NULL; ++ ++ mmiowb(); ++ ++ spin_unlock_irqrestore(&host->lock, flags); ++ mmc_request_done(host->mmc, mrq); ++} ++ ++ ++ ++static int bcm2835_mmc_add_host(struct bcm2835_host *host) ++{ ++ struct mmc_host *mmc = host->mmc; ++ struct device *dev = mmc->parent; ++#ifndef FORCE_PIO ++ struct dma_slave_config cfg; ++#endif ++ int ret; ++ ++ bcm2835_mmc_reset(host, SDHCI_RESET_ALL); ++ ++ host->clk_mul = 0; ++ ++ mmc->f_max = host->max_clk; ++ mmc->f_max = host->max_clk; ++ mmc->f_min = host->max_clk / SDHCI_MAX_DIV_SPEC_300; ++ ++ /* SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK */ ++ host->timeout_clk = mmc->f_max / 1000; ++ mmc->max_busy_timeout = (1 << 27) / host->timeout_clk; ++ ++ /* host controller capabilities */ ++ mmc->caps |= MMC_CAP_CMD23 | MMC_CAP_ERASE | MMC_CAP_NEEDS_POLL | ++ MMC_CAP_SDIO_IRQ | MMC_CAP_SD_HIGHSPEED | ++ MMC_CAP_MMC_HIGHSPEED; ++ ++ mmc->caps2 |= MMC_CAP2_SDIO_IRQ_NOTHREAD; ++ ++ host->flags = SDHCI_AUTO_CMD23; ++ ++ dev_info(dev, "mmc_debug:%x mmc_debug2:%x\n", mmc_debug, mmc_debug2); ++#ifdef FORCE_PIO ++ dev_info(dev, "Forcing PIO mode\n"); ++ host->have_dma = false; ++#else ++ if (IS_ERR_OR_NULL(host->dma_chan_rxtx)) { ++ dev_err(dev, "%s: Unable to initialise DMA channel. Falling back to PIO\n", ++ DRIVER_NAME); ++ host->have_dma = false; ++ } else { ++ dev_info(dev, "DMA channel allocated"); ++ ++ cfg.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; ++ cfg.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; ++ cfg.slave_id = 11; /* DREQ channel */ ++ ++ /* Validate the slave configurations */ ++ ++ cfg.direction = DMA_MEM_TO_DEV; ++ cfg.src_addr = 0; ++ cfg.dst_addr = host->bus_addr + SDHCI_BUFFER; ++ ++ ret = dmaengine_slave_config(host->dma_chan_rxtx, &cfg); ++ ++ if (ret == 0) { ++ host->dma_cfg_tx = cfg; ++ ++ cfg.direction = DMA_DEV_TO_MEM; ++ cfg.src_addr = host->bus_addr + SDHCI_BUFFER; ++ cfg.dst_addr = 0; ++ ++ ret = dmaengine_slave_config(host->dma_chan_rxtx, &cfg); ++ } ++ ++ if (ret == 0) { ++ host->dma_cfg_rx = cfg; ++ ++ host->use_dma = true; ++ } else { ++ pr_err("%s: unable to configure DMA channel. " ++ "Faling back to PIO\n", ++ mmc_hostname(mmc)); ++ dma_release_channel(host->dma_chan_rxtx); ++ host->dma_chan_rxtx = NULL; ++ host->use_dma = false; ++ } ++ } ++#endif ++ mmc->max_segs = 128; ++ mmc->max_req_size = 524288; ++ mmc->max_seg_size = mmc->max_req_size; ++ mmc->max_blk_size = 512; ++ mmc->max_blk_count = 65535; ++ ++ /* report supported voltage ranges */ ++ mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34; ++ ++ tasklet_init(&host->finish_tasklet, ++ bcm2835_mmc_tasklet_finish, (unsigned long)host); ++ ++ setup_timer(&host->timer, bcm2835_mmc_timeout_timer, (unsigned long)host); ++ init_waitqueue_head(&host->buf_ready_int); ++ ++ bcm2835_mmc_init(host, 0); ++ ret = devm_request_threaded_irq(dev, host->irq, bcm2835_mmc_irq, ++ bcm2835_mmc_thread_irq, IRQF_SHARED, ++ mmc_hostname(mmc), host); ++ if (ret) { ++ dev_err(dev, "Failed to request IRQ %d: %d\n", host->irq, ret); ++ goto untasklet; ++ } ++ ++ mmiowb(); ++ mmc_add_host(mmc); ++ ++ return 0; ++ ++untasklet: ++ tasklet_kill(&host->finish_tasklet); ++ ++ return ret; ++} ++ ++static int bcm2835_mmc_probe(struct platform_device *pdev) ++{ ++ struct device *dev = &pdev->dev; ++ struct device_node *node = dev->of_node; ++ struct clk *clk; ++ struct resource *iomem; ++ struct bcm2835_host *host; ++ struct mmc_host *mmc; ++ const __be32 *addr; ++ int ret; ++ ++ mmc = mmc_alloc_host(sizeof(*host), dev); ++ if (!mmc) ++ return -ENOMEM; ++ ++ mmc->ops = &bcm2835_ops; ++ host = mmc_priv(mmc); ++ host->mmc = mmc; ++ host->timeout = msecs_to_jiffies(1000); ++ spin_lock_init(&host->lock); ++ ++ iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0); ++ host->ioaddr = devm_ioremap_resource(dev, iomem); ++ if (IS_ERR(host->ioaddr)) { ++ ret = PTR_ERR(host->ioaddr); ++ goto err; ++ } ++ ++ addr = of_get_address(node, 0, NULL, NULL); ++ if (!addr) { ++ dev_err(dev, "could not get DMA-register address\n"); ++ return -ENODEV; ++ } ++ host->bus_addr = be32_to_cpup(addr); ++ pr_debug(" - ioaddr %lx, iomem->start %lx, bus_addr %lx\n", ++ (unsigned long)host->ioaddr, ++ (unsigned long)iomem->start, ++ (unsigned long)host->bus_addr); ++ ++#ifndef FORCE_PIO ++ if (node) { ++ host->dma_chan_rxtx = dma_request_slave_channel(dev, "rx-tx"); ++ if (!host->dma_chan_rxtx) ++ host->dma_chan_rxtx = ++ dma_request_slave_channel(dev, "tx"); ++ if (!host->dma_chan_rxtx) ++ host->dma_chan_rxtx = ++ dma_request_slave_channel(dev, "rx"); ++ } else { ++ dma_cap_mask_t mask; ++ ++ dma_cap_zero(mask); ++ /* we don't care about the channel, any would work */ ++ dma_cap_set(DMA_SLAVE, mask); ++ host->dma_chan_rxtx = dma_request_channel(mask, NULL, NULL); ++ } ++#endif ++ clk = devm_clk_get(dev, NULL); ++ if (IS_ERR(clk)) { ++ dev_err(dev, "could not get clk\n"); ++ ret = PTR_ERR(clk); ++ goto err; ++ } ++ ++ host->max_clk = clk_get_rate(clk); ++ ++ host->irq = platform_get_irq(pdev, 0); ++ if (host->irq <= 0) { ++ dev_err(dev, "get IRQ failed\n"); ++ ret = -EINVAL; ++ goto err; ++ } ++ ++ if (node) { ++ mmc_of_parse(mmc); ++ ++ /* Read any custom properties */ ++ of_property_read_u32(node, ++ "brcm,overclock-50", ++ &host->overclock_50); ++ } else { ++ mmc->caps |= MMC_CAP_4_BIT_DATA; ++ } ++ ++ ret = bcm2835_mmc_add_host(host); ++ if (ret) ++ goto err; ++ ++ platform_set_drvdata(pdev, host); ++ ++ return 0; ++err: ++ mmc_free_host(mmc); ++ ++ return ret; ++} ++ ++static int bcm2835_mmc_remove(struct platform_device *pdev) ++{ ++ struct bcm2835_host *host = platform_get_drvdata(pdev); ++ unsigned long flags; ++ int dead; ++ u32 scratch; ++ ++ dead = 0; ++ scratch = bcm2835_mmc_readl(host, SDHCI_INT_STATUS); ++ if (scratch == (u32)-1) ++ dead = 1; ++ ++ ++ if (dead) { ++ spin_lock_irqsave(&host->lock, flags); ++ ++ host->flags |= SDHCI_DEVICE_DEAD; ++ ++ if (host->mrq) { ++ pr_err("%s: Controller removed during " ++ " transfer!\n", mmc_hostname(host->mmc)); ++ ++ host->mrq->cmd->error = -ENOMEDIUM; ++ tasklet_schedule(&host->finish_tasklet); ++ } ++ ++ spin_unlock_irqrestore(&host->lock, flags); ++ } ++ ++ mmc_remove_host(host->mmc); ++ ++ if (!dead) ++ bcm2835_mmc_reset(host, SDHCI_RESET_ALL); ++ ++ free_irq(host->irq, host); ++ ++ del_timer_sync(&host->timer); ++ ++ tasklet_kill(&host->finish_tasklet); ++ ++ mmc_free_host(host->mmc); ++ platform_set_drvdata(pdev, NULL); ++ ++ return 0; ++} ++ ++ ++static const struct of_device_id bcm2835_mmc_match[] = { ++ { .compatible = "brcm,bcm2835-mmc" }, ++ { } ++}; ++MODULE_DEVICE_TABLE(of, bcm2835_mmc_match); ++ ++ ++ ++static struct platform_driver bcm2835_mmc_driver = { ++ .probe = bcm2835_mmc_probe, ++ .remove = bcm2835_mmc_remove, ++ .driver = { ++ .name = DRIVER_NAME, ++ .owner = THIS_MODULE, ++ .of_match_table = bcm2835_mmc_match, ++ }, ++}; ++module_platform_driver(bcm2835_mmc_driver); ++ ++module_param(mmc_debug, uint, 0644); ++module_param(mmc_debug2, uint, 0644); ++MODULE_ALIAS("platform:mmc-bcm2835"); ++MODULE_DESCRIPTION("BCM2835 SDHCI driver"); ++MODULE_LICENSE("GPL v2"); ++MODULE_AUTHOR("Gellert Weisz"); + +From 56c375164a7120be703d11e3614f78b3e5cb784d Mon Sep 17 00:00:00 2001 +From: Phil Elwell <phil@raspberrypi.org> +Date: Wed, 25 Mar 2015 17:49:47 +0000 +Subject: [PATCH 037/112] Adding bcm2835-sdhost driver, and an overlay to + enable it + +BCM2835 has two SD card interfaces. This driver uses the other one. + +bcm2835-sdhost: Error handling fix, and code clarification + +bcm2835-sdhost: Adding overclocking option + +Allow a different clock speed to be substitued for a requested 50MHz. +This option is exposed using the "overclock_50" DT parameter. +Note that the sdhost interface is restricted to integer divisions of +core_freq, and the highest sensible option for a core_freq of 250MHz +is 84 (250/3 = 83.3MHz), the next being 125 (250/2) which is much too +high. + +Use at your own risk. + +bcm2835-sdhost: Round up the overclock, so 62 works for 62.5Mhz + +Also only warn once for each overclock setting. + +bcm2835-sdhost: Improve error handling and recovery + +1) Expose the hw_reset method to the MMC framework, removing many + internal calls by the driver. + +2) Reduce overclock setting on error. + +3) Increase timeout to cope with high capacity cards. + +4) Add properties and parameters to control pio_limit and debug. + +5) Reduce messages at probe time. + +bcm2835-sdhost: Further improve overclock back-off + +bcm2835-sdhost: Clear HBLC for PIO mode + +Also update pio_limit default in overlay README. + +bcm2835-sdhost: Add the ERASE capability + +See: https://github.com/raspberrypi/linux/issues/1076 + +bcm2835-sdhost: Ignore CRC7 for MMC CMD1 + +It seems that the sdhost interface returns CRC7 errors for CMD1, +which is the MMC-specific SEND_OP_COND. Returning these errors to +the MMC layer causes a downward spiral, but ignoring them seems +to be harmless. + +bcm2835-mmc/sdhost: Remove ARCH_BCM2835 differences + +The bcm2835-mmc driver (and -sdhost driver that copied from it) +contains code to handle SDIO interrupts in a threaded interrupt +handler rather than waking the MMC framework thread. The change +follows a patch from Russell King that adds the facility as the +preferred way of working. + +However, the new code path is only present in ARCH_BCM2835 +builds, which I have taken to be a way of testing the waters +rather than making the change across the board; I can't see +any technical reason why it wouldn't be enabled for MACH_BCM270X +builds. So this patch standardises on the ARCH_BCM2835 code, +removing the old code paths. + +bcm2835-sdhost: Don't log timeout errors unless debug=1 + +The MMC card-discovery process generates timeouts. This is +expected behaviour, so reporting it to the user serves no purpose. +Suppress the reporting of timeout errors unless the debug flag +is on. + +bcm2835-sdhost: Add workaround for odd behaviour on some cards + +For reasons not understood, the sdhost driver fails when reading +sectors very near the end of some SD cards. The problem could +be related to the similar issue that reading the final sector +of any card as part of a multiple read never completes, and the +workaround is an extension of the mechanism introduced to solve +that problem which ensures those sectors are always read singly. + +bcm2835-sdhost: Major revision + +This is a significant revision of the bcm2835-sdhost driver. It +improves on the original in a number of ways: + +1) Through the use of CMD23 for reads it appears to avoid problems + reading some sectors on certain high speed cards. +2) Better atomicity to prevent crashes. +3) Higher performance. +4) Activity logging included, for easier diagnosis in the event + of a problem. + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> + +bcm2835-sdhost: Restore ATOMIC flag to PIO sg mapping + +Allocation problems have been seen in a wireless driver, and +this is the only change which might have been responsible. + +SQUASH: bcm2835-sdhost: Only claim one DMA channel + +With both MMC controllers enabled there are few DMA channels left. The +bcm2835-sdhost driver only uses DMA in one direction at a time, so it +doesn't need to claim two channels. + +See: https://github.com/raspberrypi/linux/issues/1327 + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> + +bcm2835-sdhost: Workaround for "slow" sectors + +Some cards have been seen to cause timeouts after certain sectors are +read. This workaround enforces a minimum delay between the stop after +reading one of those sectors and a subsequent data command. + +Using CMD23 (SET_BLOCK_COUNT) avoids this problem, so good cards will +not be penalised by this workaround. + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> + +bcm2835-sdhost: Firmware manages the clock divisor + +The bcm2835-sdhost driver hands control of the CDIV clock divisor +register to matching firmware, allowing it to adjust to a changing +core clock. This removes the need to use the performance governor or +to enable io_is_busy on the on-demand governor in order to get the +best SD performance. + +N.B. As SD clocks must be an integer divisor of the core clock, it is +possible that the SD clock for "turbo" mode can be different (even +lower) than "normal" mode. + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> + +bcm2835-sdhost: Reset the clock in task context + +Since reprogramming the clock can now involve a round-trip to the +firmware it must not be done at atomic context, and a tasklet +is not a task. + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> +--- + drivers/mmc/host/Kconfig | 10 + + drivers/mmc/host/Makefile | 1 + + drivers/mmc/host/bcm2835-sdhost.c | 2158 +++++++++++++++++++++++++++++++++++++ + 3 files changed, 2169 insertions(+) + create mode 100644 drivers/mmc/host/bcm2835-sdhost.c + +diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig +index 0476061..2595474 100644 +--- a/drivers/mmc/host/Kconfig ++++ b/drivers/mmc/host/Kconfig +@@ -33,6 +33,16 @@ config MMC_BCM2835_PIO_DMA_BARRIER + + If unsure, say 2 here. + ++config MMC_BCM2835_SDHOST ++ tristate "Support for the SDHost controller on BCM2708/9" ++ depends on MACH_BCM2708 || MACH_BCM2709 || ARCH_BCM2835 ++ help ++ This selects the SDHost controller on BCM2835/6. ++ ++ If you have a controller with this interface, say Y or M here. ++ ++ If unsure, say N. ++ + config MMC_ARMMMCI + tristate "ARM AMBA Multimedia Card Interface support" + depends on ARM_AMBA +diff --git a/drivers/mmc/host/Makefile b/drivers/mmc/host/Makefile +index 3ba94f0..8daaa94 100644 +--- a/drivers/mmc/host/Makefile ++++ b/drivers/mmc/host/Makefile +@@ -18,6 +18,7 @@ obj-$(CONFIG_MMC_SDHCI_S3C) += sdhci-s3c.o + obj-$(CONFIG_MMC_SDHCI_SIRF) += sdhci-sirf.o + obj-$(CONFIG_MMC_SDHCI_F_SDH30) += sdhci_f_sdh30.o + obj-$(CONFIG_MMC_SDHCI_SPEAR) += sdhci-spear.o ++obj-$(CONFIG_MMC_BCM2835_SDHOST) += bcm2835-sdhost.o + obj-$(CONFIG_MMC_BCM2835) += bcm2835-mmc.o + obj-$(CONFIG_MMC_WBSD) += wbsd.o + obj-$(CONFIG_MMC_AU1X) += au1xmmc.o +diff --git a/drivers/mmc/host/bcm2835-sdhost.c b/drivers/mmc/host/bcm2835-sdhost.c +new file mode 100644 +index 0000000..a57faed +--- /dev/null ++++ b/drivers/mmc/host/bcm2835-sdhost.c +@@ -0,0 +1,2158 @@ ++/* ++ * BCM2835 SD host driver. ++ * ++ * Author: Phil Elwell <phil@raspberrypi.org> ++ * Copyright (C) 2015-2016 Raspberry Pi (Trading) Ltd. ++ * ++ * Based on ++ * mmc-bcm2835.c by Gellert Weisz ++ * which is, in turn, based on ++ * sdhci-bcm2708.c by Broadcom ++ * sdhci-bcm2835.c by Stephen Warren and Oleksandr Tymoshenko ++ * sdhci.c and sdhci-pci.c by Pierre Ossman ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms and conditions of the GNU General Public License, ++ * version 2, as published by the Free Software Foundation. ++ * ++ * This program is distributed in the hope it will be useful, but WITHOUT ++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for ++ * more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program. If not, see <http://www.gnu.org/licenses/>. ++ */ ++ ++#define FIFO_READ_THRESHOLD 4 ++#define FIFO_WRITE_THRESHOLD 4 ++#define ALLOW_CMD23_READ 1 ++#define ALLOW_CMD23_WRITE 0 ++#define ENABLE_LOG 1 ++#define SDDATA_FIFO_PIO_BURST 8 ++#define CMD_DALLY_US 1 ++ ++#include <linux/delay.h> ++#include <linux/module.h> ++#include <linux/io.h> ++#include <linux/mmc/mmc.h> ++#include <linux/mmc/host.h> ++#include <linux/mmc/sd.h> ++#include <linux/scatterlist.h> ++#include <linux/of_address.h> ++#include <linux/of_irq.h> ++#include <linux/clk.h> ++#include <linux/platform_device.h> ++#include <linux/err.h> ++#include <linux/blkdev.h> ++#include <linux/dmaengine.h> ++#include <linux/dma-mapping.h> ++#include <linux/of_dma.h> ++#include <linux/time.h> ++#include <linux/workqueue.h> ++#include <soc/bcm2835/raspberrypi-firmware.h> ++ ++#define DRIVER_NAME "sdhost-bcm2835" ++ ++#define SDCMD 0x00 /* Command to SD card - 16 R/W */ ++#define SDARG 0x04 /* Argument to SD card - 32 R/W */ ++#define SDTOUT 0x08 /* Start value for timeout counter - 32 R/W */ ++#define SDCDIV 0x0c /* Start value for clock divider - 11 R/W */ ++#define SDRSP0 0x10 /* SD card response (31:0) - 32 R */ ++#define SDRSP1 0x14 /* SD card response (63:32) - 32 R */ ++#define SDRSP2 0x18 /* SD card response (95:64) - 32 R */ ++#define SDRSP3 0x1c /* SD card response (127:96) - 32 R */ ++#define SDHSTS 0x20 /* SD host status - 11 R */ ++#define SDVDD 0x30 /* SD card power control - 1 R/W */ ++#define SDEDM 0x34 /* Emergency Debug Mode - 13 R/W */ ++#define SDHCFG 0x38 /* Host configuration - 2 R/W */ ++#define SDHBCT 0x3c /* Host byte count (debug) - 32 R/W */ ++#define SDDATA 0x40 /* Data to/from SD card - 32 R/W */ ++#define SDHBLC 0x50 /* Host block count (SDIO/SDHC) - 9 R/W */ ++ ++#define SDCMD_NEW_FLAG 0x8000 ++#define SDCMD_FAIL_FLAG 0x4000 ++#define SDCMD_BUSYWAIT 0x800 ++#define SDCMD_NO_RESPONSE 0x400 ++#define SDCMD_LONG_RESPONSE 0x200 ++#define SDCMD_WRITE_CMD 0x80 ++#define SDCMD_READ_CMD 0x40 ++#define SDCMD_CMD_MASK 0x3f ++ ++#define SDCDIV_MAX_CDIV 0x7ff ++ ++#define SDHSTS_BUSY_IRPT 0x400 ++#define SDHSTS_BLOCK_IRPT 0x200 ++#define SDHSTS_SDIO_IRPT 0x100 ++#define SDHSTS_REW_TIME_OUT 0x80 ++#define SDHSTS_CMD_TIME_OUT 0x40 ++#define SDHSTS_CRC16_ERROR 0x20 ++#define SDHSTS_CRC7_ERROR 0x10 ++#define SDHSTS_FIFO_ERROR 0x08 ++/* Reserved */ ++/* Reserved */ ++#define SDHSTS_DATA_FLAG 0x01 ++ ++#define SDHSTS_TRANSFER_ERROR_MASK (SDHSTS_CRC7_ERROR|SDHSTS_CRC16_ERROR|SDHSTS_REW_TIME_OUT|SDHSTS_FIFO_ERROR) ++#define SDHSTS_ERROR_MASK (SDHSTS_CMD_TIME_OUT|SDHSTS_TRANSFER_ERROR_MASK) ++ ++#define SDHCFG_BUSY_IRPT_EN (1<<10) ++#define SDHCFG_BLOCK_IRPT_EN (1<<8) ++#define SDHCFG_SDIO_IRPT_EN (1<<5) ++#define SDHCFG_DATA_IRPT_EN (1<<4) ++#define SDHCFG_SLOW_CARD (1<<3) ++#define SDHCFG_WIDE_EXT_BUS (1<<2) ++#define SDHCFG_WIDE_INT_BUS (1<<1) ++#define SDHCFG_REL_CMD_LINE (1<<0) ++ ++#define SDEDM_FORCE_DATA_MODE (1<<19) ++#define SDEDM_CLOCK_PULSE (1<<20) ++#define SDEDM_BYPASS (1<<21) ++ ++#define SDEDM_WRITE_THRESHOLD_SHIFT 9 ++#define SDEDM_READ_THRESHOLD_SHIFT 14 ++#define SDEDM_THRESHOLD_MASK 0x1f ++ ++#define SDEDM_FSM_MASK 0xf ++#define SDEDM_FSM_IDENTMODE 0x0 ++#define SDEDM_FSM_DATAMODE 0x1 ++#define SDEDM_FSM_READDATA 0x2 ++#define SDEDM_FSM_WRITEDATA 0x3 ++#define SDEDM_FSM_READWAIT 0x4 ++#define SDEDM_FSM_READCRC 0x5 ++#define SDEDM_FSM_WRITECRC 0x6 ++#define SDEDM_FSM_WRITEWAIT1 0x7 ++#define SDEDM_FSM_POWERDOWN 0x8 ++#define SDEDM_FSM_POWERUP 0x9 ++#define SDEDM_FSM_WRITESTART1 0xa ++#define SDEDM_FSM_WRITESTART2 0xb ++#define SDEDM_FSM_GENPULSES 0xc ++#define SDEDM_FSM_WRITEWAIT2 0xd ++#define SDEDM_FSM_STARTPOWDOWN 0xf ++ ++#define SDDATA_FIFO_WORDS 16 ++ ++#define USE_CMD23_FLAGS ((ALLOW_CMD23_READ * MMC_DATA_READ) | \ ++ (ALLOW_CMD23_WRITE * MMC_DATA_WRITE)) ++ ++#define MHZ 1000000 ++ ++ ++struct bcm2835_host { ++ spinlock_t lock; ++ ++ void __iomem *ioaddr; ++ u32 bus_addr; ++ ++ struct mmc_host *mmc; ++ ++ u32 pio_timeout; /* In jiffies */ ++ ++ int clock; /* Current clock speed */ ++ ++ bool slow_card; /* Force 11-bit divisor */ ++ ++ unsigned int max_clk; /* Max possible freq */ ++ ++ struct tasklet_struct finish_tasklet; /* Tasklet structures */ ++ ++ struct work_struct cmd_wait_wq; /* Workqueue function */ ++ ++ struct timer_list timer; /* Timer for timeouts */ ++ ++ struct sg_mapping_iter sg_miter; /* SG state for PIO */ ++ unsigned int blocks; /* remaining PIO blocks */ ++ ++ int irq; /* Device IRQ */ ++ ++ u32 cmd_quick_poll_retries; ++ u32 ns_per_fifo_word; ++ ++ /* cached registers */ ++ u32 hcfg; ++ u32 cdiv; ++ ++ struct mmc_request *mrq; /* Current request */ ++ struct mmc_command *cmd; /* Current command */ ++ struct mmc_data *data; /* Current data request */ ++ unsigned int data_complete:1; /* Data finished before cmd */ ++ ++ unsigned int flush_fifo:1; /* Drain the fifo when finishing */ ++ ++ unsigned int use_busy:1; /* Wait for busy interrupt */ ++ ++ unsigned int use_sbc:1; /* Send CMD23 */ ++ ++ unsigned int debug:1; /* Enable debug output */ ++ unsigned int firmware_sets_cdiv:1; /* Let the firmware manage the clock */ ++ unsigned int reset_clock:1; /* Reset the clock fore the next request */ ++ ++ /*DMA part*/ ++ struct dma_chan *dma_chan_rxtx; /* DMA channel for reads and writes */ ++ struct dma_chan *dma_chan; /* Channel in use */ ++ struct dma_slave_config dma_cfg_rx; ++ struct dma_slave_config dma_cfg_tx; ++ struct dma_async_tx_descriptor *dma_desc; ++ u32 dma_dir; ++ u32 drain_words; ++ struct page *drain_page; ++ u32 drain_offset; ++ ++ bool allow_dma; ++ bool use_dma; ++ /*end of DMA part*/ ++ ++ int max_delay; /* maximum length of time spent waiting */ ++ struct timeval stop_time; /* when the last stop was issued */ ++ u32 delay_after_stop; /* minimum time between stop and subsequent data transfer */ ++ u32 delay_after_this_stop; /* minimum time between this stop and subsequent data transfer */ ++ u32 overclock_50; /* frequency to use when 50MHz is requested (in MHz) */ ++ u32 overclock; /* Current frequency if overclocked, else zero */ ++ u32 pio_limit; /* Maximum block count for PIO (0 = always DMA) */ ++ ++ u32 sectors; /* Cached card size in sectors */ ++}; ++ ++#if ENABLE_LOG ++ ++struct log_entry_struct { ++ char event[4]; ++ u32 timestamp; ++ u32 param1; ++ u32 param2; ++}; ++ ++typedef struct log_entry_struct LOG_ENTRY_T; ++ ++LOG_ENTRY_T *sdhost_log_buf; ++dma_addr_t sdhost_log_addr; ++static u32 sdhost_log_idx; ++static spinlock_t log_lock; ++static void __iomem *timer_base; ++ ++#define LOG_ENTRIES (256*1) ++#define LOG_SIZE (sizeof(LOG_ENTRY_T)*LOG_ENTRIES) ++ ++static void log_init(u32 bus_to_phys) ++{ ++ spin_lock_init(&log_lock); ++ sdhost_log_buf = dma_zalloc_coherent(NULL, LOG_SIZE, &sdhost_log_addr, ++ GFP_KERNEL); ++ if (sdhost_log_buf) { ++ pr_info("sdhost: log_buf @ %p (%x)\n", ++ sdhost_log_buf, sdhost_log_addr); ++ timer_base = ioremap_nocache(bus_to_phys + 0x7e003000, SZ_4K); ++ if (!timer_base) ++ pr_err("sdhost: failed to remap timer\n"); ++ } ++ else ++ pr_err("sdhost: failed to allocate log buf\n"); ++} ++ ++static void log_event_impl(const char *event, u32 param1, u32 param2) ++{ ++ if (sdhost_log_buf) { ++ LOG_ENTRY_T *entry; ++ unsigned long flags; ++ ++ spin_lock_irqsave(&log_lock, flags); ++ ++ entry = sdhost_log_buf + sdhost_log_idx; ++ memcpy(entry->event, event, 4); ++ entry->timestamp = (readl(timer_base + 4) & 0x3fffffff) + ++ (smp_processor_id()<<30); ++ entry->param1 = param1; ++ entry->param2 = param2; ++ sdhost_log_idx = (sdhost_log_idx + 1) % LOG_ENTRIES; ++ ++ spin_unlock_irqrestore(&log_lock, flags); ++ } ++} ++ ++static void log_dump(void) ++{ ++ if (sdhost_log_buf) { ++ LOG_ENTRY_T *entry; ++ unsigned long flags; ++ int idx; ++ ++ spin_lock_irqsave(&log_lock, flags); ++ ++ idx = sdhost_log_idx; ++ do { ++ entry = sdhost_log_buf + idx; ++ if (entry->event[0] != '\0') ++ pr_err("[%08x] %.4s %x %x\n", ++ entry->timestamp, ++ entry->event, ++ entry->param1, ++ entry->param2); ++ idx = (idx + 1) % LOG_ENTRIES; ++ } while (idx != sdhost_log_idx); ++ ++ spin_unlock_irqrestore(&log_lock, flags); ++ } ++} ++ ++#define log_event(event, param1, param2) log_event_impl(event, param1, param2) ++ ++#else ++ ++#define log_init(x) (void)0 ++#define log_event(event, param1, param2) (void)0 ++#define log_dump() (void)0 ++ ++#endif ++ ++static inline void bcm2835_sdhost_write(struct bcm2835_host *host, u32 val, int reg) ++{ ++ writel(val, host->ioaddr + reg); ++} ++ ++static inline u32 bcm2835_sdhost_read(struct bcm2835_host *host, int reg) ++{ ++ return readl(host->ioaddr + reg); ++} ++ ++static inline u32 bcm2835_sdhost_read_relaxed(struct bcm2835_host *host, int reg) ++{ ++ return readl_relaxed(host->ioaddr + reg); ++} ++ ++static void bcm2835_sdhost_dumpcmd(struct bcm2835_host *host, ++ struct mmc_command *cmd, ++ const char *label) ++{ ++ if (cmd) ++ pr_err("%s:%c%s op %d arg 0x%x flags 0x%x - resp %08x %08x %08x %08x, err %d\n", ++ mmc_hostname(host->mmc), ++ (cmd == host->cmd) ? '>' : ' ', ++ label, cmd->opcode, cmd->arg, cmd->flags, ++ cmd->resp[0], cmd->resp[1], cmd->resp[2], cmd->resp[3], ++ cmd->error); ++} ++ ++static void bcm2835_sdhost_dumpregs(struct bcm2835_host *host) ++{ ++ if (host->mrq) ++ { ++ bcm2835_sdhost_dumpcmd(host, host->mrq->sbc, "sbc"); ++ bcm2835_sdhost_dumpcmd(host, host->mrq->cmd, "cmd"); ++ if (host->mrq->data) ++ pr_err("%s: data blocks %x blksz %x - err %d\n", ++ mmc_hostname(host->mmc), ++ host->mrq->data->blocks, ++ host->mrq->data->blksz, ++ host->mrq->data->error); ++ bcm2835_sdhost_dumpcmd(host, host->mrq->stop, "stop"); ++ } ++ ++ pr_err("%s: =========== REGISTER DUMP ===========\n", ++ mmc_hostname(host->mmc)); ++ ++ pr_err("%s: SDCMD 0x%08x\n", ++ mmc_hostname(host->mmc), ++ bcm2835_sdhost_read(host, SDCMD)); ++ pr_err("%s: SDARG 0x%08x\n", ++ mmc_hostname(host->mmc), ++ bcm2835_sdhost_read(host, SDARG)); ++ pr_err("%s: SDTOUT 0x%08x\n", ++ mmc_hostname(host->mmc), ++ bcm2835_sdhost_read(host, SDTOUT)); ++ pr_err("%s: SDCDIV 0x%08x\n", ++ mmc_hostname(host->mmc), ++ bcm2835_sdhost_read(host, SDCDIV)); ++ pr_err("%s: SDRSP0 0x%08x\n", ++ mmc_hostname(host->mmc), ++ bcm2835_sdhost_read(host, SDRSP0)); ++ pr_err("%s: SDRSP1 0x%08x\n", ++ mmc_hostname(host->mmc), ++ bcm2835_sdhost_read(host, SDRSP1)); ++ pr_err("%s: SDRSP2 0x%08x\n", ++ mmc_hostname(host->mmc), ++ bcm2835_sdhost_read(host, SDRSP2)); ++ pr_err("%s: SDRSP3 0x%08x\n", ++ mmc_hostname(host->mmc), ++ bcm2835_sdhost_read(host, SDRSP3)); ++ pr_err("%s: SDHSTS 0x%08x\n", ++ mmc_hostname(host->mmc), ++ bcm2835_sdhost_read(host, SDHSTS)); ++ pr_err("%s: SDVDD 0x%08x\n", ++ mmc_hostname(host->mmc), ++ bcm2835_sdhost_read(host, SDVDD)); ++ pr_err("%s: SDEDM 0x%08x\n", ++ mmc_hostname(host->mmc), ++ bcm2835_sdhost_read(host, SDEDM)); ++ pr_err("%s: SDHCFG 0x%08x\n", ++ mmc_hostname(host->mmc), ++ bcm2835_sdhost_read(host, SDHCFG)); ++ pr_err("%s: SDHBCT 0x%08x\n", ++ mmc_hostname(host->mmc), ++ bcm2835_sdhost_read(host, SDHBCT)); ++ pr_err("%s: SDHBLC 0x%08x\n", ++ mmc_hostname(host->mmc), ++ bcm2835_sdhost_read(host, SDHBLC)); ++ ++ pr_err("%s: ===========================================\n", ++ mmc_hostname(host->mmc)); ++} ++ ++static void bcm2835_sdhost_set_power(struct bcm2835_host *host, bool on) ++{ ++ bcm2835_sdhost_write(host, on ? 1 : 0, SDVDD); ++} ++ ++static void bcm2835_sdhost_reset_internal(struct bcm2835_host *host) ++{ ++ u32 temp; ++ ++ if (host->debug) ++ pr_info("%s: reset\n", mmc_hostname(host->mmc)); ++ ++ bcm2835_sdhost_set_power(host, false); ++ ++ bcm2835_sdhost_write(host, 0, SDCMD); ++ bcm2835_sdhost_write(host, 0, SDARG); ++ bcm2835_sdhost_write(host, 0xf00000, SDTOUT); ++ bcm2835_sdhost_write(host, 0, SDCDIV); ++ bcm2835_sdhost_write(host, 0x7f8, SDHSTS); /* Write 1s to clear */ ++ bcm2835_sdhost_write(host, 0, SDHCFG); ++ bcm2835_sdhost_write(host, 0, SDHBCT); ++ bcm2835_sdhost_write(host, 0, SDHBLC); ++ ++ /* Limit fifo usage due to silicon bug */ ++ temp = bcm2835_sdhost_read(host, SDEDM); ++ temp &= ~((SDEDM_THRESHOLD_MASK<<SDEDM_READ_THRESHOLD_SHIFT) | ++ (SDEDM_THRESHOLD_MASK<<SDEDM_WRITE_THRESHOLD_SHIFT)); ++ temp |= (FIFO_READ_THRESHOLD << SDEDM_READ_THRESHOLD_SHIFT) | ++ (FIFO_WRITE_THRESHOLD << SDEDM_WRITE_THRESHOLD_SHIFT); ++ bcm2835_sdhost_write(host, temp, SDEDM); ++ mdelay(10); ++ bcm2835_sdhost_set_power(host, true); ++ mdelay(10); ++ host->clock = 0; ++ host->sectors = 0; ++ bcm2835_sdhost_write(host, host->hcfg, SDHCFG); ++ bcm2835_sdhost_write(host, SDCDIV_MAX_CDIV, SDCDIV); ++ mmiowb(); ++} ++ ++static void bcm2835_sdhost_reset(struct mmc_host *mmc) ++{ ++ struct bcm2835_host *host = mmc_priv(mmc); ++ unsigned long flags; ++ spin_lock_irqsave(&host->lock, flags); ++ log_event("RST<", 0, 0); ++ ++ bcm2835_sdhost_reset_internal(host); ++ ++ spin_unlock_irqrestore(&host->lock, flags); ++} ++ ++static void bcm2835_sdhost_set_ios(struct mmc_host *mmc, struct mmc_ios *ios); ++ ++static void bcm2835_sdhost_init(struct bcm2835_host *host, int soft) ++{ ++ pr_debug("bcm2835_sdhost_init(%d)\n", soft); ++ ++ /* Set interrupt enables */ ++ host->hcfg = SDHCFG_BUSY_IRPT_EN; ++ ++ bcm2835_sdhost_reset_internal(host); ++ ++ if (soft) { ++ /* force clock reconfiguration */ ++ host->clock = 0; ++ bcm2835_sdhost_set_ios(host->mmc, &host->mmc->ios); ++ } ++} ++ ++static void bcm2835_sdhost_wait_transfer_complete(struct bcm2835_host *host) ++{ ++ int timediff; ++ u32 alternate_idle; ++ u32 edm; ++ ++ alternate_idle = (host->mrq->data->flags & MMC_DATA_READ) ? ++ SDEDM_FSM_READWAIT : SDEDM_FSM_WRITESTART1; ++ ++ edm = bcm2835_sdhost_read(host, SDEDM); ++ ++ log_event("WTC<", edm, 0); ++ ++ timediff = 0; ++ ++ while (1) { ++ u32 fsm = edm & SDEDM_FSM_MASK; ++ if ((fsm == SDEDM_FSM_IDENTMODE) || ++ (fsm == SDEDM_FSM_DATAMODE)) ++ break; ++ if (fsm == alternate_idle) { ++ bcm2835_sdhost_write(host, ++ edm | SDEDM_FORCE_DATA_MODE, ++ SDEDM); ++ break; ++ } ++ ++ timediff++; ++ if (timediff == 100000) { ++ pr_err("%s: wait_transfer_complete - still waiting after %d retries\n", ++ mmc_hostname(host->mmc), ++ timediff); ++ log_dump(); ++ bcm2835_sdhost_dumpregs(host); ++ host->mrq->data->error = -ETIMEDOUT; ++ log_event("WTC!", edm, 0); ++ return; ++ } ++ cpu_relax(); ++ edm = bcm2835_sdhost_read(host, SDEDM); ++ } ++ log_event("WTC>", edm, 0); ++} ++ ++static void bcm2835_sdhost_finish_data(struct bcm2835_host *host); ++ ++static void bcm2835_sdhost_dma_complete(void *param) ++{ ++ struct bcm2835_host *host = param; ++ struct mmc_data *data = host->data; ++ unsigned long flags; ++ ++ spin_lock_irqsave(&host->lock, flags); ++ log_event("DMA<", (u32)host->data, bcm2835_sdhost_read(host, SDHSTS)); ++ log_event("DMA ", bcm2835_sdhost_read(host, SDCMD), ++ bcm2835_sdhost_read(host, SDEDM)); ++ ++ if (host->dma_chan) { ++ dma_unmap_sg(host->dma_chan->device->dev, ++ data->sg, data->sg_len, ++ host->dma_dir); ++ ++ host->dma_chan = NULL; ++ } ++ ++ if (host->drain_words) { ++ void *page; ++ u32 *buf; ++ ++ page = kmap_atomic(host->drain_page); ++ buf = page + host->drain_offset; ++ ++ while (host->drain_words) { ++ u32 edm = bcm2835_sdhost_read(host, SDEDM); ++ if ((edm >> 4) & 0x1f) ++ *(buf++) = bcm2835_sdhost_read(host, ++ SDDATA); ++ host->drain_words--; ++ } ++ ++ kunmap_atomic(page); ++ } ++ ++ bcm2835_sdhost_finish_data(host); ++ ++ log_event("DMA>", (u32)host->data, 0); ++ spin_unlock_irqrestore(&host->lock, flags); ++} ++ ++static void bcm2835_sdhost_read_block_pio(struct bcm2835_host *host) ++{ ++ unsigned long flags; ++ size_t blksize, len; ++ u32 *buf; ++ unsigned long wait_max; ++ ++ blksize = host->data->blksz; ++ ++ wait_max = jiffies + msecs_to_jiffies(host->pio_timeout); ++ ++ local_irq_save(flags); ++ ++ while (blksize) { ++ int copy_words; ++ u32 hsts = 0; ++ ++ if (!sg_miter_next(&host->sg_miter)) { ++ host->data->error = -EINVAL; ++ break; ++ } ++ ++ len = min(host->sg_miter.length, blksize); ++ if (len % 4) { ++ host->data->error = -EINVAL; ++ break; ++ } ++ ++ blksize -= len; ++ host->sg_miter.consumed = len; ++ ++ buf = (u32 *)host->sg_miter.addr; ++ ++ copy_words = len/4; ++ ++ while (copy_words) { ++ int burst_words, words; ++ u32 edm; ++ ++ burst_words = SDDATA_FIFO_PIO_BURST; ++ if (burst_words > copy_words) ++ burst_words = copy_words; ++ edm = bcm2835_sdhost_read(host, SDEDM); ++ words = ((edm >> 4) & 0x1f); ++ ++ if (words < burst_words) { ++ int fsm_state = (edm & SDEDM_FSM_MASK); ++ if ((fsm_state != SDEDM_FSM_READDATA) && ++ (fsm_state != SDEDM_FSM_READWAIT) && ++ (fsm_state != SDEDM_FSM_READCRC)) { ++ hsts = bcm2835_sdhost_read(host, ++ SDHSTS); ++ pr_err("%s: fsm %x, hsts %x\n", ++ mmc_hostname(host->mmc), ++ fsm_state, hsts); ++ if (hsts & SDHSTS_ERROR_MASK) ++ break; ++ } ++ ++ if (time_after(jiffies, wait_max)) { ++ pr_err("%s: PIO read timeout - EDM %x\n", ++ mmc_hostname(host->mmc), ++ edm); ++ hsts = SDHSTS_REW_TIME_OUT; ++ break; ++ } ++ ndelay((burst_words - words) * ++ host->ns_per_fifo_word); ++ continue; ++ } else if (words > copy_words) { ++ words = copy_words; ++ } ++ ++ copy_words -= words; ++ ++ while (words) { ++ *(buf++) = bcm2835_sdhost_read(host, SDDATA); ++ words--; ++ } ++ } ++ ++ if (hsts & SDHSTS_ERROR_MASK) ++ break; ++ } ++ ++ sg_miter_stop(&host->sg_miter); ++ ++ local_irq_restore(flags); ++} ++ ++static void bcm2835_sdhost_write_block_pio(struct bcm2835_host *host) ++{ ++ unsigned long flags; ++ size_t blksize, len; ++ u32 *buf; ++ unsigned long wait_max; ++ ++ blksize = host->data->blksz; ++ ++ wait_max = jiffies + msecs_to_jiffies(host->pio_timeout); ++ ++ local_irq_save(flags); ++ ++ while (blksize) { ++ int copy_words; ++ u32 hsts = 0; ++ ++ if (!sg_miter_next(&host->sg_miter)) { ++ host->data->error = -EINVAL; ++ break; ++ } ++ ++ len = min(host->sg_miter.length, blksize); ++ if (len % 4) { ++ host->data->error = -EINVAL; ++ break; ++ } ++ ++ blksize -= len; ++ host->sg_miter.consumed = len; ++ ++ buf = (u32 *)host->sg_miter.addr; ++ ++ copy_words = len/4; ++ ++ while (copy_words) { ++ int burst_words, words; ++ u32 edm; ++ ++ burst_words = SDDATA_FIFO_PIO_BURST; ++ if (burst_words > copy_words) ++ burst_words = copy_words; ++ edm = bcm2835_sdhost_read(host, SDEDM); ++ words = SDDATA_FIFO_WORDS - ((edm >> 4) & 0x1f); ++ ++ if (words < burst_words) { ++ int fsm_state = (edm & SDEDM_FSM_MASK); ++ if ((fsm_state != SDEDM_FSM_WRITEDATA) && ++ (fsm_state != SDEDM_FSM_WRITESTART1) && ++ (fsm_state != SDEDM_FSM_WRITESTART2)) { ++ hsts = bcm2835_sdhost_read(host, ++ SDHSTS); ++ pr_err("%s: fsm %x, hsts %x\n", ++ mmc_hostname(host->mmc), ++ fsm_state, hsts); ++ if (hsts & SDHSTS_ERROR_MASK) ++ break; ++ } ++ ++ if (time_after(jiffies, wait_max)) { ++ pr_err("%s: PIO write timeout - EDM %x\n", ++ mmc_hostname(host->mmc), ++ edm); ++ hsts = SDHSTS_REW_TIME_OUT; ++ break; ++ } ++ ndelay((burst_words - words) * ++ host->ns_per_fifo_word); ++ continue; ++ } else if (words > copy_words) { ++ words = copy_words; ++ } ++ ++ copy_words -= words; ++ ++ while (words) { ++ bcm2835_sdhost_write(host, *(buf++), SDDATA); ++ words--; ++ } ++ } ++ ++ if (hsts & SDHSTS_ERROR_MASK) ++ break; ++ } ++ ++ sg_miter_stop(&host->sg_miter); ++ ++ local_irq_restore(flags); ++} ++ ++static void bcm2835_sdhost_transfer_pio(struct bcm2835_host *host) ++{ ++ u32 sdhsts; ++ bool is_read; ++ BUG_ON(!host->data); ++ log_event("XFP<", (u32)host->data, host->blocks); ++ ++ is_read = (host->data->flags & MMC_DATA_READ) != 0; ++ if (is_read) ++ bcm2835_sdhost_read_block_pio(host); ++ else ++ bcm2835_sdhost_write_block_pio(host); ++ ++ sdhsts = bcm2835_sdhost_read(host, SDHSTS); ++ if (sdhsts & (SDHSTS_CRC16_ERROR | ++ SDHSTS_CRC7_ERROR | ++ SDHSTS_FIFO_ERROR)) { ++ pr_err("%s: %s transfer error - HSTS %x\n", ++ mmc_hostname(host->mmc), ++ is_read ? "read" : "write", ++ sdhsts); ++ host->data->error = -EILSEQ; ++ } else if ((sdhsts & (SDHSTS_CMD_TIME_OUT | ++ SDHSTS_REW_TIME_OUT))) { ++ pr_err("%s: %s timeout error - HSTS %x\n", ++ mmc_hostname(host->mmc), ++ is_read ? "read" : "write", ++ sdhsts); ++ host->data->error = -ETIMEDOUT; ++ } ++ log_event("XFP>", (u32)host->data, host->blocks); ++} ++ ++static void bcm2835_sdhost_prepare_dma(struct bcm2835_host *host, ++ struct mmc_data *data) ++{ ++ int len, dir_data, dir_slave; ++ struct dma_async_tx_descriptor *desc = NULL; ++ struct dma_chan *dma_chan; ++ ++ log_event("PRD<", (u32)data, 0); ++ pr_debug("bcm2835_sdhost_prepare_dma()\n"); ++ ++ dma_chan = host->dma_chan_rxtx; ++ if (data->flags & MMC_DATA_READ) { ++ dir_data = DMA_FROM_DEVICE; ++ dir_slave = DMA_DEV_TO_MEM; ++ } else { ++ dir_data = DMA_TO_DEVICE; ++ dir_slave = DMA_MEM_TO_DEV; ++ } ++ log_event("PRD1", (u32)dma_chan, 0); ++ ++ BUG_ON(!dma_chan->device); ++ BUG_ON(!dma_chan->device->dev); ++ BUG_ON(!data->sg); ++ ++ /* The block doesn't manage the FIFO DREQs properly for multi-block ++ transfers, so don't attempt to DMA the final few words. ++ Unfortunately this requires the final sg entry to be trimmed. ++ N.B. This code demands that the overspill is contained in ++ a single sg entry. ++ */ ++ ++ host->drain_words = 0; ++ if ((data->blocks > 1) && (dir_data == DMA_FROM_DEVICE)) { ++ struct scatterlist *sg; ++ u32 len; ++ int i; ++ ++ len = min((u32)(FIFO_READ_THRESHOLD - 1) * 4, ++ (u32)data->blocks * data->blksz); ++ ++ for_each_sg(data->sg, sg, data->sg_len, i) { ++ if (sg_is_last(sg)) { ++ BUG_ON(sg->length < len); ++ sg->length -= len; ++ host->drain_page = (struct page *)sg->page_link; ++ host->drain_offset = sg->offset + sg->length; ++ } ++ } ++ host->drain_words = len/4; ++ } ++ ++ /* The parameters have already been validated, so this will not fail */ ++ (void)dmaengine_slave_config(dma_chan, ++ (dir_data == DMA_FROM_DEVICE) ? ++ &host->dma_cfg_rx : ++ &host->dma_cfg_tx); ++ ++ len = dma_map_sg(dma_chan->device->dev, data->sg, data->sg_len, ++ dir_data); ++ ++ log_event("PRD2", len, 0); ++ if (len > 0) ++ desc = dmaengine_prep_slave_sg(dma_chan, data->sg, ++ len, dir_slave, ++ DMA_PREP_INTERRUPT | DMA_CTRL_ACK); ++ log_event("PRD3", (u32)desc, 0); ++ ++ if (desc) { ++ desc->callback = bcm2835_sdhost_dma_complete; ++ desc->callback_param = host; ++ host->dma_desc = desc; ++ host->dma_chan = dma_chan; ++ host->dma_dir = dir_data; ++ } ++ log_event("PDM>", (u32)data, 0); ++} ++ ++static void bcm2835_sdhost_start_dma(struct bcm2835_host *host) ++{ ++ log_event("SDMA", (u32)host->data, (u32)host->dma_chan); ++ dmaengine_submit(host->dma_desc); ++ dma_async_issue_pending(host->dma_chan); ++} ++ ++static void bcm2835_sdhost_set_transfer_irqs(struct bcm2835_host *host) ++{ ++ u32 all_irqs = SDHCFG_DATA_IRPT_EN | SDHCFG_BLOCK_IRPT_EN | ++ SDHCFG_BUSY_IRPT_EN; ++ if (host->dma_desc) ++ host->hcfg = (host->hcfg & ~all_irqs) | ++ SDHCFG_BUSY_IRPT_EN; ++ else ++ host->hcfg = (host->hcfg & ~all_irqs) | ++ SDHCFG_DATA_IRPT_EN | ++ SDHCFG_BUSY_IRPT_EN; ++ ++ bcm2835_sdhost_write(host, host->hcfg, SDHCFG); ++} ++ ++static void bcm2835_sdhost_prepare_data(struct bcm2835_host *host, struct mmc_command *cmd) ++{ ++ struct mmc_data *data = cmd->data; ++ ++ WARN_ON(host->data); ++ ++ host->data = data; ++ if (!data) ++ return; ++ ++ /* Sanity checks */ ++ BUG_ON(data->blksz * data->blocks > 524288); ++ BUG_ON(data->blksz > host->mmc->max_blk_size); ++ BUG_ON(data->blocks > 65535); ++ ++ host->data_complete = 0; ++ host->flush_fifo = 0; ++ host->data->bytes_xfered = 0; ++ ++ if (!host->sectors && host->mmc->card) { ++ struct mmc_card *card = host->mmc->card; ++ if (!mmc_card_sd(card) && mmc_card_blockaddr(card)) { ++ /* ++ * The EXT_CSD sector count is in number of 512 byte ++ * sectors. ++ */ ++ host->sectors = card->ext_csd.sectors; ++ } else { ++ /* ++ * The CSD capacity field is in units of read_blkbits. ++ * set_capacity takes units of 512 bytes. ++ */ ++ host->sectors = card->csd.capacity << ++ (card->csd.read_blkbits - 9); ++ } ++ } ++ ++ if (!host->dma_desc) { ++ /* Use PIO */ ++ int flags = SG_MITER_ATOMIC; ++ ++ if (data->flags & MMC_DATA_READ) ++ flags |= SG_MITER_TO_SG; ++ else ++ flags |= SG_MITER_FROM_SG; ++ sg_miter_start(&host->sg_miter, data->sg, data->sg_len, flags); ++ host->blocks = data->blocks; ++ } ++ ++ bcm2835_sdhost_set_transfer_irqs(host); ++ ++ bcm2835_sdhost_write(host, data->blksz, SDHBCT); ++ bcm2835_sdhost_write(host, data->blocks, SDHBLC); ++ ++ BUG_ON(!host->data); ++} ++ ++bool bcm2835_sdhost_send_command(struct bcm2835_host *host, ++ struct mmc_command *cmd) ++{ ++ u32 sdcmd, sdhsts; ++ unsigned long timeout; ++ int delay; ++ ++ WARN_ON(host->cmd); ++ log_event("CMD<", cmd->opcode, cmd->arg); ++ ++ if (cmd->data) ++ pr_debug("%s: send_command %d 0x%x " ++ "(flags 0x%x) - %s %d*%d\n", ++ mmc_hostname(host->mmc), ++ cmd->opcode, cmd->arg, cmd->flags, ++ (cmd->data->flags & MMC_DATA_READ) ? ++ "read" : "write", cmd->data->blocks, ++ cmd->data->blksz); ++ else ++ pr_debug("%s: send_command %d 0x%x (flags 0x%x)\n", ++ mmc_hostname(host->mmc), ++ cmd->opcode, cmd->arg, cmd->flags); ++ ++ /* Wait max 100 ms */ ++ timeout = 10000; ++ ++ while (bcm2835_sdhost_read(host, SDCMD) & SDCMD_NEW_FLAG) { ++ if (timeout == 0) { ++ pr_err("%s: previous command never completed.\n", ++ mmc_hostname(host->mmc)); ++ bcm2835_sdhost_dumpregs(host); ++ cmd->error = -EILSEQ; ++ tasklet_schedule(&host->finish_tasklet); ++ return false; ++ } ++ timeout--; ++ udelay(10); ++ } ++ ++ delay = (10000 - timeout)/100; ++ if (delay > host->max_delay) { ++ host->max_delay = delay; ++ pr_warning("%s: controller hung for %d ms\n", ++ mmc_hostname(host->mmc), ++ host->max_delay); ++ } ++ ++ timeout = jiffies; ++ if (!cmd->data && cmd->busy_timeout > 9000) ++ timeout += DIV_ROUND_UP(cmd->busy_timeout, 1000) * HZ + HZ; ++ else ++ timeout += 10 * HZ; ++ mod_timer(&host->timer, timeout); ++ ++ host->cmd = cmd; ++ ++ /* Clear any error flags */ ++ sdhsts = bcm2835_sdhost_read(host, SDHSTS); ++ if (sdhsts & SDHSTS_ERROR_MASK) ++ bcm2835_sdhost_write(host, sdhsts, SDHSTS); ++ ++ if ((cmd->flags & MMC_RSP_136) && (cmd->flags & MMC_RSP_BUSY)) { ++ pr_err("%s: unsupported response type!\n", ++ mmc_hostname(host->mmc)); ++ cmd->error = -EINVAL; ++ tasklet_schedule(&host->finish_tasklet); ++ return false; ++ } ++ ++ bcm2835_sdhost_prepare_data(host, cmd); ++ ++ bcm2835_sdhost_write(host, cmd->arg, SDARG); ++ ++ sdcmd = cmd->opcode & SDCMD_CMD_MASK; ++ ++ host->use_busy = 0; ++ if (!(cmd->flags & MMC_RSP_PRESENT)) { ++ sdcmd |= SDCMD_NO_RESPONSE; ++ } else { ++ if (cmd->flags & MMC_RSP_136) ++ sdcmd |= SDCMD_LONG_RESPONSE; ++ if (cmd->flags & MMC_RSP_BUSY) { ++ sdcmd |= SDCMD_BUSYWAIT; ++ host->use_busy = 1; ++ } ++ } ++ ++ if (cmd->data) { ++ log_event("CMDD", cmd->data->blocks, cmd->data->blksz); ++ if (host->delay_after_this_stop) { ++ struct timeval now; ++ int time_since_stop; ++ do_gettimeofday(&now); ++ time_since_stop = (now.tv_sec - host->stop_time.tv_sec); ++ if (time_since_stop < 2) { ++ /* Possibly less than one second */ ++ time_since_stop = time_since_stop * 1000000 + ++ (now.tv_usec - host->stop_time.tv_usec); ++ if (time_since_stop < ++ host->delay_after_this_stop) ++ udelay(host->delay_after_this_stop - ++ time_since_stop); ++ } ++ } ++ ++ host->delay_after_this_stop = host->delay_after_stop; ++ if ((cmd->data->flags & MMC_DATA_READ) && !host->use_sbc) { ++ /* See if read crosses one of the hazardous sectors */ ++ u32 first_blk, last_blk; ++ ++ /* Intentionally include the following sector because ++ without CMD23/SBC the read may run on. */ ++ first_blk = host->mrq->cmd->arg; ++ last_blk = first_blk + cmd->data->blocks; ++ ++ if (((last_blk >= (host->sectors - 64)) && ++ (first_blk <= (host->sectors - 64))) || ++ ((last_blk >= (host->sectors - 32)) && ++ (first_blk <= (host->sectors - 32)))) { ++ host->delay_after_this_stop = ++ max(250u, host->delay_after_stop); ++ } ++ } ++ ++ if (cmd->data->flags & MMC_DATA_WRITE) ++ sdcmd |= SDCMD_WRITE_CMD; ++ if (cmd->data->flags & MMC_DATA_READ) ++ sdcmd |= SDCMD_READ_CMD; ++ } ++ ++ bcm2835_sdhost_write(host, sdcmd | SDCMD_NEW_FLAG, SDCMD); ++ ++ return true; ++} ++ ++static void bcm2835_sdhost_finish_command(struct bcm2835_host *host, ++ unsigned long *irq_flags); ++static void bcm2835_sdhost_transfer_complete(struct bcm2835_host *host); ++ ++static void bcm2835_sdhost_finish_data(struct bcm2835_host *host) ++{ ++ struct mmc_data *data; ++ ++ data = host->data; ++ BUG_ON(!data); ++ ++ log_event("FDA<", (u32)host->mrq, (u32)host->cmd); ++ pr_debug("finish_data(error %d, stop %d, sbc %d)\n", ++ data->error, data->stop ? 1 : 0, ++ host->mrq->sbc ? 1 : 0); ++ ++ host->hcfg &= ~(SDHCFG_DATA_IRPT_EN | SDHCFG_BLOCK_IRPT_EN); ++ bcm2835_sdhost_write(host, host->hcfg, SDHCFG); ++ ++ data->bytes_xfered = data->error ? 0 : (data->blksz * data->blocks); ++ ++ host->data_complete = 1; ++ ++ if (host->cmd) { ++ /* ++ * Data managed to finish before the ++ * command completed. Make sure we do ++ * things in the proper order. ++ */ ++ pr_debug("Finished early - HSTS %x\n", ++ bcm2835_sdhost_read(host, SDHSTS)); ++ } ++ else ++ bcm2835_sdhost_transfer_complete(host); ++ log_event("FDA>", (u32)host->mrq, (u32)host->cmd); ++} ++ ++static void bcm2835_sdhost_transfer_complete(struct bcm2835_host *host) ++{ ++ struct mmc_data *data; ++ ++ BUG_ON(host->cmd); ++ BUG_ON(!host->data); ++ BUG_ON(!host->data_complete); ++ ++ data = host->data; ++ host->data = NULL; ++ ++ log_event("TCM<", (u32)data, data->error); ++ pr_debug("transfer_complete(error %d, stop %d)\n", ++ data->error, data->stop ? 1 : 0); ++ ++ /* ++ * Need to send CMD12 if - ++ * a) open-ended multiblock transfer (no CMD23) ++ * b) error in multiblock transfer ++ */ ++ if (host->mrq->stop && (data->error || !host->use_sbc)) { ++ if (bcm2835_sdhost_send_command(host, host->mrq->stop)) { ++ /* No busy, so poll for completion */ ++ if (!host->use_busy) ++ bcm2835_sdhost_finish_command(host, NULL); ++ ++ if (host->delay_after_this_stop) ++ do_gettimeofday(&host->stop_time); ++ } ++ } else { ++ bcm2835_sdhost_wait_transfer_complete(host); ++ tasklet_schedule(&host->finish_tasklet); ++ } ++ log_event("TCM>", (u32)data, 0); ++} ++ ++/* If irq_flags is valid, the caller is in a thread context and is allowed ++ to sleep */ ++static void bcm2835_sdhost_finish_command(struct bcm2835_host *host, ++ unsigned long *irq_flags) ++{ ++ u32 sdcmd; ++ u32 retries; ++#ifdef DEBUG ++ struct timeval before, after; ++ int timediff = 0; ++#endif ++ ++ log_event("FCM<", (u32)host->mrq, (u32)host->cmd); ++ pr_debug("finish_command(%x)\n", bcm2835_sdhost_read(host, SDCMD)); ++ ++ BUG_ON(!host->cmd || !host->mrq); ++ ++ /* Poll quickly at first */ ++ ++ retries = host->cmd_quick_poll_retries; ++ if (!retries) { ++ /* Work out how many polls take 1us by timing 10us */ ++ struct timeval start, now; ++ int us_diff; ++ ++ retries = 1; ++ do { ++ int i; ++ ++ retries *= 2; ++ ++ do_gettimeofday(&start); ++ ++ for (i = 0; i < retries; i++) { ++ cpu_relax(); ++ sdcmd = bcm2835_sdhost_read(host, SDCMD); ++ } ++ ++ do_gettimeofday(&now); ++ us_diff = (now.tv_sec - start.tv_sec) * 1000000 + ++ (now.tv_usec - start.tv_usec); ++ } while (us_diff < 10); ++ ++ host->cmd_quick_poll_retries = ((retries * us_diff + 9)*CMD_DALLY_US)/10 + 1; ++ retries = 1; // We've already waited long enough this time ++ } ++ ++ retries = host->cmd_quick_poll_retries; ++ for (sdcmd = bcm2835_sdhost_read(host, SDCMD); ++ (sdcmd & SDCMD_NEW_FLAG) && !(sdcmd & SDCMD_FAIL_FLAG) && retries; ++ retries--) { ++ cpu_relax(); ++ sdcmd = bcm2835_sdhost_read(host, SDCMD); ++ } ++ ++ if (!retries) { ++ unsigned long wait_max; ++ ++ if (!irq_flags) { ++ /* Schedule the work */ ++ log_event("CWWQ", 0, 0); ++ schedule_work(&host->cmd_wait_wq); ++ return; ++ } ++ ++ /* Wait max 100 ms */ ++ wait_max = jiffies + msecs_to_jiffies(100); ++ while (time_before(jiffies, wait_max)) { ++ spin_unlock_irqrestore(&host->lock, *irq_flags); ++ usleep_range(1, 10); ++ spin_lock_irqsave(&host->lock, *irq_flags); ++ sdcmd = bcm2835_sdhost_read(host, SDCMD); ++ if (!(sdcmd & SDCMD_NEW_FLAG) || ++ (sdcmd & SDCMD_FAIL_FLAG)) ++ break; ++ } ++ } ++ ++ /* Check for errors */ ++ if (sdcmd & SDCMD_NEW_FLAG) { ++ pr_err("%s: command never completed.\n", ++ mmc_hostname(host->mmc)); ++ bcm2835_sdhost_dumpregs(host); ++ host->cmd->error = -EIO; ++ tasklet_schedule(&host->finish_tasklet); ++ return; ++ } else if (sdcmd & SDCMD_FAIL_FLAG) { ++ u32 sdhsts = bcm2835_sdhost_read(host, SDHSTS); ++ ++ /* Clear the errors */ ++ bcm2835_sdhost_write(host, SDHSTS_ERROR_MASK, SDHSTS); ++ ++ if (host->debug) ++ pr_info("%s: error detected - CMD %x, HSTS %03x, EDM %x\n", ++ mmc_hostname(host->mmc), sdcmd, sdhsts, ++ bcm2835_sdhost_read(host, SDEDM)); ++ ++ if ((sdhsts & SDHSTS_CRC7_ERROR) && ++ (host->cmd->opcode == 1)) { ++ if (host->debug) ++ pr_info("%s: ignoring CRC7 error for CMD1\n", ++ mmc_hostname(host->mmc)); ++ } else { ++ if (sdhsts & SDHSTS_CMD_TIME_OUT) { ++ if (host->debug) ++ pr_err("%s: command %d timeout\n", ++ mmc_hostname(host->mmc), ++ host->cmd->opcode); ++ host->cmd->error = -ETIMEDOUT; ++ } else { ++ pr_err("%s: unexpected command %d error\n", ++ mmc_hostname(host->mmc), ++ host->cmd->opcode); ++ bcm2835_sdhost_dumpregs(host); ++ host->cmd->error = -EILSEQ; ++ } ++ tasklet_schedule(&host->finish_tasklet); ++ return; ++ } ++ } ++ ++ if (host->cmd->flags & MMC_RSP_PRESENT) { ++ if (host->cmd->flags & MMC_RSP_136) { ++ int i; ++ for (i = 0; i < 4; i++) ++ host->cmd->resp[3 - i] = bcm2835_sdhost_read(host, SDRSP0 + i*4); ++ pr_debug("%s: finish_command %08x %08x %08x %08x\n", ++ mmc_hostname(host->mmc), ++ host->cmd->resp[0], host->cmd->resp[1], host->cmd->resp[2], host->cmd->resp[3]); ++ log_event("RSP ", host->cmd->resp[0], host->cmd->resp[1]); ++ } else { ++ host->cmd->resp[0] = bcm2835_sdhost_read(host, SDRSP0); ++ pr_debug("%s: finish_command %08x\n", ++ mmc_hostname(host->mmc), ++ host->cmd->resp[0]); ++ log_event("RSP ", host->cmd->resp[0], 0); ++ } ++ } ++ ++ if (host->cmd == host->mrq->sbc) { ++ /* Finished CMD23, now send actual command. */ ++ host->cmd = NULL; ++ if (bcm2835_sdhost_send_command(host, host->mrq->cmd)) { ++ if (host->data && host->dma_desc) ++ /* DMA transfer starts now, PIO starts after irq */ ++ bcm2835_sdhost_start_dma(host); ++ ++ if (!host->use_busy) ++ bcm2835_sdhost_finish_command(host, NULL); ++ } ++ } else if (host->cmd == host->mrq->stop) { ++ /* Finished CMD12 */ ++ tasklet_schedule(&host->finish_tasklet); ++ } else { ++ /* Processed actual command. */ ++ host->cmd = NULL; ++ if (!host->data) ++ tasklet_schedule(&host->finish_tasklet); ++ else if (host->data_complete) ++ bcm2835_sdhost_transfer_complete(host); ++ } ++ log_event("FCM>", (u32)host->mrq, (u32)host->cmd); ++} ++ ++static void bcm2835_sdhost_timeout(unsigned long data) ++{ ++ struct bcm2835_host *host; ++ unsigned long flags; ++ ++ host = (struct bcm2835_host *)data; ++ ++ spin_lock_irqsave(&host->lock, flags); ++ log_event("TIM<", 0, 0); ++ ++ if (host->mrq) { ++ pr_err("%s: timeout waiting for hardware interrupt.\n", ++ mmc_hostname(host->mmc)); ++ log_dump(); ++ bcm2835_sdhost_dumpregs(host); ++ ++ if (host->data) { ++ host->data->error = -ETIMEDOUT; ++ bcm2835_sdhost_finish_data(host); ++ } else { ++ if (host->cmd) ++ host->cmd->error = -ETIMEDOUT; ++ else ++ host->mrq->cmd->error = -ETIMEDOUT; ++ ++ pr_debug("timeout_timer tasklet_schedule\n"); ++ tasklet_schedule(&host->finish_tasklet); ++ } ++ } ++ ++ mmiowb(); ++ spin_unlock_irqrestore(&host->lock, flags); ++} ++ ++static void bcm2835_sdhost_busy_irq(struct bcm2835_host *host, u32 intmask) ++{ ++ log_event("IRQB", (u32)host->cmd, intmask); ++ if (!host->cmd) { ++ pr_err("%s: got command busy interrupt 0x%08x even " ++ "though no command operation was in progress.\n", ++ mmc_hostname(host->mmc), (unsigned)intmask); ++ bcm2835_sdhost_dumpregs(host); ++ return; ++ } ++ ++ if (!host->use_busy) { ++ pr_err("%s: got command busy interrupt 0x%08x even " ++ "though not expecting one.\n", ++ mmc_hostname(host->mmc), (unsigned)intmask); ++ bcm2835_sdhost_dumpregs(host); ++ return; ++ } ++ host->use_busy = 0; ++ ++ if (intmask & SDHSTS_ERROR_MASK) ++ { ++ pr_err("sdhost_busy_irq: intmask %x, data %p\n", intmask, host->mrq->data); ++ if (intmask & SDHSTS_CRC7_ERROR) ++ host->cmd->error = -EILSEQ; ++ else if (intmask & (SDHSTS_CRC16_ERROR | ++ SDHSTS_FIFO_ERROR)) { ++ if (host->mrq->data) ++ host->mrq->data->error = -EILSEQ; ++ else ++ host->cmd->error = -EILSEQ; ++ } else if (intmask & SDHSTS_REW_TIME_OUT) { ++ if (host->mrq->data) ++ host->mrq->data->error = -ETIMEDOUT; ++ else ++ host->cmd->error = -ETIMEDOUT; ++ } else if (intmask & SDHSTS_CMD_TIME_OUT) ++ host->cmd->error = -ETIMEDOUT; ++ ++ log_dump(); ++ bcm2835_sdhost_dumpregs(host); ++ } ++ else ++ bcm2835_sdhost_finish_command(host, NULL); ++} ++ ++static void bcm2835_sdhost_data_irq(struct bcm2835_host *host, u32 intmask) ++{ ++ /* There are no dedicated data/space available interrupt ++ status bits, so it is necessary to use the single shared ++ data/space available FIFO status bits. It is therefore not ++ an error to get here when there is no data transfer in ++ progress. */ ++ log_event("IRQD", (u32)host->data, intmask); ++ if (!host->data) ++ return; ++ ++ if (intmask & (SDHSTS_CRC16_ERROR | ++ SDHSTS_FIFO_ERROR | ++ SDHSTS_REW_TIME_OUT)) { ++ if (intmask & (SDHSTS_CRC16_ERROR | ++ SDHSTS_FIFO_ERROR)) ++ host->data->error = -EILSEQ; ++ else ++ host->data->error = -ETIMEDOUT; ++ ++ if (host->debug) { ++ log_dump(); ++ bcm2835_sdhost_dumpregs(host); ++ } ++ } ++ ++ if (host->data->error) { ++ bcm2835_sdhost_finish_data(host); ++ } else if (host->data->flags & MMC_DATA_WRITE) { ++ /* Use the block interrupt for writes after the first block */ ++ host->hcfg &= ~(SDHCFG_DATA_IRPT_EN); ++ host->hcfg |= SDHCFG_BLOCK_IRPT_EN; ++ bcm2835_sdhost_write(host, host->hcfg, SDHCFG); ++ bcm2835_sdhost_transfer_pio(host); ++ } else { ++ bcm2835_sdhost_transfer_pio(host); ++ host->blocks--; ++ if ((host->blocks == 0) || host->data->error) ++ bcm2835_sdhost_finish_data(host); ++ } ++} ++ ++static void bcm2835_sdhost_block_irq(struct bcm2835_host *host, u32 intmask) ++{ ++ log_event("IRQK", (u32)host->data, intmask); ++ if (!host->data) { ++ pr_err("%s: got block interrupt 0x%08x even " ++ "though no data operation was in progress.\n", ++ mmc_hostname(host->mmc), (unsigned)intmask); ++ bcm2835_sdhost_dumpregs(host); ++ return; ++ } ++ ++ if (intmask & (SDHSTS_CRC16_ERROR | ++ SDHSTS_FIFO_ERROR | ++ SDHSTS_REW_TIME_OUT)) { ++ if (intmask & (SDHSTS_CRC16_ERROR | ++ SDHSTS_FIFO_ERROR)) ++ host->data->error = -EILSEQ; ++ else ++ host->data->error = -ETIMEDOUT; ++ ++ if (host->debug) { ++ log_dump(); ++ bcm2835_sdhost_dumpregs(host); ++ } ++ } ++ ++ if (!host->dma_desc) { ++ BUG_ON(!host->blocks); ++ if (host->data->error || (--host->blocks == 0)) { ++ bcm2835_sdhost_finish_data(host); ++ } else { ++ bcm2835_sdhost_transfer_pio(host); ++ } ++ } else if (host->data->flags & MMC_DATA_WRITE) { ++ bcm2835_sdhost_finish_data(host); ++ } ++} ++ ++static irqreturn_t bcm2835_sdhost_irq(int irq, void *dev_id) ++{ ++ irqreturn_t result = IRQ_NONE; ++ struct bcm2835_host *host = dev_id; ++ u32 intmask; ++ ++ spin_lock(&host->lock); ++ ++ intmask = bcm2835_sdhost_read(host, SDHSTS); ++ log_event("IRQ<", intmask, 0); ++ ++ bcm2835_sdhost_write(host, ++ SDHSTS_BUSY_IRPT | ++ SDHSTS_BLOCK_IRPT | ++ SDHSTS_SDIO_IRPT | ++ SDHSTS_DATA_FLAG, ++ SDHSTS); ++ ++ if (intmask & SDHSTS_BLOCK_IRPT) { ++ bcm2835_sdhost_block_irq(host, intmask); ++ result = IRQ_HANDLED; ++ } ++ ++ if (intmask & SDHSTS_BUSY_IRPT) { ++ bcm2835_sdhost_busy_irq(host, intmask); ++ result = IRQ_HANDLED; ++ } ++ ++ /* There is no true data interrupt status bit, so it is ++ necessary to qualify the data flag with the interrupt ++ enable bit */ ++ if ((intmask & SDHSTS_DATA_FLAG) && ++ (host->hcfg & SDHCFG_DATA_IRPT_EN)) { ++ bcm2835_sdhost_data_irq(host, intmask); ++ result = IRQ_HANDLED; ++ } ++ ++ mmiowb(); ++ ++ log_event("IRQ>", bcm2835_sdhost_read(host, SDHSTS), 0); ++ spin_unlock(&host->lock); ++ ++ return result; ++} ++ ++void bcm2835_sdhost_set_clock(struct bcm2835_host *host, unsigned int clock) ++{ ++ int div = 0; /* Initialized for compiler warning */ ++ unsigned int input_clock = clock; ++ unsigned long flags; ++ ++ if (host->debug) ++ pr_info("%s: set_clock(%d)\n", mmc_hostname(host->mmc), clock); ++ ++ if ((host->overclock_50 > 50) && ++ (clock == 50*MHZ)) ++ clock = host->overclock_50 * MHZ + (MHZ - 1); ++ ++ /* The SDCDIV register has 11 bits, and holds (div - 2). ++ But in data mode the max is 50MHz wihout a minimum, and only the ++ bottom 3 bits are used. Since the switch over is automatic (unless ++ we have marked the card as slow...), chosen values have to make ++ sense in both modes. ++ Ident mode must be 100-400KHz, so can range check the requested ++ clock. CMD15 must be used to return to data mode, so this can be ++ monitored. ++ ++ clock 250MHz -> 0->125MHz, 1->83.3MHz, 2->62.5MHz, 3->50.0MHz ++ 4->41.7MHz, 5->35.7MHz, 6->31.3MHz, 7->27.8MHz ++ ++ 623->400KHz/27.8MHz ++ reset value (507)->491159/50MHz ++ ++ BUT, the 3-bit clock divisor in data mode is too small if the ++ core clock is higher than 250MHz, so instead use the SLOW_CARD ++ configuration bit to force the use of the ident clock divisor ++ at all times. ++ */ ++ ++ host->mmc->actual_clock = 0; ++ ++ if (host->firmware_sets_cdiv) { ++ u32 msg[3] = { clock, 0, 0 }; ++ ++ rpi_firmware_property(rpi_firmware_get(NULL), ++ RPI_FIRMWARE_SET_SDHOST_CLOCK, ++ &msg, sizeof(msg)); ++ ++ clock = max(msg[1], msg[2]); ++ spin_lock_irqsave(&host->lock, flags); ++ } else { ++ spin_lock_irqsave(&host->lock, flags); ++ if (clock < 100000) { ++ /* Can't stop the clock, but make it as slow as ++ * possible to show willing ++ */ ++ host->cdiv = SDCDIV_MAX_CDIV; ++ bcm2835_sdhost_write(host, host->cdiv, SDCDIV); ++ mmiowb(); ++ spin_unlock_irqrestore(&host->lock, flags); ++ return; ++ } ++ ++ div = host->max_clk / clock; ++ if (div < 2) ++ div = 2; ++ if ((host->max_clk / div) > clock) ++ div++; ++ div -= 2; ++ ++ if (div > SDCDIV_MAX_CDIV) ++ div = SDCDIV_MAX_CDIV; ++ ++ clock = host->max_clk / (div + 2); ++ ++ host->cdiv = div; ++ bcm2835_sdhost_write(host, host->cdiv, SDCDIV); ++ ++ if (host->debug) ++ pr_info("%s: clock=%d -> max_clk=%d, cdiv=%x " ++ "(actual clock %d)\n", ++ mmc_hostname(host->mmc), input_clock, ++ host->max_clk, host->cdiv, ++ clock); ++ } ++ ++ /* Calibrate some delays */ ++ ++ host->ns_per_fifo_word = (1000000000/clock) * ++ ((host->mmc->caps & MMC_CAP_4_BIT_DATA) ? 8 : 32); ++ ++ if (input_clock == 50 * MHZ) { ++ if (clock > input_clock) { ++ /* Save the closest value, to make it easier ++ to reduce in the event of error */ ++ host->overclock_50 = (clock/MHZ); ++ ++ if (clock != host->overclock) { ++ pr_warn("%s: overclocking to %dHz\n", ++ mmc_hostname(host->mmc), clock); ++ host->overclock = clock; ++ } ++ } else if (host->overclock) { ++ host->overclock = 0; ++ if (clock == 50 * MHZ) ++ pr_warn("%s: cancelling overclock\n", ++ mmc_hostname(host->mmc)); ++ } ++ } ++ ++ /* Set the timeout to 500ms */ ++ bcm2835_sdhost_write(host, clock/2, SDTOUT); ++ ++ host->mmc->actual_clock = clock; ++ host->clock = input_clock; ++ host->reset_clock = 0; ++ ++ mmiowb(); ++ spin_unlock_irqrestore(&host->lock, flags); ++} ++ ++static void bcm2835_sdhost_request(struct mmc_host *mmc, struct mmc_request *mrq) ++{ ++ struct bcm2835_host *host; ++ unsigned long flags; ++ u32 edm, fsm; ++ ++ host = mmc_priv(mmc); ++ ++ if (host->debug) { ++ struct mmc_command *cmd = mrq->cmd; ++ BUG_ON(!cmd); ++ if (cmd->data) ++ pr_info("%s: cmd %d 0x%x (flags 0x%x) - %s %d*%d\n", ++ mmc_hostname(mmc), ++ cmd->opcode, cmd->arg, cmd->flags, ++ (cmd->data->flags & MMC_DATA_READ) ? ++ "read" : "write", cmd->data->blocks, ++ cmd->data->blksz); ++ else ++ pr_info("%s: cmd %d 0x%x (flags 0x%x)\n", ++ mmc_hostname(mmc), ++ cmd->opcode, cmd->arg, cmd->flags); ++ } ++ ++ /* Reset the error statuses in case this is a retry */ ++ if (mrq->sbc) ++ mrq->sbc->error = 0; ++ if (mrq->cmd) ++ mrq->cmd->error = 0; ++ if (mrq->data) ++ mrq->data->error = 0; ++ if (mrq->stop) ++ mrq->stop->error = 0; ++ ++ if (mrq->data && !is_power_of_2(mrq->data->blksz)) { ++ pr_err("%s: unsupported block size (%d bytes)\n", ++ mmc_hostname(mmc), mrq->data->blksz); ++ mrq->cmd->error = -EINVAL; ++ mmc_request_done(mmc, mrq); ++ return; ++ } ++ ++ if (host->use_dma && mrq->data && ++ (mrq->data->blocks > host->pio_limit)) ++ bcm2835_sdhost_prepare_dma(host, mrq->data); ++ ++ if (host->reset_clock) ++ bcm2835_sdhost_set_clock(host, host->clock); ++ ++ spin_lock_irqsave(&host->lock, flags); ++ ++ WARN_ON(host->mrq != NULL); ++ host->mrq = mrq; ++ ++ edm = bcm2835_sdhost_read(host, SDEDM); ++ fsm = edm & SDEDM_FSM_MASK; ++ ++ log_event("REQ<", (u32)mrq, edm); ++ if ((fsm != SDEDM_FSM_IDENTMODE) && ++ (fsm != SDEDM_FSM_DATAMODE)) { ++ pr_err("%s: previous command (%d) not complete (EDM %x)\n", ++ mmc_hostname(host->mmc), ++ bcm2835_sdhost_read(host, SDCMD) & SDCMD_CMD_MASK, ++ edm); ++ log_event("REQ!", (u32)mrq, edm); ++ log_dump(); ++ bcm2835_sdhost_dumpregs(host); ++ mrq->cmd->error = -EILSEQ; ++ tasklet_schedule(&host->finish_tasklet); ++ mmiowb(); ++ spin_unlock_irqrestore(&host->lock, flags); ++ return; ++ } ++ ++ host->use_sbc = !!mrq->sbc && ++ (host->mrq->data->flags & USE_CMD23_FLAGS); ++ if (host->use_sbc) { ++ if (bcm2835_sdhost_send_command(host, mrq->sbc)) { ++ if (!host->use_busy) ++ bcm2835_sdhost_finish_command(host, &flags); ++ } ++ } else if (bcm2835_sdhost_send_command(host, mrq->cmd)) { ++ if (host->data && host->dma_desc) ++ /* DMA transfer starts now, PIO starts after irq */ ++ bcm2835_sdhost_start_dma(host); ++ ++ if (!host->use_busy) ++ bcm2835_sdhost_finish_command(host, &flags); ++ } ++ ++ log_event("CMD ", (u32)mrq->cmd->opcode, ++ mrq->data ? (u32)mrq->data->blksz : 0); ++ mmiowb(); ++ ++ log_event("REQ>", (u32)mrq, 0); ++ spin_unlock_irqrestore(&host->lock, flags); ++} ++ ++static void bcm2835_sdhost_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) ++{ ++ ++ struct bcm2835_host *host = mmc_priv(mmc); ++ unsigned long flags; ++ ++ if (host->debug) ++ pr_info("%s: ios clock %d, pwr %d, bus_width %d, " ++ "timing %d, vdd %d, drv_type %d\n", ++ mmc_hostname(mmc), ++ ios->clock, ios->power_mode, ios->bus_width, ++ ios->timing, ios->signal_voltage, ios->drv_type); ++ ++ spin_lock_irqsave(&host->lock, flags); ++ ++ log_event("IOS<", ios->clock, 0); ++ ++ /* set bus width */ ++ host->hcfg &= ~SDHCFG_WIDE_EXT_BUS; ++ if (ios->bus_width == MMC_BUS_WIDTH_4) ++ host->hcfg |= SDHCFG_WIDE_EXT_BUS; ++ ++ host->hcfg |= SDHCFG_WIDE_INT_BUS; ++ ++ /* Disable clever clock switching, to cope with fast core clocks */ ++ host->hcfg |= SDHCFG_SLOW_CARD; ++ ++ bcm2835_sdhost_write(host, host->hcfg, SDHCFG); ++ ++ mmiowb(); ++ ++ spin_unlock_irqrestore(&host->lock, flags); ++ ++ if (!ios->clock || ios->clock != host->clock) ++ bcm2835_sdhost_set_clock(host, ios->clock); ++} ++ ++static struct mmc_host_ops bcm2835_sdhost_ops = { ++ .request = bcm2835_sdhost_request, ++ .set_ios = bcm2835_sdhost_set_ios, ++ .hw_reset = bcm2835_sdhost_reset, ++}; ++ ++static void bcm2835_sdhost_cmd_wait_work(struct work_struct *work) ++{ ++ struct bcm2835_host *host; ++ unsigned long flags; ++ ++ host = container_of(work, struct bcm2835_host, cmd_wait_wq); ++ ++ spin_lock_irqsave(&host->lock, flags); ++ ++ log_event("CWK<", (u32)host->cmd, (u32)host->mrq); ++ ++ /* ++ * If this tasklet gets rescheduled while running, it will ++ * be run again afterwards but without any active request. ++ */ ++ if (!host->mrq) { ++ spin_unlock_irqrestore(&host->lock, flags); ++ return; ++ } ++ ++ bcm2835_sdhost_finish_command(host, &flags); ++ ++ mmiowb(); ++ ++ log_event("CWK>", (u32)host->cmd, 0); ++ ++ spin_unlock_irqrestore(&host->lock, flags); ++} ++ ++static void bcm2835_sdhost_tasklet_finish(unsigned long param) ++{ ++ struct bcm2835_host *host; ++ unsigned long flags; ++ struct mmc_request *mrq; ++ struct dma_chan *terminate_chan = NULL; ++ ++ host = (struct bcm2835_host *)param; ++ ++ spin_lock_irqsave(&host->lock, flags); ++ ++ log_event("TSK<", (u32)host->mrq, 0); ++ /* ++ * If this tasklet gets rescheduled while running, it will ++ * be run again afterwards but without any active request. ++ */ ++ if (!host->mrq) { ++ spin_unlock_irqrestore(&host->lock, flags); ++ return; ++ } ++ ++ del_timer(&host->timer); ++ ++ mrq = host->mrq; ++ ++ /* Drop the overclock after any data corruption, or after any ++ error overclocked */ ++ if (host->overclock) { ++ if ((mrq->cmd && mrq->cmd->error) || ++ (mrq->data && mrq->data->error) || ++ (mrq->stop && mrq->stop->error)) { ++ host->overclock_50--; ++ pr_warn("%s: reducing overclock due to errors\n", ++ mmc_hostname(host->mmc)); ++ host->reset_clock = 1; ++ mrq->cmd->error = -EILSEQ; ++ mrq->cmd->retries = 1; ++ } ++ } ++ ++ host->mrq = NULL; ++ host->cmd = NULL; ++ host->data = NULL; ++ ++ mmiowb(); ++ ++ host->dma_desc = NULL; ++ terminate_chan = host->dma_chan; ++ host->dma_chan = NULL; ++ ++ spin_unlock_irqrestore(&host->lock, flags); ++ ++ if (terminate_chan) ++ { ++ int err = dmaengine_terminate_all(terminate_chan); ++ if (err) ++ pr_err("%s: failed to terminate DMA (%d)\n", ++ mmc_hostname(host->mmc), err); ++ } ++ ++ mmc_request_done(host->mmc, mrq); ++ log_event("TSK>", (u32)mrq, 0); ++} ++ ++int bcm2835_sdhost_add_host(struct bcm2835_host *host) ++{ ++ struct mmc_host *mmc; ++ struct dma_slave_config cfg; ++ char pio_limit_string[20]; ++ int ret; ++ ++ mmc = host->mmc; ++ ++ bcm2835_sdhost_reset_internal(host); ++ ++ mmc->f_max = host->max_clk; ++ mmc->f_min = host->max_clk / SDCDIV_MAX_CDIV; ++ ++ mmc->max_busy_timeout = (~(unsigned int)0)/(mmc->f_max/1000); ++ ++ pr_debug("f_max %d, f_min %d, max_busy_timeout %d\n", ++ mmc->f_max, mmc->f_min, mmc->max_busy_timeout); ++ ++ /* host controller capabilities */ ++ mmc->caps |= ++ MMC_CAP_SD_HIGHSPEED | MMC_CAP_MMC_HIGHSPEED | ++ MMC_CAP_NEEDS_POLL | MMC_CAP_HW_RESET | MMC_CAP_ERASE | ++ ((ALLOW_CMD23_READ|ALLOW_CMD23_WRITE) * MMC_CAP_CMD23); ++ ++ spin_lock_init(&host->lock); ++ ++ if (host->allow_dma) { ++ if (IS_ERR_OR_NULL(host->dma_chan_rxtx)) { ++ pr_err("%s: unable to initialise DMA channel. " ++ "Falling back to PIO\n", ++ mmc_hostname(mmc)); ++ host->use_dma = false; ++ } else { ++ cfg.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; ++ cfg.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; ++ cfg.slave_id = 13; /* DREQ channel */ ++ ++ /* Validate the slave configurations */ ++ ++ cfg.direction = DMA_MEM_TO_DEV; ++ cfg.src_addr = 0; ++ cfg.dst_addr = host->bus_addr + SDDATA; ++ ++ ret = dmaengine_slave_config(host->dma_chan_rxtx, &cfg); ++ ++ if (ret == 0) { ++ host->dma_cfg_tx = cfg; ++ ++ cfg.direction = DMA_DEV_TO_MEM; ++ cfg.src_addr = host->bus_addr + SDDATA; ++ cfg.dst_addr = 0; ++ ++ ret = dmaengine_slave_config(host->dma_chan_rxtx, &cfg); ++ } ++ ++ if (ret == 0) { ++ host->dma_cfg_rx = cfg; ++ ++ host->use_dma = true; ++ } else { ++ pr_err("%s: unable to configure DMA channel. " ++ "Falling back to PIO\n", ++ mmc_hostname(mmc)); ++ dma_release_channel(host->dma_chan_rxtx); ++ host->dma_chan_rxtx = NULL; ++ host->use_dma = false; ++ } ++ } ++ } else { ++ host->use_dma = false; ++ } ++ ++ mmc->max_segs = 128; ++ mmc->max_req_size = 524288; ++ mmc->max_seg_size = mmc->max_req_size; ++ mmc->max_blk_size = 512; ++ mmc->max_blk_count = 65535; ++ ++ /* report supported voltage ranges */ ++ mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34; ++ ++ tasklet_init(&host->finish_tasklet, ++ bcm2835_sdhost_tasklet_finish, (unsigned long)host); ++ ++ INIT_WORK(&host->cmd_wait_wq, bcm2835_sdhost_cmd_wait_work); ++ ++ setup_timer(&host->timer, bcm2835_sdhost_timeout, ++ (unsigned long)host); ++ ++ bcm2835_sdhost_init(host, 0); ++ ++ ret = request_irq(host->irq, bcm2835_sdhost_irq, 0 /*IRQF_SHARED*/, ++ mmc_hostname(mmc), host); ++ if (ret) { ++ pr_err("%s: failed to request IRQ %d: %d\n", ++ mmc_hostname(mmc), host->irq, ret); ++ goto untasklet; ++ } ++ ++ mmiowb(); ++ mmc_add_host(mmc); ++ ++ pio_limit_string[0] = '\0'; ++ if (host->use_dma && (host->pio_limit > 0)) ++ sprintf(pio_limit_string, " (>%d)", host->pio_limit); ++ pr_info("%s: %s loaded - DMA %s%s\n", ++ mmc_hostname(mmc), DRIVER_NAME, ++ host->use_dma ? "enabled" : "disabled", ++ pio_limit_string); ++ ++ return 0; ++ ++untasklet: ++ tasklet_kill(&host->finish_tasklet); ++ ++ return ret; ++} ++ ++static int bcm2835_sdhost_probe(struct platform_device *pdev) ++{ ++ struct device *dev = &pdev->dev; ++ struct device_node *node = dev->of_node; ++ struct clk *clk; ++ struct resource *iomem; ++ struct bcm2835_host *host; ++ struct mmc_host *mmc; ++ const __be32 *addr; ++ u32 msg[3]; ++ int ret; ++ ++ pr_debug("bcm2835_sdhost_probe\n"); ++ mmc = mmc_alloc_host(sizeof(*host), dev); ++ if (!mmc) ++ return -ENOMEM; ++ ++ mmc->ops = &bcm2835_sdhost_ops; ++ host = mmc_priv(mmc); ++ host->mmc = mmc; ++ host->pio_timeout = msecs_to_jiffies(500); ++ host->pio_limit = 1; ++ host->max_delay = 1; /* Warn if over 1ms */ ++ host->allow_dma = 1; ++ spin_lock_init(&host->lock); ++ ++ iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0); ++ host->ioaddr = devm_ioremap_resource(dev, iomem); ++ if (IS_ERR(host->ioaddr)) { ++ ret = PTR_ERR(host->ioaddr); ++ goto err; ++ } ++ ++ addr = of_get_address(node, 0, NULL, NULL); ++ if (!addr) { ++ dev_err(dev, "could not get DMA-register address\n"); ++ return -ENODEV; ++ } ++ host->bus_addr = be32_to_cpup(addr); ++ log_init(iomem->start - host->bus_addr); ++ pr_debug(" - ioaddr %lx, iomem->start %lx, bus_addr %lx\n", ++ (unsigned long)host->ioaddr, ++ (unsigned long)iomem->start, ++ (unsigned long)host->bus_addr); ++ ++ if (node) { ++ /* Read any custom properties */ ++ of_property_read_u32(node, ++ "brcm,delay-after-stop", ++ &host->delay_after_stop); ++ of_property_read_u32(node, ++ "brcm,overclock-50", ++ &host->overclock_50); ++ of_property_read_u32(node, ++ "brcm,pio-limit", ++ &host->pio_limit); ++ host->allow_dma = ++ !of_property_read_bool(node, "brcm,force-pio"); ++ host->debug = of_property_read_bool(node, "brcm,debug"); ++ } ++ ++ host->dma_chan = NULL; ++ host->dma_desc = NULL; ++ ++ /* Formally recognise the other way of disabling DMA */ ++ if (host->pio_limit == 0x7fffffff) ++ host->allow_dma = false; ++ ++ if (host->allow_dma) { ++ if (node) { ++ host->dma_chan_rxtx = ++ dma_request_slave_channel(dev, "rx-tx"); ++ if (!host->dma_chan_rxtx) ++ host->dma_chan_rxtx = ++ dma_request_slave_channel(dev, "tx"); ++ if (!host->dma_chan_rxtx) ++ host->dma_chan_rxtx = ++ dma_request_slave_channel(dev, "rx"); ++ } else { ++ dma_cap_mask_t mask; ++ ++ dma_cap_zero(mask); ++ /* we don't care about the channel, any would work */ ++ dma_cap_set(DMA_SLAVE, mask); ++ host->dma_chan_rxtx = ++ dma_request_channel(mask, NULL, NULL); ++ } ++ } ++ ++ clk = devm_clk_get(dev, NULL); ++ if (IS_ERR(clk)) { ++ dev_err(dev, "could not get clk\n"); ++ ret = PTR_ERR(clk); ++ goto err; ++ } ++ ++ host->max_clk = clk_get_rate(clk); ++ ++ host->irq = platform_get_irq(pdev, 0); ++ if (host->irq <= 0) { ++ dev_err(dev, "get IRQ failed\n"); ++ ret = -EINVAL; ++ goto err; ++ } ++ ++ pr_debug(" - max_clk %lx, irq %d\n", ++ (unsigned long)host->max_clk, ++ (int)host->irq); ++ ++ if (node) ++ mmc_of_parse(mmc); ++ else ++ mmc->caps |= MMC_CAP_4_BIT_DATA; ++ ++ msg[0] = 0; ++ msg[1] = ~0; ++ msg[2] = ~0; ++ ++ rpi_firmware_property(rpi_firmware_get(NULL), ++ RPI_FIRMWARE_SET_SDHOST_CLOCK, ++ &msg, sizeof(msg)); ++ ++ host->firmware_sets_cdiv = (msg[1] != ~0); ++ ++ ret = bcm2835_sdhost_add_host(host); ++ if (ret) ++ goto err; ++ ++ platform_set_drvdata(pdev, host); ++ ++ pr_debug("bcm2835_sdhost_probe -> OK\n"); ++ ++ return 0; ++ ++err: ++ pr_debug("bcm2835_sdhost_probe -> err %d\n", ret); ++ mmc_free_host(mmc); ++ ++ return ret; ++} ++ ++static int bcm2835_sdhost_remove(struct platform_device *pdev) ++{ ++ struct bcm2835_host *host = platform_get_drvdata(pdev); ++ ++ pr_debug("bcm2835_sdhost_remove\n"); ++ ++ mmc_remove_host(host->mmc); ++ ++ bcm2835_sdhost_set_power(host, false); ++ ++ free_irq(host->irq, host); ++ ++ del_timer_sync(&host->timer); ++ ++ tasklet_kill(&host->finish_tasklet); ++ ++ mmc_free_host(host->mmc); ++ platform_set_drvdata(pdev, NULL); ++ ++ pr_debug("bcm2835_sdhost_remove - OK\n"); ++ return 0; ++} ++ ++static const struct of_device_id bcm2835_sdhost_match[] = { ++ { .compatible = "brcm,bcm2835-sdhost" }, ++ { } ++}; ++MODULE_DEVICE_TABLE(of, bcm2835_sdhost_match); ++ ++static struct platform_driver bcm2835_sdhost_driver = { ++ .probe = bcm2835_sdhost_probe, ++ .remove = bcm2835_sdhost_remove, ++ .driver = { ++ .name = DRIVER_NAME, ++ .owner = THIS_MODULE, ++ .of_match_table = bcm2835_sdhost_match, ++ }, ++}; ++module_platform_driver(bcm2835_sdhost_driver); ++ ++MODULE_ALIAS("platform:sdhost-bcm2835"); ++MODULE_DESCRIPTION("BCM2835 SDHost driver"); ++MODULE_LICENSE("GPL v2"); ++MODULE_AUTHOR("Phil Elwell"); + +From 6f2e23aee85a87ba940dd5649a290e4e0a1fd84e Mon Sep 17 00:00:00 2001 +From: Phil Elwell <phil@raspberrypi.org> +Date: Wed, 11 May 2016 12:50:33 +0100 +Subject: [PATCH 038/112] mmc: Add MMC_QUIRK_ERASE_BROKEN for some cards + +Some SD cards have been found that corrupt data when small blocks +are erased. Add a quirk to indicate that ERASE should not be used, +and set it for cards of that type. + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> + +mmc: Apply QUIRK_BROKEN_ERASE to other capacities + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> + +mmc: Add card_quirks module parameter, log quirks + +Use mmc_block.card_quirks to override the quirks for all SD or MMC +cards. The value is a bitfield using the bit positions defined in +include/linux/mmc/card.h. If the module parameter is placed in the +kernel command line (or bootargs) stored on the card then, assuming the +device only has one SD card interface, the override effectively becomes +card-specific. + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> +--- + drivers/mmc/card/block.c | 39 ++++++++++++++++++++++++++++++++++++--- + drivers/mmc/core/core.c | 3 ++- + include/linux/mmc/card.h | 3 +++ + 3 files changed, 41 insertions(+), 4 deletions(-) + +diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c +index b0a2741..9ce8676 100644 +--- a/drivers/mmc/card/block.c ++++ b/drivers/mmc/card/block.c +@@ -132,6 +132,13 @@ enum { + module_param(perdev_minors, int, 0444); + MODULE_PARM_DESC(perdev_minors, "Minors numbers to allocate per device"); + ++/* ++ * Allow quirks to be overridden for the current card ++ */ ++static char *card_quirks; ++module_param(card_quirks, charp, 0644); ++MODULE_PARM_DESC(card_quirks, "Force the use of the indicated quirks (a bitfield)"); ++ + static inline int mmc_blk_part_switch(struct mmc_card *card, + struct mmc_blk_data *md); + static int get_card_status(struct mmc_card *card, u32 *status, int retries); +@@ -2532,6 +2539,17 @@ static const struct mmc_fixup blk_fixups[] = + MMC_FIXUP("V10016", CID_MANFID_KINGSTON, CID_OEMID_ANY, add_quirk_mmc, + MMC_QUIRK_TRIM_BROKEN), + ++ /* ++ * On some Kingston SD cards, multiple erases of less than 64 ++ * sectors can cause corruption. ++ */ ++ MMC_FIXUP("SD16G", 0x41, 0x3432, add_quirk_mmc, ++ MMC_QUIRK_ERASE_BROKEN), ++ MMC_FIXUP("SD32G", 0x41, 0x3432, add_quirk_mmc, ++ MMC_QUIRK_ERASE_BROKEN), ++ MMC_FIXUP("SD64G", 0x41, 0x3432, add_quirk_mmc, ++ MMC_QUIRK_ERASE_BROKEN), ++ + END_FIXUP + }; + +@@ -2539,6 +2557,7 @@ static int mmc_blk_probe(struct mmc_card *card) + { + struct mmc_blk_data *md, *part_md; + char cap_str[10]; ++ char quirk_str[24]; + + /* + * Check that the card supports the command class(es) we need. +@@ -2546,7 +2565,16 @@ static int mmc_blk_probe(struct mmc_card *card) + if (!(card->csd.cmdclass & CCC_BLOCK_READ)) + return -ENODEV; + +- mmc_fixup_device(card, blk_fixups); ++ if (card_quirks) { ++ unsigned long quirks; ++ if (kstrtoul(card_quirks, 0, &quirks) == 0) ++ card->quirks = (unsigned int)quirks; ++ else ++ pr_err("mmc_block: Invalid card_quirks parameter '%s'\n", ++ card_quirks); ++ } ++ else ++ mmc_fixup_device(card, blk_fixups); + + md = mmc_blk_alloc(card); + if (IS_ERR(md)) +@@ -2554,9 +2582,14 @@ static int mmc_blk_probe(struct mmc_card *card) + + string_get_size((u64)get_capacity(md->disk), 512, STRING_UNITS_2, + cap_str, sizeof(cap_str)); +- pr_info("%s: %s %s %s %s\n", ++ if (card->quirks) ++ snprintf(quirk_str, sizeof(quirk_str), ++ " (quirks 0x%08x)", card->quirks); ++ else ++ quirk_str[0] = '\0'; ++ pr_info("%s: %s %s %s%s%s\n", + md->disk->disk_name, mmc_card_id(card), mmc_card_name(card), +- cap_str, md->read_only ? "(ro)" : ""); ++ cap_str, md->read_only ? " (ro)" : "", quirk_str); + + if (mmc_blk_alloc_parts(card, md)) + goto out; +diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c +index 9eba56c..4b1ff84 100644 +--- a/drivers/mmc/core/core.c ++++ b/drivers/mmc/core/core.c +@@ -2253,7 +2253,8 @@ EXPORT_SYMBOL(mmc_erase); + int mmc_can_erase(struct mmc_card *card) + { + if ((card->host->caps & MMC_CAP_ERASE) && +- (card->csd.cmdclass & CCC_ERASE) && card->erase_size) ++ (card->csd.cmdclass & CCC_ERASE) && card->erase_size && ++ !(card->quirks & MMC_QUIRK_ERASE_BROKEN)) + return 1; + return 0; + } +diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h +index eb0151b..fa4e645 100644 +--- a/include/linux/mmc/card.h ++++ b/include/linux/mmc/card.h +@@ -281,6 +281,9 @@ struct mmc_card { + #define MMC_QUIRK_TRIM_BROKEN (1<<12) /* Skip trim */ + + ++#define MMC_QUIRK_ERASE_BROKEN (1<<31) /* Skip erase */ ++ ++ + unsigned int erase_size; /* erase size in sectors */ + unsigned int erase_shift; /* if erase unit is power 2 */ + unsigned int pref_erase; /* in sectors */ + +From b3dfc4d3fd00b16fdde707b9974710ca1378b1b8 Mon Sep 17 00:00:00 2001 +From: popcornmix <popcornmix@gmail.com> +Date: Wed, 3 Jul 2013 00:31:47 +0100 +Subject: [PATCH 039/112] cma: Add vc_cma driver to enable use of CMA +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: popcornmix <popcornmix@gmail.com> + +vc_cma: Make the vc_cma area the default contiguous DMA area + +vc_cma: Provide empty functions when module is not built + +Providing empty functions saves the users from guarding the +function call with an #if clause. +Move __init markings from prototypes to functions. + +Signed-off-by: Noralf Trønnes <noralf@tronnes.org> +--- + drivers/char/Kconfig | 2 + + drivers/char/Makefile | 1 + + drivers/char/broadcom/Kconfig | 15 + + drivers/char/broadcom/Makefile | 1 + + drivers/char/broadcom/vc_cma/Makefile | 14 + + drivers/char/broadcom/vc_cma/vc_cma.c | 1193 +++++++++++++++++++++++++++++++++ + include/linux/broadcom/vc_cma.h | 36 + + 7 files changed, 1262 insertions(+) + create mode 100644 drivers/char/broadcom/Kconfig + create mode 100644 drivers/char/broadcom/Makefile + create mode 100644 drivers/char/broadcom/vc_cma/Makefile + create mode 100644 drivers/char/broadcom/vc_cma/vc_cma.c + create mode 100644 include/linux/broadcom/vc_cma.h + +diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig +index 3ec0766..aec9337 100644 +--- a/drivers/char/Kconfig ++++ b/drivers/char/Kconfig +@@ -4,6 +4,8 @@ + + menu "Character devices" + ++source "drivers/char/broadcom/Kconfig" ++ + source "drivers/tty/Kconfig" + + config DEVMEM +diff --git a/drivers/char/Makefile b/drivers/char/Makefile +index d8a7579..9d8662e 100644 +--- a/drivers/char/Makefile ++++ b/drivers/char/Makefile +@@ -60,3 +60,4 @@ js-rtc-y = rtc.o + + obj-$(CONFIG_TILE_SROM) += tile-srom.o + obj-$(CONFIG_XILLYBUS) += xillybus/ ++obj-$(CONFIG_BRCM_CHAR_DRIVERS) += broadcom/ +diff --git a/drivers/char/broadcom/Kconfig b/drivers/char/broadcom/Kconfig +new file mode 100644 +index 0000000..2d8bd6e +--- /dev/null ++++ b/drivers/char/broadcom/Kconfig +@@ -0,0 +1,15 @@ ++# ++# Broadcom char driver config ++# ++ ++menuconfig BRCM_CHAR_DRIVERS ++ bool "Broadcom Char Drivers" ++ help ++ Broadcom's char drivers ++ ++config BCM_VC_CMA ++ bool "Videocore CMA" ++ depends on CMA && BRCM_CHAR_DRIVERS && BCM2708_VCHIQ ++ default n ++ help ++ Helper for videocore CMA access. +diff --git a/drivers/char/broadcom/Makefile b/drivers/char/broadcom/Makefile +new file mode 100644 +index 0000000..13c5bca +--- /dev/null ++++ b/drivers/char/broadcom/Makefile +@@ -0,0 +1 @@ ++obj-$(CONFIG_BCM_VC_CMA) += vc_cma/ +diff --git a/drivers/char/broadcom/vc_cma/Makefile b/drivers/char/broadcom/vc_cma/Makefile +new file mode 100644 +index 0000000..6a94de4 +--- /dev/null ++++ b/drivers/char/broadcom/vc_cma/Makefile +@@ -0,0 +1,14 @@ ++ccflags-y += -Wall -Wstrict-prototypes -Wno-trigraphs ++ccflags-y += -Werror ++ccflags-y += -Iinclude/linux/broadcom ++ccflags-y += -Idrivers/misc/vc04_services ++ccflags-y += -Idrivers/misc/vc04_services/interface/vchi ++ccflags-y += -Idrivers/misc/vc04_services/interface/vchiq_arm ++ ++ccflags-y += -D__KERNEL__ ++ccflags-y += -D__linux__ ++ccflags-y += -Werror ++ ++obj-$(CONFIG_BCM_VC_CMA) += vc-cma.o ++ ++vc-cma-objs := vc_cma.o +diff --git a/drivers/char/broadcom/vc_cma/vc_cma.c b/drivers/char/broadcom/vc_cma/vc_cma.c +new file mode 100644 +index 0000000..85f6e9d +--- /dev/null ++++ b/drivers/char/broadcom/vc_cma/vc_cma.c +@@ -0,0 +1,1193 @@ ++/** ++ * Copyright (c) 2010-2012 Broadcom. 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, ++ * without modification. ++ * 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. ++ * 3. The names of the above-listed copyright holders may not be used ++ * to endorse or promote products derived from this software without ++ * specific prior written permission. ++ * ++ * ALTERNATIVELY, this software may be distributed under the terms of the ++ * GNU General Public License ("GPL") version 2, as published by the Free ++ * Software Foundation. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER OR ++ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ++ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, ++ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR ++ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF ++ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING ++ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ */ ++ ++#include <linux/kernel.h> ++#include <linux/module.h> ++#include <linux/kthread.h> ++#include <linux/fs.h> ++#include <linux/device.h> ++#include <linux/cdev.h> ++#include <linux/mm.h> ++#include <linux/proc_fs.h> ++#include <linux/seq_file.h> ++#include <linux/dma-mapping.h> ++#include <linux/dma-contiguous.h> ++#include <linux/platform_device.h> ++#include <linux/uaccess.h> ++#include <asm/cacheflush.h> ++ ++#include "vc_cma.h" ++ ++#include "vchiq_util.h" ++#include "vchiq_connected.h" ++//#include "debug_sym.h" ++//#include "vc_mem.h" ++ ++#define DRIVER_NAME "vc-cma" ++ ++#define LOG_DBG(fmt, ...) \ ++ if (vc_cma_debug) \ ++ printk(KERN_INFO fmt "\n", ##__VA_ARGS__) ++#define LOG_INFO(fmt, ...) \ ++ printk(KERN_INFO fmt "\n", ##__VA_ARGS__) ++#define LOG_ERR(fmt, ...) \ ++ printk(KERN_ERR fmt "\n", ##__VA_ARGS__) ++ ++#define VC_CMA_FOURCC VCHIQ_MAKE_FOURCC('C', 'M', 'A', ' ') ++#define VC_CMA_VERSION 2 ++ ++#define VC_CMA_CHUNK_ORDER 6 /* 256K */ ++#define VC_CMA_CHUNK_SIZE (4096 << VC_CMA_CHUNK_ORDER) ++#define VC_CMA_MAX_PARAMS_PER_MSG \ ++ ((VCHIQ_MAX_MSG_SIZE - sizeof(unsigned short))/sizeof(unsigned short)) ++#define VC_CMA_RESERVE_COUNT_MAX 16 ++ ++#define PAGES_PER_CHUNK (VC_CMA_CHUNK_SIZE / PAGE_SIZE) ++ ++#define VCADDR_TO_PHYSADDR(vcaddr) (mm_vc_mem_phys_addr + vcaddr) ++ ++#define loud_error(...) \ ++ LOG_ERR("===== " __VA_ARGS__) ++ ++enum { ++ VC_CMA_MSG_QUIT, ++ VC_CMA_MSG_OPEN, ++ VC_CMA_MSG_TICK, ++ VC_CMA_MSG_ALLOC, /* chunk count */ ++ VC_CMA_MSG_FREE, /* chunk, chunk, ... */ ++ VC_CMA_MSG_ALLOCATED, /* chunk, chunk, ... */ ++ VC_CMA_MSG_REQUEST_ALLOC, /* chunk count */ ++ VC_CMA_MSG_REQUEST_FREE, /* chunk count */ ++ VC_CMA_MSG_RESERVE, /* bytes lo, bytes hi */ ++ VC_CMA_MSG_UPDATE_RESERVE, ++ VC_CMA_MSG_MAX ++}; ++ ++struct cma_msg { ++ unsigned short type; ++ unsigned short params[VC_CMA_MAX_PARAMS_PER_MSG]; ++}; ++ ++struct vc_cma_reserve_user { ++ unsigned int pid; ++ unsigned int reserve; ++}; ++ ++/* Device (/dev) related variables */ ++static dev_t vc_cma_devnum; ++static struct class *vc_cma_class; ++static struct cdev vc_cma_cdev; ++static int vc_cma_inited; ++static int vc_cma_debug; ++ ++/* Proc entry */ ++static struct proc_dir_entry *vc_cma_proc_entry; ++ ++phys_addr_t vc_cma_base; ++struct page *vc_cma_base_page; ++unsigned int vc_cma_size; ++EXPORT_SYMBOL(vc_cma_size); ++unsigned int vc_cma_initial; ++unsigned int vc_cma_chunks; ++unsigned int vc_cma_chunks_used; ++unsigned int vc_cma_chunks_reserved; ++ ++ ++void *vc_cma_dma_alloc; ++unsigned int vc_cma_dma_size; ++ ++static int in_loud_error; ++ ++unsigned int vc_cma_reserve_total; ++unsigned int vc_cma_reserve_count; ++struct vc_cma_reserve_user vc_cma_reserve_users[VC_CMA_RESERVE_COUNT_MAX]; ++static DEFINE_SEMAPHORE(vc_cma_reserve_mutex); ++static DEFINE_SEMAPHORE(vc_cma_worker_queue_push_mutex); ++ ++static u64 vc_cma_dma_mask = DMA_BIT_MASK(32); ++static struct platform_device vc_cma_device = { ++ .name = "vc-cma", ++ .id = 0, ++ .dev = { ++ .dma_mask = &vc_cma_dma_mask, ++ .coherent_dma_mask = DMA_BIT_MASK(32), ++ }, ++}; ++ ++static VCHIQ_INSTANCE_T cma_instance; ++static VCHIQ_SERVICE_HANDLE_T cma_service; ++static VCHIU_QUEUE_T cma_msg_queue; ++static struct task_struct *cma_worker; ++ ++static int vc_cma_set_reserve(unsigned int reserve, unsigned int pid); ++static int vc_cma_alloc_chunks(int num_chunks, struct cma_msg *reply); ++static VCHIQ_STATUS_T cma_service_callback(VCHIQ_REASON_T reason, ++ VCHIQ_HEADER_T * header, ++ VCHIQ_SERVICE_HANDLE_T service, ++ void *bulk_userdata); ++static void send_vc_msg(unsigned short type, ++ unsigned short param1, unsigned short param2); ++static bool send_worker_msg(VCHIQ_HEADER_T * msg); ++ ++static int early_vc_cma_mem(char *p) ++{ ++ unsigned int new_size; ++ printk(KERN_NOTICE "early_vc_cma_mem(%s)", p); ++ vc_cma_size = memparse(p, &p); ++ vc_cma_initial = vc_cma_size; ++ if (*p == '/') ++ vc_cma_size = memparse(p + 1, &p); ++ if (*p == '@') ++ vc_cma_base = memparse(p + 1, &p); ++ ++ new_size = (vc_cma_size - ((-vc_cma_base) & (VC_CMA_CHUNK_SIZE - 1))) ++ & ~(VC_CMA_CHUNK_SIZE - 1); ++ if (new_size > vc_cma_size) ++ vc_cma_size = 0; ++ vc_cma_initial = (vc_cma_initial + VC_CMA_CHUNK_SIZE - 1) ++ & ~(VC_CMA_CHUNK_SIZE - 1); ++ if (vc_cma_initial > vc_cma_size) ++ vc_cma_initial = vc_cma_size; ++ vc_cma_base = (vc_cma_base + VC_CMA_CHUNK_SIZE - 1) ++ & ~(VC_CMA_CHUNK_SIZE - 1); ++ ++ printk(KERN_NOTICE " -> initial %x, size %x, base %x", vc_cma_initial, ++ vc_cma_size, (unsigned int)vc_cma_base); ++ ++ return 0; ++} ++ ++early_param("vc-cma-mem", early_vc_cma_mem); ++ ++void __init vc_cma_early_init(void) ++{ ++ LOG_DBG("vc_cma_early_init - vc_cma_chunks = %d", vc_cma_chunks); ++ if (vc_cma_size) { ++ int rc = platform_device_register(&vc_cma_device); ++ LOG_DBG("platform_device_register -> %d", rc); ++ } ++} ++ ++void __init vc_cma_reserve(void) ++{ ++ /* if vc_cma_size is set, then declare vc CMA area of the same ++ * size from the end of memory ++ */ ++ if (vc_cma_size) { ++ if (dma_declare_contiguous(&vc_cma_device.dev, vc_cma_size, ++ vc_cma_base, 0) == 0) { ++ if (!dev_get_cma_area(NULL)) { ++ /* There is no default CMA area - make this ++ the default */ ++ struct cma *vc_cma_area = dev_get_cma_area( ++ &vc_cma_device.dev); ++ dma_contiguous_set_default(vc_cma_area); ++ LOG_INFO("vc_cma_reserve - using vc_cma as " ++ "the default contiguous DMA area"); ++ } ++ } else { ++ LOG_ERR("vc_cma: dma_declare_contiguous(%x,%x) failed", ++ vc_cma_size, (unsigned int)vc_cma_base); ++ vc_cma_size = 0; ++ } ++ } ++ vc_cma_chunks = vc_cma_size / VC_CMA_CHUNK_SIZE; ++} ++ ++/**************************************************************************** ++* ++* vc_cma_open ++* ++***************************************************************************/ ++ ++static int vc_cma_open(struct inode *inode, struct file *file) ++{ ++ (void)inode; ++ (void)file; ++ ++ return 0; ++} ++ ++/**************************************************************************** ++* ++* vc_cma_release ++* ++***************************************************************************/ ++ ++static int vc_cma_release(struct inode *inode, struct file *file) ++{ ++ (void)inode; ++ (void)file; ++ ++ vc_cma_set_reserve(0, current->tgid); ++ ++ return 0; ++} ++ ++/**************************************************************************** ++* ++* vc_cma_ioctl ++* ++***************************************************************************/ ++ ++static long vc_cma_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ++{ ++ int rc = 0; ++ ++ (void)cmd; ++ (void)arg; ++ ++ switch (cmd) { ++ case VC_CMA_IOC_RESERVE: ++ rc = vc_cma_set_reserve((unsigned int)arg, current->tgid); ++ if (rc >= 0) ++ rc = 0; ++ break; ++ default: ++ LOG_ERR("vc-cma: Unknown ioctl %x", cmd); ++ return -ENOTTY; ++ } ++ ++ return rc; ++} ++ ++/**************************************************************************** ++* ++* File Operations for the driver. ++* ++***************************************************************************/ ++ ++static const struct file_operations vc_cma_fops = { ++ .owner = THIS_MODULE, ++ .open = vc_cma_open, ++ .release = vc_cma_release, ++ .unlocked_ioctl = vc_cma_ioctl, ++}; ++ ++/**************************************************************************** ++* ++* vc_cma_proc_open ++* ++***************************************************************************/ ++ ++static int vc_cma_show_info(struct seq_file *m, void *v) ++{ ++ int i; ++ ++ seq_printf(m, "Videocore CMA:\n"); ++ seq_printf(m, " Base : %08x\n", (unsigned int)vc_cma_base); ++ seq_printf(m, " Length : %08x\n", vc_cma_size); ++ seq_printf(m, " Initial : %08x\n", vc_cma_initial); ++ seq_printf(m, " Chunk size : %08x\n", VC_CMA_CHUNK_SIZE); ++ seq_printf(m, " Chunks : %4d (%d bytes)\n", ++ (int)vc_cma_chunks, ++ (int)(vc_cma_chunks * VC_CMA_CHUNK_SIZE)); ++ seq_printf(m, " Used : %4d (%d bytes)\n", ++ (int)vc_cma_chunks_used, ++ (int)(vc_cma_chunks_used * VC_CMA_CHUNK_SIZE)); ++ seq_printf(m, " Reserved : %4d (%d bytes)\n", ++ (unsigned int)vc_cma_chunks_reserved, ++ (int)(vc_cma_chunks_reserved * VC_CMA_CHUNK_SIZE)); ++ ++ for (i = 0; i < vc_cma_reserve_count; i++) { ++ struct vc_cma_reserve_user *user = &vc_cma_reserve_users[i]; ++ seq_printf(m, " PID %5d: %d bytes\n", user->pid, ++ user->reserve); ++ } ++ seq_printf(m, " dma_alloc : %p (%d pages)\n", ++ vc_cma_dma_alloc ? page_address(vc_cma_dma_alloc) : 0, ++ vc_cma_dma_size); ++ ++ seq_printf(m, "\n"); ++ ++ return 0; ++} ++ ++static int vc_cma_proc_open(struct inode *inode, struct file *file) ++{ ++ return single_open(file, vc_cma_show_info, NULL); ++} ++ ++/**************************************************************************** ++* ++* vc_cma_proc_write ++* ++***************************************************************************/ ++ ++static int vc_cma_proc_write(struct file *file, ++ const char __user *buffer, ++ size_t size, loff_t *ppos) ++{ ++ int rc = -EFAULT; ++ char input_str[20]; ++ ++ memset(input_str, 0, sizeof(input_str)); ++ ++ if (size > sizeof(input_str)) { ++ LOG_ERR("%s: input string length too long", __func__); ++ goto out; ++ } ++ ++ if (copy_from_user(input_str, buffer, size - 1)) { ++ LOG_ERR("%s: failed to get input string", __func__); ++ goto out; ++ } ++#define ALLOC_STR "alloc" ++#define FREE_STR "free" ++#define DEBUG_STR "debug" ++#define RESERVE_STR "reserve" ++#define DMA_ALLOC_STR "dma_alloc" ++#define DMA_FREE_STR "dma_free" ++ if (strncmp(input_str, ALLOC_STR, strlen(ALLOC_STR)) == 0) { ++ int alloc_size; ++ char *p = input_str + strlen(ALLOC_STR); ++ ++ while (*p == ' ') ++ p++; ++ alloc_size = memparse(p, NULL); ++ LOG_INFO("/proc/vc-cma: alloc %d", alloc_size); ++ if (alloc_size) ++ send_vc_msg(VC_CMA_MSG_REQUEST_FREE, ++ alloc_size / VC_CMA_CHUNK_SIZE, 0); ++ else ++ LOG_ERR("invalid size '%s'", p); ++ rc = size; ++ } else if (strncmp(input_str, FREE_STR, strlen(FREE_STR)) == 0) { ++ int alloc_size; ++ char *p = input_str + strlen(FREE_STR); ++ ++ while (*p == ' ') ++ p++; ++ alloc_size = memparse(p, NULL); ++ LOG_INFO("/proc/vc-cma: free %d", alloc_size); ++ if (alloc_size) ++ send_vc_msg(VC_CMA_MSG_REQUEST_ALLOC, ++ alloc_size / VC_CMA_CHUNK_SIZE, 0); ++ else ++ LOG_ERR("invalid size '%s'", p); ++ rc = size; ++ } else if (strncmp(input_str, DEBUG_STR, strlen(DEBUG_STR)) == 0) { ++ char *p = input_str + strlen(DEBUG_STR); ++ while (*p == ' ') ++ p++; ++ if ((strcmp(p, "on") == 0) || (strcmp(p, "1") == 0)) ++ vc_cma_debug = 1; ++ else if ((strcmp(p, "off") == 0) || (strcmp(p, "0") == 0)) ++ vc_cma_debug = 0; ++ LOG_INFO("/proc/vc-cma: debug %s", vc_cma_debug ? "on" : "off"); ++ rc = size; ++ } else if (strncmp(input_str, RESERVE_STR, strlen(RESERVE_STR)) == 0) { ++ int alloc_size; ++ int reserved; ++ char *p = input_str + strlen(RESERVE_STR); ++ while (*p == ' ') ++ p++; ++ alloc_size = memparse(p, NULL); ++ ++ reserved = vc_cma_set_reserve(alloc_size, current->tgid); ++ rc = (reserved >= 0) ? size : reserved; ++ } else if (strncmp(input_str, DMA_ALLOC_STR, strlen(DMA_ALLOC_STR)) == 0) { ++ int alloc_size; ++ char *p = input_str + strlen(DMA_ALLOC_STR); ++ while (*p == ' ') ++ p++; ++ alloc_size = memparse(p, NULL); ++ ++ if (vc_cma_dma_alloc) { ++ dma_release_from_contiguous(NULL, vc_cma_dma_alloc, ++ vc_cma_dma_size); ++ vc_cma_dma_alloc = NULL; ++ vc_cma_dma_size = 0; ++ } ++ vc_cma_dma_alloc = dma_alloc_from_contiguous(NULL, alloc_size, 0); ++ vc_cma_dma_size = (vc_cma_dma_alloc ? alloc_size : 0); ++ if (vc_cma_dma_alloc) ++ LOG_INFO("dma_alloc(%d pages) -> %p", alloc_size, page_address(vc_cma_dma_alloc)); ++ else ++ LOG_ERR("dma_alloc(%d pages) failed", alloc_size); ++ rc = size; ++ } else if (strncmp(input_str, DMA_FREE_STR, strlen(DMA_FREE_STR)) == 0) { ++ if (vc_cma_dma_alloc) { ++ dma_release_from_contiguous(NULL, vc_cma_dma_alloc, ++ vc_cma_dma_size); ++ vc_cma_dma_alloc = NULL; ++ vc_cma_dma_size = 0; ++ } ++ rc = size; ++ } ++ ++out: ++ return rc; ++} ++ ++/**************************************************************************** ++* ++* File Operations for /proc interface. ++* ++***************************************************************************/ ++ ++static const struct file_operations vc_cma_proc_fops = { ++ .open = vc_cma_proc_open, ++ .read = seq_read, ++ .write = vc_cma_proc_write, ++ .llseek = seq_lseek, ++ .release = single_release ++}; ++ ++static int vc_cma_set_reserve(unsigned int reserve, unsigned int pid) ++{ ++ struct vc_cma_reserve_user *user = NULL; ++ int delta = 0; ++ int i; ++ ++ if (down_interruptible(&vc_cma_reserve_mutex)) ++ return -ERESTARTSYS; ++ ++ for (i = 0; i < vc_cma_reserve_count; i++) { ++ if (pid == vc_cma_reserve_users[i].pid) { ++ user = &vc_cma_reserve_users[i]; ++ delta = reserve - user->reserve; ++ if (reserve) ++ user->reserve = reserve; ++ else { ++ /* Remove this entry by copying downwards */ ++ while ((i + 1) < vc_cma_reserve_count) { ++ user[0].pid = user[1].pid; ++ user[0].reserve = user[1].reserve; ++ user++; ++ i++; ++ } ++ vc_cma_reserve_count--; ++ user = NULL; ++ } ++ break; ++ } ++ } ++ ++ if (reserve && !user) { ++ if (vc_cma_reserve_count == VC_CMA_RESERVE_COUNT_MAX) { ++ LOG_ERR("vc-cma: Too many reservations - " ++ "increase CMA_RESERVE_COUNT_MAX"); ++ up(&vc_cma_reserve_mutex); ++ return -EBUSY; ++ } ++ user = &vc_cma_reserve_users[vc_cma_reserve_count]; ++ user->pid = pid; ++ user->reserve = reserve; ++ delta = reserve; ++ vc_cma_reserve_count++; ++ } ++ ++ vc_cma_reserve_total += delta; ++ ++ send_vc_msg(VC_CMA_MSG_RESERVE, ++ vc_cma_reserve_total & 0xffff, vc_cma_reserve_total >> 16); ++ ++ send_worker_msg((VCHIQ_HEADER_T *) VC_CMA_MSG_UPDATE_RESERVE); ++ ++ LOG_DBG("/proc/vc-cma: reserve %d (PID %d) - total %u", ++ reserve, pid, vc_cma_reserve_total); ++ ++ up(&vc_cma_reserve_mutex); ++ ++ return vc_cma_reserve_total; ++} ++ ++static VCHIQ_STATUS_T cma_service_callback(VCHIQ_REASON_T reason, ++ VCHIQ_HEADER_T * header, ++ VCHIQ_SERVICE_HANDLE_T service, ++ void *bulk_userdata) ++{ ++ switch (reason) { ++ case VCHIQ_MESSAGE_AVAILABLE: ++ if (!send_worker_msg(header)) ++ return VCHIQ_RETRY; ++ break; ++ case VCHIQ_SERVICE_CLOSED: ++ LOG_DBG("CMA service closed"); ++ break; ++ default: ++ LOG_ERR("Unexpected CMA callback reason %d", reason); ++ break; ++ } ++ return VCHIQ_SUCCESS; ++} ++ ++static void send_vc_msg(unsigned short type, ++ unsigned short param1, unsigned short param2) ++{ ++ unsigned short msg[] = { type, param1, param2 }; ++ VCHIQ_ELEMENT_T elem = { &msg, sizeof(msg) }; ++ VCHIQ_STATUS_T ret; ++ vchiq_use_service(cma_service); ++ ret = vchiq_queue_message(cma_service, &elem, 1); ++ vchiq_release_service(cma_service); ++ if (ret != VCHIQ_SUCCESS) ++ LOG_ERR("vchiq_queue_message returned %x", ret); ++} ++ ++static bool send_worker_msg(VCHIQ_HEADER_T * msg) ++{ ++ if (down_interruptible(&vc_cma_worker_queue_push_mutex)) ++ return false; ++ vchiu_queue_push(&cma_msg_queue, msg); ++ up(&vc_cma_worker_queue_push_mutex); ++ return true; ++} ++ ++static int vc_cma_alloc_chunks(int num_chunks, struct cma_msg *reply) ++{ ++ int i; ++ for (i = 0; i < num_chunks; i++) { ++ struct page *chunk; ++ unsigned int chunk_num; ++ uint8_t *chunk_addr; ++ size_t chunk_size = PAGES_PER_CHUNK << PAGE_SHIFT; ++ ++ chunk = dma_alloc_from_contiguous(&vc_cma_device.dev, ++ PAGES_PER_CHUNK, ++ VC_CMA_CHUNK_ORDER); ++ if (!chunk) ++ break; ++ ++ chunk_addr = page_address(chunk); ++ dmac_flush_range(chunk_addr, chunk_addr + chunk_size); ++ outer_inv_range(__pa(chunk_addr), __pa(chunk_addr) + ++ chunk_size); ++ ++ chunk_num = ++ (page_to_phys(chunk) - vc_cma_base) / VC_CMA_CHUNK_SIZE; ++ BUG_ON(((page_to_phys(chunk) - vc_cma_base) % ++ VC_CMA_CHUNK_SIZE) != 0); ++ if (chunk_num >= vc_cma_chunks) { ++ phys_addr_t _pa = vc_cma_base + vc_cma_size - 1; ++ LOG_ERR("%s: ===============================", ++ __func__); ++ LOG_ERR("%s: chunk phys %x, vc_cma %pa-%pa - " ++ "bad SPARSEMEM configuration?", ++ __func__, (unsigned int)page_to_phys(chunk), ++ &vc_cma_base, &_pa); ++ LOG_ERR("%s: dev->cma_area = %p", __func__, ++ (void*)0/*vc_cma_device.dev.cma_area*/); ++ LOG_ERR("%s: ===============================", ++ __func__); ++ break; ++ } ++ reply->params[i] = chunk_num; ++ vc_cma_chunks_used++; ++ } ++ ++ if (i < num_chunks) { ++ LOG_ERR("%s: dma_alloc_from_contiguous failed " ++ "for %x bytes (alloc %d of %d, %d free)", ++ __func__, VC_CMA_CHUNK_SIZE, i, ++ num_chunks, vc_cma_chunks - vc_cma_chunks_used); ++ num_chunks = i; ++ } ++ ++ LOG_DBG("CMA allocated %d chunks -> %d used", ++ num_chunks, vc_cma_chunks_used); ++ reply->type = VC_CMA_MSG_ALLOCATED; ++ ++ { ++ VCHIQ_ELEMENT_T elem = { ++ reply, ++ offsetof(struct cma_msg, params[0]) + ++ num_chunks * sizeof(reply->params[0]) ++ }; ++ VCHIQ_STATUS_T ret; ++ vchiq_use_service(cma_service); ++ ret = vchiq_queue_message(cma_service, &elem, 1); ++ vchiq_release_service(cma_service); ++ if (ret != VCHIQ_SUCCESS) ++ LOG_ERR("vchiq_queue_message return " "%x", ret); ++ } ++ ++ return num_chunks; ++} ++ ++static int cma_worker_proc(void *param) ++{ ++ static struct cma_msg reply; ++ (void)param; ++ ++ while (1) { ++ VCHIQ_HEADER_T *msg; ++ static struct cma_msg msg_copy; ++ struct cma_msg *cma_msg = &msg_copy; ++ int type, msg_size; ++ ++ msg = vchiu_queue_pop(&cma_msg_queue); ++ if ((unsigned int)msg >= VC_CMA_MSG_MAX) { ++ msg_size = msg->size; ++ memcpy(&msg_copy, msg->data, msg_size); ++ type = cma_msg->type; ++ vchiq_release_message(cma_service, msg); ++ } else { ++ msg_size = 0; ++ type = (int)msg; ++ if (type == VC_CMA_MSG_QUIT) ++ break; ++ else if (type == VC_CMA_MSG_UPDATE_RESERVE) { ++ msg = NULL; ++ cma_msg = NULL; ++ } else { ++ BUG(); ++ continue; ++ } ++ } ++ ++ switch (type) { ++ case VC_CMA_MSG_ALLOC:{ ++ int num_chunks, free_chunks; ++ num_chunks = cma_msg->params[0]; ++ free_chunks = ++ vc_cma_chunks - vc_cma_chunks_used; ++ LOG_DBG("CMA_MSG_ALLOC(%d chunks)", num_chunks); ++ if (num_chunks > VC_CMA_MAX_PARAMS_PER_MSG) { ++ LOG_ERR ++ ("CMA_MSG_ALLOC - chunk count (%d) " ++ "exceeds VC_CMA_MAX_PARAMS_PER_MSG (%d)", ++ num_chunks, ++ VC_CMA_MAX_PARAMS_PER_MSG); ++ num_chunks = VC_CMA_MAX_PARAMS_PER_MSG; ++ } ++ ++ if (num_chunks > free_chunks) { ++ LOG_ERR ++ ("CMA_MSG_ALLOC - chunk count (%d) " ++ "exceeds free chunks (%d)", ++ num_chunks, free_chunks); ++ num_chunks = free_chunks; ++ } ++ ++ vc_cma_alloc_chunks(num_chunks, &reply); ++ } ++ break; ++ ++ case VC_CMA_MSG_FREE:{ ++ int chunk_count = ++ (msg_size - ++ offsetof(struct cma_msg, ++ params)) / ++ sizeof(cma_msg->params[0]); ++ int i; ++ BUG_ON(chunk_count <= 0); ++ ++ LOG_DBG("CMA_MSG_FREE(%d chunks - %x, ...)", ++ chunk_count, cma_msg->params[0]); ++ for (i = 0; i < chunk_count; i++) { ++ int chunk_num = cma_msg->params[i]; ++ struct page *page = vc_cma_base_page + ++ chunk_num * PAGES_PER_CHUNK; ++ if (chunk_num >= vc_cma_chunks) { ++ LOG_ERR ++ ("CMA_MSG_FREE - chunk %d of %d" ++ " (value %x) exceeds maximum " ++ "(%x)", i, chunk_count, ++ chunk_num, ++ vc_cma_chunks - 1); ++ break; ++ } ++ ++ if (!dma_release_from_contiguous ++ (&vc_cma_device.dev, page, ++ PAGES_PER_CHUNK)) { ++ phys_addr_t _pa = page_to_phys(page); ++ LOG_ERR ++ ("CMA_MSG_FREE - failed to " ++ "release chunk %d (phys %pa, " ++ "page %x)", chunk_num, ++ &_pa, ++ (unsigned int)page); ++ } ++ vc_cma_chunks_used--; ++ } ++ LOG_DBG("CMA released %d chunks -> %d used", ++ i, vc_cma_chunks_used); ++ } ++ break; ++ ++ case VC_CMA_MSG_UPDATE_RESERVE:{ ++ int chunks_needed = ++ ((vc_cma_reserve_total + VC_CMA_CHUNK_SIZE - ++ 1) ++ / VC_CMA_CHUNK_SIZE) - ++ vc_cma_chunks_reserved; ++ ++ LOG_DBG ++ ("CMA_MSG_UPDATE_RESERVE(%d chunks needed)", ++ chunks_needed); ++ ++ /* Cap the reservations to what is available */ ++ if (chunks_needed > 0) { ++ if (chunks_needed > ++ (vc_cma_chunks - ++ vc_cma_chunks_used)) ++ chunks_needed = ++ (vc_cma_chunks - ++ vc_cma_chunks_used); ++ ++ chunks_needed = ++ vc_cma_alloc_chunks(chunks_needed, ++ &reply); ++ } ++ ++ LOG_DBG ++ ("CMA_MSG_UPDATE_RESERVE(%d chunks allocated)", ++ chunks_needed); ++ vc_cma_chunks_reserved += chunks_needed; ++ } ++ break; ++ ++ default: ++ LOG_ERR("unexpected msg type %d", type); ++ break; ++ } ++ } ++ ++ LOG_DBG("quitting..."); ++ return 0; ++} ++ ++/**************************************************************************** ++* ++* vc_cma_connected_init ++* ++* This function is called once the videocore has been connected. ++* ++***************************************************************************/ ++ ++static void vc_cma_connected_init(void) ++{ ++ VCHIQ_SERVICE_PARAMS_T service_params; ++ ++ LOG_DBG("vc_cma_connected_init"); ++ ++ if (!vchiu_queue_init(&cma_msg_queue, 16)) { ++ LOG_ERR("could not create CMA msg queue"); ++ goto fail_queue; ++ } ++ ++ if (vchiq_initialise(&cma_instance) != VCHIQ_SUCCESS) ++ goto fail_vchiq_init; ++ ++ vchiq_connect(cma_instance); ++ ++ service_params.fourcc = VC_CMA_FOURCC; ++ service_params.callback = cma_service_callback; ++ service_params.userdata = NULL; ++ service_params.version = VC_CMA_VERSION; ++ service_params.version_min = VC_CMA_VERSION; ++ ++ if (vchiq_open_service(cma_instance, &service_params, ++ &cma_service) != VCHIQ_SUCCESS) { ++ LOG_ERR("failed to open service - already in use?"); ++ goto fail_vchiq_open; ++ } ++ ++ vchiq_release_service(cma_service); ++ ++ cma_worker = kthread_create(cma_worker_proc, NULL, "cma_worker"); ++ if (!cma_worker) { ++ LOG_ERR("could not create CMA worker thread"); ++ goto fail_worker; ++ } ++ set_user_nice(cma_worker, -20); ++ wake_up_process(cma_worker); ++ ++ return; ++ ++fail_worker: ++ vchiq_close_service(cma_service); ++fail_vchiq_open: ++ vchiq_shutdown(cma_instance); ++fail_vchiq_init: ++ vchiu_queue_delete(&cma_msg_queue); ++fail_queue: ++ return; ++} ++ ++void ++loud_error_header(void) ++{ ++ if (in_loud_error) ++ return; ++ ++ LOG_ERR("============================================================" ++ "================"); ++ LOG_ERR("============================================================" ++ "================"); ++ LOG_ERR("====="); ++ ++ in_loud_error = 1; ++} ++ ++void ++loud_error_footer(void) ++{ ++ if (!in_loud_error) ++ return; ++ ++ LOG_ERR("====="); ++ LOG_ERR("============================================================" ++ "================"); ++ LOG_ERR("============================================================" ++ "================"); ++ ++ in_loud_error = 0; ++} ++ ++#if 1 ++static int check_cma_config(void) { return 1; } ++#else ++static int ++read_vc_debug_var(VC_MEM_ACCESS_HANDLE_T handle, ++ const char *symbol, ++ void *buf, size_t bufsize) ++{ ++ VC_MEM_ADDR_T vcMemAddr; ++ size_t vcMemSize; ++ uint8_t *mapAddr; ++ off_t vcMapAddr; ++ ++ if (!LookupVideoCoreSymbol(handle, symbol, ++ &vcMemAddr, ++ &vcMemSize)) { ++ loud_error_header(); ++ loud_error( ++ "failed to find VC symbol \"%s\".", ++ symbol); ++ loud_error_footer(); ++ return 0; ++ } ++ ++ if (vcMemSize != bufsize) { ++ loud_error_header(); ++ loud_error( ++ "VC symbol \"%s\" is the wrong size.", ++ symbol); ++ loud_error_footer(); ++ return 0; ++ } ++ ++ vcMapAddr = (off_t)vcMemAddr & VC_MEM_TO_ARM_ADDR_MASK; ++ vcMapAddr += mm_vc_mem_phys_addr; ++ mapAddr = ioremap_nocache(vcMapAddr, vcMemSize); ++ if (mapAddr == 0) { ++ loud_error_header(); ++ loud_error( ++ "failed to ioremap \"%s\" @ 0x%x " ++ "(phys: 0x%x, size: %u).", ++ symbol, ++ (unsigned int)vcMapAddr, ++ (unsigned int)vcMemAddr, ++ (unsigned int)vcMemSize); ++ loud_error_footer(); ++ return 0; ++ } ++ ++ memcpy(buf, mapAddr, bufsize); ++ iounmap(mapAddr); ++ ++ return 1; ++} ++ ++ ++static int ++check_cma_config(void) ++{ ++ VC_MEM_ACCESS_HANDLE_T mem_hndl; ++ VC_MEM_ADDR_T mempool_start; ++ VC_MEM_ADDR_T mempool_end; ++ VC_MEM_ADDR_T mempool_offline_start; ++ VC_MEM_ADDR_T mempool_offline_end; ++ VC_MEM_ADDR_T cam_alloc_base; ++ VC_MEM_ADDR_T cam_alloc_size; ++ VC_MEM_ADDR_T cam_alloc_end; ++ int success = 0; ++ ++ if (OpenVideoCoreMemory(&mem_hndl) != 0) ++ goto out; ++ ++ /* Read the relevant VideoCore variables */ ++ if (!read_vc_debug_var(mem_hndl, "__MEMPOOL_START", ++ &mempool_start, ++ sizeof(mempool_start))) ++ goto close; ++ ++ if (!read_vc_debug_var(mem_hndl, "__MEMPOOL_END", ++ &mempool_end, ++ sizeof(mempool_end))) ++ goto close; ++ ++ if (!read_vc_debug_var(mem_hndl, "__MEMPOOL_OFFLINE_START", ++ &mempool_offline_start, ++ sizeof(mempool_offline_start))) ++ goto close; ++ ++ if (!read_vc_debug_var(mem_hndl, "__MEMPOOL_OFFLINE_END", ++ &mempool_offline_end, ++ sizeof(mempool_offline_end))) ++ goto close; ++ ++ if (!read_vc_debug_var(mem_hndl, "cam_alloc_base", ++ &cam_alloc_base, ++ sizeof(cam_alloc_base))) ++ goto close; ++ ++ if (!read_vc_debug_var(mem_hndl, "cam_alloc_size", ++ &cam_alloc_size, ++ sizeof(cam_alloc_size))) ++ goto close; ++ ++ cam_alloc_end = cam_alloc_base + cam_alloc_size; ++ ++ success = 1; ++ ++ /* Now the sanity checks */ ++ if (!mempool_offline_start) ++ mempool_offline_start = mempool_start; ++ if (!mempool_offline_end) ++ mempool_offline_end = mempool_end; ++ ++ if (VCADDR_TO_PHYSADDR(mempool_offline_start) != vc_cma_base) { ++ loud_error_header(); ++ loud_error( ++ "__MEMPOOL_OFFLINE_START(%x -> %lx) doesn't match " ++ "vc_cma_base(%x)", ++ mempool_offline_start, ++ VCADDR_TO_PHYSADDR(mempool_offline_start), ++ vc_cma_base); ++ success = 0; ++ } ++ ++ if (VCADDR_TO_PHYSADDR(mempool_offline_end) != ++ (vc_cma_base + vc_cma_size)) { ++ loud_error_header(); ++ loud_error( ++ "__MEMPOOL_OFFLINE_END(%x -> %lx) doesn't match " ++ "vc_cma_base(%x) + vc_cma_size(%x) = %x", ++ mempool_offline_start, ++ VCADDR_TO_PHYSADDR(mempool_offline_end), ++ vc_cma_base, vc_cma_size, vc_cma_base + vc_cma_size); ++ success = 0; ++ } ++ ++ if (mempool_end < mempool_start) { ++ loud_error_header(); ++ loud_error( ++ "__MEMPOOL_END(%x) must not be before " ++ "__MEMPOOL_START(%x)", ++ mempool_end, ++ mempool_start); ++ success = 0; ++ } ++ ++ if (mempool_offline_end < mempool_offline_start) { ++ loud_error_header(); ++ loud_error( ++ "__MEMPOOL_OFFLINE_END(%x) must not be before " ++ "__MEMPOOL_OFFLINE_START(%x)", ++ mempool_offline_end, ++ mempool_offline_start); ++ success = 0; ++ } ++ ++ if (mempool_offline_start < mempool_start) { ++ loud_error_header(); ++ loud_error( ++ "__MEMPOOL_OFFLINE_START(%x) must not be before " ++ "__MEMPOOL_START(%x)", ++ mempool_offline_start, ++ mempool_start); ++ success = 0; ++ } ++ ++ if (mempool_offline_end > mempool_end) { ++ loud_error_header(); ++ loud_error( ++ "__MEMPOOL_OFFLINE_END(%x) must not be after " ++ "__MEMPOOL_END(%x)", ++ mempool_offline_end, ++ mempool_end); ++ success = 0; ++ } ++ ++ if ((cam_alloc_base < mempool_end) && ++ (cam_alloc_end > mempool_start)) { ++ loud_error_header(); ++ loud_error( ++ "cam_alloc pool(%x-%x) overlaps " ++ "mempool(%x-%x)", ++ cam_alloc_base, cam_alloc_end, ++ mempool_start, mempool_end); ++ success = 0; ++ } ++ ++ loud_error_footer(); ++ ++close: ++ CloseVideoCoreMemory(mem_hndl); ++ ++out: ++ return success; ++} ++#endif ++ ++static int vc_cma_init(void) ++{ ++ int rc = -EFAULT; ++ struct device *dev; ++ ++ if (!check_cma_config()) ++ goto out_release; ++ ++ LOG_INFO("vc-cma: Videocore CMA driver"); ++ LOG_INFO("vc-cma: vc_cma_base = %pa", &vc_cma_base); ++ LOG_INFO("vc-cma: vc_cma_size = 0x%08x (%u MiB)", ++ vc_cma_size, vc_cma_size / (1024 * 1024)); ++ LOG_INFO("vc-cma: vc_cma_initial = 0x%08x (%u MiB)", ++ vc_cma_initial, vc_cma_initial / (1024 * 1024)); ++ ++ vc_cma_base_page = phys_to_page(vc_cma_base); ++ ++ if (vc_cma_chunks) { ++ int chunks_needed = vc_cma_initial / VC_CMA_CHUNK_SIZE; ++ ++ for (vc_cma_chunks_used = 0; ++ vc_cma_chunks_used < chunks_needed; vc_cma_chunks_used++) { ++ struct page *chunk; ++ chunk = dma_alloc_from_contiguous(&vc_cma_device.dev, ++ PAGES_PER_CHUNK, ++ VC_CMA_CHUNK_ORDER); ++ if (!chunk) ++ break; ++ BUG_ON(((page_to_phys(chunk) - vc_cma_base) % ++ VC_CMA_CHUNK_SIZE) != 0); ++ } ++ if (vc_cma_chunks_used != chunks_needed) { ++ LOG_ERR("%s: dma_alloc_from_contiguous failed (%d " ++ "bytes, allocation %d of %d)", ++ __func__, VC_CMA_CHUNK_SIZE, ++ vc_cma_chunks_used, chunks_needed); ++ goto out_release; ++ } ++ ++ vchiq_add_connected_callback(vc_cma_connected_init); ++ } ++ ++ rc = alloc_chrdev_region(&vc_cma_devnum, 0, 1, DRIVER_NAME); ++ if (rc < 0) { ++ LOG_ERR("%s: alloc_chrdev_region failed (rc=%d)", __func__, rc); ++ goto out_release; ++ } ++ ++ cdev_init(&vc_cma_cdev, &vc_cma_fops); ++ rc = cdev_add(&vc_cma_cdev, vc_cma_devnum, 1); ++ if (rc != 0) { ++ LOG_ERR("%s: cdev_add failed (rc=%d)", __func__, rc); ++ goto out_unregister; ++ } ++ ++ vc_cma_class = class_create(THIS_MODULE, DRIVER_NAME); ++ if (IS_ERR(vc_cma_class)) { ++ rc = PTR_ERR(vc_cma_class); ++ LOG_ERR("%s: class_create failed (rc=%d)", __func__, rc); ++ goto out_cdev_del; ++ } ++ ++ dev = device_create(vc_cma_class, NULL, vc_cma_devnum, NULL, ++ DRIVER_NAME); ++ if (IS_ERR(dev)) { ++ rc = PTR_ERR(dev); ++ LOG_ERR("%s: device_create failed (rc=%d)", __func__, rc); ++ goto out_class_destroy; ++ } ++ ++ vc_cma_proc_entry = proc_create(DRIVER_NAME, 0444, NULL, &vc_cma_proc_fops); ++ if (vc_cma_proc_entry == NULL) { ++ rc = -EFAULT; ++ LOG_ERR("%s: proc_create failed", __func__); ++ goto out_device_destroy; ++ } ++ ++ vc_cma_inited = 1; ++ return 0; ++ ++out_device_destroy: ++ device_destroy(vc_cma_class, vc_cma_devnum); ++ ++out_class_destroy: ++ class_destroy(vc_cma_class); ++ vc_cma_class = NULL; ++ ++out_cdev_del: ++ cdev_del(&vc_cma_cdev); ++ ++out_unregister: ++ unregister_chrdev_region(vc_cma_devnum, 1); ++ ++out_release: ++ /* It is tempting to try to clean up by calling ++ dma_release_from_contiguous for all allocated chunks, but it isn't ++ a very safe thing to do. If vc_cma_initial is non-zero it is because ++ VideoCore is already using that memory, so giving it back to Linux ++ is likely to be fatal. ++ */ ++ return -1; ++} ++ ++/**************************************************************************** ++* ++* vc_cma_exit ++* ++***************************************************************************/ ++ ++static void __exit vc_cma_exit(void) ++{ ++ LOG_DBG("%s: called", __func__); ++ ++ if (vc_cma_inited) { ++ remove_proc_entry(DRIVER_NAME, NULL); ++ device_destroy(vc_cma_class, vc_cma_devnum); ++ class_destroy(vc_cma_class); ++ cdev_del(&vc_cma_cdev); ++ unregister_chrdev_region(vc_cma_devnum, 1); ++ } ++} ++ ++module_init(vc_cma_init); ++module_exit(vc_cma_exit); ++MODULE_LICENSE("GPL"); ++MODULE_AUTHOR("Broadcom Corporation"); +diff --git a/include/linux/broadcom/vc_cma.h b/include/linux/broadcom/vc_cma.h +new file mode 100644 +index 0000000..be2819d +--- /dev/null ++++ b/include/linux/broadcom/vc_cma.h +@@ -0,0 +1,36 @@ ++/***************************************************************************** ++* Copyright 2012 Broadcom Corporation. All rights reserved. ++* ++* Unless you and Broadcom execute a separate written software license ++* agreement governing use of this software, this software is licensed to you ++* under the terms of the GNU General Public License version 2, available at ++* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). ++* ++* Notwithstanding the above, under no circumstances may you combine this ++* software in any way with any other Broadcom software provided under a ++* license other than the GPL, without Broadcom's express prior written ++* consent. ++*****************************************************************************/ ++ ++#if !defined( VC_CMA_H ) ++#define VC_CMA_H ++ ++#include <linux/ioctl.h> ++ ++#define VC_CMA_IOC_MAGIC 0xc5 ++ ++#define VC_CMA_IOC_RESERVE _IO(VC_CMA_IOC_MAGIC, 0) ++ ++#ifdef __KERNEL__ ++ ++#ifdef CONFIG_BCM_VC_CMA ++void vc_cma_early_init(void); ++void vc_cma_reserve(void); ++#else ++static inline void vc_cma_early_init(void) { } ++static inline void vc_cma_reserve(void) { } ++#endif ++ ++#endif ++ ++#endif /* VC_CMA_H */ + +From b66d625fcacb21a8529ef74eeb6c33e550d841e6 Mon Sep 17 00:00:00 2001 +From: popcornmix <popcornmix@gmail.com> +Date: Mon, 26 Mar 2012 22:15:50 +0100 +Subject: [PATCH 040/112] bcm2708: alsa sound driver +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: popcornmix <popcornmix@gmail.com> + +alsa: add mmap support and some cleanups to bcm2835 ALSA driver + +snd-bcm2835: Add support for spdif/hdmi passthrough + +This adds a dedicated subdevice which can be used for passthrough of non-audio +formats (ie encoded a52) through the hdmi audio link. In addition to this +driver extension an appropriate card config is required to make alsa-lib +support the AES parameters for this device. + +snd-bcm2708: Add mutex, improve logging + +Fix for ALSA driver crash + +Avoids an issue when closing and opening vchiq where a message can arrive before service handle has been written + +alsa: reduce severity of expected warning message + +snd-bcm2708: Fix dmesg spam for non-error case + +alsa: Ensure mutexes are released through error paths + +alsa: Make interrupted close paths quieter + +BCM270x: Add onboard sound device to Device Tree + +Add Device Tree support to alsa driver. +Add device to Device Tree. +Don't add platform devices when booting in DT mode. + +Signed-off-by: Noralf Trønnes <noralf@tronnes.org> + +bcm2835: access controls under the audio mutex + +I don't think the ALSA framework provides any kind of automatic +synchronization within the control callbacks. We most likely need +to ensure this manually, so add locking around all access to shared +mutable data. In particular, bcm2835_audio_set_ctls() should +probably always be called under our own audio lock. +--- + sound/arm/Kconfig | 8 + + sound/arm/Makefile | 5 + + sound/arm/bcm2835-ctl.c | 350 ++++++++++++++ + sound/arm/bcm2835-pcm.c | 561 +++++++++++++++++++++++ + sound/arm/bcm2835-vchiq.c | 902 +++++++++++++++++++++++++++++++++++++ + sound/arm/bcm2835.c | 511 +++++++++++++++++++++ + sound/arm/bcm2835.h | 167 +++++++ + sound/arm/vc_vchi_audioserv_defs.h | 116 +++++ + 8 files changed, 2620 insertions(+) + create mode 100755 sound/arm/bcm2835-ctl.c + create mode 100755 sound/arm/bcm2835-pcm.c + create mode 100755 sound/arm/bcm2835-vchiq.c + create mode 100644 sound/arm/bcm2835.c + create mode 100755 sound/arm/bcm2835.h + create mode 100644 sound/arm/vc_vchi_audioserv_defs.h + +diff --git a/sound/arm/Kconfig b/sound/arm/Kconfig +index e040621..7746e5d2 100644 +--- a/sound/arm/Kconfig ++++ b/sound/arm/Kconfig +@@ -40,5 +40,13 @@ config SND_PXA2XX_AC97 + Say Y or M if you want to support any AC97 codec attached to + the PXA2xx AC97 interface. + ++config SND_BCM2835 ++ tristate "BCM2835 ALSA driver" ++ depends on (ARCH_BCM2708 || ARCH_BCM2709 || ARCH_BCM2835) \ ++ && BCM2708_VCHIQ && SND ++ select SND_PCM ++ help ++ Say Y or M if you want to support BCM2835 Alsa pcm card driver ++ + endif # SND_ARM + +diff --git a/sound/arm/Makefile b/sound/arm/Makefile +index 8c0c851..6796d7f 100644 +--- a/sound/arm/Makefile ++++ b/sound/arm/Makefile +@@ -14,3 +14,8 @@ snd-pxa2xx-lib-$(CONFIG_SND_PXA2XX_LIB_AC97) += pxa2xx-ac97-lib.o + + obj-$(CONFIG_SND_PXA2XX_AC97) += snd-pxa2xx-ac97.o + snd-pxa2xx-ac97-objs := pxa2xx-ac97.o ++ ++obj-$(CONFIG_SND_BCM2835) += snd-bcm2835.o ++snd-bcm2835-objs := bcm2835.o bcm2835-ctl.o bcm2835-pcm.o bcm2835-vchiq.o ++ ++ccflags-y += -Idrivers/misc/vc04_services -Idrivers/misc/vc04_services/interface/vcos/linuxkernel -D__VCCOREVER__=0x04000000 +diff --git a/sound/arm/bcm2835-ctl.c b/sound/arm/bcm2835-ctl.c +new file mode 100755 +index 0000000..75dc322 +--- /dev/null ++++ b/sound/arm/bcm2835-ctl.c +@@ -0,0 +1,350 @@ ++/***************************************************************************** ++* Copyright 2011 Broadcom Corporation. All rights reserved. ++* ++* Unless you and Broadcom execute a separate written software license ++* agreement governing use of this software, this software is licensed to you ++* under the terms of the GNU General Public License version 2, available at ++* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). ++* ++* Notwithstanding the above, under no circumstances may you combine this ++* software in any way with any other Broadcom software provided under a ++* license other than the GPL, without Broadcom's express prior written ++* consent. ++*****************************************************************************/ ++ ++#include <linux/platform_device.h> ++#include <linux/init.h> ++#include <linux/io.h> ++#include <linux/jiffies.h> ++#include <linux/slab.h> ++#include <linux/time.h> ++#include <linux/wait.h> ++#include <linux/delay.h> ++#include <linux/moduleparam.h> ++#include <linux/sched.h> ++ ++#include <sound/core.h> ++#include <sound/control.h> ++#include <sound/pcm.h> ++#include <sound/pcm_params.h> ++#include <sound/rawmidi.h> ++#include <sound/initval.h> ++#include <sound/tlv.h> ++#include <sound/asoundef.h> ++ ++#include "bcm2835.h" ++ ++/* volume maximum and minimum in terms of 0.01dB */ ++#define CTRL_VOL_MAX 400 ++#define CTRL_VOL_MIN -10239 /* originally -10240 */ ++ ++ ++static int snd_bcm2835_ctl_info(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_info *uinfo) ++{ ++ audio_info(" ... IN\n"); ++ if (kcontrol->private_value == PCM_PLAYBACK_VOLUME) { ++ uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; ++ uinfo->count = 1; ++ uinfo->value.integer.min = CTRL_VOL_MIN; ++ uinfo->value.integer.max = CTRL_VOL_MAX; /* 2303 */ ++ } else if (kcontrol->private_value == PCM_PLAYBACK_MUTE) { ++ uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; ++ uinfo->count = 1; ++ uinfo->value.integer.min = 0; ++ uinfo->value.integer.max = 1; ++ } else if (kcontrol->private_value == PCM_PLAYBACK_DEVICE) { ++ uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; ++ uinfo->count = 1; ++ uinfo->value.integer.min = 0; ++ uinfo->value.integer.max = AUDIO_DEST_MAX-1; ++ } ++ audio_info(" ... OUT\n"); ++ return 0; ++} ++ ++/* toggles mute on or off depending on the value of nmute, and returns ++ * 1 if the mute value was changed, otherwise 0 ++ */ ++static int toggle_mute(struct bcm2835_chip *chip, int nmute) ++{ ++ /* if settings are ok, just return 0 */ ++ if(chip->mute == nmute) ++ return 0; ++ ++ /* if the sound is muted then we need to unmute */ ++ if(chip->mute == CTRL_VOL_MUTE) ++ { ++ chip->volume = chip->old_volume; /* copy the old volume back */ ++ audio_info("Unmuting, old_volume = %d, volume = %d ...\n", chip->old_volume, chip->volume); ++ } ++ else /* otherwise we mute */ ++ { ++ chip->old_volume = chip->volume; ++ chip->volume = 26214; /* set volume to minimum level AKA mute */ ++ audio_info("Muting, old_volume = %d, volume = %d ...\n", chip->old_volume, chip->volume); ++ } ++ ++ chip->mute = nmute; ++ return 1; ++} ++ ++static int snd_bcm2835_ctl_get(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol) ++{ ++ struct bcm2835_chip *chip = snd_kcontrol_chip(kcontrol); ++ ++ if (mutex_lock_interruptible(&chip->audio_mutex)) ++ return -EINTR; ++ ++ BUG_ON(!chip && !(chip->avail_substreams & AVAIL_SUBSTREAMS_MASK)); ++ ++ if (kcontrol->private_value == PCM_PLAYBACK_VOLUME) ++ ucontrol->value.integer.value[0] = chip2alsa(chip->volume); ++ else if (kcontrol->private_value == PCM_PLAYBACK_MUTE) ++ ucontrol->value.integer.value[0] = chip->mute; ++ else if (kcontrol->private_value == PCM_PLAYBACK_DEVICE) ++ ucontrol->value.integer.value[0] = chip->dest; ++ ++ mutex_unlock(&chip->audio_mutex); ++ return 0; ++} ++ ++static int snd_bcm2835_ctl_put(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol) ++{ ++ struct bcm2835_chip *chip = snd_kcontrol_chip(kcontrol); ++ int changed = 0; ++ ++ if (mutex_lock_interruptible(&chip->audio_mutex)) ++ return -EINTR; ++ ++ if (kcontrol->private_value == PCM_PLAYBACK_VOLUME) { ++ audio_info("Volume change attempted.. volume = %d new_volume = %d\n", chip->volume, (int)ucontrol->value.integer.value[0]); ++ if (chip->mute == CTRL_VOL_MUTE) { ++ /* changed = toggle_mute(chip, CTRL_VOL_UNMUTE); */ ++ changed = 1; /* should return 0 to signify no change but the mixer takes this as the opposite sign (no idea why) */ ++ goto unlock; ++ } ++ if (changed ++ || (ucontrol->value.integer.value[0] != chip2alsa(chip->volume))) { ++ ++ chip->volume = alsa2chip(ucontrol->value.integer.value[0]); ++ changed = 1; ++ } ++ ++ } else if (kcontrol->private_value == PCM_PLAYBACK_MUTE) { ++ /* Now implemented */ ++ audio_info(" Mute attempted\n"); ++ changed = toggle_mute(chip, ucontrol->value.integer.value[0]); ++ ++ } else if (kcontrol->private_value == PCM_PLAYBACK_DEVICE) { ++ if (ucontrol->value.integer.value[0] != chip->dest) { ++ chip->dest = ucontrol->value.integer.value[0]; ++ changed = 1; ++ } ++ } ++ ++ if (changed) { ++ if (bcm2835_audio_set_ctls(chip)) ++ printk(KERN_ERR "Failed to set ALSA controls..\n"); ++ } ++ ++unlock: ++ mutex_unlock(&chip->audio_mutex); ++ return changed; ++} ++ ++static DECLARE_TLV_DB_SCALE(snd_bcm2835_db_scale, CTRL_VOL_MIN, 1, 1); ++ ++static struct snd_kcontrol_new snd_bcm2835_ctl[] = { ++ { ++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, ++ .name = "PCM Playback Volume", ++ .index = 0, ++ .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_TLV_READ, ++ .private_value = PCM_PLAYBACK_VOLUME, ++ .info = snd_bcm2835_ctl_info, ++ .get = snd_bcm2835_ctl_get, ++ .put = snd_bcm2835_ctl_put, ++ .count = 1, ++ .tlv = {.p = snd_bcm2835_db_scale} ++ }, ++ { ++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, ++ .name = "PCM Playback Switch", ++ .index = 0, ++ .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, ++ .private_value = PCM_PLAYBACK_MUTE, ++ .info = snd_bcm2835_ctl_info, ++ .get = snd_bcm2835_ctl_get, ++ .put = snd_bcm2835_ctl_put, ++ .count = 1, ++ }, ++ { ++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, ++ .name = "PCM Playback Route", ++ .index = 0, ++ .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, ++ .private_value = PCM_PLAYBACK_DEVICE, ++ .info = snd_bcm2835_ctl_info, ++ .get = snd_bcm2835_ctl_get, ++ .put = snd_bcm2835_ctl_put, ++ .count = 1, ++ }, ++}; ++ ++static int snd_bcm2835_spdif_default_info(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_info *uinfo) ++{ ++ uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958; ++ uinfo->count = 1; ++ return 0; ++} ++ ++static int snd_bcm2835_spdif_default_get(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol) ++{ ++ struct bcm2835_chip *chip = snd_kcontrol_chip(kcontrol); ++ int i; ++ ++ if (mutex_lock_interruptible(&chip->audio_mutex)) ++ return -EINTR; ++ ++ for (i = 0; i < 4; i++) ++ ucontrol->value.iec958.status[i] = ++ (chip->spdif_status >> (i * 8)) && 0xff; ++ ++ mutex_unlock(&chip->audio_mutex); ++ return 0; ++} ++ ++static int snd_bcm2835_spdif_default_put(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol) ++{ ++ struct bcm2835_chip *chip = snd_kcontrol_chip(kcontrol); ++ unsigned int val = 0; ++ int i, change; ++ ++ if (mutex_lock_interruptible(&chip->audio_mutex)) ++ return -EINTR; ++ ++ for (i = 0; i < 4; i++) ++ val |= (unsigned int)ucontrol->value.iec958.status[i] << (i * 8); ++ ++ change = val != chip->spdif_status; ++ chip->spdif_status = val; ++ ++ mutex_unlock(&chip->audio_mutex); ++ return change; ++} ++ ++static int snd_bcm2835_spdif_mask_info(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_info *uinfo) ++{ ++ uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958; ++ uinfo->count = 1; ++ return 0; ++} ++ ++static int snd_bcm2835_spdif_mask_get(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol) ++{ ++ /* bcm2835 supports only consumer mode and sets all other format flags ++ * automatically. So the only thing left is signalling non-audio ++ * content */ ++ ucontrol->value.iec958.status[0] = IEC958_AES0_NONAUDIO; ++ return 0; ++} ++ ++static int snd_bcm2835_spdif_stream_info(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_info *uinfo) ++{ ++ uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958; ++ uinfo->count = 1; ++ return 0; ++} ++ ++static int snd_bcm2835_spdif_stream_get(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol) ++{ ++ struct bcm2835_chip *chip = snd_kcontrol_chip(kcontrol); ++ int i; ++ ++ if (mutex_lock_interruptible(&chip->audio_mutex)) ++ return -EINTR; ++ ++ for (i = 0; i < 4; i++) ++ ucontrol->value.iec958.status[i] = ++ (chip->spdif_status >> (i * 8)) & 0xff; ++ ++ mutex_unlock(&chip->audio_mutex); ++ return 0; ++} ++ ++static int snd_bcm2835_spdif_stream_put(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol) ++{ ++ struct bcm2835_chip *chip = snd_kcontrol_chip(kcontrol); ++ unsigned int val = 0; ++ int i, change; ++ ++ if (mutex_lock_interruptible(&chip->audio_mutex)) ++ return -EINTR; ++ ++ for (i = 0; i < 4; i++) ++ val |= (unsigned int)ucontrol->value.iec958.status[i] << (i * 8); ++ change = val != chip->spdif_status; ++ chip->spdif_status = val; ++ ++ mutex_unlock(&chip->audio_mutex); ++ return change; ++} ++ ++static struct snd_kcontrol_new snd_bcm2835_spdif[] = { ++ { ++ .iface = SNDRV_CTL_ELEM_IFACE_PCM, ++ .name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, DEFAULT), ++ .info = snd_bcm2835_spdif_default_info, ++ .get = snd_bcm2835_spdif_default_get, ++ .put = snd_bcm2835_spdif_default_put ++ }, ++ { ++ .access = SNDRV_CTL_ELEM_ACCESS_READ, ++ .iface = SNDRV_CTL_ELEM_IFACE_PCM, ++ .name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, CON_MASK), ++ .info = snd_bcm2835_spdif_mask_info, ++ .get = snd_bcm2835_spdif_mask_get, ++ }, ++ { ++ .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | ++ SNDRV_CTL_ELEM_ACCESS_INACTIVE, ++ .iface = SNDRV_CTL_ELEM_IFACE_PCM, ++ .name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, PCM_STREAM), ++ .info = snd_bcm2835_spdif_stream_info, ++ .get = snd_bcm2835_spdif_stream_get, ++ .put = snd_bcm2835_spdif_stream_put, ++ }, ++}; ++ ++int snd_bcm2835_new_ctl(bcm2835_chip_t * chip) ++{ ++ int err; ++ unsigned int idx; ++ ++ strcpy(chip->card->mixername, "Broadcom Mixer"); ++ for (idx = 0; idx < ARRAY_SIZE(snd_bcm2835_ctl); idx++) { ++ err = ++ snd_ctl_add(chip->card, ++ snd_ctl_new1(&snd_bcm2835_ctl[idx], chip)); ++ if (err < 0) ++ return err; ++ } ++ for (idx = 0; idx < ARRAY_SIZE(snd_bcm2835_spdif); idx++) { ++ err = snd_ctl_add(chip->card, ++ snd_ctl_new1(&snd_bcm2835_spdif[idx], chip)); ++ if (err < 0) ++ return err; ++ } ++ return 0; ++} +diff --git a/sound/arm/bcm2835-pcm.c b/sound/arm/bcm2835-pcm.c +new file mode 100755 +index 0000000..d2de13c +--- /dev/null ++++ b/sound/arm/bcm2835-pcm.c +@@ -0,0 +1,561 @@ ++/***************************************************************************** ++* Copyright 2011 Broadcom Corporation. All rights reserved. ++* ++* Unless you and Broadcom execute a separate written software license ++* agreement governing use of this software, this software is licensed to you ++* under the terms of the GNU General Public License version 2, available at ++* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). ++* ++* Notwithstanding the above, under no circumstances may you combine this ++* software in any way with any other Broadcom software provided under a ++* license other than the GPL, without Broadcom's express prior written ++* consent. ++*****************************************************************************/ ++ ++#include <linux/interrupt.h> ++#include <linux/slab.h> ++ ++#include <sound/asoundef.h> ++ ++#include "bcm2835.h" ++ ++/* hardware definition */ ++static struct snd_pcm_hardware snd_bcm2835_playback_hw = { ++ .info = (SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | ++ SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID), ++ .formats = SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE, ++ .rates = SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_8000_48000, ++ .rate_min = 8000, ++ .rate_max = 48000, ++ .channels_min = 1, ++ .channels_max = 2, ++ .buffer_bytes_max = 128 * 1024, ++ .period_bytes_min = 1 * 1024, ++ .period_bytes_max = 128 * 1024, ++ .periods_min = 1, ++ .periods_max = 128, ++}; ++ ++static struct snd_pcm_hardware snd_bcm2835_playback_spdif_hw = { ++ .info = (SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | ++ SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID), ++ .formats = SNDRV_PCM_FMTBIT_S16_LE, ++ .rates = SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_44100 | ++ SNDRV_PCM_RATE_48000, ++ .rate_min = 44100, ++ .rate_max = 48000, ++ .channels_min = 2, ++ .channels_max = 2, ++ .buffer_bytes_max = 128 * 1024, ++ .period_bytes_min = 1 * 1024, ++ .period_bytes_max = 128 * 1024, ++ .periods_min = 1, ++ .periods_max = 128, ++}; ++ ++static void snd_bcm2835_playback_free(struct snd_pcm_runtime *runtime) ++{ ++ audio_info("Freeing up alsa stream here ..\n"); ++ if (runtime->private_data) ++ kfree(runtime->private_data); ++ runtime->private_data = NULL; ++} ++ ++static irqreturn_t bcm2835_playback_fifo_irq(int irq, void *dev_id) ++{ ++ bcm2835_alsa_stream_t *alsa_stream = (bcm2835_alsa_stream_t *) dev_id; ++ uint32_t consumed = 0; ++ int new_period = 0; ++ ++ audio_info(" .. IN\n"); ++ ++ audio_info("alsa_stream=%p substream=%p\n", alsa_stream, ++ alsa_stream ? alsa_stream->substream : 0); ++ ++ if (alsa_stream->open) ++ consumed = bcm2835_audio_retrieve_buffers(alsa_stream); ++ ++ /* We get called only if playback was triggered, So, the number of buffers we retrieve in ++ * each iteration are the buffers that have been played out already ++ */ ++ ++ if (alsa_stream->period_size) { ++ if ((alsa_stream->pos / alsa_stream->period_size) != ++ ((alsa_stream->pos + consumed) / alsa_stream->period_size)) ++ new_period = 1; ++ } ++ audio_debug("updating pos cur: %d + %d max:%d period_bytes:%d, hw_ptr: %d new_period:%d\n", ++ alsa_stream->pos, ++ consumed, ++ alsa_stream->buffer_size, ++ (int)(alsa_stream->period_size*alsa_stream->substream->runtime->periods), ++ frames_to_bytes(alsa_stream->substream->runtime, alsa_stream->substream->runtime->status->hw_ptr), ++ new_period); ++ if (alsa_stream->buffer_size) { ++ alsa_stream->pos += consumed &~ (1<<30); ++ alsa_stream->pos %= alsa_stream->buffer_size; ++ } ++ ++ if (alsa_stream->substream) { ++ if (new_period) ++ snd_pcm_period_elapsed(alsa_stream->substream); ++ } else { ++ audio_warning(" unexpected NULL substream\n"); ++ } ++ audio_info(" .. OUT\n"); ++ ++ return IRQ_HANDLED; ++} ++ ++/* open callback */ ++static int snd_bcm2835_playback_open_generic( ++ struct snd_pcm_substream *substream, int spdif) ++{ ++ bcm2835_chip_t *chip = snd_pcm_substream_chip(substream); ++ struct snd_pcm_runtime *runtime = substream->runtime; ++ bcm2835_alsa_stream_t *alsa_stream; ++ int idx; ++ int err; ++ ++ audio_info(" .. IN (%d)\n", substream->number); ++ ++ if(mutex_lock_interruptible(&chip->audio_mutex)) ++ { ++ audio_error("Interrupted whilst waiting for lock\n"); ++ return -EINTR; ++ } ++ audio_info("Alsa open (%d)\n", substream->number); ++ idx = substream->number; ++ ++ if (spdif && chip->opened != 0) { ++ err = -EBUSY; ++ goto out; ++ } ++ else if (!spdif && (chip->opened & (1 << idx))) { ++ err = -EBUSY; ++ goto out; ++ } ++ if (idx > MAX_SUBSTREAMS) { ++ audio_error ++ ("substream(%d) device doesn't exist max(%d) substreams allowed\n", ++ idx, MAX_SUBSTREAMS); ++ err = -ENODEV; ++ goto out; ++ } ++ ++ /* Check if we are ready */ ++ if (!(chip->avail_substreams & (1 << idx))) { ++ /* We are not ready yet */ ++ audio_error("substream(%d) device is not ready yet\n", idx); ++ err = -EAGAIN; ++ goto out; ++ } ++ ++ alsa_stream = kzalloc(sizeof(bcm2835_alsa_stream_t), GFP_KERNEL); ++ if (alsa_stream == NULL) { ++ err = -ENOMEM; ++ goto out; ++ } ++ ++ /* Initialise alsa_stream */ ++ alsa_stream->chip = chip; ++ alsa_stream->substream = substream; ++ alsa_stream->idx = idx; ++ ++ sema_init(&alsa_stream->buffers_update_sem, 0); ++ sema_init(&alsa_stream->control_sem, 0); ++ spin_lock_init(&alsa_stream->lock); ++ ++ /* Enabled in start trigger, called on each "fifo irq" after that */ ++ alsa_stream->enable_fifo_irq = 0; ++ alsa_stream->fifo_irq_handler = bcm2835_playback_fifo_irq; ++ ++ err = bcm2835_audio_open(alsa_stream); ++ if (err != 0) { ++ kfree(alsa_stream); ++ goto out; ++ } ++ runtime->private_data = alsa_stream; ++ runtime->private_free = snd_bcm2835_playback_free; ++ if (spdif) { ++ runtime->hw = snd_bcm2835_playback_spdif_hw; ++ } else { ++ /* clear spdif status, as we are not in spdif mode */ ++ chip->spdif_status = 0; ++ runtime->hw = snd_bcm2835_playback_hw; ++ } ++ /* minimum 16 bytes alignment (for vchiq bulk transfers) */ ++ snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, ++ 16); ++ ++ chip->alsa_stream[idx] = alsa_stream; ++ ++ chip->opened |= (1 << idx); ++ alsa_stream->open = 1; ++ alsa_stream->draining = 1; ++ ++out: ++ mutex_unlock(&chip->audio_mutex); ++ ++ audio_info(" .. OUT =%d\n", err); ++ ++ return err; ++} ++ ++static int snd_bcm2835_playback_open(struct snd_pcm_substream *substream) ++{ ++ return snd_bcm2835_playback_open_generic(substream, 0); ++} ++ ++static int snd_bcm2835_playback_spdif_open(struct snd_pcm_substream *substream) ++{ ++ return snd_bcm2835_playback_open_generic(substream, 1); ++} ++ ++/* close callback */ ++static int snd_bcm2835_playback_close(struct snd_pcm_substream *substream) ++{ ++ /* the hardware-specific codes will be here */ ++ ++ bcm2835_chip_t *chip; ++ struct snd_pcm_runtime *runtime; ++ bcm2835_alsa_stream_t *alsa_stream; ++ ++ audio_info(" .. IN\n"); ++ ++ chip = snd_pcm_substream_chip(substream); ++ if(mutex_lock_interruptible(&chip->audio_mutex)) ++ { ++ audio_error("Interrupted whilst waiting for lock\n"); ++ return -EINTR; ++ } ++ runtime = substream->runtime; ++ alsa_stream = runtime->private_data; ++ ++ audio_info("Alsa close\n"); ++ ++ /* ++ * Call stop if it's still running. This happens when app ++ * is force killed and we don't get a stop trigger. ++ */ ++ if (alsa_stream->running) { ++ int err; ++ err = bcm2835_audio_stop(alsa_stream); ++ alsa_stream->running = 0; ++ if (err != 0) ++ audio_error(" Failed to STOP alsa device\n"); ++ } ++ ++ alsa_stream->period_size = 0; ++ alsa_stream->buffer_size = 0; ++ ++ if (alsa_stream->open) { ++ alsa_stream->open = 0; ++ bcm2835_audio_close(alsa_stream); ++ } ++ if (alsa_stream->chip) ++ alsa_stream->chip->alsa_stream[alsa_stream->idx] = NULL; ++ /* ++ * Do not free up alsa_stream here, it will be freed up by ++ * runtime->private_free callback we registered in *_open above ++ */ ++ ++ chip->opened &= ~(1 << substream->number); ++ ++ mutex_unlock(&chip->audio_mutex); ++ audio_info(" .. OUT\n"); ++ ++ return 0; ++} ++ ++/* hw_params callback */ ++static int snd_bcm2835_pcm_hw_params(struct snd_pcm_substream *substream, ++ struct snd_pcm_hw_params *params) ++{ ++ struct snd_pcm_runtime *runtime = substream->runtime; ++ bcm2835_alsa_stream_t *alsa_stream = runtime->private_data; ++ int err; ++ ++ audio_info(" .. IN\n"); ++ ++ err = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(params)); ++ if (err < 0) { ++ audio_error ++ (" pcm_lib_malloc failed to allocated pages for buffers\n"); ++ return err; ++ } ++ ++ alsa_stream->channels = params_channels(params); ++ alsa_stream->params_rate = params_rate(params); ++ alsa_stream->pcm_format_width = snd_pcm_format_width(params_format (params)); ++ audio_info(" .. OUT\n"); ++ ++ return err; ++} ++ ++/* hw_free callback */ ++static int snd_bcm2835_pcm_hw_free(struct snd_pcm_substream *substream) ++{ ++ audio_info(" .. IN\n"); ++ return snd_pcm_lib_free_pages(substream); ++} ++ ++/* prepare callback */ ++static int snd_bcm2835_pcm_prepare(struct snd_pcm_substream *substream) ++{ ++ bcm2835_chip_t *chip = snd_pcm_substream_chip(substream); ++ struct snd_pcm_runtime *runtime = substream->runtime; ++ bcm2835_alsa_stream_t *alsa_stream = runtime->private_data; ++ int channels; ++ int err; ++ ++ audio_info(" .. IN\n"); ++ ++ if (mutex_lock_interruptible(&chip->audio_mutex)) ++ return -EINTR; ++ ++ /* notify the vchiq that it should enter spdif passthrough mode by ++ * setting channels=0 (see ++ * https://github.com/raspberrypi/linux/issues/528) */ ++ if (chip->spdif_status & IEC958_AES0_NONAUDIO) ++ channels = 0; ++ else ++ channels = alsa_stream->channels; ++ ++ err = bcm2835_audio_set_params(alsa_stream, channels, ++ alsa_stream->params_rate, ++ alsa_stream->pcm_format_width); ++ if (err < 0) { ++ audio_error(" error setting hw params\n"); ++ } ++ ++ bcm2835_audio_setup(alsa_stream); ++ ++ /* in preparation of the stream, set the controls (volume level) of the stream */ ++ bcm2835_audio_set_ctls(alsa_stream->chip); ++ ++ ++ memset(&alsa_stream->pcm_indirect, 0, sizeof(alsa_stream->pcm_indirect)); ++ ++ alsa_stream->pcm_indirect.hw_buffer_size = ++ alsa_stream->pcm_indirect.sw_buffer_size = ++ snd_pcm_lib_buffer_bytes(substream); ++ ++ alsa_stream->buffer_size = snd_pcm_lib_buffer_bytes(substream); ++ alsa_stream->period_size = snd_pcm_lib_period_bytes(substream); ++ alsa_stream->pos = 0; ++ ++ audio_debug("buffer_size=%d, period_size=%d pos=%d frame_bits=%d\n", ++ alsa_stream->buffer_size, alsa_stream->period_size, ++ alsa_stream->pos, runtime->frame_bits); ++ ++ mutex_unlock(&chip->audio_mutex); ++ audio_info(" .. OUT\n"); ++ return 0; ++} ++ ++static void snd_bcm2835_pcm_transfer(struct snd_pcm_substream *substream, ++ struct snd_pcm_indirect *rec, size_t bytes) ++{ ++ struct snd_pcm_runtime *runtime = substream->runtime; ++ bcm2835_alsa_stream_t *alsa_stream = runtime->private_data; ++ void *src = (void *)(substream->runtime->dma_area + rec->sw_data); ++ int err; ++ ++ err = bcm2835_audio_write(alsa_stream, bytes, src); ++ if (err) ++ audio_error(" Failed to transfer to alsa device (%d)\n", err); ++ ++} ++ ++static int snd_bcm2835_pcm_ack(struct snd_pcm_substream *substream) ++{ ++ struct snd_pcm_runtime *runtime = substream->runtime; ++ bcm2835_alsa_stream_t *alsa_stream = runtime->private_data; ++ struct snd_pcm_indirect *pcm_indirect = &alsa_stream->pcm_indirect; ++ ++ pcm_indirect->hw_queue_size = runtime->hw.buffer_bytes_max; ++ snd_pcm_indirect_playback_transfer(substream, pcm_indirect, ++ snd_bcm2835_pcm_transfer); ++ return 0; ++} ++ ++/* trigger callback */ ++static int snd_bcm2835_pcm_trigger(struct snd_pcm_substream *substream, int cmd) ++{ ++ struct snd_pcm_runtime *runtime = substream->runtime; ++ bcm2835_alsa_stream_t *alsa_stream = runtime->private_data; ++ int err = 0; ++ ++ audio_info(" .. IN\n"); ++ ++ switch (cmd) { ++ case SNDRV_PCM_TRIGGER_START: ++ audio_debug("bcm2835_AUDIO_TRIGGER_START running=%d\n", ++ alsa_stream->running); ++ if (!alsa_stream->running) { ++ err = bcm2835_audio_start(alsa_stream); ++ if (err == 0) { ++ alsa_stream->pcm_indirect.hw_io = ++ alsa_stream->pcm_indirect.hw_data = ++ bytes_to_frames(runtime, ++ alsa_stream->pos); ++ substream->ops->ack(substream); ++ alsa_stream->running = 1; ++ alsa_stream->draining = 1; ++ } else { ++ audio_error(" Failed to START alsa device (%d)\n", err); ++ } ++ } ++ break; ++ case SNDRV_PCM_TRIGGER_STOP: ++ audio_debug ++ ("bcm2835_AUDIO_TRIGGER_STOP running=%d draining=%d\n", ++ alsa_stream->running, runtime->status->state == SNDRV_PCM_STATE_DRAINING); ++ if (runtime->status->state == SNDRV_PCM_STATE_DRAINING) { ++ audio_info("DRAINING\n"); ++ alsa_stream->draining = 1; ++ } else { ++ audio_info("DROPPING\n"); ++ alsa_stream->draining = 0; ++ } ++ if (alsa_stream->running) { ++ err = bcm2835_audio_stop(alsa_stream); ++ if (err != 0) ++ audio_error(" Failed to STOP alsa device (%d)\n", err); ++ alsa_stream->running = 0; ++ } ++ break; ++ default: ++ err = -EINVAL; ++ } ++ ++ audio_info(" .. OUT\n"); ++ return err; ++} ++ ++/* pointer callback */ ++static snd_pcm_uframes_t ++snd_bcm2835_pcm_pointer(struct snd_pcm_substream *substream) ++{ ++ struct snd_pcm_runtime *runtime = substream->runtime; ++ bcm2835_alsa_stream_t *alsa_stream = runtime->private_data; ++ ++ audio_info(" .. IN\n"); ++ ++ audio_debug("pcm_pointer... (%d) hwptr=%d appl=%d pos=%d\n", 0, ++ frames_to_bytes(runtime, runtime->status->hw_ptr), ++ frames_to_bytes(runtime, runtime->control->appl_ptr), ++ alsa_stream->pos); ++ ++ audio_info(" .. OUT\n"); ++ return snd_pcm_indirect_playback_pointer(substream, ++ &alsa_stream->pcm_indirect, ++ alsa_stream->pos); ++} ++ ++static int snd_bcm2835_pcm_lib_ioctl(struct snd_pcm_substream *substream, ++ unsigned int cmd, void *arg) ++{ ++ int ret = snd_pcm_lib_ioctl(substream, cmd, arg); ++ audio_info(" .. substream=%p, cmd=%d, arg=%p (%x) ret=%d\n", substream, ++ cmd, arg, arg ? *(unsigned *)arg : 0, ret); ++ return ret; ++} ++ ++/* operators */ ++static struct snd_pcm_ops snd_bcm2835_playback_ops = { ++ .open = snd_bcm2835_playback_open, ++ .close = snd_bcm2835_playback_close, ++ .ioctl = snd_bcm2835_pcm_lib_ioctl, ++ .hw_params = snd_bcm2835_pcm_hw_params, ++ .hw_free = snd_bcm2835_pcm_hw_free, ++ .prepare = snd_bcm2835_pcm_prepare, ++ .trigger = snd_bcm2835_pcm_trigger, ++ .pointer = snd_bcm2835_pcm_pointer, ++ .ack = snd_bcm2835_pcm_ack, ++}; ++ ++static struct snd_pcm_ops snd_bcm2835_playback_spdif_ops = { ++ .open = snd_bcm2835_playback_spdif_open, ++ .close = snd_bcm2835_playback_close, ++ .ioctl = snd_bcm2835_pcm_lib_ioctl, ++ .hw_params = snd_bcm2835_pcm_hw_params, ++ .hw_free = snd_bcm2835_pcm_hw_free, ++ .prepare = snd_bcm2835_pcm_prepare, ++ .trigger = snd_bcm2835_pcm_trigger, ++ .pointer = snd_bcm2835_pcm_pointer, ++ .ack = snd_bcm2835_pcm_ack, ++}; ++ ++/* create a pcm device */ ++int snd_bcm2835_new_pcm(bcm2835_chip_t * chip) ++{ ++ struct snd_pcm *pcm; ++ int err; ++ ++ audio_info(" .. IN\n"); ++ mutex_init(&chip->audio_mutex); ++ if(mutex_lock_interruptible(&chip->audio_mutex)) ++ { ++ audio_error("Interrupted whilst waiting for lock\n"); ++ return -EINTR; ++ } ++ err = ++ snd_pcm_new(chip->card, "bcm2835 ALSA", 0, MAX_SUBSTREAMS, 0, &pcm); ++ if (err < 0) ++ goto out; ++ pcm->private_data = chip; ++ strcpy(pcm->name, "bcm2835 ALSA"); ++ chip->pcm = pcm; ++ chip->dest = AUDIO_DEST_AUTO; ++ chip->volume = alsa2chip(0); ++ chip->mute = CTRL_VOL_UNMUTE; /*disable mute on startup */ ++ /* set operators */ ++ snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, ++ &snd_bcm2835_playback_ops); ++ ++ /* pre-allocation of buffers */ ++ /* NOTE: this may fail */ ++ snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_CONTINUOUS, ++ snd_dma_continuous_data ++ (GFP_KERNEL), 64 * 1024, ++ 64 * 1024); ++ ++out: ++ mutex_unlock(&chip->audio_mutex); ++ audio_info(" .. OUT\n"); ++ ++ return 0; ++} ++ ++int snd_bcm2835_new_spdif_pcm(bcm2835_chip_t * chip) ++{ ++ struct snd_pcm *pcm; ++ int err; ++ ++ audio_info(" .. IN\n"); ++ if(mutex_lock_interruptible(&chip->audio_mutex)) ++ { ++ audio_error("Interrupted whilst waiting for lock\n"); ++ return -EINTR; ++ } ++ err = snd_pcm_new(chip->card, "bcm2835 ALSA", 1, 1, 0, &pcm); ++ if (err < 0) ++ goto out; ++ ++ pcm->private_data = chip; ++ strcpy(pcm->name, "bcm2835 IEC958/HDMI"); ++ chip->pcm_spdif = pcm; ++ snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, ++ &snd_bcm2835_playback_spdif_ops); ++ ++ snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_CONTINUOUS, ++ snd_dma_continuous_data (GFP_KERNEL), ++ 64 * 1024, 64 * 1024); ++out: ++ mutex_unlock(&chip->audio_mutex); ++ audio_info(" .. OUT\n"); ++ ++ return 0; ++} +diff --git a/sound/arm/bcm2835-vchiq.c b/sound/arm/bcm2835-vchiq.c +new file mode 100755 +index 0000000..3de3094 +--- /dev/null ++++ b/sound/arm/bcm2835-vchiq.c +@@ -0,0 +1,902 @@ ++/***************************************************************************** ++* Copyright 2011 Broadcom Corporation. All rights reserved. ++* ++* Unless you and Broadcom execute a separate written software license ++* agreement governing use of this software, this software is licensed to you ++* under the terms of the GNU General Public License version 2, available at ++* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). ++* ++* Notwithstanding the above, under no circumstances may you combine this ++* software in any way with any other Broadcom software provided under a ++* license other than the GPL, without Broadcom's express prior written ++* consent. ++*****************************************************************************/ ++ ++#include <linux/device.h> ++#include <sound/core.h> ++#include <sound/initval.h> ++#include <sound/pcm.h> ++#include <linux/io.h> ++#include <linux/interrupt.h> ++#include <linux/fs.h> ++#include <linux/file.h> ++#include <linux/mm.h> ++#include <linux/syscalls.h> ++#include <asm/uaccess.h> ++#include <linux/slab.h> ++#include <linux/delay.h> ++#include <linux/atomic.h> ++#include <linux/module.h> ++#include <linux/completion.h> ++ ++#include "bcm2835.h" ++ ++/* ---- Include Files -------------------------------------------------------- */ ++ ++#include "interface/vchi/vchi.h" ++#include "vc_vchi_audioserv_defs.h" ++ ++/* ---- Private Constants and Types ------------------------------------------ */ ++ ++#define BCM2835_AUDIO_STOP 0 ++#define BCM2835_AUDIO_START 1 ++#define BCM2835_AUDIO_WRITE 2 ++ ++/* Logging macros (for remapping to other logging mechanisms, i.e., printf) */ ++#ifdef AUDIO_DEBUG_ENABLE ++ #define LOG_ERR( fmt, arg... ) pr_err( "%s:%d " fmt, __func__, __LINE__, ##arg) ++ #define LOG_WARN( fmt, arg... ) pr_info( "%s:%d " fmt, __func__, __LINE__, ##arg) ++ #define LOG_INFO( fmt, arg... ) pr_info( "%s:%d " fmt, __func__, __LINE__, ##arg) ++ #define LOG_DBG( fmt, arg... ) pr_info( "%s:%d " fmt, __func__, __LINE__, ##arg) ++#else ++ #define LOG_ERR( fmt, arg... ) pr_err( "%s:%d " fmt, __func__, __LINE__, ##arg) ++ #define LOG_WARN( fmt, arg... ) ++ #define LOG_INFO( fmt, arg... ) ++ #define LOG_DBG( fmt, arg... ) ++#endif ++ ++typedef struct opaque_AUDIO_INSTANCE_T { ++ uint32_t num_connections; ++ VCHI_SERVICE_HANDLE_T vchi_handle[VCHI_MAX_NUM_CONNECTIONS]; ++ struct completion msg_avail_comp; ++ struct mutex vchi_mutex; ++ bcm2835_alsa_stream_t *alsa_stream; ++ int32_t result; ++ short peer_version; ++} AUDIO_INSTANCE_T; ++ ++bool force_bulk = false; ++ ++/* ---- Private Variables ---------------------------------------------------- */ ++ ++/* ---- Private Function Prototypes ------------------------------------------ */ ++ ++/* ---- Private Functions ---------------------------------------------------- */ ++ ++static int bcm2835_audio_stop_worker(bcm2835_alsa_stream_t * alsa_stream); ++static int bcm2835_audio_start_worker(bcm2835_alsa_stream_t * alsa_stream); ++static int bcm2835_audio_write_worker(bcm2835_alsa_stream_t *alsa_stream, ++ uint32_t count, void *src); ++ ++typedef struct { ++ struct work_struct my_work; ++ bcm2835_alsa_stream_t *alsa_stream; ++ int cmd; ++ void *src; ++ uint32_t count; ++} my_work_t; ++ ++static void my_wq_function(struct work_struct *work) ++{ ++ my_work_t *w = (my_work_t *) work; ++ int ret = -9; ++ LOG_DBG(" .. IN %p:%d\n", w->alsa_stream, w->cmd); ++ switch (w->cmd) { ++ case BCM2835_AUDIO_START: ++ ret = bcm2835_audio_start_worker(w->alsa_stream); ++ break; ++ case BCM2835_AUDIO_STOP: ++ ret = bcm2835_audio_stop_worker(w->alsa_stream); ++ break; ++ case BCM2835_AUDIO_WRITE: ++ ret = bcm2835_audio_write_worker(w->alsa_stream, w->count, ++ w->src); ++ break; ++ default: ++ LOG_ERR(" Unexpected work: %p:%d\n", w->alsa_stream, w->cmd); ++ break; ++ } ++ kfree((void *)work); ++ LOG_DBG(" .. OUT %d\n", ret); ++} ++ ++int bcm2835_audio_start(bcm2835_alsa_stream_t * alsa_stream) ++{ ++ int ret = -1; ++ LOG_DBG(" .. IN\n"); ++ if (alsa_stream->my_wq) { ++ my_work_t *work = kmalloc(sizeof(my_work_t), GFP_ATOMIC); ++ /*--- Queue some work (item 1) ---*/ ++ if (work) { ++ INIT_WORK((struct work_struct *)work, my_wq_function); ++ work->alsa_stream = alsa_stream; ++ work->cmd = BCM2835_AUDIO_START; ++ if (queue_work ++ (alsa_stream->my_wq, (struct work_struct *)work)) ++ ret = 0; ++ } else ++ LOG_ERR(" .. Error: NULL work kmalloc\n"); ++ } ++ LOG_DBG(" .. OUT %d\n", ret); ++ return ret; ++} ++ ++int bcm2835_audio_stop(bcm2835_alsa_stream_t * alsa_stream) ++{ ++ int ret = -1; ++ LOG_DBG(" .. IN\n"); ++ if (alsa_stream->my_wq) { ++ my_work_t *work = kmalloc(sizeof(my_work_t), GFP_ATOMIC); ++ /*--- Queue some work (item 1) ---*/ ++ if (work) { ++ INIT_WORK((struct work_struct *)work, my_wq_function); ++ work->alsa_stream = alsa_stream; ++ work->cmd = BCM2835_AUDIO_STOP; ++ if (queue_work ++ (alsa_stream->my_wq, (struct work_struct *)work)) ++ ret = 0; ++ } else ++ LOG_ERR(" .. Error: NULL work kmalloc\n"); ++ } ++ LOG_DBG(" .. OUT %d\n", ret); ++ return ret; ++} ++ ++int bcm2835_audio_write(bcm2835_alsa_stream_t *alsa_stream, ++ uint32_t count, void *src) ++{ ++ int ret = -1; ++ LOG_DBG(" .. IN\n"); ++ if (alsa_stream->my_wq) { ++ my_work_t *work = kmalloc(sizeof(my_work_t), GFP_ATOMIC); ++ /*--- Queue some work (item 1) ---*/ ++ if (work) { ++ INIT_WORK((struct work_struct *)work, my_wq_function); ++ work->alsa_stream = alsa_stream; ++ work->cmd = BCM2835_AUDIO_WRITE; ++ work->src = src; ++ work->count = count; ++ if (queue_work ++ (alsa_stream->my_wq, (struct work_struct *)work)) ++ ret = 0; ++ } else ++ LOG_ERR(" .. Error: NULL work kmalloc\n"); ++ } ++ LOG_DBG(" .. OUT %d\n", ret); ++ return ret; ++} ++ ++void my_workqueue_init(bcm2835_alsa_stream_t * alsa_stream) ++{ ++ alsa_stream->my_wq = alloc_workqueue("my_queue", WQ_HIGHPRI, 1); ++ return; ++} ++ ++void my_workqueue_quit(bcm2835_alsa_stream_t * alsa_stream) ++{ ++ if (alsa_stream->my_wq) { ++ flush_workqueue(alsa_stream->my_wq); ++ destroy_workqueue(alsa_stream->my_wq); ++ alsa_stream->my_wq = NULL; ++ } ++ return; ++} ++ ++static void audio_vchi_callback(void *param, ++ const VCHI_CALLBACK_REASON_T reason, ++ void *msg_handle) ++{ ++ AUDIO_INSTANCE_T *instance = (AUDIO_INSTANCE_T *) param; ++ int32_t status; ++ int32_t msg_len; ++ VC_AUDIO_MSG_T m; ++ LOG_DBG(" .. IN instance=%p, handle=%p, alsa=%p, reason=%d, handle=%p\n", ++ instance, instance ? instance->vchi_handle[0] : NULL, instance ? instance->alsa_stream : NULL, reason, msg_handle); ++ ++ if (reason != VCHI_CALLBACK_MSG_AVAILABLE) { ++ return; ++ } ++ if (!instance) { ++ LOG_ERR(" .. instance is null\n"); ++ BUG(); ++ return; ++ } ++ if (!instance->vchi_handle[0]) { ++ LOG_ERR(" .. instance->vchi_handle[0] is null\n"); ++ BUG(); ++ return; ++ } ++ status = vchi_msg_dequeue(instance->vchi_handle[0], ++ &m, sizeof m, &msg_len, VCHI_FLAGS_NONE); ++ if (m.type == VC_AUDIO_MSG_TYPE_RESULT) { ++ LOG_DBG ++ (" .. instance=%p, m.type=VC_AUDIO_MSG_TYPE_RESULT, success=%d\n", ++ instance, m.u.result.success); ++ instance->result = m.u.result.success; ++ complete(&instance->msg_avail_comp); ++ } else if (m.type == VC_AUDIO_MSG_TYPE_COMPLETE) { ++ bcm2835_alsa_stream_t *alsa_stream = instance->alsa_stream; ++ irq_handler_t callback = (irq_handler_t) m.u.complete.callback; ++ LOG_DBG ++ (" .. instance=%p, m.type=VC_AUDIO_MSG_TYPE_COMPLETE, complete=%d\n", ++ instance, m.u.complete.count); ++ if (alsa_stream && callback) { ++ atomic_add(m.u.complete.count, &alsa_stream->retrieved); ++ callback(0, alsa_stream); ++ } else { ++ LOG_ERR(" .. unexpected alsa_stream=%p, callback=%p\n", ++ alsa_stream, callback); ++ } ++ } else { ++ LOG_ERR(" .. unexpected m.type=%d\n", m.type); ++ } ++ LOG_DBG(" .. OUT\n"); ++} ++ ++static AUDIO_INSTANCE_T *vc_vchi_audio_init(VCHI_INSTANCE_T vchi_instance, ++ VCHI_CONNECTION_T ** ++ vchi_connections, ++ uint32_t num_connections) ++{ ++ uint32_t i; ++ AUDIO_INSTANCE_T *instance; ++ int status; ++ ++ LOG_DBG("%s: start", __func__); ++ ++ if (num_connections > VCHI_MAX_NUM_CONNECTIONS) { ++ LOG_ERR("%s: unsupported number of connections %u (max=%u)\n", ++ __func__, num_connections, VCHI_MAX_NUM_CONNECTIONS); ++ ++ return NULL; ++ } ++ /* Allocate memory for this instance */ ++ instance = kmalloc(sizeof(*instance), GFP_KERNEL); ++ if (!instance) ++ return NULL; ++ ++ memset(instance, 0, sizeof(*instance)); ++ instance->num_connections = num_connections; ++ ++ /* Create a lock for exclusive, serialized VCHI connection access */ ++ mutex_init(&instance->vchi_mutex); ++ /* Open the VCHI service connections */ ++ for (i = 0; i < num_connections; i++) { ++ SERVICE_CREATION_T params = { ++ VCHI_VERSION_EX(VC_AUDIOSERV_VER, VC_AUDIOSERV_MIN_VER), ++ VC_AUDIO_SERVER_NAME, // 4cc service code ++ vchi_connections[i], // passed in fn pointers ++ 0, // rx fifo size (unused) ++ 0, // tx fifo size (unused) ++ audio_vchi_callback, // service callback ++ instance, // service callback parameter ++ 1, //TODO: remove VCOS_FALSE, // unaligned bulk recieves ++ 1, //TODO: remove VCOS_FALSE, // unaligned bulk transmits ++ 0 // want crc check on bulk transfers ++ }; ++ ++ LOG_DBG("%s: about to open %i\n", __func__, i); ++ status = vchi_service_open(vchi_instance, &params, ++ &instance->vchi_handle[i]); ++ LOG_DBG("%s: opened %i: %p=%d\n", __func__, i, instance->vchi_handle[i], status); ++ if (status) { ++ LOG_ERR ++ ("%s: failed to open VCHI service connection (status=%d)\n", ++ __func__, status); ++ ++ goto err_close_services; ++ } ++ /* Finished with the service for now */ ++ vchi_service_release(instance->vchi_handle[i]); ++ } ++ ++ LOG_DBG("%s: okay\n", __func__); ++ return instance; ++ ++err_close_services: ++ for (i = 0; i < instance->num_connections; i++) { ++ LOG_ERR("%s: closing %i: %p\n", __func__, i, instance->vchi_handle[i]); ++ if (instance->vchi_handle[i]) ++ vchi_service_close(instance->vchi_handle[i]); ++ } ++ ++ kfree(instance); ++ LOG_ERR("%s: error\n", __func__); ++ ++ return NULL; ++} ++ ++static int32_t vc_vchi_audio_deinit(AUDIO_INSTANCE_T * instance) ++{ ++ uint32_t i; ++ ++ LOG_DBG(" .. IN\n"); ++ ++ if (instance == NULL) { ++ LOG_ERR("%s: invalid handle %p\n", __func__, instance); ++ ++ return -1; ++ } ++ ++ LOG_DBG(" .. about to lock (%d)\n", instance->num_connections); ++ if(mutex_lock_interruptible(&instance->vchi_mutex)) ++ { ++ LOG_DBG("Interrupted whilst waiting for lock on (%d)\n",instance->num_connections); ++ return -EINTR; ++ } ++ ++ /* Close all VCHI service connections */ ++ for (i = 0; i < instance->num_connections; i++) { ++ int32_t success; ++ LOG_DBG(" .. %i:closing %p\n", i, instance->vchi_handle[i]); ++ vchi_service_use(instance->vchi_handle[i]); ++ ++ success = vchi_service_close(instance->vchi_handle[i]); ++ if (success != 0) { ++ LOG_DBG ++ ("%s: failed to close VCHI service connection (status=%d)\n", ++ __func__, success); ++ } ++ } ++ ++ mutex_unlock(&instance->vchi_mutex); ++ ++ kfree(instance); ++ ++ LOG_DBG(" .. OUT\n"); ++ ++ return 0; ++} ++ ++static int bcm2835_audio_open_connection(bcm2835_alsa_stream_t * alsa_stream) ++{ ++ static VCHI_INSTANCE_T vchi_instance; ++ static VCHI_CONNECTION_T *vchi_connection; ++ static int initted; ++ AUDIO_INSTANCE_T *instance = alsa_stream->instance; ++ int ret; ++ LOG_DBG(" .. IN\n"); ++ ++ LOG_INFO("%s: start\n", __func__); ++ BUG_ON(instance); ++ if (instance) { ++ LOG_ERR("%s: VCHI instance already open (%p)\n", ++ __func__, instance); ++ instance->alsa_stream = alsa_stream; ++ alsa_stream->instance = instance; ++ ret = 0; // xxx todo -1; ++ goto err_free_mem; ++ } ++ ++ /* Initialize and create a VCHI connection */ ++ if (!initted) { ++ ret = vchi_initialise(&vchi_instance); ++ if (ret != 0) { ++ LOG_ERR("%s: failed to initialise VCHI instance (ret=%d)\n", ++ __func__, ret); ++ ++ ret = -EIO; ++ goto err_free_mem; ++ } ++ ret = vchi_connect(NULL, 0, vchi_instance); ++ if (ret != 0) { ++ LOG_ERR("%s: failed to connect VCHI instance (ret=%d)\n", ++ __func__, ret); ++ ++ ret = -EIO; ++ goto err_free_mem; ++ } ++ initted = 1; ++ } ++ ++ /* Initialize an instance of the audio service */ ++ instance = vc_vchi_audio_init(vchi_instance, &vchi_connection, 1); ++ ++ if (instance == NULL) { ++ LOG_ERR("%s: failed to initialize audio service\n", __func__); ++ ++ ret = -EPERM; ++ goto err_free_mem; ++ } ++ ++ instance->alsa_stream = alsa_stream; ++ alsa_stream->instance = instance; ++ ++ LOG_DBG(" success !\n"); ++err_free_mem: ++ LOG_DBG(" .. OUT\n"); ++ ++ return ret; ++} ++ ++int bcm2835_audio_open(bcm2835_alsa_stream_t * alsa_stream) ++{ ++ AUDIO_INSTANCE_T *instance; ++ VC_AUDIO_MSG_T m; ++ int32_t success; ++ int ret; ++ LOG_DBG(" .. IN\n"); ++ ++ my_workqueue_init(alsa_stream); ++ ++ ret = bcm2835_audio_open_connection(alsa_stream); ++ if (ret != 0) { ++ ret = -1; ++ goto exit; ++ } ++ instance = alsa_stream->instance; ++ LOG_DBG(" instance (%p)\n", instance); ++ ++ if(mutex_lock_interruptible(&instance->vchi_mutex)) ++ { ++ LOG_DBG("Interrupted whilst waiting for lock on (%d)\n",instance->num_connections); ++ return -EINTR; ++ } ++ vchi_service_use(instance->vchi_handle[0]); ++ ++ m.type = VC_AUDIO_MSG_TYPE_OPEN; ++ ++ /* Send the message to the videocore */ ++ success = vchi_msg_queue(instance->vchi_handle[0], ++ &m, sizeof m, ++ VCHI_FLAGS_BLOCK_UNTIL_QUEUED, NULL); ++ ++ if (success != 0) { ++ LOG_ERR("%s: failed on vchi_msg_queue (status=%d)\n", ++ __func__, success); ++ ++ ret = -1; ++ goto unlock; ++ } ++ ++ ret = 0; ++ ++unlock: ++ vchi_service_release(instance->vchi_handle[0]); ++ mutex_unlock(&instance->vchi_mutex); ++exit: ++ LOG_DBG(" .. OUT\n"); ++ return ret; ++} ++ ++static int bcm2835_audio_set_ctls_chan(bcm2835_alsa_stream_t * alsa_stream, ++ bcm2835_chip_t * chip) ++{ ++ VC_AUDIO_MSG_T m; ++ AUDIO_INSTANCE_T *instance = alsa_stream->instance; ++ int32_t success; ++ int ret; ++ LOG_DBG(" .. IN\n"); ++ ++ LOG_INFO ++ (" Setting ALSA dest(%d), volume(%d)\n", chip->dest, chip->volume); ++ ++ if(mutex_lock_interruptible(&instance->vchi_mutex)) ++ { ++ LOG_DBG("Interrupted whilst waiting for lock on (%d)\n",instance->num_connections); ++ return -EINTR; ++ } ++ vchi_service_use(instance->vchi_handle[0]); ++ ++ instance->result = -1; ++ ++ m.type = VC_AUDIO_MSG_TYPE_CONTROL; ++ m.u.control.dest = chip->dest; ++ m.u.control.volume = chip->volume; ++ ++ /* Create the message available completion */ ++ init_completion(&instance->msg_avail_comp); ++ ++ /* Send the message to the videocore */ ++ success = vchi_msg_queue(instance->vchi_handle[0], ++ &m, sizeof m, ++ VCHI_FLAGS_BLOCK_UNTIL_QUEUED, NULL); ++ ++ if (success != 0) { ++ LOG_ERR("%s: failed on vchi_msg_queue (status=%d)\n", ++ __func__, success); ++ ++ ret = -1; ++ goto unlock; ++ } ++ ++ /* We are expecting a reply from the videocore */ ++ ret = wait_for_completion_interruptible(&instance->msg_avail_comp); ++ if (ret) { ++ LOG_DBG("%s: failed on waiting for event (status=%d)\n", ++ __func__, success); ++ goto unlock; ++ } ++ ++ if (instance->result != 0) { ++ LOG_ERR("%s: result=%d\n", __func__, instance->result); ++ ++ ret = -1; ++ goto unlock; ++ } ++ ++ ret = 0; ++ ++unlock: ++ vchi_service_release(instance->vchi_handle[0]); ++ mutex_unlock(&instance->vchi_mutex); ++ ++ LOG_DBG(" .. OUT\n"); ++ return ret; ++} ++ ++int bcm2835_audio_set_ctls(bcm2835_chip_t * chip) ++{ ++ int i; ++ int ret = 0; ++ LOG_DBG(" .. IN\n"); ++ LOG_DBG(" Setting ALSA dest(%d), volume(%d)\n", chip->dest, chip->volume); ++ ++ /* change ctls for all substreams */ ++ for (i = 0; i < MAX_SUBSTREAMS; i++) { ++ if (chip->avail_substreams & (1 << i)) { ++ if (!chip->alsa_stream[i]) ++ { ++ LOG_DBG(" No ALSA stream available?! %i:%p (%x)\n", i, chip->alsa_stream[i], chip->avail_substreams); ++ ret = 0; ++ } ++ else if (bcm2835_audio_set_ctls_chan /* returns 0 on success */ ++ (chip->alsa_stream[i], chip) != 0) ++ { ++ LOG_ERR("Couldn't set the controls for stream %d\n", i); ++ ret = -1; ++ } ++ else LOG_DBG(" Controls set for stream %d\n", i); ++ } ++ } ++ LOG_DBG(" .. OUT ret=%d\n", ret); ++ return ret; ++} ++ ++int bcm2835_audio_set_params(bcm2835_alsa_stream_t * alsa_stream, ++ uint32_t channels, uint32_t samplerate, ++ uint32_t bps) ++{ ++ VC_AUDIO_MSG_T m; ++ AUDIO_INSTANCE_T *instance = alsa_stream->instance; ++ int32_t success; ++ int ret; ++ LOG_DBG(" .. IN\n"); ++ ++ LOG_INFO ++ (" Setting ALSA channels(%d), samplerate(%d), bits-per-sample(%d)\n", ++ channels, samplerate, bps); ++ ++ /* resend ctls - alsa_stream may not have been open when first send */ ++ ret = bcm2835_audio_set_ctls_chan(alsa_stream, alsa_stream->chip); ++ if (ret != 0) { ++ LOG_ERR(" Alsa controls not supported\n"); ++ return -EINVAL; ++ } ++ ++ if(mutex_lock_interruptible(&instance->vchi_mutex)) ++ { ++ LOG_DBG("Interrupted whilst waiting for lock on (%d)\n",instance->num_connections); ++ return -EINTR; ++ } ++ vchi_service_use(instance->vchi_handle[0]); ++ ++ instance->result = -1; ++ ++ m.type = VC_AUDIO_MSG_TYPE_CONFIG; ++ m.u.config.channels = channels; ++ m.u.config.samplerate = samplerate; ++ m.u.config.bps = bps; ++ ++ /* Create the message available completion */ ++ init_completion(&instance->msg_avail_comp); ++ ++ /* Send the message to the videocore */ ++ success = vchi_msg_queue(instance->vchi_handle[0], ++ &m, sizeof m, ++ VCHI_FLAGS_BLOCK_UNTIL_QUEUED, NULL); ++ ++ if (success != 0) { ++ LOG_ERR("%s: failed on vchi_msg_queue (status=%d)\n", ++ __func__, success); ++ ++ ret = -1; ++ goto unlock; ++ } ++ ++ /* We are expecting a reply from the videocore */ ++ ret = wait_for_completion_interruptible(&instance->msg_avail_comp); ++ if (ret) { ++ LOG_DBG("%s: failed on waiting for event (status=%d)\n", ++ __func__, success); ++ goto unlock; ++ } ++ ++ if (instance->result != 0) { ++ LOG_ERR("%s: result=%d", __func__, instance->result); ++ ++ ret = -1; ++ goto unlock; ++ } ++ ++ ret = 0; ++ ++unlock: ++ vchi_service_release(instance->vchi_handle[0]); ++ mutex_unlock(&instance->vchi_mutex); ++ ++ LOG_DBG(" .. OUT\n"); ++ return ret; ++} ++ ++int bcm2835_audio_setup(bcm2835_alsa_stream_t * alsa_stream) ++{ ++ LOG_DBG(" .. IN\n"); ++ ++ LOG_DBG(" .. OUT\n"); ++ ++ return 0; ++} ++ ++static int bcm2835_audio_start_worker(bcm2835_alsa_stream_t * alsa_stream) ++{ ++ VC_AUDIO_MSG_T m; ++ AUDIO_INSTANCE_T *instance = alsa_stream->instance; ++ int32_t success; ++ int ret; ++ LOG_DBG(" .. IN\n"); ++ ++ if(mutex_lock_interruptible(&instance->vchi_mutex)) ++ { ++ LOG_DBG("Interrupted whilst waiting for lock on (%d)\n",instance->num_connections); ++ return -EINTR; ++ } ++ vchi_service_use(instance->vchi_handle[0]); ++ ++ m.type = VC_AUDIO_MSG_TYPE_START; ++ ++ /* Send the message to the videocore */ ++ success = vchi_msg_queue(instance->vchi_handle[0], ++ &m, sizeof m, ++ VCHI_FLAGS_BLOCK_UNTIL_QUEUED, NULL); ++ ++ if (success != 0) { ++ LOG_ERR("%s: failed on vchi_msg_queue (status=%d)\n", ++ __func__, success); ++ ++ ret = -1; ++ goto unlock; ++ } ++ ++ ret = 0; ++ ++unlock: ++ vchi_service_release(instance->vchi_handle[0]); ++ mutex_unlock(&instance->vchi_mutex); ++ LOG_DBG(" .. OUT\n"); ++ return ret; ++} ++ ++static int bcm2835_audio_stop_worker(bcm2835_alsa_stream_t * alsa_stream) ++{ ++ VC_AUDIO_MSG_T m; ++ AUDIO_INSTANCE_T *instance = alsa_stream->instance; ++ int32_t success; ++ int ret; ++ LOG_DBG(" .. IN\n"); ++ ++ if(mutex_lock_interruptible(&instance->vchi_mutex)) ++ { ++ LOG_DBG("Interrupted whilst waiting for lock on (%d)\n",instance->num_connections); ++ return -EINTR; ++ } ++ vchi_service_use(instance->vchi_handle[0]); ++ ++ m.type = VC_AUDIO_MSG_TYPE_STOP; ++ m.u.stop.draining = alsa_stream->draining; ++ ++ /* Send the message to the videocore */ ++ success = vchi_msg_queue(instance->vchi_handle[0], ++ &m, sizeof m, ++ VCHI_FLAGS_BLOCK_UNTIL_QUEUED, NULL); ++ ++ if (success != 0) { ++ LOG_ERR("%s: failed on vchi_msg_queue (status=%d)\n", ++ __func__, success); ++ ++ ret = -1; ++ goto unlock; ++ } ++ ++ ret = 0; ++ ++unlock: ++ vchi_service_release(instance->vchi_handle[0]); ++ mutex_unlock(&instance->vchi_mutex); ++ LOG_DBG(" .. OUT\n"); ++ return ret; ++} ++ ++int bcm2835_audio_close(bcm2835_alsa_stream_t * alsa_stream) ++{ ++ VC_AUDIO_MSG_T m; ++ AUDIO_INSTANCE_T *instance = alsa_stream->instance; ++ int32_t success; ++ int ret; ++ LOG_DBG(" .. IN\n"); ++ ++ my_workqueue_quit(alsa_stream); ++ ++ if(mutex_lock_interruptible(&instance->vchi_mutex)) ++ { ++ LOG_DBG("Interrupted whilst waiting for lock on (%d)\n",instance->num_connections); ++ return -EINTR; ++ } ++ vchi_service_use(instance->vchi_handle[0]); ++ ++ m.type = VC_AUDIO_MSG_TYPE_CLOSE; ++ ++ /* Create the message available completion */ ++ init_completion(&instance->msg_avail_comp); ++ ++ /* Send the message to the videocore */ ++ success = vchi_msg_queue(instance->vchi_handle[0], ++ &m, sizeof m, ++ VCHI_FLAGS_BLOCK_UNTIL_QUEUED, NULL); ++ ++ if (success != 0) { ++ LOG_ERR("%s: failed on vchi_msg_queue (status=%d)\n", ++ __func__, success); ++ ret = -1; ++ goto unlock; ++ } ++ ++ ret = wait_for_completion_interruptible(&instance->msg_avail_comp); ++ if (ret) { ++ LOG_DBG("%s: failed on waiting for event (status=%d)\n", ++ __func__, success); ++ goto unlock; ++ } ++ if (instance->result != 0) { ++ LOG_ERR("%s: failed result (status=%d)\n", ++ __func__, instance->result); ++ ++ ret = -1; ++ goto unlock; ++ } ++ ++ ret = 0; ++ ++unlock: ++ vchi_service_release(instance->vchi_handle[0]); ++ mutex_unlock(&instance->vchi_mutex); ++ ++ /* Stop the audio service */ ++ if (instance) { ++ vc_vchi_audio_deinit(instance); ++ alsa_stream->instance = NULL; ++ } ++ LOG_DBG(" .. OUT\n"); ++ return ret; ++} ++ ++int bcm2835_audio_write_worker(bcm2835_alsa_stream_t *alsa_stream, ++ uint32_t count, void *src) ++{ ++ VC_AUDIO_MSG_T m; ++ AUDIO_INSTANCE_T *instance = alsa_stream->instance; ++ int32_t success; ++ int ret; ++ ++ LOG_DBG(" .. IN\n"); ++ ++ LOG_INFO(" Writing %d bytes from %p\n", count, src); ++ ++ if(mutex_lock_interruptible(&instance->vchi_mutex)) ++ { ++ LOG_DBG("Interrupted whilst waiting for lock on (%d)\n",instance->num_connections); ++ return -EINTR; ++ } ++ vchi_service_use(instance->vchi_handle[0]); ++ ++ if ( instance->peer_version==0 && vchi_get_peer_version(instance->vchi_handle[0], &instance->peer_version) == 0 ) { ++ LOG_DBG("%s: client version %d connected\n", __func__, instance->peer_version); ++ } ++ m.type = VC_AUDIO_MSG_TYPE_WRITE; ++ m.u.write.count = count; ++ // old version uses bulk, new version uses control ++ m.u.write.max_packet = instance->peer_version < 2 || force_bulk ? 0:4000; ++ m.u.write.callback = alsa_stream->fifo_irq_handler; ++ m.u.write.cookie = alsa_stream; ++ m.u.write.silence = src == NULL; ++ ++ /* Send the message to the videocore */ ++ success = vchi_msg_queue(instance->vchi_handle[0], ++ &m, sizeof m, ++ VCHI_FLAGS_BLOCK_UNTIL_QUEUED, NULL); ++ ++ if (success != 0) { ++ LOG_ERR("%s: failed on vchi_msg_queue (status=%d)\n", ++ __func__, success); ++ ++ ret = -1; ++ goto unlock; ++ } ++ if (!m.u.write.silence) { ++ if (m.u.write.max_packet == 0) { ++ /* Send the message to the videocore */ ++ success = vchi_bulk_queue_transmit(instance->vchi_handle[0], ++ src, count, ++ 0 * ++ VCHI_FLAGS_BLOCK_UNTIL_QUEUED ++ + ++ 1 * ++ VCHI_FLAGS_BLOCK_UNTIL_DATA_READ, ++ NULL); ++ } else { ++ while (count > 0) { ++ int bytes = min((int)m.u.write.max_packet, (int)count); ++ success = vchi_msg_queue(instance->vchi_handle[0], ++ src, bytes, ++ VCHI_FLAGS_BLOCK_UNTIL_QUEUED, NULL); ++ src = (char *)src + bytes; ++ count -= bytes; ++ } ++ } ++ if (success != 0) { ++ LOG_ERR ++ ("%s: failed on vchi_bulk_queue_transmit (status=%d)\n", ++ __func__, success); ++ ++ ret = -1; ++ goto unlock; ++ } ++ } ++ ret = 0; ++ ++unlock: ++ vchi_service_release(instance->vchi_handle[0]); ++ mutex_unlock(&instance->vchi_mutex); ++ LOG_DBG(" .. OUT\n"); ++ return ret; ++} ++ ++/** ++ * Returns all buffers from arm->vc ++ */ ++void bcm2835_audio_flush_buffers(bcm2835_alsa_stream_t * alsa_stream) ++{ ++ LOG_DBG(" .. IN\n"); ++ LOG_DBG(" .. OUT\n"); ++ return; ++} ++ ++/** ++ * Forces VC to flush(drop) its filled playback buffers and ++ * return them the us. (VC->ARM) ++ */ ++void bcm2835_audio_flush_playback_buffers(bcm2835_alsa_stream_t * alsa_stream) ++{ ++ LOG_DBG(" .. IN\n"); ++ LOG_DBG(" .. OUT\n"); ++} ++ ++uint32_t bcm2835_audio_retrieve_buffers(bcm2835_alsa_stream_t * alsa_stream) ++{ ++ uint32_t count = atomic_read(&alsa_stream->retrieved); ++ atomic_sub(count, &alsa_stream->retrieved); ++ return count; ++} ++ ++module_param(force_bulk, bool, 0444); ++MODULE_PARM_DESC(force_bulk, "Force use of vchiq bulk for audio"); +diff --git a/sound/arm/bcm2835.c b/sound/arm/bcm2835.c +new file mode 100644 +index 0000000..7a2ed78 +--- /dev/null ++++ b/sound/arm/bcm2835.c +@@ -0,0 +1,511 @@ ++/***************************************************************************** ++* Copyright 2011 Broadcom Corporation. All rights reserved. ++* ++* Unless you and Broadcom execute a separate written software license ++* agreement governing use of this software, this software is licensed to you ++* under the terms of the GNU General Public License version 2, available at ++* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). ++* ++* Notwithstanding the above, under no circumstances may you combine this ++* software in any way with any other Broadcom software provided under a ++* license other than the GPL, without Broadcom's express prior written ++* consent. ++*****************************************************************************/ ++ ++#include <linux/platform_device.h> ++ ++#include <linux/init.h> ++#include <linux/slab.h> ++#include <linux/module.h> ++#include <linux/of.h> ++ ++#include "bcm2835.h" ++ ++/* module parameters (see "Module Parameters") */ ++/* SNDRV_CARDS: maximum number of cards supported by this module */ ++static int index[MAX_SUBSTREAMS] = {[0 ... (MAX_SUBSTREAMS - 1)] = -1 }; ++static char *id[MAX_SUBSTREAMS] = {[0 ... (MAX_SUBSTREAMS - 1)] = NULL }; ++static int enable[MAX_SUBSTREAMS] = {[0 ... (MAX_SUBSTREAMS - 1)] = 1 }; ++ ++/* HACKY global pointers needed for successive probes to work : ssp ++ * But compared against the changes we will have to do in VC audio_ipc code ++ * to export 8 audio_ipc devices as a single IPC device and then monitor all ++ * four devices in a thread, this gets things done quickly and should be easier ++ * to debug if we run into issues ++ */ ++ ++static struct snd_card *g_card = NULL; ++static bcm2835_chip_t *g_chip = NULL; ++ ++static int snd_bcm2835_free(bcm2835_chip_t * chip) ++{ ++ kfree(chip); ++ return 0; ++} ++ ++/* component-destructor ++ * (see "Management of Cards and Components") ++ */ ++static int snd_bcm2835_dev_free(struct snd_device *device) ++{ ++ return snd_bcm2835_free(device->device_data); ++} ++ ++/* chip-specific constructor ++ * (see "Management of Cards and Components") ++ */ ++static int snd_bcm2835_create(struct snd_card *card, ++ struct platform_device *pdev, ++ bcm2835_chip_t ** rchip) ++{ ++ bcm2835_chip_t *chip; ++ int err; ++ static struct snd_device_ops ops = { ++ .dev_free = snd_bcm2835_dev_free, ++ }; ++ ++ *rchip = NULL; ++ ++ chip = kzalloc(sizeof(*chip), GFP_KERNEL); ++ if (chip == NULL) ++ return -ENOMEM; ++ ++ chip->card = card; ++ ++ err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops); ++ if (err < 0) { ++ snd_bcm2835_free(chip); ++ return err; ++ } ++ ++ *rchip = chip; ++ return 0; ++} ++ ++static int snd_bcm2835_alsa_probe_dt(struct platform_device *pdev) ++{ ++ struct device *dev = &pdev->dev; ++ bcm2835_chip_t *chip; ++ struct snd_card *card; ++ u32 numchans; ++ int err, i; ++ ++ err = of_property_read_u32(dev->of_node, "brcm,pwm-channels", ++ &numchans); ++ if (err) { ++ dev_err(dev, "Failed to get DT property 'brcm,pwm-channels'"); ++ return err; ++ } ++ ++ if (numchans == 0 || numchans > MAX_SUBSTREAMS) { ++ numchans = MAX_SUBSTREAMS; ++ dev_warn(dev, "Illegal 'brcm,pwm-channels' value, will use %u\n", ++ numchans); ++ } ++ ++ err = snd_card_new(&pdev->dev, -1, NULL, THIS_MODULE, 0, &card); ++ if (err) { ++ dev_err(dev, "Failed to create soundcard structure\n"); ++ return err; ++ } ++ ++ snd_card_set_dev(card, dev); ++ strcpy(card->driver, "bcm2835"); ++ strcpy(card->shortname, "bcm2835 ALSA"); ++ sprintf(card->longname, "%s", card->shortname); ++ ++ err = snd_bcm2835_create(card, pdev, &chip); ++ if (err < 0) { ++ dev_err(dev, "Failed to create bcm2835 chip\n"); ++ goto err_free; ++ } ++ ++ err = snd_bcm2835_new_pcm(chip); ++ if (err < 0) { ++ dev_err(dev, "Failed to create new bcm2835 pcm device\n"); ++ goto err_free; ++ } ++ ++ err = snd_bcm2835_new_spdif_pcm(chip); ++ if (err < 0) { ++ dev_err(dev, "Failed to create new bcm2835 spdif pcm device\n"); ++ goto err_free; ++ } ++ ++ err = snd_bcm2835_new_ctl(chip); ++ if (err < 0) { ++ dev_err(dev, "Failed to create new bcm2835 ctl\n"); ++ goto err_free; ++ } ++ ++ for (i = 0; i < numchans; i++) { ++ chip->avail_substreams |= (1 << i); ++ chip->pdev[i] = pdev; ++ } ++ ++ err = snd_card_register(card); ++ if (err) { ++ dev_err(dev, "Failed to register bcm2835 ALSA card \n"); ++ goto err_free; ++ } ++ ++ g_card = card; ++ g_chip = chip; ++ platform_set_drvdata(pdev, card); ++ audio_info("bcm2835 ALSA card created with %u channels\n", numchans); ++ ++ return 0; ++ ++err_free: ++ snd_card_free(card); ++ ++ return err; ++} ++ ++static int snd_bcm2835_alsa_probe(struct platform_device *pdev) ++{ ++ static int dev; ++ bcm2835_chip_t *chip; ++ struct snd_card *card; ++ int err; ++ ++ if (pdev->dev.of_node) ++ return snd_bcm2835_alsa_probe_dt(pdev); ++ ++ if (dev >= MAX_SUBSTREAMS) ++ return -ENODEV; ++ ++ if (!enable[dev]) { ++ dev++; ++ return -ENOENT; ++ } ++ ++ if (dev > 0) ++ goto add_register_map; ++ ++ err = snd_card_new(&pdev->dev, index[dev], id[dev], THIS_MODULE, 0, &g_card); ++ if (err < 0) ++ goto out; ++ ++ snd_card_set_dev(g_card, &pdev->dev); ++ strcpy(g_card->driver, "bcm2835"); ++ strcpy(g_card->shortname, "bcm2835 ALSA"); ++ sprintf(g_card->longname, "%s", g_card->shortname); ++ ++ err = snd_bcm2835_create(g_card, pdev, &chip); ++ if (err < 0) { ++ dev_err(&pdev->dev, "Failed to create bcm2835 chip\n"); ++ goto out_bcm2835_create; ++ } ++ ++ g_chip = chip; ++ err = snd_bcm2835_new_pcm(chip); ++ if (err < 0) { ++ dev_err(&pdev->dev, "Failed to create new BCM2835 pcm device\n"); ++ goto out_bcm2835_new_pcm; ++ } ++ ++ err = snd_bcm2835_new_spdif_pcm(chip); ++ if (err < 0) { ++ dev_err(&pdev->dev, "Failed to create new BCM2835 spdif pcm device\n"); ++ goto out_bcm2835_new_spdif; ++ } ++ ++ err = snd_bcm2835_new_ctl(chip); ++ if (err < 0) { ++ dev_err(&pdev->dev, "Failed to create new BCM2835 ctl\n"); ++ goto out_bcm2835_new_ctl; ++ } ++ ++add_register_map: ++ card = g_card; ++ chip = g_chip; ++ ++ BUG_ON(!(card && chip)); ++ ++ chip->avail_substreams |= (1 << dev); ++ chip->pdev[dev] = pdev; ++ ++ if (dev == 0) { ++ err = snd_card_register(card); ++ if (err < 0) { ++ dev_err(&pdev->dev, ++ "Failed to register bcm2835 ALSA card \n"); ++ goto out_card_register; ++ } ++ platform_set_drvdata(pdev, card); ++ audio_info("bcm2835 ALSA card created!\n"); ++ } else { ++ audio_info("bcm2835 ALSA chip created!\n"); ++ platform_set_drvdata(pdev, (void *)dev); ++ } ++ ++ dev++; ++ ++ return 0; ++ ++out_card_register: ++out_bcm2835_new_ctl: ++out_bcm2835_new_spdif: ++out_bcm2835_new_pcm: ++out_bcm2835_create: ++ BUG_ON(!g_card); ++ if (snd_card_free(g_card)) ++ dev_err(&pdev->dev, "Failed to free Registered alsa card\n"); ++ g_card = NULL; ++out: ++ dev = SNDRV_CARDS; /* stop more avail_substreams from being probed */ ++ dev_err(&pdev->dev, "BCM2835 ALSA Probe failed !!\n"); ++ return err; ++} ++ ++static int snd_bcm2835_alsa_remove(struct platform_device *pdev) ++{ ++ uint32_t idx; ++ void *drv_data; ++ ++ drv_data = platform_get_drvdata(pdev); ++ ++ if (drv_data == (void *)g_card) { ++ /* This is the card device */ ++ snd_card_free((struct snd_card *)drv_data); ++ g_card = NULL; ++ g_chip = NULL; ++ } else { ++ idx = (uint32_t) drv_data; ++ if (g_card != NULL) { ++ BUG_ON(!g_chip); ++ /* We pass chip device numbers in audio ipc devices ++ * other than the one we registered our card with ++ */ ++ idx = (uint32_t) drv_data; ++ BUG_ON(!idx || idx > MAX_SUBSTREAMS); ++ g_chip->avail_substreams &= ~(1 << idx); ++ /* There should be atleast one substream registered ++ * after we are done here, as it wil be removed when ++ * the *remove* is called for the card device ++ */ ++ BUG_ON(!g_chip->avail_substreams); ++ } ++ } ++ ++ platform_set_drvdata(pdev, NULL); ++ ++ return 0; ++} ++ ++#ifdef CONFIG_PM ++static int snd_bcm2835_alsa_suspend(struct platform_device *pdev, ++ pm_message_t state) ++{ ++ return 0; ++} ++ ++static int snd_bcm2835_alsa_resume(struct platform_device *pdev) ++{ ++ return 0; ++} ++ ++#endif ++ ++static const struct of_device_id snd_bcm2835_of_match_table[] = { ++ { .compatible = "brcm,bcm2835-audio", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, snd_bcm2835_of_match_table); ++ ++static struct platform_driver bcm2835_alsa0_driver = { ++ .probe = snd_bcm2835_alsa_probe, ++ .remove = snd_bcm2835_alsa_remove, ++#ifdef CONFIG_PM ++ .suspend = snd_bcm2835_alsa_suspend, ++ .resume = snd_bcm2835_alsa_resume, ++#endif ++ .driver = { ++ .name = "bcm2835_AUD0", ++ .owner = THIS_MODULE, ++ .of_match_table = snd_bcm2835_of_match_table, ++ }, ++}; ++ ++static struct platform_driver bcm2835_alsa1_driver = { ++ .probe = snd_bcm2835_alsa_probe, ++ .remove = snd_bcm2835_alsa_remove, ++#ifdef CONFIG_PM ++ .suspend = snd_bcm2835_alsa_suspend, ++ .resume = snd_bcm2835_alsa_resume, ++#endif ++ .driver = { ++ .name = "bcm2835_AUD1", ++ .owner = THIS_MODULE, ++ }, ++}; ++ ++static struct platform_driver bcm2835_alsa2_driver = { ++ .probe = snd_bcm2835_alsa_probe, ++ .remove = snd_bcm2835_alsa_remove, ++#ifdef CONFIG_PM ++ .suspend = snd_bcm2835_alsa_suspend, ++ .resume = snd_bcm2835_alsa_resume, ++#endif ++ .driver = { ++ .name = "bcm2835_AUD2", ++ .owner = THIS_MODULE, ++ }, ++}; ++ ++static struct platform_driver bcm2835_alsa3_driver = { ++ .probe = snd_bcm2835_alsa_probe, ++ .remove = snd_bcm2835_alsa_remove, ++#ifdef CONFIG_PM ++ .suspend = snd_bcm2835_alsa_suspend, ++ .resume = snd_bcm2835_alsa_resume, ++#endif ++ .driver = { ++ .name = "bcm2835_AUD3", ++ .owner = THIS_MODULE, ++ }, ++}; ++ ++static struct platform_driver bcm2835_alsa4_driver = { ++ .probe = snd_bcm2835_alsa_probe, ++ .remove = snd_bcm2835_alsa_remove, ++#ifdef CONFIG_PM ++ .suspend = snd_bcm2835_alsa_suspend, ++ .resume = snd_bcm2835_alsa_resume, ++#endif ++ .driver = { ++ .name = "bcm2835_AUD4", ++ .owner = THIS_MODULE, ++ }, ++}; ++ ++static struct platform_driver bcm2835_alsa5_driver = { ++ .probe = snd_bcm2835_alsa_probe, ++ .remove = snd_bcm2835_alsa_remove, ++#ifdef CONFIG_PM ++ .suspend = snd_bcm2835_alsa_suspend, ++ .resume = snd_bcm2835_alsa_resume, ++#endif ++ .driver = { ++ .name = "bcm2835_AUD5", ++ .owner = THIS_MODULE, ++ }, ++}; ++ ++static struct platform_driver bcm2835_alsa6_driver = { ++ .probe = snd_bcm2835_alsa_probe, ++ .remove = snd_bcm2835_alsa_remove, ++#ifdef CONFIG_PM ++ .suspend = snd_bcm2835_alsa_suspend, ++ .resume = snd_bcm2835_alsa_resume, ++#endif ++ .driver = { ++ .name = "bcm2835_AUD6", ++ .owner = THIS_MODULE, ++ }, ++}; ++ ++static struct platform_driver bcm2835_alsa7_driver = { ++ .probe = snd_bcm2835_alsa_probe, ++ .remove = snd_bcm2835_alsa_remove, ++#ifdef CONFIG_PM ++ .suspend = snd_bcm2835_alsa_suspend, ++ .resume = snd_bcm2835_alsa_resume, ++#endif ++ .driver = { ++ .name = "bcm2835_AUD7", ++ .owner = THIS_MODULE, ++ }, ++}; ++ ++static int bcm2835_alsa_device_init(void) ++{ ++ int err; ++ err = platform_driver_register(&bcm2835_alsa0_driver); ++ if (err) { ++ pr_err("Error registering bcm2835_alsa0_driver %d .\n", err); ++ goto out; ++ } ++ ++ err = platform_driver_register(&bcm2835_alsa1_driver); ++ if (err) { ++ pr_err("Error registering bcm2835_alsa0_driver %d .\n", err); ++ goto unregister_0; ++ } ++ ++ err = platform_driver_register(&bcm2835_alsa2_driver); ++ if (err) { ++ pr_err("Error registering bcm2835_alsa0_driver %d .\n", err); ++ goto unregister_1; ++ } ++ ++ err = platform_driver_register(&bcm2835_alsa3_driver); ++ if (err) { ++ pr_err("Error registering bcm2835_alsa0_driver %d .\n", err); ++ goto unregister_2; ++ } ++ ++ err = platform_driver_register(&bcm2835_alsa4_driver); ++ if (err) { ++ pr_err("Error registering bcm2835_alsa0_driver %d .\n", err); ++ goto unregister_3; ++ } ++ ++ err = platform_driver_register(&bcm2835_alsa5_driver); ++ if (err) { ++ pr_err("Error registering bcm2835_alsa0_driver %d .\n", err); ++ goto unregister_4; ++ } ++ ++ err = platform_driver_register(&bcm2835_alsa6_driver); ++ if (err) { ++ pr_err("Error registering bcm2835_alsa0_driver %d .\n", err); ++ goto unregister_5; ++ } ++ ++ err = platform_driver_register(&bcm2835_alsa7_driver); ++ if (err) { ++ pr_err("Error registering bcm2835_alsa0_driver %d .\n", err); ++ goto unregister_6; ++ } ++ ++ return 0; ++ ++unregister_6: ++ platform_driver_unregister(&bcm2835_alsa6_driver); ++unregister_5: ++ platform_driver_unregister(&bcm2835_alsa5_driver); ++unregister_4: ++ platform_driver_unregister(&bcm2835_alsa4_driver); ++unregister_3: ++ platform_driver_unregister(&bcm2835_alsa3_driver); ++unregister_2: ++ platform_driver_unregister(&bcm2835_alsa2_driver); ++unregister_1: ++ platform_driver_unregister(&bcm2835_alsa1_driver); ++unregister_0: ++ platform_driver_unregister(&bcm2835_alsa0_driver); ++out: ++ return err; ++} ++ ++static void bcm2835_alsa_device_exit(void) ++{ ++ platform_driver_unregister(&bcm2835_alsa0_driver); ++ platform_driver_unregister(&bcm2835_alsa1_driver); ++ platform_driver_unregister(&bcm2835_alsa2_driver); ++ platform_driver_unregister(&bcm2835_alsa3_driver); ++ platform_driver_unregister(&bcm2835_alsa4_driver); ++ platform_driver_unregister(&bcm2835_alsa5_driver); ++ platform_driver_unregister(&bcm2835_alsa6_driver); ++ platform_driver_unregister(&bcm2835_alsa7_driver); ++} ++ ++late_initcall(bcm2835_alsa_device_init); ++module_exit(bcm2835_alsa_device_exit); ++ ++MODULE_AUTHOR("Dom Cobley"); ++MODULE_DESCRIPTION("Alsa driver for BCM2835 chip"); ++MODULE_LICENSE("GPL"); ++MODULE_ALIAS("platform:bcm2835_alsa"); +diff --git a/sound/arm/bcm2835.h b/sound/arm/bcm2835.h +new file mode 100755 +index 0000000..0f71c5d +--- /dev/null ++++ b/sound/arm/bcm2835.h +@@ -0,0 +1,167 @@ ++/***************************************************************************** ++* Copyright 2011 Broadcom Corporation. All rights reserved. ++* ++* Unless you and Broadcom execute a separate written software license ++* agreement governing use of this software, this software is licensed to you ++* under the terms of the GNU General Public License version 2, available at ++* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). ++* ++* Notwithstanding the above, under no circumstances may you combine this ++* software in any way with any other Broadcom software provided under a ++* license other than the GPL, without Broadcom's express prior written ++* consent. ++*****************************************************************************/ ++ ++#ifndef __SOUND_ARM_BCM2835_H ++#define __SOUND_ARM_BCM2835_H ++ ++#include <linux/device.h> ++#include <linux/list.h> ++#include <linux/interrupt.h> ++#include <linux/wait.h> ++#include <sound/core.h> ++#include <sound/initval.h> ++#include <sound/pcm.h> ++#include <sound/pcm_params.h> ++#include <sound/pcm-indirect.h> ++#include <linux/workqueue.h> ++ ++/* ++#define AUDIO_DEBUG_ENABLE ++#define AUDIO_VERBOSE_DEBUG_ENABLE ++*/ ++ ++/* Debug macros */ ++ ++#ifdef AUDIO_DEBUG_ENABLE ++#ifdef AUDIO_VERBOSE_DEBUG_ENABLE ++ ++#define audio_debug(fmt, arg...) \ ++ printk(KERN_INFO"%s:%d " fmt, __func__, __LINE__, ##arg) ++ ++#define audio_info(fmt, arg...) \ ++ printk(KERN_INFO"%s:%d " fmt, __func__, __LINE__, ##arg) ++ ++#else ++ ++#define audio_debug(fmt, arg...) ++ ++#define audio_info(fmt, arg...) ++ ++#endif /* AUDIO_VERBOSE_DEBUG_ENABLE */ ++ ++#else ++ ++#define audio_debug(fmt, arg...) ++ ++#define audio_info(fmt, arg...) ++ ++#endif /* AUDIO_DEBUG_ENABLE */ ++ ++#define audio_error(fmt, arg...) \ ++ printk(KERN_ERR"%s:%d " fmt, __func__, __LINE__, ##arg) ++ ++#define audio_warning(fmt, arg...) \ ++ printk(KERN_WARNING"%s:%d " fmt, __func__, __LINE__, ##arg) ++ ++#define audio_alert(fmt, arg...) \ ++ printk(KERN_ALERT"%s:%d " fmt, __func__, __LINE__, ##arg) ++ ++#define MAX_SUBSTREAMS (8) ++#define AVAIL_SUBSTREAMS_MASK (0xff) ++enum { ++ CTRL_VOL_MUTE, ++ CTRL_VOL_UNMUTE ++}; ++ ++/* macros for alsa2chip and chip2alsa, instead of functions */ ++ ++#define alsa2chip(vol) (uint)(-((vol << 8) / 100)) /* convert alsa to chip volume (defined as macro rather than function call) */ ++#define chip2alsa(vol) -((vol * 100) >> 8) /* convert chip to alsa volume */ ++ ++/* Some constants for values .. */ ++typedef enum { ++ AUDIO_DEST_AUTO = 0, ++ AUDIO_DEST_HEADPHONES = 1, ++ AUDIO_DEST_HDMI = 2, ++ AUDIO_DEST_MAX, ++} SND_BCM2835_ROUTE_T; ++ ++typedef enum { ++ PCM_PLAYBACK_VOLUME, ++ PCM_PLAYBACK_MUTE, ++ PCM_PLAYBACK_DEVICE, ++} SND_BCM2835_CTRL_T; ++ ++/* definition of the chip-specific record */ ++typedef struct bcm2835_chip { ++ struct snd_card *card; ++ struct snd_pcm *pcm; ++ struct snd_pcm *pcm_spdif; ++ /* Bitmat for valid reg_base and irq numbers */ ++ uint32_t avail_substreams; ++ struct platform_device *pdev[MAX_SUBSTREAMS]; ++ struct bcm2835_alsa_stream *alsa_stream[MAX_SUBSTREAMS]; ++ ++ int volume; ++ int old_volume; /* stores the volume value whist muted */ ++ int dest; ++ int mute; ++ ++ unsigned int opened; ++ unsigned int spdif_status; ++ struct mutex audio_mutex; ++} bcm2835_chip_t; ++ ++typedef struct bcm2835_alsa_stream { ++ bcm2835_chip_t *chip; ++ struct snd_pcm_substream *substream; ++ struct snd_pcm_indirect pcm_indirect; ++ ++ struct semaphore buffers_update_sem; ++ struct semaphore control_sem; ++ spinlock_t lock; ++ volatile uint32_t control; ++ volatile uint32_t status; ++ ++ int open; ++ int running; ++ int draining; ++ ++ int channels; ++ int params_rate; ++ int pcm_format_width; ++ ++ unsigned int pos; ++ unsigned int buffer_size; ++ unsigned int period_size; ++ ++ uint32_t enable_fifo_irq; ++ irq_handler_t fifo_irq_handler; ++ ++ atomic_t retrieved; ++ struct opaque_AUDIO_INSTANCE_T *instance; ++ struct workqueue_struct *my_wq; ++ int idx; ++} bcm2835_alsa_stream_t; ++ ++int snd_bcm2835_new_ctl(bcm2835_chip_t * chip); ++int snd_bcm2835_new_pcm(bcm2835_chip_t * chip); ++int snd_bcm2835_new_spdif_pcm(bcm2835_chip_t * chip); ++ ++int bcm2835_audio_open(bcm2835_alsa_stream_t * alsa_stream); ++int bcm2835_audio_close(bcm2835_alsa_stream_t * alsa_stream); ++int bcm2835_audio_set_params(bcm2835_alsa_stream_t * alsa_stream, ++ uint32_t channels, uint32_t samplerate, ++ uint32_t bps); ++int bcm2835_audio_setup(bcm2835_alsa_stream_t * alsa_stream); ++int bcm2835_audio_start(bcm2835_alsa_stream_t * alsa_stream); ++int bcm2835_audio_stop(bcm2835_alsa_stream_t * alsa_stream); ++int bcm2835_audio_set_ctls(bcm2835_chip_t * chip); ++int bcm2835_audio_write(bcm2835_alsa_stream_t * alsa_stream, uint32_t count, ++ void *src); ++uint32_t bcm2835_audio_retrieve_buffers(bcm2835_alsa_stream_t * alsa_stream); ++void bcm2835_audio_flush_buffers(bcm2835_alsa_stream_t * alsa_stream); ++void bcm2835_audio_flush_playback_buffers(bcm2835_alsa_stream_t * alsa_stream); ++ ++#endif /* __SOUND_ARM_BCM2835_H */ +diff --git a/sound/arm/vc_vchi_audioserv_defs.h b/sound/arm/vc_vchi_audioserv_defs.h +new file mode 100644 +index 0000000..af3e6eb +--- /dev/null ++++ b/sound/arm/vc_vchi_audioserv_defs.h +@@ -0,0 +1,116 @@ ++/***************************************************************************** ++* Copyright 2011 Broadcom Corporation. All rights reserved. ++* ++* Unless you and Broadcom execute a separate written software license ++* agreement governing use of this software, this software is licensed to you ++* under the terms of the GNU General Public License version 2, available at ++* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). ++* ++* Notwithstanding the above, under no circumstances may you combine this ++* software in any way with any other Broadcom software provided under a ++* license other than the GPL, without Broadcom's express prior written ++* consent. ++*****************************************************************************/ ++ ++#ifndef _VC_AUDIO_DEFS_H_ ++#define _VC_AUDIO_DEFS_H_ ++ ++#define VC_AUDIOSERV_MIN_VER 1 ++#define VC_AUDIOSERV_VER 2 ++ ++// FourCC code used for VCHI connection ++#define VC_AUDIO_SERVER_NAME MAKE_FOURCC("AUDS") ++ ++// Maximum message length ++#define VC_AUDIO_MAX_MSG_LEN (sizeof( VC_AUDIO_MSG_T )) ++ ++// List of screens that are currently supported ++// All message types supported for HOST->VC direction ++typedef enum { ++ VC_AUDIO_MSG_TYPE_RESULT, // Generic result ++ VC_AUDIO_MSG_TYPE_COMPLETE, // Generic result ++ VC_AUDIO_MSG_TYPE_CONFIG, // Configure audio ++ VC_AUDIO_MSG_TYPE_CONTROL, // Configure audio ++ VC_AUDIO_MSG_TYPE_OPEN, // Configure audio ++ VC_AUDIO_MSG_TYPE_CLOSE, // Configure audio ++ VC_AUDIO_MSG_TYPE_START, // Configure audio ++ VC_AUDIO_MSG_TYPE_STOP, // Configure audio ++ VC_AUDIO_MSG_TYPE_WRITE, // Configure audio ++ VC_AUDIO_MSG_TYPE_MAX ++} VC_AUDIO_MSG_TYPE; ++ ++// configure the audio ++typedef struct { ++ uint32_t channels; ++ uint32_t samplerate; ++ uint32_t bps; ++ ++} VC_AUDIO_CONFIG_T; ++ ++typedef struct { ++ uint32_t volume; ++ uint32_t dest; ++ ++} VC_AUDIO_CONTROL_T; ++ ++// audio ++typedef struct { ++ uint32_t dummy; ++ ++} VC_AUDIO_OPEN_T; ++ ++// audio ++typedef struct { ++ uint32_t dummy; ++ ++} VC_AUDIO_CLOSE_T; ++// audio ++typedef struct { ++ uint32_t dummy; ++ ++} VC_AUDIO_START_T; ++// audio ++typedef struct { ++ uint32_t draining; ++ ++} VC_AUDIO_STOP_T; ++ ++// configure the write audio samples ++typedef struct { ++ uint32_t count; // in bytes ++ void *callback; ++ void *cookie; ++ uint16_t silence; ++ uint16_t max_packet; ++} VC_AUDIO_WRITE_T; ++ ++// Generic result for a request (VC->HOST) ++typedef struct { ++ int32_t success; // Success value ++ ++} VC_AUDIO_RESULT_T; ++ ++// Generic result for a request (VC->HOST) ++typedef struct { ++ int32_t count; // Success value ++ void *callback; ++ void *cookie; ++} VC_AUDIO_COMPLETE_T; ++ ++// Message header for all messages in HOST->VC direction ++typedef struct { ++ int32_t type; // Message type (VC_AUDIO_MSG_TYPE) ++ union { ++ VC_AUDIO_CONFIG_T config; ++ VC_AUDIO_CONTROL_T control; ++ VC_AUDIO_OPEN_T open; ++ VC_AUDIO_CLOSE_T close; ++ VC_AUDIO_START_T start; ++ VC_AUDIO_STOP_T stop; ++ VC_AUDIO_WRITE_T write; ++ VC_AUDIO_RESULT_T result; ++ VC_AUDIO_COMPLETE_T complete; ++ } u; ++} VC_AUDIO_MSG_T; ++ ++#endif // _VC_AUDIO_DEFS_H_ + +From cd1caba5928a0a0e6c8901da2151c83428f03b4f Mon Sep 17 00:00:00 2001 +From: popcornmix <popcornmix@gmail.com> +Date: Tue, 2 Jul 2013 23:42:01 +0100 +Subject: [PATCH 041/112] bcm2708 vchiq driver +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: popcornmix <popcornmix@gmail.com> + +vchiq: create_pagelist copes with vmalloc memory + +Signed-off-by: Daniel Stone <daniels@collabora.com> + +vchiq: fix the shim message release + +Signed-off-by: Daniel Stone <daniels@collabora.com> + +vchiq: export additional symbols + +Signed-off-by: Daniel Stone <daniels@collabora.com> + +VCHIQ: Make service closure fully synchronous (drv) + +This is one half of a two-part patch, the other half of which is to +the vchiq_lib user library. With these patches, calls to +vchiq_close_service and vchiq_remove_service won't return until any +associated callbacks have been delivered to the callback thread. + +VCHIQ: Add per-service tracing + +The new service option VCHIQ_SERVICE_OPTION_TRACE is a boolean that +toggles tracing for the specified service. + +This commit also introduces vchi_service_set_option and the associated +option VCHI_SERVICE_OPTION_TRACE. + +vchiq: Make the synchronous-CLOSE logic more tolerant + +vchiq: Move logging control into debugfs + +vchiq: Take care of a corner case tickled by VCSM + +Closing a connection that isn't fully open requires care, since one +side does not know the other side's port number. Code was present to +handle the case where a CLOSE is sent immediately after an OPEN, i.e. +before the OPENACK has been received, but this was incorrectly being +used when an OPEN from a client using port 0 was rejected. + +(In the observed failure, the host was attempting to use the VCSM +service, which isn't present in the 'cutdown' firmware. The failure +was intermittent because sometimes the keepalive service would +grab port 0.) + +This case can be distinguished because the client's remoteport will +still be VCHIQ_PORT_FREE, and the srvstate will be OPENING. Either +condition is sufficient to differentiate it from the special case +described above. + +vchiq: Avoid high load when blocked and unkillable + +vchiq: Include SIGSTOP and SIGCONT in list of signals not-masked by vchiq to allow gdb to work + +vchiq_arm: Complete support for SYNCHRONOUS mode + +vchiq: Remove inline from suspend/resume + +vchiq: Allocation does not need to be atomic + +vchiq: Fix wrong condition check + +The log level is checked from within the log call. Remove the check in the call. + +Signed-off-by: Pranith Kumar <bobby.prani@gmail.com> + +BCM270x: Add vchiq device to platform file and Device Tree + +Prepare to turn the vchiq module into a driver. + +Signed-off-by: Noralf Trønnes <noralf@tronnes.org> + +bcm2708: vchiq: Add Device Tree support + +Turn vchiq into a driver and stop hardcoding resources. +Use devm_* functions in probe path to simplify cleanup. +A global variable is used to hold the register address. This is done +to keep this patch as small as possible. +Also make available on ARCH_BCM2835. +Based on work by Lubomir Rintel. + +Signed-off-by: Noralf Trønnes <noralf@tronnes.org> + +vchiq: Change logging level for inbound data + +vchiq_arm: Two cacheing fixes + +1) Make fragment size vary with cache line size +Without this patch, non-cache-line-aligned transfers may corrupt +(or be corrupted by) adjacent data structures. + +Both ARM and VC need to be updated to enable this feature. This is +ensured by having the loader apply a new DT parameter - +cache-line-size. The existence of this parameter guarantees that the +kernel is capable, and the parameter will only be modified from the +safe default if the loader is capable. + +2) Flush/invalidate vmalloc'd memory, and invalidate after reads + +vchiq: fix NULL pointer dereference when closing driver + +The following code run as root will cause a null pointer dereference oops: + + int fd = open("/dev/vc-cma", O_RDONLY); + if (fd < 0) + err(1, "open failed"); + (void)close(fd); + +[ 1704.877721] Unable to handle kernel NULL pointer dereference at virtual address 00000000 +[ 1704.877725] pgd = b899c000 +[ 1704.877736] [00000000] *pgd=37fab831, *pte=00000000, *ppte=00000000 +[ 1704.877748] Internal error: Oops: 817 [#1] PREEMPT SMP ARM +[ 1704.877765] Modules linked in: evdev i2c_bcm2708 uio_pdrv_genirq uio +[ 1704.877774] CPU: 2 PID: 3656 Comm: stress-ng-fstat Not tainted 3.19.1-12-generic-bcm2709 #12-Ubuntu +[ 1704.877777] Hardware name: BCM2709 +[ 1704.877783] task: b8ab9b00 ti: b7e68000 task.ti: b7e68000 +[ 1704.877798] PC is at __down_interruptible+0x50/0xec +[ 1704.877806] LR is at down_interruptible+0x5c/0x68 +[ 1704.877813] pc : [<80630ee8>] lr : [<800704b0>] psr: 60080093 +sp : b7e69e50 ip : b7e69e88 fp : b7e69e84 +[ 1704.877817] r10: b88123c8 r9 : 00000010 r8 : 00000001 +[ 1704.877822] r7 : b8ab9b00 r6 : 7fffffff r5 : 80a1cc34 r4 : 80a1cc34 +[ 1704.877826] r3 : b7e69e50 r2 : 00000000 r1 : 00000000 r0 : 80a1cc34 +[ 1704.877833] Flags: nZCv IRQs off FIQs on Mode SVC_32 ISA ARM Segment user +[ 1704.877838] Control: 10c5387d Table: 3899c06a DAC: 00000015 +[ 1704.877843] Process do-oops (pid: 3656, stack limit = 0xb7e68238) +[ 1704.877848] Stack: (0xb7e69e50 to 0xb7e6a000) +[ 1704.877856] 9e40: 80a1cc3c 00000000 00000010 b88123c8 +[ 1704.877865] 9e60: b7e69e84 80a1cc34 fff9fee9 ffffffff b7e68000 00000009 b7e69ea4 b7e69e88 +[ 1704.877874] 9e80: 800704b0 80630ea4 fff9fee9 60080013 80a1cc28 fff9fee9 b7e69edc b7e69ea8 +[ 1704.877884] 9ea0: 8040f558 80070460 fff9fee9 ffffffff 00000000 00000000 00000009 80a1cb7c +[ 1704.877893] 9ec0: 00000000 80a1cb7c 00000000 00000010 b7e69ef4 b7e69ee0 803e1ba4 8040f514 +[ 1704.877902] 9ee0: 00000e48 80a1cb7c b7e69f14 b7e69ef8 803e1c9c 803e1b74 b88123c0 b92acb18 +[ 1704.877911] 9f00: b8812790 b8d815d8 b7e69f24 b7e69f18 803e2250 803e1bc8 b7e69f5c b7e69f28 +[ 1704.877921] 9f20: 80167bac 803e222c 00000000 00000000 b7e69f54 b8ab9ffc 00000000 8098c794 +[ 1704.877930] 9f40: b8ab9b00 8000efc4 b7e68000 00000000 b7e69f6c b7e69f60 80167d6c 80167b28 +[ 1704.877939] 9f60: b7e69f8c b7e69f70 80047d38 80167d60 b7e68000 b7e68010 8000efc4 b7e69fb0 +[ 1704.877949] 9f80: b7e69fac b7e69f90 80012820 80047c84 01155490 011549a8 00000001 00000006 +[ 1704.877957] 9fa0: 00000000 b7e69fb0 8000ee5c 80012790 00000000 353d8c0f 7efc4308 00000000 +[ 1704.877966] 9fc0: 01155490 011549a8 00000001 00000006 00000000 00000000 76cf3ba0 00000003 +[ 1704.877975] 9fe0: 00000000 7efc42e4 0002272f 76e2ed66 60080030 00000003 00000000 00000000 +[ 1704.877998] [<80630ee8>] (__down_interruptible) from [<800704b0>] (down_interruptible+0x5c/0x68) +[ 1704.878015] [<800704b0>] (down_interruptible) from [<8040f558>] (vchiu_queue_push+0x50/0xd8) +[ 1704.878032] [<8040f558>] (vchiu_queue_push) from [<803e1ba4>] (send_worker_msg+0x3c/0x54) +[ 1704.878045] [<803e1ba4>] (send_worker_msg) from [<803e1c9c>] (vc_cma_set_reserve+0xe0/0x1c4) +[ 1704.878057] [<803e1c9c>] (vc_cma_set_reserve) from [<803e2250>] (vc_cma_release+0x30/0x38) +[ 1704.878069] [<803e2250>] (vc_cma_release) from [<80167bac>] (__fput+0x90/0x1e0) +[ 1704.878082] [<80167bac>] (__fput) from [<80167d6c>] (____fput+0x18/0x1c) +[ 1704.878094] [<80167d6c>] (____fput) from [<80047d38>] (task_work_run+0xc0/0xf8) +[ 1704.878109] [<80047d38>] (task_work_run) from [<80012820>] (do_work_pending+0x9c/0xc4) +[ 1704.878123] [<80012820>] (do_work_pending) from [<8000ee5c>] (work_pending+0xc/0x20) +[ 1704.878133] Code: e50b1034 e3a01000 e50b2030 e580300c (e5823000) + +..the fix is to ensure that we have actually initialized the queue before we attempt +to push any items onto it. This occurs if we do an open() followed by a close() without +any activity in between. + +Signed-off-by: Colin Ian King <colin.king@canonical.com> + +vchiq_arm: Sort out the vmalloc case + +See: https://github.com/raspberrypi/linux/issues/1055 + +vchiq: hack: Add include depecated dma include file + +vchiq_arm: Tweak the logging output + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> + +vchiq_arm: Access the dequeue_pending flag locked + +Reading through this code looking for another problem (now found in userland) +the use of dequeue_pending outside a lock didn't seem safe. + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> + +vchiq_arm: Service callbacks must not fail + +Service callbacks are not allowed to return an error. The internal callback +that delivers events and messages to user tasks does not enqueue them if +the service is closing, but this is not an error and should not be +reported as such. + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> + +vchiq_arm: do not use page_cache_release(page) macro (#1403) + +This macro is gone since 1fa64f198b9f8d6ec0f7aec7c18dc94684391140. + +Signed-off-by: Slawomir Stepien <sst@poczta.fm> + +vchiq: Upate to match get_user_pages prototype + +vchiq_arm: Add completion records under the mutex + +An issue was observed when flushing openmax components +which generate a large number of messages returning +buffers to host. + +We occasionally found a duplicate message from 16 +messages prior, resulting in a buffer returned twice. + +While only one thread adds completions, without the +mutex you don't get the protection of the automatic +memory barrier you get with synchronisation objects. + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> +--- + arch/arm/mach-bcm2708/include/mach/platform.h | 2 + + arch/arm/mach-bcm2709/include/mach/platform.h | 2 + + drivers/misc/Kconfig | 1 + + drivers/misc/Makefile | 1 + + drivers/misc/vc04_services/Kconfig | 9 + + drivers/misc/vc04_services/Makefile | 14 + + .../interface/vchi/connections/connection.h | 328 ++ + .../interface/vchi/message_drivers/message.h | 204 + + drivers/misc/vc04_services/interface/vchi/vchi.h | 378 ++ + .../misc/vc04_services/interface/vchi/vchi_cfg.h | 224 ++ + .../interface/vchi/vchi_cfg_internal.h | 71 + + .../vc04_services/interface/vchi/vchi_common.h | 175 + + .../misc/vc04_services/interface/vchi/vchi_mh.h | 42 + + .../misc/vc04_services/interface/vchiq_arm/vchiq.h | 40 + + .../vc04_services/interface/vchiq_arm/vchiq_2835.h | 42 + + .../interface/vchiq_arm/vchiq_2835_arm.c | 586 +++ + .../vc04_services/interface/vchiq_arm/vchiq_arm.c | 2920 +++++++++++++++ + .../vc04_services/interface/vchiq_arm/vchiq_arm.h | 220 ++ + .../interface/vchiq_arm/vchiq_build_info.h | 37 + + .../vc04_services/interface/vchiq_arm/vchiq_cfg.h | 69 + + .../interface/vchiq_arm/vchiq_connected.c | 120 + + .../interface/vchiq_arm/vchiq_connected.h | 50 + + .../vc04_services/interface/vchiq_arm/vchiq_core.c | 3929 ++++++++++++++++++++ + .../vc04_services/interface/vchiq_arm/vchiq_core.h | 712 ++++ + .../interface/vchiq_arm/vchiq_debugfs.c | 383 ++ + .../interface/vchiq_arm/vchiq_debugfs.h | 52 + + .../interface/vchiq_arm/vchiq_genversion | 87 + + .../vc04_services/interface/vchiq_arm/vchiq_if.h | 189 + + .../interface/vchiq_arm/vchiq_ioctl.h | 131 + + .../interface/vchiq_arm/vchiq_kern_lib.c | 458 +++ + .../interface/vchiq_arm/vchiq_killable.h | 69 + + .../interface/vchiq_arm/vchiq_memdrv.h | 71 + + .../interface/vchiq_arm/vchiq_pagelist.h | 58 + + .../vc04_services/interface/vchiq_arm/vchiq_shim.c | 860 +++++ + .../vc04_services/interface/vchiq_arm/vchiq_util.c | 156 + + .../vc04_services/interface/vchiq_arm/vchiq_util.h | 82 + + .../interface/vchiq_arm/vchiq_version.c | 59 + + 37 files changed, 12831 insertions(+) + create mode 100644 drivers/misc/vc04_services/Kconfig + create mode 100644 drivers/misc/vc04_services/Makefile + create mode 100644 drivers/misc/vc04_services/interface/vchi/connections/connection.h + create mode 100644 drivers/misc/vc04_services/interface/vchi/message_drivers/message.h + create mode 100644 drivers/misc/vc04_services/interface/vchi/vchi.h + create mode 100644 drivers/misc/vc04_services/interface/vchi/vchi_cfg.h + create mode 100644 drivers/misc/vc04_services/interface/vchi/vchi_cfg_internal.h + create mode 100644 drivers/misc/vc04_services/interface/vchi/vchi_common.h + create mode 100644 drivers/misc/vc04_services/interface/vchi/vchi_mh.h + create mode 100644 drivers/misc/vc04_services/interface/vchiq_arm/vchiq.h + create mode 100644 drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835.h + create mode 100644 drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c + create mode 100644 drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm.c + create mode 100644 drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm.h + create mode 100644 drivers/misc/vc04_services/interface/vchiq_arm/vchiq_build_info.h + create mode 100644 drivers/misc/vc04_services/interface/vchiq_arm/vchiq_cfg.h + create mode 100644 drivers/misc/vc04_services/interface/vchiq_arm/vchiq_connected.c + create mode 100644 drivers/misc/vc04_services/interface/vchiq_arm/vchiq_connected.h + create mode 100644 drivers/misc/vc04_services/interface/vchiq_arm/vchiq_core.c + create mode 100644 drivers/misc/vc04_services/interface/vchiq_arm/vchiq_core.h + create mode 100644 drivers/misc/vc04_services/interface/vchiq_arm/vchiq_debugfs.c + create mode 100644 drivers/misc/vc04_services/interface/vchiq_arm/vchiq_debugfs.h + create mode 100644 drivers/misc/vc04_services/interface/vchiq_arm/vchiq_genversion + create mode 100644 drivers/misc/vc04_services/interface/vchiq_arm/vchiq_if.h + create mode 100644 drivers/misc/vc04_services/interface/vchiq_arm/vchiq_ioctl.h + create mode 100644 drivers/misc/vc04_services/interface/vchiq_arm/vchiq_kern_lib.c + create mode 100644 drivers/misc/vc04_services/interface/vchiq_arm/vchiq_killable.h + create mode 100644 drivers/misc/vc04_services/interface/vchiq_arm/vchiq_memdrv.h + create mode 100644 drivers/misc/vc04_services/interface/vchiq_arm/vchiq_pagelist.h + create mode 100644 drivers/misc/vc04_services/interface/vchiq_arm/vchiq_shim.c + create mode 100644 drivers/misc/vc04_services/interface/vchiq_arm/vchiq_util.c + create mode 100644 drivers/misc/vc04_services/interface/vchiq_arm/vchiq_util.h + create mode 100644 drivers/misc/vc04_services/interface/vchiq_arm/vchiq_version.c + +diff --git a/arch/arm/mach-bcm2708/include/mach/platform.h b/arch/arm/mach-bcm2708/include/mach/platform.h +index 4fb43cf..e98ec5a 100644 +--- a/arch/arm/mach-bcm2708/include/mach/platform.h ++++ b/arch/arm/mach-bcm2708/include/mach/platform.h +@@ -78,6 +78,8 @@ + #define ARMCTRL_IC_BASE (ARM_BASE + 0x200) /* ARM interrupt controller */ + #define ARMCTRL_TIMER0_1_BASE (ARM_BASE + 0x400) /* Timer 0 and 1 */ + #define ARMCTRL_0_SBM_BASE (ARM_BASE + 0x800) /* User 0 (ARM)'s Semaphores Doorbells and Mailboxes */ ++#define ARMCTRL_0_BELL_BASE (ARMCTRL_0_SBM_BASE + 0x40) /* User 0 (ARM)'s Doorbell */ ++#define ARMCTRL_0_MAIL0_BASE (ARMCTRL_0_SBM_BASE + 0x80) /* User 0 (ARM)'s Mailbox 0 */ + + /* + * Watchdog +diff --git a/arch/arm/mach-bcm2709/include/mach/platform.h b/arch/arm/mach-bcm2709/include/mach/platform.h +index 311b9f2..9a638f5 100644 +--- a/arch/arm/mach-bcm2709/include/mach/platform.h ++++ b/arch/arm/mach-bcm2709/include/mach/platform.h +@@ -78,6 +78,8 @@ + #define ARMCTRL_IC_BASE (ARM_BASE + 0x200) /* ARM interrupt controller */ + #define ARMCTRL_TIMER0_1_BASE (ARM_BASE + 0x400) /* Timer 0 and 1 */ + #define ARMCTRL_0_SBM_BASE (ARM_BASE + 0x800) /* User 0 (ARM)'s Semaphores Doorbells and Mailboxes */ ++#define ARMCTRL_0_BELL_BASE (ARMCTRL_0_SBM_BASE + 0x40) /* User 0 (ARM)'s Doorbell */ ++#define ARMCTRL_0_MAIL0_BASE (ARMCTRL_0_SBM_BASE + 0x80) /* User 0 (ARM)'s Mailbox 0 */ + + /* + * Watchdog +diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig +index a216b46..90af750 100644 +--- a/drivers/misc/Kconfig ++++ b/drivers/misc/Kconfig +@@ -812,6 +812,7 @@ source "drivers/misc/lis3lv02d/Kconfig" + source "drivers/misc/altera-stapl/Kconfig" + source "drivers/misc/mei/Kconfig" + source "drivers/misc/vmw_vmci/Kconfig" ++source "drivers/misc/vc04_services/Kconfig" + source "drivers/misc/mic/Kconfig" + source "drivers/misc/genwqe/Kconfig" + source "drivers/misc/echo/Kconfig" +diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile +index b2fb6dbf..1a58cf7 100644 +--- a/drivers/misc/Makefile ++++ b/drivers/misc/Makefile +@@ -51,6 +51,7 @@ obj-$(CONFIG_INTEL_MEI) += mei/ + obj-$(CONFIG_VMWARE_VMCI) += vmw_vmci/ + obj-$(CONFIG_LATTICE_ECP3_CONFIG) += lattice-ecp3-config.o + obj-$(CONFIG_SRAM) += sram.o ++obj-$(CONFIG_BCM2708_VCHIQ) += vc04_services/ + obj-y += mic/ + obj-$(CONFIG_GENWQE) += genwqe/ + obj-$(CONFIG_ECHO) += echo/ +diff --git a/drivers/misc/vc04_services/Kconfig b/drivers/misc/vc04_services/Kconfig +new file mode 100644 +index 0000000..db8e1be +--- /dev/null ++++ b/drivers/misc/vc04_services/Kconfig +@@ -0,0 +1,9 @@ ++config BCM2708_VCHIQ ++ tristate "Videocore VCHIQ" ++ depends on RASPBERRYPI_FIRMWARE ++ default y ++ help ++ Kernel to VideoCore communication interface for the ++ BCM2708 family of products. ++ Defaults to Y when the Broadcom Videocore services ++ are included in the build, N otherwise. +diff --git a/drivers/misc/vc04_services/Makefile b/drivers/misc/vc04_services/Makefile +new file mode 100644 +index 0000000..8d038fe +--- /dev/null ++++ b/drivers/misc/vc04_services/Makefile +@@ -0,0 +1,14 @@ ++obj-$(CONFIG_BCM2708_VCHIQ) += vchiq.o ++ ++vchiq-objs := \ ++ interface/vchiq_arm/vchiq_core.o \ ++ interface/vchiq_arm/vchiq_arm.o \ ++ interface/vchiq_arm/vchiq_kern_lib.o \ ++ interface/vchiq_arm/vchiq_2835_arm.o \ ++ interface/vchiq_arm/vchiq_debugfs.o \ ++ interface/vchiq_arm/vchiq_shim.o \ ++ interface/vchiq_arm/vchiq_util.o \ ++ interface/vchiq_arm/vchiq_connected.o \ ++ ++ccflags-y += -DVCOS_VERIFY_BKPTS=1 -Idrivers/misc/vc04_services -DUSE_VCHIQ_ARM -D__VCCOREVER__=0x04000000 ++ +diff --git a/drivers/misc/vc04_services/interface/vchi/connections/connection.h b/drivers/misc/vc04_services/interface/vchi/connections/connection.h +new file mode 100644 +index 0000000..fef6ac3 +--- /dev/null ++++ b/drivers/misc/vc04_services/interface/vchi/connections/connection.h +@@ -0,0 +1,328 @@ ++/** ++ * Copyright (c) 2010-2012 Broadcom. 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, ++ * without modification. ++ * 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. ++ * 3. The names of the above-listed copyright holders may not be used ++ * to endorse or promote products derived from this software without ++ * specific prior written permission. ++ * ++ * ALTERNATIVELY, this software may be distributed under the terms of the ++ * GNU General Public License ("GPL") version 2, as published by the Free ++ * Software Foundation. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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. ++ */ ++ ++#ifndef CONNECTION_H_ ++#define CONNECTION_H_ ++ ++#include <linux/kernel.h> ++#include <linux/types.h> ++#include <linux/semaphore.h> ++ ++#include "interface/vchi/vchi_cfg_internal.h" ++#include "interface/vchi/vchi_common.h" ++#include "interface/vchi/message_drivers/message.h" ++ ++/****************************************************************************** ++ Global defs ++ *****************************************************************************/ ++ ++// Opaque handle for a connection / service pair ++typedef struct opaque_vchi_connection_connected_service_handle_t *VCHI_CONNECTION_SERVICE_HANDLE_T; ++ ++// opaque handle to the connection state information ++typedef struct opaque_vchi_connection_info_t VCHI_CONNECTION_STATE_T; ++ ++typedef struct vchi_connection_t VCHI_CONNECTION_T; ++ ++ ++/****************************************************************************** ++ API ++ *****************************************************************************/ ++ ++// Routine to init a connection with a particular low level driver ++typedef VCHI_CONNECTION_STATE_T * (*VCHI_CONNECTION_INIT_T)( struct vchi_connection_t * connection, ++ const VCHI_MESSAGE_DRIVER_T * driver ); ++ ++// Routine to control CRC enabling at a connection level ++typedef int32_t (*VCHI_CONNECTION_CRC_CONTROL_T)( VCHI_CONNECTION_STATE_T *state_handle, ++ VCHI_CRC_CONTROL_T control ); ++ ++// Routine to create a service ++typedef int32_t (*VCHI_CONNECTION_SERVICE_CONNECT_T)( VCHI_CONNECTION_STATE_T *state_handle, ++ int32_t service_id, ++ uint32_t rx_fifo_size, ++ uint32_t tx_fifo_size, ++ int server, ++ VCHI_CALLBACK_T callback, ++ void *callback_param, ++ int32_t want_crc, ++ int32_t want_unaligned_bulk_rx, ++ int32_t want_unaligned_bulk_tx, ++ VCHI_CONNECTION_SERVICE_HANDLE_T *service_handle ); ++ ++// Routine to close a service ++typedef int32_t (*VCHI_CONNECTION_SERVICE_DISCONNECT_T)( VCHI_CONNECTION_SERVICE_HANDLE_T service_handle ); ++ ++// Routine to queue a message ++typedef int32_t (*VCHI_CONNECTION_SERVICE_QUEUE_MESSAGE_T)( VCHI_CONNECTION_SERVICE_HANDLE_T service_handle, ++ const void *data, ++ uint32_t data_size, ++ VCHI_FLAGS_T flags, ++ void *msg_handle ); ++ ++// scatter-gather (vector) message queueing ++typedef int32_t (*VCHI_CONNECTION_SERVICE_QUEUE_MESSAGEV_T)( VCHI_CONNECTION_SERVICE_HANDLE_T service_handle, ++ VCHI_MSG_VECTOR_T *vector, ++ uint32_t count, ++ VCHI_FLAGS_T flags, ++ void *msg_handle ); ++ ++// Routine to dequeue a message ++typedef int32_t (*VCHI_CONNECTION_SERVICE_DEQUEUE_MESSAGE_T)( VCHI_CONNECTION_SERVICE_HANDLE_T service_handle, ++ void *data, ++ uint32_t max_data_size_to_read, ++ uint32_t *actual_msg_size, ++ VCHI_FLAGS_T flags ); ++ ++// Routine to peek at a message ++typedef int32_t (*VCHI_CONNECTION_SERVICE_PEEK_MESSAGE_T)( VCHI_CONNECTION_SERVICE_HANDLE_T service_handle, ++ void **data, ++ uint32_t *msg_size, ++ VCHI_FLAGS_T flags ); ++ ++// Routine to hold a message ++typedef int32_t (*VCHI_CONNECTION_SERVICE_HOLD_MESSAGE_T)( VCHI_CONNECTION_SERVICE_HANDLE_T service_handle, ++ void **data, ++ uint32_t *msg_size, ++ VCHI_FLAGS_T flags, ++ void **message_handle ); ++ ++// Routine to initialise a received message iterator ++typedef int32_t (*VCHI_CONNECTION_SERVICE_LOOKAHEAD_MESSAGE_T)( VCHI_CONNECTION_SERVICE_HANDLE_T service_handle, ++ VCHI_MSG_ITER_T *iter, ++ VCHI_FLAGS_T flags ); ++ ++// Routine to release a held message ++typedef int32_t (*VCHI_CONNECTION_HELD_MSG_RELEASE_T)( VCHI_CONNECTION_SERVICE_HANDLE_T service_handle, ++ void *message_handle ); ++ ++// Routine to get info on a held message ++typedef int32_t (*VCHI_CONNECTION_HELD_MSG_INFO_T)( VCHI_CONNECTION_SERVICE_HANDLE_T service_handle, ++ void *message_handle, ++ void **data, ++ int32_t *msg_size, ++ uint32_t *tx_timestamp, ++ uint32_t *rx_timestamp ); ++ ++// Routine to check whether the iterator has a next message ++typedef int32_t (*VCHI_CONNECTION_MSG_ITER_HAS_NEXT_T)( VCHI_CONNECTION_SERVICE_HANDLE_T service, ++ const VCHI_MSG_ITER_T *iter ); ++ ++// Routine to advance the iterator ++typedef int32_t (*VCHI_CONNECTION_MSG_ITER_NEXT_T)( VCHI_CONNECTION_SERVICE_HANDLE_T service, ++ VCHI_MSG_ITER_T *iter, ++ void **data, ++ uint32_t *msg_size ); ++ ++// Routine to remove the last message returned by the iterator ++typedef int32_t (*VCHI_CONNECTION_MSG_ITER_REMOVE_T)( VCHI_CONNECTION_SERVICE_HANDLE_T service, ++ VCHI_MSG_ITER_T *iter ); ++ ++// Routine to hold the last message returned by the iterator ++typedef int32_t (*VCHI_CONNECTION_MSG_ITER_HOLD_T)( VCHI_CONNECTION_SERVICE_HANDLE_T service, ++ VCHI_MSG_ITER_T *iter, ++ void **msg_handle ); ++ ++// Routine to transmit bulk data ++typedef int32_t (*VCHI_CONNECTION_BULK_QUEUE_TRANSMIT_T)( VCHI_CONNECTION_SERVICE_HANDLE_T service_handle, ++ const void *data_src, ++ uint32_t data_size, ++ VCHI_FLAGS_T flags, ++ void *bulk_handle ); ++ ++// Routine to receive data ++typedef int32_t (*VCHI_CONNECTION_BULK_QUEUE_RECEIVE_T)( VCHI_CONNECTION_SERVICE_HANDLE_T service_handle, ++ void *data_dst, ++ uint32_t data_size, ++ VCHI_FLAGS_T flags, ++ void *bulk_handle ); ++ ++// Routine to report if a server is available ++typedef int32_t (*VCHI_CONNECTION_SERVER_PRESENT)( VCHI_CONNECTION_STATE_T *state, int32_t service_id, int32_t peer_flags ); ++ ++// Routine to report the number of RX slots available ++typedef int (*VCHI_CONNECTION_RX_SLOTS_AVAILABLE)( const VCHI_CONNECTION_STATE_T *state ); ++ ++// Routine to report the RX slot size ++typedef uint32_t (*VCHI_CONNECTION_RX_SLOT_SIZE)( const VCHI_CONNECTION_STATE_T *state ); ++ ++// Callback to indicate that the other side has added a buffer to the rx bulk DMA FIFO ++typedef void (*VCHI_CONNECTION_RX_BULK_BUFFER_ADDED)(VCHI_CONNECTION_STATE_T *state, ++ int32_t service, ++ uint32_t length, ++ MESSAGE_TX_CHANNEL_T channel, ++ uint32_t channel_params, ++ uint32_t data_length, ++ uint32_t data_offset); ++ ++// Callback to inform a service that a Xon or Xoff message has been received ++typedef void (*VCHI_CONNECTION_FLOW_CONTROL)(VCHI_CONNECTION_STATE_T *state, int32_t service_id, int32_t xoff); ++ ++// Callback to inform a service that a server available reply message has been received ++typedef void (*VCHI_CONNECTION_SERVER_AVAILABLE_REPLY)(VCHI_CONNECTION_STATE_T *state, int32_t service_id, uint32_t flags); ++ ++// Callback to indicate that bulk auxiliary messages have arrived ++typedef void (*VCHI_CONNECTION_BULK_AUX_RECEIVED)(VCHI_CONNECTION_STATE_T *state); ++ ++// Callback to indicate that bulk auxiliary messages have arrived ++typedef void (*VCHI_CONNECTION_BULK_AUX_TRANSMITTED)(VCHI_CONNECTION_STATE_T *state, void *handle); ++ ++// Callback with all the connection info you require ++typedef void (*VCHI_CONNECTION_INFO)(VCHI_CONNECTION_STATE_T *state, uint32_t protocol_version, uint32_t slot_size, uint32_t num_slots, uint32_t min_bulk_size); ++ ++// Callback to inform of a disconnect ++typedef void (*VCHI_CONNECTION_DISCONNECT)(VCHI_CONNECTION_STATE_T *state, uint32_t flags); ++ ++// Callback to inform of a power control request ++typedef void (*VCHI_CONNECTION_POWER_CONTROL)(VCHI_CONNECTION_STATE_T *state, MESSAGE_TX_CHANNEL_T channel, int32_t enable); ++ ++// allocate memory suitably aligned for this connection ++typedef void * (*VCHI_BUFFER_ALLOCATE)(VCHI_CONNECTION_SERVICE_HANDLE_T service_handle, uint32_t * length); ++ ++// free memory allocated by buffer_allocate ++typedef void (*VCHI_BUFFER_FREE)(VCHI_CONNECTION_SERVICE_HANDLE_T service_handle, void * address); ++ ++ ++/****************************************************************************** ++ System driver struct ++ *****************************************************************************/ ++ ++struct opaque_vchi_connection_api_t ++{ ++ // Routine to init the connection ++ VCHI_CONNECTION_INIT_T init; ++ ++ // Connection-level CRC control ++ VCHI_CONNECTION_CRC_CONTROL_T crc_control; ++ ++ // Routine to connect to or create service ++ VCHI_CONNECTION_SERVICE_CONNECT_T service_connect; ++ ++ // Routine to disconnect from a service ++ VCHI_CONNECTION_SERVICE_DISCONNECT_T service_disconnect; ++ ++ // Routine to queue a message ++ VCHI_CONNECTION_SERVICE_QUEUE_MESSAGE_T service_queue_msg; ++ ++ // scatter-gather (vector) message queue ++ VCHI_CONNECTION_SERVICE_QUEUE_MESSAGEV_T service_queue_msgv; ++ ++ // Routine to dequeue a message ++ VCHI_CONNECTION_SERVICE_DEQUEUE_MESSAGE_T service_dequeue_msg; ++ ++ // Routine to peek at a message ++ VCHI_CONNECTION_SERVICE_PEEK_MESSAGE_T service_peek_msg; ++ ++ // Routine to hold a message ++ VCHI_CONNECTION_SERVICE_HOLD_MESSAGE_T service_hold_msg; ++ ++ // Routine to initialise a received message iterator ++ VCHI_CONNECTION_SERVICE_LOOKAHEAD_MESSAGE_T service_look_ahead_msg; ++ ++ // Routine to release a message ++ VCHI_CONNECTION_HELD_MSG_RELEASE_T held_msg_release; ++ ++ // Routine to get information on a held message ++ VCHI_CONNECTION_HELD_MSG_INFO_T held_msg_info; ++ ++ // Routine to check for next message on iterator ++ VCHI_CONNECTION_MSG_ITER_HAS_NEXT_T msg_iter_has_next; ++ ++ // Routine to get next message on iterator ++ VCHI_CONNECTION_MSG_ITER_NEXT_T msg_iter_next; ++ ++ // Routine to remove the last message returned by iterator ++ VCHI_CONNECTION_MSG_ITER_REMOVE_T msg_iter_remove; ++ ++ // Routine to hold the last message returned by iterator ++ VCHI_CONNECTION_MSG_ITER_HOLD_T msg_iter_hold; ++ ++ // Routine to transmit bulk data ++ VCHI_CONNECTION_BULK_QUEUE_TRANSMIT_T bulk_queue_transmit; ++ ++ // Routine to receive data ++ VCHI_CONNECTION_BULK_QUEUE_RECEIVE_T bulk_queue_receive; ++ ++ // Routine to report the available servers ++ VCHI_CONNECTION_SERVER_PRESENT server_present; ++ ++ // Routine to report the number of RX slots available ++ VCHI_CONNECTION_RX_SLOTS_AVAILABLE connection_rx_slots_available; ++ ++ // Routine to report the RX slot size ++ VCHI_CONNECTION_RX_SLOT_SIZE connection_rx_slot_size; ++ ++ // Callback to indicate that the other side has added a buffer to the rx bulk DMA FIFO ++ VCHI_CONNECTION_RX_BULK_BUFFER_ADDED rx_bulk_buffer_added; ++ ++ // Callback to inform a service that a Xon or Xoff message has been received ++ VCHI_CONNECTION_FLOW_CONTROL flow_control; ++ ++ // Callback to inform a service that a server available reply message has been received ++ VCHI_CONNECTION_SERVER_AVAILABLE_REPLY server_available_reply; ++ ++ // Callback to indicate that bulk auxiliary messages have arrived ++ VCHI_CONNECTION_BULK_AUX_RECEIVED bulk_aux_received; ++ ++ // Callback to indicate that a bulk auxiliary message has been transmitted ++ VCHI_CONNECTION_BULK_AUX_TRANSMITTED bulk_aux_transmitted; ++ ++ // Callback to provide information about the connection ++ VCHI_CONNECTION_INFO connection_info; ++ ++ // Callback to notify that peer has requested disconnect ++ VCHI_CONNECTION_DISCONNECT disconnect; ++ ++ // Callback to notify that peer has requested power change ++ VCHI_CONNECTION_POWER_CONTROL power_control; ++ ++ // allocate memory suitably aligned for this connection ++ VCHI_BUFFER_ALLOCATE buffer_allocate; ++ ++ // free memory allocated by buffer_allocate ++ VCHI_BUFFER_FREE buffer_free; ++ ++}; ++ ++struct vchi_connection_t { ++ const VCHI_CONNECTION_API_T *api; ++ VCHI_CONNECTION_STATE_T *state; ++#ifdef VCHI_COARSE_LOCKING ++ struct semaphore sem; ++#endif ++}; ++ ++ ++#endif /* CONNECTION_H_ */ ++ ++/****************************** End of file **********************************/ +diff --git a/drivers/misc/vc04_services/interface/vchi/message_drivers/message.h b/drivers/misc/vc04_services/interface/vchi/message_drivers/message.h +new file mode 100644 +index 0000000..8b3f767 +--- /dev/null ++++ b/drivers/misc/vc04_services/interface/vchi/message_drivers/message.h +@@ -0,0 +1,204 @@ ++/** ++ * Copyright (c) 2010-2012 Broadcom. 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, ++ * without modification. ++ * 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. ++ * 3. The names of the above-listed copyright holders may not be used ++ * to endorse or promote products derived from this software without ++ * specific prior written permission. ++ * ++ * ALTERNATIVELY, this software may be distributed under the terms of the ++ * GNU General Public License ("GPL") version 2, as published by the Free ++ * Software Foundation. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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. ++ */ ++ ++#ifndef _VCHI_MESSAGE_H_ ++#define _VCHI_MESSAGE_H_ ++ ++#include <linux/kernel.h> ++#include <linux/types.h> ++#include <linux/semaphore.h> ++ ++#include "interface/vchi/vchi_cfg_internal.h" ++#include "interface/vchi/vchi_common.h" ++ ++ ++typedef enum message_event_type { ++ MESSAGE_EVENT_NONE, ++ MESSAGE_EVENT_NOP, ++ MESSAGE_EVENT_MESSAGE, ++ MESSAGE_EVENT_SLOT_COMPLETE, ++ MESSAGE_EVENT_RX_BULK_PAUSED, ++ MESSAGE_EVENT_RX_BULK_COMPLETE, ++ MESSAGE_EVENT_TX_COMPLETE, ++ MESSAGE_EVENT_MSG_DISCARDED ++} MESSAGE_EVENT_TYPE_T; ++ ++typedef enum vchi_msg_flags ++{ ++ VCHI_MSG_FLAGS_NONE = 0x0, ++ VCHI_MSG_FLAGS_TERMINATE_DMA = 0x1 ++} VCHI_MSG_FLAGS_T; ++ ++typedef enum message_tx_channel ++{ ++ MESSAGE_TX_CHANNEL_MESSAGE = 0, ++ MESSAGE_TX_CHANNEL_BULK = 1 // drivers may provide multiple bulk channels, from 1 upwards ++} MESSAGE_TX_CHANNEL_T; ++ ++// Macros used for cycling through bulk channels ++#define MESSAGE_TX_CHANNEL_BULK_PREV(c) (MESSAGE_TX_CHANNEL_BULK+((c)-MESSAGE_TX_CHANNEL_BULK+VCHI_MAX_BULK_TX_CHANNELS_PER_CONNECTION-1)%VCHI_MAX_BULK_TX_CHANNELS_PER_CONNECTION) ++#define MESSAGE_TX_CHANNEL_BULK_NEXT(c) (MESSAGE_TX_CHANNEL_BULK+((c)-MESSAGE_TX_CHANNEL_BULK+1)%VCHI_MAX_BULK_TX_CHANNELS_PER_CONNECTION) ++ ++typedef enum message_rx_channel ++{ ++ MESSAGE_RX_CHANNEL_MESSAGE = 0, ++ MESSAGE_RX_CHANNEL_BULK = 1 // drivers may provide multiple bulk channels, from 1 upwards ++} MESSAGE_RX_CHANNEL_T; ++ ++// Message receive slot information ++typedef struct rx_msg_slot_info { ++ ++ struct rx_msg_slot_info *next; ++ //struct slot_info *prev; ++#if !defined VCHI_COARSE_LOCKING ++ struct semaphore sem; ++#endif ++ ++ uint8_t *addr; // base address of slot ++ uint32_t len; // length of slot in bytes ++ ++ uint32_t write_ptr; // hardware causes this to advance ++ uint32_t read_ptr; // this module does the reading ++ int active; // is this slot in the hardware dma fifo? ++ uint32_t msgs_parsed; // count how many messages are in this slot ++ uint32_t msgs_released; // how many messages have been released ++ void *state; // connection state information ++ uint8_t ref_count[VCHI_MAX_SERVICES_PER_CONNECTION]; // reference count for slots held by services ++} RX_MSG_SLOTINFO_T; ++ ++// The message driver no longer needs to know about the fields of RX_BULK_SLOTINFO_T - sort this out. ++// In particular, it mustn't use addr and len - they're the client buffer, but the message ++// driver will be tasked with sending the aligned core section. ++typedef struct rx_bulk_slotinfo_t { ++ struct rx_bulk_slotinfo_t *next; ++ ++ struct semaphore *blocking; ++ ++ // needed by DMA ++ void *addr; ++ uint32_t len; ++ ++ // needed for the callback ++ void *service; ++ void *handle; ++ VCHI_FLAGS_T flags; ++} RX_BULK_SLOTINFO_T; ++ ++ ++/* ---------------------------------------------------------------------- ++ * each connection driver will have a pool of the following struct. ++ * ++ * the pool will be managed by vchi_qman_* ++ * this means there will be multiple queues (single linked lists) ++ * a given struct message_info will be on exactly one of these queues ++ * at any one time ++ * -------------------------------------------------------------------- */ ++typedef struct rx_message_info { ++ ++ struct message_info *next; ++ //struct message_info *prev; ++ ++ uint8_t *addr; ++ uint32_t len; ++ RX_MSG_SLOTINFO_T *slot; // points to whichever slot contains this message ++ uint32_t tx_timestamp; ++ uint32_t rx_timestamp; ++ ++} RX_MESSAGE_INFO_T; ++ ++typedef struct { ++ MESSAGE_EVENT_TYPE_T type; ++ ++ struct { ++ // for messages ++ void *addr; // address of message ++ uint16_t slot_delta; // whether this message indicated slot delta ++ uint32_t len; // length of message ++ RX_MSG_SLOTINFO_T *slot; // slot this message is in ++ int32_t service; // service id this message is destined for ++ uint32_t tx_timestamp; // timestamp from the header ++ uint32_t rx_timestamp; // timestamp when we parsed it ++ } message; ++ ++ // FIXME: cleanup slot reporting... ++ RX_MSG_SLOTINFO_T *rx_msg; ++ RX_BULK_SLOTINFO_T *rx_bulk; ++ void *tx_handle; ++ MESSAGE_TX_CHANNEL_T tx_channel; ++ ++} MESSAGE_EVENT_T; ++ ++ ++// callbacks ++typedef void VCHI_MESSAGE_DRIVER_EVENT_CALLBACK_T( void *state ); ++ ++typedef struct { ++ VCHI_MESSAGE_DRIVER_EVENT_CALLBACK_T *event_callback; ++} VCHI_MESSAGE_DRIVER_OPEN_T; ++ ++ ++// handle to this instance of message driver (as returned by ->open) ++typedef struct opaque_mhandle_t *VCHI_MDRIVER_HANDLE_T; ++ ++struct opaque_vchi_message_driver_t { ++ VCHI_MDRIVER_HANDLE_T *(*open)( VCHI_MESSAGE_DRIVER_OPEN_T *params, void *state ); ++ int32_t (*suspending)( VCHI_MDRIVER_HANDLE_T *handle ); ++ int32_t (*resumed)( VCHI_MDRIVER_HANDLE_T *handle ); ++ int32_t (*power_control)( VCHI_MDRIVER_HANDLE_T *handle, MESSAGE_TX_CHANNEL_T, int32_t enable ); ++ int32_t (*add_msg_rx_slot)( VCHI_MDRIVER_HANDLE_T *handle, RX_MSG_SLOTINFO_T *slot ); // rx message ++ int32_t (*add_bulk_rx)( VCHI_MDRIVER_HANDLE_T *handle, void *data, uint32_t len, RX_BULK_SLOTINFO_T *slot ); // rx data (bulk) ++ int32_t (*send)( VCHI_MDRIVER_HANDLE_T *handle, MESSAGE_TX_CHANNEL_T channel, const void *data, uint32_t len, VCHI_MSG_FLAGS_T flags, void *send_handle ); // tx (message & bulk) ++ void (*next_event)( VCHI_MDRIVER_HANDLE_T *handle, MESSAGE_EVENT_T *event ); // get the next event from message_driver ++ int32_t (*enable)( VCHI_MDRIVER_HANDLE_T *handle ); ++ int32_t (*form_message)( VCHI_MDRIVER_HANDLE_T *handle, int32_t service_id, VCHI_MSG_VECTOR_T *vector, uint32_t count, void ++ *address, uint32_t length_avail, uint32_t max_total_length, int32_t pad_to_fill, int32_t allow_partial ); ++ ++ int32_t (*update_message)( VCHI_MDRIVER_HANDLE_T *handle, void *dest, int16_t *slot_count ); ++ int32_t (*buffer_aligned)( VCHI_MDRIVER_HANDLE_T *handle, int tx, int uncached, const void *address, const uint32_t length ); ++ void * (*allocate_buffer)( VCHI_MDRIVER_HANDLE_T *handle, uint32_t *length ); ++ void (*free_buffer)( VCHI_MDRIVER_HANDLE_T *handle, void *address ); ++ int (*rx_slot_size)( VCHI_MDRIVER_HANDLE_T *handle, int msg_size ); ++ int (*tx_slot_size)( VCHI_MDRIVER_HANDLE_T *handle, int msg_size ); ++ ++ int32_t (*tx_supports_terminate)( const VCHI_MDRIVER_HANDLE_T *handle, MESSAGE_TX_CHANNEL_T channel ); ++ uint32_t (*tx_bulk_chunk_size)( const VCHI_MDRIVER_HANDLE_T *handle, MESSAGE_TX_CHANNEL_T channel ); ++ int (*tx_alignment)( const VCHI_MDRIVER_HANDLE_T *handle, MESSAGE_TX_CHANNEL_T channel ); ++ int (*rx_alignment)( const VCHI_MDRIVER_HANDLE_T *handle, MESSAGE_RX_CHANNEL_T channel ); ++ void (*form_bulk_aux)( VCHI_MDRIVER_HANDLE_T *handle, MESSAGE_TX_CHANNEL_T channel, const void *data, uint32_t len, uint32_t chunk_size, const void **aux_data, int32_t *aux_len ); ++ void (*debug)( VCHI_MDRIVER_HANDLE_T *handle ); ++}; ++ ++ ++#endif // _VCHI_MESSAGE_H_ ++ ++/****************************** End of file ***********************************/ +diff --git a/drivers/misc/vc04_services/interface/vchi/vchi.h b/drivers/misc/vc04_services/interface/vchi/vchi.h +new file mode 100644 +index 0000000..1b17e98 +--- /dev/null ++++ b/drivers/misc/vc04_services/interface/vchi/vchi.h +@@ -0,0 +1,378 @@ ++/** ++ * Copyright (c) 2010-2012 Broadcom. 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, ++ * without modification. ++ * 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. ++ * 3. The names of the above-listed copyright holders may not be used ++ * to endorse or promote products derived from this software without ++ * specific prior written permission. ++ * ++ * ALTERNATIVELY, this software may be distributed under the terms of the ++ * GNU General Public License ("GPL") version 2, as published by the Free ++ * Software Foundation. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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. ++ */ ++ ++#ifndef VCHI_H_ ++#define VCHI_H_ ++ ++#include "interface/vchi/vchi_cfg.h" ++#include "interface/vchi/vchi_common.h" ++#include "interface/vchi/connections/connection.h" ++#include "vchi_mh.h" ++ ++ ++/****************************************************************************** ++ Global defs ++ *****************************************************************************/ ++ ++#define VCHI_BULK_ROUND_UP(x) ((((unsigned long)(x))+VCHI_BULK_ALIGN-1) & ~(VCHI_BULK_ALIGN-1)) ++#define VCHI_BULK_ROUND_DOWN(x) (((unsigned long)(x)) & ~(VCHI_BULK_ALIGN-1)) ++#define VCHI_BULK_ALIGN_NBYTES(x) (VCHI_BULK_ALIGNED(x) ? 0 : (VCHI_BULK_ALIGN - ((unsigned long)(x) & (VCHI_BULK_ALIGN-1)))) ++ ++#ifdef USE_VCHIQ_ARM ++#define VCHI_BULK_ALIGNED(x) 1 ++#else ++#define VCHI_BULK_ALIGNED(x) (((unsigned long)(x) & (VCHI_BULK_ALIGN-1)) == 0) ++#endif ++ ++struct vchi_version { ++ uint32_t version; ++ uint32_t version_min; ++}; ++#define VCHI_VERSION(v_) { v_, v_ } ++#define VCHI_VERSION_EX(v_, m_) { v_, m_ } ++ ++typedef enum ++{ ++ VCHI_VEC_POINTER, ++ VCHI_VEC_HANDLE, ++ VCHI_VEC_LIST ++} VCHI_MSG_VECTOR_TYPE_T; ++ ++typedef struct vchi_msg_vector_ex { ++ ++ VCHI_MSG_VECTOR_TYPE_T type; ++ union ++ { ++ // a memory handle ++ struct ++ { ++ VCHI_MEM_HANDLE_T handle; ++ uint32_t offset; ++ int32_t vec_len; ++ } handle; ++ ++ // an ordinary data pointer ++ struct ++ { ++ const void *vec_base; ++ int32_t vec_len; ++ } ptr; ++ ++ // a nested vector list ++ struct ++ { ++ struct vchi_msg_vector_ex *vec; ++ uint32_t vec_len; ++ } list; ++ } u; ++} VCHI_MSG_VECTOR_EX_T; ++ ++ ++// Construct an entry in a msg vector for a pointer (p) of length (l) ++#define VCHI_VEC_POINTER(p,l) VCHI_VEC_POINTER, { { (VCHI_MEM_HANDLE_T)(p), (l) } } ++ ++// Construct an entry in a msg vector for a message handle (h), starting at offset (o) of length (l) ++#define VCHI_VEC_HANDLE(h,o,l) VCHI_VEC_HANDLE, { { (h), (o), (l) } } ++ ++// Macros to manipulate 'FOURCC' values ++#define MAKE_FOURCC(x) ((int32_t)( (x[0] << 24) | (x[1] << 16) | (x[2] << 8) | x[3] )) ++#define FOURCC_TO_CHAR(x) (x >> 24) & 0xFF,(x >> 16) & 0xFF,(x >> 8) & 0xFF, x & 0xFF ++ ++ ++// Opaque service information ++struct opaque_vchi_service_t; ++ ++// Descriptor for a held message. Allocated by client, initialised by vchi_msg_hold, ++// vchi_msg_iter_hold or vchi_msg_iter_hold_next. Fields are for internal VCHI use only. ++typedef struct ++{ ++ struct opaque_vchi_service_t *service; ++ void *message; ++} VCHI_HELD_MSG_T; ++ ++ ++ ++// structure used to provide the information needed to open a server or a client ++typedef struct { ++ struct vchi_version version; ++ int32_t service_id; ++ VCHI_CONNECTION_T *connection; ++ uint32_t rx_fifo_size; ++ uint32_t tx_fifo_size; ++ VCHI_CALLBACK_T callback; ++ void *callback_param; ++ /* client intends to receive bulk transfers of ++ odd lengths or into unaligned buffers */ ++ int32_t want_unaligned_bulk_rx; ++ /* client intends to transmit bulk transfers of ++ odd lengths or out of unaligned buffers */ ++ int32_t want_unaligned_bulk_tx; ++ /* client wants to check CRCs on (bulk) xfers. ++ Only needs to be set at 1 end - will do both directions. */ ++ int32_t want_crc; ++} SERVICE_CREATION_T; ++ ++// Opaque handle for a VCHI instance ++typedef struct opaque_vchi_instance_handle_t *VCHI_INSTANCE_T; ++ ++// Opaque handle for a server or client ++typedef struct opaque_vchi_service_handle_t *VCHI_SERVICE_HANDLE_T; ++ ++// Service registration & startup ++typedef void (*VCHI_SERVICE_INIT)(VCHI_INSTANCE_T initialise_instance, VCHI_CONNECTION_T **connections, uint32_t num_connections); ++ ++typedef struct service_info_tag { ++ const char * const vll_filename; /* VLL to load to start this service. This is an empty string if VLL is "static" */ ++ VCHI_SERVICE_INIT init; /* Service initialisation function */ ++ void *vll_handle; /* VLL handle; NULL when unloaded or a "static VLL" in build */ ++} SERVICE_INFO_T; ++ ++/****************************************************************************** ++ Global funcs - implementation is specific to which side you are on (local / remote) ++ *****************************************************************************/ ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++extern /*@observer@*/ VCHI_CONNECTION_T * vchi_create_connection( const VCHI_CONNECTION_API_T * function_table, ++ const VCHI_MESSAGE_DRIVER_T * low_level); ++ ++ ++// Routine used to initialise the vchi on both local + remote connections ++extern int32_t vchi_initialise( VCHI_INSTANCE_T *instance_handle ); ++ ++extern int32_t vchi_exit( void ); ++ ++extern int32_t vchi_connect( VCHI_CONNECTION_T **connections, ++ const uint32_t num_connections, ++ VCHI_INSTANCE_T instance_handle ); ++ ++//When this is called, ensure that all services have no data pending. ++//Bulk transfers can remain 'queued' ++extern int32_t vchi_disconnect( VCHI_INSTANCE_T instance_handle ); ++ ++// Global control over bulk CRC checking ++extern int32_t vchi_crc_control( VCHI_CONNECTION_T *connection, ++ VCHI_CRC_CONTROL_T control ); ++ ++// helper functions ++extern void * vchi_allocate_buffer(VCHI_SERVICE_HANDLE_T handle, uint32_t *length); ++extern void vchi_free_buffer(VCHI_SERVICE_HANDLE_T handle, void *address); ++extern uint32_t vchi_current_time(VCHI_INSTANCE_T instance_handle); ++ ++ ++/****************************************************************************** ++ Global service API ++ *****************************************************************************/ ++// Routine to create a named service ++extern int32_t vchi_service_create( VCHI_INSTANCE_T instance_handle, ++ SERVICE_CREATION_T *setup, ++ VCHI_SERVICE_HANDLE_T *handle ); ++ ++// Routine to destory a service ++extern int32_t vchi_service_destroy( const VCHI_SERVICE_HANDLE_T handle ); ++ ++// Routine to open a named service ++extern int32_t vchi_service_open( VCHI_INSTANCE_T instance_handle, ++ SERVICE_CREATION_T *setup, ++ VCHI_SERVICE_HANDLE_T *handle); ++ ++extern int32_t vchi_get_peer_version( const VCHI_SERVICE_HANDLE_T handle, ++ short *peer_version ); ++ ++// Routine to close a named service ++extern int32_t vchi_service_close( const VCHI_SERVICE_HANDLE_T handle ); ++ ++// Routine to increment ref count on a named service ++extern int32_t vchi_service_use( const VCHI_SERVICE_HANDLE_T handle ); ++ ++// Routine to decrement ref count on a named service ++extern int32_t vchi_service_release( const VCHI_SERVICE_HANDLE_T handle ); ++ ++// Routine to set a control option for a named service ++extern int32_t vchi_service_set_option( const VCHI_SERVICE_HANDLE_T handle, ++ VCHI_SERVICE_OPTION_T option, ++ int value); ++ ++// Routine to send a message across a service ++extern int32_t vchi_msg_queue( VCHI_SERVICE_HANDLE_T handle, ++ const void *data, ++ uint32_t data_size, ++ VCHI_FLAGS_T flags, ++ void *msg_handle ); ++ ++// scatter-gather (vector) and send message ++int32_t vchi_msg_queuev_ex( VCHI_SERVICE_HANDLE_T handle, ++ VCHI_MSG_VECTOR_EX_T *vector, ++ uint32_t count, ++ VCHI_FLAGS_T flags, ++ void *msg_handle ); ++ ++// legacy scatter-gather (vector) and send message, only handles pointers ++int32_t vchi_msg_queuev( VCHI_SERVICE_HANDLE_T handle, ++ VCHI_MSG_VECTOR_T *vector, ++ uint32_t count, ++ VCHI_FLAGS_T flags, ++ void *msg_handle ); ++ ++// Routine to receive a msg from a service ++// Dequeue is equivalent to hold, copy into client buffer, release ++extern int32_t vchi_msg_dequeue( VCHI_SERVICE_HANDLE_T handle, ++ void *data, ++ uint32_t max_data_size_to_read, ++ uint32_t *actual_msg_size, ++ VCHI_FLAGS_T flags ); ++ ++// Routine to look at a message in place. ++// The message is not dequeued, so a subsequent call to peek or dequeue ++// will return the same message. ++extern int32_t vchi_msg_peek( VCHI_SERVICE_HANDLE_T handle, ++ void **data, ++ uint32_t *msg_size, ++ VCHI_FLAGS_T flags ); ++ ++// Routine to remove a message after it has been read in place with peek ++// The first message on the queue is dequeued. ++extern int32_t vchi_msg_remove( VCHI_SERVICE_HANDLE_T handle ); ++ ++// Routine to look at a message in place. ++// The message is dequeued, so the caller is left holding it; the descriptor is ++// filled in and must be released when the user has finished with the message. ++extern int32_t vchi_msg_hold( VCHI_SERVICE_HANDLE_T handle, ++ void **data, // } may be NULL, as info can be ++ uint32_t *msg_size, // } obtained from HELD_MSG_T ++ VCHI_FLAGS_T flags, ++ VCHI_HELD_MSG_T *message_descriptor ); ++ ++// Initialise an iterator to look through messages in place ++extern int32_t vchi_msg_look_ahead( VCHI_SERVICE_HANDLE_T handle, ++ VCHI_MSG_ITER_T *iter, ++ VCHI_FLAGS_T flags ); ++ ++/****************************************************************************** ++ Global service support API - operations on held messages and message iterators ++ *****************************************************************************/ ++ ++// Routine to get the address of a held message ++extern void *vchi_held_msg_ptr( const VCHI_HELD_MSG_T *message ); ++ ++// Routine to get the size of a held message ++extern int32_t vchi_held_msg_size( const VCHI_HELD_MSG_T *message ); ++ ++// Routine to get the transmit timestamp as written into the header by the peer ++extern uint32_t vchi_held_msg_tx_timestamp( const VCHI_HELD_MSG_T *message ); ++ ++// Routine to get the reception timestamp, written as we parsed the header ++extern uint32_t vchi_held_msg_rx_timestamp( const VCHI_HELD_MSG_T *message ); ++ ++// Routine to release a held message after it has been processed ++extern int32_t vchi_held_msg_release( VCHI_HELD_MSG_T *message ); ++ ++// Indicates whether the iterator has a next message. ++extern int32_t vchi_msg_iter_has_next( const VCHI_MSG_ITER_T *iter ); ++ ++// Return the pointer and length for the next message and advance the iterator. ++extern int32_t vchi_msg_iter_next( VCHI_MSG_ITER_T *iter, ++ void **data, ++ uint32_t *msg_size ); ++ ++// Remove the last message returned by vchi_msg_iter_next. ++// Can only be called once after each call to vchi_msg_iter_next. ++extern int32_t vchi_msg_iter_remove( VCHI_MSG_ITER_T *iter ); ++ ++// Hold the last message returned by vchi_msg_iter_next. ++// Can only be called once after each call to vchi_msg_iter_next. ++extern int32_t vchi_msg_iter_hold( VCHI_MSG_ITER_T *iter, ++ VCHI_HELD_MSG_T *message ); ++ ++// Return information for the next message, and hold it, advancing the iterator. ++extern int32_t vchi_msg_iter_hold_next( VCHI_MSG_ITER_T *iter, ++ void **data, // } may be NULL ++ uint32_t *msg_size, // } ++ VCHI_HELD_MSG_T *message ); ++ ++ ++/****************************************************************************** ++ Global bulk API ++ *****************************************************************************/ ++ ++// Routine to prepare interface for a transfer from the other side ++extern int32_t vchi_bulk_queue_receive( VCHI_SERVICE_HANDLE_T handle, ++ void *data_dst, ++ uint32_t data_size, ++ VCHI_FLAGS_T flags, ++ void *transfer_handle ); ++ ++ ++// Prepare interface for a transfer from the other side into relocatable memory. ++int32_t vchi_bulk_queue_receive_reloc( const VCHI_SERVICE_HANDLE_T handle, ++ VCHI_MEM_HANDLE_T h_dst, ++ uint32_t offset, ++ uint32_t data_size, ++ const VCHI_FLAGS_T flags, ++ void * const bulk_handle ); ++ ++// Routine to queue up data ready for transfer to the other (once they have signalled they are ready) ++extern int32_t vchi_bulk_queue_transmit( VCHI_SERVICE_HANDLE_T handle, ++ const void *data_src, ++ uint32_t data_size, ++ VCHI_FLAGS_T flags, ++ void *transfer_handle ); ++ ++ ++/****************************************************************************** ++ Configuration plumbing ++ *****************************************************************************/ ++ ++// function prototypes for the different mid layers (the state info gives the different physical connections) ++extern const VCHI_CONNECTION_API_T *single_get_func_table( void ); ++//extern const VCHI_CONNECTION_API_T *local_server_get_func_table( void ); ++//extern const VCHI_CONNECTION_API_T *local_client_get_func_table( void ); ++ ++// declare all message drivers here ++const VCHI_MESSAGE_DRIVER_T *vchi_mphi_message_driver_func_table( void ); ++ ++#ifdef __cplusplus ++} ++#endif ++ ++extern int32_t vchi_bulk_queue_transmit_reloc( VCHI_SERVICE_HANDLE_T handle, ++ VCHI_MEM_HANDLE_T h_src, ++ uint32_t offset, ++ uint32_t data_size, ++ VCHI_FLAGS_T flags, ++ void *transfer_handle ); ++#endif /* VCHI_H_ */ ++ ++/****************************** End of file **********************************/ +diff --git a/drivers/misc/vc04_services/interface/vchi/vchi_cfg.h b/drivers/misc/vc04_services/interface/vchi/vchi_cfg.h +new file mode 100644 +index 0000000..26bc2d3 +--- /dev/null ++++ b/drivers/misc/vc04_services/interface/vchi/vchi_cfg.h +@@ -0,0 +1,224 @@ ++/** ++ * Copyright (c) 2010-2012 Broadcom. 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, ++ * without modification. ++ * 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. ++ * 3. The names of the above-listed copyright holders may not be used ++ * to endorse or promote products derived from this software without ++ * specific prior written permission. ++ * ++ * ALTERNATIVELY, this software may be distributed under the terms of the ++ * GNU General Public License ("GPL") version 2, as published by the Free ++ * Software Foundation. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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. ++ */ ++ ++#ifndef VCHI_CFG_H_ ++#define VCHI_CFG_H_ ++ ++/**************************************************************************************** ++ * Defines in this first section are part of the VCHI API and may be examined by VCHI ++ * services. ++ ***************************************************************************************/ ++ ++/* Required alignment of base addresses for bulk transfer, if unaligned transfers are not enabled */ ++/* Really determined by the message driver, and should be available from a run-time call. */ ++#ifndef VCHI_BULK_ALIGN ++# if __VCCOREVER__ >= 0x04000000 ++# define VCHI_BULK_ALIGN 32 // Allows for the need to do cache cleans ++# else ++# define VCHI_BULK_ALIGN 16 ++# endif ++#endif ++ ++/* Required length multiple for bulk transfers, if unaligned transfers are not enabled */ ++/* May be less than or greater than VCHI_BULK_ALIGN */ ++/* Really determined by the message driver, and should be available from a run-time call. */ ++#ifndef VCHI_BULK_GRANULARITY ++# if __VCCOREVER__ >= 0x04000000 ++# define VCHI_BULK_GRANULARITY 32 // Allows for the need to do cache cleans ++# else ++# define VCHI_BULK_GRANULARITY 16 ++# endif ++#endif ++ ++/* The largest possible message to be queued with vchi_msg_queue. */ ++#ifndef VCHI_MAX_MSG_SIZE ++# if defined VCHI_LOCAL_HOST_PORT ++# define VCHI_MAX_MSG_SIZE 16384 // makes file transfers fast, but should they be using bulk? ++# else ++# define VCHI_MAX_MSG_SIZE 4096 // NOTE: THIS MUST BE LARGER THAN OR EQUAL TO THE SIZE OF THE KHRONOS MERGE BUFFER!! ++# endif ++#endif ++ ++/****************************************************************************************** ++ * Defines below are system configuration options, and should not be used by VCHI services. ++ *****************************************************************************************/ ++ ++/* How many connections can we support? A localhost implementation uses 2 connections, ++ * 1 for host-app, 1 for VMCS, and these are hooked together by a loopback MPHI VCFW ++ * driver. */ ++#ifndef VCHI_MAX_NUM_CONNECTIONS ++# define VCHI_MAX_NUM_CONNECTIONS 3 ++#endif ++ ++/* How many services can we open per connection? Extending this doesn't cost processing time, just a small ++ * amount of static memory. */ ++#ifndef VCHI_MAX_SERVICES_PER_CONNECTION ++# define VCHI_MAX_SERVICES_PER_CONNECTION 36 ++#endif ++ ++/* Adjust if using a message driver that supports more logical TX channels */ ++#ifndef VCHI_MAX_BULK_TX_CHANNELS_PER_CONNECTION ++# define VCHI_MAX_BULK_TX_CHANNELS_PER_CONNECTION 9 // 1 MPHI + 8 CCP2 logical channels ++#endif ++ ++/* Adjust if using a message driver that supports more logical RX channels */ ++#ifndef VCHI_MAX_BULK_RX_CHANNELS_PER_CONNECTION ++# define VCHI_MAX_BULK_RX_CHANNELS_PER_CONNECTION 1 // 1 MPHI ++#endif ++ ++/* How many receive slots do we use. This times VCHI_MAX_MSG_SIZE gives the effective ++ * receive queue space, less message headers. */ ++#ifndef VCHI_NUM_READ_SLOTS ++# if defined(VCHI_LOCAL_HOST_PORT) ++# define VCHI_NUM_READ_SLOTS 4 ++# else ++# define VCHI_NUM_READ_SLOTS 48 ++# endif ++#endif ++ ++/* Do we utilise overrun facility for receive message slots? Can aid peer transmit ++ * performance. Only define on VideoCore end, talking to host. ++ */ ++//#define VCHI_MSG_RX_OVERRUN ++ ++/* How many transmit slots do we use. Generally don't need many, as the hardware driver ++ * underneath VCHI will usually have its own buffering. */ ++#ifndef VCHI_NUM_WRITE_SLOTS ++# define VCHI_NUM_WRITE_SLOTS 4 ++#endif ++ ++/* If a service has held or queued received messages in VCHI_XOFF_THRESHOLD or more slots, ++ * then it's taking up too much buffer space, and the peer service will be told to stop ++ * transmitting with an XOFF message. For this to be effective, the VCHI_NUM_READ_SLOTS ++ * needs to be considerably bigger than VCHI_NUM_WRITE_SLOTS, or the transmit latency ++ * is too high. */ ++#ifndef VCHI_XOFF_THRESHOLD ++# define VCHI_XOFF_THRESHOLD (VCHI_NUM_READ_SLOTS / 2) ++#endif ++ ++/* After we've sent an XOFF, the peer will be told to resume transmission once the local ++ * service has dequeued/released enough messages that it's now occupying ++ * VCHI_XON_THRESHOLD slots or fewer. */ ++#ifndef VCHI_XON_THRESHOLD ++# define VCHI_XON_THRESHOLD (VCHI_NUM_READ_SLOTS / 4) ++#endif ++ ++/* A size below which a bulk transfer omits the handshake completely and always goes ++ * via the message channel, if bulk auxiliary is being sent on that service. (The user ++ * can guarantee this by enabling unaligned transmits). ++ * Not API. */ ++#ifndef VCHI_MIN_BULK_SIZE ++# define VCHI_MIN_BULK_SIZE ( VCHI_MAX_MSG_SIZE / 2 < 4096 ? VCHI_MAX_MSG_SIZE / 2 : 4096 ) ++#endif ++ ++/* Maximum size of bulk transmission chunks, for each interface type. A trade-off between ++ * speed and latency; the smaller the chunk size the better change of messages and other ++ * bulk transmissions getting in when big bulk transfers are happening. Set to 0 to not ++ * break transmissions into chunks. ++ */ ++#ifndef VCHI_MAX_BULK_CHUNK_SIZE_MPHI ++# define VCHI_MAX_BULK_CHUNK_SIZE_MPHI (16 * 1024) ++#endif ++ ++/* NB Chunked CCP2 transmissions violate the letter of the CCP2 spec by using "JPEG8" mode ++ * with multiple-line frames. Only use if the receiver can cope. */ ++#ifndef VCHI_MAX_BULK_CHUNK_SIZE_CCP2 ++# define VCHI_MAX_BULK_CHUNK_SIZE_CCP2 0 ++#endif ++ ++/* How many TX messages can we have pending in our transmit slots. Once exhausted, ++ * vchi_msg_queue will be blocked. */ ++#ifndef VCHI_TX_MSG_QUEUE_SIZE ++# define VCHI_TX_MSG_QUEUE_SIZE 256 ++#endif ++ ++/* How many RX messages can we have parsed in the receive slots. Once exhausted, parsing ++ * will be suspended until older messages are dequeued/released. */ ++#ifndef VCHI_RX_MSG_QUEUE_SIZE ++# define VCHI_RX_MSG_QUEUE_SIZE 256 ++#endif ++ ++/* Really should be able to cope if we run out of received message descriptors, by ++ * suspending parsing as the comment above says, but we don't. This sweeps the issue ++ * under the carpet. */ ++#if VCHI_RX_MSG_QUEUE_SIZE < (VCHI_MAX_MSG_SIZE/16 + 1) * VCHI_NUM_READ_SLOTS ++# undef VCHI_RX_MSG_QUEUE_SIZE ++# define VCHI_RX_MSG_QUEUE_SIZE (VCHI_MAX_MSG_SIZE/16 + 1) * VCHI_NUM_READ_SLOTS ++#endif ++ ++/* How many bulk transmits can we have pending. Once exhausted, vchi_bulk_queue_transmit ++ * will be blocked. */ ++#ifndef VCHI_TX_BULK_QUEUE_SIZE ++# define VCHI_TX_BULK_QUEUE_SIZE 64 ++#endif ++ ++/* How many bulk receives can we have pending. Once exhausted, vchi_bulk_queue_receive ++ * will be blocked. */ ++#ifndef VCHI_RX_BULK_QUEUE_SIZE ++# define VCHI_RX_BULK_QUEUE_SIZE 64 ++#endif ++ ++/* A limit on how many outstanding bulk requests we expect the peer to give us. If ++ * the peer asks for more than this, VCHI will fail and assert. The number is determined ++ * by the peer's hardware - it's the number of outstanding requests that can be queued ++ * on all bulk channels. VC3's MPHI peripheral allows 16. */ ++#ifndef VCHI_MAX_PEER_BULK_REQUESTS ++# define VCHI_MAX_PEER_BULK_REQUESTS 32 ++#endif ++ ++/* Define VCHI_CCP2TX_MANUAL_POWER if the host tells us when to turn the CCP2 ++ * transmitter on and off. ++ */ ++/*#define VCHI_CCP2TX_MANUAL_POWER*/ ++ ++#ifndef VCHI_CCP2TX_MANUAL_POWER ++ ++/* Timeout (in milliseconds) for putting the CCP2TX interface into IDLE state. Set ++ * negative for no IDLE. ++ */ ++# ifndef VCHI_CCP2TX_IDLE_TIMEOUT ++# define VCHI_CCP2TX_IDLE_TIMEOUT 5 ++# endif ++ ++/* Timeout (in milliseconds) for putting the CCP2TX interface into OFF state. Set ++ * negative for no OFF. ++ */ ++# ifndef VCHI_CCP2TX_OFF_TIMEOUT ++# define VCHI_CCP2TX_OFF_TIMEOUT 1000 ++# endif ++ ++#endif /* VCHI_CCP2TX_MANUAL_POWER */ ++ ++#endif /* VCHI_CFG_H_ */ ++ ++/****************************** End of file **********************************/ +diff --git a/drivers/misc/vc04_services/interface/vchi/vchi_cfg_internal.h b/drivers/misc/vc04_services/interface/vchi/vchi_cfg_internal.h +new file mode 100644 +index 0000000..35dcba4 +--- /dev/null ++++ b/drivers/misc/vc04_services/interface/vchi/vchi_cfg_internal.h +@@ -0,0 +1,71 @@ ++/** ++ * Copyright (c) 2010-2012 Broadcom. 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, ++ * without modification. ++ * 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. ++ * 3. The names of the above-listed copyright holders may not be used ++ * to endorse or promote products derived from this software without ++ * specific prior written permission. ++ * ++ * ALTERNATIVELY, this software may be distributed under the terms of the ++ * GNU General Public License ("GPL") version 2, as published by the Free ++ * Software Foundation. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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. ++ */ ++ ++#ifndef VCHI_CFG_INTERNAL_H_ ++#define VCHI_CFG_INTERNAL_H_ ++ ++/**************************************************************************************** ++ * Control optimisation attempts. ++ ***************************************************************************************/ ++ ++// Don't use lots of short-term locks - use great long ones, reducing the overall locks-per-second ++#define VCHI_COARSE_LOCKING ++ ++// Avoid lock then unlock on exit from blocking queue operations (msg tx, bulk rx/tx) ++// (only relevant if VCHI_COARSE_LOCKING) ++#define VCHI_ELIDE_BLOCK_EXIT_LOCK ++ ++// Avoid lock on non-blocking peek ++// (only relevant if VCHI_COARSE_LOCKING) ++#define VCHI_AVOID_PEEK_LOCK ++ ++// Use one slot-handler thread per connection, rather than 1 thread dealing with all connections in rotation. ++#define VCHI_MULTIPLE_HANDLER_THREADS ++ ++// Put free descriptors onto the head of the free queue, rather than the tail, so that we don't thrash ++// our way through the pool of descriptors. ++#define VCHI_PUSH_FREE_DESCRIPTORS_ONTO_HEAD ++ ++// Don't issue a MSG_AVAILABLE callback for every single message. Possibly only safe if VCHI_COARSE_LOCKING. ++#define VCHI_FEWER_MSG_AVAILABLE_CALLBACKS ++ ++// Don't use message descriptors for TX messages that don't need them ++#define VCHI_MINIMISE_TX_MSG_DESCRIPTORS ++ ++// Nano-locks for multiqueue ++//#define VCHI_MQUEUE_NANOLOCKS ++ ++// Lock-free(er) dequeuing ++//#define VCHI_RX_NANOLOCKS ++ ++#endif /*VCHI_CFG_INTERNAL_H_*/ +diff --git a/drivers/misc/vc04_services/interface/vchi/vchi_common.h b/drivers/misc/vc04_services/interface/vchi/vchi_common.h +new file mode 100644 +index 0000000..d535a72 +--- /dev/null ++++ b/drivers/misc/vc04_services/interface/vchi/vchi_common.h +@@ -0,0 +1,175 @@ ++/** ++ * Copyright (c) 2010-2012 Broadcom. 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, ++ * without modification. ++ * 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. ++ * 3. The names of the above-listed copyright holders may not be used ++ * to endorse or promote products derived from this software without ++ * specific prior written permission. ++ * ++ * ALTERNATIVELY, this software may be distributed under the terms of the ++ * GNU General Public License ("GPL") version 2, as published by the Free ++ * Software Foundation. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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. ++ */ ++ ++#ifndef VCHI_COMMON_H_ ++#define VCHI_COMMON_H_ ++ ++ ++//flags used when sending messages (must be bitmapped) ++typedef enum ++{ ++ VCHI_FLAGS_NONE = 0x0, ++ VCHI_FLAGS_BLOCK_UNTIL_OP_COMPLETE = 0x1, // waits for message to be received, or sent (NB. not the same as being seen on other side) ++ VCHI_FLAGS_CALLBACK_WHEN_OP_COMPLETE = 0x2, // run a callback when message sent ++ VCHI_FLAGS_BLOCK_UNTIL_QUEUED = 0x4, // return once the transfer is in a queue ready to go ++ VCHI_FLAGS_ALLOW_PARTIAL = 0x8, ++ VCHI_FLAGS_BLOCK_UNTIL_DATA_READ = 0x10, ++ VCHI_FLAGS_CALLBACK_WHEN_DATA_READ = 0x20, ++ ++ VCHI_FLAGS_ALIGN_SLOT = 0x000080, // internal use only ++ VCHI_FLAGS_BULK_AUX_QUEUED = 0x010000, // internal use only ++ VCHI_FLAGS_BULK_AUX_COMPLETE = 0x020000, // internal use only ++ VCHI_FLAGS_BULK_DATA_QUEUED = 0x040000, // internal use only ++ VCHI_FLAGS_BULK_DATA_COMPLETE = 0x080000, // internal use only ++ VCHI_FLAGS_INTERNAL = 0xFF0000 ++} VCHI_FLAGS_T; ++ ++// constants for vchi_crc_control() ++typedef enum { ++ VCHI_CRC_NOTHING = -1, ++ VCHI_CRC_PER_SERVICE = 0, ++ VCHI_CRC_EVERYTHING = 1, ++} VCHI_CRC_CONTROL_T; ++ ++//callback reasons when an event occurs on a service ++typedef enum ++{ ++ VCHI_CALLBACK_REASON_MIN, ++ ++ //This indicates that there is data available ++ //handle is the msg id that was transmitted with the data ++ // When a message is received and there was no FULL message available previously, send callback ++ // Tasks get kicked by the callback, reset their event and try and read from the fifo until it fails ++ VCHI_CALLBACK_MSG_AVAILABLE, ++ VCHI_CALLBACK_MSG_SENT, ++ VCHI_CALLBACK_MSG_SPACE_AVAILABLE, // XXX not yet implemented ++ ++ // This indicates that a transfer from the other side has completed ++ VCHI_CALLBACK_BULK_RECEIVED, ++ //This indicates that data queued up to be sent has now gone ++ //handle is the msg id that was used when sending the data ++ VCHI_CALLBACK_BULK_SENT, ++ VCHI_CALLBACK_BULK_RX_SPACE_AVAILABLE, // XXX not yet implemented ++ VCHI_CALLBACK_BULK_TX_SPACE_AVAILABLE, // XXX not yet implemented ++ ++ VCHI_CALLBACK_SERVICE_CLOSED, ++ ++ // this side has sent XOFF to peer due to lack of data consumption by service ++ // (suggests the service may need to take some recovery action if it has ++ // been deliberately holding off consuming data) ++ VCHI_CALLBACK_SENT_XOFF, ++ VCHI_CALLBACK_SENT_XON, ++ ++ // indicates that a bulk transfer has finished reading the source buffer ++ VCHI_CALLBACK_BULK_DATA_READ, ++ ++ // power notification events (currently host side only) ++ VCHI_CALLBACK_PEER_OFF, ++ VCHI_CALLBACK_PEER_SUSPENDED, ++ VCHI_CALLBACK_PEER_ON, ++ VCHI_CALLBACK_PEER_RESUMED, ++ VCHI_CALLBACK_FORCED_POWER_OFF, ++ ++#ifdef USE_VCHIQ_ARM ++ // some extra notifications provided by vchiq_arm ++ VCHI_CALLBACK_SERVICE_OPENED, ++ VCHI_CALLBACK_BULK_RECEIVE_ABORTED, ++ VCHI_CALLBACK_BULK_TRANSMIT_ABORTED, ++#endif ++ ++ VCHI_CALLBACK_REASON_MAX ++} VCHI_CALLBACK_REASON_T; ++ ++// service control options ++typedef enum ++{ ++ VCHI_SERVICE_OPTION_MIN, ++ ++ VCHI_SERVICE_OPTION_TRACE, ++ VCHI_SERVICE_OPTION_SYNCHRONOUS, ++ ++ VCHI_SERVICE_OPTION_MAX ++} VCHI_SERVICE_OPTION_T; ++ ++ ++//Callback used by all services / bulk transfers ++typedef void (*VCHI_CALLBACK_T)( void *callback_param, //my service local param ++ VCHI_CALLBACK_REASON_T reason, ++ void *handle ); //for transmitting msg's only ++ ++ ++ ++/* ++ * Define vector struct for scatter-gather (vector) operations ++ * Vectors can be nested - if a vector element has negative length, then ++ * the data pointer is treated as pointing to another vector array, with ++ * '-vec_len' elements. Thus to append a header onto an existing vector, ++ * you can do this: ++ * ++ * void foo(const VCHI_MSG_VECTOR_T *v, int n) ++ * { ++ * VCHI_MSG_VECTOR_T nv[2]; ++ * nv[0].vec_base = my_header; ++ * nv[0].vec_len = sizeof my_header; ++ * nv[1].vec_base = v; ++ * nv[1].vec_len = -n; ++ * ... ++ * ++ */ ++typedef struct vchi_msg_vector { ++ const void *vec_base; ++ int32_t vec_len; ++} VCHI_MSG_VECTOR_T; ++ ++// Opaque type for a connection API ++typedef struct opaque_vchi_connection_api_t VCHI_CONNECTION_API_T; ++ ++// Opaque type for a message driver ++typedef struct opaque_vchi_message_driver_t VCHI_MESSAGE_DRIVER_T; ++ ++ ++// Iterator structure for reading ahead through received message queue. Allocated by client, ++// initialised by vchi_msg_look_ahead. Fields are for internal VCHI use only. ++// Iterates over messages in queue at the instant of the call to vchi_msg_lookahead - ++// will not proceed to messages received since. Behaviour is undefined if an iterator ++// is used again after messages for that service are removed/dequeued by any ++// means other than vchi_msg_iter_... calls on the iterator itself. ++typedef struct { ++ struct opaque_vchi_service_t *service; ++ void *last; ++ void *next; ++ void *remove; ++} VCHI_MSG_ITER_T; ++ ++ ++#endif // VCHI_COMMON_H_ +diff --git a/drivers/misc/vc04_services/interface/vchi/vchi_mh.h b/drivers/misc/vc04_services/interface/vchi/vchi_mh.h +new file mode 100644 +index 0000000..198bd07 +--- /dev/null ++++ b/drivers/misc/vc04_services/interface/vchi/vchi_mh.h +@@ -0,0 +1,42 @@ ++/** ++ * Copyright (c) 2010-2012 Broadcom. 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, ++ * without modification. ++ * 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. ++ * 3. The names of the above-listed copyright holders may not be used ++ * to endorse or promote products derived from this software without ++ * specific prior written permission. ++ * ++ * ALTERNATIVELY, this software may be distributed under the terms of the ++ * GNU General Public License ("GPL") version 2, as published by the Free ++ * Software Foundation. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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. ++ */ ++ ++#ifndef VCHI_MH_H_ ++#define VCHI_MH_H_ ++ ++#include <linux/types.h> ++ ++typedef int32_t VCHI_MEM_HANDLE_T; ++#define VCHI_MEM_HANDLE_INVALID 0 ++ ++#endif +diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq.h b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq.h +new file mode 100644 +index 0000000..ad398ba +--- /dev/null ++++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq.h +@@ -0,0 +1,40 @@ ++/** ++ * Copyright (c) 2010-2012 Broadcom. 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, ++ * without modification. ++ * 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. ++ * 3. The names of the above-listed copyright holders may not be used ++ * to endorse or promote products derived from this software without ++ * specific prior written permission. ++ * ++ * ALTERNATIVELY, this software may be distributed under the terms of the ++ * GNU General Public License ("GPL") version 2, as published by the Free ++ * Software Foundation. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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. ++ */ ++ ++#ifndef VCHIQ_VCHIQ_H ++#define VCHIQ_VCHIQ_H ++ ++#include "vchiq_if.h" ++#include "vchiq_util.h" ++ ++#endif +diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835.h b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835.h +new file mode 100644 +index 0000000..7ea5c64 +--- /dev/null ++++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835.h +@@ -0,0 +1,42 @@ ++/** ++ * Copyright (c) 2010-2012 Broadcom. 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, ++ * without modification. ++ * 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. ++ * 3. The names of the above-listed copyright holders may not be used ++ * to endorse or promote products derived from this software without ++ * specific prior written permission. ++ * ++ * ALTERNATIVELY, this software may be distributed under the terms of the ++ * GNU General Public License ("GPL") version 2, as published by the Free ++ * Software Foundation. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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. ++ */ ++ ++#ifndef VCHIQ_2835_H ++#define VCHIQ_2835_H ++ ++#include "vchiq_pagelist.h" ++ ++#define VCHIQ_PLATFORM_FRAGMENTS_OFFSET_IDX 0 ++#define VCHIQ_PLATFORM_FRAGMENTS_COUNT_IDX 1 ++ ++#endif /* VCHIQ_2835_H */ +diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c +new file mode 100644 +index 0000000..4cb5bff +--- /dev/null ++++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c +@@ -0,0 +1,586 @@ ++/** ++ * Copyright (c) 2010-2012 Broadcom. 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, ++ * without modification. ++ * 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. ++ * 3. The names of the above-listed copyright holders may not be used ++ * to endorse or promote products derived from this software without ++ * specific prior written permission. ++ * ++ * ALTERNATIVELY, this software may be distributed under the terms of the ++ * GNU General Public License ("GPL") version 2, as published by the Free ++ * Software Foundation. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER OR ++ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ++ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, ++ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR ++ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF ++ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING ++ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ */ ++ ++#include <linux/kernel.h> ++#include <linux/types.h> ++#include <linux/errno.h> ++#include <linux/interrupt.h> ++#include <linux/pagemap.h> ++#include <linux/dma-mapping.h> ++#include <linux/version.h> ++#include <linux/io.h> ++#include <linux/platform_device.h> ++#include <linux/uaccess.h> ++#include <linux/of.h> ++#include <asm/pgtable.h> ++#include <soc/bcm2835/raspberrypi-firmware.h> ++ ++#define dmac_map_area __glue(_CACHE,_dma_map_area) ++#define dmac_unmap_area __glue(_CACHE,_dma_unmap_area) ++ ++extern void dmac_map_area(const void *, size_t, int); ++extern void dmac_unmap_area(const void *, size_t, int); ++ ++#define TOTAL_SLOTS (VCHIQ_SLOT_ZERO_SLOTS + 2 * 32) ++ ++#define VCHIQ_ARM_ADDRESS(x) ((void *)((char *)x + g_virt_to_bus_offset)) ++ ++#include "vchiq_arm.h" ++#include "vchiq_2835.h" ++#include "vchiq_connected.h" ++#include "vchiq_killable.h" ++ ++#define MAX_FRAGMENTS (VCHIQ_NUM_CURRENT_BULKS * 2) ++ ++#define BELL0 0x00 ++#define BELL2 0x08 ++ ++typedef struct vchiq_2835_state_struct { ++ int inited; ++ VCHIQ_ARM_STATE_T arm_state; ++} VCHIQ_2835_ARM_STATE_T; ++ ++static void __iomem *g_regs; ++static unsigned int g_cache_line_size = sizeof(CACHE_LINE_SIZE); ++static unsigned int g_fragments_size; ++static char *g_fragments_base; ++static char *g_free_fragments; ++static struct semaphore g_free_fragments_sema; ++static unsigned long g_virt_to_bus_offset; ++ ++extern int vchiq_arm_log_level; ++ ++static DEFINE_SEMAPHORE(g_free_fragments_mutex); ++ ++static irqreturn_t ++vchiq_doorbell_irq(int irq, void *dev_id); ++ ++static int ++create_pagelist(char __user *buf, size_t count, unsigned short type, ++ struct task_struct *task, PAGELIST_T ** ppagelist); ++ ++static void ++free_pagelist(PAGELIST_T *pagelist, int actual); ++ ++int vchiq_platform_init(struct platform_device *pdev, VCHIQ_STATE_T *state) ++{ ++ struct device *dev = &pdev->dev; ++ struct rpi_firmware *fw = platform_get_drvdata(pdev); ++ VCHIQ_SLOT_ZERO_T *vchiq_slot_zero; ++ struct resource *res; ++ void *slot_mem; ++ dma_addr_t slot_phys; ++ u32 channelbase; ++ int slot_mem_size, frag_mem_size; ++ int err, irq, i; ++ ++ g_virt_to_bus_offset = virt_to_dma(dev, (void *)0); ++ ++ (void)of_property_read_u32(dev->of_node, "cache-line-size", ++ &g_cache_line_size); ++ g_fragments_size = 2 * g_cache_line_size; ++ ++ /* Allocate space for the channels in coherent memory */ ++ slot_mem_size = PAGE_ALIGN(TOTAL_SLOTS * VCHIQ_SLOT_SIZE); ++ frag_mem_size = PAGE_ALIGN(g_fragments_size * MAX_FRAGMENTS); ++ ++ slot_mem = dmam_alloc_coherent(dev, slot_mem_size + frag_mem_size, ++ &slot_phys, GFP_KERNEL); ++ if (!slot_mem) { ++ dev_err(dev, "could not allocate DMA memory\n"); ++ return -ENOMEM; ++ } ++ ++ WARN_ON(((int)slot_mem & (PAGE_SIZE - 1)) != 0); ++ ++ vchiq_slot_zero = vchiq_init_slots(slot_mem, slot_mem_size); ++ if (!vchiq_slot_zero) ++ return -EINVAL; ++ ++ vchiq_slot_zero->platform_data[VCHIQ_PLATFORM_FRAGMENTS_OFFSET_IDX] = ++ (int)slot_phys + slot_mem_size; ++ vchiq_slot_zero->platform_data[VCHIQ_PLATFORM_FRAGMENTS_COUNT_IDX] = ++ MAX_FRAGMENTS; ++ ++ g_fragments_base = (char *)slot_mem + slot_mem_size; ++ slot_mem_size += frag_mem_size; ++ ++ g_free_fragments = g_fragments_base; ++ for (i = 0; i < (MAX_FRAGMENTS - 1); i++) { ++ *(char **)&g_fragments_base[i*g_fragments_size] = ++ &g_fragments_base[(i + 1)*g_fragments_size]; ++ } ++ *(char **)&g_fragments_base[i * g_fragments_size] = NULL; ++ sema_init(&g_free_fragments_sema, MAX_FRAGMENTS); ++ ++ if (vchiq_init_state(state, vchiq_slot_zero, 0) != VCHIQ_SUCCESS) ++ return -EINVAL; ++ ++ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); ++ g_regs = devm_ioremap_resource(&pdev->dev, res); ++ if (IS_ERR(g_regs)) ++ return PTR_ERR(g_regs); ++ ++ irq = platform_get_irq(pdev, 0); ++ if (irq <= 0) { ++ dev_err(dev, "failed to get IRQ\n"); ++ return irq; ++ } ++ ++ err = devm_request_irq(dev, irq, vchiq_doorbell_irq, IRQF_IRQPOLL, ++ "VCHIQ doorbell", state); ++ if (err) { ++ dev_err(dev, "failed to register irq=%d\n", irq); ++ return err; ++ } ++ ++ /* Send the base address of the slots to VideoCore */ ++ channelbase = slot_phys; ++ err = rpi_firmware_property(fw, RPI_FIRMWARE_VCHIQ_INIT, ++ &channelbase, sizeof(channelbase)); ++ if (err || channelbase) { ++ dev_err(dev, "failed to set channelbase\n"); ++ return err ? : -ENXIO; ++ } ++ ++ vchiq_log_info(vchiq_arm_log_level, ++ "vchiq_init - done (slots %x, phys %pad)", ++ (unsigned int)vchiq_slot_zero, &slot_phys); ++ ++ vchiq_call_connected_callbacks(); ++ ++ return 0; ++} ++ ++VCHIQ_STATUS_T ++vchiq_platform_init_state(VCHIQ_STATE_T *state) ++{ ++ VCHIQ_STATUS_T status = VCHIQ_SUCCESS; ++ state->platform_state = kzalloc(sizeof(VCHIQ_2835_ARM_STATE_T), GFP_KERNEL); ++ ((VCHIQ_2835_ARM_STATE_T*)state->platform_state)->inited = 1; ++ status = vchiq_arm_init_state(state, &((VCHIQ_2835_ARM_STATE_T*)state->platform_state)->arm_state); ++ if(status != VCHIQ_SUCCESS) ++ { ++ ((VCHIQ_2835_ARM_STATE_T*)state->platform_state)->inited = 0; ++ } ++ return status; ++} ++ ++VCHIQ_ARM_STATE_T* ++vchiq_platform_get_arm_state(VCHIQ_STATE_T *state) ++{ ++ if(!((VCHIQ_2835_ARM_STATE_T*)state->platform_state)->inited) ++ { ++ BUG(); ++ } ++ return &((VCHIQ_2835_ARM_STATE_T*)state->platform_state)->arm_state; ++} ++ ++void ++remote_event_signal(REMOTE_EVENT_T *event) ++{ ++ wmb(); ++ ++ event->fired = 1; ++ ++ dsb(); /* data barrier operation */ ++ ++ if (event->armed) ++ writel(0, g_regs + BELL2); /* trigger vc interrupt */ ++} ++ ++int ++vchiq_copy_from_user(void *dst, const void *src, int size) ++{ ++ if ((uint32_t)src < TASK_SIZE) { ++ return copy_from_user(dst, src, size); ++ } else { ++ memcpy(dst, src, size); ++ return 0; ++ } ++} ++ ++VCHIQ_STATUS_T ++vchiq_prepare_bulk_data(VCHIQ_BULK_T *bulk, VCHI_MEM_HANDLE_T memhandle, ++ void *offset, int size, int dir) ++{ ++ PAGELIST_T *pagelist; ++ int ret; ++ ++ WARN_ON(memhandle != VCHI_MEM_HANDLE_INVALID); ++ ++ ret = create_pagelist((char __user *)offset, size, ++ (dir == VCHIQ_BULK_RECEIVE) ++ ? PAGELIST_READ ++ : PAGELIST_WRITE, ++ current, ++ &pagelist); ++ if (ret != 0) ++ return VCHIQ_ERROR; ++ ++ bulk->handle = memhandle; ++ bulk->data = VCHIQ_ARM_ADDRESS(pagelist); ++ ++ /* Store the pagelist address in remote_data, which isn't used by the ++ slave. */ ++ bulk->remote_data = pagelist; ++ ++ return VCHIQ_SUCCESS; ++} ++ ++void ++vchiq_complete_bulk(VCHIQ_BULK_T *bulk) ++{ ++ if (bulk && bulk->remote_data && bulk->actual) ++ free_pagelist((PAGELIST_T *)bulk->remote_data, bulk->actual); ++} ++ ++void ++vchiq_transfer_bulk(VCHIQ_BULK_T *bulk) ++{ ++ /* ++ * This should only be called on the master (VideoCore) side, but ++ * provide an implementation to avoid the need for ifdefery. ++ */ ++ BUG(); ++} ++ ++void ++vchiq_dump_platform_state(void *dump_context) ++{ ++ char buf[80]; ++ int len; ++ len = snprintf(buf, sizeof(buf), ++ " Platform: 2835 (VC master)"); ++ vchiq_dump(dump_context, buf, len + 1); ++} ++ ++VCHIQ_STATUS_T ++vchiq_platform_suspend(VCHIQ_STATE_T *state) ++{ ++ return VCHIQ_ERROR; ++} ++ ++VCHIQ_STATUS_T ++vchiq_platform_resume(VCHIQ_STATE_T *state) ++{ ++ return VCHIQ_SUCCESS; ++} ++ ++void ++vchiq_platform_paused(VCHIQ_STATE_T *state) ++{ ++} ++ ++void ++vchiq_platform_resumed(VCHIQ_STATE_T *state) ++{ ++} ++ ++int ++vchiq_platform_videocore_wanted(VCHIQ_STATE_T* state) ++{ ++ return 1; // autosuspend not supported - videocore always wanted ++} ++ ++int ++vchiq_platform_use_suspend_timer(void) ++{ ++ return 0; ++} ++void ++vchiq_dump_platform_use_state(VCHIQ_STATE_T *state) ++{ ++ vchiq_log_info(vchiq_arm_log_level, "Suspend timer not in use"); ++} ++void ++vchiq_platform_handle_timeout(VCHIQ_STATE_T *state) ++{ ++ (void)state; ++} ++/* ++ * Local functions ++ */ ++ ++static irqreturn_t ++vchiq_doorbell_irq(int irq, void *dev_id) ++{ ++ VCHIQ_STATE_T *state = dev_id; ++ irqreturn_t ret = IRQ_NONE; ++ unsigned int status; ++ ++ /* Read (and clear) the doorbell */ ++ status = readl(g_regs + BELL0); ++ ++ if (status & 0x4) { /* Was the doorbell rung? */ ++ remote_event_pollall(state); ++ ret = IRQ_HANDLED; ++ } ++ ++ return ret; ++} ++ ++/* There is a potential problem with partial cache lines (pages?) ++** at the ends of the block when reading. If the CPU accessed anything in ++** the same line (page?) then it may have pulled old data into the cache, ++** obscuring the new data underneath. We can solve this by transferring the ++** partial cache lines separately, and allowing the ARM to copy into the ++** cached area. ++ ++** N.B. This implementation plays slightly fast and loose with the Linux ++** driver programming rules, e.g. its use of dmac_map_area instead of ++** dma_map_single, but it isn't a multi-platform driver and it benefits ++** from increased speed as a result. ++*/ ++ ++static int ++create_pagelist(char __user *buf, size_t count, unsigned short type, ++ struct task_struct *task, PAGELIST_T ** ppagelist) ++{ ++ PAGELIST_T *pagelist; ++ struct page **pages; ++ unsigned long *addrs; ++ unsigned int num_pages, offset, i; ++ char *addr, *base_addr, *next_addr; ++ int run, addridx, actual_pages; ++ unsigned long *need_release; ++ ++ offset = (unsigned int)buf & (PAGE_SIZE - 1); ++ num_pages = (count + offset + PAGE_SIZE - 1) / PAGE_SIZE; ++ ++ *ppagelist = NULL; ++ ++ /* Allocate enough storage to hold the page pointers and the page ++ ** list ++ */ ++ pagelist = kmalloc(sizeof(PAGELIST_T) + ++ (num_pages * sizeof(unsigned long)) + ++ sizeof(unsigned long) + ++ (num_pages * sizeof(pages[0])), ++ GFP_KERNEL); ++ ++ vchiq_log_trace(vchiq_arm_log_level, ++ "create_pagelist - %x", (unsigned int)pagelist); ++ if (!pagelist) ++ return -ENOMEM; ++ ++ addrs = pagelist->addrs; ++ need_release = (unsigned long *)(addrs + num_pages); ++ pages = (struct page **)(addrs + num_pages + 1); ++ ++ if (is_vmalloc_addr(buf)) { ++ int dir = (type == PAGELIST_WRITE) ? ++ DMA_TO_DEVICE : DMA_FROM_DEVICE; ++ unsigned long length = count; ++ unsigned int off = offset; ++ ++ for (actual_pages = 0; actual_pages < num_pages; ++ actual_pages++) { ++ struct page *pg = vmalloc_to_page(buf + (actual_pages * ++ PAGE_SIZE)); ++ size_t bytes = PAGE_SIZE - off; ++ ++ if (bytes > length) ++ bytes = length; ++ pages[actual_pages] = pg; ++ dmac_map_area(page_address(pg) + off, bytes, dir); ++ length -= bytes; ++ off = 0; ++ } ++ *need_release = 0; /* do not try and release vmalloc pages */ ++ } else { ++ down_read(&task->mm->mmap_sem); ++ actual_pages = get_user_pages( ++ (unsigned long)buf & ~(PAGE_SIZE - 1), ++ num_pages, ++ (type == PAGELIST_READ) /*Write */ , ++ 0 /*Force */ , ++ pages, ++ NULL /*vmas */); ++ up_read(&task->mm->mmap_sem); ++ ++ if (actual_pages != num_pages) { ++ vchiq_log_info(vchiq_arm_log_level, ++ "create_pagelist - only %d/%d pages locked", ++ actual_pages, ++ num_pages); ++ ++ /* This is probably due to the process being killed */ ++ while (actual_pages > 0) ++ { ++ actual_pages--; ++ put_page(pages[actual_pages]); ++ } ++ kfree(pagelist); ++ if (actual_pages == 0) ++ actual_pages = -ENOMEM; ++ return actual_pages; ++ } ++ *need_release = 1; /* release user pages */ ++ } ++ ++ pagelist->length = count; ++ pagelist->type = type; ++ pagelist->offset = offset; ++ ++ /* Group the pages into runs of contiguous pages */ ++ ++ base_addr = VCHIQ_ARM_ADDRESS(page_address(pages[0])); ++ next_addr = base_addr + PAGE_SIZE; ++ addridx = 0; ++ run = 0; ++ ++ for (i = 1; i < num_pages; i++) { ++ addr = VCHIQ_ARM_ADDRESS(page_address(pages[i])); ++ if ((addr == next_addr) && (run < (PAGE_SIZE - 1))) { ++ next_addr += PAGE_SIZE; ++ run++; ++ } else { ++ addrs[addridx] = (unsigned long)base_addr + run; ++ addridx++; ++ base_addr = addr; ++ next_addr = addr + PAGE_SIZE; ++ run = 0; ++ } ++ } ++ ++ addrs[addridx] = (unsigned long)base_addr + run; ++ addridx++; ++ ++ /* Partial cache lines (fragments) require special measures */ ++ if ((type == PAGELIST_READ) && ++ ((pagelist->offset & (g_cache_line_size - 1)) || ++ ((pagelist->offset + pagelist->length) & ++ (g_cache_line_size - 1)))) { ++ char *fragments; ++ ++ if (down_interruptible(&g_free_fragments_sema) != 0) { ++ kfree(pagelist); ++ return -EINTR; ++ } ++ ++ WARN_ON(g_free_fragments == NULL); ++ ++ down(&g_free_fragments_mutex); ++ fragments = g_free_fragments; ++ WARN_ON(fragments == NULL); ++ g_free_fragments = *(char **) g_free_fragments; ++ up(&g_free_fragments_mutex); ++ pagelist->type = PAGELIST_READ_WITH_FRAGMENTS + ++ (fragments - g_fragments_base) / g_fragments_size; ++ } ++ ++ dmac_flush_range(pagelist, addrs + num_pages); ++ ++ *ppagelist = pagelist; ++ ++ return 0; ++} ++ ++static void ++free_pagelist(PAGELIST_T *pagelist, int actual) ++{ ++ unsigned long *need_release; ++ struct page **pages; ++ unsigned int num_pages, i; ++ ++ vchiq_log_trace(vchiq_arm_log_level, ++ "free_pagelist - %x, %d", (unsigned int)pagelist, actual); ++ ++ num_pages = ++ (pagelist->length + pagelist->offset + PAGE_SIZE - 1) / ++ PAGE_SIZE; ++ ++ need_release = (unsigned long *)(pagelist->addrs + num_pages); ++ pages = (struct page **)(pagelist->addrs + num_pages + 1); ++ ++ /* Deal with any partial cache lines (fragments) */ ++ if (pagelist->type >= PAGELIST_READ_WITH_FRAGMENTS) { ++ char *fragments = g_fragments_base + ++ (pagelist->type - PAGELIST_READ_WITH_FRAGMENTS) * ++ g_fragments_size; ++ int head_bytes, tail_bytes; ++ head_bytes = (g_cache_line_size - pagelist->offset) & ++ (g_cache_line_size - 1); ++ tail_bytes = (pagelist->offset + actual) & ++ (g_cache_line_size - 1); ++ ++ if ((actual >= 0) && (head_bytes != 0)) { ++ if (head_bytes > actual) ++ head_bytes = actual; ++ ++ memcpy((char *)page_address(pages[0]) + ++ pagelist->offset, ++ fragments, ++ head_bytes); ++ } ++ if ((actual >= 0) && (head_bytes < actual) && ++ (tail_bytes != 0)) { ++ memcpy((char *)page_address(pages[num_pages - 1]) + ++ ((pagelist->offset + actual) & ++ (PAGE_SIZE - 1) & ~(g_cache_line_size - 1)), ++ fragments + g_cache_line_size, ++ tail_bytes); ++ } ++ ++ down(&g_free_fragments_mutex); ++ *(char **)fragments = g_free_fragments; ++ g_free_fragments = fragments; ++ up(&g_free_fragments_mutex); ++ up(&g_free_fragments_sema); ++ } ++ ++ if (*need_release) { ++ unsigned int length = pagelist->length; ++ unsigned int offset = pagelist->offset; ++ ++ for (i = 0; i < num_pages; i++) { ++ struct page *pg = pages[i]; ++ ++ if (pagelist->type != PAGELIST_WRITE) { ++ unsigned int bytes = PAGE_SIZE - offset; ++ ++ if (bytes > length) ++ bytes = length; ++ dmac_unmap_area(page_address(pg) + offset, ++ bytes, DMA_FROM_DEVICE); ++ length -= bytes; ++ offset = 0; ++ set_page_dirty(pg); ++ } ++ put_page(pg); ++ } ++ } ++ ++ kfree(pagelist); ++} +diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm.c +new file mode 100644 +index 0000000..51e6018 +--- /dev/null ++++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm.c +@@ -0,0 +1,2920 @@ ++/** ++ * Copyright (c) 2014 Raspberry Pi (Trading) Ltd. All rights reserved. ++ * Copyright (c) 2010-2012 Broadcom. 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, ++ * without modification. ++ * 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. ++ * 3. The names of the above-listed copyright holders may not be used ++ * to endorse or promote products derived from this software without ++ * specific prior written permission. ++ * ++ * ALTERNATIVELY, this software may be distributed under the terms of the ++ * GNU General Public License ("GPL") version 2, as published by the Free ++ * Software Foundation. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER OR ++ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ++ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, ++ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR ++ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF ++ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING ++ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ */ ++ ++#include <linux/kernel.h> ++#include <linux/module.h> ++#include <linux/types.h> ++#include <linux/errno.h> ++#include <linux/cdev.h> ++#include <linux/fs.h> ++#include <linux/device.h> ++#include <linux/mm.h> ++#include <linux/highmem.h> ++#include <linux/pagemap.h> ++#include <linux/bug.h> ++#include <linux/semaphore.h> ++#include <linux/list.h> ++#include <linux/of.h> ++#include <linux/platform_device.h> ++#include <soc/bcm2835/raspberrypi-firmware.h> ++ ++#include "vchiq_core.h" ++#include "vchiq_ioctl.h" ++#include "vchiq_arm.h" ++#include "vchiq_debugfs.h" ++#include "vchiq_killable.h" ++ ++#define DEVICE_NAME "vchiq" ++ ++/* Override the default prefix, which would be vchiq_arm (from the filename) */ ++#undef MODULE_PARAM_PREFIX ++#define MODULE_PARAM_PREFIX DEVICE_NAME "." ++ ++#define VCHIQ_MINOR 0 ++ ++/* Some per-instance constants */ ++#define MAX_COMPLETIONS 16 ++#define MAX_SERVICES 64 ++#define MAX_ELEMENTS 8 ++#define MSG_QUEUE_SIZE 64 ++ ++#define KEEPALIVE_VER 1 ++#define KEEPALIVE_VER_MIN KEEPALIVE_VER ++ ++/* Run time control of log level, based on KERN_XXX level. */ ++int vchiq_arm_log_level = VCHIQ_LOG_DEFAULT; ++int vchiq_susp_log_level = VCHIQ_LOG_ERROR; ++ ++#define SUSPEND_TIMER_TIMEOUT_MS 100 ++#define SUSPEND_RETRY_TIMER_TIMEOUT_MS 1000 ++ ++#define VC_SUSPEND_NUM_OFFSET 3 /* number of values before idle which are -ve */ ++static const char *const suspend_state_names[] = { ++ "VC_SUSPEND_FORCE_CANCELED", ++ "VC_SUSPEND_REJECTED", ++ "VC_SUSPEND_FAILED", ++ "VC_SUSPEND_IDLE", ++ "VC_SUSPEND_REQUESTED", ++ "VC_SUSPEND_IN_PROGRESS", ++ "VC_SUSPEND_SUSPENDED" ++}; ++#define VC_RESUME_NUM_OFFSET 1 /* number of values before idle which are -ve */ ++static const char *const resume_state_names[] = { ++ "VC_RESUME_FAILED", ++ "VC_RESUME_IDLE", ++ "VC_RESUME_REQUESTED", ++ "VC_RESUME_IN_PROGRESS", ++ "VC_RESUME_RESUMED" ++}; ++/* The number of times we allow force suspend to timeout before actually ++** _forcing_ suspend. This is to cater for SW which fails to release vchiq ++** correctly - we don't want to prevent ARM suspend indefinitely in this case. ++*/ ++#define FORCE_SUSPEND_FAIL_MAX 8 ++ ++/* The time in ms allowed for videocore to go idle when force suspend has been ++ * requested */ ++#define FORCE_SUSPEND_TIMEOUT_MS 200 ++ ++ ++static void suspend_timer_callback(unsigned long context); ++ ++ ++typedef struct user_service_struct { ++ VCHIQ_SERVICE_T *service; ++ void *userdata; ++ VCHIQ_INSTANCE_T instance; ++ char is_vchi; ++ char dequeue_pending; ++ char close_pending; ++ int message_available_pos; ++ int msg_insert; ++ int msg_remove; ++ struct semaphore insert_event; ++ struct semaphore remove_event; ++ struct semaphore close_event; ++ VCHIQ_HEADER_T * msg_queue[MSG_QUEUE_SIZE]; ++} USER_SERVICE_T; ++ ++struct bulk_waiter_node { ++ struct bulk_waiter bulk_waiter; ++ int pid; ++ struct list_head list; ++}; ++ ++struct vchiq_instance_struct { ++ VCHIQ_STATE_T *state; ++ VCHIQ_COMPLETION_DATA_T completions[MAX_COMPLETIONS]; ++ int completion_insert; ++ int completion_remove; ++ struct semaphore insert_event; ++ struct semaphore remove_event; ++ struct mutex completion_mutex; ++ ++ int connected; ++ int closing; ++ int pid; ++ int mark; ++ int use_close_delivered; ++ int trace; ++ ++ struct list_head bulk_waiter_list; ++ struct mutex bulk_waiter_list_mutex; ++ ++ VCHIQ_DEBUGFS_NODE_T debugfs_node; ++}; ++ ++typedef struct dump_context_struct { ++ char __user *buf; ++ size_t actual; ++ size_t space; ++ loff_t offset; ++} DUMP_CONTEXT_T; ++ ++static struct cdev vchiq_cdev; ++static dev_t vchiq_devid; ++static VCHIQ_STATE_T g_state; ++static struct class *vchiq_class; ++static struct device *vchiq_dev; ++static DEFINE_SPINLOCK(msg_queue_spinlock); ++ ++static const char *const ioctl_names[] = { ++ "CONNECT", ++ "SHUTDOWN", ++ "CREATE_SERVICE", ++ "REMOVE_SERVICE", ++ "QUEUE_MESSAGE", ++ "QUEUE_BULK_TRANSMIT", ++ "QUEUE_BULK_RECEIVE", ++ "AWAIT_COMPLETION", ++ "DEQUEUE_MESSAGE", ++ "GET_CLIENT_ID", ++ "GET_CONFIG", ++ "CLOSE_SERVICE", ++ "USE_SERVICE", ++ "RELEASE_SERVICE", ++ "SET_SERVICE_OPTION", ++ "DUMP_PHYS_MEM", ++ "LIB_VERSION", ++ "CLOSE_DELIVERED" ++}; ++ ++vchiq_static_assert((sizeof(ioctl_names)/sizeof(ioctl_names[0])) == ++ (VCHIQ_IOC_MAX + 1)); ++ ++static void ++dump_phys_mem(void *virt_addr, uint32_t num_bytes); ++ ++/**************************************************************************** ++* ++* add_completion ++* ++***************************************************************************/ ++ ++static VCHIQ_STATUS_T ++add_completion(VCHIQ_INSTANCE_T instance, VCHIQ_REASON_T reason, ++ VCHIQ_HEADER_T *header, USER_SERVICE_T *user_service, ++ void *bulk_userdata) ++{ ++ VCHIQ_COMPLETION_DATA_T *completion; ++ DEBUG_INITIALISE(g_state.local) ++ ++ mutex_lock(&instance->completion_mutex); ++ ++ while (instance->completion_insert == ++ (instance->completion_remove + MAX_COMPLETIONS)) { ++ /* Out of space - wait for the client */ ++ DEBUG_TRACE(SERVICE_CALLBACK_LINE); ++ vchiq_log_trace(vchiq_arm_log_level, ++ "add_completion - completion queue full"); ++ DEBUG_COUNT(COMPLETION_QUEUE_FULL_COUNT); ++ ++ mutex_unlock(&instance->completion_mutex); ++ if (down_interruptible(&instance->remove_event) != 0) { ++ vchiq_log_info(vchiq_arm_log_level, ++ "service_callback interrupted"); ++ return VCHIQ_RETRY; ++ } ++ ++ mutex_lock(&instance->completion_mutex); ++ if (instance->closing) { ++ mutex_unlock(&instance->completion_mutex); ++ vchiq_log_info(vchiq_arm_log_level, ++ "service_callback closing"); ++ return VCHIQ_SUCCESS; ++ } ++ DEBUG_TRACE(SERVICE_CALLBACK_LINE); ++ } ++ ++ completion = ++ &instance->completions[instance->completion_insert & ++ (MAX_COMPLETIONS - 1)]; ++ ++ completion->header = header; ++ completion->reason = reason; ++ /* N.B. service_userdata is updated while processing AWAIT_COMPLETION */ ++ completion->service_userdata = user_service->service; ++ completion->bulk_userdata = bulk_userdata; ++ ++ if (reason == VCHIQ_SERVICE_CLOSED) { ++ /* Take an extra reference, to be held until ++ this CLOSED notification is delivered. */ ++ lock_service(user_service->service); ++ if (instance->use_close_delivered) ++ user_service->close_pending = 1; ++ } ++ ++ /* A write barrier is needed here to ensure that the entire completion ++ record is written out before the insert point. */ ++ wmb(); ++ ++ if (reason == VCHIQ_MESSAGE_AVAILABLE) ++ user_service->message_available_pos = ++ instance->completion_insert; ++ ++ instance->completion_insert++; ++ ++ mutex_unlock(&instance->completion_mutex); ++ ++ up(&instance->insert_event); ++ ++ return VCHIQ_SUCCESS; ++} ++ ++/**************************************************************************** ++* ++* service_callback ++* ++***************************************************************************/ ++ ++static VCHIQ_STATUS_T ++service_callback(VCHIQ_REASON_T reason, VCHIQ_HEADER_T *header, ++ VCHIQ_SERVICE_HANDLE_T handle, void *bulk_userdata) ++{ ++ /* How do we ensure the callback goes to the right client? ++ ** The service_user data points to a USER_SERVICE_T record containing ++ ** the original callback and the user state structure, which contains a ++ ** circular buffer for completion records. ++ */ ++ USER_SERVICE_T *user_service; ++ VCHIQ_SERVICE_T *service; ++ VCHIQ_INSTANCE_T instance; ++ int skip_completion = 0; ++ DEBUG_INITIALISE(g_state.local) ++ ++ DEBUG_TRACE(SERVICE_CALLBACK_LINE); ++ ++ service = handle_to_service(handle); ++ BUG_ON(!service); ++ user_service = (USER_SERVICE_T *)service->base.userdata; ++ instance = user_service->instance; ++ ++ if (!instance || instance->closing) ++ return VCHIQ_SUCCESS; ++ ++ vchiq_log_trace(vchiq_arm_log_level, ++ "service_callback - service %lx(%d,%p), reason %d, header %lx, " ++ "instance %lx, bulk_userdata %lx", ++ (unsigned long)user_service, ++ service->localport, user_service->userdata, ++ reason, (unsigned long)header, ++ (unsigned long)instance, (unsigned long)bulk_userdata); ++ ++ if (header && user_service->is_vchi) { ++ spin_lock(&msg_queue_spinlock); ++ while (user_service->msg_insert == ++ (user_service->msg_remove + MSG_QUEUE_SIZE)) { ++ spin_unlock(&msg_queue_spinlock); ++ DEBUG_TRACE(SERVICE_CALLBACK_LINE); ++ DEBUG_COUNT(MSG_QUEUE_FULL_COUNT); ++ vchiq_log_trace(vchiq_arm_log_level, ++ "service_callback - msg queue full"); ++ /* If there is no MESSAGE_AVAILABLE in the completion ++ ** queue, add one ++ */ ++ if ((user_service->message_available_pos - ++ instance->completion_remove) < 0) { ++ VCHIQ_STATUS_T status; ++ vchiq_log_info(vchiq_arm_log_level, ++ "Inserting extra MESSAGE_AVAILABLE"); ++ DEBUG_TRACE(SERVICE_CALLBACK_LINE); ++ status = add_completion(instance, reason, ++ NULL, user_service, bulk_userdata); ++ if (status != VCHIQ_SUCCESS) { ++ DEBUG_TRACE(SERVICE_CALLBACK_LINE); ++ return status; ++ } ++ } ++ ++ DEBUG_TRACE(SERVICE_CALLBACK_LINE); ++ if (down_interruptible(&user_service->remove_event) ++ != 0) { ++ vchiq_log_info(vchiq_arm_log_level, ++ "service_callback interrupted"); ++ DEBUG_TRACE(SERVICE_CALLBACK_LINE); ++ return VCHIQ_RETRY; ++ } else if (instance->closing) { ++ vchiq_log_info(vchiq_arm_log_level, ++ "service_callback closing"); ++ DEBUG_TRACE(SERVICE_CALLBACK_LINE); ++ return VCHIQ_ERROR; ++ } ++ DEBUG_TRACE(SERVICE_CALLBACK_LINE); ++ spin_lock(&msg_queue_spinlock); ++ } ++ ++ user_service->msg_queue[user_service->msg_insert & ++ (MSG_QUEUE_SIZE - 1)] = header; ++ user_service->msg_insert++; ++ ++ /* If there is a thread waiting in DEQUEUE_MESSAGE, or if ++ ** there is a MESSAGE_AVAILABLE in the completion queue then ++ ** bypass the completion queue. ++ */ ++ if (((user_service->message_available_pos - ++ instance->completion_remove) >= 0) || ++ user_service->dequeue_pending) { ++ user_service->dequeue_pending = 0; ++ skip_completion = 1; ++ } ++ ++ spin_unlock(&msg_queue_spinlock); ++ ++ up(&user_service->insert_event); ++ ++ header = NULL; ++ } ++ ++ if (skip_completion) { ++ DEBUG_TRACE(SERVICE_CALLBACK_LINE); ++ return VCHIQ_SUCCESS; ++ } ++ ++ DEBUG_TRACE(SERVICE_CALLBACK_LINE); ++ ++ return add_completion(instance, reason, header, user_service, ++ bulk_userdata); ++} ++ ++/**************************************************************************** ++* ++* user_service_free ++* ++***************************************************************************/ ++static void ++user_service_free(void *userdata) ++{ ++ kfree(userdata); ++} ++ ++/**************************************************************************** ++* ++* close_delivered ++* ++***************************************************************************/ ++static void close_delivered(USER_SERVICE_T *user_service) ++{ ++ vchiq_log_info(vchiq_arm_log_level, ++ "close_delivered(handle=%x)", ++ user_service->service->handle); ++ ++ if (user_service->close_pending) { ++ /* Allow the underlying service to be culled */ ++ unlock_service(user_service->service); ++ ++ /* Wake the user-thread blocked in close_ or remove_service */ ++ up(&user_service->close_event); ++ ++ user_service->close_pending = 0; ++ } ++} ++ ++/**************************************************************************** ++* ++* vchiq_ioctl ++* ++***************************************************************************/ ++static long ++vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ++{ ++ VCHIQ_INSTANCE_T instance = file->private_data; ++ VCHIQ_STATUS_T status = VCHIQ_SUCCESS; ++ VCHIQ_SERVICE_T *service = NULL; ++ long ret = 0; ++ int i, rc; ++ DEBUG_INITIALISE(g_state.local) ++ ++ vchiq_log_trace(vchiq_arm_log_level, ++ "vchiq_ioctl - instance %x, cmd %s, arg %lx", ++ (unsigned int)instance, ++ ((_IOC_TYPE(cmd) == VCHIQ_IOC_MAGIC) && ++ (_IOC_NR(cmd) <= VCHIQ_IOC_MAX)) ? ++ ioctl_names[_IOC_NR(cmd)] : "<invalid>", arg); ++ ++ switch (cmd) { ++ case VCHIQ_IOC_SHUTDOWN: ++ if (!instance->connected) ++ break; ++ ++ /* Remove all services */ ++ i = 0; ++ while ((service = next_service_by_instance(instance->state, ++ instance, &i)) != NULL) { ++ status = vchiq_remove_service(service->handle); ++ unlock_service(service); ++ if (status != VCHIQ_SUCCESS) ++ break; ++ } ++ service = NULL; ++ ++ if (status == VCHIQ_SUCCESS) { ++ /* Wake the completion thread and ask it to exit */ ++ instance->closing = 1; ++ up(&instance->insert_event); ++ } ++ ++ break; ++ ++ case VCHIQ_IOC_CONNECT: ++ if (instance->connected) { ++ ret = -EINVAL; ++ break; ++ } ++ rc = mutex_lock_interruptible(&instance->state->mutex); ++ if (rc != 0) { ++ vchiq_log_error(vchiq_arm_log_level, ++ "vchiq: connect: could not lock mutex for " ++ "state %d: %d", ++ instance->state->id, rc); ++ ret = -EINTR; ++ break; ++ } ++ status = vchiq_connect_internal(instance->state, instance); ++ mutex_unlock(&instance->state->mutex); ++ ++ if (status == VCHIQ_SUCCESS) ++ instance->connected = 1; ++ else ++ vchiq_log_error(vchiq_arm_log_level, ++ "vchiq: could not connect: %d", status); ++ break; ++ ++ case VCHIQ_IOC_CREATE_SERVICE: { ++ VCHIQ_CREATE_SERVICE_T args; ++ USER_SERVICE_T *user_service = NULL; ++ void *userdata; ++ int srvstate; ++ ++ if (copy_from_user ++ (&args, (const void __user *)arg, ++ sizeof(args)) != 0) { ++ ret = -EFAULT; ++ break; ++ } ++ ++ user_service = kmalloc(sizeof(USER_SERVICE_T), GFP_KERNEL); ++ if (!user_service) { ++ ret = -ENOMEM; ++ break; ++ } ++ ++ if (args.is_open) { ++ if (!instance->connected) { ++ ret = -ENOTCONN; ++ kfree(user_service); ++ break; ++ } ++ srvstate = VCHIQ_SRVSTATE_OPENING; ++ } else { ++ srvstate = ++ instance->connected ? ++ VCHIQ_SRVSTATE_LISTENING : ++ VCHIQ_SRVSTATE_HIDDEN; ++ } ++ ++ userdata = args.params.userdata; ++ args.params.callback = service_callback; ++ args.params.userdata = user_service; ++ service = vchiq_add_service_internal( ++ instance->state, ++ &args.params, srvstate, ++ instance, user_service_free); ++ ++ if (service != NULL) { ++ user_service->service = service; ++ user_service->userdata = userdata; ++ user_service->instance = instance; ++ user_service->is_vchi = (args.is_vchi != 0); ++ user_service->dequeue_pending = 0; ++ user_service->close_pending = 0; ++ user_service->message_available_pos = ++ instance->completion_remove - 1; ++ user_service->msg_insert = 0; ++ user_service->msg_remove = 0; ++ sema_init(&user_service->insert_event, 0); ++ sema_init(&user_service->remove_event, 0); ++ sema_init(&user_service->close_event, 0); ++ ++ if (args.is_open) { ++ status = vchiq_open_service_internal ++ (service, instance->pid); ++ if (status != VCHIQ_SUCCESS) { ++ vchiq_remove_service(service->handle); ++ service = NULL; ++ ret = (status == VCHIQ_RETRY) ? ++ -EINTR : -EIO; ++ break; ++ } ++ } ++ ++ if (copy_to_user((void __user *) ++ &(((VCHIQ_CREATE_SERVICE_T __user *) ++ arg)->handle), ++ (const void *)&service->handle, ++ sizeof(service->handle)) != 0) { ++ ret = -EFAULT; ++ vchiq_remove_service(service->handle); ++ } ++ ++ service = NULL; ++ } else { ++ ret = -EEXIST; ++ kfree(user_service); ++ } ++ } break; ++ ++ case VCHIQ_IOC_CLOSE_SERVICE: { ++ VCHIQ_SERVICE_HANDLE_T handle = (VCHIQ_SERVICE_HANDLE_T)arg; ++ ++ service = find_service_for_instance(instance, handle); ++ if (service != NULL) { ++ USER_SERVICE_T *user_service = ++ (USER_SERVICE_T *)service->base.userdata; ++ /* close_pending is false on first entry, and when the ++ wait in vchiq_close_service has been interrupted. */ ++ if (!user_service->close_pending) { ++ status = vchiq_close_service(service->handle); ++ if (status != VCHIQ_SUCCESS) ++ break; ++ } ++ ++ /* close_pending is true once the underlying service ++ has been closed until the client library calls the ++ CLOSE_DELIVERED ioctl, signalling close_event. */ ++ if (user_service->close_pending && ++ down_interruptible(&user_service->close_event)) ++ status = VCHIQ_RETRY; ++ } ++ else ++ ret = -EINVAL; ++ } break; ++ ++ case VCHIQ_IOC_REMOVE_SERVICE: { ++ VCHIQ_SERVICE_HANDLE_T handle = (VCHIQ_SERVICE_HANDLE_T)arg; ++ ++ service = find_service_for_instance(instance, handle); ++ if (service != NULL) { ++ USER_SERVICE_T *user_service = ++ (USER_SERVICE_T *)service->base.userdata; ++ /* close_pending is false on first entry, and when the ++ wait in vchiq_close_service has been interrupted. */ ++ if (!user_service->close_pending) { ++ status = vchiq_remove_service(service->handle); ++ if (status != VCHIQ_SUCCESS) ++ break; ++ } ++ ++ /* close_pending is true once the underlying service ++ has been closed until the client library calls the ++ CLOSE_DELIVERED ioctl, signalling close_event. */ ++ if (user_service->close_pending && ++ down_interruptible(&user_service->close_event)) ++ status = VCHIQ_RETRY; ++ } ++ else ++ ret = -EINVAL; ++ } break; ++ ++ case VCHIQ_IOC_USE_SERVICE: ++ case VCHIQ_IOC_RELEASE_SERVICE: { ++ VCHIQ_SERVICE_HANDLE_T handle = (VCHIQ_SERVICE_HANDLE_T)arg; ++ ++ service = find_service_for_instance(instance, handle); ++ if (service != NULL) { ++ status = (cmd == VCHIQ_IOC_USE_SERVICE) ? ++ vchiq_use_service_internal(service) : ++ vchiq_release_service_internal(service); ++ if (status != VCHIQ_SUCCESS) { ++ vchiq_log_error(vchiq_susp_log_level, ++ "%s: cmd %s returned error %d for " ++ "service %c%c%c%c:%03d", ++ __func__, ++ (cmd == VCHIQ_IOC_USE_SERVICE) ? ++ "VCHIQ_IOC_USE_SERVICE" : ++ "VCHIQ_IOC_RELEASE_SERVICE", ++ status, ++ VCHIQ_FOURCC_AS_4CHARS( ++ service->base.fourcc), ++ service->client_id); ++ ret = -EINVAL; ++ } ++ } else ++ ret = -EINVAL; ++ } break; ++ ++ case VCHIQ_IOC_QUEUE_MESSAGE: { ++ VCHIQ_QUEUE_MESSAGE_T args; ++ if (copy_from_user ++ (&args, (const void __user *)arg, ++ sizeof(args)) != 0) { ++ ret = -EFAULT; ++ break; ++ } ++ ++ service = find_service_for_instance(instance, args.handle); ++ ++ if ((service != NULL) && (args.count <= MAX_ELEMENTS)) { ++ /* Copy elements into kernel space */ ++ VCHIQ_ELEMENT_T elements[MAX_ELEMENTS]; ++ if (copy_from_user(elements, args.elements, ++ args.count * sizeof(VCHIQ_ELEMENT_T)) == 0) ++ status = vchiq_queue_message ++ (args.handle, ++ elements, args.count); ++ else ++ ret = -EFAULT; ++ } else { ++ ret = -EINVAL; ++ } ++ } break; ++ ++ case VCHIQ_IOC_QUEUE_BULK_TRANSMIT: ++ case VCHIQ_IOC_QUEUE_BULK_RECEIVE: { ++ VCHIQ_QUEUE_BULK_TRANSFER_T args; ++ struct bulk_waiter_node *waiter = NULL; ++ VCHIQ_BULK_DIR_T dir = ++ (cmd == VCHIQ_IOC_QUEUE_BULK_TRANSMIT) ? ++ VCHIQ_BULK_TRANSMIT : VCHIQ_BULK_RECEIVE; ++ ++ if (copy_from_user ++ (&args, (const void __user *)arg, ++ sizeof(args)) != 0) { ++ ret = -EFAULT; ++ break; ++ } ++ ++ service = find_service_for_instance(instance, args.handle); ++ if (!service) { ++ ret = -EINVAL; ++ break; ++ } ++ ++ if (args.mode == VCHIQ_BULK_MODE_BLOCKING) { ++ waiter = kzalloc(sizeof(struct bulk_waiter_node), ++ GFP_KERNEL); ++ if (!waiter) { ++ ret = -ENOMEM; ++ break; ++ } ++ args.userdata = &waiter->bulk_waiter; ++ } else if (args.mode == VCHIQ_BULK_MODE_WAITING) { ++ struct list_head *pos; ++ mutex_lock(&instance->bulk_waiter_list_mutex); ++ list_for_each(pos, &instance->bulk_waiter_list) { ++ if (list_entry(pos, struct bulk_waiter_node, ++ list)->pid == current->pid) { ++ waiter = list_entry(pos, ++ struct bulk_waiter_node, ++ list); ++ list_del(pos); ++ break; ++ } ++ ++ } ++ mutex_unlock(&instance->bulk_waiter_list_mutex); ++ if (!waiter) { ++ vchiq_log_error(vchiq_arm_log_level, ++ "no bulk_waiter found for pid %d", ++ current->pid); ++ ret = -ESRCH; ++ break; ++ } ++ vchiq_log_info(vchiq_arm_log_level, ++ "found bulk_waiter %x for pid %d", ++ (unsigned int)waiter, current->pid); ++ args.userdata = &waiter->bulk_waiter; ++ } ++ status = vchiq_bulk_transfer ++ (args.handle, ++ VCHI_MEM_HANDLE_INVALID, ++ args.data, args.size, ++ args.userdata, args.mode, ++ dir); ++ if (!waiter) ++ break; ++ if ((status != VCHIQ_RETRY) || fatal_signal_pending(current) || ++ !waiter->bulk_waiter.bulk) { ++ if (waiter->bulk_waiter.bulk) { ++ /* Cancel the signal when the transfer ++ ** completes. */ ++ spin_lock(&bulk_waiter_spinlock); ++ waiter->bulk_waiter.bulk->userdata = NULL; ++ spin_unlock(&bulk_waiter_spinlock); ++ } ++ kfree(waiter); ++ } else { ++ const VCHIQ_BULK_MODE_T mode_waiting = ++ VCHIQ_BULK_MODE_WAITING; ++ waiter->pid = current->pid; ++ mutex_lock(&instance->bulk_waiter_list_mutex); ++ list_add(&waiter->list, &instance->bulk_waiter_list); ++ mutex_unlock(&instance->bulk_waiter_list_mutex); ++ vchiq_log_info(vchiq_arm_log_level, ++ "saved bulk_waiter %x for pid %d", ++ (unsigned int)waiter, current->pid); ++ ++ if (copy_to_user((void __user *) ++ &(((VCHIQ_QUEUE_BULK_TRANSFER_T __user *) ++ arg)->mode), ++ (const void *)&mode_waiting, ++ sizeof(mode_waiting)) != 0) ++ ret = -EFAULT; ++ } ++ } break; ++ ++ case VCHIQ_IOC_AWAIT_COMPLETION: { ++ VCHIQ_AWAIT_COMPLETION_T args; ++ ++ DEBUG_TRACE(AWAIT_COMPLETION_LINE); ++ if (!instance->connected) { ++ ret = -ENOTCONN; ++ break; ++ } ++ ++ if (copy_from_user(&args, (const void __user *)arg, ++ sizeof(args)) != 0) { ++ ret = -EFAULT; ++ break; ++ } ++ ++ mutex_lock(&instance->completion_mutex); ++ ++ DEBUG_TRACE(AWAIT_COMPLETION_LINE); ++ while ((instance->completion_remove == ++ instance->completion_insert) ++ && !instance->closing) { ++ int rc; ++ DEBUG_TRACE(AWAIT_COMPLETION_LINE); ++ mutex_unlock(&instance->completion_mutex); ++ rc = down_interruptible(&instance->insert_event); ++ mutex_lock(&instance->completion_mutex); ++ if (rc != 0) { ++ DEBUG_TRACE(AWAIT_COMPLETION_LINE); ++ vchiq_log_info(vchiq_arm_log_level, ++ "AWAIT_COMPLETION interrupted"); ++ ret = -EINTR; ++ break; ++ } ++ } ++ DEBUG_TRACE(AWAIT_COMPLETION_LINE); ++ ++ /* A read memory barrier is needed to stop prefetch of a stale ++ ** completion record ++ */ ++ rmb(); ++ ++ if (ret == 0) { ++ int msgbufcount = args.msgbufcount; ++ for (ret = 0; ret < args.count; ret++) { ++ VCHIQ_COMPLETION_DATA_T *completion; ++ VCHIQ_SERVICE_T *service; ++ USER_SERVICE_T *user_service; ++ VCHIQ_HEADER_T *header; ++ if (instance->completion_remove == ++ instance->completion_insert) ++ break; ++ completion = &instance->completions[ ++ instance->completion_remove & ++ (MAX_COMPLETIONS - 1)]; ++ ++ service = completion->service_userdata; ++ user_service = service->base.userdata; ++ completion->service_userdata = ++ user_service->userdata; ++ ++ header = completion->header; ++ if (header) { ++ void __user *msgbuf; ++ int msglen; ++ ++ msglen = header->size + ++ sizeof(VCHIQ_HEADER_T); ++ /* This must be a VCHIQ-style service */ ++ if (args.msgbufsize < msglen) { ++ vchiq_log_error( ++ vchiq_arm_log_level, ++ "header %x: msgbufsize" ++ " %x < msglen %x", ++ (unsigned int)header, ++ args.msgbufsize, ++ msglen); ++ WARN(1, "invalid message " ++ "size\n"); ++ if (ret == 0) ++ ret = -EMSGSIZE; ++ break; ++ } ++ if (msgbufcount <= 0) ++ /* Stall here for lack of a ++ ** buffer for the message. */ ++ break; ++ /* Get the pointer from user space */ ++ msgbufcount--; ++ if (copy_from_user(&msgbuf, ++ (const void __user *) ++ &args.msgbufs[msgbufcount], ++ sizeof(msgbuf)) != 0) { ++ if (ret == 0) ++ ret = -EFAULT; ++ break; ++ } ++ ++ /* Copy the message to user space */ ++ if (copy_to_user(msgbuf, header, ++ msglen) != 0) { ++ if (ret == 0) ++ ret = -EFAULT; ++ break; ++ } ++ ++ /* Now it has been copied, the message ++ ** can be released. */ ++ vchiq_release_message(service->handle, ++ header); ++ ++ /* The completion must point to the ++ ** msgbuf. */ ++ completion->header = msgbuf; ++ } ++ ++ if ((completion->reason == ++ VCHIQ_SERVICE_CLOSED) && ++ !instance->use_close_delivered) ++ unlock_service(service); ++ ++ if (copy_to_user((void __user *)( ++ (size_t)args.buf + ++ ret * sizeof(VCHIQ_COMPLETION_DATA_T)), ++ completion, ++ sizeof(VCHIQ_COMPLETION_DATA_T)) != 0) { ++ if (ret == 0) ++ ret = -EFAULT; ++ break; ++ } ++ ++ instance->completion_remove++; ++ } ++ ++ if (msgbufcount != args.msgbufcount) { ++ if (copy_to_user((void __user *) ++ &((VCHIQ_AWAIT_COMPLETION_T *)arg)-> ++ msgbufcount, ++ &msgbufcount, ++ sizeof(msgbufcount)) != 0) { ++ ret = -EFAULT; ++ } ++ } ++ } ++ ++ if (ret != 0) ++ up(&instance->remove_event); ++ mutex_unlock(&instance->completion_mutex); ++ DEBUG_TRACE(AWAIT_COMPLETION_LINE); ++ } break; ++ ++ case VCHIQ_IOC_DEQUEUE_MESSAGE: { ++ VCHIQ_DEQUEUE_MESSAGE_T args; ++ USER_SERVICE_T *user_service; ++ VCHIQ_HEADER_T *header; ++ ++ DEBUG_TRACE(DEQUEUE_MESSAGE_LINE); ++ if (copy_from_user ++ (&args, (const void __user *)arg, ++ sizeof(args)) != 0) { ++ ret = -EFAULT; ++ break; ++ } ++ service = find_service_for_instance(instance, args.handle); ++ if (!service) { ++ ret = -EINVAL; ++ break; ++ } ++ user_service = (USER_SERVICE_T *)service->base.userdata; ++ if (user_service->is_vchi == 0) { ++ ret = -EINVAL; ++ break; ++ } ++ ++ spin_lock(&msg_queue_spinlock); ++ if (user_service->msg_remove == user_service->msg_insert) { ++ if (!args.blocking) { ++ spin_unlock(&msg_queue_spinlock); ++ DEBUG_TRACE(DEQUEUE_MESSAGE_LINE); ++ ret = -EWOULDBLOCK; ++ break; ++ } ++ user_service->dequeue_pending = 1; ++ do { ++ spin_unlock(&msg_queue_spinlock); ++ DEBUG_TRACE(DEQUEUE_MESSAGE_LINE); ++ if (down_interruptible( ++ &user_service->insert_event) != 0) { ++ vchiq_log_info(vchiq_arm_log_level, ++ "DEQUEUE_MESSAGE interrupted"); ++ ret = -EINTR; ++ break; ++ } ++ spin_lock(&msg_queue_spinlock); ++ } while (user_service->msg_remove == ++ user_service->msg_insert); ++ ++ if (ret) ++ break; ++ } ++ ++ BUG_ON((int)(user_service->msg_insert - ++ user_service->msg_remove) < 0); ++ ++ header = user_service->msg_queue[user_service->msg_remove & ++ (MSG_QUEUE_SIZE - 1)]; ++ user_service->msg_remove++; ++ spin_unlock(&msg_queue_spinlock); ++ ++ up(&user_service->remove_event); ++ if (header == NULL) ++ ret = -ENOTCONN; ++ else if (header->size <= args.bufsize) { ++ /* Copy to user space if msgbuf is not NULL */ ++ if ((args.buf == NULL) || ++ (copy_to_user((void __user *)args.buf, ++ header->data, ++ header->size) == 0)) { ++ ret = header->size; ++ vchiq_release_message( ++ service->handle, ++ header); ++ } else ++ ret = -EFAULT; ++ } else { ++ vchiq_log_error(vchiq_arm_log_level, ++ "header %x: bufsize %x < size %x", ++ (unsigned int)header, args.bufsize, ++ header->size); ++ WARN(1, "invalid size\n"); ++ ret = -EMSGSIZE; ++ } ++ DEBUG_TRACE(DEQUEUE_MESSAGE_LINE); ++ } break; ++ ++ case VCHIQ_IOC_GET_CLIENT_ID: { ++ VCHIQ_SERVICE_HANDLE_T handle = (VCHIQ_SERVICE_HANDLE_T)arg; ++ ++ ret = vchiq_get_client_id(handle); ++ } break; ++ ++ case VCHIQ_IOC_GET_CONFIG: { ++ VCHIQ_GET_CONFIG_T args; ++ VCHIQ_CONFIG_T config; ++ ++ if (copy_from_user(&args, (const void __user *)arg, ++ sizeof(args)) != 0) { ++ ret = -EFAULT; ++ break; ++ } ++ if (args.config_size > sizeof(config)) { ++ ret = -EINVAL; ++ break; ++ } ++ status = vchiq_get_config(instance, args.config_size, &config); ++ if (status == VCHIQ_SUCCESS) { ++ if (copy_to_user((void __user *)args.pconfig, ++ &config, args.config_size) != 0) { ++ ret = -EFAULT; ++ break; ++ } ++ } ++ } break; ++ ++ case VCHIQ_IOC_SET_SERVICE_OPTION: { ++ VCHIQ_SET_SERVICE_OPTION_T args; ++ ++ if (copy_from_user( ++ &args, (const void __user *)arg, ++ sizeof(args)) != 0) { ++ ret = -EFAULT; ++ break; ++ } ++ ++ service = find_service_for_instance(instance, args.handle); ++ if (!service) { ++ ret = -EINVAL; ++ break; ++ } ++ ++ status = vchiq_set_service_option( ++ args.handle, args.option, args.value); ++ } break; ++ ++ case VCHIQ_IOC_DUMP_PHYS_MEM: { ++ VCHIQ_DUMP_MEM_T args; ++ ++ if (copy_from_user ++ (&args, (const void __user *)arg, ++ sizeof(args)) != 0) { ++ ret = -EFAULT; ++ break; ++ } ++ dump_phys_mem(args.virt_addr, args.num_bytes); ++ } break; ++ ++ case VCHIQ_IOC_LIB_VERSION: { ++ unsigned int lib_version = (unsigned int)arg; ++ ++ if (lib_version < VCHIQ_VERSION_MIN) ++ ret = -EINVAL; ++ else if (lib_version >= VCHIQ_VERSION_CLOSE_DELIVERED) ++ instance->use_close_delivered = 1; ++ } break; ++ ++ case VCHIQ_IOC_CLOSE_DELIVERED: { ++ VCHIQ_SERVICE_HANDLE_T handle = (VCHIQ_SERVICE_HANDLE_T)arg; ++ ++ service = find_closed_service_for_instance(instance, handle); ++ if (service != NULL) { ++ USER_SERVICE_T *user_service = ++ (USER_SERVICE_T *)service->base.userdata; ++ close_delivered(user_service); ++ } ++ else ++ ret = -EINVAL; ++ } break; ++ ++ default: ++ ret = -ENOTTY; ++ break; ++ } ++ ++ if (service) ++ unlock_service(service); ++ ++ if (ret == 0) { ++ if (status == VCHIQ_ERROR) ++ ret = -EIO; ++ else if (status == VCHIQ_RETRY) ++ ret = -EINTR; ++ } ++ ++ if ((status == VCHIQ_SUCCESS) && (ret < 0) && (ret != -EINTR) && ++ (ret != -EWOULDBLOCK)) ++ vchiq_log_info(vchiq_arm_log_level, ++ " ioctl instance %lx, cmd %s -> status %d, %ld", ++ (unsigned long)instance, ++ (_IOC_NR(cmd) <= VCHIQ_IOC_MAX) ? ++ ioctl_names[_IOC_NR(cmd)] : ++ "<invalid>", ++ status, ret); ++ else ++ vchiq_log_trace(vchiq_arm_log_level, ++ " ioctl instance %lx, cmd %s -> status %d, %ld", ++ (unsigned long)instance, ++ (_IOC_NR(cmd) <= VCHIQ_IOC_MAX) ? ++ ioctl_names[_IOC_NR(cmd)] : ++ "<invalid>", ++ status, ret); ++ ++ return ret; ++} ++ ++/**************************************************************************** ++* ++* vchiq_open ++* ++***************************************************************************/ ++ ++static int ++vchiq_open(struct inode *inode, struct file *file) ++{ ++ int dev = iminor(inode) & 0x0f; ++ vchiq_log_info(vchiq_arm_log_level, "vchiq_open"); ++ switch (dev) { ++ case VCHIQ_MINOR: { ++ int ret; ++ VCHIQ_STATE_T *state = vchiq_get_state(); ++ VCHIQ_INSTANCE_T instance; ++ ++ if (!state) { ++ vchiq_log_error(vchiq_arm_log_level, ++ "vchiq has no connection to VideoCore"); ++ return -ENOTCONN; ++ } ++ ++ instance = kzalloc(sizeof(*instance), GFP_KERNEL); ++ if (!instance) ++ return -ENOMEM; ++ ++ instance->state = state; ++ instance->pid = current->tgid; ++ ++ ret = vchiq_debugfs_add_instance(instance); ++ if (ret != 0) { ++ kfree(instance); ++ return ret; ++ } ++ ++ sema_init(&instance->insert_event, 0); ++ sema_init(&instance->remove_event, 0); ++ mutex_init(&instance->completion_mutex); ++ mutex_init(&instance->bulk_waiter_list_mutex); ++ INIT_LIST_HEAD(&instance->bulk_waiter_list); ++ ++ file->private_data = instance; ++ } break; ++ ++ default: ++ vchiq_log_error(vchiq_arm_log_level, ++ "Unknown minor device: %d", dev); ++ return -ENXIO; ++ } ++ ++ return 0; ++} ++ ++/**************************************************************************** ++* ++* vchiq_release ++* ++***************************************************************************/ ++ ++static int ++vchiq_release(struct inode *inode, struct file *file) ++{ ++ int dev = iminor(inode) & 0x0f; ++ int ret = 0; ++ switch (dev) { ++ case VCHIQ_MINOR: { ++ VCHIQ_INSTANCE_T instance = file->private_data; ++ VCHIQ_STATE_T *state = vchiq_get_state(); ++ VCHIQ_SERVICE_T *service; ++ int i; ++ ++ vchiq_log_info(vchiq_arm_log_level, ++ "vchiq_release: instance=%lx", ++ (unsigned long)instance); ++ ++ if (!state) { ++ ret = -EPERM; ++ goto out; ++ } ++ ++ /* Ensure videocore is awake to allow termination. */ ++ vchiq_use_internal(instance->state, NULL, ++ USE_TYPE_VCHIQ); ++ ++ mutex_lock(&instance->completion_mutex); ++ ++ /* Wake the completion thread and ask it to exit */ ++ instance->closing = 1; ++ up(&instance->insert_event); ++ ++ mutex_unlock(&instance->completion_mutex); ++ ++ /* Wake the slot handler if the completion queue is full. */ ++ up(&instance->remove_event); ++ ++ /* Mark all services for termination... */ ++ i = 0; ++ while ((service = next_service_by_instance(state, instance, ++ &i)) != NULL) { ++ USER_SERVICE_T *user_service = service->base.userdata; ++ ++ /* Wake the slot handler if the msg queue is full. */ ++ up(&user_service->remove_event); ++ ++ vchiq_terminate_service_internal(service); ++ unlock_service(service); ++ } ++ ++ /* ...and wait for them to die */ ++ i = 0; ++ while ((service = next_service_by_instance(state, instance, &i)) ++ != NULL) { ++ USER_SERVICE_T *user_service = service->base.userdata; ++ ++ down(&service->remove_event); ++ ++ BUG_ON(service->srvstate != VCHIQ_SRVSTATE_FREE); ++ ++ spin_lock(&msg_queue_spinlock); ++ ++ while (user_service->msg_remove != ++ user_service->msg_insert) { ++ VCHIQ_HEADER_T *header = user_service-> ++ msg_queue[user_service->msg_remove & ++ (MSG_QUEUE_SIZE - 1)]; ++ user_service->msg_remove++; ++ spin_unlock(&msg_queue_spinlock); ++ ++ if (header) ++ vchiq_release_message( ++ service->handle, ++ header); ++ spin_lock(&msg_queue_spinlock); ++ } ++ ++ spin_unlock(&msg_queue_spinlock); ++ ++ unlock_service(service); ++ } ++ ++ /* Release any closed services */ ++ while (instance->completion_remove != ++ instance->completion_insert) { ++ VCHIQ_COMPLETION_DATA_T *completion; ++ VCHIQ_SERVICE_T *service; ++ completion = &instance->completions[ ++ instance->completion_remove & ++ (MAX_COMPLETIONS - 1)]; ++ service = completion->service_userdata; ++ if (completion->reason == VCHIQ_SERVICE_CLOSED) ++ { ++ USER_SERVICE_T *user_service = ++ service->base.userdata; ++ ++ /* Wake any blocked user-thread */ ++ if (instance->use_close_delivered) ++ up(&user_service->close_event); ++ unlock_service(service); ++ } ++ instance->completion_remove++; ++ } ++ ++ /* Release the PEER service count. */ ++ vchiq_release_internal(instance->state, NULL); ++ ++ { ++ struct list_head *pos, *next; ++ list_for_each_safe(pos, next, ++ &instance->bulk_waiter_list) { ++ struct bulk_waiter_node *waiter; ++ waiter = list_entry(pos, ++ struct bulk_waiter_node, ++ list); ++ list_del(pos); ++ vchiq_log_info(vchiq_arm_log_level, ++ "bulk_waiter - cleaned up %x " ++ "for pid %d", ++ (unsigned int)waiter, waiter->pid); ++ kfree(waiter); ++ } ++ } ++ ++ vchiq_debugfs_remove_instance(instance); ++ ++ kfree(instance); ++ file->private_data = NULL; ++ } break; ++ ++ default: ++ vchiq_log_error(vchiq_arm_log_level, ++ "Unknown minor device: %d", dev); ++ ret = -ENXIO; ++ } ++ ++out: ++ return ret; ++} ++ ++/**************************************************************************** ++* ++* vchiq_dump ++* ++***************************************************************************/ ++ ++void ++vchiq_dump(void *dump_context, const char *str, int len) ++{ ++ DUMP_CONTEXT_T *context = (DUMP_CONTEXT_T *)dump_context; ++ ++ if (context->actual < context->space) { ++ int copy_bytes; ++ if (context->offset > 0) { ++ int skip_bytes = min(len, (int)context->offset); ++ str += skip_bytes; ++ len -= skip_bytes; ++ context->offset -= skip_bytes; ++ if (context->offset > 0) ++ return; ++ } ++ copy_bytes = min(len, (int)(context->space - context->actual)); ++ if (copy_bytes == 0) ++ return; ++ if (copy_to_user(context->buf + context->actual, str, ++ copy_bytes)) ++ context->actual = -EFAULT; ++ context->actual += copy_bytes; ++ len -= copy_bytes; ++ ++ /* If tne terminating NUL is included in the length, then it ++ ** marks the end of a line and should be replaced with a ++ ** carriage return. */ ++ if ((len == 0) && (str[copy_bytes - 1] == '\0')) { ++ char cr = '\n'; ++ if (copy_to_user(context->buf + context->actual - 1, ++ &cr, 1)) ++ context->actual = -EFAULT; ++ } ++ } ++} ++ ++/**************************************************************************** ++* ++* vchiq_dump_platform_instance_state ++* ++***************************************************************************/ ++ ++void ++vchiq_dump_platform_instances(void *dump_context) ++{ ++ VCHIQ_STATE_T *state = vchiq_get_state(); ++ char buf[80]; ++ int len; ++ int i; ++ ++ /* There is no list of instances, so instead scan all services, ++ marking those that have been dumped. */ ++ ++ for (i = 0; i < state->unused_service; i++) { ++ VCHIQ_SERVICE_T *service = state->services[i]; ++ VCHIQ_INSTANCE_T instance; ++ ++ if (service && (service->base.callback == service_callback)) { ++ instance = service->instance; ++ if (instance) ++ instance->mark = 0; ++ } ++ } ++ ++ for (i = 0; i < state->unused_service; i++) { ++ VCHIQ_SERVICE_T *service = state->services[i]; ++ VCHIQ_INSTANCE_T instance; ++ ++ if (service && (service->base.callback == service_callback)) { ++ instance = service->instance; ++ if (instance && !instance->mark) { ++ len = snprintf(buf, sizeof(buf), ++ "Instance %x: pid %d,%s completions " ++ "%d/%d", ++ (unsigned int)instance, instance->pid, ++ instance->connected ? " connected, " : ++ "", ++ instance->completion_insert - ++ instance->completion_remove, ++ MAX_COMPLETIONS); ++ ++ vchiq_dump(dump_context, buf, len + 1); ++ ++ instance->mark = 1; ++ } ++ } ++ } ++} ++ ++/**************************************************************************** ++* ++* vchiq_dump_platform_service_state ++* ++***************************************************************************/ ++ ++void ++vchiq_dump_platform_service_state(void *dump_context, VCHIQ_SERVICE_T *service) ++{ ++ USER_SERVICE_T *user_service = (USER_SERVICE_T *)service->base.userdata; ++ char buf[80]; ++ int len; ++ ++ len = snprintf(buf, sizeof(buf), " instance %x", ++ (unsigned int)service->instance); ++ ++ if ((service->base.callback == service_callback) && ++ user_service->is_vchi) { ++ len += snprintf(buf + len, sizeof(buf) - len, ++ ", %d/%d messages", ++ user_service->msg_insert - user_service->msg_remove, ++ MSG_QUEUE_SIZE); ++ ++ if (user_service->dequeue_pending) ++ len += snprintf(buf + len, sizeof(buf) - len, ++ " (dequeue pending)"); ++ } ++ ++ vchiq_dump(dump_context, buf, len + 1); ++} ++ ++/**************************************************************************** ++* ++* dump_user_mem ++* ++***************************************************************************/ ++ ++static void ++dump_phys_mem(void *virt_addr, uint32_t num_bytes) ++{ ++ int rc; ++ uint8_t *end_virt_addr = virt_addr + num_bytes; ++ int num_pages; ++ int offset; ++ int end_offset; ++ int page_idx; ++ int prev_idx; ++ struct page *page; ++ struct page **pages; ++ uint8_t *kmapped_virt_ptr; ++ ++ /* Align virtAddr and endVirtAddr to 16 byte boundaries. */ ++ ++ virt_addr = (void *)((unsigned long)virt_addr & ~0x0fuL); ++ end_virt_addr = (void *)(((unsigned long)end_virt_addr + 15uL) & ++ ~0x0fuL); ++ ++ offset = (int)(long)virt_addr & (PAGE_SIZE - 1); ++ end_offset = (int)(long)end_virt_addr & (PAGE_SIZE - 1); ++ ++ num_pages = (offset + num_bytes + PAGE_SIZE - 1) / PAGE_SIZE; ++ ++ pages = kmalloc(sizeof(struct page *) * num_pages, GFP_KERNEL); ++ if (pages == NULL) { ++ vchiq_log_error(vchiq_arm_log_level, ++ "Unable to allocation memory for %d pages\n", ++ num_pages); ++ return; ++ } ++ ++ down_read(&current->mm->mmap_sem); ++ rc = get_user_pages( ++ (unsigned long)virt_addr, /* start */ ++ num_pages, /* len */ ++ 0, /* write */ ++ 0, /* force */ ++ pages, /* pages (array of page pointers) */ ++ NULL); /* vmas */ ++ up_read(&current->mm->mmap_sem); ++ ++ prev_idx = -1; ++ page = NULL; ++ ++ while (offset < end_offset) { ++ ++ int page_offset = offset % PAGE_SIZE; ++ page_idx = offset / PAGE_SIZE; ++ ++ if (page_idx != prev_idx) { ++ ++ if (page != NULL) ++ kunmap(page); ++ page = pages[page_idx]; ++ kmapped_virt_ptr = kmap(page); ++ ++ prev_idx = page_idx; ++ } ++ ++ if (vchiq_arm_log_level >= VCHIQ_LOG_TRACE) ++ vchiq_log_dump_mem("ph", ++ (uint32_t)(unsigned long)&kmapped_virt_ptr[ ++ page_offset], ++ &kmapped_virt_ptr[page_offset], 16); ++ ++ offset += 16; ++ } ++ if (page != NULL) ++ kunmap(page); ++ ++ for (page_idx = 0; page_idx < num_pages; page_idx++) ++ put_page(pages[page_idx]); ++ ++ kfree(pages); ++} ++ ++/**************************************************************************** ++* ++* vchiq_read ++* ++***************************************************************************/ ++ ++static ssize_t ++vchiq_read(struct file *file, char __user *buf, ++ size_t count, loff_t *ppos) ++{ ++ DUMP_CONTEXT_T context; ++ context.buf = buf; ++ context.actual = 0; ++ context.space = count; ++ context.offset = *ppos; ++ ++ vchiq_dump_state(&context, &g_state); ++ ++ *ppos += context.actual; ++ ++ return context.actual; ++} ++ ++VCHIQ_STATE_T * ++vchiq_get_state(void) ++{ ++ ++ if (g_state.remote == NULL) ++ printk(KERN_ERR "%s: g_state.remote == NULL\n", __func__); ++ else if (g_state.remote->initialised != 1) ++ printk(KERN_NOTICE "%s: g_state.remote->initialised != 1 (%d)\n", ++ __func__, g_state.remote->initialised); ++ ++ return ((g_state.remote != NULL) && ++ (g_state.remote->initialised == 1)) ? &g_state : NULL; ++} ++ ++static const struct file_operations ++vchiq_fops = { ++ .owner = THIS_MODULE, ++ .unlocked_ioctl = vchiq_ioctl, ++ .open = vchiq_open, ++ .release = vchiq_release, ++ .read = vchiq_read ++}; ++ ++/* ++ * Autosuspend related functionality ++ */ ++ ++int ++vchiq_videocore_wanted(VCHIQ_STATE_T *state) ++{ ++ VCHIQ_ARM_STATE_T *arm_state = vchiq_platform_get_arm_state(state); ++ if (!arm_state) ++ /* autosuspend not supported - always return wanted */ ++ return 1; ++ else if (arm_state->blocked_count) ++ return 1; ++ else if (!arm_state->videocore_use_count) ++ /* usage count zero - check for override unless we're forcing */ ++ if (arm_state->resume_blocked) ++ return 0; ++ else ++ return vchiq_platform_videocore_wanted(state); ++ else ++ /* non-zero usage count - videocore still required */ ++ return 1; ++} ++ ++static VCHIQ_STATUS_T ++vchiq_keepalive_vchiq_callback(VCHIQ_REASON_T reason, ++ VCHIQ_HEADER_T *header, ++ VCHIQ_SERVICE_HANDLE_T service_user, ++ void *bulk_user) ++{ ++ vchiq_log_error(vchiq_susp_log_level, ++ "%s callback reason %d", __func__, reason); ++ return 0; ++} ++ ++static int ++vchiq_keepalive_thread_func(void *v) ++{ ++ VCHIQ_STATE_T *state = (VCHIQ_STATE_T *) v; ++ VCHIQ_ARM_STATE_T *arm_state = vchiq_platform_get_arm_state(state); ++ ++ VCHIQ_STATUS_T status; ++ VCHIQ_INSTANCE_T instance; ++ VCHIQ_SERVICE_HANDLE_T ka_handle; ++ ++ VCHIQ_SERVICE_PARAMS_T params = { ++ .fourcc = VCHIQ_MAKE_FOURCC('K', 'E', 'E', 'P'), ++ .callback = vchiq_keepalive_vchiq_callback, ++ .version = KEEPALIVE_VER, ++ .version_min = KEEPALIVE_VER_MIN ++ }; ++ ++ status = vchiq_initialise(&instance); ++ if (status != VCHIQ_SUCCESS) { ++ vchiq_log_error(vchiq_susp_log_level, ++ "%s vchiq_initialise failed %d", __func__, status); ++ goto exit; ++ } ++ ++ status = vchiq_connect(instance); ++ if (status != VCHIQ_SUCCESS) { ++ vchiq_log_error(vchiq_susp_log_level, ++ "%s vchiq_connect failed %d", __func__, status); ++ goto shutdown; ++ } ++ ++ status = vchiq_add_service(instance, &params, &ka_handle); ++ if (status != VCHIQ_SUCCESS) { ++ vchiq_log_error(vchiq_susp_log_level, ++ "%s vchiq_open_service failed %d", __func__, status); ++ goto shutdown; ++ } ++ ++ while (1) { ++ long rc = 0, uc = 0; ++ if (wait_for_completion_interruptible(&arm_state->ka_evt) ++ != 0) { ++ vchiq_log_error(vchiq_susp_log_level, ++ "%s interrupted", __func__); ++ flush_signals(current); ++ continue; ++ } ++ ++ /* read and clear counters. Do release_count then use_count to ++ * prevent getting more releases than uses */ ++ rc = atomic_xchg(&arm_state->ka_release_count, 0); ++ uc = atomic_xchg(&arm_state->ka_use_count, 0); ++ ++ /* Call use/release service the requisite number of times. ++ * Process use before release so use counts don't go negative */ ++ while (uc--) { ++ atomic_inc(&arm_state->ka_use_ack_count); ++ status = vchiq_use_service(ka_handle); ++ if (status != VCHIQ_SUCCESS) { ++ vchiq_log_error(vchiq_susp_log_level, ++ "%s vchiq_use_service error %d", ++ __func__, status); ++ } ++ } ++ while (rc--) { ++ status = vchiq_release_service(ka_handle); ++ if (status != VCHIQ_SUCCESS) { ++ vchiq_log_error(vchiq_susp_log_level, ++ "%s vchiq_release_service error %d", ++ __func__, status); ++ } ++ } ++ } ++ ++shutdown: ++ vchiq_shutdown(instance); ++exit: ++ return 0; ++} ++ ++ ++ ++VCHIQ_STATUS_T ++vchiq_arm_init_state(VCHIQ_STATE_T *state, VCHIQ_ARM_STATE_T *arm_state) ++{ ++ VCHIQ_STATUS_T status = VCHIQ_SUCCESS; ++ ++ if (arm_state) { ++ rwlock_init(&arm_state->susp_res_lock); ++ ++ init_completion(&arm_state->ka_evt); ++ atomic_set(&arm_state->ka_use_count, 0); ++ atomic_set(&arm_state->ka_use_ack_count, 0); ++ atomic_set(&arm_state->ka_release_count, 0); ++ ++ init_completion(&arm_state->vc_suspend_complete); ++ ++ init_completion(&arm_state->vc_resume_complete); ++ /* Initialise to 'done' state. We only want to block on resume ++ * completion while videocore is suspended. */ ++ set_resume_state(arm_state, VC_RESUME_RESUMED); ++ ++ init_completion(&arm_state->resume_blocker); ++ /* Initialise to 'done' state. We only want to block on this ++ * completion while resume is blocked */ ++ complete_all(&arm_state->resume_blocker); ++ ++ init_completion(&arm_state->blocked_blocker); ++ /* Initialise to 'done' state. We only want to block on this ++ * completion while things are waiting on the resume blocker */ ++ complete_all(&arm_state->blocked_blocker); ++ ++ arm_state->suspend_timer_timeout = SUSPEND_TIMER_TIMEOUT_MS; ++ arm_state->suspend_timer_running = 0; ++ init_timer(&arm_state->suspend_timer); ++ arm_state->suspend_timer.data = (unsigned long)(state); ++ arm_state->suspend_timer.function = suspend_timer_callback; ++ ++ arm_state->first_connect = 0; ++ ++ } ++ return status; ++} ++ ++/* ++** Functions to modify the state variables; ++** set_suspend_state ++** set_resume_state ++** ++** There are more state variables than we might like, so ensure they remain in ++** step. Suspend and resume state are maintained separately, since most of ++** these state machines can operate independently. However, there are a few ++** states where state transitions in one state machine cause a reset to the ++** other state machine. In addition, there are some completion events which ++** need to occur on state machine reset and end-state(s), so these are also ++** dealt with in these functions. ++** ++** In all states we set the state variable according to the input, but in some ++** cases we perform additional steps outlined below; ++** ++** VC_SUSPEND_IDLE - Initialise the suspend completion at the same time. ++** The suspend completion is completed after any suspend ++** attempt. When we reset the state machine we also reset ++** the completion. This reset occurs when videocore is ++** resumed, and also if we initiate suspend after a suspend ++** failure. ++** ++** VC_SUSPEND_IN_PROGRESS - This state is considered the point of no return for ++** suspend - ie from this point on we must try to suspend ++** before resuming can occur. We therefore also reset the ++** resume state machine to VC_RESUME_IDLE in this state. ++** ++** VC_SUSPEND_SUSPENDED - Suspend has completed successfully. Also call ++** complete_all on the suspend completion to notify ++** anything waiting for suspend to happen. ++** ++** VC_SUSPEND_REJECTED - Videocore rejected suspend. Videocore will also ++** initiate resume, so no need to alter resume state. ++** We call complete_all on the suspend completion to notify ++** of suspend rejection. ++** ++** VC_SUSPEND_FAILED - We failed to initiate videocore suspend. We notify the ++** suspend completion and reset the resume state machine. ++** ++** VC_RESUME_IDLE - Initialise the resume completion at the same time. The ++** resume completion is in it's 'done' state whenever ++** videcore is running. Therfore, the VC_RESUME_IDLE state ++** implies that videocore is suspended. ++** Hence, any thread which needs to wait until videocore is ++** running can wait on this completion - it will only block ++** if videocore is suspended. ++** ++** VC_RESUME_RESUMED - Resume has completed successfully. Videocore is running. ++** Call complete_all on the resume completion to unblock ++** any threads waiting for resume. Also reset the suspend ++** state machine to it's idle state. ++** ++** VC_RESUME_FAILED - Currently unused - no mechanism to fail resume exists. ++*/ ++ ++void ++set_suspend_state(VCHIQ_ARM_STATE_T *arm_state, ++ enum vc_suspend_status new_state) ++{ ++ /* set the state in all cases */ ++ arm_state->vc_suspend_state = new_state; ++ ++ /* state specific additional actions */ ++ switch (new_state) { ++ case VC_SUSPEND_FORCE_CANCELED: ++ complete_all(&arm_state->vc_suspend_complete); ++ break; ++ case VC_SUSPEND_REJECTED: ++ complete_all(&arm_state->vc_suspend_complete); ++ break; ++ case VC_SUSPEND_FAILED: ++ complete_all(&arm_state->vc_suspend_complete); ++ arm_state->vc_resume_state = VC_RESUME_RESUMED; ++ complete_all(&arm_state->vc_resume_complete); ++ break; ++ case VC_SUSPEND_IDLE: ++ reinit_completion(&arm_state->vc_suspend_complete); ++ break; ++ case VC_SUSPEND_REQUESTED: ++ break; ++ case VC_SUSPEND_IN_PROGRESS: ++ set_resume_state(arm_state, VC_RESUME_IDLE); ++ break; ++ case VC_SUSPEND_SUSPENDED: ++ complete_all(&arm_state->vc_suspend_complete); ++ break; ++ default: ++ BUG(); ++ break; ++ } ++} ++ ++void ++set_resume_state(VCHIQ_ARM_STATE_T *arm_state, ++ enum vc_resume_status new_state) ++{ ++ /* set the state in all cases */ ++ arm_state->vc_resume_state = new_state; ++ ++ /* state specific additional actions */ ++ switch (new_state) { ++ case VC_RESUME_FAILED: ++ break; ++ case VC_RESUME_IDLE: ++ reinit_completion(&arm_state->vc_resume_complete); ++ break; ++ case VC_RESUME_REQUESTED: ++ break; ++ case VC_RESUME_IN_PROGRESS: ++ break; ++ case VC_RESUME_RESUMED: ++ complete_all(&arm_state->vc_resume_complete); ++ set_suspend_state(arm_state, VC_SUSPEND_IDLE); ++ break; ++ default: ++ BUG(); ++ break; ++ } ++} ++ ++ ++/* should be called with the write lock held */ ++inline void ++start_suspend_timer(VCHIQ_ARM_STATE_T *arm_state) ++{ ++ del_timer(&arm_state->suspend_timer); ++ arm_state->suspend_timer.expires = jiffies + ++ msecs_to_jiffies(arm_state-> ++ suspend_timer_timeout); ++ add_timer(&arm_state->suspend_timer); ++ arm_state->suspend_timer_running = 1; ++} ++ ++/* should be called with the write lock held */ ++static inline void ++stop_suspend_timer(VCHIQ_ARM_STATE_T *arm_state) ++{ ++ if (arm_state->suspend_timer_running) { ++ del_timer(&arm_state->suspend_timer); ++ arm_state->suspend_timer_running = 0; ++ } ++} ++ ++static inline int ++need_resume(VCHIQ_STATE_T *state) ++{ ++ VCHIQ_ARM_STATE_T *arm_state = vchiq_platform_get_arm_state(state); ++ return (arm_state->vc_suspend_state > VC_SUSPEND_IDLE) && ++ (arm_state->vc_resume_state < VC_RESUME_REQUESTED) && ++ vchiq_videocore_wanted(state); ++} ++ ++static int ++block_resume(VCHIQ_ARM_STATE_T *arm_state) ++{ ++ int status = VCHIQ_SUCCESS; ++ const unsigned long timeout_val = ++ msecs_to_jiffies(FORCE_SUSPEND_TIMEOUT_MS); ++ int resume_count = 0; ++ ++ /* Allow any threads which were blocked by the last force suspend to ++ * complete if they haven't already. Only give this one shot; if ++ * blocked_count is incremented after blocked_blocker is completed ++ * (which only happens when blocked_count hits 0) then those threads ++ * will have to wait until next time around */ ++ if (arm_state->blocked_count) { ++ reinit_completion(&arm_state->blocked_blocker); ++ write_unlock_bh(&arm_state->susp_res_lock); ++ vchiq_log_info(vchiq_susp_log_level, "%s wait for previously " ++ "blocked clients", __func__); ++ if (wait_for_completion_interruptible_timeout( ++ &arm_state->blocked_blocker, timeout_val) ++ <= 0) { ++ vchiq_log_error(vchiq_susp_log_level, "%s wait for " ++ "previously blocked clients failed" , __func__); ++ status = VCHIQ_ERROR; ++ write_lock_bh(&arm_state->susp_res_lock); ++ goto out; ++ } ++ vchiq_log_info(vchiq_susp_log_level, "%s previously blocked " ++ "clients resumed", __func__); ++ write_lock_bh(&arm_state->susp_res_lock); ++ } ++ ++ /* We need to wait for resume to complete if it's in process */ ++ while (arm_state->vc_resume_state != VC_RESUME_RESUMED && ++ arm_state->vc_resume_state > VC_RESUME_IDLE) { ++ if (resume_count > 1) { ++ status = VCHIQ_ERROR; ++ vchiq_log_error(vchiq_susp_log_level, "%s waited too " ++ "many times for resume" , __func__); ++ goto out; ++ } ++ write_unlock_bh(&arm_state->susp_res_lock); ++ vchiq_log_info(vchiq_susp_log_level, "%s wait for resume", ++ __func__); ++ if (wait_for_completion_interruptible_timeout( ++ &arm_state->vc_resume_complete, timeout_val) ++ <= 0) { ++ vchiq_log_error(vchiq_susp_log_level, "%s wait for " ++ "resume failed (%s)", __func__, ++ resume_state_names[arm_state->vc_resume_state + ++ VC_RESUME_NUM_OFFSET]); ++ status = VCHIQ_ERROR; ++ write_lock_bh(&arm_state->susp_res_lock); ++ goto out; ++ } ++ vchiq_log_info(vchiq_susp_log_level, "%s resumed", __func__); ++ write_lock_bh(&arm_state->susp_res_lock); ++ resume_count++; ++ } ++ reinit_completion(&arm_state->resume_blocker); ++ arm_state->resume_blocked = 1; ++ ++out: ++ return status; ++} ++ ++static inline void ++unblock_resume(VCHIQ_ARM_STATE_T *arm_state) ++{ ++ complete_all(&arm_state->resume_blocker); ++ arm_state->resume_blocked = 0; ++} ++ ++/* Initiate suspend via slot handler. Should be called with the write lock ++ * held */ ++VCHIQ_STATUS_T ++vchiq_arm_vcsuspend(VCHIQ_STATE_T *state) ++{ ++ VCHIQ_STATUS_T status = VCHIQ_ERROR; ++ VCHIQ_ARM_STATE_T *arm_state = vchiq_platform_get_arm_state(state); ++ ++ if (!arm_state) ++ goto out; ++ ++ vchiq_log_trace(vchiq_susp_log_level, "%s", __func__); ++ status = VCHIQ_SUCCESS; ++ ++ ++ switch (arm_state->vc_suspend_state) { ++ case VC_SUSPEND_REQUESTED: ++ vchiq_log_info(vchiq_susp_log_level, "%s: suspend already " ++ "requested", __func__); ++ break; ++ case VC_SUSPEND_IN_PROGRESS: ++ vchiq_log_info(vchiq_susp_log_level, "%s: suspend already in " ++ "progress", __func__); ++ break; ++ ++ default: ++ /* We don't expect to be in other states, so log but continue ++ * anyway */ ++ vchiq_log_error(vchiq_susp_log_level, ++ "%s unexpected suspend state %s", __func__, ++ suspend_state_names[arm_state->vc_suspend_state + ++ VC_SUSPEND_NUM_OFFSET]); ++ /* fall through */ ++ case VC_SUSPEND_REJECTED: ++ case VC_SUSPEND_FAILED: ++ /* Ensure any idle state actions have been run */ ++ set_suspend_state(arm_state, VC_SUSPEND_IDLE); ++ /* fall through */ ++ case VC_SUSPEND_IDLE: ++ vchiq_log_info(vchiq_susp_log_level, ++ "%s: suspending", __func__); ++ set_suspend_state(arm_state, VC_SUSPEND_REQUESTED); ++ /* kick the slot handler thread to initiate suspend */ ++ request_poll(state, NULL, 0); ++ break; ++ } ++ ++out: ++ vchiq_log_trace(vchiq_susp_log_level, "%s exit %d", __func__, status); ++ return status; ++} ++ ++void ++vchiq_platform_check_suspend(VCHIQ_STATE_T *state) ++{ ++ VCHIQ_ARM_STATE_T *arm_state = vchiq_platform_get_arm_state(state); ++ int susp = 0; ++ ++ if (!arm_state) ++ goto out; ++ ++ vchiq_log_trace(vchiq_susp_log_level, "%s", __func__); ++ ++ write_lock_bh(&arm_state->susp_res_lock); ++ if (arm_state->vc_suspend_state == VC_SUSPEND_REQUESTED && ++ arm_state->vc_resume_state == VC_RESUME_RESUMED) { ++ set_suspend_state(arm_state, VC_SUSPEND_IN_PROGRESS); ++ susp = 1; ++ } ++ write_unlock_bh(&arm_state->susp_res_lock); ++ ++ if (susp) ++ vchiq_platform_suspend(state); ++ ++out: ++ vchiq_log_trace(vchiq_susp_log_level, "%s exit", __func__); ++ return; ++} ++ ++ ++static void ++output_timeout_error(VCHIQ_STATE_T *state) ++{ ++ VCHIQ_ARM_STATE_T *arm_state = vchiq_platform_get_arm_state(state); ++ char service_err[50] = ""; ++ int vc_use_count = arm_state->videocore_use_count; ++ int active_services = state->unused_service; ++ int i; ++ ++ if (!arm_state->videocore_use_count) { ++ snprintf(service_err, 50, " Videocore usecount is 0"); ++ goto output_msg; ++ } ++ for (i = 0; i < active_services; i++) { ++ VCHIQ_SERVICE_T *service_ptr = state->services[i]; ++ if (service_ptr && service_ptr->service_use_count && ++ (service_ptr->srvstate != VCHIQ_SRVSTATE_FREE)) { ++ snprintf(service_err, 50, " %c%c%c%c(%d) service has " ++ "use count %d%s", VCHIQ_FOURCC_AS_4CHARS( ++ service_ptr->base.fourcc), ++ service_ptr->client_id, ++ service_ptr->service_use_count, ++ service_ptr->service_use_count == ++ vc_use_count ? "" : " (+ more)"); ++ break; ++ } ++ } ++ ++output_msg: ++ vchiq_log_error(vchiq_susp_log_level, ++ "timed out waiting for vc suspend (%d).%s", ++ arm_state->autosuspend_override, service_err); ++ ++} ++ ++/* Try to get videocore into suspended state, regardless of autosuspend state. ++** We don't actually force suspend, since videocore may get into a bad state ++** if we force suspend at a bad time. Instead, we wait for autosuspend to ++** determine a good point to suspend. If this doesn't happen within 100ms we ++** report failure. ++** ++** Returns VCHIQ_SUCCESS if videocore suspended successfully, VCHIQ_RETRY if ++** videocore failed to suspend in time or VCHIQ_ERROR if interrupted. ++*/ ++VCHIQ_STATUS_T ++vchiq_arm_force_suspend(VCHIQ_STATE_T *state) ++{ ++ VCHIQ_ARM_STATE_T *arm_state = vchiq_platform_get_arm_state(state); ++ VCHIQ_STATUS_T status = VCHIQ_ERROR; ++ long rc = 0; ++ int repeat = -1; ++ ++ if (!arm_state) ++ goto out; ++ ++ vchiq_log_trace(vchiq_susp_log_level, "%s", __func__); ++ ++ write_lock_bh(&arm_state->susp_res_lock); ++ ++ status = block_resume(arm_state); ++ if (status != VCHIQ_SUCCESS) ++ goto unlock; ++ if (arm_state->vc_suspend_state == VC_SUSPEND_SUSPENDED) { ++ /* Already suspended - just block resume and exit */ ++ vchiq_log_info(vchiq_susp_log_level, "%s already suspended", ++ __func__); ++ status = VCHIQ_SUCCESS; ++ goto unlock; ++ } else if (arm_state->vc_suspend_state <= VC_SUSPEND_IDLE) { ++ /* initiate suspend immediately in the case that we're waiting ++ * for the timeout */ ++ stop_suspend_timer(arm_state); ++ if (!vchiq_videocore_wanted(state)) { ++ vchiq_log_info(vchiq_susp_log_level, "%s videocore " ++ "idle, initiating suspend", __func__); ++ status = vchiq_arm_vcsuspend(state); ++ } else if (arm_state->autosuspend_override < ++ FORCE_SUSPEND_FAIL_MAX) { ++ vchiq_log_info(vchiq_susp_log_level, "%s letting " ++ "videocore go idle", __func__); ++ status = VCHIQ_SUCCESS; ++ } else { ++ vchiq_log_warning(vchiq_susp_log_level, "%s failed too " ++ "many times - attempting suspend", __func__); ++ status = vchiq_arm_vcsuspend(state); ++ } ++ } else { ++ vchiq_log_info(vchiq_susp_log_level, "%s videocore suspend " ++ "in progress - wait for completion", __func__); ++ status = VCHIQ_SUCCESS; ++ } ++ ++ /* Wait for suspend to happen due to system idle (not forced..) */ ++ if (status != VCHIQ_SUCCESS) ++ goto unblock_resume; ++ ++ do { ++ write_unlock_bh(&arm_state->susp_res_lock); ++ ++ rc = wait_for_completion_interruptible_timeout( ++ &arm_state->vc_suspend_complete, ++ msecs_to_jiffies(FORCE_SUSPEND_TIMEOUT_MS)); ++ ++ write_lock_bh(&arm_state->susp_res_lock); ++ if (rc < 0) { ++ vchiq_log_warning(vchiq_susp_log_level, "%s " ++ "interrupted waiting for suspend", __func__); ++ status = VCHIQ_ERROR; ++ goto unblock_resume; ++ } else if (rc == 0) { ++ if (arm_state->vc_suspend_state > VC_SUSPEND_IDLE) { ++ /* Repeat timeout once if in progress */ ++ if (repeat < 0) { ++ repeat = 1; ++ continue; ++ } ++ } ++ arm_state->autosuspend_override++; ++ output_timeout_error(state); ++ ++ status = VCHIQ_RETRY; ++ goto unblock_resume; ++ } ++ } while (0 < (repeat--)); ++ ++ /* Check and report state in case we need to abort ARM suspend */ ++ if (arm_state->vc_suspend_state != VC_SUSPEND_SUSPENDED) { ++ status = VCHIQ_RETRY; ++ vchiq_log_error(vchiq_susp_log_level, ++ "%s videocore suspend failed (state %s)", __func__, ++ suspend_state_names[arm_state->vc_suspend_state + ++ VC_SUSPEND_NUM_OFFSET]); ++ /* Reset the state only if it's still in an error state. ++ * Something could have already initiated another suspend. */ ++ if (arm_state->vc_suspend_state < VC_SUSPEND_IDLE) ++ set_suspend_state(arm_state, VC_SUSPEND_IDLE); ++ ++ goto unblock_resume; ++ } ++ ++ /* successfully suspended - unlock and exit */ ++ goto unlock; ++ ++unblock_resume: ++ /* all error states need to unblock resume before exit */ ++ unblock_resume(arm_state); ++ ++unlock: ++ write_unlock_bh(&arm_state->susp_res_lock); ++ ++out: ++ vchiq_log_trace(vchiq_susp_log_level, "%s exit %d", __func__, status); ++ return status; ++} ++ ++void ++vchiq_check_suspend(VCHIQ_STATE_T *state) ++{ ++ VCHIQ_ARM_STATE_T *arm_state = vchiq_platform_get_arm_state(state); ++ ++ if (!arm_state) ++ goto out; ++ ++ vchiq_log_trace(vchiq_susp_log_level, "%s", __func__); ++ ++ write_lock_bh(&arm_state->susp_res_lock); ++ if (arm_state->vc_suspend_state != VC_SUSPEND_SUSPENDED && ++ arm_state->first_connect && ++ !vchiq_videocore_wanted(state)) { ++ vchiq_arm_vcsuspend(state); ++ } ++ write_unlock_bh(&arm_state->susp_res_lock); ++ ++out: ++ vchiq_log_trace(vchiq_susp_log_level, "%s exit", __func__); ++ return; ++} ++ ++ ++int ++vchiq_arm_allow_resume(VCHIQ_STATE_T *state) ++{ ++ VCHIQ_ARM_STATE_T *arm_state = vchiq_platform_get_arm_state(state); ++ int resume = 0; ++ int ret = -1; ++ ++ if (!arm_state) ++ goto out; ++ ++ vchiq_log_trace(vchiq_susp_log_level, "%s", __func__); ++ ++ write_lock_bh(&arm_state->susp_res_lock); ++ unblock_resume(arm_state); ++ resume = vchiq_check_resume(state); ++ write_unlock_bh(&arm_state->susp_res_lock); ++ ++ if (resume) { ++ if (wait_for_completion_interruptible( ++ &arm_state->vc_resume_complete) < 0) { ++ vchiq_log_error(vchiq_susp_log_level, ++ "%s interrupted", __func__); ++ /* failed, cannot accurately derive suspend ++ * state, so exit early. */ ++ goto out; ++ } ++ } ++ ++ read_lock_bh(&arm_state->susp_res_lock); ++ if (arm_state->vc_suspend_state == VC_SUSPEND_SUSPENDED) { ++ vchiq_log_info(vchiq_susp_log_level, ++ "%s: Videocore remains suspended", __func__); ++ } else { ++ vchiq_log_info(vchiq_susp_log_level, ++ "%s: Videocore resumed", __func__); ++ ret = 0; ++ } ++ read_unlock_bh(&arm_state->susp_res_lock); ++out: ++ vchiq_log_trace(vchiq_susp_log_level, "%s exit %d", __func__, ret); ++ return ret; ++} ++ ++/* This function should be called with the write lock held */ ++int ++vchiq_check_resume(VCHIQ_STATE_T *state) ++{ ++ VCHIQ_ARM_STATE_T *arm_state = vchiq_platform_get_arm_state(state); ++ int resume = 0; ++ ++ if (!arm_state) ++ goto out; ++ ++ vchiq_log_trace(vchiq_susp_log_level, "%s", __func__); ++ ++ if (need_resume(state)) { ++ set_resume_state(arm_state, VC_RESUME_REQUESTED); ++ request_poll(state, NULL, 0); ++ resume = 1; ++ } ++ ++out: ++ vchiq_log_trace(vchiq_susp_log_level, "%s exit", __func__); ++ return resume; ++} ++ ++void ++vchiq_platform_check_resume(VCHIQ_STATE_T *state) ++{ ++ VCHIQ_ARM_STATE_T *arm_state = vchiq_platform_get_arm_state(state); ++ int res = 0; ++ ++ if (!arm_state) ++ goto out; ++ ++ vchiq_log_trace(vchiq_susp_log_level, "%s", __func__); ++ ++ write_lock_bh(&arm_state->susp_res_lock); ++ if (arm_state->wake_address == 0) { ++ vchiq_log_info(vchiq_susp_log_level, ++ "%s: already awake", __func__); ++ goto unlock; ++ } ++ if (arm_state->vc_resume_state == VC_RESUME_IN_PROGRESS) { ++ vchiq_log_info(vchiq_susp_log_level, ++ "%s: already resuming", __func__); ++ goto unlock; ++ } ++ ++ if (arm_state->vc_resume_state == VC_RESUME_REQUESTED) { ++ set_resume_state(arm_state, VC_RESUME_IN_PROGRESS); ++ res = 1; ++ } else ++ vchiq_log_trace(vchiq_susp_log_level, ++ "%s: not resuming (resume state %s)", __func__, ++ resume_state_names[arm_state->vc_resume_state + ++ VC_RESUME_NUM_OFFSET]); ++ ++unlock: ++ write_unlock_bh(&arm_state->susp_res_lock); ++ ++ if (res) ++ vchiq_platform_resume(state); ++ ++out: ++ vchiq_log_trace(vchiq_susp_log_level, "%s exit", __func__); ++ return; ++ ++} ++ ++ ++ ++VCHIQ_STATUS_T ++vchiq_use_internal(VCHIQ_STATE_T *state, VCHIQ_SERVICE_T *service, ++ enum USE_TYPE_E use_type) ++{ ++ VCHIQ_ARM_STATE_T *arm_state = vchiq_platform_get_arm_state(state); ++ VCHIQ_STATUS_T ret = VCHIQ_SUCCESS; ++ char entity[16]; ++ int *entity_uc; ++ int local_uc, local_entity_uc; ++ ++ if (!arm_state) ++ goto out; ++ ++ vchiq_log_trace(vchiq_susp_log_level, "%s", __func__); ++ ++ if (use_type == USE_TYPE_VCHIQ) { ++ sprintf(entity, "VCHIQ: "); ++ entity_uc = &arm_state->peer_use_count; ++ } else if (service) { ++ sprintf(entity, "%c%c%c%c:%03d", ++ VCHIQ_FOURCC_AS_4CHARS(service->base.fourcc), ++ service->client_id); ++ entity_uc = &service->service_use_count; ++ } else { ++ vchiq_log_error(vchiq_susp_log_level, "%s null service " ++ "ptr", __func__); ++ ret = VCHIQ_ERROR; ++ goto out; ++ } ++ ++ write_lock_bh(&arm_state->susp_res_lock); ++ while (arm_state->resume_blocked) { ++ /* If we call 'use' while force suspend is waiting for suspend, ++ * then we're about to block the thread which the force is ++ * waiting to complete, so we're bound to just time out. In this ++ * case, set the suspend state such that the wait will be ++ * canceled, so we can complete as quickly as possible. */ ++ if (arm_state->resume_blocked && arm_state->vc_suspend_state == ++ VC_SUSPEND_IDLE) { ++ set_suspend_state(arm_state, VC_SUSPEND_FORCE_CANCELED); ++ break; ++ } ++ /* If suspend is already in progress then we need to block */ ++ if (!try_wait_for_completion(&arm_state->resume_blocker)) { ++ /* Indicate that there are threads waiting on the resume ++ * blocker. These need to be allowed to complete before ++ * a _second_ call to force suspend can complete, ++ * otherwise low priority threads might never actually ++ * continue */ ++ arm_state->blocked_count++; ++ write_unlock_bh(&arm_state->susp_res_lock); ++ vchiq_log_info(vchiq_susp_log_level, "%s %s resume " ++ "blocked - waiting...", __func__, entity); ++ if (wait_for_completion_killable( ++ &arm_state->resume_blocker) != 0) { ++ vchiq_log_error(vchiq_susp_log_level, "%s %s " ++ "wait for resume blocker interrupted", ++ __func__, entity); ++ ret = VCHIQ_ERROR; ++ write_lock_bh(&arm_state->susp_res_lock); ++ arm_state->blocked_count--; ++ write_unlock_bh(&arm_state->susp_res_lock); ++ goto out; ++ } ++ vchiq_log_info(vchiq_susp_log_level, "%s %s resume " ++ "unblocked", __func__, entity); ++ write_lock_bh(&arm_state->susp_res_lock); ++ if (--arm_state->blocked_count == 0) ++ complete_all(&arm_state->blocked_blocker); ++ } ++ } ++ ++ stop_suspend_timer(arm_state); ++ ++ local_uc = ++arm_state->videocore_use_count; ++ local_entity_uc = ++(*entity_uc); ++ ++ /* If there's a pending request which hasn't yet been serviced then ++ * just clear it. If we're past VC_SUSPEND_REQUESTED state then ++ * vc_resume_complete will block until we either resume or fail to ++ * suspend */ ++ if (arm_state->vc_suspend_state <= VC_SUSPEND_REQUESTED) ++ set_suspend_state(arm_state, VC_SUSPEND_IDLE); ++ ++ if ((use_type != USE_TYPE_SERVICE_NO_RESUME) && need_resume(state)) { ++ set_resume_state(arm_state, VC_RESUME_REQUESTED); ++ vchiq_log_info(vchiq_susp_log_level, ++ "%s %s count %d, state count %d", ++ __func__, entity, local_entity_uc, local_uc); ++ request_poll(state, NULL, 0); ++ } else ++ vchiq_log_trace(vchiq_susp_log_level, ++ "%s %s count %d, state count %d", ++ __func__, entity, *entity_uc, local_uc); ++ ++ ++ write_unlock_bh(&arm_state->susp_res_lock); ++ ++ /* Completion is in a done state when we're not suspended, so this won't ++ * block for the non-suspended case. */ ++ if (!try_wait_for_completion(&arm_state->vc_resume_complete)) { ++ vchiq_log_info(vchiq_susp_log_level, "%s %s wait for resume", ++ __func__, entity); ++ if (wait_for_completion_killable( ++ &arm_state->vc_resume_complete) != 0) { ++ vchiq_log_error(vchiq_susp_log_level, "%s %s wait for " ++ "resume interrupted", __func__, entity); ++ ret = VCHIQ_ERROR; ++ goto out; ++ } ++ vchiq_log_info(vchiq_susp_log_level, "%s %s resumed", __func__, ++ entity); ++ } ++ ++ if (ret == VCHIQ_SUCCESS) { ++ VCHIQ_STATUS_T status = VCHIQ_SUCCESS; ++ long ack_cnt = atomic_xchg(&arm_state->ka_use_ack_count, 0); ++ while (ack_cnt && (status == VCHIQ_SUCCESS)) { ++ /* Send the use notify to videocore */ ++ status = vchiq_send_remote_use_active(state); ++ if (status == VCHIQ_SUCCESS) ++ ack_cnt--; ++ else ++ atomic_add(ack_cnt, ++ &arm_state->ka_use_ack_count); ++ } ++ } ++ ++out: ++ vchiq_log_trace(vchiq_susp_log_level, "%s exit %d", __func__, ret); ++ return ret; ++} ++ ++VCHIQ_STATUS_T ++vchiq_release_internal(VCHIQ_STATE_T *state, VCHIQ_SERVICE_T *service) ++{ ++ VCHIQ_ARM_STATE_T *arm_state = vchiq_platform_get_arm_state(state); ++ VCHIQ_STATUS_T ret = VCHIQ_SUCCESS; ++ char entity[16]; ++ int *entity_uc; ++ int local_uc, local_entity_uc; ++ ++ if (!arm_state) ++ goto out; ++ ++ vchiq_log_trace(vchiq_susp_log_level, "%s", __func__); ++ ++ if (service) { ++ sprintf(entity, "%c%c%c%c:%03d", ++ VCHIQ_FOURCC_AS_4CHARS(service->base.fourcc), ++ service->client_id); ++ entity_uc = &service->service_use_count; ++ } else { ++ sprintf(entity, "PEER: "); ++ entity_uc = &arm_state->peer_use_count; ++ } ++ ++ write_lock_bh(&arm_state->susp_res_lock); ++ if (!arm_state->videocore_use_count || !(*entity_uc)) { ++ /* Don't use BUG_ON - don't allow user thread to crash kernel */ ++ WARN_ON(!arm_state->videocore_use_count); ++ WARN_ON(!(*entity_uc)); ++ ret = VCHIQ_ERROR; ++ goto unlock; ++ } ++ local_uc = --arm_state->videocore_use_count; ++ local_entity_uc = --(*entity_uc); ++ ++ if (!vchiq_videocore_wanted(state)) { ++ if (vchiq_platform_use_suspend_timer() && ++ !arm_state->resume_blocked) { ++ /* Only use the timer if we're not trying to force ++ * suspend (=> resume_blocked) */ ++ start_suspend_timer(arm_state); ++ } else { ++ vchiq_log_info(vchiq_susp_log_level, ++ "%s %s count %d, state count %d - suspending", ++ __func__, entity, *entity_uc, ++ arm_state->videocore_use_count); ++ vchiq_arm_vcsuspend(state); ++ } ++ } else ++ vchiq_log_trace(vchiq_susp_log_level, ++ "%s %s count %d, state count %d", ++ __func__, entity, *entity_uc, ++ arm_state->videocore_use_count); ++ ++unlock: ++ write_unlock_bh(&arm_state->susp_res_lock); ++ ++out: ++ vchiq_log_trace(vchiq_susp_log_level, "%s exit %d", __func__, ret); ++ return ret; ++} ++ ++void ++vchiq_on_remote_use(VCHIQ_STATE_T *state) ++{ ++ VCHIQ_ARM_STATE_T *arm_state = vchiq_platform_get_arm_state(state); ++ vchiq_log_trace(vchiq_susp_log_level, "%s", __func__); ++ atomic_inc(&arm_state->ka_use_count); ++ complete(&arm_state->ka_evt); ++} ++ ++void ++vchiq_on_remote_release(VCHIQ_STATE_T *state) ++{ ++ VCHIQ_ARM_STATE_T *arm_state = vchiq_platform_get_arm_state(state); ++ vchiq_log_trace(vchiq_susp_log_level, "%s", __func__); ++ atomic_inc(&arm_state->ka_release_count); ++ complete(&arm_state->ka_evt); ++} ++ ++VCHIQ_STATUS_T ++vchiq_use_service_internal(VCHIQ_SERVICE_T *service) ++{ ++ return vchiq_use_internal(service->state, service, USE_TYPE_SERVICE); ++} ++ ++VCHIQ_STATUS_T ++vchiq_release_service_internal(VCHIQ_SERVICE_T *service) ++{ ++ return vchiq_release_internal(service->state, service); ++} ++ ++VCHIQ_DEBUGFS_NODE_T * ++vchiq_instance_get_debugfs_node(VCHIQ_INSTANCE_T instance) ++{ ++ return &instance->debugfs_node; ++} ++ ++int ++vchiq_instance_get_use_count(VCHIQ_INSTANCE_T instance) ++{ ++ VCHIQ_SERVICE_T *service; ++ int use_count = 0, i; ++ i = 0; ++ while ((service = next_service_by_instance(instance->state, ++ instance, &i)) != NULL) { ++ use_count += service->service_use_count; ++ unlock_service(service); ++ } ++ return use_count; ++} ++ ++int ++vchiq_instance_get_pid(VCHIQ_INSTANCE_T instance) ++{ ++ return instance->pid; ++} ++ ++int ++vchiq_instance_get_trace(VCHIQ_INSTANCE_T instance) ++{ ++ return instance->trace; ++} ++ ++void ++vchiq_instance_set_trace(VCHIQ_INSTANCE_T instance, int trace) ++{ ++ VCHIQ_SERVICE_T *service; ++ int i; ++ i = 0; ++ while ((service = next_service_by_instance(instance->state, ++ instance, &i)) != NULL) { ++ service->trace = trace; ++ unlock_service(service); ++ } ++ instance->trace = (trace != 0); ++} ++ ++static void suspend_timer_callback(unsigned long context) ++{ ++ VCHIQ_STATE_T *state = (VCHIQ_STATE_T *)context; ++ VCHIQ_ARM_STATE_T *arm_state = vchiq_platform_get_arm_state(state); ++ if (!arm_state) ++ goto out; ++ vchiq_log_info(vchiq_susp_log_level, ++ "%s - suspend timer expired - check suspend", __func__); ++ vchiq_check_suspend(state); ++out: ++ return; ++} ++ ++VCHIQ_STATUS_T ++vchiq_use_service_no_resume(VCHIQ_SERVICE_HANDLE_T handle) ++{ ++ VCHIQ_STATUS_T ret = VCHIQ_ERROR; ++ VCHIQ_SERVICE_T *service = find_service_by_handle(handle); ++ if (service) { ++ ret = vchiq_use_internal(service->state, service, ++ USE_TYPE_SERVICE_NO_RESUME); ++ unlock_service(service); ++ } ++ return ret; ++} ++ ++VCHIQ_STATUS_T ++vchiq_use_service(VCHIQ_SERVICE_HANDLE_T handle) ++{ ++ VCHIQ_STATUS_T ret = VCHIQ_ERROR; ++ VCHIQ_SERVICE_T *service = find_service_by_handle(handle); ++ if (service) { ++ ret = vchiq_use_internal(service->state, service, ++ USE_TYPE_SERVICE); ++ unlock_service(service); ++ } ++ return ret; ++} ++ ++VCHIQ_STATUS_T ++vchiq_release_service(VCHIQ_SERVICE_HANDLE_T handle) ++{ ++ VCHIQ_STATUS_T ret = VCHIQ_ERROR; ++ VCHIQ_SERVICE_T *service = find_service_by_handle(handle); ++ if (service) { ++ ret = vchiq_release_internal(service->state, service); ++ unlock_service(service); ++ } ++ return ret; ++} ++ ++void ++vchiq_dump_service_use_state(VCHIQ_STATE_T *state) ++{ ++ VCHIQ_ARM_STATE_T *arm_state = vchiq_platform_get_arm_state(state); ++ int i, j = 0; ++ /* Only dump 64 services */ ++ static const int local_max_services = 64; ++ /* If there's more than 64 services, only dump ones with ++ * non-zero counts */ ++ int only_nonzero = 0; ++ static const char *nz = "<-- preventing suspend"; ++ ++ enum vc_suspend_status vc_suspend_state; ++ enum vc_resume_status vc_resume_state; ++ int peer_count; ++ int vc_use_count; ++ int active_services; ++ struct service_data_struct { ++ int fourcc; ++ int clientid; ++ int use_count; ++ } service_data[local_max_services]; ++ ++ if (!arm_state) ++ return; ++ ++ read_lock_bh(&arm_state->susp_res_lock); ++ vc_suspend_state = arm_state->vc_suspend_state; ++ vc_resume_state = arm_state->vc_resume_state; ++ peer_count = arm_state->peer_use_count; ++ vc_use_count = arm_state->videocore_use_count; ++ active_services = state->unused_service; ++ if (active_services > local_max_services) ++ only_nonzero = 1; ++ ++ for (i = 0; (i < active_services) && (j < local_max_services); i++) { ++ VCHIQ_SERVICE_T *service_ptr = state->services[i]; ++ if (!service_ptr) ++ continue; ++ ++ if (only_nonzero && !service_ptr->service_use_count) ++ continue; ++ ++ if (service_ptr->srvstate != VCHIQ_SRVSTATE_FREE) { ++ service_data[j].fourcc = service_ptr->base.fourcc; ++ service_data[j].clientid = service_ptr->client_id; ++ service_data[j++].use_count = service_ptr-> ++ service_use_count; ++ } ++ } ++ ++ read_unlock_bh(&arm_state->susp_res_lock); ++ ++ vchiq_log_warning(vchiq_susp_log_level, ++ "-- Videcore suspend state: %s --", ++ suspend_state_names[vc_suspend_state + VC_SUSPEND_NUM_OFFSET]); ++ vchiq_log_warning(vchiq_susp_log_level, ++ "-- Videcore resume state: %s --", ++ resume_state_names[vc_resume_state + VC_RESUME_NUM_OFFSET]); ++ ++ if (only_nonzero) ++ vchiq_log_warning(vchiq_susp_log_level, "Too many active " ++ "services (%d). Only dumping up to first %d services " ++ "with non-zero use-count", active_services, ++ local_max_services); ++ ++ for (i = 0; i < j; i++) { ++ vchiq_log_warning(vchiq_susp_log_level, ++ "----- %c%c%c%c:%d service count %d %s", ++ VCHIQ_FOURCC_AS_4CHARS(service_data[i].fourcc), ++ service_data[i].clientid, ++ service_data[i].use_count, ++ service_data[i].use_count ? nz : ""); ++ } ++ vchiq_log_warning(vchiq_susp_log_level, ++ "----- VCHIQ use count count %d", peer_count); ++ vchiq_log_warning(vchiq_susp_log_level, ++ "--- Overall vchiq instance use count %d", vc_use_count); ++ ++ vchiq_dump_platform_use_state(state); ++} ++ ++VCHIQ_STATUS_T ++vchiq_check_service(VCHIQ_SERVICE_T *service) ++{ ++ VCHIQ_ARM_STATE_T *arm_state; ++ VCHIQ_STATUS_T ret = VCHIQ_ERROR; ++ ++ if (!service || !service->state) ++ goto out; ++ ++ vchiq_log_trace(vchiq_susp_log_level, "%s", __func__); ++ ++ arm_state = vchiq_platform_get_arm_state(service->state); ++ ++ read_lock_bh(&arm_state->susp_res_lock); ++ if (service->service_use_count) ++ ret = VCHIQ_SUCCESS; ++ read_unlock_bh(&arm_state->susp_res_lock); ++ ++ if (ret == VCHIQ_ERROR) { ++ vchiq_log_error(vchiq_susp_log_level, ++ "%s ERROR - %c%c%c%c:%d service count %d, " ++ "state count %d, videocore suspend state %s", __func__, ++ VCHIQ_FOURCC_AS_4CHARS(service->base.fourcc), ++ service->client_id, service->service_use_count, ++ arm_state->videocore_use_count, ++ suspend_state_names[arm_state->vc_suspend_state + ++ VC_SUSPEND_NUM_OFFSET]); ++ vchiq_dump_service_use_state(service->state); ++ } ++out: ++ return ret; ++} ++ ++/* stub functions */ ++void vchiq_on_remote_use_active(VCHIQ_STATE_T *state) ++{ ++ (void)state; ++} ++ ++void vchiq_platform_conn_state_changed(VCHIQ_STATE_T *state, ++ VCHIQ_CONNSTATE_T oldstate, VCHIQ_CONNSTATE_T newstate) ++{ ++ VCHIQ_ARM_STATE_T *arm_state = vchiq_platform_get_arm_state(state); ++ vchiq_log_info(vchiq_susp_log_level, "%d: %s->%s", state->id, ++ get_conn_state_name(oldstate), get_conn_state_name(newstate)); ++ if (state->conn_state == VCHIQ_CONNSTATE_CONNECTED) { ++ write_lock_bh(&arm_state->susp_res_lock); ++ if (!arm_state->first_connect) { ++ char threadname[10]; ++ arm_state->first_connect = 1; ++ write_unlock_bh(&arm_state->susp_res_lock); ++ snprintf(threadname, sizeof(threadname), "VCHIQka-%d", ++ state->id); ++ arm_state->ka_thread = kthread_create( ++ &vchiq_keepalive_thread_func, ++ (void *)state, ++ threadname); ++ if (arm_state->ka_thread == NULL) { ++ vchiq_log_error(vchiq_susp_log_level, ++ "vchiq: FATAL: couldn't create thread %s", ++ threadname); ++ } else { ++ wake_up_process(arm_state->ka_thread); ++ } ++ } else ++ write_unlock_bh(&arm_state->susp_res_lock); ++ } ++} ++ ++static int vchiq_probe(struct platform_device *pdev) ++{ ++ struct device_node *fw_node; ++ struct rpi_firmware *fw; ++ int err; ++ void *ptr_err; ++ ++ fw_node = of_parse_phandle(pdev->dev.of_node, "firmware", 0); ++/* Remove comment when booting without Device Tree is no longer supported ++ if (!fw_node) { ++ dev_err(&pdev->dev, "Missing firmware node\n"); ++ return -ENOENT; ++ } ++*/ ++ fw = rpi_firmware_get(fw_node); ++ if (!fw) ++ return -EPROBE_DEFER; ++ ++ platform_set_drvdata(pdev, fw); ++ ++ /* create debugfs entries */ ++ err = vchiq_debugfs_init(); ++ if (err != 0) ++ goto failed_debugfs_init; ++ ++ err = alloc_chrdev_region(&vchiq_devid, VCHIQ_MINOR, 1, DEVICE_NAME); ++ if (err != 0) { ++ vchiq_log_error(vchiq_arm_log_level, ++ "Unable to allocate device number"); ++ goto failed_alloc_chrdev; ++ } ++ cdev_init(&vchiq_cdev, &vchiq_fops); ++ vchiq_cdev.owner = THIS_MODULE; ++ err = cdev_add(&vchiq_cdev, vchiq_devid, 1); ++ if (err != 0) { ++ vchiq_log_error(vchiq_arm_log_level, ++ "Unable to register device"); ++ goto failed_cdev_add; ++ } ++ ++ /* create sysfs entries */ ++ vchiq_class = class_create(THIS_MODULE, DEVICE_NAME); ++ ptr_err = vchiq_class; ++ if (IS_ERR(ptr_err)) ++ goto failed_class_create; ++ ++ vchiq_dev = device_create(vchiq_class, NULL, ++ vchiq_devid, NULL, "vchiq"); ++ ptr_err = vchiq_dev; ++ if (IS_ERR(ptr_err)) ++ goto failed_device_create; ++ ++ err = vchiq_platform_init(pdev, &g_state); ++ if (err != 0) ++ goto failed_platform_init; ++ ++ vchiq_log_info(vchiq_arm_log_level, ++ "vchiq: initialised - version %d (min %d), device %d.%d", ++ VCHIQ_VERSION, VCHIQ_VERSION_MIN, ++ MAJOR(vchiq_devid), MINOR(vchiq_devid)); ++ ++ return 0; ++ ++failed_platform_init: ++ device_destroy(vchiq_class, vchiq_devid); ++failed_device_create: ++ class_destroy(vchiq_class); ++failed_class_create: ++ cdev_del(&vchiq_cdev); ++ err = PTR_ERR(ptr_err); ++failed_cdev_add: ++ unregister_chrdev_region(vchiq_devid, 1); ++failed_alloc_chrdev: ++ vchiq_debugfs_deinit(); ++failed_debugfs_init: ++ vchiq_log_warning(vchiq_arm_log_level, "could not load vchiq"); ++ return err; ++} ++ ++static int vchiq_remove(struct platform_device *pdev) ++{ ++ device_destroy(vchiq_class, vchiq_devid); ++ class_destroy(vchiq_class); ++ cdev_del(&vchiq_cdev); ++ unregister_chrdev_region(vchiq_devid, 1); ++ ++ return 0; ++} ++ ++static const struct of_device_id vchiq_of_match[] = { ++ { .compatible = "brcm,bcm2835-vchiq", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, vchiq_of_match); ++ ++static struct platform_driver vchiq_driver = { ++ .driver = { ++ .name = "bcm2835_vchiq", ++ .owner = THIS_MODULE, ++ .of_match_table = vchiq_of_match, ++ }, ++ .probe = vchiq_probe, ++ .remove = vchiq_remove, ++}; ++module_platform_driver(vchiq_driver); ++ ++MODULE_LICENSE("GPL"); ++MODULE_AUTHOR("Broadcom Corporation"); +diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm.h b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm.h +new file mode 100644 +index 0000000..9740e1a +--- /dev/null ++++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm.h +@@ -0,0 +1,220 @@ ++/** ++ * Copyright (c) 2014 Raspberry Pi (Trading) Ltd. All rights reserved. ++ * Copyright (c) 2010-2012 Broadcom. 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, ++ * without modification. ++ * 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. ++ * 3. The names of the above-listed copyright holders may not be used ++ * to endorse or promote products derived from this software without ++ * specific prior written permission. ++ * ++ * ALTERNATIVELY, this software may be distributed under the terms of the ++ * GNU General Public License ("GPL") version 2, as published by the Free ++ * Software Foundation. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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. ++ */ ++ ++#ifndef VCHIQ_ARM_H ++#define VCHIQ_ARM_H ++ ++#include <linux/mutex.h> ++#include <linux/platform_device.h> ++#include <linux/semaphore.h> ++#include <linux/atomic.h> ++#include "vchiq_core.h" ++#include "vchiq_debugfs.h" ++ ++ ++enum vc_suspend_status { ++ VC_SUSPEND_FORCE_CANCELED = -3, /* Force suspend canceled, too busy */ ++ VC_SUSPEND_REJECTED = -2, /* Videocore rejected suspend request */ ++ VC_SUSPEND_FAILED = -1, /* Videocore suspend failed */ ++ VC_SUSPEND_IDLE = 0, /* VC active, no suspend actions */ ++ VC_SUSPEND_REQUESTED, /* User has requested suspend */ ++ VC_SUSPEND_IN_PROGRESS, /* Slot handler has recvd suspend request */ ++ VC_SUSPEND_SUSPENDED /* Videocore suspend succeeded */ ++}; ++ ++enum vc_resume_status { ++ VC_RESUME_FAILED = -1, /* Videocore resume failed */ ++ VC_RESUME_IDLE = 0, /* VC suspended, no resume actions */ ++ VC_RESUME_REQUESTED, /* User has requested resume */ ++ VC_RESUME_IN_PROGRESS, /* Slot handler has received resume request */ ++ VC_RESUME_RESUMED /* Videocore resumed successfully (active) */ ++}; ++ ++ ++enum USE_TYPE_E { ++ USE_TYPE_SERVICE, ++ USE_TYPE_SERVICE_NO_RESUME, ++ USE_TYPE_VCHIQ ++}; ++ ++ ++ ++typedef struct vchiq_arm_state_struct { ++ /* Keepalive-related data */ ++ struct task_struct *ka_thread; ++ struct completion ka_evt; ++ atomic_t ka_use_count; ++ atomic_t ka_use_ack_count; ++ atomic_t ka_release_count; ++ ++ struct completion vc_suspend_complete; ++ struct completion vc_resume_complete; ++ ++ rwlock_t susp_res_lock; ++ enum vc_suspend_status vc_suspend_state; ++ enum vc_resume_status vc_resume_state; ++ ++ unsigned int wake_address; ++ ++ struct timer_list suspend_timer; ++ int suspend_timer_timeout; ++ int suspend_timer_running; ++ ++ /* Global use count for videocore. ++ ** This is equal to the sum of the use counts for all services. When ++ ** this hits zero the videocore suspend procedure will be initiated. ++ */ ++ int videocore_use_count; ++ ++ /* Use count to track requests from videocore peer. ++ ** This use count is not associated with a service, so needs to be ++ ** tracked separately with the state. ++ */ ++ int peer_use_count; ++ ++ /* Flag to indicate whether resume is blocked. This happens when the ++ ** ARM is suspending ++ */ ++ struct completion resume_blocker; ++ int resume_blocked; ++ struct completion blocked_blocker; ++ int blocked_count; ++ ++ int autosuspend_override; ++ ++ /* Flag to indicate that the first vchiq connect has made it through. ++ ** This means that both sides should be fully ready, and we should ++ ** be able to suspend after this point. ++ */ ++ int first_connect; ++ ++ unsigned long long suspend_start_time; ++ unsigned long long sleep_start_time; ++ unsigned long long resume_start_time; ++ unsigned long long last_wake_time; ++ ++} VCHIQ_ARM_STATE_T; ++ ++extern int vchiq_arm_log_level; ++extern int vchiq_susp_log_level; ++ ++int vchiq_platform_init(struct platform_device *pdev, VCHIQ_STATE_T *state); ++ ++extern VCHIQ_STATE_T * ++vchiq_get_state(void); ++ ++extern VCHIQ_STATUS_T ++vchiq_arm_vcsuspend(VCHIQ_STATE_T *state); ++ ++extern VCHIQ_STATUS_T ++vchiq_arm_force_suspend(VCHIQ_STATE_T *state); ++ ++extern int ++vchiq_arm_allow_resume(VCHIQ_STATE_T *state); ++ ++extern VCHIQ_STATUS_T ++vchiq_arm_vcresume(VCHIQ_STATE_T *state); ++ ++extern VCHIQ_STATUS_T ++vchiq_arm_init_state(VCHIQ_STATE_T *state, VCHIQ_ARM_STATE_T *arm_state); ++ ++extern int ++vchiq_check_resume(VCHIQ_STATE_T *state); ++ ++extern void ++vchiq_check_suspend(VCHIQ_STATE_T *state); ++ VCHIQ_STATUS_T ++vchiq_use_service(VCHIQ_SERVICE_HANDLE_T handle); ++ ++extern VCHIQ_STATUS_T ++vchiq_release_service(VCHIQ_SERVICE_HANDLE_T handle); ++ ++extern VCHIQ_STATUS_T ++vchiq_check_service(VCHIQ_SERVICE_T *service); ++ ++extern VCHIQ_STATUS_T ++vchiq_platform_suspend(VCHIQ_STATE_T *state); ++ ++extern int ++vchiq_platform_videocore_wanted(VCHIQ_STATE_T *state); ++ ++extern int ++vchiq_platform_use_suspend_timer(void); ++ ++extern void ++vchiq_dump_platform_use_state(VCHIQ_STATE_T *state); ++ ++extern void ++vchiq_dump_service_use_state(VCHIQ_STATE_T *state); ++ ++extern VCHIQ_ARM_STATE_T* ++vchiq_platform_get_arm_state(VCHIQ_STATE_T *state); ++ ++extern int ++vchiq_videocore_wanted(VCHIQ_STATE_T *state); ++ ++extern VCHIQ_STATUS_T ++vchiq_use_internal(VCHIQ_STATE_T *state, VCHIQ_SERVICE_T *service, ++ enum USE_TYPE_E use_type); ++extern VCHIQ_STATUS_T ++vchiq_release_internal(VCHIQ_STATE_T *state, VCHIQ_SERVICE_T *service); ++ ++extern VCHIQ_DEBUGFS_NODE_T * ++vchiq_instance_get_debugfs_node(VCHIQ_INSTANCE_T instance); ++ ++extern int ++vchiq_instance_get_use_count(VCHIQ_INSTANCE_T instance); ++ ++extern int ++vchiq_instance_get_pid(VCHIQ_INSTANCE_T instance); ++ ++extern int ++vchiq_instance_get_trace(VCHIQ_INSTANCE_T instance); ++ ++extern void ++vchiq_instance_set_trace(VCHIQ_INSTANCE_T instance, int trace); ++ ++extern void ++set_suspend_state(VCHIQ_ARM_STATE_T *arm_state, ++ enum vc_suspend_status new_state); ++ ++extern void ++set_resume_state(VCHIQ_ARM_STATE_T *arm_state, ++ enum vc_resume_status new_state); ++ ++extern void ++start_suspend_timer(VCHIQ_ARM_STATE_T *arm_state); ++ ++ ++#endif /* VCHIQ_ARM_H */ +diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_build_info.h b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_build_info.h +new file mode 100644 +index 0000000..df64581 +--- /dev/null ++++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_build_info.h +@@ -0,0 +1,37 @@ ++/** ++ * Copyright (c) 2010-2012 Broadcom. 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, ++ * without modification. ++ * 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. ++ * 3. The names of the above-listed copyright holders may not be used ++ * to endorse or promote products derived from this software without ++ * specific prior written permission. ++ * ++ * ALTERNATIVELY, this software may be distributed under the terms of the ++ * GNU General Public License ("GPL") version 2, as published by the Free ++ * Software Foundation. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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. ++ */ ++ ++const char *vchiq_get_build_hostname(void); ++const char *vchiq_get_build_version(void); ++const char *vchiq_get_build_time(void); ++const char *vchiq_get_build_date(void); +diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_cfg.h b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_cfg.h +new file mode 100644 +index 0000000..d2797db +--- /dev/null ++++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_cfg.h +@@ -0,0 +1,69 @@ ++/** ++ * Copyright (c) 2010-2014 Broadcom. 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, ++ * without modification. ++ * 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. ++ * 3. The names of the above-listed copyright holders may not be used ++ * to endorse or promote products derived from this software without ++ * specific prior written permission. ++ * ++ * ALTERNATIVELY, this software may be distributed under the terms of the ++ * GNU General Public License ("GPL") version 2, as published by the Free ++ * Software Foundation. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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. ++ */ ++ ++#ifndef VCHIQ_CFG_H ++#define VCHIQ_CFG_H ++ ++#define VCHIQ_MAGIC VCHIQ_MAKE_FOURCC('V', 'C', 'H', 'I') ++/* The version of VCHIQ - change with any non-trivial change */ ++#define VCHIQ_VERSION 8 ++/* The minimum compatible version - update to match VCHIQ_VERSION with any ++** incompatible change */ ++#define VCHIQ_VERSION_MIN 3 ++ ++/* The version that introduced the VCHIQ_IOC_LIB_VERSION ioctl */ ++#define VCHIQ_VERSION_LIB_VERSION 7 ++ ++/* The version that introduced the VCHIQ_IOC_CLOSE_DELIVERED ioctl */ ++#define VCHIQ_VERSION_CLOSE_DELIVERED 7 ++ ++/* The version that made it safe to use SYNCHRONOUS mode */ ++#define VCHIQ_VERSION_SYNCHRONOUS_MODE 8 ++ ++#define VCHIQ_MAX_STATES 1 ++#define VCHIQ_MAX_SERVICES 4096 ++#define VCHIQ_MAX_SLOTS 128 ++#define VCHIQ_MAX_SLOTS_PER_SIDE 64 ++ ++#define VCHIQ_NUM_CURRENT_BULKS 32 ++#define VCHIQ_NUM_SERVICE_BULKS 4 ++ ++#ifndef VCHIQ_ENABLE_DEBUG ++#define VCHIQ_ENABLE_DEBUG 1 ++#endif ++ ++#ifndef VCHIQ_ENABLE_STATS ++#define VCHIQ_ENABLE_STATS 1 ++#endif ++ ++#endif /* VCHIQ_CFG_H */ +diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_connected.c b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_connected.c +new file mode 100644 +index 0000000..5efc62f +--- /dev/null ++++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_connected.c +@@ -0,0 +1,120 @@ ++/** ++ * Copyright (c) 2010-2012 Broadcom. 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, ++ * without modification. ++ * 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. ++ * 3. The names of the above-listed copyright holders may not be used ++ * to endorse or promote products derived from this software without ++ * specific prior written permission. ++ * ++ * ALTERNATIVELY, this software may be distributed under the terms of the ++ * GNU General Public License ("GPL") version 2, as published by the Free ++ * Software Foundation. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER OR ++ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ++ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, ++ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR ++ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF ++ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING ++ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ */ ++ ++#include "vchiq_connected.h" ++#include "vchiq_core.h" ++#include "vchiq_killable.h" ++#include <linux/module.h> ++#include <linux/mutex.h> ++ ++#define MAX_CALLBACKS 10 ++ ++static int g_connected; ++static int g_num_deferred_callbacks; ++static VCHIQ_CONNECTED_CALLBACK_T g_deferred_callback[MAX_CALLBACKS]; ++static int g_once_init; ++static struct mutex g_connected_mutex; ++ ++/**************************************************************************** ++* ++* Function to initialize our lock. ++* ++***************************************************************************/ ++ ++static void connected_init(void) ++{ ++ if (!g_once_init) { ++ mutex_init(&g_connected_mutex); ++ g_once_init = 1; ++ } ++} ++ ++/**************************************************************************** ++* ++* This function is used to defer initialization until the vchiq stack is ++* initialized. If the stack is already initialized, then the callback will ++* be made immediately, otherwise it will be deferred until ++* vchiq_call_connected_callbacks is called. ++* ++***************************************************************************/ ++ ++void vchiq_add_connected_callback(VCHIQ_CONNECTED_CALLBACK_T callback) ++{ ++ connected_init(); ++ ++ if (mutex_lock_interruptible(&g_connected_mutex) != 0) ++ return; ++ ++ if (g_connected) ++ /* We're already connected. Call the callback immediately. */ ++ ++ callback(); ++ else { ++ if (g_num_deferred_callbacks >= MAX_CALLBACKS) ++ vchiq_log_error(vchiq_core_log_level, ++ "There already %d callback registered - " ++ "please increase MAX_CALLBACKS", ++ g_num_deferred_callbacks); ++ else { ++ g_deferred_callback[g_num_deferred_callbacks] = ++ callback; ++ g_num_deferred_callbacks++; ++ } ++ } ++ mutex_unlock(&g_connected_mutex); ++} ++ ++/**************************************************************************** ++* ++* This function is called by the vchiq stack once it has been connected to ++* the videocore and clients can start to use the stack. ++* ++***************************************************************************/ ++ ++void vchiq_call_connected_callbacks(void) ++{ ++ int i; ++ ++ connected_init(); ++ ++ if (mutex_lock_interruptible(&g_connected_mutex) != 0) ++ return; ++ ++ for (i = 0; i < g_num_deferred_callbacks; i++) ++ g_deferred_callback[i](); ++ ++ g_num_deferred_callbacks = 0; ++ g_connected = 1; ++ mutex_unlock(&g_connected_mutex); ++} ++EXPORT_SYMBOL(vchiq_add_connected_callback); +diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_connected.h b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_connected.h +new file mode 100644 +index 0000000..863b3e3 +--- /dev/null ++++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_connected.h +@@ -0,0 +1,50 @@ ++/** ++ * Copyright (c) 2010-2012 Broadcom. 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, ++ * without modification. ++ * 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. ++ * 3. The names of the above-listed copyright holders may not be used ++ * to endorse or promote products derived from this software without ++ * specific prior written permission. ++ * ++ * ALTERNATIVELY, this software may be distributed under the terms of the ++ * GNU General Public License ("GPL") version 2, as published by the Free ++ * Software Foundation. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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. ++ */ ++ ++#ifndef VCHIQ_CONNECTED_H ++#define VCHIQ_CONNECTED_H ++ ++/* ---- Include Files ----------------------------------------------------- */ ++ ++/* ---- Constants and Types ---------------------------------------------- */ ++ ++typedef void (*VCHIQ_CONNECTED_CALLBACK_T)(void); ++ ++/* ---- Variable Externs ------------------------------------------------- */ ++ ++/* ---- Function Prototypes ---------------------------------------------- */ ++ ++void vchiq_add_connected_callback(VCHIQ_CONNECTED_CALLBACK_T callback); ++void vchiq_call_connected_callbacks(void); ++ ++#endif /* VCHIQ_CONNECTED_H */ +diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_core.c b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_core.c +new file mode 100644 +index 0000000..160db24 +--- /dev/null ++++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_core.c +@@ -0,0 +1,3929 @@ ++/** ++ * Copyright (c) 2010-2012 Broadcom. 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, ++ * without modification. ++ * 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. ++ * 3. The names of the above-listed copyright holders may not be used ++ * to endorse or promote products derived from this software without ++ * specific prior written permission. ++ * ++ * ALTERNATIVELY, this software may be distributed under the terms of the ++ * GNU General Public License ("GPL") version 2, as published by the Free ++ * Software Foundation. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER OR ++ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ++ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, ++ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR ++ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF ++ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING ++ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ */ ++ ++#include "vchiq_core.h" ++#include "vchiq_killable.h" ++ ++#define VCHIQ_SLOT_HANDLER_STACK 8192 ++ ++#define HANDLE_STATE_SHIFT 12 ++ ++#define SLOT_INFO_FROM_INDEX(state, index) (state->slot_info + (index)) ++#define SLOT_DATA_FROM_INDEX(state, index) (state->slot_data + (index)) ++#define SLOT_INDEX_FROM_DATA(state, data) \ ++ (((unsigned int)((char *)data - (char *)state->slot_data)) / \ ++ VCHIQ_SLOT_SIZE) ++#define SLOT_INDEX_FROM_INFO(state, info) \ ++ ((unsigned int)(info - state->slot_info)) ++#define SLOT_QUEUE_INDEX_FROM_POS(pos) \ ++ ((int)((unsigned int)(pos) / VCHIQ_SLOT_SIZE)) ++ ++#define BULK_INDEX(x) (x & (VCHIQ_NUM_SERVICE_BULKS - 1)) ++ ++#define SRVTRACE_LEVEL(srv) \ ++ (((srv) && (srv)->trace) ? VCHIQ_LOG_TRACE : vchiq_core_msg_log_level) ++#define SRVTRACE_ENABLED(srv, lev) \ ++ (((srv) && (srv)->trace) || (vchiq_core_msg_log_level >= (lev))) ++ ++struct vchiq_open_payload { ++ int fourcc; ++ int client_id; ++ short version; ++ short version_min; ++}; ++ ++struct vchiq_openack_payload { ++ short version; ++}; ++ ++enum ++{ ++ QMFLAGS_IS_BLOCKING = (1 << 0), ++ QMFLAGS_NO_MUTEX_LOCK = (1 << 1), ++ QMFLAGS_NO_MUTEX_UNLOCK = (1 << 2) ++}; ++ ++/* we require this for consistency between endpoints */ ++vchiq_static_assert(sizeof(VCHIQ_HEADER_T) == 8); ++vchiq_static_assert(IS_POW2(sizeof(VCHIQ_HEADER_T))); ++vchiq_static_assert(IS_POW2(VCHIQ_NUM_CURRENT_BULKS)); ++vchiq_static_assert(IS_POW2(VCHIQ_NUM_SERVICE_BULKS)); ++vchiq_static_assert(IS_POW2(VCHIQ_MAX_SERVICES)); ++vchiq_static_assert(VCHIQ_VERSION >= VCHIQ_VERSION_MIN); ++ ++/* Run time control of log level, based on KERN_XXX level. */ ++int vchiq_core_log_level = VCHIQ_LOG_DEFAULT; ++int vchiq_core_msg_log_level = VCHIQ_LOG_DEFAULT; ++int vchiq_sync_log_level = VCHIQ_LOG_DEFAULT; ++ ++static atomic_t pause_bulks_count = ATOMIC_INIT(0); ++ ++static DEFINE_SPINLOCK(service_spinlock); ++DEFINE_SPINLOCK(bulk_waiter_spinlock); ++DEFINE_SPINLOCK(quota_spinlock); ++ ++VCHIQ_STATE_T *vchiq_states[VCHIQ_MAX_STATES]; ++static unsigned int handle_seq; ++ ++static const char *const srvstate_names[] = { ++ "FREE", ++ "HIDDEN", ++ "LISTENING", ++ "OPENING", ++ "OPEN", ++ "OPENSYNC", ++ "CLOSESENT", ++ "CLOSERECVD", ++ "CLOSEWAIT", ++ "CLOSED" ++}; ++ ++static const char *const reason_names[] = { ++ "SERVICE_OPENED", ++ "SERVICE_CLOSED", ++ "MESSAGE_AVAILABLE", ++ "BULK_TRANSMIT_DONE", ++ "BULK_RECEIVE_DONE", ++ "BULK_TRANSMIT_ABORTED", ++ "BULK_RECEIVE_ABORTED" ++}; ++ ++static const char *const conn_state_names[] = { ++ "DISCONNECTED", ++ "CONNECTING", ++ "CONNECTED", ++ "PAUSING", ++ "PAUSE_SENT", ++ "PAUSED", ++ "RESUMING", ++ "PAUSE_TIMEOUT", ++ "RESUME_TIMEOUT" ++}; ++ ++ ++static void ++release_message_sync(VCHIQ_STATE_T *state, VCHIQ_HEADER_T *header); ++ ++static const char *msg_type_str(unsigned int msg_type) ++{ ++ switch (msg_type) { ++ case VCHIQ_MSG_PADDING: return "PADDING"; ++ case VCHIQ_MSG_CONNECT: return "CONNECT"; ++ case VCHIQ_MSG_OPEN: return "OPEN"; ++ case VCHIQ_MSG_OPENACK: return "OPENACK"; ++ case VCHIQ_MSG_CLOSE: return "CLOSE"; ++ case VCHIQ_MSG_DATA: return "DATA"; ++ case VCHIQ_MSG_BULK_RX: return "BULK_RX"; ++ case VCHIQ_MSG_BULK_TX: return "BULK_TX"; ++ case VCHIQ_MSG_BULK_RX_DONE: return "BULK_RX_DONE"; ++ case VCHIQ_MSG_BULK_TX_DONE: return "BULK_TX_DONE"; ++ case VCHIQ_MSG_PAUSE: return "PAUSE"; ++ case VCHIQ_MSG_RESUME: return "RESUME"; ++ case VCHIQ_MSG_REMOTE_USE: return "REMOTE_USE"; ++ case VCHIQ_MSG_REMOTE_RELEASE: return "REMOTE_RELEASE"; ++ case VCHIQ_MSG_REMOTE_USE_ACTIVE: return "REMOTE_USE_ACTIVE"; ++ } ++ return "???"; ++} ++ ++static inline void ++vchiq_set_service_state(VCHIQ_SERVICE_T *service, int newstate) ++{ ++ vchiq_log_info(vchiq_core_log_level, "%d: srv:%d %s->%s", ++ service->state->id, service->localport, ++ srvstate_names[service->srvstate], ++ srvstate_names[newstate]); ++ service->srvstate = newstate; ++} ++ ++VCHIQ_SERVICE_T * ++find_service_by_handle(VCHIQ_SERVICE_HANDLE_T handle) ++{ ++ VCHIQ_SERVICE_T *service; ++ ++ spin_lock(&service_spinlock); ++ service = handle_to_service(handle); ++ if (service && (service->srvstate != VCHIQ_SRVSTATE_FREE) && ++ (service->handle == handle)) { ++ BUG_ON(service->ref_count == 0); ++ service->ref_count++; ++ } else ++ service = NULL; ++ spin_unlock(&service_spinlock); ++ ++ if (!service) ++ vchiq_log_info(vchiq_core_log_level, ++ "Invalid service handle 0x%x", handle); ++ ++ return service; ++} ++ ++VCHIQ_SERVICE_T * ++find_service_by_port(VCHIQ_STATE_T *state, int localport) ++{ ++ VCHIQ_SERVICE_T *service = NULL; ++ if ((unsigned int)localport <= VCHIQ_PORT_MAX) { ++ spin_lock(&service_spinlock); ++ service = state->services[localport]; ++ if (service && (service->srvstate != VCHIQ_SRVSTATE_FREE)) { ++ BUG_ON(service->ref_count == 0); ++ service->ref_count++; ++ } else ++ service = NULL; ++ spin_unlock(&service_spinlock); ++ } ++ ++ if (!service) ++ vchiq_log_info(vchiq_core_log_level, ++ "Invalid port %d", localport); ++ ++ return service; ++} ++ ++VCHIQ_SERVICE_T * ++find_service_for_instance(VCHIQ_INSTANCE_T instance, ++ VCHIQ_SERVICE_HANDLE_T handle) { ++ VCHIQ_SERVICE_T *service; ++ ++ spin_lock(&service_spinlock); ++ service = handle_to_service(handle); ++ if (service && (service->srvstate != VCHIQ_SRVSTATE_FREE) && ++ (service->handle == handle) && ++ (service->instance == instance)) { ++ BUG_ON(service->ref_count == 0); ++ service->ref_count++; ++ } else ++ service = NULL; ++ spin_unlock(&service_spinlock); ++ ++ if (!service) ++ vchiq_log_info(vchiq_core_log_level, ++ "Invalid service handle 0x%x", handle); ++ ++ return service; ++} ++ ++VCHIQ_SERVICE_T * ++find_closed_service_for_instance(VCHIQ_INSTANCE_T instance, ++ VCHIQ_SERVICE_HANDLE_T handle) { ++ VCHIQ_SERVICE_T *service; ++ ++ spin_lock(&service_spinlock); ++ service = handle_to_service(handle); ++ if (service && ++ ((service->srvstate == VCHIQ_SRVSTATE_FREE) || ++ (service->srvstate == VCHIQ_SRVSTATE_CLOSED)) && ++ (service->handle == handle) && ++ (service->instance == instance)) { ++ BUG_ON(service->ref_count == 0); ++ service->ref_count++; ++ } else ++ service = NULL; ++ spin_unlock(&service_spinlock); ++ ++ if (!service) ++ vchiq_log_info(vchiq_core_log_level, ++ "Invalid service handle 0x%x", handle); ++ ++ return service; ++} ++ ++VCHIQ_SERVICE_T * ++next_service_by_instance(VCHIQ_STATE_T *state, VCHIQ_INSTANCE_T instance, ++ int *pidx) ++{ ++ VCHIQ_SERVICE_T *service = NULL; ++ int idx = *pidx; ++ ++ spin_lock(&service_spinlock); ++ while (idx < state->unused_service) { ++ VCHIQ_SERVICE_T *srv = state->services[idx++]; ++ if (srv && (srv->srvstate != VCHIQ_SRVSTATE_FREE) && ++ (srv->instance == instance)) { ++ service = srv; ++ BUG_ON(service->ref_count == 0); ++ service->ref_count++; ++ break; ++ } ++ } ++ spin_unlock(&service_spinlock); ++ ++ *pidx = idx; ++ ++ return service; ++} ++ ++void ++lock_service(VCHIQ_SERVICE_T *service) ++{ ++ spin_lock(&service_spinlock); ++ BUG_ON(!service || (service->ref_count == 0)); ++ if (service) ++ service->ref_count++; ++ spin_unlock(&service_spinlock); ++} ++ ++void ++unlock_service(VCHIQ_SERVICE_T *service) ++{ ++ VCHIQ_STATE_T *state = service->state; ++ spin_lock(&service_spinlock); ++ BUG_ON(!service || (service->ref_count == 0)); ++ if (service && service->ref_count) { ++ service->ref_count--; ++ if (!service->ref_count) { ++ BUG_ON(service->srvstate != VCHIQ_SRVSTATE_FREE); ++ state->services[service->localport] = NULL; ++ } else ++ service = NULL; ++ } ++ spin_unlock(&service_spinlock); ++ ++ if (service && service->userdata_term) ++ service->userdata_term(service->base.userdata); ++ ++ kfree(service); ++} ++ ++int ++vchiq_get_client_id(VCHIQ_SERVICE_HANDLE_T handle) ++{ ++ VCHIQ_SERVICE_T *service = find_service_by_handle(handle); ++ int id; ++ ++ id = service ? service->client_id : 0; ++ if (service) ++ unlock_service(service); ++ ++ return id; ++} ++ ++void * ++vchiq_get_service_userdata(VCHIQ_SERVICE_HANDLE_T handle) ++{ ++ VCHIQ_SERVICE_T *service = handle_to_service(handle); ++ ++ return service ? service->base.userdata : NULL; ++} ++ ++int ++vchiq_get_service_fourcc(VCHIQ_SERVICE_HANDLE_T handle) ++{ ++ VCHIQ_SERVICE_T *service = handle_to_service(handle); ++ ++ return service ? service->base.fourcc : 0; ++} ++ ++static void ++mark_service_closing_internal(VCHIQ_SERVICE_T *service, int sh_thread) ++{ ++ VCHIQ_STATE_T *state = service->state; ++ VCHIQ_SERVICE_QUOTA_T *service_quota; ++ ++ service->closing = 1; ++ ++ /* Synchronise with other threads. */ ++ mutex_lock(&state->recycle_mutex); ++ mutex_unlock(&state->recycle_mutex); ++ if (!sh_thread || (state->conn_state != VCHIQ_CONNSTATE_PAUSE_SENT)) { ++ /* If we're pausing then the slot_mutex is held until resume ++ * by the slot handler. Therefore don't try to acquire this ++ * mutex if we're the slot handler and in the pause sent state. ++ * We don't need to in this case anyway. */ ++ mutex_lock(&state->slot_mutex); ++ mutex_unlock(&state->slot_mutex); ++ } ++ ++ /* Unblock any sending thread. */ ++ service_quota = &state->service_quotas[service->localport]; ++ up(&service_quota->quota_event); ++} ++ ++static void ++mark_service_closing(VCHIQ_SERVICE_T *service) ++{ ++ mark_service_closing_internal(service, 0); ++} ++ ++static inline VCHIQ_STATUS_T ++make_service_callback(VCHIQ_SERVICE_T *service, VCHIQ_REASON_T reason, ++ VCHIQ_HEADER_T *header, void *bulk_userdata) ++{ ++ VCHIQ_STATUS_T status; ++ vchiq_log_trace(vchiq_core_log_level, "%d: callback:%d (%s, %x, %x)", ++ service->state->id, service->localport, reason_names[reason], ++ (unsigned int)header, (unsigned int)bulk_userdata); ++ status = service->base.callback(reason, header, service->handle, ++ bulk_userdata); ++ if (status == VCHIQ_ERROR) { ++ vchiq_log_warning(vchiq_core_log_level, ++ "%d: ignoring ERROR from callback to service %x", ++ service->state->id, service->handle); ++ status = VCHIQ_SUCCESS; ++ } ++ return status; ++} ++ ++inline void ++vchiq_set_conn_state(VCHIQ_STATE_T *state, VCHIQ_CONNSTATE_T newstate) ++{ ++ VCHIQ_CONNSTATE_T oldstate = state->conn_state; ++ vchiq_log_info(vchiq_core_log_level, "%d: %s->%s", state->id, ++ conn_state_names[oldstate], ++ conn_state_names[newstate]); ++ state->conn_state = newstate; ++ vchiq_platform_conn_state_changed(state, oldstate, newstate); ++} ++ ++static inline void ++remote_event_create(REMOTE_EVENT_T *event) ++{ ++ event->armed = 0; ++ /* Don't clear the 'fired' flag because it may already have been set ++ ** by the other side. */ ++ sema_init(event->event, 0); ++} ++ ++static inline void ++remote_event_destroy(REMOTE_EVENT_T *event) ++{ ++ (void)event; ++} ++ ++static inline int ++remote_event_wait(REMOTE_EVENT_T *event) ++{ ++ if (!event->fired) { ++ event->armed = 1; ++ dsb(); ++ if (!event->fired) { ++ if (down_interruptible(event->event) != 0) { ++ event->armed = 0; ++ return 0; ++ } ++ } ++ event->armed = 0; ++ wmb(); ++ } ++ ++ event->fired = 0; ++ return 1; ++} ++ ++static inline void ++remote_event_signal_local(REMOTE_EVENT_T *event) ++{ ++ event->armed = 0; ++ up(event->event); ++} ++ ++static inline void ++remote_event_poll(REMOTE_EVENT_T *event) ++{ ++ if (event->fired && event->armed) ++ remote_event_signal_local(event); ++} ++ ++void ++remote_event_pollall(VCHIQ_STATE_T *state) ++{ ++ remote_event_poll(&state->local->sync_trigger); ++ remote_event_poll(&state->local->sync_release); ++ remote_event_poll(&state->local->trigger); ++ remote_event_poll(&state->local->recycle); ++} ++ ++/* Round up message sizes so that any space at the end of a slot is always big ++** enough for a header. This relies on header size being a power of two, which ++** has been verified earlier by a static assertion. */ ++ ++static inline unsigned int ++calc_stride(unsigned int size) ++{ ++ /* Allow room for the header */ ++ size += sizeof(VCHIQ_HEADER_T); ++ ++ /* Round up */ ++ return (size + sizeof(VCHIQ_HEADER_T) - 1) & ~(sizeof(VCHIQ_HEADER_T) ++ - 1); ++} ++ ++/* Called by the slot handler thread */ ++static VCHIQ_SERVICE_T * ++get_listening_service(VCHIQ_STATE_T *state, int fourcc) ++{ ++ int i; ++ ++ WARN_ON(fourcc == VCHIQ_FOURCC_INVALID); ++ ++ for (i = 0; i < state->unused_service; i++) { ++ VCHIQ_SERVICE_T *service = state->services[i]; ++ if (service && ++ (service->public_fourcc == fourcc) && ++ ((service->srvstate == VCHIQ_SRVSTATE_LISTENING) || ++ ((service->srvstate == VCHIQ_SRVSTATE_OPEN) && ++ (service->remoteport == VCHIQ_PORT_FREE)))) { ++ lock_service(service); ++ return service; ++ } ++ } ++ ++ return NULL; ++} ++ ++/* Called by the slot handler thread */ ++static VCHIQ_SERVICE_T * ++get_connected_service(VCHIQ_STATE_T *state, unsigned int port) ++{ ++ int i; ++ for (i = 0; i < state->unused_service; i++) { ++ VCHIQ_SERVICE_T *service = state->services[i]; ++ if (service && (service->srvstate == VCHIQ_SRVSTATE_OPEN) ++ && (service->remoteport == port)) { ++ lock_service(service); ++ return service; ++ } ++ } ++ return NULL; ++} ++ ++inline void ++request_poll(VCHIQ_STATE_T *state, VCHIQ_SERVICE_T *service, int poll_type) ++{ ++ uint32_t value; ++ ++ if (service) { ++ do { ++ value = atomic_read(&service->poll_flags); ++ } while (atomic_cmpxchg(&service->poll_flags, value, ++ value | (1 << poll_type)) != value); ++ ++ do { ++ value = atomic_read(&state->poll_services[ ++ service->localport>>5]); ++ } while (atomic_cmpxchg( ++ &state->poll_services[service->localport>>5], ++ value, value | (1 << (service->localport & 0x1f))) ++ != value); ++ } ++ ++ state->poll_needed = 1; ++ wmb(); ++ ++ /* ... and ensure the slot handler runs. */ ++ remote_event_signal_local(&state->local->trigger); ++} ++ ++/* Called from queue_message, by the slot handler and application threads, ++** with slot_mutex held */ ++static VCHIQ_HEADER_T * ++reserve_space(VCHIQ_STATE_T *state, int space, int is_blocking) ++{ ++ VCHIQ_SHARED_STATE_T *local = state->local; ++ int tx_pos = state->local_tx_pos; ++ int slot_space = VCHIQ_SLOT_SIZE - (tx_pos & VCHIQ_SLOT_MASK); ++ ++ if (space > slot_space) { ++ VCHIQ_HEADER_T *header; ++ /* Fill the remaining space with padding */ ++ WARN_ON(state->tx_data == NULL); ++ header = (VCHIQ_HEADER_T *) ++ (state->tx_data + (tx_pos & VCHIQ_SLOT_MASK)); ++ header->msgid = VCHIQ_MSGID_PADDING; ++ header->size = slot_space - sizeof(VCHIQ_HEADER_T); ++ ++ tx_pos += slot_space; ++ } ++ ++ /* If necessary, get the next slot. */ ++ if ((tx_pos & VCHIQ_SLOT_MASK) == 0) { ++ int slot_index; ++ ++ /* If there is no free slot... */ ++ ++ if (down_trylock(&state->slot_available_event) != 0) { ++ /* ...wait for one. */ ++ ++ VCHIQ_STATS_INC(state, slot_stalls); ++ ++ /* But first, flush through the last slot. */ ++ state->local_tx_pos = tx_pos; ++ local->tx_pos = tx_pos; ++ remote_event_signal(&state->remote->trigger); ++ ++ if (!is_blocking || ++ (down_interruptible( ++ &state->slot_available_event) != 0)) ++ return NULL; /* No space available */ ++ } ++ ++ BUG_ON(tx_pos == ++ (state->slot_queue_available * VCHIQ_SLOT_SIZE)); ++ ++ slot_index = local->slot_queue[ ++ SLOT_QUEUE_INDEX_FROM_POS(tx_pos) & ++ VCHIQ_SLOT_QUEUE_MASK]; ++ state->tx_data = ++ (char *)SLOT_DATA_FROM_INDEX(state, slot_index); ++ } ++ ++ state->local_tx_pos = tx_pos + space; ++ ++ return (VCHIQ_HEADER_T *)(state->tx_data + (tx_pos & VCHIQ_SLOT_MASK)); ++} ++ ++/* Called by the recycle thread. */ ++static void ++process_free_queue(VCHIQ_STATE_T *state) ++{ ++ VCHIQ_SHARED_STATE_T *local = state->local; ++ BITSET_T service_found[BITSET_SIZE(VCHIQ_MAX_SERVICES)]; ++ int slot_queue_available; ++ ++ /* Use a read memory barrier to ensure that any state that may have ++ ** been modified by another thread is not masked by stale prefetched ++ ** values. */ ++ rmb(); ++ ++ /* Find slots which have been freed by the other side, and return them ++ ** to the available queue. */ ++ slot_queue_available = state->slot_queue_available; ++ ++ while (slot_queue_available != local->slot_queue_recycle) { ++ unsigned int pos; ++ int slot_index = local->slot_queue[slot_queue_available++ & ++ VCHIQ_SLOT_QUEUE_MASK]; ++ char *data = (char *)SLOT_DATA_FROM_INDEX(state, slot_index); ++ int data_found = 0; ++ ++ vchiq_log_trace(vchiq_core_log_level, "%d: pfq %d=%x %x %x", ++ state->id, slot_index, (unsigned int)data, ++ local->slot_queue_recycle, slot_queue_available); ++ ++ /* Initialise the bitmask for services which have used this ++ ** slot */ ++ BITSET_ZERO(service_found); ++ ++ pos = 0; ++ ++ while (pos < VCHIQ_SLOT_SIZE) { ++ VCHIQ_HEADER_T *header = ++ (VCHIQ_HEADER_T *)(data + pos); ++ int msgid = header->msgid; ++ if (VCHIQ_MSG_TYPE(msgid) == VCHIQ_MSG_DATA) { ++ int port = VCHIQ_MSG_SRCPORT(msgid); ++ VCHIQ_SERVICE_QUOTA_T *service_quota = ++ &state->service_quotas[port]; ++ int count; ++ spin_lock(&quota_spinlock); ++ count = service_quota->message_use_count; ++ if (count > 0) ++ service_quota->message_use_count = ++ count - 1; ++ spin_unlock(&quota_spinlock); ++ ++ if (count == service_quota->message_quota) ++ /* Signal the service that it ++ ** has dropped below its quota ++ */ ++ up(&service_quota->quota_event); ++ else if (count == 0) { ++ vchiq_log_error(vchiq_core_log_level, ++ "service %d " ++ "message_use_count=%d " ++ "(header %x, msgid %x, " ++ "header->msgid %x, " ++ "header->size %x)", ++ port, ++ service_quota-> ++ message_use_count, ++ (unsigned int)header, msgid, ++ header->msgid, ++ header->size); ++ WARN(1, "invalid message use count\n"); ++ } ++ if (!BITSET_IS_SET(service_found, port)) { ++ /* Set the found bit for this service */ ++ BITSET_SET(service_found, port); ++ ++ spin_lock(&quota_spinlock); ++ count = service_quota->slot_use_count; ++ if (count > 0) ++ service_quota->slot_use_count = ++ count - 1; ++ spin_unlock(&quota_spinlock); ++ ++ if (count > 0) { ++ /* Signal the service in case ++ ** it has dropped below its ++ ** quota */ ++ up(&service_quota->quota_event); ++ vchiq_log_trace( ++ vchiq_core_log_level, ++ "%d: pfq:%d %x@%x - " ++ "slot_use->%d", ++ state->id, port, ++ header->size, ++ (unsigned int)header, ++ count - 1); ++ } else { ++ vchiq_log_error( ++ vchiq_core_log_level, ++ "service %d " ++ "slot_use_count" ++ "=%d (header %x" ++ ", msgid %x, " ++ "header->msgid" ++ " %x, header->" ++ "size %x)", ++ port, count, ++ (unsigned int)header, ++ msgid, ++ header->msgid, ++ header->size); ++ WARN(1, "bad slot use count\n"); ++ } ++ } ++ ++ data_found = 1; ++ } ++ ++ pos += calc_stride(header->size); ++ if (pos > VCHIQ_SLOT_SIZE) { ++ vchiq_log_error(vchiq_core_log_level, ++ "pfq - pos %x: header %x, msgid %x, " ++ "header->msgid %x, header->size %x", ++ pos, (unsigned int)header, msgid, ++ header->msgid, header->size); ++ WARN(1, "invalid slot position\n"); ++ } ++ } ++ ++ if (data_found) { ++ int count; ++ spin_lock(&quota_spinlock); ++ count = state->data_use_count; ++ if (count > 0) ++ state->data_use_count = ++ count - 1; ++ spin_unlock(&quota_spinlock); ++ if (count == state->data_quota) ++ up(&state->data_quota_event); ++ } ++ ++ state->slot_queue_available = slot_queue_available; ++ up(&state->slot_available_event); ++ } ++} ++ ++/* Called by the slot handler and application threads */ ++static VCHIQ_STATUS_T ++queue_message(VCHIQ_STATE_T *state, VCHIQ_SERVICE_T *service, ++ int msgid, const VCHIQ_ELEMENT_T *elements, ++ int count, int size, int flags) ++{ ++ VCHIQ_SHARED_STATE_T *local; ++ VCHIQ_SERVICE_QUOTA_T *service_quota = NULL; ++ VCHIQ_HEADER_T *header; ++ int type = VCHIQ_MSG_TYPE(msgid); ++ ++ unsigned int stride; ++ ++ local = state->local; ++ ++ stride = calc_stride(size); ++ ++ WARN_ON(!(stride <= VCHIQ_SLOT_SIZE)); ++ ++ if (!(flags & QMFLAGS_NO_MUTEX_LOCK) && ++ (mutex_lock_interruptible(&state->slot_mutex) != 0)) ++ return VCHIQ_RETRY; ++ ++ if (type == VCHIQ_MSG_DATA) { ++ int tx_end_index; ++ ++ BUG_ON(!service); ++ BUG_ON((flags & (QMFLAGS_NO_MUTEX_LOCK | ++ QMFLAGS_NO_MUTEX_UNLOCK)) != 0); ++ ++ if (service->closing) { ++ /* The service has been closed */ ++ mutex_unlock(&state->slot_mutex); ++ return VCHIQ_ERROR; ++ } ++ ++ service_quota = &state->service_quotas[service->localport]; ++ ++ spin_lock(&quota_spinlock); ++ ++ /* Ensure this service doesn't use more than its quota of ++ ** messages or slots */ ++ tx_end_index = SLOT_QUEUE_INDEX_FROM_POS( ++ state->local_tx_pos + stride - 1); ++ ++ /* Ensure data messages don't use more than their quota of ++ ** slots */ ++ while ((tx_end_index != state->previous_data_index) && ++ (state->data_use_count == state->data_quota)) { ++ VCHIQ_STATS_INC(state, data_stalls); ++ spin_unlock(&quota_spinlock); ++ mutex_unlock(&state->slot_mutex); ++ ++ if (down_interruptible(&state->data_quota_event) ++ != 0) ++ return VCHIQ_RETRY; ++ ++ mutex_lock(&state->slot_mutex); ++ spin_lock(&quota_spinlock); ++ tx_end_index = SLOT_QUEUE_INDEX_FROM_POS( ++ state->local_tx_pos + stride - 1); ++ if ((tx_end_index == state->previous_data_index) || ++ (state->data_use_count < state->data_quota)) { ++ /* Pass the signal on to other waiters */ ++ up(&state->data_quota_event); ++ break; ++ } ++ } ++ ++ while ((service_quota->message_use_count == ++ service_quota->message_quota) || ++ ((tx_end_index != service_quota->previous_tx_index) && ++ (service_quota->slot_use_count == ++ service_quota->slot_quota))) { ++ spin_unlock(&quota_spinlock); ++ vchiq_log_trace(vchiq_core_log_level, ++ "%d: qm:%d %s,%x - quota stall " ++ "(msg %d, slot %d)", ++ state->id, service->localport, ++ msg_type_str(type), size, ++ service_quota->message_use_count, ++ service_quota->slot_use_count); ++ VCHIQ_SERVICE_STATS_INC(service, quota_stalls); ++ mutex_unlock(&state->slot_mutex); ++ if (down_interruptible(&service_quota->quota_event) ++ != 0) ++ return VCHIQ_RETRY; ++ if (service->closing) ++ return VCHIQ_ERROR; ++ if (mutex_lock_interruptible(&state->slot_mutex) != 0) ++ return VCHIQ_RETRY; ++ if (service->srvstate != VCHIQ_SRVSTATE_OPEN) { ++ /* The service has been closed */ ++ mutex_unlock(&state->slot_mutex); ++ return VCHIQ_ERROR; ++ } ++ spin_lock(&quota_spinlock); ++ tx_end_index = SLOT_QUEUE_INDEX_FROM_POS( ++ state->local_tx_pos + stride - 1); ++ } ++ ++ spin_unlock(&quota_spinlock); ++ } ++ ++ header = reserve_space(state, stride, flags & QMFLAGS_IS_BLOCKING); ++ ++ if (!header) { ++ if (service) ++ VCHIQ_SERVICE_STATS_INC(service, slot_stalls); ++ /* In the event of a failure, return the mutex to the ++ state it was in */ ++ if (!(flags & QMFLAGS_NO_MUTEX_LOCK)) ++ mutex_unlock(&state->slot_mutex); ++ return VCHIQ_RETRY; ++ } ++ ++ if (type == VCHIQ_MSG_DATA) { ++ int i, pos; ++ int tx_end_index; ++ int slot_use_count; ++ ++ vchiq_log_info(vchiq_core_log_level, ++ "%d: qm %s@%x,%x (%d->%d)", ++ state->id, ++ msg_type_str(VCHIQ_MSG_TYPE(msgid)), ++ (unsigned int)header, size, ++ VCHIQ_MSG_SRCPORT(msgid), ++ VCHIQ_MSG_DSTPORT(msgid)); ++ ++ BUG_ON(!service); ++ BUG_ON((flags & (QMFLAGS_NO_MUTEX_LOCK | ++ QMFLAGS_NO_MUTEX_UNLOCK)) != 0); ++ ++ for (i = 0, pos = 0; i < (unsigned int)count; ++ pos += elements[i++].size) ++ if (elements[i].size) { ++ if (vchiq_copy_from_user ++ (header->data + pos, elements[i].data, ++ (size_t) elements[i].size) != ++ VCHIQ_SUCCESS) { ++ mutex_unlock(&state->slot_mutex); ++ VCHIQ_SERVICE_STATS_INC(service, ++ error_count); ++ return VCHIQ_ERROR; ++ } ++ } ++ ++ if (SRVTRACE_ENABLED(service, ++ VCHIQ_LOG_INFO)) ++ vchiq_log_dump_mem("Sent", 0, ++ header->data, ++ min(16, pos)); ++ ++ spin_lock(&quota_spinlock); ++ service_quota->message_use_count++; ++ ++ tx_end_index = ++ SLOT_QUEUE_INDEX_FROM_POS(state->local_tx_pos - 1); ++ ++ /* If this transmission can't fit in the last slot used by any ++ ** service, the data_use_count must be increased. */ ++ if (tx_end_index != state->previous_data_index) { ++ state->previous_data_index = tx_end_index; ++ state->data_use_count++; ++ } ++ ++ /* If this isn't the same slot last used by this service, ++ ** the service's slot_use_count must be increased. */ ++ if (tx_end_index != service_quota->previous_tx_index) { ++ service_quota->previous_tx_index = tx_end_index; ++ slot_use_count = ++service_quota->slot_use_count; ++ } else { ++ slot_use_count = 0; ++ } ++ ++ spin_unlock(&quota_spinlock); ++ ++ if (slot_use_count) ++ vchiq_log_trace(vchiq_core_log_level, ++ "%d: qm:%d %s,%x - slot_use->%d (hdr %p)", ++ state->id, service->localport, ++ msg_type_str(VCHIQ_MSG_TYPE(msgid)), size, ++ slot_use_count, header); ++ ++ VCHIQ_SERVICE_STATS_INC(service, ctrl_tx_count); ++ VCHIQ_SERVICE_STATS_ADD(service, ctrl_tx_bytes, size); ++ } else { ++ vchiq_log_info(vchiq_core_log_level, ++ "%d: qm %s@%x,%x (%d->%d)", state->id, ++ msg_type_str(VCHIQ_MSG_TYPE(msgid)), ++ (unsigned int)header, size, ++ VCHIQ_MSG_SRCPORT(msgid), ++ VCHIQ_MSG_DSTPORT(msgid)); ++ if (size != 0) { ++ WARN_ON(!((count == 1) && (size == elements[0].size))); ++ memcpy(header->data, elements[0].data, ++ elements[0].size); ++ } ++ VCHIQ_STATS_INC(state, ctrl_tx_count); ++ } ++ ++ header->msgid = msgid; ++ header->size = size; ++ ++ { ++ int svc_fourcc; ++ ++ svc_fourcc = service ++ ? service->base.fourcc ++ : VCHIQ_MAKE_FOURCC('?', '?', '?', '?'); ++ ++ vchiq_log_info(SRVTRACE_LEVEL(service), ++ "Sent Msg %s(%u) to %c%c%c%c s:%u d:%d len:%d", ++ msg_type_str(VCHIQ_MSG_TYPE(msgid)), ++ VCHIQ_MSG_TYPE(msgid), ++ VCHIQ_FOURCC_AS_4CHARS(svc_fourcc), ++ VCHIQ_MSG_SRCPORT(msgid), ++ VCHIQ_MSG_DSTPORT(msgid), ++ size); ++ } ++ ++ /* Make sure the new header is visible to the peer. */ ++ wmb(); ++ ++ /* Make the new tx_pos visible to the peer. */ ++ local->tx_pos = state->local_tx_pos; ++ wmb(); ++ ++ if (service && (type == VCHIQ_MSG_CLOSE)) ++ vchiq_set_service_state(service, VCHIQ_SRVSTATE_CLOSESENT); ++ ++ if (!(flags & QMFLAGS_NO_MUTEX_UNLOCK)) ++ mutex_unlock(&state->slot_mutex); ++ ++ remote_event_signal(&state->remote->trigger); ++ ++ return VCHIQ_SUCCESS; ++} ++ ++/* Called by the slot handler and application threads */ ++static VCHIQ_STATUS_T ++queue_message_sync(VCHIQ_STATE_T *state, VCHIQ_SERVICE_T *service, ++ int msgid, const VCHIQ_ELEMENT_T *elements, ++ int count, int size, int is_blocking) ++{ ++ VCHIQ_SHARED_STATE_T *local; ++ VCHIQ_HEADER_T *header; ++ ++ local = state->local; ++ ++ if ((VCHIQ_MSG_TYPE(msgid) != VCHIQ_MSG_RESUME) && ++ (mutex_lock_interruptible(&state->sync_mutex) != 0)) ++ return VCHIQ_RETRY; ++ ++ remote_event_wait(&local->sync_release); ++ ++ rmb(); ++ ++ header = (VCHIQ_HEADER_T *)SLOT_DATA_FROM_INDEX(state, ++ local->slot_sync); ++ ++ { ++ int oldmsgid = header->msgid; ++ if (oldmsgid != VCHIQ_MSGID_PADDING) ++ vchiq_log_error(vchiq_core_log_level, ++ "%d: qms - msgid %x, not PADDING", ++ state->id, oldmsgid); ++ } ++ ++ if (service) { ++ int i, pos; ++ ++ vchiq_log_info(vchiq_sync_log_level, ++ "%d: qms %s@%x,%x (%d->%d)", state->id, ++ msg_type_str(VCHIQ_MSG_TYPE(msgid)), ++ (unsigned int)header, size, ++ VCHIQ_MSG_SRCPORT(msgid), ++ VCHIQ_MSG_DSTPORT(msgid)); ++ ++ for (i = 0, pos = 0; i < (unsigned int)count; ++ pos += elements[i++].size) ++ if (elements[i].size) { ++ if (vchiq_copy_from_user ++ (header->data + pos, elements[i].data, ++ (size_t) elements[i].size) != ++ VCHIQ_SUCCESS) { ++ mutex_unlock(&state->sync_mutex); ++ VCHIQ_SERVICE_STATS_INC(service, ++ error_count); ++ return VCHIQ_ERROR; ++ } ++ } ++ ++ if (vchiq_sync_log_level >= VCHIQ_LOG_TRACE) ++ vchiq_log_dump_mem("Sent Sync", ++ 0, header->data, ++ min(16, pos)); ++ ++ VCHIQ_SERVICE_STATS_INC(service, ctrl_tx_count); ++ VCHIQ_SERVICE_STATS_ADD(service, ctrl_tx_bytes, size); ++ } else { ++ vchiq_log_info(vchiq_sync_log_level, ++ "%d: qms %s@%x,%x (%d->%d)", state->id, ++ msg_type_str(VCHIQ_MSG_TYPE(msgid)), ++ (unsigned int)header, size, ++ VCHIQ_MSG_SRCPORT(msgid), ++ VCHIQ_MSG_DSTPORT(msgid)); ++ if (size != 0) { ++ WARN_ON(!((count == 1) && (size == elements[0].size))); ++ memcpy(header->data, elements[0].data, ++ elements[0].size); ++ } ++ VCHIQ_STATS_INC(state, ctrl_tx_count); ++ } ++ ++ header->size = size; ++ header->msgid = msgid; ++ ++ if (vchiq_sync_log_level >= VCHIQ_LOG_TRACE) { ++ int svc_fourcc; ++ ++ svc_fourcc = service ++ ? service->base.fourcc ++ : VCHIQ_MAKE_FOURCC('?', '?', '?', '?'); ++ ++ vchiq_log_trace(vchiq_sync_log_level, ++ "Sent Sync Msg %s(%u) to %c%c%c%c s:%u d:%d len:%d", ++ msg_type_str(VCHIQ_MSG_TYPE(msgid)), ++ VCHIQ_MSG_TYPE(msgid), ++ VCHIQ_FOURCC_AS_4CHARS(svc_fourcc), ++ VCHIQ_MSG_SRCPORT(msgid), ++ VCHIQ_MSG_DSTPORT(msgid), ++ size); ++ } ++ ++ /* Make sure the new header is visible to the peer. */ ++ wmb(); ++ ++ remote_event_signal(&state->remote->sync_trigger); ++ ++ if (VCHIQ_MSG_TYPE(msgid) != VCHIQ_MSG_PAUSE) ++ mutex_unlock(&state->sync_mutex); ++ ++ return VCHIQ_SUCCESS; ++} ++ ++static inline void ++claim_slot(VCHIQ_SLOT_INFO_T *slot) ++{ ++ slot->use_count++; ++} ++ ++static void ++release_slot(VCHIQ_STATE_T *state, VCHIQ_SLOT_INFO_T *slot_info, ++ VCHIQ_HEADER_T *header, VCHIQ_SERVICE_T *service) ++{ ++ int release_count; ++ ++ mutex_lock(&state->recycle_mutex); ++ ++ if (header) { ++ int msgid = header->msgid; ++ if (((msgid & VCHIQ_MSGID_CLAIMED) == 0) || ++ (service && service->closing)) { ++ mutex_unlock(&state->recycle_mutex); ++ return; ++ } ++ ++ /* Rewrite the message header to prevent a double ++ ** release */ ++ header->msgid = msgid & ~VCHIQ_MSGID_CLAIMED; ++ } ++ ++ release_count = slot_info->release_count; ++ slot_info->release_count = ++release_count; ++ ++ if (release_count == slot_info->use_count) { ++ int slot_queue_recycle; ++ /* Add to the freed queue */ ++ ++ /* A read barrier is necessary here to prevent speculative ++ ** fetches of remote->slot_queue_recycle from overtaking the ++ ** mutex. */ ++ rmb(); ++ ++ slot_queue_recycle = state->remote->slot_queue_recycle; ++ state->remote->slot_queue[slot_queue_recycle & ++ VCHIQ_SLOT_QUEUE_MASK] = ++ SLOT_INDEX_FROM_INFO(state, slot_info); ++ state->remote->slot_queue_recycle = slot_queue_recycle + 1; ++ vchiq_log_info(vchiq_core_log_level, ++ "%d: release_slot %d - recycle->%x", ++ state->id, SLOT_INDEX_FROM_INFO(state, slot_info), ++ state->remote->slot_queue_recycle); ++ ++ /* A write barrier is necessary, but remote_event_signal ++ ** contains one. */ ++ remote_event_signal(&state->remote->recycle); ++ } ++ ++ mutex_unlock(&state->recycle_mutex); ++} ++ ++/* Called by the slot handler - don't hold the bulk mutex */ ++static VCHIQ_STATUS_T ++notify_bulks(VCHIQ_SERVICE_T *service, VCHIQ_BULK_QUEUE_T *queue, ++ int retry_poll) ++{ ++ VCHIQ_STATUS_T status = VCHIQ_SUCCESS; ++ ++ vchiq_log_trace(vchiq_core_log_level, ++ "%d: nb:%d %cx - p=%x rn=%x r=%x", ++ service->state->id, service->localport, ++ (queue == &service->bulk_tx) ? 't' : 'r', ++ queue->process, queue->remote_notify, queue->remove); ++ ++ if (service->state->is_master) { ++ while (queue->remote_notify != queue->process) { ++ VCHIQ_BULK_T *bulk = ++ &queue->bulks[BULK_INDEX(queue->remote_notify)]; ++ int msgtype = (bulk->dir == VCHIQ_BULK_TRANSMIT) ? ++ VCHIQ_MSG_BULK_RX_DONE : VCHIQ_MSG_BULK_TX_DONE; ++ int msgid = VCHIQ_MAKE_MSG(msgtype, service->localport, ++ service->remoteport); ++ VCHIQ_ELEMENT_T element = { &bulk->actual, 4 }; ++ /* Only reply to non-dummy bulk requests */ ++ if (bulk->remote_data) { ++ status = queue_message(service->state, NULL, ++ msgid, &element, 1, 4, 0); ++ if (status != VCHIQ_SUCCESS) ++ break; ++ } ++ queue->remote_notify++; ++ } ++ } else { ++ queue->remote_notify = queue->process; ++ } ++ ++ if (status == VCHIQ_SUCCESS) { ++ while (queue->remove != queue->remote_notify) { ++ VCHIQ_BULK_T *bulk = ++ &queue->bulks[BULK_INDEX(queue->remove)]; ++ ++ /* Only generate callbacks for non-dummy bulk ++ ** requests, and non-terminated services */ ++ if (bulk->data && service->instance) { ++ if (bulk->actual != VCHIQ_BULK_ACTUAL_ABORTED) { ++ if (bulk->dir == VCHIQ_BULK_TRANSMIT) { ++ VCHIQ_SERVICE_STATS_INC(service, ++ bulk_tx_count); ++ VCHIQ_SERVICE_STATS_ADD(service, ++ bulk_tx_bytes, ++ bulk->actual); ++ } else { ++ VCHIQ_SERVICE_STATS_INC(service, ++ bulk_rx_count); ++ VCHIQ_SERVICE_STATS_ADD(service, ++ bulk_rx_bytes, ++ bulk->actual); ++ } ++ } else { ++ VCHIQ_SERVICE_STATS_INC(service, ++ bulk_aborted_count); ++ } ++ if (bulk->mode == VCHIQ_BULK_MODE_BLOCKING) { ++ struct bulk_waiter *waiter; ++ spin_lock(&bulk_waiter_spinlock); ++ waiter = bulk->userdata; ++ if (waiter) { ++ waiter->actual = bulk->actual; ++ up(&waiter->event); ++ } ++ spin_unlock(&bulk_waiter_spinlock); ++ } else if (bulk->mode == ++ VCHIQ_BULK_MODE_CALLBACK) { ++ VCHIQ_REASON_T reason = (bulk->dir == ++ VCHIQ_BULK_TRANSMIT) ? ++ ((bulk->actual == ++ VCHIQ_BULK_ACTUAL_ABORTED) ? ++ VCHIQ_BULK_TRANSMIT_ABORTED : ++ VCHIQ_BULK_TRANSMIT_DONE) : ++ ((bulk->actual == ++ VCHIQ_BULK_ACTUAL_ABORTED) ? ++ VCHIQ_BULK_RECEIVE_ABORTED : ++ VCHIQ_BULK_RECEIVE_DONE); ++ status = make_service_callback(service, ++ reason, NULL, bulk->userdata); ++ if (status == VCHIQ_RETRY) ++ break; ++ } ++ } ++ ++ queue->remove++; ++ up(&service->bulk_remove_event); ++ } ++ if (!retry_poll) ++ status = VCHIQ_SUCCESS; ++ } ++ ++ if (status == VCHIQ_RETRY) ++ request_poll(service->state, service, ++ (queue == &service->bulk_tx) ? ++ VCHIQ_POLL_TXNOTIFY : VCHIQ_POLL_RXNOTIFY); ++ ++ return status; ++} ++ ++/* Called by the slot handler thread */ ++static void ++poll_services(VCHIQ_STATE_T *state) ++{ ++ int group, i; ++ ++ for (group = 0; group < BITSET_SIZE(state->unused_service); group++) { ++ uint32_t flags; ++ flags = atomic_xchg(&state->poll_services[group], 0); ++ for (i = 0; flags; i++) { ++ if (flags & (1 << i)) { ++ VCHIQ_SERVICE_T *service = ++ find_service_by_port(state, ++ (group<<5) + i); ++ uint32_t service_flags; ++ flags &= ~(1 << i); ++ if (!service) ++ continue; ++ service_flags = ++ atomic_xchg(&service->poll_flags, 0); ++ if (service_flags & ++ (1 << VCHIQ_POLL_REMOVE)) { ++ vchiq_log_info(vchiq_core_log_level, ++ "%d: ps - remove %d<->%d", ++ state->id, service->localport, ++ service->remoteport); ++ ++ /* Make it look like a client, because ++ it must be removed and not left in ++ the LISTENING state. */ ++ service->public_fourcc = ++ VCHIQ_FOURCC_INVALID; ++ ++ if (vchiq_close_service_internal( ++ service, 0/*!close_recvd*/) != ++ VCHIQ_SUCCESS) ++ request_poll(state, service, ++ VCHIQ_POLL_REMOVE); ++ } else if (service_flags & ++ (1 << VCHIQ_POLL_TERMINATE)) { ++ vchiq_log_info(vchiq_core_log_level, ++ "%d: ps - terminate %d<->%d", ++ state->id, service->localport, ++ service->remoteport); ++ if (vchiq_close_service_internal( ++ service, 0/*!close_recvd*/) != ++ VCHIQ_SUCCESS) ++ request_poll(state, service, ++ VCHIQ_POLL_TERMINATE); ++ } ++ if (service_flags & (1 << VCHIQ_POLL_TXNOTIFY)) ++ notify_bulks(service, ++ &service->bulk_tx, ++ 1/*retry_poll*/); ++ if (service_flags & (1 << VCHIQ_POLL_RXNOTIFY)) ++ notify_bulks(service, ++ &service->bulk_rx, ++ 1/*retry_poll*/); ++ unlock_service(service); ++ } ++ } ++ } ++} ++ ++/* Called by the slot handler or application threads, holding the bulk mutex. */ ++static int ++resolve_bulks(VCHIQ_SERVICE_T *service, VCHIQ_BULK_QUEUE_T *queue) ++{ ++ VCHIQ_STATE_T *state = service->state; ++ int resolved = 0; ++ int rc; ++ ++ while ((queue->process != queue->local_insert) && ++ (queue->process != queue->remote_insert)) { ++ VCHIQ_BULK_T *bulk = &queue->bulks[BULK_INDEX(queue->process)]; ++ ++ vchiq_log_trace(vchiq_core_log_level, ++ "%d: rb:%d %cx - li=%x ri=%x p=%x", ++ state->id, service->localport, ++ (queue == &service->bulk_tx) ? 't' : 'r', ++ queue->local_insert, queue->remote_insert, ++ queue->process); ++ ++ WARN_ON(!((int)(queue->local_insert - queue->process) > 0)); ++ WARN_ON(!((int)(queue->remote_insert - queue->process) > 0)); ++ ++ rc = mutex_lock_interruptible(&state->bulk_transfer_mutex); ++ if (rc != 0) ++ break; ++ ++ vchiq_transfer_bulk(bulk); ++ mutex_unlock(&state->bulk_transfer_mutex); ++ ++ if (SRVTRACE_ENABLED(service, VCHIQ_LOG_INFO)) { ++ const char *header = (queue == &service->bulk_tx) ? ++ "Send Bulk to" : "Recv Bulk from"; ++ if (bulk->actual != VCHIQ_BULK_ACTUAL_ABORTED) ++ vchiq_log_info(SRVTRACE_LEVEL(service), ++ "%s %c%c%c%c d:%d len:%d %x<->%x", ++ header, ++ VCHIQ_FOURCC_AS_4CHARS( ++ service->base.fourcc), ++ service->remoteport, ++ bulk->size, ++ (unsigned int)bulk->data, ++ (unsigned int)bulk->remote_data); ++ else ++ vchiq_log_info(SRVTRACE_LEVEL(service), ++ "%s %c%c%c%c d:%d ABORTED - tx len:%d," ++ " rx len:%d %x<->%x", ++ header, ++ VCHIQ_FOURCC_AS_4CHARS( ++ service->base.fourcc), ++ service->remoteport, ++ bulk->size, ++ bulk->remote_size, ++ (unsigned int)bulk->data, ++ (unsigned int)bulk->remote_data); ++ } ++ ++ vchiq_complete_bulk(bulk); ++ queue->process++; ++ resolved++; ++ } ++ return resolved; ++} ++ ++/* Called with the bulk_mutex held */ ++static void ++abort_outstanding_bulks(VCHIQ_SERVICE_T *service, VCHIQ_BULK_QUEUE_T *queue) ++{ ++ int is_tx = (queue == &service->bulk_tx); ++ vchiq_log_trace(vchiq_core_log_level, ++ "%d: aob:%d %cx - li=%x ri=%x p=%x", ++ service->state->id, service->localport, is_tx ? 't' : 'r', ++ queue->local_insert, queue->remote_insert, queue->process); ++ ++ WARN_ON(!((int)(queue->local_insert - queue->process) >= 0)); ++ WARN_ON(!((int)(queue->remote_insert - queue->process) >= 0)); ++ ++ while ((queue->process != queue->local_insert) || ++ (queue->process != queue->remote_insert)) { ++ VCHIQ_BULK_T *bulk = &queue->bulks[BULK_INDEX(queue->process)]; ++ ++ if (queue->process == queue->remote_insert) { ++ /* fabricate a matching dummy bulk */ ++ bulk->remote_data = NULL; ++ bulk->remote_size = 0; ++ queue->remote_insert++; ++ } ++ ++ if (queue->process != queue->local_insert) { ++ vchiq_complete_bulk(bulk); ++ ++ vchiq_log_info(SRVTRACE_LEVEL(service), ++ "%s %c%c%c%c d:%d ABORTED - tx len:%d, " ++ "rx len:%d", ++ is_tx ? "Send Bulk to" : "Recv Bulk from", ++ VCHIQ_FOURCC_AS_4CHARS(service->base.fourcc), ++ service->remoteport, ++ bulk->size, ++ bulk->remote_size); ++ } else { ++ /* fabricate a matching dummy bulk */ ++ bulk->data = NULL; ++ bulk->size = 0; ++ bulk->actual = VCHIQ_BULK_ACTUAL_ABORTED; ++ bulk->dir = is_tx ? VCHIQ_BULK_TRANSMIT : ++ VCHIQ_BULK_RECEIVE; ++ queue->local_insert++; ++ } ++ ++ queue->process++; ++ } ++} ++ ++/* Called from the slot handler thread */ ++static void ++pause_bulks(VCHIQ_STATE_T *state) ++{ ++ if (unlikely(atomic_inc_return(&pause_bulks_count) != 1)) { ++ WARN_ON_ONCE(1); ++ atomic_set(&pause_bulks_count, 1); ++ return; ++ } ++ ++ /* Block bulk transfers from all services */ ++ mutex_lock(&state->bulk_transfer_mutex); ++} ++ ++/* Called from the slot handler thread */ ++static void ++resume_bulks(VCHIQ_STATE_T *state) ++{ ++ int i; ++ if (unlikely(atomic_dec_return(&pause_bulks_count) != 0)) { ++ WARN_ON_ONCE(1); ++ atomic_set(&pause_bulks_count, 0); ++ return; ++ } ++ ++ /* Allow bulk transfers from all services */ ++ mutex_unlock(&state->bulk_transfer_mutex); ++ ++ if (state->deferred_bulks == 0) ++ return; ++ ++ /* Deal with any bulks which had to be deferred due to being in ++ * paused state. Don't try to match up to number of deferred bulks ++ * in case we've had something come and close the service in the ++ * interim - just process all bulk queues for all services */ ++ vchiq_log_info(vchiq_core_log_level, "%s: processing %d deferred bulks", ++ __func__, state->deferred_bulks); ++ ++ for (i = 0; i < state->unused_service; i++) { ++ VCHIQ_SERVICE_T *service = state->services[i]; ++ int resolved_rx = 0; ++ int resolved_tx = 0; ++ if (!service || (service->srvstate != VCHIQ_SRVSTATE_OPEN)) ++ continue; ++ ++ mutex_lock(&service->bulk_mutex); ++ resolved_rx = resolve_bulks(service, &service->bulk_rx); ++ resolved_tx = resolve_bulks(service, &service->bulk_tx); ++ mutex_unlock(&service->bulk_mutex); ++ if (resolved_rx) ++ notify_bulks(service, &service->bulk_rx, 1); ++ if (resolved_tx) ++ notify_bulks(service, &service->bulk_tx, 1); ++ } ++ state->deferred_bulks = 0; ++} ++ ++static int ++parse_open(VCHIQ_STATE_T *state, VCHIQ_HEADER_T *header) ++{ ++ VCHIQ_SERVICE_T *service = NULL; ++ int msgid, size; ++ int type; ++ unsigned int localport, remoteport; ++ ++ msgid = header->msgid; ++ size = header->size; ++ type = VCHIQ_MSG_TYPE(msgid); ++ localport = VCHIQ_MSG_DSTPORT(msgid); ++ remoteport = VCHIQ_MSG_SRCPORT(msgid); ++ if (size >= sizeof(struct vchiq_open_payload)) { ++ const struct vchiq_open_payload *payload = ++ (struct vchiq_open_payload *)header->data; ++ unsigned int fourcc; ++ ++ fourcc = payload->fourcc; ++ vchiq_log_info(vchiq_core_log_level, ++ "%d: prs OPEN@%x (%d->'%c%c%c%c')", ++ state->id, (unsigned int)header, ++ localport, ++ VCHIQ_FOURCC_AS_4CHARS(fourcc)); ++ ++ service = get_listening_service(state, fourcc); ++ ++ if (service) { ++ /* A matching service exists */ ++ short version = payload->version; ++ short version_min = payload->version_min; ++ if ((service->version < version_min) || ++ (version < service->version_min)) { ++ /* Version mismatch */ ++ vchiq_loud_error_header(); ++ vchiq_loud_error("%d: service %d (%c%c%c%c) " ++ "version mismatch - local (%d, min %d)" ++ " vs. remote (%d, min %d)", ++ state->id, service->localport, ++ VCHIQ_FOURCC_AS_4CHARS(fourcc), ++ service->version, service->version_min, ++ version, version_min); ++ vchiq_loud_error_footer(); ++ unlock_service(service); ++ service = NULL; ++ goto fail_open; ++ } ++ service->peer_version = version; ++ ++ if (service->srvstate == VCHIQ_SRVSTATE_LISTENING) { ++ struct vchiq_openack_payload ack_payload = { ++ service->version ++ }; ++ VCHIQ_ELEMENT_T body = { ++ &ack_payload, ++ sizeof(ack_payload) ++ }; ++ ++ if (state->version_common < ++ VCHIQ_VERSION_SYNCHRONOUS_MODE) ++ service->sync = 0; ++ ++ /* Acknowledge the OPEN */ ++ if (service->sync && ++ (state->version_common >= ++ VCHIQ_VERSION_SYNCHRONOUS_MODE)) { ++ if (queue_message_sync(state, NULL, ++ VCHIQ_MAKE_MSG( ++ VCHIQ_MSG_OPENACK, ++ service->localport, ++ remoteport), ++ &body, 1, sizeof(ack_payload), ++ 0) == VCHIQ_RETRY) ++ goto bail_not_ready; ++ } else { ++ if (queue_message(state, NULL, ++ VCHIQ_MAKE_MSG( ++ VCHIQ_MSG_OPENACK, ++ service->localport, ++ remoteport), ++ &body, 1, sizeof(ack_payload), ++ 0) == VCHIQ_RETRY) ++ goto bail_not_ready; ++ } ++ ++ /* The service is now open */ ++ vchiq_set_service_state(service, ++ service->sync ? VCHIQ_SRVSTATE_OPENSYNC ++ : VCHIQ_SRVSTATE_OPEN); ++ } ++ ++ service->remoteport = remoteport; ++ service->client_id = ((int *)header->data)[1]; ++ if (make_service_callback(service, VCHIQ_SERVICE_OPENED, ++ NULL, NULL) == VCHIQ_RETRY) { ++ /* Bail out if not ready */ ++ service->remoteport = VCHIQ_PORT_FREE; ++ goto bail_not_ready; ++ } ++ ++ /* Success - the message has been dealt with */ ++ unlock_service(service); ++ return 1; ++ } ++ } ++ ++fail_open: ++ /* No available service, or an invalid request - send a CLOSE */ ++ if (queue_message(state, NULL, ++ VCHIQ_MAKE_MSG(VCHIQ_MSG_CLOSE, 0, VCHIQ_MSG_SRCPORT(msgid)), ++ NULL, 0, 0, 0) == VCHIQ_RETRY) ++ goto bail_not_ready; ++ ++ return 1; ++ ++bail_not_ready: ++ if (service) ++ unlock_service(service); ++ ++ return 0; ++} ++ ++/* Called by the slot handler thread */ ++static void ++parse_rx_slots(VCHIQ_STATE_T *state) ++{ ++ VCHIQ_SHARED_STATE_T *remote = state->remote; ++ VCHIQ_SERVICE_T *service = NULL; ++ int tx_pos; ++ DEBUG_INITIALISE(state->local) ++ ++ tx_pos = remote->tx_pos; ++ ++ while (state->rx_pos != tx_pos) { ++ VCHIQ_HEADER_T *header; ++ int msgid, size; ++ int type; ++ unsigned int localport, remoteport; ++ ++ DEBUG_TRACE(PARSE_LINE); ++ if (!state->rx_data) { ++ int rx_index; ++ WARN_ON(!((state->rx_pos & VCHIQ_SLOT_MASK) == 0)); ++ rx_index = remote->slot_queue[ ++ SLOT_QUEUE_INDEX_FROM_POS(state->rx_pos) & ++ VCHIQ_SLOT_QUEUE_MASK]; ++ state->rx_data = (char *)SLOT_DATA_FROM_INDEX(state, ++ rx_index); ++ state->rx_info = SLOT_INFO_FROM_INDEX(state, rx_index); ++ ++ /* Initialise use_count to one, and increment ++ ** release_count at the end of the slot to avoid ++ ** releasing the slot prematurely. */ ++ state->rx_info->use_count = 1; ++ state->rx_info->release_count = 0; ++ } ++ ++ header = (VCHIQ_HEADER_T *)(state->rx_data + ++ (state->rx_pos & VCHIQ_SLOT_MASK)); ++ DEBUG_VALUE(PARSE_HEADER, (int)header); ++ msgid = header->msgid; ++ DEBUG_VALUE(PARSE_MSGID, msgid); ++ size = header->size; ++ type = VCHIQ_MSG_TYPE(msgid); ++ localport = VCHIQ_MSG_DSTPORT(msgid); ++ remoteport = VCHIQ_MSG_SRCPORT(msgid); ++ ++ if (type != VCHIQ_MSG_DATA) ++ VCHIQ_STATS_INC(state, ctrl_rx_count); ++ ++ switch (type) { ++ case VCHIQ_MSG_OPENACK: ++ case VCHIQ_MSG_CLOSE: ++ case VCHIQ_MSG_DATA: ++ case VCHIQ_MSG_BULK_RX: ++ case VCHIQ_MSG_BULK_TX: ++ case VCHIQ_MSG_BULK_RX_DONE: ++ case VCHIQ_MSG_BULK_TX_DONE: ++ service = find_service_by_port(state, localport); ++ if ((!service || ++ ((service->remoteport != remoteport) && ++ (service->remoteport != VCHIQ_PORT_FREE))) && ++ (localport == 0) && ++ (type == VCHIQ_MSG_CLOSE)) { ++ /* This could be a CLOSE from a client which ++ hadn't yet received the OPENACK - look for ++ the connected service */ ++ if (service) ++ unlock_service(service); ++ service = get_connected_service(state, ++ remoteport); ++ if (service) ++ vchiq_log_warning(vchiq_core_log_level, ++ "%d: prs %s@%x (%d->%d) - " ++ "found connected service %d", ++ state->id, msg_type_str(type), ++ (unsigned int)header, ++ remoteport, localport, ++ service->localport); ++ } ++ ++ if (!service) { ++ vchiq_log_error(vchiq_core_log_level, ++ "%d: prs %s@%x (%d->%d) - " ++ "invalid/closed service %d", ++ state->id, msg_type_str(type), ++ (unsigned int)header, ++ remoteport, localport, localport); ++ goto skip_message; ++ } ++ break; ++ default: ++ break; ++ } ++ ++ if (SRVTRACE_ENABLED(service, VCHIQ_LOG_INFO)) { ++ int svc_fourcc; ++ ++ svc_fourcc = service ++ ? service->base.fourcc ++ : VCHIQ_MAKE_FOURCC('?', '?', '?', '?'); ++ vchiq_log_info(SRVTRACE_LEVEL(service), ++ "Rcvd Msg %s(%u) from %c%c%c%c s:%d d:%d " ++ "len:%d", ++ msg_type_str(type), type, ++ VCHIQ_FOURCC_AS_4CHARS(svc_fourcc), ++ remoteport, localport, size); ++ if (size > 0) ++ vchiq_log_dump_mem("Rcvd", 0, header->data, ++ min(16, size)); ++ } ++ ++ if (((unsigned int)header & VCHIQ_SLOT_MASK) + calc_stride(size) ++ > VCHIQ_SLOT_SIZE) { ++ vchiq_log_error(vchiq_core_log_level, ++ "header %x (msgid %x) - size %x too big for " ++ "slot", ++ (unsigned int)header, (unsigned int)msgid, ++ (unsigned int)size); ++ WARN(1, "oversized for slot\n"); ++ } ++ ++ switch (type) { ++ case VCHIQ_MSG_OPEN: ++ WARN_ON(!(VCHIQ_MSG_DSTPORT(msgid) == 0)); ++ if (!parse_open(state, header)) ++ goto bail_not_ready; ++ break; ++ case VCHIQ_MSG_OPENACK: ++ if (size >= sizeof(struct vchiq_openack_payload)) { ++ const struct vchiq_openack_payload *payload = ++ (struct vchiq_openack_payload *) ++ header->data; ++ service->peer_version = payload->version; ++ } ++ vchiq_log_info(vchiq_core_log_level, ++ "%d: prs OPENACK@%x,%x (%d->%d) v:%d", ++ state->id, (unsigned int)header, size, ++ remoteport, localport, service->peer_version); ++ if (service->srvstate == ++ VCHIQ_SRVSTATE_OPENING) { ++ service->remoteport = remoteport; ++ vchiq_set_service_state(service, ++ VCHIQ_SRVSTATE_OPEN); ++ up(&service->remove_event); ++ } else ++ vchiq_log_error(vchiq_core_log_level, ++ "OPENACK received in state %s", ++ srvstate_names[service->srvstate]); ++ break; ++ case VCHIQ_MSG_CLOSE: ++ WARN_ON(size != 0); /* There should be no data */ ++ ++ vchiq_log_info(vchiq_core_log_level, ++ "%d: prs CLOSE@%x (%d->%d)", ++ state->id, (unsigned int)header, ++ remoteport, localport); ++ ++ mark_service_closing_internal(service, 1); ++ ++ if (vchiq_close_service_internal(service, ++ 1/*close_recvd*/) == VCHIQ_RETRY) ++ goto bail_not_ready; ++ ++ vchiq_log_info(vchiq_core_log_level, ++ "Close Service %c%c%c%c s:%u d:%d", ++ VCHIQ_FOURCC_AS_4CHARS(service->base.fourcc), ++ service->localport, ++ service->remoteport); ++ break; ++ case VCHIQ_MSG_DATA: ++ vchiq_log_info(vchiq_core_log_level, ++ "%d: prs DATA@%x,%x (%d->%d)", ++ state->id, (unsigned int)header, size, ++ remoteport, localport); ++ ++ if ((service->remoteport == remoteport) ++ && (service->srvstate == ++ VCHIQ_SRVSTATE_OPEN)) { ++ header->msgid = msgid | VCHIQ_MSGID_CLAIMED; ++ claim_slot(state->rx_info); ++ DEBUG_TRACE(PARSE_LINE); ++ if (make_service_callback(service, ++ VCHIQ_MESSAGE_AVAILABLE, header, ++ NULL) == VCHIQ_RETRY) { ++ DEBUG_TRACE(PARSE_LINE); ++ goto bail_not_ready; ++ } ++ VCHIQ_SERVICE_STATS_INC(service, ctrl_rx_count); ++ VCHIQ_SERVICE_STATS_ADD(service, ctrl_rx_bytes, ++ size); ++ } else { ++ VCHIQ_STATS_INC(state, error_count); ++ } ++ break; ++ case VCHIQ_MSG_CONNECT: ++ vchiq_log_info(vchiq_core_log_level, ++ "%d: prs CONNECT@%x", ++ state->id, (unsigned int)header); ++ state->version_common = ((VCHIQ_SLOT_ZERO_T *) ++ state->slot_data)->version; ++ up(&state->connect); ++ break; ++ case VCHIQ_MSG_BULK_RX: ++ case VCHIQ_MSG_BULK_TX: { ++ VCHIQ_BULK_QUEUE_T *queue; ++ WARN_ON(!state->is_master); ++ queue = (type == VCHIQ_MSG_BULK_RX) ? ++ &service->bulk_tx : &service->bulk_rx; ++ if ((service->remoteport == remoteport) ++ && (service->srvstate == ++ VCHIQ_SRVSTATE_OPEN)) { ++ VCHIQ_BULK_T *bulk; ++ int resolved = 0; ++ ++ DEBUG_TRACE(PARSE_LINE); ++ if (mutex_lock_interruptible( ++ &service->bulk_mutex) != 0) { ++ DEBUG_TRACE(PARSE_LINE); ++ goto bail_not_ready; ++ } ++ ++ WARN_ON(!(queue->remote_insert < queue->remove + ++ VCHIQ_NUM_SERVICE_BULKS)); ++ bulk = &queue->bulks[ ++ BULK_INDEX(queue->remote_insert)]; ++ bulk->remote_data = ++ (void *)((int *)header->data)[0]; ++ bulk->remote_size = ((int *)header->data)[1]; ++ wmb(); ++ ++ vchiq_log_info(vchiq_core_log_level, ++ "%d: prs %s@%x (%d->%d) %x@%x", ++ state->id, msg_type_str(type), ++ (unsigned int)header, ++ remoteport, localport, ++ bulk->remote_size, ++ (unsigned int)bulk->remote_data); ++ ++ queue->remote_insert++; ++ ++ if (atomic_read(&pause_bulks_count)) { ++ state->deferred_bulks++; ++ vchiq_log_info(vchiq_core_log_level, ++ "%s: deferring bulk (%d)", ++ __func__, ++ state->deferred_bulks); ++ if (state->conn_state != ++ VCHIQ_CONNSTATE_PAUSE_SENT) ++ vchiq_log_error( ++ vchiq_core_log_level, ++ "%s: bulks paused in " ++ "unexpected state %s", ++ __func__, ++ conn_state_names[ ++ state->conn_state]); ++ } else if (state->conn_state == ++ VCHIQ_CONNSTATE_CONNECTED) { ++ DEBUG_TRACE(PARSE_LINE); ++ resolved = resolve_bulks(service, ++ queue); ++ } ++ ++ mutex_unlock(&service->bulk_mutex); ++ if (resolved) ++ notify_bulks(service, queue, ++ 1/*retry_poll*/); ++ } ++ } break; ++ case VCHIQ_MSG_BULK_RX_DONE: ++ case VCHIQ_MSG_BULK_TX_DONE: ++ WARN_ON(state->is_master); ++ if ((service->remoteport == remoteport) ++ && (service->srvstate != ++ VCHIQ_SRVSTATE_FREE)) { ++ VCHIQ_BULK_QUEUE_T *queue; ++ VCHIQ_BULK_T *bulk; ++ ++ queue = (type == VCHIQ_MSG_BULK_RX_DONE) ? ++ &service->bulk_rx : &service->bulk_tx; ++ ++ DEBUG_TRACE(PARSE_LINE); ++ if (mutex_lock_interruptible( ++ &service->bulk_mutex) != 0) { ++ DEBUG_TRACE(PARSE_LINE); ++ goto bail_not_ready; ++ } ++ if ((int)(queue->remote_insert - ++ queue->local_insert) >= 0) { ++ vchiq_log_error(vchiq_core_log_level, ++ "%d: prs %s@%x (%d->%d) " ++ "unexpected (ri=%d,li=%d)", ++ state->id, msg_type_str(type), ++ (unsigned int)header, ++ remoteport, localport, ++ queue->remote_insert, ++ queue->local_insert); ++ mutex_unlock(&service->bulk_mutex); ++ break; ++ } ++ ++ BUG_ON(queue->process == queue->local_insert); ++ BUG_ON(queue->process != queue->remote_insert); ++ ++ bulk = &queue->bulks[ ++ BULK_INDEX(queue->remote_insert)]; ++ bulk->actual = *(int *)header->data; ++ queue->remote_insert++; ++ ++ vchiq_log_info(vchiq_core_log_level, ++ "%d: prs %s@%x (%d->%d) %x@%x", ++ state->id, msg_type_str(type), ++ (unsigned int)header, ++ remoteport, localport, ++ bulk->actual, (unsigned int)bulk->data); ++ ++ vchiq_log_trace(vchiq_core_log_level, ++ "%d: prs:%d %cx li=%x ri=%x p=%x", ++ state->id, localport, ++ (type == VCHIQ_MSG_BULK_RX_DONE) ? ++ 'r' : 't', ++ queue->local_insert, ++ queue->remote_insert, queue->process); ++ ++ DEBUG_TRACE(PARSE_LINE); ++ WARN_ON(queue->process == queue->local_insert); ++ vchiq_complete_bulk(bulk); ++ queue->process++; ++ mutex_unlock(&service->bulk_mutex); ++ DEBUG_TRACE(PARSE_LINE); ++ notify_bulks(service, queue, 1/*retry_poll*/); ++ DEBUG_TRACE(PARSE_LINE); ++ } ++ break; ++ case VCHIQ_MSG_PADDING: ++ vchiq_log_trace(vchiq_core_log_level, ++ "%d: prs PADDING@%x,%x", ++ state->id, (unsigned int)header, size); ++ break; ++ case VCHIQ_MSG_PAUSE: ++ /* If initiated, signal the application thread */ ++ vchiq_log_trace(vchiq_core_log_level, ++ "%d: prs PAUSE@%x,%x", ++ state->id, (unsigned int)header, size); ++ if (state->conn_state == VCHIQ_CONNSTATE_PAUSED) { ++ vchiq_log_error(vchiq_core_log_level, ++ "%d: PAUSE received in state PAUSED", ++ state->id); ++ break; ++ } ++ if (state->conn_state != VCHIQ_CONNSTATE_PAUSE_SENT) { ++ /* Send a PAUSE in response */ ++ if (queue_message(state, NULL, ++ VCHIQ_MAKE_MSG(VCHIQ_MSG_PAUSE, 0, 0), ++ NULL, 0, 0, QMFLAGS_NO_MUTEX_UNLOCK) ++ == VCHIQ_RETRY) ++ goto bail_not_ready; ++ if (state->is_master) ++ pause_bulks(state); ++ } ++ /* At this point slot_mutex is held */ ++ vchiq_set_conn_state(state, VCHIQ_CONNSTATE_PAUSED); ++ vchiq_platform_paused(state); ++ break; ++ case VCHIQ_MSG_RESUME: ++ vchiq_log_trace(vchiq_core_log_level, ++ "%d: prs RESUME@%x,%x", ++ state->id, (unsigned int)header, size); ++ /* Release the slot mutex */ ++ mutex_unlock(&state->slot_mutex); ++ if (state->is_master) ++ resume_bulks(state); ++ vchiq_set_conn_state(state, VCHIQ_CONNSTATE_CONNECTED); ++ vchiq_platform_resumed(state); ++ break; ++ ++ case VCHIQ_MSG_REMOTE_USE: ++ vchiq_on_remote_use(state); ++ break; ++ case VCHIQ_MSG_REMOTE_RELEASE: ++ vchiq_on_remote_release(state); ++ break; ++ case VCHIQ_MSG_REMOTE_USE_ACTIVE: ++ vchiq_on_remote_use_active(state); ++ break; ++ ++ default: ++ vchiq_log_error(vchiq_core_log_level, ++ "%d: prs invalid msgid %x@%x,%x", ++ state->id, msgid, (unsigned int)header, size); ++ WARN(1, "invalid message\n"); ++ break; ++ } ++ ++skip_message: ++ if (service) { ++ unlock_service(service); ++ service = NULL; ++ } ++ ++ state->rx_pos += calc_stride(size); ++ ++ DEBUG_TRACE(PARSE_LINE); ++ /* Perform some housekeeping when the end of the slot is ++ ** reached. */ ++ if ((state->rx_pos & VCHIQ_SLOT_MASK) == 0) { ++ /* Remove the extra reference count. */ ++ release_slot(state, state->rx_info, NULL, NULL); ++ state->rx_data = NULL; ++ } ++ } ++ ++bail_not_ready: ++ if (service) ++ unlock_service(service); ++} ++ ++/* Called by the slot handler thread */ ++static int ++slot_handler_func(void *v) ++{ ++ VCHIQ_STATE_T *state = (VCHIQ_STATE_T *) v; ++ VCHIQ_SHARED_STATE_T *local = state->local; ++ DEBUG_INITIALISE(local) ++ ++ while (1) { ++ DEBUG_COUNT(SLOT_HANDLER_COUNT); ++ DEBUG_TRACE(SLOT_HANDLER_LINE); ++ remote_event_wait(&local->trigger); ++ ++ rmb(); ++ ++ DEBUG_TRACE(SLOT_HANDLER_LINE); ++ if (state->poll_needed) { ++ /* Check if we need to suspend - may change our ++ * conn_state */ ++ vchiq_platform_check_suspend(state); ++ ++ state->poll_needed = 0; ++ ++ /* Handle service polling and other rare conditions here ++ ** out of the mainline code */ ++ switch (state->conn_state) { ++ case VCHIQ_CONNSTATE_CONNECTED: ++ /* Poll the services as requested */ ++ poll_services(state); ++ break; ++ ++ case VCHIQ_CONNSTATE_PAUSING: ++ if (state->is_master) ++ pause_bulks(state); ++ if (queue_message(state, NULL, ++ VCHIQ_MAKE_MSG(VCHIQ_MSG_PAUSE, 0, 0), ++ NULL, 0, 0, ++ QMFLAGS_NO_MUTEX_UNLOCK) ++ != VCHIQ_RETRY) { ++ vchiq_set_conn_state(state, ++ VCHIQ_CONNSTATE_PAUSE_SENT); ++ } else { ++ if (state->is_master) ++ resume_bulks(state); ++ /* Retry later */ ++ state->poll_needed = 1; ++ } ++ break; ++ ++ case VCHIQ_CONNSTATE_PAUSED: ++ vchiq_platform_resume(state); ++ break; ++ ++ case VCHIQ_CONNSTATE_RESUMING: ++ if (queue_message(state, NULL, ++ VCHIQ_MAKE_MSG(VCHIQ_MSG_RESUME, 0, 0), ++ NULL, 0, 0, QMFLAGS_NO_MUTEX_LOCK) ++ != VCHIQ_RETRY) { ++ if (state->is_master) ++ resume_bulks(state); ++ vchiq_set_conn_state(state, ++ VCHIQ_CONNSTATE_CONNECTED); ++ vchiq_platform_resumed(state); ++ } else { ++ /* This should really be impossible, ++ ** since the PAUSE should have flushed ++ ** through outstanding messages. */ ++ vchiq_log_error(vchiq_core_log_level, ++ "Failed to send RESUME " ++ "message"); ++ BUG(); ++ } ++ break; ++ ++ case VCHIQ_CONNSTATE_PAUSE_TIMEOUT: ++ case VCHIQ_CONNSTATE_RESUME_TIMEOUT: ++ vchiq_platform_handle_timeout(state); ++ break; ++ default: ++ break; ++ } ++ ++ ++ } ++ ++ DEBUG_TRACE(SLOT_HANDLER_LINE); ++ parse_rx_slots(state); ++ } ++ return 0; ++} ++ ++ ++/* Called by the recycle thread */ ++static int ++recycle_func(void *v) ++{ ++ VCHIQ_STATE_T *state = (VCHIQ_STATE_T *) v; ++ VCHIQ_SHARED_STATE_T *local = state->local; ++ ++ while (1) { ++ remote_event_wait(&local->recycle); ++ ++ process_free_queue(state); ++ } ++ return 0; ++} ++ ++ ++/* Called by the sync thread */ ++static int ++sync_func(void *v) ++{ ++ VCHIQ_STATE_T *state = (VCHIQ_STATE_T *) v; ++ VCHIQ_SHARED_STATE_T *local = state->local; ++ VCHIQ_HEADER_T *header = (VCHIQ_HEADER_T *)SLOT_DATA_FROM_INDEX(state, ++ state->remote->slot_sync); ++ ++ while (1) { ++ VCHIQ_SERVICE_T *service; ++ int msgid, size; ++ int type; ++ unsigned int localport, remoteport; ++ ++ remote_event_wait(&local->sync_trigger); ++ ++ rmb(); ++ ++ msgid = header->msgid; ++ size = header->size; ++ type = VCHIQ_MSG_TYPE(msgid); ++ localport = VCHIQ_MSG_DSTPORT(msgid); ++ remoteport = VCHIQ_MSG_SRCPORT(msgid); ++ ++ service = find_service_by_port(state, localport); ++ ++ if (!service) { ++ vchiq_log_error(vchiq_sync_log_level, ++ "%d: sf %s@%x (%d->%d) - " ++ "invalid/closed service %d", ++ state->id, msg_type_str(type), ++ (unsigned int)header, ++ remoteport, localport, localport); ++ release_message_sync(state, header); ++ continue; ++ } ++ ++ if (vchiq_sync_log_level >= VCHIQ_LOG_TRACE) { ++ int svc_fourcc; ++ ++ svc_fourcc = service ++ ? service->base.fourcc ++ : VCHIQ_MAKE_FOURCC('?', '?', '?', '?'); ++ vchiq_log_trace(vchiq_sync_log_level, ++ "Rcvd Msg %s from %c%c%c%c s:%d d:%d len:%d", ++ msg_type_str(type), ++ VCHIQ_FOURCC_AS_4CHARS(svc_fourcc), ++ remoteport, localport, size); ++ if (size > 0) ++ vchiq_log_dump_mem("Rcvd", 0, header->data, ++ min(16, size)); ++ } ++ ++ switch (type) { ++ case VCHIQ_MSG_OPENACK: ++ if (size >= sizeof(struct vchiq_openack_payload)) { ++ const struct vchiq_openack_payload *payload = ++ (struct vchiq_openack_payload *) ++ header->data; ++ service->peer_version = payload->version; ++ } ++ vchiq_log_info(vchiq_sync_log_level, ++ "%d: sf OPENACK@%x,%x (%d->%d) v:%d", ++ state->id, (unsigned int)header, size, ++ remoteport, localport, service->peer_version); ++ if (service->srvstate == VCHIQ_SRVSTATE_OPENING) { ++ service->remoteport = remoteport; ++ vchiq_set_service_state(service, ++ VCHIQ_SRVSTATE_OPENSYNC); ++ service->sync = 1; ++ up(&service->remove_event); ++ } ++ release_message_sync(state, header); ++ break; ++ ++ case VCHIQ_MSG_DATA: ++ vchiq_log_trace(vchiq_sync_log_level, ++ "%d: sf DATA@%x,%x (%d->%d)", ++ state->id, (unsigned int)header, size, ++ remoteport, localport); ++ ++ if ((service->remoteport == remoteport) && ++ (service->srvstate == ++ VCHIQ_SRVSTATE_OPENSYNC)) { ++ if (make_service_callback(service, ++ VCHIQ_MESSAGE_AVAILABLE, header, ++ NULL) == VCHIQ_RETRY) ++ vchiq_log_error(vchiq_sync_log_level, ++ "synchronous callback to " ++ "service %d returns " ++ "VCHIQ_RETRY", ++ localport); ++ } ++ break; ++ ++ default: ++ vchiq_log_error(vchiq_sync_log_level, ++ "%d: sf unexpected msgid %x@%x,%x", ++ state->id, msgid, (unsigned int)header, size); ++ release_message_sync(state, header); ++ break; ++ } ++ ++ unlock_service(service); ++ } ++ ++ return 0; ++} ++ ++ ++static void ++init_bulk_queue(VCHIQ_BULK_QUEUE_T *queue) ++{ ++ queue->local_insert = 0; ++ queue->remote_insert = 0; ++ queue->process = 0; ++ queue->remote_notify = 0; ++ queue->remove = 0; ++} ++ ++ ++inline const char * ++get_conn_state_name(VCHIQ_CONNSTATE_T conn_state) ++{ ++ return conn_state_names[conn_state]; ++} ++ ++ ++VCHIQ_SLOT_ZERO_T * ++vchiq_init_slots(void *mem_base, int mem_size) ++{ ++ int mem_align = (VCHIQ_SLOT_SIZE - (int)mem_base) & VCHIQ_SLOT_MASK; ++ VCHIQ_SLOT_ZERO_T *slot_zero = ++ (VCHIQ_SLOT_ZERO_T *)((char *)mem_base + mem_align); ++ int num_slots = (mem_size - mem_align)/VCHIQ_SLOT_SIZE; ++ int first_data_slot = VCHIQ_SLOT_ZERO_SLOTS; ++ ++ /* Ensure there is enough memory to run an absolutely minimum system */ ++ num_slots -= first_data_slot; ++ ++ if (num_slots < 4) { ++ vchiq_log_error(vchiq_core_log_level, ++ "vchiq_init_slots - insufficient memory %x bytes", ++ mem_size); ++ return NULL; ++ } ++ ++ memset(slot_zero, 0, sizeof(VCHIQ_SLOT_ZERO_T)); ++ ++ slot_zero->magic = VCHIQ_MAGIC; ++ slot_zero->version = VCHIQ_VERSION; ++ slot_zero->version_min = VCHIQ_VERSION_MIN; ++ slot_zero->slot_zero_size = sizeof(VCHIQ_SLOT_ZERO_T); ++ slot_zero->slot_size = VCHIQ_SLOT_SIZE; ++ slot_zero->max_slots = VCHIQ_MAX_SLOTS; ++ slot_zero->max_slots_per_side = VCHIQ_MAX_SLOTS_PER_SIDE; ++ ++ slot_zero->master.slot_sync = first_data_slot; ++ slot_zero->master.slot_first = first_data_slot + 1; ++ slot_zero->master.slot_last = first_data_slot + (num_slots/2) - 1; ++ slot_zero->slave.slot_sync = first_data_slot + (num_slots/2); ++ slot_zero->slave.slot_first = first_data_slot + (num_slots/2) + 1; ++ slot_zero->slave.slot_last = first_data_slot + num_slots - 1; ++ ++ return slot_zero; ++} ++ ++VCHIQ_STATUS_T ++vchiq_init_state(VCHIQ_STATE_T *state, VCHIQ_SLOT_ZERO_T *slot_zero, ++ int is_master) ++{ ++ VCHIQ_SHARED_STATE_T *local; ++ VCHIQ_SHARED_STATE_T *remote; ++ VCHIQ_STATUS_T status; ++ char threadname[10]; ++ static int id; ++ int i; ++ ++ vchiq_log_warning(vchiq_core_log_level, ++ "%s: slot_zero = 0x%08lx, is_master = %d", ++ __func__, (unsigned long)slot_zero, is_master); ++ ++ /* Check the input configuration */ ++ ++ if (slot_zero->magic != VCHIQ_MAGIC) { ++ vchiq_loud_error_header(); ++ vchiq_loud_error("Invalid VCHIQ magic value found."); ++ vchiq_loud_error("slot_zero=%x: magic=%x (expected %x)", ++ (unsigned int)slot_zero, slot_zero->magic, VCHIQ_MAGIC); ++ vchiq_loud_error_footer(); ++ return VCHIQ_ERROR; ++ } ++ ++ if (slot_zero->version < VCHIQ_VERSION_MIN) { ++ vchiq_loud_error_header(); ++ vchiq_loud_error("Incompatible VCHIQ versions found."); ++ vchiq_loud_error("slot_zero=%x: VideoCore version=%d " ++ "(minimum %d)", ++ (unsigned int)slot_zero, slot_zero->version, ++ VCHIQ_VERSION_MIN); ++ vchiq_loud_error("Restart with a newer VideoCore image."); ++ vchiq_loud_error_footer(); ++ return VCHIQ_ERROR; ++ } ++ ++ if (VCHIQ_VERSION < slot_zero->version_min) { ++ vchiq_loud_error_header(); ++ vchiq_loud_error("Incompatible VCHIQ versions found."); ++ vchiq_loud_error("slot_zero=%x: version=%d (VideoCore " ++ "minimum %d)", ++ (unsigned int)slot_zero, VCHIQ_VERSION, ++ slot_zero->version_min); ++ vchiq_loud_error("Restart with a newer kernel."); ++ vchiq_loud_error_footer(); ++ return VCHIQ_ERROR; ++ } ++ ++ if ((slot_zero->slot_zero_size != sizeof(VCHIQ_SLOT_ZERO_T)) || ++ (slot_zero->slot_size != VCHIQ_SLOT_SIZE) || ++ (slot_zero->max_slots != VCHIQ_MAX_SLOTS) || ++ (slot_zero->max_slots_per_side != VCHIQ_MAX_SLOTS_PER_SIDE)) { ++ vchiq_loud_error_header(); ++ if (slot_zero->slot_zero_size != sizeof(VCHIQ_SLOT_ZERO_T)) ++ vchiq_loud_error("slot_zero=%x: slot_zero_size=%x " ++ "(expected %x)", ++ (unsigned int)slot_zero, ++ slot_zero->slot_zero_size, ++ sizeof(VCHIQ_SLOT_ZERO_T)); ++ if (slot_zero->slot_size != VCHIQ_SLOT_SIZE) ++ vchiq_loud_error("slot_zero=%x: slot_size=%d " ++ "(expected %d", ++ (unsigned int)slot_zero, slot_zero->slot_size, ++ VCHIQ_SLOT_SIZE); ++ if (slot_zero->max_slots != VCHIQ_MAX_SLOTS) ++ vchiq_loud_error("slot_zero=%x: max_slots=%d " ++ "(expected %d)", ++ (unsigned int)slot_zero, slot_zero->max_slots, ++ VCHIQ_MAX_SLOTS); ++ if (slot_zero->max_slots_per_side != VCHIQ_MAX_SLOTS_PER_SIDE) ++ vchiq_loud_error("slot_zero=%x: max_slots_per_side=%d " ++ "(expected %d)", ++ (unsigned int)slot_zero, ++ slot_zero->max_slots_per_side, ++ VCHIQ_MAX_SLOTS_PER_SIDE); ++ vchiq_loud_error_footer(); ++ return VCHIQ_ERROR; ++ } ++ ++ if (VCHIQ_VERSION < slot_zero->version) ++ slot_zero->version = VCHIQ_VERSION; ++ ++ if (is_master) { ++ local = &slot_zero->master; ++ remote = &slot_zero->slave; ++ } else { ++ local = &slot_zero->slave; ++ remote = &slot_zero->master; ++ } ++ ++ if (local->initialised) { ++ vchiq_loud_error_header(); ++ if (remote->initialised) ++ vchiq_loud_error("local state has already been " ++ "initialised"); ++ else ++ vchiq_loud_error("master/slave mismatch - two %ss", ++ is_master ? "master" : "slave"); ++ vchiq_loud_error_footer(); ++ return VCHIQ_ERROR; ++ } ++ ++ memset(state, 0, sizeof(VCHIQ_STATE_T)); ++ ++ state->id = id++; ++ state->is_master = is_master; ++ ++ /* ++ initialize shared state pointers ++ */ ++ ++ state->local = local; ++ state->remote = remote; ++ state->slot_data = (VCHIQ_SLOT_T *)slot_zero; ++ ++ /* ++ initialize events and mutexes ++ */ ++ ++ sema_init(&state->connect, 0); ++ mutex_init(&state->mutex); ++ sema_init(&state->trigger_event, 0); ++ sema_init(&state->recycle_event, 0); ++ sema_init(&state->sync_trigger_event, 0); ++ sema_init(&state->sync_release_event, 0); ++ ++ mutex_init(&state->slot_mutex); ++ mutex_init(&state->recycle_mutex); ++ mutex_init(&state->sync_mutex); ++ mutex_init(&state->bulk_transfer_mutex); ++ ++ sema_init(&state->slot_available_event, 0); ++ sema_init(&state->slot_remove_event, 0); ++ sema_init(&state->data_quota_event, 0); ++ ++ state->slot_queue_available = 0; ++ ++ for (i = 0; i < VCHIQ_MAX_SERVICES; i++) { ++ VCHIQ_SERVICE_QUOTA_T *service_quota = ++ &state->service_quotas[i]; ++ sema_init(&service_quota->quota_event, 0); ++ } ++ ++ for (i = local->slot_first; i <= local->slot_last; i++) { ++ local->slot_queue[state->slot_queue_available++] = i; ++ up(&state->slot_available_event); ++ } ++ ++ state->default_slot_quota = state->slot_queue_available/2; ++ state->default_message_quota = ++ min((unsigned short)(state->default_slot_quota * 256), ++ (unsigned short)~0); ++ ++ state->previous_data_index = -1; ++ state->data_use_count = 0; ++ state->data_quota = state->slot_queue_available - 1; ++ ++ local->trigger.event = &state->trigger_event; ++ remote_event_create(&local->trigger); ++ local->tx_pos = 0; ++ ++ local->recycle.event = &state->recycle_event; ++ remote_event_create(&local->recycle); ++ local->slot_queue_recycle = state->slot_queue_available; ++ ++ local->sync_trigger.event = &state->sync_trigger_event; ++ remote_event_create(&local->sync_trigger); ++ ++ local->sync_release.event = &state->sync_release_event; ++ remote_event_create(&local->sync_release); ++ ++ /* At start-of-day, the slot is empty and available */ ++ ((VCHIQ_HEADER_T *)SLOT_DATA_FROM_INDEX(state, local->slot_sync))->msgid ++ = VCHIQ_MSGID_PADDING; ++ remote_event_signal_local(&local->sync_release); ++ ++ local->debug[DEBUG_ENTRIES] = DEBUG_MAX; ++ ++ status = vchiq_platform_init_state(state); ++ ++ /* ++ bring up slot handler thread ++ */ ++ snprintf(threadname, sizeof(threadname), "VCHIQ-%d", state->id); ++ state->slot_handler_thread = kthread_create(&slot_handler_func, ++ (void *)state, ++ threadname); ++ ++ if (state->slot_handler_thread == NULL) { ++ vchiq_loud_error_header(); ++ vchiq_loud_error("couldn't create thread %s", threadname); ++ vchiq_loud_error_footer(); ++ return VCHIQ_ERROR; ++ } ++ set_user_nice(state->slot_handler_thread, -19); ++ wake_up_process(state->slot_handler_thread); ++ ++ snprintf(threadname, sizeof(threadname), "VCHIQr-%d", state->id); ++ state->recycle_thread = kthread_create(&recycle_func, ++ (void *)state, ++ threadname); ++ if (state->recycle_thread == NULL) { ++ vchiq_loud_error_header(); ++ vchiq_loud_error("couldn't create thread %s", threadname); ++ vchiq_loud_error_footer(); ++ return VCHIQ_ERROR; ++ } ++ set_user_nice(state->recycle_thread, -19); ++ wake_up_process(state->recycle_thread); ++ ++ snprintf(threadname, sizeof(threadname), "VCHIQs-%d", state->id); ++ state->sync_thread = kthread_create(&sync_func, ++ (void *)state, ++ threadname); ++ if (state->sync_thread == NULL) { ++ vchiq_loud_error_header(); ++ vchiq_loud_error("couldn't create thread %s", threadname); ++ vchiq_loud_error_footer(); ++ return VCHIQ_ERROR; ++ } ++ set_user_nice(state->sync_thread, -20); ++ wake_up_process(state->sync_thread); ++ ++ BUG_ON(state->id >= VCHIQ_MAX_STATES); ++ vchiq_states[state->id] = state; ++ ++ /* Indicate readiness to the other side */ ++ local->initialised = 1; ++ ++ return status; ++} ++ ++/* Called from application thread when a client or server service is created. */ ++VCHIQ_SERVICE_T * ++vchiq_add_service_internal(VCHIQ_STATE_T *state, ++ const VCHIQ_SERVICE_PARAMS_T *params, int srvstate, ++ VCHIQ_INSTANCE_T instance, VCHIQ_USERDATA_TERM_T userdata_term) ++{ ++ VCHIQ_SERVICE_T *service; ++ ++ service = kmalloc(sizeof(VCHIQ_SERVICE_T), GFP_KERNEL); ++ if (service) { ++ service->base.fourcc = params->fourcc; ++ service->base.callback = params->callback; ++ service->base.userdata = params->userdata; ++ service->handle = VCHIQ_SERVICE_HANDLE_INVALID; ++ service->ref_count = 1; ++ service->srvstate = VCHIQ_SRVSTATE_FREE; ++ service->userdata_term = userdata_term; ++ service->localport = VCHIQ_PORT_FREE; ++ service->remoteport = VCHIQ_PORT_FREE; ++ ++ service->public_fourcc = (srvstate == VCHIQ_SRVSTATE_OPENING) ? ++ VCHIQ_FOURCC_INVALID : params->fourcc; ++ service->client_id = 0; ++ service->auto_close = 1; ++ service->sync = 0; ++ service->closing = 0; ++ service->trace = 0; ++ atomic_set(&service->poll_flags, 0); ++ service->version = params->version; ++ service->version_min = params->version_min; ++ service->state = state; ++ service->instance = instance; ++ service->service_use_count = 0; ++ init_bulk_queue(&service->bulk_tx); ++ init_bulk_queue(&service->bulk_rx); ++ sema_init(&service->remove_event, 0); ++ sema_init(&service->bulk_remove_event, 0); ++ mutex_init(&service->bulk_mutex); ++ memset(&service->stats, 0, sizeof(service->stats)); ++ } else { ++ vchiq_log_error(vchiq_core_log_level, ++ "Out of memory"); ++ } ++ ++ if (service) { ++ VCHIQ_SERVICE_T **pservice = NULL; ++ int i; ++ ++ /* Although it is perfectly possible to use service_spinlock ++ ** to protect the creation of services, it is overkill as it ++ ** disables interrupts while the array is searched. ++ ** The only danger is of another thread trying to create a ++ ** service - service deletion is safe. ++ ** Therefore it is preferable to use state->mutex which, ++ ** although slower to claim, doesn't block interrupts while ++ ** it is held. ++ */ ++ ++ mutex_lock(&state->mutex); ++ ++ /* Prepare to use a previously unused service */ ++ if (state->unused_service < VCHIQ_MAX_SERVICES) ++ pservice = &state->services[state->unused_service]; ++ ++ if (srvstate == VCHIQ_SRVSTATE_OPENING) { ++ for (i = 0; i < state->unused_service; i++) { ++ VCHIQ_SERVICE_T *srv = state->services[i]; ++ if (!srv) { ++ pservice = &state->services[i]; ++ break; ++ } ++ } ++ } else { ++ for (i = (state->unused_service - 1); i >= 0; i--) { ++ VCHIQ_SERVICE_T *srv = state->services[i]; ++ if (!srv) ++ pservice = &state->services[i]; ++ else if ((srv->public_fourcc == params->fourcc) ++ && ((srv->instance != instance) || ++ (srv->base.callback != ++ params->callback))) { ++ /* There is another server using this ++ ** fourcc which doesn't match. */ ++ pservice = NULL; ++ break; ++ } ++ } ++ } ++ ++ if (pservice) { ++ service->localport = (pservice - state->services); ++ if (!handle_seq) ++ handle_seq = VCHIQ_MAX_STATES * ++ VCHIQ_MAX_SERVICES; ++ service->handle = handle_seq | ++ (state->id * VCHIQ_MAX_SERVICES) | ++ service->localport; ++ handle_seq += VCHIQ_MAX_STATES * VCHIQ_MAX_SERVICES; ++ *pservice = service; ++ if (pservice == &state->services[state->unused_service]) ++ state->unused_service++; ++ } ++ ++ mutex_unlock(&state->mutex); ++ ++ if (!pservice) { ++ kfree(service); ++ service = NULL; ++ } ++ } ++ ++ if (service) { ++ VCHIQ_SERVICE_QUOTA_T *service_quota = ++ &state->service_quotas[service->localport]; ++ service_quota->slot_quota = state->default_slot_quota; ++ service_quota->message_quota = state->default_message_quota; ++ if (service_quota->slot_use_count == 0) ++ service_quota->previous_tx_index = ++ SLOT_QUEUE_INDEX_FROM_POS(state->local_tx_pos) ++ - 1; ++ ++ /* Bring this service online */ ++ vchiq_set_service_state(service, srvstate); ++ ++ vchiq_log_info(vchiq_core_msg_log_level, ++ "%s Service %c%c%c%c SrcPort:%d", ++ (srvstate == VCHIQ_SRVSTATE_OPENING) ++ ? "Open" : "Add", ++ VCHIQ_FOURCC_AS_4CHARS(params->fourcc), ++ service->localport); ++ } ++ ++ /* Don't unlock the service - leave it with a ref_count of 1. */ ++ ++ return service; ++} ++ ++VCHIQ_STATUS_T ++vchiq_open_service_internal(VCHIQ_SERVICE_T *service, int client_id) ++{ ++ struct vchiq_open_payload payload = { ++ service->base.fourcc, ++ client_id, ++ service->version, ++ service->version_min ++ }; ++ VCHIQ_ELEMENT_T body = { &payload, sizeof(payload) }; ++ VCHIQ_STATUS_T status = VCHIQ_SUCCESS; ++ ++ service->client_id = client_id; ++ vchiq_use_service_internal(service); ++ status = queue_message(service->state, NULL, ++ VCHIQ_MAKE_MSG(VCHIQ_MSG_OPEN, service->localport, 0), ++ &body, 1, sizeof(payload), QMFLAGS_IS_BLOCKING); ++ if (status == VCHIQ_SUCCESS) { ++ /* Wait for the ACK/NAK */ ++ if (down_interruptible(&service->remove_event) != 0) { ++ status = VCHIQ_RETRY; ++ vchiq_release_service_internal(service); ++ } else if ((service->srvstate != VCHIQ_SRVSTATE_OPEN) && ++ (service->srvstate != VCHIQ_SRVSTATE_OPENSYNC)) { ++ if (service->srvstate != VCHIQ_SRVSTATE_CLOSEWAIT) ++ vchiq_log_error(vchiq_core_log_level, ++ "%d: osi - srvstate = %s (ref %d)", ++ service->state->id, ++ srvstate_names[service->srvstate], ++ service->ref_count); ++ status = VCHIQ_ERROR; ++ VCHIQ_SERVICE_STATS_INC(service, error_count); ++ vchiq_release_service_internal(service); ++ } ++ } ++ return status; ++} ++ ++static void ++release_service_messages(VCHIQ_SERVICE_T *service) ++{ ++ VCHIQ_STATE_T *state = service->state; ++ int slot_last = state->remote->slot_last; ++ int i; ++ ++ /* Release any claimed messages aimed at this service */ ++ ++ if (service->sync) { ++ VCHIQ_HEADER_T *header = ++ (VCHIQ_HEADER_T *)SLOT_DATA_FROM_INDEX(state, ++ state->remote->slot_sync); ++ if (VCHIQ_MSG_DSTPORT(header->msgid) == service->localport) ++ release_message_sync(state, header); ++ ++ return; ++ } ++ ++ for (i = state->remote->slot_first; i <= slot_last; i++) { ++ VCHIQ_SLOT_INFO_T *slot_info = ++ SLOT_INFO_FROM_INDEX(state, i); ++ if (slot_info->release_count != slot_info->use_count) { ++ char *data = ++ (char *)SLOT_DATA_FROM_INDEX(state, i); ++ unsigned int pos, end; ++ ++ end = VCHIQ_SLOT_SIZE; ++ if (data == state->rx_data) ++ /* This buffer is still being read from - stop ++ ** at the current read position */ ++ end = state->rx_pos & VCHIQ_SLOT_MASK; ++ ++ pos = 0; ++ ++ while (pos < end) { ++ VCHIQ_HEADER_T *header = ++ (VCHIQ_HEADER_T *)(data + pos); ++ int msgid = header->msgid; ++ int port = VCHIQ_MSG_DSTPORT(msgid); ++ if ((port == service->localport) && ++ (msgid & VCHIQ_MSGID_CLAIMED)) { ++ vchiq_log_info(vchiq_core_log_level, ++ " fsi - hdr %x", ++ (unsigned int)header); ++ release_slot(state, slot_info, header, ++ NULL); ++ } ++ pos += calc_stride(header->size); ++ if (pos > VCHIQ_SLOT_SIZE) { ++ vchiq_log_error(vchiq_core_log_level, ++ "fsi - pos %x: header %x, " ++ "msgid %x, header->msgid %x, " ++ "header->size %x", ++ pos, (unsigned int)header, ++ msgid, header->msgid, ++ header->size); ++ WARN(1, "invalid slot position\n"); ++ } ++ } ++ } ++ } ++} ++ ++static int ++do_abort_bulks(VCHIQ_SERVICE_T *service) ++{ ++ VCHIQ_STATUS_T status; ++ ++ /* Abort any outstanding bulk transfers */ ++ if (mutex_lock_interruptible(&service->bulk_mutex) != 0) ++ return 0; ++ abort_outstanding_bulks(service, &service->bulk_tx); ++ abort_outstanding_bulks(service, &service->bulk_rx); ++ mutex_unlock(&service->bulk_mutex); ++ ++ status = notify_bulks(service, &service->bulk_tx, 0/*!retry_poll*/); ++ if (status == VCHIQ_SUCCESS) ++ status = notify_bulks(service, &service->bulk_rx, ++ 0/*!retry_poll*/); ++ return (status == VCHIQ_SUCCESS); ++} ++ ++static VCHIQ_STATUS_T ++close_service_complete(VCHIQ_SERVICE_T *service, int failstate) ++{ ++ VCHIQ_STATUS_T status; ++ int is_server = (service->public_fourcc != VCHIQ_FOURCC_INVALID); ++ int newstate; ++ ++ switch (service->srvstate) { ++ case VCHIQ_SRVSTATE_OPEN: ++ case VCHIQ_SRVSTATE_CLOSESENT: ++ case VCHIQ_SRVSTATE_CLOSERECVD: ++ if (is_server) { ++ if (service->auto_close) { ++ service->client_id = 0; ++ service->remoteport = VCHIQ_PORT_FREE; ++ newstate = VCHIQ_SRVSTATE_LISTENING; ++ } else ++ newstate = VCHIQ_SRVSTATE_CLOSEWAIT; ++ } else ++ newstate = VCHIQ_SRVSTATE_CLOSED; ++ vchiq_set_service_state(service, newstate); ++ break; ++ case VCHIQ_SRVSTATE_LISTENING: ++ break; ++ default: ++ vchiq_log_error(vchiq_core_log_level, ++ "close_service_complete(%x) called in state %s", ++ service->handle, srvstate_names[service->srvstate]); ++ WARN(1, "close_service_complete in unexpected state\n"); ++ return VCHIQ_ERROR; ++ } ++ ++ status = make_service_callback(service, ++ VCHIQ_SERVICE_CLOSED, NULL, NULL); ++ ++ if (status != VCHIQ_RETRY) { ++ int uc = service->service_use_count; ++ int i; ++ /* Complete the close process */ ++ for (i = 0; i < uc; i++) ++ /* cater for cases where close is forced and the ++ ** client may not close all it's handles */ ++ vchiq_release_service_internal(service); ++ ++ service->client_id = 0; ++ service->remoteport = VCHIQ_PORT_FREE; ++ ++ if (service->srvstate == VCHIQ_SRVSTATE_CLOSED) ++ vchiq_free_service_internal(service); ++ else if (service->srvstate != VCHIQ_SRVSTATE_CLOSEWAIT) { ++ if (is_server) ++ service->closing = 0; ++ ++ up(&service->remove_event); ++ } ++ } else ++ vchiq_set_service_state(service, failstate); ++ ++ return status; ++} ++ ++/* Called by the slot handler */ ++VCHIQ_STATUS_T ++vchiq_close_service_internal(VCHIQ_SERVICE_T *service, int close_recvd) ++{ ++ VCHIQ_STATE_T *state = service->state; ++ VCHIQ_STATUS_T status = VCHIQ_SUCCESS; ++ int is_server = (service->public_fourcc != VCHIQ_FOURCC_INVALID); ++ ++ vchiq_log_info(vchiq_core_log_level, "%d: csi:%d,%d (%s)", ++ service->state->id, service->localport, close_recvd, ++ srvstate_names[service->srvstate]); ++ ++ switch (service->srvstate) { ++ case VCHIQ_SRVSTATE_CLOSED: ++ case VCHIQ_SRVSTATE_HIDDEN: ++ case VCHIQ_SRVSTATE_LISTENING: ++ case VCHIQ_SRVSTATE_CLOSEWAIT: ++ if (close_recvd) ++ vchiq_log_error(vchiq_core_log_level, ++ "vchiq_close_service_internal(1) called " ++ "in state %s", ++ srvstate_names[service->srvstate]); ++ else if (is_server) { ++ if (service->srvstate == VCHIQ_SRVSTATE_LISTENING) { ++ status = VCHIQ_ERROR; ++ } else { ++ service->client_id = 0; ++ service->remoteport = VCHIQ_PORT_FREE; ++ if (service->srvstate == ++ VCHIQ_SRVSTATE_CLOSEWAIT) ++ vchiq_set_service_state(service, ++ VCHIQ_SRVSTATE_LISTENING); ++ } ++ up(&service->remove_event); ++ } else ++ vchiq_free_service_internal(service); ++ break; ++ case VCHIQ_SRVSTATE_OPENING: ++ if (close_recvd) { ++ /* The open was rejected - tell the user */ ++ vchiq_set_service_state(service, ++ VCHIQ_SRVSTATE_CLOSEWAIT); ++ up(&service->remove_event); ++ } else { ++ /* Shutdown mid-open - let the other side know */ ++ status = queue_message(state, service, ++ VCHIQ_MAKE_MSG ++ (VCHIQ_MSG_CLOSE, ++ service->localport, ++ VCHIQ_MSG_DSTPORT(service->remoteport)), ++ NULL, 0, 0, 0); ++ } ++ break; ++ ++ case VCHIQ_SRVSTATE_OPENSYNC: ++ mutex_lock(&state->sync_mutex); ++ /* Drop through */ ++ ++ case VCHIQ_SRVSTATE_OPEN: ++ if (state->is_master || close_recvd) { ++ if (!do_abort_bulks(service)) ++ status = VCHIQ_RETRY; ++ } ++ ++ release_service_messages(service); ++ ++ if (status == VCHIQ_SUCCESS) ++ status = queue_message(state, service, ++ VCHIQ_MAKE_MSG ++ (VCHIQ_MSG_CLOSE, ++ service->localport, ++ VCHIQ_MSG_DSTPORT(service->remoteport)), ++ NULL, 0, 0, QMFLAGS_NO_MUTEX_UNLOCK); ++ ++ if (status == VCHIQ_SUCCESS) { ++ if (!close_recvd) { ++ /* Change the state while the mutex is ++ still held */ ++ vchiq_set_service_state(service, ++ VCHIQ_SRVSTATE_CLOSESENT); ++ mutex_unlock(&state->slot_mutex); ++ if (service->sync) ++ mutex_unlock(&state->sync_mutex); ++ break; ++ } ++ } else if (service->srvstate == VCHIQ_SRVSTATE_OPENSYNC) { ++ mutex_unlock(&state->sync_mutex); ++ break; ++ } else ++ break; ++ ++ /* Change the state while the mutex is still held */ ++ vchiq_set_service_state(service, VCHIQ_SRVSTATE_CLOSERECVD); ++ mutex_unlock(&state->slot_mutex); ++ if (service->sync) ++ mutex_unlock(&state->sync_mutex); ++ ++ status = close_service_complete(service, ++ VCHIQ_SRVSTATE_CLOSERECVD); ++ break; ++ ++ case VCHIQ_SRVSTATE_CLOSESENT: ++ if (!close_recvd) ++ /* This happens when a process is killed mid-close */ ++ break; ++ ++ if (!state->is_master) { ++ if (!do_abort_bulks(service)) { ++ status = VCHIQ_RETRY; ++ break; ++ } ++ } ++ ++ if (status == VCHIQ_SUCCESS) ++ status = close_service_complete(service, ++ VCHIQ_SRVSTATE_CLOSERECVD); ++ break; ++ ++ case VCHIQ_SRVSTATE_CLOSERECVD: ++ if (!close_recvd && is_server) ++ /* Force into LISTENING mode */ ++ vchiq_set_service_state(service, ++ VCHIQ_SRVSTATE_LISTENING); ++ status = close_service_complete(service, ++ VCHIQ_SRVSTATE_CLOSERECVD); ++ break; ++ ++ default: ++ vchiq_log_error(vchiq_core_log_level, ++ "vchiq_close_service_internal(%d) called in state %s", ++ close_recvd, srvstate_names[service->srvstate]); ++ break; ++ } ++ ++ return status; ++} ++ ++/* Called from the application process upon process death */ ++void ++vchiq_terminate_service_internal(VCHIQ_SERVICE_T *service) ++{ ++ VCHIQ_STATE_T *state = service->state; ++ ++ vchiq_log_info(vchiq_core_log_level, "%d: tsi - (%d<->%d)", ++ state->id, service->localport, service->remoteport); ++ ++ mark_service_closing(service); ++ ++ /* Mark the service for removal by the slot handler */ ++ request_poll(state, service, VCHIQ_POLL_REMOVE); ++} ++ ++/* Called from the slot handler */ ++void ++vchiq_free_service_internal(VCHIQ_SERVICE_T *service) ++{ ++ VCHIQ_STATE_T *state = service->state; ++ ++ vchiq_log_info(vchiq_core_log_level, "%d: fsi - (%d)", ++ state->id, service->localport); ++ ++ switch (service->srvstate) { ++ case VCHIQ_SRVSTATE_OPENING: ++ case VCHIQ_SRVSTATE_CLOSED: ++ case VCHIQ_SRVSTATE_HIDDEN: ++ case VCHIQ_SRVSTATE_LISTENING: ++ case VCHIQ_SRVSTATE_CLOSEWAIT: ++ break; ++ default: ++ vchiq_log_error(vchiq_core_log_level, ++ "%d: fsi - (%d) in state %s", ++ state->id, service->localport, ++ srvstate_names[service->srvstate]); ++ return; ++ } ++ ++ vchiq_set_service_state(service, VCHIQ_SRVSTATE_FREE); ++ ++ up(&service->remove_event); ++ ++ /* Release the initial lock */ ++ unlock_service(service); ++} ++ ++VCHIQ_STATUS_T ++vchiq_connect_internal(VCHIQ_STATE_T *state, VCHIQ_INSTANCE_T instance) ++{ ++ VCHIQ_SERVICE_T *service; ++ int i; ++ ++ /* Find all services registered to this client and enable them. */ ++ i = 0; ++ while ((service = next_service_by_instance(state, instance, ++ &i)) != NULL) { ++ if (service->srvstate == VCHIQ_SRVSTATE_HIDDEN) ++ vchiq_set_service_state(service, ++ VCHIQ_SRVSTATE_LISTENING); ++ unlock_service(service); ++ } ++ ++ if (state->conn_state == VCHIQ_CONNSTATE_DISCONNECTED) { ++ if (queue_message(state, NULL, ++ VCHIQ_MAKE_MSG(VCHIQ_MSG_CONNECT, 0, 0), NULL, 0, ++ 0, QMFLAGS_IS_BLOCKING) == VCHIQ_RETRY) ++ return VCHIQ_RETRY; ++ ++ vchiq_set_conn_state(state, VCHIQ_CONNSTATE_CONNECTING); ++ } ++ ++ if (state->conn_state == VCHIQ_CONNSTATE_CONNECTING) { ++ if (down_interruptible(&state->connect) != 0) ++ return VCHIQ_RETRY; ++ ++ vchiq_set_conn_state(state, VCHIQ_CONNSTATE_CONNECTED); ++ up(&state->connect); ++ } ++ ++ return VCHIQ_SUCCESS; ++} ++ ++VCHIQ_STATUS_T ++vchiq_shutdown_internal(VCHIQ_STATE_T *state, VCHIQ_INSTANCE_T instance) ++{ ++ VCHIQ_SERVICE_T *service; ++ int i; ++ ++ /* Find all services registered to this client and enable them. */ ++ i = 0; ++ while ((service = next_service_by_instance(state, instance, ++ &i)) != NULL) { ++ (void)vchiq_remove_service(service->handle); ++ unlock_service(service); ++ } ++ ++ return VCHIQ_SUCCESS; ++} ++ ++VCHIQ_STATUS_T ++vchiq_pause_internal(VCHIQ_STATE_T *state) ++{ ++ VCHIQ_STATUS_T status = VCHIQ_SUCCESS; ++ ++ switch (state->conn_state) { ++ case VCHIQ_CONNSTATE_CONNECTED: ++ /* Request a pause */ ++ vchiq_set_conn_state(state, VCHIQ_CONNSTATE_PAUSING); ++ request_poll(state, NULL, 0); ++ break; ++ default: ++ vchiq_log_error(vchiq_core_log_level, ++ "vchiq_pause_internal in state %s\n", ++ conn_state_names[state->conn_state]); ++ status = VCHIQ_ERROR; ++ VCHIQ_STATS_INC(state, error_count); ++ break; ++ } ++ ++ return status; ++} ++ ++VCHIQ_STATUS_T ++vchiq_resume_internal(VCHIQ_STATE_T *state) ++{ ++ VCHIQ_STATUS_T status = VCHIQ_SUCCESS; ++ ++ if (state->conn_state == VCHIQ_CONNSTATE_PAUSED) { ++ vchiq_set_conn_state(state, VCHIQ_CONNSTATE_RESUMING); ++ request_poll(state, NULL, 0); ++ } else { ++ status = VCHIQ_ERROR; ++ VCHIQ_STATS_INC(state, error_count); ++ } ++ ++ return status; ++} ++ ++VCHIQ_STATUS_T ++vchiq_close_service(VCHIQ_SERVICE_HANDLE_T handle) ++{ ++ /* Unregister the service */ ++ VCHIQ_SERVICE_T *service = find_service_by_handle(handle); ++ VCHIQ_STATUS_T status = VCHIQ_SUCCESS; ++ ++ if (!service) ++ return VCHIQ_ERROR; ++ ++ vchiq_log_info(vchiq_core_log_level, ++ "%d: close_service:%d", ++ service->state->id, service->localport); ++ ++ if ((service->srvstate == VCHIQ_SRVSTATE_FREE) || ++ (service->srvstate == VCHIQ_SRVSTATE_LISTENING) || ++ (service->srvstate == VCHIQ_SRVSTATE_HIDDEN)) { ++ unlock_service(service); ++ return VCHIQ_ERROR; ++ } ++ ++ mark_service_closing(service); ++ ++ if (current == service->state->slot_handler_thread) { ++ status = vchiq_close_service_internal(service, ++ 0/*!close_recvd*/); ++ BUG_ON(status == VCHIQ_RETRY); ++ } else { ++ /* Mark the service for termination by the slot handler */ ++ request_poll(service->state, service, VCHIQ_POLL_TERMINATE); ++ } ++ ++ while (1) { ++ if (down_interruptible(&service->remove_event) != 0) { ++ status = VCHIQ_RETRY; ++ break; ++ } ++ ++ if ((service->srvstate == VCHIQ_SRVSTATE_FREE) || ++ (service->srvstate == VCHIQ_SRVSTATE_LISTENING) || ++ (service->srvstate == VCHIQ_SRVSTATE_OPEN)) ++ break; ++ ++ vchiq_log_warning(vchiq_core_log_level, ++ "%d: close_service:%d - waiting in state %s", ++ service->state->id, service->localport, ++ srvstate_names[service->srvstate]); ++ } ++ ++ if ((status == VCHIQ_SUCCESS) && ++ (service->srvstate != VCHIQ_SRVSTATE_FREE) && ++ (service->srvstate != VCHIQ_SRVSTATE_LISTENING)) ++ status = VCHIQ_ERROR; ++ ++ unlock_service(service); ++ ++ return status; ++} ++ ++VCHIQ_STATUS_T ++vchiq_remove_service(VCHIQ_SERVICE_HANDLE_T handle) ++{ ++ /* Unregister the service */ ++ VCHIQ_SERVICE_T *service = find_service_by_handle(handle); ++ VCHIQ_STATUS_T status = VCHIQ_SUCCESS; ++ ++ if (!service) ++ return VCHIQ_ERROR; ++ ++ vchiq_log_info(vchiq_core_log_level, ++ "%d: remove_service:%d", ++ service->state->id, service->localport); ++ ++ if (service->srvstate == VCHIQ_SRVSTATE_FREE) { ++ unlock_service(service); ++ return VCHIQ_ERROR; ++ } ++ ++ mark_service_closing(service); ++ ++ if ((service->srvstate == VCHIQ_SRVSTATE_HIDDEN) || ++ (current == service->state->slot_handler_thread)) { ++ /* Make it look like a client, because it must be removed and ++ not left in the LISTENING state. */ ++ service->public_fourcc = VCHIQ_FOURCC_INVALID; ++ ++ status = vchiq_close_service_internal(service, ++ 0/*!close_recvd*/); ++ BUG_ON(status == VCHIQ_RETRY); ++ } else { ++ /* Mark the service for removal by the slot handler */ ++ request_poll(service->state, service, VCHIQ_POLL_REMOVE); ++ } ++ while (1) { ++ if (down_interruptible(&service->remove_event) != 0) { ++ status = VCHIQ_RETRY; ++ break; ++ } ++ ++ if ((service->srvstate == VCHIQ_SRVSTATE_FREE) || ++ (service->srvstate == VCHIQ_SRVSTATE_OPEN)) ++ break; ++ ++ vchiq_log_warning(vchiq_core_log_level, ++ "%d: remove_service:%d - waiting in state %s", ++ service->state->id, service->localport, ++ srvstate_names[service->srvstate]); ++ } ++ ++ if ((status == VCHIQ_SUCCESS) && ++ (service->srvstate != VCHIQ_SRVSTATE_FREE)) ++ status = VCHIQ_ERROR; ++ ++ unlock_service(service); ++ ++ return status; ++} ++ ++ ++/* This function may be called by kernel threads or user threads. ++ * User threads may receive VCHIQ_RETRY to indicate that a signal has been ++ * received and the call should be retried after being returned to user ++ * context. ++ * When called in blocking mode, the userdata field points to a bulk_waiter ++ * structure. ++ */ ++VCHIQ_STATUS_T ++vchiq_bulk_transfer(VCHIQ_SERVICE_HANDLE_T handle, ++ VCHI_MEM_HANDLE_T memhandle, void *offset, int size, void *userdata, ++ VCHIQ_BULK_MODE_T mode, VCHIQ_BULK_DIR_T dir) ++{ ++ VCHIQ_SERVICE_T *service = find_service_by_handle(handle); ++ VCHIQ_BULK_QUEUE_T *queue; ++ VCHIQ_BULK_T *bulk; ++ VCHIQ_STATE_T *state; ++ struct bulk_waiter *bulk_waiter = NULL; ++ const char dir_char = (dir == VCHIQ_BULK_TRANSMIT) ? 't' : 'r'; ++ const int dir_msgtype = (dir == VCHIQ_BULK_TRANSMIT) ? ++ VCHIQ_MSG_BULK_TX : VCHIQ_MSG_BULK_RX; ++ VCHIQ_STATUS_T status = VCHIQ_ERROR; ++ ++ if (!service || ++ (service->srvstate != VCHIQ_SRVSTATE_OPEN) || ++ ((memhandle == VCHI_MEM_HANDLE_INVALID) && (offset == NULL)) || ++ (vchiq_check_service(service) != VCHIQ_SUCCESS)) ++ goto error_exit; ++ ++ switch (mode) { ++ case VCHIQ_BULK_MODE_NOCALLBACK: ++ case VCHIQ_BULK_MODE_CALLBACK: ++ break; ++ case VCHIQ_BULK_MODE_BLOCKING: ++ bulk_waiter = (struct bulk_waiter *)userdata; ++ sema_init(&bulk_waiter->event, 0); ++ bulk_waiter->actual = 0; ++ bulk_waiter->bulk = NULL; ++ break; ++ case VCHIQ_BULK_MODE_WAITING: ++ bulk_waiter = (struct bulk_waiter *)userdata; ++ bulk = bulk_waiter->bulk; ++ goto waiting; ++ default: ++ goto error_exit; ++ } ++ ++ state = service->state; ++ ++ queue = (dir == VCHIQ_BULK_TRANSMIT) ? ++ &service->bulk_tx : &service->bulk_rx; ++ ++ if (mutex_lock_interruptible(&service->bulk_mutex) != 0) { ++ status = VCHIQ_RETRY; ++ goto error_exit; ++ } ++ ++ if (queue->local_insert == queue->remove + VCHIQ_NUM_SERVICE_BULKS) { ++ VCHIQ_SERVICE_STATS_INC(service, bulk_stalls); ++ do { ++ mutex_unlock(&service->bulk_mutex); ++ if (down_interruptible(&service->bulk_remove_event) ++ != 0) { ++ status = VCHIQ_RETRY; ++ goto error_exit; ++ } ++ if (mutex_lock_interruptible(&service->bulk_mutex) ++ != 0) { ++ status = VCHIQ_RETRY; ++ goto error_exit; ++ } ++ } while (queue->local_insert == queue->remove + ++ VCHIQ_NUM_SERVICE_BULKS); ++ } ++ ++ bulk = &queue->bulks[BULK_INDEX(queue->local_insert)]; ++ ++ bulk->mode = mode; ++ bulk->dir = dir; ++ bulk->userdata = userdata; ++ bulk->size = size; ++ bulk->actual = VCHIQ_BULK_ACTUAL_ABORTED; ++ ++ if (vchiq_prepare_bulk_data(bulk, memhandle, offset, size, dir) != ++ VCHIQ_SUCCESS) ++ goto unlock_error_exit; ++ ++ wmb(); ++ ++ vchiq_log_info(vchiq_core_log_level, ++ "%d: bt (%d->%d) %cx %x@%x %x", ++ state->id, ++ service->localport, service->remoteport, dir_char, ++ size, (unsigned int)bulk->data, (unsigned int)userdata); ++ ++ /* The slot mutex must be held when the service is being closed, so ++ claim it here to ensure that isn't happening */ ++ if (mutex_lock_interruptible(&state->slot_mutex) != 0) { ++ status = VCHIQ_RETRY; ++ goto cancel_bulk_error_exit; ++ } ++ ++ if (service->srvstate != VCHIQ_SRVSTATE_OPEN) ++ goto unlock_both_error_exit; ++ ++ if (state->is_master) { ++ queue->local_insert++; ++ if (resolve_bulks(service, queue)) ++ request_poll(state, service, ++ (dir == VCHIQ_BULK_TRANSMIT) ? ++ VCHIQ_POLL_TXNOTIFY : VCHIQ_POLL_RXNOTIFY); ++ } else { ++ int payload[2] = { (int)bulk->data, bulk->size }; ++ VCHIQ_ELEMENT_T element = { payload, sizeof(payload) }; ++ ++ status = queue_message(state, NULL, ++ VCHIQ_MAKE_MSG(dir_msgtype, ++ service->localport, service->remoteport), ++ &element, 1, sizeof(payload), ++ QMFLAGS_IS_BLOCKING | ++ QMFLAGS_NO_MUTEX_LOCK | ++ QMFLAGS_NO_MUTEX_UNLOCK); ++ if (status != VCHIQ_SUCCESS) { ++ goto unlock_both_error_exit; ++ } ++ queue->local_insert++; ++ } ++ ++ mutex_unlock(&state->slot_mutex); ++ mutex_unlock(&service->bulk_mutex); ++ ++ vchiq_log_trace(vchiq_core_log_level, ++ "%d: bt:%d %cx li=%x ri=%x p=%x", ++ state->id, ++ service->localport, dir_char, ++ queue->local_insert, queue->remote_insert, queue->process); ++ ++waiting: ++ unlock_service(service); ++ ++ status = VCHIQ_SUCCESS; ++ ++ if (bulk_waiter) { ++ bulk_waiter->bulk = bulk; ++ if (down_interruptible(&bulk_waiter->event) != 0) ++ status = VCHIQ_RETRY; ++ else if (bulk_waiter->actual == VCHIQ_BULK_ACTUAL_ABORTED) ++ status = VCHIQ_ERROR; ++ } ++ ++ return status; ++ ++unlock_both_error_exit: ++ mutex_unlock(&state->slot_mutex); ++cancel_bulk_error_exit: ++ vchiq_complete_bulk(bulk); ++unlock_error_exit: ++ mutex_unlock(&service->bulk_mutex); ++ ++error_exit: ++ if (service) ++ unlock_service(service); ++ return status; ++} ++ ++VCHIQ_STATUS_T ++vchiq_queue_message(VCHIQ_SERVICE_HANDLE_T handle, ++ const VCHIQ_ELEMENT_T *elements, unsigned int count) ++{ ++ VCHIQ_SERVICE_T *service = find_service_by_handle(handle); ++ VCHIQ_STATUS_T status = VCHIQ_ERROR; ++ ++ unsigned int size = 0; ++ unsigned int i; ++ ++ if (!service || ++ (vchiq_check_service(service) != VCHIQ_SUCCESS)) ++ goto error_exit; ++ ++ for (i = 0; i < (unsigned int)count; i++) { ++ if (elements[i].size) { ++ if (elements[i].data == NULL) { ++ VCHIQ_SERVICE_STATS_INC(service, error_count); ++ goto error_exit; ++ } ++ size += elements[i].size; ++ } ++ } ++ ++ if (size > VCHIQ_MAX_MSG_SIZE) { ++ VCHIQ_SERVICE_STATS_INC(service, error_count); ++ goto error_exit; ++ } ++ ++ switch (service->srvstate) { ++ case VCHIQ_SRVSTATE_OPEN: ++ status = queue_message(service->state, service, ++ VCHIQ_MAKE_MSG(VCHIQ_MSG_DATA, ++ service->localport, ++ service->remoteport), ++ elements, count, size, 1); ++ break; ++ case VCHIQ_SRVSTATE_OPENSYNC: ++ status = queue_message_sync(service->state, service, ++ VCHIQ_MAKE_MSG(VCHIQ_MSG_DATA, ++ service->localport, ++ service->remoteport), ++ elements, count, size, 1); ++ break; ++ default: ++ status = VCHIQ_ERROR; ++ break; ++ } ++ ++error_exit: ++ if (service) ++ unlock_service(service); ++ ++ return status; ++} ++ ++void ++vchiq_release_message(VCHIQ_SERVICE_HANDLE_T handle, VCHIQ_HEADER_T *header) ++{ ++ VCHIQ_SERVICE_T *service = find_service_by_handle(handle); ++ VCHIQ_SHARED_STATE_T *remote; ++ VCHIQ_STATE_T *state; ++ int slot_index; ++ ++ if (!service) ++ return; ++ ++ state = service->state; ++ remote = state->remote; ++ ++ slot_index = SLOT_INDEX_FROM_DATA(state, (void *)header); ++ ++ if ((slot_index >= remote->slot_first) && ++ (slot_index <= remote->slot_last)) { ++ int msgid = header->msgid; ++ if (msgid & VCHIQ_MSGID_CLAIMED) { ++ VCHIQ_SLOT_INFO_T *slot_info = ++ SLOT_INFO_FROM_INDEX(state, slot_index); ++ ++ release_slot(state, slot_info, header, service); ++ } ++ } else if (slot_index == remote->slot_sync) ++ release_message_sync(state, header); ++ ++ unlock_service(service); ++} ++ ++static void ++release_message_sync(VCHIQ_STATE_T *state, VCHIQ_HEADER_T *header) ++{ ++ header->msgid = VCHIQ_MSGID_PADDING; ++ wmb(); ++ remote_event_signal(&state->remote->sync_release); ++} ++ ++VCHIQ_STATUS_T ++vchiq_get_peer_version(VCHIQ_SERVICE_HANDLE_T handle, short *peer_version) ++{ ++ VCHIQ_STATUS_T status = VCHIQ_ERROR; ++ VCHIQ_SERVICE_T *service = find_service_by_handle(handle); ++ ++ if (!service || ++ (vchiq_check_service(service) != VCHIQ_SUCCESS) || ++ !peer_version) ++ goto exit; ++ *peer_version = service->peer_version; ++ status = VCHIQ_SUCCESS; ++ ++exit: ++ if (service) ++ unlock_service(service); ++ return status; ++} ++ ++VCHIQ_STATUS_T ++vchiq_get_config(VCHIQ_INSTANCE_T instance, ++ int config_size, VCHIQ_CONFIG_T *pconfig) ++{ ++ VCHIQ_CONFIG_T config; ++ ++ (void)instance; ++ ++ config.max_msg_size = VCHIQ_MAX_MSG_SIZE; ++ config.bulk_threshold = VCHIQ_MAX_MSG_SIZE; ++ config.max_outstanding_bulks = VCHIQ_NUM_SERVICE_BULKS; ++ config.max_services = VCHIQ_MAX_SERVICES; ++ config.version = VCHIQ_VERSION; ++ config.version_min = VCHIQ_VERSION_MIN; ++ ++ if (config_size > sizeof(VCHIQ_CONFIG_T)) ++ return VCHIQ_ERROR; ++ ++ memcpy(pconfig, &config, ++ min(config_size, (int)(sizeof(VCHIQ_CONFIG_T)))); ++ ++ return VCHIQ_SUCCESS; ++} ++ ++VCHIQ_STATUS_T ++vchiq_set_service_option(VCHIQ_SERVICE_HANDLE_T handle, ++ VCHIQ_SERVICE_OPTION_T option, int value) ++{ ++ VCHIQ_SERVICE_T *service = find_service_by_handle(handle); ++ VCHIQ_STATUS_T status = VCHIQ_ERROR; ++ ++ if (service) { ++ switch (option) { ++ case VCHIQ_SERVICE_OPTION_AUTOCLOSE: ++ service->auto_close = value; ++ status = VCHIQ_SUCCESS; ++ break; ++ ++ case VCHIQ_SERVICE_OPTION_SLOT_QUOTA: { ++ VCHIQ_SERVICE_QUOTA_T *service_quota = ++ &service->state->service_quotas[ ++ service->localport]; ++ if (value == 0) ++ value = service->state->default_slot_quota; ++ if ((value >= service_quota->slot_use_count) && ++ (value < (unsigned short)~0)) { ++ service_quota->slot_quota = value; ++ if ((value >= service_quota->slot_use_count) && ++ (service_quota->message_quota >= ++ service_quota->message_use_count)) { ++ /* Signal the service that it may have ++ ** dropped below its quota */ ++ up(&service_quota->quota_event); ++ } ++ status = VCHIQ_SUCCESS; ++ } ++ } break; ++ ++ case VCHIQ_SERVICE_OPTION_MESSAGE_QUOTA: { ++ VCHIQ_SERVICE_QUOTA_T *service_quota = ++ &service->state->service_quotas[ ++ service->localport]; ++ if (value == 0) ++ value = service->state->default_message_quota; ++ if ((value >= service_quota->message_use_count) && ++ (value < (unsigned short)~0)) { ++ service_quota->message_quota = value; ++ if ((value >= ++ service_quota->message_use_count) && ++ (service_quota->slot_quota >= ++ service_quota->slot_use_count)) ++ /* Signal the service that it may have ++ ** dropped below its quota */ ++ up(&service_quota->quota_event); ++ status = VCHIQ_SUCCESS; ++ } ++ } break; ++ ++ case VCHIQ_SERVICE_OPTION_SYNCHRONOUS: ++ if ((service->srvstate == VCHIQ_SRVSTATE_HIDDEN) || ++ (service->srvstate == ++ VCHIQ_SRVSTATE_LISTENING)) { ++ service->sync = value; ++ status = VCHIQ_SUCCESS; ++ } ++ break; ++ ++ case VCHIQ_SERVICE_OPTION_TRACE: ++ service->trace = value; ++ status = VCHIQ_SUCCESS; ++ break; ++ ++ default: ++ break; ++ } ++ unlock_service(service); ++ } ++ ++ return status; ++} ++ ++void ++vchiq_dump_shared_state(void *dump_context, VCHIQ_STATE_T *state, ++ VCHIQ_SHARED_STATE_T *shared, const char *label) ++{ ++ static const char *const debug_names[] = { ++ "<entries>", ++ "SLOT_HANDLER_COUNT", ++ "SLOT_HANDLER_LINE", ++ "PARSE_LINE", ++ "PARSE_HEADER", ++ "PARSE_MSGID", ++ "AWAIT_COMPLETION_LINE", ++ "DEQUEUE_MESSAGE_LINE", ++ "SERVICE_CALLBACK_LINE", ++ "MSG_QUEUE_FULL_COUNT", ++ "COMPLETION_QUEUE_FULL_COUNT" ++ }; ++ int i; ++ ++ char buf[80]; ++ int len; ++ len = snprintf(buf, sizeof(buf), ++ " %s: slots %d-%d tx_pos=%x recycle=%x", ++ label, shared->slot_first, shared->slot_last, ++ shared->tx_pos, shared->slot_queue_recycle); ++ vchiq_dump(dump_context, buf, len + 1); ++ ++ len = snprintf(buf, sizeof(buf), ++ " Slots claimed:"); ++ vchiq_dump(dump_context, buf, len + 1); ++ ++ for (i = shared->slot_first; i <= shared->slot_last; i++) { ++ VCHIQ_SLOT_INFO_T slot_info = *SLOT_INFO_FROM_INDEX(state, i); ++ if (slot_info.use_count != slot_info.release_count) { ++ len = snprintf(buf, sizeof(buf), ++ " %d: %d/%d", i, slot_info.use_count, ++ slot_info.release_count); ++ vchiq_dump(dump_context, buf, len + 1); ++ } ++ } ++ ++ for (i = 1; i < shared->debug[DEBUG_ENTRIES]; i++) { ++ len = snprintf(buf, sizeof(buf), " DEBUG: %s = %d(%x)", ++ debug_names[i], shared->debug[i], shared->debug[i]); ++ vchiq_dump(dump_context, buf, len + 1); ++ } ++} ++ ++void ++vchiq_dump_state(void *dump_context, VCHIQ_STATE_T *state) ++{ ++ char buf[80]; ++ int len; ++ int i; ++ ++ len = snprintf(buf, sizeof(buf), "State %d: %s", state->id, ++ conn_state_names[state->conn_state]); ++ vchiq_dump(dump_context, buf, len + 1); ++ ++ len = snprintf(buf, sizeof(buf), ++ " tx_pos=%x(@%x), rx_pos=%x(@%x)", ++ state->local->tx_pos, ++ (uint32_t)state->tx_data + ++ (state->local_tx_pos & VCHIQ_SLOT_MASK), ++ state->rx_pos, ++ (uint32_t)state->rx_data + ++ (state->rx_pos & VCHIQ_SLOT_MASK)); ++ vchiq_dump(dump_context, buf, len + 1); ++ ++ len = snprintf(buf, sizeof(buf), ++ " Version: %d (min %d)", ++ VCHIQ_VERSION, VCHIQ_VERSION_MIN); ++ vchiq_dump(dump_context, buf, len + 1); ++ ++ if (VCHIQ_ENABLE_STATS) { ++ len = snprintf(buf, sizeof(buf), ++ " Stats: ctrl_tx_count=%d, ctrl_rx_count=%d, " ++ "error_count=%d", ++ state->stats.ctrl_tx_count, state->stats.ctrl_rx_count, ++ state->stats.error_count); ++ vchiq_dump(dump_context, buf, len + 1); ++ } ++ ++ len = snprintf(buf, sizeof(buf), ++ " Slots: %d available (%d data), %d recyclable, %d stalls " ++ "(%d data)", ++ ((state->slot_queue_available * VCHIQ_SLOT_SIZE) - ++ state->local_tx_pos) / VCHIQ_SLOT_SIZE, ++ state->data_quota - state->data_use_count, ++ state->local->slot_queue_recycle - state->slot_queue_available, ++ state->stats.slot_stalls, state->stats.data_stalls); ++ vchiq_dump(dump_context, buf, len + 1); ++ ++ vchiq_dump_platform_state(dump_context); ++ ++ vchiq_dump_shared_state(dump_context, state, state->local, "Local"); ++ vchiq_dump_shared_state(dump_context, state, state->remote, "Remote"); ++ ++ vchiq_dump_platform_instances(dump_context); ++ ++ for (i = 0; i < state->unused_service; i++) { ++ VCHIQ_SERVICE_T *service = find_service_by_port(state, i); ++ ++ if (service) { ++ vchiq_dump_service_state(dump_context, service); ++ unlock_service(service); ++ } ++ } ++} ++ ++void ++vchiq_dump_service_state(void *dump_context, VCHIQ_SERVICE_T *service) ++{ ++ char buf[80]; ++ int len; ++ ++ len = snprintf(buf, sizeof(buf), "Service %d: %s (ref %u)", ++ service->localport, srvstate_names[service->srvstate], ++ service->ref_count - 1); /*Don't include the lock just taken*/ ++ ++ if (service->srvstate != VCHIQ_SRVSTATE_FREE) { ++ char remoteport[30]; ++ VCHIQ_SERVICE_QUOTA_T *service_quota = ++ &service->state->service_quotas[service->localport]; ++ int fourcc = service->base.fourcc; ++ int tx_pending, rx_pending; ++ if (service->remoteport != VCHIQ_PORT_FREE) { ++ int len2 = snprintf(remoteport, sizeof(remoteport), ++ "%d", service->remoteport); ++ if (service->public_fourcc != VCHIQ_FOURCC_INVALID) ++ snprintf(remoteport + len2, ++ sizeof(remoteport) - len2, ++ " (client %x)", service->client_id); ++ } else ++ strcpy(remoteport, "n/a"); ++ ++ len += snprintf(buf + len, sizeof(buf) - len, ++ " '%c%c%c%c' remote %s (msg use %d/%d, slot use %d/%d)", ++ VCHIQ_FOURCC_AS_4CHARS(fourcc), ++ remoteport, ++ service_quota->message_use_count, ++ service_quota->message_quota, ++ service_quota->slot_use_count, ++ service_quota->slot_quota); ++ ++ vchiq_dump(dump_context, buf, len + 1); ++ ++ tx_pending = service->bulk_tx.local_insert - ++ service->bulk_tx.remote_insert; ++ ++ rx_pending = service->bulk_rx.local_insert - ++ service->bulk_rx.remote_insert; ++ ++ len = snprintf(buf, sizeof(buf), ++ " Bulk: tx_pending=%d (size %d)," ++ " rx_pending=%d (size %d)", ++ tx_pending, ++ tx_pending ? service->bulk_tx.bulks[ ++ BULK_INDEX(service->bulk_tx.remove)].size : 0, ++ rx_pending, ++ rx_pending ? service->bulk_rx.bulks[ ++ BULK_INDEX(service->bulk_rx.remove)].size : 0); ++ ++ if (VCHIQ_ENABLE_STATS) { ++ vchiq_dump(dump_context, buf, len + 1); ++ ++ len = snprintf(buf, sizeof(buf), ++ " Ctrl: tx_count=%d, tx_bytes=%llu, " ++ "rx_count=%d, rx_bytes=%llu", ++ service->stats.ctrl_tx_count, ++ service->stats.ctrl_tx_bytes, ++ service->stats.ctrl_rx_count, ++ service->stats.ctrl_rx_bytes); ++ vchiq_dump(dump_context, buf, len + 1); ++ ++ len = snprintf(buf, sizeof(buf), ++ " Bulk: tx_count=%d, tx_bytes=%llu, " ++ "rx_count=%d, rx_bytes=%llu", ++ service->stats.bulk_tx_count, ++ service->stats.bulk_tx_bytes, ++ service->stats.bulk_rx_count, ++ service->stats.bulk_rx_bytes); ++ vchiq_dump(dump_context, buf, len + 1); ++ ++ len = snprintf(buf, sizeof(buf), ++ " %d quota stalls, %d slot stalls, " ++ "%d bulk stalls, %d aborted, %d errors", ++ service->stats.quota_stalls, ++ service->stats.slot_stalls, ++ service->stats.bulk_stalls, ++ service->stats.bulk_aborted_count, ++ service->stats.error_count); ++ } ++ } ++ ++ vchiq_dump(dump_context, buf, len + 1); ++ ++ if (service->srvstate != VCHIQ_SRVSTATE_FREE) ++ vchiq_dump_platform_service_state(dump_context, service); ++} ++ ++ ++void ++vchiq_loud_error_header(void) ++{ ++ vchiq_log_error(vchiq_core_log_level, ++ "============================================================" ++ "================"); ++ vchiq_log_error(vchiq_core_log_level, ++ "============================================================" ++ "================"); ++ vchiq_log_error(vchiq_core_log_level, "====="); ++} ++ ++void ++vchiq_loud_error_footer(void) ++{ ++ vchiq_log_error(vchiq_core_log_level, "====="); ++ vchiq_log_error(vchiq_core_log_level, ++ "============================================================" ++ "================"); ++ vchiq_log_error(vchiq_core_log_level, ++ "============================================================" ++ "================"); ++} ++ ++ ++VCHIQ_STATUS_T vchiq_send_remote_use(VCHIQ_STATE_T *state) ++{ ++ VCHIQ_STATUS_T status = VCHIQ_RETRY; ++ if (state->conn_state != VCHIQ_CONNSTATE_DISCONNECTED) ++ status = queue_message(state, NULL, ++ VCHIQ_MAKE_MSG(VCHIQ_MSG_REMOTE_USE, 0, 0), ++ NULL, 0, 0, 0); ++ return status; ++} ++ ++VCHIQ_STATUS_T vchiq_send_remote_release(VCHIQ_STATE_T *state) ++{ ++ VCHIQ_STATUS_T status = VCHIQ_RETRY; ++ if (state->conn_state != VCHIQ_CONNSTATE_DISCONNECTED) ++ status = queue_message(state, NULL, ++ VCHIQ_MAKE_MSG(VCHIQ_MSG_REMOTE_RELEASE, 0, 0), ++ NULL, 0, 0, 0); ++ return status; ++} ++ ++VCHIQ_STATUS_T vchiq_send_remote_use_active(VCHIQ_STATE_T *state) ++{ ++ VCHIQ_STATUS_T status = VCHIQ_RETRY; ++ if (state->conn_state != VCHIQ_CONNSTATE_DISCONNECTED) ++ status = queue_message(state, NULL, ++ VCHIQ_MAKE_MSG(VCHIQ_MSG_REMOTE_USE_ACTIVE, 0, 0), ++ NULL, 0, 0, 0); ++ return status; ++} ++ ++void vchiq_log_dump_mem(const char *label, uint32_t addr, const void *voidMem, ++ size_t numBytes) ++{ ++ const uint8_t *mem = (const uint8_t *)voidMem; ++ size_t offset; ++ char lineBuf[100]; ++ char *s; ++ ++ while (numBytes > 0) { ++ s = lineBuf; ++ ++ for (offset = 0; offset < 16; offset++) { ++ if (offset < numBytes) ++ s += snprintf(s, 4, "%02x ", mem[offset]); ++ else ++ s += snprintf(s, 4, " "); ++ } ++ ++ for (offset = 0; offset < 16; offset++) { ++ if (offset < numBytes) { ++ uint8_t ch = mem[offset]; ++ ++ if ((ch < ' ') || (ch > '~')) ++ ch = '.'; ++ *s++ = (char)ch; ++ } ++ } ++ *s++ = '\0'; ++ ++ if ((label != NULL) && (*label != '\0')) ++ vchiq_log_trace(VCHIQ_LOG_TRACE, ++ "%s: %08x: %s", label, addr, lineBuf); ++ else ++ vchiq_log_trace(VCHIQ_LOG_TRACE, ++ "%08x: %s", addr, lineBuf); ++ ++ addr += 16; ++ mem += 16; ++ if (numBytes > 16) ++ numBytes -= 16; ++ else ++ numBytes = 0; ++ } ++} +diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_core.h b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_core.h +new file mode 100644 +index 0000000..9be484c +--- /dev/null ++++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_core.h +@@ -0,0 +1,712 @@ ++/** ++ * Copyright (c) 2010-2012 Broadcom. 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, ++ * without modification. ++ * 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. ++ * 3. The names of the above-listed copyright holders may not be used ++ * to endorse or promote products derived from this software without ++ * specific prior written permission. ++ * ++ * ALTERNATIVELY, this software may be distributed under the terms of the ++ * GNU General Public License ("GPL") version 2, as published by the Free ++ * Software Foundation. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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. ++ */ ++ ++#ifndef VCHIQ_CORE_H ++#define VCHIQ_CORE_H ++ ++#include <linux/mutex.h> ++#include <linux/semaphore.h> ++#include <linux/kthread.h> ++ ++#include "vchiq_cfg.h" ++ ++#include "vchiq.h" ++ ++/* Run time control of log level, based on KERN_XXX level. */ ++#define VCHIQ_LOG_DEFAULT 4 ++#define VCHIQ_LOG_ERROR 3 ++#define VCHIQ_LOG_WARNING 4 ++#define VCHIQ_LOG_INFO 6 ++#define VCHIQ_LOG_TRACE 7 ++ ++#define VCHIQ_LOG_PREFIX KERN_INFO "vchiq: " ++ ++#ifndef vchiq_log_error ++#define vchiq_log_error(cat, fmt, ...) \ ++ do { if (cat >= VCHIQ_LOG_ERROR) \ ++ printk(VCHIQ_LOG_PREFIX fmt "\n", ##__VA_ARGS__); } while (0) ++#endif ++#ifndef vchiq_log_warning ++#define vchiq_log_warning(cat, fmt, ...) \ ++ do { if (cat >= VCHIQ_LOG_WARNING) \ ++ printk(VCHIQ_LOG_PREFIX fmt "\n", ##__VA_ARGS__); } while (0) ++#endif ++#ifndef vchiq_log_info ++#define vchiq_log_info(cat, fmt, ...) \ ++ do { if (cat >= VCHIQ_LOG_INFO) \ ++ printk(VCHIQ_LOG_PREFIX fmt "\n", ##__VA_ARGS__); } while (0) ++#endif ++#ifndef vchiq_log_trace ++#define vchiq_log_trace(cat, fmt, ...) \ ++ do { if (cat >= VCHIQ_LOG_TRACE) \ ++ printk(VCHIQ_LOG_PREFIX fmt "\n", ##__VA_ARGS__); } while (0) ++#endif ++ ++#define vchiq_loud_error(...) \ ++ vchiq_log_error(vchiq_core_log_level, "===== " __VA_ARGS__) ++ ++#ifndef vchiq_static_assert ++#define vchiq_static_assert(cond) __attribute__((unused)) \ ++ extern int vchiq_static_assert[(cond) ? 1 : -1] ++#endif ++ ++#define IS_POW2(x) (x && ((x & (x - 1)) == 0)) ++ ++/* Ensure that the slot size and maximum number of slots are powers of 2 */ ++vchiq_static_assert(IS_POW2(VCHIQ_SLOT_SIZE)); ++vchiq_static_assert(IS_POW2(VCHIQ_MAX_SLOTS)); ++vchiq_static_assert(IS_POW2(VCHIQ_MAX_SLOTS_PER_SIDE)); ++ ++#define VCHIQ_SLOT_MASK (VCHIQ_SLOT_SIZE - 1) ++#define VCHIQ_SLOT_QUEUE_MASK (VCHIQ_MAX_SLOTS_PER_SIDE - 1) ++#define VCHIQ_SLOT_ZERO_SLOTS ((sizeof(VCHIQ_SLOT_ZERO_T) + \ ++ VCHIQ_SLOT_SIZE - 1) / VCHIQ_SLOT_SIZE) ++ ++#define VCHIQ_MSG_PADDING 0 /* - */ ++#define VCHIQ_MSG_CONNECT 1 /* - */ ++#define VCHIQ_MSG_OPEN 2 /* + (srcport, -), fourcc, client_id */ ++#define VCHIQ_MSG_OPENACK 3 /* + (srcport, dstport) */ ++#define VCHIQ_MSG_CLOSE 4 /* + (srcport, dstport) */ ++#define VCHIQ_MSG_DATA 5 /* + (srcport, dstport) */ ++#define VCHIQ_MSG_BULK_RX 6 /* + (srcport, dstport), data, size */ ++#define VCHIQ_MSG_BULK_TX 7 /* + (srcport, dstport), data, size */ ++#define VCHIQ_MSG_BULK_RX_DONE 8 /* + (srcport, dstport), actual */ ++#define VCHIQ_MSG_BULK_TX_DONE 9 /* + (srcport, dstport), actual */ ++#define VCHIQ_MSG_PAUSE 10 /* - */ ++#define VCHIQ_MSG_RESUME 11 /* - */ ++#define VCHIQ_MSG_REMOTE_USE 12 /* - */ ++#define VCHIQ_MSG_REMOTE_RELEASE 13 /* - */ ++#define VCHIQ_MSG_REMOTE_USE_ACTIVE 14 /* - */ ++ ++#define VCHIQ_PORT_MAX (VCHIQ_MAX_SERVICES - 1) ++#define VCHIQ_PORT_FREE 0x1000 ++#define VCHIQ_PORT_IS_VALID(port) (port < VCHIQ_PORT_FREE) ++#define VCHIQ_MAKE_MSG(type, srcport, dstport) \ ++ ((type<<24) | (srcport<<12) | (dstport<<0)) ++#define VCHIQ_MSG_TYPE(msgid) ((unsigned int)msgid >> 24) ++#define VCHIQ_MSG_SRCPORT(msgid) \ ++ (unsigned short)(((unsigned int)msgid >> 12) & 0xfff) ++#define VCHIQ_MSG_DSTPORT(msgid) \ ++ ((unsigned short)msgid & 0xfff) ++ ++#define VCHIQ_FOURCC_AS_4CHARS(fourcc) \ ++ ((fourcc) >> 24) & 0xff, \ ++ ((fourcc) >> 16) & 0xff, \ ++ ((fourcc) >> 8) & 0xff, \ ++ (fourcc) & 0xff ++ ++/* Ensure the fields are wide enough */ ++vchiq_static_assert(VCHIQ_MSG_SRCPORT(VCHIQ_MAKE_MSG(0, 0, VCHIQ_PORT_MAX)) ++ == 0); ++vchiq_static_assert(VCHIQ_MSG_TYPE(VCHIQ_MAKE_MSG(0, VCHIQ_PORT_MAX, 0)) == 0); ++vchiq_static_assert((unsigned int)VCHIQ_PORT_MAX < ++ (unsigned int)VCHIQ_PORT_FREE); ++ ++#define VCHIQ_MSGID_PADDING VCHIQ_MAKE_MSG(VCHIQ_MSG_PADDING, 0, 0) ++#define VCHIQ_MSGID_CLAIMED 0x40000000 ++ ++#define VCHIQ_FOURCC_INVALID 0x00000000 ++#define VCHIQ_FOURCC_IS_LEGAL(fourcc) (fourcc != VCHIQ_FOURCC_INVALID) ++ ++#define VCHIQ_BULK_ACTUAL_ABORTED -1 ++ ++typedef uint32_t BITSET_T; ++ ++vchiq_static_assert((sizeof(BITSET_T) * 8) == 32); ++ ++#define BITSET_SIZE(b) ((b + 31) >> 5) ++#define BITSET_WORD(b) (b >> 5) ++#define BITSET_BIT(b) (1 << (b & 31)) ++#define BITSET_ZERO(bs) memset(bs, 0, sizeof(bs)) ++#define BITSET_IS_SET(bs, b) (bs[BITSET_WORD(b)] & BITSET_BIT(b)) ++#define BITSET_SET(bs, b) (bs[BITSET_WORD(b)] |= BITSET_BIT(b)) ++#define BITSET_CLR(bs, b) (bs[BITSET_WORD(b)] &= ~BITSET_BIT(b)) ++ ++#if VCHIQ_ENABLE_STATS ++#define VCHIQ_STATS_INC(state, stat) (state->stats. stat++) ++#define VCHIQ_SERVICE_STATS_INC(service, stat) (service->stats. stat++) ++#define VCHIQ_SERVICE_STATS_ADD(service, stat, addend) \ ++ (service->stats. stat += addend) ++#else ++#define VCHIQ_STATS_INC(state, stat) ((void)0) ++#define VCHIQ_SERVICE_STATS_INC(service, stat) ((void)0) ++#define VCHIQ_SERVICE_STATS_ADD(service, stat, addend) ((void)0) ++#endif ++ ++enum { ++ DEBUG_ENTRIES, ++#if VCHIQ_ENABLE_DEBUG ++ DEBUG_SLOT_HANDLER_COUNT, ++ DEBUG_SLOT_HANDLER_LINE, ++ DEBUG_PARSE_LINE, ++ DEBUG_PARSE_HEADER, ++ DEBUG_PARSE_MSGID, ++ DEBUG_AWAIT_COMPLETION_LINE, ++ DEBUG_DEQUEUE_MESSAGE_LINE, ++ DEBUG_SERVICE_CALLBACK_LINE, ++ DEBUG_MSG_QUEUE_FULL_COUNT, ++ DEBUG_COMPLETION_QUEUE_FULL_COUNT, ++#endif ++ DEBUG_MAX ++}; ++ ++#if VCHIQ_ENABLE_DEBUG ++ ++#define DEBUG_INITIALISE(local) int *debug_ptr = (local)->debug; ++#define DEBUG_TRACE(d) \ ++ do { debug_ptr[DEBUG_ ## d] = __LINE__; dsb(); } while (0) ++#define DEBUG_VALUE(d, v) \ ++ do { debug_ptr[DEBUG_ ## d] = (v); dsb(); } while (0) ++#define DEBUG_COUNT(d) \ ++ do { debug_ptr[DEBUG_ ## d]++; dsb(); } while (0) ++ ++#else /* VCHIQ_ENABLE_DEBUG */ ++ ++#define DEBUG_INITIALISE(local) ++#define DEBUG_TRACE(d) ++#define DEBUG_VALUE(d, v) ++#define DEBUG_COUNT(d) ++ ++#endif /* VCHIQ_ENABLE_DEBUG */ ++ ++typedef enum { ++ VCHIQ_CONNSTATE_DISCONNECTED, ++ VCHIQ_CONNSTATE_CONNECTING, ++ VCHIQ_CONNSTATE_CONNECTED, ++ VCHIQ_CONNSTATE_PAUSING, ++ VCHIQ_CONNSTATE_PAUSE_SENT, ++ VCHIQ_CONNSTATE_PAUSED, ++ VCHIQ_CONNSTATE_RESUMING, ++ VCHIQ_CONNSTATE_PAUSE_TIMEOUT, ++ VCHIQ_CONNSTATE_RESUME_TIMEOUT ++} VCHIQ_CONNSTATE_T; ++ ++enum { ++ VCHIQ_SRVSTATE_FREE, ++ VCHIQ_SRVSTATE_HIDDEN, ++ VCHIQ_SRVSTATE_LISTENING, ++ VCHIQ_SRVSTATE_OPENING, ++ VCHIQ_SRVSTATE_OPEN, ++ VCHIQ_SRVSTATE_OPENSYNC, ++ VCHIQ_SRVSTATE_CLOSESENT, ++ VCHIQ_SRVSTATE_CLOSERECVD, ++ VCHIQ_SRVSTATE_CLOSEWAIT, ++ VCHIQ_SRVSTATE_CLOSED ++}; ++ ++enum { ++ VCHIQ_POLL_TERMINATE, ++ VCHIQ_POLL_REMOVE, ++ VCHIQ_POLL_TXNOTIFY, ++ VCHIQ_POLL_RXNOTIFY, ++ VCHIQ_POLL_COUNT ++}; ++ ++typedef enum { ++ VCHIQ_BULK_TRANSMIT, ++ VCHIQ_BULK_RECEIVE ++} VCHIQ_BULK_DIR_T; ++ ++typedef void (*VCHIQ_USERDATA_TERM_T)(void *userdata); ++ ++typedef struct vchiq_bulk_struct { ++ short mode; ++ short dir; ++ void *userdata; ++ VCHI_MEM_HANDLE_T handle; ++ void *data; ++ int size; ++ void *remote_data; ++ int remote_size; ++ int actual; ++} VCHIQ_BULK_T; ++ ++typedef struct vchiq_bulk_queue_struct { ++ int local_insert; /* Where to insert the next local bulk */ ++ int remote_insert; /* Where to insert the next remote bulk (master) */ ++ int process; /* Bulk to transfer next */ ++ int remote_notify; /* Bulk to notify the remote client of next (mstr) */ ++ int remove; /* Bulk to notify the local client of, and remove, ++ ** next */ ++ VCHIQ_BULK_T bulks[VCHIQ_NUM_SERVICE_BULKS]; ++} VCHIQ_BULK_QUEUE_T; ++ ++typedef struct remote_event_struct { ++ int armed; ++ int fired; ++ struct semaphore *event; ++} REMOTE_EVENT_T; ++ ++typedef struct opaque_platform_state_t *VCHIQ_PLATFORM_STATE_T; ++ ++typedef struct vchiq_state_struct VCHIQ_STATE_T; ++ ++typedef struct vchiq_slot_struct { ++ char data[VCHIQ_SLOT_SIZE]; ++} VCHIQ_SLOT_T; ++ ++typedef struct vchiq_slot_info_struct { ++ /* Use two counters rather than one to avoid the need for a mutex. */ ++ short use_count; ++ short release_count; ++} VCHIQ_SLOT_INFO_T; ++ ++typedef struct vchiq_service_struct { ++ VCHIQ_SERVICE_BASE_T base; ++ VCHIQ_SERVICE_HANDLE_T handle; ++ unsigned int ref_count; ++ int srvstate; ++ VCHIQ_USERDATA_TERM_T userdata_term; ++ unsigned int localport; ++ unsigned int remoteport; ++ int public_fourcc; ++ int client_id; ++ char auto_close; ++ char sync; ++ char closing; ++ char trace; ++ atomic_t poll_flags; ++ short version; ++ short version_min; ++ short peer_version; ++ ++ VCHIQ_STATE_T *state; ++ VCHIQ_INSTANCE_T instance; ++ ++ int service_use_count; ++ ++ VCHIQ_BULK_QUEUE_T bulk_tx; ++ VCHIQ_BULK_QUEUE_T bulk_rx; ++ ++ struct semaphore remove_event; ++ struct semaphore bulk_remove_event; ++ struct mutex bulk_mutex; ++ ++ struct service_stats_struct { ++ int quota_stalls; ++ int slot_stalls; ++ int bulk_stalls; ++ int error_count; ++ int ctrl_tx_count; ++ int ctrl_rx_count; ++ int bulk_tx_count; ++ int bulk_rx_count; ++ int bulk_aborted_count; ++ uint64_t ctrl_tx_bytes; ++ uint64_t ctrl_rx_bytes; ++ uint64_t bulk_tx_bytes; ++ uint64_t bulk_rx_bytes; ++ } stats; ++} VCHIQ_SERVICE_T; ++ ++/* The quota information is outside VCHIQ_SERVICE_T so that it can be ++ statically allocated, since for accounting reasons a service's slot ++ usage is carried over between users of the same port number. ++ */ ++typedef struct vchiq_service_quota_struct { ++ unsigned short slot_quota; ++ unsigned short slot_use_count; ++ unsigned short message_quota; ++ unsigned short message_use_count; ++ struct semaphore quota_event; ++ int previous_tx_index; ++} VCHIQ_SERVICE_QUOTA_T; ++ ++typedef struct vchiq_shared_state_struct { ++ ++ /* A non-zero value here indicates that the content is valid. */ ++ int initialised; ++ ++ /* The first and last (inclusive) slots allocated to the owner. */ ++ int slot_first; ++ int slot_last; ++ ++ /* The slot allocated to synchronous messages from the owner. */ ++ int slot_sync; ++ ++ /* Signalling this event indicates that owner's slot handler thread ++ ** should run. */ ++ REMOTE_EVENT_T trigger; ++ ++ /* Indicates the byte position within the stream where the next message ++ ** will be written. The least significant bits are an index into the ++ ** slot. The next bits are the index of the slot in slot_queue. */ ++ int tx_pos; ++ ++ /* This event should be signalled when a slot is recycled. */ ++ REMOTE_EVENT_T recycle; ++ ++ /* The slot_queue index where the next recycled slot will be written. */ ++ int slot_queue_recycle; ++ ++ /* This event should be signalled when a synchronous message is sent. */ ++ REMOTE_EVENT_T sync_trigger; ++ ++ /* This event should be signalled when a synchronous message has been ++ ** released. */ ++ REMOTE_EVENT_T sync_release; ++ ++ /* A circular buffer of slot indexes. */ ++ int slot_queue[VCHIQ_MAX_SLOTS_PER_SIDE]; ++ ++ /* Debugging state */ ++ int debug[DEBUG_MAX]; ++} VCHIQ_SHARED_STATE_T; ++ ++typedef struct vchiq_slot_zero_struct { ++ int magic; ++ short version; ++ short version_min; ++ int slot_zero_size; ++ int slot_size; ++ int max_slots; ++ int max_slots_per_side; ++ int platform_data[2]; ++ VCHIQ_SHARED_STATE_T master; ++ VCHIQ_SHARED_STATE_T slave; ++ VCHIQ_SLOT_INFO_T slots[VCHIQ_MAX_SLOTS]; ++} VCHIQ_SLOT_ZERO_T; ++ ++struct vchiq_state_struct { ++ int id; ++ int initialised; ++ VCHIQ_CONNSTATE_T conn_state; ++ int is_master; ++ short version_common; ++ ++ VCHIQ_SHARED_STATE_T *local; ++ VCHIQ_SHARED_STATE_T *remote; ++ VCHIQ_SLOT_T *slot_data; ++ ++ unsigned short default_slot_quota; ++ unsigned short default_message_quota; ++ ++ /* Event indicating connect message received */ ++ struct semaphore connect; ++ ++ /* Mutex protecting services */ ++ struct mutex mutex; ++ VCHIQ_INSTANCE_T *instance; ++ ++ /* Processes incoming messages */ ++ struct task_struct *slot_handler_thread; ++ ++ /* Processes recycled slots */ ++ struct task_struct *recycle_thread; ++ ++ /* Processes synchronous messages */ ++ struct task_struct *sync_thread; ++ ++ /* Local implementation of the trigger remote event */ ++ struct semaphore trigger_event; ++ ++ /* Local implementation of the recycle remote event */ ++ struct semaphore recycle_event; ++ ++ /* Local implementation of the sync trigger remote event */ ++ struct semaphore sync_trigger_event; ++ ++ /* Local implementation of the sync release remote event */ ++ struct semaphore sync_release_event; ++ ++ char *tx_data; ++ char *rx_data; ++ VCHIQ_SLOT_INFO_T *rx_info; ++ ++ struct mutex slot_mutex; ++ ++ struct mutex recycle_mutex; ++ ++ struct mutex sync_mutex; ++ ++ struct mutex bulk_transfer_mutex; ++ ++ /* Indicates the byte position within the stream from where the next ++ ** message will be read. The least significant bits are an index into ++ ** the slot.The next bits are the index of the slot in ++ ** remote->slot_queue. */ ++ int rx_pos; ++ ++ /* A cached copy of local->tx_pos. Only write to local->tx_pos, and read ++ from remote->tx_pos. */ ++ int local_tx_pos; ++ ++ /* The slot_queue index of the slot to become available next. */ ++ int slot_queue_available; ++ ++ /* A flag to indicate if any poll has been requested */ ++ int poll_needed; ++ ++ /* Ths index of the previous slot used for data messages. */ ++ int previous_data_index; ++ ++ /* The number of slots occupied by data messages. */ ++ unsigned short data_use_count; ++ ++ /* The maximum number of slots to be occupied by data messages. */ ++ unsigned short data_quota; ++ ++ /* An array of bit sets indicating which services must be polled. */ ++ atomic_t poll_services[BITSET_SIZE(VCHIQ_MAX_SERVICES)]; ++ ++ /* The number of the first unused service */ ++ int unused_service; ++ ++ /* Signalled when a free slot becomes available. */ ++ struct semaphore slot_available_event; ++ ++ struct semaphore slot_remove_event; ++ ++ /* Signalled when a free data slot becomes available. */ ++ struct semaphore data_quota_event; ++ ++ /* Incremented when there are bulk transfers which cannot be processed ++ * whilst paused and must be processed on resume */ ++ int deferred_bulks; ++ ++ struct state_stats_struct { ++ int slot_stalls; ++ int data_stalls; ++ int ctrl_tx_count; ++ int ctrl_rx_count; ++ int error_count; ++ } stats; ++ ++ VCHIQ_SERVICE_T * services[VCHIQ_MAX_SERVICES]; ++ VCHIQ_SERVICE_QUOTA_T service_quotas[VCHIQ_MAX_SERVICES]; ++ VCHIQ_SLOT_INFO_T slot_info[VCHIQ_MAX_SLOTS]; ++ ++ VCHIQ_PLATFORM_STATE_T platform_state; ++}; ++ ++struct bulk_waiter { ++ VCHIQ_BULK_T *bulk; ++ struct semaphore event; ++ int actual; ++}; ++ ++extern spinlock_t bulk_waiter_spinlock; ++ ++extern int vchiq_core_log_level; ++extern int vchiq_core_msg_log_level; ++extern int vchiq_sync_log_level; ++ ++extern VCHIQ_STATE_T *vchiq_states[VCHIQ_MAX_STATES]; ++ ++extern const char * ++get_conn_state_name(VCHIQ_CONNSTATE_T conn_state); ++ ++extern VCHIQ_SLOT_ZERO_T * ++vchiq_init_slots(void *mem_base, int mem_size); ++ ++extern VCHIQ_STATUS_T ++vchiq_init_state(VCHIQ_STATE_T *state, VCHIQ_SLOT_ZERO_T *slot_zero, ++ int is_master); ++ ++extern VCHIQ_STATUS_T ++vchiq_connect_internal(VCHIQ_STATE_T *state, VCHIQ_INSTANCE_T instance); ++ ++extern VCHIQ_SERVICE_T * ++vchiq_add_service_internal(VCHIQ_STATE_T *state, ++ const VCHIQ_SERVICE_PARAMS_T *params, int srvstate, ++ VCHIQ_INSTANCE_T instance, VCHIQ_USERDATA_TERM_T userdata_term); ++ ++extern VCHIQ_STATUS_T ++vchiq_open_service_internal(VCHIQ_SERVICE_T *service, int client_id); ++ ++extern VCHIQ_STATUS_T ++vchiq_close_service_internal(VCHIQ_SERVICE_T *service, int close_recvd); ++ ++extern void ++vchiq_terminate_service_internal(VCHIQ_SERVICE_T *service); ++ ++extern void ++vchiq_free_service_internal(VCHIQ_SERVICE_T *service); ++ ++extern VCHIQ_STATUS_T ++vchiq_shutdown_internal(VCHIQ_STATE_T *state, VCHIQ_INSTANCE_T instance); ++ ++extern VCHIQ_STATUS_T ++vchiq_pause_internal(VCHIQ_STATE_T *state); ++ ++extern VCHIQ_STATUS_T ++vchiq_resume_internal(VCHIQ_STATE_T *state); ++ ++extern void ++remote_event_pollall(VCHIQ_STATE_T *state); ++ ++extern VCHIQ_STATUS_T ++vchiq_bulk_transfer(VCHIQ_SERVICE_HANDLE_T handle, ++ VCHI_MEM_HANDLE_T memhandle, void *offset, int size, void *userdata, ++ VCHIQ_BULK_MODE_T mode, VCHIQ_BULK_DIR_T dir); ++ ++extern void ++vchiq_dump_state(void *dump_context, VCHIQ_STATE_T *state); ++ ++extern void ++vchiq_dump_service_state(void *dump_context, VCHIQ_SERVICE_T *service); ++ ++extern void ++vchiq_loud_error_header(void); ++ ++extern void ++vchiq_loud_error_footer(void); ++ ++extern void ++request_poll(VCHIQ_STATE_T *state, VCHIQ_SERVICE_T *service, int poll_type); ++ ++static inline VCHIQ_SERVICE_T * ++handle_to_service(VCHIQ_SERVICE_HANDLE_T handle) ++{ ++ VCHIQ_STATE_T *state = vchiq_states[(handle / VCHIQ_MAX_SERVICES) & ++ (VCHIQ_MAX_STATES - 1)]; ++ if (!state) ++ return NULL; ++ ++ return state->services[handle & (VCHIQ_MAX_SERVICES - 1)]; ++} ++ ++extern VCHIQ_SERVICE_T * ++find_service_by_handle(VCHIQ_SERVICE_HANDLE_T handle); ++ ++extern VCHIQ_SERVICE_T * ++find_service_by_port(VCHIQ_STATE_T *state, int localport); ++ ++extern VCHIQ_SERVICE_T * ++find_service_for_instance(VCHIQ_INSTANCE_T instance, ++ VCHIQ_SERVICE_HANDLE_T handle); ++ ++extern VCHIQ_SERVICE_T * ++find_closed_service_for_instance(VCHIQ_INSTANCE_T instance, ++ VCHIQ_SERVICE_HANDLE_T handle); ++ ++extern VCHIQ_SERVICE_T * ++next_service_by_instance(VCHIQ_STATE_T *state, VCHIQ_INSTANCE_T instance, ++ int *pidx); ++ ++extern void ++lock_service(VCHIQ_SERVICE_T *service); ++ ++extern void ++unlock_service(VCHIQ_SERVICE_T *service); ++ ++/* The following functions are called from vchiq_core, and external ++** implementations must be provided. */ ++ ++extern VCHIQ_STATUS_T ++vchiq_prepare_bulk_data(VCHIQ_BULK_T *bulk, ++ VCHI_MEM_HANDLE_T memhandle, void *offset, int size, int dir); ++ ++extern void ++vchiq_transfer_bulk(VCHIQ_BULK_T *bulk); ++ ++extern void ++vchiq_complete_bulk(VCHIQ_BULK_T *bulk); ++ ++extern VCHIQ_STATUS_T ++vchiq_copy_from_user(void *dst, const void *src, int size); ++ ++extern void ++remote_event_signal(REMOTE_EVENT_T *event); ++ ++void ++vchiq_platform_check_suspend(VCHIQ_STATE_T *state); ++ ++extern void ++vchiq_platform_paused(VCHIQ_STATE_T *state); ++ ++extern VCHIQ_STATUS_T ++vchiq_platform_resume(VCHIQ_STATE_T *state); ++ ++extern void ++vchiq_platform_resumed(VCHIQ_STATE_T *state); ++ ++extern void ++vchiq_dump(void *dump_context, const char *str, int len); ++ ++extern void ++vchiq_dump_platform_state(void *dump_context); ++ ++extern void ++vchiq_dump_platform_instances(void *dump_context); ++ ++extern void ++vchiq_dump_platform_service_state(void *dump_context, ++ VCHIQ_SERVICE_T *service); ++ ++extern VCHIQ_STATUS_T ++vchiq_use_service_internal(VCHIQ_SERVICE_T *service); ++ ++extern VCHIQ_STATUS_T ++vchiq_release_service_internal(VCHIQ_SERVICE_T *service); ++ ++extern void ++vchiq_on_remote_use(VCHIQ_STATE_T *state); ++ ++extern void ++vchiq_on_remote_release(VCHIQ_STATE_T *state); ++ ++extern VCHIQ_STATUS_T ++vchiq_platform_init_state(VCHIQ_STATE_T *state); ++ ++extern VCHIQ_STATUS_T ++vchiq_check_service(VCHIQ_SERVICE_T *service); ++ ++extern void ++vchiq_on_remote_use_active(VCHIQ_STATE_T *state); ++ ++extern VCHIQ_STATUS_T ++vchiq_send_remote_use(VCHIQ_STATE_T *state); ++ ++extern VCHIQ_STATUS_T ++vchiq_send_remote_release(VCHIQ_STATE_T *state); ++ ++extern VCHIQ_STATUS_T ++vchiq_send_remote_use_active(VCHIQ_STATE_T *state); ++ ++extern void ++vchiq_platform_conn_state_changed(VCHIQ_STATE_T *state, ++ VCHIQ_CONNSTATE_T oldstate, VCHIQ_CONNSTATE_T newstate); ++ ++extern void ++vchiq_platform_handle_timeout(VCHIQ_STATE_T *state); ++ ++extern void ++vchiq_set_conn_state(VCHIQ_STATE_T *state, VCHIQ_CONNSTATE_T newstate); ++ ++ ++extern void ++vchiq_log_dump_mem(const char *label, uint32_t addr, const void *voidMem, ++ size_t numBytes); ++ ++#endif +diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_debugfs.c b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_debugfs.c +new file mode 100644 +index 0000000..7e03213 +--- /dev/null ++++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_debugfs.c +@@ -0,0 +1,383 @@ ++/** ++ * Copyright (c) 2014 Raspberry Pi (Trading) Ltd. All rights reserved. ++ * Copyright (c) 2010-2012 Broadcom. 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, ++ * without modification. ++ * 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. ++ * 3. The names of the above-listed copyright holders may not be used ++ * to endorse or promote products derived from this software without ++ * specific prior written permission. ++ * ++ * ALTERNATIVELY, this software may be distributed under the terms of the ++ * GNU General Public License ("GPL") version 2, as published by the Free ++ * Software Foundation. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER OR ++ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ++ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, ++ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR ++ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF ++ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING ++ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ */ ++ ++ ++#include <linux/debugfs.h> ++#include "vchiq_core.h" ++#include "vchiq_arm.h" ++#include "vchiq_debugfs.h" ++ ++#ifdef CONFIG_DEBUG_FS ++ ++/**************************************************************************** ++* ++* log category entries ++* ++***************************************************************************/ ++#define DEBUGFS_WRITE_BUF_SIZE 256 ++ ++#define VCHIQ_LOG_ERROR_STR "error" ++#define VCHIQ_LOG_WARNING_STR "warning" ++#define VCHIQ_LOG_INFO_STR "info" ++#define VCHIQ_LOG_TRACE_STR "trace" ++ ++ ++/* Top-level debug info */ ++struct vchiq_debugfs_info { ++ /* Global 'vchiq' debugfs entry used by all instances */ ++ struct dentry *vchiq_cfg_dir; ++ ++ /* one entry per client process */ ++ struct dentry *clients; ++ ++ /* log categories */ ++ struct dentry *log_categories; ++}; ++ ++static struct vchiq_debugfs_info debugfs_info; ++ ++/* Log category debugfs entries */ ++struct vchiq_debugfs_log_entry { ++ const char *name; ++ int *plevel; ++ struct dentry *dir; ++}; ++ ++static struct vchiq_debugfs_log_entry vchiq_debugfs_log_entries[] = { ++ { "core", &vchiq_core_log_level }, ++ { "msg", &vchiq_core_msg_log_level }, ++ { "sync", &vchiq_sync_log_level }, ++ { "susp", &vchiq_susp_log_level }, ++ { "arm", &vchiq_arm_log_level }, ++}; ++static int n_log_entries = ++ sizeof(vchiq_debugfs_log_entries)/sizeof(vchiq_debugfs_log_entries[0]); ++ ++ ++static struct dentry *vchiq_clients_top(void); ++static struct dentry *vchiq_debugfs_top(void); ++ ++static int debugfs_log_show(struct seq_file *f, void *offset) ++{ ++ int *levp = f->private; ++ char *log_value = NULL; ++ ++ switch (*levp) { ++ case VCHIQ_LOG_ERROR: ++ log_value = VCHIQ_LOG_ERROR_STR; ++ break; ++ case VCHIQ_LOG_WARNING: ++ log_value = VCHIQ_LOG_WARNING_STR; ++ break; ++ case VCHIQ_LOG_INFO: ++ log_value = VCHIQ_LOG_INFO_STR; ++ break; ++ case VCHIQ_LOG_TRACE: ++ log_value = VCHIQ_LOG_TRACE_STR; ++ break; ++ default: ++ break; ++ } ++ ++ seq_printf(f, "%s\n", log_value ? log_value : "(null)"); ++ ++ return 0; ++} ++ ++static int debugfs_log_open(struct inode *inode, struct file *file) ++{ ++ return single_open(file, debugfs_log_show, inode->i_private); ++} ++ ++static int debugfs_log_write(struct file *file, ++ const char __user *buffer, ++ size_t count, loff_t *ppos) ++{ ++ struct seq_file *f = (struct seq_file *)file->private_data; ++ int *levp = f->private; ++ char kbuf[DEBUGFS_WRITE_BUF_SIZE + 1]; ++ ++ memset(kbuf, 0, DEBUGFS_WRITE_BUF_SIZE + 1); ++ if (count >= DEBUGFS_WRITE_BUF_SIZE) ++ count = DEBUGFS_WRITE_BUF_SIZE; ++ ++ if (copy_from_user(kbuf, buffer, count) != 0) ++ return -EFAULT; ++ kbuf[count - 1] = 0; ++ ++ if (strncmp("error", kbuf, strlen("error")) == 0) ++ *levp = VCHIQ_LOG_ERROR; ++ else if (strncmp("warning", kbuf, strlen("warning")) == 0) ++ *levp = VCHIQ_LOG_WARNING; ++ else if (strncmp("info", kbuf, strlen("info")) == 0) ++ *levp = VCHIQ_LOG_INFO; ++ else if (strncmp("trace", kbuf, strlen("trace")) == 0) ++ *levp = VCHIQ_LOG_TRACE; ++ else ++ *levp = VCHIQ_LOG_DEFAULT; ++ ++ *ppos += count; ++ ++ return count; ++} ++ ++static const struct file_operations debugfs_log_fops = { ++ .owner = THIS_MODULE, ++ .open = debugfs_log_open, ++ .write = debugfs_log_write, ++ .read = seq_read, ++ .llseek = seq_lseek, ++ .release = single_release, ++}; ++ ++/* create an entry under <debugfs>/vchiq/log for each log category */ ++static int vchiq_debugfs_create_log_entries(struct dentry *top) ++{ ++ struct dentry *dir; ++ size_t i; ++ int ret = 0; ++ dir = debugfs_create_dir("log", vchiq_debugfs_top()); ++ if (!dir) ++ return -ENOMEM; ++ debugfs_info.log_categories = dir; ++ ++ for (i = 0; i < n_log_entries; i++) { ++ void *levp = (void *)vchiq_debugfs_log_entries[i].plevel; ++ dir = debugfs_create_file(vchiq_debugfs_log_entries[i].name, ++ 0644, ++ debugfs_info.log_categories, ++ levp, ++ &debugfs_log_fops); ++ if (!dir) { ++ ret = -ENOMEM; ++ break; ++ } ++ ++ vchiq_debugfs_log_entries[i].dir = dir; ++ } ++ return ret; ++} ++ ++static int debugfs_usecount_show(struct seq_file *f, void *offset) ++{ ++ VCHIQ_INSTANCE_T instance = f->private; ++ int use_count; ++ ++ use_count = vchiq_instance_get_use_count(instance); ++ seq_printf(f, "%d\n", use_count); ++ ++ return 0; ++} ++ ++static int debugfs_usecount_open(struct inode *inode, struct file *file) ++{ ++ return single_open(file, debugfs_usecount_show, inode->i_private); ++} ++ ++static const struct file_operations debugfs_usecount_fops = { ++ .owner = THIS_MODULE, ++ .open = debugfs_usecount_open, ++ .read = seq_read, ++ .llseek = seq_lseek, ++ .release = single_release, ++}; ++ ++static int debugfs_trace_show(struct seq_file *f, void *offset) ++{ ++ VCHIQ_INSTANCE_T instance = f->private; ++ int trace; ++ ++ trace = vchiq_instance_get_trace(instance); ++ seq_printf(f, "%s\n", trace ? "Y" : "N"); ++ ++ return 0; ++} ++ ++static int debugfs_trace_open(struct inode *inode, struct file *file) ++{ ++ return single_open(file, debugfs_trace_show, inode->i_private); ++} ++ ++static int debugfs_trace_write(struct file *file, ++ const char __user *buffer, ++ size_t count, loff_t *ppos) ++{ ++ struct seq_file *f = (struct seq_file *)file->private_data; ++ VCHIQ_INSTANCE_T instance = f->private; ++ char firstchar; ++ ++ if (copy_from_user(&firstchar, buffer, 1) != 0) ++ return -EFAULT; ++ ++ switch (firstchar) { ++ case 'Y': ++ case 'y': ++ case '1': ++ vchiq_instance_set_trace(instance, 1); ++ break; ++ case 'N': ++ case 'n': ++ case '0': ++ vchiq_instance_set_trace(instance, 0); ++ break; ++ default: ++ break; ++ } ++ ++ *ppos += count; ++ ++ return count; ++} ++ ++static const struct file_operations debugfs_trace_fops = { ++ .owner = THIS_MODULE, ++ .open = debugfs_trace_open, ++ .write = debugfs_trace_write, ++ .read = seq_read, ++ .llseek = seq_lseek, ++ .release = single_release, ++}; ++ ++/* add an instance (process) to the debugfs entries */ ++int vchiq_debugfs_add_instance(VCHIQ_INSTANCE_T instance) ++{ ++ char pidstr[16]; ++ struct dentry *top, *use_count, *trace; ++ struct dentry *clients = vchiq_clients_top(); ++ ++ snprintf(pidstr, sizeof(pidstr), "%d", ++ vchiq_instance_get_pid(instance)); ++ ++ top = debugfs_create_dir(pidstr, clients); ++ if (!top) ++ goto fail_top; ++ ++ use_count = debugfs_create_file("use_count", ++ 0444, top, ++ instance, ++ &debugfs_usecount_fops); ++ if (!use_count) ++ goto fail_use_count; ++ ++ trace = debugfs_create_file("trace", ++ 0644, top, ++ instance, ++ &debugfs_trace_fops); ++ if (!trace) ++ goto fail_trace; ++ ++ vchiq_instance_get_debugfs_node(instance)->dentry = top; ++ ++ return 0; ++ ++fail_trace: ++ debugfs_remove(use_count); ++fail_use_count: ++ debugfs_remove(top); ++fail_top: ++ return -ENOMEM; ++} ++ ++void vchiq_debugfs_remove_instance(VCHIQ_INSTANCE_T instance) ++{ ++ VCHIQ_DEBUGFS_NODE_T *node = vchiq_instance_get_debugfs_node(instance); ++ debugfs_remove_recursive(node->dentry); ++} ++ ++ ++int vchiq_debugfs_init(void) ++{ ++ BUG_ON(debugfs_info.vchiq_cfg_dir != NULL); ++ ++ debugfs_info.vchiq_cfg_dir = debugfs_create_dir("vchiq", NULL); ++ if (debugfs_info.vchiq_cfg_dir == NULL) ++ goto fail; ++ ++ debugfs_info.clients = debugfs_create_dir("clients", ++ vchiq_debugfs_top()); ++ if (!debugfs_info.clients) ++ goto fail; ++ ++ if (vchiq_debugfs_create_log_entries(vchiq_debugfs_top()) != 0) ++ goto fail; ++ ++ return 0; ++ ++fail: ++ vchiq_debugfs_deinit(); ++ vchiq_log_error(vchiq_arm_log_level, ++ "%s: failed to create debugfs directory", ++ __func__); ++ ++ return -ENOMEM; ++} ++ ++/* remove all the debugfs entries */ ++void vchiq_debugfs_deinit(void) ++{ ++ debugfs_remove_recursive(vchiq_debugfs_top()); ++} ++ ++static struct dentry *vchiq_clients_top(void) ++{ ++ return debugfs_info.clients; ++} ++ ++static struct dentry *vchiq_debugfs_top(void) ++{ ++ BUG_ON(debugfs_info.vchiq_cfg_dir == NULL); ++ return debugfs_info.vchiq_cfg_dir; ++} ++ ++#else /* CONFIG_DEBUG_FS */ ++ ++int vchiq_debugfs_init(void) ++{ ++ return 0; ++} ++ ++void vchiq_debugfs_deinit(void) ++{ ++} ++ ++int vchiq_debugfs_add_instance(VCHIQ_INSTANCE_T instance) ++{ ++ return 0; ++} ++ ++void vchiq_debugfs_remove_instance(VCHIQ_INSTANCE_T instance) ++{ ++} ++ ++#endif /* CONFIG_DEBUG_FS */ +diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_debugfs.h b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_debugfs.h +new file mode 100644 +index 0000000..4d6a378 +--- /dev/null ++++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_debugfs.h +@@ -0,0 +1,52 @@ ++/** ++ * Copyright (c) 2014 Raspberry Pi (Trading) Ltd. 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, ++ * without modification. ++ * 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. ++ * 3. The names of the above-listed copyright holders may not be used ++ * to endorse or promote products derived from this software without ++ * specific prior written permission. ++ * ++ * ALTERNATIVELY, this software may be distributed under the terms of the ++ * GNU General Public License ("GPL") version 2, as published by the Free ++ * Software Foundation. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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. ++ */ ++ ++#ifndef VCHIQ_DEBUGFS_H ++#define VCHIQ_DEBUGFS_H ++ ++#include "vchiq_core.h" ++ ++typedef struct vchiq_debugfs_node_struct ++{ ++ struct dentry *dentry; ++} VCHIQ_DEBUGFS_NODE_T; ++ ++int vchiq_debugfs_init(void); ++ ++void vchiq_debugfs_deinit(void); ++ ++int vchiq_debugfs_add_instance(VCHIQ_INSTANCE_T instance); ++ ++void vchiq_debugfs_remove_instance(VCHIQ_INSTANCE_T instance); ++ ++#endif /* VCHIQ_DEBUGFS_H */ +diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_genversion b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_genversion +new file mode 100644 +index 0000000..9f5b634 +--- /dev/null ++++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_genversion +@@ -0,0 +1,87 @@ ++#!/usr/bin/perl -w ++ ++use strict; ++ ++# ++# Generate a version from available information ++# ++ ++my $prefix = shift @ARGV; ++my $root = shift @ARGV; ++ ++ ++if ( not defined $root ) { ++ die "usage: $0 prefix root-dir\n"; ++} ++ ++if ( ! -d $root ) { ++ die "root directory $root not found\n"; ++} ++ ++my $version = "unknown"; ++my $tainted = ""; ++ ++if ( -d "$root/.git" ) { ++ # attempt to work out git version. only do so ++ # on a linux build host, as cygwin builds are ++ # already slow enough ++ ++ if ( -f "/usr/bin/git" || -f "/usr/local/bin/git" ) { ++ if (not open(F, "git --git-dir $root/.git rev-parse --verify HEAD|")) { ++ $version = "no git version"; ++ } ++ else { ++ $version = <F>; ++ $version =~ s/[ \r\n]*$//; # chomp may not be enough (cygwin). ++ $version =~ s/^[ \r\n]*//; # chomp may not be enough (cygwin). ++ } ++ ++ if (open(G, "git --git-dir $root/.git status --porcelain|")) { ++ $tainted = <G>; ++ $tainted =~ s/[ \r\n]*$//; # chomp may not be enough (cygwin). ++ $tainted =~ s/^[ \r\n]*//; # chomp may not be enough (cygwin). ++ if (length $tainted) { ++ $version = join ' ', $version, "(tainted)"; ++ } ++ else { ++ $version = join ' ', $version, "(clean)"; ++ } ++ } ++ } ++} ++ ++my $hostname = `hostname`; ++$hostname =~ s/[ \r\n]*$//; # chomp may not be enough (cygwin). ++$hostname =~ s/^[ \r\n]*//; # chomp may not be enough (cygwin). ++ ++ ++print STDERR "Version $version\n"; ++print <<EOF; ++#include "${prefix}_build_info.h" ++#include <linux/broadcom/vc_debug_sym.h> ++ ++VC_DEBUG_DECLARE_STRING_VAR( ${prefix}_build_hostname, "$hostname" ); ++VC_DEBUG_DECLARE_STRING_VAR( ${prefix}_build_version, "$version" ); ++VC_DEBUG_DECLARE_STRING_VAR( ${prefix}_build_time, __TIME__ ); ++VC_DEBUG_DECLARE_STRING_VAR( ${prefix}_build_date, __DATE__ ); ++ ++const char *vchiq_get_build_hostname( void ) ++{ ++ return vchiq_build_hostname; ++} ++ ++const char *vchiq_get_build_version( void ) ++{ ++ return vchiq_build_version; ++} ++ ++const char *vchiq_get_build_date( void ) ++{ ++ return vchiq_build_date; ++} ++ ++const char *vchiq_get_build_time( void ) ++{ ++ return vchiq_build_time; ++} ++EOF +diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_if.h b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_if.h +new file mode 100644 +index 0000000..8067bbe +--- /dev/null ++++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_if.h +@@ -0,0 +1,189 @@ ++/** ++ * Copyright (c) 2010-2012 Broadcom. 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, ++ * without modification. ++ * 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. ++ * 3. The names of the above-listed copyright holders may not be used ++ * to endorse or promote products derived from this software without ++ * specific prior written permission. ++ * ++ * ALTERNATIVELY, this software may be distributed under the terms of the ++ * GNU General Public License ("GPL") version 2, as published by the Free ++ * Software Foundation. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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. ++ */ ++ ++#ifndef VCHIQ_IF_H ++#define VCHIQ_IF_H ++ ++#include "interface/vchi/vchi_mh.h" ++ ++#define VCHIQ_SERVICE_HANDLE_INVALID 0 ++ ++#define VCHIQ_SLOT_SIZE 4096 ++#define VCHIQ_MAX_MSG_SIZE (VCHIQ_SLOT_SIZE - sizeof(VCHIQ_HEADER_T)) ++#define VCHIQ_CHANNEL_SIZE VCHIQ_MAX_MSG_SIZE /* For backwards compatibility */ ++ ++#define VCHIQ_MAKE_FOURCC(x0, x1, x2, x3) \ ++ (((x0) << 24) | ((x1) << 16) | ((x2) << 8) | (x3)) ++#define VCHIQ_GET_SERVICE_USERDATA(service) vchiq_get_service_userdata(service) ++#define VCHIQ_GET_SERVICE_FOURCC(service) vchiq_get_service_fourcc(service) ++ ++typedef enum { ++ VCHIQ_SERVICE_OPENED, /* service, -, - */ ++ VCHIQ_SERVICE_CLOSED, /* service, -, - */ ++ VCHIQ_MESSAGE_AVAILABLE, /* service, header, - */ ++ VCHIQ_BULK_TRANSMIT_DONE, /* service, -, bulk_userdata */ ++ VCHIQ_BULK_RECEIVE_DONE, /* service, -, bulk_userdata */ ++ VCHIQ_BULK_TRANSMIT_ABORTED, /* service, -, bulk_userdata */ ++ VCHIQ_BULK_RECEIVE_ABORTED /* service, -, bulk_userdata */ ++} VCHIQ_REASON_T; ++ ++typedef enum { ++ VCHIQ_ERROR = -1, ++ VCHIQ_SUCCESS = 0, ++ VCHIQ_RETRY = 1 ++} VCHIQ_STATUS_T; ++ ++typedef enum { ++ VCHIQ_BULK_MODE_CALLBACK, ++ VCHIQ_BULK_MODE_BLOCKING, ++ VCHIQ_BULK_MODE_NOCALLBACK, ++ VCHIQ_BULK_MODE_WAITING /* Reserved for internal use */ ++} VCHIQ_BULK_MODE_T; ++ ++typedef enum { ++ VCHIQ_SERVICE_OPTION_AUTOCLOSE, ++ VCHIQ_SERVICE_OPTION_SLOT_QUOTA, ++ VCHIQ_SERVICE_OPTION_MESSAGE_QUOTA, ++ VCHIQ_SERVICE_OPTION_SYNCHRONOUS, ++ VCHIQ_SERVICE_OPTION_TRACE ++} VCHIQ_SERVICE_OPTION_T; ++ ++typedef struct vchiq_header_struct { ++ /* The message identifier - opaque to applications. */ ++ int msgid; ++ ++ /* Size of message data. */ ++ unsigned int size; ++ ++ char data[0]; /* message */ ++} VCHIQ_HEADER_T; ++ ++typedef struct { ++ const void *data; ++ unsigned int size; ++} VCHIQ_ELEMENT_T; ++ ++typedef unsigned int VCHIQ_SERVICE_HANDLE_T; ++ ++typedef VCHIQ_STATUS_T (*VCHIQ_CALLBACK_T)(VCHIQ_REASON_T, VCHIQ_HEADER_T *, ++ VCHIQ_SERVICE_HANDLE_T, void *); ++ ++typedef struct vchiq_service_base_struct { ++ int fourcc; ++ VCHIQ_CALLBACK_T callback; ++ void *userdata; ++} VCHIQ_SERVICE_BASE_T; ++ ++typedef struct vchiq_service_params_struct { ++ int fourcc; ++ VCHIQ_CALLBACK_T callback; ++ void *userdata; ++ short version; /* Increment for non-trivial changes */ ++ short version_min; /* Update for incompatible changes */ ++} VCHIQ_SERVICE_PARAMS_T; ++ ++typedef struct vchiq_config_struct { ++ unsigned int max_msg_size; ++ unsigned int bulk_threshold; /* The message size above which it ++ is better to use a bulk transfer ++ (<= max_msg_size) */ ++ unsigned int max_outstanding_bulks; ++ unsigned int max_services; ++ short version; /* The version of VCHIQ */ ++ short version_min; /* The minimum compatible version of VCHIQ */ ++} VCHIQ_CONFIG_T; ++ ++typedef struct vchiq_instance_struct *VCHIQ_INSTANCE_T; ++typedef void (*VCHIQ_REMOTE_USE_CALLBACK_T)(void *cb_arg); ++ ++extern VCHIQ_STATUS_T vchiq_initialise(VCHIQ_INSTANCE_T *pinstance); ++extern VCHIQ_STATUS_T vchiq_shutdown(VCHIQ_INSTANCE_T instance); ++extern VCHIQ_STATUS_T vchiq_connect(VCHIQ_INSTANCE_T instance); ++extern VCHIQ_STATUS_T vchiq_add_service(VCHIQ_INSTANCE_T instance, ++ const VCHIQ_SERVICE_PARAMS_T *params, ++ VCHIQ_SERVICE_HANDLE_T *pservice); ++extern VCHIQ_STATUS_T vchiq_open_service(VCHIQ_INSTANCE_T instance, ++ const VCHIQ_SERVICE_PARAMS_T *params, ++ VCHIQ_SERVICE_HANDLE_T *pservice); ++extern VCHIQ_STATUS_T vchiq_close_service(VCHIQ_SERVICE_HANDLE_T service); ++extern VCHIQ_STATUS_T vchiq_remove_service(VCHIQ_SERVICE_HANDLE_T service); ++extern VCHIQ_STATUS_T vchiq_use_service(VCHIQ_SERVICE_HANDLE_T service); ++extern VCHIQ_STATUS_T vchiq_use_service_no_resume( ++ VCHIQ_SERVICE_HANDLE_T service); ++extern VCHIQ_STATUS_T vchiq_release_service(VCHIQ_SERVICE_HANDLE_T service); ++ ++extern VCHIQ_STATUS_T vchiq_queue_message(VCHIQ_SERVICE_HANDLE_T service, ++ const VCHIQ_ELEMENT_T *elements, unsigned int count); ++extern void vchiq_release_message(VCHIQ_SERVICE_HANDLE_T service, ++ VCHIQ_HEADER_T *header); ++extern VCHIQ_STATUS_T vchiq_queue_bulk_transmit(VCHIQ_SERVICE_HANDLE_T service, ++ const void *data, unsigned int size, void *userdata); ++extern VCHIQ_STATUS_T vchiq_queue_bulk_receive(VCHIQ_SERVICE_HANDLE_T service, ++ void *data, unsigned int size, void *userdata); ++extern VCHIQ_STATUS_T vchiq_queue_bulk_transmit_handle( ++ VCHIQ_SERVICE_HANDLE_T service, VCHI_MEM_HANDLE_T handle, ++ const void *offset, unsigned int size, void *userdata); ++extern VCHIQ_STATUS_T vchiq_queue_bulk_receive_handle( ++ VCHIQ_SERVICE_HANDLE_T service, VCHI_MEM_HANDLE_T handle, ++ void *offset, unsigned int size, void *userdata); ++extern VCHIQ_STATUS_T vchiq_bulk_transmit(VCHIQ_SERVICE_HANDLE_T service, ++ const void *data, unsigned int size, void *userdata, ++ VCHIQ_BULK_MODE_T mode); ++extern VCHIQ_STATUS_T vchiq_bulk_receive(VCHIQ_SERVICE_HANDLE_T service, ++ void *data, unsigned int size, void *userdata, ++ VCHIQ_BULK_MODE_T mode); ++extern VCHIQ_STATUS_T vchiq_bulk_transmit_handle(VCHIQ_SERVICE_HANDLE_T service, ++ VCHI_MEM_HANDLE_T handle, const void *offset, unsigned int size, ++ void *userdata, VCHIQ_BULK_MODE_T mode); ++extern VCHIQ_STATUS_T vchiq_bulk_receive_handle(VCHIQ_SERVICE_HANDLE_T service, ++ VCHI_MEM_HANDLE_T handle, void *offset, unsigned int size, ++ void *userdata, VCHIQ_BULK_MODE_T mode); ++extern int vchiq_get_client_id(VCHIQ_SERVICE_HANDLE_T service); ++extern void *vchiq_get_service_userdata(VCHIQ_SERVICE_HANDLE_T service); ++extern int vchiq_get_service_fourcc(VCHIQ_SERVICE_HANDLE_T service); ++extern VCHIQ_STATUS_T vchiq_get_config(VCHIQ_INSTANCE_T instance, ++ int config_size, VCHIQ_CONFIG_T *pconfig); ++extern VCHIQ_STATUS_T vchiq_set_service_option(VCHIQ_SERVICE_HANDLE_T service, ++ VCHIQ_SERVICE_OPTION_T option, int value); ++ ++extern VCHIQ_STATUS_T vchiq_remote_use(VCHIQ_INSTANCE_T instance, ++ VCHIQ_REMOTE_USE_CALLBACK_T callback, void *cb_arg); ++extern VCHIQ_STATUS_T vchiq_remote_release(VCHIQ_INSTANCE_T instance); ++ ++extern VCHIQ_STATUS_T vchiq_dump_phys_mem(VCHIQ_SERVICE_HANDLE_T service, ++ void *ptr, size_t num_bytes); ++ ++extern VCHIQ_STATUS_T vchiq_get_peer_version(VCHIQ_SERVICE_HANDLE_T handle, ++ short *peer_version); ++ ++#endif /* VCHIQ_IF_H */ +diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_ioctl.h b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_ioctl.h +new file mode 100644 +index 0000000..6137ae9 +--- /dev/null ++++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_ioctl.h +@@ -0,0 +1,131 @@ ++/** ++ * Copyright (c) 2010-2012 Broadcom. 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, ++ * without modification. ++ * 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. ++ * 3. The names of the above-listed copyright holders may not be used ++ * to endorse or promote products derived from this software without ++ * specific prior written permission. ++ * ++ * ALTERNATIVELY, this software may be distributed under the terms of the ++ * GNU General Public License ("GPL") version 2, as published by the Free ++ * Software Foundation. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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. ++ */ ++ ++#ifndef VCHIQ_IOCTLS_H ++#define VCHIQ_IOCTLS_H ++ ++#include <linux/ioctl.h> ++#include "vchiq_if.h" ++ ++#define VCHIQ_IOC_MAGIC 0xc4 ++#define VCHIQ_INVALID_HANDLE (~0) ++ ++typedef struct { ++ VCHIQ_SERVICE_PARAMS_T params; ++ int is_open; ++ int is_vchi; ++ unsigned int handle; /* OUT */ ++} VCHIQ_CREATE_SERVICE_T; ++ ++typedef struct { ++ unsigned int handle; ++ unsigned int count; ++ const VCHIQ_ELEMENT_T *elements; ++} VCHIQ_QUEUE_MESSAGE_T; ++ ++typedef struct { ++ unsigned int handle; ++ void *data; ++ unsigned int size; ++ void *userdata; ++ VCHIQ_BULK_MODE_T mode; ++} VCHIQ_QUEUE_BULK_TRANSFER_T; ++ ++typedef struct { ++ VCHIQ_REASON_T reason; ++ VCHIQ_HEADER_T *header; ++ void *service_userdata; ++ void *bulk_userdata; ++} VCHIQ_COMPLETION_DATA_T; ++ ++typedef struct { ++ unsigned int count; ++ VCHIQ_COMPLETION_DATA_T *buf; ++ unsigned int msgbufsize; ++ unsigned int msgbufcount; /* IN/OUT */ ++ void **msgbufs; ++} VCHIQ_AWAIT_COMPLETION_T; ++ ++typedef struct { ++ unsigned int handle; ++ int blocking; ++ unsigned int bufsize; ++ void *buf; ++} VCHIQ_DEQUEUE_MESSAGE_T; ++ ++typedef struct { ++ unsigned int config_size; ++ VCHIQ_CONFIG_T *pconfig; ++} VCHIQ_GET_CONFIG_T; ++ ++typedef struct { ++ unsigned int handle; ++ VCHIQ_SERVICE_OPTION_T option; ++ int value; ++} VCHIQ_SET_SERVICE_OPTION_T; ++ ++typedef struct { ++ void *virt_addr; ++ size_t num_bytes; ++} VCHIQ_DUMP_MEM_T; ++ ++#define VCHIQ_IOC_CONNECT _IO(VCHIQ_IOC_MAGIC, 0) ++#define VCHIQ_IOC_SHUTDOWN _IO(VCHIQ_IOC_MAGIC, 1) ++#define VCHIQ_IOC_CREATE_SERVICE \ ++ _IOWR(VCHIQ_IOC_MAGIC, 2, VCHIQ_CREATE_SERVICE_T) ++#define VCHIQ_IOC_REMOVE_SERVICE _IO(VCHIQ_IOC_MAGIC, 3) ++#define VCHIQ_IOC_QUEUE_MESSAGE \ ++ _IOW(VCHIQ_IOC_MAGIC, 4, VCHIQ_QUEUE_MESSAGE_T) ++#define VCHIQ_IOC_QUEUE_BULK_TRANSMIT \ ++ _IOWR(VCHIQ_IOC_MAGIC, 5, VCHIQ_QUEUE_BULK_TRANSFER_T) ++#define VCHIQ_IOC_QUEUE_BULK_RECEIVE \ ++ _IOWR(VCHIQ_IOC_MAGIC, 6, VCHIQ_QUEUE_BULK_TRANSFER_T) ++#define VCHIQ_IOC_AWAIT_COMPLETION \ ++ _IOWR(VCHIQ_IOC_MAGIC, 7, VCHIQ_AWAIT_COMPLETION_T) ++#define VCHIQ_IOC_DEQUEUE_MESSAGE \ ++ _IOWR(VCHIQ_IOC_MAGIC, 8, VCHIQ_DEQUEUE_MESSAGE_T) ++#define VCHIQ_IOC_GET_CLIENT_ID _IO(VCHIQ_IOC_MAGIC, 9) ++#define VCHIQ_IOC_GET_CONFIG \ ++ _IOWR(VCHIQ_IOC_MAGIC, 10, VCHIQ_GET_CONFIG_T) ++#define VCHIQ_IOC_CLOSE_SERVICE _IO(VCHIQ_IOC_MAGIC, 11) ++#define VCHIQ_IOC_USE_SERVICE _IO(VCHIQ_IOC_MAGIC, 12) ++#define VCHIQ_IOC_RELEASE_SERVICE _IO(VCHIQ_IOC_MAGIC, 13) ++#define VCHIQ_IOC_SET_SERVICE_OPTION \ ++ _IOW(VCHIQ_IOC_MAGIC, 14, VCHIQ_SET_SERVICE_OPTION_T) ++#define VCHIQ_IOC_DUMP_PHYS_MEM \ ++ _IOW(VCHIQ_IOC_MAGIC, 15, VCHIQ_DUMP_MEM_T) ++#define VCHIQ_IOC_LIB_VERSION _IO(VCHIQ_IOC_MAGIC, 16) ++#define VCHIQ_IOC_CLOSE_DELIVERED _IO(VCHIQ_IOC_MAGIC, 17) ++#define VCHIQ_IOC_MAX 17 ++ ++#endif +diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_kern_lib.c b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_kern_lib.c +new file mode 100644 +index 0000000..25e7011 +--- /dev/null ++++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_kern_lib.c +@@ -0,0 +1,458 @@ ++/** ++ * Copyright (c) 2010-2012 Broadcom. 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, ++ * without modification. ++ * 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. ++ * 3. The names of the above-listed copyright holders may not be used ++ * to endorse or promote products derived from this software without ++ * specific prior written permission. ++ * ++ * ALTERNATIVELY, this software may be distributed under the terms of the ++ * GNU General Public License ("GPL") version 2, as published by the Free ++ * Software Foundation. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER OR ++ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ++ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, ++ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR ++ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF ++ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING ++ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ */ ++ ++/* ---- Include Files ---------------------------------------------------- */ ++ ++#include <linux/kernel.h> ++#include <linux/module.h> ++#include <linux/mutex.h> ++ ++#include "vchiq_core.h" ++#include "vchiq_arm.h" ++#include "vchiq_killable.h" ++ ++/* ---- Public Variables ------------------------------------------------- */ ++ ++/* ---- Private Constants and Types -------------------------------------- */ ++ ++struct bulk_waiter_node { ++ struct bulk_waiter bulk_waiter; ++ int pid; ++ struct list_head list; ++}; ++ ++struct vchiq_instance_struct { ++ VCHIQ_STATE_T *state; ++ ++ int connected; ++ ++ struct list_head bulk_waiter_list; ++ struct mutex bulk_waiter_list_mutex; ++}; ++ ++static VCHIQ_STATUS_T ++vchiq_blocking_bulk_transfer(VCHIQ_SERVICE_HANDLE_T handle, void *data, ++ unsigned int size, VCHIQ_BULK_DIR_T dir); ++ ++/**************************************************************************** ++* ++* vchiq_initialise ++* ++***************************************************************************/ ++#define VCHIQ_INIT_RETRIES 10 ++VCHIQ_STATUS_T vchiq_initialise(VCHIQ_INSTANCE_T *instanceOut) ++{ ++ VCHIQ_STATUS_T status = VCHIQ_ERROR; ++ VCHIQ_STATE_T *state; ++ VCHIQ_INSTANCE_T instance = NULL; ++ int i; ++ ++ vchiq_log_trace(vchiq_core_log_level, "%s called", __func__); ++ ++ /* VideoCore may not be ready due to boot up timing. ++ It may never be ready if kernel and firmware are mismatched, so don't block forever. */ ++ for (i=0; i<VCHIQ_INIT_RETRIES; i++) { ++ state = vchiq_get_state(); ++ if (state) ++ break; ++ udelay(500); ++ } ++ if (i==VCHIQ_INIT_RETRIES) { ++ vchiq_log_error(vchiq_core_log_level, ++ "%s: videocore not initialized\n", __func__); ++ goto failed; ++ } else if (i>0) { ++ vchiq_log_warning(vchiq_core_log_level, ++ "%s: videocore initialized after %d retries\n", __func__, i); ++ } ++ ++ instance = kzalloc(sizeof(*instance), GFP_KERNEL); ++ if (!instance) { ++ vchiq_log_error(vchiq_core_log_level, ++ "%s: error allocating vchiq instance\n", __func__); ++ goto failed; ++ } ++ ++ instance->connected = 0; ++ instance->state = state; ++ mutex_init(&instance->bulk_waiter_list_mutex); ++ INIT_LIST_HEAD(&instance->bulk_waiter_list); ++ ++ *instanceOut = instance; ++ ++ status = VCHIQ_SUCCESS; ++ ++failed: ++ vchiq_log_trace(vchiq_core_log_level, ++ "%s(%p): returning %d", __func__, instance, status); ++ ++ return status; ++} ++EXPORT_SYMBOL(vchiq_initialise); ++ ++/**************************************************************************** ++* ++* vchiq_shutdown ++* ++***************************************************************************/ ++ ++VCHIQ_STATUS_T vchiq_shutdown(VCHIQ_INSTANCE_T instance) ++{ ++ VCHIQ_STATUS_T status; ++ VCHIQ_STATE_T *state = instance->state; ++ ++ vchiq_log_trace(vchiq_core_log_level, ++ "%s(%p) called", __func__, instance); ++ ++ if (mutex_lock_interruptible(&state->mutex) != 0) ++ return VCHIQ_RETRY; ++ ++ /* Remove all services */ ++ status = vchiq_shutdown_internal(state, instance); ++ ++ mutex_unlock(&state->mutex); ++ ++ vchiq_log_trace(vchiq_core_log_level, ++ "%s(%p): returning %d", __func__, instance, status); ++ ++ if (status == VCHIQ_SUCCESS) { ++ struct list_head *pos, *next; ++ list_for_each_safe(pos, next, ++ &instance->bulk_waiter_list) { ++ struct bulk_waiter_node *waiter; ++ waiter = list_entry(pos, ++ struct bulk_waiter_node, ++ list); ++ list_del(pos); ++ vchiq_log_info(vchiq_arm_log_level, ++ "bulk_waiter - cleaned up %x " ++ "for pid %d", ++ (unsigned int)waiter, waiter->pid); ++ kfree(waiter); ++ } ++ kfree(instance); ++ } ++ ++ return status; ++} ++EXPORT_SYMBOL(vchiq_shutdown); ++ ++/**************************************************************************** ++* ++* vchiq_is_connected ++* ++***************************************************************************/ ++ ++int vchiq_is_connected(VCHIQ_INSTANCE_T instance) ++{ ++ return instance->connected; ++} ++ ++/**************************************************************************** ++* ++* vchiq_connect ++* ++***************************************************************************/ ++ ++VCHIQ_STATUS_T vchiq_connect(VCHIQ_INSTANCE_T instance) ++{ ++ VCHIQ_STATUS_T status; ++ VCHIQ_STATE_T *state = instance->state; ++ ++ vchiq_log_trace(vchiq_core_log_level, ++ "%s(%p) called", __func__, instance); ++ ++ if (mutex_lock_interruptible(&state->mutex) != 0) { ++ vchiq_log_trace(vchiq_core_log_level, ++ "%s: call to mutex_lock failed", __func__); ++ status = VCHIQ_RETRY; ++ goto failed; ++ } ++ status = vchiq_connect_internal(state, instance); ++ ++ if (status == VCHIQ_SUCCESS) ++ instance->connected = 1; ++ ++ mutex_unlock(&state->mutex); ++ ++failed: ++ vchiq_log_trace(vchiq_core_log_level, ++ "%s(%p): returning %d", __func__, instance, status); ++ ++ return status; ++} ++EXPORT_SYMBOL(vchiq_connect); ++ ++/**************************************************************************** ++* ++* vchiq_add_service ++* ++***************************************************************************/ ++ ++VCHIQ_STATUS_T vchiq_add_service( ++ VCHIQ_INSTANCE_T instance, ++ const VCHIQ_SERVICE_PARAMS_T *params, ++ VCHIQ_SERVICE_HANDLE_T *phandle) ++{ ++ VCHIQ_STATUS_T status; ++ VCHIQ_STATE_T *state = instance->state; ++ VCHIQ_SERVICE_T *service = NULL; ++ int srvstate; ++ ++ vchiq_log_trace(vchiq_core_log_level, ++ "%s(%p) called", __func__, instance); ++ ++ *phandle = VCHIQ_SERVICE_HANDLE_INVALID; ++ ++ srvstate = vchiq_is_connected(instance) ++ ? VCHIQ_SRVSTATE_LISTENING ++ : VCHIQ_SRVSTATE_HIDDEN; ++ ++ service = vchiq_add_service_internal( ++ state, ++ params, ++ srvstate, ++ instance, ++ NULL); ++ ++ if (service) { ++ *phandle = service->handle; ++ status = VCHIQ_SUCCESS; ++ } else ++ status = VCHIQ_ERROR; ++ ++ vchiq_log_trace(vchiq_core_log_level, ++ "%s(%p): returning %d", __func__, instance, status); ++ ++ return status; ++} ++EXPORT_SYMBOL(vchiq_add_service); ++ ++/**************************************************************************** ++* ++* vchiq_open_service ++* ++***************************************************************************/ ++ ++VCHIQ_STATUS_T vchiq_open_service( ++ VCHIQ_INSTANCE_T instance, ++ const VCHIQ_SERVICE_PARAMS_T *params, ++ VCHIQ_SERVICE_HANDLE_T *phandle) ++{ ++ VCHIQ_STATUS_T status = VCHIQ_ERROR; ++ VCHIQ_STATE_T *state = instance->state; ++ VCHIQ_SERVICE_T *service = NULL; ++ ++ vchiq_log_trace(vchiq_core_log_level, ++ "%s(%p) called", __func__, instance); ++ ++ *phandle = VCHIQ_SERVICE_HANDLE_INVALID; ++ ++ if (!vchiq_is_connected(instance)) ++ goto failed; ++ ++ service = vchiq_add_service_internal(state, ++ params, ++ VCHIQ_SRVSTATE_OPENING, ++ instance, ++ NULL); ++ ++ if (service) { ++ *phandle = service->handle; ++ status = vchiq_open_service_internal(service, current->pid); ++ if (status != VCHIQ_SUCCESS) { ++ vchiq_remove_service(service->handle); ++ *phandle = VCHIQ_SERVICE_HANDLE_INVALID; ++ } ++ } ++ ++failed: ++ vchiq_log_trace(vchiq_core_log_level, ++ "%s(%p): returning %d", __func__, instance, status); ++ ++ return status; ++} ++EXPORT_SYMBOL(vchiq_open_service); ++ ++VCHIQ_STATUS_T ++vchiq_queue_bulk_transmit(VCHIQ_SERVICE_HANDLE_T handle, ++ const void *data, unsigned int size, void *userdata) ++{ ++ return vchiq_bulk_transfer(handle, ++ VCHI_MEM_HANDLE_INVALID, (void *)data, size, userdata, ++ VCHIQ_BULK_MODE_CALLBACK, VCHIQ_BULK_TRANSMIT); ++} ++EXPORT_SYMBOL(vchiq_queue_bulk_transmit); ++ ++VCHIQ_STATUS_T ++vchiq_queue_bulk_receive(VCHIQ_SERVICE_HANDLE_T handle, void *data, ++ unsigned int size, void *userdata) ++{ ++ return vchiq_bulk_transfer(handle, ++ VCHI_MEM_HANDLE_INVALID, data, size, userdata, ++ VCHIQ_BULK_MODE_CALLBACK, VCHIQ_BULK_RECEIVE); ++} ++EXPORT_SYMBOL(vchiq_queue_bulk_receive); ++ ++VCHIQ_STATUS_T ++vchiq_bulk_transmit(VCHIQ_SERVICE_HANDLE_T handle, const void *data, ++ unsigned int size, void *userdata, VCHIQ_BULK_MODE_T mode) ++{ ++ VCHIQ_STATUS_T status; ++ ++ switch (mode) { ++ case VCHIQ_BULK_MODE_NOCALLBACK: ++ case VCHIQ_BULK_MODE_CALLBACK: ++ status = vchiq_bulk_transfer(handle, ++ VCHI_MEM_HANDLE_INVALID, (void *)data, size, userdata, ++ mode, VCHIQ_BULK_TRANSMIT); ++ break; ++ case VCHIQ_BULK_MODE_BLOCKING: ++ status = vchiq_blocking_bulk_transfer(handle, ++ (void *)data, size, VCHIQ_BULK_TRANSMIT); ++ break; ++ default: ++ return VCHIQ_ERROR; ++ } ++ ++ return status; ++} ++EXPORT_SYMBOL(vchiq_bulk_transmit); ++ ++VCHIQ_STATUS_T ++vchiq_bulk_receive(VCHIQ_SERVICE_HANDLE_T handle, void *data, ++ unsigned int size, void *userdata, VCHIQ_BULK_MODE_T mode) ++{ ++ VCHIQ_STATUS_T status; ++ ++ switch (mode) { ++ case VCHIQ_BULK_MODE_NOCALLBACK: ++ case VCHIQ_BULK_MODE_CALLBACK: ++ status = vchiq_bulk_transfer(handle, ++ VCHI_MEM_HANDLE_INVALID, data, size, userdata, ++ mode, VCHIQ_BULK_RECEIVE); ++ break; ++ case VCHIQ_BULK_MODE_BLOCKING: ++ status = vchiq_blocking_bulk_transfer(handle, ++ (void *)data, size, VCHIQ_BULK_RECEIVE); ++ break; ++ default: ++ return VCHIQ_ERROR; ++ } ++ ++ return status; ++} ++EXPORT_SYMBOL(vchiq_bulk_receive); ++ ++static VCHIQ_STATUS_T ++vchiq_blocking_bulk_transfer(VCHIQ_SERVICE_HANDLE_T handle, void *data, ++ unsigned int size, VCHIQ_BULK_DIR_T dir) ++{ ++ VCHIQ_INSTANCE_T instance; ++ VCHIQ_SERVICE_T *service; ++ VCHIQ_STATUS_T status; ++ struct bulk_waiter_node *waiter = NULL; ++ struct list_head *pos; ++ ++ service = find_service_by_handle(handle); ++ if (!service) ++ return VCHIQ_ERROR; ++ ++ instance = service->instance; ++ ++ unlock_service(service); ++ ++ mutex_lock(&instance->bulk_waiter_list_mutex); ++ list_for_each(pos, &instance->bulk_waiter_list) { ++ if (list_entry(pos, struct bulk_waiter_node, ++ list)->pid == current->pid) { ++ waiter = list_entry(pos, ++ struct bulk_waiter_node, ++ list); ++ list_del(pos); ++ break; ++ } ++ } ++ mutex_unlock(&instance->bulk_waiter_list_mutex); ++ ++ if (waiter) { ++ VCHIQ_BULK_T *bulk = waiter->bulk_waiter.bulk; ++ if (bulk) { ++ /* This thread has an outstanding bulk transfer. */ ++ if ((bulk->data != data) || ++ (bulk->size != size)) { ++ /* This is not a retry of the previous one. ++ ** Cancel the signal when the transfer ++ ** completes. */ ++ spin_lock(&bulk_waiter_spinlock); ++ bulk->userdata = NULL; ++ spin_unlock(&bulk_waiter_spinlock); ++ } ++ } ++ } ++ ++ if (!waiter) { ++ waiter = kzalloc(sizeof(struct bulk_waiter_node), GFP_KERNEL); ++ if (!waiter) { ++ vchiq_log_error(vchiq_core_log_level, ++ "%s - out of memory", __func__); ++ return VCHIQ_ERROR; ++ } ++ } ++ ++ status = vchiq_bulk_transfer(handle, VCHI_MEM_HANDLE_INVALID, ++ data, size, &waiter->bulk_waiter, VCHIQ_BULK_MODE_BLOCKING, ++ dir); ++ if ((status != VCHIQ_RETRY) || fatal_signal_pending(current) || ++ !waiter->bulk_waiter.bulk) { ++ VCHIQ_BULK_T *bulk = waiter->bulk_waiter.bulk; ++ if (bulk) { ++ /* Cancel the signal when the transfer ++ ** completes. */ ++ spin_lock(&bulk_waiter_spinlock); ++ bulk->userdata = NULL; ++ spin_unlock(&bulk_waiter_spinlock); ++ } ++ kfree(waiter); ++ } else { ++ waiter->pid = current->pid; ++ mutex_lock(&instance->bulk_waiter_list_mutex); ++ list_add(&waiter->list, &instance->bulk_waiter_list); ++ mutex_unlock(&instance->bulk_waiter_list_mutex); ++ vchiq_log_info(vchiq_arm_log_level, ++ "saved bulk_waiter %x for pid %d", ++ (unsigned int)waiter, current->pid); ++ } ++ ++ return status; ++} +diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_killable.h b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_killable.h +new file mode 100644 +index 0000000..335446e +--- /dev/null ++++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_killable.h +@@ -0,0 +1,69 @@ ++/** ++ * Copyright (c) 2010-2012 Broadcom. 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, ++ * without modification. ++ * 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. ++ * 3. The names of the above-listed copyright holders may not be used ++ * to endorse or promote products derived from this software without ++ * specific prior written permission. ++ * ++ * ALTERNATIVELY, this software may be distributed under the terms of the ++ * GNU General Public License ("GPL") version 2, as published by the Free ++ * Software Foundation. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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. ++ */ ++ ++#ifndef VCHIQ_KILLABLE_H ++#define VCHIQ_KILLABLE_H ++ ++#include <linux/mutex.h> ++#include <linux/semaphore.h> ++ ++#define SHUTDOWN_SIGS (sigmask(SIGKILL) | sigmask(SIGINT) | sigmask(SIGQUIT) | sigmask(SIGTRAP) | sigmask(SIGSTOP) | sigmask(SIGCONT)) ++ ++static inline int __must_check down_interruptible_killable(struct semaphore *sem) ++{ ++ /* Allow interception of killable signals only. We don't want to be interrupted by harmless signals like SIGALRM */ ++ int ret; ++ sigset_t blocked, oldset; ++ siginitsetinv(&blocked, SHUTDOWN_SIGS); ++ sigprocmask(SIG_SETMASK, &blocked, &oldset); ++ ret = down_interruptible(sem); ++ sigprocmask(SIG_SETMASK, &oldset, NULL); ++ return ret; ++} ++#define down_interruptible down_interruptible_killable ++ ++ ++static inline int __must_check mutex_lock_interruptible_killable(struct mutex *lock) ++{ ++ /* Allow interception of killable signals only. We don't want to be interrupted by harmless signals like SIGALRM */ ++ int ret; ++ sigset_t blocked, oldset; ++ siginitsetinv(&blocked, SHUTDOWN_SIGS); ++ sigprocmask(SIG_SETMASK, &blocked, &oldset); ++ ret = mutex_lock_interruptible(lock); ++ sigprocmask(SIG_SETMASK, &oldset, NULL); ++ return ret; ++} ++#define mutex_lock_interruptible mutex_lock_interruptible_killable ++ ++#endif +diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_memdrv.h b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_memdrv.h +new file mode 100644 +index 0000000..d02e776 +--- /dev/null ++++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_memdrv.h +@@ -0,0 +1,71 @@ ++/** ++ * Copyright (c) 2010-2012 Broadcom. 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, ++ * without modification. ++ * 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. ++ * 3. The names of the above-listed copyright holders may not be used ++ * to endorse or promote products derived from this software without ++ * specific prior written permission. ++ * ++ * ALTERNATIVELY, this software may be distributed under the terms of the ++ * GNU General Public License ("GPL") version 2, as published by the Free ++ * Software Foundation. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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. ++ */ ++ ++#ifndef VCHIQ_MEMDRV_H ++#define VCHIQ_MEMDRV_H ++ ++/* ---- Include Files ----------------------------------------------------- */ ++ ++#include <linux/kernel.h> ++#include "vchiq_if.h" ++ ++/* ---- Constants and Types ---------------------------------------------- */ ++ ++typedef struct { ++ void *armSharedMemVirt; ++ dma_addr_t armSharedMemPhys; ++ size_t armSharedMemSize; ++ ++ void *vcSharedMemVirt; ++ dma_addr_t vcSharedMemPhys; ++ size_t vcSharedMemSize; ++} VCHIQ_SHARED_MEM_INFO_T; ++ ++/* ---- Variable Externs ------------------------------------------------- */ ++ ++/* ---- Function Prototypes ---------------------------------------------- */ ++ ++void vchiq_get_shared_mem_info(VCHIQ_SHARED_MEM_INFO_T *info); ++ ++VCHIQ_STATUS_T vchiq_memdrv_initialise(void); ++ ++VCHIQ_STATUS_T vchiq_userdrv_create_instance( ++ const VCHIQ_PLATFORM_DATA_T * platform_data); ++ ++VCHIQ_STATUS_T vchiq_userdrv_suspend( ++ const VCHIQ_PLATFORM_DATA_T * platform_data); ++ ++VCHIQ_STATUS_T vchiq_userdrv_resume( ++ const VCHIQ_PLATFORM_DATA_T * platform_data); ++ ++#endif +diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_pagelist.h b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_pagelist.h +new file mode 100644 +index 0000000..54a3ece +--- /dev/null ++++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_pagelist.h +@@ -0,0 +1,58 @@ ++/** ++ * Copyright (c) 2010-2012 Broadcom. 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, ++ * without modification. ++ * 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. ++ * 3. The names of the above-listed copyright holders may not be used ++ * to endorse or promote products derived from this software without ++ * specific prior written permission. ++ * ++ * ALTERNATIVELY, this software may be distributed under the terms of the ++ * GNU General Public License ("GPL") version 2, as published by the Free ++ * Software Foundation. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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. ++ */ ++ ++#ifndef VCHIQ_PAGELIST_H ++#define VCHIQ_PAGELIST_H ++ ++#ifndef PAGE_SIZE ++#define PAGE_SIZE 4096 ++#endif ++#define CACHE_LINE_SIZE 32 ++#define PAGELIST_WRITE 0 ++#define PAGELIST_READ 1 ++#define PAGELIST_READ_WITH_FRAGMENTS 2 ++ ++typedef struct pagelist_struct { ++ unsigned long length; ++ unsigned short type; ++ unsigned short offset; ++ unsigned long addrs[1]; /* N.B. 12 LSBs hold the number of following ++ pages at consecutive addresses. */ ++} PAGELIST_T; ++ ++typedef struct fragments_struct { ++ char headbuf[CACHE_LINE_SIZE]; ++ char tailbuf[CACHE_LINE_SIZE]; ++} FRAGMENTS_T; ++ ++#endif /* VCHIQ_PAGELIST_H */ +diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_shim.c b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_shim.c +new file mode 100644 +index 0000000..8072ff6 +--- /dev/null ++++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_shim.c +@@ -0,0 +1,860 @@ ++/** ++ * Copyright (c) 2010-2012 Broadcom. 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, ++ * without modification. ++ * 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. ++ * 3. The names of the above-listed copyright holders may not be used ++ * to endorse or promote products derived from this software without ++ * specific prior written permission. ++ * ++ * ALTERNATIVELY, this software may be distributed under the terms of the ++ * GNU General Public License ("GPL") version 2, as published by the Free ++ * Software Foundation. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER OR ++ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ++ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, ++ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR ++ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF ++ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING ++ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ */ ++#include <linux/module.h> ++#include <linux/types.h> ++ ++#include "interface/vchi/vchi.h" ++#include "vchiq.h" ++#include "vchiq_core.h" ++ ++#include "vchiq_util.h" ++ ++#include <stddef.h> ++ ++#define vchiq_status_to_vchi(status) ((int32_t)status) ++ ++typedef struct { ++ VCHIQ_SERVICE_HANDLE_T handle; ++ ++ VCHIU_QUEUE_T queue; ++ ++ VCHI_CALLBACK_T callback; ++ void *callback_param; ++} SHIM_SERVICE_T; ++ ++/* ---------------------------------------------------------------------- ++ * return pointer to the mphi message driver function table ++ * -------------------------------------------------------------------- */ ++const VCHI_MESSAGE_DRIVER_T * ++vchi_mphi_message_driver_func_table(void) ++{ ++ return NULL; ++} ++ ++/* ---------------------------------------------------------------------- ++ * return a pointer to the 'single' connection driver fops ++ * -------------------------------------------------------------------- */ ++const VCHI_CONNECTION_API_T * ++single_get_func_table(void) ++{ ++ return NULL; ++} ++ ++VCHI_CONNECTION_T *vchi_create_connection( ++ const VCHI_CONNECTION_API_T *function_table, ++ const VCHI_MESSAGE_DRIVER_T *low_level) ++{ ++ (void)function_table; ++ (void)low_level; ++ return NULL; ++} ++ ++/*********************************************************** ++ * Name: vchi_msg_peek ++ * ++ * Arguments: const VCHI_SERVICE_HANDLE_T handle, ++ * void **data, ++ * uint32_t *msg_size, ++ ++ ++ * VCHI_FLAGS_T flags ++ * ++ * Description: Routine to return a pointer to the current message (to allow in ++ * place processing). The message can be removed using ++ * vchi_msg_remove when you're finished ++ * ++ * Returns: int32_t - success == 0 ++ * ++ ***********************************************************/ ++int32_t vchi_msg_peek(VCHI_SERVICE_HANDLE_T handle, ++ void **data, ++ uint32_t *msg_size, ++ VCHI_FLAGS_T flags) ++{ ++ SHIM_SERVICE_T *service = (SHIM_SERVICE_T *)handle; ++ VCHIQ_HEADER_T *header; ++ ++ WARN_ON((flags != VCHI_FLAGS_NONE) && ++ (flags != VCHI_FLAGS_BLOCK_UNTIL_OP_COMPLETE)); ++ ++ if (flags == VCHI_FLAGS_NONE) ++ if (vchiu_queue_is_empty(&service->queue)) ++ return -1; ++ ++ header = vchiu_queue_peek(&service->queue); ++ ++ *data = header->data; ++ *msg_size = header->size; ++ ++ return 0; ++} ++EXPORT_SYMBOL(vchi_msg_peek); ++ ++/*********************************************************** ++ * Name: vchi_msg_remove ++ * ++ * Arguments: const VCHI_SERVICE_HANDLE_T handle, ++ * ++ * Description: Routine to remove a message (after it has been read with ++ * vchi_msg_peek) ++ * ++ * Returns: int32_t - success == 0 ++ * ++ ***********************************************************/ ++int32_t vchi_msg_remove(VCHI_SERVICE_HANDLE_T handle) ++{ ++ SHIM_SERVICE_T *service = (SHIM_SERVICE_T *)handle; ++ VCHIQ_HEADER_T *header; ++ ++ header = vchiu_queue_pop(&service->queue); ++ ++ vchiq_release_message(service->handle, header); ++ ++ return 0; ++} ++EXPORT_SYMBOL(vchi_msg_remove); ++ ++/*********************************************************** ++ * Name: vchi_msg_queue ++ * ++ * Arguments: VCHI_SERVICE_HANDLE_T handle, ++ * const void *data, ++ * uint32_t data_size, ++ * VCHI_FLAGS_T flags, ++ * void *msg_handle, ++ * ++ * Description: Thin wrapper to queue a message onto a connection ++ * ++ * Returns: int32_t - success == 0 ++ * ++ ***********************************************************/ ++int32_t vchi_msg_queue(VCHI_SERVICE_HANDLE_T handle, ++ const void *data, ++ uint32_t data_size, ++ VCHI_FLAGS_T flags, ++ void *msg_handle) ++{ ++ SHIM_SERVICE_T *service = (SHIM_SERVICE_T *)handle; ++ VCHIQ_ELEMENT_T element = {data, data_size}; ++ VCHIQ_STATUS_T status; ++ ++ (void)msg_handle; ++ ++ WARN_ON(flags != VCHI_FLAGS_BLOCK_UNTIL_QUEUED); ++ ++ status = vchiq_queue_message(service->handle, &element, 1); ++ ++ /* vchiq_queue_message() may return VCHIQ_RETRY, so we need to ++ ** implement a retry mechanism since this function is supposed ++ ** to block until queued ++ */ ++ while (status == VCHIQ_RETRY) { ++ msleep(1); ++ status = vchiq_queue_message(service->handle, &element, 1); ++ } ++ ++ return vchiq_status_to_vchi(status); ++} ++EXPORT_SYMBOL(vchi_msg_queue); ++ ++/*********************************************************** ++ * Name: vchi_bulk_queue_receive ++ * ++ * Arguments: VCHI_BULK_HANDLE_T handle, ++ * void *data_dst, ++ * const uint32_t data_size, ++ * VCHI_FLAGS_T flags ++ * void *bulk_handle ++ * ++ * Description: Routine to setup a rcv buffer ++ * ++ * Returns: int32_t - success == 0 ++ * ++ ***********************************************************/ ++int32_t vchi_bulk_queue_receive(VCHI_SERVICE_HANDLE_T handle, ++ void *data_dst, ++ uint32_t data_size, ++ VCHI_FLAGS_T flags, ++ void *bulk_handle) ++{ ++ SHIM_SERVICE_T *service = (SHIM_SERVICE_T *)handle; ++ VCHIQ_BULK_MODE_T mode; ++ VCHIQ_STATUS_T status; ++ ++ switch ((int)flags) { ++ case VCHI_FLAGS_CALLBACK_WHEN_OP_COMPLETE ++ | VCHI_FLAGS_BLOCK_UNTIL_QUEUED: ++ WARN_ON(!service->callback); ++ mode = VCHIQ_BULK_MODE_CALLBACK; ++ break; ++ case VCHI_FLAGS_BLOCK_UNTIL_OP_COMPLETE: ++ mode = VCHIQ_BULK_MODE_BLOCKING; ++ break; ++ case VCHI_FLAGS_BLOCK_UNTIL_QUEUED: ++ case VCHI_FLAGS_NONE: ++ mode = VCHIQ_BULK_MODE_NOCALLBACK; ++ break; ++ default: ++ WARN(1, "unsupported message\n"); ++ return vchiq_status_to_vchi(VCHIQ_ERROR); ++ } ++ ++ status = vchiq_bulk_receive(service->handle, data_dst, data_size, ++ bulk_handle, mode); ++ ++ /* vchiq_bulk_receive() may return VCHIQ_RETRY, so we need to ++ ** implement a retry mechanism since this function is supposed ++ ** to block until queued ++ */ ++ while (status == VCHIQ_RETRY) { ++ msleep(1); ++ status = vchiq_bulk_receive(service->handle, data_dst, ++ data_size, bulk_handle, mode); ++ } ++ ++ return vchiq_status_to_vchi(status); ++} ++EXPORT_SYMBOL(vchi_bulk_queue_receive); ++ ++/*********************************************************** ++ * Name: vchi_bulk_queue_transmit ++ * ++ * Arguments: VCHI_BULK_HANDLE_T handle, ++ * const void *data_src, ++ * uint32_t data_size, ++ * VCHI_FLAGS_T flags, ++ * void *bulk_handle ++ * ++ * Description: Routine to transmit some data ++ * ++ * Returns: int32_t - success == 0 ++ * ++ ***********************************************************/ ++int32_t vchi_bulk_queue_transmit(VCHI_SERVICE_HANDLE_T handle, ++ const void *data_src, ++ uint32_t data_size, ++ VCHI_FLAGS_T flags, ++ void *bulk_handle) ++{ ++ SHIM_SERVICE_T *service = (SHIM_SERVICE_T *)handle; ++ VCHIQ_BULK_MODE_T mode; ++ VCHIQ_STATUS_T status; ++ ++ switch ((int)flags) { ++ case VCHI_FLAGS_CALLBACK_WHEN_OP_COMPLETE ++ | VCHI_FLAGS_BLOCK_UNTIL_QUEUED: ++ WARN_ON(!service->callback); ++ mode = VCHIQ_BULK_MODE_CALLBACK; ++ break; ++ case VCHI_FLAGS_BLOCK_UNTIL_DATA_READ: ++ case VCHI_FLAGS_BLOCK_UNTIL_OP_COMPLETE: ++ mode = VCHIQ_BULK_MODE_BLOCKING; ++ break; ++ case VCHI_FLAGS_BLOCK_UNTIL_QUEUED: ++ case VCHI_FLAGS_NONE: ++ mode = VCHIQ_BULK_MODE_NOCALLBACK; ++ break; ++ default: ++ WARN(1, "unsupported message\n"); ++ return vchiq_status_to_vchi(VCHIQ_ERROR); ++ } ++ ++ status = vchiq_bulk_transmit(service->handle, data_src, data_size, ++ bulk_handle, mode); ++ ++ /* vchiq_bulk_transmit() may return VCHIQ_RETRY, so we need to ++ ** implement a retry mechanism since this function is supposed ++ ** to block until queued ++ */ ++ while (status == VCHIQ_RETRY) { ++ msleep(1); ++ status = vchiq_bulk_transmit(service->handle, data_src, ++ data_size, bulk_handle, mode); ++ } ++ ++ return vchiq_status_to_vchi(status); ++} ++EXPORT_SYMBOL(vchi_bulk_queue_transmit); ++ ++/*********************************************************** ++ * Name: vchi_msg_dequeue ++ * ++ * Arguments: VCHI_SERVICE_HANDLE_T handle, ++ * void *data, ++ * uint32_t max_data_size_to_read, ++ * uint32_t *actual_msg_size ++ * VCHI_FLAGS_T flags ++ * ++ * Description: Routine to dequeue a message into the supplied buffer ++ * ++ * Returns: int32_t - success == 0 ++ * ++ ***********************************************************/ ++int32_t vchi_msg_dequeue(VCHI_SERVICE_HANDLE_T handle, ++ void *data, ++ uint32_t max_data_size_to_read, ++ uint32_t *actual_msg_size, ++ VCHI_FLAGS_T flags) ++{ ++ SHIM_SERVICE_T *service = (SHIM_SERVICE_T *)handle; ++ VCHIQ_HEADER_T *header; ++ ++ WARN_ON((flags != VCHI_FLAGS_NONE) && ++ (flags != VCHI_FLAGS_BLOCK_UNTIL_OP_COMPLETE)); ++ ++ if (flags == VCHI_FLAGS_NONE) ++ if (vchiu_queue_is_empty(&service->queue)) ++ return -1; ++ ++ header = vchiu_queue_pop(&service->queue); ++ ++ memcpy(data, header->data, header->size < max_data_size_to_read ? ++ header->size : max_data_size_to_read); ++ ++ *actual_msg_size = header->size; ++ ++ vchiq_release_message(service->handle, header); ++ ++ return 0; ++} ++EXPORT_SYMBOL(vchi_msg_dequeue); ++ ++/*********************************************************** ++ * Name: vchi_msg_queuev ++ * ++ * Arguments: VCHI_SERVICE_HANDLE_T handle, ++ * VCHI_MSG_VECTOR_T *vector, ++ * uint32_t count, ++ * VCHI_FLAGS_T flags, ++ * void *msg_handle ++ * ++ * Description: Thin wrapper to queue a message onto a connection ++ * ++ * Returns: int32_t - success == 0 ++ * ++ ***********************************************************/ ++ ++vchiq_static_assert(sizeof(VCHI_MSG_VECTOR_T) == sizeof(VCHIQ_ELEMENT_T)); ++vchiq_static_assert(offsetof(VCHI_MSG_VECTOR_T, vec_base) == ++ offsetof(VCHIQ_ELEMENT_T, data)); ++vchiq_static_assert(offsetof(VCHI_MSG_VECTOR_T, vec_len) == ++ offsetof(VCHIQ_ELEMENT_T, size)); ++ ++int32_t vchi_msg_queuev(VCHI_SERVICE_HANDLE_T handle, ++ VCHI_MSG_VECTOR_T *vector, ++ uint32_t count, ++ VCHI_FLAGS_T flags, ++ void *msg_handle) ++{ ++ SHIM_SERVICE_T *service = (SHIM_SERVICE_T *)handle; ++ ++ (void)msg_handle; ++ ++ WARN_ON(flags != VCHI_FLAGS_BLOCK_UNTIL_QUEUED); ++ ++ return vchiq_status_to_vchi(vchiq_queue_message(service->handle, ++ (const VCHIQ_ELEMENT_T *)vector, count)); ++} ++EXPORT_SYMBOL(vchi_msg_queuev); ++ ++/*********************************************************** ++ * Name: vchi_held_msg_release ++ * ++ * Arguments: VCHI_HELD_MSG_T *message ++ * ++ * Description: Routine to release a held message (after it has been read with ++ * vchi_msg_hold) ++ * ++ * Returns: int32_t - success == 0 ++ * ++ ***********************************************************/ ++int32_t vchi_held_msg_release(VCHI_HELD_MSG_T *message) ++{ ++ vchiq_release_message((VCHIQ_SERVICE_HANDLE_T)message->service, ++ (VCHIQ_HEADER_T *)message->message); ++ ++ return 0; ++} ++EXPORT_SYMBOL(vchi_held_msg_release); ++ ++/*********************************************************** ++ * Name: vchi_msg_hold ++ * ++ * Arguments: VCHI_SERVICE_HANDLE_T handle, ++ * void **data, ++ * uint32_t *msg_size, ++ * VCHI_FLAGS_T flags, ++ * VCHI_HELD_MSG_T *message_handle ++ * ++ * Description: Routine to return a pointer to the current message (to allow ++ * in place processing). The message is dequeued - don't forget ++ * to release the message using vchi_held_msg_release when you're ++ * finished. ++ * ++ * Returns: int32_t - success == 0 ++ * ++ ***********************************************************/ ++int32_t vchi_msg_hold(VCHI_SERVICE_HANDLE_T handle, ++ void **data, ++ uint32_t *msg_size, ++ VCHI_FLAGS_T flags, ++ VCHI_HELD_MSG_T *message_handle) ++{ ++ SHIM_SERVICE_T *service = (SHIM_SERVICE_T *)handle; ++ VCHIQ_HEADER_T *header; ++ ++ WARN_ON((flags != VCHI_FLAGS_NONE) && ++ (flags != VCHI_FLAGS_BLOCK_UNTIL_OP_COMPLETE)); ++ ++ if (flags == VCHI_FLAGS_NONE) ++ if (vchiu_queue_is_empty(&service->queue)) ++ return -1; ++ ++ header = vchiu_queue_pop(&service->queue); ++ ++ *data = header->data; ++ *msg_size = header->size; ++ ++ message_handle->service = ++ (struct opaque_vchi_service_t *)service->handle; ++ message_handle->message = header; ++ ++ return 0; ++} ++EXPORT_SYMBOL(vchi_msg_hold); ++ ++/*********************************************************** ++ * Name: vchi_initialise ++ * ++ * Arguments: VCHI_INSTANCE_T *instance_handle ++ * ++ * Description: Initialises the hardware but does not transmit anything ++ * When run as a Host App this will be called twice hence the need ++ * to malloc the state information ++ * ++ * Returns: 0 if successful, failure otherwise ++ * ++ ***********************************************************/ ++ ++int32_t vchi_initialise(VCHI_INSTANCE_T *instance_handle) ++{ ++ VCHIQ_INSTANCE_T instance; ++ VCHIQ_STATUS_T status; ++ ++ status = vchiq_initialise(&instance); ++ ++ *instance_handle = (VCHI_INSTANCE_T)instance; ++ ++ return vchiq_status_to_vchi(status); ++} ++EXPORT_SYMBOL(vchi_initialise); ++ ++/*********************************************************** ++ * Name: vchi_connect ++ * ++ * Arguments: VCHI_CONNECTION_T **connections ++ * const uint32_t num_connections ++ * VCHI_INSTANCE_T instance_handle) ++ * ++ * Description: Starts the command service on each connection, ++ * causing INIT messages to be pinged back and forth ++ * ++ * Returns: 0 if successful, failure otherwise ++ * ++ ***********************************************************/ ++int32_t vchi_connect(VCHI_CONNECTION_T **connections, ++ const uint32_t num_connections, ++ VCHI_INSTANCE_T instance_handle) ++{ ++ VCHIQ_INSTANCE_T instance = (VCHIQ_INSTANCE_T)instance_handle; ++ ++ (void)connections; ++ (void)num_connections; ++ ++ return vchiq_connect(instance); ++} ++EXPORT_SYMBOL(vchi_connect); ++ ++ ++/*********************************************************** ++ * Name: vchi_disconnect ++ * ++ * Arguments: VCHI_INSTANCE_T instance_handle ++ * ++ * Description: Stops the command service on each connection, ++ * causing DE-INIT messages to be pinged back and forth ++ * ++ * Returns: 0 if successful, failure otherwise ++ * ++ ***********************************************************/ ++int32_t vchi_disconnect(VCHI_INSTANCE_T instance_handle) ++{ ++ VCHIQ_INSTANCE_T instance = (VCHIQ_INSTANCE_T)instance_handle; ++ return vchiq_status_to_vchi(vchiq_shutdown(instance)); ++} ++EXPORT_SYMBOL(vchi_disconnect); ++ ++ ++/*********************************************************** ++ * Name: vchi_service_open ++ * Name: vchi_service_create ++ * ++ * Arguments: VCHI_INSTANCE_T *instance_handle ++ * SERVICE_CREATION_T *setup, ++ * VCHI_SERVICE_HANDLE_T *handle ++ * ++ * Description: Routine to open a service ++ * ++ * Returns: int32_t - success == 0 ++ * ++ ***********************************************************/ ++ ++static VCHIQ_STATUS_T shim_callback(VCHIQ_REASON_T reason, ++ VCHIQ_HEADER_T *header, VCHIQ_SERVICE_HANDLE_T handle, void *bulk_user) ++{ ++ SHIM_SERVICE_T *service = ++ (SHIM_SERVICE_T *)VCHIQ_GET_SERVICE_USERDATA(handle); ++ ++ if (!service->callback) ++ goto release; ++ ++ switch (reason) { ++ case VCHIQ_MESSAGE_AVAILABLE: ++ vchiu_queue_push(&service->queue, header); ++ ++ service->callback(service->callback_param, ++ VCHI_CALLBACK_MSG_AVAILABLE, NULL); ++ ++ goto done; ++ break; ++ ++ case VCHIQ_BULK_TRANSMIT_DONE: ++ service->callback(service->callback_param, ++ VCHI_CALLBACK_BULK_SENT, bulk_user); ++ break; ++ ++ case VCHIQ_BULK_RECEIVE_DONE: ++ service->callback(service->callback_param, ++ VCHI_CALLBACK_BULK_RECEIVED, bulk_user); ++ break; ++ ++ case VCHIQ_SERVICE_CLOSED: ++ service->callback(service->callback_param, ++ VCHI_CALLBACK_SERVICE_CLOSED, NULL); ++ break; ++ ++ case VCHIQ_SERVICE_OPENED: ++ /* No equivalent VCHI reason */ ++ break; ++ ++ case VCHIQ_BULK_TRANSMIT_ABORTED: ++ service->callback(service->callback_param, ++ VCHI_CALLBACK_BULK_TRANSMIT_ABORTED, ++ bulk_user); ++ break; ++ ++ case VCHIQ_BULK_RECEIVE_ABORTED: ++ service->callback(service->callback_param, ++ VCHI_CALLBACK_BULK_RECEIVE_ABORTED, ++ bulk_user); ++ break; ++ ++ default: ++ WARN(1, "not supported\n"); ++ break; ++ } ++ ++release: ++ vchiq_release_message(service->handle, header); ++done: ++ return VCHIQ_SUCCESS; ++} ++ ++static SHIM_SERVICE_T *service_alloc(VCHIQ_INSTANCE_T instance, ++ SERVICE_CREATION_T *setup) ++{ ++ SHIM_SERVICE_T *service = kzalloc(sizeof(SHIM_SERVICE_T), GFP_KERNEL); ++ ++ (void)instance; ++ ++ if (service) { ++ if (vchiu_queue_init(&service->queue, 64)) { ++ service->callback = setup->callback; ++ service->callback_param = setup->callback_param; ++ } else { ++ kfree(service); ++ service = NULL; ++ } ++ } ++ ++ return service; ++} ++ ++static void service_free(SHIM_SERVICE_T *service) ++{ ++ if (service) { ++ vchiu_queue_delete(&service->queue); ++ kfree(service); ++ } ++} ++ ++int32_t vchi_service_open(VCHI_INSTANCE_T instance_handle, ++ SERVICE_CREATION_T *setup, ++ VCHI_SERVICE_HANDLE_T *handle) ++{ ++ VCHIQ_INSTANCE_T instance = (VCHIQ_INSTANCE_T)instance_handle; ++ SHIM_SERVICE_T *service = service_alloc(instance, setup); ++ ++ *handle = (VCHI_SERVICE_HANDLE_T)service; ++ ++ if (service) { ++ VCHIQ_SERVICE_PARAMS_T params; ++ VCHIQ_STATUS_T status; ++ ++ memset(&params, 0, sizeof(params)); ++ params.fourcc = setup->service_id; ++ params.callback = shim_callback; ++ params.userdata = service; ++ params.version = setup->version.version; ++ params.version_min = setup->version.version_min; ++ ++ status = vchiq_open_service(instance, &params, ++ &service->handle); ++ if (status != VCHIQ_SUCCESS) { ++ service_free(service); ++ service = NULL; ++ *handle = NULL; ++ } ++ } ++ ++ return (service != NULL) ? 0 : -1; ++} ++EXPORT_SYMBOL(vchi_service_open); ++ ++int32_t vchi_service_create(VCHI_INSTANCE_T instance_handle, ++ SERVICE_CREATION_T *setup, ++ VCHI_SERVICE_HANDLE_T *handle) ++{ ++ VCHIQ_INSTANCE_T instance = (VCHIQ_INSTANCE_T)instance_handle; ++ SHIM_SERVICE_T *service = service_alloc(instance, setup); ++ ++ *handle = (VCHI_SERVICE_HANDLE_T)service; ++ ++ if (service) { ++ VCHIQ_SERVICE_PARAMS_T params; ++ VCHIQ_STATUS_T status; ++ ++ memset(&params, 0, sizeof(params)); ++ params.fourcc = setup->service_id; ++ params.callback = shim_callback; ++ params.userdata = service; ++ params.version = setup->version.version; ++ params.version_min = setup->version.version_min; ++ status = vchiq_add_service(instance, &params, &service->handle); ++ ++ if (status != VCHIQ_SUCCESS) { ++ service_free(service); ++ service = NULL; ++ *handle = NULL; ++ } ++ } ++ ++ return (service != NULL) ? 0 : -1; ++} ++EXPORT_SYMBOL(vchi_service_create); ++ ++int32_t vchi_service_close(const VCHI_SERVICE_HANDLE_T handle) ++{ ++ int32_t ret = -1; ++ SHIM_SERVICE_T *service = (SHIM_SERVICE_T *)handle; ++ if (service) { ++ VCHIQ_STATUS_T status = vchiq_close_service(service->handle); ++ if (status == VCHIQ_SUCCESS) { ++ service_free(service); ++ service = NULL; ++ } ++ ++ ret = vchiq_status_to_vchi(status); ++ } ++ return ret; ++} ++EXPORT_SYMBOL(vchi_service_close); ++ ++int32_t vchi_service_destroy(const VCHI_SERVICE_HANDLE_T handle) ++{ ++ int32_t ret = -1; ++ SHIM_SERVICE_T *service = (SHIM_SERVICE_T *)handle; ++ if (service) { ++ VCHIQ_STATUS_T status = vchiq_remove_service(service->handle); ++ if (status == VCHIQ_SUCCESS) { ++ service_free(service); ++ service = NULL; ++ } ++ ++ ret = vchiq_status_to_vchi(status); ++ } ++ return ret; ++} ++EXPORT_SYMBOL(vchi_service_destroy); ++ ++int32_t vchi_service_set_option(const VCHI_SERVICE_HANDLE_T handle, ++ VCHI_SERVICE_OPTION_T option, ++ int value) ++{ ++ int32_t ret = -1; ++ SHIM_SERVICE_T *service = (SHIM_SERVICE_T *)handle; ++ VCHIQ_SERVICE_OPTION_T vchiq_option; ++ switch (option) { ++ case VCHI_SERVICE_OPTION_TRACE: ++ vchiq_option = VCHIQ_SERVICE_OPTION_TRACE; ++ break; ++ case VCHI_SERVICE_OPTION_SYNCHRONOUS: ++ vchiq_option = VCHIQ_SERVICE_OPTION_SYNCHRONOUS; ++ break; ++ default: ++ service = NULL; ++ break; ++ } ++ if (service) { ++ VCHIQ_STATUS_T status = ++ vchiq_set_service_option(service->handle, ++ vchiq_option, ++ value); ++ ++ ret = vchiq_status_to_vchi(status); ++ } ++ return ret; ++} ++EXPORT_SYMBOL(vchi_service_set_option); ++ ++int32_t vchi_get_peer_version( const VCHI_SERVICE_HANDLE_T handle, short *peer_version ) ++{ ++ int32_t ret = -1; ++ SHIM_SERVICE_T *service = (SHIM_SERVICE_T *)handle; ++ if(service) ++ { ++ VCHIQ_STATUS_T status = vchiq_get_peer_version(service->handle, peer_version); ++ ret = vchiq_status_to_vchi( status ); ++ } ++ return ret; ++} ++EXPORT_SYMBOL(vchi_get_peer_version); ++ ++/* ---------------------------------------------------------------------- ++ * read a uint32_t from buffer. ++ * network format is defined to be little endian ++ * -------------------------------------------------------------------- */ ++uint32_t ++vchi_readbuf_uint32(const void *_ptr) ++{ ++ const unsigned char *ptr = _ptr; ++ return ptr[0] | (ptr[1] << 8) | (ptr[2] << 16) | (ptr[3] << 24); ++} ++ ++/* ---------------------------------------------------------------------- ++ * write a uint32_t to buffer. ++ * network format is defined to be little endian ++ * -------------------------------------------------------------------- */ ++void ++vchi_writebuf_uint32(void *_ptr, uint32_t value) ++{ ++ unsigned char *ptr = _ptr; ++ ptr[0] = (unsigned char)((value >> 0) & 0xFF); ++ ptr[1] = (unsigned char)((value >> 8) & 0xFF); ++ ptr[2] = (unsigned char)((value >> 16) & 0xFF); ++ ptr[3] = (unsigned char)((value >> 24) & 0xFF); ++} ++ ++/* ---------------------------------------------------------------------- ++ * read a uint16_t from buffer. ++ * network format is defined to be little endian ++ * -------------------------------------------------------------------- */ ++uint16_t ++vchi_readbuf_uint16(const void *_ptr) ++{ ++ const unsigned char *ptr = _ptr; ++ return ptr[0] | (ptr[1] << 8); ++} ++ ++/* ---------------------------------------------------------------------- ++ * write a uint16_t into the buffer. ++ * network format is defined to be little endian ++ * -------------------------------------------------------------------- */ ++void ++vchi_writebuf_uint16(void *_ptr, uint16_t value) ++{ ++ unsigned char *ptr = _ptr; ++ ptr[0] = (value >> 0) & 0xFF; ++ ptr[1] = (value >> 8) & 0xFF; ++} ++ ++/*********************************************************** ++ * Name: vchi_service_use ++ * ++ * Arguments: const VCHI_SERVICE_HANDLE_T handle ++ * ++ * Description: Routine to increment refcount on a service ++ * ++ * Returns: void ++ * ++ ***********************************************************/ ++int32_t vchi_service_use(const VCHI_SERVICE_HANDLE_T handle) ++{ ++ int32_t ret = -1; ++ SHIM_SERVICE_T *service = (SHIM_SERVICE_T *)handle; ++ if (service) ++ ret = vchiq_status_to_vchi(vchiq_use_service(service->handle)); ++ return ret; ++} ++EXPORT_SYMBOL(vchi_service_use); ++ ++/*********************************************************** ++ * Name: vchi_service_release ++ * ++ * Arguments: const VCHI_SERVICE_HANDLE_T handle ++ * ++ * Description: Routine to decrement refcount on a service ++ * ++ * Returns: void ++ * ++ ***********************************************************/ ++int32_t vchi_service_release(const VCHI_SERVICE_HANDLE_T handle) ++{ ++ int32_t ret = -1; ++ SHIM_SERVICE_T *service = (SHIM_SERVICE_T *)handle; ++ if (service) ++ ret = vchiq_status_to_vchi( ++ vchiq_release_service(service->handle)); ++ return ret; ++} ++EXPORT_SYMBOL(vchi_service_release); +diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_util.c b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_util.c +new file mode 100644 +index 0000000..384acb8 +--- /dev/null ++++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_util.c +@@ -0,0 +1,156 @@ ++/** ++ * Copyright (c) 2010-2012 Broadcom. 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, ++ * without modification. ++ * 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. ++ * 3. The names of the above-listed copyright holders may not be used ++ * to endorse or promote products derived from this software without ++ * specific prior written permission. ++ * ++ * ALTERNATIVELY, this software may be distributed under the terms of the ++ * GNU General Public License ("GPL") version 2, as published by the Free ++ * Software Foundation. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER OR ++ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ++ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, ++ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR ++ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF ++ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING ++ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ */ ++ ++#include "vchiq_util.h" ++#include "vchiq_killable.h" ++ ++static inline int is_pow2(int i) ++{ ++ return i && !(i & (i - 1)); ++} ++ ++int vchiu_queue_init(VCHIU_QUEUE_T *queue, int size) ++{ ++ WARN_ON(!is_pow2(size)); ++ ++ queue->size = size; ++ queue->read = 0; ++ queue->write = 0; ++ queue->initialized = 1; ++ ++ sema_init(&queue->pop, 0); ++ sema_init(&queue->push, 0); ++ ++ queue->storage = kzalloc(size * sizeof(VCHIQ_HEADER_T *), GFP_KERNEL); ++ if (queue->storage == NULL) { ++ vchiu_queue_delete(queue); ++ return 0; ++ } ++ return 1; ++} ++ ++void vchiu_queue_delete(VCHIU_QUEUE_T *queue) ++{ ++ if (queue->storage != NULL) ++ kfree(queue->storage); ++} ++ ++int vchiu_queue_is_empty(VCHIU_QUEUE_T *queue) ++{ ++ return queue->read == queue->write; ++} ++ ++int vchiu_queue_is_full(VCHIU_QUEUE_T *queue) ++{ ++ return queue->write == queue->read + queue->size; ++} ++ ++void vchiu_queue_push(VCHIU_QUEUE_T *queue, VCHIQ_HEADER_T *header) ++{ ++ if (!queue->initialized) ++ return; ++ ++ while (queue->write == queue->read + queue->size) { ++ if (down_interruptible(&queue->pop) != 0) { ++ flush_signals(current); ++ } ++ } ++ ++ /* ++ * Write to queue->storage must be visible after read from ++ * queue->read ++ */ ++ smp_mb(); ++ ++ queue->storage[queue->write & (queue->size - 1)] = header; ++ ++ /* ++ * Write to queue->storage must be visible before write to ++ * queue->write ++ */ ++ smp_wmb(); ++ ++ queue->write++; ++ ++ up(&queue->push); ++} ++ ++VCHIQ_HEADER_T *vchiu_queue_peek(VCHIU_QUEUE_T *queue) ++{ ++ while (queue->write == queue->read) { ++ if (down_interruptible(&queue->push) != 0) { ++ flush_signals(current); ++ } ++ } ++ ++ up(&queue->push); // We haven't removed anything from the queue. ++ ++ /* ++ * Read from queue->storage must be visible after read from ++ * queue->write ++ */ ++ smp_rmb(); ++ ++ return queue->storage[queue->read & (queue->size - 1)]; ++} ++ ++VCHIQ_HEADER_T *vchiu_queue_pop(VCHIU_QUEUE_T *queue) ++{ ++ VCHIQ_HEADER_T *header; ++ ++ while (queue->write == queue->read) { ++ if (down_interruptible(&queue->push) != 0) { ++ flush_signals(current); ++ } ++ } ++ ++ /* ++ * Read from queue->storage must be visible after read from ++ * queue->write ++ */ ++ smp_rmb(); ++ ++ header = queue->storage[queue->read & (queue->size - 1)]; ++ ++ /* ++ * Read from queue->storage must be visible before write to ++ * queue->read ++ */ ++ smp_mb(); ++ ++ queue->read++; ++ ++ up(&queue->pop); ++ ++ return header; ++} +diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_util.h b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_util.h +new file mode 100644 +index 0000000..4055d4b +--- /dev/null ++++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_util.h +@@ -0,0 +1,82 @@ ++/** ++ * Copyright (c) 2010-2012 Broadcom. 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, ++ * without modification. ++ * 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. ++ * 3. The names of the above-listed copyright holders may not be used ++ * to endorse or promote products derived from this software without ++ * specific prior written permission. ++ * ++ * ALTERNATIVELY, this software may be distributed under the terms of the ++ * GNU General Public License ("GPL") version 2, as published by the Free ++ * Software Foundation. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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. ++ */ ++ ++#ifndef VCHIQ_UTIL_H ++#define VCHIQ_UTIL_H ++ ++#include <linux/types.h> ++#include <linux/semaphore.h> ++#include <linux/mutex.h> ++#include <linux/bitops.h> ++#include <linux/kthread.h> ++#include <linux/wait.h> ++#include <linux/vmalloc.h> ++#include <linux/jiffies.h> ++#include <linux/delay.h> ++#include <linux/string.h> ++#include <linux/types.h> ++#include <linux/interrupt.h> ++#include <linux/random.h> ++#include <linux/sched.h> ++#include <linux/ctype.h> ++#include <linux/uaccess.h> ++#include <linux/time.h> /* for time_t */ ++#include <linux/slab.h> ++#include <linux/vmalloc.h> ++ ++#include "vchiq_if.h" ++ ++typedef struct { ++ int size; ++ int read; ++ int write; ++ int initialized; ++ ++ struct semaphore pop; ++ struct semaphore push; ++ ++ VCHIQ_HEADER_T **storage; ++} VCHIU_QUEUE_T; ++ ++extern int vchiu_queue_init(VCHIU_QUEUE_T *queue, int size); ++extern void vchiu_queue_delete(VCHIU_QUEUE_T *queue); ++ ++extern int vchiu_queue_is_empty(VCHIU_QUEUE_T *queue); ++extern int vchiu_queue_is_full(VCHIU_QUEUE_T *queue); ++ ++extern void vchiu_queue_push(VCHIU_QUEUE_T *queue, VCHIQ_HEADER_T *header); ++ ++extern VCHIQ_HEADER_T *vchiu_queue_peek(VCHIU_QUEUE_T *queue); ++extern VCHIQ_HEADER_T *vchiu_queue_pop(VCHIU_QUEUE_T *queue); ++ ++#endif +diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_version.c b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_version.c +new file mode 100644 +index 0000000..b6bfa21 +--- /dev/null ++++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_version.c +@@ -0,0 +1,59 @@ ++/** ++ * Copyright (c) 2010-2012 Broadcom. 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, ++ * without modification. ++ * 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. ++ * 3. The names of the above-listed copyright holders may not be used ++ * to endorse or promote products derived from this software without ++ * specific prior written permission. ++ * ++ * ALTERNATIVELY, this software may be distributed under the terms of the ++ * GNU General Public License ("GPL") version 2, as published by the Free ++ * Software Foundation. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER OR ++ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ++ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, ++ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR ++ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF ++ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING ++ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ */ ++#include "vchiq_build_info.h" ++#include <linux/broadcom/vc_debug_sym.h> ++ ++VC_DEBUG_DECLARE_STRING_VAR( vchiq_build_hostname, "dc4-arm-01" ); ++VC_DEBUG_DECLARE_STRING_VAR( vchiq_build_version, "9245b4c35b99b3870e1f7dc598c5692b3c66a6f0 (tainted)" ); ++VC_DEBUG_DECLARE_STRING_VAR( vchiq_build_time, __TIME__ ); ++VC_DEBUG_DECLARE_STRING_VAR( vchiq_build_date, __DATE__ ); ++ ++const char *vchiq_get_build_hostname( void ) ++{ ++ return vchiq_build_hostname; ++} ++ ++const char *vchiq_get_build_version( void ) ++{ ++ return vchiq_build_version; ++} ++ ++const char *vchiq_get_build_date( void ) ++{ ++ return vchiq_build_date; ++} ++ ++const char *vchiq_get_build_time( void ) ++{ ++ return vchiq_build_time; ++} + +From 5e58581648c99f1696b84c9e4b8b89eb3c659407 Mon Sep 17 00:00:00 2001 +From: popcornmix <popcornmix@gmail.com> +Date: Wed, 17 Jun 2015 16:07:06 +0100 +Subject: [PATCH 042/112] vc_mem: Add vc_mem driver +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: popcornmix <popcornmix@gmail.com> + +BCM270x: Move vc_mem + +Make the vc_mem module available for ARCH_BCM2835 by moving it. + +Signed-off-by: Noralf Trønnes <noralf@tronnes.org> +--- + arch/arm/mach-bcm2709/include/mach/vc_mem.h | 35 --- + arch/arm/mach-bcm2709/vc_mem.c | 431 ---------------------------- + drivers/char/broadcom/Kconfig | 12 +- + drivers/char/broadcom/Makefile | 1 + + drivers/char/broadcom/vc_mem.c | 422 +++++++++++++++++++++++++++ + include/linux/broadcom/vc_mem.h | 35 +++ + 6 files changed, 469 insertions(+), 467 deletions(-) + delete mode 100644 arch/arm/mach-bcm2709/include/mach/vc_mem.h + delete mode 100644 arch/arm/mach-bcm2709/vc_mem.c + create mode 100644 drivers/char/broadcom/vc_mem.c + create mode 100644 include/linux/broadcom/vc_mem.h + +diff --git a/arch/arm/mach-bcm2709/include/mach/vc_mem.h b/arch/arm/mach-bcm2709/include/mach/vc_mem.h +deleted file mode 100644 +index 4a4a338..0000000 +--- a/arch/arm/mach-bcm2709/include/mach/vc_mem.h ++++ /dev/null +@@ -1,35 +0,0 @@ +-/***************************************************************************** +-* Copyright 2010 - 2011 Broadcom Corporation. All rights reserved. +-* +-* Unless you and Broadcom execute a separate written software license +-* agreement governing use of this software, this software is licensed to you +-* under the terms of the GNU General Public License version 2, available at +-* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). +-* +-* Notwithstanding the above, under no circumstances may you combine this +-* software in any way with any other Broadcom software provided under a +-* license other than the GPL, without Broadcom's express prior written +-* consent. +-*****************************************************************************/ +- +-#if !defined( VC_MEM_H ) +-#define VC_MEM_H +- +-#include <linux/ioctl.h> +- +-#define VC_MEM_IOC_MAGIC 'v' +- +-#define VC_MEM_IOC_MEM_PHYS_ADDR _IOR( VC_MEM_IOC_MAGIC, 0, unsigned long ) +-#define VC_MEM_IOC_MEM_SIZE _IOR( VC_MEM_IOC_MAGIC, 1, unsigned int ) +-#define VC_MEM_IOC_MEM_BASE _IOR( VC_MEM_IOC_MAGIC, 2, unsigned int ) +-#define VC_MEM_IOC_MEM_LOAD _IOR( VC_MEM_IOC_MAGIC, 3, unsigned int ) +- +-#if defined( __KERNEL__ ) +-#define VC_MEM_TO_ARM_ADDR_MASK 0x3FFFFFFF +- +-extern unsigned long mm_vc_mem_phys_addr; +-extern unsigned int mm_vc_mem_size; +-extern int vc_mem_get_current_size( void ); +-#endif +- +-#endif /* VC_MEM_H */ +diff --git a/arch/arm/mach-bcm2709/vc_mem.c b/arch/arm/mach-bcm2709/vc_mem.c +deleted file mode 100644 +index d2adfd1..0000000 +--- a/arch/arm/mach-bcm2709/vc_mem.c ++++ /dev/null +@@ -1,431 +0,0 @@ +-/***************************************************************************** +-* Copyright 2010 - 2011 Broadcom Corporation. All rights reserved. +-* +-* Unless you and Broadcom execute a separate written software license +-* agreement governing use of this software, this software is licensed to you +-* under the terms of the GNU General Public License version 2, available at +-* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). +-* +-* Notwithstanding the above, under no circumstances may you combine this +-* software in any way with any other Broadcom software provided under a +-* license other than the GPL, without Broadcom's express prior written +-* consent. +-*****************************************************************************/ +- +-#include <linux/kernel.h> +-#include <linux/module.h> +-#include <linux/fs.h> +-#include <linux/device.h> +-#include <linux/cdev.h> +-#include <linux/mm.h> +-#include <linux/slab.h> +-#include <linux/debugfs.h> +-#include <asm/uaccess.h> +-#include <linux/dma-mapping.h> +-#include <linux/platform_data/mailbox-bcm2708.h> +- +-#ifdef CONFIG_ARCH_KONA +-#include <chal/chal_ipc.h> +-#elif defined(CONFIG_ARCH_BCM2708) || defined(CONFIG_ARCH_BCM2709) +-#else +-#include <csp/chal_ipc.h> +-#endif +- +-#include "mach/vc_mem.h" +- +-#define DRIVER_NAME "vc-mem" +- +-// Device (/dev) related variables +-static dev_t vc_mem_devnum = 0; +-static struct class *vc_mem_class = NULL; +-static struct cdev vc_mem_cdev; +-static int vc_mem_inited = 0; +- +-#ifdef CONFIG_DEBUG_FS +-static struct dentry *vc_mem_debugfs_entry; +-#endif +- +-/* +- * Videocore memory addresses and size +- * +- * Drivers that wish to know the videocore memory addresses and sizes should +- * use these variables instead of the MM_IO_BASE and MM_ADDR_IO defines in +- * headers. This allows the other drivers to not be tied down to a a certain +- * address/size at compile time. +- * +- * In the future, the goal is to have the videocore memory virtual address and +- * size be calculated at boot time rather than at compile time. The decision of +- * where the videocore memory resides and its size would be in the hands of the +- * bootloader (and/or kernel). When that happens, the values of these variables +- * would be calculated and assigned in the init function. +- */ +-// in the 2835 VC in mapped above ARM, but ARM has full access to VC space +-unsigned long mm_vc_mem_phys_addr = 0x00000000; +-unsigned int mm_vc_mem_size = 0; +-unsigned int mm_vc_mem_base = 0; +- +-EXPORT_SYMBOL(mm_vc_mem_phys_addr); +-EXPORT_SYMBOL(mm_vc_mem_size); +-EXPORT_SYMBOL(mm_vc_mem_base); +- +-static uint phys_addr = 0; +-static uint mem_size = 0; +-static uint mem_base = 0; +- +- +-/**************************************************************************** +-* +-* vc_mem_open +-* +-***************************************************************************/ +- +-static int +-vc_mem_open(struct inode *inode, struct file *file) +-{ +- (void) inode; +- (void) file; +- +- pr_debug("%s: called file = 0x%p\n", __func__, file); +- +- return 0; +-} +- +-/**************************************************************************** +-* +-* vc_mem_release +-* +-***************************************************************************/ +- +-static int +-vc_mem_release(struct inode *inode, struct file *file) +-{ +- (void) inode; +- (void) file; +- +- pr_debug("%s: called file = 0x%p\n", __func__, file); +- +- return 0; +-} +- +-/**************************************************************************** +-* +-* vc_mem_get_size +-* +-***************************************************************************/ +- +-static void +-vc_mem_get_size(void) +-{ +-} +- +-/**************************************************************************** +-* +-* vc_mem_get_base +-* +-***************************************************************************/ +- +-static void +-vc_mem_get_base(void) +-{ +-} +- +-/**************************************************************************** +-* +-* vc_mem_get_current_size +-* +-***************************************************************************/ +- +-int +-vc_mem_get_current_size(void) +-{ +- return mm_vc_mem_size; +-} +- +-EXPORT_SYMBOL_GPL(vc_mem_get_current_size); +- +-/**************************************************************************** +-* +-* vc_mem_ioctl +-* +-***************************************************************************/ +- +-static long +-vc_mem_ioctl(struct file *file, unsigned int cmd, unsigned long arg) +-{ +- int rc = 0; +- +- (void) cmd; +- (void) arg; +- +- pr_debug("%s: called file = 0x%p\n", __func__, file); +- +- switch (cmd) { +- case VC_MEM_IOC_MEM_PHYS_ADDR: +- { +- pr_debug("%s: VC_MEM_IOC_MEM_PHYS_ADDR=0x%p\n", +- __func__, (void *) mm_vc_mem_phys_addr); +- +- if (copy_to_user((void *) arg, &mm_vc_mem_phys_addr, +- sizeof (mm_vc_mem_phys_addr)) != 0) { +- rc = -EFAULT; +- } +- break; +- } +- case VC_MEM_IOC_MEM_SIZE: +- { +- // Get the videocore memory size first +- vc_mem_get_size(); +- +- pr_debug("%s: VC_MEM_IOC_MEM_SIZE=%u\n", __func__, +- mm_vc_mem_size); +- +- if (copy_to_user((void *) arg, &mm_vc_mem_size, +- sizeof (mm_vc_mem_size)) != 0) { +- rc = -EFAULT; +- } +- break; +- } +- case VC_MEM_IOC_MEM_BASE: +- { +- // Get the videocore memory base +- vc_mem_get_base(); +- +- pr_debug("%s: VC_MEM_IOC_MEM_BASE=%u\n", __func__, +- mm_vc_mem_base); +- +- if (copy_to_user((void *) arg, &mm_vc_mem_base, +- sizeof (mm_vc_mem_base)) != 0) { +- rc = -EFAULT; +- } +- break; +- } +- case VC_MEM_IOC_MEM_LOAD: +- { +- // Get the videocore memory base +- vc_mem_get_base(); +- +- pr_debug("%s: VC_MEM_IOC_MEM_LOAD=%u\n", __func__, +- mm_vc_mem_base); +- +- if (copy_to_user((void *) arg, &mm_vc_mem_base, +- sizeof (mm_vc_mem_base)) != 0) { +- rc = -EFAULT; +- } +- break; +- } +- default: +- { +- return -ENOTTY; +- } +- } +- pr_debug("%s: file = 0x%p returning %d\n", __func__, file, rc); +- +- return rc; +-} +- +-/**************************************************************************** +-* +-* vc_mem_mmap +-* +-***************************************************************************/ +- +-static int +-vc_mem_mmap(struct file *filp, struct vm_area_struct *vma) +-{ +- int rc = 0; +- unsigned long length = vma->vm_end - vma->vm_start; +- unsigned long offset = vma->vm_pgoff << PAGE_SHIFT; +- +- pr_debug("%s: vm_start = 0x%08lx vm_end = 0x%08lx vm_pgoff = 0x%08lx\n", +- __func__, (long) vma->vm_start, (long) vma->vm_end, +- (long) vma->vm_pgoff); +- +- if (offset + length > mm_vc_mem_size) { +- pr_err("%s: length %ld is too big\n", __func__, length); +- return -EINVAL; +- } +- // Do not cache the memory map +- vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); +- +- rc = remap_pfn_range(vma, vma->vm_start, +- (mm_vc_mem_phys_addr >> PAGE_SHIFT) + +- vma->vm_pgoff, length, vma->vm_page_prot); +- if (rc != 0) { +- pr_err("%s: remap_pfn_range failed (rc=%d)\n", __func__, rc); +- } +- +- return rc; +-} +- +-/**************************************************************************** +-* +-* File Operations for the driver. +-* +-***************************************************************************/ +- +-static const struct file_operations vc_mem_fops = { +- .owner = THIS_MODULE, +- .open = vc_mem_open, +- .release = vc_mem_release, +- .unlocked_ioctl = vc_mem_ioctl, +- .mmap = vc_mem_mmap, +-}; +- +-#ifdef CONFIG_DEBUG_FS +-static void vc_mem_debugfs_deinit(void) +-{ +- debugfs_remove_recursive(vc_mem_debugfs_entry); +- vc_mem_debugfs_entry = NULL; +-} +- +- +-static int vc_mem_debugfs_init( +- struct device *dev) +-{ +- vc_mem_debugfs_entry = debugfs_create_dir(DRIVER_NAME, NULL); +- if (!vc_mem_debugfs_entry) { +- dev_warn(dev, "could not create debugfs entry\n"); +- return -EFAULT; +- } +- +- if (!debugfs_create_x32("vc_mem_phys_addr", +- 0444, +- vc_mem_debugfs_entry, +- (u32 *)&mm_vc_mem_phys_addr)) { +- dev_warn(dev, "%s:could not create vc_mem_phys entry\n", +- __func__); +- goto fail; +- } +- +- if (!debugfs_create_x32("vc_mem_size", +- 0444, +- vc_mem_debugfs_entry, +- (u32 *)&mm_vc_mem_size)) { +- dev_warn(dev, "%s:could not create vc_mem_size entry\n", +- __func__); +- goto fail; +- } +- +- if (!debugfs_create_x32("vc_mem_base", +- 0444, +- vc_mem_debugfs_entry, +- (u32 *)&mm_vc_mem_base)) { +- dev_warn(dev, "%s:could not create vc_mem_base entry\n", +- __func__); +- goto fail; +- } +- +- return 0; +- +-fail: +- vc_mem_debugfs_deinit(); +- return -EFAULT; +-} +- +-#endif /* CONFIG_DEBUG_FS */ +- +- +-/**************************************************************************** +-* +-* vc_mem_init +-* +-***************************************************************************/ +- +-static int __init +-vc_mem_init(void) +-{ +- int rc = -EFAULT; +- struct device *dev; +- +- pr_debug("%s: called\n", __func__); +- +- mm_vc_mem_phys_addr = phys_addr; +- mm_vc_mem_size = mem_size; +- mm_vc_mem_base = mem_base; +- +- vc_mem_get_size(); +- +- pr_info("vc-mem: phys_addr:0x%08lx mem_base=0x%08x mem_size:0x%08x(%u MiB)\n", +- mm_vc_mem_phys_addr, mm_vc_mem_base, mm_vc_mem_size, mm_vc_mem_size / (1024 * 1024)); +- +- if ((rc = alloc_chrdev_region(&vc_mem_devnum, 0, 1, DRIVER_NAME)) < 0) { +- pr_err("%s: alloc_chrdev_region failed (rc=%d)\n", +- __func__, rc); +- goto out_err; +- } +- +- cdev_init(&vc_mem_cdev, &vc_mem_fops); +- if ((rc = cdev_add(&vc_mem_cdev, vc_mem_devnum, 1)) != 0) { +- pr_err("%s: cdev_add failed (rc=%d)\n", __func__, rc); +- goto out_unregister; +- } +- +- vc_mem_class = class_create(THIS_MODULE, DRIVER_NAME); +- if (IS_ERR(vc_mem_class)) { +- rc = PTR_ERR(vc_mem_class); +- pr_err("%s: class_create failed (rc=%d)\n", __func__, rc); +- goto out_cdev_del; +- } +- +- dev = device_create(vc_mem_class, NULL, vc_mem_devnum, NULL, +- DRIVER_NAME); +- if (IS_ERR(dev)) { +- rc = PTR_ERR(dev); +- pr_err("%s: device_create failed (rc=%d)\n", __func__, rc); +- goto out_class_destroy; +- } +- +-#ifdef CONFIG_DEBUG_FS +- /* don't fail if the debug entries cannot be created */ +- vc_mem_debugfs_init(dev); +-#endif +- +- vc_mem_inited = 1; +- return 0; +- +- device_destroy(vc_mem_class, vc_mem_devnum); +- +- out_class_destroy: +- class_destroy(vc_mem_class); +- vc_mem_class = NULL; +- +- out_cdev_del: +- cdev_del(&vc_mem_cdev); +- +- out_unregister: +- unregister_chrdev_region(vc_mem_devnum, 1); +- +- out_err: +- return -1; +-} +- +-/**************************************************************************** +-* +-* vc_mem_exit +-* +-***************************************************************************/ +- +-static void __exit +-vc_mem_exit(void) +-{ +- pr_debug("%s: called\n", __func__); +- +- if (vc_mem_inited) { +-#if CONFIG_DEBUG_FS +- vc_mem_debugfs_deinit(); +-#endif +- device_destroy(vc_mem_class, vc_mem_devnum); +- class_destroy(vc_mem_class); +- cdev_del(&vc_mem_cdev); +- unregister_chrdev_region(vc_mem_devnum, 1); +- } +-} +- +-module_init(vc_mem_init); +-module_exit(vc_mem_exit); +-MODULE_LICENSE("GPL"); +-MODULE_AUTHOR("Broadcom Corporation"); +- +-module_param(phys_addr, uint, 0644); +-module_param(mem_size, uint, 0644); +-module_param(mem_base, uint, 0644); +diff --git a/drivers/char/broadcom/Kconfig b/drivers/char/broadcom/Kconfig +index 2d8bd6e..7037928 100644 +--- a/drivers/char/broadcom/Kconfig ++++ b/drivers/char/broadcom/Kconfig +@@ -7,9 +7,19 @@ menuconfig BRCM_CHAR_DRIVERS + help + Broadcom's char drivers + ++if BRCM_CHAR_DRIVERS ++ + config BCM_VC_CMA + bool "Videocore CMA" +- depends on CMA && BRCM_CHAR_DRIVERS && BCM2708_VCHIQ ++ depends on CMA && BCM2708_VCHIQ + default n + help + Helper for videocore CMA access. ++ ++config BCM2708_VCMEM ++ bool "Videocore Memory" ++ default y ++ help ++ Helper for videocore memory access and total size allocation. ++ ++endif +diff --git a/drivers/char/broadcom/Makefile b/drivers/char/broadcom/Makefile +index 13c5bca..fce918c 100644 +--- a/drivers/char/broadcom/Makefile ++++ b/drivers/char/broadcom/Makefile +@@ -1 +1,2 @@ + obj-$(CONFIG_BCM_VC_CMA) += vc_cma/ ++obj-$(CONFIG_BCM2708_VCMEM) += vc_mem.o +diff --git a/drivers/char/broadcom/vc_mem.c b/drivers/char/broadcom/vc_mem.c +new file mode 100644 +index 0000000..be64f23 +--- /dev/null ++++ b/drivers/char/broadcom/vc_mem.c +@@ -0,0 +1,422 @@ ++/***************************************************************************** ++* Copyright 2010 - 2011 Broadcom Corporation. All rights reserved. ++* ++* Unless you and Broadcom execute a separate written software license ++* agreement governing use of this software, this software is licensed to you ++* under the terms of the GNU General Public License version 2, available at ++* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). ++* ++* Notwithstanding the above, under no circumstances may you combine this ++* software in any way with any other Broadcom software provided under a ++* license other than the GPL, without Broadcom's express prior written ++* consent. ++*****************************************************************************/ ++ ++#include <linux/kernel.h> ++#include <linux/module.h> ++#include <linux/fs.h> ++#include <linux/device.h> ++#include <linux/cdev.h> ++#include <linux/mm.h> ++#include <linux/slab.h> ++#include <linux/debugfs.h> ++#include <asm/uaccess.h> ++#include <linux/dma-mapping.h> ++#include <linux/broadcom/vc_mem.h> ++ ++#define DRIVER_NAME "vc-mem" ++ ++// Device (/dev) related variables ++static dev_t vc_mem_devnum = 0; ++static struct class *vc_mem_class = NULL; ++static struct cdev vc_mem_cdev; ++static int vc_mem_inited = 0; ++ ++#ifdef CONFIG_DEBUG_FS ++static struct dentry *vc_mem_debugfs_entry; ++#endif ++ ++/* ++ * Videocore memory addresses and size ++ * ++ * Drivers that wish to know the videocore memory addresses and sizes should ++ * use these variables instead of the MM_IO_BASE and MM_ADDR_IO defines in ++ * headers. This allows the other drivers to not be tied down to a a certain ++ * address/size at compile time. ++ * ++ * In the future, the goal is to have the videocore memory virtual address and ++ * size be calculated at boot time rather than at compile time. The decision of ++ * where the videocore memory resides and its size would be in the hands of the ++ * bootloader (and/or kernel). When that happens, the values of these variables ++ * would be calculated and assigned in the init function. ++ */ ++// in the 2835 VC in mapped above ARM, but ARM has full access to VC space ++unsigned long mm_vc_mem_phys_addr = 0x00000000; ++unsigned int mm_vc_mem_size = 0; ++unsigned int mm_vc_mem_base = 0; ++ ++EXPORT_SYMBOL(mm_vc_mem_phys_addr); ++EXPORT_SYMBOL(mm_vc_mem_size); ++EXPORT_SYMBOL(mm_vc_mem_base); ++ ++static uint phys_addr = 0; ++static uint mem_size = 0; ++static uint mem_base = 0; ++ ++ ++/**************************************************************************** ++* ++* vc_mem_open ++* ++***************************************************************************/ ++ ++static int ++vc_mem_open(struct inode *inode, struct file *file) ++{ ++ (void) inode; ++ (void) file; ++ ++ pr_debug("%s: called file = 0x%p\n", __func__, file); ++ ++ return 0; ++} ++ ++/**************************************************************************** ++* ++* vc_mem_release ++* ++***************************************************************************/ ++ ++static int ++vc_mem_release(struct inode *inode, struct file *file) ++{ ++ (void) inode; ++ (void) file; ++ ++ pr_debug("%s: called file = 0x%p\n", __func__, file); ++ ++ return 0; ++} ++ ++/**************************************************************************** ++* ++* vc_mem_get_size ++* ++***************************************************************************/ ++ ++static void ++vc_mem_get_size(void) ++{ ++} ++ ++/**************************************************************************** ++* ++* vc_mem_get_base ++* ++***************************************************************************/ ++ ++static void ++vc_mem_get_base(void) ++{ ++} ++ ++/**************************************************************************** ++* ++* vc_mem_get_current_size ++* ++***************************************************************************/ ++ ++int ++vc_mem_get_current_size(void) ++{ ++ return mm_vc_mem_size; ++} ++ ++EXPORT_SYMBOL_GPL(vc_mem_get_current_size); ++ ++/**************************************************************************** ++* ++* vc_mem_ioctl ++* ++***************************************************************************/ ++ ++static long ++vc_mem_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ++{ ++ int rc = 0; ++ ++ (void) cmd; ++ (void) arg; ++ ++ pr_debug("%s: called file = 0x%p\n", __func__, file); ++ ++ switch (cmd) { ++ case VC_MEM_IOC_MEM_PHYS_ADDR: ++ { ++ pr_debug("%s: VC_MEM_IOC_MEM_PHYS_ADDR=0x%p\n", ++ __func__, (void *) mm_vc_mem_phys_addr); ++ ++ if (copy_to_user((void *) arg, &mm_vc_mem_phys_addr, ++ sizeof (mm_vc_mem_phys_addr)) != 0) { ++ rc = -EFAULT; ++ } ++ break; ++ } ++ case VC_MEM_IOC_MEM_SIZE: ++ { ++ // Get the videocore memory size first ++ vc_mem_get_size(); ++ ++ pr_debug("%s: VC_MEM_IOC_MEM_SIZE=%u\n", __func__, ++ mm_vc_mem_size); ++ ++ if (copy_to_user((void *) arg, &mm_vc_mem_size, ++ sizeof (mm_vc_mem_size)) != 0) { ++ rc = -EFAULT; ++ } ++ break; ++ } ++ case VC_MEM_IOC_MEM_BASE: ++ { ++ // Get the videocore memory base ++ vc_mem_get_base(); ++ ++ pr_debug("%s: VC_MEM_IOC_MEM_BASE=%u\n", __func__, ++ mm_vc_mem_base); ++ ++ if (copy_to_user((void *) arg, &mm_vc_mem_base, ++ sizeof (mm_vc_mem_base)) != 0) { ++ rc = -EFAULT; ++ } ++ break; ++ } ++ case VC_MEM_IOC_MEM_LOAD: ++ { ++ // Get the videocore memory base ++ vc_mem_get_base(); ++ ++ pr_debug("%s: VC_MEM_IOC_MEM_LOAD=%u\n", __func__, ++ mm_vc_mem_base); ++ ++ if (copy_to_user((void *) arg, &mm_vc_mem_base, ++ sizeof (mm_vc_mem_base)) != 0) { ++ rc = -EFAULT; ++ } ++ break; ++ } ++ default: ++ { ++ return -ENOTTY; ++ } ++ } ++ pr_debug("%s: file = 0x%p returning %d\n", __func__, file, rc); ++ ++ return rc; ++} ++ ++/**************************************************************************** ++* ++* vc_mem_mmap ++* ++***************************************************************************/ ++ ++static int ++vc_mem_mmap(struct file *filp, struct vm_area_struct *vma) ++{ ++ int rc = 0; ++ unsigned long length = vma->vm_end - vma->vm_start; ++ unsigned long offset = vma->vm_pgoff << PAGE_SHIFT; ++ ++ pr_debug("%s: vm_start = 0x%08lx vm_end = 0x%08lx vm_pgoff = 0x%08lx\n", ++ __func__, (long) vma->vm_start, (long) vma->vm_end, ++ (long) vma->vm_pgoff); ++ ++ if (offset + length > mm_vc_mem_size) { ++ pr_err("%s: length %ld is too big\n", __func__, length); ++ return -EINVAL; ++ } ++ // Do not cache the memory map ++ vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); ++ ++ rc = remap_pfn_range(vma, vma->vm_start, ++ (mm_vc_mem_phys_addr >> PAGE_SHIFT) + ++ vma->vm_pgoff, length, vma->vm_page_prot); ++ if (rc != 0) { ++ pr_err("%s: remap_pfn_range failed (rc=%d)\n", __func__, rc); ++ } ++ ++ return rc; ++} ++ ++/**************************************************************************** ++* ++* File Operations for the driver. ++* ++***************************************************************************/ ++ ++static const struct file_operations vc_mem_fops = { ++ .owner = THIS_MODULE, ++ .open = vc_mem_open, ++ .release = vc_mem_release, ++ .unlocked_ioctl = vc_mem_ioctl, ++ .mmap = vc_mem_mmap, ++}; ++ ++#ifdef CONFIG_DEBUG_FS ++static void vc_mem_debugfs_deinit(void) ++{ ++ debugfs_remove_recursive(vc_mem_debugfs_entry); ++ vc_mem_debugfs_entry = NULL; ++} ++ ++ ++static int vc_mem_debugfs_init( ++ struct device *dev) ++{ ++ vc_mem_debugfs_entry = debugfs_create_dir(DRIVER_NAME, NULL); ++ if (!vc_mem_debugfs_entry) { ++ dev_warn(dev, "could not create debugfs entry\n"); ++ return -EFAULT; ++ } ++ ++ if (!debugfs_create_x32("vc_mem_phys_addr", ++ 0444, ++ vc_mem_debugfs_entry, ++ (u32 *)&mm_vc_mem_phys_addr)) { ++ dev_warn(dev, "%s:could not create vc_mem_phys entry\n", ++ __func__); ++ goto fail; ++ } ++ ++ if (!debugfs_create_x32("vc_mem_size", ++ 0444, ++ vc_mem_debugfs_entry, ++ (u32 *)&mm_vc_mem_size)) { ++ dev_warn(dev, "%s:could not create vc_mem_size entry\n", ++ __func__); ++ goto fail; ++ } ++ ++ if (!debugfs_create_x32("vc_mem_base", ++ 0444, ++ vc_mem_debugfs_entry, ++ (u32 *)&mm_vc_mem_base)) { ++ dev_warn(dev, "%s:could not create vc_mem_base entry\n", ++ __func__); ++ goto fail; ++ } ++ ++ return 0; ++ ++fail: ++ vc_mem_debugfs_deinit(); ++ return -EFAULT; ++} ++ ++#endif /* CONFIG_DEBUG_FS */ ++ ++ ++/**************************************************************************** ++* ++* vc_mem_init ++* ++***************************************************************************/ ++ ++static int __init ++vc_mem_init(void) ++{ ++ int rc = -EFAULT; ++ struct device *dev; ++ ++ pr_debug("%s: called\n", __func__); ++ ++ mm_vc_mem_phys_addr = phys_addr; ++ mm_vc_mem_size = mem_size; ++ mm_vc_mem_base = mem_base; ++ ++ vc_mem_get_size(); ++ ++ pr_info("vc-mem: phys_addr:0x%08lx mem_base=0x%08x mem_size:0x%08x(%u MiB)\n", ++ mm_vc_mem_phys_addr, mm_vc_mem_base, mm_vc_mem_size, mm_vc_mem_size / (1024 * 1024)); ++ ++ if ((rc = alloc_chrdev_region(&vc_mem_devnum, 0, 1, DRIVER_NAME)) < 0) { ++ pr_err("%s: alloc_chrdev_region failed (rc=%d)\n", ++ __func__, rc); ++ goto out_err; ++ } ++ ++ cdev_init(&vc_mem_cdev, &vc_mem_fops); ++ if ((rc = cdev_add(&vc_mem_cdev, vc_mem_devnum, 1)) != 0) { ++ pr_err("%s: cdev_add failed (rc=%d)\n", __func__, rc); ++ goto out_unregister; ++ } ++ ++ vc_mem_class = class_create(THIS_MODULE, DRIVER_NAME); ++ if (IS_ERR(vc_mem_class)) { ++ rc = PTR_ERR(vc_mem_class); ++ pr_err("%s: class_create failed (rc=%d)\n", __func__, rc); ++ goto out_cdev_del; ++ } ++ ++ dev = device_create(vc_mem_class, NULL, vc_mem_devnum, NULL, ++ DRIVER_NAME); ++ if (IS_ERR(dev)) { ++ rc = PTR_ERR(dev); ++ pr_err("%s: device_create failed (rc=%d)\n", __func__, rc); ++ goto out_class_destroy; ++ } ++ ++#ifdef CONFIG_DEBUG_FS ++ /* don't fail if the debug entries cannot be created */ ++ vc_mem_debugfs_init(dev); ++#endif ++ ++ vc_mem_inited = 1; ++ return 0; ++ ++ device_destroy(vc_mem_class, vc_mem_devnum); ++ ++ out_class_destroy: ++ class_destroy(vc_mem_class); ++ vc_mem_class = NULL; ++ ++ out_cdev_del: ++ cdev_del(&vc_mem_cdev); ++ ++ out_unregister: ++ unregister_chrdev_region(vc_mem_devnum, 1); ++ ++ out_err: ++ return -1; ++} ++ ++/**************************************************************************** ++* ++* vc_mem_exit ++* ++***************************************************************************/ ++ ++static void __exit ++vc_mem_exit(void) ++{ ++ pr_debug("%s: called\n", __func__); ++ ++ if (vc_mem_inited) { ++#if CONFIG_DEBUG_FS ++ vc_mem_debugfs_deinit(); ++#endif ++ device_destroy(vc_mem_class, vc_mem_devnum); ++ class_destroy(vc_mem_class); ++ cdev_del(&vc_mem_cdev); ++ unregister_chrdev_region(vc_mem_devnum, 1); ++ } ++} ++ ++module_init(vc_mem_init); ++module_exit(vc_mem_exit); ++MODULE_LICENSE("GPL"); ++MODULE_AUTHOR("Broadcom Corporation"); ++ ++module_param(phys_addr, uint, 0644); ++module_param(mem_size, uint, 0644); ++module_param(mem_base, uint, 0644); +diff --git a/include/linux/broadcom/vc_mem.h b/include/linux/broadcom/vc_mem.h +new file mode 100644 +index 0000000..20a4753 +--- /dev/null ++++ b/include/linux/broadcom/vc_mem.h +@@ -0,0 +1,35 @@ ++/***************************************************************************** ++* Copyright 2010 - 2011 Broadcom Corporation. All rights reserved. ++* ++* Unless you and Broadcom execute a separate written software license ++* agreement governing use of this software, this software is licensed to you ++* under the terms of the GNU General Public License version 2, available at ++* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). ++* ++* Notwithstanding the above, under no circumstances may you combine this ++* software in any way with any other Broadcom software provided under a ++* license other than the GPL, without Broadcom's express prior written ++* consent. ++*****************************************************************************/ ++ ++#ifndef _VC_MEM_H ++#define _VC_MEM_H ++ ++#include <linux/ioctl.h> ++ ++#define VC_MEM_IOC_MAGIC 'v' ++ ++#define VC_MEM_IOC_MEM_PHYS_ADDR _IOR( VC_MEM_IOC_MAGIC, 0, unsigned long ) ++#define VC_MEM_IOC_MEM_SIZE _IOR( VC_MEM_IOC_MAGIC, 1, unsigned int ) ++#define VC_MEM_IOC_MEM_BASE _IOR( VC_MEM_IOC_MAGIC, 2, unsigned int ) ++#define VC_MEM_IOC_MEM_LOAD _IOR( VC_MEM_IOC_MAGIC, 3, unsigned int ) ++ ++#if defined( __KERNEL__ ) ++#define VC_MEM_TO_ARM_ADDR_MASK 0x3FFFFFFF ++ ++extern unsigned long mm_vc_mem_phys_addr; ++extern unsigned int mm_vc_mem_size; ++extern int vc_mem_get_current_size( void ); ++#endif ++ ++#endif /* _VC_MEM_H */ + +From 9e8a9f6739d247779cfed83ca57c70c963eaa14e Mon Sep 17 00:00:00 2001 +From: Tim Gover <tgover@broadcom.com> +Date: Tue, 22 Jul 2014 15:41:04 +0100 +Subject: [PATCH 043/112] vcsm: VideoCore shared memory service for BCM2835 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Add experimental support for the VideoCore shared memory service. +This allows user processes to allocate memory from VideoCore's +GPU relocatable heap and mmap the buffers. Additionally, the memory +handles can passed to other VideoCore services such as MMAL, OpenMax +and DispmanX + +TODO +* This driver was originally released for BCM28155 which has a different + cache architecture to BCM2835. Consequently, in this release only + uncached mappings are supported. However, there's no fundamental + reason which cached mappings cannot be support or BCM2835 +* More refactoring is required to remove the typedefs. +* Re-enable the some of the commented out debug-fs statistics which were + disabled when migrating code from proc-fs. +* There's a lot of code to support sharing of VCSM in order to support + Android. This could probably done more cleanly or perhaps just + removed. + +Signed-off-by: Tim Gover <timgover@gmail.com> + +config: Disable VC_SM for now to fix hang with cutdown kernel + +vcsm: Use boolean as it cannot be built as module + +On building the bcm_vc_sm as a module we get the following error: + +v7_dma_flush_range and do_munmap are undefined in vc-sm.ko. + +Fix by making it not an option to build as module + +vcsm: Add ioctl for custom cache flushing + +vc-sm: Move headers out of arch directory + +Signed-off-by: Noralf Trønnes <noralf@tronnes.org> +--- + drivers/char/broadcom/Kconfig | 9 + + drivers/char/broadcom/Makefile | 1 + + drivers/char/broadcom/vc_sm/Makefile | 20 + + drivers/char/broadcom/vc_sm/vc_sm_defs.h | 181 ++ + drivers/char/broadcom/vc_sm/vc_sm_knl.h | 55 + + drivers/char/broadcom/vc_sm/vc_vchi_sm.c | 492 +++++ + drivers/char/broadcom/vc_sm/vc_vchi_sm.h | 82 + + drivers/char/broadcom/vc_sm/vmcs_sm.c | 3213 ++++++++++++++++++++++++++++++ + include/linux/broadcom/vmcs_sm_ioctl.h | 248 +++ + 9 files changed, 4301 insertions(+) + create mode 100644 drivers/char/broadcom/vc_sm/Makefile + create mode 100644 drivers/char/broadcom/vc_sm/vc_sm_defs.h + create mode 100644 drivers/char/broadcom/vc_sm/vc_sm_knl.h + create mode 100644 drivers/char/broadcom/vc_sm/vc_vchi_sm.c + create mode 100644 drivers/char/broadcom/vc_sm/vc_vchi_sm.h + create mode 100644 drivers/char/broadcom/vc_sm/vmcs_sm.c + create mode 100644 include/linux/broadcom/vmcs_sm_ioctl.h + +diff --git a/drivers/char/broadcom/Kconfig b/drivers/char/broadcom/Kconfig +index 7037928..75fa1cb 100644 +--- a/drivers/char/broadcom/Kconfig ++++ b/drivers/char/broadcom/Kconfig +@@ -23,3 +23,12 @@ config BCM2708_VCMEM + Helper for videocore memory access and total size allocation. + + endif ++ ++config BCM_VC_SM ++ bool "VMCS Shared Memory" ++ depends on BCM2708_VCHIQ ++ select BCM2708_VCMEM ++ default n ++ help ++ Support for the VC shared memory on the Broadcom reference ++ design. Uses the VCHIQ stack. +diff --git a/drivers/char/broadcom/Makefile b/drivers/char/broadcom/Makefile +index fce918c..de8feb9 100644 +--- a/drivers/char/broadcom/Makefile ++++ b/drivers/char/broadcom/Makefile +@@ -1,2 +1,3 @@ + obj-$(CONFIG_BCM_VC_CMA) += vc_cma/ + obj-$(CONFIG_BCM2708_VCMEM) += vc_mem.o ++obj-$(CONFIG_BCM_VC_SM) += vc_sm/ +diff --git a/drivers/char/broadcom/vc_sm/Makefile b/drivers/char/broadcom/vc_sm/Makefile +new file mode 100644 +index 0000000..68fa2aa +--- /dev/null ++++ b/drivers/char/broadcom/vc_sm/Makefile +@@ -0,0 +1,20 @@ ++EXTRA_CFLAGS += -Wall -Wstrict-prototypes -Wno-trigraphs -O2 ++ ++EXTRA_CFLAGS += -I"drivers/misc/vc04_services" ++EXTRA_CFLAGS += -I"drivers/misc/vc04_services/interface/vchi" ++EXTRA_CFLAGS += -I"drivers/misc/vc04_services/interface/vchiq_arm" ++EXTRA_CFLAGS += -I"$(srctree)/fs/" ++ ++EXTRA_CFLAGS += -DOS_ASSERT_FAILURE ++EXTRA_CFLAGS += -D__STDC_VERSION=199901L ++EXTRA_CFLAGS += -D__STDC_VERSION__=199901L ++EXTRA_CFLAGS += -D__VCCOREVER__=0 ++EXTRA_CFLAGS += -D__KERNEL__ ++EXTRA_CFLAGS += -D__linux__ ++EXTRA_CFLAGS += -Werror ++ ++obj-$(CONFIG_BCM_VC_SM) := vc-sm.o ++ ++vc-sm-objs := \ ++ vmcs_sm.o \ ++ vc_vchi_sm.o +diff --git a/drivers/char/broadcom/vc_sm/vc_sm_defs.h b/drivers/char/broadcom/vc_sm/vc_sm_defs.h +new file mode 100644 +index 0000000..c4d5ff7 +--- /dev/null ++++ b/drivers/char/broadcom/vc_sm/vc_sm_defs.h +@@ -0,0 +1,181 @@ ++/***************************************************************************** ++* Copyright 2011 Broadcom Corporation. All rights reserved. ++* ++* Unless you and Broadcom execute a separate written software license ++* agreement governing use of this software, this software is licensed to you ++* under the terms of the GNU General Public License version 2, available at ++* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). ++* ++* Notwithstanding the above, under no circumstances may you combine this ++* software in any way with any other Broadcom software provided under a ++* license other than the GPL, without Broadcom's express prior written ++* consent. ++*****************************************************************************/ ++ ++#ifndef __VC_SM_DEFS_H__INCLUDED__ ++#define __VC_SM_DEFS_H__INCLUDED__ ++ ++/* FourCC code used for VCHI connection */ ++#define VC_SM_SERVER_NAME MAKE_FOURCC("SMEM") ++ ++/* Maximum message length */ ++#define VC_SM_MAX_MSG_LEN (sizeof(VC_SM_MSG_UNION_T) + \ ++ sizeof(VC_SM_MSG_HDR_T)) ++#define VC_SM_MAX_RSP_LEN (sizeof(VC_SM_MSG_UNION_T)) ++ ++/* Resource name maximum size */ ++#define VC_SM_RESOURCE_NAME 32 ++ ++/* All message types supported for HOST->VC direction */ ++typedef enum { ++ /* Allocate shared memory block */ ++ VC_SM_MSG_TYPE_ALLOC, ++ /* Lock allocated shared memory block */ ++ VC_SM_MSG_TYPE_LOCK, ++ /* Unlock allocated shared memory block */ ++ VC_SM_MSG_TYPE_UNLOCK, ++ /* Unlock allocated shared memory block, do not answer command */ ++ VC_SM_MSG_TYPE_UNLOCK_NOANS, ++ /* Free shared memory block */ ++ VC_SM_MSG_TYPE_FREE, ++ /* Resize a shared memory block */ ++ VC_SM_MSG_TYPE_RESIZE, ++ /* Walk the allocated shared memory block(s) */ ++ VC_SM_MSG_TYPE_WALK_ALLOC, ++ ++ /* A previously applied action will need to be reverted */ ++ VC_SM_MSG_TYPE_ACTION_CLEAN, ++ VC_SM_MSG_TYPE_MAX ++} VC_SM_MSG_TYPE; ++ ++/* Type of memory to be allocated */ ++typedef enum { ++ VC_SM_ALLOC_CACHED, ++ VC_SM_ALLOC_NON_CACHED, ++ ++} VC_SM_ALLOC_TYPE_T; ++ ++/* Message header for all messages in HOST->VC direction */ ++typedef struct { ++ int32_t type; ++ uint32_t trans_id; ++ uint8_t body[0]; ++ ++} VC_SM_MSG_HDR_T; ++ ++/* Request to allocate memory (HOST->VC) */ ++typedef struct { ++ /* type of memory to allocate */ ++ VC_SM_ALLOC_TYPE_T type; ++ /* byte amount of data to allocate per unit */ ++ uint32_t base_unit; ++ /* number of unit to allocate */ ++ uint32_t num_unit; ++ /* alignement to be applied on allocation */ ++ uint32_t alignement; ++ /* identity of who allocated this block */ ++ uint32_t allocator; ++ /* resource name (for easier tracking on vc side) */ ++ char name[VC_SM_RESOURCE_NAME]; ++ ++} VC_SM_ALLOC_T; ++ ++/* Result of a requested memory allocation (VC->HOST) */ ++typedef struct { ++ /* Transaction identifier */ ++ uint32_t trans_id; ++ ++ /* Resource handle */ ++ uint32_t res_handle; ++ /* Pointer to resource buffer */ ++ void *res_mem; ++ /* Resource base size (bytes) */ ++ uint32_t res_base_size; ++ /* Resource number */ ++ uint32_t res_num; ++ ++} VC_SM_ALLOC_RESULT_T; ++ ++/* Request to free a previously allocated memory (HOST->VC) */ ++typedef struct { ++ /* Resource handle (returned from alloc) */ ++ uint32_t res_handle; ++ /* Resource buffer (returned from alloc) */ ++ void *res_mem; ++ ++} VC_SM_FREE_T; ++ ++/* Request to lock a previously allocated memory (HOST->VC) */ ++typedef struct { ++ /* Resource handle (returned from alloc) */ ++ uint32_t res_handle; ++ /* Resource buffer (returned from alloc) */ ++ void *res_mem; ++ ++} VC_SM_LOCK_UNLOCK_T; ++ ++/* Request to resize a previously allocated memory (HOST->VC) */ ++typedef struct { ++ /* Resource handle (returned from alloc) */ ++ uint32_t res_handle; ++ /* Resource buffer (returned from alloc) */ ++ void *res_mem; ++ /* Resource *new* size requested (bytes) */ ++ uint32_t res_new_size; ++ ++} VC_SM_RESIZE_T; ++ ++/* Result of a requested memory lock (VC->HOST) */ ++typedef struct { ++ /* Transaction identifier */ ++ uint32_t trans_id; ++ ++ /* Resource handle */ ++ uint32_t res_handle; ++ /* Pointer to resource buffer */ ++ void *res_mem; ++ /* Pointer to former resource buffer if the memory ++ * was reallocated */ ++ void *res_old_mem; ++ ++} VC_SM_LOCK_RESULT_T; ++ ++/* Generic result for a request (VC->HOST) */ ++typedef struct { ++ /* Transaction identifier */ ++ uint32_t trans_id; ++ ++ int32_t success; ++ ++} VC_SM_RESULT_T; ++ ++/* Request to revert a previously applied action (HOST->VC) */ ++typedef struct { ++ /* Action of interest */ ++ VC_SM_MSG_TYPE res_action; ++ /* Transaction identifier for the action of interest */ ++ uint32_t action_trans_id; ++ ++} VC_SM_ACTION_CLEAN_T; ++ ++/* Request to remove all data associated with a given allocator (HOST->VC) */ ++typedef struct { ++ /* Allocator identifier */ ++ uint32_t allocator; ++ ++} VC_SM_FREE_ALL_T; ++ ++/* Union of ALL messages */ ++typedef union { ++ VC_SM_ALLOC_T alloc; ++ VC_SM_ALLOC_RESULT_T alloc_result; ++ VC_SM_FREE_T free; ++ VC_SM_ACTION_CLEAN_T action_clean; ++ VC_SM_RESIZE_T resize; ++ VC_SM_LOCK_RESULT_T lock_result; ++ VC_SM_RESULT_T result; ++ VC_SM_FREE_ALL_T free_all; ++ ++} VC_SM_MSG_UNION_T; ++ ++#endif /* __VC_SM_DEFS_H__INCLUDED__ */ +diff --git a/drivers/char/broadcom/vc_sm/vc_sm_knl.h b/drivers/char/broadcom/vc_sm/vc_sm_knl.h +new file mode 100644 +index 0000000..965f9a2 +--- /dev/null ++++ b/drivers/char/broadcom/vc_sm/vc_sm_knl.h +@@ -0,0 +1,55 @@ ++/***************************************************************************** ++* Copyright 2011 Broadcom Corporation. All rights reserved. ++* ++* Unless you and Broadcom execute a separate written software license ++* agreement governing use of this software, this software is licensed to you ++* under the terms of the GNU General Public License version 2, available at ++* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). ++* ++* Notwithstanding the above, under no circumstances may you combine this ++* software in any way with any other Broadcom software provided under a ++* license other than the GPL, without Broadcom's express prior written ++* consent. ++*****************************************************************************/ ++ ++#ifndef __VC_SM_KNL_H__INCLUDED__ ++#define __VC_SM_KNL_H__INCLUDED__ ++ ++#if !defined(__KERNEL__) ++#error "This interface is for kernel use only..." ++#endif ++ ++/* Type of memory to be locked (ie mapped) */ ++typedef enum { ++ VC_SM_LOCK_CACHED, ++ VC_SM_LOCK_NON_CACHED, ++ ++} VC_SM_LOCK_CACHE_MODE_T; ++ ++/* Allocate a shared memory handle and block. ++*/ ++int vc_sm_alloc(VC_SM_ALLOC_T *alloc, int *handle); ++ ++/* Free a previously allocated shared memory handle and block. ++*/ ++int vc_sm_free(int handle); ++ ++/* Lock a memory handle for use by kernel. ++*/ ++int vc_sm_lock(int handle, VC_SM_LOCK_CACHE_MODE_T mode, ++ long unsigned int *data); ++ ++/* Unlock a memory handle in use by kernel. ++*/ ++int vc_sm_unlock(int handle, int flush, int no_vc_unlock); ++ ++/* Get an internal resource handle mapped from the external one. ++*/ ++int vc_sm_int_handle(int handle); ++ ++/* Map a shared memory region for use by kernel. ++*/ ++int vc_sm_map(int handle, unsigned int sm_addr, VC_SM_LOCK_CACHE_MODE_T mode, ++ long unsigned int *data); ++ ++#endif /* __VC_SM_KNL_H__INCLUDED__ */ +diff --git a/drivers/char/broadcom/vc_sm/vc_vchi_sm.c b/drivers/char/broadcom/vc_sm/vc_vchi_sm.c +new file mode 100644 +index 0000000..7c6ba1a +--- /dev/null ++++ b/drivers/char/broadcom/vc_sm/vc_vchi_sm.c +@@ -0,0 +1,492 @@ ++/***************************************************************************** ++* Copyright 2011-2012 Broadcom Corporation. All rights reserved. ++* ++* Unless you and Broadcom execute a separate written software license ++* agreement governing use of this software, this software is licensed to you ++* under the terms of the GNU General Public License version 2, available at ++* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). ++* ++* Notwithstanding the above, under no circumstances may you combine this ++* software in any way with any other Broadcom software provided under a ++* license other than the GPL, without Broadcom's express prior written ++* consent. ++*****************************************************************************/ ++ ++/* ---- Include Files ----------------------------------------------------- */ ++#include <linux/types.h> ++#include <linux/kernel.h> ++#include <linux/list.h> ++#include <linux/semaphore.h> ++#include <linux/mutex.h> ++#include <linux/slab.h> ++#include <linux/kthread.h> ++ ++#include "vc_vchi_sm.h" ++ ++#define VC_SM_VER 1 ++#define VC_SM_MIN_VER 0 ++ ++/* ---- Private Constants and Types -------------------------------------- */ ++ ++/* Command blocks come from a pool */ ++#define SM_MAX_NUM_CMD_RSP_BLKS 32 ++ ++struct sm_cmd_rsp_blk { ++ struct list_head head; /* To create lists */ ++ struct semaphore sema; /* To be signaled when the response is there */ ++ ++ uint16_t id; ++ uint16_t length; ++ ++ uint8_t msg[VC_SM_MAX_MSG_LEN]; ++ ++ uint32_t wait:1; ++ uint32_t sent:1; ++ uint32_t alloc:1; ++ ++}; ++ ++struct sm_instance { ++ uint32_t num_connections; ++ VCHI_SERVICE_HANDLE_T vchi_handle[VCHI_MAX_NUM_CONNECTIONS]; ++ struct task_struct *io_thread; ++ struct semaphore io_sema; ++ ++ uint32_t trans_id; ++ ++ struct mutex lock; ++ struct list_head cmd_list; ++ struct list_head rsp_list; ++ struct list_head dead_list; ++ ++ struct sm_cmd_rsp_blk free_blk[SM_MAX_NUM_CMD_RSP_BLKS]; ++ struct list_head free_list; ++ struct mutex free_lock; ++ struct semaphore free_sema; ++ ++}; ++ ++/* ---- Private Variables ------------------------------------------------ */ ++ ++/* ---- Private Function Prototypes -------------------------------------- */ ++ ++/* ---- Private Functions ------------------------------------------------ */ ++static struct ++sm_cmd_rsp_blk *vc_vchi_cmd_create(struct sm_instance *instance, ++ VC_SM_MSG_TYPE id, void *msg, ++ uint32_t size, int wait) ++{ ++ struct sm_cmd_rsp_blk *blk; ++ VC_SM_MSG_HDR_T *hdr; ++ ++ if (down_interruptible(&instance->free_sema)) { ++ blk = kmalloc(sizeof(*blk), GFP_KERNEL); ++ if (!blk) ++ return NULL; ++ ++ blk->alloc = 1; ++ sema_init(&blk->sema, 0); ++ } else { ++ mutex_lock(&instance->free_lock); ++ blk = ++ list_first_entry(&instance->free_list, ++ struct sm_cmd_rsp_blk, head); ++ list_del(&blk->head); ++ mutex_unlock(&instance->free_lock); ++ } ++ ++ blk->sent = 0; ++ blk->wait = wait; ++ blk->length = sizeof(*hdr) + size; ++ ++ hdr = (VC_SM_MSG_HDR_T *) blk->msg; ++ hdr->type = id; ++ mutex_lock(&instance->lock); ++ hdr->trans_id = blk->id = ++instance->trans_id; ++ mutex_unlock(&instance->lock); ++ ++ if (size) ++ memcpy(hdr->body, msg, size); ++ ++ return blk; ++} ++ ++static void ++vc_vchi_cmd_delete(struct sm_instance *instance, struct sm_cmd_rsp_blk *blk) ++{ ++ if (blk->alloc) { ++ kfree(blk); ++ return; ++ } ++ ++ mutex_lock(&instance->free_lock); ++ list_add(&blk->head, &instance->free_list); ++ mutex_unlock(&instance->free_lock); ++ up(&instance->free_sema); ++} ++ ++static int vc_vchi_sm_videocore_io(void *arg) ++{ ++ struct sm_instance *instance = arg; ++ struct sm_cmd_rsp_blk *cmd = NULL, *cmd_tmp; ++ VC_SM_RESULT_T *reply; ++ uint32_t reply_len; ++ int32_t status; ++ int svc_use = 1; ++ ++ while (1) { ++ if (svc_use) ++ vchi_service_release(instance->vchi_handle[0]); ++ svc_use = 0; ++ if (!down_interruptible(&instance->io_sema)) { ++ vchi_service_use(instance->vchi_handle[0]); ++ svc_use = 1; ++ ++ do { ++ unsigned int flags; ++ /* ++ * Get new command and move it to response list ++ */ ++ mutex_lock(&instance->lock); ++ if (list_empty(&instance->cmd_list)) { ++ /* no more commands to process */ ++ mutex_unlock(&instance->lock); ++ break; ++ } ++ cmd = ++ list_first_entry(&instance->cmd_list, ++ struct sm_cmd_rsp_blk, ++ head); ++ list_move(&cmd->head, &instance->rsp_list); ++ cmd->sent = 1; ++ mutex_unlock(&instance->lock); ++ ++ /* Send the command */ ++ flags = VCHI_FLAGS_BLOCK_UNTIL_QUEUED; ++ status = vchi_msg_queue( ++ instance->vchi_handle[0], ++ cmd->msg, cmd->length, ++ flags, NULL); ++ if (status) { ++ pr_err("%s: failed to queue message (%d)", ++ __func__, status); ++ } ++ ++ /* If no reply is needed then we're done */ ++ if (!cmd->wait) { ++ mutex_lock(&instance->lock); ++ list_del(&cmd->head); ++ mutex_unlock(&instance->lock); ++ vc_vchi_cmd_delete(instance, cmd); ++ continue; ++ } ++ ++ if (status) { ++ up(&cmd->sema); ++ continue; ++ } ++ ++ } while (1); ++ ++ while (!vchi_msg_peek ++ (instance->vchi_handle[0], (void **)&reply, ++ &reply_len, VCHI_FLAGS_NONE)) { ++ mutex_lock(&instance->lock); ++ list_for_each_entry(cmd, &instance->rsp_list, ++ head) { ++ if (cmd->id == reply->trans_id) ++ break; ++ } ++ mutex_unlock(&instance->lock); ++ ++ if (&cmd->head == &instance->rsp_list) { ++ pr_debug("%s: received response %u, throw away...", ++ __func__, reply->trans_id); ++ } else if (reply_len > sizeof(cmd->msg)) { ++ pr_err("%s: reply too big (%u) %u, throw away...", ++ __func__, reply_len, ++ reply->trans_id); ++ } else { ++ memcpy(cmd->msg, reply, reply_len); ++ up(&cmd->sema); ++ } ++ ++ vchi_msg_remove(instance->vchi_handle[0]); ++ } ++ ++ /* Go through the dead list and free them */ ++ mutex_lock(&instance->lock); ++ list_for_each_entry_safe(cmd, cmd_tmp, ++ &instance->dead_list, head) { ++ list_del(&cmd->head); ++ vc_vchi_cmd_delete(instance, cmd); ++ } ++ mutex_unlock(&instance->lock); ++ } ++ } ++ ++ return 0; ++} ++ ++static void vc_sm_vchi_callback(void *param, ++ const VCHI_CALLBACK_REASON_T reason, ++ void *msg_handle) ++{ ++ struct sm_instance *instance = param; ++ ++ (void)msg_handle; ++ ++ switch (reason) { ++ case VCHI_CALLBACK_MSG_AVAILABLE: ++ up(&instance->io_sema); ++ break; ++ ++ case VCHI_CALLBACK_SERVICE_CLOSED: ++ pr_info("%s: service CLOSED!!", __func__); ++ default: ++ break; ++ } ++} ++ ++VC_VCHI_SM_HANDLE_T vc_vchi_sm_init(VCHI_INSTANCE_T vchi_instance, ++ VCHI_CONNECTION_T **vchi_connections, ++ uint32_t num_connections) ++{ ++ uint32_t i; ++ struct sm_instance *instance; ++ int status; ++ ++ pr_debug("%s: start", __func__); ++ ++ if (num_connections > VCHI_MAX_NUM_CONNECTIONS) { ++ pr_err("%s: unsupported number of connections %u (max=%u)", ++ __func__, num_connections, VCHI_MAX_NUM_CONNECTIONS); ++ ++ goto err_null; ++ } ++ /* Allocate memory for this instance */ ++ instance = kzalloc(sizeof(*instance), GFP_KERNEL); ++ ++ /* Misc initialisations */ ++ mutex_init(&instance->lock); ++ sema_init(&instance->io_sema, 0); ++ INIT_LIST_HEAD(&instance->cmd_list); ++ INIT_LIST_HEAD(&instance->rsp_list); ++ INIT_LIST_HEAD(&instance->dead_list); ++ INIT_LIST_HEAD(&instance->free_list); ++ sema_init(&instance->free_sema, SM_MAX_NUM_CMD_RSP_BLKS); ++ mutex_init(&instance->free_lock); ++ for (i = 0; i < SM_MAX_NUM_CMD_RSP_BLKS; i++) { ++ sema_init(&instance->free_blk[i].sema, 0); ++ list_add(&instance->free_blk[i].head, &instance->free_list); ++ } ++ ++ /* Open the VCHI service connections */ ++ instance->num_connections = num_connections; ++ for (i = 0; i < num_connections; i++) { ++ SERVICE_CREATION_T params = { ++ VCHI_VERSION_EX(VC_SM_VER, VC_SM_MIN_VER), ++ VC_SM_SERVER_NAME, ++ vchi_connections[i], ++ 0, ++ 0, ++ vc_sm_vchi_callback, ++ instance, ++ 0, ++ 0, ++ 0, ++ }; ++ ++ status = vchi_service_open(vchi_instance, ++ &params, &instance->vchi_handle[i]); ++ if (status) { ++ pr_err("%s: failed to open VCHI service (%d)", ++ __func__, status); ++ ++ goto err_close_services; ++ } ++ } ++ ++ /* Create the thread which takes care of all io to/from videoocore. */ ++ instance->io_thread = kthread_create(&vc_vchi_sm_videocore_io, ++ (void *)instance, "SMIO"); ++ if (instance->io_thread == NULL) { ++ pr_err("%s: failed to create SMIO thread", __func__); ++ ++ goto err_close_services; ++ } ++ set_user_nice(instance->io_thread, -10); ++ wake_up_process(instance->io_thread); ++ ++ pr_debug("%s: success - instance 0x%x", __func__, (unsigned)instance); ++ return instance; ++ ++err_close_services: ++ for (i = 0; i < instance->num_connections; i++) { ++ if (instance->vchi_handle[i] != NULL) ++ vchi_service_close(instance->vchi_handle[i]); ++ } ++ kfree(instance); ++err_null: ++ pr_debug("%s: FAILED", __func__); ++ return NULL; ++} ++ ++int vc_vchi_sm_stop(VC_VCHI_SM_HANDLE_T *handle) ++{ ++ struct sm_instance *instance; ++ uint32_t i; ++ ++ if (handle == NULL) { ++ pr_err("%s: invalid pointer to handle %p", __func__, handle); ++ goto lock; ++ } ++ ++ if (*handle == NULL) { ++ pr_err("%s: invalid handle %p", __func__, *handle); ++ goto lock; ++ } ++ ++ instance = *handle; ++ ++ /* Close all VCHI service connections */ ++ for (i = 0; i < instance->num_connections; i++) { ++ int32_t success; ++ vchi_service_use(instance->vchi_handle[i]); ++ ++ success = vchi_service_close(instance->vchi_handle[i]); ++ } ++ ++ kfree(instance); ++ ++ *handle = NULL; ++ return 0; ++ ++lock: ++ return -EINVAL; ++} ++ ++int vc_vchi_sm_send_msg(VC_VCHI_SM_HANDLE_T handle, ++ VC_SM_MSG_TYPE msg_id, ++ void *msg, uint32_t msg_size, ++ void *result, uint32_t result_size, ++ uint32_t *cur_trans_id, uint8_t wait_reply) ++{ ++ int status = 0; ++ struct sm_instance *instance = handle; ++ struct sm_cmd_rsp_blk *cmd_blk; ++ ++ if (handle == NULL) { ++ pr_err("%s: invalid handle", __func__); ++ return -EINVAL; ++ } ++ if (msg == NULL) { ++ pr_err("%s: invalid msg pointer", __func__); ++ return -EINVAL; ++ } ++ ++ cmd_blk = ++ vc_vchi_cmd_create(instance, msg_id, msg, msg_size, wait_reply); ++ if (cmd_blk == NULL) { ++ pr_err("[%s]: failed to allocate global tracking resource", ++ __func__); ++ return -ENOMEM; ++ } ++ ++ if (cur_trans_id != NULL) ++ *cur_trans_id = cmd_blk->id; ++ ++ mutex_lock(&instance->lock); ++ list_add_tail(&cmd_blk->head, &instance->cmd_list); ++ mutex_unlock(&instance->lock); ++ up(&instance->io_sema); ++ ++ if (!wait_reply) ++ /* We're done */ ++ return 0; ++ ++ /* Wait for the response */ ++ if (down_interruptible(&cmd_blk->sema)) { ++ mutex_lock(&instance->lock); ++ if (!cmd_blk->sent) { ++ list_del(&cmd_blk->head); ++ mutex_unlock(&instance->lock); ++ vc_vchi_cmd_delete(instance, cmd_blk); ++ return -ENXIO; ++ } ++ mutex_unlock(&instance->lock); ++ ++ mutex_lock(&instance->lock); ++ list_move(&cmd_blk->head, &instance->dead_list); ++ mutex_unlock(&instance->lock); ++ up(&instance->io_sema); ++ return -EINTR; /* We're done */ ++ } ++ ++ if (result && result_size) { ++ memcpy(result, cmd_blk->msg, result_size); ++ } else { ++ VC_SM_RESULT_T *res = (VC_SM_RESULT_T *) cmd_blk->msg; ++ status = (res->success == 0) ? 0 : -ENXIO; ++ } ++ ++ mutex_lock(&instance->lock); ++ list_del(&cmd_blk->head); ++ mutex_unlock(&instance->lock); ++ vc_vchi_cmd_delete(instance, cmd_blk); ++ return status; ++} ++ ++int vc_vchi_sm_alloc(VC_VCHI_SM_HANDLE_T handle, VC_SM_ALLOC_T *msg, ++ VC_SM_ALLOC_RESULT_T *result, uint32_t *cur_trans_id) ++{ ++ return vc_vchi_sm_send_msg(handle, VC_SM_MSG_TYPE_ALLOC, ++ msg, sizeof(*msg), result, sizeof(*result), ++ cur_trans_id, 1); ++} ++ ++int vc_vchi_sm_free(VC_VCHI_SM_HANDLE_T handle, ++ VC_SM_FREE_T *msg, uint32_t *cur_trans_id) ++{ ++ return vc_vchi_sm_send_msg(handle, VC_SM_MSG_TYPE_FREE, ++ msg, sizeof(*msg), 0, 0, cur_trans_id, 0); ++} ++ ++int vc_vchi_sm_lock(VC_VCHI_SM_HANDLE_T handle, ++ VC_SM_LOCK_UNLOCK_T *msg, ++ VC_SM_LOCK_RESULT_T *result, uint32_t *cur_trans_id) ++{ ++ return vc_vchi_sm_send_msg(handle, VC_SM_MSG_TYPE_LOCK, ++ msg, sizeof(*msg), result, sizeof(*result), ++ cur_trans_id, 1); ++} ++ ++int vc_vchi_sm_unlock(VC_VCHI_SM_HANDLE_T handle, ++ VC_SM_LOCK_UNLOCK_T *msg, ++ uint32_t *cur_trans_id, uint8_t wait_reply) ++{ ++ return vc_vchi_sm_send_msg(handle, wait_reply ? ++ VC_SM_MSG_TYPE_UNLOCK : ++ VC_SM_MSG_TYPE_UNLOCK_NOANS, msg, ++ sizeof(*msg), 0, 0, cur_trans_id, ++ wait_reply); ++} ++ ++int vc_vchi_sm_resize(VC_VCHI_SM_HANDLE_T handle, VC_SM_RESIZE_T *msg, ++ uint32_t *cur_trans_id) ++{ ++ return vc_vchi_sm_send_msg(handle, VC_SM_MSG_TYPE_RESIZE, ++ msg, sizeof(*msg), 0, 0, cur_trans_id, 1); ++} ++ ++int vc_vchi_sm_walk_alloc(VC_VCHI_SM_HANDLE_T handle) ++{ ++ return vc_vchi_sm_send_msg(handle, VC_SM_MSG_TYPE_WALK_ALLOC, ++ 0, 0, 0, 0, 0, 0); ++} ++ ++int vc_vchi_sm_clean_up(VC_VCHI_SM_HANDLE_T handle, VC_SM_ACTION_CLEAN_T *msg) ++{ ++ return vc_vchi_sm_send_msg(handle, VC_SM_MSG_TYPE_ACTION_CLEAN, ++ msg, sizeof(*msg), 0, 0, 0, 0); ++} +diff --git a/drivers/char/broadcom/vc_sm/vc_vchi_sm.h b/drivers/char/broadcom/vc_sm/vc_vchi_sm.h +new file mode 100644 +index 0000000..5e279f5 +--- /dev/null ++++ b/drivers/char/broadcom/vc_sm/vc_vchi_sm.h +@@ -0,0 +1,82 @@ ++/***************************************************************************** ++* Copyright 2011 Broadcom Corporation. All rights reserved. ++* ++* Unless you and Broadcom execute a separate written software license ++* agreement governing use of this software, this software is licensed to you ++* under the terms of the GNU General Public License version 2, available at ++* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). ++* ++* Notwithstanding the above, under no circumstances may you combine this ++* software in any way with any other Broadcom software provided under a ++* license other than the GPL, without Broadcom's express prior written ++* consent. ++*****************************************************************************/ ++ ++#ifndef __VC_VCHI_SM_H__INCLUDED__ ++#define __VC_VCHI_SM_H__INCLUDED__ ++ ++#include "interface/vchi/vchi.h" ++ ++#include "vc_sm_defs.h" ++ ++/* Forward declare. ++*/ ++typedef struct sm_instance *VC_VCHI_SM_HANDLE_T; ++ ++/* Initialize the shared memory service, opens up vchi connection to talk to it. ++*/ ++VC_VCHI_SM_HANDLE_T vc_vchi_sm_init(VCHI_INSTANCE_T vchi_instance, ++ VCHI_CONNECTION_T **vchi_connections, ++ uint32_t num_connections); ++ ++/* Terminates the shared memory service. ++*/ ++int vc_vchi_sm_stop(VC_VCHI_SM_HANDLE_T *handle); ++ ++/* Ask the shared memory service to allocate some memory on videocre and ++** return the result of this allocation (which upon success will be a pointer ++** to some memory in videocore space). ++*/ ++int vc_vchi_sm_alloc(VC_VCHI_SM_HANDLE_T handle, ++ VC_SM_ALLOC_T *alloc, ++ VC_SM_ALLOC_RESULT_T *alloc_result, uint32_t *trans_id); ++ ++/* Ask the shared memory service to free up some memory that was previously ++** allocated by the vc_vchi_sm_alloc function call. ++*/ ++int vc_vchi_sm_free(VC_VCHI_SM_HANDLE_T handle, ++ VC_SM_FREE_T *free, uint32_t *trans_id); ++ ++/* Ask the shared memory service to lock up some memory that was previously ++** allocated by the vc_vchi_sm_alloc function call. ++*/ ++int vc_vchi_sm_lock(VC_VCHI_SM_HANDLE_T handle, ++ VC_SM_LOCK_UNLOCK_T *lock_unlock, ++ VC_SM_LOCK_RESULT_T *lock_result, uint32_t *trans_id); ++ ++/* Ask the shared memory service to unlock some memory that was previously ++** allocated by the vc_vchi_sm_alloc function call. ++*/ ++int vc_vchi_sm_unlock(VC_VCHI_SM_HANDLE_T handle, ++ VC_SM_LOCK_UNLOCK_T *lock_unlock, ++ uint32_t *trans_id, uint8_t wait_reply); ++ ++/* Ask the shared memory service to resize some memory that was previously ++** allocated by the vc_vchi_sm_alloc function call. ++*/ ++int vc_vchi_sm_resize(VC_VCHI_SM_HANDLE_T handle, ++ VC_SM_RESIZE_T *resize, uint32_t *trans_id); ++ ++/* Walk the allocated resources on the videocore side, the allocation will ++** show up in the log. This is purely for debug/information and takes no ++** specific actions. ++*/ ++int vc_vchi_sm_walk_alloc(VC_VCHI_SM_HANDLE_T handle); ++ ++/* Clean up following a previously interrupted action which left the system ++** in a bad state of some sort. ++*/ ++int vc_vchi_sm_clean_up(VC_VCHI_SM_HANDLE_T handle, ++ VC_SM_ACTION_CLEAN_T *action_clean); ++ ++#endif /* __VC_VCHI_SM_H__INCLUDED__ */ +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +new file mode 100644 +index 0000000..1db6716 +--- /dev/null ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -0,0 +1,3213 @@ ++/***************************************************************************** ++* Copyright 2011-2012 Broadcom Corporation. All rights reserved. ++* ++* Unless you and Broadcom execute a separate written software license ++* agreement governing use of this software, this software is licensed to you ++* under the terms of the GNU General Public License version 2, available at ++* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). ++* ++* Notwithstanding the above, under no circumstances may you combine this ++* software in any way with any other Broadcom software provided under a ++* license other than the GPL, without Broadcom's express prior written ++* consent. ++*****************************************************************************/ ++ ++/* ---- Include Files ----------------------------------------------------- */ ++ ++#include <linux/cdev.h> ++#include <linux/broadcom/vc_mem.h> ++#include <linux/device.h> ++#include <linux/debugfs.h> ++#include <linux/dma-mapping.h> ++#include <linux/errno.h> ++#include <linux/fs.h> ++#include <linux/hugetlb.h> ++#include <linux/ioctl.h> ++#include <linux/kernel.h> ++#include <linux/list.h> ++#include <linux/module.h> ++#include <linux/mm.h> ++#include <linux/pfn.h> ++#include <linux/proc_fs.h> ++#include <linux/pagemap.h> ++#include <linux/semaphore.h> ++#include <linux/slab.h> ++#include <linux/seq_file.h> ++#include <linux/types.h> ++#include <asm/cacheflush.h> ++ ++#include "vchiq_connected.h" ++#include "vc_vchi_sm.h" ++ ++#include <linux/broadcom/vmcs_sm_ioctl.h> ++#include "vc_sm_knl.h" ++ ++/* ---- Private Constants and Types --------------------------------------- */ ++ ++#define DEVICE_NAME "vcsm" ++#define DEVICE_MINOR 0 ++ ++#define VC_SM_DIR_ROOT_NAME "vc-smem" ++#define VC_SM_DIR_ALLOC_NAME "alloc" ++#define VC_SM_STATE "state" ++#define VC_SM_STATS "statistics" ++#define VC_SM_RESOURCES "resources" ++#define VC_SM_DEBUG "debug" ++#define VC_SM_WRITE_BUF_SIZE 128 ++ ++/* Statistics tracked per resource and globally. ++*/ ++enum SM_STATS_T { ++ /* Attempt. */ ++ ALLOC, ++ FREE, ++ LOCK, ++ UNLOCK, ++ MAP, ++ FLUSH, ++ INVALID, ++ ++ END_ATTEMPT, ++ ++ /* Failure. */ ++ ALLOC_FAIL, ++ FREE_FAIL, ++ LOCK_FAIL, ++ UNLOCK_FAIL, ++ MAP_FAIL, ++ FLUSH_FAIL, ++ INVALID_FAIL, ++ ++ END_ALL, ++ ++}; ++ ++static const char *const sm_stats_human_read[] = { ++ "Alloc", ++ "Free", ++ "Lock", ++ "Unlock", ++ "Map", ++ "Cache Flush", ++ "Cache Invalidate", ++}; ++ ++typedef int (*VC_SM_SHOW) (struct seq_file *s, void *v); ++struct SM_PDE_T { ++ VC_SM_SHOW show; /* Debug fs function hookup. */ ++ struct dentry *dir_entry; /* Debug fs directory entry. */ ++ void *priv_data; /* Private data */ ++ ++}; ++ ++/* Single resource allocation tracked for all devices. ++*/ ++struct sm_mmap { ++ struct list_head map_list; /* Linked list of maps. */ ++ ++ struct SM_RESOURCE_T *resource; /* Pointer to the resource. */ ++ ++ pid_t res_pid; /* PID owning that resource. */ ++ unsigned int res_vc_hdl; /* Resource handle (videocore). */ ++ unsigned int res_usr_hdl; /* Resource handle (user). */ ++ ++ long unsigned int res_addr; /* Mapped virtual address. */ ++ struct vm_area_struct *vma; /* VM area for this mapping. */ ++ unsigned int ref_count; /* Reference count to this vma. */ ++ ++ /* Used to link maps associated with a resource. */ ++ struct list_head resource_map_list; ++}; ++ ++/* Single resource allocation tracked for each opened device. ++*/ ++struct SM_RESOURCE_T { ++ struct list_head resource_list; /* List of resources. */ ++ struct list_head global_resource_list; /* Global list of resources. */ ++ ++ pid_t pid; /* PID owning that resource. */ ++ uint32_t res_guid; /* Unique identifier. */ ++ uint32_t lock_count; /* Lock count for this resource. */ ++ uint32_t ref_count; /* Ref count for this resource. */ ++ ++ uint32_t res_handle; /* Resource allocation handle. */ ++ void *res_base_mem; /* Resource base memory address. */ ++ uint32_t res_size; /* Resource size allocated. */ ++ enum vmcs_sm_cache_e res_cached; /* Resource cache type. */ ++ struct SM_RESOURCE_T *res_shared; /* Shared resource */ ++ ++ enum SM_STATS_T res_stats[END_ALL]; /* Resource statistics. */ ++ ++ uint8_t map_count; /* Counter of mappings for this resource. */ ++ struct list_head map_list; /* Maps associated with a resource. */ ++ ++ struct SM_PRIV_DATA_T *private; ++}; ++ ++/* Private file data associated with each opened device. ++*/ ++struct SM_PRIV_DATA_T { ++ struct list_head resource_list; /* List of resources. */ ++ ++ pid_t pid; /* PID of creator. */ ++ ++ struct dentry *dir_pid; /* Debug fs entries root. */ ++ struct SM_PDE_T dir_stats; /* Debug fs entries statistics sub-tree. */ ++ struct SM_PDE_T dir_res; /* Debug fs resource sub-tree. */ ++ ++ int restart_sys; /* Tracks restart on interrupt. */ ++ VC_SM_MSG_TYPE int_action; /* Interrupted action. */ ++ uint32_t int_trans_id; /* Interrupted transaction. */ ++ ++}; ++ ++/* Global state information. ++*/ ++struct SM_STATE_T { ++ VC_VCHI_SM_HANDLE_T sm_handle; /* Handle for videocore service. */ ++ struct dentry *dir_root; /* Debug fs entries root. */ ++ struct dentry *dir_alloc; /* Debug fs entries allocations. */ ++ struct SM_PDE_T dir_stats; /* Debug fs entries statistics sub-tree. */ ++ struct SM_PDE_T dir_state; /* Debug fs entries state sub-tree. */ ++ struct dentry *debug; /* Debug fs entries debug. */ ++ ++ struct mutex map_lock; /* Global map lock. */ ++ struct list_head map_list; /* List of maps. */ ++ struct list_head resource_list; /* List of resources. */ ++ ++ enum SM_STATS_T deceased[END_ALL]; /* Natural termination stats. */ ++ enum SM_STATS_T terminated[END_ALL]; /* Forced termination stats. */ ++ uint32_t res_deceased_cnt; /* Natural termination counter. */ ++ uint32_t res_terminated_cnt; /* Forced termination counter. */ ++ ++ struct cdev sm_cdev; /* Device. */ ++ dev_t sm_devid; /* Device identifier. */ ++ struct class *sm_class; /* Class. */ ++ struct device *sm_dev; /* Device. */ ++ ++ struct SM_PRIV_DATA_T *data_knl; /* Kernel internal data tracking. */ ++ ++ struct mutex lock; /* Global lock. */ ++ uint32_t guid; /* GUID (next) tracker. */ ++ ++}; ++ ++/* ---- Private Variables ----------------------------------------------- */ ++ ++static struct SM_STATE_T *sm_state; ++static int sm_inited; ++ ++#if 0 ++static const char *const sm_cache_map_vector[] = { ++ "(null)", ++ "host", ++ "videocore", ++ "host+videocore", ++}; ++#endif ++ ++/* ---- Private Function Prototypes -------------------------------------- */ ++ ++/* ---- Private Functions ------------------------------------------------ */ ++ ++static inline unsigned vcaddr_to_pfn(unsigned long vc_addr) ++{ ++ unsigned long pfn = vc_addr & 0x3FFFFFFF; ++ pfn += mm_vc_mem_phys_addr; ++ pfn >>= PAGE_SHIFT; ++ return pfn; ++} ++ ++/* Carries over to the state statistics the statistics once owned by a deceased ++** resource. ++*/ ++static void vc_sm_resource_deceased(struct SM_RESOURCE_T *p_res, int terminated) ++{ ++ if (sm_state != NULL) { ++ if (p_res != NULL) { ++ int ix; ++ ++ if (terminated) ++ sm_state->res_terminated_cnt++; ++ else ++ sm_state->res_deceased_cnt++; ++ ++ for (ix = 0; ix < END_ALL; ix++) { ++ if (terminated) ++ sm_state->terminated[ix] += ++ p_res->res_stats[ix]; ++ else ++ sm_state->deceased[ix] += ++ p_res->res_stats[ix]; ++ } ++ } ++ } ++} ++ ++/* Fetch a videocore handle corresponding to a mapping of the pid+address ++** returns 0 (ie NULL) if no such handle exists in the global map. ++*/ ++static unsigned int vmcs_sm_vc_handle_from_pid_and_address(unsigned int pid, ++ unsigned int addr) ++{ ++ struct sm_mmap *map = NULL; ++ unsigned int handle = 0; ++ ++ if (!sm_state || addr == 0) ++ goto out; ++ ++ mutex_lock(&(sm_state->map_lock)); ++ ++ /* Lookup the resource. ++ */ ++ if (!list_empty(&sm_state->map_list)) { ++ list_for_each_entry(map, &sm_state->map_list, map_list) { ++ if (map->res_pid != pid || map->res_addr != addr) ++ continue; ++ ++ pr_debug("[%s]: global map %p (pid %u, addr %lx) -> vc-hdl %x (usr-hdl %x)\n", ++ __func__, map, map->res_pid, map->res_addr, ++ map->res_vc_hdl, map->res_usr_hdl); ++ ++ handle = map->res_vc_hdl; ++ break; ++ } ++ } ++ ++ mutex_unlock(&(sm_state->map_lock)); ++ ++out: ++ /* Use a debug log here as it may be a valid situation that we query ++ ** for something that is not mapped, we do not want a kernel log each ++ ** time around. ++ ** ++ ** There are other error log that would pop up accordingly if someone ++ ** subsequently tries to use something invalid after being told not to ++ ** use it... ++ */ ++ if (handle == 0) { ++ pr_debug("[%s]: not a valid map (pid %u, addr %x)\n", ++ __func__, pid, addr); ++ } ++ ++ return handle; ++} ++ ++/* Fetch a user handle corresponding to a mapping of the pid+address ++** returns 0 (ie NULL) if no such handle exists in the global map. ++*/ ++static unsigned int vmcs_sm_usr_handle_from_pid_and_address(unsigned int pid, ++ unsigned int addr) ++{ ++ struct sm_mmap *map = NULL; ++ unsigned int handle = 0; ++ ++ if (!sm_state || addr == 0) ++ goto out; ++ ++ mutex_lock(&(sm_state->map_lock)); ++ ++ /* Lookup the resource. ++ */ ++ if (!list_empty(&sm_state->map_list)) { ++ list_for_each_entry(map, &sm_state->map_list, map_list) { ++ if (map->res_pid != pid || map->res_addr != addr) ++ continue; ++ ++ pr_debug("[%s]: global map %p (pid %u, addr %lx) -> usr-hdl %x (vc-hdl %x)\n", ++ __func__, map, map->res_pid, map->res_addr, ++ map->res_usr_hdl, map->res_vc_hdl); ++ ++ handle = map->res_usr_hdl; ++ break; ++ } ++ } ++ ++ mutex_unlock(&(sm_state->map_lock)); ++ ++out: ++ /* Use a debug log here as it may be a valid situation that we query ++ * for something that is not mapped yet. ++ * ++ * There are other error log that would pop up accordingly if someone ++ * subsequently tries to use something invalid after being told not to ++ * use it... ++ */ ++ if (handle == 0) ++ pr_debug("[%s]: not a valid map (pid %u, addr %x)\n", ++ __func__, pid, addr); ++ ++ return handle; ++} ++ ++#if defined(DO_NOT_USE) ++/* Fetch an address corresponding to a mapping of the pid+handle ++** returns 0 (ie NULL) if no such address exists in the global map. ++*/ ++static unsigned int vmcs_sm_usr_address_from_pid_and_vc_handle(unsigned int pid, ++ unsigned int hdl) ++{ ++ struct sm_mmap *map = NULL; ++ unsigned int addr = 0; ++ ++ if (sm_state == NULL || hdl == 0) ++ goto out; ++ ++ mutex_lock(&(sm_state->map_lock)); ++ ++ /* Lookup the resource. ++ */ ++ if (!list_empty(&sm_state->map_list)) { ++ list_for_each_entry(map, &sm_state->map_list, map_list) { ++ if (map->res_pid != pid || map->res_vc_hdl != hdl) ++ continue; ++ ++ pr_debug("[%s]: global map %p (pid %u, vc-hdl %x, usr-hdl %x) -> addr %lx\n", ++ __func__, map, map->res_pid, map->res_vc_hdl, ++ map->res_usr_hdl, map->res_addr); ++ ++ addr = map->res_addr; ++ break; ++ } ++ } ++ ++ mutex_unlock(&(sm_state->map_lock)); ++ ++out: ++ /* Use a debug log here as it may be a valid situation that we query ++ ** for something that is not mapped, we do not want a kernel log each ++ ** time around. ++ ** ++ ** There are other error log that would pop up accordingly if someone ++ ** subsequently tries to use something invalid after being told not to ++ ** use it... ++ */ ++ if (addr == 0) ++ pr_debug("[%s]: not a valid map (pid %u, hdl %x)\n", ++ __func__, pid, hdl); ++ ++ return addr; ++} ++#endif ++ ++/* Fetch an address corresponding to a mapping of the pid+handle ++** returns 0 (ie NULL) if no such address exists in the global map. ++*/ ++static unsigned int vmcs_sm_usr_address_from_pid_and_usr_handle(unsigned int ++ pid, ++ unsigned int ++ hdl) ++{ ++ struct sm_mmap *map = NULL; ++ unsigned int addr = 0; ++ ++ if (sm_state == NULL || hdl == 0) ++ goto out; ++ ++ mutex_lock(&(sm_state->map_lock)); ++ ++ /* Lookup the resource. ++ */ ++ if (!list_empty(&sm_state->map_list)) { ++ list_for_each_entry(map, &sm_state->map_list, map_list) { ++ if (map->res_pid != pid || map->res_usr_hdl != hdl) ++ continue; ++ ++ pr_debug("[%s]: global map %p (pid %u, vc-hdl %x, usr-hdl %x) -> addr %lx\n", ++ __func__, map, map->res_pid, map->res_vc_hdl, ++ map->res_usr_hdl, map->res_addr); ++ ++ addr = map->res_addr; ++ break; ++ } ++ } ++ ++ mutex_unlock(&(sm_state->map_lock)); ++ ++out: ++ /* Use a debug log here as it may be a valid situation that we query ++ * for something that is not mapped, we do not want a kernel log each ++ * time around. ++ * ++ * There are other error log that would pop up accordingly if someone ++ * subsequently tries to use something invalid after being told not to ++ * use it... ++ */ ++ if (addr == 0) ++ pr_debug("[%s]: not a valid map (pid %u, hdl %x)\n", __func__, ++ pid, hdl); ++ ++ return addr; ++} ++ ++/* Adds a resource mapping to the global data list. ++*/ ++static void vmcs_sm_add_map(struct SM_STATE_T *state, ++ struct SM_RESOURCE_T *resource, struct sm_mmap *map) ++{ ++ mutex_lock(&(state->map_lock)); ++ ++ /* Add to the global list of mappings ++ */ ++ list_add(&map->map_list, &state->map_list); ++ ++ /* Add to the list of mappings for this resource ++ */ ++ list_add(&map->resource_map_list, &resource->map_list); ++ resource->map_count++; ++ ++ mutex_unlock(&(state->map_lock)); ++ ++ pr_debug("[%s]: added map %p (pid %u, vc-hdl %x, usr-hdl %x, addr %lx)\n", ++ __func__, map, map->res_pid, map->res_vc_hdl, ++ map->res_usr_hdl, map->res_addr); ++} ++ ++/* Removes a resource mapping from the global data list. ++*/ ++static void vmcs_sm_remove_map(struct SM_STATE_T *state, ++ struct SM_RESOURCE_T *resource, ++ struct sm_mmap *map) ++{ ++ mutex_lock(&(state->map_lock)); ++ ++ /* Remove from the global list of mappings ++ */ ++ list_del(&map->map_list); ++ ++ /* Remove from the list of mapping for this resource ++ */ ++ list_del(&map->resource_map_list); ++ if (resource->map_count > 0) ++ resource->map_count--; ++ ++ mutex_unlock(&(state->map_lock)); ++ ++ pr_debug("[%s]: removed map %p (pid %d, vc-hdl %x, usr-hdl %x, addr %lx)\n", ++ __func__, map, map->res_pid, map->res_vc_hdl, map->res_usr_hdl, ++ map->res_addr); ++ ++ kfree(map); ++} ++ ++/* Read callback for the global state proc entry. ++*/ ++static int vc_sm_global_state_show(struct seq_file *s, void *v) ++{ ++ struct sm_mmap *map = NULL; ++ int map_count = 0; ++ ++ if (sm_state == NULL) ++ return 0; ++ ++ seq_printf(s, "\nVC-ServiceHandle 0x%x\n", ++ (unsigned int)sm_state->sm_handle); ++ ++ /* Log all applicable mapping(s). ++ */ ++ ++ mutex_lock(&(sm_state->map_lock)); ++ ++ if (!list_empty(&sm_state->map_list)) { ++ list_for_each_entry(map, &sm_state->map_list, map_list) { ++ map_count++; ++ ++ seq_printf(s, "\nMapping 0x%x\n", ++ (unsigned int)map); ++ seq_printf(s, " TGID %u\n", ++ map->res_pid); ++ seq_printf(s, " VC-HDL 0x%x\n", ++ map->res_vc_hdl); ++ seq_printf(s, " USR-HDL 0x%x\n", ++ map->res_usr_hdl); ++ seq_printf(s, " USR-ADDR 0x%lx\n", ++ map->res_addr); ++ } ++ } ++ ++ mutex_unlock(&(sm_state->map_lock)); ++ seq_printf(s, "\n\nTotal map count: %d\n\n", map_count); ++ ++ return 0; ++} ++ ++static int vc_sm_global_statistics_show(struct seq_file *s, void *v) ++{ ++ int ix; ++ ++ /* Global state tracked statistics. ++ */ ++ if (sm_state != NULL) { ++ seq_puts(s, "\nDeceased Resources Statistics\n"); ++ ++ seq_printf(s, "\nNatural Cause (%u occurences)\n", ++ sm_state->res_deceased_cnt); ++ for (ix = 0; ix < END_ATTEMPT; ix++) { ++ if (sm_state->deceased[ix] > 0) { ++ seq_printf(s, " %u\t%s\n", ++ sm_state->deceased[ix], ++ sm_stats_human_read[ix]); ++ } ++ } ++ seq_puts(s, "\n"); ++ for (ix = 0; ix < END_ATTEMPT; ix++) { ++ if (sm_state->deceased[ix + END_ATTEMPT] > 0) { ++ seq_printf(s, " %u\tFAILED %s\n", ++ sm_state->deceased[ix + END_ATTEMPT], ++ sm_stats_human_read[ix]); ++ } ++ } ++ ++ seq_printf(s, "\nForcefull (%u occurences)\n", ++ sm_state->res_terminated_cnt); ++ for (ix = 0; ix < END_ATTEMPT; ix++) { ++ if (sm_state->terminated[ix] > 0) { ++ seq_printf(s, " %u\t%s\n", ++ sm_state->terminated[ix], ++ sm_stats_human_read[ix]); ++ } ++ } ++ seq_puts(s, "\n"); ++ for (ix = 0; ix < END_ATTEMPT; ix++) { ++ if (sm_state->terminated[ix + END_ATTEMPT] > 0) { ++ seq_printf(s, " %u\tFAILED %s\n", ++ sm_state->terminated[ix + ++ END_ATTEMPT], ++ sm_stats_human_read[ix]); ++ } ++ } ++ } ++ ++ return 0; ++} ++ ++#if 0 ++/* Read callback for the statistics proc entry. ++*/ ++static int vc_sm_statistics_show(struct seq_file *s, void *v) ++{ ++ int ix; ++ struct SM_PRIV_DATA_T *file_data; ++ struct SM_RESOURCE_T *resource; ++ int res_count = 0; ++ struct SM_PDE_T *p_pde; ++ ++ p_pde = (struct SM_PDE_T *)(s->private); ++ file_data = (struct SM_PRIV_DATA_T *)(p_pde->priv_data); ++ ++ if (file_data == NULL) ++ return 0; ++ ++ /* Per process statistics. ++ */ ++ ++ seq_printf(s, "\nStatistics for TGID %d\n", file_data->pid); ++ ++ mutex_lock(&(sm_state->map_lock)); ++ ++ if (!list_empty(&file_data->resource_list)) { ++ list_for_each_entry(resource, &file_data->resource_list, ++ resource_list) { ++ res_count++; ++ ++ seq_printf(s, "\nGUID: 0x%x\n\n", ++ resource->res_guid); ++ for (ix = 0; ix < END_ATTEMPT; ix++) { ++ if (resource->res_stats[ix] > 0) { ++ seq_printf(s, ++ " %u\t%s\n", ++ resource->res_stats[ix], ++ sm_stats_human_read[ix]); ++ } ++ } ++ seq_puts(s, "\n"); ++ for (ix = 0; ix < END_ATTEMPT; ix++) { ++ if (resource->res_stats[ix + END_ATTEMPT] > 0) { ++ seq_printf(s, ++ " %u\tFAILED %s\n", ++ resource->res_stats[ ++ ix + END_ATTEMPT], ++ sm_stats_human_read[ix]); ++ } ++ } ++ } ++ } ++ ++ mutex_unlock(&(sm_state->map_lock)); ++ ++ seq_printf(s, "\nResources Count %d\n", res_count); ++ ++ return 0; ++} ++#endif ++ ++#if 0 ++/* Read callback for the allocation proc entry. */ ++static int vc_sm_alloc_show(struct seq_file *s, void *v) ++{ ++ struct SM_PRIV_DATA_T *file_data; ++ struct SM_RESOURCE_T *resource; ++ int alloc_count = 0; ++ struct SM_PDE_T *p_pde; ++ ++ p_pde = (struct SM_PDE_T *)(s->private); ++ file_data = (struct SM_PRIV_DATA_T *)(p_pde->priv_data); ++ ++ if (!file_data) ++ return 0; ++ ++ /* Per process statistics. */ ++ seq_printf(s, "\nAllocation for TGID %d\n", file_data->pid); ++ ++ mutex_lock(&(sm_state->map_lock)); ++ ++ if (!list_empty(&file_data->resource_list)) { ++ list_for_each_entry(resource, &file_data->resource_list, ++ resource_list) { ++ alloc_count++; ++ ++ seq_printf(s, "\nGUID: 0x%x\n", ++ resource->res_guid); ++ seq_printf(s, "Lock Count: %u\n", ++ resource->lock_count); ++ seq_printf(s, "Mapped: %s\n", ++ (resource->map_count ? "yes" : "no")); ++ seq_printf(s, "VC-handle: 0x%x\n", ++ resource->res_handle); ++ seq_printf(s, "VC-address: 0x%p\n", ++ resource->res_base_mem); ++ seq_printf(s, "VC-size (bytes): %u\n", ++ resource->res_size); ++ seq_printf(s, "Cache: %s\n", ++ sm_cache_map_vector[resource->res_cached]); ++ } ++ } ++ ++ mutex_unlock(&(sm_state->map_lock)); ++ ++ seq_printf(s, "\n\nTotal allocation count: %d\n\n", alloc_count); ++ ++ return 0; ++} ++#endif ++ ++static int vc_sm_seq_file_show(struct seq_file *s, void *v) ++{ ++ struct SM_PDE_T *sm_pde; ++ ++ sm_pde = (struct SM_PDE_T *)(s->private); ++ ++ if (sm_pde && sm_pde->show) ++ sm_pde->show(s, v); ++ ++ return 0; ++} ++ ++static int vc_sm_single_open(struct inode *inode, struct file *file) ++{ ++ return single_open(file, vc_sm_seq_file_show, inode->i_private); ++} ++ ++static const struct file_operations vc_sm_debug_fs_fops = { ++ .open = vc_sm_single_open, ++ .read = seq_read, ++ .llseek = seq_lseek, ++ .release = single_release, ++}; ++ ++/* Adds a resource to the private data list which tracks all the allocated ++** data. ++*/ ++static void vmcs_sm_add_resource(struct SM_PRIV_DATA_T *privdata, ++ struct SM_RESOURCE_T *resource) ++{ ++ mutex_lock(&(sm_state->map_lock)); ++ list_add(&resource->resource_list, &privdata->resource_list); ++ list_add(&resource->global_resource_list, &sm_state->resource_list); ++ mutex_unlock(&(sm_state->map_lock)); ++ ++ pr_debug("[%s]: added resource %p (base addr %p, hdl %x, size %u, cache %u)\n", ++ __func__, resource, resource->res_base_mem, ++ resource->res_handle, resource->res_size, resource->res_cached); ++} ++ ++/* Locates a resource and acquire a reference on it. ++** The resource won't be deleted while there is a reference on it. ++*/ ++static struct SM_RESOURCE_T *vmcs_sm_acquire_resource(struct SM_PRIV_DATA_T ++ *private, ++ unsigned int res_guid) ++{ ++ struct SM_RESOURCE_T *resource, *ret = NULL; ++ ++ mutex_lock(&(sm_state->map_lock)); ++ ++ list_for_each_entry(resource, &private->resource_list, resource_list) { ++ if (resource->res_guid != res_guid) ++ continue; ++ ++ pr_debug("[%s]: located resource %p (guid: %x, base addr %p, hdl %x, size %u, cache %u)\n", ++ __func__, resource, resource->res_guid, ++ resource->res_base_mem, resource->res_handle, ++ resource->res_size, resource->res_cached); ++ resource->ref_count++; ++ ret = resource; ++ break; ++ } ++ ++ mutex_unlock(&(sm_state->map_lock)); ++ ++ return ret; ++} ++ ++/* Locates a resource and acquire a reference on it. ++** The resource won't be deleted while there is a reference on it. ++*/ ++static struct SM_RESOURCE_T *vmcs_sm_acquire_first_resource( ++ struct SM_PRIV_DATA_T *private) ++{ ++ struct SM_RESOURCE_T *resource, *ret = NULL; ++ ++ mutex_lock(&(sm_state->map_lock)); ++ ++ list_for_each_entry(resource, &private->resource_list, resource_list) { ++ pr_debug("[%s]: located resource %p (guid: %x, base addr %p, hdl %x, size %u, cache %u)\n", ++ __func__, resource, resource->res_guid, ++ resource->res_base_mem, resource->res_handle, ++ resource->res_size, resource->res_cached); ++ resource->ref_count++; ++ ret = resource; ++ break; ++ } ++ ++ mutex_unlock(&(sm_state->map_lock)); ++ ++ return ret; ++} ++ ++/* Locates a resource and acquire a reference on it. ++** The resource won't be deleted while there is a reference on it. ++*/ ++static struct SM_RESOURCE_T *vmcs_sm_acquire_global_resource(unsigned int ++ res_guid) ++{ ++ struct SM_RESOURCE_T *resource, *ret = NULL; ++ ++ mutex_lock(&(sm_state->map_lock)); ++ ++ list_for_each_entry(resource, &sm_state->resource_list, ++ global_resource_list) { ++ if (resource->res_guid != res_guid) ++ continue; ++ ++ pr_debug("[%s]: located resource %p (guid: %x, base addr %p, hdl %x, size %u, cache %u)\n", ++ __func__, resource, resource->res_guid, ++ resource->res_base_mem, resource->res_handle, ++ resource->res_size, resource->res_cached); ++ resource->ref_count++; ++ ret = resource; ++ break; ++ } ++ ++ mutex_unlock(&(sm_state->map_lock)); ++ ++ return ret; ++} ++ ++/* Release a previously acquired resource. ++** The resource will be deleted when its refcount reaches 0. ++*/ ++static void vmcs_sm_release_resource(struct SM_RESOURCE_T *resource, int force) ++{ ++ struct SM_PRIV_DATA_T *private = resource->private; ++ struct sm_mmap *map, *map_tmp; ++ struct SM_RESOURCE_T *res_tmp; ++ int ret; ++ ++ mutex_lock(&(sm_state->map_lock)); ++ ++ if (--resource->ref_count) { ++ if (force) ++ pr_err("[%s]: resource %p in use\n", __func__, resource); ++ ++ mutex_unlock(&(sm_state->map_lock)); ++ return; ++ } ++ ++ /* Time to free the resource. Start by removing it from the list */ ++ list_del(&resource->resource_list); ++ list_del(&resource->global_resource_list); ++ ++ /* Walk the global resource list, find out if the resource is used ++ * somewhere else. In which case we don't want to delete it. ++ */ ++ list_for_each_entry(res_tmp, &sm_state->resource_list, ++ global_resource_list) { ++ if (res_tmp->res_handle == resource->res_handle) { ++ resource->res_handle = 0; ++ break; ++ } ++ } ++ ++ mutex_unlock(&(sm_state->map_lock)); ++ ++ pr_debug("[%s]: freeing data - guid %x, hdl %x, base address %p\n", ++ __func__, resource->res_guid, resource->res_handle, ++ resource->res_base_mem); ++ resource->res_stats[FREE]++; ++ ++ /* Make sure the resource we're removing is unmapped first */ ++ if (resource->map_count && !list_empty(&resource->map_list)) { ++ down_write(&current->mm->mmap_sem); ++ list_for_each_entry_safe(map, map_tmp, &resource->map_list, ++ resource_map_list) { ++ ret = ++ do_munmap(current->mm, map->res_addr, ++ resource->res_size); ++ if (ret) { ++ pr_err("[%s]: could not unmap resource %p\n", ++ __func__, resource); ++ } ++ } ++ up_write(&current->mm->mmap_sem); ++ } ++ ++ /* Free up the videocore allocated resource. ++ */ ++ if (resource->res_handle) { ++ VC_SM_FREE_T free = { ++ resource->res_handle, resource->res_base_mem ++ }; ++ int status = vc_vchi_sm_free(sm_state->sm_handle, &free, ++ &private->int_trans_id); ++ if (status != 0 && status != -EINTR) { ++ pr_err("[%s]: failed to free memory on videocore (status: %u, trans_id: %u)\n", ++ __func__, status, private->int_trans_id); ++ resource->res_stats[FREE_FAIL]++; ++ ret = -EPERM; ++ } ++ } ++ ++ /* Free up the shared resource. ++ */ ++ if (resource->res_shared) ++ vmcs_sm_release_resource(resource->res_shared, 0); ++ ++ /* Free up the local resource tracking this allocation. ++ */ ++ vc_sm_resource_deceased(resource, force); ++ kfree(resource); ++} ++ ++/* Dump the map table for the driver. If process is -1, dumps the whole table, ++** if process is a valid pid (non -1) dump only the entries associated with the ++** pid of interest. ++*/ ++static void vmcs_sm_host_walk_map_per_pid(int pid) ++{ ++ struct sm_mmap *map = NULL; ++ ++ /* Make sure the device was started properly. ++ */ ++ if (sm_state == NULL) { ++ pr_err("[%s]: invalid device\n", __func__); ++ return; ++ } ++ ++ mutex_lock(&(sm_state->map_lock)); ++ ++ /* Log all applicable mapping(s). ++ */ ++ if (!list_empty(&sm_state->map_list)) { ++ list_for_each_entry(map, &sm_state->map_list, map_list) { ++ if (pid == -1 || map->res_pid == pid) { ++ pr_info("[%s]: tgid: %u - vc-hdl: %x, usr-hdl: %x, usr-addr: %lx\n", ++ __func__, map->res_pid, map->res_vc_hdl, ++ map->res_usr_hdl, map->res_addr); ++ } ++ } ++ } ++ ++ mutex_unlock(&(sm_state->map_lock)); ++ ++ return; ++} ++ ++/* Dump the allocation table from host side point of view. This only dumps the ++** data allocated for this process/device referenced by the file_data. ++*/ ++static void vmcs_sm_host_walk_alloc(struct SM_PRIV_DATA_T *file_data) ++{ ++ struct SM_RESOURCE_T *resource = NULL; ++ ++ /* Make sure the device was started properly. ++ */ ++ if ((sm_state == NULL) || (file_data == NULL)) { ++ pr_err("[%s]: invalid device\n", __func__); ++ return; ++ } ++ ++ mutex_lock(&(sm_state->map_lock)); ++ ++ if (!list_empty(&file_data->resource_list)) { ++ list_for_each_entry(resource, &file_data->resource_list, ++ resource_list) { ++ pr_info("[%s]: guid: %x - hdl: %x, vc-mem: %p, size: %u, cache: %u\n", ++ __func__, resource->res_guid, resource->res_handle, ++ resource->res_base_mem, resource->res_size, ++ resource->res_cached); ++ } ++ } ++ ++ mutex_unlock(&(sm_state->map_lock)); ++ ++ return; ++} ++ ++/* Create support for private data tracking. ++*/ ++static struct SM_PRIV_DATA_T *vc_sm_create_priv_data(pid_t id) ++{ ++ char alloc_name[32]; ++ struct SM_PRIV_DATA_T *file_data = NULL; ++ ++ /* Allocate private structure. */ ++ file_data = kzalloc(sizeof(*file_data), GFP_KERNEL); ++ ++ if (!file_data) { ++ pr_err("[%s]: cannot allocate file data\n", __func__); ++ goto out; ++ } ++ ++ snprintf(alloc_name, sizeof(alloc_name), "%d", id); ++ ++ INIT_LIST_HEAD(&file_data->resource_list); ++ file_data->pid = id; ++ file_data->dir_pid = debugfs_create_dir(alloc_name, ++ sm_state->dir_alloc); ++#if 0 ++ /* TODO: fix this to support querying statistics per pid */ ++ ++ if (IS_ERR_OR_NULL(file_data->dir_pid)) { ++ file_data->dir_pid = NULL; ++ } else { ++ struct dentry *dir_entry; ++ ++ dir_entry = debugfs_create_file(VC_SM_RESOURCES, S_IRUGO, ++ file_data->dir_pid, file_data, ++ vc_sm_debug_fs_fops); ++ ++ file_data->dir_res.dir_entry = dir_entry; ++ file_data->dir_res.priv_data = file_data; ++ file_data->dir_res.show = &vc_sm_alloc_show; ++ ++ dir_entry = debugfs_create_file(VC_SM_STATS, S_IRUGO, ++ file_data->dir_pid, file_data, ++ vc_sm_debug_fs_fops); ++ ++ file_data->dir_res.dir_entry = dir_entry; ++ file_data->dir_res.priv_data = file_data; ++ file_data->dir_res.show = &vc_sm_statistics_show; ++ } ++ pr_debug("[%s]: private data allocated %p\n", __func__, file_data); ++ ++#endif ++out: ++ return file_data; ++} ++ ++/* Open the device. Creates a private state to help track all allocation ++** associated with this device. ++*/ ++static int vc_sm_open(struct inode *inode, struct file *file) ++{ ++ int ret = 0; ++ ++ /* Make sure the device was started properly. ++ */ ++ if (!sm_state) { ++ pr_err("[%s]: invalid device\n", __func__); ++ ret = -EPERM; ++ goto out; ++ } ++ ++ file->private_data = vc_sm_create_priv_data(current->tgid); ++ if (file->private_data == NULL) { ++ pr_err("[%s]: failed to create data tracker\n", __func__); ++ ++ ret = -ENOMEM; ++ goto out; ++ } ++ ++out: ++ return ret; ++} ++ ++/* Close the device. Free up all resources still associated with this device ++** at the time. ++*/ ++static int vc_sm_release(struct inode *inode, struct file *file) ++{ ++ struct SM_PRIV_DATA_T *file_data = ++ (struct SM_PRIV_DATA_T *)file->private_data; ++ struct SM_RESOURCE_T *resource; ++ int ret = 0; ++ ++ /* Make sure the device was started properly. ++ */ ++ if (sm_state == NULL || file_data == NULL) { ++ pr_err("[%s]: invalid device\n", __func__); ++ ret = -EPERM; ++ goto out; ++ } ++ ++ pr_debug("[%s]: using private data %p\n", __func__, file_data); ++ ++ if (file_data->restart_sys == -EINTR) { ++ VC_SM_ACTION_CLEAN_T action_clean; ++ ++ pr_debug("[%s]: releasing following EINTR on %u (trans_id: %u) (likely due to signal)...\n", ++ __func__, file_data->int_action, ++ file_data->int_trans_id); ++ ++ action_clean.res_action = file_data->int_action; ++ action_clean.action_trans_id = file_data->int_trans_id; ++ ++ vc_vchi_sm_clean_up(sm_state->sm_handle, &action_clean); ++ } ++ ++ while ((resource = vmcs_sm_acquire_first_resource(file_data)) != NULL) { ++ vmcs_sm_release_resource(resource, 0); ++ vmcs_sm_release_resource(resource, 1); ++ } ++ ++ /* Remove the corresponding proc entry. */ ++ debugfs_remove_recursive(file_data->dir_pid); ++ ++ /* Terminate the private data. ++ */ ++ kfree(file_data); ++ ++out: ++ return ret; ++} ++ ++static void vcsm_vma_open(struct vm_area_struct *vma) ++{ ++ struct sm_mmap *map = (struct sm_mmap *)vma->vm_private_data; ++ ++ pr_debug("[%s]: virt %lx-%lx, pid %i, pfn %i\n", ++ __func__, vma->vm_start, vma->vm_end, (int)current->tgid, ++ (int)vma->vm_pgoff); ++ ++ map->ref_count++; ++} ++ ++static void vcsm_vma_close(struct vm_area_struct *vma) ++{ ++ struct sm_mmap *map = (struct sm_mmap *)vma->vm_private_data; ++ ++ pr_debug("[%s]: virt %lx-%lx, pid %i, pfn %i\n", ++ __func__, vma->vm_start, vma->vm_end, (int)current->tgid, ++ (int)vma->vm_pgoff); ++ ++ map->ref_count--; ++ ++ /* Remove from the map table. ++ */ ++ if (map->ref_count == 0) ++ vmcs_sm_remove_map(sm_state, map->resource, map); ++} ++ ++static int vcsm_vma_fault(struct vm_area_struct *vma, struct vm_fault *vmf) ++{ ++ struct sm_mmap *map = (struct sm_mmap *)vma->vm_private_data; ++ struct SM_RESOURCE_T *resource = map->resource; ++ pgoff_t page_offset; ++ unsigned long pfn; ++ int ret = 0; ++ ++ /* Lock the resource if necessary. ++ */ ++ if (!resource->lock_count) { ++ VC_SM_LOCK_UNLOCK_T lock_unlock; ++ VC_SM_LOCK_RESULT_T lock_result; ++ int status; ++ ++ lock_unlock.res_handle = resource->res_handle; ++ lock_unlock.res_mem = resource->res_base_mem; ++ ++ pr_debug("[%s]: attempt to lock data - hdl %x, base address %p\n", ++ __func__, lock_unlock.res_handle, lock_unlock.res_mem); ++ ++ /* Lock the videocore allocated resource. ++ */ ++ status = vc_vchi_sm_lock(sm_state->sm_handle, ++ &lock_unlock, &lock_result, 0); ++ if ((status != 0) || ++ ((status == 0) && (lock_result.res_mem == NULL))) { ++ pr_err("[%s]: failed to lock memory on videocore (status: %u)\n", ++ __func__, status); ++ resource->res_stats[LOCK_FAIL]++; ++ return VM_FAULT_SIGBUS; ++ } ++ ++ pfn = vcaddr_to_pfn((unsigned long)resource->res_base_mem); ++ outer_inv_range(__pfn_to_phys(pfn), ++ __pfn_to_phys(pfn) + resource->res_size); ++ ++ resource->res_stats[LOCK]++; ++ resource->lock_count++; ++ ++ /* Keep track of the new base memory. ++ */ ++ if ((lock_result.res_mem != NULL) && ++ (lock_result.res_old_mem != NULL) && ++ (lock_result.res_mem != lock_result.res_old_mem)) { ++ resource->res_base_mem = lock_result.res_mem; ++ } ++ } ++ ++ /* We don't use vmf->pgoff since that has the fake offset */ ++ page_offset = ((unsigned long)vmf->virtual_address - vma->vm_start); ++ pfn = (uint32_t)resource->res_base_mem & 0x3FFFFFFF; ++ pfn += mm_vc_mem_phys_addr; ++ pfn += page_offset; ++ pfn >>= PAGE_SHIFT; ++ ++ /* Finally, remap it */ ++ ret = vm_insert_pfn(vma, (unsigned long)vmf->virtual_address, pfn); ++ ++ switch (ret) { ++ case 0: ++ case -ERESTARTSYS: ++ return VM_FAULT_NOPAGE; ++ case -ENOMEM: ++ case -EAGAIN: ++ return VM_FAULT_OOM; ++ default: ++ return VM_FAULT_SIGBUS; ++ } ++} ++ ++static struct vm_operations_struct vcsm_vm_ops = { ++ .open = vcsm_vma_open, ++ .close = vcsm_vma_close, ++ .fault = vcsm_vma_fault, ++}; ++ ++/* Walks a VMA and clean each valid page from the cache */ ++static void vcsm_vma_cache_clean_page_range(unsigned long addr, ++ unsigned long end) ++{ ++ pgd_t *pgd; ++ pud_t *pud; ++ pmd_t *pmd; ++ pte_t *pte; ++ unsigned long pgd_next, pud_next, pmd_next; ++ ++ if (addr >= end) ++ return; ++ ++ /* Walk PGD */ ++ pgd = pgd_offset(current->mm, addr); ++ do { ++ pgd_next = pgd_addr_end(addr, end); ++ ++ if (pgd_none(*pgd) || pgd_bad(*pgd)) ++ continue; ++ ++ /* Walk PUD */ ++ pud = pud_offset(pgd, addr); ++ do { ++ pud_next = pud_addr_end(addr, pgd_next); ++ if (pud_none(*pud) || pud_bad(*pud)) ++ continue; ++ ++ /* Walk PMD */ ++ pmd = pmd_offset(pud, addr); ++ do { ++ pmd_next = pmd_addr_end(addr, pud_next); ++ if (pmd_none(*pmd) || pmd_bad(*pmd)) ++ continue; ++ ++ /* Walk PTE */ ++ pte = pte_offset_map(pmd, addr); ++ do { ++ if (pte_none(*pte) ++ || !pte_present(*pte)) ++ continue; ++ ++ /* Clean + invalidate */ ++ dmac_flush_range((const void *) addr, ++ (const void *) ++ (addr + PAGE_SIZE)); ++ ++ } while (pte++, addr += ++ PAGE_SIZE, addr != pmd_next); ++ pte_unmap(pte); ++ ++ } while (pmd++, addr = pmd_next, addr != pud_next); ++ ++ } while (pud++, addr = pud_next, addr != pgd_next); ++ } while (pgd++, addr = pgd_next, addr != end); ++} ++ ++/* Map an allocated data into something that the user space. ++*/ ++static int vc_sm_mmap(struct file *file, struct vm_area_struct *vma) ++{ ++ int ret = 0; ++ struct SM_PRIV_DATA_T *file_data = ++ (struct SM_PRIV_DATA_T *)file->private_data; ++ struct SM_RESOURCE_T *resource = NULL; ++ struct sm_mmap *map = NULL; ++ ++ /* Make sure the device was started properly. ++ */ ++ if ((sm_state == NULL) || (file_data == NULL)) { ++ pr_err("[%s]: invalid device\n", __func__); ++ return -EPERM; ++ } ++ ++ pr_debug("[%s]: private data %p, guid %x\n", __func__, file_data, ++ ((unsigned int)vma->vm_pgoff << PAGE_SHIFT)); ++ ++ /* We lookup to make sure that the data we are being asked to mmap is ++ ** something that we allocated. ++ ** ++ ** We use the offset information as the key to tell us which resource ++ ** we are mapping. ++ */ ++ resource = vmcs_sm_acquire_resource(file_data, ++ ((unsigned int)vma->vm_pgoff << ++ PAGE_SHIFT)); ++ if (resource == NULL) { ++ pr_err("[%s]: failed to locate resource for guid %x\n", __func__, ++ ((unsigned int)vma->vm_pgoff << PAGE_SHIFT)); ++ return -ENOMEM; ++ } ++ ++ pr_debug("[%s]: guid %x, tgid %u, %u, %u\n", ++ __func__, resource->res_guid, current->tgid, resource->pid, ++ file_data->pid); ++ ++ /* Check permissions. ++ */ ++ if (resource->pid && (resource->pid != current->tgid)) { ++ pr_err("[%s]: current tgid %u != %u owner\n", ++ __func__, current->tgid, resource->pid); ++ ret = -EPERM; ++ goto error; ++ } ++ ++ /* Verify that what we are asked to mmap is proper. ++ */ ++ if (resource->res_size != (unsigned int)(vma->vm_end - vma->vm_start)) { ++ pr_err("[%s]: size inconsistency (resource: %u - mmap: %u)\n", ++ __func__, ++ resource->res_size, ++ (unsigned int)(vma->vm_end - vma->vm_start)); ++ ++ ret = -EINVAL; ++ goto error; ++ } ++ ++ /* Keep track of the tuple in the global resource list such that one ++ * can do a mapping lookup for address/memory handle. ++ */ ++ map = kzalloc(sizeof(*map), GFP_KERNEL); ++ if (map == NULL) { ++ pr_err("[%s]: failed to allocate global tracking resource\n", ++ __func__); ++ ret = -ENOMEM; ++ goto error; ++ } ++ ++ map->res_pid = current->tgid; ++ map->res_vc_hdl = resource->res_handle; ++ map->res_usr_hdl = resource->res_guid; ++ map->res_addr = (long unsigned int)vma->vm_start; ++ map->resource = resource; ++ map->vma = vma; ++ vmcs_sm_add_map(sm_state, resource, map); ++ ++ /* We are not actually mapping the pages, we just provide a fault ++ ** handler to allow pages to be mapped when accessed ++ */ ++ vma->vm_flags |= ++ VM_IO | VM_PFNMAP | VM_DONTCOPY | VM_DONTEXPAND; ++ vma->vm_ops = &vcsm_vm_ops; ++ vma->vm_private_data = map; ++ ++ /* vm_pgoff is the first PFN of the mapped memory */ ++ vma->vm_pgoff = (unsigned long)resource->res_base_mem & 0x3FFFFFFF; ++ vma->vm_pgoff += mm_vc_mem_phys_addr; ++ vma->vm_pgoff >>= PAGE_SHIFT; ++ ++ if ((resource->res_cached == VMCS_SM_CACHE_NONE) || ++ (resource->res_cached == VMCS_SM_CACHE_VC)) { ++ /* Allocated non host cached memory, honour it. ++ */ ++ vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); ++ } ++ ++ pr_debug("[%s]: resource %p (guid %x) - cnt %u, base address %p, handle %x, size %u (%u), cache %u\n", ++ __func__, ++ resource, resource->res_guid, resource->lock_count, ++ resource->res_base_mem, resource->res_handle, ++ resource->res_size, (unsigned int)(vma->vm_end - vma->vm_start), ++ resource->res_cached); ++ ++ pr_debug("[%s]: resource %p (base address %p, handle %x) - map-count %d, usr-addr %x\n", ++ __func__, resource, resource->res_base_mem, ++ resource->res_handle, resource->map_count, ++ (unsigned int)vma->vm_start); ++ ++ vcsm_vma_open(vma); ++ resource->res_stats[MAP]++; ++ vmcs_sm_release_resource(resource, 0); ++ return 0; ++ ++error: ++ resource->res_stats[MAP_FAIL]++; ++ vmcs_sm_release_resource(resource, 0); ++ return ret; ++} ++ ++/* Allocate a shared memory handle and block. ++*/ ++int vc_sm_ioctl_alloc(struct SM_PRIV_DATA_T *private, ++ struct vmcs_sm_ioctl_alloc *ioparam) ++{ ++ int ret = 0; ++ int status; ++ struct SM_RESOURCE_T *resource; ++ VC_SM_ALLOC_T alloc = { 0 }; ++ VC_SM_ALLOC_RESULT_T result = { 0 }; ++ ++ /* Setup our allocation parameters */ ++ alloc.type = ((ioparam->cached == VMCS_SM_CACHE_VC) ++ || (ioparam->cached == ++ VMCS_SM_CACHE_BOTH)) ? VC_SM_ALLOC_CACHED : ++ VC_SM_ALLOC_NON_CACHED; ++ alloc.base_unit = ioparam->size; ++ alloc.num_unit = ioparam->num; ++ alloc.allocator = current->tgid; ++ /* Align to kernel page size */ ++ alloc.alignement = 4096; ++ /* Align the size to the kernel page size */ ++ alloc.base_unit = ++ (alloc.base_unit + alloc.alignement - 1) & ~(alloc.alignement - 1); ++ if (*ioparam->name) { ++ memcpy(alloc.name, ioparam->name, sizeof(alloc.name) - 1); ++ } else { ++ memcpy(alloc.name, VMCS_SM_RESOURCE_NAME_DEFAULT, ++ sizeof(VMCS_SM_RESOURCE_NAME_DEFAULT)); ++ } ++ ++ pr_debug("[%s]: attempt to allocate \"%s\" data - type %u, base %u (%u), num %u, alignement %u\n", ++ __func__, alloc.name, alloc.type, ioparam->size, ++ alloc.base_unit, alloc.num_unit, alloc.alignement); ++ ++ /* Allocate local resource to track this allocation. ++ */ ++ resource = kzalloc(sizeof(*resource), GFP_KERNEL); ++ if (!resource) { ++ ret = -ENOMEM; ++ goto error; ++ } ++ INIT_LIST_HEAD(&resource->map_list); ++ resource->ref_count++; ++ resource->pid = current->tgid; ++ ++ /* Allocate the videocore resource. ++ */ ++ status = vc_vchi_sm_alloc(sm_state->sm_handle, &alloc, &result, ++ &private->int_trans_id); ++ if (status == -EINTR) { ++ pr_debug("[%s]: requesting allocate memory action restart (trans_id: %u)\n", ++ __func__, private->int_trans_id); ++ ret = -ERESTARTSYS; ++ private->restart_sys = -EINTR; ++ private->int_action = VC_SM_MSG_TYPE_ALLOC; ++ goto error; ++ } else if (status != 0 || (status == 0 && result.res_mem == NULL)) { ++ pr_err("[%s]: failed to allocate memory on videocore (status: %u, trans_id: %u)\n", ++ __func__, status, private->int_trans_id); ++ ret = -ENOMEM; ++ resource->res_stats[ALLOC_FAIL]++; ++ goto error; ++ } ++ ++ /* Keep track of the resource we created. ++ */ ++ resource->private = private; ++ resource->res_handle = result.res_handle; ++ resource->res_base_mem = result.res_mem; ++ resource->res_size = alloc.base_unit * alloc.num_unit; ++ resource->res_cached = ioparam->cached; ++ ++ /* Kernel/user GUID. This global identifier is used for mmap'ing the ++ * allocated region from user space, it is passed as the mmap'ing ++ * offset, we use it to 'hide' the videocore handle/address. ++ */ ++ mutex_lock(&sm_state->lock); ++ resource->res_guid = ++sm_state->guid; ++ mutex_unlock(&sm_state->lock); ++ resource->res_guid <<= PAGE_SHIFT; ++ ++ vmcs_sm_add_resource(private, resource); ++ ++ pr_debug("[%s]: allocated data - guid %x, hdl %x, base address %p, size %d, cache %d\n", ++ __func__, resource->res_guid, resource->res_handle, ++ resource->res_base_mem, resource->res_size, ++ resource->res_cached); ++ ++ /* We're done */ ++ resource->res_stats[ALLOC]++; ++ ioparam->handle = resource->res_guid; ++ return 0; ++ ++error: ++ pr_err("[%s]: failed to allocate \"%s\" data (%i) - type %u, base %u (%u), num %u, alignment %u\n", ++ __func__, alloc.name, ret, alloc.type, ioparam->size, ++ alloc.base_unit, alloc.num_unit, alloc.alignement); ++ if (resource != NULL) { ++ vc_sm_resource_deceased(resource, 1); ++ kfree(resource); ++ } ++ return ret; ++} ++ ++/* Share an allocate memory handle and block. ++*/ ++int vc_sm_ioctl_alloc_share(struct SM_PRIV_DATA_T *private, ++ struct vmcs_sm_ioctl_alloc_share *ioparam) ++{ ++ struct SM_RESOURCE_T *resource, *shared_resource; ++ int ret = 0; ++ ++ pr_debug("[%s]: attempt to share resource %u\n", __func__, ++ ioparam->handle); ++ ++ shared_resource = vmcs_sm_acquire_global_resource(ioparam->handle); ++ if (shared_resource == NULL) { ++ ret = -ENOMEM; ++ goto error; ++ } ++ ++ /* Allocate local resource to track this allocation. ++ */ ++ resource = kzalloc(sizeof(*resource), GFP_KERNEL); ++ if (resource == NULL) { ++ pr_err("[%s]: failed to allocate local tracking resource\n", ++ __func__); ++ ret = -ENOMEM; ++ goto error; ++ } ++ INIT_LIST_HEAD(&resource->map_list); ++ resource->ref_count++; ++ resource->pid = current->tgid; ++ ++ /* Keep track of the resource we created. ++ */ ++ resource->private = private; ++ resource->res_handle = shared_resource->res_handle; ++ resource->res_base_mem = shared_resource->res_base_mem; ++ resource->res_size = shared_resource->res_size; ++ resource->res_cached = shared_resource->res_cached; ++ resource->res_shared = shared_resource; ++ ++ mutex_lock(&sm_state->lock); ++ resource->res_guid = ++sm_state->guid; ++ mutex_unlock(&sm_state->lock); ++ resource->res_guid <<= PAGE_SHIFT; ++ ++ vmcs_sm_add_resource(private, resource); ++ ++ pr_debug("[%s]: allocated data - guid %x, hdl %x, base address %p, size %d, cache %d\n", ++ __func__, resource->res_guid, resource->res_handle, ++ resource->res_base_mem, resource->res_size, ++ resource->res_cached); ++ ++ /* We're done */ ++ resource->res_stats[ALLOC]++; ++ ioparam->handle = resource->res_guid; ++ ioparam->size = resource->res_size; ++ return 0; ++ ++error: ++ pr_err("[%s]: failed to share %u\n", __func__, ioparam->handle); ++ if (shared_resource != NULL) ++ vmcs_sm_release_resource(shared_resource, 0); ++ ++ return ret; ++} ++ ++/* Free a previously allocated shared memory handle and block. ++*/ ++static int vc_sm_ioctl_free(struct SM_PRIV_DATA_T *private, ++ struct vmcs_sm_ioctl_free *ioparam) ++{ ++ struct SM_RESOURCE_T *resource = ++ vmcs_sm_acquire_resource(private, ioparam->handle); ++ ++ if (resource == NULL) { ++ pr_err("[%s]: resource for guid %u does not exist\n", __func__, ++ ioparam->handle); ++ return -EINVAL; ++ } ++ ++ /* Check permissions. ++ */ ++ if (resource->pid && (resource->pid != current->tgid)) { ++ pr_err("[%s]: current tgid %u != %u owner\n", ++ __func__, current->tgid, resource->pid); ++ vmcs_sm_release_resource(resource, 0); ++ return -EPERM; ++ } ++ ++ vmcs_sm_release_resource(resource, 0); ++ vmcs_sm_release_resource(resource, 0); ++ return 0; ++} ++ ++/* Resize a previously allocated shared memory handle and block. ++*/ ++static int vc_sm_ioctl_resize(struct SM_PRIV_DATA_T *private, ++ struct vmcs_sm_ioctl_resize *ioparam) ++{ ++ int ret = 0; ++ int status; ++ VC_SM_RESIZE_T resize; ++ struct SM_RESOURCE_T *resource; ++ ++ /* Locate resource from GUID. ++ */ ++ resource = vmcs_sm_acquire_resource(private, ioparam->handle); ++ if (!resource) { ++ pr_err("[%s]: failed resource - guid %x\n", ++ __func__, ioparam->handle); ++ ret = -EFAULT; ++ goto error; ++ } ++ ++ /* If the resource is locked, its reference count will be not NULL, ++ ** in which case we will not be allowed to resize it anyways, so ++ ** reject the attempt here. ++ */ ++ if (resource->lock_count != 0) { ++ pr_err("[%s]: cannot resize - guid %x, ref-cnt %d\n", ++ __func__, ioparam->handle, resource->lock_count); ++ ret = -EFAULT; ++ goto error; ++ } ++ ++ /* Check permissions. ++ */ ++ if (resource->pid && (resource->pid != current->tgid)) { ++ pr_err("[%s]: current tgid %u != %u owner\n", __func__, ++ current->tgid, resource->pid); ++ ret = -EPERM; ++ goto error; ++ } ++ ++ if (resource->map_count != 0) { ++ pr_err("[%s]: cannot resize - guid %x, ref-cnt %d\n", ++ __func__, ioparam->handle, resource->map_count); ++ ret = -EFAULT; ++ goto error; ++ } ++ ++ resize.res_handle = resource->res_handle; ++ resize.res_mem = resource->res_base_mem; ++ resize.res_new_size = ioparam->new_size; ++ ++ pr_debug("[%s]: attempt to resize data - guid %x, hdl %x, base address %p\n", ++ __func__, ioparam->handle, resize.res_handle, resize.res_mem); ++ ++ /* Resize the videocore allocated resource. ++ */ ++ status = vc_vchi_sm_resize(sm_state->sm_handle, &resize, ++ &private->int_trans_id); ++ if (status == -EINTR) { ++ pr_debug("[%s]: requesting resize memory action restart (trans_id: %u)\n", ++ __func__, private->int_trans_id); ++ ret = -ERESTARTSYS; ++ private->restart_sys = -EINTR; ++ private->int_action = VC_SM_MSG_TYPE_RESIZE; ++ goto error; ++ } else if (status != 0) { ++ pr_err("[%s]: failed to resize memory on videocore (status: %u, trans_id: %u)\n", ++ __func__, status, private->int_trans_id); ++ ret = -EPERM; ++ goto error; ++ } ++ ++ pr_debug("[%s]: success to resize data - hdl %x, size %d -> %d\n", ++ __func__, resize.res_handle, resource->res_size, ++ resize.res_new_size); ++ ++ /* Successfully resized, save the information and inform the user. ++ */ ++ ioparam->old_size = resource->res_size; ++ resource->res_size = resize.res_new_size; ++ ++error: ++ if (resource) ++ vmcs_sm_release_resource(resource, 0); ++ ++ return ret; ++} ++ ++/* Lock a previously allocated shared memory handle and block. ++*/ ++static int vc_sm_ioctl_lock(struct SM_PRIV_DATA_T *private, ++ struct vmcs_sm_ioctl_lock_unlock *ioparam, ++ int change_cache, enum vmcs_sm_cache_e cache_type, ++ unsigned int vc_addr) ++{ ++ int status; ++ VC_SM_LOCK_UNLOCK_T lock; ++ VC_SM_LOCK_RESULT_T result; ++ struct SM_RESOURCE_T *resource; ++ int ret = 0; ++ struct sm_mmap *map, *map_tmp; ++ long unsigned int phys_addr; ++ ++ map = NULL; ++ ++ /* Locate resource from GUID. ++ */ ++ resource = vmcs_sm_acquire_resource(private, ioparam->handle); ++ if (resource == NULL) { ++ ret = -EINVAL; ++ goto error; ++ } ++ ++ /* Check permissions. ++ */ ++ if (resource->pid && (resource->pid != current->tgid)) { ++ pr_err("[%s]: current tgid %u != %u owner\n", __func__, ++ current->tgid, resource->pid); ++ ret = -EPERM; ++ goto error; ++ } ++ ++ lock.res_handle = resource->res_handle; ++ lock.res_mem = resource->res_base_mem; ++ ++ /* Take the lock and get the address to be mapped. ++ */ ++ if (vc_addr == 0) { ++ pr_debug("[%s]: attempt to lock data - guid %x, hdl %x, base address %p\n", ++ __func__, ioparam->handle, lock.res_handle, ++ lock.res_mem); ++ ++ /* Lock the videocore allocated resource. ++ */ ++ status = vc_vchi_sm_lock(sm_state->sm_handle, &lock, &result, ++ &private->int_trans_id); ++ if (status == -EINTR) { ++ pr_debug("[%s]: requesting lock memory action restart (trans_id: %u)\n", ++ __func__, private->int_trans_id); ++ ret = -ERESTARTSYS; ++ private->restart_sys = -EINTR; ++ private->int_action = VC_SM_MSG_TYPE_LOCK; ++ goto error; ++ } else if (status != 0 || ++ (status == 0 && result.res_mem == NULL)) { ++ pr_err("[%s]: failed to lock memory on videocore (status: %u, trans_id: %u)\n", ++ __func__, status, private->int_trans_id); ++ ret = -EPERM; ++ resource->res_stats[LOCK_FAIL]++; ++ goto error; ++ } ++ ++ pr_debug("[%s]: succeed to lock data - hdl %x, base address %p (%p), ref-cnt %d\n", ++ __func__, lock.res_handle, result.res_mem, ++ lock.res_mem, resource->lock_count); ++ } ++ /* Lock assumed taken already, address to be mapped is known. ++ */ ++ else ++ resource->res_base_mem = (void *)vc_addr; ++ ++ resource->res_stats[LOCK]++; ++ resource->lock_count++; ++ ++ /* Keep track of the new base memory allocation if it has changed. ++ */ ++ if ((vc_addr == 0) && ++ (result.res_mem != NULL) && ++ (result.res_old_mem != NULL) && ++ (result.res_mem != result.res_old_mem)) { ++ resource->res_base_mem = result.res_mem; ++ ++ /* Kernel allocated resources. ++ */ ++ if (resource->pid == 0) { ++ if (!list_empty(&resource->map_list)) { ++ list_for_each_entry_safe(map, map_tmp, ++ &resource->map_list, ++ resource_map_list) { ++ if (map->res_addr) { ++ iounmap((void *)map->res_addr); ++ map->res_addr = 0; ++ ++ vmcs_sm_remove_map(sm_state, ++ map->resource, ++ map); ++ break; ++ } ++ } ++ } ++ } ++ } ++ ++ if (change_cache) ++ resource->res_cached = cache_type; ++ ++ if (resource->map_count) { ++ ioparam->addr = ++ vmcs_sm_usr_address_from_pid_and_usr_handle( ++ current->tgid, ioparam->handle); ++ ++ pr_debug("[%s] map_count %d private->pid %d current->tgid %d hnd %x addr %u\n", ++ __func__, resource->map_count, private->pid, ++ current->tgid, ioparam->handle, ioparam->addr); ++ } else { ++ /* Kernel allocated resources. ++ */ ++ if (resource->pid == 0) { ++ pr_debug("[%s]: attempt mapping kernel resource - guid %x, hdl %x\n", ++ __func__, ioparam->handle, lock.res_handle); ++ ++ ioparam->addr = 0; ++ ++ map = kzalloc(sizeof(*map), GFP_KERNEL); ++ if (map == NULL) { ++ pr_err("[%s]: failed allocating tracker\n", ++ __func__); ++ ret = -ENOMEM; ++ goto error; ++ } else { ++ phys_addr = (uint32_t)resource->res_base_mem & ++ 0x3FFFFFFF; ++ phys_addr += mm_vc_mem_phys_addr; ++ if (resource->res_cached ++ == VMCS_SM_CACHE_HOST) { ++ ioparam->addr = (long unsigned int) ++ /* TODO - make cached work */ ++ ioremap_nocache(phys_addr, ++ resource->res_size); ++ ++ pr_debug("[%s]: mapping kernel - guid %x, hdl %x - cached mapping %u\n", ++ __func__, ioparam->handle, ++ lock.res_handle, ioparam->addr); ++ } else { ++ ioparam->addr = (long unsigned int) ++ ioremap_nocache(phys_addr, ++ resource->res_size); ++ ++ pr_debug("[%s]: mapping kernel- guid %x, hdl %x - non cached mapping %u\n", ++ __func__, ioparam->handle, ++ lock.res_handle, ioparam->addr); ++ } ++ ++ map->res_pid = 0; ++ map->res_vc_hdl = resource->res_handle; ++ map->res_usr_hdl = resource->res_guid; ++ map->res_addr = ioparam->addr; ++ map->resource = resource; ++ map->vma = NULL; ++ ++ vmcs_sm_add_map(sm_state, resource, map); ++ } ++ } else ++ ioparam->addr = 0; ++ } ++ ++error: ++ if (resource) ++ vmcs_sm_release_resource(resource, 0); ++ ++ return ret; ++} ++ ++/* Unlock a previously allocated shared memory handle and block. ++*/ ++static int vc_sm_ioctl_unlock(struct SM_PRIV_DATA_T *private, ++ struct vmcs_sm_ioctl_lock_unlock *ioparam, ++ int flush, int wait_reply, int no_vc_unlock) ++{ ++ int status; ++ VC_SM_LOCK_UNLOCK_T unlock; ++ struct sm_mmap *map, *map_tmp; ++ struct SM_RESOURCE_T *resource; ++ int ret = 0; ++ ++ map = NULL; ++ ++ /* Locate resource from GUID. ++ */ ++ resource = vmcs_sm_acquire_resource(private, ioparam->handle); ++ if (resource == NULL) { ++ ret = -EINVAL; ++ goto error; ++ } ++ ++ /* Check permissions. ++ */ ++ if (resource->pid && (resource->pid != current->tgid)) { ++ pr_err("[%s]: current tgid %u != %u owner\n", ++ __func__, current->tgid, resource->pid); ++ ret = -EPERM; ++ goto error; ++ } ++ ++ unlock.res_handle = resource->res_handle; ++ unlock.res_mem = resource->res_base_mem; ++ ++ pr_debug("[%s]: attempt to unlock data - guid %x, hdl %x, base address %p\n", ++ __func__, ioparam->handle, unlock.res_handle, unlock.res_mem); ++ ++ /* User space allocated resources. ++ */ ++ if (resource->pid) { ++ /* Flush if requested */ ++ if (resource->res_cached && flush) { ++ dma_addr_t phys_addr = 0; ++ resource->res_stats[FLUSH]++; ++ ++ phys_addr = ++ (dma_addr_t)((uint32_t)resource->res_base_mem & ++ 0x3FFFFFFF); ++ phys_addr += (dma_addr_t)mm_vc_mem_phys_addr; ++ ++ /* L1 cache flush */ ++ down_read(&current->mm->mmap_sem); ++ list_for_each_entry(map, &resource->map_list, ++ resource_map_list) { ++ if (map->vma) { ++ unsigned long start; ++ unsigned long end; ++ start = map->vma->vm_start; ++ end = map->vma->vm_end; ++ ++ vcsm_vma_cache_clean_page_range( ++ start, end); ++ } ++ } ++ up_read(&current->mm->mmap_sem); ++ ++ /* L2 cache flush */ ++ outer_clean_range(phys_addr, ++ phys_addr + ++ (size_t) resource->res_size); ++ } ++ ++ /* We need to zap all the vmas associated with this resource */ ++ if (resource->lock_count == 1) { ++ down_read(&current->mm->mmap_sem); ++ list_for_each_entry(map, &resource->map_list, ++ resource_map_list) { ++ if (map->vma) { ++ zap_vma_ptes(map->vma, ++ map->vma->vm_start, ++ map->vma->vm_end - ++ map->vma->vm_start); ++ } ++ } ++ up_read(&current->mm->mmap_sem); ++ } ++ } ++ /* Kernel allocated resources. */ ++ else { ++ /* Global + Taken in this context */ ++ if (resource->ref_count == 2) { ++ if (!list_empty(&resource->map_list)) { ++ list_for_each_entry_safe(map, map_tmp, ++ &resource->map_list, ++ resource_map_list) { ++ if (map->res_addr) { ++ if (flush && ++ (resource->res_cached == ++ VMCS_SM_CACHE_HOST)) { ++ long unsigned int ++ phys_addr; ++ phys_addr = (uint32_t) ++ resource->res_base_mem & 0x3FFFFFFF; ++ phys_addr += ++ mm_vc_mem_phys_addr; ++ ++ /* L1 cache flush */ ++ dmac_flush_range((const ++ void ++ *) ++ map->res_addr, (const void *) ++ (map->res_addr + resource->res_size)); ++ ++ /* L2 cache flush */ ++ outer_clean_range ++ (phys_addr, ++ phys_addr + ++ (size_t) ++ resource->res_size); ++ } ++ ++ iounmap((void *)map->res_addr); ++ map->res_addr = 0; ++ ++ vmcs_sm_remove_map(sm_state, ++ map->resource, ++ map); ++ break; ++ } ++ } ++ } ++ } ++ } ++ ++ if (resource->lock_count) { ++ /* Bypass the videocore unlock. ++ */ ++ if (no_vc_unlock) ++ status = 0; ++ /* Unlock the videocore allocated resource. ++ */ ++ else { ++ status = ++ vc_vchi_sm_unlock(sm_state->sm_handle, &unlock, ++ &private->int_trans_id, ++ wait_reply); ++ if (status == -EINTR) { ++ pr_debug("[%s]: requesting unlock memory action restart (trans_id: %u)\n", ++ __func__, private->int_trans_id); ++ ++ ret = -ERESTARTSYS; ++ resource->res_stats[UNLOCK]--; ++ private->restart_sys = -EINTR; ++ private->int_action = VC_SM_MSG_TYPE_UNLOCK; ++ goto error; ++ } else if (status != 0) { ++ pr_err("[%s]: failed to unlock vc mem (status: %u, trans_id: %u)\n", ++ __func__, status, private->int_trans_id); ++ ++ ret = -EPERM; ++ resource->res_stats[UNLOCK_FAIL]++; ++ goto error; ++ } ++ } ++ ++ resource->res_stats[UNLOCK]++; ++ resource->lock_count--; ++ } ++ ++ pr_debug("[%s]: success to unlock data - hdl %x, base address %p, ref-cnt %d\n", ++ __func__, unlock.res_handle, unlock.res_mem, ++ resource->lock_count); ++ ++error: ++ if (resource) ++ vmcs_sm_release_resource(resource, 0); ++ ++ return ret; ++} ++ ++/* Handle control from host. */ ++static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ++{ ++ int ret = 0; ++ unsigned int cmdnr = _IOC_NR(cmd); ++ struct SM_PRIV_DATA_T *file_data = ++ (struct SM_PRIV_DATA_T *)file->private_data; ++ struct SM_RESOURCE_T *resource = NULL; ++ ++ /* Validate we can work with this device. */ ++ if ((sm_state == NULL) || (file_data == NULL)) { ++ pr_err("[%s]: invalid device\n", __func__); ++ ret = -EPERM; ++ goto out; ++ } ++ ++ pr_debug("[%s]: cmd %x tgid %u, owner %u\n", __func__, cmdnr, ++ current->tgid, file_data->pid); ++ ++ /* Action is a re-post of a previously interrupted action? */ ++ if (file_data->restart_sys == -EINTR) { ++ VC_SM_ACTION_CLEAN_T action_clean; ++ ++ pr_debug("[%s]: clean up of action %u (trans_id: %u) following EINTR\n", ++ __func__, file_data->int_action, ++ file_data->int_trans_id); ++ ++ action_clean.res_action = file_data->int_action; ++ action_clean.action_trans_id = file_data->int_trans_id; ++ ++ vc_vchi_sm_clean_up(sm_state->sm_handle, &action_clean); ++ ++ file_data->restart_sys = 0; ++ } ++ ++ /* Now process the command. ++ */ ++ switch (cmdnr) { ++ /* New memory allocation. ++ */ ++ case VMCS_SM_CMD_ALLOC: ++ { ++ struct vmcs_sm_ioctl_alloc ioparam; ++ ++ /* Get the parameter data. ++ */ ++ if (copy_from_user ++ (&ioparam, (void *)arg, sizeof(ioparam)) != 0) { ++ pr_err("[%s]: failed to copy-from-user for cmd %x\n", ++ __func__, cmdnr); ++ ret = -EFAULT; ++ goto out; ++ } ++ ++ ret = vc_sm_ioctl_alloc(file_data, &ioparam); ++ if (!ret && ++ (copy_to_user((void *)arg, ++ &ioparam, sizeof(ioparam)) != 0)) { ++ struct vmcs_sm_ioctl_free freeparam = { ++ ioparam.handle ++ }; ++ pr_err("[%s]: failed to copy-to-user for cmd %x\n", ++ __func__, cmdnr); ++ vc_sm_ioctl_free(file_data, &freeparam); ++ ret = -EFAULT; ++ } ++ ++ /* Done. ++ */ ++ goto out; ++ } ++ break; ++ ++ /* Share existing memory allocation. ++ */ ++ case VMCS_SM_CMD_ALLOC_SHARE: ++ { ++ struct vmcs_sm_ioctl_alloc_share ioparam; ++ ++ /* Get the parameter data. ++ */ ++ if (copy_from_user ++ (&ioparam, (void *)arg, sizeof(ioparam)) != 0) { ++ pr_err("[%s]: failed to copy-from-user for cmd %x\n", ++ __func__, cmdnr); ++ ret = -EFAULT; ++ goto out; ++ } ++ ++ ret = vc_sm_ioctl_alloc_share(file_data, &ioparam); ++ ++ /* Copy result back to user. ++ */ ++ if (!ret ++ && copy_to_user((void *)arg, &ioparam, ++ sizeof(ioparam)) != 0) { ++ struct vmcs_sm_ioctl_free freeparam = { ++ ioparam.handle ++ }; ++ pr_err("[%s]: failed to copy-to-user for cmd %x\n", ++ __func__, cmdnr); ++ vc_sm_ioctl_free(file_data, &freeparam); ++ ret = -EFAULT; ++ } ++ ++ /* Done. ++ */ ++ goto out; ++ } ++ break; ++ ++ /* Lock (attempt to) *and* register a cache behavior change. ++ */ ++ case VMCS_SM_CMD_LOCK_CACHE: ++ { ++ struct vmcs_sm_ioctl_lock_cache ioparam; ++ struct vmcs_sm_ioctl_lock_unlock lock; ++ ++ /* Get parameter data. ++ */ ++ if (copy_from_user ++ (&ioparam, (void *)arg, sizeof(ioparam)) != 0) { ++ pr_err("[%s]: failed to copy-from-user for cmd %x\n", ++ __func__, cmdnr); ++ ret = -EFAULT; ++ goto out; ++ } ++ ++ lock.handle = ioparam.handle; ++ ret = ++ vc_sm_ioctl_lock(file_data, &lock, 1, ++ ioparam.cached, 0); ++ ++ /* Done. ++ */ ++ goto out; ++ } ++ break; ++ ++ /* Lock (attempt to) existing memory allocation. ++ */ ++ case VMCS_SM_CMD_LOCK: ++ { ++ struct vmcs_sm_ioctl_lock_unlock ioparam; ++ ++ /* Get parameter data. ++ */ ++ if (copy_from_user ++ (&ioparam, (void *)arg, sizeof(ioparam)) != 0) { ++ pr_err("[%s]: failed to copy-from-user for cmd %x\n", ++ __func__, cmdnr); ++ ret = -EFAULT; ++ goto out; ++ } ++ ++ ret = vc_sm_ioctl_lock(file_data, &ioparam, 0, 0, 0); ++ ++ /* Copy result back to user. ++ */ ++ if (copy_to_user((void *)arg, &ioparam, sizeof(ioparam)) ++ != 0) { ++ pr_err("[%s]: failed to copy-to-user for cmd %x\n", ++ __func__, cmdnr); ++ ret = -EFAULT; ++ } ++ ++ /* Done. ++ */ ++ goto out; ++ } ++ break; ++ ++ /* Unlock (attempt to) existing memory allocation. ++ */ ++ case VMCS_SM_CMD_UNLOCK: ++ { ++ struct vmcs_sm_ioctl_lock_unlock ioparam; ++ ++ /* Get parameter data. ++ */ ++ if (copy_from_user ++ (&ioparam, (void *)arg, sizeof(ioparam)) != 0) { ++ pr_err("[%s]: failed to copy-from-user for cmd %x\n", ++ __func__, cmdnr); ++ ret = -EFAULT; ++ goto out; ++ } ++ ++ ret = vc_sm_ioctl_unlock(file_data, &ioparam, 0, 1, 0); ++ ++ /* Done. ++ */ ++ goto out; ++ } ++ break; ++ ++ /* Resize (attempt to) existing memory allocation. ++ */ ++ case VMCS_SM_CMD_RESIZE: ++ { ++ struct vmcs_sm_ioctl_resize ioparam; ++ ++ /* Get parameter data. ++ */ ++ if (copy_from_user ++ (&ioparam, (void *)arg, sizeof(ioparam)) != 0) { ++ pr_err("[%s]: failed to copy-from-user for cmd %x\n", ++ __func__, cmdnr); ++ ret = -EFAULT; ++ goto out; ++ } ++ ++ ret = vc_sm_ioctl_resize(file_data, &ioparam); ++ ++ /* Copy result back to user. ++ */ ++ if (copy_to_user((void *)arg, &ioparam, sizeof(ioparam)) ++ != 0) { ++ pr_err("[%s]: failed to copy-to-user for cmd %x\n", ++ __func__, cmdnr); ++ ret = -EFAULT; ++ } ++ ++ /* Done. ++ */ ++ goto out; ++ } ++ break; ++ ++ /* Terminate existing memory allocation. ++ */ ++ case VMCS_SM_CMD_FREE: ++ { ++ struct vmcs_sm_ioctl_free ioparam; ++ ++ /* Get parameter data. ++ */ ++ if (copy_from_user ++ (&ioparam, (void *)arg, sizeof(ioparam)) != 0) { ++ pr_err("[%s]: failed to copy-from-user for cmd %x\n", ++ __func__, cmdnr); ++ ret = -EFAULT; ++ goto out; ++ } ++ ++ ret = vc_sm_ioctl_free(file_data, &ioparam); ++ ++ /* Done. ++ */ ++ goto out; ++ } ++ break; ++ ++ /* Walk allocation on videocore, information shows up in the ++ ** videocore log. ++ */ ++ case VMCS_SM_CMD_VC_WALK_ALLOC: ++ { ++ pr_debug("[%s]: invoking walk alloc\n", __func__); ++ ++ if (vc_vchi_sm_walk_alloc(sm_state->sm_handle) != 0) ++ pr_err("[%s]: failed to walk-alloc on videocore\n", ++ __func__); ++ ++ /* Done. ++ */ ++ goto out; ++ } ++ break; ++/* Walk mapping table on host, information shows up in the ++ ** kernel log. ++ */ ++ case VMCS_SM_CMD_HOST_WALK_MAP: ++ { ++ /* Use pid of -1 to tell to walk the whole map. */ ++ vmcs_sm_host_walk_map_per_pid(-1); ++ ++ /* Done. */ ++ goto out; ++ } ++ break; ++ ++ /* Walk mapping table per process on host. */ ++ case VMCS_SM_CMD_HOST_WALK_PID_ALLOC: ++ { ++ struct vmcs_sm_ioctl_walk ioparam; ++ ++ /* Get parameter data. */ ++ if (copy_from_user(&ioparam, ++ (void *)arg, sizeof(ioparam)) != 0) { ++ pr_err("[%s]: failed to copy-from-user for cmd %x\n", ++ __func__, cmdnr); ++ ret = -EFAULT; ++ goto out; ++ } ++ ++ vmcs_sm_host_walk_alloc(file_data); ++ ++ /* Done. */ ++ goto out; ++ } ++ break; ++ ++ /* Walk allocation per process on host. */ ++ case VMCS_SM_CMD_HOST_WALK_PID_MAP: ++ { ++ struct vmcs_sm_ioctl_walk ioparam; ++ ++ /* Get parameter data. */ ++ if (copy_from_user(&ioparam, ++ (void *)arg, sizeof(ioparam)) != 0) { ++ pr_err("[%s]: failed to copy-from-user for cmd %x\n", ++ __func__, cmdnr); ++ ret = -EFAULT; ++ goto out; ++ } ++ ++ vmcs_sm_host_walk_map_per_pid(ioparam.pid); ++ ++ /* Done. */ ++ goto out; ++ } ++ break; ++ ++ /* Gets the size of the memory associated with a user handle. */ ++ case VMCS_SM_CMD_SIZE_USR_HANDLE: ++ { ++ struct vmcs_sm_ioctl_size ioparam; ++ ++ /* Get parameter data. */ ++ if (copy_from_user(&ioparam, ++ (void *)arg, sizeof(ioparam)) != 0) { ++ pr_err("[%s]: failed to copy-from-user for cmd %x\n", ++ __func__, cmdnr); ++ ret = -EFAULT; ++ goto out; ++ } ++ ++ /* Locate resource from GUID. */ ++ resource = ++ vmcs_sm_acquire_resource(file_data, ioparam.handle); ++ if (resource != NULL) { ++ ioparam.size = resource->res_size; ++ vmcs_sm_release_resource(resource, 0); ++ } else { ++ ioparam.size = 0; ++ } ++ ++ if (copy_to_user((void *)arg, ++ &ioparam, sizeof(ioparam)) != 0) { ++ pr_err("[%s]: failed to copy-to-user for cmd %x\n", ++ __func__, cmdnr); ++ ret = -EFAULT; ++ } ++ ++ /* Done. */ ++ goto out; ++ } ++ break; ++ ++ /* Verify we are dealing with a valid resource. */ ++ case VMCS_SM_CMD_CHK_USR_HANDLE: ++ { ++ struct vmcs_sm_ioctl_chk ioparam; ++ ++ /* Get parameter data. ++ */ ++ if (copy_from_user(&ioparam, ++ (void *)arg, sizeof(ioparam)) != 0) { ++ pr_err("[%s]: failed to copy-from-user for cmd %x\n", ++ __func__, cmdnr); ++ ++ ret = -EFAULT; ++ goto out; ++ } ++ ++ /* Locate resource from GUID. */ ++ resource = ++ vmcs_sm_acquire_resource(file_data, ioparam.handle); ++ if (resource == NULL) ++ ret = -EINVAL; ++ /* If the resource is cacheable, return additional ++ * information that may be needed to flush the cache. ++ */ ++ else if ((resource->res_cached == VMCS_SM_CACHE_HOST) || ++ (resource->res_cached == VMCS_SM_CACHE_BOTH)) { ++ ioparam.addr = ++ vmcs_sm_usr_address_from_pid_and_usr_handle ++ (current->tgid, ioparam.handle); ++ ioparam.size = resource->res_size; ++ ioparam.cache = resource->res_cached; ++ } else { ++ ioparam.addr = 0; ++ ioparam.size = 0; ++ ioparam.cache = resource->res_cached; ++ } ++ ++ if (resource) ++ vmcs_sm_release_resource(resource, 0); ++ ++ if (copy_to_user((void *)arg, ++ &ioparam, sizeof(ioparam)) != 0) { ++ pr_err("[%s]: failed to copy-to-user for cmd %x\n", ++ __func__, cmdnr); ++ ret = -EFAULT; ++ } ++ ++ /* Done. ++ */ ++ goto out; ++ } ++ break; ++ ++ /* ++ * Maps a user handle given the process and the virtual address. ++ */ ++ case VMCS_SM_CMD_MAPPED_USR_HANDLE: ++ { ++ struct vmcs_sm_ioctl_map ioparam; ++ ++ /* Get parameter data. */ ++ if (copy_from_user(&ioparam, ++ (void *)arg, sizeof(ioparam)) != 0) { ++ pr_err("[%s]: failed to copy-from-user for cmd %x\n", ++ __func__, cmdnr); ++ ++ ret = -EFAULT; ++ goto out; ++ } ++ ++ ioparam.handle = ++ vmcs_sm_usr_handle_from_pid_and_address( ++ ioparam.pid, ioparam.addr); ++ ++ resource = ++ vmcs_sm_acquire_resource(file_data, ioparam.handle); ++ if ((resource != NULL) ++ && ((resource->res_cached == VMCS_SM_CACHE_HOST) ++ || (resource->res_cached == ++ VMCS_SM_CACHE_BOTH))) { ++ ioparam.size = resource->res_size; ++ } else { ++ ioparam.size = 0; ++ } ++ ++ if (resource) ++ vmcs_sm_release_resource(resource, 0); ++ ++ if (copy_to_user((void *)arg, ++ &ioparam, sizeof(ioparam)) != 0) { ++ pr_err("[%s]: failed to copy-to-user for cmd %x\n", ++ __func__, cmdnr); ++ ret = -EFAULT; ++ } ++ ++ /* Done. */ ++ goto out; ++ } ++ break; ++ ++ /* ++ * Maps a videocore handle given process and virtual address. ++ */ ++ case VMCS_SM_CMD_MAPPED_VC_HDL_FROM_ADDR: ++ { ++ struct vmcs_sm_ioctl_map ioparam; ++ ++ /* Get parameter data. */ ++ if (copy_from_user(&ioparam, ++ (void *)arg, sizeof(ioparam)) != 0) { ++ pr_err("[%s]: failed to copy-from-user for cmd %x\n", ++ __func__, cmdnr); ++ ret = -EFAULT; ++ goto out; ++ } ++ ++ ioparam.handle = vmcs_sm_vc_handle_from_pid_and_address( ++ ioparam.pid, ioparam.addr); ++ ++ if (copy_to_user((void *)arg, ++ &ioparam, sizeof(ioparam)) != 0) { ++ pr_err("[%s]: failed to copy-to-user for cmd %x\n", ++ __func__, cmdnr); ++ ++ ret = -EFAULT; ++ } ++ ++ /* Done. ++ */ ++ goto out; ++ } ++ break; ++ ++ /* Maps a videocore handle given process and user handle. */ ++ case VMCS_SM_CMD_MAPPED_VC_HDL_FROM_HDL: ++ { ++ struct vmcs_sm_ioctl_map ioparam; ++ ++ /* Get parameter data. */ ++ if (copy_from_user(&ioparam, ++ (void *)arg, sizeof(ioparam)) != 0) { ++ pr_err("[%s]: failed to copy-from-user for cmd %x\n", ++ __func__, cmdnr); ++ ret = -EFAULT; ++ goto out; ++ } ++ ++ /* Locate resource from GUID. */ ++ resource = ++ vmcs_sm_acquire_resource(file_data, ioparam.handle); ++ if (resource != NULL) { ++ ioparam.handle = resource->res_handle; ++ vmcs_sm_release_resource(resource, 0); ++ } else { ++ ioparam.handle = 0; ++ } ++ ++ if (copy_to_user((void *)arg, ++ &ioparam, sizeof(ioparam)) != 0) { ++ pr_err("[%s]: failed to copy-to-user for cmd %x\n", ++ __func__, cmdnr); ++ ++ ret = -EFAULT; ++ } ++ ++ /* Done. */ ++ goto out; ++ } ++ break; ++ ++ /* ++ * Maps a videocore address given process and videocore handle. ++ */ ++ case VMCS_SM_CMD_MAPPED_VC_ADDR_FROM_HDL: ++ { ++ struct vmcs_sm_ioctl_map ioparam; ++ ++ /* Get parameter data. */ ++ if (copy_from_user(&ioparam, ++ (void *)arg, sizeof(ioparam)) != 0) { ++ pr_err("[%s]: failed to copy-from-user for cmd %x\n", ++ __func__, cmdnr); ++ ++ ret = -EFAULT; ++ goto out; ++ } ++ ++ /* Locate resource from GUID. */ ++ resource = ++ vmcs_sm_acquire_resource(file_data, ioparam.handle); ++ if (resource != NULL) { ++ ioparam.addr = ++ (unsigned int)resource->res_base_mem; ++ vmcs_sm_release_resource(resource, 0); ++ } else { ++ ioparam.addr = 0; ++ } ++ ++ if (copy_to_user((void *)arg, ++ &ioparam, sizeof(ioparam)) != 0) { ++ pr_err("[%s]: failed to copy-to-user for cmd %x\n", ++ __func__, cmdnr); ++ ret = -EFAULT; ++ } ++ ++ /* Done. */ ++ goto out; ++ } ++ break; ++ ++ /* Maps a user address given process and vc handle. ++ */ ++ case VMCS_SM_CMD_MAPPED_USR_ADDRESS: ++ { ++ struct vmcs_sm_ioctl_map ioparam; ++ ++ /* Get parameter data. */ ++ if (copy_from_user(&ioparam, ++ (void *)arg, sizeof(ioparam)) != 0) { ++ pr_err("[%s]: failed to copy-from-user for cmd %x\n", ++ __func__, cmdnr); ++ ret = -EFAULT; ++ goto out; ++ } ++ ++ /* ++ * Return the address information from the mapping, ++ * 0 (ie NULL) if it cannot locate the actual mapping. ++ */ ++ ioparam.addr = ++ vmcs_sm_usr_address_from_pid_and_usr_handle ++ (ioparam.pid, ioparam.handle); ++ ++ if (copy_to_user((void *)arg, ++ &ioparam, sizeof(ioparam)) != 0) { ++ pr_err("[%s]: failed to copy-to-user for cmd %x\n", ++ __func__, cmdnr); ++ ret = -EFAULT; ++ } ++ ++ /* Done. */ ++ goto out; ++ } ++ break; ++ ++ /* Flush the cache for a given mapping. */ ++ case VMCS_SM_CMD_FLUSH: ++ { ++ struct vmcs_sm_ioctl_cache ioparam; ++ ++ /* Get parameter data. */ ++ if (copy_from_user(&ioparam, ++ (void *)arg, sizeof(ioparam)) != 0) { ++ pr_err("[%s]: failed to copy-from-user for cmd %x\n", ++ __func__, cmdnr); ++ ret = -EFAULT; ++ goto out; ++ } ++ ++ /* Locate resource from GUID. */ ++ resource = ++ vmcs_sm_acquire_resource(file_data, ioparam.handle); ++ ++ if ((resource != NULL) && resource->res_cached) { ++ dma_addr_t phys_addr = 0; ++ ++ resource->res_stats[FLUSH]++; ++ ++ phys_addr = ++ (dma_addr_t)((uint32_t) ++ resource->res_base_mem & ++ 0x3FFFFFFF); ++ phys_addr += (dma_addr_t)mm_vc_mem_phys_addr; ++ ++ /* L1 cache flush */ ++ down_read(&current->mm->mmap_sem); ++ vcsm_vma_cache_clean_page_range((unsigned long) ++ ioparam.addr, ++ (unsigned long) ++ ioparam.addr + ++ ioparam.size); ++ up_read(&current->mm->mmap_sem); ++ ++ /* L2 cache flush */ ++ outer_clean_range(phys_addr, ++ phys_addr + ++ (size_t) ioparam.size); ++ } else if (resource == NULL) { ++ ret = -EINVAL; ++ goto out; ++ } ++ ++ if (resource) ++ vmcs_sm_release_resource(resource, 0); ++ ++ /* Done. */ ++ goto out; ++ } ++ break; ++ ++ /* Invalidate the cache for a given mapping. */ ++ case VMCS_SM_CMD_INVALID: ++ { ++ struct vmcs_sm_ioctl_cache ioparam; ++ ++ /* Get parameter data. */ ++ if (copy_from_user(&ioparam, ++ (void *)arg, sizeof(ioparam)) != 0) { ++ pr_err("[%s]: failed to copy-from-user for cmd %x\n", ++ __func__, cmdnr); ++ ret = -EFAULT; ++ goto out; ++ } ++ ++ /* Locate resource from GUID. ++ */ ++ resource = ++ vmcs_sm_acquire_resource(file_data, ioparam.handle); ++ ++ if ((resource != NULL) && resource->res_cached) { ++ dma_addr_t phys_addr = 0; ++ ++ resource->res_stats[INVALID]++; ++ ++ phys_addr = ++ (dma_addr_t)((uint32_t) ++ resource->res_base_mem & ++ 0x3FFFFFFF); ++ phys_addr += (dma_addr_t)mm_vc_mem_phys_addr; ++ ++ /* L2 cache invalidate */ ++ outer_inv_range(phys_addr, ++ phys_addr + ++ (size_t) ioparam.size); ++ ++ /* L1 cache invalidate */ ++ down_read(&current->mm->mmap_sem); ++ vcsm_vma_cache_clean_page_range((unsigned long) ++ ioparam.addr, ++ (unsigned long) ++ ioparam.addr + ++ ioparam.size); ++ up_read(&current->mm->mmap_sem); ++ } else if (resource == NULL) { ++ ret = -EINVAL; ++ goto out; ++ } ++ ++ if (resource) ++ vmcs_sm_release_resource(resource, 0); ++ ++ /* Done. ++ */ ++ goto out; ++ } ++ break; ++ ++ /* Flush/Invalidate the cache for a given mapping. */ ++ case VMCS_SM_CMD_CLEAN_INVALID: ++ { ++ int i; ++ struct vmcs_sm_ioctl_clean_invalid ioparam; ++ ++ /* Get parameter data. */ ++ if (copy_from_user(&ioparam, ++ (void *)arg, sizeof(ioparam)) != 0) { ++ pr_err("[%s]: failed to copy-from-user for cmd %x\n", ++ __func__, cmdnr); ++ ret = -EFAULT; ++ goto out; ++ } ++ for (i=0; i<sizeof ioparam.s/sizeof *ioparam.s; i++) { ++ switch (ioparam.s[i].cmd) { ++ default: case 0: break; /* NOOP */ ++ case 1: /* L1/L2 invalidate virtual range */ ++ case 2: /* L1/L2 clean physical range */ ++ case 3: /* L1/L2 clean+invalidate all */ ++ { ++ /* Locate resource from GUID. ++ */ ++ resource = ++ vmcs_sm_acquire_resource(file_data, ioparam.s[i].handle); ++ ++ if ((resource != NULL) && resource->res_cached) { ++ unsigned long base = ioparam.s[i].addr & ~(PAGE_SIZE-1); ++ unsigned long end = (ioparam.s[i].addr + ioparam.s[i].size + PAGE_SIZE-1) & ~(PAGE_SIZE-1); ++ resource->res_stats[ioparam.s[i].cmd == 1 ? INVALID:FLUSH]++; ++ ++ /* L1/L2 cache flush */ ++ down_read(&current->mm->mmap_sem); ++ vcsm_vma_cache_clean_page_range(base, end); ++ up_read(&current->mm->mmap_sem); ++ } else if (resource == NULL) { ++ ret = -EINVAL; ++ goto out; ++ } ++ ++ if (resource) ++ vmcs_sm_release_resource(resource, 0); ++ } ++ break; ++ } ++ } ++ } ++ break; ++ ++ default: ++ { ++ ret = -EINVAL; ++ goto out; ++ } ++ break; ++ } ++ ++out: ++ return ret; ++} ++ ++/* Device operations that we managed in this driver. ++*/ ++static const struct file_operations vmcs_sm_ops = { ++ .owner = THIS_MODULE, ++ .unlocked_ioctl = vc_sm_ioctl, ++ .open = vc_sm_open, ++ .release = vc_sm_release, ++ .mmap = vc_sm_mmap, ++}; ++ ++/* Creation of device. ++*/ ++static int vc_sm_create_sharedmemory(void) ++{ ++ int ret; ++ ++ if (sm_state == NULL) { ++ ret = -ENOMEM; ++ goto out; ++ } ++ ++ /* Create a device class for creating dev nodes. ++ */ ++ sm_state->sm_class = class_create(THIS_MODULE, "vc-sm"); ++ if (IS_ERR(sm_state->sm_class)) { ++ pr_err("[%s]: unable to create device class\n", __func__); ++ ret = PTR_ERR(sm_state->sm_class); ++ goto out; ++ } ++ ++ /* Create a character driver. ++ */ ++ ret = alloc_chrdev_region(&sm_state->sm_devid, ++ DEVICE_MINOR, 1, DEVICE_NAME); ++ if (ret != 0) { ++ pr_err("[%s]: unable to allocate device number\n", __func__); ++ goto out_dev_class_destroy; ++ } ++ ++ cdev_init(&sm_state->sm_cdev, &vmcs_sm_ops); ++ ret = cdev_add(&sm_state->sm_cdev, sm_state->sm_devid, 1); ++ if (ret != 0) { ++ pr_err("[%s]: unable to register device\n", __func__); ++ goto out_chrdev_unreg; ++ } ++ ++ /* Create a device node. ++ */ ++ sm_state->sm_dev = device_create(sm_state->sm_class, ++ NULL, ++ MKDEV(MAJOR(sm_state->sm_devid), ++ DEVICE_MINOR), NULL, ++ DEVICE_NAME); ++ if (IS_ERR(sm_state->sm_dev)) { ++ pr_err("[%s]: unable to create device node\n", __func__); ++ ret = PTR_ERR(sm_state->sm_dev); ++ goto out_chrdev_del; ++ } ++ ++ goto out; ++ ++out_chrdev_del: ++ cdev_del(&sm_state->sm_cdev); ++out_chrdev_unreg: ++ unregister_chrdev_region(sm_state->sm_devid, 1); ++out_dev_class_destroy: ++ class_destroy(sm_state->sm_class); ++ sm_state->sm_class = NULL; ++out: ++ return ret; ++} ++ ++/* Termination of the device. ++*/ ++static int vc_sm_remove_sharedmemory(void) ++{ ++ int ret; ++ ++ if (sm_state == NULL) { ++ /* Nothing to do. ++ */ ++ ret = 0; ++ goto out; ++ } ++ ++ /* Remove the sharedmemory character driver. ++ */ ++ cdev_del(&sm_state->sm_cdev); ++ ++ /* Unregister region. ++ */ ++ unregister_chrdev_region(sm_state->sm_devid, 1); ++ ++ ret = 0; ++ goto out; ++ ++out: ++ return ret; ++} ++ ++/* Videocore connected. */ ++static void vc_sm_connected_init(void) ++{ ++ int ret; ++ VCHI_INSTANCE_T vchi_instance; ++ VCHI_CONNECTION_T *vchi_connection = NULL; ++ ++ pr_info("[%s]: start\n", __func__); ++ ++ /* Allocate memory for the state structure. ++ */ ++ sm_state = kzalloc(sizeof(struct SM_STATE_T), GFP_KERNEL); ++ if (sm_state == NULL) { ++ pr_err("[%s]: failed to allocate memory\n", __func__); ++ ret = -ENOMEM; ++ goto out; ++ } ++ ++ mutex_init(&sm_state->lock); ++ mutex_init(&sm_state->map_lock); ++ ++ /* Initialize and create a VCHI connection for the shared memory service ++ ** running on videocore. ++ */ ++ ret = vchi_initialise(&vchi_instance); ++ if (ret != 0) { ++ pr_err("[%s]: failed to initialise VCHI instance (ret=%d)\n", ++ __func__, ret); ++ ++ ret = -EIO; ++ goto err_free_mem; ++ } ++ ++ ret = vchi_connect(NULL, 0, vchi_instance); ++ if (ret != 0) { ++ pr_err("[%s]: failed to connect VCHI instance (ret=%d)\n", ++ __func__, ret); ++ ++ ret = -EIO; ++ goto err_free_mem; ++ } ++ ++ /* Initialize an instance of the shared memory service. */ ++ sm_state->sm_handle = ++ vc_vchi_sm_init(vchi_instance, &vchi_connection, 1); ++ if (sm_state->sm_handle == NULL) { ++ pr_err("[%s]: failed to initialize shared memory service\n", ++ __func__); ++ ++ ret = -EPERM; ++ goto err_free_mem; ++ } ++ ++ /* Create a debug fs directory entry (root). */ ++ sm_state->dir_root = debugfs_create_dir(VC_SM_DIR_ROOT_NAME, NULL); ++ if (!sm_state->dir_root) { ++ pr_err("[%s]: failed to create \'%s\' directory entry\n", ++ __func__, VC_SM_DIR_ROOT_NAME); ++ ++ ret = -EPERM; ++ goto err_stop_sm_service; ++ } ++ ++ sm_state->dir_state.show = &vc_sm_global_state_show; ++ sm_state->dir_state.dir_entry = debugfs_create_file(VC_SM_STATE, ++ S_IRUGO, sm_state->dir_root, &sm_state->dir_state, ++ &vc_sm_debug_fs_fops); ++ ++ sm_state->dir_stats.show = &vc_sm_global_statistics_show; ++ sm_state->dir_stats.dir_entry = debugfs_create_file(VC_SM_STATS, ++ S_IRUGO, sm_state->dir_root, &sm_state->dir_stats, ++ &vc_sm_debug_fs_fops); ++ ++ /* Create the proc entry children. */ ++ sm_state->dir_alloc = debugfs_create_dir(VC_SM_DIR_ALLOC_NAME, ++ sm_state->dir_root); ++ ++ /* Create a shared memory device. */ ++ ret = vc_sm_create_sharedmemory(); ++ if (ret != 0) { ++ pr_err("[%s]: failed to create shared memory device\n", ++ __func__); ++ goto err_remove_debugfs; ++ } ++ ++ INIT_LIST_HEAD(&sm_state->map_list); ++ INIT_LIST_HEAD(&sm_state->resource_list); ++ ++ sm_state->data_knl = vc_sm_create_priv_data(0); ++ if (sm_state->data_knl == NULL) { ++ pr_err("[%s]: failed to create kernel private data tracker\n", ++ __func__); ++ goto err_remove_shared_memory; ++ } ++ ++ /* Done! ++ */ ++ sm_inited = 1; ++ goto out; ++ ++err_remove_shared_memory: ++ vc_sm_remove_sharedmemory(); ++err_remove_debugfs: ++ debugfs_remove_recursive(sm_state->dir_root); ++err_stop_sm_service: ++ vc_vchi_sm_stop(&sm_state->sm_handle); ++err_free_mem: ++ kfree(sm_state); ++out: ++ pr_info("[%s]: end - returning %d\n", __func__, ret); ++} ++ ++/* Driver loading. */ ++static int __init vc_sm_init(void) ++{ ++ pr_info("vc-sm: Videocore shared memory driver\n"); ++ vchiq_add_connected_callback(vc_sm_connected_init); ++ return 0; ++} ++ ++/* Driver unloading. */ ++static void __exit vc_sm_exit(void) ++{ ++ pr_debug("[%s]: start\n", __func__); ++ if (sm_inited) { ++ /* Remove shared memory device. ++ */ ++ vc_sm_remove_sharedmemory(); ++ ++ /* Remove all proc entries. ++ */ ++ debugfs_remove_recursive(sm_state->dir_root); ++ ++ /* Stop the videocore shared memory service. ++ */ ++ vc_vchi_sm_stop(&sm_state->sm_handle); ++ ++ /* Free the memory for the state structure. ++ */ ++ mutex_destroy(&(sm_state->map_lock)); ++ kfree(sm_state); ++ } ++ ++ pr_debug("[%s]: end\n", __func__); ++} ++ ++#if defined(__KERNEL__) ++/* Allocate a shared memory handle and block. */ ++int vc_sm_alloc(VC_SM_ALLOC_T *alloc, int *handle) ++{ ++ struct vmcs_sm_ioctl_alloc ioparam = { 0 }; ++ int ret; ++ struct SM_RESOURCE_T *resource; ++ ++ /* Validate we can work with this device. ++ */ ++ if (sm_state == NULL || alloc == NULL || handle == NULL) { ++ pr_err("[%s]: invalid input\n", __func__); ++ return -EPERM; ++ } ++ ++ ioparam.size = alloc->base_unit; ++ ioparam.num = alloc->num_unit; ++ ioparam.cached = ++ alloc->type == VC_SM_ALLOC_CACHED ? VMCS_SM_CACHE_VC : 0; ++ ++ ret = vc_sm_ioctl_alloc(sm_state->data_knl, &ioparam); ++ ++ if (ret == 0) { ++ resource = ++ vmcs_sm_acquire_resource(sm_state->data_knl, ++ ioparam.handle); ++ if (resource) { ++ resource->pid = 0; ++ vmcs_sm_release_resource(resource, 0); ++ ++ /* Assign valid handle at this time. ++ */ ++ *handle = ioparam.handle; ++ } else { ++ ret = -ENOMEM; ++ } ++ } ++ ++ return ret; ++} ++EXPORT_SYMBOL_GPL(vc_sm_alloc); ++ ++/* Get an internal resource handle mapped from the external one. ++*/ ++int vc_sm_int_handle(int handle) ++{ ++ struct SM_RESOURCE_T *resource; ++ int ret = 0; ++ ++ /* Validate we can work with this device. ++ */ ++ if (sm_state == NULL || handle == 0) { ++ pr_err("[%s]: invalid input\n", __func__); ++ return 0; ++ } ++ ++ /* Locate resource from GUID. ++ */ ++ resource = vmcs_sm_acquire_resource(sm_state->data_knl, handle); ++ if (resource) { ++ ret = resource->res_handle; ++ vmcs_sm_release_resource(resource, 0); ++ } ++ ++ return ret; ++} ++EXPORT_SYMBOL_GPL(vc_sm_int_handle); ++ ++/* Free a previously allocated shared memory handle and block. ++*/ ++int vc_sm_free(int handle) ++{ ++ struct vmcs_sm_ioctl_free ioparam = { handle }; ++ ++ /* Validate we can work with this device. ++ */ ++ if (sm_state == NULL || handle == 0) { ++ pr_err("[%s]: invalid input\n", __func__); ++ return -EPERM; ++ } ++ ++ return vc_sm_ioctl_free(sm_state->data_knl, &ioparam); ++} ++EXPORT_SYMBOL_GPL(vc_sm_free); ++ ++/* Lock a memory handle for use by kernel. ++*/ ++int vc_sm_lock(int handle, VC_SM_LOCK_CACHE_MODE_T mode, ++ long unsigned int *data) ++{ ++ struct vmcs_sm_ioctl_lock_unlock ioparam; ++ int ret; ++ ++ /* Validate we can work with this device. ++ */ ++ if (sm_state == NULL || handle == 0 || data == NULL) { ++ pr_err("[%s]: invalid input\n", __func__); ++ return -EPERM; ++ } ++ ++ *data = 0; ++ ++ ioparam.handle = handle; ++ ret = vc_sm_ioctl_lock(sm_state->data_knl, ++ &ioparam, ++ 1, ++ ((mode == ++ VC_SM_LOCK_CACHED) ? VMCS_SM_CACHE_HOST : ++ VMCS_SM_CACHE_NONE), 0); ++ ++ *data = ioparam.addr; ++ return ret; ++} ++EXPORT_SYMBOL_GPL(vc_sm_lock); ++ ++/* Unlock a memory handle in use by kernel. ++*/ ++int vc_sm_unlock(int handle, int flush, int no_vc_unlock) ++{ ++ struct vmcs_sm_ioctl_lock_unlock ioparam; ++ ++ /* Validate we can work with this device. ++ */ ++ if (sm_state == NULL || handle == 0) { ++ pr_err("[%s]: invalid input\n", __func__); ++ return -EPERM; ++ } ++ ++ ioparam.handle = handle; ++ return vc_sm_ioctl_unlock(sm_state->data_knl, ++ &ioparam, flush, 0, no_vc_unlock); ++} ++EXPORT_SYMBOL_GPL(vc_sm_unlock); ++ ++/* Map a shared memory region for use by kernel. ++*/ ++int vc_sm_map(int handle, unsigned int sm_addr, VC_SM_LOCK_CACHE_MODE_T mode, ++ long unsigned int *data) ++{ ++ struct vmcs_sm_ioctl_lock_unlock ioparam; ++ int ret; ++ ++ /* Validate we can work with this device. ++ */ ++ if (sm_state == NULL || handle == 0 || data == NULL || sm_addr == 0) { ++ pr_err("[%s]: invalid input\n", __func__); ++ return -EPERM; ++ } ++ ++ *data = 0; ++ ++ ioparam.handle = handle; ++ ret = vc_sm_ioctl_lock(sm_state->data_knl, ++ &ioparam, ++ 1, ++ ((mode == ++ VC_SM_LOCK_CACHED) ? VMCS_SM_CACHE_HOST : ++ VMCS_SM_CACHE_NONE), sm_addr); ++ ++ *data = ioparam.addr; ++ return ret; ++} ++EXPORT_SYMBOL_GPL(vc_sm_map); ++#endif ++ ++late_initcall(vc_sm_init); ++module_exit(vc_sm_exit); ++ ++MODULE_AUTHOR("Broadcom"); ++MODULE_DESCRIPTION("VideoCore SharedMemory Driver"); ++MODULE_LICENSE("GPL v2"); +diff --git a/include/linux/broadcom/vmcs_sm_ioctl.h b/include/linux/broadcom/vmcs_sm_ioctl.h +new file mode 100644 +index 0000000..334f36d +--- /dev/null ++++ b/include/linux/broadcom/vmcs_sm_ioctl.h +@@ -0,0 +1,248 @@ ++/***************************************************************************** ++* Copyright 2011 Broadcom Corporation. All rights reserved. ++* ++* Unless you and Broadcom execute a separate written software license ++* agreement governing use of this software, this software is licensed to you ++* under the terms of the GNU General Public License version 2, available at ++* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). ++* ++* Notwithstanding the above, under no circumstances may you combine this ++* software in any way with any other Broadcom software provided under a ++* license other than the GPL, without Broadcom's express prior written ++* consent. ++* ++*****************************************************************************/ ++ ++#if !defined(__VMCS_SM_IOCTL_H__INCLUDED__) ++#define __VMCS_SM_IOCTL_H__INCLUDED__ ++ ++/* ---- Include Files ---------------------------------------------------- */ ++ ++#if defined(__KERNEL__) ++#include <linux/types.h> /* Needed for standard types */ ++#else ++#include <stdint.h> ++#endif ++ ++#include <linux/ioctl.h> ++ ++/* ---- Constants and Types ---------------------------------------------- */ ++ ++#define VMCS_SM_RESOURCE_NAME 32 ++#define VMCS_SM_RESOURCE_NAME_DEFAULT "sm-host-resource" ++ ++/* Type define used to create unique IOCTL number */ ++#define VMCS_SM_MAGIC_TYPE 'I' ++ ++/* IOCTL commands */ ++enum vmcs_sm_cmd_e { ++ VMCS_SM_CMD_ALLOC = 0x5A, /* Start at 0x5A arbitrarily */ ++ VMCS_SM_CMD_ALLOC_SHARE, ++ VMCS_SM_CMD_LOCK, ++ VMCS_SM_CMD_LOCK_CACHE, ++ VMCS_SM_CMD_UNLOCK, ++ VMCS_SM_CMD_RESIZE, ++ VMCS_SM_CMD_UNMAP, ++ VMCS_SM_CMD_FREE, ++ VMCS_SM_CMD_FLUSH, ++ VMCS_SM_CMD_INVALID, ++ ++ VMCS_SM_CMD_SIZE_USR_HANDLE, ++ VMCS_SM_CMD_CHK_USR_HANDLE, ++ ++ VMCS_SM_CMD_MAPPED_USR_HANDLE, ++ VMCS_SM_CMD_MAPPED_USR_ADDRESS, ++ VMCS_SM_CMD_MAPPED_VC_HDL_FROM_ADDR, ++ VMCS_SM_CMD_MAPPED_VC_HDL_FROM_HDL, ++ VMCS_SM_CMD_MAPPED_VC_ADDR_FROM_HDL, ++ ++ VMCS_SM_CMD_VC_WALK_ALLOC, ++ VMCS_SM_CMD_HOST_WALK_MAP, ++ VMCS_SM_CMD_HOST_WALK_PID_ALLOC, ++ VMCS_SM_CMD_HOST_WALK_PID_MAP, ++ ++ VMCS_SM_CMD_CLEAN_INVALID, ++ ++ VMCS_SM_CMD_LAST /* Do no delete */ ++}; ++ ++/* Cache type supported, conveniently matches the user space definition in ++** user-vcsm.h. ++*/ ++enum vmcs_sm_cache_e { ++ VMCS_SM_CACHE_NONE, ++ VMCS_SM_CACHE_HOST, ++ VMCS_SM_CACHE_VC, ++ VMCS_SM_CACHE_BOTH, ++}; ++ ++/* IOCTL Data structures */ ++struct vmcs_sm_ioctl_alloc { ++ /* user -> kernel */ ++ unsigned int size; ++ unsigned int num; ++ enum vmcs_sm_cache_e cached; ++ char name[VMCS_SM_RESOURCE_NAME]; ++ ++ /* kernel -> user */ ++ unsigned int handle; ++ /* unsigned int base_addr; */ ++}; ++ ++struct vmcs_sm_ioctl_alloc_share { ++ /* user -> kernel */ ++ unsigned int handle; ++ unsigned int size; ++}; ++ ++struct vmcs_sm_ioctl_free { ++ /* user -> kernel */ ++ unsigned int handle; ++ /* unsigned int base_addr; */ ++}; ++ ++struct vmcs_sm_ioctl_lock_unlock { ++ /* user -> kernel */ ++ unsigned int handle; ++ ++ /* kernel -> user */ ++ unsigned int addr; ++}; ++ ++struct vmcs_sm_ioctl_lock_cache { ++ /* user -> kernel */ ++ unsigned int handle; ++ enum vmcs_sm_cache_e cached; ++}; ++ ++struct vmcs_sm_ioctl_resize { ++ /* user -> kernel */ ++ unsigned int handle; ++ unsigned int new_size; ++ ++ /* kernel -> user */ ++ unsigned int old_size; ++}; ++ ++struct vmcs_sm_ioctl_map { ++ /* user -> kernel */ ++ /* and kernel -> user */ ++ unsigned int pid; ++ unsigned int handle; ++ unsigned int addr; ++ ++ /* kernel -> user */ ++ unsigned int size; ++}; ++ ++struct vmcs_sm_ioctl_walk { ++ /* user -> kernel */ ++ unsigned int pid; ++}; ++ ++struct vmcs_sm_ioctl_chk { ++ /* user -> kernel */ ++ unsigned int handle; ++ ++ /* kernel -> user */ ++ unsigned int addr; ++ unsigned int size; ++ enum vmcs_sm_cache_e cache; ++}; ++ ++struct vmcs_sm_ioctl_size { ++ /* user -> kernel */ ++ unsigned int handle; ++ ++ /* kernel -> user */ ++ unsigned int size; ++}; ++ ++struct vmcs_sm_ioctl_cache { ++ /* user -> kernel */ ++ unsigned int handle; ++ unsigned int addr; ++ unsigned int size; ++}; ++ ++struct vmcs_sm_ioctl_clean_invalid { ++ /* user -> kernel */ ++ struct { ++ unsigned int cmd; ++ unsigned int handle; ++ unsigned int addr; ++ unsigned int size; ++ } s[8]; ++}; ++ ++/* IOCTL numbers */ ++#define VMCS_SM_IOCTL_MEM_ALLOC\ ++ _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_ALLOC,\ ++ struct vmcs_sm_ioctl_alloc) ++#define VMCS_SM_IOCTL_MEM_ALLOC_SHARE\ ++ _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_ALLOC_SHARE,\ ++ struct vmcs_sm_ioctl_alloc_share) ++#define VMCS_SM_IOCTL_MEM_LOCK\ ++ _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_LOCK,\ ++ struct vmcs_sm_ioctl_lock_unlock) ++#define VMCS_SM_IOCTL_MEM_LOCK_CACHE\ ++ _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_LOCK_CACHE,\ ++ struct vmcs_sm_ioctl_lock_cache) ++#define VMCS_SM_IOCTL_MEM_UNLOCK\ ++ _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_UNLOCK,\ ++ struct vmcs_sm_ioctl_lock_unlock) ++#define VMCS_SM_IOCTL_MEM_RESIZE\ ++ _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_RESIZE,\ ++ struct vmcs_sm_ioctl_resize) ++#define VMCS_SM_IOCTL_MEM_FREE\ ++ _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_FREE,\ ++ struct vmcs_sm_ioctl_free) ++#define VMCS_SM_IOCTL_MEM_FLUSH\ ++ _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_FLUSH,\ ++ struct vmcs_sm_ioctl_cache) ++#define VMCS_SM_IOCTL_MEM_INVALID\ ++ _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_INVALID,\ ++ struct vmcs_sm_ioctl_cache) ++#define VMCS_SM_IOCTL_MEM_CLEAN_INVALID\ ++ _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_CLEAN_INVALID,\ ++ struct vmcs_sm_ioctl_clean_invalid) ++ ++#define VMCS_SM_IOCTL_SIZE_USR_HDL\ ++ _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_SIZE_USR_HANDLE,\ ++ struct vmcs_sm_ioctl_size) ++#define VMCS_SM_IOCTL_CHK_USR_HDL\ ++ _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_CHK_USR_HANDLE,\ ++ struct vmcs_sm_ioctl_chk) ++ ++#define VMCS_SM_IOCTL_MAP_USR_HDL\ ++ _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_MAPPED_USR_HANDLE,\ ++ struct vmcs_sm_ioctl_map) ++#define VMCS_SM_IOCTL_MAP_USR_ADDRESS\ ++ _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_MAPPED_USR_ADDRESS,\ ++ struct vmcs_sm_ioctl_map) ++#define VMCS_SM_IOCTL_MAP_VC_HDL_FR_ADDR\ ++ _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_MAPPED_VC_HDL_FROM_ADDR,\ ++ struct vmcs_sm_ioctl_map) ++#define VMCS_SM_IOCTL_MAP_VC_HDL_FR_HDL\ ++ _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_MAPPED_VC_HDL_FROM_HDL,\ ++ struct vmcs_sm_ioctl_map) ++#define VMCS_SM_IOCTL_MAP_VC_ADDR_FR_HDL\ ++ _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_MAPPED_VC_ADDR_FROM_HDL,\ ++ struct vmcs_sm_ioctl_map) ++ ++#define VMCS_SM_IOCTL_VC_WALK_ALLOC\ ++ _IO(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_VC_WALK_ALLOC) ++#define VMCS_SM_IOCTL_HOST_WALK_MAP\ ++ _IO(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_HOST_WALK_MAP) ++#define VMCS_SM_IOCTL_HOST_WALK_PID_ALLOC\ ++ _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_HOST_WALK_PID_ALLOC,\ ++ struct vmcs_sm_ioctl_walk) ++#define VMCS_SM_IOCTL_HOST_WALK_PID_MAP\ ++ _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_HOST_WALK_PID_MAP,\ ++ struct vmcs_sm_ioctl_walk) ++ ++/* ---- Variable Externs ------------------------------------------------- */ ++ ++/* ---- Function Prototypes ---------------------------------------------- */ ++ ++#endif /* __VMCS_SM_IOCTL_H__INCLUDED__ */ + +From a8149b98a7e18684c916b50e54b5b4c365bbe530 Mon Sep 17 00:00:00 2001 +From: Luke Wren <luke@raspberrypi.org> +Date: Fri, 21 Aug 2015 23:14:48 +0100 +Subject: [PATCH 044/112] Add /dev/gpiomem device for rootless user GPIO access + +Signed-off-by: Luke Wren <luke@raspberrypi.org> + +bcm2835-gpiomem: Fix for ARCH_BCM2835 builds + +Build on ARCH_BCM2835, and fail to probe if no IO resource. + +See: https://github.com/raspberrypi/linux/issues/1154 +--- + drivers/char/broadcom/Kconfig | 9 ++ + drivers/char/broadcom/Makefile | 3 + + drivers/char/broadcom/bcm2835-gpiomem.c | 260 ++++++++++++++++++++++++++++++++ + 3 files changed, 272 insertions(+) + create mode 100644 drivers/char/broadcom/bcm2835-gpiomem.c + +diff --git a/drivers/char/broadcom/Kconfig b/drivers/char/broadcom/Kconfig +index 75fa1cb..b75c9b2 100644 +--- a/drivers/char/broadcom/Kconfig ++++ b/drivers/char/broadcom/Kconfig +@@ -32,3 +32,12 @@ config BCM_VC_SM + help + Support for the VC shared memory on the Broadcom reference + design. Uses the VCHIQ stack. ++ ++config BCM2835_DEVGPIOMEM ++ tristate "/dev/gpiomem rootless GPIO access via mmap() on the BCM2835" ++ default m ++ help ++ Provides users with root-free access to the GPIO registers ++ on the 2835. Calling mmap(/dev/gpiomem) will map the GPIO ++ register page to the user's pointer. ++ +diff --git a/drivers/char/broadcom/Makefile b/drivers/char/broadcom/Makefile +index de8feb9..1eb06e9 100644 +--- a/drivers/char/broadcom/Makefile ++++ b/drivers/char/broadcom/Makefile +@@ -1,3 +1,6 @@ + obj-$(CONFIG_BCM_VC_CMA) += vc_cma/ + obj-$(CONFIG_BCM2708_VCMEM) += vc_mem.o + obj-$(CONFIG_BCM_VC_SM) += vc_sm/ ++ ++obj-$(CONFIG_BCM2835_DEVGPIOMEM)+= bcm2835-gpiomem.o ++ +diff --git a/drivers/char/broadcom/bcm2835-gpiomem.c b/drivers/char/broadcom/bcm2835-gpiomem.c +new file mode 100644 +index 0000000..911f5b7 +--- /dev/null ++++ b/drivers/char/broadcom/bcm2835-gpiomem.c +@@ -0,0 +1,260 @@ ++/** ++ * GPIO memory device driver ++ * ++ * Creates a chardev /dev/gpiomem which will provide user access to ++ * the BCM2835's GPIO registers when it is mmap()'d. ++ * No longer need root for user GPIO access, but without relaxing permissions ++ * on /dev/mem. ++ * ++ * Written by Luke Wren <luke@raspberrypi.org> ++ * Copyright (c) 2015, Raspberry Pi (Trading) Ltd. ++ * ++ * 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, ++ * without modification. ++ * 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. ++ * 3. The names of the above-listed copyright holders may not be used ++ * to endorse or promote products derived from this software without ++ * specific prior written permission. ++ * ++ * ALTERNATIVELY, this software may be distributed under the terms of the ++ * GNU General Public License ("GPL") version 2, as published by the Free ++ * Software Foundation. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER OR ++ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ++ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, ++ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR ++ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF ++ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING ++ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ */ ++ ++#include <linux/kernel.h> ++#include <linux/module.h> ++#include <linux/of.h> ++#include <linux/platform_device.h> ++#include <linux/mm.h> ++#include <linux/slab.h> ++#include <linux/cdev.h> ++#include <linux/pagemap.h> ++#include <linux/io.h> ++ ++#define DEVICE_NAME "bcm2835-gpiomem" ++#define DRIVER_NAME "gpiomem-bcm2835" ++#define DEVICE_MINOR 0 ++ ++struct bcm2835_gpiomem_instance { ++ unsigned long gpio_regs_phys; ++ struct device *dev; ++}; ++ ++static struct cdev bcm2835_gpiomem_cdev; ++static dev_t bcm2835_gpiomem_devid; ++static struct class *bcm2835_gpiomem_class; ++static struct device *bcm2835_gpiomem_dev; ++static struct bcm2835_gpiomem_instance *inst; ++ ++ ++/**************************************************************************** ++* ++* GPIO mem chardev file ops ++* ++***************************************************************************/ ++ ++static int bcm2835_gpiomem_open(struct inode *inode, struct file *file) ++{ ++ int dev = iminor(inode); ++ int ret = 0; ++ ++ dev_info(inst->dev, "gpiomem device opened."); ++ ++ if (dev != DEVICE_MINOR) { ++ dev_err(inst->dev, "Unknown minor device: %d", dev); ++ ret = -ENXIO; ++ } ++ return ret; ++} ++ ++static int bcm2835_gpiomem_release(struct inode *inode, struct file *file) ++{ ++ int dev = iminor(inode); ++ int ret = 0; ++ ++ if (dev != DEVICE_MINOR) { ++ dev_err(inst->dev, "Unknown minor device %d", dev); ++ ret = -ENXIO; ++ } ++ return ret; ++} ++ ++static const struct vm_operations_struct bcm2835_gpiomem_vm_ops = { ++#ifdef CONFIG_HAVE_IOREMAP_PROT ++ .access = generic_access_phys ++#endif ++}; ++ ++static int bcm2835_gpiomem_mmap(struct file *file, struct vm_area_struct *vma) ++{ ++ /* Ignore what the user says - they're getting the GPIO regs ++ whether they like it or not! */ ++ unsigned long gpio_page = inst->gpio_regs_phys >> PAGE_SHIFT; ++ ++ vma->vm_page_prot = phys_mem_access_prot(file, gpio_page, ++ PAGE_SIZE, ++ vma->vm_page_prot); ++ vma->vm_ops = &bcm2835_gpiomem_vm_ops; ++ if (remap_pfn_range(vma, vma->vm_start, ++ gpio_page, ++ PAGE_SIZE, ++ vma->vm_page_prot)) { ++ return -EAGAIN; ++ } ++ return 0; ++} ++ ++static const struct file_operations ++bcm2835_gpiomem_fops = { ++ .owner = THIS_MODULE, ++ .open = bcm2835_gpiomem_open, ++ .release = bcm2835_gpiomem_release, ++ .mmap = bcm2835_gpiomem_mmap, ++}; ++ ++ ++ /**************************************************************************** ++* ++* Probe and remove functions ++* ++***************************************************************************/ ++ ++ ++static int bcm2835_gpiomem_probe(struct platform_device *pdev) ++{ ++ int err; ++ void *ptr_err; ++ struct device *dev = &pdev->dev; ++ struct resource *ioresource; ++ ++ /* Allocate buffers and instance data */ ++ ++ inst = kzalloc(sizeof(struct bcm2835_gpiomem_instance), GFP_KERNEL); ++ ++ if (!inst) { ++ err = -ENOMEM; ++ goto failed_inst_alloc; ++ } ++ ++ inst->dev = dev; ++ ++ ioresource = platform_get_resource(pdev, IORESOURCE_MEM, 0); ++ if (ioresource) { ++ inst->gpio_regs_phys = ioresource->start; ++ } else { ++ dev_err(inst->dev, "failed to get IO resource"); ++ err = -ENOENT; ++ goto failed_get_resource; ++ } ++ ++ /* Create character device entries */ ++ ++ err = alloc_chrdev_region(&bcm2835_gpiomem_devid, ++ DEVICE_MINOR, 1, DEVICE_NAME); ++ if (err != 0) { ++ dev_err(inst->dev, "unable to allocate device number"); ++ goto failed_alloc_chrdev; ++ } ++ cdev_init(&bcm2835_gpiomem_cdev, &bcm2835_gpiomem_fops); ++ bcm2835_gpiomem_cdev.owner = THIS_MODULE; ++ err = cdev_add(&bcm2835_gpiomem_cdev, bcm2835_gpiomem_devid, 1); ++ if (err != 0) { ++ dev_err(inst->dev, "unable to register device"); ++ goto failed_cdev_add; ++ } ++ ++ /* Create sysfs entries */ ++ ++ bcm2835_gpiomem_class = class_create(THIS_MODULE, DEVICE_NAME); ++ ptr_err = bcm2835_gpiomem_class; ++ if (IS_ERR(ptr_err)) ++ goto failed_class_create; ++ ++ bcm2835_gpiomem_dev = device_create(bcm2835_gpiomem_class, NULL, ++ bcm2835_gpiomem_devid, NULL, ++ "gpiomem"); ++ ptr_err = bcm2835_gpiomem_dev; ++ if (IS_ERR(ptr_err)) ++ goto failed_device_create; ++ ++ dev_info(inst->dev, "Initialised: Registers at 0x%08lx", ++ inst->gpio_regs_phys); ++ ++ return 0; ++ ++failed_device_create: ++ class_destroy(bcm2835_gpiomem_class); ++failed_class_create: ++ cdev_del(&bcm2835_gpiomem_cdev); ++ err = PTR_ERR(ptr_err); ++failed_cdev_add: ++ unregister_chrdev_region(bcm2835_gpiomem_devid, 1); ++failed_alloc_chrdev: ++failed_get_resource: ++ kfree(inst); ++failed_inst_alloc: ++ dev_err(inst->dev, "could not load bcm2835_gpiomem"); ++ return err; ++} ++ ++static int bcm2835_gpiomem_remove(struct platform_device *pdev) ++{ ++ struct device *dev = inst->dev; ++ ++ kfree(inst); ++ device_destroy(bcm2835_gpiomem_class, bcm2835_gpiomem_devid); ++ class_destroy(bcm2835_gpiomem_class); ++ cdev_del(&bcm2835_gpiomem_cdev); ++ unregister_chrdev_region(bcm2835_gpiomem_devid, 1); ++ ++ dev_info(dev, "GPIO mem driver removed - OK"); ++ return 0; ++} ++ ++ /**************************************************************************** ++* ++* Register the driver with device tree ++* ++***************************************************************************/ ++ ++static const struct of_device_id bcm2835_gpiomem_of_match[] = { ++ {.compatible = "brcm,bcm2835-gpiomem",}, ++ { /* sentinel */ }, ++}; ++ ++MODULE_DEVICE_TABLE(of, bcm2835_gpiomem_of_match); ++ ++static struct platform_driver bcm2835_gpiomem_driver = { ++ .probe = bcm2835_gpiomem_probe, ++ .remove = bcm2835_gpiomem_remove, ++ .driver = { ++ .name = DRIVER_NAME, ++ .owner = THIS_MODULE, ++ .of_match_table = bcm2835_gpiomem_of_match, ++ }, ++}; ++ ++module_platform_driver(bcm2835_gpiomem_driver); ++ ++MODULE_ALIAS("platform:gpiomem-bcm2835"); ++MODULE_LICENSE("GPL"); ++MODULE_DESCRIPTION("gpiomem driver for accessing GPIO from userspace"); ++MODULE_AUTHOR("Luke Wren <luke@raspberrypi.org>"); + +From e4a7770dc5ecfcd28d0caef360659afd54bb95e5 Mon Sep 17 00:00:00 2001 +From: Luke Wren <wren6991@gmail.com> +Date: Sat, 5 Sep 2015 01:14:45 +0100 +Subject: [PATCH 045/112] Add SMI driver + +Signed-off-by: Luke Wren <wren6991@gmail.com> +--- + .../bindings/misc/brcm,bcm2835-smi-dev.txt | 17 + + .../devicetree/bindings/misc/brcm,bcm2835-smi.txt | 48 + + drivers/char/broadcom/Kconfig | 8 + + drivers/char/broadcom/Makefile | 2 +- + drivers/char/broadcom/bcm2835_smi_dev.c | 402 +++++++++ + drivers/misc/Kconfig | 8 + + drivers/misc/Makefile | 1 + + drivers/misc/bcm2835_smi.c | 985 +++++++++++++++++++++ + include/linux/broadcom/bcm2835_smi.h | 391 ++++++++ + 9 files changed, 1861 insertions(+), 1 deletion(-) + create mode 100644 Documentation/devicetree/bindings/misc/brcm,bcm2835-smi-dev.txt + create mode 100644 Documentation/devicetree/bindings/misc/brcm,bcm2835-smi.txt + create mode 100644 drivers/char/broadcom/bcm2835_smi_dev.c + create mode 100644 drivers/misc/bcm2835_smi.c + create mode 100644 include/linux/broadcom/bcm2835_smi.h + +diff --git a/Documentation/devicetree/bindings/misc/brcm,bcm2835-smi-dev.txt b/Documentation/devicetree/bindings/misc/brcm,bcm2835-smi-dev.txt +new file mode 100644 +index 0000000..68cc8eb +--- /dev/null ++++ b/Documentation/devicetree/bindings/misc/brcm,bcm2835-smi-dev.txt +@@ -0,0 +1,17 @@ ++* Broadcom BCM2835 SMI character device driver. ++ ++SMI or secondary memory interface is a peripheral specific to certain Broadcom ++SOCs, and is helpful for talking to things like parallel-interface displays ++and NAND flashes (in fact, most things with a parallel register interface). ++ ++This driver adds a character device which provides a user-space interface to ++an instance of the SMI driver. ++ ++Required properties: ++- compatible: "brcm,bcm2835-smi-dev" ++- smi_handle: a phandle to the smi node. ++ ++Optional properties: ++- None. ++ ++ +diff --git a/Documentation/devicetree/bindings/misc/brcm,bcm2835-smi.txt b/Documentation/devicetree/bindings/misc/brcm,bcm2835-smi.txt +new file mode 100644 +index 0000000..b76dc69 +--- /dev/null ++++ b/Documentation/devicetree/bindings/misc/brcm,bcm2835-smi.txt +@@ -0,0 +1,48 @@ ++* Broadcom BCM2835 SMI driver. ++ ++SMI or secondary memory interface is a peripheral specific to certain Broadcom ++SOCs, and is helpful for talking to things like parallel-interface displays ++and NAND flashes (in fact, most things with a parallel register interface). ++ ++Required properties: ++- compatible: "brcm,bcm2835-smi" ++- reg: Should contain location and length of SMI registers and SMI clkman regs ++- interrupts: *the* SMI interrupt. ++- pinctrl-names: should be "default". ++- pinctrl-0: the phandle of the gpio pin node. ++- brcm,smi-clock-source: the clock source for clkman ++- brcm,smi-clock-divisor: the integer clock divisor for clkman ++- dmas: the dma controller phandle and the DREQ number (4 on a 2835) ++- dma-names: the name used by the driver to request its channel. ++ Should be "rx-tx". ++ ++Optional properties: ++- None. ++ ++Examples: ++ ++8 data pin configuration: ++ ++smi: smi@7e600000 { ++ compatible = "brcm,bcm2835-smi"; ++ reg = <0x7e600000 0x44>, <0x7e1010b0 0x8>; ++ interrupts = <2 16>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&smi_pins>; ++ brcm,smi-clock-source = <6>; ++ brcm,smi-clock-divisor = <4>; ++ dmas = <&dma 4>; ++ dma-names = "rx-tx"; ++ ++ status = "okay"; ++}; ++ ++smi_pins: smi_pins { ++ brcm,pins = <2 3 4 5 6 7 8 9 10 11 12 13 14 15>; ++ /* Alt 1: SMI */ ++ brcm,function = <5 5 5 5 5 5 5 5 5 5 5 5 5 5>; ++ /* /CS, /WE and /OE are pulled high, as they are ++ generally active low signals */ ++ brcm,pull = <2 2 2 2 2 2 0 0 0 0 0 0 0 0>; ++}; ++ +diff --git a/drivers/char/broadcom/Kconfig b/drivers/char/broadcom/Kconfig +index b75c9b2..2292ed2 100644 +--- a/drivers/char/broadcom/Kconfig ++++ b/drivers/char/broadcom/Kconfig +@@ -41,3 +41,11 @@ config BCM2835_DEVGPIOMEM + on the 2835. Calling mmap(/dev/gpiomem) will map the GPIO + register page to the user's pointer. + ++config BCM2835_SMI_DEV ++ tristate "Character device driver for BCM2835 Secondary Memory Interface" ++ depends on (MACH_BCM2708 || MACH_BCM2709 || ARCH_BCM2835) && BCM2835_SMI ++ default m ++ help ++ This driver provides a character device interface (ioctl + read/write) to ++ Broadcom's Secondary Memory interface. The low-level functionality is provided ++ by the SMI driver itself. +diff --git a/drivers/char/broadcom/Makefile b/drivers/char/broadcom/Makefile +index 1eb06e9..667d33e 100644 +--- a/drivers/char/broadcom/Makefile ++++ b/drivers/char/broadcom/Makefile +@@ -3,4 +3,4 @@ obj-$(CONFIG_BCM2708_VCMEM) += vc_mem.o + obj-$(CONFIG_BCM_VC_SM) += vc_sm/ + + obj-$(CONFIG_BCM2835_DEVGPIOMEM)+= bcm2835-gpiomem.o +- ++obj-$(CONFIG_BCM2835_SMI_DEV) += bcm2835_smi_dev.o +diff --git a/drivers/char/broadcom/bcm2835_smi_dev.c b/drivers/char/broadcom/bcm2835_smi_dev.c +new file mode 100644 +index 0000000..d6efd92 +--- /dev/null ++++ b/drivers/char/broadcom/bcm2835_smi_dev.c +@@ -0,0 +1,402 @@ ++/** ++ * Character device driver for Broadcom Secondary Memory Interface ++ * ++ * Written by Luke Wren <luke@raspberrypi.org> ++ * Copyright (c) 2015, Raspberry Pi (Trading) Ltd. ++ * ++ * 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, ++ * without modification. ++ * 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. ++ * 3. The names of the above-listed copyright holders may not be used ++ * to endorse or promote products derived from this software without ++ * specific prior written permission. ++ * ++ * ALTERNATIVELY, this software may be distributed under the terms of the ++ * GNU General Public License ("GPL") version 2, as published by the Free ++ * Software Foundation. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER OR ++ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ++ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, ++ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR ++ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF ++ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING ++ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ */ ++ ++#include <linux/kernel.h> ++#include <linux/module.h> ++#include <linux/of.h> ++#include <linux/platform_device.h> ++#include <linux/slab.h> ++#include <linux/mm.h> ++#include <linux/pagemap.h> ++#include <linux/fs.h> ++#include <linux/cdev.h> ++#include <linux/fs.h> ++ ++#include <linux/broadcom/bcm2835_smi.h> ++ ++#define DEVICE_NAME "bcm2835-smi-dev" ++#define DRIVER_NAME "smi-dev-bcm2835" ++#define DEVICE_MINOR 0 ++ ++static struct cdev bcm2835_smi_cdev; ++static dev_t bcm2835_smi_devid; ++static struct class *bcm2835_smi_class; ++static struct device *bcm2835_smi_dev; ++ ++struct bcm2835_smi_dev_instance { ++ struct device *dev; ++}; ++ ++static struct bcm2835_smi_instance *smi_inst; ++static struct bcm2835_smi_dev_instance *inst; ++ ++static const char *const ioctl_names[] = { ++ "READ_SETTINGS", ++ "WRITE_SETTINGS", ++ "ADDRESS" ++}; ++ ++/**************************************************************************** ++* ++* SMI chardev file ops ++* ++***************************************************************************/ ++static long ++bcm2835_smi_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ++{ ++ long ret = 0; ++ ++ dev_info(inst->dev, "serving ioctl..."); ++ ++ switch (cmd) { ++ case BCM2835_SMI_IOC_GET_SETTINGS:{ ++ struct smi_settings *settings; ++ ++ dev_info(inst->dev, "Reading SMI settings to user."); ++ settings = bcm2835_smi_get_settings_from_regs(smi_inst); ++ if (copy_to_user((void *)arg, settings, ++ sizeof(struct smi_settings))) ++ dev_err(inst->dev, "settings copy failed."); ++ break; ++ } ++ case BCM2835_SMI_IOC_WRITE_SETTINGS:{ ++ struct smi_settings *settings; ++ ++ dev_info(inst->dev, "Setting user's SMI settings."); ++ settings = bcm2835_smi_get_settings_from_regs(smi_inst); ++ if (copy_from_user(settings, (void *)arg, ++ sizeof(struct smi_settings))) ++ dev_err(inst->dev, "settings copy failed."); ++ else ++ bcm2835_smi_set_regs_from_settings(smi_inst); ++ break; ++ } ++ case BCM2835_SMI_IOC_ADDRESS: ++ dev_info(inst->dev, "SMI address set: 0x%02x", (int)arg); ++ bcm2835_smi_set_address(smi_inst, arg); ++ break; ++ default: ++ dev_err(inst->dev, "invalid ioctl cmd: %d", cmd); ++ ret = -ENOTTY; ++ break; ++ } ++ ++ return ret; ++} ++ ++static int bcm2835_smi_open(struct inode *inode, struct file *file) ++{ ++ int dev = iminor(inode); ++ ++ dev_dbg(inst->dev, "SMI device opened."); ++ ++ if (dev != DEVICE_MINOR) { ++ dev_err(inst->dev, ++ "bcm2835_smi_release: Unknown minor device: %d", ++ dev); ++ return -ENXIO; ++ } ++ ++ return 0; ++} ++ ++static int bcm2835_smi_release(struct inode *inode, struct file *file) ++{ ++ int dev = iminor(inode); ++ ++ if (dev != DEVICE_MINOR) { ++ dev_err(inst->dev, ++ "bcm2835_smi_release: Unknown minor device %d", dev); ++ return -ENXIO; ++ } ++ ++ return 0; ++} ++ ++static ssize_t dma_bounce_user( ++ enum dma_transfer_direction dma_dir, ++ char __user *user_ptr, ++ size_t count, ++ struct bcm2835_smi_bounce_info *bounce) ++{ ++ int chunk_size; ++ int chunk_no = 0; ++ int count_left = count; ++ ++ while (count_left) { ++ int rv; ++ void *buf; ++ ++ /* Wait for current chunk to complete: */ ++ if (down_timeout(&bounce->callback_sem, ++ msecs_to_jiffies(1000))) { ++ dev_err(inst->dev, "DMA bounce timed out"); ++ count -= (count_left); ++ break; ++ } ++ ++ if (bounce->callback_sem.count >= DMA_BOUNCE_BUFFER_COUNT - 1) ++ dev_err(inst->dev, "WARNING: Ring buffer overflow"); ++ chunk_size = count_left > DMA_BOUNCE_BUFFER_SIZE ? ++ DMA_BOUNCE_BUFFER_SIZE : count_left; ++ buf = bounce->buffer[chunk_no % DMA_BOUNCE_BUFFER_COUNT]; ++ if (dma_dir == DMA_DEV_TO_MEM) ++ rv = copy_to_user(user_ptr, buf, chunk_size); ++ else ++ rv = copy_from_user(buf, user_ptr, chunk_size); ++ if (rv) ++ dev_err(inst->dev, "copy_*_user() failed!: %d", rv); ++ user_ptr += chunk_size; ++ count_left -= chunk_size; ++ chunk_no++; ++ } ++ return count; ++} ++ ++static ssize_t ++bcm2835_read_file(struct file *f, char __user *user_ptr, ++ size_t count, loff_t *offs) ++{ ++ int odd_bytes; ++ ++ dev_dbg(inst->dev, "User reading %d bytes from SMI.", count); ++ /* We don't want to DMA a number of bytes % 4 != 0 (32 bit FIFO) */ ++ if (count > DMA_THRESHOLD_BYTES) ++ odd_bytes = count & 0x3; ++ else ++ odd_bytes = count; ++ count -= odd_bytes; ++ if (count) { ++ struct bcm2835_smi_bounce_info *bounce; ++ ++ count = bcm2835_smi_user_dma(smi_inst, ++ DMA_DEV_TO_MEM, user_ptr, count, ++ &bounce); ++ if (count) ++ count = dma_bounce_user(DMA_DEV_TO_MEM, user_ptr, ++ count, bounce); ++ } ++ if (odd_bytes) { ++ /* Read from FIFO directly if not using DMA */ ++ uint8_t buf[DMA_THRESHOLD_BYTES]; ++ ++ bcm2835_smi_read_buf(smi_inst, buf, odd_bytes); ++ if (copy_to_user(user_ptr, buf, odd_bytes)) ++ dev_err(inst->dev, "copy_to_user() failed."); ++ count += odd_bytes; ++ ++ } ++ return count; ++} ++ ++static ssize_t ++bcm2835_write_file(struct file *f, const char __user *user_ptr, ++ size_t count, loff_t *offs) ++{ ++ int odd_bytes; ++ ++ dev_dbg(inst->dev, "User writing %d bytes to SMI.", count); ++ if (count > DMA_THRESHOLD_BYTES) ++ odd_bytes = count & 0x3; ++ else ++ odd_bytes = count; ++ count -= odd_bytes; ++ if (count) { ++ struct bcm2835_smi_bounce_info *bounce; ++ ++ count = bcm2835_smi_user_dma(smi_inst, ++ DMA_MEM_TO_DEV, (char __user *)user_ptr, count, ++ &bounce); ++ if (count) ++ count = dma_bounce_user(DMA_MEM_TO_DEV, ++ (char __user *)user_ptr, ++ count, bounce); ++ } ++ if (odd_bytes) { ++ uint8_t buf[DMA_THRESHOLD_BYTES]; ++ ++ if (copy_from_user(buf, user_ptr, odd_bytes)) ++ dev_err(inst->dev, "copy_from_user() failed."); ++ else ++ bcm2835_smi_write_buf(smi_inst, buf, odd_bytes); ++ count += odd_bytes; ++ } ++ return count; ++} ++ ++static const struct file_operations ++bcm2835_smi_fops = { ++ .owner = THIS_MODULE, ++ .unlocked_ioctl = bcm2835_smi_ioctl, ++ .open = bcm2835_smi_open, ++ .release = bcm2835_smi_release, ++ .read = bcm2835_read_file, ++ .write = bcm2835_write_file, ++}; ++ ++ ++/**************************************************************************** ++* ++* bcm2835_smi_probe - called when the driver is loaded. ++* ++***************************************************************************/ ++ ++static int bcm2835_smi_dev_probe(struct platform_device *pdev) ++{ ++ int err; ++ void *ptr_err; ++ struct device *dev = &pdev->dev; ++ struct device_node *node = dev->of_node, *smi_node; ++ ++ if (!node) { ++ dev_err(dev, "No device tree node supplied!"); ++ return -EINVAL; ++ } ++ ++ smi_node = of_parse_phandle(node, "smi_handle", 0); ++ ++ if (!smi_node) { ++ dev_err(dev, "No such property: smi_handle"); ++ return -ENXIO; ++ } ++ ++ smi_inst = bcm2835_smi_get(smi_node); ++ ++ if (!smi_inst) ++ return -EPROBE_DEFER; ++ ++ /* Allocate buffers and instance data */ ++ ++ inst = devm_kzalloc(dev, sizeof(*inst), GFP_KERNEL); ++ ++ if (!inst) ++ return -ENOMEM; ++ ++ inst->dev = dev; ++ ++ /* Create character device entries */ ++ ++ err = alloc_chrdev_region(&bcm2835_smi_devid, ++ DEVICE_MINOR, 1, DEVICE_NAME); ++ if (err != 0) { ++ dev_err(inst->dev, "unable to allocate device number"); ++ return -ENOMEM; ++ } ++ cdev_init(&bcm2835_smi_cdev, &bcm2835_smi_fops); ++ bcm2835_smi_cdev.owner = THIS_MODULE; ++ err = cdev_add(&bcm2835_smi_cdev, bcm2835_smi_devid, 1); ++ if (err != 0) { ++ dev_err(inst->dev, "unable to register device"); ++ err = -ENOMEM; ++ goto failed_cdev_add; ++ } ++ ++ /* Create sysfs entries */ ++ ++ bcm2835_smi_class = class_create(THIS_MODULE, DEVICE_NAME); ++ ptr_err = bcm2835_smi_class; ++ if (IS_ERR(ptr_err)) ++ goto failed_class_create; ++ ++ bcm2835_smi_dev = device_create(bcm2835_smi_class, NULL, ++ bcm2835_smi_devid, NULL, ++ "smi"); ++ ptr_err = bcm2835_smi_dev; ++ if (IS_ERR(ptr_err)) ++ goto failed_device_create; ++ ++ dev_info(inst->dev, "initialised"); ++ ++ return 0; ++ ++failed_device_create: ++ class_destroy(bcm2835_smi_class); ++failed_class_create: ++ cdev_del(&bcm2835_smi_cdev); ++ err = PTR_ERR(ptr_err); ++failed_cdev_add: ++ unregister_chrdev_region(bcm2835_smi_devid, 1); ++ dev_err(dev, "could not load bcm2835_smi_dev"); ++ return err; ++} ++ ++/**************************************************************************** ++* ++* bcm2835_smi_remove - called when the driver is unloaded. ++* ++***************************************************************************/ ++ ++static int bcm2835_smi_dev_remove(struct platform_device *pdev) ++{ ++ device_destroy(bcm2835_smi_class, bcm2835_smi_devid); ++ class_destroy(bcm2835_smi_class); ++ cdev_del(&bcm2835_smi_cdev); ++ unregister_chrdev_region(bcm2835_smi_devid, 1); ++ ++ dev_info(inst->dev, "SMI character dev removed - OK"); ++ return 0; ++} ++ ++/**************************************************************************** ++* ++* Register the driver with device tree ++* ++***************************************************************************/ ++ ++static const struct of_device_id bcm2835_smi_dev_of_match[] = { ++ {.compatible = "brcm,bcm2835-smi-dev",}, ++ { /* sentinel */ }, ++}; ++ ++MODULE_DEVICE_TABLE(of, bcm2835_smi_dev_of_match); ++ ++static struct platform_driver bcm2835_smi_dev_driver = { ++ .probe = bcm2835_smi_dev_probe, ++ .remove = bcm2835_smi_dev_remove, ++ .driver = { ++ .name = DRIVER_NAME, ++ .owner = THIS_MODULE, ++ .of_match_table = bcm2835_smi_dev_of_match, ++ }, ++}; ++ ++module_platform_driver(bcm2835_smi_dev_driver); ++ ++MODULE_ALIAS("platform:smi-dev-bcm2835"); ++MODULE_LICENSE("GPL"); ++MODULE_DESCRIPTION( ++ "Character device driver for BCM2835's secondary memory interface"); ++MODULE_AUTHOR("Luke Wren <luke@raspberrypi.org>"); +diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig +index 90af750..7011b2d 100644 +--- a/drivers/misc/Kconfig ++++ b/drivers/misc/Kconfig +@@ -10,6 +10,14 @@ config SENSORS_LIS3LV02D + select INPUT_POLLDEV + default n + ++config BCM2835_SMI ++ tristate "Broadcom 283x Secondary Memory Interface driver" ++ depends on MACH_BCM2708 || MACH_BCM2709 || ARCH_BCM2835 ++ default m ++ help ++ Driver for enabling and using Broadcom's Secondary/Slow Memory Interface. ++ Appears as /dev/bcm2835_smi. For ioctl interface see drivers/misc/bcm2835_smi.h ++ + config AD525X_DPOT + tristate "Analog Devices Digital Potentiometers" + depends on (I2C || SPI) && SYSFS +diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile +index 1a58cf7..28989fa 100644 +--- a/drivers/misc/Makefile ++++ b/drivers/misc/Makefile +@@ -9,6 +9,7 @@ obj-$(CONFIG_AD525X_DPOT_SPI) += ad525x_dpot-spi.o + obj-$(CONFIG_INTEL_MID_PTI) += pti.o + obj-$(CONFIG_ATMEL_SSC) += atmel-ssc.o + obj-$(CONFIG_ATMEL_TCLIB) += atmel_tclib.o ++obj-$(CONFIG_BCM2835_SMI) += bcm2835_smi.o + obj-$(CONFIG_BMP085) += bmp085.o + obj-$(CONFIG_BMP085_I2C) += bmp085-i2c.o + obj-$(CONFIG_BMP085_SPI) += bmp085-spi.o +diff --git a/drivers/misc/bcm2835_smi.c b/drivers/misc/bcm2835_smi.c +new file mode 100644 +index 0000000..63a4ea0 +--- /dev/null ++++ b/drivers/misc/bcm2835_smi.c +@@ -0,0 +1,985 @@ ++/** ++ * Broadcom Secondary Memory Interface driver ++ * ++ * Written by Luke Wren <luke@raspberrypi.org> ++ * Copyright (c) 2015, Raspberry Pi (Trading) Ltd. ++ * ++ * 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, ++ * without modification. ++ * 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. ++ * 3. The names of the above-listed copyright holders may not be used ++ * to endorse or promote products derived from this software without ++ * specific prior written permission. ++ * ++ * ALTERNATIVELY, this software may be distributed under the terms of the ++ * GNU General Public License ("GPL") version 2, as published by the Free ++ * Software Foundation. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER OR ++ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ++ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, ++ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR ++ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF ++ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING ++ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ */ ++ ++#include <linux/kernel.h> ++#include <linux/module.h> ++#include <linux/of.h> ++#include <linux/platform_device.h> ++#include <linux/of_address.h> ++#include <linux/of_platform.h> ++#include <linux/mm.h> ++#include <linux/slab.h> ++#include <linux/pagemap.h> ++#include <linux/dma-mapping.h> ++#include <linux/dmaengine.h> ++#include <linux/semaphore.h> ++#include <linux/spinlock.h> ++#include <linux/io.h> ++ ++#define BCM2835_SMI_IMPLEMENTATION ++#include <linux/broadcom/bcm2835_smi.h> ++ ++#define DRIVER_NAME "smi-bcm2835" ++ ++#define N_PAGES_FROM_BYTES(n) ((n + PAGE_SIZE-1) / PAGE_SIZE) ++ ++#define DMA_WRITE_TO_MEM true ++#define DMA_READ_FROM_MEM false ++ ++struct bcm2835_smi_instance { ++ struct device *dev; ++ struct smi_settings settings; ++ __iomem void *smi_regs_ptr, *cm_smi_regs_ptr; ++ dma_addr_t smi_regs_busaddr; ++ ++ struct dma_chan *dma_chan; ++ struct dma_slave_config dma_config; ++ ++ struct bcm2835_smi_bounce_info bounce; ++ ++ struct scatterlist buffer_sgl; ++ ++ int clock_source; ++ int clock_divisor; ++ ++ /* Sometimes we are called into in an atomic context (e.g. by ++ JFFS2 + MTD) so we can't use a mutex */ ++ spinlock_t transaction_lock; ++}; ++ ++/**************************************************************************** ++* ++* SMI clock manager setup ++* ++***************************************************************************/ ++ ++static inline void write_smi_cm_reg(struct bcm2835_smi_instance *inst, ++ u32 val, unsigned reg) ++{ ++ writel(CM_PWD | val, inst->cm_smi_regs_ptr + reg); ++} ++ ++static inline u32 read_smi_cm_reg(struct bcm2835_smi_instance *inst, ++ unsigned reg) ++{ ++ return readl(inst->cm_smi_regs_ptr + reg); ++} ++ ++static void smi_setup_clock(struct bcm2835_smi_instance *inst) ++{ ++ dev_dbg(inst->dev, "Setting up clock..."); ++ /* Disable SMI clock and wait for it to stop. */ ++ write_smi_cm_reg(inst, 0, CM_SMI_CTL); ++ while (read_smi_cm_reg(inst, CM_SMI_CTL) & CM_SMI_CTL_BUSY) ++ ; ++ ++ write_smi_cm_reg(inst, (inst->clock_divisor << CM_SMI_DIV_DIVI_OFFS), ++ CM_SMI_DIV); ++ write_smi_cm_reg(inst, (inst->clock_source << CM_SMI_CTL_SRC_OFFS), ++ CM_SMI_CTL); ++ ++ /* Enable the clock */ ++ write_smi_cm_reg(inst, (inst->clock_source << CM_SMI_CTL_SRC_OFFS) | ++ CM_SMI_CTL_ENAB, CM_SMI_CTL); ++} ++ ++/**************************************************************************** ++* ++* SMI peripheral setup ++* ++***************************************************************************/ ++ ++static inline void write_smi_reg(struct bcm2835_smi_instance *inst, ++ u32 val, unsigned reg) ++{ ++ writel(val, inst->smi_regs_ptr + reg); ++} ++ ++static inline u32 read_smi_reg(struct bcm2835_smi_instance *inst, unsigned reg) ++{ ++ return readl(inst->smi_regs_ptr + reg); ++} ++ ++/* Token-paste macro for e.g SMIDSR_RSTROBE -> value of SMIDSR_RSTROBE_MASK */ ++#define _CONCAT(x, y) x##y ++#define CONCAT(x, y) _CONCAT(x, y) ++ ++#define SET_BIT_FIELD(dest, field, bits) ((dest) = \ ++ ((dest) & ~CONCAT(field, _MASK)) | (((bits) << CONCAT(field, _OFFS))& \ ++ CONCAT(field, _MASK))) ++#define GET_BIT_FIELD(src, field) (((src) & \ ++ CONCAT(field, _MASK)) >> CONCAT(field, _OFFS)) ++ ++static void smi_dump_context_labelled(struct bcm2835_smi_instance *inst, ++ const char *label) ++{ ++ dev_err(inst->dev, "SMI context dump: %s", label); ++ dev_err(inst->dev, "SMICS: 0x%08x", read_smi_reg(inst, SMICS)); ++ dev_err(inst->dev, "SMIL: 0x%08x", read_smi_reg(inst, SMIL)); ++ dev_err(inst->dev, "SMIDSR: 0x%08x", read_smi_reg(inst, SMIDSR0)); ++ dev_err(inst->dev, "SMIDSW: 0x%08x", read_smi_reg(inst, SMIDSW0)); ++ dev_err(inst->dev, "SMIDC: 0x%08x", read_smi_reg(inst, SMIDC)); ++ dev_err(inst->dev, "SMIFD: 0x%08x", read_smi_reg(inst, SMIFD)); ++ dev_err(inst->dev, " "); ++} ++ ++static inline void smi_dump_context(struct bcm2835_smi_instance *inst) ++{ ++ smi_dump_context_labelled(inst, ""); ++} ++ ++static void smi_get_default_settings(struct bcm2835_smi_instance *inst) ++{ ++ struct smi_settings *settings = &inst->settings; ++ ++ settings->data_width = SMI_WIDTH_16BIT; ++ settings->pack_data = true; ++ ++ settings->read_setup_time = 1; ++ settings->read_hold_time = 1; ++ settings->read_pace_time = 1; ++ settings->read_strobe_time = 3; ++ ++ settings->write_setup_time = settings->read_setup_time; ++ settings->write_hold_time = settings->read_hold_time; ++ settings->write_pace_time = settings->read_pace_time; ++ settings->write_strobe_time = settings->read_strobe_time; ++ ++ settings->dma_enable = true; ++ settings->dma_passthrough_enable = false; ++ settings->dma_read_thresh = 0x01; ++ settings->dma_write_thresh = 0x3f; ++ settings->dma_panic_read_thresh = 0x20; ++ settings->dma_panic_write_thresh = 0x20; ++} ++ ++void bcm2835_smi_set_regs_from_settings(struct bcm2835_smi_instance *inst) ++{ ++ struct smi_settings *settings = &inst->settings; ++ int smidsr_temp = 0, smidsw_temp = 0, smics_temp, ++ smidcs_temp, smidc_temp = 0; ++ ++ spin_lock(&inst->transaction_lock); ++ ++ /* temporarily disable the peripheral: */ ++ smics_temp = read_smi_reg(inst, SMICS); ++ write_smi_reg(inst, 0, SMICS); ++ smidcs_temp = read_smi_reg(inst, SMIDCS); ++ write_smi_reg(inst, 0, SMIDCS); ++ ++ if (settings->pack_data) ++ smics_temp |= SMICS_PXLDAT; ++ else ++ smics_temp &= ~SMICS_PXLDAT; ++ ++ SET_BIT_FIELD(smidsr_temp, SMIDSR_RWIDTH, settings->data_width); ++ SET_BIT_FIELD(smidsr_temp, SMIDSR_RSETUP, settings->read_setup_time); ++ SET_BIT_FIELD(smidsr_temp, SMIDSR_RHOLD, settings->read_hold_time); ++ SET_BIT_FIELD(smidsr_temp, SMIDSR_RPACE, settings->read_pace_time); ++ SET_BIT_FIELD(smidsr_temp, SMIDSR_RSTROBE, settings->read_strobe_time); ++ write_smi_reg(inst, smidsr_temp, SMIDSR0); ++ ++ SET_BIT_FIELD(smidsw_temp, SMIDSW_WWIDTH, settings->data_width); ++ if (settings->data_width == SMI_WIDTH_8BIT) ++ smidsw_temp |= SMIDSW_WSWAP; ++ else ++ smidsw_temp &= ~SMIDSW_WSWAP; ++ SET_BIT_FIELD(smidsw_temp, SMIDSW_WSETUP, settings->write_setup_time); ++ SET_BIT_FIELD(smidsw_temp, SMIDSW_WHOLD, settings->write_hold_time); ++ SET_BIT_FIELD(smidsw_temp, SMIDSW_WPACE, settings->write_pace_time); ++ SET_BIT_FIELD(smidsw_temp, SMIDSW_WSTROBE, ++ settings->write_strobe_time); ++ write_smi_reg(inst, smidsw_temp, SMIDSW0); ++ ++ SET_BIT_FIELD(smidc_temp, SMIDC_REQR, settings->dma_read_thresh); ++ SET_BIT_FIELD(smidc_temp, SMIDC_REQW, settings->dma_write_thresh); ++ SET_BIT_FIELD(smidc_temp, SMIDC_PANICR, ++ settings->dma_panic_read_thresh); ++ SET_BIT_FIELD(smidc_temp, SMIDC_PANICW, ++ settings->dma_panic_write_thresh); ++ if (settings->dma_passthrough_enable) { ++ smidc_temp |= SMIDC_DMAP; ++ smidsr_temp |= SMIDSR_RDREQ; ++ write_smi_reg(inst, smidsr_temp, SMIDSR0); ++ smidsw_temp |= SMIDSW_WDREQ; ++ write_smi_reg(inst, smidsw_temp, SMIDSW0); ++ } else ++ smidc_temp &= ~SMIDC_DMAP; ++ if (settings->dma_enable) ++ smidc_temp |= SMIDC_DMAEN; ++ else ++ smidc_temp &= ~SMIDC_DMAEN; ++ ++ write_smi_reg(inst, smidc_temp, SMIDC); ++ ++ /* re-enable (if was previously enabled) */ ++ write_smi_reg(inst, smics_temp, SMICS); ++ write_smi_reg(inst, smidcs_temp, SMIDCS); ++ ++ spin_unlock(&inst->transaction_lock); ++} ++EXPORT_SYMBOL(bcm2835_smi_set_regs_from_settings); ++ ++struct smi_settings *bcm2835_smi_get_settings_from_regs ++ (struct bcm2835_smi_instance *inst) ++{ ++ struct smi_settings *settings = &inst->settings; ++ int smidsr, smidsw, smidc; ++ ++ spin_lock(&inst->transaction_lock); ++ ++ smidsr = read_smi_reg(inst, SMIDSR0); ++ smidsw = read_smi_reg(inst, SMIDSW0); ++ smidc = read_smi_reg(inst, SMIDC); ++ ++ settings->pack_data = (read_smi_reg(inst, SMICS) & SMICS_PXLDAT) ? ++ true : false; ++ ++ settings->data_width = GET_BIT_FIELD(smidsr, SMIDSR_RWIDTH); ++ settings->read_setup_time = GET_BIT_FIELD(smidsr, SMIDSR_RSETUP); ++ settings->read_hold_time = GET_BIT_FIELD(smidsr, SMIDSR_RHOLD); ++ settings->read_pace_time = GET_BIT_FIELD(smidsr, SMIDSR_RPACE); ++ settings->read_strobe_time = GET_BIT_FIELD(smidsr, SMIDSR_RSTROBE); ++ ++ settings->write_setup_time = GET_BIT_FIELD(smidsw, SMIDSW_WSETUP); ++ settings->write_hold_time = GET_BIT_FIELD(smidsw, SMIDSW_WHOLD); ++ settings->write_pace_time = GET_BIT_FIELD(smidsw, SMIDSW_WPACE); ++ settings->write_strobe_time = GET_BIT_FIELD(smidsw, SMIDSW_WSTROBE); ++ ++ settings->dma_read_thresh = GET_BIT_FIELD(smidc, SMIDC_REQR); ++ settings->dma_write_thresh = GET_BIT_FIELD(smidc, SMIDC_REQW); ++ settings->dma_panic_read_thresh = GET_BIT_FIELD(smidc, SMIDC_PANICR); ++ settings->dma_panic_write_thresh = GET_BIT_FIELD(smidc, SMIDC_PANICW); ++ settings->dma_passthrough_enable = (smidc & SMIDC_DMAP) ? true : false; ++ settings->dma_enable = (smidc & SMIDC_DMAEN) ? true : false; ++ ++ spin_unlock(&inst->transaction_lock); ++ ++ return settings; ++} ++EXPORT_SYMBOL(bcm2835_smi_get_settings_from_regs); ++ ++static inline void smi_set_address(struct bcm2835_smi_instance *inst, ++ unsigned int address) ++{ ++ int smia_temp = 0, smida_temp = 0; ++ ++ SET_BIT_FIELD(smia_temp, SMIA_ADDR, address); ++ SET_BIT_FIELD(smida_temp, SMIDA_ADDR, address); ++ ++ /* Write to both address registers - user doesn't care whether we're ++ doing programmed or direct transfers. */ ++ write_smi_reg(inst, smia_temp, SMIA); ++ write_smi_reg(inst, smida_temp, SMIDA); ++} ++ ++static void smi_setup_regs(struct bcm2835_smi_instance *inst) ++{ ++ ++ dev_dbg(inst->dev, "Initialising SMI registers..."); ++ /* Disable the peripheral if already enabled */ ++ write_smi_reg(inst, 0, SMICS); ++ write_smi_reg(inst, 0, SMIDCS); ++ ++ smi_get_default_settings(inst); ++ bcm2835_smi_set_regs_from_settings(inst); ++ smi_set_address(inst, 0); ++ ++ write_smi_reg(inst, read_smi_reg(inst, SMICS) | SMICS_ENABLE, SMICS); ++ write_smi_reg(inst, read_smi_reg(inst, SMIDCS) | SMIDCS_ENABLE, ++ SMIDCS); ++} ++ ++/**************************************************************************** ++* ++* Low-level SMI access functions ++* Other modules should use the exported higher-level functions e.g. ++* bcm2835_smi_write_buf() unless they have a good reason to use these ++* ++***************************************************************************/ ++ ++static inline uint32_t smi_read_single_word(struct bcm2835_smi_instance *inst) ++{ ++ int timeout = 0; ++ ++ write_smi_reg(inst, SMIDCS_ENABLE, SMIDCS); ++ write_smi_reg(inst, SMIDCS_ENABLE | SMIDCS_START, SMIDCS); ++ /* Make sure things happen in the right order...*/ ++ mb(); ++ while (!(read_smi_reg(inst, SMIDCS) & SMIDCS_DONE) && ++ ++timeout < 10000) ++ ; ++ if (timeout < 10000) ++ return read_smi_reg(inst, SMIDD); ++ ++ dev_err(inst->dev, ++ "SMI direct read timed out (is the clock set up correctly?)"); ++ return 0; ++} ++ ++static inline void smi_write_single_word(struct bcm2835_smi_instance *inst, ++ uint32_t data) ++{ ++ int timeout = 0; ++ ++ write_smi_reg(inst, SMIDCS_ENABLE | SMIDCS_WRITE, SMIDCS); ++ write_smi_reg(inst, data, SMIDD); ++ write_smi_reg(inst, SMIDCS_ENABLE | SMIDCS_WRITE | SMIDCS_START, ++ SMIDCS); ++ ++ while (!(read_smi_reg(inst, SMIDCS) & SMIDCS_DONE) && ++ ++timeout < 10000) ++ ; ++ if (timeout >= 10000) ++ dev_err(inst->dev, ++ "SMI direct write timed out (is the clock set up correctly?)"); ++} ++ ++/* Initiates a programmed read into the read FIFO. It is up to the caller to ++ * read data from the FIFO - either via paced DMA transfer, ++ * or polling SMICS_RXD to check whether data is available. ++ * SMICS_ACTIVE will go low upon completion. */ ++static void smi_init_programmed_read(struct bcm2835_smi_instance *inst, ++ int num_transfers) ++{ ++ int smics_temp; ++ ++ /* Disable the peripheral: */ ++ smics_temp = read_smi_reg(inst, SMICS) & ~(SMICS_ENABLE | SMICS_WRITE); ++ write_smi_reg(inst, smics_temp, SMICS); ++ while (read_smi_reg(inst, SMICS) & SMICS_ENABLE) ++ ; ++ ++ /* Program the transfer count: */ ++ write_smi_reg(inst, num_transfers, SMIL); ++ ++ /* re-enable and start: */ ++ smics_temp |= SMICS_ENABLE; ++ write_smi_reg(inst, smics_temp, SMICS); ++ smics_temp |= SMICS_CLEAR; ++ /* Just to be certain: */ ++ mb(); ++ while (read_smi_reg(inst, SMICS) & SMICS_ACTIVE) ++ ; ++ write_smi_reg(inst, smics_temp, SMICS); ++ smics_temp |= SMICS_START; ++ write_smi_reg(inst, smics_temp, SMICS); ++} ++ ++/* Initiates a programmed write sequence, using data from the write FIFO. ++ * It is up to the caller to initiate a DMA transfer before calling, ++ * or use another method to keep the write FIFO topped up. ++ * SMICS_ACTIVE will go low upon completion. ++ */ ++static void smi_init_programmed_write(struct bcm2835_smi_instance *inst, ++ int num_transfers) ++{ ++ int smics_temp; ++ ++ /* Disable the peripheral: */ ++ smics_temp = read_smi_reg(inst, SMICS) & ~SMICS_ENABLE; ++ write_smi_reg(inst, smics_temp, SMICS); ++ while (read_smi_reg(inst, SMICS) & SMICS_ENABLE) ++ ; ++ ++ /* Program the transfer count: */ ++ write_smi_reg(inst, num_transfers, SMIL); ++ ++ /* setup, re-enable and start: */ ++ smics_temp |= SMICS_WRITE | SMICS_ENABLE; ++ write_smi_reg(inst, smics_temp, SMICS); ++ smics_temp |= SMICS_START; ++ write_smi_reg(inst, smics_temp, SMICS); ++} ++ ++/* Initiate a read and then poll FIFO for data, reading out as it appears. */ ++static void smi_read_fifo(struct bcm2835_smi_instance *inst, ++ uint32_t *dest, int n_bytes) ++{ ++ if (read_smi_reg(inst, SMICS) & SMICS_RXD) { ++ smi_dump_context_labelled(inst, ++ "WARNING: read FIFO not empty at start of read call."); ++ while (read_smi_reg(inst, SMICS)) ++ ; ++ } ++ ++ /* Dispatch the read: */ ++ if (inst->settings.data_width == SMI_WIDTH_8BIT) ++ smi_init_programmed_read(inst, n_bytes); ++ else if (inst->settings.data_width == SMI_WIDTH_16BIT) ++ smi_init_programmed_read(inst, n_bytes / 2); ++ else { ++ dev_err(inst->dev, "Unsupported data width for read."); ++ return; ++ } ++ ++ /* Poll FIFO to keep it empty */ ++ while (!(read_smi_reg(inst, SMICS) & SMICS_DONE)) ++ if (read_smi_reg(inst, SMICS) & SMICS_RXD) ++ *dest++ = read_smi_reg(inst, SMID); ++ ++ /* Ensure that the FIFO is emptied */ ++ if (read_smi_reg(inst, SMICS) & SMICS_RXD) { ++ int fifo_count; ++ ++ fifo_count = GET_BIT_FIELD(read_smi_reg(inst, SMIFD), ++ SMIFD_FCNT); ++ while (fifo_count--) ++ *dest++ = read_smi_reg(inst, SMID); ++ } ++ ++ if (!(read_smi_reg(inst, SMICS) & SMICS_DONE)) ++ smi_dump_context_labelled(inst, ++ "WARNING: transaction finished but done bit not set."); ++ ++ if (read_smi_reg(inst, SMICS) & SMICS_RXD) ++ smi_dump_context_labelled(inst, ++ "WARNING: read FIFO not empty at end of read call."); ++ ++} ++ ++/* Initiate a write, and then keep the FIFO topped up. */ ++static void smi_write_fifo(struct bcm2835_smi_instance *inst, ++ uint32_t *src, int n_bytes) ++{ ++ int i, timeout = 0; ++ ++ /* Empty FIFOs if not already so */ ++ if (!(read_smi_reg(inst, SMICS) & SMICS_TXE)) { ++ smi_dump_context_labelled(inst, ++ "WARNING: write fifo not empty at start of write call."); ++ write_smi_reg(inst, read_smi_reg(inst, SMICS) | SMICS_CLEAR, ++ SMICS); ++ } ++ ++ /* Initiate the transfer */ ++ if (inst->settings.data_width == SMI_WIDTH_8BIT) ++ smi_init_programmed_write(inst, n_bytes); ++ else if (inst->settings.data_width == SMI_WIDTH_16BIT) ++ smi_init_programmed_write(inst, n_bytes / 2); ++ else { ++ dev_err(inst->dev, "Unsupported data width for write."); ++ return; ++ } ++ /* Fill the FIFO: */ ++ for (i = 0; i < (n_bytes - 1) / 4 + 1; ++i) { ++ while (!(read_smi_reg(inst, SMICS) & SMICS_TXD)) ++ ; ++ write_smi_reg(inst, *src++, SMID); ++ } ++ /* Busy wait... */ ++ while (!(read_smi_reg(inst, SMICS) & SMICS_DONE) && ++timeout < ++ 1000000) ++ ; ++ if (timeout >= 1000000) ++ smi_dump_context_labelled(inst, ++ "Timed out on write operation!"); ++ if (!(read_smi_reg(inst, SMICS) & SMICS_TXE)) ++ smi_dump_context_labelled(inst, ++ "WARNING: FIFO not empty at end of write operation."); ++} ++ ++/**************************************************************************** ++* ++* SMI DMA operations ++* ++***************************************************************************/ ++ ++/* Disable SMI and put it into the correct direction before doing DMA setup. ++ Stops spurious DREQs during setup. Peripheral is re-enabled by init_*() */ ++static void smi_disable(struct bcm2835_smi_instance *inst, ++ enum dma_transfer_direction direction) ++{ ++ int smics_temp = read_smi_reg(inst, SMICS) & ~SMICS_ENABLE; ++ ++ if (direction == DMA_DEV_TO_MEM) ++ smics_temp &= ~SMICS_WRITE; ++ else ++ smics_temp |= SMICS_WRITE; ++ write_smi_reg(inst, smics_temp, SMICS); ++ while (read_smi_reg(inst, SMICS) & SMICS_ACTIVE) ++ ; ++} ++ ++static struct scatterlist *smi_scatterlist_from_buffer( ++ struct bcm2835_smi_instance *inst, ++ dma_addr_t buf, ++ size_t len, ++ struct scatterlist *sg) ++{ ++ sg_init_table(sg, 1); ++ sg_dma_address(sg) = buf; ++ sg_dma_len(sg) = len; ++ return sg; ++} ++ ++static void smi_dma_callback_user_copy(void *param) ++{ ++ /* Notify the bottom half that a chunk is ready for user copy */ ++ struct bcm2835_smi_instance *inst = ++ (struct bcm2835_smi_instance *)param; ++ ++ up(&inst->bounce.callback_sem); ++} ++ ++/* Creates a descriptor, assigns the given callback, and submits the ++ descriptor to dmaengine. Does not block - can queue up multiple ++ descriptors and then wait for them all to complete. ++ sg_len is the number of control blocks, NOT the number of bytes. ++ dir can be DMA_MEM_TO_DEV or DMA_DEV_TO_MEM. ++ callback can be NULL - in this case it is not called. */ ++static inline struct dma_async_tx_descriptor *smi_dma_submit_sgl( ++ struct bcm2835_smi_instance *inst, ++ struct scatterlist *sgl, ++ size_t sg_len, ++ enum dma_transfer_direction dir, ++ dma_async_tx_callback callback) ++{ ++ struct dma_async_tx_descriptor *desc; ++ ++ desc = dmaengine_prep_slave_sg(inst->dma_chan, ++ sgl, ++ sg_len, ++ dir, ++ DMA_PREP_INTERRUPT | DMA_CTRL_ACK | ++ DMA_PREP_FENCE); ++ if (!desc) { ++ dev_err(inst->dev, "read_sgl: dma slave preparation failed!"); ++ write_smi_reg(inst, read_smi_reg(inst, SMICS) & ~SMICS_ACTIVE, ++ SMICS); ++ while (read_smi_reg(inst, SMICS) & SMICS_ACTIVE) ++ cpu_relax(); ++ write_smi_reg(inst, read_smi_reg(inst, SMICS) | SMICS_ACTIVE, ++ SMICS); ++ return NULL; ++ } ++ desc->callback = callback; ++ desc->callback_param = inst; ++ if (dmaengine_submit(desc) < 0) ++ return NULL; ++ return desc; ++} ++ ++/* NB this function blocks until the transfer is complete */ ++static void ++smi_dma_read_sgl(struct bcm2835_smi_instance *inst, ++ struct scatterlist *sgl, size_t sg_len, size_t n_bytes) ++{ ++ struct dma_async_tx_descriptor *desc; ++ ++ /* Disable SMI and set to read before dispatching DMA - if SMI is in ++ * write mode and TX fifo is empty, it will generate a DREQ which may ++ * cause the read DMA to complete before the SMI read command is even ++ * dispatched! We want to dispatch DMA before SMI read so that reading ++ * is gapless, for logic analyser. ++ */ ++ ++ smi_disable(inst, DMA_DEV_TO_MEM); ++ ++ desc = smi_dma_submit_sgl(inst, sgl, sg_len, DMA_DEV_TO_MEM, NULL); ++ dma_async_issue_pending(inst->dma_chan); ++ ++ if (inst->settings.data_width == SMI_WIDTH_8BIT) ++ smi_init_programmed_read(inst, n_bytes); ++ else ++ smi_init_programmed_read(inst, n_bytes / 2); ++ ++ if (dma_wait_for_async_tx(desc) == DMA_ERROR) ++ smi_dump_context_labelled(inst, "DMA timeout!"); ++} ++ ++static void ++smi_dma_write_sgl(struct bcm2835_smi_instance *inst, ++ struct scatterlist *sgl, size_t sg_len, size_t n_bytes) ++{ ++ struct dma_async_tx_descriptor *desc; ++ ++ if (inst->settings.data_width == SMI_WIDTH_8BIT) ++ smi_init_programmed_write(inst, n_bytes); ++ else ++ smi_init_programmed_write(inst, n_bytes / 2); ++ ++ desc = smi_dma_submit_sgl(inst, sgl, sg_len, DMA_MEM_TO_DEV, NULL); ++ dma_async_issue_pending(inst->dma_chan); ++ ++ if (dma_wait_for_async_tx(desc) == DMA_ERROR) ++ smi_dump_context_labelled(inst, "DMA timeout!"); ++ else ++ /* Wait for SMI to finish our writes */ ++ while (!(read_smi_reg(inst, SMICS) & SMICS_DONE)) ++ cpu_relax(); ++} ++ ++ssize_t bcm2835_smi_user_dma( ++ struct bcm2835_smi_instance *inst, ++ enum dma_transfer_direction dma_dir, ++ char __user *user_ptr, size_t count, ++ struct bcm2835_smi_bounce_info **bounce) ++{ ++ int chunk_no = 0, chunk_size, count_left = count; ++ struct scatterlist *sgl; ++ void (*init_trans_func)(struct bcm2835_smi_instance *, int); ++ ++ spin_lock(&inst->transaction_lock); ++ ++ if (dma_dir == DMA_DEV_TO_MEM) ++ init_trans_func = smi_init_programmed_read; ++ else ++ init_trans_func = smi_init_programmed_write; ++ ++ smi_disable(inst, dma_dir); ++ ++ sema_init(&inst->bounce.callback_sem, 0); ++ if (bounce) ++ *bounce = &inst->bounce; ++ while (count_left) { ++ chunk_size = count_left > DMA_BOUNCE_BUFFER_SIZE ? ++ DMA_BOUNCE_BUFFER_SIZE : count_left; ++ if (chunk_size == DMA_BOUNCE_BUFFER_SIZE) { ++ sgl = ++ &inst->bounce.sgl[chunk_no % DMA_BOUNCE_BUFFER_COUNT]; ++ } else { ++ sgl = smi_scatterlist_from_buffer( ++ inst, ++ inst->bounce.phys[ ++ chunk_no % DMA_BOUNCE_BUFFER_COUNT], ++ chunk_size, ++ &inst->buffer_sgl); ++ } ++ ++ if (!smi_dma_submit_sgl(inst, sgl, 1, dma_dir, ++ smi_dma_callback_user_copy ++ )) { ++ dev_err(inst->dev, "sgl submit failed"); ++ count = 0; ++ goto out; ++ } ++ count_left -= chunk_size; ++ chunk_no++; ++ } ++ dma_async_issue_pending(inst->dma_chan); ++ ++ if (inst->settings.data_width == SMI_WIDTH_8BIT) ++ init_trans_func(inst, count); ++ else if (inst->settings.data_width == SMI_WIDTH_16BIT) ++ init_trans_func(inst, count / 2); ++out: ++ spin_unlock(&inst->transaction_lock); ++ return count; ++} ++EXPORT_SYMBOL(bcm2835_smi_user_dma); ++ ++ ++/**************************************************************************** ++* ++* High level buffer transfer functions - for use by other drivers ++* ++***************************************************************************/ ++ ++/* Buffer must be physically contiguous - i.e. kmalloc, not vmalloc! */ ++void bcm2835_smi_write_buf( ++ struct bcm2835_smi_instance *inst, ++ const void *buf, size_t n_bytes) ++{ ++ int odd_bytes = n_bytes & 0x3; ++ ++ n_bytes -= odd_bytes; ++ ++ spin_lock(&inst->transaction_lock); ++ ++ if (n_bytes > DMA_THRESHOLD_BYTES) { ++ dma_addr_t phy_addr = dma_map_single( ++ inst->dev, ++ (void *)buf, ++ n_bytes, ++ DMA_MEM_TO_DEV); ++ struct scatterlist *sgl = ++ smi_scatterlist_from_buffer(inst, phy_addr, n_bytes, ++ &inst->buffer_sgl); ++ ++ if (!sgl) { ++ smi_dump_context_labelled(inst, ++ "Error: could not create scatterlist for write!"); ++ goto out; ++ } ++ smi_dma_write_sgl(inst, sgl, 1, n_bytes); ++ ++ dma_unmap_single ++ (inst->dev, phy_addr, n_bytes, DMA_MEM_TO_DEV); ++ } else if (n_bytes) { ++ smi_write_fifo(inst, (uint32_t *) buf, n_bytes); ++ } ++ buf += n_bytes; ++ ++ if (inst->settings.data_width == SMI_WIDTH_8BIT) { ++ while (odd_bytes--) ++ smi_write_single_word(inst, *(uint8_t *) (buf++)); ++ } else { ++ while (odd_bytes >= 2) { ++ smi_write_single_word(inst, *(uint16_t *)buf); ++ buf += 2; ++ odd_bytes -= 2; ++ } ++ if (odd_bytes) { ++ /* Reading an odd number of bytes on a 16 bit bus is ++ a user bug. It's kinder to fail early and tell them ++ than to e.g. transparently give them the bottom byte ++ of a 16 bit transfer. */ ++ dev_err(inst->dev, ++ "WARNING: odd number of bytes specified for wide transfer."); ++ dev_err(inst->dev, ++ "At least one byte dropped as a result."); ++ dump_stack(); ++ } ++ } ++out: ++ spin_unlock(&inst->transaction_lock); ++} ++EXPORT_SYMBOL(bcm2835_smi_write_buf); ++ ++void bcm2835_smi_read_buf(struct bcm2835_smi_instance *inst, ++ void *buf, size_t n_bytes) ++{ ++ ++ /* SMI is inherently 32-bit, which causes surprising amounts of mess ++ for bytes % 4 != 0. Easiest to avoid this mess altogether ++ by handling remainder separately. */ ++ int odd_bytes = n_bytes & 0x3; ++ ++ spin_lock(&inst->transaction_lock); ++ n_bytes -= odd_bytes; ++ if (n_bytes > DMA_THRESHOLD_BYTES) { ++ dma_addr_t phy_addr = dma_map_single(inst->dev, ++ buf, n_bytes, ++ DMA_DEV_TO_MEM); ++ struct scatterlist *sgl = smi_scatterlist_from_buffer( ++ inst, phy_addr, n_bytes, ++ &inst->buffer_sgl); ++ if (!sgl) { ++ smi_dump_context_labelled(inst, ++ "Error: could not create scatterlist for read!"); ++ goto out; ++ } ++ smi_dma_read_sgl(inst, sgl, 1, n_bytes); ++ dma_unmap_single(inst->dev, phy_addr, n_bytes, DMA_DEV_TO_MEM); ++ } else if (n_bytes) { ++ smi_read_fifo(inst, (uint32_t *)buf, n_bytes); ++ } ++ buf += n_bytes; ++ ++ if (inst->settings.data_width == SMI_WIDTH_8BIT) { ++ while (odd_bytes--) ++ *((uint8_t *) (buf++)) = smi_read_single_word(inst); ++ } else { ++ while (odd_bytes >= 2) { ++ *(uint16_t *) buf = smi_read_single_word(inst); ++ buf += 2; ++ odd_bytes -= 2; ++ } ++ if (odd_bytes) { ++ dev_err(inst->dev, ++ "WARNING: odd number of bytes specified for wide transfer."); ++ dev_err(inst->dev, ++ "At least one byte dropped as a result."); ++ dump_stack(); ++ } ++ } ++out: ++ spin_unlock(&inst->transaction_lock); ++} ++EXPORT_SYMBOL(bcm2835_smi_read_buf); ++ ++void bcm2835_smi_set_address(struct bcm2835_smi_instance *inst, ++ unsigned int address) ++{ ++ spin_lock(&inst->transaction_lock); ++ smi_set_address(inst, address); ++ spin_unlock(&inst->transaction_lock); ++} ++EXPORT_SYMBOL(bcm2835_smi_set_address); ++ ++struct bcm2835_smi_instance *bcm2835_smi_get(struct device_node *node) ++{ ++ struct platform_device *pdev; ++ ++ if (!node) ++ return NULL; ++ ++ pdev = of_find_device_by_node(node); ++ if (!pdev) ++ return NULL; ++ ++ return platform_get_drvdata(pdev); ++} ++EXPORT_SYMBOL(bcm2835_smi_get); ++ ++/**************************************************************************** ++* ++* bcm2835_smi_probe - called when the driver is loaded. ++* ++***************************************************************************/ ++ ++static int bcm2835_smi_dma_setup(struct bcm2835_smi_instance *inst) ++{ ++ int i, rv = 0; ++ ++ inst->dma_chan = dma_request_slave_channel(inst->dev, "rx-tx"); ++ ++ inst->dma_config.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; ++ inst->dma_config.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; ++ inst->dma_config.src_addr = inst->smi_regs_busaddr + SMID; ++ inst->dma_config.dst_addr = inst->dma_config.src_addr; ++ /* Direction unimportant - always overridden by prep_slave_sg */ ++ inst->dma_config.direction = DMA_DEV_TO_MEM; ++ dmaengine_slave_config(inst->dma_chan, &inst->dma_config); ++ /* Alloc and map bounce buffers */ ++ for (i = 0; i < DMA_BOUNCE_BUFFER_COUNT; ++i) { ++ inst->bounce.buffer[i] = ++ dmam_alloc_coherent(inst->dev, DMA_BOUNCE_BUFFER_SIZE, ++ &inst->bounce.phys[i], ++ GFP_KERNEL); ++ if (!inst->bounce.buffer[i]) { ++ dev_err(inst->dev, "Could not allocate buffer!"); ++ rv = -ENOMEM; ++ break; ++ } ++ smi_scatterlist_from_buffer( ++ inst, ++ inst->bounce.phys[i], ++ DMA_BOUNCE_BUFFER_SIZE, ++ &inst->bounce.sgl[i] ++ ); ++ } ++ ++ return rv; ++} ++ ++static int bcm2835_smi_probe(struct platform_device *pdev) ++{ ++ int err; ++ struct device *dev = &pdev->dev; ++ struct device_node *node = dev->of_node; ++ struct resource *ioresource; ++ struct bcm2835_smi_instance *inst; ++ ++ /* Allocate buffers and instance data */ ++ ++ inst = devm_kzalloc(dev, sizeof(struct bcm2835_smi_instance), ++ GFP_KERNEL); ++ ++ if (!inst) ++ return -ENOMEM; ++ ++ inst->dev = dev; ++ spin_lock_init(&inst->transaction_lock); ++ ++ /* We require device tree support */ ++ if (!node) ++ return -EINVAL; ++ ++ ioresource = platform_get_resource(pdev, IORESOURCE_MEM, 0); ++ inst->smi_regs_ptr = devm_ioremap_resource(dev, ioresource); ++ ioresource = platform_get_resource(pdev, IORESOURCE_MEM, 1); ++ inst->cm_smi_regs_ptr = devm_ioremap_resource(dev, ioresource); ++ inst->smi_regs_busaddr = be32_to_cpu( ++ *of_get_address(node, 0, NULL, NULL)); ++ of_property_read_u32(node, ++ "brcm,smi-clock-source", ++ &inst->clock_source); ++ of_property_read_u32(node, ++ "brcm,smi-clock-divisor", ++ &inst->clock_divisor); ++ ++ err = bcm2835_smi_dma_setup(inst); ++ if (err) ++ return err; ++ ++ /* Finally, do peripheral setup */ ++ ++ smi_setup_clock(inst); ++ smi_setup_regs(inst); ++ ++ platform_set_drvdata(pdev, inst); ++ ++ dev_info(inst->dev, "initialised"); ++ ++ return 0; ++} ++ ++/**************************************************************************** ++* ++* bcm2835_smi_remove - called when the driver is unloaded. ++* ++***************************************************************************/ ++ ++static int bcm2835_smi_remove(struct platform_device *pdev) ++{ ++ struct bcm2835_smi_instance *inst = platform_get_drvdata(pdev); ++ struct device *dev = inst->dev; ++ ++ dev_info(dev, "SMI device removed - OK"); ++ return 0; ++} ++ ++/**************************************************************************** ++* ++* Register the driver with device tree ++* ++***************************************************************************/ ++ ++static const struct of_device_id bcm2835_smi_of_match[] = { ++ {.compatible = "brcm,bcm2835-smi",}, ++ { /* sentinel */ }, ++}; ++ ++MODULE_DEVICE_TABLE(of, bcm2835_smi_of_match); ++ ++static struct platform_driver bcm2835_smi_driver = { ++ .probe = bcm2835_smi_probe, ++ .remove = bcm2835_smi_remove, ++ .driver = { ++ .name = DRIVER_NAME, ++ .owner = THIS_MODULE, ++ .of_match_table = bcm2835_smi_of_match, ++ }, ++}; ++ ++module_platform_driver(bcm2835_smi_driver); ++ ++MODULE_ALIAS("platform:smi-bcm2835"); ++MODULE_LICENSE("GPL"); ++MODULE_DESCRIPTION("Device driver for BCM2835's secondary memory interface"); ++MODULE_AUTHOR("Luke Wren <luke@raspberrypi.org>"); +diff --git a/include/linux/broadcom/bcm2835_smi.h b/include/linux/broadcom/bcm2835_smi.h +new file mode 100644 +index 0000000..ee3a75e +--- /dev/null ++++ b/include/linux/broadcom/bcm2835_smi.h +@@ -0,0 +1,391 @@ ++/** ++ * Declarations and definitions for Broadcom's Secondary Memory Interface ++ * ++ * Written by Luke Wren <luke@raspberrypi.org> ++ * Copyright (c) 2015, Raspberry Pi (Trading) Ltd. ++ * Copyright (c) 2010-2012 Broadcom. 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, ++ * without modification. ++ * 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. ++ * 3. The names of the above-listed copyright holders may not be used ++ * to endorse or promote products derived from this software without ++ * specific prior written permission. ++ * ++ * ALTERNATIVELY, this software may be distributed under the terms of the ++ * GNU General Public License ("GPL") version 2, as published by the Free ++ * Software Foundation. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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. ++ */ ++ ++#ifndef BCM2835_SMI_H ++#define BCM2835_SMI_H ++ ++#include <linux/ioctl.h> ++ ++#ifndef __KERNEL__ ++#include <stdint.h> ++#include <stdbool.h> ++#endif ++ ++#define BCM2835_SMI_IOC_MAGIC 0x1 ++#define BCM2835_SMI_INVALID_HANDLE (~0) ++ ++/* IOCTLs 0x100...0x1ff are not device-specific - we can use them */ ++#define BCM2835_SMI_IOC_GET_SETTINGS _IO(BCM2835_SMI_IOC_MAGIC, 0) ++#define BCM2835_SMI_IOC_WRITE_SETTINGS _IO(BCM2835_SMI_IOC_MAGIC, 1) ++#define BCM2835_SMI_IOC_ADDRESS _IO(BCM2835_SMI_IOC_MAGIC, 2) ++#define BCM2835_SMI_IOC_MAX 2 ++ ++#define SMI_WIDTH_8BIT 0 ++#define SMI_WIDTH_16BIT 1 ++#define SMI_WIDTH_9BIT 2 ++#define SMI_WIDTH_18BIT 3 ++ ++/* max number of bytes where DMA will not be used */ ++#define DMA_THRESHOLD_BYTES 128 ++#define DMA_BOUNCE_BUFFER_SIZE (1024 * 1024 / 2) ++#define DMA_BOUNCE_BUFFER_COUNT 3 ++ ++ ++struct smi_settings { ++ int data_width; ++ /* Whether or not to pack multiple SMI transfers into a ++ single 32 bit FIFO word */ ++ bool pack_data; ++ ++ /* Timing for reads (writes the same but for WE) ++ * ++ * OE ----------+ +-------------------- ++ * | | ++ * +----------+ ++ * SD -<==============================>----------- ++ * SA -<=========================================>- ++ * <-setup-> <-strobe -> <-hold -> <- pace -> ++ */ ++ ++ int read_setup_time; ++ int read_hold_time; ++ int read_pace_time; ++ int read_strobe_time; ++ ++ int write_setup_time; ++ int write_hold_time; ++ int write_pace_time; ++ int write_strobe_time; ++ ++ bool dma_enable; /* DREQs */ ++ bool dma_passthrough_enable; /* External DREQs */ ++ int dma_read_thresh; ++ int dma_write_thresh; ++ int dma_panic_read_thresh; ++ int dma_panic_write_thresh; ++}; ++ ++/**************************************************************************** ++* ++* Declare exported SMI functions ++* ++***************************************************************************/ ++ ++#ifdef __KERNEL__ ++ ++#include <linux/dmaengine.h> /* for enum dma_transfer_direction */ ++#include <linux/of.h> ++#include <linux/semaphore.h> ++ ++struct bcm2835_smi_instance; ++ ++struct bcm2835_smi_bounce_info { ++ struct semaphore callback_sem; ++ void *buffer[DMA_BOUNCE_BUFFER_COUNT]; ++ dma_addr_t phys[DMA_BOUNCE_BUFFER_COUNT]; ++ struct scatterlist sgl[DMA_BOUNCE_BUFFER_COUNT]; ++}; ++ ++ ++void bcm2835_smi_set_regs_from_settings(struct bcm2835_smi_instance *); ++ ++struct smi_settings *bcm2835_smi_get_settings_from_regs( ++ struct bcm2835_smi_instance *inst); ++ ++void bcm2835_smi_write_buf( ++ struct bcm2835_smi_instance *inst, ++ const void *buf, ++ size_t n_bytes); ++ ++void bcm2835_smi_read_buf( ++ struct bcm2835_smi_instance *inst, ++ void *buf, ++ size_t n_bytes); ++ ++void bcm2835_smi_set_address(struct bcm2835_smi_instance *inst, ++ unsigned int address); ++ ++ssize_t bcm2835_smi_user_dma( ++ struct bcm2835_smi_instance *inst, ++ enum dma_transfer_direction dma_dir, ++ char __user *user_ptr, ++ size_t count, ++ struct bcm2835_smi_bounce_info **bounce); ++ ++struct bcm2835_smi_instance *bcm2835_smi_get(struct device_node *node); ++ ++#endif /* __KERNEL__ */ ++ ++/**************************************************************** ++* ++* Implementation-only declarations ++* ++****************************************************************/ ++ ++#ifdef BCM2835_SMI_IMPLEMENTATION ++ ++/* Clock manager registers for SMI clock: */ ++#define CM_SMI_BASE_ADDRESS ((BCM2708_PERI_BASE) + 0x1010b0) ++/* Clock manager "password" to protect registers from spurious writes */ ++#define CM_PWD (0x5a << 24) ++ ++#define CM_SMI_CTL 0x00 ++#define CM_SMI_DIV 0x04 ++ ++#define CM_SMI_CTL_FLIP (1 << 8) ++#define CM_SMI_CTL_BUSY (1 << 7) ++#define CM_SMI_CTL_KILL (1 << 5) ++#define CM_SMI_CTL_ENAB (1 << 4) ++#define CM_SMI_CTL_SRC_MASK (0xf) ++#define CM_SMI_CTL_SRC_OFFS (0) ++ ++#define CM_SMI_DIV_DIVI_MASK (0xf << 12) ++#define CM_SMI_DIV_DIVI_OFFS (12) ++#define CM_SMI_DIV_DIVF_MASK (0xff << 4) ++#define CM_SMI_DIV_DIVF_OFFS (4) ++ ++/* SMI register mapping:*/ ++#define SMI_BASE_ADDRESS ((BCM2708_PERI_BASE) + 0x600000) ++ ++#define SMICS 0x00 /* control + status register */ ++#define SMIL 0x04 /* length/count (n external txfers) */ ++#define SMIA 0x08 /* address register */ ++#define SMID 0x0c /* data register */ ++#define SMIDSR0 0x10 /* device 0 read settings */ ++#define SMIDSW0 0x14 /* device 0 write settings */ ++#define SMIDSR1 0x18 /* device 1 read settings */ ++#define SMIDSW1 0x1c /* device 1 write settings */ ++#define SMIDSR2 0x20 /* device 2 read settings */ ++#define SMIDSW2 0x24 /* device 2 write settings */ ++#define SMIDSR3 0x28 /* device 3 read settings */ ++#define SMIDSW3 0x2c /* device 3 write settings */ ++#define SMIDC 0x30 /* DMA control registers */ ++#define SMIDCS 0x34 /* direct control/status register */ ++#define SMIDA 0x38 /* direct address register */ ++#define SMIDD 0x3c /* direct data registers */ ++#define SMIFD 0x40 /* FIFO debug register */ ++ ++ ++ ++/* Control and Status register bits: ++ * SMICS_RXF : RX fifo full: 1 when RX fifo is full ++ * SMICS_TXE : TX fifo empty: 1 when empty. ++ * SMICS_RXD : RX fifo contains data: 1 when there is data. ++ * SMICS_TXD : TX fifo can accept data: 1 when true. ++ * SMICS_RXR : RX fifo needs reading: 1 when fifo more than 3/4 full, or ++ * when "DONE" and fifo not emptied. ++ * SMICS_TXW : TX fifo needs writing: 1 when less than 1/4 full. ++ * SMICS_AFERR : AXI FIFO error: 1 when fifo read when empty or written ++ * when full. Write 1 to clear. ++ * SMICS_EDREQ : 1 when external DREQ received. ++ * SMICS_PXLDAT : Pixel data: write 1 to enable pixel transfer modes. ++ * SMICS_SETERR : 1 if there was an error writing to setup regs (e.g. ++ * tx was in progress). Write 1 to clear. ++ * SMICS_PVMODE : Set to 1 to enable pixel valve mode. ++ * SMICS_INTR : Set to 1 to enable interrupt on RX. ++ * SMICS_INTT : Set to 1 to enable interrupt on TX. ++ * SMICS_INTD : Set to 1 to enable interrupt on DONE condition. ++ * SMICS_TEEN : Tear effect mode enabled: Programmed transfers will wait ++ * for a TE trigger before writing. ++ * SMICS_PAD1 : Padding settings for external transfers. For writes: the ++ * number of bytes initially written to the TX fifo that ++ * SMICS_PAD0 : should be ignored. For reads: the number of bytes that will ++ * be read before the data, and should be dropped. ++ * SMICS_WRITE : Transfer direction: 1 = write to external device, 0 = read ++ * SMICS_CLEAR : Write 1 to clear the FIFOs. ++ * SMICS_START : Write 1 to start the programmed transfer. ++ * SMICS_ACTIVE : Reads as 1 when a programmed transfer is underway. ++ * SMICS_DONE : Reads as 1 when transfer finished. For RX, not set until ++ * FIFO emptied. ++ * SMICS_ENABLE : Set to 1 to enable the SMI peripheral, 0 to disable. ++ */ ++ ++#define SMICS_RXF (1 << 31) ++#define SMICS_TXE (1 << 30) ++#define SMICS_RXD (1 << 29) ++#define SMICS_TXD (1 << 28) ++#define SMICS_RXR (1 << 27) ++#define SMICS_TXW (1 << 26) ++#define SMICS_AFERR (1 << 25) ++#define SMICS_EDREQ (1 << 15) ++#define SMICS_PXLDAT (1 << 14) ++#define SMICS_SETERR (1 << 13) ++#define SMICS_PVMODE (1 << 12) ++#define SMICS_INTR (1 << 11) ++#define SMICS_INTT (1 << 10) ++#define SMICS_INTD (1 << 9) ++#define SMICS_TEEN (1 << 8) ++#define SMICS_PAD1 (1 << 7) ++#define SMICS_PAD0 (1 << 6) ++#define SMICS_WRITE (1 << 5) ++#define SMICS_CLEAR (1 << 4) ++#define SMICS_START (1 << 3) ++#define SMICS_ACTIVE (1 << 2) ++#define SMICS_DONE (1 << 1) ++#define SMICS_ENABLE (1 << 0) ++ ++/* Address register bits: */ ++ ++#define SMIA_DEVICE_MASK ((1 << 9) | (1 << 8)) ++#define SMIA_DEVICE_OFFS (8) ++#define SMIA_ADDR_MASK (0x3f) /* bits 5 -> 0 */ ++#define SMIA_ADDR_OFFS (0) ++ ++/* DMA control register bits: ++ * SMIDC_DMAEN : DMA enable: set 1: DMA requests will be issued. ++ * SMIDC_DMAP : DMA passthrough: when set to 0, top two data pins are used by ++ * SMI as usual. When set to 1, the top two pins are used for ++ * external DREQs: pin 16 read request, 17 write. ++ * SMIDC_PANIC* : Threshold at which DMA will panic during read/write. ++ * SMIDC_REQ* : Threshold at which DMA will generate a DREQ. ++ */ ++ ++#define SMIDC_DMAEN (1 << 28) ++#define SMIDC_DMAP (1 << 24) ++#define SMIDC_PANICR_MASK (0x3f << 18) ++#define SMIDC_PANICR_OFFS (18) ++#define SMIDC_PANICW_MASK (0x3f << 12) ++#define SMIDC_PANICW_OFFS (12) ++#define SMIDC_REQR_MASK (0x3f << 6) ++#define SMIDC_REQR_OFFS (6) ++#define SMIDC_REQW_MASK (0x3f) ++#define SMIDC_REQW_OFFS (0) ++ ++/* Device settings register bits: same for all 4 (or 3?) device register sets. ++ * Device read settings: ++ * SMIDSR_RWIDTH : Read transfer width. 00 = 8bit, 01 = 16bit, ++ * 10 = 18bit, 11 = 9bit. ++ * SMIDSR_RSETUP : Read setup time: number of core cycles between chip ++ * select/address and read strobe. Min 1, max 64. ++ * SMIDSR_MODE68 : 1 for System 68 mode (i.e. enable + direction pins, ++ * rather than OE + WE pin) ++ * SMIDSR_FSETUP : If set to 1, setup time only applies to first ++ * transfer after address change. ++ * SMIDSR_RHOLD : Number of core cycles between read strobe going ++ * inactive and CS/address going inactive. Min 1, max 64 ++ * SMIDSR_RPACEALL : When set to 1, this device's RPACE value will always ++ * be used for the next transaction, even if it is not ++ * to this device. ++ * SMIDSR_RPACE : Number of core cycles spent waiting between CS ++ * deassert and start of next transfer. Min 1, max 128 ++ * SMIDSR_RDREQ : 1 = use external DMA request on SD16 to pace reads ++ * from device. Must also set DMAP in SMICS. ++ * SMIDSR_RSTROBE : Number of cycles to assert the read strobe. ++ * min 1, max 128. ++ */ ++#define SMIDSR_RWIDTH_MASK ((1<<31)|(1<<30)) ++#define SMIDSR_RWIDTH_OFFS (30) ++#define SMIDSR_RSETUP_MASK (0x3f << 24) ++#define SMIDSR_RSETUP_OFFS (24) ++#define SMIDSR_MODE68 (1 << 23) ++#define SMIDSR_FSETUP (1 << 22) ++#define SMIDSR_RHOLD_MASK (0x3f << 16) ++#define SMIDSR_RHOLD_OFFS (16) ++#define SMIDSR_RPACEALL (1 << 15) ++#define SMIDSR_RPACE_MASK (0x7f << 8) ++#define SMIDSR_RPACE_OFFS (8) ++#define SMIDSR_RDREQ (1 << 7) ++#define SMIDSR_RSTROBE_MASK (0x7f) ++#define SMIDSR_RSTROBE_OFFS (0) ++ ++/* Device write settings: ++ * SMIDSW_WWIDTH : Write transfer width. 00 = 8bit, 01 = 16bit, ++ * 10= 18bit, 11 = 9bit. ++ * SMIDSW_WSETUP : Number of cycles between CS assert and write strobe. ++ * Min 1, max 64. ++ * SMIDSW_WFORMAT : Pixel format of input. 0 = 16bit RGB 565, ++ * 1 = 32bit RGBA 8888 ++ * SMIDSW_WSWAP : 1 = swap pixel data bits. (Use with SMICS_PXLDAT) ++ * SMIDSW_WHOLD : Time between WE deassert and CS deassert. 1 to 64 ++ * SMIDSW_WPACEALL : 1: this device's WPACE will be used for the next ++ * transfer, regardless of that transfer's device. ++ * SMIDSW_WPACE : Cycles between CS deassert and next CS assert. ++ * Min 1, max 128 ++ * SMIDSW_WDREQ : Use external DREQ on pin 17 to pace writes. DMAP must ++ * be set in SMICS. ++ * SMIDSW_WSTROBE : Number of cycles to assert the write strobe. ++ * Min 1, max 128 ++ */ ++#define SMIDSW_WWIDTH_MASK ((1<<31)|(1<<30)) ++#define SMIDSW_WWIDTH_OFFS (30) ++#define SMIDSW_WSETUP_MASK (0x3f << 24) ++#define SMIDSW_WSETUP_OFFS (24) ++#define SMIDSW_WFORMAT (1 << 23) ++#define SMIDSW_WSWAP (1 << 22) ++#define SMIDSW_WHOLD_MASK (0x3f << 16) ++#define SMIDSW_WHOLD_OFFS (16) ++#define SMIDSW_WPACEALL (1 << 15) ++#define SMIDSW_WPACE_MASK (0x7f << 8) ++#define SMIDSW_WPACE_OFFS (8) ++#define SMIDSW_WDREQ (1 << 7) ++#define SMIDSW_WSTROBE_MASK (0x7f) ++#define SMIDSW_WSTROBE_OFFS (0) ++ ++/* Direct transfer control + status register ++ * SMIDCS_WRITE : Direction of transfer: 1 -> write, 0 -> read ++ * SMIDCS_DONE : 1 when a transfer has finished. Write 1 to clear. ++ * SMIDCS_START : Write 1 to start a transfer, if one is not already underway. ++ * SMIDCE_ENABLE: Write 1 to enable SMI in direct mode. ++ */ ++ ++#define SMIDCS_WRITE (1 << 3) ++#define SMIDCS_DONE (1 << 2) ++#define SMIDCS_START (1 << 1) ++#define SMIDCS_ENABLE (1 << 0) ++ ++/* Direct transfer address register ++ * SMIDA_DEVICE : Indicates which of the device settings banks should be used. ++ * SMIDA_ADDR : The value to be asserted on the address pins. ++ */ ++ ++#define SMIDA_DEVICE_MASK ((1<<9)|(1<<8)) ++#define SMIDA_DEVICE_OFFS (8) ++#define SMIDA_ADDR_MASK (0x3f) ++#define SMIDA_ADDR_OFFS (0) ++ ++/* FIFO debug register ++ * SMIFD_FLVL : The high-tide mark of FIFO count during the most recent txfer ++ * SMIFD_FCNT : The current FIFO count. ++ */ ++#define SMIFD_FLVL_MASK (0x3f << 8) ++#define SMIFD_FLVL_OFFS (8) ++#define SMIFD_FCNT_MASK (0x3f) ++#define SMIFD_FCNT_OFFS (0) ++ ++#endif /* BCM2835_SMI_IMPLEMENTATION */ ++ ++#endif /* BCM2835_SMI_H */ + +From 6da5091e686e4c92424fe6d70a96baf54fbcc2fd Mon Sep 17 00:00:00 2001 +From: Luke Wren <wren6991@gmail.com> +Date: Sat, 5 Sep 2015 01:16:10 +0100 +Subject: [PATCH 046/112] Add SMI NAND driver + +Signed-off-by: Luke Wren <wren6991@gmail.com> +--- + .../bindings/mtd/brcm,bcm2835-smi-nand.txt | 42 ++++ + drivers/mtd/nand/Kconfig | 7 + + drivers/mtd/nand/Makefile | 1 + + drivers/mtd/nand/bcm2835_smi_nand.c | 267 +++++++++++++++++++++ + 4 files changed, 317 insertions(+) + create mode 100644 Documentation/devicetree/bindings/mtd/brcm,bcm2835-smi-nand.txt + create mode 100644 drivers/mtd/nand/bcm2835_smi_nand.c + +diff --git a/Documentation/devicetree/bindings/mtd/brcm,bcm2835-smi-nand.txt b/Documentation/devicetree/bindings/mtd/brcm,bcm2835-smi-nand.txt +new file mode 100644 +index 0000000..159544d +--- /dev/null ++++ b/Documentation/devicetree/bindings/mtd/brcm,bcm2835-smi-nand.txt +@@ -0,0 +1,42 @@ ++* BCM2835 SMI NAND flash ++ ++This driver is a shim between the BCM2835 SMI driver (SMI is a peripheral for ++talking to parallel register interfaces) and Linux's MTD layer. ++ ++Required properties: ++- compatible: "brcm,bcm2835-smi-nand" ++- status: "okay" ++ ++Optional properties: ++- partition@n, where n is an integer from a consecutive sequence starting at 0 ++ - Difficult to store partition table on NAND device - normally put it ++ in the source code, kernel bootparams, or device tree (the best way!) ++ - Sub-properties: ++ - label: the partition name, as shown by mtdinfo /dev/mtd* ++ - reg: the size and offset of this partition. ++ - (optional) read-only: an empty property flagging as read only ++ ++Example: ++ ++nand: flash@0 { ++ compatible = "brcm,bcm2835-smi-nand"; ++ status = "okay"; ++ ++ partition@0 { ++ label = "stage2"; ++ // 128k ++ reg = <0 0x20000>; ++ read-only; ++ }; ++ partition@1 { ++ label = "firmware"; ++ // 16M ++ reg = <0x20000 0x1000000>; ++ read-only; ++ }; ++ partition@2 { ++ label = "root"; ++ // 2G ++ reg = <0x1020000 0x80000000>; ++ }; ++}; +\ No newline at end of file +diff --git a/drivers/mtd/nand/Kconfig b/drivers/mtd/nand/Kconfig +index f05e0e9..8c69541 100644 +--- a/drivers/mtd/nand/Kconfig ++++ b/drivers/mtd/nand/Kconfig +@@ -41,6 +41,13 @@ config MTD_SM_COMMON + tristate + default n + ++config MTD_NAND_BCM2835_SMI ++ tristate "Use Broadcom's Secondary Memory Interface as a NAND controller (BCM283x)" ++ depends on (MACH_BCM2708 || MACH_BCM2709 || ARCH_BCM2835) && BCM2835_SMI && MTD_NAND ++ default m ++ help ++ Uses the BCM2835's SMI peripheral as a NAND controller. ++ + config MTD_NAND_DENALI + tristate + +diff --git a/drivers/mtd/nand/Makefile b/drivers/mtd/nand/Makefile +index f553353..ea8d647 100644 +--- a/drivers/mtd/nand/Makefile ++++ b/drivers/mtd/nand/Makefile +@@ -14,6 +14,7 @@ obj-$(CONFIG_MTD_NAND_DENALI) += denali.o + obj-$(CONFIG_MTD_NAND_DENALI_PCI) += denali_pci.o + obj-$(CONFIG_MTD_NAND_DENALI_DT) += denali_dt.o + obj-$(CONFIG_MTD_NAND_AU1550) += au1550nd.o ++obj-$(CONFIG_MTD_NAND_BCM2835_SMI) += bcm2835_smi_nand.o + obj-$(CONFIG_MTD_NAND_BF5XX) += bf5xx_nand.o + obj-$(CONFIG_MTD_NAND_S3C2410) += s3c2410.o + obj-$(CONFIG_MTD_NAND_DAVINCI) += davinci_nand.o +diff --git a/drivers/mtd/nand/bcm2835_smi_nand.c b/drivers/mtd/nand/bcm2835_smi_nand.c +new file mode 100644 +index 0000000..02adda6 +--- /dev/null ++++ b/drivers/mtd/nand/bcm2835_smi_nand.c +@@ -0,0 +1,267 @@ ++/** ++ * NAND flash driver for Broadcom Secondary Memory Interface ++ * ++ * Written by Luke Wren <luke@raspberrypi.org> ++ * Copyright (c) 2015, Raspberry Pi (Trading) Ltd. ++ * ++ * 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, ++ * without modification. ++ * 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. ++ * 3. The names of the above-listed copyright holders may not be used ++ * to endorse or promote products derived from this software without ++ * specific prior written permission. ++ * ++ * ALTERNATIVELY, this software may be distributed under the terms of the ++ * GNU General Public License ("GPL") version 2, as published by the Free ++ * Software Foundation. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER OR ++ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ++ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, ++ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR ++ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF ++ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING ++ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ */ ++ ++#include <linux/kernel.h> ++#include <linux/module.h> ++#include <linux/of.h> ++#include <linux/platform_device.h> ++#include <linux/slab.h> ++#include <linux/mtd/nand.h> ++#include <linux/mtd/partitions.h> ++ ++#include <linux/broadcom/bcm2835_smi.h> ++ ++#define DEVICE_NAME "bcm2835-smi-nand" ++#define DRIVER_NAME "smi-nand-bcm2835" ++ ++struct bcm2835_smi_nand_host { ++ struct bcm2835_smi_instance *smi_inst; ++ struct nand_chip nand_chip; ++ struct mtd_info mtd; ++ struct device *dev; ++}; ++ ++/**************************************************************************** ++* ++* NAND functionality implementation ++* ++****************************************************************************/ ++ ++#define SMI_NAND_CLE_PIN 0x01 ++#define SMI_NAND_ALE_PIN 0x02 ++ ++static inline void bcm2835_smi_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, ++ unsigned int ctrl) ++{ ++ uint32_t cmd32 = cmd; ++ uint32_t addr = ~(SMI_NAND_CLE_PIN | SMI_NAND_ALE_PIN); ++ struct bcm2835_smi_nand_host *host = dev_get_drvdata(mtd->dev.parent); ++ struct bcm2835_smi_instance *inst = host->smi_inst; ++ ++ if (ctrl & NAND_CLE) ++ addr |= SMI_NAND_CLE_PIN; ++ if (ctrl & NAND_ALE) ++ addr |= SMI_NAND_ALE_PIN; ++ /* Lower ALL the CS pins! */ ++ if (ctrl & NAND_NCE) ++ addr &= (SMI_NAND_CLE_PIN | SMI_NAND_ALE_PIN); ++ ++ bcm2835_smi_set_address(inst, addr); ++ ++ if (cmd != NAND_CMD_NONE) ++ bcm2835_smi_write_buf(inst, &cmd32, 1); ++} ++ ++static inline uint8_t bcm2835_smi_nand_read_byte(struct mtd_info *mtd) ++{ ++ uint8_t byte; ++ struct bcm2835_smi_nand_host *host = dev_get_drvdata(mtd->dev.parent); ++ struct bcm2835_smi_instance *inst = host->smi_inst; ++ ++ bcm2835_smi_read_buf(inst, &byte, 1); ++ return byte; ++} ++ ++static inline void bcm2835_smi_nand_write_byte(struct mtd_info *mtd, ++ uint8_t byte) ++{ ++ struct bcm2835_smi_nand_host *host = dev_get_drvdata(mtd->dev.parent); ++ struct bcm2835_smi_instance *inst = host->smi_inst; ++ ++ bcm2835_smi_write_buf(inst, &byte, 1); ++} ++ ++static inline void bcm2835_smi_nand_write_buf(struct mtd_info *mtd, ++ const uint8_t *buf, int len) ++{ ++ struct bcm2835_smi_nand_host *host = dev_get_drvdata(mtd->dev.parent); ++ struct bcm2835_smi_instance *inst = host->smi_inst; ++ ++ bcm2835_smi_write_buf(inst, buf, len); ++} ++ ++static inline void bcm2835_smi_nand_read_buf(struct mtd_info *mtd, ++ uint8_t *buf, int len) ++{ ++ struct bcm2835_smi_nand_host *host = dev_get_drvdata(mtd->dev.parent); ++ struct bcm2835_smi_instance *inst = host->smi_inst; ++ ++ bcm2835_smi_read_buf(inst, buf, len); ++} ++ ++/**************************************************************************** ++* ++* Probe and remove functions ++* ++***************************************************************************/ ++ ++static int bcm2835_smi_nand_probe(struct platform_device *pdev) ++{ ++ struct bcm2835_smi_nand_host *host; ++ struct nand_chip *this; ++ struct mtd_info *mtd; ++ struct device *dev = &pdev->dev; ++ struct device_node *node = dev->of_node, *smi_node; ++ struct mtd_part_parser_data ppdata; ++ struct smi_settings *smi_settings; ++ struct bcm2835_smi_instance *smi_inst; ++ int ret = -ENXIO; ++ ++ if (!node) { ++ dev_err(dev, "No device tree node supplied!"); ++ return -EINVAL; ++ } ++ ++ smi_node = of_parse_phandle(node, "smi_handle", 0); ++ ++ /* Request use of SMI peripheral: */ ++ smi_inst = bcm2835_smi_get(smi_node); ++ ++ if (!smi_inst) { ++ dev_err(dev, "Could not register with SMI."); ++ return -EPROBE_DEFER; ++ } ++ ++ /* Set SMI timing and bus width */ ++ ++ smi_settings = bcm2835_smi_get_settings_from_regs(smi_inst); ++ ++ smi_settings->data_width = SMI_WIDTH_8BIT; ++ smi_settings->read_setup_time = 2; ++ smi_settings->read_hold_time = 1; ++ smi_settings->read_pace_time = 1; ++ smi_settings->read_strobe_time = 3; ++ ++ smi_settings->write_setup_time = 2; ++ smi_settings->write_hold_time = 1; ++ smi_settings->write_pace_time = 1; ++ smi_settings->write_strobe_time = 3; ++ ++ bcm2835_smi_set_regs_from_settings(smi_inst); ++ ++ host = devm_kzalloc(dev, sizeof(struct bcm2835_smi_nand_host), ++ GFP_KERNEL); ++ if (!host) ++ return -ENOMEM; ++ ++ host->dev = dev; ++ host->smi_inst = smi_inst; ++ ++ platform_set_drvdata(pdev, host); ++ ++ /* Link the structures together */ ++ ++ this = &host->nand_chip; ++ mtd = &host->mtd; ++ mtd->priv = this; ++ mtd->owner = THIS_MODULE; ++ mtd->dev.parent = dev; ++ mtd->name = DRIVER_NAME; ++ ++ /* 20 us command delay time... */ ++ this->chip_delay = 20; ++ ++ this->priv = host; ++ this->cmd_ctrl = bcm2835_smi_nand_cmd_ctrl; ++ this->read_byte = bcm2835_smi_nand_read_byte; ++ this->write_byte = bcm2835_smi_nand_write_byte; ++ this->write_buf = bcm2835_smi_nand_write_buf; ++ this->read_buf = bcm2835_smi_nand_read_buf; ++ ++ this->ecc.mode = NAND_ECC_SOFT; ++ ++ /* Should never be accessed directly: */ ++ ++ this->IO_ADDR_R = (void *)0xdeadbeef; ++ this->IO_ADDR_W = (void *)0xdeadbeef; ++ ++ /* First scan to find the device and get the page size */ ++ ++ if (nand_scan_ident(mtd, 1, NULL)) ++ return -ENXIO; ++ ++ /* Second phase scan */ ++ ++ if (nand_scan_tail(mtd)) ++ return -ENXIO; ++ ++ ret = mtd_device_parse_register(mtd, NULL, &ppdata, NULL, 0); ++ if (!ret) ++ return 0; ++ ++ nand_release(mtd); ++ return -EINVAL; ++} ++ ++static int bcm2835_smi_nand_remove(struct platform_device *pdev) ++{ ++ struct bcm2835_smi_nand_host *host = platform_get_drvdata(pdev); ++ ++ nand_release(&host->mtd); ++ ++ return 0; ++} ++ ++/**************************************************************************** ++* ++* Register the driver with device tree ++* ++***************************************************************************/ ++ ++static const struct of_device_id bcm2835_smi_nand_of_match[] = { ++ {.compatible = "brcm,bcm2835-smi-nand",}, ++ { /* sentinel */ } ++}; ++ ++MODULE_DEVICE_TABLE(of, bcm2835_smi_nand_of_match); ++ ++static struct platform_driver bcm2835_smi_nand_driver = { ++ .probe = bcm2835_smi_nand_probe, ++ .remove = bcm2835_smi_nand_remove, ++ .driver = { ++ .name = DRIVER_NAME, ++ .owner = THIS_MODULE, ++ .of_match_table = bcm2835_smi_nand_of_match, ++ }, ++}; ++ ++module_platform_driver(bcm2835_smi_nand_driver); ++ ++MODULE_ALIAS("platform:smi-nand-bcm2835"); ++MODULE_LICENSE("GPL"); ++MODULE_DESCRIPTION ++ ("Driver for NAND chips using Broadcom Secondary Memory Interface"); ++MODULE_AUTHOR("Luke Wren <luke@raspberrypi.org>"); + +From d294fc10d2c2d93dd5280e2ef30f4b6dfa7ad3bf Mon Sep 17 00:00:00 2001 +From: Aron Szabo <aron@aron.ws> +Date: Sat, 16 Jun 2012 12:15:55 +0200 +Subject: [PATCH 047/112] lirc: added support for RaspberryPi GPIO + +lirc_rpi: Use read_current_timer to determine transmitter delay. Thanks to jjmz and others +See: https://github.com/raspberrypi/linux/issues/525 + +lirc: Remove restriction on gpio pins that can be used with lirc + +Compute Module, for example could use different pins + +lirc_rpi: Add parameter to specify input pin pull + +Depending on the connected IR circuitry it might be desirable to change the +gpios internal pull from it pull-down default behaviour. Add a module +parameter to allow the user to set it explicitly. + +Signed-off-by: Julian Scheel <julian@jusst.de> + +lirc-rpi: Use the higher-level irq control functions + +This module used to access the irq_chip methods of the +gpio controller directly, rather than going through the +standard enable_irq/irq_set_irq_type functions. This +caused problems on pinctrl-bcm2835 which only implements +the irq_enable/disable methods and not irq_unmask/mask. + +lirc-rpi: Correct the interrupt usage + +1) Correct the use of enable_irq (i.e. don't call it so often) +2) Correct the shutdown sequence. +3) Avoid a bcm2708_gpio driver quirk by setting the irq flags earlier + +lirc-rpi: use getnstimeofday instead of read_current_timer + +read_current_timer isn't guaranteed to return values in +microseconds, and indeed it doesn't on a Pi2. + +Issue: linux#827 + +lirc-rpi: Add device tree support, and a suitable overlay + +The overlay supports DT parameters that match the old module +parameters, except that gpio_in_pull should be set using the +strings "up", "down" or "off". + +lirc-rpi: Also support pinctrl-bcm2835 in non-DT mode +--- + drivers/staging/media/lirc/Kconfig | 6 + + drivers/staging/media/lirc/Makefile | 1 + + drivers/staging/media/lirc/lirc_rpi.c | 730 ++++++++++++++++++++++++++++++++++ + include/linux/platform_data/bcm2708.h | 23 ++ + 4 files changed, 760 insertions(+) + create mode 100644 drivers/staging/media/lirc/lirc_rpi.c + create mode 100644 include/linux/platform_data/bcm2708.h + +diff --git a/drivers/staging/media/lirc/Kconfig b/drivers/staging/media/lirc/Kconfig +index 6879c46..77c69f2 100644 +--- a/drivers/staging/media/lirc/Kconfig ++++ b/drivers/staging/media/lirc/Kconfig +@@ -32,6 +32,12 @@ config LIRC_PARALLEL + help + Driver for Homebrew Parallel Port Receivers + ++config LIRC_RPI ++ tristate "Homebrew GPIO Port Receiver/Transmitter for the RaspberryPi" ++ depends on LIRC ++ help ++ Driver for Homebrew GPIO Port Receiver/Transmitter for the RaspberryPi ++ + config LIRC_SASEM + tristate "Sasem USB IR Remote" + depends on LIRC && USB +diff --git a/drivers/staging/media/lirc/Makefile b/drivers/staging/media/lirc/Makefile +index 5430adf..9e53cd0 100644 +--- a/drivers/staging/media/lirc/Makefile ++++ b/drivers/staging/media/lirc/Makefile +@@ -6,6 +6,7 @@ + obj-$(CONFIG_LIRC_BT829) += lirc_bt829.o + obj-$(CONFIG_LIRC_IMON) += lirc_imon.o + obj-$(CONFIG_LIRC_PARALLEL) += lirc_parallel.o ++obj-$(CONFIG_LIRC_RPI) += lirc_rpi.o + obj-$(CONFIG_LIRC_SASEM) += lirc_sasem.o + obj-$(CONFIG_LIRC_SERIAL) += lirc_serial.o + obj-$(CONFIG_LIRC_SIR) += lirc_sir.o +diff --git a/drivers/staging/media/lirc/lirc_rpi.c b/drivers/staging/media/lirc/lirc_rpi.c +new file mode 100644 +index 0000000..0624439 +--- /dev/null ++++ b/drivers/staging/media/lirc/lirc_rpi.c +@@ -0,0 +1,730 @@ ++/* ++ * lirc_rpi.c ++ * ++ * lirc_rpi - Device driver that records pulse- and pause-lengths ++ * (space-lengths) (just like the lirc_serial driver does) ++ * between GPIO interrupt events on the Raspberry Pi. ++ * Lots of code has been taken from the lirc_serial module, ++ * so I would like say thanks to the authors. ++ * ++ * Copyright (C) 2012 Aron Robert Szabo <aron@reon.hu>, ++ * Michael Bishop <cleverca22@gmail.com> ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ */ ++ ++#include <linux/module.h> ++#include <linux/errno.h> ++#include <linux/interrupt.h> ++#include <linux/sched.h> ++#include <linux/kernel.h> ++#include <linux/time.h> ++#include <linux/timex.h> ++#include <linux/timekeeping.h> ++#include <linux/string.h> ++#include <linux/delay.h> ++#include <linux/platform_device.h> ++#include <linux/irq.h> ++#include <linux/spinlock.h> ++#include <media/lirc.h> ++#include <media/lirc_dev.h> ++#include <linux/gpio.h> ++#include <linux/of_platform.h> ++#include <linux/platform_data/bcm2708.h> ++ ++#define LIRC_DRIVER_NAME "lirc_rpi" ++#define RBUF_LEN 256 ++#define LIRC_TRANSMITTER_LATENCY 50 ++ ++#ifndef MAX_UDELAY_MS ++#define MAX_UDELAY_US 5000 ++#else ++#define MAX_UDELAY_US (MAX_UDELAY_MS*1000) ++#endif ++ ++#define dprintk(fmt, args...) \ ++ do { \ ++ if (debug) \ ++ printk(KERN_DEBUG LIRC_DRIVER_NAME ": " \ ++ fmt, ## args); \ ++ } while (0) ++ ++/* module parameters */ ++ ++/* set the default GPIO input pin */ ++static int gpio_in_pin = 18; ++/* set the default pull behaviour for input pin */ ++static int gpio_in_pull = BCM2708_PULL_DOWN; ++/* set the default GPIO output pin */ ++static int gpio_out_pin = 17; ++/* enable debugging messages */ ++static bool debug; ++/* -1 = auto, 0 = active high, 1 = active low */ ++static int sense = -1; ++/* use softcarrier by default */ ++static bool softcarrier = 1; ++/* 0 = do not invert output, 1 = invert output */ ++static bool invert = 0; ++ ++struct gpio_chip *gpiochip; ++static int irq_num; ++ ++/* forward declarations */ ++static long send_pulse(unsigned long length); ++static void send_space(long length); ++static void lirc_rpi_exit(void); ++ ++static struct platform_device *lirc_rpi_dev; ++static struct timeval lasttv = { 0, 0 }; ++static struct lirc_buffer rbuf; ++static spinlock_t lock; ++ ++/* initialized/set in init_timing_params() */ ++static unsigned int freq = 38000; ++static unsigned int duty_cycle = 50; ++static unsigned long period; ++static unsigned long pulse_width; ++static unsigned long space_width; ++ ++static void safe_udelay(unsigned long usecs) ++{ ++ while (usecs > MAX_UDELAY_US) { ++ udelay(MAX_UDELAY_US); ++ usecs -= MAX_UDELAY_US; ++ } ++ udelay(usecs); ++} ++ ++static unsigned long read_current_us(void) ++{ ++ struct timespec now; ++ getnstimeofday(&now); ++ return (now.tv_sec * 1000000) + (now.tv_nsec/1000); ++} ++ ++static int init_timing_params(unsigned int new_duty_cycle, ++ unsigned int new_freq) ++{ ++ if (1000 * 1000000L / new_freq * new_duty_cycle / 100 <= ++ LIRC_TRANSMITTER_LATENCY) ++ return -EINVAL; ++ if (1000 * 1000000L / new_freq * (100 - new_duty_cycle) / 100 <= ++ LIRC_TRANSMITTER_LATENCY) ++ return -EINVAL; ++ duty_cycle = new_duty_cycle; ++ freq = new_freq; ++ period = 1000 * 1000000L / freq; ++ pulse_width = period * duty_cycle / 100; ++ space_width = period - pulse_width; ++ dprintk("in init_timing_params, freq=%d pulse=%ld, " ++ "space=%ld\n", freq, pulse_width, space_width); ++ return 0; ++} ++ ++static long send_pulse_softcarrier(unsigned long length) ++{ ++ int flag; ++ unsigned long actual, target; ++ unsigned long actual_us, initial_us, target_us; ++ ++ length *= 1000; ++ ++ actual = 0; target = 0; flag = 0; ++ actual_us = read_current_us(); ++ ++ while (actual < length) { ++ if (flag) { ++ gpiochip->set(gpiochip, gpio_out_pin, invert); ++ target += space_width; ++ } else { ++ gpiochip->set(gpiochip, gpio_out_pin, !invert); ++ target += pulse_width; ++ } ++ initial_us = actual_us; ++ target_us = actual_us + (target - actual) / 1000; ++ /* ++ * Note - we've checked in ioctl that the pulse/space ++ * widths are big enough so that d is > 0 ++ */ ++ if ((int)(target_us - actual_us) > 0) ++ udelay(target_us - actual_us); ++ actual_us = read_current_us(); ++ actual += (actual_us - initial_us) * 1000; ++ flag = !flag; ++ } ++ return (actual-length) / 1000; ++} ++ ++static long send_pulse(unsigned long length) ++{ ++ if (length <= 0) ++ return 0; ++ ++ if (softcarrier) { ++ return send_pulse_softcarrier(length); ++ } else { ++ gpiochip->set(gpiochip, gpio_out_pin, !invert); ++ safe_udelay(length); ++ return 0; ++ } ++} ++ ++static void send_space(long length) ++{ ++ gpiochip->set(gpiochip, gpio_out_pin, invert); ++ if (length <= 0) ++ return; ++ safe_udelay(length); ++} ++ ++static void rbwrite(int l) ++{ ++ if (lirc_buffer_full(&rbuf)) { ++ /* no new signals will be accepted */ ++ dprintk("Buffer overrun\n"); ++ return; ++ } ++ lirc_buffer_write(&rbuf, (void *)&l); ++} ++ ++static void frbwrite(int l) ++{ ++ /* simple noise filter */ ++ static int pulse, space; ++ static unsigned int ptr; ++ ++ if (ptr > 0 && (l & PULSE_BIT)) { ++ pulse += l & PULSE_MASK; ++ if (pulse > 250) { ++ rbwrite(space); ++ rbwrite(pulse | PULSE_BIT); ++ ptr = 0; ++ pulse = 0; ++ } ++ return; ++ } ++ if (!(l & PULSE_BIT)) { ++ if (ptr == 0) { ++ if (l > 20000) { ++ space = l; ++ ptr++; ++ return; ++ } ++ } else { ++ if (l > 20000) { ++ space += pulse; ++ if (space > PULSE_MASK) ++ space = PULSE_MASK; ++ space += l; ++ if (space > PULSE_MASK) ++ space = PULSE_MASK; ++ pulse = 0; ++ return; ++ } ++ rbwrite(space); ++ rbwrite(pulse | PULSE_BIT); ++ ptr = 0; ++ pulse = 0; ++ } ++ } ++ rbwrite(l); ++} ++ ++static irqreturn_t irq_handler(int i, void *blah, struct pt_regs *regs) ++{ ++ struct timeval tv; ++ long deltv; ++ int data; ++ int signal; ++ ++ /* use the GPIO signal level */ ++ signal = gpiochip->get(gpiochip, gpio_in_pin); ++ ++ if (sense != -1) { ++ /* get current time */ ++ do_gettimeofday(&tv); ++ ++ /* calc time since last interrupt in microseconds */ ++ deltv = tv.tv_sec-lasttv.tv_sec; ++ if (tv.tv_sec < lasttv.tv_sec || ++ (tv.tv_sec == lasttv.tv_sec && ++ tv.tv_usec < lasttv.tv_usec)) { ++ printk(KERN_WARNING LIRC_DRIVER_NAME ++ ": AIEEEE: your clock just jumped backwards\n"); ++ printk(KERN_WARNING LIRC_DRIVER_NAME ++ ": %d %d %lx %lx %lx %lx\n", signal, sense, ++ tv.tv_sec, lasttv.tv_sec, ++ tv.tv_usec, lasttv.tv_usec); ++ data = PULSE_MASK; ++ } else if (deltv > 15) { ++ data = PULSE_MASK; /* really long time */ ++ if (!(signal^sense)) { ++ /* sanity check */ ++ printk(KERN_DEBUG LIRC_DRIVER_NAME ++ ": AIEEEE: %d %d %lx %lx %lx %lx\n", ++ signal, sense, tv.tv_sec, lasttv.tv_sec, ++ tv.tv_usec, lasttv.tv_usec); ++ /* ++ * detecting pulse while this ++ * MUST be a space! ++ */ ++ sense = sense ? 0 : 1; ++ } ++ } else { ++ data = (int) (deltv*1000000 + ++ (tv.tv_usec - lasttv.tv_usec)); ++ } ++ frbwrite(signal^sense ? data : (data|PULSE_BIT)); ++ lasttv = tv; ++ wake_up_interruptible(&rbuf.wait_poll); ++ } ++ ++ return IRQ_HANDLED; ++} ++ ++static int is_right_chip(struct gpio_chip *chip, void *data) ++{ ++ dprintk("is_right_chip %s %d\n", chip->label, strcmp(data, chip->label)); ++ ++ if (strcmp(data, chip->label) == 0) ++ return 1; ++ return 0; ++} ++ ++static inline int read_bool_property(const struct device_node *np, ++ const char *propname, ++ bool *out_value) ++{ ++ u32 value = 0; ++ int err = of_property_read_u32(np, propname, &value); ++ if (err == 0) ++ *out_value = (value != 0); ++ return err; ++} ++ ++static void read_pin_settings(struct device_node *node) ++{ ++ u32 pin; ++ int index; ++ ++ for (index = 0; ++ of_property_read_u32_index( ++ node, ++ "brcm,pins", ++ index, ++ &pin) == 0; ++ index++) { ++ u32 function; ++ int err; ++ err = of_property_read_u32_index( ++ node, ++ "brcm,function", ++ index, ++ &function); ++ if (err == 0) { ++ if (function == 1) /* Output */ ++ gpio_out_pin = pin; ++ else if (function == 0) /* Input */ ++ gpio_in_pin = pin; ++ } ++ } ++} ++ ++static int init_port(void) ++{ ++ int i, nlow, nhigh; ++ struct device_node *node; ++ ++ node = lirc_rpi_dev->dev.of_node; ++ ++ gpiochip = gpiochip_find("bcm2708_gpio", is_right_chip); ++ ++ /* ++ * Because of the lack of a setpull function, only support ++ * pinctrl-bcm2835 if using device tree. ++ */ ++ if (!gpiochip && node) ++ gpiochip = gpiochip_find("pinctrl-bcm2835", is_right_chip); ++ ++ if (!gpiochip) { ++ pr_err(LIRC_DRIVER_NAME ": gpio chip not found!\n"); ++ return -ENODEV; ++ } ++ ++ if (node) { ++ struct device_node *pins_node; ++ ++ pins_node = of_parse_phandle(node, "pinctrl-0", 0); ++ if (!pins_node) { ++ printk(KERN_ERR LIRC_DRIVER_NAME ++ ": pinctrl settings not found!\n"); ++ return -EINVAL; ++ } ++ ++ read_pin_settings(pins_node); ++ ++ of_property_read_u32(node, "rpi,sense", &sense); ++ ++ read_bool_property(node, "rpi,softcarrier", &softcarrier); ++ ++ read_bool_property(node, "rpi,invert", &invert); ++ ++ read_bool_property(node, "rpi,debug", &debug); ++ ++ } else { ++ return -EINVAL; ++ } ++ ++ gpiochip->set(gpiochip, gpio_out_pin, invert); ++ ++ irq_num = gpiochip->to_irq(gpiochip, gpio_in_pin); ++ dprintk("to_irq %d\n", irq_num); ++ ++ /* if pin is high, then this must be an active low receiver. */ ++ if (sense == -1) { ++ /* wait 1/2 sec for the power supply */ ++ msleep(500); ++ ++ /* ++ * probe 9 times every 0.04s, collect "votes" for ++ * active high/low ++ */ ++ nlow = 0; ++ nhigh = 0; ++ for (i = 0; i < 9; i++) { ++ if (gpiochip->get(gpiochip, gpio_in_pin)) ++ nlow++; ++ else ++ nhigh++; ++ msleep(40); ++ } ++ sense = (nlow >= nhigh ? 1 : 0); ++ printk(KERN_INFO LIRC_DRIVER_NAME ++ ": auto-detected active %s receiver on GPIO pin %d\n", ++ sense ? "low" : "high", gpio_in_pin); ++ } else { ++ printk(KERN_INFO LIRC_DRIVER_NAME ++ ": manually using active %s receiver on GPIO pin %d\n", ++ sense ? "low" : "high", gpio_in_pin); ++ } ++ ++ return 0; ++} ++ ++// called when the character device is opened ++static int set_use_inc(void *data) ++{ ++ int result; ++ ++ /* initialize timestamp */ ++ do_gettimeofday(&lasttv); ++ ++ result = request_irq(irq_num, ++ (irq_handler_t) irq_handler, ++ IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING, ++ LIRC_DRIVER_NAME, (void*) 0); ++ ++ switch (result) { ++ case -EBUSY: ++ printk(KERN_ERR LIRC_DRIVER_NAME ++ ": IRQ %d is busy\n", ++ irq_num); ++ return -EBUSY; ++ case -EINVAL: ++ printk(KERN_ERR LIRC_DRIVER_NAME ++ ": Bad irq number or handler\n"); ++ return -EINVAL; ++ default: ++ dprintk("Interrupt %d obtained\n", ++ irq_num); ++ break; ++ }; ++ ++ /* initialize pulse/space widths */ ++ init_timing_params(duty_cycle, freq); ++ ++ return 0; ++} ++ ++static void set_use_dec(void *data) ++{ ++ /* GPIO Pin Falling/Rising Edge Detect Disable */ ++ irq_set_irq_type(irq_num, 0); ++ disable_irq(irq_num); ++ ++ free_irq(irq_num, (void *) 0); ++ ++ dprintk(KERN_INFO LIRC_DRIVER_NAME ++ ": freed IRQ %d\n", irq_num); ++} ++ ++static ssize_t lirc_write(struct file *file, const char *buf, ++ size_t n, loff_t *ppos) ++{ ++ int i, count; ++ unsigned long flags; ++ long delta = 0; ++ int *wbuf; ++ ++ count = n / sizeof(int); ++ if (n % sizeof(int) || count % 2 == 0) ++ return -EINVAL; ++ wbuf = memdup_user(buf, n); ++ if (IS_ERR(wbuf)) ++ return PTR_ERR(wbuf); ++ spin_lock_irqsave(&lock, flags); ++ ++ for (i = 0; i < count; i++) { ++ if (i%2) ++ send_space(wbuf[i] - delta); ++ else ++ delta = send_pulse(wbuf[i]); ++ } ++ gpiochip->set(gpiochip, gpio_out_pin, invert); ++ ++ spin_unlock_irqrestore(&lock, flags); ++ kfree(wbuf); ++ return n; ++} ++ ++static long lirc_ioctl(struct file *filep, unsigned int cmd, unsigned long arg) ++{ ++ int result; ++ __u32 value; ++ ++ switch (cmd) { ++ case LIRC_GET_SEND_MODE: ++ return -ENOIOCTLCMD; ++ break; ++ ++ case LIRC_SET_SEND_MODE: ++ result = get_user(value, (__u32 *) arg); ++ if (result) ++ return result; ++ /* only LIRC_MODE_PULSE supported */ ++ if (value != LIRC_MODE_PULSE) ++ return -ENOSYS; ++ break; ++ ++ case LIRC_GET_LENGTH: ++ return -ENOSYS; ++ break; ++ ++ case LIRC_SET_SEND_DUTY_CYCLE: ++ dprintk("SET_SEND_DUTY_CYCLE\n"); ++ result = get_user(value, (__u32 *) arg); ++ if (result) ++ return result; ++ if (value <= 0 || value > 100) ++ return -EINVAL; ++ return init_timing_params(value, freq); ++ break; ++ ++ case LIRC_SET_SEND_CARRIER: ++ dprintk("SET_SEND_CARRIER\n"); ++ result = get_user(value, (__u32 *) arg); ++ if (result) ++ return result; ++ if (value > 500000 || value < 20000) ++ return -EINVAL; ++ return init_timing_params(duty_cycle, value); ++ break; ++ ++ default: ++ return lirc_dev_fop_ioctl(filep, cmd, arg); ++ } ++ return 0; ++} ++ ++static const struct file_operations lirc_fops = { ++ .owner = THIS_MODULE, ++ .write = lirc_write, ++ .unlocked_ioctl = lirc_ioctl, ++ .read = lirc_dev_fop_read, ++ .poll = lirc_dev_fop_poll, ++ .open = lirc_dev_fop_open, ++ .release = lirc_dev_fop_close, ++ .llseek = no_llseek, ++}; ++ ++static struct lirc_driver driver = { ++ .name = LIRC_DRIVER_NAME, ++ .minor = -1, ++ .code_length = 1, ++ .sample_rate = 0, ++ .data = NULL, ++ .add_to_buf = NULL, ++ .rbuf = &rbuf, ++ .set_use_inc = set_use_inc, ++ .set_use_dec = set_use_dec, ++ .fops = &lirc_fops, ++ .dev = NULL, ++ .owner = THIS_MODULE, ++}; ++ ++static const struct of_device_id lirc_rpi_of_match[] = { ++ { .compatible = "rpi,lirc-rpi", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, lirc_rpi_of_match); ++ ++static struct platform_driver lirc_rpi_driver = { ++ .driver = { ++ .name = LIRC_DRIVER_NAME, ++ .owner = THIS_MODULE, ++ .of_match_table = of_match_ptr(lirc_rpi_of_match), ++ }, ++}; ++ ++static int __init lirc_rpi_init(void) ++{ ++ struct device_node *node; ++ int result; ++ ++ /* Init read buffer. */ ++ result = lirc_buffer_init(&rbuf, sizeof(int), RBUF_LEN); ++ if (result < 0) ++ return -ENOMEM; ++ ++ result = platform_driver_register(&lirc_rpi_driver); ++ if (result) { ++ printk(KERN_ERR LIRC_DRIVER_NAME ++ ": lirc register returned %d\n", result); ++ goto exit_buffer_free; ++ } ++ ++ node = of_find_compatible_node(NULL, NULL, ++ lirc_rpi_of_match[0].compatible); ++ ++ if (node) { ++ /* DT-enabled */ ++ lirc_rpi_dev = of_find_device_by_node(node); ++ WARN_ON(lirc_rpi_dev->dev.of_node != node); ++ of_node_put(node); ++ } ++ else { ++ lirc_rpi_dev = platform_device_alloc(LIRC_DRIVER_NAME, 0); ++ if (!lirc_rpi_dev) { ++ result = -ENOMEM; ++ goto exit_driver_unregister; ++ } ++ ++ result = platform_device_add(lirc_rpi_dev); ++ if (result) ++ goto exit_device_put; ++ } ++ ++ return 0; ++ ++ exit_device_put: ++ platform_device_put(lirc_rpi_dev); ++ ++ exit_driver_unregister: ++ platform_driver_unregister(&lirc_rpi_driver); ++ ++ exit_buffer_free: ++ lirc_buffer_free(&rbuf); ++ ++ return result; ++} ++ ++static void lirc_rpi_exit(void) ++{ ++ if (!lirc_rpi_dev->dev.of_node) ++ platform_device_unregister(lirc_rpi_dev); ++ platform_driver_unregister(&lirc_rpi_driver); ++ lirc_buffer_free(&rbuf); ++} ++ ++static int __init lirc_rpi_init_module(void) ++{ ++ int result; ++ ++ result = lirc_rpi_init(); ++ if (result) ++ return result; ++ ++ result = init_port(); ++ if (result < 0) ++ goto exit_rpi; ++ ++ driver.features = LIRC_CAN_SET_SEND_DUTY_CYCLE | ++ LIRC_CAN_SET_SEND_CARRIER | ++ LIRC_CAN_SEND_PULSE | ++ LIRC_CAN_REC_MODE2; ++ ++ driver.dev = &lirc_rpi_dev->dev; ++ driver.minor = lirc_register_driver(&driver); ++ ++ if (driver.minor < 0) { ++ printk(KERN_ERR LIRC_DRIVER_NAME ++ ": device registration failed with %d\n", result); ++ result = -EIO; ++ goto exit_rpi; ++ } ++ ++ printk(KERN_INFO LIRC_DRIVER_NAME ": driver registered!\n"); ++ ++ return 0; ++ ++ exit_rpi: ++ lirc_rpi_exit(); ++ ++ return result; ++} ++ ++static void __exit lirc_rpi_exit_module(void) ++{ ++ lirc_unregister_driver(driver.minor); ++ ++ gpio_free(gpio_out_pin); ++ gpio_free(gpio_in_pin); ++ ++ lirc_rpi_exit(); ++ ++ printk(KERN_INFO LIRC_DRIVER_NAME ": cleaned up module\n"); ++} ++ ++module_init(lirc_rpi_init_module); ++module_exit(lirc_rpi_exit_module); ++ ++MODULE_DESCRIPTION("Infra-red receiver and blaster driver for Raspberry Pi GPIO."); ++MODULE_AUTHOR("Aron Robert Szabo <aron@reon.hu>"); ++MODULE_AUTHOR("Michael Bishop <cleverca22@gmail.com>"); ++MODULE_LICENSE("GPL"); ++ ++module_param(gpio_out_pin, int, S_IRUGO); ++MODULE_PARM_DESC(gpio_out_pin, "GPIO output/transmitter pin number of the BCM" ++ " processor. (default 17"); ++ ++module_param(gpio_in_pin, int, S_IRUGO); ++MODULE_PARM_DESC(gpio_in_pin, "GPIO input pin number of the BCM processor." ++ " (default 18"); ++ ++module_param(gpio_in_pull, int, S_IRUGO); ++MODULE_PARM_DESC(gpio_in_pull, "GPIO input pin pull configuration." ++ " (0 = off, 1 = up, 2 = down, default down)"); ++ ++module_param(sense, int, S_IRUGO); ++MODULE_PARM_DESC(sense, "Override autodetection of IR receiver circuit" ++ " (0 = active high, 1 = active low )"); ++ ++module_param(softcarrier, bool, S_IRUGO); ++MODULE_PARM_DESC(softcarrier, "Software carrier (0 = off, 1 = on, default on)"); ++ ++module_param(invert, bool, S_IRUGO); ++MODULE_PARM_DESC(invert, "Invert output (0 = off, 1 = on, default off"); ++ ++module_param(debug, bool, S_IRUGO | S_IWUSR); ++MODULE_PARM_DESC(debug, "Enable debugging messages"); +diff --git a/include/linux/platform_data/bcm2708.h b/include/linux/platform_data/bcm2708.h +new file mode 100644 +index 0000000..fb69624 +--- /dev/null ++++ b/include/linux/platform_data/bcm2708.h +@@ -0,0 +1,23 @@ ++/* ++ * include/linux/platform_data/bcm2708.h ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 as ++ * published by the Free Software Foundation. ++ * ++ * (C) 2014 Julian Scheel <julian@jusst.de> ++ * ++ */ ++#ifndef __BCM2708_H_ ++#define __BCM2708_H_ ++ ++typedef enum { ++ BCM2708_PULL_OFF, ++ BCM2708_PULL_UP, ++ BCM2708_PULL_DOWN ++} bcm2708_gpio_pull_t; ++ ++extern int bcm2708_gpio_setpull(struct gpio_chip *gc, unsigned offset, ++ bcm2708_gpio_pull_t value); ++ ++#endif + +From 2fd607ce8d6e45776c6f6d750dc5e167d8865f54 Mon Sep 17 00:00:00 2001 +From: popcornmix <popcornmix@gmail.com> +Date: Wed, 3 Jul 2013 00:49:20 +0100 +Subject: [PATCH 048/112] Add cpufreq driver + +Signed-off-by: popcornmix <popcornmix@gmail.com> +--- + drivers/cpufreq/Kconfig.arm | 9 ++ + drivers/cpufreq/Makefile | 1 + + drivers/cpufreq/bcm2835-cpufreq.c | 213 ++++++++++++++++++++++++++++++++++++++ + 3 files changed, 223 insertions(+) + create mode 100644 drivers/cpufreq/bcm2835-cpufreq.c + +diff --git a/drivers/cpufreq/Kconfig.arm b/drivers/cpufreq/Kconfig.arm +index 14b1f93..c6e8bd5 100644 +--- a/drivers/cpufreq/Kconfig.arm ++++ b/drivers/cpufreq/Kconfig.arm +@@ -229,6 +229,15 @@ config ARM_STI_CPUFREQ + this config option if you wish to add CPUFreq support for STi based + SoCs. + ++config ARM_BCM2835_CPUFREQ ++ depends on RASPBERRYPI_FIRMWARE ++ bool "BCM2835 Driver" ++ default y ++ help ++ This adds the CPUFreq driver for BCM2835 ++ ++ If in doubt, say N. ++ + config ARM_TEGRA20_CPUFREQ + bool "Tegra20 CPUFreq support" + depends on ARCH_TEGRA +diff --git a/drivers/cpufreq/Makefile b/drivers/cpufreq/Makefile +index 9e63fb1..9e55083 100644 +--- a/drivers/cpufreq/Makefile ++++ b/drivers/cpufreq/Makefile +@@ -74,6 +74,7 @@ obj-$(CONFIG_ARM_SA1110_CPUFREQ) += sa1110-cpufreq.o + obj-$(CONFIG_ARM_SCPI_CPUFREQ) += scpi-cpufreq.o + obj-$(CONFIG_ARM_SPEAR_CPUFREQ) += spear-cpufreq.o + obj-$(CONFIG_ARM_STI_CPUFREQ) += sti-cpufreq.o ++obj-$(CONFIG_ARM_BCM2835_CPUFREQ) += bcm2835-cpufreq.o + obj-$(CONFIG_ARM_TEGRA20_CPUFREQ) += tegra20-cpufreq.o + obj-$(CONFIG_ARM_TEGRA124_CPUFREQ) += tegra124-cpufreq.o + obj-$(CONFIG_ARM_VEXPRESS_SPC_CPUFREQ) += vexpress-spc-cpufreq.o +diff --git a/drivers/cpufreq/bcm2835-cpufreq.c b/drivers/cpufreq/bcm2835-cpufreq.c +new file mode 100644 +index 0000000..3eb9e93 +--- /dev/null ++++ b/drivers/cpufreq/bcm2835-cpufreq.c +@@ -0,0 +1,213 @@ ++/***************************************************************************** ++* Copyright 2011 Broadcom Corporation. All rights reserved. ++* ++* Unless you and Broadcom execute a separate written software license ++* agreement governing use of this software, this software is licensed to you ++* under the terms of the GNU General Public License version 2, available at ++* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). ++* ++* Notwithstanding the above, under no circumstances may you combine this ++* software in any way with any other Broadcom software provided under a ++* license other than the GPL, without Broadcom's express prior written ++* consent. ++*****************************************************************************/ ++ ++/***************************************************************************** ++* FILENAME: bcm2835-cpufreq.h ++* DESCRIPTION: This driver dynamically manages the CPU Frequency of the ARM ++* processor. Messages are sent to Videocore either setting or requesting the ++* frequency of the ARM in order to match an appropiate frequency to the current ++* usage of the processor. The policy which selects the frequency to use is ++* defined in the kernel .config file, but can be changed during runtime. ++*****************************************************************************/ ++ ++/* ---------- INCLUDES ---------- */ ++#include <linux/kernel.h> ++#include <linux/init.h> ++#include <linux/module.h> ++#include <linux/cpufreq.h> ++#include <soc/bcm2835/raspberrypi-firmware.h> ++ ++/* ---------- DEFINES ---------- */ ++/*#define CPUFREQ_DEBUG_ENABLE*/ /* enable debugging */ ++#define MODULE_NAME "bcm2835-cpufreq" ++ ++#define VCMSG_ID_ARM_CLOCK 0x000000003 /* Clock/Voltage ID's */ ++ ++/* debug printk macros */ ++#ifdef CPUFREQ_DEBUG_ENABLE ++#define print_debug(fmt,...) pr_debug("%s:%s:%d: "fmt, MODULE_NAME, __func__, __LINE__, ##__VA_ARGS__) ++#else ++#define print_debug(fmt,...) ++#endif ++#define print_err(fmt,...) pr_err("%s:%s:%d: "fmt, MODULE_NAME, __func__,__LINE__, ##__VA_ARGS__) ++#define print_info(fmt,...) pr_info("%s: "fmt, MODULE_NAME, ##__VA_ARGS__) ++ ++/* ---------- GLOBALS ---------- */ ++static struct cpufreq_driver bcm2835_cpufreq_driver; /* the cpufreq driver global */ ++ ++static struct cpufreq_frequency_table bcm2835_freq_table[] = { ++ {0, 0, 0}, ++ {0, 0, 0}, ++ {0, 0, CPUFREQ_TABLE_END}, ++}; ++ ++/* ++ =============================================== ++ clk_rate either gets or sets the clock rates. ++ =============================================== ++*/ ++ ++static int bcm2835_cpufreq_clock_property(u32 tag, u32 id, u32 *val) ++{ ++ struct rpi_firmware *fw = rpi_firmware_get(NULL); ++ struct { ++ u32 id; ++ u32 val; ++ } packet; ++ int ret; ++ ++ packet.id = id; ++ packet.val = *val; ++ ret = rpi_firmware_property(fw, tag, &packet, sizeof(packet)); ++ if (ret) ++ return ret; ++ ++ *val = packet.val; ++ ++ return 0; ++} ++ ++static uint32_t bcm2835_cpufreq_set_clock(int cur_rate, int arm_rate) ++{ ++ u32 rate = arm_rate * 1000; ++ int ret; ++ ++ ret = bcm2835_cpufreq_clock_property(RPI_FIRMWARE_SET_CLOCK_RATE, VCMSG_ID_ARM_CLOCK, &rate); ++ if (ret) { ++ print_err("Failed to set clock: %d (%d)\n", arm_rate, ret); ++ return 0; ++ } ++ ++ rate /= 1000; ++ print_debug("Setting new frequency = %d -> %d (actual %d)\n", cur_rate, arm_rate, rate); ++ ++ return rate; ++} ++ ++static uint32_t bcm2835_cpufreq_get_clock(int tag) ++{ ++ u32 rate; ++ int ret; ++ ++ ret = bcm2835_cpufreq_clock_property(tag, VCMSG_ID_ARM_CLOCK, &rate); ++ if (ret) { ++ print_err("Failed to get clock (%d)\n", ret); ++ return 0; ++ } ++ ++ rate /= 1000; ++ print_debug("%s frequency = %u\n", ++ tag == RPI_FIRMWARE_GET_CLOCK_RATE ? "Current": ++ tag == RPI_FIRMWARE_GET_MIN_CLOCK_RATE ? "Min": ++ tag == RPI_FIRMWARE_GET_MAX_CLOCK_RATE ? "Max": ++ "Unexpected", rate); ++ ++ return rate; ++} ++ ++/* ++ ==================================================== ++ Module Initialisation registers the cpufreq driver ++ ==================================================== ++*/ ++static int __init bcm2835_cpufreq_module_init(void) ++{ ++ print_debug("IN\n"); ++ return cpufreq_register_driver(&bcm2835_cpufreq_driver); ++} ++ ++/* ++ ============= ++ Module exit ++ ============= ++*/ ++static void __exit bcm2835_cpufreq_module_exit(void) ++{ ++ print_debug("IN\n"); ++ cpufreq_unregister_driver(&bcm2835_cpufreq_driver); ++ return; ++} ++ ++/* ++ ============================================================== ++ Initialisation function sets up the CPU policy for first use ++ ============================================================== ++*/ ++static int bcm2835_cpufreq_driver_init(struct cpufreq_policy *policy) ++{ ++ /* measured value of how long it takes to change frequency */ ++ const unsigned int transition_latency = 355000; /* ns */ ++ ++ if (!rpi_firmware_get(NULL)) { ++ print_err("Firmware is not available\n"); ++ return -ENODEV; ++ } ++ ++ /* now find out what the maximum and minimum frequencies are */ ++ bcm2835_freq_table[0].frequency = bcm2835_cpufreq_get_clock(RPI_FIRMWARE_GET_MIN_CLOCK_RATE); ++ bcm2835_freq_table[1].frequency = bcm2835_cpufreq_get_clock(RPI_FIRMWARE_GET_MAX_CLOCK_RATE); ++ ++ print_info("min=%d max=%d\n", bcm2835_freq_table[0].frequency, bcm2835_freq_table[1].frequency); ++ return cpufreq_generic_init(policy, bcm2835_freq_table, transition_latency); ++} ++ ++/* ++ ===================================================================== ++ Target index function chooses the requested frequency from the table ++ ===================================================================== ++*/ ++ ++static int bcm2835_cpufreq_driver_target_index(struct cpufreq_policy *policy, unsigned int state) ++{ ++ unsigned int target_freq = bcm2835_freq_table[state].frequency; ++ unsigned int cur = bcm2835_cpufreq_set_clock(policy->cur, target_freq); ++ ++ if (!cur) ++ { ++ print_err("Error occurred setting a new frequency (%d)\n", target_freq); ++ return -EINVAL; ++ } ++ print_debug("%s: %i: freq %d->%d\n", policy->governor->name, state, policy->cur, cur); ++ return 0; ++} ++ ++/* ++ ====================================================== ++ Get function returns the current frequency from table ++ ====================================================== ++*/ ++ ++static unsigned int bcm2835_cpufreq_driver_get(unsigned int cpu) ++{ ++ unsigned int actual_rate = bcm2835_cpufreq_get_clock(RPI_FIRMWARE_GET_CLOCK_RATE); ++ print_debug("cpu%d: freq=%d\n", cpu, actual_rate); ++ return actual_rate <= bcm2835_freq_table[0].frequency ? bcm2835_freq_table[0].frequency : bcm2835_freq_table[1].frequency; ++} ++ ++/* the CPUFreq driver */ ++static struct cpufreq_driver bcm2835_cpufreq_driver = { ++ .name = "BCM2835 CPUFreq", ++ .init = bcm2835_cpufreq_driver_init, ++ .verify = cpufreq_generic_frequency_table_verify, ++ .target_index = bcm2835_cpufreq_driver_target_index, ++ .get = bcm2835_cpufreq_driver_get, ++ .attr = cpufreq_generic_attr, ++}; ++ ++MODULE_AUTHOR("Dorian Peake and Dom Cobley"); ++MODULE_DESCRIPTION("CPU frequency driver for BCM2835 chip"); ++MODULE_LICENSE("GPL"); ++ ++module_init(bcm2835_cpufreq_module_init); ++module_exit(bcm2835_cpufreq_module_exit); + +From aed691d5d3e8bd608d947a963c71413b068f4575 Mon Sep 17 00:00:00 2001 +From: popcornmix <popcornmix@gmail.com> +Date: Tue, 26 Mar 2013 19:24:24 +0000 +Subject: [PATCH 049/112] Added hwmon/thermal driver for reporting core + temperature. Thanks Dorian +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +BCM270x: Move thermal sensor to Device Tree + +Add Device Tree support to bcm2835-thermal driver. +Add thermal sensor device to Device Tree. +Don't add platform device when booting in DT mode. + +Signed-off-by: Noralf Trønnes <noralf@tronnes.org> +--- + drivers/thermal/Kconfig | 7 +++ + drivers/thermal/Makefile | 1 + + drivers/thermal/bcm2835-thermal.c | 109 ++++++++++++++++++++++++++++++++++++++ + 3 files changed, 117 insertions(+) + create mode 100644 drivers/thermal/bcm2835-thermal.c + +diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig +index 3c3dc4a..6789340 100644 +--- a/drivers/thermal/Kconfig ++++ b/drivers/thermal/Kconfig +@@ -292,6 +292,13 @@ config INTEL_POWERCLAMP + enforce idle time which results in more package C-state residency. The + user interface is exposed via generic thermal framework. + ++config THERMAL_BCM2835 ++ depends on RASPBERRYPI_FIRMWARE ++ tristate "BCM2835 Thermal Driver" ++ help ++ This will enable temperature monitoring for the Broadcom BCM2835 ++ chip. If built as a module, it will be called 'bcm2835-thermal'. ++ + config X86_PKG_TEMP_THERMAL + tristate "X86 package temperature thermal driver" + depends on X86_THERMAL_VECTOR +diff --git a/drivers/thermal/Makefile b/drivers/thermal/Makefile +index 8e9cbc3..497014c 100644 +--- a/drivers/thermal/Makefile ++++ b/drivers/thermal/Makefile +@@ -38,6 +38,7 @@ obj-$(CONFIG_ARMADA_THERMAL) += armada_thermal.o + obj-$(CONFIG_IMX_THERMAL) += imx_thermal.o + obj-$(CONFIG_DB8500_CPUFREQ_COOLING) += db8500_cpufreq_cooling.o + obj-$(CONFIG_INTEL_POWERCLAMP) += intel_powerclamp.o ++obj-$(CONFIG_THERMAL_BCM2835) += bcm2835-thermal.o + obj-$(CONFIG_X86_PKG_TEMP_THERMAL) += x86_pkg_temp_thermal.o + obj-$(CONFIG_INTEL_SOC_DTS_IOSF_CORE) += intel_soc_dts_iosf.o + obj-$(CONFIG_INTEL_SOC_DTS_THERMAL) += intel_soc_dts_thermal.o +diff --git a/drivers/thermal/bcm2835-thermal.c b/drivers/thermal/bcm2835-thermal.c +new file mode 100644 +index 0000000..c63fb9f +--- /dev/null ++++ b/drivers/thermal/bcm2835-thermal.c +@@ -0,0 +1,109 @@ ++/***************************************************************************** ++* Copyright 2011 Broadcom Corporation. All rights reserved. ++* ++* Unless you and Broadcom execute a separate written software license ++* agreement governing use of this software, this software is licensed to you ++* under the terms of the GNU General Public License version 2, available at ++* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). ++* ++* Notwithstanding the above, under no circumstances may you combine this ++* software in any way with any other Broadcom software provided under a ++* license other than the GPL, without Broadcom's express prior written ++* consent. ++*****************************************************************************/ ++ ++#include <linux/module.h> ++#include <linux/platform_device.h> ++#include <linux/thermal.h> ++#include <soc/bcm2835/raspberrypi-firmware.h> ++ ++static int bcm2835_thermal_get_property(struct thermal_zone_device *tz, ++ int *temp, u32 tag) ++{ ++ struct rpi_firmware *fw = tz->devdata; ++ struct { ++ u32 id; ++ u32 val; ++ } packet; ++ int ret; ++ ++ *temp = 0; ++ packet.id = 0; ++ ret = rpi_firmware_property(fw, tag, &packet, sizeof(packet)); ++ if (ret) { ++ dev_err(&tz->device, "Failed to get temperature\n"); ++ return ret; ++ } ++ ++ *temp = packet.val; ++ dev_dbg(&tz->device, "%stemp=%d\n", ++ tag == RPI_FIRMWARE_GET_MAX_TEMPERATURE ? "max" : "", *temp); ++ ++ return 0; ++} ++ ++static int bcm2835_thermal_get_temp(struct thermal_zone_device *tz, ++ int *temp) ++{ ++ return bcm2835_thermal_get_property(tz, temp, ++ RPI_FIRMWARE_GET_TEMPERATURE); ++} ++ ++static struct thermal_zone_device_ops ops = { ++ .get_temp = bcm2835_thermal_get_temp, ++}; ++ ++static int bcm2835_thermal_probe(struct platform_device *pdev) ++{ ++ struct device_node *fw_np; ++ struct rpi_firmware *fw; ++ struct thermal_zone_device *tz; ++ ++ fw_np = of_parse_phandle(pdev->dev.of_node, "firmware", 0); ++ if (!fw_np) { ++ dev_err(&pdev->dev, "Missing firmware node\n"); ++ return -ENOENT; ++ } ++ fw = rpi_firmware_get(fw_np); ++ if (!fw) ++ return -EPROBE_DEFER; ++ ++ tz = thermal_zone_device_register("bcm2835_thermal", 0, 0, fw, &ops, ++ NULL, 0, 0); ++ if (IS_ERR(tz)) { ++ dev_err(&pdev->dev, "Failed to register the thermal device\n"); ++ return PTR_ERR(tz); ++ } ++ ++ platform_set_drvdata(pdev, tz); ++ ++ return 0; ++} ++ ++static int bcm2835_thermal_remove(struct platform_device *pdev) ++{ ++ thermal_zone_device_unregister(platform_get_drvdata(pdev)); ++ ++ return 0; ++} ++ ++static const struct of_device_id bcm2835_thermal_of_match_table[] = { ++ { .compatible = "brcm,bcm2835-thermal", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, bcm2835_thermal_of_match_table); ++ ++static struct platform_driver bcm2835_thermal_driver = { ++ .probe = bcm2835_thermal_probe, ++ .remove = bcm2835_thermal_remove, ++ .driver = { ++ .name = "bcm2835_thermal", ++ .of_match_table = bcm2835_thermal_of_match_table, ++ }, ++}; ++module_platform_driver(bcm2835_thermal_driver); ++ ++MODULE_AUTHOR("Dorian Peake"); ++MODULE_AUTHOR("Noralf Trønnes"); ++MODULE_DESCRIPTION("Thermal driver for bcm2835 chip"); ++MODULE_LICENSE("GPL"); + +From 61031ab34cccd4b7be3198a2b91bd585caceed78 Mon Sep 17 00:00:00 2001 +From: popcornmix <popcornmix@gmail.com> +Date: Wed, 17 Jun 2015 15:44:08 +0100 +Subject: [PATCH 050/112] Add Chris Boot's i2c driver +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +i2c-bcm2708: fixed baudrate + +Fixed issue where the wrong CDIV value was set for baudrates below 3815 Hz (for 250MHz bus clock). +In that case the computed CDIV value was more than 0xffff. However the CDIV register width is only 16 bits. +This resulted in incorrect setting of CDIV and higher baudrate than intended. +Example: 3500Hz -> CDIV=0x11704 -> CDIV(16bit)=0x1704 -> 42430Hz +After correction: 3500Hz -> CDIV=0x11704 -> CDIV(16bit)=0xffff -> 3815Hz +The correct baudrate is shown in the log after the cdiv > 0xffff correction. + +Perform I2C combined transactions when possible + +Perform I2C combined transactions whenever possible, within the +restrictions of the Broadcomm Serial Controller. + +Disable DONE interrupt during TA poll + +Prevent interrupt from being triggered if poll is missed and transfer +starts and finishes. + +i2c: Make combined transactions optional and disabled by default + +i2c: bcm2708: add device tree support + +Add DT support to driver and add to .dtsi file. +Setup pins in .dts file. +i2c is disabled by default. + +Signed-off-by: Noralf Tronnes <notro@tronnes.org> + +bcm2708: don't register i2c controllers when using DT + +The devices for the i2c controllers are in the Device Tree. +Only register devices when not using DT. + +Signed-off-by: Noralf Tronnes <notro@tronnes.org> + +I2C: Only register the I2C device for the current board revision + +i2c_bcm2708: Fix clock reference counting + +Fix grabbing lock from atomic context in i2c driver + +2 main changes: +- check for timeouts in the bcm2708_bsc_setup function as indicated by this comment: + /* poll for transfer start bit (should only take 1-20 polls) */ + This implies that the setup function can now fail so account for this everywhere it's called +- Removed the clk_get_rate call from inside the setup function as it locks a mutex and that's not ok since we call it from under a spin lock. + +i2c-bcm2708: When using DT, leave the GPIO setup to pinctrl + +i2c-bcm2708: Increase timeouts to allow larger transfers + +Use the timeout value provided by the I2C_TIMEOUT ioctl when waiting +for completion. The default timeout is 1 second. + +See: https://github.com/raspberrypi/linux/issues/260 + +i2c-bcm2708/BCM270X_DT: Add support for I2C2 + +The third I2C bus (I2C2) is normally reserved for HDMI use. Careless +use of this bus can break an attached display - use with caution. + +It is recommended to disable accesses by VideoCore by setting +hdmi_ignore_edid=1 or hdmi_edid_file=1 in config.txt. + +The interface is disabled by default - enable using the +i2c2_iknowwhatimdoing DT parameter. + +bcm2708-spi: Don't use static pin configuration with DT + +Also remove superfluous error checking - the SPI framework ensures the +validity of the chip_select value. + +i2c-bcm2708: Remove non-DT support + +Signed-off-by: Noralf Trønnes <noralf@tronnes.org> + +Set the BSC_CLKT clock streching timeout to 35ms as per SMBus specs. +--- + drivers/i2c/busses/Kconfig | 21 +- + drivers/i2c/busses/Makefile | 2 + + drivers/i2c/busses/i2c-bcm2708.c | 508 +++++++++++++++++++++++++++++++++++++++ + 3 files changed, 530 insertions(+), 1 deletion(-) + create mode 100644 drivers/i2c/busses/i2c-bcm2708.c + +diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig +index 0967e1a..c11fce1 100644 +--- a/drivers/i2c/busses/Kconfig ++++ b/drivers/i2c/busses/Kconfig +@@ -8,6 +8,25 @@ menu "I2C Hardware Bus support" + comment "PC SMBus host controller drivers" + depends on PCI + ++config I2C_BCM2708 ++ tristate "BCM2708 BSC" ++ depends on MACH_BCM2708 || MACH_BCM2709 || ARCH_BCM2835 ++ help ++ Enabling this option will add BSC (Broadcom Serial Controller) ++ support for the BCM2708. BSC is a Broadcom proprietary bus compatible ++ with I2C/TWI/SMBus. ++ ++config I2C_BCM2708_BAUDRATE ++ prompt "BCM2708 I2C baudrate" ++ depends on I2C_BCM2708 ++ int ++ default 100000 ++ help ++ Set the I2C baudrate. This will alter the default value. A ++ different baudrate can be set by using a module parameter as well. If ++ no parameter is provided when loading, this is the value that will be ++ used. ++ + config I2C_ALI1535 + tristate "ALI 1535" + depends on PCI +@@ -365,7 +384,7 @@ config I2C_AXXIA + + config I2C_BCM2835 + tristate "Broadcom BCM2835 I2C controller" +- depends on ARCH_BCM2835 ++ depends on ARCH_BCM2835 || ARCH_BCM2708 || ARCH_BCM2709 + help + If you say yes to this option, support will be included for the + BCM2835 I2C controller. +diff --git a/drivers/i2c/busses/Makefile b/drivers/i2c/busses/Makefile +index 37f2819..e309579 100644 +--- a/drivers/i2c/busses/Makefile ++++ b/drivers/i2c/busses/Makefile +@@ -2,6 +2,8 @@ + # Makefile for the i2c bus drivers. + # + ++obj-$(CONFIG_I2C_BCM2708) += i2c-bcm2708.o ++ + # ACPI drivers + obj-$(CONFIG_I2C_SCMI) += i2c-scmi.o + +diff --git a/drivers/i2c/busses/i2c-bcm2708.c b/drivers/i2c/busses/i2c-bcm2708.c +new file mode 100644 +index 0000000..c9b8e5c +--- /dev/null ++++ b/drivers/i2c/busses/i2c-bcm2708.c +@@ -0,0 +1,508 @@ ++/* ++ * Driver for Broadcom BCM2708 BSC Controllers ++ * ++ * Copyright (C) 2012 Chris Boot & Frank Buss ++ * ++ * This driver is inspired by: ++ * i2c-ocores.c, by Peter Korsgaard <jacmet@sunsite.dk> ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ++ */ ++ ++#include <linux/kernel.h> ++#include <linux/module.h> ++#include <linux/spinlock.h> ++#include <linux/clk.h> ++#include <linux/err.h> ++#include <linux/of.h> ++#include <linux/platform_device.h> ++#include <linux/io.h> ++#include <linux/slab.h> ++#include <linux/i2c.h> ++#include <linux/interrupt.h> ++#include <linux/sched.h> ++#include <linux/wait.h> ++ ++/* BSC register offsets */ ++#define BSC_C 0x00 ++#define BSC_S 0x04 ++#define BSC_DLEN 0x08 ++#define BSC_A 0x0c ++#define BSC_FIFO 0x10 ++#define BSC_DIV 0x14 ++#define BSC_DEL 0x18 ++#define BSC_CLKT 0x1c ++ ++/* Bitfields in BSC_C */ ++#define BSC_C_I2CEN 0x00008000 ++#define BSC_C_INTR 0x00000400 ++#define BSC_C_INTT 0x00000200 ++#define BSC_C_INTD 0x00000100 ++#define BSC_C_ST 0x00000080 ++#define BSC_C_CLEAR_1 0x00000020 ++#define BSC_C_CLEAR_2 0x00000010 ++#define BSC_C_READ 0x00000001 ++ ++/* Bitfields in BSC_S */ ++#define BSC_S_CLKT 0x00000200 ++#define BSC_S_ERR 0x00000100 ++#define BSC_S_RXF 0x00000080 ++#define BSC_S_TXE 0x00000040 ++#define BSC_S_RXD 0x00000020 ++#define BSC_S_TXD 0x00000010 ++#define BSC_S_RXR 0x00000008 ++#define BSC_S_TXW 0x00000004 ++#define BSC_S_DONE 0x00000002 ++#define BSC_S_TA 0x00000001 ++ ++#define I2C_WAIT_LOOP_COUNT 200 ++ ++#define DRV_NAME "bcm2708_i2c" ++ ++static unsigned int baudrate; ++module_param(baudrate, uint, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP); ++MODULE_PARM_DESC(baudrate, "The I2C baudrate"); ++ ++static bool combined = false; ++module_param(combined, bool, 0644); ++MODULE_PARM_DESC(combined, "Use combined transactions"); ++ ++struct bcm2708_i2c { ++ struct i2c_adapter adapter; ++ ++ spinlock_t lock; ++ void __iomem *base; ++ int irq; ++ struct clk *clk; ++ u32 cdiv; ++ u32 clk_tout; ++ ++ struct completion done; ++ ++ struct i2c_msg *msg; ++ int pos; ++ int nmsgs; ++ bool error; ++}; ++ ++static inline u32 bcm2708_rd(struct bcm2708_i2c *bi, unsigned reg) ++{ ++ return readl(bi->base + reg); ++} ++ ++static inline void bcm2708_wr(struct bcm2708_i2c *bi, unsigned reg, u32 val) ++{ ++ writel(val, bi->base + reg); ++} ++ ++static inline void bcm2708_bsc_reset(struct bcm2708_i2c *bi) ++{ ++ bcm2708_wr(bi, BSC_C, 0); ++ bcm2708_wr(bi, BSC_S, BSC_S_CLKT | BSC_S_ERR | BSC_S_DONE); ++} ++ ++static inline void bcm2708_bsc_fifo_drain(struct bcm2708_i2c *bi) ++{ ++ while ((bcm2708_rd(bi, BSC_S) & BSC_S_RXD) && (bi->pos < bi->msg->len)) ++ bi->msg->buf[bi->pos++] = bcm2708_rd(bi, BSC_FIFO); ++} ++ ++static inline void bcm2708_bsc_fifo_fill(struct bcm2708_i2c *bi) ++{ ++ while ((bcm2708_rd(bi, BSC_S) & BSC_S_TXD) && (bi->pos < bi->msg->len)) ++ bcm2708_wr(bi, BSC_FIFO, bi->msg->buf[bi->pos++]); ++} ++ ++static inline int bcm2708_bsc_setup(struct bcm2708_i2c *bi) ++{ ++ u32 cdiv, s, clk_tout; ++ u32 c = BSC_C_I2CEN | BSC_C_INTD | BSC_C_ST | BSC_C_CLEAR_1; ++ int wait_loops = I2C_WAIT_LOOP_COUNT; ++ ++ /* Can't call clk_get_rate as it locks a mutex and here we are spinlocked. ++ * Use the value that we cached in the probe. ++ */ ++ cdiv = bi->cdiv; ++ clk_tout = bi->clk_tout; ++ ++ if (bi->msg->flags & I2C_M_RD) ++ c |= BSC_C_INTR | BSC_C_READ; ++ else ++ c |= BSC_C_INTT; ++ ++ bcm2708_wr(bi, BSC_CLKT, clk_tout); ++ bcm2708_wr(bi, BSC_DIV, cdiv); ++ bcm2708_wr(bi, BSC_A, bi->msg->addr); ++ bcm2708_wr(bi, BSC_DLEN, bi->msg->len); ++ if (combined) ++ { ++ /* Do the next two messages meet combined transaction criteria? ++ - Current message is a write, next message is a read ++ - Both messages to same slave address ++ - Write message can fit inside FIFO (16 bytes or less) */ ++ if ( (bi->nmsgs > 1) && ++ !(bi->msg[0].flags & I2C_M_RD) && (bi->msg[1].flags & I2C_M_RD) && ++ (bi->msg[0].addr == bi->msg[1].addr) && (bi->msg[0].len <= 16)) { ++ /* Fill FIFO with entire write message (16 byte FIFO) */ ++ while (bi->pos < bi->msg->len) { ++ bcm2708_wr(bi, BSC_FIFO, bi->msg->buf[bi->pos++]); ++ } ++ /* Start write transfer (no interrupts, don't clear FIFO) */ ++ bcm2708_wr(bi, BSC_C, BSC_C_I2CEN | BSC_C_ST); ++ ++ /* poll for transfer start bit (should only take 1-20 polls) */ ++ do { ++ s = bcm2708_rd(bi, BSC_S); ++ } while (!(s & (BSC_S_TA | BSC_S_ERR | BSC_S_CLKT | BSC_S_DONE)) && --wait_loops >= 0); ++ ++ /* did we time out or some error occured? */ ++ if (wait_loops < 0 || (s & (BSC_S_ERR | BSC_S_CLKT))) { ++ return -1; ++ } ++ ++ /* Send next read message before the write transfer finishes. */ ++ bi->nmsgs--; ++ bi->msg++; ++ bi->pos = 0; ++ bcm2708_wr(bi, BSC_DLEN, bi->msg->len); ++ c = BSC_C_I2CEN | BSC_C_INTD | BSC_C_INTR | BSC_C_ST | BSC_C_READ; ++ } ++ } ++ bcm2708_wr(bi, BSC_C, c); ++ ++ return 0; ++} ++ ++static irqreturn_t bcm2708_i2c_interrupt(int irq, void *dev_id) ++{ ++ struct bcm2708_i2c *bi = dev_id; ++ bool handled = true; ++ u32 s; ++ int ret; ++ ++ spin_lock(&bi->lock); ++ ++ /* we may see camera interrupts on the "other" I2C channel ++ Just return if we've not sent anything */ ++ if (!bi->nmsgs || !bi->msg) { ++ goto early_exit; ++ } ++ ++ s = bcm2708_rd(bi, BSC_S); ++ ++ if (s & (BSC_S_CLKT | BSC_S_ERR)) { ++ bcm2708_bsc_reset(bi); ++ bi->error = true; ++ ++ bi->msg = 0; /* to inform the that all work is done */ ++ bi->nmsgs = 0; ++ /* wake up our bh */ ++ complete(&bi->done); ++ } else if (s & BSC_S_DONE) { ++ bi->nmsgs--; ++ ++ if (bi->msg->flags & I2C_M_RD) { ++ bcm2708_bsc_fifo_drain(bi); ++ } ++ ++ bcm2708_bsc_reset(bi); ++ ++ if (bi->nmsgs) { ++ /* advance to next message */ ++ bi->msg++; ++ bi->pos = 0; ++ ret = bcm2708_bsc_setup(bi); ++ if (ret < 0) { ++ bcm2708_bsc_reset(bi); ++ bi->error = true; ++ bi->msg = 0; /* to inform the that all work is done */ ++ bi->nmsgs = 0; ++ /* wake up our bh */ ++ complete(&bi->done); ++ goto early_exit; ++ } ++ } else { ++ bi->msg = 0; /* to inform the that all work is done */ ++ bi->nmsgs = 0; ++ /* wake up our bh */ ++ complete(&bi->done); ++ } ++ } else if (s & BSC_S_TXW) { ++ bcm2708_bsc_fifo_fill(bi); ++ } else if (s & BSC_S_RXR) { ++ bcm2708_bsc_fifo_drain(bi); ++ } else { ++ handled = false; ++ } ++ ++early_exit: ++ spin_unlock(&bi->lock); ++ ++ return handled ? IRQ_HANDLED : IRQ_NONE; ++} ++ ++static int bcm2708_i2c_master_xfer(struct i2c_adapter *adap, ++ struct i2c_msg *msgs, int num) ++{ ++ struct bcm2708_i2c *bi = adap->algo_data; ++ unsigned long flags; ++ int ret; ++ ++ spin_lock_irqsave(&bi->lock, flags); ++ ++ reinit_completion(&bi->done); ++ bi->msg = msgs; ++ bi->pos = 0; ++ bi->nmsgs = num; ++ bi->error = false; ++ ++ ret = bcm2708_bsc_setup(bi); ++ ++ spin_unlock_irqrestore(&bi->lock, flags); ++ ++ /* check the result of the setup */ ++ if (ret < 0) ++ { ++ dev_err(&adap->dev, "transfer setup timed out\n"); ++ goto error_timeout; ++ } ++ ++ ret = wait_for_completion_timeout(&bi->done, adap->timeout); ++ if (ret == 0) { ++ dev_err(&adap->dev, "transfer timed out\n"); ++ goto error_timeout; ++ } ++ ++ ret = bi->error ? -EIO : num; ++ return ret; ++ ++error_timeout: ++ spin_lock_irqsave(&bi->lock, flags); ++ bcm2708_bsc_reset(bi); ++ bi->msg = 0; /* to inform the interrupt handler that there's nothing else to be done */ ++ bi->nmsgs = 0; ++ spin_unlock_irqrestore(&bi->lock, flags); ++ return -ETIMEDOUT; ++} ++ ++static u32 bcm2708_i2c_functionality(struct i2c_adapter *adap) ++{ ++ return I2C_FUNC_I2C | /*I2C_FUNC_10BIT_ADDR |*/ I2C_FUNC_SMBUS_EMUL; ++} ++ ++static struct i2c_algorithm bcm2708_i2c_algorithm = { ++ .master_xfer = bcm2708_i2c_master_xfer, ++ .functionality = bcm2708_i2c_functionality, ++}; ++ ++static int bcm2708_i2c_probe(struct platform_device *pdev) ++{ ++ struct resource *regs; ++ int irq, err = -ENOMEM; ++ struct clk *clk; ++ struct bcm2708_i2c *bi; ++ struct i2c_adapter *adap; ++ unsigned long bus_hz; ++ u32 cdiv, clk_tout; ++ u32 baud; ++ ++ baud = CONFIG_I2C_BCM2708_BAUDRATE; ++ ++ if (pdev->dev.of_node) { ++ u32 bus_clk_rate; ++ pdev->id = of_alias_get_id(pdev->dev.of_node, "i2c"); ++ if (pdev->id < 0) { ++ dev_err(&pdev->dev, "alias is missing\n"); ++ return -EINVAL; ++ } ++ if (!of_property_read_u32(pdev->dev.of_node, ++ "clock-frequency", &bus_clk_rate)) ++ baud = bus_clk_rate; ++ else ++ dev_warn(&pdev->dev, ++ "Could not read clock-frequency property\n"); ++ } ++ ++ if (baudrate) ++ baud = baudrate; ++ ++ regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); ++ if (!regs) { ++ dev_err(&pdev->dev, "could not get IO memory\n"); ++ return -ENXIO; ++ } ++ ++ irq = platform_get_irq(pdev, 0); ++ if (irq < 0) { ++ dev_err(&pdev->dev, "could not get IRQ\n"); ++ return irq; ++ } ++ ++ clk = clk_get(&pdev->dev, NULL); ++ if (IS_ERR(clk)) { ++ dev_err(&pdev->dev, "could not find clk: %ld\n", PTR_ERR(clk)); ++ return PTR_ERR(clk); ++ } ++ ++ err = clk_prepare_enable(clk); ++ if (err) { ++ dev_err(&pdev->dev, "could not enable clk: %d\n", err); ++ goto out_clk_put; ++ } ++ ++ bi = kzalloc(sizeof(*bi), GFP_KERNEL); ++ if (!bi) ++ goto out_clk_disable; ++ ++ platform_set_drvdata(pdev, bi); ++ ++ adap = &bi->adapter; ++ adap->class = I2C_CLASS_HWMON | I2C_CLASS_DDC; ++ adap->algo = &bcm2708_i2c_algorithm; ++ adap->algo_data = bi; ++ adap->dev.parent = &pdev->dev; ++ adap->nr = pdev->id; ++ strlcpy(adap->name, dev_name(&pdev->dev), sizeof(adap->name)); ++ adap->dev.of_node = pdev->dev.of_node; ++ ++ switch (pdev->id) { ++ case 0: ++ adap->class = I2C_CLASS_HWMON; ++ break; ++ case 1: ++ adap->class = I2C_CLASS_DDC; ++ break; ++ case 2: ++ adap->class = I2C_CLASS_DDC; ++ break; ++ default: ++ dev_err(&pdev->dev, "can only bind to BSC 0, 1 or 2\n"); ++ err = -ENXIO; ++ goto out_free_bi; ++ } ++ ++ spin_lock_init(&bi->lock); ++ init_completion(&bi->done); ++ ++ bi->base = ioremap(regs->start, resource_size(regs)); ++ if (!bi->base) { ++ dev_err(&pdev->dev, "could not remap memory\n"); ++ goto out_free_bi; ++ } ++ ++ bi->irq = irq; ++ bi->clk = clk; ++ ++ err = request_irq(irq, bcm2708_i2c_interrupt, IRQF_SHARED, ++ dev_name(&pdev->dev), bi); ++ if (err) { ++ dev_err(&pdev->dev, "could not request IRQ: %d\n", err); ++ goto out_iounmap; ++ } ++ ++ bcm2708_bsc_reset(bi); ++ ++ err = i2c_add_numbered_adapter(adap); ++ if (err < 0) { ++ dev_err(&pdev->dev, "could not add I2C adapter: %d\n", err); ++ goto out_free_irq; ++ } ++ ++ bus_hz = clk_get_rate(bi->clk); ++ cdiv = bus_hz / baud; ++ if (cdiv > 0xffff) { ++ cdiv = 0xffff; ++ baud = bus_hz / cdiv; ++ } ++ ++ clk_tout = 35/1000*baud; //35ms timeout as per SMBus specs. ++ if (clk_tout > 0xffff) ++ clk_tout = 0xffff; ++ ++ bi->cdiv = cdiv; ++ bi->clk_tout = clk_tout; ++ ++ dev_info(&pdev->dev, "BSC%d Controller at 0x%08lx (irq %d) (baudrate %d)\n", ++ pdev->id, (unsigned long)regs->start, irq, baud); ++ ++ return 0; ++ ++out_free_irq: ++ free_irq(bi->irq, bi); ++out_iounmap: ++ iounmap(bi->base); ++out_free_bi: ++ kfree(bi); ++out_clk_disable: ++ clk_disable_unprepare(clk); ++out_clk_put: ++ clk_put(clk); ++ return err; ++} ++ ++static int bcm2708_i2c_remove(struct platform_device *pdev) ++{ ++ struct bcm2708_i2c *bi = platform_get_drvdata(pdev); ++ ++ platform_set_drvdata(pdev, NULL); ++ ++ i2c_del_adapter(&bi->adapter); ++ free_irq(bi->irq, bi); ++ iounmap(bi->base); ++ clk_disable_unprepare(bi->clk); ++ clk_put(bi->clk); ++ kfree(bi); ++ ++ return 0; ++} ++ ++static const struct of_device_id bcm2708_i2c_of_match[] = { ++ { .compatible = "brcm,bcm2708-i2c" }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, bcm2708_i2c_of_match); ++ ++static struct platform_driver bcm2708_i2c_driver = { ++ .driver = { ++ .name = DRV_NAME, ++ .owner = THIS_MODULE, ++ .of_match_table = bcm2708_i2c_of_match, ++ }, ++ .probe = bcm2708_i2c_probe, ++ .remove = bcm2708_i2c_remove, ++}; ++ ++// module_platform_driver(bcm2708_i2c_driver); ++ ++ ++static int __init bcm2708_i2c_init(void) ++{ ++ return platform_driver_register(&bcm2708_i2c_driver); ++} ++ ++static void __exit bcm2708_i2c_exit(void) ++{ ++ platform_driver_unregister(&bcm2708_i2c_driver); ++} ++ ++module_init(bcm2708_i2c_init); ++module_exit(bcm2708_i2c_exit); ++ ++ ++ ++MODULE_DESCRIPTION("BSC controller driver for Broadcom BCM2708"); ++MODULE_AUTHOR("Chris Boot <bootc@bootc.net>"); ++MODULE_LICENSE("GPL v2"); ++MODULE_ALIAS("platform:" DRV_NAME); + +From 299b995c56f17d7b8b67cb128f170f7f552e7b54 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= <noralf@tronnes.org> +Date: Fri, 26 Jun 2015 14:27:06 +0200 +Subject: [PATCH 051/112] char: broadcom: Add vcio module +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Add module for accessing the mailbox property channel through +/dev/vcio. Was previously in bcm2708-vcio. + +Signed-off-by: Noralf Trønnes <noralf@tronnes.org> +--- + drivers/char/broadcom/Kconfig | 6 ++ + drivers/char/broadcom/Makefile | 1 + + drivers/char/broadcom/vcio.c | 175 +++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 182 insertions(+) + create mode 100644 drivers/char/broadcom/vcio.c + +diff --git a/drivers/char/broadcom/Kconfig b/drivers/char/broadcom/Kconfig +index 2292ed2..5489f19 100644 +--- a/drivers/char/broadcom/Kconfig ++++ b/drivers/char/broadcom/Kconfig +@@ -22,6 +22,12 @@ config BCM2708_VCMEM + help + Helper for videocore memory access and total size allocation. + ++config BCM_VCIO ++ tristate "Mailbox userspace access" ++ depends on BCM2835_MBOX ++ help ++ Gives access to the mailbox property channel from userspace. ++ + endif + + config BCM_VC_SM +diff --git a/drivers/char/broadcom/Makefile b/drivers/char/broadcom/Makefile +index 667d33e..14775c9 100644 +--- a/drivers/char/broadcom/Makefile ++++ b/drivers/char/broadcom/Makefile +@@ -1,5 +1,6 @@ + obj-$(CONFIG_BCM_VC_CMA) += vc_cma/ + obj-$(CONFIG_BCM2708_VCMEM) += vc_mem.o ++obj-$(CONFIG_BCM_VCIO) += vcio.o + obj-$(CONFIG_BCM_VC_SM) += vc_sm/ + + obj-$(CONFIG_BCM2835_DEVGPIOMEM)+= bcm2835-gpiomem.o +diff --git a/drivers/char/broadcom/vcio.c b/drivers/char/broadcom/vcio.c +new file mode 100644 +index 0000000..c19bc20 +--- /dev/null ++++ b/drivers/char/broadcom/vcio.c +@@ -0,0 +1,175 @@ ++/* ++ * Copyright (C) 2010 Broadcom ++ * Copyright (C) 2015 Noralf Trønnes ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 as ++ * published by the Free Software Foundation. ++ * ++ */ ++ ++#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt ++ ++#include <linux/cdev.h> ++#include <linux/device.h> ++#include <linux/fs.h> ++#include <linux/init.h> ++#include <linux/ioctl.h> ++#include <linux/module.h> ++#include <linux/slab.h> ++#include <linux/uaccess.h> ++#include <soc/bcm2835/raspberrypi-firmware.h> ++ ++#define MBOX_CHAN_PROPERTY 8 ++ ++#define VCIO_IOC_MAGIC 100 ++#define IOCTL_MBOX_PROPERTY _IOWR(VCIO_IOC_MAGIC, 0, char *) ++ ++static struct { ++ dev_t devt; ++ struct cdev cdev; ++ struct class *class; ++ struct rpi_firmware *fw; ++} vcio; ++ ++static int vcio_user_property_list(void *user) ++{ ++ u32 *buf, size; ++ int ret; ++ ++ /* The first 32-bit is the size of the buffer */ ++ if (copy_from_user(&size, user, sizeof(size))) ++ return -EFAULT; ++ ++ buf = kmalloc(size, GFP_KERNEL); ++ if (!buf) ++ return -ENOMEM; ++ ++ if (copy_from_user(buf, user, size)) { ++ kfree(buf); ++ return -EFAULT; ++ } ++ ++ /* Strip off protocol encapsulation */ ++ ret = rpi_firmware_property_list(vcio.fw, &buf[2], size - 12); ++ if (ret) { ++ kfree(buf); ++ return ret; ++ } ++ ++ buf[1] = RPI_FIRMWARE_STATUS_SUCCESS; ++ if (copy_to_user(user, buf, size)) ++ ret = -EFAULT; ++ ++ kfree(buf); ++ ++ return ret; ++} ++ ++static int vcio_device_open(struct inode *inode, struct file *file) ++{ ++ try_module_get(THIS_MODULE); ++ ++ return 0; ++} ++ ++static int vcio_device_release(struct inode *inode, struct file *file) ++{ ++ module_put(THIS_MODULE); ++ ++ return 0; ++} ++ ++static long vcio_device_ioctl(struct file *file, unsigned int ioctl_num, ++ unsigned long ioctl_param) ++{ ++ switch (ioctl_num) { ++ case IOCTL_MBOX_PROPERTY: ++ return vcio_user_property_list((void *)ioctl_param); ++ default: ++ pr_err("unknown ioctl: %d\n", ioctl_num); ++ return -EINVAL; ++ } ++} ++ ++const struct file_operations vcio_fops = { ++ .unlocked_ioctl = vcio_device_ioctl, ++ .open = vcio_device_open, ++ .release = vcio_device_release, ++}; ++ ++static int __init vcio_init(void) ++{ ++ struct device_node *np; ++ static struct device *dev; ++ int ret; ++ ++ np = of_find_compatible_node(NULL, NULL, ++ "raspberrypi,bcm2835-firmware"); ++/* Uncomment this when we only boot with Device Tree ++ if (!of_device_is_available(np)) ++ return -ENODEV; ++*/ ++ vcio.fw = rpi_firmware_get(np); ++ if (!vcio.fw) ++ return -ENODEV; ++ ++ ret = alloc_chrdev_region(&vcio.devt, 0, 1, "vcio"); ++ if (ret) { ++ pr_err("failed to allocate device number\n"); ++ return ret; ++ } ++ ++ cdev_init(&vcio.cdev, &vcio_fops); ++ vcio.cdev.owner = THIS_MODULE; ++ ret = cdev_add(&vcio.cdev, vcio.devt, 1); ++ if (ret) { ++ pr_err("failed to register device\n"); ++ goto err_unregister_chardev; ++ } ++ ++ /* ++ * Create sysfs entries ++ * 'bcm2708_vcio' is used for backwards compatibility so we don't break ++ * userspace. Raspian has a udev rule that changes the permissions. ++ */ ++ vcio.class = class_create(THIS_MODULE, "bcm2708_vcio"); ++ if (IS_ERR(vcio.class)) { ++ ret = PTR_ERR(vcio.class); ++ pr_err("failed to create class\n"); ++ goto err_cdev_del; ++ } ++ ++ dev = device_create(vcio.class, NULL, vcio.devt, NULL, "vcio"); ++ if (IS_ERR(dev)) { ++ ret = PTR_ERR(dev); ++ pr_err("failed to create device\n"); ++ goto err_class_destroy; ++ } ++ ++ return 0; ++ ++err_class_destroy: ++ class_destroy(vcio.class); ++err_cdev_del: ++ cdev_del(&vcio.cdev); ++err_unregister_chardev: ++ unregister_chrdev_region(vcio.devt, 1); ++ ++ return ret; ++} ++module_init(vcio_init); ++ ++static void __exit vcio_exit(void) ++{ ++ device_destroy(vcio.class, vcio.devt); ++ class_destroy(vcio.class); ++ cdev_del(&vcio.cdev); ++ unregister_chrdev_region(vcio.devt, 1); ++} ++module_exit(vcio_exit); ++ ++MODULE_AUTHOR("Gray Girling"); ++MODULE_AUTHOR("Noralf Trønnes"); ++MODULE_DESCRIPTION("Mailbox userspace access"); ++MODULE_LICENSE("GPL"); + +From ae4644ff503855f8f68767d92b9abbf9ffa7c5bf Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= <noralf@tronnes.org> +Date: Fri, 26 Jun 2015 14:25:01 +0200 +Subject: [PATCH 052/112] firmware: bcm2835: Support ARCH_BCM270x +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Support booting without Device Tree. +Turn on USB power. +Load driver early because of lacking support for deferred probing +in many drivers. + +Signed-off-by: Noralf Trønnes <noralf@tronnes.org> +--- + drivers/firmware/raspberrypi.c | 41 +++++++++++++++++++++++++++++++++++++++-- + 1 file changed, 39 insertions(+), 2 deletions(-) + +diff --git a/drivers/firmware/raspberrypi.c b/drivers/firmware/raspberrypi.c +index dd506cd3..b980d53 100644 +--- a/drivers/firmware/raspberrypi.c ++++ b/drivers/firmware/raspberrypi.c +@@ -28,6 +28,8 @@ struct rpi_firmware { + u32 enabled; + }; + ++static struct platform_device *g_pdev; ++ + static DEFINE_MUTEX(transaction_lock); + + static void response_callback(struct mbox_client *cl, void *msg) +@@ -183,6 +185,25 @@ rpi_firmware_print_firmware_revision(struct rpi_firmware *fw) + } + } + ++static int raspberrypi_firmware_set_power(struct rpi_firmware *fw, ++ u32 domain, bool on) ++{ ++ struct { ++ u32 domain; ++ u32 on; ++ } packet; ++ int ret; ++ ++ packet.domain = domain; ++ packet.on = on; ++ ret = rpi_firmware_property(fw, RPI_FIRMWARE_SET_POWER_STATE, ++ &packet, sizeof(packet)); ++ if (!ret && packet.on != on) ++ ret = -EINVAL; ++ ++ return ret; ++} ++ + static int rpi_firmware_probe(struct platform_device *pdev) + { + struct device *dev = &pdev->dev; +@@ -207,9 +228,13 @@ static int rpi_firmware_probe(struct platform_device *pdev) + init_completion(&fw->c); + + platform_set_drvdata(pdev, fw); ++ g_pdev = pdev; + + rpi_firmware_print_firmware_revision(fw); + ++ if (raspberrypi_firmware_set_power(fw, 3, true)) ++ dev_err(dev, "failed to turn on USB power\n"); ++ + return 0; + } + +@@ -218,6 +243,7 @@ static int rpi_firmware_remove(struct platform_device *pdev) + struct rpi_firmware *fw = platform_get_drvdata(pdev); + + mbox_free_channel(fw->chan); ++ g_pdev = NULL; + + return 0; + } +@@ -230,7 +256,7 @@ static int rpi_firmware_remove(struct platform_device *pdev) + */ + struct rpi_firmware *rpi_firmware_get(struct device_node *firmware_node) + { +- struct platform_device *pdev = of_find_device_by_node(firmware_node); ++ struct platform_device *pdev = g_pdev; + + if (!pdev) + return NULL; +@@ -253,7 +279,18 @@ static struct platform_driver rpi_firmware_driver = { + .probe = rpi_firmware_probe, + .remove = rpi_firmware_remove, + }; +-module_platform_driver(rpi_firmware_driver); ++ ++static int __init rpi_firmware_init(void) ++{ ++ return platform_driver_register(&rpi_firmware_driver); ++} ++subsys_initcall(rpi_firmware_init); ++ ++static void __init rpi_firmware_exit(void) ++{ ++ platform_driver_unregister(&rpi_firmware_driver); ++} ++module_exit(rpi_firmware_exit); + + MODULE_AUTHOR("Eric Anholt <eric@anholt.net>"); + MODULE_DESCRIPTION("Raspberry Pi firmware driver"); + +From fcaa83d6edd872b393cad689acf8b1975af74867 Mon Sep 17 00:00:00 2001 +From: Vincent Sanders <vincent.sanders@collabora.co.uk> +Date: Wed, 30 Jan 2013 12:45:18 +0000 +Subject: [PATCH 053/112] bcm2835: add v4l2 camera device + +- Supports raw YUV capture, preview, JPEG and H264. +- Uses videobuf2 for data transfer, using dma_buf. +- Uses 3.6.10 timestamping +- Camera power based on use +- Uses immutable input mode on video encoder + +Signed-off-by: Daniel Stone <daniels@collabora.com> +Signed-off-by: Luke Diamand <luked@broadcom.com> + +V4L2: Fixes from 6by9 + +V4L2: Fix EV values. Add manual shutter speed control + +V4L2 EV values should be in units of 1/1000. Corrected. +Add support for V4L2_CID_EXPOSURE_ABSOLUTE which should +give manual shutter control. Requires manual exposure mode +to be selected first. + +Signed-off-by: Dave Stevenson <dsteve@broadcom.com> + +V4L2: Correct JPEG Q-factor range + +Should be 1-100, not 0-100 + +Signed-off-by: Dave Stevenson <dsteve@broadcom.com> + +V4L2: Fix issue of driver jamming if STREAMON failed. + +Fix issue where the driver was left in a partially enabled +state if STREAMON failed, and would then reject many IOCTLs +as it thought it was streaming. + +Signed-off-by: Dave Stevenson <dsteve@broadcom.com> + +V4L2: Fix ISO controls. + +Driver was passing the index to the GPU, and not the desired +ISO value. + +Signed-off-by: Dave Stevenson <dsteve@broadcom.com> + +V4L2: Add flicker avoidance controls + +Add support for V4L2_CID_POWER_LINE_FREQUENCY to set flicker +avoidance frequencies. + +Signed-off-by: Dave Stevenson <dsteve@broadcom.com> + +V4L2: Add support for frame rate control. + +Add support for frame rate (or time per frame as V4L2 +inverts it) control via s_parm. + +Signed-off-by: Dave Stevenson <dsteve@broadcom.com> + +V4L2: Improve G_FBUF handling so we pass conformance + +Return some sane numbers for get framebuffer so that +we pass conformance. + +Signed-off-by: Dave Stevenson <dsteve@broadcom.com> + +V4L2: Fix information advertised through g_vidfmt + +Width and height were being stored based on incorrect +values. + +Signed-off-by: Dave Stevenson <dsteve@broadcom.com> + +V4L2: Add support for inline H264 headers + +Add support for V4L2_CID_MPEG_VIDEO_REPEAT_SEQ_HEADER +to control H264 inline headers. +Requires firmware fix to work correctly, otherwise format +has to be set to H264 before this parameter is set. + +Signed-off-by: Dave Stevenson <dsteve@broadcom.com> + +V4L2: Fix JPEG timestamp issue + +JPEG images were coming through from the GPU with timestamp +of 0. Detect this and give current system time instead +of some invalid value. + +Signed-off-by: Dave Stevenson <dsteve@broadcom.com> + +V4L2: Fix issue when switching down JPEG resolution. + +JPEG buffer size calculation is based on input resolution. +Input resolution was being configured after output port +format. Caused failures if switching from one JPEG resolution +to a smaller one. + +Signed-off-by: Dave Stevenson <dsteve@broadcom.com> + +V4L2: Enable MJPEG encoding + +Requires GPU firmware update to support MJPEG encoder. + +Signed-off-by: Dave Stevenson <dsteve@broadcom.com> + +V4L2: Correct flag settings for compressed formats + +Set flags field correctly on enum_fmt_vid_cap for compressed +image formats. + +Signed-off-by: Dave Stevenson <dsteve@broadcom.com> + +V4L2: H264 profile & level ctrls, FPS control and auto exp pri + +Several control handling updates. +H264 profile and level controls. +Timeperframe/FPS reworked to add V4L2_CID_EXPOSURE_AUTO_PRIORITY to +select whether AE is allowed to override the framerate specified. + +Signed-off-by: Dave Stevenson <dsteve@broadcom.com> + +V4L2: Correct BGR24 to RGB24 in format table + +Signed-off-by: Dave Stevenson <dsteve@broadcom.com> + +V4L2: Add additional pixel formats. Correct colourspace + +Adds the other flavours of YUYV, and NV12. +Corrects the overlay advertised colourspace. + +Signed-off-by: Dave Stevenson <dsteve@broadcom.com> + +V4L2: Drop logging msg from info to debug + +Signed-off-by: Dave Stevenson <dsteve@broadcom.com> + +V4L2: Initial pass at scene modes. + +Only supports exposure mode and metering modes. + +Signed-off-by: Dave Stevenson <dsteve@broadcom.com> + +V4L2: Add manual white balance control. + +Adds support for V4L2_CID_RED_BALANCE and +V4L2_CID_BLUE_BALANCE. Only has an effect if +V4L2_CID_AUTO_N_PRESET_WHITE_BALANCE has +V4L2_WHITE_BALANCE_MANUAL selected. + +Signed-off-by: Dave Stevenson <dsteve@broadcom.com> + +config: Enable V4L / MMAL driver + +V4L2: Increase the MMAL timeout to 3sec + +MJPEG codec flush is now taking longer and results +in a kernel panic if the driver has stopped waiting for +the result when it finally completes. +Increase the timeout value from 1 to 3secs. + +Signed-off-by: Dave Stevenson <dsteve@broadcom.com> + +V4L2: Add support for setting H264_I_PERIOD + +Adds support for the parameter V4L2_CID_MPEG_VIDEO_H264_I_PERIOD +to set the frequency with which I frames are produced. + +Signed-off-by: Dave Stevenson <dsteve@broadcom.com> + +V4L2: Enable GPU function for removing padding from images. + +GPU can now support arbitrary strides, although may require +additional processing to achieve it. Enable this feature +so that the images delivered are the size requested. + +Signed-off-by: Dave Stevenson <dsteve@broadcom.com> + +V4L2: Add support for V4L2_PIX_FMT_BGR32 + +Signed-off-by: Dave Stevenson <dsteve@broadcom.com> + +V4L2: Set the colourspace to avoid odd YUV-RGB conversions + +Removes the amiguity from the conversion routines and stops +them dropping back to the SD vs HD choice of coeffs. + +Signed-off-by: Dave Stevenson <dsteve@broadcom.com> + +V4L2: Make video/still threshold a run-time param + +Move the define for at what resolution the driver +switches from a video mode capture to a stills mode +capture to module parameters. + +Signed-off-by: Dave Stevenson <dsteve@broadcom.com> + +V4L2: Fix incorrect pool sizing + +Signed-off-by: Dave Stevenson <dsteve@broadcom.com> + +V4L2: Add option to disable enum_framesizes. + +Gstreamer's handling of a driver that advertises +V4L2_FRMSIZE_TYPE_STEPWISE to define the supported +resolutions is broken. See bug +https://bugzilla.gnome.org/show_bug.cgi?id=726521 + +Optional parameter of gst_v4l2src_is_broken added. +If non-zero, the driver claims not to support that +ioctl, and gstreamer should be happy again (it +guesses a set of defaults for itself). + +Signed-off-by: Dave Stevenson <dsteve@broadcom.com> + +V4L2: Add support for more image formats + +Adds YVU420 (YV12), YVU420SP (NV21), and BGR888. + +Signed-off-by: Dave Stevenson <dsteve@broadcom.com> + +V4L2: Extend range for V4L2_CID_MPEG_VIDEO_H264_I_PERIOD + +Request to extend the range from the fairly arbitrary +1000 frames (33 seconds at 30fps). Extend out to the +max range supported (int32 value). +Also allow 0, which is handled by the codec as only +send an I-frame on the first frame and never again. +There may be an exception if it detects a significant +scene change, but there's no easy way around that. + +Signed-off-by: Dave Stevenson <dsteve@broadcom.com> + +bcm2835-camera: stop_streaming now has a void return + +BCM2835-V4L2: Fix compliance test failures + +VIDIOC_TRY_FMT and VIDIOC_S_FMT tests were faling due +to reporting V4L2_COLORSPACE_JPEG when the colour +format wasn't V4L2_PIX_FMT_JPEG. +Now reports V4L2_COLORSPACE_SMPTE170M for YUV formats. + +bcm2835 camera planar/packed stride length + +Added a field to the mmal_fmt struct used to compute the bytes per line +when using a particular format. This results in the correct stride being +calculated even when the format is planar. + +Signed-off-by: Garrett Wilson <g@floft.net> + +bcm2835: camera: check for scene not being found + +static analysis by cppcheck detected some potential NULL pointer +dereference issues: + +[drivers/media/platform/bcm2835/controls.c:854]: (error) Possible null + pointer dereference: scene + (and lines 858, 859 too) + +it is possible that scene is not found because of an invalue ctrl->val +and is therefore NULL and hence causing a null pointer dereference. + +Signed-off-by: Colin Ian King <colin.king@canonical.com> + +bcm2835: memcpy port data to m rather than rmsg + +static analysis by cppcheck detected a memcpy to rmsg which is +not actually initialized at that point. The memcpy should be copying +to variable m instead. + +Signed-off-by: Colin Ian King <colin.king@canonical.com> + +BCM2835-V4L2: Return buffers to videobuf2 on shutdown + +https://github.com/raspberrypi/linux/issues/817 +Fixes the kernel warning from videobuf2 as buffers +are now returned as they are being flushed on +stop_streaming. + +squash: Fixup bcm2835-camera for changes in kernel 4.4 api + +v4l2: Fix up driver to upstream timestamp changes + +bcm2835-camera: fix a bug in computation of frame timestamp + +Fixes #1318 + +V4L2 driver updates (#1393) + +* BCM2835-V4L2: Correct ISO control and add V4L2_CID_ISO_SENSITIVITY_AUTO + +https://github.com/raspberrypi/linux/issues/1251 + +V4L2_CID_ISO_SENSITIVITY was not advertising ISO*1000 as it should. +V4L2_CID_ISO_SENSITIVITY_AUTO was not implemented, so was taking +V4L2_CID_ISO_SENSITIVITY as 0 for auto mode. +Still accepts 0 for auto, but also abides by the new parameter. + +Signed-off-by: Dave Stevenson <6by9@users.noreply.github.com> + +* BCM2835-V4L2: Add a video_nr parameter. + +Adds a kernel parameter "video_nr" to specify the preferred +/dev/videoX device node. +https://www.raspberrypi.org/forums/viewtopic.php?f=38&t=136120&p=905545 + +Signed-off-by: Dave Stevenson <6by9@users.noreply.github.com> + +* BCM2835-V4L2: Add support for multiple cameras + +Ask GPU on load how many cameras have been detected, and +enumerate that number of devices. +Only applicable on the Compute Module as no other device +exposes multiple CSI2 interfaces. + +Signed-off-by: Dave Stevenson <6by9@users.noreply.github.com> + +* BCM2835-V4L2: Add control of the overlay location and alpha. + +Actually do something useful in vidioc_s_fmt_vid_overlay and +vidioc_try_fmt_vid_overlay, rather than effectively having +read-only fields. + +Signed-off-by: Dave Stevenson <6by9@users.noreply.github.com> + +* BCM2835-V4L2: V4L2-Compliance failure fix + +VIDIOC_TRY_FMT was failing due to bytesperline not +being set correctly by default. + +Signed-off-by: Dave Stevenson <6by9@users.noreply.github.com> + +* BCM2835-V4L2: Make all module parameters static + +Clean up to correct variable scope + +Signed-off-by: Dave Stevenson <6by9@users.noreply.github.com> + +V4L2: Request maximum resolution from GPU + +Get resolution information about the sensors from the GPU +and advertise it correctly. + +Signed-off-by: Dave Stevenson <6by9@users.noreply.github.com> + +BCM2835-V4L2: Increase minimum resolution to 32x32 + +https://github.com/raspberrypi/linux/issues/1498 showed +up that 16x16 is failing to work on the GPU for some reason. + +GPU bug being tracked on +https://github.com/raspberrypi/firmware/issues/607 +Workaround here by increasing minimum resolution via V4L2 +to 32x32. + +Signed-off-by: Dave Stevenson <6by9@users.noreply.github.com> + +[media]: bcm2835-camera: fix compilation error + +There is an error when compiling rpi-4.6.y branch: + CC [M] drivers/media/platform/bcm2835/bcm2835-camera.o +drivers/media/platform/bcm2835/bcm2835-camera.c:639:17: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types] + .queue_setup = queue_setup, + ^ +drivers/media/platform/bcm2835/bcm2835-camera.c:639:17: note: (near initialization for 'bm2835_mmal_video_qops.queue_setup') + +The const void *parg in setup_queue callback is not needed since commit: +df9ecb0cad14b952a2865f8b3af86b2bbadfab45. +This commit removes it. + +Signed-off-by: Slawomir Stepien <sst@poczta.fm> + +bcm2835-camera: Fix max/min error when looping over cameras/resolutions + +See: https://github.com/raspberrypi/linux/issues/1447#issuecomment-221303506 +--- + Documentation/video4linux/bcm2835-v4l2.txt | 60 + + drivers/media/platform/Kconfig | 2 + + drivers/media/platform/Makefile | 2 + + drivers/media/platform/bcm2835/Kconfig | 25 + + drivers/media/platform/bcm2835/Makefile | 5 + + drivers/media/platform/bcm2835/bcm2835-camera.c | 1982 ++++++++++++++++++++++ + drivers/media/platform/bcm2835/bcm2835-camera.h | 144 ++ + drivers/media/platform/bcm2835/controls.c | 1345 +++++++++++++++ + drivers/media/platform/bcm2835/mmal-common.h | 53 + + drivers/media/platform/bcm2835/mmal-encodings.h | 127 ++ + drivers/media/platform/bcm2835/mmal-msg-common.h | 50 + + drivers/media/platform/bcm2835/mmal-msg-format.h | 81 + + drivers/media/platform/bcm2835/mmal-msg-port.h | 107 ++ + drivers/media/platform/bcm2835/mmal-msg.h | 404 +++++ + drivers/media/platform/bcm2835/mmal-parameters.h | 689 ++++++++ + drivers/media/platform/bcm2835/mmal-vchiq.c | 1916 +++++++++++++++++++++ + drivers/media/platform/bcm2835/mmal-vchiq.h | 178 ++ + 17 files changed, 7170 insertions(+) + create mode 100644 Documentation/video4linux/bcm2835-v4l2.txt + create mode 100644 drivers/media/platform/bcm2835/Kconfig + create mode 100644 drivers/media/platform/bcm2835/Makefile + create mode 100644 drivers/media/platform/bcm2835/bcm2835-camera.c + create mode 100644 drivers/media/platform/bcm2835/bcm2835-camera.h + create mode 100644 drivers/media/platform/bcm2835/controls.c + create mode 100644 drivers/media/platform/bcm2835/mmal-common.h + create mode 100644 drivers/media/platform/bcm2835/mmal-encodings.h + create mode 100644 drivers/media/platform/bcm2835/mmal-msg-common.h + create mode 100644 drivers/media/platform/bcm2835/mmal-msg-format.h + create mode 100644 drivers/media/platform/bcm2835/mmal-msg-port.h + create mode 100644 drivers/media/platform/bcm2835/mmal-msg.h + create mode 100644 drivers/media/platform/bcm2835/mmal-parameters.h + create mode 100644 drivers/media/platform/bcm2835/mmal-vchiq.c + create mode 100644 drivers/media/platform/bcm2835/mmal-vchiq.h + +diff --git a/Documentation/video4linux/bcm2835-v4l2.txt b/Documentation/video4linux/bcm2835-v4l2.txt +new file mode 100644 +index 0000000..c585a8f +--- /dev/null ++++ b/Documentation/video4linux/bcm2835-v4l2.txt +@@ -0,0 +1,60 @@ ++ ++BCM2835 (aka Raspberry Pi) V4L2 driver ++====================================== ++ ++1. Copyright ++============ ++ ++Copyright © 2013 Raspberry Pi (Trading) Ltd. ++ ++2. License ++========== ++ ++This program is free software; you can redistribute it and/or modify ++it under the terms of the GNU General Public License as published by ++the Free Software Foundation; either version 2 of the License, or ++(at your option) any later version. ++ ++This program is distributed in the hope that it will be useful, ++but WITHOUT ANY WARRANTY; without even the implied warranty of ++MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++GNU General Public License for more details. ++ ++You should have received a copy of the GNU General Public License ++along with this program; if not, write to the Free Software ++Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ++ ++3. Quick Start ++============== ++ ++You need a version 1.0 or later of v4l2-ctl, available from: ++ git://git.linuxtv.org/v4l-utils.git ++ ++$ sudo modprobe bcm2835-v4l2 ++ ++Turn on the overlay: ++ ++$ v4l2-ctl --overlay=1 ++ ++Turn off the overlay: ++ ++$ v4l2-ctl --overlay=0 ++ ++Set the capture format for video: ++ ++$ v4l2-ctl --set-fmt-video=width=1920,height=1088,pixelformat=4 ++ ++(Note: 1088 not 1080). ++ ++Capture: ++ ++$ v4l2-ctl --stream-mmap=3 --stream-count=100 --stream-to=somefile.h264 ++ ++Stills capture: ++ ++$ v4l2-ctl --set-fmt-video=width=2592,height=1944,pixelformat=3 ++$ v4l2-ctl --stream-mmap=3 --stream-count=1 --stream-to=somefile.jpg ++ ++List of available formats: ++ ++$ v4l2-ctl --list-formats +diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig +index 201f5c2..b798ab8 100644 +--- a/drivers/media/platform/Kconfig ++++ b/drivers/media/platform/Kconfig +@@ -11,6 +11,8 @@ menuconfig V4L_PLATFORM_DRIVERS + + if V4L_PLATFORM_DRIVERS + ++source "drivers/media/platform/bcm2835/Kconfig" ++ + source "drivers/media/platform/marvell-ccic/Kconfig" + + config VIDEO_VIA_CAMERA +diff --git a/drivers/media/platform/Makefile b/drivers/media/platform/Makefile +index bbb7bd1..6fe5b3f 100644 +--- a/drivers/media/platform/Makefile ++++ b/drivers/media/platform/Makefile +@@ -2,6 +2,8 @@ + # Makefile for the video capture/playback device drivers. + # + ++obj-$(CONFIG_VIDEO_BCM2835) += bcm2835/ ++ + obj-$(CONFIG_VIDEO_M32R_AR_M64278) += arv.o + + obj-$(CONFIG_VIDEO_VIA_CAMERA) += via-camera.o +diff --git a/drivers/media/platform/bcm2835/Kconfig b/drivers/media/platform/bcm2835/Kconfig +new file mode 100644 +index 0000000..99a5cbc +--- /dev/null ++++ b/drivers/media/platform/bcm2835/Kconfig +@@ -0,0 +1,25 @@ ++# Broadcom VideoCore IV v4l2 camera support ++ ++config VIDEO_BCM2835 ++ bool "Broadcom BCM2835 camera interface driver" ++ depends on VIDEO_V4L2 && (ARCH_BCM2708 || ARCH_BCM2709 || ARCH_BCM2835) ++ ---help--- ++ Say Y here to enable camera host interface devices for ++ Broadcom BCM2835 SoC. This operates over the VCHIQ interface ++ to a service running on VideoCore. ++ ++ ++if VIDEO_BCM2835 ++ ++config VIDEO_BCM2835_MMAL ++ tristate "Broadcom BM2835 MMAL camera interface driver" ++ depends on BCM2708_VCHIQ ++ select VIDEOBUF2_VMALLOC ++ ---help--- ++ This is a V4L2 driver for the Broadcom BCM2835 MMAL camera host interface ++ ++ To compile this driver as a module, choose M here: the ++ module will be called bcm2835-v4l2.o ++ ++ ++endif # VIDEO_BM2835 +diff --git a/drivers/media/platform/bcm2835/Makefile b/drivers/media/platform/bcm2835/Makefile +new file mode 100644 +index 0000000..f17c79c +--- /dev/null ++++ b/drivers/media/platform/bcm2835/Makefile +@@ -0,0 +1,5 @@ ++bcm2835-v4l2-objs := bcm2835-camera.o controls.o mmal-vchiq.o ++ ++obj-$(CONFIG_VIDEO_BCM2835_MMAL) += bcm2835-v4l2.o ++ ++ccflags-$(CONFIG_VIDEO_BCM2835) += -Idrivers/misc/vc04_services -Idrivers/misc/vc04_services/interface/vcos/linuxkernel -D__VCCOREVER__=0x04000000 +diff --git a/drivers/media/platform/bcm2835/bcm2835-camera.c b/drivers/media/platform/bcm2835/bcm2835-camera.c +new file mode 100644 +index 0000000..1b16c63 +--- /dev/null ++++ b/drivers/media/platform/bcm2835/bcm2835-camera.c +@@ -0,0 +1,1982 @@ ++/* ++ * Broadcom BM2835 V4L2 driver ++ * ++ * Copyright © 2013 Raspberry Pi (Trading) Ltd. ++ * ++ * This file is subject to the terms and conditions of the GNU General Public ++ * License. See the file COPYING in the main directory of this archive ++ * for more details. ++ * ++ * Authors: Vincent Sanders <vincent.sanders@collabora.co.uk> ++ * Dave Stevenson <dsteve@broadcom.com> ++ * Simon Mellor <simellor@broadcom.com> ++ * Luke Diamand <luked@broadcom.com> ++ */ ++ ++#include <linux/errno.h> ++#include <linux/kernel.h> ++#include <linux/module.h> ++#include <linux/slab.h> ++#include <media/videobuf2-vmalloc.h> ++#include <media/videobuf2-dma-contig.h> ++#include <media/v4l2-device.h> ++#include <media/v4l2-ioctl.h> ++#include <media/v4l2-ctrls.h> ++#include <media/v4l2-fh.h> ++#include <media/v4l2-event.h> ++#include <media/v4l2-common.h> ++#include <linux/delay.h> ++ ++#include "mmal-common.h" ++#include "mmal-encodings.h" ++#include "mmal-vchiq.h" ++#include "mmal-msg.h" ++#include "mmal-parameters.h" ++#include "bcm2835-camera.h" ++ ++#define BM2835_MMAL_VERSION "0.0.2" ++#define BM2835_MMAL_MODULE_NAME "bcm2835-v4l2" ++#define MIN_WIDTH 32 ++#define MIN_HEIGHT 32 ++#define MIN_BUFFER_SIZE (80*1024) ++ ++#define MAX_VIDEO_MODE_WIDTH 1280 ++#define MAX_VIDEO_MODE_HEIGHT 720 ++ ++#define MAX_BCM2835_CAMERAS 2 ++ ++MODULE_DESCRIPTION("Broadcom 2835 MMAL video capture"); ++MODULE_AUTHOR("Vincent Sanders"); ++MODULE_LICENSE("GPL"); ++MODULE_VERSION(BM2835_MMAL_VERSION); ++ ++int bcm2835_v4l2_debug; ++module_param_named(debug, bcm2835_v4l2_debug, int, 0644); ++MODULE_PARM_DESC(bcm2835_v4l2_debug, "Debug level 0-2"); ++ ++#define UNSET (-1) ++static int video_nr[] = {[0 ... (MAX_BCM2835_CAMERAS - 1)] = UNSET }; ++module_param_array(video_nr, int, NULL, 0644); ++MODULE_PARM_DESC(video_nr, "videoX start numbers, -1 is autodetect"); ++ ++static int max_video_width = MAX_VIDEO_MODE_WIDTH; ++static int max_video_height = MAX_VIDEO_MODE_HEIGHT; ++module_param(max_video_width, int, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); ++MODULE_PARM_DESC(max_video_width, "Threshold for video mode"); ++module_param(max_video_height, int, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); ++MODULE_PARM_DESC(max_video_height, "Threshold for video mode"); ++ ++/* Gstreamer bug https://bugzilla.gnome.org/show_bug.cgi?id=726521 ++ * v4l2src does bad (and actually wrong) things when the vidioc_enum_framesizes ++ * function says type V4L2_FRMSIZE_TYPE_STEPWISE, which we do by default. ++ * It's happier if we just don't say anything at all, when it then ++ * sets up a load of defaults that it thinks might work. ++ * If gst_v4l2src_is_broken is non-zero, then we remove the function from ++ * our function table list (actually switch to an alternate set, but same ++ * result). ++ */ ++static int gst_v4l2src_is_broken; ++module_param(gst_v4l2src_is_broken, int, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); ++MODULE_PARM_DESC(gst_v4l2src_is_broken, "If non-zero, enable workaround for Gstreamer"); ++ ++/* global device data array */ ++static struct bm2835_mmal_dev *gdev[MAX_BCM2835_CAMERAS]; ++ ++#define FPS_MIN 1 ++#define FPS_MAX 90 ++ ++/* timeperframe: min/max and default */ ++static const struct v4l2_fract ++ tpf_min = {.numerator = 1, .denominator = FPS_MAX}, ++ tpf_max = {.numerator = 1, .denominator = FPS_MIN}, ++ tpf_default = {.numerator = 1000, .denominator = 30000}; ++ ++/* video formats */ ++static struct mmal_fmt formats[] = { ++ { ++ .name = "4:2:0, planar, YUV", ++ .fourcc = V4L2_PIX_FMT_YUV420, ++ .flags = 0, ++ .mmal = MMAL_ENCODING_I420, ++ .depth = 12, ++ .mmal_component = MMAL_COMPONENT_CAMERA, ++ .ybbp = 1, ++ }, ++ { ++ .name = "4:2:2, packed, YUYV", ++ .fourcc = V4L2_PIX_FMT_YUYV, ++ .flags = 0, ++ .mmal = MMAL_ENCODING_YUYV, ++ .depth = 16, ++ .mmal_component = MMAL_COMPONENT_CAMERA, ++ .ybbp = 2, ++ }, ++ { ++ .name = "RGB24 (LE)", ++ .fourcc = V4L2_PIX_FMT_RGB24, ++ .flags = 0, ++ .mmal = MMAL_ENCODING_BGR24, ++ .depth = 24, ++ .mmal_component = MMAL_COMPONENT_CAMERA, ++ .ybbp = 3, ++ }, ++ { ++ .name = "JPEG", ++ .fourcc = V4L2_PIX_FMT_JPEG, ++ .flags = V4L2_FMT_FLAG_COMPRESSED, ++ .mmal = MMAL_ENCODING_JPEG, ++ .depth = 8, ++ .mmal_component = MMAL_COMPONENT_IMAGE_ENCODE, ++ .ybbp = 0, ++ }, ++ { ++ .name = "H264", ++ .fourcc = V4L2_PIX_FMT_H264, ++ .flags = V4L2_FMT_FLAG_COMPRESSED, ++ .mmal = MMAL_ENCODING_H264, ++ .depth = 8, ++ .mmal_component = MMAL_COMPONENT_VIDEO_ENCODE, ++ .ybbp = 0, ++ }, ++ { ++ .name = "MJPEG", ++ .fourcc = V4L2_PIX_FMT_MJPEG, ++ .flags = V4L2_FMT_FLAG_COMPRESSED, ++ .mmal = MMAL_ENCODING_MJPEG, ++ .depth = 8, ++ .mmal_component = MMAL_COMPONENT_VIDEO_ENCODE, ++ .ybbp = 0, ++ }, ++ { ++ .name = "4:2:2, packed, YVYU", ++ .fourcc = V4L2_PIX_FMT_YVYU, ++ .flags = 0, ++ .mmal = MMAL_ENCODING_YVYU, ++ .depth = 16, ++ .mmal_component = MMAL_COMPONENT_CAMERA, ++ .ybbp = 2, ++ }, ++ { ++ .name = "4:2:2, packed, VYUY", ++ .fourcc = V4L2_PIX_FMT_VYUY, ++ .flags = 0, ++ .mmal = MMAL_ENCODING_VYUY, ++ .depth = 16, ++ .mmal_component = MMAL_COMPONENT_CAMERA, ++ .ybbp = 2, ++ }, ++ { ++ .name = "4:2:2, packed, UYVY", ++ .fourcc = V4L2_PIX_FMT_UYVY, ++ .flags = 0, ++ .mmal = MMAL_ENCODING_UYVY, ++ .depth = 16, ++ .mmal_component = MMAL_COMPONENT_CAMERA, ++ .ybbp = 2, ++ }, ++ { ++ .name = "4:2:0, planar, NV12", ++ .fourcc = V4L2_PIX_FMT_NV12, ++ .flags = 0, ++ .mmal = MMAL_ENCODING_NV12, ++ .depth = 12, ++ .mmal_component = MMAL_COMPONENT_CAMERA, ++ .ybbp = 1, ++ }, ++ { ++ .name = "RGB24 (BE)", ++ .fourcc = V4L2_PIX_FMT_BGR24, ++ .flags = 0, ++ .mmal = MMAL_ENCODING_RGB24, ++ .depth = 24, ++ .mmal_component = MMAL_COMPONENT_CAMERA, ++ .ybbp = 3, ++ }, ++ { ++ .name = "4:2:0, planar, YVU", ++ .fourcc = V4L2_PIX_FMT_YVU420, ++ .flags = 0, ++ .mmal = MMAL_ENCODING_YV12, ++ .depth = 12, ++ .mmal_component = MMAL_COMPONENT_CAMERA, ++ .ybbp = 1, ++ }, ++ { ++ .name = "4:2:0, planar, NV21", ++ .fourcc = V4L2_PIX_FMT_NV21, ++ .flags = 0, ++ .mmal = MMAL_ENCODING_NV21, ++ .depth = 12, ++ .mmal_component = MMAL_COMPONENT_CAMERA, ++ .ybbp = 1, ++ }, ++ { ++ .name = "RGB32 (BE)", ++ .fourcc = V4L2_PIX_FMT_BGR32, ++ .flags = 0, ++ .mmal = MMAL_ENCODING_BGRA, ++ .depth = 32, ++ .mmal_component = MMAL_COMPONENT_CAMERA, ++ .ybbp = 4, ++ }, ++}; ++ ++static struct mmal_fmt *get_format(struct v4l2_format *f) ++{ ++ struct mmal_fmt *fmt; ++ unsigned int k; ++ ++ for (k = 0; k < ARRAY_SIZE(formats); k++) { ++ fmt = &formats[k]; ++ if (fmt->fourcc == f->fmt.pix.pixelformat) ++ break; ++ } ++ ++ if (k == ARRAY_SIZE(formats)) ++ return NULL; ++ ++ return &formats[k]; ++} ++ ++/* ------------------------------------------------------------------ ++ Videobuf queue operations ++ ------------------------------------------------------------------*/ ++ ++static int queue_setup(struct vb2_queue *vq, ++ unsigned int *nbuffers, unsigned int *nplanes, ++ unsigned int sizes[], void *alloc_ctxs[]) ++{ ++ struct bm2835_mmal_dev *dev = vb2_get_drv_priv(vq); ++ unsigned long size; ++ ++ /* refuse queue setup if port is not configured */ ++ if (dev->capture.port == NULL) { ++ v4l2_err(&dev->v4l2_dev, ++ "%s: capture port not configured\n", __func__); ++ return -EINVAL; ++ } ++ ++ size = dev->capture.port->current_buffer.size; ++ if (size == 0) { ++ v4l2_err(&dev->v4l2_dev, ++ "%s: capture port buffer size is zero\n", __func__); ++ return -EINVAL; ++ } ++ ++ if (*nbuffers < (dev->capture.port->current_buffer.num + 2)) ++ *nbuffers = (dev->capture.port->current_buffer.num + 2); ++ ++ *nplanes = 1; ++ ++ sizes[0] = size; ++ ++ /* ++ * videobuf2-vmalloc allocator is context-less so no need to set ++ * alloc_ctxs array. ++ */ ++ ++ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, "%s: dev:%p\n", ++ __func__, dev); ++ ++ return 0; ++} ++ ++static int buffer_prepare(struct vb2_buffer *vb) ++{ ++ struct bm2835_mmal_dev *dev = vb2_get_drv_priv(vb->vb2_queue); ++ unsigned long size; ++ ++ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, "%s: dev:%p\n", ++ __func__, dev); ++ ++ BUG_ON(dev->capture.port == NULL); ++ BUG_ON(dev->capture.fmt == NULL); ++ ++ size = dev->capture.stride * dev->capture.height; ++ if (vb2_plane_size(vb, 0) < size) { ++ v4l2_err(&dev->v4l2_dev, ++ "%s data will not fit into plane (%lu < %lu)\n", ++ __func__, vb2_plane_size(vb, 0), size); ++ return -EINVAL; ++ } ++ ++ return 0; ++} ++ ++static inline bool is_capturing(struct bm2835_mmal_dev *dev) ++{ ++ return dev->capture.camera_port == ++ &dev-> ++ component[MMAL_COMPONENT_CAMERA]->output[MMAL_CAMERA_PORT_CAPTURE]; ++} ++ ++static void buffer_cb(struct vchiq_mmal_instance *instance, ++ struct vchiq_mmal_port *port, ++ int status, ++ struct mmal_buffer *buf, ++ unsigned long length, u32 mmal_flags, s64 dts, s64 pts) ++{ ++ struct bm2835_mmal_dev *dev = port->cb_ctx; ++ ++ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, ++ "%s: status:%d, buf:%p, length:%lu, flags %u, pts %lld\n", ++ __func__, status, buf, length, mmal_flags, pts); ++ ++ if (status != 0) { ++ /* error in transfer */ ++ if (buf != NULL) { ++ /* there was a buffer with the error so return it */ ++ vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR); ++ } ++ return; ++ } else if (length == 0) { ++ /* stream ended */ ++ if (buf != NULL) { ++ /* this should only ever happen if the port is ++ * disabled and there are buffers still queued ++ */ ++ vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR); ++ pr_debug("Empty buffer"); ++ } else if (dev->capture.frame_count) { ++ /* grab another frame */ ++ if (is_capturing(dev)) { ++ pr_debug("Grab another frame"); ++ vchiq_mmal_port_parameter_set( ++ instance, ++ dev->capture. ++ camera_port, ++ MMAL_PARAMETER_CAPTURE, ++ &dev->capture. ++ frame_count, ++ sizeof(dev->capture.frame_count)); ++ } ++ } else { ++ /* signal frame completion */ ++ complete(&dev->capture.frame_cmplt); ++ } ++ } else { ++ if (dev->capture.frame_count) { ++ if (dev->capture.vc_start_timestamp != -1 && ++ pts != 0) { ++ struct timeval timestamp; ++ s64 runtime_us = pts - ++ dev->capture.vc_start_timestamp; ++ u32 div = 0; ++ u32 rem = 0; ++ ++ div = ++ div_u64_rem(runtime_us, USEC_PER_SEC, &rem); ++ timestamp.tv_sec = ++ dev->capture.kernel_start_ts.tv_sec + div; ++ timestamp.tv_usec = ++ dev->capture.kernel_start_ts.tv_usec + rem; ++ ++ if (timestamp.tv_usec >= ++ USEC_PER_SEC) { ++ timestamp.tv_sec++; ++ timestamp.tv_usec -= ++ USEC_PER_SEC; ++ } ++ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, ++ "Convert start time %d.%06d and %llu " ++ "with offset %llu to %d.%06d\n", ++ (int)dev->capture.kernel_start_ts. ++ tv_sec, ++ (int)dev->capture.kernel_start_ts. ++ tv_usec, ++ dev->capture.vc_start_timestamp, pts, ++ (int)timestamp.tv_sec, ++ (int)timestamp.tv_usec); ++ buf->vb.vb2_buf.timestamp = timestamp.tv_sec * 1000000000ULL + ++ timestamp.tv_usec * 1000ULL; ++ } else { ++ buf->vb.vb2_buf.timestamp = ktime_get_ns(); ++ } ++ ++ vb2_set_plane_payload(&buf->vb.vb2_buf, 0, length); ++ vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_DONE); ++ ++ if (mmal_flags & MMAL_BUFFER_HEADER_FLAG_EOS && ++ is_capturing(dev)) { ++ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, ++ "Grab another frame as buffer has EOS"); ++ vchiq_mmal_port_parameter_set( ++ instance, ++ dev->capture. ++ camera_port, ++ MMAL_PARAMETER_CAPTURE, ++ &dev->capture. ++ frame_count, ++ sizeof(dev->capture.frame_count)); ++ } ++ } else { ++ /* signal frame completion */ ++ vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR); ++ complete(&dev->capture.frame_cmplt); ++ } ++ } ++} ++ ++static int enable_camera(struct bm2835_mmal_dev *dev) ++{ ++ int ret; ++ if (!dev->camera_use_count) { ++ ret = vchiq_mmal_port_parameter_set( ++ dev->instance, ++ &dev->component[MMAL_COMPONENT_CAMERA]->control, ++ MMAL_PARAMETER_CAMERA_NUM, &dev->camera_num, ++ sizeof(dev->camera_num)); ++ if (ret < 0) { ++ v4l2_err(&dev->v4l2_dev, ++ "Failed setting camera num, ret %d\n", ret); ++ return -EINVAL; ++ } ++ ++ ret = vchiq_mmal_component_enable( ++ dev->instance, ++ dev->component[MMAL_COMPONENT_CAMERA]); ++ if (ret < 0) { ++ v4l2_err(&dev->v4l2_dev, ++ "Failed enabling camera, ret %d\n", ret); ++ return -EINVAL; ++ } ++ } ++ dev->camera_use_count++; ++ v4l2_dbg(1, bcm2835_v4l2_debug, ++ &dev->v4l2_dev, "enabled camera (refcount %d)\n", ++ dev->camera_use_count); ++ return 0; ++} ++ ++static int disable_camera(struct bm2835_mmal_dev *dev) ++{ ++ int ret; ++ if (!dev->camera_use_count) { ++ v4l2_err(&dev->v4l2_dev, ++ "Disabled the camera when already disabled\n"); ++ return -EINVAL; ++ } ++ dev->camera_use_count--; ++ if (!dev->camera_use_count) { ++ unsigned int i = 0xFFFFFFFF; ++ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, ++ "Disabling camera\n"); ++ ret = ++ vchiq_mmal_component_disable( ++ dev->instance, ++ dev->component[MMAL_COMPONENT_CAMERA]); ++ if (ret < 0) { ++ v4l2_err(&dev->v4l2_dev, ++ "Failed disabling camera, ret %d\n", ret); ++ return -EINVAL; ++ } ++ vchiq_mmal_port_parameter_set( ++ dev->instance, ++ &dev->component[MMAL_COMPONENT_CAMERA]->control, ++ MMAL_PARAMETER_CAMERA_NUM, &i, ++ sizeof(i)); ++ } ++ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, ++ "Camera refcount now %d\n", dev->camera_use_count); ++ return 0; ++} ++ ++static void buffer_queue(struct vb2_buffer *vb) ++{ ++ struct bm2835_mmal_dev *dev = vb2_get_drv_priv(vb->vb2_queue); ++ struct vb2_v4l2_buffer *vb2 = to_vb2_v4l2_buffer(vb); ++ struct mmal_buffer *buf = container_of(vb2, struct mmal_buffer, vb); ++ int ret; ++ ++ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, ++ "%s: dev:%p buf:%p\n", __func__, dev, buf); ++ ++ buf->buffer = vb2_plane_vaddr(&buf->vb.vb2_buf, 0); ++ buf->buffer_size = vb2_plane_size(&buf->vb.vb2_buf, 0); ++ ++ ret = vchiq_mmal_submit_buffer(dev->instance, dev->capture.port, buf); ++ if (ret < 0) ++ v4l2_err(&dev->v4l2_dev, "%s: error submitting buffer\n", ++ __func__); ++} ++ ++static int start_streaming(struct vb2_queue *vq, unsigned int count) ++{ ++ struct bm2835_mmal_dev *dev = vb2_get_drv_priv(vq); ++ int ret; ++ int parameter_size; ++ ++ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, "%s: dev:%p\n", ++ __func__, dev); ++ ++ /* ensure a format has actually been set */ ++ if (dev->capture.port == NULL) ++ return -EINVAL; ++ ++ if (enable_camera(dev) < 0) { ++ v4l2_err(&dev->v4l2_dev, "Failed to enable camera\n"); ++ return -EINVAL; ++ } ++ ++ /*init_completion(&dev->capture.frame_cmplt); */ ++ ++ /* enable frame capture */ ++ dev->capture.frame_count = 1; ++ ++ /* if the preview is not already running, wait for a few frames for AGC ++ * to settle down. ++ */ ++ if (!dev->component[MMAL_COMPONENT_PREVIEW]->enabled) ++ msleep(300); ++ ++ /* enable the connection from camera to encoder (if applicable) */ ++ if (dev->capture.camera_port != dev->capture.port ++ && dev->capture.camera_port) { ++ ret = vchiq_mmal_port_enable(dev->instance, ++ dev->capture.camera_port, NULL); ++ if (ret) { ++ v4l2_err(&dev->v4l2_dev, ++ "Failed to enable encode tunnel - error %d\n", ++ ret); ++ return -1; ++ } ++ } ++ ++ /* Get VC timestamp at this point in time */ ++ parameter_size = sizeof(dev->capture.vc_start_timestamp); ++ if (vchiq_mmal_port_parameter_get(dev->instance, ++ dev->capture.camera_port, ++ MMAL_PARAMETER_SYSTEM_TIME, ++ &dev->capture.vc_start_timestamp, ++ &parameter_size)) { ++ v4l2_err(&dev->v4l2_dev, ++ "Failed to get VC start time - update your VC f/w\n"); ++ ++ /* Flag to indicate just to rely on kernel timestamps */ ++ dev->capture.vc_start_timestamp = -1; ++ } else ++ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, ++ "Start time %lld size %d\n", ++ dev->capture.vc_start_timestamp, parameter_size); ++ ++ v4l2_get_timestamp(&dev->capture.kernel_start_ts); ++ ++ /* enable the camera port */ ++ dev->capture.port->cb_ctx = dev; ++ ret = ++ vchiq_mmal_port_enable(dev->instance, dev->capture.port, buffer_cb); ++ if (ret) { ++ v4l2_err(&dev->v4l2_dev, ++ "Failed to enable capture port - error %d. " ++ "Disabling camera port again\n", ret); ++ ++ vchiq_mmal_port_disable(dev->instance, ++ dev->capture.camera_port); ++ if (disable_camera(dev) < 0) { ++ v4l2_err(&dev->v4l2_dev, "Failed to disable camera\n"); ++ return -EINVAL; ++ } ++ return -1; ++ } ++ ++ /* capture the first frame */ ++ vchiq_mmal_port_parameter_set(dev->instance, ++ dev->capture.camera_port, ++ MMAL_PARAMETER_CAPTURE, ++ &dev->capture.frame_count, ++ sizeof(dev->capture.frame_count)); ++ return 0; ++} ++ ++/* abort streaming and wait for last buffer */ ++static void stop_streaming(struct vb2_queue *vq) ++{ ++ int ret; ++ struct bm2835_mmal_dev *dev = vb2_get_drv_priv(vq); ++ ++ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, "%s: dev:%p\n", ++ __func__, dev); ++ ++ init_completion(&dev->capture.frame_cmplt); ++ dev->capture.frame_count = 0; ++ ++ /* ensure a format has actually been set */ ++ if (dev->capture.port == NULL) { ++ v4l2_err(&dev->v4l2_dev, ++ "no capture port - stream not started?\n"); ++ return; ++ } ++ ++ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, "stopping capturing\n"); ++ ++ /* stop capturing frames */ ++ vchiq_mmal_port_parameter_set(dev->instance, ++ dev->capture.camera_port, ++ MMAL_PARAMETER_CAPTURE, ++ &dev->capture.frame_count, ++ sizeof(dev->capture.frame_count)); ++ ++ /* wait for last frame to complete */ ++ ret = wait_for_completion_timeout(&dev->capture.frame_cmplt, HZ); ++ if (ret <= 0) ++ v4l2_err(&dev->v4l2_dev, ++ "error %d waiting for frame completion\n", ret); ++ ++ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, ++ "disabling connection\n"); ++ ++ /* disable the connection from camera to encoder */ ++ ret = vchiq_mmal_port_disable(dev->instance, dev->capture.camera_port); ++ if (!ret && dev->capture.camera_port != dev->capture.port) { ++ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, ++ "disabling port\n"); ++ ret = vchiq_mmal_port_disable(dev->instance, dev->capture.port); ++ } else if (dev->capture.camera_port != dev->capture.port) { ++ v4l2_err(&dev->v4l2_dev, "port_disable failed, error %d\n", ++ ret); ++ } ++ ++ if (disable_camera(dev) < 0) ++ v4l2_err(&dev->v4l2_dev, "Failed to disable camera\n"); ++} ++ ++static void bm2835_mmal_lock(struct vb2_queue *vq) ++{ ++ struct bm2835_mmal_dev *dev = vb2_get_drv_priv(vq); ++ mutex_lock(&dev->mutex); ++} ++ ++static void bm2835_mmal_unlock(struct vb2_queue *vq) ++{ ++ struct bm2835_mmal_dev *dev = vb2_get_drv_priv(vq); ++ mutex_unlock(&dev->mutex); ++} ++ ++static struct vb2_ops bm2835_mmal_video_qops = { ++ .queue_setup = queue_setup, ++ .buf_prepare = buffer_prepare, ++ .buf_queue = buffer_queue, ++ .start_streaming = start_streaming, ++ .stop_streaming = stop_streaming, ++ .wait_prepare = bm2835_mmal_unlock, ++ .wait_finish = bm2835_mmal_lock, ++}; ++ ++/* ------------------------------------------------------------------ ++ IOCTL operations ++ ------------------------------------------------------------------*/ ++ ++static int set_overlay_params(struct bm2835_mmal_dev *dev, ++ struct vchiq_mmal_port *port) ++{ ++ int ret; ++ struct mmal_parameter_displayregion prev_config = { ++ .set = MMAL_DISPLAY_SET_LAYER | MMAL_DISPLAY_SET_ALPHA | ++ MMAL_DISPLAY_SET_DEST_RECT | MMAL_DISPLAY_SET_FULLSCREEN, ++ .layer = PREVIEW_LAYER, ++ .alpha = dev->overlay.global_alpha, ++ .fullscreen = 0, ++ .dest_rect = { ++ .x = dev->overlay.w.left, ++ .y = dev->overlay.w.top, ++ .width = dev->overlay.w.width, ++ .height = dev->overlay.w.height, ++ }, ++ }; ++ ret = vchiq_mmal_port_parameter_set(dev->instance, port, ++ MMAL_PARAMETER_DISPLAYREGION, ++ &prev_config, sizeof(prev_config)); ++ ++ return ret; ++} ++ ++/* overlay ioctl */ ++static int vidioc_enum_fmt_vid_overlay(struct file *file, void *priv, ++ struct v4l2_fmtdesc *f) ++{ ++ struct mmal_fmt *fmt; ++ ++ if (f->index >= ARRAY_SIZE(formats)) ++ return -EINVAL; ++ ++ fmt = &formats[f->index]; ++ ++ strlcpy(f->description, fmt->name, sizeof(f->description)); ++ f->pixelformat = fmt->fourcc; ++ f->flags = fmt->flags; ++ ++ return 0; ++} ++ ++static int vidioc_g_fmt_vid_overlay(struct file *file, void *priv, ++ struct v4l2_format *f) ++{ ++ struct bm2835_mmal_dev *dev = video_drvdata(file); ++ ++ f->fmt.win = dev->overlay; ++ ++ return 0; ++} ++ ++static int vidioc_try_fmt_vid_overlay(struct file *file, void *priv, ++ struct v4l2_format *f) ++{ ++ struct bm2835_mmal_dev *dev = video_drvdata(file); ++ ++ f->fmt.win.field = V4L2_FIELD_NONE; ++ f->fmt.win.chromakey = 0; ++ f->fmt.win.clips = NULL; ++ f->fmt.win.clipcount = 0; ++ f->fmt.win.bitmap = NULL; ++ ++ v4l_bound_align_image(&f->fmt.win.w.width, MIN_WIDTH, dev->max_width, 1, ++ &f->fmt.win.w.height, MIN_HEIGHT, dev->max_height, ++ 1, 0); ++ v4l_bound_align_image(&f->fmt.win.w.left, MIN_WIDTH, dev->max_width, 1, ++ &f->fmt.win.w.top, MIN_HEIGHT, dev->max_height, ++ 1, 0); ++ ++ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, ++ "Overlay: Now w/h %dx%d l/t %dx%d\n", ++ f->fmt.win.w.width, f->fmt.win.w.height, ++ f->fmt.win.w.left, f->fmt.win.w.top); ++ ++ v4l2_dump_win_format(1, ++ bcm2835_v4l2_debug, ++ &dev->v4l2_dev, ++ &f->fmt.win, ++ __func__); ++ return 0; ++} ++ ++static int vidioc_s_fmt_vid_overlay(struct file *file, void *priv, ++ struct v4l2_format *f) ++{ ++ struct bm2835_mmal_dev *dev = video_drvdata(file); ++ ++ vidioc_try_fmt_vid_overlay(file, priv, f); ++ ++ dev->overlay = f->fmt.win; ++ if (dev->component[MMAL_COMPONENT_PREVIEW]->enabled) { ++ set_overlay_params(dev, ++ &dev->component[MMAL_COMPONENT_PREVIEW]->input[0]); ++ } ++ ++ return 0; ++} ++ ++static int vidioc_overlay(struct file *file, void *f, unsigned int on) ++{ ++ int ret; ++ struct bm2835_mmal_dev *dev = video_drvdata(file); ++ struct vchiq_mmal_port *src; ++ struct vchiq_mmal_port *dst; ++ if ((on && dev->component[MMAL_COMPONENT_PREVIEW]->enabled) || ++ (!on && !dev->component[MMAL_COMPONENT_PREVIEW]->enabled)) ++ return 0; /* already in requested state */ ++ ++ src = ++ &dev->component[MMAL_COMPONENT_CAMERA]-> ++ output[MMAL_CAMERA_PORT_PREVIEW]; ++ ++ if (!on) { ++ /* disconnect preview ports and disable component */ ++ ret = vchiq_mmal_port_disable(dev->instance, src); ++ if (!ret) ++ ret = ++ vchiq_mmal_port_connect_tunnel(dev->instance, src, ++ NULL); ++ if (ret >= 0) ++ ret = vchiq_mmal_component_disable( ++ dev->instance, ++ dev->component[MMAL_COMPONENT_PREVIEW]); ++ ++ disable_camera(dev); ++ return ret; ++ } ++ ++ /* set preview port format and connect it to output */ ++ dst = &dev->component[MMAL_COMPONENT_PREVIEW]->input[0]; ++ ++ ret = vchiq_mmal_port_set_format(dev->instance, src); ++ if (ret < 0) ++ goto error; ++ ++ ret = set_overlay_params(dev, dst); ++ if (ret < 0) ++ goto error; ++ ++ if (enable_camera(dev) < 0) ++ goto error; ++ ++ ret = vchiq_mmal_component_enable( ++ dev->instance, ++ dev->component[MMAL_COMPONENT_PREVIEW]); ++ if (ret < 0) ++ goto error; ++ ++ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, "connecting %p to %p\n", ++ src, dst); ++ ret = vchiq_mmal_port_connect_tunnel(dev->instance, src, dst); ++ if (!ret) ++ ret = vchiq_mmal_port_enable(dev->instance, src, NULL); ++error: ++ return ret; ++} ++ ++static int vidioc_g_fbuf(struct file *file, void *fh, ++ struct v4l2_framebuffer *a) ++{ ++ /* The video overlay must stay within the framebuffer and can't be ++ positioned independently. */ ++ struct bm2835_mmal_dev *dev = video_drvdata(file); ++ struct vchiq_mmal_port *preview_port = ++ &dev->component[MMAL_COMPONENT_CAMERA]-> ++ output[MMAL_CAMERA_PORT_PREVIEW]; ++ ++ a->capability = V4L2_FBUF_CAP_EXTERNOVERLAY | ++ V4L2_FBUF_CAP_GLOBAL_ALPHA; ++ a->flags = V4L2_FBUF_FLAG_OVERLAY; ++ a->fmt.width = preview_port->es.video.width; ++ a->fmt.height = preview_port->es.video.height; ++ a->fmt.pixelformat = V4L2_PIX_FMT_YUV420; ++ a->fmt.bytesperline = preview_port->es.video.width; ++ a->fmt.sizeimage = (preview_port->es.video.width * ++ preview_port->es.video.height * 3)>>1; ++ a->fmt.colorspace = V4L2_COLORSPACE_SMPTE170M; ++ ++ return 0; ++} ++ ++/* input ioctls */ ++static int vidioc_enum_input(struct file *file, void *priv, ++ struct v4l2_input *inp) ++{ ++ /* only a single camera input */ ++ if (inp->index != 0) ++ return -EINVAL; ++ ++ inp->type = V4L2_INPUT_TYPE_CAMERA; ++ sprintf(inp->name, "Camera %u", inp->index); ++ return 0; ++} ++ ++static int vidioc_g_input(struct file *file, void *priv, unsigned int *i) ++{ ++ *i = 0; ++ return 0; ++} ++ ++static int vidioc_s_input(struct file *file, void *priv, unsigned int i) ++{ ++ if (i != 0) ++ return -EINVAL; ++ ++ return 0; ++} ++ ++/* capture ioctls */ ++static int vidioc_querycap(struct file *file, void *priv, ++ struct v4l2_capability *cap) ++{ ++ struct bm2835_mmal_dev *dev = video_drvdata(file); ++ u32 major; ++ u32 minor; ++ ++ vchiq_mmal_version(dev->instance, &major, &minor); ++ ++ strcpy(cap->driver, "bm2835 mmal"); ++ snprintf(cap->card, sizeof(cap->card), "mmal service %d.%d", ++ major, minor); ++ ++ snprintf(cap->bus_info, sizeof(cap->bus_info), ++ "platform:%s", dev->v4l2_dev.name); ++ cap->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_VIDEO_OVERLAY | ++ V4L2_CAP_STREAMING | V4L2_CAP_READWRITE; ++ cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS; ++ ++ return 0; ++} ++ ++static int vidioc_enum_fmt_vid_cap(struct file *file, void *priv, ++ struct v4l2_fmtdesc *f) ++{ ++ struct mmal_fmt *fmt; ++ ++ if (f->index >= ARRAY_SIZE(formats)) ++ return -EINVAL; ++ ++ fmt = &formats[f->index]; ++ ++ strlcpy(f->description, fmt->name, sizeof(f->description)); ++ f->pixelformat = fmt->fourcc; ++ f->flags = fmt->flags; ++ ++ return 0; ++} ++ ++static int vidioc_g_fmt_vid_cap(struct file *file, void *priv, ++ struct v4l2_format *f) ++{ ++ struct bm2835_mmal_dev *dev = video_drvdata(file); ++ ++ f->fmt.pix.width = dev->capture.width; ++ f->fmt.pix.height = dev->capture.height; ++ f->fmt.pix.field = V4L2_FIELD_NONE; ++ f->fmt.pix.pixelformat = dev->capture.fmt->fourcc; ++ f->fmt.pix.bytesperline = dev->capture.stride; ++ f->fmt.pix.sizeimage = dev->capture.buffersize; ++ ++ if (dev->capture.fmt->fourcc == V4L2_PIX_FMT_RGB24) ++ f->fmt.pix.colorspace = V4L2_COLORSPACE_SRGB; ++ else if (dev->capture.fmt->fourcc == V4L2_PIX_FMT_JPEG) ++ f->fmt.pix.colorspace = V4L2_COLORSPACE_JPEG; ++ else ++ f->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M; ++ f->fmt.pix.priv = 0; ++ ++ v4l2_dump_pix_format(1, bcm2835_v4l2_debug, &dev->v4l2_dev, &f->fmt.pix, ++ __func__); ++ return 0; ++} ++ ++static int vidioc_try_fmt_vid_cap(struct file *file, void *priv, ++ struct v4l2_format *f) ++{ ++ struct bm2835_mmal_dev *dev = video_drvdata(file); ++ struct mmal_fmt *mfmt; ++ ++ mfmt = get_format(f); ++ if (!mfmt) { ++ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, ++ "Fourcc format (0x%08x) unknown.\n", ++ f->fmt.pix.pixelformat); ++ f->fmt.pix.pixelformat = formats[0].fourcc; ++ mfmt = get_format(f); ++ } ++ ++ f->fmt.pix.field = V4L2_FIELD_NONE; ++ ++ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, ++ "Clipping/aligning %dx%d format %08X\n", ++ f->fmt.pix.width, f->fmt.pix.height, f->fmt.pix.pixelformat); ++ ++ v4l_bound_align_image(&f->fmt.pix.width, MIN_WIDTH, dev->max_width, 1, ++ &f->fmt.pix.height, MIN_HEIGHT, dev->max_height, ++ 1, 0); ++ f->fmt.pix.bytesperline = f->fmt.pix.width * mfmt->ybbp; ++ ++ /* Image buffer has to be padded to allow for alignment, even though ++ * we then remove that padding before delivering the buffer. ++ */ ++ f->fmt.pix.sizeimage = ((f->fmt.pix.height+15)&~15) * ++ (((f->fmt.pix.width+31)&~31) * mfmt->depth) >> 3; ++ ++ if ((mfmt->flags & V4L2_FMT_FLAG_COMPRESSED) && ++ f->fmt.pix.sizeimage < MIN_BUFFER_SIZE) ++ f->fmt.pix.sizeimage = MIN_BUFFER_SIZE; ++ ++ if (f->fmt.pix.pixelformat == V4L2_PIX_FMT_RGB24) ++ f->fmt.pix.colorspace = V4L2_COLORSPACE_SRGB; ++ else if (f->fmt.pix.pixelformat == V4L2_PIX_FMT_JPEG) ++ f->fmt.pix.colorspace = V4L2_COLORSPACE_JPEG; ++ else ++ f->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M; ++ f->fmt.pix.priv = 0; ++ ++ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, ++ "Now %dx%d format %08X\n", ++ f->fmt.pix.width, f->fmt.pix.height, f->fmt.pix.pixelformat); ++ ++ v4l2_dump_pix_format(1, bcm2835_v4l2_debug, &dev->v4l2_dev, &f->fmt.pix, ++ __func__); ++ return 0; ++} ++ ++static int mmal_setup_components(struct bm2835_mmal_dev *dev, ++ struct v4l2_format *f) ++{ ++ int ret; ++ struct vchiq_mmal_port *port = NULL, *camera_port = NULL; ++ struct vchiq_mmal_component *encode_component = NULL; ++ struct mmal_fmt *mfmt = get_format(f); ++ ++ BUG_ON(!mfmt); ++ ++ if (dev->capture.encode_component) { ++ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, ++ "vid_cap - disconnect previous tunnel\n"); ++ ++ /* Disconnect any previous connection */ ++ vchiq_mmal_port_connect_tunnel(dev->instance, ++ dev->capture.camera_port, NULL); ++ dev->capture.camera_port = NULL; ++ ret = vchiq_mmal_component_disable(dev->instance, ++ dev->capture. ++ encode_component); ++ if (ret) ++ v4l2_err(&dev->v4l2_dev, ++ "Failed to disable encode component %d\n", ++ ret); ++ ++ dev->capture.encode_component = NULL; ++ } ++ /* format dependant port setup */ ++ switch (mfmt->mmal_component) { ++ case MMAL_COMPONENT_CAMERA: ++ /* Make a further decision on port based on resolution */ ++ if (f->fmt.pix.width <= max_video_width ++ && f->fmt.pix.height <= max_video_height) ++ camera_port = port = ++ &dev->component[MMAL_COMPONENT_CAMERA]-> ++ output[MMAL_CAMERA_PORT_VIDEO]; ++ else ++ camera_port = port = ++ &dev->component[MMAL_COMPONENT_CAMERA]-> ++ output[MMAL_CAMERA_PORT_CAPTURE]; ++ break; ++ case MMAL_COMPONENT_IMAGE_ENCODE: ++ encode_component = dev->component[MMAL_COMPONENT_IMAGE_ENCODE]; ++ port = &dev->component[MMAL_COMPONENT_IMAGE_ENCODE]->output[0]; ++ camera_port = ++ &dev->component[MMAL_COMPONENT_CAMERA]-> ++ output[MMAL_CAMERA_PORT_CAPTURE]; ++ break; ++ case MMAL_COMPONENT_VIDEO_ENCODE: ++ encode_component = dev->component[MMAL_COMPONENT_VIDEO_ENCODE]; ++ port = &dev->component[MMAL_COMPONENT_VIDEO_ENCODE]->output[0]; ++ camera_port = ++ &dev->component[MMAL_COMPONENT_CAMERA]-> ++ output[MMAL_CAMERA_PORT_VIDEO]; ++ break; ++ default: ++ break; ++ } ++ ++ if (!port) ++ return -EINVAL; ++ ++ if (encode_component) ++ camera_port->format.encoding = MMAL_ENCODING_OPAQUE; ++ else ++ camera_port->format.encoding = mfmt->mmal; ++ ++ camera_port->format.encoding_variant = 0; ++ camera_port->es.video.width = f->fmt.pix.width; ++ camera_port->es.video.height = f->fmt.pix.height; ++ camera_port->es.video.crop.x = 0; ++ camera_port->es.video.crop.y = 0; ++ camera_port->es.video.crop.width = f->fmt.pix.width; ++ camera_port->es.video.crop.height = f->fmt.pix.height; ++ camera_port->es.video.frame_rate.num = 0; ++ camera_port->es.video.frame_rate.den = 1; ++ camera_port->es.video.color_space = MMAL_COLOR_SPACE_JPEG_JFIF; ++ ++ ret = vchiq_mmal_port_set_format(dev->instance, camera_port); ++ ++ if (!ret ++ && camera_port == ++ &dev->component[MMAL_COMPONENT_CAMERA]-> ++ output[MMAL_CAMERA_PORT_VIDEO]) { ++ bool overlay_enabled = ++ !!dev->component[MMAL_COMPONENT_PREVIEW]->enabled; ++ struct vchiq_mmal_port *preview_port = ++ &dev->component[MMAL_COMPONENT_CAMERA]-> ++ output[MMAL_CAMERA_PORT_PREVIEW]; ++ /* Preview and encode ports need to match on resolution */ ++ if (overlay_enabled) { ++ /* Need to disable the overlay before we can update ++ * the resolution ++ */ ++ ret = ++ vchiq_mmal_port_disable(dev->instance, ++ preview_port); ++ if (!ret) ++ ret = ++ vchiq_mmal_port_connect_tunnel( ++ dev->instance, ++ preview_port, ++ NULL); ++ } ++ preview_port->es.video.width = f->fmt.pix.width; ++ preview_port->es.video.height = f->fmt.pix.height; ++ preview_port->es.video.crop.x = 0; ++ preview_port->es.video.crop.y = 0; ++ preview_port->es.video.crop.width = f->fmt.pix.width; ++ preview_port->es.video.crop.height = f->fmt.pix.height; ++ preview_port->es.video.frame_rate.num = ++ dev->capture.timeperframe.denominator; ++ preview_port->es.video.frame_rate.den = ++ dev->capture.timeperframe.numerator; ++ ret = vchiq_mmal_port_set_format(dev->instance, preview_port); ++ if (overlay_enabled) { ++ ret = vchiq_mmal_port_connect_tunnel( ++ dev->instance, ++ preview_port, ++ &dev->component[MMAL_COMPONENT_PREVIEW]->input[0]); ++ if (!ret) ++ ret = vchiq_mmal_port_enable(dev->instance, ++ preview_port, ++ NULL); ++ } ++ } ++ ++ if (ret) { ++ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, ++ "%s failed to set format %dx%d %08X\n", __func__, ++ f->fmt.pix.width, f->fmt.pix.height, ++ f->fmt.pix.pixelformat); ++ /* ensure capture is not going to be tried */ ++ dev->capture.port = NULL; ++ } else { ++ if (encode_component) { ++ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, ++ "vid_cap - set up encode comp\n"); ++ ++ /* configure buffering */ ++ camera_port->current_buffer.size = ++ camera_port->recommended_buffer.size; ++ camera_port->current_buffer.num = ++ camera_port->recommended_buffer.num; ++ ++ ret = ++ vchiq_mmal_port_connect_tunnel( ++ dev->instance, ++ camera_port, ++ &encode_component->input[0]); ++ if (ret) { ++ v4l2_dbg(1, bcm2835_v4l2_debug, ++ &dev->v4l2_dev, ++ "%s failed to create connection\n", ++ __func__); ++ /* ensure capture is not going to be tried */ ++ dev->capture.port = NULL; ++ } else { ++ port->es.video.width = f->fmt.pix.width; ++ port->es.video.height = f->fmt.pix.height; ++ port->es.video.crop.x = 0; ++ port->es.video.crop.y = 0; ++ port->es.video.crop.width = f->fmt.pix.width; ++ port->es.video.crop.height = f->fmt.pix.height; ++ port->es.video.frame_rate.num = ++ dev->capture.timeperframe.denominator; ++ port->es.video.frame_rate.den = ++ dev->capture.timeperframe.numerator; ++ ++ port->format.encoding = mfmt->mmal; ++ port->format.encoding_variant = 0; ++ /* Set any encoding specific parameters */ ++ switch (mfmt->mmal_component) { ++ case MMAL_COMPONENT_VIDEO_ENCODE: ++ port->format.bitrate = ++ dev->capture.encode_bitrate; ++ break; ++ case MMAL_COMPONENT_IMAGE_ENCODE: ++ /* Could set EXIF parameters here */ ++ break; ++ default: ++ break; ++ } ++ ret = vchiq_mmal_port_set_format(dev->instance, ++ port); ++ if (ret) ++ v4l2_dbg(1, bcm2835_v4l2_debug, ++ &dev->v4l2_dev, ++ "%s failed to set format %dx%d fmt %08X\n", ++ __func__, ++ f->fmt.pix.width, ++ f->fmt.pix.height, ++ f->fmt.pix.pixelformat ++ ); ++ } ++ ++ if (!ret) { ++ ret = vchiq_mmal_component_enable( ++ dev->instance, ++ encode_component); ++ if (ret) { ++ v4l2_dbg(1, bcm2835_v4l2_debug, ++ &dev->v4l2_dev, ++ "%s Failed to enable encode components\n", ++ __func__); ++ } ++ } ++ if (!ret) { ++ /* configure buffering */ ++ port->current_buffer.num = 1; ++ port->current_buffer.size = ++ f->fmt.pix.sizeimage; ++ if (port->format.encoding == ++ MMAL_ENCODING_JPEG) { ++ v4l2_dbg(1, bcm2835_v4l2_debug, ++ &dev->v4l2_dev, ++ "JPG - buf size now %d was %d\n", ++ f->fmt.pix.sizeimage, ++ port->current_buffer.size); ++ port->current_buffer.size = ++ (f->fmt.pix.sizeimage < ++ (100 << 10)) ++ ? (100 << 10) : f->fmt.pix. ++ sizeimage; ++ } ++ v4l2_dbg(1, bcm2835_v4l2_debug, ++ &dev->v4l2_dev, ++ "vid_cap - cur_buf.size set to %d\n", ++ f->fmt.pix.sizeimage); ++ port->current_buffer.alignment = 0; ++ } ++ } else { ++ /* configure buffering */ ++ camera_port->current_buffer.num = 1; ++ camera_port->current_buffer.size = f->fmt.pix.sizeimage; ++ camera_port->current_buffer.alignment = 0; ++ } ++ ++ if (!ret) { ++ dev->capture.fmt = mfmt; ++ dev->capture.stride = f->fmt.pix.bytesperline; ++ dev->capture.width = camera_port->es.video.crop.width; ++ dev->capture.height = camera_port->es.video.crop.height; ++ dev->capture.buffersize = port->current_buffer.size; ++ ++ /* select port for capture */ ++ dev->capture.port = port; ++ dev->capture.camera_port = camera_port; ++ dev->capture.encode_component = encode_component; ++ v4l2_dbg(1, bcm2835_v4l2_debug, ++ &dev->v4l2_dev, ++ "Set dev->capture.fmt %08X, %dx%d, stride %d, size %d", ++ port->format.encoding, ++ dev->capture.width, dev->capture.height, ++ dev->capture.stride, dev->capture.buffersize); ++ } ++ } ++ ++ /* todo: Need to convert the vchiq/mmal error into a v4l2 error. */ ++ return ret; ++} ++ ++static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, ++ struct v4l2_format *f) ++{ ++ int ret; ++ struct bm2835_mmal_dev *dev = video_drvdata(file); ++ struct mmal_fmt *mfmt; ++ ++ /* try the format to set valid parameters */ ++ ret = vidioc_try_fmt_vid_cap(file, priv, f); ++ if (ret) { ++ v4l2_err(&dev->v4l2_dev, ++ "vid_cap - vidioc_try_fmt_vid_cap failed\n"); ++ return ret; ++ } ++ ++ /* if a capture is running refuse to set format */ ++ if (vb2_is_busy(&dev->capture.vb_vidq)) { ++ v4l2_info(&dev->v4l2_dev, "%s device busy\n", __func__); ++ return -EBUSY; ++ } ++ ++ /* If the format is unsupported v4l2 says we should switch to ++ * a supported one and not return an error. */ ++ mfmt = get_format(f); ++ if (!mfmt) { ++ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, ++ "Fourcc format (0x%08x) unknown.\n", ++ f->fmt.pix.pixelformat); ++ f->fmt.pix.pixelformat = formats[0].fourcc; ++ mfmt = get_format(f); ++ } ++ ++ ret = mmal_setup_components(dev, f); ++ if (ret != 0) { ++ v4l2_err(&dev->v4l2_dev, ++ "%s: failed to setup mmal components: %d\n", ++ __func__, ret); ++ ret = -EINVAL; ++ } ++ ++ return ret; ++} ++ ++int vidioc_enum_framesizes(struct file *file, void *fh, ++ struct v4l2_frmsizeenum *fsize) ++{ ++ struct bm2835_mmal_dev *dev = video_drvdata(file); ++ static const struct v4l2_frmsize_stepwise sizes = { ++ MIN_WIDTH, 0, 2, ++ MIN_HEIGHT, 0, 2 ++ }; ++ int i; ++ ++ if (fsize->index) ++ return -EINVAL; ++ for (i = 0; i < ARRAY_SIZE(formats); i++) ++ if (formats[i].fourcc == fsize->pixel_format) ++ break; ++ if (i == ARRAY_SIZE(formats)) ++ return -EINVAL; ++ fsize->type = V4L2_FRMSIZE_TYPE_STEPWISE; ++ fsize->stepwise = sizes; ++ fsize->stepwise.max_width = dev->max_width; ++ fsize->stepwise.max_height = dev->max_height; ++ return 0; ++} ++ ++/* timeperframe is arbitrary and continous */ ++static int vidioc_enum_frameintervals(struct file *file, void *priv, ++ struct v4l2_frmivalenum *fival) ++{ ++ struct bm2835_mmal_dev *dev = video_drvdata(file); ++ int i; ++ ++ if (fival->index) ++ return -EINVAL; ++ ++ for (i = 0; i < ARRAY_SIZE(formats); i++) ++ if (formats[i].fourcc == fival->pixel_format) ++ break; ++ if (i == ARRAY_SIZE(formats)) ++ return -EINVAL; ++ ++ /* regarding width & height - we support any within range */ ++ if (fival->width < MIN_WIDTH || fival->width > dev->max_width || ++ fival->height < MIN_HEIGHT || fival->height > dev->max_height) ++ return -EINVAL; ++ ++ fival->type = V4L2_FRMIVAL_TYPE_CONTINUOUS; ++ ++ /* fill in stepwise (step=1.0 is requred by V4L2 spec) */ ++ fival->stepwise.min = tpf_min; ++ fival->stepwise.max = tpf_max; ++ fival->stepwise.step = (struct v4l2_fract) {1, 1}; ++ ++ return 0; ++} ++ ++static int vidioc_g_parm(struct file *file, void *priv, ++ struct v4l2_streamparm *parm) ++{ ++ struct bm2835_mmal_dev *dev = video_drvdata(file); ++ ++ if (parm->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) ++ return -EINVAL; ++ ++ parm->parm.capture.capability = V4L2_CAP_TIMEPERFRAME; ++ parm->parm.capture.timeperframe = dev->capture.timeperframe; ++ parm->parm.capture.readbuffers = 1; ++ return 0; ++} ++ ++#define FRACT_CMP(a, OP, b) \ ++ ((u64)(a).numerator * (b).denominator OP \ ++ (u64)(b).numerator * (a).denominator) ++ ++static int vidioc_s_parm(struct file *file, void *priv, ++ struct v4l2_streamparm *parm) ++{ ++ struct bm2835_mmal_dev *dev = video_drvdata(file); ++ struct v4l2_fract tpf; ++ struct mmal_parameter_rational fps_param; ++ ++ if (parm->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) ++ return -EINVAL; ++ ++ tpf = parm->parm.capture.timeperframe; ++ ++ /* tpf: {*, 0} resets timing; clip to [min, max]*/ ++ tpf = tpf.denominator ? tpf : tpf_default; ++ tpf = FRACT_CMP(tpf, <, tpf_min) ? tpf_min : tpf; ++ tpf = FRACT_CMP(tpf, >, tpf_max) ? tpf_max : tpf; ++ ++ dev->capture.timeperframe = tpf; ++ parm->parm.capture.timeperframe = tpf; ++ parm->parm.capture.readbuffers = 1; ++ ++ fps_param.num = 0; /* Select variable fps, and then use ++ * FPS_RANGE to select the actual limits. ++ */ ++ fps_param.den = 1; ++ set_framerate_params(dev); ++ ++ return 0; ++} ++ ++static const struct v4l2_ioctl_ops camera0_ioctl_ops = { ++ /* overlay */ ++ .vidioc_enum_fmt_vid_overlay = vidioc_enum_fmt_vid_overlay, ++ .vidioc_g_fmt_vid_overlay = vidioc_g_fmt_vid_overlay, ++ .vidioc_try_fmt_vid_overlay = vidioc_try_fmt_vid_overlay, ++ .vidioc_s_fmt_vid_overlay = vidioc_s_fmt_vid_overlay, ++ .vidioc_overlay = vidioc_overlay, ++ .vidioc_g_fbuf = vidioc_g_fbuf, ++ ++ /* inputs */ ++ .vidioc_enum_input = vidioc_enum_input, ++ .vidioc_g_input = vidioc_g_input, ++ .vidioc_s_input = vidioc_s_input, ++ ++ /* capture */ ++ .vidioc_querycap = vidioc_querycap, ++ .vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap, ++ .vidioc_g_fmt_vid_cap = vidioc_g_fmt_vid_cap, ++ .vidioc_try_fmt_vid_cap = vidioc_try_fmt_vid_cap, ++ .vidioc_s_fmt_vid_cap = vidioc_s_fmt_vid_cap, ++ ++ /* buffer management */ ++ .vidioc_reqbufs = vb2_ioctl_reqbufs, ++ .vidioc_create_bufs = vb2_ioctl_create_bufs, ++ .vidioc_prepare_buf = vb2_ioctl_prepare_buf, ++ .vidioc_querybuf = vb2_ioctl_querybuf, ++ .vidioc_qbuf = vb2_ioctl_qbuf, ++ .vidioc_dqbuf = vb2_ioctl_dqbuf, ++ .vidioc_enum_framesizes = vidioc_enum_framesizes, ++ .vidioc_enum_frameintervals = vidioc_enum_frameintervals, ++ .vidioc_g_parm = vidioc_g_parm, ++ .vidioc_s_parm = vidioc_s_parm, ++ .vidioc_streamon = vb2_ioctl_streamon, ++ .vidioc_streamoff = vb2_ioctl_streamoff, ++ ++ .vidioc_log_status = v4l2_ctrl_log_status, ++ .vidioc_subscribe_event = v4l2_ctrl_subscribe_event, ++ .vidioc_unsubscribe_event = v4l2_event_unsubscribe, ++}; ++ ++static const struct v4l2_ioctl_ops camera0_ioctl_ops_gstreamer = { ++ /* overlay */ ++ .vidioc_enum_fmt_vid_overlay = vidioc_enum_fmt_vid_overlay, ++ .vidioc_g_fmt_vid_overlay = vidioc_g_fmt_vid_overlay, ++ .vidioc_try_fmt_vid_overlay = vidioc_try_fmt_vid_overlay, ++ .vidioc_s_fmt_vid_overlay = vidioc_s_fmt_vid_overlay, ++ .vidioc_overlay = vidioc_overlay, ++ .vidioc_g_fbuf = vidioc_g_fbuf, ++ ++ /* inputs */ ++ .vidioc_enum_input = vidioc_enum_input, ++ .vidioc_g_input = vidioc_g_input, ++ .vidioc_s_input = vidioc_s_input, ++ ++ /* capture */ ++ .vidioc_querycap = vidioc_querycap, ++ .vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap, ++ .vidioc_g_fmt_vid_cap = vidioc_g_fmt_vid_cap, ++ .vidioc_try_fmt_vid_cap = vidioc_try_fmt_vid_cap, ++ .vidioc_s_fmt_vid_cap = vidioc_s_fmt_vid_cap, ++ ++ /* buffer management */ ++ .vidioc_reqbufs = vb2_ioctl_reqbufs, ++ .vidioc_create_bufs = vb2_ioctl_create_bufs, ++ .vidioc_prepare_buf = vb2_ioctl_prepare_buf, ++ .vidioc_querybuf = vb2_ioctl_querybuf, ++ .vidioc_qbuf = vb2_ioctl_qbuf, ++ .vidioc_dqbuf = vb2_ioctl_dqbuf, ++ /* Remove this function ptr to fix gstreamer bug ++ .vidioc_enum_framesizes = vidioc_enum_framesizes, */ ++ .vidioc_enum_frameintervals = vidioc_enum_frameintervals, ++ .vidioc_g_parm = vidioc_g_parm, ++ .vidioc_s_parm = vidioc_s_parm, ++ .vidioc_streamon = vb2_ioctl_streamon, ++ .vidioc_streamoff = vb2_ioctl_streamoff, ++ ++ .vidioc_log_status = v4l2_ctrl_log_status, ++ .vidioc_subscribe_event = v4l2_ctrl_subscribe_event, ++ .vidioc_unsubscribe_event = v4l2_event_unsubscribe, ++}; ++ ++/* ------------------------------------------------------------------ ++ Driver init/finalise ++ ------------------------------------------------------------------*/ ++ ++static const struct v4l2_file_operations camera0_fops = { ++ .owner = THIS_MODULE, ++ .open = v4l2_fh_open, ++ .release = vb2_fop_release, ++ .read = vb2_fop_read, ++ .poll = vb2_fop_poll, ++ .unlocked_ioctl = video_ioctl2, /* V4L2 ioctl handler */ ++ .mmap = vb2_fop_mmap, ++}; ++ ++static struct video_device vdev_template = { ++ .name = "camera0", ++ .fops = &camera0_fops, ++ .ioctl_ops = &camera0_ioctl_ops, ++ .release = video_device_release_empty, ++}; ++ ++/* Returns the number of cameras, and also the max resolution supported ++ * by those cameras. ++ */ ++static int get_num_cameras(struct vchiq_mmal_instance *instance, ++ unsigned int resolutions[][2], int num_resolutions) ++{ ++ int ret; ++ struct vchiq_mmal_component *cam_info_component; ++ struct mmal_parameter_camera_info_t cam_info = {0}; ++ int param_size = sizeof(cam_info); ++ int i; ++ ++ /* create a camera_info component */ ++ ret = vchiq_mmal_component_init(instance, "camera_info", ++ &cam_info_component); ++ if (ret < 0) ++ /* Unusual failure - let's guess one camera. */ ++ return 1; ++ ++ if (vchiq_mmal_port_parameter_get(instance, ++ &cam_info_component->control, ++ MMAL_PARAMETER_CAMERA_INFO, ++ &cam_info, ++ &param_size)) { ++ pr_info("Failed to get camera info\n"); ++ } ++ for (i = 0; ++ i < (cam_info.num_cameras > num_resolutions ? ++ num_resolutions : ++ cam_info.num_cameras); ++ i++) { ++ resolutions[i][0] = cam_info.cameras[i].max_width; ++ resolutions[i][1] = cam_info.cameras[i].max_height; ++ } ++ ++ vchiq_mmal_component_finalise(instance, ++ cam_info_component); ++ ++ return cam_info.num_cameras; ++} ++ ++static int set_camera_parameters(struct vchiq_mmal_instance *instance, ++ struct vchiq_mmal_component *camera, ++ struct bm2835_mmal_dev *dev) ++{ ++ int ret; ++ struct mmal_parameter_camera_config cam_config = { ++ .max_stills_w = dev->max_width, ++ .max_stills_h = dev->max_height, ++ .stills_yuv422 = 1, ++ .one_shot_stills = 1, ++ .max_preview_video_w = (max_video_width > 1920) ? ++ max_video_width : 1920, ++ .max_preview_video_h = (max_video_height > 1088) ? ++ max_video_height : 1088, ++ .num_preview_video_frames = 3, ++ .stills_capture_circular_buffer_height = 0, ++ .fast_preview_resume = 0, ++ .use_stc_timestamp = MMAL_PARAM_TIMESTAMP_MODE_RAW_STC ++ }; ++ ++ ret = vchiq_mmal_port_parameter_set(instance, &camera->control, ++ MMAL_PARAMETER_CAMERA_CONFIG, ++ &cam_config, sizeof(cam_config)); ++ return ret; ++} ++ ++/* MMAL instance and component init */ ++static int __init mmal_init(struct bm2835_mmal_dev *dev) ++{ ++ int ret; ++ struct mmal_es_format *format; ++ u32 bool_true = 1; ++ ++ ret = vchiq_mmal_init(&dev->instance); ++ if (ret < 0) ++ return ret; ++ ++ /* get the camera component ready */ ++ ret = vchiq_mmal_component_init(dev->instance, "ril.camera", ++ &dev->component[MMAL_COMPONENT_CAMERA]); ++ if (ret < 0) ++ goto unreg_mmal; ++ ++ if (dev->component[MMAL_COMPONENT_CAMERA]->outputs < ++ MMAL_CAMERA_PORT_COUNT) { ++ ret = -EINVAL; ++ goto unreg_camera; ++ } ++ ++ ret = set_camera_parameters(dev->instance, ++ dev->component[MMAL_COMPONENT_CAMERA], ++ dev); ++ if (ret < 0) ++ goto unreg_camera; ++ ++ format = ++ &dev->component[MMAL_COMPONENT_CAMERA]-> ++ output[MMAL_CAMERA_PORT_PREVIEW].format; ++ ++ format->encoding = MMAL_ENCODING_OPAQUE; ++ format->encoding_variant = MMAL_ENCODING_I420; ++ ++ format->es->video.width = 1024; ++ format->es->video.height = 768; ++ format->es->video.crop.x = 0; ++ format->es->video.crop.y = 0; ++ format->es->video.crop.width = 1024; ++ format->es->video.crop.height = 768; ++ format->es->video.frame_rate.num = 0; /* Rely on fps_range */ ++ format->es->video.frame_rate.den = 1; ++ ++ format = ++ &dev->component[MMAL_COMPONENT_CAMERA]-> ++ output[MMAL_CAMERA_PORT_VIDEO].format; ++ ++ format->encoding = MMAL_ENCODING_OPAQUE; ++ format->encoding_variant = MMAL_ENCODING_I420; ++ ++ format->es->video.width = 1024; ++ format->es->video.height = 768; ++ format->es->video.crop.x = 0; ++ format->es->video.crop.y = 0; ++ format->es->video.crop.width = 1024; ++ format->es->video.crop.height = 768; ++ format->es->video.frame_rate.num = 0; /* Rely on fps_range */ ++ format->es->video.frame_rate.den = 1; ++ ++ vchiq_mmal_port_parameter_set(dev->instance, ++ &dev->component[MMAL_COMPONENT_CAMERA]-> ++ output[MMAL_CAMERA_PORT_VIDEO], ++ MMAL_PARAMETER_NO_IMAGE_PADDING, ++ &bool_true, sizeof(bool_true)); ++ ++ format = ++ &dev->component[MMAL_COMPONENT_CAMERA]-> ++ output[MMAL_CAMERA_PORT_CAPTURE].format; ++ ++ format->encoding = MMAL_ENCODING_OPAQUE; ++ ++ format->es->video.width = 2592; ++ format->es->video.height = 1944; ++ format->es->video.crop.x = 0; ++ format->es->video.crop.y = 0; ++ format->es->video.crop.width = 2592; ++ format->es->video.crop.height = 1944; ++ format->es->video.frame_rate.num = 0; /* Rely on fps_range */ ++ format->es->video.frame_rate.den = 1; ++ ++ dev->capture.width = format->es->video.width; ++ dev->capture.height = format->es->video.height; ++ dev->capture.fmt = &formats[0]; ++ dev->capture.encode_component = NULL; ++ dev->capture.timeperframe = tpf_default; ++ dev->capture.enc_profile = V4L2_MPEG_VIDEO_H264_PROFILE_HIGH; ++ dev->capture.enc_level = V4L2_MPEG_VIDEO_H264_LEVEL_4_0; ++ ++ vchiq_mmal_port_parameter_set(dev->instance, ++ &dev->component[MMAL_COMPONENT_CAMERA]-> ++ output[MMAL_CAMERA_PORT_CAPTURE], ++ MMAL_PARAMETER_NO_IMAGE_PADDING, ++ &bool_true, sizeof(bool_true)); ++ ++ /* get the preview component ready */ ++ ret = vchiq_mmal_component_init( ++ dev->instance, "ril.video_render", ++ &dev->component[MMAL_COMPONENT_PREVIEW]); ++ if (ret < 0) ++ goto unreg_camera; ++ ++ if (dev->component[MMAL_COMPONENT_PREVIEW]->inputs < 1) { ++ ret = -EINVAL; ++ pr_debug("too few input ports %d needed %d\n", ++ dev->component[MMAL_COMPONENT_PREVIEW]->inputs, 1); ++ goto unreg_preview; ++ } ++ ++ /* get the image encoder component ready */ ++ ret = vchiq_mmal_component_init( ++ dev->instance, "ril.image_encode", ++ &dev->component[MMAL_COMPONENT_IMAGE_ENCODE]); ++ if (ret < 0) ++ goto unreg_preview; ++ ++ if (dev->component[MMAL_COMPONENT_IMAGE_ENCODE]->inputs < 1) { ++ ret = -EINVAL; ++ v4l2_err(&dev->v4l2_dev, "too few input ports %d needed %d\n", ++ dev->component[MMAL_COMPONENT_IMAGE_ENCODE]->inputs, ++ 1); ++ goto unreg_image_encoder; ++ } ++ ++ /* get the video encoder component ready */ ++ ret = vchiq_mmal_component_init(dev->instance, "ril.video_encode", ++ &dev-> ++ component[MMAL_COMPONENT_VIDEO_ENCODE]); ++ if (ret < 0) ++ goto unreg_image_encoder; ++ ++ if (dev->component[MMAL_COMPONENT_VIDEO_ENCODE]->inputs < 1) { ++ ret = -EINVAL; ++ v4l2_err(&dev->v4l2_dev, "too few input ports %d needed %d\n", ++ dev->component[MMAL_COMPONENT_VIDEO_ENCODE]->inputs, ++ 1); ++ goto unreg_vid_encoder; ++ } ++ ++ { ++ struct vchiq_mmal_port *encoder_port = ++ &dev->component[MMAL_COMPONENT_VIDEO_ENCODE]->output[0]; ++ encoder_port->format.encoding = MMAL_ENCODING_H264; ++ ret = vchiq_mmal_port_set_format(dev->instance, ++ encoder_port); ++ } ++ ++ { ++ unsigned int enable = 1; ++ vchiq_mmal_port_parameter_set( ++ dev->instance, ++ &dev->component[MMAL_COMPONENT_VIDEO_ENCODE]->control, ++ MMAL_PARAMETER_VIDEO_IMMUTABLE_INPUT, ++ &enable, sizeof(enable)); ++ ++ vchiq_mmal_port_parameter_set(dev->instance, ++ &dev->component[MMAL_COMPONENT_VIDEO_ENCODE]->control, ++ MMAL_PARAMETER_MINIMISE_FRAGMENTATION, ++ &enable, ++ sizeof(enable)); ++ } ++ ret = bm2835_mmal_set_all_camera_controls(dev); ++ if (ret < 0) ++ goto unreg_vid_encoder; ++ ++ return 0; ++ ++unreg_vid_encoder: ++ pr_err("Cleanup: Destroy video encoder\n"); ++ vchiq_mmal_component_finalise( ++ dev->instance, ++ dev->component[MMAL_COMPONENT_VIDEO_ENCODE]); ++ ++unreg_image_encoder: ++ pr_err("Cleanup: Destroy image encoder\n"); ++ vchiq_mmal_component_finalise( ++ dev->instance, ++ dev->component[MMAL_COMPONENT_IMAGE_ENCODE]); ++ ++unreg_preview: ++ pr_err("Cleanup: Destroy video render\n"); ++ vchiq_mmal_component_finalise(dev->instance, ++ dev->component[MMAL_COMPONENT_PREVIEW]); ++ ++unreg_camera: ++ pr_err("Cleanup: Destroy camera\n"); ++ vchiq_mmal_component_finalise(dev->instance, ++ dev->component[MMAL_COMPONENT_CAMERA]); ++ ++unreg_mmal: ++ vchiq_mmal_finalise(dev->instance); ++ return ret; ++} ++ ++static int __init bm2835_mmal_init_device(struct bm2835_mmal_dev *dev, ++ struct video_device *vfd) ++{ ++ int ret; ++ ++ *vfd = vdev_template; ++ if (gst_v4l2src_is_broken) { ++ v4l2_info(&dev->v4l2_dev, ++ "Work-around for gstreamer issue is active.\n"); ++ vfd->ioctl_ops = &camera0_ioctl_ops_gstreamer; ++ } ++ ++ vfd->v4l2_dev = &dev->v4l2_dev; ++ ++ vfd->lock = &dev->mutex; ++ ++ vfd->queue = &dev->capture.vb_vidq; ++ ++ /* video device needs to be able to access instance data */ ++ video_set_drvdata(vfd, dev); ++ ++ ret = video_register_device(vfd, ++ VFL_TYPE_GRABBER, ++ video_nr[dev->camera_num]); ++ if (ret < 0) ++ return ret; ++ ++ v4l2_info(vfd->v4l2_dev, ++ "V4L2 device registered as %s - stills mode > %dx%d\n", ++ video_device_node_name(vfd), max_video_width, max_video_height); ++ ++ return 0; ++} ++ ++void bcm2835_cleanup_instance(struct bm2835_mmal_dev *dev) ++{ ++ if (!dev) ++ return; ++ ++ v4l2_info(&dev->v4l2_dev, "unregistering %s\n", ++ video_device_node_name(&dev->vdev)); ++ ++ video_unregister_device(&dev->vdev); ++ ++ if (dev->capture.encode_component) { ++ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, ++ "mmal_exit - disconnect tunnel\n"); ++ vchiq_mmal_port_connect_tunnel(dev->instance, ++ dev->capture.camera_port, NULL); ++ vchiq_mmal_component_disable(dev->instance, ++ dev->capture.encode_component); ++ } ++ vchiq_mmal_component_disable(dev->instance, ++ dev->component[MMAL_COMPONENT_CAMERA]); ++ ++ vchiq_mmal_component_finalise(dev->instance, ++ dev-> ++ component[MMAL_COMPONENT_VIDEO_ENCODE]); ++ ++ vchiq_mmal_component_finalise(dev->instance, ++ dev-> ++ component[MMAL_COMPONENT_IMAGE_ENCODE]); ++ ++ vchiq_mmal_component_finalise(dev->instance, ++ dev->component[MMAL_COMPONENT_PREVIEW]); ++ ++ vchiq_mmal_component_finalise(dev->instance, ++ dev->component[MMAL_COMPONENT_CAMERA]); ++ ++ v4l2_ctrl_handler_free(&dev->ctrl_handler); ++ ++ v4l2_device_unregister(&dev->v4l2_dev); ++ ++ kfree(dev); ++} ++ ++static struct v4l2_format default_v4l2_format = { ++ .fmt.pix.pixelformat = V4L2_PIX_FMT_JPEG, ++ .fmt.pix.width = 1024, ++ .fmt.pix.bytesperline = 0, ++ .fmt.pix.height = 768, ++ .fmt.pix.sizeimage = 1024*768, ++}; ++ ++static int __init bm2835_mmal_init(void) ++{ ++ int ret; ++ struct bm2835_mmal_dev *dev; ++ struct vb2_queue *q; ++ int camera; ++ unsigned int num_cameras; ++ struct vchiq_mmal_instance *instance; ++ unsigned int resolutions[MAX_BCM2835_CAMERAS][2]; ++ ++ ret = vchiq_mmal_init(&instance); ++ if (ret < 0) ++ return ret; ++ ++ num_cameras = get_num_cameras(instance, ++ resolutions, ++ MAX_BCM2835_CAMERAS); ++ if (num_cameras > MAX_BCM2835_CAMERAS) ++ num_cameras = MAX_BCM2835_CAMERAS; ++ ++ for (camera = 0; camera < num_cameras; camera++) { ++ dev = kzalloc(sizeof(struct bm2835_mmal_dev), GFP_KERNEL); ++ if (!dev) ++ return -ENOMEM; ++ ++ dev->camera_num = camera; ++ dev->max_width = resolutions[camera][0]; ++ dev->max_height = resolutions[camera][1]; ++ ++ /* setup device defaults */ ++ dev->overlay.w.left = 150; ++ dev->overlay.w.top = 50; ++ dev->overlay.w.width = 1024; ++ dev->overlay.w.height = 768; ++ dev->overlay.clipcount = 0; ++ dev->overlay.field = V4L2_FIELD_NONE; ++ dev->overlay.global_alpha = 255; ++ ++ dev->capture.fmt = &formats[3]; /* JPEG */ ++ ++ /* v4l device registration */ ++ snprintf(dev->v4l2_dev.name, sizeof(dev->v4l2_dev.name), ++ "%s", BM2835_MMAL_MODULE_NAME); ++ ret = v4l2_device_register(NULL, &dev->v4l2_dev); ++ if (ret) ++ goto free_dev; ++ ++ /* setup v4l controls */ ++ ret = bm2835_mmal_init_controls(dev, &dev->ctrl_handler); ++ if (ret < 0) ++ goto unreg_dev; ++ dev->v4l2_dev.ctrl_handler = &dev->ctrl_handler; ++ ++ /* mmal init */ ++ dev->instance = instance; ++ ret = mmal_init(dev); ++ if (ret < 0) ++ goto unreg_dev; ++ ++ /* initialize queue */ ++ q = &dev->capture.vb_vidq; ++ memset(q, 0, sizeof(*q)); ++ q->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; ++ q->io_modes = VB2_MMAP | VB2_USERPTR | VB2_READ; ++ q->drv_priv = dev; ++ q->buf_struct_size = sizeof(struct mmal_buffer); ++ q->ops = &bm2835_mmal_video_qops; ++ q->mem_ops = &vb2_vmalloc_memops; ++ q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; ++ ret = vb2_queue_init(q); ++ if (ret < 0) ++ goto unreg_dev; ++ ++ /* v4l2 core mutex used to protect all fops and v4l2 ioctls. */ ++ mutex_init(&dev->mutex); ++ ++ /* initialise video devices */ ++ ret = bm2835_mmal_init_device(dev, &dev->vdev); ++ if (ret < 0) ++ goto unreg_dev; ++ ++ /* Really want to call vidioc_s_fmt_vid_cap with the default ++ * format, but currently the APIs don't join up. ++ */ ++ ret = mmal_setup_components(dev, &default_v4l2_format); ++ if (ret < 0) { ++ v4l2_err(&dev->v4l2_dev, ++ "%s: could not setup components\n", __func__); ++ goto unreg_dev; ++ } ++ ++ v4l2_info(&dev->v4l2_dev, ++ "Broadcom 2835 MMAL video capture ver %s loaded.\n", ++ BM2835_MMAL_VERSION); ++ ++ gdev[camera] = dev; ++ } ++ return 0; ++ ++unreg_dev: ++ v4l2_ctrl_handler_free(&dev->ctrl_handler); ++ v4l2_device_unregister(&dev->v4l2_dev); ++ ++free_dev: ++ kfree(dev); ++ ++ for ( ; camera > 0; camera--) { ++ bcm2835_cleanup_instance(gdev[camera]); ++ gdev[camera] = NULL; ++ } ++ pr_info("%s: error %d while loading driver\n", ++ BM2835_MMAL_MODULE_NAME, ret); ++ ++ return ret; ++} ++ ++static void __exit bm2835_mmal_exit(void) ++{ ++ int camera; ++ struct vchiq_mmal_instance *instance = gdev[0]->instance; ++ ++ for (camera = 0; camera < MAX_BCM2835_CAMERAS; camera++) { ++ bcm2835_cleanup_instance(gdev[camera]); ++ gdev[camera] = NULL; ++ } ++ vchiq_mmal_finalise(instance); ++} ++ ++module_init(bm2835_mmal_init); ++module_exit(bm2835_mmal_exit); +diff --git a/drivers/media/platform/bcm2835/bcm2835-camera.h b/drivers/media/platform/bcm2835/bcm2835-camera.h +new file mode 100644 +index 0000000..13f426f +--- /dev/null ++++ b/drivers/media/platform/bcm2835/bcm2835-camera.h +@@ -0,0 +1,144 @@ ++/* ++ * Broadcom BM2835 V4L2 driver ++ * ++ * Copyright © 2013 Raspberry Pi (Trading) Ltd. ++ * ++ * This file is subject to the terms and conditions of the GNU General Public ++ * License. See the file COPYING in the main directory of this archive ++ * for more details. ++ * ++ * Authors: Vincent Sanders <vincent.sanders@collabora.co.uk> ++ * Dave Stevenson <dsteve@broadcom.com> ++ * Simon Mellor <simellor@broadcom.com> ++ * Luke Diamand <luked@broadcom.com> ++ * ++ * core driver device ++ */ ++ ++#define V4L2_CTRL_COUNT 29 /* number of v4l controls */ ++ ++enum { ++ MMAL_COMPONENT_CAMERA = 0, ++ MMAL_COMPONENT_PREVIEW, ++ MMAL_COMPONENT_IMAGE_ENCODE, ++ MMAL_COMPONENT_VIDEO_ENCODE, ++ MMAL_COMPONENT_COUNT ++}; ++ ++enum { ++ MMAL_CAMERA_PORT_PREVIEW = 0, ++ MMAL_CAMERA_PORT_VIDEO, ++ MMAL_CAMERA_PORT_CAPTURE, ++ MMAL_CAMERA_PORT_COUNT ++}; ++ ++#define PREVIEW_LAYER 2 ++ ++extern int bcm2835_v4l2_debug; ++ ++struct bm2835_mmal_dev { ++ /* v4l2 devices */ ++ struct v4l2_device v4l2_dev; ++ struct video_device vdev; ++ struct mutex mutex; ++ ++ /* controls */ ++ struct v4l2_ctrl_handler ctrl_handler; ++ struct v4l2_ctrl *ctrls[V4L2_CTRL_COUNT]; ++ enum v4l2_scene_mode scene_mode; ++ struct mmal_colourfx colourfx; ++ int hflip; ++ int vflip; ++ int red_gain; ++ int blue_gain; ++ enum mmal_parameter_exposuremode exposure_mode_user; ++ enum v4l2_exposure_auto_type exposure_mode_v4l2_user; ++ /* active exposure mode may differ if selected via a scene mode */ ++ enum mmal_parameter_exposuremode exposure_mode_active; ++ enum mmal_parameter_exposuremeteringmode metering_mode; ++ unsigned int manual_shutter_speed; ++ bool exp_auto_priority; ++ bool manual_iso_enabled; ++ uint32_t iso; ++ ++ /* allocated mmal instance and components */ ++ struct vchiq_mmal_instance *instance; ++ struct vchiq_mmal_component *component[MMAL_COMPONENT_COUNT]; ++ int camera_use_count; ++ ++ struct v4l2_window overlay; ++ ++ struct { ++ unsigned int width; /* width */ ++ unsigned int height; /* height */ ++ unsigned int stride; /* stride */ ++ unsigned int buffersize; /* buffer size with padding */ ++ struct mmal_fmt *fmt; ++ struct v4l2_fract timeperframe; ++ ++ /* H264 encode bitrate */ ++ int encode_bitrate; ++ /* H264 bitrate mode. CBR/VBR */ ++ int encode_bitrate_mode; ++ /* H264 profile */ ++ enum v4l2_mpeg_video_h264_profile enc_profile; ++ /* H264 level */ ++ enum v4l2_mpeg_video_h264_level enc_level; ++ /* JPEG Q-factor */ ++ int q_factor; ++ ++ struct vb2_queue vb_vidq; ++ ++ /* VC start timestamp for streaming */ ++ s64 vc_start_timestamp; ++ /* Kernel start timestamp for streaming */ ++ struct timeval kernel_start_ts; ++ ++ struct vchiq_mmal_port *port; /* port being used for capture */ ++ /* camera port being used for capture */ ++ struct vchiq_mmal_port *camera_port; ++ /* component being used for encode */ ++ struct vchiq_mmal_component *encode_component; ++ /* number of frames remaining which driver should capture */ ++ unsigned int frame_count; ++ /* last frame completion */ ++ struct completion frame_cmplt; ++ ++ } capture; ++ ++ unsigned int camera_num; ++ unsigned int max_width; ++ unsigned int max_height; ++}; ++ ++int bm2835_mmal_init_controls( ++ struct bm2835_mmal_dev *dev, ++ struct v4l2_ctrl_handler *hdl); ++ ++int bm2835_mmal_set_all_camera_controls(struct bm2835_mmal_dev *dev); ++int set_framerate_params(struct bm2835_mmal_dev *dev); ++ ++/* Debug helpers */ ++ ++#define v4l2_dump_pix_format(level, debug, dev, pix_fmt, desc) \ ++{ \ ++ v4l2_dbg(level, debug, dev, \ ++"%s: w %u h %u field %u pfmt 0x%x bpl %u sz_img %u colorspace 0x%x priv %u\n", \ ++ desc == NULL ? "" : desc, \ ++ (pix_fmt)->width, (pix_fmt)->height, (pix_fmt)->field, \ ++ (pix_fmt)->pixelformat, (pix_fmt)->bytesperline, \ ++ (pix_fmt)->sizeimage, (pix_fmt)->colorspace, (pix_fmt)->priv); \ ++} ++#define v4l2_dump_win_format(level, debug, dev, win_fmt, desc) \ ++{ \ ++ v4l2_dbg(level, debug, dev, \ ++"%s: w %u h %u l %u t %u field %u chromakey %06X clip %p " \ ++"clipcount %u bitmap %p\n", \ ++ desc == NULL ? "" : desc, \ ++ (win_fmt)->w.width, (win_fmt)->w.height, \ ++ (win_fmt)->w.left, (win_fmt)->w.top, \ ++ (win_fmt)->field, \ ++ (win_fmt)->chromakey, \ ++ (win_fmt)->clips, (win_fmt)->clipcount, \ ++ (win_fmt)->bitmap); \ ++} +diff --git a/drivers/media/platform/bcm2835/controls.c b/drivers/media/platform/bcm2835/controls.c +new file mode 100644 +index 0000000..fe61330 +--- /dev/null ++++ b/drivers/media/platform/bcm2835/controls.c +@@ -0,0 +1,1345 @@ ++/* ++ * Broadcom BM2835 V4L2 driver ++ * ++ * Copyright © 2013 Raspberry Pi (Trading) Ltd. ++ * ++ * This file is subject to the terms and conditions of the GNU General Public ++ * License. See the file COPYING in the main directory of this archive ++ * for more details. ++ * ++ * Authors: Vincent Sanders <vincent.sanders@collabora.co.uk> ++ * Dave Stevenson <dsteve@broadcom.com> ++ * Simon Mellor <simellor@broadcom.com> ++ * Luke Diamand <luked@broadcom.com> ++ */ ++ ++#include <linux/errno.h> ++#include <linux/kernel.h> ++#include <linux/module.h> ++#include <linux/slab.h> ++#include <media/videobuf2-vmalloc.h> ++#include <media/v4l2-device.h> ++#include <media/v4l2-ioctl.h> ++#include <media/v4l2-ctrls.h> ++#include <media/v4l2-fh.h> ++#include <media/v4l2-event.h> ++#include <media/v4l2-common.h> ++ ++#include "mmal-common.h" ++#include "mmal-vchiq.h" ++#include "mmal-parameters.h" ++#include "bcm2835-camera.h" ++ ++/* The supported V4L2_CID_AUTO_EXPOSURE_BIAS values are from -4.0 to +4.0. ++ * MMAL values are in 1/6th increments so the MMAL range is -24 to +24. ++ * V4L2 docs say value "is expressed in terms of EV, drivers should interpret ++ * the values as 0.001 EV units, where the value 1000 stands for +1 EV." ++ * V4L2 is limited to a max of 32 values in a menu, so count in 1/3rds from ++ * -4 to +4 ++ */ ++static const s64 ev_bias_qmenu[] = { ++ -4000, -3667, -3333, ++ -3000, -2667, -2333, ++ -2000, -1667, -1333, ++ -1000, -667, -333, ++ 0, 333, 667, ++ 1000, 1333, 1667, ++ 2000, 2333, 2667, ++ 3000, 3333, 3667, ++ 4000 ++}; ++ ++/* Supported ISO values (*1000) ++ * ISOO = auto ISO ++ */ ++static const s64 iso_qmenu[] = { ++ 0, 100000, 200000, 400000, 800000, ++}; ++static const uint32_t iso_values[] = { ++ 0, 100, 200, 400, 800, ++}; ++ ++static const s64 mains_freq_qmenu[] = { ++ V4L2_CID_POWER_LINE_FREQUENCY_DISABLED, ++ V4L2_CID_POWER_LINE_FREQUENCY_50HZ, ++ V4L2_CID_POWER_LINE_FREQUENCY_60HZ, ++ V4L2_CID_POWER_LINE_FREQUENCY_AUTO ++}; ++ ++/* Supported video encode modes */ ++static const s64 bitrate_mode_qmenu[] = { ++ (s64)V4L2_MPEG_VIDEO_BITRATE_MODE_VBR, ++ (s64)V4L2_MPEG_VIDEO_BITRATE_MODE_CBR, ++}; ++ ++enum bm2835_mmal_ctrl_type { ++ MMAL_CONTROL_TYPE_STD, ++ MMAL_CONTROL_TYPE_STD_MENU, ++ MMAL_CONTROL_TYPE_INT_MENU, ++ MMAL_CONTROL_TYPE_CLUSTER, /* special cluster entry */ ++}; ++ ++struct bm2835_mmal_v4l2_ctrl; ++ ++typedef int(bm2835_mmal_v4l2_ctrl_cb)( ++ struct bm2835_mmal_dev *dev, ++ struct v4l2_ctrl *ctrl, ++ const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl); ++ ++struct bm2835_mmal_v4l2_ctrl { ++ u32 id; /* v4l2 control identifier */ ++ enum bm2835_mmal_ctrl_type type; ++ /* control minimum value or ++ * mask for MMAL_CONTROL_TYPE_STD_MENU */ ++ s32 min; ++ s32 max; /* maximum value of control */ ++ s32 def; /* default value of control */ ++ s32 step; /* step size of the control */ ++ const s64 *imenu; /* integer menu array */ ++ u32 mmal_id; /* mmal parameter id */ ++ bm2835_mmal_v4l2_ctrl_cb *setter; ++ bool ignore_errors; ++}; ++ ++struct v4l2_to_mmal_effects_setting { ++ u32 v4l2_effect; ++ u32 mmal_effect; ++ s32 col_fx_enable; ++ s32 col_fx_fixed_cbcr; ++ u32 u; ++ u32 v; ++ u32 num_effect_params; ++ u32 effect_params[MMAL_MAX_IMAGEFX_PARAMETERS]; ++}; ++ ++static const struct v4l2_to_mmal_effects_setting ++ v4l2_to_mmal_effects_values[] = { ++ { V4L2_COLORFX_NONE, MMAL_PARAM_IMAGEFX_NONE, ++ 0, 0, 0, 0, 0, {0, 0, 0, 0, 0} }, ++ { V4L2_COLORFX_BW, MMAL_PARAM_IMAGEFX_NONE, ++ 1, 0, 128, 128, 0, {0, 0, 0, 0, 0} }, ++ { V4L2_COLORFX_SEPIA, MMAL_PARAM_IMAGEFX_NONE, ++ 1, 0, 87, 151, 0, {0, 0, 0, 0, 0} }, ++ { V4L2_COLORFX_NEGATIVE, MMAL_PARAM_IMAGEFX_NEGATIVE, ++ 0, 0, 0, 0, 0, {0, 0, 0, 0, 0} }, ++ { V4L2_COLORFX_EMBOSS, MMAL_PARAM_IMAGEFX_EMBOSS, ++ 0, 0, 0, 0, 0, {0, 0, 0, 0, 0} }, ++ { V4L2_COLORFX_SKETCH, MMAL_PARAM_IMAGEFX_SKETCH, ++ 0, 0, 0, 0, 0, {0, 0, 0, 0, 0} }, ++ { V4L2_COLORFX_SKY_BLUE, MMAL_PARAM_IMAGEFX_PASTEL, ++ 0, 0, 0, 0, 0, {0, 0, 0, 0, 0} }, ++ { V4L2_COLORFX_GRASS_GREEN, MMAL_PARAM_IMAGEFX_WATERCOLOUR, ++ 0, 0, 0, 0, 0, {0, 0, 0, 0, 0} }, ++ { V4L2_COLORFX_SKIN_WHITEN, MMAL_PARAM_IMAGEFX_WASHEDOUT, ++ 0, 0, 0, 0, 0, {0, 0, 0, 0, 0} }, ++ { V4L2_COLORFX_VIVID, MMAL_PARAM_IMAGEFX_SATURATION, ++ 0, 0, 0, 0, 0, {0, 0, 0, 0, 0} }, ++ { V4L2_COLORFX_AQUA, MMAL_PARAM_IMAGEFX_NONE, ++ 1, 0, 171, 121, 0, {0, 0, 0, 0, 0} }, ++ { V4L2_COLORFX_ART_FREEZE, MMAL_PARAM_IMAGEFX_HATCH, ++ 0, 0, 0, 0, 0, {0, 0, 0, 0, 0} }, ++ { V4L2_COLORFX_SILHOUETTE, MMAL_PARAM_IMAGEFX_FILM, ++ 0, 0, 0, 0, 0, {0, 0, 0, 0, 0} }, ++ { V4L2_COLORFX_SOLARIZATION, MMAL_PARAM_IMAGEFX_SOLARIZE, ++ 0, 0, 0, 0, 5, {1, 128, 160, 160, 48} }, ++ { V4L2_COLORFX_ANTIQUE, MMAL_PARAM_IMAGEFX_COLOURBALANCE, ++ 0, 0, 0, 0, 3, {108, 274, 238, 0, 0} }, ++ { V4L2_COLORFX_SET_CBCR, MMAL_PARAM_IMAGEFX_NONE, ++ 1, 1, 0, 0, 0, {0, 0, 0, 0, 0} } ++}; ++ ++struct v4l2_mmal_scene_config { ++ enum v4l2_scene_mode v4l2_scene; ++ enum mmal_parameter_exposuremode exposure_mode; ++ enum mmal_parameter_exposuremeteringmode metering_mode; ++}; ++ ++static const struct v4l2_mmal_scene_config scene_configs[] = { ++ /* V4L2_SCENE_MODE_NONE automatically added */ ++ { ++ V4L2_SCENE_MODE_NIGHT, ++ MMAL_PARAM_EXPOSUREMODE_NIGHT, ++ MMAL_PARAM_EXPOSUREMETERINGMODE_AVERAGE ++ }, ++ { ++ V4L2_SCENE_MODE_SPORTS, ++ MMAL_PARAM_EXPOSUREMODE_SPORTS, ++ MMAL_PARAM_EXPOSUREMETERINGMODE_AVERAGE ++ }, ++}; ++ ++/* control handlers*/ ++ ++static int ctrl_set_rational(struct bm2835_mmal_dev *dev, ++ struct v4l2_ctrl *ctrl, ++ const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl) ++{ ++ struct mmal_parameter_rational rational_value; ++ struct vchiq_mmal_port *control; ++ ++ control = &dev->component[MMAL_COMPONENT_CAMERA]->control; ++ ++ rational_value.num = ctrl->val; ++ rational_value.den = 100; ++ ++ return vchiq_mmal_port_parameter_set(dev->instance, control, ++ mmal_ctrl->mmal_id, ++ &rational_value, ++ sizeof(rational_value)); ++} ++ ++static int ctrl_set_value(struct bm2835_mmal_dev *dev, ++ struct v4l2_ctrl *ctrl, ++ const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl) ++{ ++ u32 u32_value; ++ struct vchiq_mmal_port *control; ++ ++ control = &dev->component[MMAL_COMPONENT_CAMERA]->control; ++ ++ u32_value = ctrl->val; ++ ++ return vchiq_mmal_port_parameter_set(dev->instance, control, ++ mmal_ctrl->mmal_id, ++ &u32_value, sizeof(u32_value)); ++} ++ ++static int ctrl_set_iso(struct bm2835_mmal_dev *dev, ++ struct v4l2_ctrl *ctrl, ++ const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl) ++{ ++ u32 u32_value; ++ struct vchiq_mmal_port *control; ++ ++ if (ctrl->val > mmal_ctrl->max || ctrl->val < mmal_ctrl->min) ++ return 1; ++ ++ if (ctrl->id == V4L2_CID_ISO_SENSITIVITY) ++ dev->iso = iso_values[ctrl->val]; ++ else if (ctrl->id == V4L2_CID_ISO_SENSITIVITY_AUTO) ++ dev->manual_iso_enabled = ++ (ctrl->val == V4L2_ISO_SENSITIVITY_MANUAL ? ++ true : ++ false); ++ ++ control = &dev->component[MMAL_COMPONENT_CAMERA]->control; ++ ++ if (dev->manual_iso_enabled) ++ u32_value = dev->iso; ++ else ++ u32_value = 0; ++ ++ return vchiq_mmal_port_parameter_set(dev->instance, control, ++ MMAL_PARAMETER_ISO, ++ &u32_value, sizeof(u32_value)); ++} ++ ++static int ctrl_set_value_ev(struct bm2835_mmal_dev *dev, ++ struct v4l2_ctrl *ctrl, ++ const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl) ++{ ++ s32 s32_value; ++ struct vchiq_mmal_port *control; ++ ++ control = &dev->component[MMAL_COMPONENT_CAMERA]->control; ++ ++ s32_value = (ctrl->val-12)*2; /* Convert from index to 1/6ths */ ++ ++ return vchiq_mmal_port_parameter_set(dev->instance, control, ++ mmal_ctrl->mmal_id, ++ &s32_value, sizeof(s32_value)); ++} ++ ++static int ctrl_set_rotate(struct bm2835_mmal_dev *dev, ++ struct v4l2_ctrl *ctrl, ++ const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl) ++{ ++ int ret; ++ u32 u32_value; ++ struct vchiq_mmal_component *camera; ++ ++ camera = dev->component[MMAL_COMPONENT_CAMERA]; ++ ++ u32_value = ((ctrl->val % 360) / 90) * 90; ++ ++ ret = vchiq_mmal_port_parameter_set(dev->instance, &camera->output[0], ++ mmal_ctrl->mmal_id, ++ &u32_value, sizeof(u32_value)); ++ if (ret < 0) ++ return ret; ++ ++ ret = vchiq_mmal_port_parameter_set(dev->instance, &camera->output[1], ++ mmal_ctrl->mmal_id, ++ &u32_value, sizeof(u32_value)); ++ if (ret < 0) ++ return ret; ++ ++ ret = vchiq_mmal_port_parameter_set(dev->instance, &camera->output[2], ++ mmal_ctrl->mmal_id, ++ &u32_value, sizeof(u32_value)); ++ ++ return ret; ++} ++ ++static int ctrl_set_flip(struct bm2835_mmal_dev *dev, ++ struct v4l2_ctrl *ctrl, ++ const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl) ++{ ++ int ret; ++ u32 u32_value; ++ struct vchiq_mmal_component *camera; ++ ++ if (ctrl->id == V4L2_CID_HFLIP) ++ dev->hflip = ctrl->val; ++ else ++ dev->vflip = ctrl->val; ++ ++ camera = dev->component[MMAL_COMPONENT_CAMERA]; ++ ++ if (dev->hflip && dev->vflip) ++ u32_value = MMAL_PARAM_MIRROR_BOTH; ++ else if (dev->hflip) ++ u32_value = MMAL_PARAM_MIRROR_HORIZONTAL; ++ else if (dev->vflip) ++ u32_value = MMAL_PARAM_MIRROR_VERTICAL; ++ else ++ u32_value = MMAL_PARAM_MIRROR_NONE; ++ ++ ret = vchiq_mmal_port_parameter_set(dev->instance, &camera->output[0], ++ mmal_ctrl->mmal_id, ++ &u32_value, sizeof(u32_value)); ++ if (ret < 0) ++ return ret; ++ ++ ret = vchiq_mmal_port_parameter_set(dev->instance, &camera->output[1], ++ mmal_ctrl->mmal_id, ++ &u32_value, sizeof(u32_value)); ++ if (ret < 0) ++ return ret; ++ ++ ret = vchiq_mmal_port_parameter_set(dev->instance, &camera->output[2], ++ mmal_ctrl->mmal_id, ++ &u32_value, sizeof(u32_value)); ++ ++ return ret; ++ ++} ++ ++static int ctrl_set_exposure(struct bm2835_mmal_dev *dev, ++ struct v4l2_ctrl *ctrl, ++ const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl) ++{ ++ enum mmal_parameter_exposuremode exp_mode = dev->exposure_mode_user; ++ u32 shutter_speed = 0; ++ struct vchiq_mmal_port *control; ++ int ret = 0; ++ ++ control = &dev->component[MMAL_COMPONENT_CAMERA]->control; ++ ++ if (mmal_ctrl->mmal_id == MMAL_PARAMETER_SHUTTER_SPEED) { ++ /* V4L2 is in 100usec increments. ++ * MMAL is 1usec. ++ */ ++ dev->manual_shutter_speed = ctrl->val * 100; ++ } else if (mmal_ctrl->mmal_id == MMAL_PARAMETER_EXPOSURE_MODE) { ++ switch (ctrl->val) { ++ case V4L2_EXPOSURE_AUTO: ++ exp_mode = MMAL_PARAM_EXPOSUREMODE_AUTO; ++ break; ++ ++ case V4L2_EXPOSURE_MANUAL: ++ exp_mode = MMAL_PARAM_EXPOSUREMODE_OFF; ++ break; ++ } ++ dev->exposure_mode_user = exp_mode; ++ dev->exposure_mode_v4l2_user = ctrl->val; ++ } else if (mmal_ctrl->id == V4L2_CID_EXPOSURE_AUTO_PRIORITY) { ++ dev->exp_auto_priority = ctrl->val; ++ } ++ ++ if (dev->scene_mode == V4L2_SCENE_MODE_NONE) { ++ if (exp_mode == MMAL_PARAM_EXPOSUREMODE_OFF) ++ shutter_speed = dev->manual_shutter_speed; ++ ++ ret = vchiq_mmal_port_parameter_set(dev->instance, ++ control, ++ MMAL_PARAMETER_SHUTTER_SPEED, ++ &shutter_speed, ++ sizeof(shutter_speed)); ++ ret += vchiq_mmal_port_parameter_set(dev->instance, ++ control, ++ MMAL_PARAMETER_EXPOSURE_MODE, ++ &exp_mode, ++ sizeof(u32)); ++ dev->exposure_mode_active = exp_mode; ++ } ++ /* exposure_dynamic_framerate (V4L2_CID_EXPOSURE_AUTO_PRIORITY) should ++ * always apply irrespective of scene mode. ++ */ ++ ret += set_framerate_params(dev); ++ ++ return ret; ++} ++ ++static int ctrl_set_metering_mode(struct bm2835_mmal_dev *dev, ++ struct v4l2_ctrl *ctrl, ++ const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl) ++{ ++ switch (ctrl->val) { ++ case V4L2_EXPOSURE_METERING_AVERAGE: ++ dev->metering_mode = MMAL_PARAM_EXPOSUREMETERINGMODE_AVERAGE; ++ break; ++ ++ case V4L2_EXPOSURE_METERING_CENTER_WEIGHTED: ++ dev->metering_mode = MMAL_PARAM_EXPOSUREMETERINGMODE_BACKLIT; ++ break; ++ ++ case V4L2_EXPOSURE_METERING_SPOT: ++ dev->metering_mode = MMAL_PARAM_EXPOSUREMETERINGMODE_SPOT; ++ break; ++ ++ /* todo matrix weighting not added to Linux API till 3.9 ++ case V4L2_EXPOSURE_METERING_MATRIX: ++ dev->metering_mode = MMAL_PARAM_EXPOSUREMETERINGMODE_MATRIX; ++ break; ++ */ ++ ++ } ++ ++ if (dev->scene_mode == V4L2_SCENE_MODE_NONE) { ++ struct vchiq_mmal_port *control; ++ u32 u32_value = dev->metering_mode; ++ ++ control = &dev->component[MMAL_COMPONENT_CAMERA]->control; ++ ++ return vchiq_mmal_port_parameter_set(dev->instance, control, ++ mmal_ctrl->mmal_id, ++ &u32_value, sizeof(u32_value)); ++ } else ++ return 0; ++} ++ ++static int ctrl_set_flicker_avoidance(struct bm2835_mmal_dev *dev, ++ struct v4l2_ctrl *ctrl, ++ const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl) ++{ ++ u32 u32_value; ++ struct vchiq_mmal_port *control; ++ ++ control = &dev->component[MMAL_COMPONENT_CAMERA]->control; ++ ++ switch (ctrl->val) { ++ case V4L2_CID_POWER_LINE_FREQUENCY_DISABLED: ++ u32_value = MMAL_PARAM_FLICKERAVOID_OFF; ++ break; ++ case V4L2_CID_POWER_LINE_FREQUENCY_50HZ: ++ u32_value = MMAL_PARAM_FLICKERAVOID_50HZ; ++ break; ++ case V4L2_CID_POWER_LINE_FREQUENCY_60HZ: ++ u32_value = MMAL_PARAM_FLICKERAVOID_60HZ; ++ break; ++ case V4L2_CID_POWER_LINE_FREQUENCY_AUTO: ++ u32_value = MMAL_PARAM_FLICKERAVOID_AUTO; ++ break; ++ } ++ ++ return vchiq_mmal_port_parameter_set(dev->instance, control, ++ mmal_ctrl->mmal_id, ++ &u32_value, sizeof(u32_value)); ++} ++ ++static int ctrl_set_awb_mode(struct bm2835_mmal_dev *dev, ++ struct v4l2_ctrl *ctrl, ++ const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl) ++{ ++ u32 u32_value; ++ struct vchiq_mmal_port *control; ++ ++ control = &dev->component[MMAL_COMPONENT_CAMERA]->control; ++ ++ switch (ctrl->val) { ++ case V4L2_WHITE_BALANCE_MANUAL: ++ u32_value = MMAL_PARAM_AWBMODE_OFF; ++ break; ++ ++ case V4L2_WHITE_BALANCE_AUTO: ++ u32_value = MMAL_PARAM_AWBMODE_AUTO; ++ break; ++ ++ case V4L2_WHITE_BALANCE_INCANDESCENT: ++ u32_value = MMAL_PARAM_AWBMODE_INCANDESCENT; ++ break; ++ ++ case V4L2_WHITE_BALANCE_FLUORESCENT: ++ u32_value = MMAL_PARAM_AWBMODE_FLUORESCENT; ++ break; ++ ++ case V4L2_WHITE_BALANCE_FLUORESCENT_H: ++ u32_value = MMAL_PARAM_AWBMODE_TUNGSTEN; ++ break; ++ ++ case V4L2_WHITE_BALANCE_HORIZON: ++ u32_value = MMAL_PARAM_AWBMODE_HORIZON; ++ break; ++ ++ case V4L2_WHITE_BALANCE_DAYLIGHT: ++ u32_value = MMAL_PARAM_AWBMODE_SUNLIGHT; ++ break; ++ ++ case V4L2_WHITE_BALANCE_FLASH: ++ u32_value = MMAL_PARAM_AWBMODE_FLASH; ++ break; ++ ++ case V4L2_WHITE_BALANCE_CLOUDY: ++ u32_value = MMAL_PARAM_AWBMODE_CLOUDY; ++ break; ++ ++ case V4L2_WHITE_BALANCE_SHADE: ++ u32_value = MMAL_PARAM_AWBMODE_SHADE; ++ break; ++ ++ } ++ ++ return vchiq_mmal_port_parameter_set(dev->instance, control, ++ mmal_ctrl->mmal_id, ++ &u32_value, sizeof(u32_value)); ++} ++ ++static int ctrl_set_awb_gains(struct bm2835_mmal_dev *dev, ++ struct v4l2_ctrl *ctrl, ++ const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl) ++{ ++ struct vchiq_mmal_port *control; ++ struct mmal_parameter_awbgains gains; ++ ++ control = &dev->component[MMAL_COMPONENT_CAMERA]->control; ++ ++ if (ctrl->id == V4L2_CID_RED_BALANCE) ++ dev->red_gain = ctrl->val; ++ else if (ctrl->id == V4L2_CID_BLUE_BALANCE) ++ dev->blue_gain = ctrl->val; ++ ++ gains.r_gain.num = dev->red_gain; ++ gains.b_gain.num = dev->blue_gain; ++ gains.r_gain.den = gains.b_gain.den = 1000; ++ ++ return vchiq_mmal_port_parameter_set(dev->instance, control, ++ mmal_ctrl->mmal_id, ++ &gains, sizeof(gains)); ++} ++ ++static int ctrl_set_image_effect(struct bm2835_mmal_dev *dev, ++ struct v4l2_ctrl *ctrl, ++ const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl) ++{ ++ int ret = -EINVAL; ++ int i, j; ++ struct vchiq_mmal_port *control; ++ struct mmal_parameter_imagefx_parameters imagefx; ++ ++ for (i = 0; i < ARRAY_SIZE(v4l2_to_mmal_effects_values); i++) { ++ if (ctrl->val == v4l2_to_mmal_effects_values[i].v4l2_effect) { ++ ++ imagefx.effect = ++ v4l2_to_mmal_effects_values[i].mmal_effect; ++ imagefx.num_effect_params = ++ v4l2_to_mmal_effects_values[i].num_effect_params; ++ ++ if (imagefx.num_effect_params > MMAL_MAX_IMAGEFX_PARAMETERS) ++ imagefx.num_effect_params = MMAL_MAX_IMAGEFX_PARAMETERS; ++ ++ for (j = 0; j < imagefx.num_effect_params; j++) ++ imagefx.effect_parameter[j] = ++ v4l2_to_mmal_effects_values[i].effect_params[j]; ++ ++ dev->colourfx.enable = ++ v4l2_to_mmal_effects_values[i].col_fx_enable; ++ if (!v4l2_to_mmal_effects_values[i].col_fx_fixed_cbcr) { ++ dev->colourfx.u = ++ v4l2_to_mmal_effects_values[i].u; ++ dev->colourfx.v = ++ v4l2_to_mmal_effects_values[i].v; ++ } ++ ++ control = &dev->component[MMAL_COMPONENT_CAMERA]->control; ++ ++ ret = vchiq_mmal_port_parameter_set( ++ dev->instance, control, ++ MMAL_PARAMETER_IMAGE_EFFECT_PARAMETERS, ++ &imagefx, sizeof(imagefx)); ++ if (ret) ++ goto exit; ++ ++ ret = vchiq_mmal_port_parameter_set( ++ dev->instance, control, ++ MMAL_PARAMETER_COLOUR_EFFECT, ++ &dev->colourfx, sizeof(dev->colourfx)); ++ } ++ } ++ ++exit: ++ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, ++ "mmal_ctrl:%p ctrl id:0x%x ctrl val:%d imagefx:0x%x color_effect:%s u:%d v:%d ret %d(%d)\n", ++ mmal_ctrl, ctrl->id, ctrl->val, imagefx.effect, ++ dev->colourfx.enable ? "true" : "false", ++ dev->colourfx.u, dev->colourfx.v, ++ ret, (ret == 0 ? 0 : -EINVAL)); ++ return (ret == 0 ? 0 : EINVAL); ++} ++ ++static int ctrl_set_colfx(struct bm2835_mmal_dev *dev, ++ struct v4l2_ctrl *ctrl, ++ const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl) ++{ ++ int ret = -EINVAL; ++ struct vchiq_mmal_port *control; ++ ++ control = &dev->component[MMAL_COMPONENT_CAMERA]->control; ++ ++ dev->colourfx.enable = (ctrl->val & 0xff00) >> 8; ++ dev->colourfx.enable = ctrl->val & 0xff; ++ ++ ret = vchiq_mmal_port_parameter_set(dev->instance, control, ++ MMAL_PARAMETER_COLOUR_EFFECT, ++ &dev->colourfx, sizeof(dev->colourfx)); ++ ++ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, ++ "%s: After: mmal_ctrl:%p ctrl id:0x%x ctrl val:%d ret %d(%d)\n", ++ __func__, mmal_ctrl, ctrl->id, ctrl->val, ret, ++ (ret == 0 ? 0 : -EINVAL)); ++ return (ret == 0 ? 0 : EINVAL); ++} ++ ++static int ctrl_set_bitrate(struct bm2835_mmal_dev *dev, ++ struct v4l2_ctrl *ctrl, ++ const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl) ++{ ++ int ret; ++ struct vchiq_mmal_port *encoder_out; ++ ++ dev->capture.encode_bitrate = ctrl->val; ++ ++ encoder_out = &dev->component[MMAL_COMPONENT_VIDEO_ENCODE]->output[0]; ++ ++ ret = vchiq_mmal_port_parameter_set(dev->instance, encoder_out, ++ mmal_ctrl->mmal_id, ++ &ctrl->val, sizeof(ctrl->val)); ++ ret = 0; ++ return ret; ++} ++ ++static int ctrl_set_bitrate_mode(struct bm2835_mmal_dev *dev, ++ struct v4l2_ctrl *ctrl, ++ const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl) ++{ ++ u32 bitrate_mode; ++ struct vchiq_mmal_port *encoder_out; ++ ++ encoder_out = &dev->component[MMAL_COMPONENT_VIDEO_ENCODE]->output[0]; ++ ++ dev->capture.encode_bitrate_mode = ctrl->val; ++ switch (ctrl->val) { ++ default: ++ case V4L2_MPEG_VIDEO_BITRATE_MODE_VBR: ++ bitrate_mode = MMAL_VIDEO_RATECONTROL_VARIABLE; ++ break; ++ case V4L2_MPEG_VIDEO_BITRATE_MODE_CBR: ++ bitrate_mode = MMAL_VIDEO_RATECONTROL_CONSTANT; ++ break; ++ } ++ ++ vchiq_mmal_port_parameter_set(dev->instance, encoder_out, ++ mmal_ctrl->mmal_id, ++ &bitrate_mode, ++ sizeof(bitrate_mode)); ++ return 0; ++} ++ ++static int ctrl_set_image_encode_output(struct bm2835_mmal_dev *dev, ++ struct v4l2_ctrl *ctrl, ++ const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl) ++{ ++ u32 u32_value; ++ struct vchiq_mmal_port *jpeg_out; ++ ++ jpeg_out = &dev->component[MMAL_COMPONENT_IMAGE_ENCODE]->output[0]; ++ ++ u32_value = ctrl->val; ++ ++ return vchiq_mmal_port_parameter_set(dev->instance, jpeg_out, ++ mmal_ctrl->mmal_id, ++ &u32_value, sizeof(u32_value)); ++} ++ ++static int ctrl_set_video_encode_param_output(struct bm2835_mmal_dev *dev, ++ struct v4l2_ctrl *ctrl, ++ const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl) ++{ ++ u32 u32_value; ++ struct vchiq_mmal_port *vid_enc_ctl; ++ ++ vid_enc_ctl = &dev->component[MMAL_COMPONENT_VIDEO_ENCODE]->output[0]; ++ ++ u32_value = ctrl->val; ++ ++ return vchiq_mmal_port_parameter_set(dev->instance, vid_enc_ctl, ++ mmal_ctrl->mmal_id, ++ &u32_value, sizeof(u32_value)); ++} ++ ++static int ctrl_set_video_encode_profile_level(struct bm2835_mmal_dev *dev, ++ struct v4l2_ctrl *ctrl, ++ const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl) ++{ ++ struct mmal_parameter_video_profile param; ++ int ret = 0; ++ ++ if (ctrl->id == V4L2_CID_MPEG_VIDEO_H264_PROFILE) { ++ switch (ctrl->val) { ++ case V4L2_MPEG_VIDEO_H264_PROFILE_BASELINE: ++ case V4L2_MPEG_VIDEO_H264_PROFILE_CONSTRAINED_BASELINE: ++ case V4L2_MPEG_VIDEO_H264_PROFILE_MAIN: ++ case V4L2_MPEG_VIDEO_H264_PROFILE_HIGH: ++ dev->capture.enc_profile = ctrl->val; ++ break; ++ default: ++ ret = -EINVAL; ++ break; ++ } ++ } else if (ctrl->id == V4L2_CID_MPEG_VIDEO_H264_LEVEL) { ++ switch (ctrl->val) { ++ case V4L2_MPEG_VIDEO_H264_LEVEL_1_0: ++ case V4L2_MPEG_VIDEO_H264_LEVEL_1B: ++ case V4L2_MPEG_VIDEO_H264_LEVEL_1_1: ++ case V4L2_MPEG_VIDEO_H264_LEVEL_1_2: ++ case V4L2_MPEG_VIDEO_H264_LEVEL_1_3: ++ case V4L2_MPEG_VIDEO_H264_LEVEL_2_0: ++ case V4L2_MPEG_VIDEO_H264_LEVEL_2_1: ++ case V4L2_MPEG_VIDEO_H264_LEVEL_2_2: ++ case V4L2_MPEG_VIDEO_H264_LEVEL_3_0: ++ case V4L2_MPEG_VIDEO_H264_LEVEL_3_1: ++ case V4L2_MPEG_VIDEO_H264_LEVEL_3_2: ++ case V4L2_MPEG_VIDEO_H264_LEVEL_4_0: ++ dev->capture.enc_level = ctrl->val; ++ break; ++ default: ++ ret = -EINVAL; ++ break; ++ } ++ } ++ ++ if (!ret) { ++ switch (dev->capture.enc_profile) { ++ case V4L2_MPEG_VIDEO_H264_PROFILE_BASELINE: ++ param.profile = MMAL_VIDEO_PROFILE_H264_BASELINE; ++ break; ++ case V4L2_MPEG_VIDEO_H264_PROFILE_CONSTRAINED_BASELINE: ++ param.profile = ++ MMAL_VIDEO_PROFILE_H264_CONSTRAINED_BASELINE; ++ break; ++ case V4L2_MPEG_VIDEO_H264_PROFILE_MAIN: ++ param.profile = MMAL_VIDEO_PROFILE_H264_MAIN; ++ break; ++ case V4L2_MPEG_VIDEO_H264_PROFILE_HIGH: ++ param.profile = MMAL_VIDEO_PROFILE_H264_HIGH; ++ break; ++ default: ++ /* Should never get here */ ++ break; ++ } ++ ++ switch (dev->capture.enc_level) { ++ case V4L2_MPEG_VIDEO_H264_LEVEL_1_0: ++ param.level = MMAL_VIDEO_LEVEL_H264_1; ++ break; ++ case V4L2_MPEG_VIDEO_H264_LEVEL_1B: ++ param.level = MMAL_VIDEO_LEVEL_H264_1b; ++ break; ++ case V4L2_MPEG_VIDEO_H264_LEVEL_1_1: ++ param.level = MMAL_VIDEO_LEVEL_H264_11; ++ break; ++ case V4L2_MPEG_VIDEO_H264_LEVEL_1_2: ++ param.level = MMAL_VIDEO_LEVEL_H264_12; ++ break; ++ case V4L2_MPEG_VIDEO_H264_LEVEL_1_3: ++ param.level = MMAL_VIDEO_LEVEL_H264_13; ++ break; ++ case V4L2_MPEG_VIDEO_H264_LEVEL_2_0: ++ param.level = MMAL_VIDEO_LEVEL_H264_2; ++ break; ++ case V4L2_MPEG_VIDEO_H264_LEVEL_2_1: ++ param.level = MMAL_VIDEO_LEVEL_H264_21; ++ break; ++ case V4L2_MPEG_VIDEO_H264_LEVEL_2_2: ++ param.level = MMAL_VIDEO_LEVEL_H264_22; ++ break; ++ case V4L2_MPEG_VIDEO_H264_LEVEL_3_0: ++ param.level = MMAL_VIDEO_LEVEL_H264_3; ++ break; ++ case V4L2_MPEG_VIDEO_H264_LEVEL_3_1: ++ param.level = MMAL_VIDEO_LEVEL_H264_31; ++ break; ++ case V4L2_MPEG_VIDEO_H264_LEVEL_3_2: ++ param.level = MMAL_VIDEO_LEVEL_H264_32; ++ break; ++ case V4L2_MPEG_VIDEO_H264_LEVEL_4_0: ++ param.level = MMAL_VIDEO_LEVEL_H264_4; ++ break; ++ default: ++ /* Should never get here */ ++ break; ++ } ++ ++ ret = vchiq_mmal_port_parameter_set(dev->instance, ++ &dev->component[MMAL_COMPONENT_VIDEO_ENCODE]->output[0], ++ mmal_ctrl->mmal_id, ++ &param, sizeof(param)); ++ } ++ return ret; ++} ++ ++static int ctrl_set_scene_mode(struct bm2835_mmal_dev *dev, ++ struct v4l2_ctrl *ctrl, ++ const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl) ++{ ++ int ret = 0; ++ int shutter_speed; ++ struct vchiq_mmal_port *control; ++ ++ v4l2_dbg(0, bcm2835_v4l2_debug, &dev->v4l2_dev, ++ "scene mode selected %d, was %d\n", ctrl->val, ++ dev->scene_mode); ++ control = &dev->component[MMAL_COMPONENT_CAMERA]->control; ++ ++ if (ctrl->val == dev->scene_mode) ++ return 0; ++ ++ if (ctrl->val == V4L2_SCENE_MODE_NONE) { ++ /* Restore all user selections */ ++ dev->scene_mode = V4L2_SCENE_MODE_NONE; ++ ++ if (dev->exposure_mode_user == MMAL_PARAM_EXPOSUREMODE_OFF) ++ shutter_speed = dev->manual_shutter_speed; ++ else ++ shutter_speed = 0; ++ ++ v4l2_dbg(0, bcm2835_v4l2_debug, &dev->v4l2_dev, ++ "%s: scene mode none: shut_speed %d, exp_mode %d, metering %d\n", ++ __func__, shutter_speed, dev->exposure_mode_user, ++ dev->metering_mode); ++ ret = vchiq_mmal_port_parameter_set(dev->instance, ++ control, ++ MMAL_PARAMETER_SHUTTER_SPEED, ++ &shutter_speed, ++ sizeof(shutter_speed)); ++ ret += vchiq_mmal_port_parameter_set(dev->instance, ++ control, ++ MMAL_PARAMETER_EXPOSURE_MODE, ++ &dev->exposure_mode_user, ++ sizeof(u32)); ++ dev->exposure_mode_active = dev->exposure_mode_user; ++ ret += vchiq_mmal_port_parameter_set(dev->instance, ++ control, ++ MMAL_PARAMETER_EXP_METERING_MODE, ++ &dev->metering_mode, ++ sizeof(u32)); ++ ret += set_framerate_params(dev); ++ } else { ++ /* Set up scene mode */ ++ int i; ++ const struct v4l2_mmal_scene_config *scene = NULL; ++ int shutter_speed; ++ enum mmal_parameter_exposuremode exposure_mode; ++ enum mmal_parameter_exposuremeteringmode metering_mode; ++ ++ for (i = 0; i < ARRAY_SIZE(scene_configs); i++) { ++ if (scene_configs[i].v4l2_scene == ++ ctrl->val) { ++ scene = &scene_configs[i]; ++ break; ++ } ++ } ++ if (!scene) ++ return -EINVAL; ++ if (i >= ARRAY_SIZE(scene_configs)) ++ return -EINVAL; ++ ++ /* Set all the values */ ++ dev->scene_mode = ctrl->val; ++ ++ if (scene->exposure_mode == MMAL_PARAM_EXPOSUREMODE_OFF) ++ shutter_speed = dev->manual_shutter_speed; ++ else ++ shutter_speed = 0; ++ exposure_mode = scene->exposure_mode; ++ metering_mode = scene->metering_mode; ++ ++ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, ++ "%s: scene mode none: shut_speed %d, exp_mode %d, metering %d\n", ++ __func__, shutter_speed, exposure_mode, metering_mode); ++ ++ ret = vchiq_mmal_port_parameter_set(dev->instance, control, ++ MMAL_PARAMETER_SHUTTER_SPEED, ++ &shutter_speed, ++ sizeof(shutter_speed)); ++ ret += vchiq_mmal_port_parameter_set(dev->instance, ++ control, ++ MMAL_PARAMETER_EXPOSURE_MODE, ++ &exposure_mode, ++ sizeof(u32)); ++ dev->exposure_mode_active = exposure_mode; ++ ret += vchiq_mmal_port_parameter_set(dev->instance, control, ++ MMAL_PARAMETER_EXPOSURE_MODE, ++ &exposure_mode, ++ sizeof(u32)); ++ ret += vchiq_mmal_port_parameter_set(dev->instance, control, ++ MMAL_PARAMETER_EXP_METERING_MODE, ++ &metering_mode, ++ sizeof(u32)); ++ ret += set_framerate_params(dev); ++ } ++ if (ret) { ++ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, ++ "%s: Setting scene to %d, ret=%d\n", ++ __func__, ctrl->val, ret); ++ ret = -EINVAL; ++ } ++ return 0; ++} ++ ++static int bm2835_mmal_s_ctrl(struct v4l2_ctrl *ctrl) ++{ ++ struct bm2835_mmal_dev *dev = ++ container_of(ctrl->handler, struct bm2835_mmal_dev, ++ ctrl_handler); ++ const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl = ctrl->priv; ++ int ret; ++ ++ if ((mmal_ctrl == NULL) || ++ (mmal_ctrl->id != ctrl->id) || ++ (mmal_ctrl->setter == NULL)) { ++ pr_warn("mmal_ctrl:%p ctrl id:%d\n", mmal_ctrl, ctrl->id); ++ return -EINVAL; ++ } ++ ++ ret = mmal_ctrl->setter(dev, ctrl, mmal_ctrl); ++ if (ret) ++ pr_warn("ctrl id:%d/MMAL param %08X- returned ret %d\n", ++ ctrl->id, mmal_ctrl->mmal_id, ret); ++ if (mmal_ctrl->ignore_errors) ++ ret = 0; ++ return ret; ++} ++ ++static const struct v4l2_ctrl_ops bm2835_mmal_ctrl_ops = { ++ .s_ctrl = bm2835_mmal_s_ctrl, ++}; ++ ++ ++ ++static const struct bm2835_mmal_v4l2_ctrl v4l2_ctrls[V4L2_CTRL_COUNT] = { ++ { ++ V4L2_CID_SATURATION, MMAL_CONTROL_TYPE_STD, ++ -100, 100, 0, 1, NULL, ++ MMAL_PARAMETER_SATURATION, ++ &ctrl_set_rational, ++ false ++ }, ++ { ++ V4L2_CID_SHARPNESS, MMAL_CONTROL_TYPE_STD, ++ -100, 100, 0, 1, NULL, ++ MMAL_PARAMETER_SHARPNESS, ++ &ctrl_set_rational, ++ false ++ }, ++ { ++ V4L2_CID_CONTRAST, MMAL_CONTROL_TYPE_STD, ++ -100, 100, 0, 1, NULL, ++ MMAL_PARAMETER_CONTRAST, ++ &ctrl_set_rational, ++ false ++ }, ++ { ++ V4L2_CID_BRIGHTNESS, MMAL_CONTROL_TYPE_STD, ++ 0, 100, 50, 1, NULL, ++ MMAL_PARAMETER_BRIGHTNESS, ++ &ctrl_set_rational, ++ false ++ }, ++ { ++ V4L2_CID_ISO_SENSITIVITY, MMAL_CONTROL_TYPE_INT_MENU, ++ 0, ARRAY_SIZE(iso_qmenu) - 1, 0, 1, iso_qmenu, ++ MMAL_PARAMETER_ISO, ++ &ctrl_set_iso, ++ false ++ }, ++ { ++ V4L2_CID_ISO_SENSITIVITY_AUTO, MMAL_CONTROL_TYPE_STD_MENU, ++ 0, 1, V4L2_ISO_SENSITIVITY_AUTO, 1, NULL, ++ MMAL_PARAMETER_ISO, ++ &ctrl_set_iso, ++ false ++ }, ++ { ++ V4L2_CID_IMAGE_STABILIZATION, MMAL_CONTROL_TYPE_STD, ++ 0, 1, 0, 1, NULL, ++ MMAL_PARAMETER_VIDEO_STABILISATION, ++ &ctrl_set_value, ++ false ++ }, ++/* { ++ 0, MMAL_CONTROL_TYPE_CLUSTER, 3, 1, 0, NULL, 0, NULL ++ }, */ ++ { ++ V4L2_CID_EXPOSURE_AUTO, MMAL_CONTROL_TYPE_STD_MENU, ++ ~0x03, 3, V4L2_EXPOSURE_AUTO, 0, NULL, ++ MMAL_PARAMETER_EXPOSURE_MODE, ++ &ctrl_set_exposure, ++ false ++ }, ++/* todo this needs mixing in with set exposure ++ { ++ V4L2_CID_SCENE_MODE, MMAL_CONTROL_TYPE_STD_MENU, ++ }, ++ */ ++ { ++ V4L2_CID_EXPOSURE_ABSOLUTE, MMAL_CONTROL_TYPE_STD, ++ /* Units of 100usecs */ ++ 1, 1*1000*10, 100*10, 1, NULL, ++ MMAL_PARAMETER_SHUTTER_SPEED, ++ &ctrl_set_exposure, ++ false ++ }, ++ { ++ V4L2_CID_AUTO_EXPOSURE_BIAS, MMAL_CONTROL_TYPE_INT_MENU, ++ 0, ARRAY_SIZE(ev_bias_qmenu) - 1, ++ (ARRAY_SIZE(ev_bias_qmenu)+1)/2 - 1, 0, ev_bias_qmenu, ++ MMAL_PARAMETER_EXPOSURE_COMP, ++ &ctrl_set_value_ev, ++ false ++ }, ++ { ++ V4L2_CID_EXPOSURE_AUTO_PRIORITY, MMAL_CONTROL_TYPE_STD, ++ 0, 1, ++ 0, 1, NULL, ++ 0, /* Dummy MMAL ID as it gets mapped into FPS range*/ ++ &ctrl_set_exposure, ++ false ++ }, ++ { ++ V4L2_CID_EXPOSURE_METERING, ++ MMAL_CONTROL_TYPE_STD_MENU, ++ ~0x7, 2, V4L2_EXPOSURE_METERING_AVERAGE, 0, NULL, ++ MMAL_PARAMETER_EXP_METERING_MODE, ++ &ctrl_set_metering_mode, ++ false ++ }, ++ { ++ V4L2_CID_AUTO_N_PRESET_WHITE_BALANCE, ++ MMAL_CONTROL_TYPE_STD_MENU, ++ ~0x3ff, 9, V4L2_WHITE_BALANCE_AUTO, 0, NULL, ++ MMAL_PARAMETER_AWB_MODE, ++ &ctrl_set_awb_mode, ++ false ++ }, ++ { ++ V4L2_CID_RED_BALANCE, MMAL_CONTROL_TYPE_STD, ++ 1, 7999, 1000, 1, NULL, ++ MMAL_PARAMETER_CUSTOM_AWB_GAINS, ++ &ctrl_set_awb_gains, ++ false ++ }, ++ { ++ V4L2_CID_BLUE_BALANCE, MMAL_CONTROL_TYPE_STD, ++ 1, 7999, 1000, 1, NULL, ++ MMAL_PARAMETER_CUSTOM_AWB_GAINS, ++ &ctrl_set_awb_gains, ++ false ++ }, ++ { ++ V4L2_CID_COLORFX, MMAL_CONTROL_TYPE_STD_MENU, ++ 0, 15, V4L2_COLORFX_NONE, 0, NULL, ++ MMAL_PARAMETER_IMAGE_EFFECT, ++ &ctrl_set_image_effect, ++ false ++ }, ++ { ++ V4L2_CID_COLORFX_CBCR, MMAL_CONTROL_TYPE_STD, ++ 0, 0xffff, 0x8080, 1, NULL, ++ MMAL_PARAMETER_COLOUR_EFFECT, ++ &ctrl_set_colfx, ++ false ++ }, ++ { ++ V4L2_CID_ROTATE, MMAL_CONTROL_TYPE_STD, ++ 0, 360, 0, 90, NULL, ++ MMAL_PARAMETER_ROTATION, ++ &ctrl_set_rotate, ++ false ++ }, ++ { ++ V4L2_CID_HFLIP, MMAL_CONTROL_TYPE_STD, ++ 0, 1, 0, 1, NULL, ++ MMAL_PARAMETER_MIRROR, ++ &ctrl_set_flip, ++ false ++ }, ++ { ++ V4L2_CID_VFLIP, MMAL_CONTROL_TYPE_STD, ++ 0, 1, 0, 1, NULL, ++ MMAL_PARAMETER_MIRROR, ++ &ctrl_set_flip, ++ false ++ }, ++ { ++ V4L2_CID_MPEG_VIDEO_BITRATE_MODE, MMAL_CONTROL_TYPE_STD_MENU, ++ 0, ARRAY_SIZE(bitrate_mode_qmenu) - 1, ++ 0, 0, bitrate_mode_qmenu, ++ MMAL_PARAMETER_RATECONTROL, ++ &ctrl_set_bitrate_mode, ++ false ++ }, ++ { ++ V4L2_CID_MPEG_VIDEO_BITRATE, MMAL_CONTROL_TYPE_STD, ++ 25*1000, 25*1000*1000, 10*1000*1000, 25*1000, NULL, ++ MMAL_PARAMETER_VIDEO_BIT_RATE, ++ &ctrl_set_bitrate, ++ false ++ }, ++ { ++ V4L2_CID_JPEG_COMPRESSION_QUALITY, MMAL_CONTROL_TYPE_STD, ++ 1, 100, ++ 30, 1, NULL, ++ MMAL_PARAMETER_JPEG_Q_FACTOR, ++ &ctrl_set_image_encode_output, ++ false ++ }, ++ { ++ V4L2_CID_POWER_LINE_FREQUENCY, MMAL_CONTROL_TYPE_STD_MENU, ++ 0, ARRAY_SIZE(mains_freq_qmenu) - 1, ++ 1, 1, NULL, ++ MMAL_PARAMETER_FLICKER_AVOID, ++ &ctrl_set_flicker_avoidance, ++ false ++ }, ++ { ++ V4L2_CID_MPEG_VIDEO_REPEAT_SEQ_HEADER, MMAL_CONTROL_TYPE_STD, ++ 0, 1, ++ 0, 1, NULL, ++ MMAL_PARAMETER_VIDEO_ENCODE_INLINE_HEADER, ++ &ctrl_set_video_encode_param_output, ++ true /* Errors ignored as requires latest firmware to work */ ++ }, ++ { ++ V4L2_CID_MPEG_VIDEO_H264_PROFILE, ++ MMAL_CONTROL_TYPE_STD_MENU, ++ ~((1<<V4L2_MPEG_VIDEO_H264_PROFILE_BASELINE) | ++ (1<<V4L2_MPEG_VIDEO_H264_PROFILE_CONSTRAINED_BASELINE) | ++ (1<<V4L2_MPEG_VIDEO_H264_PROFILE_MAIN) | ++ (1<<V4L2_MPEG_VIDEO_H264_PROFILE_HIGH)), ++ V4L2_MPEG_VIDEO_H264_PROFILE_HIGH, ++ V4L2_MPEG_VIDEO_H264_PROFILE_HIGH, 1, NULL, ++ MMAL_PARAMETER_PROFILE, ++ &ctrl_set_video_encode_profile_level, ++ false ++ }, ++ { ++ V4L2_CID_MPEG_VIDEO_H264_LEVEL, MMAL_CONTROL_TYPE_STD_MENU, ++ ~((1<<V4L2_MPEG_VIDEO_H264_LEVEL_1_0) | ++ (1<<V4L2_MPEG_VIDEO_H264_LEVEL_1B) | ++ (1<<V4L2_MPEG_VIDEO_H264_LEVEL_1_1) | ++ (1<<V4L2_MPEG_VIDEO_H264_LEVEL_1_2) | ++ (1<<V4L2_MPEG_VIDEO_H264_LEVEL_1_3) | ++ (1<<V4L2_MPEG_VIDEO_H264_LEVEL_2_0) | ++ (1<<V4L2_MPEG_VIDEO_H264_LEVEL_2_1) | ++ (1<<V4L2_MPEG_VIDEO_H264_LEVEL_2_2) | ++ (1<<V4L2_MPEG_VIDEO_H264_LEVEL_3_0) | ++ (1<<V4L2_MPEG_VIDEO_H264_LEVEL_3_1) | ++ (1<<V4L2_MPEG_VIDEO_H264_LEVEL_3_2) | ++ (1<<V4L2_MPEG_VIDEO_H264_LEVEL_4_0)), ++ V4L2_MPEG_VIDEO_H264_LEVEL_4_0, ++ V4L2_MPEG_VIDEO_H264_LEVEL_4_0, 1, NULL, ++ MMAL_PARAMETER_PROFILE, ++ &ctrl_set_video_encode_profile_level, ++ false ++ }, ++ { ++ V4L2_CID_SCENE_MODE, MMAL_CONTROL_TYPE_STD_MENU, ++ -1, /* Min is computed at runtime */ ++ V4L2_SCENE_MODE_TEXT, ++ V4L2_SCENE_MODE_NONE, 1, NULL, ++ MMAL_PARAMETER_PROFILE, ++ &ctrl_set_scene_mode, ++ false ++ }, ++ { ++ V4L2_CID_MPEG_VIDEO_H264_I_PERIOD, MMAL_CONTROL_TYPE_STD, ++ 0, 0x7FFFFFFF, 60, 1, NULL, ++ MMAL_PARAMETER_INTRAPERIOD, ++ &ctrl_set_video_encode_param_output, ++ false ++ }, ++}; ++ ++int bm2835_mmal_set_all_camera_controls(struct bm2835_mmal_dev *dev) ++{ ++ int c; ++ int ret = 0; ++ ++ for (c = 0; c < V4L2_CTRL_COUNT; c++) { ++ if ((dev->ctrls[c]) && (v4l2_ctrls[c].setter)) { ++ ret = v4l2_ctrls[c].setter(dev, dev->ctrls[c], ++ &v4l2_ctrls[c]); ++ if (!v4l2_ctrls[c].ignore_errors && ret) { ++ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, ++ "Failed when setting default values for ctrl %d\n", ++ c); ++ break; ++ } ++ } ++ } ++ return ret; ++} ++ ++int set_framerate_params(struct bm2835_mmal_dev *dev) ++{ ++ struct mmal_parameter_fps_range fps_range; ++ int ret; ++ ++ if ((dev->exposure_mode_active != MMAL_PARAM_EXPOSUREMODE_OFF) && ++ (dev->exp_auto_priority)) { ++ /* Variable FPS. Define min FPS as 1fps. ++ * Max as max defined FPS. ++ */ ++ fps_range.fps_low.num = 1; ++ fps_range.fps_low.den = 1; ++ fps_range.fps_high.num = dev->capture.timeperframe.denominator; ++ fps_range.fps_high.den = dev->capture.timeperframe.numerator; ++ } else { ++ /* Fixed FPS - set min and max to be the same */ ++ fps_range.fps_low.num = fps_range.fps_high.num = ++ dev->capture.timeperframe.denominator; ++ fps_range.fps_low.den = fps_range.fps_high.den = ++ dev->capture.timeperframe.numerator; ++ } ++ ++ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, ++ "Set fps range to %d/%d to %d/%d\n", ++ fps_range.fps_low.num, ++ fps_range.fps_low.den, ++ fps_range.fps_high.num, ++ fps_range.fps_high.den ++ ); ++ ++ ret = vchiq_mmal_port_parameter_set(dev->instance, ++ &dev->component[MMAL_COMPONENT_CAMERA]-> ++ output[MMAL_CAMERA_PORT_PREVIEW], ++ MMAL_PARAMETER_FPS_RANGE, ++ &fps_range, sizeof(fps_range)); ++ ret += vchiq_mmal_port_parameter_set(dev->instance, ++ &dev->component[MMAL_COMPONENT_CAMERA]-> ++ output[MMAL_CAMERA_PORT_VIDEO], ++ MMAL_PARAMETER_FPS_RANGE, ++ &fps_range, sizeof(fps_range)); ++ ret += vchiq_mmal_port_parameter_set(dev->instance, ++ &dev->component[MMAL_COMPONENT_CAMERA]-> ++ output[MMAL_CAMERA_PORT_CAPTURE], ++ MMAL_PARAMETER_FPS_RANGE, ++ &fps_range, sizeof(fps_range)); ++ if (ret) ++ v4l2_dbg(0, bcm2835_v4l2_debug, &dev->v4l2_dev, ++ "Failed to set fps ret %d\n", ++ ret); ++ ++ return ret; ++ ++} ++ ++int bm2835_mmal_init_controls(struct bm2835_mmal_dev *dev, ++ struct v4l2_ctrl_handler *hdl) ++{ ++ int c; ++ const struct bm2835_mmal_v4l2_ctrl *ctrl; ++ ++ v4l2_ctrl_handler_init(hdl, V4L2_CTRL_COUNT); ++ ++ for (c = 0; c < V4L2_CTRL_COUNT; c++) { ++ ctrl = &v4l2_ctrls[c]; ++ ++ switch (ctrl->type) { ++ case MMAL_CONTROL_TYPE_STD: ++ dev->ctrls[c] = v4l2_ctrl_new_std(hdl, ++ &bm2835_mmal_ctrl_ops, ctrl->id, ++ ctrl->min, ctrl->max, ctrl->step, ctrl->def); ++ break; ++ ++ case MMAL_CONTROL_TYPE_STD_MENU: ++ { ++ int mask = ctrl->min; ++ ++ if (ctrl->id == V4L2_CID_SCENE_MODE) { ++ /* Special handling to work out the mask ++ * value based on the scene_configs array ++ * at runtime. Reduces the chance of ++ * mismatches. ++ */ ++ int i; ++ mask = 1<<V4L2_SCENE_MODE_NONE; ++ for (i = 0; ++ i < ARRAY_SIZE(scene_configs); ++ i++) { ++ mask |= 1<<scene_configs[i].v4l2_scene; ++ } ++ mask = ~mask; ++ } ++ ++ dev->ctrls[c] = v4l2_ctrl_new_std_menu(hdl, ++ &bm2835_mmal_ctrl_ops, ctrl->id, ++ ctrl->max, mask, ctrl->def); ++ break; ++ } ++ ++ case MMAL_CONTROL_TYPE_INT_MENU: ++ dev->ctrls[c] = v4l2_ctrl_new_int_menu(hdl, ++ &bm2835_mmal_ctrl_ops, ctrl->id, ++ ctrl->max, ctrl->def, ctrl->imenu); ++ break; ++ ++ case MMAL_CONTROL_TYPE_CLUSTER: ++ /* skip this entry when constructing controls */ ++ continue; ++ } ++ ++ if (hdl->error) ++ break; ++ ++ dev->ctrls[c]->priv = (void *)ctrl; ++ } ++ ++ if (hdl->error) { ++ pr_err("error adding control %d/%d id 0x%x\n", c, ++ V4L2_CTRL_COUNT, ctrl->id); ++ return hdl->error; ++ } ++ ++ for (c = 0; c < V4L2_CTRL_COUNT; c++) { ++ ctrl = &v4l2_ctrls[c]; ++ ++ switch (ctrl->type) { ++ case MMAL_CONTROL_TYPE_CLUSTER: ++ v4l2_ctrl_auto_cluster(ctrl->min, ++ &dev->ctrls[c+1], ++ ctrl->max, ++ ctrl->def); ++ break; ++ ++ case MMAL_CONTROL_TYPE_STD: ++ case MMAL_CONTROL_TYPE_STD_MENU: ++ case MMAL_CONTROL_TYPE_INT_MENU: ++ break; ++ } ++ ++ } ++ ++ return 0; ++} +diff --git a/drivers/media/platform/bcm2835/mmal-common.h b/drivers/media/platform/bcm2835/mmal-common.h +new file mode 100644 +index 0000000..840fd13 +--- /dev/null ++++ b/drivers/media/platform/bcm2835/mmal-common.h +@@ -0,0 +1,53 @@ ++/* ++ * Broadcom BM2835 V4L2 driver ++ * ++ * Copyright © 2013 Raspberry Pi (Trading) Ltd. ++ * ++ * This file is subject to the terms and conditions of the GNU General Public ++ * License. See the file COPYING in the main directory of this archive ++ * for more details. ++ * ++ * Authors: Vincent Sanders <vincent.sanders@collabora.co.uk> ++ * Dave Stevenson <dsteve@broadcom.com> ++ * Simon Mellor <simellor@broadcom.com> ++ * Luke Diamand <luked@broadcom.com> ++ * ++ * MMAL structures ++ * ++ */ ++ ++#define MMAL_FOURCC(a, b, c, d) ((a) | (b << 8) | (c << 16) | (d << 24)) ++#define MMAL_MAGIC MMAL_FOURCC('m', 'm', 'a', 'l') ++ ++/** Special value signalling that time is not known */ ++#define MMAL_TIME_UNKNOWN (1LL<<63) ++ ++/* mapping between v4l and mmal video modes */ ++struct mmal_fmt { ++ char *name; ++ u32 fourcc; /* v4l2 format id */ ++ int flags; /* v4l2 flags field */ ++ u32 mmal; ++ int depth; ++ u32 mmal_component; /* MMAL component index to be used to encode */ ++ u32 ybbp; /* depth of first Y plane for planar formats */ ++}; ++ ++/* buffer for one video frame */ ++struct mmal_buffer { ++ /* v4l buffer data -- must be first */ ++ struct vb2_v4l2_buffer vb; ++ ++ /* list of buffers available */ ++ struct list_head list; ++ ++ void *buffer; /* buffer pointer */ ++ unsigned long buffer_size; /* size of allocated buffer */ ++}; ++ ++/* */ ++struct mmal_colourfx { ++ s32 enable; ++ u32 u; ++ u32 v; ++}; +diff --git a/drivers/media/platform/bcm2835/mmal-encodings.h b/drivers/media/platform/bcm2835/mmal-encodings.h +new file mode 100644 +index 0000000..024d620 +--- /dev/null ++++ b/drivers/media/platform/bcm2835/mmal-encodings.h +@@ -0,0 +1,127 @@ ++/* ++ * Broadcom BM2835 V4L2 driver ++ * ++ * Copyright © 2013 Raspberry Pi (Trading) Ltd. ++ * ++ * This file is subject to the terms and conditions of the GNU General Public ++ * License. See the file COPYING in the main directory of this archive ++ * for more details. ++ * ++ * Authors: Vincent Sanders <vincent.sanders@collabora.co.uk> ++ * Dave Stevenson <dsteve@broadcom.com> ++ * Simon Mellor <simellor@broadcom.com> ++ * Luke Diamand <luked@broadcom.com> ++ */ ++#ifndef MMAL_ENCODINGS_H ++#define MMAL_ENCODINGS_H ++ ++#define MMAL_ENCODING_H264 MMAL_FOURCC('H', '2', '6', '4') ++#define MMAL_ENCODING_H263 MMAL_FOURCC('H', '2', '6', '3') ++#define MMAL_ENCODING_MP4V MMAL_FOURCC('M', 'P', '4', 'V') ++#define MMAL_ENCODING_MP2V MMAL_FOURCC('M', 'P', '2', 'V') ++#define MMAL_ENCODING_MP1V MMAL_FOURCC('M', 'P', '1', 'V') ++#define MMAL_ENCODING_WMV3 MMAL_FOURCC('W', 'M', 'V', '3') ++#define MMAL_ENCODING_WMV2 MMAL_FOURCC('W', 'M', 'V', '2') ++#define MMAL_ENCODING_WMV1 MMAL_FOURCC('W', 'M', 'V', '1') ++#define MMAL_ENCODING_WVC1 MMAL_FOURCC('W', 'V', 'C', '1') ++#define MMAL_ENCODING_VP8 MMAL_FOURCC('V', 'P', '8', ' ') ++#define MMAL_ENCODING_VP7 MMAL_FOURCC('V', 'P', '7', ' ') ++#define MMAL_ENCODING_VP6 MMAL_FOURCC('V', 'P', '6', ' ') ++#define MMAL_ENCODING_THEORA MMAL_FOURCC('T', 'H', 'E', 'O') ++#define MMAL_ENCODING_SPARK MMAL_FOURCC('S', 'P', 'R', 'K') ++#define MMAL_ENCODING_MJPEG MMAL_FOURCC('M', 'J', 'P', 'G') ++ ++#define MMAL_ENCODING_JPEG MMAL_FOURCC('J', 'P', 'E', 'G') ++#define MMAL_ENCODING_GIF MMAL_FOURCC('G', 'I', 'F', ' ') ++#define MMAL_ENCODING_PNG MMAL_FOURCC('P', 'N', 'G', ' ') ++#define MMAL_ENCODING_PPM MMAL_FOURCC('P', 'P', 'M', ' ') ++#define MMAL_ENCODING_TGA MMAL_FOURCC('T', 'G', 'A', ' ') ++#define MMAL_ENCODING_BMP MMAL_FOURCC('B', 'M', 'P', ' ') ++ ++#define MMAL_ENCODING_I420 MMAL_FOURCC('I', '4', '2', '0') ++#define MMAL_ENCODING_I420_SLICE MMAL_FOURCC('S', '4', '2', '0') ++#define MMAL_ENCODING_YV12 MMAL_FOURCC('Y', 'V', '1', '2') ++#define MMAL_ENCODING_I422 MMAL_FOURCC('I', '4', '2', '2') ++#define MMAL_ENCODING_I422_SLICE MMAL_FOURCC('S', '4', '2', '2') ++#define MMAL_ENCODING_YUYV MMAL_FOURCC('Y', 'U', 'Y', 'V') ++#define MMAL_ENCODING_YVYU MMAL_FOURCC('Y', 'V', 'Y', 'U') ++#define MMAL_ENCODING_UYVY MMAL_FOURCC('U', 'Y', 'V', 'Y') ++#define MMAL_ENCODING_VYUY MMAL_FOURCC('V', 'Y', 'U', 'Y') ++#define MMAL_ENCODING_NV12 MMAL_FOURCC('N', 'V', '1', '2') ++#define MMAL_ENCODING_NV21 MMAL_FOURCC('N', 'V', '2', '1') ++#define MMAL_ENCODING_ARGB MMAL_FOURCC('A', 'R', 'G', 'B') ++#define MMAL_ENCODING_RGBA MMAL_FOURCC('R', 'G', 'B', 'A') ++#define MMAL_ENCODING_ABGR MMAL_FOURCC('A', 'B', 'G', 'R') ++#define MMAL_ENCODING_BGRA MMAL_FOURCC('B', 'G', 'R', 'A') ++#define MMAL_ENCODING_RGB16 MMAL_FOURCC('R', 'G', 'B', '2') ++#define MMAL_ENCODING_RGB24 MMAL_FOURCC('R', 'G', 'B', '3') ++#define MMAL_ENCODING_RGB32 MMAL_FOURCC('R', 'G', 'B', '4') ++#define MMAL_ENCODING_BGR16 MMAL_FOURCC('B', 'G', 'R', '2') ++#define MMAL_ENCODING_BGR24 MMAL_FOURCC('B', 'G', 'R', '3') ++#define MMAL_ENCODING_BGR32 MMAL_FOURCC('B', 'G', 'R', '4') ++ ++/** SAND Video (YUVUV128) format, native format understood by VideoCore. ++ * This format is *not* opaque - if requested you will receive full frames ++ * of YUV_UV video. ++ */ ++#define MMAL_ENCODING_YUVUV128 MMAL_FOURCC('S', 'A', 'N', 'D') ++ ++/** VideoCore opaque image format, image handles are returned to ++ * the host but not the actual image data. ++ */ ++#define MMAL_ENCODING_OPAQUE MMAL_FOURCC('O', 'P', 'Q', 'V') ++ ++/** An EGL image handle ++ */ ++#define MMAL_ENCODING_EGL_IMAGE MMAL_FOURCC('E', 'G', 'L', 'I') ++ ++/* }@ */ ++ ++/** \name Pre-defined audio encodings */ ++/* @{ */ ++#define MMAL_ENCODING_PCM_UNSIGNED_BE MMAL_FOURCC('P', 'C', 'M', 'U') ++#define MMAL_ENCODING_PCM_UNSIGNED_LE MMAL_FOURCC('p', 'c', 'm', 'u') ++#define MMAL_ENCODING_PCM_SIGNED_BE MMAL_FOURCC('P', 'C', 'M', 'S') ++#define MMAL_ENCODING_PCM_SIGNED_LE MMAL_FOURCC('p', 'c', 'm', 's') ++#define MMAL_ENCODING_PCM_FLOAT_BE MMAL_FOURCC('P', 'C', 'M', 'F') ++#define MMAL_ENCODING_PCM_FLOAT_LE MMAL_FOURCC('p', 'c', 'm', 'f') ++ ++/* Pre-defined H264 encoding variants */ ++ ++/** ISO 14496-10 Annex B byte stream format */ ++#define MMAL_ENCODING_VARIANT_H264_DEFAULT 0 ++/** ISO 14496-15 AVC stream format */ ++#define MMAL_ENCODING_VARIANT_H264_AVC1 MMAL_FOURCC('A', 'V', 'C', '1') ++/** Implicitly delineated NAL units without emulation prevention */ ++#define MMAL_ENCODING_VARIANT_H264_RAW MMAL_FOURCC('R', 'A', 'W', ' ') ++ ++ ++/** \defgroup MmalColorSpace List of pre-defined video color spaces ++ * This defines a list of common color spaces. This list isn't exhaustive and ++ * is only provided as a convenience to avoid clients having to use FourCC ++ * codes directly. However components are allowed to define and use their own ++ * FourCC codes. ++ */ ++/* @{ */ ++ ++/** Unknown color space */ ++#define MMAL_COLOR_SPACE_UNKNOWN 0 ++/** ITU-R BT.601-5 [SDTV] */ ++#define MMAL_COLOR_SPACE_ITUR_BT601 MMAL_FOURCC('Y', '6', '0', '1') ++/** ITU-R BT.709-3 [HDTV] */ ++#define MMAL_COLOR_SPACE_ITUR_BT709 MMAL_FOURCC('Y', '7', '0', '9') ++/** JPEG JFIF */ ++#define MMAL_COLOR_SPACE_JPEG_JFIF MMAL_FOURCC('Y', 'J', 'F', 'I') ++/** Title 47 Code of Federal Regulations (2003) 73.682 (a) (20) */ ++#define MMAL_COLOR_SPACE_FCC MMAL_FOURCC('Y', 'F', 'C', 'C') ++/** Society of Motion Picture and Television Engineers 240M (1999) */ ++#define MMAL_COLOR_SPACE_SMPTE240M MMAL_FOURCC('Y', '2', '4', '0') ++/** ITU-R BT.470-2 System M */ ++#define MMAL_COLOR_SPACE_BT470_2_M MMAL_FOURCC('Y', '_', '_', 'M') ++/** ITU-R BT.470-2 System BG */ ++#define MMAL_COLOR_SPACE_BT470_2_BG MMAL_FOURCC('Y', '_', 'B', 'G') ++/** JPEG JFIF, but with 16..255 luma */ ++#define MMAL_COLOR_SPACE_JFIF_Y16_255 MMAL_FOURCC('Y', 'Y', '1', '6') ++/* @} MmalColorSpace List */ ++ ++#endif /* MMAL_ENCODINGS_H */ +diff --git a/drivers/media/platform/bcm2835/mmal-msg-common.h b/drivers/media/platform/bcm2835/mmal-msg-common.h +new file mode 100644 +index 0000000..66e8a6e +--- /dev/null ++++ b/drivers/media/platform/bcm2835/mmal-msg-common.h +@@ -0,0 +1,50 @@ ++/* ++ * Broadcom BM2835 V4L2 driver ++ * ++ * Copyright © 2013 Raspberry Pi (Trading) Ltd. ++ * ++ * This file is subject to the terms and conditions of the GNU General Public ++ * License. See the file COPYING in the main directory of this archive ++ * for more details. ++ * ++ * Authors: Vincent Sanders <vincent.sanders@collabora.co.uk> ++ * Dave Stevenson <dsteve@broadcom.com> ++ * Simon Mellor <simellor@broadcom.com> ++ * Luke Diamand <luked@broadcom.com> ++ */ ++ ++#ifndef MMAL_MSG_COMMON_H ++#define MMAL_MSG_COMMON_H ++ ++enum mmal_msg_status { ++ MMAL_MSG_STATUS_SUCCESS = 0, /**< Success */ ++ MMAL_MSG_STATUS_ENOMEM, /**< Out of memory */ ++ MMAL_MSG_STATUS_ENOSPC, /**< Out of resources other than memory */ ++ MMAL_MSG_STATUS_EINVAL, /**< Argument is invalid */ ++ MMAL_MSG_STATUS_ENOSYS, /**< Function not implemented */ ++ MMAL_MSG_STATUS_ENOENT, /**< No such file or directory */ ++ MMAL_MSG_STATUS_ENXIO, /**< No such device or address */ ++ MMAL_MSG_STATUS_EIO, /**< I/O error */ ++ MMAL_MSG_STATUS_ESPIPE, /**< Illegal seek */ ++ MMAL_MSG_STATUS_ECORRUPT, /**< Data is corrupt \attention */ ++ MMAL_MSG_STATUS_ENOTREADY, /**< Component is not ready */ ++ MMAL_MSG_STATUS_ECONFIG, /**< Component is not configured */ ++ MMAL_MSG_STATUS_EISCONN, /**< Port is already connected */ ++ MMAL_MSG_STATUS_ENOTCONN, /**< Port is disconnected */ ++ MMAL_MSG_STATUS_EAGAIN, /**< Resource temporarily unavailable. */ ++ MMAL_MSG_STATUS_EFAULT, /**< Bad address */ ++}; ++ ++struct mmal_rect { ++ s32 x; /**< x coordinate (from left) */ ++ s32 y; /**< y coordinate (from top) */ ++ s32 width; /**< width */ ++ s32 height; /**< height */ ++}; ++ ++struct mmal_rational { ++ s32 num; /**< Numerator */ ++ s32 den; /**< Denominator */ ++}; ++ ++#endif /* MMAL_MSG_COMMON_H */ +diff --git a/drivers/media/platform/bcm2835/mmal-msg-format.h b/drivers/media/platform/bcm2835/mmal-msg-format.h +new file mode 100644 +index 0000000..123d86e +--- /dev/null ++++ b/drivers/media/platform/bcm2835/mmal-msg-format.h +@@ -0,0 +1,81 @@ ++/* ++ * Broadcom BM2835 V4L2 driver ++ * ++ * Copyright © 2013 Raspberry Pi (Trading) Ltd. ++ * ++ * This file is subject to the terms and conditions of the GNU General Public ++ * License. See the file COPYING in the main directory of this archive ++ * for more details. ++ * ++ * Authors: Vincent Sanders <vincent.sanders@collabora.co.uk> ++ * Dave Stevenson <dsteve@broadcom.com> ++ * Simon Mellor <simellor@broadcom.com> ++ * Luke Diamand <luked@broadcom.com> ++ */ ++ ++#ifndef MMAL_MSG_FORMAT_H ++#define MMAL_MSG_FORMAT_H ++ ++#include "mmal-msg-common.h" ++ ++/* MMAL_ES_FORMAT_T */ ++ ++ ++struct mmal_audio_format { ++ u32 channels; /**< Number of audio channels */ ++ u32 sample_rate; /**< Sample rate */ ++ ++ u32 bits_per_sample; /**< Bits per sample */ ++ u32 block_align; /**< Size of a block of data */ ++}; ++ ++struct mmal_video_format { ++ u32 width; /**< Width of frame in pixels */ ++ u32 height; /**< Height of frame in rows of pixels */ ++ struct mmal_rect crop; /**< Visible region of the frame */ ++ struct mmal_rational frame_rate; /**< Frame rate */ ++ struct mmal_rational par; /**< Pixel aspect ratio */ ++ ++ /* FourCC specifying the color space of the video stream. See the ++ * \ref MmalColorSpace "pre-defined color spaces" for some examples. ++ */ ++ u32 color_space; ++}; ++ ++struct mmal_subpicture_format { ++ u32 x_offset; ++ u32 y_offset; ++}; ++ ++union mmal_es_specific_format { ++ struct mmal_audio_format audio; ++ struct mmal_video_format video; ++ struct mmal_subpicture_format subpicture; ++}; ++ ++/** Definition of an elementary stream format (MMAL_ES_FORMAT_T) */ ++struct mmal_es_format { ++ u32 type; /* enum mmal_es_type */ ++ ++ u32 encoding; /* FourCC specifying encoding of the elementary stream.*/ ++ u32 encoding_variant; /* FourCC specifying the specific ++ * encoding variant of the elementary ++ * stream. ++ */ ++ ++ union mmal_es_specific_format *es; /* TODO: pointers in ++ * message serialisation?!? ++ */ ++ /* Type specific ++ * information for the ++ * elementary stream ++ */ ++ ++ u32 bitrate; /**< Bitrate in bits per second */ ++ u32 flags; /**< Flags describing properties of the elementary stream. */ ++ ++ u32 extradata_size; /**< Size of the codec specific data */ ++ u8 *extradata; /**< Codec specific data */ ++}; ++ ++#endif /* MMAL_MSG_FORMAT_H */ +diff --git a/drivers/media/platform/bcm2835/mmal-msg-port.h b/drivers/media/platform/bcm2835/mmal-msg-port.h +new file mode 100644 +index 0000000..a55c1ea +--- /dev/null ++++ b/drivers/media/platform/bcm2835/mmal-msg-port.h +@@ -0,0 +1,107 @@ ++/* ++ * Broadcom BM2835 V4L2 driver ++ * ++ * Copyright © 2013 Raspberry Pi (Trading) Ltd. ++ * ++ * This file is subject to the terms and conditions of the GNU General Public ++ * License. See the file COPYING in the main directory of this archive ++ * for more details. ++ * ++ * Authors: Vincent Sanders <vincent.sanders@collabora.co.uk> ++ * Dave Stevenson <dsteve@broadcom.com> ++ * Simon Mellor <simellor@broadcom.com> ++ * Luke Diamand <luked@broadcom.com> ++ */ ++ ++/* MMAL_PORT_TYPE_T */ ++enum mmal_port_type { ++ MMAL_PORT_TYPE_UNKNOWN = 0, /**< Unknown port type */ ++ MMAL_PORT_TYPE_CONTROL, /**< Control port */ ++ MMAL_PORT_TYPE_INPUT, /**< Input port */ ++ MMAL_PORT_TYPE_OUTPUT, /**< Output port */ ++ MMAL_PORT_TYPE_CLOCK, /**< Clock port */ ++}; ++ ++/** The port is pass-through and doesn't need buffer headers allocated */ ++#define MMAL_PORT_CAPABILITY_PASSTHROUGH 0x01 ++/** The port wants to allocate the buffer payloads. ++ * This signals a preference that payload allocation should be done ++ * on this port for efficiency reasons. */ ++#define MMAL_PORT_CAPABILITY_ALLOCATION 0x02 ++/** The port supports format change events. ++ * This applies to input ports and is used to let the client know ++ * whether the port supports being reconfigured via a format ++ * change event (i.e. without having to disable the port). */ ++#define MMAL_PORT_CAPABILITY_SUPPORTS_EVENT_FORMAT_CHANGE 0x04 ++ ++/* mmal port structure (MMAL_PORT_T) ++ * ++ * most elements are informational only, the pointer values for ++ * interogation messages are generally provided as additional ++ * strucures within the message. When used to set values only teh ++ * buffer_num, buffer_size and userdata parameters are writable. ++ */ ++struct mmal_port { ++ void *priv; /* Private member used by the framework */ ++ const char *name; /* Port name. Used for debugging purposes (RO) */ ++ ++ u32 type; /* Type of the port (RO) enum mmal_port_type */ ++ u16 index; /* Index of the port in its type list (RO) */ ++ u16 index_all; /* Index of the port in the list of all ports (RO) */ ++ ++ u32 is_enabled; /* Indicates whether the port is enabled or not (RO) */ ++ struct mmal_es_format *format; /* Format of the elementary stream */ ++ ++ u32 buffer_num_min; /* Minimum number of buffers the port ++ * requires (RO). This is set by the ++ * component. ++ */ ++ ++ u32 buffer_size_min; /* Minimum size of buffers the port ++ * requires (RO). This is set by the ++ * component. ++ */ ++ ++ u32 buffer_alignment_min; /* Minimum alignment requirement for ++ * the buffers (RO). A value of ++ * zero means no special alignment ++ * requirements. This is set by the ++ * component. ++ */ ++ ++ u32 buffer_num_recommended; /* Number of buffers the port ++ * recommends for optimal ++ * performance (RO). A value of ++ * zero means no special ++ * recommendation. This is set ++ * by the component. ++ */ ++ ++ u32 buffer_size_recommended; /* Size of buffers the port ++ * recommends for optimal ++ * performance (RO). A value of ++ * zero means no special ++ * recommendation. This is set ++ * by the component. ++ */ ++ ++ u32 buffer_num; /* Actual number of buffers the port will use. ++ * This is set by the client. ++ */ ++ ++ u32 buffer_size; /* Actual maximum size of the buffers that ++ * will be sent to the port. This is set by ++ * the client. ++ */ ++ ++ void *component; /* Component this port belongs to (Read Only) */ ++ ++ void *userdata; /* Field reserved for use by the client */ ++ ++ u32 capabilities; /* Flags describing the capabilities of a ++ * port (RO). Bitwise combination of \ref ++ * portcapabilities "Port capabilities" ++ * values. ++ */ ++ ++}; +diff --git a/drivers/media/platform/bcm2835/mmal-msg.h b/drivers/media/platform/bcm2835/mmal-msg.h +new file mode 100644 +index 0000000..67b1076 +--- /dev/null ++++ b/drivers/media/platform/bcm2835/mmal-msg.h +@@ -0,0 +1,404 @@ ++/* ++ * Broadcom BM2835 V4L2 driver ++ * ++ * Copyright © 2013 Raspberry Pi (Trading) Ltd. ++ * ++ * This file is subject to the terms and conditions of the GNU General Public ++ * License. See the file COPYING in the main directory of this archive ++ * for more details. ++ * ++ * Authors: Vincent Sanders <vincent.sanders@collabora.co.uk> ++ * Dave Stevenson <dsteve@broadcom.com> ++ * Simon Mellor <simellor@broadcom.com> ++ * Luke Diamand <luked@broadcom.com> ++ */ ++ ++/* all the data structures which serialise the MMAL protocol. note ++ * these are directly mapped onto the recived message data. ++ * ++ * BEWARE: They seem to *assume* pointers are u32 and that there is no ++ * structure padding! ++ * ++ * NOTE: this implementation uses kernel types to ensure sizes. Rather ++ * than assigning values to enums to force their size the ++ * implementation uses fixed size types and not the enums (though the ++ * comments have the actual enum type ++ */ ++ ++#define VC_MMAL_VER 15 ++#define VC_MMAL_MIN_VER 10 ++#define VC_MMAL_SERVER_NAME MAKE_FOURCC("mmal") ++ ++/* max total message size is 512 bytes */ ++#define MMAL_MSG_MAX_SIZE 512 ++/* with six 32bit header elements max payload is therefore 488 bytes */ ++#define MMAL_MSG_MAX_PAYLOAD 488 ++ ++#include "mmal-msg-common.h" ++#include "mmal-msg-format.h" ++#include "mmal-msg-port.h" ++ ++enum mmal_msg_type { ++ MMAL_MSG_TYPE_QUIT = 1, ++ MMAL_MSG_TYPE_SERVICE_CLOSED, ++ MMAL_MSG_TYPE_GET_VERSION, ++ MMAL_MSG_TYPE_COMPONENT_CREATE, ++ MMAL_MSG_TYPE_COMPONENT_DESTROY, /* 5 */ ++ MMAL_MSG_TYPE_COMPONENT_ENABLE, ++ MMAL_MSG_TYPE_COMPONENT_DISABLE, ++ MMAL_MSG_TYPE_PORT_INFO_GET, ++ MMAL_MSG_TYPE_PORT_INFO_SET, ++ MMAL_MSG_TYPE_PORT_ACTION, /* 10 */ ++ MMAL_MSG_TYPE_BUFFER_FROM_HOST, ++ MMAL_MSG_TYPE_BUFFER_TO_HOST, ++ MMAL_MSG_TYPE_GET_STATS, ++ MMAL_MSG_TYPE_PORT_PARAMETER_SET, ++ MMAL_MSG_TYPE_PORT_PARAMETER_GET, /* 15 */ ++ MMAL_MSG_TYPE_EVENT_TO_HOST, ++ MMAL_MSG_TYPE_GET_CORE_STATS_FOR_PORT, ++ MMAL_MSG_TYPE_OPAQUE_ALLOCATOR, ++ MMAL_MSG_TYPE_CONSUME_MEM, ++ MMAL_MSG_TYPE_LMK, /* 20 */ ++ MMAL_MSG_TYPE_OPAQUE_ALLOCATOR_DESC, ++ MMAL_MSG_TYPE_DRM_GET_LHS32, ++ MMAL_MSG_TYPE_DRM_GET_TIME, ++ MMAL_MSG_TYPE_BUFFER_FROM_HOST_ZEROLEN, ++ MMAL_MSG_TYPE_PORT_FLUSH, /* 25 */ ++ MMAL_MSG_TYPE_HOST_LOG, ++ MMAL_MSG_TYPE_MSG_LAST ++}; ++ ++/* port action request messages differ depending on the action type */ ++enum mmal_msg_port_action_type { ++ MMAL_MSG_PORT_ACTION_TYPE_UNKNOWN = 0, /* Unkown action */ ++ MMAL_MSG_PORT_ACTION_TYPE_ENABLE, /* Enable a port */ ++ MMAL_MSG_PORT_ACTION_TYPE_DISABLE, /* Disable a port */ ++ MMAL_MSG_PORT_ACTION_TYPE_FLUSH, /* Flush a port */ ++ MMAL_MSG_PORT_ACTION_TYPE_CONNECT, /* Connect ports */ ++ MMAL_MSG_PORT_ACTION_TYPE_DISCONNECT, /* Disconnect ports */ ++ MMAL_MSG_PORT_ACTION_TYPE_SET_REQUIREMENTS, /* Set buffer requirements*/ ++}; ++ ++struct mmal_msg_header { ++ u32 magic; ++ u32 type; /** enum mmal_msg_type */ ++ ++ /* Opaque handle to the control service */ ++ struct mmal_control_service *control_service; ++ ++ struct mmal_msg_context *context; /** a u32 per message context */ ++ u32 status; /** The status of the vchiq operation */ ++ u32 padding; ++}; ++ ++/* Send from VC to host to report version */ ++struct mmal_msg_version { ++ u32 flags; ++ u32 major; ++ u32 minor; ++ u32 minimum; ++}; ++ ++/* request to VC to create component */ ++struct mmal_msg_component_create { ++ void *client_component; /* component context */ ++ char name[128]; ++ u32 pid; /* For debug */ ++}; ++ ++/* reply from VC to component creation request */ ++struct mmal_msg_component_create_reply { ++ u32 status; /** enum mmal_msg_status - how does this differ to ++ * the one in the header? ++ */ ++ u32 component_handle; /* VideoCore handle for component */ ++ u32 input_num; /* Number of input ports */ ++ u32 output_num; /* Number of output ports */ ++ u32 clock_num; /* Number of clock ports */ ++}; ++ ++/* request to VC to destroy a component */ ++struct mmal_msg_component_destroy { ++ u32 component_handle; ++}; ++ ++struct mmal_msg_component_destroy_reply { ++ u32 status; /** The component destruction status */ ++}; ++ ++ ++/* request and reply to VC to enable a component */ ++struct mmal_msg_component_enable { ++ u32 component_handle; ++}; ++ ++struct mmal_msg_component_enable_reply { ++ u32 status; /** The component enable status */ ++}; ++ ++ ++/* request and reply to VC to disable a component */ ++struct mmal_msg_component_disable { ++ u32 component_handle; ++}; ++ ++struct mmal_msg_component_disable_reply { ++ u32 status; /** The component disable status */ ++}; ++ ++/* request to VC to get port information */ ++struct mmal_msg_port_info_get { ++ u32 component_handle; /* component handle port is associated with */ ++ u32 port_type; /* enum mmal_msg_port_type */ ++ u32 index; /* port index to query */ ++}; ++ ++/* reply from VC to get port info request */ ++struct mmal_msg_port_info_get_reply { ++ u32 status; /** enum mmal_msg_status */ ++ u32 component_handle; /* component handle port is associated with */ ++ u32 port_type; /* enum mmal_msg_port_type */ ++ u32 port_index; /* port indexed in query */ ++ s32 found; /* unused */ ++ u32 port_handle; /**< Handle to use for this port */ ++ struct mmal_port port; ++ struct mmal_es_format format; /* elementry stream format */ ++ union mmal_es_specific_format es; /* es type specific data */ ++ u8 extradata[MMAL_FORMAT_EXTRADATA_MAX_SIZE]; /* es extra data */ ++}; ++ ++/* request to VC to set port information */ ++struct mmal_msg_port_info_set { ++ u32 component_handle; ++ u32 port_type; /* enum mmal_msg_port_type */ ++ u32 port_index; /* port indexed in query */ ++ struct mmal_port port; ++ struct mmal_es_format format; ++ union mmal_es_specific_format es; ++ u8 extradata[MMAL_FORMAT_EXTRADATA_MAX_SIZE]; ++}; ++ ++/* reply from VC to port info set request */ ++struct mmal_msg_port_info_set_reply { ++ u32 status; ++ u32 component_handle; /* component handle port is associated with */ ++ u32 port_type; /* enum mmal_msg_port_type */ ++ u32 index; /* port indexed in query */ ++ s32 found; /* unused */ ++ u32 port_handle; /**< Handle to use for this port */ ++ struct mmal_port port; ++ struct mmal_es_format format; ++ union mmal_es_specific_format es; ++ u8 extradata[MMAL_FORMAT_EXTRADATA_MAX_SIZE]; ++}; ++ ++ ++/* port action requests that take a mmal_port as a parameter */ ++struct mmal_msg_port_action_port { ++ u32 component_handle; ++ u32 port_handle; ++ u32 action; /* enum mmal_msg_port_action_type */ ++ struct mmal_port port; ++}; ++ ++/* port action requests that take handles as a parameter */ ++struct mmal_msg_port_action_handle { ++ u32 component_handle; ++ u32 port_handle; ++ u32 action; /* enum mmal_msg_port_action_type */ ++ u32 connect_component_handle; ++ u32 connect_port_handle; ++}; ++ ++struct mmal_msg_port_action_reply { ++ u32 status; /** The port action operation status */ ++}; ++ ++ ++ ++ ++/* MMAL buffer transfer */ ++ ++/** Size of space reserved in a buffer message for short messages. */ ++#define MMAL_VC_SHORT_DATA 128 ++ ++/** Signals that the current payload is the end of the stream of data */ ++#define MMAL_BUFFER_HEADER_FLAG_EOS (1<<0) ++/** Signals that the start of the current payload starts a frame */ ++#define MMAL_BUFFER_HEADER_FLAG_FRAME_START (1<<1) ++/** Signals that the end of the current payload ends a frame */ ++#define MMAL_BUFFER_HEADER_FLAG_FRAME_END (1<<2) ++/** Signals that the current payload contains only complete frames (>1) */ ++#define MMAL_BUFFER_HEADER_FLAG_FRAME \ ++ (MMAL_BUFFER_HEADER_FLAG_FRAME_START|MMAL_BUFFER_HEADER_FLAG_FRAME_END) ++/** Signals that the current payload is a keyframe (i.e. self decodable) */ ++#define MMAL_BUFFER_HEADER_FLAG_KEYFRAME (1<<3) ++/** Signals a discontinuity in the stream of data (e.g. after a seek). ++ * Can be used for instance by a decoder to reset its state */ ++#define MMAL_BUFFER_HEADER_FLAG_DISCONTINUITY (1<<4) ++/** Signals a buffer containing some kind of config data for the component ++ * (e.g. codec config data) */ ++#define MMAL_BUFFER_HEADER_FLAG_CONFIG (1<<5) ++/** Signals an encrypted payload */ ++#define MMAL_BUFFER_HEADER_FLAG_ENCRYPTED (1<<6) ++/** Signals a buffer containing side information */ ++#define MMAL_BUFFER_HEADER_FLAG_CODECSIDEINFO (1<<7) ++/** Signals a buffer which is the snapshot/postview image from a stills ++ * capture ++ */ ++#define MMAL_BUFFER_HEADER_FLAGS_SNAPSHOT (1<<8) ++/** Signals a buffer which contains data known to be corrupted */ ++#define MMAL_BUFFER_HEADER_FLAG_CORRUPTED (1<<9) ++/** Signals that a buffer failed to be transmitted */ ++#define MMAL_BUFFER_HEADER_FLAG_TRANSMISSION_FAILED (1<<10) ++ ++struct mmal_driver_buffer { ++ u32 magic; ++ u32 component_handle; ++ u32 port_handle; ++ void *client_context; ++}; ++ ++/* buffer header */ ++struct mmal_buffer_header { ++ struct mmal_buffer_header *next; /* next header */ ++ void *priv; /* framework private data */ ++ u32 cmd; ++ void *data; ++ u32 alloc_size; ++ u32 length; ++ u32 offset; ++ u32 flags; ++ s64 pts; ++ s64 dts; ++ void *type; ++ void *user_data; ++}; ++ ++struct mmal_buffer_header_type_specific { ++ union { ++ struct { ++ u32 planes; ++ u32 offset[4]; ++ u32 pitch[4]; ++ u32 flags; ++ } video; ++ } u; ++}; ++ ++struct mmal_msg_buffer_from_host { ++ /* The front 32 bytes of the buffer header are copied ++ * back to us in the reply to allow for context. This ++ * area is used to store two mmal_driver_buffer structures to ++ * allow for multiple concurrent service users. ++ */ ++ /* control data */ ++ struct mmal_driver_buffer drvbuf; ++ ++ /* referenced control data for passthrough buffer management */ ++ struct mmal_driver_buffer drvbuf_ref; ++ struct mmal_buffer_header buffer_header; /* buffer header itself */ ++ struct mmal_buffer_header_type_specific buffer_header_type_specific; ++ s32 is_zero_copy; ++ s32 has_reference; ++ ++ /** allows short data to be xfered in control message */ ++ u32 payload_in_message; ++ u8 short_data[MMAL_VC_SHORT_DATA]; ++}; ++ ++ ++/* port parameter setting */ ++ ++#define MMAL_WORKER_PORT_PARAMETER_SPACE 96 ++ ++struct mmal_msg_port_parameter_set { ++ u32 component_handle; /* component */ ++ u32 port_handle; /* port */ ++ u32 id; /* Parameter ID */ ++ u32 size; /* Parameter size */ ++ uint32_t value[MMAL_WORKER_PORT_PARAMETER_SPACE]; ++}; ++ ++struct mmal_msg_port_parameter_set_reply { ++ u32 status; /** enum mmal_msg_status todo: how does this ++ * differ to the one in the header? ++ */ ++}; ++ ++/* port parameter getting */ ++ ++struct mmal_msg_port_parameter_get { ++ u32 component_handle; /* component */ ++ u32 port_handle; /* port */ ++ u32 id; /* Parameter ID */ ++ u32 size; /* Parameter size */ ++}; ++ ++struct mmal_msg_port_parameter_get_reply { ++ u32 status; /* Status of mmal_port_parameter_get call */ ++ u32 id; /* Parameter ID */ ++ u32 size; /* Parameter size */ ++ uint32_t value[MMAL_WORKER_PORT_PARAMETER_SPACE]; ++}; ++ ++/* event messages */ ++#define MMAL_WORKER_EVENT_SPACE 256 ++ ++struct mmal_msg_event_to_host { ++ void *client_component; /* component context */ ++ ++ u32 port_type; ++ u32 port_num; ++ ++ u32 cmd; ++ u32 length; ++ u8 data[MMAL_WORKER_EVENT_SPACE]; ++ struct mmal_buffer_header *delayed_buffer; ++}; ++ ++/* all mmal messages are serialised through this structure */ ++struct mmal_msg { ++ /* header */ ++ struct mmal_msg_header h; ++ /* payload */ ++ union { ++ struct mmal_msg_version version; ++ ++ struct mmal_msg_component_create component_create; ++ struct mmal_msg_component_create_reply component_create_reply; ++ ++ struct mmal_msg_component_destroy component_destroy; ++ struct mmal_msg_component_destroy_reply component_destroy_reply; ++ ++ struct mmal_msg_component_enable component_enable; ++ struct mmal_msg_component_enable_reply component_enable_reply; ++ ++ struct mmal_msg_component_disable component_disable; ++ struct mmal_msg_component_disable_reply component_disable_reply; ++ ++ struct mmal_msg_port_info_get port_info_get; ++ struct mmal_msg_port_info_get_reply port_info_get_reply; ++ ++ struct mmal_msg_port_info_set port_info_set; ++ struct mmal_msg_port_info_set_reply port_info_set_reply; ++ ++ struct mmal_msg_port_action_port port_action_port; ++ struct mmal_msg_port_action_handle port_action_handle; ++ struct mmal_msg_port_action_reply port_action_reply; ++ ++ struct mmal_msg_buffer_from_host buffer_from_host; ++ ++ struct mmal_msg_port_parameter_set port_parameter_set; ++ struct mmal_msg_port_parameter_set_reply ++ port_parameter_set_reply; ++ struct mmal_msg_port_parameter_get ++ port_parameter_get; ++ struct mmal_msg_port_parameter_get_reply ++ port_parameter_get_reply; ++ ++ struct mmal_msg_event_to_host event_to_host; ++ ++ u8 payload[MMAL_MSG_MAX_PAYLOAD]; ++ } u; ++}; +diff --git a/drivers/media/platform/bcm2835/mmal-parameters.h b/drivers/media/platform/bcm2835/mmal-parameters.h +new file mode 100644 +index 0000000..f6abb5c +--- /dev/null ++++ b/drivers/media/platform/bcm2835/mmal-parameters.h +@@ -0,0 +1,689 @@ ++/* ++ * Broadcom BM2835 V4L2 driver ++ * ++ * Copyright © 2013 Raspberry Pi (Trading) Ltd. ++ * ++ * This file is subject to the terms and conditions of the GNU General Public ++ * License. See the file COPYING in the main directory of this archive ++ * for more details. ++ * ++ * Authors: Vincent Sanders <vincent.sanders@collabora.co.uk> ++ * Dave Stevenson <dsteve@broadcom.com> ++ * Simon Mellor <simellor@broadcom.com> ++ * Luke Diamand <luked@broadcom.com> ++ */ ++ ++/* common parameters */ ++ ++/** @name Parameter groups ++ * Parameters are divided into groups, and then allocated sequentially within ++ * a group using an enum. ++ * @{ ++ */ ++ ++/** Common parameter ID group, used with many types of component. */ ++#define MMAL_PARAMETER_GROUP_COMMON (0<<16) ++/** Camera-specific parameter ID group. */ ++#define MMAL_PARAMETER_GROUP_CAMERA (1<<16) ++/** Video-specific parameter ID group. */ ++#define MMAL_PARAMETER_GROUP_VIDEO (2<<16) ++/** Audio-specific parameter ID group. */ ++#define MMAL_PARAMETER_GROUP_AUDIO (3<<16) ++/** Clock-specific parameter ID group. */ ++#define MMAL_PARAMETER_GROUP_CLOCK (4<<16) ++/** Miracast-specific parameter ID group. */ ++#define MMAL_PARAMETER_GROUP_MIRACAST (5<<16) ++ ++/* Common parameters */ ++enum mmal_parameter_common_type { ++ MMAL_PARAMETER_UNUSED /**< Never a valid parameter ID */ ++ = MMAL_PARAMETER_GROUP_COMMON, ++ MMAL_PARAMETER_SUPPORTED_ENCODINGS, /**< MMAL_PARAMETER_ENCODING_T */ ++ MMAL_PARAMETER_URI, /**< MMAL_PARAMETER_URI_T */ ++ ++ /** MMAL_PARAMETER_CHANGE_EVENT_REQUEST_T */ ++ MMAL_PARAMETER_CHANGE_EVENT_REQUEST, ++ ++ /** MMAL_PARAMETER_BOOLEAN_T */ ++ MMAL_PARAMETER_ZERO_COPY, ++ ++ /**< MMAL_PARAMETER_BUFFER_REQUIREMENTS_T */ ++ MMAL_PARAMETER_BUFFER_REQUIREMENTS, ++ ++ MMAL_PARAMETER_STATISTICS, /**< MMAL_PARAMETER_STATISTICS_T */ ++ MMAL_PARAMETER_CORE_STATISTICS, /**< MMAL_PARAMETER_CORE_STATISTICS_T */ ++ MMAL_PARAMETER_MEM_USAGE, /**< MMAL_PARAMETER_MEM_USAGE_T */ ++ MMAL_PARAMETER_BUFFER_FLAG_FILTER, /**< MMAL_PARAMETER_UINT32_T */ ++ MMAL_PARAMETER_SEEK, /**< MMAL_PARAMETER_SEEK_T */ ++ MMAL_PARAMETER_POWERMON_ENABLE, /**< MMAL_PARAMETER_BOOLEAN_T */ ++ MMAL_PARAMETER_LOGGING, /**< MMAL_PARAMETER_LOGGING_T */ ++ MMAL_PARAMETER_SYSTEM_TIME, /**< MMAL_PARAMETER_UINT64_T */ ++ MMAL_PARAMETER_NO_IMAGE_PADDING /**< MMAL_PARAMETER_BOOLEAN_T */ ++}; ++ ++/* camera parameters */ ++ ++enum mmal_parameter_camera_type { ++ /* 0 */ ++ /** @ref MMAL_PARAMETER_THUMBNAIL_CONFIG_T */ ++ MMAL_PARAMETER_THUMBNAIL_CONFIGURATION ++ = MMAL_PARAMETER_GROUP_CAMERA, ++ MMAL_PARAMETER_CAPTURE_QUALITY, /**< Unused? */ ++ MMAL_PARAMETER_ROTATION, /**< @ref MMAL_PARAMETER_INT32_T */ ++ MMAL_PARAMETER_EXIF_DISABLE, /**< @ref MMAL_PARAMETER_BOOLEAN_T */ ++ MMAL_PARAMETER_EXIF, /**< @ref MMAL_PARAMETER_EXIF_T */ ++ MMAL_PARAMETER_AWB_MODE, /**< @ref MMAL_PARAM_AWBMODE_T */ ++ MMAL_PARAMETER_IMAGE_EFFECT, /**< @ref MMAL_PARAMETER_IMAGEFX_T */ ++ MMAL_PARAMETER_COLOUR_EFFECT, /**< @ref MMAL_PARAMETER_COLOURFX_T */ ++ MMAL_PARAMETER_FLICKER_AVOID, /**< @ref MMAL_PARAMETER_FLICKERAVOID_T */ ++ MMAL_PARAMETER_FLASH, /**< @ref MMAL_PARAMETER_FLASH_T */ ++ MMAL_PARAMETER_REDEYE, /**< @ref MMAL_PARAMETER_REDEYE_T */ ++ MMAL_PARAMETER_FOCUS, /**< @ref MMAL_PARAMETER_FOCUS_T */ ++ MMAL_PARAMETER_FOCAL_LENGTHS, /**< Unused? */ ++ MMAL_PARAMETER_EXPOSURE_COMP, /**< @ref MMAL_PARAMETER_INT32_T */ ++ MMAL_PARAMETER_ZOOM, /**< @ref MMAL_PARAMETER_SCALEFACTOR_T */ ++ MMAL_PARAMETER_MIRROR, /**< @ref MMAL_PARAMETER_MIRROR_T */ ++ ++ /* 0x10 */ ++ MMAL_PARAMETER_CAMERA_NUM, /**< @ref MMAL_PARAMETER_UINT32_T */ ++ MMAL_PARAMETER_CAPTURE, /**< @ref MMAL_PARAMETER_BOOLEAN_T */ ++ MMAL_PARAMETER_EXPOSURE_MODE, /**< @ref MMAL_PARAMETER_EXPOSUREMODE_T */ ++ MMAL_PARAMETER_EXP_METERING_MODE, /**< @ref MMAL_PARAMETER_EXPOSUREMETERINGMODE_T */ ++ MMAL_PARAMETER_FOCUS_STATUS, /**< @ref MMAL_PARAMETER_FOCUS_STATUS_T */ ++ MMAL_PARAMETER_CAMERA_CONFIG, /**< @ref MMAL_PARAMETER_CAMERA_CONFIG_T */ ++ MMAL_PARAMETER_CAPTURE_STATUS, /**< @ref MMAL_PARAMETER_CAPTURE_STATUS_T */ ++ MMAL_PARAMETER_FACE_TRACK, /**< @ref MMAL_PARAMETER_FACE_TRACK_T */ ++ MMAL_PARAMETER_DRAW_BOX_FACES_AND_FOCUS, /**< @ref MMAL_PARAMETER_BOOLEAN_T */ ++ MMAL_PARAMETER_JPEG_Q_FACTOR, /**< @ref MMAL_PARAMETER_UINT32_T */ ++ MMAL_PARAMETER_FRAME_RATE, /**< @ref MMAL_PARAMETER_FRAME_RATE_T */ ++ MMAL_PARAMETER_USE_STC, /**< @ref MMAL_PARAMETER_CAMERA_STC_MODE_T */ ++ MMAL_PARAMETER_CAMERA_INFO, /**< @ref MMAL_PARAMETER_CAMERA_INFO_T */ ++ MMAL_PARAMETER_VIDEO_STABILISATION, /**< @ref MMAL_PARAMETER_BOOLEAN_T */ ++ MMAL_PARAMETER_FACE_TRACK_RESULTS, /**< @ref MMAL_PARAMETER_FACE_TRACK_RESULTS_T */ ++ MMAL_PARAMETER_ENABLE_RAW_CAPTURE, /**< @ref MMAL_PARAMETER_BOOLEAN_T */ ++ ++ /* 0x20 */ ++ MMAL_PARAMETER_DPF_FILE, /**< @ref MMAL_PARAMETER_URI_T */ ++ MMAL_PARAMETER_ENABLE_DPF_FILE, /**< @ref MMAL_PARAMETER_BOOLEAN_T */ ++ MMAL_PARAMETER_DPF_FAIL_IS_FATAL, /**< @ref MMAL_PARAMETER_BOOLEAN_T */ ++ MMAL_PARAMETER_CAPTURE_MODE, /**< @ref MMAL_PARAMETER_CAPTUREMODE_T */ ++ MMAL_PARAMETER_FOCUS_REGIONS, /**< @ref MMAL_PARAMETER_FOCUS_REGIONS_T */ ++ MMAL_PARAMETER_INPUT_CROP, /**< @ref MMAL_PARAMETER_INPUT_CROP_T */ ++ MMAL_PARAMETER_SENSOR_INFORMATION, /**< @ref MMAL_PARAMETER_SENSOR_INFORMATION_T */ ++ MMAL_PARAMETER_FLASH_SELECT, /**< @ref MMAL_PARAMETER_FLASH_SELECT_T */ ++ MMAL_PARAMETER_FIELD_OF_VIEW, /**< @ref MMAL_PARAMETER_FIELD_OF_VIEW_T */ ++ MMAL_PARAMETER_HIGH_DYNAMIC_RANGE, /**< @ref MMAL_PARAMETER_BOOLEAN_T */ ++ MMAL_PARAMETER_DYNAMIC_RANGE_COMPRESSION, /**< @ref MMAL_PARAMETER_DRC_T */ ++ MMAL_PARAMETER_ALGORITHM_CONTROL, /**< @ref MMAL_PARAMETER_ALGORITHM_CONTROL_T */ ++ MMAL_PARAMETER_SHARPNESS, /**< @ref MMAL_PARAMETER_RATIONAL_T */ ++ MMAL_PARAMETER_CONTRAST, /**< @ref MMAL_PARAMETER_RATIONAL_T */ ++ MMAL_PARAMETER_BRIGHTNESS, /**< @ref MMAL_PARAMETER_RATIONAL_T */ ++ MMAL_PARAMETER_SATURATION, /**< @ref MMAL_PARAMETER_RATIONAL_T */ ++ ++ /* 0x30 */ ++ MMAL_PARAMETER_ISO, /**< @ref MMAL_PARAMETER_UINT32_T */ ++ MMAL_PARAMETER_ANTISHAKE, /**< @ref MMAL_PARAMETER_BOOLEAN_T */ ++ ++ /** @ref MMAL_PARAMETER_IMAGEFX_PARAMETERS_T */ ++ MMAL_PARAMETER_IMAGE_EFFECT_PARAMETERS, ++ ++ /** @ref MMAL_PARAMETER_BOOLEAN_T */ ++ MMAL_PARAMETER_CAMERA_BURST_CAPTURE, ++ ++ /** @ref MMAL_PARAMETER_UINT32_T */ ++ MMAL_PARAMETER_CAMERA_MIN_ISO, ++ ++ /** @ref MMAL_PARAMETER_CAMERA_USE_CASE_T */ ++ MMAL_PARAMETER_CAMERA_USE_CASE, ++ ++ /**< @ref MMAL_PARAMETER_BOOLEAN_T */ ++ MMAL_PARAMETER_CAPTURE_STATS_PASS, ++ ++ /** @ref MMAL_PARAMETER_UINT32_T */ ++ MMAL_PARAMETER_CAMERA_CUSTOM_SENSOR_CONFIG, ++ ++ /** @ref MMAL_PARAMETER_BOOLEAN_T */ ++ MMAL_PARAMETER_ENABLE_REGISTER_FILE, ++ ++ /** @ref MMAL_PARAMETER_BOOLEAN_T */ ++ MMAL_PARAMETER_REGISTER_FAIL_IS_FATAL, ++ ++ /** @ref MMAL_PARAMETER_CONFIGFILE_T */ ++ MMAL_PARAMETER_CONFIGFILE_REGISTERS, ++ ++ /** @ref MMAL_PARAMETER_CONFIGFILE_CHUNK_T */ ++ MMAL_PARAMETER_CONFIGFILE_CHUNK_REGISTERS, ++ MMAL_PARAMETER_JPEG_ATTACH_LOG, /**< @ref MMAL_PARAMETER_BOOLEAN_T */ ++ MMAL_PARAMETER_ZERO_SHUTTER_LAG, /**< @ref MMAL_PARAMETER_ZEROSHUTTERLAG_T */ ++ MMAL_PARAMETER_FPS_RANGE, /**< @ref MMAL_PARAMETER_FPS_RANGE_T */ ++ MMAL_PARAMETER_CAPTURE_EXPOSURE_COMP, /**< @ref MMAL_PARAMETER_INT32_T */ ++ ++ /* 0x40 */ ++ MMAL_PARAMETER_SW_SHARPEN_DISABLE, /**< @ref MMAL_PARAMETER_BOOLEAN_T */ ++ MMAL_PARAMETER_FLASH_REQUIRED, /**< @ref MMAL_PARAMETER_BOOLEAN_T */ ++ MMAL_PARAMETER_SW_SATURATION_DISABLE, /**< @ref MMAL_PARAMETER_BOOLEAN_T */ ++ MMAL_PARAMETER_SHUTTER_SPEED, /**< Takes a @ref MMAL_PARAMETER_UINT32_T */ ++ MMAL_PARAMETER_CUSTOM_AWB_GAINS, /**< Takes a @ref MMAL_PARAMETER_AWB_GAINS_T */ ++}; ++ ++struct mmal_parameter_rational { ++ s32 num; /**< Numerator */ ++ s32 den; /**< Denominator */ ++}; ++ ++enum mmal_parameter_camera_config_timestamp_mode { ++ MMAL_PARAM_TIMESTAMP_MODE_ZERO = 0, /* Always timestamp frames as 0 */ ++ MMAL_PARAM_TIMESTAMP_MODE_RAW_STC, /* Use the raw STC value ++ * for the frame timestamp ++ */ ++ MMAL_PARAM_TIMESTAMP_MODE_RESET_STC, /* Use the STC timestamp ++ * but subtract the ++ * timestamp of the first ++ * frame sent to give a ++ * zero based timestamp. ++ */ ++}; ++ ++struct mmal_parameter_fps_range { ++ /**< Low end of the permitted framerate range */ ++ struct mmal_parameter_rational fps_low; ++ /**< High end of the permitted framerate range */ ++ struct mmal_parameter_rational fps_high; ++}; ++ ++ ++/* camera configuration parameter */ ++struct mmal_parameter_camera_config { ++ /* Parameters for setting up the image pools */ ++ u32 max_stills_w; /* Max size of stills capture */ ++ u32 max_stills_h; ++ u32 stills_yuv422; /* Allow YUV422 stills capture */ ++ u32 one_shot_stills; /* Continuous or one shot stills captures. */ ++ ++ u32 max_preview_video_w; /* Max size of the preview or video ++ * capture frames ++ */ ++ u32 max_preview_video_h; ++ u32 num_preview_video_frames; ++ ++ /** Sets the height of the circular buffer for stills capture. */ ++ u32 stills_capture_circular_buffer_height; ++ ++ /** Allows preview/encode to resume as fast as possible after the stills ++ * input frame has been received, and then processes the still frame in ++ * the background whilst preview/encode has resumed. ++ * Actual mode is controlled by MMAL_PARAMETER_CAPTURE_MODE. ++ */ ++ u32 fast_preview_resume; ++ ++ /** Selects algorithm for timestamping frames if ++ * there is no clock component connected. ++ * enum mmal_parameter_camera_config_timestamp_mode ++ */ ++ s32 use_stc_timestamp; ++}; ++ ++ ++enum mmal_parameter_exposuremode { ++ MMAL_PARAM_EXPOSUREMODE_OFF, ++ MMAL_PARAM_EXPOSUREMODE_AUTO, ++ MMAL_PARAM_EXPOSUREMODE_NIGHT, ++ MMAL_PARAM_EXPOSUREMODE_NIGHTPREVIEW, ++ MMAL_PARAM_EXPOSUREMODE_BACKLIGHT, ++ MMAL_PARAM_EXPOSUREMODE_SPOTLIGHT, ++ MMAL_PARAM_EXPOSUREMODE_SPORTS, ++ MMAL_PARAM_EXPOSUREMODE_SNOW, ++ MMAL_PARAM_EXPOSUREMODE_BEACH, ++ MMAL_PARAM_EXPOSUREMODE_VERYLONG, ++ MMAL_PARAM_EXPOSUREMODE_FIXEDFPS, ++ MMAL_PARAM_EXPOSUREMODE_ANTISHAKE, ++ MMAL_PARAM_EXPOSUREMODE_FIREWORKS, ++}; ++ ++enum mmal_parameter_exposuremeteringmode { ++ MMAL_PARAM_EXPOSUREMETERINGMODE_AVERAGE, ++ MMAL_PARAM_EXPOSUREMETERINGMODE_SPOT, ++ MMAL_PARAM_EXPOSUREMETERINGMODE_BACKLIT, ++ MMAL_PARAM_EXPOSUREMETERINGMODE_MATRIX, ++}; ++ ++enum mmal_parameter_awbmode { ++ MMAL_PARAM_AWBMODE_OFF, ++ MMAL_PARAM_AWBMODE_AUTO, ++ MMAL_PARAM_AWBMODE_SUNLIGHT, ++ MMAL_PARAM_AWBMODE_CLOUDY, ++ MMAL_PARAM_AWBMODE_SHADE, ++ MMAL_PARAM_AWBMODE_TUNGSTEN, ++ MMAL_PARAM_AWBMODE_FLUORESCENT, ++ MMAL_PARAM_AWBMODE_INCANDESCENT, ++ MMAL_PARAM_AWBMODE_FLASH, ++ MMAL_PARAM_AWBMODE_HORIZON, ++}; ++ ++enum mmal_parameter_imagefx { ++ MMAL_PARAM_IMAGEFX_NONE, ++ MMAL_PARAM_IMAGEFX_NEGATIVE, ++ MMAL_PARAM_IMAGEFX_SOLARIZE, ++ MMAL_PARAM_IMAGEFX_POSTERIZE, ++ MMAL_PARAM_IMAGEFX_WHITEBOARD, ++ MMAL_PARAM_IMAGEFX_BLACKBOARD, ++ MMAL_PARAM_IMAGEFX_SKETCH, ++ MMAL_PARAM_IMAGEFX_DENOISE, ++ MMAL_PARAM_IMAGEFX_EMBOSS, ++ MMAL_PARAM_IMAGEFX_OILPAINT, ++ MMAL_PARAM_IMAGEFX_HATCH, ++ MMAL_PARAM_IMAGEFX_GPEN, ++ MMAL_PARAM_IMAGEFX_PASTEL, ++ MMAL_PARAM_IMAGEFX_WATERCOLOUR, ++ MMAL_PARAM_IMAGEFX_FILM, ++ MMAL_PARAM_IMAGEFX_BLUR, ++ MMAL_PARAM_IMAGEFX_SATURATION, ++ MMAL_PARAM_IMAGEFX_COLOURSWAP, ++ MMAL_PARAM_IMAGEFX_WASHEDOUT, ++ MMAL_PARAM_IMAGEFX_POSTERISE, ++ MMAL_PARAM_IMAGEFX_COLOURPOINT, ++ MMAL_PARAM_IMAGEFX_COLOURBALANCE, ++ MMAL_PARAM_IMAGEFX_CARTOON, ++}; ++ ++enum MMAL_PARAM_FLICKERAVOID_T { ++ MMAL_PARAM_FLICKERAVOID_OFF, ++ MMAL_PARAM_FLICKERAVOID_AUTO, ++ MMAL_PARAM_FLICKERAVOID_50HZ, ++ MMAL_PARAM_FLICKERAVOID_60HZ, ++ MMAL_PARAM_FLICKERAVOID_MAX = 0x7FFFFFFF ++}; ++ ++struct mmal_parameter_awbgains { ++ struct mmal_parameter_rational r_gain; /**< Red gain */ ++ struct mmal_parameter_rational b_gain; /**< Blue gain */ ++}; ++ ++/** Manner of video rate control */ ++enum mmal_parameter_rate_control_mode { ++ MMAL_VIDEO_RATECONTROL_DEFAULT, ++ MMAL_VIDEO_RATECONTROL_VARIABLE, ++ MMAL_VIDEO_RATECONTROL_CONSTANT, ++ MMAL_VIDEO_RATECONTROL_VARIABLE_SKIP_FRAMES, ++ MMAL_VIDEO_RATECONTROL_CONSTANT_SKIP_FRAMES ++}; ++ ++enum mmal_video_profile { ++ MMAL_VIDEO_PROFILE_H263_BASELINE, ++ MMAL_VIDEO_PROFILE_H263_H320CODING, ++ MMAL_VIDEO_PROFILE_H263_BACKWARDCOMPATIBLE, ++ MMAL_VIDEO_PROFILE_H263_ISWV2, ++ MMAL_VIDEO_PROFILE_H263_ISWV3, ++ MMAL_VIDEO_PROFILE_H263_HIGHCOMPRESSION, ++ MMAL_VIDEO_PROFILE_H263_INTERNET, ++ MMAL_VIDEO_PROFILE_H263_INTERLACE, ++ MMAL_VIDEO_PROFILE_H263_HIGHLATENCY, ++ MMAL_VIDEO_PROFILE_MP4V_SIMPLE, ++ MMAL_VIDEO_PROFILE_MP4V_SIMPLESCALABLE, ++ MMAL_VIDEO_PROFILE_MP4V_CORE, ++ MMAL_VIDEO_PROFILE_MP4V_MAIN, ++ MMAL_VIDEO_PROFILE_MP4V_NBIT, ++ MMAL_VIDEO_PROFILE_MP4V_SCALABLETEXTURE, ++ MMAL_VIDEO_PROFILE_MP4V_SIMPLEFACE, ++ MMAL_VIDEO_PROFILE_MP4V_SIMPLEFBA, ++ MMAL_VIDEO_PROFILE_MP4V_BASICANIMATED, ++ MMAL_VIDEO_PROFILE_MP4V_HYBRID, ++ MMAL_VIDEO_PROFILE_MP4V_ADVANCEDREALTIME, ++ MMAL_VIDEO_PROFILE_MP4V_CORESCALABLE, ++ MMAL_VIDEO_PROFILE_MP4V_ADVANCEDCODING, ++ MMAL_VIDEO_PROFILE_MP4V_ADVANCEDCORE, ++ MMAL_VIDEO_PROFILE_MP4V_ADVANCEDSCALABLE, ++ MMAL_VIDEO_PROFILE_MP4V_ADVANCEDSIMPLE, ++ MMAL_VIDEO_PROFILE_H264_BASELINE, ++ MMAL_VIDEO_PROFILE_H264_MAIN, ++ MMAL_VIDEO_PROFILE_H264_EXTENDED, ++ MMAL_VIDEO_PROFILE_H264_HIGH, ++ MMAL_VIDEO_PROFILE_H264_HIGH10, ++ MMAL_VIDEO_PROFILE_H264_HIGH422, ++ MMAL_VIDEO_PROFILE_H264_HIGH444, ++ MMAL_VIDEO_PROFILE_H264_CONSTRAINED_BASELINE, ++ MMAL_VIDEO_PROFILE_DUMMY = 0x7FFFFFFF ++}; ++ ++enum mmal_video_level { ++ MMAL_VIDEO_LEVEL_H263_10, ++ MMAL_VIDEO_LEVEL_H263_20, ++ MMAL_VIDEO_LEVEL_H263_30, ++ MMAL_VIDEO_LEVEL_H263_40, ++ MMAL_VIDEO_LEVEL_H263_45, ++ MMAL_VIDEO_LEVEL_H263_50, ++ MMAL_VIDEO_LEVEL_H263_60, ++ MMAL_VIDEO_LEVEL_H263_70, ++ MMAL_VIDEO_LEVEL_MP4V_0, ++ MMAL_VIDEO_LEVEL_MP4V_0b, ++ MMAL_VIDEO_LEVEL_MP4V_1, ++ MMAL_VIDEO_LEVEL_MP4V_2, ++ MMAL_VIDEO_LEVEL_MP4V_3, ++ MMAL_VIDEO_LEVEL_MP4V_4, ++ MMAL_VIDEO_LEVEL_MP4V_4a, ++ MMAL_VIDEO_LEVEL_MP4V_5, ++ MMAL_VIDEO_LEVEL_MP4V_6, ++ MMAL_VIDEO_LEVEL_H264_1, ++ MMAL_VIDEO_LEVEL_H264_1b, ++ MMAL_VIDEO_LEVEL_H264_11, ++ MMAL_VIDEO_LEVEL_H264_12, ++ MMAL_VIDEO_LEVEL_H264_13, ++ MMAL_VIDEO_LEVEL_H264_2, ++ MMAL_VIDEO_LEVEL_H264_21, ++ MMAL_VIDEO_LEVEL_H264_22, ++ MMAL_VIDEO_LEVEL_H264_3, ++ MMAL_VIDEO_LEVEL_H264_31, ++ MMAL_VIDEO_LEVEL_H264_32, ++ MMAL_VIDEO_LEVEL_H264_4, ++ MMAL_VIDEO_LEVEL_H264_41, ++ MMAL_VIDEO_LEVEL_H264_42, ++ MMAL_VIDEO_LEVEL_H264_5, ++ MMAL_VIDEO_LEVEL_H264_51, ++ MMAL_VIDEO_LEVEL_DUMMY = 0x7FFFFFFF ++}; ++ ++struct mmal_parameter_video_profile { ++ enum mmal_video_profile profile; ++ enum mmal_video_level level; ++}; ++ ++/* video parameters */ ++ ++enum mmal_parameter_video_type { ++ /** @ref MMAL_DISPLAYREGION_T */ ++ MMAL_PARAMETER_DISPLAYREGION = MMAL_PARAMETER_GROUP_VIDEO, ++ ++ /** @ref MMAL_PARAMETER_VIDEO_PROFILE_T */ ++ MMAL_PARAMETER_SUPPORTED_PROFILES, ++ ++ /** @ref MMAL_PARAMETER_VIDEO_PROFILE_T */ ++ MMAL_PARAMETER_PROFILE, ++ ++ /** @ref MMAL_PARAMETER_UINT32_T */ ++ MMAL_PARAMETER_INTRAPERIOD, ++ ++ /** @ref MMAL_PARAMETER_VIDEO_RATECONTROL_T */ ++ MMAL_PARAMETER_RATECONTROL, ++ ++ /** @ref MMAL_PARAMETER_VIDEO_NALUNITFORMAT_T */ ++ MMAL_PARAMETER_NALUNITFORMAT, ++ ++ /** @ref MMAL_PARAMETER_BOOLEAN_T */ ++ MMAL_PARAMETER_MINIMISE_FRAGMENTATION, ++ ++ /** @ref MMAL_PARAMETER_UINT32_T. ++ * Setting the value to zero resets to the default (one slice per frame). ++ */ ++ MMAL_PARAMETER_MB_ROWS_PER_SLICE, ++ ++ /** @ref MMAL_PARAMETER_VIDEO_LEVEL_EXTENSION_T */ ++ MMAL_PARAMETER_VIDEO_LEVEL_EXTENSION, ++ ++ /** @ref MMAL_PARAMETER_VIDEO_EEDE_ENABLE_T */ ++ MMAL_PARAMETER_VIDEO_EEDE_ENABLE, ++ ++ /** @ref MMAL_PARAMETER_VIDEO_EEDE_LOSSRATE_T */ ++ MMAL_PARAMETER_VIDEO_EEDE_LOSSRATE, ++ ++ /** @ref MMAL_PARAMETER_BOOLEAN_T. Request an I-frame. */ ++ MMAL_PARAMETER_VIDEO_REQUEST_I_FRAME, ++ /** @ref MMAL_PARAMETER_VIDEO_INTRA_REFRESH_T */ ++ MMAL_PARAMETER_VIDEO_INTRA_REFRESH, ++ ++ /** @ref MMAL_PARAMETER_BOOLEAN_T. */ ++ MMAL_PARAMETER_VIDEO_IMMUTABLE_INPUT, ++ ++ /** @ref MMAL_PARAMETER_UINT32_T. Run-time bit rate control */ ++ MMAL_PARAMETER_VIDEO_BIT_RATE, ++ ++ /** @ref MMAL_PARAMETER_FRAME_RATE_T */ ++ MMAL_PARAMETER_VIDEO_FRAME_RATE, ++ ++ /** @ref MMAL_PARAMETER_UINT32_T. */ ++ MMAL_PARAMETER_VIDEO_ENCODE_MIN_QUANT, ++ ++ /** @ref MMAL_PARAMETER_UINT32_T. */ ++ MMAL_PARAMETER_VIDEO_ENCODE_MAX_QUANT, ++ ++ /** @ref MMAL_PARAMETER_VIDEO_ENCODE_RC_MODEL_T. */ ++ MMAL_PARAMETER_VIDEO_ENCODE_RC_MODEL, ++ ++ MMAL_PARAMETER_EXTRA_BUFFERS, /**< @ref MMAL_PARAMETER_UINT32_T. */ ++ /** @ref MMAL_PARAMETER_UINT32_T. ++ * Changing this parameter from the default can reduce frame rate ++ * because image buffers need to be re-pitched. ++ */ ++ MMAL_PARAMETER_VIDEO_ALIGN_HORIZ, ++ ++ /** @ref MMAL_PARAMETER_UINT32_T. ++ * Changing this parameter from the default can reduce frame rate ++ * because image buffers need to be re-pitched. ++ */ ++ MMAL_PARAMETER_VIDEO_ALIGN_VERT, ++ ++ /** @ref MMAL_PARAMETER_BOOLEAN_T. */ ++ MMAL_PARAMETER_VIDEO_DROPPABLE_PFRAMES, ++ ++ /** @ref MMAL_PARAMETER_UINT32_T. */ ++ MMAL_PARAMETER_VIDEO_ENCODE_INITIAL_QUANT, ++ ++ /**< @ref MMAL_PARAMETER_UINT32_T. */ ++ MMAL_PARAMETER_VIDEO_ENCODE_QP_P, ++ ++ /**< @ref MMAL_PARAMETER_UINT32_T. */ ++ MMAL_PARAMETER_VIDEO_ENCODE_RC_SLICE_DQUANT, ++ ++ /** @ref MMAL_PARAMETER_UINT32_T */ ++ MMAL_PARAMETER_VIDEO_ENCODE_FRAME_LIMIT_BITS, ++ ++ /** @ref MMAL_PARAMETER_UINT32_T. */ ++ MMAL_PARAMETER_VIDEO_ENCODE_PEAK_RATE, ++ ++ /* H264 specific parameters */ ++ ++ /** @ref MMAL_PARAMETER_BOOLEAN_T. */ ++ MMAL_PARAMETER_VIDEO_ENCODE_H264_DISABLE_CABAC, ++ ++ /** @ref MMAL_PARAMETER_BOOLEAN_T. */ ++ MMAL_PARAMETER_VIDEO_ENCODE_H264_LOW_LATENCY, ++ ++ /** @ref MMAL_PARAMETER_BOOLEAN_T. */ ++ MMAL_PARAMETER_VIDEO_ENCODE_H264_AU_DELIMITERS, ++ ++ /** @ref MMAL_PARAMETER_UINT32_T. */ ++ MMAL_PARAMETER_VIDEO_ENCODE_H264_DEBLOCK_IDC, ++ ++ /** @ref MMAL_PARAMETER_VIDEO_ENCODER_H264_MB_INTRA_MODES_T. */ ++ MMAL_PARAMETER_VIDEO_ENCODE_H264_MB_INTRA_MODE, ++ ++ /** @ref MMAL_PARAMETER_BOOLEAN_T */ ++ MMAL_PARAMETER_VIDEO_ENCODE_HEADER_ON_OPEN, ++ ++ /** @ref MMAL_PARAMETER_BOOLEAN_T */ ++ MMAL_PARAMETER_VIDEO_ENCODE_PRECODE_FOR_QP, ++ ++ /** @ref MMAL_PARAMETER_VIDEO_DRM_INIT_INFO_T. */ ++ MMAL_PARAMETER_VIDEO_DRM_INIT_INFO, ++ ++ /** @ref MMAL_PARAMETER_BOOLEAN_T */ ++ MMAL_PARAMETER_VIDEO_TIMESTAMP_FIFO, ++ ++ /** @ref MMAL_PARAMETER_BOOLEAN_T */ ++ MMAL_PARAMETER_VIDEO_DECODE_ERROR_CONCEALMENT, ++ ++ /** @ref MMAL_PARAMETER_VIDEO_DRM_PROTECT_BUFFER_T. */ ++ MMAL_PARAMETER_VIDEO_DRM_PROTECT_BUFFER, ++ ++ /** @ref MMAL_PARAMETER_BYTES_T */ ++ MMAL_PARAMETER_VIDEO_DECODE_CONFIG_VD3, ++ ++ /**< @ref MMAL_PARAMETER_BOOLEAN_T */ ++ MMAL_PARAMETER_VIDEO_ENCODE_H264_VCL_HRD_PARAMETERS, ++ ++ /**< @ref MMAL_PARAMETER_BOOLEAN_T */ ++ MMAL_PARAMETER_VIDEO_ENCODE_H264_LOW_DELAY_HRD_FLAG, ++ ++ /**< @ref MMAL_PARAMETER_BOOLEAN_T */ ++ MMAL_PARAMETER_VIDEO_ENCODE_INLINE_HEADER ++}; ++ ++/** Valid mirror modes */ ++enum mmal_parameter_mirror { ++ MMAL_PARAM_MIRROR_NONE, ++ MMAL_PARAM_MIRROR_VERTICAL, ++ MMAL_PARAM_MIRROR_HORIZONTAL, ++ MMAL_PARAM_MIRROR_BOTH, ++}; ++ ++enum mmal_parameter_displaytransform { ++ MMAL_DISPLAY_ROT0 = 0, ++ MMAL_DISPLAY_MIRROR_ROT0 = 1, ++ MMAL_DISPLAY_MIRROR_ROT180 = 2, ++ MMAL_DISPLAY_ROT180 = 3, ++ MMAL_DISPLAY_MIRROR_ROT90 = 4, ++ MMAL_DISPLAY_ROT270 = 5, ++ MMAL_DISPLAY_ROT90 = 6, ++ MMAL_DISPLAY_MIRROR_ROT270 = 7, ++}; ++ ++enum mmal_parameter_displaymode { ++ MMAL_DISPLAY_MODE_FILL = 0, ++ MMAL_DISPLAY_MODE_LETTERBOX = 1, ++}; ++ ++enum mmal_parameter_displayset { ++ MMAL_DISPLAY_SET_NONE = 0, ++ MMAL_DISPLAY_SET_NUM = 1, ++ MMAL_DISPLAY_SET_FULLSCREEN = 2, ++ MMAL_DISPLAY_SET_TRANSFORM = 4, ++ MMAL_DISPLAY_SET_DEST_RECT = 8, ++ MMAL_DISPLAY_SET_SRC_RECT = 0x10, ++ MMAL_DISPLAY_SET_MODE = 0x20, ++ MMAL_DISPLAY_SET_PIXEL = 0x40, ++ MMAL_DISPLAY_SET_NOASPECT = 0x80, ++ MMAL_DISPLAY_SET_LAYER = 0x100, ++ MMAL_DISPLAY_SET_COPYPROTECT = 0x200, ++ MMAL_DISPLAY_SET_ALPHA = 0x400, ++}; ++ ++struct mmal_parameter_displayregion { ++ /** Bitfield that indicates which fields are set and should be ++ * used. All other fields will maintain their current value. ++ * \ref MMAL_DISPLAYSET_T defines the bits that can be ++ * combined. ++ */ ++ u32 set; ++ ++ /** Describes the display output device, with 0 typically ++ * being a directly connected LCD display. The actual values ++ * will depend on the hardware. Code using hard-wired numbers ++ * (e.g. 2) is certain to fail. ++ */ ++ ++ u32 display_num; ++ /** Indicates that we are using the full device screen area, ++ * rather than a window of the display. If zero, then ++ * dest_rect is used to specify a region of the display to ++ * use. ++ */ ++ ++ s32 fullscreen; ++ /** Indicates any rotation or flipping used to map frames onto ++ * the natural display orientation. ++ */ ++ u32 transform; /* enum mmal_parameter_displaytransform */ ++ ++ /** Where to display the frame within the screen, if ++ * fullscreen is zero. ++ */ ++ struct vchiq_mmal_rect dest_rect; ++ ++ /** Indicates which area of the frame to display. If all ++ * values are zero, the whole frame will be used. ++ */ ++ struct vchiq_mmal_rect src_rect; ++ ++ /** If set to non-zero, indicates that any display scaling ++ * should disregard the aspect ratio of the frame region being ++ * displayed. ++ */ ++ s32 noaspect; ++ ++ /** Indicates how the image should be scaled to fit the ++ * display. \code MMAL_DISPLAY_MODE_FILL \endcode indicates ++ * that the image should fill the screen by potentially ++ * cropping the frames. Setting \code mode \endcode to \code ++ * MMAL_DISPLAY_MODE_LETTERBOX \endcode indicates that all the ++ * source region should be displayed and black bars added if ++ * necessary. ++ */ ++ u32 mode; /* enum mmal_parameter_displaymode */ ++ ++ /** If non-zero, defines the width of a source pixel relative ++ * to \code pixel_y \endcode. If zero, then pixels default to ++ * being square. ++ */ ++ u32 pixel_x; ++ ++ /** If non-zero, defines the height of a source pixel relative ++ * to \code pixel_x \endcode. If zero, then pixels default to ++ * being square. ++ */ ++ u32 pixel_y; ++ ++ /** Sets the relative depth of the images, with greater values ++ * being in front of smaller values. ++ */ ++ u32 layer; ++ ++ /** Set to non-zero to ensure copy protection is used on ++ * output. ++ */ ++ s32 copyprotect_required; ++ ++ /** Level of opacity of the layer, where zero is fully ++ * transparent and 255 is fully opaque. ++ */ ++ u32 alpha; ++}; ++ ++#define MMAL_MAX_IMAGEFX_PARAMETERS 5 ++ ++struct mmal_parameter_imagefx_parameters { ++ enum mmal_parameter_imagefx effect; ++ u32 num_effect_params; ++ u32 effect_parameter[MMAL_MAX_IMAGEFX_PARAMETERS]; ++}; ++ ++#define MMAL_PARAMETER_CAMERA_INFO_MAX_CAMERAS 4 ++#define MMAL_PARAMETER_CAMERA_INFO_MAX_FLASHES 2 ++#define MMAL_PARAMETER_CAMERA_INFO_MAX_STR_LEN 16 ++ ++struct mmal_parameter_camera_info_camera_t { ++ u32 port_id; ++ u32 max_width; ++ u32 max_height; ++ u32 lens_present; ++ u8 camera_name[MMAL_PARAMETER_CAMERA_INFO_MAX_STR_LEN]; ++}; ++ ++enum mmal_parameter_camera_info_flash_type_t { ++ /* Make values explicit to ensure they match values in config ini */ ++ MMAL_PARAMETER_CAMERA_INFO_FLASH_TYPE_XENON = 0, ++ MMAL_PARAMETER_CAMERA_INFO_FLASH_TYPE_LED = 1, ++ MMAL_PARAMETER_CAMERA_INFO_FLASH_TYPE_OTHER = 2, ++ MMAL_PARAMETER_CAMERA_INFO_FLASH_TYPE_MAX = 0x7FFFFFFF ++}; ++ ++struct mmal_parameter_camera_info_flash_t { ++ enum mmal_parameter_camera_info_flash_type_t flash_type; ++}; ++ ++struct mmal_parameter_camera_info_t { ++ u32 num_cameras; ++ u32 num_flashes; ++ struct mmal_parameter_camera_info_camera_t ++ cameras[MMAL_PARAMETER_CAMERA_INFO_MAX_CAMERAS]; ++ struct mmal_parameter_camera_info_flash_t ++ flashes[MMAL_PARAMETER_CAMERA_INFO_MAX_FLASHES]; ++}; +diff --git a/drivers/media/platform/bcm2835/mmal-vchiq.c b/drivers/media/platform/bcm2835/mmal-vchiq.c +new file mode 100644 +index 0000000..78132254 +--- /dev/null ++++ b/drivers/media/platform/bcm2835/mmal-vchiq.c +@@ -0,0 +1,1916 @@ ++/* ++ * Broadcom BM2835 V4L2 driver ++ * ++ * Copyright © 2013 Raspberry Pi (Trading) Ltd. ++ * ++ * This file is subject to the terms and conditions of the GNU General Public ++ * License. See the file COPYING in the main directory of this archive ++ * for more details. ++ * ++ * Authors: Vincent Sanders <vincent.sanders@collabora.co.uk> ++ * Dave Stevenson <dsteve@broadcom.com> ++ * Simon Mellor <simellor@broadcom.com> ++ * Luke Diamand <luked@broadcom.com> ++ * ++ * V4L2 driver MMAL vchiq interface code ++ */ ++ ++#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt ++ ++#include <linux/errno.h> ++#include <linux/kernel.h> ++#include <linux/mutex.h> ++#include <linux/mm.h> ++#include <linux/slab.h> ++#include <linux/completion.h> ++#include <linux/vmalloc.h> ++#include <asm/cacheflush.h> ++#include <media/videobuf2-vmalloc.h> ++ ++#include "mmal-common.h" ++#include "mmal-vchiq.h" ++#include "mmal-msg.h" ++ ++#define USE_VCHIQ_ARM ++#include "interface/vchi/vchi.h" ++ ++/* maximum number of components supported */ ++#define VCHIQ_MMAL_MAX_COMPONENTS 4 ++ ++/*#define FULL_MSG_DUMP 1*/ ++ ++#ifdef DEBUG ++static const char *const msg_type_names[] = { ++ "UNKNOWN", ++ "QUIT", ++ "SERVICE_CLOSED", ++ "GET_VERSION", ++ "COMPONENT_CREATE", ++ "COMPONENT_DESTROY", ++ "COMPONENT_ENABLE", ++ "COMPONENT_DISABLE", ++ "PORT_INFO_GET", ++ "PORT_INFO_SET", ++ "PORT_ACTION", ++ "BUFFER_FROM_HOST", ++ "BUFFER_TO_HOST", ++ "GET_STATS", ++ "PORT_PARAMETER_SET", ++ "PORT_PARAMETER_GET", ++ "EVENT_TO_HOST", ++ "GET_CORE_STATS_FOR_PORT", ++ "OPAQUE_ALLOCATOR", ++ "CONSUME_MEM", ++ "LMK", ++ "OPAQUE_ALLOCATOR_DESC", ++ "DRM_GET_LHS32", ++ "DRM_GET_TIME", ++ "BUFFER_FROM_HOST_ZEROLEN", ++ "PORT_FLUSH", ++ "HOST_LOG", ++}; ++#endif ++ ++static const char *const port_action_type_names[] = { ++ "UNKNOWN", ++ "ENABLE", ++ "DISABLE", ++ "FLUSH", ++ "CONNECT", ++ "DISCONNECT", ++ "SET_REQUIREMENTS", ++}; ++ ++#if defined(DEBUG) ++#if defined(FULL_MSG_DUMP) ++#define DBG_DUMP_MSG(MSG, MSG_LEN, TITLE) \ ++ do { \ ++ pr_debug(TITLE" type:%s(%d) length:%d\n", \ ++ msg_type_names[(MSG)->h.type], \ ++ (MSG)->h.type, (MSG_LEN)); \ ++ print_hex_dump(KERN_DEBUG, "<<h: ", DUMP_PREFIX_OFFSET, \ ++ 16, 4, (MSG), \ ++ sizeof(struct mmal_msg_header), 1); \ ++ print_hex_dump(KERN_DEBUG, "<<p: ", DUMP_PREFIX_OFFSET, \ ++ 16, 4, \ ++ ((u8 *)(MSG)) + sizeof(struct mmal_msg_header),\ ++ (MSG_LEN) - sizeof(struct mmal_msg_header), 1); \ ++ } while (0) ++#else ++#define DBG_DUMP_MSG(MSG, MSG_LEN, TITLE) \ ++ { \ ++ pr_debug(TITLE" type:%s(%d) length:%d\n", \ ++ msg_type_names[(MSG)->h.type], \ ++ (MSG)->h.type, (MSG_LEN)); \ ++ } ++#endif ++#else ++#define DBG_DUMP_MSG(MSG, MSG_LEN, TITLE) ++#endif ++ ++/* normal message context */ ++struct mmal_msg_context { ++ union { ++ struct { ++ /* work struct for defered callback - must come first */ ++ struct work_struct work; ++ /* mmal instance */ ++ struct vchiq_mmal_instance *instance; ++ /* mmal port */ ++ struct vchiq_mmal_port *port; ++ /* actual buffer used to store bulk reply */ ++ struct mmal_buffer *buffer; ++ /* amount of buffer used */ ++ unsigned long buffer_used; ++ /* MMAL buffer flags */ ++ u32 mmal_flags; ++ /* Presentation and Decode timestamps */ ++ s64 pts; ++ s64 dts; ++ ++ int status; /* context status */ ++ ++ } bulk; /* bulk data */ ++ ++ struct { ++ /* message handle to release */ ++ VCHI_HELD_MSG_T msg_handle; ++ /* pointer to received message */ ++ struct mmal_msg *msg; ++ /* received message length */ ++ u32 msg_len; ++ /* completion upon reply */ ++ struct completion cmplt; ++ } sync; /* synchronous response */ ++ } u; ++ ++}; ++ ++struct vchiq_mmal_instance { ++ VCHI_SERVICE_HANDLE_T handle; ++ ++ /* ensure serialised access to service */ ++ struct mutex vchiq_mutex; ++ ++ /* ensure serialised access to bulk operations */ ++ struct mutex bulk_mutex; ++ ++ /* vmalloc page to receive scratch bulk xfers into */ ++ void *bulk_scratch; ++ ++ /* component to use next */ ++ int component_idx; ++ struct vchiq_mmal_component component[VCHIQ_MMAL_MAX_COMPONENTS]; ++}; ++ ++static struct mmal_msg_context *get_msg_context(struct vchiq_mmal_instance ++ *instance) ++{ ++ struct mmal_msg_context *msg_context; ++ ++ /* todo: should this be allocated from a pool to avoid kmalloc */ ++ msg_context = kmalloc(sizeof(*msg_context), GFP_KERNEL); ++ memset(msg_context, 0, sizeof(*msg_context)); ++ ++ return msg_context; ++} ++ ++static void release_msg_context(struct mmal_msg_context *msg_context) ++{ ++ kfree(msg_context); ++} ++ ++/* deals with receipt of event to host message */ ++static void event_to_host_cb(struct vchiq_mmal_instance *instance, ++ struct mmal_msg *msg, u32 msg_len) ++{ ++ pr_debug("unhandled event\n"); ++ pr_debug("component:%p port type:%d num:%d cmd:0x%x length:%d\n", ++ msg->u.event_to_host.client_component, ++ msg->u.event_to_host.port_type, ++ msg->u.event_to_host.port_num, ++ msg->u.event_to_host.cmd, msg->u.event_to_host.length); ++} ++ ++/* workqueue scheduled callback ++ * ++ * we do this because it is important we do not call any other vchiq ++ * sync calls from witin the message delivery thread ++ */ ++static void buffer_work_cb(struct work_struct *work) ++{ ++ struct mmal_msg_context *msg_context = (struct mmal_msg_context *)work; ++ ++ msg_context->u.bulk.port->buffer_cb(msg_context->u.bulk.instance, ++ msg_context->u.bulk.port, ++ msg_context->u.bulk.status, ++ msg_context->u.bulk.buffer, ++ msg_context->u.bulk.buffer_used, ++ msg_context->u.bulk.mmal_flags, ++ msg_context->u.bulk.dts, ++ msg_context->u.bulk.pts); ++ ++ /* release message context */ ++ release_msg_context(msg_context); ++} ++ ++/* enqueue a bulk receive for a given message context */ ++static int bulk_receive(struct vchiq_mmal_instance *instance, ++ struct mmal_msg *msg, ++ struct mmal_msg_context *msg_context) ++{ ++ unsigned long rd_len; ++ unsigned long flags = 0; ++ int ret; ++ ++ /* bulk mutex stops other bulk operations while we have a ++ * receive in progress - released in callback ++ */ ++ ret = mutex_lock_interruptible(&instance->bulk_mutex); ++ if (ret != 0) ++ return ret; ++ ++ rd_len = msg->u.buffer_from_host.buffer_header.length; ++ ++ /* take buffer from queue */ ++ spin_lock_irqsave(&msg_context->u.bulk.port->slock, flags); ++ if (list_empty(&msg_context->u.bulk.port->buffers)) { ++ spin_unlock_irqrestore(&msg_context->u.bulk.port->slock, flags); ++ pr_err("buffer list empty trying to submit bulk receive\n"); ++ ++ /* todo: this is a serious error, we should never have ++ * commited a buffer_to_host operation to the mmal ++ * port without the buffer to back it up (underflow ++ * handling) and there is no obvious way to deal with ++ * this - how is the mmal servie going to react when ++ * we fail to do the xfer and reschedule a buffer when ++ * it arrives? perhaps a starved flag to indicate a ++ * waiting bulk receive? ++ */ ++ ++ mutex_unlock(&instance->bulk_mutex); ++ ++ return -EINVAL; ++ } ++ ++ msg_context->u.bulk.buffer = ++ list_entry(msg_context->u.bulk.port->buffers.next, ++ struct mmal_buffer, list); ++ list_del(&msg_context->u.bulk.buffer->list); ++ ++ spin_unlock_irqrestore(&msg_context->u.bulk.port->slock, flags); ++ ++ /* ensure we do not overrun the available buffer */ ++ if (rd_len > msg_context->u.bulk.buffer->buffer_size) { ++ rd_len = msg_context->u.bulk.buffer->buffer_size; ++ pr_warn("short read as not enough receive buffer space\n"); ++ /* todo: is this the correct response, what happens to ++ * the rest of the message data? ++ */ ++ } ++ ++ /* store length */ ++ msg_context->u.bulk.buffer_used = rd_len; ++ msg_context->u.bulk.mmal_flags = ++ msg->u.buffer_from_host.buffer_header.flags; ++ msg_context->u.bulk.dts = msg->u.buffer_from_host.buffer_header.dts; ++ msg_context->u.bulk.pts = msg->u.buffer_from_host.buffer_header.pts; ++ ++ // only need to flush L1 cache here, as VCHIQ takes care of the L2 ++ // cache. ++ __cpuc_flush_dcache_area(msg_context->u.bulk.buffer->buffer, rd_len); ++ ++ /* queue the bulk submission */ ++ vchi_service_use(instance->handle); ++ ret = vchi_bulk_queue_receive(instance->handle, ++ msg_context->u.bulk.buffer->buffer, ++ /* Actual receive needs to be a multiple ++ * of 4 bytes ++ */ ++ (rd_len + 3) & ~3, ++ VCHI_FLAGS_CALLBACK_WHEN_OP_COMPLETE | ++ VCHI_FLAGS_BLOCK_UNTIL_QUEUED, ++ msg_context); ++ ++ vchi_service_release(instance->handle); ++ ++ if (ret != 0) { ++ /* callback will not be clearing the mutex */ ++ mutex_unlock(&instance->bulk_mutex); ++ } ++ ++ return ret; ++} ++ ++/* enque a dummy bulk receive for a given message context */ ++static int dummy_bulk_receive(struct vchiq_mmal_instance *instance, ++ struct mmal_msg_context *msg_context) ++{ ++ int ret; ++ ++ /* bulk mutex stops other bulk operations while we have a ++ * receive in progress - released in callback ++ */ ++ ret = mutex_lock_interruptible(&instance->bulk_mutex); ++ if (ret != 0) ++ return ret; ++ ++ /* zero length indicates this was a dummy transfer */ ++ msg_context->u.bulk.buffer_used = 0; ++ ++ /* queue the bulk submission */ ++ vchi_service_use(instance->handle); ++ ++ ret = vchi_bulk_queue_receive(instance->handle, ++ instance->bulk_scratch, ++ 8, ++ VCHI_FLAGS_CALLBACK_WHEN_OP_COMPLETE | ++ VCHI_FLAGS_BLOCK_UNTIL_QUEUED, ++ msg_context); ++ ++ vchi_service_release(instance->handle); ++ ++ if (ret != 0) { ++ /* callback will not be clearing the mutex */ ++ mutex_unlock(&instance->bulk_mutex); ++ } ++ ++ return ret; ++} ++ ++/* data in message, memcpy from packet into output buffer */ ++static int inline_receive(struct vchiq_mmal_instance *instance, ++ struct mmal_msg *msg, ++ struct mmal_msg_context *msg_context) ++{ ++ unsigned long flags = 0; ++ ++ /* take buffer from queue */ ++ spin_lock_irqsave(&msg_context->u.bulk.port->slock, flags); ++ if (list_empty(&msg_context->u.bulk.port->buffers)) { ++ spin_unlock_irqrestore(&msg_context->u.bulk.port->slock, flags); ++ pr_err("buffer list empty trying to receive inline\n"); ++ ++ /* todo: this is a serious error, we should never have ++ * commited a buffer_to_host operation to the mmal ++ * port without the buffer to back it up (with ++ * underflow handling) and there is no obvious way to ++ * deal with this. Less bad than the bulk case as we ++ * can just drop this on the floor but...unhelpful ++ */ ++ return -EINVAL; ++ } ++ ++ msg_context->u.bulk.buffer = ++ list_entry(msg_context->u.bulk.port->buffers.next, ++ struct mmal_buffer, list); ++ list_del(&msg_context->u.bulk.buffer->list); ++ ++ spin_unlock_irqrestore(&msg_context->u.bulk.port->slock, flags); ++ ++ memcpy(msg_context->u.bulk.buffer->buffer, ++ msg->u.buffer_from_host.short_data, ++ msg->u.buffer_from_host.payload_in_message); ++ ++ msg_context->u.bulk.buffer_used = ++ msg->u.buffer_from_host.payload_in_message; ++ ++ return 0; ++} ++ ++/* queue the buffer availability with MMAL_MSG_TYPE_BUFFER_FROM_HOST */ ++static int ++buffer_from_host(struct vchiq_mmal_instance *instance, ++ struct vchiq_mmal_port *port, struct mmal_buffer *buf) ++{ ++ struct mmal_msg_context *msg_context; ++ struct mmal_msg m; ++ int ret; ++ ++ pr_debug("instance:%p buffer:%p\n", instance->handle, buf); ++ ++ /* bulk mutex stops other bulk operations while we ++ * have a receive in progress ++ */ ++ if (mutex_lock_interruptible(&instance->bulk_mutex)) ++ return -EINTR; ++ ++ /* get context */ ++ msg_context = get_msg_context(instance); ++ if (msg_context == NULL) ++ return -ENOMEM; ++ ++ /* store bulk message context for when data arrives */ ++ msg_context->u.bulk.instance = instance; ++ msg_context->u.bulk.port = port; ++ msg_context->u.bulk.buffer = NULL; /* not valid until bulk xfer */ ++ msg_context->u.bulk.buffer_used = 0; ++ ++ /* initialise work structure ready to schedule callback */ ++ INIT_WORK(&msg_context->u.bulk.work, buffer_work_cb); ++ ++ /* prep the buffer from host message */ ++ memset(&m, 0xbc, sizeof(m)); /* just to make debug clearer */ ++ ++ m.h.type = MMAL_MSG_TYPE_BUFFER_FROM_HOST; ++ m.h.magic = MMAL_MAGIC; ++ m.h.context = msg_context; ++ m.h.status = 0; ++ ++ /* drvbuf is our private data passed back */ ++ m.u.buffer_from_host.drvbuf.magic = MMAL_MAGIC; ++ m.u.buffer_from_host.drvbuf.component_handle = port->component->handle; ++ m.u.buffer_from_host.drvbuf.port_handle = port->handle; ++ m.u.buffer_from_host.drvbuf.client_context = msg_context; ++ ++ /* buffer header */ ++ m.u.buffer_from_host.buffer_header.cmd = 0; ++ m.u.buffer_from_host.buffer_header.data = buf->buffer; ++ m.u.buffer_from_host.buffer_header.alloc_size = buf->buffer_size; ++ m.u.buffer_from_host.buffer_header.length = 0; /* nothing used yet */ ++ m.u.buffer_from_host.buffer_header.offset = 0; /* no offset */ ++ m.u.buffer_from_host.buffer_header.flags = 0; /* no flags */ ++ m.u.buffer_from_host.buffer_header.pts = MMAL_TIME_UNKNOWN; ++ m.u.buffer_from_host.buffer_header.dts = MMAL_TIME_UNKNOWN; ++ ++ /* clear buffer type sepecific data */ ++ memset(&m.u.buffer_from_host.buffer_header_type_specific, 0, ++ sizeof(m.u.buffer_from_host.buffer_header_type_specific)); ++ ++ /* no payload in message */ ++ m.u.buffer_from_host.payload_in_message = 0; ++ ++ vchi_service_use(instance->handle); ++ ++ ret = vchi_msg_queue(instance->handle, &m, ++ sizeof(struct mmal_msg_header) + ++ sizeof(m.u.buffer_from_host), ++ VCHI_FLAGS_BLOCK_UNTIL_QUEUED, NULL); ++ ++ if (ret != 0) { ++ release_msg_context(msg_context); ++ /* todo: is this correct error value? */ ++ } ++ ++ vchi_service_release(instance->handle); ++ ++ mutex_unlock(&instance->bulk_mutex); ++ ++ return ret; ++} ++ ++/* submit a buffer to the mmal sevice ++ * ++ * the buffer_from_host uses size data from the ports next available ++ * mmal_buffer and deals with there being no buffer available by ++ * incrementing the underflow for later ++ */ ++static int port_buffer_from_host(struct vchiq_mmal_instance *instance, ++ struct vchiq_mmal_port *port) ++{ ++ int ret; ++ struct mmal_buffer *buf; ++ unsigned long flags = 0; ++ ++ if (!port->enabled) ++ return -EINVAL; ++ ++ /* peek buffer from queue */ ++ spin_lock_irqsave(&port->slock, flags); ++ if (list_empty(&port->buffers)) { ++ port->buffer_underflow++; ++ spin_unlock_irqrestore(&port->slock, flags); ++ return -ENOSPC; ++ } ++ ++ buf = list_entry(port->buffers.next, struct mmal_buffer, list); ++ ++ spin_unlock_irqrestore(&port->slock, flags); ++ ++ /* issue buffer to mmal service */ ++ ret = buffer_from_host(instance, port, buf); ++ if (ret) { ++ pr_err("adding buffer header failed\n"); ++ /* todo: how should this be dealt with */ ++ } ++ ++ return ret; ++} ++ ++/* deals with receipt of buffer to host message */ ++static void buffer_to_host_cb(struct vchiq_mmal_instance *instance, ++ struct mmal_msg *msg, u32 msg_len) ++{ ++ struct mmal_msg_context *msg_context; ++ ++ pr_debug("buffer_to_host_cb: instance:%p msg:%p msg_len:%d\n", ++ instance, msg, msg_len); ++ ++ if (msg->u.buffer_from_host.drvbuf.magic == MMAL_MAGIC) { ++ msg_context = msg->u.buffer_from_host.drvbuf.client_context; ++ } else { ++ pr_err("MMAL_MSG_TYPE_BUFFER_TO_HOST with bad magic\n"); ++ return; ++ } ++ ++ if (msg->h.status != MMAL_MSG_STATUS_SUCCESS) { ++ /* message reception had an error */ ++ pr_warn("error %d in reply\n", msg->h.status); ++ ++ msg_context->u.bulk.status = msg->h.status; ++ ++ } else if (msg->u.buffer_from_host.buffer_header.length == 0) { ++ /* empty buffer */ ++ if (msg->u.buffer_from_host.buffer_header.flags & ++ MMAL_BUFFER_HEADER_FLAG_EOS) { ++ msg_context->u.bulk.status = ++ dummy_bulk_receive(instance, msg_context); ++ if (msg_context->u.bulk.status == 0) ++ return; /* successful bulk submission, bulk ++ * completion will trigger callback ++ */ ++ } else { ++ /* do callback with empty buffer - not EOS though */ ++ msg_context->u.bulk.status = 0; ++ msg_context->u.bulk.buffer_used = 0; ++ } ++ } else if (msg->u.buffer_from_host.payload_in_message == 0) { ++ /* data is not in message, queue a bulk receive */ ++ msg_context->u.bulk.status = ++ bulk_receive(instance, msg, msg_context); ++ if (msg_context->u.bulk.status == 0) ++ return; /* successful bulk submission, bulk ++ * completion will trigger callback ++ */ ++ ++ /* failed to submit buffer, this will end badly */ ++ pr_err("error %d on bulk submission\n", ++ msg_context->u.bulk.status); ++ ++ } else if (msg->u.buffer_from_host.payload_in_message <= ++ MMAL_VC_SHORT_DATA) { ++ /* data payload within message */ ++ msg_context->u.bulk.status = inline_receive(instance, msg, ++ msg_context); ++ } else { ++ pr_err("message with invalid short payload\n"); ++ ++ /* signal error */ ++ msg_context->u.bulk.status = -EINVAL; ++ msg_context->u.bulk.buffer_used = ++ msg->u.buffer_from_host.payload_in_message; ++ } ++ ++ /* replace the buffer header */ ++ port_buffer_from_host(instance, msg_context->u.bulk.port); ++ ++ /* schedule the port callback */ ++ schedule_work(&msg_context->u.bulk.work); ++} ++ ++static void bulk_receive_cb(struct vchiq_mmal_instance *instance, ++ struct mmal_msg_context *msg_context) ++{ ++ /* bulk receive operation complete */ ++ mutex_unlock(&msg_context->u.bulk.instance->bulk_mutex); ++ ++ /* replace the buffer header */ ++ port_buffer_from_host(msg_context->u.bulk.instance, ++ msg_context->u.bulk.port); ++ ++ msg_context->u.bulk.status = 0; ++ ++ /* schedule the port callback */ ++ schedule_work(&msg_context->u.bulk.work); ++} ++ ++static void bulk_abort_cb(struct vchiq_mmal_instance *instance, ++ struct mmal_msg_context *msg_context) ++{ ++ pr_err("%s: bulk ABORTED msg_context:%p\n", __func__, msg_context); ++ ++ /* bulk receive operation complete */ ++ mutex_unlock(&msg_context->u.bulk.instance->bulk_mutex); ++ ++ /* replace the buffer header */ ++ port_buffer_from_host(msg_context->u.bulk.instance, ++ msg_context->u.bulk.port); ++ ++ msg_context->u.bulk.status = -EINTR; ++ ++ schedule_work(&msg_context->u.bulk.work); ++} ++ ++/* incoming event service callback */ ++static void service_callback(void *param, ++ const VCHI_CALLBACK_REASON_T reason, ++ void *bulk_ctx) ++{ ++ struct vchiq_mmal_instance *instance = param; ++ int status; ++ u32 msg_len; ++ struct mmal_msg *msg; ++ VCHI_HELD_MSG_T msg_handle; ++ ++ if (!instance) { ++ pr_err("Message callback passed NULL instance\n"); ++ return; ++ } ++ ++ switch (reason) { ++ case VCHI_CALLBACK_MSG_AVAILABLE: ++ status = vchi_msg_hold(instance->handle, (void **)&msg, ++ &msg_len, VCHI_FLAGS_NONE, &msg_handle); ++ if (status) { ++ pr_err("Unable to dequeue a message (%d)\n", status); ++ break; ++ } ++ ++ DBG_DUMP_MSG(msg, msg_len, "<<< reply message"); ++ ++ /* handling is different for buffer messages */ ++ switch (msg->h.type) { ++ ++ case MMAL_MSG_TYPE_BUFFER_FROM_HOST: ++ vchi_held_msg_release(&msg_handle); ++ break; ++ ++ case MMAL_MSG_TYPE_EVENT_TO_HOST: ++ event_to_host_cb(instance, msg, msg_len); ++ vchi_held_msg_release(&msg_handle); ++ ++ break; ++ ++ case MMAL_MSG_TYPE_BUFFER_TO_HOST: ++ buffer_to_host_cb(instance, msg, msg_len); ++ vchi_held_msg_release(&msg_handle); ++ break; ++ ++ default: ++ /* messages dependant on header context to complete */ ++ ++ /* todo: the msg.context really ought to be sanity ++ * checked before we just use it, afaict it comes back ++ * and is used raw from the videocore. Perhaps it ++ * should be verified the address lies in the kernel ++ * address space. ++ */ ++ if (msg->h.context == NULL) { ++ pr_err("received message context was null!\n"); ++ vchi_held_msg_release(&msg_handle); ++ break; ++ } ++ ++ /* fill in context values */ ++ msg->h.context->u.sync.msg_handle = msg_handle; ++ msg->h.context->u.sync.msg = msg; ++ msg->h.context->u.sync.msg_len = msg_len; ++ ++ /* todo: should this check (completion_done() ++ * == 1) for no one waiting? or do we need a ++ * flag to tell us the completion has been ++ * interrupted so we can free the message and ++ * its context. This probably also solves the ++ * message arriving after interruption todo ++ * below ++ */ ++ ++ /* complete message so caller knows it happened */ ++ complete(&msg->h.context->u.sync.cmplt); ++ break; ++ } ++ ++ break; ++ ++ case VCHI_CALLBACK_BULK_RECEIVED: ++ bulk_receive_cb(instance, bulk_ctx); ++ break; ++ ++ case VCHI_CALLBACK_BULK_RECEIVE_ABORTED: ++ bulk_abort_cb(instance, bulk_ctx); ++ break; ++ ++ case VCHI_CALLBACK_SERVICE_CLOSED: ++ /* TODO: consider if this requires action if received when ++ * driver is not explicitly closing the service ++ */ ++ break; ++ ++ default: ++ pr_err("Received unhandled message reason %d\n", reason); ++ break; ++ } ++} ++ ++static int send_synchronous_mmal_msg(struct vchiq_mmal_instance *instance, ++ struct mmal_msg *msg, ++ unsigned int payload_len, ++ struct mmal_msg **msg_out, ++ VCHI_HELD_MSG_T *msg_handle_out) ++{ ++ struct mmal_msg_context msg_context; ++ int ret; ++ ++ /* payload size must not cause message to exceed max size */ ++ if (payload_len > ++ (MMAL_MSG_MAX_SIZE - sizeof(struct mmal_msg_header))) { ++ pr_err("payload length %d exceeds max:%d\n", payload_len, ++ (MMAL_MSG_MAX_SIZE - sizeof(struct mmal_msg_header))); ++ return -EINVAL; ++ } ++ ++ init_completion(&msg_context.u.sync.cmplt); ++ ++ msg->h.magic = MMAL_MAGIC; ++ msg->h.context = &msg_context; ++ msg->h.status = 0; ++ ++ DBG_DUMP_MSG(msg, (sizeof(struct mmal_msg_header) + payload_len), ++ ">>> sync message"); ++ ++ vchi_service_use(instance->handle); ++ ++ ret = vchi_msg_queue(instance->handle, ++ msg, ++ sizeof(struct mmal_msg_header) + payload_len, ++ VCHI_FLAGS_BLOCK_UNTIL_QUEUED, NULL); ++ ++ vchi_service_release(instance->handle); ++ ++ if (ret) { ++ pr_err("error %d queuing message\n", ret); ++ return ret; ++ } ++ ++ ret = wait_for_completion_timeout(&msg_context.u.sync.cmplt, 3*HZ); ++ if (ret <= 0) { ++ pr_err("error %d waiting for sync completion\n", ret); ++ if (ret == 0) ++ ret = -ETIME; ++ /* todo: what happens if the message arrives after aborting */ ++ return ret; ++ } ++ ++ *msg_out = msg_context.u.sync.msg; ++ *msg_handle_out = msg_context.u.sync.msg_handle; ++ ++ return 0; ++} ++ ++static void dump_port_info(struct vchiq_mmal_port *port) ++{ ++ pr_debug("port handle:0x%x enabled:%d\n", port->handle, port->enabled); ++ ++ pr_debug("buffer minimum num:%d size:%d align:%d\n", ++ port->minimum_buffer.num, ++ port->minimum_buffer.size, port->minimum_buffer.alignment); ++ ++ pr_debug("buffer recommended num:%d size:%d align:%d\n", ++ port->recommended_buffer.num, ++ port->recommended_buffer.size, ++ port->recommended_buffer.alignment); ++ ++ pr_debug("buffer current values num:%d size:%d align:%d\n", ++ port->current_buffer.num, ++ port->current_buffer.size, port->current_buffer.alignment); ++ ++ pr_debug("elementry stream: type:%d encoding:0x%x varient:0x%x\n", ++ port->format.type, ++ port->format.encoding, port->format.encoding_variant); ++ ++ pr_debug(" bitrate:%d flags:0x%x\n", ++ port->format.bitrate, port->format.flags); ++ ++ if (port->format.type == MMAL_ES_TYPE_VIDEO) { ++ pr_debug ++ ("es video format: width:%d height:%d colourspace:0x%x\n", ++ port->es.video.width, port->es.video.height, ++ port->es.video.color_space); ++ ++ pr_debug(" : crop xywh %d,%d,%d,%d\n", ++ port->es.video.crop.x, ++ port->es.video.crop.y, ++ port->es.video.crop.width, port->es.video.crop.height); ++ pr_debug(" : framerate %d/%d aspect %d/%d\n", ++ port->es.video.frame_rate.num, ++ port->es.video.frame_rate.den, ++ port->es.video.par.num, port->es.video.par.den); ++ } ++} ++ ++static void port_to_mmal_msg(struct vchiq_mmal_port *port, struct mmal_port *p) ++{ ++ ++ /* todo do readonly fields need setting at all? */ ++ p->type = port->type; ++ p->index = port->index; ++ p->index_all = 0; ++ p->is_enabled = port->enabled; ++ p->buffer_num_min = port->minimum_buffer.num; ++ p->buffer_size_min = port->minimum_buffer.size; ++ p->buffer_alignment_min = port->minimum_buffer.alignment; ++ p->buffer_num_recommended = port->recommended_buffer.num; ++ p->buffer_size_recommended = port->recommended_buffer.size; ++ ++ /* only three writable fields in a port */ ++ p->buffer_num = port->current_buffer.num; ++ p->buffer_size = port->current_buffer.size; ++ p->userdata = port; ++} ++ ++static int port_info_set(struct vchiq_mmal_instance *instance, ++ struct vchiq_mmal_port *port) ++{ ++ int ret; ++ struct mmal_msg m; ++ struct mmal_msg *rmsg; ++ VCHI_HELD_MSG_T rmsg_handle; ++ ++ pr_debug("setting port info port %p\n", port); ++ if (!port) ++ return -1; ++ dump_port_info(port); ++ ++ m.h.type = MMAL_MSG_TYPE_PORT_INFO_SET; ++ ++ m.u.port_info_set.component_handle = port->component->handle; ++ m.u.port_info_set.port_type = port->type; ++ m.u.port_info_set.port_index = port->index; ++ ++ port_to_mmal_msg(port, &m.u.port_info_set.port); ++ ++ /* elementry stream format setup */ ++ m.u.port_info_set.format.type = port->format.type; ++ m.u.port_info_set.format.encoding = port->format.encoding; ++ m.u.port_info_set.format.encoding_variant = ++ port->format.encoding_variant; ++ m.u.port_info_set.format.bitrate = port->format.bitrate; ++ m.u.port_info_set.format.flags = port->format.flags; ++ ++ memcpy(&m.u.port_info_set.es, &port->es, ++ sizeof(union mmal_es_specific_format)); ++ ++ m.u.port_info_set.format.extradata_size = port->format.extradata_size; ++ memcpy(&m.u.port_info_set.extradata, port->format.extradata, ++ port->format.extradata_size); ++ ++ ret = send_synchronous_mmal_msg(instance, &m, ++ sizeof(m.u.port_info_set), ++ &rmsg, &rmsg_handle); ++ if (ret) ++ return ret; ++ ++ if (rmsg->h.type != MMAL_MSG_TYPE_PORT_INFO_SET) { ++ /* got an unexpected message type in reply */ ++ ret = -EINVAL; ++ goto release_msg; ++ } ++ ++ /* return operation status */ ++ ret = -rmsg->u.port_info_get_reply.status; ++ ++ pr_debug("%s:result:%d component:0x%x port:%d\n", __func__, ret, ++ port->component->handle, port->handle); ++ ++release_msg: ++ vchi_held_msg_release(&rmsg_handle); ++ ++ return ret; ++ ++} ++ ++/* use port info get message to retrive port information */ ++static int port_info_get(struct vchiq_mmal_instance *instance, ++ struct vchiq_mmal_port *port) ++{ ++ int ret; ++ struct mmal_msg m; ++ struct mmal_msg *rmsg; ++ VCHI_HELD_MSG_T rmsg_handle; ++ ++ /* port info time */ ++ m.h.type = MMAL_MSG_TYPE_PORT_INFO_GET; ++ m.u.port_info_get.component_handle = port->component->handle; ++ m.u.port_info_get.port_type = port->type; ++ m.u.port_info_get.index = port->index; ++ ++ ret = send_synchronous_mmal_msg(instance, &m, ++ sizeof(m.u.port_info_get), ++ &rmsg, &rmsg_handle); ++ if (ret) ++ return ret; ++ ++ if (rmsg->h.type != MMAL_MSG_TYPE_PORT_INFO_GET) { ++ /* got an unexpected message type in reply */ ++ ret = -EINVAL; ++ goto release_msg; ++ } ++ ++ /* return operation status */ ++ ret = -rmsg->u.port_info_get_reply.status; ++ if (ret != MMAL_MSG_STATUS_SUCCESS) ++ goto release_msg; ++ ++ if (rmsg->u.port_info_get_reply.port.is_enabled == 0) ++ port->enabled = false; ++ else ++ port->enabled = true; ++ ++ /* copy the values out of the message */ ++ port->handle = rmsg->u.port_info_get_reply.port_handle; ++ ++ /* port type and index cached to use on port info set becuase ++ * it does not use a port handle ++ */ ++ port->type = rmsg->u.port_info_get_reply.port_type; ++ port->index = rmsg->u.port_info_get_reply.port_index; ++ ++ port->minimum_buffer.num = ++ rmsg->u.port_info_get_reply.port.buffer_num_min; ++ port->minimum_buffer.size = ++ rmsg->u.port_info_get_reply.port.buffer_size_min; ++ port->minimum_buffer.alignment = ++ rmsg->u.port_info_get_reply.port.buffer_alignment_min; ++ ++ port->recommended_buffer.alignment = ++ rmsg->u.port_info_get_reply.port.buffer_alignment_min; ++ port->recommended_buffer.num = ++ rmsg->u.port_info_get_reply.port.buffer_num_recommended; ++ ++ port->current_buffer.num = rmsg->u.port_info_get_reply.port.buffer_num; ++ port->current_buffer.size = ++ rmsg->u.port_info_get_reply.port.buffer_size; ++ ++ /* stream format */ ++ port->format.type = rmsg->u.port_info_get_reply.format.type; ++ port->format.encoding = rmsg->u.port_info_get_reply.format.encoding; ++ port->format.encoding_variant = ++ rmsg->u.port_info_get_reply.format.encoding_variant; ++ port->format.bitrate = rmsg->u.port_info_get_reply.format.bitrate; ++ port->format.flags = rmsg->u.port_info_get_reply.format.flags; ++ ++ /* elementry stream format */ ++ memcpy(&port->es, ++ &rmsg->u.port_info_get_reply.es, ++ sizeof(union mmal_es_specific_format)); ++ port->format.es = &port->es; ++ ++ port->format.extradata_size = ++ rmsg->u.port_info_get_reply.format.extradata_size; ++ memcpy(port->format.extradata, ++ rmsg->u.port_info_get_reply.extradata, ++ port->format.extradata_size); ++ ++ pr_debug("received port info\n"); ++ dump_port_info(port); ++ ++release_msg: ++ ++ pr_debug("%s:result:%d component:0x%x port:%d\n", ++ __func__, ret, port->component->handle, port->handle); ++ ++ vchi_held_msg_release(&rmsg_handle); ++ ++ return ret; ++} ++ ++/* create comonent on vc */ ++static int create_component(struct vchiq_mmal_instance *instance, ++ struct vchiq_mmal_component *component, ++ const char *name) ++{ ++ int ret; ++ struct mmal_msg m; ++ struct mmal_msg *rmsg; ++ VCHI_HELD_MSG_T rmsg_handle; ++ ++ /* build component create message */ ++ m.h.type = MMAL_MSG_TYPE_COMPONENT_CREATE; ++ m.u.component_create.client_component = component; ++ strncpy(m.u.component_create.name, name, ++ sizeof(m.u.component_create.name)); ++ ++ ret = send_synchronous_mmal_msg(instance, &m, ++ sizeof(m.u.component_create), ++ &rmsg, &rmsg_handle); ++ if (ret) ++ return ret; ++ ++ if (rmsg->h.type != m.h.type) { ++ /* got an unexpected message type in reply */ ++ ret = -EINVAL; ++ goto release_msg; ++ } ++ ++ ret = -rmsg->u.component_create_reply.status; ++ if (ret != MMAL_MSG_STATUS_SUCCESS) ++ goto release_msg; ++ ++ /* a valid component response received */ ++ component->handle = rmsg->u.component_create_reply.component_handle; ++ component->inputs = rmsg->u.component_create_reply.input_num; ++ component->outputs = rmsg->u.component_create_reply.output_num; ++ component->clocks = rmsg->u.component_create_reply.clock_num; ++ ++ pr_debug("Component handle:0x%x in:%d out:%d clock:%d\n", ++ component->handle, ++ component->inputs, component->outputs, component->clocks); ++ ++release_msg: ++ vchi_held_msg_release(&rmsg_handle); ++ ++ return ret; ++} ++ ++/* destroys a component on vc */ ++static int destroy_component(struct vchiq_mmal_instance *instance, ++ struct vchiq_mmal_component *component) ++{ ++ int ret; ++ struct mmal_msg m; ++ struct mmal_msg *rmsg; ++ VCHI_HELD_MSG_T rmsg_handle; ++ ++ m.h.type = MMAL_MSG_TYPE_COMPONENT_DESTROY; ++ m.u.component_destroy.component_handle = component->handle; ++ ++ ret = send_synchronous_mmal_msg(instance, &m, ++ sizeof(m.u.component_destroy), ++ &rmsg, &rmsg_handle); ++ if (ret) ++ return ret; ++ ++ if (rmsg->h.type != m.h.type) { ++ /* got an unexpected message type in reply */ ++ ret = -EINVAL; ++ goto release_msg; ++ } ++ ++ ret = -rmsg->u.component_destroy_reply.status; ++ ++release_msg: ++ ++ vchi_held_msg_release(&rmsg_handle); ++ ++ return ret; ++} ++ ++/* enable a component on vc */ ++static int enable_component(struct vchiq_mmal_instance *instance, ++ struct vchiq_mmal_component *component) ++{ ++ int ret; ++ struct mmal_msg m; ++ struct mmal_msg *rmsg; ++ VCHI_HELD_MSG_T rmsg_handle; ++ ++ m.h.type = MMAL_MSG_TYPE_COMPONENT_ENABLE; ++ m.u.component_enable.component_handle = component->handle; ++ ++ ret = send_synchronous_mmal_msg(instance, &m, ++ sizeof(m.u.component_enable), ++ &rmsg, &rmsg_handle); ++ if (ret) ++ return ret; ++ ++ if (rmsg->h.type != m.h.type) { ++ /* got an unexpected message type in reply */ ++ ret = -EINVAL; ++ goto release_msg; ++ } ++ ++ ret = -rmsg->u.component_enable_reply.status; ++ ++release_msg: ++ vchi_held_msg_release(&rmsg_handle); ++ ++ return ret; ++} ++ ++/* disable a component on vc */ ++static int disable_component(struct vchiq_mmal_instance *instance, ++ struct vchiq_mmal_component *component) ++{ ++ int ret; ++ struct mmal_msg m; ++ struct mmal_msg *rmsg; ++ VCHI_HELD_MSG_T rmsg_handle; ++ ++ m.h.type = MMAL_MSG_TYPE_COMPONENT_DISABLE; ++ m.u.component_disable.component_handle = component->handle; ++ ++ ret = send_synchronous_mmal_msg(instance, &m, ++ sizeof(m.u.component_disable), ++ &rmsg, &rmsg_handle); ++ if (ret) ++ return ret; ++ ++ if (rmsg->h.type != m.h.type) { ++ /* got an unexpected message type in reply */ ++ ret = -EINVAL; ++ goto release_msg; ++ } ++ ++ ret = -rmsg->u.component_disable_reply.status; ++ ++release_msg: ++ ++ vchi_held_msg_release(&rmsg_handle); ++ ++ return ret; ++} ++ ++/* get version of mmal implementation */ ++static int get_version(struct vchiq_mmal_instance *instance, ++ u32 *major_out, u32 *minor_out) ++{ ++ int ret; ++ struct mmal_msg m; ++ struct mmal_msg *rmsg; ++ VCHI_HELD_MSG_T rmsg_handle; ++ ++ m.h.type = MMAL_MSG_TYPE_GET_VERSION; ++ ++ ret = send_synchronous_mmal_msg(instance, &m, ++ sizeof(m.u.version), ++ &rmsg, &rmsg_handle); ++ if (ret) ++ return ret; ++ ++ if (rmsg->h.type != m.h.type) { ++ /* got an unexpected message type in reply */ ++ ret = -EINVAL; ++ goto release_msg; ++ } ++ ++ *major_out = rmsg->u.version.major; ++ *minor_out = rmsg->u.version.minor; ++ ++release_msg: ++ vchi_held_msg_release(&rmsg_handle); ++ ++ return ret; ++} ++ ++/* do a port action with a port as a parameter */ ++static int port_action_port(struct vchiq_mmal_instance *instance, ++ struct vchiq_mmal_port *port, ++ enum mmal_msg_port_action_type action_type) ++{ ++ int ret; ++ struct mmal_msg m; ++ struct mmal_msg *rmsg; ++ VCHI_HELD_MSG_T rmsg_handle; ++ ++ m.h.type = MMAL_MSG_TYPE_PORT_ACTION; ++ m.u.port_action_port.component_handle = port->component->handle; ++ m.u.port_action_port.port_handle = port->handle; ++ m.u.port_action_port.action = action_type; ++ ++ port_to_mmal_msg(port, &m.u.port_action_port.port); ++ ++ ret = send_synchronous_mmal_msg(instance, &m, ++ sizeof(m.u.port_action_port), ++ &rmsg, &rmsg_handle); ++ if (ret) ++ return ret; ++ ++ if (rmsg->h.type != MMAL_MSG_TYPE_PORT_ACTION) { ++ /* got an unexpected message type in reply */ ++ ret = -EINVAL; ++ goto release_msg; ++ } ++ ++ ret = -rmsg->u.port_action_reply.status; ++ ++ pr_debug("%s:result:%d component:0x%x port:%d action:%s(%d)\n", ++ __func__, ++ ret, port->component->handle, port->handle, ++ port_action_type_names[action_type], action_type); ++ ++release_msg: ++ vchi_held_msg_release(&rmsg_handle); ++ ++ return ret; ++} ++ ++/* do a port action with handles as parameters */ ++static int port_action_handle(struct vchiq_mmal_instance *instance, ++ struct vchiq_mmal_port *port, ++ enum mmal_msg_port_action_type action_type, ++ u32 connect_component_handle, ++ u32 connect_port_handle) ++{ ++ int ret; ++ struct mmal_msg m; ++ struct mmal_msg *rmsg; ++ VCHI_HELD_MSG_T rmsg_handle; ++ ++ m.h.type = MMAL_MSG_TYPE_PORT_ACTION; ++ ++ m.u.port_action_handle.component_handle = port->component->handle; ++ m.u.port_action_handle.port_handle = port->handle; ++ m.u.port_action_handle.action = action_type; ++ ++ m.u.port_action_handle.connect_component_handle = ++ connect_component_handle; ++ m.u.port_action_handle.connect_port_handle = connect_port_handle; ++ ++ ret = send_synchronous_mmal_msg(instance, &m, ++ sizeof(m.u.port_action_handle), ++ &rmsg, &rmsg_handle); ++ if (ret) ++ return ret; ++ ++ if (rmsg->h.type != MMAL_MSG_TYPE_PORT_ACTION) { ++ /* got an unexpected message type in reply */ ++ ret = -EINVAL; ++ goto release_msg; ++ } ++ ++ ret = -rmsg->u.port_action_reply.status; ++ ++ pr_debug("%s:result:%d component:0x%x port:%d action:%s(%d)" \ ++ " connect component:0x%x connect port:%d\n", ++ __func__, ++ ret, port->component->handle, port->handle, ++ port_action_type_names[action_type], ++ action_type, connect_component_handle, connect_port_handle); ++ ++release_msg: ++ vchi_held_msg_release(&rmsg_handle); ++ ++ return ret; ++} ++ ++static int port_parameter_set(struct vchiq_mmal_instance *instance, ++ struct vchiq_mmal_port *port, ++ u32 parameter_id, void *value, u32 value_size) ++{ ++ int ret; ++ struct mmal_msg m; ++ struct mmal_msg *rmsg; ++ VCHI_HELD_MSG_T rmsg_handle; ++ ++ m.h.type = MMAL_MSG_TYPE_PORT_PARAMETER_SET; ++ ++ m.u.port_parameter_set.component_handle = port->component->handle; ++ m.u.port_parameter_set.port_handle = port->handle; ++ m.u.port_parameter_set.id = parameter_id; ++ m.u.port_parameter_set.size = (2 * sizeof(u32)) + value_size; ++ memcpy(&m.u.port_parameter_set.value, value, value_size); ++ ++ ret = send_synchronous_mmal_msg(instance, &m, ++ (4 * sizeof(u32)) + value_size, ++ &rmsg, &rmsg_handle); ++ if (ret) ++ return ret; ++ ++ if (rmsg->h.type != MMAL_MSG_TYPE_PORT_PARAMETER_SET) { ++ /* got an unexpected message type in reply */ ++ ret = -EINVAL; ++ goto release_msg; ++ } ++ ++ ret = -rmsg->u.port_parameter_set_reply.status; ++ ++ pr_debug("%s:result:%d component:0x%x port:%d parameter:%d\n", ++ __func__, ++ ret, port->component->handle, port->handle, parameter_id); ++ ++release_msg: ++ vchi_held_msg_release(&rmsg_handle); ++ ++ return ret; ++} ++ ++static int port_parameter_get(struct vchiq_mmal_instance *instance, ++ struct vchiq_mmal_port *port, ++ u32 parameter_id, void *value, u32 *value_size) ++{ ++ int ret; ++ struct mmal_msg m; ++ struct mmal_msg *rmsg; ++ VCHI_HELD_MSG_T rmsg_handle; ++ ++ m.h.type = MMAL_MSG_TYPE_PORT_PARAMETER_GET; ++ ++ m.u.port_parameter_get.component_handle = port->component->handle; ++ m.u.port_parameter_get.port_handle = port->handle; ++ m.u.port_parameter_get.id = parameter_id; ++ m.u.port_parameter_get.size = (2 * sizeof(u32)) + *value_size; ++ ++ ret = send_synchronous_mmal_msg(instance, &m, ++ sizeof(struct ++ mmal_msg_port_parameter_get), ++ &rmsg, &rmsg_handle); ++ if (ret) ++ return ret; ++ ++ if (rmsg->h.type != MMAL_MSG_TYPE_PORT_PARAMETER_GET) { ++ /* got an unexpected message type in reply */ ++ pr_err("Incorrect reply type %d\n", rmsg->h.type); ++ ret = -EINVAL; ++ goto release_msg; ++ } ++ ++ ret = -rmsg->u.port_parameter_get_reply.status; ++ if (ret) { ++ /* Copy only as much as we have space for ++ * but report true size of parameter ++ */ ++ memcpy(value, &rmsg->u.port_parameter_get_reply.value, ++ *value_size); ++ *value_size = rmsg->u.port_parameter_get_reply.size; ++ } else ++ memcpy(value, &rmsg->u.port_parameter_get_reply.value, ++ rmsg->u.port_parameter_get_reply.size); ++ ++ pr_debug("%s:result:%d component:0x%x port:%d parameter:%d\n", __func__, ++ ret, port->component->handle, port->handle, parameter_id); ++ ++release_msg: ++ vchi_held_msg_release(&rmsg_handle); ++ ++ return ret; ++} ++ ++/* disables a port and drains buffers from it */ ++static int port_disable(struct vchiq_mmal_instance *instance, ++ struct vchiq_mmal_port *port) ++{ ++ int ret; ++ struct list_head *q, *buf_head; ++ unsigned long flags = 0; ++ ++ if (!port->enabled) ++ return 0; ++ ++ port->enabled = false; ++ ++ ret = port_action_port(instance, port, ++ MMAL_MSG_PORT_ACTION_TYPE_DISABLE); ++ if (ret == 0) { ++ ++ /* drain all queued buffers on port */ ++ spin_lock_irqsave(&port->slock, flags); ++ ++ list_for_each_safe(buf_head, q, &port->buffers) { ++ struct mmal_buffer *mmalbuf; ++ mmalbuf = list_entry(buf_head, struct mmal_buffer, ++ list); ++ list_del(buf_head); ++ if (port->buffer_cb) ++ port->buffer_cb(instance, ++ port, 0, mmalbuf, 0, 0, ++ MMAL_TIME_UNKNOWN, ++ MMAL_TIME_UNKNOWN); ++ } ++ ++ spin_unlock_irqrestore(&port->slock, flags); ++ ++ ret = port_info_get(instance, port); ++ } ++ ++ return ret; ++} ++ ++/* enable a port */ ++static int port_enable(struct vchiq_mmal_instance *instance, ++ struct vchiq_mmal_port *port) ++{ ++ unsigned int hdr_count; ++ struct list_head *buf_head; ++ int ret; ++ ++ if (port->enabled) ++ return 0; ++ ++ /* ensure there are enough buffers queued to cover the buffer headers */ ++ if (port->buffer_cb != NULL) { ++ hdr_count = 0; ++ list_for_each(buf_head, &port->buffers) { ++ hdr_count++; ++ } ++ if (hdr_count < port->current_buffer.num) ++ return -ENOSPC; ++ } ++ ++ ret = port_action_port(instance, port, ++ MMAL_MSG_PORT_ACTION_TYPE_ENABLE); ++ if (ret) ++ goto done; ++ ++ port->enabled = true; ++ ++ if (port->buffer_cb) { ++ /* send buffer headers to videocore */ ++ hdr_count = 1; ++ list_for_each(buf_head, &port->buffers) { ++ struct mmal_buffer *mmalbuf; ++ mmalbuf = list_entry(buf_head, struct mmal_buffer, ++ list); ++ ret = buffer_from_host(instance, port, mmalbuf); ++ if (ret) ++ goto done; ++ ++ hdr_count++; ++ if (hdr_count > port->current_buffer.num) ++ break; ++ } ++ } ++ ++ ret = port_info_get(instance, port); ++ ++done: ++ return ret; ++} ++ ++/* ------------------------------------------------------------------ ++ * Exported API ++ *------------------------------------------------------------------*/ ++ ++int vchiq_mmal_port_set_format(struct vchiq_mmal_instance *instance, ++ struct vchiq_mmal_port *port) ++{ ++ int ret; ++ ++ if (mutex_lock_interruptible(&instance->vchiq_mutex)) ++ return -EINTR; ++ ++ ret = port_info_set(instance, port); ++ if (ret) ++ goto release_unlock; ++ ++ /* read what has actually been set */ ++ ret = port_info_get(instance, port); ++ ++release_unlock: ++ mutex_unlock(&instance->vchiq_mutex); ++ ++ return ret; ++ ++} ++ ++int vchiq_mmal_port_parameter_set(struct vchiq_mmal_instance *instance, ++ struct vchiq_mmal_port *port, ++ u32 parameter, void *value, u32 value_size) ++{ ++ int ret; ++ ++ if (mutex_lock_interruptible(&instance->vchiq_mutex)) ++ return -EINTR; ++ ++ ret = port_parameter_set(instance, port, parameter, value, value_size); ++ ++ mutex_unlock(&instance->vchiq_mutex); ++ ++ return ret; ++} ++ ++int vchiq_mmal_port_parameter_get(struct vchiq_mmal_instance *instance, ++ struct vchiq_mmal_port *port, ++ u32 parameter, void *value, u32 *value_size) ++{ ++ int ret; ++ ++ if (mutex_lock_interruptible(&instance->vchiq_mutex)) ++ return -EINTR; ++ ++ ret = port_parameter_get(instance, port, parameter, value, value_size); ++ ++ mutex_unlock(&instance->vchiq_mutex); ++ ++ return ret; ++} ++ ++/* enable a port ++ * ++ * enables a port and queues buffers for satisfying callbacks if we ++ * provide a callback handler ++ */ ++int vchiq_mmal_port_enable(struct vchiq_mmal_instance *instance, ++ struct vchiq_mmal_port *port, ++ vchiq_mmal_buffer_cb buffer_cb) ++{ ++ int ret; ++ ++ if (mutex_lock_interruptible(&instance->vchiq_mutex)) ++ return -EINTR; ++ ++ /* already enabled - noop */ ++ if (port->enabled) { ++ ret = 0; ++ goto unlock; ++ } ++ ++ port->buffer_cb = buffer_cb; ++ ++ ret = port_enable(instance, port); ++ ++unlock: ++ mutex_unlock(&instance->vchiq_mutex); ++ ++ return ret; ++} ++ ++int vchiq_mmal_port_disable(struct vchiq_mmal_instance *instance, ++ struct vchiq_mmal_port *port) ++{ ++ int ret; ++ ++ if (mutex_lock_interruptible(&instance->vchiq_mutex)) ++ return -EINTR; ++ ++ if (!port->enabled) { ++ mutex_unlock(&instance->vchiq_mutex); ++ return 0; ++ } ++ ++ ret = port_disable(instance, port); ++ ++ mutex_unlock(&instance->vchiq_mutex); ++ ++ return ret; ++} ++ ++/* ports will be connected in a tunneled manner so data buffers ++ * are not handled by client. ++ */ ++int vchiq_mmal_port_connect_tunnel(struct vchiq_mmal_instance *instance, ++ struct vchiq_mmal_port *src, ++ struct vchiq_mmal_port *dst) ++{ ++ int ret; ++ ++ if (mutex_lock_interruptible(&instance->vchiq_mutex)) ++ return -EINTR; ++ ++ /* disconnect ports if connected */ ++ if (src->connected != NULL) { ++ ret = port_disable(instance, src); ++ if (ret) { ++ pr_err("failed disabling src port(%d)\n", ret); ++ goto release_unlock; ++ } ++ ++ /* do not need to disable the destination port as they ++ * are connected and it is done automatically ++ */ ++ ++ ret = port_action_handle(instance, src, ++ MMAL_MSG_PORT_ACTION_TYPE_DISCONNECT, ++ src->connected->component->handle, ++ src->connected->handle); ++ if (ret < 0) { ++ pr_err("failed disconnecting src port\n"); ++ goto release_unlock; ++ } ++ src->connected->enabled = false; ++ src->connected = NULL; ++ } ++ ++ if (dst == NULL) { ++ /* do not make new connection */ ++ ret = 0; ++ pr_debug("not making new connection\n"); ++ goto release_unlock; ++ } ++ ++ /* copy src port format to dst */ ++ dst->format.encoding = src->format.encoding; ++ dst->es.video.width = src->es.video.width; ++ dst->es.video.height = src->es.video.height; ++ dst->es.video.crop.x = src->es.video.crop.x; ++ dst->es.video.crop.y = src->es.video.crop.y; ++ dst->es.video.crop.width = src->es.video.crop.width; ++ dst->es.video.crop.height = src->es.video.crop.height; ++ dst->es.video.frame_rate.num = src->es.video.frame_rate.num; ++ dst->es.video.frame_rate.den = src->es.video.frame_rate.den; ++ ++ /* set new format */ ++ ret = port_info_set(instance, dst); ++ if (ret) { ++ pr_debug("setting port info failed\n"); ++ goto release_unlock; ++ } ++ ++ /* read what has actually been set */ ++ ret = port_info_get(instance, dst); ++ if (ret) { ++ pr_debug("read back port info failed\n"); ++ goto release_unlock; ++ } ++ ++ /* connect two ports together */ ++ ret = port_action_handle(instance, src, ++ MMAL_MSG_PORT_ACTION_TYPE_CONNECT, ++ dst->component->handle, dst->handle); ++ if (ret < 0) { ++ pr_debug("connecting port %d:%d to %d:%d failed\n", ++ src->component->handle, src->handle, ++ dst->component->handle, dst->handle); ++ goto release_unlock; ++ } ++ src->connected = dst; ++ ++release_unlock: ++ ++ mutex_unlock(&instance->vchiq_mutex); ++ ++ return ret; ++} ++ ++int vchiq_mmal_submit_buffer(struct vchiq_mmal_instance *instance, ++ struct vchiq_mmal_port *port, ++ struct mmal_buffer *buffer) ++{ ++ unsigned long flags = 0; ++ ++ spin_lock_irqsave(&port->slock, flags); ++ list_add_tail(&buffer->list, &port->buffers); ++ spin_unlock_irqrestore(&port->slock, flags); ++ ++ /* the port previously underflowed because it was missing a ++ * mmal_buffer which has just been added, submit that buffer ++ * to the mmal service. ++ */ ++ if (port->buffer_underflow) { ++ port_buffer_from_host(instance, port); ++ port->buffer_underflow--; ++ } ++ ++ return 0; ++} ++ ++/* Initialise a mmal component and its ports ++ * ++ */ ++int vchiq_mmal_component_init(struct vchiq_mmal_instance *instance, ++ const char *name, ++ struct vchiq_mmal_component **component_out) ++{ ++ int ret; ++ int idx; /* port index */ ++ struct vchiq_mmal_component *component; ++ ++ if (mutex_lock_interruptible(&instance->vchiq_mutex)) ++ return -EINTR; ++ ++ if (instance->component_idx == VCHIQ_MMAL_MAX_COMPONENTS) { ++ ret = -EINVAL; /* todo is this correct error? */ ++ goto unlock; ++ } ++ ++ component = &instance->component[instance->component_idx]; ++ ++ ret = create_component(instance, component, name); ++ if (ret < 0) ++ goto unlock; ++ ++ /* ports info needs gathering */ ++ component->control.type = MMAL_PORT_TYPE_CONTROL; ++ component->control.index = 0; ++ component->control.component = component; ++ spin_lock_init(&component->control.slock); ++ INIT_LIST_HEAD(&component->control.buffers); ++ ret = port_info_get(instance, &component->control); ++ if (ret < 0) ++ goto release_component; ++ ++ for (idx = 0; idx < component->inputs; idx++) { ++ component->input[idx].type = MMAL_PORT_TYPE_INPUT; ++ component->input[idx].index = idx; ++ component->input[idx].component = component; ++ spin_lock_init(&component->input[idx].slock); ++ INIT_LIST_HEAD(&component->input[idx].buffers); ++ ret = port_info_get(instance, &component->input[idx]); ++ if (ret < 0) ++ goto release_component; ++ } ++ ++ for (idx = 0; idx < component->outputs; idx++) { ++ component->output[idx].type = MMAL_PORT_TYPE_OUTPUT; ++ component->output[idx].index = idx; ++ component->output[idx].component = component; ++ spin_lock_init(&component->output[idx].slock); ++ INIT_LIST_HEAD(&component->output[idx].buffers); ++ ret = port_info_get(instance, &component->output[idx]); ++ if (ret < 0) ++ goto release_component; ++ } ++ ++ for (idx = 0; idx < component->clocks; idx++) { ++ component->clock[idx].type = MMAL_PORT_TYPE_CLOCK; ++ component->clock[idx].index = idx; ++ component->clock[idx].component = component; ++ spin_lock_init(&component->clock[idx].slock); ++ INIT_LIST_HEAD(&component->clock[idx].buffers); ++ ret = port_info_get(instance, &component->clock[idx]); ++ if (ret < 0) ++ goto release_component; ++ } ++ ++ instance->component_idx++; ++ ++ *component_out = component; ++ ++ mutex_unlock(&instance->vchiq_mutex); ++ ++ return 0; ++ ++release_component: ++ destroy_component(instance, component); ++unlock: ++ mutex_unlock(&instance->vchiq_mutex); ++ ++ return ret; ++} ++ ++/* ++ * cause a mmal component to be destroyed ++ */ ++int vchiq_mmal_component_finalise(struct vchiq_mmal_instance *instance, ++ struct vchiq_mmal_component *component) ++{ ++ int ret; ++ ++ if (mutex_lock_interruptible(&instance->vchiq_mutex)) ++ return -EINTR; ++ ++ if (component->enabled) ++ ret = disable_component(instance, component); ++ ++ ret = destroy_component(instance, component); ++ ++ mutex_unlock(&instance->vchiq_mutex); ++ ++ return ret; ++} ++ ++/* ++ * cause a mmal component to be enabled ++ */ ++int vchiq_mmal_component_enable(struct vchiq_mmal_instance *instance, ++ struct vchiq_mmal_component *component) ++{ ++ int ret; ++ ++ if (mutex_lock_interruptible(&instance->vchiq_mutex)) ++ return -EINTR; ++ ++ if (component->enabled) { ++ mutex_unlock(&instance->vchiq_mutex); ++ return 0; ++ } ++ ++ ret = enable_component(instance, component); ++ if (ret == 0) ++ component->enabled = true; ++ ++ mutex_unlock(&instance->vchiq_mutex); ++ ++ return ret; ++} ++ ++/* ++ * cause a mmal component to be enabled ++ */ ++int vchiq_mmal_component_disable(struct vchiq_mmal_instance *instance, ++ struct vchiq_mmal_component *component) ++{ ++ int ret; ++ ++ if (mutex_lock_interruptible(&instance->vchiq_mutex)) ++ return -EINTR; ++ ++ if (!component->enabled) { ++ mutex_unlock(&instance->vchiq_mutex); ++ return 0; ++ } ++ ++ ret = disable_component(instance, component); ++ if (ret == 0) ++ component->enabled = false; ++ ++ mutex_unlock(&instance->vchiq_mutex); ++ ++ return ret; ++} ++ ++int vchiq_mmal_version(struct vchiq_mmal_instance *instance, ++ u32 *major_out, u32 *minor_out) ++{ ++ int ret; ++ ++ if (mutex_lock_interruptible(&instance->vchiq_mutex)) ++ return -EINTR; ++ ++ ret = get_version(instance, major_out, minor_out); ++ ++ mutex_unlock(&instance->vchiq_mutex); ++ ++ return ret; ++} ++ ++int vchiq_mmal_finalise(struct vchiq_mmal_instance *instance) ++{ ++ int status = 0; ++ ++ if (instance == NULL) ++ return -EINVAL; ++ ++ if (mutex_lock_interruptible(&instance->vchiq_mutex)) ++ return -EINTR; ++ ++ vchi_service_use(instance->handle); ++ ++ status = vchi_service_close(instance->handle); ++ if (status != 0) ++ pr_err("mmal-vchiq: VCHIQ close failed"); ++ ++ mutex_unlock(&instance->vchiq_mutex); ++ ++ vfree(instance->bulk_scratch); ++ ++ kfree(instance); ++ ++ return status; ++} ++ ++int vchiq_mmal_init(struct vchiq_mmal_instance **out_instance) ++{ ++ int status; ++ struct vchiq_mmal_instance *instance; ++ static VCHI_CONNECTION_T *vchi_connection; ++ static VCHI_INSTANCE_T vchi_instance; ++ SERVICE_CREATION_T params = { ++ VCHI_VERSION_EX(VC_MMAL_VER, VC_MMAL_MIN_VER), ++ VC_MMAL_SERVER_NAME, ++ vchi_connection, ++ 0, /* rx fifo size (unused) */ ++ 0, /* tx fifo size (unused) */ ++ service_callback, ++ NULL, /* service callback parameter */ ++ 1, /* unaligned bulk receives */ ++ 1, /* unaligned bulk transmits */ ++ 0 /* want crc check on bulk transfers */ ++ }; ++ ++ /* compile time checks to ensure structure size as they are ++ * directly (de)serialised from memory. ++ */ ++ ++ /* ensure the header structure has packed to the correct size */ ++ BUILD_BUG_ON(sizeof(struct mmal_msg_header) != 24); ++ ++ /* ensure message structure does not exceed maximum length */ ++ BUILD_BUG_ON(sizeof(struct mmal_msg) > MMAL_MSG_MAX_SIZE); ++ ++ /* mmal port struct is correct size */ ++ BUILD_BUG_ON(sizeof(struct mmal_port) != 64); ++ ++ /* create a vchi instance */ ++ status = vchi_initialise(&vchi_instance); ++ if (status) { ++ pr_err("Failed to initialise VCHI instance (status=%d)\n", ++ status); ++ return -EIO; ++ } ++ ++ status = vchi_connect(NULL, 0, vchi_instance); ++ if (status) { ++ pr_err("Failed to connect VCHI instance (status=%d)\n", status); ++ return -EIO; ++ } ++ ++ instance = kmalloc(sizeof(*instance), GFP_KERNEL); ++ memset(instance, 0, sizeof(*instance)); ++ ++ mutex_init(&instance->vchiq_mutex); ++ mutex_init(&instance->bulk_mutex); ++ ++ instance->bulk_scratch = vmalloc(PAGE_SIZE); ++ ++ params.callback_param = instance; ++ ++ status = vchi_service_open(vchi_instance, &params, &instance->handle); ++ if (status) { ++ pr_err("Failed to open VCHI service connection (status=%d)\n", ++ status); ++ goto err_close_services; ++ } ++ ++ vchi_service_release(instance->handle); ++ ++ *out_instance = instance; ++ ++ return 0; ++ ++err_close_services: ++ ++ vchi_service_close(instance->handle); ++ vfree(instance->bulk_scratch); ++ kfree(instance); ++ return -ENODEV; ++} +diff --git a/drivers/media/platform/bcm2835/mmal-vchiq.h b/drivers/media/platform/bcm2835/mmal-vchiq.h +new file mode 100644 +index 0000000..9d1d11e +--- /dev/null ++++ b/drivers/media/platform/bcm2835/mmal-vchiq.h +@@ -0,0 +1,178 @@ ++/* ++ * Broadcom BM2835 V4L2 driver ++ * ++ * Copyright © 2013 Raspberry Pi (Trading) Ltd. ++ * ++ * This file is subject to the terms and conditions of the GNU General Public ++ * License. See the file COPYING in the main directory of this archive ++ * for more details. ++ * ++ * Authors: Vincent Sanders <vincent.sanders@collabora.co.uk> ++ * Dave Stevenson <dsteve@broadcom.com> ++ * Simon Mellor <simellor@broadcom.com> ++ * Luke Diamand <luked@broadcom.com> ++ * ++ * MMAL interface to VCHIQ message passing ++ */ ++ ++#ifndef MMAL_VCHIQ_H ++#define MMAL_VCHIQ_H ++ ++#include "mmal-msg-format.h" ++ ++#define MAX_PORT_COUNT 4 ++ ++/* Maximum size of the format extradata. */ ++#define MMAL_FORMAT_EXTRADATA_MAX_SIZE 128 ++ ++struct vchiq_mmal_instance; ++ ++enum vchiq_mmal_es_type { ++ MMAL_ES_TYPE_UNKNOWN, /**< Unknown elementary stream type */ ++ MMAL_ES_TYPE_CONTROL, /**< Elementary stream of control commands */ ++ MMAL_ES_TYPE_AUDIO, /**< Audio elementary stream */ ++ MMAL_ES_TYPE_VIDEO, /**< Video elementary stream */ ++ MMAL_ES_TYPE_SUBPICTURE /**< Sub-picture elementary stream */ ++}; ++ ++/* rectangle, used lots so it gets its own struct */ ++struct vchiq_mmal_rect { ++ s32 x; ++ s32 y; ++ s32 width; ++ s32 height; ++}; ++ ++struct vchiq_mmal_port_buffer { ++ unsigned int num; /* number of buffers */ ++ u32 size; /* size of buffers */ ++ u32 alignment; /* alignment of buffers */ ++}; ++ ++struct vchiq_mmal_port; ++ ++typedef void (*vchiq_mmal_buffer_cb)( ++ struct vchiq_mmal_instance *instance, ++ struct vchiq_mmal_port *port, ++ int status, struct mmal_buffer *buffer, ++ unsigned long length, u32 mmal_flags, s64 dts, s64 pts); ++ ++struct vchiq_mmal_port { ++ bool enabled; ++ u32 handle; ++ u32 type; /* port type, cached to use on port info set */ ++ u32 index; /* port index, cached to use on port info set */ ++ ++ /* component port belongs to, allows simple deref */ ++ struct vchiq_mmal_component *component; ++ ++ struct vchiq_mmal_port *connected; /* port conencted to */ ++ ++ /* buffer info */ ++ struct vchiq_mmal_port_buffer minimum_buffer; ++ struct vchiq_mmal_port_buffer recommended_buffer; ++ struct vchiq_mmal_port_buffer current_buffer; ++ ++ /* stream format */ ++ struct mmal_es_format format; ++ /* elementry stream format */ ++ union mmal_es_specific_format es; ++ ++ /* data buffers to fill */ ++ struct list_head buffers; ++ /* lock to serialise adding and removing buffers from list */ ++ spinlock_t slock; ++ /* count of how many buffer header refils have failed because ++ * there was no buffer to satisfy them ++ */ ++ int buffer_underflow; ++ /* callback on buffer completion */ ++ vchiq_mmal_buffer_cb buffer_cb; ++ /* callback context */ ++ void *cb_ctx; ++}; ++ ++struct vchiq_mmal_component { ++ bool enabled; ++ u32 handle; /* VideoCore handle for component */ ++ u32 inputs; /* Number of input ports */ ++ u32 outputs; /* Number of output ports */ ++ u32 clocks; /* Number of clock ports */ ++ struct vchiq_mmal_port control; /* control port */ ++ struct vchiq_mmal_port input[MAX_PORT_COUNT]; /* input ports */ ++ struct vchiq_mmal_port output[MAX_PORT_COUNT]; /* output ports */ ++ struct vchiq_mmal_port clock[MAX_PORT_COUNT]; /* clock ports */ ++}; ++ ++ ++int vchiq_mmal_init(struct vchiq_mmal_instance **out_instance); ++int vchiq_mmal_finalise(struct vchiq_mmal_instance *instance); ++ ++/* Initialise a mmal component and its ports ++* ++*/ ++int vchiq_mmal_component_init( ++ struct vchiq_mmal_instance *instance, ++ const char *name, ++ struct vchiq_mmal_component **component_out); ++ ++int vchiq_mmal_component_finalise( ++ struct vchiq_mmal_instance *instance, ++ struct vchiq_mmal_component *component); ++ ++int vchiq_mmal_component_enable( ++ struct vchiq_mmal_instance *instance, ++ struct vchiq_mmal_component *component); ++ ++int vchiq_mmal_component_disable( ++ struct vchiq_mmal_instance *instance, ++ struct vchiq_mmal_component *component); ++ ++ ++ ++/* enable a mmal port ++ * ++ * enables a port and if a buffer callback provided enque buffer ++ * headers as apropriate for the port. ++ */ ++int vchiq_mmal_port_enable( ++ struct vchiq_mmal_instance *instance, ++ struct vchiq_mmal_port *port, ++ vchiq_mmal_buffer_cb buffer_cb); ++ ++/* disable a port ++ * ++ * disable a port will dequeue any pending buffers ++ */ ++int vchiq_mmal_port_disable(struct vchiq_mmal_instance *instance, ++ struct vchiq_mmal_port *port); ++ ++ ++int vchiq_mmal_port_parameter_set(struct vchiq_mmal_instance *instance, ++ struct vchiq_mmal_port *port, ++ u32 parameter, ++ void *value, ++ u32 value_size); ++ ++int vchiq_mmal_port_parameter_get(struct vchiq_mmal_instance *instance, ++ struct vchiq_mmal_port *port, ++ u32 parameter, ++ void *value, ++ u32 *value_size); ++ ++int vchiq_mmal_port_set_format(struct vchiq_mmal_instance *instance, ++ struct vchiq_mmal_port *port); ++ ++int vchiq_mmal_port_connect_tunnel(struct vchiq_mmal_instance *instance, ++ struct vchiq_mmal_port *src, ++ struct vchiq_mmal_port *dst); ++ ++int vchiq_mmal_version(struct vchiq_mmal_instance *instance, ++ u32 *major_out, ++ u32 *minor_out); ++ ++int vchiq_mmal_submit_buffer(struct vchiq_mmal_instance *instance, ++ struct vchiq_mmal_port *port, ++ struct mmal_buffer *buf); ++ ++#endif /* MMAL_VCHIQ_H */ + +From f91fde0e119041b5a8c762748fc51c2637eb38a4 Mon Sep 17 00:00:00 2001 +From: Phil Elwell <phil@raspberrypi.org> +Date: Mon, 11 May 2015 09:00:42 +0100 +Subject: [PATCH 054/112] scripts: Add mkknlimg and knlinfo scripts from tools + repo + +The Raspberry Pi firmware looks for a trailer on the kernel image to +determine whether it was compiled with Device Tree support enabled. +If the firmware finds a kernel without this trailer, or which has a +trailer indicating that it isn't DT-capable, it disables DT support +and reverts to using ATAGs. + +The mkknlimg utility adds that trailer, having first analysed the +image to look for signs of DT support and the kernel version string. + +knlinfo displays the contents of the trailer in the given kernel image. + +scripts/mkknlimg: Add support for ARCH_BCM2835 + +Add a new trailer field indicating whether this is an ARCH_BCM2835 +build, as opposed to MACH_BCM2708/9. If the loader finds this flag +is set it changes the default base dtb file name from bcm270x... +to bcm283y... + +Also update knlinfo to show the status of the field. + +scripts/mkknlimg: Improve ARCH_BCM2835 detection + +The board support code contains sufficient strings to be able to +distinguish 2708 vs. 2835 builds, so remove the check for +bcm2835-pm-wdt which could exist in either. + +Also, since the canned configuration is no longer built in (it's +a module), remove the config string checking. + +See: https://github.com/raspberrypi/linux/issues/1157 + +scripts: Multi-platform support for mkknlimg and knlinfo + +The firmware uses tags in the kernel trailer to choose which dtb file +to load. Current firmware loads bcm2835-*.dtb if the '283x' tag is true, +otherwise it loads bcm270*.dtb. This scheme breaks if an image supports +multiple platforms. + +This patch adds '270X' and '283X' tags to indicate support for RPi and +upstream platforms, respectively. '283x' (note lower case 'x') is left +for old firmware, and is only set if the image only supports upstream +builds. + +scripts/mkknlimg: Append a trailer for all input + +Now that the firmware assumes an unsigned kernel is DT-capable, it is +helpful to be able to mark a kernel as being non-DT-capable. + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> + +scripts/knlinfo: Decode DDTK atom + +Show the DDTK atom as being a boolean. + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> +--- + scripts/knlinfo | 171 ++++++++++++++++++++++++++++++++++++ + scripts/mkknlimg | 263 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 434 insertions(+) + create mode 100755 scripts/knlinfo + create mode 100755 scripts/mkknlimg + +diff --git a/scripts/knlinfo b/scripts/knlinfo +new file mode 100755 +index 0000000..263ec93 +--- /dev/null ++++ b/scripts/knlinfo +@@ -0,0 +1,171 @@ ++#!/usr/bin/env perl ++# ---------------------------------------------------------------------- ++# knlinfo by Phil Elwell for Raspberry Pi ++# ++# (c) 2014,2015 Raspberry Pi (Trading) Limited <info@raspberrypi.org> ++# ++# Licensed under the terms of the GNU General Public License. ++# ---------------------------------------------------------------------- ++ ++use strict; ++use integer; ++ ++use Fcntl ":seek"; ++ ++my $trailer_magic = 'RPTL'; ++ ++my %atom_formats = ++( ++ 'DDTK' => \&format_bool, ++ 'DTOK' => \&format_bool, ++ 'KVer' => \&format_string, ++ '270X' => \&format_bool, ++ '283X' => \&format_bool, ++ '283x' => \&format_bool, ++); ++ ++if (@ARGV != 1) ++{ ++ print ("Usage: knlinfo <kernel image>\n"); ++ exit(1); ++} ++ ++my $kernel_file = $ARGV[0]; ++ ++ ++my ($atoms, $pos) = read_trailer($kernel_file); ++ ++exit(1) if (!$atoms); ++ ++printf("Kernel trailer found at %d/0x%x:\n", $pos, $pos); ++ ++foreach my $atom (@$atoms) ++{ ++ printf(" %s: %s\n", $atom->[0], format_atom($atom)); ++} ++ ++exit(0); ++ ++sub read_trailer ++{ ++ my ($kernel_file) = @_; ++ my $fh; ++ ++ if (!open($fh, '<', $kernel_file)) ++ { ++ print ("* Failed to open '$kernel_file'\n"); ++ return undef; ++ } ++ ++ if (!seek($fh, -12, SEEK_END)) ++ { ++ print ("* seek error in '$kernel_file'\n"); ++ return undef; ++ } ++ ++ my $last_bytes; ++ sysread($fh, $last_bytes, 12); ++ ++ my ($trailer_len, $data_len, $magic) = unpack('VVa4', $last_bytes); ++ ++ if (($magic ne $trailer_magic) || ($data_len != 4)) ++ { ++ print ("* no trailer\n"); ++ return undef; ++ } ++ if (!seek($fh, -12, SEEK_END)) ++ { ++ print ("* seek error in '$kernel_file'\n"); ++ return undef; ++ } ++ ++ $trailer_len -= 12; ++ ++ while ($trailer_len > 0) ++ { ++ if ($trailer_len < 8) ++ { ++ print ("* truncated atom header in trailer\n"); ++ return undef; ++ } ++ if (!seek($fh, -8, SEEK_CUR)) ++ { ++ print ("* seek error in '$kernel_file'\n"); ++ return undef; ++ } ++ $trailer_len -= 8; ++ ++ my $atom_hdr; ++ sysread($fh, $atom_hdr, 8); ++ my ($atom_len, $atom_type) = unpack('Va4', $atom_hdr); ++ ++ if ($trailer_len < $atom_len) ++ { ++ print ("* truncated atom data in trailer\n"); ++ return undef; ++ } ++ ++ my $rounded_len = (($atom_len + 3) & ~3); ++ if (!seek($fh, -(8 + $rounded_len), SEEK_CUR)) ++ { ++ print ("* seek error in '$kernel_file'\n"); ++ return undef; ++ } ++ $trailer_len -= $rounded_len; ++ ++ my $atom_data; ++ sysread($fh, $atom_data, $atom_len); ++ ++ if (!seek($fh, -$atom_len, SEEK_CUR)) ++ { ++ print ("* seek error in '$kernel_file'\n"); ++ return undef; ++ } ++ ++ push @$atoms, [ $atom_type, $atom_data ]; ++ } ++ ++ if (($$atoms[-1][0] eq "\x00\x00\x00\x00") && ++ ($$atoms[-1][1] eq "")) ++ { ++ pop @$atoms; ++ } ++ else ++ { ++ print ("* end marker missing from trailer\n"); ++ } ++ ++ return ($atoms, tell($fh)); ++} ++ ++sub format_atom ++{ ++ my ($atom) = @_; ++ ++ my $format_func = $atom_formats{$atom->[0]} || \&format_hex; ++ return $format_func->($atom->[1]); ++} ++ ++sub format_bool ++{ ++ my ($data) = @_; ++ return unpack('V', $data) ? 'y' : 'n'; ++} ++ ++sub format_int ++{ ++ my ($data) = @_; ++ return unpack('V', $data); ++} ++ ++sub format_string ++{ ++ my ($data) = @_; ++ return '"'.$data.'"'; ++} ++ ++sub format_hex ++{ ++ my ($data) = @_; ++ return unpack('H*', $data); ++} +diff --git a/scripts/mkknlimg b/scripts/mkknlimg +new file mode 100755 +index 0000000..78c5845 +--- /dev/null ++++ b/scripts/mkknlimg +@@ -0,0 +1,263 @@ ++#!/usr/bin/env perl ++# ---------------------------------------------------------------------- ++# mkknlimg by Phil Elwell for Raspberry Pi ++# based on extract-ikconfig by Dick Streefland ++# ++# (c) 2009,2010 Dick Streefland <dick@streefland.net> ++# (c) 2014,2015 Raspberry Pi (Trading) Limited <info@raspberrypi.org> ++# ++# Licensed under the terms of the GNU General Public License. ++# ---------------------------------------------------------------------- ++ ++use strict; ++use warnings; ++use integer; ++ ++use constant FLAG_PI => 0x01; ++use constant FLAG_DTOK => 0x02; ++use constant FLAG_DDTK => 0x04; ++use constant FLAG_270X => 0x08; ++use constant FLAG_283X => 0x10; ++ ++my $trailer_magic = 'RPTL'; ++ ++my $tmpfile1 = "/tmp/mkknlimg_$$.1"; ++my $tmpfile2 = "/tmp/mkknlimg_$$.2"; ++ ++my $dtok = 0; ++my $ddtk = 0; ++my $is_270x = 0; ++my $is_283x = 0; ++ ++while (@ARGV && ($ARGV[0] =~ /^-/)) ++{ ++ my $arg = shift(@ARGV); ++ if ($arg eq '--dtok') ++ { ++ $dtok = 1; ++ } ++ elsif ($arg eq '--ddtk') ++ { ++ $ddtk = 1; ++ } ++ elsif ($arg eq '--270x') ++ { ++ $is_270x = 1; ++ } ++ elsif ($arg eq '--283x') ++ { ++ $is_283x = 1; ++ } ++ else ++ { ++ print ("* Unknown option '$arg'\n"); ++ usage(); ++ } ++} ++ ++usage() if (@ARGV != 2); ++ ++my $kernel_file = $ARGV[0]; ++my $out_file = $ARGV[1]; ++ ++if (! -r $kernel_file) ++{ ++ print ("* File '$kernel_file' not found\n"); ++ usage(); ++} ++ ++my $wanted_strings = ++{ ++ 'bcm2708_fb' => FLAG_PI, ++ 'brcm,bcm2835-mmc' => FLAG_PI, ++ 'brcm,bcm2835-sdhost' => FLAG_PI, ++ 'brcm,bcm2708-pinctrl' => FLAG_PI | FLAG_DTOK, ++ 'brcm,bcm2835-gpio' => FLAG_PI | FLAG_DTOK, ++ 'brcm,bcm2708' => FLAG_PI | FLAG_DTOK | FLAG_270X, ++ 'brcm,bcm2709' => FLAG_PI | FLAG_DTOK | FLAG_270X, ++ 'brcm,bcm2835' => FLAG_PI | FLAG_DTOK | FLAG_283X, ++ 'brcm,bcm2836' => FLAG_PI | FLAG_DTOK | FLAG_283X, ++ 'of_overlay_apply' => FLAG_DTOK | FLAG_DDTK, ++}; ++ ++my $res = try_extract($kernel_file, $tmpfile1); ++$res ||= try_decompress('\037\213\010', 'xy', 'gunzip', 0, ++ $kernel_file, $tmpfile1, $tmpfile2); ++$res ||= try_decompress('\3757zXZ\000', 'abcde', 'unxz --single-stream', -1, ++ $kernel_file, $tmpfile1, $tmpfile2); ++$res ||= try_decompress('BZh', 'xy', 'bunzip2', 0, ++ $kernel_file, $tmpfile1, $tmpfile2); ++$res ||= try_decompress('\135\0\0\0', 'xxx', 'unlzma', 0, ++ $kernel_file, $tmpfile1, $tmpfile2); ++$res ||= try_decompress('\211\114\132', 'xy', 'lzop -d', 0, ++ $kernel_file, $tmpfile1, $tmpfile2); ++$res ||= try_decompress('\002\041\114\030', 'xy', 'lz4 -d', 1, ++ $kernel_file, $tmpfile1, $tmpfile2); ++ ++my $append_trailer; ++my $trailer; ++my $kver = '?'; ++ ++$append_trailer = 1; ++ ++if ($res) ++{ ++ $kver = $res->{'kver'} || '?'; ++ my $flags = $res->{'flags'}; ++ print("Version: $kver\n"); ++ ++ if ($flags & FLAG_PI) ++ { ++ $dtok ||= ($flags & FLAG_DTOK) != 0; ++ $is_270x ||= ($flags & FLAG_270X) != 0; ++ $is_283x ||= ($flags & FLAG_283X) != 0; ++ $ddtk ||= ($flags & FLAG_DDTK) != 0; ++ } ++ else ++ { ++ print ("* This doesn't look like a Raspberry Pi kernel.\n"); ++ } ++} ++elsif (!$dtok) ++{ ++ print ("* Is this a valid kernel?\n"); ++} ++ ++if ($append_trailer) ++{ ++ printf("DT: %s\n", $dtok ? "y" : "n"); ++ printf("DDT: %s\n", $ddtk ? "y" : "n"); ++ printf("270x: %s\n", $is_270x ? "y" : "n"); ++ printf("283x: %s\n", $is_283x ? "y" : "n"); ++ ++ my @atoms; ++ ++ push @atoms, [ $trailer_magic, pack('V', 0) ]; ++ push @atoms, [ 'KVer', $kver ]; ++ push @atoms, [ 'DTOK', pack('V', $dtok) ]; ++ push @atoms, [ 'DDTK', pack('V', $ddtk) ]; ++ push @atoms, [ '270X', pack('V', $is_270x) ]; ++ push @atoms, [ '283X', pack('V', $is_283x) ]; ++ push @atoms, [ '283x', pack('V', $is_283x && !$is_270x) ]; ++ ++ $trailer = pack_trailer(\@atoms); ++ $atoms[0]->[1] = pack('V', length($trailer)); ++ ++ $trailer = pack_trailer(\@atoms); ++} ++ ++my $ofh; ++my $total_len = 0; ++ ++if ($out_file eq $kernel_file) ++{ ++ die "* Failed to open '$out_file' for append\n" ++ if (!open($ofh, '>>', $out_file)); ++ $total_len = tell($ofh); ++} ++else ++{ ++ die "* Failed to open '$kernel_file'\n" ++ if (!open(my $ifh, '<', $kernel_file)); ++ die "* Failed to create '$out_file'\n" ++ if (!open($ofh, '>', $out_file)); ++ ++ my $copybuf; ++ while (1) ++ { ++ my $bytes = sysread($ifh, $copybuf, 64*1024); ++ last if (!$bytes); ++ syswrite($ofh, $copybuf, $bytes); ++ $total_len += $bytes; ++ } ++ close($ifh); ++} ++ ++if ($trailer) ++{ ++ # Pad to word-alignment ++ syswrite($ofh, "\x000\x000\x000", (-$total_len & 0x3)); ++ syswrite($ofh, $trailer); ++} ++ ++close($ofh); ++ ++exit($trailer ? 0 : 1); ++ ++END { ++ unlink($tmpfile1) if ($tmpfile1); ++ unlink($tmpfile2) if ($tmpfile2); ++} ++ ++ ++sub usage ++{ ++ print ("Usage: mkknlimg [--dtok] [--270x] [--283x] <vmlinux|zImage|bzImage> <outfile>\n"); ++ exit(1); ++} ++ ++sub try_extract ++{ ++ my ($knl, $tmp) = @_; ++ ++ my $ver = `strings "$knl" | grep -a -E "^Linux version [1-9]"`; ++ ++ return undef if (!$ver); ++ ++ chomp($ver); ++ ++ my $res = { 'kver'=>$ver }; ++ $res->{'flags'} = strings_to_flags($knl, $wanted_strings); ++ ++ return $res; ++} ++ ++ ++sub try_decompress ++{ ++ my ($magic, $subst, $zcat, $idx, $knl, $tmp1, $tmp2) = @_; ++ ++ my $pos = `tr "$magic\n$subst" "\n$subst=" < "$knl" | grep -abo "^$subst"`; ++ if ($pos) ++ { ++ chomp($pos); ++ $pos = (split(/[\r\n]+/, $pos))[$idx]; ++ return undef if (!defined($pos)); ++ $pos =~ s/:.*[\r\n]*$//s; ++ my $cmd = "tail -c+$pos \"$knl\" | $zcat > $tmp2 2> /dev/null"; ++ my $err = (system($cmd) >> 8); ++ return undef if (($err != 0) && ($err != 2)); ++ ++ return try_extract($tmp2, $tmp1); ++ } ++ ++ return undef; ++} ++ ++sub strings_to_flags ++{ ++ my ($knl, $strings) = @_; ++ my $string_pattern = '^('.join('|', keys(%$strings)).')$'; ++ my $flags = 0; ++ ++ my @matches = `strings \"$knl\" | grep -E \"$string_pattern\"`; ++ foreach my $match (@matches) ++ { ++ chomp($match); ++ $flags |= $strings->{$match}; ++ } ++ ++ return $flags; ++} ++ ++sub pack_trailer ++{ ++ my ($atoms) = @_; ++ my $trailer = pack('VV', 0, 0); ++ for (my $i = $#$atoms; $i>=0; $i--) ++ { ++ my $atom = $atoms->[$i]; ++ $trailer .= pack('a*x!4Va4', $atom->[1], length($atom->[1]), $atom->[0]); ++ } ++ return $trailer; ++} + +From bcf6cc7b91fb794994940d91f41159cd16d1cb18 Mon Sep 17 00:00:00 2001 +From: Phil Elwell <phil@raspberrypi.org> +Date: Mon, 10 Aug 2015 09:49:15 +0100 +Subject: [PATCH 055/112] scripts/dtc: Update to upstream version 1.4.1 + +Includes the new localfixups format. + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> + +scripts/dtc: Fix UMR causing corrupt dtbo overlay files + +struct fixup_entry is allocated from the heap but it's member +local_fixup_generated was never initialized. This lead to +corrupted dtbo files. + +Fix this by initializing local_fixup_generated to false. + +Signed-off-by: Matthias Reichl <hias@horus.com> + +scripts/dtc: Only emit local fixups for overlays + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> +--- + scripts/dtc/checks.c | 106 +++++- + scripts/dtc/dtc-lexer.l | 5 + + scripts/dtc/dtc-lexer.lex.c_shipped | 537 +++++++++++++------------- + scripts/dtc/dtc-parser.tab.c_shipped | 714 ++++++++++++++++++----------------- + scripts/dtc/dtc-parser.tab.h_shipped | 46 +-- + scripts/dtc/dtc-parser.y | 22 +- + scripts/dtc/dtc.c | 9 +- + scripts/dtc/dtc.h | 40 ++ + scripts/dtc/flattree.c | 202 ++++++++++ + scripts/dtc/version_gen.h | 2 +- + 10 files changed, 1029 insertions(+), 654 deletions(-) + +diff --git a/scripts/dtc/checks.c b/scripts/dtc/checks.c +index 0c03ac9..88550b4 100644 +--- a/scripts/dtc/checks.c ++++ b/scripts/dtc/checks.c +@@ -458,6 +458,8 @@ static void fixup_phandle_references(struct check *c, struct node *dt, + struct node *node, struct property *prop) + { + struct marker *m = prop->val.markers; ++ struct fixup *f, **fp; ++ struct fixup_entry *fe, **fep; + struct node *refnode; + cell_t phandle; + +@@ -466,11 +468,70 @@ static void fixup_phandle_references(struct check *c, struct node *dt, + + refnode = get_node_by_ref(dt, m->ref); + if (! refnode) { +- FAIL(c, "Reference to non-existent node or label \"%s\"\n", +- m->ref); ++ if (!dt->is_plugin) { ++ FAIL(c, "Reference to non-existent node or label \"%s\"\n", ++ m->ref); ++ continue; ++ } ++ ++ /* allocate fixup entry */ ++ fe = xmalloc(sizeof(*fe)); ++ ++ fe->node = node; ++ fe->prop = prop; ++ fe->offset = m->offset; ++ fe->next = NULL; ++ ++ /* search for an already existing fixup */ ++ for_each_fixup(dt, f) ++ if (strcmp(f->ref, m->ref) == 0) ++ break; ++ ++ /* no fixup found, add new */ ++ if (f == NULL) { ++ f = xmalloc(sizeof(*f)); ++ f->ref = m->ref; ++ f->entries = NULL; ++ f->next = NULL; ++ ++ /* add it to the tree */ ++ fp = &dt->fixups; ++ while (*fp) ++ fp = &(*fp)->next; ++ *fp = f; ++ } ++ ++ /* and now append fixup entry */ ++ fep = &f->entries; ++ while (*fep) ++ fep = &(*fep)->next; ++ *fep = fe; ++ ++ /* mark the entry as unresolved */ ++ *((cell_t *)(prop->val.val + m->offset)) = ++ cpu_to_fdt32(0xdeadbeef); + continue; + } + ++ /* if it's a local reference, we need to record it */ ++ if (symbol_fixup_support && dt->is_plugin) { ++ ++ /* allocate a new local fixup entry */ ++ fe = xmalloc(sizeof(*fe)); ++ ++ fe->node = node; ++ fe->prop = prop; ++ fe->offset = m->offset; ++ fe->next = NULL; ++ fe->local_fixup_generated = false; ++ ++ /* append it to the local fixups */ ++ fep = &dt->local_fixups; ++ while (*fep) ++ fep = &(*fep)->next; ++ *fep = fe; ++ } ++ + phandle = get_node_phandle(dt, refnode); + *((cell_t *)(prop->val.val + m->offset)) = cpu_to_fdt32(phandle); + } +@@ -652,6 +713,45 @@ static void check_obsolete_chosen_interrupt_controller(struct check *c, + } + TREE_WARNING(obsolete_chosen_interrupt_controller, NULL); + ++static void check_auto_label_phandles(struct check *c, struct node *dt, ++ struct node *node) ++{ ++ struct label *l; ++ struct symbol *s, **sp; ++ int has_label; ++ ++ if (!symbol_fixup_support) ++ return; ++ ++ has_label = 0; ++ for_each_label(node->labels, l) { ++ has_label = 1; ++ break; ++ } ++ ++ if (!has_label) ++ return; ++ ++ /* force allocation of a phandle for this node */ ++ (void)get_node_phandle(dt, node); ++ ++ /* add the symbol */ ++ for_each_label(node->labels, l) { ++ ++ s = xmalloc(sizeof(*s)); ++ s->label = l; ++ s->node = node; ++ s->next = NULL; ++ ++ /* add it to the symbols list */ ++ sp = &dt->symbols; ++ while (*sp) ++ sp = &((*sp)->next); ++ *sp = s; ++ } ++} ++NODE_WARNING(auto_label_phandles, NULL); ++ + static struct check *check_table[] = { + &duplicate_node_names, &duplicate_property_names, + &node_name_chars, &node_name_format, &property_name_chars, +@@ -670,6 +770,8 @@ static struct check *check_table[] = { + &avoid_default_addr_size, + &obsolete_chosen_interrupt_controller, + ++ &auto_label_phandles, ++ + &always_fail, + }; + +diff --git a/scripts/dtc/dtc-lexer.l b/scripts/dtc/dtc-lexer.l +index 790fbf6..40bbc87 100644 +--- a/scripts/dtc/dtc-lexer.l ++++ b/scripts/dtc/dtc-lexer.l +@@ -121,6 +121,11 @@ static void lexical_error(const char *fmt, ...); + return DT_V1; + } + ++<*>"/plugin/" { ++ DPRINT("Keyword: /plugin/\n"); ++ return DT_PLUGIN; ++ } ++ + <*>"/memreserve/" { + DPRINT("Keyword: /memreserve/\n"); + BEGIN_DEFAULT(); +diff --git a/scripts/dtc/dtc-lexer.lex.c_shipped b/scripts/dtc/dtc-lexer.lex.c_shipped +index ba525c2..1518525 100644 +--- a/scripts/dtc/dtc-lexer.lex.c_shipped ++++ b/scripts/dtc/dtc-lexer.lex.c_shipped +@@ -9,7 +9,7 @@ + #define FLEX_SCANNER + #define YY_FLEX_MAJOR_VERSION 2 + #define YY_FLEX_MINOR_VERSION 5 +-#define YY_FLEX_SUBMINOR_VERSION 39 ++#define YY_FLEX_SUBMINOR_VERSION 35 + #if YY_FLEX_SUBMINOR_VERSION > 0 + #define FLEX_BETA + #endif +@@ -162,12 +162,7 @@ typedef unsigned int flex_uint32_t; + typedef struct yy_buffer_state *YY_BUFFER_STATE; + #endif + +-#ifndef YY_TYPEDEF_YY_SIZE_T +-#define YY_TYPEDEF_YY_SIZE_T +-typedef size_t yy_size_t; +-#endif +- +-extern yy_size_t yyleng; ++extern int yyleng; + + extern FILE *yyin, *yyout; + +@@ -176,7 +171,6 @@ extern FILE *yyin, *yyout; + #define EOB_ACT_LAST_MATCH 2 + + #define YY_LESS_LINENO(n) +- #define YY_LINENO_REWIND_TO(ptr) + + /* Return all but the first "n" matched characters back to the input stream. */ + #define yyless(n) \ +@@ -194,6 +188,11 @@ extern FILE *yyin, *yyout; + + #define unput(c) yyunput( c, (yytext_ptr) ) + ++#ifndef YY_TYPEDEF_YY_SIZE_T ++#define YY_TYPEDEF_YY_SIZE_T ++typedef size_t yy_size_t; ++#endif ++ + #ifndef YY_STRUCT_YY_BUFFER_STATE + #define YY_STRUCT_YY_BUFFER_STATE + struct yy_buffer_state +@@ -211,7 +210,7 @@ struct yy_buffer_state + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ +- yy_size_t yy_n_chars; ++ int yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to +@@ -281,8 +280,8 @@ static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ + + /* yy_hold_char holds the character lost when yytext is formed. */ + static char yy_hold_char; +-static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */ +-yy_size_t yyleng; ++static int yy_n_chars; /* number of characters read into yy_ch_buf */ ++int yyleng; + + /* Points to current character in buffer. */ + static char *yy_c_buf_p = (char *) 0; +@@ -310,7 +309,7 @@ static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ); + + YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ); + YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ); +-YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,yy_size_t len ); ++YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len ); + + void *yyalloc (yy_size_t ); + void *yyrealloc (void *,yy_size_t ); +@@ -342,7 +341,7 @@ void yyfree (void * ); + + /* Begin user sect3 */ + +-#define yywrap() 1 ++#define yywrap(n) 1 + #define YY_SKIP_YYWRAP + + typedef unsigned char YY_CHAR; +@@ -373,8 +372,8 @@ static void yy_fatal_error (yyconst char msg[] ); + *yy_cp = '\0'; \ + (yy_c_buf_p) = yy_cp; + +-#define YY_NUM_RULES 30 +-#define YY_END_OF_BUFFER 31 ++#define YY_NUM_RULES 31 ++#define YY_END_OF_BUFFER 32 + /* This struct is not used in this scanner, + but its presence is necessary. */ + struct yy_trans_info +@@ -382,25 +381,26 @@ struct yy_trans_info + flex_int32_t yy_verify; + flex_int32_t yy_nxt; + }; +-static yyconst flex_int16_t yy_accept[159] = ++static yyconst flex_int16_t yy_accept[166] = + { 0, +- 0, 0, 0, 0, 0, 0, 0, 0, 31, 29, +- 18, 18, 29, 29, 29, 29, 29, 29, 29, 29, +- 29, 29, 29, 29, 29, 29, 15, 16, 16, 29, +- 16, 10, 10, 18, 26, 0, 3, 0, 27, 12, +- 0, 0, 11, 0, 0, 0, 0, 0, 0, 0, +- 21, 23, 25, 24, 22, 0, 9, 28, 0, 0, +- 0, 14, 14, 16, 16, 16, 10, 10, 10, 0, +- 12, 0, 11, 0, 0, 0, 20, 0, 0, 0, +- 0, 0, 0, 0, 0, 16, 10, 10, 10, 0, +- 13, 19, 0, 0, 0, 0, 0, 0, 0, 0, +- +- 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, +- 0, 16, 6, 0, 0, 0, 0, 0, 0, 2, +- 0, 0, 0, 0, 0, 0, 0, 0, 4, 17, +- 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, +- 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, +- 5, 8, 0, 0, 0, 0, 7, 0 ++ 0, 0, 0, 0, 0, 0, 0, 0, 32, 30, ++ 19, 19, 30, 30, 30, 30, 30, 30, 30, 30, ++ 30, 30, 30, 30, 30, 30, 16, 17, 17, 30, ++ 17, 11, 11, 19, 27, 0, 3, 0, 28, 13, ++ 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, ++ 0, 22, 24, 26, 25, 23, 0, 10, 29, 0, ++ 0, 0, 15, 15, 17, 17, 17, 11, 11, 11, ++ 0, 13, 0, 12, 0, 0, 0, 21, 0, 0, ++ 0, 0, 0, 0, 0, 0, 0, 17, 11, 11, ++ 11, 0, 14, 20, 0, 0, 0, 0, 0, 0, ++ ++ 0, 0, 0, 0, 17, 0, 0, 0, 0, 0, ++ 0, 0, 0, 0, 0, 17, 7, 0, 0, 0, ++ 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, ++ 0, 0, 0, 0, 4, 18, 0, 0, 5, 2, ++ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ++ 0, 0, 1, 0, 0, 0, 0, 6, 9, 0, ++ 0, 0, 0, 8, 0 + } ; + + static yyconst flex_int32_t yy_ec[256] = +@@ -416,9 +416,9 @@ static yyconst flex_int32_t yy_ec[256] = + 22, 22, 22, 22, 24, 22, 22, 25, 22, 22, + 1, 26, 27, 1, 22, 1, 21, 28, 29, 30, + +- 31, 21, 22, 22, 32, 22, 22, 33, 34, 35, +- 36, 37, 22, 38, 39, 40, 41, 42, 22, 25, +- 43, 22, 44, 45, 46, 1, 1, 1, 1, 1, ++ 31, 21, 32, 22, 33, 22, 22, 34, 35, 36, ++ 37, 38, 22, 39, 40, 41, 42, 43, 22, 25, ++ 44, 22, 45, 46, 47, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +@@ -435,163 +435,165 @@ static yyconst flex_int32_t yy_ec[256] = + 1, 1, 1, 1, 1 + } ; + +-static yyconst flex_int32_t yy_meta[47] = ++static yyconst flex_int32_t yy_meta[48] = + { 0, + 1, 1, 1, 1, 1, 1, 2, 3, 1, 2, + 2, 2, 4, 5, 5, 5, 6, 1, 1, 1, + 7, 8, 8, 8, 8, 1, 1, 7, 7, 7, + 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, +- 8, 8, 8, 3, 1, 4 ++ 8, 8, 8, 8, 3, 1, 4 + } ; + +-static yyconst flex_int16_t yy_base[173] = ++static yyconst flex_int16_t yy_base[180] = + { 0, +- 0, 383, 34, 382, 65, 381, 37, 105, 387, 391, +- 54, 111, 367, 110, 109, 109, 112, 41, 366, 104, +- 367, 338, 124, 117, 0, 144, 391, 0, 121, 0, +- 135, 155, 140, 179, 391, 160, 391, 379, 391, 0, +- 368, 141, 391, 167, 370, 376, 346, 103, 342, 345, +- 391, 391, 391, 391, 391, 358, 391, 391, 175, 342, +- 338, 391, 355, 0, 185, 339, 184, 347, 346, 0, +- 0, 322, 175, 357, 175, 363, 352, 324, 330, 323, +- 332, 326, 201, 324, 329, 322, 391, 333, 181, 309, +- 391, 341, 340, 313, 320, 338, 178, 311, 146, 317, +- +- 314, 315, 335, 331, 303, 300, 309, 299, 308, 188, +- 336, 335, 391, 305, 320, 281, 283, 271, 203, 288, +- 281, 271, 266, 264, 245, 242, 208, 104, 391, 391, +- 244, 218, 204, 219, 206, 224, 201, 212, 204, 229, +- 215, 208, 207, 200, 219, 391, 233, 221, 200, 181, +- 391, 391, 149, 122, 86, 41, 391, 391, 245, 251, +- 259, 263, 267, 273, 280, 284, 292, 300, 304, 310, +- 318, 326 ++ 0, 393, 35, 392, 66, 391, 38, 107, 397, 401, ++ 55, 113, 377, 112, 111, 111, 114, 42, 376, 106, ++ 377, 347, 126, 120, 0, 147, 401, 0, 124, 0, ++ 137, 158, 170, 163, 401, 153, 401, 389, 401, 0, ++ 378, 120, 401, 131, 380, 386, 355, 139, 351, 355, ++ 351, 401, 401, 401, 401, 401, 367, 401, 401, 185, ++ 350, 346, 401, 364, 0, 185, 347, 189, 356, 355, ++ 0, 0, 330, 180, 366, 141, 372, 361, 332, 338, ++ 331, 341, 334, 326, 205, 331, 337, 329, 401, 341, ++ 167, 316, 401, 349, 348, 320, 328, 346, 180, 318, ++ ++ 324, 209, 324, 320, 322, 342, 338, 309, 306, 315, ++ 305, 315, 312, 192, 342, 341, 401, 293, 306, 282, ++ 268, 252, 255, 203, 285, 282, 272, 268, 252, 233, ++ 232, 239, 208, 107, 401, 401, 238, 211, 401, 211, ++ 212, 208, 228, 203, 215, 207, 233, 222, 212, 211, ++ 203, 227, 401, 237, 225, 204, 185, 401, 401, 149, ++ 128, 88, 42, 401, 401, 253, 259, 267, 271, 275, ++ 281, 288, 292, 300, 308, 312, 318, 326, 334 + } ; + +-static yyconst flex_int16_t yy_def[173] = ++static yyconst flex_int16_t yy_def[180] = + { 0, +- 158, 1, 1, 3, 158, 5, 1, 1, 158, 158, +- 158, 158, 158, 159, 160, 161, 158, 158, 158, 158, +- 162, 158, 158, 158, 163, 162, 158, 164, 165, 164, +- 164, 158, 158, 158, 158, 159, 158, 159, 158, 166, +- 158, 161, 158, 161, 167, 168, 158, 158, 158, 158, +- 158, 158, 158, 158, 158, 162, 158, 158, 158, 158, +- 158, 158, 162, 164, 165, 164, 158, 158, 158, 169, +- 166, 170, 161, 167, 167, 168, 158, 158, 158, 158, +- 158, 158, 158, 158, 158, 164, 158, 158, 169, 170, +- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, +- +- 158, 164, 158, 158, 158, 158, 158, 158, 158, 171, +- 158, 164, 158, 158, 158, 158, 158, 158, 171, 158, +- 171, 158, 158, 158, 158, 158, 158, 158, 158, 158, +- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, +- 172, 158, 158, 158, 172, 158, 172, 158, 158, 158, +- 158, 158, 158, 158, 158, 158, 158, 0, 158, 158, +- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, +- 158, 158 ++ 165, 1, 1, 3, 165, 5, 1, 1, 165, 165, ++ 165, 165, 165, 166, 167, 168, 165, 165, 165, 165, ++ 169, 165, 165, 165, 170, 169, 165, 171, 172, 171, ++ 171, 165, 165, 165, 165, 166, 165, 166, 165, 173, ++ 165, 168, 165, 168, 174, 175, 165, 165, 165, 165, ++ 165, 165, 165, 165, 165, 165, 169, 165, 165, 165, ++ 165, 165, 165, 169, 171, 172, 171, 165, 165, 165, ++ 176, 173, 177, 168, 174, 174, 175, 165, 165, 165, ++ 165, 165, 165, 165, 165, 165, 165, 171, 165, 165, ++ 176, 177, 165, 165, 165, 165, 165, 165, 165, 165, ++ ++ 165, 165, 165, 165, 171, 165, 165, 165, 165, 165, ++ 165, 165, 165, 178, 165, 171, 165, 165, 165, 165, ++ 165, 165, 165, 178, 165, 178, 165, 165, 165, 165, ++ 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, ++ 165, 165, 165, 165, 165, 165, 165, 179, 165, 165, ++ 165, 179, 165, 179, 165, 165, 165, 165, 165, 165, ++ 165, 165, 165, 165, 0, 165, 165, 165, 165, 165, ++ 165, 165, 165, 165, 165, 165, 165, 165, 165 + } ; + +-static yyconst flex_int16_t yy_nxt[438] = ++static yyconst flex_int16_t yy_nxt[449] = + { 0, + 10, 11, 12, 11, 13, 14, 10, 15, 16, 10, + 10, 10, 17, 10, 10, 10, 10, 18, 19, 20, + 21, 21, 21, 21, 21, 10, 10, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, +- 21, 21, 21, 10, 22, 10, 24, 25, 25, 25, +- 32, 33, 33, 157, 26, 34, 34, 34, 51, 52, +- 27, 26, 26, 26, 26, 10, 11, 12, 11, 13, +- 14, 28, 15, 16, 28, 28, 28, 24, 28, 28, +- 28, 10, 18, 19, 20, 29, 29, 29, 29, 29, +- 30, 10, 29, 29, 29, 29, 29, 29, 29, 29, +- +- 29, 29, 29, 29, 29, 29, 29, 29, 10, 22, +- 10, 23, 34, 34, 34, 37, 39, 43, 32, 33, +- 33, 45, 54, 55, 46, 59, 45, 64, 156, 46, +- 64, 64, 64, 79, 44, 38, 59, 57, 134, 47, +- 135, 48, 80, 49, 47, 50, 48, 99, 61, 43, +- 50, 110, 41, 67, 67, 67, 60, 63, 63, 63, +- 57, 155, 68, 69, 63, 37, 44, 66, 67, 67, +- 67, 63, 63, 63, 63, 73, 59, 68, 69, 70, +- 34, 34, 34, 43, 75, 38, 154, 92, 83, 83, +- 83, 64, 44, 120, 64, 64, 64, 67, 67, 67, +- +- 44, 57, 99, 68, 69, 107, 68, 69, 120, 127, +- 108, 153, 152, 121, 83, 83, 83, 133, 133, 133, +- 146, 133, 133, 133, 146, 140, 140, 140, 121, 141, +- 140, 140, 140, 151, 141, 158, 150, 149, 148, 144, +- 147, 143, 142, 139, 147, 36, 36, 36, 36, 36, +- 36, 36, 36, 40, 138, 137, 136, 40, 40, 42, +- 42, 42, 42, 42, 42, 42, 42, 56, 56, 56, +- 56, 62, 132, 62, 64, 131, 130, 64, 129, 64, +- 64, 65, 128, 158, 65, 65, 65, 65, 71, 127, +- 71, 71, 74, 74, 74, 74, 74, 74, 74, 74, +- +- 76, 76, 76, 76, 76, 76, 76, 76, 89, 126, +- 89, 90, 125, 90, 90, 124, 90, 90, 119, 119, +- 119, 119, 119, 119, 119, 119, 145, 145, 145, 145, +- 145, 145, 145, 145, 123, 122, 59, 59, 118, 117, +- 116, 115, 114, 113, 45, 112, 108, 111, 109, 106, +- 105, 104, 46, 103, 91, 87, 102, 101, 100, 98, +- 97, 96, 95, 94, 93, 77, 75, 91, 88, 87, +- 86, 57, 85, 84, 57, 82, 81, 78, 77, 75, +- 72, 158, 58, 57, 53, 35, 158, 31, 23, 23, +- 9, 158, 158, 158, 158, 158, 158, 158, 158, 158, +- +- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, +- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, +- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, +- 158, 158, 158, 158, 158, 158, 158 ++ 21, 21, 21, 21, 10, 22, 10, 24, 25, 25, ++ 25, 32, 33, 33, 164, 26, 34, 34, 34, 52, ++ 53, 27, 26, 26, 26, 26, 10, 11, 12, 11, ++ 13, 14, 28, 15, 16, 28, 28, 28, 24, 28, ++ 28, 28, 10, 18, 19, 20, 29, 29, 29, 29, ++ 29, 30, 10, 29, 29, 29, 29, 29, 29, 29, ++ ++ 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, ++ 10, 22, 10, 23, 34, 34, 34, 37, 39, 43, ++ 32, 33, 33, 45, 55, 56, 46, 60, 43, 45, ++ 65, 163, 46, 65, 65, 65, 44, 38, 60, 74, ++ 58, 47, 141, 48, 142, 44, 49, 47, 50, 48, ++ 76, 51, 62, 94, 50, 41, 44, 51, 37, 61, ++ 64, 64, 64, 58, 34, 34, 34, 64, 162, 80, ++ 67, 68, 68, 68, 64, 64, 64, 64, 38, 81, ++ 69, 70, 71, 68, 68, 68, 60, 161, 43, 69, ++ 70, 65, 69, 70, 65, 65, 65, 125, 85, 85, ++ ++ 85, 58, 68, 68, 68, 44, 102, 110, 125, 133, ++ 102, 69, 70, 111, 114, 160, 159, 126, 85, 85, ++ 85, 140, 140, 140, 140, 140, 140, 153, 126, 147, ++ 147, 147, 153, 148, 147, 147, 147, 158, 148, 165, ++ 157, 156, 155, 151, 150, 149, 146, 154, 145, 144, ++ 143, 139, 154, 36, 36, 36, 36, 36, 36, 36, ++ 36, 40, 138, 137, 136, 40, 40, 42, 42, 42, ++ 42, 42, 42, 42, 42, 57, 57, 57, 57, 63, ++ 135, 63, 65, 134, 165, 65, 133, 65, 65, 66, ++ 132, 131, 66, 66, 66, 66, 72, 130, 72, 72, ++ ++ 75, 75, 75, 75, 75, 75, 75, 75, 77, 77, ++ 77, 77, 77, 77, 77, 77, 91, 129, 91, 92, ++ 128, 92, 92, 127, 92, 92, 124, 124, 124, 124, ++ 124, 124, 124, 124, 152, 152, 152, 152, 152, 152, ++ 152, 152, 60, 60, 123, 122, 121, 120, 119, 118, ++ 117, 45, 116, 111, 115, 113, 112, 109, 108, 107, ++ 46, 106, 93, 89, 105, 104, 103, 101, 100, 99, ++ 98, 97, 96, 95, 78, 76, 93, 90, 89, 88, ++ 58, 87, 86, 58, 84, 83, 82, 79, 78, 76, ++ 73, 165, 59, 58, 54, 35, 165, 31, 23, 23, ++ ++ 9, 165, 165, 165, 165, 165, 165, 165, 165, 165, ++ 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, ++ 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, ++ 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, ++ 165, 165, 165, 165, 165, 165, 165, 165 + } ; + +-static yyconst flex_int16_t yy_chk[438] = ++static yyconst flex_int16_t yy_chk[449] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +- 1, 1, 1, 1, 1, 1, 3, 3, 3, 3, +- 7, 7, 7, 156, 3, 11, 11, 11, 18, 18, +- 3, 3, 3, 3, 3, 5, 5, 5, 5, 5, ++ 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, ++ 3, 7, 7, 7, 163, 3, 11, 11, 11, 18, ++ 18, 3, 3, 3, 3, 3, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, +- 5, 8, 12, 12, 12, 14, 15, 16, 8, 8, +- 8, 17, 20, 20, 17, 23, 24, 29, 155, 24, +- 29, 29, 29, 48, 16, 14, 31, 29, 128, 17, +- 128, 17, 48, 17, 24, 17, 24, 99, 24, 42, +- 24, 99, 15, 33, 33, 33, 23, 26, 26, 26, +- 26, 154, 33, 33, 26, 36, 42, 31, 32, 32, +- 32, 26, 26, 26, 26, 44, 59, 32, 32, 32, +- 34, 34, 34, 73, 75, 36, 153, 75, 59, 59, +- 59, 65, 44, 110, 65, 65, 65, 67, 67, 67, +- +- 73, 65, 83, 89, 89, 97, 67, 67, 119, 127, +- 97, 150, 149, 110, 83, 83, 83, 133, 133, 133, +- 141, 127, 127, 127, 145, 136, 136, 136, 119, 136, +- 140, 140, 140, 148, 140, 147, 144, 143, 142, 139, +- 141, 138, 137, 135, 145, 159, 159, 159, 159, 159, +- 159, 159, 159, 160, 134, 132, 131, 160, 160, 161, +- 161, 161, 161, 161, 161, 161, 161, 162, 162, 162, +- 162, 163, 126, 163, 164, 125, 124, 164, 123, 164, +- 164, 165, 122, 121, 165, 165, 165, 165, 166, 120, +- 166, 166, 167, 167, 167, 167, 167, 167, 167, 167, +- +- 168, 168, 168, 168, 168, 168, 168, 168, 169, 118, +- 169, 170, 117, 170, 170, 116, 170, 170, 171, 171, +- 171, 171, 171, 171, 171, 171, 172, 172, 172, 172, +- 172, 172, 172, 172, 115, 114, 112, 111, 109, 108, +- 107, 106, 105, 104, 103, 102, 101, 100, 98, 96, +- 95, 94, 93, 92, 90, 88, 86, 85, 84, 82, +- 81, 80, 79, 78, 77, 76, 74, 72, 69, 68, +- 66, 63, 61, 60, 56, 50, 49, 47, 46, 45, ++ 5, 5, 5, 8, 12, 12, 12, 14, 15, 16, ++ 8, 8, 8, 17, 20, 20, 17, 23, 42, 24, ++ 29, 162, 24, 29, 29, 29, 16, 14, 31, 44, ++ 29, 17, 134, 17, 134, 42, 17, 24, 17, 24, ++ 76, 17, 24, 76, 24, 15, 44, 24, 36, 23, ++ 26, 26, 26, 26, 34, 34, 34, 26, 161, 48, ++ 31, 32, 32, 32, 26, 26, 26, 26, 36, 48, ++ 32, 32, 32, 33, 33, 33, 60, 160, 74, 91, ++ 91, 66, 33, 33, 66, 66, 66, 114, 60, 60, ++ ++ 60, 66, 68, 68, 68, 74, 85, 99, 124, 133, ++ 102, 68, 68, 99, 102, 157, 156, 114, 85, 85, ++ 85, 133, 133, 133, 140, 140, 140, 148, 124, 143, ++ 143, 143, 152, 143, 147, 147, 147, 155, 147, 154, ++ 151, 150, 149, 146, 145, 144, 142, 148, 141, 138, ++ 137, 132, 152, 166, 166, 166, 166, 166, 166, 166, ++ 166, 167, 131, 130, 129, 167, 167, 168, 168, 168, ++ 168, 168, 168, 168, 168, 169, 169, 169, 169, 170, ++ 128, 170, 171, 127, 126, 171, 125, 171, 171, 172, ++ 123, 122, 172, 172, 172, 172, 173, 121, 173, 173, ++ ++ 174, 174, 174, 174, 174, 174, 174, 174, 175, 175, ++ 175, 175, 175, 175, 175, 175, 176, 120, 176, 177, ++ 119, 177, 177, 118, 177, 177, 178, 178, 178, 178, ++ 178, 178, 178, 178, 179, 179, 179, 179, 179, 179, ++ 179, 179, 116, 115, 113, 112, 111, 110, 109, 108, ++ 107, 106, 105, 104, 103, 101, 100, 98, 97, 96, ++ 95, 94, 92, 90, 88, 87, 86, 84, 83, 82, ++ 81, 80, 79, 78, 77, 75, 73, 70, 69, 67, ++ 64, 62, 61, 57, 51, 50, 49, 47, 46, 45, + 41, 38, 22, 21, 19, 13, 9, 6, 4, 2, +- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, + +- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, +- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, +- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, +- 158, 158, 158, 158, 158, 158, 158 ++ 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, ++ 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, ++ 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, ++ 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, ++ 165, 165, 165, 165, 165, 165, 165, 165 + } ; + + static yy_state_type yy_last_accepting_state; +@@ -662,7 +664,7 @@ static int dts_version = 1; + static void push_input_file(const char *filename); + static bool pop_input_file(void); + static void lexical_error(const char *fmt, ...); +-#line 666 "dtc-lexer.lex.c" ++#line 668 "dtc-lexer.lex.c" + + #define INITIAL 0 + #define BYTESTRING 1 +@@ -704,7 +706,7 @@ FILE *yyget_out (void ); + + void yyset_out (FILE * out_str ); + +-yy_size_t yyget_leng (void ); ++int yyget_leng (void ); + + char *yyget_text (void ); + +@@ -853,6 +855,10 @@ YY_DECL + register char *yy_cp, *yy_bp; + register int yy_act; + ++#line 68 "dtc-lexer.l" ++ ++#line 861 "dtc-lexer.lex.c" ++ + if ( !(yy_init) ) + { + (yy_init) = 1; +@@ -879,11 +885,6 @@ YY_DECL + yy_load_buffer_state( ); + } + +- { +-#line 68 "dtc-lexer.l" +- +-#line 886 "dtc-lexer.lex.c" +- + while ( 1 ) /* loops until end-of-file is reached */ + { + yy_cp = (yy_c_buf_p); +@@ -901,7 +902,7 @@ YY_DECL + yy_match: + do + { +- register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ; ++ register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; +@@ -910,13 +911,13 @@ yy_match: + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; +- if ( yy_current_state >= 159 ) ++ if ( yy_current_state >= 166 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + ++yy_cp; + } +- while ( yy_current_state != 158 ); ++ while ( yy_current_state != 165 ); + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + +@@ -951,39 +952,31 @@ case 2: + YY_RULE_SETUP + #line 75 "dtc-lexer.l" + { +- char *line, *fnstart, *fnend; +- struct data fn; ++ char *line, *tmp, *fn; + /* skip text before line # */ + line = yytext; + while (!isdigit((unsigned char)*line)) + line++; +- +- /* regexp ensures that first and list " +- * in the whole yytext are those at +- * beginning and end of the filename string */ +- fnstart = memchr(yytext, '"', yyleng); +- for (fnend = yytext + yyleng - 1; +- *fnend != '"'; fnend--) +- ; +- assert(fnstart && fnend && (fnend > fnstart)); +- +- fn = data_copy_escape_string(fnstart + 1, +- fnend - fnstart - 1); +- +- /* Don't allow nuls in filenames */ +- if (memchr(fn.val, '\0', fn.len - 1)) +- lexical_error("nul in line number directive"); +- ++ /* skip digits in line # */ ++ tmp = line; ++ while (!isspace((unsigned char)*tmp)) ++ tmp++; ++ /* "NULL"-terminate line # */ ++ *tmp = '\0'; ++ /* start of filename */ ++ fn = strchr(tmp + 1, '"') + 1; ++ /* strip trailing " from filename */ ++ tmp = strchr(fn, '"'); ++ *tmp = 0; + /* -1 since #line is the number of the next line */ +- srcpos_set_line(xstrdup(fn.val), atoi(line) - 1); +- data_free(fn); ++ srcpos_set_line(xstrdup(fn), atoi(line) - 1); + } + YY_BREAK + case YY_STATE_EOF(INITIAL): + case YY_STATE_EOF(BYTESTRING): + case YY_STATE_EOF(PROPNODENAME): + case YY_STATE_EOF(V1): +-#line 104 "dtc-lexer.l" ++#line 96 "dtc-lexer.l" + { + if (!pop_input_file()) { + yyterminate(); +@@ -993,7 +986,7 @@ case YY_STATE_EOF(V1): + case 3: + /* rule 3 can match eol */ + YY_RULE_SETUP +-#line 110 "dtc-lexer.l" ++#line 102 "dtc-lexer.l" + { + DPRINT("String: %s\n", yytext); + yylval.data = data_copy_escape_string(yytext+1, +@@ -1003,7 +996,7 @@ YY_RULE_SETUP + YY_BREAK + case 4: + YY_RULE_SETUP +-#line 117 "dtc-lexer.l" ++#line 109 "dtc-lexer.l" + { + DPRINT("Keyword: /dts-v1/\n"); + dts_version = 1; +@@ -1013,25 +1006,33 @@ YY_RULE_SETUP + YY_BREAK + case 5: + YY_RULE_SETUP +-#line 124 "dtc-lexer.l" ++#line 116 "dtc-lexer.l" ++{ ++ DPRINT("Keyword: /plugin/\n"); ++ return DT_PLUGIN; ++ } ++ YY_BREAK ++case 6: ++YY_RULE_SETUP ++#line 121 "dtc-lexer.l" + { + DPRINT("Keyword: /memreserve/\n"); + BEGIN_DEFAULT(); + return DT_MEMRESERVE; + } + YY_BREAK +-case 6: ++case 7: + YY_RULE_SETUP +-#line 130 "dtc-lexer.l" ++#line 127 "dtc-lexer.l" + { + DPRINT("Keyword: /bits/\n"); + BEGIN_DEFAULT(); + return DT_BITS; + } + YY_BREAK +-case 7: ++case 8: + YY_RULE_SETUP +-#line 136 "dtc-lexer.l" ++#line 133 "dtc-lexer.l" + { + DPRINT("Keyword: /delete-property/\n"); + DPRINT("<PROPNODENAME>\n"); +@@ -1039,9 +1040,9 @@ YY_RULE_SETUP + return DT_DEL_PROP; + } + YY_BREAK +-case 8: ++case 9: + YY_RULE_SETUP +-#line 143 "dtc-lexer.l" ++#line 140 "dtc-lexer.l" + { + DPRINT("Keyword: /delete-node/\n"); + DPRINT("<PROPNODENAME>\n"); +@@ -1049,9 +1050,9 @@ YY_RULE_SETUP + return DT_DEL_NODE; + } + YY_BREAK +-case 9: ++case 10: + YY_RULE_SETUP +-#line 150 "dtc-lexer.l" ++#line 147 "dtc-lexer.l" + { + DPRINT("Label: %s\n", yytext); + yylval.labelref = xstrdup(yytext); +@@ -1059,9 +1060,9 @@ YY_RULE_SETUP + return DT_LABEL; + } + YY_BREAK +-case 10: ++case 11: + YY_RULE_SETUP +-#line 157 "dtc-lexer.l" ++#line 154 "dtc-lexer.l" + { + char *e; + DPRINT("Integer Literal: '%s'\n", yytext); +@@ -1069,10 +1070,7 @@ YY_RULE_SETUP + errno = 0; + yylval.integer = strtoull(yytext, &e, 0); + +- if (*e && e[strspn(e, "UL")]) { +- lexical_error("Bad integer literal '%s'", +- yytext); +- } ++ assert(!(*e) || !e[strspn(e, "UL")]); + + if (errno == ERANGE) + lexical_error("Integer literal '%s' out of range", +@@ -1084,10 +1082,10 @@ YY_RULE_SETUP + return DT_LITERAL; + } + YY_BREAK +-case 11: +-/* rule 11 can match eol */ ++case 12: ++/* rule 12 can match eol */ + YY_RULE_SETUP +-#line 179 "dtc-lexer.l" ++#line 173 "dtc-lexer.l" + { + struct data d; + DPRINT("Character literal: %s\n", yytext); +@@ -1109,18 +1107,18 @@ YY_RULE_SETUP + return DT_CHAR_LITERAL; + } + YY_BREAK +-case 12: ++case 13: + YY_RULE_SETUP +-#line 200 "dtc-lexer.l" ++#line 194 "dtc-lexer.l" + { /* label reference */ + DPRINT("Ref: %s\n", yytext+1); + yylval.labelref = xstrdup(yytext+1); + return DT_REF; + } + YY_BREAK +-case 13: ++case 14: + YY_RULE_SETUP +-#line 206 "dtc-lexer.l" ++#line 200 "dtc-lexer.l" + { /* new-style path reference */ + yytext[yyleng-1] = '\0'; + DPRINT("Ref: %s\n", yytext+2); +@@ -1128,27 +1126,27 @@ YY_RULE_SETUP + return DT_REF; + } + YY_BREAK +-case 14: ++case 15: + YY_RULE_SETUP +-#line 213 "dtc-lexer.l" ++#line 207 "dtc-lexer.l" + { + yylval.byte = strtol(yytext, NULL, 16); + DPRINT("Byte: %02x\n", (int)yylval.byte); + return DT_BYTE; + } + YY_BREAK +-case 15: ++case 16: + YY_RULE_SETUP +-#line 219 "dtc-lexer.l" ++#line 213 "dtc-lexer.l" + { + DPRINT("/BYTESTRING\n"); + BEGIN_DEFAULT(); + return ']'; + } + YY_BREAK +-case 16: ++case 17: + YY_RULE_SETUP +-#line 225 "dtc-lexer.l" ++#line 219 "dtc-lexer.l" + { + DPRINT("PropNodeName: %s\n", yytext); + yylval.propnodename = xstrdup((yytext[0] == '\\') ? +@@ -1157,75 +1155,75 @@ YY_RULE_SETUP + return DT_PROPNODENAME; + } + YY_BREAK +-case 17: ++case 18: + YY_RULE_SETUP +-#line 233 "dtc-lexer.l" ++#line 227 "dtc-lexer.l" + { + DPRINT("Binary Include\n"); + return DT_INCBIN; + } + YY_BREAK +-case 18: +-/* rule 18 can match eol */ +-YY_RULE_SETUP +-#line 238 "dtc-lexer.l" +-/* eat whitespace */ +- YY_BREAK + case 19: + /* rule 19 can match eol */ + YY_RULE_SETUP +-#line 239 "dtc-lexer.l" +-/* eat C-style comments */ ++#line 232 "dtc-lexer.l" ++/* eat whitespace */ + YY_BREAK + case 20: + /* rule 20 can match eol */ + YY_RULE_SETUP +-#line 240 "dtc-lexer.l" +-/* eat C++-style comments */ ++#line 233 "dtc-lexer.l" ++/* eat C-style comments */ + YY_BREAK + case 21: ++/* rule 21 can match eol */ + YY_RULE_SETUP +-#line 242 "dtc-lexer.l" +-{ return DT_LSHIFT; }; ++#line 234 "dtc-lexer.l" ++/* eat C++-style comments */ + YY_BREAK + case 22: + YY_RULE_SETUP +-#line 243 "dtc-lexer.l" +-{ return DT_RSHIFT; }; ++#line 236 "dtc-lexer.l" ++{ return DT_LSHIFT; }; + YY_BREAK + case 23: + YY_RULE_SETUP +-#line 244 "dtc-lexer.l" +-{ return DT_LE; }; ++#line 237 "dtc-lexer.l" ++{ return DT_RSHIFT; }; + YY_BREAK + case 24: + YY_RULE_SETUP +-#line 245 "dtc-lexer.l" +-{ return DT_GE; }; ++#line 238 "dtc-lexer.l" ++{ return DT_LE; }; + YY_BREAK + case 25: + YY_RULE_SETUP +-#line 246 "dtc-lexer.l" +-{ return DT_EQ; }; ++#line 239 "dtc-lexer.l" ++{ return DT_GE; }; + YY_BREAK + case 26: + YY_RULE_SETUP +-#line 247 "dtc-lexer.l" +-{ return DT_NE; }; ++#line 240 "dtc-lexer.l" ++{ return DT_EQ; }; + YY_BREAK + case 27: + YY_RULE_SETUP +-#line 248 "dtc-lexer.l" +-{ return DT_AND; }; ++#line 241 "dtc-lexer.l" ++{ return DT_NE; }; + YY_BREAK + case 28: + YY_RULE_SETUP +-#line 249 "dtc-lexer.l" +-{ return DT_OR; }; ++#line 242 "dtc-lexer.l" ++{ return DT_AND; }; + YY_BREAK + case 29: + YY_RULE_SETUP +-#line 251 "dtc-lexer.l" ++#line 243 "dtc-lexer.l" ++{ return DT_OR; }; ++ YY_BREAK ++case 30: ++YY_RULE_SETUP ++#line 245 "dtc-lexer.l" + { + DPRINT("Char: %c (\\x%02x)\n", yytext[0], + (unsigned)yytext[0]); +@@ -1241,12 +1239,12 @@ YY_RULE_SETUP + return yytext[0]; + } + YY_BREAK +-case 30: ++case 31: + YY_RULE_SETUP +-#line 266 "dtc-lexer.l" ++#line 260 "dtc-lexer.l" + ECHO; + YY_BREAK +-#line 1250 "dtc-lexer.lex.c" ++#line 1248 "dtc-lexer.lex.c" + + case YY_END_OF_BUFFER: + { +@@ -1376,7 +1374,6 @@ ECHO; + "fatal flex scanner internal error--no action found" ); + } /* end of action switch */ + } /* end of scanning one token */ +- } /* end of user's declarations */ + } /* end of yylex */ + + /* yy_get_next_buffer - try to read in a new buffer +@@ -1432,21 +1429,21 @@ static int yy_get_next_buffer (void) + + else + { +- yy_size_t num_to_read = ++ int num_to_read = + YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; + + while ( num_to_read <= 0 ) + { /* Not enough room in the buffer - grow it. */ + + /* just a shorter name for the current buffer */ +- YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE; ++ YY_BUFFER_STATE b = YY_CURRENT_BUFFER; + + int yy_c_buf_p_offset = + (int) ((yy_c_buf_p) - b->yy_ch_buf); + + if ( b->yy_is_our_buffer ) + { +- yy_size_t new_size = b->yy_buf_size * 2; ++ int new_size = b->yy_buf_size * 2; + + if ( new_size <= 0 ) + b->yy_buf_size += b->yy_buf_size / 8; +@@ -1477,7 +1474,7 @@ static int yy_get_next_buffer (void) + + /* Read in more data. */ + YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), +- (yy_n_chars), num_to_read ); ++ (yy_n_chars), (size_t) num_to_read ); + + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } +@@ -1539,7 +1536,7 @@ static int yy_get_next_buffer (void) + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; +- if ( yy_current_state >= 159 ) ++ if ( yy_current_state >= 166 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; +@@ -1567,13 +1564,13 @@ static int yy_get_next_buffer (void) + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; +- if ( yy_current_state >= 159 ) ++ if ( yy_current_state >= 166 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; +- yy_is_jam = (yy_current_state == 158); ++ yy_is_jam = (yy_current_state == 165); + +- return yy_is_jam ? 0 : yy_current_state; ++ return yy_is_jam ? 0 : yy_current_state; + } + + #ifndef YY_NO_INPUT +@@ -1600,7 +1597,7 @@ static int yy_get_next_buffer (void) + + else + { /* need more input */ +- yy_size_t offset = (yy_c_buf_p) - (yytext_ptr); ++ int offset = (yy_c_buf_p) - (yytext_ptr); + ++(yy_c_buf_p); + + switch ( yy_get_next_buffer( ) ) +@@ -1874,7 +1871,7 @@ void yypop_buffer_state (void) + */ + static void yyensure_buffer_stack (void) + { +- yy_size_t num_to_alloc; ++ int num_to_alloc; + + if (!(yy_buffer_stack)) { + +@@ -1971,12 +1968,12 @@ YY_BUFFER_STATE yy_scan_string (yyconst char * yystr ) + * + * @return the newly allocated buffer state object. + */ +-YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len ) ++YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, int _yybytes_len ) + { + YY_BUFFER_STATE b; + char *buf; + yy_size_t n; +- yy_size_t i; ++ int i; + + /* Get memory for full buffer, including space for trailing EOB's. */ + n = _yybytes_len + 2; +@@ -2058,7 +2055,7 @@ FILE *yyget_out (void) + /** Get the length of the current token. + * + */ +-yy_size_t yyget_leng (void) ++int yyget_leng (void) + { + return yyleng; + } +@@ -2206,7 +2203,7 @@ void yyfree (void * ptr ) + + #define YYTABLES_NAME "yytables" + +-#line 265 "dtc-lexer.l" ++#line 260 "dtc-lexer.l" + + + +diff --git a/scripts/dtc/dtc-parser.tab.c_shipped b/scripts/dtc/dtc-parser.tab.c_shipped +index 31cec50..844c462 100644 +--- a/scripts/dtc/dtc-parser.tab.c_shipped ++++ b/scripts/dtc/dtc-parser.tab.c_shipped +@@ -65,6 +65,7 @@ + #line 20 "dtc-parser.y" /* yacc.c:339 */ + + #include <stdio.h> ++#include <inttypes.h> + + #include "dtc.h" + #include "srcpos.h" +@@ -80,7 +81,7 @@ extern void yyerror(char const *s); + extern struct boot_info *the_boot_info; + extern bool treesource_error; + +-#line 84 "dtc-parser.tab.c" /* yacc.c:339 */ ++#line 85 "dtc-parser.tab.c" /* yacc.c:339 */ + + # ifndef YY_NULLPTR + # if defined __cplusplus && 201103L <= __cplusplus +@@ -116,26 +117,27 @@ extern int yydebug; + enum yytokentype + { + DT_V1 = 258, +- DT_MEMRESERVE = 259, +- DT_LSHIFT = 260, +- DT_RSHIFT = 261, +- DT_LE = 262, +- DT_GE = 263, +- DT_EQ = 264, +- DT_NE = 265, +- DT_AND = 266, +- DT_OR = 267, +- DT_BITS = 268, +- DT_DEL_PROP = 269, +- DT_DEL_NODE = 270, +- DT_PROPNODENAME = 271, +- DT_LITERAL = 272, +- DT_CHAR_LITERAL = 273, +- DT_BYTE = 274, +- DT_STRING = 275, +- DT_LABEL = 276, +- DT_REF = 277, +- DT_INCBIN = 278 ++ DT_PLUGIN = 259, ++ DT_MEMRESERVE = 260, ++ DT_LSHIFT = 261, ++ DT_RSHIFT = 262, ++ DT_LE = 263, ++ DT_GE = 264, ++ DT_EQ = 265, ++ DT_NE = 266, ++ DT_AND = 267, ++ DT_OR = 268, ++ DT_BITS = 269, ++ DT_DEL_PROP = 270, ++ DT_DEL_NODE = 271, ++ DT_PROPNODENAME = 272, ++ DT_LITERAL = 273, ++ DT_CHAR_LITERAL = 274, ++ DT_BYTE = 275, ++ DT_STRING = 276, ++ DT_LABEL = 277, ++ DT_REF = 278, ++ DT_INCBIN = 279 + }; + #endif + +@@ -144,7 +146,7 @@ extern int yydebug; + typedef union YYSTYPE YYSTYPE; + union YYSTYPE + { +-#line 38 "dtc-parser.y" /* yacc.c:355 */ ++#line 39 "dtc-parser.y" /* yacc.c:355 */ + + char *propnodename; + char *labelref; +@@ -162,8 +164,9 @@ union YYSTYPE + struct node *nodelist; + struct reserve_info *re; + uint64_t integer; ++ bool is_plugin; + +-#line 167 "dtc-parser.tab.c" /* yacc.c:355 */ ++#line 170 "dtc-parser.tab.c" /* yacc.c:355 */ + }; + # define YYSTYPE_IS_TRIVIAL 1 + # define YYSTYPE_IS_DECLARED 1 +@@ -192,7 +195,7 @@ int yyparse (void); + + /* Copy the second part of user declarations. */ + +-#line 196 "dtc-parser.tab.c" /* yacc.c:358 */ ++#line 199 "dtc-parser.tab.c" /* yacc.c:358 */ + + #ifdef short + # undef short +@@ -439,18 +442,18 @@ union yyalloc + #define YYLAST 136 + + /* YYNTOKENS -- Number of terminals. */ +-#define YYNTOKENS 47 ++#define YYNTOKENS 48 + /* YYNNTS -- Number of nonterminals. */ +-#define YYNNTS 28 ++#define YYNNTS 29 + /* YYNRULES -- Number of rules. */ +-#define YYNRULES 80 ++#define YYNRULES 82 + /* YYNSTATES -- Number of states. */ +-#define YYNSTATES 144 ++#define YYNSTATES 147 + + /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned + by yylex, with out-of-bounds checking. */ + #define YYUNDEFTOK 2 +-#define YYMAXUTOK 278 ++#define YYMAXUTOK 279 + + #define YYTRANSLATE(YYX) \ + ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) +@@ -462,16 +465,16 @@ static const yytype_uint8 yytranslate[] = + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +- 2, 2, 2, 46, 2, 2, 2, 44, 40, 2, +- 32, 34, 43, 41, 33, 42, 2, 25, 2, 2, +- 2, 2, 2, 2, 2, 2, 2, 2, 37, 24, +- 35, 28, 29, 36, 2, 2, 2, 2, 2, 2, ++ 2, 2, 2, 47, 2, 2, 2, 45, 41, 2, ++ 33, 35, 44, 42, 34, 43, 2, 26, 2, 2, ++ 2, 2, 2, 2, 2, 2, 2, 2, 38, 25, ++ 36, 29, 30, 37, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +- 2, 30, 2, 31, 39, 2, 2, 2, 2, 2, ++ 2, 31, 2, 32, 40, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +- 2, 2, 2, 26, 38, 27, 45, 2, 2, 2, ++ 2, 2, 2, 27, 39, 28, 46, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +@@ -486,22 +489,22 @@ static const yytype_uint8 yytranslate[] = + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, + 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, +- 15, 16, 17, 18, 19, 20, 21, 22, 23 ++ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24 + }; + + #if YYDEBUG + /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ + static const yytype_uint16 yyrline[] = + { +- 0, 104, 104, 113, 116, 123, 127, 135, 139, 144, +- 155, 165, 180, 188, 191, 198, 202, 206, 210, 218, +- 222, 226, 230, 234, 250, 260, 268, 271, 275, 282, +- 298, 303, 322, 336, 343, 344, 345, 352, 356, 357, +- 361, 362, 366, 367, 371, 372, 376, 377, 381, 382, +- 386, 387, 388, 392, 393, 394, 395, 396, 400, 401, +- 402, 406, 407, 408, 412, 413, 422, 431, 435, 436, +- 437, 438, 443, 446, 450, 458, 461, 465, 473, 477, +- 481 ++ 0, 108, 108, 118, 121, 129, 132, 139, 143, 151, ++ 155, 160, 171, 181, 196, 204, 207, 214, 218, 222, ++ 226, 234, 238, 242, 246, 250, 266, 276, 284, 287, ++ 291, 298, 314, 319, 338, 352, 359, 360, 361, 368, ++ 372, 373, 377, 378, 382, 383, 387, 388, 392, 393, ++ 397, 398, 402, 403, 404, 408, 409, 410, 411, 412, ++ 416, 417, 418, 422, 423, 424, 428, 429, 430, 431, ++ 435, 436, 437, 438, 443, 446, 450, 458, 461, 465, ++ 473, 477, 481 + }; + #endif + +@@ -510,19 +513,19 @@ static const yytype_uint16 yyrline[] = + First, the terminals, then, starting at YYNTOKENS, nonterminals. */ + static const char *const yytname[] = + { +- "$end", "error", "$undefined", "DT_V1", "DT_MEMRESERVE", "DT_LSHIFT", +- "DT_RSHIFT", "DT_LE", "DT_GE", "DT_EQ", "DT_NE", "DT_AND", "DT_OR", +- "DT_BITS", "DT_DEL_PROP", "DT_DEL_NODE", "DT_PROPNODENAME", "DT_LITERAL", +- "DT_CHAR_LITERAL", "DT_BYTE", "DT_STRING", "DT_LABEL", "DT_REF", +- "DT_INCBIN", "';'", "'/'", "'{'", "'}'", "'='", "'>'", "'['", "']'", +- "'('", "','", "')'", "'<'", "'?'", "':'", "'|'", "'^'", "'&'", "'+'", +- "'-'", "'*'", "'%'", "'~'", "'!'", "$accept", "sourcefile", +- "memreserves", "memreserve", "devicetree", "nodedef", "proplist", +- "propdef", "propdata", "propdataprefix", "arrayprefix", "integer_prim", +- "integer_expr", "integer_trinary", "integer_or", "integer_and", +- "integer_bitor", "integer_bitxor", "integer_bitand", "integer_eq", +- "integer_rela", "integer_shift", "integer_add", "integer_mul", +- "integer_unary", "bytestring", "subnodes", "subnode", YY_NULLPTR ++ "$end", "error", "$undefined", "DT_V1", "DT_PLUGIN", "DT_MEMRESERVE", ++ "DT_LSHIFT", "DT_RSHIFT", "DT_LE", "DT_GE", "DT_EQ", "DT_NE", "DT_AND", ++ "DT_OR", "DT_BITS", "DT_DEL_PROP", "DT_DEL_NODE", "DT_PROPNODENAME", ++ "DT_LITERAL", "DT_CHAR_LITERAL", "DT_BYTE", "DT_STRING", "DT_LABEL", ++ "DT_REF", "DT_INCBIN", "';'", "'/'", "'{'", "'}'", "'='", "'>'", "'['", ++ "']'", "'('", "','", "')'", "'<'", "'?'", "':'", "'|'", "'^'", "'&'", ++ "'+'", "'-'", "'*'", "'%'", "'~'", "'!'", "$accept", "sourcefile", ++ "plugindecl", "memreserves", "memreserve", "devicetree", "nodedef", ++ "proplist", "propdef", "propdata", "propdataprefix", "arrayprefix", ++ "integer_prim", "integer_expr", "integer_trinary", "integer_or", ++ "integer_and", "integer_bitor", "integer_bitxor", "integer_bitand", ++ "integer_eq", "integer_rela", "integer_shift", "integer_add", ++ "integer_mul", "integer_unary", "bytestring", "subnodes", "subnode", YY_NULLPTR + }; + #endif + +@@ -533,16 +536,16 @@ static const yytype_uint16 yytoknum[] = + { + 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, + 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, +- 275, 276, 277, 278, 59, 47, 123, 125, 61, 62, +- 91, 93, 40, 44, 41, 60, 63, 58, 124, 94, +- 38, 43, 45, 42, 37, 126, 33 ++ 275, 276, 277, 278, 279, 59, 47, 123, 125, 61, ++ 62, 91, 93, 40, 44, 41, 60, 63, 58, 124, ++ 94, 38, 43, 45, 42, 37, 126, 33 + }; + # endif + +-#define YYPACT_NINF -81 ++#define YYPACT_NINF -84 + + #define yypact_value_is_default(Yystate) \ +- (!!((Yystate) == (-81))) ++ (!!((Yystate) == (-84))) + + #define YYTABLE_NINF -1 + +@@ -553,21 +556,21 @@ static const yytype_uint16 yytoknum[] = + STATE-NUM. */ + static const yytype_int8 yypact[] = + { +- 16, -11, 21, 10, -81, 25, 10, 19, 10, -81, +- -81, -9, 25, -81, 2, 51, -81, -9, -9, -9, +- -81, 1, -81, -6, 50, 14, 28, 29, 36, 3, +- 58, 44, -3, -81, 47, -81, -81, 65, 68, 2, +- 2, -81, -81, -81, -81, -9, -9, -9, -9, -9, +- -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, +- -9, -9, -9, -9, -81, 63, 69, 2, -81, -81, +- 50, 57, 14, 28, 29, 36, 3, 3, 58, 58, +- 58, 58, 44, 44, -3, -3, -81, -81, -81, 79, +- 80, -8, 63, -81, 72, 63, -81, -81, -9, 76, +- 77, -81, -81, -81, -81, -81, 78, -81, -81, -81, +- -81, -81, 35, 4, -81, -81, -81, -81, 86, -81, +- -81, -81, 73, -81, -81, 33, 71, 84, 39, -81, +- -81, -81, -81, -81, 41, -81, -81, -81, 25, -81, +- 74, 25, 75, -81 ++ 15, -12, 35, 42, -84, 27, 9, -84, 24, 9, ++ 43, 9, -84, -84, -10, 24, -84, 60, 44, -84, ++ -10, -10, -10, -84, 55, -84, -7, 52, 53, 51, ++ 54, 10, 2, 38, 37, -4, -84, 68, -84, -84, ++ 71, 73, 60, 60, -84, -84, -84, -84, -10, -10, ++ -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, ++ -10, -10, -10, -10, -10, -10, -10, -84, 56, 72, ++ 60, -84, -84, 52, 61, 53, 51, 54, 10, 2, ++ 2, 38, 38, 38, 38, 37, 37, -4, -4, -84, ++ -84, -84, 81, 83, 34, 56, -84, 74, 56, -84, ++ -84, -10, 76, 78, -84, -84, -84, -84, -84, 79, ++ -84, -84, -84, -84, -84, -6, 3, -84, -84, -84, ++ -84, 87, -84, -84, -84, 75, -84, -84, 32, 70, ++ 86, 36, -84, -84, -84, -84, -84, 47, -84, -84, ++ -84, 24, -84, 77, 24, 80, -84 + }; + + /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. +@@ -575,37 +578,37 @@ static const yytype_int8 yypact[] = + means the default is an error. */ + static const yytype_uint8 yydefact[] = + { +- 0, 0, 0, 3, 1, 0, 0, 0, 3, 34, +- 35, 0, 0, 6, 0, 2, 4, 0, 0, 0, +- 68, 0, 37, 38, 40, 42, 44, 46, 48, 50, +- 53, 60, 63, 67, 0, 13, 7, 0, 0, 0, +- 0, 69, 70, 71, 36, 0, 0, 0, 0, 0, ++ 0, 0, 0, 3, 1, 0, 5, 4, 0, 0, ++ 0, 5, 36, 37, 0, 0, 8, 0, 2, 6, ++ 0, 0, 0, 70, 0, 39, 40, 42, 44, 46, ++ 48, 50, 52, 55, 62, 65, 69, 0, 15, 9, ++ 0, 0, 0, 0, 71, 72, 73, 38, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +- 0, 0, 0, 0, 5, 75, 0, 0, 10, 8, +- 41, 0, 43, 45, 47, 49, 51, 52, 56, 57, +- 55, 54, 58, 59, 61, 62, 65, 64, 66, 0, +- 0, 0, 0, 14, 0, 75, 11, 9, 0, 0, +- 0, 16, 26, 78, 18, 80, 0, 77, 76, 39, +- 17, 79, 0, 0, 12, 25, 15, 27, 0, 19, +- 28, 22, 0, 72, 30, 0, 0, 0, 0, 33, +- 32, 20, 31, 29, 0, 73, 74, 21, 0, 24, +- 0, 0, 0, 23 ++ 0, 0, 0, 0, 0, 0, 0, 7, 77, 0, ++ 0, 12, 10, 43, 0, 45, 47, 49, 51, 53, ++ 54, 58, 59, 57, 56, 60, 61, 63, 64, 67, ++ 66, 68, 0, 0, 0, 0, 16, 0, 77, 13, ++ 11, 0, 0, 0, 18, 28, 80, 20, 82, 0, ++ 79, 78, 41, 19, 81, 0, 0, 14, 27, 17, ++ 29, 0, 21, 30, 24, 0, 74, 32, 0, 0, ++ 0, 0, 35, 34, 22, 33, 31, 0, 75, 76, ++ 23, 0, 26, 0, 0, 0, 25 + }; + + /* YYPGOTO[NTERM-NUM]. */ + static const yytype_int8 yypgoto[] = + { +- -81, -81, 100, 104, -81, -38, -81, -80, -81, -81, +- -81, -5, 66, 13, -81, 70, 67, 81, 64, 82, +- 37, 27, 34, 38, -14, -81, 22, 24 ++ -84, -84, -84, 98, 101, -84, -41, -84, -83, -84, ++ -84, -84, -8, 63, 12, -84, 66, 67, 65, 69, ++ 82, 29, 18, 25, 26, -17, -84, 20, 28 + }; + + /* YYDEFGOTO[NTERM-NUM]. */ + static const yytype_int16 yydefgoto[] = + { +- -1, 2, 7, 8, 15, 36, 65, 93, 112, 113, +- 125, 20, 21, 22, 23, 24, 25, 26, 27, 28, +- 29, 30, 31, 32, 33, 128, 94, 95 ++ -1, 2, 6, 10, 11, 18, 39, 68, 96, 115, ++ 116, 128, 23, 24, 25, 26, 27, 28, 29, 30, ++ 31, 32, 33, 34, 35, 36, 131, 97, 98 + }; + + /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If +@@ -613,87 +616,87 @@ static const yytype_int16 yydefgoto[] = + number is the opposite. If YYTABLE_NINF, syntax error. */ + static const yytype_uint8 yytable[] = + { +- 12, 68, 69, 41, 42, 43, 45, 34, 9, 10, +- 53, 54, 104, 3, 5, 107, 101, 118, 35, 1, +- 102, 4, 61, 11, 119, 120, 121, 122, 35, 97, +- 46, 6, 55, 17, 123, 44, 18, 19, 56, 124, +- 62, 63, 9, 10, 14, 51, 52, 86, 87, 88, +- 9, 10, 48, 103, 129, 130, 115, 11, 135, 116, +- 136, 47, 131, 57, 58, 11, 37, 49, 117, 50, +- 137, 64, 38, 39, 138, 139, 40, 89, 90, 91, +- 78, 79, 80, 81, 92, 59, 60, 66, 76, 77, +- 67, 82, 83, 96, 98, 99, 100, 84, 85, 106, +- 110, 111, 114, 126, 134, 127, 133, 141, 16, 143, +- 13, 109, 71, 74, 72, 70, 105, 108, 0, 0, +- 132, 0, 0, 0, 0, 0, 0, 0, 0, 73, +- 0, 0, 75, 140, 0, 0, 142 ++ 15, 71, 72, 44, 45, 46, 48, 37, 12, 13, ++ 56, 57, 107, 3, 8, 110, 118, 121, 1, 119, ++ 54, 55, 64, 14, 122, 123, 124, 125, 120, 100, ++ 49, 9, 58, 20, 126, 4, 21, 22, 59, 127, ++ 65, 66, 12, 13, 60, 61, 5, 89, 90, 91, ++ 12, 13, 7, 106, 132, 133, 138, 14, 139, 104, ++ 40, 38, 134, 105, 50, 14, 41, 42, 140, 17, ++ 43, 92, 93, 94, 81, 82, 83, 84, 95, 62, ++ 63, 141, 142, 79, 80, 85, 86, 38, 87, 88, ++ 47, 52, 51, 67, 69, 53, 70, 99, 102, 101, ++ 103, 113, 109, 114, 117, 129, 136, 137, 130, 19, ++ 16, 144, 74, 112, 73, 146, 76, 75, 111, 0, ++ 135, 77, 0, 108, 0, 0, 0, 0, 0, 0, ++ 0, 0, 0, 143, 0, 78, 145 + }; + + static const yytype_int16 yycheck[] = + { +- 5, 39, 40, 17, 18, 19, 12, 12, 17, 18, +- 7, 8, 92, 24, 4, 95, 24, 13, 26, 3, +- 28, 0, 25, 32, 20, 21, 22, 23, 26, 67, +- 36, 21, 29, 42, 30, 34, 45, 46, 35, 35, +- 43, 44, 17, 18, 25, 9, 10, 61, 62, 63, +- 17, 18, 38, 91, 21, 22, 21, 32, 19, 24, +- 21, 11, 29, 5, 6, 32, 15, 39, 33, 40, +- 31, 24, 21, 22, 33, 34, 25, 14, 15, 16, +- 53, 54, 55, 56, 21, 41, 42, 22, 51, 52, +- 22, 57, 58, 24, 37, 16, 16, 59, 60, 27, +- 24, 24, 24, 17, 20, 32, 35, 33, 8, 34, +- 6, 98, 46, 49, 47, 45, 92, 95, -1, -1, +- 125, -1, -1, -1, -1, -1, -1, -1, -1, 48, +- -1, -1, 50, 138, -1, -1, 141 ++ 8, 42, 43, 20, 21, 22, 13, 15, 18, 19, ++ 8, 9, 95, 25, 5, 98, 22, 14, 3, 25, ++ 10, 11, 26, 33, 21, 22, 23, 24, 34, 70, ++ 37, 22, 30, 43, 31, 0, 46, 47, 36, 36, ++ 44, 45, 18, 19, 6, 7, 4, 64, 65, 66, ++ 18, 19, 25, 94, 22, 23, 20, 33, 22, 25, ++ 16, 27, 30, 29, 12, 33, 22, 23, 32, 26, ++ 26, 15, 16, 17, 56, 57, 58, 59, 22, 42, ++ 43, 34, 35, 54, 55, 60, 61, 27, 62, 63, ++ 35, 40, 39, 25, 23, 41, 23, 25, 17, 38, ++ 17, 25, 28, 25, 25, 18, 36, 21, 33, 11, ++ 9, 34, 49, 101, 48, 35, 51, 50, 98, -1, ++ 128, 52, -1, 95, -1, -1, -1, -1, -1, -1, ++ -1, -1, -1, 141, -1, 53, 144 + }; + + /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ + static const yytype_uint8 yystos[] = + { +- 0, 3, 48, 24, 0, 4, 21, 49, 50, 17, +- 18, 32, 58, 50, 25, 51, 49, 42, 45, 46, +- 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, +- 68, 69, 70, 71, 58, 26, 52, 15, 21, 22, +- 25, 71, 71, 71, 34, 12, 36, 11, 38, 39, +- 40, 9, 10, 7, 8, 29, 35, 5, 6, 41, +- 42, 25, 43, 44, 24, 53, 22, 22, 52, 52, +- 62, 59, 63, 64, 65, 66, 67, 67, 68, 68, +- 68, 68, 69, 69, 70, 70, 71, 71, 71, 14, +- 15, 16, 21, 54, 73, 74, 24, 52, 37, 16, +- 16, 24, 28, 52, 54, 74, 27, 54, 73, 60, +- 24, 24, 55, 56, 24, 21, 24, 33, 13, 20, +- 21, 22, 23, 30, 35, 57, 17, 32, 72, 21, +- 22, 29, 58, 35, 20, 19, 21, 31, 33, 34, +- 58, 33, 58, 34 ++ 0, 3, 49, 25, 0, 4, 50, 25, 5, 22, ++ 51, 52, 18, 19, 33, 60, 52, 26, 53, 51, ++ 43, 46, 47, 60, 61, 62, 63, 64, 65, 66, ++ 67, 68, 69, 70, 71, 72, 73, 60, 27, 54, ++ 16, 22, 23, 26, 73, 73, 73, 35, 13, 37, ++ 12, 39, 40, 41, 10, 11, 8, 9, 30, 36, ++ 6, 7, 42, 43, 26, 44, 45, 25, 55, 23, ++ 23, 54, 54, 64, 61, 65, 66, 67, 68, 69, ++ 69, 70, 70, 70, 70, 71, 71, 72, 72, 73, ++ 73, 73, 15, 16, 17, 22, 56, 75, 76, 25, ++ 54, 38, 17, 17, 25, 29, 54, 56, 76, 28, ++ 56, 75, 62, 25, 25, 57, 58, 25, 22, 25, ++ 34, 14, 21, 22, 23, 24, 31, 36, 59, 18, ++ 33, 74, 22, 23, 30, 60, 36, 21, 20, 22, ++ 32, 34, 35, 60, 34, 60, 35 + }; + + /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ + static const yytype_uint8 yyr1[] = + { +- 0, 47, 48, 49, 49, 50, 50, 51, 51, 51, +- 51, 51, 52, 53, 53, 54, 54, 54, 54, 55, +- 55, 55, 55, 55, 55, 55, 56, 56, 56, 57, +- 57, 57, 57, 57, 58, 58, 58, 59, 60, 60, +- 61, 61, 62, 62, 63, 63, 64, 64, 65, 65, +- 66, 66, 66, 67, 67, 67, 67, 67, 68, 68, +- 68, 69, 69, 69, 70, 70, 70, 70, 71, 71, +- 71, 71, 72, 72, 72, 73, 73, 73, 74, 74, +- 74 ++ 0, 48, 49, 50, 50, 51, 51, 52, 52, 53, ++ 53, 53, 53, 53, 54, 55, 55, 56, 56, 56, ++ 56, 57, 57, 57, 57, 57, 57, 57, 58, 58, ++ 58, 59, 59, 59, 59, 59, 60, 60, 60, 61, ++ 62, 62, 63, 63, 64, 64, 65, 65, 66, 66, ++ 67, 67, 68, 68, 68, 69, 69, 69, 69, 69, ++ 70, 70, 70, 71, 71, 71, 72, 72, 72, 72, ++ 73, 73, 73, 73, 74, 74, 74, 75, 75, 75, ++ 76, 76, 76 + }; + + /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ + static const yytype_uint8 yyr2[] = + { +- 0, 2, 4, 0, 2, 4, 2, 2, 3, 4, +- 3, 4, 5, 0, 2, 4, 2, 3, 2, 2, +- 3, 4, 2, 9, 5, 2, 0, 2, 2, 3, +- 1, 2, 2, 2, 1, 1, 3, 1, 1, 5, +- 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, +- 1, 3, 3, 1, 3, 3, 3, 3, 3, 3, +- 1, 3, 3, 1, 3, 3, 3, 1, 1, 2, +- 2, 2, 0, 2, 2, 0, 2, 2, 2, 3, +- 2 ++ 0, 2, 5, 0, 2, 0, 2, 4, 2, 2, ++ 3, 4, 3, 4, 5, 0, 2, 4, 2, 3, ++ 2, 2, 3, 4, 2, 9, 5, 2, 0, 2, ++ 2, 3, 1, 2, 2, 2, 1, 1, 3, 1, ++ 1, 5, 1, 3, 1, 3, 1, 3, 1, 3, ++ 1, 3, 1, 3, 3, 1, 3, 3, 3, 3, ++ 3, 3, 1, 3, 3, 1, 3, 3, 3, 1, ++ 1, 2, 2, 2, 0, 2, 2, 0, 2, 2, ++ 2, 3, 2 + }; + + +@@ -1463,65 +1466,82 @@ yyreduce: + switch (yyn) + { + case 2: +-#line 105 "dtc-parser.y" /* yacc.c:1646 */ ++#line 109 "dtc-parser.y" /* yacc.c:1646 */ + { ++ (yyvsp[0].node)->is_plugin = (yyvsp[-2].is_plugin); + the_boot_info = build_boot_info((yyvsp[-1].re), (yyvsp[0].node), + guess_boot_cpuid((yyvsp[0].node))); + } +-#line 1472 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1476 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + + case 3: +-#line 113 "dtc-parser.y" /* yacc.c:1646 */ ++#line 118 "dtc-parser.y" /* yacc.c:1646 */ + { +- (yyval.re) = NULL; ++ (yyval.is_plugin) = false; + } +-#line 1480 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1484 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + + case 4: +-#line 117 "dtc-parser.y" /* yacc.c:1646 */ ++#line 122 "dtc-parser.y" /* yacc.c:1646 */ + { +- (yyval.re) = chain_reserve_entry((yyvsp[-1].re), (yyvsp[0].re)); ++ (yyval.is_plugin) = true; + } +-#line 1488 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1492 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + + case 5: +-#line 124 "dtc-parser.y" /* yacc.c:1646 */ ++#line 129 "dtc-parser.y" /* yacc.c:1646 */ + { +- (yyval.re) = build_reserve_entry((yyvsp[-2].integer), (yyvsp[-1].integer)); ++ (yyval.re) = NULL; + } +-#line 1496 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1500 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + + case 6: +-#line 128 "dtc-parser.y" /* yacc.c:1646 */ ++#line 133 "dtc-parser.y" /* yacc.c:1646 */ ++ { ++ (yyval.re) = chain_reserve_entry((yyvsp[-1].re), (yyvsp[0].re)); ++ } ++#line 1508 "dtc-parser.tab.c" /* yacc.c:1646 */ ++ break; ++ ++ case 7: ++#line 140 "dtc-parser.y" /* yacc.c:1646 */ ++ { ++ (yyval.re) = build_reserve_entry((yyvsp[-2].integer), (yyvsp[-1].integer)); ++ } ++#line 1516 "dtc-parser.tab.c" /* yacc.c:1646 */ ++ break; ++ ++ case 8: ++#line 144 "dtc-parser.y" /* yacc.c:1646 */ + { + add_label(&(yyvsp[0].re)->labels, (yyvsp[-1].labelref)); + (yyval.re) = (yyvsp[0].re); + } +-#line 1505 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1525 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 7: +-#line 136 "dtc-parser.y" /* yacc.c:1646 */ ++ case 9: ++#line 152 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = name_node((yyvsp[0].node), ""); + } +-#line 1513 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1533 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 8: +-#line 140 "dtc-parser.y" /* yacc.c:1646 */ ++ case 10: ++#line 156 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = merge_nodes((yyvsp[-2].node), (yyvsp[0].node)); + } +-#line 1521 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1541 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 9: +-#line 145 "dtc-parser.y" /* yacc.c:1646 */ ++ case 11: ++#line 161 "dtc-parser.y" /* yacc.c:1646 */ + { + struct node *target = get_node_by_ref((yyvsp[-3].node), (yyvsp[-1].labelref)); + +@@ -1532,11 +1552,11 @@ yyreduce: + ERROR(&(yylsp[-1]), "Label or path %s not found", (yyvsp[-1].labelref)); + (yyval.node) = (yyvsp[-3].node); + } +-#line 1536 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1556 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 10: +-#line 156 "dtc-parser.y" /* yacc.c:1646 */ ++ case 12: ++#line 172 "dtc-parser.y" /* yacc.c:1646 */ + { + struct node *target = get_node_by_ref((yyvsp[-2].node), (yyvsp[-1].labelref)); + +@@ -1546,11 +1566,11 @@ yyreduce: + ERROR(&(yylsp[-1]), "Label or path %s not found", (yyvsp[-1].labelref)); + (yyval.node) = (yyvsp[-2].node); + } +-#line 1550 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1570 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 11: +-#line 166 "dtc-parser.y" /* yacc.c:1646 */ ++ case 13: ++#line 182 "dtc-parser.y" /* yacc.c:1646 */ + { + struct node *target = get_node_by_ref((yyvsp[-3].node), (yyvsp[-1].labelref)); + +@@ -1562,100 +1582,100 @@ yyreduce: + + (yyval.node) = (yyvsp[-3].node); + } +-#line 1566 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1586 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 12: +-#line 181 "dtc-parser.y" /* yacc.c:1646 */ ++ case 14: ++#line 197 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = build_node((yyvsp[-3].proplist), (yyvsp[-2].nodelist)); + } +-#line 1574 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1594 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 13: +-#line 188 "dtc-parser.y" /* yacc.c:1646 */ ++ case 15: ++#line 204 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.proplist) = NULL; + } +-#line 1582 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1602 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 14: +-#line 192 "dtc-parser.y" /* yacc.c:1646 */ ++ case 16: ++#line 208 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.proplist) = chain_property((yyvsp[0].prop), (yyvsp[-1].proplist)); + } +-#line 1590 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1610 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 15: +-#line 199 "dtc-parser.y" /* yacc.c:1646 */ ++ case 17: ++#line 215 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.prop) = build_property((yyvsp[-3].propnodename), (yyvsp[-1].data)); + } +-#line 1598 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1618 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 16: +-#line 203 "dtc-parser.y" /* yacc.c:1646 */ ++ case 18: ++#line 219 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.prop) = build_property((yyvsp[-1].propnodename), empty_data); + } +-#line 1606 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1626 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 17: +-#line 207 "dtc-parser.y" /* yacc.c:1646 */ ++ case 19: ++#line 223 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.prop) = build_property_delete((yyvsp[-1].propnodename)); + } +-#line 1614 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1634 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 18: +-#line 211 "dtc-parser.y" /* yacc.c:1646 */ ++ case 20: ++#line 227 "dtc-parser.y" /* yacc.c:1646 */ + { + add_label(&(yyvsp[0].prop)->labels, (yyvsp[-1].labelref)); + (yyval.prop) = (yyvsp[0].prop); + } +-#line 1623 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1643 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 19: +-#line 219 "dtc-parser.y" /* yacc.c:1646 */ ++ case 21: ++#line 235 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.data) = data_merge((yyvsp[-1].data), (yyvsp[0].data)); + } +-#line 1631 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1651 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 20: +-#line 223 "dtc-parser.y" /* yacc.c:1646 */ ++ case 22: ++#line 239 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.data) = data_merge((yyvsp[-2].data), (yyvsp[-1].array).data); + } +-#line 1639 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1659 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 21: +-#line 227 "dtc-parser.y" /* yacc.c:1646 */ ++ case 23: ++#line 243 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.data) = data_merge((yyvsp[-3].data), (yyvsp[-1].data)); + } +-#line 1647 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1667 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 22: +-#line 231 "dtc-parser.y" /* yacc.c:1646 */ ++ case 24: ++#line 247 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.data) = data_add_marker((yyvsp[-1].data), REF_PATH, (yyvsp[0].labelref)); + } +-#line 1655 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1675 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 23: +-#line 235 "dtc-parser.y" /* yacc.c:1646 */ ++ case 25: ++#line 251 "dtc-parser.y" /* yacc.c:1646 */ + { + FILE *f = srcfile_relative_open((yyvsp[-5].data).val, NULL); + struct data d; +@@ -1671,11 +1691,11 @@ yyreduce: + (yyval.data) = data_merge((yyvsp[-8].data), d); + fclose(f); + } +-#line 1675 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1695 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 24: +-#line 251 "dtc-parser.y" /* yacc.c:1646 */ ++ case 26: ++#line 267 "dtc-parser.y" /* yacc.c:1646 */ + { + FILE *f = srcfile_relative_open((yyvsp[-1].data).val, NULL); + struct data d = empty_data; +@@ -1685,43 +1705,43 @@ yyreduce: + (yyval.data) = data_merge((yyvsp[-4].data), d); + fclose(f); + } +-#line 1689 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1709 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 25: +-#line 261 "dtc-parser.y" /* yacc.c:1646 */ ++ case 27: ++#line 277 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.data) = data_add_marker((yyvsp[-1].data), LABEL, (yyvsp[0].labelref)); + } +-#line 1697 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1717 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 26: +-#line 268 "dtc-parser.y" /* yacc.c:1646 */ ++ case 28: ++#line 284 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.data) = empty_data; + } +-#line 1705 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1725 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 27: +-#line 272 "dtc-parser.y" /* yacc.c:1646 */ ++ case 29: ++#line 288 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.data) = (yyvsp[-1].data); + } +-#line 1713 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1733 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 28: +-#line 276 "dtc-parser.y" /* yacc.c:1646 */ ++ case 30: ++#line 292 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.data) = data_add_marker((yyvsp[-1].data), LABEL, (yyvsp[0].labelref)); + } +-#line 1721 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1741 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 29: +-#line 283 "dtc-parser.y" /* yacc.c:1646 */ ++ case 31: ++#line 299 "dtc-parser.y" /* yacc.c:1646 */ + { + unsigned long long bits; + +@@ -1737,20 +1757,20 @@ yyreduce: + (yyval.array).data = empty_data; + (yyval.array).bits = bits; + } +-#line 1741 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1761 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 30: +-#line 299 "dtc-parser.y" /* yacc.c:1646 */ ++ case 32: ++#line 315 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.array).data = empty_data; + (yyval.array).bits = 32; + } +-#line 1750 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1770 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 31: +-#line 304 "dtc-parser.y" /* yacc.c:1646 */ ++ case 33: ++#line 320 "dtc-parser.y" /* yacc.c:1646 */ + { + if ((yyvsp[-1].array).bits < 64) { + uint64_t mask = (1ULL << (yyvsp[-1].array).bits) - 1; +@@ -1769,11 +1789,11 @@ yyreduce: + + (yyval.array).data = data_append_integer((yyvsp[-1].array).data, (yyvsp[0].integer), (yyvsp[-1].array).bits); + } +-#line 1773 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1793 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 32: +-#line 323 "dtc-parser.y" /* yacc.c:1646 */ ++ case 34: ++#line 339 "dtc-parser.y" /* yacc.c:1646 */ + { + uint64_t val = ~0ULL >> (64 - (yyvsp[-1].array).bits); + +@@ -1787,247 +1807,233 @@ yyreduce: + + (yyval.array).data = data_append_integer((yyvsp[-1].array).data, val, (yyvsp[-1].array).bits); + } +-#line 1791 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1811 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 33: +-#line 337 "dtc-parser.y" /* yacc.c:1646 */ ++ case 35: ++#line 353 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.array).data = data_add_marker((yyvsp[-1].array).data, LABEL, (yyvsp[0].labelref)); + } +-#line 1799 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1819 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 36: +-#line 346 "dtc-parser.y" /* yacc.c:1646 */ ++ case 38: ++#line 362 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.integer) = (yyvsp[-1].integer); + } +-#line 1807 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1827 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 39: +-#line 357 "dtc-parser.y" /* yacc.c:1646 */ ++ case 41: ++#line 373 "dtc-parser.y" /* yacc.c:1646 */ + { (yyval.integer) = (yyvsp[-4].integer) ? (yyvsp[-2].integer) : (yyvsp[0].integer); } +-#line 1813 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1833 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 41: +-#line 362 "dtc-parser.y" /* yacc.c:1646 */ ++ case 43: ++#line 378 "dtc-parser.y" /* yacc.c:1646 */ + { (yyval.integer) = (yyvsp[-2].integer) || (yyvsp[0].integer); } +-#line 1819 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1839 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 43: +-#line 367 "dtc-parser.y" /* yacc.c:1646 */ ++ case 45: ++#line 383 "dtc-parser.y" /* yacc.c:1646 */ + { (yyval.integer) = (yyvsp[-2].integer) && (yyvsp[0].integer); } +-#line 1825 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1845 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 45: +-#line 372 "dtc-parser.y" /* yacc.c:1646 */ ++ case 47: ++#line 388 "dtc-parser.y" /* yacc.c:1646 */ + { (yyval.integer) = (yyvsp[-2].integer) | (yyvsp[0].integer); } +-#line 1831 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1851 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 47: +-#line 377 "dtc-parser.y" /* yacc.c:1646 */ ++ case 49: ++#line 393 "dtc-parser.y" /* yacc.c:1646 */ + { (yyval.integer) = (yyvsp[-2].integer) ^ (yyvsp[0].integer); } +-#line 1837 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1857 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 49: +-#line 382 "dtc-parser.y" /* yacc.c:1646 */ ++ case 51: ++#line 398 "dtc-parser.y" /* yacc.c:1646 */ + { (yyval.integer) = (yyvsp[-2].integer) & (yyvsp[0].integer); } +-#line 1843 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1863 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 51: +-#line 387 "dtc-parser.y" /* yacc.c:1646 */ ++ case 53: ++#line 403 "dtc-parser.y" /* yacc.c:1646 */ + { (yyval.integer) = (yyvsp[-2].integer) == (yyvsp[0].integer); } +-#line 1849 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1869 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 52: +-#line 388 "dtc-parser.y" /* yacc.c:1646 */ ++ case 54: ++#line 404 "dtc-parser.y" /* yacc.c:1646 */ + { (yyval.integer) = (yyvsp[-2].integer) != (yyvsp[0].integer); } +-#line 1855 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1875 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 54: +-#line 393 "dtc-parser.y" /* yacc.c:1646 */ ++ case 56: ++#line 409 "dtc-parser.y" /* yacc.c:1646 */ + { (yyval.integer) = (yyvsp[-2].integer) < (yyvsp[0].integer); } +-#line 1861 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1881 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 55: +-#line 394 "dtc-parser.y" /* yacc.c:1646 */ ++ case 57: ++#line 410 "dtc-parser.y" /* yacc.c:1646 */ + { (yyval.integer) = (yyvsp[-2].integer) > (yyvsp[0].integer); } +-#line 1867 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1887 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 56: +-#line 395 "dtc-parser.y" /* yacc.c:1646 */ ++ case 58: ++#line 411 "dtc-parser.y" /* yacc.c:1646 */ + { (yyval.integer) = (yyvsp[-2].integer) <= (yyvsp[0].integer); } +-#line 1873 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1893 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 57: +-#line 396 "dtc-parser.y" /* yacc.c:1646 */ ++ case 59: ++#line 412 "dtc-parser.y" /* yacc.c:1646 */ + { (yyval.integer) = (yyvsp[-2].integer) >= (yyvsp[0].integer); } +-#line 1879 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1899 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 58: +-#line 400 "dtc-parser.y" /* yacc.c:1646 */ ++ case 60: ++#line 416 "dtc-parser.y" /* yacc.c:1646 */ + { (yyval.integer) = (yyvsp[-2].integer) << (yyvsp[0].integer); } +-#line 1885 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1905 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 59: +-#line 401 "dtc-parser.y" /* yacc.c:1646 */ ++ case 61: ++#line 417 "dtc-parser.y" /* yacc.c:1646 */ + { (yyval.integer) = (yyvsp[-2].integer) >> (yyvsp[0].integer); } +-#line 1891 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1911 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 61: +-#line 406 "dtc-parser.y" /* yacc.c:1646 */ ++ case 63: ++#line 422 "dtc-parser.y" /* yacc.c:1646 */ + { (yyval.integer) = (yyvsp[-2].integer) + (yyvsp[0].integer); } +-#line 1897 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1917 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 62: +-#line 407 "dtc-parser.y" /* yacc.c:1646 */ ++ case 64: ++#line 423 "dtc-parser.y" /* yacc.c:1646 */ + { (yyval.integer) = (yyvsp[-2].integer) - (yyvsp[0].integer); } +-#line 1903 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1923 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 64: +-#line 412 "dtc-parser.y" /* yacc.c:1646 */ ++ case 66: ++#line 428 "dtc-parser.y" /* yacc.c:1646 */ + { (yyval.integer) = (yyvsp[-2].integer) * (yyvsp[0].integer); } +-#line 1909 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1929 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 65: +-#line 414 "dtc-parser.y" /* yacc.c:1646 */ +- { +- if ((yyvsp[0].integer) != 0) { +- (yyval.integer) = (yyvsp[-2].integer) / (yyvsp[0].integer); +- } else { +- ERROR(&(yyloc), "Division by zero"); +- (yyval.integer) = 0; +- } +- } +-#line 1922 "dtc-parser.tab.c" /* yacc.c:1646 */ ++ case 67: ++#line 429 "dtc-parser.y" /* yacc.c:1646 */ ++ { (yyval.integer) = (yyvsp[-2].integer) / (yyvsp[0].integer); } ++#line 1935 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 66: +-#line 423 "dtc-parser.y" /* yacc.c:1646 */ +- { +- if ((yyvsp[0].integer) != 0) { +- (yyval.integer) = (yyvsp[-2].integer) % (yyvsp[0].integer); +- } else { +- ERROR(&(yyloc), "Division by zero"); +- (yyval.integer) = 0; +- } +- } +-#line 1935 "dtc-parser.tab.c" /* yacc.c:1646 */ ++ case 68: ++#line 430 "dtc-parser.y" /* yacc.c:1646 */ ++ { (yyval.integer) = (yyvsp[-2].integer) % (yyvsp[0].integer); } ++#line 1941 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 69: ++ case 71: + #line 436 "dtc-parser.y" /* yacc.c:1646 */ + { (yyval.integer) = -(yyvsp[0].integer); } +-#line 1941 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1947 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 70: ++ case 72: + #line 437 "dtc-parser.y" /* yacc.c:1646 */ + { (yyval.integer) = ~(yyvsp[0].integer); } +-#line 1947 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1953 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 71: ++ case 73: + #line 438 "dtc-parser.y" /* yacc.c:1646 */ + { (yyval.integer) = !(yyvsp[0].integer); } +-#line 1953 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1959 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 72: ++ case 74: + #line 443 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.data) = empty_data; + } +-#line 1961 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1967 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 73: ++ case 75: + #line 447 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.data) = data_append_byte((yyvsp[-1].data), (yyvsp[0].byte)); + } +-#line 1969 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1975 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 74: ++ case 76: + #line 451 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.data) = data_add_marker((yyvsp[-1].data), LABEL, (yyvsp[0].labelref)); + } +-#line 1977 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1983 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 75: ++ case 77: + #line 458 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.nodelist) = NULL; + } +-#line 1985 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1991 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 76: ++ case 78: + #line 462 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.nodelist) = chain_node((yyvsp[-1].node), (yyvsp[0].nodelist)); + } +-#line 1993 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 1999 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 77: ++ case 79: + #line 466 "dtc-parser.y" /* yacc.c:1646 */ + { + ERROR(&(yylsp[0]), "Properties must precede subnodes"); + YYERROR; + } +-#line 2002 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 2008 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 78: ++ case 80: + #line 474 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = name_node((yyvsp[0].node), (yyvsp[-1].propnodename)); + } +-#line 2010 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 2016 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 79: ++ case 81: + #line 478 "dtc-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = name_node(build_node_delete(), (yyvsp[-1].propnodename)); + } +-#line 2018 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 2024 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + +- case 80: ++ case 82: + #line 482 "dtc-parser.y" /* yacc.c:1646 */ + { + add_label(&(yyvsp[0].node)->labels, (yyvsp[-1].labelref)); + (yyval.node) = (yyvsp[0].node); + } +-#line 2027 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 2033 "dtc-parser.tab.c" /* yacc.c:1646 */ + break; + + +-#line 2031 "dtc-parser.tab.c" /* yacc.c:1646 */ ++#line 2037 "dtc-parser.tab.c" /* yacc.c:1646 */ + default: break; + } + /* User semantic actions sometimes alter yychar, and that requires +diff --git a/scripts/dtc/dtc-parser.tab.h_shipped b/scripts/dtc/dtc-parser.tab.h_shipped +index 30867c6..276d078 100644 +--- a/scripts/dtc/dtc-parser.tab.h_shipped ++++ b/scripts/dtc/dtc-parser.tab.h_shipped +@@ -46,26 +46,27 @@ extern int yydebug; + enum yytokentype + { + DT_V1 = 258, +- DT_MEMRESERVE = 259, +- DT_LSHIFT = 260, +- DT_RSHIFT = 261, +- DT_LE = 262, +- DT_GE = 263, +- DT_EQ = 264, +- DT_NE = 265, +- DT_AND = 266, +- DT_OR = 267, +- DT_BITS = 268, +- DT_DEL_PROP = 269, +- DT_DEL_NODE = 270, +- DT_PROPNODENAME = 271, +- DT_LITERAL = 272, +- DT_CHAR_LITERAL = 273, +- DT_BYTE = 274, +- DT_STRING = 275, +- DT_LABEL = 276, +- DT_REF = 277, +- DT_INCBIN = 278 ++ DT_PLUGIN = 259, ++ DT_MEMRESERVE = 260, ++ DT_LSHIFT = 261, ++ DT_RSHIFT = 262, ++ DT_LE = 263, ++ DT_GE = 264, ++ DT_EQ = 265, ++ DT_NE = 266, ++ DT_AND = 267, ++ DT_OR = 268, ++ DT_BITS = 269, ++ DT_DEL_PROP = 270, ++ DT_DEL_NODE = 271, ++ DT_PROPNODENAME = 272, ++ DT_LITERAL = 273, ++ DT_CHAR_LITERAL = 274, ++ DT_BYTE = 275, ++ DT_STRING = 276, ++ DT_LABEL = 277, ++ DT_REF = 278, ++ DT_INCBIN = 279 + }; + #endif + +@@ -74,7 +75,7 @@ extern int yydebug; + typedef union YYSTYPE YYSTYPE; + union YYSTYPE + { +-#line 38 "dtc-parser.y" /* yacc.c:1909 */ ++#line 39 "dtc-parser.y" /* yacc.c:1909 */ + + char *propnodename; + char *labelref; +@@ -92,8 +93,9 @@ union YYSTYPE + struct node *nodelist; + struct reserve_info *re; + uint64_t integer; ++ bool is_plugin; + +-#line 97 "dtc-parser.tab.h" /* yacc.c:1909 */ ++#line 99 "dtc-parser.tab.h" /* yacc.c:1909 */ + }; + # define YYSTYPE_IS_TRIVIAL 1 + # define YYSTYPE_IS_DECLARED 1 +diff --git a/scripts/dtc/dtc-parser.y b/scripts/dtc/dtc-parser.y +index 000873f..bd67bac 100644 +--- a/scripts/dtc/dtc-parser.y ++++ b/scripts/dtc/dtc-parser.y +@@ -19,6 +19,7 @@ + */ + %{ + #include <stdio.h> ++#include <inttypes.h> + + #include "dtc.h" + #include "srcpos.h" +@@ -52,9 +53,11 @@ extern bool treesource_error; + struct node *nodelist; + struct reserve_info *re; + uint64_t integer; ++ bool is_plugin; + } + + %token DT_V1 ++%token DT_PLUGIN + %token DT_MEMRESERVE + %token DT_LSHIFT DT_RSHIFT DT_LE DT_GE DT_EQ DT_NE DT_AND DT_OR + %token DT_BITS +@@ -71,6 +74,7 @@ extern bool treesource_error; + + %type <data> propdata + %type <data> propdataprefix ++%type <is_plugin> plugindecl + %type <re> memreserve + %type <re> memreserves + %type <array> arrayprefix +@@ -101,10 +105,22 @@ extern bool treesource_error; + %% + + sourcefile: +- DT_V1 ';' memreserves devicetree ++ DT_V1 ';' plugindecl memreserves devicetree + { +- the_boot_info = build_boot_info($3, $4, +- guess_boot_cpuid($4)); ++ $5->is_plugin = $3; ++ the_boot_info = build_boot_info($4, $5, ++ guess_boot_cpuid($5)); ++ } ++ ; ++ ++plugindecl: ++ /* empty */ ++ { ++ $$ = false; ++ } ++ | DT_PLUGIN ';' ++ { ++ $$ = true; + } + ; + +diff --git a/scripts/dtc/dtc.c b/scripts/dtc/dtc.c +index 5fa23c4..1f8c285 100644 +--- a/scripts/dtc/dtc.c ++++ b/scripts/dtc/dtc.c +@@ -31,6 +31,7 @@ int reservenum; /* Number of memory reservation slots */ + int minsize; /* Minimum blob size */ + int padsize; /* Additional padding to blob */ + int phandle_format = PHANDLE_BOTH; /* Use linux,phandle or phandle properties */ ++int symbol_fixup_support = 0; + + static void fill_fullpaths(struct node *tree, const char *prefix) + { +@@ -53,7 +54,7 @@ static void fill_fullpaths(struct node *tree, const char *prefix) + #define FDT_VERSION(version) _FDT_VERSION(version) + #define _FDT_VERSION(version) #version + static const char usage_synopsis[] = "dtc [options] <input file>"; +-static const char usage_short_opts[] = "qI:O:o:V:d:R:S:p:fb:i:H:sW:E:hv"; ++static const char usage_short_opts[] = "qI:O:o:V:d:R:S:p:fb:i:H:sW:E:@hv"; + static struct option const usage_long_opts[] = { + {"quiet", no_argument, NULL, 'q'}, + {"in-format", a_argument, NULL, 'I'}, +@@ -71,6 +72,7 @@ static struct option const usage_long_opts[] = { + {"phandle", a_argument, NULL, 'H'}, + {"warning", a_argument, NULL, 'W'}, + {"error", a_argument, NULL, 'E'}, ++ {"symbols", no_argument, NULL, '@'}, + {"help", no_argument, NULL, 'h'}, + {"version", no_argument, NULL, 'v'}, + {NULL, no_argument, NULL, 0x0}, +@@ -101,6 +103,7 @@ static const char * const usage_opts_help[] = { + "\t\tboth - Both \"linux,phandle\" and \"phandle\" properties", + "\n\tEnable/disable warnings (prefix with \"no-\")", + "\n\tEnable/disable errors (prefix with \"no-\")", ++ "\n\tEnable symbols/fixup support", + "\n\tPrint this help and exit", + "\n\tPrint version and exit", + NULL, +@@ -233,7 +236,9 @@ int main(int argc, char *argv[]) + case 'E': + parse_checks_option(false, true, optarg); + break; +- ++ case '@': ++ symbol_fixup_support = 1; ++ break; + case 'h': + usage(NULL); + default: +diff --git a/scripts/dtc/dtc.h b/scripts/dtc/dtc.h +index 56212c8..f163b22 100644 +--- a/scripts/dtc/dtc.h ++++ b/scripts/dtc/dtc.h +@@ -54,6 +54,7 @@ extern int reservenum; /* Number of memory reservation slots */ + extern int minsize; /* Minimum blob size */ + extern int padsize; /* Additional padding to blob */ + extern int phandle_format; /* Use linux,phandle or phandle properties */ ++extern int symbol_fixup_support;/* enable symbols & fixup support */ + + #define PHANDLE_LEGACY 0x1 + #define PHANDLE_EPAPR 0x2 +@@ -132,6 +133,26 @@ struct label { + struct label *next; + }; + ++struct fixup_entry { ++ int offset; ++ struct node *node; ++ struct property *prop; ++ struct fixup_entry *next; ++ bool local_fixup_generated; ++}; ++ ++struct fixup { ++ char *ref; ++ struct fixup_entry *entries; ++ struct fixup *next; ++}; ++ ++struct symbol { ++ struct label *label; ++ struct node *node; ++ struct symbol *next; ++}; ++ + struct property { + bool deleted; + char *name; +@@ -158,6 +179,13 @@ struct node { + int addr_cells, size_cells; + + struct label *labels; ++ ++ struct symbol *symbols; ++ struct fixup_entry *local_fixups; ++ bool emit_local_fixup_node; ++ ++ bool is_plugin; ++ struct fixup *fixups; + }; + + #define for_each_label_withdel(l0, l) \ +@@ -181,6 +209,18 @@ struct node { + for_each_child_withdel(n, c) \ + if (!(c)->deleted) + ++#define for_each_fixup(n, f) \ ++ for ((f) = (n)->fixups; (f); (f) = (f)->next) ++ ++#define for_each_fixup_entry(f, fe) \ ++ for ((fe) = (f)->entries; (fe); (fe) = (fe)->next) ++ ++#define for_each_symbol(n, s) \ ++ for ((s) = (n)->symbols; (s); (s) = (s)->next) ++ ++#define for_each_local_fixup_entry(n, fe) \ ++ for ((fe) = (n)->local_fixups; (fe); (fe) = (fe)->next) ++ + void add_label(struct label **labels, char *label); + void delete_labels(struct label **labels); + +diff --git a/scripts/dtc/flattree.c b/scripts/dtc/flattree.c +index bd99fa2..2385137 100644 +--- a/scripts/dtc/flattree.c ++++ b/scripts/dtc/flattree.c +@@ -255,6 +255,204 @@ static int stringtable_insert(struct data *d, const char *str) + return i; + } + ++static void emit_local_fixups(struct node *tree, struct emitter *emit, ++ void *etarget, struct data *strbuf, struct version_info *vi, ++ struct node *node) ++{ ++ struct fixup_entry *fe, *fen; ++ struct node *child; ++ int nameoff, count; ++ cell_t *buf; ++ struct data d; ++ ++ if (node->emit_local_fixup_node) { ++ ++ /* emit the external fixups (do not emit /) */ ++ if (node != tree) { ++ emit->beginnode(etarget, NULL); ++ emit->string(etarget, node->name, 0); ++ emit->align(etarget, sizeof(cell_t)); ++ } ++ ++ for_each_local_fixup_entry(tree, fe) { ++ if (fe->node != node || fe->local_fixup_generated) ++ continue; ++ ++ /* count the number of fixup entries */ ++ count = 0; ++ for_each_local_fixup_entry(tree, fen) { ++ if (fen->prop != fe->prop) ++ continue; ++ fen->local_fixup_generated = true; ++ count++; ++ } ++ ++ /* allocate buffer */ ++ buf = xmalloc(count * sizeof(cell_t)); ++ ++ /* collect all the offsets in buffer */ ++ count = 0; ++ for_each_local_fixup_entry(tree, fen) { ++ if (fen->prop != fe->prop) ++ continue; ++ fen->local_fixup_generated = true; ++ buf[count++] = cpu_to_fdt32(fen->offset); ++ } ++ d = empty_data; ++ d.len = count * sizeof(cell_t); ++ d.val = (char *)buf; ++ ++ nameoff = stringtable_insert(strbuf, fe->prop->name); ++ emit->property(etarget, fe->prop->labels); ++ emit->cell(etarget, count * sizeof(cell_t)); ++ emit->cell(etarget, nameoff); ++ ++ if ((vi->flags & FTF_VARALIGN) && ++ (count * sizeof(cell_t)) >= 8) ++ emit->align(etarget, 8); ++ ++ emit->data(etarget, d); ++ emit->align(etarget, sizeof(cell_t)); ++ ++ free(buf); ++ } ++ } ++ ++ for_each_child(node, child) ++ emit_local_fixups(tree, emit, etarget, strbuf, vi, child); ++ ++ if (node->emit_local_fixup_node && node != tree) ++ emit->endnode(etarget, tree->labels); ++} ++ ++static void emit_symbols_node(struct node *tree, struct emitter *emit, ++ void *etarget, struct data *strbuf, ++ struct version_info *vi) ++{ ++ struct symbol *sym; ++ int nameoff, vallen; ++ ++ /* do nothing if no symbols */ ++ if (!tree->symbols) ++ return; ++ ++ emit->beginnode(etarget, NULL); ++ emit->string(etarget, "__symbols__", 0); ++ emit->align(etarget, sizeof(cell_t)); ++ ++ for_each_symbol(tree, sym) { ++ ++ vallen = strlen(sym->node->fullpath); ++ ++ nameoff = stringtable_insert(strbuf, sym->label->label); ++ ++ emit->property(etarget, NULL); ++ emit->cell(etarget, vallen + 1); ++ emit->cell(etarget, nameoff); ++ ++ if ((vi->flags & FTF_VARALIGN) && vallen >= 8) ++ emit->align(etarget, 8); ++ ++ emit->string(etarget, sym->node->fullpath, ++ strlen(sym->node->fullpath)); ++ emit->align(etarget, sizeof(cell_t)); ++ } ++ ++ emit->endnode(etarget, NULL); ++} ++ ++static void emit_local_fixups_node(struct node *tree, struct emitter *emit, ++ void *etarget, struct data *strbuf, ++ struct version_info *vi) ++{ ++ struct fixup_entry *fe; ++ struct node *node; ++ ++ /* do nothing if no local fixups */ ++ if (!tree->local_fixups) ++ return; ++ ++ /* mark all nodes that need a local fixup generated (and parents) */ ++ for_each_local_fixup_entry(tree, fe) { ++ node = fe->node; ++ while (node != NULL && !node->emit_local_fixup_node) { ++ node->emit_local_fixup_node = true; ++ node = node->parent; ++ } ++ } ++ ++ /* emit the local fixups node now */ ++ emit->beginnode(etarget, NULL); ++ emit->string(etarget, "__local_fixups__", 0); ++ emit->align(etarget, sizeof(cell_t)); ++ ++ emit_local_fixups(tree, emit, etarget, strbuf, vi, tree); ++ ++ emit->endnode(etarget, tree->labels); ++} ++ ++static void emit_fixups_node(struct node *tree, struct emitter *emit, ++ void *etarget, struct data *strbuf, ++ struct version_info *vi) ++{ ++ struct fixup *f; ++ struct fixup_entry *fe; ++ char *name, *s; ++ const char *fullpath; ++ int namesz, nameoff, vallen; ++ ++ /* do nothing if no fixups */ ++ if (!tree->fixups) ++ return; ++ ++ /* emit the external fixups */ ++ emit->beginnode(etarget, NULL); ++ emit->string(etarget, "__fixups__", 0); ++ emit->align(etarget, sizeof(cell_t)); ++ ++ for_each_fixup(tree, f) { ++ ++ namesz = 0; ++ for_each_fixup_entry(f, fe) { ++ fullpath = fe->node->fullpath; ++ if (fullpath[0] == '\0') ++ fullpath = "/"; ++ namesz += strlen(fullpath) + 1; ++ namesz += strlen(fe->prop->name) + 1; ++ namesz += 32; /* space for :<number> + '\0' */ ++ } ++ ++ name = xmalloc(namesz); ++ ++ s = name; ++ for_each_fixup_entry(f, fe) { ++ fullpath = fe->node->fullpath; ++ if (fullpath[0] == '\0') ++ fullpath = "/"; ++ snprintf(s, name + namesz - s, "%s:%s:%d", fullpath, ++ fe->prop->name, fe->offset); ++ s += strlen(s) + 1; ++ } ++ ++ nameoff = stringtable_insert(strbuf, f->ref); ++ vallen = s - name - 1; ++ ++ emit->property(etarget, NULL); ++ emit->cell(etarget, vallen + 1); ++ emit->cell(etarget, nameoff); ++ ++ if ((vi->flags & FTF_VARALIGN) && vallen >= 8) ++ emit->align(etarget, 8); ++ ++ emit->string(etarget, name, vallen); ++ emit->align(etarget, sizeof(cell_t)); ++ ++ free(name); ++ } ++ ++ emit->endnode(etarget, tree->labels); ++} ++ + static void flatten_tree(struct node *tree, struct emitter *emit, + void *etarget, struct data *strbuf, + struct version_info *vi) +@@ -310,6 +508,10 @@ static void flatten_tree(struct node *tree, struct emitter *emit, + flatten_tree(child, emit, etarget, strbuf, vi); + } + ++ emit_symbols_node(tree, emit, etarget, strbuf, vi); ++ emit_local_fixups_node(tree, emit, etarget, strbuf, vi); ++ emit_fixups_node(tree, emit, etarget, strbuf, vi); ++ + emit->endnode(etarget, tree->labels); + } + +diff --git a/scripts/dtc/version_gen.h b/scripts/dtc/version_gen.h +index 11d93e6..2595dfd 100644 +--- a/scripts/dtc/version_gen.h ++++ b/scripts/dtc/version_gen.h +@@ -1 +1 @@ +-#define DTC_VERSION "DTC 1.4.1-gb06e55c8" ++#define DTC_VERSION "DTC 1.4.1-g25efc119" + +From 43f338fd4cb0e7a0813f527883930806c712369e Mon Sep 17 00:00:00 2001 +From: Phil Elwell <phil@raspberrypi.org> +Date: Fri, 5 Dec 2014 17:26:26 +0000 +Subject: [PATCH 056/112] fdt: Add support for the CONFIG_CMDLINE_EXTEND option + +--- + drivers/of/fdt.c | 29 ++++++++++++++++++++++++----- + 1 file changed, 24 insertions(+), 5 deletions(-) + +diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c +index 3349d2a..1e26605 100644 +--- a/drivers/of/fdt.c ++++ b/drivers/of/fdt.c +@@ -960,19 +960,38 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname, + + /* Retrieve command line */ + p = of_get_flat_dt_prop(node, "bootargs", &l); +- if (p != NULL && l > 0) +- strlcpy(data, p, min((int)l, COMMAND_LINE_SIZE)); + + /* + * CONFIG_CMDLINE is meant to be a default in case nothing else + * managed to set the command line, unless CONFIG_CMDLINE_FORCE + * is set in which case we override whatever was found earlier. ++ * ++ * However, it can be useful to be able to treat the default as ++ * a starting point to be extended using CONFIG_CMDLINE_EXTEND. + */ ++ ((char *)data)[0] = '\0'; ++ + #ifdef CONFIG_CMDLINE +-#ifndef CONFIG_CMDLINE_FORCE +- if (!((char *)data)[0]) ++ strlcpy(data, CONFIG_CMDLINE, COMMAND_LINE_SIZE); ++ ++ if (p != NULL && l > 0) { ++#if defined(CONFIG_CMDLINE_EXTEND) ++ int len = strlen(data); ++ if (len > 0) { ++ strlcat(data, " ", COMMAND_LINE_SIZE); ++ len++; ++ } ++ strlcpy((char *)data + len, p, min((int)l, COMMAND_LINE_SIZE - len)); ++#elif defined(CONFIG_CMDLINE_FORCE) ++ pr_warning("Ignoring bootargs property (using the default kernel command line)\n"); ++#else ++ /* Neither extend nor force - just override */ ++ strlcpy(data, p, min((int)l, COMMAND_LINE_SIZE)); + #endif +- strlcpy(data, CONFIG_CMDLINE, COMMAND_LINE_SIZE); ++ } ++#else /* CONFIG_CMDLINE */ ++ if (p != NULL && l > 0) ++ strlcpy(data, p, min((int)l, COMMAND_LINE_SIZE)); + #endif /* CONFIG_CMDLINE */ + + pr_debug("Command line is: %s\n", (char*)data); + +From d0653a1baeb2b6a9507051fb026b01a1621cb321 Mon Sep 17 00:00:00 2001 +From: notro <notro@tronnes.org> +Date: Wed, 9 Jul 2014 14:46:08 +0200 +Subject: [PATCH 057/112] BCM2708: Add core Device Tree support + +Add the bare minimum needed to boot BCM2708 from a Device Tree. + +Signed-off-by: Noralf Tronnes <notro@tronnes.org> + +BCM2708: DT: change 'axi' nodename to 'soc' + +Change DT node named 'axi' to 'soc' so it matches ARCH_BCM2835. +The VC4 bootloader fills in certain properties in the 'axi' subtree, +but since this is part of an upstreaming effort, the name is changed. + +Signed-off-by: Noralf Tronnes notro@tronnes.org + +BCM2708_DT: Correct length of the peripheral space + +Use dts-dirs feature for overlays. + +The kernel makefiles have a dts-dirs target that is for vendor subdirectories. + +Using this fixes the install_dtbs target, which previously did not install the overlays. + +BCM270X_DT: configure I2S DMA channels + +Signed-off-by: Matthias Reichl <hias@horus.com> + +BCM270X_DT: switch to bcm2835-i2s + +I2S soundcard drivers with proper devicetree support (i.e. not linking +to the cpu_dai/platform via name but to cpu/platform via of_node) +will work out of the box without any modifications. + +When the kernel is compiled without devicetree support the platform +code will instantiate the bcm2708-i2s driver and I2S soundcard drivers +will link to it via name, as before. + +Signed-off-by: Matthias Reichl <hias@horus.com> + +SDIO-overlay: add poll_once-boolean parameter + +Add paramter to toggle sdio-device-polling +done every second or once at boot-time. + +Signed-off-by: Patrick Boettcher <patrick.boettcher@posteo.de> + +BCM270X_DT: Make mmc overlay compatible with current firmware + +The original DT overlay logic followed a merge-then-patch procedure, +i.e. parameters are applied to the loaded overlay before the overlay +is merged into the base DTB. This sequence has been changed to +patch-then-merge, in order to support parameterised node names, and +to protect against bad overlays. As a result, overrides (parameters) +must only target labels in the overlay, but the overlay can obviously target nodes in the base DTB. + +mmc-overlay.dts (that switches back to the original mmc sdcard +driver) is the only overlay violating that rule, and this patch +fixes it. + +bcm270x_dt: Use the sdhost MMC controller by default + +The "mmc" overlay reverts to using the other controller. + +squash: Add cprman to dt + +BCM270X_DT: Use clk_core for I2C interfaces +--- + arch/arm/boot/dts/Makefile | 31 + + arch/arm/boot/dts/bcm2708-rpi-b-plus.dts | 154 +++ + arch/arm/boot/dts/bcm2708-rpi-b.dts | 144 +++ + arch/arm/boot/dts/bcm2708-rpi-cm.dts | 102 ++ + arch/arm/boot/dts/bcm2708-rpi-cm.dtsi | 52 + + arch/arm/boot/dts/bcm2708.dtsi | 40 + + arch/arm/boot/dts/bcm2708_common.dtsi | 438 ++++++++ + arch/arm/boot/dts/bcm2709-rpi-2-b.dts | 154 +++ + arch/arm/boot/dts/bcm2709.dtsi | 102 ++ + arch/arm/boot/dts/bcm2710-rpi-3-b.dts | 201 ++++ + arch/arm/boot/dts/bcm2710.dtsi | 102 ++ + arch/arm/boot/dts/bcm2835-rpi-cm.dts | 93 ++ + arch/arm/boot/dts/bcm2835-rpi-cm.dtsi | 30 + + arch/arm/boot/dts/overlays/Makefile | 99 ++ + arch/arm/boot/dts/overlays/README | 1161 ++++++++++++++++++++ + .../arm/boot/dts/overlays/adau1977-adc-overlay.dts | 53 + + arch/arm/boot/dts/overlays/ads7846-overlay.dts | 89 ++ + .../dts/overlays/akkordion-iqdacplus-overlay.dts | 46 + + arch/arm/boot/dts/overlays/at86rf233-overlay.dts | 57 + + .../audioinjector-wm8731-audio-overlay.dts | 39 + + .../dts/overlays/bmp085_i2c-sensor-overlay.dts | 23 + + arch/arm/boot/dts/overlays/dht11-overlay.dts | 39 + + arch/arm/boot/dts/overlays/dpi24-overlay.dts | 31 + + arch/arm/boot/dts/overlays/dwc-otg-overlay.dts | 20 + + arch/arm/boot/dts/overlays/dwc2-overlay.dts | 29 + + arch/arm/boot/dts/overlays/enc28j60-overlay.dts | 53 + + arch/arm/boot/dts/overlays/gpio-ir-overlay.dts | 45 + + .../boot/dts/overlays/gpio-poweroff-overlay.dts | 34 + + .../boot/dts/overlays/hifiberry-amp-overlay.dts | 39 + + .../boot/dts/overlays/hifiberry-dac-overlay.dts | 34 + + .../dts/overlays/hifiberry-dacplus-overlay.dts | 56 + + .../boot/dts/overlays/hifiberry-digi-overlay.dts | 39 + + arch/arm/boot/dts/overlays/hy28a-overlay.dts | 93 ++ + arch/arm/boot/dts/overlays/hy28b-overlay.dts | 148 +++ + arch/arm/boot/dts/overlays/i2c-gpio-overlay.dts | 28 + + arch/arm/boot/dts/overlays/i2c-mux-overlay.dts | 139 +++ + .../boot/dts/overlays/i2c-pwm-pca9685a-overlay.dts | 26 + + arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts | 69 ++ + .../arm/boot/dts/overlays/i2c0-bcm2708-overlay.dts | 61 + + .../arm/boot/dts/overlays/i2c1-bcm2708-overlay.dts | 37 + + .../boot/dts/overlays/i2s-gpio28-31-overlay.dts | 18 + + arch/arm/boot/dts/overlays/i2s-mmap-overlay.dts | 13 + + arch/arm/boot/dts/overlays/iqaudio-dac-overlay.dts | 43 + + .../boot/dts/overlays/iqaudio-dacplus-overlay.dts | 43 + + .../arm/boot/dts/overlays/justboom-dac-overlay.dts | 43 + + .../boot/dts/overlays/justboom-digi-overlay.dts | 39 + + arch/arm/boot/dts/overlays/lirc-rpi-overlay.dts | 57 + + arch/arm/boot/dts/overlays/mcp23017-overlay.dts | 54 + + .../arm/boot/dts/overlays/mcp2515-can0-overlay.dts | 73 ++ + .../arm/boot/dts/overlays/mcp2515-can1-overlay.dts | 73 ++ + arch/arm/boot/dts/overlays/mmc-overlay.dts | 38 + + arch/arm/boot/dts/overlays/mz61581-overlay.dts | 117 ++ + arch/arm/boot/dts/overlays/pi3-act-led-overlay.dts | 27 + + .../boot/dts/overlays/pi3-disable-bt-overlay.dts | 46 + + .../boot/dts/overlays/pi3-miniuart-bt-overlay.dts | 64 ++ + arch/arm/boot/dts/overlays/piscreen-overlay.dts | 102 ++ + arch/arm/boot/dts/overlays/piscreen2r-overlay.dts | 106 ++ + arch/arm/boot/dts/overlays/pitft22-overlay.dts | 69 ++ + .../dts/overlays/pitft28-capacitive-overlay.dts | 91 ++ + .../dts/overlays/pitft28-resistive-overlay.dts | 121 ++ + arch/arm/boot/dts/overlays/pps-gpio-overlay.dts | 34 + + arch/arm/boot/dts/overlays/pwm-2chan-overlay.dts | 53 + + arch/arm/boot/dts/overlays/pwm-overlay.dts | 49 + + arch/arm/boot/dts/overlays/qca7000-overlay.dts | 52 + + arch/arm/boot/dts/overlays/raspidac3-overlay.dts | 45 + + .../boot/dts/overlays/rpi-backlight-overlay.dts | 21 + + arch/arm/boot/dts/overlays/rpi-dac-overlay.dts | 34 + + arch/arm/boot/dts/overlays/rpi-display-overlay.dts | 89 ++ + arch/arm/boot/dts/overlays/rpi-ft5406-overlay.dts | 17 + + arch/arm/boot/dts/overlays/rpi-proto-overlay.dts | 39 + + arch/arm/boot/dts/overlays/rpi-sense-overlay.dts | 47 + + .../overlays/rra-digidac1-wm8741-audio-overlay.dts | 81 ++ + arch/arm/boot/dts/overlays/sdhost-overlay.dts | 32 + + arch/arm/boot/dts/overlays/sdio-1bit-overlay.dts | 36 + + arch/arm/boot/dts/overlays/sdio-overlay.dts | 36 + + arch/arm/boot/dts/overlays/sdtweak-overlay.dts | 23 + + arch/arm/boot/dts/overlays/smi-dev-overlay.dts | 18 + + arch/arm/boot/dts/overlays/smi-nand-overlay.dts | 69 ++ + arch/arm/boot/dts/overlays/smi-overlay.dts | 37 + + .../boot/dts/overlays/spi-gpio35-39-overlay.dts | 31 + + arch/arm/boot/dts/overlays/spi1-1cs-overlay.dts | 57 + + arch/arm/boot/dts/overlays/spi1-2cs-overlay.dts | 69 ++ + arch/arm/boot/dts/overlays/spi1-3cs-overlay.dts | 81 ++ + arch/arm/boot/dts/overlays/spi2-1cs-overlay.dts | 57 + + arch/arm/boot/dts/overlays/spi2-2cs-overlay.dts | 69 ++ + arch/arm/boot/dts/overlays/spi2-3cs-overlay.dts | 81 ++ + arch/arm/boot/dts/overlays/tinylcd35-overlay.dts | 224 ++++ + arch/arm/boot/dts/overlays/uart1-overlay.dts | 38 + + arch/arm/boot/dts/overlays/vc4-kms-v3d-overlay.dts | 129 +++ + arch/arm/boot/dts/overlays/vga666-overlay.dts | 30 + + arch/arm/boot/dts/overlays/w1-gpio-overlay.dts | 39 + + .../boot/dts/overlays/w1-gpio-pullup-overlay.dts | 41 + + arch/arm/boot/dts/overlays/wittypi-overlay.dts | 44 + + 93 files changed, 7269 insertions(+) + create mode 100644 arch/arm/boot/dts/bcm2708-rpi-b-plus.dts + create mode 100644 arch/arm/boot/dts/bcm2708-rpi-b.dts + create mode 100755 arch/arm/boot/dts/bcm2708-rpi-cm.dts + create mode 100644 arch/arm/boot/dts/bcm2708-rpi-cm.dtsi + create mode 100644 arch/arm/boot/dts/bcm2708.dtsi + create mode 100644 arch/arm/boot/dts/bcm2708_common.dtsi + create mode 100644 arch/arm/boot/dts/bcm2709-rpi-2-b.dts + create mode 100644 arch/arm/boot/dts/bcm2709.dtsi + create mode 100644 arch/arm/boot/dts/bcm2710-rpi-3-b.dts + create mode 100644 arch/arm/boot/dts/bcm2710.dtsi + create mode 100644 arch/arm/boot/dts/bcm2835-rpi-cm.dts + create mode 100644 arch/arm/boot/dts/bcm2835-rpi-cm.dtsi + create mode 100644 arch/arm/boot/dts/overlays/Makefile + create mode 100644 arch/arm/boot/dts/overlays/README + create mode 100644 arch/arm/boot/dts/overlays/adau1977-adc-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/ads7846-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/akkordion-iqdacplus-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/at86rf233-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/audioinjector-wm8731-audio-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/bmp085_i2c-sensor-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/dht11-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/dpi24-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/dwc-otg-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/dwc2-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/enc28j60-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/gpio-ir-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/gpio-poweroff-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/hifiberry-amp-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/hifiberry-dac-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/hifiberry-digi-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/hy28a-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/hy28b-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/i2c-gpio-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/i2c-mux-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/i2c-pwm-pca9685a-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/i2c0-bcm2708-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/i2c1-bcm2708-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/i2s-gpio28-31-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/i2s-mmap-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/iqaudio-dac-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/iqaudio-dacplus-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/justboom-dac-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/justboom-digi-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/lirc-rpi-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/mcp23017-overlay.dts + create mode 100755 arch/arm/boot/dts/overlays/mcp2515-can0-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/mcp2515-can1-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/mmc-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/mz61581-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/pi3-act-led-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/pi3-disable-bt-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/pi3-miniuart-bt-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/piscreen-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/piscreen2r-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/pitft22-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/pitft28-capacitive-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/pitft28-resistive-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/pps-gpio-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/pwm-2chan-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/pwm-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/qca7000-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/raspidac3-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/rpi-backlight-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/rpi-dac-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/rpi-display-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/rpi-ft5406-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/rpi-proto-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/rpi-sense-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/rra-digidac1-wm8741-audio-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/sdhost-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/sdio-1bit-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/sdio-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/sdtweak-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/smi-dev-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/smi-nand-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/smi-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/spi-gpio35-39-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/spi1-1cs-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/spi1-2cs-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/spi1-3cs-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/spi2-1cs-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/spi2-2cs-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/spi2-3cs-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/tinylcd35-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/uart1-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/vc4-kms-v3d-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/vga666-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/w1-gpio-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/w1-gpio-pullup-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/wittypi-overlay.dts + +diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile +index 95c1923..1af92d7 100644 +--- a/arch/arm/boot/dts/Makefile ++++ b/arch/arm/boot/dts/Makefile +@@ -1,5 +1,26 @@ + ifeq ($(CONFIG_OF),y) + ++dtb-$(CONFIG_ARCH_BCM2708) += bcm2708-rpi-b.dtb ++dtb-$(CONFIG_ARCH_BCM2708) += bcm2708-rpi-b-plus.dtb ++dtb-$(CONFIG_ARCH_BCM2708) += bcm2708-rpi-cm.dtb ++dtb-$(CONFIG_ARCH_BCM2835) += bcm2835-rpi-cm.dtb ++dtb-$(CONFIG_ARCH_BCM2709) += bcm2709-rpi-2-b.dtb ++dtb-$(CONFIG_ARCH_BCM2709) += bcm2710-rpi-3-b.dtb ++ ++# Raspberry Pi ++ifeq ($(CONFIG_ARCH_BCM2708),y) ++ RPI_DT_OVERLAYS=y ++endif ++ifeq ($(CONFIG_ARCH_BCM2709),y) ++ RPI_DT_OVERLAYS=y ++endif ++ifeq ($(CONFIG_ARCH_BCM2835),y) ++ RPI_DT_OVERLAYS=y ++endif ++ifeq ($(RPI_DT_OVERLAYS),y) ++ dts-dirs += overlays ++endif ++ + dtb-$(CONFIG_ARCH_ALPINE) += \ + alpine-db.dtb + dtb-$(CONFIG_MACH_ARTPEC6) += \ +@@ -839,10 +860,20 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \ + mt8127-moose.dtb \ + mt8135-evbp1.dtb + dtb-$(CONFIG_ARCH_ZX) += zx296702-ad1.dtb ++ ++targets += dtbs dtbs_install ++targets += $(dtb-y) ++ + endif + + dtstree := $(srctree)/$(src) + dtb-$(CONFIG_OF_ALL_DTBS) := $(patsubst $(dtstree)/%.dts,%.dtb, $(wildcard $(dtstree)/*.dts)) + + always := $(dtb-y) ++subdir-y := $(dts-dirs) + clean-files := *.dtb ++ ++# Enable fixups to support overlays on BCM2708 platforms ++ifeq ($(RPI_DT_OVERLAYS),y) ++ DTC_FLAGS ?= -@ -H epapr ++endif +diff --git a/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts b/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts +new file mode 100644 +index 0000000..0ac7725 +--- /dev/null ++++ b/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts +@@ -0,0 +1,154 @@ ++/dts-v1/; ++ ++#include "bcm2708.dtsi" ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ model = "Raspberry Pi Model B+"; ++}; ++ ++&gpio { ++ sdhost_pins: sdhost_pins { ++ brcm,pins = <48 49 50 51 52 53>; ++ brcm,function = <4>; /* alt0 */ ++ }; ++ ++ spi0_pins: spi0_pins { ++ brcm,pins = <9 10 11>; ++ brcm,function = <4>; /* alt0 */ ++ }; ++ ++ spi0_cs_pins: spi0_cs_pins { ++ brcm,pins = <8 7>; ++ brcm,function = <1>; /* output */ ++ }; ++ ++ i2c0_pins: i2c0 { ++ brcm,pins = <0 1>; ++ brcm,function = <4>; ++ }; ++ ++ i2c1_pins: i2c1 { ++ brcm,pins = <2 3>; ++ brcm,function = <4>; ++ }; ++ ++ i2s_pins: i2s { ++ brcm,pins = <18 19 20 21>; ++ brcm,function = <4>; /* alt0 */ ++ }; ++}; ++ ++&sdhost { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&sdhost_pins>; ++ bus-width = <4>; ++ status = "okay"; ++}; ++ ++&fb { ++ status = "okay"; ++}; ++ ++&uart0 { ++ status = "okay"; ++}; ++ ++&spi0 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&spi0_pins &spi0_cs_pins>; ++ cs-gpios = <&gpio 8 1>, <&gpio 7 1>; ++ ++ spidev0: spidev@0{ ++ compatible = "spidev"; ++ reg = <0>; /* CE0 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ }; ++ ++ spidev1: spidev@1{ ++ compatible = "spidev"; ++ reg = <1>; /* CE1 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ }; ++}; ++ ++&i2c0 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2c0_pins>; ++ clock-frequency = <100000>; ++}; ++ ++&i2c1 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2c1_pins>; ++ clock-frequency = <100000>; ++}; ++ ++&i2c2 { ++ clock-frequency = <100000>; ++}; ++ ++&i2s { ++ #sound-dai-cells = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2s_pins>; ++}; ++ ++&random { ++ status = "okay"; ++}; ++ ++&leds { ++ act_led: act { ++ label = "led0"; ++ linux,default-trigger = "mmc0"; ++ gpios = <&gpio 47 0>; ++ }; ++ ++ pwr_led: pwr { ++ label = "led1"; ++ linux,default-trigger = "input"; ++ gpios = <&gpio 35 0>; ++ }; ++}; ++ ++&hdmi { ++ hpd-gpios = <&gpio 46 GPIO_ACTIVE_LOW>; ++}; ++ ++/ { ++ __overrides__ { ++ uart0 = <&uart0>,"status"; ++ uart0_clkrate = <&clk_uart0>,"clock-frequency:0"; ++ uart1 = <&uart1>,"status"; ++ i2s = <&i2s>,"status"; ++ spi = <&spi0>,"status"; ++ i2c0 = <&i2c0>,"status"; ++ i2c1 = <&i2c1>,"status"; ++ i2c2_iknowwhatimdoing = <&i2c2>,"status"; ++ i2c0_baudrate = <&i2c0>,"clock-frequency:0"; ++ i2c1_baudrate = <&i2c1>,"clock-frequency:0"; ++ i2c2_baudrate = <&i2c2>,"clock-frequency:0"; ++ core_freq = <&clk_core>,"clock-frequency:0"; ++ ++ act_led_gpio = <&act_led>,"gpios:4"; ++ act_led_activelow = <&act_led>,"gpios:8"; ++ act_led_trigger = <&act_led>,"linux,default-trigger"; ++ ++ pwr_led_gpio = <&pwr_led>,"gpios:4"; ++ pwr_led_activelow = <&pwr_led>,"gpios:8"; ++ pwr_led_trigger = <&pwr_led>,"linux,default-trigger"; ++ ++ audio = <&audio>,"status"; ++ watchdog = <&watchdog>,"status"; ++ random = <&random>,"status"; ++ sd_overclock = <&sdhost>,"brcm,overclock-50:0"; ++ sd_force_pio = <&sdhost>,"brcm,force-pio?"; ++ sd_pio_limit = <&sdhost>,"brcm,pio-limit:0"; ++ sd_debug = <&sdhost>,"brcm,debug"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/bcm2708-rpi-b.dts b/arch/arm/boot/dts/bcm2708-rpi-b.dts +new file mode 100644 +index 0000000..8474834 +--- /dev/null ++++ b/arch/arm/boot/dts/bcm2708-rpi-b.dts +@@ -0,0 +1,144 @@ ++/dts-v1/; ++ ++#include "bcm2708.dtsi" ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ model = "Raspberry Pi Model B"; ++}; ++ ++&gpio { ++ sdhost_pins: sdhost_pins { ++ brcm,pins = <48 49 50 51 52 53>; ++ brcm,function = <4>; /* alt0 */ ++ }; ++ ++ spi0_pins: spi0_pins { ++ brcm,pins = <9 10 11>; ++ brcm,function = <4>; /* alt0 */ ++ }; ++ ++ spi0_cs_pins: spi0_cs_pins { ++ brcm,pins = <8 7>; ++ brcm,function = <1>; /* output */ ++ }; ++ ++ i2c0_pins: i2c0 { ++ brcm,pins = <0 1>; ++ brcm,function = <4>; ++ }; ++ ++ i2c1_pins: i2c1 { ++ brcm,pins = <2 3>; ++ brcm,function = <4>; ++ }; ++ ++ i2s_pins: i2s { ++ brcm,pins = <28 29 30 31>; ++ brcm,function = <6>; /* alt2 */ ++ }; ++}; ++ ++&sdhost { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&sdhost_pins>; ++ bus-width = <4>; ++ status = "okay"; ++}; ++ ++&fb { ++ status = "okay"; ++}; ++ ++&uart0 { ++ status = "okay"; ++}; ++ ++&spi0 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&spi0_pins &spi0_cs_pins>; ++ cs-gpios = <&gpio 8 1>, <&gpio 7 1>; ++ ++ spidev0: spidev@0{ ++ compatible = "spidev"; ++ reg = <0>; /* CE0 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ }; ++ ++ spidev1: spidev@1{ ++ compatible = "spidev"; ++ reg = <1>; /* CE1 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ }; ++}; ++ ++&i2c0 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2c0_pins>; ++ clock-frequency = <100000>; ++}; ++ ++&i2c1 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2c1_pins>; ++ clock-frequency = <100000>; ++}; ++ ++&i2c2 { ++ clock-frequency = <100000>; ++}; ++ ++&i2s { ++ #sound-dai-cells = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2s_pins>; ++}; ++ ++&random { ++ status = "okay"; ++}; ++ ++&leds { ++ act_led: act { ++ label = "led0"; ++ linux,default-trigger = "mmc0"; ++ gpios = <&gpio 16 1>; ++ }; ++}; ++ ++&hdmi { ++ hpd-gpios = <&gpio 46 GPIO_ACTIVE_HIGH>; ++}; ++ ++/ { ++ __overrides__ { ++ uart0 = <&uart0>,"status"; ++ uart0_clkrate = <&clk_uart0>,"clock-frequency:0"; ++ uart1 = <&uart1>,"status"; ++ i2s = <&i2s>,"status"; ++ spi = <&spi0>,"status"; ++ i2c0 = <&i2c0>,"status"; ++ i2c1 = <&i2c1>,"status"; ++ i2c2_iknowwhatimdoing = <&i2c2>,"status"; ++ i2c0_baudrate = <&i2c0>,"clock-frequency:0"; ++ i2c1_baudrate = <&i2c1>,"clock-frequency:0"; ++ i2c2_baudrate = <&i2c2>,"clock-frequency:0"; ++ core_freq = <&clk_core>,"clock-frequency:0"; ++ ++ act_led_gpio = <&act_led>,"gpios:4"; ++ act_led_activelow = <&act_led>,"gpios:8"; ++ act_led_trigger = <&act_led>,"linux,default-trigger"; ++ ++ audio = <&audio>,"status"; ++ watchdog = <&watchdog>,"status"; ++ random = <&random>,"status"; ++ sd_overclock = <&sdhost>,"brcm,overclock-50:0"; ++ sd_force_pio = <&sdhost>,"brcm,force-pio?"; ++ sd_pio_limit = <&sdhost>,"brcm,pio-limit:0"; ++ sd_debug = <&sdhost>,"brcm,debug"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/bcm2708-rpi-cm.dts b/arch/arm/boot/dts/bcm2708-rpi-cm.dts +new file mode 100755 +index 0000000..cd0e1ac +--- /dev/null ++++ b/arch/arm/boot/dts/bcm2708-rpi-cm.dts +@@ -0,0 +1,102 @@ ++/dts-v1/; ++ ++#include "bcm2708-rpi-cm.dtsi" ++ ++/ { ++ model = "Raspberry Pi Compute Module"; ++}; ++ ++&uart0 { ++ status = "okay"; ++}; ++ ++&gpio { ++ spi0_pins: spi0_pins { ++ brcm,pins = <9 10 11>; ++ brcm,function = <4>; /* alt0 */ ++ }; ++ ++ spi0_cs_pins: spi0_cs_pins { ++ brcm,pins = <8 7>; ++ brcm,function = <1>; /* output */ ++ }; ++ ++ i2c0_pins: i2c0 { ++ brcm,pins = <0 1>; ++ brcm,function = <4>; ++ }; ++ ++ i2c1_pins: i2c1 { ++ brcm,pins = <2 3>; ++ brcm,function = <4>; ++ }; ++ ++ i2s_pins: i2s { ++ brcm,pins = <18 19 20 21>; ++ brcm,function = <4>; /* alt0 */ ++ }; ++}; ++ ++&spi0 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&spi0_pins &spi0_cs_pins>; ++ cs-gpios = <&gpio 8 1>, <&gpio 7 1>; ++ ++ spidev0: spidev@0{ ++ compatible = "spidev"; ++ reg = <0>; /* CE0 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ }; ++ ++ spidev1: spidev@1{ ++ compatible = "spidev"; ++ reg = <1>; /* CE1 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ }; ++}; ++ ++&i2c0 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2c0_pins>; ++ clock-frequency = <100000>; ++}; ++ ++&i2c1 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2c1_pins>; ++ clock-frequency = <100000>; ++}; ++ ++&i2c2 { ++ clock-frequency = <100000>; ++}; ++ ++&i2s { ++ #sound-dai-cells = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2s_pins>; ++}; ++ ++&random { ++ status = "okay"; ++}; ++ ++/ { ++ __overrides__ { ++ uart0 = <&uart0>,"status"; ++ uart0_clkrate = <&clk_uart0>,"clock-frequency:0"; ++ uart1 = <&uart1>,"status"; ++ i2s = <&i2s>,"status"; ++ spi = <&spi0>,"status"; ++ i2c0 = <&i2c0>,"status"; ++ i2c1 = <&i2c1>,"status"; ++ i2c2_iknowwhatimdoing = <&i2c2>,"status"; ++ i2c0_baudrate = <&i2c0>,"clock-frequency:0"; ++ i2c1_baudrate = <&i2c1>,"clock-frequency:0"; ++ i2c2_baudrate = <&i2c2>,"clock-frequency:0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi b/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi +new file mode 100644 +index 0000000..90e330d +--- /dev/null ++++ b/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi +@@ -0,0 +1,52 @@ ++#include "bcm2708.dtsi" ++ ++&gpio { ++ sdhost_pins: sdhost_pins { ++ brcm,pins = <48 49 50 51 52 53>; ++ brcm,function = <4>; /* alt0 */ ++ }; ++}; ++ ++&gpio { ++ mmc_pins: mmc_pins { ++ brcm,pins = <48 49 50 51 52 53>; ++ brcm,function = <7>; /* alt3 */ ++ }; ++}; ++ ++&leds { ++ act_led: act { ++ label = "led0"; ++ linux,default-trigger = "mmc0"; ++ gpios = <&gpio 47 0>; ++ }; ++}; ++ ++ ++&mmc { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&mmc_pins>; ++ non-removable; ++ bus-width = <4>; ++ status = "okay"; ++ brcm,overclock-50 = <0>; ++}; ++ ++&fb { ++ status = "okay"; ++}; ++ ++/ { ++ __overrides__ { ++ core_freq = <&clk_core>,"clock-frequency:0"; ++ ++ act_led_gpio = <&act_led>,"gpios:4"; ++ act_led_activelow = <&act_led>,"gpios:8"; ++ act_led_trigger = <&act_led>,"linux,default-trigger"; ++ ++ audio = <&audio>,"status"; ++ watchdog = <&watchdog>,"status"; ++ random = <&random>,"status"; ++ sd_overclock = <&mmc>,"brcm,overclock-50:0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/bcm2708.dtsi b/arch/arm/boot/dts/bcm2708.dtsi +new file mode 100644 +index 0000000..f5a44cd +--- /dev/null ++++ b/arch/arm/boot/dts/bcm2708.dtsi +@@ -0,0 +1,40 @@ ++#include "bcm2708_common.dtsi" ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ model = "BCM2708"; ++ ++ chosen { ++ /* No padding required - the boot loader can do that. */ ++ bootargs = ""; ++ }; ++ ++ soc { ++ ranges = <0x7e000000 0x20000000 0x01000000>; ++ ++ timer@7e003000 { ++ compatible = "brcm,bcm2835-system-timer"; ++ reg = <0x7e003000 0x1000>; ++ interrupts = <1 0>, <1 1>, <1 2>, <1 3>; ++ clock-frequency = <1000000>; ++ }; ++ ++ arm-pmu { ++ compatible = "arm,arm1176-pmu"; ++ }; ++ ++ gpiomem { ++ compatible = "brcm,bcm2835-gpiomem"; ++ reg = <0x7e200000 0x1000>; ++ status = "okay"; ++ }; ++ }; ++}; ++ ++&intc { ++ compatible = "brcm,bcm2835-armctrl-ic"; ++}; ++ ++&watchdog { ++ status = "okay"; ++}; +diff --git a/arch/arm/boot/dts/bcm2708_common.dtsi b/arch/arm/boot/dts/bcm2708_common.dtsi +new file mode 100644 +index 0000000..6ea37c5 +--- /dev/null ++++ b/arch/arm/boot/dts/bcm2708_common.dtsi +@@ -0,0 +1,438 @@ ++#include "dt-bindings/clock/bcm2835.h" ++#include <dt-bindings/clock/bcm2835-aux.h> ++#include "dt-bindings/power/raspberrypi-power.h" ++#include "dt-bindings/gpio/gpio.h" ++#include "skeleton.dtsi" ++ ++/ { ++ interrupt-parent = <&intc>; ++ ++ aliases { ++ audio = &audio; ++ aux = &aux; ++ sound = &sound; ++ soc = &soc; ++ dma = &dma; ++ intc = &intc; ++ watchdog = &watchdog; ++ random = &random; ++ mailbox = &mailbox; ++ gpio = &gpio; ++ uart0 = &uart0; ++ sdhost = &sdhost; ++ i2s = &i2s; ++ spi0 = &spi0; ++ i2c0 = &i2c0; ++ uart1 = &uart1; ++ spi1 = &spi1; ++ spi2 = &spi2; ++ mmc = &mmc; ++ i2c1 = &i2c1; ++ i2c2 = &i2c2; ++ usb = &usb; ++ leds = &leds; ++ fb = &fb; ++ vchiq = &vchiq; ++ thermal = &thermal; ++ clocks = &clocks; ++ }; ++ ++ soc: soc { ++ compatible = "simple-bus"; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ++ dma: dma@7e007000 { ++ compatible = "brcm,bcm2835-dma"; ++ reg = <0x7e007000 0xf00>; ++ interrupts = <1 16>, ++ <1 17>, ++ <1 18>, ++ <1 19>, ++ <1 20>, ++ <1 21>, ++ <1 22>, ++ <1 23>, ++ <1 24>, ++ <1 25>, ++ <1 26>, ++ <1 27>; ++ ++ #dma-cells = <1>; ++ brcm,dma-channel-mask = <0x0f35>; ++ }; ++ ++ intc: interrupt-controller@7e00b200 { ++ compatible = "brcm,bcm2708-armctrl-ic"; ++ reg = <0x7e00b200 0x200>; ++ interrupt-controller; ++ #interrupt-cells = <2>; ++ }; ++ ++ mailbox: mailbox@7e00b800 { ++ compatible = "brcm,bcm2835-mbox"; ++ reg = <0x7e00b880 0x40>; ++ interrupts = <0 1>; ++ #mbox-cells = <0>; ++ }; ++ ++ watchdog: watchdog@7e100000 { ++ compatible = "brcm,bcm2835-pm-wdt"; ++ reg = <0x7e100000 0x28>; ++ status = "disabled"; ++ }; ++ ++ cprman: cprman@7e101000 { ++ compatible = "brcm,bcm2835-cprman"; ++ #clock-cells = <1>; ++ reg = <0x7e101000 0x2000>; ++ ++ /* CPRMAN derives everything from the platform's ++ * oscillator. ++ */ ++ clocks = <&clk_osc>; ++ status = "disabled"; ++ }; ++ ++ random: rng@7e104000 { ++ compatible = "brcm,bcm2835-rng"; ++ reg = <0x7e104000 0x10>; ++ status = "disabled"; ++ }; ++ ++ gpio: gpio@7e200000 { ++ compatible = "brcm,bcm2835-gpio"; ++ reg = <0x7e200000 0xb4>; ++ interrupts = <2 17>, <2 18>; ++ ++ gpio-controller; ++ #gpio-cells = <2>; ++ ++ interrupt-controller; ++ #interrupt-cells = <2>; ++ }; ++ ++ uart0: uart@7e201000 { ++ compatible = "arm,pl011", "arm,primecell"; ++ reg = <0x7e201000 0x1000>; ++ interrupts = <2 25>; ++ clocks = <&clk_uart0 &clk_apb_p>; ++ clock-names = "uartclk","apb_pclk"; ++ arm,primecell-periphid = <0x00241011>; // For an explanation, see ++ // https://github.com/raspberrypi/linux/commit/13731d862cf5219216533a3b0de052cee4cc5038 ++ status = "disabled"; ++ }; ++ ++ sdhost: sdhost@7e202000 { ++ compatible = "brcm,bcm2835-sdhost"; ++ reg = <0x7e202000 0x100>; ++ interrupts = <2 24>; ++ clocks = <&clk_core>; ++ dmas = <&dma 13>; ++ dma-names = "rx-tx"; ++ brcm,overclock-50 = <0>; ++ brcm,pio-limit = <1>; ++ status = "disabled"; ++ }; ++ ++ i2s: i2s@7e203000 { ++ compatible = "brcm,bcm2835-i2s"; ++ #sound-dai-cells = <0>; ++ reg = <0x7e203000 0x24>, ++ <0x7e101098 0x08>; ++ ++ dmas = <&dma 2>, <&dma 3>; ++ dma-names = "tx", "rx"; ++ status = "disabled"; ++ }; ++ ++ spi0: spi@7e204000 { ++ compatible = "brcm,bcm2835-spi"; ++ reg = <0x7e204000 0x1000>; ++ interrupts = <2 22>; ++ clocks = <&clk_core>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "disabled"; ++ /* the dma channels */ ++ dmas = <&dma 6>, <&dma 7>; ++ dma-names = "tx", "rx"; ++ /* the chipselects used - <0> means native GPIO ++ * add more gpios if necessary as <&gpio 6 1> ++ * (but do not forget to make them output!) ++ */ ++ cs-gpios = <0>, <0>; ++ }; ++ ++ i2c0: i2c@7e205000 { ++ compatible = "brcm,bcm2708-i2c"; ++ reg = <0x7e205000 0x1000>; ++ interrupts = <2 21>; ++ clocks = <&clk_core>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "disabled"; ++ }; ++ ++ pixelvalve0: pixelvalve@7e206000 { ++ compatible = "brcm,bcm2835-pixelvalve0"; ++ reg = <0x7e206000 0x100>; ++ status = "disabled"; ++ }; ++ ++ pixelvalve1: pixelvalve@7e207000 { ++ compatible = "brcm,bcm2835-pixelvalve1"; ++ reg = <0x7e207000 0x100>; ++ status = "disabled"; ++ }; ++ ++ pwm: pwm@7e20c000 { ++ compatible = "brcm,bcm2835-pwm"; ++ reg = <0x7e20c000 0x28>; ++ clocks = <&clk_pwm>; ++ #pwm-cells = <2>; ++ status = "disabled"; ++ }; ++ ++ aux: aux@0x7e215004 { ++ compatible = "brcm,bcm2835-aux"; ++ #clock-cells = <1>; ++ reg = <0x7e215000 0x8>; ++ clocks = <&clk_core>; ++ status = "disabled"; ++ }; ++ ++ uart1: uart@7e215040 { ++ compatible = "brcm,bcm2835-aux-uart", "ns16550"; ++ reg = <0x7e215040 0x40>; ++ interrupts = <1 29>; ++ clocks = <&clk_uart1>; ++ reg-shift = <2>; ++ no-loopback-test; ++ status = "disabled"; ++ }; ++ ++ spi1: spi@7e215080 { ++ compatible = "brcm,bcm2835-aux-spi"; ++ reg = <0x7e215080 0x40>, <0x7e215000 0x8>; ++ interrupts = <1 29>; ++ clocks = <&aux BCM2835_AUX_CLOCK_SPI1>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "disabled"; ++ }; ++ ++ spi2: spi@7e2150C0 { ++ compatible = "brcm,bcm2835-aux-spi"; ++ reg = <0x7e2150C0 0x40>, <0x7e215000 0x8>; ++ interrupts = <1 29>; ++ clocks = <&aux BCM2835_AUX_CLOCK_SPI2>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "disabled"; ++ }; ++ ++ mmc: mmc@7e300000 { ++ compatible = "brcm,bcm2835-mmc"; ++ reg = <0x7e300000 0x100>; ++ interrupts = <2 30>; ++ clocks = <&clk_mmc>; ++ dmas = <&dma 11>; ++ dma-names = "rx-tx"; ++ brcm,overclock-50 = <0>; ++ status = "disabled"; ++ }; ++ ++ hvs: hvs@7e400000 { ++ compatible = "brcm,bcm2835-hvs"; ++ reg = <0x7e400000 0x6000>; ++ status = "disabled"; ++ }; ++ ++ i2c1: i2c@7e804000 { ++ compatible = "brcm,bcm2708-i2c"; ++ reg = <0x7e804000 0x1000>; ++ interrupts = <2 21>; ++ clocks = <&clk_core>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "disabled"; ++ }; ++ ++ i2c2: i2c@7e805000 { ++ // Beware - this is shared with the HDMI module. ++ // Careless use may break (really) your display. ++ // Caveat emptor. ++ compatible = "brcm,bcm2708-i2c"; ++ reg = <0x7e805000 0x1000>; ++ interrupts = <2 21>; ++ clocks = <&clk_core>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "disabled"; ++ }; ++ ++ smi: smi@7e600000 { ++ compatible = "brcm,bcm2835-smi"; ++ reg = <0x7e600000 0x44>, <0x7e1010b0 0x8>; ++ interrupts = <2 16>; ++ brcm,smi-clock-source = <6>; ++ brcm,smi-clock-divisor = <4>; ++ dmas = <&dma 4>; ++ dma-names = "rx-tx"; ++ status = "disabled"; ++ }; ++ ++ pixelvalve2: pixelvalve@7e807000 { ++ compatible = "brcm,bcm2835-pixelvalve2"; ++ reg = <0x7e807000 0x100>; ++ status = "disabled"; ++ }; ++ ++ hdmi: hdmi@7e902000 { ++ compatible = "brcm,bcm2835-hdmi"; ++ reg = <0x7e902000 0x600>, ++ <0x7e808000 0x100>; ++ ddc = <&i2c2>; ++ hpd-gpios = <&gpio 46 GPIO_ACTIVE_HIGH>; ++ clocks = <&cprman BCM2835_PLLH_PIX>, ++ <&cprman BCM2835_CLOCK_HSM>; ++ clock-names = "pixel", "hdmi"; ++ power-domains = <&power RPI_POWER_DOMAIN_HDMI>; ++ status = "disabled"; ++ }; ++ ++ usb: usb@7e980000 { ++ compatible = "brcm,bcm2708-usb"; ++ reg = <0x7e980000 0x10000>, ++ <0x7e006000 0x1000>; ++ interrupts = <2 0>, ++ <1 9>; ++ }; ++ ++ v3d: v3d@7ec00000 { ++ compatible = "brcm,vc4-v3d"; ++ reg = <0x7ec00000 0x1000>; ++ status = "disabled"; ++ }; ++ ++ firmware: firmware { ++ compatible = "raspberrypi,bcm2835-firmware"; ++ mboxes = <&mailbox>; ++ }; ++ ++ power: power { ++ compatible = "raspberrypi,bcm2835-power"; ++ firmware = <&firmware>; ++ #power-domain-cells = <1>; ++ }; ++ ++ leds: leds { ++ compatible = "gpio-leds"; ++ }; ++ ++ fb: fb { ++ compatible = "brcm,bcm2708-fb"; ++ firmware = <&firmware>; ++ status = "disabled"; ++ }; ++ ++ vchiq: vchiq { ++ compatible = "brcm,bcm2835-vchiq"; ++ reg = <0x7e00b840 0xf>; ++ interrupts = <0 2>; ++ cache-line-size = <32>; ++ firmware = <&firmware>; ++ }; ++ ++ thermal: thermal { ++ compatible = "brcm,bcm2835-thermal"; ++ firmware = <&firmware>; ++ }; ++ ++ gpu: gpu { ++ compatible = "brcm,bcm2835-vc4"; ++ status = "disabled"; ++ }; ++ ++ /* Onboard audio */ ++ audio: audio { ++ compatible = "brcm,bcm2835-audio"; ++ brcm,pwm-channels = <8>; ++ status = "disabled"; ++ }; ++ ++ /* External sound card */ ++ sound: sound { ++ status = "disabled"; ++ }; ++ }; ++ ++ clocks: clocks { ++ compatible = "simple-bus"; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ clk_core: clock@0 { ++ compatible = "fixed-clock"; ++ reg = <0>; ++ #clock-cells = <0>; ++ clock-output-names = "core"; ++ clock-frequency = <250000000>; ++ }; ++ ++ clk_mmc: clock@1 { ++ compatible = "fixed-clock"; ++ reg = <1>; ++ #clock-cells = <0>; ++ clock-output-names = "mmc"; ++ clock-frequency = <250000000>; ++ }; ++ ++ clk_uart0: clock@2 { ++ compatible = "fixed-clock"; ++ reg = <2>; ++ #clock-cells = <0>; ++ clock-output-names = "uart0_pclk"; ++ clock-frequency = <3000000>; ++ }; ++ ++ clk_apb_p: clock@3 { ++ compatible = "fixed-clock"; ++ reg = <3>; ++ #clock-cells = <0>; ++ clock-output-names = "apb_pclk"; ++ clock-frequency = <126000000>; ++ }; ++ ++ clk_pwm: clock@4 { ++ compatible = "fixed-clock"; ++ reg = <4>; ++ #clock-cells = <0>; ++ clock-output-names = "pwm"; ++ clock-frequency = <100000000>; ++ }; ++ ++ clk_uart1: clock@5 { ++ compatible = "fixed-factor-clock"; ++ reg = <5>; ++ clocks = <&clk_core>; ++ #clock-cells = <0>; ++ clock-div = <1>; ++ clock-mult = <2>; ++ }; ++ ++ /* The oscillator is the root of the clock tree. */ ++ clk_osc: clock@6 { ++ compatible = "fixed-clock"; ++ reg = <6>; ++ #clock-cells = <0>; ++ clock-output-names = "osc"; ++ clock-frequency = <19200000>; ++ }; ++ }; ++ ++ __overrides__ { ++ cache_line_size = <&vchiq>, "cache-line-size:0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/bcm2709-rpi-2-b.dts b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts +new file mode 100644 +index 0000000..5e23c04 +--- /dev/null ++++ b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts +@@ -0,0 +1,154 @@ ++/dts-v1/; ++ ++#include "bcm2709.dtsi" ++ ++/ { ++ compatible = "brcm,bcm2709"; ++ model = "Raspberry Pi 2 Model B"; ++}; ++ ++&gpio { ++ sdhost_pins: sdhost_pins { ++ brcm,pins = <48 49 50 51 52 53>; ++ brcm,function = <4>; /* alt0 */ ++ }; ++ ++ spi0_pins: spi0_pins { ++ brcm,pins = <9 10 11>; ++ brcm,function = <4>; /* alt0 */ ++ }; ++ ++ spi0_cs_pins: spi0_cs_pins { ++ brcm,pins = <8 7>; ++ brcm,function = <1>; /* output */ ++ }; ++ ++ i2c0_pins: i2c0 { ++ brcm,pins = <0 1>; ++ brcm,function = <4>; ++ }; ++ ++ i2c1_pins: i2c1 { ++ brcm,pins = <2 3>; ++ brcm,function = <4>; ++ }; ++ ++ i2s_pins: i2s { ++ brcm,pins = <18 19 20 21>; ++ brcm,function = <4>; /* alt0 */ ++ }; ++}; ++ ++&sdhost { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&sdhost_pins>; ++ bus-width = <4>; ++ status = "okay"; ++}; ++ ++&fb { ++ status = "okay"; ++}; ++ ++&uart0 { ++ status = "okay"; ++}; ++ ++&spi0 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&spi0_pins &spi0_cs_pins>; ++ cs-gpios = <&gpio 8 1>, <&gpio 7 1>; ++ ++ spidev0: spidev@0{ ++ compatible = "spidev"; ++ reg = <0>; /* CE0 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ }; ++ ++ spidev1: spidev@1{ ++ compatible = "spidev"; ++ reg = <1>; /* CE1 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ }; ++}; ++ ++&i2c0 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2c0_pins>; ++ clock-frequency = <100000>; ++}; ++ ++&i2c1 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2c1_pins>; ++ clock-frequency = <100000>; ++}; ++ ++&i2c2 { ++ clock-frequency = <100000>; ++}; ++ ++&i2s { ++ #sound-dai-cells = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2s_pins>; ++}; ++ ++&random { ++ status = "okay"; ++}; ++ ++&leds { ++ act_led: act { ++ label = "led0"; ++ linux,default-trigger = "mmc0"; ++ gpios = <&gpio 47 0>; ++ }; ++ ++ pwr_led: pwr { ++ label = "led1"; ++ linux,default-trigger = "input"; ++ gpios = <&gpio 35 0>; ++ }; ++}; ++ ++&hdmi { ++ hpd-gpios = <&gpio 46 GPIO_ACTIVE_LOW>; ++}; ++ ++/ { ++ __overrides__ { ++ uart0 = <&uart0>,"status"; ++ uart0_clkrate = <&clk_uart0>,"clock-frequency:0"; ++ uart1 = <&uart1>,"status"; ++ i2s = <&i2s>,"status"; ++ spi = <&spi0>,"status"; ++ i2c0 = <&i2c0>,"status"; ++ i2c1 = <&i2c1>,"status"; ++ i2c2_iknowwhatimdoing = <&i2c2>,"status"; ++ i2c0_baudrate = <&i2c0>,"clock-frequency:0"; ++ i2c1_baudrate = <&i2c1>,"clock-frequency:0"; ++ i2c2_baudrate = <&i2c2>,"clock-frequency:0"; ++ core_freq = <&clk_core>,"clock-frequency:0"; ++ ++ act_led_gpio = <&act_led>,"gpios:4"; ++ act_led_activelow = <&act_led>,"gpios:8"; ++ act_led_trigger = <&act_led>,"linux,default-trigger"; ++ ++ pwr_led_gpio = <&pwr_led>,"gpios:4"; ++ pwr_led_activelow = <&pwr_led>,"gpios:8"; ++ pwr_led_trigger = <&pwr_led>,"linux,default-trigger"; ++ ++ audio = <&audio>,"status"; ++ watchdog = <&watchdog>,"status"; ++ random = <&random>,"status"; ++ sd_overclock = <&sdhost>,"brcm,overclock-50:0"; ++ sd_force_pio = <&sdhost>,"brcm,force-pio?"; ++ sd_pio_limit = <&sdhost>,"brcm,pio-limit:0"; ++ sd_debug = <&sdhost>,"brcm,debug"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/bcm2709.dtsi b/arch/arm/boot/dts/bcm2709.dtsi +new file mode 100644 +index 0000000..a8cfd7c +--- /dev/null ++++ b/arch/arm/boot/dts/bcm2709.dtsi +@@ -0,0 +1,102 @@ ++#include "bcm2708_common.dtsi" ++ ++/ { ++ compatible = "brcm,bcm2709"; ++ model = "BCM2709"; ++ ++ chosen { ++ /* No padding required - the boot loader can do that. */ ++ bootargs = ""; ++ }; ++ ++ soc { ++ ranges = <0x7e000000 0x3f000000 0x01000000>, ++ <0x40000000 0x40000000 0x00040000>; ++ ++ local_intc: local_intc { ++ compatible = "brcm,bcm2836-l1-intc"; ++ reg = <0x40000000 0x100>; ++ interrupt-controller; ++ #interrupt-cells = <1>; ++ interrupt-parent = <&local_intc>; ++ }; ++ ++ arm-pmu { ++ compatible = "arm,cortex-a7-pmu"; ++ interrupt-parent = <&local_intc>; ++ interrupts = <9>; ++ }; ++ ++ gpiomem { ++ compatible = "brcm,bcm2835-gpiomem"; ++ reg = <0x7e200000 0x1000>; ++ status = "okay"; ++ }; ++ ++ timer { ++ compatible = "arm,armv7-timer"; ++ clock-frequency = <19200000>; ++ interrupt-parent = <&local_intc>; ++ interrupts = <0>, // PHYS_SECURE_PPI ++ <1>, // PHYS_NONSECURE_PPI ++ <3>, // VIRT_PPI ++ <2>; // HYP_PPI ++ always-on; ++ }; ++ ++ syscon@40000000 { ++ compatible = "brcm,bcm2836-arm-local", "syscon"; ++ reg = <0x40000000 0x100>; ++ }; ++ }; ++ ++ cpus: cpus { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ v7_cpu0: cpu@0 { ++ device_type = "cpu"; ++ compatible = "arm,cortex-a7"; ++ reg = <0xf00>; ++ clock-frequency = <800000000>; ++ }; ++ ++ v7_cpu1: cpu@1 { ++ device_type = "cpu"; ++ compatible = "arm,cortex-a7"; ++ reg = <0xf01>; ++ clock-frequency = <800000000>; ++ }; ++ ++ v7_cpu2: cpu@2 { ++ device_type = "cpu"; ++ compatible = "arm,cortex-a7"; ++ reg = <0xf02>; ++ clock-frequency = <800000000>; ++ }; ++ ++ v7_cpu3: cpu@3 { ++ device_type = "cpu"; ++ compatible = "arm,cortex-a7"; ++ reg = <0xf03>; ++ clock-frequency = <800000000>; ++ }; ++ }; ++ ++ __overrides__ { ++ arm_freq = <&v7_cpu0>, "clock-frequency:0", ++ <&v7_cpu1>, "clock-frequency:0", ++ <&v7_cpu2>, "clock-frequency:0", ++ <&v7_cpu3>, "clock-frequency:0"; ++ }; ++}; ++ ++&watchdog { ++ status = "okay"; ++}; ++ ++&intc { ++ compatible = "brcm,bcm2836-armctrl-ic"; ++ interrupt-parent = <&local_intc>; ++ interrupts = <8>; ++}; +diff --git a/arch/arm/boot/dts/bcm2710-rpi-3-b.dts b/arch/arm/boot/dts/bcm2710-rpi-3-b.dts +new file mode 100644 +index 0000000..0979a27 +--- /dev/null ++++ b/arch/arm/boot/dts/bcm2710-rpi-3-b.dts +@@ -0,0 +1,201 @@ ++/dts-v1/; ++ ++#include "bcm2710.dtsi" ++ ++/ { ++ compatible = "brcm,bcm2710","brcm,bcm2709"; ++ model = "Raspberry Pi 3 Model B"; ++}; ++ ++&gpio { ++ sdhost_pins: sdhost_pins { ++ brcm,pins = <48 49 50 51 52 53>; ++ brcm,function = <4>; /* alt0 */ ++ }; ++ ++ spi0_pins: spi0_pins { ++ brcm,pins = <9 10 11>; ++ brcm,function = <4>; /* alt0 */ ++ }; ++ ++ spi0_cs_pins: spi0_cs_pins { ++ brcm,pins = <8 7>; ++ brcm,function = <1>; /* output */ ++ }; ++ ++ i2c0_pins: i2c0 { ++ brcm,pins = <0 1>; ++ brcm,function = <4>; ++ }; ++ ++ i2c1_pins: i2c1 { ++ brcm,pins = <2 3>; ++ brcm,function = <4>; ++ }; ++ ++ i2s_pins: i2s { ++ brcm,pins = <18 19 20 21>; ++ brcm,function = <4>; /* alt0 */ ++ }; ++ ++ sdio_pins: sdio_pins { ++ brcm,pins = <34 35 36 37 38 39>; ++ brcm,function = <7>; // alt3 = SD1 ++ brcm,pull = <0 2 2 2 2 2>; ++ }; ++ ++ bt_pins: bt_pins { ++ brcm,pins = <43>; ++ brcm,function = <4>; /* alt0:GPCLK2 */ ++ brcm,pull = <0>; ++ }; ++ ++ uart0_pins: uart0_pins { ++ brcm,pins = <32 33>; ++ brcm,function = <7>; /* alt3=UART0 */ ++ brcm,pull = <0 2>; ++ }; ++ ++ uart1_pins: uart1_pins { ++ brcm,pins; ++ brcm,function; ++ brcm,pull; ++ }; ++}; ++ ++&sdhost { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&sdhost_pins>; ++ bus-width = <4>; ++ status = "okay"; ++}; ++ ++&mmc { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&sdio_pins>; ++ non-removable; ++ bus-width = <4>; ++ status = "okay"; ++ brcm,overclock-50 = <0>; ++}; ++ ++&soc { ++ virtgpio: virtgpio { ++ compatible = "brcm,bcm2835-virtgpio"; ++ gpio-controller; ++ #gpio-cells = <2>; ++ firmware = <&firmware>; ++ status = "okay"; ++ }; ++}; ++ ++&fb { ++ status = "okay"; ++}; ++ ++&uart0 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&uart0_pins &bt_pins>; ++ status = "okay"; ++}; ++ ++&uart1 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&uart1_pins>; ++ status = "okay"; ++}; ++ ++&spi0 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&spi0_pins &spi0_cs_pins>; ++ cs-gpios = <&gpio 8 1>, <&gpio 7 1>; ++ ++ spidev0: spidev@0{ ++ compatible = "spidev"; ++ reg = <0>; /* CE0 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ }; ++ ++ spidev1: spidev@1{ ++ compatible = "spidev"; ++ reg = <1>; /* CE1 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ }; ++}; ++ ++&i2c0 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2c0_pins>; ++ clock-frequency = <100000>; ++}; ++ ++&i2c1 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2c1_pins>; ++ clock-frequency = <100000>; ++}; ++ ++&i2c2 { ++ clock-frequency = <100000>; ++}; ++ ++&i2s { ++ #sound-dai-cells = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2s_pins>; ++}; ++ ++&random { ++ status = "okay"; ++}; ++ ++&leds { ++ act_led: act { ++ label = "led0"; ++ linux,default-trigger = "mmc0"; ++ gpios = <&virtgpio 0 0>; ++ }; ++}; ++ ++&hdmi { ++ hpd-gpios = <&gpio 46 GPIO_ACTIVE_LOW>; ++}; ++ ++/ { ++ chosen { ++ bootargs = "8250.nr_uarts=1"; ++ }; ++}; ++ ++/ { ++ __overrides__ { ++ uart0 = <&uart0>,"status"; ++ uart0_clkrate = <&clk_uart0>,"clock-frequency:0"; ++ uart1 = <&uart1>,"status"; ++ i2s = <&i2s>,"status"; ++ spi = <&spi0>,"status"; ++ i2c0 = <&i2c0>,"status"; ++ i2c1 = <&i2c1>,"status"; ++ i2c2_iknowwhatimdoing = <&i2c2>,"status"; ++ i2c0_baudrate = <&i2c0>,"clock-frequency:0"; ++ i2c1_baudrate = <&i2c1>,"clock-frequency:0"; ++ i2c2_baudrate = <&i2c2>,"clock-frequency:0"; ++ core_freq = <&clk_core>,"clock-frequency:0"; ++ ++ act_led_gpio = <&act_led>,"gpios:4"; ++ act_led_activelow = <&act_led>,"gpios:8"; ++ act_led_trigger = <&act_led>,"linux,default-trigger"; ++ ++ audio = <&audio>,"status"; ++ watchdog = <&watchdog>,"status"; ++ random = <&random>,"status"; ++ sd_overclock = <&sdhost>,"brcm,overclock-50:0"; ++ sd_force_pio = <&sdhost>,"brcm,force-pio?"; ++ sd_pio_limit = <&sdhost>,"brcm,pio-limit:0"; ++ sd_debug = <&sdhost>,"brcm,debug"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/bcm2710.dtsi b/arch/arm/boot/dts/bcm2710.dtsi +new file mode 100644 +index 0000000..1a48686 +--- /dev/null ++++ b/arch/arm/boot/dts/bcm2710.dtsi +@@ -0,0 +1,102 @@ ++#include "bcm2708_common.dtsi" ++ ++/ { ++ compatible = "brcm,bcm2710","brcm,bcm2709"; ++ model = "BCM2710"; ++ ++ chosen { ++ /* No padding required - the boot loader can do that. */ ++ bootargs = ""; ++ }; ++ ++ soc { ++ ranges = <0x7e000000 0x3f000000 0x01000000>, ++ <0x40000000 0x40000000 0x00040000>; ++ ++ local_intc: local_intc { ++ compatible = "brcm,bcm2836-l1-intc"; ++ reg = <0x40000000 0x100>; ++ interrupt-controller; ++ #interrupt-cells = <1>; ++ interrupt-parent = <&local_intc>; ++ }; ++ ++ arm-pmu { ++ compatible = "arm,cortex-a7-pmu"; ++ interrupt-parent = <&local_intc>; ++ interrupts = <9>; ++ }; ++ ++ gpiomem { ++ compatible = "brcm,bcm2835-gpiomem"; ++ reg = <0x7e200000 0x1000>; ++ status = "okay"; ++ }; ++ ++ timer { ++ compatible = "arm,armv7-timer"; ++ clock-frequency = <19200000>; ++ interrupt-parent = <&local_intc>; ++ interrupts = <0>, // PHYS_SECURE_PPI ++ <1>, // PHYS_NONSECURE_PPI ++ <3>, // VIRT_PPI ++ <2>; // HYP_PPI ++ always-on; ++ }; ++ ++ syscon@40000000 { ++ compatible = "brcm,bcm2836-arm-local", "syscon"; ++ reg = <0x40000000 0x100>; ++ }; ++ }; ++ ++ cpus: cpus { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ v7_cpu0: cpu@0 { ++ device_type = "cpu"; ++ compatible = "arm,cortex-a7"; ++ reg = <0x000>; ++ clock-frequency = <800000000>; ++ }; ++ ++ v7_cpu1: cpu@1 { ++ device_type = "cpu"; ++ compatible = "arm,cortex-a7"; ++ reg = <0x001>; ++ clock-frequency = <800000000>; ++ }; ++ ++ v7_cpu2: cpu@2 { ++ device_type = "cpu"; ++ compatible = "arm,cortex-a7"; ++ reg = <0x002>; ++ clock-frequency = <800000000>; ++ }; ++ ++ v7_cpu3: cpu@3 { ++ device_type = "cpu"; ++ compatible = "arm,cortex-a7"; ++ reg = <0x003>; ++ clock-frequency = <800000000>; ++ }; ++ }; ++ ++ __overrides__ { ++ arm_freq = <&v7_cpu0>, "clock-frequency:0", ++ <&v7_cpu1>, "clock-frequency:0", ++ <&v7_cpu2>, "clock-frequency:0", ++ <&v7_cpu3>, "clock-frequency:0"; ++ }; ++}; ++ ++&watchdog { ++ status = "okay"; ++}; ++ ++&intc { ++ compatible = "brcm,bcm2836-armctrl-ic"; ++ interrupt-parent = <&local_intc>; ++ interrupts = <8>; ++}; +diff --git a/arch/arm/boot/dts/bcm2835-rpi-cm.dts b/arch/arm/boot/dts/bcm2835-rpi-cm.dts +new file mode 100644 +index 0000000..c6e6860 +--- /dev/null ++++ b/arch/arm/boot/dts/bcm2835-rpi-cm.dts +@@ -0,0 +1,93 @@ ++/dts-v1/; ++ ++#include "bcm2835-rpi-cm.dtsi" ++ ++/ { ++ model = "Raspberry Pi Compute Module"; ++}; ++ ++&uart0 { ++ status = "okay"; ++}; ++ ++&gpio { ++ spi0_pins: spi0_pins { ++ brcm,pins = <7 8 9 10 11>; ++ brcm,function = <4>; /* alt0 */ ++ }; ++ ++ i2c0_pins: i2c0 { ++ brcm,pins = <0 1>; ++ brcm,function = <4>; ++ }; ++ ++ i2c1_pins: i2c1 { ++ brcm,pins = <2 3>; ++ brcm,function = <4>; ++ }; ++ ++ i2s_pins: i2s { ++ brcm,pins = <18 19 20 21>; ++ brcm,function = <4>; /* alt0 */ ++ }; ++}; ++ ++&spi0 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&spi0_pins>; ++ ++ spidev@0{ ++ compatible = "spidev"; ++ reg = <0>; /* CE0 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ }; ++ ++ spidev@1{ ++ compatible = "spidev"; ++ reg = <1>; /* CE1 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ }; ++}; ++ ++&i2c0 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2c0_pins>; ++ clock-frequency = <100000>; ++}; ++ ++&i2c1 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2c1_pins>; ++ clock-frequency = <100000>; ++}; ++ ++&i2c2 { ++ clock-frequency = <100000>; ++}; ++ ++&i2s { ++ #sound-dai-cells = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2s_pins>; ++}; ++ ++/ { ++ __overrides__ { ++ uart0 = <&uart0>,"status"; ++ uart0_clkrate = <&clk_uart0>,"clock-frequency:0"; ++ uart1_clkrate = <&uart1>,"clock-frequency:0"; ++ i2s = <&i2s>,"status"; ++ spi = <&spi0>,"status"; ++ i2c0 = <&i2c0>,"status"; ++ i2c1 = <&i2c1>,"status"; ++ i2c2_iknowwhatimdoing = <&i2c2>,"status"; ++ i2c0_baudrate = <&i2c0>,"clock-frequency:0"; ++ i2c1_baudrate = <&i2c1>,"clock-frequency:0"; ++ i2c2_baudrate = <&i2c2>,"clock-frequency:0"; ++ core_freq = <&clk_core>,"clock-frequency:0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/bcm2835-rpi-cm.dtsi b/arch/arm/boot/dts/bcm2835-rpi-cm.dtsi +new file mode 100644 +index 0000000..9c4000f +--- /dev/null ++++ b/arch/arm/boot/dts/bcm2835-rpi-cm.dtsi +@@ -0,0 +1,30 @@ ++#include "bcm2835.dtsi" ++ ++&leds { ++ act_led: act { ++ label = "led0"; ++ linux,default-trigger = "mmc0"; ++ gpios = <&gpio 47 0>; ++ }; ++}; ++ ++&mmc { ++ status = "okay"; ++ bus-width = <4>; ++}; ++ ++&fb { ++ status = "okay"; ++}; ++ ++/ { ++ __overrides__ { ++ act_led_gpio = <&act_led>,"gpios:4"; ++ act_led_activelow = <&act_led>,"gpios:8"; ++ act_led_trigger = <&act_led>,"linux,default-trigger"; ++ ++ audio = <&audio>,"status"; ++ watchdog = <&watchdog>,"status"; ++ random = <&random>,"status"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/Makefile b/arch/arm/boot/dts/overlays/Makefile +new file mode 100644 +index 0000000..0adb5b9 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/Makefile +@@ -0,0 +1,99 @@ ++ifeq ($(CONFIG_OF),y) ++ ++# Overlays for the Raspberry Pi platform ++ ++ifeq ($(CONFIG_ARCH_BCM2708),y) ++ RPI_DT_OVERLAYS=y ++endif ++ifeq ($(CONFIG_ARCH_BCM2709),y) ++ RPI_DT_OVERLAYS=y ++endif ++ifeq ($(CONFIG_ARCH_BCM2835),y) ++ RPI_DT_OVERLAYS=y ++endif ++ ++dtbo-$(RPI_DT_OVERLAYS) += adau1977-adc.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += ads7846.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += akkordion-iqdacplus.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += at86rf233.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += audioinjector-wm8731-audio.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += bmp085_i2c-sensor.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += dpi24.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += dwc2.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += dwc-otg.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += dht11.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += enc28j60.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += gpio-ir.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += gpio-poweroff.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += hifiberry-amp.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += hifiberry-dac.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += hifiberry-dacplus.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += hifiberry-digi.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += hy28a.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += hy28b.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += i2c-rtc.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += i2c-gpio.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += i2c-mux.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += i2c-pwm-pca9685a.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += i2c0-bcm2708.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += i2c1-bcm2708.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += i2s-gpio28-31.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += i2s-mmap.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += iqaudio-dac.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += iqaudio-dacplus.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += justboom-dac.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += justboom-digi.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += lirc-rpi.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += mcp2515-can0.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += mcp2515-can1.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += mmc.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += mz61581.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += pi3-act-led.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += pi3-disable-bt.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += pi3-miniuart-bt.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += piscreen.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += piscreen2r.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += pitft22.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += pitft28-capacitive.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += pitft28-resistive.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += pps-gpio.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += pwm.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += pwm-2chan.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += qca7000.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += raspidac3.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += rpi-backlight.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += rpi-dac.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += rpi-display.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += rpi-ft5406.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += rpi-proto.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += rpi-sense.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += rra-digidac1-wm8741-audio.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += sdhost.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += sdio.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += sdio-1bit.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += sdtweak.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += smi-dev.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += smi-nand.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += smi.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += spi1-1cs.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += spi1-2cs.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += spi1-3cs.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += spi2-1cs.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += spi2-2cs.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += spi2-3cs.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += spi-gpio35-39.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += tinylcd35.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += uart1.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += vc4-kms-v3d.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += vga666.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += w1-gpio.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += w1-gpio-pullup.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += wittypi.dtbo ++ ++targets += dtbs dtbs_install ++targets += $(dtbo-y) ++ ++endif ++ ++always := $(dtbo-y) ++clean-files := *.dtbo +diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README +new file mode 100644 +index 0000000..1516cc2 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/README +@@ -0,0 +1,1161 @@ ++Introduction ++============ ++ ++This directory contains Device Tree overlays. Device Tree makes it possible ++to support many hardware configurations with a single kernel and without the ++need to explicitly load or blacklist kernel modules. Note that this isn't a ++"pure" Device Tree configuration (c.f. MACH_BCM2835) - some on-board devices ++are still configured by the board support code, but the intention is to ++eventually reach that goal. ++ ++On Raspberry Pi, Device Tree usage is controlled from /boot/config.txt. By ++default, the Raspberry Pi kernel boots with device tree enabled. You can ++completely disable DT usage (for now) by adding: ++ ++ device_tree= ++ ++to your config.txt, which should cause your Pi to revert to the old way of ++doing things after a reboot. ++ ++In /boot you will find a .dtb for each base platform. This describes the ++hardware that is part of the Raspberry Pi board. The loader (start.elf and its ++siblings) selects the .dtb file appropriate for the platform by name, and reads ++it into memory. At this point, all of the optional interfaces (i2c, i2s, spi) ++are disabled, but they can be enabled using Device Tree parameters: ++ ++ dtparam=i2c=on,i2s=on,spi=on ++ ++However, this shouldn't be necessary in many use cases because loading an ++overlay that requires one of those interfaces will cause it to be enabled ++automatically, and it is advisable to only enable interfaces if they are ++needed. ++ ++Configuring additional, optional hardware is done using Device Tree overlays ++(see below). ++ ++raspi-config ++============ ++ ++The Advanced Options section of the raspi-config utility can enable and disable ++Device Tree use, as well as toggling the I2C and SPI interfaces. Note that it ++is possible to both enable an interface and blacklist the driver, if for some ++reason you should want to defer the loading. ++ ++Modules ++======= ++ ++As well as describing the hardware, Device Tree also gives enough information ++to allow suitable driver modules to be located and loaded, with the corollary ++that unneeded modules are not loaded. As a result it should be possible to ++remove lines from /etc/modules, and /etc/modprobe.d/raspi-blacklist.conf can ++have its contents deleted (or commented out). ++ ++Using Overlays ++============== ++ ++Overlays are loaded using the "dtoverlay" directive. As an example, consider ++the popular lirc-rpi module, the Linux Infrared Remote Control driver. In the ++pre-DT world this would be loaded from /etc/modules, with an explicit ++"modprobe lirc-rpi" command, or programmatically by lircd. With DT enabled, ++this becomes a line in config.txt: ++ ++ dtoverlay=lirc-rpi ++ ++This causes the file /boot/overlays/lirc-rpi-overlay.dtb to be loaded. By ++default it will use GPIOs 17 (out) and 18 (in), but this can be modified using ++DT parameters: ++ ++ dtoverlay=lirc-rpi,gpio_out_pin=17,gpio_in_pin=13 ++ ++Parameters always have default values, although in some cases (e.g. "w1-gpio") ++it is necessary to provided multiple overlays in order to get the desired ++behaviour. See the list of overlays below for a description of the parameters ++and their defaults. ++ ++The Overlay and Parameter Reference ++=================================== ++ ++N.B. When editing this file, please preserve the indentation levels to make it ++simple to parse programmatically. NO HARD TABS. ++ ++ ++Name: <The base DTB> ++Info: Configures the base Raspberry Pi hardware ++Load: <loaded automatically> ++Params: ++ audio Set to "on" to enable the onboard ALSA audio ++ interface (default "off") ++ ++ i2c_arm Set to "on" to enable the ARM's i2c interface ++ (default "off") ++ ++ i2c_vc Set to "on" to enable the i2c interface ++ usually reserved for the VideoCore processor ++ (default "off") ++ ++ i2c An alias for i2c_arm ++ ++ i2c_arm_baudrate Set the baudrate of the ARM's i2c interface ++ (default "100000") ++ ++ i2c_vc_baudrate Set the baudrate of the VideoCore i2c interface ++ (default "100000") ++ ++ i2c_baudrate An alias for i2c_arm_baudrate ++ ++ i2s Set to "on" to enable the i2s interface ++ (default "off") ++ ++ spi Set to "on" to enable the spi interfaces ++ (default "off") ++ ++ random Set to "on" to enable the hardware random ++ number generator (default "on") ++ ++ sd_overclock Clock (in MHz) to use when the MMC framework ++ requests 50MHz ++ ++ sd_force_pio Disable DMA support for SD driver (default off) ++ ++ sd_pio_limit Number of blocks above which to use DMA for ++ SD card (default 1) ++ ++ sd_debug Enable debug output from SD driver (default off) ++ ++ uart0 Set to "off" to disable uart0 (default "on") ++ ++ uart1 Set to "on" or "off" to enable or disable uart1 ++ (default varies) ++ ++ watchdog Set to "on" to enable the hardware watchdog ++ (default "off") ++ ++ act_led_trigger Choose which activity the LED tracks. ++ Use "heartbeat" for a nice load indicator. ++ (default "mmc") ++ ++ act_led_activelow Set to "on" to invert the sense of the LED ++ (default "off") ++ N.B. For Pi3 see pi3-act-led overlay. ++ ++ act_led_gpio Set which GPIO to use for the activity LED ++ (in case you want to connect it to an external ++ device) ++ (default "16" on a non-Plus board, "47" on a ++ Plus or Pi 2) ++ N.B. For Pi3 see pi3-act-led overlay. ++ ++ pwr_led_trigger ++ pwr_led_activelow ++ pwr_led_gpio ++ As for act_led_*, but using the PWR LED. ++ Not available on Model A/B boards. ++ ++ N.B. It is recommended to only enable those interfaces that are needed. ++ Leaving all interfaces enabled can lead to unwanted behaviour (i2c_vc ++ interfering with Pi Camera, I2S and SPI hogging GPIO pins, etc.) ++ Note also that i2c, i2c_arm and i2c_vc are aliases for the physical ++ interfaces i2c0 and i2c1. Use of the numeric variants is still possible ++ but deprecated because the ARM/VC assignments differ between board ++ revisions. The same board-specific mapping applies to i2c_baudrate, ++ and the other i2c baudrate parameters. ++ ++ ++Name: adau1977-adc ++Info: Overlay for activation of ADAU1977 ADC codec over I2C for control ++ and I2S for data. ++Load: dtoverlay=adau1977-adc ++Params: <None> ++ ++ ++Name: ads7846 ++Info: ADS7846 Touch controller ++Load: dtoverlay=ads7846,<param>=<val> ++Params: cs SPI bus Chip Select (default 1) ++ speed SPI bus speed (default 2MHz, max 3.25MHz) ++ penirq GPIO used for PENIRQ. REQUIRED ++ penirq_pull Set GPIO pull (default 0=none, 2=pullup) ++ swapxy Swap x and y axis ++ xmin Minimum value on the X axis (default 0) ++ ymin Minimum value on the Y axis (default 0) ++ xmax Maximum value on the X axis (default 4095) ++ ymax Maximum value on the Y axis (default 4095) ++ pmin Minimum reported pressure value (default 0) ++ pmax Maximum reported pressure value (default 65535) ++ xohms Touchpanel sensitivity (X-plate resistance) ++ (default 400) ++ ++ penirq is required and usually xohms (60-100) has to be set as well. ++ Apart from that, pmax (255) and swapxy are also common. ++ The rest of the calibration can be done with xinput-calibrator. ++ See: github.com/notro/fbtft/wiki/FBTFT-on-Raspian ++ Device Tree binding document: ++ www.kernel.org/doc/Documentation/devicetree/bindings/input/ads7846.txt ++ ++ ++Name: akkordion-iqdacplus ++Info: Configures the Digital Dreamtime Akkordion Music Player (based on the ++ OEM IQAudIO DAC+ or DAC Zero module). ++Load: dtoverlay=akkordion-iqdacplus,<param>=<val> ++Params: 24db_digital_gain Allow gain to be applied via the PCM512x codec ++ Digital volume control. Enable with ++ dtoverlay=akkordion-iqdacplus,24db_digital_gain ++ (The default behaviour is that the Digital ++ volume control is limited to a maximum of ++ 0dB. ie. it can attenuate but not provide ++ gain. For most users, this will be desired ++ as it will prevent clipping. By appending ++ the 24db_digital_gain parameter, the Digital ++ volume control will allow up to 24dB of ++ gain. If this parameter is enabled, it is the ++ responsibility of the user to ensure that ++ the Digital volume control is set to a value ++ that does not result in clipping/distortion!) ++ ++ ++Name: at86rf233 ++Info: Configures the Atmel AT86RF233 802.15.4 low-power WPAN transceiver, ++ connected to spi0.0 ++Load: dtoverlay=at86rf233,<param>=<val> ++Params: interrupt GPIO used for INT (default 23) ++ reset GPIO used for Reset (default 24) ++ sleep GPIO used for Sleep (default 25) ++ speed SPI bus speed in Hz (default 3000000) ++ trim Fine tuning of the internal capacitance ++ arrays (0=+0pF, 15=+4.5pF, default 15) ++ ++ ++Name: audioinjector-wm8731-audio ++Info: Configures the audioinjector.net audio add on soundcard ++Load: dtoverlay=audioinjector-wm8731-audio ++Params: <None> ++ ++ ++Name: bmp085_i2c-sensor ++Info: Configures the BMP085/BMP180 digital barometric pressure and temperature ++ sensors from Bosch Sensortec ++Load: dtoverlay=bmp085_i2c-sensor ++Params: <None> ++ ++ ++Name: dht11 ++Info: Overlay for the DHT11/DHT21/DHT22 humidity/temperature sensors ++ Also sometimes found with the part number(s) AM230x. ++Load: dtoverlay=dht11,<param>=<val> ++Params: gpiopin GPIO connected to the sensor's DATA output. ++ (default 4) ++ ++ ++Name: dpi24 ++Info: Overlay for a generic 24-bit DPI display ++ This uses GPIOs 0-27 (so no I2C, uart etc.), and activates the output ++ 2-3 seconds after the kernel has started. ++Load: dtoverlay=dpi24 ++Params: <None> ++ ++ ++Name: dwc-otg ++Info: Selects the dwc_otg USB controller driver which has fiq support. This ++ is the default on all except the Pi Zero which defaults to dwc2. ++Load: dtoverlay=dwc-otg ++Params: <None> ++ ++ ++Name: dwc2 ++Info: Selects the dwc2 USB controller driver ++Load: dtoverlay=dwc2,<param>=<val> ++Params: dr_mode Dual role mode: "host", "peripheral" or "otg" ++ ++ g-rx-fifo-size Size of rx fifo size in gadget mode ++ ++ g-np-tx-fifo-size Size of non-periodic tx fifo size in gadget ++ mode ++ ++ g-tx-fifo-size Size of periodic tx fifo per endpoint ++ (except ep0) in gadget mode ++ ++ ++[ The ds1307-rtc overlay has been deleted. See i2c-rtc. ] ++ ++ ++Name: enc28j60 ++Info: Overlay for the Microchip ENC28J60 Ethernet Controller (SPI) ++Load: dtoverlay=enc28j60,<param>=<val> ++Params: int_pin GPIO used for INT (default 25) ++ ++ speed SPI bus speed (default 12000000) ++ ++ ++Name: gpio-ir ++Info: Use GPIO pin as rc-core style infrared receiver input. The rc-core- ++ based gpio_ir_recv driver maps received keys directly to a ++ /dev/input/event* device, all decoding is done by the kernel - LIRC is ++ not required! The key mapping and other decoding parameters can be ++ configured by "ir-keytable" tool. ++Load: dtoverlay=gpio-ir,<param>=<val> ++Params: gpio_pin Input pin number. Default is 18. ++ ++ gpio_pull Desired pull-up/down state (off, down, up) ++ Default is "down". ++ ++ rc-map-name Default rc keymap (can also be changed by ++ ir-keytable), defaults to "rc-rc6-mce" ++ ++ ++Name: gpio-poweroff ++Info: Drives a GPIO high or low on reboot ++Load: dtoverlay=gpio-poweroff,<param>=<val> ++Params: gpiopin GPIO for signalling (default 26) ++ ++ active_low Set if the power control device requires a ++ high->low transition to trigger a power-down. ++ Note that this will require the support of a ++ custom dt-blob.bin to prevent a power-down ++ during the boot process, and that a reboot ++ will also cause the pin to go low. ++ ++ ++Name: hifiberry-amp ++Info: Configures the HifiBerry Amp and Amp+ audio cards ++Load: dtoverlay=hifiberry-amp ++Params: <None> ++ ++ ++Name: hifiberry-dac ++Info: Configures the HifiBerry DAC audio card ++Load: dtoverlay=hifiberry-dac ++Params: <None> ++ ++ ++Name: hifiberry-dacplus ++Info: Configures the HifiBerry DAC+ audio card ++Load: dtoverlay=hifiberry-dacplus,<param>=<val> ++Params: 24db_digital_gain Allow gain to be applied via the PCM512x codec ++ Digital volume control. Enable with ++ "dtoverlay=hifiberry-dacplus,24db_digital_gain" ++ (The default behaviour is that the Digital ++ volume control is limited to a maximum of ++ 0dB. ie. it can attenuate but not provide ++ gain. For most users, this will be desired ++ as it will prevent clipping. By appending ++ the 24dB_digital_gain parameter, the Digital ++ volume control will allow up to 24dB of ++ gain. If this parameter is enabled, it is the ++ responsibility of the user to ensure that ++ the Digital volume control is set to a value ++ that does not result in clipping/distortion!) ++ slave Force DAC+ Pro into slave mode, using Pi as ++ master for bit clock and frame clock. ++ ++ ++Name: hifiberry-digi ++Info: Configures the HifiBerry Digi audio card ++Load: dtoverlay=hifiberry-digi ++Params: <None> ++ ++ ++Name: hy28a ++Info: HY28A - 2.8" TFT LCD Display Module by HAOYU Electronics ++ Default values match Texy's display shield ++Load: dtoverlay=hy28a,<param>=<val> ++Params: speed Display SPI bus speed ++ ++ rotate Display rotation {0,90,180,270} ++ ++ fps Delay between frame updates ++ ++ debug Debug output level {0-7} ++ ++ xohms Touchpanel sensitivity (X-plate resistance) ++ ++ resetgpio GPIO used to reset controller ++ ++ ledgpio GPIO used to control backlight ++ ++ ++Name: hy28b ++Info: HY28B - 2.8" TFT LCD Display Module by HAOYU Electronics ++ Default values match Texy's display shield ++Load: dtoverlay=hy28b,<param>=<val> ++Params: speed Display SPI bus speed ++ ++ rotate Display rotation {0,90,180,270} ++ ++ fps Delay between frame updates ++ ++ debug Debug output level {0-7} ++ ++ xohms Touchpanel sensitivity (X-plate resistance) ++ ++ resetgpio GPIO used to reset controller ++ ++ ledgpio GPIO used to control backlight ++ ++ ++Name: i2c-gpio ++Info: Adds support for software i2c controller on gpio pins ++Load: dtoverlay=i2c-gpio,<param>=<val> ++Params: i2c_gpio_sda GPIO used for I2C data (default "23") ++ ++ i2c_gpio_scl GPIO used for I2C clock (default "24") ++ ++ i2c_gpio_delay_us Clock delay in microseconds ++ (default "2" = ~100kHz) ++ ++ ++Name: i2c-mux ++Info: Adds support for a number of I2C bus multiplexers on i2c_arm ++Load: dtoverlay=i2c-mux,<param>=<val> ++Params: pca9542 Select the NXP PCA9542 device ++ ++ pca9545 Select the NXP PCA9545 device ++ ++ pca9548 Select the NXP PCA9548 device ++ ++ addr Change I2C address of the device (default 0x70) ++ ++ ++[ The i2c-mux-pca9548a overlay has been deleted. See i2c-mux. ] ++ ++ ++Name: i2c-pwm-pca9685a ++Info: Adds support for an NXP PCA9685A I2C PWM controller on i2c_arm ++Load: dtoverlay=i2c-pwm-pca9685a,<param>=<val> ++Params: addr I2C address of PCA9685A (default 0x40) ++ ++ ++Name: i2c-rtc ++Info: Adds support for a number of I2C Real Time Clock devices ++Load: dtoverlay=i2c-rtc,<param>=<val> ++Params: ds1307 Select the DS1307 device ++ ++ ds1339 Select the DS1339 device ++ ++ ds3231 Select the DS3231 device ++ ++ mcp7940x Select the MCP7940x device ++ ++ mcp7941x Select the MCP7941x device ++ ++ pcf2127 Select the PCF2127 device ++ ++ pcf8523 Select the PCF8523 device ++ ++ pcf8563 Select the PCF8563 device ++ ++ trickle-resistor-ohms Resistor value for trickle charge (DS1339-only) ++ ++ ++Name: i2c0-bcm2708 ++Info: Enable the i2c_bcm2708 driver for the i2c0 bus. Not all pin combinations ++ are usable on all platforms. ++Load: dtoverlay=i2c0-bcm2708,<param>=<val> ++Params: sda0_pin GPIO pin for SDA0 (deprecated - use pins_*) ++ scl0_pin GPIO pin for SCL0 (deprecated - use pins_*) ++ pins_0_1 Use pins 0 and 1 (default) ++ pins_28_29 Use pins 28 and 29 ++ pins_44_45 Use pins 44 and 45 ++ pins_46_47 Use pins 46 and 47 ++ ++ ++Name: i2c1-bcm2708 ++Info: Enable the i2c_bcm2708 driver for the i2c1 bus ++Load: dtoverlay=i2c1-bcm2708,<param>=<val> ++Params: sda1_pin GPIO pin for SDA1 (2 or 44 - default 2) ++ scl1_pin GPIO pin for SCL1 (3 or 45 - default 3) ++ pin_func Alternative pin function (4 (alt0), 6 (alt2) - ++ default 4) ++ ++ ++Name: i2s-gpio28-31 ++Info: move I2S function block to GPIO 28 to 31 ++Load: dtoverlay=i2s-gpio28-31 ++Params: <None> ++ ++ ++Name: i2s-mmap ++Info: Enables mmap support in the bcm2708-i2s driver ++Load: dtoverlay=i2s-mmap ++Params: <None> ++ ++ ++Name: iqaudio-dac ++Info: Configures the IQaudio DAC audio card ++Load: dtoverlay=iqaudio-dac,<param> ++Params: 24db_digital_gain Allow gain to be applied via the PCM512x codec ++ Digital volume control. Enable with ++ "dtoverlay=iqaudio-dac,24db_digital_gain" ++ (The default behaviour is that the Digital ++ volume control is limited to a maximum of ++ 0dB. ie. it can attenuate but not provide ++ gain. For most users, this will be desired ++ as it will prevent clipping. By appending ++ the 24db_digital_gain parameter, the Digital ++ volume control will allow up to 24dB of ++ gain. If this parameter is enabled, it is the ++ responsibility of the user to ensure that ++ the Digital volume control is set to a value ++ that does not result in clipping/distortion!) ++ ++ ++Name: iqaudio-dacplus ++Info: Configures the IQaudio DAC+ audio card ++Load: dtoverlay=iqaudio-dacplus,<param>=<val> ++Params: 24db_digital_gain Allow gain to be applied via the PCM512x codec ++ Digital volume control. Enable with ++ "dtoverlay=iqaudio-dacplus,24db_digital_gain" ++ (The default behaviour is that the Digital ++ volume control is limited to a maximum of ++ 0dB. ie. it can attenuate but not provide ++ gain. For most users, this will be desired ++ as it will prevent clipping. By appending ++ the 24db_digital_gain parameter, the Digital ++ volume control will allow up to 24dB of ++ gain. If this parameter is enabled, it is the ++ responsibility of the user to ensure that ++ the Digital volume control is set to a value ++ that does not result in clipping/distortion!) ++ ++ ++Name: justboom-dac ++Info: Configures the JustBoom DAC HAT, Amp HAT, DAC Zero and Amp Zero audio ++ cards ++Load: dtoverlay=justboom-dac,<param>=<val> ++Params: 24db_digital_gain Allow gain to be applied via the PCM512x codec ++ Digital volume control. Enable with ++ "dtoverlay=justboom-dac,24db_digital_gain" ++ (The default behaviour is that the Digital ++ volume control is limited to a maximum of ++ 0dB. ie. it can attenuate but not provide ++ gain. For most users, this will be desired ++ as it will prevent clipping. By appending ++ the 24dB_digital_gain parameter, the Digital ++ volume control will allow up to 24dB of ++ gain. If this parameter is enabled, it is the ++ responsibility of the user to ensure that ++ the Digital volume control is set to a value ++ that does not result in clipping/distortion!) ++ ++ ++Name: justboom-digi ++Info: Configures the JustBoom Digi HAT and Digi Zero audio cards ++Load: dtoverlay=justboom-digi ++Params: <None> ++ ++ ++Name: lirc-rpi ++Info: Configures lirc-rpi (Linux Infrared Remote Control for Raspberry Pi) ++ Consult the module documentation for more details. ++Load: dtoverlay=lirc-rpi,<param>=<val> ++Params: gpio_out_pin GPIO for output (default "17") ++ ++ gpio_in_pin GPIO for input (default "18") ++ ++ gpio_in_pull Pull up/down/off on the input pin ++ (default "down") ++ ++ sense Override the IR receive auto-detection logic: ++ "0" = force active-high ++ "1" = force active-low ++ "-1" = use auto-detection ++ (default "-1") ++ ++ softcarrier Turn the software carrier "on" or "off" ++ (default "on") ++ ++ invert "on" = invert the output pin (default "off") ++ ++ debug "on" = enable additional debug messages ++ (default "off") ++ ++ ++Name: mcp23017 ++Info: Configures the MCP23017 I2C port expander ++Load: dtoverlay=mcp23017,<param>=<val> ++Params: gpiopin Gpio pin connected to the INTA output of the ++ MCP23017 (default: 4) ++ ++ addr I2C address of the MCP23017 (default: 0x20) ++ ++ ++Name: mcp2515-can0 ++Info: Configures the MCP2515 CAN controller on spi0.0 ++Load: dtoverlay=mcp2515-can0,<param>=<val> ++Params: oscillator Clock frequency for the CAN controller (Hz) ++ ++ spimaxfrequency Maximum SPI frequence (Hz) ++ ++ interrupt GPIO for interrupt signal ++ ++ ++Name: mcp2515-can1 ++Info: Configures the MCP2515 CAN controller on spi0.1 ++Load: dtoverlay=mcp2515-can1,<param>=<val> ++Params: oscillator Clock frequency for the CAN controller (Hz) ++ ++ spimaxfrequency Maximum SPI frequence (Hz) ++ ++ interrupt GPIO for interrupt signal ++ ++ ++Name: mmc ++Info: Selects the bcm2835-mmc SD/MMC driver, optionally with overclock ++Load: dtoverlay=mmc,<param>=<val> ++Params: overclock_50 Clock (in MHz) to use when the MMC framework ++ requests 50MHz ++ ++ ++Name: mz61581 ++Info: MZ61581 display by Tontec ++Load: dtoverlay=mz61581,<param>=<val> ++Params: speed Display SPI bus speed ++ ++ rotate Display rotation {0,90,180,270} ++ ++ fps Delay between frame updates ++ ++ txbuflen Transmit buffer length (default 32768) ++ ++ debug Debug output level {0-7} ++ ++ xohms Touchpanel sensitivity (X-plate resistance) ++ ++ ++[ The pcf2127-rtc overlay has been deleted. See i2c-rtc. ] ++ ++ ++[ The pcf8523-rtc overlay has been deleted. See i2c-rtc. ] ++ ++ ++[ The pcf8563-rtc overlay has been deleted. See i2c-rtc. ] ++ ++ ++Name: pi3-act-led ++Info: Pi3 uses a GPIO expander to drive the LEDs which can only be accessed ++ from the VPU. There is a special driver for this with a separate DT ++ node, which has the unfortunate consequence of breaking the ++ act_led_gpio and act_led_activelow dtparams. ++ This overlay changes the GPIO controller back to the standard one and ++ restores the dtparams. ++Load: dtoverlay=pi3-act-led,<param>=<val> ++Params: activelow Set to "on" to invert the sense of the LED ++ (default "off") ++ ++ gpio Set which GPIO to use for the activity LED ++ (in case you want to connect it to an external ++ device) ++ REQUIRED ++ ++ ++Name: pi3-disable-bt ++Info: Disable Pi3 Bluetooth and restore UART0/ttyAMA0 over GPIOs 14 & 15 ++ N.B. To disable the systemd service that initialises the modem so it ++ doesn't use the UART, use 'sudo systemctl disable hciuart'. ++Load: dtoverlay=pi3-disable-bt ++Params: <None> ++ ++ ++Name: pi3-miniuart-bt ++Info: Switch Pi3 Bluetooth function to use the mini-UART (ttyS0) and restore ++ UART0/ttyAMA0 over GPIOs 14 & 15. Note that this may reduce the maximum ++ usable baudrate. ++ N.B. It is also necessary to edit /lib/systemd/system/hciuart.service ++ and replace ttyAMA0 with ttyS0, unless you have a system with udev rules ++ that create /dev/serial0 and /dev/serial1, in which case use ++ /dev/serial1 instead because it will always be correct. ++Load: dtoverlay=pi3-miniuart-bt ++Params: <None> ++ ++ ++Name: piscreen ++Info: PiScreen display by OzzMaker.com ++Load: dtoverlay=piscreen,<param>=<val> ++Params: speed Display SPI bus speed ++ ++ rotate Display rotation {0,90,180,270} ++ ++ fps Delay between frame updates ++ ++ debug Debug output level {0-7} ++ ++ xohms Touchpanel sensitivity (X-plate resistance) ++ ++ ++Name: piscreen2r ++Info: PiScreen 2 with resistive TP display by OzzMaker.com ++Load: dtoverlay=piscreen2r,<param>=<val> ++Params: speed Display SPI bus speed ++ ++ rotate Display rotation {0,90,180,270} ++ ++ fps Delay between frame updates ++ ++ debug Debug output level {0-7} ++ ++ xohms Touchpanel sensitivity (X-plate resistance) ++ ++ ++Name: pitft22 ++Info: Adafruit PiTFT 2.2" screen ++Load: dtoverlay=pitft22,<param>=<val> ++Params: speed Display SPI bus speed ++ ++ rotate Display rotation {0,90,180,270} ++ ++ fps Delay between frame updates ++ ++ debug Debug output level {0-7} ++ ++ ++Name: pitft28-capacitive ++Info: Adafruit PiTFT 2.8" capacitive touch screen ++Load: dtoverlay=pitft28-capacitive,<param>=<val> ++Params: speed Display SPI bus speed ++ ++ rotate Display rotation {0,90,180,270} ++ ++ fps Delay between frame updates ++ ++ debug Debug output level {0-7} ++ ++ touch-sizex Touchscreen size x (default 240) ++ ++ touch-sizey Touchscreen size y (default 320) ++ ++ touch-invx Touchscreen inverted x axis ++ ++ touch-invy Touchscreen inverted y axis ++ ++ touch-swapxy Touchscreen swapped x y axis ++ ++ ++Name: pitft28-resistive ++Info: Adafruit PiTFT 2.8" resistive touch screen ++Load: dtoverlay=pitft28-resistive,<param>=<val> ++Params: speed Display SPI bus speed ++ ++ rotate Display rotation {0,90,180,270} ++ ++ fps Delay between frame updates ++ ++ debug Debug output level {0-7} ++ ++ ++Name: pps-gpio ++Info: Configures the pps-gpio (pulse-per-second time signal via GPIO). ++Load: dtoverlay=pps-gpio,<param>=<val> ++Params: gpiopin Input GPIO (default "18") ++ ++ ++Name: pwm ++Info: Configures a single PWM channel ++ Legal pin,function combinations for each channel: ++ PWM0: 12,4(Alt0) 18,2(Alt5) 40,4(Alt0) 52,5(Alt1) ++ PWM1: 13,4(Alt0) 19,2(Alt5) 41,4(Alt0) 45,4(Alt0) 53,5(Alt1) ++ N.B.: ++ 1) Pin 18 is the only one available on all platforms, and ++ it is the one used by the I2S audio interface. ++ Pins 12 and 13 might be better choices on an A+, B+ or Pi2. ++ 2) The onboard analogue audio output uses both PWM channels. ++ 3) So be careful mixing audio and PWM. ++ 4) Currently the clock must have been enabled and configured ++ by other means. ++Load: dtoverlay=pwm,<param>=<val> ++Params: pin Output pin (default 18) - see table ++ func Pin function (default 2 = Alt5) - see above ++ clock PWM clock frequency (informational) ++ ++ ++Name: pwm-2chan ++Info: Configures both PWM channels ++ Legal pin,function combinations for each channel: ++ PWM0: 12,4(Alt0) 18,2(Alt5) 40,4(Alt0) 52,5(Alt1) ++ PWM1: 13,4(Alt0) 19,2(Alt5) 41,4(Alt0) 45,4(Alt0) 53,5(Alt1) ++ N.B.: ++ 1) Pin 18 is the only one available on all platforms, and ++ it is the one used by the I2S audio interface. ++ Pins 12 and 13 might be better choices on an A+, B+ or Pi2. ++ 2) The onboard analogue audio output uses both PWM channels. ++ 3) So be careful mixing audio and PWM. ++ 4) Currently the clock must have been enabled and configured ++ by other means. ++Load: dtoverlay=pwm-2chan,<param>=<val> ++Params: pin Output pin (default 18) - see table ++ pin2 Output pin for other channel (default 19) ++ func Pin function (default 2 = Alt5) - see above ++ func2 Function for pin2 (default 2 = Alt5) ++ clock PWM clock frequency (informational) ++ ++ ++Name: qca7000 ++Info: I2SE's Evaluation Board for PLC Stamp micro ++Load: dtoverlay=qca7000,<param>=<val> ++Params: int_pin GPIO pin for interrupt signal (default 23) ++ ++ speed SPI bus speed (default 12 MHz) ++ ++ ++Name: raspidac3 ++Info: Configures the RaspiDAV Rev.3x audio card ++Load: dtoverlay=raspidac3 ++Params: <None> ++ ++ ++Name: rpi-backlight ++Info: Raspberry Pi official display backlight driver ++Load: dtoverlay=rpi-backlight ++Params: <None> ++ ++ ++Name: rpi-dac ++Info: Configures the RPi DAC audio card ++Load: dtoverlay=rpi-dac ++Params: <None> ++ ++ ++Name: rpi-display ++Info: RPi-Display - 2.8" Touch Display by Watterott ++Load: dtoverlay=rpi-display,<param>=<val> ++Params: speed Display SPI bus speed ++ rotate Display rotation {0,90,180,270} ++ fps Delay between frame updates ++ debug Debug output level {0-7} ++ xohms Touchpanel sensitivity (X-plate resistance) ++ swapxy Swap x and y axis ++ ++ ++Name: rpi-ft5406 ++Info: Official Raspberry Pi display touchscreen ++Load: dtoverlay=rpi-ft5406 ++Params: <None> ++ ++ ++Name: rpi-proto ++Info: Configures the RPi Proto audio card ++Load: dtoverlay=rpi-proto ++Params: <None> ++ ++ ++Name: rpi-sense ++Info: Raspberry Pi Sense HAT ++Load: dtoverlay=rpi-sense ++Params: <None> ++ ++ ++Name: rra-digidac1-wm8741-audio ++Info: Configures the Red Rocks Audio DigiDAC1 soundcard ++Load: dtoverlay=rra-digidac1-wm8741-audio ++Params: <None> ++ ++ ++Name: sdhost ++Info: Selects the bcm2835-sdhost SD/MMC driver, optionally with overclock. ++ N.B. This overlay is designed for situations where the mmc driver is ++ the default, so it disables the other (mmc) interface - this will kill ++ WiFi on a Pi3. If this isn't what you want, either use the sdtweak ++ overlay or the new sd_* dtparams of the base DTBs. ++Load: dtoverlay=sdhost,<param>=<val> ++Params: overclock_50 Clock (in MHz) to use when the MMC framework ++ requests 50MHz ++ ++ force_pio Disable DMA support (default off) ++ ++ pio_limit Number of blocks above which to use DMA ++ (default 1) ++ ++ debug Enable debug output (default off) ++ ++ ++Name: sdio ++Info: Selects the bcm2835-sdhost SD/MMC driver, optionally with overclock, ++ and enables SDIO via GPIOs 22-27. ++Load: dtoverlay=sdio,<param>=<val> ++Params: overclock_50 SD Clock (in MHz) to use when the MMC framework ++ requests 50MHz ++ ++ sdio_overclock SDIO Clock (in MHz) to use when the MMC ++ framework requests 50MHz ++ ++ force_pio Disable DMA support (default off) ++ ++ pio_limit Number of blocks above which to use DMA ++ (default 1) ++ ++ debug Enable debug output (default off) ++ ++ poll_once Disable SDIO-device polling every second ++ (default on: polling once at boot-time) ++ ++ bus_width Set the SDIO host bus width (default 4 bits) ++ ++ ++Name: sdio-1bit ++Info: Selects the bcm2835-sdhost SD/MMC driver, optionally with overclock, ++ and enables 1-bit SDIO via GPIOs 22-25. ++Load: dtoverlay=sdio-1bit,<param>=<val> ++Params: overclock_50 SD Clock (in MHz) to use when the MMC framework ++ requests 50MHz ++ ++ sdio_overclock SDIO Clock (in MHz) to use when the MMC ++ framework requests 50MHz ++ ++ force_pio Disable DMA support (default off) ++ ++ pio_limit Number of blocks above which to use DMA ++ (default 1) ++ ++ debug Enable debug output (default off) ++ ++ poll_once Disable SDIO-device polling every second ++ (default on: polling once at boot-time) ++ ++ ++Name: sdtweak ++Info: Tunes the bcm2835-sdhost SD/MMC driver ++ N.B. This functionality is now available via the sd_* dtparams in the ++ base DTB. ++Load: dtoverlay=sdtweak,<param>=<val> ++Params: overclock_50 Clock (in MHz) to use when the MMC framework ++ requests 50MHz ++ ++ force_pio Disable DMA support (default off) ++ ++ pio_limit Number of blocks above which to use DMA ++ (default 1) ++ ++ debug Enable debug output (default off) ++ ++ ++Name: smi ++Info: Enables the Secondary Memory Interface peripheral. Uses GPIOs 2-25! ++Load: dtoverlay=smi ++Params: <None> ++ ++ ++Name: smi-dev ++Info: Enables the userspace interface for the SMI driver ++Load: dtoverlay=smi-dev ++Params: <None> ++ ++ ++Name: smi-nand ++Info: Enables access to NAND flash via the SMI interface ++Load: dtoverlay=smi-nand ++Params: <None> ++ ++ ++Name: spi-gpio35-39 ++Info: move SPI function block to GPIO 35 to 39 ++Load: dtoverlay=spi-gpio35-39 ++Params: <None> ++ ++ ++Name: spi1-1cs ++Info: Enables spi1 with a single chip select (CS) line and associated spidev ++ dev node. The gpio pin number for the CS line and spidev device node ++ creation are configurable. ++ N.B.: spi1 is only accessible on devices with a 40pin header, eg: ++ A+, B+, Zero and PI2 B; as well as the Compute Module. ++Load: dtoverlay=spi1-1cs,<param>=<val> ++Params: cs0_pin GPIO pin for CS0 (default 18 - BCM SPI1_CE0). ++ cs0_spidev Set to 'disabled' to stop the creation of a ++ userspace device node /dev/spidev1.0 (default ++ is 'okay' or enabled). ++ ++ ++Name: spi1-2cs ++Info: Enables spi1 with two chip select (CS) lines and associated spidev ++ dev nodes. The gpio pin numbers for the CS lines and spidev device node ++ creation are configurable. ++ N.B.: spi1 is only accessible on devices with a 40pin header, eg: ++ A+, B+, Zero and PI2 B; as well as the Compute Module. ++Load: dtoverlay=spi1-2cs,<param>=<val> ++Params: cs0_pin GPIO pin for CS0 (default 18 - BCM SPI1_CE0). ++ cs1_pin GPIO pin for CS1 (default 17 - BCM SPI1_CE1). ++ cs0_spidev Set to 'disabled' to stop the creation of a ++ userspace device node /dev/spidev1.0 (default ++ is 'okay' or enabled). ++ cs1_spidev Set to 'disabled' to stop the creation of a ++ userspace device node /dev/spidev1.1 (default ++ is 'okay' or enabled). ++ ++ ++Name: spi1-3cs ++Info: Enables spi1 with three chip select (CS) lines and associated spidev ++ dev nodes. The gpio pin numbers for the CS lines and spidev device node ++ creation are configurable. ++ N.B.: spi1 is only accessible on devices with a 40pin header, eg: ++ A+, B+, Zero and PI2 B; as well as the Compute Module. ++Load: dtoverlay=spi1-3cs,<param>=<val> ++Params: cs0_pin GPIO pin for CS0 (default 18 - BCM SPI1_CE0). ++ cs1_pin GPIO pin for CS1 (default 17 - BCM SPI1_CE1). ++ cs2_pin GPIO pin for CS2 (default 16 - BCM SPI1_CE2). ++ cs0_spidev Set to 'disabled' to stop the creation of a ++ userspace device node /dev/spidev1.0 (default ++ is 'okay' or enabled). ++ cs1_spidev Set to 'disabled' to stop the creation of a ++ userspace device node /dev/spidev1.1 (default ++ is 'okay' or enabled). ++ cs2_spidev Set to 'disabled' to stop the creation of a ++ userspace device node /dev/spidev1.2 (default ++ is 'okay' or enabled). ++ ++ ++Name: spi2-1cs ++Info: Enables spi2 with a single chip select (CS) line and associated spidev ++ dev node. The gpio pin number for the CS line and spidev device node ++ creation are configurable. ++ N.B.: spi2 is only accessible with the Compute Module. ++Load: dtoverlay=spi2-1cs,<param>=<val> ++Params: cs0_pin GPIO pin for CS0 (default 43 - BCM SPI2_CE0). ++ cs0_spidev Set to 'disabled' to stop the creation of a ++ userspace device node /dev/spidev2.0 (default ++ is 'okay' or enabled). ++ ++ ++Name: spi2-2cs ++Info: Enables spi2 with two chip select (CS) lines and associated spidev ++ dev nodes. The gpio pin numbers for the CS lines and spidev device node ++ creation are configurable. ++ N.B.: spi2 is only accessible with the Compute Module. ++Load: dtoverlay=spi2-2cs,<param>=<val> ++Params: cs0_pin GPIO pin for CS0 (default 43 - BCM SPI2_CE0). ++ cs1_pin GPIO pin for CS1 (default 44 - BCM SPI2_CE1). ++ cs0_spidev Set to 'disabled' to stop the creation of a ++ userspace device node /dev/spidev2.0 (default ++ is 'okay' or enabled). ++ cs1_spidev Set to 'disabled' to stop the creation of a ++ userspace device node /dev/spidev2.1 (default ++ is 'okay' or enabled). ++ ++ ++Name: spi2-3cs ++Info: Enables spi2 with three chip select (CS) lines and associated spidev ++ dev nodes. The gpio pin numbers for the CS lines and spidev device node ++ creation are configurable. ++ N.B.: spi2 is only accessible with the Compute Module. ++Load: dtoverlay=spi2-3cs,<param>=<val> ++Params: cs0_pin GPIO pin for CS0 (default 43 - BCM SPI2_CE0). ++ cs1_pin GPIO pin for CS1 (default 44 - BCM SPI2_CE1). ++ cs2_pin GPIO pin for CS2 (default 45 - BCM SPI2_CE2). ++ cs0_spidev Set to 'disabled' to stop the creation of a ++ userspace device node /dev/spidev2.0 (default ++ is 'okay' or enabled). ++ cs1_spidev Set to 'disabled' to stop the creation of a ++ userspace device node /dev/spidev2.1 (default ++ is 'okay' or enabled). ++ cs2_spidev Set to 'disabled' to stop the creation of a ++ userspace device node /dev/spidev2.2 (default ++ is 'okay' or enabled). ++ ++ ++Name: tinylcd35 ++Info: 3.5" Color TFT Display by www.tinylcd.com ++ Options: Touch, RTC, keypad ++Load: dtoverlay=tinylcd35,<param>=<val> ++Params: speed Display SPI bus speed ++ ++ rotate Display rotation {0,90,180,270} ++ ++ fps Delay between frame updates ++ ++ debug Debug output level {0-7} ++ ++ touch Enable touch panel ++ ++ touchgpio Touch controller IRQ GPIO ++ ++ xohms Touchpanel: Resistance of X-plate in ohms ++ ++ rtc-pcf PCF8563 Real Time Clock ++ ++ rtc-ds DS1307 Real Time Clock ++ ++ keypad Enable keypad ++ ++ Examples: ++ Display with touchpanel, PCF8563 RTC and keypad: ++ dtoverlay=tinylcd35,touch,rtc-pcf,keypad ++ Old touch display: ++ dtoverlay=tinylcd35,touch,touchgpio=3 ++ ++ ++Name: uart1 ++Info: Enable uart1 in place of uart0 ++Load: dtoverlay=uart1,<param>=<val> ++Params: txd1_pin GPIO pin for TXD1 (14, 32 or 40 - default 14) ++ ++ rxd1_pin GPIO pin for RXD1 (15, 33 or 41 - default 15) ++ ++ ++Name: vc4-kms-v3d ++Info: Enable Eric Anholt's DRM VC4 HDMI/HVS/V3D driver. Running startx or ++ booting to GUI while this overlay is in use will cause interesting ++ lockups. ++Load: dtoverlay=vc4-kms-v3d,<param> ++Params: cma-256 CMA is 256MB, 256MB-aligned (needs 1GB) ++ cma-192 CMA is 192MB, 256MB-aligned (needs 1GB) ++ cma-128 CMA is 128MB, 128MB-aligned ++ cma-96 CMA is 96MB, 128MB-aligned ++ cma-64 CMA is 64MB, 64MB-aligned ++ ++ ++Name: vga666 ++Info: Overlay for the Fen Logic VGA666 board ++ This uses GPIOs 2-21 (so no I2C), and activates the output 2-3 seconds ++ after the kernel has started. ++Load: dtoverlay=vga666 ++Params: <None> ++ ++ ++Name: w1-gpio ++Info: Configures the w1-gpio Onewire interface module. ++ Use this overlay if you *don't* need a GPIO to drive an external pullup. ++Load: dtoverlay=w1-gpio,<param>=<val> ++Params: gpiopin GPIO for I/O (default "4") ++ ++ pullup Non-zero, "on", or "y" to enable the parasitic ++ power (2-wire, power-on-data) feature ++ ++ ++Name: w1-gpio-pullup ++Info: Configures the w1-gpio Onewire interface module. ++ Use this overlay if you *do* need a GPIO to drive an external pullup. ++Load: dtoverlay=w1-gpio-pullup,<param>=<val> ++Params: gpiopin GPIO for I/O (default "4") ++ ++ pullup Non-zero, "on", or "y" to enable the parasitic ++ power (2-wire, power-on-data) feature ++ ++ extpullup GPIO for external pullup (default "5") ++ ++ ++Name: wittypi ++Info: Configures the wittypi RTC module. ++Load: dtoverlay=wittypi,<param>=<val> ++Params: led_gpio GPIO for LED (default "17") ++ led_trigger Choose which activity the LED tracks (default ++ "default-on") ++ ++ ++Troubleshooting ++=============== ++ ++If you are experiencing problems that you think are DT-related, enable DT ++diagnostic output by adding this to /boot/config.txt: ++ ++ dtdebug=on ++ ++and rebooting. Then run: ++ ++ sudo vcdbg log msg ++ ++and look for relevant messages. ++ ++Further reading ++=============== ++ ++This is only meant to be a quick introduction to the subject of Device Tree on ++Raspberry Pi. There is a more complete explanation here: ++ ++http://www.raspberrypi.org/documentation/configuration/device-tree.md +diff --git a/arch/arm/boot/dts/overlays/adau1977-adc-overlay.dts b/arch/arm/boot/dts/overlays/adau1977-adc-overlay.dts +new file mode 100644 +index 0000000..24fcd58 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/adau1977-adc-overlay.dts +@@ -0,0 +1,53 @@ ++// Definitions for ADAU1977 ADC ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&soc>; ++ ++ __overlay__ { ++ codec_supply: fixedregulator@0 { ++ compatible = "regulator-fixed"; ++ regulator-name = "AVDD"; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&i2c>; ++ ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ adau1977: codec@11 { ++ compatible = "adi,adau1977"; ++ reg = <0x11>; ++ reset-gpios = <&gpio 5 0>; ++ AVDD-supply = <&codec_supply>; ++ }; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&i2s>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@3 { ++ target = <&sound>; ++ __overlay__ { ++ compatible = "adi,adau1977-adc"; ++ i2s-controller = <&i2s>; ++ status = "okay"; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/ads7846-overlay.dts b/arch/arm/boot/dts/overlays/ads7846-overlay.dts +new file mode 100644 +index 0000000..edf2dc9 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/ads7846-overlay.dts +@@ -0,0 +1,89 @@ ++/* ++ * Generic Device Tree overlay for the ADS7846 touch controller ++ * ++ */ ++ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; ++ ++ fragment@0 { ++ target = <&spi0>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&spidev0>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&spidev1>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; ++ ++ fragment@3 { ++ target = <&gpio>; ++ __overlay__ { ++ ads7846_pins: ads7846_pins { ++ brcm,pins = <255>; /* illegal default value */ ++ brcm,function = <0>; /* in */ ++ brcm,pull = <0>; /* none */ ++ }; ++ }; ++ }; ++ ++ fragment@4 { ++ target = <&spi0>; ++ __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ ads7846: ads7846@1 { ++ compatible = "ti,ads7846"; ++ reg = <1>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&ads7846_pins>; ++ ++ spi-max-frequency = <2000000>; ++ interrupts = <255 2>; /* high-to-low edge triggered */ ++ interrupt-parent = <&gpio>; ++ pendown-gpio = <&gpio 255 0>; ++ ++ /* driver defaults */ ++ ti,x-min = /bits/ 16 <0>; ++ ti,y-min = /bits/ 16 <0>; ++ ti,x-max = /bits/ 16 <0x0FFF>; ++ ti,y-max = /bits/ 16 <0x0FFF>; ++ ti,pressure-min = /bits/ 16 <0>; ++ ti,pressure-max = /bits/ 16 <0xFFFF>; ++ ti,x-plate-ohms = /bits/ 16 <400>; ++ }; ++ }; ++ }; ++ __overrides__ { ++ cs = <&ads7846>,"reg:0"; ++ speed = <&ads7846>,"spi-max-frequency:0"; ++ penirq = <&ads7846_pins>,"brcm,pins:0", /* REQUIRED */ ++ <&ads7846>,"interrupts:0", ++ <&ads7846>,"pendown-gpio:4"; ++ penirq_pull = <&ads7846_pins>,"brcm,pull:0"; ++ swapxy = <&ads7846>,"ti,swap-xy?"; ++ xmin = <&ads7846>,"ti,x-min;0"; ++ ymin = <&ads7846>,"ti,y-min;0"; ++ xmax = <&ads7846>,"ti,x-max;0"; ++ ymax = <&ads7846>,"ti,y-max;0"; ++ pmin = <&ads7846>,"ti,pressure-min;0"; ++ pmax = <&ads7846>,"ti,pressure-max;0"; ++ xohms = <&ads7846>,"ti,x-plate-ohms;0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/akkordion-iqdacplus-overlay.dts b/arch/arm/boot/dts/overlays/akkordion-iqdacplus-overlay.dts +new file mode 100644 +index 0000000..208849d +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/akkordion-iqdacplus-overlay.dts +@@ -0,0 +1,46 @@ ++// Definitions for Digital Dreamtime Akkordion using IQaudIO DAC+ or DACZero ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&i2s>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&i2c1>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ pcm5122@4c { ++ #sound-dai-cells = <0>; ++ compatible = "ti,pcm5122"; ++ reg = <0x4c>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&sound>; ++ frag2: __overlay__ { ++ compatible = "iqaudio,iqaudio-dac"; ++ card_name = "Akkordion"; ++ dai_name = "IQaudIO DAC"; ++ dai_stream_name = "IQaudIO DAC HiFi"; ++ i2s-controller = <&i2s>; ++ status = "okay"; ++ }; ++ }; ++ ++ __overrides__ { ++ 24db_digital_gain = <&frag2>,"iqaudio,24db_digital_gain?"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/at86rf233-overlay.dts b/arch/arm/boot/dts/overlays/at86rf233-overlay.dts +new file mode 100644 +index 0000000..880c753 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/at86rf233-overlay.dts +@@ -0,0 +1,57 @@ ++/dts-v1/; ++/plugin/; ++ ++/* Overlay for Atmel AT86RF233 IEEE 802.15.4 WPAN transceiver on spi0.0 */ ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2836", "brcm,bcm2708", "brcm,bcm2709"; ++ ++ fragment@0 { ++ target = <&spi0>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ status = "okay"; ++ ++ lowpan0: at86rf233@0 { ++ compatible = "atmel,at86rf233"; ++ reg = <0>; ++ interrupt-parent = <&gpio>; ++ interrupts = <23 4>; /* active high */ ++ reset-gpio = <&gpio 24 1>; ++ sleep-gpio = <&gpio 25 1>; ++ spi-max-frequency = <3000000>; ++ xtal-trim = /bits/ 8 <0xf>; ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&spidev0>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&gpio>; ++ __overlay__ { ++ lowpan0_pins: lowpan0_pins { ++ brcm,pins = <23 24 25>; ++ brcm,function = <0 1 1>; /* in out out */ ++ }; ++ }; ++ }; ++ ++ __overrides__ { ++ interrupt = <&lowpan0>, "interrupts:0", ++ <&lowpan0_pins>, "brcm,pins:0"; ++ reset = <&lowpan0>, "reset-gpio:4", ++ <&lowpan0_pins>, "brcm,pins:4"; ++ sleep = <&lowpan0>, "sleep-gpio:4", ++ <&lowpan0_pins>, "brcm,pins:8"; ++ speed = <&lowpan0>, "spi-max-frequency:0"; ++ trim = <&lowpan0>, "xtal-trim.0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/audioinjector-wm8731-audio-overlay.dts b/arch/arm/boot/dts/overlays/audioinjector-wm8731-audio-overlay.dts +new file mode 100644 +index 0000000..4ed66577 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/audioinjector-wm8731-audio-overlay.dts +@@ -0,0 +1,39 @@ ++// Definitions for audioinjector.net audio add on soundcard ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&i2s>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&i2c1>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ wm8731@1a { ++ #sound-dai-cells = <0>; ++ compatible = "wlf,wm8731"; ++ reg = <0x1a>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&sound>; ++ __overlay__ { ++ compatible = "ai,audioinjector-pi-soundcard"; ++ i2s-controller = <&i2s>; ++ status = "okay"; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/bmp085_i2c-sensor-overlay.dts b/arch/arm/boot/dts/overlays/bmp085_i2c-sensor-overlay.dts +new file mode 100644 +index 0000000..782b171 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/bmp085_i2c-sensor-overlay.dts +@@ -0,0 +1,23 @@ ++// Definitions for BMP085/BMP180 digital barometric pressure and temperature sensors from Bosch Sensortec ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&i2c_arm>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ bmp085@77 { ++ compatible = "bosch,bmp085"; ++ reg = <0x77>; ++ default-oversampling = <3>; ++ status = "okay"; ++ }; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/dht11-overlay.dts b/arch/arm/boot/dts/overlays/dht11-overlay.dts +new file mode 100644 +index 0000000..9bf67fd +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/dht11-overlay.dts +@@ -0,0 +1,39 @@ ++/* ++ * Overlay for the DHT11/21/22 humidity/temperature sensor modules. ++ */ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target-path = "/"; ++ __overlay__ { ++ ++ dht11: dht11@0 { ++ compatible = "dht11"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&dht11_pins>; ++ gpios = <&gpio 4 0>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ dht11_pins: dht11_pins { ++ brcm,pins = <4>; ++ brcm,function = <0>; // in ++ brcm,pull = <0>; // off ++ }; ++ }; ++ }; ++ ++ __overrides__ { ++ gpiopin = <&dht11_pins>,"brcm,pins:0", ++ <&dht11>,"gpios:4"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/dpi24-overlay.dts b/arch/arm/boot/dts/overlays/dpi24-overlay.dts +new file mode 100644 +index 0000000..e4dbe40 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/dpi24-overlay.dts +@@ -0,0 +1,31 @@ ++/dts-v1/; ++/plugin/; ++ ++/{ ++ compatible = "brcm,bcm2708"; ++ ++ // There is no DPI driver module, but we need a platform device ++ // node (that doesn't already use pinctrl) to hang the pinctrl ++ // reference on - leds will do ++ ++ fragment@0 { ++ target = <&leds>; ++ __overlay__ { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&dpi24_pins>; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ dpi24_pins: dpi24_pins { ++ brcm,pins = <0 1 2 3 4 5 6 7 8 9 10 11 ++ 12 13 14 15 16 17 18 19 20 ++ 21 22 23 24 25 26 27>; ++ brcm,function = <6>; /* alt2 */ ++ brcm,pull = <0>; /* no pull */ ++ }; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/dwc-otg-overlay.dts b/arch/arm/boot/dts/overlays/dwc-otg-overlay.dts +new file mode 100644 +index 0000000..fc48bd1 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/dwc-otg-overlay.dts +@@ -0,0 +1,20 @@ ++/dts-v1/; ++/plugin/; ++ ++/{ ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&usb>; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ __overlay__ { ++ compatible = "brcm,bcm2708-usb"; ++ reg = <0x7e980000 0x10000>, ++ <0x7e006000 0x1000>; ++ interrupts = <2 0>, ++ <1 9>; ++ status = "okay"; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/dwc2-overlay.dts b/arch/arm/boot/dts/overlays/dwc2-overlay.dts +new file mode 100644 +index 0000000..527abc9 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/dwc2-overlay.dts +@@ -0,0 +1,29 @@ ++/dts-v1/; ++/plugin/; ++ ++/{ ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&usb>; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ dwc2_usb: __overlay__ { ++ compatible = "brcm,bcm2835-usb"; ++ reg = <0x7e980000 0x10000>; ++ interrupts = <1 9>; ++ dr_mode = "otg"; ++ g-np-tx-fifo-size = <32>; ++ g-rx-fifo-size = <256>; ++ g-tx-fifo-size = <256 128 128 64 64 64 32>; ++ status = "okay"; ++ }; ++ }; ++ ++ __overrides__ { ++ dr_mode = <&dwc2_usb>, "dr_mode"; ++ g-np-tx-fifo-size = <&dwc2_usb>,"g-np-tx-fifo-size:0"; ++ g-rx-fifo-size = <&dwc2_usb>,"g-rx-fifo-size:0"; ++ g-tx-fifo-size = <&dwc2_usb>,"g-tx-fifo-size:0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/enc28j60-overlay.dts b/arch/arm/boot/dts/overlays/enc28j60-overlay.dts +new file mode 100644 +index 0000000..db8a8fe +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/enc28j60-overlay.dts +@@ -0,0 +1,53 @@ ++// Overlay for the Microchip ENC28J60 Ethernet Controller ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&spi0>; ++ __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ status = "okay"; ++ ++ eth1: enc28j60@0{ ++ compatible = "microchip,enc28j60"; ++ reg = <0>; /* CE0 */ ++ pinctrl-names = "default"; ++ pinctrl-0 = <&eth1_pins>; ++ interrupt-parent = <&gpio>; ++ interrupts = <25 0x2>; /* falling edge */ ++ spi-max-frequency = <12000000>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&spidev0>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&gpio>; ++ __overlay__ { ++ eth1_pins: eth1_pins { ++ brcm,pins = <25>; ++ brcm,function = <0>; /* in */ ++ brcm,pull = <0>; /* none */ ++ }; ++ }; ++ }; ++ ++ __overrides__ { ++ int_pin = <&eth1>, "interrupts:0", ++ <&eth1_pins>, "brcm,pins:0"; ++ speed = <&eth1>, "spi-max-frequency:0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/gpio-ir-overlay.dts b/arch/arm/boot/dts/overlays/gpio-ir-overlay.dts +new file mode 100644 +index 0000000..a2d6bc7 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/gpio-ir-overlay.dts +@@ -0,0 +1,45 @@ ++// Definitions for ir-gpio module ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target-path = "/"; ++ __overlay__ { ++ gpio_ir: ir-receiver { ++ compatible = "gpio-ir-receiver"; ++ ++ // pin number, high or low ++ gpios = <&gpio 18 1>; ++ ++ // parameter for keymap name ++ linux,rc-map-name = "rc-rc6-mce"; ++ ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ gpio_ir_pins: gpio_ir_pins { ++ brcm,pins = <18>; // pin 18 ++ brcm,function = <0>; // in ++ brcm,pull = <1>; // down ++ }; ++ }; ++ }; ++ ++ __overrides__ { ++ // parameters ++ gpio_pin = <&gpio_ir>,"gpios:4", ++ <&gpio_ir_pins>,"brcm,pins:0", ++ <&gpio_ir_pins>,"brcm,pull:0"; // pin number ++ gpio_pull = <&gpio_ir_pins>,"brcm,pull:0"; // pull-up/down state ++ ++ rc-map-name = <&gpio_ir>,"linux,rc-map-name"; // default rc map ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/gpio-poweroff-overlay.dts b/arch/arm/boot/dts/overlays/gpio-poweroff-overlay.dts +new file mode 100644 +index 0000000..ff8cb36 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/gpio-poweroff-overlay.dts +@@ -0,0 +1,34 @@ ++// Definitions for gpio-poweroff module ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target-path = "/"; ++ __overlay__ { ++ power_ctrl: power_ctrl { ++ compatible = "gpio-poweroff"; ++ gpios = <&gpio 26 0>; ++ force; ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ power_ctrl_pins: power_ctrl_pins { ++ brcm,pins = <26>; ++ brcm,function = <1>; // out ++ }; ++ }; ++ }; ++ ++ __overrides__ { ++ gpiopin = <&power_ctrl>,"gpios:4", ++ <&power_ctrl_pins>,"brcm,pins:0"; ++ active_low = <&power_ctrl>,"gpios:8"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/hifiberry-amp-overlay.dts b/arch/arm/boot/dts/overlays/hifiberry-amp-overlay.dts +new file mode 100644 +index 0000000..5f57855 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/hifiberry-amp-overlay.dts +@@ -0,0 +1,39 @@ ++// Definitions for HiFiBerry Amp/Amp+ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&i2s>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&i2c1>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ tas5713@1b { ++ #sound-dai-cells = <0>; ++ compatible = "ti,tas5713"; ++ reg = <0x1b>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&sound>; ++ __overlay__ { ++ compatible = "hifiberry,hifiberry-amp"; ++ i2s-controller = <&i2s>; ++ status = "okay"; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/hifiberry-dac-overlay.dts b/arch/arm/boot/dts/overlays/hifiberry-dac-overlay.dts +new file mode 100644 +index 0000000..0b74fdc +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/hifiberry-dac-overlay.dts +@@ -0,0 +1,34 @@ ++// Definitions for HiFiBerry DAC ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&i2s>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target-path = "/"; ++ __overlay__ { ++ pcm5102a-codec { ++ #sound-dai-cells = <0>; ++ compatible = "ti,pcm5102a"; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&sound>; ++ __overlay__ { ++ compatible = "hifiberry,hifiberry-dac"; ++ i2s-controller = <&i2s>; ++ status = "okay"; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts b/arch/arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts +new file mode 100644 +index 0000000..2f078d4 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts +@@ -0,0 +1,56 @@ ++// Definitions for HiFiBerry DAC+ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target-path = "/clocks"; ++ __overlay__ { ++ dacpro_osc: dacpro_osc { ++ compatible = "hifiberry,dacpro-clk"; ++ #clock-cells = <0>; ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&i2s>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&i2c1>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ pcm5122@4d { ++ #sound-dai-cells = <0>; ++ compatible = "ti,pcm5122"; ++ reg = <0x4d>; ++ clocks = <&dacpro_osc>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@3 { ++ target = <&sound>; ++ hifiberry_dacplus: __overlay__ { ++ compatible = "hifiberry,hifiberry-dacplus"; ++ i2s-controller = <&i2s>; ++ status = "okay"; ++ }; ++ }; ++ ++ __overrides__ { ++ 24db_digital_gain = ++ <&hifiberry_dacplus>,"hifiberry,24db_digital_gain?"; ++ slave = <&hifiberry_dacplus>,"hifiberry-dacplus,slave?"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/hifiberry-digi-overlay.dts b/arch/arm/boot/dts/overlays/hifiberry-digi-overlay.dts +new file mode 100644 +index 0000000..f5e41f4 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/hifiberry-digi-overlay.dts +@@ -0,0 +1,39 @@ ++// Definitions for HiFiBerry Digi ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&i2s>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&i2c1>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ wm8804@3b { ++ #sound-dai-cells = <0>; ++ compatible = "wlf,wm8804"; ++ reg = <0x3b>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&sound>; ++ __overlay__ { ++ compatible = "hifiberry,hifiberry-digi"; ++ i2s-controller = <&i2s>; ++ status = "okay"; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/hy28a-overlay.dts b/arch/arm/boot/dts/overlays/hy28a-overlay.dts +new file mode 100644 +index 0000000..ac0f3c2 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/hy28a-overlay.dts +@@ -0,0 +1,93 @@ ++/* ++ * Device Tree overlay for HY28A display ++ * ++ */ ++ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; ++ ++ fragment@0 { ++ target = <&spi0>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&spidev0>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&spidev1>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; ++ ++ fragment@3 { ++ target = <&gpio>; ++ __overlay__ { ++ hy28a_pins: hy28a_pins { ++ brcm,pins = <17 25 18>; ++ brcm,function = <0 1 1>; /* in out out */ ++ }; ++ }; ++ }; ++ ++ fragment@4 { ++ target = <&spi0>; ++ __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ hy28a: hy28a@0{ ++ compatible = "ilitek,ili9320"; ++ reg = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&hy28a_pins>; ++ ++ spi-max-frequency = <32000000>; ++ spi-cpol; ++ spi-cpha; ++ rotate = <270>; ++ bgr; ++ fps = <50>; ++ buswidth = <8>; ++ startbyte = <0x70>; ++ reset-gpios = <&gpio 25 0>; ++ led-gpios = <&gpio 18 1>; ++ debug = <0>; ++ }; ++ ++ hy28a_ts: hy28a-ts@1 { ++ compatible = "ti,ads7846"; ++ reg = <1>; ++ ++ spi-max-frequency = <2000000>; ++ interrupts = <17 2>; /* high-to-low edge triggered */ ++ interrupt-parent = <&gpio>; ++ pendown-gpio = <&gpio 17 0>; ++ ti,x-plate-ohms = /bits/ 16 <100>; ++ ti,pressure-max = /bits/ 16 <255>; ++ }; ++ }; ++ }; ++ __overrides__ { ++ speed = <&hy28a>,"spi-max-frequency:0"; ++ rotate = <&hy28a>,"rotate:0"; ++ fps = <&hy28a>,"fps:0"; ++ debug = <&hy28a>,"debug:0"; ++ xohms = <&hy28a_ts>,"ti,x-plate-ohms;0"; ++ resetgpio = <&hy28a>,"reset-gpios:4", ++ <&hy28a_pins>, "brcm,pins:1"; ++ ledgpio = <&hy28a>,"led-gpios:4", ++ <&hy28a_pins>, "brcm,pins:2"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/hy28b-overlay.dts b/arch/arm/boot/dts/overlays/hy28b-overlay.dts +new file mode 100644 +index 0000000..8018aeb +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/hy28b-overlay.dts +@@ -0,0 +1,148 @@ ++/* ++ * Device Tree overlay for HY28b display shield by Texy ++ * ++ */ ++ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; ++ ++ fragment@0 { ++ target = <&spi0>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&spidev0>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&spidev1>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; ++ ++ fragment@3 { ++ target = <&gpio>; ++ __overlay__ { ++ hy28b_pins: hy28b_pins { ++ brcm,pins = <17 25 18>; ++ brcm,function = <0 1 1>; /* in out out */ ++ }; ++ }; ++ }; ++ ++ fragment@4 { ++ target = <&spi0>; ++ __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ hy28b: hy28b@0{ ++ compatible = "ilitek,ili9325"; ++ reg = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&hy28b_pins>; ++ ++ spi-max-frequency = <48000000>; ++ spi-cpol; ++ spi-cpha; ++ rotate = <270>; ++ bgr; ++ fps = <50>; ++ buswidth = <8>; ++ startbyte = <0x70>; ++ reset-gpios = <&gpio 25 0>; ++ led-gpios = <&gpio 18 1>; ++ ++ gamma = "04 1F 4 7 7 0 7 7 6 0\n0F 00 1 7 4 0 0 0 6 7"; ++ ++ init = <0x10000e7 0x0010 ++ 0x1000000 0x0001 ++ 0x1000001 0x0100 ++ 0x1000002 0x0700 ++ 0x1000003 0x1030 ++ 0x1000004 0x0000 ++ 0x1000008 0x0207 ++ 0x1000009 0x0000 ++ 0x100000a 0x0000 ++ 0x100000c 0x0001 ++ 0x100000d 0x0000 ++ 0x100000f 0x0000 ++ 0x1000010 0x0000 ++ 0x1000011 0x0007 ++ 0x1000012 0x0000 ++ 0x1000013 0x0000 ++ 0x2000032 ++ 0x1000010 0x1590 ++ 0x1000011 0x0227 ++ 0x2000032 ++ 0x1000012 0x009c ++ 0x2000032 ++ 0x1000013 0x1900 ++ 0x1000029 0x0023 ++ 0x100002b 0x000e ++ 0x2000032 ++ 0x1000020 0x0000 ++ 0x1000021 0x0000 ++ 0x2000032 ++ 0x1000050 0x0000 ++ 0x1000051 0x00ef ++ 0x1000052 0x0000 ++ 0x1000053 0x013f ++ 0x1000060 0xa700 ++ 0x1000061 0x0001 ++ 0x100006a 0x0000 ++ 0x1000080 0x0000 ++ 0x1000081 0x0000 ++ 0x1000082 0x0000 ++ 0x1000083 0x0000 ++ 0x1000084 0x0000 ++ 0x1000085 0x0000 ++ 0x1000090 0x0010 ++ 0x1000092 0x0000 ++ 0x1000093 0x0003 ++ 0x1000095 0x0110 ++ 0x1000097 0x0000 ++ 0x1000098 0x0000 ++ 0x1000007 0x0133 ++ 0x1000020 0x0000 ++ 0x1000021 0x0000 ++ 0x2000064>; ++ debug = <0>; ++ }; ++ ++ hy28b_ts: hy28b-ts@1 { ++ compatible = "ti,ads7846"; ++ reg = <1>; ++ ++ spi-max-frequency = <2000000>; ++ interrupts = <17 2>; /* high-to-low edge triggered */ ++ interrupt-parent = <&gpio>; ++ pendown-gpio = <&gpio 17 0>; ++ ti,x-plate-ohms = /bits/ 16 <100>; ++ ti,pressure-max = /bits/ 16 <255>; ++ }; ++ }; ++ }; ++ __overrides__ { ++ speed = <&hy28b>,"spi-max-frequency:0"; ++ rotate = <&hy28b>,"rotate:0"; ++ fps = <&hy28b>,"fps:0"; ++ debug = <&hy28b>,"debug:0"; ++ xohms = <&hy28b_ts>,"ti,x-plate-ohms;0"; ++ resetgpio = <&hy28b>,"reset-gpios:4", ++ <&hy28b_pins>, "brcm,pins:1"; ++ ledgpio = <&hy28b>,"led-gpios:4", ++ <&hy28b_pins>, "brcm,pins:2"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/i2c-gpio-overlay.dts b/arch/arm/boot/dts/overlays/i2c-gpio-overlay.dts +new file mode 100644 +index 0000000..2a2dc98 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/i2c-gpio-overlay.dts +@@ -0,0 +1,28 @@ ++// Overlay for i2c_gpio bitbanging host bus. ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target-path = "/"; ++ __overlay__ { ++ i2c_gpio: i2c@0 { ++ compatible = "i2c-gpio"; ++ gpios = <&gpio 23 0 /* sda */ ++ &gpio 24 0 /* scl */ ++ >; ++ i2c-gpio,delay-us = <2>; /* ~100 kHz */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ }; ++ }; ++ }; ++ __overrides__ { ++ i2c_gpio_sda = <&i2c_gpio>,"gpios:4"; ++ i2c_gpio_scl = <&i2c_gpio>,"gpios:16"; ++ i2c_gpio_delay_us = <&i2c_gpio>,"i2c-gpio,delay-us:0"; ++ }; ++}; ++ +diff --git a/arch/arm/boot/dts/overlays/i2c-mux-overlay.dts b/arch/arm/boot/dts/overlays/i2c-mux-overlay.dts +new file mode 100644 +index 0000000..976d38e +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/i2c-mux-overlay.dts +@@ -0,0 +1,139 @@ ++// Umbrella I2C Mux overlay ++ ++/dts-v1/; ++/plugin/; ++ ++/{ ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&i2c_arm>; ++ __dormant__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ pca9542: mux@70 { ++ compatible = "nxp,pca9542"; ++ reg = <0x70>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ i2c@0 { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ reg = <0>; ++ }; ++ i2c@1 { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ reg = <1>; ++ }; ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&i2c_arm>; ++ __dormant__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ pca9545: mux@70 { ++ compatible = "nxp,pca9545"; ++ reg = <0x70>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ i2c@0 { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ reg = <0>; ++ }; ++ i2c@1 { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ reg = <1>; ++ }; ++ i2c@2 { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ reg = <2>; ++ }; ++ i2c@3 { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ reg = <3>; ++ }; ++ }; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&i2c_arm>; ++ __dormant__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ pca9548: mux@70 { ++ compatible = "nxp,pca9548"; ++ reg = <0x70>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ i2c@0 { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ reg = <0>; ++ }; ++ i2c@1 { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ reg = <1>; ++ }; ++ i2c@2 { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ reg = <2>; ++ }; ++ i2c@3 { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ reg = <3>; ++ }; ++ i2c@4 { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ reg = <4>; ++ }; ++ i2c@5 { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ reg = <5>; ++ }; ++ i2c@6 { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ reg = <6>; ++ }; ++ i2c@7 { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ reg = <7>; ++ }; ++ }; ++ }; ++ }; ++ ++ __overrides__ { ++ pca9542 = <0>, "+0"; ++ pca9545 = <0>, "+1"; ++ pca9548 = <0>, "+2"; ++ ++ addr = <&pca9542>,"reg:0", ++ <&pca9545>,"reg:0", ++ <&pca9548>,"reg:0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/i2c-pwm-pca9685a-overlay.dts b/arch/arm/boot/dts/overlays/i2c-pwm-pca9685a-overlay.dts +new file mode 100644 +index 0000000..d1ffd23 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/i2c-pwm-pca9685a-overlay.dts +@@ -0,0 +1,26 @@ ++// Definitions for NXP PCA9685A I2C PWM controller on ARM I2C bus. ++/dts-v1/; ++/plugin/; ++ ++/{ ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&i2c_arm>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ pca: pca@40 { ++ compatible = "nxp,pca9685"; ++ #pwm-cells = <2>; ++ reg = <0x40>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ __overrides__ { ++ addr = <&pca>,"reg:0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts b/arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts +new file mode 100644 +index 0000000..4065647 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts +@@ -0,0 +1,69 @@ ++// Definitions for several I2C based Real Time Clocks ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&i2c_arm>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ ds1307: ds1307@68 { ++ compatible = "maxim,ds1307"; ++ reg = <0x68>; ++ status = "disable"; ++ }; ++ ds1339: ds1339@68 { ++ compatible = "dallas,ds1339"; ++ trickle-resistor-ohms = <0>; ++ reg = <0x68>; ++ status = "disable"; ++ }; ++ mcp7940x: mcp7940x@6f { ++ compatible = "microchip,mcp7940x"; ++ reg = <0x6f>; ++ status = "disable"; ++ }; ++ mcp7941x: mcp7941x@6f { ++ compatible = "microchip,mcp7941x"; ++ reg = <0x6f>; ++ status = "disable"; ++ }; ++ ds3231: ds3231@68 { ++ compatible = "maxim,ds3231"; ++ reg = <0x68>; ++ status = "disable"; ++ }; ++ pcf2127: pcf2127@51 { ++ compatible = "nxp,pcf2127"; ++ reg = <0x51>; ++ status = "disable"; ++ }; ++ pcf8523: pcf8523@68 { ++ compatible = "nxp,pcf8523"; ++ reg = <0x68>; ++ status = "disable"; ++ }; ++ pcf8563: pcf8563@51 { ++ compatible = "nxp,pcf8563"; ++ reg = <0x51>; ++ status = "disable"; ++ }; ++ }; ++ }; ++ __overrides__ { ++ ds1307 = <&ds1307>,"status"; ++ ds1339 = <&ds1339>,"status"; ++ ds3231 = <&ds3231>,"status"; ++ mcp7940x = <&mcp7940x>,"status"; ++ mcp7941x = <&mcp7941x>,"status"; ++ pcf2127 = <&pcf2127>,"status"; ++ pcf8523 = <&pcf8523>,"status"; ++ pcf8563 = <&pcf8563>,"status"; ++ trickle-resistor-ohms = <&ds1339>,"trickle-resistor-ohms:0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/i2c0-bcm2708-overlay.dts b/arch/arm/boot/dts/overlays/i2c0-bcm2708-overlay.dts +new file mode 100644 +index 0000000..1f4fc7b +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/i2c0-bcm2708-overlay.dts +@@ -0,0 +1,61 @@ ++/* ++ * Device tree overlay for i2c_bcm2708, i2c0 bus ++ * ++ * Compile: ++ * dtc -@ -I dts -O dtb -o i2c0-bcm2708-overlay.dtb i2c0-bcm2708-overlay.dts ++ */ ++ ++/dts-v1/; ++/plugin/; ++ ++/{ ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&i2c0>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&i2c0_pins>; ++ frag1: __overlay__ { ++ brcm,pins = <0 1>; ++ brcm,function = <4>; /* alt0 */ ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&i2c0_pins>; ++ __dormant__ { ++ brcm,pins = <28 29>; ++ brcm,function = <4>; /* alt0 */ ++ }; ++ }; ++ ++ fragment@3 { ++ target = <&i2c0_pins>; ++ __dormant__ { ++ brcm,pins = <44 45>; ++ brcm,function = <5>; /* alt1 */ ++ }; ++ }; ++ ++ fragment@4 { ++ target = <&i2c0_pins>; ++ __dormant__ { ++ brcm,pins = <46 47>; ++ brcm,function = <4>; /* alt0 */ ++ }; ++ }; ++ ++ __overrides__ { ++ sda0_pin = <&frag1>,"brcm,pins:0"; ++ scl0_pin = <&frag1>,"brcm,pins:4"; ++ pins_0_1 = <0>,"+1-2-3-4"; ++ pins_28_29 = <0>,"-1+2-3-4"; ++ pins_44_45 = <0>,"-1-2+3-4"; ++ pins_46_47 = <0>,"-1-2-3+4"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/i2c1-bcm2708-overlay.dts b/arch/arm/boot/dts/overlays/i2c1-bcm2708-overlay.dts +new file mode 100644 +index 0000000..e303b9c +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/i2c1-bcm2708-overlay.dts +@@ -0,0 +1,37 @@ ++/* ++ * Device tree overlay for i2c_bcm2708, i2c1 bus ++ * ++ * Compile: ++ * dtc -@ -I dts -O dtb -o i2c1-bcm2708-overlay.dtb i2c1-bcm2708-overlay.dts ++ */ ++ ++/dts-v1/; ++/plugin/; ++ ++/{ ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&i2c1>; ++ __overlay__ { ++ pinctrl-0 = <&i2c1_pins>; ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ i2c1_pins: i2c1 { ++ brcm,pins = <2 3>; ++ brcm,function = <4>; /* alt0 */ ++ }; ++ }; ++ }; ++ ++ __overrides__ { ++ sda1_pin = <&i2c1_pins>,"brcm,pins:0"; ++ scl1_pin = <&i2c1_pins>,"brcm,pins:4"; ++ pin_func = <&i2c1_pins>,"brcm,function:0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/i2s-gpio28-31-overlay.dts b/arch/arm/boot/dts/overlays/i2s-gpio28-31-overlay.dts +new file mode 100644 +index 0000000..30c356d6 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/i2s-gpio28-31-overlay.dts +@@ -0,0 +1,18 @@ ++/* ++ * Device tree overlay to move i2s to gpio 28 to 31 on CM ++ */ ++ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2836", "brcm,bcm2708", "brcm,bcm2709"; ++ ++ fragment@0 { ++ target = <&i2s_pins>; ++ __overlay__ { ++ brcm,pins = <28 29 30 31>; ++ brcm,function = <6>; /* alt2 */ ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/i2s-mmap-overlay.dts b/arch/arm/boot/dts/overlays/i2s-mmap-overlay.dts +new file mode 100644 +index 0000000..a11160a +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/i2s-mmap-overlay.dts +@@ -0,0 +1,13 @@ ++/dts-v1/; ++/plugin/; ++ ++/{ ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&i2s>; ++ __overlay__ { ++ brcm,enable-mmap; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/iqaudio-dac-overlay.dts b/arch/arm/boot/dts/overlays/iqaudio-dac-overlay.dts +new file mode 100644 +index 0000000..0d35c85 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/iqaudio-dac-overlay.dts +@@ -0,0 +1,43 @@ ++// Definitions for IQaudIO DAC ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&i2s>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&i2c1>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ pcm5122@4c { ++ #sound-dai-cells = <0>; ++ compatible = "ti,pcm5122"; ++ reg = <0x4c>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&sound>; ++ frag2: __overlay__ { ++ compatible = "iqaudio,iqaudio-dac"; ++ i2s-controller = <&i2s>; ++ status = "okay"; ++ }; ++ }; ++ ++ __overrides__ { ++ 24db_digital_gain = <&frag2>,"iqaudio,24db_digital_gain?"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/iqaudio-dacplus-overlay.dts b/arch/arm/boot/dts/overlays/iqaudio-dacplus-overlay.dts +new file mode 100644 +index 0000000..1d0663e +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/iqaudio-dacplus-overlay.dts +@@ -0,0 +1,43 @@ ++// Definitions for IQaudIO DAC+ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&i2s>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&i2c1>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ pcm5122@4c { ++ #sound-dai-cells = <0>; ++ compatible = "ti,pcm5122"; ++ reg = <0x4c>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&sound>; ++ frag2: __overlay__ { ++ compatible = "iqaudio,iqaudio-dac"; ++ i2s-controller = <&i2s>; ++ status = "okay"; ++ }; ++ }; ++ ++ __overrides__ { ++ 24db_digital_gain = <&frag2>,"iqaudio,24db_digital_gain?"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/justboom-dac-overlay.dts b/arch/arm/boot/dts/overlays/justboom-dac-overlay.dts +new file mode 100644 +index 0000000..312632a +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/justboom-dac-overlay.dts +@@ -0,0 +1,43 @@ ++// Definitions for JustBoom DAC ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&i2s>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&i2c1>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ pcm5122@4d { ++ #sound-dai-cells = <0>; ++ compatible = "ti,pcm5122"; ++ reg = <0x4d>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&sound>; ++ frag2: __overlay__ { ++ compatible = "justboom,justboom-dac"; ++ i2s-controller = <&i2s>; ++ status = "okay"; ++ }; ++ }; ++ ++ __overrides__ { ++ 24db_digital_gain = <&frag2>,"justboom,24db_digital_gain?"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/justboom-digi-overlay.dts b/arch/arm/boot/dts/overlays/justboom-digi-overlay.dts +new file mode 100644 +index 0000000..cbbede9 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/justboom-digi-overlay.dts +@@ -0,0 +1,39 @@ ++// Definitions for JustBoom Digi ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&i2s>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&i2c1>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ wm8804@3b { ++ #sound-dai-cells = <0>; ++ compatible = "wlf,wm8804"; ++ reg = <0x3b>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&sound>; ++ __overlay__ { ++ compatible = "justboom,justboom-digi"; ++ i2s-controller = <&i2s>; ++ status = "okay"; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/lirc-rpi-overlay.dts b/arch/arm/boot/dts/overlays/lirc-rpi-overlay.dts +new file mode 100644 +index 0000000..7d5d82b +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/lirc-rpi-overlay.dts +@@ -0,0 +1,57 @@ ++// Definitions for lirc-rpi module ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target-path = "/"; ++ __overlay__ { ++ lirc_rpi: lirc_rpi { ++ compatible = "rpi,lirc-rpi"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&lirc_pins>; ++ status = "okay"; ++ ++ // Override autodetection of IR receiver circuit ++ // (0 = active high, 1 = active low, -1 = no override ) ++ rpi,sense = <0xffffffff>; ++ ++ // Software carrier ++ // (0 = off, 1 = on) ++ rpi,softcarrier = <1>; ++ ++ // Invert output ++ // (0 = off, 1 = on) ++ rpi,invert = <0>; ++ ++ // Enable debugging messages ++ // (0 = off, 1 = on) ++ rpi,debug = <0>; ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ lirc_pins: lirc_pins { ++ brcm,pins = <17 18>; ++ brcm,function = <1 0>; // out in ++ brcm,pull = <0 1>; // off down ++ }; ++ }; ++ }; ++ ++ __overrides__ { ++ gpio_out_pin = <&lirc_pins>,"brcm,pins:0"; ++ gpio_in_pin = <&lirc_pins>,"brcm,pins:4"; ++ gpio_in_pull = <&lirc_pins>,"brcm,pull:4"; ++ ++ sense = <&lirc_rpi>,"rpi,sense:0"; ++ softcarrier = <&lirc_rpi>,"rpi,softcarrier:0"; ++ invert = <&lirc_rpi>,"rpi,invert:0"; ++ debug = <&lirc_rpi>,"rpi,debug:0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/mcp23017-overlay.dts b/arch/arm/boot/dts/overlays/mcp23017-overlay.dts +new file mode 100644 +index 0000000..412f966 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/mcp23017-overlay.dts +@@ -0,0 +1,54 @@ ++// Definitions for MCP23017 Gpio Extender from Microchip Semiconductor ++ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; ++ ++ fragment@0 { ++ target = <&i2c1>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ mcp23017_pins: mcp23017_pins { ++ brcm,pins = <4>; ++ brcm,function = <0>; ++ }; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&i2c1>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ mcp23017: mcp@20 { ++ compatible = "microchip,mcp23017"; ++ reg = <0x20>; ++ gpio-controller; ++ #gpio-cells = <2>; ++ #interrupt-cells=<2>; ++ interrupt-parent = <&gpio>; ++ interrupts = <4 2>; ++ interrupt-controller; ++ microchip,irq-mirror; ++ ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ __overrides__ { ++ gpiopin = <&mcp23017_pins>,"brcm,pins:0", ++ <&mcp23017>,"interrupts:0"; ++ addr = <&mcp23017>,"reg:0"; ++ }; ++}; ++ +diff --git a/arch/arm/boot/dts/overlays/mcp2515-can0-overlay.dts b/arch/arm/boot/dts/overlays/mcp2515-can0-overlay.dts +new file mode 100755 +index 0000000..c96cdae +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/mcp2515-can0-overlay.dts +@@ -0,0 +1,73 @@ ++/* ++ * Device tree overlay for mcp251x/can0 on spi0.0 ++ */ ++ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2836", "brcm,bcm2708", "brcm,bcm2709"; ++ /* disable spi-dev for spi0.0 */ ++ fragment@0 { ++ target = <&spi0>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&spidev0>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; ++ ++ /* the interrupt pin of the can-controller */ ++ fragment@2 { ++ target = <&gpio>; ++ __overlay__ { ++ can0_pins: can0_pins { ++ brcm,pins = <25>; ++ brcm,function = <0>; /* input */ ++ }; ++ }; ++ }; ++ ++ /* the clock/oscillator of the can-controller */ ++ fragment@3 { ++ target-path = "/clocks"; ++ __overlay__ { ++ /* external oscillator of mcp2515 on SPI0.0 */ ++ can0_osc: can0_osc { ++ compatible = "fixed-clock"; ++ #clock-cells = <0>; ++ clock-frequency = <16000000>; ++ }; ++ }; ++ }; ++ ++ /* the spi config of the can-controller itself binding everything together */ ++ fragment@4 { ++ target = <&spi0>; ++ __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ can0: mcp2515@0 { ++ reg = <0>; ++ compatible = "microchip,mcp2515"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&can0_pins>; ++ spi-max-frequency = <10000000>; ++ interrupt-parent = <&gpio>; ++ interrupts = <25 0x2>; ++ clocks = <&can0_osc>; ++ }; ++ }; ++ }; ++ __overrides__ { ++ oscillator = <&can0_osc>,"clock-frequency:0"; ++ spimaxfrequency = <&can0>,"spi-max-frequency:0"; ++ interrupt = <&can0_pins>,"brcm,pins:0",<&can0>,"interrupts:0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/mcp2515-can1-overlay.dts b/arch/arm/boot/dts/overlays/mcp2515-can1-overlay.dts +new file mode 100644 +index 0000000..67bd0d9 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/mcp2515-can1-overlay.dts +@@ -0,0 +1,73 @@ ++/* ++ * Device tree overlay for mcp251x/can1 on spi0.1 edited by petit_miner ++ */ ++ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2836", "brcm,bcm2708", "brcm,bcm2709"; ++ /* disable spi-dev for spi0.1 */ ++ fragment@0 { ++ target = <&spi0>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&spidev1>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; ++ ++ /* the interrupt pin of the can-controller */ ++ fragment@2 { ++ target = <&gpio>; ++ __overlay__ { ++ can1_pins: can1_pins { ++ brcm,pins = <25>; ++ brcm,function = <0>; /* input */ ++ }; ++ }; ++ }; ++ ++ /* the clock/oscillator of the can-controller */ ++ fragment@3 { ++ target-path = "/clocks"; ++ __overlay__ { ++ /* external oscillator of mcp2515 on spi0.1 */ ++ can1_osc: can1_osc { ++ compatible = "fixed-clock"; ++ #clock-cells = <0>; ++ clock-frequency = <16000000>; ++ }; ++ }; ++ }; ++ ++ /* the spi config of the can-controller itself binding everything together */ ++ fragment@4 { ++ target = <&spi0>; ++ __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ can1: mcp2515@1 { ++ reg = <1>; ++ compatible = "microchip,mcp2515"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&can1_pins>; ++ spi-max-frequency = <10000000>; ++ interrupt-parent = <&gpio>; ++ interrupts = <25 0x2>; ++ clocks = <&can1_osc>; ++ }; ++ }; ++ }; ++ __overrides__ { ++ oscillator = <&can1_osc>,"clock-frequency:0"; ++ spimaxfrequency = <&can1>,"spi-max-frequency:0"; ++ interrupt = <&can1_pins>,"brcm,pins:0",<&can1>,"interrupts:0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/mmc-overlay.dts b/arch/arm/boot/dts/overlays/mmc-overlay.dts +new file mode 100644 +index 0000000..d32b02c +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/mmc-overlay.dts +@@ -0,0 +1,38 @@ ++/dts-v1/; ++/plugin/; ++ ++/{ ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&mmc>; ++ frag0: __overlay__ { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&mmc_pins>; ++ bus-width = <4>; ++ brcm,overclock-50 = <0>; ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ mmc_pins: mmc_pins { ++ brcm,pins = <48 49 50 51 52 53>; ++ brcm,function = <7>; /* alt3 */ ++ }; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&sdhost>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; ++ ++ __overrides__ { ++ overclock_50 = <&frag0>,"brcm,overclock-50:0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/mz61581-overlay.dts b/arch/arm/boot/dts/overlays/mz61581-overlay.dts +new file mode 100644 +index 0000000..2c29aae +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/mz61581-overlay.dts +@@ -0,0 +1,117 @@ ++/* ++ * Device Tree overlay for MZ61581-PI-EXT 2014.12.28 by Tontec ++ * ++ */ ++ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; ++ ++ fragment@0 { ++ target = <&spi0>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&spidev0>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&spidev1>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; ++ ++ fragment@3 { ++ target = <&gpio>; ++ __overlay__ { ++ mz61581_pins: mz61581_pins { ++ brcm,pins = <4 15 18 25>; ++ brcm,function = <0 1 1 1>; /* in out out out */ ++ }; ++ }; ++ }; ++ ++ fragment@4 { ++ target = <&spi0>; ++ __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ mz61581: mz61581@0{ ++ compatible = "samsung,s6d02a1"; ++ reg = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&mz61581_pins>; ++ ++ spi-max-frequency = <128000000>; ++ spi-cpol; ++ spi-cpha; ++ ++ width = <320>; ++ height = <480>; ++ rotate = <270>; ++ bgr; ++ fps = <30>; ++ buswidth = <8>; ++ txbuflen = <32768>; ++ ++ reset-gpios = <&gpio 15 0>; ++ dc-gpios = <&gpio 25 0>; ++ led-gpios = <&gpio 18 0>; ++ ++ init = <0x10000b0 00 ++ 0x1000011 ++ 0x20000ff ++ 0x10000b3 0x02 0x00 0x00 0x00 ++ 0x10000c0 0x13 0x3b 0x00 0x02 0x00 0x01 0x00 0x43 ++ 0x10000c1 0x08 0x16 0x08 0x08 ++ 0x10000c4 0x11 0x07 0x03 0x03 ++ 0x10000c6 0x00 ++ 0x10000c8 0x03 0x03 0x13 0x5c 0x03 0x07 0x14 0x08 0x00 0x21 0x08 0x14 0x07 0x53 0x0c 0x13 0x03 0x03 0x21 0x00 ++ 0x1000035 0x00 ++ 0x1000036 0xa0 ++ 0x100003a 0x55 ++ 0x1000044 0x00 0x01 ++ 0x10000d0 0x07 0x07 0x1d 0x03 ++ 0x10000d1 0x03 0x30 0x10 ++ 0x10000d2 0x03 0x14 0x04 ++ 0x1000029 ++ 0x100002c>; ++ ++ /* This is a workaround to make sure the init sequence slows down and doesn't fail */ ++ debug = <3>; ++ }; ++ ++ mz61581_ts: mz61581_ts@1 { ++ compatible = "ti,ads7846"; ++ reg = <1>; ++ ++ spi-max-frequency = <2000000>; ++ interrupts = <4 2>; /* high-to-low edge triggered */ ++ interrupt-parent = <&gpio>; ++ pendown-gpio = <&gpio 4 0>; ++ ++ ti,x-plate-ohms = /bits/ 16 <60>; ++ ti,pressure-max = /bits/ 16 <255>; ++ }; ++ }; ++ }; ++ __overrides__ { ++ speed = <&mz61581>, "spi-max-frequency:0"; ++ rotate = <&mz61581>, "rotate:0"; ++ fps = <&mz61581>, "fps:0"; ++ txbuflen = <&mz61581>, "txbuflen:0"; ++ debug = <&mz61581>, "debug:0"; ++ xohms = <&mz61581_ts>,"ti,x-plate-ohms;0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/pi3-act-led-overlay.dts b/arch/arm/boot/dts/overlays/pi3-act-led-overlay.dts +new file mode 100644 +index 0000000..14a59dc +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/pi3-act-led-overlay.dts +@@ -0,0 +1,27 @@ ++/dts-v1/; ++/plugin/; ++ ++/* Pi3 uses a GPIO expander to drive the LEDs which can only be accessed ++ from the VPU. There is a special driver for this with a separate DT node, ++ which has the unfortunate consequence of breaking the act_led_gpio and ++ act_led_activelow dtparams. ++ ++ This overlay changes the GPIO controller back to the standard one and ++ restores the dtparams. ++*/ ++ ++/{ ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&act_led>; ++ frag0: __overlay__ { ++ gpios = <&gpio 0 0>; ++ }; ++ }; ++ ++ __overrides__ { ++ gpio = <&frag0>,"gpios:4"; ++ activelow = <&frag0>,"gpios:8"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/pi3-disable-bt-overlay.dts b/arch/arm/boot/dts/overlays/pi3-disable-bt-overlay.dts +new file mode 100644 +index 0000000..68f6069 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/pi3-disable-bt-overlay.dts +@@ -0,0 +1,46 @@ ++/dts-v1/; ++/plugin/; ++ ++/* Disable Bluetooth and restore UART0/ttyAMA0 over GPIOs 14 & 15. ++ To disable the systemd service that initialises the modem so it doesn't use ++ the UART: ++ ++ sudo systemctl disable hciuart ++*/ ++ ++/{ ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&uart1>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&uart0>; ++ __overlay__ { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&uart0_pins>; ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&uart0_pins>; ++ __overlay__ { ++ brcm,pins; ++ brcm,function; ++ brcm,pull; ++ }; ++ }; ++ ++ fragment@3 { ++ target-path = "/aliases"; ++ __overlay__ { ++ serial0 = "/soc/uart@7e201000"; ++ serial1 = "/soc/uart@7e215040"; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/pi3-miniuart-bt-overlay.dts b/arch/arm/boot/dts/overlays/pi3-miniuart-bt-overlay.dts +new file mode 100644 +index 0000000..17d04cf +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/pi3-miniuart-bt-overlay.dts +@@ -0,0 +1,64 @@ ++/dts-v1/; ++/plugin/; ++ ++/* Switch Pi3 Bluetooth function to use the mini-UART (ttyS0) and restore ++ UART0/ttyAMA0 over GPIOs 14 & 15. Note that this may reduce the maximum ++ usable baudrate. ++ ++ It is also necessary to edit /lib/systemd/system/hciuart.service and ++ replace ttyAMA0 with ttyS0, unless you have a system with udev rules ++ that create /dev/serial0 and /dev/serial1, in which case use /dev/serial1 ++ instead because it will always be correct. ++ ++ If cmdline.txt uses the alias serial0 to refer to the user-accessable port ++ then the firmware will replace with the appropriate port whether or not ++ this overlay is used. ++*/ ++ ++/{ ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&uart0>; ++ __overlay__ { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&uart0_pins>; ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&uart1>; ++ __overlay__ { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&uart1_pins &bt_pins>; ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&uart0_pins>; ++ __overlay__ { ++ brcm,pins; ++ brcm,function; ++ brcm,pull; ++ }; ++ }; ++ ++ fragment@3 { ++ target = <&uart1_pins>; ++ __overlay__ { ++ brcm,pins = <32 33>; ++ brcm,function = <2>; /* alt5=UART1 */ ++ brcm,pull = <0 2>; ++ }; ++ }; ++ ++ fragment@4 { ++ target-path = "/aliases"; ++ __overlay__ { ++ serial0 = "/soc/uart@7e201000"; ++ serial1 = "/soc/uart@7e215040"; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/piscreen-overlay.dts b/arch/arm/boot/dts/overlays/piscreen-overlay.dts +new file mode 100644 +index 0000000..40a1f29 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/piscreen-overlay.dts +@@ -0,0 +1,102 @@ ++/* ++ * Device Tree overlay for PiScreen 3.5" display shield by Ozzmaker ++ * ++ */ ++ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; ++ ++ fragment@0 { ++ target = <&spi0>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&spidev0>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&spidev1>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; ++ ++ fragment@3 { ++ target = <&gpio>; ++ __overlay__ { ++ piscreen_pins: piscreen_pins { ++ brcm,pins = <17 25 24 22>; ++ brcm,function = <0 1 1 1>; /* in out out out */ ++ }; ++ }; ++ }; ++ ++ fragment@4 { ++ target = <&spi0>; ++ __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ piscreen: piscreen@0{ ++ compatible = "ilitek,ili9486"; ++ reg = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&piscreen_pins>; ++ ++ spi-max-frequency = <24000000>; ++ rotate = <270>; ++ bgr; ++ fps = <30>; ++ buswidth = <8>; ++ regwidth = <16>; ++ reset-gpios = <&gpio 25 0>; ++ dc-gpios = <&gpio 24 0>; ++ led-gpios = <&gpio 22 1>; ++ debug = <0>; ++ ++ init = <0x10000b0 0x00 ++ 0x1000011 ++ 0x20000ff ++ 0x100003a 0x55 ++ 0x1000036 0x28 ++ 0x10000c2 0x44 ++ 0x10000c5 0x00 0x00 0x00 0x00 ++ 0x10000e0 0x0f 0x1f 0x1c 0x0c 0x0f 0x08 0x48 0x98 0x37 0x0a 0x13 0x04 0x11 0x0d 0x00 ++ 0x10000e1 0x0f 0x32 0x2e 0x0b 0x0d 0x05 0x47 0x75 0x37 0x06 0x10 0x03 0x24 0x20 0x00 ++ 0x10000e2 0x0f 0x32 0x2e 0x0b 0x0d 0x05 0x47 0x75 0x37 0x06 0x10 0x03 0x24 0x20 0x00 ++ 0x1000011 ++ 0x1000029>; ++ }; ++ ++ piscreen_ts: piscreen-ts@1 { ++ compatible = "ti,ads7846"; ++ reg = <1>; ++ ++ spi-max-frequency = <2000000>; ++ interrupts = <17 2>; /* high-to-low edge triggered */ ++ interrupt-parent = <&gpio>; ++ pendown-gpio = <&gpio 17 0>; ++ ti,swap-xy; ++ ti,x-plate-ohms = /bits/ 16 <100>; ++ ti,pressure-max = /bits/ 16 <255>; ++ }; ++ }; ++ }; ++ __overrides__ { ++ speed = <&piscreen>,"spi-max-frequency:0"; ++ rotate = <&piscreen>,"rotate:0"; ++ fps = <&piscreen>,"fps:0"; ++ debug = <&piscreen>,"debug:0"; ++ xohms = <&piscreen_ts>,"ti,x-plate-ohms;0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/piscreen2r-overlay.dts b/arch/arm/boot/dts/overlays/piscreen2r-overlay.dts +new file mode 100644 +index 0000000..9c0bed8 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/piscreen2r-overlay.dts +@@ -0,0 +1,106 @@ ++ /* ++ * Device Tree overlay for PiScreen2 3.5" TFT with resistive touch by Ozzmaker.com ++ * ++ */ ++ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; ++ ++ fragment@0 { ++ target = <&spi0>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&spidev0>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&spidev1>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; ++ ++ fragment@3 { ++ target = <&gpio>; ++ __overlay__ { ++ piscreen2_pins: piscreen2_pins { ++ brcm,pins = <17 25 24 22>; ++ brcm,function = <0 1 1 1>; /* in out out out */ ++ }; ++ }; ++ }; ++ ++ fragment@4 { ++ target = <&spi0>; ++ __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ piscreen2: piscreen2@0{ ++ compatible = "ilitek,ili9486"; ++ reg = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&piscreen2_pins>; ++ bgr; ++ spi-max-frequency = <64000000>; ++ rotate = <90>; ++ fps = <30>; ++ buswidth = <8>; ++ regwidth = <16>; ++ txbuflen = <32768>; ++ reset-gpios = <&gpio 25 0>; ++ dc-gpios = <&gpio 24 0>; ++ led-gpios = <&gpio 22 1>; ++ debug = <0>; ++ ++ init = <0x10000b0 0x00 ++ 0x1000011 ++ 0x20000ff ++ 0x100003a 0x55 ++ 0x1000036 0x28 ++ 0x10000c0 0x11 0x09 ++ 0x10000c1 0x41 ++ 0x10000c5 0x00 0x00 0x00 0x00 ++ 0x10000b6 0x00 0x02 ++ 0x10000f7 0xa9 0x51 0x2c 0x2 ++ 0x10000be 0x00 0x04 ++ 0x10000e9 0x00 ++ 0x1000011 ++ 0x1000029>; ++ ++ }; ++ ++ piscreen2_ts: piscreen2-ts@1 { ++ compatible = "ti,ads7846"; ++ reg = <1>; ++ ++ spi-max-frequency = <2000000>; ++ interrupts = <17 2>; /* high-to-low edge triggered */ ++ interrupt-parent = <&gpio>; ++ pendown-gpio = <&gpio 17 0>; ++ ti,swap-xy; ++ ti,x-plate-ohms = /bits/ 16 <100>; ++ ti,pressure-max = /bits/ 16 <255>; ++ }; ++ }; ++ }; ++ __overrides__ { ++ speed = <&piscreen2>,"spi-max-frequency:0"; ++ rotate = <&piscreen2>,"rotate:0"; ++ fps = <&piscreen2>,"fps:0"; ++ debug = <&piscreen2>,"debug:0"; ++ xohms = <&piscreen2_ts>,"ti,x-plate-ohms;0"; ++ }; ++}; ++ +diff --git a/arch/arm/boot/dts/overlays/pitft22-overlay.dts b/arch/arm/boot/dts/overlays/pitft22-overlay.dts +new file mode 100644 +index 0000000..894ba22 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/pitft22-overlay.dts +@@ -0,0 +1,69 @@ ++/* ++ * Device Tree overlay for pitft by Adafruit ++ * ++ */ ++ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; ++ ++ fragment@0 { ++ target = <&spi0>; ++ __overlay__ { ++ status = "okay"; ++ ++ spidev@0{ ++ status = "disabled"; ++ }; ++ ++ spidev@1{ ++ status = "disabled"; ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ pitft_pins: pitft_pins { ++ brcm,pins = <25>; ++ brcm,function = <1>; /* out */ ++ brcm,pull = <0>; /* none */ ++ }; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&spi0>; ++ __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ pitft: pitft@0{ ++ compatible = "ilitek,ili9340"; ++ reg = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pitft_pins>; ++ ++ spi-max-frequency = <32000000>; ++ rotate = <90>; ++ fps = <25>; ++ bgr; ++ buswidth = <8>; ++ dc-gpios = <&gpio 25 0>; ++ debug = <0>; ++ }; ++ ++ }; ++ }; ++ ++ __overrides__ { ++ speed = <&pitft>,"spi-max-frequency:0"; ++ rotate = <&pitft>,"rotate:0"; ++ fps = <&pitft>,"fps:0"; ++ debug = <&pitft>,"debug:0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/pitft28-capacitive-overlay.dts b/arch/arm/boot/dts/overlays/pitft28-capacitive-overlay.dts +new file mode 100644 +index 0000000..5c07526 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/pitft28-capacitive-overlay.dts +@@ -0,0 +1,91 @@ ++/* ++ * Device Tree overlay for Adafruit PiTFT 2.8" capacitive touch screen ++ * ++ */ ++ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; ++ ++ fragment@0 { ++ target = <&spi0>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&spidev0>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&gpio>; ++ __overlay__ { ++ pitft_pins: pitft_pins { ++ brcm,pins = <24 25>; ++ brcm,function = <0 1>; /* in out */ ++ brcm,pull = <2 0>; /* pullup none */ ++ }; ++ }; ++ }; ++ ++ fragment@3 { ++ target = <&spi0>; ++ __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ pitft: pitft@0{ ++ compatible = "ilitek,ili9340"; ++ reg = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pitft_pins>; ++ ++ spi-max-frequency = <32000000>; ++ rotate = <90>; ++ fps = <25>; ++ bgr; ++ buswidth = <8>; ++ dc-gpios = <&gpio 25 0>; ++ debug = <0>; ++ }; ++ }; ++ }; ++ ++ fragment@4 { ++ target = <&i2c1>; ++ __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ ft6236: ft6236@38 { ++ compatible = "focaltech,ft6236"; ++ reg = <0x38>; ++ ++ interrupt-parent = <&gpio>; ++ interrupts = <24 2>; ++ touchscreen-size-x = <240>; ++ touchscreen-size-y = <320>; ++ }; ++ }; ++ }; ++ ++ __overrides__ { ++ speed = <&pitft>,"spi-max-frequency:0"; ++ rotate = <&pitft>,"rotate:0"; ++ fps = <&pitft>,"fps:0"; ++ debug = <&pitft>,"debug:0"; ++ touch-sizex = <&ft6236>,"touchscreen-size-x?"; ++ touch-sizey = <&ft6236>,"touchscreen-size-y?"; ++ touch-invx = <&ft6236>,"touchscreen-inverted-x?"; ++ touch-invy = <&ft6236>,"touchscreen-inverted-y?"; ++ touch-swapxy = <&ft6236>,"touchscreen-swapped-x-y?"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/pitft28-resistive-overlay.dts b/arch/arm/boot/dts/overlays/pitft28-resistive-overlay.dts +new file mode 100644 +index 0000000..ed2afc2 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/pitft28-resistive-overlay.dts +@@ -0,0 +1,121 @@ ++/* ++ * Device Tree overlay for Adafruit PiTFT 2.8" resistive touch screen ++ * ++ */ ++ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; ++ ++ fragment@0 { ++ target = <&spi0>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&spidev0>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&spidev1>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; ++ ++ fragment@3 { ++ target = <&gpio>; ++ __overlay__ { ++ pitft_pins: pitft_pins { ++ brcm,pins = <24 25>; ++ brcm,function = <0 1>; /* in out */ ++ brcm,pull = <2 0>; /* pullup none */ ++ }; ++ }; ++ }; ++ ++ fragment@4 { ++ target = <&spi0>; ++ __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ pitft: pitft@0{ ++ compatible = "ilitek,ili9340"; ++ reg = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pitft_pins>; ++ ++ spi-max-frequency = <32000000>; ++ rotate = <90>; ++ fps = <25>; ++ bgr; ++ buswidth = <8>; ++ dc-gpios = <&gpio 25 0>; ++ debug = <0>; ++ }; ++ ++ pitft_ts@1 { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ compatible = "st,stmpe610"; ++ reg = <1>; ++ ++ spi-max-frequency = <500000>; ++ irq-gpio = <&gpio 24 0x2>; /* IRQF_TRIGGER_FALLING */ ++ interrupts = <24 2>; /* high-to-low edge triggered */ ++ interrupt-parent = <&gpio>; ++ interrupt-controller; ++ ++ stmpe_touchscreen { ++ compatible = "st,stmpe-ts"; ++ st,sample-time = <4>; ++ st,mod-12b = <1>; ++ st,ref-sel = <0>; ++ st,adc-freq = <2>; ++ st,ave-ctrl = <3>; ++ st,touch-det-delay = <4>; ++ st,settling = <2>; ++ st,fraction-z = <7>; ++ st,i-drive = <0>; ++ }; ++ ++ stmpe_gpio: stmpe_gpio { ++ #gpio-cells = <2>; ++ compatible = "st,stmpe-gpio"; ++ /* ++ * only GPIO2 is wired/available ++ * and it is wired to the backlight ++ */ ++ st,norequest-mask = <0x7b>; ++ }; ++ }; ++ }; ++ }; ++ ++ fragment@5 { ++ target-path = "/soc"; ++ __overlay__ { ++ backlight { ++ compatible = "gpio-backlight"; ++ gpios = <&stmpe_gpio 2 0>; ++ default-on; ++ }; ++ }; ++ }; ++ ++ __overrides__ { ++ speed = <&pitft>,"spi-max-frequency:0"; ++ rotate = <&pitft>,"rotate:0"; ++ fps = <&pitft>,"fps:0"; ++ debug = <&pitft>,"debug:0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/pps-gpio-overlay.dts b/arch/arm/boot/dts/overlays/pps-gpio-overlay.dts +new file mode 100644 +index 0000000..40bf0e1 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/pps-gpio-overlay.dts +@@ -0,0 +1,34 @@ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ fragment@0 { ++ target-path = "/"; ++ __overlay__ { ++ pps: pps { ++ compatible = "pps-gpio"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pps_pins>; ++ gpios = <&gpio 18 0>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ pps_pins: pps_pins { ++ brcm,pins = <18>; ++ brcm,function = <0>; // in ++ brcm,pull = <0>; // off ++ }; ++ }; ++ }; ++ ++ __overrides__ { ++ gpiopin = <&pps>,"gpios:4", ++ <&pps_pins>,"brcm,pins:0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/pwm-2chan-overlay.dts b/arch/arm/boot/dts/overlays/pwm-2chan-overlay.dts +new file mode 100644 +index 0000000..18e4e4f +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/pwm-2chan-overlay.dts +@@ -0,0 +1,53 @@ ++/dts-v1/; ++/plugin/; ++ ++/* ++This is the 2-channel overlay - only use it if you need both channels. ++ ++Legal pin,function combinations for each channel: ++ PWM0: 12,4(Alt0) 18,2(Alt5) 40,4(Alt0) 52,5(Alt1) ++ PWM1: 13,4(Alt0) 19,2(Alt5) 41,4(Alt0) 45,4(Alt0) 53,5(Alt1) ++ ++N.B.: ++ 1) Pin 18 is the only one available on all platforms, and ++ it is the one used by the I2S audio interface. ++ Pins 12 and 13 might be better choices on an A+, B+ or Pi2. ++ 2) The onboard analogue audio output uses both PWM channels. ++ 3) So be careful mixing audio and PWM. ++*/ ++ ++/ { ++ fragment@0 { ++ target = <&gpio>; ++ __overlay__ { ++ pwm_pins: pwm_pins { ++ brcm,pins = <18 19>; ++ brcm,function = <2 2>; /* Alt5 */ ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&pwm>; ++ __overlay__ { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pwm_pins>; ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&clk_pwm>; ++ frag2: __overlay__ { ++ clock-frequency = <100000000>; ++ }; ++ }; ++ ++ __overrides__ { ++ pin = <&pwm_pins>,"brcm,pins:0"; ++ pin2 = <&pwm_pins>,"brcm,pins:4"; ++ func = <&pwm_pins>,"brcm,function:0"; ++ func2 = <&pwm_pins>,"brcm,function:4"; ++ clock = <&frag2>,"clock-frequency:0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/pwm-overlay.dts b/arch/arm/boot/dts/overlays/pwm-overlay.dts +new file mode 100644 +index 0000000..bf030a6 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/pwm-overlay.dts +@@ -0,0 +1,49 @@ ++/dts-v1/; ++/plugin/; ++ ++/* ++Legal pin,function combinations for each channel: ++ PWM0: 12,4(Alt0) 18,2(Alt5) 40,4(Alt0) 52,5(Alt1) ++ PWM1: 13,4(Alt0) 19,2(Alt5) 41,4(Alt0) 45,4(Alt0) 53,5(Alt1) ++ ++N.B.: ++ 1) Pin 18 is the only one available on all platforms, and ++ it is the one used by the I2S audio interface. ++ Pins 12 and 13 might be better choices on an A+, B+ or Pi2. ++ 2) The onboard analogue audio output uses both PWM channels. ++ 3) So be careful mixing audio and PWM. ++*/ ++ ++/ { ++ fragment@0 { ++ target = <&gpio>; ++ __overlay__ { ++ pwm_pins: pwm_pins { ++ brcm,pins = <18>; ++ brcm,function = <2>; /* Alt5 */ ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&pwm>; ++ __overlay__ { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pwm_pins>; ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&clk_pwm>; ++ frag2: __overlay__ { ++ clock-frequency = <100000000>; ++ }; ++ }; ++ ++ __overrides__ { ++ pin = <&pwm_pins>,"brcm,pins:0"; ++ func = <&pwm_pins>,"brcm,function:0"; ++ clock = <&frag2>,"clock-frequency:0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/qca7000-overlay.dts b/arch/arm/boot/dts/overlays/qca7000-overlay.dts +new file mode 100644 +index 0000000..b4e6013 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/qca7000-overlay.dts +@@ -0,0 +1,52 @@ ++// Overlay for the Qualcomm Atheros QCA7000 on I2SE's PLC Stamp micro EVK ++// Visit: https://www.i2se.com/product/plc-stamp-micro-evk for details ++ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&spi0>; ++ __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ status = "okay"; ++ ++ spidev@0 { ++ status = "disabled"; ++ }; ++ ++ eth1: qca7000@0 { ++ compatible = "qca,qca7000"; ++ reg = <0>; /* CE0 */ ++ pinctrl-names = "default"; ++ pinctrl-0 = <&eth1_pins>; ++ interrupt-parent = <&gpio>; ++ interrupts = <23 0x1>; /* rising edge */ ++ spi-max-frequency = <12000000>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ eth1_pins: eth1_pins { ++ brcm,pins = <23>; ++ brcm,function = <0>; /* in */ ++ brcm,pull = <0>; /* none */ ++ }; ++ }; ++ }; ++ ++ __overrides__ { ++ int_pin = <&eth1>, "interrupts:0", ++ <&eth1_pins>, "brcm,pins:0"; ++ speed = <&eth1>, "spi-max-frequency:0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/raspidac3-overlay.dts b/arch/arm/boot/dts/overlays/raspidac3-overlay.dts +new file mode 100644 +index 0000000..2fac57c +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/raspidac3-overlay.dts +@@ -0,0 +1,45 @@ ++// Definitions for RaspiDACv3 ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&i2s>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&i2c1>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ pcm5122@4c { ++ #sound-dai-cells = <0>; ++ compatible = "ti,pcm5122"; ++ reg = <0x4c>; ++ status = "okay"; ++ }; ++ ++ tpa6130a2: tpa6130a2@60 { ++ compatible = "ti,tpa6130a2"; ++ reg = <0x60>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&sound>; ++ __overlay__ { ++ compatible = "jg,raspidacv3"; ++ i2s-controller = <&i2s>; ++ status = "okay"; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/rpi-backlight-overlay.dts b/arch/arm/boot/dts/overlays/rpi-backlight-overlay.dts +new file mode 100644 +index 0000000..c021d02 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/rpi-backlight-overlay.dts +@@ -0,0 +1,21 @@ ++/* ++ * Devicetree overlay for mailbox-driven Raspberry Pi DSI Display ++ * backlight controller ++ */ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target-path = "/"; ++ __overlay__ { ++ rpi_backlight: rpi_backlight { ++ compatible = "raspberrypi,rpi-backlight"; ++ firmware = <&firmware>; ++ status = "okay"; ++ }; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/rpi-dac-overlay.dts b/arch/arm/boot/dts/overlays/rpi-dac-overlay.dts +new file mode 100644 +index 0000000..1523eae +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/rpi-dac-overlay.dts +@@ -0,0 +1,34 @@ ++// Definitions for RPi DAC ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&i2s>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&soc>; ++ __overlay__ { ++ pcm1794a-codec { ++ #sound-dai-cells = <0>; ++ compatible = "ti,pcm1794a"; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&sound>; ++ __overlay__ { ++ compatible = "rpi,rpi-dac"; ++ i2s-controller = <&i2s>; ++ status = "okay"; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/rpi-display-overlay.dts b/arch/arm/boot/dts/overlays/rpi-display-overlay.dts +new file mode 100644 +index 0000000..d7e72ee +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/rpi-display-overlay.dts +@@ -0,0 +1,89 @@ ++/* ++ * Device Tree overlay for rpi-display by Watterott ++ * ++ */ ++ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; ++ ++ fragment@0 { ++ target = <&spi0>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&spidev0>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&spidev1>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; ++ ++ fragment@3 { ++ target = <&gpio>; ++ __overlay__ { ++ rpi_display_pins: rpi_display_pins { ++ brcm,pins = <18 23 24 25>; ++ brcm,function = <1 1 1 0>; /* out out out in */ ++ brcm,pull = <0 0 0 2>; /* - - - up */ ++ }; ++ }; ++ }; ++ ++ fragment@4 { ++ target = <&spi0>; ++ __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ rpidisplay: rpi-display@0{ ++ compatible = "ilitek,ili9341"; ++ reg = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&rpi_display_pins>; ++ ++ spi-max-frequency = <32000000>; ++ rotate = <270>; ++ bgr; ++ fps = <30>; ++ buswidth = <8>; ++ reset-gpios = <&gpio 23 0>; ++ dc-gpios = <&gpio 24 0>; ++ led-gpios = <&gpio 18 1>; ++ debug = <0>; ++ }; ++ ++ rpidisplay_ts: rpi-display-ts@1 { ++ compatible = "ti,ads7846"; ++ reg = <1>; ++ ++ spi-max-frequency = <2000000>; ++ interrupts = <25 2>; /* high-to-low edge triggered */ ++ interrupt-parent = <&gpio>; ++ pendown-gpio = <&gpio 25 0>; ++ ti,x-plate-ohms = /bits/ 16 <60>; ++ ti,pressure-max = /bits/ 16 <255>; ++ }; ++ }; ++ }; ++ __overrides__ { ++ speed = <&rpidisplay>,"spi-max-frequency:0"; ++ rotate = <&rpidisplay>,"rotate:0"; ++ fps = <&rpidisplay>,"fps:0"; ++ debug = <&rpidisplay>,"debug:0"; ++ xohms = <&rpidisplay_ts>,"ti,x-plate-ohms;0"; ++ swapxy = <&rpidisplay_ts>,"ti,swap-xy?"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/rpi-ft5406-overlay.dts b/arch/arm/boot/dts/overlays/rpi-ft5406-overlay.dts +new file mode 100644 +index 0000000..2e53a17 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/rpi-ft5406-overlay.dts +@@ -0,0 +1,17 @@ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target-path = "/"; ++ __overlay__ { ++ rpi_ft5406: rpi_ft5406 { ++ compatible = "rpi,rpi-ft5406"; ++ firmware = <&firmware>; ++ status = "okay"; ++ }; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/rpi-proto-overlay.dts b/arch/arm/boot/dts/overlays/rpi-proto-overlay.dts +new file mode 100644 +index 0000000..8332d01 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/rpi-proto-overlay.dts +@@ -0,0 +1,39 @@ ++// Definitions for Rpi-Proto ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&i2s>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&i2c1>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ wm8731@1a { ++ #sound-dai-cells = <0>; ++ compatible = "wlf,wm8731"; ++ reg = <0x1a>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&sound>; ++ __overlay__ { ++ compatible = "rpi,rpi-proto"; ++ i2s-controller = <&i2s>; ++ status = "okay"; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/rpi-sense-overlay.dts b/arch/arm/boot/dts/overlays/rpi-sense-overlay.dts +new file mode 100644 +index 0000000..2715324 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/rpi-sense-overlay.dts +@@ -0,0 +1,47 @@ ++// rpi-sense HAT ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708", "brcm,bcm2709"; ++ ++ fragment@0 { ++ target = <&i2c1>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ rpi-sense@46 { ++ compatible = "rpi,rpi-sense"; ++ reg = <0x46>; ++ keys-int-gpios = <&gpio 23 1>; ++ status = "okay"; ++ }; ++ ++ lsm9ds1-magn@1c { ++ compatible = "st,lsm9ds1-magn"; ++ reg = <0x1c>; ++ status = "okay"; ++ }; ++ ++ lsm9ds1-accel6a { ++ compatible = "st,lsm9ds1-accel"; ++ reg = <0x6a>; ++ status = "okay"; ++ }; ++ ++ lps25h-press@5c { ++ compatible = "st,lps25h-press"; ++ reg = <0x5c>; ++ status = "okay"; ++ }; ++ ++ hts221-humid@5f { ++ compatible = "st,hts221-humid"; ++ reg = <0x5f>; ++ status = "okay"; ++ }; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/rra-digidac1-wm8741-audio-overlay.dts b/arch/arm/boot/dts/overlays/rra-digidac1-wm8741-audio-overlay.dts +new file mode 100644 +index 0000000..16b1247 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/rra-digidac1-wm8741-audio-overlay.dts +@@ -0,0 +1,81 @@ ++// Definitions for RRA DigiDAC1 Audio card ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target-path = "/"; ++ __overlay__ { ++ aliases { ++ ldo0 = &ldo0; ++ ldo1 = &ldo1; ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target-path = "/soc"; ++ __overlay__ { ++ ++ ldo1: ldo1 { ++ compatible = "regulator-fixed"; ++ regulator-name = "DC_5V"; ++ regulator-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; ++ regulator-always-on; ++ }; ++ ++ ldo0: ldo0 { ++ compatible = "regulator-fixed"; ++ regulator-name = "DC_3V3"; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ regulator-always-on; ++ }; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&i2s>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@3 { ++ target = <&i2c1>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ wm8804@3b { ++ #sound-dai-cells = <0>; ++ compatible = "wlf,wm8804"; ++ reg = <0x3b>; ++ status = "okay"; ++ PVDD-supply = <&ldo0>; ++ DVDD-supply = <&ldo0>; ++ }; ++ ++ wm8742: wm8741@1a { ++ compatible = "wlf,wm8741"; ++ reg = <0x1a>; ++ status = "okay"; ++ AVDD-supply = <&ldo1>; ++ DVDD-supply = <&ldo0>; ++ }; ++ }; ++ }; ++ ++ fragment@4 { ++ target = <&sound>; ++ __overlay__ { ++ compatible = "rra,digidac1-soundcard"; ++ i2s-controller = <&i2s>; ++ status = "okay"; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/sdhost-overlay.dts b/arch/arm/boot/dts/overlays/sdhost-overlay.dts +new file mode 100644 +index 0000000..a431177 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/sdhost-overlay.dts +@@ -0,0 +1,32 @@ ++/dts-v1/; ++/plugin/; ++ ++/* Provide backwards compatible aliases for the old sdhost dtparams. */ ++ ++/{ ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&sdhost>; ++ frag0: __overlay__ { ++ brcm,overclock-50 = <0>; ++ brcm,pio-limit = <1>; ++ brcm,debug-flags = <0>; ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&mmc>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; ++ ++ __overrides__ { ++ overclock_50 = <&frag0>,"brcm,overclock-50:0"; ++ force_pio = <&frag0>,"brcm,force-pio?"; ++ pio_limit = <&frag0>,"brcm,pio-limit:0"; ++ debug = <&frag0>,"brcm,debug?"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/sdio-1bit-overlay.dts b/arch/arm/boot/dts/overlays/sdio-1bit-overlay.dts +new file mode 100644 +index 0000000..46d4538 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/sdio-1bit-overlay.dts +@@ -0,0 +1,36 @@ ++/* Enable 1-bit SDIO from MMC interface via GPIOs 22-25. Includes sdhost overlay. */ ++ ++/include/ "sdhost-overlay.dts" ++ ++/{ ++ compatible = "brcm,bcm2708"; ++ ++ fragment@3 { ++ target = <&mmc>; ++ sdio_mmc: __overlay__ { ++ compatible = "brcm,bcm2835-mmc"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&sdio_pins>; ++ non-removable; ++ bus-width = <1>; ++ brcm,overclock-50 = <0>; ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@4 { ++ target = <&gpio>; ++ __overlay__ { ++ sdio_pins: sdio_pins { ++ brcm,pins = <22 23 24 25>; ++ brcm,function = <7 7 7 7>; /* ALT3 = SD1 */ ++ brcm,pull = <0 2 2 2>; ++ }; ++ }; ++ }; ++ ++ __overrides__ { ++ poll_once = <&sdio_mmc>,"non-removable?"; ++ sdio_overclock = <&sdio_mmc>,"brcm,overclock-50:0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/sdio-overlay.dts b/arch/arm/boot/dts/overlays/sdio-overlay.dts +new file mode 100644 +index 0000000..398bd81 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/sdio-overlay.dts +@@ -0,0 +1,36 @@ ++/* Enable SDIO from MMC interface via GPIOs 22-27. Includes sdhost overlay. */ ++ ++/include/ "sdhost-overlay.dts" ++ ++/{ ++ compatible = "brcm,bcm2708"; ++ ++ fragment@3 { ++ target = <&mmc>; ++ sdio_mmc: __overlay__ { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&sdio_pins>; ++ non-removable; ++ bus-width = <4>; ++ brcm,overclock-50 = <0>; ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@4 { ++ target = <&gpio>; ++ __overlay__ { ++ sdio_pins: sdio_pins { ++ brcm,pins = <22 23 24 25 26 27>; ++ brcm,function = <7 7 7 7 7 7>; /* ALT3 = SD1 */ ++ brcm,pull = <0 2 2 2 2 2>; ++ }; ++ }; ++ }; ++ ++ __overrides__ { ++ poll_once = <&sdio_mmc>,"non-removable?"; ++ bus_width = <&sdio_mmc>,"bus-width:0"; ++ sdio_overclock = <&sdio_mmc>,"brcm,overclock-50:0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/sdtweak-overlay.dts b/arch/arm/boot/dts/overlays/sdtweak-overlay.dts +new file mode 100644 +index 0000000..e4a4677 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/sdtweak-overlay.dts +@@ -0,0 +1,23 @@ ++/dts-v1/; ++/plugin/; ++ ++/* Provide backwards compatible aliases for the old sdhost dtparams. */ ++ ++/{ ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&sdhost>; ++ frag0: __overlay__ { ++ brcm,overclock-50 = <0>; ++ brcm,pio-limit = <1>; ++ }; ++ }; ++ ++ __overrides__ { ++ overclock_50 = <&frag0>,"brcm,overclock-50:0"; ++ force_pio = <&frag0>,"brcm,force-pio?"; ++ pio_limit = <&frag0>,"brcm,pio-limit:0"; ++ debug = <&frag0>,"brcm,debug?"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/smi-dev-overlay.dts b/arch/arm/boot/dts/overlays/smi-dev-overlay.dts +new file mode 100644 +index 0000000..b610d82 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/smi-dev-overlay.dts +@@ -0,0 +1,18 @@ ++// Description: Overlay to enable character device interface for SMI. ++// Author: Luke Wren <luke@raspberrypi.org> ++ ++/dts-v1/; ++/plugin/; ++ ++/{ ++ fragment@0 { ++ target = <&soc>; ++ __overlay__ { ++ smi_dev { ++ compatible = "brcm,bcm2835-smi-dev"; ++ smi_handle = <&smi>; ++ status = "okay"; ++ }; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/smi-nand-overlay.dts b/arch/arm/boot/dts/overlays/smi-nand-overlay.dts +new file mode 100644 +index 0000000..13ce0b7 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/smi-nand-overlay.dts +@@ -0,0 +1,69 @@ ++// Description: Overlay to enable NAND flash through ++// the secondary memory interface ++// Author: Luke Wren ++ ++/dts-v1/; ++/plugin/; ++ ++/{ ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&smi>; ++ __overlay__ { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&smi_pins>; ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&soc>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ++ nand: flash@0 { ++ compatible = "brcm,bcm2835-smi-nand"; ++ smi_handle = <&smi>; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ status = "okay"; ++ ++ partition@0 { ++ label = "stage2"; ++ // 128k ++ reg = <0 0x20000>; ++ read-only; ++ }; ++ partition@1 { ++ label = "firmware"; ++ // 16M ++ reg = <0x20000 0x1000000>; ++ read-only; ++ }; ++ partition@2 { ++ label = "root"; ++ // 2G (will need to use 64 bit for >=4G) ++ reg = <0x1020000 0x80000000>; ++ }; ++ }; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&gpio>; ++ __overlay__ { ++ smi_pins: smi_pins { ++ brcm,pins = <0 1 2 3 4 5 6 7 8 9 10 11 ++ 12 13 14 15>; ++ /* Alt 1: SMI */ ++ brcm,function = <5 5 5 5 5 5 5 5 5 5 5 ++ 5 5 5 5 5>; ++ /* /CS, /WE and /OE are pulled high, as they are ++ generally active low signals */ ++ brcm,pull = <2 2 2 2 2 2 2 2 0 0 0 0 0 0 0 0>; ++ }; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/smi-overlay.dts b/arch/arm/boot/dts/overlays/smi-overlay.dts +new file mode 100644 +index 0000000..095f52c +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/smi-overlay.dts +@@ -0,0 +1,37 @@ ++// Description: Overlay to enable the secondary memory interface peripheral ++// Author: Luke Wren ++ ++/dts-v1/; ++/plugin/; ++ ++/{ ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&smi>; ++ __overlay__ { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&smi_pins>; ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ smi_pins: smi_pins { ++ /* Don't configure the top two address bits, as ++ these are already used as ID_SD and ID_SC */ ++ brcm,pins = <2 3 4 5 6 7 8 9 10 11 12 13 14 15 ++ 16 17 18 19 20 21 22 23 24 25>; ++ /* Alt 0: SMI */ ++ brcm,function = <5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 ++ 5 5 5 5 5 5 5 5 5>; ++ /* /CS, /WE and /OE are pulled high, as they are ++ generally active low signals */ ++ brcm,pull = <2 2 2 2 2 2 0 0 0 0 0 0 0 0 0 0 0 ++ 0 0 0 0 0 0 0>; ++ }; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/spi-gpio35-39-overlay.dts b/arch/arm/boot/dts/overlays/spi-gpio35-39-overlay.dts +new file mode 100644 +index 0000000..9648063 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/spi-gpio35-39-overlay.dts +@@ -0,0 +1,31 @@ ++/* ++ * Device tree overlay to move spi0 to gpio 35 to 39 on CM ++ */ ++ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2836", "brcm,bcm2708", "brcm,bcm2709"; ++ ++ fragment@0 { ++ target = <&spi0>; ++ __overlay__ { ++ cs-gpios = <&gpio 36 1>, <&gpio 35 1>; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&spi0_cs_pins>; ++ __overlay__ { ++ bcrm,pins = <36 35>; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&spi0_pins>; ++ __overlay__ { ++ bcrm,pins = <37 38 39>; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/spi1-1cs-overlay.dts b/arch/arm/boot/dts/overlays/spi1-1cs-overlay.dts +new file mode 100644 +index 0000000..71c2439 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/spi1-1cs-overlay.dts +@@ -0,0 +1,57 @@ ++/dts-v1/; ++/plugin/; ++ ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; ++ ++ fragment@0 { ++ target = <&gpio>; ++ __overlay__ { ++ spi1_pins: spi1_pins { ++ brcm,pins = <19 20 21>; ++ brcm,function = <3>; /* alt4 */ ++ }; ++ ++ spi1_cs_pins: spi1_cs_pins { ++ brcm,pins = <18>; ++ brcm,function = <1>; /* output */ ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&spi1>; ++ frag1: __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&spi1_pins &spi1_cs_pins>; ++ cs-gpios = <&gpio 18 1>; ++ status = "okay"; ++ ++ spidev1_0: spidev@0 { ++ compatible = "spidev"; ++ reg = <0>; /* CE0 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&aux>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ __overrides__ { ++ cs0_pin = <&spi1_cs_pins>,"brcm,pins:0", ++ <&frag1>,"cs-gpios:4"; ++ cs0_spidev = <&spidev1_0>,"status"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/spi1-2cs-overlay.dts b/arch/arm/boot/dts/overlays/spi1-2cs-overlay.dts +new file mode 100644 +index 0000000..2ae0885 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/spi1-2cs-overlay.dts +@@ -0,0 +1,69 @@ ++/dts-v1/; ++/plugin/; ++ ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; ++ ++ fragment@0 { ++ target = <&gpio>; ++ __overlay__ { ++ spi1_pins: spi1_pins { ++ brcm,pins = <19 20 21>; ++ brcm,function = <3>; /* alt4 */ ++ }; ++ ++ spi1_cs_pins: spi1_cs_pins { ++ brcm,pins = <18 17>; ++ brcm,function = <1>; /* output */ ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&spi1>; ++ frag1: __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&spi1_pins &spi1_cs_pins>; ++ cs-gpios = <&gpio 18 1>, <&gpio 17 1>; ++ status = "okay"; ++ ++ spidev1_0: spidev@0 { ++ compatible = "spidev"; ++ reg = <0>; /* CE0 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ status = "okay"; ++ }; ++ ++ spidev1_1: spidev@1 { ++ compatible = "spidev"; ++ reg = <1>; /* CE1 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&aux>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ __overrides__ { ++ cs0_pin = <&spi1_cs_pins>,"brcm,pins:0", ++ <&frag1>,"cs-gpios:4"; ++ cs1_pin = <&spi1_cs_pins>,"brcm,pins:4", ++ <&frag1>,"cs-gpios:16"; ++ cs0_spidev = <&spidev1_0>,"status"; ++ cs1_spidev = <&spidev1_1>,"status"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/spi1-3cs-overlay.dts b/arch/arm/boot/dts/overlays/spi1-3cs-overlay.dts +new file mode 100644 +index 0000000..8f79044 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/spi1-3cs-overlay.dts +@@ -0,0 +1,81 @@ ++/dts-v1/; ++/plugin/; ++ ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; ++ ++ fragment@0 { ++ target = <&gpio>; ++ __overlay__ { ++ spi1_pins: spi1_pins { ++ brcm,pins = <19 20 21>; ++ brcm,function = <3>; /* alt4 */ ++ }; ++ ++ spi1_cs_pins: spi1_cs_pins { ++ brcm,pins = <18 17 16>; ++ brcm,function = <1>; /* output */ ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&spi1>; ++ frag1: __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&spi1_pins &spi1_cs_pins>; ++ cs-gpios = <&gpio 18 1>, <&gpio 17 1>, <&gpio 16 1>; ++ status = "okay"; ++ ++ spidev1_0: spidev@0 { ++ compatible = "spidev"; ++ reg = <0>; /* CE0 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ status = "okay"; ++ }; ++ ++ spidev1_1: spidev@1 { ++ compatible = "spidev"; ++ reg = <1>; /* CE1 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ status = "okay"; ++ }; ++ ++ spidev1_2: spidev@2 { ++ compatible = "spidev"; ++ reg = <2>; /* CE2 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&aux>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ __overrides__ { ++ cs0_pin = <&spi1_cs_pins>,"brcm,pins:0", ++ <&frag1>,"cs-gpios:4"; ++ cs1_pin = <&spi1_cs_pins>,"brcm,pins:4", ++ <&frag1>,"cs-gpios:16"; ++ cs2_pin = <&spi1_cs_pins>,"brcm,pins:8", ++ <&frag1>,"cs-gpios:28"; ++ cs0_spidev = <&spidev1_0>,"status"; ++ cs1_spidev = <&spidev1_1>,"status"; ++ cs2_spidev = <&spidev1_2>,"status"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/spi2-1cs-overlay.dts b/arch/arm/boot/dts/overlays/spi2-1cs-overlay.dts +new file mode 100644 +index 0000000..6f57bc7 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/spi2-1cs-overlay.dts +@@ -0,0 +1,57 @@ ++/dts-v1/; ++/plugin/; ++ ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; ++ ++ fragment@0 { ++ target = <&gpio>; ++ __overlay__ { ++ spi2_pins: spi2_pins { ++ brcm,pins = <40 41 42>; ++ brcm,function = <3>; /* alt4 */ ++ }; ++ ++ spi2_cs_pins: spi2_cs_pins { ++ brcm,pins = <43>; ++ brcm,function = <1>; /* output */ ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&spi2>; ++ frag1: __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&spi2_pins &spi2_cs_pins>; ++ cs-gpios = <&gpio 43 1>; ++ status = "okay"; ++ ++ spidev2_0: spidev@0 { ++ compatible = "spidev"; ++ reg = <0>; /* CE0 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&aux>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ __overrides__ { ++ cs0_pin = <&spi2_cs_pins>,"brcm,pins:0", ++ <&frag1>,"cs-gpios:4"; ++ cs0_spidev = <&spidev2_0>,"status"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/spi2-2cs-overlay.dts b/arch/arm/boot/dts/overlays/spi2-2cs-overlay.dts +new file mode 100644 +index 0000000..d090631 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/spi2-2cs-overlay.dts +@@ -0,0 +1,69 @@ ++/dts-v1/; ++/plugin/; ++ ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; ++ ++ fragment@0 { ++ target = <&gpio>; ++ __overlay__ { ++ spi2_pins: spi2_pins { ++ brcm,pins = <40 41 42>; ++ brcm,function = <3>; /* alt4 */ ++ }; ++ ++ spi2_cs_pins: spi2_cs_pins { ++ brcm,pins = <43 44>; ++ brcm,function = <1>; /* output */ ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&spi2>; ++ frag1: __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&spi2_pins &spi2_cs_pins>; ++ cs-gpios = <&gpio 43 1>, <&gpio 44 1>; ++ status = "okay"; ++ ++ spidev2_0: spidev@0 { ++ compatible = "spidev"; ++ reg = <0>; /* CE0 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ status = "okay"; ++ }; ++ ++ spidev2_1: spidev@1 { ++ compatible = "spidev"; ++ reg = <1>; /* CE1 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&aux>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ __overrides__ { ++ cs0_pin = <&spi2_cs_pins>,"brcm,pins:0", ++ <&frag1>,"cs-gpios:4"; ++ cs1_pin = <&spi2_cs_pins>,"brcm,pins:4", ++ <&frag1>,"cs-gpios:16"; ++ cs0_spidev = <&spidev2_0>,"status"; ++ cs1_spidev = <&spidev2_1>,"status"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/spi2-3cs-overlay.dts b/arch/arm/boot/dts/overlays/spi2-3cs-overlay.dts +new file mode 100644 +index 0000000..e258672 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/spi2-3cs-overlay.dts +@@ -0,0 +1,81 @@ ++/dts-v1/; ++/plugin/; ++ ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; ++ ++ fragment@0 { ++ target = <&gpio>; ++ __overlay__ { ++ spi2_pins: spi2_pins { ++ brcm,pins = <40 41 42>; ++ brcm,function = <3>; /* alt4 */ ++ }; ++ ++ spi2_cs_pins: spi2_cs_pins { ++ brcm,pins = <43 44 45>; ++ brcm,function = <1>; /* output */ ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&spi2>; ++ frag1: __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&spi2_pins &spi2_cs_pins>; ++ cs-gpios = <&gpio 43 1>, <&gpio 44 1>, <&gpio 45 1>; ++ status = "okay"; ++ ++ spidev2_0: spidev@0 { ++ compatible = "spidev"; ++ reg = <0>; /* CE0 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ status = "okay"; ++ }; ++ ++ spidev2_1: spidev@1 { ++ compatible = "spidev"; ++ reg = <1>; /* CE1 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ status = "okay"; ++ }; ++ ++ spidev2_2: spidev@2 { ++ compatible = "spidev"; ++ reg = <2>; /* CE2 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&aux>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ __overrides__ { ++ cs0_pin = <&spi2_cs_pins>,"brcm,pins:0", ++ <&frag1>,"cs-gpios:4"; ++ cs1_pin = <&spi2_cs_pins>,"brcm,pins:4", ++ <&frag1>,"cs-gpios:16"; ++ cs2_pin = <&spi2_cs_pins>,"brcm,pins:8", ++ <&frag1>,"cs-gpios:28"; ++ cs0_spidev = <&spidev2_0>,"status"; ++ cs1_spidev = <&spidev2_1>,"status"; ++ cs2_spidev = <&spidev2_2>,"status"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/tinylcd35-overlay.dts b/arch/arm/boot/dts/overlays/tinylcd35-overlay.dts +new file mode 100644 +index 0000000..ed2b053 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/tinylcd35-overlay.dts +@@ -0,0 +1,224 @@ ++/* ++ * tinylcd35-overlay.dts ++ * ++ * ------------------------------------------------- ++ * www.tinlylcd.com ++ * ------------------------------------------------- ++ * Device---Driver-----BUS GPIO's ++ * display tinylcd35 spi0.0 25 24 18 ++ * touch ads7846 spi0.1 5 ++ * rtc ds1307 i2c1-0068 ++ * rtc pcf8563 i2c1-0051 ++ * keypad gpio-keys --------- 17 22 27 23 28 ++ * ++ * ++ * TinyLCD.com 3.5 inch TFT ++ * ++ * Version 001 ++ * 5/3/2015 -- Noralf Trønnes Initial Device tree framework ++ * 10/3/2015 -- tinylcd@gmail.com added ds1307 support. ++ * ++ */ ++ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; ++ ++ fragment@0 { ++ target = <&spi0>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&spidev0>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&spidev1>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; ++ ++ fragment@3 { ++ target = <&gpio>; ++ __overlay__ { ++ tinylcd35_pins: tinylcd35_pins { ++ brcm,pins = <25 24 18>; ++ brcm,function = <1>; /* out */ ++ }; ++ tinylcd35_ts_pins: tinylcd35_ts_pins { ++ brcm,pins = <5>; ++ brcm,function = <0>; /* in */ ++ }; ++ keypad_pins: keypad_pins { ++ brcm,pins = <4 17 22 23 27>; ++ brcm,function = <0>; /* in */ ++ brcm,pull = <1>; /* down */ ++ }; ++ }; ++ }; ++ ++ fragment@4 { ++ target = <&spi0>; ++ __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ tinylcd35: tinylcd35@0{ ++ compatible = "neosec,tinylcd"; ++ reg = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&tinylcd35_pins>, ++ <&tinylcd35_ts_pins>; ++ ++ spi-max-frequency = <48000000>; ++ rotate = <270>; ++ fps = <20>; ++ bgr; ++ buswidth = <8>; ++ reset-gpios = <&gpio 25 0>; ++ dc-gpios = <&gpio 24 0>; ++ led-gpios = <&gpio 18 1>; ++ debug = <0>; ++ ++ init = <0x10000B0 0x80 ++ 0x10000C0 0x0A 0x0A ++ 0x10000C1 0x01 0x01 ++ 0x10000C2 0x33 ++ 0x10000C5 0x00 0x42 0x80 ++ 0x10000B1 0xD0 0x11 ++ 0x10000B4 0x02 ++ 0x10000B6 0x00 0x22 0x3B ++ 0x10000B7 0x07 ++ 0x1000036 0x58 ++ 0x10000F0 0x36 0xA5 0xD3 ++ 0x10000E5 0x80 ++ 0x10000E5 0x01 ++ 0x10000B3 0x00 ++ 0x10000E5 0x00 ++ 0x10000F0 0x36 0xA5 0x53 ++ 0x10000E0 0x00 0x35 0x33 0x00 0x00 0x00 0x00 0x35 0x33 0x00 0x00 0x00 ++ 0x100003A 0x55 ++ 0x1000011 ++ 0x2000001 ++ 0x1000029>; ++ }; ++ ++ tinylcd35_ts: tinylcd35_ts@1 { ++ compatible = "ti,ads7846"; ++ reg = <1>; ++ status = "disabled"; ++ ++ spi-max-frequency = <2000000>; ++ interrupts = <5 2>; /* high-to-low edge triggered */ ++ interrupt-parent = <&gpio>; ++ pendown-gpio = <&gpio 5 0>; ++ ti,x-plate-ohms = /bits/ 16 <100>; ++ ti,pressure-max = /bits/ 16 <255>; ++ }; ++ }; ++ }; ++ ++ /* RTC */ ++ ++ fragment@5 { ++ target = <&i2c1>; ++ __dormant__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ status = "okay"; ++ ++ pcf8563: pcf8563@51 { ++ compatible = "nxp,pcf8563"; ++ reg = <0x51>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@6 { ++ target = <&i2c1>; ++ __dormant__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ status = "okay"; ++ ++ ds1307: ds1307@68 { ++ compatible = "maxim,ds1307"; ++ reg = <0x68>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ /* ++ * Values for input event code is found under the ++ * 'Keys and buttons' heading in include/uapi/linux/input.h ++ */ ++ fragment@7 { ++ target-path = "/soc"; ++ __overlay__ { ++ keypad: keypad { ++ compatible = "gpio-keys"; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&keypad_pins>; ++ status = "disabled"; ++ autorepeat; ++ ++ button@17 { ++ label = "GPIO KEY_UP"; ++ linux,code = <103>; ++ gpios = <&gpio 17 0>; ++ }; ++ button@22 { ++ label = "GPIO KEY_DOWN"; ++ linux,code = <108>; ++ gpios = <&gpio 22 0>; ++ }; ++ button@27 { ++ label = "GPIO KEY_LEFT"; ++ linux,code = <105>; ++ gpios = <&gpio 27 0>; ++ }; ++ button@23 { ++ label = "GPIO KEY_RIGHT"; ++ linux,code = <106>; ++ gpios = <&gpio 23 0>; ++ }; ++ button@4 { ++ label = "GPIO KEY_ENTER"; ++ linux,code = <28>; ++ gpios = <&gpio 4 0>; ++ }; ++ }; ++ }; ++ }; ++ ++ __overrides__ { ++ speed = <&tinylcd35>,"spi-max-frequency:0"; ++ rotate = <&tinylcd35>,"rotate:0"; ++ fps = <&tinylcd35>,"fps:0"; ++ debug = <&tinylcd35>,"debug:0"; ++ touch = <&tinylcd35_ts>,"status"; ++ touchgpio = <&tinylcd35_ts_pins>,"brcm,pins:0", ++ <&tinylcd35_ts>,"interrupts:0", ++ <&tinylcd35_ts>,"pendown-gpio:4"; ++ xohms = <&tinylcd35_ts>,"ti,x-plate-ohms;0"; ++ rtc-pcf = <0>,"=5"; ++ rtc-ds = <0>,"=6"; ++ keypad = <&keypad>,"status"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/uart1-overlay.dts b/arch/arm/boot/dts/overlays/uart1-overlay.dts +new file mode 100644 +index 0000000..fa73e1f +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/uart1-overlay.dts +@@ -0,0 +1,38 @@ ++/dts-v1/; ++/plugin/; ++ ++/{ ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&uart1>; ++ __overlay__ { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&uart1_pins>; ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ uart1_pins: uart1_pins { ++ brcm,pins = <14 15>; ++ brcm,function = <2>; /* alt5 */ ++ brcm,pull = <0 2>; ++ }; ++ }; ++ }; ++ ++ fragment@2 { ++ target-path = "/chosen"; ++ __overlay__ { ++ bootargs = "8250.nr_uarts=1"; ++ }; ++ }; ++ ++ __overrides__ { ++ txd1_pin = <&uart1_pins>,"brcm,pins:0"; ++ rxd1_pin = <&uart1_pins>,"brcm,pins:4"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/vc4-kms-v3d-overlay.dts b/arch/arm/boot/dts/overlays/vc4-kms-v3d-overlay.dts +new file mode 100644 +index 0000000..a4ca2ca +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/vc4-kms-v3d-overlay.dts +@@ -0,0 +1,129 @@ ++/* ++ * vc4-kms-v3d-overlay.dts ++ */ ++ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; ++ ++ fragment@0 { ++ target-path = "/chosen"; ++ __overlay__ { ++ bootargs = "cma=256M@256M"; ++ }; ++ }; ++ ++ fragment@1 { ++ target-path = "/chosen"; ++ __dormant__ { ++ bootargs = "cma=192M@256M"; ++ }; ++ }; ++ ++ fragment@2 { ++ target-path = "/chosen"; ++ __dormant__ { ++ bootargs = "cma=128M@128M"; ++ }; ++ }; ++ ++ fragment@3 { ++ target-path = "/chosen"; ++ __dormant__ { ++ bootargs = "cma=96M@128M"; ++ }; ++ }; ++ ++ fragment@4 { ++ target-path = "/chosen"; ++ __dormant__ { ++ bootargs = "cma=64M@64M"; ++ }; ++ }; ++ ++ fragment@5 { ++ target = <&i2c2>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@6 { ++ target = <&cprman>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@7 { ++ target = <&fb>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; ++ ++ fragment@8 { ++ target = <&pixelvalve0>; ++ __overlay__ { ++ interrupts = <2 13>; /* pwa0 */ ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@9 { ++ target = <&pixelvalve1>; ++ __overlay__ { ++ interrupts = <2 14>; /* pwa1 */ ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@10 { ++ target = <&pixelvalve2>; ++ __overlay__ { ++ interrupts = <2 10>; /* pixelvalve */ ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@11 { ++ target = <&hvs>; ++ __overlay__ { ++ interrupts = <2 1>; ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@12 { ++ target = <&hdmi>; ++ __overlay__ { ++ interrupts = <2 8>, <2 9>; ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@13 { ++ target = <&v3d>; ++ __overlay__ { ++ interrupts = <1 10>; ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@14 { ++ target = <&gpu>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ __overrides__ { ++ cma-256 = <0>,"+0-1-2-3-4"; ++ cma-192 = <0>,"-0+1-2-3-4"; ++ cma-128 = <0>,"-0-1+2-3-4"; ++ cma-96 = <0>,"-0-1-2+3-4"; ++ cma-64 = <0>,"-0-1-2-3+4"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/vga666-overlay.dts b/arch/arm/boot/dts/overlays/vga666-overlay.dts +new file mode 100644 +index 0000000..7fcab96 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/vga666-overlay.dts +@@ -0,0 +1,30 @@ ++/dts-v1/; ++/plugin/; ++ ++/{ ++ compatible = "brcm,bcm2708"; ++ ++ // There is no VGA driver module, but we need a platform device ++ // node (that doesn't already use pinctrl) to hang the pinctrl ++ // reference on - leds will do ++ ++ fragment@0 { ++ target = <&leds>; ++ __overlay__ { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&vga666_pins>; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ vga666_pins: vga666_pins { ++ brcm,pins = <2 3 4 5 6 7 8 9 10 11 12 ++ 13 14 15 16 17 18 19 20 21>; ++ brcm,function = <6>; /* alt2 */ ++ brcm,pull = <0>; /* no pull */ ++ }; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/w1-gpio-overlay.dts b/arch/arm/boot/dts/overlays/w1-gpio-overlay.dts +new file mode 100644 +index 0000000..29a3b48 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/w1-gpio-overlay.dts +@@ -0,0 +1,39 @@ ++// Definitions for w1-gpio module (without external pullup) ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target-path = "/"; ++ __overlay__ { ++ ++ w1: onewire@0 { ++ compatible = "w1-gpio"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&w1_pins>; ++ gpios = <&gpio 4 0>; ++ rpi,parasitic-power = <0>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ w1_pins: w1_pins { ++ brcm,pins = <4>; ++ brcm,function = <0>; // in (initially) ++ brcm,pull = <0>; // off ++ }; ++ }; ++ }; ++ ++ __overrides__ { ++ gpiopin = <&w1>,"gpios:4", ++ <&w1_pins>,"brcm,pins:0"; ++ pullup = <&w1>,"rpi,parasitic-power:0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/w1-gpio-pullup-overlay.dts b/arch/arm/boot/dts/overlays/w1-gpio-pullup-overlay.dts +new file mode 100644 +index 0000000..66a98f6 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/w1-gpio-pullup-overlay.dts +@@ -0,0 +1,41 @@ ++// Definitions for w1-gpio module (with external pullup) ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target-path = "/"; ++ __overlay__ { ++ ++ w1: onewire@0 { ++ compatible = "w1-gpio"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&w1_pins>; ++ gpios = <&gpio 4 0>, <&gpio 5 1>; ++ rpi,parasitic-power = <0>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ w1_pins: w1_pins { ++ brcm,pins = <4 5>; ++ brcm,function = <0 1>; // in out ++ brcm,pull = <0 0>; // off off ++ }; ++ }; ++ }; ++ ++ __overrides__ { ++ gpiopin = <&w1>,"gpios:4", ++ <&w1_pins>,"brcm,pins:0"; ++ extpullup = <&w1>,"gpios:16", ++ <&w1_pins>,"brcm,pins:4"; ++ pullup = <&w1>,"rpi,parasitic-power:0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/wittypi-overlay.dts b/arch/arm/boot/dts/overlays/wittypi-overlay.dts +new file mode 100644 +index 0000000..8498134 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/wittypi-overlay.dts +@@ -0,0 +1,44 @@ ++/* ++ * Device Tree overlay for Witty Pi extension board by UUGear ++ * ++ */ ++ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; ++ ++ fragment@0 { ++ target = <&leds>; ++ __overlay__ { ++ compatible = "gpio-leds"; ++ wittypi_led: wittypi_led { ++ label = "wittypi_led"; ++ linux,default-trigger = "default-on"; ++ gpios = <&gpio 17 0>; ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&i2c1>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ rtc: ds1337@68 { ++ compatible = "dallas,ds1337"; ++ reg = <0x68>; ++ wakeup-source; ++ }; ++ }; ++ }; ++ ++ __overrides__ { ++ led_gpio = <&wittypi_led>,"gpios:4"; ++ led_trigger = <&wittypi_led>,"linux,default-trigger"; ++ }; ++ ++}; + +From 548bca82b6fa7a057e5db331334a25c80810dfc7 Mon Sep 17 00:00:00 2001 +From: Phil Elwell <phil@raspberrypi.org> +Date: Fri, 13 Mar 2015 20:00:21 +0000 +Subject: [PATCH 058/112] BCM270X_DT: Add a .dtbo target, use for overlays + +Change the filenames and extensions to keep the pre-DDT style of +overlay (<name>-overlay.dtb) distinct from new ones that use a +different style of local fixups (<name>.dtbo), and to match other +platforms. + +The RPi firmware uses the DDTK trailer atom to choose which type of +overlay to use for each kernel. + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> +--- + arch/arm/boot/.gitignore | 2 +- + scripts/Makefile.dtbinst | 10 +++++++--- + scripts/Makefile.lib | 10 ++++++++++ + 3 files changed, 18 insertions(+), 4 deletions(-) + +diff --git a/arch/arm/boot/.gitignore b/arch/arm/boot/.gitignore +index 3c79f85..eaaeb17 100644 +--- a/arch/arm/boot/.gitignore ++++ b/arch/arm/boot/.gitignore +@@ -3,4 +3,4 @@ zImage + xipImage + bootpImage + uImage +-*.dtb ++*.dtb* +diff --git a/scripts/Makefile.dtbinst b/scripts/Makefile.dtbinst +index a1be75d..ad8dc1c 100644 +--- a/scripts/Makefile.dtbinst ++++ b/scripts/Makefile.dtbinst +@@ -27,6 +27,7 @@ ifeq ("$(dtbinst-root)", "$(obj)") + endif + + dtbinst-files := $(dtb-y) ++dtboinst-files := $(dtbo-y) + dtbinst-dirs := $(dts-dirs) + + # Helper targets for Installing DTBs into the boot directory +@@ -35,15 +36,18 @@ quiet_cmd_dtb_install = INSTALL $< + + install-dir = $(patsubst $(dtbinst-root)%,$(INSTALL_DTBS_PATH)%,$(obj)) + +-$(dtbinst-files) $(dtbinst-dirs): | __dtbs_install_prep ++$(dtbinst-files) $(dtboinst-files) $(dtbinst-dirs): | __dtbs_install_prep + + $(dtbinst-files): %.dtb: $(obj)/%.dtb + $(call cmd,dtb_install,$(install-dir)) + ++$(dtboinst-files): %.dtbo: $(obj)/%.dtbo ++ $(call cmd,dtb_install,$(install-dir)) ++ + $(dtbinst-dirs): + $(Q)$(MAKE) $(dtbinst)=$(obj)/$@ + +-PHONY += $(dtbinst-files) $(dtbinst-dirs) +-__dtbs_install: $(dtbinst-files) $(dtbinst-dirs) ++PHONY += $(dtbinst-files) $(dtboinst-files) $(dtbinst-dirs) ++__dtbs_install: $(dtbinst-files) $(dtboinst-files) $(dtbinst-dirs) + + .PHONY: $(PHONY) +diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib +index ddf83d0..c819ddc 100644 +--- a/scripts/Makefile.lib ++++ b/scripts/Makefile.lib +@@ -306,6 +306,16 @@ cmd_dtc = mkdir -p $(dir ${dtc-tmp}) ; \ + $(obj)/%.dtb: $(src)/%.dts FORCE + $(call if_changed_dep,dtc) + ++quiet_cmd_dtco = DTCO $@ ++cmd_dtco = $(CPP) $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $< ; \ ++ $(objtree)/scripts/dtc/dtc -@ -O dtb -o $@ -b 0 \ ++ -i $(dir $<) $(DTC_FLAGS) \ ++ -d $(depfile).dtc.tmp $(dtc-tmp) ; \ ++ cat $(depfile).pre.tmp $(depfile).dtc.tmp > $(depfile) ++ ++$(obj)/%.dtbo: $(src)/%-overlay.dts FORCE ++ $(call if_changed_dep,dtco) ++ + dtc-tmp = $(subst $(comma),_,$(dot-target).dts.tmp) + + # Bzip2 + +From cea163c683858d514cbdeac63a351a160c1ff4e6 Mon Sep 17 00:00:00 2001 +From: Phil Elwell <phil@raspberrypi.org> +Date: Fri, 8 Apr 2016 17:43:27 +0100 +Subject: [PATCH 059/112] BCM270X_DT: Don't generate "linux,phandle" props + +The EPAPR standard says to use "phandle" properties to store phandles, +rather than the deprecated "linux,phandle" version. By default, dtc +generates both, but adding "-H epapr" causes it to only generate +"phandle"s, saving some space and clutter. + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> +--- + scripts/Makefile.lib | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib +index c819ddc..b36099a 100644 +--- a/scripts/Makefile.lib ++++ b/scripts/Makefile.lib +@@ -308,7 +308,7 @@ $(obj)/%.dtb: $(src)/%.dts FORCE + + quiet_cmd_dtco = DTCO $@ + cmd_dtco = $(CPP) $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $< ; \ +- $(objtree)/scripts/dtc/dtc -@ -O dtb -o $@ -b 0 \ ++ $(objtree)/scripts/dtc/dtc -@ -H epapr -O dtb -o $@ -b 0 \ + -i $(dir $<) $(DTC_FLAGS) \ + -d $(depfile).dtc.tmp $(dtc-tmp) ; \ + cat $(depfile).pre.tmp $(depfile).dtc.tmp > $(depfile) + +From 273e251cd1f6808847b4f04d87a04048f549fb9d Mon Sep 17 00:00:00 2001 +From: Phil Elwell <phil@raspberrypi.org> +Date: Fri, 6 Feb 2015 13:50:57 +0000 +Subject: [PATCH 060/112] BCM270x_DT: Add pwr_led, and the required "input" + trigger + +The "input" trigger makes the associated GPIO an input. This is to support +the Raspberry Pi PWR LED, which is driven by external hardware in normal use. + +N.B. pwr_led is not available on Model A or B boards. + +leds-gpio: Implement the brightness_get method + +The power LED uses some clever logic that means it is driven +by a voltage measuring circuit when configured as input, otherwise +it is driven by the GPIO output value. This patch wires up the +brightness_get method for leds-gpio so that user-space can monitor +the LED value via /sys/class/gpio/led1/brightness. Using the input +trigger this returns an indication of the system power health, +otherwise it is just whatever value the trigger has written most +recently. + +See: https://github.com/raspberrypi/linux/issues/1064 +--- + drivers/leds/leds-gpio.c | 18 +++++++++++- + drivers/leds/trigger/Kconfig | 7 +++++ + drivers/leds/trigger/Makefile | 1 + + drivers/leds/trigger/ledtrig-input.c | 54 ++++++++++++++++++++++++++++++++++++ + include/linux/leds.h | 3 ++ + 5 files changed, 82 insertions(+), 1 deletion(-) + create mode 100644 drivers/leds/trigger/ledtrig-input.c + +diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c +index 61143f5..e98df59 100644 +--- a/drivers/leds/leds-gpio.c ++++ b/drivers/leds/leds-gpio.c +@@ -46,8 +46,15 @@ static void gpio_led_set(struct led_classdev *led_cdev, + led_dat->platform_gpio_blink_set(led_dat->gpiod, level, + NULL, NULL); + led_dat->blinking = 0; ++ } else if (led_dat->cdev.flags & SET_GPIO_INPUT) { ++ gpiod_direction_input(led_dat->gpiod); ++ led_dat->cdev.flags &= ~SET_GPIO_INPUT; ++ } else if (led_dat->cdev.flags & SET_GPIO_OUTPUT) { ++ gpiod_direction_output(led_dat->gpiod, level); ++ led_dat->cdev.flags &= ~SET_GPIO_OUTPUT; + } else { +- if (led_dat->can_sleep) ++ if (led_dat->can_sleep || ++ (led_dat->cdev.flags & (SET_GPIO_INPUT | SET_GPIO_OUTPUT) )) + gpiod_set_value_cansleep(led_dat->gpiod, level); + else + gpiod_set_value(led_dat->gpiod, level); +@@ -61,6 +68,13 @@ static int gpio_led_set_blocking(struct led_classdev *led_cdev, + return 0; + } + ++static enum led_brightness gpio_led_get(struct led_classdev *led_cdev) ++{ ++ struct gpio_led_data *led_dat = ++ container_of(led_cdev, struct gpio_led_data, cdev); ++ return gpiod_get_value_cansleep(led_dat->gpiod) ? LED_FULL : LED_OFF; ++} ++ + static int gpio_blink_set(struct led_classdev *led_cdev, + unsigned long *delay_on, unsigned long *delay_off) + { +@@ -120,6 +134,8 @@ static int create_gpio_led(const struct gpio_led *template, + led_dat->platform_gpio_blink_set = blink_set; + led_dat->cdev.blink_set = gpio_blink_set; + } ++ led_dat->cdev.brightness_set = gpio_led_set; ++ led_dat->cdev.brightness_get = gpio_led_get; + if (template->default_state == LEDS_GPIO_DEFSTATE_KEEP) + state = !!gpiod_get_value_cansleep(led_dat->gpiod); + else +diff --git a/drivers/leds/trigger/Kconfig b/drivers/leds/trigger/Kconfig +index 5bda6a9..eb98cca 100644 +--- a/drivers/leds/trigger/Kconfig ++++ b/drivers/leds/trigger/Kconfig +@@ -108,4 +108,11 @@ config LEDS_TRIGGER_CAMERA + This enables direct flash/torch on/off by the driver, kernel space. + If unsure, say Y. + ++config LEDS_TRIGGER_INPUT ++ tristate "LED Input Trigger" ++ depends on LEDS_TRIGGERS ++ help ++ This allows the GPIOs assigned to be LEDs to be initialised to inputs. ++ If unsure, say Y. ++ + endif # LEDS_TRIGGERS +diff --git a/drivers/leds/trigger/Makefile b/drivers/leds/trigger/Makefile +index 1abf48d..c03afdc 100644 +--- a/drivers/leds/trigger/Makefile ++++ b/drivers/leds/trigger/Makefile +@@ -8,3 +8,4 @@ obj-$(CONFIG_LEDS_TRIGGER_CPU) += ledtrig-cpu.o + obj-$(CONFIG_LEDS_TRIGGER_DEFAULT_ON) += ledtrig-default-on.o + obj-$(CONFIG_LEDS_TRIGGER_TRANSIENT) += ledtrig-transient.o + obj-$(CONFIG_LEDS_TRIGGER_CAMERA) += ledtrig-camera.o ++obj-$(CONFIG_LEDS_TRIGGER_INPUT) += ledtrig-input.o +diff --git a/drivers/leds/trigger/ledtrig-input.c b/drivers/leds/trigger/ledtrig-input.c +new file mode 100644 +index 0000000..27f8ebe +--- /dev/null ++++ b/drivers/leds/trigger/ledtrig-input.c +@@ -0,0 +1,54 @@ ++/* ++ * Set LED GPIO to Input "Trigger" ++ * ++ * Copyright 2015 Phil Elwell <phil@raspberrypi.org> ++ * ++ * Based on Nick Forbes's ledtrig-default-on.c. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 as ++ * published by the Free Software Foundation. ++ * ++ */ ++ ++#include <linux/module.h> ++#include <linux/kernel.h> ++#include <linux/init.h> ++#include <linux/leds.h> ++#include <linux/gpio.h> ++#include "../leds.h" ++ ++static void input_trig_activate(struct led_classdev *led_cdev) ++{ ++ led_cdev->flags |= SET_GPIO_INPUT; ++ led_set_brightness(led_cdev, 0); ++} ++ ++static void input_trig_deactivate(struct led_classdev *led_cdev) ++{ ++ led_cdev->flags |= SET_GPIO_OUTPUT; ++ led_set_brightness(led_cdev, 0); ++} ++ ++static struct led_trigger input_led_trigger = { ++ .name = "input", ++ .activate = input_trig_activate, ++ .deactivate = input_trig_deactivate, ++}; ++ ++static int __init input_trig_init(void) ++{ ++ return led_trigger_register(&input_led_trigger); ++} ++ ++static void __exit input_trig_exit(void) ++{ ++ led_trigger_unregister(&input_led_trigger); ++} ++ ++module_init(input_trig_init); ++module_exit(input_trig_exit); ++ ++MODULE_AUTHOR("Phil Elwell <phil@raspberrypi.org>"); ++MODULE_DESCRIPTION("Set LED GPIO to Input \"trigger\""); ++MODULE_LICENSE("GPL"); +diff --git a/include/linux/leds.h b/include/linux/leds.h +index f203a8f..555cf15 100644 +--- a/include/linux/leds.h ++++ b/include/linux/leds.h +@@ -50,6 +50,9 @@ struct led_classdev { + #define LED_SYSFS_DISABLE (1 << 22) + #define LED_DEV_CAP_FLASH (1 << 23) + #define LED_HW_PLUGGABLE (1 << 24) ++ /* Additions for Raspberry Pi PWR LED */ ++#define SET_GPIO_INPUT (1 << 30) ++#define SET_GPIO_OUTPUT (1 << 31) + + /* Set LED brightness level + * Must not sleep. Use brightness_set_blocking for drivers + +From ea3dfa01346c7b37d14b3b01b82d05fff57903bd Mon Sep 17 00:00:00 2001 +From: Siarhei Siamashka <siarhei.siamashka@gmail.com> +Date: Mon, 17 Jun 2013 13:32:11 +0300 +Subject: [PATCH 061/112] fbdev: add FBIOCOPYAREA ioctl + +Based on the patch authored by Ali Gholami Rudi at + https://lkml.org/lkml/2009/7/13/153 + +Provide an ioctl for userspace applications, but only if this operation +is hardware accelerated (otherwide it does not make any sense). + +Signed-off-by: Siarhei Siamashka <siarhei.siamashka@gmail.com> +--- + drivers/video/fbdev/core/fbmem.c | 30 ++++++++++++++++++++++++++++++ + include/uapi/linux/fb.h | 5 +++++ + 2 files changed, 35 insertions(+) + +diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c +index 4e73b6f..d3a8cc3 100644 +--- a/drivers/video/fbdev/core/fbmem.c ++++ b/drivers/video/fbdev/core/fbmem.c +@@ -1084,6 +1084,25 @@ fb_blank(struct fb_info *info, int blank) + } + EXPORT_SYMBOL(fb_blank); + ++static int fb_copyarea_user(struct fb_info *info, ++ struct fb_copyarea *copy) ++{ ++ int ret = 0; ++ if (!lock_fb_info(info)) ++ return -ENODEV; ++ if (copy->dx + copy->width > info->var.xres || ++ copy->sx + copy->width > info->var.xres || ++ copy->dy + copy->height > info->var.yres || ++ copy->sy + copy->height > info->var.yres) { ++ ret = -EINVAL; ++ goto out; ++ } ++ info->fbops->fb_copyarea(info, copy); ++out: ++ unlock_fb_info(info); ++ return ret; ++} ++ + static long do_fb_ioctl(struct fb_info *info, unsigned int cmd, + unsigned long arg) + { +@@ -1094,6 +1113,7 @@ static long do_fb_ioctl(struct fb_info *info, unsigned int cmd, + struct fb_cmap cmap_from; + struct fb_cmap_user cmap; + struct fb_event event; ++ struct fb_copyarea copy; + void __user *argp = (void __user *)arg; + long ret = 0; + +@@ -1211,6 +1231,15 @@ static long do_fb_ioctl(struct fb_info *info, unsigned int cmd, + unlock_fb_info(info); + console_unlock(); + break; ++ case FBIOCOPYAREA: ++ if (info->flags & FBINFO_HWACCEL_COPYAREA) { ++ /* only provide this ioctl if it is accelerated */ ++ if (copy_from_user(&copy, argp, sizeof(copy))) ++ return -EFAULT; ++ ret = fb_copyarea_user(info, &copy); ++ break; ++ } ++ /* fall through */ + default: + if (!lock_fb_info(info)) + return -ENODEV; +@@ -1365,6 +1394,7 @@ static long fb_compat_ioctl(struct file *file, unsigned int cmd, + case FBIOPAN_DISPLAY: + case FBIOGET_CON2FBMAP: + case FBIOPUT_CON2FBMAP: ++ case FBIOCOPYAREA: + arg = (unsigned long) compat_ptr(arg); + case FBIOBLANK: + ret = do_fb_ioctl(info, cmd, arg); +diff --git a/include/uapi/linux/fb.h b/include/uapi/linux/fb.h +index fb795c3..fa72af0 100644 +--- a/include/uapi/linux/fb.h ++++ b/include/uapi/linux/fb.h +@@ -34,6 +34,11 @@ + #define FBIOPUT_MODEINFO 0x4617 + #define FBIOGET_DISPINFO 0x4618 + #define FBIO_WAITFORVSYNC _IOW('F', 0x20, __u32) ++/* ++ * HACK: use 'z' in order not to clash with any other ioctl numbers which might ++ * be concurrently added to the mainline kernel ++ */ ++#define FBIOCOPYAREA _IOW('z', 0x21, struct fb_copyarea) + + #define FB_TYPE_PACKED_PIXELS 0 /* Packed Pixels */ + #define FB_TYPE_PLANES 1 /* Non interleaved planes */ + +From 3de9d9af98b49cd140532eee17196742d1d875c7 Mon Sep 17 00:00:00 2001 +From: Harm Hanemaaijer <fgenfb@yahoo.com> +Date: Thu, 20 Jun 2013 20:21:39 +0200 +Subject: [PATCH 062/112] Speed up console framebuffer imageblit function + +Especially on platforms with a slower CPU but a relatively high +framebuffer fill bandwidth, like current ARM devices, the existing +console monochrome imageblit function used to draw console text is +suboptimal for common pixel depths such as 16bpp and 32bpp. The existing +code is quite general and can deal with several pixel depths. By creating +special case functions for 16bpp and 32bpp, by far the most common pixel +formats used on modern systems, a significant speed-up is attained +which can be readily felt on ARM-based devices like the Raspberry Pi +and the Allwinner platform, but should help any platform using the +fb layer. + +The special case functions allow constant folding, eliminating a number +of instructions including divide operations, and allow the use of an +unrolled loop, eliminating instructions with a variable shift size, +reducing source memory access instructions, and eliminating excessive +branching. These unrolled loops also allow much better code optimization +by the C compiler. The code that selects which optimized variant is used +is also simplified, eliminating integer divide instructions. + +The speed-up, measured by timing 'cat file.txt' in the console, varies +between 40% and 70%, when testing on the Raspberry Pi and Allwinner +ARM-based platforms, depending on font size and the pixel depth, with +the greater benefit for 32bpp. + +Signed-off-by: Harm Hanemaaijer <fgenfb@yahoo.com> +--- + drivers/video/fbdev/core/cfbimgblt.c | 152 +++++++++++++++++++++++++++++++++-- + 1 file changed, 147 insertions(+), 5 deletions(-) + +diff --git a/drivers/video/fbdev/core/cfbimgblt.c b/drivers/video/fbdev/core/cfbimgblt.c +index a2bb276..436494f 100644 +--- a/drivers/video/fbdev/core/cfbimgblt.c ++++ b/drivers/video/fbdev/core/cfbimgblt.c +@@ -28,6 +28,11 @@ + * + * Also need to add code to deal with cards endians that are different than + * the native cpu endians. I also need to deal with MSB position in the word. ++ * Modified by Harm Hanemaaijer (fgenfb@yahoo.com) 2013: ++ * - Provide optimized versions of fast_imageblit for 16 and 32bpp that are ++ * significantly faster than the previous implementation. ++ * - Simplify the fast/slow_imageblit selection code, avoiding integer ++ * divides. + */ + #include <linux/module.h> + #include <linux/string.h> +@@ -262,6 +267,133 @@ static inline void fast_imageblit(const struct fb_image *image, struct fb_info * + } + } + ++/* ++ * Optimized fast_imageblit for bpp == 16. ppw = 2, bit_mask = 3 folded ++ * into the code, main loop unrolled. ++ */ ++ ++static inline void fast_imageblit16(const struct fb_image *image, ++ struct fb_info *p, u8 __iomem * dst1, ++ u32 fgcolor, u32 bgcolor) ++{ ++ u32 fgx = fgcolor, bgx = bgcolor; ++ u32 spitch = (image->width + 7) / 8; ++ u32 end_mask, eorx; ++ const char *s = image->data, *src; ++ u32 __iomem *dst; ++ const u32 *tab = NULL; ++ int i, j, k; ++ ++ tab = fb_be_math(p) ? cfb_tab16_be : cfb_tab16_le; ++ ++ fgx <<= 16; ++ bgx <<= 16; ++ fgx |= fgcolor; ++ bgx |= bgcolor; ++ ++ eorx = fgx ^ bgx; ++ k = image->width / 2; ++ ++ for (i = image->height; i--;) { ++ dst = (u32 __iomem *) dst1; ++ src = s; ++ ++ j = k; ++ while (j >= 4) { ++ u8 bits = *src; ++ end_mask = tab[(bits >> 6) & 3]; ++ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); ++ end_mask = tab[(bits >> 4) & 3]; ++ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); ++ end_mask = tab[(bits >> 2) & 3]; ++ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); ++ end_mask = tab[bits & 3]; ++ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); ++ src++; ++ j -= 4; ++ } ++ if (j != 0) { ++ u8 bits = *src; ++ end_mask = tab[(bits >> 6) & 3]; ++ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); ++ if (j >= 2) { ++ end_mask = tab[(bits >> 4) & 3]; ++ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); ++ if (j == 3) { ++ end_mask = tab[(bits >> 2) & 3]; ++ FB_WRITEL((end_mask & eorx) ^ bgx, dst); ++ } ++ } ++ } ++ dst1 += p->fix.line_length; ++ s += spitch; ++ } ++} ++ ++/* ++ * Optimized fast_imageblit for bpp == 32. ppw = 1, bit_mask = 1 folded ++ * into the code, main loop unrolled. ++ */ ++ ++static inline void fast_imageblit32(const struct fb_image *image, ++ struct fb_info *p, u8 __iomem * dst1, ++ u32 fgcolor, u32 bgcolor) ++{ ++ u32 fgx = fgcolor, bgx = bgcolor; ++ u32 spitch = (image->width + 7) / 8; ++ u32 end_mask, eorx; ++ const char *s = image->data, *src; ++ u32 __iomem *dst; ++ const u32 *tab = NULL; ++ int i, j, k; ++ ++ tab = cfb_tab32; ++ ++ eorx = fgx ^ bgx; ++ k = image->width; ++ ++ for (i = image->height; i--;) { ++ dst = (u32 __iomem *) dst1; ++ src = s; ++ ++ j = k; ++ while (j >= 8) { ++ u8 bits = *src; ++ end_mask = tab[(bits >> 7) & 1]; ++ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); ++ end_mask = tab[(bits >> 6) & 1]; ++ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); ++ end_mask = tab[(bits >> 5) & 1]; ++ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); ++ end_mask = tab[(bits >> 4) & 1]; ++ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); ++ end_mask = tab[(bits >> 3) & 1]; ++ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); ++ end_mask = tab[(bits >> 2) & 1]; ++ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); ++ end_mask = tab[(bits >> 1) & 1]; ++ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); ++ end_mask = tab[bits & 1]; ++ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); ++ src++; ++ j -= 8; ++ } ++ if (j != 0) { ++ u32 bits = (u32) * src; ++ while (j > 1) { ++ end_mask = tab[(bits >> 7) & 1]; ++ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); ++ bits <<= 1; ++ j--; ++ } ++ end_mask = tab[(bits >> 7) & 1]; ++ FB_WRITEL((end_mask & eorx) ^ bgx, dst); ++ } ++ dst1 += p->fix.line_length; ++ s += spitch; ++ } ++} ++ + void cfb_imageblit(struct fb_info *p, const struct fb_image *image) + { + u32 fgcolor, bgcolor, start_index, bitstart, pitch_index = 0; +@@ -294,11 +426,21 @@ void cfb_imageblit(struct fb_info *p, const struct fb_image *image) + bgcolor = image->bg_color; + } + +- if (32 % bpp == 0 && !start_index && !pitch_index && +- ((width & (32/bpp-1)) == 0) && +- bpp >= 8 && bpp <= 32) +- fast_imageblit(image, p, dst1, fgcolor, bgcolor); +- else ++ if (!start_index && !pitch_index) { ++ if (bpp == 32) ++ fast_imageblit32(image, p, dst1, fgcolor, ++ bgcolor); ++ else if (bpp == 16 && (width & 1) == 0) ++ fast_imageblit16(image, p, dst1, fgcolor, ++ bgcolor); ++ else if (bpp == 8 && (width & 3) == 0) ++ fast_imageblit(image, p, dst1, fgcolor, ++ bgcolor); ++ else ++ slow_imageblit(image, p, dst1, fgcolor, ++ bgcolor, ++ start_index, pitch_index); ++ } else + slow_imageblit(image, p, dst1, fgcolor, bgcolor, + start_index, pitch_index); + } else + +From fe2e696dfa4ad9e5a5f6c772efc6be7e8aba5a75 Mon Sep 17 00:00:00 2001 +From: popcornmix <popcornmix@gmail.com> +Date: Wed, 8 May 2013 11:46:50 +0100 +Subject: [PATCH 063/112] enabling the realtime clock 1-wire chip DS1307 and + 1-wire on GPIO4 (as a module) + +1-wire: Add support for configuring pin for w1-gpio kernel module +See: https://github.com/raspberrypi/linux/pull/457 + +Add bitbanging pullups, use them for w1-gpio + +Allows parasite power to work, uses module option pullup=1 + +bcm2708: Ensure 1-wire pullup is disabled by default, and expose as module parameter + +Signed-off-by: Alex J Lennon <ajlennon@dynamicdevices.co.uk> + +w1-gpio: Add gpiopin module parameter and correctly free up gpio pull-up pin, if set + +Signed-off-by: Alex J Lennon <ajlennon@dynamicdevices.co.uk> + +w1-gpio: Sort out the pullup/parasitic power tangle +--- + drivers/w1/masters/w1-gpio.c | 69 ++++++++++++++++++++++++++++++++++++++++---- + drivers/w1/w1.h | 6 ++++ + drivers/w1/w1_int.c | 14 +++++++++ + drivers/w1/w1_io.c | 18 ++++++++++-- + include/linux/w1-gpio.h | 1 + + 5 files changed, 99 insertions(+), 9 deletions(-) + +diff --git a/drivers/w1/masters/w1-gpio.c b/drivers/w1/masters/w1-gpio.c +index a373ae6..080e597 100644 +--- a/drivers/w1/masters/w1-gpio.c ++++ b/drivers/w1/masters/w1-gpio.c +@@ -23,6 +23,19 @@ + #include "../w1.h" + #include "../w1_int.h" + ++static int w1_gpio_pullup = 0; ++static int w1_gpio_pullup_orig = 0; ++module_param_named(pullup, w1_gpio_pullup, int, 0); ++MODULE_PARM_DESC(pullup, "Enable parasitic power (power on data) mode"); ++static int w1_gpio_pullup_pin = -1; ++static int w1_gpio_pullup_pin_orig = -1; ++module_param_named(extpullup, w1_gpio_pullup_pin, int, 0); ++MODULE_PARM_DESC(extpullup, "GPIO external pullup pin number"); ++static int w1_gpio_pin = -1; ++static int w1_gpio_pin_orig = -1; ++module_param_named(gpiopin, w1_gpio_pin, int, 0); ++MODULE_PARM_DESC(gpiopin, "GPIO pin number"); ++ + static u8 w1_gpio_set_pullup(void *data, int delay) + { + struct w1_gpio_platform_data *pdata = data; +@@ -67,6 +80,16 @@ static u8 w1_gpio_read_bit(void *data) + return gpio_get_value(pdata->pin) ? 1 : 0; + } + ++static void w1_gpio_bitbang_pullup(void *data, u8 on) ++{ ++ struct w1_gpio_platform_data *pdata = data; ++ ++ if (on) ++ gpio_direction_output(pdata->pin, 1); ++ else ++ gpio_direction_input(pdata->pin); ++} ++ + #if defined(CONFIG_OF) + static const struct of_device_id w1_gpio_dt_ids[] = { + { .compatible = "w1-gpio" }, +@@ -80,6 +103,7 @@ static int w1_gpio_probe_dt(struct platform_device *pdev) + struct w1_gpio_platform_data *pdata = dev_get_platdata(&pdev->dev); + struct device_node *np = pdev->dev.of_node; + int gpio; ++ u32 value; + + pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); + if (!pdata) +@@ -88,6 +112,9 @@ static int w1_gpio_probe_dt(struct platform_device *pdev) + if (of_get_property(np, "linux,open-drain", NULL)) + pdata->is_open_drain = 1; + ++ if (of_property_read_u32(np, "rpi,parasitic-power", &value) == 0) ++ pdata->parasitic_power = (value != 0); ++ + gpio = of_get_gpio(np, 0); + if (gpio < 0) { + if (gpio != -EPROBE_DEFER) +@@ -103,7 +130,7 @@ static int w1_gpio_probe_dt(struct platform_device *pdev) + if (gpio == -EPROBE_DEFER) + return gpio; + /* ignore other errors as the pullup gpio is optional */ +- pdata->ext_pullup_enable_pin = gpio; ++ pdata->ext_pullup_enable_pin = (gpio >= 0) ? gpio : -1; + + pdev->dev.platform_data = pdata; + +@@ -113,13 +140,15 @@ static int w1_gpio_probe_dt(struct platform_device *pdev) + static int w1_gpio_probe(struct platform_device *pdev) + { + struct w1_bus_master *master; +- struct w1_gpio_platform_data *pdata; ++ struct w1_gpio_platform_data *pdata = pdev->dev.platform_data; + int err; + +- if (of_have_populated_dt()) { +- err = w1_gpio_probe_dt(pdev); +- if (err < 0) +- return err; ++ if(pdata == NULL) { ++ if (of_have_populated_dt()) { ++ err = w1_gpio_probe_dt(pdev); ++ if (err < 0) ++ return err; ++ } + } + + pdata = dev_get_platdata(&pdev->dev); +@@ -136,6 +165,22 @@ static int w1_gpio_probe(struct platform_device *pdev) + return -ENOMEM; + } + ++ w1_gpio_pin_orig = pdata->pin; ++ w1_gpio_pullup_pin_orig = pdata->ext_pullup_enable_pin; ++ w1_gpio_pullup_orig = pdata->parasitic_power; ++ ++ if(gpio_is_valid(w1_gpio_pin)) { ++ pdata->pin = w1_gpio_pin; ++ pdata->ext_pullup_enable_pin = -1; ++ pdata->parasitic_power = -1; ++ } ++ pdata->parasitic_power |= w1_gpio_pullup; ++ if(gpio_is_valid(w1_gpio_pullup_pin)) { ++ pdata->ext_pullup_enable_pin = w1_gpio_pullup_pin; ++ } ++ ++ dev_info(&pdev->dev, "gpio pin %d, external pullup pin %d, parasitic power %d\n", pdata->pin, pdata->ext_pullup_enable_pin, pdata->parasitic_power); ++ + err = devm_gpio_request(&pdev->dev, pdata->pin, "w1"); + if (err) { + dev_err(&pdev->dev, "gpio_request (pin) failed\n"); +@@ -165,6 +210,14 @@ static int w1_gpio_probe(struct platform_device *pdev) + master->set_pullup = w1_gpio_set_pullup; + } + ++ if (pdata->parasitic_power) { ++ if (pdata->is_open_drain) ++ printk(KERN_ERR "w1-gpio 'pullup'(parasitic power) " ++ "option doesn't work with open drain GPIO\n"); ++ else ++ master->bitbang_pullup = w1_gpio_bitbang_pullup; ++ } ++ + err = w1_add_master_device(master); + if (err) { + dev_err(&pdev->dev, "w1_add_master device failed\n"); +@@ -195,6 +248,10 @@ static int w1_gpio_remove(struct platform_device *pdev) + + w1_remove_master_device(master); + ++ pdata->pin = w1_gpio_pin_orig; ++ pdata->ext_pullup_enable_pin = w1_gpio_pullup_pin_orig; ++ pdata->parasitic_power = w1_gpio_pullup_orig; ++ + return 0; + } + +diff --git a/drivers/w1/w1.h b/drivers/w1/w1.h +index 56a49ba..881d728 100644 +--- a/drivers/w1/w1.h ++++ b/drivers/w1/w1.h +@@ -171,6 +171,12 @@ struct w1_bus_master + + u8 (*set_pullup)(void *, int); + ++ /** ++ * Turns the pullup on/off in bitbanging mode, takes an on/off argument. ++ * @return -1=Error, 0=completed ++ */ ++ void (*bitbang_pullup) (void *, u8); ++ + void (*search)(void *, struct w1_master *, + u8, w1_slave_found_callback); + }; +diff --git a/drivers/w1/w1_int.c b/drivers/w1/w1_int.c +index 20f766a..c4fbdb1 100644 +--- a/drivers/w1/w1_int.c ++++ b/drivers/w1/w1_int.c +@@ -122,6 +122,20 @@ int w1_add_master_device(struct w1_bus_master *master) + return(-EINVAL); + } + ++ /* bitbanging hardware uses bitbang_pullup, other hardware uses set_pullup ++ * and takes care of timing itself */ ++ if (!master->write_byte && !master->touch_bit && master->set_pullup) { ++ printk(KERN_ERR "w1_add_master_device: set_pullup requires " ++ "write_byte or touch_bit, disabling\n"); ++ master->set_pullup = NULL; ++ } ++ ++ if (master->set_pullup && master->bitbang_pullup) { ++ printk(KERN_ERR "w1_add_master_device: set_pullup should not " ++ "be set when bitbang_pullup is used, disabling\n"); ++ master->set_pullup = NULL; ++ } ++ + /* Lock until the device is added (or not) to w1_masters. */ + mutex_lock(&w1_mlock); + /* Search for the first available id (starting at 1). */ +diff --git a/drivers/w1/w1_io.c b/drivers/w1/w1_io.c +index 2820924..fd0550f 100644 +--- a/drivers/w1/w1_io.c ++++ b/drivers/w1/w1_io.c +@@ -134,10 +134,22 @@ static void w1_pre_write(struct w1_master *dev) + static void w1_post_write(struct w1_master *dev) + { + if (dev->pullup_duration) { +- if (dev->enable_pullup && dev->bus_master->set_pullup) +- dev->bus_master->set_pullup(dev->bus_master->data, 0); +- else ++ if (dev->enable_pullup) { ++ if (dev->bus_master->set_pullup) { ++ dev->bus_master->set_pullup(dev-> ++ bus_master->data, ++ 0); ++ } else if (dev->bus_master->bitbang_pullup) { ++ dev->bus_master-> ++ bitbang_pullup(dev->bus_master->data, 1); ++ msleep(dev->pullup_duration); ++ dev->bus_master-> ++ bitbang_pullup(dev->bus_master->data, 0); ++ } ++ } else { + msleep(dev->pullup_duration); ++ } ++ + dev->pullup_duration = 0; + } + } +diff --git a/include/linux/w1-gpio.h b/include/linux/w1-gpio.h +index d58594a..feae942 100644 +--- a/include/linux/w1-gpio.h ++++ b/include/linux/w1-gpio.h +@@ -18,6 +18,7 @@ + struct w1_gpio_platform_data { + unsigned int pin; + unsigned int is_open_drain:1; ++ unsigned int parasitic_power:1; + void (*enable_external_pullup)(int enable); + unsigned int ext_pullup_enable_pin; + unsigned int pullup_duration; + +From 8f8fe914a218412e705869e5ca6b205556275bf3 Mon Sep 17 00:00:00 2001 +From: popcornmix <popcornmix@gmail.com> +Date: Wed, 18 Dec 2013 22:16:19 +0000 +Subject: [PATCH 064/112] config: Enable CONFIG_MEMCG, but leave it disabled + (due to memory cost). Enable with cgroup_enable=memory. + +--- + kernel/cgroup.c | 24 +++++++++++++++++++++++- + 1 file changed, 23 insertions(+), 1 deletion(-) + +diff --git a/kernel/cgroup.c b/kernel/cgroup.c +index 86cb5c6..0b5668a 100644 +--- a/kernel/cgroup.c ++++ b/kernel/cgroup.c +@@ -5587,7 +5587,7 @@ int __init cgroup_init_early(void) + return 0; + } + +-static u16 cgroup_disable_mask __initdata; ++static u16 cgroup_disable_mask __initdata = 1<<0; + + /** + * cgroup_init - cgroup initialization +@@ -6117,6 +6117,28 @@ static int __init cgroup_no_v1(char *str) + } + __setup("cgroup_no_v1=", cgroup_no_v1); + ++static int __init cgroup_enable(char *str) ++{ ++ struct cgroup_subsys *ss; ++ char *token; ++ int i; ++ ++ while ((token = strsep(&str, ",")) != NULL) { ++ if (!*token) ++ continue; ++ ++ for_each_subsys(ss, i) { ++ if (strcmp(token, ss->name) && ++ strcmp(token, ss->legacy_name)) ++ continue; ++ ++ cgroup_disable_mask &= ~(1 << i); ++ } ++ } ++ return 1; ++} ++__setup("cgroup_enable=", cgroup_enable); ++ + /** + * css_tryget_online_from_dir - get corresponding css from a cgroup dentry + * @dentry: directory dentry of interest + +From 52e23c689e7112dee3f533c35dc4d952293a2694 Mon Sep 17 00:00:00 2001 +From: Florian Meier <florian.meier@koalo.de> +Date: Fri, 22 Nov 2013 14:59:51 +0100 +Subject: [PATCH 065/112] ASoC: Add support for PCM5102A codec + +Some definitions to support the PCM5102A codec +by Texas Instruments. + +Signed-off-by: Florian Meier <florian.meier@koalo.de> +--- + sound/soc/codecs/Kconfig | 5 ++++ + sound/soc/codecs/Makefile | 2 ++ + sound/soc/codecs/pcm5102a.c | 70 +++++++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 77 insertions(+) + create mode 100644 sound/soc/codecs/pcm5102a.c + +diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig +index 7ef3a0c..4308f90 100644 +--- a/sound/soc/codecs/Kconfig ++++ b/sound/soc/codecs/Kconfig +@@ -100,6 +100,7 @@ config SND_SOC_ALL_CODECS + select SND_SOC_RT298 if I2C + select SND_SOC_RT5514 if I2C + select SND_SOC_RT5616 if I2C ++ select SND_SOC_PCM5102A if I2C + select SND_SOC_RT5631 if I2C + select SND_SOC_RT5640 if I2C + select SND_SOC_RT5645 if I2C +@@ -631,6 +632,10 @@ config SND_SOC_RT5616 + tristate "Realtek RT5616 CODEC" + depends on I2C + ++config SND_SOC_PCM5102A ++ tristate ++ depends on I2C ++ + config SND_SOC_RT5631 + tristate "Realtek ALC5631/RT5631 CODEC" + depends on I2C +diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile +index 185a712..7522017 100644 +--- a/sound/soc/codecs/Makefile ++++ b/sound/soc/codecs/Makefile +@@ -98,6 +98,7 @@ snd-soc-rt286-objs := rt286.o + snd-soc-rt298-objs := rt298.o + snd-soc-rt5514-objs := rt5514.o + snd-soc-rt5616-objs := rt5616.o ++snd-soc-pcm5102a-objs := pcm5102a.o + snd-soc-rt5631-objs := rt5631.o + snd-soc-rt5640-objs := rt5640.o + snd-soc-rt5645-objs := rt5645.o +@@ -307,6 +308,7 @@ obj-$(CONFIG_SND_SOC_RT286) += snd-soc-rt286.o + obj-$(CONFIG_SND_SOC_RT298) += snd-soc-rt298.o + obj-$(CONFIG_SND_SOC_RT5514) += snd-soc-rt5514.o + obj-$(CONFIG_SND_SOC_RT5616) += snd-soc-rt5616.o ++obj-$(CONFIG_SND_SOC_PCM5102A) += snd-soc-pcm5102a.o + obj-$(CONFIG_SND_SOC_RT5631) += snd-soc-rt5631.o + obj-$(CONFIG_SND_SOC_RT5640) += snd-soc-rt5640.o + obj-$(CONFIG_SND_SOC_RT5645) += snd-soc-rt5645.o +diff --git a/sound/soc/codecs/pcm5102a.c b/sound/soc/codecs/pcm5102a.c +new file mode 100644 +index 0000000..7c6598e +--- /dev/null ++++ b/sound/soc/codecs/pcm5102a.c +@@ -0,0 +1,70 @@ ++/* ++ * Driver for the PCM5102A codec ++ * ++ * Author: Florian Meier <florian.meier@koalo.de> ++ * Copyright 2013 ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * version 2 as published by the Free Software Foundation. ++ * ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * General Public License for more details. ++ */ ++ ++ ++#include <linux/init.h> ++#include <linux/module.h> ++#include <linux/platform_device.h> ++ ++#include <sound/soc.h> ++ ++static struct snd_soc_dai_driver pcm5102a_dai = { ++ .name = "pcm5102a-hifi", ++ .playback = { ++ .channels_min = 2, ++ .channels_max = 2, ++ .rates = SNDRV_PCM_RATE_8000_192000, ++ .formats = SNDRV_PCM_FMTBIT_S16_LE | ++ SNDRV_PCM_FMTBIT_S24_LE | ++ SNDRV_PCM_FMTBIT_S32_LE ++ }, ++}; ++ ++static struct snd_soc_codec_driver soc_codec_dev_pcm5102a; ++ ++static int pcm5102a_probe(struct platform_device *pdev) ++{ ++ return snd_soc_register_codec(&pdev->dev, &soc_codec_dev_pcm5102a, ++ &pcm5102a_dai, 1); ++} ++ ++static int pcm5102a_remove(struct platform_device *pdev) ++{ ++ snd_soc_unregister_codec(&pdev->dev); ++ return 0; ++} ++ ++static const struct of_device_id pcm5102a_of_match[] = { ++ { .compatible = "ti,pcm5102a", }, ++ { } ++}; ++MODULE_DEVICE_TABLE(of, pcm5102a_of_match); ++ ++static struct platform_driver pcm5102a_codec_driver = { ++ .probe = pcm5102a_probe, ++ .remove = pcm5102a_remove, ++ .driver = { ++ .name = "pcm5102a-codec", ++ .owner = THIS_MODULE, ++ .of_match_table = pcm5102a_of_match, ++ }, ++}; ++ ++module_platform_driver(pcm5102a_codec_driver); ++ ++MODULE_DESCRIPTION("ASoC PCM5102A codec driver"); ++MODULE_AUTHOR("Florian Meier <florian.meier@koalo.de>"); ++MODULE_LICENSE("GPL v2"); + +From 8963bf5947a58437d86fd18cd2e1a3dacb6c16ae Mon Sep 17 00:00:00 2001 +From: Florian Meier <florian.meier@koalo.de> +Date: Fri, 22 Nov 2013 19:19:08 +0100 +Subject: [PATCH 066/112] ASoC: Add support for HifiBerry DAC + +This adds a machine driver for the HifiBerry DAC. +It is a sound card that can +be stacked onto the Raspberry Pi. + +Signed-off-by: Florian Meier <florian.meier@koalo.de> +--- + sound/soc/bcm/Kconfig | 7 +++ + sound/soc/bcm/Makefile | 4 ++ + sound/soc/bcm/hifiberry_dac.c | 123 ++++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 134 insertions(+) + create mode 100644 sound/soc/bcm/hifiberry_dac.c + +diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig +index c5070ae..ce81f14 100644 +--- a/sound/soc/bcm/Kconfig ++++ b/sound/soc/bcm/Kconfig +@@ -7,3 +7,10 @@ config SND_BCM2835_SOC_I2S + Say Y or M if you want to add support for codecs attached to + the BCM2835 I2S interface. You will also need + to select the audio interfaces to support below. ++ ++config SND_BCM2708_SOC_HIFIBERRY_DAC ++ tristate "Support for HifiBerry DAC" ++ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S ++ select SND_SOC_PCM5102A ++ help ++ Say Y or M if you want to add support for HifiBerry DAC. +diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile +index bc816b7..b877d38 100644 +--- a/sound/soc/bcm/Makefile ++++ b/sound/soc/bcm/Makefile +@@ -3,3 +3,7 @@ snd-soc-bcm2835-i2s-objs := bcm2835-i2s.o + + obj-$(CONFIG_SND_BCM2835_SOC_I2S) += snd-soc-bcm2835-i2s.o + ++# BCM2708 Machine Support ++snd-soc-hifiberry-dac-objs := hifiberry_dac.o ++ ++obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o +diff --git a/sound/soc/bcm/hifiberry_dac.c b/sound/soc/bcm/hifiberry_dac.c +new file mode 100644 +index 0000000..29ecc08 +--- /dev/null ++++ b/sound/soc/bcm/hifiberry_dac.c +@@ -0,0 +1,123 @@ ++/* ++ * ASoC Driver for HifiBerry DAC ++ * ++ * Author: Florian Meier <florian.meier@koalo.de> ++ * Copyright 2013 ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * version 2 as published by the Free Software Foundation. ++ * ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * General Public License for more details. ++ */ ++ ++#include <linux/module.h> ++#include <linux/platform_device.h> ++ ++#include <sound/core.h> ++#include <sound/pcm.h> ++#include <sound/pcm_params.h> ++#include <sound/soc.h> ++#include <sound/jack.h> ++ ++static int snd_rpi_hifiberry_dac_init(struct snd_soc_pcm_runtime *rtd) ++{ ++ return 0; ++} ++ ++static int snd_rpi_hifiberry_dac_hw_params(struct snd_pcm_substream *substream, ++ struct snd_pcm_hw_params *params) ++{ ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; ++ ++ unsigned int sample_bits = ++ snd_pcm_format_physical_width(params_format(params)); ++ ++ return snd_soc_dai_set_bclk_ratio(cpu_dai, sample_bits * 2); ++} ++ ++/* machine stream operations */ ++static struct snd_soc_ops snd_rpi_hifiberry_dac_ops = { ++ .hw_params = snd_rpi_hifiberry_dac_hw_params, ++}; ++ ++static struct snd_soc_dai_link snd_rpi_hifiberry_dac_dai[] = { ++{ ++ .name = "HifiBerry DAC", ++ .stream_name = "HifiBerry DAC HiFi", ++ .cpu_dai_name = "bcm2708-i2s.0", ++ .codec_dai_name = "pcm5102a-hifi", ++ .platform_name = "bcm2708-i2s.0", ++ .codec_name = "pcm5102a-codec", ++ .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | ++ SND_SOC_DAIFMT_CBS_CFS, ++ .ops = &snd_rpi_hifiberry_dac_ops, ++ .init = snd_rpi_hifiberry_dac_init, ++}, ++}; ++ ++/* audio machine driver */ ++static struct snd_soc_card snd_rpi_hifiberry_dac = { ++ .name = "snd_rpi_hifiberry_dac", ++ .owner = THIS_MODULE, ++ .dai_link = snd_rpi_hifiberry_dac_dai, ++ .num_links = ARRAY_SIZE(snd_rpi_hifiberry_dac_dai), ++}; ++ ++static int snd_rpi_hifiberry_dac_probe(struct platform_device *pdev) ++{ ++ int ret = 0; ++ ++ snd_rpi_hifiberry_dac.dev = &pdev->dev; ++ ++ if (pdev->dev.of_node) { ++ struct device_node *i2s_node; ++ struct snd_soc_dai_link *dai = &snd_rpi_hifiberry_dac_dai[0]; ++ i2s_node = of_parse_phandle(pdev->dev.of_node, ++ "i2s-controller", 0); ++ ++ if (i2s_node) { ++ dai->cpu_dai_name = NULL; ++ dai->cpu_of_node = i2s_node; ++ dai->platform_name = NULL; ++ dai->platform_of_node = i2s_node; ++ } ++ } ++ ++ ret = snd_soc_register_card(&snd_rpi_hifiberry_dac); ++ if (ret) ++ dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", ret); ++ ++ return ret; ++} ++ ++static int snd_rpi_hifiberry_dac_remove(struct platform_device *pdev) ++{ ++ return snd_soc_unregister_card(&snd_rpi_hifiberry_dac); ++} ++ ++static const struct of_device_id snd_rpi_hifiberry_dac_of_match[] = { ++ { .compatible = "hifiberry,hifiberry-dac", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, snd_rpi_hifiberry_dac_of_match); ++ ++static struct platform_driver snd_rpi_hifiberry_dac_driver = { ++ .driver = { ++ .name = "snd-hifiberry-dac", ++ .owner = THIS_MODULE, ++ .of_match_table = snd_rpi_hifiberry_dac_of_match, ++ }, ++ .probe = snd_rpi_hifiberry_dac_probe, ++ .remove = snd_rpi_hifiberry_dac_remove, ++}; ++ ++module_platform_driver(snd_rpi_hifiberry_dac_driver); ++ ++MODULE_AUTHOR("Florian Meier <florian.meier@koalo.de>"); ++MODULE_DESCRIPTION("ASoC Driver for HifiBerry DAC"); ++MODULE_LICENSE("GPL v2"); + +From 133cbdab8d6f90145845d63730736887fbeb3cbe Mon Sep 17 00:00:00 2001 +From: Florian Meier <florian.meier@koalo.de> +Date: Mon, 25 Jan 2016 15:48:59 +0000 +Subject: [PATCH 067/112] ASoC: Add support for Rpi-DAC + +--- + sound/soc/bcm/Kconfig | 7 +++ + sound/soc/bcm/Makefile | 2 + + sound/soc/bcm/rpi-dac.c | 119 ++++++++++++++++++++++++++++++++++++++++++++ + sound/soc/codecs/Kconfig | 9 ++++ + sound/soc/codecs/Makefile | 2 + + sound/soc/codecs/pcm1794a.c | 69 +++++++++++++++++++++++++ + 6 files changed, 208 insertions(+) + create mode 100644 sound/soc/bcm/rpi-dac.c + create mode 100644 sound/soc/codecs/pcm1794a.c + +diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig +index ce81f14..900de22 100644 +--- a/sound/soc/bcm/Kconfig ++++ b/sound/soc/bcm/Kconfig +@@ -14,3 +14,10 @@ config SND_BCM2708_SOC_HIFIBERRY_DAC + select SND_SOC_PCM5102A + help + Say Y or M if you want to add support for HifiBerry DAC. ++ ++config SND_BCM2708_SOC_RPI_DAC ++ tristate "Support for RPi-DAC" ++ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S ++ select SND_SOC_PCM1794A ++ help ++ Say Y or M if you want to add support for RPi-DAC. +diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile +index b877d38..99c96b4 100644 +--- a/sound/soc/bcm/Makefile ++++ b/sound/soc/bcm/Makefile +@@ -5,5 +5,7 @@ obj-$(CONFIG_SND_BCM2835_SOC_I2S) += snd-soc-bcm2835-i2s.o + + # BCM2708 Machine Support + snd-soc-hifiberry-dac-objs := hifiberry_dac.o ++snd-soc-rpi-dac-objs := rpi-dac.o + + obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o ++obj-$(CONFIG_SND_BCM2708_SOC_RPI_DAC) += snd-soc-rpi-dac.o +diff --git a/sound/soc/bcm/rpi-dac.c b/sound/soc/bcm/rpi-dac.c +new file mode 100644 +index 0000000..59dc89e +--- /dev/null ++++ b/sound/soc/bcm/rpi-dac.c +@@ -0,0 +1,119 @@ ++/* ++ * ASoC Driver for RPi-DAC. ++ * ++ * Author: Florian Meier <florian.meier@koalo.de> ++ * Copyright 2013 ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * version 2 as published by the Free Software Foundation. ++ * ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * General Public License for more details. ++ */ ++ ++#include <linux/module.h> ++#include <linux/platform_device.h> ++ ++#include <sound/core.h> ++#include <sound/pcm.h> ++#include <sound/pcm_params.h> ++#include <sound/soc.h> ++#include <sound/jack.h> ++ ++static int snd_rpi_rpi_dac_init(struct snd_soc_pcm_runtime *rtd) ++{ ++ return 0; ++} ++ ++static int snd_rpi_rpi_dac_hw_params(struct snd_pcm_substream *substream, ++ struct snd_pcm_hw_params *params) ++{ ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; ++ ++ return snd_soc_dai_set_bclk_ratio(cpu_dai, 32*2); ++} ++ ++/* machine stream operations */ ++static struct snd_soc_ops snd_rpi_rpi_dac_ops = { ++ .hw_params = snd_rpi_rpi_dac_hw_params, ++}; ++ ++static struct snd_soc_dai_link snd_rpi_rpi_dac_dai[] = { ++{ ++ .name = "RPi-DAC", ++ .stream_name = "RPi-DAC HiFi", ++ .cpu_dai_name = "bcm2708-i2s.0", ++ .codec_dai_name = "pcm1794a-hifi", ++ .platform_name = "bcm2708-i2s.0", ++ .codec_name = "pcm1794a-codec", ++ .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | ++ SND_SOC_DAIFMT_CBS_CFS, ++ .ops = &snd_rpi_rpi_dac_ops, ++ .init = snd_rpi_rpi_dac_init, ++}, ++}; ++ ++/* audio machine driver */ ++static struct snd_soc_card snd_rpi_rpi_dac = { ++ .name = "snd_rpi_rpi_dac", ++ .owner = THIS_MODULE, ++ .dai_link = snd_rpi_rpi_dac_dai, ++ .num_links = ARRAY_SIZE(snd_rpi_rpi_dac_dai), ++}; ++ ++static int snd_rpi_rpi_dac_probe(struct platform_device *pdev) ++{ ++ int ret = 0; ++ ++ snd_rpi_rpi_dac.dev = &pdev->dev; ++ ++ if (pdev->dev.of_node) { ++ struct device_node *i2s_node; ++ struct snd_soc_dai_link *dai = &snd_rpi_rpi_dac_dai[0]; ++ i2s_node = of_parse_phandle(pdev->dev.of_node, "i2s-controller", 0); ++ ++ if (i2s_node) { ++ dai->cpu_dai_name = NULL; ++ dai->cpu_of_node = i2s_node; ++ dai->platform_name = NULL; ++ dai->platform_of_node = i2s_node; ++ } ++ } ++ ++ ret = snd_soc_register_card(&snd_rpi_rpi_dac); ++ if (ret) ++ dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", ret); ++ ++ return ret; ++} ++ ++static int snd_rpi_rpi_dac_remove(struct platform_device *pdev) ++{ ++ return snd_soc_unregister_card(&snd_rpi_rpi_dac); ++} ++ ++static const struct of_device_id snd_rpi_rpi_dac_of_match[] = { ++ { .compatible = "rpi,rpi-dac", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, snd_rpi_rpi_dac_of_match); ++ ++static struct platform_driver snd_rpi_rpi_dac_driver = { ++ .driver = { ++ .name = "snd-rpi-dac", ++ .owner = THIS_MODULE, ++ .of_match_table = snd_rpi_rpi_dac_of_match, ++ }, ++ .probe = snd_rpi_rpi_dac_probe, ++ .remove = snd_rpi_rpi_dac_remove, ++}; ++ ++module_platform_driver(snd_rpi_rpi_dac_driver); ++ ++MODULE_AUTHOR("Florian Meier <florian.meier@koalo.de>"); ++MODULE_DESCRIPTION("ASoC Driver for RPi-DAC"); ++MODULE_LICENSE("GPL v2"); +diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig +index 4308f90..513ab55 100644 +--- a/sound/soc/codecs/Kconfig ++++ b/sound/soc/codecs/Kconfig +@@ -101,6 +101,7 @@ config SND_SOC_ALL_CODECS + select SND_SOC_RT5514 if I2C + select SND_SOC_RT5616 if I2C + select SND_SOC_PCM5102A if I2C ++ select SND_SOC_PCM1794A if I2C + select SND_SOC_RT5631 if I2C + select SND_SOC_RT5640 if I2C + select SND_SOC_RT5645 if I2C +@@ -632,6 +633,14 @@ config SND_SOC_RT5616 + tristate "Realtek RT5616 CODEC" + depends on I2C + ++config SND_SOC_RT298 ++ tristate ++ depends on I2C ++ ++config SND_SOC_PCM1794A ++ tristate ++ depends on I2C ++ + config SND_SOC_PCM5102A + tristate + depends on I2C +diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile +index 7522017..b87e845 100644 +--- a/sound/soc/codecs/Makefile ++++ b/sound/soc/codecs/Makefile +@@ -98,6 +98,7 @@ snd-soc-rt286-objs := rt286.o + snd-soc-rt298-objs := rt298.o + snd-soc-rt5514-objs := rt5514.o + snd-soc-rt5616-objs := rt5616.o ++snd-soc-pcm1794a-objs := pcm1794a.o + snd-soc-pcm5102a-objs := pcm5102a.o + snd-soc-rt5631-objs := rt5631.o + snd-soc-rt5640-objs := rt5640.o +@@ -308,6 +309,7 @@ obj-$(CONFIG_SND_SOC_RT286) += snd-soc-rt286.o + obj-$(CONFIG_SND_SOC_RT298) += snd-soc-rt298.o + obj-$(CONFIG_SND_SOC_RT5514) += snd-soc-rt5514.o + obj-$(CONFIG_SND_SOC_RT5616) += snd-soc-rt5616.o ++obj-$(CONFIG_SND_SOC_PCM1794A) += snd-soc-pcm1794a.o + obj-$(CONFIG_SND_SOC_PCM5102A) += snd-soc-pcm5102a.o + obj-$(CONFIG_SND_SOC_RT5631) += snd-soc-rt5631.o + obj-$(CONFIG_SND_SOC_RT5640) += snd-soc-rt5640.o +diff --git a/sound/soc/codecs/pcm1794a.c b/sound/soc/codecs/pcm1794a.c +new file mode 100644 +index 0000000..afe1b41 +--- /dev/null ++++ b/sound/soc/codecs/pcm1794a.c +@@ -0,0 +1,69 @@ ++/* ++ * Driver for the PCM1794A codec ++ * ++ * Author: Florian Meier <florian.meier@koalo.de> ++ * Copyright 2013 ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * version 2 as published by the Free Software Foundation. ++ * ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * General Public License for more details. ++ */ ++ ++ ++#include <linux/init.h> ++#include <linux/module.h> ++#include <linux/platform_device.h> ++ ++#include <sound/soc.h> ++ ++static struct snd_soc_dai_driver pcm1794a_dai = { ++ .name = "pcm1794a-hifi", ++ .playback = { ++ .channels_min = 2, ++ .channels_max = 2, ++ .rates = SNDRV_PCM_RATE_8000_192000, ++ .formats = SNDRV_PCM_FMTBIT_S16_LE | ++ SNDRV_PCM_FMTBIT_S24_LE ++ }, ++}; ++ ++static struct snd_soc_codec_driver soc_codec_dev_pcm1794a; ++ ++static int pcm1794a_probe(struct platform_device *pdev) ++{ ++ return snd_soc_register_codec(&pdev->dev, &soc_codec_dev_pcm1794a, ++ &pcm1794a_dai, 1); ++} ++ ++static int pcm1794a_remove(struct platform_device *pdev) ++{ ++ snd_soc_unregister_codec(&pdev->dev); ++ return 0; ++} ++ ++static const struct of_device_id pcm1794a_of_match[] = { ++ { .compatible = "ti,pcm1794a", }, ++ { } ++}; ++MODULE_DEVICE_TABLE(of, pcm1794a_of_match); ++ ++static struct platform_driver pcm1794a_codec_driver = { ++ .probe = pcm1794a_probe, ++ .remove = pcm1794a_remove, ++ .driver = { ++ .name = "pcm1794a-codec", ++ .owner = THIS_MODULE, ++ .of_match_table = of_match_ptr(pcm1794a_of_match), ++ }, ++}; ++ ++module_platform_driver(pcm1794a_codec_driver); ++ ++MODULE_DESCRIPTION("ASoC PCM1794A codec driver"); ++MODULE_AUTHOR("Florian Meier <florian.meier@koalo.de>"); ++MODULE_LICENSE("GPL v2"); + +From a8113bd47e56c48df869517ceff8a9e05d61e036 Mon Sep 17 00:00:00 2001 +From: Daniel Matuschek <info@crazy-audio.com> +Date: Wed, 15 Jan 2014 21:41:23 +0100 +Subject: [PATCH 068/112] ASoC: wm8804: Implement MCLK configuration options, + add 32bit support WM8804 can run with PLL frequencies of 256xfs and 128xfs + for most sample rates. At 192kHz only 128xfs is supported. The existing + driver selects 128xfs automatically for some lower samples rates. By using an + additional mclk_div divider, it is now possible to control the behaviour. + This allows using 256xfs PLL frequency on all sample rates up to 96kHz. It + should allow lower jitter and better signal quality. The behavior has to be + controlled by the sound card driver, because some sample frequency share the + same setting. e.g. 192kHz and 96kHz use 24.576MHz master clock. The only + difference is the MCLK divider. + +This also added support for 32bit data. + +Signed-off-by: Daniel Matuschek <daniel@matuschek.net> +--- + sound/soc/codecs/wm8804.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/sound/soc/codecs/wm8804.c b/sound/soc/codecs/wm8804.c +index 8d91470..c846716 100644 +--- a/sound/soc/codecs/wm8804.c ++++ b/sound/soc/codecs/wm8804.c +@@ -304,6 +304,7 @@ static int wm8804_hw_params(struct snd_pcm_substream *substream, + blen = 0x1; + break; + case 24: ++ case 32: + blen = 0x2; + break; + default: +@@ -515,7 +516,7 @@ static const struct snd_soc_dai_ops wm8804_dai_ops = { + }; + + #define WM8804_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE | \ +- SNDRV_PCM_FMTBIT_S24_LE) ++ SNDRV_PCM_FMTBIT_S24_3LE | SNDRV_PCM_FMTBIT_S32_LE) + + #define WM8804_RATES (SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 | \ + SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_64000 | \ +@@ -543,7 +544,7 @@ static struct snd_soc_dai_driver wm8804_dai = { + }; + + static const struct snd_soc_codec_driver soc_codec_dev_wm8804 = { +- .idle_bias_off = true, ++ .idle_bias_off = false, + + .dapm_widgets = wm8804_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(wm8804_dapm_widgets), + +From e4119855ee7612fe8032d43fb0cd14e87109d613 Mon Sep 17 00:00:00 2001 +From: Daniel Matuschek <info@crazy-audio.com> +Date: Wed, 15 Jan 2014 21:42:08 +0100 +Subject: [PATCH 069/112] ASoC: BCM:Add support for HiFiBerry Digi. Driver is + based on the patched WM8804 driver. + +Signed-off-by: Daniel Matuschek <daniel@matuschek.net> + +Add a parameter to turn off SPDIF output if no audio is playing + +This patch adds the paramater auto_shutdown_output to the kernel module. +Default behaviour of the module is the same, but when auto_shutdown_output +is set to 1, the SPDIF oputput will shutdown if no stream is playing. + +bugfix for 32kHz sample rate, was missing + +HiFiBerry Digi: set SPDIF status bits for sample rate + +The HiFiBerry Digi driver did not signal the sample rate in the SPDIF status bits. +While this is optional, some DACs and receivers do not accept this signal. This patch +adds the sample rate bits in the SPDIF status block. +--- + sound/soc/bcm/Kconfig | 7 ++ + sound/soc/bcm/Makefile | 2 + + sound/soc/bcm/hifiberry_digi.c | 224 +++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 233 insertions(+) + create mode 100644 sound/soc/bcm/hifiberry_digi.c + +diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig +index 900de22..a34aff2 100644 +--- a/sound/soc/bcm/Kconfig ++++ b/sound/soc/bcm/Kconfig +@@ -15,6 +15,13 @@ config SND_BCM2708_SOC_HIFIBERRY_DAC + help + Say Y or M if you want to add support for HifiBerry DAC. + ++config SND_BCM2708_SOC_HIFIBERRY_DIGI ++ tristate "Support for HifiBerry Digi" ++ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S ++ select SND_SOC_WM8804 ++ help ++ Say Y or M if you want to add support for HifiBerry Digi S/PDIF output board. ++ + config SND_BCM2708_SOC_RPI_DAC + tristate "Support for RPi-DAC" + depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S +diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile +index 99c96b4..4d53c58 100644 +--- a/sound/soc/bcm/Makefile ++++ b/sound/soc/bcm/Makefile +@@ -5,7 +5,9 @@ obj-$(CONFIG_SND_BCM2835_SOC_I2S) += snd-soc-bcm2835-i2s.o + + # BCM2708 Machine Support + snd-soc-hifiberry-dac-objs := hifiberry_dac.o ++snd-soc-hifiberry-digi-objs := hifiberry_digi.o + snd-soc-rpi-dac-objs := rpi-dac.o + + obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o ++obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI) += snd-soc-hifiberry-digi.o + obj-$(CONFIG_SND_BCM2708_SOC_RPI_DAC) += snd-soc-rpi-dac.o +diff --git a/sound/soc/bcm/hifiberry_digi.c b/sound/soc/bcm/hifiberry_digi.c +new file mode 100644 +index 0000000..9840e15 +--- /dev/null ++++ b/sound/soc/bcm/hifiberry_digi.c +@@ -0,0 +1,224 @@ ++/* ++ * ASoC Driver for HifiBerry Digi ++ * ++ * Author: Daniel Matuschek <info@crazy-audio.com> ++ * based on the HifiBerry DAC driver by Florian Meier <florian.meier@koalo.de> ++ * Copyright 2013 ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * version 2 as published by the Free Software Foundation. ++ * ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * General Public License for more details. ++ */ ++ ++#include <linux/module.h> ++#include <linux/platform_device.h> ++ ++#include <sound/core.h> ++#include <sound/pcm.h> ++#include <sound/pcm_params.h> ++#include <sound/soc.h> ++#include <sound/jack.h> ++ ++#include "../codecs/wm8804.h" ++ ++static short int auto_shutdown_output = 0; ++module_param(auto_shutdown_output, short, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP); ++MODULE_PARM_DESC(auto_shutdown_output, "Shutdown SP/DIF output if playback is stopped"); ++ ++ ++static int samplerate=44100; ++ ++static int snd_rpi_hifiberry_digi_init(struct snd_soc_pcm_runtime *rtd) ++{ ++ struct snd_soc_codec *codec = rtd->codec; ++ ++ /* enable TX output */ ++ snd_soc_update_bits(codec, WM8804_PWRDN, 0x4, 0x0); ++ ++ return 0; ++} ++ ++static int snd_rpi_hifiberry_digi_startup(struct snd_pcm_substream *substream) { ++ /* turn on digital output */ ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_codec *codec = rtd->codec; ++ snd_soc_update_bits(codec, WM8804_PWRDN, 0x3c, 0x00); ++ return 0; ++} ++ ++static void snd_rpi_hifiberry_digi_shutdown(struct snd_pcm_substream *substream) { ++ /* turn off output */ ++ if (auto_shutdown_output) { ++ /* turn off output */ ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_codec *codec = rtd->codec; ++ snd_soc_update_bits(codec, WM8804_PWRDN, 0x3c, 0x3c); ++ } ++} ++ ++ ++static int snd_rpi_hifiberry_digi_hw_params(struct snd_pcm_substream *substream, ++ struct snd_pcm_hw_params *params) ++{ ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_dai *codec_dai = rtd->codec_dai; ++ struct snd_soc_codec *codec = rtd->codec; ++ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; ++ ++ int sysclk = 27000000; /* This is fixed on this board */ ++ ++ long mclk_freq=0; ++ int mclk_div=1; ++ int sampling_freq=1; ++ ++ int ret; ++ ++ samplerate = params_rate(params); ++ ++ if (samplerate<=96000) { ++ mclk_freq=samplerate*256; ++ mclk_div=WM8804_MCLKDIV_256FS; ++ } else { ++ mclk_freq=samplerate*128; ++ mclk_div=WM8804_MCLKDIV_128FS; ++ } ++ ++ switch (samplerate) { ++ case 32000: ++ sampling_freq=0x03; ++ break; ++ case 44100: ++ sampling_freq=0x00; ++ break; ++ case 48000: ++ sampling_freq=0x02; ++ break; ++ case 88200: ++ sampling_freq=0x08; ++ break; ++ case 96000: ++ sampling_freq=0x0a; ++ break; ++ case 176400: ++ sampling_freq=0x0c; ++ break; ++ case 192000: ++ sampling_freq=0x0e; ++ break; ++ default: ++ dev_err(codec->dev, ++ "Failed to set WM8804 SYSCLK, unsupported samplerate %d\n", ++ samplerate); ++ } ++ ++ snd_soc_dai_set_clkdiv(codec_dai, WM8804_MCLK_DIV, mclk_div); ++ snd_soc_dai_set_pll(codec_dai, 0, 0, sysclk, mclk_freq); ++ ++ ret = snd_soc_dai_set_sysclk(codec_dai, WM8804_TX_CLKSRC_PLL, ++ sysclk, SND_SOC_CLOCK_OUT); ++ if (ret < 0) { ++ dev_err(codec->dev, ++ "Failed to set WM8804 SYSCLK: %d\n", ret); ++ return ret; ++ } ++ ++ /* Enable TX output */ ++ snd_soc_update_bits(codec, WM8804_PWRDN, 0x4, 0x0); ++ ++ /* Power on */ ++ snd_soc_update_bits(codec, WM8804_PWRDN, 0x9, 0); ++ ++ /* set sampling frequency status bits */ ++ snd_soc_update_bits(codec, WM8804_SPDTX4, 0x0f, sampling_freq); ++ ++ return snd_soc_dai_set_bclk_ratio(cpu_dai,64); ++} ++ ++/* machine stream operations */ ++static struct snd_soc_ops snd_rpi_hifiberry_digi_ops = { ++ .hw_params = snd_rpi_hifiberry_digi_hw_params, ++ .startup = snd_rpi_hifiberry_digi_startup, ++ .shutdown = snd_rpi_hifiberry_digi_shutdown, ++}; ++ ++static struct snd_soc_dai_link snd_rpi_hifiberry_digi_dai[] = { ++{ ++ .name = "HifiBerry Digi", ++ .stream_name = "HifiBerry Digi HiFi", ++ .cpu_dai_name = "bcm2708-i2s.0", ++ .codec_dai_name = "wm8804-spdif", ++ .platform_name = "bcm2708-i2s.0", ++ .codec_name = "wm8804.1-003b", ++ .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | ++ SND_SOC_DAIFMT_CBM_CFM, ++ .ops = &snd_rpi_hifiberry_digi_ops, ++ .init = snd_rpi_hifiberry_digi_init, ++}, ++}; ++ ++/* audio machine driver */ ++static struct snd_soc_card snd_rpi_hifiberry_digi = { ++ .name = "snd_rpi_hifiberry_digi", ++ .owner = THIS_MODULE, ++ .dai_link = snd_rpi_hifiberry_digi_dai, ++ .num_links = ARRAY_SIZE(snd_rpi_hifiberry_digi_dai), ++}; ++ ++static int snd_rpi_hifiberry_digi_probe(struct platform_device *pdev) ++{ ++ int ret = 0; ++ ++ snd_rpi_hifiberry_digi.dev = &pdev->dev; ++ ++ if (pdev->dev.of_node) { ++ struct device_node *i2s_node; ++ struct snd_soc_dai_link *dai = &snd_rpi_hifiberry_digi_dai[0]; ++ i2s_node = of_parse_phandle(pdev->dev.of_node, ++ "i2s-controller", 0); ++ ++ if (i2s_node) { ++ dai->cpu_dai_name = NULL; ++ dai->cpu_of_node = i2s_node; ++ dai->platform_name = NULL; ++ dai->platform_of_node = i2s_node; ++ } ++ } ++ ++ ret = snd_soc_register_card(&snd_rpi_hifiberry_digi); ++ if (ret) ++ dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", ret); ++ ++ return ret; ++} ++ ++static int snd_rpi_hifiberry_digi_remove(struct platform_device *pdev) ++{ ++ return snd_soc_unregister_card(&snd_rpi_hifiberry_digi); ++} ++ ++static const struct of_device_id snd_rpi_hifiberry_digi_of_match[] = { ++ { .compatible = "hifiberry,hifiberry-digi", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, snd_rpi_hifiberry_digi_of_match); ++ ++static struct platform_driver snd_rpi_hifiberry_digi_driver = { ++ .driver = { ++ .name = "snd-hifiberry-digi", ++ .owner = THIS_MODULE, ++ .of_match_table = snd_rpi_hifiberry_digi_of_match, ++ }, ++ .probe = snd_rpi_hifiberry_digi_probe, ++ .remove = snd_rpi_hifiberry_digi_remove, ++}; ++ ++module_platform_driver(snd_rpi_hifiberry_digi_driver); ++ ++MODULE_AUTHOR("Daniel Matuschek <info@crazy-audio.com>"); ++MODULE_DESCRIPTION("ASoC Driver for HifiBerry Digi"); ++MODULE_LICENSE("GPL v2"); + +From ea72e0251bc9d43b981cf3f5caa807c41475e327 Mon Sep 17 00:00:00 2001 +From: Gordon Garrity <gordon@iqaudio.com> +Date: Sat, 8 Mar 2014 16:56:57 +0000 +Subject: [PATCH 070/112] Add IQaudIO Sound Card support for Raspberry Pi + +Set a limit of 0dB on Digital Volume Control + +The main volume control in the PCM512x DAC has a range up to ++24dB. This is dangerously loud and can potentially cause massive +clipping in the output stages. Therefore this sets a sensible +limit of 0dB for this control. + +Allow up to 24dB digital gain to be applied when using IQAudIO DAC+ + +24db_digital_gain DT param can be used to specify that PCM512x +codec "Digital" volume control should not be limited to 0dB gain, +and if specified will allow the full 24dB gain. + +Modify IQAudIO DAC+ ASoC driver to set card/dai config from dt + +Add the ability to set the card name, dai name and dai stream name, from +dt config. + +Signed-off-by: DigitalDreamtime <clive.messer@digitaldreamtime.co.uk> +--- + sound/soc/bcm/Kconfig | 7 +++ + sound/soc/bcm/Makefile | 2 + + sound/soc/bcm/iqaudio-dac.c | 148 ++++++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 157 insertions(+) + create mode 100644 sound/soc/bcm/iqaudio-dac.c + +diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig +index a34aff2..38dcdd9 100644 +--- a/sound/soc/bcm/Kconfig ++++ b/sound/soc/bcm/Kconfig +@@ -28,3 +28,10 @@ config SND_BCM2708_SOC_RPI_DAC + select SND_SOC_PCM1794A + help + Say Y or M if you want to add support for RPi-DAC. ++ ++config SND_BCM2708_SOC_IQAUDIO_DAC ++ tristate "Support for IQaudIO-DAC" ++ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S ++ select SND_SOC_PCM512x_I2C ++ help ++ Say Y or M if you want to add support for IQaudIO-DAC. +diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile +index 4d53c58..08e4dc5 100644 +--- a/sound/soc/bcm/Makefile ++++ b/sound/soc/bcm/Makefile +@@ -7,7 +7,9 @@ obj-$(CONFIG_SND_BCM2835_SOC_I2S) += snd-soc-bcm2835-i2s.o + snd-soc-hifiberry-dac-objs := hifiberry_dac.o + snd-soc-hifiberry-digi-objs := hifiberry_digi.o + snd-soc-rpi-dac-objs := rpi-dac.o ++snd-soc-iqaudio-dac-objs := iqaudio-dac.o + + obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o + obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI) += snd-soc-hifiberry-digi.o + obj-$(CONFIG_SND_BCM2708_SOC_RPI_DAC) += snd-soc-rpi-dac.o ++obj-$(CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC) += snd-soc-iqaudio-dac.o +diff --git a/sound/soc/bcm/iqaudio-dac.c b/sound/soc/bcm/iqaudio-dac.c +new file mode 100644 +index 0000000..b6b6dcf +--- /dev/null ++++ b/sound/soc/bcm/iqaudio-dac.c +@@ -0,0 +1,148 @@ ++/* ++ * ASoC Driver for IQaudIO DAC ++ * ++ * Author: Florian Meier <florian.meier@koalo.de> ++ * Copyright 2013 ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * version 2 as published by the Free Software Foundation. ++ * ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * General Public License for more details. ++ */ ++ ++#include <linux/module.h> ++#include <linux/platform_device.h> ++ ++#include <sound/core.h> ++#include <sound/pcm.h> ++#include <sound/pcm_params.h> ++#include <sound/soc.h> ++#include <sound/jack.h> ++ ++static bool digital_gain_0db_limit = true; ++ ++static int snd_rpi_iqaudio_dac_init(struct snd_soc_pcm_runtime *rtd) ++{ ++ if (digital_gain_0db_limit) ++ { ++ int ret; ++ struct snd_soc_card *card = rtd->card; ++ ++ ret = snd_soc_limit_volume(card, "Digital Playback Volume", 207); ++ if (ret < 0) ++ dev_warn(card->dev, "Failed to set volume limit: %d\n", ret); ++ } ++ ++ return 0; ++} ++ ++static int snd_rpi_iqaudio_dac_hw_params(struct snd_pcm_substream *substream, ++ struct snd_pcm_hw_params *params) ++{ ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++// NOT USED struct snd_soc_dai *codec_dai = rtd->codec_dai; ++// NOT USED struct snd_soc_codec *codec = rtd->codec; ++ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; ++ ++ unsigned int sample_bits = ++ snd_pcm_format_physical_width(params_format(params)); ++ ++ return snd_soc_dai_set_bclk_ratio(cpu_dai, sample_bits * 2); ++} ++ ++/* machine stream operations */ ++static struct snd_soc_ops snd_rpi_iqaudio_dac_ops = { ++ .hw_params = snd_rpi_iqaudio_dac_hw_params, ++}; ++ ++static struct snd_soc_dai_link snd_rpi_iqaudio_dac_dai[] = { ++{ ++ .cpu_dai_name = "bcm2708-i2s.0", ++ .codec_dai_name = "pcm512x-hifi", ++ .platform_name = "bcm2708-i2s.0", ++ .codec_name = "pcm512x.1-004c", ++ .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | ++ SND_SOC_DAIFMT_CBS_CFS, ++ .ops = &snd_rpi_iqaudio_dac_ops, ++ .init = snd_rpi_iqaudio_dac_init, ++}, ++}; ++ ++/* audio machine driver */ ++static struct snd_soc_card snd_rpi_iqaudio_dac = { ++ .owner = THIS_MODULE, ++ .dai_link = snd_rpi_iqaudio_dac_dai, ++ .num_links = ARRAY_SIZE(snd_rpi_iqaudio_dac_dai), ++}; ++ ++static int snd_rpi_iqaudio_dac_probe(struct platform_device *pdev) ++{ ++ int ret = 0; ++ ++ snd_rpi_iqaudio_dac.dev = &pdev->dev; ++ ++ if (pdev->dev.of_node) { ++ struct device_node *i2s_node; ++ struct snd_soc_card *card = &snd_rpi_iqaudio_dac; ++ struct snd_soc_dai_link *dai = &snd_rpi_iqaudio_dac_dai[0]; ++ i2s_node = of_parse_phandle(pdev->dev.of_node, ++ "i2s-controller", 0); ++ ++ if (i2s_node) { ++ dai->cpu_dai_name = NULL; ++ dai->cpu_of_node = i2s_node; ++ dai->platform_name = NULL; ++ dai->platform_of_node = i2s_node; ++ } ++ ++ digital_gain_0db_limit = !of_property_read_bool(pdev->dev.of_node, ++ "iqaudio,24db_digital_gain"); ++ if (of_property_read_string(pdev->dev.of_node, "card_name", ++ &card->name)) ++ card->name = "IQaudIODAC"; ++ if (of_property_read_string(pdev->dev.of_node, "dai_name", ++ &dai->name)) ++ dai->name = "IQaudIO DAC"; ++ if (of_property_read_string(pdev->dev.of_node, "dai_stream_name", ++ &dai->stream_name)) ++ dai->stream_name = "IQaudIO DAC HiFi"; ++ } ++ ++ ret = snd_soc_register_card(&snd_rpi_iqaudio_dac); ++ if (ret) ++ dev_err(&pdev->dev, ++ "snd_soc_register_card() failed: %d\n", ret); ++ ++ return ret; ++} ++ ++static int snd_rpi_iqaudio_dac_remove(struct platform_device *pdev) ++{ ++ return snd_soc_unregister_card(&snd_rpi_iqaudio_dac); ++} ++ ++static const struct of_device_id iqaudio_of_match[] = { ++ { .compatible = "iqaudio,iqaudio-dac", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, iqaudio_of_match); ++ ++static struct platform_driver snd_rpi_iqaudio_dac_driver = { ++ .driver = { ++ .name = "snd-rpi-iqaudio-dac", ++ .owner = THIS_MODULE, ++ .of_match_table = iqaudio_of_match, ++ }, ++ .probe = snd_rpi_iqaudio_dac_probe, ++ .remove = snd_rpi_iqaudio_dac_remove, ++}; ++ ++module_platform_driver(snd_rpi_iqaudio_dac_driver); ++ ++MODULE_AUTHOR("Florian Meier <florian.meier@koalo.de>"); ++MODULE_DESCRIPTION("ASoC Driver for IQAudio DAC"); ++MODULE_LICENSE("GPL v2"); + +From 51d3e7110c3e009d1f568a280f7645d0b44592d7 Mon Sep 17 00:00:00 2001 +From: popcornmix <popcornmix@gmail.com> +Date: Mon, 14 Jul 2014 22:02:09 +0100 +Subject: [PATCH 071/112] hid: Reduce default mouse polling interval to 60Hz + +Reduces overhead when using X +--- + drivers/hid/usbhid/hid-core.c | 10 +++++++--- + 1 file changed, 7 insertions(+), 3 deletions(-) + +diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c +index ae83af6..4a7af9d 100644 +--- a/drivers/hid/usbhid/hid-core.c ++++ b/drivers/hid/usbhid/hid-core.c +@@ -49,7 +49,7 @@ + * Module parameters. + */ + +-static unsigned int hid_mousepoll_interval; ++static unsigned int hid_mousepoll_interval = ~0; + module_param_named(mousepoll, hid_mousepoll_interval, uint, 0644); + MODULE_PARM_DESC(mousepoll, "Polling interval of mice"); + +@@ -1083,8 +1083,12 @@ static int usbhid_start(struct hid_device *hid) + } + + /* Change the polling interval of mice. */ +- if (hid->collection->usage == HID_GD_MOUSE && hid_mousepoll_interval > 0) +- interval = hid_mousepoll_interval; ++ if (hid->collection->usage == HID_GD_MOUSE) { ++ if (hid_mousepoll_interval == ~0 && interval < 16) ++ interval = 16; ++ else if (hid_mousepoll_interval != ~0 && hid_mousepoll_interval != 0) ++ interval = hid_mousepoll_interval; ++ } + + ret = -ENOMEM; + if (usb_endpoint_dir_in(endpoint)) { + +From 6b4093df74895715c00c4a7f3d364ef2bc02421d Mon Sep 17 00:00:00 2001 +From: Daniel Matuschek <info@crazy-audio.com> +Date: Mon, 4 Aug 2014 10:06:56 +0200 +Subject: [PATCH 072/112] Added support for HiFiBerry DAC+ + +The driver is based on the HiFiBerry DAC driver. However HiFiBerry DAC+ uses +a different codec chip (PCM5122), therefore a new driver is necessary. + +Add support for the HiFiBerry DAC+ Pro. + +The HiFiBerry DAC+ and DAC+ Pro products both use the existing bcm sound driver with the DAC+ Pro having a special clock device driver representing the two high precision oscillators. + +An addition bug fix is included for the PCM512x codec where by the physical size of the sample frame is used in the calculation of the LRCK divisor as it was found to be wrong when using 24-bit depth sample contained in a little endian 4-byte sample frame. + +Limit PCM512x "Digital" gain to 0dB by default with HiFiBerry DAC+ + +24db_digital_gain DT param can be used to specify that PCM512x +codec "Digital" volume control should not be limited to 0dB gain, +and if specified will allow the full 24dB gain. + +Add dt param to force HiFiBerry DAC+ Pro into slave mode + +"dtoverlay=hifiberry-dacplus,slave" + +Add 'slave' param to use HiFiBerry DAC+ Pro in slave mode, +with Pi as master for bit and frame clock. + +Signed-off-by: DigitalDreamtime <clive.messer@digitaldreamtime.co.uk> +--- + drivers/clk/Makefile | 1 + + drivers/clk/clk-hifiberry-dacpro.c | 160 +++++++++++++++++ + sound/soc/bcm/Kconfig | 7 + + sound/soc/bcm/Makefile | 2 + + sound/soc/bcm/hifiberry_dacplus.c | 358 +++++++++++++++++++++++++++++++++++++ + sound/soc/codecs/pcm512x.c | 3 +- + 6 files changed, 530 insertions(+), 1 deletion(-) + create mode 100644 drivers/clk/clk-hifiberry-dacpro.c + create mode 100644 sound/soc/bcm/hifiberry_dacplus.c + +diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile +index 46869d6..a202e6f 100644 +--- a/drivers/clk/Makefile ++++ b/drivers/clk/Makefile +@@ -25,6 +25,7 @@ obj-$(CONFIG_COMMON_CLK_CS2000_CP) += clk-cs2000-cp.o + obj-$(CONFIG_ARCH_CLPS711X) += clk-clps711x.o + obj-$(CONFIG_ARCH_EFM32) += clk-efm32gg.o + obj-$(CONFIG_ARCH_HIGHBANK) += clk-highbank.o ++obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS) += clk-hifiberry-dacpro.o + obj-$(CONFIG_MACH_LOONGSON32) += clk-ls1x.o + obj-$(CONFIG_COMMON_CLK_MAX_GEN) += clk-max-gen.o + obj-$(CONFIG_COMMON_CLK_MAX77686) += clk-max77686.o +diff --git a/drivers/clk/clk-hifiberry-dacpro.c b/drivers/clk/clk-hifiberry-dacpro.c +new file mode 100644 +index 0000000..3e35d45 +--- /dev/null ++++ b/drivers/clk/clk-hifiberry-dacpro.c +@@ -0,0 +1,160 @@ ++/* ++ * Clock Driver for HiFiBerry DAC Pro ++ * ++ * Author: Stuart MacLean ++ * Copyright 2015 ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * version 2 as published by the Free Software Foundation. ++ * ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * General Public License for more details. ++ */ ++ ++#include <linux/clk-provider.h> ++#include <linux/clkdev.h> ++#include <linux/kernel.h> ++#include <linux/module.h> ++#include <linux/of.h> ++#include <linux/slab.h> ++#include <linux/platform_device.h> ++ ++/* Clock rate of CLK44EN attached to GPIO6 pin */ ++#define CLK_44EN_RATE 22579200UL ++/* Clock rate of CLK48EN attached to GPIO3 pin */ ++#define CLK_48EN_RATE 24576000UL ++ ++/** ++ * struct hifiberry_dacpro_clk - Common struct to the HiFiBerry DAC Pro ++ * @hw: clk_hw for the common clk framework ++ * @mode: 0 => CLK44EN, 1 => CLK48EN ++ */ ++struct clk_hifiberry_hw { ++ struct clk_hw hw; ++ uint8_t mode; ++}; ++ ++#define to_hifiberry_clk(_hw) container_of(_hw, struct clk_hifiberry_hw, hw) ++ ++static const struct of_device_id clk_hifiberry_dacpro_dt_ids[] = { ++ { .compatible = "hifiberry,dacpro-clk",}, ++ { } ++}; ++MODULE_DEVICE_TABLE(of, clk_hifiberry_dacpro_dt_ids); ++ ++static unsigned long clk_hifiberry_dacpro_recalc_rate(struct clk_hw *hw, ++ unsigned long parent_rate) ++{ ++ return (to_hifiberry_clk(hw)->mode == 0) ? CLK_44EN_RATE : ++ CLK_48EN_RATE; ++} ++ ++static long clk_hifiberry_dacpro_round_rate(struct clk_hw *hw, ++ unsigned long rate, unsigned long *parent_rate) ++{ ++ long actual_rate; ++ ++ if (rate <= CLK_44EN_RATE) { ++ actual_rate = (long)CLK_44EN_RATE; ++ } else if (rate >= CLK_48EN_RATE) { ++ actual_rate = (long)CLK_48EN_RATE; ++ } else { ++ long diff44Rate = (long)(rate - CLK_44EN_RATE); ++ long diff48Rate = (long)(CLK_48EN_RATE - rate); ++ ++ if (diff44Rate < diff48Rate) ++ actual_rate = (long)CLK_44EN_RATE; ++ else ++ actual_rate = (long)CLK_48EN_RATE; ++ } ++ return actual_rate; ++} ++ ++ ++static int clk_hifiberry_dacpro_set_rate(struct clk_hw *hw, ++ unsigned long rate, unsigned long parent_rate) ++{ ++ unsigned long actual_rate; ++ struct clk_hifiberry_hw *clk = to_hifiberry_clk(hw); ++ ++ actual_rate = (unsigned long)clk_hifiberry_dacpro_round_rate(hw, rate, ++ &parent_rate); ++ clk->mode = (actual_rate == CLK_44EN_RATE) ? 0 : 1; ++ return 0; ++} ++ ++ ++const struct clk_ops clk_hifiberry_dacpro_rate_ops = { ++ .recalc_rate = clk_hifiberry_dacpro_recalc_rate, ++ .round_rate = clk_hifiberry_dacpro_round_rate, ++ .set_rate = clk_hifiberry_dacpro_set_rate, ++}; ++ ++static int clk_hifiberry_dacpro_probe(struct platform_device *pdev) ++{ ++ int ret; ++ struct clk_hifiberry_hw *proclk; ++ struct clk *clk; ++ struct device *dev; ++ struct clk_init_data init; ++ ++ dev = &pdev->dev; ++ ++ proclk = kzalloc(sizeof(struct clk_hifiberry_hw), GFP_KERNEL); ++ if (!proclk) ++ return -ENOMEM; ++ ++ init.name = "clk-hifiberry-dacpro"; ++ init.ops = &clk_hifiberry_dacpro_rate_ops; ++ init.flags = CLK_IS_ROOT | CLK_IS_BASIC; ++ init.parent_names = NULL; ++ init.num_parents = 0; ++ ++ proclk->mode = 0; ++ proclk->hw.init = &init; ++ ++ clk = devm_clk_register(dev, &proclk->hw); ++ if (!IS_ERR(clk)) { ++ ret = of_clk_add_provider(dev->of_node, of_clk_src_simple_get, ++ clk); ++ } else { ++ dev_err(dev, "Fail to register clock driver\n"); ++ kfree(proclk); ++ ret = PTR_ERR(clk); ++ } ++ return ret; ++} ++ ++static int clk_hifiberry_dacpro_remove(struct platform_device *pdev) ++{ ++ of_clk_del_provider(pdev->dev.of_node); ++ return 0; ++} ++ ++static struct platform_driver clk_hifiberry_dacpro_driver = { ++ .probe = clk_hifiberry_dacpro_probe, ++ .remove = clk_hifiberry_dacpro_remove, ++ .driver = { ++ .name = "clk-hifiberry-dacpro", ++ .of_match_table = clk_hifiberry_dacpro_dt_ids, ++ }, ++}; ++ ++static int __init clk_hifiberry_dacpro_init(void) ++{ ++ return platform_driver_register(&clk_hifiberry_dacpro_driver); ++} ++core_initcall(clk_hifiberry_dacpro_init); ++ ++static void __exit clk_hifiberry_dacpro_exit(void) ++{ ++ platform_driver_unregister(&clk_hifiberry_dacpro_driver); ++} ++module_exit(clk_hifiberry_dacpro_exit); ++ ++MODULE_DESCRIPTION("HiFiBerry DAC Pro clock driver"); ++MODULE_LICENSE("GPL v2"); ++MODULE_ALIAS("platform:clk-hifiberry-dacpro"); +diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig +index 38dcdd9..8c338b5 100644 +--- a/sound/soc/bcm/Kconfig ++++ b/sound/soc/bcm/Kconfig +@@ -15,6 +15,13 @@ config SND_BCM2708_SOC_HIFIBERRY_DAC + help + Say Y or M if you want to add support for HifiBerry DAC. + ++config SND_BCM2708_SOC_HIFIBERRY_DACPLUS ++ tristate "Support for HifiBerry DAC+" ++ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S ++ select SND_SOC_PCM512x ++ help ++ Say Y or M if you want to add support for HifiBerry DAC+. ++ + config SND_BCM2708_SOC_HIFIBERRY_DIGI + tristate "Support for HifiBerry Digi" + depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S +diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile +index 08e4dc5..a29538e 100644 +--- a/sound/soc/bcm/Makefile ++++ b/sound/soc/bcm/Makefile +@@ -5,11 +5,13 @@ obj-$(CONFIG_SND_BCM2835_SOC_I2S) += snd-soc-bcm2835-i2s.o + + # BCM2708 Machine Support + snd-soc-hifiberry-dac-objs := hifiberry_dac.o ++snd-soc-hifiberry-dacplus-objs := hifiberry_dacplus.o + snd-soc-hifiberry-digi-objs := hifiberry_digi.o + snd-soc-rpi-dac-objs := rpi-dac.o + snd-soc-iqaudio-dac-objs := iqaudio-dac.o + + obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o ++obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS) += snd-soc-hifiberry-dacplus.o + obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI) += snd-soc-hifiberry-digi.o + obj-$(CONFIG_SND_BCM2708_SOC_RPI_DAC) += snd-soc-rpi-dac.o + obj-$(CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC) += snd-soc-iqaudio-dac.o +diff --git a/sound/soc/bcm/hifiberry_dacplus.c b/sound/soc/bcm/hifiberry_dacplus.c +new file mode 100644 +index 0000000..6560067 +--- /dev/null ++++ b/sound/soc/bcm/hifiberry_dacplus.c +@@ -0,0 +1,358 @@ ++/* ++ * ASoC Driver for HiFiBerry DAC+ / DAC Pro ++ * ++ * Author: Daniel Matuschek, Stuart MacLean <stuart@hifiberry.com> ++ * Copyright 2014-2015 ++ * based on code by Florian Meier <florian.meier@koalo.de> ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * version 2 as published by the Free Software Foundation. ++ * ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * General Public License for more details. ++ */ ++ ++#include <linux/module.h> ++#include <linux/platform_device.h> ++#include <linux/kernel.h> ++#include <linux/clk.h> ++#include <linux/kernel.h> ++#include <linux/module.h> ++#include <linux/of.h> ++#include <linux/slab.h> ++#include <linux/delay.h> ++ ++#include <sound/core.h> ++#include <sound/pcm.h> ++#include <sound/pcm_params.h> ++#include <sound/soc.h> ++#include <sound/jack.h> ++ ++#include "../codecs/pcm512x.h" ++ ++#define HIFIBERRY_DACPRO_NOCLOCK 0 ++#define HIFIBERRY_DACPRO_CLK44EN 1 ++#define HIFIBERRY_DACPRO_CLK48EN 2 ++ ++struct pcm512x_priv { ++ struct regmap *regmap; ++ struct clk *sclk; ++}; ++ ++/* Clock rate of CLK44EN attached to GPIO6 pin */ ++#define CLK_44EN_RATE 22579200UL ++/* Clock rate of CLK48EN attached to GPIO3 pin */ ++#define CLK_48EN_RATE 24576000UL ++ ++static bool slave; ++static bool snd_rpi_hifiberry_is_dacpro; ++static bool digital_gain_0db_limit = true; ++ ++static void snd_rpi_hifiberry_dacplus_select_clk(struct snd_soc_codec *codec, ++ int clk_id) ++{ ++ switch (clk_id) { ++ case HIFIBERRY_DACPRO_NOCLOCK: ++ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x24, 0x00); ++ break; ++ case HIFIBERRY_DACPRO_CLK44EN: ++ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x24, 0x20); ++ break; ++ case HIFIBERRY_DACPRO_CLK48EN: ++ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x24, 0x04); ++ break; ++ } ++} ++ ++static void snd_rpi_hifiberry_dacplus_clk_gpio(struct snd_soc_codec *codec) ++{ ++ snd_soc_update_bits(codec, PCM512x_GPIO_EN, 0x24, 0x24); ++ snd_soc_update_bits(codec, PCM512x_GPIO_OUTPUT_3, 0x0f, 0x02); ++ snd_soc_update_bits(codec, PCM512x_GPIO_OUTPUT_6, 0x0f, 0x02); ++} ++ ++static bool snd_rpi_hifiberry_dacplus_is_sclk(struct snd_soc_codec *codec) ++{ ++ int sck; ++ ++ sck = snd_soc_read(codec, PCM512x_RATE_DET_4); ++ return (!(sck & 0x40)); ++} ++ ++static bool snd_rpi_hifiberry_dacplus_is_sclk_sleep( ++ struct snd_soc_codec *codec) ++{ ++ msleep(2); ++ return snd_rpi_hifiberry_dacplus_is_sclk(codec); ++} ++ ++static bool snd_rpi_hifiberry_dacplus_is_pro_card(struct snd_soc_codec *codec) ++{ ++ bool isClk44EN, isClk48En, isNoClk; ++ ++ snd_rpi_hifiberry_dacplus_clk_gpio(codec); ++ ++ snd_rpi_hifiberry_dacplus_select_clk(codec, HIFIBERRY_DACPRO_CLK44EN); ++ isClk44EN = snd_rpi_hifiberry_dacplus_is_sclk_sleep(codec); ++ ++ snd_rpi_hifiberry_dacplus_select_clk(codec, HIFIBERRY_DACPRO_NOCLOCK); ++ isNoClk = snd_rpi_hifiberry_dacplus_is_sclk_sleep(codec); ++ ++ snd_rpi_hifiberry_dacplus_select_clk(codec, HIFIBERRY_DACPRO_CLK48EN); ++ isClk48En = snd_rpi_hifiberry_dacplus_is_sclk_sleep(codec); ++ ++ return (isClk44EN && isClk48En && !isNoClk); ++} ++ ++static int snd_rpi_hifiberry_dacplus_clk_for_rate(int sample_rate) ++{ ++ int type; ++ ++ switch (sample_rate) { ++ case 11025: ++ case 22050: ++ case 44100: ++ case 88200: ++ case 176400: ++ type = HIFIBERRY_DACPRO_CLK44EN; ++ break; ++ default: ++ type = HIFIBERRY_DACPRO_CLK48EN; ++ break; ++ } ++ return type; ++} ++ ++static void snd_rpi_hifiberry_dacplus_set_sclk(struct snd_soc_codec *codec, ++ int sample_rate) ++{ ++ struct pcm512x_priv *pcm512x = snd_soc_codec_get_drvdata(codec); ++ ++ if (!IS_ERR(pcm512x->sclk)) { ++ int ctype; ++ ++ ctype = snd_rpi_hifiberry_dacplus_clk_for_rate(sample_rate); ++ clk_set_rate(pcm512x->sclk, (ctype == HIFIBERRY_DACPRO_CLK44EN) ++ ? CLK_44EN_RATE : CLK_48EN_RATE); ++ snd_rpi_hifiberry_dacplus_select_clk(codec, ctype); ++ } ++} ++ ++static int snd_rpi_hifiberry_dacplus_init(struct snd_soc_pcm_runtime *rtd) ++{ ++ struct snd_soc_codec *codec = rtd->codec; ++ struct pcm512x_priv *priv; ++ ++ if (slave) ++ snd_rpi_hifiberry_is_dacpro = false; ++ else ++ snd_rpi_hifiberry_is_dacpro = ++ snd_rpi_hifiberry_dacplus_is_pro_card(codec); ++ ++ if (snd_rpi_hifiberry_is_dacpro) { ++ struct snd_soc_dai_link *dai = rtd->dai_link; ++ ++ dai->name = "HiFiBerry DAC+ Pro"; ++ dai->stream_name = "HiFiBerry DAC+ Pro HiFi"; ++ dai->dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF ++ | SND_SOC_DAIFMT_CBM_CFM; ++ ++ snd_soc_update_bits(codec, PCM512x_BCLK_LRCLK_CFG, 0x31, 0x11); ++ snd_soc_update_bits(codec, PCM512x_MASTER_MODE, 0x03, 0x03); ++ snd_soc_update_bits(codec, PCM512x_MASTER_CLKDIV_2, 0x7f, 63); ++ } else { ++ priv = snd_soc_codec_get_drvdata(codec); ++ priv->sclk = ERR_PTR(-ENOENT); ++ } ++ ++ snd_soc_update_bits(codec, PCM512x_GPIO_EN, 0x08, 0x08); ++ snd_soc_update_bits(codec, PCM512x_GPIO_OUTPUT_4, 0x0f, 0x02); ++ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x08, 0x08); ++ ++ if (digital_gain_0db_limit) ++ { ++ int ret; ++ struct snd_soc_card *card = rtd->card; ++ ++ ret = snd_soc_limit_volume(card, "Digital Playback Volume", 207); ++ if (ret < 0) ++ dev_warn(card->dev, "Failed to set volume limit: %d\n", ret); ++ } ++ ++ return 0; ++} ++ ++static int snd_rpi_hifiberry_dacplus_update_rate_den( ++ struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params) ++{ ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_codec *codec = rtd->codec; ++ struct pcm512x_priv *pcm512x = snd_soc_codec_get_drvdata(codec); ++ struct snd_ratnum *rats_no_pll; ++ unsigned int num = 0, den = 0; ++ int err; ++ ++ rats_no_pll = devm_kzalloc(rtd->dev, sizeof(*rats_no_pll), GFP_KERNEL); ++ if (!rats_no_pll) ++ return -ENOMEM; ++ ++ rats_no_pll->num = clk_get_rate(pcm512x->sclk) / 64; ++ rats_no_pll->den_min = 1; ++ rats_no_pll->den_max = 128; ++ rats_no_pll->den_step = 1; ++ ++ err = snd_interval_ratnum(hw_param_interval(params, ++ SNDRV_PCM_HW_PARAM_RATE), 1, rats_no_pll, &num, &den); ++ if (err >= 0 && den) { ++ params->rate_num = num; ++ params->rate_den = den; ++ } ++ ++ devm_kfree(rtd->dev, rats_no_pll); ++ return 0; ++} ++ ++static int snd_rpi_hifiberry_dacplus_set_bclk_ratio_pro( ++ struct snd_soc_dai *cpu_dai, struct snd_pcm_hw_params *params) ++{ ++ int bratio = snd_pcm_format_physical_width(params_format(params)) ++ * params_channels(params); ++ return snd_soc_dai_set_bclk_ratio(cpu_dai, bratio); ++} ++ ++static int snd_rpi_hifiberry_dacplus_hw_params( ++ struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params) ++{ ++ int ret; ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; ++ ++ if (snd_rpi_hifiberry_is_dacpro) { ++ struct snd_soc_codec *codec = rtd->codec; ++ ++ snd_rpi_hifiberry_dacplus_set_sclk(codec, ++ params_rate(params)); ++ ++ ret = snd_rpi_hifiberry_dacplus_set_bclk_ratio_pro(cpu_dai, ++ params); ++ if (!ret) ++ ret = snd_rpi_hifiberry_dacplus_update_rate_den( ++ substream, params); ++ } else { ++ ret = snd_soc_dai_set_bclk_ratio(cpu_dai, 64); ++ } ++ return ret; ++} ++ ++static int snd_rpi_hifiberry_dacplus_startup( ++ struct snd_pcm_substream *substream) ++{ ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_codec *codec = rtd->codec; ++ ++ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x08, 0x08); ++ return 0; ++} ++ ++static void snd_rpi_hifiberry_dacplus_shutdown( ++ struct snd_pcm_substream *substream) ++{ ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_codec *codec = rtd->codec; ++ ++ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x08, 0x00); ++} ++ ++/* machine stream operations */ ++static struct snd_soc_ops snd_rpi_hifiberry_dacplus_ops = { ++ .hw_params = snd_rpi_hifiberry_dacplus_hw_params, ++ .startup = snd_rpi_hifiberry_dacplus_startup, ++ .shutdown = snd_rpi_hifiberry_dacplus_shutdown, ++}; ++ ++static struct snd_soc_dai_link snd_rpi_hifiberry_dacplus_dai[] = { ++{ ++ .name = "HiFiBerry DAC+", ++ .stream_name = "HiFiBerry DAC+ HiFi", ++ .cpu_dai_name = "bcm2708-i2s.0", ++ .codec_dai_name = "pcm512x-hifi", ++ .platform_name = "bcm2708-i2s.0", ++ .codec_name = "pcm512x.1-004d", ++ .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | ++ SND_SOC_DAIFMT_CBS_CFS, ++ .ops = &snd_rpi_hifiberry_dacplus_ops, ++ .init = snd_rpi_hifiberry_dacplus_init, ++}, ++}; ++ ++/* audio machine driver */ ++static struct snd_soc_card snd_rpi_hifiberry_dacplus = { ++ .name = "snd_rpi_hifiberry_dacplus", ++ .owner = THIS_MODULE, ++ .dai_link = snd_rpi_hifiberry_dacplus_dai, ++ .num_links = ARRAY_SIZE(snd_rpi_hifiberry_dacplus_dai), ++}; ++ ++static int snd_rpi_hifiberry_dacplus_probe(struct platform_device *pdev) ++{ ++ int ret = 0; ++ ++ snd_rpi_hifiberry_dacplus.dev = &pdev->dev; ++ if (pdev->dev.of_node) { ++ struct device_node *i2s_node; ++ struct snd_soc_dai_link *dai; ++ ++ dai = &snd_rpi_hifiberry_dacplus_dai[0]; ++ i2s_node = of_parse_phandle(pdev->dev.of_node, ++ "i2s-controller", 0); ++ ++ if (i2s_node) { ++ dai->cpu_dai_name = NULL; ++ dai->cpu_of_node = i2s_node; ++ dai->platform_name = NULL; ++ dai->platform_of_node = i2s_node; ++ } ++ ++ digital_gain_0db_limit = !of_property_read_bool( ++ pdev->dev.of_node, "hifiberry,24db_digital_gain"); ++ slave = of_property_read_bool(pdev->dev.of_node, ++ "hifiberry-dacplus,slave"); ++ } ++ ++ ret = snd_soc_register_card(&snd_rpi_hifiberry_dacplus); ++ if (ret) ++ dev_err(&pdev->dev, ++ "snd_soc_register_card() failed: %d\n", ret); ++ ++ return ret; ++} ++ ++static int snd_rpi_hifiberry_dacplus_remove(struct platform_device *pdev) ++{ ++ return snd_soc_unregister_card(&snd_rpi_hifiberry_dacplus); ++} ++ ++static const struct of_device_id snd_rpi_hifiberry_dacplus_of_match[] = { ++ { .compatible = "hifiberry,hifiberry-dacplus", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, snd_rpi_hifiberry_dacplus_of_match); ++ ++static struct platform_driver snd_rpi_hifiberry_dacplus_driver = { ++ .driver = { ++ .name = "snd-rpi-hifiberry-dacplus", ++ .owner = THIS_MODULE, ++ .of_match_table = snd_rpi_hifiberry_dacplus_of_match, ++ }, ++ .probe = snd_rpi_hifiberry_dacplus_probe, ++ .remove = snd_rpi_hifiberry_dacplus_remove, ++}; ++ ++module_platform_driver(snd_rpi_hifiberry_dacplus_driver); ++ ++MODULE_AUTHOR("Daniel Matuschek <daniel@hifiberry.com>"); ++MODULE_DESCRIPTION("ASoC Driver for HiFiBerry DAC+"); ++MODULE_LICENSE("GPL v2"); +diff --git a/sound/soc/codecs/pcm512x.c b/sound/soc/codecs/pcm512x.c +index 047c489..090fe0e 100644 +--- a/sound/soc/codecs/pcm512x.c ++++ b/sound/soc/codecs/pcm512x.c +@@ -854,7 +854,8 @@ static int pcm512x_set_dividers(struct snd_soc_dai *dai, + int fssp; + int gpio; + +- lrclk_div = snd_soc_params_to_frame_size(params); ++ lrclk_div = snd_pcm_format_physical_width(params_format(params)) ++ * params_channels(params); + if (lrclk_div == 0) { + dev_err(dev, "No LRCLK?\n"); + return -EINVAL; + +From e98480a9bdf2baa680bdd5e92a9cc914c3dea397 Mon Sep 17 00:00:00 2001 +From: Daniel Matuschek <info@crazy-audio.com> +Date: Mon, 4 Aug 2014 11:09:58 +0200 +Subject: [PATCH 073/112] Added driver for HiFiBerry Amp amplifier add-on board + +The driver contains a low-level hardware driver for the TAS5713 and the +drivers for the Raspberry Pi I2S subsystem. + +TAS5713: return error if initialisation fails + +Existing TAS5713 driver logs errors during initialisation, but does not return +an error code. Therefore even if initialisation fails, the driver will still be +loaded, but won't work. This patch fixes this. I2C communication error will now +reported correctly by a non-zero return code. + +HiFiBerry Amp: fix device-tree problems + +Some code to load the driver based on device-tree-overlays was missing. This is added by this patch. +--- + sound/soc/bcm/Kconfig | 7 + + sound/soc/bcm/Makefile | 2 + + sound/soc/bcm/hifiberry_amp.c | 128 +++++++++++++++ + sound/soc/codecs/Kconfig | 4 + + sound/soc/codecs/Makefile | 2 + + sound/soc/codecs/tas5713.c | 369 ++++++++++++++++++++++++++++++++++++++++++ + sound/soc/codecs/tas5713.h | 210 ++++++++++++++++++++++++ + 7 files changed, 722 insertions(+) + create mode 100644 sound/soc/bcm/hifiberry_amp.c + create mode 100644 sound/soc/codecs/tas5713.c + create mode 100644 sound/soc/codecs/tas5713.h + +diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig +index 8c338b5..7677c89 100644 +--- a/sound/soc/bcm/Kconfig ++++ b/sound/soc/bcm/Kconfig +@@ -29,6 +29,13 @@ config SND_BCM2708_SOC_HIFIBERRY_DIGI + help + Say Y or M if you want to add support for HifiBerry Digi S/PDIF output board. + ++config SND_BCM2708_SOC_HIFIBERRY_AMP ++ tristate "Support for the HifiBerry Amp" ++ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S ++ select SND_SOC_TAS5713 ++ help ++ Say Y or M if you want to add support for the HifiBerry Amp amplifier board. ++ + config SND_BCM2708_SOC_RPI_DAC + tristate "Support for RPi-DAC" + depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S +diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile +index a29538e..30db495 100644 +--- a/sound/soc/bcm/Makefile ++++ b/sound/soc/bcm/Makefile +@@ -7,11 +7,13 @@ obj-$(CONFIG_SND_BCM2835_SOC_I2S) += snd-soc-bcm2835-i2s.o + snd-soc-hifiberry-dac-objs := hifiberry_dac.o + snd-soc-hifiberry-dacplus-objs := hifiberry_dacplus.o + snd-soc-hifiberry-digi-objs := hifiberry_digi.o ++snd-soc-hifiberry-amp-objs := hifiberry_amp.o + snd-soc-rpi-dac-objs := rpi-dac.o + snd-soc-iqaudio-dac-objs := iqaudio-dac.o + + obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o + obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS) += snd-soc-hifiberry-dacplus.o + obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI) += snd-soc-hifiberry-digi.o ++obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_AMP) += snd-soc-hifiberry-amp.o + obj-$(CONFIG_SND_BCM2708_SOC_RPI_DAC) += snd-soc-rpi-dac.o + obj-$(CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC) += snd-soc-iqaudio-dac.o +diff --git a/sound/soc/bcm/hifiberry_amp.c b/sound/soc/bcm/hifiberry_amp.c +new file mode 100644 +index 0000000..0bb12e4 +--- /dev/null ++++ b/sound/soc/bcm/hifiberry_amp.c +@@ -0,0 +1,128 @@ ++/* ++ * ASoC Driver for HifiBerry AMP ++ * ++ * Author: Sebastian Eickhoff <basti.eickhoff@googlemail.com> ++ * Copyright 2014 ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * version 2 as published by the Free Software Foundation. ++ * ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * General Public License for more details. ++ */ ++ ++#include <linux/module.h> ++#include <linux/platform_device.h> ++ ++#include <sound/core.h> ++#include <sound/pcm.h> ++#include <sound/pcm_params.h> ++#include <sound/soc.h> ++#include <sound/jack.h> ++ ++static int snd_rpi_hifiberry_amp_init(struct snd_soc_pcm_runtime *rtd) ++{ ++ // ToDo: init of the dsp-registers. ++ return 0; ++} ++ ++static int snd_rpi_hifiberry_amp_hw_params( struct snd_pcm_substream *substream, ++ struct snd_pcm_hw_params *params ) ++{ ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; ++ ++ return snd_soc_dai_set_bclk_ratio(cpu_dai, 64); ++} ++ ++static struct snd_soc_ops snd_rpi_hifiberry_amp_ops = { ++ .hw_params = snd_rpi_hifiberry_amp_hw_params, ++}; ++ ++static struct snd_soc_dai_link snd_rpi_hifiberry_amp_dai[] = { ++ { ++ .name = "HifiBerry AMP", ++ .stream_name = "HifiBerry AMP HiFi", ++ .cpu_dai_name = "bcm2708-i2s.0", ++ .codec_dai_name = "tas5713-hifi", ++ .platform_name = "bcm2708-i2s.0", ++ .codec_name = "tas5713.1-001b", ++ .dai_fmt = SND_SOC_DAIFMT_I2S | ++ SND_SOC_DAIFMT_NB_NF | ++ SND_SOC_DAIFMT_CBS_CFS, ++ .ops = &snd_rpi_hifiberry_amp_ops, ++ .init = snd_rpi_hifiberry_amp_init, ++ }, ++}; ++ ++ ++static struct snd_soc_card snd_rpi_hifiberry_amp = { ++ .name = "snd_rpi_hifiberry_amp", ++ .owner = THIS_MODULE, ++ .dai_link = snd_rpi_hifiberry_amp_dai, ++ .num_links = ARRAY_SIZE(snd_rpi_hifiberry_amp_dai), ++}; ++ ++static const struct of_device_id snd_rpi_hifiberry_amp_of_match[] = { ++ { .compatible = "hifiberry,hifiberry-amp", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, snd_rpi_hifiberry_amp_of_match); ++ ++ ++static int snd_rpi_hifiberry_amp_probe(struct platform_device *pdev) ++{ ++ int ret = 0; ++ ++ snd_rpi_hifiberry_amp.dev = &pdev->dev; ++ ++ if (pdev->dev.of_node) { ++ struct device_node *i2s_node; ++ struct snd_soc_dai_link *dai = &snd_rpi_hifiberry_amp_dai[0]; ++ i2s_node = of_parse_phandle(pdev->dev.of_node, ++ "i2s-controller", 0); ++ ++ if (i2s_node) { ++ dai->cpu_dai_name = NULL; ++ dai->cpu_of_node = i2s_node; ++ dai->platform_name = NULL; ++ dai->platform_of_node = i2s_node; ++ } ++ } ++ ++ ret = snd_soc_register_card(&snd_rpi_hifiberry_amp); ++ ++ if (ret != 0) { ++ dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", ret); ++ } ++ ++ return ret; ++} ++ ++ ++static int snd_rpi_hifiberry_amp_remove(struct platform_device *pdev) ++{ ++ return snd_soc_unregister_card(&snd_rpi_hifiberry_amp); ++} ++ ++ ++static struct platform_driver snd_rpi_hifiberry_amp_driver = { ++ .driver = { ++ .name = "snd-hifiberry-amp", ++ .owner = THIS_MODULE, ++ .of_match_table = snd_rpi_hifiberry_amp_of_match, ++ }, ++ .probe = snd_rpi_hifiberry_amp_probe, ++ .remove = snd_rpi_hifiberry_amp_remove, ++}; ++ ++ ++module_platform_driver(snd_rpi_hifiberry_amp_driver); ++ ++ ++MODULE_AUTHOR("Sebastian Eickhoff <basti.eickhoff@googlemail.com>"); ++MODULE_DESCRIPTION("ASoC driver for HiFiBerry-AMP"); ++MODULE_LICENSE("GPL v2"); +diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig +index 513ab55..ebcfbfd 100644 +--- a/sound/soc/codecs/Kconfig ++++ b/sound/soc/codecs/Kconfig +@@ -129,6 +129,7 @@ config SND_SOC_ALL_CODECS + select SND_SOC_TFA9879 if I2C + select SND_SOC_TLV320AIC23_I2C if I2C + select SND_SOC_TLV320AIC23_SPI if SPI_MASTER ++ select SND_SOC_TAS5713 if I2C + select SND_SOC_TLV320AIC26 if SPI_MASTER + select SND_SOC_TLV320AIC31XX if I2C + select SND_SOC_TLV320AIC32X4 if I2C +@@ -759,6 +760,9 @@ config SND_SOC_TFA9879 + tristate "NXP Semiconductors TFA9879 amplifier" + depends on I2C + ++config SND_SOC_TAS5713 ++ tristate ++ + config SND_SOC_TLV320AIC23 + tristate + +diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile +index b87e845..9974a13 100644 +--- a/sound/soc/codecs/Makefile ++++ b/sound/soc/codecs/Makefile +@@ -132,6 +132,7 @@ snd-soc-sti-sas-objs := sti-sas.o + snd-soc-tas5086-objs := tas5086.o + snd-soc-tas571x-objs := tas571x.o + snd-soc-tfa9879-objs := tfa9879.o ++snd-soc-tas5713-objs := tas5713.o + snd-soc-tlv320aic23-objs := tlv320aic23.o + snd-soc-tlv320aic23-i2c-objs := tlv320aic23-i2c.o + snd-soc-tlv320aic23-spi-objs := tlv320aic23-spi.o +@@ -340,6 +341,7 @@ obj-$(CONFIG_SND_SOC_TAS2552) += snd-soc-tas2552.o + obj-$(CONFIG_SND_SOC_TAS5086) += snd-soc-tas5086.o + obj-$(CONFIG_SND_SOC_TAS571X) += snd-soc-tas571x.o + obj-$(CONFIG_SND_SOC_TFA9879) += snd-soc-tfa9879.o ++obj-$(CONFIG_SND_SOC_TAS5713) += snd-soc-tas5713.o + obj-$(CONFIG_SND_SOC_TLV320AIC23) += snd-soc-tlv320aic23.o + obj-$(CONFIG_SND_SOC_TLV320AIC23_I2C) += snd-soc-tlv320aic23-i2c.o + obj-$(CONFIG_SND_SOC_TLV320AIC23_SPI) += snd-soc-tlv320aic23-spi.o +diff --git a/sound/soc/codecs/tas5713.c b/sound/soc/codecs/tas5713.c +new file mode 100644 +index 0000000..9b27138 +--- /dev/null ++++ b/sound/soc/codecs/tas5713.c +@@ -0,0 +1,369 @@ ++/* ++ * ASoC Driver for TAS5713 ++ * ++ * Author: Sebastian Eickhoff <basti.eickhoff@googlemail.com> ++ * Copyright 2014 ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * version 2 as published by the Free Software Foundation. ++ * ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * General Public License for more details. ++ */ ++ ++#include <linux/module.h> ++#include <linux/moduleparam.h> ++#include <linux/init.h> ++#include <linux/delay.h> ++#include <linux/pm.h> ++#include <linux/i2c.h> ++#include <linux/of_device.h> ++#include <linux/spi/spi.h> ++#include <linux/regmap.h> ++#include <linux/regulator/consumer.h> ++#include <linux/slab.h> ++#include <sound/core.h> ++#include <sound/pcm.h> ++#include <sound/pcm_params.h> ++#include <sound/soc.h> ++#include <sound/initval.h> ++#include <sound/tlv.h> ++ ++#include <linux/kernel.h> ++#include <linux/string.h> ++#include <linux/fs.h> ++#include <asm/uaccess.h> ++ ++#include "tas5713.h" ++ ++ ++static struct i2c_client *i2c; ++ ++struct tas5713_priv { ++ struct regmap *regmap; ++ int mclk_div; ++ struct snd_soc_codec *codec; ++}; ++ ++static struct tas5713_priv *priv_data; ++ ++ ++ ++ ++/* ++ * _ _ ___ _ ___ _ _ ++ * /_\ | | / __| /_\ / __|___ _ _| |_ _ _ ___| |___ ++ * / _ \| |__\__ \/ _ \ | (__/ _ \ ' \ _| '_/ _ \ (_-< ++ * /_/ \_\____|___/_/ \_\ \___\___/_||_\__|_| \___/_/__/ ++ * ++ */ ++ ++static const DECLARE_TLV_DB_SCALE(tas5713_vol_tlv, -10000, 50, 1); ++ ++ ++static const struct snd_kcontrol_new tas5713_snd_controls[] = { ++ SOC_SINGLE_TLV ("Master" , TAS5713_VOL_MASTER, 0, 248, 1, tas5713_vol_tlv), ++ SOC_DOUBLE_R_TLV("Channels" , TAS5713_VOL_CH1, TAS5713_VOL_CH2, 0, 248, 1, tas5713_vol_tlv) ++}; ++ ++ ++ ++ ++/* ++ * __ __ _ _ ___ _ ++ * | \/ |__ _ __| |_ (_)_ _ ___ | \ _ _(_)_ _____ _ _ ++ * | |\/| / _` / _| ' \| | ' \/ -_) | |) | '_| \ V / -_) '_| ++ * |_| |_\__,_\__|_||_|_|_||_\___| |___/|_| |_|\_/\___|_| ++ * ++ */ ++ ++static int tas5713_hw_params(struct snd_pcm_substream *substream, ++ struct snd_pcm_hw_params *params, ++ struct snd_soc_dai *dai) ++{ ++ u16 blen = 0x00; ++ ++ struct snd_soc_codec *codec; ++ codec = dai->codec; ++ priv_data->codec = dai->codec; ++ ++ switch (params_format(params)) { ++ case SNDRV_PCM_FORMAT_S16_LE: ++ blen = 0x03; ++ break; ++ case SNDRV_PCM_FORMAT_S20_3LE: ++ blen = 0x1; ++ break; ++ case SNDRV_PCM_FORMAT_S24_LE: ++ blen = 0x04; ++ break; ++ case SNDRV_PCM_FORMAT_S32_LE: ++ blen = 0x05; ++ break; ++ default: ++ dev_err(dai->dev, "Unsupported word length: %u\n", ++ params_format(params)); ++ return -EINVAL; ++ } ++ ++ // set word length ++ snd_soc_update_bits(codec, TAS5713_SERIAL_DATA_INTERFACE, 0x7, blen); ++ ++ return 0; ++} ++ ++ ++static int tas5713_mute_stream(struct snd_soc_dai *dai, int mute, int stream) ++{ ++ unsigned int val = 0; ++ ++ struct tas5713_priv *tas5713; ++ struct snd_soc_codec *codec = dai->codec; ++ tas5713 = snd_soc_codec_get_drvdata(codec); ++ ++ if (mute) { ++ val = TAS5713_SOFT_MUTE_ALL; ++ } ++ ++ return regmap_write(tas5713->regmap, TAS5713_SOFT_MUTE, val); ++} ++ ++ ++static const struct snd_soc_dai_ops tas5713_dai_ops = { ++ .hw_params = tas5713_hw_params, ++ .mute_stream = tas5713_mute_stream, ++}; ++ ++ ++static struct snd_soc_dai_driver tas5713_dai = { ++ .name = "tas5713-hifi", ++ .playback = { ++ .stream_name = "Playback", ++ .channels_min = 2, ++ .channels_max = 2, ++ .rates = SNDRV_PCM_RATE_8000_48000, ++ .formats = (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE ), ++ }, ++ .ops = &tas5713_dai_ops, ++}; ++ ++ ++ ++ ++/* ++ * ___ _ ___ _ ++ * / __|___ __| |___ __ | \ _ _(_)_ _____ _ _ ++ * | (__/ _ \/ _` / -_) _| | |) | '_| \ V / -_) '_| ++ * \___\___/\__,_\___\__| |___/|_| |_|\_/\___|_| ++ * ++ */ ++ ++static int tas5713_remove(struct snd_soc_codec *codec) ++{ ++ struct tas5713_priv *tas5713; ++ ++ tas5713 = snd_soc_codec_get_drvdata(codec); ++ ++ return 0; ++} ++ ++ ++static int tas5713_probe(struct snd_soc_codec *codec) ++{ ++ struct tas5713_priv *tas5713; ++ int i, ret; ++ ++ i2c = container_of(codec->dev, struct i2c_client, dev); ++ ++ tas5713 = snd_soc_codec_get_drvdata(codec); ++ ++ // Reset error ++ ret = snd_soc_write(codec, TAS5713_ERROR_STATUS, 0x00); ++ if (ret < 0) return ret; ++ ++ // Trim oscillator ++ ret = snd_soc_write(codec, TAS5713_OSC_TRIM, 0x00); ++ if (ret < 0) return ret; ++ msleep(1000); ++ ++ // Reset error ++ ret = snd_soc_write(codec, TAS5713_ERROR_STATUS, 0x00); ++ if (ret < 0) return ret; ++ ++ // Clock mode: 44/48kHz, MCLK=64xfs ++ ret = snd_soc_write(codec, TAS5713_CLOCK_CTRL, 0x60); ++ if (ret < 0) return ret; ++ ++ // I2S 24bit ++ ret = snd_soc_write(codec, TAS5713_SERIAL_DATA_INTERFACE, 0x05); ++ if (ret < 0) return ret; ++ ++ // Unmute ++ ret = snd_soc_write(codec, TAS5713_SYSTEM_CTRL2, 0x00); ++ if (ret < 0) return ret; ++ ret = snd_soc_write(codec, TAS5713_SOFT_MUTE, 0x00); ++ if (ret < 0) return ret; ++ ++ // Set volume to 0db ++ ret = snd_soc_write(codec, TAS5713_VOL_MASTER, 0x00); ++ if (ret < 0) return ret; ++ ++ // Now start programming the default initialization sequence ++ for (i = 0; i < ARRAY_SIZE(tas5713_init_sequence); ++i) { ++ ret = i2c_master_send(i2c, ++ tas5713_init_sequence[i].data, ++ tas5713_init_sequence[i].size); ++ if (ret < 0) { ++ printk(KERN_INFO "TAS5713 CODEC PROBE: InitSeq returns: %d\n", ret); ++ } ++ } ++ ++ // Unmute ++ ret = snd_soc_write(codec, TAS5713_SYSTEM_CTRL2, 0x00); ++ if (ret < 0) return ret; ++ ++ return 0; ++} ++ ++ ++static struct snd_soc_codec_driver soc_codec_dev_tas5713 = { ++ .probe = tas5713_probe, ++ .remove = tas5713_remove, ++ .controls = tas5713_snd_controls, ++ .num_controls = ARRAY_SIZE(tas5713_snd_controls), ++}; ++ ++ ++ ++ ++/* ++ * ___ ___ ___ ___ _ ++ * |_ _|_ ) __| | \ _ _(_)_ _____ _ _ ++ * | | / / (__ | |) | '_| \ V / -_) '_| ++ * |___/___\___| |___/|_| |_|\_/\___|_| ++ * ++ */ ++ ++static const struct reg_default tas5713_reg_defaults[] = { ++ { 0x07 ,0x80 }, // R7 - VOL_MASTER - -40dB ++ { 0x08 , 30 }, // R8 - VOL_CH1 - 0dB ++ { 0x09 , 30 }, // R9 - VOL_CH2 - 0dB ++ { 0x0A ,0x80 }, // R10 - VOL_HEADPHONE - -40dB ++}; ++ ++ ++static bool tas5713_reg_volatile(struct device *dev, unsigned int reg) ++{ ++ switch (reg) { ++ case TAS5713_DEVICE_ID: ++ case TAS5713_ERROR_STATUS: ++ return true; ++ default: ++ return false; ++ } ++} ++ ++ ++static const struct of_device_id tas5713_of_match[] = { ++ { .compatible = "ti,tas5713", }, ++ { } ++}; ++MODULE_DEVICE_TABLE(of, tas5713_of_match); ++ ++ ++static struct regmap_config tas5713_regmap_config = { ++ .reg_bits = 8, ++ .val_bits = 8, ++ ++ .max_register = TAS5713_MAX_REGISTER, ++ .volatile_reg = tas5713_reg_volatile, ++ ++ .cache_type = REGCACHE_RBTREE, ++ .reg_defaults = tas5713_reg_defaults, ++ .num_reg_defaults = ARRAY_SIZE(tas5713_reg_defaults), ++}; ++ ++ ++static int tas5713_i2c_probe(struct i2c_client *i2c, ++ const struct i2c_device_id *id) ++{ ++ int ret; ++ ++ priv_data = devm_kzalloc(&i2c->dev, sizeof *priv_data, GFP_KERNEL); ++ if (!priv_data) ++ return -ENOMEM; ++ ++ priv_data->regmap = devm_regmap_init_i2c(i2c, &tas5713_regmap_config); ++ if (IS_ERR(priv_data->regmap)) { ++ ret = PTR_ERR(priv_data->regmap); ++ return ret; ++ } ++ ++ i2c_set_clientdata(i2c, priv_data); ++ ++ ret = snd_soc_register_codec(&i2c->dev, ++ &soc_codec_dev_tas5713, &tas5713_dai, 1); ++ ++ return ret; ++} ++ ++ ++static int tas5713_i2c_remove(struct i2c_client *i2c) ++{ ++ snd_soc_unregister_codec(&i2c->dev); ++ i2c_set_clientdata(i2c, NULL); ++ ++ kfree(priv_data); ++ ++ return 0; ++} ++ ++ ++static const struct i2c_device_id tas5713_i2c_id[] = { ++ { "tas5713", 0 }, ++ { } ++}; ++ ++MODULE_DEVICE_TABLE(i2c, tas5713_i2c_id); ++ ++ ++static struct i2c_driver tas5713_i2c_driver = { ++ .driver = { ++ .name = "tas5713", ++ .owner = THIS_MODULE, ++ .of_match_table = tas5713_of_match, ++ }, ++ .probe = tas5713_i2c_probe, ++ .remove = tas5713_i2c_remove, ++ .id_table = tas5713_i2c_id ++}; ++ ++ ++static int __init tas5713_modinit(void) ++{ ++ int ret = 0; ++ ++ ret = i2c_add_driver(&tas5713_i2c_driver); ++ if (ret) { ++ printk(KERN_ERR "Failed to register tas5713 I2C driver: %d\n", ++ ret); ++ } ++ ++ return ret; ++} ++module_init(tas5713_modinit); ++ ++ ++static void __exit tas5713_exit(void) ++{ ++ i2c_del_driver(&tas5713_i2c_driver); ++} ++module_exit(tas5713_exit); ++ ++ ++MODULE_AUTHOR("Sebastian Eickhoff <basti.eickhoff@googlemail.com>"); ++MODULE_DESCRIPTION("ASoC driver for TAS5713"); ++MODULE_LICENSE("GPL v2"); +diff --git a/sound/soc/codecs/tas5713.h b/sound/soc/codecs/tas5713.h +new file mode 100644 +index 0000000..8f019e0 +--- /dev/null ++++ b/sound/soc/codecs/tas5713.h +@@ -0,0 +1,210 @@ ++/* ++ * ASoC Driver for TAS5713 ++ * ++ * Author: Sebastian Eickhoff <basti.eickhoff@googlemail.com> ++ * Copyright 2014 ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * version 2 as published by the Free Software Foundation. ++ * ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * General Public License for more details. ++ */ ++ ++#ifndef _TAS5713_H ++#define _TAS5713_H ++ ++ ++// TAS5713 I2C-bus register addresses ++ ++#define TAS5713_CLOCK_CTRL 0x00 ++#define TAS5713_DEVICE_ID 0x01 ++#define TAS5713_ERROR_STATUS 0x02 ++#define TAS5713_SYSTEM_CTRL1 0x03 ++#define TAS5713_SERIAL_DATA_INTERFACE 0x04 ++#define TAS5713_SYSTEM_CTRL2 0x05 ++#define TAS5713_SOFT_MUTE 0x06 ++#define TAS5713_VOL_MASTER 0x07 ++#define TAS5713_VOL_CH1 0x08 ++#define TAS5713_VOL_CH2 0x09 ++#define TAS5713_VOL_HEADPHONE 0x0A ++#define TAS5713_VOL_CONFIG 0x0E ++#define TAS5713_MODULATION_LIMIT 0x10 ++#define TAS5713_IC_DLY_CH1 0x11 ++#define TAS5713_IC_DLY_CH2 0x12 ++#define TAS5713_IC_DLY_CH3 0x13 ++#define TAS5713_IC_DLY_CH4 0x14 ++ ++#define TAS5713_START_STOP_PERIOD 0x1A ++#define TAS5713_OSC_TRIM 0x1B ++#define TAS5713_BKND_ERR 0x1C ++ ++#define TAS5713_INPUT_MUX 0x20 ++#define TAS5713_SRC_SELECT_CH4 0x21 ++#define TAS5713_PWM_MUX 0x25 ++ ++#define TAS5713_CH1_BQ0 0x29 ++#define TAS5713_CH1_BQ1 0x2A ++#define TAS5713_CH1_BQ2 0x2B ++#define TAS5713_CH1_BQ3 0x2C ++#define TAS5713_CH1_BQ4 0x2D ++#define TAS5713_CH1_BQ5 0x2E ++#define TAS5713_CH1_BQ6 0x2F ++#define TAS5713_CH1_BQ7 0x58 ++#define TAS5713_CH1_BQ8 0x59 ++ ++#define TAS5713_CH2_BQ0 0x30 ++#define TAS5713_CH2_BQ1 0x31 ++#define TAS5713_CH2_BQ2 0x32 ++#define TAS5713_CH2_BQ3 0x33 ++#define TAS5713_CH2_BQ4 0x34 ++#define TAS5713_CH2_BQ5 0x35 ++#define TAS5713_CH2_BQ6 0x36 ++#define TAS5713_CH2_BQ7 0x5C ++#define TAS5713_CH2_BQ8 0x5D ++ ++#define TAS5713_CH4_BQ0 0x5A ++#define TAS5713_CH4_BQ1 0x5B ++#define TAS5713_CH3_BQ0 0x5E ++#define TAS5713_CH3_BQ1 0x5F ++ ++#define TAS5713_DRC1_SOFTENING_FILTER_ALPHA_OMEGA 0x3B ++#define TAS5713_DRC1_ATTACK_RELEASE_RATE 0x3C ++#define TAS5713_DRC2_SOFTENING_FILTER_ALPHA_OMEGA 0x3E ++#define TAS5713_DRC2_ATTACK_RELEASE_RATE 0x3F ++#define TAS5713_DRC1_ATTACK_RELEASE_THRES 0x40 ++#define TAS5713_DRC2_ATTACK_RELEASE_THRES 0x43 ++#define TAS5713_DRC_CTRL 0x46 ++ ++#define TAS5713_BANK_SW_CTRL 0x50 ++#define TAS5713_CH1_OUTPUT_MIXER 0x51 ++#define TAS5713_CH2_OUTPUT_MIXER 0x52 ++#define TAS5713_CH1_INPUT_MIXER 0x53 ++#define TAS5713_CH2_INPUT_MIXER 0x54 ++#define TAS5713_OUTPUT_POST_SCALE 0x56 ++#define TAS5713_OUTPUT_PRESCALE 0x57 ++ ++#define TAS5713_IDF_POST_SCALE 0x62 ++ ++#define TAS5713_CH1_INLINE_MIXER 0x70 ++#define TAS5713_CH1_INLINE_DRC_EN_MIXER 0x71 ++#define TAS5713_CH1_R_CHANNEL_MIXER 0x72 ++#define TAS5713_CH1_L_CHANNEL_MIXER 0x73 ++#define TAS5713_CH2_INLINE_MIXER 0x74 ++#define TAS5713_CH2_INLINE_DRC_EN_MIXER 0x75 ++#define TAS5713_CH2_L_CHANNEL_MIXER 0x76 ++#define TAS5713_CH2_R_CHANNEL_MIXER 0x77 ++ ++#define TAS5713_UPDATE_DEV_ADDR_KEY 0xF8 ++#define TAS5713_UPDATE_DEV_ADDR_REG 0xF9 ++ ++#define TAS5713_REGISTER_COUNT 0x46 ++#define TAS5713_MAX_REGISTER 0xF9 ++ ++ ++// Bitmasks for registers ++#define TAS5713_SOFT_MUTE_ALL 0x07 ++ ++ ++ ++struct tas5713_init_command { ++ const int size; ++ const char *const data; ++}; ++ ++static const struct tas5713_init_command tas5713_init_sequence[] = { ++ ++ // Trim oscillator ++ { .size = 2, .data = "\x1B\x00" }, ++ // System control register 1 (0x03): block DC ++ { .size = 2, .data = "\x03\x80" }, ++ // Mute everything ++ { .size = 2, .data = "\x05\x40" }, ++ // Modulation limit register (0x10): 97.7% ++ { .size = 2, .data = "\x10\x02" }, ++ // Interchannel delay registers ++ // (0x11, 0x12, 0x13, and 0x14): BD mode ++ { .size = 2, .data = "\x11\xB8" }, ++ { .size = 2, .data = "\x12\x60" }, ++ { .size = 2, .data = "\x13\xA0" }, ++ { .size = 2, .data = "\x14\x48" }, ++ // PWM shutdown group register (0x19): no shutdown ++ { .size = 2, .data = "\x19\x00" }, ++ // Input multiplexer register (0x20): BD mode ++ { .size = 2, .data = "\x20\x00\x89\x77\x72" }, ++ // PWM output mux register (0x25) ++ // Channel 1 --> OUTA, channel 1 neg --> OUTB ++ // Channel 2 --> OUTC, channel 2 neg --> OUTD ++ { .size = 5, .data = "\x25\x01\x02\x13\x45" }, ++ // DRC control (0x46): DRC off ++ { .size = 5, .data = "\x46\x00\x00\x00\x00" }, ++ // BKND_ERR register (0x1C): 299ms reset period ++ { .size = 2, .data = "\x1C\x07" }, ++ // Mute channel 3 ++ { .size = 2, .data = "\x0A\xFF" }, ++ // Volume configuration register (0x0E): volume slew 512 steps ++ { .size = 2, .data = "\x0E\x90" }, ++ // Clock control register (0x00): 44/48kHz, MCLK=64xfs ++ { .size = 2, .data = "\x00\x60" }, ++ // Bank switch and eq control (0x50): no bank switching ++ { .size = 5, .data = "\x50\x00\x00\x00\x00" }, ++ // Volume registers (0x07, 0x08, 0x09, 0x0A) ++ { .size = 2, .data = "\x07\x20" }, ++ { .size = 2, .data = "\x08\x30" }, ++ { .size = 2, .data = "\x09\x30" }, ++ { .size = 2, .data = "\x0A\xFF" }, ++ // 0x72, 0x73, 0x76, 0x77 input mixer: ++ // no intermix between channels ++ { .size = 5, .data = "\x72\x00\x00\x00\x00" }, ++ { .size = 5, .data = "\x73\x00\x80\x00\x00" }, ++ { .size = 5, .data = "\x76\x00\x00\x00\x00" }, ++ { .size = 5, .data = "\x77\x00\x80\x00\x00" }, ++ // 0x70, 0x71, 0x74, 0x75 inline DRC mixer: ++ // no inline DRC inmix ++ { .size = 5, .data = "\x70\x00\x80\x00\x00" }, ++ { .size = 5, .data = "\x71\x00\x00\x00\x00" }, ++ { .size = 5, .data = "\x74\x00\x80\x00\x00" }, ++ { .size = 5, .data = "\x75\x00\x00\x00\x00" }, ++ // 0x56, 0x57 Output scale ++ { .size = 5, .data = "\x56\x00\x80\x00\x00" }, ++ { .size = 5, .data = "\x57\x00\x02\x00\x00" }, ++ // 0x3B, 0x3c ++ { .size = 9, .data = "\x3B\x00\x08\x00\x00\x00\x78\x00\x00" }, ++ { .size = 9, .data = "\x3C\x00\x00\x01\x00\xFF\xFF\xFF\x00" }, ++ { .size = 9, .data = "\x3E\x00\x08\x00\x00\x00\x78\x00\x00" }, ++ { .size = 9, .data = "\x3F\x00\x00\x01\x00\xFF\xFF\xFF\x00" }, ++ { .size = 9, .data = "\x40\x00\x00\x01\x00\xFF\xFF\xFF\x00" }, ++ { .size = 9, .data = "\x43\x00\x00\x01\x00\xFF\xFF\xFF\x00" }, ++ // 0x51, 0x52: output mixer ++ { .size = 9, .data = "\x51\x00\x80\x00\x00\x00\x00\x00\x00" }, ++ { .size = 9, .data = "\x52\x00\x80\x00\x00\x00\x00\x00\x00" }, ++ // PEQ defaults ++ { .size = 21, .data = "\x29\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, ++ { .size = 21, .data = "\x2A\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, ++ { .size = 21, .data = "\x2B\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, ++ { .size = 21, .data = "\x2C\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, ++ { .size = 21, .data = "\x2D\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, ++ { .size = 21, .data = "\x2E\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, ++ { .size = 21, .data = "\x2F\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, ++ { .size = 21, .data = "\x30\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, ++ { .size = 21, .data = "\x31\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, ++ { .size = 21, .data = "\x32\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, ++ { .size = 21, .data = "\x33\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, ++ { .size = 21, .data = "\x34\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, ++ { .size = 21, .data = "\x35\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, ++ { .size = 21, .data = "\x36\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, ++ { .size = 21, .data = "\x58\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, ++ { .size = 21, .data = "\x59\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, ++ { .size = 21, .data = "\x5C\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, ++ { .size = 21, .data = "\x5D\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, ++ { .size = 21, .data = "\x5E\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, ++ { .size = 21, .data = "\x5F\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, ++ { .size = 21, .data = "\x5A\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, ++ { .size = 21, .data = "\x5B\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, ++}; ++ ++ ++#endif /* _TAS5713_H */ + +From c3ed64332c5f99c98c467d4640a94a63d8b0554f Mon Sep 17 00:00:00 2001 +From: Ryan Coe <bluemrp9@gmail.com> +Date: Sat, 31 Jan 2015 18:25:49 -0700 +Subject: [PATCH 074/112] Update ds1307 driver for device-tree support + +Signed-off-by: Ryan Coe <bluemrp9@gmail.com> +--- + drivers/rtc/rtc-ds1307.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c +index e94eb09..f5d93be 100644 +--- a/drivers/rtc/rtc-ds1307.c ++++ b/drivers/rtc/rtc-ds1307.c +@@ -1608,6 +1608,14 @@ static int ds1307_remove(struct i2c_client *client) + return 0; + } + ++#ifdef CONFIG_OF ++static const struct of_device_id ds1307_of_match[] = { ++ { .compatible = "maxim,ds1307" }, ++ { } ++}; ++MODULE_DEVICE_TABLE(of, ds1307_of_match); ++#endif ++ + static struct i2c_driver ds1307_driver = { + .driver = { + .name = "rtc-ds1307", + +From 0cb5de060ca2b6655d39f5e2368439b5e1f0d8f2 Mon Sep 17 00:00:00 2001 +From: Phil Elwell <phil@raspberrypi.org> +Date: Fri, 27 Feb 2015 15:10:24 +0000 +Subject: [PATCH 075/112] enc28j60: Add device tree compatible string and an + overlay + +--- + drivers/net/ethernet/microchip/enc28j60.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/drivers/net/ethernet/microchip/enc28j60.c b/drivers/net/ethernet/microchip/enc28j60.c +index 86ea17e..a1b20c1 100644 +--- a/drivers/net/ethernet/microchip/enc28j60.c ++++ b/drivers/net/ethernet/microchip/enc28j60.c +@@ -1630,9 +1630,16 @@ static int enc28j60_remove(struct spi_device *spi) + return 0; + } + ++static const struct of_device_id enc28j60_of_match[] = { ++ { .compatible = "microchip,enc28j60", }, ++ { /* sentinel */ } ++}; ++MODULE_DEVICE_TABLE(of, enc28j60_of_match); ++ + static struct spi_driver enc28j60_driver = { + .driver = { + .name = DRV_NAME, ++ .of_match_table = enc28j60_of_match, + }, + .probe = enc28j60_probe, + .remove = enc28j60_remove, + +From b93b87463485525ab8d4a782dda0e04d36d1c1b3 Mon Sep 17 00:00:00 2001 +From: Waldemar Brodkorb <wbrodkorb@conet.de> +Date: Wed, 25 Mar 2015 09:26:17 +0100 +Subject: [PATCH 076/112] Add driver for rpi-proto + +Forward port of 3.10.x driver from https://github.com/koalo +We are using a custom board and would like to use rpi 3.18.x +kernel. Patch works fine for our embedded system. + +URL to the audio chip: +http://www.mikroe.com/add-on-boards/audio-voice/audio-codec-proto/ + +Playback tested with devicetree enabled. + +Signed-off-by: Waldemar Brodkorb <wbrodkorb@conet.de> +--- + sound/soc/bcm/Kconfig | 7 +++ + sound/soc/bcm/Makefile | 2 + + sound/soc/bcm/rpi-proto.c | 154 ++++++++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 163 insertions(+) + create mode 100644 sound/soc/bcm/rpi-proto.c + +diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig +index 7677c89..8669a9a 100644 +--- a/sound/soc/bcm/Kconfig ++++ b/sound/soc/bcm/Kconfig +@@ -43,6 +43,13 @@ config SND_BCM2708_SOC_RPI_DAC + help + Say Y or M if you want to add support for RPi-DAC. + ++config SND_BCM2708_SOC_RPI_PROTO ++ tristate "Support for Rpi-PROTO" ++ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S ++ select SND_SOC_WM8731 ++ help ++ Say Y or M if you want to add support for Audio Codec Board PROTO (WM8731). ++ + config SND_BCM2708_SOC_IQAUDIO_DAC + tristate "Support for IQaudIO-DAC" + depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S +diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile +index 30db495..4f5ab1f 100644 +--- a/sound/soc/bcm/Makefile ++++ b/sound/soc/bcm/Makefile +@@ -9,6 +9,7 @@ snd-soc-hifiberry-dacplus-objs := hifiberry_dacplus.o + snd-soc-hifiberry-digi-objs := hifiberry_digi.o + snd-soc-hifiberry-amp-objs := hifiberry_amp.o + snd-soc-rpi-dac-objs := rpi-dac.o ++snd-soc-rpi-proto-objs := rpi-proto.o + snd-soc-iqaudio-dac-objs := iqaudio-dac.o + + obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o +@@ -16,4 +17,5 @@ obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS) += snd-soc-hifiberry-dacplus.o + obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI) += snd-soc-hifiberry-digi.o + obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_AMP) += snd-soc-hifiberry-amp.o + obj-$(CONFIG_SND_BCM2708_SOC_RPI_DAC) += snd-soc-rpi-dac.o ++obj-$(CONFIG_SND_BCM2708_SOC_RPI_PROTO) += snd-soc-rpi-proto.o + obj-$(CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC) += snd-soc-iqaudio-dac.o +diff --git a/sound/soc/bcm/rpi-proto.c b/sound/soc/bcm/rpi-proto.c +new file mode 100644 +index 0000000..9db678e +--- /dev/null ++++ b/sound/soc/bcm/rpi-proto.c +@@ -0,0 +1,154 @@ ++/* ++ * ASoC driver for PROTO AudioCODEC (with a WM8731) ++ * connected to a Raspberry Pi ++ * ++ * Author: Florian Meier, <koalo@koalo.de> ++ * Copyright 2013 ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 as ++ * published by the Free Software Foundation. ++ */ ++ ++#include <linux/module.h> ++#include <linux/platform_device.h> ++ ++#include <sound/core.h> ++#include <sound/pcm.h> ++#include <sound/soc.h> ++#include <sound/jack.h> ++ ++#include "../codecs/wm8731.h" ++ ++static const unsigned int wm8731_rates_12288000[] = { ++ 8000, 32000, 48000, 96000, ++}; ++ ++static struct snd_pcm_hw_constraint_list wm8731_constraints_12288000 = { ++ .list = wm8731_rates_12288000, ++ .count = ARRAY_SIZE(wm8731_rates_12288000), ++}; ++ ++static int snd_rpi_proto_startup(struct snd_pcm_substream *substream) ++{ ++ /* Setup constraints, because there is a 12.288 MHz XTAL on the board */ ++ snd_pcm_hw_constraint_list(substream->runtime, 0, ++ SNDRV_PCM_HW_PARAM_RATE, ++ &wm8731_constraints_12288000); ++ return 0; ++} ++ ++static int snd_rpi_proto_hw_params(struct snd_pcm_substream *substream, ++ struct snd_pcm_hw_params *params) ++{ ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_codec *codec = rtd->codec; ++ struct snd_soc_dai *codec_dai = rtd->codec_dai; ++ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; ++ int sysclk = 12288000; /* This is fixed on this board */ ++ ++ /* Set proto bclk */ ++ int ret = snd_soc_dai_set_bclk_ratio(cpu_dai,32*2); ++ if (ret < 0){ ++ dev_err(codec->dev, ++ "Failed to set BCLK ratio %d\n", ret); ++ return ret; ++ } ++ ++ /* Set proto sysclk */ ++ ret = snd_soc_dai_set_sysclk(codec_dai, WM8731_SYSCLK_XTAL, ++ sysclk, SND_SOC_CLOCK_IN); ++ if (ret < 0) { ++ dev_err(codec->dev, ++ "Failed to set WM8731 SYSCLK: %d\n", ret); ++ return ret; ++ } ++ ++ return 0; ++} ++ ++/* machine stream operations */ ++static struct snd_soc_ops snd_rpi_proto_ops = { ++ .startup = snd_rpi_proto_startup, ++ .hw_params = snd_rpi_proto_hw_params, ++}; ++ ++static struct snd_soc_dai_link snd_rpi_proto_dai[] = { ++{ ++ .name = "WM8731", ++ .stream_name = "WM8731 HiFi", ++ .cpu_dai_name = "bcm2708-i2s.0", ++ .codec_dai_name = "wm8731-hifi", ++ .platform_name = "bcm2708-i2s.0", ++ .codec_name = "wm8731.1-001a", ++ .dai_fmt = SND_SOC_DAIFMT_I2S ++ | SND_SOC_DAIFMT_NB_NF ++ | SND_SOC_DAIFMT_CBM_CFM, ++ .ops = &snd_rpi_proto_ops, ++}, ++}; ++ ++/* audio machine driver */ ++static struct snd_soc_card snd_rpi_proto = { ++ .name = "snd_rpi_proto", ++ .owner = THIS_MODULE, ++ .dai_link = snd_rpi_proto_dai, ++ .num_links = ARRAY_SIZE(snd_rpi_proto_dai), ++}; ++ ++static int snd_rpi_proto_probe(struct platform_device *pdev) ++{ ++ int ret = 0; ++ ++ snd_rpi_proto.dev = &pdev->dev; ++ ++ if (pdev->dev.of_node) { ++ struct device_node *i2s_node; ++ struct snd_soc_dai_link *dai = &snd_rpi_proto_dai[0]; ++ i2s_node = of_parse_phandle(pdev->dev.of_node, ++ "i2s-controller", 0); ++ ++ if (i2s_node) { ++ dai->cpu_dai_name = NULL; ++ dai->cpu_of_node = i2s_node; ++ dai->platform_name = NULL; ++ dai->platform_of_node = i2s_node; ++ } ++ } ++ ++ ret = snd_soc_register_card(&snd_rpi_proto); ++ if (ret) { ++ dev_err(&pdev->dev, ++ "snd_soc_register_card() failed: %d\n", ret); ++ } ++ ++ return ret; ++} ++ ++ ++static int snd_rpi_proto_remove(struct platform_device *pdev) ++{ ++ return snd_soc_unregister_card(&snd_rpi_proto); ++} ++ ++static const struct of_device_id snd_rpi_proto_of_match[] = { ++ { .compatible = "rpi,rpi-proto", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, snd_rpi_proto_of_match); ++ ++static struct platform_driver snd_rpi_proto_driver = { ++ .driver = { ++ .name = "snd-rpi-proto", ++ .owner = THIS_MODULE, ++ .of_match_table = snd_rpi_proto_of_match, ++ }, ++ .probe = snd_rpi_proto_probe, ++ .remove = snd_rpi_proto_remove, ++}; ++ ++module_platform_driver(snd_rpi_proto_driver); ++ ++MODULE_AUTHOR("Florian Meier"); ++MODULE_DESCRIPTION("ASoC Driver for Raspberry Pi connected to PROTO board (WM8731)"); ++MODULE_LICENSE("GPL"); + +From 1bd993b072abd8431882cd24e374c24d3144d206 Mon Sep 17 00:00:00 2001 +From: popcornmix <popcornmix@gmail.com> +Date: Mon, 13 Apr 2015 17:16:29 +0100 +Subject: [PATCH 077/112] config: Add default configs + +--- + arch/arm/configs/bcm2709_defconfig | 1279 +++++++++++++++++++++++++++++++++++ + arch/arm/configs/bcmrpi_defconfig | 1289 ++++++++++++++++++++++++++++++++++++ + 2 files changed, 2568 insertions(+) + create mode 100644 arch/arm/configs/bcm2709_defconfig + create mode 100644 arch/arm/configs/bcmrpi_defconfig + +diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig +new file mode 100644 +index 0000000..f42c5eb +--- /dev/null ++++ b/arch/arm/configs/bcm2709_defconfig +@@ -0,0 +1,1279 @@ ++# CONFIG_ARM_PATCH_PHYS_VIRT is not set ++CONFIG_PHYS_OFFSET=0 ++CONFIG_LOCALVERSION="-v7" ++# CONFIG_LOCALVERSION_AUTO is not set ++CONFIG_SYSVIPC=y ++CONFIG_POSIX_MQUEUE=y ++CONFIG_NO_HZ=y ++CONFIG_HIGH_RES_TIMERS=y ++CONFIG_BSD_PROCESS_ACCT=y ++CONFIG_BSD_PROCESS_ACCT_V3=y ++CONFIG_TASKSTATS=y ++CONFIG_TASK_DELAY_ACCT=y ++CONFIG_TASK_XACCT=y ++CONFIG_TASK_IO_ACCOUNTING=y ++CONFIG_IKCONFIG=m ++CONFIG_IKCONFIG_PROC=y ++CONFIG_MEMCG=y ++CONFIG_BLK_CGROUP=y ++CONFIG_CGROUP_FREEZER=y ++CONFIG_CPUSETS=y ++CONFIG_CGROUP_DEVICE=y ++CONFIG_CGROUP_CPUACCT=y ++CONFIG_NAMESPACES=y ++CONFIG_SCHED_AUTOGROUP=y ++CONFIG_BLK_DEV_INITRD=y ++CONFIG_EMBEDDED=y ++# CONFIG_COMPAT_BRK is not set ++CONFIG_PROFILING=y ++CONFIG_OPROFILE=m ++CONFIG_KPROBES=y ++CONFIG_JUMP_LABEL=y ++CONFIG_MODULES=y ++CONFIG_MODULE_UNLOAD=y ++CONFIG_MODVERSIONS=y ++CONFIG_MODULE_SRCVERSION_ALL=y ++CONFIG_BLK_DEV_THROTTLING=y ++CONFIG_PARTITION_ADVANCED=y ++CONFIG_MAC_PARTITION=y ++CONFIG_CFQ_GROUP_IOSCHED=y ++CONFIG_ARCH_BCM2709=y ++# CONFIG_CACHE_L2X0 is not set ++CONFIG_SMP=y ++CONFIG_HAVE_ARM_ARCH_TIMER=y ++CONFIG_VMSPLIT_2G=y ++CONFIG_PREEMPT_VOLUNTARY=y ++CONFIG_AEABI=y ++CONFIG_OABI_COMPAT=y ++# CONFIG_CPU_SW_DOMAIN_PAN is not set ++CONFIG_CLEANCACHE=y ++CONFIG_FRONTSWAP=y ++CONFIG_CMA=y ++CONFIG_ZSMALLOC=m ++CONFIG_PGTABLE_MAPPING=y ++CONFIG_UACCESS_WITH_MEMCPY=y ++CONFIG_SECCOMP=y ++# CONFIG_ATAGS is not set ++CONFIG_ZBOOT_ROM_TEXT=0x0 ++CONFIG_ZBOOT_ROM_BSS=0x0 ++CONFIG_CMDLINE="console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait" ++CONFIG_CPU_FREQ=y ++CONFIG_CPU_FREQ_STAT=m ++CONFIG_CPU_FREQ_STAT_DETAILS=y ++CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE=y ++CONFIG_CPU_FREQ_GOV_PERFORMANCE=y ++CONFIG_CPU_FREQ_GOV_USERSPACE=y ++CONFIG_CPU_FREQ_GOV_ONDEMAND=y ++CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y ++CONFIG_VFP=y ++CONFIG_NEON=y ++CONFIG_KERNEL_MODE_NEON=y ++CONFIG_BINFMT_MISC=m ++# CONFIG_SUSPEND is not set ++CONFIG_PM=y ++CONFIG_NET=y ++CONFIG_PACKET=y ++CONFIG_UNIX=y ++CONFIG_XFRM_USER=y ++CONFIG_NET_KEY=m ++CONFIG_INET=y ++CONFIG_IP_MULTICAST=y ++CONFIG_IP_ADVANCED_ROUTER=y ++CONFIG_IP_MULTIPLE_TABLES=y ++CONFIG_IP_ROUTE_MULTIPATH=y ++CONFIG_IP_ROUTE_VERBOSE=y ++CONFIG_IP_PNP=y ++CONFIG_IP_PNP_DHCP=y ++CONFIG_IP_PNP_RARP=y ++CONFIG_NET_IPIP=m ++CONFIG_NET_IPGRE_DEMUX=m ++CONFIG_NET_IPGRE=m ++CONFIG_IP_MROUTE=y ++CONFIG_IP_MROUTE_MULTIPLE_TABLES=y ++CONFIG_IP_PIMSM_V1=y ++CONFIG_IP_PIMSM_V2=y ++CONFIG_SYN_COOKIES=y ++CONFIG_INET_AH=m ++CONFIG_INET_ESP=m ++CONFIG_INET_IPCOMP=m ++CONFIG_INET_XFRM_MODE_TRANSPORT=m ++CONFIG_INET_XFRM_MODE_TUNNEL=m ++CONFIG_INET_XFRM_MODE_BEET=m ++CONFIG_INET_DIAG=m ++CONFIG_IPV6=m ++CONFIG_IPV6_ROUTER_PREF=y ++CONFIG_INET6_AH=m ++CONFIG_INET6_ESP=m ++CONFIG_INET6_IPCOMP=m ++CONFIG_IPV6_TUNNEL=m ++CONFIG_IPV6_MULTIPLE_TABLES=y ++CONFIG_IPV6_SUBTREES=y ++CONFIG_IPV6_MROUTE=y ++CONFIG_IPV6_MROUTE_MULTIPLE_TABLES=y ++CONFIG_IPV6_PIMSM_V2=y ++CONFIG_NETFILTER=y ++CONFIG_NF_CONNTRACK=m ++CONFIG_NF_CONNTRACK_ZONES=y ++CONFIG_NF_CONNTRACK_EVENTS=y ++CONFIG_NF_CONNTRACK_TIMESTAMP=y ++CONFIG_NF_CT_PROTO_DCCP=m ++CONFIG_NF_CT_PROTO_UDPLITE=m ++CONFIG_NF_CONNTRACK_AMANDA=m ++CONFIG_NF_CONNTRACK_FTP=m ++CONFIG_NF_CONNTRACK_H323=m ++CONFIG_NF_CONNTRACK_IRC=m ++CONFIG_NF_CONNTRACK_NETBIOS_NS=m ++CONFIG_NF_CONNTRACK_SNMP=m ++CONFIG_NF_CONNTRACK_PPTP=m ++CONFIG_NF_CONNTRACK_SANE=m ++CONFIG_NF_CONNTRACK_SIP=m ++CONFIG_NF_CONNTRACK_TFTP=m ++CONFIG_NF_CT_NETLINK=m ++CONFIG_NETFILTER_XT_SET=m ++CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m ++CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m ++CONFIG_NETFILTER_XT_TARGET_CONNMARK=m ++CONFIG_NETFILTER_XT_TARGET_DSCP=m ++CONFIG_NETFILTER_XT_TARGET_HMARK=m ++CONFIG_NETFILTER_XT_TARGET_IDLETIMER=m ++CONFIG_NETFILTER_XT_TARGET_LED=m ++CONFIG_NETFILTER_XT_TARGET_LOG=m ++CONFIG_NETFILTER_XT_TARGET_MARK=m ++CONFIG_NETFILTER_XT_TARGET_NFLOG=m ++CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m ++CONFIG_NETFILTER_XT_TARGET_NOTRACK=m ++CONFIG_NETFILTER_XT_TARGET_TEE=m ++CONFIG_NETFILTER_XT_TARGET_TPROXY=m ++CONFIG_NETFILTER_XT_TARGET_TRACE=m ++CONFIG_NETFILTER_XT_TARGET_TCPMSS=m ++CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP=m ++CONFIG_NETFILTER_XT_MATCH_ADDRTYPE=m ++CONFIG_NETFILTER_XT_MATCH_BPF=m ++CONFIG_NETFILTER_XT_MATCH_CLUSTER=m ++CONFIG_NETFILTER_XT_MATCH_COMMENT=m ++CONFIG_NETFILTER_XT_MATCH_CONNBYTES=m ++CONFIG_NETFILTER_XT_MATCH_CONNLABEL=m ++CONFIG_NETFILTER_XT_MATCH_CONNLIMIT=m ++CONFIG_NETFILTER_XT_MATCH_CONNMARK=m ++CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m ++CONFIG_NETFILTER_XT_MATCH_CPU=m ++CONFIG_NETFILTER_XT_MATCH_DCCP=m ++CONFIG_NETFILTER_XT_MATCH_DEVGROUP=m ++CONFIG_NETFILTER_XT_MATCH_DSCP=m ++CONFIG_NETFILTER_XT_MATCH_ESP=m ++CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=m ++CONFIG_NETFILTER_XT_MATCH_HELPER=m ++CONFIG_NETFILTER_XT_MATCH_IPRANGE=m ++CONFIG_NETFILTER_XT_MATCH_IPVS=m ++CONFIG_NETFILTER_XT_MATCH_LENGTH=m ++CONFIG_NETFILTER_XT_MATCH_LIMIT=m ++CONFIG_NETFILTER_XT_MATCH_MAC=m ++CONFIG_NETFILTER_XT_MATCH_MARK=m ++CONFIG_NETFILTER_XT_MATCH_MULTIPORT=m ++CONFIG_NETFILTER_XT_MATCH_NFACCT=m ++CONFIG_NETFILTER_XT_MATCH_OSF=m ++CONFIG_NETFILTER_XT_MATCH_OWNER=m ++CONFIG_NETFILTER_XT_MATCH_POLICY=m ++CONFIG_NETFILTER_XT_MATCH_PHYSDEV=m ++CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m ++CONFIG_NETFILTER_XT_MATCH_QUOTA=m ++CONFIG_NETFILTER_XT_MATCH_RATEEST=m ++CONFIG_NETFILTER_XT_MATCH_REALM=m ++CONFIG_NETFILTER_XT_MATCH_RECENT=m ++CONFIG_NETFILTER_XT_MATCH_SOCKET=m ++CONFIG_NETFILTER_XT_MATCH_STATE=m ++CONFIG_NETFILTER_XT_MATCH_STATISTIC=m ++CONFIG_NETFILTER_XT_MATCH_STRING=m ++CONFIG_NETFILTER_XT_MATCH_TCPMSS=m ++CONFIG_NETFILTER_XT_MATCH_TIME=m ++CONFIG_NETFILTER_XT_MATCH_U32=m ++CONFIG_IP_SET=m ++CONFIG_IP_SET_BITMAP_IP=m ++CONFIG_IP_SET_BITMAP_IPMAC=m ++CONFIG_IP_SET_BITMAP_PORT=m ++CONFIG_IP_SET_HASH_IP=m ++CONFIG_IP_SET_HASH_IPPORT=m ++CONFIG_IP_SET_HASH_IPPORTIP=m ++CONFIG_IP_SET_HASH_IPPORTNET=m ++CONFIG_IP_SET_HASH_NET=m ++CONFIG_IP_SET_HASH_NETPORT=m ++CONFIG_IP_SET_HASH_NETIFACE=m ++CONFIG_IP_SET_LIST_SET=m ++CONFIG_IP_VS=m ++CONFIG_IP_VS_PROTO_TCP=y ++CONFIG_IP_VS_PROTO_UDP=y ++CONFIG_IP_VS_PROTO_ESP=y ++CONFIG_IP_VS_PROTO_AH=y ++CONFIG_IP_VS_PROTO_SCTP=y ++CONFIG_IP_VS_RR=m ++CONFIG_IP_VS_WRR=m ++CONFIG_IP_VS_LC=m ++CONFIG_IP_VS_WLC=m ++CONFIG_IP_VS_LBLC=m ++CONFIG_IP_VS_LBLCR=m ++CONFIG_IP_VS_DH=m ++CONFIG_IP_VS_SH=m ++CONFIG_IP_VS_SED=m ++CONFIG_IP_VS_NQ=m ++CONFIG_IP_VS_FTP=m ++CONFIG_IP_VS_PE_SIP=m ++CONFIG_NF_CONNTRACK_IPV4=m ++CONFIG_IP_NF_IPTABLES=m ++CONFIG_IP_NF_MATCH_AH=m ++CONFIG_IP_NF_MATCH_ECN=m ++CONFIG_IP_NF_MATCH_RPFILTER=m ++CONFIG_IP_NF_MATCH_TTL=m ++CONFIG_IP_NF_FILTER=m ++CONFIG_IP_NF_TARGET_REJECT=m ++CONFIG_IP_NF_NAT=m ++CONFIG_IP_NF_TARGET_MASQUERADE=m ++CONFIG_IP_NF_TARGET_NETMAP=m ++CONFIG_IP_NF_TARGET_REDIRECT=m ++CONFIG_IP_NF_MANGLE=m ++CONFIG_IP_NF_TARGET_CLUSTERIP=m ++CONFIG_IP_NF_TARGET_ECN=m ++CONFIG_IP_NF_TARGET_TTL=m ++CONFIG_IP_NF_RAW=m ++CONFIG_IP_NF_ARPTABLES=m ++CONFIG_IP_NF_ARPFILTER=m ++CONFIG_IP_NF_ARP_MANGLE=m ++CONFIG_NF_CONNTRACK_IPV6=m ++CONFIG_IP6_NF_IPTABLES=m ++CONFIG_IP6_NF_MATCH_AH=m ++CONFIG_IP6_NF_MATCH_EUI64=m ++CONFIG_IP6_NF_MATCH_FRAG=m ++CONFIG_IP6_NF_MATCH_OPTS=m ++CONFIG_IP6_NF_MATCH_HL=m ++CONFIG_IP6_NF_MATCH_IPV6HEADER=m ++CONFIG_IP6_NF_MATCH_MH=m ++CONFIG_IP6_NF_MATCH_RPFILTER=m ++CONFIG_IP6_NF_MATCH_RT=m ++CONFIG_IP6_NF_TARGET_HL=m ++CONFIG_IP6_NF_FILTER=m ++CONFIG_IP6_NF_TARGET_REJECT=m ++CONFIG_IP6_NF_MANGLE=m ++CONFIG_IP6_NF_RAW=m ++CONFIG_IP6_NF_NAT=m ++CONFIG_IP6_NF_TARGET_MASQUERADE=m ++CONFIG_IP6_NF_TARGET_NPT=m ++CONFIG_BRIDGE_NF_EBTABLES=m ++CONFIG_BRIDGE_EBT_BROUTE=m ++CONFIG_BRIDGE_EBT_T_FILTER=m ++CONFIG_BRIDGE_EBT_T_NAT=m ++CONFIG_BRIDGE_EBT_802_3=m ++CONFIG_BRIDGE_EBT_AMONG=m ++CONFIG_BRIDGE_EBT_ARP=m ++CONFIG_BRIDGE_EBT_IP=m ++CONFIG_BRIDGE_EBT_IP6=m ++CONFIG_BRIDGE_EBT_LIMIT=m ++CONFIG_BRIDGE_EBT_MARK=m ++CONFIG_BRIDGE_EBT_PKTTYPE=m ++CONFIG_BRIDGE_EBT_STP=m ++CONFIG_BRIDGE_EBT_VLAN=m ++CONFIG_BRIDGE_EBT_ARPREPLY=m ++CONFIG_BRIDGE_EBT_DNAT=m ++CONFIG_BRIDGE_EBT_MARK_T=m ++CONFIG_BRIDGE_EBT_REDIRECT=m ++CONFIG_BRIDGE_EBT_SNAT=m ++CONFIG_BRIDGE_EBT_LOG=m ++CONFIG_BRIDGE_EBT_NFLOG=m ++CONFIG_SCTP_COOKIE_HMAC_SHA1=y ++CONFIG_ATM=m ++CONFIG_L2TP=m ++CONFIG_L2TP_V3=y ++CONFIG_L2TP_IP=m ++CONFIG_L2TP_ETH=m ++CONFIG_BRIDGE=m ++CONFIG_VLAN_8021Q=m ++CONFIG_VLAN_8021Q_GVRP=y ++CONFIG_ATALK=m ++CONFIG_6LOWPAN=m ++CONFIG_IEEE802154=m ++CONFIG_IEEE802154_6LOWPAN=m ++CONFIG_MAC802154=m ++CONFIG_NET_SCHED=y ++CONFIG_NET_SCH_CBQ=m ++CONFIG_NET_SCH_HTB=m ++CONFIG_NET_SCH_HFSC=m ++CONFIG_NET_SCH_PRIO=m ++CONFIG_NET_SCH_MULTIQ=m ++CONFIG_NET_SCH_RED=m ++CONFIG_NET_SCH_SFB=m ++CONFIG_NET_SCH_SFQ=m ++CONFIG_NET_SCH_TEQL=m ++CONFIG_NET_SCH_TBF=m ++CONFIG_NET_SCH_GRED=m ++CONFIG_NET_SCH_DSMARK=m ++CONFIG_NET_SCH_NETEM=m ++CONFIG_NET_SCH_DRR=m ++CONFIG_NET_SCH_MQPRIO=m ++CONFIG_NET_SCH_CHOKE=m ++CONFIG_NET_SCH_QFQ=m ++CONFIG_NET_SCH_CODEL=m ++CONFIG_NET_SCH_FQ_CODEL=m ++CONFIG_NET_SCH_INGRESS=m ++CONFIG_NET_SCH_PLUG=m ++CONFIG_NET_CLS_BASIC=m ++CONFIG_NET_CLS_TCINDEX=m ++CONFIG_NET_CLS_ROUTE4=m ++CONFIG_NET_CLS_FW=m ++CONFIG_NET_CLS_U32=m ++CONFIG_CLS_U32_MARK=y ++CONFIG_NET_CLS_RSVP=m ++CONFIG_NET_CLS_RSVP6=m ++CONFIG_NET_CLS_FLOW=m ++CONFIG_NET_CLS_CGROUP=m ++CONFIG_NET_EMATCH=y ++CONFIG_NET_EMATCH_CMP=m ++CONFIG_NET_EMATCH_NBYTE=m ++CONFIG_NET_EMATCH_U32=m ++CONFIG_NET_EMATCH_META=m ++CONFIG_NET_EMATCH_TEXT=m ++CONFIG_NET_EMATCH_IPSET=m ++CONFIG_NET_CLS_ACT=y ++CONFIG_NET_ACT_POLICE=m ++CONFIG_NET_ACT_GACT=m ++CONFIG_GACT_PROB=y ++CONFIG_NET_ACT_MIRRED=m ++CONFIG_NET_ACT_IPT=m ++CONFIG_NET_ACT_NAT=m ++CONFIG_NET_ACT_PEDIT=m ++CONFIG_NET_ACT_SIMP=m ++CONFIG_NET_ACT_SKBEDIT=m ++CONFIG_NET_ACT_CSUM=m ++CONFIG_BATMAN_ADV=m ++CONFIG_OPENVSWITCH=m ++CONFIG_NET_PKTGEN=m ++CONFIG_HAMRADIO=y ++CONFIG_AX25=m ++CONFIG_NETROM=m ++CONFIG_ROSE=m ++CONFIG_MKISS=m ++CONFIG_6PACK=m ++CONFIG_BPQETHER=m ++CONFIG_BAYCOM_SER_FDX=m ++CONFIG_BAYCOM_SER_HDX=m ++CONFIG_YAM=m ++CONFIG_CAN=m ++CONFIG_CAN_VCAN=m ++CONFIG_CAN_MCP251X=m ++CONFIG_IRDA=m ++CONFIG_IRLAN=m ++CONFIG_IRNET=m ++CONFIG_IRCOMM=m ++CONFIG_IRDA_ULTRA=y ++CONFIG_IRDA_CACHE_LAST_LSAP=y ++CONFIG_IRDA_FAST_RR=y ++CONFIG_IRTTY_SIR=m ++CONFIG_KINGSUN_DONGLE=m ++CONFIG_KSDAZZLE_DONGLE=m ++CONFIG_KS959_DONGLE=m ++CONFIG_USB_IRDA=m ++CONFIG_SIGMATEL_FIR=m ++CONFIG_MCS_FIR=m ++CONFIG_BT=m ++CONFIG_BT_RFCOMM=m ++CONFIG_BT_RFCOMM_TTY=y ++CONFIG_BT_BNEP=m ++CONFIG_BT_BNEP_MC_FILTER=y ++CONFIG_BT_BNEP_PROTO_FILTER=y ++CONFIG_BT_HIDP=m ++CONFIG_BT_6LOWPAN=m ++CONFIG_BT_HCIBTUSB=m ++CONFIG_BT_HCIUART=m ++CONFIG_BT_HCIUART_3WIRE=y ++CONFIG_BT_HCIUART_BCM=y ++CONFIG_BT_HCIBCM203X=m ++CONFIG_BT_HCIBPA10X=m ++CONFIG_BT_HCIBFUSB=m ++CONFIG_BT_HCIVHCI=m ++CONFIG_BT_MRVL=m ++CONFIG_BT_MRVL_SDIO=m ++CONFIG_BT_ATH3K=m ++CONFIG_BT_WILINK=m ++CONFIG_MAC80211=m ++CONFIG_MAC80211_MESH=y ++CONFIG_WIMAX=m ++CONFIG_RFKILL=m ++CONFIG_RFKILL_INPUT=y ++CONFIG_NET_9P=m ++CONFIG_NFC=m ++CONFIG_NFC_PN533=m ++CONFIG_DEVTMPFS=y ++CONFIG_DEVTMPFS_MOUNT=y ++CONFIG_DMA_CMA=y ++CONFIG_CMA_SIZE_MBYTES=5 ++CONFIG_MTD=m ++CONFIG_MTD_BLOCK=m ++CONFIG_MTD_NAND=m ++CONFIG_MTD_UBI=m ++CONFIG_OF_CONFIGFS=y ++CONFIG_ZRAM=m ++CONFIG_ZRAM_LZ4_COMPRESS=y ++CONFIG_BLK_DEV_LOOP=y ++CONFIG_BLK_DEV_CRYPTOLOOP=m ++CONFIG_BLK_DEV_DRBD=m ++CONFIG_BLK_DEV_NBD=m ++CONFIG_BLK_DEV_RAM=y ++CONFIG_CDROM_PKTCDVD=m ++CONFIG_ATA_OVER_ETH=m ++CONFIG_EEPROM_AT24=m ++CONFIG_TI_ST=m ++CONFIG_SCSI=y ++# CONFIG_SCSI_PROC_FS is not set ++CONFIG_BLK_DEV_SD=y ++CONFIG_CHR_DEV_ST=m ++CONFIG_CHR_DEV_OSST=m ++CONFIG_BLK_DEV_SR=m ++CONFIG_CHR_DEV_SG=m ++CONFIG_SCSI_ISCSI_ATTRS=y ++CONFIG_ISCSI_TCP=m ++CONFIG_ISCSI_BOOT_SYSFS=m ++CONFIG_MD=y ++CONFIG_MD_LINEAR=m ++CONFIG_MD_RAID0=m ++CONFIG_BLK_DEV_DM=m ++CONFIG_DM_CRYPT=m ++CONFIG_DM_SNAPSHOT=m ++CONFIG_DM_THIN_PROVISIONING=m ++CONFIG_DM_MIRROR=m ++CONFIG_DM_LOG_USERSPACE=m ++CONFIG_DM_RAID=m ++CONFIG_DM_ZERO=m ++CONFIG_DM_DELAY=m ++CONFIG_NETDEVICES=y ++CONFIG_BONDING=m ++CONFIG_DUMMY=m ++CONFIG_IFB=m ++CONFIG_MACVLAN=m ++CONFIG_NETCONSOLE=m ++CONFIG_TUN=m ++CONFIG_VETH=m ++CONFIG_ENC28J60=m ++CONFIG_QCA7000=m ++CONFIG_MDIO_BITBANG=m ++CONFIG_PPP=m ++CONFIG_PPP_BSDCOMP=m ++CONFIG_PPP_DEFLATE=m ++CONFIG_PPP_FILTER=y ++CONFIG_PPP_MPPE=m ++CONFIG_PPP_MULTILINK=y ++CONFIG_PPPOATM=m ++CONFIG_PPPOE=m ++CONFIG_PPPOL2TP=m ++CONFIG_PPP_ASYNC=m ++CONFIG_PPP_SYNC_TTY=m ++CONFIG_SLIP=m ++CONFIG_SLIP_COMPRESSED=y ++CONFIG_SLIP_SMART=y ++CONFIG_USB_CATC=m ++CONFIG_USB_KAWETH=m ++CONFIG_USB_PEGASUS=m ++CONFIG_USB_RTL8150=m ++CONFIG_USB_RTL8152=m ++CONFIG_USB_USBNET=y ++CONFIG_USB_NET_AX8817X=m ++CONFIG_USB_NET_AX88179_178A=m ++CONFIG_USB_NET_CDCETHER=m ++CONFIG_USB_NET_CDC_EEM=m ++CONFIG_USB_NET_CDC_NCM=m ++CONFIG_USB_NET_HUAWEI_CDC_NCM=m ++CONFIG_USB_NET_CDC_MBIM=m ++CONFIG_USB_NET_DM9601=m ++CONFIG_USB_NET_SR9700=m ++CONFIG_USB_NET_SR9800=m ++CONFIG_USB_NET_SMSC75XX=m ++CONFIG_USB_NET_SMSC95XX=y ++CONFIG_USB_NET_GL620A=m ++CONFIG_USB_NET_NET1080=m ++CONFIG_USB_NET_PLUSB=m ++CONFIG_USB_NET_MCS7830=m ++CONFIG_USB_NET_CDC_SUBSET=m ++CONFIG_USB_ALI_M5632=y ++CONFIG_USB_AN2720=y ++CONFIG_USB_EPSON2888=y ++CONFIG_USB_KC2190=y ++CONFIG_USB_NET_ZAURUS=m ++CONFIG_USB_NET_CX82310_ETH=m ++CONFIG_USB_NET_KALMIA=m ++CONFIG_USB_NET_QMI_WWAN=m ++CONFIG_USB_HSO=m ++CONFIG_USB_NET_INT51X1=m ++CONFIG_USB_IPHETH=m ++CONFIG_USB_SIERRA_NET=m ++CONFIG_USB_VL600=m ++CONFIG_ATH9K=m ++CONFIG_ATH9K_HTC=m ++CONFIG_CARL9170=m ++CONFIG_ATH6KL=m ++CONFIG_ATH6KL_USB=m ++CONFIG_AR5523=m ++CONFIG_AT76C50X_USB=m ++CONFIG_B43=m ++# CONFIG_B43_PHY_N is not set ++CONFIG_B43LEGACY=m ++CONFIG_BRCMFMAC=m ++CONFIG_BRCMFMAC_USB=y ++CONFIG_HOSTAP=m ++CONFIG_P54_COMMON=m ++CONFIG_P54_USB=m ++CONFIG_LIBERTAS=m ++CONFIG_LIBERTAS_USB=m ++CONFIG_LIBERTAS_SDIO=m ++CONFIG_LIBERTAS_THINFIRM=m ++CONFIG_LIBERTAS_THINFIRM_USB=m ++CONFIG_MWIFIEX=m ++CONFIG_MWIFIEX_SDIO=m ++CONFIG_MT7601U=m ++CONFIG_RT2X00=m ++CONFIG_RT2500USB=m ++CONFIG_RT73USB=m ++CONFIG_RT2800USB=m ++CONFIG_RT2800USB_RT3573=y ++CONFIG_RT2800USB_RT53XX=y ++CONFIG_RT2800USB_RT55XX=y ++CONFIG_RT2800USB_UNKNOWN=y ++CONFIG_RTL8187=m ++CONFIG_RTL8192CU=m ++CONFIG_USB_ZD1201=m ++CONFIG_ZD1211RW=m ++CONFIG_MAC80211_HWSIM=m ++CONFIG_USB_NET_RNDIS_WLAN=m ++CONFIG_WIMAX_I2400M_USB=m ++CONFIG_IEEE802154_AT86RF230=m ++CONFIG_IEEE802154_MRF24J40=m ++CONFIG_IEEE802154_CC2520=m ++CONFIG_INPUT_POLLDEV=m ++# CONFIG_INPUT_MOUSEDEV_PSAUX is not set ++CONFIG_INPUT_JOYDEV=m ++CONFIG_INPUT_EVDEV=m ++# CONFIG_KEYBOARD_ATKBD is not set ++CONFIG_KEYBOARD_GPIO=m ++# CONFIG_INPUT_MOUSE is not set ++CONFIG_INPUT_JOYSTICK=y ++CONFIG_JOYSTICK_IFORCE=m ++CONFIG_JOYSTICK_IFORCE_USB=y ++CONFIG_JOYSTICK_XPAD=m ++CONFIG_JOYSTICK_XPAD_FF=y ++CONFIG_JOYSTICK_RPISENSE=m ++CONFIG_INPUT_TOUCHSCREEN=y ++CONFIG_TOUCHSCREEN_ADS7846=m ++CONFIG_TOUCHSCREEN_EGALAX=m ++CONFIG_TOUCHSCREEN_FT6236=m ++CONFIG_TOUCHSCREEN_RPI_FT5406=m ++CONFIG_TOUCHSCREEN_USB_COMPOSITE=m ++CONFIG_TOUCHSCREEN_STMPE=m ++CONFIG_INPUT_MISC=y ++CONFIG_INPUT_AD714X=m ++CONFIG_INPUT_ATI_REMOTE2=m ++CONFIG_INPUT_KEYSPAN_REMOTE=m ++CONFIG_INPUT_POWERMATE=m ++CONFIG_INPUT_YEALINK=m ++CONFIG_INPUT_CM109=m ++CONFIG_INPUT_UINPUT=m ++CONFIG_INPUT_GPIO_ROTARY_ENCODER=m ++CONFIG_INPUT_ADXL34X=m ++CONFIG_INPUT_CMA3000=m ++CONFIG_SERIO=m ++CONFIG_SERIO_RAW=m ++CONFIG_GAMEPORT=m ++CONFIG_GAMEPORT_NS558=m ++CONFIG_GAMEPORT_L4=m ++CONFIG_BRCM_CHAR_DRIVERS=y ++CONFIG_BCM_VC_CMA=y ++CONFIG_BCM_VCIO=y ++CONFIG_BCM_VC_SM=y ++CONFIG_DEVPTS_MULTIPLE_INSTANCES=y ++# CONFIG_LEGACY_PTYS is not set ++# CONFIG_DEVKMEM is not set ++CONFIG_SERIAL_8250=y ++# CONFIG_SERIAL_8250_DEPRECATED_OPTIONS is not set ++CONFIG_SERIAL_8250_CONSOLE=y ++# CONFIG_SERIAL_8250_DMA is not set ++CONFIG_SERIAL_8250_NR_UARTS=1 ++CONFIG_SERIAL_8250_RUNTIME_UARTS=0 ++CONFIG_SERIAL_OF_PLATFORM=y ++CONFIG_SERIAL_AMBA_PL011=y ++CONFIG_SERIAL_AMBA_PL011_CONSOLE=y ++CONFIG_TTY_PRINTK=y ++CONFIG_HW_RANDOM=y ++CONFIG_RAW_DRIVER=y ++CONFIG_I2C=y ++CONFIG_I2C_CHARDEV=m ++CONFIG_I2C_MUX_PCA954x=m ++CONFIG_I2C_BCM2708=m ++CONFIG_I2C_GPIO=m ++CONFIG_SPI=y ++CONFIG_SPI_BCM2835=m ++CONFIG_SPI_BCM2835AUX=m ++CONFIG_SPI_SPIDEV=y ++CONFIG_PPS=m ++CONFIG_PPS_CLIENT_LDISC=m ++CONFIG_PPS_CLIENT_GPIO=m ++CONFIG_GPIO_SYSFS=y ++CONFIG_GPIO_BCM_VIRT=y ++CONFIG_GPIO_ARIZONA=m ++CONFIG_GPIO_STMPE=y ++CONFIG_W1=m ++CONFIG_W1_MASTER_DS2490=m ++CONFIG_W1_MASTER_DS2482=m ++CONFIG_W1_MASTER_DS1WM=m ++CONFIG_W1_MASTER_GPIO=m ++CONFIG_W1_SLAVE_THERM=m ++CONFIG_W1_SLAVE_SMEM=m ++CONFIG_W1_SLAVE_DS2408=m ++CONFIG_W1_SLAVE_DS2413=m ++CONFIG_W1_SLAVE_DS2406=m ++CONFIG_W1_SLAVE_DS2423=m ++CONFIG_W1_SLAVE_DS2431=m ++CONFIG_W1_SLAVE_DS2433=m ++CONFIG_W1_SLAVE_DS2760=m ++CONFIG_W1_SLAVE_DS2780=m ++CONFIG_W1_SLAVE_DS2781=m ++CONFIG_W1_SLAVE_DS28E04=m ++CONFIG_W1_SLAVE_BQ27000=m ++CONFIG_BATTERY_DS2760=m ++CONFIG_POWER_RESET=y ++CONFIG_POWER_RESET_GPIO=y ++CONFIG_HWMON=m ++CONFIG_SENSORS_SHT21=m ++CONFIG_SENSORS_SHTC1=m ++CONFIG_THERMAL=y ++CONFIG_THERMAL_BCM2835=y ++CONFIG_WATCHDOG=y ++CONFIG_BCM2835_WDT=m ++CONFIG_UCB1400_CORE=m ++CONFIG_MFD_STMPE=y ++CONFIG_STMPE_SPI=y ++CONFIG_MFD_ARIZONA_I2C=m ++CONFIG_MFD_ARIZONA_SPI=m ++CONFIG_MFD_WM5102=y ++CONFIG_MEDIA_SUPPORT=m ++CONFIG_MEDIA_CAMERA_SUPPORT=y ++CONFIG_MEDIA_ANALOG_TV_SUPPORT=y ++CONFIG_MEDIA_DIGITAL_TV_SUPPORT=y ++CONFIG_MEDIA_RADIO_SUPPORT=y ++CONFIG_MEDIA_RC_SUPPORT=y ++CONFIG_MEDIA_CONTROLLER=y ++CONFIG_LIRC=m ++CONFIG_RC_DEVICES=y ++CONFIG_RC_ATI_REMOTE=m ++CONFIG_IR_IMON=m ++CONFIG_IR_MCEUSB=m ++CONFIG_IR_REDRAT3=m ++CONFIG_IR_STREAMZAP=m ++CONFIG_IR_IGUANA=m ++CONFIG_IR_TTUSBIR=m ++CONFIG_RC_LOOPBACK=m ++CONFIG_IR_GPIO_CIR=m ++CONFIG_MEDIA_USB_SUPPORT=y ++CONFIG_USB_VIDEO_CLASS=m ++CONFIG_USB_M5602=m ++CONFIG_USB_STV06XX=m ++CONFIG_USB_GL860=m ++CONFIG_USB_GSPCA_BENQ=m ++CONFIG_USB_GSPCA_CONEX=m ++CONFIG_USB_GSPCA_CPIA1=m ++CONFIG_USB_GSPCA_DTCS033=m ++CONFIG_USB_GSPCA_ETOMS=m ++CONFIG_USB_GSPCA_FINEPIX=m ++CONFIG_USB_GSPCA_JEILINJ=m ++CONFIG_USB_GSPCA_JL2005BCD=m ++CONFIG_USB_GSPCA_KINECT=m ++CONFIG_USB_GSPCA_KONICA=m ++CONFIG_USB_GSPCA_MARS=m ++CONFIG_USB_GSPCA_MR97310A=m ++CONFIG_USB_GSPCA_NW80X=m ++CONFIG_USB_GSPCA_OV519=m ++CONFIG_USB_GSPCA_OV534=m ++CONFIG_USB_GSPCA_OV534_9=m ++CONFIG_USB_GSPCA_PAC207=m ++CONFIG_USB_GSPCA_PAC7302=m ++CONFIG_USB_GSPCA_PAC7311=m ++CONFIG_USB_GSPCA_SE401=m ++CONFIG_USB_GSPCA_SN9C2028=m ++CONFIG_USB_GSPCA_SN9C20X=m ++CONFIG_USB_GSPCA_SONIXB=m ++CONFIG_USB_GSPCA_SONIXJ=m ++CONFIG_USB_GSPCA_SPCA500=m ++CONFIG_USB_GSPCA_SPCA501=m ++CONFIG_USB_GSPCA_SPCA505=m ++CONFIG_USB_GSPCA_SPCA506=m ++CONFIG_USB_GSPCA_SPCA508=m ++CONFIG_USB_GSPCA_SPCA561=m ++CONFIG_USB_GSPCA_SPCA1528=m ++CONFIG_USB_GSPCA_SQ905=m ++CONFIG_USB_GSPCA_SQ905C=m ++CONFIG_USB_GSPCA_SQ930X=m ++CONFIG_USB_GSPCA_STK014=m ++CONFIG_USB_GSPCA_STK1135=m ++CONFIG_USB_GSPCA_STV0680=m ++CONFIG_USB_GSPCA_SUNPLUS=m ++CONFIG_USB_GSPCA_T613=m ++CONFIG_USB_GSPCA_TOPRO=m ++CONFIG_USB_GSPCA_TV8532=m ++CONFIG_USB_GSPCA_VC032X=m ++CONFIG_USB_GSPCA_VICAM=m ++CONFIG_USB_GSPCA_XIRLINK_CIT=m ++CONFIG_USB_GSPCA_ZC3XX=m ++CONFIG_USB_PWC=m ++CONFIG_VIDEO_CPIA2=m ++CONFIG_USB_ZR364XX=m ++CONFIG_USB_STKWEBCAM=m ++CONFIG_USB_S2255=m ++CONFIG_VIDEO_USBTV=m ++CONFIG_VIDEO_PVRUSB2=m ++CONFIG_VIDEO_HDPVR=m ++CONFIG_VIDEO_USBVISION=m ++CONFIG_VIDEO_STK1160_COMMON=m ++CONFIG_VIDEO_STK1160_AC97=y ++CONFIG_VIDEO_GO7007=m ++CONFIG_VIDEO_GO7007_USB=m ++CONFIG_VIDEO_GO7007_USB_S2250_BOARD=m ++CONFIG_VIDEO_AU0828=m ++CONFIG_VIDEO_AU0828_RC=y ++CONFIG_VIDEO_CX231XX=m ++CONFIG_VIDEO_CX231XX_ALSA=m ++CONFIG_VIDEO_CX231XX_DVB=m ++CONFIG_VIDEO_TM6000=m ++CONFIG_VIDEO_TM6000_ALSA=m ++CONFIG_VIDEO_TM6000_DVB=m ++CONFIG_DVB_USB=m ++CONFIG_DVB_USB_A800=m ++CONFIG_DVB_USB_DIBUSB_MB=m ++CONFIG_DVB_USB_DIBUSB_MB_FAULTY=y ++CONFIG_DVB_USB_DIBUSB_MC=m ++CONFIG_DVB_USB_DIB0700=m ++CONFIG_DVB_USB_UMT_010=m ++CONFIG_DVB_USB_CXUSB=m ++CONFIG_DVB_USB_M920X=m ++CONFIG_DVB_USB_DIGITV=m ++CONFIG_DVB_USB_VP7045=m ++CONFIG_DVB_USB_VP702X=m ++CONFIG_DVB_USB_GP8PSK=m ++CONFIG_DVB_USB_NOVA_T_USB2=m ++CONFIG_DVB_USB_TTUSB2=m ++CONFIG_DVB_USB_DTT200U=m ++CONFIG_DVB_USB_OPERA1=m ++CONFIG_DVB_USB_AF9005=m ++CONFIG_DVB_USB_AF9005_REMOTE=m ++CONFIG_DVB_USB_PCTV452E=m ++CONFIG_DVB_USB_DW2102=m ++CONFIG_DVB_USB_CINERGY_T2=m ++CONFIG_DVB_USB_DTV5100=m ++CONFIG_DVB_USB_FRIIO=m ++CONFIG_DVB_USB_AZ6027=m ++CONFIG_DVB_USB_TECHNISAT_USB2=m ++CONFIG_DVB_USB_V2=m ++CONFIG_DVB_USB_AF9015=m ++CONFIG_DVB_USB_AF9035=m ++CONFIG_DVB_USB_ANYSEE=m ++CONFIG_DVB_USB_AU6610=m ++CONFIG_DVB_USB_AZ6007=m ++CONFIG_DVB_USB_CE6230=m ++CONFIG_DVB_USB_EC168=m ++CONFIG_DVB_USB_GL861=m ++CONFIG_DVB_USB_LME2510=m ++CONFIG_DVB_USB_MXL111SF=m ++CONFIG_DVB_USB_RTL28XXU=m ++CONFIG_DVB_USB_DVBSKY=m ++CONFIG_SMS_USB_DRV=m ++CONFIG_DVB_B2C2_FLEXCOP_USB=m ++CONFIG_DVB_AS102=m ++CONFIG_VIDEO_EM28XX=m ++CONFIG_VIDEO_EM28XX_V4L2=m ++CONFIG_VIDEO_EM28XX_ALSA=m ++CONFIG_VIDEO_EM28XX_DVB=m ++CONFIG_V4L_PLATFORM_DRIVERS=y ++CONFIG_VIDEO_BCM2835=y ++CONFIG_VIDEO_BCM2835_MMAL=m ++CONFIG_RADIO_SI470X=y ++CONFIG_USB_SI470X=m ++CONFIG_I2C_SI470X=m ++CONFIG_RADIO_SI4713=m ++CONFIG_I2C_SI4713=m ++CONFIG_USB_MR800=m ++CONFIG_USB_DSBR=m ++CONFIG_RADIO_SHARK=m ++CONFIG_RADIO_SHARK2=m ++CONFIG_USB_KEENE=m ++CONFIG_USB_MA901=m ++CONFIG_RADIO_TEA5764=m ++CONFIG_RADIO_SAA7706H=m ++CONFIG_RADIO_TEF6862=m ++CONFIG_RADIO_WL1273=m ++CONFIG_RADIO_WL128X=m ++# CONFIG_MEDIA_SUBDRV_AUTOSELECT is not set ++CONFIG_VIDEO_UDA1342=m ++CONFIG_VIDEO_SONY_BTF_MPX=m ++CONFIG_VIDEO_TVP5150=m ++CONFIG_VIDEO_TW2804=m ++CONFIG_VIDEO_TW9903=m ++CONFIG_VIDEO_TW9906=m ++CONFIG_VIDEO_OV7640=m ++CONFIG_VIDEO_MT9V011=m ++CONFIG_DRM=m ++CONFIG_DRM_LOAD_EDID_FIRMWARE=y ++CONFIG_DRM_UDL=m ++CONFIG_DRM_VC4=m ++CONFIG_FB=y ++CONFIG_FB_BCM2708=y ++CONFIG_FB_UDL=m ++CONFIG_FB_SSD1307=m ++CONFIG_FB_RPISENSE=m ++# CONFIG_BACKLIGHT_GENERIC is not set ++CONFIG_BACKLIGHT_RPI=m ++CONFIG_BACKLIGHT_GPIO=m ++CONFIG_FRAMEBUFFER_CONSOLE=y ++CONFIG_LOGO=y ++# CONFIG_LOGO_LINUX_MONO is not set ++# CONFIG_LOGO_LINUX_VGA16 is not set ++CONFIG_SOUND=y ++CONFIG_SND=m ++CONFIG_SND_SEQUENCER=m ++CONFIG_SND_SEQ_DUMMY=m ++CONFIG_SND_MIXER_OSS=m ++CONFIG_SND_PCM_OSS=m ++CONFIG_SND_SEQUENCER_OSS=y ++CONFIG_SND_HRTIMER=m ++CONFIG_SND_DUMMY=m ++CONFIG_SND_ALOOP=m ++CONFIG_SND_VIRMIDI=m ++CONFIG_SND_MTPAV=m ++CONFIG_SND_SERIAL_U16550=m ++CONFIG_SND_MPU401=m ++CONFIG_SND_BCM2835=m ++CONFIG_SND_USB_AUDIO=m ++CONFIG_SND_USB_UA101=m ++CONFIG_SND_USB_CAIAQ=m ++CONFIG_SND_USB_CAIAQ_INPUT=y ++CONFIG_SND_USB_6FIRE=m ++CONFIG_SND_SOC=m ++CONFIG_SND_BCM2835_SOC_I2S=m ++CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC=m ++CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS=m ++CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI=m ++CONFIG_SND_BCM2708_SOC_HIFIBERRY_AMP=m ++CONFIG_SND_BCM2708_SOC_RPI_DAC=m ++CONFIG_SND_BCM2708_SOC_RPI_PROTO=m ++CONFIG_SND_BCM2708_SOC_BOOMBERRY_DAC=m ++CONFIG_SND_BCM2708_SOC_BOOMBERRY_DIGI=m ++CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC=m ++CONFIG_SND_BCM2708_SOC_RASPIDAC3=m ++CONFIG_SND_BCM2708_SOC_ADAU1977_ADC=m ++CONFIG_SND_AUDIOINJECTOR_PI_SOUNDCARD=m ++CONFIG_SND_SOC_ADAU1701=m ++CONFIG_SND_SOC_WM8804_I2C=m ++CONFIG_SND_SIMPLE_CARD=m ++CONFIG_SOUND_PRIME=m ++CONFIG_HIDRAW=y ++CONFIG_UHID=m ++CONFIG_HID_A4TECH=m ++CONFIG_HID_ACRUX=m ++CONFIG_HID_APPLE=m ++CONFIG_HID_BELKIN=m ++CONFIG_HID_BETOP_FF=m ++CONFIG_HID_CHERRY=m ++CONFIG_HID_CHICONY=m ++CONFIG_HID_CYPRESS=m ++CONFIG_HID_DRAGONRISE=m ++CONFIG_HID_EMS_FF=m ++CONFIG_HID_ELECOM=m ++CONFIG_HID_ELO=m ++CONFIG_HID_EZKEY=m ++CONFIG_HID_HOLTEK=m ++CONFIG_HID_KEYTOUCH=m ++CONFIG_HID_KYE=m ++CONFIG_HID_UCLOGIC=m ++CONFIG_HID_WALTOP=m ++CONFIG_HID_GYRATION=m ++CONFIG_HID_TWINHAN=m ++CONFIG_HID_KENSINGTON=m ++CONFIG_HID_LCPOWER=m ++CONFIG_HID_LOGITECH=m ++CONFIG_HID_LOGITECH_DJ=m ++CONFIG_LOGITECH_FF=y ++CONFIG_LOGIRUMBLEPAD2_FF=y ++CONFIG_LOGIG940_FF=y ++CONFIG_HID_MAGICMOUSE=m ++CONFIG_HID_MICROSOFT=m ++CONFIG_HID_MONTEREY=m ++CONFIG_HID_MULTITOUCH=m ++CONFIG_HID_NTRIG=m ++CONFIG_HID_ORTEK=m ++CONFIG_HID_PANTHERLORD=m ++CONFIG_HID_PETALYNX=m ++CONFIG_HID_PICOLCD=m ++CONFIG_HID_ROCCAT=m ++CONFIG_HID_SAMSUNG=m ++CONFIG_HID_SONY=m ++CONFIG_HID_SPEEDLINK=m ++CONFIG_HID_SUNPLUS=m ++CONFIG_HID_GREENASIA=m ++CONFIG_HID_SMARTJOYPLUS=m ++CONFIG_HID_TOPSEED=m ++CONFIG_HID_THINGM=m ++CONFIG_HID_THRUSTMASTER=m ++CONFIG_HID_WACOM=m ++CONFIG_HID_WIIMOTE=m ++CONFIG_HID_XINMO=m ++CONFIG_HID_ZEROPLUS=m ++CONFIG_HID_ZYDACRON=m ++CONFIG_HID_PID=y ++CONFIG_USB_HIDDEV=y ++CONFIG_USB=y ++CONFIG_USB_ANNOUNCE_NEW_DEVICES=y ++CONFIG_USB_MON=m ++CONFIG_USB_DWCOTG=y ++CONFIG_USB_PRINTER=m ++CONFIG_USB_STORAGE=y ++CONFIG_USB_STORAGE_REALTEK=m ++CONFIG_USB_STORAGE_DATAFAB=m ++CONFIG_USB_STORAGE_FREECOM=m ++CONFIG_USB_STORAGE_ISD200=m ++CONFIG_USB_STORAGE_USBAT=m ++CONFIG_USB_STORAGE_SDDR09=m ++CONFIG_USB_STORAGE_SDDR55=m ++CONFIG_USB_STORAGE_JUMPSHOT=m ++CONFIG_USB_STORAGE_ALAUDA=m ++CONFIG_USB_STORAGE_ONETOUCH=m ++CONFIG_USB_STORAGE_KARMA=m ++CONFIG_USB_STORAGE_CYPRESS_ATACB=m ++CONFIG_USB_STORAGE_ENE_UB6250=m ++CONFIG_USB_MDC800=m ++CONFIG_USB_MICROTEK=m ++CONFIG_USBIP_CORE=m ++CONFIG_USBIP_VHCI_HCD=m ++CONFIG_USBIP_HOST=m ++CONFIG_USB_SERIAL=m ++CONFIG_USB_SERIAL_GENERIC=y ++CONFIG_USB_SERIAL_AIRCABLE=m ++CONFIG_USB_SERIAL_ARK3116=m ++CONFIG_USB_SERIAL_BELKIN=m ++CONFIG_USB_SERIAL_CH341=m ++CONFIG_USB_SERIAL_WHITEHEAT=m ++CONFIG_USB_SERIAL_DIGI_ACCELEPORT=m ++CONFIG_USB_SERIAL_CP210X=m ++CONFIG_USB_SERIAL_CYPRESS_M8=m ++CONFIG_USB_SERIAL_EMPEG=m ++CONFIG_USB_SERIAL_FTDI_SIO=m ++CONFIG_USB_SERIAL_VISOR=m ++CONFIG_USB_SERIAL_IPAQ=m ++CONFIG_USB_SERIAL_IR=m ++CONFIG_USB_SERIAL_EDGEPORT=m ++CONFIG_USB_SERIAL_EDGEPORT_TI=m ++CONFIG_USB_SERIAL_F81232=m ++CONFIG_USB_SERIAL_GARMIN=m ++CONFIG_USB_SERIAL_IPW=m ++CONFIG_USB_SERIAL_IUU=m ++CONFIG_USB_SERIAL_KEYSPAN_PDA=m ++CONFIG_USB_SERIAL_KEYSPAN=m ++CONFIG_USB_SERIAL_KLSI=m ++CONFIG_USB_SERIAL_KOBIL_SCT=m ++CONFIG_USB_SERIAL_MCT_U232=m ++CONFIG_USB_SERIAL_METRO=m ++CONFIG_USB_SERIAL_MOS7720=m ++CONFIG_USB_SERIAL_MOS7840=m ++CONFIG_USB_SERIAL_NAVMAN=m ++CONFIG_USB_SERIAL_PL2303=m ++CONFIG_USB_SERIAL_OTI6858=m ++CONFIG_USB_SERIAL_QCAUX=m ++CONFIG_USB_SERIAL_QUALCOMM=m ++CONFIG_USB_SERIAL_SPCP8X5=m ++CONFIG_USB_SERIAL_SAFE=m ++CONFIG_USB_SERIAL_SIERRAWIRELESS=m ++CONFIG_USB_SERIAL_SYMBOL=m ++CONFIG_USB_SERIAL_TI=m ++CONFIG_USB_SERIAL_CYBERJACK=m ++CONFIG_USB_SERIAL_XIRCOM=m ++CONFIG_USB_SERIAL_OPTION=m ++CONFIG_USB_SERIAL_OMNINET=m ++CONFIG_USB_SERIAL_OPTICON=m ++CONFIG_USB_SERIAL_XSENS_MT=m ++CONFIG_USB_SERIAL_WISHBONE=m ++CONFIG_USB_SERIAL_SSU100=m ++CONFIG_USB_SERIAL_QT2=m ++CONFIG_USB_SERIAL_DEBUG=m ++CONFIG_USB_EMI62=m ++CONFIG_USB_EMI26=m ++CONFIG_USB_ADUTUX=m ++CONFIG_USB_SEVSEG=m ++CONFIG_USB_RIO500=m ++CONFIG_USB_LEGOTOWER=m ++CONFIG_USB_LCD=m ++CONFIG_USB_LED=m ++CONFIG_USB_CYPRESS_CY7C63=m ++CONFIG_USB_CYTHERM=m ++CONFIG_USB_IDMOUSE=m ++CONFIG_USB_FTDI_ELAN=m ++CONFIG_USB_APPLEDISPLAY=m ++CONFIG_USB_LD=m ++CONFIG_USB_TRANCEVIBRATOR=m ++CONFIG_USB_IOWARRIOR=m ++CONFIG_USB_TEST=m ++CONFIG_USB_ISIGHTFW=m ++CONFIG_USB_YUREX=m ++CONFIG_USB_ATM=m ++CONFIG_USB_SPEEDTOUCH=m ++CONFIG_USB_CXACRU=m ++CONFIG_USB_UEAGLEATM=m ++CONFIG_USB_XUSBATM=m ++CONFIG_MMC=y ++CONFIG_MMC_BLOCK_MINORS=32 ++CONFIG_MMC_BCM2835=y ++CONFIG_MMC_BCM2835_DMA=y ++CONFIG_MMC_BCM2835_SDHOST=y ++CONFIG_MMC_SDHCI=y ++CONFIG_MMC_SDHCI_PLTFM=y ++CONFIG_MMC_SPI=m ++CONFIG_LEDS_CLASS=y ++CONFIG_LEDS_GPIO=y ++CONFIG_LEDS_TRIGGER_TIMER=y ++CONFIG_LEDS_TRIGGER_ONESHOT=y ++CONFIG_LEDS_TRIGGER_HEARTBEAT=y ++CONFIG_LEDS_TRIGGER_BACKLIGHT=y ++CONFIG_LEDS_TRIGGER_CPU=y ++CONFIG_LEDS_TRIGGER_GPIO=y ++CONFIG_LEDS_TRIGGER_DEFAULT_ON=y ++CONFIG_LEDS_TRIGGER_TRANSIENT=m ++CONFIG_LEDS_TRIGGER_CAMERA=m ++CONFIG_LEDS_TRIGGER_INPUT=y ++CONFIG_RTC_CLASS=y ++# CONFIG_RTC_HCTOSYS is not set ++CONFIG_RTC_DRV_DS1307=m ++CONFIG_RTC_DRV_DS1374=m ++CONFIG_RTC_DRV_DS1672=m ++CONFIG_RTC_DRV_MAX6900=m ++CONFIG_RTC_DRV_RS5C372=m ++CONFIG_RTC_DRV_ISL1208=m ++CONFIG_RTC_DRV_ISL12022=m ++CONFIG_RTC_DRV_ISL12057=m ++CONFIG_RTC_DRV_X1205=m ++CONFIG_RTC_DRV_PCF8523=m ++CONFIG_RTC_DRV_PCF8563=m ++CONFIG_RTC_DRV_PCF8583=m ++CONFIG_RTC_DRV_M41T80=m ++CONFIG_RTC_DRV_BQ32K=m ++CONFIG_RTC_DRV_S35390A=m ++CONFIG_RTC_DRV_FM3130=m ++CONFIG_RTC_DRV_RX8581=m ++CONFIG_RTC_DRV_RX8025=m ++CONFIG_RTC_DRV_EM3027=m ++CONFIG_RTC_DRV_RV3029C2=m ++CONFIG_RTC_DRV_M41T93=m ++CONFIG_RTC_DRV_M41T94=m ++CONFIG_RTC_DRV_DS1305=m ++CONFIG_RTC_DRV_DS1390=m ++CONFIG_RTC_DRV_R9701=m ++CONFIG_RTC_DRV_RX4581=m ++CONFIG_RTC_DRV_RS5C348=m ++CONFIG_RTC_DRV_MAX6902=m ++CONFIG_RTC_DRV_PCF2123=m ++CONFIG_RTC_DRV_DS3232=m ++CONFIG_RTC_DRV_PCF2127=m ++CONFIG_DMADEVICES=y ++CONFIG_DMA_BCM2835=y ++CONFIG_DMA_BCM2708=y ++CONFIG_UIO=m ++CONFIG_UIO_PDRV_GENIRQ=m ++CONFIG_STAGING=y ++CONFIG_PRISM2_USB=m ++CONFIG_R8712U=m ++CONFIG_R8188EU=m ++CONFIG_R8723AU=m ++CONFIG_VT6656=m ++CONFIG_SPEAKUP=m ++CONFIG_SPEAKUP_SYNTH_SOFT=m ++CONFIG_STAGING_MEDIA=y ++CONFIG_LIRC_STAGING=y ++CONFIG_LIRC_IMON=m ++CONFIG_LIRC_RPI=m ++CONFIG_LIRC_SASEM=m ++CONFIG_LIRC_SERIAL=m ++CONFIG_FB_TFT=m ++CONFIG_FB_TFT_AGM1264K_FL=m ++CONFIG_FB_TFT_BD663474=m ++CONFIG_FB_TFT_HX8340BN=m ++CONFIG_FB_TFT_HX8347D=m ++CONFIG_FB_TFT_HX8353D=m ++CONFIG_FB_TFT_ILI9163=m ++CONFIG_FB_TFT_ILI9320=m ++CONFIG_FB_TFT_ILI9325=m ++CONFIG_FB_TFT_ILI9340=m ++CONFIG_FB_TFT_ILI9341=m ++CONFIG_FB_TFT_ILI9481=m ++CONFIG_FB_TFT_ILI9486=m ++CONFIG_FB_TFT_PCD8544=m ++CONFIG_FB_TFT_RA8875=m ++CONFIG_FB_TFT_S6D02A1=m ++CONFIG_FB_TFT_S6D1121=m ++CONFIG_FB_TFT_SSD1289=m ++CONFIG_FB_TFT_SSD1306=m ++CONFIG_FB_TFT_SSD1331=m ++CONFIG_FB_TFT_SSD1351=m ++CONFIG_FB_TFT_ST7735R=m ++CONFIG_FB_TFT_TINYLCD=m ++CONFIG_FB_TFT_TLS8204=m ++CONFIG_FB_TFT_UC1701=m ++CONFIG_FB_TFT_UPD161704=m ++CONFIG_FB_TFT_WATTEROTT=m ++CONFIG_FB_FLEX=m ++CONFIG_FB_TFT_FBTFT_DEVICE=m ++CONFIG_MAILBOX=y ++CONFIG_BCM2835_MBOX=y ++# CONFIG_IOMMU_SUPPORT is not set ++CONFIG_RASPBERRYPI_POWER=y ++CONFIG_EXTCON=m ++CONFIG_EXTCON_ARIZONA=m ++CONFIG_IIO=m ++CONFIG_IIO_BUFFER=y ++CONFIG_IIO_BUFFER_CB=m ++CONFIG_IIO_KFIFO_BUF=m ++CONFIG_MCP320X=m ++CONFIG_MCP3422=m ++CONFIG_DHT11=m ++CONFIG_PWM_BCM2835=m ++CONFIG_PWM_PCA9685=m ++CONFIG_RASPBERRYPI_FIRMWARE=y ++CONFIG_EXT4_FS=y ++CONFIG_EXT4_FS_POSIX_ACL=y ++CONFIG_EXT4_FS_SECURITY=y ++CONFIG_REISERFS_FS=m ++CONFIG_REISERFS_FS_XATTR=y ++CONFIG_REISERFS_FS_POSIX_ACL=y ++CONFIG_REISERFS_FS_SECURITY=y ++CONFIG_JFS_FS=m ++CONFIG_JFS_POSIX_ACL=y ++CONFIG_JFS_SECURITY=y ++CONFIG_JFS_STATISTICS=y ++CONFIG_XFS_FS=m ++CONFIG_XFS_QUOTA=y ++CONFIG_XFS_POSIX_ACL=y ++CONFIG_XFS_RT=y ++CONFIG_GFS2_FS=m ++CONFIG_OCFS2_FS=m ++CONFIG_BTRFS_FS=m ++CONFIG_BTRFS_FS_POSIX_ACL=y ++CONFIG_NILFS2_FS=m ++CONFIG_F2FS_FS=y ++CONFIG_FANOTIFY=y ++CONFIG_QFMT_V1=m ++CONFIG_QFMT_V2=m ++CONFIG_AUTOFS4_FS=y ++CONFIG_FUSE_FS=m ++CONFIG_CUSE=m ++CONFIG_OVERLAY_FS=m ++CONFIG_FSCACHE=y ++CONFIG_FSCACHE_STATS=y ++CONFIG_FSCACHE_HISTOGRAM=y ++CONFIG_CACHEFILES=y ++CONFIG_ISO9660_FS=m ++CONFIG_JOLIET=y ++CONFIG_ZISOFS=y ++CONFIG_UDF_FS=m ++CONFIG_MSDOS_FS=y ++CONFIG_VFAT_FS=y ++CONFIG_FAT_DEFAULT_IOCHARSET="ascii" ++CONFIG_NTFS_FS=m ++CONFIG_NTFS_RW=y ++CONFIG_TMPFS=y ++CONFIG_TMPFS_POSIX_ACL=y ++CONFIG_ECRYPT_FS=m ++CONFIG_HFS_FS=m ++CONFIG_HFSPLUS_FS=m ++CONFIG_JFFS2_FS=m ++CONFIG_JFFS2_SUMMARY=y ++CONFIG_UBIFS_FS=m ++CONFIG_SQUASHFS=m ++CONFIG_SQUASHFS_XATTR=y ++CONFIG_SQUASHFS_LZO=y ++CONFIG_SQUASHFS_XZ=y ++CONFIG_NFS_FS=y ++CONFIG_NFS_V3_ACL=y ++CONFIG_NFS_V4=y ++CONFIG_NFS_SWAP=y ++CONFIG_ROOT_NFS=y ++CONFIG_NFS_FSCACHE=y ++CONFIG_NFSD=m ++CONFIG_NFSD_V3_ACL=y ++CONFIG_NFSD_V4=y ++CONFIG_CIFS=m ++CONFIG_CIFS_WEAK_PW_HASH=y ++CONFIG_CIFS_UPCALL=y ++CONFIG_CIFS_XATTR=y ++CONFIG_CIFS_POSIX=y ++CONFIG_CIFS_ACL=y ++CONFIG_CIFS_DFS_UPCALL=y ++CONFIG_CIFS_SMB2=y ++CONFIG_CIFS_FSCACHE=y ++CONFIG_9P_FS=m ++CONFIG_9P_FS_POSIX_ACL=y ++CONFIG_NLS_DEFAULT="utf8" ++CONFIG_NLS_CODEPAGE_437=y ++CONFIG_NLS_CODEPAGE_737=m ++CONFIG_NLS_CODEPAGE_775=m ++CONFIG_NLS_CODEPAGE_850=m ++CONFIG_NLS_CODEPAGE_852=m ++CONFIG_NLS_CODEPAGE_855=m ++CONFIG_NLS_CODEPAGE_857=m ++CONFIG_NLS_CODEPAGE_860=m ++CONFIG_NLS_CODEPAGE_861=m ++CONFIG_NLS_CODEPAGE_862=m ++CONFIG_NLS_CODEPAGE_863=m ++CONFIG_NLS_CODEPAGE_864=m ++CONFIG_NLS_CODEPAGE_865=m ++CONFIG_NLS_CODEPAGE_866=m ++CONFIG_NLS_CODEPAGE_869=m ++CONFIG_NLS_CODEPAGE_936=m ++CONFIG_NLS_CODEPAGE_950=m ++CONFIG_NLS_CODEPAGE_932=m ++CONFIG_NLS_CODEPAGE_949=m ++CONFIG_NLS_CODEPAGE_874=m ++CONFIG_NLS_ISO8859_8=m ++CONFIG_NLS_CODEPAGE_1250=m ++CONFIG_NLS_CODEPAGE_1251=m ++CONFIG_NLS_ASCII=y ++CONFIG_NLS_ISO8859_1=m ++CONFIG_NLS_ISO8859_2=m ++CONFIG_NLS_ISO8859_3=m ++CONFIG_NLS_ISO8859_4=m ++CONFIG_NLS_ISO8859_5=m ++CONFIG_NLS_ISO8859_6=m ++CONFIG_NLS_ISO8859_7=m ++CONFIG_NLS_ISO8859_9=m ++CONFIG_NLS_ISO8859_13=m ++CONFIG_NLS_ISO8859_14=m ++CONFIG_NLS_ISO8859_15=m ++CONFIG_NLS_KOI8_R=m ++CONFIG_NLS_KOI8_U=m ++CONFIG_DLM=m ++CONFIG_PRINTK_TIME=y ++CONFIG_BOOT_PRINTK_DELAY=y ++CONFIG_DEBUG_MEMORY_INIT=y ++CONFIG_DETECT_HUNG_TASK=y ++CONFIG_TIMER_STATS=y ++CONFIG_IRQSOFF_TRACER=y ++CONFIG_SCHED_TRACER=y ++CONFIG_STACK_TRACER=y ++CONFIG_BLK_DEV_IO_TRACE=y ++# CONFIG_KPROBE_EVENT is not set ++CONFIG_FUNCTION_PROFILER=y ++CONFIG_KGDB=y ++CONFIG_KGDB_KDB=y ++CONFIG_KDB_KEYBOARD=y ++CONFIG_CRYPTO_USER=m ++CONFIG_CRYPTO_CBC=y ++CONFIG_CRYPTO_CTS=m ++CONFIG_CRYPTO_XTS=m ++CONFIG_CRYPTO_XCBC=m ++CONFIG_CRYPTO_TGR192=m ++CONFIG_CRYPTO_WP512=m ++CONFIG_CRYPTO_CAST5=m ++CONFIG_CRYPTO_DES=y ++CONFIG_CRYPTO_USER_API_SKCIPHER=m ++# CONFIG_CRYPTO_HW is not set ++CONFIG_ARM_CRYPTO=y ++CONFIG_CRYPTO_SHA1_ARM_NEON=m ++CONFIG_CRYPTO_AES_ARM_BS=m ++CONFIG_CRC_ITU_T=y ++CONFIG_LIBCRC32C=y +diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig +new file mode 100644 +index 0000000..8bd0207 +--- /dev/null ++++ b/arch/arm/configs/bcmrpi_defconfig +@@ -0,0 +1,1289 @@ ++# CONFIG_ARM_PATCH_PHYS_VIRT is not set ++CONFIG_PHYS_OFFSET=0 ++# CONFIG_LOCALVERSION_AUTO is not set ++CONFIG_SYSVIPC=y ++CONFIG_POSIX_MQUEUE=y ++CONFIG_NO_HZ=y ++CONFIG_HIGH_RES_TIMERS=y ++CONFIG_BSD_PROCESS_ACCT=y ++CONFIG_BSD_PROCESS_ACCT_V3=y ++CONFIG_TASKSTATS=y ++CONFIG_TASK_DELAY_ACCT=y ++CONFIG_TASK_XACCT=y ++CONFIG_TASK_IO_ACCOUNTING=y ++CONFIG_IKCONFIG=m ++CONFIG_IKCONFIG_PROC=y ++CONFIG_MEMCG=y ++CONFIG_BLK_CGROUP=y ++CONFIG_CGROUP_FREEZER=y ++CONFIG_CPUSETS=y ++CONFIG_CGROUP_DEVICE=y ++CONFIG_CGROUP_CPUACCT=y ++CONFIG_NAMESPACES=y ++CONFIG_SCHED_AUTOGROUP=y ++CONFIG_BLK_DEV_INITRD=y ++CONFIG_EMBEDDED=y ++# CONFIG_COMPAT_BRK is not set ++CONFIG_PROFILING=y ++CONFIG_OPROFILE=m ++CONFIG_KPROBES=y ++CONFIG_JUMP_LABEL=y ++CONFIG_MODULES=y ++CONFIG_MODULE_UNLOAD=y ++CONFIG_MODVERSIONS=y ++CONFIG_MODULE_SRCVERSION_ALL=y ++CONFIG_BLK_DEV_THROTTLING=y ++CONFIG_PARTITION_ADVANCED=y ++CONFIG_MAC_PARTITION=y ++CONFIG_CFQ_GROUP_IOSCHED=y ++CONFIG_ARCH_BCM2708=y ++CONFIG_PREEMPT_VOLUNTARY=y ++CONFIG_AEABI=y ++CONFIG_OABI_COMPAT=y ++# CONFIG_CPU_SW_DOMAIN_PAN is not set ++CONFIG_CLEANCACHE=y ++CONFIG_FRONTSWAP=y ++CONFIG_CMA=y ++CONFIG_ZSMALLOC=m ++CONFIG_PGTABLE_MAPPING=y ++CONFIG_UACCESS_WITH_MEMCPY=y ++CONFIG_SECCOMP=y ++# CONFIG_ATAGS is not set ++CONFIG_ZBOOT_ROM_TEXT=0x0 ++CONFIG_ZBOOT_ROM_BSS=0x0 ++CONFIG_CMDLINE="console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait" ++CONFIG_CPU_FREQ=y ++CONFIG_CPU_FREQ_STAT=m ++CONFIG_CPU_FREQ_STAT_DETAILS=y ++CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE=y ++CONFIG_CPU_FREQ_GOV_PERFORMANCE=y ++CONFIG_CPU_FREQ_GOV_USERSPACE=y ++CONFIG_CPU_FREQ_GOV_ONDEMAND=y ++CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y ++CONFIG_VFP=y ++CONFIG_BINFMT_MISC=m ++# CONFIG_SUSPEND is not set ++CONFIG_PM=y ++CONFIG_NET=y ++CONFIG_PACKET=y ++CONFIG_UNIX=y ++CONFIG_XFRM_USER=y ++CONFIG_NET_KEY=m ++CONFIG_INET=y ++CONFIG_IP_MULTICAST=y ++CONFIG_IP_ADVANCED_ROUTER=y ++CONFIG_IP_MULTIPLE_TABLES=y ++CONFIG_IP_ROUTE_MULTIPATH=y ++CONFIG_IP_ROUTE_VERBOSE=y ++CONFIG_IP_PNP=y ++CONFIG_IP_PNP_DHCP=y ++CONFIG_IP_PNP_RARP=y ++CONFIG_NET_IPIP=m ++CONFIG_NET_IPGRE_DEMUX=m ++CONFIG_NET_IPGRE=m ++CONFIG_IP_MROUTE=y ++CONFIG_IP_MROUTE_MULTIPLE_TABLES=y ++CONFIG_IP_PIMSM_V1=y ++CONFIG_IP_PIMSM_V2=y ++CONFIG_SYN_COOKIES=y ++CONFIG_INET_AH=m ++CONFIG_INET_ESP=m ++CONFIG_INET_IPCOMP=m ++CONFIG_INET_XFRM_MODE_TRANSPORT=m ++CONFIG_INET_XFRM_MODE_TUNNEL=m ++CONFIG_INET_XFRM_MODE_BEET=m ++CONFIG_INET_DIAG=m ++CONFIG_IPV6=m ++CONFIG_IPV6_ROUTER_PREF=y ++CONFIG_INET6_AH=m ++CONFIG_INET6_ESP=m ++CONFIG_INET6_IPCOMP=m ++CONFIG_IPV6_TUNNEL=m ++CONFIG_IPV6_MULTIPLE_TABLES=y ++CONFIG_IPV6_SUBTREES=y ++CONFIG_IPV6_MROUTE=y ++CONFIG_IPV6_MROUTE_MULTIPLE_TABLES=y ++CONFIG_IPV6_PIMSM_V2=y ++CONFIG_NETFILTER=y ++CONFIG_NF_CONNTRACK=m ++CONFIG_NF_CONNTRACK_ZONES=y ++CONFIG_NF_CONNTRACK_EVENTS=y ++CONFIG_NF_CONNTRACK_TIMESTAMP=y ++CONFIG_NF_CT_PROTO_DCCP=m ++CONFIG_NF_CT_PROTO_UDPLITE=m ++CONFIG_NF_CONNTRACK_AMANDA=m ++CONFIG_NF_CONNTRACK_FTP=m ++CONFIG_NF_CONNTRACK_H323=m ++CONFIG_NF_CONNTRACK_IRC=m ++CONFIG_NF_CONNTRACK_NETBIOS_NS=m ++CONFIG_NF_CONNTRACK_SNMP=m ++CONFIG_NF_CONNTRACK_PPTP=m ++CONFIG_NF_CONNTRACK_SANE=m ++CONFIG_NF_CONNTRACK_SIP=m ++CONFIG_NF_CONNTRACK_TFTP=m ++CONFIG_NF_CT_NETLINK=m ++CONFIG_NETFILTER_XT_SET=m ++CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m ++CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m ++CONFIG_NETFILTER_XT_TARGET_CONNMARK=m ++CONFIG_NETFILTER_XT_TARGET_DSCP=m ++CONFIG_NETFILTER_XT_TARGET_HMARK=m ++CONFIG_NETFILTER_XT_TARGET_IDLETIMER=m ++CONFIG_NETFILTER_XT_TARGET_LED=m ++CONFIG_NETFILTER_XT_TARGET_LOG=m ++CONFIG_NETFILTER_XT_TARGET_MARK=m ++CONFIG_NETFILTER_XT_TARGET_NFLOG=m ++CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m ++CONFIG_NETFILTER_XT_TARGET_NOTRACK=m ++CONFIG_NETFILTER_XT_TARGET_TEE=m ++CONFIG_NETFILTER_XT_TARGET_TPROXY=m ++CONFIG_NETFILTER_XT_TARGET_TRACE=m ++CONFIG_NETFILTER_XT_TARGET_TCPMSS=m ++CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP=m ++CONFIG_NETFILTER_XT_MATCH_ADDRTYPE=m ++CONFIG_NETFILTER_XT_MATCH_BPF=m ++CONFIG_NETFILTER_XT_MATCH_CLUSTER=m ++CONFIG_NETFILTER_XT_MATCH_COMMENT=m ++CONFIG_NETFILTER_XT_MATCH_CONNBYTES=m ++CONFIG_NETFILTER_XT_MATCH_CONNLABEL=m ++CONFIG_NETFILTER_XT_MATCH_CONNLIMIT=m ++CONFIG_NETFILTER_XT_MATCH_CONNMARK=m ++CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m ++CONFIG_NETFILTER_XT_MATCH_CPU=m ++CONFIG_NETFILTER_XT_MATCH_DCCP=m ++CONFIG_NETFILTER_XT_MATCH_DEVGROUP=m ++CONFIG_NETFILTER_XT_MATCH_DSCP=m ++CONFIG_NETFILTER_XT_MATCH_ESP=m ++CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=m ++CONFIG_NETFILTER_XT_MATCH_HELPER=m ++CONFIG_NETFILTER_XT_MATCH_IPRANGE=m ++CONFIG_NETFILTER_XT_MATCH_IPVS=m ++CONFIG_NETFILTER_XT_MATCH_LENGTH=m ++CONFIG_NETFILTER_XT_MATCH_LIMIT=m ++CONFIG_NETFILTER_XT_MATCH_MAC=m ++CONFIG_NETFILTER_XT_MATCH_MARK=m ++CONFIG_NETFILTER_XT_MATCH_MULTIPORT=m ++CONFIG_NETFILTER_XT_MATCH_NFACCT=m ++CONFIG_NETFILTER_XT_MATCH_OSF=m ++CONFIG_NETFILTER_XT_MATCH_OWNER=m ++CONFIG_NETFILTER_XT_MATCH_POLICY=m ++CONFIG_NETFILTER_XT_MATCH_PHYSDEV=m ++CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m ++CONFIG_NETFILTER_XT_MATCH_QUOTA=m ++CONFIG_NETFILTER_XT_MATCH_RATEEST=m ++CONFIG_NETFILTER_XT_MATCH_REALM=m ++CONFIG_NETFILTER_XT_MATCH_RECENT=m ++CONFIG_NETFILTER_XT_MATCH_SOCKET=m ++CONFIG_NETFILTER_XT_MATCH_STATE=m ++CONFIG_NETFILTER_XT_MATCH_STATISTIC=m ++CONFIG_NETFILTER_XT_MATCH_STRING=m ++CONFIG_NETFILTER_XT_MATCH_TCPMSS=m ++CONFIG_NETFILTER_XT_MATCH_TIME=m ++CONFIG_NETFILTER_XT_MATCH_U32=m ++CONFIG_IP_SET=m ++CONFIG_IP_SET_BITMAP_IP=m ++CONFIG_IP_SET_BITMAP_IPMAC=m ++CONFIG_IP_SET_BITMAP_PORT=m ++CONFIG_IP_SET_HASH_IP=m ++CONFIG_IP_SET_HASH_IPPORT=m ++CONFIG_IP_SET_HASH_IPPORTIP=m ++CONFIG_IP_SET_HASH_IPPORTNET=m ++CONFIG_IP_SET_HASH_NET=m ++CONFIG_IP_SET_HASH_NETPORT=m ++CONFIG_IP_SET_HASH_NETIFACE=m ++CONFIG_IP_SET_LIST_SET=m ++CONFIG_IP_VS=m ++CONFIG_IP_VS_PROTO_TCP=y ++CONFIG_IP_VS_PROTO_UDP=y ++CONFIG_IP_VS_PROTO_ESP=y ++CONFIG_IP_VS_PROTO_AH=y ++CONFIG_IP_VS_PROTO_SCTP=y ++CONFIG_IP_VS_RR=m ++CONFIG_IP_VS_WRR=m ++CONFIG_IP_VS_LC=m ++CONFIG_IP_VS_WLC=m ++CONFIG_IP_VS_LBLC=m ++CONFIG_IP_VS_LBLCR=m ++CONFIG_IP_VS_DH=m ++CONFIG_IP_VS_SH=m ++CONFIG_IP_VS_SED=m ++CONFIG_IP_VS_NQ=m ++CONFIG_IP_VS_FTP=m ++CONFIG_IP_VS_PE_SIP=m ++CONFIG_NF_CONNTRACK_IPV4=m ++CONFIG_IP_NF_IPTABLES=m ++CONFIG_IP_NF_MATCH_AH=m ++CONFIG_IP_NF_MATCH_ECN=m ++CONFIG_IP_NF_MATCH_RPFILTER=m ++CONFIG_IP_NF_MATCH_TTL=m ++CONFIG_IP_NF_FILTER=m ++CONFIG_IP_NF_TARGET_REJECT=m ++CONFIG_IP_NF_NAT=m ++CONFIG_IP_NF_TARGET_MASQUERADE=m ++CONFIG_IP_NF_TARGET_NETMAP=m ++CONFIG_IP_NF_TARGET_REDIRECT=m ++CONFIG_IP_NF_MANGLE=m ++CONFIG_IP_NF_TARGET_CLUSTERIP=m ++CONFIG_IP_NF_TARGET_ECN=m ++CONFIG_IP_NF_TARGET_TTL=m ++CONFIG_IP_NF_RAW=m ++CONFIG_IP_NF_ARPTABLES=m ++CONFIG_IP_NF_ARPFILTER=m ++CONFIG_IP_NF_ARP_MANGLE=m ++CONFIG_NF_CONNTRACK_IPV6=m ++CONFIG_IP6_NF_IPTABLES=m ++CONFIG_IP6_NF_MATCH_AH=m ++CONFIG_IP6_NF_MATCH_EUI64=m ++CONFIG_IP6_NF_MATCH_FRAG=m ++CONFIG_IP6_NF_MATCH_OPTS=m ++CONFIG_IP6_NF_MATCH_HL=m ++CONFIG_IP6_NF_MATCH_IPV6HEADER=m ++CONFIG_IP6_NF_MATCH_MH=m ++CONFIG_IP6_NF_MATCH_RPFILTER=m ++CONFIG_IP6_NF_MATCH_RT=m ++CONFIG_IP6_NF_TARGET_HL=m ++CONFIG_IP6_NF_FILTER=m ++CONFIG_IP6_NF_TARGET_REJECT=m ++CONFIG_IP6_NF_MANGLE=m ++CONFIG_IP6_NF_RAW=m ++CONFIG_IP6_NF_NAT=m ++CONFIG_IP6_NF_TARGET_MASQUERADE=m ++CONFIG_IP6_NF_TARGET_NPT=m ++CONFIG_BRIDGE_NF_EBTABLES=m ++CONFIG_BRIDGE_EBT_BROUTE=m ++CONFIG_BRIDGE_EBT_T_FILTER=m ++CONFIG_BRIDGE_EBT_T_NAT=m ++CONFIG_BRIDGE_EBT_802_3=m ++CONFIG_BRIDGE_EBT_AMONG=m ++CONFIG_BRIDGE_EBT_ARP=m ++CONFIG_BRIDGE_EBT_IP=m ++CONFIG_BRIDGE_EBT_IP6=m ++CONFIG_BRIDGE_EBT_LIMIT=m ++CONFIG_BRIDGE_EBT_MARK=m ++CONFIG_BRIDGE_EBT_PKTTYPE=m ++CONFIG_BRIDGE_EBT_STP=m ++CONFIG_BRIDGE_EBT_VLAN=m ++CONFIG_BRIDGE_EBT_ARPREPLY=m ++CONFIG_BRIDGE_EBT_DNAT=m ++CONFIG_BRIDGE_EBT_MARK_T=m ++CONFIG_BRIDGE_EBT_REDIRECT=m ++CONFIG_BRIDGE_EBT_SNAT=m ++CONFIG_BRIDGE_EBT_LOG=m ++CONFIG_BRIDGE_EBT_NFLOG=m ++CONFIG_SCTP_COOKIE_HMAC_SHA1=y ++CONFIG_ATM=m ++CONFIG_L2TP=m ++CONFIG_L2TP_V3=y ++CONFIG_L2TP_IP=m ++CONFIG_L2TP_ETH=m ++CONFIG_BRIDGE=m ++CONFIG_VLAN_8021Q=m ++CONFIG_VLAN_8021Q_GVRP=y ++CONFIG_ATALK=m ++CONFIG_6LOWPAN=m ++CONFIG_IEEE802154=m ++CONFIG_IEEE802154_6LOWPAN=m ++CONFIG_MAC802154=m ++CONFIG_NET_SCHED=y ++CONFIG_NET_SCH_CBQ=m ++CONFIG_NET_SCH_HTB=m ++CONFIG_NET_SCH_HFSC=m ++CONFIG_NET_SCH_PRIO=m ++CONFIG_NET_SCH_MULTIQ=m ++CONFIG_NET_SCH_RED=m ++CONFIG_NET_SCH_SFB=m ++CONFIG_NET_SCH_SFQ=m ++CONFIG_NET_SCH_TEQL=m ++CONFIG_NET_SCH_TBF=m ++CONFIG_NET_SCH_GRED=m ++CONFIG_NET_SCH_DSMARK=m ++CONFIG_NET_SCH_NETEM=m ++CONFIG_NET_SCH_DRR=m ++CONFIG_NET_SCH_MQPRIO=m ++CONFIG_NET_SCH_CHOKE=m ++CONFIG_NET_SCH_QFQ=m ++CONFIG_NET_SCH_CODEL=m ++CONFIG_NET_SCH_FQ_CODEL=m ++CONFIG_NET_SCH_INGRESS=m ++CONFIG_NET_SCH_PLUG=m ++CONFIG_NET_CLS_BASIC=m ++CONFIG_NET_CLS_TCINDEX=m ++CONFIG_NET_CLS_ROUTE4=m ++CONFIG_NET_CLS_FW=m ++CONFIG_NET_CLS_U32=m ++CONFIG_CLS_U32_MARK=y ++CONFIG_NET_CLS_RSVP=m ++CONFIG_NET_CLS_RSVP6=m ++CONFIG_NET_CLS_FLOW=m ++CONFIG_NET_CLS_CGROUP=m ++CONFIG_NET_EMATCH=y ++CONFIG_NET_EMATCH_CMP=m ++CONFIG_NET_EMATCH_NBYTE=m ++CONFIG_NET_EMATCH_U32=m ++CONFIG_NET_EMATCH_META=m ++CONFIG_NET_EMATCH_TEXT=m ++CONFIG_NET_EMATCH_IPSET=m ++CONFIG_NET_CLS_ACT=y ++CONFIG_NET_ACT_POLICE=m ++CONFIG_NET_ACT_GACT=m ++CONFIG_GACT_PROB=y ++CONFIG_NET_ACT_MIRRED=m ++CONFIG_NET_ACT_IPT=m ++CONFIG_NET_ACT_NAT=m ++CONFIG_NET_ACT_PEDIT=m ++CONFIG_NET_ACT_SIMP=m ++CONFIG_NET_ACT_SKBEDIT=m ++CONFIG_NET_ACT_CSUM=m ++CONFIG_BATMAN_ADV=m ++CONFIG_OPENVSWITCH=m ++CONFIG_NET_PKTGEN=m ++CONFIG_HAMRADIO=y ++CONFIG_AX25=m ++CONFIG_NETROM=m ++CONFIG_ROSE=m ++CONFIG_MKISS=m ++CONFIG_6PACK=m ++CONFIG_BPQETHER=m ++CONFIG_BAYCOM_SER_FDX=m ++CONFIG_BAYCOM_SER_HDX=m ++CONFIG_YAM=m ++CONFIG_CAN=m ++CONFIG_CAN_VCAN=m ++CONFIG_CAN_MCP251X=m ++CONFIG_IRDA=m ++CONFIG_IRLAN=m ++CONFIG_IRNET=m ++CONFIG_IRCOMM=m ++CONFIG_IRDA_ULTRA=y ++CONFIG_IRDA_CACHE_LAST_LSAP=y ++CONFIG_IRDA_FAST_RR=y ++CONFIG_IRTTY_SIR=m ++CONFIG_KINGSUN_DONGLE=m ++CONFIG_KSDAZZLE_DONGLE=m ++CONFIG_KS959_DONGLE=m ++CONFIG_USB_IRDA=m ++CONFIG_SIGMATEL_FIR=m ++CONFIG_MCS_FIR=m ++CONFIG_BT=m ++CONFIG_BT_RFCOMM=m ++CONFIG_BT_RFCOMM_TTY=y ++CONFIG_BT_BNEP=m ++CONFIG_BT_BNEP_MC_FILTER=y ++CONFIG_BT_BNEP_PROTO_FILTER=y ++CONFIG_BT_HIDP=m ++CONFIG_BT_6LOWPAN=m ++CONFIG_BT_HCIBTUSB=m ++CONFIG_BT_HCIUART=m ++CONFIG_BT_HCIUART_3WIRE=y ++CONFIG_BT_HCIUART_BCM=y ++CONFIG_BT_HCIBCM203X=m ++CONFIG_BT_HCIBPA10X=m ++CONFIG_BT_HCIBFUSB=m ++CONFIG_BT_HCIVHCI=m ++CONFIG_BT_MRVL=m ++CONFIG_BT_MRVL_SDIO=m ++CONFIG_BT_ATH3K=m ++CONFIG_BT_WILINK=m ++CONFIG_MAC80211=m ++CONFIG_MAC80211_MESH=y ++CONFIG_WIMAX=m ++CONFIG_RFKILL=m ++CONFIG_RFKILL_INPUT=y ++CONFIG_NET_9P=m ++CONFIG_NFC=m ++CONFIG_NFC_PN533=m ++CONFIG_DEVTMPFS=y ++CONFIG_DEVTMPFS_MOUNT=y ++CONFIG_DMA_CMA=y ++CONFIG_CMA_SIZE_MBYTES=5 ++CONFIG_MTD=m ++CONFIG_MTD_BLOCK=m ++CONFIG_MTD_NAND=m ++CONFIG_MTD_UBI=m ++CONFIG_OF_CONFIGFS=y ++CONFIG_ZRAM=m ++CONFIG_ZRAM_LZ4_COMPRESS=y ++CONFIG_BLK_DEV_LOOP=y ++CONFIG_BLK_DEV_CRYPTOLOOP=m ++CONFIG_BLK_DEV_DRBD=m ++CONFIG_BLK_DEV_NBD=m ++CONFIG_BLK_DEV_RAM=y ++CONFIG_CDROM_PKTCDVD=m ++CONFIG_ATA_OVER_ETH=m ++CONFIG_EEPROM_AT24=m ++CONFIG_TI_ST=m ++CONFIG_SCSI=y ++# CONFIG_SCSI_PROC_FS is not set ++CONFIG_BLK_DEV_SD=y ++CONFIG_CHR_DEV_ST=m ++CONFIG_CHR_DEV_OSST=m ++CONFIG_BLK_DEV_SR=m ++CONFIG_CHR_DEV_SG=m ++CONFIG_SCSI_ISCSI_ATTRS=y ++CONFIG_ISCSI_TCP=m ++CONFIG_ISCSI_BOOT_SYSFS=m ++CONFIG_MD=y ++CONFIG_MD_LINEAR=m ++CONFIG_MD_RAID0=m ++CONFIG_BLK_DEV_DM=m ++CONFIG_DM_CRYPT=m ++CONFIG_DM_SNAPSHOT=m ++CONFIG_DM_THIN_PROVISIONING=m ++CONFIG_DM_MIRROR=m ++CONFIG_DM_LOG_USERSPACE=m ++CONFIG_DM_RAID=m ++CONFIG_DM_ZERO=m ++CONFIG_DM_DELAY=m ++CONFIG_NETDEVICES=y ++CONFIG_BONDING=m ++CONFIG_DUMMY=m ++CONFIG_IFB=m ++CONFIG_MACVLAN=m ++CONFIG_NETCONSOLE=m ++CONFIG_TUN=m ++CONFIG_VETH=m ++CONFIG_ENC28J60=m ++CONFIG_QCA7000=m ++CONFIG_MDIO_BITBANG=m ++CONFIG_PPP=m ++CONFIG_PPP_BSDCOMP=m ++CONFIG_PPP_DEFLATE=m ++CONFIG_PPP_FILTER=y ++CONFIG_PPP_MPPE=m ++CONFIG_PPP_MULTILINK=y ++CONFIG_PPPOATM=m ++CONFIG_PPPOE=m ++CONFIG_PPPOL2TP=m ++CONFIG_PPP_ASYNC=m ++CONFIG_PPP_SYNC_TTY=m ++CONFIG_SLIP=m ++CONFIG_SLIP_COMPRESSED=y ++CONFIG_SLIP_SMART=y ++CONFIG_USB_CATC=m ++CONFIG_USB_KAWETH=m ++CONFIG_USB_PEGASUS=m ++CONFIG_USB_RTL8150=m ++CONFIG_USB_RTL8152=m ++CONFIG_USB_USBNET=y ++CONFIG_USB_NET_AX8817X=m ++CONFIG_USB_NET_AX88179_178A=m ++CONFIG_USB_NET_CDCETHER=m ++CONFIG_USB_NET_CDC_EEM=m ++CONFIG_USB_NET_CDC_NCM=m ++CONFIG_USB_NET_HUAWEI_CDC_NCM=m ++CONFIG_USB_NET_CDC_MBIM=m ++CONFIG_USB_NET_DM9601=m ++CONFIG_USB_NET_SR9700=m ++CONFIG_USB_NET_SR9800=m ++CONFIG_USB_NET_SMSC75XX=m ++CONFIG_USB_NET_SMSC95XX=y ++CONFIG_USB_NET_GL620A=m ++CONFIG_USB_NET_NET1080=m ++CONFIG_USB_NET_PLUSB=m ++CONFIG_USB_NET_MCS7830=m ++CONFIG_USB_NET_CDC_SUBSET=m ++CONFIG_USB_ALI_M5632=y ++CONFIG_USB_AN2720=y ++CONFIG_USB_EPSON2888=y ++CONFIG_USB_KC2190=y ++CONFIG_USB_NET_ZAURUS=m ++CONFIG_USB_NET_CX82310_ETH=m ++CONFIG_USB_NET_KALMIA=m ++CONFIG_USB_NET_QMI_WWAN=m ++CONFIG_USB_HSO=m ++CONFIG_USB_NET_INT51X1=m ++CONFIG_USB_IPHETH=m ++CONFIG_USB_SIERRA_NET=m ++CONFIG_USB_VL600=m ++CONFIG_ATH9K=m ++CONFIG_ATH9K_HTC=m ++CONFIG_CARL9170=m ++CONFIG_ATH6KL=m ++CONFIG_ATH6KL_USB=m ++CONFIG_AR5523=m ++CONFIG_AT76C50X_USB=m ++CONFIG_B43=m ++# CONFIG_B43_PHY_N is not set ++CONFIG_B43LEGACY=m ++CONFIG_BRCMFMAC=m ++CONFIG_BRCMFMAC_USB=y ++CONFIG_HOSTAP=m ++CONFIG_P54_COMMON=m ++CONFIG_P54_USB=m ++CONFIG_LIBERTAS=m ++CONFIG_LIBERTAS_USB=m ++CONFIG_LIBERTAS_SDIO=m ++CONFIG_LIBERTAS_THINFIRM=m ++CONFIG_LIBERTAS_THINFIRM_USB=m ++CONFIG_MWIFIEX=m ++CONFIG_MWIFIEX_SDIO=m ++CONFIG_MT7601U=m ++CONFIG_RT2X00=m ++CONFIG_RT2500USB=m ++CONFIG_RT73USB=m ++CONFIG_RT2800USB=m ++CONFIG_RT2800USB_RT3573=y ++CONFIG_RT2800USB_RT53XX=y ++CONFIG_RT2800USB_RT55XX=y ++CONFIG_RT2800USB_UNKNOWN=y ++CONFIG_RTL8187=m ++CONFIG_RTL8192CU=m ++CONFIG_USB_ZD1201=m ++CONFIG_ZD1211RW=m ++CONFIG_MAC80211_HWSIM=m ++CONFIG_USB_NET_RNDIS_WLAN=m ++CONFIG_WIMAX_I2400M_USB=m ++CONFIG_IEEE802154_AT86RF230=m ++CONFIG_IEEE802154_MRF24J40=m ++CONFIG_IEEE802154_CC2520=m ++CONFIG_INPUT_POLLDEV=m ++# CONFIG_INPUT_MOUSEDEV_PSAUX is not set ++CONFIG_INPUT_JOYDEV=m ++CONFIG_INPUT_EVDEV=m ++# CONFIG_KEYBOARD_ATKBD is not set ++CONFIG_KEYBOARD_GPIO=m ++# CONFIG_INPUT_MOUSE is not set ++CONFIG_INPUT_JOYSTICK=y ++CONFIG_JOYSTICK_IFORCE=m ++CONFIG_JOYSTICK_IFORCE_USB=y ++CONFIG_JOYSTICK_XPAD=m ++CONFIG_JOYSTICK_XPAD_FF=y ++CONFIG_JOYSTICK_RPISENSE=m ++CONFIG_INPUT_TOUCHSCREEN=y ++CONFIG_TOUCHSCREEN_ADS7846=m ++CONFIG_TOUCHSCREEN_EGALAX=m ++CONFIG_TOUCHSCREEN_FT6236=m ++CONFIG_TOUCHSCREEN_RPI_FT5406=m ++CONFIG_TOUCHSCREEN_USB_COMPOSITE=m ++CONFIG_TOUCHSCREEN_STMPE=m ++CONFIG_INPUT_MISC=y ++CONFIG_INPUT_AD714X=m ++CONFIG_INPUT_ATI_REMOTE2=m ++CONFIG_INPUT_KEYSPAN_REMOTE=m ++CONFIG_INPUT_POWERMATE=m ++CONFIG_INPUT_YEALINK=m ++CONFIG_INPUT_CM109=m ++CONFIG_INPUT_UINPUT=m ++CONFIG_INPUT_GPIO_ROTARY_ENCODER=m ++CONFIG_INPUT_ADXL34X=m ++CONFIG_INPUT_CMA3000=m ++CONFIG_SERIO=m ++CONFIG_SERIO_RAW=m ++CONFIG_GAMEPORT=m ++CONFIG_GAMEPORT_NS558=m ++CONFIG_GAMEPORT_L4=m ++CONFIG_BRCM_CHAR_DRIVERS=y ++CONFIG_BCM_VC_CMA=y ++CONFIG_BCM_VCIO=y ++CONFIG_BCM_VC_SM=y ++CONFIG_DEVPTS_MULTIPLE_INSTANCES=y ++# CONFIG_LEGACY_PTYS is not set ++# CONFIG_DEVKMEM is not set ++CONFIG_SERIAL_8250=y ++# CONFIG_SERIAL_8250_DEPRECATED_OPTIONS is not set ++CONFIG_SERIAL_8250_CONSOLE=y ++# CONFIG_SERIAL_8250_DMA is not set ++CONFIG_SERIAL_8250_NR_UARTS=1 ++CONFIG_SERIAL_8250_RUNTIME_UARTS=0 ++CONFIG_SERIAL_OF_PLATFORM=y ++CONFIG_SERIAL_AMBA_PL011=y ++CONFIG_SERIAL_AMBA_PL011_CONSOLE=y ++CONFIG_TTY_PRINTK=y ++CONFIG_HW_RANDOM=y ++CONFIG_RAW_DRIVER=y ++CONFIG_I2C=y ++CONFIG_I2C_CHARDEV=m ++CONFIG_I2C_MUX_PCA954x=m ++CONFIG_I2C_BCM2708=m ++CONFIG_I2C_GPIO=m ++CONFIG_SPI=y ++CONFIG_SPI_BCM2835=m ++CONFIG_SPI_BCM2835AUX=m ++CONFIG_SPI_SPIDEV=y ++CONFIG_PPS=m ++CONFIG_PPS_CLIENT_LDISC=m ++CONFIG_PPS_CLIENT_GPIO=m ++CONFIG_GPIO_SYSFS=y ++CONFIG_GPIO_ARIZONA=m ++CONFIG_GPIO_STMPE=y ++CONFIG_W1=m ++CONFIG_W1_MASTER_DS2490=m ++CONFIG_W1_MASTER_DS2482=m ++CONFIG_W1_MASTER_DS1WM=m ++CONFIG_W1_MASTER_GPIO=m ++CONFIG_W1_SLAVE_THERM=m ++CONFIG_W1_SLAVE_SMEM=m ++CONFIG_W1_SLAVE_DS2408=m ++CONFIG_W1_SLAVE_DS2413=m ++CONFIG_W1_SLAVE_DS2406=m ++CONFIG_W1_SLAVE_DS2423=m ++CONFIG_W1_SLAVE_DS2431=m ++CONFIG_W1_SLAVE_DS2433=m ++CONFIG_W1_SLAVE_DS2760=m ++CONFIG_W1_SLAVE_DS2780=m ++CONFIG_W1_SLAVE_DS2781=m ++CONFIG_W1_SLAVE_DS28E04=m ++CONFIG_W1_SLAVE_BQ27000=m ++CONFIG_BATTERY_DS2760=m ++CONFIG_POWER_RESET=y ++CONFIG_POWER_RESET_GPIO=y ++CONFIG_HWMON=m ++CONFIG_SENSORS_SHT21=m ++CONFIG_SENSORS_SHTC1=m ++CONFIG_THERMAL=y ++CONFIG_THERMAL_BCM2835=y ++CONFIG_WATCHDOG=y ++CONFIG_BCM2835_WDT=m ++CONFIG_UCB1400_CORE=m ++CONFIG_MFD_STMPE=y ++CONFIG_STMPE_SPI=y ++CONFIG_MFD_ARIZONA_I2C=m ++CONFIG_MFD_ARIZONA_SPI=m ++CONFIG_MFD_WM5102=y ++CONFIG_MEDIA_SUPPORT=m ++CONFIG_MEDIA_CAMERA_SUPPORT=y ++CONFIG_MEDIA_ANALOG_TV_SUPPORT=y ++CONFIG_MEDIA_DIGITAL_TV_SUPPORT=y ++CONFIG_MEDIA_RADIO_SUPPORT=y ++CONFIG_MEDIA_RC_SUPPORT=y ++CONFIG_MEDIA_CONTROLLER=y ++CONFIG_LIRC=m ++CONFIG_RC_DEVICES=y ++CONFIG_RC_ATI_REMOTE=m ++CONFIG_IR_IMON=m ++CONFIG_IR_MCEUSB=m ++CONFIG_IR_REDRAT3=m ++CONFIG_IR_STREAMZAP=m ++CONFIG_IR_IGUANA=m ++CONFIG_IR_TTUSBIR=m ++CONFIG_RC_LOOPBACK=m ++CONFIG_IR_GPIO_CIR=m ++CONFIG_MEDIA_USB_SUPPORT=y ++CONFIG_USB_VIDEO_CLASS=m ++CONFIG_USB_M5602=m ++CONFIG_USB_STV06XX=m ++CONFIG_USB_GL860=m ++CONFIG_USB_GSPCA_BENQ=m ++CONFIG_USB_GSPCA_CONEX=m ++CONFIG_USB_GSPCA_CPIA1=m ++CONFIG_USB_GSPCA_DTCS033=m ++CONFIG_USB_GSPCA_ETOMS=m ++CONFIG_USB_GSPCA_FINEPIX=m ++CONFIG_USB_GSPCA_JEILINJ=m ++CONFIG_USB_GSPCA_JL2005BCD=m ++CONFIG_USB_GSPCA_KINECT=m ++CONFIG_USB_GSPCA_KONICA=m ++CONFIG_USB_GSPCA_MARS=m ++CONFIG_USB_GSPCA_MR97310A=m ++CONFIG_USB_GSPCA_NW80X=m ++CONFIG_USB_GSPCA_OV519=m ++CONFIG_USB_GSPCA_OV534=m ++CONFIG_USB_GSPCA_OV534_9=m ++CONFIG_USB_GSPCA_PAC207=m ++CONFIG_USB_GSPCA_PAC7302=m ++CONFIG_USB_GSPCA_PAC7311=m ++CONFIG_USB_GSPCA_SE401=m ++CONFIG_USB_GSPCA_SN9C2028=m ++CONFIG_USB_GSPCA_SN9C20X=m ++CONFIG_USB_GSPCA_SONIXB=m ++CONFIG_USB_GSPCA_SONIXJ=m ++CONFIG_USB_GSPCA_SPCA500=m ++CONFIG_USB_GSPCA_SPCA501=m ++CONFIG_USB_GSPCA_SPCA505=m ++CONFIG_USB_GSPCA_SPCA506=m ++CONFIG_USB_GSPCA_SPCA508=m ++CONFIG_USB_GSPCA_SPCA561=m ++CONFIG_USB_GSPCA_SPCA1528=m ++CONFIG_USB_GSPCA_SQ905=m ++CONFIG_USB_GSPCA_SQ905C=m ++CONFIG_USB_GSPCA_SQ930X=m ++CONFIG_USB_GSPCA_STK014=m ++CONFIG_USB_GSPCA_STK1135=m ++CONFIG_USB_GSPCA_STV0680=m ++CONFIG_USB_GSPCA_SUNPLUS=m ++CONFIG_USB_GSPCA_T613=m ++CONFIG_USB_GSPCA_TOPRO=m ++CONFIG_USB_GSPCA_TV8532=m ++CONFIG_USB_GSPCA_VC032X=m ++CONFIG_USB_GSPCA_VICAM=m ++CONFIG_USB_GSPCA_XIRLINK_CIT=m ++CONFIG_USB_GSPCA_ZC3XX=m ++CONFIG_USB_PWC=m ++CONFIG_VIDEO_CPIA2=m ++CONFIG_USB_ZR364XX=m ++CONFIG_USB_STKWEBCAM=m ++CONFIG_USB_S2255=m ++CONFIG_VIDEO_USBTV=m ++CONFIG_VIDEO_PVRUSB2=m ++CONFIG_VIDEO_HDPVR=m ++CONFIG_VIDEO_USBVISION=m ++CONFIG_VIDEO_STK1160_COMMON=m ++CONFIG_VIDEO_STK1160_AC97=y ++CONFIG_VIDEO_GO7007=m ++CONFIG_VIDEO_GO7007_USB=m ++CONFIG_VIDEO_GO7007_USB_S2250_BOARD=m ++CONFIG_VIDEO_AU0828=m ++CONFIG_VIDEO_AU0828_RC=y ++CONFIG_VIDEO_CX231XX=m ++CONFIG_VIDEO_CX231XX_ALSA=m ++CONFIG_VIDEO_CX231XX_DVB=m ++CONFIG_VIDEO_TM6000=m ++CONFIG_VIDEO_TM6000_ALSA=m ++CONFIG_VIDEO_TM6000_DVB=m ++CONFIG_DVB_USB=m ++CONFIG_DVB_USB_A800=m ++CONFIG_DVB_USB_DIBUSB_MB=m ++CONFIG_DVB_USB_DIBUSB_MB_FAULTY=y ++CONFIG_DVB_USB_DIBUSB_MC=m ++CONFIG_DVB_USB_DIB0700=m ++CONFIG_DVB_USB_UMT_010=m ++CONFIG_DVB_USB_CXUSB=m ++CONFIG_DVB_USB_M920X=m ++CONFIG_DVB_USB_DIGITV=m ++CONFIG_DVB_USB_VP7045=m ++CONFIG_DVB_USB_VP702X=m ++CONFIG_DVB_USB_GP8PSK=m ++CONFIG_DVB_USB_NOVA_T_USB2=m ++CONFIG_DVB_USB_TTUSB2=m ++CONFIG_DVB_USB_DTT200U=m ++CONFIG_DVB_USB_OPERA1=m ++CONFIG_DVB_USB_AF9005=m ++CONFIG_DVB_USB_AF9005_REMOTE=m ++CONFIG_DVB_USB_PCTV452E=m ++CONFIG_DVB_USB_DW2102=m ++CONFIG_DVB_USB_CINERGY_T2=m ++CONFIG_DVB_USB_DTV5100=m ++CONFIG_DVB_USB_FRIIO=m ++CONFIG_DVB_USB_AZ6027=m ++CONFIG_DVB_USB_TECHNISAT_USB2=m ++CONFIG_DVB_USB_V2=m ++CONFIG_DVB_USB_AF9015=m ++CONFIG_DVB_USB_AF9035=m ++CONFIG_DVB_USB_ANYSEE=m ++CONFIG_DVB_USB_AU6610=m ++CONFIG_DVB_USB_AZ6007=m ++CONFIG_DVB_USB_CE6230=m ++CONFIG_DVB_USB_EC168=m ++CONFIG_DVB_USB_GL861=m ++CONFIG_DVB_USB_LME2510=m ++CONFIG_DVB_USB_MXL111SF=m ++CONFIG_DVB_USB_RTL28XXU=m ++CONFIG_DVB_USB_DVBSKY=m ++CONFIG_SMS_USB_DRV=m ++CONFIG_DVB_B2C2_FLEXCOP_USB=m ++CONFIG_DVB_AS102=m ++CONFIG_VIDEO_EM28XX=m ++CONFIG_VIDEO_EM28XX_V4L2=m ++CONFIG_VIDEO_EM28XX_ALSA=m ++CONFIG_VIDEO_EM28XX_DVB=m ++CONFIG_V4L_PLATFORM_DRIVERS=y ++CONFIG_VIDEO_BCM2835=y ++CONFIG_VIDEO_BCM2835_MMAL=m ++CONFIG_RADIO_SI470X=y ++CONFIG_USB_SI470X=m ++CONFIG_I2C_SI470X=m ++CONFIG_RADIO_SI4713=m ++CONFIG_I2C_SI4713=m ++CONFIG_USB_MR800=m ++CONFIG_USB_DSBR=m ++CONFIG_RADIO_SHARK=m ++CONFIG_RADIO_SHARK2=m ++CONFIG_USB_KEENE=m ++CONFIG_USB_MA901=m ++CONFIG_RADIO_TEA5764=m ++CONFIG_RADIO_SAA7706H=m ++CONFIG_RADIO_TEF6862=m ++CONFIG_RADIO_WL1273=m ++CONFIG_RADIO_WL128X=m ++# CONFIG_MEDIA_SUBDRV_AUTOSELECT is not set ++CONFIG_VIDEO_UDA1342=m ++CONFIG_VIDEO_SONY_BTF_MPX=m ++CONFIG_VIDEO_TVP5150=m ++CONFIG_VIDEO_TW2804=m ++CONFIG_VIDEO_TW9903=m ++CONFIG_VIDEO_TW9906=m ++CONFIG_VIDEO_OV7640=m ++CONFIG_VIDEO_MT9V011=m ++CONFIG_DRM=m ++CONFIG_DRM_LOAD_EDID_FIRMWARE=y ++CONFIG_DRM_UDL=m ++CONFIG_DRM_VC4=m ++CONFIG_FB=y ++CONFIG_FB_BCM2708=y ++CONFIG_FB_UDL=m ++CONFIG_FB_SSD1307=m ++CONFIG_FB_RPISENSE=m ++# CONFIG_BACKLIGHT_GENERIC is not set ++CONFIG_BACKLIGHT_RPI=m ++CONFIG_BACKLIGHT_GPIO=m ++CONFIG_FRAMEBUFFER_CONSOLE=y ++CONFIG_LOGO=y ++# CONFIG_LOGO_LINUX_MONO is not set ++# CONFIG_LOGO_LINUX_VGA16 is not set ++CONFIG_SOUND=y ++CONFIG_SND=m ++CONFIG_SND_SEQUENCER=m ++CONFIG_SND_SEQ_DUMMY=m ++CONFIG_SND_MIXER_OSS=m ++CONFIG_SND_PCM_OSS=m ++CONFIG_SND_SEQUENCER_OSS=y ++CONFIG_SND_HRTIMER=m ++CONFIG_SND_DUMMY=m ++CONFIG_SND_ALOOP=m ++CONFIG_SND_VIRMIDI=m ++CONFIG_SND_MTPAV=m ++CONFIG_SND_SERIAL_U16550=m ++CONFIG_SND_MPU401=m ++CONFIG_SND_BCM2835=m ++CONFIG_SND_USB_AUDIO=m ++CONFIG_SND_USB_UA101=m ++CONFIG_SND_USB_CAIAQ=m ++CONFIG_SND_USB_CAIAQ_INPUT=y ++CONFIG_SND_USB_6FIRE=m ++CONFIG_SND_SOC=m ++CONFIG_SND_BCM2835_SOC_I2S=m ++CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC=m ++CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS=m ++CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI=m ++CONFIG_SND_BCM2708_SOC_HIFIBERRY_AMP=m ++CONFIG_SND_BCM2708_SOC_RPI_DAC=m ++CONFIG_SND_BCM2708_SOC_RPI_PROTO=m ++CONFIG_SND_BCM2708_SOC_BOOMBERRY_DAC=m ++CONFIG_SND_BCM2708_SOC_BOOMBERRY_DIGI=m ++CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC=m ++CONFIG_SND_BCM2708_SOC_RASPIDAC3=m ++CONFIG_SND_BCM2708_SOC_ADAU1977_ADC=m ++CONFIG_SND_AUDIOINJECTOR_PI_SOUNDCARD=m ++CONFIG_SND_SOC_ADAU1701=m ++CONFIG_SND_SOC_WM8804_I2C=m ++CONFIG_SND_SIMPLE_CARD=m ++CONFIG_SOUND_PRIME=m ++CONFIG_HIDRAW=y ++CONFIG_UHID=m ++CONFIG_HID_A4TECH=m ++CONFIG_HID_ACRUX=m ++CONFIG_HID_APPLE=m ++CONFIG_HID_BELKIN=m ++CONFIG_HID_BETOP_FF=m ++CONFIG_HID_CHERRY=m ++CONFIG_HID_CHICONY=m ++CONFIG_HID_CYPRESS=m ++CONFIG_HID_DRAGONRISE=m ++CONFIG_HID_EMS_FF=m ++CONFIG_HID_ELECOM=m ++CONFIG_HID_ELO=m ++CONFIG_HID_EZKEY=m ++CONFIG_HID_HOLTEK=m ++CONFIG_HID_KEYTOUCH=m ++CONFIG_HID_KYE=m ++CONFIG_HID_UCLOGIC=m ++CONFIG_HID_WALTOP=m ++CONFIG_HID_GYRATION=m ++CONFIG_HID_TWINHAN=m ++CONFIG_HID_KENSINGTON=m ++CONFIG_HID_LCPOWER=m ++CONFIG_HID_LOGITECH=m ++CONFIG_HID_LOGITECH_DJ=m ++CONFIG_LOGITECH_FF=y ++CONFIG_LOGIRUMBLEPAD2_FF=y ++CONFIG_LOGIG940_FF=y ++CONFIG_HID_MAGICMOUSE=m ++CONFIG_HID_MICROSOFT=m ++CONFIG_HID_MONTEREY=m ++CONFIG_HID_MULTITOUCH=m ++CONFIG_HID_NTRIG=m ++CONFIG_HID_ORTEK=m ++CONFIG_HID_PANTHERLORD=m ++CONFIG_HID_PETALYNX=m ++CONFIG_HID_PICOLCD=m ++CONFIG_HID_ROCCAT=m ++CONFIG_HID_SAMSUNG=m ++CONFIG_HID_SONY=m ++CONFIG_HID_SPEEDLINK=m ++CONFIG_HID_SUNPLUS=m ++CONFIG_HID_GREENASIA=m ++CONFIG_HID_SMARTJOYPLUS=m ++CONFIG_HID_TOPSEED=m ++CONFIG_HID_THINGM=m ++CONFIG_HID_THRUSTMASTER=m ++CONFIG_HID_WACOM=m ++CONFIG_HID_WIIMOTE=m ++CONFIG_HID_XINMO=m ++CONFIG_HID_ZEROPLUS=m ++CONFIG_HID_ZYDACRON=m ++CONFIG_HID_PID=y ++CONFIG_USB_HIDDEV=y ++CONFIG_USB=y ++CONFIG_USB_ANNOUNCE_NEW_DEVICES=y ++CONFIG_USB_MON=m ++CONFIG_USB_DWCOTG=y ++CONFIG_USB_PRINTER=m ++CONFIG_USB_STORAGE=y ++CONFIG_USB_STORAGE_REALTEK=m ++CONFIG_USB_STORAGE_DATAFAB=m ++CONFIG_USB_STORAGE_FREECOM=m ++CONFIG_USB_STORAGE_ISD200=m ++CONFIG_USB_STORAGE_USBAT=m ++CONFIG_USB_STORAGE_SDDR09=m ++CONFIG_USB_STORAGE_SDDR55=m ++CONFIG_USB_STORAGE_JUMPSHOT=m ++CONFIG_USB_STORAGE_ALAUDA=m ++CONFIG_USB_STORAGE_ONETOUCH=m ++CONFIG_USB_STORAGE_KARMA=m ++CONFIG_USB_STORAGE_CYPRESS_ATACB=m ++CONFIG_USB_STORAGE_ENE_UB6250=m ++CONFIG_USB_MDC800=m ++CONFIG_USB_MICROTEK=m ++CONFIG_USBIP_CORE=m ++CONFIG_USBIP_VHCI_HCD=m ++CONFIG_USBIP_HOST=m ++CONFIG_USB_DWC2=m ++CONFIG_USB_SERIAL=m ++CONFIG_USB_SERIAL_GENERIC=y ++CONFIG_USB_SERIAL_AIRCABLE=m ++CONFIG_USB_SERIAL_ARK3116=m ++CONFIG_USB_SERIAL_BELKIN=m ++CONFIG_USB_SERIAL_CH341=m ++CONFIG_USB_SERIAL_WHITEHEAT=m ++CONFIG_USB_SERIAL_DIGI_ACCELEPORT=m ++CONFIG_USB_SERIAL_CP210X=m ++CONFIG_USB_SERIAL_CYPRESS_M8=m ++CONFIG_USB_SERIAL_EMPEG=m ++CONFIG_USB_SERIAL_FTDI_SIO=m ++CONFIG_USB_SERIAL_VISOR=m ++CONFIG_USB_SERIAL_IPAQ=m ++CONFIG_USB_SERIAL_IR=m ++CONFIG_USB_SERIAL_EDGEPORT=m ++CONFIG_USB_SERIAL_EDGEPORT_TI=m ++CONFIG_USB_SERIAL_F81232=m ++CONFIG_USB_SERIAL_GARMIN=m ++CONFIG_USB_SERIAL_IPW=m ++CONFIG_USB_SERIAL_IUU=m ++CONFIG_USB_SERIAL_KEYSPAN_PDA=m ++CONFIG_USB_SERIAL_KEYSPAN=m ++CONFIG_USB_SERIAL_KLSI=m ++CONFIG_USB_SERIAL_KOBIL_SCT=m ++CONFIG_USB_SERIAL_MCT_U232=m ++CONFIG_USB_SERIAL_METRO=m ++CONFIG_USB_SERIAL_MOS7720=m ++CONFIG_USB_SERIAL_MOS7840=m ++CONFIG_USB_SERIAL_NAVMAN=m ++CONFIG_USB_SERIAL_PL2303=m ++CONFIG_USB_SERIAL_OTI6858=m ++CONFIG_USB_SERIAL_QCAUX=m ++CONFIG_USB_SERIAL_QUALCOMM=m ++CONFIG_USB_SERIAL_SPCP8X5=m ++CONFIG_USB_SERIAL_SAFE=m ++CONFIG_USB_SERIAL_SIERRAWIRELESS=m ++CONFIG_USB_SERIAL_SYMBOL=m ++CONFIG_USB_SERIAL_TI=m ++CONFIG_USB_SERIAL_CYBERJACK=m ++CONFIG_USB_SERIAL_XIRCOM=m ++CONFIG_USB_SERIAL_OPTION=m ++CONFIG_USB_SERIAL_OMNINET=m ++CONFIG_USB_SERIAL_OPTICON=m ++CONFIG_USB_SERIAL_XSENS_MT=m ++CONFIG_USB_SERIAL_WISHBONE=m ++CONFIG_USB_SERIAL_SSU100=m ++CONFIG_USB_SERIAL_QT2=m ++CONFIG_USB_SERIAL_DEBUG=m ++CONFIG_USB_EMI62=m ++CONFIG_USB_EMI26=m ++CONFIG_USB_ADUTUX=m ++CONFIG_USB_SEVSEG=m ++CONFIG_USB_RIO500=m ++CONFIG_USB_LEGOTOWER=m ++CONFIG_USB_LCD=m ++CONFIG_USB_LED=m ++CONFIG_USB_CYPRESS_CY7C63=m ++CONFIG_USB_CYTHERM=m ++CONFIG_USB_IDMOUSE=m ++CONFIG_USB_FTDI_ELAN=m ++CONFIG_USB_APPLEDISPLAY=m ++CONFIG_USB_LD=m ++CONFIG_USB_TRANCEVIBRATOR=m ++CONFIG_USB_IOWARRIOR=m ++CONFIG_USB_TEST=m ++CONFIG_USB_ISIGHTFW=m ++CONFIG_USB_YUREX=m ++CONFIG_USB_ATM=m ++CONFIG_USB_SPEEDTOUCH=m ++CONFIG_USB_CXACRU=m ++CONFIG_USB_UEAGLEATM=m ++CONFIG_USB_XUSBATM=m ++CONFIG_USB_GADGET=m ++CONFIG_USB_ZERO=m ++CONFIG_USB_AUDIO=m ++CONFIG_USB_ETH=m ++CONFIG_USB_GADGETFS=m ++CONFIG_USB_MASS_STORAGE=m ++CONFIG_USB_G_SERIAL=m ++CONFIG_USB_MIDI_GADGET=m ++CONFIG_USB_G_PRINTER=m ++CONFIG_USB_CDC_COMPOSITE=m ++CONFIG_USB_G_ACM_MS=m ++CONFIG_USB_G_MULTI=m ++CONFIG_USB_G_HID=m ++CONFIG_USB_G_WEBCAM=m ++CONFIG_MMC=y ++CONFIG_MMC_BLOCK_MINORS=32 ++CONFIG_MMC_BCM2835=y ++CONFIG_MMC_BCM2835_DMA=y ++CONFIG_MMC_BCM2835_SDHOST=y ++CONFIG_MMC_SDHCI=y ++CONFIG_MMC_SDHCI_PLTFM=y ++CONFIG_MMC_SPI=m ++CONFIG_LEDS_CLASS=y ++CONFIG_LEDS_GPIO=y ++CONFIG_LEDS_TRIGGER_TIMER=y ++CONFIG_LEDS_TRIGGER_ONESHOT=y ++CONFIG_LEDS_TRIGGER_HEARTBEAT=y ++CONFIG_LEDS_TRIGGER_BACKLIGHT=y ++CONFIG_LEDS_TRIGGER_CPU=y ++CONFIG_LEDS_TRIGGER_GPIO=y ++CONFIG_LEDS_TRIGGER_DEFAULT_ON=y ++CONFIG_LEDS_TRIGGER_TRANSIENT=m ++CONFIG_LEDS_TRIGGER_CAMERA=m ++CONFIG_LEDS_TRIGGER_INPUT=y ++CONFIG_RTC_CLASS=y ++# CONFIG_RTC_HCTOSYS is not set ++CONFIG_RTC_DRV_DS1307=m ++CONFIG_RTC_DRV_DS1374=m ++CONFIG_RTC_DRV_DS1672=m ++CONFIG_RTC_DRV_MAX6900=m ++CONFIG_RTC_DRV_RS5C372=m ++CONFIG_RTC_DRV_ISL1208=m ++CONFIG_RTC_DRV_ISL12022=m ++CONFIG_RTC_DRV_ISL12057=m ++CONFIG_RTC_DRV_X1205=m ++CONFIG_RTC_DRV_PCF8523=m ++CONFIG_RTC_DRV_PCF8563=m ++CONFIG_RTC_DRV_PCF8583=m ++CONFIG_RTC_DRV_M41T80=m ++CONFIG_RTC_DRV_BQ32K=m ++CONFIG_RTC_DRV_S35390A=m ++CONFIG_RTC_DRV_FM3130=m ++CONFIG_RTC_DRV_RX8581=m ++CONFIG_RTC_DRV_RX8025=m ++CONFIG_RTC_DRV_EM3027=m ++CONFIG_RTC_DRV_RV3029C2=m ++CONFIG_RTC_DRV_M41T93=m ++CONFIG_RTC_DRV_M41T94=m ++CONFIG_RTC_DRV_DS1305=m ++CONFIG_RTC_DRV_DS1390=m ++CONFIG_RTC_DRV_R9701=m ++CONFIG_RTC_DRV_RX4581=m ++CONFIG_RTC_DRV_RS5C348=m ++CONFIG_RTC_DRV_MAX6902=m ++CONFIG_RTC_DRV_PCF2123=m ++CONFIG_RTC_DRV_DS3232=m ++CONFIG_RTC_DRV_PCF2127=m ++CONFIG_DMADEVICES=y ++CONFIG_DMA_BCM2835=y ++CONFIG_DMA_BCM2708=y ++CONFIG_UIO=m ++CONFIG_UIO_PDRV_GENIRQ=m ++CONFIG_STAGING=y ++CONFIG_PRISM2_USB=m ++CONFIG_R8712U=m ++CONFIG_R8188EU=m ++CONFIG_R8723AU=m ++CONFIG_VT6656=m ++CONFIG_SPEAKUP=m ++CONFIG_SPEAKUP_SYNTH_SOFT=m ++CONFIG_STAGING_MEDIA=y ++CONFIG_LIRC_STAGING=y ++CONFIG_LIRC_IMON=m ++CONFIG_LIRC_RPI=m ++CONFIG_LIRC_SASEM=m ++CONFIG_LIRC_SERIAL=m ++CONFIG_FB_TFT=m ++CONFIG_FB_TFT_AGM1264K_FL=m ++CONFIG_FB_TFT_BD663474=m ++CONFIG_FB_TFT_HX8340BN=m ++CONFIG_FB_TFT_HX8347D=m ++CONFIG_FB_TFT_HX8353D=m ++CONFIG_FB_TFT_ILI9163=m ++CONFIG_FB_TFT_ILI9320=m ++CONFIG_FB_TFT_ILI9325=m ++CONFIG_FB_TFT_ILI9340=m ++CONFIG_FB_TFT_ILI9341=m ++CONFIG_FB_TFT_ILI9481=m ++CONFIG_FB_TFT_ILI9486=m ++CONFIG_FB_TFT_PCD8544=m ++CONFIG_FB_TFT_RA8875=m ++CONFIG_FB_TFT_S6D02A1=m ++CONFIG_FB_TFT_S6D1121=m ++CONFIG_FB_TFT_SSD1289=m ++CONFIG_FB_TFT_SSD1306=m ++CONFIG_FB_TFT_SSD1331=m ++CONFIG_FB_TFT_SSD1351=m ++CONFIG_FB_TFT_ST7735R=m ++CONFIG_FB_TFT_TINYLCD=m ++CONFIG_FB_TFT_TLS8204=m ++CONFIG_FB_TFT_UC1701=m ++CONFIG_FB_TFT_UPD161704=m ++CONFIG_FB_TFT_WATTEROTT=m ++CONFIG_FB_FLEX=m ++CONFIG_FB_TFT_FBTFT_DEVICE=m ++CONFIG_MAILBOX=y ++CONFIG_BCM2835_MBOX=y ++# CONFIG_IOMMU_SUPPORT is not set ++CONFIG_RASPBERRYPI_POWER=y ++CONFIG_EXTCON=m ++CONFIG_EXTCON_ARIZONA=m ++CONFIG_IIO=m ++CONFIG_IIO_BUFFER=y ++CONFIG_IIO_BUFFER_CB=m ++CONFIG_IIO_KFIFO_BUF=m ++CONFIG_MCP320X=m ++CONFIG_MCP3422=m ++CONFIG_DHT11=m ++CONFIG_PWM_BCM2835=m ++CONFIG_PWM_PCA9685=m ++CONFIG_RASPBERRYPI_FIRMWARE=y ++CONFIG_EXT4_FS=y ++CONFIG_EXT4_FS_POSIX_ACL=y ++CONFIG_EXT4_FS_SECURITY=y ++CONFIG_REISERFS_FS=m ++CONFIG_REISERFS_FS_XATTR=y ++CONFIG_REISERFS_FS_POSIX_ACL=y ++CONFIG_REISERFS_FS_SECURITY=y ++CONFIG_JFS_FS=m ++CONFIG_JFS_POSIX_ACL=y ++CONFIG_JFS_SECURITY=y ++CONFIG_JFS_STATISTICS=y ++CONFIG_XFS_FS=m ++CONFIG_XFS_QUOTA=y ++CONFIG_XFS_POSIX_ACL=y ++CONFIG_XFS_RT=y ++CONFIG_GFS2_FS=m ++CONFIG_OCFS2_FS=m ++CONFIG_BTRFS_FS=m ++CONFIG_BTRFS_FS_POSIX_ACL=y ++CONFIG_NILFS2_FS=m ++CONFIG_F2FS_FS=y ++CONFIG_FANOTIFY=y ++CONFIG_QFMT_V1=m ++CONFIG_QFMT_V2=m ++CONFIG_AUTOFS4_FS=y ++CONFIG_FUSE_FS=m ++CONFIG_CUSE=m ++CONFIG_OVERLAY_FS=m ++CONFIG_FSCACHE=y ++CONFIG_FSCACHE_STATS=y ++CONFIG_FSCACHE_HISTOGRAM=y ++CONFIG_CACHEFILES=y ++CONFIG_ISO9660_FS=m ++CONFIG_JOLIET=y ++CONFIG_ZISOFS=y ++CONFIG_UDF_FS=m ++CONFIG_MSDOS_FS=y ++CONFIG_VFAT_FS=y ++CONFIG_FAT_DEFAULT_IOCHARSET="ascii" ++CONFIG_NTFS_FS=m ++CONFIG_NTFS_RW=y ++CONFIG_TMPFS=y ++CONFIG_TMPFS_POSIX_ACL=y ++CONFIG_ECRYPT_FS=m ++CONFIG_HFS_FS=m ++CONFIG_HFSPLUS_FS=m ++CONFIG_JFFS2_FS=m ++CONFIG_JFFS2_SUMMARY=y ++CONFIG_UBIFS_FS=m ++CONFIG_SQUASHFS=m ++CONFIG_SQUASHFS_XATTR=y ++CONFIG_SQUASHFS_LZO=y ++CONFIG_SQUASHFS_XZ=y ++CONFIG_NFS_FS=y ++CONFIG_NFS_V3_ACL=y ++CONFIG_NFS_V4=y ++CONFIG_NFS_SWAP=y ++CONFIG_ROOT_NFS=y ++CONFIG_NFS_FSCACHE=y ++CONFIG_NFSD=m ++CONFIG_NFSD_V3_ACL=y ++CONFIG_NFSD_V4=y ++CONFIG_CIFS=m ++CONFIG_CIFS_WEAK_PW_HASH=y ++CONFIG_CIFS_UPCALL=y ++CONFIG_CIFS_XATTR=y ++CONFIG_CIFS_POSIX=y ++CONFIG_CIFS_ACL=y ++CONFIG_CIFS_DFS_UPCALL=y ++CONFIG_CIFS_SMB2=y ++CONFIG_CIFS_FSCACHE=y ++CONFIG_9P_FS=m ++CONFIG_9P_FS_POSIX_ACL=y ++CONFIG_NLS_DEFAULT="utf8" ++CONFIG_NLS_CODEPAGE_437=y ++CONFIG_NLS_CODEPAGE_737=m ++CONFIG_NLS_CODEPAGE_775=m ++CONFIG_NLS_CODEPAGE_850=m ++CONFIG_NLS_CODEPAGE_852=m ++CONFIG_NLS_CODEPAGE_855=m ++CONFIG_NLS_CODEPAGE_857=m ++CONFIG_NLS_CODEPAGE_860=m ++CONFIG_NLS_CODEPAGE_861=m ++CONFIG_NLS_CODEPAGE_862=m ++CONFIG_NLS_CODEPAGE_863=m ++CONFIG_NLS_CODEPAGE_864=m ++CONFIG_NLS_CODEPAGE_865=m ++CONFIG_NLS_CODEPAGE_866=m ++CONFIG_NLS_CODEPAGE_869=m ++CONFIG_NLS_CODEPAGE_936=m ++CONFIG_NLS_CODEPAGE_950=m ++CONFIG_NLS_CODEPAGE_932=m ++CONFIG_NLS_CODEPAGE_949=m ++CONFIG_NLS_CODEPAGE_874=m ++CONFIG_NLS_ISO8859_8=m ++CONFIG_NLS_CODEPAGE_1250=m ++CONFIG_NLS_CODEPAGE_1251=m ++CONFIG_NLS_ASCII=y ++CONFIG_NLS_ISO8859_1=m ++CONFIG_NLS_ISO8859_2=m ++CONFIG_NLS_ISO8859_3=m ++CONFIG_NLS_ISO8859_4=m ++CONFIG_NLS_ISO8859_5=m ++CONFIG_NLS_ISO8859_6=m ++CONFIG_NLS_ISO8859_7=m ++CONFIG_NLS_ISO8859_9=m ++CONFIG_NLS_ISO8859_13=m ++CONFIG_NLS_ISO8859_14=m ++CONFIG_NLS_ISO8859_15=m ++CONFIG_NLS_KOI8_R=m ++CONFIG_NLS_KOI8_U=m ++CONFIG_DLM=m ++CONFIG_PRINTK_TIME=y ++CONFIG_BOOT_PRINTK_DELAY=y ++CONFIG_DEBUG_MEMORY_INIT=y ++CONFIG_DETECT_HUNG_TASK=y ++CONFIG_TIMER_STATS=y ++CONFIG_LATENCYTOP=y ++CONFIG_IRQSOFF_TRACER=y ++CONFIG_SCHED_TRACER=y ++CONFIG_STACK_TRACER=y ++CONFIG_BLK_DEV_IO_TRACE=y ++# CONFIG_KPROBE_EVENT is not set ++CONFIG_FUNCTION_PROFILER=y ++CONFIG_KGDB=y ++CONFIG_KGDB_KDB=y ++CONFIG_KDB_KEYBOARD=y ++CONFIG_CRYPTO_USER=m ++CONFIG_CRYPTO_CRYPTD=m ++CONFIG_CRYPTO_CBC=y ++CONFIG_CRYPTO_CTS=m ++CONFIG_CRYPTO_XTS=m ++CONFIG_CRYPTO_XCBC=m ++CONFIG_CRYPTO_SHA512=m ++CONFIG_CRYPTO_TGR192=m ++CONFIG_CRYPTO_WP512=m ++CONFIG_CRYPTO_CAST5=m ++CONFIG_CRYPTO_DES=y ++CONFIG_CRYPTO_USER_API_SKCIPHER=m ++# CONFIG_CRYPTO_HW is not set ++CONFIG_ARM_CRYPTO=y ++CONFIG_CRYPTO_SHA1_ARM=m ++CONFIG_CRYPTO_AES_ARM=m ++CONFIG_CRC_ITU_T=y ++CONFIG_LIBCRC32C=y + +From 62dcca217ece326d398b5a2ded691690d01014f1 Mon Sep 17 00:00:00 2001 +From: Gordon Hollingworth <gordon@raspberrypi.org> +Date: Tue, 12 May 2015 14:47:56 +0100 +Subject: [PATCH 078/112] rpi-ft5406: Add touchscreen driver for pi LCD display + +Fix driver detection failure Check that the buffer response is non-zero meaning the touchscreen was detected + +rpi-ft5406: Use firmware API +--- + drivers/input/touchscreen/Kconfig | 7 + + drivers/input/touchscreen/Makefile | 1 + + drivers/input/touchscreen/rpi-ft5406.c | 246 +++++++++++++++++++++++++++++++++ + 3 files changed, 254 insertions(+) + create mode 100644 drivers/input/touchscreen/rpi-ft5406.c + +diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig +index 8ecdc38..1e4e7a0 100644 +--- a/drivers/input/touchscreen/Kconfig ++++ b/drivers/input/touchscreen/Kconfig +@@ -630,6 +630,13 @@ config TOUCHSCREEN_EDT_FT5X06 + To compile this driver as a module, choose M here: the + module will be called edt-ft5x06. + ++config TOUCHSCREEN_RPI_FT5406 ++ tristate "Raspberry Pi FT5406 driver" ++ depends on RASPBERRYPI_FIRMWARE ++ help ++ Say Y here to enable the Raspberry Pi memory based FT5406 device ++ ++ + config TOUCHSCREEN_MIGOR + tristate "Renesas MIGO-R touchscreen" + depends on SH_MIGOR && I2C +diff --git a/drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile +index f42975e..92590b3 100644 +--- a/drivers/input/touchscreen/Makefile ++++ b/drivers/input/touchscreen/Makefile +@@ -29,6 +29,7 @@ obj-$(CONFIG_TOUCHSCREEN_DA9034) += da9034-ts.o + obj-$(CONFIG_TOUCHSCREEN_DA9052) += da9052_tsi.o + obj-$(CONFIG_TOUCHSCREEN_DYNAPRO) += dynapro.o + obj-$(CONFIG_TOUCHSCREEN_EDT_FT5X06) += edt-ft5x06.o ++obj-$(CONFIG_TOUCHSCREEN_RPI_FT5406) += rpi-ft5406.o + obj-$(CONFIG_TOUCHSCREEN_HAMPSHIRE) += hampshire.o + obj-$(CONFIG_TOUCHSCREEN_GUNZE) += gunze.o + obj-$(CONFIG_TOUCHSCREEN_EETI) += eeti_ts.o +diff --git a/drivers/input/touchscreen/rpi-ft5406.c b/drivers/input/touchscreen/rpi-ft5406.c +new file mode 100644 +index 0000000..b27dbee +--- /dev/null ++++ b/drivers/input/touchscreen/rpi-ft5406.c +@@ -0,0 +1,246 @@ ++/* ++ * Driver for memory based ft5406 touchscreen ++ * ++ * Copyright (C) 2015 Raspberry Pi ++ * ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 as ++ * published by the Free Software Foundation. ++ */ ++ ++ ++#include <linux/module.h> ++#include <linux/interrupt.h> ++#include <linux/input.h> ++#include <linux/irq.h> ++#include <linux/delay.h> ++#include <linux/slab.h> ++#include <linux/bitops.h> ++#include <linux/input/mt.h> ++#include <linux/kthread.h> ++#include <linux/platform_device.h> ++#include <asm/io.h> ++#include <soc/bcm2835/raspberrypi-firmware.h> ++ ++#define MAXIMUM_SUPPORTED_POINTS 10 ++struct ft5406_regs { ++ uint8_t device_mode; ++ uint8_t gesture_id; ++ uint8_t num_points; ++ struct ft5406_touch { ++ uint8_t xh; ++ uint8_t xl; ++ uint8_t yh; ++ uint8_t yl; ++ uint8_t res1; ++ uint8_t res2; ++ } point[MAXIMUM_SUPPORTED_POINTS]; ++}; ++ ++#define SCREEN_WIDTH 800 ++#define SCREEN_HEIGHT 480 ++ ++struct ft5406 { ++ struct platform_device * pdev; ++ struct input_dev * input_dev; ++ void __iomem * ts_base; ++ struct ft5406_regs * regs; ++ struct task_struct * thread; ++}; ++ ++/* Thread to poll for touchscreen events ++ * ++ * This thread polls the memory based register copy of the ft5406 registers ++ * using the number of points register to know whether the copy has been ++ * updated (we write 99 to the memory copy, the GPU will write between ++ * 0 - 10 points) ++ */ ++static int ft5406_thread(void *arg) ++{ ++ struct ft5406 *ts = (struct ft5406 *) arg; ++ struct ft5406_regs regs; ++ int known_ids = 0; ++ ++ while(!kthread_should_stop()) ++ { ++ // 60fps polling ++ msleep_interruptible(17); ++ memcpy_fromio(&regs, ts->regs, sizeof(*ts->regs)); ++ writel(99, &ts->regs->num_points); ++ // Do not output if theres no new information (num_points is 99) ++ // or we have no touch points and don't need to release any ++ if(!(regs.num_points == 99 || (regs.num_points == 0 && known_ids == 0))) ++ { ++ int i; ++ int modified_ids = 0, released_ids; ++ for(i = 0; i < regs.num_points; i++) ++ { ++ int x = (((int) regs.point[i].xh & 0xf) << 8) + regs.point[i].xl; ++ int y = (((int) regs.point[i].yh & 0xf) << 8) + regs.point[i].yl; ++ int touchid = (regs.point[i].yh >> 4) & 0xf; ++ ++ modified_ids |= 1 << touchid; ++ ++ if(!((1 << touchid) & known_ids)) ++ dev_dbg(&ts->pdev->dev, "x = %d, y = %d, touchid = %d\n", x, y, touchid); ++ ++ input_mt_slot(ts->input_dev, touchid); ++ input_mt_report_slot_state(ts->input_dev, MT_TOOL_FINGER, 1); ++ ++ input_report_abs(ts->input_dev, ABS_MT_POSITION_X, x); ++ input_report_abs(ts->input_dev, ABS_MT_POSITION_Y, y); ++ ++ } ++ ++ released_ids = known_ids & ~modified_ids; ++ for(i = 0; released_ids && i < MAXIMUM_SUPPORTED_POINTS; i++) ++ { ++ if(released_ids & (1<<i)) ++ { ++ dev_dbg(&ts->pdev->dev, "Released %d, known = %x modified = %x\n", i, known_ids, modified_ids); ++ input_mt_slot(ts->input_dev, i); ++ input_mt_report_slot_state(ts->input_dev, MT_TOOL_FINGER, 0); ++ modified_ids &= ~(1 << i); ++ } ++ } ++ known_ids = modified_ids; ++ ++ input_mt_report_pointer_emulation(ts->input_dev, true); ++ input_sync(ts->input_dev); ++ } ++ ++ } ++ ++ return 0; ++} ++ ++static int ft5406_probe(struct platform_device *pdev) ++{ ++ int ret; ++ struct input_dev * input_dev = input_allocate_device(); ++ struct ft5406 * ts; ++ struct device_node *fw_node; ++ struct rpi_firmware *fw; ++ u32 touchbuf; ++ ++ dev_info(&pdev->dev, "Probing device\n"); ++ ++ fw_node = of_parse_phandle(pdev->dev.of_node, "firmware", 0); ++ if (!fw_node) { ++ dev_err(&pdev->dev, "Missing firmware node\n"); ++ return -ENOENT; ++ } ++ ++ fw = rpi_firmware_get(fw_node); ++ if (!fw) ++ return -EPROBE_DEFER; ++ ++ ret = rpi_firmware_property(fw, RPI_FIRMWARE_FRAMEBUFFER_GET_TOUCHBUF, ++ &touchbuf, sizeof(touchbuf)); ++ if (ret) { ++ dev_err(&pdev->dev, "Failed to get touch buffer\n"); ++ return ret; ++ } ++ ++ if (!touchbuf) { ++ dev_err(&pdev->dev, "Touchscreen not detected\n"); ++ return -ENODEV; ++ } ++ ++ dev_dbg(&pdev->dev, "Got TS buffer 0x%x\n", touchbuf); ++ ++ ts = kzalloc(sizeof(struct ft5406), GFP_KERNEL); ++ ++ if (!ts || !input_dev) { ++ ret = -ENOMEM; ++ dev_err(&pdev->dev, "Failed to allocate memory\n"); ++ return ret; ++ } ++ ts->input_dev = input_dev; ++ platform_set_drvdata(pdev, ts); ++ ts->pdev = pdev; ++ ++ input_dev->name = "FT5406 memory based driver"; ++ ++ __set_bit(EV_KEY, input_dev->evbit); ++ __set_bit(EV_SYN, input_dev->evbit); ++ __set_bit(EV_ABS, input_dev->evbit); ++ ++ input_set_abs_params(input_dev, ABS_MT_POSITION_X, 0, ++ SCREEN_WIDTH, 0, 0); ++ input_set_abs_params(input_dev, ABS_MT_POSITION_Y, 0, ++ SCREEN_HEIGHT, 0, 0); ++ ++ input_mt_init_slots(input_dev, MAXIMUM_SUPPORTED_POINTS, INPUT_MT_DIRECT); ++ ++ input_set_drvdata(input_dev, ts); ++ ++ ret = input_register_device(input_dev); ++ if (ret) { ++ dev_err(&pdev->dev, "could not register input device, %d\n", ++ ret); ++ return ret; ++ } ++ ++ // mmap the physical memory ++ touchbuf &= ~0xc0000000; ++ ts->ts_base = ioremap(touchbuf, sizeof(*ts->regs)); ++ if(ts->ts_base == NULL) ++ { ++ dev_err(&pdev->dev, "Failed to map physical address\n"); ++ input_unregister_device(input_dev); ++ kzfree(ts); ++ return -ENOMEM; ++ } ++ ++ ts->regs = (struct ft5406_regs *) ts->ts_base; ++ ++ // create thread to poll the touch events ++ ts->thread = kthread_run(ft5406_thread, ts, "ft5406"); ++ if(ts->thread == NULL) ++ { ++ dev_err(&pdev->dev, "Failed to create kernel thread"); ++ iounmap(ts->ts_base); ++ input_unregister_device(input_dev); ++ kzfree(ts); ++ } ++ ++ return 0; ++} ++ ++static int ft5406_remove(struct platform_device *pdev) ++{ ++ struct ft5406 *ts = (struct ft5406 *) platform_get_drvdata(pdev); ++ ++ dev_info(&pdev->dev, "Removing rpi-ft5406\n"); ++ ++ kthread_stop(ts->thread); ++ iounmap(ts->ts_base); ++ input_unregister_device(ts->input_dev); ++ kzfree(ts); ++ ++ return 0; ++} ++ ++static const struct of_device_id ft5406_match[] = { ++ { .compatible = "rpi,rpi-ft5406", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, ft5406_match); ++ ++static struct platform_driver ft5406_driver = { ++ .driver = { ++ .name = "rpi-ft5406", ++ .owner = THIS_MODULE, ++ .of_match_table = ft5406_match, ++ }, ++ .probe = ft5406_probe, ++ .remove = ft5406_remove, ++}; ++ ++module_platform_driver(ft5406_driver); ++ ++MODULE_AUTHOR("Gordon Hollingworth"); ++MODULE_DESCRIPTION("Touchscreen driver for memory based FT5406"); ++MODULE_LICENSE("GPL"); + +From d3b07af9751b03a6d60b5bcd95df067add313b78 Mon Sep 17 00:00:00 2001 +From: Phil Elwell <phil@raspberrypi.org> +Date: Mon, 13 Oct 2014 11:47:53 +0100 +Subject: [PATCH 079/112] Improve __copy_to_user and __copy_from_user + performance + +Provide a __copy_from_user that uses memcpy. On BCM2708, use +optimised memcpy/memmove/memcmp/memset implementations. + +arch/arm: Add mmiocpy/set aliases for memcpy/set + +See: https://github.com/raspberrypi/linux/issues/1082 + +copy_from_user: CPU_SW_DOMAIN_PAN compatibility + +The downstream copy_from_user acceleration must also play nice with +CONFIG_CPU_SW_DOMAIN_PAN. + +See: https://github.com/raspberrypi/linux/issues/1381 + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> +--- + arch/arm/include/asm/string.h | 5 + + arch/arm/include/asm/uaccess.h | 3 + + arch/arm/lib/Makefile | 15 +- + arch/arm/lib/arm-mem.h | 159 ++++++++++++ + arch/arm/lib/copy_from_user.S | 4 +- + arch/arm/lib/exports_rpi.c | 37 +++ + arch/arm/lib/memcmp_rpi.S | 285 +++++++++++++++++++++ + arch/arm/lib/memcpy_rpi.S | 61 +++++ + arch/arm/lib/memcpymove.h | 506 +++++++++++++++++++++++++++++++++++++ + arch/arm/lib/memmove_rpi.S | 61 +++++ + arch/arm/lib/memset_rpi.S | 123 +++++++++ + arch/arm/lib/uaccess_with_memcpy.c | 120 ++++++++- + 12 files changed, 1373 insertions(+), 6 deletions(-) + create mode 100644 arch/arm/lib/arm-mem.h + create mode 100644 arch/arm/lib/exports_rpi.c + create mode 100644 arch/arm/lib/memcmp_rpi.S + create mode 100644 arch/arm/lib/memcpy_rpi.S + create mode 100644 arch/arm/lib/memcpymove.h + create mode 100644 arch/arm/lib/memmove_rpi.S + create mode 100644 arch/arm/lib/memset_rpi.S + +diff --git a/arch/arm/include/asm/string.h b/arch/arm/include/asm/string.h +index cf4f3aa..9fe7780 100644 +--- a/arch/arm/include/asm/string.h ++++ b/arch/arm/include/asm/string.h +@@ -24,6 +24,11 @@ extern void * memchr(const void *, int, __kernel_size_t); + #define __HAVE_ARCH_MEMSET + extern void * memset(void *, int, __kernel_size_t); + ++#ifdef CONFIG_MACH_BCM2708 ++#define __HAVE_ARCH_MEMCMP ++extern int memcmp(const void *, const void *, size_t); ++#endif ++ + extern void __memzero(void *ptr, __kernel_size_t n); + + #define memset(p,v,n) \ +diff --git a/arch/arm/include/asm/uaccess.h b/arch/arm/include/asm/uaccess.h +index 35c9db8..52d3401 100644 +--- a/arch/arm/include/asm/uaccess.h ++++ b/arch/arm/include/asm/uaccess.h +@@ -493,6 +493,9 @@ do { \ + extern unsigned long __must_check + arm_copy_from_user(void *to, const void __user *from, unsigned long n); + ++extern unsigned long __must_check ++__copy_from_user_std(void *to, const void __user *from, unsigned long n); ++ + static inline unsigned long __must_check + __copy_from_user(void *to, const void __user *from, unsigned long n) + { +diff --git a/arch/arm/lib/Makefile b/arch/arm/lib/Makefile +index d8a7807..9c7dc5b 100644 +--- a/arch/arm/lib/Makefile ++++ b/arch/arm/lib/Makefile +@@ -6,9 +6,8 @@ + + lib-y := backtrace.o changebit.o csumipv6.o csumpartial.o \ + csumpartialcopy.o csumpartialcopyuser.o clearbit.o \ +- delay.o delay-loop.o findbit.o memchr.o memcpy.o \ +- memmove.o memset.o memzero.o setbit.o \ +- strchr.o strrchr.o \ ++ delay.o delay-loop.o findbit.o memchr.o memzero.o \ ++ setbit.o strchr.o strrchr.o \ + testchangebit.o testclearbit.o testsetbit.o \ + ashldi3.o ashrdi3.o lshrdi3.o muldi3.o \ + ucmpdi2.o lib1funcs.o div64.o \ +@@ -18,6 +17,16 @@ lib-y := backtrace.o changebit.o csumipv6.o csumpartial.o \ + mmu-y := clear_user.o copy_page.o getuser.o putuser.o \ + copy_from_user.o copy_to_user.o + ++# Choose optimised implementations for Raspberry Pi ++ifeq ($(CONFIG_MACH_BCM2708),y) ++ CFLAGS_uaccess_with_memcpy.o += -DCOPY_FROM_USER_THRESHOLD=1600 ++ CFLAGS_uaccess_with_memcpy.o += -DCOPY_TO_USER_THRESHOLD=672 ++ obj-$(CONFIG_MODULES) += exports_rpi.o ++ lib-y += memcpy_rpi.o memmove_rpi.o memset_rpi.o memcmp_rpi.o ++else ++ lib-y += memcpy.o memmove.o memset.o ++endif ++ + # using lib_ here won't override already available weak symbols + obj-$(CONFIG_UACCESS_WITH_MEMCPY) += uaccess_with_memcpy.o + +diff --git a/arch/arm/lib/arm-mem.h b/arch/arm/lib/arm-mem.h +new file mode 100644 +index 0000000..5d4bda1 +--- /dev/null ++++ b/arch/arm/lib/arm-mem.h +@@ -0,0 +1,159 @@ ++/* ++Copyright (c) 2013, Raspberry Pi Foundation ++Copyright (c) 2013, RISC OS Open Ltd ++All rights reserved. ++ ++Redistribution and use in source and binary forms, with or without ++modification, are permitted provided that the following conditions are met: ++ * Redistributions of source code must retain the above copyright ++ notice, this list of conditions and the following disclaimer. ++ * 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. ++ * Neither the name of the copyright holder nor the ++ names of its contributors may be used to endorse or promote products ++ derived from this software without specific prior written permission. ++ ++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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. ++*/ ++ ++.macro myfunc fname ++ .func fname ++ .global fname ++fname: ++.endm ++ ++.macro preload_leading_step1 backwards, ptr, base ++/* If the destination is already 16-byte aligned, then we need to preload ++ * between 0 and prefetch_distance (inclusive) cache lines ahead so there ++ * are no gaps when the inner loop starts. ++ */ ++ .if backwards ++ sub ptr, base, #1 ++ bic ptr, ptr, #31 ++ .else ++ bic ptr, base, #31 ++ .endif ++ .set OFFSET, 0 ++ .rept prefetch_distance+1 ++ pld [ptr, #OFFSET] ++ .if backwards ++ .set OFFSET, OFFSET-32 ++ .else ++ .set OFFSET, OFFSET+32 ++ .endif ++ .endr ++.endm ++ ++.macro preload_leading_step2 backwards, ptr, base, leading_bytes, tmp ++/* However, if the destination is not 16-byte aligned, we may need to ++ * preload one more cache line than that. The question we need to ask is: ++ * are the leading bytes more than the amount by which the source ++ * pointer will be rounded down for preloading, and if so, by how many ++ * cache lines? ++ */ ++ .if backwards ++/* Here we compare against how many bytes we are into the ++ * cache line, counting down from the highest such address. ++ * Effectively, we want to calculate ++ * leading_bytes = dst&15 ++ * cacheline_offset = 31-((src-leading_bytes-1)&31) ++ * extra_needed = leading_bytes - cacheline_offset ++ * and test if extra_needed is <= 0, or rearranging: ++ * leading_bytes + (src-leading_bytes-1)&31 <= 31 ++ */ ++ mov tmp, base, lsl #32-5 ++ sbc tmp, tmp, leading_bytes, lsl #32-5 ++ adds tmp, tmp, leading_bytes, lsl #32-5 ++ bcc 61f ++ pld [ptr, #-32*(prefetch_distance+1)] ++ .else ++/* Effectively, we want to calculate ++ * leading_bytes = (-dst)&15 ++ * cacheline_offset = (src+leading_bytes)&31 ++ * extra_needed = leading_bytes - cacheline_offset ++ * and test if extra_needed is <= 0. ++ */ ++ mov tmp, base, lsl #32-5 ++ add tmp, tmp, leading_bytes, lsl #32-5 ++ rsbs tmp, tmp, leading_bytes, lsl #32-5 ++ bls 61f ++ pld [ptr, #32*(prefetch_distance+1)] ++ .endif ++61: ++.endm ++ ++.macro preload_trailing backwards, base, remain, tmp ++ /* We need either 0, 1 or 2 extra preloads */ ++ .if backwards ++ rsb tmp, base, #0 ++ mov tmp, tmp, lsl #32-5 ++ .else ++ mov tmp, base, lsl #32-5 ++ .endif ++ adds tmp, tmp, remain, lsl #32-5 ++ adceqs tmp, tmp, #0 ++ /* The instruction above has two effects: ensures Z is only ++ * set if C was clear (so Z indicates that both shifted quantities ++ * were 0), and clears C if Z was set (so C indicates that the sum ++ * of the shifted quantities was greater and not equal to 32) */ ++ beq 82f ++ .if backwards ++ sub tmp, base, #1 ++ bic tmp, tmp, #31 ++ .else ++ bic tmp, base, #31 ++ .endif ++ bcc 81f ++ .if backwards ++ pld [tmp, #-32*(prefetch_distance+1)] ++81: ++ pld [tmp, #-32*prefetch_distance] ++ .else ++ pld [tmp, #32*(prefetch_distance+2)] ++81: ++ pld [tmp, #32*(prefetch_distance+1)] ++ .endif ++82: ++.endm ++ ++.macro preload_all backwards, narrow_case, shift, base, remain, tmp0, tmp1 ++ .if backwards ++ sub tmp0, base, #1 ++ bic tmp0, tmp0, #31 ++ pld [tmp0] ++ sub tmp1, base, remain, lsl #shift ++ .else ++ bic tmp0, base, #31 ++ pld [tmp0] ++ add tmp1, base, remain, lsl #shift ++ sub tmp1, tmp1, #1 ++ .endif ++ bic tmp1, tmp1, #31 ++ cmp tmp1, tmp0 ++ beq 92f ++ .if narrow_case ++ /* In this case, all the data fits in either 1 or 2 cache lines */ ++ pld [tmp1] ++ .else ++91: ++ .if backwards ++ sub tmp0, tmp0, #32 ++ .else ++ add tmp0, tmp0, #32 ++ .endif ++ cmp tmp0, tmp1 ++ pld [tmp0] ++ bne 91b ++ .endif ++92: ++.endm +diff --git a/arch/arm/lib/copy_from_user.S b/arch/arm/lib/copy_from_user.S +index 1512beb..3da60dd 100644 +--- a/arch/arm/lib/copy_from_user.S ++++ b/arch/arm/lib/copy_from_user.S +@@ -89,11 +89,13 @@ + + .text + +-ENTRY(arm_copy_from_user) ++ENTRY(__copy_from_user_std) ++WEAK(arm_copy_from_user) + + #include "copy_template.S" + + ENDPROC(arm_copy_from_user) ++ENDPROC(__copy_from_user_std) + + .pushsection .fixup,"ax" + .align 0 +diff --git a/arch/arm/lib/exports_rpi.c b/arch/arm/lib/exports_rpi.c +new file mode 100644 +index 0000000..1f82604 +--- /dev/null ++++ b/arch/arm/lib/exports_rpi.c +@@ -0,0 +1,37 @@ ++/** ++ * Copyright (c) 2014, Raspberry Pi (Trading) Ltd. ++ * ++ * 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, ++ * without modification. ++ * 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. ++ * 3. The names of the above-listed copyright holders may not be used ++ * to endorse or promote products derived from this software without ++ * specific prior written permission. ++ * ++ * ALTERNATIVELY, this software may be distributed under the terms of the ++ * GNU General Public License ("GPL") version 2, as published by the Free ++ * Software Foundation. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER OR ++ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ++ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, ++ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR ++ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF ++ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING ++ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ */ ++ ++#include <linux/kernel.h> ++#include <linux/module.h> ++ ++EXPORT_SYMBOL(memcmp); +diff --git a/arch/arm/lib/memcmp_rpi.S b/arch/arm/lib/memcmp_rpi.S +new file mode 100644 +index 0000000..bf6e4ed +--- /dev/null ++++ b/arch/arm/lib/memcmp_rpi.S +@@ -0,0 +1,285 @@ ++/* ++Copyright (c) 2013, Raspberry Pi Foundation ++Copyright (c) 2013, RISC OS Open Ltd ++All rights reserved. ++ ++Redistribution and use in source and binary forms, with or without ++modification, are permitted provided that the following conditions are met: ++ * Redistributions of source code must retain the above copyright ++ notice, this list of conditions and the following disclaimer. ++ * 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. ++ * Neither the name of the copyright holder nor the ++ names of its contributors may be used to endorse or promote products ++ derived from this software without specific prior written permission. ++ ++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY ++DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ++(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; ++LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ++ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ++(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++*/ ++ ++#include <linux/linkage.h> ++#include "arm-mem.h" ++ ++/* Prevent the stack from becoming executable */ ++#if defined(__linux__) && defined(__ELF__) ++.section .note.GNU-stack,"",%progbits ++#endif ++ ++ .text ++ .arch armv6 ++ .object_arch armv4 ++ .arm ++ .altmacro ++ .p2align 2 ++ ++.macro memcmp_process_head unaligned ++ .if unaligned ++ ldr DAT0, [S_1], #4 ++ ldr DAT1, [S_1], #4 ++ ldr DAT2, [S_1], #4 ++ ldr DAT3, [S_1], #4 ++ .else ++ ldmia S_1!, {DAT0, DAT1, DAT2, DAT3} ++ .endif ++ ldmia S_2!, {DAT4, DAT5, DAT6, DAT7} ++.endm ++ ++.macro memcmp_process_tail ++ cmp DAT0, DAT4 ++ cmpeq DAT1, DAT5 ++ cmpeq DAT2, DAT6 ++ cmpeq DAT3, DAT7 ++ bne 200f ++.endm ++ ++.macro memcmp_leading_31bytes ++ movs DAT0, OFF, lsl #31 ++ ldrmib DAT0, [S_1], #1 ++ ldrcsh DAT1, [S_1], #2 ++ ldrmib DAT4, [S_2], #1 ++ ldrcsh DAT5, [S_2], #2 ++ movpl DAT0, #0 ++ movcc DAT1, #0 ++ movpl DAT4, #0 ++ movcc DAT5, #0 ++ submi N, N, #1 ++ subcs N, N, #2 ++ cmp DAT0, DAT4 ++ cmpeq DAT1, DAT5 ++ bne 200f ++ movs DAT0, OFF, lsl #29 ++ ldrmi DAT0, [S_1], #4 ++ ldrcs DAT1, [S_1], #4 ++ ldrcs DAT2, [S_1], #4 ++ ldrmi DAT4, [S_2], #4 ++ ldmcsia S_2!, {DAT5, DAT6} ++ movpl DAT0, #0 ++ movcc DAT1, #0 ++ movcc DAT2, #0 ++ movpl DAT4, #0 ++ movcc DAT5, #0 ++ movcc DAT6, #0 ++ submi N, N, #4 ++ subcs N, N, #8 ++ cmp DAT0, DAT4 ++ cmpeq DAT1, DAT5 ++ cmpeq DAT2, DAT6 ++ bne 200f ++ tst OFF, #16 ++ beq 105f ++ memcmp_process_head 1 ++ sub N, N, #16 ++ memcmp_process_tail ++105: ++.endm ++ ++.macro memcmp_trailing_15bytes unaligned ++ movs N, N, lsl #29 ++ .if unaligned ++ ldrcs DAT0, [S_1], #4 ++ ldrcs DAT1, [S_1], #4 ++ .else ++ ldmcsia S_1!, {DAT0, DAT1} ++ .endif ++ ldrmi DAT2, [S_1], #4 ++ ldmcsia S_2!, {DAT4, DAT5} ++ ldrmi DAT6, [S_2], #4 ++ movcc DAT0, #0 ++ movcc DAT1, #0 ++ movpl DAT2, #0 ++ movcc DAT4, #0 ++ movcc DAT5, #0 ++ movpl DAT6, #0 ++ cmp DAT0, DAT4 ++ cmpeq DAT1, DAT5 ++ cmpeq DAT2, DAT6 ++ bne 200f ++ movs N, N, lsl #2 ++ ldrcsh DAT0, [S_1], #2 ++ ldrmib DAT1, [S_1] ++ ldrcsh DAT4, [S_2], #2 ++ ldrmib DAT5, [S_2] ++ movcc DAT0, #0 ++ movpl DAT1, #0 ++ movcc DAT4, #0 ++ movpl DAT5, #0 ++ cmp DAT0, DAT4 ++ cmpeq DAT1, DAT5 ++ bne 200f ++.endm ++ ++.macro memcmp_long_inner_loop unaligned ++110: ++ memcmp_process_head unaligned ++ pld [S_2, #prefetch_distance*32 + 16] ++ memcmp_process_tail ++ memcmp_process_head unaligned ++ pld [S_1, OFF] ++ memcmp_process_tail ++ subs N, N, #32 ++ bhs 110b ++ /* Just before the final (prefetch_distance+1) 32-byte blocks, ++ * deal with final preloads */ ++ preload_trailing 0, S_1, N, DAT0 ++ preload_trailing 0, S_2, N, DAT0 ++ add N, N, #(prefetch_distance+2)*32 - 16 ++120: ++ memcmp_process_head unaligned ++ memcmp_process_tail ++ subs N, N, #16 ++ bhs 120b ++ /* Trailing words and bytes */ ++ tst N, #15 ++ beq 199f ++ memcmp_trailing_15bytes unaligned ++199: /* Reached end without detecting a difference */ ++ mov a1, #0 ++ setend le ++ pop {DAT1-DAT6, pc} ++.endm ++ ++.macro memcmp_short_inner_loop unaligned ++ subs N, N, #16 /* simplifies inner loop termination */ ++ blo 122f ++120: ++ memcmp_process_head unaligned ++ memcmp_process_tail ++ subs N, N, #16 ++ bhs 120b ++122: /* Trailing words and bytes */ ++ tst N, #15 ++ beq 199f ++ memcmp_trailing_15bytes unaligned ++199: /* Reached end without detecting a difference */ ++ mov a1, #0 ++ setend le ++ pop {DAT1-DAT6, pc} ++.endm ++ ++/* ++ * int memcmp(const void *s1, const void *s2, size_t n); ++ * On entry: ++ * a1 = pointer to buffer 1 ++ * a2 = pointer to buffer 2 ++ * a3 = number of bytes to compare (as unsigned chars) ++ * On exit: ++ * a1 = >0/=0/<0 if s1 >/=/< s2 ++ */ ++ ++.set prefetch_distance, 2 ++ ++ENTRY(memcmp) ++ S_1 .req a1 ++ S_2 .req a2 ++ N .req a3 ++ DAT0 .req a4 ++ DAT1 .req v1 ++ DAT2 .req v2 ++ DAT3 .req v3 ++ DAT4 .req v4 ++ DAT5 .req v5 ++ DAT6 .req v6 ++ DAT7 .req ip ++ OFF .req lr ++ ++ push {DAT1-DAT6, lr} ++ setend be /* lowest-addressed bytes are most significant */ ++ ++ /* To preload ahead as we go, we need at least (prefetch_distance+2) 32-byte blocks */ ++ cmp N, #(prefetch_distance+3)*32 - 1 ++ blo 170f ++ ++ /* Long case */ ++ /* Adjust N so that the decrement instruction can also test for ++ * inner loop termination. We want it to stop when there are ++ * (prefetch_distance+1) complete blocks to go. */ ++ sub N, N, #(prefetch_distance+2)*32 ++ preload_leading_step1 0, DAT0, S_1 ++ preload_leading_step1 0, DAT1, S_2 ++ tst S_2, #31 ++ beq 154f ++ rsb OFF, S_2, #0 /* no need to AND with 15 here */ ++ preload_leading_step2 0, DAT0, S_1, OFF, DAT2 ++ preload_leading_step2 0, DAT1, S_2, OFF, DAT2 ++ memcmp_leading_31bytes ++154: /* Second source now cacheline (32-byte) aligned; we have at ++ * least one prefetch to go. */ ++ /* Prefetch offset is best selected such that it lies in the ++ * first 8 of each 32 bytes - but it's just as easy to aim for ++ * the first one */ ++ and OFF, S_1, #31 ++ rsb OFF, OFF, #32*prefetch_distance ++ tst S_1, #3 ++ bne 140f ++ memcmp_long_inner_loop 0 ++140: memcmp_long_inner_loop 1 ++ ++170: /* Short case */ ++ teq N, #0 ++ beq 199f ++ preload_all 0, 0, 0, S_1, N, DAT0, DAT1 ++ preload_all 0, 0, 0, S_2, N, DAT0, DAT1 ++ tst S_2, #3 ++ beq 174f ++172: subs N, N, #1 ++ blo 199f ++ ldrb DAT0, [S_1], #1 ++ ldrb DAT4, [S_2], #1 ++ cmp DAT0, DAT4 ++ bne 200f ++ tst S_2, #3 ++ bne 172b ++174: /* Second source now 4-byte aligned; we have 0 or more bytes to go */ ++ tst S_1, #3 ++ bne 140f ++ memcmp_short_inner_loop 0 ++140: memcmp_short_inner_loop 1 ++ ++200: /* Difference found: determine sign. */ ++ movhi a1, #1 ++ movlo a1, #-1 ++ setend le ++ pop {DAT1-DAT6, pc} ++ ++ .unreq S_1 ++ .unreq S_2 ++ .unreq N ++ .unreq DAT0 ++ .unreq DAT1 ++ .unreq DAT2 ++ .unreq DAT3 ++ .unreq DAT4 ++ .unreq DAT5 ++ .unreq DAT6 ++ .unreq DAT7 ++ .unreq OFF ++ENDPROC(memcmp) +diff --git a/arch/arm/lib/memcpy_rpi.S b/arch/arm/lib/memcpy_rpi.S +new file mode 100644 +index 0000000..30f8a90 +--- /dev/null ++++ b/arch/arm/lib/memcpy_rpi.S +@@ -0,0 +1,61 @@ ++/* ++Copyright (c) 2013, Raspberry Pi Foundation ++Copyright (c) 2013, RISC OS Open Ltd ++All rights reserved. ++ ++Redistribution and use in source and binary forms, with or without ++modification, are permitted provided that the following conditions are met: ++ * Redistributions of source code must retain the above copyright ++ notice, this list of conditions and the following disclaimer. ++ * 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. ++ * Neither the name of the copyright holder nor the ++ names of its contributors may be used to endorse or promote products ++ derived from this software without specific prior written permission. ++ ++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY ++DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ++(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; ++LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ++ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ++(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++*/ ++ ++#include <linux/linkage.h> ++#include "arm-mem.h" ++#include "memcpymove.h" ++ ++/* Prevent the stack from becoming executable */ ++#if defined(__linux__) && defined(__ELF__) ++.section .note.GNU-stack,"",%progbits ++#endif ++ ++ .text ++ .arch armv6 ++ .object_arch armv4 ++ .arm ++ .altmacro ++ .p2align 2 ++ ++/* ++ * void *memcpy(void * restrict s1, const void * restrict s2, size_t n); ++ * On entry: ++ * a1 = pointer to destination ++ * a2 = pointer to source ++ * a3 = number of bytes to copy ++ * On exit: ++ * a1 preserved ++ */ ++ ++.set prefetch_distance, 3 ++ ++ENTRY(mmiocpy) ++ENTRY(memcpy) ++ memcpy 0 ++ENDPROC(memcpy) ++ENDPROC(mmiocpy) +diff --git a/arch/arm/lib/memcpymove.h b/arch/arm/lib/memcpymove.h +new file mode 100644 +index 0000000..d8be584 +--- /dev/null ++++ b/arch/arm/lib/memcpymove.h +@@ -0,0 +1,506 @@ ++/* ++Copyright (c) 2013, Raspberry Pi Foundation ++Copyright (c) 2013, RISC OS Open Ltd ++All rights reserved. ++ ++Redistribution and use in source and binary forms, with or without ++modification, are permitted provided that the following conditions are met: ++ * Redistributions of source code must retain the above copyright ++ notice, this list of conditions and the following disclaimer. ++ * 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. ++ * Neither the name of the copyright holder nor the ++ names of its contributors may be used to endorse or promote products ++ derived from this software without specific prior written permission. ++ ++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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. ++*/ ++ ++.macro unaligned_words backwards, align, use_pld, words, r0, r1, r2, r3, r4, r5, r6, r7, r8 ++ .if words == 1 ++ .if backwards ++ mov r1, r0, lsl #32-align*8 ++ ldr r0, [S, #-4]! ++ orr r1, r1, r0, lsr #align*8 ++ str r1, [D, #-4]! ++ .else ++ mov r0, r1, lsr #align*8 ++ ldr r1, [S, #4]! ++ orr r0, r0, r1, lsl #32-align*8 ++ str r0, [D], #4 ++ .endif ++ .elseif words == 2 ++ .if backwards ++ ldr r1, [S, #-4]! ++ mov r2, r0, lsl #32-align*8 ++ ldr r0, [S, #-4]! ++ orr r2, r2, r1, lsr #align*8 ++ mov r1, r1, lsl #32-align*8 ++ orr r1, r1, r0, lsr #align*8 ++ stmdb D!, {r1, r2} ++ .else ++ ldr r1, [S, #4]! ++ mov r0, r2, lsr #align*8 ++ ldr r2, [S, #4]! ++ orr r0, r0, r1, lsl #32-align*8 ++ mov r1, r1, lsr #align*8 ++ orr r1, r1, r2, lsl #32-align*8 ++ stmia D!, {r0, r1} ++ .endif ++ .elseif words == 4 ++ .if backwards ++ ldmdb S!, {r2, r3} ++ mov r4, r0, lsl #32-align*8 ++ ldmdb S!, {r0, r1} ++ orr r4, r4, r3, lsr #align*8 ++ mov r3, r3, lsl #32-align*8 ++ orr r3, r3, r2, lsr #align*8 ++ mov r2, r2, lsl #32-align*8 ++ orr r2, r2, r1, lsr #align*8 ++ mov r1, r1, lsl #32-align*8 ++ orr r1, r1, r0, lsr #align*8 ++ stmdb D!, {r1, r2, r3, r4} ++ .else ++ ldmib S!, {r1, r2} ++ mov r0, r4, lsr #align*8 ++ ldmib S!, {r3, r4} ++ orr r0, r0, r1, lsl #32-align*8 ++ mov r1, r1, lsr #align*8 ++ orr r1, r1, r2, lsl #32-align*8 ++ mov r2, r2, lsr #align*8 ++ orr r2, r2, r3, lsl #32-align*8 ++ mov r3, r3, lsr #align*8 ++ orr r3, r3, r4, lsl #32-align*8 ++ stmia D!, {r0, r1, r2, r3} ++ .endif ++ .elseif words == 8 ++ .if backwards ++ ldmdb S!, {r4, r5, r6, r7} ++ mov r8, r0, lsl #32-align*8 ++ ldmdb S!, {r0, r1, r2, r3} ++ .if use_pld ++ pld [S, OFF] ++ .endif ++ orr r8, r8, r7, lsr #align*8 ++ mov r7, r7, lsl #32-align*8 ++ orr r7, r7, r6, lsr #align*8 ++ mov r6, r6, lsl #32-align*8 ++ orr r6, r6, r5, lsr #align*8 ++ mov r5, r5, lsl #32-align*8 ++ orr r5, r5, r4, lsr #align*8 ++ mov r4, r4, lsl #32-align*8 ++ orr r4, r4, r3, lsr #align*8 ++ mov r3, r3, lsl #32-align*8 ++ orr r3, r3, r2, lsr #align*8 ++ mov r2, r2, lsl #32-align*8 ++ orr r2, r2, r1, lsr #align*8 ++ mov r1, r1, lsl #32-align*8 ++ orr r1, r1, r0, lsr #align*8 ++ stmdb D!, {r5, r6, r7, r8} ++ stmdb D!, {r1, r2, r3, r4} ++ .else ++ ldmib S!, {r1, r2, r3, r4} ++ mov r0, r8, lsr #align*8 ++ ldmib S!, {r5, r6, r7, r8} ++ .if use_pld ++ pld [S, OFF] ++ .endif ++ orr r0, r0, r1, lsl #32-align*8 ++ mov r1, r1, lsr #align*8 ++ orr r1, r1, r2, lsl #32-align*8 ++ mov r2, r2, lsr #align*8 ++ orr r2, r2, r3, lsl #32-align*8 ++ mov r3, r3, lsr #align*8 ++ orr r3, r3, r4, lsl #32-align*8 ++ mov r4, r4, lsr #align*8 ++ orr r4, r4, r5, lsl #32-align*8 ++ mov r5, r5, lsr #align*8 ++ orr r5, r5, r6, lsl #32-align*8 ++ mov r6, r6, lsr #align*8 ++ orr r6, r6, r7, lsl #32-align*8 ++ mov r7, r7, lsr #align*8 ++ orr r7, r7, r8, lsl #32-align*8 ++ stmia D!, {r0, r1, r2, r3} ++ stmia D!, {r4, r5, r6, r7} ++ .endif ++ .endif ++.endm ++ ++.macro memcpy_leading_15bytes backwards, align ++ movs DAT1, DAT2, lsl #31 ++ sub N, N, DAT2 ++ .if backwards ++ ldrmib DAT0, [S, #-1]! ++ ldrcsh DAT1, [S, #-2]! ++ strmib DAT0, [D, #-1]! ++ strcsh DAT1, [D, #-2]! ++ .else ++ ldrmib DAT0, [S], #1 ++ ldrcsh DAT1, [S], #2 ++ strmib DAT0, [D], #1 ++ strcsh DAT1, [D], #2 ++ .endif ++ movs DAT1, DAT2, lsl #29 ++ .if backwards ++ ldrmi DAT0, [S, #-4]! ++ .if align == 0 ++ ldmcsdb S!, {DAT1, DAT2} ++ .else ++ ldrcs DAT2, [S, #-4]! ++ ldrcs DAT1, [S, #-4]! ++ .endif ++ strmi DAT0, [D, #-4]! ++ stmcsdb D!, {DAT1, DAT2} ++ .else ++ ldrmi DAT0, [S], #4 ++ .if align == 0 ++ ldmcsia S!, {DAT1, DAT2} ++ .else ++ ldrcs DAT1, [S], #4 ++ ldrcs DAT2, [S], #4 ++ .endif ++ strmi DAT0, [D], #4 ++ stmcsia D!, {DAT1, DAT2} ++ .endif ++.endm ++ ++.macro memcpy_trailing_15bytes backwards, align ++ movs N, N, lsl #29 ++ .if backwards ++ .if align == 0 ++ ldmcsdb S!, {DAT0, DAT1} ++ .else ++ ldrcs DAT1, [S, #-4]! ++ ldrcs DAT0, [S, #-4]! ++ .endif ++ ldrmi DAT2, [S, #-4]! ++ stmcsdb D!, {DAT0, DAT1} ++ strmi DAT2, [D, #-4]! ++ .else ++ .if align == 0 ++ ldmcsia S!, {DAT0, DAT1} ++ .else ++ ldrcs DAT0, [S], #4 ++ ldrcs DAT1, [S], #4 ++ .endif ++ ldrmi DAT2, [S], #4 ++ stmcsia D!, {DAT0, DAT1} ++ strmi DAT2, [D], #4 ++ .endif ++ movs N, N, lsl #2 ++ .if backwards ++ ldrcsh DAT0, [S, #-2]! ++ ldrmib DAT1, [S, #-1] ++ strcsh DAT0, [D, #-2]! ++ strmib DAT1, [D, #-1] ++ .else ++ ldrcsh DAT0, [S], #2 ++ ldrmib DAT1, [S] ++ strcsh DAT0, [D], #2 ++ strmib DAT1, [D] ++ .endif ++.endm ++ ++.macro memcpy_long_inner_loop backwards, align ++ .if align != 0 ++ .if backwards ++ ldr DAT0, [S, #-align]! ++ .else ++ ldr LAST, [S, #-align]! ++ .endif ++ .endif ++110: ++ .if align == 0 ++ .if backwards ++ ldmdb S!, {DAT0, DAT1, DAT2, DAT3, DAT4, DAT5, DAT6, LAST} ++ pld [S, OFF] ++ stmdb D!, {DAT4, DAT5, DAT6, LAST} ++ stmdb D!, {DAT0, DAT1, DAT2, DAT3} ++ .else ++ ldmia S!, {DAT0, DAT1, DAT2, DAT3, DAT4, DAT5, DAT6, LAST} ++ pld [S, OFF] ++ stmia D!, {DAT0, DAT1, DAT2, DAT3} ++ stmia D!, {DAT4, DAT5, DAT6, LAST} ++ .endif ++ .else ++ unaligned_words backwards, align, 1, 8, DAT0, DAT1, DAT2, DAT3, DAT4, DAT5, DAT6, DAT7, LAST ++ .endif ++ subs N, N, #32 ++ bhs 110b ++ /* Just before the final (prefetch_distance+1) 32-byte blocks, deal with final preloads */ ++ preload_trailing backwards, S, N, OFF ++ add N, N, #(prefetch_distance+2)*32 - 32 ++120: ++ .if align == 0 ++ .if backwards ++ ldmdb S!, {DAT0, DAT1, DAT2, DAT3, DAT4, DAT5, DAT6, LAST} ++ stmdb D!, {DAT4, DAT5, DAT6, LAST} ++ stmdb D!, {DAT0, DAT1, DAT2, DAT3} ++ .else ++ ldmia S!, {DAT0, DAT1, DAT2, DAT3, DAT4, DAT5, DAT6, LAST} ++ stmia D!, {DAT0, DAT1, DAT2, DAT3} ++ stmia D!, {DAT4, DAT5, DAT6, LAST} ++ .endif ++ .else ++ unaligned_words backwards, align, 0, 8, DAT0, DAT1, DAT2, DAT3, DAT4, DAT5, DAT6, DAT7, LAST ++ .endif ++ subs N, N, #32 ++ bhs 120b ++ tst N, #16 ++ .if align == 0 ++ .if backwards ++ ldmnedb S!, {DAT0, DAT1, DAT2, LAST} ++ stmnedb D!, {DAT0, DAT1, DAT2, LAST} ++ .else ++ ldmneia S!, {DAT0, DAT1, DAT2, LAST} ++ stmneia D!, {DAT0, DAT1, DAT2, LAST} ++ .endif ++ .else ++ beq 130f ++ unaligned_words backwards, align, 0, 4, DAT0, DAT1, DAT2, DAT3, LAST ++130: ++ .endif ++ /* Trailing words and bytes */ ++ tst N, #15 ++ beq 199f ++ .if align != 0 ++ add S, S, #align ++ .endif ++ memcpy_trailing_15bytes backwards, align ++199: ++ pop {DAT3, DAT4, DAT5, DAT6, DAT7} ++ pop {D, DAT1, DAT2, pc} ++.endm ++ ++.macro memcpy_medium_inner_loop backwards, align ++120: ++ .if backwards ++ .if align == 0 ++ ldmdb S!, {DAT0, DAT1, DAT2, LAST} ++ .else ++ ldr LAST, [S, #-4]! ++ ldr DAT2, [S, #-4]! ++ ldr DAT1, [S, #-4]! ++ ldr DAT0, [S, #-4]! ++ .endif ++ stmdb D!, {DAT0, DAT1, DAT2, LAST} ++ .else ++ .if align == 0 ++ ldmia S!, {DAT0, DAT1, DAT2, LAST} ++ .else ++ ldr DAT0, [S], #4 ++ ldr DAT1, [S], #4 ++ ldr DAT2, [S], #4 ++ ldr LAST, [S], #4 ++ .endif ++ stmia D!, {DAT0, DAT1, DAT2, LAST} ++ .endif ++ subs N, N, #16 ++ bhs 120b ++ /* Trailing words and bytes */ ++ tst N, #15 ++ beq 199f ++ memcpy_trailing_15bytes backwards, align ++199: ++ pop {D, DAT1, DAT2, pc} ++.endm ++ ++.macro memcpy_short_inner_loop backwards, align ++ tst N, #16 ++ .if backwards ++ .if align == 0 ++ ldmnedb S!, {DAT0, DAT1, DAT2, LAST} ++ .else ++ ldrne LAST, [S, #-4]! ++ ldrne DAT2, [S, #-4]! ++ ldrne DAT1, [S, #-4]! ++ ldrne DAT0, [S, #-4]! ++ .endif ++ stmnedb D!, {DAT0, DAT1, DAT2, LAST} ++ .else ++ .if align == 0 ++ ldmneia S!, {DAT0, DAT1, DAT2, LAST} ++ .else ++ ldrne DAT0, [S], #4 ++ ldrne DAT1, [S], #4 ++ ldrne DAT2, [S], #4 ++ ldrne LAST, [S], #4 ++ .endif ++ stmneia D!, {DAT0, DAT1, DAT2, LAST} ++ .endif ++ memcpy_trailing_15bytes backwards, align ++199: ++ pop {D, DAT1, DAT2, pc} ++.endm ++ ++.macro memcpy backwards ++ D .req a1 ++ S .req a2 ++ N .req a3 ++ DAT0 .req a4 ++ DAT1 .req v1 ++ DAT2 .req v2 ++ DAT3 .req v3 ++ DAT4 .req v4 ++ DAT5 .req v5 ++ DAT6 .req v6 ++ DAT7 .req sl ++ LAST .req ip ++ OFF .req lr ++ ++ .cfi_startproc ++ ++ push {D, DAT1, DAT2, lr} ++ ++ .cfi_def_cfa_offset 16 ++ .cfi_rel_offset D, 0 ++ .cfi_undefined S ++ .cfi_undefined N ++ .cfi_undefined DAT0 ++ .cfi_rel_offset DAT1, 4 ++ .cfi_rel_offset DAT2, 8 ++ .cfi_undefined LAST ++ .cfi_rel_offset lr, 12 ++ ++ .if backwards ++ add D, D, N ++ add S, S, N ++ .endif ++ ++ /* See if we're guaranteed to have at least one 16-byte aligned 16-byte write */ ++ cmp N, #31 ++ blo 170f ++ /* To preload ahead as we go, we need at least (prefetch_distance+2) 32-byte blocks */ ++ cmp N, #(prefetch_distance+3)*32 - 1 ++ blo 160f ++ ++ /* Long case */ ++ push {DAT3, DAT4, DAT5, DAT6, DAT7} ++ ++ .cfi_def_cfa_offset 36 ++ .cfi_rel_offset D, 20 ++ .cfi_rel_offset DAT1, 24 ++ .cfi_rel_offset DAT2, 28 ++ .cfi_rel_offset DAT3, 0 ++ .cfi_rel_offset DAT4, 4 ++ .cfi_rel_offset DAT5, 8 ++ .cfi_rel_offset DAT6, 12 ++ .cfi_rel_offset DAT7, 16 ++ .cfi_rel_offset lr, 32 ++ ++ /* Adjust N so that the decrement instruction can also test for ++ * inner loop termination. We want it to stop when there are ++ * (prefetch_distance+1) complete blocks to go. */ ++ sub N, N, #(prefetch_distance+2)*32 ++ preload_leading_step1 backwards, DAT0, S ++ .if backwards ++ /* Bug in GAS: it accepts, but mis-assembles the instruction ++ * ands DAT2, D, #60, 2 ++ * which sets DAT2 to the number of leading bytes until destination is aligned and also clears C (sets borrow) ++ */ ++ .word 0xE210513C ++ beq 154f ++ .else ++ ands DAT2, D, #15 ++ beq 154f ++ rsb DAT2, DAT2, #16 /* number of leading bytes until destination aligned */ ++ .endif ++ preload_leading_step2 backwards, DAT0, S, DAT2, OFF ++ memcpy_leading_15bytes backwards, 1 ++154: /* Destination now 16-byte aligned; we have at least one prefetch as well as at least one 16-byte output block */ ++ /* Prefetch offset is best selected such that it lies in the first 8 of each 32 bytes - but it's just as easy to aim for the first one */ ++ .if backwards ++ rsb OFF, S, #3 ++ and OFF, OFF, #28 ++ sub OFF, OFF, #32*(prefetch_distance+1) ++ .else ++ and OFF, S, #28 ++ rsb OFF, OFF, #32*prefetch_distance ++ .endif ++ movs DAT0, S, lsl #31 ++ bhi 157f ++ bcs 156f ++ bmi 155f ++ memcpy_long_inner_loop backwards, 0 ++155: memcpy_long_inner_loop backwards, 1 ++156: memcpy_long_inner_loop backwards, 2 ++157: memcpy_long_inner_loop backwards, 3 ++ ++ .cfi_def_cfa_offset 16 ++ .cfi_rel_offset D, 0 ++ .cfi_rel_offset DAT1, 4 ++ .cfi_rel_offset DAT2, 8 ++ .cfi_same_value DAT3 ++ .cfi_same_value DAT4 ++ .cfi_same_value DAT5 ++ .cfi_same_value DAT6 ++ .cfi_same_value DAT7 ++ .cfi_rel_offset lr, 12 ++ ++160: /* Medium case */ ++ preload_all backwards, 0, 0, S, N, DAT2, OFF ++ sub N, N, #16 /* simplifies inner loop termination */ ++ .if backwards ++ ands DAT2, D, #15 ++ beq 164f ++ .else ++ ands DAT2, D, #15 ++ beq 164f ++ rsb DAT2, DAT2, #16 ++ .endif ++ memcpy_leading_15bytes backwards, align ++164: /* Destination now 16-byte aligned; we have at least one 16-byte output block */ ++ tst S, #3 ++ bne 140f ++ memcpy_medium_inner_loop backwards, 0 ++140: memcpy_medium_inner_loop backwards, 1 ++ ++170: /* Short case, less than 31 bytes, so no guarantee of at least one 16-byte block */ ++ teq N, #0 ++ beq 199f ++ preload_all backwards, 1, 0, S, N, DAT2, LAST ++ tst D, #3 ++ beq 174f ++172: subs N, N, #1 ++ blo 199f ++ .if backwards ++ ldrb DAT0, [S, #-1]! ++ strb DAT0, [D, #-1]! ++ .else ++ ldrb DAT0, [S], #1 ++ strb DAT0, [D], #1 ++ .endif ++ tst D, #3 ++ bne 172b ++174: /* Destination now 4-byte aligned; we have 0 or more output bytes to go */ ++ tst S, #3 ++ bne 140f ++ memcpy_short_inner_loop backwards, 0 ++140: memcpy_short_inner_loop backwards, 1 ++ ++ .cfi_endproc ++ ++ .unreq D ++ .unreq S ++ .unreq N ++ .unreq DAT0 ++ .unreq DAT1 ++ .unreq DAT2 ++ .unreq DAT3 ++ .unreq DAT4 ++ .unreq DAT5 ++ .unreq DAT6 ++ .unreq DAT7 ++ .unreq LAST ++ .unreq OFF ++.endm +diff --git a/arch/arm/lib/memmove_rpi.S b/arch/arm/lib/memmove_rpi.S +new file mode 100644 +index 0000000..8b0760c +--- /dev/null ++++ b/arch/arm/lib/memmove_rpi.S +@@ -0,0 +1,61 @@ ++/* ++Copyright (c) 2013, Raspberry Pi Foundation ++Copyright (c) 2013, RISC OS Open Ltd ++All rights reserved. ++ ++Redistribution and use in source and binary forms, with or without ++modification, are permitted provided that the following conditions are met: ++ * Redistributions of source code must retain the above copyright ++ notice, this list of conditions and the following disclaimer. ++ * 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. ++ * Neither the name of the copyright holder nor the ++ names of its contributors may be used to endorse or promote products ++ derived from this software without specific prior written permission. ++ ++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY ++DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ++(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; ++LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ++ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ++(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++*/ ++ ++#include <linux/linkage.h> ++#include "arm-mem.h" ++#include "memcpymove.h" ++ ++/* Prevent the stack from becoming executable */ ++#if defined(__linux__) && defined(__ELF__) ++.section .note.GNU-stack,"",%progbits ++#endif ++ ++ .text ++ .arch armv6 ++ .object_arch armv4 ++ .arm ++ .altmacro ++ .p2align 2 ++ ++/* ++ * void *memmove(void *s1, const void *s2, size_t n); ++ * On entry: ++ * a1 = pointer to destination ++ * a2 = pointer to source ++ * a3 = number of bytes to copy ++ * On exit: ++ * a1 preserved ++ */ ++ ++.set prefetch_distance, 3 ++ ++ENTRY(memmove) ++ cmp a2, a1 ++ bpl memcpy /* pl works even over -1 - 0 and 0x7fffffff - 0x80000000 boundaries */ ++ memcpy 1 ++ENDPROC(memmove) +diff --git a/arch/arm/lib/memset_rpi.S b/arch/arm/lib/memset_rpi.S +new file mode 100644 +index 0000000..7067415 +--- /dev/null ++++ b/arch/arm/lib/memset_rpi.S +@@ -0,0 +1,123 @@ ++/* ++Copyright (c) 2013, Raspberry Pi Foundation ++Copyright (c) 2013, RISC OS Open Ltd ++All rights reserved. ++ ++Redistribution and use in source and binary forms, with or without ++modification, are permitted provided that the following conditions are met: ++ * Redistributions of source code must retain the above copyright ++ notice, this list of conditions and the following disclaimer. ++ * 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. ++ * Neither the name of the copyright holder nor the ++ names of its contributors may be used to endorse or promote products ++ derived from this software without specific prior written permission. ++ ++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY ++DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ++(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; ++LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ++ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ++(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++*/ ++ ++#include <linux/linkage.h> ++#include "arm-mem.h" ++ ++/* Prevent the stack from becoming executable */ ++#if defined(__linux__) && defined(__ELF__) ++.section .note.GNU-stack,"",%progbits ++#endif ++ ++ .text ++ .arch armv6 ++ .object_arch armv4 ++ .arm ++ .altmacro ++ .p2align 2 ++ ++/* ++ * void *memset(void *s, int c, size_t n); ++ * On entry: ++ * a1 = pointer to buffer to fill ++ * a2 = byte pattern to fill with (caller-narrowed) ++ * a3 = number of bytes to fill ++ * On exit: ++ * a1 preserved ++ */ ++ENTRY(mmioset) ++ENTRY(memset) ++ S .req a1 ++ DAT0 .req a2 ++ N .req a3 ++ DAT1 .req a4 ++ DAT2 .req ip ++ DAT3 .req lr ++ ++ orr DAT0, DAT0, lsl #8 ++ push {S, lr} ++ orr DAT0, DAT0, lsl #16 ++ mov DAT1, DAT0 ++ ++ /* See if we're guaranteed to have at least one 16-byte aligned 16-byte write */ ++ cmp N, #31 ++ blo 170f ++ ++161: sub N, N, #16 /* simplifies inner loop termination */ ++ /* Leading words and bytes */ ++ tst S, #15 ++ beq 164f ++ rsb DAT3, S, #0 /* bits 0-3 = number of leading bytes until aligned */ ++ movs DAT2, DAT3, lsl #31 ++ submi N, N, #1 ++ strmib DAT0, [S], #1 ++ subcs N, N, #2 ++ strcsh DAT0, [S], #2 ++ movs DAT2, DAT3, lsl #29 ++ submi N, N, #4 ++ strmi DAT0, [S], #4 ++ subcs N, N, #8 ++ stmcsia S!, {DAT0, DAT1} ++164: /* Delayed set up of DAT2 and DAT3 so we could use them as scratch registers above */ ++ mov DAT2, DAT0 ++ mov DAT3, DAT0 ++ /* Now the inner loop of 16-byte stores */ ++165: stmia S!, {DAT0, DAT1, DAT2, DAT3} ++ subs N, N, #16 ++ bhs 165b ++166: /* Trailing words and bytes */ ++ movs N, N, lsl #29 ++ stmcsia S!, {DAT0, DAT1} ++ strmi DAT0, [S], #4 ++ movs N, N, lsl #2 ++ strcsh DAT0, [S], #2 ++ strmib DAT0, [S] ++199: pop {S, pc} ++ ++170: /* Short case */ ++ mov DAT2, DAT0 ++ mov DAT3, DAT0 ++ tst S, #3 ++ beq 174f ++172: subs N, N, #1 ++ blo 199b ++ strb DAT0, [S], #1 ++ tst S, #3 ++ bne 172b ++174: tst N, #16 ++ stmneia S!, {DAT0, DAT1, DAT2, DAT3} ++ b 166b ++ ++ .unreq S ++ .unreq DAT0 ++ .unreq N ++ .unreq DAT1 ++ .unreq DAT2 ++ .unreq DAT3 ++ENDPROC(memset) ++ENDPROC(mmioset) +diff --git a/arch/arm/lib/uaccess_with_memcpy.c b/arch/arm/lib/uaccess_with_memcpy.c +index 6bd1089..cd17dd1 100644 +--- a/arch/arm/lib/uaccess_with_memcpy.c ++++ b/arch/arm/lib/uaccess_with_memcpy.c +@@ -22,6 +22,14 @@ + #include <asm/current.h> + #include <asm/page.h> + ++#ifndef COPY_FROM_USER_THRESHOLD ++#define COPY_FROM_USER_THRESHOLD 64 ++#endif ++ ++#ifndef COPY_TO_USER_THRESHOLD ++#define COPY_TO_USER_THRESHOLD 64 ++#endif ++ + static int + pin_page_for_write(const void __user *_addr, pte_t **ptep, spinlock_t **ptlp) + { +@@ -84,7 +92,44 @@ pin_page_for_write(const void __user *_addr, pte_t **ptep, spinlock_t **ptlp) + return 1; + } + +-static unsigned long noinline ++static int ++pin_page_for_read(const void __user *_addr, pte_t **ptep, spinlock_t **ptlp) ++{ ++ unsigned long addr = (unsigned long)_addr; ++ pgd_t *pgd; ++ pmd_t *pmd; ++ pte_t *pte; ++ pud_t *pud; ++ spinlock_t *ptl; ++ ++ pgd = pgd_offset(current->mm, addr); ++ if (unlikely(pgd_none(*pgd) || pgd_bad(*pgd))) ++ { ++ return 0; ++ } ++ pud = pud_offset(pgd, addr); ++ if (unlikely(pud_none(*pud) || pud_bad(*pud))) ++ { ++ return 0; ++ } ++ ++ pmd = pmd_offset(pud, addr); ++ if (unlikely(pmd_none(*pmd) || pmd_bad(*pmd))) ++ return 0; ++ ++ pte = pte_offset_map_lock(current->mm, pmd, addr, &ptl); ++ if (unlikely(!pte_present(*pte) || !pte_young(*pte))) { ++ pte_unmap_unlock(pte, ptl); ++ return 0; ++ } ++ ++ *ptep = pte; ++ *ptlp = ptl; ++ ++ return 1; ++} ++ ++unsigned long noinline + __copy_to_user_memcpy(void __user *to, const void *from, unsigned long n) + { + unsigned long ua_flags; +@@ -137,6 +182,57 @@ out: + return n; + } + ++unsigned long noinline ++__copy_from_user_memcpy(void *to, const void __user *from, unsigned long n) ++{ ++ unsigned long ua_flags; ++ int atomic; ++ ++ if (unlikely(segment_eq(get_fs(), KERNEL_DS))) { ++ memcpy(to, (const void *)from, n); ++ return 0; ++ } ++ ++ /* the mmap semaphore is taken only if not in an atomic context */ ++ atomic = in_atomic(); ++ ++ if (!atomic) ++ down_read(&current->mm->mmap_sem); ++ while (n) { ++ pte_t *pte; ++ spinlock_t *ptl; ++ int tocopy; ++ ++ while (!pin_page_for_read(from, &pte, &ptl)) { ++ char temp; ++ if (!atomic) ++ up_read(&current->mm->mmap_sem); ++ if (__get_user(temp, (char __user *)from)) ++ goto out; ++ if (!atomic) ++ down_read(&current->mm->mmap_sem); ++ } ++ ++ tocopy = (~(unsigned long)from & ~PAGE_MASK) + 1; ++ if (tocopy > n) ++ tocopy = n; ++ ++ ua_flags = uaccess_save_and_enable(); ++ memcpy(to, (const void *)from, tocopy); ++ uaccess_restore(ua_flags); ++ to += tocopy; ++ from += tocopy; ++ n -= tocopy; ++ ++ pte_unmap_unlock(pte, ptl); ++ } ++ if (!atomic) ++ up_read(&current->mm->mmap_sem); ++ ++out: ++ return n; ++} ++ + unsigned long + arm_copy_to_user(void __user *to, const void *from, unsigned long n) + { +@@ -147,7 +243,7 @@ arm_copy_to_user(void __user *to, const void *from, unsigned long n) + * With frame pointer disabled, tail call optimization kicks in + * as well making this test almost invisible. + */ +- if (n < 64) { ++ if (n < COPY_TO_USER_THRESHOLD) { + unsigned long ua_flags = uaccess_save_and_enable(); + n = __copy_to_user_std(to, from, n); + uaccess_restore(ua_flags); +@@ -156,6 +252,26 @@ arm_copy_to_user(void __user *to, const void *from, unsigned long n) + } + return n; + } ++ ++unsigned long __must_check ++arm_copy_from_user(void *to, const void __user *from, unsigned long n) ++{ ++ /* ++ * This test is stubbed out of the main function above to keep ++ * the overhead for small copies low by avoiding a large ++ * register dump on the stack just to reload them right away. ++ * With frame pointer disabled, tail call optimization kicks in ++ * as well making this test almost invisible. ++ */ ++ if (n < COPY_TO_USER_THRESHOLD) { ++ unsigned long ua_flags = uaccess_save_and_enable(); ++ n = __copy_from_user_std(to, from, n); ++ uaccess_restore(ua_flags); ++ } else { ++ n = __copy_from_user_memcpy(to, from, n); ++ } ++ return n; ++} + + static unsigned long noinline + __clear_user_memset(void __user *addr, unsigned long n) + +From d67c5533e1929885c312599acdf853138761f6ed Mon Sep 17 00:00:00 2001 +From: Phil Elwell <phil@raspberrypi.org> +Date: Thu, 25 Jun 2015 12:16:11 +0100 +Subject: [PATCH 080/112] gpio-poweroff: Allow it to work on Raspberry Pi + +The Raspberry Pi firmware manages the power-down and reboot +process. To do this it installs a pm_power_off handler, causing +the gpio-poweroff module to abort the probe function. + +This patch introduces a "force" DT property that overrides that +behaviour, and also adds a DT overlay to enable and control it. + +Note that running in an active-low configuration (DT parameter +"active_low") requires a custom dt-blob.bin and probably won't +allow a reboot without switching off, so an external inversion +of the trigger signal may be preferable. +--- + drivers/power/reset/gpio-poweroff.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/drivers/power/reset/gpio-poweroff.c b/drivers/power/reset/gpio-poweroff.c +index be3d81f..a030ae9 100644 +--- a/drivers/power/reset/gpio-poweroff.c ++++ b/drivers/power/reset/gpio-poweroff.c +@@ -49,9 +49,11 @@ static int gpio_poweroff_probe(struct platform_device *pdev) + { + bool input = false; + enum gpiod_flags flags; ++ bool force = false; + + /* If a pm_power_off function has already been added, leave it alone */ +- if (pm_power_off != NULL) { ++ force = of_property_read_bool(pdev->dev.of_node, "force"); ++ if (!force && (pm_power_off != NULL)) { + dev_err(&pdev->dev, + "%s: pm_power_off function already registered", + __func__); + +From e72f41d909aa46e9bc234f6f2a6301ef9ef23676 Mon Sep 17 00:00:00 2001 +From: Phil Elwell <pelwell@users.noreply.github.com> +Date: Tue, 14 Jul 2015 14:32:47 +0100 +Subject: [PATCH 081/112] mfd: Add Raspberry Pi Sense HAT core driver + +--- + drivers/input/joystick/Kconfig | 8 + + drivers/input/joystick/Makefile | 1 + + drivers/input/joystick/rpisense-js.c | 153 ++++++++++++++++ + drivers/mfd/Kconfig | 8 + + drivers/mfd/Makefile | 2 + + drivers/mfd/rpisense-core.c | 157 +++++++++++++++++ + drivers/video/fbdev/Kconfig | 13 ++ + drivers/video/fbdev/Makefile | 1 + + drivers/video/fbdev/rpisense-fb.c | 293 +++++++++++++++++++++++++++++++ + include/linux/mfd/rpisense/core.h | 47 +++++ + include/linux/mfd/rpisense/framebuffer.h | 32 ++++ + include/linux/mfd/rpisense/joystick.h | 35 ++++ + 12 files changed, 750 insertions(+) + create mode 100644 drivers/input/joystick/rpisense-js.c + create mode 100644 drivers/mfd/rpisense-core.c + create mode 100644 drivers/video/fbdev/rpisense-fb.c + create mode 100644 include/linux/mfd/rpisense/core.h + create mode 100644 include/linux/mfd/rpisense/framebuffer.h + create mode 100644 include/linux/mfd/rpisense/joystick.h + +diff --git a/drivers/input/joystick/Kconfig b/drivers/input/joystick/Kconfig +index 4215b53..4364d7c 100644 +--- a/drivers/input/joystick/Kconfig ++++ b/drivers/input/joystick/Kconfig +@@ -330,4 +330,12 @@ config JOYSTICK_MAPLE + To compile this as a module choose M here: the module will be called + maplecontrol. + ++config JOYSTICK_RPISENSE ++ tristate "Raspberry Pi Sense HAT joystick" ++ depends on GPIOLIB && INPUT ++ select MFD_RPISENSE_CORE ++ ++ help ++ This is the joystick driver for the Raspberry Pi Sense HAT ++ + endif +diff --git a/drivers/input/joystick/Makefile b/drivers/input/joystick/Makefile +index 92dc0de..1758160 100644 +--- a/drivers/input/joystick/Makefile ++++ b/drivers/input/joystick/Makefile +@@ -32,4 +32,5 @@ obj-$(CONFIG_JOYSTICK_WARRIOR) += warrior.o + obj-$(CONFIG_JOYSTICK_XPAD) += xpad.o + obj-$(CONFIG_JOYSTICK_ZHENHUA) += zhenhua.o + obj-$(CONFIG_JOYSTICK_WALKERA0701) += walkera0701.o ++obj-$(CONFIG_JOYSTICK_RPISENSE) += rpisense-js.o + +diff --git a/drivers/input/joystick/rpisense-js.c b/drivers/input/joystick/rpisense-js.c +new file mode 100644 +index 0000000..6a41676 +--- /dev/null ++++ b/drivers/input/joystick/rpisense-js.c +@@ -0,0 +1,153 @@ ++/* ++ * Raspberry Pi Sense HAT joystick driver ++ * http://raspberrypi.org ++ * ++ * Copyright (C) 2015 Raspberry Pi ++ * ++ * Author: Serge Schneider ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License as published by the ++ * Free Software Foundation; either version 2 of the License, or (at your ++ * option) any later version. ++ * ++ */ ++ ++#include <linux/module.h> ++ ++#include <linux/mfd/rpisense/joystick.h> ++#include <linux/mfd/rpisense/core.h> ++ ++static struct rpisense *rpisense; ++static unsigned char keymap[5] = {KEY_DOWN, KEY_RIGHT, KEY_UP, KEY_ENTER, KEY_LEFT,}; ++ ++static void keys_work_fn(struct work_struct *work) ++{ ++ int i; ++ static s32 prev_keys; ++ struct rpisense_js *rpisense_js = &rpisense->joystick; ++ s32 keys = rpisense_reg_read(rpisense, RPISENSE_KEYS); ++ s32 changes = keys ^ prev_keys; ++ ++ prev_keys = keys; ++ for (i = 0; i < 5; i++) { ++ if (changes & 1) { ++ input_report_key(rpisense_js->keys_dev, ++ keymap[i], keys & 1); ++ } ++ changes >>= 1; ++ keys >>= 1; ++ } ++ input_sync(rpisense_js->keys_dev); ++} ++ ++static irqreturn_t keys_irq_handler(int irq, void *pdev) ++{ ++ struct rpisense_js *rpisense_js = &rpisense->joystick; ++ ++ schedule_work(&rpisense_js->keys_work_s); ++ return IRQ_HANDLED; ++} ++ ++static int rpisense_js_probe(struct platform_device *pdev) ++{ ++ int ret; ++ int i; ++ struct rpisense_js *rpisense_js; ++ ++ rpisense = rpisense_get_dev(); ++ rpisense_js = &rpisense->joystick; ++ ++ INIT_WORK(&rpisense_js->keys_work_s, keys_work_fn); ++ ++ rpisense_js->keys_dev = input_allocate_device(); ++ if (!rpisense_js->keys_dev) { ++ dev_err(&pdev->dev, "Could not allocate input device.\n"); ++ return -ENOMEM; ++ } ++ ++ rpisense_js->keys_dev->evbit[0] = BIT_MASK(EV_KEY); ++ for (i = 0; i < ARRAY_SIZE(keymap); i++) { ++ set_bit(keymap[i], ++ rpisense_js->keys_dev->keybit); ++ } ++ ++ rpisense_js->keys_dev->name = "Raspberry Pi Sense HAT Joystick"; ++ rpisense_js->keys_dev->phys = "rpi-sense-joy/input0"; ++ rpisense_js->keys_dev->id.bustype = BUS_I2C; ++ rpisense_js->keys_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP); ++ rpisense_js->keys_dev->keycode = keymap; ++ rpisense_js->keys_dev->keycodesize = sizeof(unsigned char); ++ rpisense_js->keys_dev->keycodemax = ARRAY_SIZE(keymap); ++ ++ ret = input_register_device(rpisense_js->keys_dev); ++ if (ret) { ++ dev_err(&pdev->dev, "Could not register input device.\n"); ++ goto err_keys_alloc; ++ } ++ ++ ret = gpiod_direction_input(rpisense_js->keys_desc); ++ if (ret) { ++ dev_err(&pdev->dev, "Could not set keys-int direction.\n"); ++ goto err_keys_reg; ++ } ++ ++ rpisense_js->keys_irq = gpiod_to_irq(rpisense_js->keys_desc); ++ if (rpisense_js->keys_irq < 0) { ++ dev_err(&pdev->dev, "Could not determine keys-int IRQ.\n"); ++ ret = rpisense_js->keys_irq; ++ goto err_keys_reg; ++ } ++ ++ ret = devm_request_irq(&pdev->dev, rpisense_js->keys_irq, ++ keys_irq_handler, IRQF_TRIGGER_RISING, ++ "keys", &pdev->dev); ++ if (ret) { ++ dev_err(&pdev->dev, "IRQ request failed.\n"); ++ goto err_keys_reg; ++ } ++ return 0; ++err_keys_reg: ++ input_unregister_device(rpisense_js->keys_dev); ++err_keys_alloc: ++ input_free_device(rpisense_js->keys_dev); ++ return ret; ++} ++ ++static int rpisense_js_remove(struct platform_device *pdev) ++{ ++ struct rpisense_js *rpisense_js = &rpisense->joystick; ++ ++ input_unregister_device(rpisense_js->keys_dev); ++ input_free_device(rpisense_js->keys_dev); ++ return 0; ++} ++ ++#ifdef CONFIG_OF ++static const struct of_device_id rpisense_js_id[] = { ++ { .compatible = "rpi,rpi-sense-js" }, ++ { }, ++}; ++MODULE_DEVICE_TABLE(of, rpisense_js_id); ++#endif ++ ++static struct platform_device_id rpisense_js_device_id[] = { ++ { .name = "rpi-sense-js" }, ++ { }, ++}; ++MODULE_DEVICE_TABLE(platform, rpisense_js_device_id); ++ ++static struct platform_driver rpisense_js_driver = { ++ .probe = rpisense_js_probe, ++ .remove = rpisense_js_remove, ++ .driver = { ++ .name = "rpi-sense-js", ++ .owner = THIS_MODULE, ++ }, ++}; ++ ++module_platform_driver(rpisense_js_driver); ++ ++MODULE_DESCRIPTION("Raspberry Pi Sense HAT joystick driver"); ++MODULE_AUTHOR("Serge Schneider <serge@raspberrypi.org>"); ++MODULE_LICENSE("GPL"); +diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig +index eea61e3..d2c3b72 100644 +--- a/drivers/mfd/Kconfig ++++ b/drivers/mfd/Kconfig +@@ -10,6 +10,14 @@ config MFD_CORE + select IRQ_DOMAIN + default n + ++config MFD_RPISENSE_CORE ++ tristate "Raspberry Pi Sense HAT core functions" ++ depends on I2C ++ select MFD_CORE ++ help ++ This is the core driver for the Raspberry Pi Sense HAT. This provides ++ the necessary functions to communicate with the hardware. ++ + config MFD_CS5535 + tristate "AMD CS5535 and CS5536 southbridge core functions" + select MFD_CORE +diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile +index 5eaa6465d..8dc2dde 100644 +--- a/drivers/mfd/Makefile ++++ b/drivers/mfd/Makefile +@@ -203,3 +203,5 @@ intel-soc-pmic-objs := intel_soc_pmic_core.o intel_soc_pmic_crc.o + intel-soc-pmic-$(CONFIG_INTEL_PMC_IPC) += intel_soc_pmic_bxtwc.o + obj-$(CONFIG_INTEL_SOC_PMIC) += intel-soc-pmic.o + obj-$(CONFIG_MFD_MT6397) += mt6397-core.o ++ ++obj-$(CONFIG_MFD_RPISENSE_CORE) += rpisense-core.o +diff --git a/drivers/mfd/rpisense-core.c b/drivers/mfd/rpisense-core.c +new file mode 100644 +index 0000000..eea9312 +--- /dev/null ++++ b/drivers/mfd/rpisense-core.c +@@ -0,0 +1,157 @@ ++/* ++ * Raspberry Pi Sense HAT core driver ++ * http://raspberrypi.org ++ * ++ * Copyright (C) 2015 Raspberry Pi ++ * ++ * Author: Serge Schneider ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License as published by the ++ * Free Software Foundation; either version 2 of the License, or (at your ++ * option) any later version. ++ * ++ * This driver is based on wm8350 implementation. ++ */ ++ ++#include <linux/module.h> ++#include <linux/moduleparam.h> ++#include <linux/err.h> ++#include <linux/init.h> ++#include <linux/i2c.h> ++#include <linux/platform_device.h> ++#include <linux/mfd/rpisense/core.h> ++#include <linux/slab.h> ++ ++static struct rpisense *rpisense; ++ ++static void rpisense_client_dev_register(struct rpisense *rpisense, ++ const char *name, ++ struct platform_device **pdev) ++{ ++ int ret; ++ ++ *pdev = platform_device_alloc(name, -1); ++ if (*pdev == NULL) { ++ dev_err(rpisense->dev, "Failed to allocate %s\n", name); ++ return; ++ } ++ ++ (*pdev)->dev.parent = rpisense->dev; ++ platform_set_drvdata(*pdev, rpisense); ++ ret = platform_device_add(*pdev); ++ if (ret != 0) { ++ dev_err(rpisense->dev, "Failed to register %s: %d\n", ++ name, ret); ++ platform_device_put(*pdev); ++ *pdev = NULL; ++ } ++} ++ ++static int rpisense_probe(struct i2c_client *i2c, ++ const struct i2c_device_id *id) ++{ ++ int ret; ++ struct rpisense_js *rpisense_js; ++ ++ rpisense = devm_kzalloc(&i2c->dev, sizeof(struct rpisense), GFP_KERNEL); ++ if (rpisense == NULL) ++ return -ENOMEM; ++ ++ i2c_set_clientdata(i2c, rpisense); ++ rpisense->dev = &i2c->dev; ++ rpisense->i2c_client = i2c; ++ ++ ret = rpisense_reg_read(rpisense, RPISENSE_WAI); ++ if (ret > 0) { ++ if (ret != 's') ++ return -EINVAL; ++ } else { ++ return ret; ++ } ++ ret = rpisense_reg_read(rpisense, RPISENSE_VER); ++ if (ret < 0) ++ return ret; ++ ++ dev_info(rpisense->dev, ++ "Raspberry Pi Sense HAT firmware version %i\n", ret); ++ ++ rpisense_js = &rpisense->joystick; ++ rpisense_js->keys_desc = devm_gpiod_get(&i2c->dev, ++ "keys-int", GPIOD_IN); ++ if (IS_ERR(rpisense_js->keys_desc)) { ++ dev_warn(&i2c->dev, "Failed to get keys-int descriptor.\n"); ++ rpisense_js->keys_desc = gpio_to_desc(23); ++ if (rpisense_js->keys_desc == NULL) { ++ dev_err(&i2c->dev, "GPIO23 fallback failed.\n"); ++ return PTR_ERR(rpisense_js->keys_desc); ++ } ++ } ++ rpisense_client_dev_register(rpisense, "rpi-sense-js", ++ &(rpisense->joystick.pdev)); ++ rpisense_client_dev_register(rpisense, "rpi-sense-fb", ++ &(rpisense->framebuffer.pdev)); ++ ++ return 0; ++} ++ ++static int rpisense_remove(struct i2c_client *i2c) ++{ ++ struct rpisense *rpisense = i2c_get_clientdata(i2c); ++ ++ platform_device_unregister(rpisense->joystick.pdev); ++ return 0; ++} ++ ++struct rpisense *rpisense_get_dev(void) ++{ ++ return rpisense; ++} ++EXPORT_SYMBOL_GPL(rpisense_get_dev); ++ ++s32 rpisense_reg_read(struct rpisense *rpisense, int reg) ++{ ++ int ret = i2c_smbus_read_byte_data(rpisense->i2c_client, reg); ++ ++ if (ret < 0) ++ dev_err(rpisense->dev, "Read from reg %d failed\n", reg); ++ /* Due to the BCM270x I2C clock stretching bug, some values ++ * may have MSB set. Clear it to avoid incorrect values. ++ * */ ++ return ret & 0x7F; ++} ++EXPORT_SYMBOL_GPL(rpisense_reg_read); ++ ++int rpisense_block_write(struct rpisense *rpisense, const char *buf, int count) ++{ ++ int ret = i2c_master_send(rpisense->i2c_client, buf, count); ++ ++ if (ret < 0) ++ dev_err(rpisense->dev, "Block write failed\n"); ++ return ret; ++} ++EXPORT_SYMBOL_GPL(rpisense_block_write); ++ ++static const struct i2c_device_id rpisense_i2c_id[] = { ++ { "rpi-sense", 0 }, ++ { } ++}; ++MODULE_DEVICE_TABLE(i2c, rpisense_i2c_id); ++ ++ ++static struct i2c_driver rpisense_driver = { ++ .driver = { ++ .name = "rpi-sense", ++ .owner = THIS_MODULE, ++ }, ++ .probe = rpisense_probe, ++ .remove = rpisense_remove, ++ .id_table = rpisense_i2c_id, ++}; ++ ++module_i2c_driver(rpisense_driver); ++ ++MODULE_DESCRIPTION("Raspberry Pi Sense HAT core driver"); ++MODULE_AUTHOR("Serge Schneider <serge@raspberrypi.org>"); ++MODULE_LICENSE("GPL"); ++ +diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig +index ee72c3a..5be1a31 100644 +--- a/drivers/video/fbdev/Kconfig ++++ b/drivers/video/fbdev/Kconfig +@@ -2502,3 +2502,16 @@ config FB_SM712 + This driver is also available as a module. The module will be + called sm712fb. If you want to compile it as a module, say M + here and read <file:Documentation/kbuild/modules.txt>. ++ ++config FB_RPISENSE ++ tristate "Raspberry Pi Sense HAT framebuffer" ++ depends on FB ++ select MFD_RPISENSE_CORE ++ select FB_SYS_FOPS ++ select FB_SYS_FILLRECT ++ select FB_SYS_COPYAREA ++ select FB_SYS_IMAGEBLIT ++ select FB_DEFERRED_IO ++ ++ help ++ This is the framebuffer driver for the Raspberry Pi Sense HAT +diff --git a/drivers/video/fbdev/Makefile b/drivers/video/fbdev/Makefile +index df473d8..474c567 100644 +--- a/drivers/video/fbdev/Makefile ++++ b/drivers/video/fbdev/Makefile +@@ -149,6 +149,7 @@ obj-$(CONFIG_FB_DA8XX) += da8xx-fb.o + obj-$(CONFIG_FB_MXS) += mxsfb.o + obj-$(CONFIG_FB_SSD1307) += ssd1307fb.o + obj-$(CONFIG_FB_SIMPLE) += simplefb.o ++obj-$(CONFIG_FB_RPISENSE) += rpisense-fb.o + + # the test framebuffer is last + obj-$(CONFIG_FB_VIRTUAL) += vfb.o +diff --git a/drivers/video/fbdev/rpisense-fb.c b/drivers/video/fbdev/rpisense-fb.c +new file mode 100644 +index 0000000..26432a5 +--- /dev/null ++++ b/drivers/video/fbdev/rpisense-fb.c +@@ -0,0 +1,293 @@ ++/* ++ * Raspberry Pi Sense HAT framebuffer driver ++ * http://raspberrypi.org ++ * ++ * Copyright (C) 2015 Raspberry Pi ++ * ++ * Author: Serge Schneider ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License as published by the ++ * Free Software Foundation; either version 2 of the License, or (at your ++ * option) any later version. ++ * ++ */ ++ ++#include <linux/module.h> ++#include <linux/kernel.h> ++#include <linux/errno.h> ++#include <linux/string.h> ++#include <linux/mm.h> ++#include <linux/slab.h> ++#include <linux/uaccess.h> ++#include <linux/delay.h> ++#include <linux/fb.h> ++#include <linux/init.h> ++ ++#include <linux/mfd/rpisense/framebuffer.h> ++#include <linux/mfd/rpisense/core.h> ++ ++static bool lowlight; ++module_param(lowlight, bool, 0); ++MODULE_PARM_DESC(lowlight, "Reduce LED matrix brightness to one third"); ++ ++static struct rpisense *rpisense; ++ ++struct rpisense_fb_param { ++ char __iomem *vmem; ++ u8 *vmem_work; ++ u32 vmemsize; ++ u8 *gamma; ++}; ++ ++static u8 gamma_default[32] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, ++ 0x02, 0x02, 0x03, 0x03, 0x04, 0x05, 0x06, 0x07, ++ 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0E, 0x0F, 0x11, ++ 0x12, 0x14, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F,}; ++ ++static u8 gamma_low[32] = {0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, ++ 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, ++ 0x03, 0x03, 0x03, 0x04, 0x04, 0x05, 0x05, 0x06, ++ 0x06, 0x07, 0x07, 0x08, 0x08, 0x09, 0x0A, 0x0A,}; ++ ++static u8 gamma_user[32]; ++ ++static struct rpisense_fb_param rpisense_fb_param = { ++ .vmem = NULL, ++ .vmemsize = 128, ++ .gamma = gamma_default, ++}; ++ ++static struct fb_deferred_io rpisense_fb_defio; ++ ++static struct fb_fix_screeninfo rpisense_fb_fix = { ++ .id = "RPi-Sense FB", ++ .type = FB_TYPE_PACKED_PIXELS, ++ .visual = FB_VISUAL_TRUECOLOR, ++ .xpanstep = 0, ++ .ypanstep = 0, ++ .ywrapstep = 0, ++ .accel = FB_ACCEL_NONE, ++ .line_length = 16, ++}; ++ ++static struct fb_var_screeninfo rpisense_fb_var = { ++ .xres = 8, ++ .yres = 8, ++ .xres_virtual = 8, ++ .yres_virtual = 8, ++ .bits_per_pixel = 16, ++ .red = {11, 5, 0}, ++ .green = {5, 6, 0}, ++ .blue = {0, 5, 0}, ++}; ++ ++static ssize_t rpisense_fb_write(struct fb_info *info, ++ const char __user *buf, size_t count, ++ loff_t *ppos) ++{ ++ ssize_t res = fb_sys_write(info, buf, count, ppos); ++ ++ schedule_delayed_work(&info->deferred_work, rpisense_fb_defio.delay); ++ return res; ++} ++ ++static void rpisense_fb_fillrect(struct fb_info *info, ++ const struct fb_fillrect *rect) ++{ ++ sys_fillrect(info, rect); ++ schedule_delayed_work(&info->deferred_work, rpisense_fb_defio.delay); ++} ++ ++static void rpisense_fb_copyarea(struct fb_info *info, ++ const struct fb_copyarea *area) ++{ ++ sys_copyarea(info, area); ++ schedule_delayed_work(&info->deferred_work, rpisense_fb_defio.delay); ++} ++ ++static void rpisense_fb_imageblit(struct fb_info *info, ++ const struct fb_image *image) ++{ ++ sys_imageblit(info, image); ++ schedule_delayed_work(&info->deferred_work, rpisense_fb_defio.delay); ++} ++ ++static void rpisense_fb_deferred_io(struct fb_info *info, ++ struct list_head *pagelist) ++{ ++ int i; ++ int j; ++ u8 *vmem_work = rpisense_fb_param.vmem_work; ++ u16 *mem = (u16 *)rpisense_fb_param.vmem; ++ u8 *gamma = rpisense_fb_param.gamma; ++ ++ vmem_work[0] = 0; ++ for (j = 0; j < 8; j++) { ++ for (i = 0; i < 8; i++) { ++ vmem_work[(j * 24) + i + 1] = ++ gamma[(mem[(j * 8) + i] >> 11) & 0x1F]; ++ vmem_work[(j * 24) + (i + 8) + 1] = ++ gamma[(mem[(j * 8) + i] >> 6) & 0x1F]; ++ vmem_work[(j * 24) + (i + 16) + 1] = ++ gamma[(mem[(j * 8) + i]) & 0x1F]; ++ } ++ } ++ rpisense_block_write(rpisense, vmem_work, 193); ++} ++ ++static struct fb_deferred_io rpisense_fb_defio = { ++ .delay = HZ/100, ++ .deferred_io = rpisense_fb_deferred_io, ++}; ++ ++static int rpisense_fb_ioctl(struct fb_info *info, unsigned int cmd, ++ unsigned long arg) ++{ ++ switch (cmd) { ++ case SENSEFB_FBIOGET_GAMMA: ++ if (copy_to_user((void __user *) arg, rpisense_fb_param.gamma, ++ sizeof(u8[32]))) ++ return -EFAULT; ++ return 0; ++ case SENSEFB_FBIOSET_GAMMA: ++ if (copy_from_user(gamma_user, (void __user *)arg, ++ sizeof(u8[32]))) ++ return -EFAULT; ++ rpisense_fb_param.gamma = gamma_user; ++ schedule_delayed_work(&info->deferred_work, ++ rpisense_fb_defio.delay); ++ return 0; ++ case SENSEFB_FBIORESET_GAMMA: ++ switch (arg) { ++ case 0: ++ rpisense_fb_param.gamma = gamma_default; ++ break; ++ case 1: ++ rpisense_fb_param.gamma = gamma_low; ++ break; ++ case 2: ++ rpisense_fb_param.gamma = gamma_user; ++ break; ++ default: ++ return -EINVAL; ++ } ++ schedule_delayed_work(&info->deferred_work, ++ rpisense_fb_defio.delay); ++ break; ++ default: ++ return -EINVAL; ++ } ++ return 0; ++} ++ ++static struct fb_ops rpisense_fb_ops = { ++ .owner = THIS_MODULE, ++ .fb_read = fb_sys_read, ++ .fb_write = rpisense_fb_write, ++ .fb_fillrect = rpisense_fb_fillrect, ++ .fb_copyarea = rpisense_fb_copyarea, ++ .fb_imageblit = rpisense_fb_imageblit, ++ .fb_ioctl = rpisense_fb_ioctl, ++}; ++ ++static int rpisense_fb_probe(struct platform_device *pdev) ++{ ++ struct fb_info *info; ++ int ret = -ENOMEM; ++ struct rpisense_fb *rpisense_fb; ++ ++ rpisense = rpisense_get_dev(); ++ rpisense_fb = &rpisense->framebuffer; ++ ++ rpisense_fb_param.vmem = vzalloc(rpisense_fb_param.vmemsize); ++ if (!rpisense_fb_param.vmem) ++ return ret; ++ ++ rpisense_fb_param.vmem_work = devm_kmalloc(&pdev->dev, 193, GFP_KERNEL); ++ if (!rpisense_fb_param.vmem_work) ++ goto err_malloc; ++ ++ info = framebuffer_alloc(0, &pdev->dev); ++ if (!info) { ++ dev_err(&pdev->dev, "Could not allocate framebuffer.\n"); ++ goto err_malloc; ++ } ++ rpisense_fb->info = info; ++ ++ rpisense_fb_fix.smem_start = (unsigned long)rpisense_fb_param.vmem; ++ rpisense_fb_fix.smem_len = rpisense_fb_param.vmemsize; ++ ++ info->fbops = &rpisense_fb_ops; ++ info->fix = rpisense_fb_fix; ++ info->var = rpisense_fb_var; ++ info->fbdefio = &rpisense_fb_defio; ++ info->flags = FBINFO_FLAG_DEFAULT | FBINFO_VIRTFB; ++ info->screen_base = rpisense_fb_param.vmem; ++ info->screen_size = rpisense_fb_param.vmemsize; ++ ++ if (lowlight) ++ rpisense_fb_param.gamma = gamma_low; ++ ++ fb_deferred_io_init(info); ++ ++ ret = register_framebuffer(info); ++ if (ret < 0) { ++ dev_err(&pdev->dev, "Could not register framebuffer.\n"); ++ goto err_fballoc; ++ } ++ ++ fb_info(info, "%s frame buffer device\n", info->fix.id); ++ schedule_delayed_work(&info->deferred_work, rpisense_fb_defio.delay); ++ return 0; ++err_fballoc: ++ framebuffer_release(info); ++err_malloc: ++ vfree(rpisense_fb_param.vmem); ++ return ret; ++} ++ ++static int rpisense_fb_remove(struct platform_device *pdev) ++{ ++ struct rpisense_fb *rpisense_fb = &rpisense->framebuffer; ++ struct fb_info *info = rpisense_fb->info; ++ ++ if (info) { ++ unregister_framebuffer(info); ++ fb_deferred_io_cleanup(info); ++ framebuffer_release(info); ++ vfree(rpisense_fb_param.vmem); ++ } ++ ++ return 0; ++} ++ ++#ifdef CONFIG_OF ++static const struct of_device_id rpisense_fb_id[] = { ++ { .compatible = "rpi,rpi-sense-fb" }, ++ { }, ++}; ++MODULE_DEVICE_TABLE(of, rpisense_fb_id); ++#endif ++ ++static struct platform_device_id rpisense_fb_device_id[] = { ++ { .name = "rpi-sense-fb" }, ++ { }, ++}; ++MODULE_DEVICE_TABLE(platform, rpisense_fb_device_id); ++ ++static struct platform_driver rpisense_fb_driver = { ++ .probe = rpisense_fb_probe, ++ .remove = rpisense_fb_remove, ++ .driver = { ++ .name = "rpi-sense-fb", ++ .owner = THIS_MODULE, ++ }, ++}; ++ ++module_platform_driver(rpisense_fb_driver); ++ ++MODULE_DESCRIPTION("Raspberry Pi Sense HAT framebuffer driver"); ++MODULE_AUTHOR("Serge Schneider <serge@raspberrypi.org>"); ++MODULE_LICENSE("GPL"); ++ +diff --git a/include/linux/mfd/rpisense/core.h b/include/linux/mfd/rpisense/core.h +new file mode 100644 +index 0000000..4856aa3 +--- /dev/null ++++ b/include/linux/mfd/rpisense/core.h +@@ -0,0 +1,47 @@ ++/* ++ * Raspberry Pi Sense HAT core driver ++ * http://raspberrypi.org ++ * ++ * Copyright (C) 2015 Raspberry Pi ++ * ++ * Author: Serge Schneider ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License as published by the ++ * Free Software Foundation; either version 2 of the License, or (at your ++ * option) any later version. ++ * ++ */ ++ ++#ifndef __LINUX_MFD_RPISENSE_CORE_H_ ++#define __LINUX_MFD_RPISENSE_CORE_H_ ++ ++#include <linux/mfd/rpisense/joystick.h> ++#include <linux/mfd/rpisense/framebuffer.h> ++ ++/* ++ * Register values. ++ */ ++#define RPISENSE_FB 0x00 ++#define RPISENSE_WAI 0xF0 ++#define RPISENSE_VER 0xF1 ++#define RPISENSE_KEYS 0xF2 ++#define RPISENSE_EE_WP 0xF3 ++ ++#define RPISENSE_ID 's' ++ ++struct rpisense { ++ struct device *dev; ++ struct i2c_client *i2c_client; ++ ++ /* Client devices */ ++ struct rpisense_js joystick; ++ struct rpisense_fb framebuffer; ++}; ++ ++struct rpisense *rpisense_get_dev(void); ++s32 rpisense_reg_read(struct rpisense *rpisense, int reg); ++int rpisense_reg_write(struct rpisense *rpisense, int reg, u16 val); ++int rpisense_block_write(struct rpisense *rpisense, const char *buf, int count); ++ ++#endif +diff --git a/include/linux/mfd/rpisense/framebuffer.h b/include/linux/mfd/rpisense/framebuffer.h +new file mode 100644 +index 0000000..2ba95d7 +--- /dev/null ++++ b/include/linux/mfd/rpisense/framebuffer.h +@@ -0,0 +1,32 @@ ++/* ++ * Raspberry Pi Sense HAT framebuffer driver ++ * http://raspberrypi.org ++ * ++ * Copyright (C) 2015 Raspberry Pi ++ * ++ * Author: Serge Schneider ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License as published by the ++ * Free Software Foundation; either version 2 of the License, or (at your ++ * option) any later version. ++ * ++ */ ++ ++#ifndef __LINUX_RPISENSE_FB_H_ ++#define __LINUX_RPISENSE_FB_H_ ++ ++#define SENSEFB_FBIO_IOC_MAGIC 0xF1 ++ ++#define SENSEFB_FBIOGET_GAMMA _IO(SENSEFB_FBIO_IOC_MAGIC, 0) ++#define SENSEFB_FBIOSET_GAMMA _IO(SENSEFB_FBIO_IOC_MAGIC, 1) ++#define SENSEFB_FBIORESET_GAMMA _IO(SENSEFB_FBIO_IOC_MAGIC, 2) ++ ++struct rpisense; ++ ++struct rpisense_fb { ++ struct platform_device *pdev; ++ struct fb_info *info; ++}; ++ ++#endif +diff --git a/include/linux/mfd/rpisense/joystick.h b/include/linux/mfd/rpisense/joystick.h +new file mode 100644 +index 0000000..56196dc +--- /dev/null ++++ b/include/linux/mfd/rpisense/joystick.h +@@ -0,0 +1,35 @@ ++/* ++ * Raspberry Pi Sense HAT joystick driver ++ * http://raspberrypi.org ++ * ++ * Copyright (C) 2015 Raspberry Pi ++ * ++ * Author: Serge Schneider ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License as published by the ++ * Free Software Foundation; either version 2 of the License, or (at your ++ * option) any later version. ++ * ++ */ ++ ++#ifndef __LINUX_RPISENSE_JOYSTICK_H_ ++#define __LINUX_RPISENSE_JOYSTICK_H_ ++ ++#include <linux/input.h> ++#include <linux/interrupt.h> ++#include <linux/gpio/consumer.h> ++#include <linux/platform_device.h> ++ ++struct rpisense; ++ ++struct rpisense_js { ++ struct platform_device *pdev; ++ struct input_dev *keys_dev; ++ struct gpio_desc *keys_desc; ++ struct work_struct keys_work_s; ++ int keys_irq; ++}; ++ ++ ++#endif + +From 4b70a98f86ebee7fe728cc485ce689ea8f842ab6 Mon Sep 17 00:00:00 2001 +From: Jan Grulich <jan@grulich.eu> +Date: Mon, 24 Aug 2015 16:03:47 +0100 +Subject: [PATCH 082/112] RaspiDAC3 support + +Signed-off-by: Jan Grulich <jan@grulich.eu> + +config: fix RaspiDAC Rev.3x dependencies + +Change depends to SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S +like the other I2S soundcard drivers. + +Signed-off-by: Matthias Reichl <hias@horus.com> +--- + sound/soc/bcm/Kconfig | 8 ++ + sound/soc/bcm/Makefile | 2 + + sound/soc/bcm/raspidac3.c | 192 ++++++++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 202 insertions(+) + create mode 100644 sound/soc/bcm/raspidac3.c + +diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig +index 8669a9a..1a3f826 100644 +--- a/sound/soc/bcm/Kconfig ++++ b/sound/soc/bcm/Kconfig +@@ -56,3 +56,11 @@ config SND_BCM2708_SOC_IQAUDIO_DAC + select SND_SOC_PCM512x_I2C + help + Say Y or M if you want to add support for IQaudIO-DAC. ++ ++config SND_BCM2708_SOC_RASPIDAC3 ++ tristate "Support for RaspiDAC Rev.3x" ++ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S ++ select SND_SOC_PCM512x_I2C ++ select SND_SOC_TPA6130A2 ++ help ++ Say Y or M if you want to add support for RaspiDAC Rev.3x. +diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile +index 4f5ab1f..b21e11e 100644 +--- a/sound/soc/bcm/Makefile ++++ b/sound/soc/bcm/Makefile +@@ -11,6 +11,7 @@ snd-soc-hifiberry-amp-objs := hifiberry_amp.o + snd-soc-rpi-dac-objs := rpi-dac.o + snd-soc-rpi-proto-objs := rpi-proto.o + snd-soc-iqaudio-dac-objs := iqaudio-dac.o ++snd-soc-raspidac3-objs := raspidac3.o + + obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o + obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS) += snd-soc-hifiberry-dacplus.o +@@ -19,3 +20,4 @@ obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_AMP) += snd-soc-hifiberry-amp.o + obj-$(CONFIG_SND_BCM2708_SOC_RPI_DAC) += snd-soc-rpi-dac.o + obj-$(CONFIG_SND_BCM2708_SOC_RPI_PROTO) += snd-soc-rpi-proto.o + obj-$(CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC) += snd-soc-iqaudio-dac.o ++obj-$(CONFIG_SND_BCM2708_SOC_RASPIDAC3) += snd-soc-raspidac3.o +diff --git a/sound/soc/bcm/raspidac3.c b/sound/soc/bcm/raspidac3.c +new file mode 100644 +index 0000000..e7422e2 +--- /dev/null ++++ b/sound/soc/bcm/raspidac3.c +@@ -0,0 +1,192 @@ ++/* ++ * ASoC Driver for RaspiDAC v3 ++ * ++ * Author: Jan Grulich <jan@grulich.eu> ++ * Copyright 2015 ++ * based on code by Daniel Matuschek <daniel@hifiberry.com> ++ * based on code by Florian Meier <florian.meier@koalo.de> ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * version 2 as published by the Free Software Foundation. ++ * ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * General Public License for more details. ++ */ ++ ++#include <linux/module.h> ++#include <linux/platform_device.h> ++ ++#include <sound/core.h> ++#include <sound/pcm.h> ++#include <sound/pcm_params.h> ++#include <sound/soc.h> ++#include <sound/jack.h> ++#include <sound/soc-dapm.h> ++ ++#include "../codecs/pcm512x.h" ++#include "../codecs/tpa6130a2.h" ++ ++/* sound card init */ ++static int snd_rpi_raspidac3_init(struct snd_soc_pcm_runtime *rtd) ++{ ++ int ret; ++ struct snd_soc_card *card = rtd->card; ++ struct snd_soc_codec *codec = rtd->codec; ++ snd_soc_update_bits(codec, PCM512x_GPIO_EN, 0x08, 0x08); ++ snd_soc_update_bits(codec, PCM512x_GPIO_OUTPUT_4, 0xf, 0x02); ++ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x08,0x00); ++ ++ ret = snd_soc_limit_volume(card, "Digital Playback Volume", 207); ++ if (ret < 0) ++ dev_warn(card->dev, "Failed to set volume limit: %d\n", ret); ++ else { ++ struct snd_kcontrol *kctl; ++ ++ ret = tpa6130a2_add_controls(codec); ++ if (ret < 0) ++ dev_warn(card->dev, "Failed to add TPA6130A2 controls: %d\n", ++ ret); ++ ret = snd_soc_limit_volume(card, ++ "TPA6130A2 Headphone Playback Volume", ++ 54); ++ if (ret < 0) ++ dev_warn(card->dev, "Failed to set TPA6130A2 volume limit: %d\n", ++ ret); ++ kctl = snd_soc_card_get_kcontrol(card, ++ "TPA6130A2 Headphone Playback Volume"); ++ if (kctl) { ++ strcpy(kctl->id.name, "Headphones Playback Volume"); ++ /* disable the volume dB scale so alsamixer works */ ++ kctl->vd[0].access = SNDRV_CTL_ELEM_ACCESS_READWRITE; ++ } ++ ++ kctl = snd_soc_card_get_kcontrol(card, ++ "TPA6130A2 Headphone Playback Switch"); ++ if (kctl) ++ strcpy(kctl->id.name, "Headphones Playback Switch"); ++ } ++ ++ return 0; ++} ++ ++/* set hw parameters */ ++static int snd_rpi_raspidac3_hw_params(struct snd_pcm_substream *substream, ++ struct snd_pcm_hw_params *params) ++{ ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; ++ ++ unsigned int sample_bits = ++ snd_pcm_format_physical_width(params_format(params)); ++ ++ return snd_soc_dai_set_bclk_ratio(cpu_dai, sample_bits * 2); ++} ++ ++/* startup */ ++static int snd_rpi_raspidac3_startup(struct snd_pcm_substream *substream) { ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_codec *codec = rtd->codec; ++ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x08,0x08); ++ tpa6130a2_stereo_enable(codec, 1); ++ return 0; ++} ++ ++/* shutdown */ ++static void snd_rpi_raspidac3_shutdown(struct snd_pcm_substream *substream) { ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_codec *codec = rtd->codec; ++ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x08,0x00); ++ tpa6130a2_stereo_enable(codec, 0); ++} ++ ++/* machine stream operations */ ++static struct snd_soc_ops snd_rpi_raspidac3_ops = { ++ .hw_params = snd_rpi_raspidac3_hw_params, ++ .startup = snd_rpi_raspidac3_startup, ++ .shutdown = snd_rpi_raspidac3_shutdown, ++}; ++ ++/* interface setup */ ++static struct snd_soc_dai_link snd_rpi_raspidac3_dai[] = { ++{ ++ .name = "RaspiDAC Rev.3x", ++ .stream_name = "RaspiDAC HiFi", ++ .cpu_dai_name = "bcm2708-i2s.0", ++ .codec_dai_name = "pcm512x-hifi", ++ .platform_name = "bcm2708-i2s.0", ++ .codec_name = "pcm512x.1-004c", ++ .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | ++ SND_SOC_DAIFMT_CBS_CFS, ++ .ops = &snd_rpi_raspidac3_ops, ++ .init = snd_rpi_raspidac3_init, ++}, ++}; ++ ++/* audio machine driver */ ++static struct snd_soc_card snd_rpi_raspidac3 = { ++ .name = "RaspiDAC Rev.3x HiFi Audio Card", ++ .owner = THIS_MODULE, ++ .dai_link = snd_rpi_raspidac3_dai, ++ .num_links = ARRAY_SIZE(snd_rpi_raspidac3_dai), ++}; ++ ++/* sound card test */ ++static int snd_rpi_raspidac3_probe(struct platform_device *pdev) ++{ ++ int ret = 0; ++ ++ snd_rpi_raspidac3.dev = &pdev->dev; ++ ++ if (pdev->dev.of_node) { ++ struct device_node *i2s_node; ++ struct snd_soc_dai_link *dai = &snd_rpi_raspidac3_dai[0]; ++ i2s_node = of_parse_phandle(pdev->dev.of_node, ++ "i2s-controller", 0); ++ ++ if (i2s_node) { ++ dai->cpu_dai_name = NULL; ++ dai->cpu_of_node = i2s_node; ++ dai->platform_name = NULL; ++ dai->platform_of_node = i2s_node; ++ } ++ } ++ ++ ret = snd_soc_register_card(&snd_rpi_raspidac3); ++ if (ret) ++ dev_err(&pdev->dev, ++ "snd_soc_register_card() failed: %d\n", ret); ++ ++ return ret; ++} ++ ++/* sound card disconnect */ ++static int snd_rpi_raspidac3_remove(struct platform_device *pdev) ++{ ++ return snd_soc_unregister_card(&snd_rpi_raspidac3); ++} ++ ++static const struct of_device_id raspidac3_of_match[] = { ++ { .compatible = "jg,raspidacv3", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, raspidac3_of_match); ++ ++/* sound card platform driver */ ++static struct platform_driver snd_rpi_raspidac3_driver = { ++ .driver = { ++ .name = "snd-rpi-raspidac3", ++ .owner = THIS_MODULE, ++ .of_match_table = raspidac3_of_match, ++ }, ++ .probe = snd_rpi_raspidac3_probe, ++ .remove = snd_rpi_raspidac3_remove, ++}; ++ ++module_platform_driver(snd_rpi_raspidac3_driver); ++ ++MODULE_AUTHOR("Jan Grulich <jan@grulich.eu>"); ++MODULE_DESCRIPTION("ASoC Driver for RaspiDAC Rev.3x"); ++MODULE_LICENSE("GPL v2"); + +From 5d9f6033f4aa5a9c0430dfec7dae4ff5b5fb1d60 Mon Sep 17 00:00:00 2001 +From: Jan Grulich <jan@grulich.eu> +Date: Mon, 24 Aug 2015 16:02:34 +0100 +Subject: [PATCH 083/112] tpa6130a2: Add headphone switch control + +Signed-off-by: Jan Grulich <jan@grulich.eu> +--- + sound/soc/codecs/tpa6130a2.c | 29 ++++++++++++++++++++++++++--- + 1 file changed, 26 insertions(+), 3 deletions(-) + +diff --git a/sound/soc/codecs/tpa6130a2.c b/sound/soc/codecs/tpa6130a2.c +index 11d85c5..3caaa17 100644 +--- a/sound/soc/codecs/tpa6130a2.c ++++ b/sound/soc/codecs/tpa6130a2.c +@@ -4,6 +4,7 @@ + * Copyright (C) Nokia Corporation + * + * Author: Peter Ujfalusi <peter.ujfalusi@ti.com> ++ * Modified: Jan Grulich <jan@grulich.eu> + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License +@@ -52,6 +53,8 @@ struct tpa6130a2_data { + enum tpa_model id; + }; + ++static void tpa6130a2_channel_enable(u8 channel, int enable); ++ + static int tpa6130a2_i2c_read(int reg) + { + struct tpa6130a2_data *data; +@@ -189,7 +192,7 @@ exit: + } + + static int tpa6130a2_get_volsw(struct snd_kcontrol *kcontrol, +- struct snd_ctl_elem_value *ucontrol) ++ struct snd_ctl_elem_value *ucontrol) + { + struct soc_mixer_control *mc = + (struct soc_mixer_control *)kcontrol->private_value; +@@ -218,7 +221,7 @@ static int tpa6130a2_get_volsw(struct snd_kcontrol *kcontrol, + } + + static int tpa6130a2_put_volsw(struct snd_kcontrol *kcontrol, +- struct snd_ctl_elem_value *ucontrol) ++ struct snd_ctl_elem_value *ucontrol) + { + struct soc_mixer_control *mc = + (struct soc_mixer_control *)kcontrol->private_value; +@@ -255,8 +258,22 @@ static int tpa6130a2_put_volsw(struct snd_kcontrol *kcontrol, + return 1; + } + ++static int tpa6130a2_put_hp_sw(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol) ++{ ++ int enable = ucontrol->value.integer.value[0]; ++ unsigned int state; ++ ++ state = (tpa6130a2_read(TPA6130A2_REG_VOL_MUTE) & 0x80) == 0; ++ if (state == enable) ++ return 0; /* No change */ ++ ++ tpa6130a2_channel_enable(TPA6130A2_HP_EN_R | TPA6130A2_HP_EN_L, enable); ++ return 1; /* Changed */ ++} ++ + /* +- * TPA6130 volume. From -59.5 to 4 dB with increasing step size when going ++ * TPA6130 volume. From -59.5 to +4.0 dB with increasing step size when going + * down in gain. + */ + static const DECLARE_TLV_DB_RANGE(tpa6130_tlv, +@@ -277,6 +294,9 @@ static const struct snd_kcontrol_new tpa6130a2_controls[] = { + TPA6130A2_REG_VOL_MUTE, 0, 0x3f, 0, + tpa6130a2_get_volsw, tpa6130a2_put_volsw, + tpa6130_tlv), ++ SOC_SINGLE_EXT("TPA6130A2 Headphone Playback Switch", ++ TPA6130A2_REG_VOL_MUTE, 7, 1, 1, ++ tpa6130a2_get_volsw, tpa6130a2_put_hp_sw), + }; + + static const DECLARE_TLV_DB_RANGE(tpa6140_tlv, +@@ -290,6 +310,9 @@ static const struct snd_kcontrol_new tpa6140a2_controls[] = { + TPA6130A2_REG_VOL_MUTE, 1, 0x1f, 0, + tpa6130a2_get_volsw, tpa6130a2_put_volsw, + tpa6140_tlv), ++ SOC_SINGLE_EXT("TPA6140A2 Headphone Playback Switch", ++ TPA6130A2_REG_VOL_MUTE, 7, 1, 1, ++ tpa6130a2_get_volsw, tpa6130a2_put_hp_sw), + }; + + /* + +From 5859bcaed12501a27b5ac8adb573eccb739bbc7e Mon Sep 17 00:00:00 2001 +From: P33M <P33M@github.com> +Date: Wed, 21 Oct 2015 14:55:21 +0100 +Subject: [PATCH 084/112] rpi_display: add backlight driver and overlay + +Add a mailbox-driven backlight controller for the Raspberry Pi DSI +touchscreen display. Requires updated GPU firmware to recognise the +mailbox request. + +Signed-off-by: Gordon Hollingworth <gordon@raspberrypi.org> +--- + drivers/video/backlight/Kconfig | 6 ++ + drivers/video/backlight/Makefile | 1 + + drivers/video/backlight/rpi_backlight.c | 119 ++++++++++++++++++++++++++++++++ + 3 files changed, 126 insertions(+) + create mode 100644 drivers/video/backlight/rpi_backlight.c + +diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig +index 5ffa4b4..c3023ab 100644 +--- a/drivers/video/backlight/Kconfig ++++ b/drivers/video/backlight/Kconfig +@@ -265,6 +265,12 @@ config BACKLIGHT_PWM + If you have a LCD backlight adjustable by PWM, say Y to enable + this driver. + ++config BACKLIGHT_RPI ++ tristate "Raspberry Pi display firmware driven backlight" ++ help ++ If you have the Raspberry Pi DSI touchscreen display, say Y to ++ enable the mailbox-controlled backlight driver. ++ + config BACKLIGHT_DA903X + tristate "Backlight Driver for DA9030/DA9034 using WLED" + depends on PMIC_DA903X +diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile +index 16ec534..00eff87 100644 +--- a/drivers/video/backlight/Makefile ++++ b/drivers/video/backlight/Makefile +@@ -50,6 +50,7 @@ obj-$(CONFIG_BACKLIGHT_PANDORA) += pandora_bl.o + obj-$(CONFIG_BACKLIGHT_PCF50633) += pcf50633-backlight.o + obj-$(CONFIG_BACKLIGHT_PM8941_WLED) += pm8941-wled.o + obj-$(CONFIG_BACKLIGHT_PWM) += pwm_bl.o ++obj-$(CONFIG_BACKLIGHT_RPI) += rpi_backlight.o + obj-$(CONFIG_BACKLIGHT_SAHARA) += kb3886_bl.o + obj-$(CONFIG_BACKLIGHT_SKY81452) += sky81452-backlight.o + obj-$(CONFIG_BACKLIGHT_TOSA) += tosa_bl.o +diff --git a/drivers/video/backlight/rpi_backlight.c b/drivers/video/backlight/rpi_backlight.c +new file mode 100644 +index 0000000..14a0d9b +--- /dev/null ++++ b/drivers/video/backlight/rpi_backlight.c +@@ -0,0 +1,119 @@ ++/* ++ * rpi_bl.c - Backlight controller through VPU ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 as ++ * published by the Free Software Foundation. ++ */ ++ ++#include <linux/backlight.h> ++#include <linux/err.h> ++#include <linux/fb.h> ++#include <linux/gpio.h> ++#include <linux/init.h> ++#include <linux/kernel.h> ++#include <linux/module.h> ++#include <linux/of.h> ++#include <linux/of_gpio.h> ++#include <linux/platform_device.h> ++#include <linux/slab.h> ++#include <soc/bcm2835/raspberrypi-firmware.h> ++ ++struct rpi_backlight { ++ struct device *dev; ++ struct device *fbdev; ++ struct rpi_firmware *fw; ++}; ++ ++static int rpi_backlight_update_status(struct backlight_device *bl) ++{ ++ struct rpi_backlight *gbl = bl_get_data(bl); ++ int brightness = bl->props.brightness; ++ int ret; ++ ++ if (bl->props.power != FB_BLANK_UNBLANK || ++ bl->props.fb_blank != FB_BLANK_UNBLANK || ++ bl->props.state & (BL_CORE_SUSPENDED | BL_CORE_FBBLANK)) ++ brightness = 0; ++ ++ ret = rpi_firmware_property(gbl->fw, ++ RPI_FIRMWARE_FRAMEBUFFER_SET_BACKLIGHT, ++ &brightness, sizeof(brightness)); ++ if (ret) { ++ dev_err(gbl->dev, "Failed to set brightness\n"); ++ return ret; ++ } ++ ++ if (brightness < 0) { ++ dev_err(gbl->dev, "Backlight change failed\n"); ++ return -EAGAIN; ++ } ++ ++ return 0; ++} ++ ++static const struct backlight_ops rpi_backlight_ops = { ++ .options = BL_CORE_SUSPENDRESUME, ++ .update_status = rpi_backlight_update_status, ++}; ++ ++static int rpi_backlight_probe(struct platform_device *pdev) ++{ ++ struct backlight_properties props; ++ struct backlight_device *bl; ++ struct rpi_backlight *gbl; ++ struct device_node *fw_node; ++ ++ gbl = devm_kzalloc(&pdev->dev, sizeof(*gbl), GFP_KERNEL); ++ if (gbl == NULL) ++ return -ENOMEM; ++ ++ gbl->dev = &pdev->dev; ++ ++ fw_node = of_parse_phandle(pdev->dev.of_node, "firmware", 0); ++ if (!fw_node) { ++ dev_err(&pdev->dev, "Missing firmware node\n"); ++ return -ENOENT; ++ } ++ ++ gbl->fw = rpi_firmware_get(fw_node); ++ if (!gbl->fw) ++ return -EPROBE_DEFER; ++ ++ memset(&props, 0, sizeof(props)); ++ props.type = BACKLIGHT_RAW; ++ props.max_brightness = 255; ++ bl = devm_backlight_device_register(&pdev->dev, dev_name(&pdev->dev), ++ &pdev->dev, gbl, &rpi_backlight_ops, ++ &props); ++ if (IS_ERR(bl)) { ++ dev_err(&pdev->dev, "failed to register backlight\n"); ++ return PTR_ERR(bl); ++ } ++ ++ bl->props.brightness = 255; ++ backlight_update_status(bl); ++ ++ platform_set_drvdata(pdev, bl); ++ return 0; ++} ++ ++static const struct of_device_id rpi_backlight_of_match[] = { ++ { .compatible = "raspberrypi,rpi-backlight" }, ++ { /* sentinel */ } ++}; ++MODULE_DEVICE_TABLE(of, rpi_backlight_of_match); ++ ++static struct platform_driver rpi_backlight_driver = { ++ .driver = { ++ .name = "rpi-backlight", ++ .of_match_table = of_match_ptr(rpi_backlight_of_match), ++ }, ++ .probe = rpi_backlight_probe, ++}; ++ ++module_platform_driver(rpi_backlight_driver); ++ ++MODULE_AUTHOR("Gordon Hollingworth <gordon@raspberrypi.org>"); ++MODULE_DESCRIPTION("Raspberry Pi mailbox based Backlight Driver"); ++MODULE_LICENSE("GPL"); + +From 8b5f29a6c47607b328c57a67aca43a9f46f779c6 Mon Sep 17 00:00:00 2001 +From: popcornmix <popcornmix@gmail.com> +Date: Tue, 23 Feb 2016 19:56:04 +0000 +Subject: [PATCH 085/112] bcm2835-virtgpio: Virtual GPIO driver + +Add a virtual GPIO driver that uses the firmware mailbox interface to +request that the VPU toggles LEDs. +--- + drivers/gpio/Kconfig | 6 ++ + drivers/gpio/Makefile | 1 + + drivers/gpio/gpio-bcm-virt.c | 179 +++++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 186 insertions(+) + create mode 100644 drivers/gpio/gpio-bcm-virt.c + +diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig +index 5f3429f..86cb971 100644 +--- a/drivers/gpio/Kconfig ++++ b/drivers/gpio/Kconfig +@@ -142,6 +142,12 @@ config GPIO_BCM_KONA + help + Turn on GPIO support for Broadcom "Kona" chips. + ++config GPIO_BCM_VIRT ++ bool "Broadcom Virt GPIO" ++ depends on OF_GPIO && RASPBERRYPI_FIRMWARE && (ARCH_BCM2835 || ARCH_BCM2708 || ARCH_BCM2709 || COMPILE_TEST) ++ help ++ Turn on virtual GPIO support for Broadcom BCM283X chips. ++ + config GPIO_BRCMSTB + tristate "BRCMSTB GPIO support" + default y if (ARCH_BRCMSTB || BMIPS_GENERIC) +diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile +index 1e0b74f..908596d 100644 +--- a/drivers/gpio/Makefile ++++ b/drivers/gpio/Makefile +@@ -26,6 +26,7 @@ obj-$(CONFIG_GPIO_AMDPT) += gpio-amdpt.o + obj-$(CONFIG_GPIO_ARIZONA) += gpio-arizona.o + obj-$(CONFIG_GPIO_ATH79) += gpio-ath79.o + obj-$(CONFIG_GPIO_BCM_KONA) += gpio-bcm-kona.o ++obj-$(CONFIG_GPIO_BCM_VIRT) += gpio-bcm-virt.o + obj-$(CONFIG_GPIO_BRCMSTB) += gpio-brcmstb.o + obj-$(CONFIG_GPIO_BT8XX) += gpio-bt8xx.o + obj-$(CONFIG_GPIO_CLPS711X) += gpio-clps711x.o +diff --git a/drivers/gpio/gpio-bcm-virt.c b/drivers/gpio/gpio-bcm-virt.c +new file mode 100644 +index 0000000..f3e0f16 +--- /dev/null ++++ b/drivers/gpio/gpio-bcm-virt.c +@@ -0,0 +1,179 @@ ++/* ++ * brcmvirt GPIO driver ++ * ++ * Copyright (C) 2012,2013 Dom Cobley <popcornmix@gmail.com> ++ * Based on gpio-clps711x.c by Alexander Shiyan <shc_work@mail.ru> ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ */ ++ ++#include <linux/err.h> ++#include <linux/gpio.h> ++#include <linux/module.h> ++#include <linux/platform_device.h> ++#include <soc/bcm2835/raspberrypi-firmware.h> ++ ++#define MODULE_NAME "brcmvirt-gpio" ++#define NUM_GPIO 2 ++ ++struct brcmvirt_gpio { ++ struct gpio_chip gc; ++ u32 __iomem *ts_base; ++ /* two packed 16-bit counts of enabled and disables ++ Allows host to detect a brief enable that was missed */ ++ u32 enables_disables[NUM_GPIO]; ++}; ++ ++static int brcmvirt_gpio_dir_in(struct gpio_chip *gc, unsigned off) ++{ ++ struct brcmvirt_gpio *gpio; ++ gpio = container_of(gc, struct brcmvirt_gpio, gc); ++ return -EINVAL; ++} ++ ++static int brcmvirt_gpio_dir_out(struct gpio_chip *gc, unsigned off, int val) ++{ ++ struct brcmvirt_gpio *gpio; ++ gpio = container_of(gc, struct brcmvirt_gpio, gc); ++ return 0; ++} ++ ++static int brcmvirt_gpio_get(struct gpio_chip *gc, unsigned off) ++{ ++ struct brcmvirt_gpio *gpio; ++ unsigned v; ++ gpio = container_of(gc, struct brcmvirt_gpio, gc); ++ v = readl(gpio->ts_base + off); ++ return (v >> off) & 1; ++} ++ ++static void brcmvirt_gpio_set(struct gpio_chip *gc, unsigned off, int val) ++{ ++ struct brcmvirt_gpio *gpio; ++ u16 enables, disables; ++ s16 diff; ++ bool lit; ++ gpio = container_of(gc, struct brcmvirt_gpio, gc); ++ enables = gpio->enables_disables[off] >> 16; ++ disables = gpio->enables_disables[off] >> 0; ++ diff = (s16)(enables - disables); ++ lit = diff > 0; ++ if ((val && lit) || (!val && !lit)) ++ return; ++ if (val) ++ enables++; ++ else ++ disables++; ++ diff = (s16)(enables - disables); ++ BUG_ON(diff != 0 && diff != 1); ++ gpio->enables_disables[off] = (enables << 16) | (disables << 0); ++ writel(gpio->enables_disables[off], gpio->ts_base + off); ++} ++ ++static int brcmvirt_gpio_probe(struct platform_device *pdev) ++{ ++ struct device *dev = &pdev->dev; ++ struct device_node *np = dev->of_node; ++ struct device_node *fw_node; ++ struct rpi_firmware *fw; ++ struct brcmvirt_gpio *ucb; ++ u32 gpiovirtbuf; ++ int err = 0; ++ ++ fw_node = of_parse_phandle(np, "firmware", 0); ++ if (!fw_node) { ++ dev_err(dev, "Missing firmware node\n"); ++ return -ENOENT; ++ } ++ ++ fw = rpi_firmware_get(fw_node); ++ if (!fw) ++ return -EPROBE_DEFER; ++ ++ err = rpi_firmware_property(fw, RPI_FIRMWARE_FRAMEBUFFER_GET_GPIOVIRTBUF, ++ &gpiovirtbuf, sizeof(gpiovirtbuf)); ++ ++ if (err) { ++ dev_err(dev, "Failed to get gpiovirtbuf\n"); ++ goto err; ++ } ++ ++ if (!gpiovirtbuf) { ++ dev_err(dev, "No virtgpio buffer\n"); ++ err = -ENOENT; ++ goto err; ++ } ++ ++ ucb = devm_kzalloc(dev, sizeof *ucb, GFP_KERNEL); ++ if (!ucb) { ++ err = -EINVAL; ++ goto err; ++ } ++ ++ // mmap the physical memory ++ gpiovirtbuf &= ~0xc0000000; ++ ucb->ts_base = ioremap(gpiovirtbuf, 4096); ++ if (ucb->ts_base == NULL) { ++ dev_err(dev, "Failed to map physical address\n"); ++ err = -ENOENT; ++ goto err; ++ } ++ ++ ucb->gc.label = MODULE_NAME; ++ ucb->gc.owner = THIS_MODULE; ++ //ucb->gc.dev = dev; ++ ucb->gc.of_node = np; ++ ucb->gc.base = 100; ++ ucb->gc.ngpio = NUM_GPIO; ++ ++ ucb->gc.direction_input = brcmvirt_gpio_dir_in; ++ ucb->gc.direction_output = brcmvirt_gpio_dir_out; ++ ucb->gc.get = brcmvirt_gpio_get; ++ ucb->gc.set = brcmvirt_gpio_set; ++ ucb->gc.can_sleep = true; ++ ++ err = gpiochip_add(&ucb->gc); ++ if (err) ++ goto err; ++ ++ platform_set_drvdata(pdev, ucb); ++ ++err: ++ return err; ++ ++} ++ ++static int brcmvirt_gpio_remove(struct platform_device *pdev) ++{ ++ int err = 0; ++ struct brcmvirt_gpio *ucb = platform_get_drvdata(pdev); ++ ++ gpiochip_remove(&ucb->gc); ++ iounmap(ucb->ts_base); ++ return err; ++} ++ ++static const struct of_device_id __maybe_unused brcmvirt_gpio_ids[] = { ++ { .compatible = "brcm,bcm2835-virtgpio" }, ++ { } ++}; ++MODULE_DEVICE_TABLE(of, brcmvirt_gpio_ids); ++ ++static struct platform_driver brcmvirt_gpio_driver = { ++ .driver = { ++ .name = MODULE_NAME, ++ .owner = THIS_MODULE, ++ .of_match_table = of_match_ptr(brcmvirt_gpio_ids), ++ }, ++ .probe = brcmvirt_gpio_probe, ++ .remove = brcmvirt_gpio_remove, ++}; ++module_platform_driver(brcmvirt_gpio_driver); ++ ++MODULE_LICENSE("GPL"); ++MODULE_AUTHOR("Dom Cobley <popcornmix@gmail.com>"); ++MODULE_DESCRIPTION("brcmvirt GPIO driver"); ++MODULE_ALIAS("platform:brcmvirt-gpio"); + +From 4af55e5c7890f15b3ee2953fe66a7af6a35fde5d Mon Sep 17 00:00:00 2001 +From: popcornmix <popcornmix@gmail.com> +Date: Fri, 4 Mar 2016 12:49:09 +0000 +Subject: [PATCH 086/112] DRM_VC4: Allow to be built for ARCH_BCM270x + +--- + drivers/gpu/drm/vc4/Kconfig | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/vc4/Kconfig b/drivers/gpu/drm/vc4/Kconfig +index 5848104..870fea5 100644 +--- a/drivers/gpu/drm/vc4/Kconfig ++++ b/drivers/gpu/drm/vc4/Kconfig +@@ -1,6 +1,6 @@ + config DRM_VC4 + tristate "Broadcom VC4 Graphics" +- depends on ARCH_BCM2835 || COMPILE_TEST ++ depends on ARCH_BCM2835 || ARCH_BCM2708 || ARCH_BCM2709 || COMPILE_TEST + depends on DRM + select DRM_KMS_HELPER + select DRM_KMS_CMA_HELPER + +From 98b2c4aae5e4450f7fe526b36cb22d144d394f5b Mon Sep 17 00:00:00 2001 +From: Phil Elwell <phil@raspberrypi.org> +Date: Tue, 23 Feb 2016 17:26:48 +0000 +Subject: [PATCH 087/112] amba_pl011: Don't use DT aliases for numbering + +The pl011 driver looks for DT aliases of the form "serial<n>", +and if found uses <n> as the device ID. This can cause +/dev/ttyAMA0 to become /dev/ttyAMA1, which is confusing if the +other serial port is provided by the 8250 driver which doesn't +use the same logic. +--- + drivers/tty/serial/amba-pl011.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c +index 7c198e0..4f9e97b 100644 +--- a/drivers/tty/serial/amba-pl011.c ++++ b/drivers/tty/serial/amba-pl011.c +@@ -2413,7 +2413,12 @@ static int pl011_setup_port(struct device *dev, struct uart_amba_port *uap, + if (IS_ERR(base)) + return PTR_ERR(base); + ++ /* Don't use DT serial<n> aliases - it causes the device to ++ be renumbered to ttyAMA1 if it is the second serial port in the ++ system, even though the other one is ttyS0. The 8250 driver ++ doesn't use this logic, so always remains ttyS0. + index = pl011_probe_dt_alias(index, dev); ++ */ + + uap->old_cr = 0; + uap->port.dev = dev; + +From 74026743feb7e22a4393a00f227736160e146bb2 Mon Sep 17 00:00:00 2001 +From: Pantelis Antoniou <pantelis.antoniou@konsulko.com> +Date: Wed, 3 Dec 2014 13:23:28 +0200 +Subject: [PATCH 088/112] OF: DT-Overlay configfs interface + +This is a port of Pantelis Antoniou's v3 port that makes use of the +new upstreamed configfs support for binary attributes. + +Original commit message: + +Add a runtime interface to using configfs for generic device tree overlay +usage. With it its possible to use device tree overlays without having +to use a per-platform overlay manager. + +Please see Documentation/devicetree/configfs-overlays.txt for more info. + +Changes since v2: +- Removed ifdef CONFIG_OF_OVERLAY (since for now it's required) +- Created a documentation entry +- Slight rewording in Kconfig + +Changes since v1: +- of_resolve() -> of_resolve_phandles(). + +Originally-signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com> +Signed-off-by: Phil Elwell <phil@raspberrypi.org> + +DT configfs: Fix build errors on other platforms + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> + +DT configfs: fix build error + +There is an error when compiling rpi-4.6.y branch: + CC drivers/of/configfs.o +drivers/of/configfs.c:291:21: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types] + .default_groups = of_cfs_def_groups, + ^ +drivers/of/configfs.c:291:21: note: (near initialization for 'of_cfs_subsys.su_group.default_groups.next') + +The .default_groups is linked list since commit +1ae1602de028acaa42a0f6ff18d19756f8e825c6. +This commit uses configfs_add_default_group to fix this problem. + +Signed-off-by: Slawomir Stepien <sst@poczta.fm> +--- + Documentation/devicetree/configfs-overlays.txt | 31 +++ + drivers/of/Kconfig | 7 + + drivers/of/Makefile | 1 + + drivers/of/configfs.c | 311 +++++++++++++++++++++++++ + 4 files changed, 350 insertions(+) + create mode 100644 Documentation/devicetree/configfs-overlays.txt + create mode 100644 drivers/of/configfs.c + +diff --git a/Documentation/devicetree/configfs-overlays.txt b/Documentation/devicetree/configfs-overlays.txt +new file mode 100644 +index 0000000..5fa43e0 +--- /dev/null ++++ b/Documentation/devicetree/configfs-overlays.txt +@@ -0,0 +1,31 @@ ++Howto use the configfs overlay interface. ++ ++A device-tree configfs entry is created in /config/device-tree/overlays ++and and it is manipulated using standard file system I/O. ++Note that this is a debug level interface, for use by developers and ++not necessarily something accessed by normal users due to the ++security implications of having direct access to the kernel's device tree. ++ ++* To create an overlay you mkdir the directory: ++ ++ # mkdir /config/device-tree/overlays/foo ++ ++* Either you echo the overlay firmware file to the path property file. ++ ++ # echo foo.dtbo >/config/device-tree/overlays/foo/path ++ ++* Or you cat the contents of the overlay to the dtbo file ++ ++ # cat foo.dtbo >/config/device-tree/overlays/foo/dtbo ++ ++The overlay file will be applied, and devices will be created/destroyed ++as required. ++ ++To remove it simply rmdir the directory. ++ ++ # rmdir /config/device-tree/overlays/foo ++ ++The rationalle of the dual interface (firmware & direct copy) is that each is ++better suited to different use patterns. The firmware interface is what's ++intended to be used by hardware managers in the kernel, while the copy interface ++make sense for developers (since it avoids problems with namespaces). +diff --git a/drivers/of/Kconfig b/drivers/of/Kconfig +index e2a4841..7e5e6c4 100644 +--- a/drivers/of/Kconfig ++++ b/drivers/of/Kconfig +@@ -112,4 +112,11 @@ config OF_OVERLAY + While this option is selected automatically when needed, you can + enable it manually to improve device tree unit test coverage. + ++config OF_CONFIGFS ++ bool "Device Tree Overlay ConfigFS interface" ++ select CONFIGFS_FS ++ select OF_OVERLAY ++ help ++ Enable a simple user-space driven DT overlay interface. ++ + endif # OF +diff --git a/drivers/of/Makefile b/drivers/of/Makefile +index 156c072..46c8f57 100644 +--- a/drivers/of/Makefile ++++ b/drivers/of/Makefile +@@ -1,4 +1,5 @@ + obj-y = base.o device.o platform.o ++obj-$(CONFIG_OF_CONFIGFS) += configfs.o + obj-$(CONFIG_OF_DYNAMIC) += dynamic.o + obj-$(CONFIG_OF_FLATTREE) += fdt.o + obj-$(CONFIG_OF_EARLY_FLATTREE) += fdt_address.o +diff --git a/drivers/of/configfs.c b/drivers/of/configfs.c +new file mode 100644 +index 0000000..68f889d +--- /dev/null ++++ b/drivers/of/configfs.c +@@ -0,0 +1,311 @@ ++/* ++ * Configfs entries for device-tree ++ * ++ * Copyright (C) 2013 - Pantelis Antoniou <panto@antoniou-consulting.com> ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * as published by the Free Software Foundation; either version ++ * 2 of the License, or (at your option) any later version. ++ */ ++#include <linux/ctype.h> ++#include <linux/cpu.h> ++#include <linux/module.h> ++#include <linux/of.h> ++#include <linux/of_fdt.h> ++#include <linux/spinlock.h> ++#include <linux/slab.h> ++#include <linux/proc_fs.h> ++#include <linux/configfs.h> ++#include <linux/types.h> ++#include <linux/stat.h> ++#include <linux/limits.h> ++#include <linux/file.h> ++#include <linux/vmalloc.h> ++#include <linux/firmware.h> ++#include <linux/sizes.h> ++ ++#include "of_private.h" ++ ++struct cfs_overlay_item { ++ struct config_item item; ++ ++ char path[PATH_MAX]; ++ ++ const struct firmware *fw; ++ struct device_node *overlay; ++ int ov_id; ++ ++ void *dtbo; ++ int dtbo_size; ++}; ++ ++static int create_overlay(struct cfs_overlay_item *overlay, void *blob) ++{ ++ int err; ++ ++ /* unflatten the tree */ ++ of_fdt_unflatten_tree(blob, &overlay->overlay); ++ if (overlay->overlay == NULL) { ++ pr_err("%s: failed to unflatten tree\n", __func__); ++ err = -EINVAL; ++ goto out_err; ++ } ++ pr_debug("%s: unflattened OK\n", __func__); ++ ++ /* mark it as detached */ ++ of_node_set_flag(overlay->overlay, OF_DETACHED); ++ ++ /* perform resolution */ ++ err = of_resolve_phandles(overlay->overlay); ++ if (err != 0) { ++ pr_err("%s: Failed to resolve tree\n", __func__); ++ goto out_err; ++ } ++ pr_debug("%s: resolved OK\n", __func__); ++ ++ err = of_overlay_create(overlay->overlay); ++ if (err < 0) { ++ pr_err("%s: Failed to create overlay (err=%d)\n", ++ __func__, err); ++ goto out_err; ++ } ++ overlay->ov_id = err; ++ ++out_err: ++ return err; ++} ++ ++static inline struct cfs_overlay_item *to_cfs_overlay_item( ++ struct config_item *item) ++{ ++ return item ? container_of(item, struct cfs_overlay_item, item) : NULL; ++} ++ ++static ssize_t cfs_overlay_item_path_show(struct config_item *item, ++ char *page) ++{ ++ struct cfs_overlay_item *overlay = to_cfs_overlay_item(item); ++ return sprintf(page, "%s\n", overlay->path); ++} ++ ++static ssize_t cfs_overlay_item_path_store(struct config_item *item, ++ const char *page, size_t count) ++{ ++ struct cfs_overlay_item *overlay = to_cfs_overlay_item(item); ++ const char *p = page; ++ char *s; ++ int err; ++ ++ /* if it's set do not allow changes */ ++ if (overlay->path[0] != '\0' || overlay->dtbo_size > 0) ++ return -EPERM; ++ ++ /* copy to path buffer (and make sure it's always zero terminated */ ++ count = snprintf(overlay->path, sizeof(overlay->path) - 1, "%s", p); ++ overlay->path[sizeof(overlay->path) - 1] = '\0'; ++ ++ /* strip trailing newlines */ ++ s = overlay->path + strlen(overlay->path); ++ while (s > overlay->path && *--s == '\n') ++ *s = '\0'; ++ ++ pr_debug("%s: path is '%s'\n", __func__, overlay->path); ++ ++ err = request_firmware(&overlay->fw, overlay->path, NULL); ++ if (err != 0) ++ goto out_err; ++ ++ err = create_overlay(overlay, (void *)overlay->fw->data); ++ if (err != 0) ++ goto out_err; ++ ++ return count; ++ ++out_err: ++ ++ release_firmware(overlay->fw); ++ overlay->fw = NULL; ++ ++ overlay->path[0] = '\0'; ++ return err; ++} ++ ++static ssize_t cfs_overlay_item_status_show(struct config_item *item, ++ char *page) ++{ ++ struct cfs_overlay_item *overlay = to_cfs_overlay_item(item); ++ ++ return sprintf(page, "%s\n", ++ overlay->ov_id >= 0 ? "applied" : "unapplied"); ++} ++ ++CONFIGFS_ATTR(cfs_overlay_item_, path); ++CONFIGFS_ATTR_RO(cfs_overlay_item_, status); ++ ++static struct configfs_attribute *cfs_overlay_attrs[] = { ++ &cfs_overlay_item_attr_path, ++ &cfs_overlay_item_attr_status, ++ NULL, ++}; ++ ++ssize_t cfs_overlay_item_dtbo_read(struct config_item *item, ++ void *buf, size_t max_count) ++{ ++ struct cfs_overlay_item *overlay = to_cfs_overlay_item(item); ++ ++ pr_debug("%s: buf=%p max_count=%zu\n", __func__, ++ buf, max_count); ++ ++ if (overlay->dtbo == NULL) ++ return 0; ++ ++ /* copy if buffer provided */ ++ if (buf != NULL) { ++ /* the buffer must be large enough */ ++ if (overlay->dtbo_size > max_count) ++ return -ENOSPC; ++ ++ memcpy(buf, overlay->dtbo, overlay->dtbo_size); ++ } ++ ++ return overlay->dtbo_size; ++} ++ ++ssize_t cfs_overlay_item_dtbo_write(struct config_item *item, ++ const void *buf, size_t count) ++{ ++ struct cfs_overlay_item *overlay = to_cfs_overlay_item(item); ++ int err; ++ ++ /* if it's set do not allow changes */ ++ if (overlay->path[0] != '\0' || overlay->dtbo_size > 0) ++ return -EPERM; ++ ++ /* copy the contents */ ++ overlay->dtbo = kmemdup(buf, count, GFP_KERNEL); ++ if (overlay->dtbo == NULL) ++ return -ENOMEM; ++ ++ overlay->dtbo_size = count; ++ ++ err = create_overlay(overlay, overlay->dtbo); ++ if (err != 0) ++ goto out_err; ++ ++ return count; ++ ++out_err: ++ kfree(overlay->dtbo); ++ overlay->dtbo = NULL; ++ overlay->dtbo_size = 0; ++ ++ return err; ++} ++ ++CONFIGFS_BIN_ATTR(cfs_overlay_item_, dtbo, NULL, SZ_1M); ++ ++static struct configfs_bin_attribute *cfs_overlay_bin_attrs[] = { ++ &cfs_overlay_item_attr_dtbo, ++ NULL, ++}; ++ ++static void cfs_overlay_release(struct config_item *item) ++{ ++ struct cfs_overlay_item *overlay = to_cfs_overlay_item(item); ++ ++ if (overlay->ov_id >= 0) ++ of_overlay_destroy(overlay->ov_id); ++ if (overlay->fw) ++ release_firmware(overlay->fw); ++ /* kfree with NULL is safe */ ++ kfree(overlay->dtbo); ++ kfree(overlay); ++} ++ ++static struct configfs_item_operations cfs_overlay_item_ops = { ++ .release = cfs_overlay_release, ++}; ++ ++static struct config_item_type cfs_overlay_type = { ++ .ct_item_ops = &cfs_overlay_item_ops, ++ .ct_attrs = cfs_overlay_attrs, ++ .ct_bin_attrs = cfs_overlay_bin_attrs, ++ .ct_owner = THIS_MODULE, ++}; ++ ++static struct config_item *cfs_overlay_group_make_item( ++ struct config_group *group, const char *name) ++{ ++ struct cfs_overlay_item *overlay; ++ ++ overlay = kzalloc(sizeof(*overlay), GFP_KERNEL); ++ if (!overlay) ++ return ERR_PTR(-ENOMEM); ++ overlay->ov_id = -1; ++ ++ config_item_init_type_name(&overlay->item, name, &cfs_overlay_type); ++ return &overlay->item; ++} ++ ++static void cfs_overlay_group_drop_item(struct config_group *group, ++ struct config_item *item) ++{ ++ struct cfs_overlay_item *overlay = to_cfs_overlay_item(item); ++ ++ config_item_put(&overlay->item); ++} ++ ++static struct configfs_group_operations overlays_ops = { ++ .make_item = cfs_overlay_group_make_item, ++ .drop_item = cfs_overlay_group_drop_item, ++}; ++ ++static struct config_item_type overlays_type = { ++ .ct_group_ops = &overlays_ops, ++ .ct_owner = THIS_MODULE, ++}; ++ ++static struct configfs_group_operations of_cfs_ops = { ++ /* empty - we don't allow anything to be created */ ++}; ++ ++static struct config_item_type of_cfs_type = { ++ .ct_group_ops = &of_cfs_ops, ++ .ct_owner = THIS_MODULE, ++}; ++ ++struct config_group of_cfs_overlay_group; ++ ++static struct configfs_subsystem of_cfs_subsys = { ++ .su_group = { ++ .cg_item = { ++ .ci_namebuf = "device-tree", ++ .ci_type = &of_cfs_type, ++ }, ++ }, ++ .su_mutex = __MUTEX_INITIALIZER(of_cfs_subsys.su_mutex), ++}; ++ ++static int __init of_cfs_init(void) ++{ ++ int ret; ++ ++ pr_info("%s\n", __func__); ++ ++ config_group_init(&of_cfs_subsys.su_group); ++ config_group_init_type_name(&of_cfs_overlay_group, "overlays", ++ &overlays_type); ++ configfs_add_default_group(&of_cfs_overlay_group, ++ &of_cfs_subsys.su_group); ++ ++ ret = configfs_register_subsystem(&of_cfs_subsys); ++ if (ret != 0) { ++ pr_err("%s: failed to register subsys\n", __func__); ++ goto out; ++ } ++ pr_info("%s: OK\n", __func__); ++out: ++ return ret; ++} ++late_initcall(of_cfs_init); + +From 84da37731727b20a8b585757ad3b16f09a1d0073 Mon Sep 17 00:00:00 2001 +From: Cheong2K <cheong@redbear.cc> +Date: Fri, 26 Feb 2016 18:20:10 +0800 +Subject: [PATCH 089/112] brcm: adds support for BCM43341 wifi + +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 2 ++ + drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h | 1 + + 2 files changed, 3 insertions(+) + +diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +index 43fd3f4..c3c7c79 100644 +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +@@ -606,6 +606,7 @@ BRCMF_FW_NVRAM_DEF(4329, "brcmfmac4329-sdio.bin", "brcmfmac4329-sdio.txt"); + BRCMF_FW_NVRAM_DEF(4330, "brcmfmac4330-sdio.bin", "brcmfmac4330-sdio.txt"); + BRCMF_FW_NVRAM_DEF(4334, "brcmfmac4334-sdio.bin", "brcmfmac4334-sdio.txt"); + BRCMF_FW_NVRAM_DEF(43340, "brcmfmac43340-sdio.bin", "brcmfmac43340-sdio.txt"); ++BRCMF_FW_NVRAM_DEF(43341, "brcmfmac43341-sdio.bin", "brcmfmac43341-sdio.txt"); + BRCMF_FW_NVRAM_DEF(4335, "brcmfmac4335-sdio.bin", "brcmfmac4335-sdio.txt"); + BRCMF_FW_NVRAM_DEF(43362, "brcmfmac43362-sdio.bin", "brcmfmac43362-sdio.txt"); + BRCMF_FW_NVRAM_DEF(4339, "brcmfmac4339-sdio.bin", "brcmfmac4339-sdio.txt"); +@@ -622,6 +623,7 @@ static struct brcmf_firmware_mapping brcmf_sdio_fwnames[] = { + BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4330_CHIP_ID, 0xFFFFFFFF, 4330), + BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4334_CHIP_ID, 0xFFFFFFFF, 4334), + BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43340_CHIP_ID, 0xFFFFFFFF, 43340), ++ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43341_CHIP_ID, 0xFFFFFFFF, 43341), + BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4335_CHIP_ID, 0xFFFFFFFF, 4335), + BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43362_CHIP_ID, 0xFFFFFFFE, 43362), + BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4339_CHIP_ID, 0xFFFFFFFF, 4339), +diff --git a/drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h b/drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h +index 699f2c2..15598b3 100644 +--- a/drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h ++++ b/drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h +@@ -35,6 +35,7 @@ + #define BRCM_CC_4330_CHIP_ID 0x4330 + #define BRCM_CC_4334_CHIP_ID 0x4334 + #define BRCM_CC_43340_CHIP_ID 43340 ++#define BRCM_CC_43341_CHIP_ID 43341 + #define BRCM_CC_43362_CHIP_ID 43362 + #define BRCM_CC_4335_CHIP_ID 0x4335 + #define BRCM_CC_4339_CHIP_ID 0x4339 + +From 48b27165b0d028e22700c9c760ee28758191e153 Mon Sep 17 00:00:00 2001 +From: Phil Elwell <phil@raspberrypi.org> +Date: Wed, 9 Mar 2016 17:25:59 +0000 +Subject: [PATCH 090/112] brcmfmac: Disable power management + +Disable wireless power saving in the brcmfmac WLAN driver. This is a +temporary measure until the connectivity loss resulting from power +saving is resolved. + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +index d5c2a27..5a08f59 100644 +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +@@ -2623,6 +2623,8 @@ brcmf_cfg80211_set_power_mgmt(struct wiphy *wiphy, struct net_device *ndev, + * preference in cfg struct to apply this to + * FW later while initializing the dongle + */ ++ pr_info("power management disabled\n"); ++ enabled = false; + cfg->pwr_save = enabled; + if (!check_vif_up(ifp->vif)) { + + +From cf6845399aab2b43a579bc613a8c2b2f4cda5920 Mon Sep 17 00:00:00 2001 +From: Phil Elwell <phil@raspberrypi.org> +Date: Thu, 28 Apr 2016 17:13:47 +0100 +Subject: [PATCH 091/112] brcmfmac: Use original country code as a fallback + +Commit 73345fd212980d2e28a5c6d83801c903bd773680: + + brcmfmac: Configure country code using device specific settings + +prevents region codes from working on devices that lack a region code +translation table. In the event of an absent table, preserve the old +behaviour of using the provided code as-is. + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> +--- + .../wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 20 +++++++++++++++----- + 1 file changed, 15 insertions(+), 5 deletions(-) + +diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +index 5a08f59..ceba7b6 100644 +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +@@ -6516,12 +6516,18 @@ static s32 brcmf_translate_country_code(struct brcmf_pub *drvr, char alpha2[2], + struct brcmfmac_pd_cc *country_codes; + struct brcmfmac_pd_cc_entry *cc; + s32 found_index; ++ char ccode[BRCMF_COUNTRY_BUF_SZ]; ++ int rev; + int i; + ++ memcpy(ccode, alpha2, sizeof(ccode)); ++ rev = -1; ++ + country_codes = drvr->settings->country_codes; + if (!country_codes) { +- brcmf_dbg(TRACE, "No country codes configured for device\n"); +- return -EINVAL; ++ brcmf_dbg(TRACE, "No country codes configured for device" ++ " - use requested value\n"); ++ goto use_input_value; + } + + if ((alpha2[0] == ccreq->country_abbrev[0]) && +@@ -6545,10 +6551,14 @@ static s32 brcmf_translate_country_code(struct brcmf_pub *drvr, char alpha2[2], + brcmf_dbg(TRACE, "No country code match found\n"); + return -EINVAL; + } +- memset(ccreq, 0, sizeof(*ccreq)); +- ccreq->rev = cpu_to_le32(country_codes->table[found_index].rev); +- memcpy(ccreq->ccode, country_codes->table[found_index].cc, ++ rev = country_codes->table[found_index].rev; ++ memcpy(ccode, country_codes->table[found_index].cc, + BRCMF_COUNTRY_BUF_SZ); ++ ++use_input_value: ++ memset(ccreq, 0, sizeof(*ccreq)); ++ ccreq->rev = cpu_to_le32(rev); ++ memcpy(ccreq->ccode, ccode, sizeof(ccode)); + ccreq->country_abbrev[0] = alpha2[0]; + ccreq->country_abbrev[1] = alpha2[1]; + ccreq->country_abbrev[2] = 0; + +From 57720f476dafd8ad6d218c75d816df912d572d01 Mon Sep 17 00:00:00 2001 +From: Phil Elwell <phil@raspberrypi.org> +Date: Thu, 19 May 2016 15:36:09 +0100 +Subject: [PATCH 092/112] brcmfmac: Plug memory leak in brcmf_fill_bss_param + +See: https://github.com/raspberrypi/linux/issues/1471 + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +index ceba7b6..afb0154 100644 +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +@@ -2413,7 +2413,7 @@ static void brcmf_fill_bss_param(struct brcmf_if *ifp, struct station_info *si) + WL_BSS_INFO_MAX); + if (err) { + brcmf_err("Failed to get bss info (%d)\n", err); +- return; ++ goto out_err; + } + si->filled |= BIT(NL80211_STA_INFO_BSS_PARAM); + si->bss_param.beacon_interval = le16_to_cpu(buf->bss_le.beacon_period); +@@ -2425,6 +2425,9 @@ static void brcmf_fill_bss_param(struct brcmf_if *ifp, struct station_info *si) + si->bss_param.flags |= BSS_PARAM_FLAGS_SHORT_PREAMBLE; + if (capability & WLAN_CAPABILITY_SHORT_SLOT_TIME) + si->bss_param.flags |= BSS_PARAM_FLAGS_SHORT_SLOT_TIME; ++ ++out_err: ++ kfree(buf); + } + + static s32 + +From b83945eb624ddcfbf5687cbb64b3e502765b8847 Mon Sep 17 00:00:00 2001 +From: Phil Elwell <phil@raspberrypi.org> +Date: Thu, 17 Dec 2015 13:37:07 +0000 +Subject: [PATCH 093/112] hci_h5: Don't send conf_req when ACTIVE + +Without this patch, a modem and kernel can continuously bombard each +other with conf_req and conf_rsp messages, in a demented game of tag. +--- + drivers/bluetooth/hci_h5.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/bluetooth/hci_h5.c b/drivers/bluetooth/hci_h5.c +index 0879d64..5161ab3 100644 +--- a/drivers/bluetooth/hci_h5.c ++++ b/drivers/bluetooth/hci_h5.c +@@ -310,7 +310,8 @@ static void h5_handle_internal_rx(struct hci_uart *hu) + h5_link_control(hu, conf_req, 3); + } else if (memcmp(data, conf_req, 2) == 0) { + h5_link_control(hu, conf_rsp, 2); +- h5_link_control(hu, conf_req, 3); ++ if (h5->state != H5_ACTIVE) ++ h5_link_control(hu, conf_req, 3); + } else if (memcmp(data, conf_rsp, 2) == 0) { + if (H5_HDR_LEN(hdr) > 2) + h5->tx_win = (data[2] & 0x07); + +From b233a26228b7db2f5ce2dcf40cf27c9461661335 Mon Sep 17 00:00:00 2001 +From: Eric Anholt <eric@anholt.net> +Date: Fri, 22 Jan 2016 13:06:39 -0800 +Subject: [PATCH 094/112] drm/vc4: Add a debugfs node for tracking execution + state. + +Signed-off-by: Eric Anholt <eric@anholt.net> +--- + drivers/gpu/drm/vc4/vc4_debugfs.c | 1 + + drivers/gpu/drm/vc4/vc4_drv.h | 1 + + drivers/gpu/drm/vc4/vc4_gem.c | 14 ++++++++++++++ + 3 files changed, 16 insertions(+) + +diff --git a/drivers/gpu/drm/vc4/vc4_debugfs.c b/drivers/gpu/drm/vc4/vc4_debugfs.c +index d76ad10..a99aa86 100644 +--- a/drivers/gpu/drm/vc4/vc4_debugfs.c ++++ b/drivers/gpu/drm/vc4/vc4_debugfs.c +@@ -17,6 +17,7 @@ + + static const struct drm_info_list vc4_debugfs_list[] = { + {"bo_stats", vc4_bo_stats_debugfs, 0}, ++ {"gem_exec", vc4_gem_exec_debugfs, 0}, + {"hdmi_regs", vc4_hdmi_debugfs_regs, 0}, + {"hvs_regs", vc4_hvs_debugfs_regs, 0}, + {"crtc0_regs", vc4_crtc_debugfs_regs, 0, (void *)(uintptr_t)0}, +diff --git a/drivers/gpu/drm/vc4/vc4_drv.h b/drivers/gpu/drm/vc4/vc4_drv.h +index fa2ad15..f092986 100644 +--- a/drivers/gpu/drm/vc4/vc4_drv.h ++++ b/drivers/gpu/drm/vc4/vc4_drv.h +@@ -440,6 +440,7 @@ void vc4_job_handle_completed(struct vc4_dev *vc4); + int vc4_queue_seqno_cb(struct drm_device *dev, + struct vc4_seqno_cb *cb, uint64_t seqno, + void (*func)(struct vc4_seqno_cb *cb)); ++int vc4_gem_exec_debugfs(struct seq_file *m, void *arg); + + /* vc4_hdmi.c */ + extern struct platform_driver vc4_hdmi_driver; +diff --git a/drivers/gpu/drm/vc4/vc4_gem.c b/drivers/gpu/drm/vc4/vc4_gem.c +index 8d4384f..aa4517c 100644 +--- a/drivers/gpu/drm/vc4/vc4_gem.c ++++ b/drivers/gpu/drm/vc4/vc4_gem.c +@@ -32,6 +32,20 @@ + #include "vc4_regs.h" + #include "vc4_trace.h" + ++#ifdef CONFIG_DEBUG_FS ++int vc4_gem_exec_debugfs(struct seq_file *m, void *unused) ++{ ++ struct drm_info_node *node = (struct drm_info_node *)m->private; ++ struct drm_device *dev = node->minor->dev; ++ struct vc4_dev *vc4 = to_vc4_dev(dev); ++ ++ seq_printf(m, "Emitted seqno: 0x%016llx\n", vc4->emit_seqno); ++ seq_printf(m, "Finished seqno: 0x%016llx\n", vc4->finished_seqno); ++ ++ return 0; ++} ++#endif /* CONFIG_DEBUG_FS */ ++ + static void + vc4_queue_hangcheck(struct drm_device *dev) + { + +From 9e309d7f765e380b8e707659ab9ed4b182dc22f6 Mon Sep 17 00:00:00 2001 +From: Eric Anholt <eric@anholt.net> +Date: Mon, 25 Jan 2016 13:03:33 -0800 +Subject: [PATCH 095/112] drm/vc4: Include vc4_drm.h in uapi in downstream + build. + +Signed-off-by: Eric Anholt <eric@anholt.net> +--- + include/uapi/drm/Kbuild | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/include/uapi/drm/Kbuild b/include/uapi/drm/Kbuild +index 9355dd8..68828bf 100644 +--- a/include/uapi/drm/Kbuild ++++ b/include/uapi/drm/Kbuild +@@ -15,6 +15,7 @@ header-y += radeon_drm.h + header-y += savage_drm.h + header-y += sis_drm.h + header-y += tegra_drm.h ++header-y += vc4_drm.h + header-y += via_drm.h + header-y += vmwgfx_drm.h + header-y += msm_drm.h + +From 8ebc53b4f06a2076f30f0ec77153af7dcb5d1edb Mon Sep 17 00:00:00 2001 +From: Phil Elwell <phil@raspberrypi.org> +Date: Wed, 30 Mar 2016 17:23:15 +0100 +Subject: [PATCH 096/112] cpufreq: Temporarily ignore io_is_busy=1 + +To speed testing of the new sdhost driver that adapts to changes in +core_freq, hack the on-demand governor to treat io_is_busy=1 as +io_is_busy=0. The io_is_busy feature can still be forced using +io_is_busy=2. + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> +--- + drivers/cpufreq/cpufreq_ondemand.c | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/drivers/cpufreq/cpufreq_ondemand.c b/drivers/cpufreq/cpufreq_ondemand.c +index acd8027..72c5a4c 100644 +--- a/drivers/cpufreq/cpufreq_ondemand.c ++++ b/drivers/cpufreq/cpufreq_ondemand.c +@@ -216,7 +216,12 @@ static ssize_t store_io_is_busy(struct dbs_data *dbs_data, const char *buf, + ret = sscanf(buf, "%u", &input); + if (ret != 1) + return -EINVAL; +- dbs_data->io_is_busy = !!input; ++ // XXX temporary hack ++ if (input > 1) ++ input = 1; ++ else ++ input = 0; ++ dbs_data->io_is_busy = input; + + /* we need to re-evaluate prev_cpu_idle */ + gov_update_cpu_data(dbs_data); + +From 29509a4b9e47b129d5032bb7c0fdba0a7f9b66b6 Mon Sep 17 00:00:00 2001 +From: popcornmix <popcornmix@gmail.com> +Date: Wed, 27 Apr 2016 16:59:24 +0100 +Subject: [PATCH 097/112] Revert "ASoC: bcm2835: move to use the clock + framework" + +This reverts commit 517e7a1537ae4663268be5d0c0ec62c563b9fc99. +--- + sound/soc/bcm/bcm2835-i2s.c | 284 ++++++++++++++++++++++++++++++++++---------- + 1 file changed, 220 insertions(+), 64 deletions(-) + +diff --git a/sound/soc/bcm/bcm2835-i2s.c b/sound/soc/bcm/bcm2835-i2s.c +index 1c1f221..3303d5f 100644 +--- a/sound/soc/bcm/bcm2835-i2s.c ++++ b/sound/soc/bcm/bcm2835-i2s.c +@@ -37,7 +37,6 @@ + #include <linux/init.h> + #include <linux/io.h> + #include <linux/module.h> +-#include <linux/of_address.h> + #include <linux/slab.h> + + #include <sound/core.h> +@@ -47,6 +46,55 @@ + #include <sound/pcm_params.h> + #include <sound/soc.h> + ++/* Clock registers */ ++#define BCM2835_CLK_PCMCTL_REG 0x00 ++#define BCM2835_CLK_PCMDIV_REG 0x04 ++ ++/* Clock register settings */ ++#define BCM2835_CLK_PASSWD (0x5a000000) ++#define BCM2835_CLK_PASSWD_MASK (0xff000000) ++#define BCM2835_CLK_MASH(v) ((v) << 9) ++#define BCM2835_CLK_FLIP BIT(8) ++#define BCM2835_CLK_BUSY BIT(7) ++#define BCM2835_CLK_KILL BIT(5) ++#define BCM2835_CLK_ENAB BIT(4) ++#define BCM2835_CLK_SRC(v) (v) ++ ++#define BCM2835_CLK_SHIFT (12) ++#define BCM2835_CLK_DIVI(v) ((v) << BCM2835_CLK_SHIFT) ++#define BCM2835_CLK_DIVF(v) (v) ++#define BCM2835_CLK_DIVF_MASK (0xFFF) ++ ++enum { ++ BCM2835_CLK_MASH_0 = 0, ++ BCM2835_CLK_MASH_1, ++ BCM2835_CLK_MASH_2, ++ BCM2835_CLK_MASH_3, ++}; ++ ++enum { ++ BCM2835_CLK_SRC_GND = 0, ++ BCM2835_CLK_SRC_OSC, ++ BCM2835_CLK_SRC_DBG0, ++ BCM2835_CLK_SRC_DBG1, ++ BCM2835_CLK_SRC_PLLA, ++ BCM2835_CLK_SRC_PLLC, ++ BCM2835_CLK_SRC_PLLD, ++ BCM2835_CLK_SRC_HDMI, ++}; ++ ++/* Most clocks are not useable (freq = 0) */ ++static const unsigned int bcm2835_clk_freq[BCM2835_CLK_SRC_HDMI+1] = { ++ [BCM2835_CLK_SRC_GND] = 0, ++ [BCM2835_CLK_SRC_OSC] = 19200000, ++ [BCM2835_CLK_SRC_DBG0] = 0, ++ [BCM2835_CLK_SRC_DBG1] = 0, ++ [BCM2835_CLK_SRC_PLLA] = 0, ++ [BCM2835_CLK_SRC_PLLC] = 0, ++ [BCM2835_CLK_SRC_PLLD] = 500000000, ++ [BCM2835_CLK_SRC_HDMI] = 0, ++}; ++ + /* I2S registers */ + #define BCM2835_I2S_CS_A_REG 0x00 + #define BCM2835_I2S_FIFO_A_REG 0x04 +@@ -110,6 +158,10 @@ + #define BCM2835_I2S_INT_RXR BIT(1) + #define BCM2835_I2S_INT_TXW BIT(0) + ++/* I2S DMA interface */ ++/* FIXME: Needs IOMMU support */ ++#define BCM2835_VCMMU_SHIFT (0x7E000000 - 0x20000000) ++ + /* General device struct */ + struct bcm2835_i2s_dev { + struct device *dev; +@@ -117,23 +169,21 @@ struct bcm2835_i2s_dev { + unsigned int fmt; + unsigned int bclk_ratio; + +- struct regmap *i2s_regmap; +- struct clk *clk; +- bool clk_prepared; ++ struct regmap *i2s_regmap; ++ struct regmap *clk_regmap; + }; + + static void bcm2835_i2s_start_clock(struct bcm2835_i2s_dev *dev) + { ++ /* Start the clock if in master mode */ + unsigned int master = dev->fmt & SND_SOC_DAIFMT_MASTER_MASK; + +- if (dev->clk_prepared) +- return; +- + switch (master) { + case SND_SOC_DAIFMT_CBS_CFS: + case SND_SOC_DAIFMT_CBS_CFM: +- clk_prepare_enable(dev->clk); +- dev->clk_prepared = true; ++ regmap_update_bits(dev->clk_regmap, BCM2835_CLK_PCMCTL_REG, ++ BCM2835_CLK_PASSWD_MASK | BCM2835_CLK_ENAB, ++ BCM2835_CLK_PASSWD | BCM2835_CLK_ENAB); + break; + default: + break; +@@ -142,9 +192,28 @@ static void bcm2835_i2s_start_clock(struct bcm2835_i2s_dev *dev) + + static void bcm2835_i2s_stop_clock(struct bcm2835_i2s_dev *dev) + { +- if (dev->clk_prepared) +- clk_disable_unprepare(dev->clk); +- dev->clk_prepared = false; ++ uint32_t clkreg; ++ int timeout = 1000; ++ ++ /* Stop clock */ ++ regmap_update_bits(dev->clk_regmap, BCM2835_CLK_PCMCTL_REG, ++ BCM2835_CLK_PASSWD_MASK | BCM2835_CLK_ENAB, ++ BCM2835_CLK_PASSWD); ++ ++ /* Wait for the BUSY flag going down */ ++ while (--timeout) { ++ regmap_read(dev->clk_regmap, BCM2835_CLK_PCMCTL_REG, &clkreg); ++ if (!(clkreg & BCM2835_CLK_BUSY)) ++ break; ++ } ++ ++ if (!timeout) { ++ /* KILL the clock */ ++ dev_err(dev->dev, "I2S clock didn't stop. Kill the clock!\n"); ++ regmap_update_bits(dev->clk_regmap, BCM2835_CLK_PCMCTL_REG, ++ BCM2835_CLK_KILL | BCM2835_CLK_PASSWD_MASK, ++ BCM2835_CLK_KILL | BCM2835_CLK_PASSWD); ++ } + } + + static void bcm2835_i2s_clear_fifos(struct bcm2835_i2s_dev *dev, +@@ -154,7 +223,8 @@ static void bcm2835_i2s_clear_fifos(struct bcm2835_i2s_dev *dev, + uint32_t syncval; + uint32_t csreg; + uint32_t i2s_active_state; +- bool clk_was_prepared; ++ uint32_t clkreg; ++ uint32_t clk_active_state; + uint32_t off; + uint32_t clr; + +@@ -168,10 +238,15 @@ static void bcm2835_i2s_clear_fifos(struct bcm2835_i2s_dev *dev, + regmap_read(dev->i2s_regmap, BCM2835_I2S_CS_A_REG, &csreg); + i2s_active_state = csreg & (BCM2835_I2S_RXON | BCM2835_I2S_TXON); + ++ regmap_read(dev->clk_regmap, BCM2835_CLK_PCMCTL_REG, &clkreg); ++ clk_active_state = clkreg & BCM2835_CLK_ENAB; ++ + /* Start clock if not running */ +- clk_was_prepared = dev->clk_prepared; +- if (!clk_was_prepared) +- bcm2835_i2s_start_clock(dev); ++ if (!clk_active_state) { ++ regmap_update_bits(dev->clk_regmap, BCM2835_CLK_PCMCTL_REG, ++ BCM2835_CLK_PASSWD_MASK | BCM2835_CLK_ENAB, ++ BCM2835_CLK_PASSWD | BCM2835_CLK_ENAB); ++ } + + /* Stop I2S module */ + regmap_update_bits(dev->i2s_regmap, BCM2835_I2S_CS_A_REG, off, 0); +@@ -205,7 +280,7 @@ static void bcm2835_i2s_clear_fifos(struct bcm2835_i2s_dev *dev, + dev_err(dev->dev, "I2S SYNC error!\n"); + + /* Stop clock if it was not running before */ +- if (!clk_was_prepared) ++ if (!clk_active_state) + bcm2835_i2s_stop_clock(dev); + + /* Restore I2S state */ +@@ -234,9 +309,19 @@ static int bcm2835_i2s_hw_params(struct snd_pcm_substream *substream, + struct snd_soc_dai *dai) + { + struct bcm2835_i2s_dev *dev = snd_soc_dai_get_drvdata(dai); ++ + unsigned int sampling_rate = params_rate(params); + unsigned int data_length, data_delay, bclk_ratio; + unsigned int ch1pos, ch2pos, mode, format; ++ unsigned int mash = BCM2835_CLK_MASH_1; ++ unsigned int divi, divf, target_frequency; ++ int clk_src = -1; ++ unsigned int master = dev->fmt & SND_SOC_DAIFMT_MASTER_MASK; ++ bool bit_master = (master == SND_SOC_DAIFMT_CBS_CFS ++ || master == SND_SOC_DAIFMT_CBS_CFM); ++ ++ bool frame_master = (master == SND_SOC_DAIFMT_CBS_CFS ++ || master == SND_SOC_DAIFMT_CBM_CFS); + uint32_t csreg; + + /* +@@ -258,9 +343,11 @@ static int bcm2835_i2s_hw_params(struct snd_pcm_substream *substream, + switch (params_format(params)) { + case SNDRV_PCM_FORMAT_S16_LE: + data_length = 16; ++ bclk_ratio = 40; + break; + case SNDRV_PCM_FORMAT_S32_LE: + data_length = 32; ++ bclk_ratio = 80; + break; + default: + return -EINVAL; +@@ -269,12 +356,69 @@ static int bcm2835_i2s_hw_params(struct snd_pcm_substream *substream, + /* If bclk_ratio already set, use that one. */ + if (dev->bclk_ratio) + bclk_ratio = dev->bclk_ratio; +- else +- /* otherwise calculate a fitting block ratio */ +- bclk_ratio = 2 * data_length; + +- /* set target clock rate*/ +- clk_set_rate(dev->clk, sampling_rate * bclk_ratio); ++ /* ++ * Clock Settings ++ * ++ * The target frequency of the bit clock is ++ * sampling rate * frame length ++ * ++ * Integer mode: ++ * Sampling rates that are multiples of 8000 kHz ++ * can be driven by the oscillator of 19.2 MHz ++ * with an integer divider as long as the frame length ++ * is an integer divider of 19200000/8000=2400 as set up above. ++ * This is no longer possible if the sampling rate ++ * is too high (e.g. 192 kHz), because the oscillator is too slow. ++ * ++ * MASH mode: ++ * For all other sampling rates, it is not possible to ++ * have an integer divider. Approximate the clock ++ * with the MASH module that induces a slight frequency ++ * variance. To minimize that it is best to have the fastest ++ * clock here. That is PLLD with 500 MHz. ++ */ ++ target_frequency = sampling_rate * bclk_ratio; ++ clk_src = BCM2835_CLK_SRC_OSC; ++ mash = BCM2835_CLK_MASH_0; ++ ++ if (bcm2835_clk_freq[clk_src] % target_frequency == 0 ++ && bit_master && frame_master) { ++ divi = bcm2835_clk_freq[clk_src] / target_frequency; ++ divf = 0; ++ } else { ++ uint64_t dividend; ++ ++ if (!dev->bclk_ratio) { ++ /* ++ * Overwrite bclk_ratio, because the ++ * above trick is not needed or can ++ * not be used. ++ */ ++ bclk_ratio = 2 * data_length; ++ } ++ ++ target_frequency = sampling_rate * bclk_ratio; ++ ++ clk_src = BCM2835_CLK_SRC_PLLD; ++ mash = BCM2835_CLK_MASH_1; ++ ++ dividend = bcm2835_clk_freq[clk_src]; ++ dividend <<= BCM2835_CLK_SHIFT; ++ do_div(dividend, target_frequency); ++ divi = dividend >> BCM2835_CLK_SHIFT; ++ divf = dividend & BCM2835_CLK_DIVF_MASK; ++ } ++ ++ /* Set clock divider */ ++ regmap_write(dev->clk_regmap, BCM2835_CLK_PCMDIV_REG, BCM2835_CLK_PASSWD ++ | BCM2835_CLK_DIVI(divi) ++ | BCM2835_CLK_DIVF(divf)); ++ ++ /* Setup clock, but don't start it yet */ ++ regmap_write(dev->clk_regmap, BCM2835_CLK_PCMCTL_REG, BCM2835_CLK_PASSWD ++ | BCM2835_CLK_MASH(mash) ++ | BCM2835_CLK_SRC(clk_src)); + + /* Setup the frame format */ + format = BCM2835_I2S_CHEN; +@@ -548,7 +692,7 @@ static const struct snd_soc_dai_ops bcm2835_i2s_dai_ops = { + .trigger = bcm2835_i2s_trigger, + .hw_params = bcm2835_i2s_hw_params, + .set_fmt = bcm2835_i2s_set_dai_fmt, +- .set_bclk_ratio = bcm2835_i2s_set_dai_bclk_ratio, ++ .set_bclk_ratio = bcm2835_i2s_set_dai_bclk_ratio + }; + + static int bcm2835_i2s_dai_probe(struct snd_soc_dai *dai) +@@ -606,14 +750,34 @@ static bool bcm2835_i2s_precious_reg(struct device *dev, unsigned int reg) + }; + } + +-static const struct regmap_config bcm2835_regmap_config = { +- .reg_bits = 32, +- .reg_stride = 4, +- .val_bits = 32, +- .max_register = BCM2835_I2S_GRAY_REG, +- .precious_reg = bcm2835_i2s_precious_reg, +- .volatile_reg = bcm2835_i2s_volatile_reg, +- .cache_type = REGCACHE_RBTREE, ++static bool bcm2835_clk_volatile_reg(struct device *dev, unsigned int reg) ++{ ++ switch (reg) { ++ case BCM2835_CLK_PCMCTL_REG: ++ return true; ++ default: ++ return false; ++ }; ++} ++ ++static const struct regmap_config bcm2835_regmap_config[] = { ++ { ++ .reg_bits = 32, ++ .reg_stride = 4, ++ .val_bits = 32, ++ .max_register = BCM2835_I2S_GRAY_REG, ++ .precious_reg = bcm2835_i2s_precious_reg, ++ .volatile_reg = bcm2835_i2s_volatile_reg, ++ .cache_type = REGCACHE_RBTREE, ++ }, ++ { ++ .reg_bits = 32, ++ .reg_stride = 4, ++ .val_bits = 32, ++ .max_register = BCM2835_CLK_PCMDIV_REG, ++ .volatile_reg = bcm2835_clk_volatile_reg, ++ .cache_type = REGCACHE_RBTREE, ++ }, + }; + + static const struct snd_soc_component_driver bcm2835_i2s_component = { +@@ -623,50 +787,42 @@ static const struct snd_soc_component_driver bcm2835_i2s_component = { + static int bcm2835_i2s_probe(struct platform_device *pdev) + { + struct bcm2835_i2s_dev *dev; ++ int i; + int ret; +- struct resource *mem; +- void __iomem *base; +- const __be32 *addr; +- dma_addr_t dma_base; ++ struct regmap *regmap[2]; ++ struct resource *mem[2]; ++ ++ /* Request both ioareas */ ++ for (i = 0; i <= 1; i++) { ++ void __iomem *base; ++ ++ mem[i] = platform_get_resource(pdev, IORESOURCE_MEM, i); ++ base = devm_ioremap_resource(&pdev->dev, mem[i]); ++ if (IS_ERR(base)) ++ return PTR_ERR(base); ++ ++ regmap[i] = devm_regmap_init_mmio(&pdev->dev, base, ++ &bcm2835_regmap_config[i]); ++ if (IS_ERR(regmap[i])) ++ return PTR_ERR(regmap[i]); ++ } + + dev = devm_kzalloc(&pdev->dev, sizeof(*dev), + GFP_KERNEL); + if (!dev) + return -ENOMEM; + +- /* get the clock */ +- dev->clk_prepared = false; +- dev->clk = devm_clk_get(&pdev->dev, NULL); +- if (IS_ERR(dev->clk)) { +- dev_err(&pdev->dev, "could not get clk: %ld\n", +- PTR_ERR(dev->clk)); +- return PTR_ERR(dev->clk); +- } +- +- /* Request ioarea */ +- mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); +- base = devm_ioremap_resource(&pdev->dev, mem); +- if (IS_ERR(base)) +- return PTR_ERR(base); +- +- dev->i2s_regmap = devm_regmap_init_mmio(&pdev->dev, base, +- &bcm2835_regmap_config); +- if (IS_ERR(dev->i2s_regmap)) +- return PTR_ERR(dev->i2s_regmap); +- +- /* Set the DMA address - we have to parse DT ourselves */ +- addr = of_get_address(pdev->dev.of_node, 0, NULL, NULL); +- if (!addr) { +- dev_err(&pdev->dev, "could not get DMA-register address\n"); +- return -EINVAL; +- } +- dma_base = be32_to_cpup(addr); ++ dev->i2s_regmap = regmap[0]; ++ dev->clk_regmap = regmap[1]; + ++ /* Set the DMA address */ + dev->dma_data[SNDRV_PCM_STREAM_PLAYBACK].addr = +- dma_base + BCM2835_I2S_FIFO_A_REG; ++ (dma_addr_t)mem[0]->start + BCM2835_I2S_FIFO_A_REG ++ + BCM2835_VCMMU_SHIFT; + + dev->dma_data[SNDRV_PCM_STREAM_CAPTURE].addr = +- dma_base + BCM2835_I2S_FIFO_A_REG; ++ (dma_addr_t)mem[0]->start + BCM2835_I2S_FIFO_A_REG ++ + BCM2835_VCMMU_SHIFT; + + /* Set the bus width */ + dev->dma_data[SNDRV_PCM_STREAM_PLAYBACK].addr_width = + +From d62af4b3c919fa6330797345e0304d1d0d85e98f Mon Sep 17 00:00:00 2001 +From: Matthias Reichl <hias@horus.com> +Date: Sun, 11 Oct 2015 16:44:05 +0200 +Subject: [PATCH 098/112] bcm2835-i2s: get base address for DMA from devicetree + +Code copied from spi-bcm2835. Get physical address from devicetree +instead of using hardcoded constant. + +Signed-off-by: Matthias Reichl <hias@horus.com> +--- + sound/soc/bcm/bcm2835-i2s.c | 20 ++++++++++++-------- + 1 file changed, 12 insertions(+), 8 deletions(-) + +diff --git a/sound/soc/bcm/bcm2835-i2s.c b/sound/soc/bcm/bcm2835-i2s.c +index 3303d5f..0f25db4 100644 +--- a/sound/soc/bcm/bcm2835-i2s.c ++++ b/sound/soc/bcm/bcm2835-i2s.c +@@ -38,6 +38,7 @@ + #include <linux/io.h> + #include <linux/module.h> + #include <linux/slab.h> ++#include <linux/of_address.h> + + #include <sound/core.h> + #include <sound/dmaengine_pcm.h> +@@ -158,10 +159,6 @@ static const unsigned int bcm2835_clk_freq[BCM2835_CLK_SRC_HDMI+1] = { + #define BCM2835_I2S_INT_RXR BIT(1) + #define BCM2835_I2S_INT_TXW BIT(0) + +-/* I2S DMA interface */ +-/* FIXME: Needs IOMMU support */ +-#define BCM2835_VCMMU_SHIFT (0x7E000000 - 0x20000000) +- + /* General device struct */ + struct bcm2835_i2s_dev { + struct device *dev; +@@ -791,6 +788,15 @@ static int bcm2835_i2s_probe(struct platform_device *pdev) + int ret; + struct regmap *regmap[2]; + struct resource *mem[2]; ++ const __be32 *addr; ++ dma_addr_t dma_reg_base; ++ ++ addr = of_get_address(pdev->dev.of_node, 0, NULL, NULL); ++ if (!addr) { ++ dev_err(&pdev->dev, "could not get DMA-register address\n"); ++ return -ENODEV; ++ } ++ dma_reg_base = be32_to_cpup(addr); + + /* Request both ioareas */ + for (i = 0; i <= 1; i++) { +@@ -817,12 +823,10 @@ static int bcm2835_i2s_probe(struct platform_device *pdev) + + /* Set the DMA address */ + dev->dma_data[SNDRV_PCM_STREAM_PLAYBACK].addr = +- (dma_addr_t)mem[0]->start + BCM2835_I2S_FIFO_A_REG +- + BCM2835_VCMMU_SHIFT; ++ dma_reg_base + BCM2835_I2S_FIFO_A_REG; + + dev->dma_data[SNDRV_PCM_STREAM_CAPTURE].addr = +- (dma_addr_t)mem[0]->start + BCM2835_I2S_FIFO_A_REG +- + BCM2835_VCMMU_SHIFT; ++ dma_reg_base + BCM2835_I2S_FIFO_A_REG; + + /* Set the bus width */ + dev->dma_data[SNDRV_PCM_STREAM_PLAYBACK].addr_width = + +From 8a02cd06b98460363d598c1df1a92b05b4dc1ad5 Mon Sep 17 00:00:00 2001 +From: Matthias Reichl <hias@horus.com> +Date: Sun, 11 Oct 2015 15:21:16 +0200 +Subject: [PATCH 099/112] bcm2835-i2s: add 24bit support, update bclk_ratio to + more correct values + +Code ported from bcm2708-i2s driver in Raspberry Pi tree. + +RPi commit 62c05a0b5328d9376d39c9e74da10b8a2465c234 ("ASoC: BCM2708: +Add 24 bit support") + +This adds 24 bit support to the I2S driver of the BCM2708. +Besides enabling the 24 bit flags, it includes two bug fixes: + +MMAP is not supported. Claiming this leads to strange issues +when the format of driver and file do not match. + +The datasheet states that the width extension bit should be set +for widths greater than 24, but greater or equal would be correct. +This follows from the definition of the width field. + +Signed-off-by: Florian Meier <florian.meier@koalo.de> + +RPi commit 3e8c672bc4e92d457aa4654bbb4cfd79a18a2327 ("bcm2708-i2s: +Update bclk_ratio to more correct values") + +Discussion about blck_ratio affecting sound quality: +https://github.com/raspberrypi/linux/issues/681 + +Signed-off-by: Matthias Reichl <hias@horus.com> +--- + sound/soc/bcm/bcm2835-i2s.c | 12 +++++++++--- + 1 file changed, 9 insertions(+), 3 deletions(-) + +diff --git a/sound/soc/bcm/bcm2835-i2s.c b/sound/soc/bcm/bcm2835-i2s.c +index 0f25db4..0f35d7c 100644 +--- a/sound/soc/bcm/bcm2835-i2s.c ++++ b/sound/soc/bcm/bcm2835-i2s.c +@@ -340,11 +340,15 @@ static int bcm2835_i2s_hw_params(struct snd_pcm_substream *substream, + switch (params_format(params)) { + case SNDRV_PCM_FORMAT_S16_LE: + data_length = 16; +- bclk_ratio = 40; ++ bclk_ratio = 50; ++ break; ++ case SNDRV_PCM_FORMAT_S24_LE: ++ data_length = 24; ++ bclk_ratio = 50; + break; + case SNDRV_PCM_FORMAT_S32_LE: + data_length = 32; +- bclk_ratio = 80; ++ bclk_ratio = 100; + break; + default: + return -EINVAL; +@@ -420,7 +424,7 @@ static int bcm2835_i2s_hw_params(struct snd_pcm_substream *substream, + /* Setup the frame format */ + format = BCM2835_I2S_CHEN; + +- if (data_length > 24) ++ if (data_length >= 24) + format |= BCM2835_I2S_CHWEX; + + format |= BCM2835_I2S_CHWID((data_length-8)&0xf); +@@ -711,6 +715,7 @@ static struct snd_soc_dai_driver bcm2835_i2s_dai = { + .channels_max = 2, + .rates = SNDRV_PCM_RATE_8000_192000, + .formats = SNDRV_PCM_FMTBIT_S16_LE ++ | SNDRV_PCM_FMTBIT_S24_LE + | SNDRV_PCM_FMTBIT_S32_LE + }, + .capture = { +@@ -718,6 +723,7 @@ static struct snd_soc_dai_driver bcm2835_i2s_dai = { + .channels_max = 2, + .rates = SNDRV_PCM_RATE_8000_192000, + .formats = SNDRV_PCM_FMTBIT_S16_LE ++ | SNDRV_PCM_FMTBIT_S24_LE + | SNDRV_PCM_FMTBIT_S32_LE + }, + .ops = &bcm2835_i2s_dai_ops, + +From c7032249121b5eb95cfeb1812782c204810dc939 Mon Sep 17 00:00:00 2001 +From: Matthias Reichl <hias@horus.com> +Date: Sun, 11 Oct 2015 15:25:51 +0200 +Subject: [PATCH 100/112] bcm2835-i2s: setup clock only if CPU is clock master + +Code ported from bcm2708-i2s driver in Raspberry Pi tree. + +RPi commit c14827ecdaa36607f6110f9ce8df96e698672191 ("bcm2708: Allow +option card devices to be configured via DT") + +Original work by Zoltan Szenczi, committed to RPi tree by +Phil Elwell. + +Signed-off-by: Matthias Reichl <hias@horus.com> +--- + sound/soc/bcm/bcm2835-i2s.c | 28 +++++++++++++++++++--------- + 1 file changed, 19 insertions(+), 9 deletions(-) + +diff --git a/sound/soc/bcm/bcm2835-i2s.c b/sound/soc/bcm/bcm2835-i2s.c +index 0f35d7c..d5e4123 100644 +--- a/sound/soc/bcm/bcm2835-i2s.c ++++ b/sound/soc/bcm/bcm2835-i2s.c +@@ -411,15 +411,25 @@ static int bcm2835_i2s_hw_params(struct snd_pcm_substream *substream, + divf = dividend & BCM2835_CLK_DIVF_MASK; + } + +- /* Set clock divider */ +- regmap_write(dev->clk_regmap, BCM2835_CLK_PCMDIV_REG, BCM2835_CLK_PASSWD +- | BCM2835_CLK_DIVI(divi) +- | BCM2835_CLK_DIVF(divf)); +- +- /* Setup clock, but don't start it yet */ +- regmap_write(dev->clk_regmap, BCM2835_CLK_PCMCTL_REG, BCM2835_CLK_PASSWD +- | BCM2835_CLK_MASH(mash) +- | BCM2835_CLK_SRC(clk_src)); ++ /* Clock should only be set up here if CPU is clock master */ ++ switch (dev->fmt & SND_SOC_DAIFMT_MASTER_MASK) { ++ case SND_SOC_DAIFMT_CBS_CFS: ++ case SND_SOC_DAIFMT_CBS_CFM: ++ /* Set clock divider */ ++ regmap_write(dev->clk_regmap, BCM2835_CLK_PCMDIV_REG, ++ BCM2835_CLK_PASSWD ++ | BCM2835_CLK_DIVI(divi) ++ | BCM2835_CLK_DIVF(divf)); ++ ++ /* Setup clock, but don't start it yet */ ++ regmap_write(dev->clk_regmap, BCM2835_CLK_PCMCTL_REG, ++ BCM2835_CLK_PASSWD ++ | BCM2835_CLK_MASH(mash) ++ | BCM2835_CLK_SRC(clk_src)); ++ break; ++ default: ++ break; ++ } + + /* Setup the frame format */ + format = BCM2835_I2S_CHEN; + +From 1fcff3b17e19175b7fc986f868ac4209abc5a71d Mon Sep 17 00:00:00 2001 +From: Matthias Reichl <hias@horus.com> +Date: Sun, 11 Oct 2015 15:49:51 +0200 +Subject: [PATCH 101/112] bcm2835-i2s: Eliminate debugfs directory error + +Code ported from bcm2708-i2s driver in Raspberry Pi tree. + +RPi commit fd7d7a3dbe9262d16971ef81c234ed28c6499dd7 ("bcm2708: +Eliminate i2s debugfs directory error") + +Qualify the two regmap ranges uses by bcm2708-i2s ('-i2s' and '-clk') +to avoid the name clash when registering debugfs entries. + +Signed-off-by: Matthias Reichl <hias@horus.com> +--- + sound/soc/bcm/bcm2835-i2s.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/sound/soc/bcm/bcm2835-i2s.c b/sound/soc/bcm/bcm2835-i2s.c +index d5e4123..2d29050 100644 +--- a/sound/soc/bcm/bcm2835-i2s.c ++++ b/sound/soc/bcm/bcm2835-i2s.c +@@ -782,6 +782,7 @@ static const struct regmap_config bcm2835_regmap_config[] = { + .precious_reg = bcm2835_i2s_precious_reg, + .volatile_reg = bcm2835_i2s_volatile_reg, + .cache_type = REGCACHE_RBTREE, ++ .name = "i2s", + }, + { + .reg_bits = 32, +@@ -790,6 +791,7 @@ static const struct regmap_config bcm2835_regmap_config[] = { + .max_register = BCM2835_CLK_PCMDIV_REG, + .volatile_reg = bcm2835_clk_volatile_reg, + .cache_type = REGCACHE_RBTREE, ++ .name = "clk", + }, + }; + + +From 46931a1a476d1f1deb4dd654305a911e720bda21 Mon Sep 17 00:00:00 2001 +From: Matthias Reichl <hias@horus.com> +Date: Sun, 11 Oct 2015 15:35:20 +0200 +Subject: [PATCH 102/112] bcm2835-i2s: Register PCM device + +Code ported from bcm2708-i2s driver in Raspberry Pi tree. + +RPi commit ba46b4935a23aa2caac1855ead52a035d4776680 ("ASoC: Add +support for BCM2708") + +This driver adds support for digital audio (I2S) +for the BCM2708 SoC that is used by the +Raspberry Pi. External audio codecs can be +connected to the Raspberry Pi via P5 header. + +It relies on cyclic DMA engine support for BCM2708. + +Signed-off-by: Florian Meier <florian.meier@koalo.de> + +Signed-off-by: Matthias Reichl <hias@horus.com> +--- + sound/soc/bcm/bcm2835-i2s.c | 23 ++++++++++++++++++++++- + 1 file changed, 22 insertions(+), 1 deletion(-) + +diff --git a/sound/soc/bcm/bcm2835-i2s.c b/sound/soc/bcm/bcm2835-i2s.c +index 2d29050..ce93ef0 100644 +--- a/sound/soc/bcm/bcm2835-i2s.c ++++ b/sound/soc/bcm/bcm2835-i2s.c +@@ -799,6 +799,25 @@ static const struct snd_soc_component_driver bcm2835_i2s_component = { + .name = "bcm2835-i2s-comp", + }; + ++static const struct snd_pcm_hardware bcm2835_pcm_hardware = { ++ .info = SNDRV_PCM_INFO_INTERLEAVED | ++ SNDRV_PCM_INFO_JOINT_DUPLEX, ++ .formats = SNDRV_PCM_FMTBIT_S16_LE | ++ SNDRV_PCM_FMTBIT_S24_LE | ++ SNDRV_PCM_FMTBIT_S32_LE, ++ .period_bytes_min = 32, ++ .period_bytes_max = 64 * PAGE_SIZE, ++ .periods_min = 2, ++ .periods_max = 255, ++ .buffer_bytes_max = 128 * PAGE_SIZE, ++}; ++ ++static const struct snd_dmaengine_pcm_config bcm2835_dmaengine_pcm_config = { ++ .prepare_slave_config = snd_dmaengine_pcm_prepare_slave_config, ++ .pcm_hardware = &bcm2835_pcm_hardware, ++ .prealloc_buffer_size = 256 * PAGE_SIZE, ++}; ++ + static int bcm2835_i2s_probe(struct platform_device *pdev) + { + struct bcm2835_i2s_dev *dev; +@@ -870,7 +889,9 @@ static int bcm2835_i2s_probe(struct platform_device *pdev) + return ret; + } + +- ret = devm_snd_dmaengine_pcm_register(&pdev->dev, NULL, 0); ++ ret = devm_snd_dmaengine_pcm_register(&pdev->dev, ++ &bcm2835_dmaengine_pcm_config, ++ SND_DMAENGINE_PCM_FLAG_COMPAT); + if (ret) { + dev_err(&pdev->dev, "Could not register PCM: %d\n", ret); + return ret; + +From 04c99807249213d277900d529ad921edad28af25 Mon Sep 17 00:00:00 2001 +From: Matthias Reichl <hias@horus.com> +Date: Sun, 11 Oct 2015 15:55:21 +0200 +Subject: [PATCH 103/112] bcm2835-i2s: Enable MMAP support via a DT property + +Code ported from bcm2708-i2s driver in Raspberry Pi tree. + +RPi commit 7ee829fd77a30127db5d0b3c7d79b8718166e568 ("bcm2708-i2s: +Enable MMAP support via a DT property and overlay") + +The i2s driver used to claim to support MMAP, but that feature was disabled +when some problems were found. Add the ability to enable this feature +through Device Tree, using the i2s-mmap overlay. + +See: #1004 + +Signed-off-by: Matthias Reichl <hias@horus.com> +--- + sound/soc/bcm/bcm2835-i2s.c | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/sound/soc/bcm/bcm2835-i2s.c b/sound/soc/bcm/bcm2835-i2s.c +index ce93ef0..6f60c2c 100644 +--- a/sound/soc/bcm/bcm2835-i2s.c ++++ b/sound/soc/bcm/bcm2835-i2s.c +@@ -799,7 +799,7 @@ static const struct snd_soc_component_driver bcm2835_i2s_component = { + .name = "bcm2835-i2s-comp", + }; + +-static const struct snd_pcm_hardware bcm2835_pcm_hardware = { ++static struct snd_pcm_hardware bcm2835_pcm_hardware = { + .info = SNDRV_PCM_INFO_INTERLEAVED | + SNDRV_PCM_INFO_JOINT_DUPLEX, + .formats = SNDRV_PCM_FMTBIT_S16_LE | +@@ -835,6 +835,11 @@ static int bcm2835_i2s_probe(struct platform_device *pdev) + } + dma_reg_base = be32_to_cpup(addr); + ++ if (of_property_read_bool(pdev->dev.of_node, "brcm,enable-mmap")) ++ bcm2835_pcm_hardware.info |= ++ SNDRV_PCM_INFO_MMAP | ++ SNDRV_PCM_INFO_MMAP_VALID; ++ + /* Request both ioareas */ + for (i = 0; i <= 1; i++) { + void __iomem *base; + +From 262486d1cc4f3cf204c012100bd7bfd36f446b37 Mon Sep 17 00:00:00 2001 +From: Phil Elwell <phil@raspberrypi.org> +Date: Thu, 21 Apr 2016 15:44:14 +0100 +Subject: [PATCH 104/112] bcm2835-i2s: Reduce the TX DREQ threshold + +TX FIFO overrun is thought to be the cause of channel swapping, so +reducing the DREQ threshold seems reasonable and appears to be +effective. + +See: https://github.com/raspberrypi/linux/issues/1417 + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> +--- + sound/soc/bcm/bcm2835-i2s.c | 21 ++++++++++++++------- + 1 file changed, 14 insertions(+), 7 deletions(-) + +diff --git a/sound/soc/bcm/bcm2835-i2s.c b/sound/soc/bcm/bcm2835-i2s.c +index 6f60c2c..b26f958 100644 +--- a/sound/soc/bcm/bcm2835-i2s.c ++++ b/sound/soc/bcm/bcm2835-i2s.c +@@ -555,15 +555,22 @@ static int bcm2835_i2s_hw_params(struct snd_pcm_substream *substream, + + /* Setup the DMA parameters */ + regmap_update_bits(dev->i2s_regmap, BCM2835_I2S_CS_A_REG, +- BCM2835_I2S_RXTHR(1) +- | BCM2835_I2S_TXTHR(1) +- | BCM2835_I2S_DMAEN, 0xffffffff); ++ BCM2835_I2S_RXTHR(3) ++ | BCM2835_I2S_TXTHR(3) ++ | BCM2835_I2S_DMAEN, ++ BCM2835_I2S_RXTHR(1) ++ | BCM2835_I2S_TXTHR(1) ++ | BCM2835_I2S_DMAEN); + + regmap_update_bits(dev->i2s_regmap, BCM2835_I2S_DREQ_A_REG, +- BCM2835_I2S_TX_PANIC(0x10) +- | BCM2835_I2S_RX_PANIC(0x30) +- | BCM2835_I2S_TX(0x30) +- | BCM2835_I2S_RX(0x20), 0xffffffff); ++ BCM2835_I2S_TX_PANIC(0x7f) ++ | BCM2835_I2S_RX_PANIC(0x7f) ++ | BCM2835_I2S_TX(0x7f) ++ | BCM2835_I2S_RX(0x7f), ++ BCM2835_I2S_TX_PANIC(0x10) ++ | BCM2835_I2S_RX_PANIC(0x30) ++ | BCM2835_I2S_TX(0x20) ++ | BCM2835_I2S_RX(0x20)); + + /* Clear FIFOs */ + bcm2835_i2s_clear_fifos(dev, true, true); + +From de142c7f01c5fea98e0548d564c08e0084cb4706 Mon Sep 17 00:00:00 2001 +From: Eric Anholt <eric@anholt.net> +Date: Wed, 14 Oct 2015 11:32:14 -0700 +Subject: [PATCH 105/112] drm/vc4: Force HDMI to connected. + +For some reason on the downstream tree, the HPD GPIO isn't working. + +Signed-off-by: Eric Anholt <eric@anholt.net> +--- + drivers/gpu/drm/vc4/vc4_hdmi.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c +index d8b8649..136847e 100644 +--- a/drivers/gpu/drm/vc4/vc4_hdmi.c ++++ b/drivers/gpu/drm/vc4/vc4_hdmi.c +@@ -166,6 +166,8 @@ vc4_hdmi_connector_detect(struct drm_connector *connector, bool force) + struct drm_device *dev = connector->dev; + struct vc4_dev *vc4 = to_vc4_dev(dev); + ++ return connector_status_connected; ++ + if (vc4->hdmi->hpd_gpio) { + if (gpio_get_value_cansleep(vc4->hdmi->hpd_gpio) ^ + vc4->hdmi->hpd_active_low) + +From 69dd4dd3bef6d673a6b81f115b83238e70c30e7b Mon Sep 17 00:00:00 2001 +From: Aaron Shaw <shawaj@gmail.com> +Date: Thu, 7 Apr 2016 21:26:21 +0100 +Subject: [PATCH 106/112] Add Support for JustBoom Audio boards + +justboom-dac: Adjust for ALSA API change + +As of 4.4, snd_soc_limit_volume now takes a struct snd_soc_card * +rather than a struct snd_soc_codec *. + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> +--- + arch/arm/configs/bcm2709_defconfig | 4 +- + arch/arm/configs/bcmrpi_defconfig | 4 +- + sound/soc/bcm/Kconfig | 14 +++ + sound/soc/bcm/Makefile | 4 + + sound/soc/bcm/justboom-dac.c | 162 ++++++++++++++++++++++++++++ + sound/soc/bcm/justboom-digi.c | 215 +++++++++++++++++++++++++++++++++++++ + 6 files changed, 399 insertions(+), 4 deletions(-) + create mode 100644 sound/soc/bcm/justboom-dac.c + create mode 100644 sound/soc/bcm/justboom-digi.c + +diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig +index f42c5eb..055ecfc 100644 +--- a/arch/arm/configs/bcm2709_defconfig ++++ b/arch/arm/configs/bcm2709_defconfig +@@ -856,8 +856,8 @@ CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI=m + CONFIG_SND_BCM2708_SOC_HIFIBERRY_AMP=m + CONFIG_SND_BCM2708_SOC_RPI_DAC=m + CONFIG_SND_BCM2708_SOC_RPI_PROTO=m +-CONFIG_SND_BCM2708_SOC_BOOMBERRY_DAC=m +-CONFIG_SND_BCM2708_SOC_BOOMBERRY_DIGI=m ++CONFIG_SND_BCM2708_SOC_JUSTBOOM_DAC=m ++CONFIG_SND_BCM2708_SOC_JUSTBOOM_DIGI=m + CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC=m + CONFIG_SND_BCM2708_SOC_RASPIDAC3=m + CONFIG_SND_BCM2708_SOC_ADAU1977_ADC=m +diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig +index 8bd0207..8e0b51f 100644 +--- a/arch/arm/configs/bcmrpi_defconfig ++++ b/arch/arm/configs/bcmrpi_defconfig +@@ -848,8 +848,8 @@ CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI=m + CONFIG_SND_BCM2708_SOC_HIFIBERRY_AMP=m + CONFIG_SND_BCM2708_SOC_RPI_DAC=m + CONFIG_SND_BCM2708_SOC_RPI_PROTO=m +-CONFIG_SND_BCM2708_SOC_BOOMBERRY_DAC=m +-CONFIG_SND_BCM2708_SOC_BOOMBERRY_DIGI=m ++CONFIG_SND_BCM2708_SOC_JUSTBOOM_DAC=m ++CONFIG_SND_BCM2708_SOC_JUSTBOOM_DIGI=m + CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC=m + CONFIG_SND_BCM2708_SOC_RASPIDAC3=m + CONFIG_SND_BCM2708_SOC_ADAU1977_ADC=m +diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig +index 1a3f826..e2e2782 100644 +--- a/sound/soc/bcm/Kconfig ++++ b/sound/soc/bcm/Kconfig +@@ -50,6 +50,20 @@ config SND_BCM2708_SOC_RPI_PROTO + help + Say Y or M if you want to add support for Audio Codec Board PROTO (WM8731). + ++config SND_BCM2708_SOC_JUSTBOOM_DAC ++ tristate "Support for JustBoom DAC" ++ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S ++ select SND_SOC_PCM512x ++ help ++ Say Y or M if you want to add support for JustBoom DAC. ++ ++config SND_BCM2708_SOC_JUSTBOOM_DIGI ++ tristate "Support for JustBoom Digi" ++ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S ++ select SND_SOC_WM8804 ++ help ++ Say Y or M if you want to add support for JustBoom Digi. ++ + config SND_BCM2708_SOC_IQAUDIO_DAC + tristate "Support for IQaudIO-DAC" + depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S +diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile +index b21e11e..6c9714c 100644 +--- a/sound/soc/bcm/Makefile ++++ b/sound/soc/bcm/Makefile +@@ -8,6 +8,8 @@ snd-soc-hifiberry-dac-objs := hifiberry_dac.o + snd-soc-hifiberry-dacplus-objs := hifiberry_dacplus.o + snd-soc-hifiberry-digi-objs := hifiberry_digi.o + snd-soc-hifiberry-amp-objs := hifiberry_amp.o ++snd-soc-justboom-dac-objs := justboom-dac.o ++snd-soc-justboom-digi-objs := justboom-digi.o + snd-soc-rpi-dac-objs := rpi-dac.o + snd-soc-rpi-proto-objs := rpi-proto.o + snd-soc-iqaudio-dac-objs := iqaudio-dac.o +@@ -17,6 +19,8 @@ obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o + obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS) += snd-soc-hifiberry-dacplus.o + obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI) += snd-soc-hifiberry-digi.o + obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_AMP) += snd-soc-hifiberry-amp.o ++obj-$(CONFIG_SND_BCM2708_SOC_JUSTBOOM_DAC) += snd-soc-justboom-dac.o ++obj-$(CONFIG_SND_BCM2708_SOC_JUSTBOOM_DIGI) += snd-soc-justboom-digi.o + obj-$(CONFIG_SND_BCM2708_SOC_RPI_DAC) += snd-soc-rpi-dac.o + obj-$(CONFIG_SND_BCM2708_SOC_RPI_PROTO) += snd-soc-rpi-proto.o + obj-$(CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC) += snd-soc-iqaudio-dac.o +diff --git a/sound/soc/bcm/justboom-dac.c b/sound/soc/bcm/justboom-dac.c +new file mode 100644 +index 0000000..8fd50db +--- /dev/null ++++ b/sound/soc/bcm/justboom-dac.c +@@ -0,0 +1,162 @@ ++/* ++ * ASoC Driver for JustBoom DAC Raspberry Pi HAT Sound Card ++ * ++ * Author: Milan Neskovic ++ * Copyright 2016 ++ * based on code by Daniel Matuschek <info@crazy-audio.com> ++ * based on code by Florian Meier <florian.meier@koalo.de> ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * version 2 as published by the Free Software Foundation. ++ * ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * General Public License for more details. ++ */ ++ ++#include <linux/module.h> ++#include <linux/platform_device.h> ++ ++#include <sound/core.h> ++#include <sound/pcm.h> ++#include <sound/pcm_params.h> ++#include <sound/soc.h> ++#include <sound/jack.h> ++ ++#include "../codecs/pcm512x.h" ++ ++static bool digital_gain_0db_limit = true; ++ ++static int snd_rpi_justboom_dac_init(struct snd_soc_pcm_runtime *rtd) ++{ ++ struct snd_soc_codec *codec = rtd->codec; ++ snd_soc_update_bits(codec, PCM512x_GPIO_EN, 0x08, 0x08); ++ snd_soc_update_bits(codec, PCM512x_GPIO_OUTPUT_4, 0xf, 0x02); ++ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x08,0x08); ++ ++ if (digital_gain_0db_limit) ++ { ++ int ret; ++ struct snd_soc_card *card = rtd->card; ++ ++ ret = snd_soc_limit_volume(card, "Digital Playback Volume", 207); ++ if (ret < 0) ++ dev_warn(card->dev, "Failed to set volume limit: %d\n", ret); ++ } ++ ++ return 0; ++} ++ ++static int snd_rpi_justboom_dac_hw_params(struct snd_pcm_substream *substream, ++ struct snd_pcm_hw_params *params) ++{ ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; ++ /*return snd_soc_dai_set_bclk_ratio(cpu_dai, 64);*/ ++ unsigned int sample_bits = ++ snd_pcm_format_physical_width(params_format(params)); ++ return snd_soc_dai_set_bclk_ratio(cpu_dai, sample_bits * 2); ++} ++ ++static int snd_rpi_justboom_dac_startup(struct snd_pcm_substream *substream) { ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_codec *codec = rtd->codec; ++ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x08,0x08); ++ return 0; ++} ++ ++static void snd_rpi_justboom_dac_shutdown(struct snd_pcm_substream *substream) { ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_codec *codec = rtd->codec; ++ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x08,0x00); ++} ++ ++/* machine stream operations */ ++static struct snd_soc_ops snd_rpi_justboom_dac_ops = { ++ .hw_params = snd_rpi_justboom_dac_hw_params, ++ .startup = snd_rpi_justboom_dac_startup, ++ .shutdown = snd_rpi_justboom_dac_shutdown, ++}; ++ ++static struct snd_soc_dai_link snd_rpi_justboom_dac_dai[] = { ++{ ++ .name = "JustBoom DAC", ++ .stream_name = "JustBoom DAC HiFi", ++ .cpu_dai_name = "bcm2708-i2s.0", ++ .codec_dai_name = "pcm512x-hifi", ++ .platform_name = "bcm2708-i2s.0", ++ .codec_name = "pcm512x.1-004d", ++ .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | ++ SND_SOC_DAIFMT_CBS_CFS, ++ .ops = &snd_rpi_justboom_dac_ops, ++ .init = snd_rpi_justboom_dac_init, ++}, ++}; ++ ++/* audio machine driver */ ++static struct snd_soc_card snd_rpi_justboom_dac = { ++ .name = "snd_rpi_justboom_dac", ++ .owner = THIS_MODULE, ++ .dai_link = snd_rpi_justboom_dac_dai, ++ .num_links = ARRAY_SIZE(snd_rpi_justboom_dac_dai), ++}; ++ ++static int snd_rpi_justboom_dac_probe(struct platform_device *pdev) ++{ ++ int ret = 0; ++ ++ snd_rpi_justboom_dac.dev = &pdev->dev; ++ ++ if (pdev->dev.of_node) { ++ struct device_node *i2s_node; ++ struct snd_soc_dai_link *dai = &snd_rpi_justboom_dac_dai[0]; ++ i2s_node = of_parse_phandle(pdev->dev.of_node, ++ "i2s-controller", 0); ++ ++ if (i2s_node) { ++ dai->cpu_dai_name = NULL; ++ dai->cpu_of_node = i2s_node; ++ dai->platform_name = NULL; ++ dai->platform_of_node = i2s_node; ++ } ++ ++ digital_gain_0db_limit = !of_property_read_bool( ++ pdev->dev.of_node, "justboom,24db_digital_gain"); ++ } ++ ++ ret = snd_soc_register_card(&snd_rpi_justboom_dac); ++ if (ret) ++ dev_err(&pdev->dev, ++ "snd_soc_register_card() failed: %d\n", ret); ++ ++ return ret; ++} ++ ++static int snd_rpi_justboom_dac_remove(struct platform_device *pdev) ++{ ++ return snd_soc_unregister_card(&snd_rpi_justboom_dac); ++} ++ ++static const struct of_device_id snd_rpi_justboom_dac_of_match[] = { ++ { .compatible = "justboom,justboom-dac", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, snd_rpi_justboom_dac_of_match); ++ ++static struct platform_driver snd_rpi_justboom_dac_driver = { ++ .driver = { ++ .name = "snd-rpi-justboom-dac", ++ .owner = THIS_MODULE, ++ .of_match_table = snd_rpi_justboom_dac_of_match, ++ }, ++ .probe = snd_rpi_justboom_dac_probe, ++ .remove = snd_rpi_justboom_dac_remove, ++}; ++ ++module_platform_driver(snd_rpi_justboom_dac_driver); ++ ++MODULE_AUTHOR("Milan Neskovic <info@justboom.co>"); ++MODULE_DESCRIPTION("ASoC Driver for JustBoom PI DAC HAT Sound Card"); ++MODULE_LICENSE("GPL v2"); +diff --git a/sound/soc/bcm/justboom-digi.c b/sound/soc/bcm/justboom-digi.c +new file mode 100644 +index 0000000..91acb66 +--- /dev/null ++++ b/sound/soc/bcm/justboom-digi.c +@@ -0,0 +1,215 @@ ++/* ++ * ASoC Driver for JustBoom Raspberry Pi Digi HAT Sound Card ++ * ++ * Author: Milan Neskovic ++ * Copyright 2016 ++ * based on code by Daniel Matuschek <info@crazy-audio.com> ++ * based on code by Florian Meier <florian.meier@koalo.de> ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * version 2 as published by the Free Software Foundation. ++ * ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * General Public License for more details. ++ */ ++ ++#include <linux/module.h> ++#include <linux/platform_device.h> ++ ++#include <sound/core.h> ++#include <sound/pcm.h> ++#include <sound/pcm_params.h> ++#include <sound/soc.h> ++#include <sound/jack.h> ++ ++#include "../codecs/wm8804.h" ++ ++static int snd_rpi_justboom_digi_init(struct snd_soc_pcm_runtime *rtd) ++{ ++ struct snd_soc_codec *codec = rtd->codec; ++ ++ /* enable TX output */ ++ snd_soc_update_bits(codec, WM8804_PWRDN, 0x4, 0x0); ++ ++ return 0; ++} ++ ++static int snd_rpi_justboom_digi_startup(struct snd_pcm_substream *substream) { ++ /* turn on digital output */ ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_codec *codec = rtd->codec; ++ snd_soc_update_bits(codec, WM8804_PWRDN, 0x3c, 0x00); ++ return 0; ++} ++ ++static void snd_rpi_justboom_digi_shutdown(struct snd_pcm_substream *substream) { ++ /* turn off output */ ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_codec *codec = rtd->codec; ++ snd_soc_update_bits(codec, WM8804_PWRDN, 0x3c, 0x3c); ++} ++ ++static int snd_rpi_justboom_digi_hw_params(struct snd_pcm_substream *substream, ++ struct snd_pcm_hw_params *params) ++{ ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_dai *codec_dai = rtd->codec_dai; ++ struct snd_soc_codec *codec = rtd->codec; ++ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; ++ ++ int sysclk = 27000000; /* This is fixed on this board */ ++ ++ long mclk_freq=0; ++ int mclk_div=1; ++ int sampling_freq=1; ++ ++ int ret; ++ ++ int samplerate = params_rate(params); ++ ++ if (samplerate<=96000) { ++ mclk_freq=samplerate*256; ++ mclk_div=WM8804_MCLKDIV_256FS; ++ } else { ++ mclk_freq=samplerate*128; ++ mclk_div=WM8804_MCLKDIV_128FS; ++ } ++ ++ switch (samplerate) { ++ case 32000: ++ sampling_freq=0x03; ++ break; ++ case 44100: ++ sampling_freq=0x00; ++ break; ++ case 48000: ++ sampling_freq=0x02; ++ break; ++ case 88200: ++ sampling_freq=0x08; ++ break; ++ case 96000: ++ sampling_freq=0x0a; ++ break; ++ case 176400: ++ sampling_freq=0x0c; ++ break; ++ case 192000: ++ sampling_freq=0x0e; ++ break; ++ default: ++ dev_err(codec->dev, ++ "Failed to set WM8804 SYSCLK, unsupported samplerate %d\n", ++ samplerate); ++ } ++ ++ snd_soc_dai_set_clkdiv(codec_dai, WM8804_MCLK_DIV, mclk_div); ++ snd_soc_dai_set_pll(codec_dai, 0, 0, sysclk, mclk_freq); ++ ++ ret = snd_soc_dai_set_sysclk(codec_dai, WM8804_TX_CLKSRC_PLL, ++ sysclk, SND_SOC_CLOCK_OUT); ++ if (ret < 0) { ++ dev_err(codec->dev, ++ "Failed to set WM8804 SYSCLK: %d\n", ret); ++ return ret; ++ } ++ ++ /* Enable TX output */ ++ snd_soc_update_bits(codec, WM8804_PWRDN, 0x4, 0x0); ++ ++ /* Power on */ ++ snd_soc_update_bits(codec, WM8804_PWRDN, 0x9, 0); ++ ++ /* set sampling frequency status bits */ ++ snd_soc_update_bits(codec, WM8804_SPDTX4, 0x0f, sampling_freq); ++ ++ return snd_soc_dai_set_bclk_ratio(cpu_dai,64); ++} ++ ++/* machine stream operations */ ++static struct snd_soc_ops snd_rpi_justboom_digi_ops = { ++ .hw_params = snd_rpi_justboom_digi_hw_params, ++ .startup = snd_rpi_justboom_digi_startup, ++ .shutdown = snd_rpi_justboom_digi_shutdown, ++}; ++ ++static struct snd_soc_dai_link snd_rpi_justboom_digi_dai[] = { ++{ ++ .name = "JustBoom Digi", ++ .stream_name = "JustBoom Digi HiFi", ++ .cpu_dai_name = "bcm2708-i2s.0", ++ .codec_dai_name = "wm8804-spdif", ++ .platform_name = "bcm2708-i2s.0", ++ .codec_name = "wm8804.1-003b", ++ .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | ++ SND_SOC_DAIFMT_CBM_CFM, ++ .ops = &snd_rpi_justboom_digi_ops, ++ .init = snd_rpi_justboom_digi_init, ++}, ++}; ++ ++/* audio machine driver */ ++static struct snd_soc_card snd_rpi_justboom_digi = { ++ .name = "snd_rpi_justboom_digi", ++ .owner = THIS_MODULE, ++ .dai_link = snd_rpi_justboom_digi_dai, ++ .num_links = ARRAY_SIZE(snd_rpi_justboom_digi_dai), ++}; ++ ++static int snd_rpi_justboom_digi_probe(struct platform_device *pdev) ++{ ++ int ret = 0; ++ ++ snd_rpi_justboom_digi.dev = &pdev->dev; ++ ++ if (pdev->dev.of_node) { ++ struct device_node *i2s_node; ++ struct snd_soc_dai_link *dai = &snd_rpi_justboom_digi_dai[0]; ++ i2s_node = of_parse_phandle(pdev->dev.of_node, ++ "i2s-controller", 0); ++ ++ if (i2s_node) { ++ dai->cpu_dai_name = NULL; ++ dai->cpu_of_node = i2s_node; ++ dai->platform_name = NULL; ++ dai->platform_of_node = i2s_node; ++ } ++ } ++ ++ ret = snd_soc_register_card(&snd_rpi_justboom_digi); ++ if (ret) ++ dev_err(&pdev->dev, ++ "snd_soc_register_card() failed: %d\n", ret); ++ ++ return ret; ++} ++ ++static int snd_rpi_justboom_digi_remove(struct platform_device *pdev) ++{ ++ return snd_soc_unregister_card(&snd_rpi_justboom_digi); ++} ++ ++static const struct of_device_id snd_rpi_justboom_digi_of_match[] = { ++ { .compatible = "justboom,justboom-digi", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, snd_rpi_justboom_digi_of_match); ++ ++static struct platform_driver snd_rpi_justboom_digi_driver = { ++ .driver = { ++ .name = "snd-rpi-justboom-digi", ++ .owner = THIS_MODULE, ++ .of_match_table = snd_rpi_justboom_digi_of_match, ++ }, ++ .probe = snd_rpi_justboom_digi_probe, ++ .remove = snd_rpi_justboom_digi_remove, ++}; ++ ++module_platform_driver(snd_rpi_justboom_digi_driver); ++ ++MODULE_AUTHOR("Milan Neskovic <info@justboom.co>"); ++MODULE_DESCRIPTION("ASoC Driver for JustBoom PI Digi HAT Sound Card"); ++MODULE_LICENSE("GPL v2"); + +From 2fc52b7468ac688af8a702978eb688fac59eb97b Mon Sep 17 00:00:00 2001 +From: Eric Anholt <eric@anholt.net> +Date: Tue, 19 Apr 2016 15:55:02 -0700 +Subject: [PATCH 107/112] ARM: bcm2708: Enable building power domain driver. + +Signed-off-by: Eric Anholt <eric@anholt.net> +--- + drivers/soc/bcm/Kconfig | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/soc/bcm/Kconfig b/drivers/soc/bcm/Kconfig +index 3066ede..e235181 100644 +--- a/drivers/soc/bcm/Kconfig ++++ b/drivers/soc/bcm/Kconfig +@@ -1,6 +1,6 @@ + config RASPBERRYPI_POWER + bool "Raspberry Pi power domain driver" +- depends on ARCH_BCM2835 || COMPILE_TEST ++ depends on ARCH_BCM2835 || ARCH_BCM2708 || ARCH_BCM2709 || COMPILE_TEST + depends on RASPBERRYPI_FIRMWARE=y + select PM_GENERIC_DOMAINS if PM + select PM_GENERIC_DOMAINS_OF if PM + +From 1acf838a61e40b5f1a59152810802e6e2db3d273 Mon Sep 17 00:00:00 2001 +From: Andrey Grodzovsky <andrey2805@gmail.com> +Date: Tue, 3 May 2016 22:10:59 -0400 +Subject: [PATCH 108/112] ARM: adau1977-adc: Add basic machine driver for + adau1977 codec driver. + +This commit adds basic support for the codec usage including: Device tree overlay, +binding I2S bus and setting I2S mode, clock source and frequency setting according +to spec. + +Signed-off-by: Andrey Grodzovsky <andrey2805@gmail.com> +--- + sound/soc/bcm/Kconfig | 7 +++ + sound/soc/bcm/Makefile | 2 + + sound/soc/bcm/adau1977-adc.c | 125 +++++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 134 insertions(+) + create mode 100644 sound/soc/bcm/adau1977-adc.c + +diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig +index e2e2782..59890cc 100644 +--- a/sound/soc/bcm/Kconfig ++++ b/sound/soc/bcm/Kconfig +@@ -78,3 +78,10 @@ config SND_BCM2708_SOC_RASPIDAC3 + select SND_SOC_TPA6130A2 + help + Say Y or M if you want to add support for RaspiDAC Rev.3x. ++ ++config SND_BCM2708_SOC_ADAU1977_ADC ++ tristate "Support for ADAU1977 ADC" ++ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S ++ select SND_SOC_ADAU1977_I2C ++ help ++ Say Y or M if you want to add support for ADAU1977 ADC. +diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile +index 6c9714c..d3124f5 100644 +--- a/sound/soc/bcm/Makefile ++++ b/sound/soc/bcm/Makefile +@@ -4,6 +4,7 @@ snd-soc-bcm2835-i2s-objs := bcm2835-i2s.o + obj-$(CONFIG_SND_BCM2835_SOC_I2S) += snd-soc-bcm2835-i2s.o + + # BCM2708 Machine Support ++snd-soc-adau1977-adc-objs := adau1977-adc.o + snd-soc-hifiberry-dac-objs := hifiberry_dac.o + snd-soc-hifiberry-dacplus-objs := hifiberry_dacplus.o + snd-soc-hifiberry-digi-objs := hifiberry_digi.o +@@ -15,6 +16,7 @@ snd-soc-rpi-proto-objs := rpi-proto.o + snd-soc-iqaudio-dac-objs := iqaudio-dac.o + snd-soc-raspidac3-objs := raspidac3.o + ++obj-$(CONFIG_SND_BCM2708_SOC_ADAU1977_ADC) += snd-soc-adau1977-adc.o + obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o + obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS) += snd-soc-hifiberry-dacplus.o + obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI) += snd-soc-hifiberry-digi.o +diff --git a/sound/soc/bcm/adau1977-adc.c b/sound/soc/bcm/adau1977-adc.c +new file mode 100644 +index 0000000..6e2ee02 +--- /dev/null ++++ b/sound/soc/bcm/adau1977-adc.c +@@ -0,0 +1,125 @@ ++/* ++ * ASoC Driver for ADAU1977 ADC ++ * ++ * Author: Andrey Grodzovsky <andrey2805@gmail.com> ++ * Copyright 2016 ++ * ++ * This file is based on hifibery_dac driver by Florian Meier. ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * version 2 as published by the Free Software Foundation. ++ * ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * General Public License for more details. ++ */ ++ ++#include <linux/module.h> ++#include <linux/platform_device.h> ++ ++#include <sound/core.h> ++#include <sound/pcm.h> ++#include <sound/pcm_params.h> ++#include <sound/soc.h> ++#include <sound/jack.h> ++ ++enum adau1977_clk_id { ++ ADAU1977_SYSCLK, ++}; ++ ++enum adau1977_sysclk_src { ++ ADAU1977_SYSCLK_SRC_MCLK, ++ ADAU1977_SYSCLK_SRC_LRCLK, ++}; ++ ++static int eval_adau1977_init(struct snd_soc_pcm_runtime *rtd) ++{ ++ int ret; ++ struct snd_soc_dai *codec_dai = rtd->codec_dai; ++ ++ ret = snd_soc_dai_set_tdm_slot(codec_dai, 0, 0, 0, 0); ++ if (ret < 0) ++ return ret; ++ ++ return snd_soc_codec_set_sysclk(rtd->codec, ADAU1977_SYSCLK, ++ ADAU1977_SYSCLK_SRC_MCLK, 11289600, SND_SOC_CLOCK_IN); ++} ++ ++static struct snd_soc_dai_link snd_rpi_adau1977_dai[] = { ++ { ++ .name = "adau1977", ++ .stream_name = "ADAU1977", ++ .cpu_dai_name = "bcm2708-i2s.0", ++ .codec_dai_name = "adau1977-hifi", ++ .platform_name = "bcm2708-i2s.0", ++ .codec_name = "adau1977.1-0011", ++ .init = eval_adau1977_init, ++ .dai_fmt = SND_SOC_DAIFMT_I2S | ++ SND_SOC_DAIFMT_NB_NF | ++ SND_SOC_DAIFMT_CBM_CFM, ++ }, ++}; ++ ++/* audio machine driver */ ++static struct snd_soc_card snd_adau1977_adc = { ++ .name = "snd_rpi_adau1977_adc", ++ .owner = THIS_MODULE, ++ .dai_link = snd_rpi_adau1977_dai, ++ .num_links = ARRAY_SIZE(snd_rpi_adau1977_dai), ++}; ++ ++static int snd_adau1977_adc_probe(struct platform_device *pdev) ++{ ++ int ret = 0; ++ ++ snd_adau1977_adc.dev = &pdev->dev; ++ if (pdev->dev.of_node) { ++ struct device_node *i2s_node; ++ struct snd_soc_dai_link *dai = &snd_rpi_adau1977_dai[0]; ++ i2s_node = of_parse_phandle(pdev->dev.of_node, ++ "i2s-controller", 0); ++ ++ if (i2s_node) { ++ dai->cpu_dai_name = NULL; ++ dai->cpu_of_node = i2s_node; ++ dai->platform_name = NULL; ++ dai->platform_of_node = i2s_node; ++ } ++ } ++ ++ ret = snd_soc_register_card(&snd_adau1977_adc); ++ if (ret) ++ dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", ret); ++ ++ return ret; ++} ++ ++static int snd_adau1977_adc_remove(struct platform_device *pdev) ++{ ++ return snd_soc_unregister_card(&snd_adau1977_adc); ++} ++ ++static const struct of_device_id snd_adau1977_adc_of_match[] = { ++ { .compatible = "adi,adau1977-adc", }, ++ {}, ++}; ++ ++MODULE_DEVICE_TABLE(of, snd_adau1977_adc_of_match); ++ ++static struct platform_driver snd_adau1977_adc_driver = { ++ .driver = { ++ .name = "snd-adau1977-adc", ++ .owner = THIS_MODULE, ++ .of_match_table = snd_adau1977_adc_of_match, ++ }, ++ .probe = snd_adau1977_adc_probe, ++ .remove = snd_adau1977_adc_remove, ++}; ++ ++module_platform_driver(snd_adau1977_adc_driver); ++ ++MODULE_AUTHOR("Andrey Grodzovsky <andrey2805@gmail.com>"); ++MODULE_DESCRIPTION("ASoC Driver for ADAU1977 ADC"); ++MODULE_LICENSE("GPL v2"); + +From ae03e3ad4d50779677d0cf9ca847c8a1b4372e1c Mon Sep 17 00:00:00 2001 +From: Matt Flax <flatmax@flatmax.org> +Date: Mon, 16 May 2016 21:36:31 +1000 +Subject: [PATCH 109/112] New AudioInjector.net Pi soundcard with low jitter + audio in and out. + +Contains the sound/soc/bcm ALSA machine driver and necessary alterations to the Kconfig and Makefile. +Adds the dts overlay and updates the Makefile and README. +Updates the relevant defconfig files to enable building for the Raspberry Pi. +Thanks to Phil Elwell (pelwell) for the review, simple-card concepts and discussion. Thanks to Clive Messer for overlay naming suggestions. +--- + sound/soc/bcm/Kconfig | 7 ++ + sound/soc/bcm/Makefile | 3 + + sound/soc/bcm/audioinjector-pi-soundcard.c | 142 +++++++++++++++++++++++++++++ + 3 files changed, 152 insertions(+) + create mode 100644 sound/soc/bcm/audioinjector-pi-soundcard.c + +diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig +index 59890cc..e2e40ed 100644 +--- a/sound/soc/bcm/Kconfig ++++ b/sound/soc/bcm/Kconfig +@@ -85,3 +85,10 @@ config SND_BCM2708_SOC_ADAU1977_ADC + select SND_SOC_ADAU1977_I2C + help + Say Y or M if you want to add support for ADAU1977 ADC. ++ ++config SND_AUDIOINJECTOR_PI_SOUNDCARD ++ tristate "Support for audioinjector.net Pi add on soundcard" ++ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S ++ select SND_SOC_WM8731 ++ help ++ Say Y or M if you want to add support for audioinjector.net Pi Hat +diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile +index d3124f5..3353192 100644 +--- a/sound/soc/bcm/Makefile ++++ b/sound/soc/bcm/Makefile +@@ -15,6 +15,7 @@ snd-soc-rpi-dac-objs := rpi-dac.o + snd-soc-rpi-proto-objs := rpi-proto.o + snd-soc-iqaudio-dac-objs := iqaudio-dac.o + snd-soc-raspidac3-objs := raspidac3.o ++snd-soc-audioinjector-pi-soundcard-objs := audioinjector-pi-soundcard.o + + obj-$(CONFIG_SND_BCM2708_SOC_ADAU1977_ADC) += snd-soc-adau1977-adc.o + obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o +@@ -27,3 +28,5 @@ obj-$(CONFIG_SND_BCM2708_SOC_RPI_DAC) += snd-soc-rpi-dac.o + obj-$(CONFIG_SND_BCM2708_SOC_RPI_PROTO) += snd-soc-rpi-proto.o + obj-$(CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC) += snd-soc-iqaudio-dac.o + obj-$(CONFIG_SND_BCM2708_SOC_RASPIDAC3) += snd-soc-raspidac3.o ++obj-$(CONFIG_SND_AUDIOINJECTOR_PI_SOUNDCARD) += snd-soc-audioinjector-pi-soundcard.o ++ +diff --git a/sound/soc/bcm/audioinjector-pi-soundcard.c b/sound/soc/bcm/audioinjector-pi-soundcard.c +new file mode 100644 +index 0000000..39f29e2 +--- /dev/null ++++ b/sound/soc/bcm/audioinjector-pi-soundcard.c +@@ -0,0 +1,142 @@ ++/* ++ * ASoC Driver for AudioInjector Pi add on soundcard ++ * ++ * Created on: 13-May-2016 ++ * Author: flatmax@flatmax.org ++ * based on code by Cliff Cai <Cliff.Cai@analog.com> for the ssm2602 machine blackfin. ++ * with help from Lars-Peter Clausen for simplifying the original code to use the dai_fmt field. ++ * i2s_node code taken from the other sound/soc/bcm machine drivers. ++ * ++ * Copyright (C) 2016 Flatmax Pty. Ltd. ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * version 2 as published by the Free Software Foundation. ++ * ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * General Public License for more details. ++ */ ++ ++#include <linux/module.h> ++#include <linux/types.h> ++ ++#include <sound/core.h> ++#include <sound/soc.h> ++#include <sound/pcm_params.h> ++#include <sound/control.h> ++ ++#include "../codecs/wm8731.h" ++ ++static int audioinjector_pi_soundcard_dai_init(struct snd_soc_pcm_runtime *rtd) ++{ ++ struct snd_soc_dapm_context *dapm = &rtd->card->dapm; ++ ++ // not connected ++ snd_soc_dapm_nc_pin(dapm, "Mic Bias"); ++ snd_soc_dapm_nc_pin(dapm, "MICIN"); ++ snd_soc_dapm_nc_pin(dapm, "RHPOUT"); ++ snd_soc_dapm_nc_pin(dapm, "LHPOUT"); ++ ++ return snd_soc_dai_set_sysclk(rtd->codec_dai, WM8731_SYSCLK_XTAL, 12000000, SND_SOC_CLOCK_IN); ++} ++ ++static struct snd_soc_dai_link audioinjector_pi_soundcard_dai[] = { ++ { ++ .name = "AudioInjector audio", ++ .stream_name = "AudioInjector audio", ++ .cpu_dai_name = "bcm2708-i2s.0", ++ .codec_dai_name = "wm8731-hifi", ++ .platform_name = "bcm2835-i2s.0", ++ .codec_name = "wm8731.1-001a", ++ .init = audioinjector_pi_soundcard_dai_init, ++ .dai_fmt = SND_SOC_DAIFMT_CBM_CFM|SND_SOC_DAIFMT_I2S|SND_SOC_DAIFMT_NB_NF, ++ }, ++}; ++ ++static const struct snd_soc_dapm_widget wm8731_dapm_widgets[] = { ++ SND_SOC_DAPM_SPK("Ext Spk", NULL), ++ SND_SOC_DAPM_LINE("Line In Jacks", NULL), ++}; ++ ++/* Corgi machine connections to the codec pins */ ++static const struct snd_soc_dapm_route audioinjector_audio_map[] = { ++ /* speaker connected to LOUT, ROUT */ ++ {"Ext Spk", NULL, "ROUT"}, ++ {"Ext Spk", NULL, "LOUT"}, ++ ++ /* line inputs */ ++ {"Line In Jacks", NULL, "Line Input"}, ++}; ++ ++static struct snd_soc_card snd_soc_audioinjector = { ++ .name = "audioinjector-pi-soundcard", ++ .dai_link = audioinjector_pi_soundcard_dai, ++ .num_links = 1, ++ ++ .dapm_widgets = wm8731_dapm_widgets, ++ .num_dapm_widgets = ARRAY_SIZE(wm8731_dapm_widgets), ++ .dapm_routes = audioinjector_audio_map, ++ .num_dapm_routes = ARRAY_SIZE(audioinjector_audio_map), ++}; ++ ++static int audioinjector_pi_soundcard_probe(struct platform_device *pdev) ++{ ++ struct snd_soc_card *card = &snd_soc_audioinjector; ++ int ret; ++ ++ card->dev = &pdev->dev; ++ ++ if (pdev->dev.of_node) { ++ struct snd_soc_dai_link *dai = &audioinjector_pi_soundcard_dai[0]; ++ struct device_node *i2s_node = of_parse_phandle(pdev->dev.of_node, ++ "i2s-controller", 0); ++ ++ if (i2s_node) { ++ dai->cpu_dai_name = NULL; ++ dai->cpu_of_node = i2s_node; ++ dai->platform_name = NULL; ++ dai->platform_of_node = i2s_node; ++ } else ++ if (!dai->cpu_of_node) { ++ dev_err(&pdev->dev, "Property 'i2s-controller' missing or invalid\n"); ++ return -EINVAL; ++ } ++ } ++ ++ if ((ret = snd_soc_register_card(card))) { ++ dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", ret); ++ } ++ return ret; ++} ++ ++static int audioinjector_pi_soundcard_remove(struct platform_device *pdev) ++{ ++ struct snd_soc_card *card = platform_get_drvdata(pdev); ++ return snd_soc_unregister_card(card); ++ ++} ++ ++static const struct of_device_id audioinjector_pi_soundcard_of_match[] = { ++ { .compatible = "ai,audioinjector-pi-soundcard", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, audioinjector_pi_soundcard_of_match); ++ ++static struct platform_driver audioinjector_pi_soundcard_driver = { ++ .driver = { ++ .name = "audioinjector-audio", ++ .owner = THIS_MODULE, ++ .of_match_table = audioinjector_pi_soundcard_of_match, ++ }, ++ .probe = audioinjector_pi_soundcard_probe, ++ .remove = audioinjector_pi_soundcard_remove, ++}; ++ ++module_platform_driver(audioinjector_pi_soundcard_driver); ++MODULE_AUTHOR("Matt Flax <flatmax@flatmax.org>"); ++MODULE_DESCRIPTION("AudioInjector.net Pi Soundcard"); ++MODULE_LICENSE("GPL v2"); ++MODULE_ALIAS("platform:audioinjector-pi-soundcard"); ++ + +From aa9aed28809dbf4d95025626cb5de26b7da023d1 Mon Sep 17 00:00:00 2001 +From: Dave Stevenson <6by9@users.noreply.github.com> +Date: Wed, 25 May 2016 23:25:36 +0100 +Subject: [PATCH 110/112] BCM2835-V4L2: Correct handling for BGR24 vs RGB24. + +There was a bug in the GPU firmware that had reversed these +two formats. +Detect the old firmware, and reverse the formats if necessary. + +Signed-off-by: Dave Stevenson <6by9@users.noreply.github.com> +--- + drivers/media/platform/bcm2835/bcm2835-camera.c | 69 ++++++++++++++++++------- + drivers/media/platform/bcm2835/bcm2835-camera.h | 1 + + 2 files changed, 52 insertions(+), 18 deletions(-) + +diff --git a/drivers/media/platform/bcm2835/bcm2835-camera.c b/drivers/media/platform/bcm2835/bcm2835-camera.c +index 1b16c63..70f4db2 100644 +--- a/drivers/media/platform/bcm2835/bcm2835-camera.c ++++ b/drivers/media/platform/bcm2835/bcm2835-camera.c +@@ -115,7 +115,7 @@ static struct mmal_fmt formats[] = { + .name = "RGB24 (LE)", + .fourcc = V4L2_PIX_FMT_RGB24, + .flags = 0, +- .mmal = MMAL_ENCODING_BGR24, ++ .mmal = MMAL_ENCODING_RGB24, + .depth = 24, + .mmal_component = MMAL_COMPONENT_CAMERA, + .ybbp = 3, +@@ -187,7 +187,7 @@ static struct mmal_fmt formats[] = { + .name = "RGB24 (BE)", + .fourcc = V4L2_PIX_FMT_BGR24, + .flags = 0, +- .mmal = MMAL_ENCODING_RGB24, ++ .mmal = MMAL_ENCODING_BGR24, + .depth = 24, + .mmal_component = MMAL_COMPONENT_CAMERA, + .ybbp = 3, +@@ -1061,6 +1061,13 @@ static int mmal_setup_components(struct bm2835_mmal_dev *dev, + else + camera_port->format.encoding = mfmt->mmal; + ++ if (dev->rgb_bgr_swapped) { ++ if (camera_port->format.encoding == MMAL_ENCODING_RGB24) ++ camera_port->format.encoding = MMAL_ENCODING_BGR24; ++ else if (camera_port->format.encoding == MMAL_ENCODING_BGR24) ++ camera_port->format.encoding = MMAL_ENCODING_RGB24; ++ } ++ + camera_port->format.encoding_variant = 0; + camera_port->es.video.width = f->fmt.pix.width; + camera_port->es.video.height = f->fmt.pix.height; +@@ -1571,12 +1578,17 @@ static int set_camera_parameters(struct vchiq_mmal_instance *instance, + return ret; + } + ++#define MAX_SUPPORTED_ENCODINGS 20 ++ + /* MMAL instance and component init */ + static int __init mmal_init(struct bm2835_mmal_dev *dev) + { + int ret; + struct mmal_es_format *format; + u32 bool_true = 1; ++ u32 supported_encodings[MAX_SUPPORTED_ENCODINGS]; ++ int param_size; ++ struct vchiq_mmal_component *camera; + + ret = vchiq_mmal_init(&dev->instance); + if (ret < 0) +@@ -1588,21 +1600,48 @@ static int __init mmal_init(struct bm2835_mmal_dev *dev) + if (ret < 0) + goto unreg_mmal; + +- if (dev->component[MMAL_COMPONENT_CAMERA]->outputs < +- MMAL_CAMERA_PORT_COUNT) { ++ camera = dev->component[MMAL_COMPONENT_CAMERA]; ++ if (camera->outputs < MMAL_CAMERA_PORT_COUNT) { + ret = -EINVAL; + goto unreg_camera; + } + + ret = set_camera_parameters(dev->instance, +- dev->component[MMAL_COMPONENT_CAMERA], ++ camera, + dev); + if (ret < 0) + goto unreg_camera; + +- format = +- &dev->component[MMAL_COMPONENT_CAMERA]-> +- output[MMAL_CAMERA_PORT_PREVIEW].format; ++ /* There was an error in the firmware that meant the camera component ++ * produced BGR instead of RGB. ++ * This is now fixed, but in order to support the old firmwares, we ++ * have to check. ++ */ ++ dev->rgb_bgr_swapped = true; ++ param_size = sizeof(supported_encodings); ++ ret = vchiq_mmal_port_parameter_get(dev->instance, ++ &camera->output[MMAL_CAMERA_PORT_CAPTURE], ++ MMAL_PARAMETER_SUPPORTED_ENCODINGS, ++ &supported_encodings, ++ &param_size); ++ if (ret == 0) { ++ int i; ++ ++ for (i = 0; i < param_size/sizeof(u32); i++) { ++ if (supported_encodings[i] == MMAL_ENCODING_BGR24) { ++ /* Found BGR24 first - old firmware. */ ++ break; ++ } ++ if (supported_encodings[i] == MMAL_ENCODING_RGB24) { ++ /* Found RGB24 first ++ * new firmware, so use RGB24. ++ */ ++ dev->rgb_bgr_swapped = false; ++ break; ++ } ++ } ++ } ++ format = &camera->output[MMAL_CAMERA_PORT_PREVIEW].format; + + format->encoding = MMAL_ENCODING_OPAQUE; + format->encoding_variant = MMAL_ENCODING_I420; +@@ -1616,9 +1655,7 @@ static int __init mmal_init(struct bm2835_mmal_dev *dev) + format->es->video.frame_rate.num = 0; /* Rely on fps_range */ + format->es->video.frame_rate.den = 1; + +- format = +- &dev->component[MMAL_COMPONENT_CAMERA]-> +- output[MMAL_CAMERA_PORT_VIDEO].format; ++ format = &camera->output[MMAL_CAMERA_PORT_VIDEO].format; + + format->encoding = MMAL_ENCODING_OPAQUE; + format->encoding_variant = MMAL_ENCODING_I420; +@@ -1633,14 +1670,11 @@ static int __init mmal_init(struct bm2835_mmal_dev *dev) + format->es->video.frame_rate.den = 1; + + vchiq_mmal_port_parameter_set(dev->instance, +- &dev->component[MMAL_COMPONENT_CAMERA]-> +- output[MMAL_CAMERA_PORT_VIDEO], ++ &camera->output[MMAL_CAMERA_PORT_VIDEO], + MMAL_PARAMETER_NO_IMAGE_PADDING, + &bool_true, sizeof(bool_true)); + +- format = +- &dev->component[MMAL_COMPONENT_CAMERA]-> +- output[MMAL_CAMERA_PORT_CAPTURE].format; ++ format = &camera->output[MMAL_CAMERA_PORT_CAPTURE].format; + + format->encoding = MMAL_ENCODING_OPAQUE; + +@@ -1662,8 +1696,7 @@ static int __init mmal_init(struct bm2835_mmal_dev *dev) + dev->capture.enc_level = V4L2_MPEG_VIDEO_H264_LEVEL_4_0; + + vchiq_mmal_port_parameter_set(dev->instance, +- &dev->component[MMAL_COMPONENT_CAMERA]-> +- output[MMAL_CAMERA_PORT_CAPTURE], ++ &camera->output[MMAL_CAMERA_PORT_CAPTURE], + MMAL_PARAMETER_NO_IMAGE_PADDING, + &bool_true, sizeof(bool_true)); + +diff --git a/drivers/media/platform/bcm2835/bcm2835-camera.h b/drivers/media/platform/bcm2835/bcm2835-camera.h +index 13f426f..e6aeb7e 100644 +--- a/drivers/media/platform/bcm2835/bcm2835-camera.h ++++ b/drivers/media/platform/bcm2835/bcm2835-camera.h +@@ -109,6 +109,7 @@ struct bm2835_mmal_dev { + unsigned int camera_num; + unsigned int max_width; + unsigned int max_height; ++ unsigned int rgb_bgr_swapped; + }; + + int bm2835_mmal_init_controls( + +From e17217216036509a8711ab042e4808b0b4c59a66 Mon Sep 17 00:00:00 2001 +From: escalator2015 <jmtasende@gmail.com> +Date: Tue, 24 May 2016 16:20:09 +0100 +Subject: [PATCH 111/112] New driver for RRA DigiDAC1 soundcard using WM8741 + + WM8804 + +--- + arch/arm/configs/bcm2709_defconfig | 1 + + arch/arm/configs/bcmrpi_defconfig | 1 + + sound/soc/bcm/Kconfig | 8 + + sound/soc/bcm/Makefile | 2 + + sound/soc/bcm/digidac1-soundcard.c | 422 +++++++++++++++++++++++++++++++++++++ + 5 files changed, 434 insertions(+) + create mode 100644 sound/soc/bcm/digidac1-soundcard.c + +diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig +index 055ecfc..1643dab 100644 +--- a/arch/arm/configs/bcm2709_defconfig ++++ b/arch/arm/configs/bcm2709_defconfig +@@ -862,6 +862,7 @@ CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC=m + CONFIG_SND_BCM2708_SOC_RASPIDAC3=m + CONFIG_SND_BCM2708_SOC_ADAU1977_ADC=m + CONFIG_SND_AUDIOINJECTOR_PI_SOUNDCARD=m ++CONFIG_SND_DIGIDAC1_SOUNDCARD=m + CONFIG_SND_SOC_ADAU1701=m + CONFIG_SND_SOC_WM8804_I2C=m + CONFIG_SND_SIMPLE_CARD=m +diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig +index 8e0b51f..d936b43 100644 +--- a/arch/arm/configs/bcmrpi_defconfig ++++ b/arch/arm/configs/bcmrpi_defconfig +@@ -854,6 +854,7 @@ CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC=m + CONFIG_SND_BCM2708_SOC_RASPIDAC3=m + CONFIG_SND_BCM2708_SOC_ADAU1977_ADC=m + CONFIG_SND_AUDIOINJECTOR_PI_SOUNDCARD=m ++CONFIG_SND_DIGIDAC1_SOUNDCARD=m + CONFIG_SND_SOC_ADAU1701=m + CONFIG_SND_SOC_WM8804_I2C=m + CONFIG_SND_SIMPLE_CARD=m +diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig +index e2e40ed..fa11cd7 100644 +--- a/sound/soc/bcm/Kconfig ++++ b/sound/soc/bcm/Kconfig +@@ -92,3 +92,11 @@ config SND_AUDIOINJECTOR_PI_SOUNDCARD + select SND_SOC_WM8731 + help + Say Y or M if you want to add support for audioinjector.net Pi Hat ++ ++config SND_DIGIDAC1_SOUNDCARD ++ tristate "Support for Red Rocks Audio DigiDAC1" ++ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S ++ select SND_SOC_WM8804 ++ select SND_SOC_WM8741 ++ help ++ Say Y or M if you want to add support for Red Rocks Audio DigiDAC1 board. +diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile +index 3353192..a9448fd 100644 +--- a/sound/soc/bcm/Makefile ++++ b/sound/soc/bcm/Makefile +@@ -16,6 +16,7 @@ snd-soc-rpi-proto-objs := rpi-proto.o + snd-soc-iqaudio-dac-objs := iqaudio-dac.o + snd-soc-raspidac3-objs := raspidac3.o + snd-soc-audioinjector-pi-soundcard-objs := audioinjector-pi-soundcard.o ++snd-soc-digidac1-soundcard-objs := digidac1-soundcard.o + + obj-$(CONFIG_SND_BCM2708_SOC_ADAU1977_ADC) += snd-soc-adau1977-adc.o + obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o +@@ -29,4 +30,5 @@ obj-$(CONFIG_SND_BCM2708_SOC_RPI_PROTO) += snd-soc-rpi-proto.o + obj-$(CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC) += snd-soc-iqaudio-dac.o + obj-$(CONFIG_SND_BCM2708_SOC_RASPIDAC3) += snd-soc-raspidac3.o + obj-$(CONFIG_SND_AUDIOINJECTOR_PI_SOUNDCARD) += snd-soc-audioinjector-pi-soundcard.o ++obj-$(CONFIG_SND_DIGIDAC1_SOUNDCARD) += snd-soc-digidac1-soundcard.o + +diff --git a/sound/soc/bcm/digidac1-soundcard.c b/sound/soc/bcm/digidac1-soundcard.c +new file mode 100644 +index 0000000..446796e +--- /dev/null ++++ b/sound/soc/bcm/digidac1-soundcard.c +@@ -0,0 +1,422 @@ ++/* ++ * ASoC Driver for RRA DigiDAC1 ++ * Copyright 2016 ++ * Author: José M. Tasende <vintage@redrocksaudio.es> ++ * based on the HifiBerry DAC driver by Florian Meier <florian.meier@koalo.de> ++ * and the Wolfson card driver by Nikesh Oswal, <Nikesh.Oswal@wolfsonmicro.com> ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * version 2 as published by the Free Software Foundation. ++ * ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * General Public License for more details. ++ */ ++ ++#include <linux/module.h> ++#include <linux/platform_device.h> ++#include <linux/i2c.h> ++#include <sound/core.h> ++#include <sound/pcm.h> ++#include <sound/pcm_params.h> ++#include <sound/soc.h> ++#include <sound/jack.h> ++#include <sound/soc-dapm.h> ++#include <sound/tlv.h> ++#include <linux/regulator/consumer.h> ++ ++#include "../codecs/wm8804.h" ++#include "../codecs/wm8741.h" ++ ++#define WM8741_NUM_SUPPLIES 2 ++ ++/* codec private data */ ++struct wm8741_priv { ++ struct wm8741_platform_data pdata; ++ struct regmap *regmap; ++ struct regulator_bulk_data supplies[WM8741_NUM_SUPPLIES]; ++ unsigned int sysclk; ++ const struct snd_pcm_hw_constraint_list *sysclk_constraints; ++}; ++ ++static int samplerate = 44100; ++ ++/* New Alsa Controls not exposed by original wm8741 codec driver */ ++/* in actual driver the att. adjustment is wrong because */ ++/* this DAC has a coarse attenuation register with 4dB steps */ ++/* and a fine level register with 0.125dB steps */ ++/* each register has 32 steps so combining both we have 1024 steps */ ++/* of 0.125 dB. */ ++/* The original level controls from driver are removed at startup */ ++/* and replaced by the corrected ones. */ ++/* The same wm8741 driver can be used for wm8741 and wm8742 devices */ ++ ++static const DECLARE_TLV_DB_SCALE(dac_tlv_fine, 0, 13, 0); ++static const DECLARE_TLV_DB_SCALE(dac_tlv_coarse, -12700, 400, 1); ++static const char *w8741_dither[4] = {"Off", "RPDF", "TPDF", "HPDF"}; ++static const char *w8741_filter[5] = { ++ "Type 1", "Type 2", "Type 3", "Type 4", "Type 5"}; ++static const char *w8741_switch[2] = {"Off", "On"}; ++static const struct soc_enum w8741_enum[] = { ++SOC_ENUM_SINGLE(WM8741_MODE_CONTROL_2, 0, 4, w8741_dither),/* dithering type */ ++SOC_ENUM_SINGLE(WM8741_FILTER_CONTROL, 0, 5, w8741_filter),/* filter type */ ++SOC_ENUM_SINGLE(WM8741_FORMAT_CONTROL, 6, 2, w8741_switch),/* phase invert */ ++SOC_ENUM_SINGLE(WM8741_VOLUME_CONTROL, 0, 2, w8741_switch),/* volume ramp */ ++SOC_ENUM_SINGLE(WM8741_VOLUME_CONTROL, 3, 2, w8741_switch),/* soft mute */ ++}; ++ ++static const struct snd_kcontrol_new w8741_snd_controls_stereo[] = { ++SOC_DOUBLE_R_TLV("DAC Fine Playback Volume", WM8741_DACLLSB_ATTENUATION, ++ WM8741_DACRLSB_ATTENUATION, 0, 31, 1, dac_tlv_fine), ++SOC_DOUBLE_R_TLV("Digital Playback Volume", WM8741_DACLMSB_ATTENUATION, ++ WM8741_DACRMSB_ATTENUATION, 0, 31, 1, dac_tlv_coarse), ++SOC_ENUM("DAC Dither", w8741_enum[0]), ++SOC_ENUM("DAC Digital Filter", w8741_enum[1]), ++SOC_ENUM("DAC Phase Invert", w8741_enum[2]), ++SOC_ENUM("DAC Volume Ramp", w8741_enum[3]), ++SOC_ENUM("DAC Soft Mute", w8741_enum[4]), ++}; ++ ++static const struct snd_kcontrol_new w8741_snd_controls_mono_left[] = { ++SOC_SINGLE_TLV("DAC Fine Playback Volume", WM8741_DACLLSB_ATTENUATION, ++ 0, 31, 0, dac_tlv_fine), ++SOC_SINGLE_TLV("Digital Playback Volume", WM8741_DACLMSB_ATTENUATION, ++ 0, 31, 1, dac_tlv_coarse), ++SOC_ENUM("DAC Dither", w8741_enum[0]), ++SOC_ENUM("DAC Digital Filter", w8741_enum[1]), ++SOC_ENUM("DAC Phase Invert", w8741_enum[2]), ++SOC_ENUM("DAC Volume Ramp", w8741_enum[3]), ++SOC_ENUM("DAC Soft Mute", w8741_enum[4]), ++}; ++ ++static const struct snd_kcontrol_new w8741_snd_controls_mono_right[] = { ++SOC_SINGLE_TLV("DAC Fine Playback Volume", WM8741_DACRLSB_ATTENUATION, ++ 0, 31, 0, dac_tlv_fine), ++SOC_SINGLE_TLV("Digital Playback Volume", WM8741_DACRMSB_ATTENUATION, ++ 0, 31, 1, dac_tlv_coarse), ++SOC_ENUM("DAC Dither", w8741_enum[0]), ++SOC_ENUM("DAC Digital Filter", w8741_enum[1]), ++SOC_ENUM("DAC Phase Invert", w8741_enum[2]), ++SOC_ENUM("DAC Volume Ramp", w8741_enum[3]), ++SOC_ENUM("DAC Soft Mute", w8741_enum[4]), ++}; ++ ++static int w8741_add_controls(struct snd_soc_codec *codec) ++{ ++ struct wm8741_priv *wm8741 = snd_soc_codec_get_drvdata(codec); ++ ++ switch (wm8741->pdata.diff_mode) { ++ case WM8741_DIFF_MODE_STEREO: ++ case WM8741_DIFF_MODE_STEREO_REVERSED: ++ snd_soc_add_codec_controls(codec, ++ w8741_snd_controls_stereo, ++ ARRAY_SIZE(w8741_snd_controls_stereo)); ++ break; ++ case WM8741_DIFF_MODE_MONO_LEFT: ++ snd_soc_add_codec_controls(codec, ++ w8741_snd_controls_mono_left, ++ ARRAY_SIZE(w8741_snd_controls_mono_left)); ++ break; ++ case WM8741_DIFF_MODE_MONO_RIGHT: ++ snd_soc_add_codec_controls(codec, ++ w8741_snd_controls_mono_right, ++ ARRAY_SIZE(w8741_snd_controls_mono_right)); ++ break; ++ default: ++ return -EINVAL; ++ } ++ ++ return 0; ++} ++ ++static int digidac1_soundcard_init(struct snd_soc_pcm_runtime *rtd) ++{ ++ struct snd_soc_codec *codec = rtd->codec; ++ struct snd_soc_card *card = rtd->card; ++ struct snd_soc_pcm_runtime *wm8741_rtd; ++ struct snd_soc_codec *wm8741_codec; ++ struct snd_card *sound_card = card->snd_card; ++ struct snd_kcontrol *kctl; ++ int ret; ++ ++ wm8741_rtd = snd_soc_get_pcm_runtime(card, card->dai_link[1].name); ++ if (!wm8741_rtd) { ++ dev_warn(card->dev, "digidac1_soundcard_init: couldn't get wm8741 rtd\n"); ++ return -EFAULT; ++ } ++ wm8741_codec = wm8741_rtd->codec; ++ ret = w8741_add_controls(wm8741_codec); ++ if (ret < 0) ++ dev_warn(card->dev, "Failed to add new wm8741 controls: %d\n", ++ ret); ++ ++ /* enable TX output */ ++ snd_soc_update_bits(codec, WM8804_PWRDN, 0x4, 0x0); ++ ++ kctl = snd_soc_card_get_kcontrol(card, ++ "Playback Volume"); ++ if (kctl) { ++ kctl->vd[0].access = SNDRV_CTL_ELEM_ACCESS_READWRITE; ++ snd_ctl_remove(sound_card, kctl); ++ } ++ kctl = snd_soc_card_get_kcontrol(card, ++ "Fine Playback Volume"); ++ if (kctl) { ++ kctl->vd[0].access = SNDRV_CTL_ELEM_ACCESS_READWRITE; ++ snd_ctl_remove(sound_card, kctl); ++ } ++ return 0; ++} ++ ++static int digidac1_soundcard_startup(struct snd_pcm_substream *substream) ++{ ++ /* turn on wm8804 digital output */ ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_codec *codec = rtd->codec; ++ struct snd_soc_card *card = rtd->card; ++ struct snd_soc_pcm_runtime *wm8741_rtd; ++ struct snd_soc_codec *wm8741_codec; ++ ++ snd_soc_update_bits(codec, WM8804_PWRDN, 0x3c, 0x00); ++ wm8741_rtd = snd_soc_get_pcm_runtime(card, card->dai_link[1].name); ++ if (!wm8741_rtd) { ++ dev_warn(card->dev, "digidac1_soundcard_startup: couldn't get WM8741 rtd\n"); ++ return -EFAULT; ++ } ++ wm8741_codec = wm8741_rtd->codec; ++ ++ /* latch wm8741 level */ ++ snd_soc_update_bits(wm8741_codec, WM8741_DACLLSB_ATTENUATION, ++ WM8741_UPDATELL, WM8741_UPDATELL); ++ snd_soc_update_bits(wm8741_codec, WM8741_DACLMSB_ATTENUATION, ++ WM8741_UPDATELM, WM8741_UPDATELM); ++ snd_soc_update_bits(wm8741_codec, WM8741_DACRLSB_ATTENUATION, ++ WM8741_UPDATERL, WM8741_UPDATERL); ++ snd_soc_update_bits(wm8741_codec, WM8741_DACRMSB_ATTENUATION, ++ WM8741_UPDATERM, WM8741_UPDATERM); ++ ++ return 0; ++} ++ ++static void digidac1_soundcard_shutdown(struct snd_pcm_substream *substream) ++{ ++ /* turn off wm8804 digital output */ ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_codec *codec = rtd->codec; ++ ++ snd_soc_update_bits(codec, WM8804_PWRDN, 0x3c, 0x3c); ++} ++ ++static int digidac1_soundcard_hw_params(struct snd_pcm_substream *substream, ++ struct snd_pcm_hw_params *params) ++{ ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_dai *codec_dai = rtd->codec_dai; ++ struct snd_soc_codec *codec = rtd->codec; ++ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; ++ struct snd_soc_card *card = rtd->card; ++ struct snd_soc_pcm_runtime *wm8741_rtd; ++ struct snd_soc_codec *wm8741_codec; ++ ++ int sysclk = 27000000; ++ long mclk_freq = 0; ++ int mclk_div = 1; ++ int sampling_freq = 1; ++ int ret; ++ ++ wm8741_rtd = snd_soc_get_pcm_runtime(card, card->dai_link[1].name); ++ if (!wm8741_rtd) { ++ dev_warn(card->dev, "digidac1_soundcard_hw_params: couldn't get WM8741 rtd\n"); ++ return -EFAULT; ++ } ++ wm8741_codec = wm8741_rtd->codec; ++ samplerate = params_rate(params); ++ ++ if (samplerate <= 96000) { ++ mclk_freq = samplerate*256; ++ mclk_div = WM8804_MCLKDIV_256FS; ++ } else { ++ mclk_freq = samplerate*128; ++ mclk_div = WM8804_MCLKDIV_128FS; ++ } ++ ++ switch (samplerate) { ++ case 32000: ++ sampling_freq = 0x03; ++ break; ++ case 44100: ++ sampling_freq = 0x00; ++ break; ++ case 48000: ++ sampling_freq = 0x02; ++ break; ++ case 88200: ++ sampling_freq = 0x08; ++ break; ++ case 96000: ++ sampling_freq = 0x0a; ++ break; ++ case 176400: ++ sampling_freq = 0x0c; ++ break; ++ case 192000: ++ sampling_freq = 0x0e; ++ break; ++ default: ++ dev_err(codec->dev, ++ "Failed to set WM8804 SYSCLK, unsupported samplerate %d\n", ++ samplerate); ++ } ++ ++ snd_soc_dai_set_clkdiv(codec_dai, WM8804_MCLK_DIV, mclk_div); ++ snd_soc_dai_set_pll(codec_dai, 0, 0, sysclk, mclk_freq); ++ ++ ret = snd_soc_dai_set_sysclk(codec_dai, WM8804_TX_CLKSRC_PLL, ++ sysclk, SND_SOC_CLOCK_OUT); ++ if (ret < 0) { ++ dev_err(codec->dev, ++ "Failed to set WM8804 SYSCLK: %d\n", ret); ++ return ret; ++ } ++ /* Enable wm8804 TX output */ ++ snd_soc_update_bits(codec, WM8804_PWRDN, 0x4, 0x0); ++ ++ /* wm8804 Power on */ ++ snd_soc_update_bits(codec, WM8804_PWRDN, 0x9, 0); ++ ++ /* wm8804 set sampling frequency status bits */ ++ snd_soc_update_bits(codec, WM8804_SPDTX4, 0x0f, sampling_freq); ++ ++ /* Now update wm8741 registers for the correct oversampling */ ++ if (samplerate <= 48000) ++ snd_soc_update_bits(wm8741_codec, WM8741_MODE_CONTROL_1, ++ WM8741_OSR_MASK, 0x00); ++ else if (samplerate <= 96000) ++ snd_soc_update_bits(wm8741_codec, WM8741_MODE_CONTROL_1, ++ WM8741_OSR_MASK, 0x20); ++ else ++ snd_soc_update_bits(wm8741_codec, WM8741_MODE_CONTROL_1, ++ WM8741_OSR_MASK, 0x40); ++ ++ /* wm8741 bit size */ ++ switch (params_width(params)) { ++ case 16: ++ snd_soc_update_bits(wm8741_codec, WM8741_FORMAT_CONTROL, ++ WM8741_IWL_MASK, 0x00); ++ break; ++ case 20: ++ snd_soc_update_bits(wm8741_codec, WM8741_FORMAT_CONTROL, ++ WM8741_IWL_MASK, 0x01); ++ break; ++ case 24: ++ snd_soc_update_bits(wm8741_codec, WM8741_FORMAT_CONTROL, ++ WM8741_IWL_MASK, 0x02); ++ break; ++ case 32: ++ snd_soc_update_bits(wm8741_codec, WM8741_FORMAT_CONTROL, ++ WM8741_IWL_MASK, 0x03); ++ break; ++ default: ++ dev_dbg(codec->dev, "wm8741_hw_params: Unsupported bit size param = %d", ++ params_width(params)); ++ return -EINVAL; ++ } ++ ++ return snd_soc_dai_set_bclk_ratio(cpu_dai, 64); ++} ++/* machine stream operations */ ++static struct snd_soc_ops digidac1_soundcard_ops = { ++ .hw_params = digidac1_soundcard_hw_params, ++ .startup = digidac1_soundcard_startup, ++ .shutdown = digidac1_soundcard_shutdown, ++}; ++ ++static struct snd_soc_dai_link digidac1_soundcard_dai[] = { ++ { ++ .name = "RRA DigiDAC1", ++ .stream_name = "RRA DigiDAC1 HiFi", ++ .cpu_dai_name = "bcm2708-i2s.0", ++ .codec_dai_name = "wm8804-spdif", ++ .platform_name = "bcm2708-i2s.0", ++ .codec_name = "wm8804.1-003b", ++ .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | ++ SND_SOC_DAIFMT_CBM_CFM, ++ .ops = &digidac1_soundcard_ops, ++ .init = digidac1_soundcard_init, ++ }, ++ { ++ .name = "RRA DigiDAC11", ++ .stream_name = "RRA DigiDAC11 HiFi", ++ .cpu_dai_name = "wm8804-spdif", ++ .codec_dai_name = "wm8741", ++ .codec_name = "wm8741.1-001a", ++ .dai_fmt = SND_SOC_DAIFMT_I2S ++ | SND_SOC_DAIFMT_NB_NF ++ | SND_SOC_DAIFMT_CBS_CFS, ++ }, ++}; ++ ++/* audio machine driver */ ++static struct snd_soc_card digidac1_soundcard = { ++ .name = "digidac1-soundcard", ++ .owner = THIS_MODULE, ++ .dai_link = digidac1_soundcard_dai, ++ .num_links = ARRAY_SIZE(digidac1_soundcard_dai), ++}; ++ ++static int digidac1_soundcard_probe(struct platform_device *pdev) ++{ ++ int ret = 0; ++ ++ digidac1_soundcard.dev = &pdev->dev; ++ ++ if (pdev->dev.of_node) { ++ struct device_node *i2s_node; ++ struct snd_soc_dai_link *dai = &digidac1_soundcard_dai[0]; ++ ++ i2s_node = of_parse_phandle(pdev->dev.of_node, ++ "i2s-controller", 0); ++ ++ if (i2s_node) { ++ dai->cpu_dai_name = NULL; ++ dai->cpu_of_node = i2s_node; ++ dai->platform_name = NULL; ++ dai->platform_of_node = i2s_node; ++ } ++ } ++ ++ ret = snd_soc_register_card(&digidac1_soundcard); ++ if (ret) ++ dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", ++ ret); ++ ++ return ret; ++} ++ ++static int digidac1_soundcard_remove(struct platform_device *pdev) ++{ ++ return snd_soc_unregister_card(&digidac1_soundcard); ++} ++ ++static const struct of_device_id digidac1_soundcard_of_match[] = { ++ { .compatible = "rra,digidac1-soundcard", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, digidac1_soundcard_of_match); ++ ++static struct platform_driver digidac1_soundcard_driver = { ++ .driver = { ++ .name = "digidac1-audio", ++ .owner = THIS_MODULE, ++ .of_match_table = digidac1_soundcard_of_match, ++ }, ++ .probe = digidac1_soundcard_probe, ++ .remove = digidac1_soundcard_remove, ++}; ++ ++module_platform_driver(digidac1_soundcard_driver); ++ ++MODULE_AUTHOR("José M. Tasende <vintage@redrocksaudio.es>"); ++MODULE_DESCRIPTION("ASoC Driver for RRA DigiDAC1"); ++MODULE_LICENSE("GPL v2"); + +From 8f1f7957d7684294706126f51dc46e362d7822a4 Mon Sep 17 00:00:00 2001 +From: Phil Elwell <phil@raspberrypi.org> +Date: Fri, 3 Jun 2016 21:56:40 +0100 +Subject: [PATCH 112/112] BCM270X_DT: Fix rpi-dac overlay + +The rpi-dac overlay is almost identical to the hifiberry-dac overlay - +the codec used is different but it also doesn't sit on the I2C bus. As +a result, when the overlays were modified for dynamic loading and it +was discovered that the hifiberry-dac overlay didn't work any more, the +the rpi-dac overlay was also broken. + +The failure was caused by the fact that outside a bus, device names are +constructed from the concatenation of the path elements leading to it, +so moving the codec instantiation inside /soc caused the device name +to get a "soc" added, breaking ALSA's naming. + +See: http://forum.kodi.tv/showthread.php?tid=269814&pid=2349776#pid2349776 + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> +--- + arch/arm/boot/dts/overlays/rpi-dac-overlay.dts | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm/boot/dts/overlays/rpi-dac-overlay.dts b/arch/arm/boot/dts/overlays/rpi-dac-overlay.dts +index 1523eae..a442c8f0 100644 +--- a/arch/arm/boot/dts/overlays/rpi-dac-overlay.dts ++++ b/arch/arm/boot/dts/overlays/rpi-dac-overlay.dts +@@ -13,7 +13,7 @@ + }; + + fragment@1 { +- target = <&soc>; ++ target-path = "/"; + __overlay__ { + pcm1794a-codec { + #sound-dai-cells = <0>; diff --git a/projects/Slice2/patches/linux/linux-02-Slice.patch b/projects/Slice2/patches/linux/linux-02-Slice.patch new file mode 100644 index 00000000000..634aed567f4 --- /dev/null +++ b/projects/Slice2/patches/linux/linux-02-Slice.patch @@ -0,0 +1,2445 @@ +reverted: +--- unpatched_linux/arch/arm/boot/dts/overlays/Makefile 2016-07-29 09:31:11.178762674 +0100 ++++ linux-4.6.1/arch/arm/boot/dts/overlays/Makefile 2016-07-29 09:35:50.378775589 +0100 +@@ -89,6 +89,8 @@ + dtbo-$(RPI_DT_OVERLAYS) += w1-gpio.dtbo + dtbo-$(RPI_DT_OVERLAYS) += w1-gpio-pullup.dtbo + dtbo-$(RPI_DT_OVERLAYS) += wittypi.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += ws2812.dtbo ++dtbo-$(RPI_DT_OVERLAYS) += slice.dtbo + + targets += dtbs dtbs_install + targets += $(dtbo-y) +reverted: +--- unpatched_linux/arch/arm/boot/dts/overlays/README 2016-07-29 09:31:11.182762674 +0100 ++++ linux-4.6.1/arch/arm/boot/dts/overlays/README 2016-07-29 09:35:50.378775589 +0100 +@@ -1079,6 +1079,11 @@ + Old touch display: + dtoverlay=tinylcd35,touch,touchgpio=3 + ++Name: ws2812 ++Info: WS2812 LED driver using Raspberry Pi PWM interface ++Load: dtoverlay=ws2812,<param>=<val> ++Params: invert Enable inversion of the PWM output ++ num_leds Configure number of LEDs + + Name: uart1 + Info: Enable uart1 in place of uart0 +reverted: +--- unpatched_linux/arch/arm/boot/dts/overlays/slice-overlay.dts 1970-01-01 01:00:00.000000000 +0100 ++++ linux-4.6.1/arch/arm/boot/dts/overlays/slice-overlay.dts 2016-07-29 09:35:50.378775589 +0100 +@@ -0,0 +1,171 @@ ++// Definitions for Slice hardware ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ // ++ // Set up GPIOs: ++ // I2C1 on GPIO44,45 ++ // LIRC input/output on GPIO4 and 37 (NB GPIO4 NC on Slice) ++ // I2S on GPIO28-31 ++ // ++ fragment@0 { ++ target = <&gpio>; ++ __overlay__ { ++ i2c1_pins: i2c1 { ++ brcm,pins = <44 45>; ++ brcm,function = <6>; /* alt2 */ ++ }; ++ lirc_pins: lirc_pins { ++ brcm,pins = <4 37>; // <out in> ++ brcm,function = <1 0>; // out in ++ brcm,pull = <0 1>; // off down ++ }; ++ i2s_pins: i2s { ++ brcm,pins = <28 29 30 31>; ++ brcm,function = <6>; /* alt2 */ ++ }; ++ ws2812_pins: ws2812 { ++ brcm,pins = <40>; ++ brcm,function = <4>; /* alt0 */ ++ }; ++ }; ++ }; ++ ++ // ++ // I2C at 100KHz ++ // ++ fragment@1 { ++ target = <&i2c1>; ++ __overlay__ { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2c1_pins>; ++ clock-frequency = <100000>; ++ }; ++ }; ++ ++ // ++ // Add devices to I2C1 Bus: ++ // PCF8523 RTC device ++ // CS4265 Audio CODEC ++ // ++ fragment@2 { ++ target = <&i2c1>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ pcf8523@68 { ++ compatible = "nxp,pcf8523"; ++ reg = <0x68>; ++ nxp,xtalcap-7pf; /* set crystal load to 7pf */ ++ status = "okay"; ++ }; ++ cs4265@4e { ++ #sound-dai-cells = <0>; ++ compatible = "cirrus,cs4265"; ++ reg = <0x4e>; ++ cs4265-reset-gpios = <&gpio 33 0>; /* AUD_RST_N on GPIO33 */ ++ cirrus,no-s16le; /* remove S16LE support to workaround I2S controller issue */ ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ // ++ // LIRC ++ // ++ fragment@3 { ++ target-path = "/"; ++ __overlay__ { ++ lirc_rpi: lirc_rpi { ++ compatible = "rpi,lirc-rpi"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&lirc_pins>; ++ status = "okay"; ++ ++ // Override autodetection of IR receiver circuit ++ // (0 = active high, 1 = active low, -1 = no override ) ++ rpi,sense = <0xffffffff>; ++ ++ // Software carrier ++ // (0 = off, 1 = on) ++ rpi,softcarrier = <1>; ++ ++ // Invert output ++ // (0 = off, 1 = on) ++ rpi,invert = <0>; ++ ++ // Enable debugging messages ++ // (0 = off, 1 = on) ++ rpi,debug = <0>; ++ }; ++ }; ++ }; ++ ++ // ++ // Audio driver ++ // ++ fragment@4 { ++ #address-cells = <1>; ++ #size-cells = <1>; ++ target = <&sound>; ++ __overlay__ { ++ compatible = "fiveninjas,slice"; ++ reg = <0x20101070 0x11>, ++ <0x20101104 0x05>, ++ <0x20102500 0x04>; ++ pinctrl-names = "default"; ++ i2s-controller = <&i2s>; ++ status = "okay"; ++ }; ++ }; ++ ++ // ++ // Enable I2S ++ // ++ fragment@5 { ++ target = <&i2s>; ++ __overlay__ { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2s_pins>; ++ brcm,enable-mmap; ++ status = "okay"; ++ }; ++ }; ++ ++ // ++ // WS2812B LEDs driver ++ // ++ fragment@6 { ++ target = <&soc>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ws2812: ws2812 { ++ compatible = "rpi,ws2812"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&ws2812_pins>; ++ reg = <0x7e20c000 0x100>; /* PWM */ ++ dmas = <&dma 5>; ++ dma-names = "pwm_dma"; ++ led-en-gpios = <&gpio 43 0>; ++ rpi,invert = <1>; ++ rpi,num_leds = <25>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ // ++ // Disable standard audio ++ // ++ fragment@7 { ++ target = <&audio>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; ++}; +reverted: +--- unpatched_linux/arch/arm/boot/dts/overlays/ws2812-overlay.dts 1970-01-01 01:00:00.000000000 +0100 ++++ linux-4.6.1/arch/arm/boot/dts/overlays/ws2812-overlay.dts 2016-07-29 09:35:50.378775589 +0100 +@@ -0,0 +1,33 @@ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&soc>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ++ ws2812: ws2812 { ++ compatible = "rpi,ws2812"; ++ reg = <0x7e20c000 0x100>; /* PWM */ ++ dmas = <&dma 5>; ++ dma-names = "pwm_dma"; ++ led-en-gpios = <&gpio 43 0>; ++ ++ rpi,invert = <1>; ++ rpi,num_leds = <25>; ++ ++ status = "okay"; ++ ++ }; ++ }; ++ }; ++ ++ __overrides__ { ++ invert = <&ws2812>,"rpi,invert:0"; ++ num_leds = <&ws2812>,"rpi,num_leds:0"; ++ }; ++}; +reverted: +--- unpatched_linux/arch/arm/configs/slice2708_defconfig 1970-01-01 01:00:00.000000000 +0100 ++++ linux-4.6.1/arch/arm/configs/slice2708_defconfig 2016-07-29 09:35:50.378775589 +0100 +@@ -0,0 +1,1201 @@ ++# CONFIG_ARM_PATCH_PHYS_VIRT is not set ++CONFIG_PHYS_OFFSET=0 ++# CONFIG_LOCALVERSION_AUTO is not set ++CONFIG_SYSVIPC=y ++CONFIG_POSIX_MQUEUE=y ++CONFIG_FHANDLE=y ++CONFIG_NO_HZ=y ++CONFIG_HIGH_RES_TIMERS=y ++CONFIG_BSD_PROCESS_ACCT=y ++CONFIG_BSD_PROCESS_ACCT_V3=y ++CONFIG_TASKSTATS=y ++CONFIG_TASK_DELAY_ACCT=y ++CONFIG_TASK_XACCT=y ++CONFIG_TASK_IO_ACCOUNTING=y ++CONFIG_IKCONFIG=m ++CONFIG_IKCONFIG_PROC=y ++CONFIG_CGROUP_FREEZER=y ++CONFIG_CGROUP_DEVICE=y ++CONFIG_CGROUP_CPUACCT=y ++CONFIG_MEMCG=y ++CONFIG_BLK_CGROUP=y ++CONFIG_NAMESPACES=y ++CONFIG_SCHED_AUTOGROUP=y ++CONFIG_BLK_DEV_INITRD=y ++CONFIG_EMBEDDED=y ++# CONFIG_COMPAT_BRK is not set ++CONFIG_PROFILING=y ++CONFIG_OPROFILE=m ++CONFIG_KPROBES=y ++CONFIG_JUMP_LABEL=y ++CONFIG_MODULES=y ++CONFIG_MODULE_UNLOAD=y ++CONFIG_MODVERSIONS=y ++CONFIG_MODULE_SRCVERSION_ALL=y ++CONFIG_BLK_DEV_THROTTLING=y ++CONFIG_PARTITION_ADVANCED=y ++CONFIG_MAC_PARTITION=y ++CONFIG_CFQ_GROUP_IOSCHED=y ++CONFIG_ARCH_BCM2708=y ++CONFIG_BCM2708_DT=y ++CONFIG_PREEMPT=y ++CONFIG_AEABI=y ++CONFIG_OABI_COMPAT=y ++CONFIG_CLEANCACHE=y ++CONFIG_FRONTSWAP=y ++CONFIG_CMA=y ++CONFIG_UACCESS_WITH_MEMCPY=y ++CONFIG_SECCOMP=y ++CONFIG_ZBOOT_ROM_TEXT=0x0 ++CONFIG_ZBOOT_ROM_BSS=0x0 ++CONFIG_CMDLINE="console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait" ++CONFIG_CPU_FREQ=y ++CONFIG_CPU_FREQ_STAT=m ++CONFIG_CPU_FREQ_STAT_DETAILS=y ++CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE=y ++CONFIG_CPU_FREQ_GOV_PERFORMANCE=y ++CONFIG_CPU_FREQ_GOV_USERSPACE=y ++CONFIG_CPU_FREQ_GOV_ONDEMAND=y ++CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y ++CONFIG_VFP=y ++CONFIG_BINFMT_MISC=m ++# CONFIG_SUSPEND is not set ++CONFIG_NET=y ++CONFIG_PACKET=y ++CONFIG_UNIX=y ++CONFIG_XFRM_USER=y ++CONFIG_NET_KEY=m ++CONFIG_INET=y ++CONFIG_IP_MULTICAST=y ++CONFIG_IP_ADVANCED_ROUTER=y ++CONFIG_IP_MULTIPLE_TABLES=y ++CONFIG_IP_ROUTE_MULTIPATH=y ++CONFIG_IP_ROUTE_VERBOSE=y ++CONFIG_IP_PNP=y ++CONFIG_IP_PNP_DHCP=y ++CONFIG_IP_PNP_RARP=y ++CONFIG_NET_IPIP=m ++CONFIG_NET_IPGRE_DEMUX=m ++CONFIG_NET_IPGRE=m ++CONFIG_IP_MROUTE=y ++CONFIG_IP_MROUTE_MULTIPLE_TABLES=y ++CONFIG_IP_PIMSM_V1=y ++CONFIG_IP_PIMSM_V2=y ++CONFIG_SYN_COOKIES=y ++CONFIG_INET_AH=m ++CONFIG_INET_ESP=m ++CONFIG_INET_IPCOMP=m ++CONFIG_INET_XFRM_MODE_TRANSPORT=m ++CONFIG_INET_XFRM_MODE_TUNNEL=m ++CONFIG_INET_XFRM_MODE_BEET=m ++CONFIG_INET_LRO=m ++CONFIG_INET_DIAG=m ++CONFIG_INET6_AH=m ++CONFIG_INET6_ESP=m ++CONFIG_INET6_IPCOMP=m ++CONFIG_IPV6_TUNNEL=m ++CONFIG_IPV6_MULTIPLE_TABLES=y ++CONFIG_IPV6_MROUTE=y ++CONFIG_IPV6_MROUTE_MULTIPLE_TABLES=y ++CONFIG_IPV6_PIMSM_V2=y ++CONFIG_NETFILTER=y ++CONFIG_NF_CONNTRACK=m ++CONFIG_NF_CONNTRACK_ZONES=y ++CONFIG_NF_CONNTRACK_EVENTS=y ++CONFIG_NF_CONNTRACK_TIMESTAMP=y ++CONFIG_NF_CT_PROTO_DCCP=m ++CONFIG_NF_CT_PROTO_UDPLITE=m ++CONFIG_NF_CONNTRACK_AMANDA=m ++CONFIG_NF_CONNTRACK_FTP=m ++CONFIG_NF_CONNTRACK_H323=m ++CONFIG_NF_CONNTRACK_IRC=m ++CONFIG_NF_CONNTRACK_NETBIOS_NS=m ++CONFIG_NF_CONNTRACK_SNMP=m ++CONFIG_NF_CONNTRACK_PPTP=m ++CONFIG_NF_CONNTRACK_SANE=m ++CONFIG_NF_CONNTRACK_SIP=m ++CONFIG_NF_CONNTRACK_TFTP=m ++CONFIG_NF_CT_NETLINK=m ++CONFIG_NETFILTER_XT_SET=m ++CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m ++CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m ++CONFIG_NETFILTER_XT_TARGET_CONNMARK=m ++CONFIG_NETFILTER_XT_TARGET_DSCP=m ++CONFIG_NETFILTER_XT_TARGET_HMARK=m ++CONFIG_NETFILTER_XT_TARGET_IDLETIMER=m ++CONFIG_NETFILTER_XT_TARGET_LED=m ++CONFIG_NETFILTER_XT_TARGET_LOG=m ++CONFIG_NETFILTER_XT_TARGET_MARK=m ++CONFIG_NETFILTER_XT_TARGET_NFLOG=m ++CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m ++CONFIG_NETFILTER_XT_TARGET_NOTRACK=m ++CONFIG_NETFILTER_XT_TARGET_TEE=m ++CONFIG_NETFILTER_XT_TARGET_TPROXY=m ++CONFIG_NETFILTER_XT_TARGET_TRACE=m ++CONFIG_NETFILTER_XT_TARGET_TCPMSS=m ++CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP=m ++CONFIG_NETFILTER_XT_MATCH_ADDRTYPE=m ++CONFIG_NETFILTER_XT_MATCH_BPF=m ++CONFIG_NETFILTER_XT_MATCH_CLUSTER=m ++CONFIG_NETFILTER_XT_MATCH_COMMENT=m ++CONFIG_NETFILTER_XT_MATCH_CONNBYTES=m ++CONFIG_NETFILTER_XT_MATCH_CONNLABEL=m ++CONFIG_NETFILTER_XT_MATCH_CONNLIMIT=m ++CONFIG_NETFILTER_XT_MATCH_CONNMARK=m ++CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m ++CONFIG_NETFILTER_XT_MATCH_CPU=m ++CONFIG_NETFILTER_XT_MATCH_DCCP=m ++CONFIG_NETFILTER_XT_MATCH_DEVGROUP=m ++CONFIG_NETFILTER_XT_MATCH_DSCP=m ++CONFIG_NETFILTER_XT_MATCH_ESP=m ++CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=m ++CONFIG_NETFILTER_XT_MATCH_HELPER=m ++CONFIG_NETFILTER_XT_MATCH_IPRANGE=m ++CONFIG_NETFILTER_XT_MATCH_IPVS=m ++CONFIG_NETFILTER_XT_MATCH_LENGTH=m ++CONFIG_NETFILTER_XT_MATCH_LIMIT=m ++CONFIG_NETFILTER_XT_MATCH_MAC=m ++CONFIG_NETFILTER_XT_MATCH_MARK=m ++CONFIG_NETFILTER_XT_MATCH_MULTIPORT=m ++CONFIG_NETFILTER_XT_MATCH_NFACCT=m ++CONFIG_NETFILTER_XT_MATCH_OSF=m ++CONFIG_NETFILTER_XT_MATCH_OWNER=m ++CONFIG_NETFILTER_XT_MATCH_POLICY=m ++CONFIG_NETFILTER_XT_MATCH_PHYSDEV=m ++CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m ++CONFIG_NETFILTER_XT_MATCH_QUOTA=m ++CONFIG_NETFILTER_XT_MATCH_RATEEST=m ++CONFIG_NETFILTER_XT_MATCH_REALM=m ++CONFIG_NETFILTER_XT_MATCH_RECENT=m ++CONFIG_NETFILTER_XT_MATCH_SOCKET=m ++CONFIG_NETFILTER_XT_MATCH_STATE=m ++CONFIG_NETFILTER_XT_MATCH_STATISTIC=m ++CONFIG_NETFILTER_XT_MATCH_STRING=m ++CONFIG_NETFILTER_XT_MATCH_TCPMSS=m ++CONFIG_NETFILTER_XT_MATCH_TIME=m ++CONFIG_NETFILTER_XT_MATCH_U32=m ++CONFIG_IP_SET=m ++CONFIG_IP_SET_BITMAP_IP=m ++CONFIG_IP_SET_BITMAP_IPMAC=m ++CONFIG_IP_SET_BITMAP_PORT=m ++CONFIG_IP_SET_HASH_IP=m ++CONFIG_IP_SET_HASH_IPPORT=m ++CONFIG_IP_SET_HASH_IPPORTIP=m ++CONFIG_IP_SET_HASH_IPPORTNET=m ++CONFIG_IP_SET_HASH_NET=m ++CONFIG_IP_SET_HASH_NETPORT=m ++CONFIG_IP_SET_HASH_NETIFACE=m ++CONFIG_IP_SET_LIST_SET=m ++CONFIG_IP_VS=m ++CONFIG_IP_VS_PROTO_TCP=y ++CONFIG_IP_VS_PROTO_UDP=y ++CONFIG_IP_VS_PROTO_ESP=y ++CONFIG_IP_VS_PROTO_AH=y ++CONFIG_IP_VS_PROTO_SCTP=y ++CONFIG_IP_VS_RR=m ++CONFIG_IP_VS_WRR=m ++CONFIG_IP_VS_LC=m ++CONFIG_IP_VS_WLC=m ++CONFIG_IP_VS_LBLC=m ++CONFIG_IP_VS_LBLCR=m ++CONFIG_IP_VS_DH=m ++CONFIG_IP_VS_SH=m ++CONFIG_IP_VS_SED=m ++CONFIG_IP_VS_NQ=m ++CONFIG_IP_VS_FTP=m ++CONFIG_IP_VS_PE_SIP=m ++CONFIG_NF_CONNTRACK_IPV4=m ++CONFIG_IP_NF_IPTABLES=m ++CONFIG_IP_NF_MATCH_AH=m ++CONFIG_IP_NF_MATCH_ECN=m ++CONFIG_IP_NF_MATCH_TTL=m ++CONFIG_IP_NF_FILTER=m ++CONFIG_IP_NF_TARGET_REJECT=m ++CONFIG_IP_NF_NAT=m ++CONFIG_IP_NF_TARGET_MASQUERADE=m ++CONFIG_IP_NF_TARGET_NETMAP=m ++CONFIG_IP_NF_TARGET_REDIRECT=m ++CONFIG_IP_NF_MANGLE=m ++CONFIG_IP_NF_TARGET_CLUSTERIP=m ++CONFIG_IP_NF_TARGET_ECN=m ++CONFIG_IP_NF_TARGET_TTL=m ++CONFIG_IP_NF_RAW=m ++CONFIG_IP_NF_ARPTABLES=m ++CONFIG_IP_NF_ARPFILTER=m ++CONFIG_IP_NF_ARP_MANGLE=m ++CONFIG_NF_CONNTRACK_IPV6=m ++CONFIG_IP6_NF_IPTABLES=m ++CONFIG_IP6_NF_MATCH_AH=m ++CONFIG_IP6_NF_MATCH_EUI64=m ++CONFIG_IP6_NF_MATCH_FRAG=m ++CONFIG_IP6_NF_MATCH_OPTS=m ++CONFIG_IP6_NF_MATCH_HL=m ++CONFIG_IP6_NF_MATCH_IPV6HEADER=m ++CONFIG_IP6_NF_MATCH_MH=m ++CONFIG_IP6_NF_MATCH_RT=m ++CONFIG_IP6_NF_TARGET_HL=m ++CONFIG_IP6_NF_FILTER=m ++CONFIG_IP6_NF_TARGET_REJECT=m ++CONFIG_IP6_NF_MANGLE=m ++CONFIG_IP6_NF_RAW=m ++CONFIG_IP6_NF_NAT=m ++CONFIG_IP6_NF_TARGET_MASQUERADE=m ++CONFIG_IP6_NF_TARGET_NPT=m ++CONFIG_BRIDGE_NF_EBTABLES=m ++CONFIG_BRIDGE_EBT_BROUTE=m ++CONFIG_BRIDGE_EBT_T_FILTER=m ++CONFIG_BRIDGE_EBT_T_NAT=m ++CONFIG_BRIDGE_EBT_802_3=m ++CONFIG_BRIDGE_EBT_AMONG=m ++CONFIG_BRIDGE_EBT_ARP=m ++CONFIG_BRIDGE_EBT_IP=m ++CONFIG_BRIDGE_EBT_IP6=m ++CONFIG_BRIDGE_EBT_LIMIT=m ++CONFIG_BRIDGE_EBT_MARK=m ++CONFIG_BRIDGE_EBT_PKTTYPE=m ++CONFIG_BRIDGE_EBT_STP=m ++CONFIG_BRIDGE_EBT_VLAN=m ++CONFIG_BRIDGE_EBT_ARPREPLY=m ++CONFIG_BRIDGE_EBT_DNAT=m ++CONFIG_BRIDGE_EBT_MARK_T=m ++CONFIG_BRIDGE_EBT_REDIRECT=m ++CONFIG_BRIDGE_EBT_SNAT=m ++CONFIG_BRIDGE_EBT_LOG=m ++CONFIG_BRIDGE_EBT_NFLOG=m ++CONFIG_SCTP_COOKIE_HMAC_SHA1=y ++CONFIG_ATM=m ++CONFIG_L2TP=m ++CONFIG_L2TP_V3=y ++CONFIG_L2TP_IP=m ++CONFIG_L2TP_ETH=m ++CONFIG_BRIDGE=m ++CONFIG_VLAN_8021Q=m ++CONFIG_VLAN_8021Q_GVRP=y ++CONFIG_ATALK=m ++CONFIG_6LOWPAN=m ++CONFIG_NET_SCHED=y ++CONFIG_NET_SCH_CBQ=m ++CONFIG_NET_SCH_HTB=m ++CONFIG_NET_SCH_HFSC=m ++CONFIG_NET_SCH_PRIO=m ++CONFIG_NET_SCH_MULTIQ=m ++CONFIG_NET_SCH_RED=m ++CONFIG_NET_SCH_SFB=m ++CONFIG_NET_SCH_SFQ=m ++CONFIG_NET_SCH_TEQL=m ++CONFIG_NET_SCH_TBF=m ++CONFIG_NET_SCH_GRED=m ++CONFIG_NET_SCH_DSMARK=m ++CONFIG_NET_SCH_NETEM=m ++CONFIG_NET_SCH_DRR=m ++CONFIG_NET_SCH_MQPRIO=m ++CONFIG_NET_SCH_CHOKE=m ++CONFIG_NET_SCH_QFQ=m ++CONFIG_NET_SCH_CODEL=m ++CONFIG_NET_SCH_FQ_CODEL=m ++CONFIG_NET_SCH_INGRESS=m ++CONFIG_NET_SCH_PLUG=m ++CONFIG_NET_CLS_BASIC=m ++CONFIG_NET_CLS_TCINDEX=m ++CONFIG_NET_CLS_ROUTE4=m ++CONFIG_NET_CLS_FW=m ++CONFIG_NET_CLS_U32=m ++CONFIG_CLS_U32_MARK=y ++CONFIG_NET_CLS_RSVP=m ++CONFIG_NET_CLS_RSVP6=m ++CONFIG_NET_CLS_FLOW=m ++CONFIG_NET_CLS_CGROUP=m ++CONFIG_NET_EMATCH=y ++CONFIG_NET_EMATCH_CMP=m ++CONFIG_NET_EMATCH_NBYTE=m ++CONFIG_NET_EMATCH_U32=m ++CONFIG_NET_EMATCH_META=m ++CONFIG_NET_EMATCH_TEXT=m ++CONFIG_NET_EMATCH_IPSET=m ++CONFIG_NET_CLS_ACT=y ++CONFIG_NET_ACT_POLICE=m ++CONFIG_NET_ACT_GACT=m ++CONFIG_GACT_PROB=y ++CONFIG_NET_ACT_MIRRED=m ++CONFIG_NET_ACT_IPT=m ++CONFIG_NET_ACT_NAT=m ++CONFIG_NET_ACT_PEDIT=m ++CONFIG_NET_ACT_SIMP=m ++CONFIG_NET_ACT_SKBEDIT=m ++CONFIG_NET_ACT_CSUM=m ++CONFIG_BATMAN_ADV=m ++CONFIG_OPENVSWITCH=m ++CONFIG_NET_PKTGEN=m ++CONFIG_HAMRADIO=y ++CONFIG_AX25=m ++CONFIG_NETROM=m ++CONFIG_ROSE=m ++CONFIG_MKISS=m ++CONFIG_6PACK=m ++CONFIG_BPQETHER=m ++CONFIG_BAYCOM_SER_FDX=m ++CONFIG_BAYCOM_SER_HDX=m ++CONFIG_YAM=m ++CONFIG_CAN=m ++CONFIG_CAN_VCAN=m ++CONFIG_CAN_MCP251X=m ++CONFIG_IRDA=m ++CONFIG_IRLAN=m ++CONFIG_IRNET=m ++CONFIG_IRCOMM=m ++CONFIG_IRDA_ULTRA=y ++CONFIG_IRDA_CACHE_LAST_LSAP=y ++CONFIG_IRDA_FAST_RR=y ++CONFIG_IRTTY_SIR=m ++CONFIG_KINGSUN_DONGLE=m ++CONFIG_KSDAZZLE_DONGLE=m ++CONFIG_KS959_DONGLE=m ++CONFIG_USB_IRDA=m ++CONFIG_SIGMATEL_FIR=m ++CONFIG_MCS_FIR=m ++CONFIG_BT=m ++CONFIG_BT_RFCOMM=m ++CONFIG_BT_RFCOMM_TTY=y ++CONFIG_BT_BNEP=m ++CONFIG_BT_BNEP_MC_FILTER=y ++CONFIG_BT_BNEP_PROTO_FILTER=y ++CONFIG_BT_HIDP=m ++CONFIG_BT_6LOWPAN=m ++CONFIG_BT_HCIBTUSB=m ++CONFIG_BT_HCIBCM203X=m ++CONFIG_BT_HCIBPA10X=m ++CONFIG_BT_HCIBFUSB=m ++CONFIG_BT_HCIVHCI=m ++CONFIG_BT_MRVL=m ++CONFIG_BT_MRVL_SDIO=m ++CONFIG_BT_ATH3K=m ++CONFIG_BT_WILINK=m ++CONFIG_MAC80211=m ++CONFIG_MAC80211_MESH=y ++CONFIG_WIMAX=m ++CONFIG_RFKILL=m ++CONFIG_RFKILL_INPUT=y ++CONFIG_NET_9P=m ++CONFIG_NFC=m ++CONFIG_NFC_PN533=m ++CONFIG_DEVTMPFS=y ++CONFIG_DEVTMPFS_MOUNT=y ++CONFIG_DMA_CMA=y ++CONFIG_CMA_SIZE_MBYTES=5 ++CONFIG_BLK_DEV_LOOP=y ++CONFIG_BLK_DEV_CRYPTOLOOP=m ++CONFIG_BLK_DEV_DRBD=m ++CONFIG_BLK_DEV_NBD=m ++CONFIG_BLK_DEV_RAM=y ++CONFIG_CDROM_PKTCDVD=m ++CONFIG_ATA_OVER_ETH=m ++CONFIG_BCM2835_WS2812=m ++CONFIG_EEPROM_AT24=m ++CONFIG_SCSI=y ++# CONFIG_SCSI_PROC_FS is not set ++CONFIG_BLK_DEV_SD=y ++CONFIG_CHR_DEV_ST=m ++CONFIG_CHR_DEV_OSST=m ++CONFIG_BLK_DEV_SR=m ++CONFIG_CHR_DEV_SG=m ++CONFIG_SCSI_ISCSI_ATTRS=y ++CONFIG_ISCSI_TCP=m ++CONFIG_ISCSI_BOOT_SYSFS=m ++CONFIG_MD=y ++CONFIG_MD_LINEAR=m ++CONFIG_MD_RAID0=m ++CONFIG_BLK_DEV_DM=m ++CONFIG_DM_CRYPT=m ++CONFIG_DM_SNAPSHOT=m ++CONFIG_DM_MIRROR=m ++CONFIG_DM_LOG_USERSPACE=m ++CONFIG_DM_RAID=m ++CONFIG_DM_ZERO=m ++CONFIG_DM_DELAY=m ++CONFIG_NETDEVICES=y ++CONFIG_BONDING=m ++CONFIG_DUMMY=m ++CONFIG_IFB=m ++CONFIG_MACVLAN=m ++CONFIG_NETCONSOLE=m ++CONFIG_TUN=m ++CONFIG_VETH=m ++CONFIG_ENC28J60=m ++CONFIG_MDIO_BITBANG=m ++CONFIG_PPP=m ++CONFIG_PPP_BSDCOMP=m ++CONFIG_PPP_DEFLATE=m ++CONFIG_PPP_FILTER=y ++CONFIG_PPP_MPPE=m ++CONFIG_PPP_MULTILINK=y ++CONFIG_PPPOATM=m ++CONFIG_PPPOE=m ++CONFIG_PPPOL2TP=m ++CONFIG_PPP_ASYNC=m ++CONFIG_PPP_SYNC_TTY=m ++CONFIG_SLIP=m ++CONFIG_SLIP_COMPRESSED=y ++CONFIG_SLIP_SMART=y ++CONFIG_USB_CATC=m ++CONFIG_USB_KAWETH=m ++CONFIG_USB_PEGASUS=m ++CONFIG_USB_RTL8150=m ++CONFIG_USB_RTL8152=m ++CONFIG_USB_USBNET=y ++CONFIG_USB_NET_AX8817X=m ++CONFIG_USB_NET_AX88179_178A=m ++CONFIG_USB_NET_CDCETHER=m ++CONFIG_USB_NET_CDC_EEM=m ++CONFIG_USB_NET_CDC_NCM=m ++CONFIG_USB_NET_HUAWEI_CDC_NCM=m ++CONFIG_USB_NET_CDC_MBIM=m ++CONFIG_USB_NET_DM9601=m ++CONFIG_USB_NET_SR9700=m ++CONFIG_USB_NET_SR9800=m ++CONFIG_USB_NET_SMSC75XX=m ++CONFIG_USB_NET_SMSC95XX=y ++CONFIG_USB_NET_GL620A=m ++CONFIG_USB_NET_NET1080=m ++CONFIG_USB_NET_PLUSB=m ++CONFIG_USB_NET_MCS7830=m ++CONFIG_USB_NET_CDC_SUBSET=m ++CONFIG_USB_ALI_M5632=y ++CONFIG_USB_AN2720=y ++CONFIG_USB_EPSON2888=y ++CONFIG_USB_KC2190=y ++CONFIG_USB_NET_ZAURUS=m ++CONFIG_USB_NET_CX82310_ETH=m ++CONFIG_USB_NET_KALMIA=m ++CONFIG_USB_NET_QMI_WWAN=m ++CONFIG_USB_HSO=m ++CONFIG_USB_NET_INT51X1=m ++CONFIG_USB_IPHETH=m ++CONFIG_USB_SIERRA_NET=m ++CONFIG_USB_VL600=m ++CONFIG_LIBERTAS_THINFIRM=m ++CONFIG_LIBERTAS_THINFIRM_USB=m ++CONFIG_AT76C50X_USB=m ++CONFIG_USB_ZD1201=m ++CONFIG_USB_NET_RNDIS_WLAN=m ++CONFIG_RTL8187=m ++CONFIG_MAC80211_HWSIM=m ++CONFIG_ATH_CARDS=m ++CONFIG_ATH9K=m ++CONFIG_ATH9K_HTC=m ++CONFIG_CARL9170=m ++CONFIG_ATH6KL=m ++CONFIG_ATH6KL_USB=m ++CONFIG_AR5523=m ++CONFIG_B43=m ++# CONFIG_B43_PHY_N is not set ++CONFIG_B43LEGACY=m ++CONFIG_BRCMFMAC=m ++CONFIG_BRCMFMAC_USB=y ++CONFIG_HOSTAP=m ++CONFIG_LIBERTAS=m ++CONFIG_LIBERTAS_USB=m ++CONFIG_LIBERTAS_SDIO=m ++CONFIG_P54_COMMON=m ++CONFIG_P54_USB=m ++CONFIG_RT2X00=m ++CONFIG_RT2500USB=m ++CONFIG_RT73USB=m ++CONFIG_RT2800USB=m ++CONFIG_RT2800USB_RT3573=y ++CONFIG_RT2800USB_RT53XX=y ++CONFIG_RT2800USB_RT55XX=y ++CONFIG_RT2800USB_UNKNOWN=y ++CONFIG_RTL8192CU=m ++CONFIG_ZD1211RW=m ++CONFIG_MWIFIEX=m ++CONFIG_MWIFIEX_SDIO=m ++CONFIG_WIMAX_I2400M_USB=m ++CONFIG_INPUT_POLLDEV=m ++# CONFIG_INPUT_MOUSEDEV_PSAUX is not set ++CONFIG_INPUT_JOYDEV=m ++CONFIG_INPUT_EVDEV=m ++# CONFIG_KEYBOARD_ATKBD is not set ++CONFIG_KEYBOARD_GPIO=m ++# CONFIG_INPUT_MOUSE is not set ++CONFIG_INPUT_JOYSTICK=y ++CONFIG_JOYSTICK_IFORCE=m ++CONFIG_JOYSTICK_IFORCE_USB=y ++CONFIG_JOYSTICK_XPAD=m ++CONFIG_JOYSTICK_XPAD_FF=y ++CONFIG_INPUT_TOUCHSCREEN=y ++CONFIG_TOUCHSCREEN_ADS7846=m ++CONFIG_TOUCHSCREEN_EGALAX=m ++CONFIG_TOUCHSCREEN_USB_COMPOSITE=m ++CONFIG_TOUCHSCREEN_STMPE=m ++CONFIG_INPUT_MISC=y ++CONFIG_INPUT_AD714X=m ++CONFIG_INPUT_ATI_REMOTE2=m ++CONFIG_INPUT_KEYSPAN_REMOTE=m ++CONFIG_INPUT_POWERMATE=m ++CONFIG_INPUT_YEALINK=m ++CONFIG_INPUT_CM109=m ++CONFIG_INPUT_UINPUT=m ++CONFIG_INPUT_GPIO_ROTARY_ENCODER=m ++CONFIG_INPUT_ADXL34X=m ++CONFIG_INPUT_CMA3000=m ++CONFIG_SERIO=m ++CONFIG_SERIO_RAW=m ++CONFIG_GAMEPORT=m ++CONFIG_GAMEPORT_NS558=m ++CONFIG_GAMEPORT_L4=m ++CONFIG_DEVPTS_MULTIPLE_INSTANCES=y ++# CONFIG_LEGACY_PTYS is not set ++# CONFIG_DEVKMEM is not set ++CONFIG_SERIAL_AMBA_PL011=y ++CONFIG_SERIAL_AMBA_PL011_CONSOLE=y ++CONFIG_TTY_PRINTK=y ++CONFIG_HW_RANDOM=y ++CONFIG_HW_RANDOM_BCM2835=m ++CONFIG_HW_RANDOM_BCM2708=m ++CONFIG_RAW_DRIVER=y ++CONFIG_BRCM_CHAR_DRIVERS=y ++CONFIG_BCM_VC_CMA=y ++CONFIG_BCM_VC_SM=y ++CONFIG_I2C=y ++CONFIG_I2C_CHARDEV=m ++CONFIG_I2C_BCM2708=m ++CONFIG_SPI=y ++CONFIG_SPI_BCM2835=m ++CONFIG_SPI_BCM2708=m ++CONFIG_SPI_SPIDEV=y ++CONFIG_PPS=m ++CONFIG_PPS_CLIENT_LDISC=m ++CONFIG_PPS_CLIENT_GPIO=m ++CONFIG_GPIO_SYSFS=y ++CONFIG_GPIO_ARIZONA=m ++CONFIG_GPIO_STMPE=y ++CONFIG_W1=m ++CONFIG_W1_MASTER_DS2490=m ++CONFIG_W1_MASTER_DS2482=m ++CONFIG_W1_MASTER_DS1WM=m ++CONFIG_W1_MASTER_GPIO=m ++CONFIG_W1_SLAVE_THERM=m ++CONFIG_W1_SLAVE_SMEM=m ++CONFIG_W1_SLAVE_DS2408=m ++CONFIG_W1_SLAVE_DS2413=m ++CONFIG_W1_SLAVE_DS2406=m ++CONFIG_W1_SLAVE_DS2423=m ++CONFIG_W1_SLAVE_DS2431=m ++CONFIG_W1_SLAVE_DS2433=m ++CONFIG_W1_SLAVE_DS2760=m ++CONFIG_W1_SLAVE_DS2780=m ++CONFIG_W1_SLAVE_DS2781=m ++CONFIG_W1_SLAVE_DS28E04=m ++CONFIG_W1_SLAVE_BQ27000=m ++CONFIG_BATTERY_DS2760=m ++# CONFIG_HWMON is not set ++CONFIG_THERMAL=y ++CONFIG_THERMAL_BCM2835=y ++CONFIG_WATCHDOG=y ++CONFIG_BCM2708_WDT=m ++CONFIG_BCM2835_WDT=m ++CONFIG_UCB1400_CORE=m ++CONFIG_MFD_STMPE=y ++CONFIG_STMPE_SPI=y ++CONFIG_MFD_ARIZONA_I2C=m ++CONFIG_MFD_ARIZONA_SPI=m ++CONFIG_MFD_WM5102=y ++CONFIG_MEDIA_SUPPORT=m ++CONFIG_MEDIA_CAMERA_SUPPORT=y ++CONFIG_MEDIA_ANALOG_TV_SUPPORT=y ++CONFIG_MEDIA_DIGITAL_TV_SUPPORT=y ++CONFIG_MEDIA_RADIO_SUPPORT=y ++CONFIG_MEDIA_RC_SUPPORT=y ++CONFIG_MEDIA_CONTROLLER=y ++CONFIG_LIRC=m ++CONFIG_RC_DEVICES=y ++CONFIG_RC_ATI_REMOTE=m ++CONFIG_IR_IMON=m ++CONFIG_IR_MCEUSB=m ++CONFIG_IR_REDRAT3=m ++CONFIG_IR_STREAMZAP=m ++CONFIG_IR_IGUANA=m ++CONFIG_IR_TTUSBIR=m ++CONFIG_RC_LOOPBACK=m ++CONFIG_IR_GPIO_CIR=m ++CONFIG_MEDIA_USB_SUPPORT=y ++CONFIG_USB_VIDEO_CLASS=m ++CONFIG_USB_M5602=m ++CONFIG_USB_STV06XX=m ++CONFIG_USB_GL860=m ++CONFIG_USB_GSPCA_BENQ=m ++CONFIG_USB_GSPCA_CONEX=m ++CONFIG_USB_GSPCA_CPIA1=m ++CONFIG_USB_GSPCA_DTCS033=m ++CONFIG_USB_GSPCA_ETOMS=m ++CONFIG_USB_GSPCA_FINEPIX=m ++CONFIG_USB_GSPCA_JEILINJ=m ++CONFIG_USB_GSPCA_JL2005BCD=m ++CONFIG_USB_GSPCA_KINECT=m ++CONFIG_USB_GSPCA_KONICA=m ++CONFIG_USB_GSPCA_MARS=m ++CONFIG_USB_GSPCA_MR97310A=m ++CONFIG_USB_GSPCA_NW80X=m ++CONFIG_USB_GSPCA_OV519=m ++CONFIG_USB_GSPCA_OV534=m ++CONFIG_USB_GSPCA_OV534_9=m ++CONFIG_USB_GSPCA_PAC207=m ++CONFIG_USB_GSPCA_PAC7302=m ++CONFIG_USB_GSPCA_PAC7311=m ++CONFIG_USB_GSPCA_SE401=m ++CONFIG_USB_GSPCA_SN9C2028=m ++CONFIG_USB_GSPCA_SN9C20X=m ++CONFIG_USB_GSPCA_SONIXB=m ++CONFIG_USB_GSPCA_SONIXJ=m ++CONFIG_USB_GSPCA_SPCA500=m ++CONFIG_USB_GSPCA_SPCA501=m ++CONFIG_USB_GSPCA_SPCA505=m ++CONFIG_USB_GSPCA_SPCA506=m ++CONFIG_USB_GSPCA_SPCA508=m ++CONFIG_USB_GSPCA_SPCA561=m ++CONFIG_USB_GSPCA_SPCA1528=m ++CONFIG_USB_GSPCA_SQ905=m ++CONFIG_USB_GSPCA_SQ905C=m ++CONFIG_USB_GSPCA_SQ930X=m ++CONFIG_USB_GSPCA_STK014=m ++CONFIG_USB_GSPCA_STK1135=m ++CONFIG_USB_GSPCA_STV0680=m ++CONFIG_USB_GSPCA_SUNPLUS=m ++CONFIG_USB_GSPCA_T613=m ++CONFIG_USB_GSPCA_TOPRO=m ++CONFIG_USB_GSPCA_TV8532=m ++CONFIG_USB_GSPCA_VC032X=m ++CONFIG_USB_GSPCA_VICAM=m ++CONFIG_USB_GSPCA_XIRLINK_CIT=m ++CONFIG_USB_GSPCA_ZC3XX=m ++CONFIG_USB_PWC=m ++CONFIG_VIDEO_CPIA2=m ++CONFIG_USB_ZR364XX=m ++CONFIG_USB_STKWEBCAM=m ++CONFIG_USB_S2255=m ++CONFIG_VIDEO_USBTV=m ++CONFIG_VIDEO_PVRUSB2=m ++CONFIG_VIDEO_HDPVR=m ++CONFIG_VIDEO_USBVISION=m ++CONFIG_VIDEO_STK1160_COMMON=m ++CONFIG_VIDEO_STK1160_AC97=y ++CONFIG_VIDEO_GO7007=m ++CONFIG_VIDEO_GO7007_USB=m ++CONFIG_VIDEO_GO7007_USB_S2250_BOARD=m ++CONFIG_VIDEO_AU0828=m ++CONFIG_VIDEO_AU0828_RC=y ++CONFIG_VIDEO_CX231XX=m ++CONFIG_VIDEO_CX231XX_ALSA=m ++CONFIG_VIDEO_CX231XX_DVB=m ++CONFIG_VIDEO_TM6000=m ++CONFIG_VIDEO_TM6000_ALSA=m ++CONFIG_VIDEO_TM6000_DVB=m ++CONFIG_DVB_USB=m ++CONFIG_DVB_USB_A800=m ++CONFIG_DVB_USB_DIBUSB_MB=m ++CONFIG_DVB_USB_DIBUSB_MB_FAULTY=y ++CONFIG_DVB_USB_DIBUSB_MC=m ++CONFIG_DVB_USB_DIB0700=m ++CONFIG_DVB_USB_UMT_010=m ++CONFIG_DVB_USB_CXUSB=m ++CONFIG_DVB_USB_M920X=m ++CONFIG_DVB_USB_DIGITV=m ++CONFIG_DVB_USB_VP7045=m ++CONFIG_DVB_USB_VP702X=m ++CONFIG_DVB_USB_GP8PSK=m ++CONFIG_DVB_USB_NOVA_T_USB2=m ++CONFIG_DVB_USB_TTUSB2=m ++CONFIG_DVB_USB_DTT200U=m ++CONFIG_DVB_USB_OPERA1=m ++CONFIG_DVB_USB_AF9005=m ++CONFIG_DVB_USB_AF9005_REMOTE=m ++CONFIG_DVB_USB_PCTV452E=m ++CONFIG_DVB_USB_DW2102=m ++CONFIG_DVB_USB_CINERGY_T2=m ++CONFIG_DVB_USB_DTV5100=m ++CONFIG_DVB_USB_FRIIO=m ++CONFIG_DVB_USB_AZ6027=m ++CONFIG_DVB_USB_TECHNISAT_USB2=m ++CONFIG_DVB_USB_V2=m ++CONFIG_DVB_USB_AF9015=m ++CONFIG_DVB_USB_AF9035=m ++CONFIG_DVB_USB_ANYSEE=m ++CONFIG_DVB_USB_AU6610=m ++CONFIG_DVB_USB_AZ6007=m ++CONFIG_DVB_USB_CE6230=m ++CONFIG_DVB_USB_EC168=m ++CONFIG_DVB_USB_GL861=m ++CONFIG_DVB_USB_LME2510=m ++CONFIG_DVB_USB_MXL111SF=m ++CONFIG_DVB_USB_RTL28XXU=m ++CONFIG_DVB_USB_DVBSKY=m ++CONFIG_SMS_USB_DRV=m ++CONFIG_DVB_B2C2_FLEXCOP_USB=m ++CONFIG_DVB_AS102=m ++CONFIG_VIDEO_EM28XX=m ++CONFIG_VIDEO_EM28XX_V4L2=m ++CONFIG_VIDEO_EM28XX_ALSA=m ++CONFIG_VIDEO_EM28XX_DVB=m ++CONFIG_V4L_PLATFORM_DRIVERS=y ++CONFIG_VIDEO_BCM2835=y ++CONFIG_VIDEO_BCM2835_MMAL=m ++CONFIG_RADIO_SI470X=y ++CONFIG_USB_SI470X=m ++CONFIG_I2C_SI470X=m ++CONFIG_RADIO_SI4713=m ++CONFIG_I2C_SI4713=m ++CONFIG_USB_MR800=m ++CONFIG_USB_DSBR=m ++CONFIG_RADIO_SHARK=m ++CONFIG_RADIO_SHARK2=m ++CONFIG_USB_KEENE=m ++CONFIG_USB_MA901=m ++CONFIG_RADIO_TEA5764=m ++CONFIG_RADIO_SAA7706H=m ++CONFIG_RADIO_TEF6862=m ++CONFIG_RADIO_WL1273=m ++CONFIG_RADIO_WL128X=m ++# CONFIG_MEDIA_SUBDRV_AUTOSELECT is not set ++CONFIG_VIDEO_UDA1342=m ++CONFIG_VIDEO_SONY_BTF_MPX=m ++CONFIG_VIDEO_TVP5150=m ++CONFIG_VIDEO_TW2804=m ++CONFIG_VIDEO_TW9903=m ++CONFIG_VIDEO_TW9906=m ++CONFIG_VIDEO_OV7640=m ++CONFIG_VIDEO_MT9V011=m ++CONFIG_FB=y ++CONFIG_FB_BCM2708=y ++CONFIG_FB_SSD1307=m ++# CONFIG_BACKLIGHT_GENERIC is not set ++CONFIG_BACKLIGHT_GPIO=m ++CONFIG_FRAMEBUFFER_CONSOLE=y ++CONFIG_LOGO=y ++# CONFIG_LOGO_LINUX_MONO is not set ++# CONFIG_LOGO_LINUX_VGA16 is not set ++CONFIG_SOUND=y ++CONFIG_SND=m ++CONFIG_SND_SEQUENCER=m ++CONFIG_SND_SEQ_DUMMY=m ++CONFIG_SND_MIXER_OSS=m ++CONFIG_SND_PCM_OSS=m ++CONFIG_SND_SEQUENCER_OSS=y ++CONFIG_SND_HRTIMER=m ++CONFIG_SND_DUMMY=m ++CONFIG_SND_ALOOP=m ++CONFIG_SND_VIRMIDI=m ++CONFIG_SND_MTPAV=m ++CONFIG_SND_SERIAL_U16550=m ++CONFIG_SND_MPU401=m ++CONFIG_SND_BCM2835=m ++CONFIG_SND_USB_AUDIO=m ++CONFIG_SND_USB_UA101=m ++CONFIG_SND_USB_CAIAQ=m ++CONFIG_SND_USB_CAIAQ_INPUT=y ++CONFIG_SND_USB_6FIRE=m ++CONFIG_SND_SOC=m ++CONFIG_SND_BCM2708_SOC_I2S=m ++CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC=m ++CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS=m ++CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI=m ++CONFIG_SND_BCM2708_SOC_HIFIBERRY_AMP=m ++CONFIG_SND_BCM2708_SOC_RPI_DAC=m ++CONFIG_SND_BCM2708_SOC_RPI_PROTO=m ++CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC=m ++CONFIG_SND_BCM2708_SOC_SLICE=m ++CONFIG_SND_SIMPLE_CARD=m ++CONFIG_SOUND_PRIME=m ++CONFIG_HIDRAW=y ++CONFIG_HID_A4TECH=m ++CONFIG_HID_ACRUX=m ++CONFIG_HID_APPLE=m ++CONFIG_HID_BELKIN=m ++CONFIG_HID_CHERRY=m ++CONFIG_HID_CHICONY=m ++CONFIG_HID_CYPRESS=m ++CONFIG_HID_DRAGONRISE=m ++CONFIG_HID_EMS_FF=m ++CONFIG_HID_ELECOM=m ++CONFIG_HID_ELO=m ++CONFIG_HID_EZKEY=m ++CONFIG_HID_HOLTEK=m ++CONFIG_HID_KEYTOUCH=m ++CONFIG_HID_KYE=m ++CONFIG_HID_UCLOGIC=m ++CONFIG_HID_WALTOP=m ++CONFIG_HID_GYRATION=m ++CONFIG_HID_TWINHAN=m ++CONFIG_HID_KENSINGTON=m ++CONFIG_HID_LCPOWER=m ++CONFIG_HID_LOGITECH=m ++CONFIG_HID_MAGICMOUSE=m ++CONFIG_HID_MICROSOFT=m ++CONFIG_HID_MONTEREY=m ++CONFIG_HID_MULTITOUCH=m ++CONFIG_HID_NTRIG=m ++CONFIG_HID_ORTEK=m ++CONFIG_HID_PANTHERLORD=m ++CONFIG_HID_PETALYNX=m ++CONFIG_HID_PICOLCD=m ++CONFIG_HID_ROCCAT=m ++CONFIG_HID_SAMSUNG=m ++CONFIG_HID_SONY=m ++CONFIG_HID_SPEEDLINK=m ++CONFIG_HID_SUNPLUS=m ++CONFIG_HID_GREENASIA=m ++CONFIG_HID_SMARTJOYPLUS=m ++CONFIG_HID_TOPSEED=m ++CONFIG_HID_THINGM=m ++CONFIG_HID_THRUSTMASTER=m ++CONFIG_HID_WACOM=m ++CONFIG_HID_WIIMOTE=m ++CONFIG_HID_XINMO=m ++CONFIG_HID_ZEROPLUS=m ++CONFIG_HID_ZYDACRON=m ++CONFIG_HID_PID=y ++CONFIG_USB_HIDDEV=y ++CONFIG_USB=y ++CONFIG_USB_ANNOUNCE_NEW_DEVICES=y ++CONFIG_USB_MON=m ++CONFIG_USB_DWCOTG=y ++CONFIG_USB_PRINTER=m ++CONFIG_USB_STORAGE=y ++CONFIG_USB_STORAGE_REALTEK=m ++CONFIG_USB_STORAGE_DATAFAB=m ++CONFIG_USB_STORAGE_FREECOM=m ++CONFIG_USB_STORAGE_ISD200=m ++CONFIG_USB_STORAGE_USBAT=m ++CONFIG_USB_STORAGE_SDDR09=m ++CONFIG_USB_STORAGE_SDDR55=m ++CONFIG_USB_STORAGE_JUMPSHOT=m ++CONFIG_USB_STORAGE_ALAUDA=m ++CONFIG_USB_STORAGE_ONETOUCH=m ++CONFIG_USB_STORAGE_KARMA=m ++CONFIG_USB_STORAGE_CYPRESS_ATACB=m ++CONFIG_USB_STORAGE_ENE_UB6250=m ++CONFIG_USB_MDC800=m ++CONFIG_USB_MICROTEK=m ++CONFIG_USBIP_CORE=m ++CONFIG_USBIP_VHCI_HCD=m ++CONFIG_USBIP_HOST=m ++CONFIG_USB_SERIAL=m ++CONFIG_USB_SERIAL_GENERIC=y ++CONFIG_USB_SERIAL_AIRCABLE=m ++CONFIG_USB_SERIAL_ARK3116=m ++CONFIG_USB_SERIAL_BELKIN=m ++CONFIG_USB_SERIAL_CH341=m ++CONFIG_USB_SERIAL_WHITEHEAT=m ++CONFIG_USB_SERIAL_DIGI_ACCELEPORT=m ++CONFIG_USB_SERIAL_CP210X=m ++CONFIG_USB_SERIAL_CYPRESS_M8=m ++CONFIG_USB_SERIAL_EMPEG=m ++CONFIG_USB_SERIAL_FTDI_SIO=m ++CONFIG_USB_SERIAL_VISOR=m ++CONFIG_USB_SERIAL_IPAQ=m ++CONFIG_USB_SERIAL_IR=m ++CONFIG_USB_SERIAL_EDGEPORT=m ++CONFIG_USB_SERIAL_EDGEPORT_TI=m ++CONFIG_USB_SERIAL_F81232=m ++CONFIG_USB_SERIAL_GARMIN=m ++CONFIG_USB_SERIAL_IPW=m ++CONFIG_USB_SERIAL_IUU=m ++CONFIG_USB_SERIAL_KEYSPAN_PDA=m ++CONFIG_USB_SERIAL_KEYSPAN=m ++CONFIG_USB_SERIAL_KLSI=m ++CONFIG_USB_SERIAL_KOBIL_SCT=m ++CONFIG_USB_SERIAL_MCT_U232=m ++CONFIG_USB_SERIAL_METRO=m ++CONFIG_USB_SERIAL_MOS7720=m ++CONFIG_USB_SERIAL_MOS7840=m ++CONFIG_USB_SERIAL_NAVMAN=m ++CONFIG_USB_SERIAL_PL2303=m ++CONFIG_USB_SERIAL_OTI6858=m ++CONFIG_USB_SERIAL_QCAUX=m ++CONFIG_USB_SERIAL_QUALCOMM=m ++CONFIG_USB_SERIAL_SPCP8X5=m ++CONFIG_USB_SERIAL_SAFE=m ++CONFIG_USB_SERIAL_SIERRAWIRELESS=m ++CONFIG_USB_SERIAL_SYMBOL=m ++CONFIG_USB_SERIAL_TI=m ++CONFIG_USB_SERIAL_CYBERJACK=m ++CONFIG_USB_SERIAL_XIRCOM=m ++CONFIG_USB_SERIAL_OPTION=m ++CONFIG_USB_SERIAL_OMNINET=m ++CONFIG_USB_SERIAL_OPTICON=m ++CONFIG_USB_SERIAL_XSENS_MT=m ++CONFIG_USB_SERIAL_WISHBONE=m ++CONFIG_USB_SERIAL_SSU100=m ++CONFIG_USB_SERIAL_QT2=m ++CONFIG_USB_SERIAL_DEBUG=m ++CONFIG_USB_EMI62=m ++CONFIG_USB_EMI26=m ++CONFIG_USB_ADUTUX=m ++CONFIG_USB_SEVSEG=m ++CONFIG_USB_RIO500=m ++CONFIG_USB_LEGOTOWER=m ++CONFIG_USB_LCD=m ++CONFIG_USB_LED=m ++CONFIG_USB_CYPRESS_CY7C63=m ++CONFIG_USB_CYTHERM=m ++CONFIG_USB_IDMOUSE=m ++CONFIG_USB_FTDI_ELAN=m ++CONFIG_USB_APPLEDISPLAY=m ++CONFIG_USB_LD=m ++CONFIG_USB_TRANCEVIBRATOR=m ++CONFIG_USB_IOWARRIOR=m ++CONFIG_USB_TEST=m ++CONFIG_USB_ISIGHTFW=m ++CONFIG_USB_YUREX=m ++CONFIG_USB_ATM=m ++CONFIG_USB_SPEEDTOUCH=m ++CONFIG_USB_CXACRU=m ++CONFIG_USB_UEAGLEATM=m ++CONFIG_USB_XUSBATM=m ++CONFIG_MMC=y ++CONFIG_MMC_BLOCK_MINORS=32 ++CONFIG_MMC_BCM2835=y ++CONFIG_MMC_BCM2835_DMA=y ++CONFIG_MMC_BCM2835_SDHOST=y ++CONFIG_MMC_SDHCI=y ++CONFIG_MMC_SDHCI_PLTFM=y ++CONFIG_MMC_SPI=m ++CONFIG_LEDS_CLASS=y ++CONFIG_LEDS_GPIO=y ++CONFIG_LEDS_TRIGGER_TIMER=y ++CONFIG_LEDS_TRIGGER_ONESHOT=y ++CONFIG_LEDS_TRIGGER_HEARTBEAT=y ++CONFIG_LEDS_TRIGGER_BACKLIGHT=y ++CONFIG_LEDS_TRIGGER_CPU=y ++CONFIG_LEDS_TRIGGER_GPIO=y ++CONFIG_LEDS_TRIGGER_DEFAULT_ON=y ++CONFIG_LEDS_TRIGGER_TRANSIENT=m ++CONFIG_LEDS_TRIGGER_CAMERA=m ++CONFIG_LEDS_TRIGGER_INPUT=y ++CONFIG_RTC_CLASS=y ++# CONFIG_RTC_HCTOSYS is not set ++CONFIG_RTC_DRV_DS1307=m ++CONFIG_RTC_DRV_DS1374=m ++CONFIG_RTC_DRV_DS1672=m ++CONFIG_RTC_DRV_DS3232=m ++CONFIG_RTC_DRV_MAX6900=m ++CONFIG_RTC_DRV_RS5C372=m ++CONFIG_RTC_DRV_ISL1208=m ++CONFIG_RTC_DRV_ISL12022=m ++CONFIG_RTC_DRV_ISL12057=m ++CONFIG_RTC_DRV_X1205=m ++CONFIG_RTC_DRV_PCF2127=m ++CONFIG_RTC_DRV_PCF8523=m ++CONFIG_RTC_DRV_PCF8563=m ++CONFIG_RTC_DRV_PCF8583=m ++CONFIG_RTC_DRV_M41T80=m ++CONFIG_RTC_DRV_BQ32K=m ++CONFIG_RTC_DRV_S35390A=m ++CONFIG_RTC_DRV_FM3130=m ++CONFIG_RTC_DRV_RX8581=m ++CONFIG_RTC_DRV_RX8025=m ++CONFIG_RTC_DRV_EM3027=m ++CONFIG_RTC_DRV_RV3029C2=m ++CONFIG_RTC_DRV_M41T93=m ++CONFIG_RTC_DRV_M41T94=m ++CONFIG_RTC_DRV_DS1305=m ++CONFIG_RTC_DRV_DS1390=m ++CONFIG_RTC_DRV_MAX6902=m ++CONFIG_RTC_DRV_R9701=m ++CONFIG_RTC_DRV_RS5C348=m ++CONFIG_RTC_DRV_DS3234=m ++CONFIG_RTC_DRV_PCF2123=m ++CONFIG_RTC_DRV_RX4581=m ++CONFIG_DMADEVICES=y ++CONFIG_DMA_BCM2708=y ++CONFIG_UIO=m ++CONFIG_UIO_PDRV_GENIRQ=m ++CONFIG_STAGING=y ++CONFIG_PRISM2_USB=m ++CONFIG_R8712U=m ++CONFIG_R8188EU=m ++CONFIG_R8723AU=m ++CONFIG_VT6656=m ++CONFIG_SPEAKUP=m ++CONFIG_SPEAKUP_SYNTH_SOFT=m ++CONFIG_STAGING_MEDIA=y ++CONFIG_LIRC_STAGING=y ++CONFIG_LIRC_IMON=m ++CONFIG_LIRC_RPI=m ++CONFIG_LIRC_SASEM=m ++CONFIG_LIRC_SERIAL=m ++CONFIG_FB_TFT=m ++CONFIG_FB_TFT_AGM1264K_FL=m ++CONFIG_FB_TFT_BD663474=m ++CONFIG_FB_TFT_HX8340BN=m ++CONFIG_FB_TFT_HX8347D=m ++CONFIG_FB_TFT_HX8353D=m ++CONFIG_FB_TFT_ILI9320=m ++CONFIG_FB_TFT_ILI9325=m ++CONFIG_FB_TFT_ILI9340=m ++CONFIG_FB_TFT_ILI9341=m ++CONFIG_FB_TFT_ILI9481=m ++CONFIG_FB_TFT_ILI9486=m ++CONFIG_FB_TFT_PCD8544=m ++CONFIG_FB_TFT_RA8875=m ++CONFIG_FB_TFT_S6D02A1=m ++CONFIG_FB_TFT_S6D1121=m ++CONFIG_FB_TFT_SSD1289=m ++CONFIG_FB_TFT_SSD1306=m ++CONFIG_FB_TFT_SSD1331=m ++CONFIG_FB_TFT_SSD1351=m ++CONFIG_FB_TFT_ST7735R=m ++CONFIG_FB_TFT_TINYLCD=m ++CONFIG_FB_TFT_TLS8204=m ++CONFIG_FB_TFT_UC1701=m ++CONFIG_FB_TFT_UPD161704=m ++CONFIG_FB_TFT_WATTEROTT=m ++CONFIG_FB_FLEX=m ++CONFIG_FB_TFT_FBTFT_DEVICE=m ++CONFIG_MAILBOX=y ++CONFIG_BCM2708_MBOX=y ++# CONFIG_IOMMU_SUPPORT is not set ++CONFIG_EXTCON=m ++CONFIG_EXTCON_ARIZONA=m ++CONFIG_IIO=m ++CONFIG_IIO_BUFFER=y ++CONFIG_IIO_BUFFER_CB=y ++CONFIG_IIO_KFIFO_BUF=m ++CONFIG_DHT11=m ++CONFIG_EXT4_FS=y ++CONFIG_EXT4_FS_POSIX_ACL=y ++CONFIG_EXT4_FS_SECURITY=y ++CONFIG_REISERFS_FS=m ++CONFIG_REISERFS_FS_XATTR=y ++CONFIG_REISERFS_FS_POSIX_ACL=y ++CONFIG_REISERFS_FS_SECURITY=y ++CONFIG_JFS_FS=m ++CONFIG_JFS_POSIX_ACL=y ++CONFIG_JFS_SECURITY=y ++CONFIG_JFS_STATISTICS=y ++CONFIG_XFS_FS=m ++CONFIG_XFS_QUOTA=y ++CONFIG_XFS_POSIX_ACL=y ++CONFIG_XFS_RT=y ++CONFIG_GFS2_FS=m ++CONFIG_OCFS2_FS=m ++CONFIG_BTRFS_FS=m ++CONFIG_BTRFS_FS_POSIX_ACL=y ++CONFIG_NILFS2_FS=m ++CONFIG_FANOTIFY=y ++CONFIG_QFMT_V1=m ++CONFIG_QFMT_V2=m ++CONFIG_AUTOFS4_FS=y ++CONFIG_FUSE_FS=m ++CONFIG_CUSE=m ++CONFIG_FSCACHE=y ++CONFIG_FSCACHE_STATS=y ++CONFIG_FSCACHE_HISTOGRAM=y ++CONFIG_CACHEFILES=y ++CONFIG_ISO9660_FS=m ++CONFIG_JOLIET=y ++CONFIG_ZISOFS=y ++CONFIG_UDF_FS=m ++CONFIG_MSDOS_FS=y ++CONFIG_VFAT_FS=y ++CONFIG_FAT_DEFAULT_IOCHARSET="ascii" ++CONFIG_NTFS_FS=m ++CONFIG_NTFS_RW=y ++CONFIG_TMPFS=y ++CONFIG_TMPFS_POSIX_ACL=y ++CONFIG_CONFIGFS_FS=y ++CONFIG_ECRYPT_FS=m ++CONFIG_HFS_FS=m ++CONFIG_HFSPLUS_FS=m ++CONFIG_SQUASHFS=m ++CONFIG_SQUASHFS_XATTR=y ++CONFIG_SQUASHFS_LZO=y ++CONFIG_SQUASHFS_XZ=y ++CONFIG_F2FS_FS=y ++CONFIG_NFS_FS=y ++CONFIG_NFS_V3_ACL=y ++CONFIG_NFS_V4=y ++CONFIG_NFS_SWAP=y ++CONFIG_ROOT_NFS=y ++CONFIG_NFS_FSCACHE=y ++CONFIG_NFSD=m ++CONFIG_NFSD_V3_ACL=y ++CONFIG_NFSD_V4=y ++CONFIG_CIFS=m ++CONFIG_CIFS_WEAK_PW_HASH=y ++CONFIG_CIFS_UPCALL=y ++CONFIG_CIFS_XATTR=y ++CONFIG_CIFS_POSIX=y ++CONFIG_9P_FS=m ++CONFIG_9P_FS_POSIX_ACL=y ++CONFIG_NLS_DEFAULT="utf8" ++CONFIG_NLS_CODEPAGE_437=y ++CONFIG_NLS_CODEPAGE_737=m ++CONFIG_NLS_CODEPAGE_775=m ++CONFIG_NLS_CODEPAGE_850=m ++CONFIG_NLS_CODEPAGE_852=m ++CONFIG_NLS_CODEPAGE_855=m ++CONFIG_NLS_CODEPAGE_857=m ++CONFIG_NLS_CODEPAGE_860=m ++CONFIG_NLS_CODEPAGE_861=m ++CONFIG_NLS_CODEPAGE_862=m ++CONFIG_NLS_CODEPAGE_863=m ++CONFIG_NLS_CODEPAGE_864=m ++CONFIG_NLS_CODEPAGE_865=m ++CONFIG_NLS_CODEPAGE_866=m ++CONFIG_NLS_CODEPAGE_869=m ++CONFIG_NLS_CODEPAGE_936=m ++CONFIG_NLS_CODEPAGE_950=m ++CONFIG_NLS_CODEPAGE_932=m ++CONFIG_NLS_CODEPAGE_949=m ++CONFIG_NLS_CODEPAGE_874=m ++CONFIG_NLS_ISO8859_8=m ++CONFIG_NLS_CODEPAGE_1250=m ++CONFIG_NLS_CODEPAGE_1251=m ++CONFIG_NLS_ASCII=y ++CONFIG_NLS_ISO8859_1=m ++CONFIG_NLS_ISO8859_2=m ++CONFIG_NLS_ISO8859_3=m ++CONFIG_NLS_ISO8859_4=m ++CONFIG_NLS_ISO8859_5=m ++CONFIG_NLS_ISO8859_6=m ++CONFIG_NLS_ISO8859_7=m ++CONFIG_NLS_ISO8859_9=m ++CONFIG_NLS_ISO8859_13=m ++CONFIG_NLS_ISO8859_14=m ++CONFIG_NLS_ISO8859_15=m ++CONFIG_NLS_KOI8_R=m ++CONFIG_NLS_KOI8_U=m ++CONFIG_DLM=m ++CONFIG_PRINTK_TIME=y ++CONFIG_BOOT_PRINTK_DELAY=y ++CONFIG_DEBUG_MEMORY_INIT=y ++CONFIG_DETECT_HUNG_TASK=y ++CONFIG_TIMER_STATS=y ++# CONFIG_DEBUG_PREEMPT is not set ++CONFIG_LATENCYTOP=y ++CONFIG_IRQSOFF_TRACER=y ++CONFIG_SCHED_TRACER=y ++CONFIG_STACK_TRACER=y ++CONFIG_BLK_DEV_IO_TRACE=y ++# CONFIG_KPROBE_EVENT is not set ++CONFIG_FUNCTION_PROFILER=y ++CONFIG_KGDB=y ++CONFIG_KGDB_KDB=y ++CONFIG_KDB_KEYBOARD=y ++CONFIG_CRYPTO_USER=m ++CONFIG_CRYPTO_CRYPTD=m ++CONFIG_CRYPTO_CBC=y ++CONFIG_CRYPTO_CTS=m ++CONFIG_CRYPTO_XTS=m ++CONFIG_CRYPTO_XCBC=m ++CONFIG_CRYPTO_SHA1_ARM=m ++CONFIG_CRYPTO_SHA512=m ++CONFIG_CRYPTO_TGR192=m ++CONFIG_CRYPTO_WP512=m ++CONFIG_CRYPTO_AES_ARM=m ++CONFIG_CRYPTO_CAST5=m ++CONFIG_CRYPTO_DES=y ++# CONFIG_CRYPTO_ANSI_CPRNG is not set ++# CONFIG_CRYPTO_HW is not set ++CONFIG_CRC_ITU_T=y ++CONFIG_LIBCRC32C=y +reverted: +--- unpatched_linux/drivers/misc/Kconfig 2016-07-29 09:31:11.166762673 +0100 ++++ linux-4.6.1/drivers/misc/Kconfig 2016-07-29 09:35:50.378775589 +0100 +@@ -4,6 +4,10 @@ + + menu "Misc devices" + ++config BCM2835_WS2812 ++ tristate "Support DMA user access to WS2812 LEDs" ++ ++ + config SENSORS_LIS3LV02D + tristate + depends on INPUT +reverted: +--- unpatched_linux/drivers/misc/Makefile 2016-07-29 09:31:11.166762673 +0100 ++++ linux-4.6.1/drivers/misc/Makefile 2016-07-29 09:35:50.378775589 +0100 +@@ -2,6 +2,7 @@ + # Makefile for misc devices that really don't fit anywhere else. + # + ++obj-$(CONFIG_BCM2835_WS2812) += ws2812.o + obj-$(CONFIG_IBM_ASM) += ibmasm/ + obj-$(CONFIG_AD525X_DPOT) += ad525x_dpot.o + obj-$(CONFIG_AD525X_DPOT_I2C) += ad525x_dpot-i2c.o +reverted: +--- unpatched_linux/drivers/misc/ws2812.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-4.6.1/drivers/misc/ws2812.c 2016-07-29 09:40:19.434788035 +0100 +@@ -0,0 +1,533 @@ ++/* ++ * Raspberry Pi WS2812 PWM driver ++ * ++ * Written by: Gordon Hollingworth <gordon@fiveninjas.com> ++ * Based on DMA PWM driver from Jonathan Bell <jonathan@raspberrypi.org> ++ * ++ * Copyright (C) 2014 Raspberry Pi Ltd. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 as ++ * published by the Free Software Foundation. ++ * ++ * To use this driver you need to make sure that the PWM clock is set to 2.4MHz ++ * and the correct PWM0 output is connected. The best way to do this is to ++ * create a dt-blob.bin on your RaspberryPi, start by downloading the default ++ * dt-blob.dts from ++ * ++ * Note, this uses the same PWM hardware as the standard audio output on the Pi ++ * so you cannot use both simultaneously. ++ * ++ * http://www.raspberrypi.org/documentation/configuration/pin-configuration.md ++ * ++ * (Copy the bit from /dts-v1/; through to the end... This will contain the pin ++ * configuration for all the Raspberry Pi versions (since they are different. ++ * You can get rid of the ones you don't care about. Next alter the PWM0 output ++ * you want to use. ++ * ++ * http://www.raspberrypi.org/documentation/hardware/raspberrypi/bcm2835/BCM2835-ARM-Peripherals.pdf ++ * ++ * The link above will help understand what the GPIOs can do, check out page 102 ++ * You can use: GPIO12, GPIO18 or GPIO40, so for the Slice board we use GPIO40 so ++ * we have the following in the dts file ++ * ++ * pin@p40 { ++ * function = "pwm"; ++ * termination = "no_pulling"; ++ * }; ++ * ++ * And at the bottom of the dts file, although still in the 'videocore' block we ++ * have: ++ * ++ * clock_setup { ++ * clock@PWM { freq = <2400000>; }; ++ * }; ++ * ++ * To check whether the changes are correct you can use 'vcgencmd measure_clock 25' ++ * This should return the value 2400000 ++ * ++ * Also if you use wiringPi then you can do 'gpio readall' to check that the pin ++ * alternate setting is set correctly. ++ * ++ */ ++ ++#include <linux/kernel.h> ++#include <linux/module.h> ++#include <linux/fcntl.h> ++#include <linux/file.h> ++#include <linux/fs.h> ++#include <linux/wait.h> ++#include <linux/io.h> ++#include <linux/ioctl.h> ++#include <linux/cdev.h> ++#include <linux/delay.h> ++#include <linux/interrupt.h> ++#include <linux/dma-mapping.h> ++#include <linux/dmaengine.h> ++#include <linux/slab.h> ++#include <linux/platform_device.h> ++#include <linux/uaccess.h> ++#include <linux/of.h> ++#include <linux/of_address.h> ++#include <linux/gpio/consumer.h> ++#include <asm-generic/ioctl.h> ++ ++#define DRIVER_NAME "ws2812" ++ ++struct ws2812_state { ++ struct device * dev; ++ struct cdev cdev; ++ struct class * cl; ++ struct dma_chan * dma_chan; ++ dma_addr_t dma_addr; ++ ++ void __iomem * ioaddr; ++ phys_addr_t phys_addr; ++ ++ uint8_t * buffer; ++ uint32_t * pixbuf; ++ ++ struct gpio_desc * led_en; ++ ++ unsigned char brightness; ++ u32 invert; ++ u32 num_leds; ++}; ++ ++#ifndef BCM2708_PERI_BASE ++ #define BCM2708_PERI_BASE 0x20000000 ++#endif ++ ++#define BCM2835_VCMMU_SHIFT (0x7E000000 - BCM2708_PERI_BASE) ++ ++/* Each LED is controlled with a 24 bit RGB value ++ * each bit is created from a nibble of data either ++ * 1000 or 1110 so to create 24 bits you need 12 bytes ++ * of PWM output ++ */ ++#define BYTES_PER_LED 12 ++ ++// Number of 2.4MHz bits in 50us to create a reset condition ++#define RESET_BYTES ((50 * 24) / 80) ++ ++#define PWM_CTL 0x0 ++#define PWM_STA 0x4 ++#define PWM_DMAC 0x8 ++#define PWM_RNG1 0x10 ++#define PWM_DAT1 0x14 ++#define PWM_FIFO1 0x18 ++#define PWM_ID 0x50 ++ ++#define PWM_DMA_DREQ 5 ++ ++static dev_t devid = MKDEV(1337, 0); ++ ++/* ++** Functions to access the pwm peripheral ++*/ ++static void pwm_writel(struct ws2812_state * state, uint32_t val, uint32_t reg) ++{ ++ writel(val, state->ioaddr + reg); ++} ++ ++#if 0 ++static uint32_t pwm_readl(struct ws2812_state * state, uint32_t reg) ++{ ++ return readl(state->ioaddr + reg); ++} ++#endif ++ ++/* Initialise the PWM module to use serial output ++ * mode ++ */ ++static int pwm_init(struct ws2812_state * state) ++{ ++ uint32_t reg; ++ ++ // serial 32 bits per word ++ pwm_writel(state, 32, PWM_RNG1); ++ // Clear ++ pwm_writel(state, 0, PWM_DAT1); ++ ++ reg = (1 << 0) | /* CH1EN */ ++ (1 << 1) | /* serialiser */ ++ (0 << 2) | /* don't repeat last word */ ++ (0 << 3) | /* silence is zero */ ++ ((state->invert ? 1 : 0) << 4) | /* polarity */ ++ (1 << 5) | /* use fifo */ ++ (1 << 6) | /* Clear fifo */ ++ (1 << 7) | /* MSEN - Mask space enable */ ++ ((state->invert ? 1 : 0) << 11); /* Silence bit = 1 */ ++ pwm_writel(state, reg, PWM_CTL); ++ reg = (1 << 31) | /* DMA enabled */ ++ (4 << 8) | /* Threshold for panic */ ++ (8 << 0); /* Threshold for dreq */ ++ pwm_writel(state, reg, PWM_DMAC); ++ ++ return 0; ++ ++} ++ ++/* ++ * DMA callback function, release the mapping and the calling function ++ */ ++void ws2812_callback(void * param) ++{ ++ struct ws2812_state * state = (struct ws2812_state *) param; ++ ++ dma_unmap_single(state->dev, state->dma_addr, state->num_leds * BYTES_PER_LED, ++ DMA_TO_DEVICE); ++ ++} ++ ++/* ++ * Issue a DMA to the PWM peripheral from the assigned buffer ++ * buffer must be unmapped again before being used ++ */ ++int issue_dma(struct ws2812_state * state, uint8_t *buffer, int length) ++{ ++ struct dma_async_tx_descriptor *desc; ++ ++ state->dma_addr = dma_map_single(state->dev, ++ buffer, length, ++ DMA_TO_DEVICE); ++ ++ if(state->dma_addr == 0) ++ { ++ pr_err("Failed to map buffer for DMA\n"); ++ return -1; ++ } ++ ++ desc = dmaengine_prep_slave_single(state->dma_chan, state->dma_addr, ++ length, DMA_TO_DEVICE, DMA_PREP_INTERRUPT); ++ if(desc == NULL) ++ { ++ pr_err("Failed to prep the DMA transfer\n"); ++ return -1; ++ } ++ ++ desc->callback = ws2812_callback; ++ desc->callback_param = state; ++ dmaengine_submit(desc); ++ dma_async_issue_pending(state->dma_chan); ++ ++ return 0; ++} ++ ++ ++int clear_leds(struct ws2812_state * state) ++{ ++ int i; ++ ++ for(i = 0; i < state->num_leds * BYTES_PER_LED; i++) ++ state->buffer[i] = 0x88; ++ for(i = 0; i < RESET_BYTES; i++) ++ state->buffer[state->num_leds * BYTES_PER_LED + i] = 0; ++ ++ issue_dma(state, state->buffer, state->num_leds * BYTES_PER_LED + RESET_BYTES); ++ ++ return 0; ++} ++ ++static int ws2812_open(struct inode *inode, struct file *file) ++{ ++ struct ws2812_state * state; ++ state = container_of(inode->i_cdev, struct ws2812_state, cdev); ++ ++ file->private_data = state; ++ ++ return 0; ++} ++ ++/* WS2812B gamma correction ++GammaE=255*(res/255).^(1/.45) ++From: http://rgb-123.com/ws2812-color-output/ ++*/ ++unsigned char gamma_(unsigned char brightness, unsigned char val) ++{ ++ int bright = val; ++ unsigned char GammaE[] = { ++ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ++ 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, ++ 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, ++ 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 11, 11, ++ 11, 12, 12, 13, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, ++ 19, 19, 20, 21, 21, 22, 22, 23, 23, 24, 25, 25, 26, 27, 27, 28, ++ 29, 29, 30, 31, 31, 32, 33, 34, 34, 35, 36, 37, 37, 38, 39, 40, ++ 40, 41, 42, 43, 44, 45, 46, 46, 47, 48, 49, 50, 51, 52, 53, 54, ++ 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, ++ 71, 72, 73, 74, 76, 77, 78, 79, 80, 81, 83, 84, 85, 86, 88, 89, ++ 90, 91, 93, 94, 95, 96, 98, 99,100,102,103,104,106,107,109,110, ++ 111,113,114,116,117,119,120,121,123,124,126,128,129,131,132,134, ++ 135,137,138,140,142,143,145,146,148,150,151,153,155,157,158,160, ++ 162,163,165,167,169,170,172,174,176,178,179,181,183,185,187,189, ++ 191,193,194,196,198,200,202,204,206,208,210,212,214,216,218,220, ++ 222,224,227,229,231,233,235,237,239,241,244,246,248,250,252,255}; ++ bright = (bright * brightness) / 255; ++ return GammaE[bright]; ++} ++ ++// LED serial output ++// 4 bits make up a single bit of the output ++// 1 1 1 0 -- 1 ++// 1 0 0 0 -- 0 ++// ++// Plus require a space of 50 microseconds for reset ++// 24 bits per led ++// ++// (24 * 4) / 8 = 12 bytes per led ++// ++// red = 0xff0000 == 0xeeeeeeee 0x88888888 0x88888888 ++unsigned char * led_encode(struct ws2812_state * state, int rgb, unsigned char *buf) ++{ ++ int i; ++ unsigned char red = gamma_(state->brightness, rgb >> 8); ++ unsigned char blu = gamma_(state->brightness, rgb); ++ unsigned char grn = gamma_(state->brightness, rgb >> 16); ++ int rearrange = red + ++ (blu << 8) + ++ (grn << 16); ++ for(i = 11; i >= 0; i--) ++ { ++ switch(rearrange & 3) ++ { ++ case 0: *buf++ = 0x88; break; ++ case 1: *buf++ = 0x8e; break; ++ case 2: *buf++ = 0xe8; break; ++ case 3: *buf++ = 0xee; break; ++ } ++ rearrange >>= 2; ++ } ++ ++ return buf; ++} ++ ++ ++/* Write to the PWM through DMA ++ * Function to write the RGB buffer to the WS2812 leds, the input buffer ++ * contains a sequence of up to num_leds RGB32 integers, these are then ++ * converted into the nibble per bit sequence required to drive the PWM ++ */ ++ssize_t ws2812_write(struct file *filp, const char __user *buf, size_t count, loff_t *pos) ++{ ++ int32_t *p_rgb; ++ int8_t * p_buffer; ++ int i, length, num_leds; ++ struct ws2812_state * state = (struct ws2812_state *) filp->private_data; ++ ++ num_leds = min(count/4, state->num_leds); ++ ++ if(copy_from_user(state->pixbuf, buf, num_leds * 4)) ++ return -EFAULT; ++ ++ p_rgb = state->pixbuf; ++ p_buffer = state->buffer; ++ for(i = 0; i < num_leds; i++) ++ p_buffer = led_encode(state, *p_rgb++, p_buffer); ++ ++ /* Fill rest with '0' */ ++ memset(p_buffer, 0x00, RESET_BYTES); ++ ++ length = (int) p_buffer - (int) state->buffer + RESET_BYTES; ++ ++ /* Setup DMA engine */ ++ issue_dma(state, state->buffer, length); ++ ++ return count; ++} ++ ++ ++struct file_operations ws2812_fops = { ++ .owner = THIS_MODULE, ++ .llseek = NULL, ++ .read = NULL, ++ .write = ws2812_write, ++ .open = ws2812_open, ++ .release = NULL, ++}; ++ ++/* ++ * Probe function ++ */ ++static int ws2812_probe(struct platform_device *pdev) ++{ ++ int ret; ++ struct device *dev = &pdev->dev; ++ struct device_node *node = dev->of_node; ++ struct ws2812_state * state; ++ struct resource *iomem; ++ const __be32 *addr; ++ struct dma_slave_config cfg = ++ { ++ .src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES, ++ .dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES, ++ .slave_id = PWM_DMA_DREQ, ++ .direction = DMA_MEM_TO_DEV, ++ .src_addr = 0, ++ }; ++ ++ if(node == NULL) ++ { ++ pr_err("Require device tree entry\n"); ++ goto fail; ++ } ++ ++ state = kmalloc(sizeof(struct ws2812_state), GFP_KERNEL); ++ if (!state) { ++ pr_err("Can't allocate state\n"); ++ goto fail; ++ } ++ ++ state->dev = dev; ++ state->brightness = 255; ++ ++ // Create character device interface /dev/ws2812 ++ if(alloc_chrdev_region(&devid, 0, 1, "ws2812") < 0) ++ { ++ pr_err("Unable to create chrdev region"); ++ goto fail_malloc; ++ } ++ if((state->cl = class_create(THIS_MODULE, "ws2812")) == NULL) ++ { ++ unregister_chrdev_region(devid, 1); ++ pr_err("Unable to create class ws2812"); ++ goto fail_chrdev; ++ } ++ if(device_create(state->cl, NULL, devid, NULL, "ws2812") == NULL) ++ { ++ class_destroy(state->cl); ++ unregister_chrdev_region(devid, 1); ++ pr_err("Unable to create device ws2812"); ++ goto fail_class; ++ } ++ ++ state->cdev.owner = THIS_MODULE; ++ cdev_init(&state->cdev, &ws2812_fops); ++ ++ if(cdev_add(&state->cdev, devid, 1)) { ++ pr_err("CDEV failed\n"); ++ goto fail_device; ++ } ++ ++ platform_set_drvdata(pdev, state); ++ ++ /* get parameters from device tree */ ++ of_property_read_u32(node, ++ "rpi,invert", ++ &state->invert); ++ of_property_read_u32(node, ++ "rpi,num_leds", ++ &state->num_leds); ++ ++ state->pixbuf = kmalloc(state->num_leds * sizeof(int), GFP_KERNEL); ++ if(state->pixbuf == NULL) ++ { ++ pr_err("Failed to allocate internal buffer\n"); ++ goto fail_cdev; ++ } ++ ++ iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0); ++ state->ioaddr = devm_ioremap_resource(dev, iomem); ++ if (IS_ERR(state->ioaddr)) { ++ goto fail_pixbuf; ++ } ++ ++ addr = of_get_address(node, 0, NULL, NULL); ++ if (!addr) { ++ dev_err(dev, "could not get DMA-register address\n"); ++ return -ENODEV; ++ } ++ state->phys_addr = be32_to_cpup(addr); ++ ++ pr_err("phys_addr = 0x%x\n", state->phys_addr); ++ ++ state->buffer = kmalloc(state->num_leds * BYTES_PER_LED + RESET_BYTES, GFP_KERNEL); ++ if(state->buffer == NULL) ++ { ++ pr_err("Failed to allocate internal buffer\n"); ++ goto fail_pixbuf; ++ } ++ ++ state->dma_chan = dma_request_slave_channel(dev, "pwm_dma"); ++ if(state->dma_chan == NULL) ++ { ++ pr_err("Failed to request DMA channel"); ++ goto fail_buffer; ++ } ++ ++ /* request a DMA channel */ ++ cfg.dst_addr = state->phys_addr + PWM_FIFO1; ++ ret = dmaengine_slave_config(state->dma_chan, &cfg); ++ if (state->dma_chan < 0) { ++ pr_err("Can't allocate DMA channel\n"); ++ goto fail_dma_init; ++ } ++ pwm_init(state); ++ ++ // Enable the LED power ++ state->led_en = devm_gpiod_get(dev, "led-en", GPIOD_OUT_HIGH); ++ ++ clear_leds(state); ++ ++ return 0; ++fail_dma_init: ++ dma_release_channel(state->dma_chan); ++fail_buffer: ++ kfree(state->buffer); ++fail_pixbuf: ++ kfree(state->pixbuf); ++fail_cdev: ++ cdev_del(&state->cdev); ++fail_device: ++ device_destroy(state->cl, devid); ++fail_class: ++ class_destroy(state->cl); ++fail_chrdev: ++ unregister_chrdev_region(devid, 1); ++fail_malloc: ++ kfree(state); ++fail: ++ ++ return -1; ++} ++ ++ ++static int ws2812_remove(struct platform_device *pdev) ++{ ++ struct ws2812_state *state = platform_get_drvdata(pdev); ++ ++ platform_set_drvdata(pdev, NULL); ++ ++ dma_release_channel(state->dma_chan); ++ kfree(state->buffer); ++ kfree(state->pixbuf); ++ cdev_del(&state->cdev); ++ device_destroy(state->cl, devid); ++ class_destroy(state->cl); ++ unregister_chrdev_region(devid, 1); ++ kfree(state); ++ ++ return 0; ++} ++ ++static const struct of_device_id ws2812_match[] = { ++ { .compatible = "rpi,ws2812" }, ++ { } ++}; ++MODULE_DEVICE_TABLE(of, ws2812_match); ++ ++static struct platform_driver ws2812_driver = { ++ .probe = ws2812_probe, ++ .remove = ws2812_remove, ++ .driver = { ++ .name = DRIVER_NAME, ++ .owner = THIS_MODULE, ++ .of_match_table = ws2812_match, ++ }, ++}; ++module_platform_driver(ws2812_driver); ++ ++MODULE_ALIAS("platform:ws2812"); ++MODULE_DESCRIPTION("WS2812 PWM driver"); ++MODULE_LICENSE("GPL v2"); ++MODULE_AUTHOR("Gordon Hollingworth"); +reverted: +--- unpatched_linux/drivers/rtc/rtc-pcf8523.c 2016-06-01 20:18:22.000000000 +0100 ++++ linux-4.6.1/drivers/rtc/rtc-pcf8523.c 2016-07-29 09:35:50.378775589 +0100 +@@ -291,7 +291,13 @@ + if (!pcf) + return -ENOMEM; + ++ if (of_property_read_bool(client->dev.of_node, "nxp,xtalcap-7pf")) { ++ printk(KERN_ERR "PCF8523 - set 7pF crystal load"); ++ err = pcf8523_select_capacitance(client, false); ++ } else { ++ printk(KERN_ERR "PCF8523 - set 12pF crystal load"); ++ err = pcf8523_select_capacitance(client, true); ++ } +- err = pcf8523_select_capacitance(client, true); + if (err < 0) + return err; + +reverted: +--- unpatched_linux/sound/soc/bcm/Kconfig 2016-07-29 09:31:11.218762676 +0100 ++++ linux-4.6.1/sound/soc/bcm/Kconfig 2016-07-29 09:35:50.378775589 +0100 +@@ -100,3 +100,10 @@ + select SND_SOC_WM8741 + help + Say Y or M if you want to add support for Red Rocks Audio DigiDAC1 board. ++ ++config SND_BCM2708_SOC_SLICE ++ tristate "Support for Slice on-board sound" ++ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S ++ select SND_SOC_CS4265 ++ help ++ Say Y or M if you want to add support for Slice on-board sound. +reverted: +--- unpatched_linux/sound/soc/bcm/Makefile 2016-07-29 09:31:11.218762676 +0100 ++++ linux-4.6.1/sound/soc/bcm/Makefile 2016-07-29 09:35:50.378775589 +0100 +@@ -17,6 +17,7 @@ + snd-soc-raspidac3-objs := raspidac3.o + snd-soc-audioinjector-pi-soundcard-objs := audioinjector-pi-soundcard.o + snd-soc-digidac1-soundcard-objs := digidac1-soundcard.o ++snd-soc-slice-objs := slice.o + + obj-$(CONFIG_SND_BCM2708_SOC_ADAU1977_ADC) += snd-soc-adau1977-adc.o + obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o +@@ -31,4 +32,5 @@ + obj-$(CONFIG_SND_BCM2708_SOC_RASPIDAC3) += snd-soc-raspidac3.o + obj-$(CONFIG_SND_AUDIOINJECTOR_PI_SOUNDCARD) += snd-soc-audioinjector-pi-soundcard.o + obj-$(CONFIG_SND_DIGIDAC1_SOUNDCARD) += snd-soc-digidac1-soundcard.o ++obj-$(CONFIG_SND_BCM2708_SOC_SLICE) += snd-soc-slice.o + +reverted: +--- unpatched_linux/sound/soc/bcm/slice.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-4.6.1/sound/soc/bcm/slice.c 2016-07-29 09:35:50.378775589 +0100 +@@ -0,0 +1,340 @@ ++/* ++ * ASoC Driver for Slice on-board sound ++ * ++ * Author: James Adams <james@fiveninjas.com> ++ * Based on the HifiBerry DAC driver by Florian Meier <florian.meier@koalo.de> ++ * Copyright 2014 ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * version 2 as published by the Free Software Foundation. ++ * ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * General Public License for more details. ++ */ ++ ++#include <linux/module.h> ++#include <linux/platform_device.h> ++ ++#include <linux/io.h> ++ ++#include <sound/core.h> ++#include <sound/pcm.h> ++#include <sound/pcm_params.h> ++#include <sound/soc.h> ++#include <sound/jack.h> ++ ++#include "../codecs/cs4265.h" ++ ++static void __iomem *aper_base; ++static void __iomem *apll_base; ++static void __iomem *a2w_base; ++ ++#define CM_PLLA (apll_base) ++#define A2W_APER (a2w_base) ++ ++static int snd_slice_init(struct snd_soc_pcm_runtime *rtd) ++{ ++ return 0; ++} ++ ++#define BCM2708_CLK_PASSWD (0x5a000000) ++#define BCM2708_CLK_MASH(v) ((v) << 9) ++#define BCM2708_CLK_FLIP BIT(8) ++#define BCM2708_CLK_BUSY BIT(7) ++#define BCM2708_CLK_KILL BIT(5) ++#define BCM2708_CLK_ENAB BIT(4) ++#define BCM2708_CLK_SRC(v) (v) ++ ++#define BCM2708_CLK_LOADMASK BIT(6) ++#define BCM2708_CLK_HOLDMASK BIT(7) ++#define BCM2708_CLK_CHENB BIT(8) ++ ++void set_aper(int div) ++{ ++ if ( div == 0 ) { ++ writel(BCM2708_CLK_PASSWD | (readl(CM_PLLA) & ~BCM2708_CLK_LOADMASK) ++ | BCM2708_CLK_HOLDMASK, CM_PLLA); ++ // This line removes the channel enable and resets the divisor to 0 ++ // and disables the bypass clock ++ writel(BCM2708_CLK_PASSWD | BCM2708_CLK_CHENB, A2W_APER); ++ return; ++ } ++ ++ // To save time reading status bits from a2w regs we perform the same ++ // actions for starting a channel and changing a channel ++ // First we enable the channel and set the divisor ++ writel(BCM2708_CLK_PASSWD | div, A2W_APER); ++ ++ // Now load the divisor ++ writel(BCM2708_CLK_PASSWD | readl(CM_PLLA) | BCM2708_CLK_LOADMASK, CM_PLLA); ++ writel(BCM2708_CLK_PASSWD | (readl(CM_PLLA) & ~BCM2708_CLK_LOADMASK), CM_PLLA); ++ ++ // Now remove the hold (does nothing if already running) ++ writel(BCM2708_CLK_PASSWD | (readl(CM_PLLA) & ~BCM2708_CLK_HOLDMASK), CM_PLLA); ++} ++ ++ ++static void set_gp0div(unsigned int val) ++{ ++ int timeout = 1000; ++ ++ // First stop the clock ++ writel(BCM2708_CLK_PASSWD | (readl(aper_base) & ~BCM2708_CLK_ENAB), aper_base); ++ ++ // Wait until it is not busy ++ while (--timeout && (readl(aper_base) & BCM2708_CLK_BUSY)); ++ ++ if (timeout) { ++ writel(val | BCM2708_CLK_PASSWD, aper_base + 4); ++ writel(readl(aper_base) | BCM2708_CLK_PASSWD | BCM2708_CLK_ENAB, aper_base); ++ printk(KERN_ERR "New clock set"); ++ } ++ else ++ printk(KERN_ERR "Failed waiting for clock to stop"); ++} ++ ++ ++static int snd_slice_hw_params(struct snd_pcm_substream *substream, ++ struct snd_pcm_hw_params *params) ++{ ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_dai *codec_dai = rtd->codec_dai; ++ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; ++ struct snd_soc_codec *codec = rtd->codec; ++ int err; ++ int ret; ++ unsigned int rate = params_rate(params); ++ unsigned int sysclk = 12288000; ++ ++ switch (rate) { ++ case 32000: ++ sysclk = 12288000; ++ break; ++ case 44100: ++ sysclk = 11289600; ++ break; ++ case 48000: ++ sysclk = 12288000; ++ break; ++ case 64000: ++ sysclk = 12288000; ++ break; ++ case 88200: ++ sysclk = 11289600; ++ break; ++ case 96000: ++ sysclk = 12288000; ++ break; ++ case 128000: ++ dev_err(codec->dev, ++ "Failed to set CS4265 SYSCLK, sample rate not supported in ALSA: 128000\n"); ++ break; ++ case 176400: ++ sysclk = 11289600; ++ break; ++ case 192000: ++ sysclk = 12288000; ++ break; ++ default: ++ dev_err(codec->dev, ++ "Failed to set CS4265 SYSCLK, sample rate not supported\n"); ++ break; ++ } ++ ++ // Need two frequencies: 12.288 or 11.2896MHz ++ // Source is 1,806,336,000 ++ // /4 /40 - 1128960 ++ // /7 /21 - 1228800 ++ if (sysclk == 12288000) { ++ set_aper(0); ++ set_aper(7); ++ set_gp0div(0x15000); ++ printk(KERN_ERR "Setting hw_params, GP0_CTL=0x%x GP0_DIV=0x%x\n", readl(aper_base), readl(aper_base+0x4)); ++ } else { ++ set_aper(0); ++ set_aper(4); ++ set_gp0div(0x28000); ++ printk(KERN_ERR "Setting hw_params, GP0_CTL=0x%x GP0_DIV=0x%x\n", readl(aper_base), readl(aper_base+0x4)); ++ } ++ ++ printk(KERN_ERR "A2W_APER = 0x%x", readl(A2W_APER)); ++ ++ dev_err(codec->dev, "Set sampling frequency %d, using sysclk %d\n", rate, sysclk); ++ ++ err = snd_soc_dai_set_sysclk(codec_dai, 0, sysclk, ++ SND_SOC_CLOCK_OUT); ++ ++ ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S | ++ SND_SOC_DAIFMT_NB_NF | ++ SND_SOC_DAIFMT_CBM_CFM); ++ ++ if (ret) { ++ dev_err(cpu_dai->dev, ++ "Failed to set the cpu dai format.\n"); ++ return ret; ++ } ++ ++ ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S | ++ SND_SOC_DAIFMT_NB_NF | ++ SND_SOC_DAIFMT_CBM_CFM); ++ if (ret) { ++ dev_err(cpu_dai->dev, ++ "Failed to set the codec format.\n"); ++ return ret; ++ } ++ ++ snd_soc_dai_set_bclk_ratio(cpu_dai, 64); ++ ++ return 0; ++} ++ ++static int snd_slice_params_fixup(struct snd_soc_pcm_runtime *rtd, ++ struct snd_pcm_hw_params *params) ++{ ++printk(KERN_ERR "snd_slice_params_fixup called\n"); ++ /* force 32 bit */ ++ params_set_format(params, SNDRV_PCM_FORMAT_S32_LE); ++ return 0; ++} ++ ++/* machine stream operations */ ++static struct snd_soc_ops snd_slice_ops = { ++ .hw_params = snd_slice_hw_params, ++}; ++ ++/* Widgets */ ++static const struct snd_soc_dapm_widget snd_slice_dapm_widgets[] = { ++ SND_SOC_DAPM_SPK("Speaker 1", NULL), ++ SND_SOC_DAPM_SPK("Speaker 2", NULL), ++ SND_SOC_DAPM_MIC("Mic 1", NULL), ++ SND_SOC_DAPM_MIC("Mic 2", NULL), ++ SND_SOC_DAPM_MIC("LineIn 1", NULL), ++ SND_SOC_DAPM_MIC("LineIn 2", NULL), ++ SND_SOC_DAPM_SPK("Spdif", NULL), ++}; ++ ++/* Audio Map */ ++static const struct snd_soc_dapm_route snd_slice_audio_map[] = { ++ {"Speaker 1", NULL, "LINEOUTL"}, ++ {"Speaker 2", NULL, "LINEOUTR"}, ++ {"MICL", NULL, "Mic 1"}, ++ {"MICR", NULL, "Mic 2"}, ++ {"LINEINL", NULL, "LineIn 1"}, ++ {"LINEINR", NULL, "LineIn 2"}, ++ {"Spdif", NULL, "SPDIF"}, ++}; ++ ++static const struct snd_soc_pcm_stream snd_slice_params = { ++ .formats = SNDRV_PCM_FMTBIT_S32_LE | SNDRV_PCM_FMTBIT_S24_LE, ++}; ++ ++static struct snd_soc_dai_link snd_slice_dai[] = { ++{ ++ .name = "Slice", ++ .stream_name = "Slice HiFi", ++ .cpu_dai_name = "bcm2708-i2s.0", ++ .codec_dai_name = "cs4265-dai1", ++ .platform_name = "bcm2708-i2s.0", ++ .codec_name = "cs4265.1-004e", ++ .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | ++ SND_SOC_DAIFMT_CBM_CFM, ++ .ops = &snd_slice_ops, ++ .init = snd_slice_init, ++ .be_hw_params_fixup = snd_slice_params_fixup, ++}, ++}; ++ ++/* audio machine driver */ ++static struct snd_soc_card snd_slice = { ++ .name = "snd_slice", ++ .dai_link = snd_slice_dai, ++ .num_links = ARRAY_SIZE(snd_slice_dai), ++ .fully_routed = 1, ++ .dapm_widgets = snd_slice_dapm_widgets, ++ .num_dapm_widgets = ARRAY_SIZE(snd_slice_dapm_widgets), ++ .dapm_routes = snd_slice_audio_map, ++ .num_dapm_routes = ARRAY_SIZE(snd_slice_audio_map), ++}; ++ ++static int snd_slice_probe(struct platform_device *pdev) ++{ ++ int ret = 0; ++ struct resource *mem; ++ snd_slice.dev = &pdev->dev; ++ ++ if (pdev->dev.of_node) { ++ struct device_node *i2s_node; ++ struct snd_soc_dai_link *dai = &snd_slice_dai[0]; ++ i2s_node = of_parse_phandle(pdev->dev.of_node, ++ "i2s-controller", 0); ++ ++ if (i2s_node) { ++ dai->cpu_dai_name = NULL; ++ dai->cpu_of_node = i2s_node; ++ dai->platform_name = NULL; ++ dai->platform_of_node = i2s_node; ++ } ++ } ++ else ++ { ++ printk(KERN_ERR "SLICEAUDIO - ERROR no Device Tree!\n"); ++ } ++ ++ ret = snd_soc_register_card(&snd_slice); ++ if (ret) { ++ dev_err(&pdev->dev, ++ "snd_soc_register_card() failed: %d\n", ret); ++ goto snd_soc_register_card_failed; ++ } ++ ++ mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); ++ aper_base = devm_ioremap_resource(&pdev->dev, mem); ++ if (IS_ERR(aper_base)) ++ return PTR_ERR(aper_base); ++ ++ mem = platform_get_resource(pdev, IORESOURCE_MEM, 1); ++ apll_base = devm_ioremap_resource(&pdev->dev, mem); ++ if (IS_ERR(apll_base)) ++ return PTR_ERR(apll_base); ++ ++ mem = platform_get_resource(pdev, IORESOURCE_MEM, 2); ++ a2w_base = devm_ioremap_resource(&pdev->dev, mem); ++ if (IS_ERR(a2w_base)) ++ return PTR_ERR(a2w_base); ++ ++ return 0; ++ ++snd_soc_register_card_failed: ++ ++ return ret; ++} ++ ++static int snd_slice_remove(struct platform_device *pdev) ++{ ++ return snd_soc_unregister_card(&snd_slice); ++} ++ ++static const struct of_device_id slice_of_match[] = { ++ { .compatible = "fiveninjas,slice", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, slice_of_match); ++ ++static struct platform_driver snd_slice_driver = { ++ .driver = { ++ .name = "snd-slice", ++ .owner = THIS_MODULE, ++ .of_match_table = slice_of_match, ++ }, ++ .probe = snd_slice_probe, ++ .remove = snd_slice_remove, ++}; ++ ++module_platform_driver(snd_slice_driver); ++ ++MODULE_AUTHOR("James Adams <james@fiveninjas.com>"); ++MODULE_DESCRIPTION("ASoC Driver for Slice on-board audio"); ++MODULE_LICENSE("GPL v2"); +reverted: +--- unpatched_linux/sound/soc/codecs/cs4265.c 2016-06-01 20:18:22.000000000 +0100 ++++ linux-4.6.1/sound/soc/codecs/cs4265.c 2016-07-29 09:35:50.378775589 +0100 +@@ -157,7 +157,7 @@ + SOC_SINGLE("Validity Bit Control Switch", CS4265_SPDIF_CTL2, + 3, 1, 0), + SOC_ENUM("SPDIF Mono/Stereo", spdif_mono_stereo_enum), ++ SOC_SINGLE("MMTLR Data Switch", CS4265_SPDIF_CTL2, +- SOC_SINGLE("MMTLR Data Switch", 0, + 1, 1, 0), + SOC_ENUM("Mono Channel Select", spdif_mono_select_enum), + SND_SOC_BYTES("C Data Buffer", CS4265_C_DATA_BUFF, 24), +@@ -199,8 +199,6 @@ + SND_SOC_NOPM, 0, 0), + SND_SOC_DAPM_AIF_IN("DIN2", NULL, 0, + SND_SOC_NOPM, 0, 0), +- SND_SOC_DAPM_AIF_IN("TXIN", NULL, 0, +- CS4265_SPDIF_CTL2, 5, 1), + + SND_SOC_DAPM_OUTPUT("LINEOUTL"), + SND_SOC_DAPM_OUTPUT("LINEOUTR"), +@@ -384,7 +382,6 @@ + static int cs4265_digital_mute(struct snd_soc_dai *dai, int mute) + { + struct snd_soc_codec *codec = dai->codec; +- + if (mute) { + snd_soc_update_bits(codec, CS4265_DAC_CTL, + CS4265_DAC_CTL_MUTE, +@@ -410,7 +407,7 @@ + struct snd_soc_codec *codec = dai->codec; + struct cs4265_private *cs4265 = snd_soc_codec_get_drvdata(codec); + int index; ++printk(KERN_ERR "cs4265_pcm_hw_params: format = 0x%x, width = %d\n", cs4265->format, params_width(params)); +- + if (substream->stream == SNDRV_PCM_STREAM_CAPTURE && + ((cs4265->format & SND_SOC_DAIFMT_FORMAT_MASK) + == SND_SOC_DAIFMT_RIGHT_J)) +@@ -469,6 +466,7 @@ + static int cs4265_set_bias_level(struct snd_soc_codec *codec, + enum snd_soc_bias_level level) + { ++printk(KERN_ERR "set_bias_level %d\n", level); + switch (level) { + case SND_SOC_BIAS_ON: + break; diff --git a/projects/Virtual/README.unsupported b/projects/Virtual/README.unsupported new file mode 100644 index 00000000000..cbc5ff4d6a5 --- /dev/null +++ b/projects/Virtual/README.unsupported @@ -0,0 +1,9 @@ +This is a testing project ONLY for developers. + +You are free to use it but there will be no support at all. + +To be absolutely clear there will be + +=== NO SUPPORT === + +on this project. diff --git a/projects/Virtual/linux/linux.x86_64.conf b/projects/Virtual/linux/linux.x86_64.conf new file mode 100644 index 00000000000..020532b0536 --- /dev/null +++ b/projects/Virtual/linux/linux.x86_64.conf @@ -0,0 +1,4830 @@ +# +# Automatically generated file; DO NOT EDIT. +# Linux/x86 4.6.0-rc5 Kernel Configuration +# +CONFIG_64BIT=y +CONFIG_X86_64=y +CONFIG_X86=y +CONFIG_INSTRUCTION_DECODER=y +CONFIG_PERF_EVENTS_INTEL_UNCORE=y +CONFIG_OUTPUT_FORMAT="elf64-x86-64" +CONFIG_ARCH_DEFCONFIG="arch/x86/configs/x86_64_defconfig" +CONFIG_LOCKDEP_SUPPORT=y +CONFIG_STACKTRACE_SUPPORT=y +CONFIG_MMU=y +CONFIG_ARCH_MMAP_RND_BITS_MIN=28 +CONFIG_ARCH_MMAP_RND_BITS_MAX=32 +CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MIN=8 +CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MAX=16 +CONFIG_NEED_DMA_MAP_STATE=y +CONFIG_NEED_SG_DMA_LENGTH=y +CONFIG_GENERIC_ISA_DMA=y +CONFIG_GENERIC_BUG=y +CONFIG_GENERIC_BUG_RELATIVE_POINTERS=y +CONFIG_GENERIC_HWEIGHT=y +CONFIG_ARCH_MAY_HAVE_PC_FDC=y +CONFIG_RWSEM_XCHGADD_ALGORITHM=y +CONFIG_GENERIC_CALIBRATE_DELAY=y +CONFIG_ARCH_HAS_CPU_RELAX=y +CONFIG_ARCH_HAS_CACHE_LINE_SIZE=y +CONFIG_HAVE_SETUP_PER_CPU_AREA=y +CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK=y +CONFIG_NEED_PER_CPU_PAGE_FIRST_CHUNK=y +CONFIG_ARCH_HIBERNATION_POSSIBLE=y +CONFIG_ARCH_SUSPEND_POSSIBLE=y +CONFIG_ARCH_WANT_HUGE_PMD_SHARE=y +CONFIG_ARCH_WANT_GENERAL_HUGETLB=y +CONFIG_ZONE_DMA32=y +CONFIG_AUDIT_ARCH=y +CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING=y +CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y +CONFIG_X86_64_SMP=y +CONFIG_ARCH_HWEIGHT_CFLAGS="-fcall-saved-rdi -fcall-saved-rsi -fcall-saved-rdx -fcall-saved-rcx -fcall-saved-r8 -fcall-saved-r9 -fcall-saved-r10 -fcall-saved-r11" +CONFIG_ARCH_SUPPORTS_UPROBES=y +CONFIG_FIX_EARLYCON_MEM=y +CONFIG_DEBUG_RODATA=y +CONFIG_PGTABLE_LEVELS=4 +CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" +CONFIG_IRQ_WORK=y +CONFIG_BUILDTIME_EXTABLE_SORT=y + +# +# General setup +# +CONFIG_INIT_ENV_ARG_LIMIT=32 +CONFIG_CROSS_COMPILE="" +# CONFIG_COMPILE_TEST is not set +CONFIG_LOCALVERSION="" +# CONFIG_LOCALVERSION_AUTO is not set +CONFIG_HAVE_KERNEL_GZIP=y +CONFIG_HAVE_KERNEL_BZIP2=y +CONFIG_HAVE_KERNEL_LZMA=y +CONFIG_HAVE_KERNEL_XZ=y +CONFIG_HAVE_KERNEL_LZO=y +CONFIG_HAVE_KERNEL_LZ4=y +# CONFIG_KERNEL_GZIP is not set +# CONFIG_KERNEL_BZIP2 is not set +# CONFIG_KERNEL_LZMA is not set +CONFIG_KERNEL_XZ=y +# CONFIG_KERNEL_LZO is not set +# CONFIG_KERNEL_LZ4 is not set +CONFIG_DEFAULT_HOSTNAME="@DISTRONAME@" +CONFIG_SWAP=y +CONFIG_SYSVIPC=y +CONFIG_SYSVIPC_SYSCTL=y +CONFIG_POSIX_MQUEUE=y +CONFIG_POSIX_MQUEUE_SYSCTL=y +CONFIG_CROSS_MEMORY_ATTACH=y +CONFIG_FHANDLE=y +# CONFIG_USELIB is not set +# CONFIG_AUDIT is not set +CONFIG_HAVE_ARCH_AUDITSYSCALL=y + +# +# IRQ subsystem +# +CONFIG_GENERIC_IRQ_PROBE=y +CONFIG_GENERIC_IRQ_SHOW=y +CONFIG_GENERIC_PENDING_IRQ=y +CONFIG_IRQ_DOMAIN=y +CONFIG_IRQ_DOMAIN_HIERARCHY=y +CONFIG_GENERIC_MSI_IRQ=y +CONFIG_GENERIC_MSI_IRQ_DOMAIN=y +# CONFIG_IRQ_DOMAIN_DEBUG is not set +CONFIG_IRQ_FORCED_THREADING=y +CONFIG_SPARSE_IRQ=y +CONFIG_CLOCKSOURCE_WATCHDOG=y +CONFIG_ARCH_CLOCKSOURCE_DATA=y +CONFIG_CLOCKSOURCE_VALIDATE_LAST_CYCLE=y +CONFIG_GENERIC_TIME_VSYSCALL=y +CONFIG_GENERIC_CLOCKEVENTS=y +CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y +CONFIG_GENERIC_CLOCKEVENTS_MIN_ADJUST=y +CONFIG_GENERIC_CMOS_UPDATE=y + +# +# Timers subsystem +# +CONFIG_TICK_ONESHOT=y +CONFIG_NO_HZ_COMMON=y +# CONFIG_HZ_PERIODIC is not set +CONFIG_NO_HZ_IDLE=y +# CONFIG_NO_HZ_FULL is not set +CONFIG_NO_HZ=y +CONFIG_HIGH_RES_TIMERS=y + +# +# CPU/Task time and stats accounting +# +CONFIG_TICK_CPU_ACCOUNTING=y +# CONFIG_VIRT_CPU_ACCOUNTING_GEN is not set +# CONFIG_IRQ_TIME_ACCOUNTING is not set +CONFIG_BSD_PROCESS_ACCT=y +# CONFIG_BSD_PROCESS_ACCT_V3 is not set +# CONFIG_TASKSTATS is not set + +# +# RCU Subsystem +# +CONFIG_TREE_RCU=y +# CONFIG_RCU_EXPERT is not set +CONFIG_SRCU=y +# CONFIG_TASKS_RCU is not set +CONFIG_RCU_STALL_COMMON=y +# CONFIG_TREE_RCU_TRACE is not set +# CONFIG_RCU_EXPEDITE_BOOT is not set +CONFIG_BUILD_BIN2C=y +CONFIG_IKCONFIG=m +CONFIG_IKCONFIG_PROC=y +CONFIG_LOG_BUF_SHIFT=16 +CONFIG_LOG_CPU_MAX_BUF_SHIFT=12 +CONFIG_HAVE_UNSTABLE_SCHED_CLOCK=y +CONFIG_ARCH_SUPPORTS_NUMA_BALANCING=y +CONFIG_ARCH_WANT_BATCHED_UNMAP_TLB_FLUSH=y +CONFIG_ARCH_SUPPORTS_INT128=y +CONFIG_NUMA_BALANCING=y +CONFIG_NUMA_BALANCING_DEFAULT_ENABLED=y +CONFIG_CGROUPS=y +CONFIG_PAGE_COUNTER=y +CONFIG_MEMCG=y +CONFIG_MEMCG_SWAP=y +CONFIG_MEMCG_SWAP_ENABLED=y +CONFIG_BLK_CGROUP=y +# CONFIG_DEBUG_BLK_CGROUP is not set +CONFIG_CGROUP_WRITEBACK=y +CONFIG_CGROUP_SCHED=y +CONFIG_FAIR_GROUP_SCHED=y +CONFIG_CFS_BANDWIDTH=y +CONFIG_RT_GROUP_SCHED=y +# CONFIG_CGROUP_PIDS is not set +CONFIG_CGROUP_FREEZER=y +CONFIG_CPUSETS=y +CONFIG_PROC_PID_CPUSET=y +CONFIG_CGROUP_DEVICE=y +CONFIG_CGROUP_CPUACCT=y +CONFIG_CGROUP_PERF=y +# CONFIG_CGROUP_DEBUG is not set +# CONFIG_CHECKPOINT_RESTORE is not set +CONFIG_NAMESPACES=y +CONFIG_UTS_NS=y +CONFIG_IPC_NS=y +# CONFIG_USER_NS is not set +CONFIG_PID_NS=y +CONFIG_NET_NS=y +# CONFIG_SCHED_AUTOGROUP is not set +# CONFIG_SYSFS_DEPRECATED is not set +CONFIG_RELAY=y +CONFIG_BLK_DEV_INITRD=y +CONFIG_INITRAMFS_SOURCE=" " +CONFIG_INITRAMFS_ROOT_UID=0 +CONFIG_INITRAMFS_ROOT_GID=0 +CONFIG_RD_GZIP=y +# CONFIG_RD_BZIP2 is not set +# CONFIG_RD_LZMA is not set +# CONFIG_RD_XZ is not set +# CONFIG_RD_LZO is not set +# CONFIG_RD_LZ4 is not set +CONFIG_CC_OPTIMIZE_FOR_SIZE=y +CONFIG_SYSCTL=y +CONFIG_ANON_INODES=y +CONFIG_HAVE_UID16=y +CONFIG_SYSCTL_EXCEPTION_TRACE=y +CONFIG_HAVE_PCSPKR_PLATFORM=y +CONFIG_BPF=y +CONFIG_EXPERT=y +# CONFIG_UID16 is not set +CONFIG_MULTIUSER=y +# CONFIG_SGETMASK_SYSCALL is not set +# CONFIG_SYSFS_SYSCALL is not set +# CONFIG_SYSCTL_SYSCALL is not set +CONFIG_KALLSYMS=y +# CONFIG_KALLSYMS_ALL is not set +CONFIG_KALLSYMS_ABSOLUTE_PERCPU=y +CONFIG_KALLSYMS_BASE_RELATIVE=y +CONFIG_PRINTK=y +CONFIG_BUG=y +CONFIG_ELF_CORE=y +# CONFIG_PCSPKR_PLATFORM is not set +CONFIG_BASE_FULL=y +CONFIG_FUTEX=y +CONFIG_EPOLL=y +CONFIG_SIGNALFD=y +CONFIG_TIMERFD=y +CONFIG_EVENTFD=y +# CONFIG_BPF_SYSCALL is not set +CONFIG_SHMEM=y +# CONFIG_AIO is not set +CONFIG_ADVISE_SYSCALLS=y +# CONFIG_USERFAULTFD is not set +CONFIG_PCI_QUIRKS=y +CONFIG_MEMBARRIER=y +# CONFIG_EMBEDDED is not set +CONFIG_HAVE_PERF_EVENTS=y + +# +# Kernel Performance Events And Counters +# +CONFIG_PERF_EVENTS=y +# CONFIG_DEBUG_PERF_USE_VMALLOC is not set +CONFIG_VM_EVENT_COUNTERS=y +CONFIG_SLUB_DEBUG=y +# CONFIG_COMPAT_BRK is not set +# CONFIG_SLAB is not set +CONFIG_SLUB=y +# CONFIG_SLOB is not set +CONFIG_SLUB_CPU_PARTIAL=y +# CONFIG_SYSTEM_DATA_VERIFICATION is not set +# CONFIG_PROFILING is not set +CONFIG_HAVE_OPROFILE=y +CONFIG_OPROFILE_NMI_TIMER=y +# CONFIG_KPROBES is not set +CONFIG_JUMP_LABEL=y +# CONFIG_STATIC_KEYS_SELFTEST is not set +# CONFIG_UPROBES is not set +# CONFIG_HAVE_64BIT_ALIGNED_ACCESS is not set +CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y +CONFIG_ARCH_USE_BUILTIN_BSWAP=y +CONFIG_HAVE_IOREMAP_PROT=y +CONFIG_HAVE_KPROBES=y +CONFIG_HAVE_KRETPROBES=y +CONFIG_HAVE_OPTPROBES=y +CONFIG_HAVE_KPROBES_ON_FTRACE=y +CONFIG_HAVE_ARCH_TRACEHOOK=y +CONFIG_HAVE_DMA_CONTIGUOUS=y +CONFIG_GENERIC_SMP_IDLE_THREAD=y +CONFIG_ARCH_WANTS_DYNAMIC_TASK_STRUCT=y +CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y +CONFIG_HAVE_CLK=y +CONFIG_HAVE_DMA_API_DEBUG=y +CONFIG_HAVE_HW_BREAKPOINT=y +CONFIG_HAVE_MIXED_BREAKPOINTS_REGS=y +CONFIG_HAVE_USER_RETURN_NOTIFIER=y +CONFIG_HAVE_PERF_EVENTS_NMI=y +CONFIG_HAVE_PERF_REGS=y +CONFIG_HAVE_PERF_USER_STACK_DUMP=y +CONFIG_HAVE_ARCH_JUMP_LABEL=y +CONFIG_ARCH_HAVE_NMI_SAFE_CMPXCHG=y +CONFIG_HAVE_ALIGNED_STRUCT_PAGE=y +CONFIG_HAVE_CMPXCHG_LOCAL=y +CONFIG_HAVE_CMPXCHG_DOUBLE=y +CONFIG_ARCH_WANT_COMPAT_IPC_PARSE_VERSION=y +CONFIG_ARCH_WANT_OLD_COMPAT_IPC=y +CONFIG_HAVE_ARCH_SECCOMP_FILTER=y +CONFIG_SECCOMP_FILTER=y +CONFIG_HAVE_CC_STACKPROTECTOR=y +# CONFIG_CC_STACKPROTECTOR is not set +CONFIG_CC_STACKPROTECTOR_NONE=y +# CONFIG_CC_STACKPROTECTOR_REGULAR is not set +# CONFIG_CC_STACKPROTECTOR_STRONG is not set +CONFIG_HAVE_CONTEXT_TRACKING=y +CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y +CONFIG_HAVE_IRQ_TIME_ACCOUNTING=y +CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE=y +CONFIG_HAVE_ARCH_HUGE_VMAP=y +CONFIG_HAVE_ARCH_SOFT_DIRTY=y +CONFIG_MODULES_USE_ELF_RELA=y +CONFIG_HAVE_IRQ_EXIT_ON_IRQ_STACK=y +CONFIG_ARCH_HAS_ELF_RANDOMIZE=y +CONFIG_HAVE_ARCH_MMAP_RND_BITS=y +CONFIG_ARCH_MMAP_RND_BITS=28 +CONFIG_HAVE_ARCH_MMAP_RND_COMPAT_BITS=y +CONFIG_ARCH_MMAP_RND_COMPAT_BITS=8 +CONFIG_HAVE_COPY_THREAD_TLS=y +CONFIG_HAVE_STACK_VALIDATION=y +CONFIG_OLD_SIGSUSPEND3=y +CONFIG_COMPAT_OLD_SIGACTION=y + +# +# GCOV-based kernel profiling +# +# CONFIG_GCOV_KERNEL is not set +CONFIG_ARCH_HAS_GCOV_PROFILE_ALL=y +# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set +CONFIG_SLABINFO=y +CONFIG_RT_MUTEXES=y +CONFIG_BASE_SMALL=0 +CONFIG_MODULES=y +# CONFIG_MODULE_FORCE_LOAD is not set +CONFIG_MODULE_UNLOAD=y +# CONFIG_MODULE_FORCE_UNLOAD is not set +# CONFIG_MODVERSIONS is not set +# CONFIG_MODULE_SRCVERSION_ALL is not set +# CONFIG_MODULE_SIG is not set +# CONFIG_MODULE_COMPRESS is not set +CONFIG_MODULES_TREE_LOOKUP=y +CONFIG_BLOCK=y +CONFIG_BLK_DEV_BSG=y +CONFIG_BLK_DEV_BSGLIB=y +# CONFIG_BLK_DEV_INTEGRITY is not set +# CONFIG_BLK_DEV_THROTTLING is not set +# CONFIG_BLK_CMDLINE_PARSER is not set + +# +# Partition Types +# +CONFIG_PARTITION_ADVANCED=y +# CONFIG_ACORN_PARTITION is not set +# CONFIG_AIX_PARTITION is not set +# CONFIG_OSF_PARTITION is not set +# CONFIG_AMIGA_PARTITION is not set +# CONFIG_ATARI_PARTITION is not set +CONFIG_MAC_PARTITION=y +CONFIG_MSDOS_PARTITION=y +# CONFIG_BSD_DISKLABEL is not set +# CONFIG_MINIX_SUBPARTITION is not set +# CONFIG_SOLARIS_X86_PARTITION is not set +# CONFIG_UNIXWARE_DISKLABEL is not set +CONFIG_LDM_PARTITION=y +# CONFIG_LDM_DEBUG is not set +# CONFIG_SGI_PARTITION is not set +# CONFIG_ULTRIX_PARTITION is not set +# CONFIG_SUN_PARTITION is not set +# CONFIG_KARMA_PARTITION is not set +CONFIG_EFI_PARTITION=y +# CONFIG_SYSV68_PARTITION is not set +# CONFIG_CMDLINE_PARTITION is not set +CONFIG_BLOCK_COMPAT=y + +# +# IO Schedulers +# +CONFIG_IOSCHED_NOOP=y +# CONFIG_IOSCHED_DEADLINE is not set +CONFIG_IOSCHED_CFQ=y +# CONFIG_CFQ_GROUP_IOSCHED is not set +CONFIG_DEFAULT_CFQ=y +# CONFIG_DEFAULT_NOOP is not set +CONFIG_DEFAULT_IOSCHED="cfq" +CONFIG_INLINE_SPIN_UNLOCK_IRQ=y +CONFIG_INLINE_READ_UNLOCK=y +CONFIG_INLINE_READ_UNLOCK_IRQ=y +CONFIG_INLINE_WRITE_UNLOCK=y +CONFIG_INLINE_WRITE_UNLOCK_IRQ=y +CONFIG_ARCH_SUPPORTS_ATOMIC_RMW=y +CONFIG_MUTEX_SPIN_ON_OWNER=y +CONFIG_RWSEM_SPIN_ON_OWNER=y +CONFIG_LOCK_SPIN_ON_OWNER=y +CONFIG_ARCH_USE_QUEUED_SPINLOCKS=y +CONFIG_QUEUED_SPINLOCKS=y +CONFIG_ARCH_USE_QUEUED_RWLOCKS=y +CONFIG_QUEUED_RWLOCKS=y +CONFIG_FREEZER=y + +# +# Processor type and features +# +CONFIG_ZONE_DMA=y +CONFIG_SMP=y +CONFIG_X86_FEATURE_NAMES=y +CONFIG_X86_FAST_FEATURE_TESTS=y +# CONFIG_X86_X2APIC is not set +CONFIG_X86_MPPARSE=y +# CONFIG_GOLDFISH is not set +# CONFIG_X86_EXTENDED_PLATFORM is not set +CONFIG_X86_INTEL_LPSS=y +CONFIG_X86_AMD_PLATFORM_DEVICE=y +CONFIG_IOSF_MBI=y +# CONFIG_IOSF_MBI_DEBUG is not set +CONFIG_SCHED_OMIT_FRAME_POINTER=y +CONFIG_HYPERVISOR_GUEST=y +CONFIG_PARAVIRT=y +# CONFIG_PARAVIRT_DEBUG is not set +CONFIG_PARAVIRT_SPINLOCKS=y +# CONFIG_QUEUED_LOCK_STAT is not set +# CONFIG_XEN is not set +CONFIG_KVM_GUEST=y +# CONFIG_KVM_DEBUG_FS is not set +CONFIG_PARAVIRT_TIME_ACCOUNTING=y +CONFIG_PARAVIRT_CLOCK=y +CONFIG_NO_BOOTMEM=y +# CONFIG_MK8 is not set +# CONFIG_MPSC is not set +# CONFIG_MCORE2 is not set +# CONFIG_MATOM is not set +CONFIG_GENERIC_CPU=y +CONFIG_X86_INTERNODE_CACHE_SHIFT=6 +CONFIG_X86_L1_CACHE_SHIFT=6 +CONFIG_X86_TSC=y +CONFIG_X86_CMPXCHG64=y +CONFIG_X86_CMOV=y +CONFIG_X86_MINIMUM_CPU_FAMILY=64 +CONFIG_X86_DEBUGCTLMSR=y +# CONFIG_PROCESSOR_SELECT is not set +CONFIG_CPU_SUP_INTEL=y +CONFIG_CPU_SUP_AMD=y +CONFIG_CPU_SUP_CENTAUR=y +CONFIG_HPET_TIMER=y +CONFIG_HPET_EMULATE_RTC=y +CONFIG_DMI=y +CONFIG_GART_IOMMU=y +# CONFIG_CALGARY_IOMMU is not set +CONFIG_SWIOTLB=y +CONFIG_IOMMU_HELPER=y +# CONFIG_MAXSMP is not set +CONFIG_NR_CPUS=16 +CONFIG_SCHED_SMT=y +CONFIG_SCHED_MC=y +# CONFIG_PREEMPT_NONE is not set +CONFIG_PREEMPT_VOLUNTARY=y +# CONFIG_PREEMPT is not set +CONFIG_X86_LOCAL_APIC=y +CONFIG_X86_IO_APIC=y +# CONFIG_X86_REROUTE_FOR_BROKEN_BOOT_IRQS is not set +# CONFIG_X86_MCE is not set +# CONFIG_VM86 is not set +CONFIG_X86_16BIT=y +CONFIG_X86_ESPFIX64=y +CONFIG_X86_VSYSCALL_EMULATION=y +# CONFIG_I8K is not set +CONFIG_MICROCODE=y +CONFIG_MICROCODE_INTEL=y +CONFIG_MICROCODE_AMD=y +CONFIG_MICROCODE_OLD_INTERFACE=y +# CONFIG_PERF_EVENTS_AMD_POWER is not set +CONFIG_X86_MSR=y +CONFIG_X86_CPUID=y +CONFIG_ARCH_PHYS_ADDR_T_64BIT=y +CONFIG_ARCH_DMA_ADDR_T_64BIT=y +CONFIG_X86_DIRECT_GBPAGES=y +CONFIG_NUMA=y +# CONFIG_AMD_NUMA is not set +CONFIG_X86_64_ACPI_NUMA=y +CONFIG_NODES_SPAN_OTHER_NODES=y +# CONFIG_NUMA_EMU is not set +CONFIG_NODES_SHIFT=6 +CONFIG_ARCH_SPARSEMEM_ENABLE=y +CONFIG_ARCH_SPARSEMEM_DEFAULT=y +CONFIG_ARCH_SELECT_MEMORY_MODEL=y +CONFIG_ARCH_PROC_KCORE_TEXT=y +CONFIG_ILLEGAL_POINTER_VALUE=0xdead000000000000 +CONFIG_SELECT_MEMORY_MODEL=y +CONFIG_SPARSEMEM_MANUAL=y +CONFIG_SPARSEMEM=y +CONFIG_NEED_MULTIPLE_NODES=y +CONFIG_HAVE_MEMORY_PRESENT=y +CONFIG_SPARSEMEM_EXTREME=y +CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y +CONFIG_SPARSEMEM_ALLOC_MEM_MAP_TOGETHER=y +CONFIG_SPARSEMEM_VMEMMAP=y +CONFIG_HAVE_MEMBLOCK=y +CONFIG_HAVE_MEMBLOCK_NODE_MAP=y +CONFIG_ARCH_DISCARD_MEMBLOCK=y +# CONFIG_MOVABLE_NODE is not set +# CONFIG_HAVE_BOOTMEM_INFO_NODE is not set +# CONFIG_MEMORY_HOTPLUG is not set +CONFIG_SPLIT_PTLOCK_CPUS=4 +CONFIG_ARCH_ENABLE_SPLIT_PMD_PTLOCK=y +CONFIG_MEMORY_BALLOON=y +CONFIG_BALLOON_COMPACTION=y +CONFIG_COMPACTION=y +CONFIG_MIGRATION=y +CONFIG_PHYS_ADDR_T_64BIT=y +CONFIG_ZONE_DMA_FLAG=1 +CONFIG_BOUNCE=y +CONFIG_VIRT_TO_BUS=y +CONFIG_MMU_NOTIFIER=y +# CONFIG_KSM is not set +CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 +CONFIG_TRANSPARENT_HUGEPAGE=y +# CONFIG_TRANSPARENT_HUGEPAGE_ALWAYS is not set +CONFIG_TRANSPARENT_HUGEPAGE_MADVISE=y +CONFIG_CLEANCACHE=y +# CONFIG_FRONTSWAP is not set +# CONFIG_CMA is not set +# CONFIG_ZPOOL is not set +# CONFIG_ZBUD is not set +# CONFIG_ZSMALLOC is not set +CONFIG_GENERIC_EARLY_IOREMAP=y +CONFIG_ARCH_SUPPORTS_DEFERRED_STRUCT_PAGE_INIT=y +# CONFIG_IDLE_PAGE_TRACKING is not set +CONFIG_FRAME_VECTOR=y +CONFIG_ARCH_USES_HIGH_VMA_FLAGS=y +CONFIG_ARCH_HAS_PKEYS=y +# CONFIG_X86_PMEM_LEGACY is not set +CONFIG_X86_CHECK_BIOS_CORRUPTION=y +CONFIG_X86_BOOTPARAM_MEMORY_CORRUPTION_CHECK=y +CONFIG_X86_RESERVE_LOW=64 +CONFIG_MTRR=y +CONFIG_MTRR_SANITIZER=y +CONFIG_MTRR_SANITIZER_ENABLE_DEFAULT=0 +CONFIG_MTRR_SANITIZER_SPARE_REG_NR_DEFAULT=1 +CONFIG_X86_PAT=y +CONFIG_ARCH_USES_PG_UNCACHED=y +CONFIG_ARCH_RANDOM=y +# CONFIG_X86_SMAP is not set +# CONFIG_X86_INTEL_MPX is not set +CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS=y +CONFIG_EFI=y +CONFIG_EFI_STUB=y +# CONFIG_EFI_MIXED is not set +CONFIG_SECCOMP=y +# CONFIG_HZ_100 is not set +# CONFIG_HZ_250 is not set +CONFIG_HZ_300=y +# CONFIG_HZ_1000 is not set +CONFIG_HZ=300 +CONFIG_SCHED_HRTICK=y +# CONFIG_KEXEC is not set +# CONFIG_KEXEC_FILE is not set +# CONFIG_CRASH_DUMP is not set +CONFIG_PHYSICAL_START=0x1000000 +CONFIG_RELOCATABLE=y +# CONFIG_RANDOMIZE_BASE is not set +CONFIG_PHYSICAL_ALIGN=0x1000000 +CONFIG_HOTPLUG_CPU=y +# CONFIG_BOOTPARAM_HOTPLUG_CPU0 is not set +# CONFIG_DEBUG_HOTPLUG_CPU0 is not set +# CONFIG_COMPAT_VDSO is not set +# CONFIG_LEGACY_VSYSCALL_NATIVE is not set +CONFIG_LEGACY_VSYSCALL_EMULATE=y +# CONFIG_LEGACY_VSYSCALL_NONE is not set +CONFIG_CMDLINE_BOOL=y +CONFIG_CMDLINE="root=/dev/ram0 rdinit=/init usbcore.autosuspend=-1" +# CONFIG_CMDLINE_OVERRIDE is not set +CONFIG_MODIFY_LDT_SYSCALL=y +CONFIG_HAVE_LIVEPATCH=y +CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y +CONFIG_USE_PERCPU_NUMA_NODE_ID=y + +# +# Power management and ACPI options +# +CONFIG_SUSPEND=y +CONFIG_SUSPEND_FREEZER=y +# CONFIG_SUSPEND_SKIP_SYNC is not set +# CONFIG_HIBERNATION is not set +CONFIG_PM_SLEEP=y +CONFIG_PM_SLEEP_SMP=y +# CONFIG_PM_AUTOSLEEP is not set +# CONFIG_PM_WAKELOCKS is not set +CONFIG_PM=y +CONFIG_PM_DEBUG=y +# CONFIG_PM_ADVANCED_DEBUG is not set +CONFIG_PM_TEST_SUSPEND=y +CONFIG_PM_SLEEP_DEBUG=y +# CONFIG_PM_TRACE_RTC is not set +CONFIG_PM_CLK=y +# CONFIG_WQ_POWER_EFFICIENT_DEFAULT is not set +CONFIG_ACPI=y +CONFIG_ACPI_LEGACY_TABLES_LOOKUP=y +CONFIG_ARCH_MIGHT_HAVE_ACPI_PDC=y +CONFIG_ACPI_SYSTEM_POWER_STATES_SUPPORT=y +# CONFIG_ACPI_DEBUGGER is not set +CONFIG_ACPI_SLEEP=y +# CONFIG_ACPI_PROCFS_POWER is not set +CONFIG_ACPI_REV_OVERRIDE_POSSIBLE=y +# CONFIG_ACPI_EC_DEBUGFS is not set +# CONFIG_ACPI_AC is not set +CONFIG_ACPI_BATTERY=y +CONFIG_ACPI_BUTTON=y +CONFIG_ACPI_VIDEO=y +CONFIG_ACPI_FAN=y +# CONFIG_ACPI_DOCK is not set +CONFIG_ACPI_CPU_FREQ_PSS=y +CONFIG_ACPI_PROCESSOR_IDLE=y +CONFIG_ACPI_PROCESSOR=y +CONFIG_ACPI_HOTPLUG_CPU=y +CONFIG_ACPI_PROCESSOR_AGGREGATOR=y +CONFIG_ACPI_THERMAL=y +CONFIG_ACPI_NUMA=y +# CONFIG_ACPI_CUSTOM_DSDT is not set +# CONFIG_ACPI_INITRD_TABLE_OVERRIDE is not set +# CONFIG_ACPI_DEBUG is not set +# CONFIG_ACPI_PCI_SLOT is not set +CONFIG_X86_PM_TIMER=y +CONFIG_ACPI_CONTAINER=y +CONFIG_ACPI_HOTPLUG_IOAPIC=y +# CONFIG_ACPI_SBS is not set +# CONFIG_ACPI_HED is not set +# CONFIG_ACPI_CUSTOM_METHOD is not set +# CONFIG_ACPI_BGRT is not set +# CONFIG_ACPI_REDUCED_HARDWARE_ONLY is not set +# CONFIG_ACPI_NFIT is not set +CONFIG_HAVE_ACPI_APEI=y +CONFIG_HAVE_ACPI_APEI_NMI=y +# CONFIG_ACPI_APEI is not set +# CONFIG_PMIC_OPREGION is not set +# CONFIG_SFI is not set + +# +# CPU Frequency scaling +# +CONFIG_CPU_FREQ=y +CONFIG_CPU_FREQ_GOV_COMMON=y +# CONFIG_CPU_FREQ_STAT is not set +# CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set +# CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE is not set +# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set +CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y +# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set +CONFIG_CPU_FREQ_GOV_PERFORMANCE=y +CONFIG_CPU_FREQ_GOV_POWERSAVE=y +# CONFIG_CPU_FREQ_GOV_USERSPACE is not set +CONFIG_CPU_FREQ_GOV_ONDEMAND=y +# CONFIG_CPU_FREQ_GOV_CONSERVATIVE is not set + +# +# CPU frequency scaling drivers +# +CONFIG_X86_INTEL_PSTATE=y +CONFIG_X86_PCC_CPUFREQ=m +CONFIG_X86_ACPI_CPUFREQ=y +CONFIG_X86_ACPI_CPUFREQ_CPB=y +CONFIG_X86_POWERNOW_K8=y +CONFIG_X86_AMD_FREQ_SENSITIVITY=m +# CONFIG_X86_SPEEDSTEP_CENTRINO is not set +CONFIG_X86_P4_CLOCKMOD=y + +# +# shared options +# +CONFIG_X86_SPEEDSTEP_LIB=y + +# +# CPU Idle +# +CONFIG_CPU_IDLE=y +CONFIG_CPU_IDLE_GOV_LADDER=y +CONFIG_CPU_IDLE_GOV_MENU=y +# CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED is not set +CONFIG_INTEL_IDLE=y + +# +# Memory power savings +# +# CONFIG_I7300_IDLE is not set + +# +# Bus options (PCI etc.) +# +CONFIG_PCI=y +CONFIG_PCI_DIRECT=y +CONFIG_PCI_MMCONFIG=y +CONFIG_PCI_DOMAINS=y +# CONFIG_PCI_CNB20LE_QUIRK is not set +CONFIG_PCIEPORTBUS=y +CONFIG_PCIEAER=y +# CONFIG_PCIE_ECRC is not set +# CONFIG_PCIEAER_INJECT is not set +CONFIG_PCIEASPM=y +# CONFIG_PCIEASPM_DEBUG is not set +CONFIG_PCIEASPM_DEFAULT=y +# CONFIG_PCIEASPM_POWERSAVE is not set +# CONFIG_PCIEASPM_PERFORMANCE is not set +CONFIG_PCIE_PME=y +CONFIG_PCI_BUS_ADDR_T_64BIT=y +CONFIG_PCI_MSI=y +CONFIG_PCI_MSI_IRQ_DOMAIN=y +# CONFIG_PCI_DEBUG is not set +# CONFIG_PCI_REALLOC_ENABLE_AUTO is not set +# CONFIG_PCI_STUB is not set +CONFIG_HT_IRQ=y +# CONFIG_PCI_IOV is not set +# CONFIG_PCI_PRI is not set +# CONFIG_PCI_PASID is not set +CONFIG_PCI_LABEL=y +# CONFIG_HOTPLUG_PCI is not set + +# +# PCI host controller drivers +# +# CONFIG_PCIE_DW_PLAT is not set +CONFIG_ISA_DMA_API=y +CONFIG_AMD_NB=y +# CONFIG_PCCARD is not set +# CONFIG_RAPIDIO is not set +# CONFIG_X86_SYSFB is not set + +# +# Executable file formats / Emulations +# +CONFIG_BINFMT_ELF=y +CONFIG_COMPAT_BINFMT_ELF=y +CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS=y +CONFIG_BINFMT_SCRIPT=y +# CONFIG_HAVE_AOUT is not set +CONFIG_BINFMT_MISC=y +CONFIG_COREDUMP=y +CONFIG_IA32_EMULATION=y +# CONFIG_IA32_AOUT is not set +# CONFIG_X86_X32 is not set +CONFIG_COMPAT=y +CONFIG_COMPAT_FOR_U64_ALIGNMENT=y +CONFIG_SYSVIPC_COMPAT=y +CONFIG_KEYS_COMPAT=y +CONFIG_X86_DEV_DMA_OPS=y +CONFIG_PMC_ATOM=y +# CONFIG_VMD is not set +CONFIG_NET=y +CONFIG_COMPAT_NETLINK_MESSAGES=y + +# +# Networking options +# +CONFIG_PACKET=y +# CONFIG_PACKET_DIAG is not set +CONFIG_UNIX=y +# CONFIG_UNIX_DIAG is not set +# CONFIG_XFRM_USER is not set +# CONFIG_NET_KEY is not set +CONFIG_INET=y +CONFIG_IP_MULTICAST=y +# CONFIG_IP_ADVANCED_ROUTER is not set +CONFIG_IP_PNP=y +CONFIG_IP_PNP_DHCP=y +CONFIG_IP_PNP_BOOTP=y +# CONFIG_IP_PNP_RARP is not set +# CONFIG_NET_IPIP is not set +# CONFIG_NET_IPGRE_DEMUX is not set +CONFIG_NET_IP_TUNNEL=m +CONFIG_IP_MROUTE=y +# CONFIG_IP_PIMSM_V1 is not set +# CONFIG_IP_PIMSM_V2 is not set +# CONFIG_SYN_COOKIES is not set +# CONFIG_NET_UDP_TUNNEL is not set +# CONFIG_NET_FOU is not set +# CONFIG_NET_FOU_IP_TUNNELS is not set +# CONFIG_INET_AH is not set +# CONFIG_INET_ESP is not set +# CONFIG_INET_IPCOMP is not set +# CONFIG_INET_XFRM_TUNNEL is not set +CONFIG_INET_TUNNEL=m +# CONFIG_INET_XFRM_MODE_TRANSPORT is not set +# CONFIG_INET_XFRM_MODE_TUNNEL is not set +# CONFIG_INET_XFRM_MODE_BEET is not set +# CONFIG_INET_DIAG is not set +# CONFIG_TCP_CONG_ADVANCED is not set +CONFIG_TCP_CONG_CUBIC=y +CONFIG_DEFAULT_TCP_CONG="cubic" +# CONFIG_TCP_MD5SIG is not set +CONFIG_IPV6=y +# CONFIG_IPV6_ROUTER_PREF is not set +# CONFIG_IPV6_OPTIMISTIC_DAD is not set +# CONFIG_INET6_AH is not set +# CONFIG_INET6_ESP is not set +# CONFIG_INET6_IPCOMP is not set +# CONFIG_IPV6_MIP6 is not set +# CONFIG_IPV6_ILA is not set +# CONFIG_INET6_XFRM_TUNNEL is not set +# CONFIG_INET6_TUNNEL is not set +# CONFIG_INET6_XFRM_MODE_TRANSPORT is not set +# CONFIG_INET6_XFRM_MODE_TUNNEL is not set +# CONFIG_INET6_XFRM_MODE_BEET is not set +# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set +CONFIG_IPV6_SIT=m +# CONFIG_IPV6_SIT_6RD is not set +CONFIG_IPV6_NDISC_NODETYPE=y +# CONFIG_IPV6_TUNNEL is not set +# CONFIG_IPV6_GRE is not set +# CONFIG_IPV6_MULTIPLE_TABLES is not set +# CONFIG_IPV6_MROUTE is not set +# CONFIG_NETWORK_SECMARK is not set +CONFIG_NET_PTP_CLASSIFY=y +# CONFIG_NETWORK_PHY_TIMESTAMPING is not set +CONFIG_NETFILTER=y +# CONFIG_NETFILTER_DEBUG is not set +CONFIG_NETFILTER_ADVANCED=y +CONFIG_BRIDGE_NETFILTER=m + +# +# Core Netfilter Configuration +# +# CONFIG_NETFILTER_INGRESS is not set +CONFIG_NETFILTER_NETLINK=m +# CONFIG_NETFILTER_NETLINK_ACCT is not set +# CONFIG_NETFILTER_NETLINK_QUEUE is not set +CONFIG_NETFILTER_NETLINK_LOG=m +CONFIG_NF_CONNTRACK=m +# CONFIG_NF_CONNTRACK_MARK is not set +# CONFIG_NF_CONNTRACK_PROCFS is not set +# CONFIG_NF_CONNTRACK_EVENTS is not set +# CONFIG_NF_CONNTRACK_TIMEOUT is not set +# CONFIG_NF_CONNTRACK_TIMESTAMP is not set +# CONFIG_NF_CT_PROTO_DCCP is not set +# CONFIG_NF_CT_PROTO_SCTP is not set +# CONFIG_NF_CT_PROTO_UDPLITE is not set +# CONFIG_NF_CONNTRACK_AMANDA is not set +CONFIG_NF_CONNTRACK_FTP=m +# CONFIG_NF_CONNTRACK_H323 is not set +CONFIG_NF_CONNTRACK_IRC=m +CONFIG_NF_CONNTRACK_BROADCAST=m +CONFIG_NF_CONNTRACK_NETBIOS_NS=m +# CONFIG_NF_CONNTRACK_SNMP is not set +# CONFIG_NF_CONNTRACK_PPTP is not set +# CONFIG_NF_CONNTRACK_SANE is not set +CONFIG_NF_CONNTRACK_SIP=m +# CONFIG_NF_CONNTRACK_TFTP is not set +CONFIG_NF_CT_NETLINK=m +# CONFIG_NF_CT_NETLINK_TIMEOUT is not set +# CONFIG_NETFILTER_NETLINK_GLUE_CT is not set +CONFIG_NF_NAT=m +CONFIG_NF_NAT_NEEDED=y +# CONFIG_NF_NAT_AMANDA is not set +CONFIG_NF_NAT_FTP=m +CONFIG_NF_NAT_IRC=m +CONFIG_NF_NAT_SIP=m +# CONFIG_NF_NAT_TFTP is not set +# CONFIG_NF_NAT_REDIRECT is not set +# CONFIG_NF_TABLES is not set +CONFIG_NETFILTER_XTABLES=m + +# +# Xtables combined modules +# +# CONFIG_NETFILTER_XT_MARK is not set +# CONFIG_NETFILTER_XT_CONNMARK is not set + +# +# Xtables targets +# +# CONFIG_NETFILTER_XT_TARGET_CHECKSUM is not set +# CONFIG_NETFILTER_XT_TARGET_CLASSIFY is not set +# CONFIG_NETFILTER_XT_TARGET_CONNMARK is not set +# CONFIG_NETFILTER_XT_TARGET_DSCP is not set +# CONFIG_NETFILTER_XT_TARGET_HL is not set +# CONFIG_NETFILTER_XT_TARGET_HMARK is not set +# CONFIG_NETFILTER_XT_TARGET_IDLETIMER is not set +# CONFIG_NETFILTER_XT_TARGET_LED is not set +# CONFIG_NETFILTER_XT_TARGET_LOG is not set +# CONFIG_NETFILTER_XT_TARGET_MARK is not set +CONFIG_NETFILTER_XT_NAT=m +# CONFIG_NETFILTER_XT_TARGET_NETMAP is not set +# CONFIG_NETFILTER_XT_TARGET_NFLOG is not set +# CONFIG_NETFILTER_XT_TARGET_NFQUEUE is not set +# CONFIG_NETFILTER_XT_TARGET_RATEEST is not set +# CONFIG_NETFILTER_XT_TARGET_REDIRECT is not set +# CONFIG_NETFILTER_XT_TARGET_TEE is not set +# CONFIG_NETFILTER_XT_TARGET_TPROXY is not set +# CONFIG_NETFILTER_XT_TARGET_TCPMSS is not set +# CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP is not set + +# +# Xtables matches +# +CONFIG_NETFILTER_XT_MATCH_ADDRTYPE=m +# CONFIG_NETFILTER_XT_MATCH_BPF is not set +# CONFIG_NETFILTER_XT_MATCH_CGROUP is not set +# CONFIG_NETFILTER_XT_MATCH_CLUSTER is not set +# CONFIG_NETFILTER_XT_MATCH_COMMENT is not set +# CONFIG_NETFILTER_XT_MATCH_CONNBYTES is not set +# CONFIG_NETFILTER_XT_MATCH_CONNLABEL is not set +# CONFIG_NETFILTER_XT_MATCH_CONNLIMIT is not set +# CONFIG_NETFILTER_XT_MATCH_CONNMARK is not set +CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m +# CONFIG_NETFILTER_XT_MATCH_CPU is not set +# CONFIG_NETFILTER_XT_MATCH_DCCP is not set +# CONFIG_NETFILTER_XT_MATCH_DEVGROUP is not set +# CONFIG_NETFILTER_XT_MATCH_DSCP is not set +# CONFIG_NETFILTER_XT_MATCH_ECN is not set +# CONFIG_NETFILTER_XT_MATCH_ESP is not set +# CONFIG_NETFILTER_XT_MATCH_HASHLIMIT is not set +# CONFIG_NETFILTER_XT_MATCH_HELPER is not set +# CONFIG_NETFILTER_XT_MATCH_HL is not set +# CONFIG_NETFILTER_XT_MATCH_IPCOMP is not set +CONFIG_NETFILTER_XT_MATCH_IPRANGE=m +# CONFIG_NETFILTER_XT_MATCH_L2TP is not set +# CONFIG_NETFILTER_XT_MATCH_LENGTH is not set +# CONFIG_NETFILTER_XT_MATCH_LIMIT is not set +# CONFIG_NETFILTER_XT_MATCH_MAC is not set +# CONFIG_NETFILTER_XT_MATCH_MARK is not set +# CONFIG_NETFILTER_XT_MATCH_MULTIPORT is not set +# CONFIG_NETFILTER_XT_MATCH_NFACCT is not set +# CONFIG_NETFILTER_XT_MATCH_OSF is not set +CONFIG_NETFILTER_XT_MATCH_OWNER=m +# CONFIG_NETFILTER_XT_MATCH_PHYSDEV is not set +# CONFIG_NETFILTER_XT_MATCH_PKTTYPE is not set +# CONFIG_NETFILTER_XT_MATCH_QUOTA is not set +# CONFIG_NETFILTER_XT_MATCH_RATEEST is not set +# CONFIG_NETFILTER_XT_MATCH_REALM is not set +# CONFIG_NETFILTER_XT_MATCH_RECENT is not set +# CONFIG_NETFILTER_XT_MATCH_SCTP is not set +# CONFIG_NETFILTER_XT_MATCH_SOCKET is not set +CONFIG_NETFILTER_XT_MATCH_STATE=m +# CONFIG_NETFILTER_XT_MATCH_STATISTIC is not set +# CONFIG_NETFILTER_XT_MATCH_STRING is not set +# CONFIG_NETFILTER_XT_MATCH_TCPMSS is not set +# CONFIG_NETFILTER_XT_MATCH_TIME is not set +# CONFIG_NETFILTER_XT_MATCH_U32 is not set +# CONFIG_IP_SET is not set +# CONFIG_IP_VS is not set + +# +# IP: Netfilter Configuration +# +CONFIG_NF_DEFRAG_IPV4=m +CONFIG_NF_CONNTRACK_IPV4=m +# CONFIG_NF_DUP_IPV4 is not set +# CONFIG_NF_LOG_ARP is not set +# CONFIG_NF_LOG_IPV4 is not set +CONFIG_NF_REJECT_IPV4=m +CONFIG_NF_NAT_IPV4=m +CONFIG_NF_NAT_MASQUERADE_IPV4=m +# CONFIG_NF_NAT_PPTP is not set +# CONFIG_NF_NAT_H323 is not set +CONFIG_IP_NF_IPTABLES=m +# CONFIG_IP_NF_MATCH_AH is not set +# CONFIG_IP_NF_MATCH_ECN is not set +# CONFIG_IP_NF_MATCH_RPFILTER is not set +# CONFIG_IP_NF_MATCH_TTL is not set +CONFIG_IP_NF_FILTER=m +CONFIG_IP_NF_TARGET_REJECT=m +# CONFIG_IP_NF_TARGET_SYNPROXY is not set +CONFIG_IP_NF_NAT=m +CONFIG_IP_NF_TARGET_MASQUERADE=m +# CONFIG_IP_NF_TARGET_NETMAP is not set +# CONFIG_IP_NF_TARGET_REDIRECT is not set +CONFIG_IP_NF_MANGLE=m +# CONFIG_IP_NF_TARGET_CLUSTERIP is not set +# CONFIG_IP_NF_TARGET_ECN is not set +# CONFIG_IP_NF_TARGET_TTL is not set +# CONFIG_IP_NF_RAW is not set +# CONFIG_IP_NF_ARPTABLES is not set + +# +# IPv6: Netfilter Configuration +# +CONFIG_NF_DEFRAG_IPV6=m +CONFIG_NF_CONNTRACK_IPV6=m +# CONFIG_NF_DUP_IPV6 is not set +CONFIG_NF_REJECT_IPV6=m +# CONFIG_NF_LOG_IPV6 is not set +CONFIG_NF_NAT_IPV6=m +# CONFIG_NF_NAT_MASQUERADE_IPV6 is not set +CONFIG_IP6_NF_IPTABLES=m +# CONFIG_IP6_NF_MATCH_AH is not set +# CONFIG_IP6_NF_MATCH_EUI64 is not set +# CONFIG_IP6_NF_MATCH_FRAG is not set +# CONFIG_IP6_NF_MATCH_OPTS is not set +# CONFIG_IP6_NF_MATCH_HL is not set +# CONFIG_IP6_NF_MATCH_IPV6HEADER is not set +# CONFIG_IP6_NF_MATCH_MH is not set +# CONFIG_IP6_NF_MATCH_RPFILTER is not set +# CONFIG_IP6_NF_MATCH_RT is not set +# CONFIG_IP6_NF_TARGET_HL is not set +CONFIG_IP6_NF_FILTER=m +CONFIG_IP6_NF_TARGET_REJECT=m +# CONFIG_IP6_NF_TARGET_SYNPROXY is not set +CONFIG_IP6_NF_MANGLE=m +# CONFIG_IP6_NF_RAW is not set +CONFIG_IP6_NF_NAT=m +# CONFIG_IP6_NF_TARGET_MASQUERADE is not set +# CONFIG_IP6_NF_TARGET_NPT is not set +# CONFIG_BRIDGE_NF_EBTABLES is not set +# CONFIG_IP_DCCP is not set +# CONFIG_IP_SCTP is not set +# CONFIG_RDS is not set +# CONFIG_TIPC is not set +# CONFIG_ATM is not set +# CONFIG_L2TP is not set +CONFIG_STP=m +CONFIG_BRIDGE=m +CONFIG_BRIDGE_IGMP_SNOOPING=y +# CONFIG_BRIDGE_VLAN_FILTERING is not set +CONFIG_HAVE_NET_DSA=y +CONFIG_VLAN_8021Q=m +# CONFIG_VLAN_8021Q_GVRP is not set +# CONFIG_VLAN_8021Q_MVRP is not set +# CONFIG_DECNET is not set +CONFIG_LLC=m +# CONFIG_LLC2 is not set +# CONFIG_IPX is not set +# CONFIG_ATALK is not set +# CONFIG_X25 is not set +# CONFIG_LAPB is not set +# CONFIG_PHONET is not set +# CONFIG_6LOWPAN is not set +# CONFIG_IEEE802154 is not set +# CONFIG_NET_SCHED is not set +# CONFIG_DCB is not set +CONFIG_DNS_RESOLVER=y +# CONFIG_BATMAN_ADV is not set +# CONFIG_OPENVSWITCH is not set +# CONFIG_VSOCKETS is not set +# CONFIG_NETLINK_DIAG is not set +# CONFIG_MPLS is not set +# CONFIG_HSR is not set +# CONFIG_NET_SWITCHDEV is not set +# CONFIG_NET_L3_MASTER_DEV is not set +CONFIG_RPS=y +CONFIG_RFS_ACCEL=y +CONFIG_XPS=y +# CONFIG_SOCK_CGROUP_DATA is not set +# CONFIG_CGROUP_NET_PRIO is not set +# CONFIG_CGROUP_NET_CLASSID is not set +CONFIG_NET_RX_BUSY_POLL=y +CONFIG_BQL=y +# CONFIG_BPF_JIT is not set +CONFIG_NET_FLOW_LIMIT=y + +# +# Network testing +# +# CONFIG_NET_PKTGEN is not set +# CONFIG_HAMRADIO is not set +# CONFIG_CAN is not set +# CONFIG_IRDA is not set +CONFIG_BT=m +CONFIG_BT_BREDR=y +CONFIG_BT_RFCOMM=m +CONFIG_BT_RFCOMM_TTY=y +CONFIG_BT_BNEP=m +CONFIG_BT_BNEP_MC_FILTER=y +CONFIG_BT_BNEP_PROTO_FILTER=y +CONFIG_BT_HIDP=m +CONFIG_BT_HS=y +CONFIG_BT_LE=y +# CONFIG_BT_LEDS is not set +# CONFIG_BT_SELFTEST is not set +# CONFIG_BT_DEBUGFS is not set + +# +# Bluetooth device drivers +# +CONFIG_BT_INTEL=m +CONFIG_BT_BCM=m +CONFIG_BT_RTL=m +CONFIG_BT_HCIBTUSB=m +CONFIG_BT_HCIBTUSB_BCM=y +CONFIG_BT_HCIBTUSB_RTL=y +# CONFIG_BT_HCIBTSDIO is not set +# CONFIG_BT_HCIUART is not set +# CONFIG_BT_HCIBCM203X is not set +# CONFIG_BT_HCIBFUSB is not set +# CONFIG_BT_HCIVHCI is not set +# CONFIG_BT_MRVL is not set +CONFIG_BT_ATH3K=m +# CONFIG_AF_RXRPC is not set +# CONFIG_AF_KCM is not set +CONFIG_WIRELESS=y +CONFIG_WIRELESS_EXT=y +CONFIG_WEXT_CORE=y +CONFIG_WEXT_PROC=y +CONFIG_WEXT_SPY=y +CONFIG_WEXT_PRIV=y +CONFIG_CFG80211=m +# CONFIG_NL80211_TESTMODE is not set +# CONFIG_CFG80211_DEVELOPER_WARNINGS is not set +# CONFIG_CFG80211_CERTIFICATION_ONUS is not set +CONFIG_CFG80211_DEFAULT_PS=y +# CONFIG_CFG80211_DEBUGFS is not set +CONFIG_CFG80211_INTERNAL_REGDB=y +# CONFIG_CFG80211_CRDA_SUPPORT is not set +CONFIG_CFG80211_WEXT=y +CONFIG_CFG80211_WEXT_EXPORT=y +CONFIG_LIB80211=m +CONFIG_LIB80211_CRYPT_WEP=m +CONFIG_LIB80211_CRYPT_CCMP=m +CONFIG_LIB80211_CRYPT_TKIP=m +# CONFIG_LIB80211_DEBUG is not set +CONFIG_MAC80211=m +CONFIG_MAC80211_HAS_RC=y +CONFIG_MAC80211_RC_MINSTREL=y +CONFIG_MAC80211_RC_MINSTREL_HT=y +CONFIG_MAC80211_RC_MINSTREL_VHT=y +CONFIG_MAC80211_RC_DEFAULT_MINSTREL=y +CONFIG_MAC80211_RC_DEFAULT="minstrel_ht" +# CONFIG_MAC80211_MESH is not set +CONFIG_MAC80211_LEDS=y +# CONFIG_MAC80211_DEBUGFS is not set +# CONFIG_MAC80211_MESSAGE_TRACING is not set +# CONFIG_MAC80211_DEBUG_MENU is not set +CONFIG_MAC80211_STA_HASH_MAX_SIZE=0 +# CONFIG_WIMAX is not set +# CONFIG_RFKILL is not set +# CONFIG_NET_9P is not set +# CONFIG_CAIF is not set +# CONFIG_CEPH_LIB is not set +# CONFIG_NFC is not set +# CONFIG_LWTUNNEL is not set +CONFIG_DST_CACHE=y +# CONFIG_NET_DEVLINK is not set +CONFIG_MAY_USE_DEVLINK=y +CONFIG_HAVE_BPF_JIT=y + +# +# Device Drivers +# + +# +# Generic Driver Options +# +# CONFIG_UEVENT_HELPER is not set +CONFIG_DEVTMPFS=y +CONFIG_DEVTMPFS_MOUNT=y +CONFIG_STANDALONE=y +# CONFIG_PREVENT_FIRMWARE_BUILD is not set +CONFIG_FW_LOADER=y +CONFIG_FIRMWARE_IN_KERNEL=y +CONFIG_EXTRA_FIRMWARE="amdgpu/carrizo_ce.bin amdgpu/carrizo_me.bin amdgpu/carrizo_mec2.bin amdgpu/carrizo_mec.bin amdgpu/carrizo_pfp.bin amdgpu/carrizo_rlc.bin amdgpu/carrizo_sdma1.bin amdgpu/carrizo_sdma.bin amdgpu/carrizo_uvd.bin amdgpu/carrizo_vce.bin amdgpu/fiji_ce.bin amdgpu/fiji_mc.bin amdgpu/fiji_me.bin amdgpu/fiji_mec2.bin amdgpu/fiji_mec.bin amdgpu/fiji_pfp.bin amdgpu/fiji_rlc.bin amdgpu/fiji_sdma1.bin amdgpu/fiji_sdma.bin amdgpu/fiji_smc.bin amdgpu/fiji_uvd.bin amdgpu/fiji_vce.bin amdgpu/polaris10_ce.bin amdgpu/polaris10_mc.bin amdgpu/polaris10_me.bin amdgpu/polaris10_mec2.bin amdgpu/polaris10_mec.bin amdgpu/polaris10_pfp.bin amdgpu/polaris10_rlc.bin amdgpu/polaris10_sdma1.bin amdgpu/polaris10_sdma.bin amdgpu/polaris10_smc.bin amdgpu/polaris10_smc_sk.bin amdgpu/polaris10_uvd.bin amdgpu/polaris10_vce.bin amdgpu/polaris11_ce.bin amdgpu/polaris11_mc.bin amdgpu/polaris11_me.bin amdgpu/polaris11_mec2.bin amdgpu/polaris11_mec.bin amdgpu/polaris11_pfp.bin amdgpu/polaris11_rlc.bin amdgpu/polaris11_sdma1.bin amdgpu/polaris11_sdma.bin amdgpu/polaris11_smc.bin amdgpu/polaris11_smc_sk.bin amdgpu/polaris11_uvd.bin amdgpu/polaris11_vce.bin amdgpu/stoney_ce.bin amdgpu/stoney_me.bin amdgpu/stoney_mec.bin amdgpu/stoney_pfp.bin amdgpu/stoney_rlc.bin amdgpu/stoney_sdma.bin amdgpu/stoney_uvd.bin amdgpu/stoney_vce.bin amdgpu/tonga_ce.bin amdgpu/tonga_mc.bin amdgpu/tonga_me.bin amdgpu/tonga_mec2.bin amdgpu/tonga_mec.bin amdgpu/tonga_pfp.bin amdgpu/tonga_rlc.bin amdgpu/tonga_sdma1.bin amdgpu/tonga_sdma.bin amdgpu/tonga_smc.bin amdgpu/tonga_uvd.bin amdgpu/tonga_vce.bin amdgpu/topaz_ce.bin amdgpu/topaz_mc.bin amdgpu/topaz_me.bin amdgpu/topaz_mec2.bin amdgpu/topaz_mec.bin amdgpu/topaz_pfp.bin amdgpu/topaz_rlc.bin amdgpu/topaz_sdma1.bin amdgpu/topaz_sdma.bin amdgpu/topaz_smc.bin i915/bxt_dmc_ver1_04.bin i915/bxt_dmc_ver1_05.bin i915/bxt_dmc_ver1_06.bin i915/bxt_dmc_ver1.bin i915/skl_dmc_ver1_21.bin i915/skl_dmc_ver1_22.bin i915/skl_dmc_ver1.bin i915/skl_guc_ver1_1059.bin i915/skl_guc_ver1.bin i915/skl_guc_ver4_3.bin i915/skl_guc_ver4.bin radeon/ARUBA_me.bin radeon/ARUBA_pfp.bin radeon/ARUBA_rlc.bin radeon/BARTS_mc.bin radeon/BARTS_me.bin radeon/BARTS_pfp.bin radeon/BARTS_smc.bin radeon/BONAIRE_ce.bin radeon/bonaire_ce.bin radeon/BONAIRE_mc2.bin radeon/BONAIRE_mc.bin radeon/bonaire_mc.bin radeon/BONAIRE_me.bin radeon/bonaire_me.bin radeon/BONAIRE_mec.bin radeon/bonaire_mec.bin radeon/BONAIRE_pfp.bin radeon/bonaire_pfp.bin radeon/BONAIRE_rlc.bin radeon/bonaire_rlc.bin radeon/bonaire_sdma1.bin radeon/BONAIRE_sdma.bin radeon/bonaire_sdma.bin radeon/BONAIRE_smc.bin radeon/bonaire_smc.bin radeon/BONAIRE_uvd.bin radeon/bonaire_uvd.bin radeon/BONAIRE_vce.bin radeon/bonaire_vce.bin radeon/BTC_rlc.bin radeon/CAICOS_mc.bin radeon/CAICOS_me.bin radeon/CAICOS_pfp.bin radeon/CAICOS_smc.bin radeon/CAYMAN_mc.bin radeon/CAYMAN_me.bin radeon/CAYMAN_pfp.bin radeon/CAYMAN_rlc.bin radeon/CAYMAN_smc.bin radeon/CEDAR_me.bin radeon/CEDAR_pfp.bin radeon/CEDAR_rlc.bin radeon/CEDAR_smc.bin radeon/CYPRESS_me.bin radeon/CYPRESS_pfp.bin radeon/CYPRESS_rlc.bin radeon/CYPRESS_smc.bin radeon/CYPRESS_uvd.bin radeon/HAINAN_ce.bin radeon/hainan_ce.bin radeon/HAINAN_mc2.bin radeon/HAINAN_mc.bin radeon/hainan_mc.bin radeon/HAINAN_me.bin radeon/hainan_me.bin radeon/HAINAN_pfp.bin radeon/hainan_pfp.bin radeon/HAINAN_rlc.bin radeon/hainan_rlc.bin radeon/HAINAN_smc.bin radeon/hainan_smc.bin radeon/HAWAII_ce.bin radeon/hawaii_ce.bin radeon/HAWAII_mc2.bin radeon/HAWAII_mc.bin radeon/hawaii_mc.bin radeon/HAWAII_me.bin radeon/hawaii_me.bin radeon/HAWAII_mec.bin radeon/hawaii_mec.bin radeon/HAWAII_pfp.bin radeon/hawaii_pfp.bin radeon/HAWAII_rlc.bin radeon/hawaii_rlc.bin radeon/hawaii_sdma1.bin radeon/HAWAII_sdma.bin radeon/hawaii_sdma.bin radeon/HAWAII_smc.bin radeon/hawaii_smc.bin radeon/hawaii_uvd.bin radeon/hawaii_vce.bin radeon/JUNIPER_me.bin radeon/JUNIPER_pfp.bin radeon/JUNIPER_rlc.bin radeon/JUNIPER_smc.bin radeon/KABINI_ce.bin radeon/kabini_ce.bin radeon/KABINI_me.bin radeon/kabini_me.bin radeon/KABINI_mec.bin radeon/kabini_mec.bin radeon/KABINI_pfp.bin radeon/kabini_pfp.bin radeon/KABINI_rlc.bin radeon/kabini_rlc.bin radeon/kabini_sdma1.bin radeon/KABINI_sdma.bin radeon/kabini_sdma.bin radeon/kabini_uvd.bin radeon/kabini_vce.bin radeon/KAVERI_ce.bin radeon/kaveri_ce.bin radeon/KAVERI_me.bin radeon/kaveri_me.bin radeon/kaveri_mec2.bin radeon/KAVERI_mec.bin radeon/kaveri_mec.bin radeon/KAVERI_pfp.bin radeon/kaveri_pfp.bin radeon/KAVERI_rlc.bin radeon/kaveri_rlc.bin radeon/kaveri_sdma1.bin radeon/KAVERI_sdma.bin radeon/kaveri_sdma.bin radeon/kaveri_uvd.bin radeon/kaveri_vce.bin radeon/LICENSE.radeon radeon/MULLINS_ce.bin radeon/mullins_ce.bin radeon/MULLINS_me.bin radeon/mullins_me.bin radeon/MULLINS_mec.bin radeon/mullins_mec.bin radeon/MULLINS_pfp.bin radeon/mullins_pfp.bin radeon/MULLINS_rlc.bin radeon/mullins_rlc.bin radeon/mullins_sdma1.bin radeon/MULLINS_sdma.bin radeon/mullins_sdma.bin radeon/mullins_uvd.bin radeon/mullins_vce.bin radeon/OLAND_ce.bin radeon/oland_ce.bin radeon/OLAND_mc2.bin radeon/OLAND_mc.bin radeon/oland_mc.bin radeon/OLAND_me.bin radeon/oland_me.bin radeon/OLAND_pfp.bin radeon/oland_pfp.bin radeon/OLAND_rlc.bin radeon/oland_rlc.bin radeon/OLAND_smc.bin radeon/oland_smc.bin radeon/PALM_me.bin radeon/PALM_pfp.bin radeon/PITCAIRN_ce.bin radeon/pitcairn_ce.bin radeon/PITCAIRN_mc2.bin radeon/PITCAIRN_mc.bin radeon/pitcairn_mc.bin radeon/PITCAIRN_me.bin radeon/pitcairn_me.bin radeon/PITCAIRN_pfp.bin radeon/pitcairn_pfp.bin radeon/PITCAIRN_rlc.bin radeon/pitcairn_rlc.bin radeon/PITCAIRN_smc.bin radeon/pitcairn_smc.bin radeon/R100_cp.bin radeon/R200_cp.bin radeon/R300_cp.bin radeon/R420_cp.bin radeon/R520_cp.bin radeon/R600_me.bin radeon/R600_pfp.bin radeon/R600_rlc.bin radeon/R600_uvd.bin radeon/R700_rlc.bin radeon/REDWOOD_me.bin radeon/REDWOOD_pfp.bin radeon/REDWOOD_rlc.bin radeon/REDWOOD_smc.bin radeon/RS600_cp.bin radeon/RS690_cp.bin radeon/RS780_me.bin radeon/RS780_pfp.bin radeon/RS780_uvd.bin radeon/RV610_me.bin radeon/RV610_pfp.bin radeon/RV620_me.bin radeon/RV620_pfp.bin radeon/RV630_me.bin radeon/RV630_pfp.bin radeon/RV635_me.bin radeon/RV635_pfp.bin radeon/RV670_me.bin radeon/RV670_pfp.bin radeon/RV710_me.bin radeon/RV710_pfp.bin radeon/RV710_smc.bin radeon/RV710_uvd.bin radeon/RV730_me.bin radeon/RV730_pfp.bin radeon/RV730_smc.bin radeon/RV740_smc.bin radeon/RV770_me.bin radeon/RV770_pfp.bin radeon/RV770_smc.bin radeon/RV770_uvd.bin radeon/SUMO2_me.bin radeon/SUMO2_pfp.bin radeon/SUMO_me.bin radeon/SUMO_pfp.bin radeon/SUMO_rlc.bin radeon/SUMO_uvd.bin radeon/TAHITI_ce.bin radeon/tahiti_ce.bin radeon/TAHITI_mc2.bin radeon/TAHITI_mc.bin radeon/tahiti_mc.bin radeon/TAHITI_me.bin radeon/tahiti_me.bin radeon/TAHITI_pfp.bin radeon/tahiti_pfp.bin radeon/TAHITI_rlc.bin radeon/tahiti_rlc.bin radeon/TAHITI_smc.bin radeon/tahiti_smc.bin radeon/TAHITI_uvd.bin radeon/TAHITI_vce.bin radeon/TURKS_mc.bin radeon/TURKS_me.bin radeon/TURKS_pfp.bin radeon/TURKS_smc.bin radeon/VERDE_ce.bin radeon/verde_ce.bin radeon/VERDE_mc2.bin radeon/VERDE_mc.bin radeon/verde_mc.bin radeon/VERDE_me.bin radeon/verde_me.bin radeon/VERDE_pfp.bin radeon/verde_pfp.bin radeon/VERDE_rlc.bin radeon/verde_rlc.bin radeon/VERDE_smc.bin radeon/verde_smc.bin rtl_nic/rtl8105e-1.fw rtl_nic/rtl8106e-1.fw rtl_nic/rtl8106e-2.fw rtl_nic/rtl8107e-1.fw rtl_nic/rtl8107e-2.fw rtl_nic/rtl8168d-1.fw rtl_nic/rtl8168d-2.fw rtl_nic/rtl8168e-1.fw rtl_nic/rtl8168e-2.fw rtl_nic/rtl8168e-3.fw rtl_nic/rtl8168f-1.fw rtl_nic/rtl8168f-2.fw rtl_nic/rtl8168g-1.fw rtl_nic/rtl8168g-2.fw rtl_nic/rtl8168g-3.fw rtl_nic/rtl8168h-1.fw rtl_nic/rtl8168h-2.fw rtl_nic/rtl8402-1.fw rtl_nic/rtl8411-1.fw rtl_nic/rtl8411-2.fw" +CONFIG_EXTRA_FIRMWARE_DIR="firmware" +# CONFIG_FW_LOADER_USER_HELPER_FALLBACK is not set +CONFIG_WANT_DEV_COREDUMP=y +# CONFIG_ALLOW_DEV_COREDUMP is not set +# CONFIG_DEBUG_DRIVER is not set +# CONFIG_DEBUG_DEVRES is not set +# CONFIG_SYS_HYPERVISOR is not set +# CONFIG_GENERIC_CPU_DEVICES is not set +CONFIG_GENERIC_CPU_AUTOPROBE=y +CONFIG_REGMAP=y +CONFIG_REGMAP_I2C=y +CONFIG_DMA_SHARED_BUFFER=y +# CONFIG_FENCE_TRACE is not set + +# +# Bus devices +# +CONFIG_CONNECTOR=y +CONFIG_PROC_EVENTS=y +# CONFIG_MTD is not set +# CONFIG_OF is not set +CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y +# CONFIG_PARPORT is not set +CONFIG_PNP=y +# CONFIG_PNP_DEBUG_MESSAGES is not set + +# +# Protocols +# +CONFIG_PNPACPI=y +CONFIG_BLK_DEV=y +# CONFIG_BLK_DEV_NULL_BLK is not set +# CONFIG_BLK_DEV_FD is not set +# CONFIG_BLK_DEV_PCIESSD_MTIP32XX is not set +# CONFIG_BLK_CPQ_CISS_DA is not set +# CONFIG_BLK_DEV_DAC960 is not set +# CONFIG_BLK_DEV_UMEM is not set +# CONFIG_BLK_DEV_COW_COMMON is not set +CONFIG_BLK_DEV_LOOP=y +CONFIG_BLK_DEV_LOOP_MIN_COUNT=0 +# CONFIG_BLK_DEV_CRYPTOLOOP is not set +# CONFIG_BLK_DEV_DRBD is not set +CONFIG_BLK_DEV_NBD=y +# CONFIG_BLK_DEV_SKD is not set +# CONFIG_BLK_DEV_SX8 is not set +CONFIG_BLK_DEV_RAM=y +CONFIG_BLK_DEV_RAM_COUNT=16 +CONFIG_BLK_DEV_RAM_SIZE=16384 +# CONFIG_CDROM_PKTCDVD is not set +# CONFIG_ATA_OVER_ETH is not set +CONFIG_VIRTIO_BLK=y +# CONFIG_BLK_DEV_HD is not set +# CONFIG_BLK_DEV_RBD is not set +# CONFIG_BLK_DEV_RSXX is not set +CONFIG_NVME_CORE=y +CONFIG_BLK_DEV_NVME=y +# CONFIG_BLK_DEV_NVME_SCSI is not set + +# +# Misc devices +# +# CONFIG_SENSORS_LIS3LV02D is not set +# CONFIG_AD525X_DPOT is not set +# CONFIG_DUMMY_IRQ is not set +# CONFIG_IBM_ASM is not set +# CONFIG_PHANTOM is not set +# CONFIG_SGI_IOC4 is not set +# CONFIG_TIFM_CORE is not set +# CONFIG_ICS932S401 is not set +# CONFIG_ENCLOSURE_SERVICES is not set +# CONFIG_HP_ILO is not set +# CONFIG_APDS9802ALS is not set +# CONFIG_ISL29003 is not set +# CONFIG_ISL29020 is not set +# CONFIG_SENSORS_TSL2550 is not set +# CONFIG_SENSORS_BH1780 is not set +# CONFIG_SENSORS_BH1770 is not set +# CONFIG_SENSORS_APDS990X is not set +# CONFIG_HMC6352 is not set +# CONFIG_DS1682 is not set +# CONFIG_BMP085_I2C is not set +# CONFIG_USB_SWITCH_FSA9480 is not set +# CONFIG_SRAM is not set +# CONFIG_C2PORT is not set + +# +# EEPROM support +# +# CONFIG_EEPROM_AT24 is not set +# CONFIG_EEPROM_LEGACY is not set +# CONFIG_EEPROM_MAX6875 is not set +CONFIG_EEPROM_93CX6=m +# CONFIG_CB710_CORE is not set + +# +# Texas Instruments shared transport line discipline +# +# CONFIG_SENSORS_LIS3_I2C is not set + +# +# Altera FPGA firmware download module +# +CONFIG_ALTERA_STAPL=m +# CONFIG_INTEL_MEI is not set +# CONFIG_INTEL_MEI_ME is not set +# CONFIG_INTEL_MEI_TXE is not set +# CONFIG_VMWARE_VMCI is not set + +# +# Intel MIC Bus Driver +# +# CONFIG_INTEL_MIC_BUS is not set + +# +# SCIF Bus Driver +# +# CONFIG_SCIF_BUS is not set + +# +# VOP Bus Driver +# +# CONFIG_VOP_BUS is not set + +# +# Intel MIC Host Driver +# + +# +# Intel MIC Card Driver +# + +# +# SCIF Driver +# + +# +# Intel MIC Coprocessor State Management (COSM) Drivers +# + +# +# VOP Driver +# +# CONFIG_GENWQE is not set +# CONFIG_ECHO is not set +# CONFIG_CXL_BASE is not set +# CONFIG_CXL_KERNEL_API is not set +# CONFIG_CXL_EEH is not set +CONFIG_HAVE_IDE=y +# CONFIG_IDE is not set + +# +# SCSI device support +# +CONFIG_SCSI_MOD=y +# CONFIG_RAID_ATTRS is not set +CONFIG_SCSI=y +CONFIG_SCSI_DMA=y +# CONFIG_SCSI_NETLINK is not set +# CONFIG_SCSI_MQ_DEFAULT is not set +# CONFIG_SCSI_PROC_FS is not set + +# +# SCSI support type (disk, tape, CD-ROM) +# +CONFIG_BLK_DEV_SD=y +# CONFIG_CHR_DEV_ST is not set +# CONFIG_CHR_DEV_OSST is not set +CONFIG_BLK_DEV_SR=y +# CONFIG_BLK_DEV_SR_VENDOR is not set +CONFIG_CHR_DEV_SG=y +# CONFIG_CHR_DEV_SCH is not set +# CONFIG_SCSI_CONSTANTS is not set +# CONFIG_SCSI_LOGGING is not set +CONFIG_SCSI_SCAN_ASYNC=y + +# +# SCSI Transports +# +# CONFIG_SCSI_SPI_ATTRS is not set +# CONFIG_SCSI_FC_ATTRS is not set +CONFIG_SCSI_ISCSI_ATTRS=y +CONFIG_SCSI_SAS_ATTRS=y +CONFIG_SCSI_SAS_LIBSAS=y +CONFIG_SCSI_SAS_ATA=y +CONFIG_SCSI_SAS_HOST_SMP=y +# CONFIG_SCSI_SRP_ATTRS is not set +CONFIG_SCSI_LOWLEVEL=y +CONFIG_ISCSI_TCP=y +CONFIG_ISCSI_BOOT_SYSFS=y +# CONFIG_SCSI_CXGB3_ISCSI is not set +# CONFIG_SCSI_CXGB4_ISCSI is not set +# CONFIG_SCSI_BNX2_ISCSI is not set +# CONFIG_BE2ISCSI is not set +# CONFIG_BLK_DEV_3W_XXXX_RAID is not set +# CONFIG_SCSI_HPSA is not set +# CONFIG_SCSI_3W_9XXX is not set +# CONFIG_SCSI_3W_SAS is not set +# CONFIG_SCSI_ACARD is not set +# CONFIG_SCSI_AACRAID is not set +# CONFIG_SCSI_AIC7XXX is not set +# CONFIG_SCSI_AIC79XX is not set +# CONFIG_SCSI_AIC94XX is not set +CONFIG_SCSI_MVSAS=y +# CONFIG_SCSI_MVSAS_DEBUG is not set +# CONFIG_SCSI_MVSAS_TASKLET is not set +# CONFIG_SCSI_MVUMI is not set +# CONFIG_SCSI_DPT_I2O is not set +# CONFIG_SCSI_ADVANSYS is not set +# CONFIG_SCSI_ARCMSR is not set +# CONFIG_SCSI_ESAS2R is not set +# CONFIG_MEGARAID_NEWGEN is not set +# CONFIG_MEGARAID_LEGACY is not set +CONFIG_MEGARAID_SAS=y +# CONFIG_SCSI_MPT3SAS is not set +# CONFIG_SCSI_MPT2SAS is not set +# CONFIG_SCSI_UFSHCD is not set +# CONFIG_SCSI_HPTIOP is not set +# CONFIG_SCSI_BUSLOGIC is not set +# CONFIG_VMWARE_PVSCSI is not set +# CONFIG_SCSI_SNIC is not set +# CONFIG_SCSI_DMX3191D is not set +# CONFIG_SCSI_EATA is not set +# CONFIG_SCSI_FUTURE_DOMAIN is not set +# CONFIG_SCSI_GDTH is not set +# CONFIG_SCSI_ISCI is not set +# CONFIG_SCSI_IPS is not set +# CONFIG_SCSI_INITIO is not set +# CONFIG_SCSI_INIA100 is not set +# CONFIG_SCSI_STEX is not set +# CONFIG_SCSI_SYM53C8XX_2 is not set +# CONFIG_SCSI_IPR is not set +# CONFIG_SCSI_QLOGIC_1280 is not set +# CONFIG_SCSI_QLA_ISCSI is not set +# CONFIG_SCSI_DC395x is not set +# CONFIG_SCSI_AM53C974 is not set +# CONFIG_SCSI_WD719X is not set +# CONFIG_SCSI_DEBUG is not set +# CONFIG_SCSI_PMCRAID is not set +# CONFIG_SCSI_PM8001 is not set +# CONFIG_SCSI_VIRTIO is not set +# CONFIG_SCSI_DH is not set +# CONFIG_SCSI_OSD_INITIATOR is not set +CONFIG_ATA=y +# CONFIG_ATA_NONSTANDARD is not set +# CONFIG_ATA_VERBOSE_ERROR is not set +CONFIG_ATA_ACPI=y +# CONFIG_SATA_ZPODD is not set +CONFIG_SATA_PMP=y + +# +# Controllers with non-SFF native interface +# +CONFIG_SATA_AHCI=y +CONFIG_SATA_AHCI_PLATFORM=y +# CONFIG_SATA_INIC162X is not set +# CONFIG_SATA_ACARD_AHCI is not set +CONFIG_SATA_SIL24=y +CONFIG_ATA_SFF=y + +# +# SFF controllers with custom DMA interface +# +# CONFIG_PDC_ADMA is not set +# CONFIG_SATA_QSTOR is not set +# CONFIG_SATA_SX4 is not set +CONFIG_ATA_BMDMA=y + +# +# SATA SFF controllers with BMDMA +# +CONFIG_ATA_PIIX=y +# CONFIG_SATA_MV is not set +CONFIG_SATA_NV=y +# CONFIG_SATA_PROMISE is not set +CONFIG_SATA_SIL=y +CONFIG_SATA_SIS=y +# CONFIG_SATA_SVW is not set +CONFIG_SATA_ULI=y +CONFIG_SATA_VIA=y +# CONFIG_SATA_VITESSE is not set + +# +# PATA SFF controllers with BMDMA +# +CONFIG_PATA_ALI=y +CONFIG_PATA_AMD=y +# CONFIG_PATA_ARTOP is not set +CONFIG_PATA_ATIIXP=y +# CONFIG_PATA_ATP867X is not set +# CONFIG_PATA_CMD64X is not set +# CONFIG_PATA_CYPRESS is not set +# CONFIG_PATA_EFAR is not set +# CONFIG_PATA_HPT366 is not set +# CONFIG_PATA_HPT37X is not set +# CONFIG_PATA_HPT3X2N is not set +# CONFIG_PATA_HPT3X3 is not set +# CONFIG_PATA_IT8213 is not set +# CONFIG_PATA_IT821X is not set +CONFIG_PATA_JMICRON=y +CONFIG_PATA_MARVELL=y +# CONFIG_PATA_NETCELL is not set +# CONFIG_PATA_NINJA32 is not set +# CONFIG_PATA_NS87415 is not set +# CONFIG_PATA_OLDPIIX is not set +# CONFIG_PATA_OPTIDMA is not set +# CONFIG_PATA_PDC2027X is not set +# CONFIG_PATA_PDC_OLD is not set +# CONFIG_PATA_RADISYS is not set +# CONFIG_PATA_RDC is not set +# CONFIG_PATA_SCH is not set +# CONFIG_PATA_SERVERWORKS is not set +# CONFIG_PATA_SIL680 is not set +CONFIG_PATA_SIS=y +# CONFIG_PATA_TOSHIBA is not set +# CONFIG_PATA_TRIFLEX is not set +CONFIG_PATA_VIA=y +# CONFIG_PATA_WINBOND is not set + +# +# PIO-only SFF controllers +# +# CONFIG_PATA_CMD640_PCI is not set +# CONFIG_PATA_MPIIX is not set +# CONFIG_PATA_NS87410 is not set +# CONFIG_PATA_OPTI is not set +# CONFIG_PATA_PLATFORM is not set +# CONFIG_PATA_RZ1000 is not set + +# +# Generic fallback / legacy drivers +# +CONFIG_PATA_ACPI=y +CONFIG_ATA_GENERIC=y +# CONFIG_PATA_LEGACY is not set +# CONFIG_MD is not set +# CONFIG_TARGET_CORE is not set +# CONFIG_FUSION is not set + +# +# IEEE 1394 (FireWire) support +# +CONFIG_FIREWIRE=m +CONFIG_FIREWIRE_OHCI=m +CONFIG_FIREWIRE_SBP2=m +# CONFIG_FIREWIRE_NET is not set +# CONFIG_FIREWIRE_NOSY is not set +# CONFIG_MACINTOSH_DRIVERS is not set +CONFIG_NETDEVICES=y +CONFIG_MII=y +CONFIG_NET_CORE=y +# CONFIG_BONDING is not set +# CONFIG_DUMMY is not set +# CONFIG_EQUALIZER is not set +# CONFIG_NET_FC is not set +# CONFIG_NET_TEAM is not set +CONFIG_MACVLAN=m +# CONFIG_MACVTAP is not set +# CONFIG_IPVLAN is not set +# CONFIG_VXLAN is not set +# CONFIG_MACSEC is not set +CONFIG_NETCONSOLE=y +CONFIG_NETPOLL=y +CONFIG_NET_POLL_CONTROLLER=y +CONFIG_TUN=y +# CONFIG_TUN_VNET_CROSS_LE is not set +CONFIG_VETH=m +CONFIG_VIRTIO_NET=y +# CONFIG_NLMON is not set +# CONFIG_ARCNET is not set + +# +# CAIF transport drivers +# + +# +# Distributed Switch Architecture drivers +# +# CONFIG_NET_DSA_MV88E6XXX is not set +# CONFIG_NET_DSA_MV88E6XXX_NEED_PPU is not set +CONFIG_ETHERNET=y +CONFIG_MDIO=y +CONFIG_NET_VENDOR_3COM=y +CONFIG_VORTEX=y +# CONFIG_TYPHOON is not set +# CONFIG_NET_VENDOR_ADAPTEC is not set +# CONFIG_NET_VENDOR_AGERE is not set +# CONFIG_NET_VENDOR_ALTEON is not set +# CONFIG_ALTERA_TSE is not set +CONFIG_NET_VENDOR_AMD=y +# CONFIG_AMD8111_ETH is not set +CONFIG_PCNET32=y +CONFIG_NET_VENDOR_ARC=y +CONFIG_NET_VENDOR_ATHEROS=y +CONFIG_ATL2=y +CONFIG_ATL1=y +CONFIG_ATL1E=y +CONFIG_ATL1C=y +CONFIG_ALX=y +# CONFIG_NET_VENDOR_AURORA is not set +# CONFIG_NET_CADENCE is not set +CONFIG_NET_VENDOR_BROADCOM=y +CONFIG_B44=y +CONFIG_B44_PCI_AUTOSELECT=y +CONFIG_B44_PCICORE_AUTOSELECT=y +CONFIG_B44_PCI=y +# CONFIG_BCMGENET is not set +CONFIG_BNX2=y +CONFIG_CNIC=y +CONFIG_TIGON3=y +# CONFIG_BNX2X is not set +# CONFIG_BNXT is not set +# CONFIG_NET_VENDOR_BROCADE is not set +CONFIG_NET_VENDOR_CAVIUM=y +# CONFIG_THUNDER_NIC_PF is not set +# CONFIG_THUNDER_NIC_VF is not set +# CONFIG_THUNDER_NIC_BGX is not set +# CONFIG_LIQUIDIO is not set +# CONFIG_NET_VENDOR_CHELSIO is not set +# CONFIG_NET_VENDOR_CISCO is not set +# CONFIG_CX_ECAT is not set +# CONFIG_DNET is not set +CONFIG_NET_VENDOR_DEC=y +CONFIG_NET_TULIP=y +# CONFIG_DE2104X is not set +# CONFIG_TULIP is not set +# CONFIG_DE4X5 is not set +# CONFIG_WINBOND_840 is not set +# CONFIG_DM9102 is not set +CONFIG_ULI526X=y +# CONFIG_NET_VENDOR_DLINK is not set +# CONFIG_NET_VENDOR_EMULEX is not set +CONFIG_NET_VENDOR_EZCHIP=y +# CONFIG_NET_VENDOR_EXAR is not set +# CONFIG_NET_VENDOR_HP is not set +CONFIG_NET_VENDOR_INTEL=y +CONFIG_E100=y +CONFIG_E1000=y +CONFIG_E1000E=y +CONFIG_E1000E_HWTS=y +CONFIG_IGB=y +CONFIG_IGB_HWMON=y +# CONFIG_IGBVF is not set +CONFIG_IXGB=y +CONFIG_IXGBE=y +CONFIG_IXGBE_HWMON=y +# CONFIG_IXGBEVF is not set +# CONFIG_I40E is not set +# CONFIG_I40EVF is not set +# CONFIG_FM10K is not set +CONFIG_NET_VENDOR_I825XX=y +CONFIG_JME=y +CONFIG_NET_VENDOR_MARVELL=y +# CONFIG_MVMDIO is not set +# CONFIG_MVNETA_BM is not set +CONFIG_SKGE=y +# CONFIG_SKGE_DEBUG is not set +CONFIG_SKGE_GENESIS=y +CONFIG_SKY2=y +# CONFIG_SKY2_DEBUG is not set +# CONFIG_NET_VENDOR_MELLANOX is not set +# CONFIG_NET_VENDOR_MICREL is not set +# CONFIG_NET_VENDOR_MYRI is not set +# CONFIG_FEALNX is not set +# CONFIG_NET_VENDOR_NATSEMI is not set +CONFIG_NET_VENDOR_NETRONOME=y +# CONFIG_NFP_NETVF is not set +CONFIG_NET_VENDOR_NVIDIA=y +CONFIG_FORCEDETH=y +# CONFIG_NET_VENDOR_OKI is not set +# CONFIG_ETHOC is not set +# CONFIG_NET_PACKET_ENGINE is not set +CONFIG_NET_VENDOR_QLOGIC=y +CONFIG_QLA3XXX=y +# CONFIG_QLCNIC is not set +# CONFIG_QLGE is not set +# CONFIG_NETXEN_NIC is not set +# CONFIG_QED is not set +# CONFIG_NET_VENDOR_QUALCOMM is not set +CONFIG_NET_VENDOR_REALTEK=y +# CONFIG_8139CP is not set +CONFIG_8139TOO=y +# CONFIG_8139TOO_PIO is not set +# CONFIG_8139TOO_TUNE_TWISTER is not set +# CONFIG_8139TOO_8129 is not set +# CONFIG_8139_OLD_RX_RESET is not set +CONFIG_R8169=y +CONFIG_NET_VENDOR_RENESAS=y +# CONFIG_NET_VENDOR_RDC is not set +CONFIG_NET_VENDOR_ROCKER=y +# CONFIG_NET_VENDOR_SAMSUNG is not set +# CONFIG_NET_VENDOR_SEEQ is not set +# CONFIG_NET_VENDOR_SILAN is not set +CONFIG_NET_VENDOR_SIS=y +CONFIG_SIS900=y +CONFIG_SIS190=y +# CONFIG_SFC is not set +# CONFIG_NET_VENDOR_SMSC is not set +# CONFIG_NET_VENDOR_STMICRO is not set +# CONFIG_NET_VENDOR_SUN is not set +CONFIG_NET_VENDOR_SYNOPSYS=y +# CONFIG_NET_VENDOR_TEHUTI is not set +# CONFIG_NET_VENDOR_TI is not set +CONFIG_NET_VENDOR_VIA=y +CONFIG_VIA_RHINE=y +# CONFIG_VIA_RHINE_MMIO is not set +CONFIG_VIA_VELOCITY=y +# CONFIG_NET_VENDOR_WIZNET is not set +# CONFIG_FDDI is not set +# CONFIG_HIPPI is not set +# CONFIG_NET_SB1000 is not set +CONFIG_PHYLIB=y + +# +# MII PHY device drivers +# +# CONFIG_AQUANTIA_PHY is not set +CONFIG_AT803X_PHY=y +CONFIG_AMD_PHY=y +CONFIG_MARVELL_PHY=y +# CONFIG_DAVICOM_PHY is not set +# CONFIG_QSEMI_PHY is not set +# CONFIG_LXT_PHY is not set +# CONFIG_CICADA_PHY is not set +# CONFIG_VITESSE_PHY is not set +# CONFIG_TERANETICS_PHY is not set +# CONFIG_SMSC_PHY is not set +CONFIG_BCM_NET_PHYLIB=y +CONFIG_BROADCOM_PHY=y +# CONFIG_BCM7XXX_PHY is not set +# CONFIG_BCM87XX_PHY is not set +# CONFIG_ICPLUS_PHY is not set +CONFIG_REALTEK_PHY=y +# CONFIG_NATIONAL_PHY is not set +# CONFIG_STE10XP is not set +# CONFIG_LSI_ET1011C_PHY is not set +# CONFIG_MICREL_PHY is not set +# CONFIG_DP83848_PHY is not set +# CONFIG_DP83867_PHY is not set +# CONFIG_MICROCHIP_PHY is not set +# CONFIG_FIXED_PHY is not set +# CONFIG_MDIO_BITBANG is not set +# CONFIG_MDIO_OCTEON is not set +# CONFIG_MDIO_THUNDER is not set +# CONFIG_MDIO_BCM_UNIMAC is not set +CONFIG_PPP=m +CONFIG_PPP_BSDCOMP=m +CONFIG_PPP_DEFLATE=m +# CONFIG_PPP_FILTER is not set +CONFIG_PPP_MPPE=m +# CONFIG_PPP_MULTILINK is not set +CONFIG_PPPOE=m +CONFIG_PPP_ASYNC=m +# CONFIG_PPP_SYNC_TTY is not set +# CONFIG_SLIP is not set +CONFIG_SLHC=m +CONFIG_USB_NET_DRIVERS=y +# CONFIG_USB_CATC is not set +# CONFIG_USB_KAWETH is not set +# CONFIG_USB_PEGASUS is not set +# CONFIG_USB_RTL8150 is not set +CONFIG_USB_RTL8152=m +# CONFIG_USB_LAN78XX is not set +CONFIG_USB_USBNET=m +CONFIG_USB_NET_AX8817X=m +CONFIG_USB_NET_AX88179_178A=m +CONFIG_USB_NET_CDCETHER=m +# CONFIG_USB_NET_CDC_EEM is not set +# CONFIG_USB_NET_CDC_NCM is not set +# CONFIG_USB_NET_HUAWEI_CDC_NCM is not set +# CONFIG_USB_NET_CDC_MBIM is not set +CONFIG_USB_NET_DM9601=m +# CONFIG_USB_NET_SR9700 is not set +# CONFIG_USB_NET_SR9800 is not set +CONFIG_USB_NET_SMSC75XX=m +# CONFIG_USB_NET_SMSC95XX is not set +# CONFIG_USB_NET_GL620A is not set +# CONFIG_USB_NET_NET1080 is not set +# CONFIG_USB_NET_PLUSB is not set +CONFIG_USB_NET_MCS7830=m +CONFIG_USB_NET_RNDIS_HOST=m +# CONFIG_USB_NET_CDC_SUBSET is not set +# CONFIG_USB_NET_ZAURUS is not set +# CONFIG_USB_NET_CX82310_ETH is not set +# CONFIG_USB_NET_KALMIA is not set +# CONFIG_USB_NET_QMI_WWAN is not set +# CONFIG_USB_NET_INT51X1 is not set +CONFIG_USB_IPHETH=m +# CONFIG_USB_SIERRA_NET is not set +# CONFIG_USB_VL600 is not set +# CONFIG_USB_NET_CH9200 is not set +CONFIG_WLAN=y +CONFIG_WLAN_VENDOR_ADMTEK=y +# CONFIG_ADM8211 is not set +CONFIG_ATH_COMMON=m +CONFIG_WLAN_VENDOR_ATH=y +# CONFIG_ATH_DEBUG is not set +CONFIG_ATH5K=m +# CONFIG_ATH5K_DEBUG is not set +CONFIG_ATH5K_PCI=y +CONFIG_ATH9K_HW=m +CONFIG_ATH9K_COMMON=m +CONFIG_ATH9K_BTCOEX_SUPPORT=y +CONFIG_ATH9K=m +CONFIG_ATH9K_PCI=y +CONFIG_ATH9K_AHB=y +# CONFIG_ATH9K_DEBUGFS is not set +# CONFIG_ATH9K_DYNACK is not set +# CONFIG_ATH9K_WOW is not set +# CONFIG_ATH9K_CHANNEL_CONTEXT is not set +CONFIG_ATH9K_PCOEM=y +CONFIG_ATH9K_HTC=m +# CONFIG_ATH9K_HTC_DEBUGFS is not set +CONFIG_ATH9K_HWRNG=y +CONFIG_CARL9170=m +CONFIG_CARL9170_LEDS=y +CONFIG_CARL9170_WPC=y +# CONFIG_CARL9170_HWRNG is not set +CONFIG_ATH6KL=m +# CONFIG_ATH6KL_SDIO is not set +CONFIG_ATH6KL_USB=m +# CONFIG_ATH6KL_DEBUG is not set +CONFIG_AR5523=m +# CONFIG_WIL6210 is not set +# CONFIG_ATH10K is not set +CONFIG_WCN36XX=m +# CONFIG_WCN36XX_DEBUGFS is not set +CONFIG_WLAN_VENDOR_ATMEL=y +CONFIG_ATMEL=m +CONFIG_PCI_ATMEL=m +# CONFIG_AT76C50X_USB is not set +CONFIG_WLAN_VENDOR_BROADCOM=y +# CONFIG_B43 is not set +# CONFIG_B43LEGACY is not set +CONFIG_BRCMUTIL=m +# CONFIG_BRCMSMAC is not set +CONFIG_BRCMFMAC=m +CONFIG_BRCMFMAC_PROTO_BCDC=y +CONFIG_BRCMFMAC_PROTO_MSGBUF=y +# CONFIG_BRCMFMAC_SDIO is not set +CONFIG_BRCMFMAC_USB=y +CONFIG_BRCMFMAC_PCIE=y +# CONFIG_BRCM_TRACING is not set +# CONFIG_BRCMDBG is not set +CONFIG_WLAN_VENDOR_CISCO=y +# CONFIG_AIRO is not set +CONFIG_WLAN_VENDOR_INTEL=y +CONFIG_IPW2100=m +CONFIG_IPW2100_MONITOR=y +# CONFIG_IPW2100_DEBUG is not set +CONFIG_IPW2200=m +CONFIG_IPW2200_MONITOR=y +CONFIG_IPW2200_RADIOTAP=y +CONFIG_IPW2200_PROMISCUOUS=y +CONFIG_IPW2200_QOS=y +# CONFIG_IPW2200_DEBUG is not set +CONFIG_LIBIPW=m +# CONFIG_LIBIPW_DEBUG is not set +CONFIG_IWLEGACY=m +CONFIG_IWL4965=m +CONFIG_IWL3945=m + +# +# iwl3945 / iwl4965 Debugging Options +# +# CONFIG_IWLEGACY_DEBUG is not set +CONFIG_IWLWIFI=m +CONFIG_IWLWIFI_LEDS=y +CONFIG_IWLDVM=m +CONFIG_IWLMVM=m +CONFIG_IWLWIFI_OPMODE_MODULAR=y +# CONFIG_IWLWIFI_BCAST_FILTERING is not set +# CONFIG_IWLWIFI_UAPSD is not set +# CONFIG_IWLWIFI_PCIE_RTPM is not set + +# +# Debugging Options +# +# CONFIG_IWLWIFI_DEBUG is not set +CONFIG_WLAN_VENDOR_INTERSIL=y +CONFIG_HOSTAP=m +CONFIG_HOSTAP_FIRMWARE=y +CONFIG_HOSTAP_FIRMWARE_NVRAM=y +# CONFIG_HOSTAP_PLX is not set +# CONFIG_HOSTAP_PCI is not set +# CONFIG_HERMES is not set +CONFIG_P54_COMMON=m +CONFIG_P54_USB=m +CONFIG_P54_PCI=m +CONFIG_P54_LEDS=y +# CONFIG_PRISM54 is not set +CONFIG_WLAN_VENDOR_MARVELL=y +CONFIG_LIBERTAS=m +# CONFIG_LIBERTAS_USB is not set +# CONFIG_LIBERTAS_SDIO is not set +# CONFIG_LIBERTAS_DEBUG is not set +# CONFIG_LIBERTAS_MESH is not set +CONFIG_LIBERTAS_THINFIRM=m +# CONFIG_LIBERTAS_THINFIRM_DEBUG is not set +CONFIG_LIBERTAS_THINFIRM_USB=m +# CONFIG_MWIFIEX is not set +# CONFIG_MWL8K is not set +CONFIG_WLAN_VENDOR_MEDIATEK=y +CONFIG_MT7601U=m +CONFIG_WLAN_VENDOR_RALINK=y +CONFIG_RT2X00=m +CONFIG_RT2400PCI=m +CONFIG_RT2500PCI=m +CONFIG_RT61PCI=m +CONFIG_RT2800PCI=m +CONFIG_RT2800PCI_RT33XX=y +CONFIG_RT2800PCI_RT35XX=y +CONFIG_RT2800PCI_RT53XX=y +CONFIG_RT2800PCI_RT3290=y +CONFIG_RT2500USB=m +CONFIG_RT73USB=m +CONFIG_RT2800USB=m +CONFIG_RT2800USB_RT33XX=y +CONFIG_RT2800USB_RT35XX=y +CONFIG_RT2800USB_RT3573=y +CONFIG_RT2800USB_RT53XX=y +CONFIG_RT2800USB_RT55XX=y +CONFIG_RT2800USB_UNKNOWN=y +CONFIG_RT2800_LIB=m +CONFIG_RT2800_LIB_MMIO=m +CONFIG_RT2X00_LIB_MMIO=m +CONFIG_RT2X00_LIB_PCI=m +CONFIG_RT2X00_LIB_USB=m +CONFIG_RT2X00_LIB=m +CONFIG_RT2X00_LIB_FIRMWARE=y +CONFIG_RT2X00_LIB_CRYPTO=y +CONFIG_RT2X00_LIB_LEDS=y +# CONFIG_RT2X00_DEBUG is not set +CONFIG_WLAN_VENDOR_REALTEK=y +CONFIG_RTL8180=m +CONFIG_RTL8187=m +CONFIG_RTL8187_LEDS=y +CONFIG_RTL_CARDS=m +CONFIG_RTL8192CE=m +CONFIG_RTL8192SE=m +CONFIG_RTL8192DE=m +CONFIG_RTL8723AE=m +CONFIG_RTL8723BE=m +CONFIG_RTL8188EE=m +CONFIG_RTL8192EE=m +CONFIG_RTL8821AE=m +# CONFIG_RTL8192CU is not set +CONFIG_RTLWIFI=m +CONFIG_RTLWIFI_PCI=m +# CONFIG_RTLWIFI_DEBUG is not set +CONFIG_RTL8192C_COMMON=m +CONFIG_RTL8723_COMMON=m +CONFIG_RTLBTCOEXIST=m +# CONFIG_RTL8XXXU is not set +CONFIG_WLAN_VENDOR_RSI=y +# CONFIG_RSI_91X is not set +CONFIG_WLAN_VENDOR_ST=y +# CONFIG_CW1200 is not set +CONFIG_WLAN_VENDOR_TI=y +# CONFIG_WL1251 is not set +# CONFIG_WL12XX is not set +# CONFIG_WL18XX is not set +# CONFIG_WLCORE is not set +CONFIG_WLAN_VENDOR_ZYDAS=y +CONFIG_USB_ZD1201=m +CONFIG_ZD1211RW=m +# CONFIG_ZD1211RW_DEBUG is not set +# CONFIG_MAC80211_HWSIM is not set +CONFIG_USB_NET_RNDIS_WLAN=m + +# +# Enable WiMAX (Networking options) to see the WiMAX drivers +# +# CONFIG_WAN is not set +# CONFIG_VMXNET3 is not set +# CONFIG_FUJITSU_ES is not set +# CONFIG_ISDN is not set +# CONFIG_NVM is not set + +# +# Input device support +# +CONFIG_INPUT=y +CONFIG_INPUT_LEDS=y +CONFIG_INPUT_FF_MEMLESS=y +# CONFIG_INPUT_POLLDEV is not set +# CONFIG_INPUT_SPARSEKMAP is not set +# CONFIG_INPUT_MATRIXKMAP is not set + +# +# Userland interfaces +# +CONFIG_INPUT_MOUSEDEV=y +# CONFIG_INPUT_MOUSEDEV_PSAUX is not set +CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 +CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 +CONFIG_INPUT_JOYDEV=y +CONFIG_INPUT_EVDEV=y +# CONFIG_INPUT_EVBUG is not set + +# +# Input Device Drivers +# +CONFIG_INPUT_KEYBOARD=y +# CONFIG_KEYBOARD_ADP5588 is not set +# CONFIG_KEYBOARD_ADP5589 is not set +CONFIG_KEYBOARD_ATKBD=y +# CONFIG_KEYBOARD_QT1070 is not set +# CONFIG_KEYBOARD_QT2160 is not set +# CONFIG_KEYBOARD_LKKBD is not set +# CONFIG_KEYBOARD_TCA6416 is not set +# CONFIG_KEYBOARD_TCA8418 is not set +# CONFIG_KEYBOARD_LM8323 is not set +# CONFIG_KEYBOARD_LM8333 is not set +# CONFIG_KEYBOARD_MAX7359 is not set +# CONFIG_KEYBOARD_MCS is not set +# CONFIG_KEYBOARD_MPR121 is not set +# CONFIG_KEYBOARD_NEWTON is not set +# CONFIG_KEYBOARD_OPENCORES is not set +# CONFIG_KEYBOARD_SAMSUNG is not set +# CONFIG_KEYBOARD_STOWAWAY is not set +# CONFIG_KEYBOARD_SUNKBD is not set +# CONFIG_KEYBOARD_XTKBD is not set +CONFIG_INPUT_MOUSE=y +CONFIG_MOUSE_PS2=y +CONFIG_MOUSE_PS2_ALPS=y +CONFIG_MOUSE_PS2_BYD=y +CONFIG_MOUSE_PS2_LOGIPS2PP=y +CONFIG_MOUSE_PS2_SYNAPTICS=y +CONFIG_MOUSE_PS2_CYPRESS=y +CONFIG_MOUSE_PS2_LIFEBOOK=y +CONFIG_MOUSE_PS2_TRACKPOINT=y +# CONFIG_MOUSE_PS2_ELANTECH is not set +# CONFIG_MOUSE_PS2_SENTELIC is not set +# CONFIG_MOUSE_PS2_TOUCHKIT is not set +# CONFIG_MOUSE_PS2_FOCALTECH is not set +# CONFIG_MOUSE_PS2_VMMOUSE is not set +# CONFIG_MOUSE_SERIAL is not set +# CONFIG_MOUSE_APPLETOUCH is not set +# CONFIG_MOUSE_BCM5974 is not set +# CONFIG_MOUSE_CYAPA is not set +# CONFIG_MOUSE_ELAN_I2C is not set +# CONFIG_MOUSE_VSXXXAA is not set +# CONFIG_MOUSE_SYNAPTICS_I2C is not set +# CONFIG_MOUSE_SYNAPTICS_USB is not set +CONFIG_INPUT_JOYSTICK=y +# CONFIG_JOYSTICK_ANALOG is not set +# CONFIG_JOYSTICK_A3D is not set +# CONFIG_JOYSTICK_ADI is not set +# CONFIG_JOYSTICK_COBRA is not set +# CONFIG_JOYSTICK_GF2K is not set +# CONFIG_JOYSTICK_GRIP is not set +# CONFIG_JOYSTICK_GRIP_MP is not set +# CONFIG_JOYSTICK_GUILLEMOT is not set +# CONFIG_JOYSTICK_INTERACT is not set +# CONFIG_JOYSTICK_SIDEWINDER is not set +# CONFIG_JOYSTICK_TMDC is not set +# CONFIG_JOYSTICK_IFORCE is not set +# CONFIG_JOYSTICK_WARRIOR is not set +# CONFIG_JOYSTICK_MAGELLAN is not set +# CONFIG_JOYSTICK_SPACEORB is not set +# CONFIG_JOYSTICK_SPACEBALL is not set +# CONFIG_JOYSTICK_STINGER is not set +# CONFIG_JOYSTICK_TWIDJOY is not set +# CONFIG_JOYSTICK_ZHENHUA is not set +# CONFIG_JOYSTICK_AS5011 is not set +# CONFIG_JOYSTICK_JOYDUMP is not set +CONFIG_JOYSTICK_XPAD=m +CONFIG_JOYSTICK_XPAD_FF=y +CONFIG_JOYSTICK_XPAD_LEDS=y +# CONFIG_INPUT_TABLET is not set +CONFIG_INPUT_TOUCHSCREEN=y +CONFIG_TOUCHSCREEN_PROPERTIES=y +# CONFIG_TOUCHSCREEN_AD7879 is not set +# CONFIG_TOUCHSCREEN_ATMEL_MXT is not set +# CONFIG_TOUCHSCREEN_BU21013 is not set +# CONFIG_TOUCHSCREEN_CYTTSP_CORE is not set +# CONFIG_TOUCHSCREEN_CYTTSP4_CORE is not set +# CONFIG_TOUCHSCREEN_DYNAPRO is not set +# CONFIG_TOUCHSCREEN_HAMPSHIRE is not set +# CONFIG_TOUCHSCREEN_EETI is not set +# CONFIG_TOUCHSCREEN_EGALAX_SERIAL is not set +# CONFIG_TOUCHSCREEN_FUJITSU is not set +# CONFIG_TOUCHSCREEN_ILI210X is not set +# CONFIG_TOUCHSCREEN_GUNZE is not set +# CONFIG_TOUCHSCREEN_ELAN is not set +# CONFIG_TOUCHSCREEN_ELO is not set +# CONFIG_TOUCHSCREEN_WACOM_W8001 is not set +# CONFIG_TOUCHSCREEN_WACOM_I2C is not set +# CONFIG_TOUCHSCREEN_MAX11801 is not set +# CONFIG_TOUCHSCREEN_MCS5000 is not set +# CONFIG_TOUCHSCREEN_MMS114 is not set +# CONFIG_TOUCHSCREEN_MELFAS_MIP4 is not set +# CONFIG_TOUCHSCREEN_MTOUCH is not set +# CONFIG_TOUCHSCREEN_INEXIO is not set +# CONFIG_TOUCHSCREEN_MK712 is not set +# CONFIG_TOUCHSCREEN_PENMOUNT is not set +# CONFIG_TOUCHSCREEN_EDT_FT5X06 is not set +# CONFIG_TOUCHSCREEN_TOUCHRIGHT is not set +# CONFIG_TOUCHSCREEN_TOUCHWIN is not set +# CONFIG_TOUCHSCREEN_PIXCIR is not set +# CONFIG_TOUCHSCREEN_WDT87XX_I2C is not set +# CONFIG_TOUCHSCREEN_WM97XX is not set +CONFIG_TOUCHSCREEN_USB_COMPOSITE=m +CONFIG_TOUCHSCREEN_USB_EGALAX=y +# CONFIG_TOUCHSCREEN_USB_PANJIT is not set +CONFIG_TOUCHSCREEN_USB_3M=y +# CONFIG_TOUCHSCREEN_USB_ITM is not set +# CONFIG_TOUCHSCREEN_USB_ETURBO is not set +# CONFIG_TOUCHSCREEN_USB_GUNZE is not set +# CONFIG_TOUCHSCREEN_USB_DMC_TSC10 is not set +# CONFIG_TOUCHSCREEN_USB_IRTOUCH is not set +# CONFIG_TOUCHSCREEN_USB_IDEALTEK is not set +# CONFIG_TOUCHSCREEN_USB_GENERAL_TOUCH is not set +# CONFIG_TOUCHSCREEN_USB_GOTOP is not set +# CONFIG_TOUCHSCREEN_USB_JASTEC is not set +# CONFIG_TOUCHSCREEN_USB_ELO is not set +# CONFIG_TOUCHSCREEN_USB_E2I is not set +# CONFIG_TOUCHSCREEN_USB_ZYTRONIC is not set +# CONFIG_TOUCHSCREEN_USB_ETT_TC45USB is not set +# CONFIG_TOUCHSCREEN_USB_NEXIO is not set +CONFIG_TOUCHSCREEN_USB_EASYTOUCH=y +# CONFIG_TOUCHSCREEN_TOUCHIT213 is not set +# CONFIG_TOUCHSCREEN_TSC_SERIO is not set +# CONFIG_TOUCHSCREEN_TSC2004 is not set +# CONFIG_TOUCHSCREEN_TSC2007 is not set +CONFIG_TOUCHSCREEN_ST1232=m +# CONFIG_TOUCHSCREEN_SUR40 is not set +# CONFIG_TOUCHSCREEN_SX8654 is not set +# CONFIG_TOUCHSCREEN_TPS6507X is not set +# CONFIG_TOUCHSCREEN_ROHM_BU21023 is not set +CONFIG_INPUT_MISC=y +# CONFIG_INPUT_AD714X is not set +# CONFIG_INPUT_BMA150 is not set +# CONFIG_INPUT_E3X0_BUTTON is not set +# CONFIG_INPUT_MMA8450 is not set +# CONFIG_INPUT_MPU3050 is not set +# CONFIG_INPUT_APANEL is not set +# CONFIG_INPUT_ATLAS_BTNS is not set +CONFIG_INPUT_ATI_REMOTE2=m +# CONFIG_INPUT_KEYSPAN_REMOTE is not set +# CONFIG_INPUT_KXTJ9 is not set +# CONFIG_INPUT_POWERMATE is not set +# CONFIG_INPUT_YEALINK is not set +# CONFIG_INPUT_CM109 is not set +CONFIG_INPUT_UINPUT=y +# CONFIG_INPUT_PCF8574 is not set +# CONFIG_INPUT_ADXL34X is not set +# CONFIG_INPUT_IMS_PCU is not set +# CONFIG_INPUT_CMA3000 is not set +# CONFIG_INPUT_IDEAPAD_SLIDEBAR is not set +# CONFIG_INPUT_DRV2665_HAPTICS is not set +# CONFIG_INPUT_DRV2667_HAPTICS is not set +# CONFIG_RMI4_CORE is not set + +# +# Hardware I/O ports +# +CONFIG_SERIO=y +CONFIG_ARCH_MIGHT_HAVE_PC_SERIO=y +CONFIG_SERIO_I8042=y +CONFIG_SERIO_SERPORT=y +# CONFIG_SERIO_CT82C710 is not set +# CONFIG_SERIO_PCIPS2 is not set +CONFIG_SERIO_LIBPS2=y +# CONFIG_SERIO_RAW is not set +# CONFIG_SERIO_ALTERA_PS2 is not set +# CONFIG_SERIO_PS2MULT is not set +# CONFIG_SERIO_ARC_PS2 is not set +# CONFIG_USERIO is not set +# CONFIG_GAMEPORT is not set + +# +# Character devices +# +CONFIG_TTY=y +CONFIG_VT=y +CONFIG_CONSOLE_TRANSLATIONS=y +CONFIG_VT_CONSOLE=y +CONFIG_VT_CONSOLE_SLEEP=y +CONFIG_HW_CONSOLE=y +CONFIG_VT_HW_CONSOLE_BINDING=y +CONFIG_UNIX98_PTYS=y +CONFIG_DEVPTS_MULTIPLE_INSTANCES=y +# CONFIG_LEGACY_PTYS is not set +# CONFIG_SERIAL_NONSTANDARD is not set +# CONFIG_NOZOMI is not set +# CONFIG_N_GSM is not set +# CONFIG_TRACE_SINK is not set +CONFIG_DEVMEM=y +# CONFIG_DEVKMEM is not set + +# +# Serial drivers +# +CONFIG_SERIAL_8250=y +# CONFIG_SERIAL_8250_DEPRECATED_OPTIONS is not set +CONFIG_SERIAL_8250_PNP=y +# CONFIG_SERIAL_8250_CONSOLE is not set +CONFIG_SERIAL_8250_DMA=y +CONFIG_SERIAL_8250_PCI=y +CONFIG_SERIAL_8250_NR_UARTS=4 +CONFIG_SERIAL_8250_RUNTIME_UARTS=4 +# CONFIG_SERIAL_8250_EXTENDED is not set +# CONFIG_SERIAL_8250_DW is not set +# CONFIG_SERIAL_8250_RT288X is not set +# CONFIG_SERIAL_8250_FINTEK is not set +# CONFIG_SERIAL_8250_MID is not set +# CONFIG_SERIAL_8250_MOXA is not set + +# +# Non-8250 serial port support +# +# CONFIG_SERIAL_UARTLITE is not set +CONFIG_SERIAL_CORE=y +# CONFIG_SERIAL_JSM is not set +# CONFIG_SERIAL_SCCNXP is not set +# CONFIG_SERIAL_SC16IS7XX is not set +# CONFIG_SERIAL_ALTERA_JTAGUART is not set +# CONFIG_SERIAL_ALTERA_UART is not set +# CONFIG_SERIAL_ARC is not set +# CONFIG_SERIAL_RP2 is not set +# CONFIG_SERIAL_FSL_LPUART is not set +# CONFIG_SERIAL_MVEBU_UART is not set +# CONFIG_TTY_PRINTK is not set +CONFIG_HVC_DRIVER=y +CONFIG_VIRTIO_CONSOLE=y +# CONFIG_IPMI_HANDLER is not set +CONFIG_HW_RANDOM=m +# CONFIG_HW_RANDOM_TIMERIOMEM is not set +CONFIG_HW_RANDOM_INTEL=m +CONFIG_HW_RANDOM_AMD=m +# CONFIG_HW_RANDOM_VIA is not set +CONFIG_HW_RANDOM_VIRTIO=m +# CONFIG_NVRAM is not set +# CONFIG_R3964 is not set +# CONFIG_APPLICOM is not set +# CONFIG_MWAVE is not set +# CONFIG_RAW_DRIVER is not set +# CONFIG_HPET is not set +# CONFIG_HANGCHECK_TIMER is not set +# CONFIG_TCG_TPM is not set +# CONFIG_TELCLOCK is not set +CONFIG_DEVPORT=y +# CONFIG_XILLYBUS is not set + +# +# I2C support +# +CONFIG_I2C=y +CONFIG_ACPI_I2C_OPREGION=y +CONFIG_I2C_BOARDINFO=y +# CONFIG_I2C_COMPAT is not set +CONFIG_I2C_CHARDEV=y +CONFIG_I2C_MUX=m + +# +# Multiplexer I2C Chip support +# +# CONFIG_I2C_MUX_PCA9541 is not set +# CONFIG_I2C_MUX_PINCTRL is not set +# CONFIG_I2C_MUX_REG is not set +CONFIG_I2C_HELPER_AUTO=y +CONFIG_I2C_ALGOBIT=y + +# +# I2C Hardware Bus support +# + +# +# PC SMBus host controller drivers +# +# CONFIG_I2C_ALI1535 is not set +# CONFIG_I2C_ALI1563 is not set +# CONFIG_I2C_ALI15X3 is not set +# CONFIG_I2C_AMD756 is not set +# CONFIG_I2C_AMD8111 is not set +CONFIG_I2C_I801=y +CONFIG_I2C_ISCH=y +# CONFIG_I2C_ISMT is not set +CONFIG_I2C_PIIX4=y +CONFIG_I2C_NFORCE2=y +# CONFIG_I2C_NFORCE2_S4985 is not set +# CONFIG_I2C_SIS5595 is not set +# CONFIG_I2C_SIS630 is not set +# CONFIG_I2C_SIS96X is not set +CONFIG_I2C_VIA=y +CONFIG_I2C_VIAPRO=y + +# +# ACPI drivers +# +# CONFIG_I2C_SCMI is not set + +# +# I2C system bus drivers (mostly embedded / system-on-chip) +# +CONFIG_I2C_DESIGNWARE_CORE=y +CONFIG_I2C_DESIGNWARE_PLATFORM=y +# CONFIG_I2C_DESIGNWARE_PCI is not set +# CONFIG_I2C_DESIGNWARE_BAYTRAIL is not set +# CONFIG_I2C_EMEV2 is not set +# CONFIG_I2C_OCORES is not set +# CONFIG_I2C_PCA_PLATFORM is not set +# CONFIG_I2C_PXA_PCI is not set +# CONFIG_I2C_SIMTEC is not set +# CONFIG_I2C_XILINX is not set + +# +# External I2C/SMBus adapter drivers +# +# CONFIG_I2C_DIOLAN_U2C is not set +# CONFIG_I2C_PARPORT_LIGHT is not set +# CONFIG_I2C_ROBOTFUZZ_OSIF is not set +# CONFIG_I2C_TAOS_EVM is not set +# CONFIG_I2C_TINY_USB is not set + +# +# Other I2C/SMBus bus drivers +# +# CONFIG_I2C_STUB is not set +# CONFIG_I2C_SLAVE is not set +# CONFIG_I2C_DEBUG_CORE is not set +# CONFIG_I2C_DEBUG_ALGO is not set +# CONFIG_I2C_DEBUG_BUS is not set +# CONFIG_SPI is not set +# CONFIG_SPMI is not set +# CONFIG_HSI is not set + +# +# PPS support +# +CONFIG_PPS=y +# CONFIG_PPS_DEBUG is not set + +# +# PPS clients support +# +# CONFIG_PPS_CLIENT_KTIMER is not set +# CONFIG_PPS_CLIENT_LDISC is not set +# CONFIG_PPS_CLIENT_GPIO is not set + +# +# PPS generators support +# + +# +# PTP clock support +# +CONFIG_PTP_1588_CLOCK=y + +# +# Enable PHYLIB and NETWORK_PHY_TIMESTAMPING to see the additional clocks. +# +CONFIG_PINCTRL=y + +# +# Pin controllers +# +# CONFIG_DEBUG_PINCTRL is not set +# CONFIG_PINCTRL_CHERRYVIEW is not set +# CONFIG_PINCTRL_BROXTON is not set +# CONFIG_PINCTRL_SUNRISEPOINT is not set +CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y +# CONFIG_GPIOLIB is not set +# CONFIG_W1 is not set +CONFIG_POWER_SUPPLY=y +# CONFIG_POWER_SUPPLY_DEBUG is not set +# CONFIG_PDA_POWER is not set +# CONFIG_TEST_POWER is not set +# CONFIG_BATTERY_DS2780 is not set +# CONFIG_BATTERY_DS2781 is not set +# CONFIG_BATTERY_DS2782 is not set +# CONFIG_BATTERY_SBS is not set +# CONFIG_BATTERY_BQ27XXX is not set +# CONFIG_BATTERY_MAX17040 is not set +# CONFIG_BATTERY_MAX17042 is not set +# CONFIG_CHARGER_MAX8903 is not set +# CONFIG_CHARGER_LP8727 is not set +# CONFIG_CHARGER_BQ2415X is not set +# CONFIG_CHARGER_SMB347 is not set +# CONFIG_BATTERY_GAUGE_LTC2941 is not set +# CONFIG_POWER_RESET is not set +# CONFIG_POWER_AVS is not set +CONFIG_HWMON=y +CONFIG_HWMON_VID=y +# CONFIG_HWMON_DEBUG_CHIP is not set + +# +# Native drivers +# +# CONFIG_SENSORS_ABITUGURU is not set +# CONFIG_SENSORS_ABITUGURU3 is not set +# CONFIG_SENSORS_AD7414 is not set +# CONFIG_SENSORS_AD7418 is not set +# CONFIG_SENSORS_ADM1021 is not set +# CONFIG_SENSORS_ADM1025 is not set +# CONFIG_SENSORS_ADM1026 is not set +# CONFIG_SENSORS_ADM1029 is not set +# CONFIG_SENSORS_ADM1031 is not set +# CONFIG_SENSORS_ADM9240 is not set +# CONFIG_SENSORS_ADT7410 is not set +# CONFIG_SENSORS_ADT7411 is not set +# CONFIG_SENSORS_ADT7462 is not set +# CONFIG_SENSORS_ADT7470 is not set +# CONFIG_SENSORS_ADT7475 is not set +# CONFIG_SENSORS_ASC7621 is not set +CONFIG_SENSORS_K8TEMP=m +CONFIG_SENSORS_K10TEMP=m +CONFIG_SENSORS_FAM15H_POWER=m +# CONFIG_SENSORS_APPLESMC is not set +# CONFIG_SENSORS_ASB100 is not set +# CONFIG_SENSORS_ATXP1 is not set +# CONFIG_SENSORS_DS620 is not set +# CONFIG_SENSORS_DS1621 is not set +# CONFIG_SENSORS_DELL_SMM is not set +# CONFIG_SENSORS_I5K_AMB is not set +# CONFIG_SENSORS_F71805F is not set +# CONFIG_SENSORS_F71882FG is not set +# CONFIG_SENSORS_F75375S is not set +# CONFIG_SENSORS_FSCHMD is not set +# CONFIG_SENSORS_GL518SM is not set +# CONFIG_SENSORS_GL520SM is not set +# CONFIG_SENSORS_G760A is not set +# CONFIG_SENSORS_G762 is not set +# CONFIG_SENSORS_HIH6130 is not set +# CONFIG_SENSORS_I5500 is not set +CONFIG_SENSORS_CORETEMP=y +CONFIG_SENSORS_IT87=m +# CONFIG_SENSORS_JC42 is not set +# CONFIG_SENSORS_POWR1220 is not set +# CONFIG_SENSORS_LINEAGE is not set +# CONFIG_SENSORS_LTC2945 is not set +# CONFIG_SENSORS_LTC2990 is not set +# CONFIG_SENSORS_LTC4151 is not set +# CONFIG_SENSORS_LTC4215 is not set +# CONFIG_SENSORS_LTC4222 is not set +# CONFIG_SENSORS_LTC4245 is not set +# CONFIG_SENSORS_LTC4260 is not set +# CONFIG_SENSORS_LTC4261 is not set +# CONFIG_SENSORS_MAX16065 is not set +# CONFIG_SENSORS_MAX1619 is not set +# CONFIG_SENSORS_MAX1668 is not set +# CONFIG_SENSORS_MAX197 is not set +# CONFIG_SENSORS_MAX6639 is not set +# CONFIG_SENSORS_MAX6642 is not set +# CONFIG_SENSORS_MAX6650 is not set +# CONFIG_SENSORS_MAX6697 is not set +# CONFIG_SENSORS_MAX31790 is not set +# CONFIG_SENSORS_MCP3021 is not set +# CONFIG_SENSORS_LM63 is not set +# CONFIG_SENSORS_LM73 is not set +# CONFIG_SENSORS_LM75 is not set +# CONFIG_SENSORS_LM77 is not set +# CONFIG_SENSORS_LM78 is not set +# CONFIG_SENSORS_LM80 is not set +# CONFIG_SENSORS_LM83 is not set +# CONFIG_SENSORS_LM85 is not set +# CONFIG_SENSORS_LM87 is not set +# CONFIG_SENSORS_LM90 is not set +# CONFIG_SENSORS_LM92 is not set +# CONFIG_SENSORS_LM93 is not set +# CONFIG_SENSORS_LM95234 is not set +# CONFIG_SENSORS_LM95241 is not set +# CONFIG_SENSORS_LM95245 is not set +# CONFIG_SENSORS_PC87360 is not set +# CONFIG_SENSORS_PC87427 is not set +# CONFIG_SENSORS_NTC_THERMISTOR is not set +# CONFIG_SENSORS_NCT6683 is not set +# CONFIG_SENSORS_NCT6775 is not set +# CONFIG_SENSORS_NCT7802 is not set +# CONFIG_SENSORS_NCT7904 is not set +# CONFIG_SENSORS_PCF8591 is not set +# CONFIG_PMBUS is not set +# CONFIG_SENSORS_SHT21 is not set +# CONFIG_SENSORS_SHTC1 is not set +# CONFIG_SENSORS_SIS5595 is not set +# CONFIG_SENSORS_DME1737 is not set +# CONFIG_SENSORS_EMC1403 is not set +# CONFIG_SENSORS_EMC2103 is not set +# CONFIG_SENSORS_EMC6W201 is not set +# CONFIG_SENSORS_SMSC47M1 is not set +# CONFIG_SENSORS_SMSC47M192 is not set +# CONFIG_SENSORS_SMSC47B397 is not set +# CONFIG_SENSORS_SCH56XX_COMMON is not set +# CONFIG_SENSORS_SMM665 is not set +# CONFIG_SENSORS_ADC128D818 is not set +# CONFIG_SENSORS_ADS1015 is not set +# CONFIG_SENSORS_ADS7828 is not set +# CONFIG_SENSORS_AMC6821 is not set +# CONFIG_SENSORS_INA209 is not set +# CONFIG_SENSORS_INA2XX is not set +# CONFIG_SENSORS_TC74 is not set +# CONFIG_SENSORS_THMC50 is not set +# CONFIG_SENSORS_TMP102 is not set +# CONFIG_SENSORS_TMP103 is not set +# CONFIG_SENSORS_TMP401 is not set +# CONFIG_SENSORS_TMP421 is not set +# CONFIG_SENSORS_VIA_CPUTEMP is not set +# CONFIG_SENSORS_VIA686A is not set +# CONFIG_SENSORS_VT1211 is not set +# CONFIG_SENSORS_VT8231 is not set +# CONFIG_SENSORS_W83781D is not set +# CONFIG_SENSORS_W83791D is not set +# CONFIG_SENSORS_W83792D is not set +# CONFIG_SENSORS_W83793 is not set +# CONFIG_SENSORS_W83795 is not set +# CONFIG_SENSORS_W83L785TS is not set +# CONFIG_SENSORS_W83L786NG is not set +# CONFIG_SENSORS_W83627HF is not set +CONFIG_SENSORS_W83627EHF=y + +# +# ACPI drivers +# +# CONFIG_SENSORS_ACPI_POWER is not set +CONFIG_SENSORS_ATK0110=m +CONFIG_THERMAL=y +CONFIG_THERMAL_HWMON=y +CONFIG_THERMAL_WRITABLE_TRIPS=y +CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE=y +# CONFIG_THERMAL_DEFAULT_GOV_FAIR_SHARE is not set +# CONFIG_THERMAL_DEFAULT_GOV_USER_SPACE is not set +# CONFIG_THERMAL_DEFAULT_GOV_POWER_ALLOCATOR is not set +# CONFIG_THERMAL_GOV_FAIR_SHARE is not set +CONFIG_THERMAL_GOV_STEP_WISE=y +# CONFIG_THERMAL_GOV_BANG_BANG is not set +# CONFIG_THERMAL_GOV_USER_SPACE is not set +# CONFIG_THERMAL_GOV_POWER_ALLOCATOR is not set +# CONFIG_THERMAL_EMULATION is not set +CONFIG_INTEL_POWERCLAMP=m +CONFIG_INTEL_SOC_DTS_IOSF_CORE=m +CONFIG_INTEL_SOC_DTS_THERMAL=m +# CONFIG_INT340X_THERMAL is not set +# CONFIG_INTEL_PCH_THERMAL is not set +# CONFIG_WATCHDOG is not set +CONFIG_SSB_POSSIBLE=y + +# +# Sonics Silicon Backplane +# +CONFIG_SSB=y +CONFIG_SSB_SPROM=y +CONFIG_SSB_PCIHOST_POSSIBLE=y +CONFIG_SSB_PCIHOST=y +# CONFIG_SSB_B43_PCI_BRIDGE is not set +CONFIG_SSB_SDIOHOST_POSSIBLE=y +CONFIG_SSB_SDIOHOST=y +# CONFIG_SSB_SILENT is not set +# CONFIG_SSB_DEBUG is not set +CONFIG_SSB_DRIVER_PCICORE_POSSIBLE=y +CONFIG_SSB_DRIVER_PCICORE=y +CONFIG_BCMA_POSSIBLE=y + +# +# Broadcom specific AMBA +# +CONFIG_BCMA=m +CONFIG_BCMA_HOST_PCI_POSSIBLE=y +CONFIG_BCMA_HOST_PCI=y +# CONFIG_BCMA_HOST_SOC is not set +CONFIG_BCMA_DRIVER_PCI=y +CONFIG_BCMA_DRIVER_GMAC_CMN=y +# CONFIG_BCMA_DEBUG is not set + +# +# Multifunction device drivers +# +CONFIG_MFD_CORE=y +# CONFIG_MFD_AS3711 is not set +# CONFIG_PMIC_ADP5520 is not set +# CONFIG_MFD_BCM590XX is not set +# CONFIG_MFD_AXP20X_I2C is not set +# CONFIG_MFD_CROS_EC is not set +# CONFIG_PMIC_DA903X is not set +# CONFIG_MFD_DA9052_I2C is not set +# CONFIG_MFD_DA9055 is not set +# CONFIG_MFD_DA9062 is not set +# CONFIG_MFD_DA9063 is not set +# CONFIG_MFD_DA9150 is not set +# CONFIG_MFD_DLN2 is not set +# CONFIG_MFD_MC13XXX_I2C is not set +# CONFIG_HTC_PASIC3 is not set +# CONFIG_MFD_INTEL_QUARK_I2C_GPIO is not set +# CONFIG_LPC_ICH is not set +CONFIG_LPC_SCH=y +# CONFIG_MFD_INTEL_LPSS_ACPI is not set +# CONFIG_MFD_INTEL_LPSS_PCI is not set +# CONFIG_MFD_JANZ_CMODIO is not set +# CONFIG_MFD_KEMPLD is not set +# CONFIG_MFD_88PM800 is not set +# CONFIG_MFD_88PM805 is not set +# CONFIG_MFD_88PM860X is not set +# CONFIG_MFD_MAX14577 is not set +# CONFIG_MFD_MAX77693 is not set +# CONFIG_MFD_MAX77843 is not set +# CONFIG_MFD_MAX8907 is not set +# CONFIG_MFD_MAX8925 is not set +# CONFIG_MFD_MAX8997 is not set +# CONFIG_MFD_MAX8998 is not set +# CONFIG_MFD_MT6397 is not set +# CONFIG_MFD_MENF21BMC is not set +# CONFIG_MFD_VIPERBOARD is not set +# CONFIG_MFD_RETU is not set +# CONFIG_MFD_PCF50633 is not set +# CONFIG_MFD_RDC321X is not set +CONFIG_MFD_RTSX_PCI=y +# CONFIG_MFD_RT5033 is not set +CONFIG_MFD_RTSX_USB=y +# CONFIG_MFD_RC5T583 is not set +# CONFIG_MFD_RN5T618 is not set +# CONFIG_MFD_SEC_CORE is not set +# CONFIG_MFD_SI476X_CORE is not set +# CONFIG_MFD_SM501 is not set +# CONFIG_MFD_SKY81452 is not set +# CONFIG_MFD_SMSC is not set +# CONFIG_ABX500_CORE is not set +# CONFIG_MFD_SYSCON is not set +# CONFIG_MFD_TI_AM335X_TSCADC is not set +# CONFIG_MFD_LP3943 is not set +# CONFIG_MFD_LP8788 is not set +# CONFIG_MFD_PALMAS is not set +# CONFIG_TPS6105X is not set +# CONFIG_TPS6507X is not set +# CONFIG_MFD_TPS65086 is not set +# CONFIG_MFD_TPS65090 is not set +# CONFIG_MFD_TPS65217 is not set +# CONFIG_MFD_TPS65218 is not set +# CONFIG_MFD_TPS6586X is not set +# CONFIG_MFD_TPS65912_I2C is not set +# CONFIG_MFD_TPS80031 is not set +# CONFIG_TWL4030_CORE is not set +# CONFIG_TWL6040_CORE is not set +# CONFIG_MFD_WL1273_CORE is not set +# CONFIG_MFD_LM3533 is not set +# CONFIG_MFD_TMIO is not set +# CONFIG_MFD_VX855 is not set +# CONFIG_MFD_ARIZONA_I2C is not set +# CONFIG_MFD_WM8400 is not set +# CONFIG_MFD_WM831X_I2C is not set +# CONFIG_MFD_WM8350_I2C is not set +# CONFIG_MFD_WM8994 is not set +# CONFIG_REGULATOR is not set +CONFIG_MEDIA_SUPPORT=m + +# +# Multimedia core support +# +CONFIG_MEDIA_CAMERA_SUPPORT=y +CONFIG_MEDIA_ANALOG_TV_SUPPORT=y +CONFIG_MEDIA_DIGITAL_TV_SUPPORT=y +# CONFIG_MEDIA_RADIO_SUPPORT is not set +# CONFIG_MEDIA_SDR_SUPPORT is not set +CONFIG_MEDIA_RC_SUPPORT=y +# CONFIG_MEDIA_CONTROLLER is not set +CONFIG_VIDEO_DEV=m +CONFIG_VIDEO_V4L2=m +# CONFIG_VIDEO_ADV_DEBUG is not set +# CONFIG_VIDEO_FIXED_MINOR_RANGES is not set +CONFIG_VIDEO_TUNER=m +CONFIG_VIDEOBUF_GEN=m +CONFIG_VIDEOBUF_DMA_SG=m +CONFIG_VIDEOBUF_VMALLOC=m +CONFIG_VIDEOBUF_DVB=m +CONFIG_VIDEOBUF2_CORE=m +CONFIG_VIDEOBUF2_MEMOPS=m +CONFIG_VIDEOBUF2_VMALLOC=m +CONFIG_VIDEOBUF2_DMA_SG=m +CONFIG_VIDEOBUF2_DVB=m +CONFIG_DVB_CORE=m +CONFIG_DVB_NET=y +CONFIG_TTPCI_EEPROM=m +CONFIG_DVB_MAX_ADAPTERS=8 +# CONFIG_DVB_DYNAMIC_MINORS is not set + +# +# Media drivers +# +CONFIG_RC_CORE=m +CONFIG_RC_MAP=m +CONFIG_RC_DECODERS=y +CONFIG_LIRC=m +CONFIG_IR_LIRC_CODEC=m +CONFIG_IR_NEC_DECODER=m +CONFIG_IR_RC5_DECODER=m +CONFIG_IR_RC6_DECODER=m +CONFIG_IR_JVC_DECODER=m +CONFIG_IR_SONY_DECODER=m +CONFIG_IR_SANYO_DECODER=m +CONFIG_IR_SHARP_DECODER=m +CONFIG_IR_MCE_KBD_DECODER=m +CONFIG_IR_XMP_DECODER=m +CONFIG_RC_DEVICES=y +CONFIG_RC_ATI_REMOTE=m +CONFIG_IR_ENE=m +# CONFIG_IR_HIX5HD2 is not set +CONFIG_IR_IMON=m +CONFIG_IR_MCEUSB=m +CONFIG_IR_ITE_CIR=m +CONFIG_IR_FINTEK=m +CONFIG_IR_NUVOTON=m +CONFIG_IR_REDRAT3=m +CONFIG_IR_STREAMZAP=m +CONFIG_IR_WINBOND_CIR=m +CONFIG_IR_IGORPLUGUSB=m +CONFIG_IR_IGUANA=m +CONFIG_IR_TTUSBIR=m +# CONFIG_RC_LOOPBACK is not set +# CONFIG_IR_GPIO_CIR is not set +CONFIG_MEDIA_USB_SUPPORT=y + +# +# Webcam devices +# +# CONFIG_USB_VIDEO_CLASS is not set +# CONFIG_USB_GSPCA is not set +# CONFIG_USB_PWC is not set +# CONFIG_VIDEO_CPIA2 is not set +# CONFIG_USB_ZR364XX is not set +# CONFIG_USB_STKWEBCAM is not set +# CONFIG_USB_S2255 is not set +CONFIG_VIDEO_USBTV=m + +# +# Analog TV USB devices +# +CONFIG_VIDEO_PVRUSB2=m +CONFIG_VIDEO_PVRUSB2_SYSFS=y +CONFIG_VIDEO_PVRUSB2_DVB=y +# CONFIG_VIDEO_PVRUSB2_DEBUGIFC is not set +# CONFIG_VIDEO_HDPVR is not set +# CONFIG_VIDEO_USBVISION is not set +CONFIG_VIDEO_STK1160_COMMON=m +# CONFIG_VIDEO_STK1160_AC97 is not set +CONFIG_VIDEO_STK1160=m +# CONFIG_VIDEO_GO7007 is not set + +# +# Analog/digital TV USB devices +# +CONFIG_VIDEO_AU0828=m +CONFIG_VIDEO_AU0828_V4L2=y +CONFIG_VIDEO_AU0828_RC=y +CONFIG_VIDEO_CX231XX=m +CONFIG_VIDEO_CX231XX_RC=y +# CONFIG_VIDEO_CX231XX_ALSA is not set +CONFIG_VIDEO_CX231XX_DVB=m +CONFIG_VIDEO_TM6000=m +# CONFIG_VIDEO_TM6000_ALSA is not set +CONFIG_VIDEO_TM6000_DVB=m + +# +# Digital TV USB devices +# +CONFIG_DVB_USB=m +# CONFIG_DVB_USB_DEBUG is not set +# CONFIG_DVB_USB_A800 is not set +CONFIG_DVB_USB_DIBUSB_MB=m +CONFIG_DVB_USB_DIBUSB_MB_FAULTY=y +CONFIG_DVB_USB_DIBUSB_MC=m +CONFIG_DVB_USB_DIB0700=m +# CONFIG_DVB_USB_UMT_010 is not set +CONFIG_DVB_USB_CXUSB=m +# CONFIG_DVB_USB_M920X is not set +# CONFIG_DVB_USB_DIGITV is not set +CONFIG_DVB_USB_VP7045=m +# CONFIG_DVB_USB_VP702X is not set +# CONFIG_DVB_USB_GP8PSK is not set +CONFIG_DVB_USB_NOVA_T_USB2=m +CONFIG_DVB_USB_TTUSB2=m +CONFIG_DVB_USB_DTT200U=m +CONFIG_DVB_USB_OPERA1=m +CONFIG_DVB_USB_AF9005=m +CONFIG_DVB_USB_AF9005_REMOTE=m +CONFIG_DVB_USB_PCTV452E=m +CONFIG_DVB_USB_DW2102=m +CONFIG_DVB_USB_CINERGY_T2=m +CONFIG_DVB_USB_DTV5100=m +# CONFIG_DVB_USB_FRIIO is not set +CONFIG_DVB_USB_AZ6027=m +CONFIG_DVB_USB_TECHNISAT_USB2=m +CONFIG_DVB_USB_V2=m +CONFIG_DVB_USB_AF9015=m +CONFIG_DVB_USB_AF9035=m +CONFIG_DVB_USB_ANYSEE=m +# CONFIG_DVB_USB_AU6610 is not set +CONFIG_DVB_USB_AZ6007=m +CONFIG_DVB_USB_CE6230=m +CONFIG_DVB_USB_EC168=m +# CONFIG_DVB_USB_GL861 is not set +CONFIG_DVB_USB_LME2510=m +# CONFIG_DVB_USB_MXL111SF is not set +CONFIG_DVB_USB_RTL28XXU=m +CONFIG_DVB_USB_DVBSKY=m +# CONFIG_DVB_TTUSB_BUDGET is not set +# CONFIG_DVB_TTUSB_DEC is not set +CONFIG_SMS_USB_DRV=m +CONFIG_DVB_B2C2_FLEXCOP_USB=m +# CONFIG_DVB_B2C2_FLEXCOP_USB_DEBUG is not set +CONFIG_DVB_AS102=m + +# +# Webcam, TV (analog/digital) USB devices +# +CONFIG_VIDEO_EM28XX=m +# CONFIG_VIDEO_EM28XX_V4L2 is not set +# CONFIG_VIDEO_EM28XX_ALSA is not set +CONFIG_VIDEO_EM28XX_DVB=m +CONFIG_VIDEO_EM28XX_RC=m +CONFIG_MEDIA_PCI_SUPPORT=y + +# +# Media capture support +# +# CONFIG_VIDEO_SOLO6X10 is not set +# CONFIG_VIDEO_TW68 is not set +# CONFIG_VIDEO_ZORAN is not set + +# +# Media capture/analog TV support +# +# CONFIG_VIDEO_IVTV is not set +# CONFIG_VIDEO_HEXIUM_GEMINI is not set +# CONFIG_VIDEO_HEXIUM_ORION is not set +# CONFIG_VIDEO_MXB is not set +# CONFIG_VIDEO_DT3155 is not set + +# +# Media capture/analog/hybrid TV support +# +CONFIG_VIDEO_CX18=m +# CONFIG_VIDEO_CX18_ALSA is not set +CONFIG_VIDEO_CX23885=m +CONFIG_MEDIA_ALTERA_CI=m +# CONFIG_VIDEO_CX25821 is not set +CONFIG_VIDEO_CX88=m +# CONFIG_VIDEO_CX88_ALSA is not set +# CONFIG_VIDEO_CX88_BLACKBIRD is not set +CONFIG_VIDEO_CX88_DVB=m +CONFIG_VIDEO_CX88_ENABLE_VP3054=y +CONFIG_VIDEO_CX88_VP3054=m +CONFIG_VIDEO_CX88_MPEG=m +CONFIG_VIDEO_SAA7134=m +# CONFIG_VIDEO_SAA7134_ALSA is not set +CONFIG_VIDEO_SAA7134_RC=y +CONFIG_VIDEO_SAA7134_DVB=m +CONFIG_VIDEO_SAA7164=m + +# +# Media digital TV PCI Adapters +# +CONFIG_DVB_AV7110_IR=y +CONFIG_DVB_AV7110=m +CONFIG_DVB_AV7110_OSD=y +CONFIG_DVB_BUDGET_CORE=m +CONFIG_DVB_BUDGET=m +CONFIG_DVB_BUDGET_CI=m +CONFIG_DVB_BUDGET_AV=m +CONFIG_DVB_BUDGET_PATCH=m +CONFIG_DVB_B2C2_FLEXCOP_PCI=m +# CONFIG_DVB_B2C2_FLEXCOP_PCI_DEBUG is not set +# CONFIG_DVB_PLUTO2 is not set +CONFIG_DVB_DM1105=m +# CONFIG_DVB_PT1 is not set +# CONFIG_DVB_PT3 is not set +CONFIG_MANTIS_CORE=m +CONFIG_DVB_MANTIS=m +# CONFIG_DVB_HOPPER is not set +CONFIG_DVB_NGENE=m +CONFIG_DVB_DDBRIDGE=m +CONFIG_DVB_SMIPCIE=m +# CONFIG_V4L_PLATFORM_DRIVERS is not set +# CONFIG_V4L_MEM2MEM_DRIVERS is not set +# CONFIG_V4L_TEST_DRIVERS is not set +# CONFIG_DVB_PLATFORM_DRIVERS is not set + +# +# Supported MMC/SDIO adapters +# +CONFIG_SMS_SDIO_DRV=m + +# +# Supported FireWire (IEEE 1394) Adapters +# +CONFIG_DVB_FIREDTV=m +CONFIG_DVB_FIREDTV_INPUT=y +CONFIG_MEDIA_COMMON_OPTIONS=y + +# +# common driver options +# +CONFIG_VIDEO_CX2341X=m +CONFIG_VIDEO_TVEEPROM=m +CONFIG_CYPRESS_FIRMWARE=m +CONFIG_DVB_B2C2_FLEXCOP=m +CONFIG_VIDEO_SAA7146=m +CONFIG_VIDEO_SAA7146_VV=m +CONFIG_SMS_SIANO_MDTV=m +CONFIG_SMS_SIANO_RC=y +# CONFIG_SMS_SIANO_DEBUGFS is not set + +# +# Media ancillary drivers (tuners, sensors, i2c, frontends) +# +CONFIG_MEDIA_SUBDRV_AUTOSELECT=y +CONFIG_MEDIA_ATTACH=y +CONFIG_VIDEO_IR_I2C=m + +# +# Audio decoders, processors and mixers +# +CONFIG_VIDEO_MSP3400=m +CONFIG_VIDEO_CS3308=m +CONFIG_VIDEO_CS5345=m +CONFIG_VIDEO_CS53L32A=m +CONFIG_VIDEO_WM8775=m + +# +# RDS decoders +# +CONFIG_VIDEO_SAA6588=m + +# +# Video decoders +# +CONFIG_VIDEO_SAA711X=m + +# +# Video and audio decoders +# +CONFIG_VIDEO_CX25840=m + +# +# Video encoders +# + +# +# Camera sensor devices +# + +# +# Flash devices +# + +# +# Video improvement chips +# + +# +# Audio/Video compression chips +# +CONFIG_VIDEO_SAA6752HS=m + +# +# Miscellaneous helper chips +# + +# +# Sensors used on soc_camera driver +# +CONFIG_MEDIA_TUNER=m +CONFIG_MEDIA_TUNER_SIMPLE=m +CONFIG_MEDIA_TUNER_TDA8290=m +CONFIG_MEDIA_TUNER_TDA827X=m +CONFIG_MEDIA_TUNER_TDA18271=m +CONFIG_MEDIA_TUNER_TDA9887=m +CONFIG_MEDIA_TUNER_MT20XX=m +CONFIG_MEDIA_TUNER_MT2060=m +CONFIG_MEDIA_TUNER_MT2063=m +CONFIG_MEDIA_TUNER_MT2266=m +CONFIG_MEDIA_TUNER_MT2131=m +CONFIG_MEDIA_TUNER_QT1010=m +CONFIG_MEDIA_TUNER_XC2028=m +CONFIG_MEDIA_TUNER_XC5000=m +CONFIG_MEDIA_TUNER_XC4000=m +CONFIG_MEDIA_TUNER_MXL5005S=m +CONFIG_MEDIA_TUNER_MXL5007T=m +CONFIG_MEDIA_TUNER_MC44S803=m +CONFIG_MEDIA_TUNER_MAX2165=m +CONFIG_MEDIA_TUNER_TDA18218=m +CONFIG_MEDIA_TUNER_FC0011=m +CONFIG_MEDIA_TUNER_FC0012=m +CONFIG_MEDIA_TUNER_FC0013=m +CONFIG_MEDIA_TUNER_TDA18212=m +CONFIG_MEDIA_TUNER_E4000=m +CONFIG_MEDIA_TUNER_FC2580=m +CONFIG_MEDIA_TUNER_M88RS6000T=m +CONFIG_MEDIA_TUNER_TUA9001=m +CONFIG_MEDIA_TUNER_SI2157=m +CONFIG_MEDIA_TUNER_IT913X=m +CONFIG_MEDIA_TUNER_R820T=m + +# +# Multistandard (satellite) frontends +# +CONFIG_DVB_STB0899=m +CONFIG_DVB_STB6100=m +CONFIG_DVB_STV090x=m +CONFIG_DVB_STV6110x=m +CONFIG_DVB_M88DS3103=m + +# +# Multistandard (cable + terrestrial) frontends +# +CONFIG_DVB_DRXK=m +CONFIG_DVB_TDA18271C2DD=m +CONFIG_DVB_SI2165=m + +# +# DVB-S (satellite) frontends +# +CONFIG_DVB_CX24123=m +CONFIG_DVB_MT312=m +CONFIG_DVB_ZL10036=m +CONFIG_DVB_ZL10039=m +CONFIG_DVB_S5H1420=m +CONFIG_DVB_STV0288=m +CONFIG_DVB_STB6000=m +CONFIG_DVB_STV0299=m +CONFIG_DVB_STV6110=m +CONFIG_DVB_STV0900=m +CONFIG_DVB_TDA8083=m +CONFIG_DVB_TDA10086=m +CONFIG_DVB_TDA8261=m +CONFIG_DVB_VES1X93=m +CONFIG_DVB_TUNER_ITD1000=m +CONFIG_DVB_TUNER_CX24113=m +CONFIG_DVB_TDA826X=m +CONFIG_DVB_TUA6100=m +CONFIG_DVB_CX24116=m +CONFIG_DVB_CX24117=m +CONFIG_DVB_CX24120=m +CONFIG_DVB_SI21XX=m +CONFIG_DVB_TS2020=m +CONFIG_DVB_DS3000=m +CONFIG_DVB_MB86A16=m +CONFIG_DVB_TDA10071=m + +# +# DVB-T (terrestrial) frontends +# +CONFIG_DVB_SP8870=m +CONFIG_DVB_CX22702=m +CONFIG_DVB_DRXD=m +CONFIG_DVB_L64781=m +CONFIG_DVB_TDA1004X=m +CONFIG_DVB_MT352=m +CONFIG_DVB_ZL10353=m +CONFIG_DVB_DIB3000MB=m +CONFIG_DVB_DIB3000MC=m +CONFIG_DVB_DIB7000M=m +CONFIG_DVB_DIB7000P=m +CONFIG_DVB_TDA10048=m +CONFIG_DVB_AF9013=m +CONFIG_DVB_EC100=m +CONFIG_DVB_STV0367=m +CONFIG_DVB_CXD2820R=m +CONFIG_DVB_RTL2830=m +CONFIG_DVB_RTL2832=m +CONFIG_DVB_SI2168=m +CONFIG_DVB_AS102_FE=m + +# +# DVB-C (cable) frontends +# +CONFIG_DVB_VES1820=m +CONFIG_DVB_TDA10021=m +CONFIG_DVB_TDA10023=m +CONFIG_DVB_STV0297=m + +# +# ATSC (North American/Korean Terrestrial/Cable DTV) frontends +# +CONFIG_DVB_NXT200X=m +CONFIG_DVB_OR51132=m +CONFIG_DVB_BCM3510=m +CONFIG_DVB_LGDT330X=m +CONFIG_DVB_LGDT3305=m +CONFIG_DVB_LGDT3306A=m +CONFIG_DVB_S5H1409=m +CONFIG_DVB_AU8522=m +CONFIG_DVB_AU8522_DTV=m +CONFIG_DVB_AU8522_V4L=m +CONFIG_DVB_S5H1411=m + +# +# ISDB-T (terrestrial) frontends +# +CONFIG_DVB_S921=m +CONFIG_DVB_DIB8000=m +CONFIG_DVB_MB86A20S=m + +# +# ISDB-S (satellite) & ISDB-T (terrestrial) frontends +# + +# +# Digital terrestrial only tuners/PLL +# +CONFIG_DVB_PLL=m +CONFIG_DVB_TUNER_DIB0070=m +CONFIG_DVB_TUNER_DIB0090=m + +# +# SEC control devices for DVB-S +# +CONFIG_DVB_DRX39XYJ=m +CONFIG_DVB_LNBP21=m +CONFIG_DVB_LNBP22=m +CONFIG_DVB_ISL6405=m +CONFIG_DVB_ISL6421=m +CONFIG_DVB_ISL6423=m +CONFIG_DVB_A8293=m +CONFIG_DVB_SP2=m +CONFIG_DVB_LGS8GXX=m +CONFIG_DVB_ATBM8830=m +CONFIG_DVB_TDA665x=m +CONFIG_DVB_IX2505V=m +CONFIG_DVB_M88RS2000=m +CONFIG_DVB_AF9033=m + +# +# Tools to develop new frontends +# +# CONFIG_DVB_DUMMY_FE is not set + +# +# Graphics support +# +CONFIG_AGP=y +# CONFIG_AGP_AMD64 is not set +CONFIG_AGP_INTEL=y +# CONFIG_AGP_SIS is not set +CONFIG_AGP_VIA=y +CONFIG_INTEL_GTT=y +CONFIG_VGA_ARB=y +CONFIG_VGA_ARB_MAX_GPUS=16 +CONFIG_VGA_SWITCHEROO=y +CONFIG_DRM=y +CONFIG_DRM_MIPI_DSI=y +# CONFIG_DRM_DP_AUX_CHARDEV is not set +CONFIG_DRM_KMS_HELPER=y +CONFIG_DRM_KMS_FB_HELPER=y +CONFIG_DRM_FBDEV_EMULATION=y +CONFIG_DRM_LOAD_EDID_FIRMWARE=y +CONFIG_DRM_TTM=y + +# +# I2C encoder or helper chips +# +# CONFIG_DRM_I2C_ADV7511 is not set +# CONFIG_DRM_I2C_CH7006 is not set +# CONFIG_DRM_I2C_SIL164 is not set +# CONFIG_DRM_I2C_NXP_TDA998X is not set +# CONFIG_DRM_TDFX is not set +# CONFIG_DRM_R128 is not set +CONFIG_DRM_RADEON=y +# CONFIG_DRM_RADEON_USERPTR is not set +CONFIG_DRM_AMDGPU=y +# CONFIG_DRM_AMDGPU_CIK is not set +# CONFIG_DRM_AMDGPU_USERPTR is not set +# CONFIG_DRM_AMD_POWERPLAY is not set + +# +# ACP (Audio CoProcessor) Configuration +# +# CONFIG_DRM_AMD_ACP is not set +# CONFIG_DRM_NOUVEAU is not set +# CONFIG_DRM_I810 is not set +CONFIG_DRM_I915=y +# CONFIG_DRM_I915_PRELIMINARY_HW_SUPPORT is not set +CONFIG_DRM_I915_USERPTR=y +# CONFIG_DRM_MGA is not set +# CONFIG_DRM_SIS is not set +# CONFIG_DRM_VIA is not set +# CONFIG_DRM_SAVAGE is not set +# CONFIG_DRM_VGEM is not set +# CONFIG_DRM_VMWGFX is not set +# CONFIG_DRM_GMA500 is not set +# CONFIG_DRM_UDL is not set +# CONFIG_DRM_AST is not set +# CONFIG_DRM_MGAG200 is not set +# CONFIG_DRM_CIRRUS_QEMU is not set +# CONFIG_DRM_QXL is not set +# CONFIG_DRM_BOCHS is not set +# CONFIG_DRM_VIRTIO_GPU is not set +CONFIG_DRM_PANEL=y + +# +# Display Panels +# +CONFIG_DRM_BRIDGE=y + +# +# Display Interface Bridges +# + +# +# Frame buffer Devices +# +CONFIG_FB=y +# CONFIG_FIRMWARE_EDID is not set +CONFIG_FB_CMDLINE=y +CONFIG_FB_NOTIFY=y +# CONFIG_FB_DDC is not set +# CONFIG_FB_BOOT_VESA_SUPPORT is not set +CONFIG_FB_CFB_FILLRECT=y +CONFIG_FB_CFB_COPYAREA=y +CONFIG_FB_CFB_IMAGEBLIT=y +# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set +CONFIG_FB_SYS_FILLRECT=y +CONFIG_FB_SYS_COPYAREA=y +CONFIG_FB_SYS_IMAGEBLIT=y +# CONFIG_FB_FOREIGN_ENDIAN is not set +CONFIG_FB_SYS_FOPS=y +# CONFIG_FB_SVGALIB is not set +# CONFIG_FB_MACMODES is not set +# CONFIG_FB_BACKLIGHT is not set +CONFIG_FB_MODE_HELPERS=y +# CONFIG_FB_TILEBLITTING is not set + +# +# Frame buffer hardware drivers +# +# CONFIG_FB_CIRRUS is not set +# CONFIG_FB_PM2 is not set +# CONFIG_FB_CYBER2000 is not set +# CONFIG_FB_ARC is not set +# CONFIG_FB_ASILIANT is not set +# CONFIG_FB_IMSTT is not set +# CONFIG_FB_VGA16 is not set +CONFIG_FB_UVESA=m +# CONFIG_FB_VESA is not set +CONFIG_FB_EFI=y +# CONFIG_FB_N411 is not set +# CONFIG_FB_HGA is not set +# CONFIG_FB_OPENCORES is not set +# CONFIG_FB_S1D13XXX is not set +# CONFIG_FB_NVIDIA is not set +# CONFIG_FB_RIVA is not set +# CONFIG_FB_I740 is not set +# CONFIG_FB_LE80578 is not set +# CONFIG_FB_MATROX is not set +# CONFIG_FB_RADEON is not set +# CONFIG_FB_ATY128 is not set +# CONFIG_FB_ATY is not set +# CONFIG_FB_S3 is not set +# CONFIG_FB_SAVAGE is not set +# CONFIG_FB_SIS is not set +# CONFIG_FB_NEOMAGIC is not set +# CONFIG_FB_KYRO is not set +# CONFIG_FB_3DFX is not set +# CONFIG_FB_VOODOO1 is not set +# CONFIG_FB_VT8623 is not set +# CONFIG_FB_TRIDENT is not set +# CONFIG_FB_ARK is not set +# CONFIG_FB_PM3 is not set +# CONFIG_FB_CARMINE is not set +# CONFIG_FB_SMSCUFX is not set +# CONFIG_FB_UDL is not set +# CONFIG_FB_IBM_GXT4500 is not set +# CONFIG_FB_VIRTUAL is not set +# CONFIG_FB_METRONOME is not set +# CONFIG_FB_MB862XX is not set +# CONFIG_FB_BROADSHEET is not set +# CONFIG_FB_AUO_K190X is not set +# CONFIG_FB_SIMPLE is not set +# CONFIG_FB_SM712 is not set +CONFIG_BACKLIGHT_LCD_SUPPORT=y +# CONFIG_LCD_CLASS_DEVICE is not set +CONFIG_BACKLIGHT_CLASS_DEVICE=y +# CONFIG_BACKLIGHT_GENERIC is not set +# CONFIG_BACKLIGHT_APPLE is not set +# CONFIG_BACKLIGHT_PM8941_WLED is not set +# CONFIG_BACKLIGHT_SAHARA is not set +# CONFIG_BACKLIGHT_ADP8860 is not set +# CONFIG_BACKLIGHT_ADP8870 is not set +# CONFIG_BACKLIGHT_LM3639 is not set +# CONFIG_BACKLIGHT_LV5207LP is not set +# CONFIG_BACKLIGHT_BD6107 is not set +# CONFIG_VGASTATE is not set +CONFIG_HDMI=y + +# +# Console display driver support +# +CONFIG_VGA_CONSOLE=y +CONFIG_VGACON_SOFT_SCROLLBACK=y +CONFIG_VGACON_SOFT_SCROLLBACK_SIZE=256 +CONFIG_DUMMY_CONSOLE=y +CONFIG_DUMMY_CONSOLE_COLUMNS=80 +CONFIG_DUMMY_CONSOLE_ROWS=25 +CONFIG_FRAMEBUFFER_CONSOLE=y +CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y +# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set +# CONFIG_LOGO is not set +CONFIG_SOUND=y +# CONFIG_SOUND_OSS_CORE is not set +CONFIG_SND=y +CONFIG_SND_TIMER=y +CONFIG_SND_PCM=y +CONFIG_SND_HWDEP=m +CONFIG_SND_RAWMIDI=m +CONFIG_SND_COMPRESS_OFFLOAD=y +CONFIG_SND_JACK=y +CONFIG_SND_JACK_INPUT_DEV=y +# CONFIG_SND_SEQUENCER is not set +# CONFIG_SND_MIXER_OSS is not set +# CONFIG_SND_PCM_OSS is not set +CONFIG_SND_PCM_TIMER=y +CONFIG_SND_HRTIMER=y +CONFIG_SND_DYNAMIC_MINORS=y +CONFIG_SND_MAX_CARDS=32 +# CONFIG_SND_SUPPORT_OLD_API is not set +CONFIG_SND_PROC_FS=y +CONFIG_SND_VERBOSE_PROCFS=y +# CONFIG_SND_VERBOSE_PRINTK is not set +# CONFIG_SND_DEBUG is not set +CONFIG_SND_VMASTER=y +CONFIG_SND_DMA_SGBUF=y +# CONFIG_SND_RAWMIDI_SEQ is not set +# CONFIG_SND_OPL3_LIB_SEQ is not set +# CONFIG_SND_OPL4_LIB_SEQ is not set +# CONFIG_SND_SBAWE_SEQ is not set +# CONFIG_SND_EMU10K1_SEQ is not set +CONFIG_SND_MPU401_UART=m +CONFIG_SND_OPL3_LIB=m +CONFIG_SND_AC97_CODEC=m +# CONFIG_SND_DRIVERS is not set +CONFIG_SND_PCI=y +# CONFIG_SND_AD1889 is not set +# CONFIG_SND_ALS300 is not set +# CONFIG_SND_ALS4000 is not set +# CONFIG_SND_ALI5451 is not set +# CONFIG_SND_ASIHPI is not set +CONFIG_SND_ATIIXP=m +# CONFIG_SND_ATIIXP_MODEM is not set +# CONFIG_SND_AU8810 is not set +# CONFIG_SND_AU8820 is not set +# CONFIG_SND_AU8830 is not set +# CONFIG_SND_AW2 is not set +# CONFIG_SND_AZT3328 is not set +# CONFIG_SND_BT87X is not set +CONFIG_SND_CA0106=m +CONFIG_SND_CMIPCI=m +CONFIG_SND_OXYGEN_LIB=m +CONFIG_SND_OXYGEN=m +# CONFIG_SND_CS4281 is not set +# CONFIG_SND_CS46XX is not set +CONFIG_SND_CTXFI=m +# CONFIG_SND_DARLA20 is not set +# CONFIG_SND_GINA20 is not set +# CONFIG_SND_LAYLA20 is not set +# CONFIG_SND_DARLA24 is not set +# CONFIG_SND_GINA24 is not set +CONFIG_SND_LAYLA24=m +# CONFIG_SND_MONA is not set +# CONFIG_SND_MIA is not set +# CONFIG_SND_ECHO3G is not set +# CONFIG_SND_INDIGO is not set +# CONFIG_SND_INDIGOIO is not set +# CONFIG_SND_INDIGODJ is not set +# CONFIG_SND_INDIGOIOX is not set +# CONFIG_SND_INDIGODJX is not set +CONFIG_SND_EMU10K1=m +CONFIG_SND_EMU10K1X=m +# CONFIG_SND_ENS1370 is not set +# CONFIG_SND_ENS1371 is not set +# CONFIG_SND_ES1938 is not set +# CONFIG_SND_ES1968 is not set +# CONFIG_SND_FM801 is not set +# CONFIG_SND_HDSP is not set +# CONFIG_SND_HDSPM is not set +CONFIG_SND_ICE1712=m +CONFIG_SND_ICE1724=m +CONFIG_SND_INTEL8X0=m +# CONFIG_SND_INTEL8X0M is not set +# CONFIG_SND_KORG1212 is not set +# CONFIG_SND_LOLA is not set +# CONFIG_SND_LX6464ES is not set +# CONFIG_SND_MAESTRO3 is not set +# CONFIG_SND_MIXART is not set +# CONFIG_SND_NM256 is not set +# CONFIG_SND_PCXHR is not set +# CONFIG_SND_RIPTIDE is not set +# CONFIG_SND_RME32 is not set +# CONFIG_SND_RME96 is not set +CONFIG_SND_RME9652=m +# CONFIG_SND_SONICVIBES is not set +# CONFIG_SND_TRIDENT is not set +# CONFIG_SND_VIA82XX is not set +# CONFIG_SND_VIA82XX_MODEM is not set +CONFIG_SND_VIRTUOSO=m +# CONFIG_SND_VX222 is not set +# CONFIG_SND_YMFPCI is not set + +# +# HD-Audio +# +CONFIG_SND_HDA=m +CONFIG_SND_HDA_INTEL=m +CONFIG_SND_HDA_HWDEP=y +CONFIG_SND_HDA_RECONFIG=y +CONFIG_SND_HDA_INPUT_BEEP=y +CONFIG_SND_HDA_INPUT_BEEP_MODE=1 +CONFIG_SND_HDA_PATCH_LOADER=y +CONFIG_SND_HDA_CODEC_REALTEK=m +CONFIG_SND_HDA_CODEC_ANALOG=m +CONFIG_SND_HDA_CODEC_SIGMATEL=m +CONFIG_SND_HDA_CODEC_VIA=m +CONFIG_SND_HDA_CODEC_HDMI=m +CONFIG_SND_HDA_CODEC_CIRRUS=m +CONFIG_SND_HDA_CODEC_CONEXANT=m +CONFIG_SND_HDA_CODEC_CA0110=m +CONFIG_SND_HDA_CODEC_CA0132=m +CONFIG_SND_HDA_CODEC_CA0132_DSP=y +CONFIG_SND_HDA_CODEC_CMEDIA=m +CONFIG_SND_HDA_CODEC_SI3054=m +CONFIG_SND_HDA_GENERIC=m +CONFIG_SND_HDA_POWER_SAVE_DEFAULT=0 +CONFIG_SND_HDA_CORE=m +CONFIG_SND_HDA_DSP_LOADER=y +CONFIG_SND_HDA_I915=y +CONFIG_SND_HDA_PREALLOC_SIZE=2048 +CONFIG_SND_USB=y +CONFIG_SND_USB_AUDIO=m +CONFIG_SND_USB_UA101=m +CONFIG_SND_USB_USX2Y=m +CONFIG_SND_USB_CAIAQ=m +CONFIG_SND_USB_CAIAQ_INPUT=y +CONFIG_SND_USB_US122L=m +CONFIG_SND_USB_6FIRE=m +CONFIG_SND_USB_HIFACE=m +CONFIG_SND_BCD2000=m +CONFIG_SND_USB_LINE6=m +CONFIG_SND_USB_POD=m +CONFIG_SND_USB_PODHD=m +CONFIG_SND_USB_TONEPORT=m +CONFIG_SND_USB_VARIAX=m +CONFIG_SND_FIREWIRE=y +# CONFIG_SND_DICE is not set +# CONFIG_SND_OXFW is not set +# CONFIG_SND_ISIGHT is not set +# CONFIG_SND_FIREWORKS is not set +# CONFIG_SND_BEBOB is not set +# CONFIG_SND_FIREWIRE_DIGI00X is not set +# CONFIG_SND_FIREWIRE_TASCAM is not set +CONFIG_SND_SOC=y +CONFIG_SND_SOC_COMPRESS=y +# CONFIG_SND_SOC_AMD_ACP is not set +# CONFIG_SND_ATMEL_SOC is not set +# CONFIG_SND_DESIGNWARE_I2S is not set + +# +# SoC Audio for Freescale CPUs +# + +# +# Common SoC Audio options for Freescale CPUs: +# +# CONFIG_SND_SOC_FSL_ASRC is not set +# CONFIG_SND_SOC_FSL_SAI is not set +# CONFIG_SND_SOC_FSL_SSI is not set +# CONFIG_SND_SOC_FSL_SPDIF is not set +# CONFIG_SND_SOC_FSL_ESAI is not set +# CONFIG_SND_SOC_IMX_AUDMUX is not set +# CONFIG_SND_SOC_IMG is not set +CONFIG_SND_SST_MFLD_PLATFORM=m +CONFIG_SND_SST_IPC=m +CONFIG_SND_SST_IPC_ACPI=m +CONFIG_SND_SOC_INTEL_SST=m +CONFIG_SND_SOC_INTEL_SST_ACPI=m +CONFIG_SND_SOC_INTEL_SST_MATCH=m +CONFIG_SND_SOC_INTEL_BYTCR_RT5640_MACH=m +# CONFIG_SND_SOC_INTEL_BYTCR_RT5651_MACH is not set +CONFIG_SND_SOC_INTEL_CHT_BSW_RT5672_MACH=m +CONFIG_SND_SOC_INTEL_CHT_BSW_RT5645_MACH=m +CONFIG_SND_SOC_INTEL_CHT_BSW_MAX98090_TI_MACH=m +# CONFIG_SND_SOC_INTEL_SKL_RT286_MACH is not set +# CONFIG_SND_SOC_INTEL_SKL_NAU88L25_SSM4567_MACH is not set +# CONFIG_SND_SOC_INTEL_SKL_NAU88L25_MAX98357A_MACH is not set + +# +# Allwinner SoC Audio support +# +# CONFIG_SND_SUN4I_CODEC is not set +# CONFIG_SND_SOC_XTFPGA_I2S is not set +CONFIG_SND_SOC_I2C_AND_SPI=y + +# +# CODEC drivers +# +# CONFIG_SND_SOC_AC97_CODEC is not set +# CONFIG_SND_SOC_ADAU1701 is not set +# CONFIG_SND_SOC_AK4554 is not set +# CONFIG_SND_SOC_AK4613 is not set +# CONFIG_SND_SOC_AK4642 is not set +# CONFIG_SND_SOC_AK5386 is not set +# CONFIG_SND_SOC_ALC5623 is not set +# CONFIG_SND_SOC_CS35L32 is not set +# CONFIG_SND_SOC_CS42L51_I2C is not set +# CONFIG_SND_SOC_CS42L52 is not set +# CONFIG_SND_SOC_CS42L56 is not set +# CONFIG_SND_SOC_CS42L73 is not set +# CONFIG_SND_SOC_CS4265 is not set +# CONFIG_SND_SOC_CS4270 is not set +# CONFIG_SND_SOC_CS4271_I2C is not set +# CONFIG_SND_SOC_CS42XX8_I2C is not set +# CONFIG_SND_SOC_CS4349 is not set +# CONFIG_SND_SOC_ES8328 is not set +# CONFIG_SND_SOC_GTM601 is not set +# CONFIG_SND_SOC_INNO_RK3036 is not set +CONFIG_SND_SOC_MAX98090=m +# CONFIG_SND_SOC_PCM1681 is not set +# CONFIG_SND_SOC_PCM179X_I2C is not set +# CONFIG_SND_SOC_PCM3168A_I2C is not set +# CONFIG_SND_SOC_PCM512x_I2C is not set +CONFIG_SND_SOC_RL6231=m +# CONFIG_SND_SOC_RT5616 is not set +# CONFIG_SND_SOC_RT5631 is not set +CONFIG_SND_SOC_RT5640=m +CONFIG_SND_SOC_RT5645=m +CONFIG_SND_SOC_RT5670=m +# CONFIG_SND_SOC_RT5677_SPI is not set +# CONFIG_SND_SOC_SGTL5000 is not set +# CONFIG_SND_SOC_SIRF_AUDIO_CODEC is not set +CONFIG_SND_SOC_SPDIF=m +# CONFIG_SND_SOC_SSM2602_I2C is not set +# CONFIG_SND_SOC_SSM4567 is not set +# CONFIG_SND_SOC_STA32X is not set +# CONFIG_SND_SOC_STA350 is not set +# CONFIG_SND_SOC_STI_SAS is not set +# CONFIG_SND_SOC_TAS2552 is not set +# CONFIG_SND_SOC_TAS5086 is not set +# CONFIG_SND_SOC_TAS571X is not set +# CONFIG_SND_SOC_TFA9879 is not set +# CONFIG_SND_SOC_TLV320AIC23_I2C is not set +# CONFIG_SND_SOC_TLV320AIC31XX is not set +# CONFIG_SND_SOC_TLV320AIC3X is not set +CONFIG_SND_SOC_TS3A227E=m +# CONFIG_SND_SOC_WM8510 is not set +# CONFIG_SND_SOC_WM8523 is not set +# CONFIG_SND_SOC_WM8580 is not set +# CONFIG_SND_SOC_WM8711 is not set +# CONFIG_SND_SOC_WM8728 is not set +# CONFIG_SND_SOC_WM8731 is not set +# CONFIG_SND_SOC_WM8737 is not set +# CONFIG_SND_SOC_WM8741 is not set +# CONFIG_SND_SOC_WM8750 is not set +# CONFIG_SND_SOC_WM8753 is not set +# CONFIG_SND_SOC_WM8776 is not set +# CONFIG_SND_SOC_WM8804_I2C is not set +# CONFIG_SND_SOC_WM8903 is not set +# CONFIG_SND_SOC_WM8962 is not set +# CONFIG_SND_SOC_WM8974 is not set +# CONFIG_SND_SOC_WM8978 is not set +# CONFIG_SND_SOC_TPA6130A2 is not set +CONFIG_SND_SIMPLE_CARD=m +# CONFIG_SOUND_PRIME is not set +CONFIG_AC97_BUS=m + +# +# HID support +# +CONFIG_HID=y +# CONFIG_HID_BATTERY_STRENGTH is not set +CONFIG_HIDRAW=y +CONFIG_UHID=y +CONFIG_HID_GENERIC=y + +# +# Special HID drivers +# +CONFIG_HID_A4TECH=y +# CONFIG_HID_ACRUX is not set +CONFIG_HID_APPLE=y +# CONFIG_HID_APPLEIR is not set +CONFIG_HID_AUREAL=y +CONFIG_HID_BELKIN=y +# CONFIG_HID_BETOP_FF is not set +CONFIG_HID_CHERRY=y +CONFIG_HID_CHICONY=y +# CONFIG_HID_CORSAIR is not set +# CONFIG_HID_PRODIKEYS is not set +# CONFIG_HID_CMEDIA is not set +CONFIG_HID_CYPRESS=y +CONFIG_HID_DRAGONRISE=m +CONFIG_DRAGONRISE_FF=y +# CONFIG_HID_EMS_FF is not set +# CONFIG_HID_ELECOM is not set +# CONFIG_HID_ELO is not set +CONFIG_HID_EZKEY=y +# CONFIG_HID_GEMBIRD is not set +# CONFIG_HID_GFRM is not set +# CONFIG_HID_HOLTEK is not set +# CONFIG_HID_GT683R is not set +# CONFIG_HID_KEYTOUCH is not set +CONFIG_HID_KYE=y +# CONFIG_HID_UCLOGIC is not set +# CONFIG_HID_WALTOP is not set +CONFIG_HID_GYRATION=y +# CONFIG_HID_ICADE is not set +CONFIG_HID_TWINHAN=y +CONFIG_HID_KENSINGTON=y +CONFIG_HID_LCPOWER=y +CONFIG_HID_LENOVO=y +CONFIG_HID_LOGITECH=y +CONFIG_HID_LOGITECH_DJ=y +CONFIG_HID_LOGITECH_HIDPP=y +CONFIG_LOGITECH_FF=y +CONFIG_LOGIRUMBLEPAD2_FF=y +CONFIG_LOGIG940_FF=y +CONFIG_LOGIWHEELS_FF=y +# CONFIG_HID_MAGICMOUSE is not set +CONFIG_HID_MICROSOFT=y +CONFIG_HID_MONTEREY=y +# CONFIG_HID_MULTITOUCH is not set +# CONFIG_HID_NTRIG is not set +CONFIG_HID_ORTEK=y +CONFIG_HID_OUYA=y +CONFIG_HID_PANTHERLORD=y +CONFIG_PANTHERLORD_FF=y +CONFIG_HID_PENMOUNT=y +CONFIG_HID_PETALYNX=y +# CONFIG_HID_PICOLCD is not set +# CONFIG_HID_PLANTRONICS is not set +# CONFIG_HID_PRIMAX is not set +# CONFIG_HID_ROCCAT is not set +# CONFIG_HID_SAITEK is not set +CONFIG_HID_SAMSUNG=y +CONFIG_HID_SONY=y +CONFIG_SONY_FF=y +# CONFIG_HID_SPEEDLINK is not set +# CONFIG_HID_STEELSERIES is not set +CONFIG_HID_SPINELPLUS=y +CONFIG_HID_SUNPLUS=y +CONFIG_HID_RMI=y +# CONFIG_HID_GREENASIA is not set +CONFIG_HID_SMARTJOYPLUS=m +CONFIG_SMARTJOYPLUS_FF=y +CONFIG_HID_TIVO=y +CONFIG_HID_TOPSEED=y +# CONFIG_HID_THINGM is not set +# CONFIG_HID_THRUSTMASTER is not set +# CONFIG_HID_WACOM is not set +CONFIG_HID_WIIMOTE=m +CONFIG_HID_XINMO=y +# CONFIG_HID_ZEROPLUS is not set +CONFIG_HID_ZYDACRON=y +# CONFIG_HID_SENSOR_HUB is not set + +# +# USB HID support +# +CONFIG_USB_HID=y +# CONFIG_HID_PID is not set +CONFIG_USB_HIDDEV=y + +# +# I2C HID support +# +# CONFIG_I2C_HID is not set +CONFIG_USB_OHCI_LITTLE_ENDIAN=y +CONFIG_USB_SUPPORT=y +CONFIG_USB_COMMON=y +CONFIG_USB_ARCH_HAS_HCD=y +CONFIG_USB=y +# CONFIG_USB_ANNOUNCE_NEW_DEVICES is not set + +# +# Miscellaneous USB options +# +CONFIG_USB_DEFAULT_PERSIST=y +# CONFIG_USB_DYNAMIC_MINORS is not set +# CONFIG_USB_OTG is not set +# CONFIG_USB_OTG_WHITELIST is not set +# CONFIG_USB_OTG_BLACKLIST_HUB is not set +# CONFIG_USB_ULPI_BUS is not set +# CONFIG_USB_MON is not set +# CONFIG_USB_WUSB_CBAF is not set + +# +# USB Host Controller Drivers +# +# CONFIG_USB_C67X00_HCD is not set +CONFIG_USB_XHCI_HCD=y +CONFIG_USB_XHCI_PCI=y +# CONFIG_USB_XHCI_PLATFORM is not set +CONFIG_USB_EHCI_HCD=y +CONFIG_USB_EHCI_ROOT_HUB_TT=y +CONFIG_USB_EHCI_TT_NEWSCHED=y +CONFIG_USB_EHCI_PCI=y +# CONFIG_USB_EHCI_HCD_PLATFORM is not set +# CONFIG_USB_OXU210HP_HCD is not set +# CONFIG_USB_ISP116X_HCD is not set +# CONFIG_USB_ISP1362_HCD is not set +# CONFIG_USB_FOTG210_HCD is not set +CONFIG_USB_OHCI_HCD=y +CONFIG_USB_OHCI_HCD_PCI=y +# CONFIG_USB_OHCI_HCD_SSB is not set +# CONFIG_USB_OHCI_HCD_PLATFORM is not set +CONFIG_USB_UHCI_HCD=y +# CONFIG_USB_SL811_HCD is not set +# CONFIG_USB_R8A66597_HCD is not set +# CONFIG_USB_HCD_BCMA is not set +# CONFIG_USB_HCD_SSB is not set +# CONFIG_USB_HCD_TEST_MODE is not set + +# +# USB Device Class drivers +# +CONFIG_USB_ACM=m +# CONFIG_USB_PRINTER is not set +# CONFIG_USB_WDM is not set +# CONFIG_USB_TMC is not set + +# +# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may +# + +# +# also be needed; see USB_STORAGE Help for more info +# +CONFIG_USB_STORAGE=y +# CONFIG_USB_STORAGE_DEBUG is not set +# CONFIG_USB_STORAGE_REALTEK is not set +# CONFIG_USB_STORAGE_DATAFAB is not set +# CONFIG_USB_STORAGE_FREECOM is not set +# CONFIG_USB_STORAGE_ISD200 is not set +# CONFIG_USB_STORAGE_USBAT is not set +# CONFIG_USB_STORAGE_SDDR09 is not set +# CONFIG_USB_STORAGE_SDDR55 is not set +# CONFIG_USB_STORAGE_JUMPSHOT is not set +# CONFIG_USB_STORAGE_ALAUDA is not set +# CONFIG_USB_STORAGE_ONETOUCH is not set +# CONFIG_USB_STORAGE_KARMA is not set +# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set +# CONFIG_USB_STORAGE_ENE_UB6250 is not set +CONFIG_USB_UAS=y + +# +# USB Imaging devices +# +# CONFIG_USB_MDC800 is not set +# CONFIG_USB_MICROTEK is not set +# CONFIG_USBIP_CORE is not set +# CONFIG_USB_MUSB_HDRC is not set +# CONFIG_USB_DWC3 is not set +# CONFIG_USB_DWC2 is not set +# CONFIG_USB_CHIPIDEA is not set +# CONFIG_USB_ISP1760 is not set + +# +# USB port drivers +# +CONFIG_USB_SERIAL=m +# CONFIG_USB_SERIAL_GENERIC is not set +# CONFIG_USB_SERIAL_SIMPLE is not set +# CONFIG_USB_SERIAL_AIRCABLE is not set +# CONFIG_USB_SERIAL_ARK3116 is not set +# CONFIG_USB_SERIAL_BELKIN is not set +CONFIG_USB_SERIAL_CH341=m +# CONFIG_USB_SERIAL_WHITEHEAT is not set +# CONFIG_USB_SERIAL_DIGI_ACCELEPORT is not set +CONFIG_USB_SERIAL_CP210X=m +# CONFIG_USB_SERIAL_CYPRESS_M8 is not set +# CONFIG_USB_SERIAL_EMPEG is not set +CONFIG_USB_SERIAL_FTDI_SIO=m +# CONFIG_USB_SERIAL_VISOR is not set +# CONFIG_USB_SERIAL_IPAQ is not set +# CONFIG_USB_SERIAL_IR is not set +# CONFIG_USB_SERIAL_EDGEPORT is not set +# CONFIG_USB_SERIAL_EDGEPORT_TI is not set +# CONFIG_USB_SERIAL_F81232 is not set +# CONFIG_USB_SERIAL_GARMIN is not set +# CONFIG_USB_SERIAL_IPW is not set +CONFIG_USB_SERIAL_IUU=m +# CONFIG_USB_SERIAL_KEYSPAN_PDA is not set +# CONFIG_USB_SERIAL_KEYSPAN is not set +# CONFIG_USB_SERIAL_KLSI is not set +# CONFIG_USB_SERIAL_KOBIL_SCT is not set +# CONFIG_USB_SERIAL_MCT_U232 is not set +# CONFIG_USB_SERIAL_METRO is not set +# CONFIG_USB_SERIAL_MOS7720 is not set +# CONFIG_USB_SERIAL_MOS7840 is not set +# CONFIG_USB_SERIAL_MXUPORT is not set +# CONFIG_USB_SERIAL_NAVMAN is not set +CONFIG_USB_SERIAL_PL2303=m +# CONFIG_USB_SERIAL_OTI6858 is not set +# CONFIG_USB_SERIAL_QCAUX is not set +# CONFIG_USB_SERIAL_QUALCOMM is not set +# CONFIG_USB_SERIAL_SPCP8X5 is not set +# CONFIG_USB_SERIAL_SAFE is not set +# CONFIG_USB_SERIAL_SIERRAWIRELESS is not set +# CONFIG_USB_SERIAL_SYMBOL is not set +# CONFIG_USB_SERIAL_TI is not set +# CONFIG_USB_SERIAL_CYBERJACK is not set +# CONFIG_USB_SERIAL_XIRCOM is not set +# CONFIG_USB_SERIAL_OPTION is not set +# CONFIG_USB_SERIAL_OMNINET is not set +# CONFIG_USB_SERIAL_OPTICON is not set +# CONFIG_USB_SERIAL_XSENS_MT is not set +# CONFIG_USB_SERIAL_WISHBONE is not set +# CONFIG_USB_SERIAL_SSU100 is not set +# CONFIG_USB_SERIAL_QT2 is not set +# CONFIG_USB_SERIAL_DEBUG is not set + +# +# USB Miscellaneous drivers +# +# CONFIG_USB_EMI62 is not set +# CONFIG_USB_EMI26 is not set +# CONFIG_USB_ADUTUX is not set +# CONFIG_USB_SEVSEG is not set +# CONFIG_USB_RIO500 is not set +# CONFIG_USB_LEGOTOWER is not set +# CONFIG_USB_LCD is not set +# CONFIG_USB_LED is not set +# CONFIG_USB_CYPRESS_CY7C63 is not set +# CONFIG_USB_CYTHERM is not set +# CONFIG_USB_IDMOUSE is not set +# CONFIG_USB_FTDI_ELAN is not set +# CONFIG_USB_APPLEDISPLAY is not set +# CONFIG_USB_SISUSBVGA is not set +# CONFIG_USB_LD is not set +# CONFIG_USB_TRANCEVIBRATOR is not set +# CONFIG_USB_IOWARRIOR is not set +# CONFIG_USB_TEST is not set +# CONFIG_USB_EHSET_TEST_FIXTURE is not set +# CONFIG_USB_ISIGHTFW is not set +# CONFIG_USB_YUREX is not set +# CONFIG_USB_EZUSB_FX2 is not set +# CONFIG_USB_HSIC_USB3503 is not set +# CONFIG_USB_LINK_LAYER_TEST is not set +# CONFIG_USB_CHAOSKEY is not set + +# +# USB Physical Layer drivers +# +# CONFIG_USB_PHY is not set +# CONFIG_NOP_USB_XCEIV is not set +# CONFIG_USB_ISP1301 is not set +# CONFIG_USB_GADGET is not set +# CONFIG_USB_LED_TRIG is not set +# CONFIG_UWB is not set +CONFIG_MMC=y +# CONFIG_MMC_DEBUG is not set + +# +# MMC/SD/SDIO Card Drivers +# +CONFIG_MMC_BLOCK=y +CONFIG_MMC_BLOCK_MINORS=32 +CONFIG_MMC_BLOCK_BOUNCE=y +# CONFIG_SDIO_UART is not set +# CONFIG_MMC_TEST is not set + +# +# MMC/SD/SDIO Host Controller Drivers +# +CONFIG_MMC_SDHCI=y +CONFIG_MMC_SDHCI_PCI=y +# CONFIG_MMC_RICOH_MMC is not set +CONFIG_MMC_SDHCI_ACPI=y +# CONFIG_MMC_SDHCI_PLTFM is not set +# CONFIG_MMC_WBSD is not set +# CONFIG_MMC_TIFM_SD is not set +# CONFIG_MMC_CB710 is not set +# CONFIG_MMC_VIA_SDMMC is not set +# CONFIG_MMC_VUB300 is not set +# CONFIG_MMC_USHC is not set +# CONFIG_MMC_USDHI6ROL0 is not set +CONFIG_MMC_REALTEK_PCI=m +CONFIG_MMC_REALTEK_USB=m +CONFIG_MMC_TOSHIBA_PCI=m +# CONFIG_MMC_MTK is not set +CONFIG_MEMSTICK=m +# CONFIG_MEMSTICK_DEBUG is not set + +# +# MemoryStick drivers +# +# CONFIG_MEMSTICK_UNSAFE_RESUME is not set +# CONFIG_MSPRO_BLOCK is not set +# CONFIG_MS_BLOCK is not set + +# +# MemoryStick Host Controller Drivers +# +# CONFIG_MEMSTICK_TIFM_MS is not set +CONFIG_MEMSTICK_JMICRON_38X=m +# CONFIG_MEMSTICK_R592 is not set +CONFIG_MEMSTICK_REALTEK_PCI=m +CONFIG_MEMSTICK_REALTEK_USB=m +CONFIG_NEW_LEDS=y +CONFIG_LEDS_CLASS=y +CONFIG_LEDS_CLASS_FLASH=y + +# +# LED drivers +# +# CONFIG_LEDS_LM3530 is not set +# CONFIG_LEDS_LM3642 is not set +# CONFIG_LEDS_PCA9532 is not set +# CONFIG_LEDS_LP3944 is not set +# CONFIG_LEDS_LP5521 is not set +# CONFIG_LEDS_LP5523 is not set +# CONFIG_LEDS_LP5562 is not set +# CONFIG_LEDS_LP8501 is not set +# CONFIG_LEDS_LP8860 is not set +# CONFIG_LEDS_CLEVO_MAIL is not set +# CONFIG_LEDS_PCA955X is not set +# CONFIG_LEDS_PCA963X is not set +# CONFIG_LEDS_BD2802 is not set +# CONFIG_LEDS_INTEL_SS4200 is not set +# CONFIG_LEDS_TCA6507 is not set +# CONFIG_LEDS_TLC591XX is not set +# CONFIG_LEDS_LM355x is not set + +# +# LED driver for blink(1) USB RGB LED is under Special HID drivers (HID_THINGM) +# +# CONFIG_LEDS_BLINKM is not set + +# +# LED Triggers +# +CONFIG_LEDS_TRIGGERS=y +# CONFIG_LEDS_TRIGGER_TIMER is not set +# CONFIG_LEDS_TRIGGER_ONESHOT is not set +# CONFIG_LEDS_TRIGGER_HEARTBEAT is not set +# CONFIG_LEDS_TRIGGER_BACKLIGHT is not set +# CONFIG_LEDS_TRIGGER_CPU is not set +# CONFIG_LEDS_TRIGGER_DEFAULT_ON is not set + +# +# iptables trigger is under Netfilter config (LED target) +# +# CONFIG_LEDS_TRIGGER_TRANSIENT is not set +# CONFIG_LEDS_TRIGGER_CAMERA is not set +# CONFIG_ACCESSIBILITY is not set +# CONFIG_INFINIBAND is not set +CONFIG_EDAC_ATOMIC_SCRUB=y +CONFIG_EDAC_SUPPORT=y +# CONFIG_EDAC is not set +CONFIG_RTC_LIB=y +CONFIG_RTC_CLASS=y +CONFIG_RTC_HCTOSYS=y +CONFIG_RTC_HCTOSYS_DEVICE="rtc0" +CONFIG_RTC_SYSTOHC=y +CONFIG_RTC_SYSTOHC_DEVICE="rtc0" +# CONFIG_RTC_DEBUG is not set + +# +# RTC interfaces +# +CONFIG_RTC_INTF_SYSFS=y +CONFIG_RTC_INTF_PROC=y +CONFIG_RTC_INTF_DEV=y +# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set +# CONFIG_RTC_DRV_TEST is not set + +# +# I2C RTC drivers +# +# CONFIG_RTC_DRV_ABB5ZES3 is not set +# CONFIG_RTC_DRV_ABX80X is not set +# CONFIG_RTC_DRV_DS1307 is not set +# CONFIG_RTC_DRV_DS1374 is not set +# CONFIG_RTC_DRV_DS1672 is not set +# CONFIG_RTC_DRV_MAX6900 is not set +# CONFIG_RTC_DRV_RS5C372 is not set +# CONFIG_RTC_DRV_ISL1208 is not set +# CONFIG_RTC_DRV_ISL12022 is not set +# CONFIG_RTC_DRV_ISL12057 is not set +# CONFIG_RTC_DRV_X1205 is not set +# CONFIG_RTC_DRV_PCF8523 is not set +# CONFIG_RTC_DRV_PCF85063 is not set +# CONFIG_RTC_DRV_PCF8563 is not set +# CONFIG_RTC_DRV_PCF8583 is not set +# CONFIG_RTC_DRV_M41T80 is not set +# CONFIG_RTC_DRV_BQ32K is not set +# CONFIG_RTC_DRV_S35390A is not set +# CONFIG_RTC_DRV_FM3130 is not set +# CONFIG_RTC_DRV_RX8010 is not set +# CONFIG_RTC_DRV_RX8581 is not set +# CONFIG_RTC_DRV_RX8025 is not set +# CONFIG_RTC_DRV_EM3027 is not set +# CONFIG_RTC_DRV_RV3029C2 is not set +# CONFIG_RTC_DRV_RV8803 is not set + +# +# SPI RTC drivers +# +CONFIG_RTC_I2C_AND_SPI=y + +# +# SPI and I2C RTC drivers +# +# CONFIG_RTC_DRV_DS3232 is not set +# CONFIG_RTC_DRV_PCF2127 is not set + +# +# Platform RTC drivers +# +CONFIG_RTC_DRV_CMOS=y +# CONFIG_RTC_DRV_DS1286 is not set +# CONFIG_RTC_DRV_DS1511 is not set +# CONFIG_RTC_DRV_DS1553 is not set +# CONFIG_RTC_DRV_DS1685_FAMILY is not set +# CONFIG_RTC_DRV_DS1742 is not set +# CONFIG_RTC_DRV_DS2404 is not set +# CONFIG_RTC_DRV_STK17TA8 is not set +# CONFIG_RTC_DRV_M48T86 is not set +# CONFIG_RTC_DRV_M48T35 is not set +# CONFIG_RTC_DRV_M48T59 is not set +# CONFIG_RTC_DRV_MSM6242 is not set +# CONFIG_RTC_DRV_BQ4802 is not set +# CONFIG_RTC_DRV_RP5C01 is not set +# CONFIG_RTC_DRV_V3020 is not set + +# +# on-CPU RTC drivers +# + +# +# HID Sensor RTC drivers +# +# CONFIG_RTC_DRV_HID_SENSOR_TIME is not set +CONFIG_DMADEVICES=y +# CONFIG_DMADEVICES_DEBUG is not set + +# +# DMA Devices +# +CONFIG_DMA_ENGINE=y +CONFIG_DMA_VIRTUAL_CHANNELS=m +CONFIG_DMA_ACPI=y +CONFIG_INTEL_IDMA64=m +CONFIG_INTEL_IOATDMA=m +# CONFIG_QCOM_HIDMA_MGMT is not set +# CONFIG_QCOM_HIDMA is not set +CONFIG_DW_DMAC_CORE=m +CONFIG_DW_DMAC=m +CONFIG_DW_DMAC_PCI=m + +# +# DMA Clients +# +# CONFIG_ASYNC_TX_DMA is not set +# CONFIG_DMATEST is not set +CONFIG_DMA_ENGINE_RAID=y +CONFIG_DCA=m +# CONFIG_AUXDISPLAY is not set +CONFIG_UIO=y +# CONFIG_UIO_CIF is not set +# CONFIG_UIO_PDRV_GENIRQ is not set +# CONFIG_UIO_DMEM_GENIRQ is not set +# CONFIG_UIO_AEC is not set +# CONFIG_UIO_SERCOS3 is not set +# CONFIG_UIO_PCI_GENERIC is not set +# CONFIG_UIO_NETX is not set +# CONFIG_UIO_PRUSS is not set +# CONFIG_UIO_MF624 is not set +# CONFIG_VIRT_DRIVERS is not set +CONFIG_VIRTIO=y + +# +# Virtio drivers +# +CONFIG_VIRTIO_PCI=y +CONFIG_VIRTIO_PCI_LEGACY=y +CONFIG_VIRTIO_BALLOON=y +CONFIG_VIRTIO_INPUT=y +CONFIG_VIRTIO_MMIO=y +# CONFIG_VIRTIO_MMIO_CMDLINE_DEVICES is not set + +# +# Microsoft Hyper-V guest support +# +# CONFIG_HYPERV is not set +CONFIG_STAGING=y +# CONFIG_SLICOSS is not set +# CONFIG_PRISM2_USB is not set +# CONFIG_COMEDI is not set +CONFIG_RTL8192U=m +# CONFIG_RTLLIB is not set +CONFIG_R8712U=m +# CONFIG_R8188EU is not set +CONFIG_RTS5208=y +# CONFIG_VT6655 is not set +CONFIG_VT6656=m +# CONFIG_FB_SM750 is not set +# CONFIG_FB_XGI is not set + +# +# Speakup console speech +# +# CONFIG_SPEAKUP is not set +CONFIG_STAGING_MEDIA=y +CONFIG_DVB_CXD2099=m +CONFIG_DVB_MN88472=m +CONFIG_LIRC_STAGING=y +# CONFIG_LIRC_BT829 is not set +# CONFIG_LIRC_IMON is not set +# CONFIG_LIRC_SASEM is not set +CONFIG_LIRC_SERIAL=m +CONFIG_LIRC_SERIAL_TRANSMITTER=y +# CONFIG_LIRC_SIR is not set +CONFIG_LIRC_XBOX=m +# CONFIG_LIRC_ZILOG is not set + +# +# Android +# +# CONFIG_LTE_GDM724X is not set +# CONFIG_FIREWIRE_SERIAL is not set +# CONFIG_LNET is not set +# CONFIG_DGNC is not set +# CONFIG_GS_FPGABOOT is not set +# CONFIG_CRYPTO_SKEIN is not set +# CONFIG_UNISYSSPAR is not set +# CONFIG_WILC1000_SDIO is not set +# CONFIG_MOST is not set +# CONFIG_X86_PLATFORM_DEVICES is not set +# CONFIG_CHROME_PLATFORMS is not set +CONFIG_CLKDEV_LOOKUP=y +CONFIG_HAVE_CLK_PREPARE=y +CONFIG_COMMON_CLK=y + +# +# Common Clock Framework +# +# CONFIG_COMMON_CLK_SI5351 is not set +# CONFIG_COMMON_CLK_CDCE706 is not set +# CONFIG_COMMON_CLK_CS2000_CP is not set +# CONFIG_COMMON_CLK_NXP is not set +# CONFIG_COMMON_CLK_PXA is not set + +# +# Hardware Spinlock drivers +# + +# +# Clock Source drivers +# +CONFIG_CLKEVT_I8253=y +CONFIG_CLKBLD_I8253=y +# CONFIG_ATMEL_PIT is not set +# CONFIG_SH_TIMER_CMT is not set +# CONFIG_SH_TIMER_MTU2 is not set +# CONFIG_SH_TIMER_TMU is not set +# CONFIG_EM_TIMER_STI is not set +# CONFIG_MAILBOX is not set +# CONFIG_IOMMU_SUPPORT is not set + +# +# Remoteproc drivers +# +# CONFIG_STE_MODEM_RPROC is not set + +# +# Rpmsg drivers +# + +# +# SOC (System On Chip) specific Drivers +# +# CONFIG_SUNXI_SRAM is not set +# CONFIG_SOC_TI is not set +# CONFIG_PM_DEVFREQ is not set +# CONFIG_EXTCON is not set +# CONFIG_MEMORY is not set +# CONFIG_IIO is not set +# CONFIG_NTB is not set +# CONFIG_VME_BUS is not set +# CONFIG_PWM is not set +CONFIG_ARM_GIC_MAX_NR=1 +# CONFIG_IPACK_BUS is not set +# CONFIG_RESET_CONTROLLER is not set +# CONFIG_FMC is not set + +# +# PHY Subsystem +# +# CONFIG_GENERIC_PHY is not set +# CONFIG_PHY_PXA_28NM_HSIC is not set +# CONFIG_PHY_PXA_28NM_USB2 is not set +# CONFIG_BCM_KONA_USB2_PHY is not set +CONFIG_POWERCAP=y +CONFIG_INTEL_RAPL=m +# CONFIG_MCB is not set + +# +# Performance monitor support +# +CONFIG_RAS=y +CONFIG_THUNDERBOLT=m + +# +# Android +# +# CONFIG_ANDROID is not set +# CONFIG_LIBNVDIMM is not set +# CONFIG_NVMEM is not set +# CONFIG_STM is not set +# CONFIG_INTEL_TH is not set + +# +# FPGA Configuration Support +# +# CONFIG_FPGA is not set + +# +# Firmware Drivers +# +# CONFIG_EDD is not set +CONFIG_FIRMWARE_MEMMAP=y +# CONFIG_DELL_RBU is not set +# CONFIG_DCDBAS is not set +CONFIG_DMIID=y +CONFIG_DMI_SYSFS=m +CONFIG_DMI_SCAN_MACHINE_NON_EFI_FALLBACK=y +CONFIG_ISCSI_IBFT_FIND=y +CONFIG_ISCSI_IBFT=y +# CONFIG_FW_CFG_SYSFS is not set +# CONFIG_GOOGLE_FIRMWARE is not set + +# +# EFI (Extensible Firmware Interface) Support +# +CONFIG_EFI_VARS=y +CONFIG_EFI_ESRT=y +# CONFIG_EFI_FAKE_MEMMAP is not set +CONFIG_EFI_RUNTIME_WRAPPERS=y + +# +# File systems +# +CONFIG_DCACHE_WORD_ACCESS=y +# CONFIG_EXT2_FS is not set +# CONFIG_EXT3_FS is not set +CONFIG_EXT4_FS=y +CONFIG_EXT4_USE_FOR_EXT2=y +CONFIG_EXT4_FS_POSIX_ACL=y +CONFIG_EXT4_FS_SECURITY=y +# CONFIG_EXT4_ENCRYPTION is not set +# CONFIG_EXT4_DEBUG is not set +CONFIG_JBD2=y +# CONFIG_JBD2_DEBUG is not set +CONFIG_FS_MBCACHE=y +CONFIG_REISERFS_FS=m +# CONFIG_REISERFS_CHECK is not set +# CONFIG_REISERFS_PROC_INFO is not set +# CONFIG_REISERFS_FS_XATTR is not set +CONFIG_JFS_FS=m +# CONFIG_JFS_POSIX_ACL is not set +# CONFIG_JFS_SECURITY is not set +# CONFIG_JFS_DEBUG is not set +# CONFIG_JFS_STATISTICS is not set +CONFIG_XFS_FS=m +# CONFIG_XFS_QUOTA is not set +# CONFIG_XFS_POSIX_ACL is not set +# CONFIG_XFS_RT is not set +# CONFIG_XFS_WARN is not set +# CONFIG_XFS_DEBUG is not set +# CONFIG_GFS2_FS is not set +CONFIG_BTRFS_FS=y +# CONFIG_BTRFS_FS_POSIX_ACL is not set +# CONFIG_BTRFS_FS_CHECK_INTEGRITY is not set +# CONFIG_BTRFS_FS_RUN_SANITY_TESTS is not set +# CONFIG_BTRFS_DEBUG is not set +# CONFIG_BTRFS_ASSERT is not set +# CONFIG_NILFS2_FS is not set +CONFIG_F2FS_FS=y +CONFIG_F2FS_STAT_FS=y +# CONFIG_F2FS_FS_XATTR is not set +CONFIG_F2FS_CHECK_FS=y +# CONFIG_FS_DAX is not set +CONFIG_FS_POSIX_ACL=y +CONFIG_EXPORTFS=y +CONFIG_FILE_LOCKING=y +CONFIG_MANDATORY_FILE_LOCKING=y +# CONFIG_FS_ENCRYPTION is not set +CONFIG_FSNOTIFY=y +CONFIG_DNOTIFY=y +CONFIG_INOTIFY_USER=y +CONFIG_FANOTIFY=y +# CONFIG_QUOTA is not set +# CONFIG_QUOTACTL is not set +CONFIG_AUTOFS4_FS=y +CONFIG_FUSE_FS=m +# CONFIG_CUSE is not set +CONFIG_OVERLAY_FS=m + +# +# Caches +# +# CONFIG_FSCACHE is not set + +# +# CD-ROM/DVD Filesystems +# +CONFIG_ISO9660_FS=m +CONFIG_JOLIET=y +CONFIG_ZISOFS=y +CONFIG_UDF_FS=m +CONFIG_UDF_NLS=y + +# +# DOS/FAT/NT Filesystems +# +CONFIG_FAT_FS=y +# CONFIG_MSDOS_FS is not set +CONFIG_VFAT_FS=y +CONFIG_FAT_DEFAULT_CODEPAGE=437 +CONFIG_FAT_DEFAULT_IOCHARSET="ascii" +# CONFIG_FAT_DEFAULT_UTF8 is not set +# CONFIG_NTFS_FS is not set + +# +# Pseudo filesystems +# +CONFIG_PROC_FS=y +CONFIG_PROC_KCORE=y +CONFIG_PROC_SYSCTL=y +CONFIG_PROC_PAGE_MONITOR=y +# CONFIG_PROC_CHILDREN is not set +CONFIG_KERNFS=y +CONFIG_SYSFS=y +CONFIG_TMPFS=y +CONFIG_TMPFS_POSIX_ACL=y +CONFIG_TMPFS_XATTR=y +# CONFIG_HUGETLBFS is not set +# CONFIG_HUGETLB_PAGE is not set +# CONFIG_CONFIGFS_FS is not set +CONFIG_EFIVAR_FS=y +CONFIG_MISC_FILESYSTEMS=y +# CONFIG_ORANGEFS_FS is not set +# CONFIG_ADFS_FS is not set +# CONFIG_AFFS_FS is not set +# CONFIG_ECRYPT_FS is not set +# CONFIG_HFS_FS is not set +CONFIG_HFSPLUS_FS=m +# CONFIG_HFSPLUS_FS_POSIX_ACL is not set +# CONFIG_BEFS_FS is not set +# CONFIG_BFS_FS is not set +# CONFIG_EFS_FS is not set +# CONFIG_LOGFS is not set +# CONFIG_CRAMFS is not set +CONFIG_SQUASHFS=y +# CONFIG_SQUASHFS_FILE_CACHE is not set +CONFIG_SQUASHFS_FILE_DIRECT=y +# CONFIG_SQUASHFS_DECOMP_SINGLE is not set +# CONFIG_SQUASHFS_DECOMP_MULTI is not set +CONFIG_SQUASHFS_DECOMP_MULTI_PERCPU=y +# CONFIG_SQUASHFS_XATTR is not set +CONFIG_SQUASHFS_ZLIB=y +CONFIG_SQUASHFS_LZ4=y +CONFIG_SQUASHFS_LZO=y +CONFIG_SQUASHFS_XZ=y +# CONFIG_SQUASHFS_4K_DEVBLK_SIZE is not set +# CONFIG_SQUASHFS_EMBEDDED is not set +CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE=3 +# CONFIG_VXFS_FS is not set +# CONFIG_MINIX_FS is not set +# CONFIG_OMFS_FS is not set +# CONFIG_HPFS_FS is not set +# CONFIG_QNX4FS_FS is not set +# CONFIG_QNX6FS_FS is not set +# CONFIG_ROMFS_FS is not set +# CONFIG_PSTORE is not set +# CONFIG_SYSV_FS is not set +# CONFIG_UFS_FS is not set +CONFIG_NETWORK_FILESYSTEMS=y +CONFIG_NFS_FS=y +CONFIG_NFS_V2=y +CONFIG_NFS_V3=y +# CONFIG_NFS_V3_ACL is not set +CONFIG_NFS_V4=y +CONFIG_NFS_SWAP=y +CONFIG_NFS_V4_1=y +CONFIG_NFS_V4_2=y +CONFIG_PNFS_FILE_LAYOUT=y +CONFIG_PNFS_FLEXFILE_LAYOUT=m +CONFIG_NFS_V4_1_IMPLEMENTATION_ID_DOMAIN="kernel.org" +CONFIG_NFS_V4_1_MIGRATION=y +CONFIG_ROOT_NFS=y +# CONFIG_NFS_USE_LEGACY_DNS is not set +CONFIG_NFS_USE_KERNEL_DNS=y +# CONFIG_NFSD is not set +CONFIG_GRACE_PERIOD=y +CONFIG_LOCKD=y +CONFIG_LOCKD_V4=y +CONFIG_NFS_COMMON=y +CONFIG_SUNRPC=y +CONFIG_SUNRPC_GSS=y +CONFIG_SUNRPC_BACKCHANNEL=y +CONFIG_SUNRPC_SWAP=y +CONFIG_RPCSEC_GSS_KRB5=m +# CONFIG_SUNRPC_DEBUG is not set +# CONFIG_CEPH_FS is not set +CONFIG_CIFS=y +CONFIG_CIFS_STATS=y +CONFIG_CIFS_STATS2=y +# CONFIG_CIFS_WEAK_PW_HASH is not set +# CONFIG_CIFS_UPCALL is not set +# CONFIG_CIFS_XATTR is not set +# CONFIG_CIFS_DEBUG is not set +# CONFIG_CIFS_DFS_UPCALL is not set +# CONFIG_CIFS_SMB2 is not set +# CONFIG_NCP_FS is not set +# CONFIG_CODA_FS is not set +# CONFIG_AFS_FS is not set +CONFIG_NLS=y +CONFIG_NLS_DEFAULT="utf8" +CONFIG_NLS_CODEPAGE_437=y +# CONFIG_NLS_CODEPAGE_737 is not set +# CONFIG_NLS_CODEPAGE_775 is not set +# CONFIG_NLS_CODEPAGE_850 is not set +# CONFIG_NLS_CODEPAGE_852 is not set +# CONFIG_NLS_CODEPAGE_855 is not set +# CONFIG_NLS_CODEPAGE_857 is not set +# CONFIG_NLS_CODEPAGE_860 is not set +# CONFIG_NLS_CODEPAGE_861 is not set +# CONFIG_NLS_CODEPAGE_862 is not set +# CONFIG_NLS_CODEPAGE_863 is not set +# CONFIG_NLS_CODEPAGE_864 is not set +# CONFIG_NLS_CODEPAGE_865 is not set +# CONFIG_NLS_CODEPAGE_866 is not set +# CONFIG_NLS_CODEPAGE_869 is not set +# CONFIG_NLS_CODEPAGE_936 is not set +# CONFIG_NLS_CODEPAGE_950 is not set +# CONFIG_NLS_CODEPAGE_932 is not set +# CONFIG_NLS_CODEPAGE_949 is not set +# CONFIG_NLS_CODEPAGE_874 is not set +# CONFIG_NLS_ISO8859_8 is not set +# CONFIG_NLS_CODEPAGE_1250 is not set +# CONFIG_NLS_CODEPAGE_1251 is not set +CONFIG_NLS_ASCII=y +CONFIG_NLS_ISO8859_1=y +# CONFIG_NLS_ISO8859_2 is not set +# CONFIG_NLS_ISO8859_3 is not set +# CONFIG_NLS_ISO8859_4 is not set +# CONFIG_NLS_ISO8859_5 is not set +# CONFIG_NLS_ISO8859_6 is not set +# CONFIG_NLS_ISO8859_7 is not set +# CONFIG_NLS_ISO8859_9 is not set +# CONFIG_NLS_ISO8859_13 is not set +# CONFIG_NLS_ISO8859_14 is not set +# CONFIG_NLS_ISO8859_15 is not set +# CONFIG_NLS_KOI8_R is not set +# CONFIG_NLS_KOI8_U is not set +# CONFIG_NLS_MAC_ROMAN is not set +# CONFIG_NLS_MAC_CELTIC is not set +# CONFIG_NLS_MAC_CENTEURO is not set +# CONFIG_NLS_MAC_CROATIAN is not set +# CONFIG_NLS_MAC_CYRILLIC is not set +# CONFIG_NLS_MAC_GAELIC is not set +# CONFIG_NLS_MAC_GREEK is not set +# CONFIG_NLS_MAC_ICELAND is not set +# CONFIG_NLS_MAC_INUIT is not set +# CONFIG_NLS_MAC_ROMANIAN is not set +# CONFIG_NLS_MAC_TURKISH is not set +CONFIG_NLS_UTF8=y + +# +# Kernel hacking +# +CONFIG_TRACE_IRQFLAGS_SUPPORT=y + +# +# printk and dmesg options +# +CONFIG_PRINTK_TIME=y +CONFIG_MESSAGE_LOGLEVEL_DEFAULT=4 +# CONFIG_BOOT_PRINTK_DELAY is not set +# CONFIG_DYNAMIC_DEBUG is not set + +# +# Compile-time checks and compiler options +# +# CONFIG_DEBUG_INFO is not set +# CONFIG_ENABLE_WARN_DEPRECATED is not set +# CONFIG_ENABLE_MUST_CHECK is not set +CONFIG_FRAME_WARN=1024 +CONFIG_STRIP_ASM_SYMS=y +# CONFIG_READABLE_ASM is not set +# CONFIG_UNUSED_SYMBOLS is not set +# CONFIG_PAGE_OWNER is not set +CONFIG_DEBUG_FS=y +# CONFIG_HEADERS_CHECK is not set +# CONFIG_DEBUG_SECTION_MISMATCH is not set +CONFIG_SECTION_MISMATCH_WARN_ONLY=y +CONFIG_ARCH_WANT_FRAME_POINTERS=y +# CONFIG_FRAME_POINTER is not set +# CONFIG_STACK_VALIDATION is not set +# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set +CONFIG_MAGIC_SYSRQ=y +CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE=0x1 +CONFIG_DEBUG_KERNEL=y + +# +# Memory Debugging +# +# CONFIG_PAGE_EXTENSION is not set +# CONFIG_DEBUG_PAGEALLOC is not set +# CONFIG_PAGE_POISONING is not set +# CONFIG_DEBUG_OBJECTS is not set +# CONFIG_SLUB_DEBUG_ON is not set +# CONFIG_SLUB_STATS is not set +CONFIG_HAVE_DEBUG_KMEMLEAK=y +# CONFIG_DEBUG_KMEMLEAK is not set +# CONFIG_DEBUG_STACK_USAGE is not set +# CONFIG_DEBUG_VM is not set +# CONFIG_DEBUG_VIRTUAL is not set +# CONFIG_DEBUG_MEMORY_INIT is not set +# CONFIG_DEBUG_PER_CPU_MAPS is not set +CONFIG_HAVE_DEBUG_STACKOVERFLOW=y +# CONFIG_DEBUG_STACKOVERFLOW is not set +CONFIG_HAVE_ARCH_KMEMCHECK=y +CONFIG_HAVE_ARCH_KASAN=y +# CONFIG_KASAN is not set +CONFIG_ARCH_HAS_KCOV=y +# CONFIG_KCOV is not set +# CONFIG_DEBUG_SHIRQ is not set + +# +# Debug Lockups and Hangs +# +CONFIG_LOCKUP_DETECTOR=y +CONFIG_HARDLOCKUP_DETECTOR=y +# CONFIG_BOOTPARAM_HARDLOCKUP_PANIC is not set +CONFIG_BOOTPARAM_HARDLOCKUP_PANIC_VALUE=0 +# CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set +CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0 +CONFIG_DETECT_HUNG_TASK=y +CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=120 +# CONFIG_BOOTPARAM_HUNG_TASK_PANIC is not set +CONFIG_BOOTPARAM_HUNG_TASK_PANIC_VALUE=0 +# CONFIG_WQ_WATCHDOG is not set +# CONFIG_PANIC_ON_OOPS is not set +CONFIG_PANIC_ON_OOPS_VALUE=0 +CONFIG_PANIC_TIMEOUT=0 +# CONFIG_SCHED_DEBUG is not set +# CONFIG_SCHED_INFO is not set +# CONFIG_SCHEDSTATS is not set +# CONFIG_SCHED_STACK_END_CHECK is not set +# CONFIG_DEBUG_TIMEKEEPING is not set +# CONFIG_TIMER_STATS is not set + +# +# Lock Debugging (spinlocks, mutexes, etc...) +# +# CONFIG_DEBUG_RT_MUTEXES is not set +# CONFIG_DEBUG_SPINLOCK is not set +# CONFIG_DEBUG_MUTEXES is not set +# CONFIG_DEBUG_WW_MUTEX_SLOWPATH is not set +# CONFIG_DEBUG_LOCK_ALLOC is not set +# CONFIG_PROVE_LOCKING is not set +# CONFIG_LOCK_STAT is not set +# CONFIG_DEBUG_ATOMIC_SLEEP is not set +# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set +# CONFIG_LOCK_TORTURE_TEST is not set +# CONFIG_STACKTRACE is not set +# CONFIG_DEBUG_KOBJECT is not set +CONFIG_DEBUG_BUGVERBOSE=y +# CONFIG_DEBUG_LIST is not set +# CONFIG_DEBUG_PI_LIST is not set +# CONFIG_DEBUG_SG is not set +# CONFIG_DEBUG_NOTIFIERS is not set +# CONFIG_DEBUG_CREDENTIALS is not set + +# +# RCU Debugging +# +# CONFIG_PROVE_RCU is not set +# CONFIG_SPARSE_RCU_POINTER is not set +# CONFIG_TORTURE_TEST is not set +# CONFIG_RCU_TORTURE_TEST is not set +CONFIG_RCU_CPU_STALL_TIMEOUT=60 +# CONFIG_RCU_TRACE is not set +# CONFIG_RCU_EQS_DEBUG is not set +# CONFIG_DEBUG_WQ_FORCE_RR_CPU is not set +# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set +# CONFIG_CPU_HOTPLUG_STATE_CONTROL is not set +# CONFIG_NOTIFIER_ERROR_INJECTION is not set +# CONFIG_FAULT_INJECTION is not set +# CONFIG_LATENCYTOP is not set +CONFIG_ARCH_HAS_DEBUG_STRICT_USER_COPY_CHECKS=y +# CONFIG_DEBUG_STRICT_USER_COPY_CHECKS is not set +CONFIG_USER_STACKTRACE_SUPPORT=y +CONFIG_HAVE_FUNCTION_TRACER=y +CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y +CONFIG_HAVE_FUNCTION_GRAPH_FP_TEST=y +CONFIG_HAVE_DYNAMIC_FTRACE=y +CONFIG_HAVE_DYNAMIC_FTRACE_WITH_REGS=y +CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y +CONFIG_HAVE_SYSCALL_TRACEPOINTS=y +CONFIG_HAVE_FENTRY=y +CONFIG_HAVE_C_RECORDMCOUNT=y +CONFIG_TRACING_SUPPORT=y +# CONFIG_FTRACE is not set + +# +# Runtime Testing +# +# CONFIG_LKDTM is not set +# CONFIG_TEST_LIST_SORT is not set +# CONFIG_BACKTRACE_SELF_TEST is not set +# CONFIG_RBTREE_TEST is not set +# CONFIG_INTERVAL_TREE_TEST is not set +# CONFIG_PERCPU_TEST is not set +# CONFIG_ATOMIC64_SELFTEST is not set +# CONFIG_TEST_HEXDUMP is not set +# CONFIG_TEST_STRING_HELPERS is not set +# CONFIG_TEST_KSTRTOX is not set +# CONFIG_TEST_PRINTF is not set +# CONFIG_TEST_BITMAP is not set +# CONFIG_TEST_RHASHTABLE is not set +# CONFIG_PROVIDE_OHCI1394_DMA_INIT is not set +# CONFIG_DMA_API_DEBUG is not set +# CONFIG_TEST_LKM is not set +# CONFIG_TEST_USER_COPY is not set +# CONFIG_TEST_BPF is not set +# CONFIG_TEST_FIRMWARE is not set +# CONFIG_TEST_UDELAY is not set +# CONFIG_MEMTEST is not set +# CONFIG_TEST_STATIC_KEYS is not set +# CONFIG_SAMPLES is not set +CONFIG_HAVE_ARCH_KGDB=y +# CONFIG_KGDB is not set +CONFIG_ARCH_HAS_UBSAN_SANITIZE_ALL=y +# CONFIG_UBSAN is not set +CONFIG_ARCH_HAS_DEVMEM_IS_ALLOWED=y +CONFIG_STRICT_DEVMEM=y +# CONFIG_IO_STRICT_DEVMEM is not set +# CONFIG_X86_VERBOSE_BOOTUP is not set +# CONFIG_EARLY_PRINTK is not set +# CONFIG_X86_PTDUMP_CORE is not set +# CONFIG_X86_PTDUMP is not set +# CONFIG_EFI_PGT_DUMP is not set +# CONFIG_DEBUG_RODATA_TEST is not set +# CONFIG_DEBUG_WX is not set +# CONFIG_DEBUG_SET_MODULE_RONX is not set +# CONFIG_DEBUG_NX_TEST is not set +CONFIG_DOUBLEFAULT=y +# CONFIG_DEBUG_TLBFLUSH is not set +# CONFIG_IOMMU_DEBUG is not set +# CONFIG_IOMMU_STRESS is not set +CONFIG_HAVE_MMIOTRACE_SUPPORT=y +CONFIG_IO_DELAY_TYPE_0X80=0 +CONFIG_IO_DELAY_TYPE_0XED=1 +CONFIG_IO_DELAY_TYPE_UDELAY=2 +CONFIG_IO_DELAY_TYPE_NONE=3 +CONFIG_IO_DELAY_0X80=y +# CONFIG_IO_DELAY_0XED is not set +# CONFIG_IO_DELAY_UDELAY is not set +# CONFIG_IO_DELAY_NONE is not set +CONFIG_DEFAULT_IO_DELAY_TYPE=0 +# CONFIG_DEBUG_BOOT_PARAMS is not set +# CONFIG_CPA_DEBUG is not set +CONFIG_OPTIMIZE_INLINING=y +# CONFIG_DEBUG_ENTRY is not set +# CONFIG_DEBUG_NMI_SELFTEST is not set +CONFIG_X86_DEBUG_FPU=y +# CONFIG_PUNIT_ATOM_DEBUG is not set + +# +# Security options +# +CONFIG_KEYS=y +# CONFIG_PERSISTENT_KEYRINGS is not set +# CONFIG_BIG_KEYS is not set +# CONFIG_ENCRYPTED_KEYS is not set +# CONFIG_SECURITY_DMESG_RESTRICT is not set +# CONFIG_SECURITY is not set +# CONFIG_SECURITYFS is not set +CONFIG_DEFAULT_SECURITY_DAC=y +CONFIG_DEFAULT_SECURITY="" +CONFIG_XOR_BLOCKS=y +CONFIG_CRYPTO=y + +# +# Crypto core or helper +# +CONFIG_CRYPTO_ALGAPI=y +CONFIG_CRYPTO_ALGAPI2=y +CONFIG_CRYPTO_AEAD=m +CONFIG_CRYPTO_AEAD2=y +CONFIG_CRYPTO_BLKCIPHER=y +CONFIG_CRYPTO_BLKCIPHER2=y +CONFIG_CRYPTO_HASH=y +CONFIG_CRYPTO_HASH2=y +CONFIG_CRYPTO_RNG=m +CONFIG_CRYPTO_RNG2=y +CONFIG_CRYPTO_RNG_DEFAULT=m +CONFIG_CRYPTO_AKCIPHER2=y +# CONFIG_CRYPTO_RSA is not set +CONFIG_CRYPTO_MANAGER=y +CONFIG_CRYPTO_MANAGER2=y +# CONFIG_CRYPTO_USER is not set +# CONFIG_CRYPTO_MANAGER_DISABLE_TESTS is not set +CONFIG_CRYPTO_GF128MUL=m +CONFIG_CRYPTO_NULL=m +CONFIG_CRYPTO_NULL2=y +# CONFIG_CRYPTO_PCRYPT is not set +CONFIG_CRYPTO_WORKQUEUE=y +# CONFIG_CRYPTO_CRYPTD is not set +# CONFIG_CRYPTO_MCRYPTD is not set +# CONFIG_CRYPTO_AUTHENC is not set +# CONFIG_CRYPTO_TEST is not set + +# +# Authenticated Encryption with Associated Data +# +CONFIG_CRYPTO_CCM=m +CONFIG_CRYPTO_GCM=m +# CONFIG_CRYPTO_CHACHA20POLY1305 is not set +CONFIG_CRYPTO_SEQIV=m +CONFIG_CRYPTO_ECHAINIV=m + +# +# Block modes +# +CONFIG_CRYPTO_CBC=m +CONFIG_CRYPTO_CTR=m +CONFIG_CRYPTO_CTS=m +CONFIG_CRYPTO_ECB=y +# CONFIG_CRYPTO_LRW is not set +# CONFIG_CRYPTO_PCBC is not set +# CONFIG_CRYPTO_XTS is not set +# CONFIG_CRYPTO_KEYWRAP is not set + +# +# Hash modes +# +CONFIG_CRYPTO_CMAC=y +CONFIG_CRYPTO_HMAC=y +# CONFIG_CRYPTO_XCBC is not set +# CONFIG_CRYPTO_VMAC is not set + +# +# Digest +# +CONFIG_CRYPTO_CRC32C=y +# CONFIG_CRYPTO_CRC32C_INTEL is not set +CONFIG_CRYPTO_CRC32=y +# CONFIG_CRYPTO_CRC32_PCLMUL is not set +# CONFIG_CRYPTO_CRCT10DIF is not set +CONFIG_CRYPTO_GHASH=m +# CONFIG_CRYPTO_POLY1305 is not set +# CONFIG_CRYPTO_POLY1305_X86_64 is not set +CONFIG_CRYPTO_MD4=y +CONFIG_CRYPTO_MD5=y +CONFIG_CRYPTO_MICHAEL_MIC=m +# CONFIG_CRYPTO_RMD128 is not set +# CONFIG_CRYPTO_RMD160 is not set +# CONFIG_CRYPTO_RMD256 is not set +# CONFIG_CRYPTO_RMD320 is not set +CONFIG_CRYPTO_SHA1=m +# CONFIG_CRYPTO_SHA1_SSSE3 is not set +# CONFIG_CRYPTO_SHA256_SSSE3 is not set +# CONFIG_CRYPTO_SHA512_SSSE3 is not set +# CONFIG_CRYPTO_SHA1_MB is not set +CONFIG_CRYPTO_SHA256=y +# CONFIG_CRYPTO_SHA512 is not set +# CONFIG_CRYPTO_TGR192 is not set +# CONFIG_CRYPTO_WP512 is not set +# CONFIG_CRYPTO_GHASH_CLMUL_NI_INTEL is not set + +# +# Ciphers +# +CONFIG_CRYPTO_AES=y +# CONFIG_CRYPTO_AES_X86_64 is not set +# CONFIG_CRYPTO_AES_NI_INTEL is not set +# CONFIG_CRYPTO_ANUBIS is not set +CONFIG_CRYPTO_ARC4=y +# CONFIG_CRYPTO_BLOWFISH is not set +# CONFIG_CRYPTO_BLOWFISH_X86_64 is not set +# CONFIG_CRYPTO_CAMELLIA is not set +# CONFIG_CRYPTO_CAMELLIA_X86_64 is not set +# CONFIG_CRYPTO_CAMELLIA_AESNI_AVX_X86_64 is not set +# CONFIG_CRYPTO_CAMELLIA_AESNI_AVX2_X86_64 is not set +# CONFIG_CRYPTO_CAST5 is not set +# CONFIG_CRYPTO_CAST5_AVX_X86_64 is not set +# CONFIG_CRYPTO_CAST6 is not set +# CONFIG_CRYPTO_CAST6_AVX_X86_64 is not set +CONFIG_CRYPTO_DES=y +# CONFIG_CRYPTO_DES3_EDE_X86_64 is not set +# CONFIG_CRYPTO_FCRYPT is not set +# CONFIG_CRYPTO_KHAZAD is not set +# CONFIG_CRYPTO_SALSA20 is not set +# CONFIG_CRYPTO_SALSA20_X86_64 is not set +# CONFIG_CRYPTO_CHACHA20 is not set +# CONFIG_CRYPTO_CHACHA20_X86_64 is not set +# CONFIG_CRYPTO_SEED is not set +# CONFIG_CRYPTO_SERPENT is not set +# CONFIG_CRYPTO_SERPENT_SSE2_X86_64 is not set +# CONFIG_CRYPTO_SERPENT_AVX_X86_64 is not set +# CONFIG_CRYPTO_SERPENT_AVX2_X86_64 is not set +# CONFIG_CRYPTO_TEA is not set +# CONFIG_CRYPTO_TWOFISH is not set +# CONFIG_CRYPTO_TWOFISH_X86_64 is not set +# CONFIG_CRYPTO_TWOFISH_X86_64_3WAY is not set +# CONFIG_CRYPTO_TWOFISH_AVX_X86_64 is not set + +# +# Compression +# +# CONFIG_CRYPTO_DEFLATE is not set +# CONFIG_CRYPTO_LZO is not set +# CONFIG_CRYPTO_842 is not set +# CONFIG_CRYPTO_LZ4 is not set +# CONFIG_CRYPTO_LZ4HC is not set + +# +# Random Number Generation +# +# CONFIG_CRYPTO_ANSI_CPRNG is not set +CONFIG_CRYPTO_DRBG_MENU=m +CONFIG_CRYPTO_DRBG_HMAC=y +# CONFIG_CRYPTO_DRBG_HASH is not set +# CONFIG_CRYPTO_DRBG_CTR is not set +CONFIG_CRYPTO_DRBG=m +CONFIG_CRYPTO_JITTERENTROPY=m +# CONFIG_CRYPTO_USER_API_HASH is not set +# CONFIG_CRYPTO_USER_API_SKCIPHER is not set +# CONFIG_CRYPTO_USER_API_RNG is not set +# CONFIG_CRYPTO_USER_API_AEAD is not set +# CONFIG_CRYPTO_HW is not set +# CONFIG_ASYMMETRIC_KEY_TYPE is not set + +# +# Certificates for signature checking +# +# CONFIG_SYSTEM_TRUSTED_KEYRING is not set +CONFIG_HAVE_KVM=y +# CONFIG_VIRTUALIZATION is not set +# CONFIG_BINARY_PRINTF is not set + +# +# Library routines +# +CONFIG_RAID6_PQ=y +CONFIG_BITREVERSE=y +# CONFIG_HAVE_ARCH_BITREVERSE is not set +CONFIG_RATIONAL=y +CONFIG_GENERIC_STRNCPY_FROM_USER=y +CONFIG_GENERIC_STRNLEN_USER=y +CONFIG_GENERIC_NET_UTILS=y +CONFIG_GENERIC_FIND_FIRST_BIT=y +CONFIG_GENERIC_PCI_IOMAP=y +CONFIG_GENERIC_IOMAP=y +CONFIG_GENERIC_IO=y +CONFIG_ARCH_USE_CMPXCHG_LOCKREF=y +CONFIG_ARCH_HAS_FAST_MULTIPLIER=y +CONFIG_CRC_CCITT=y +CONFIG_CRC16=y +# CONFIG_CRC_T10DIF is not set +CONFIG_CRC_ITU_T=m +CONFIG_CRC32=y +# CONFIG_CRC32_SELFTEST is not set +CONFIG_CRC32_SLICEBY8=y +# CONFIG_CRC32_SLICEBY4 is not set +# CONFIG_CRC32_SARWATE is not set +# CONFIG_CRC32_BIT is not set +# CONFIG_CRC7 is not set +CONFIG_LIBCRC32C=m +# CONFIG_CRC8 is not set +# CONFIG_AUDIT_ARCH_COMPAT_GENERIC is not set +# CONFIG_RANDOM32_SELFTEST is not set +CONFIG_ZLIB_INFLATE=y +CONFIG_ZLIB_DEFLATE=y +CONFIG_LZO_COMPRESS=y +CONFIG_LZO_DECOMPRESS=y +CONFIG_LZ4_DECOMPRESS=y +CONFIG_XZ_DEC=y +# CONFIG_XZ_DEC_X86 is not set +# CONFIG_XZ_DEC_POWERPC is not set +# CONFIG_XZ_DEC_IA64 is not set +# CONFIG_XZ_DEC_ARM is not set +# CONFIG_XZ_DEC_ARMTHUMB is not set +# CONFIG_XZ_DEC_SPARC is not set +# CONFIG_XZ_DEC_BCJ is not set +# CONFIG_XZ_DEC_TEST is not set +CONFIG_DECOMPRESS_GZIP=y +CONFIG_INTERVAL_TREE=y +CONFIG_ASSOCIATIVE_ARRAY=y +CONFIG_HAS_IOMEM=y +CONFIG_HAS_IOPORT_MAP=y +CONFIG_HAS_DMA=y +CONFIG_CHECK_SIGNATURE=y +CONFIG_CPU_RMAP=y +CONFIG_DQL=y +CONFIG_GLOB=y +# CONFIG_GLOB_SELFTEST is not set +CONFIG_NLATTR=y +CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE=y +# CONFIG_CORDIC is not set +# CONFIG_DDR is not set +# CONFIG_IRQ_POLL is not set +CONFIG_OID_REGISTRY=y +CONFIG_UCS2_STRING=y +CONFIG_FONT_SUPPORT=y +# CONFIG_FONTS is not set +CONFIG_FONT_8x8=y +CONFIG_FONT_8x16=y +# CONFIG_SG_SPLIT is not set +CONFIG_ARCH_HAS_SG_CHAIN=y +CONFIG_ARCH_HAS_PMEM_API=y +CONFIG_ARCH_HAS_MMIO_FLUSH=y diff --git a/projects/Virtual/options b/projects/Virtual/options new file mode 100644 index 00000000000..0e896ac238c --- /dev/null +++ b/projects/Virtual/options @@ -0,0 +1,106 @@ +################################################################################ +# setup system defaults +################################################################################ + + # The TARGET_CPU variable controls which processor should be targeted for + # generated code. + case $TARGET_ARCH in + x86_64) + # (AMD CPUs) k8 k8-sse3 opteron opteron-sse3 athlon64 athlon64-sse3 + # athlon-fx amdfam10 barcelona + # (Intel CPUs) atom core2 nocona + # + TARGET_CPU="x86-64" + ;; + esac + + # Bootloader to use (syslinux / u-boot / atv-bootloader) + BOOTLOADER="syslinux" + + # u-boot version to use (default) + UBOOT_VERSION="default" + + # Configuration for u-boot + UBOOT_CONFIG="" + + # Target Configfile for u-boot + UBOOT_CONFIGFILE="" + + # Kernel target + KERNEL_TARGET="bzImage" + + # Kernel extra targets to build + KERNEL_UBOOT_EXTRA_TARGET="" + + # Additional kernel make parameters (for example to specify the u-boot loadaddress) + KERNEL_MAKE_EXTRACMD="" + + # Kernel to use. values can be: + # default: default mainline kernel + LINUX="default" + + +################################################################################ +# setup build defaults +################################################################################ + + # Build optimizations (size/normal) + OPTIMIZATIONS="size" + + # Project CFLAGS + PROJECT_CFLAGS="-mmmx -msse -msse2 -mfpmath=sse" + + # LTO (Link Time Optimization) support + LTO_SUPPORT="yes" + + # GOLD (Google Linker) support + GOLD_SUPPORT="yes" + + # SquashFS compression method (gzip / lzo / xz) + SQUASHFS_COMPRESSION="gzip" + + +################################################################################ +# setup project defaults +################################################################################ + + # build and install ALSA Audio support (yes / no) + ALSA_SUPPORT="yes" + + # OpenGL(X) implementation to use (no / mesa) + OPENGL="mesa" + + # OpenGL-ES implementation to use (no / bcm2835-driver / gpu-viv-bin-mx6q) + OPENGLES="no" + + # include uvesafb support (yes / no) + UVESAFB_SUPPORT="yes" + + # Displayserver to use (x11 / no) + DISPLAYSERVER="x11" + + # KODI Player implementation to use (default / bcm2835-driver / libfslvpuwrap) + KODIPLAYER_DRIVER="default" + + # Modules to install in initramfs for early boot + INITRAMFS_MODULES="" + + # additional Firmware to use (dvb-firmware, misc-firmware, wlan-firmware) + # Space separated list is supported, + # e.g. FIRMWARE="dvb-firmware misc-firmware wlan-firmware" + FIRMWARE="misc-firmware wlan-firmware dvb-firmware iwlwifi-firmware" + + # additional drivers to install: + # for a list of additinoal drivers see packages/linux-drivers + # Space separated list is supported, + # e.g. ADDITIONAL_DRIVERS="DRIVER1 DRIVER2" + ADDITIONAL_DRIVERS="$ADDITIONAL_DRIVERS bcm_sta vboxguest" + + # Xorg Graphic drivers to use (all / i915,i965,r200,r300,r600,nvidia,nouveau,vmware,virtualbox) + # Space separated list is supported, + # e.g. GRAPHIC_DRIVERS="i915 i965 r300 r600 radeonsi nvidia nouveau" + GRAPHIC_DRIVERS="vmware virtualbox" + + # set the addon dirs + ADDON_PATH="$ADDON_VERSION/Generic/$TARGET_ARCH" + ADDON_URL="$ADDON_SERVER_URL/$ADDON_PATH" diff --git a/projects/WeTek_Core/initramfs/platform_init b/projects/WeTek_Core/initramfs/platform_init index 13a23033735..c83a0f5b761 100755 --- a/projects/WeTek_Core/initramfs/platform_init +++ b/projects/WeTek_Core/initramfs/platform_init @@ -48,6 +48,9 @@ echo 1 > /sys/class/graphics/fb1/blank # Disable framebuffer scaling echo 0 > /sys/class/graphics/fb0/free_scale +# set initial video state +echo 1 > /sys/class/video/disable_video + # Set framebuffer geometry to match the resolution case "$hdmimode" in 720*) diff --git a/projects/WeTek_Core/install/updater-script b/projects/WeTek_Core/install/updater-script index 954414988db..7c133e5ab9d 100644 --- a/projects/WeTek_Core/install/updater-script +++ b/projects/WeTek_Core/install/updater-script @@ -1,9 +1,6 @@ show_progress(0.500000, 3); set_bootloader_env("upgrade_step", "3"); -ui_print("Wiping Userdata"); -format("ext4", "EMMC", "/dev/block/data", "0", "/data"); - ui_print("Writing kernel image"); assert(package_extract_file("KERNEL", "/tmp/boot.img"), write_raw_image("/tmp/boot.img", "boot"), @@ -33,4 +30,4 @@ write_raw_image(package_extract_file("logo.img"), "logo"); set_bootloader_env("upgrade_step", "1"); show_progress(0.100000, 0); -ui_print("OpenELEC Installed Successfully"); +ui_print("LibreELEC Installed Successfully"); diff --git a/projects/WeTek_Core/kodi/advancedsettings.xml b/projects/WeTek_Core/kodi/advancedsettings.xml index 6c59e0b8a7b..ecb3edfae50 100644 --- a/projects/WeTek_Core/kodi/advancedsettings.xml +++ b/projects/WeTek_Core/kodi/advancedsettings.xml @@ -6,10 +6,6 @@ <clienttimeout>30</clienttimeout> </samba> - <network> - <readbufferfactor>4.0</readbufferfactor> - </network> - <pvr> <minvideocachelevel>5</minvideocachelevel> <minaudiocachelevel>20</minaudiocachelevel> diff --git a/projects/WeTek_Core/options b/projects/WeTek_Core/options index 09f14f7f173..be6f37d5306 100644 --- a/projects/WeTek_Core/options +++ b/projects/WeTek_Core/options @@ -96,8 +96,11 @@ # OpenGL(X) implementation to use (no / Mesa) OPENGL="no" - # OpenGL-ES implementation to use (no / bcm2835-driver / gpu-viv-bin-mx6q / opengl-meson6) - OPENGLES="opengl-meson8" + # OpenGL-ES implementation to use (no / bcm2835-driver / gpu-viv-bin-mx6q / opengl-meson) + OPENGLES="opengl-meson" + + # Amlogic Meson SOC family (8 / 6 / gxbb) + MESON_FAMILY="8" # include uvesafb support (yes / no) UVESAFB_SUPPORT="no" diff --git a/projects/WeTek_Core/patches/kodi/0003-aml-Add-support-for-4k-resolutions.patch b/projects/WeTek_Core/patches/kodi/0003-aml-Add-support-for-4k-resolutions.patch index f662832e773..e0782c17d19 100644 --- a/projects/WeTek_Core/patches/kodi/0003-aml-Add-support-for-4k-resolutions.patch +++ b/projects/WeTek_Core/patches/kodi/0003-aml-Add-support-for-4k-resolutions.patch @@ -97,99 +97,6 @@ index 21256ef..2103f0b 100644 m_nativeWindow = nativeWindow; SetFramebufferResolution(nativeWindow->width, nativeWindow->height); -@@ -142,48 +157,78 @@ bool CEGLNativeTypeAmlogic::SetNativeResolution(const RESOLUTION_INFO &res) - } - #endif - -- switch((int)(0.5 + res.fRefreshRate)) -+ switch((int)(res.fRefreshRate*10)) - { - default: -- case 60: -+ case 600: - switch(res.iScreenWidth) - { - default: - case 1280: -- SetDisplayResolution("720p"); -+ return SetDisplayResolution("720p"); - break; - case 1920: - if (res.dwFlags & D3DPRESENTFLAG_INTERLACED) -- SetDisplayResolution("1080i"); -+ return SetDisplayResolution("1080i"); - else -- SetDisplayResolution("1080p"); -+ return SetDisplayResolution("1080p"); - break; - } - break; -- case 50: -+ case 500: - switch(res.iScreenWidth) - { - default: - case 1280: -- SetDisplayResolution("720p50hz"); -+ return SetDisplayResolution("720p50hz"); - break; - case 1920: - if (res.dwFlags & D3DPRESENTFLAG_INTERLACED) -- SetDisplayResolution("1080i50hz"); -+ return SetDisplayResolution("1080i50hz"); - else -- SetDisplayResolution("1080p50hz"); -+ return SetDisplayResolution("1080p50hz"); - break; - } - break; -- case 30: -- SetDisplayResolution("1080p30hz"); -+ case 300: -+ switch(res.iScreenWidth) -+ { -+ case 3840: -+ return SetDisplayResolution("4k2k30hz"); -+ break; -+ default: -+ return SetDisplayResolution("1080p30hz"); -+ break; -+ } - break; -- case 24: -- SetDisplayResolution("1080p24hz"); -+ case 250: -+ switch(res.iScreenWidth) -+ { -+ case 3840: -+ return SetDisplayResolution("4k2k25hz"); -+ break; -+ default: -+ return SetDisplayResolution("1080p25hz"); -+ break; -+ } -+ break; -+ case 240: -+ switch(res.iScreenWidth) -+ { -+ case 3840: -+ return SetDisplayResolution("4k2k24hz"); -+ break; -+ case 4096: -+ return SetDisplayResolution("4k2ksmpte"); -+ break; -+ default: -+ return SetDisplayResolution("1080p24hz"); -+ break; -+ } - break; - } - -- return true; -+ return false; - } - - bool CEGLNativeTypeAmlogic::ProbeResolutions(std::vector<RESOLUTION_INFO> &resolutions) @@ -280,8 +325,8 @@ void CEGLNativeTypeAmlogic::SetFramebufferResolution(int width, int height) cons { vinfo.xres = width; diff --git a/projects/WeTek_Core/patches/kodi/0005-aml-Fix-compiler-badness-when-compiling-with-amcodec.patch b/projects/WeTek_Core/patches/kodi/0005-aml-Fix-compiler-badness-when-compiling-with-amcodec.patch deleted file mode 100644 index c91e0705989..00000000000 --- a/projects/WeTek_Core/patches/kodi/0005-aml-Fix-compiler-badness-when-compiling-with-amcodec.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 4570b6dfdd6e9dfe67f3f2b1103a3bc4b4a7f9cf Mon Sep 17 00:00:00 2001 -From: Alex Deryskyba <alex@codesnake.com> -Date: Sat, 12 Dec 2015 02:15:15 +0100 -Subject: [PATCH 5/6] [aml] Fix compiler badness when compiling with amcodec - ---- - xbmc/cores/dvdplayer/DVDCodecs/Video/Makefile.in | 2 -- - 1 file changed, 2 deletions(-) - -diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/Makefile.in b/xbmc/cores/dvdplayer/DVDCodecs/Video/Makefile.in -index 56ec6a3..52fa07e 100644 ---- a/xbmc/cores/dvdplayer/DVDCodecs/Video/Makefile.in -+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/Makefile.in -@@ -26,8 +26,6 @@ endif - ifeq (@USE_LIBAMCODEC@,1) - SRCS += AMLCodec.cpp - SRCS += DVDVideoCodecAmlogic.cpp --INCLUDES += -I$(prefix)/include/amcodec --INCLUDES += -I$(prefix)/include/amplayer - endif - - ifeq (@USE_ANDROID@,1) --- -1.7.10.4 - diff --git a/packages/devel/libcec/patches/libcec-03-amlogic-support.patch b/projects/WeTek_Core/patches/libcec/libcec-00-amlogic-support.patch similarity index 77% rename from packages/devel/libcec/patches/libcec-03-amlogic-support.patch rename to projects/WeTek_Core/patches/libcec/libcec-00-amlogic-support.patch index 8d58b75439e..02bedc7b9a5 100644 --- a/packages/devel/libcec/patches/libcec-03-amlogic-support.patch +++ b/projects/WeTek_Core/patches/libcec/libcec-00-amlogic-support.patch @@ -1,8 +1,26 @@ -diff -Nur -x .cproject -x .project -x .settings libcec-3.0.1/include/cectypes.h libcec-3.0.1-with-amlogic-adapter/include/cectypes.h ---- libcec-3.0.1/include/cectypes.h 2016-02-21 01:11:20.791177759 +0100 -+++ libcec-3.0.1-with-amlogic-adapter/include/cectypes.h 2016-02-10 13:45:19.057046951 +0100 -@@ -320,6 +320,16 @@ +diff --git a/README.md b/README.md +index dfaf4d6..0dffdcf 100644 +--- a/README.md ++++ b/README.md +@@ -93,6 +93,12 @@ To compile in support for Exynos devices, you have to pass the argument -DHAVE_E + cmake -DHAVE_EXYNOS_API=1 .. + ``` ++### Amlogic ++To compile in support for Amlogic devices, you have to pass the argument -DHAVE_AMLOGIC_API=1 to cmake: ++``` ++cmake -DHAVE_AMLOGIC_API=1 .. ++``` ++ + ### TDA995x + To compile in support for TDA995x devices, you have to pass the argument -DHAVE_TDA995X_API=1 to cmake: + ``` +diff --git a/include/cectypes.h b/include/cectypes.h +index 0fdd48e..b7e1932 100644 +--- a/include/cectypes.h ++++ b/include/cectypes.h +@@ -309,6 +309,16 @@ namespace CEC { + #define CEC_EXYNOS_VIRTUAL_COM "Exynos" /*! + * the path to use for the Amlogic HDMI CEC device @@ -18,37 +36,36 @@ diff -Nur -x .cproject -x .project -x .settings libcec-3.0.1/include/cectypes.h * Mimimum client version */ #define CEC_MIN_LIB_VERSION 3 -@@ -888,7 +898,8 @@ +@@ -877,7 +887,8 @@ typedef enum cec_adapter_type + ADAPTERTYPE_P8_DAUGHTERBOARD = 0x2, ADAPTERTYPE_RPI = 0x100, ADAPTERTYPE_TDA995x = 0x200, - ADAPTERTYPE_EXYNOS = 0x300, -- ADAPTERTYPE_IMX = 0x400 -+ ADAPTERTYPE_IMX = 0x400, +- ADAPTERTYPE_EXYNOS = 0x300 ++ ADAPTERTYPE_EXYNOS = 0x300, + ADAPTERTYPE_AMLOGIC = 0x500 } cec_adapter_type; /** force exporting through swig */ -diff -Nur -x .cproject -x .project -x .settings libcec-3.0.1/README.md libcec-3.0.1-with-amlogic-adapter/README.md ---- libcec-3.0.1/README.md 2015-07-03 19:20:49.000000000 +0200 -+++ libcec-3.0.1-with-amlogic-adapter/README.md 2016-02-10 12:03:54.517523977 +0100 -@@ -58,6 +58,12 @@ - cmake -DHAVE_EXYNOS_API=1 .. - ``` - -+### Amlogic -+To compile in support for Amlogic devices, you have to pass the argument -DHAVE_AMLOGIC_API=1 to cmake: -+``` -+cmake -DHAVE_AMLOGIC_API=1 .. -+``` -+ - ## TDA995x ## - To compile in support for TDA995x devices, you have to pass the argument -DHAVE_TDA995X_API=1 to cmake: - ``` -diff -Nur -x .cproject -x .project -x .settings libcec-3.0.1/src/libcec/adapter/AdapterFactory.cpp libcec-3.0.1-with-amlogic-adapter/src/libcec/adapter/AdapterFactory.cpp ---- libcec-3.0.1/src/libcec/adapter/AdapterFactory.cpp 2016-02-21 01:11:12.579266950 +0100 -+++ libcec-3.0.1-with-amlogic-adapter/src/libcec/adapter/AdapterFactory.cpp 2016-02-10 12:41:44.252060917 +0100 -@@ -63,6 +63,11 @@ - #include "IMX/IMXCECAdapterCommunication.h" +diff --git a/src/libcec/CMakeLists.txt b/src/libcec/CMakeLists.txt +index a494533..e94b094 100644 +--- a/src/libcec/CMakeLists.txt ++++ b/src/libcec/CMakeLists.txt +@@ -87,6 +87,9 @@ set(CEC_HEADERS devices/CECRecordingDevice.h + adapter/Exynos/ExynosCEC.h + adapter/Exynos/ExynosCECAdapterDetection.h + adapter/Exynos/ExynosCECAdapterCommunication.h ++ adapter/Amlogic/AmlogicCEC.h ++ adapter/Amlogic/AmlogicCECAdapterDetection.h ++ adapter/Amlogic/AmlogicCECAdapterCommunication.h + adapter/Pulse-Eight/USBCECAdapterMessageQueue.h + adapter/Pulse-Eight/USBCECAdapterCommunication.h + adapter/Pulse-Eight/USBCECAdapterCommands.h +diff --git a/src/libcec/adapter/AdapterFactory.cpp b/src/libcec/adapter/AdapterFactory.cpp +index da05725..824c5ff 100644 +--- a/src/libcec/adapter/AdapterFactory.cpp ++++ b/src/libcec/adapter/AdapterFactory.cpp +@@ -58,6 +58,11 @@ + #include "Exynos/ExynosCECAdapterCommunication.h" #endif +#if defined(HAVE_AMLOGIC_API) @@ -59,7 +76,7 @@ diff -Nur -x .cproject -x .project -x .settings libcec-3.0.1/src/libcec/adapter/ using namespace CEC; int8_t CAdapterFactory::FindAdapters(cec_adapter *deviceList, uint8_t iBufSize, const char *strDevicePath /* = NULL */) -@@ -131,6 +136,18 @@ +@@ -126,8 +131,20 @@ int8_t CAdapterFactory::DetectAdapters(cec_adapter_descriptor *deviceList, uint8 } #endif @@ -76,9 +93,12 @@ diff -Nur -x .cproject -x .project -x .settings libcec-3.0.1/src/libcec/adapter/ +#endif + +-#if !defined(HAVE_RPI_API) && !defined(HAVE_P8_USB) && !defined(HAVE_TDA995X_API) ++#if !defined(HAVE_RPI_API) && !defined(HAVE_P8_USB) && !defined(HAVE_TDA995X_API) && !defined(HAVE_AMLOGIC_API) + #error "libCEC doesn't have support for any type of adapter. please check your build system or configuration" + #endif - #if defined(HAVE_IMX_API) -@@ -166,6 +183,11 @@ +@@ -146,6 +163,11 @@ IAdapterCommunication *CAdapterFactory::GetInstance(const char *strPort, uint16_ return new CExynosCECAdapterCommunication(m_lib->m_cec); #endif @@ -90,19 +110,59 @@ diff -Nur -x .cproject -x .project -x .settings libcec-3.0.1/src/libcec/adapter/ #if defined(HAVE_RPI_API) if (!strcmp(strPort, CEC_RPI_VIRTUAL_COM)) return new CRPiCECAdapterCommunication(m_lib->m_cec); -@@ -180,7 +202,7 @@ - return new CUSBCECAdapterCommunication(m_lib->m_cec, strPort, iBaudRate); - #endif - --#if !defined(HAVE_RPI_API) && !defined(HAVE_P8_USB) && !defined(HAVE_TDA995X_API) && !defined(HAVE_EXYNOS_API) && !defined(HAVE_IMX_API) -+#if !defined(HAVE_RPI_API) && !defined(HAVE_P8_USB) && !defined(HAVE_TDA995X_API) && !defined(HAVE_EXYNOS_API) && !defined(HAVE_IMX_API) && !defined(HAVE_AMLOGIC_API) - return NULL; - #endif - } -diff -Nur -x .cproject -x .project -x .settings libcec-3.0.1/src/libcec/adapter/Amlogic/AmlogicCECAdapterCommunication.cpp libcec-3.0.1-with-amlogic-adapter/src/libcec/adapter/Amlogic/AmlogicCECAdapterCommunication.cpp ---- libcec-3.0.1/src/libcec/adapter/Amlogic/AmlogicCECAdapterCommunication.cpp 1970-01-01 01:00:00.000000000 +0100 -+++ libcec-3.0.1-with-amlogic-adapter/src/libcec/adapter/Amlogic/AmlogicCECAdapterCommunication.cpp 2016-02-28 12:31:26.771045268 +0100 -@@ -0,0 +1,298 @@ +diff --git a/src/libcec/adapter/Amlogic/AmlogicCEC.h b/src/libcec/adapter/Amlogic/AmlogicCEC.h +new file mode 100644 +index 0000000..7b86982 +--- /dev/null ++++ b/src/libcec/adapter/Amlogic/AmlogicCEC.h +@@ -0,0 +1,41 @@ ++#pragma once ++/* ++ * This file is part of the libCEC(R) library. ++ * ++ * libCEC Amlogic Code Copyright (C) 2016 Gerald Dachs ++ * based heavily on: ++ * libCEC Exynos Code Copyright (C) 2014 Valentin Manea ++ * libCEC(R) is Copyright (C) 2011-2015 Pulse-Eight Limited. All rights reserved. ++ * libCEC(R) is an original work, containing original code. ++ * ++ * libCEC(R) is a trademark of Pulse-Eight Limited. ++ * ++ * This program is dual-licensed; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ++ * ++ * ++ * Alternatively, you can license this library under a commercial license, ++ * please contact Pulse-Eight Licensing for more information. ++ * ++ * For more information contact: ++ * Pulse-Eight Licensing <license@pulse-eight.com> ++ * http://www.pulse-eight.com/ ++ * http://www.pulse-eight.net/ ++ */ ++ ++ ++#define CEC_DEFAULT_PADDR 0x1000 ++#define CEC_IOC_SETLADDR _IOW('c', 0, unsigned int) ++#define CEC_IOC_GETPADDR _IO('c', 1) ++#define CEC_MAX_FRAME_SIZE 16 +diff --git a/src/libcec/adapter/Amlogic/AmlogicCECAdapterCommunication.cpp b/src/libcec/adapter/Amlogic/AmlogicCECAdapterCommunication.cpp +new file mode 100644 +index 0000000..5aeddda +--- /dev/null ++++ b/src/libcec/adapter/Amlogic/AmlogicCECAdapterCommunication.cpp +@@ -0,0 +1,305 @@ +/* + * This file is part of the libCEC(R) library. + * @@ -149,10 +209,10 @@ diff -Nur -x .cproject -x .project -x .settings libcec-3.0.1/src/libcec/adapter/ + +#include "CECTypeUtils.h" +#include "LibCEC.h" -+#include <platform/util/buffer.h> ++#include <p8-platform/util/buffer.h> + +using namespace CEC; -+using namespace PLATFORM; ++using namespace P8PLATFORM; + +#define LIB_CEC m_callback->GetLib() + @@ -346,6 +406,7 @@ diff -Nur -x .cproject -x .project -x .settings libcec-3.0.1/src/libcec/adapter/ + uint32_t size; + fd_set rfds; + cec_logical_address initiator, destination; ++ struct timeval tv; + + if (!IsOpen()) + return 0; @@ -362,8 +423,15 @@ diff -Nur -x .cproject -x .project -x .settings libcec-3.0.1/src/libcec/adapter/ + FD_ZERO(&rfds); + FD_SET(fd, &rfds); + -+ if (select(fd + 1, &rfds, NULL, NULL, NULL) >= 0 ) ++ tv.tv_sec = 1; ++ tv.tv_usec = 0; ++ ++ if (select(fd + 1, &rfds, NULL, NULL, &tv) >= 0 ) + { ++ ++ if (!FD_ISSET(fd, &rfds)) ++ continue; ++ + size = read(fd, buffer, CEC_MAX_FRAME_SIZE); + + if (size > 0) @@ -394,16 +462,17 @@ diff -Nur -x .cproject -x .project -x .settings libcec-3.0.1/src/libcec/adapter/ + m_callback->OnCommandReceived(cmd); + } + } -+ + } + + return 0; +} + +#endif // HAVE_AMLOGIC_API -diff -Nur -x .cproject -x .project -x .settings libcec-3.0.1/src/libcec/adapter/Amlogic/AmlogicCECAdapterCommunication.h libcec-3.0.1-with-amlogic-adapter/src/libcec/adapter/Amlogic/AmlogicCECAdapterCommunication.h ---- libcec-3.0.1/src/libcec/adapter/Amlogic/AmlogicCECAdapterCommunication.h 1970-01-01 01:00:00.000000000 +0100 -+++ libcec-3.0.1-with-amlogic-adapter/src/libcec/adapter/Amlogic/AmlogicCECAdapterCommunication.h 2016-02-28 12:16:30.985474428 +0100 +diff --git a/src/libcec/adapter/Amlogic/AmlogicCECAdapterCommunication.h b/src/libcec/adapter/Amlogic/AmlogicCECAdapterCommunication.h +new file mode 100644 +index 0000000..0e99cf8 +--- /dev/null ++++ b/src/libcec/adapter/Amlogic/AmlogicCECAdapterCommunication.h @@ -0,0 +1,105 @@ +#pragma once +/* @@ -445,14 +514,14 @@ diff -Nur -x .cproject -x .project -x .settings libcec-3.0.1/src/libcec/adapter/ + +#if defined(HAVE_AMLOGIC_API) + -+#include <platform/threads/mutex.h> -+#include <platform/threads/threads.h> ++#include <p8-platform/threads/mutex.h> ++#include <p8-platform/threads/threads.h> +#include "../AdapterCommunication.h" +#include <map> + +namespace CEC +{ -+ class CAmlogicCECAdapterCommunication : public IAdapterCommunication, public PLATFORM::CThread ++ class CAmlogicCECAdapterCommunication : public IAdapterCommunication, public P8PLATFORM::CThread + { + public: + /*! @@ -492,7 +561,7 @@ diff -Nur -x .cproject -x .project -x .settings libcec-3.0.1/src/libcec/adapter/ + void SetActiveSource(bool UNUSED(bSetTo), bool UNUSED(bClientUnregistered)) {} + ///} + -+ /** @name PLATFORM::CThread implementation */ ++ /** @name P8PLATFORM::CThread implementation */ + ///{ + void *Process(void); + ///} @@ -505,14 +574,16 @@ diff -Nur -x .cproject -x .project -x .settings libcec-3.0.1/src/libcec/adapter/ + + bool m_bLogicalAddressChanged; + cec_logical_addresses m_logicalAddresses; -+ PLATFORM::CMutex m_mutex; ++ P8PLATFORM::CMutex m_mutex; + int m_fd; + }; +}; +#endif -diff -Nur -x .cproject -x .project -x .settings libcec-3.0.1/src/libcec/adapter/Amlogic/AmlogicCECAdapterDetection.cpp libcec-3.0.1-with-amlogic-adapter/src/libcec/adapter/Amlogic/AmlogicCECAdapterDetection.cpp ---- libcec-3.0.1/src/libcec/adapter/Amlogic/AmlogicCECAdapterDetection.cpp 1970-01-01 01:00:00.000000000 +0100 -+++ libcec-3.0.1-with-amlogic-adapter/src/libcec/adapter/Amlogic/AmlogicCECAdapterDetection.cpp 2016-02-10 11:57:58.445532459 +0100 +diff --git a/src/libcec/adapter/Amlogic/AmlogicCECAdapterDetection.cpp b/src/libcec/adapter/Amlogic/AmlogicCECAdapterDetection.cpp +new file mode 100644 +index 0000000..2247346 +--- /dev/null ++++ b/src/libcec/adapter/Amlogic/AmlogicCECAdapterDetection.cpp @@ -0,0 +1,50 @@ +/* + * This file is part of the libCEC(R) library. @@ -564,9 +635,11 @@ diff -Nur -x .cproject -x .project -x .settings libcec-3.0.1/src/libcec/adapter/ +} + +#endif -diff -Nur -x .cproject -x .project -x .settings libcec-3.0.1/src/libcec/adapter/Amlogic/AmlogicCECAdapterDetection.h libcec-3.0.1-with-amlogic-adapter/src/libcec/adapter/Amlogic/AmlogicCECAdapterDetection.h ---- libcec-3.0.1/src/libcec/adapter/Amlogic/AmlogicCECAdapterDetection.h 1970-01-01 01:00:00.000000000 +0100 -+++ libcec-3.0.1-with-amlogic-adapter/src/libcec/adapter/Amlogic/AmlogicCECAdapterDetection.h 2016-02-10 11:57:58.445532459 +0100 +diff --git a/src/libcec/adapter/Amlogic/AmlogicCECAdapterDetection.h b/src/libcec/adapter/Amlogic/AmlogicCECAdapterDetection.h +new file mode 100644 +index 0000000..8a7418d +--- /dev/null ++++ b/src/libcec/adapter/Amlogic/AmlogicCECAdapterDetection.h @@ -0,0 +1,46 @@ +#pragma once +/* @@ -614,63 +687,19 @@ diff -Nur -x .cproject -x .project -x .settings libcec-3.0.1/src/libcec/adapter/ + static bool FindAdapter(void); + }; +} -diff -Nur -x .cproject -x .project -x .settings libcec-3.0.1/src/libcec/adapter/Amlogic/AmlogicCEC.h libcec-3.0.1-with-amlogic-adapter/src/libcec/adapter/Amlogic/AmlogicCEC.h ---- libcec-3.0.1/src/libcec/adapter/Amlogic/AmlogicCEC.h 1970-01-01 01:00:00.000000000 +0100 -+++ libcec-3.0.1-with-amlogic-adapter/src/libcec/adapter/Amlogic/AmlogicCEC.h 2016-02-10 11:57:58.445532459 +0100 -@@ -0,0 +1,41 @@ -+#pragma once -+/* -+ * This file is part of the libCEC(R) library. -+ * -+ * libCEC Amlogic Code Copyright (C) 2016 Gerald Dachs -+ * based heavily on: -+ * libCEC Exynos Code Copyright (C) 2014 Valentin Manea -+ * libCEC(R) is Copyright (C) 2011-2015 Pulse-Eight Limited. All rights reserved. -+ * libCEC(R) is an original work, containing original code. -+ * -+ * libCEC(R) is a trademark of Pulse-Eight Limited. -+ * -+ * This program is dual-licensed; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2 of the License, or -+ * (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -+ * -+ * -+ * Alternatively, you can license this library under a commercial license, -+ * please contact Pulse-Eight Licensing for more information. -+ * -+ * For more information contact: -+ * Pulse-Eight Licensing <license@pulse-eight.com> -+ * http://www.pulse-eight.com/ -+ * http://www.pulse-eight.net/ -+ */ -+ -+ -+#define CEC_DEFAULT_PADDR 0x1000 -+#define CEC_IOC_SETLADDR _IOW('c', 0, unsigned int) -+#define CEC_IOC_GETPADDR _IO('c', 1) -+#define CEC_MAX_FRAME_SIZE 16 -diff -Nur -x .cproject -x .project -x .settings libcec-3.0.1/src/libcec/cmake/CheckPlatformSupport.cmake libcec-3.0.1-with-amlogic-adapter/src/libcec/cmake/CheckPlatformSupport.cmake ---- libcec-3.0.1/src/libcec/cmake/CheckPlatformSupport.cmake 2016-02-21 01:11:12.579266950 +0100 -+++ libcec-3.0.1-with-amlogic-adapter/src/libcec/cmake/CheckPlatformSupport.cmake 2016-02-10 13:18:20.847385373 +0100 -@@ -11,6 +11,7 @@ - # HAVE_IMX_API 1 if i.MX is supported - # HAVE_TDA995X_API 1 if TDA995X is supported - # HAVE_EXYNOS_API 1 if Exynos is supported -+# HAVE_AMLOGIC_API 1 if Amlogic is supported +diff --git a/src/libcec/cmake/CheckPlatformSupport.cmake b/src/libcec/cmake/CheckPlatformSupport.cmake +index b8a16c8..311cb52 100644 +--- a/src/libcec/cmake/CheckPlatformSupport.cmake ++++ b/src/libcec/cmake/CheckPlatformSupport.cmake +@@ -9,6 +9,7 @@ + # HAVE_RPI_API 1 if Raspberry Pi is supported + # HAVE_TDA995X_API 1 if TDA995X is supported + # HAVE_EXYNOS_API 1 if Exynos is supported ++# HAVE_AMLOGIC_API 1 if Amlogic is supported + # HAVE_P8_USB 1 if Pulse-Eight devices are supported # HAVE_P8_USB_DETECT 1 if Pulse-Eight devices can be auto-detected - # - -@@ -129,6 +130,18 @@ + # HAVE_DRM_EDID_PARSER 1 if DRM EDID parsing is supported +@@ -132,6 +133,18 @@ else() else() set(HAVE_EXYNOS_API 0) endif() @@ -689,11 +718,12 @@ diff -Nur -x .cproject -x .project -x .settings libcec-3.0.1/src/libcec/cmake/Ch endif() # rt -diff -Nur -x .cproject -x .project -x .settings libcec-3.0.1/src/libcec/cmake/DisplayPlatformSupport.cmake libcec-3.0.1-with-amlogic-adapter/src/libcec/cmake/DisplayPlatformSupport.cmake ---- libcec-3.0.1/src/libcec/cmake/DisplayPlatformSupport.cmake 2016-02-21 01:11:12.579266950 +0100 -+++ libcec-3.0.1-with-amlogic-adapter/src/libcec/cmake/DisplayPlatformSupport.cmake 2016-02-10 12:47:10.380408360 +0100 -@@ -50,6 +50,12 @@ - message(STATUS "Exynos support: no") +diff --git a/src/libcec/cmake/DisplayPlatformSupport.cmake b/src/libcec/cmake/DisplayPlatformSupport.cmake +index 9dcaacf..464252e 100644 +--- a/src/libcec/cmake/DisplayPlatformSupport.cmake ++++ b/src/libcec/cmake/DisplayPlatformSupport.cmake +@@ -44,6 +44,12 @@ else() + message(STATUS "DRM support: no") endif() +if (HAVE_AMLOGIC_API) @@ -705,23 +735,11 @@ diff -Nur -x .cproject -x .project -x .settings libcec-3.0.1/src/libcec/cmake/Di if (HAVE_PYTHON) message(STATUS "Python support: version ${PYTHONLIBS_VERSION_STRING} (${PYTHON_VERSION})") else() -diff -Nur -x .cproject -x .project -x .settings libcec-3.0.1/src/libcec/CMakeLists.txt libcec-3.0.1-with-amlogic-adapter/src/libcec/CMakeLists.txt ---- libcec-3.0.1/src/libcec/CMakeLists.txt 2015-07-03 19:20:49.000000000 +0200 -+++ libcec-3.0.1-with-amlogic-adapter/src/libcec/CMakeLists.txt 2016-02-10 11:57:58.445532459 +0100 -@@ -83,6 +83,9 @@ - adapter/Exynos/ExynosCEC.h - adapter/Exynos/ExynosCECAdapterDetection.h - adapter/Exynos/ExynosCECAdapterCommunication.h -+ adapter/Amlogic/AmlogicCEC.h -+ adapter/Amlogic/AmlogicCECAdapterDetection.h -+ adapter/Amlogic/AmlogicCECAdapterCommunication.h - adapter/Pulse-Eight/USBCECAdapterMessageQueue.h - adapter/Pulse-Eight/USBCECAdapterCommunication.h - adapter/Pulse-Eight/USBCECAdapterCommands.h -diff -Nur -x .cproject -x .project -x .settings libcec-3.0.1/src/libcec/env.h.in libcec-3.0.1-with-amlogic-adapter/src/libcec/env.h.in ---- libcec-3.0.1/src/libcec/env.h.in 2016-02-21 01:11:12.579266950 +0100 -+++ libcec-3.0.1-with-amlogic-adapter/src/libcec/env.h.in 2016-02-10 11:57:58.449532413 +0100 -@@ -69,6 +69,9 @@ +diff --git a/src/libcec/env.h.in b/src/libcec/env.h.in +index 0496aa0..971f769 100644 +--- a/src/libcec/env.h.in ++++ b/src/libcec/env.h.in +@@ -72,6 +72,9 @@ /* Define to 1 for Exynos support */ #cmakedefine HAVE_EXYNOS_API @HAVE_EXYNOS_API@ diff --git a/projects/WeTek_Core/patches/linux/080-amlogic-cec-driver.patch b/projects/WeTek_Core/patches/linux/080-amlogic-cec-driver.patch index 5d72bcde96f..e4685d281eb 100644 --- a/projects/WeTek_Core/patches/linux/080-amlogic-cec-driver.patch +++ b/projects/WeTek_Core/patches/linux/080-amlogic-cec-driver.patch @@ -55,10 +55,10 @@ index 7a944cd..f74ec1f 100755 #EXTRA_CFLAGS += -O2 diff --git a/drivers/amlogic/hdmi/hdmi_tx/amlogic_cec.c b/drivers/amlogic/hdmi/hdmi_tx/amlogic_cec.c new file mode 100644 -index 0000000..bd31aaa +index 0000000..1bfc29b --- /dev/null +++ b/drivers/amlogic/hdmi/hdmi_tx/amlogic_cec.c -@@ -0,0 +1,596 @@ +@@ -0,0 +1,679 @@ +/* linux/drivers/amlogic/hdmi/hdmi_tx/amlogic_cec.c + * + * Copyright (c) 2016 Gerald Dachs @@ -84,6 +84,7 @@ index 0000000..bd31aaa +#include <linux/delay.h> +#include <linux/types.h> +#include <linux/atomic.h> ++#include <linux/semaphore.h> + +#include <asm/uaccess.h> +#include <asm/delay.h> @@ -127,6 +128,8 @@ index 0000000..bd31aaa +/* CEC Tx buffer size */ +#define CEC_TX_BUFF_SIZE 16 + ++static DEFINE_SEMAPHORE(init_mutex); ++ +struct cec_rx_list { + u8 buffer[CEC_RX_BUFF_SIZE]; + unsigned char size; @@ -226,7 +229,7 @@ index 0000000..bd31aaa + rx_msg_status = amlogic_cec_read_reg(CEC_RX_MSG_STATUS); + rx_num_msg = amlogic_cec_read_reg(CEC_RX_NUM_MSG); + -+ amlogic_cec_log_dbg("amlogic_cec_read_hw: enter: CEC_RX_MSG_STATUS %d, CEC_RX_NUM_MSG %d\n", rx_msg_status, rx_num_msg); ++ amlogic_cec_log_dbg("rx_msg_status: %d, rx_num_msg: %d\n", rx_msg_status, rx_num_msg); + + valid_msg = (RX_DONE == rx_msg_status) && (1 == rx_num_msg); + @@ -248,7 +251,7 @@ index 0000000..bd31aaa +#if MESON_CPU_TYPE >= MESON_CPU_TYPE_MESON8 + aml_write_reg32(P_AO_CEC_INTR_CLR, aml_read_reg32(P_AO_CEC_INTR_CLR) | (1 << 2)); +#endif -+ amlogic_cec_write_reg(CEC_RX_MSG_CMD, RX_ACK_NEXT); ++ amlogic_cec_write_reg(CEC_RX_MSG_CMD, valid_msg ? RX_ACK_NEXT : RX_ACK_CURRENT); + amlogic_cec_write_reg(CEC_RX_MSG_CMD, RX_NO_OP); + + return ret; @@ -290,45 +293,89 @@ index 0000000..bd31aaa + if (hdmitx_device->hdmi_info.vsdb_phy_addr.valid == 0) + { + amlogic_cec_log_dbg("no valid cec physical address\n"); -+ if (aml_read_reg32(P_AO_DEBUG_REG1)) ++ if (aml_read_reg32(P_AO_DEBUG_REG1) & 0xffff) + { + amlogic_cec_log_dbg("use last physical address\n"); + } + else + { -+ aml_write_reg32(P_AO_DEBUG_REG1, 0x1000); ++ aml_write_reg32(P_AO_DEBUG_REG1, (aml_read_reg32(P_AO_DEBUG_REG1) & (0xf << 16)) | 0x1000); + amlogic_cec_log_dbg("use default physical address\n"); + } + } + else + { -+ aml_write_reg32(P_AO_DEBUG_REG1, cec_phy_addr); -+ amlogic_cec_log_dbg("physical address:0x%x\n", aml_read_reg32(P_AO_DEBUG_REG1)); -+ -+ if ((hdmitx_device->cec_init_ready != 0) && (hdmitx_device->hpd_state != 0)) -+ { -+ if ((entry = kmalloc(sizeof(struct cec_rx_list), GFP_ATOMIC)) == NULL) ++ if (cec_global_info.my_node_index) ++ { ++ // prevent write operations ++ if (down_interruptible(&init_mutex)) + { -+ amlogic_cec_log_dbg("can't alloc cec_rx_list\n"); ++ printk(KERN_ERR "[amlogic] ##### cec node init interrupted! #####\n"); ++ return; + } -+ else ++ hdmitx_device->cec_init_ready = 0; ++ spin_lock_irqsave(&cec_rx_struct.lock, spin_flags); ++ ++ amlogic_cec_log_dbg("start reset\n"); ++#if MESON_CPU_TYPE == MESON_CPU_TYPE_MESON6 ++ aml_write_reg32(P_HDMI_CTRL_PORT, aml_read_reg32(P_HDMI_CTRL_PORT)|(1<<16)); ++ hdmi_wr_reg(OTHER_BASE_ADDR+HDMI_OTHER_CTRL0, 0xc); //[3]cec_creg_sw_rst [2]cec_sys_sw_rst ++ ++#if 0 ++ hdmi_wr_reg(CEC0_BASE_ADDR+CEC_TX_CLEAR_BUF, 0x1); ++ hdmi_wr_reg(CEC0_BASE_ADDR+CEC_RX_CLEAR_BUF, 0x1); ++ ++ hdmi_wr_reg(CEC0_BASE_ADDR+CEC_TX_CLEAR_BUF, 0x0); ++ hdmi_wr_reg(CEC0_BASE_ADDR+CEC_RX_CLEAR_BUF, 0x0); ++#endif ++ ++ hdmi_wr_reg(OTHER_BASE_ADDR+HDMI_OTHER_CTRL0, 0x0); ++ aml_write_reg32(P_HDMI_CTRL_PORT, aml_read_reg32(P_HDMI_CTRL_PORT)&(~(1<<16))); ++ hdmi_wr_reg(CEC0_BASE_ADDR+CEC_CLOCK_DIV_H, 0x00 ); ++ hdmi_wr_reg(CEC0_BASE_ADDR+CEC_CLOCK_DIV_L, 0xf0 ); ++ ++#endif ++#if MESON_CPU_TYPE >= MESON_CPU_TYPE_MESON8 ++ // regain rx interrupts ++ cec_enable_irq(); ++#endif ++ spin_unlock_irqrestore(&cec_rx_struct.lock, spin_flags); ++ ++ hdmitx_device->cec_init_ready = 1; ++ ++ up(&init_mutex); ++ amlogic_cec_log_dbg("stop reset\n"); ++ } ++ ++ if ((aml_read_reg32(P_AO_DEBUG_REG1) & 0xffff) != cec_phy_addr) ++ { ++ aml_write_reg32(P_AO_DEBUG_REG1, (aml_read_reg32(P_AO_DEBUG_REG1) & (0xf << 16)) | cec_phy_addr); ++ amlogic_cec_log_dbg("physical address:0x%x\n", aml_read_reg32(P_AO_DEBUG_REG1) & 0xffff); ++ ++ if ((hdmitx_device->cec_init_ready != 0) && (hdmitx_device->hpd_state != 0)) + { -+ // let the libCEC ask for new physical Address -+ entry->buffer[0] = 0xff; -+ entry->size = 1; -+ INIT_LIST_HEAD(&entry->list); -+ -+ spin_lock_irqsave(&cec_rx_struct.lock, spin_flags); -+ list_add_tail(&entry->list, &cec_rx_struct.list); -+ amlogic_cec_set_rx_state(STATE_DONE); -+ spin_unlock_irqrestore(&cec_rx_struct.lock, spin_flags); -+ -+ amlogic_cec_log_dbg("trigger libCEC\n"); -+ wake_up_interruptible(&cec_rx_struct.waitq); ++ if ((entry = kmalloc(sizeof(struct cec_rx_list), GFP_ATOMIC)) == NULL) ++ { ++ amlogic_cec_log_dbg("can't alloc cec_rx_list\n"); ++ } ++ else ++ { ++ // let the libCEC ask for new physical Address ++ entry->buffer[0] = 0xff; ++ entry->size = 1; ++ INIT_LIST_HEAD(&entry->list); ++ ++ spin_lock_irqsave(&cec_rx_struct.lock, spin_flags); ++ list_add_tail(&entry->list, &cec_rx_struct.list); ++ amlogic_cec_set_rx_state(STATE_DONE); ++ spin_unlock_irqrestore(&cec_rx_struct.lock, spin_flags); ++ ++ amlogic_cec_log_dbg("trigger libCEC\n"); ++ wake_up_interruptible(&cec_rx_struct.waitq); ++ } + } -+ } ++ } + } -+ amlogic_cec_log_dbg("cec node init: cec features ok !\n"); +} + +static irqreturn_t amlogic_cec_irq_handler(int irq, void *dummy) @@ -338,7 +385,9 @@ index 0000000..bd31aaa + unsigned int tx_msg_state; + unsigned int rx_msg_state; + ++#if MESON_CPU_TYPE == MESON_CPU_TYPE_MESON6 + udelay(100); //Delay execution a little. This fixes an issue when HDMI CEC stops working after a while. ++#endif + + tx_msg_state = amlogic_cec_read_reg(CEC_TX_MSG_STATUS); + rx_msg_state = amlogic_cec_read_reg(CEC_RX_MSG_STATUS); @@ -356,9 +405,6 @@ index 0000000..bd31aaa + case TX_DONE : + amlogic_cec_set_tx_state(STATE_DONE); + break; -+ default : -+ amlogic_cec_log_dbg("unexpected ts message state: 0x%x", tx_msg_state); -+ break; + } + wake_up_interruptible(&cec_tx_struct.waitq); + } @@ -372,16 +418,18 @@ index 0000000..bd31aaa + return IRQ_HANDLED; + } + ++ INIT_LIST_HEAD(&entry->list); ++ ++ spin_lock_irqsave(&cec_rx_struct.lock, spin_flags); ++ + if ((-1) == amlogic_cec_read_hw(entry->buffer, &entry->size)) + { + kfree(entry); + amlogic_cec_log_dbg("amlogic_cec_irq_handler: nothing to read\n"); ++ spin_unlock_irqrestore(&cec_rx_struct.lock, spin_flags); + return IRQ_HANDLED; + } + -+ INIT_LIST_HEAD(&entry->list); -+ -+ spin_lock_irqsave(&cec_rx_struct.lock, spin_flags); + list_add_tail(&entry->list, &cec_rx_struct.list); + amlogic_cec_set_rx_state(STATE_DONE); + spin_unlock_irqrestore(&cec_rx_struct.lock, spin_flags); @@ -432,21 +480,17 @@ index 0000000..bd31aaa + aml_write_reg32(P_SYS_CPU_0_IRQ_IN1_INTR_MASK, aml_read_reg32(P_SYS_CPU_0_IRQ_IN1_INTR_MASK) | (1 << 23)); // Enable the hdmi cec interrupt +#endif +#if MESON_CPU_TYPE >= MESON_CPU_TYPE_MESON8 -+#if 1 // Please match with H/W cec config +// GPIOAO_12 + aml_set_reg32_bits(P_AO_RTI_PIN_MUX_REG, 0, 14, 1); // bit[14]: AO_PWM_C pinmux //0xc8100014 + aml_set_reg32_bits(P_AO_RTI_PULL_UP_REG, 1, 12, 1); // bit[12]: enable AO_12 internal pull-up //0xc810002c + aml_set_reg32_bits(P_AO_RTI_PIN_MUX_REG, 1, 17, 1); // bit[17]: AO_CEC pinmux //0xc8100014 + ao_cec_init(); -+#else -+// GPIOH_3 -+ aml_set_reg32_bits(P_PAD_PULL_UP_EN_REG1, 0, 19, 1); // disable gpioh_3 internal pull-up -+ aml_set_reg32_bits(P_PERIPHS_PIN_MUX_1, 1, 23, 1); // gpioh_3 cec pinmux -+#endif + cec_arbit_bit_time_set(3, 0x118, 0); + cec_arbit_bit_time_set(5, 0x000, 0); + cec_arbit_bit_time_set(7, 0x2aa, 0); +#endif ++ amlogic_cec_write_reg(CEC_LOGICAL_ADDR0, (0x1 << 4) | 0xf); ++ + hdmitx_device->cec_init_ready = 1; + + } @@ -463,6 +507,8 @@ index 0000000..bd31aaa + free_irq(INT_AO_CEC, (void *)hdmitx_device); +#endif + ++ amlogic_cec_write_reg(CEC_LOGICAL_ADDR0, (0x1 << 4) | 0xf); ++ + atomic_dec(&hdmi_on); + + return 0; @@ -503,7 +549,6 @@ index 0000000..bd31aaa + + retval = entry->size; + -+ amlogic_cec_set_rx_state(STATE_RX); + +error_exit: + if (entry != NULL) @@ -512,6 +557,11 @@ index 0000000..bd31aaa + kfree(entry); + } + ++ if (list_empty(&cec_rx_struct.list)) ++ { ++ amlogic_cec_set_rx_state(STATE_RX); ++ } ++ + spin_unlock_irqrestore(&cec_rx_struct.lock, spin_flags); + + return retval; @@ -520,6 +570,7 @@ index 0000000..bd31aaa +static ssize_t amlogic_cec_write(struct file *file, const char __user *buffer, + size_t count, loff_t *ppos) +{ ++ int retval = count; + char data[CEC_TX_BUFF_SIZE]; + + /* check data size */ @@ -534,9 +585,8 @@ index 0000000..bd31aaa + + amlogic_cec_set_tx_state(STATE_TX); + -+ // just for the case that the first write starts -+ // before the end of amlogic_cec_delayed_init() -+ if (wait_event_interruptible(cec_tx_struct.waitq, hdmitx_device->cec_init_ready == 1)) ++ // don't write if cec_node_init() is in progress ++ if (down_interruptible(&init_mutex)) + { + amlogic_cec_log_dbg("error during wait on state change\n"); + printk(KERN_ERR "[amlogic] ##### cec write error! #####\n"); @@ -552,22 +602,27 @@ index 0000000..bd31aaa + printk(KERN_ERR "[amlogic] ##### cec write error! #####\n"); + amlogic_cec_write_reg(CEC_TX_MSG_CMD, TX_ABORT); // stop cec tx for hw retry. + amlogic_cec_write_reg(CEC_TX_MSG_CMD, TX_NO_OP); -+ return -ERESTARTSYS; ++ retval = -ERESTARTSYS; ++ goto error_exit; + } + + if (atomic_read(&cec_tx_struct.state) != STATE_DONE) + { + printk(KERN_ERR "[amlogic] ##### cec write error! #####\n"); -+ return -1; ++ retval = -1; + } + -+ return count; ++error_exit: ++ up(&init_mutex); ++ ++ return retval; +} + +static long amlogic_cec_ioctl(struct file *file, unsigned int cmd, + unsigned long arg) +{ + unsigned char logical_addr; ++ unsigned int reg; + + switch(cmd) { + case CEC_IOC_SETLADDR: @@ -578,12 +633,21 @@ index 0000000..bd31aaa + } + + amlogic_cec_write_reg(CEC_LOGICAL_ADDR0, (0x1 << 4) | logical_addr); ++ cec_global_info.my_node_index = logical_addr; ++ /* ++ * use DEBUG_REG1 bit 16 ~ 31 to save logic address. ++ * So uboot can use this logic address directly ++ */ ++ reg = (aml_read_reg32(P_AO_DEBUG_REG1) & 0xffff); ++ reg |= ((unsigned int)logical_addr) << 16; ++ aml_write_reg32(P_AO_DEBUG_REG1, reg); ++ + amlogic_cec_log_dbg("amlogic_cec_ioctl: Set logical address: %d\n", logical_addr); + return 0; + + case CEC_IOC_GETPADDR: -+ amlogic_cec_log_dbg("amlogic_cec_ioctl: return physical address 0x%x\n", aml_read_reg32(P_AO_DEBUG_REG1)); -+ return aml_read_reg32(P_AO_DEBUG_REG1); ++ amlogic_cec_log_dbg("amlogic_cec_ioctl: return physical address 0x%x\n", aml_read_reg32(P_AO_DEBUG_REG1) & 0xffff); ++ return aml_read_reg32(P_AO_DEBUG_REG1) & 0xffff; + } + + return -EINVAL; @@ -591,7 +655,11 @@ index 0000000..bd31aaa + +static u32 amlogic_cec_poll(struct file *file, poll_table *wait) +{ -+ poll_wait(file, &cec_rx_struct.waitq, wait); ++ ++ if (atomic_read(&cec_rx_struct.state) != STATE_DONE) ++ { ++ poll_wait(file, &cec_rx_struct.waitq, wait); ++ } + + if (atomic_read(&cec_rx_struct.state) == STATE_DONE) + { @@ -618,13 +686,23 @@ index 0000000..bd31aaa + +static int amlogic_cec_init(void) +{ ++ int retval = 0; + extern hdmitx_dev_t * get_hdmitx_device(void); ++ ++ if (down_interruptible(&init_mutex)) ++ { ++ return -ERESTARTSYS; ++ } ++ + INIT_LIST_HEAD(&cec_rx_struct.list); + + printk("%s, Version: %s\n", banner, VERSION); + + hdmitx_device = get_hdmitx_device(); + amlogic_cec_log_dbg("CEC init\n"); ++ ++ amlogic_cec_write_reg(CEC_LOGICAL_ADDR0, (0x1 << 4) | 0xf); ++ +#if MESON_CPU_TYPE == MESON_CPU_TYPE_MESON6 + hdmi_wr_reg(CEC0_BASE_ADDR+CEC_CLOCK_DIV_H, 0x00 ); + hdmi_wr_reg(CEC0_BASE_ADDR+CEC_CLOCK_DIV_L, 0xf0 ); @@ -641,10 +719,15 @@ index 0000000..bd31aaa + if (misc_register(&cec_misc_device)) + { + printk(KERN_WARNING " Couldn't register device 10, %d.\n", CEC_MINOR); -+ return -EBUSY; ++ retval = -EBUSY; + } + -+ return 0; ++ // release initial lock on init_mutex ++ up(&init_mutex); ++ ++ amlogic_cec_log_dbg("CEC init finished: %d\n", retval); ++ ++ return retval; +} + +static void amlogic_cec_exit(void) diff --git a/projects/WeTek_Play/initramfs/platform_init b/projects/WeTek_Play/initramfs/platform_init index 5e32a6847f1..f1adf38fe3b 100755 --- a/projects/WeTek_Play/initramfs/platform_init +++ b/projects/WeTek_Play/initramfs/platform_init @@ -46,6 +46,9 @@ echo 0 > /sys/class/graphics/fb0/blank # Disable framebuffer scaling echo 0 > /sys/class/graphics/fb0/free_scale +# set initial video state +echo 1 > /sys/class/video/disable_video + # Set framebuffer geometry to match the resolution case "$hdmimode" in 720*) diff --git a/projects/WeTek_Play/install/updater-script b/projects/WeTek_Play/install/updater-script index 97e9e9166f0..cda32c019b5 100644 --- a/projects/WeTek_Play/install/updater-script +++ b/projects/WeTek_Play/install/updater-script @@ -1,9 +1,6 @@ show_progress(0.500000, 3); set_bootloader_env("upgrade_step", "3"); -ui_print("Wiping Userdata"); -format("ext4", "EMMC", "/dev/block/data", "0", "/data"); - show_progress(0.020000, 0); ui_print("Wiping System"); @@ -29,4 +26,4 @@ write_raw_image(package_extract_file("logo.img"), "logo"); set_bootloader_env("upgrade_step", "1"); show_progress(0.100000, 0); -ui_print("OpenELEC Installed Successfully"); +ui_print("LibreELEC Installed Successfully"); diff --git a/projects/WeTek_Play/kodi/advancedsettings.xml b/projects/WeTek_Play/kodi/advancedsettings.xml index 6c59e0b8a7b..ecb3edfae50 100644 --- a/projects/WeTek_Play/kodi/advancedsettings.xml +++ b/projects/WeTek_Play/kodi/advancedsettings.xml @@ -6,10 +6,6 @@ <clienttimeout>30</clienttimeout> </samba> - <network> - <readbufferfactor>4.0</readbufferfactor> - </network> - <pvr> <minvideocachelevel>5</minvideocachelevel> <minaudiocachelevel>20</minaudiocachelevel> diff --git a/projects/WeTek_Play/options b/projects/WeTek_Play/options index 81d2c104330..c315bc131ce 100644 --- a/projects/WeTek_Play/options +++ b/projects/WeTek_Play/options @@ -90,8 +90,11 @@ # OpenGL(X) implementation to use (no / mesa) OPENGL="no" - # OpenGL-ES implementation to use (no / bcm2835-driver / gpu-viv-bin-mx6q / opengl-meson6) - OPENGLES="opengl-meson6" + # OpenGL-ES implementation to use (no / bcm2835-driver / gpu-viv-bin-mx6q / opengl-meson) + OPENGLES="opengl-meson" + + # Amlogic Meson SOC family (8 / 6 / gxbb) + MESON_FAMILY="6" # include uvesafb support (yes / no) UVESAFB_SUPPORT="no" diff --git a/projects/WeTek_Play/patches/kodi/0001-Fix-ALSA-sound-output-for-Amlogic-based-devices.patch b/projects/WeTek_Play/patches/kodi/0001-Fix-ALSA-sound-output-for-Amlogic-based-devices.patch index b15591d6b2b..72c97da58d3 100644 --- a/projects/WeTek_Play/patches/kodi/0001-Fix-ALSA-sound-output-for-Amlogic-based-devices.patch +++ b/projects/WeTek_Play/patches/kodi/0001-Fix-ALSA-sound-output-for-Amlogic-based-devices.patch @@ -1,17 +1,17 @@ -From 5e5453322e71c16b8b96b471a9e5c32b96d6b1af Mon Sep 17 00:00:00 2001 +From fde3d3d609e570aa3a8691a4e66e07dce1c80b25 Mon Sep 17 00:00:00 2001 From: Alex Deryskyba <alex@codesnake.com> Date: Wed, 16 Apr 2014 22:02:01 +0300 -Subject: [PATCH 01/17] Fix ALSA sound output for Amlogic-based devices. +Subject: [PATCH] [aml] Fix ALSA sound output for Amlogic-based devices. --- - xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp | 19 +++++++++++++++++++ + xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp b/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp -index df50940..9f80c06 100644 +index fbccce0..6bf2c53 100644 --- a/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp +++ b/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp -@@ -83,6 +83,17 @@ static unsigned int ALSASampleRateList[] = +@@ -84,6 +84,17 @@ static unsigned int ALSASampleRateList[] = 0 }; @@ -29,7 +29,7 @@ index df50940..9f80c06 100644 CAESinkALSA::CAESinkALSA() : m_bufferSize(0), m_formatSampleRateMul(0.0), -@@ -741,12 +752,20 @@ bool CAESinkALSA::InitializeHW(const ALSAConfig &inconfig, ALSAConfig &outconfig +@@ -748,12 +759,20 @@ bool CAESinkALSA::InitializeHW(const ALSAConfig &inconfig, ALSAConfig &outconfig */ periodSize = std::min(periodSize, (snd_pcm_uframes_t) sampleRate / 20); bufferSize = std::min(bufferSize, (snd_pcm_uframes_t) sampleRate / 5); @@ -50,6 +50,3 @@ index df50940..9f80c06 100644 CLog::Log(LOGDEBUG, "CAESinkALSA::InitializeHW - Request: periodSize %lu, bufferSize %lu", periodSize, bufferSize); --- -1.7.10.4 - diff --git a/projects/WeTek_Play/patches/kodi/0008-Reorder-libraries-in-configure-script-to-prevent-lin.patch b/projects/WeTek_Play/patches/kodi/0008-Reorder-libraries-in-configure-script-to-prevent-lin.patch index 99d12214ae6..098407d0137 100644 --- a/projects/WeTek_Play/patches/kodi/0008-Reorder-libraries-in-configure-script-to-prevent-lin.patch +++ b/projects/WeTek_Play/patches/kodi/0008-Reorder-libraries-in-configure-script-to-prevent-lin.patch @@ -1,7 +1,7 @@ -From d81c2be6e702206b7c00e25be4ee0c0750f1b84d Mon Sep 17 00:00:00 2001 +From 0367076d263846832cff68052f3de362f27e5bc6 Mon Sep 17 00:00:00 2001 From: Alex Deryskyba <alex@codesnake.com> Date: Mon, 8 Sep 2014 23:29:40 +0300 -Subject: [PATCH 08/17] Reorder libraries in configure script to prevent +Subject: [PATCH] [wetek] Reorder libraries in configure script to prevent linker errors when linking with libsmbclient Place libsmbclient before all other libraries to prevent linker errors when linking @@ -9,14 +9,14 @@ with libsmbclient if the libc that is currently used doesn't contain some functi such as dn_expand (which are often included in libc), but are actually included in libresolv. --- - configure.ac | 2 +- + configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac -index ff4022f..079fa27 100644 +index fbe2766..c668729 100644 --- a/configure.ac +++ b/configure.ac -@@ -1475,7 +1475,7 @@ fi +@@ -1425,7 +1425,7 @@ fi # samba if test "x$use_samba" != "xno"; then PKG_CHECK_MODULES([SAMBA], [smbclient], @@ -25,6 +25,3 @@ index ff4022f..079fa27 100644 [AC_CHECK_LIB([smbclient], [main],, use_samba=no;AC_MSG_ERROR($missing_library)) USE_LIBSMBCLIENT=0 --- -1.7.10.4 - diff --git a/projects/WeTek_Play/patches/kodi/0009-aml-Change-the-sample-rates-that-are-supported-by-AL.patch b/projects/WeTek_Play/patches/kodi/0009-aml-Change-the-sample-rates-that-are-supported-by-AL.patch index 278fdbdaeb0..f24d6c80e14 100644 --- a/projects/WeTek_Play/patches/kodi/0009-aml-Change-the-sample-rates-that-are-supported-by-AL.patch +++ b/projects/WeTek_Play/patches/kodi/0009-aml-Change-the-sample-rates-that-are-supported-by-AL.patch @@ -1,22 +1,18 @@ -From a98954cef067010982c83568dfba45da0d43fe4d Mon Sep 17 00:00:00 2001 +From 813e6f31c8006190615cbf8ab031db2362bcf553 Mon Sep 17 00:00:00 2001 From: Alex Deryskyba <alex@codesnake.com> Date: Fri, 19 Sep 2014 01:55:12 +0300 -Subject: [PATCH 09/17] [aml] Change the sample rates that are supported by - ALSA but unsupported by HDMI to the closest supported - value +Subject: [PATCH] [aml] Change the sample rates that are supported by ALSA but + unsupported by HDMI to the closest supported value -Conflicts: - - xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp --- - xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp | 20 ++++++++++++++++++++ + xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp b/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp -index 9f80c06..18303f8 100644 +index 6bf2c53..32ab888 100644 --- a/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp +++ b/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp -@@ -666,6 +666,26 @@ bool CAESinkALSA::InitializeHW(const ALSAConfig &inconfig, ALSAConfig &outconfig +@@ -673,6 +673,26 @@ bool CAESinkALSA::InitializeHW(const ALSAConfig &inconfig, ALSAConfig &outconfig snd_pcm_hw_params_set_access(m_pcm, hw_params, SND_PCM_ACCESS_RW_INTERLEAVED); unsigned int sampleRate = inconfig.sampleRate; @@ -43,6 +39,3 @@ index 9f80c06..18303f8 100644 snd_pcm_hw_params_set_rate_near (m_pcm, hw_params, &sampleRate, NULL); unsigned int channelCount = inconfig.channels; --- -1.7.10.4 - diff --git a/projects/WeTek_Play/patches/kodi/0010-aml-Fill-audio-packets-completely-when-resampling-to.patch b/projects/WeTek_Play/patches/kodi/0010-aml-Fill-audio-packets-completely-when-resampling-to.patch index 706e10d117d..634c68112ed 100644 --- a/projects/WeTek_Play/patches/kodi/0010-aml-Fill-audio-packets-completely-when-resampling-to.patch +++ b/projects/WeTek_Play/patches/kodi/0010-aml-Fill-audio-packets-completely-when-resampling-to.patch @@ -1,20 +1,20 @@ -From 554f4a769d67155cbdf6f45ba256b5700baa65c1 Mon Sep 17 00:00:00 2001 +From b97f9b069a98984109829badcdf8ead92a29ee38 Mon Sep 17 00:00:00 2001 From: Alex Deryskyba <alex@codesnake.com> Date: Sat, 20 Sep 2014 04:43:52 +0300 -Subject: [PATCH 10/17] [aml] Fill audio packets completely when resampling to +Subject: [PATCH] [aml] Fill audio packets completely when resampling to prevent 'audio data unaligned' kernel warnings --- - xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.cpp | 4 ++++ + xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.cpp -index 3b0a015..ef431a4 100644 +index dffded7..2f9dc47 100644 --- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.cpp +++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.cpp -@@ -143,7 +143,11 @@ CActiveAEBufferPoolResample::CActiveAEBufferPoolResample(AEAudioFormat inputForm - if (AE_IS_RAW(m_inputFormat.m_dataFormat)) - m_inputFormat.m_dataFormat = AE_FMT_S16NE; +@@ -157,7 +157,11 @@ CActiveAEBufferPoolResample::CActiveAEBufferPoolResample(AEAudioFormat inputForm + m_inputFormat.m_channelLayout += AE_CH_FC; + } m_resampler = NULL; +#ifdef HAS_LIBAMCODEC + m_fillPackets = true; @@ -24,6 +24,3 @@ index 3b0a015..ef431a4 100644 m_drain = false; m_empty = true; m_procSample = NULL; --- -1.7.10.4 - diff --git a/projects/WeTek_Play/patches/kodi/0011-aml-Use-fpsrate-and-fpsscale-instead-of-rfpsrate-and.patch b/projects/WeTek_Play/patches/kodi/0011-aml-Use-fpsrate-and-fpsscale-instead-of-rfpsrate-and.patch deleted file mode 100644 index fd4bf3281c6..00000000000 --- a/projects/WeTek_Play/patches/kodi/0011-aml-Use-fpsrate-and-fpsscale-instead-of-rfpsrate-and.patch +++ /dev/null @@ -1,120 +0,0 @@ -From e065d31b7bac0a3fffc0f05922613090cc573709 Mon Sep 17 00:00:00 2001 -From: Alex Deryskyba <alex@codesnake.com> -Date: Sun, 21 Sep 2014 17:17:14 +0300 -Subject: [PATCH 11/17] [aml] Use fpsrate and fpsscale instead of rfpsrate and - rfpsscale to detect framerate - ---- - xbmc/cores/dvdplayer/DVDCodecs/Video/AMLCodec.cpp | 12 ++----- - .../DVDCodecs/Video/DVDVideoCodecAmlogic.cpp | 38 +++++++++----------- - 2 files changed, 20 insertions(+), 30 deletions(-) - -diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/AMLCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/AMLCodec.cpp -index 26db4a1..fcdad19 100644 ---- a/xbmc/cores/dvdplayer/DVDCodecs/Video/AMLCodec.cpp -+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/AMLCodec.cpp -@@ -1465,14 +1465,8 @@ bool CAMLCodec::OpenDecoder(CDVDStreamInfo &hints) - am_private->video_ratio64 = ((int64_t)video_ratio.num << 32) | video_ratio.den; - - // handle video rate -- if (hints.rfpsrate > 0 && hints.rfpsscale != 0) -+ if (hints.fpsrate > 0 && hints.fpsscale != 0) - { -- // check ffmpeg r_frame_rate 1st -- am_private->video_rate = 0.5 + (float)UNIT_FREQ * hints.rfpsscale / hints.rfpsrate; -- } -- else if (hints.fpsrate > 0 && hints.fpsscale != 0) -- { -- // then ffmpeg avg_frame_rate next - am_private->video_rate = 0.5 + (float)UNIT_FREQ * hints.fpsscale / hints.fpsrate; - } - -@@ -1545,8 +1539,8 @@ bool CAMLCodec::OpenDecoder(CDVDStreamInfo &hints) - CLog::Log(LOGDEBUG, "CAMLCodec::OpenDecoder " - "hints.width(%d), hints.height(%d), hints.codec(%d), hints.codec_tag(%d), hints.pid(%d)", - hints.width, hints.height, hints.codec, hints.codec_tag, hints.pid); -- CLog::Log(LOGDEBUG, "CAMLCodec::OpenDecoder hints.fpsrate(%d), hints.fpsscale(%d), hints.rfpsrate(%d), hints.rfpsscale(%d), video_rate(%d)", -- hints.fpsrate, hints.fpsscale, hints.rfpsrate, hints.rfpsscale, am_private->video_rate); -+ CLog::Log(LOGDEBUG, "CAMLCodec::OpenDecoder hints.fpsrate(%d), hints.fpsscale(%d), video_rate(%d)", -+ hints.fpsrate, hints.fpsscale, am_private->video_rate); - CLog::Log(LOGDEBUG, "CAMLCodec::OpenDecoder hints.aspect(%f), video_ratio.num(%d), video_ratio.den(%d)", - hints.aspect, video_ratio.num, video_ratio.den); - CLog::Log(LOGDEBUG, "CAMLCodec::OpenDecoder hints.orientation(%d), hints.forced_aspect(%d), hints.extrasize(%d)", -diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecAmlogic.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecAmlogic.cpp -index 24c1ab9..960aae1 100644 ---- a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecAmlogic.cpp -+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecAmlogic.cpp -@@ -74,9 +74,7 @@ bool CDVDVideoCodecAmlogic::Open(CDVDStreamInfo &hints, CDVDCodecOptions &option - m_mpeg2_sequence->width = m_hints.width; - m_mpeg2_sequence->height = m_hints.height; - m_mpeg2_sequence->ratio = m_hints.aspect; -- if (m_hints.rfpsrate > 0 && m_hints.rfpsscale != 0) -- m_mpeg2_sequence->rate = (float)m_hints.rfpsrate / m_hints.rfpsscale; -- else if (m_hints.fpsrate > 0 && m_hints.fpsscale != 0) -+ if (m_hints.fpsrate > 0 && m_hints.fpsscale != 0) - m_mpeg2_sequence->rate = (float)m_hints.fpsrate / m_hints.fpsscale; - else - m_mpeg2_sequence->rate = 1.0; -@@ -374,43 +372,41 @@ void CDVDVideoCodecAmlogic::FrameRateTracking(uint8_t *pData, int iSize, double - { - default: - case 0x01: -- m_hints.rfpsrate = 24000.0; -- m_hints.rfpsscale = 1001.0; -+ m_hints.fpsrate = 24000.0; -+ m_hints.fpsscale = 1001.0; - break; - case 0x02: -- m_hints.rfpsrate = 24000.0; -- m_hints.rfpsscale = 1000.0; -+ m_hints.fpsrate = 24000.0; -+ m_hints.fpsscale = 1000.0; - break; - case 0x03: -- m_hints.rfpsrate = 25000.0; -- m_hints.rfpsscale = 1000.0; -+ m_hints.fpsrate = 25000.0; -+ m_hints.fpsscale = 1000.0; - break; - case 0x04: -- m_hints.rfpsrate = 30000.0; -- m_hints.rfpsscale = 1001.0; -+ m_hints.fpsrate = 30000.0; -+ m_hints.fpsscale = 1001.0; - break; - case 0x05: -- m_hints.rfpsrate = 30000.0; -- m_hints.rfpsscale = 1000.0; -+ m_hints.fpsrate = 30000.0; -+ m_hints.fpsscale = 1000.0; - break; - case 0x06: -- m_hints.rfpsrate = 50000.0; -- m_hints.rfpsscale = 1000.0; -+ m_hints.fpsrate = 50000.0; -+ m_hints.fpsscale = 1000.0; - break; - case 0x07: -- m_hints.rfpsrate = 60000.0; -- m_hints.rfpsscale = 1001.0; -+ m_hints.fpsrate = 60000.0; -+ m_hints.fpsscale = 1001.0; - break; - case 0x08: -- m_hints.rfpsrate = 60000.0; -- m_hints.rfpsscale = 1000.0; -+ m_hints.fpsrate = 60000.0; -+ m_hints.fpsscale = 1000.0; - break; - } - m_hints.width = m_mpeg2_sequence->width; - m_hints.height = m_mpeg2_sequence->height; - m_hints.aspect = m_mpeg2_sequence->ratio; -- m_hints.fpsrate = m_hints.rfpsrate; -- m_hints.fpsscale = m_hints.rfpsscale; - } - return; - } --- -1.7.10.4 - diff --git a/projects/WeTek_Play/patches/kodi/0012-Fix-incorrect-frame-rate-detection-of-some-videos-wi.patch b/projects/WeTek_Play/patches/kodi/0012-Fix-incorrect-frame-rate-detection-of-some-videos-wi.patch deleted file mode 100644 index 9f70d0fa692..00000000000 --- a/projects/WeTek_Play/patches/kodi/0012-Fix-incorrect-frame-rate-detection-of-some-videos-wi.patch +++ /dev/null @@ -1,143 +0,0 @@ -From a9ff99a36f9e6cea70f7274312a127563af15dc5 Mon Sep 17 00:00:00 2001 -From: Alex Deryskyba <alex@codesnake.com> -Date: Sun, 21 Sep 2014 17:20:25 +0300 -Subject: [PATCH 12/17] Fix incorrect frame rate detection of some videos with - variable frame rate. - -Use FFMPEG's r_frame_rate, if it as valid, as a video stream frame rate, otherwise use avg_frame_rate. -Also remove CDVDStreamInfo.rfpsscale, CDVDStreamInfo.rfpsrate, CDemuxStreamVideo.irFpsScale and CDemuxStreamVideo.irFpsRate, -they are not needed anymore. ---- - xbmc/cores/dvdplayer/DVDDemuxers/DVDDemux.h | 4 --- - .../cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp | 29 ++++++++-------------- - xbmc/cores/dvdplayer/DVDStreamInfo.cpp | 8 ------ - xbmc/cores/dvdplayer/DVDStreamInfo.h | 2 -- - 4 files changed, 10 insertions(+), 33 deletions(-) - -diff --git a/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemux.h b/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemux.h -index d69991e..faf3c9b 100644 ---- a/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemux.h -+++ b/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemux.h -@@ -151,8 +151,6 @@ public: - { - iFpsScale = 0; - iFpsRate = 0; -- irFpsScale = 0; -- irFpsRate = 0; - iHeight = 0; - iWidth = 0; - fAspect = 0.0; -@@ -167,8 +165,6 @@ public: - virtual ~CDemuxStreamVideo() {} - int iFpsScale; // scale of 1000 and a rate of 29970 will result in 29.97 fps - int iFpsRate; -- int irFpsScale; -- int irFpsRate; - int iHeight; // height of the stream reported by the demuxer - int iWidth; // width of the stream reported by the demuxer - float fAspect; // display aspect of stream -diff --git a/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp b/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp -index 1315117..5367b28 100644 ---- a/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp -+++ b/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp -@@ -1125,34 +1125,25 @@ CDemuxStream* CDVDDemuxFFmpeg::AddStream(int iId) - #else - AVRational r_frame_rate = pStream->r_frame_rate; - #endif -+ int rFrameRate = 0; -+ if (r_frame_rate.den && r_frame_rate.num) -+ rFrameRate = r_frame_rate.num / r_frame_rate.den; -+ bool rFrameRateValid = rFrameRate >= 5 && rFrameRate <= 100; - -- //average fps is more accurate for mkv files -- if (m_bMatroska && pStream->avg_frame_rate.den && pStream->avg_frame_rate.num) -- { -- st->iFpsRate = pStream->avg_frame_rate.num; -- st->iFpsScale = pStream->avg_frame_rate.den; -- } -- else if(r_frame_rate.den && r_frame_rate.num) -+ if (rFrameRateValid) - { - st->iFpsRate = r_frame_rate.num; - st->iFpsScale = r_frame_rate.den; - } -- else -- { -- st->iFpsRate = 0; -- st->iFpsScale = 0; -- } -- -- // added for aml hw decoder, mkv frame-rate can be wrong. -- if (r_frame_rate.den && r_frame_rate.num) -+ else if(pStream->avg_frame_rate.den && pStream->avg_frame_rate.num) - { -- st->irFpsRate = r_frame_rate.num; -- st->irFpsScale = r_frame_rate.den; -+ st->iFpsRate = pStream->avg_frame_rate.num; -+ st->iFpsScale = pStream->avg_frame_rate.den; - } - else - { -- st->irFpsRate = 0; -- st->irFpsScale = 0; -+ st->iFpsRate = 0; -+ st->iFpsScale = 0; - } - - if (pStream->codec_info_nb_frames > 0 -diff --git a/xbmc/cores/dvdplayer/DVDStreamInfo.cpp b/xbmc/cores/dvdplayer/DVDStreamInfo.cpp -index c1dbd85..03facbe 100644 ---- a/xbmc/cores/dvdplayer/DVDStreamInfo.cpp -+++ b/xbmc/cores/dvdplayer/DVDStreamInfo.cpp -@@ -52,8 +52,6 @@ void CDVDStreamInfo::Clear() - - fpsscale = 0; - fpsrate = 0; -- rfpsscale= 0; -- rfpsrate = 0; - height = 0; - width = 0; - aspect = 0.0; -@@ -97,8 +95,6 @@ bool CDVDStreamInfo::Equal(const CDVDStreamInfo& right, bool withextradata) - // VIDEO - if( fpsscale != right.fpsscale - || fpsrate != right.fpsrate -- || rfpsscale!= right.rfpsscale -- || rfpsrate != right.rfpsrate - || height != right.height - || width != right.width - || stills != right.stills -@@ -159,8 +155,6 @@ void CDVDStreamInfo::Assign(const CDVDStreamInfo& right, bool withextradata) - // VIDEO - fpsscale = right.fpsscale; - fpsrate = right.fpsrate; -- rfpsscale= right.rfpsscale; -- rfpsrate = right.rfpsrate; - height = right.height; - width = right.width; - aspect = right.aspect; -@@ -220,8 +214,6 @@ void CDVDStreamInfo::Assign(const CDemuxStream& right, bool withextradata) - const CDemuxStreamVideo *stream = static_cast<const CDemuxStreamVideo*>(&right); - fpsscale = stream->iFpsScale; - fpsrate = stream->iFpsRate; -- rfpsscale = stream->irFpsScale; -- rfpsrate = stream->irFpsRate; - height = stream->iHeight; - width = stream->iWidth; - aspect = stream->fAspect; -diff --git a/xbmc/cores/dvdplayer/DVDStreamInfo.h b/xbmc/cores/dvdplayer/DVDStreamInfo.h -index c0e22a2..8953ff3 100644 ---- a/xbmc/cores/dvdplayer/DVDStreamInfo.h -+++ b/xbmc/cores/dvdplayer/DVDStreamInfo.h -@@ -58,8 +58,6 @@ public: - // VIDEO - int fpsscale; // scale of 1001 and a rate of 60000 will result in 59.94 fps - int fpsrate; -- int rfpsscale; -- int rfpsrate; - int height; // height of the stream reported by the demuxer - int width; // width of the stream reported by the demuxer - float aspect; // display aspect as reported by demuxer --- -2.1.4 - diff --git a/projects/WeTek_Play/patches/kodi/0016-aml-Disable-deinterlacing-for-HD-content-while-video.patch b/projects/WeTek_Play/patches/kodi/0016-aml-Disable-deinterlacing-for-HD-content-while-video.patch index ac06dd2ec9a..0bc4a80f05c 100644 --- a/projects/WeTek_Play/patches/kodi/0016-aml-Disable-deinterlacing-for-HD-content-while-video.patch +++ b/projects/WeTek_Play/patches/kodi/0016-aml-Disable-deinterlacing-for-HD-content-while-video.patch @@ -1,19 +1,19 @@ -From 6aa16d7fe7e6dbe95bdca8069a16d2aa415adf37 Mon Sep 17 00:00:00 2001 +From a2adae2d6a5036b2af02448e6803175a02f368d1 Mon Sep 17 00:00:00 2001 From: Alex Deryskyba <alex@codesnake.com> Date: Tue, 3 Feb 2015 17:58:19 +0100 -Subject: [PATCH 16/17] Disable deinterlacing for HD content while video is - being played in a window to prevent screen blinking in 1080p50/60hz display - modes +Subject: [PATCH] [aml] Disable deinterlacing for HD content while video is + being played in a window +... to prevent screen blinking in 1080p50/60hz display modes --- - xbmc/cores/dvdplayer/DVDCodecs/Video/AMLCodec.cpp | 5 +++++ + xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp | 5 +++++ 1 file changed, 5 insertions(+) -diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/AMLCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/AMLCodec.cpp -index 2fad224..74804de 100644 ---- a/xbmc/cores/dvdplayer/DVDCodecs/Video/AMLCodec.cpp -+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/AMLCodec.cpp -@@ -2261,6 +2261,11 @@ void CAMLCodec::SetVideoRect(const CRect &SrcRect, const CRect &DestRect) +diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp +index 5dc6592..2103042 100644 +--- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp ++++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp +@@ -2259,6 +2259,11 @@ void CAMLCodec::SetVideoRect(const CRect &SrcRect, const CRect &DestRect) CLog::Log(LOGDEBUG, "CAMLCodec::SetVideoRect:m_stereo_view(%d)", m_stereo_view); #endif @@ -25,6 +25,3 @@ index 2fad224..74804de 100644 // goofy 0/1 based difference in aml axis coordinates. // fix them. dst_rect.x2--; --- -2.1.4 - diff --git a/projects/WeTek_Play/patches/kodi/0018-aml-Fix-stuttering-during-a-playback-of-a-video-with.patch b/projects/WeTek_Play/patches/kodi/0018-aml-Fix-stuttering-during-a-playback-of-a-video-with.patch deleted file mode 100644 index 21415b4eadb..00000000000 --- a/projects/WeTek_Play/patches/kodi/0018-aml-Fix-stuttering-during-a-playback-of-a-video-with.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 7b1c6ca4cb5bf3310cbfe3b007063439be301b6b Mon Sep 17 00:00:00 2001 -From: Alex Deryskyba <alex@codesnake.com> -Date: Mon, 2 Mar 2015 09:48:14 +0100 -Subject: [PATCH 18/26] [aml] Fix stuttering during a playback of a video with - 23.976 FPS - ---- - xbmc/cores/dvdplayer/DVDCodecs/Video/AMLCodec.cpp | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/AMLCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/AMLCodec.cpp -index bf4c958..8d49de8 100644 ---- a/xbmc/cores/dvdplayer/DVDCodecs/Video/AMLCodec.cpp -+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/AMLCodec.cpp -@@ -1932,7 +1932,7 @@ void CAMLCodec::Process() - - double error = app_pts - (double)pts_video/PTS_FREQ; - double abs_error = fabs(error); -- if (abs_error > 0.125) -+ if (abs_error > 0) - { - //CLog::Log(LOGDEBUG, "CAMLCodec::Process pts diff = %f", error); - if (abs_error > 0.150) --- -1.7.10.4 - diff --git a/projects/WeTek_Play/patches/kodi/0019-aml-Ugly-workaround-to-show-DTS-AC3-caps.patch b/projects/WeTek_Play/patches/kodi/0019-aml-Ugly-workaround-to-show-DTS-AC3-caps.patch new file mode 100644 index 00000000000..6d8d4a23b5f --- /dev/null +++ b/projects/WeTek_Play/patches/kodi/0019-aml-Ugly-workaround-to-show-DTS-AC3-caps.patch @@ -0,0 +1,27 @@ +From 11435d47a5351c55ef12661baf1adb167da513ef Mon Sep 17 00:00:00 2001 +From: Alex Deryskyba <alex@codesnake.com> +Date: Tue, 30 Jun 2015 11:19:57 +0200 +Subject: [PATCH] [aml] Ugly workaround to show DTS/AC3 caps + +... but don't run into multi channel issues as we can only open 2 pcm channels +--- + xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp b/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp +index 32ab888..d4eb0be 100644 +--- a/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp ++++ b/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp +@@ -1336,6 +1336,12 @@ void CAESinkALSA::EnumerateDevicesEx(AEDeviceInfoList &list, bool force) + + AEDeviceType CAESinkALSA::AEDeviceTypeFromName(const std::string &name) + { ++#ifdef HAS_LIBAMCODEC ++ // ugly workaround to show DTS / AC3 caps ++ // but don't run into multi channel issues ++ // as we can only open 2 pcm channels ++ return AE_DEVTYPE_IEC958; ++#endif + if (name.substr(0, 4) == "hdmi") + return AE_DEVTYPE_HDMI; + else if (name.substr(0, 6) == "iec958" || name.substr(0, 5) == "spdif") diff --git a/projects/WeTek_Play/patches/kodi/0103-fix_compiler_badness_when_compiling_with_amcodec.patch b/projects/WeTek_Play/patches/kodi/0103-fix_compiler_badness_when_compiling_with_amcodec.patch deleted file mode 100644 index cb2351b790f..00000000000 --- a/projects/WeTek_Play/patches/kodi/0103-fix_compiler_badness_when_compiling_with_amcodec.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/Makefile.in b/xbmc/cores/dvdplayer/DVDCodecs/Video/Makefile.in -index 8a97889..78506b1 100644 ---- a/xbmc/cores/dvdplayer/DVDCodecs/Video/Makefile.in -+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/Makefile.in -@@ -27,8 +27,6 @@ endif - ifeq (@USE_LIBAMCODEC@,1) - SRCS += AMLCodec.cpp - SRCS += DVDVideoCodecAmlogic.cpp --INCLUDES += -I$(prefix)/include/amcodec --INCLUDES += -I$(prefix)/include/amplayer - endif - - ifeq (@USE_ANDROID@,1) diff --git a/projects/WeTek_Play/patches/kodi/0105-perform_suspend_instead_of_powerdown.patch b/projects/WeTek_Play/patches/kodi/0105-perform_suspend_instead_of_powerdown.patch index 07a504fe3dc..d66d9f07a06 100644 --- a/projects/WeTek_Play/patches/kodi/0105-perform_suspend_instead_of_powerdown.patch +++ b/projects/WeTek_Play/patches/kodi/0105-perform_suspend_instead_of_powerdown.patch @@ -1,8 +1,18 @@ +From 55b3da7e97f6dc1e99724782253c35fe4c8b7c5a Mon Sep 17 00:00:00 2001 +From: Stefan Saraev <stefan@saraev.ca> +Date: Sat, 7 Nov 2015 16:25:44 +0200 +Subject: [PATCH] [wetek] perform suspend instead of powerdown + +--- + system/keymaps/keyboard.xml | 2 +- + xbmc/powermanagement/linux/LogindUPowerSyscall.cpp | 4 ++-- + 2 files changed, 3 insertions(+), 3 deletions(-) + diff --git a/system/keymaps/keyboard.xml b/system/keymaps/keyboard.xml -index 45682a2..b8ce91b 100644 +index 9833cff..0ce105e 100644 --- a/system/keymaps/keyboard.xml +++ b/system/keymaps/keyboard.xml -@@ -96,7 +96,7 @@ +@@ -91,7 +91,7 @@ <backslash>ToggleFullScreen</backslash> <home>FirstPage</home> <end>LastPage</end> @@ -10,12 +20,12 @@ index 45682a2..b8ce91b 100644 + <power>XBMC.Powerdown()</power> <sleep>ActivateWindow(shutdownmenu)</sleep> <!-- PVR windows --> - <e>XBMC.ActivateWindowAndFocus(MyPVR, 31,0, 10,0)</e> + <e>ActivateWindow(TVGuide)</e> diff --git a/xbmc/powermanagement/linux/LogindUPowerSyscall.cpp b/xbmc/powermanagement/linux/LogindUPowerSyscall.cpp -index 5a97fe6..369e790 100644 +index 4e5bcc6..ad5847d 100644 --- a/xbmc/powermanagement/linux/LogindUPowerSyscall.cpp +++ b/xbmc/powermanagement/linux/LogindUPowerSyscall.cpp -@@ -52,7 +52,7 @@ CLogindUPowerSyscall::CLogindUPowerSyscall() +@@ -53,7 +53,7 @@ CLogindUPowerSyscall::CLogindUPowerSyscall() m_canPowerdown = LogindCheckCapability("CanPowerOff"); m_canReboot = LogindCheckCapability("CanReboot"); m_canHibernate = LogindCheckCapability("CanHibernate"); @@ -24,7 +34,7 @@ index 5a97fe6..369e790 100644 InhibitDelayLock(); -@@ -97,7 +97,7 @@ CLogindUPowerSyscall::~CLogindUPowerSyscall() +@@ -98,7 +98,7 @@ CLogindUPowerSyscall::~CLogindUPowerSyscall() bool CLogindUPowerSyscall::Powerdown() { diff --git a/projects/WeTek_Play/patches/kodi/1012-hide-meaningless-skips-from-users.patch b/projects/WeTek_Play/patches/kodi/1012-hide-meaningless-skips-from-users.patch index cb240a4801e..6a82519bec0 100644 --- a/projects/WeTek_Play/patches/kodi/1012-hide-meaningless-skips-from-users.patch +++ b/projects/WeTek_Play/patches/kodi/1012-hide-meaningless-skips-from-users.patch @@ -1,22 +1,22 @@ -From a19578679f63520b0d8e9f589b82699076aff6ed Mon Sep 17 00:00:00 2001 -From: "Chris \"Koying\" Browet" <cbro@semperpax.com> +From 0cdf5c043e783e8d956c5d59be8a9ec13a53fee3 Mon Sep 17 00:00:00 2001 +From: "Chris \\\"Koying\\\" Browet" <cbro@semperpax.com> Date: Fri, 19 Dec 2014 12:30:04 +0100 -Subject: [PATCH] FIX: [renderer] hide meaningless skips from users +Subject: [PATCH] [aml] FIX: [renderer] hide meaningless skips from users --- - xbmc/cores/VideoRenderers/RenderManager.cpp | 3 ++- + xbmc/cores/VideoPlayer/VideoRenderers/RenderManager.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -diff --git a/xbmc/cores/VideoRenderers/RenderManager.cpp b/xbmc/cores/VideoRenderers/RenderManager.cpp -index 7f43949..01327f5 100644 ---- a/xbmc/cores/VideoRenderers/RenderManager.cpp -+++ b/xbmc/cores/VideoRenderers/RenderManager.cpp -@@ -1198,7 +1198,8 @@ void CXBMCRenderManager::PrepareNextRender() +diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/RenderManager.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/RenderManager.cpp +index 70741be..15a484a 100644 +--- a/xbmc/cores/VideoPlayer/VideoRenderers/RenderManager.cpp ++++ b/xbmc/cores/VideoPlayer/VideoRenderers/RenderManager.cpp +@@ -1421,7 +1421,8 @@ void CRenderManager::PrepareNextRender() while(m_queued.front() != idx) { requeue(m_discard, m_queued); - m_QueueSkip++; -+ if (m_format != RENDER_FMT_BYPASS) // skips scares users ;) ++ if (m_format != RENDER_FMT_AML) // skips scares users ;) + m_QueueSkip++; } diff --git a/projects/WeTek_Play/patches/libcec/libcec-00-amlogic-support.patch b/projects/WeTek_Play/patches/libcec/libcec-00-amlogic-support.patch new file mode 100644 index 00000000000..02bedc7b9a5 --- /dev/null +++ b/projects/WeTek_Play/patches/libcec/libcec-00-amlogic-support.patch @@ -0,0 +1,751 @@ +diff --git a/README.md b/README.md +index dfaf4d6..0dffdcf 100644 +--- a/README.md ++++ b/README.md +@@ -93,6 +93,12 @@ To compile in support for Exynos devices, you have to pass the argument -DHAVE_E + cmake -DHAVE_EXYNOS_API=1 .. + ``` + ++### Amlogic ++To compile in support for Amlogic devices, you have to pass the argument -DHAVE_AMLOGIC_API=1 to cmake: ++``` ++cmake -DHAVE_AMLOGIC_API=1 .. ++``` ++ + ### TDA995x + To compile in support for TDA995x devices, you have to pass the argument -DHAVE_TDA995X_API=1 to cmake: + ``` +diff --git a/include/cectypes.h b/include/cectypes.h +index 0fdd48e..b7e1932 100644 +--- a/include/cectypes.h ++++ b/include/cectypes.h +@@ -309,6 +309,16 @@ namespace CEC { + #define CEC_EXYNOS_VIRTUAL_COM "Exynos" + + /*! ++ * the path to use for the Amlogic HDMI CEC device ++ */ ++#define CEC_AMLOGIC_PATH "/dev/AmlogicCEC" ++ ++/*! ++ * the name of the virtual COM port to use for the AMLOGIC' CEC wire ++ */ ++#define CEC_AMLOGIC_VIRTUAL_COM "Amlogic" ++ ++/*! + * Mimimum client version + */ + #define CEC_MIN_LIB_VERSION 3 +@@ -877,7 +887,8 @@ typedef enum cec_adapter_type + ADAPTERTYPE_P8_DAUGHTERBOARD = 0x2, + ADAPTERTYPE_RPI = 0x100, + ADAPTERTYPE_TDA995x = 0x200, +- ADAPTERTYPE_EXYNOS = 0x300 ++ ADAPTERTYPE_EXYNOS = 0x300, ++ ADAPTERTYPE_AMLOGIC = 0x500 + } cec_adapter_type; + + /** force exporting through swig */ +diff --git a/src/libcec/CMakeLists.txt b/src/libcec/CMakeLists.txt +index a494533..e94b094 100644 +--- a/src/libcec/CMakeLists.txt ++++ b/src/libcec/CMakeLists.txt +@@ -87,6 +87,9 @@ set(CEC_HEADERS devices/CECRecordingDevice.h + adapter/Exynos/ExynosCEC.h + adapter/Exynos/ExynosCECAdapterDetection.h + adapter/Exynos/ExynosCECAdapterCommunication.h ++ adapter/Amlogic/AmlogicCEC.h ++ adapter/Amlogic/AmlogicCECAdapterDetection.h ++ adapter/Amlogic/AmlogicCECAdapterCommunication.h + adapter/Pulse-Eight/USBCECAdapterMessageQueue.h + adapter/Pulse-Eight/USBCECAdapterCommunication.h + adapter/Pulse-Eight/USBCECAdapterCommands.h +diff --git a/src/libcec/adapter/AdapterFactory.cpp b/src/libcec/adapter/AdapterFactory.cpp +index da05725..824c5ff 100644 +--- a/src/libcec/adapter/AdapterFactory.cpp ++++ b/src/libcec/adapter/AdapterFactory.cpp +@@ -58,6 +58,11 @@ + #include "Exynos/ExynosCECAdapterCommunication.h" + #endif + ++#if defined(HAVE_AMLOGIC_API) ++#include "Amlogic/AmlogicCECAdapterDetection.h" ++#include "Amlogic/AmlogicCECAdapterCommunication.h" ++#endif ++ + using namespace CEC; + + int8_t CAdapterFactory::FindAdapters(cec_adapter *deviceList, uint8_t iBufSize, const char *strDevicePath /* = NULL */) +@@ -126,8 +131,20 @@ int8_t CAdapterFactory::DetectAdapters(cec_adapter_descriptor *deviceList, uint8 + } + #endif + ++#if defined(HAVE_AMLOGIC_API) ++ if (iAdaptersFound < iBufSize && CAmlogicCECAdapterDetection::FindAdapter()) ++ { ++ snprintf(deviceList[iAdaptersFound].strComPath, sizeof(deviceList[iAdaptersFound].strComPath), CEC_AMLOGIC_PATH); ++ snprintf(deviceList[iAdaptersFound].strComName, sizeof(deviceList[iAdaptersFound].strComName), CEC_AMLOGIC_VIRTUAL_COM); ++ deviceList[iAdaptersFound].iVendorId = 0; ++ deviceList[iAdaptersFound].iProductId = 0; ++ deviceList[iAdaptersFound].adapterType = ADAPTERTYPE_AMLOGIC; ++ iAdaptersFound++; ++ } ++#endif ++ + +-#if !defined(HAVE_RPI_API) && !defined(HAVE_P8_USB) && !defined(HAVE_TDA995X_API) ++#if !defined(HAVE_RPI_API) && !defined(HAVE_P8_USB) && !defined(HAVE_TDA995X_API) && !defined(HAVE_AMLOGIC_API) + #error "libCEC doesn't have support for any type of adapter. please check your build system or configuration" + #endif + +@@ -146,6 +163,11 @@ IAdapterCommunication *CAdapterFactory::GetInstance(const char *strPort, uint16_ + return new CExynosCECAdapterCommunication(m_lib->m_cec); + #endif + ++#if defined(HAVE_AMLOGIC_API) ++ if (!strcmp(strPort, CEC_AMLOGIC_VIRTUAL_COM)) ++ return new CAmlogicCECAdapterCommunication(m_lib->m_cec); ++#endif ++ + #if defined(HAVE_RPI_API) + if (!strcmp(strPort, CEC_RPI_VIRTUAL_COM)) + return new CRPiCECAdapterCommunication(m_lib->m_cec); +diff --git a/src/libcec/adapter/Amlogic/AmlogicCEC.h b/src/libcec/adapter/Amlogic/AmlogicCEC.h +new file mode 100644 +index 0000000..7b86982 +--- /dev/null ++++ b/src/libcec/adapter/Amlogic/AmlogicCEC.h +@@ -0,0 +1,41 @@ ++#pragma once ++/* ++ * This file is part of the libCEC(R) library. ++ * ++ * libCEC Amlogic Code Copyright (C) 2016 Gerald Dachs ++ * based heavily on: ++ * libCEC Exynos Code Copyright (C) 2014 Valentin Manea ++ * libCEC(R) is Copyright (C) 2011-2015 Pulse-Eight Limited. All rights reserved. ++ * libCEC(R) is an original work, containing original code. ++ * ++ * libCEC(R) is a trademark of Pulse-Eight Limited. ++ * ++ * This program is dual-licensed; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ++ * ++ * ++ * Alternatively, you can license this library under a commercial license, ++ * please contact Pulse-Eight Licensing for more information. ++ * ++ * For more information contact: ++ * Pulse-Eight Licensing <license@pulse-eight.com> ++ * http://www.pulse-eight.com/ ++ * http://www.pulse-eight.net/ ++ */ ++ ++ ++#define CEC_DEFAULT_PADDR 0x1000 ++#define CEC_IOC_SETLADDR _IOW('c', 0, unsigned int) ++#define CEC_IOC_GETPADDR _IO('c', 1) ++#define CEC_MAX_FRAME_SIZE 16 +diff --git a/src/libcec/adapter/Amlogic/AmlogicCECAdapterCommunication.cpp b/src/libcec/adapter/Amlogic/AmlogicCECAdapterCommunication.cpp +new file mode 100644 +index 0000000..5aeddda +--- /dev/null ++++ b/src/libcec/adapter/Amlogic/AmlogicCECAdapterCommunication.cpp +@@ -0,0 +1,305 @@ ++/* ++ * This file is part of the libCEC(R) library. ++ * ++ * libCEC Amlogic Code Copyright (C) 2016 Gerald Dachs ++ * based heavily on: ++ * libCEC Exynos Code Copyright (C) 2014 Valentin Manea ++ * libCEC(R) is Copyright (C) 2011-2015 Pulse-Eight Limited. All rights reserved. ++ * libCEC(R) is an original work, containing original code. ++ * ++ * libCEC(R) is a trademark of Pulse-Eight Limited. ++ * ++ * This program is dual-licensed; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ++ * ++ * ++ * Alternatively, you can license this library under a commercial license, ++ * please contact Pulse-Eight Licensing for more information. ++ * ++ * For more information contact: ++ * Pulse-Eight Licensing <license@pulse-eight.com> ++ * http://www.pulse-eight.com/ ++ * http://www.pulse-eight.net/ ++ */ ++ ++#include "env.h" ++#include <fcntl.h> ++#include <sys/ioctl.h> ++ ++ ++#if defined(HAVE_AMLOGIC_API) ++#include "AmlogicCEC.h" ++#include "AmlogicCECAdapterCommunication.h" ++ ++#include "CECTypeUtils.h" ++#include "LibCEC.h" ++#include <p8-platform/util/buffer.h> ++ ++using namespace CEC; ++using namespace P8PLATFORM; ++ ++#define LIB_CEC m_callback->GetLib() ++ ++ ++CAmlogicCECAdapterCommunication::CAmlogicCECAdapterCommunication(IAdapterCommunicationCallback *callback) : ++ IAdapterCommunication(callback), ++ m_bLogicalAddressChanged(false) ++{ ++ CLockObject lock(m_mutex); ++ ++ m_logicalAddresses.Clear(); ++ m_fd = INVALID_SOCKET_VALUE; ++} ++ ++ ++CAmlogicCECAdapterCommunication::~CAmlogicCECAdapterCommunication(void) ++{ ++ Close(); ++} ++ ++ ++bool CAmlogicCECAdapterCommunication::IsOpen(void) ++{ ++ CLockObject lock(m_mutex); ++ return IsInitialised() && m_fd != INVALID_SOCKET_VALUE; ++} ++ ++ ++bool CAmlogicCECAdapterCommunication::Open(uint32_t UNUSED(iTimeoutMs), bool UNUSED(bSkipChecks), bool bStartListening) ++{ ++ if (IsOpen()) ++ Close(); ++ ++ CLockObject lock(m_mutex); ++ ++ if ((m_fd = open(CEC_AMLOGIC_PATH, O_RDWR)) > 0) ++ { ++ if (!bStartListening || CreateThread()) { ++ return true; ++ } ++ close(m_fd); ++ m_fd = INVALID_SOCKET_VALUE; ++ } ++ return false; ++} ++ ++ ++void CAmlogicCECAdapterCommunication::Close(void) ++{ ++ StopThread(0); ++ ++ CLockObject lock(m_mutex); ++ ++ close(m_fd); ++ m_fd = INVALID_SOCKET_VALUE; ++} ++ ++ ++std::string CAmlogicCECAdapterCommunication::GetError(void) const ++{ ++ std::string strError(m_strError); ++ return strError; ++} ++ ++int CAmlogicCECAdapterCommunication::getFileDescriptor(void) ++{ ++ CLockObject lock(m_mutex); ++ ++ return m_fd; ++} ++ ++ ++ ++cec_adapter_message_state CAmlogicCECAdapterCommunication::Write( ++ const cec_command &data, bool &UNUSED(bRetry), uint8_t UNUSED(iLineTimeout), bool UNUSED(bIsReply)) ++{ ++ uint8_t buffer[CEC_MAX_FRAME_SIZE]; ++ int32_t size = 1; ++ cec_adapter_message_state rc = ADAPTER_MESSAGE_STATE_ERROR; ++ ++ if (!IsOpen()) ++ return rc; ++ ++ CLockObject lock(m_mutex); ++ ++ if ((size_t)data.parameters.size + data.opcode_set > sizeof(buffer)) ++ { ++ LIB_CEC->AddLog(CEC_LOG_ERROR, "%s: data size too large !", __func__); ++ return ADAPTER_MESSAGE_STATE_ERROR; ++ } ++ ++ buffer[0] = (data.initiator << 4) | (data.destination & 0x0f); ++ ++ if (data.opcode_set) ++ { ++ buffer[1] = data.opcode; ++ size++; ++ ++ memcpy(&buffer[size], data.parameters.data, data.parameters.size); ++ size += data.parameters.size; ++ } ++ ++ if (write(m_fd, (void *)buffer, size) == size) ++ { ++ rc = ADAPTER_MESSAGE_STATE_SENT_ACKED; ++ } ++ else ++ { ++ LIB_CEC->AddLog(CEC_LOG_ERROR, "%s: write failed !", __func__); ++ } ++ ++ return rc; ++} ++ ++ ++uint16_t CAmlogicCECAdapterCommunication::GetFirmwareVersion(void) ++{ ++ return 0; ++} ++ ++ ++cec_vendor_id CAmlogicCECAdapterCommunication::GetVendorId(void) ++{ ++ return cec_vendor_id(CEC_VENDOR_UNKNOWN); ++} ++ ++ ++uint16_t CAmlogicCECAdapterCommunication::GetPhysicalAddress(void) ++{ ++ int phys_addr = CEC_DEFAULT_PADDR; ++ ++ if (!IsOpen()) ++ return (uint16_t)phys_addr; ++ ++ CLockObject lock(m_mutex); ++ ++ if ((phys_addr = ioctl(m_fd, CEC_IOC_GETPADDR)) < 0) ++ { ++ LIB_CEC->AddLog(CEC_LOG_ERROR, "%s: IOCTL GetPhysicalAddr failed !", __func__); ++ phys_addr = CEC_DEFAULT_PADDR; ++ } ++ return (uint16_t)phys_addr; ++} ++ ++ ++cec_logical_addresses CAmlogicCECAdapterCommunication::GetLogicalAddresses(void) ++{ ++ return m_logicalAddresses; ++} ++ ++ ++bool CAmlogicCECAdapterCommunication::SetLogicalAddresses(const cec_logical_addresses &addresses) ++{ ++ unsigned int log_addr = addresses.primary; ++ if (!IsOpen()) ++ return false; ++ ++ CLockObject lock(m_mutex); ++ ++ if (ioctl(m_fd, CEC_IOC_SETLADDR, &log_addr)) ++ { ++ LIB_CEC->AddLog(CEC_LOG_ERROR, "%s: IOCTL SetLogicalAddr failed !", __func__); ++ return false; ++ } ++ m_logicalAddresses = addresses; ++ m_bLogicalAddressChanged = true; ++ ++ return true; ++} ++ ++ ++void CAmlogicCECAdapterCommunication::HandleLogicalAddressLost(cec_logical_address UNUSED(oldAddress)) ++{ ++ unsigned int log_addr = CECDEVICE_BROADCAST; ++ ++ if (!IsOpen()) ++ return; ++ ++ CLockObject lock(m_mutex); ++ ++ if (ioctl(m_fd, CEC_IOC_SETLADDR, &log_addr)) ++ { ++ LIB_CEC->AddLog(CEC_LOG_ERROR, "%s: IOCTL SetLogicalAddr failed !", __func__); ++ } ++} ++ ++ ++void *CAmlogicCECAdapterCommunication::Process(void) ++{ ++ uint8_t buffer[CEC_MAX_FRAME_SIZE]; ++ uint32_t size; ++ fd_set rfds; ++ cec_logical_address initiator, destination; ++ struct timeval tv; ++ ++ if (!IsOpen()) ++ return 0; ++ ++ while (!IsStopped()) ++ { ++ int fd = getFileDescriptor(); ++ ++ if (fd == INVALID_SOCKET_VALUE) ++ { ++ break; ++ } ++ ++ FD_ZERO(&rfds); ++ FD_SET(fd, &rfds); ++ ++ tv.tv_sec = 1; ++ tv.tv_usec = 0; ++ ++ if (select(fd + 1, &rfds, NULL, NULL, &tv) >= 0 ) ++ { ++ ++ if (!FD_ISSET(fd, &rfds)) ++ continue; ++ ++ size = read(fd, buffer, CEC_MAX_FRAME_SIZE); ++ ++ if (size > 0) ++ { ++ if (buffer[0] == 0xff) // driver wants us to reread the physical address ++ { ++ if (!IsStopped()) ++ { ++ uint16_t iNewAddress = GetPhysicalAddress(); ++ m_callback->HandlePhysicalAddressChanged(iNewAddress); ++ } ++ continue; ++ } ++ ++ initiator = cec_logical_address(buffer[0] >> 4); ++ destination = cec_logical_address(buffer[0] & 0x0f); ++ ++ cec_command cmd; ++ ++ cec_command::Format( ++ cmd, initiator, destination, ++ ( size > 1 ) ? cec_opcode(buffer[1]) : CEC_OPCODE_NONE); ++ ++ for( uint8_t i = 2; i < size; i++ ) ++ cmd.parameters.PushBack(buffer[i]); ++ ++ if (!IsStopped()) ++ m_callback->OnCommandReceived(cmd); ++ } ++ } ++ } ++ ++ return 0; ++} ++ ++#endif // HAVE_AMLOGIC_API +diff --git a/src/libcec/adapter/Amlogic/AmlogicCECAdapterCommunication.h b/src/libcec/adapter/Amlogic/AmlogicCECAdapterCommunication.h +new file mode 100644 +index 0000000..0e99cf8 +--- /dev/null ++++ b/src/libcec/adapter/Amlogic/AmlogicCECAdapterCommunication.h +@@ -0,0 +1,105 @@ ++#pragma once ++/* ++ * This file is part of the libCEC(R) library. ++ * ++ * libCEC Amlogic Code Copyright (C) 2016 Gerald Dachs ++ * based heavily on: ++ * libCEC Exynos Code Copyright (C) 2014 Valentin Manea ++ * libCEC(R) is Copyright (C) 2011-2015 Pulse-Eight Limited. All rights reserved. ++ * libCEC(R) is an original work, containing original code. ++ * ++ * libCEC(R) is a trademark of Pulse-Eight Limited. ++ * ++ * This program is dual-licensed; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ++ * ++ * ++ * Alternatively, you can license this library under a commercial license, ++ * please contact Pulse-Eight Licensing for more information. ++ * ++ * For more information contact: ++ * Pulse-Eight Licensing <license@pulse-eight.com> ++ * http://www.pulse-eight.com/ ++ * http://www.pulse-eight.net/ ++ */ ++ ++#include "env.h" ++ ++#if defined(HAVE_AMLOGIC_API) ++ ++#include <p8-platform/threads/mutex.h> ++#include <p8-platform/threads/threads.h> ++#include "../AdapterCommunication.h" ++#include <map> ++ ++namespace CEC ++{ ++ class CAmlogicCECAdapterCommunication : public IAdapterCommunication, public P8PLATFORM::CThread ++ { ++ public: ++ /*! ++ * @brief Create a new Exynos HDMI CEC communication handler. ++ * @param callback The callback to use for incoming CEC commands. ++ */ ++ CAmlogicCECAdapterCommunication(IAdapterCommunicationCallback *callback); ++ virtual ~CAmlogicCECAdapterCommunication(void); ++ ++ /** @name IAdapterCommunication implementation */ ++ ///{ ++ bool Open(uint32_t iTimeoutMs = CEC_DEFAULT_CONNECT_TIMEOUT, bool bSkipChecks = false, bool bStartListening = true); ++ void Close(void); ++ bool IsOpen(void); ++ std::string GetError(void) const; ++ cec_adapter_message_state Write(const cec_command &data, bool &bRetry, uint8_t iLineTimeout, bool bIsReply); ++ ++ bool SetLineTimeout(uint8_t UNUSED(iTimeout)) { return true; } ++ bool StartBootloader(void) { return false; } ++ bool SetLogicalAddresses(const cec_logical_addresses &addresses); ++ cec_logical_addresses GetLogicalAddresses(void); ++ bool PingAdapter(void) { return IsInitialised(); } ++ uint16_t GetFirmwareVersion(void); ++ uint32_t GetFirmwareBuildDate(void) { return 0; } ++ bool IsRunningLatestFirmware(void) { return true; } ++ bool PersistConfiguration(const libcec_configuration & UNUSED(configuration)) { return false; } ++ bool GetConfiguration(libcec_configuration & UNUSED(configuration)) { return false; } ++ std::string GetPortName(void) { return std::string("AMLOGIC"); } ++ uint16_t GetPhysicalAddress(void); ++ bool SetControlledMode(bool UNUSED(controlled)) { return true; } ++ cec_vendor_id GetVendorId(void); ++ bool SupportsSourceLogicalAddress(const cec_logical_address address) { return address > CECDEVICE_TV && address <= CECDEVICE_BROADCAST; } ++ cec_adapter_type GetAdapterType(void) { return ADAPTERTYPE_AMLOGIC; } ++ uint16_t GetAdapterVendorId(void) const { return 1; } ++ uint16_t GetAdapterProductId(void) const { return 1; } ++ void HandleLogicalAddressLost(cec_logical_address oldAddress); ++ void SetActiveSource(bool UNUSED(bSetTo), bool UNUSED(bClientUnregistered)) {} ++ ///} ++ ++ /** @name P8PLATFORM::CThread implementation */ ++ ///{ ++ void *Process(void); ++ ///} ++ ++ private: ++ bool IsInitialised(void) const { return 1; }; ++ int getFileDescriptor(void); ++ ++ std::string m_strError; /**< current error message */ ++ ++ bool m_bLogicalAddressChanged; ++ cec_logical_addresses m_logicalAddresses; ++ P8PLATFORM::CMutex m_mutex; ++ int m_fd; ++ }; ++}; ++#endif +diff --git a/src/libcec/adapter/Amlogic/AmlogicCECAdapterDetection.cpp b/src/libcec/adapter/Amlogic/AmlogicCECAdapterDetection.cpp +new file mode 100644 +index 0000000..2247346 +--- /dev/null ++++ b/src/libcec/adapter/Amlogic/AmlogicCECAdapterDetection.cpp +@@ -0,0 +1,50 @@ ++/* ++ * This file is part of the libCEC(R) library. ++ * ++ * libCEC Amlogic Code Copyright (C) 2016 Gerald Dachs ++ * based heavily on: ++ * libCEC Exynos Code Copyright (C) 2014 Valentin Manea ++ * libCEC(R) is Copyright (C) 2011-2015 Pulse-Eight Limited. All rights reserved. ++ * libCEC(R) is an original work, containing original code. ++ * ++ * libCEC(R) is a trademark of Pulse-Eight Limited. ++ * ++ * This program is dual-licensed; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ++ * ++ * ++ * Alternatively, you can license this library under a commercial license, ++ * please contact Pulse-Eight Licensing for more information. ++ * ++ * For more information contact: ++ * Pulse-Eight Licensing <license@pulse-eight.com> ++ * http://www.pulse-eight.com/ ++ * http://www.pulse-eight.net/ ++ */ ++ ++#include "env.h" ++#include <stdio.h> ++ ++#if defined(HAVE_AMLOGIC_API) ++#include "AmlogicCECAdapterDetection.h" ++#include "AmlogicCEC.h" ++ ++using namespace CEC; ++ ++bool CAmlogicCECAdapterDetection::FindAdapter(void) ++{ ++ return access(CEC_AMLOGIC_PATH, 0) == 0; ++} ++ ++#endif +diff --git a/src/libcec/adapter/Amlogic/AmlogicCECAdapterDetection.h b/src/libcec/adapter/Amlogic/AmlogicCECAdapterDetection.h +new file mode 100644 +index 0000000..8a7418d +--- /dev/null ++++ b/src/libcec/adapter/Amlogic/AmlogicCECAdapterDetection.h +@@ -0,0 +1,46 @@ ++#pragma once ++/* ++ * This file is part of the libCEC(R) library. ++ * ++ * libCEC Amlogic Code Copyright (C) 2016 Gerald Dachs ++ * based heavily on: ++ * libCEC Exynos Code Copyright (C) 2014 Valentin Manea ++ * libCEC(R) is Copyright (C) 2011-2015 Pulse-Eight Limited. All rights reserved. ++ * libCEC(R) is an original work, containing original code. ++ * ++ * libCEC(R) is a trademark of Pulse-Eight Limited. ++ * ++ * This program is dual-licensed; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ++ * ++ * ++ * Alternatively, you can license this library under a commercial license, ++ * please contact Pulse-Eight Licensing for more information. ++ * ++ * For more information contact: ++ * Pulse-Eight Licensing <license@pulse-eight.com> ++ * http://www.pulse-eight.com/ ++ * http://www.pulse-eight.net/ ++ */ ++ ++#include "env.h" ++ ++namespace CEC ++{ ++ class CAmlogicCECAdapterDetection ++ { ++ public: ++ static bool FindAdapter(void); ++ }; ++} +diff --git a/src/libcec/cmake/CheckPlatformSupport.cmake b/src/libcec/cmake/CheckPlatformSupport.cmake +index b8a16c8..311cb52 100644 +--- a/src/libcec/cmake/CheckPlatformSupport.cmake ++++ b/src/libcec/cmake/CheckPlatformSupport.cmake +@@ -9,6 +9,7 @@ + # HAVE_RPI_API 1 if Raspberry Pi is supported + # HAVE_TDA995X_API 1 if TDA995X is supported + # HAVE_EXYNOS_API 1 if Exynos is supported ++# HAVE_AMLOGIC_API 1 if Amlogic is supported + # HAVE_P8_USB 1 if Pulse-Eight devices are supported + # HAVE_P8_USB_DETECT 1 if Pulse-Eight devices can be auto-detected + # HAVE_DRM_EDID_PARSER 1 if DRM EDID parsing is supported +@@ -132,6 +133,18 @@ else() + else() + set(HAVE_EXYNOS_API 0) + endif() ++ ++ # Amlogic ++ if (${HAVE_AMLOGIC_API}) ++ set(LIB_INFO "${LIB_INFO}, Amlogic") ++ set(HAVE_AMLOGIC_API 1) ++ set(CEC_SOURCES_ADAPTER_AMLOGIC adapter/Amlogic/AmlogicCECAdapterDetection.cpp ++ adapter/Amlogic/AmlogicCECAdapterCommunication.cpp) ++ source_group("Source Files\\adapter\\Amlogic" FILES ${CEC_SOURCES_ADAPTER_AMLOGIC}) ++ list(APPEND CEC_SOURCES ${CEC_SOURCES_ADAPTER_AMLOGIC}) ++ else() ++ set(HAVE_AMLOGIC_API 0) ++ endif() + endif() + + # rt +diff --git a/src/libcec/cmake/DisplayPlatformSupport.cmake b/src/libcec/cmake/DisplayPlatformSupport.cmake +index 9dcaacf..464252e 100644 +--- a/src/libcec/cmake/DisplayPlatformSupport.cmake ++++ b/src/libcec/cmake/DisplayPlatformSupport.cmake +@@ -44,6 +44,12 @@ else() + message(STATUS "DRM support: no") + endif() + ++if (HAVE_AMLOGIC_API) ++ message(STATUS "Amlogic support: yes") ++else() ++ message(STATUS "Amlogic support: no") ++endif() ++ + if (HAVE_PYTHON) + message(STATUS "Python support: version ${PYTHONLIBS_VERSION_STRING} (${PYTHON_VERSION})") + else() +diff --git a/src/libcec/env.h.in b/src/libcec/env.h.in +index 0496aa0..971f769 100644 +--- a/src/libcec/env.h.in ++++ b/src/libcec/env.h.in +@@ -72,6 +72,9 @@ + /* Define to 1 for Exynos support */ + #cmakedefine HAVE_EXYNOS_API @HAVE_EXYNOS_API@ + ++/* Define to 1 for Amlogic support */ ++#cmakedefine HAVE_AMLOGIC_API @HAVE_AMLOGIC_API@ ++ + /* Define to 1 for nVidia EDID parsing support (on selected models) */ + #cmakedefine HAVE_NVIDIA_EDID_PARSER @HAVE_NVIDIA_EDID_PARSER@ + diff --git a/projects/WeTek_Play/patches/linux/080-amlogic-cec-driver.patch b/projects/WeTek_Play/patches/linux/080-amlogic-cec-driver.patch index 5d72bcde96f..e4685d281eb 100644 --- a/projects/WeTek_Play/patches/linux/080-amlogic-cec-driver.patch +++ b/projects/WeTek_Play/patches/linux/080-amlogic-cec-driver.patch @@ -55,10 +55,10 @@ index 7a944cd..f74ec1f 100755 #EXTRA_CFLAGS += -O2 diff --git a/drivers/amlogic/hdmi/hdmi_tx/amlogic_cec.c b/drivers/amlogic/hdmi/hdmi_tx/amlogic_cec.c new file mode 100644 -index 0000000..bd31aaa +index 0000000..1bfc29b --- /dev/null +++ b/drivers/amlogic/hdmi/hdmi_tx/amlogic_cec.c -@@ -0,0 +1,596 @@ +@@ -0,0 +1,679 @@ +/* linux/drivers/amlogic/hdmi/hdmi_tx/amlogic_cec.c + * + * Copyright (c) 2016 Gerald Dachs @@ -84,6 +84,7 @@ index 0000000..bd31aaa +#include <linux/delay.h> +#include <linux/types.h> +#include <linux/atomic.h> ++#include <linux/semaphore.h> + +#include <asm/uaccess.h> +#include <asm/delay.h> @@ -127,6 +128,8 @@ index 0000000..bd31aaa +/* CEC Tx buffer size */ +#define CEC_TX_BUFF_SIZE 16 + ++static DEFINE_SEMAPHORE(init_mutex); ++ +struct cec_rx_list { + u8 buffer[CEC_RX_BUFF_SIZE]; + unsigned char size; @@ -226,7 +229,7 @@ index 0000000..bd31aaa + rx_msg_status = amlogic_cec_read_reg(CEC_RX_MSG_STATUS); + rx_num_msg = amlogic_cec_read_reg(CEC_RX_NUM_MSG); + -+ amlogic_cec_log_dbg("amlogic_cec_read_hw: enter: CEC_RX_MSG_STATUS %d, CEC_RX_NUM_MSG %d\n", rx_msg_status, rx_num_msg); ++ amlogic_cec_log_dbg("rx_msg_status: %d, rx_num_msg: %d\n", rx_msg_status, rx_num_msg); + + valid_msg = (RX_DONE == rx_msg_status) && (1 == rx_num_msg); + @@ -248,7 +251,7 @@ index 0000000..bd31aaa +#if MESON_CPU_TYPE >= MESON_CPU_TYPE_MESON8 + aml_write_reg32(P_AO_CEC_INTR_CLR, aml_read_reg32(P_AO_CEC_INTR_CLR) | (1 << 2)); +#endif -+ amlogic_cec_write_reg(CEC_RX_MSG_CMD, RX_ACK_NEXT); ++ amlogic_cec_write_reg(CEC_RX_MSG_CMD, valid_msg ? RX_ACK_NEXT : RX_ACK_CURRENT); + amlogic_cec_write_reg(CEC_RX_MSG_CMD, RX_NO_OP); + + return ret; @@ -290,45 +293,89 @@ index 0000000..bd31aaa + if (hdmitx_device->hdmi_info.vsdb_phy_addr.valid == 0) + { + amlogic_cec_log_dbg("no valid cec physical address\n"); -+ if (aml_read_reg32(P_AO_DEBUG_REG1)) ++ if (aml_read_reg32(P_AO_DEBUG_REG1) & 0xffff) + { + amlogic_cec_log_dbg("use last physical address\n"); + } + else + { -+ aml_write_reg32(P_AO_DEBUG_REG1, 0x1000); ++ aml_write_reg32(P_AO_DEBUG_REG1, (aml_read_reg32(P_AO_DEBUG_REG1) & (0xf << 16)) | 0x1000); + amlogic_cec_log_dbg("use default physical address\n"); + } + } + else + { -+ aml_write_reg32(P_AO_DEBUG_REG1, cec_phy_addr); -+ amlogic_cec_log_dbg("physical address:0x%x\n", aml_read_reg32(P_AO_DEBUG_REG1)); -+ -+ if ((hdmitx_device->cec_init_ready != 0) && (hdmitx_device->hpd_state != 0)) -+ { -+ if ((entry = kmalloc(sizeof(struct cec_rx_list), GFP_ATOMIC)) == NULL) ++ if (cec_global_info.my_node_index) ++ { ++ // prevent write operations ++ if (down_interruptible(&init_mutex)) + { -+ amlogic_cec_log_dbg("can't alloc cec_rx_list\n"); ++ printk(KERN_ERR "[amlogic] ##### cec node init interrupted! #####\n"); ++ return; + } -+ else ++ hdmitx_device->cec_init_ready = 0; ++ spin_lock_irqsave(&cec_rx_struct.lock, spin_flags); ++ ++ amlogic_cec_log_dbg("start reset\n"); ++#if MESON_CPU_TYPE == MESON_CPU_TYPE_MESON6 ++ aml_write_reg32(P_HDMI_CTRL_PORT, aml_read_reg32(P_HDMI_CTRL_PORT)|(1<<16)); ++ hdmi_wr_reg(OTHER_BASE_ADDR+HDMI_OTHER_CTRL0, 0xc); //[3]cec_creg_sw_rst [2]cec_sys_sw_rst ++ ++#if 0 ++ hdmi_wr_reg(CEC0_BASE_ADDR+CEC_TX_CLEAR_BUF, 0x1); ++ hdmi_wr_reg(CEC0_BASE_ADDR+CEC_RX_CLEAR_BUF, 0x1); ++ ++ hdmi_wr_reg(CEC0_BASE_ADDR+CEC_TX_CLEAR_BUF, 0x0); ++ hdmi_wr_reg(CEC0_BASE_ADDR+CEC_RX_CLEAR_BUF, 0x0); ++#endif ++ ++ hdmi_wr_reg(OTHER_BASE_ADDR+HDMI_OTHER_CTRL0, 0x0); ++ aml_write_reg32(P_HDMI_CTRL_PORT, aml_read_reg32(P_HDMI_CTRL_PORT)&(~(1<<16))); ++ hdmi_wr_reg(CEC0_BASE_ADDR+CEC_CLOCK_DIV_H, 0x00 ); ++ hdmi_wr_reg(CEC0_BASE_ADDR+CEC_CLOCK_DIV_L, 0xf0 ); ++ ++#endif ++#if MESON_CPU_TYPE >= MESON_CPU_TYPE_MESON8 ++ // regain rx interrupts ++ cec_enable_irq(); ++#endif ++ spin_unlock_irqrestore(&cec_rx_struct.lock, spin_flags); ++ ++ hdmitx_device->cec_init_ready = 1; ++ ++ up(&init_mutex); ++ amlogic_cec_log_dbg("stop reset\n"); ++ } ++ ++ if ((aml_read_reg32(P_AO_DEBUG_REG1) & 0xffff) != cec_phy_addr) ++ { ++ aml_write_reg32(P_AO_DEBUG_REG1, (aml_read_reg32(P_AO_DEBUG_REG1) & (0xf << 16)) | cec_phy_addr); ++ amlogic_cec_log_dbg("physical address:0x%x\n", aml_read_reg32(P_AO_DEBUG_REG1) & 0xffff); ++ ++ if ((hdmitx_device->cec_init_ready != 0) && (hdmitx_device->hpd_state != 0)) + { -+ // let the libCEC ask for new physical Address -+ entry->buffer[0] = 0xff; -+ entry->size = 1; -+ INIT_LIST_HEAD(&entry->list); -+ -+ spin_lock_irqsave(&cec_rx_struct.lock, spin_flags); -+ list_add_tail(&entry->list, &cec_rx_struct.list); -+ amlogic_cec_set_rx_state(STATE_DONE); -+ spin_unlock_irqrestore(&cec_rx_struct.lock, spin_flags); -+ -+ amlogic_cec_log_dbg("trigger libCEC\n"); -+ wake_up_interruptible(&cec_rx_struct.waitq); ++ if ((entry = kmalloc(sizeof(struct cec_rx_list), GFP_ATOMIC)) == NULL) ++ { ++ amlogic_cec_log_dbg("can't alloc cec_rx_list\n"); ++ } ++ else ++ { ++ // let the libCEC ask for new physical Address ++ entry->buffer[0] = 0xff; ++ entry->size = 1; ++ INIT_LIST_HEAD(&entry->list); ++ ++ spin_lock_irqsave(&cec_rx_struct.lock, spin_flags); ++ list_add_tail(&entry->list, &cec_rx_struct.list); ++ amlogic_cec_set_rx_state(STATE_DONE); ++ spin_unlock_irqrestore(&cec_rx_struct.lock, spin_flags); ++ ++ amlogic_cec_log_dbg("trigger libCEC\n"); ++ wake_up_interruptible(&cec_rx_struct.waitq); ++ } + } -+ } ++ } + } -+ amlogic_cec_log_dbg("cec node init: cec features ok !\n"); +} + +static irqreturn_t amlogic_cec_irq_handler(int irq, void *dummy) @@ -338,7 +385,9 @@ index 0000000..bd31aaa + unsigned int tx_msg_state; + unsigned int rx_msg_state; + ++#if MESON_CPU_TYPE == MESON_CPU_TYPE_MESON6 + udelay(100); //Delay execution a little. This fixes an issue when HDMI CEC stops working after a while. ++#endif + + tx_msg_state = amlogic_cec_read_reg(CEC_TX_MSG_STATUS); + rx_msg_state = amlogic_cec_read_reg(CEC_RX_MSG_STATUS); @@ -356,9 +405,6 @@ index 0000000..bd31aaa + case TX_DONE : + amlogic_cec_set_tx_state(STATE_DONE); + break; -+ default : -+ amlogic_cec_log_dbg("unexpected ts message state: 0x%x", tx_msg_state); -+ break; + } + wake_up_interruptible(&cec_tx_struct.waitq); + } @@ -372,16 +418,18 @@ index 0000000..bd31aaa + return IRQ_HANDLED; + } + ++ INIT_LIST_HEAD(&entry->list); ++ ++ spin_lock_irqsave(&cec_rx_struct.lock, spin_flags); ++ + if ((-1) == amlogic_cec_read_hw(entry->buffer, &entry->size)) + { + kfree(entry); + amlogic_cec_log_dbg("amlogic_cec_irq_handler: nothing to read\n"); ++ spin_unlock_irqrestore(&cec_rx_struct.lock, spin_flags); + return IRQ_HANDLED; + } + -+ INIT_LIST_HEAD(&entry->list); -+ -+ spin_lock_irqsave(&cec_rx_struct.lock, spin_flags); + list_add_tail(&entry->list, &cec_rx_struct.list); + amlogic_cec_set_rx_state(STATE_DONE); + spin_unlock_irqrestore(&cec_rx_struct.lock, spin_flags); @@ -432,21 +480,17 @@ index 0000000..bd31aaa + aml_write_reg32(P_SYS_CPU_0_IRQ_IN1_INTR_MASK, aml_read_reg32(P_SYS_CPU_0_IRQ_IN1_INTR_MASK) | (1 << 23)); // Enable the hdmi cec interrupt +#endif +#if MESON_CPU_TYPE >= MESON_CPU_TYPE_MESON8 -+#if 1 // Please match with H/W cec config +// GPIOAO_12 + aml_set_reg32_bits(P_AO_RTI_PIN_MUX_REG, 0, 14, 1); // bit[14]: AO_PWM_C pinmux //0xc8100014 + aml_set_reg32_bits(P_AO_RTI_PULL_UP_REG, 1, 12, 1); // bit[12]: enable AO_12 internal pull-up //0xc810002c + aml_set_reg32_bits(P_AO_RTI_PIN_MUX_REG, 1, 17, 1); // bit[17]: AO_CEC pinmux //0xc8100014 + ao_cec_init(); -+#else -+// GPIOH_3 -+ aml_set_reg32_bits(P_PAD_PULL_UP_EN_REG1, 0, 19, 1); // disable gpioh_3 internal pull-up -+ aml_set_reg32_bits(P_PERIPHS_PIN_MUX_1, 1, 23, 1); // gpioh_3 cec pinmux -+#endif + cec_arbit_bit_time_set(3, 0x118, 0); + cec_arbit_bit_time_set(5, 0x000, 0); + cec_arbit_bit_time_set(7, 0x2aa, 0); +#endif ++ amlogic_cec_write_reg(CEC_LOGICAL_ADDR0, (0x1 << 4) | 0xf); ++ + hdmitx_device->cec_init_ready = 1; + + } @@ -463,6 +507,8 @@ index 0000000..bd31aaa + free_irq(INT_AO_CEC, (void *)hdmitx_device); +#endif + ++ amlogic_cec_write_reg(CEC_LOGICAL_ADDR0, (0x1 << 4) | 0xf); ++ + atomic_dec(&hdmi_on); + + return 0; @@ -503,7 +549,6 @@ index 0000000..bd31aaa + + retval = entry->size; + -+ amlogic_cec_set_rx_state(STATE_RX); + +error_exit: + if (entry != NULL) @@ -512,6 +557,11 @@ index 0000000..bd31aaa + kfree(entry); + } + ++ if (list_empty(&cec_rx_struct.list)) ++ { ++ amlogic_cec_set_rx_state(STATE_RX); ++ } ++ + spin_unlock_irqrestore(&cec_rx_struct.lock, spin_flags); + + return retval; @@ -520,6 +570,7 @@ index 0000000..bd31aaa +static ssize_t amlogic_cec_write(struct file *file, const char __user *buffer, + size_t count, loff_t *ppos) +{ ++ int retval = count; + char data[CEC_TX_BUFF_SIZE]; + + /* check data size */ @@ -534,9 +585,8 @@ index 0000000..bd31aaa + + amlogic_cec_set_tx_state(STATE_TX); + -+ // just for the case that the first write starts -+ // before the end of amlogic_cec_delayed_init() -+ if (wait_event_interruptible(cec_tx_struct.waitq, hdmitx_device->cec_init_ready == 1)) ++ // don't write if cec_node_init() is in progress ++ if (down_interruptible(&init_mutex)) + { + amlogic_cec_log_dbg("error during wait on state change\n"); + printk(KERN_ERR "[amlogic] ##### cec write error! #####\n"); @@ -552,22 +602,27 @@ index 0000000..bd31aaa + printk(KERN_ERR "[amlogic] ##### cec write error! #####\n"); + amlogic_cec_write_reg(CEC_TX_MSG_CMD, TX_ABORT); // stop cec tx for hw retry. + amlogic_cec_write_reg(CEC_TX_MSG_CMD, TX_NO_OP); -+ return -ERESTARTSYS; ++ retval = -ERESTARTSYS; ++ goto error_exit; + } + + if (atomic_read(&cec_tx_struct.state) != STATE_DONE) + { + printk(KERN_ERR "[amlogic] ##### cec write error! #####\n"); -+ return -1; ++ retval = -1; + } + -+ return count; ++error_exit: ++ up(&init_mutex); ++ ++ return retval; +} + +static long amlogic_cec_ioctl(struct file *file, unsigned int cmd, + unsigned long arg) +{ + unsigned char logical_addr; ++ unsigned int reg; + + switch(cmd) { + case CEC_IOC_SETLADDR: @@ -578,12 +633,21 @@ index 0000000..bd31aaa + } + + amlogic_cec_write_reg(CEC_LOGICAL_ADDR0, (0x1 << 4) | logical_addr); ++ cec_global_info.my_node_index = logical_addr; ++ /* ++ * use DEBUG_REG1 bit 16 ~ 31 to save logic address. ++ * So uboot can use this logic address directly ++ */ ++ reg = (aml_read_reg32(P_AO_DEBUG_REG1) & 0xffff); ++ reg |= ((unsigned int)logical_addr) << 16; ++ aml_write_reg32(P_AO_DEBUG_REG1, reg); ++ + amlogic_cec_log_dbg("amlogic_cec_ioctl: Set logical address: %d\n", logical_addr); + return 0; + + case CEC_IOC_GETPADDR: -+ amlogic_cec_log_dbg("amlogic_cec_ioctl: return physical address 0x%x\n", aml_read_reg32(P_AO_DEBUG_REG1)); -+ return aml_read_reg32(P_AO_DEBUG_REG1); ++ amlogic_cec_log_dbg("amlogic_cec_ioctl: return physical address 0x%x\n", aml_read_reg32(P_AO_DEBUG_REG1) & 0xffff); ++ return aml_read_reg32(P_AO_DEBUG_REG1) & 0xffff; + } + + return -EINVAL; @@ -591,7 +655,11 @@ index 0000000..bd31aaa + +static u32 amlogic_cec_poll(struct file *file, poll_table *wait) +{ -+ poll_wait(file, &cec_rx_struct.waitq, wait); ++ ++ if (atomic_read(&cec_rx_struct.state) != STATE_DONE) ++ { ++ poll_wait(file, &cec_rx_struct.waitq, wait); ++ } + + if (atomic_read(&cec_rx_struct.state) == STATE_DONE) + { @@ -618,13 +686,23 @@ index 0000000..bd31aaa + +static int amlogic_cec_init(void) +{ ++ int retval = 0; + extern hdmitx_dev_t * get_hdmitx_device(void); ++ ++ if (down_interruptible(&init_mutex)) ++ { ++ return -ERESTARTSYS; ++ } ++ + INIT_LIST_HEAD(&cec_rx_struct.list); + + printk("%s, Version: %s\n", banner, VERSION); + + hdmitx_device = get_hdmitx_device(); + amlogic_cec_log_dbg("CEC init\n"); ++ ++ amlogic_cec_write_reg(CEC_LOGICAL_ADDR0, (0x1 << 4) | 0xf); ++ +#if MESON_CPU_TYPE == MESON_CPU_TYPE_MESON6 + hdmi_wr_reg(CEC0_BASE_ADDR+CEC_CLOCK_DIV_H, 0x00 ); + hdmi_wr_reg(CEC0_BASE_ADDR+CEC_CLOCK_DIV_L, 0xf0 ); @@ -641,10 +719,15 @@ index 0000000..bd31aaa + if (misc_register(&cec_misc_device)) + { + printk(KERN_WARNING " Couldn't register device 10, %d.\n", CEC_MINOR); -+ return -EBUSY; ++ retval = -EBUSY; + } + -+ return 0; ++ // release initial lock on init_mutex ++ up(&init_mutex); ++ ++ amlogic_cec_log_dbg("CEC init finished: %d\n", retval); ++ ++ return retval; +} + +static void amlogic_cec_exit(void) diff --git a/projects/WeTek_Play/splash/splash-full.png b/projects/WeTek_Play/splash/splash-full.png deleted file mode 100644 index 36ec92afbf2..00000000000 Binary files a/projects/WeTek_Play/splash/splash-full.png and /dev/null differ diff --git a/projects/imx6/filesystem/usr/lib/systemd/system/serial-console.service b/projects/imx6/filesystem/usr/lib/systemd/system/serial-console.service index 9e0ca3617a4..50437436995 100644 --- a/projects/imx6/filesystem/usr/lib/systemd/system/serial-console.service +++ b/projects/imx6/filesystem/usr/lib/systemd/system/serial-console.service @@ -6,6 +6,7 @@ ConditionKernelCommandLine=console=ttymxc0,115200 [Service] WorkingDirectory=/storage Environment="ENV=/etc/profile" +ExecStartPre=/bin/sh -c 'echo -en "\033[?25h"' ExecStart=/bin/sh Restart=always RestartSec=0 diff --git a/projects/imx6/kodi/advancedsettings.xml b/projects/imx6/kodi/advancedsettings.xml index 9faba43f899..e19d88653c9 100644 --- a/projects/imx6/kodi/advancedsettings.xml +++ b/projects/imx6/kodi/advancedsettings.xml @@ -13,9 +13,4 @@ <samba> <clienttimeout>30</clienttimeout> </samba> - - <network> - <readbufferfactor>4.0</readbufferfactor> - </network> - </advancedsettings> diff --git a/projects/imx6/linux/linux.arm.conf b/projects/imx6/linux/3.14-mx6-sr/linux.arm.conf similarity index 96% rename from projects/imx6/linux/linux.arm.conf rename to projects/imx6/linux/3.14-mx6-sr/linux.arm.conf index fbe6f82a1e5..be64eee02c9 100644 --- a/projects/imx6/linux/linux.arm.conf +++ b/projects/imx6/linux/3.14-mx6-sr/linux.arm.conf @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/arm 3.14.36 Kernel Configuration +# Linux/arm 3.14.60 Kernel Configuration # CONFIG_ARM=y CONFIG_MIGHT_HAVE_PCI=y @@ -9,7 +9,7 @@ CONFIG_HAVE_PROC_CPU=y CONFIG_STACKTRACE_SUPPORT=y CONFIG_LOCKDEP_SUPPORT=y CONFIG_TRACE_IRQFLAGS_SUPPORT=y -CONFIG_RWSEM_GENERIC_SPINLOCK=y +CONFIG_RWSEM_XCHGADD_ALGORITHM=y CONFIG_ARCH_HAS_CPUFREQ=y CONFIG_GENERIC_HWEIGHT=y CONFIG_GENERIC_CALIBRATE_DELAY=y @@ -102,7 +102,7 @@ CONFIG_RCU_NOCB_CPU=y # CONFIG_RCU_NOCB_CPU_NONE is not set # CONFIG_RCU_NOCB_CPU_ZERO is not set CONFIG_RCU_NOCB_CPU_ALL=y -CONFIG_IKCONFIG=m +CONFIG_IKCONFIG=y CONFIG_IKCONFIG_PROC=y CONFIG_LOG_BUF_SHIFT=17 CONFIG_GENERIC_SCHED_CLOCK=y @@ -272,7 +272,7 @@ CONFIG_INLINE_WRITE_UNLOCK=y CONFIG_INLINE_WRITE_UNLOCK_IRQ=y CONFIG_ARCH_SUPPORTS_ATOMIC_RMW=y CONFIG_MUTEX_SPIN_ON_OWNER=y -# CONFIG_FREEZER is not set +CONFIG_FREEZER=y # # System Type @@ -339,7 +339,7 @@ CONFIG_ARCH_MXC=y # # Freescale i.MX support # -CONFIG_MXC_DEBUG_BOARD=y +# CONFIG_MXC_DEBUG_BOARD is not set CONFIG_HAVE_IMX_ANATOP=y CONFIG_HAVE_IMX_GPC=y CONFIG_HAVE_IMX_MMDC=y @@ -357,8 +357,10 @@ CONFIG_HAVE_IMX_SRC=y # # CONFIG_SOC_IMX50 is not set # CONFIG_SOC_IMX53 is not set +CONFIG_SOC_IMX6=y CONFIG_SOC_IMX6Q=y -CONFIG_SOC_IMX6SL=y +# CONFIG_SOC_IMX6SL is not set +# CONFIG_SOC_IMX6SX is not set # CONFIG_SOC_VF610 is not set # CONFIG_ARCH_OMAP3 is not set # CONFIG_ARCH_OMAP4 is not set @@ -432,8 +434,6 @@ CONFIG_ARM_ERRATA_764369=y CONFIG_ARM_ERRATA_775420=y # CONFIG_ARM_ERRATA_798181 is not set # CONFIG_ARM_ERRATA_773022 is not set -CONFIG_ARM_ERRATA_794072=y -CONFIG_ARM_ERRATA_761320=y # # Bus support @@ -456,6 +456,7 @@ CONFIG_PCIE_DW=y CONFIG_PCI_IMX6=y # CONFIG_EP_MODE_IN_EP_RC_SYS is not set # CONFIG_RC_MODE_IN_EP_RC_SYS is not set +# CONFIG_PCI_HOST_GENERIC is not set CONFIG_PCIEPORTBUS=y CONFIG_PCIEAER=y # CONFIG_PCIE_ECRC is not set @@ -482,10 +483,10 @@ CONFIG_HAVE_ARM_SCU=y CONFIG_HAVE_ARM_TWD=y # CONFIG_MCPM is not set # CONFIG_BIG_LITTLE is not set -# CONFIG_VMSPLIT_3G is not set -CONFIG_VMSPLIT_2G=y +CONFIG_VMSPLIT_3G=y +# CONFIG_VMSPLIT_2G is not set # CONFIG_VMSPLIT_1G is not set -CONFIG_PAGE_OFFSET=0x80000000 +CONFIG_PAGE_OFFSET=0xC0000000 CONFIG_NR_CPUS=4 CONFIG_HOTPLUG_CPU=y # CONFIG_ARM_PSCI is not set @@ -531,6 +532,7 @@ CONFIG_CLEANCACHE=y CONFIG_FRONTSWAP=y CONFIG_CMA=y # CONFIG_CMA_DEBUG is not set +# CONFIG_CMA_DEBUGFS is not set CONFIG_CMA_AREAS=7 # CONFIG_ZBUD is not set # CONFIG_ZSWAP is not set @@ -556,6 +558,8 @@ CONFIG_CMDLINE="root=/dev/ram0 rdinit=/init noram usbcore.autosuspend=-1 coheren # CONFIG_CMDLINE_FROM_BOOTLOADER is not set CONFIG_CMDLINE_EXTEND=y # CONFIG_CMDLINE_FORCE is not set +CONFIG_KEXEC=y +CONFIG_ATAGS_PROC=y # CONFIG_CRASH_DUMP is not set CONFIG_AUTO_ZRELADDR=y @@ -574,8 +578,8 @@ CONFIG_CPU_FREQ_STAT=y # CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE is not set # CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set # CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set -CONFIG_CPU_FREQ_DEFAULT_GOV_INTERACTIVE=y # CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set +CONFIG_CPU_FREQ_DEFAULT_GOV_INTERACTIVE=y CONFIG_CPU_FREQ_GOV_PERFORMANCE=y CONFIG_CPU_FREQ_GOV_POWERSAVE=y # CONFIG_CPU_FREQ_GOV_USERSPACE is not set @@ -587,7 +591,7 @@ CONFIG_CPU_FREQ_GOV_INTERACTIVE=y # # ARM CPU frequency scaling drivers # -CONFIG_ARM_IMX6_CPUFREQ=y +CONFIG_ARM_IMX6Q_CPUFREQ=y # CONFIG_ARM_KIRKWOOD_CPUFREQ is not set # @@ -622,16 +626,25 @@ CONFIG_COREDUMP=y # # Power management options # -# CONFIG_SUSPEND is not set +CONFIG_SUSPEND=y +CONFIG_SUSPEND_FREEZER=y +CONFIG_PM_SLEEP=y +CONFIG_PM_SLEEP_SMP=y +# CONFIG_PM_AUTOSLEEP is not set +# CONFIG_PM_WAKELOCKS is not set CONFIG_PM_RUNTIME=y CONFIG_PM=y -CONFIG_PM_DEBUG=y -# CONFIG_PM_ADVANCED_DEBUG is not set +# CONFIG_PM_DEBUG is not set # CONFIG_APM_EMULATION is not set CONFIG_ARCH_HAS_OPP=y CONFIG_PM_OPP=y CONFIG_PM_CLK=y +CONFIG_PM_GENERIC_DOMAINS=y # CONFIG_WQ_POWER_EFFICIENT_DEFAULT is not set +CONFIG_PM_GENERIC_DOMAINS_SLEEP=y +CONFIG_PM_GENERIC_DOMAINS_RUNTIME=y +CONFIG_PM_GENERIC_DOMAINS_OF=y +CONFIG_CPU_PM=y CONFIG_ARCH_SUSPEND_POSSIBLE=y CONFIG_ARM_CPU_SUSPEND=y CONFIG_NET=y @@ -1000,10 +1013,9 @@ CONFIG_EXTRA_FIRMWARE_DIR="firmware" # CONFIG_DEBUG_DEVRES is not set # CONFIG_SYS_HYPERVISOR is not set # CONFIG_GENERIC_CPU_DEVICES is not set -# CONFIG_HAVE_CPU_AUTOPROBE is not set CONFIG_SOC_BUS=y CONFIG_REGMAP=y -CONFIG_REGMAP_AC97=m +CONFIG_REGMAP_AC97=y CONFIG_REGMAP_I2C=y CONFIG_REGMAP_SPI=y CONFIG_REGMAP_MMIO=y @@ -1091,7 +1103,6 @@ CONFIG_MTD_PHYSMAP_OF=y CONFIG_MTD_DATAFLASH=y # CONFIG_MTD_DATAFLASH_WRITE_VERIFY is not set # CONFIG_MTD_DATAFLASH_OTP is not set -CONFIG_MTD_M25P80=y CONFIG_MTD_SST25L=y # CONFIG_MTD_SLRAM is not set # CONFIG_MTD_PHRAM is not set @@ -1124,6 +1135,7 @@ CONFIG_MTD_NAND_MXC=y # LPDDR flash memory drivers # # CONFIG_MTD_LPDDR is not set +# CONFIG_MTD_SPI_NOR is not set CONFIG_MTD_UBI=y CONFIG_MTD_UBI_WL_THRESHOLD=4096 CONFIG_MTD_UBI_BEB_LIMIT=20 @@ -1354,11 +1366,9 @@ CONFIG_ATA_BMDMA=y # SATA SFF controllers with BMDMA # # CONFIG_ATA_PIIX is not set -# CONFIG_SATA_HIGHBANK is not set # CONFIG_SATA_MV is not set # CONFIG_SATA_NV is not set # CONFIG_SATA_PROMISE is not set -# CONFIG_SATA_RCAR is not set # CONFIG_SATA_SIL is not set # CONFIG_SATA_SIS is not set # CONFIG_SATA_SVW is not set @@ -1371,14 +1381,10 @@ CONFIG_ATA_BMDMA=y # # CONFIG_PATA_ALI is not set # CONFIG_PATA_AMD is not set -# CONFIG_PATA_ARASAN_CF is not set # CONFIG_PATA_ARTOP is not set # CONFIG_PATA_ATIIXP is not set # CONFIG_PATA_ATP867X is not set # CONFIG_PATA_CMD64X is not set -# CONFIG_PATA_CS5520 is not set -# CONFIG_PATA_CS5530 is not set -# CONFIG_PATA_CS5536 is not set # CONFIG_PATA_CYPRESS is not set # CONFIG_PATA_EFAR is not set # CONFIG_PATA_HPT366 is not set @@ -1399,7 +1405,6 @@ CONFIG_PATA_IMX=y # CONFIG_PATA_PDC_OLD is not set # CONFIG_PATA_RADISYS is not set # CONFIG_PATA_RDC is not set -# CONFIG_PATA_SC1200 is not set # CONFIG_PATA_SCH is not set # CONFIG_PATA_SERVERWORKS is not set # CONFIG_PATA_SIL680 is not set @@ -1701,8 +1706,10 @@ CONFIG_B43_HWRNG=y CONFIG_BRCMUTIL=m # CONFIG_BRCMSMAC is not set CONFIG_BRCMFMAC=m +CONFIG_BRCMFMAC_PROTO_BCDC=y CONFIG_BRCMFMAC_SDIO=y CONFIG_BRCMFMAC_USB=y +# CONFIG_BRCMFMAC_PCIE is not set # CONFIG_BRCM_TRACING is not set # CONFIG_BRCMDBG is not set # CONFIG_HOSTAP is not set @@ -1833,7 +1840,9 @@ CONFIG_TOUCHSCREEN_ADS7846=m # CONFIG_TOUCHSCREEN_HAMPSHIRE is not set # CONFIG_TOUCHSCREEN_EETI is not set CONFIG_TOUCHSCREEN_EGALAX=m +# CONFIG_TOUCHSCREEN_ELAN is not set # CONFIG_TOUCHSCREEN_FUJITSU is not set +# CONFIG_TOUCHSCREEN_GOODIX is not set # CONFIG_TOUCHSCREEN_ILI210X is not set # CONFIG_TOUCHSCREEN_GUNZE is not set # CONFIG_TOUCHSCREEN_ELO is not set @@ -1854,23 +1863,23 @@ CONFIG_TOUCHSCREEN_EGALAX=m CONFIG_TOUCHSCREEN_USB_COMPOSITE=m # CONFIG_TOUCHSCREEN_MC13783 is not set CONFIG_TOUCHSCREEN_USB_EGALAX=y -# CONFIG_TOUCHSCREEN_USB_PANJIT is not set +CONFIG_TOUCHSCREEN_USB_PANJIT=y CONFIG_TOUCHSCREEN_USB_3M=y -# CONFIG_TOUCHSCREEN_USB_ITM is not set -# CONFIG_TOUCHSCREEN_USB_ETURBO is not set -# CONFIG_TOUCHSCREEN_USB_GUNZE is not set -# CONFIG_TOUCHSCREEN_USB_DMC_TSC10 is not set -# CONFIG_TOUCHSCREEN_USB_IRTOUCH is not set -# CONFIG_TOUCHSCREEN_USB_IDEALTEK is not set -# CONFIG_TOUCHSCREEN_USB_GENERAL_TOUCH is not set -# CONFIG_TOUCHSCREEN_USB_GOTOP is not set -# CONFIG_TOUCHSCREEN_USB_JASTEC is not set -# CONFIG_TOUCHSCREEN_USB_ELO is not set -# CONFIG_TOUCHSCREEN_USB_E2I is not set -# CONFIG_TOUCHSCREEN_USB_ZYTRONIC is not set -# CONFIG_TOUCHSCREEN_USB_ETT_TC45USB is not set -# CONFIG_TOUCHSCREEN_USB_NEXIO is not set -# CONFIG_TOUCHSCREEN_USB_EASYTOUCH is not set +CONFIG_TOUCHSCREEN_USB_ITM=y +CONFIG_TOUCHSCREEN_USB_ETURBO=y +CONFIG_TOUCHSCREEN_USB_GUNZE=y +CONFIG_TOUCHSCREEN_USB_DMC_TSC10=y +CONFIG_TOUCHSCREEN_USB_IRTOUCH=y +CONFIG_TOUCHSCREEN_USB_IDEALTEK=y +CONFIG_TOUCHSCREEN_USB_GENERAL_TOUCH=y +CONFIG_TOUCHSCREEN_USB_GOTOP=y +CONFIG_TOUCHSCREEN_USB_JASTEC=y +CONFIG_TOUCHSCREEN_USB_ELO=y +CONFIG_TOUCHSCREEN_USB_E2I=y +CONFIG_TOUCHSCREEN_USB_ZYTRONIC=y +CONFIG_TOUCHSCREEN_USB_ETT_TC45USB=y +CONFIG_TOUCHSCREEN_USB_NEXIO=y +CONFIG_TOUCHSCREEN_USB_EASYTOUCH=y # CONFIG_TOUCHSCREEN_TOUCHIT213 is not set # CONFIG_TOUCHSCREEN_TSC_SERIO is not set # CONFIG_TOUCHSCREEN_TSC2005 is not set @@ -1902,6 +1911,7 @@ CONFIG_INPUT_UINPUT=y # CONFIG_INPUT_ADXL34X is not set # CONFIG_INPUT_IMS_PCU is not set # CONFIG_INPUT_CMA3000 is not set +# CONFIG_INPUT_ISL29023 is not set # # Hardware I/O ports @@ -1916,6 +1926,7 @@ CONFIG_TTY=y CONFIG_VT=y CONFIG_CONSOLE_TRANSLATIONS=y CONFIG_VT_CONSOLE=y +CONFIG_VT_CONSOLE_SLEEP=y CONFIG_HW_CONSOLE=y CONFIG_VT_HW_CONSOLE_BINDING=y CONFIG_UNIX98_PTYS=y @@ -1957,6 +1968,7 @@ CONFIG_SERIAL_CORE_CONSOLE=y # CONFIG_SERIAL_ST_ASC is not set # CONFIG_TTY_PRINTK is not set CONFIG_FSL_OTP=y +# CONFIG_FSL_OTP_WRITE_ENABLE is not set # CONFIG_HVC_DCC is not set # CONFIG_IPMI_HANDLER is not set CONFIG_HW_RANDOM=y @@ -2109,7 +2121,6 @@ CONFIG_PINCONF=y # CONFIG_PINCTRL_CAPRI is not set CONFIG_PINCTRL_IMX=y CONFIG_PINCTRL_IMX6Q=y -CONFIG_PINCTRL_IMX6SL=y # CONFIG_PINCTRL_MSM8X74 is not set # CONFIG_PINCTRL_SINGLE is not set CONFIG_ARCH_HAVE_CUSTOM_GPIO_H=y @@ -2227,9 +2238,9 @@ CONFIG_POWER_SUPPLY=y # CONFIG_CHARGER_SMB347 is not set # CONFIG_IMX6_USB_CHARGER is not set CONFIG_POWER_RESET=y -# CONFIG_POWER_RESET_GPIO is not set +CONFIG_POWER_RESET_GPIO=y # CONFIG_POWER_RESET_RESTART is not set -CONFIG_POWER_RESET_UDOO=y +CONFIG_POWER_RESET_SNVS=y # CONFIG_POWER_AVS is not set CONFIG_HWMON=y # CONFIG_HWMON_VID is not set @@ -2267,7 +2278,7 @@ CONFIG_HWMON=y # CONFIG_SENSORS_G762 is not set # CONFIG_SENSORS_GL518SM is not set # CONFIG_SENSORS_GL520SM is not set -# CONFIG_SENSORS_GPIO_FAN is not set +CONFIG_SENSORS_GPIO_FAN=m # CONFIG_SENSORS_HIH6130 is not set # CONFIG_SENSORS_HTU21 is not set # CONFIG_SENSORS_IT87 is not set @@ -2297,6 +2308,7 @@ CONFIG_HWMON=y # CONFIG_SENSORS_MAX16065 is not set # CONFIG_SENSORS_MAX1619 is not set # CONFIG_SENSORS_MAX1668 is not set +# CONFIG_SENSORS_MAX17135 is not set # CONFIG_SENSORS_MAX197 is not set # CONFIG_SENSORS_MAX6639 is not set # CONFIG_SENSORS_MAX6642 is not set @@ -2345,6 +2357,7 @@ CONFIG_HWMON=y # CONFIG_SENSORS_W83627EHF is not set # CONFIG_SENSORS_MC13783_ADC is not set # CONFIG_SENSORS_MAG3110 is not set +# CONFIG_MXC_MMA8451 is not set CONFIG_THERMAL=y CONFIG_THERMAL_HWMON=y CONFIG_THERMAL_OF=y @@ -2405,6 +2418,7 @@ CONFIG_MFD_DA9052_I2C=y # CONFIG_MFD_DA9055 is not set # CONFIG_MFD_DA9063 is not set CONFIG_MFD_MXC_HDMI=y +# CONFIG_MFD_MXC_HDMI_ANDROID is not set CONFIG_MFD_MC13XXX=m CONFIG_MFD_MC13XXX_SPI=m CONFIG_MFD_MC13XXX_I2C=m @@ -2418,6 +2432,7 @@ CONFIG_MFD_MC13XXX_I2C=m # CONFIG_MFD_88PM800 is not set # CONFIG_MFD_88PM805 is not set # CONFIG_MFD_88PM860X is not set +# CONFIG_MFD_MAX17135 is not set # CONFIG_MFD_MAX14577 is not set # CONFIG_MFD_MAX77686 is not set # CONFIG_MFD_MAX77693 is not set @@ -2473,6 +2488,7 @@ CONFIG_MFD_SYSCON=y # CONFIG_MFD_WM831X_SPI is not set # CONFIG_MFD_WM8350_I2C is not set # CONFIG_MFD_WM8994 is not set +# CONFIG_MFD_TDA1997X is not set # CONFIG_VEXPRESS_CONFIG is not set CONFIG_REGULATOR=y # CONFIG_REGULATOR_DEBUG is not set @@ -2491,6 +2507,7 @@ CONFIG_REGULATOR_ANATOP=y # CONFIG_REGULATOR_LP3972 is not set # CONFIG_REGULATOR_LP872X is not set # CONFIG_REGULATOR_LP8755 is not set +# CONFIG_REGULATOR_LTC3676 is not set # CONFIG_REGULATOR_MAX1586 is not set # CONFIG_REGULATOR_MAX8649 is not set # CONFIG_REGULATOR_MAX8660 is not set @@ -2663,7 +2680,9 @@ CONFIG_V4L_PLATFORM_DRIVERS=y # CONFIG_VIDEO_CAFE_CCIC is not set # CONFIG_VIDEO_TIMBERDALE is not set CONFIG_VIDEO_MXC_OUTPUT=y +# CONFIG_VIDEO_MXC_CAPTURE is not set CONFIG_VIDEO_MXC_IPU_OUTPUT=y +# CONFIG_VIDEO_MXC_PXP_V4L2 is not set # CONFIG_SOC_CAMERA is not set # CONFIG_V4L_MEM2MEM_DRIVERS is not set # CONFIG_V4L_TEST_DRIVERS is not set @@ -2889,9 +2908,15 @@ CONFIG_DVB_SP2=m # CONFIG_VGA_ARB=y CONFIG_VGA_ARB_MAX_GPUS=16 + +# +# Vivante GPU support +# +CONFIG_VIVANTE_GALCORE=y # CONFIG_DRM is not set # CONFIG_VGASTATE is not set # CONFIG_VIDEO_OUTPUT_CONTROL is not set +CONFIG_VIDEOMODE_HELPERS=y CONFIG_FB=y # CONFIG_FIRMWARE_EDID is not set # CONFIG_FB_DDC is not set @@ -2916,7 +2941,6 @@ CONFIG_FB_MODE_HELPERS=y # # CONFIG_FB_CIRRUS is not set # CONFIG_FB_PM2 is not set -# CONFIG_FB_ARMHDLCD is not set # CONFIG_FB_IMX is not set # CONFIG_FB_CYBER2000 is not set # CONFIG_FB_ASILIANT is not set @@ -2947,20 +2971,39 @@ CONFIG_FB_MODE_HELPERS=y # CONFIG_FB_UDL is not set # CONFIG_FB_GOLDFISH is not set # CONFIG_FB_VIRTUAL is not set +CONFIG_FB_VIRTUAL_PHYMEM=y # CONFIG_FB_METRONOME is not set # CONFIG_FB_MB862XX is not set # CONFIG_FB_MX3 is not set # CONFIG_FB_BROADSHEET is not set # CONFIG_FB_AUO_K190X is not set +# CONFIG_FB_MXS is not set # CONFIG_FB_SIMPLE is not set # CONFIG_EXYNOS_VIDEO is not set -# CONFIG_BACKLIGHT_LCD_SUPPORT is not set +CONFIG_BACKLIGHT_LCD_SUPPORT=y +# CONFIG_LCD_CLASS_DEVICE is not set +CONFIG_BACKLIGHT_CLASS_DEVICE=y +# CONFIG_BACKLIGHT_GENERIC is not set +# CONFIG_BACKLIGHT_PWM is not set +# CONFIG_BACKLIGHT_DA9052 is not set +# CONFIG_BACKLIGHT_ADP8860 is not set +# CONFIG_BACKLIGHT_ADP8870 is not set +# CONFIG_BACKLIGHT_LM3630A is not set +# CONFIG_BACKLIGHT_LM3639 is not set +# CONFIG_BACKLIGHT_LP855X is not set +CONFIG_BACKLIGHT_GPIO=y +# CONFIG_BACKLIGHT_LV5207LP is not set +# CONFIG_BACKLIGHT_BD6107 is not set CONFIG_FB_MXC=y CONFIG_FB_MXC_SYNC_PANEL=y +# CONFIG_FB_MXC_TVOUT_ADV739X is not set CONFIG_FB_MXC_LDB=y # CONFIG_FB_MXC_MIPI_DSI is not set CONFIG_FB_MXC_HDMI=y CONFIG_FB_MXC_EDID=y +# CONFIG_FB_MXC_EINK_PANEL is not set +CONFIG_FB_MXC_DCIC=y +# CONFIG_HANNSTAR_CABC is not set # # Console display driver support @@ -3078,25 +3121,44 @@ CONFIG_SND_SOC_AC97_BUS=y CONFIG_SND_SOC_GENERIC_DMAENGINE_PCM=y # CONFIG_SND_ATMEL_SOC is not set # CONFIG_SND_DESIGNWARE_I2S is not set -CONFIG_SND_SOC_FSL_SSI=m -CONFIG_SND_SOC_FSL_SPDIF=m + +# +# SoC Audio for Freescale CPUs +# + +# +# Common SoC Audio options for Freescale CPUs: +# CONFIG_SND_SOC_FSL_ASRC=y +CONFIG_SND_SOC_FSL_SAI=y +CONFIG_SND_SOC_FSL_SSI=y +CONFIG_SND_SOC_FSL_SPDIF=y +# CONFIG_SND_SOC_FSL_ESAI is not set CONFIG_SND_SOC_FSL_HDMI=y -CONFIG_SND_IMX_SOC=y CONFIG_SND_SOC_IMX_PCM_DMA=y +CONFIG_SND_SOC_IMX_AUDMUX=y +CONFIG_SND_IMX_SOC=y CONFIG_SND_SOC_IMX_HDMI_DMA=y -CONFIG_SND_SOC_IMX_AUDMUX=m + +# +# SoC Audio support for Freescale i.MX boards: +# # CONFIG_SND_SOC_IMX_CS42888 is not set +# CONFIG_SND_SOC_IMX_WM8731 is not set # CONFIG_SND_SOC_IMX_WM8962 is not set -CONFIG_SND_SOC_IMX_SGTL5000=m -CONFIG_SND_SOC_IMX_AC97_VT1613=m -CONFIG_SND_SOC_IMX_SPDIF=m -CONFIG_SND_SOC_IMX_HDMI=y +CONFIG_SND_SOC_IMX_SGTL5000=y +CONFIG_SND_SOC_IMX_AC97_VT1613=y +# CONFIG_SND_SOC_IMX_MQS is not set +CONFIG_SND_SOC_IMX_SPDIF=y # CONFIG_SND_SOC_IMX_MC13783 is not set +CONFIG_SND_SOC_IMX_HDMI=y +# CONFIG_SND_SOC_IMX_SI476X is not set +# CONFIG_SND_SOC_IMX_TDA1997X is not set CONFIG_SND_SOC_I2C_AND_SPI=y +# CONFIG_SND_SOC_CS42XX8_I2C is not set CONFIG_SND_SOC_HDMI_CODEC=y -CONFIG_SND_SOC_SGTL5000=m -CONFIG_SND_SOC_VT1613=m +CONFIG_SND_SOC_SGTL5000=y +CONFIG_SND_SOC_VT1613=y # CONFIG_SND_SIMPLE_CARD is not set # CONFIG_SOUND_PRIME is not set CONFIG_AC97_BUS=y @@ -3209,6 +3271,7 @@ CONFIG_USB_DEFAULT_PERSIST=y # CONFIG_USB_OTG is not set # CONFIG_USB_OTG_WHITELIST is not set # CONFIG_USB_OTG_BLACKLIST_HUB is not set +# CONFIG_USB_OTG_FSM is not set CONFIG_USB_MON=m # CONFIG_USB_WUSB_CBAF is not set @@ -3222,7 +3285,6 @@ CONFIG_USB_EHCI_ROOT_HUB_TT=y CONFIG_USB_EHCI_TT_NEWSCHED=y CONFIG_USB_EHCI_PCI=y # CONFIG_USB_EHCI_MXC is not set -# CONFIG_USB_EHCI_HCD_SYNOPSYS is not set # CONFIG_USB_EHCI_HCD_PLATFORM is not set # CONFIG_USB_OXU210HP_HCD is not set # CONFIG_USB_ISP116X_HCD is not set @@ -3370,7 +3432,6 @@ CONFIG_USB_SERIAL_PL2303=m # USB Physical Layer drivers # CONFIG_USB_PHY=y -# CONFIG_USB_OTG_FSM is not set # CONFIG_NOP_USB_XCEIV is not set # CONFIG_AM335X_PHY_USB is not set # CONFIG_SAMSUNG_USB2PHY is not set @@ -3476,20 +3537,8 @@ CONFIG_MMC_SDHCI_ESDHC_IMX=y # MXC support drivers # CONFIG_MXC_IPU=y - -# -# MXC Vivante GPU support -# -CONFIG_MXC_GPU_VIV=y -# CONFIG_MXC_GPU_VIV_V5 is not set -CONFIG_MXC_GPU_VIV_V4=y CONFIG_MXC_IPU_V3=y -# -# MXC Asynchronous Sample Rate Converter support -# -CONFIG_MXC_ASRC=y - # # MXC VPU(Video Processing Unit) support # @@ -3700,7 +3749,9 @@ CONFIG_W35UND=m # CONFIG_RTL8192U is not set # CONFIG_RTLLIB is not set CONFIG_R8712U=m -# CONFIG_R8188EU is not set +CONFIG_R8188EU=m +CONFIG_88EU_AP_MODE=y +# CONFIG_88EU_P2P is not set # CONFIG_R8821AE is not set CONFIG_RTS5139=m # CONFIG_RTS5139_DEBUG is not set @@ -4187,15 +4238,16 @@ CONFIG_CRYPTO=y # CONFIG_CRYPTO_ALGAPI=y CONFIG_CRYPTO_ALGAPI2=y -CONFIG_CRYPTO_AEAD=m +CONFIG_CRYPTO_AEAD=y CONFIG_CRYPTO_AEAD2=y CONFIG_CRYPTO_BLKCIPHER=y CONFIG_CRYPTO_BLKCIPHER2=y CONFIG_CRYPTO_HASH=y CONFIG_CRYPTO_HASH2=y -CONFIG_CRYPTO_RNG=m +CONFIG_CRYPTO_RNG=y CONFIG_CRYPTO_RNG2=y CONFIG_CRYPTO_PCOMP2=y +# CONFIG_CRYPTO_CRYPTODEV is not set CONFIG_CRYPTO_MANAGER=y CONFIG_CRYPTO_MANAGER2=y # CONFIG_CRYPTO_USER is not set @@ -4205,7 +4257,7 @@ CONFIG_CRYPTO_MANAGER_DISABLE_TESTS=y # CONFIG_CRYPTO_PCRYPT is not set CONFIG_CRYPTO_WORKQUEUE=y # CONFIG_CRYPTO_CRYPTD is not set -# CONFIG_CRYPTO_AUTHENC is not set +CONFIG_CRYPTO_AUTHENC=y # CONFIG_CRYPTO_TEST is not set # @@ -4291,7 +4343,22 @@ CONFIG_CRYPTO_LZO=m # CONFIG_CRYPTO_ANSI_CPRNG is not set # CONFIG_CRYPTO_USER_API_HASH is not set # CONFIG_CRYPTO_USER_API_SKCIPHER is not set -# CONFIG_CRYPTO_HW is not set +CONFIG_CRYPTO_HW=y +# CONFIG_CRYPTO_DEV_HIFN_795X is not set +CONFIG_CRYPTO_DEV_FSL_CAAM=y +CONFIG_CRYPTO_DEV_FSL_CAAM_JR=y +CONFIG_CRYPTO_DEV_FSL_CAAM_RINGSIZE=9 +# CONFIG_CRYPTO_DEV_FSL_CAAM_INTC is not set +CONFIG_CRYPTO_DEV_FSL_CAAM_CRYPTO_API=y +CONFIG_CRYPTO_DEV_FSL_CAAM_AHASH_API=y +CONFIG_CRYPTO_DEV_FSL_CAAM_RNG_API=y +# CONFIG_CRYPTO_DEV_FSL_CAAM_RNG_TEST is not set +CONFIG_CRYPTO_DEV_FSL_CAAM_SM=y +CONFIG_CRYPTO_DEV_FSL_CAAM_SM_SLOTSIZE=7 +# CONFIG_CRYPTO_DEV_FSL_CAAM_SM_TEST is not set +CONFIG_CRYPTO_DEV_FSL_CAAM_SECVIO=y +# CONFIG_CRYPTO_DEV_FSL_CAAM_DEBUG is not set +# CONFIG_CRYPTO_DEV_SAHARA is not set # CONFIG_ASYMMETRIC_KEY_TYPE is not set # CONFIG_BINARY_PRINTF is not set diff --git a/projects/imx6/linux/4.4-xbian/linux.arm.conf b/projects/imx6/linux/4.4-xbian/linux.arm.conf new file mode 100644 index 00000000000..734f48ad9ae --- /dev/null +++ b/projects/imx6/linux/4.4-xbian/linux.arm.conf @@ -0,0 +1,6585 @@ +# +# Automatically generated file; DO NOT EDIT. +# Linux/arm 4.4.6 Kernel Configuration +# +CONFIG_ARM=y +CONFIG_ARM_HAS_SG_CHAIN=y +CONFIG_MIGHT_HAVE_PCI=y +CONFIG_SYS_SUPPORTS_APM_EMULATION=y +CONFIG_HAVE_PROC_CPU=y +CONFIG_STACKTRACE_SUPPORT=y +CONFIG_LOCKDEP_SUPPORT=y +CONFIG_TRACE_IRQFLAGS_SUPPORT=y +CONFIG_RWSEM_XCHGADD_ALGORITHM=y +CONFIG_FIX_EARLYCON_MEM=y +CONFIG_GENERIC_HWEIGHT=y +CONFIG_GENERIC_CALIBRATE_DELAY=y +CONFIG_ZONE_DMA=y +CONFIG_NEED_DMA_MAP_STATE=y +CONFIG_ARCH_SUPPORTS_UPROBES=y +CONFIG_VECTORS_BASE=0xffff0000 +CONFIG_ARM_PATCH_PHYS_VIRT=y +CONFIG_GENERIC_BUG=y +CONFIG_PGTABLE_LEVELS=2 +CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" +CONFIG_IRQ_WORK=y +CONFIG_BUILDTIME_EXTABLE_SORT=y + +# +# General setup +# +CONFIG_INIT_ENV_ARG_LIMIT=32 +CONFIG_CROSS_COMPILE="" +# CONFIG_COMPILE_TEST is not set +CONFIG_LOCALVERSION="" +# CONFIG_LOCALVERSION_AUTO is not set +CONFIG_HAVE_KERNEL_GZIP=y +CONFIG_HAVE_KERNEL_LZMA=y +CONFIG_HAVE_KERNEL_XZ=y +CONFIG_HAVE_KERNEL_LZO=y +CONFIG_HAVE_KERNEL_LZ4=y +CONFIG_KERNEL_GZIP=y +# CONFIG_KERNEL_LZMA is not set +# CONFIG_KERNEL_XZ is not set +# CONFIG_KERNEL_LZO is not set +# CONFIG_KERNEL_LZ4 is not set +CONFIG_DEFAULT_HOSTNAME="@DISTRONAME@" +CONFIG_SWAP=y +CONFIG_SYSVIPC=y +CONFIG_SYSVIPC_SYSCTL=y +CONFIG_POSIX_MQUEUE=y +CONFIG_POSIX_MQUEUE_SYSCTL=y +CONFIG_CROSS_MEMORY_ATTACH=y +CONFIG_FHANDLE=y +# CONFIG_USELIB is not set +# CONFIG_AUDIT is not set +CONFIG_HAVE_ARCH_AUDITSYSCALL=y + +# +# IRQ subsystem +# +CONFIG_GENERIC_IRQ_PROBE=y +CONFIG_GENERIC_IRQ_SHOW=y +CONFIG_GENERIC_IRQ_SHOW_LEVEL=y +CONFIG_HARDIRQS_SW_RESEND=y +CONFIG_GENERIC_IRQ_CHIP=y +CONFIG_IRQ_DOMAIN=y +CONFIG_IRQ_DOMAIN_HIERARCHY=y +CONFIG_GENERIC_MSI_IRQ=y +CONFIG_HANDLE_DOMAIN_IRQ=y +# CONFIG_IRQ_DOMAIN_DEBUG is not set +CONFIG_IRQ_FORCED_THREADING=y +CONFIG_SPARSE_IRQ=y +CONFIG_GENERIC_TIME_VSYSCALL=y +CONFIG_GENERIC_CLOCKEVENTS=y +CONFIG_ARCH_HAS_TICK_BROADCAST=y +CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y + +# +# Timers subsystem +# +CONFIG_TICK_ONESHOT=y +CONFIG_NO_HZ_COMMON=y +# CONFIG_HZ_PERIODIC is not set +CONFIG_NO_HZ_IDLE=y +# CONFIG_NO_HZ_FULL is not set +# CONFIG_NO_HZ is not set +CONFIG_HIGH_RES_TIMERS=y + +# +# CPU/Task time and stats accounting +# +# CONFIG_TICK_CPU_ACCOUNTING is not set +# CONFIG_VIRT_CPU_ACCOUNTING_GEN is not set +CONFIG_IRQ_TIME_ACCOUNTING=y +CONFIG_BSD_PROCESS_ACCT=y +CONFIG_BSD_PROCESS_ACCT_V3=y +# CONFIG_TASKSTATS is not set + +# +# RCU Subsystem +# +CONFIG_PREEMPT_RCU=y +CONFIG_RCU_EXPERT=y +CONFIG_SRCU=y +# CONFIG_TASKS_RCU is not set +CONFIG_RCU_STALL_COMMON=y +CONFIG_RCU_FANOUT=16 +CONFIG_RCU_FANOUT_LEAF=8 +# CONFIG_TREE_RCU_TRACE is not set +CONFIG_RCU_BOOST=y +CONFIG_RCU_KTHREAD_PRIO=1 +CONFIG_RCU_BOOST_DELAY=500 +CONFIG_RCU_NOCB_CPU=y +CONFIG_RCU_NOCB_CPU_NONE=y +# CONFIG_RCU_NOCB_CPU_ZERO is not set +# CONFIG_RCU_NOCB_CPU_ALL is not set +# CONFIG_RCU_EXPEDITE_BOOT is not set +CONFIG_BUILD_BIN2C=y +CONFIG_IKCONFIG=y +CONFIG_IKCONFIG_PROC=y +CONFIG_LOG_BUF_SHIFT=16 +CONFIG_LOG_CPU_MAX_BUF_SHIFT=13 +CONFIG_GENERIC_SCHED_CLOCK=y +CONFIG_CGROUPS=y +# CONFIG_CGROUP_DEBUG is not set +CONFIG_CGROUP_FREEZER=y +CONFIG_CGROUP_PIDS=y +CONFIG_CGROUP_DEVICE=y +CONFIG_CPUSETS=y +CONFIG_PROC_PID_CPUSET=y +CONFIG_CGROUP_CPUACCT=y +# CONFIG_MEMCG is not set +# CONFIG_CGROUP_PERF is not set +CONFIG_CGROUP_SCHED=y +CONFIG_FAIR_GROUP_SCHED=y +CONFIG_CFS_BANDWIDTH=y +CONFIG_BLK_CGROUP=y +# CONFIG_DEBUG_BLK_CGROUP is not set +# CONFIG_CHECKPOINT_RESTORE is not set +CONFIG_NAMESPACES=y +CONFIG_UTS_NS=y +CONFIG_IPC_NS=y +CONFIG_USER_NS=y +CONFIG_PID_NS=y +CONFIG_NET_NS=y +# CONFIG_SCHED_AUTOGROUP is not set +# CONFIG_SYSFS_DEPRECATED is not set +CONFIG_RELAY=y +CONFIG_BLK_DEV_INITRD=y +CONFIG_INITRAMFS_SOURCE="" +CONFIG_INITRAMFS_ROOT_UID=0 +CONFIG_INITRAMFS_ROOT_GID=0 +CONFIG_RD_GZIP=y +# CONFIG_RD_BZIP2 is not set +# CONFIG_RD_LZMA is not set +# CONFIG_RD_XZ is not set +CONFIG_RD_LZO=y +# CONFIG_RD_LZ4 is not set +# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set +CONFIG_SYSCTL=y +CONFIG_ANON_INODES=y +CONFIG_HAVE_UID16=y +CONFIG_BPF=y +CONFIG_EXPERT=y +# CONFIG_UID16 is not set +CONFIG_MULTIUSER=y +# CONFIG_SGETMASK_SYSCALL is not set +CONFIG_SYSFS_SYSCALL=y +CONFIG_SYSCTL_SYSCALL=y +CONFIG_KALLSYMS=y +CONFIG_PRINTK=y +CONFIG_BUG=y +CONFIG_BASE_FULL=y +CONFIG_FUTEX=y +CONFIG_EPOLL=y +CONFIG_SIGNALFD=y +CONFIG_TIMERFD=y +CONFIG_EVENTFD=y +# CONFIG_BPF_SYSCALL is not set +CONFIG_SHMEM=y +CONFIG_AIO=y +# CONFIG_ADVISE_SYSCALLS is not set +CONFIG_USERFAULTFD=y +CONFIG_PCI_QUIRKS=y +CONFIG_MEMBARRIER=y +CONFIG_EMBEDDED=y +CONFIG_HAVE_PERF_EVENTS=y +CONFIG_PERF_USE_VMALLOC=y + +# +# Kernel Performance Events And Counters +# +CONFIG_PERF_EVENTS=y +# CONFIG_VM_EVENT_COUNTERS is not set +# CONFIG_SLUB_DEBUG is not set +# CONFIG_COMPAT_BRK is not set +CONFIG_SLUB=y +# CONFIG_SYSTEM_DATA_VERIFICATION is not set +# CONFIG_PROFILING is not set +CONFIG_TRACEPOINTS=y +CONFIG_KEXEC_CORE=y +CONFIG_HAVE_OPROFILE=y +# CONFIG_KPROBES is not set +# CONFIG_UPROBES is not set +# CONFIG_HAVE_64BIT_ALIGNED_ACCESS is not set +CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y +CONFIG_ARCH_USE_BUILTIN_BSWAP=y +CONFIG_HAVE_KPROBES=y +CONFIG_HAVE_KRETPROBES=y +CONFIG_HAVE_OPTPROBES=y +CONFIG_HAVE_ARCH_TRACEHOOK=y +CONFIG_HAVE_DMA_ATTRS=y +CONFIG_HAVE_DMA_CONTIGUOUS=y +CONFIG_GENERIC_SMP_IDLE_THREAD=y +CONFIG_GENERIC_IDLE_POLL_SETUP=y +CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y +CONFIG_HAVE_CLK=y +CONFIG_HAVE_DMA_API_DEBUG=y +CONFIG_HAVE_HW_BREAKPOINT=y +CONFIG_HAVE_PERF_REGS=y +CONFIG_HAVE_PERF_USER_STACK_DUMP=y +CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y +CONFIG_HAVE_ARCH_SECCOMP_FILTER=y +CONFIG_HAVE_CC_STACKPROTECTOR=y +CONFIG_CC_STACKPROTECTOR=y +# CONFIG_CC_STACKPROTECTOR_NONE is not set +CONFIG_CC_STACKPROTECTOR_REGULAR=y +# CONFIG_CC_STACKPROTECTOR_STRONG is not set +CONFIG_HAVE_CONTEXT_TRACKING=y +CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y +CONFIG_HAVE_IRQ_TIME_ACCOUNTING=y +CONFIG_HAVE_MOD_ARCH_SPECIFIC=y +CONFIG_MODULES_USE_ELF_REL=y +CONFIG_ARCH_HAS_ELF_RANDOMIZE=y +CONFIG_CLONE_BACKWARDS=y +CONFIG_OLD_SIGSUSPEND3=y +CONFIG_OLD_SIGACTION=y + +# +# GCOV-based kernel profiling +# +# CONFIG_GCOV_KERNEL is not set +CONFIG_ARCH_HAS_GCOV_PROFILE_ALL=y +CONFIG_HAVE_GENERIC_DMA_COHERENT=y +CONFIG_RT_MUTEXES=y +CONFIG_BASE_SMALL=0 +CONFIG_MODULES=y +# CONFIG_MODULE_FORCE_LOAD is not set +CONFIG_MODULE_UNLOAD=y +# CONFIG_MODULE_FORCE_UNLOAD is not set +# CONFIG_MODVERSIONS is not set +# CONFIG_MODULE_SRCVERSION_ALL is not set +# CONFIG_MODULE_SIG is not set +# CONFIG_MODULE_COMPRESS is not set +CONFIG_MODULES_TREE_LOOKUP=y +CONFIG_BLOCK=y +CONFIG_LBDAF=y +CONFIG_BLK_DEV_BSG=y +CONFIG_BLK_DEV_BSGLIB=y +CONFIG_BLK_DEV_INTEGRITY=y +# CONFIG_BLK_DEV_THROTTLING is not set +# CONFIG_BLK_CMDLINE_PARSER is not set + +# +# Partition Types +# +CONFIG_PARTITION_ADVANCED=y +# CONFIG_ACORN_PARTITION is not set +# CONFIG_AIX_PARTITION is not set +# CONFIG_OSF_PARTITION is not set +# CONFIG_AMIGA_PARTITION is not set +# CONFIG_ATARI_PARTITION is not set +CONFIG_MAC_PARTITION=y +CONFIG_MSDOS_PARTITION=y +CONFIG_BSD_DISKLABEL=y +CONFIG_MINIX_SUBPARTITION=y +CONFIG_SOLARIS_X86_PARTITION=y +CONFIG_UNIXWARE_DISKLABEL=y +CONFIG_LDM_PARTITION=y +# CONFIG_LDM_DEBUG is not set +# CONFIG_SGI_PARTITION is not set +# CONFIG_ULTRIX_PARTITION is not set +CONFIG_SUN_PARTITION=y +CONFIG_KARMA_PARTITION=y +CONFIG_EFI_PARTITION=y +# CONFIG_SYSV68_PARTITION is not set +# CONFIG_CMDLINE_PARTITION is not set + +# +# IO Schedulers +# +CONFIG_IOSCHED_NOOP=y +CONFIG_IOSCHED_DEADLINE=y +CONFIG_IOSCHED_CFQ=y +# CONFIG_CFQ_GROUP_IOSCHED is not set +CONFIG_IOSCHED_BFQ=y +# CONFIG_CGROUP_BFQIO is not set +# CONFIG_DEFAULT_DEADLINE is not set +# CONFIG_DEFAULT_CFQ is not set +CONFIG_DEFAULT_BFQ=y +# CONFIG_DEFAULT_NOOP is not set +CONFIG_DEFAULT_IOSCHED="bfq" +CONFIG_PADATA=y +CONFIG_ASN1=m +CONFIG_ARCH_SUPPORTS_ATOMIC_RMW=y +CONFIG_FREEZER=y + +# +# System Type +# +CONFIG_MMU=y +CONFIG_ARCH_MULTIPLATFORM=y +# CONFIG_ARCH_REALVIEW is not set +# CONFIG_ARCH_VERSATILE is not set +# CONFIG_ARCH_CLPS711X is not set +# CONFIG_ARCH_GEMINI is not set +# CONFIG_ARCH_EBSA110 is not set +# CONFIG_ARCH_EP93XX is not set +# CONFIG_ARCH_FOOTBRIDGE is not set +# CONFIG_ARCH_NETX is not set +# CONFIG_ARCH_IOP13XX is not set +# CONFIG_ARCH_IOP32X is not set +# CONFIG_ARCH_IOP33X is not set +# CONFIG_ARCH_IXP4XX is not set +# CONFIG_ARCH_DOVE is not set +# CONFIG_ARCH_MV78XX0 is not set +# CONFIG_ARCH_ORION5X is not set +# CONFIG_ARCH_MMP is not set +# CONFIG_ARCH_KS8695 is not set +# CONFIG_ARCH_W90X900 is not set +# CONFIG_ARCH_LPC32XX is not set +# CONFIG_ARCH_PXA is not set +# CONFIG_ARCH_RPC is not set +# CONFIG_ARCH_SA1100 is not set +# CONFIG_ARCH_S3C24XX is not set +# CONFIG_ARCH_S3C64XX is not set +# CONFIG_ARCH_DAVINCI is not set +# CONFIG_ARCH_OMAP1 is not set + +# +# Multiple platform selection +# + +# +# CPU Core family selection +# +# CONFIG_ARCH_MULTI_V6 is not set +CONFIG_ARCH_MULTI_V7=y +CONFIG_ARCH_MULTI_V6_V7=y +# CONFIG_ARCH_MULTI_CPU_AUTO is not set +# CONFIG_ARCH_VIRT is not set +# CONFIG_ARCH_MVEBU is not set +# CONFIG_ARCH_ALPINE is not set +# CONFIG_ARCH_AT91 is not set +# CONFIG_ARCH_BCM is not set +# CONFIG_ARCH_BERLIN is not set +# CONFIG_ARCH_DIGICOLOR is not set +# CONFIG_ARCH_HIGHBANK is not set +# CONFIG_ARCH_HISI is not set +# CONFIG_ARCH_KEYSTONE is not set +# CONFIG_ARCH_MESON is not set +CONFIG_ARCH_MXC=y +CONFIG_HAVE_IMX_ANATOP=y +CONFIG_HAVE_IMX_GPC=y +CONFIG_HAVE_IMX_MMDC=y +CONFIG_HAVE_IMX_SRC=y + +# +# Device tree only +# + +# +# Cortex-A platforms +# +# CONFIG_SOC_IMX50 is not set +# CONFIG_SOC_IMX51 is not set +# CONFIG_SOC_IMX53 is not set +CONFIG_SOC_IMX6=y +CONFIG_SOC_IMX6Q=y +# CONFIG_SOC_IMX6SL is not set +# CONFIG_SOC_IMX6SX is not set +# CONFIG_SOC_IMX6UL is not set +# CONFIG_SOC_IMX7D is not set +# CONFIG_SOC_LS1021A is not set + +# +# Cortex-A/Cortex-M asymmetric multiprocessing platforms +# +# CONFIG_SOC_VF610 is not set +# CONFIG_ARCH_MEDIATEK is not set + +# +# TI OMAP/AM/DM/DRA Family +# +# CONFIG_ARCH_OMAP3 is not set +# CONFIG_ARCH_OMAP4 is not set +# CONFIG_SOC_OMAP5 is not set +# CONFIG_SOC_AM33XX is not set +# CONFIG_SOC_AM43XX is not set +# CONFIG_SOC_DRA7XX is not set +# CONFIG_ARCH_QCOM is not set +# CONFIG_ARCH_ROCKCHIP is not set +# CONFIG_ARCH_SOCFPGA is not set +# CONFIG_PLAT_SPEAR is not set +# CONFIG_ARCH_STI is not set +# CONFIG_ARCH_S5PV210 is not set +# CONFIG_ARCH_EXYNOS is not set +# CONFIG_ARCH_SHMOBILE_MULTI is not set +# CONFIG_ARCH_SUNXI is not set +# CONFIG_ARCH_SIRF is not set +# CONFIG_ARCH_TEGRA is not set +# CONFIG_ARCH_UNIPHIER is not set +# CONFIG_ARCH_U8500 is not set +# CONFIG_ARCH_VEXPRESS is not set +# CONFIG_ARCH_WM8850 is not set +# CONFIG_ARCH_ZX is not set +# CONFIG_ARCH_ZYNQ is not set + +# +# Processor Type +# +CONFIG_CPU_V7=y +CONFIG_CPU_32v6K=y +CONFIG_CPU_32v7=y +CONFIG_CPU_ABRT_EV7=y +CONFIG_CPU_PABRT_V7=y +CONFIG_CPU_CACHE_V7=y +CONFIG_CPU_CACHE_VIPT=y +CONFIG_CPU_COPY_V6=y +CONFIG_CPU_TLB_V7=y +CONFIG_CPU_HAS_ASID=y +CONFIG_CPU_CP15=y +CONFIG_CPU_CP15_MMU=y + +# +# Processor Features +# +# CONFIG_ARM_LPAE is not set +# CONFIG_ARCH_PHYS_ADDR_T_64BIT is not set +CONFIG_ARM_THUMB=y +CONFIG_ARM_THUMBEE=y +CONFIG_ARM_VIRT_EXT=y +CONFIG_SWP_EMULATE=y +# CONFIG_CPU_ICACHE_DISABLE is not set +# CONFIG_CPU_BPREDICT_DISABLE is not set +CONFIG_KUSER_HELPERS=y +CONFIG_VDSO=y +CONFIG_OUTER_CACHE=y +CONFIG_OUTER_CACHE_SYNC=y +CONFIG_MIGHT_HAVE_CACHE_L2X0=y +CONFIG_CACHE_L2X0=y +# CONFIG_PL310_ERRATA_588369 is not set +# CONFIG_PL310_ERRATA_727915 is not set +# CONFIG_PL310_ERRATA_753970 is not set +CONFIG_PL310_ERRATA_769419=y +CONFIG_ARM_L1_CACHE_SHIFT_6=y +CONFIG_ARM_L1_CACHE_SHIFT=6 +CONFIG_ARM_DMA_MEM_BUFFERABLE=y +CONFIG_ARM_HEAVY_MB=y +# CONFIG_ARM_KERNMEM_PERMS is not set +CONFIG_MULTI_IRQ_HANDLER=y +# CONFIG_ARM_ERRATA_430973 is not set +# CONFIG_ARM_ERRATA_643719 is not set +CONFIG_ARM_ERRATA_720789=y +CONFIG_ARM_ERRATA_754322=y +# CONFIG_ARM_ERRATA_754327 is not set +CONFIG_ARM_ERRATA_764369=y +CONFIG_ARM_ERRATA_775420=y +# CONFIG_ARM_ERRATA_798181 is not set +# CONFIG_ARM_ERRATA_773022 is not set + +# +# Bus support +# +CONFIG_PCI=y +CONFIG_PCI_DOMAINS=y +CONFIG_PCI_DOMAINS_GENERIC=y +CONFIG_PCI_SYSCALL=y +CONFIG_PCI_MSI=y +CONFIG_PCI_REALLOC_ENABLE_AUTO=y +CONFIG_PCI_STUB=y +CONFIG_PCI_ATS=y +CONFIG_PCI_IOV=y +CONFIG_PCI_PRI=y +CONFIG_PCI_PASID=y + +# +# PCI host controller drivers +# +CONFIG_PCIE_DW=y +CONFIG_PCI_IMX6=y +# CONFIG_PCI_HOST_GENERIC is not set +# CONFIG_PCI_LAYERSCAPE is not set +# CONFIG_PCIE_IPROC is not set +# CONFIG_PCIE_ALTERA is not set +CONFIG_PCIEPORTBUS=y +CONFIG_PCIEAER=y +CONFIG_PCIE_ECRC=y +# CONFIG_PCIEAER_INJECT is not set +CONFIG_PCIEASPM=y +# CONFIG_PCIEASPM_DEBUG is not set +CONFIG_PCIEASPM_DEFAULT=y +# CONFIG_PCIEASPM_POWERSAVE is not set +# CONFIG_PCIEASPM_PERFORMANCE is not set +CONFIG_PCIE_PME=y +# CONFIG_PCCARD is not set + +# +# Kernel Features +# +CONFIG_HAVE_SMP=y +CONFIG_SMP=y +CONFIG_SMP_ON_UP=y +CONFIG_ARM_CPU_TOPOLOGY=y +CONFIG_SCHED_MC=y +# CONFIG_SCHED_SMT is not set +CONFIG_HAVE_ARM_SCU=y +# CONFIG_HAVE_ARM_ARCH_TIMER is not set +CONFIG_HAVE_ARM_TWD=y +# CONFIG_MCPM is not set +# CONFIG_BIG_LITTLE is not set +# CONFIG_VMSPLIT_3G is not set +# CONFIG_VMSPLIT_3G_OPT is not set +CONFIG_VMSPLIT_2G=y +# CONFIG_VMSPLIT_1G is not set +CONFIG_PAGE_OFFSET=0x80000000 +CONFIG_NR_CPUS=4 +CONFIG_HOTPLUG_CPU=y +# CONFIG_ARM_PSCI is not set +CONFIG_ARCH_NR_GPIO=0 +CONFIG_PREEMPT=y +CONFIG_PREEMPT_RT_BASE=y +CONFIG_HAVE_PREEMPT_LAZY=y +CONFIG_PREEMPT_LAZY=y +# CONFIG_PREEMPT_NONE is not set +# CONFIG_PREEMPT_VOLUNTARY is not set +# CONFIG_PREEMPT__LL is not set +# CONFIG_PREEMPT_RTB is not set +CONFIG_PREEMPT_RT_FULL=y +CONFIG_PREEMPT_COUNT=y +CONFIG_HZ_FIXED=0 +# CONFIG_HZ_100 is not set +# CONFIG_HZ_200 is not set +# CONFIG_HZ_250 is not set +CONFIG_HZ_300=y +# CONFIG_HZ_500 is not set +# CONFIG_HZ_1000 is not set +CONFIG_HZ=300 +CONFIG_SCHED_HRTICK=y +# CONFIG_THUMB2_KERNEL is not set +CONFIG_AEABI=y +# CONFIG_OABI_COMPAT is not set +# CONFIG_ARCH_SPARSEMEM_DEFAULT is not set +# CONFIG_ARCH_SELECT_MEMORY_MODEL is not set +CONFIG_HAVE_ARCH_PFN_VALID=y +CONFIG_HIGHMEM=y +# CONFIG_HIGHPTE is not set +# CONFIG_CPU_SW_DOMAIN_PAN is not set +CONFIG_HW_PERF_EVENTS=y +CONFIG_ARCH_WANT_GENERAL_HUGETLB=y +CONFIG_ARM_MODULE_PLTS=y +CONFIG_FLATMEM=y +CONFIG_FLAT_NODE_MEM_MAP=y +CONFIG_HAVE_MEMBLOCK=y +CONFIG_NO_BOOTMEM=y +CONFIG_MEMORY_ISOLATION=y +# CONFIG_HAVE_BOOTMEM_INFO_NODE is not set +CONFIG_SPLIT_PTLOCK_CPUS=4 +CONFIG_COMPACTION=y +CONFIG_MIGRATION=y +# CONFIG_PHYS_ADDR_T_64BIT is not set +CONFIG_ZONE_DMA_FLAG=1 +CONFIG_BOUNCE=y +# CONFIG_KSM is not set +CONFIG_DEFAULT_MMAP_MIN_ADDR=16384 +# CONFIG_CLEANCACHE is not set +# CONFIG_FRONTSWAP is not set +CONFIG_CMA=y +# CONFIG_CMA_DEBUGFS is not set +CONFIG_CMA_AREAS=7 +# CONFIG_ZPOOL is not set +# CONFIG_ZBUD is not set +# CONFIG_ZSMALLOC is not set +# CONFIG_IDLE_PAGE_TRACKING is not set +CONFIG_FRAME_VECTOR=y +CONFIG_FORCE_MAX_ZONEORDER=14 +CONFIG_ALIGNMENT_TRAP=y +# CONFIG_UACCESS_WITH_MEMCPY is not set +# CONFIG_SECCOMP is not set +CONFIG_SWIOTLB=y +CONFIG_IOMMU_HELPER=y +# CONFIG_XEN is not set + +# +# Boot options +# +CONFIG_USE_OF=y +CONFIG_ATAGS=y +# CONFIG_DEPRECATED_PARAM_STRUCT is not set +CONFIG_ZBOOT_ROM_TEXT=0 +CONFIG_ZBOOT_ROM_BSS=0 +# CONFIG_ARM_APPENDED_DTB is not set +CONFIG_CMDLINE="root=/dev/ram0 rdinit=/init noram usbcore.autosuspend=-1 coherent_pool=2M pci=nomsi" +CONFIG_CMDLINE_FROM_BOOTLOADER=y +# CONFIG_CMDLINE_EXTEND is not set +# CONFIG_CMDLINE_FORCE is not set +CONFIG_KEXEC=y +CONFIG_ATAGS_PROC=y +# CONFIG_CRASH_DUMP is not set +CONFIG_AUTO_ZRELADDR=y + +# +# CPU Power Management +# + +# +# CPU Frequency scaling +# +CONFIG_CPU_FREQ=y +CONFIG_CPU_FREQ_GOV_COMMON=y +CONFIG_CPU_FREQ_STAT=y +CONFIG_CPU_FREQ_STAT_DETAILS=y +CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y +# CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE is not set +# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set +# CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set +# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set +CONFIG_CPU_FREQ_GOV_PERFORMANCE=y +CONFIG_CPU_FREQ_GOV_POWERSAVE=y +CONFIG_CPU_FREQ_GOV_USERSPACE=y +CONFIG_CPU_FREQ_GOV_ONDEMAND=y +CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y + +# +# CPU frequency scaling drivers +# +# CONFIG_CPUFREQ_DT is not set +# CONFIG_ARM_BIG_LITTLE_CPUFREQ is not set +CONFIG_ARM_IMX6Q_CPUFREQ=y +# CONFIG_ARM_KIRKWOOD_CPUFREQ is not set +# CONFIG_QORIQ_CPUFREQ is not set + +# +# CPU Idle +# +CONFIG_CPU_IDLE=y +# CONFIG_CPU_IDLE_GOV_LADDER is not set +CONFIG_CPU_IDLE_GOV_MENU=y +CONFIG_DT_IDLE_STATES=y + +# +# ARM CPU Idle Drivers +# +CONFIG_ARM_CPUIDLE=y +# CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED is not set + +# +# Floating point emulation +# + +# +# At least one emulation must be selected +# +CONFIG_VFP=y +CONFIG_VFPv3=y +CONFIG_NEON=y +CONFIG_KERNEL_MODE_NEON=y + +# +# Userspace binary formats +# +CONFIG_BINFMT_ELF=y +CONFIG_BINFMT_SCRIPT=y +# CONFIG_HAVE_AOUT is not set +CONFIG_BINFMT_MISC=m +# CONFIG_COREDUMP is not set + +# +# Power management options +# +CONFIG_SUSPEND=y +CONFIG_SUSPEND_FREEZER=y +# CONFIG_SUSPEND_SKIP_SYNC is not set +# CONFIG_HIBERNATION is not set +CONFIG_PM_SLEEP=y +CONFIG_PM_SLEEP_SMP=y +# CONFIG_PM_AUTOSLEEP is not set +# CONFIG_PM_WAKELOCKS is not set +CONFIG_PM=y +# CONFIG_PM_DEBUG is not set +# CONFIG_APM_EMULATION is not set +CONFIG_PM_OPP=y +CONFIG_PM_CLK=y +CONFIG_PM_GENERIC_DOMAINS=y +# CONFIG_WQ_POWER_EFFICIENT_DEFAULT is not set +CONFIG_PM_GENERIC_DOMAINS_SLEEP=y +CONFIG_PM_GENERIC_DOMAINS_OF=y +CONFIG_CPU_PM=y +CONFIG_ARCH_SUSPEND_POSSIBLE=y +CONFIG_ARM_CPU_SUSPEND=y +CONFIG_ARCH_HIBERNATION_POSSIBLE=y +CONFIG_NET=y +CONFIG_NET_INGRESS=y + +# +# Networking options +# +CONFIG_PACKET=y +CONFIG_PACKET_DIAG=y +CONFIG_UNIX=y +CONFIG_UNIX_DIAG=y +CONFIG_XFRM=y +CONFIG_XFRM_ALGO=y +CONFIG_XFRM_USER=y +CONFIG_XFRM_SUB_POLICY=y +CONFIG_XFRM_MIGRATE=y +CONFIG_XFRM_STATISTICS=y +CONFIG_XFRM_IPCOMP=m +CONFIG_NET_KEY=y +CONFIG_NET_KEY_MIGRATE=y +CONFIG_INET=y +CONFIG_IP_MULTICAST=y +CONFIG_IP_ADVANCED_ROUTER=y +# CONFIG_IP_FIB_TRIE_STATS is not set +CONFIG_IP_MULTIPLE_TABLES=y +CONFIG_IP_ROUTE_MULTIPATH=y +CONFIG_IP_ROUTE_VERBOSE=y +CONFIG_IP_ROUTE_CLASSID=y +CONFIG_IP_PNP=y +CONFIG_IP_PNP_DHCP=y +CONFIG_IP_PNP_BOOTP=y +# CONFIG_IP_PNP_RARP is not set +CONFIG_NET_IPIP=m +CONFIG_NET_IPGRE_DEMUX=m +CONFIG_NET_IP_TUNNEL=m +CONFIG_NET_IPGRE=m +CONFIG_NET_IPGRE_BROADCAST=y +CONFIG_IP_MROUTE=y +CONFIG_IP_MROUTE_MULTIPLE_TABLES=y +CONFIG_IP_PIMSM_V1=y +CONFIG_IP_PIMSM_V2=y +CONFIG_SYN_COOKIES=y +CONFIG_NET_IPVTI=m +CONFIG_NET_UDP_TUNNEL=m +# CONFIG_NET_FOU is not set +# CONFIG_NET_FOU_IP_TUNNELS is not set +CONFIG_INET_AH=m +CONFIG_INET_ESP=m +CONFIG_INET_IPCOMP=m +CONFIG_INET_XFRM_TUNNEL=m +CONFIG_INET_TUNNEL=m +CONFIG_INET_XFRM_MODE_TRANSPORT=m +CONFIG_INET_XFRM_MODE_TUNNEL=m +CONFIG_INET_XFRM_MODE_BEET=m +CONFIG_INET_LRO=m +CONFIG_INET_DIAG=y +CONFIG_INET_TCP_DIAG=y +CONFIG_INET_UDP_DIAG=m +CONFIG_TCP_CONG_ADVANCED=y +CONFIG_TCP_CONG_BIC=m +CONFIG_TCP_CONG_CUBIC=m +CONFIG_TCP_CONG_WESTWOOD=m +CONFIG_TCP_CONG_HTCP=m +CONFIG_TCP_CONG_HSTCP=m +CONFIG_TCP_CONG_HYBLA=m +CONFIG_TCP_CONG_VEGAS=y +CONFIG_TCP_CONG_SCALABLE=m +CONFIG_TCP_CONG_LP=m +CONFIG_TCP_CONG_VENO=m +CONFIG_TCP_CONG_YEAH=y +CONFIG_TCP_CONG_ILLINOIS=m +CONFIG_TCP_CONG_DCTCP=m +# CONFIG_TCP_CONG_CDG is not set +CONFIG_DEFAULT_VEGAS=y +# CONFIG_DEFAULT_RENO is not set +CONFIG_DEFAULT_TCP_CONG="vegas" +CONFIG_TCP_MD5SIG=y +CONFIG_IPV6=m +CONFIG_IPV6_ROUTER_PREF=y +CONFIG_IPV6_ROUTE_INFO=y +CONFIG_IPV6_OPTIMISTIC_DAD=y +CONFIG_INET6_AH=m +CONFIG_INET6_ESP=m +CONFIG_INET6_IPCOMP=m +CONFIG_IPV6_MIP6=m +CONFIG_IPV6_ILA=m +CONFIG_INET6_XFRM_TUNNEL=m +CONFIG_INET6_TUNNEL=m +CONFIG_INET6_XFRM_MODE_TRANSPORT=m +CONFIG_INET6_XFRM_MODE_TUNNEL=m +CONFIG_INET6_XFRM_MODE_BEET=m +CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION=m +CONFIG_IPV6_VTI=m +CONFIG_IPV6_SIT=m +CONFIG_IPV6_SIT_6RD=y +CONFIG_IPV6_NDISC_NODETYPE=y +CONFIG_IPV6_TUNNEL=m +CONFIG_IPV6_GRE=m +CONFIG_IPV6_MULTIPLE_TABLES=y +CONFIG_IPV6_SUBTREES=y +CONFIG_IPV6_MROUTE=y +CONFIG_IPV6_MROUTE_MULTIPLE_TABLES=y +CONFIG_IPV6_PIMSM_V2=y +# CONFIG_NETWORK_SECMARK is not set +CONFIG_NET_PTP_CLASSIFY=y +# CONFIG_NETWORK_PHY_TIMESTAMPING is not set +CONFIG_NETFILTER=y +# CONFIG_NETFILTER_DEBUG is not set +CONFIG_NETFILTER_ADVANCED=y +CONFIG_BRIDGE_NETFILTER=m + +# +# Core Netfilter Configuration +# +CONFIG_NETFILTER_INGRESS=y +CONFIG_NETFILTER_NETLINK=m +CONFIG_NETFILTER_NETLINK_ACCT=m +CONFIG_NETFILTER_NETLINK_QUEUE=m +CONFIG_NETFILTER_NETLINK_LOG=m +CONFIG_NF_CONNTRACK=m +CONFIG_NF_LOG_COMMON=m +CONFIG_NF_CONNTRACK_MARK=y +CONFIG_NF_CONNTRACK_ZONES=y +CONFIG_NF_CONNTRACK_PROCFS=y +CONFIG_NF_CONNTRACK_EVENTS=y +CONFIG_NF_CONNTRACK_TIMEOUT=y +CONFIG_NF_CONNTRACK_TIMESTAMP=y +CONFIG_NF_CONNTRACK_LABELS=y +CONFIG_NF_CT_PROTO_DCCP=m +CONFIG_NF_CT_PROTO_GRE=m +CONFIG_NF_CT_PROTO_SCTP=m +CONFIG_NF_CT_PROTO_UDPLITE=m +CONFIG_NF_CONNTRACK_AMANDA=m +CONFIG_NF_CONNTRACK_FTP=m +CONFIG_NF_CONNTRACK_H323=m +CONFIG_NF_CONNTRACK_IRC=m +CONFIG_NF_CONNTRACK_BROADCAST=m +CONFIG_NF_CONNTRACK_NETBIOS_NS=m +CONFIG_NF_CONNTRACK_SNMP=m +CONFIG_NF_CONNTRACK_PPTP=m +CONFIG_NF_CONNTRACK_SANE=m +CONFIG_NF_CONNTRACK_SIP=m +CONFIG_NF_CONNTRACK_TFTP=m +CONFIG_NF_CT_NETLINK=m +CONFIG_NF_CT_NETLINK_TIMEOUT=m +# CONFIG_NETFILTER_NETLINK_GLUE_CT is not set +CONFIG_NF_NAT=m +CONFIG_NF_NAT_NEEDED=y +CONFIG_NF_NAT_PROTO_DCCP=m +CONFIG_NF_NAT_PROTO_UDPLITE=m +CONFIG_NF_NAT_PROTO_SCTP=m +CONFIG_NF_NAT_AMANDA=m +CONFIG_NF_NAT_FTP=m +CONFIG_NF_NAT_IRC=m +CONFIG_NF_NAT_SIP=m +CONFIG_NF_NAT_TFTP=m +CONFIG_NF_NAT_REDIRECT=m +CONFIG_NETFILTER_SYNPROXY=m +CONFIG_NF_TABLES=m +CONFIG_NF_TABLES_INET=m +CONFIG_NF_TABLES_NETDEV=m +CONFIG_NFT_EXTHDR=m +CONFIG_NFT_META=m +CONFIG_NFT_CT=m +CONFIG_NFT_RBTREE=m +CONFIG_NFT_HASH=m +CONFIG_NFT_COUNTER=m +CONFIG_NFT_LOG=m +CONFIG_NFT_LIMIT=m +CONFIG_NFT_MASQ=m +CONFIG_NFT_REDIR=m +CONFIG_NFT_NAT=m +CONFIG_NFT_QUEUE=m +CONFIG_NFT_REJECT=m +CONFIG_NFT_REJECT_INET=m +CONFIG_NFT_COMPAT=m +CONFIG_NETFILTER_XTABLES=m + +# +# Xtables combined modules +# +CONFIG_NETFILTER_XT_MARK=m +CONFIG_NETFILTER_XT_CONNMARK=m +CONFIG_NETFILTER_XT_SET=m + +# +# Xtables targets +# +CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m +CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m +CONFIG_NETFILTER_XT_TARGET_CONNMARK=m +CONFIG_NETFILTER_XT_TARGET_CT=m +CONFIG_NETFILTER_XT_TARGET_DSCP=m +CONFIG_NETFILTER_XT_TARGET_HL=m +CONFIG_NETFILTER_XT_TARGET_HMARK=m +CONFIG_NETFILTER_XT_TARGET_IDLETIMER=m +CONFIG_NETFILTER_XT_TARGET_LED=m +CONFIG_NETFILTER_XT_TARGET_LOG=m +CONFIG_NETFILTER_XT_TARGET_MARK=m +CONFIG_NETFILTER_XT_NAT=m +CONFIG_NETFILTER_XT_TARGET_NETMAP=m +CONFIG_NETFILTER_XT_TARGET_NFLOG=m +CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m +CONFIG_NETFILTER_XT_TARGET_NOTRACK=m +CONFIG_NETFILTER_XT_TARGET_RATEEST=m +CONFIG_NETFILTER_XT_TARGET_REDIRECT=m +CONFIG_NETFILTER_XT_TARGET_TEE=m +CONFIG_NETFILTER_XT_TARGET_TPROXY=m +CONFIG_NETFILTER_XT_TARGET_TRACE=m +CONFIG_NETFILTER_XT_TARGET_TCPMSS=m +CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP=m + +# +# Xtables matches +# +CONFIG_NETFILTER_XT_MATCH_ADDRTYPE=m +CONFIG_NETFILTER_XT_MATCH_BPF=m +CONFIG_NETFILTER_XT_MATCH_CGROUP=m +CONFIG_NETFILTER_XT_MATCH_CLUSTER=m +CONFIG_NETFILTER_XT_MATCH_COMMENT=m +CONFIG_NETFILTER_XT_MATCH_CONNBYTES=m +CONFIG_NETFILTER_XT_MATCH_CONNLABEL=m +CONFIG_NETFILTER_XT_MATCH_CONNLIMIT=m +CONFIG_NETFILTER_XT_MATCH_CONNMARK=m +CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m +CONFIG_NETFILTER_XT_MATCH_CPU=m +CONFIG_NETFILTER_XT_MATCH_DCCP=m +CONFIG_NETFILTER_XT_MATCH_DEVGROUP=m +CONFIG_NETFILTER_XT_MATCH_DSCP=m +CONFIG_NETFILTER_XT_MATCH_ECN=m +CONFIG_NETFILTER_XT_MATCH_ESP=m +CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=m +CONFIG_NETFILTER_XT_MATCH_HELPER=m +CONFIG_NETFILTER_XT_MATCH_HL=m +CONFIG_NETFILTER_XT_MATCH_IPCOMP=m +CONFIG_NETFILTER_XT_MATCH_IPRANGE=m +CONFIG_NETFILTER_XT_MATCH_IPVS=m +CONFIG_NETFILTER_XT_MATCH_L2TP=m +CONFIG_NETFILTER_XT_MATCH_LENGTH=m +CONFIG_NETFILTER_XT_MATCH_LIMIT=m +CONFIG_NETFILTER_XT_MATCH_MAC=m +CONFIG_NETFILTER_XT_MATCH_MARK=m +CONFIG_NETFILTER_XT_MATCH_MULTIPORT=m +CONFIG_NETFILTER_XT_MATCH_NFACCT=m +CONFIG_NETFILTER_XT_MATCH_OSF=m +CONFIG_NETFILTER_XT_MATCH_OWNER=m +CONFIG_NETFILTER_XT_MATCH_POLICY=m +CONFIG_NETFILTER_XT_MATCH_PHYSDEV=m +CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m +CONFIG_NETFILTER_XT_MATCH_QUOTA=m +CONFIG_NETFILTER_XT_MATCH_RATEEST=m +CONFIG_NETFILTER_XT_MATCH_REALM=m +CONFIG_NETFILTER_XT_MATCH_RECENT=m +CONFIG_NETFILTER_XT_MATCH_SCTP=m +CONFIG_NETFILTER_XT_MATCH_SOCKET=m +CONFIG_NETFILTER_XT_MATCH_STATE=m +CONFIG_NETFILTER_XT_MATCH_STATISTIC=m +CONFIG_NETFILTER_XT_MATCH_STRING=m +CONFIG_NETFILTER_XT_MATCH_TCPMSS=m +CONFIG_NETFILTER_XT_MATCH_TIME=m +CONFIG_NETFILTER_XT_MATCH_U32=m +CONFIG_IP_SET=m +CONFIG_IP_SET_MAX=256 +CONFIG_IP_SET_BITMAP_IP=m +CONFIG_IP_SET_BITMAP_IPMAC=m +CONFIG_IP_SET_BITMAP_PORT=m +CONFIG_IP_SET_HASH_IP=m +CONFIG_IP_SET_HASH_IPMARK=m +CONFIG_IP_SET_HASH_IPPORT=m +CONFIG_IP_SET_HASH_IPPORTIP=m +CONFIG_IP_SET_HASH_IPPORTNET=m +CONFIG_IP_SET_HASH_MAC=m +CONFIG_IP_SET_HASH_NETPORTNET=m +CONFIG_IP_SET_HASH_NET=m +CONFIG_IP_SET_HASH_NETNET=m +CONFIG_IP_SET_HASH_NETPORT=m +CONFIG_IP_SET_HASH_NETIFACE=m +CONFIG_IP_SET_LIST_SET=m +CONFIG_IP_VS=m +CONFIG_IP_VS_IPV6=y +# CONFIG_IP_VS_DEBUG is not set +CONFIG_IP_VS_TAB_BITS=12 + +# +# IPVS transport protocol load balancing support +# +CONFIG_IP_VS_PROTO_TCP=y +CONFIG_IP_VS_PROTO_UDP=y +CONFIG_IP_VS_PROTO_AH_ESP=y +CONFIG_IP_VS_PROTO_ESP=y +CONFIG_IP_VS_PROTO_AH=y +CONFIG_IP_VS_PROTO_SCTP=y + +# +# IPVS scheduler +# +CONFIG_IP_VS_RR=m +CONFIG_IP_VS_WRR=m +CONFIG_IP_VS_LC=m +CONFIG_IP_VS_WLC=m +CONFIG_IP_VS_FO=m +CONFIG_IP_VS_OVF=m +CONFIG_IP_VS_LBLC=m +CONFIG_IP_VS_LBLCR=m +CONFIG_IP_VS_DH=m +CONFIG_IP_VS_SH=m +CONFIG_IP_VS_SED=m +CONFIG_IP_VS_NQ=m + +# +# IPVS SH scheduler +# +CONFIG_IP_VS_SH_TAB_BITS=8 + +# +# IPVS application helper +# +CONFIG_IP_VS_FTP=m +CONFIG_IP_VS_NFCT=y +CONFIG_IP_VS_PE_SIP=m + +# +# IP: Netfilter Configuration +# +CONFIG_NF_DEFRAG_IPV4=m +CONFIG_NF_CONNTRACK_IPV4=m +CONFIG_NF_CONNTRACK_PROC_COMPAT=y +CONFIG_NF_TABLES_IPV4=m +CONFIG_NFT_CHAIN_ROUTE_IPV4=m +CONFIG_NFT_REJECT_IPV4=m +CONFIG_NFT_DUP_IPV4=m +CONFIG_NF_TABLES_ARP=m +CONFIG_NF_DUP_IPV4=m +CONFIG_NF_LOG_ARP=m +CONFIG_NF_LOG_IPV4=m +CONFIG_NF_REJECT_IPV4=m +CONFIG_NF_NAT_IPV4=m +CONFIG_NFT_CHAIN_NAT_IPV4=m +CONFIG_NF_NAT_MASQUERADE_IPV4=m +CONFIG_NFT_MASQ_IPV4=m +CONFIG_NFT_REDIR_IPV4=m +CONFIG_NF_NAT_SNMP_BASIC=m +CONFIG_NF_NAT_PROTO_GRE=m +CONFIG_NF_NAT_PPTP=m +CONFIG_NF_NAT_H323=m +CONFIG_IP_NF_IPTABLES=m +CONFIG_IP_NF_MATCH_AH=m +CONFIG_IP_NF_MATCH_ECN=m +CONFIG_IP_NF_MATCH_RPFILTER=m +CONFIG_IP_NF_MATCH_TTL=m +CONFIG_IP_NF_FILTER=m +CONFIG_IP_NF_TARGET_REJECT=m +CONFIG_IP_NF_TARGET_SYNPROXY=m +CONFIG_IP_NF_NAT=m +CONFIG_IP_NF_TARGET_MASQUERADE=m +CONFIG_IP_NF_TARGET_NETMAP=m +CONFIG_IP_NF_TARGET_REDIRECT=m +CONFIG_IP_NF_MANGLE=m +CONFIG_IP_NF_TARGET_CLUSTERIP=m +CONFIG_IP_NF_TARGET_ECN=m +CONFIG_IP_NF_TARGET_TTL=m +CONFIG_IP_NF_RAW=m +CONFIG_IP_NF_ARPTABLES=m +CONFIG_IP_NF_ARPFILTER=m +CONFIG_IP_NF_ARP_MANGLE=m + +# +# IPv6: Netfilter Configuration +# +CONFIG_NF_DEFRAG_IPV6=m +CONFIG_NF_CONNTRACK_IPV6=m +CONFIG_NF_TABLES_IPV6=m +CONFIG_NFT_CHAIN_ROUTE_IPV6=m +CONFIG_NFT_REJECT_IPV6=m +CONFIG_NFT_DUP_IPV6=m +CONFIG_NF_DUP_IPV6=m +CONFIG_NF_REJECT_IPV6=m +CONFIG_NF_LOG_IPV6=m +CONFIG_NF_NAT_IPV6=m +CONFIG_NFT_CHAIN_NAT_IPV6=m +CONFIG_NF_NAT_MASQUERADE_IPV6=m +CONFIG_NFT_MASQ_IPV6=m +CONFIG_NFT_REDIR_IPV6=m +CONFIG_IP6_NF_IPTABLES=m +CONFIG_IP6_NF_MATCH_AH=m +CONFIG_IP6_NF_MATCH_EUI64=m +CONFIG_IP6_NF_MATCH_FRAG=m +CONFIG_IP6_NF_MATCH_OPTS=m +CONFIG_IP6_NF_MATCH_HL=m +CONFIG_IP6_NF_MATCH_IPV6HEADER=m +CONFIG_IP6_NF_MATCH_MH=m +CONFIG_IP6_NF_MATCH_RPFILTER=m +CONFIG_IP6_NF_MATCH_RT=m +CONFIG_IP6_NF_TARGET_HL=m +CONFIG_IP6_NF_FILTER=m +CONFIG_IP6_NF_TARGET_REJECT=m +CONFIG_IP6_NF_TARGET_SYNPROXY=m +CONFIG_IP6_NF_MANGLE=m +CONFIG_IP6_NF_RAW=m +CONFIG_IP6_NF_NAT=m +CONFIG_IP6_NF_TARGET_MASQUERADE=m +CONFIG_IP6_NF_TARGET_NPT=m +CONFIG_NF_TABLES_BRIDGE=m +CONFIG_NFT_BRIDGE_META=m +CONFIG_NFT_BRIDGE_REJECT=m +CONFIG_NF_LOG_BRIDGE=m +CONFIG_BRIDGE_NF_EBTABLES=m +CONFIG_BRIDGE_EBT_BROUTE=m +CONFIG_BRIDGE_EBT_T_FILTER=m +CONFIG_BRIDGE_EBT_T_NAT=m +CONFIG_BRIDGE_EBT_802_3=m +CONFIG_BRIDGE_EBT_AMONG=m +CONFIG_BRIDGE_EBT_ARP=m +CONFIG_BRIDGE_EBT_IP=m +CONFIG_BRIDGE_EBT_IP6=m +CONFIG_BRIDGE_EBT_LIMIT=m +CONFIG_BRIDGE_EBT_MARK=m +CONFIG_BRIDGE_EBT_PKTTYPE=m +CONFIG_BRIDGE_EBT_STP=m +CONFIG_BRIDGE_EBT_VLAN=m +CONFIG_BRIDGE_EBT_ARPREPLY=m +CONFIG_BRIDGE_EBT_DNAT=m +CONFIG_BRIDGE_EBT_MARK_T=m +CONFIG_BRIDGE_EBT_REDIRECT=m +CONFIG_BRIDGE_EBT_SNAT=m +CONFIG_BRIDGE_EBT_LOG=m +CONFIG_BRIDGE_EBT_NFLOG=m +CONFIG_IP_DCCP=m +CONFIG_INET_DCCP_DIAG=m + +# +# DCCP CCIDs Configuration +# +# CONFIG_IP_DCCP_CCID2_DEBUG is not set +CONFIG_IP_DCCP_CCID3=y +# CONFIG_IP_DCCP_CCID3_DEBUG is not set +CONFIG_IP_DCCP_TFRC_LIB=y +CONFIG_IP_SCTP=m +# CONFIG_SCTP_DBG_OBJCNT is not set +CONFIG_SCTP_DEFAULT_COOKIE_HMAC_MD5=y +# CONFIG_SCTP_DEFAULT_COOKIE_HMAC_SHA1 is not set +# CONFIG_SCTP_DEFAULT_COOKIE_HMAC_NONE is not set +CONFIG_SCTP_COOKIE_HMAC_MD5=y +CONFIG_SCTP_COOKIE_HMAC_SHA1=y +CONFIG_RDS=m +# CONFIG_RDS_TCP is not set +# CONFIG_RDS_DEBUG is not set +CONFIG_TIPC=m +CONFIG_TIPC_MEDIA_UDP=y +# CONFIG_ATM is not set +CONFIG_L2TP=m +# CONFIG_L2TP_DEBUGFS is not set +CONFIG_L2TP_V3=y +CONFIG_L2TP_IP=m +CONFIG_L2TP_ETH=m +CONFIG_STP=m +CONFIG_BRIDGE=m +CONFIG_BRIDGE_IGMP_SNOOPING=y +CONFIG_BRIDGE_VLAN_FILTERING=y +CONFIG_HAVE_NET_DSA=y +CONFIG_NET_DSA=y +CONFIG_NET_DSA_HWMON=y +CONFIG_NET_DSA_TAG_EDSA=y +CONFIG_VLAN_8021Q=m +# CONFIG_VLAN_8021Q_GVRP is not set +# CONFIG_VLAN_8021Q_MVRP is not set +# CONFIG_DECNET is not set +CONFIG_LLC=m +CONFIG_LLC2=m +# CONFIG_IPX is not set +CONFIG_ATALK=m +CONFIG_DEV_APPLETALK=m +CONFIG_IPDDP=m +CONFIG_IPDDP_ENCAP=y +# CONFIG_X25 is not set +# CONFIG_LAPB is not set +# CONFIG_PHONET is not set +# CONFIG_6LOWPAN is not set +# CONFIG_IEEE802154 is not set +CONFIG_NET_SCHED=y + +# +# Queueing/Scheduling +# +CONFIG_NET_SCH_CBQ=y +CONFIG_NET_SCH_HTB=y +CONFIG_NET_SCH_HFSC=m +CONFIG_NET_SCH_PRIO=y +CONFIG_NET_SCH_MULTIQ=m +CONFIG_NET_SCH_RED=m +CONFIG_NET_SCH_SFB=m +CONFIG_NET_SCH_SFQ=y +CONFIG_NET_SCH_TEQL=m +CONFIG_NET_SCH_TBF=m +CONFIG_NET_SCH_GRED=m +CONFIG_NET_SCH_DSMARK=m +CONFIG_NET_SCH_NETEM=m +CONFIG_NET_SCH_DRR=m +CONFIG_NET_SCH_MQPRIO=m +CONFIG_NET_SCH_CHOKE=m +CONFIG_NET_SCH_QFQ=y +CONFIG_NET_SCH_CODEL=m +CONFIG_NET_SCH_FQ_CODEL=m +CONFIG_NET_SCH_FQ=m +CONFIG_NET_SCH_HHF=m +CONFIG_NET_SCH_PIE=m +CONFIG_NET_SCH_INGRESS=m +CONFIG_NET_SCH_PLUG=m + +# +# Classification +# +CONFIG_NET_CLS=y +CONFIG_NET_CLS_BASIC=m +CONFIG_NET_CLS_TCINDEX=m +CONFIG_NET_CLS_ROUTE4=m +CONFIG_NET_CLS_FW=m +CONFIG_NET_CLS_U32=m +CONFIG_CLS_U32_PERF=y +CONFIG_CLS_U32_MARK=y +CONFIG_NET_CLS_RSVP=m +CONFIG_NET_CLS_RSVP6=m +CONFIG_NET_CLS_FLOW=m +CONFIG_NET_CLS_CGROUP=m +CONFIG_NET_CLS_BPF=m +CONFIG_NET_CLS_FLOWER=m +CONFIG_NET_EMATCH=y +CONFIG_NET_EMATCH_STACK=32 +CONFIG_NET_EMATCH_CMP=m +CONFIG_NET_EMATCH_NBYTE=m +CONFIG_NET_EMATCH_U32=m +CONFIG_NET_EMATCH_META=m +CONFIG_NET_EMATCH_TEXT=m +CONFIG_NET_EMATCH_CANID=m +CONFIG_NET_EMATCH_IPSET=m +CONFIG_NET_CLS_ACT=y +CONFIG_NET_ACT_POLICE=m +CONFIG_NET_ACT_GACT=m +CONFIG_GACT_PROB=y +CONFIG_NET_ACT_MIRRED=m +CONFIG_NET_ACT_IPT=m +CONFIG_NET_ACT_NAT=m +CONFIG_NET_ACT_PEDIT=m +CONFIG_NET_ACT_SIMP=m +CONFIG_NET_ACT_SKBEDIT=m +CONFIG_NET_ACT_CSUM=m +CONFIG_NET_ACT_VLAN=m +CONFIG_NET_ACT_BPF=m +CONFIG_NET_ACT_CONNMARK=m +CONFIG_NET_CLS_IND=y +CONFIG_NET_SCH_FIFO=y +# CONFIG_DCB is not set +CONFIG_DNS_RESOLVER=y +# CONFIG_BATMAN_ADV is not set +CONFIG_OPENVSWITCH=m +CONFIG_OPENVSWITCH_GRE=m +CONFIG_OPENVSWITCH_VXLAN=m +CONFIG_VSOCKETS=m +CONFIG_NETLINK_MMAP=y +CONFIG_NETLINK_DIAG=m +CONFIG_MPLS=y +CONFIG_NET_MPLS_GSO=m +# CONFIG_MPLS_ROUTING is not set +# CONFIG_HSR is not set +CONFIG_NET_SWITCHDEV=y +# CONFIG_NET_L3_MASTER_DEV is not set +CONFIG_RPS=y +CONFIG_RFS_ACCEL=y +CONFIG_XPS=y +CONFIG_CGROUP_NET_PRIO=y +CONFIG_CGROUP_NET_CLASSID=y +CONFIG_NET_RX_BUSY_POLL=y +CONFIG_BQL=y +# CONFIG_BPF_JIT is not set +CONFIG_NET_FLOW_LIMIT=y + +# +# Network testing +# +# CONFIG_NET_PKTGEN is not set +# CONFIG_NET_DROP_MONITOR is not set +# CONFIG_HAMRADIO is not set +CONFIG_CAN=m +CONFIG_CAN_RAW=m +CONFIG_CAN_BCM=m +CONFIG_CAN_GW=m + +# +# CAN Device Drivers +# +# CONFIG_CAN_VCAN is not set +# CONFIG_CAN_SLCAN is not set +CONFIG_CAN_DEV=m +CONFIG_CAN_CALC_BITTIMING=y +# CONFIG_CAN_LEDS is not set +# CONFIG_CAN_TI_HECC is not set +CONFIG_CAN_FLEXCAN=m +# CONFIG_CAN_GRCAN is not set +# CONFIG_CAN_RCAR is not set +# CONFIG_CAN_SJA1000 is not set +# CONFIG_CAN_C_CAN is not set +# CONFIG_CAN_M_CAN is not set +# CONFIG_CAN_CC770 is not set + +# +# CAN SPI interfaces +# +# CONFIG_CAN_MCP251X is not set + +# +# CAN USB interfaces +# +CONFIG_CAN_EMS_USB=m +CONFIG_CAN_ESD_USB2=m +CONFIG_CAN_GS_USB=m +CONFIG_CAN_KVASER_USB=m +CONFIG_CAN_PEAK_USB=m +CONFIG_CAN_8DEV_USB=m +# CONFIG_CAN_SOFTING is not set +# CONFIG_CAN_DEBUG_DEVICES is not set +CONFIG_IRDA=m + +# +# IrDA protocols +# +CONFIG_IRLAN=m +CONFIG_IRNET=m +CONFIG_IRCOMM=m +CONFIG_IRDA_ULTRA=y + +# +# IrDA options +# +# CONFIG_IRDA_CACHE_LAST_LSAP is not set +CONFIG_IRDA_FAST_RR=y +# CONFIG_IRDA_DEBUG is not set + +# +# Infrared-port device drivers +# + +# +# SIR device drivers +# +CONFIG_IRTTY_SIR=m + +# +# Dongle support +# +CONFIG_DONGLE=y +CONFIG_ESI_DONGLE=m +CONFIG_ACTISYS_DONGLE=m +CONFIG_TEKRAM_DONGLE=m +CONFIG_TOIM3232_DONGLE=m +CONFIG_LITELINK_DONGLE=m +CONFIG_MA600_DONGLE=m +CONFIG_GIRBIL_DONGLE=m +CONFIG_MCP2120_DONGLE=m +CONFIG_OLD_BELKIN_DONGLE=m +CONFIG_ACT200L_DONGLE=m +CONFIG_KINGSUN_DONGLE=m +CONFIG_KSDAZZLE_DONGLE=m +CONFIG_KS959_DONGLE=m + +# +# FIR device drivers +# +CONFIG_USB_IRDA=m +CONFIG_SIGMATEL_FIR=m +CONFIG_VLSI_FIR=m +CONFIG_MCS_FIR=m +CONFIG_BT=y +CONFIG_BT_BREDR=y +CONFIG_BT_RFCOMM=m +CONFIG_BT_RFCOMM_TTY=y +CONFIG_BT_BNEP=m +CONFIG_BT_BNEP_MC_FILTER=y +CONFIG_BT_BNEP_PROTO_FILTER=y +CONFIG_BT_CMTP=m +CONFIG_BT_HIDP=y +CONFIG_BT_HS=y +CONFIG_BT_LE=y +# CONFIG_BT_DEBUGFS is not set + +# +# Bluetooth device drivers +# +CONFIG_BT_INTEL=y +CONFIG_BT_BCM=y +CONFIG_BT_RTL=m +CONFIG_BT_QCA=y +CONFIG_BT_HCIBTUSB=m +CONFIG_BT_HCIBTUSB_BCM=y +CONFIG_BT_HCIBTUSB_RTL=y +# CONFIG_BT_HCIBTSDIO is not set +CONFIG_BT_HCIUART=y +CONFIG_BT_HCIUART_H4=y +CONFIG_BT_HCIUART_BCSP=y +CONFIG_BT_HCIUART_ATH3K=y +CONFIG_BT_HCIUART_LL=y +CONFIG_BT_HCIUART_3WIRE=y +CONFIG_BT_HCIUART_INTEL=y +CONFIG_BT_HCIUART_BCM=y +CONFIG_BT_HCIUART_QCA=y +CONFIG_BT_HCIBCM203X=m +CONFIG_BT_HCIBPA10X=m +CONFIG_BT_HCIBFUSB=m +CONFIG_BT_HCIVHCI=m +CONFIG_BT_MRVL=m +CONFIG_BT_MRVL_SDIO=m +CONFIG_BT_ATH3K=m +CONFIG_BT_WILINK=m +CONFIG_AF_RXRPC=m +# CONFIG_AF_RXRPC_DEBUG is not set +# CONFIG_RXKAD is not set +CONFIG_FIB_RULES=y +CONFIG_WIRELESS=y +CONFIG_WIRELESS_EXT=y +CONFIG_WEXT_CORE=y +CONFIG_WEXT_PROC=y +CONFIG_WEXT_SPY=y +CONFIG_WEXT_PRIV=y +CONFIG_CFG80211=m +# CONFIG_NL80211_TESTMODE is not set +# CONFIG_CFG80211_DEVELOPER_WARNINGS is not set +# CONFIG_CFG80211_REG_DEBUG is not set +CONFIG_CFG80211_CERTIFICATION_ONUS=y +# CONFIG_CFG80211_REG_CELLULAR_HINTS is not set +# CONFIG_CFG80211_REG_RELAX_NO_IR is not set +# CONFIG_CFG80211_DEFAULT_PS is not set +# CONFIG_CFG80211_DEBUGFS is not set +# CONFIG_CFG80211_INTERNAL_REGDB is not set +CONFIG_CFG80211_CRDA_SUPPORT=y +CONFIG_CFG80211_WEXT=y +CONFIG_CFG80211_WEXT_EXPORT=y +CONFIG_LIB80211=m +CONFIG_LIB80211_CRYPT_WEP=m +CONFIG_LIB80211_CRYPT_CCMP=m +CONFIG_LIB80211_CRYPT_TKIP=m +# CONFIG_LIB80211_DEBUG is not set +CONFIG_MAC80211=m +CONFIG_MAC80211_HAS_RC=y +CONFIG_MAC80211_RC_MINSTREL=y +CONFIG_MAC80211_RC_MINSTREL_HT=y +CONFIG_MAC80211_RC_MINSTREL_VHT=y +CONFIG_MAC80211_RC_DEFAULT_MINSTREL=y +CONFIG_MAC80211_RC_DEFAULT="minstrel_ht" +# CONFIG_MAC80211_MESH is not set +CONFIG_MAC80211_LEDS=y +# CONFIG_MAC80211_DEBUGFS is not set +# CONFIG_MAC80211_MESSAGE_TRACING is not set +# CONFIG_MAC80211_DEBUG_MENU is not set +CONFIG_MAC80211_STA_HASH_MAX_SIZE=0 +# CONFIG_WIMAX is not set +CONFIG_RFKILL=y +CONFIG_RFKILL_LEDS=y +CONFIG_RFKILL_INPUT=y +CONFIG_RFKILL_REGULATOR=y +CONFIG_RFKILL_GPIO=y +# CONFIG_NET_9P is not set +CONFIG_CAIF=m +# CONFIG_CAIF_DEBUG is not set +CONFIG_CAIF_NETDEV=m +CONFIG_CAIF_USB=m +CONFIG_CEPH_LIB=m +# CONFIG_CEPH_LIB_PRETTYDEBUG is not set +CONFIG_CEPH_LIB_USE_DNS_RESOLVER=y +CONFIG_NFC=m +# CONFIG_NFC_DIGITAL is not set +# CONFIG_NFC_NCI is not set +# CONFIG_NFC_HCI is not set + +# +# Near Field Communication (NFC) devices +# +# CONFIG_NFC_PN533 is not set +# CONFIG_NFC_SIM is not set +CONFIG_LWTUNNEL=y +CONFIG_HAVE_BPF_JIT=y + +# +# Device Drivers +# + +# +# Generic Driver Options +# +CONFIG_UEVENT_HELPER=y +CONFIG_UEVENT_HELPER_PATH="" +CONFIG_DEVTMPFS=y +CONFIG_DEVTMPFS_MOUNT=y +# CONFIG_STANDALONE is not set +# CONFIG_PREVENT_FIRMWARE_BUILD is not set +CONFIG_FW_LOADER=y +CONFIG_FIRMWARE_IN_KERNEL=y +CONFIG_EXTRA_FIRMWARE="" +CONFIG_FW_LOADER_USER_HELPER=y +CONFIG_FW_LOADER_USER_HELPER_FALLBACK=y +CONFIG_WANT_DEV_COREDUMP=y +CONFIG_ALLOW_DEV_COREDUMP=y +CONFIG_DEV_COREDUMP=y +# CONFIG_SYS_HYPERVISOR is not set +# CONFIG_GENERIC_CPU_DEVICES is not set +CONFIG_SOC_BUS=y +CONFIG_REGMAP=y +CONFIG_REGMAP_AC97=y +CONFIG_REGMAP_I2C=y +CONFIG_REGMAP_SPI=y +CONFIG_REGMAP_MMIO=y +CONFIG_REGMAP_IRQ=y +CONFIG_DMA_SHARED_BUFFER=y +# CONFIG_FENCE_TRACE is not set +CONFIG_DMA_CMA=y + +# +# Default contiguous memory area size: +# +CONFIG_CMA_SIZE_MBYTES=288 +CONFIG_CMA_SIZE_SEL_MBYTES=y +# CONFIG_CMA_SIZE_SEL_PERCENTAGE is not set +# CONFIG_CMA_SIZE_SEL_MIN is not set +# CONFIG_CMA_SIZE_SEL_MAX is not set +CONFIG_CMA_ALIGNMENT=8 + +# +# Bus devices +# +# CONFIG_ARM_CCI400_PMU is not set +# CONFIG_ARM_CCI500_PMU is not set +# CONFIG_ARM_CCN is not set +# CONFIG_BRCMSTB_GISB_ARB is not set +CONFIG_IMX_WEIM=y +# CONFIG_VEXPRESS_CONFIG is not set +CONFIG_CONNECTOR=y +CONFIG_PROC_EVENTS=y +CONFIG_MTD=y +# CONFIG_MTD_TESTS is not set +# CONFIG_MTD_REDBOOT_PARTS is not set +CONFIG_MTD_CMDLINE_PARTS=y +# CONFIG_MTD_AFS_PARTS is not set +CONFIG_MTD_OF_PARTS=y +# CONFIG_MTD_AR7_PARTS is not set + +# +# User Modules And Translation Layers +# +CONFIG_MTD_BLKDEVS=y +CONFIG_MTD_BLOCK=y +# CONFIG_FTL is not set +# CONFIG_NFTL is not set +# CONFIG_INFTL is not set +# CONFIG_RFD_FTL is not set +# CONFIG_SSFDC is not set +# CONFIG_SM_FTL is not set +# CONFIG_MTD_OOPS is not set +# CONFIG_MTD_SWAP is not set +# CONFIG_MTD_PARTITIONED_MASTER is not set + +# +# RAM/ROM/Flash chip drivers +# +CONFIG_MTD_CFI=y +CONFIG_MTD_JEDECPROBE=y +CONFIG_MTD_GEN_PROBE=y +# CONFIG_MTD_CFI_ADV_OPTIONS is not set +CONFIG_MTD_MAP_BANK_WIDTH_1=y +CONFIG_MTD_MAP_BANK_WIDTH_2=y +CONFIG_MTD_MAP_BANK_WIDTH_4=y +# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set +# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set +# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set +CONFIG_MTD_CFI_I1=y +CONFIG_MTD_CFI_I2=y +# CONFIG_MTD_CFI_I4 is not set +# CONFIG_MTD_CFI_I8 is not set +CONFIG_MTD_CFI_INTELEXT=y +CONFIG_MTD_CFI_AMDSTD=y +CONFIG_MTD_CFI_STAA=y +CONFIG_MTD_CFI_UTIL=y +# CONFIG_MTD_RAM is not set +# CONFIG_MTD_ROM is not set +# CONFIG_MTD_ABSENT is not set + +# +# Mapping drivers for chip access +# +# CONFIG_MTD_COMPLEX_MAPPINGS is not set +# CONFIG_MTD_PHYSMAP is not set +CONFIG_MTD_PHYSMAP_OF=y +# CONFIG_MTD_IMPA7 is not set +# CONFIG_MTD_INTEL_VR_NOR is not set +# CONFIG_MTD_PLATRAM is not set + +# +# Self-contained MTD device drivers +# +# CONFIG_MTD_PMC551 is not set +CONFIG_MTD_DATAFLASH=y +# CONFIG_MTD_DATAFLASH_WRITE_VERIFY is not set +# CONFIG_MTD_DATAFLASH_OTP is not set +# CONFIG_MTD_M25P80 is not set +CONFIG_MTD_SST25L=y +# CONFIG_MTD_SLRAM is not set +# CONFIG_MTD_PHRAM is not set +# CONFIG_MTD_MTDRAM is not set +# CONFIG_MTD_BLOCK2MTD is not set + +# +# Disk-On-Chip Device Drivers +# +# CONFIG_MTD_DOCG3 is not set +CONFIG_MTD_NAND_ECC=y +# CONFIG_MTD_NAND_ECC_SMC is not set +CONFIG_MTD_NAND=y +# CONFIG_MTD_NAND_ECC_BCH is not set +# CONFIG_MTD_SM_COMMON is not set +# CONFIG_MTD_NAND_DENALI_PCI is not set +# CONFIG_MTD_NAND_DENALI_DT is not set +# CONFIG_MTD_NAND_GPIO is not set +# CONFIG_MTD_NAND_OMAP_BCH_BUILD is not set +CONFIG_MTD_NAND_IDS=y +# CONFIG_MTD_NAND_RICOH is not set +# CONFIG_MTD_NAND_DISKONCHIP is not set +# CONFIG_MTD_NAND_DOCG4 is not set +# CONFIG_MTD_NAND_CAFE is not set +# CONFIG_MTD_NAND_NANDSIM is not set +# CONFIG_MTD_NAND_GPMI_NAND is not set +# CONFIG_MTD_NAND_BRCMNAND is not set +# CONFIG_MTD_NAND_PLATFORM is not set +CONFIG_MTD_NAND_MXC=y +# CONFIG_MTD_NAND_HISI504 is not set +# CONFIG_MTD_ONENAND is not set + +# +# LPDDR & LPDDR2 PCM memory drivers +# +# CONFIG_MTD_LPDDR is not set +# CONFIG_MTD_LPDDR2_NVM is not set +CONFIG_MTD_SPI_NOR=m +CONFIG_MTD_SPI_NOR_USE_4K_SECTORS=y +CONFIG_SPI_FSL_QUADSPI=m +CONFIG_MTD_UBI=y +CONFIG_MTD_UBI_WL_THRESHOLD=4096 +CONFIG_MTD_UBI_BEB_LIMIT=20 +# CONFIG_MTD_UBI_FASTMAP is not set +# CONFIG_MTD_UBI_GLUEBI is not set +# CONFIG_MTD_UBI_BLOCK is not set +CONFIG_DTC=y +CONFIG_OF=y +# CONFIG_OF_UNITTEST is not set +CONFIG_OF_FLATTREE=y +CONFIG_OF_EARLY_FLATTREE=y +CONFIG_OF_ADDRESS=y +CONFIG_OF_ADDRESS_PCI=y +CONFIG_OF_IRQ=y +CONFIG_OF_NET=y +CONFIG_OF_MDIO=y +CONFIG_OF_PCI=y +CONFIG_OF_PCI_IRQ=y +CONFIG_OF_MTD=y +CONFIG_OF_RESERVED_MEM=y +# CONFIG_OF_OVERLAY is not set +CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y +# CONFIG_PARPORT is not set +CONFIG_BLK_DEV=y +# CONFIG_BLK_DEV_NULL_BLK is not set +# CONFIG_BLK_DEV_PCIESSD_MTIP32XX is not set +# CONFIG_BLK_CPQ_CISS_DA is not set +# CONFIG_BLK_DEV_DAC960 is not set +# CONFIG_BLK_DEV_UMEM is not set +# CONFIG_BLK_DEV_COW_COMMON is not set +CONFIG_BLK_DEV_LOOP=y +CONFIG_BLK_DEV_LOOP_MIN_COUNT=0 +CONFIG_BLK_DEV_CRYPTOLOOP=m +# CONFIG_BLK_DEV_DRBD is not set +# CONFIG_BLK_DEV_NBD is not set +# CONFIG_BLK_DEV_SX8 is not set +CONFIG_BLK_DEV_RAM=y +CONFIG_BLK_DEV_RAM_COUNT=16 +CONFIG_BLK_DEV_RAM_SIZE=4096 +CONFIG_CDROM_PKTCDVD=m +CONFIG_CDROM_PKTCDVD_BUFFERS=8 +# CONFIG_CDROM_PKTCDVD_WCACHE is not set +# CONFIG_ATA_OVER_ETH is not set +CONFIG_MG_DISK=y +CONFIG_MG_DISK_RES=0 +# CONFIG_VIRTIO_BLK is not set +# CONFIG_BLK_DEV_RBD is not set +# CONFIG_BLK_DEV_RSXX is not set +CONFIG_BLK_DEV_NVME=y + +# +# Misc devices +# +# CONFIG_SENSORS_LIS3LV02D is not set +# CONFIG_AD525X_DPOT is not set +# CONFIG_DUMMY_IRQ is not set +CONFIG_HWLAT_DETECTOR=m +# CONFIG_PHANTOM is not set +# CONFIG_SGI_IOC4 is not set +CONFIG_TIFM_CORE=y +CONFIG_TIFM_7XX1=y +# CONFIG_ICS932S401 is not set +CONFIG_ENCLOSURE_SERVICES=y +# CONFIG_HP_ILO is not set +# CONFIG_APDS9802ALS is not set +# CONFIG_ISL29003 is not set +# CONFIG_ISL29020 is not set +# CONFIG_SENSORS_TSL2550 is not set +# CONFIG_SENSORS_BH1780 is not set +# CONFIG_SENSORS_BH1770 is not set +# CONFIG_SENSORS_APDS990X is not set +# CONFIG_HMC6352 is not set +# CONFIG_DS1682 is not set +# CONFIG_TI_DAC7512 is not set +# CONFIG_BMP085_I2C is not set +# CONFIG_BMP085_SPI is not set +# CONFIG_USB_SWITCH_FSA9480 is not set +# CONFIG_LATTICE_ECP3_CONFIG is not set +CONFIG_SRAM=y +# CONFIG_C2PORT is not set + +# +# EEPROM support +# +CONFIG_EEPROM_AT24=y +CONFIG_EEPROM_AT25=y +# CONFIG_EEPROM_LEGACY is not set +CONFIG_EEPROM_MAX6875=y +CONFIG_EEPROM_93CX6=m +# CONFIG_EEPROM_93XX46 is not set +CONFIG_CB710_CORE=y +# CONFIG_CB710_DEBUG is not set +CONFIG_CB710_DEBUG_ASSUMPTIONS=y + +# +# Texas Instruments shared transport line discipline +# +CONFIG_TI_ST=m +# CONFIG_SENSORS_LIS3_SPI is not set +# CONFIG_SENSORS_LIS3_I2C is not set + +# +# Altera FPGA firmware download module +# +CONFIG_ALTERA_STAPL=m + +# +# Intel MIC Bus Driver +# + +# +# SCIF Bus Driver +# + +# +# Intel MIC Host Driver +# + +# +# Intel MIC Card Driver +# + +# +# SCIF Driver +# + +# +# Intel MIC Coprocessor State Management (COSM) Drivers +# +CONFIG_ECHO=m +# CONFIG_CXL_BASE is not set +# CONFIG_CXL_KERNEL_API is not set +# CONFIG_CXL_EEH is not set +CONFIG_HAVE_IDE=y +# CONFIG_IDE is not set + +# +# SCSI device support +# +CONFIG_SCSI_MOD=y +# CONFIG_RAID_ATTRS is not set +CONFIG_SCSI=y +CONFIG_SCSI_DMA=y +CONFIG_SCSI_NETLINK=y +# CONFIG_SCSI_MQ_DEFAULT is not set +CONFIG_SCSI_PROC_FS=y + +# +# SCSI support type (disk, tape, CD-ROM) +# +CONFIG_BLK_DEV_SD=y +# CONFIG_CHR_DEV_ST is not set +# CONFIG_CHR_DEV_OSST is not set +CONFIG_BLK_DEV_SR=y +CONFIG_BLK_DEV_SR_VENDOR=y +# CONFIG_CHR_DEV_SG is not set +CONFIG_CHR_DEV_SCH=m +CONFIG_SCSI_ENCLOSURE=y +# CONFIG_SCSI_CONSTANTS is not set +CONFIG_SCSI_LOGGING=y +# CONFIG_SCSI_SCAN_ASYNC is not set + +# +# SCSI Transports +# +# CONFIG_SCSI_SPI_ATTRS is not set +CONFIG_SCSI_FC_ATTRS=m +CONFIG_SCSI_ISCSI_ATTRS=m +# CONFIG_SCSI_SAS_ATTRS is not set +# CONFIG_SCSI_SAS_LIBSAS is not set +# CONFIG_SCSI_SRP_ATTRS is not set +CONFIG_SCSI_LOWLEVEL=y +CONFIG_ISCSI_TCP=m +CONFIG_ISCSI_BOOT_SYSFS=m +# CONFIG_SCSI_CXGB3_ISCSI is not set +# CONFIG_SCSI_CXGB4_ISCSI is not set +# CONFIG_SCSI_BNX2_ISCSI is not set +# CONFIG_SCSI_BNX2X_FCOE is not set +# CONFIG_BE2ISCSI is not set +# CONFIG_BLK_DEV_3W_XXXX_RAID is not set +# CONFIG_SCSI_HPSA is not set +# CONFIG_SCSI_3W_9XXX is not set +# CONFIG_SCSI_3W_SAS is not set +# CONFIG_SCSI_ACARD is not set +# CONFIG_SCSI_AACRAID is not set +# CONFIG_SCSI_AIC7XXX is not set +# CONFIG_SCSI_AIC79XX is not set +# CONFIG_SCSI_AIC94XX is not set +# CONFIG_SCSI_MVSAS is not set +# CONFIG_SCSI_MVUMI is not set +# CONFIG_SCSI_ADVANSYS is not set +# CONFIG_SCSI_ARCMSR is not set +# CONFIG_SCSI_ESAS2R is not set +# CONFIG_MEGARAID_NEWGEN is not set +# CONFIG_MEGARAID_LEGACY is not set +# CONFIG_MEGARAID_SAS is not set +# CONFIG_SCSI_MPT3SAS is not set +# CONFIG_SCSI_MPT2SAS is not set +CONFIG_SCSI_UFSHCD=m +# CONFIG_SCSI_UFSHCD_PCI is not set +CONFIG_SCSI_UFSHCD_PLATFORM=m +# CONFIG_SCSI_HPTIOP is not set +CONFIG_LIBFC=m +CONFIG_LIBFCOE=m +# CONFIG_FCOE is not set +# CONFIG_SCSI_SNIC is not set +# CONFIG_SCSI_DMX3191D is not set +# CONFIG_SCSI_FUTURE_DOMAIN is not set +# CONFIG_SCSI_IPS is not set +# CONFIG_SCSI_INITIO is not set +# CONFIG_SCSI_INIA100 is not set +# CONFIG_SCSI_STEX is not set +# CONFIG_SCSI_SYM53C8XX_2 is not set +# CONFIG_SCSI_IPR is not set +# CONFIG_SCSI_QLOGIC_1280 is not set +# CONFIG_SCSI_QLA_FC is not set +# CONFIG_SCSI_QLA_ISCSI is not set +# CONFIG_SCSI_LPFC is not set +# CONFIG_SCSI_DC395x is not set +# CONFIG_SCSI_AM53C974 is not set +# CONFIG_SCSI_NSP32 is not set +# CONFIG_SCSI_WD719X is not set +# CONFIG_SCSI_DEBUG is not set +# CONFIG_SCSI_PMCRAID is not set +# CONFIG_SCSI_PM8001 is not set +# CONFIG_SCSI_BFA_FC is not set +# CONFIG_SCSI_VIRTIO is not set +# CONFIG_SCSI_CHELSIO_FCOE is not set +# CONFIG_SCSI_DH is not set +CONFIG_SCSI_OSD_INITIATOR=m +# CONFIG_SCSI_OSD_ULD is not set +CONFIG_SCSI_OSD_DPRINT_SENSE=1 +# CONFIG_SCSI_OSD_DEBUG is not set +CONFIG_ATA=y +# CONFIG_ATA_NONSTANDARD is not set +# CONFIG_ATA_VERBOSE_ERROR is not set +CONFIG_SATA_PMP=y + +# +# Controllers with non-SFF native interface +# +CONFIG_SATA_AHCI=y +CONFIG_SATA_AHCI_PLATFORM=y +CONFIG_AHCI_IMX=y +# CONFIG_AHCI_CEVA is not set +# CONFIG_AHCI_QORIQ is not set +# CONFIG_SATA_INIC162X is not set +# CONFIG_SATA_ACARD_AHCI is not set +# CONFIG_SATA_SIL24 is not set +CONFIG_ATA_SFF=y + +# +# SFF controllers with custom DMA interface +# +# CONFIG_PDC_ADMA is not set +# CONFIG_SATA_QSTOR is not set +# CONFIG_SATA_SX4 is not set +CONFIG_ATA_BMDMA=y + +# +# SATA SFF controllers with BMDMA +# +# CONFIG_ATA_PIIX is not set +CONFIG_SATA_MV=y +# CONFIG_SATA_NV is not set +# CONFIG_SATA_PROMISE is not set +# CONFIG_SATA_SIL is not set +# CONFIG_SATA_SIS is not set +# CONFIG_SATA_SVW is not set +# CONFIG_SATA_ULI is not set +# CONFIG_SATA_VIA is not set +# CONFIG_SATA_VITESSE is not set + +# +# PATA SFF controllers with BMDMA +# +# CONFIG_PATA_ALI is not set +# CONFIG_PATA_AMD is not set +# CONFIG_PATA_ARTOP is not set +# CONFIG_PATA_ATIIXP is not set +# CONFIG_PATA_ATP867X is not set +# CONFIG_PATA_CMD64X is not set +# CONFIG_PATA_CYPRESS is not set +# CONFIG_PATA_EFAR is not set +# CONFIG_PATA_HPT366 is not set +# CONFIG_PATA_HPT37X is not set +# CONFIG_PATA_HPT3X2N is not set +# CONFIG_PATA_HPT3X3 is not set +CONFIG_PATA_IMX=y +# CONFIG_PATA_IT8213 is not set +# CONFIG_PATA_IT821X is not set +# CONFIG_PATA_JMICRON is not set +# CONFIG_PATA_MARVELL is not set +# CONFIG_PATA_NETCELL is not set +# CONFIG_PATA_NINJA32 is not set +# CONFIG_PATA_NS87415 is not set +# CONFIG_PATA_OLDPIIX is not set +# CONFIG_PATA_OPTIDMA is not set +# CONFIG_PATA_PDC2027X is not set +# CONFIG_PATA_PDC_OLD is not set +# CONFIG_PATA_RADISYS is not set +# CONFIG_PATA_RDC is not set +# CONFIG_PATA_SCH is not set +# CONFIG_PATA_SERVERWORKS is not set +# CONFIG_PATA_SIL680 is not set +# CONFIG_PATA_SIS is not set +# CONFIG_PATA_TOSHIBA is not set +# CONFIG_PATA_TRIFLEX is not set +# CONFIG_PATA_VIA is not set +# CONFIG_PATA_WINBOND is not set + +# +# PIO-only SFF controllers +# +# CONFIG_PATA_CMD640_PCI is not set +# CONFIG_PATA_MPIIX is not set +# CONFIG_PATA_NS87410 is not set +# CONFIG_PATA_OPTI is not set +# CONFIG_PATA_PLATFORM is not set +# CONFIG_PATA_RZ1000 is not set + +# +# Generic fallback / legacy drivers +# +# CONFIG_ATA_GENERIC is not set +# CONFIG_PATA_LEGACY is not set +CONFIG_MD=y +CONFIG_BLK_DEV_MD=y +CONFIG_MD_AUTODETECT=y +CONFIG_MD_LINEAR=y +CONFIG_MD_RAID0=y +CONFIG_MD_RAID1=y +CONFIG_MD_RAID10=y +CONFIG_MD_RAID456=m +CONFIG_MD_MULTIPATH=m +CONFIG_MD_FAULTY=m +# CONFIG_MD_CLUSTER is not set +CONFIG_BLK_DEV_DM_BUILTIN=y +CONFIG_BLK_DEV_DM=m +# CONFIG_DM_MQ_DEFAULT is not set +# CONFIG_DM_DEBUG is not set +CONFIG_DM_BUFIO=m +CONFIG_DM_BIO_PRISON=m +CONFIG_DM_PERSISTENT_DATA=m +# CONFIG_DM_DEBUG_BLOCK_STACK_TRACING is not set +CONFIG_DM_CRYPT=m +CONFIG_DM_SNAPSHOT=m +CONFIG_DM_THIN_PROVISIONING=m +CONFIG_DM_CACHE=m +CONFIG_DM_CACHE_MQ=m +CONFIG_DM_CACHE_SMQ=m +CONFIG_DM_CACHE_CLEANER=m +# CONFIG_DM_ERA is not set +CONFIG_DM_MIRROR=m +CONFIG_DM_LOG_USERSPACE=m +CONFIG_DM_RAID=m +CONFIG_DM_ZERO=m +CONFIG_DM_MULTIPATH=m +CONFIG_DM_MULTIPATH_QL=m +CONFIG_DM_MULTIPATH_ST=m +CONFIG_DM_DELAY=m +CONFIG_DM_UEVENT=y +CONFIG_DM_FLAKEY=m +CONFIG_DM_VERITY=m +# CONFIG_DM_SWITCH is not set +# CONFIG_DM_LOG_WRITES is not set +# CONFIG_TARGET_CORE is not set +# CONFIG_FUSION is not set + +# +# IEEE 1394 (FireWire) support +# +# CONFIG_FIREWIRE is not set +# CONFIG_FIREWIRE_NOSY is not set +CONFIG_NETDEVICES=y +CONFIG_MII=y +CONFIG_NET_CORE=y +CONFIG_BONDING=m +CONFIG_DUMMY=m +CONFIG_EQUALIZER=m +# CONFIG_NET_FC is not set +# CONFIG_IFB is not set +CONFIG_NET_TEAM=y +CONFIG_NET_TEAM_MODE_BROADCAST=y +CONFIG_NET_TEAM_MODE_ROUNDROBIN=y +CONFIG_NET_TEAM_MODE_RANDOM=y +CONFIG_NET_TEAM_MODE_ACTIVEBACKUP=y +CONFIG_NET_TEAM_MODE_LOADBALANCE=y +CONFIG_MACVLAN=m +CONFIG_MACVTAP=m +CONFIG_IPVLAN=m +CONFIG_VXLAN=m +# CONFIG_GENEVE is not set +CONFIG_NETCONSOLE=m +CONFIG_NETCONSOLE_DYNAMIC=y +CONFIG_NETPOLL=y +CONFIG_NET_POLL_CONTROLLER=y +CONFIG_TUN=m +# CONFIG_TUN_VNET_CROSS_LE is not set +CONFIG_VETH=m +# CONFIG_VIRTIO_NET is not set +CONFIG_NLMON=m +# CONFIG_ARCNET is not set + +# +# CAIF transport drivers +# +CONFIG_CAIF_TTY=m +CONFIG_CAIF_SPI_SLAVE=m +CONFIG_CAIF_SPI_SYNC=y +CONFIG_CAIF_HSI=m +CONFIG_CAIF_VIRTIO=m +# CONFIG_VHOST_NET is not set +CONFIG_VHOST_RING=m +# CONFIG_VHOST_CROSS_ENDIAN_LEGACY is not set + +# +# Distributed Switch Architecture drivers +# +CONFIG_NET_DSA_MV88E6XXX=y +# CONFIG_NET_DSA_MV88E6060 is not set +# CONFIG_NET_DSA_MV88E6XXX_NEED_PPU is not set +# CONFIG_NET_DSA_MV88E6131 is not set +# CONFIG_NET_DSA_MV88E6123_61_65 is not set +# CONFIG_NET_DSA_MV88E6171 is not set +CONFIG_NET_DSA_MV88E6352=y +# CONFIG_NET_DSA_BCM_SF2 is not set +CONFIG_ETHERNET=y +CONFIG_MDIO=y +# CONFIG_NET_VENDOR_3COM is not set +# CONFIG_NET_VENDOR_ADAPTEC is not set +# CONFIG_NET_VENDOR_AGERE is not set +# CONFIG_NET_VENDOR_ALTEON is not set +# CONFIG_ALTERA_TSE is not set +# CONFIG_NET_VENDOR_AMD is not set +# CONFIG_NET_VENDOR_ARC is not set +CONFIG_NET_VENDOR_ATHEROS=y +CONFIG_ATL2=y +CONFIG_ATL1=y +CONFIG_ATL1E=y +CONFIG_ATL1C=y +CONFIG_ALX=y +# CONFIG_NET_VENDOR_AURORA is not set +# CONFIG_NET_CADENCE is not set +# CONFIG_NET_VENDOR_BROADCOM is not set +# CONFIG_NET_VENDOR_BROCADE is not set +# CONFIG_NET_VENDOR_CAVIUM is not set +# CONFIG_NET_VENDOR_CHELSIO is not set +# CONFIG_NET_VENDOR_CIRRUS is not set +# CONFIG_NET_VENDOR_CISCO is not set +# CONFIG_DM9000 is not set +# CONFIG_DNET is not set +# CONFIG_NET_VENDOR_DEC is not set +# CONFIG_NET_VENDOR_DLINK is not set +# CONFIG_NET_VENDOR_EMULEX is not set +# CONFIG_NET_VENDOR_EZCHIP is not set +# CONFIG_NET_VENDOR_EXAR is not set +# CONFIG_NET_VENDOR_FARADAY is not set +CONFIG_NET_VENDOR_FREESCALE=y +CONFIG_FEC=y +CONFIG_FSL_PQ_MDIO=y +CONFIG_FSL_XGMAC_MDIO=y +CONFIG_GIANFAR=y +# CONFIG_NET_VENDOR_HISILICON is not set +# CONFIG_NET_VENDOR_HP is not set +CONFIG_NET_VENDOR_INTEL=y +# CONFIG_E100 is not set +CONFIG_E1000=m +CONFIG_E1000E=m +CONFIG_IGB=m +CONFIG_IGB_HWMON=y +CONFIG_IGBVF=m +# CONFIG_IXGB is not set +# CONFIG_IXGBE is not set +# CONFIG_IXGBEVF is not set +# CONFIG_I40E is not set +# CONFIG_I40EVF is not set +# CONFIG_FM10K is not set +CONFIG_NET_VENDOR_I825XX=y +# CONFIG_JME is not set +CONFIG_NET_VENDOR_MARVELL=y +CONFIG_MVMDIO=y +# CONFIG_SKGE is not set +# CONFIG_SKY2 is not set +# CONFIG_NET_VENDOR_MELLANOX is not set +# CONFIG_NET_VENDOR_MICREL is not set +# CONFIG_NET_VENDOR_MICROCHIP is not set +# CONFIG_NET_VENDOR_MYRI is not set +# CONFIG_FEALNX is not set +# CONFIG_NET_VENDOR_NATSEMI is not set +# CONFIG_NET_VENDOR_NVIDIA is not set +# CONFIG_NET_VENDOR_OKI is not set +# CONFIG_ETHOC is not set +# CONFIG_NET_PACKET_ENGINE is not set +# CONFIG_NET_VENDOR_QLOGIC is not set +# CONFIG_NET_VENDOR_QUALCOMM is not set +# CONFIG_NET_VENDOR_REALTEK is not set +# CONFIG_NET_VENDOR_RENESAS is not set +# CONFIG_NET_VENDOR_RDC is not set +# CONFIG_NET_VENDOR_ROCKER is not set +# CONFIG_NET_VENDOR_SAMSUNG is not set +# CONFIG_NET_VENDOR_SEEQ is not set +# CONFIG_NET_VENDOR_SILAN is not set +# CONFIG_NET_VENDOR_SIS is not set +# CONFIG_SFC is not set +# CONFIG_NET_VENDOR_SMSC is not set +# CONFIG_NET_VENDOR_STMICRO is not set +# CONFIG_NET_VENDOR_SUN is not set +# CONFIG_NET_VENDOR_SYNOPSYS is not set +# CONFIG_NET_VENDOR_TEHUTI is not set +# CONFIG_NET_VENDOR_TI is not set +# CONFIG_NET_VENDOR_VIA is not set +# CONFIG_NET_VENDOR_WIZNET is not set +# CONFIG_FDDI is not set +# CONFIG_HIPPI is not set +CONFIG_PHYLIB=y +CONFIG_SWPHY=y + +# +# MII PHY device drivers +# +# CONFIG_AQUANTIA_PHY is not set +CONFIG_AT803X_PHY=y +# CONFIG_AMD_PHY is not set +CONFIG_MARVELL_PHY=y +# CONFIG_DAVICOM_PHY is not set +# CONFIG_QSEMI_PHY is not set +CONFIG_LXT_PHY=m +# CONFIG_CICADA_PHY is not set +# CONFIG_VITESSE_PHY is not set +# CONFIG_TERANETICS_PHY is not set +# CONFIG_SMSC_PHY is not set +# CONFIG_BROADCOM_PHY is not set +# CONFIG_BCM7XXX_PHY is not set +# CONFIG_BCM87XX_PHY is not set +# CONFIG_ICPLUS_PHY is not set +# CONFIG_REALTEK_PHY is not set +# CONFIG_NATIONAL_PHY is not set +# CONFIG_STE10XP is not set +# CONFIG_LSI_ET1011C_PHY is not set +# CONFIG_MICREL_PHY is not set +# CONFIG_DP83848_PHY is not set +# CONFIG_DP83867_PHY is not set +CONFIG_MICROCHIP_PHY=y +CONFIG_FIXED_PHY=y +CONFIG_MDIO_BITBANG=y +CONFIG_MDIO_GPIO=y +CONFIG_MDIO_BUS_MUX=y +CONFIG_MDIO_BUS_MUX_GPIO=y +CONFIG_MDIO_BUS_MUX_MMIOREG=y +CONFIG_MDIO_BCM_UNIMAC=m +# CONFIG_MICREL_KS8995MA is not set +CONFIG_PPP=m +CONFIG_PPP_BSDCOMP=m +CONFIG_PPP_DEFLATE=m +CONFIG_PPP_FILTER=y +CONFIG_PPP_MPPE=m +CONFIG_PPP_MULTILINK=y +CONFIG_PPPOE=m +CONFIG_PPTP=m +CONFIG_PPPOL2TP=m +CONFIG_PPP_ASYNC=m +CONFIG_PPP_SYNC_TTY=m +CONFIG_SLIP=m +CONFIG_SLHC=m +CONFIG_SLIP_COMPRESSED=y +CONFIG_SLIP_SMART=y +CONFIG_SLIP_MODE_SLIP6=y +CONFIG_USB_NET_DRIVERS=m +CONFIG_USB_CATC=m +CONFIG_USB_KAWETH=m +CONFIG_USB_PEGASUS=m +CONFIG_USB_RTL8150=m +CONFIG_USB_RTL8152=m +CONFIG_USB_LAN78XX=m +CONFIG_USB_USBNET=m +CONFIG_USB_NET_AX8817X=m +CONFIG_USB_NET_AX88179_178A=m +CONFIG_USB_NET_CDCETHER=m +CONFIG_USB_NET_CDC_EEM=m +CONFIG_USB_NET_CDC_NCM=m +CONFIG_USB_NET_HUAWEI_CDC_NCM=m +CONFIG_USB_NET_CDC_MBIM=m +CONFIG_USB_NET_DM9601=m +CONFIG_USB_NET_SR9700=m +CONFIG_USB_NET_SR9800=m +CONFIG_USB_NET_SMSC75XX=m +CONFIG_USB_NET_SMSC95XX=m +CONFIG_USB_NET_GL620A=m +CONFIG_USB_NET_NET1080=m +CONFIG_USB_NET_PLUSB=m +CONFIG_USB_NET_MCS7830=m +CONFIG_USB_NET_RNDIS_HOST=m +CONFIG_USB_NET_CDC_SUBSET=m +CONFIG_USB_ALI_M5632=y +CONFIG_USB_AN2720=y +CONFIG_USB_BELKIN=y +CONFIG_USB_ARMLINUX=y +CONFIG_USB_EPSON2888=y +CONFIG_USB_KC2190=y +CONFIG_USB_NET_ZAURUS=m +CONFIG_USB_NET_CX82310_ETH=m +CONFIG_USB_NET_KALMIA=m +CONFIG_USB_NET_QMI_WWAN=m +CONFIG_USB_HSO=m +CONFIG_USB_NET_INT51X1=m +CONFIG_USB_IPHETH=m +CONFIG_USB_SIERRA_NET=m +CONFIG_USB_VL600=m +CONFIG_USB_NET_CH9200=m +CONFIG_WLAN=y +CONFIG_LIBERTAS_THINFIRM=m +# CONFIG_LIBERTAS_THINFIRM_DEBUG is not set +CONFIG_LIBERTAS_THINFIRM_USB=m +CONFIG_ATMEL=m +CONFIG_PCI_ATMEL=m +CONFIG_AT76C50X_USB=m +CONFIG_PRISM54=m +CONFIG_USB_ZD1201=m +CONFIG_USB_NET_RNDIS_WLAN=m +CONFIG_ADM8211=m +CONFIG_RTL8180=m +CONFIG_RTL8187=m +CONFIG_RTL8187_LEDS=y +CONFIG_MAC80211_HWSIM=m +CONFIG_MWL8K=m +CONFIG_ATH_COMMON=m +CONFIG_ATH_CARDS=m +# CONFIG_ATH_DEBUG is not set +# CONFIG_ATH_REG_DYNAMIC_USER_REG_HINTS is not set +CONFIG_ATH5K=m +# CONFIG_ATH5K_DEBUG is not set +# CONFIG_ATH5K_TRACER is not set +CONFIG_ATH5K_PCI=y +# CONFIG_ATH5K_TEST_CHANNELS is not set +CONFIG_ATH9K_HW=m +CONFIG_ATH9K_COMMON=m +CONFIG_ATH9K_BTCOEX_SUPPORT=y +CONFIG_ATH9K=m +CONFIG_ATH9K_PCI=y +CONFIG_ATH9K_AHB=y +# CONFIG_ATH9K_DEBUGFS is not set +# CONFIG_ATH9K_DFS_CERTIFIED is not set +# CONFIG_ATH9K_DYNACK is not set +CONFIG_ATH9K_WOW=y +CONFIG_ATH9K_RFKILL=y +CONFIG_ATH9K_CHANNEL_CONTEXT=y +CONFIG_ATH9K_PCOEM=y +CONFIG_ATH9K_HTC=m +# CONFIG_ATH9K_HTC_DEBUGFS is not set +CONFIG_CARL9170=m +CONFIG_CARL9170_LEDS=y +CONFIG_CARL9170_WPC=y +CONFIG_CARL9170_HWRNG=y +CONFIG_ATH6KL=m +CONFIG_ATH6KL_SDIO=m +CONFIG_ATH6KL_USB=m +# CONFIG_ATH6KL_DEBUG is not set +# CONFIG_ATH6KL_TRACING is not set +# CONFIG_ATH6KL_REGDOMAIN is not set +CONFIG_AR5523=m +CONFIG_WIL6210=m +CONFIG_WIL6210_ISR_COR=y +CONFIG_WIL6210_TRACING=y +CONFIG_ATH10K=m +CONFIG_ATH10K_PCI=m +# CONFIG_ATH10K_DEBUG is not set +# CONFIG_ATH10K_DEBUGFS is not set +# CONFIG_ATH10K_TRACING is not set +# CONFIG_ATH10K_DFS_CERTIFIED is not set +CONFIG_WCN36XX=m +# CONFIG_WCN36XX_DEBUGFS is not set +CONFIG_B43=m +CONFIG_B43_BCMA=y +CONFIG_B43_SSB=y +CONFIG_B43_BUSES_BCMA_AND_SSB=y +# CONFIG_B43_BUSES_BCMA is not set +# CONFIG_B43_BUSES_SSB is not set +CONFIG_B43_PCI_AUTOSELECT=y +CONFIG_B43_PCICORE_AUTOSELECT=y +CONFIG_B43_SDIO=y +CONFIG_B43_BCMA_PIO=y +CONFIG_B43_PIO=y +CONFIG_B43_PHY_G=y +CONFIG_B43_PHY_N=y +CONFIG_B43_PHY_LP=y +CONFIG_B43_PHY_HT=y +CONFIG_B43_LEDS=y +CONFIG_B43_HWRNG=y +# CONFIG_B43_DEBUG is not set +CONFIG_B43LEGACY=m +CONFIG_B43LEGACY_PCI_AUTOSELECT=y +CONFIG_B43LEGACY_PCICORE_AUTOSELECT=y +CONFIG_B43LEGACY_LEDS=y +CONFIG_B43LEGACY_HWRNG=y +# CONFIG_B43LEGACY_DEBUG is not set +CONFIG_B43LEGACY_DMA=y +CONFIG_B43LEGACY_PIO=y +CONFIG_B43LEGACY_DMA_AND_PIO_MODE=y +# CONFIG_B43LEGACY_DMA_MODE is not set +# CONFIG_B43LEGACY_PIO_MODE is not set +CONFIG_BRCMUTIL=m +CONFIG_BRCMSMAC=m +CONFIG_BRCMFMAC=m +CONFIG_BRCMFMAC_PROTO_BCDC=y +CONFIG_BRCMFMAC_PROTO_MSGBUF=y +CONFIG_BRCMFMAC_SDIO=y +CONFIG_BRCMFMAC_USB=y +CONFIG_BRCMFMAC_PCIE=y +# CONFIG_BRCM_TRACING is not set +# CONFIG_BRCMDBG is not set +CONFIG_HOSTAP=m +CONFIG_HOSTAP_FIRMWARE=y +CONFIG_HOSTAP_FIRMWARE_NVRAM=y +CONFIG_HOSTAP_PLX=m +CONFIG_HOSTAP_PCI=m +CONFIG_IPW2100=m +CONFIG_IPW2100_MONITOR=y +# CONFIG_IPW2100_DEBUG is not set +CONFIG_IPW2200=m +CONFIG_IPW2200_MONITOR=y +CONFIG_IPW2200_RADIOTAP=y +CONFIG_IPW2200_PROMISCUOUS=y +CONFIG_IPW2200_QOS=y +CONFIG_IPW2200_DEBUG=y +CONFIG_LIBIPW=m +CONFIG_LIBIPW_DEBUG=y +CONFIG_IWLWIFI=m +CONFIG_IWLWIFI_LEDS=y +CONFIG_IWLDVM=m +CONFIG_IWLMVM=m +CONFIG_IWLWIFI_OPMODE_MODULAR=y +# CONFIG_IWLWIFI_BCAST_FILTERING is not set +CONFIG_IWLWIFI_UAPSD=y + +# +# Debugging Options +# +# CONFIG_IWLWIFI_DEBUG is not set +# CONFIG_IWLWIFI_DEVICE_TRACING is not set +CONFIG_IWLEGACY=m +CONFIG_IWL4965=m +CONFIG_IWL3945=m + +# +# iwl3945 / iwl4965 Debugging Options +# +# CONFIG_IWLEGACY_DEBUG is not set +CONFIG_LIBERTAS=m +CONFIG_LIBERTAS_USB=m +CONFIG_LIBERTAS_SDIO=m +CONFIG_LIBERTAS_SPI=m +# CONFIG_LIBERTAS_DEBUG is not set +CONFIG_LIBERTAS_MESH=y +CONFIG_HERMES=m +CONFIG_HERMES_PRISM=y +CONFIG_HERMES_CACHE_FW_ON_INIT=y +CONFIG_PLX_HERMES=m +CONFIG_TMD_HERMES=m +CONFIG_NORTEL_HERMES=m +CONFIG_PCI_HERMES=m +CONFIG_ORINOCO_USB=m +CONFIG_P54_COMMON=m +CONFIG_P54_USB=m +CONFIG_P54_PCI=m +CONFIG_P54_SPI=m +CONFIG_P54_SPI_DEFAULT_EEPROM=y +CONFIG_P54_LEDS=y +CONFIG_RT2X00=m +CONFIG_RT2400PCI=m +CONFIG_RT2500PCI=m +CONFIG_RT61PCI=m +CONFIG_RT2800PCI=m +CONFIG_RT2800PCI_RT33XX=y +CONFIG_RT2800PCI_RT35XX=y +CONFIG_RT2800PCI_RT53XX=y +CONFIG_RT2800PCI_RT3290=y +CONFIG_RT2500USB=m +CONFIG_RT73USB=m +CONFIG_RT2800USB=m +CONFIG_RT2800USB_RT33XX=y +CONFIG_RT2800USB_RT35XX=y +CONFIG_RT2800USB_RT3573=y +CONFIG_RT2800USB_RT53XX=y +CONFIG_RT2800USB_RT55XX=y +CONFIG_RT2800USB_UNKNOWN=y +CONFIG_RT2800_LIB=m +CONFIG_RT2800_LIB_MMIO=m +CONFIG_RT2X00_LIB_MMIO=m +CONFIG_RT2X00_LIB_PCI=m +CONFIG_RT2X00_LIB_USB=m +CONFIG_RT2X00_LIB=m +CONFIG_RT2X00_LIB_FIRMWARE=y +CONFIG_RT2X00_LIB_CRYPTO=y +CONFIG_RT2X00_LIB_LEDS=y +# CONFIG_RT2X00_DEBUG is not set +CONFIG_WL_MEDIATEK=y +CONFIG_MT7601U=m +CONFIG_RTL8XXXU=m +# CONFIG_RTL8XXXU_UNTESTED is not set +# CONFIG_RTL8192CU is not set +CONFIG_WL_TI=y +CONFIG_WL1251=m +CONFIG_WL1251_SPI=m +CONFIG_WL1251_SDIO=m +CONFIG_WL12XX=m +CONFIG_WL18XX=m +CONFIG_WLCORE=m +CONFIG_WLCORE_SPI=m +CONFIG_WLCORE_SDIO=m +CONFIG_WILINK_PLATFORM_DATA=y +CONFIG_ZD1211RW=m +# CONFIG_ZD1211RW_DEBUG is not set +CONFIG_MWIFIEX=m +CONFIG_MWIFIEX_SDIO=m +CONFIG_MWIFIEX_PCIE=m +CONFIG_MWIFIEX_USB=m +CONFIG_CW1200=m +CONFIG_CW1200_WLAN_SDIO=m +CONFIG_CW1200_WLAN_SPI=m +CONFIG_RSI_91X=m +CONFIG_RSI_DEBUGFS=y +CONFIG_RSI_SDIO=m +CONFIG_RSI_USB=m + +# +# Enable WiMAX (Networking options) to see the WiMAX drivers +# +CONFIG_WAN=y +CONFIG_HDLC=m +CONFIG_HDLC_RAW=m +CONFIG_HDLC_RAW_ETH=m +CONFIG_HDLC_CISCO=m +CONFIG_HDLC_FR=m +CONFIG_HDLC_PPP=m + +# +# X.25/LAPB support is disabled +# +# CONFIG_PCI200SYN is not set +CONFIG_WANXL=m +# CONFIG_WANXL_BUILD_FIRMWARE is not set +CONFIG_PC300TOO=m +CONFIG_FARSYNC=m +CONFIG_DSCC4=m +# CONFIG_DSCC4_PCISYNC is not set +# CONFIG_DSCC4_PCI_RST is not set +# CONFIG_DLCI is not set +# CONFIG_VMXNET3 is not set +CONFIG_ISDN=y +CONFIG_ISDN_I4L=m +# CONFIG_ISDN_PPP is not set +# CONFIG_ISDN_AUDIO is not set + +# +# ISDN feature submodules +# +# CONFIG_ISDN_DIVERSION is not set + +# +# ISDN4Linux hardware drivers +# + +# +# Passive cards +# +# CONFIG_ISDN_DRV_HISAX is not set + +# +# Active cards +# +CONFIG_ISDN_CAPI=m +CONFIG_CAPI_TRACE=y +# CONFIG_ISDN_CAPI_CAPI20 is not set +# CONFIG_ISDN_CAPI_CAPIDRV is not set + +# +# CAPI hardware drivers +# +# CONFIG_CAPI_AVM is not set +# CONFIG_CAPI_EICON is not set +CONFIG_ISDN_DRV_GIGASET=m +CONFIG_GIGASET_CAPI=y +# CONFIG_GIGASET_I4L is not set +# CONFIG_GIGASET_DUMMYLL is not set +# CONFIG_GIGASET_BASE is not set +# CONFIG_GIGASET_M105 is not set +# CONFIG_GIGASET_M101 is not set +# CONFIG_GIGASET_DEBUG is not set +CONFIG_HYSDN=m +CONFIG_HYSDN_CAPI=y +CONFIG_MISDN=m +CONFIG_MISDN_DSP=m +CONFIG_MISDN_L1OIP=m + +# +# mISDN hardware drivers +# +CONFIG_MISDN_HFCPCI=m +CONFIG_MISDN_HFCMULTI=m +CONFIG_MISDN_HFCUSB=m +CONFIG_MISDN_AVMFRITZ=m +CONFIG_MISDN_SPEEDFAX=m +CONFIG_MISDN_INFINEON=m +CONFIG_MISDN_W6692=m +CONFIG_MISDN_NETJET=m +CONFIG_MISDN_IPAC=m +CONFIG_MISDN_ISAR=m +CONFIG_ISDN_HDLC=m +# CONFIG_NVM is not set + +# +# Input device support +# +CONFIG_INPUT=y +CONFIG_INPUT_LEDS=m +CONFIG_INPUT_FF_MEMLESS=m +CONFIG_INPUT_POLLDEV=y +CONFIG_INPUT_SPARSEKMAP=m +CONFIG_INPUT_MATRIXKMAP=y + +# +# Userland interfaces +# +CONFIG_INPUT_MOUSEDEV=m +# CONFIG_INPUT_MOUSEDEV_PSAUX is not set +CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 +CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 +CONFIG_INPUT_JOYDEV=m +CONFIG_INPUT_EVDEV=y +CONFIG_INPUT_EVBUG=m + +# +# Input Device Drivers +# +CONFIG_INPUT_KEYBOARD=y +# CONFIG_KEYBOARD_ADP5588 is not set +# CONFIG_KEYBOARD_ADP5589 is not set +# CONFIG_KEYBOARD_ATKBD is not set +# CONFIG_KEYBOARD_QT1070 is not set +# CONFIG_KEYBOARD_QT2160 is not set +# CONFIG_KEYBOARD_LKKBD is not set +CONFIG_KEYBOARD_GPIO=y +CONFIG_KEYBOARD_GPIO_POLLED=y +CONFIG_KEYBOARD_TCA6416=m +CONFIG_KEYBOARD_TCA8418=m +CONFIG_KEYBOARD_MATRIX=m +# CONFIG_KEYBOARD_LM8323 is not set +# CONFIG_KEYBOARD_LM8333 is not set +# CONFIG_KEYBOARD_MAX7359 is not set +# CONFIG_KEYBOARD_MCS is not set +# CONFIG_KEYBOARD_MPR121 is not set +CONFIG_KEYBOARD_IMX=y +# CONFIG_KEYBOARD_NEWTON is not set +# CONFIG_KEYBOARD_OPENCORES is not set +# CONFIG_KEYBOARD_SAMSUNG is not set +# CONFIG_KEYBOARD_STOWAWAY is not set +# CONFIG_KEYBOARD_SUNKBD is not set +# CONFIG_KEYBOARD_OMAP4 is not set +CONFIG_KEYBOARD_XTKBD=m +# CONFIG_KEYBOARD_CAP11XX is not set +# CONFIG_KEYBOARD_BCM is not set +CONFIG_INPUT_MOUSE=y +CONFIG_MOUSE_PS2=m +CONFIG_MOUSE_PS2_ALPS=y +CONFIG_MOUSE_PS2_LOGIPS2PP=y +CONFIG_MOUSE_PS2_SYNAPTICS=y +CONFIG_MOUSE_PS2_CYPRESS=y +CONFIG_MOUSE_PS2_TRACKPOINT=y +CONFIG_MOUSE_PS2_ELANTECH=y +# CONFIG_MOUSE_PS2_SENTELIC is not set +# CONFIG_MOUSE_PS2_TOUCHKIT is not set +CONFIG_MOUSE_PS2_FOCALTECH=y +CONFIG_MOUSE_SERIAL=m +CONFIG_MOUSE_APPLETOUCH=m +CONFIG_MOUSE_BCM5974=m +CONFIG_MOUSE_CYAPA=m +CONFIG_MOUSE_ELAN_I2C=m +CONFIG_MOUSE_ELAN_I2C_I2C=y +# CONFIG_MOUSE_ELAN_I2C_SMBUS is not set +CONFIG_MOUSE_VSXXXAA=m +CONFIG_MOUSE_GPIO=m +CONFIG_MOUSE_SYNAPTICS_I2C=m +CONFIG_MOUSE_SYNAPTICS_USB=m +CONFIG_INPUT_JOYSTICK=y +CONFIG_JOYSTICK_ANALOG=m +CONFIG_JOYSTICK_A3D=m +CONFIG_JOYSTICK_ADI=m +CONFIG_JOYSTICK_COBRA=m +CONFIG_JOYSTICK_GF2K=m +CONFIG_JOYSTICK_GRIP=m +CONFIG_JOYSTICK_GRIP_MP=m +CONFIG_JOYSTICK_GUILLEMOT=m +CONFIG_JOYSTICK_INTERACT=m +CONFIG_JOYSTICK_SIDEWINDER=m +CONFIG_JOYSTICK_TMDC=m +CONFIG_JOYSTICK_IFORCE=m +CONFIG_JOYSTICK_IFORCE_USB=y +CONFIG_JOYSTICK_IFORCE_232=y +CONFIG_JOYSTICK_WARRIOR=m +CONFIG_JOYSTICK_MAGELLAN=m +CONFIG_JOYSTICK_SPACEORB=m +CONFIG_JOYSTICK_SPACEBALL=m +CONFIG_JOYSTICK_STINGER=m +CONFIG_JOYSTICK_TWIDJOY=m +CONFIG_JOYSTICK_ZHENHUA=m +CONFIG_JOYSTICK_AS5011=m +CONFIG_JOYSTICK_JOYDUMP=m +CONFIG_JOYSTICK_XPAD=m +CONFIG_JOYSTICK_XPAD_FF=y +CONFIG_JOYSTICK_XPAD_LEDS=y +# CONFIG_INPUT_TABLET is not set +CONFIG_INPUT_TOUCHSCREEN=y +CONFIG_TOUCHSCREEN_PROPERTIES=y +# CONFIG_TOUCHSCREEN_88PM860X is not set +CONFIG_TOUCHSCREEN_ADS7846=m +CONFIG_TOUCHSCREEN_AD7877=m +CONFIG_TOUCHSCREEN_AD7879=m +CONFIG_TOUCHSCREEN_AD7879_I2C=m +CONFIG_TOUCHSCREEN_AD7879_SPI=m +CONFIG_TOUCHSCREEN_AR1021_I2C=m +CONFIG_TOUCHSCREEN_ATMEL_MXT=m +CONFIG_TOUCHSCREEN_AUO_PIXCIR=m +CONFIG_TOUCHSCREEN_BU21013=m +CONFIG_TOUCHSCREEN_CHIPONE_ICN8318=m +CONFIG_TOUCHSCREEN_CY8CTMG110=m +CONFIG_TOUCHSCREEN_CYTTSP_CORE=m +CONFIG_TOUCHSCREEN_CYTTSP_I2C=m +CONFIG_TOUCHSCREEN_CYTTSP_SPI=m +CONFIG_TOUCHSCREEN_CYTTSP4_CORE=m +CONFIG_TOUCHSCREEN_CYTTSP4_I2C=m +CONFIG_TOUCHSCREEN_CYTTSP4_SPI=m +CONFIG_TOUCHSCREEN_DA9052=m +CONFIG_TOUCHSCREEN_DYNAPRO=m +CONFIG_TOUCHSCREEN_HAMPSHIRE=m +CONFIG_TOUCHSCREEN_EETI=m +CONFIG_TOUCHSCREEN_EGALAX=m +CONFIG_TOUCHSCREEN_FT6236=m +CONFIG_TOUCHSCREEN_FUJITSU=m +CONFIG_TOUCHSCREEN_GOODIX=m +CONFIG_TOUCHSCREEN_ILI210X=m +CONFIG_TOUCHSCREEN_GUNZE=m +CONFIG_TOUCHSCREEN_ELAN=m +CONFIG_TOUCHSCREEN_ELO=m +CONFIG_TOUCHSCREEN_WACOM_W8001=m +CONFIG_TOUCHSCREEN_WACOM_I2C=m +CONFIG_TOUCHSCREEN_MAX11801=m +CONFIG_TOUCHSCREEN_MCS5000=m +CONFIG_TOUCHSCREEN_MMS114=m +CONFIG_TOUCHSCREEN_MTOUCH=m +CONFIG_TOUCHSCREEN_IMX6UL_TSC=m +CONFIG_TOUCHSCREEN_INEXIO=m +CONFIG_TOUCHSCREEN_MK712=m +CONFIG_TOUCHSCREEN_PENMOUNT=m +CONFIG_TOUCHSCREEN_EDT_FT5X06=m +CONFIG_TOUCHSCREEN_TOUCHRIGHT=m +CONFIG_TOUCHSCREEN_TOUCHWIN=m +CONFIG_TOUCHSCREEN_PIXCIR=m +CONFIG_TOUCHSCREEN_WDT87XX_I2C=m +CONFIG_TOUCHSCREEN_WM97XX=m +CONFIG_TOUCHSCREEN_WM9705=y +CONFIG_TOUCHSCREEN_WM9712=y +CONFIG_TOUCHSCREEN_WM9713=y +CONFIG_TOUCHSCREEN_USB_COMPOSITE=m +CONFIG_TOUCHSCREEN_MC13783=m +CONFIG_TOUCHSCREEN_USB_EGALAX=y +CONFIG_TOUCHSCREEN_USB_PANJIT=y +CONFIG_TOUCHSCREEN_USB_3M=y +CONFIG_TOUCHSCREEN_USB_ITM=y +CONFIG_TOUCHSCREEN_USB_ETURBO=y +CONFIG_TOUCHSCREEN_USB_GUNZE=y +CONFIG_TOUCHSCREEN_USB_DMC_TSC10=y +CONFIG_TOUCHSCREEN_USB_IRTOUCH=y +CONFIG_TOUCHSCREEN_USB_IDEALTEK=y +CONFIG_TOUCHSCREEN_USB_GENERAL_TOUCH=y +CONFIG_TOUCHSCREEN_USB_GOTOP=y +CONFIG_TOUCHSCREEN_USB_JASTEC=y +CONFIG_TOUCHSCREEN_USB_ELO=y +CONFIG_TOUCHSCREEN_USB_E2I=y +CONFIG_TOUCHSCREEN_USB_ZYTRONIC=y +CONFIG_TOUCHSCREEN_USB_ETT_TC45USB=y +CONFIG_TOUCHSCREEN_USB_NEXIO=y +CONFIG_TOUCHSCREEN_USB_EASYTOUCH=y +CONFIG_TOUCHSCREEN_TOUCHIT213=m +CONFIG_TOUCHSCREEN_TSC_SERIO=m +CONFIG_TOUCHSCREEN_TSC200X_CORE=m +CONFIG_TOUCHSCREEN_TSC2004=m +CONFIG_TOUCHSCREEN_TSC2005=m +CONFIG_TOUCHSCREEN_TSC2007=m +CONFIG_TOUCHSCREEN_ST1232=m +CONFIG_TOUCHSCREEN_SUR40=m +CONFIG_TOUCHSCREEN_SX8654=m +CONFIG_TOUCHSCREEN_TPS6507X=m +CONFIG_TOUCHSCREEN_ZFORCE=m +CONFIG_TOUCHSCREEN_ROHM_BU21023=m +CONFIG_INPUT_MISC=y +# CONFIG_INPUT_88PM860X_ONKEY is not set +# CONFIG_INPUT_88PM80X_ONKEY is not set +CONFIG_INPUT_AD714X=m +CONFIG_INPUT_AD714X_I2C=m +CONFIG_INPUT_AD714X_SPI=m +CONFIG_INPUT_BMA150=m +CONFIG_INPUT_E3X0_BUTTON=m +CONFIG_INPUT_MC13783_PWRBUTTON=m +CONFIG_INPUT_MMA8450=y +CONFIG_INPUT_MPU3050=m +CONFIG_INPUT_GP2A=m +CONFIG_INPUT_GPIO_BEEPER=m +CONFIG_INPUT_GPIO_TILT_POLLED=m +CONFIG_INPUT_ATI_REMOTE2=m +CONFIG_INPUT_KEYSPAN_REMOTE=m +CONFIG_INPUT_KXTJ9=m +CONFIG_INPUT_KXTJ9_POLLED_MODE=y +CONFIG_INPUT_POWERMATE=m +CONFIG_INPUT_YEALINK=m +CONFIG_INPUT_CM109=m +CONFIG_INPUT_REGULATOR_HAPTIC=m +CONFIG_INPUT_UINPUT=m +CONFIG_INPUT_PCF8574=m +CONFIG_INPUT_PWM_BEEPER=m +CONFIG_INPUT_GPIO_ROTARY_ENCODER=m +CONFIG_INPUT_DA9052_ONKEY=m +CONFIG_INPUT_ADXL34X=m +CONFIG_INPUT_ADXL34X_I2C=m +CONFIG_INPUT_ADXL34X_SPI=m +CONFIG_INPUT_IMS_PCU=m +CONFIG_INPUT_CMA3000=m +CONFIG_INPUT_CMA3000_I2C=m +CONFIG_INPUT_SOC_BUTTON_ARRAY=m +CONFIG_INPUT_DRV260X_HAPTICS=m +CONFIG_INPUT_DRV2665_HAPTICS=m +CONFIG_INPUT_DRV2667_HAPTICS=m + +# +# Hardware I/O ports +# +CONFIG_SERIO=m +CONFIG_SERIO_SERPORT=m +# CONFIG_SERIO_PCIPS2 is not set +CONFIG_SERIO_LIBPS2=m +CONFIG_SERIO_RAW=m +CONFIG_SERIO_ALTERA_PS2=m +# CONFIG_SERIO_PS2MULT is not set +# CONFIG_SERIO_ARC_PS2 is not set +# CONFIG_SERIO_APBPS2 is not set +# CONFIG_USERIO is not set +CONFIG_GAMEPORT=m +# CONFIG_GAMEPORT_NS558 is not set +# CONFIG_GAMEPORT_L4 is not set +# CONFIG_GAMEPORT_EMU10K1 is not set +# CONFIG_GAMEPORT_FM801 is not set + +# +# Character devices +# +CONFIG_TTY=y +CONFIG_VT=y +CONFIG_CONSOLE_TRANSLATIONS=y +CONFIG_VT_CONSOLE=y +CONFIG_VT_CONSOLE_SLEEP=y +CONFIG_HW_CONSOLE=y +CONFIG_VT_HW_CONSOLE_BINDING=y +CONFIG_UNIX98_PTYS=y +# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set +# CONFIG_LEGACY_PTYS is not set +# CONFIG_SERIAL_NONSTANDARD is not set +# CONFIG_NOZOMI is not set +# CONFIG_N_GSM is not set +# CONFIG_TRACE_SINK is not set +CONFIG_DEVMEM=y +CONFIG_DEVKMEM=y + +# +# Serial drivers +# +CONFIG_SERIAL_EARLYCON=y +CONFIG_SERIAL_8250=y +CONFIG_SERIAL_8250_DEPRECATED_OPTIONS=y +CONFIG_SERIAL_8250_CONSOLE=y +CONFIG_SERIAL_8250_DMA=y +CONFIG_SERIAL_8250_PCI=y +CONFIG_SERIAL_8250_NR_UARTS=4 +CONFIG_SERIAL_8250_RUNTIME_UARTS=4 +# CONFIG_SERIAL_8250_EXTENDED is not set +CONFIG_SERIAL_8250_FSL=y +CONFIG_SERIAL_8250_DW=y +# CONFIG_SERIAL_8250_EM is not set +# CONFIG_SERIAL_8250_RT288X is not set +# CONFIG_SERIAL_8250_INGENIC is not set +# CONFIG_SERIAL_8250_MID is not set + +# +# Non-8250 serial port support +# +CONFIG_SERIAL_EARLYCON_ARM_SEMIHOST=y +CONFIG_SERIAL_MAX3100=m +CONFIG_SERIAL_MAX310X=m +CONFIG_SERIAL_IMX=y +CONFIG_SERIAL_IMX_CONSOLE=y +# CONFIG_SERIAL_UARTLITE is not set +CONFIG_SERIAL_CORE=y +CONFIG_SERIAL_CORE_CONSOLE=y +# CONFIG_SERIAL_JSM is not set +# CONFIG_SERIAL_OF_PLATFORM is not set +# CONFIG_SERIAL_SCCNXP is not set +# CONFIG_SERIAL_SC16IS7XX is not set +CONFIG_SERIAL_BCM63XX=y +CONFIG_SERIAL_BCM63XX_CONSOLE=y +# CONFIG_SERIAL_ALTERA_JTAGUART is not set +# CONFIG_SERIAL_ALTERA_UART is not set +# CONFIG_SERIAL_IFX6X60 is not set +# CONFIG_SERIAL_XILINX_PS_UART is not set +CONFIG_SERIAL_ARC=y +CONFIG_SERIAL_ARC_CONSOLE=y +CONFIG_SERIAL_ARC_NR_PORTS=1 +# CONFIG_SERIAL_RP2 is not set +CONFIG_SERIAL_FSL_LPUART=y +CONFIG_SERIAL_FSL_LPUART_CONSOLE=y +# CONFIG_SERIAL_CONEXANT_DIGICOLOR is not set +# CONFIG_SERIAL_ST_ASC is not set +# CONFIG_SERIAL_STM32 is not set +CONFIG_TTY_PRINTK=m +CONFIG_HVC_DRIVER=y +CONFIG_HVC_DCC=y +# CONFIG_VIRTIO_CONSOLE is not set +# CONFIG_IPMI_HANDLER is not set +CONFIG_HW_RANDOM=y +CONFIG_HW_RANDOM_TIMERIOMEM=m +# CONFIG_HW_RANDOM_VIRTIO is not set +# CONFIG_NVRAM is not set +# CONFIG_R3964 is not set +# CONFIG_APPLICOM is not set +CONFIG_RAW_DRIVER=m +CONFIG_MAX_RAW_DEVS=256 +# CONFIG_TCG_TPM is not set +CONFIG_DEVPORT=y +# CONFIG_XILLYBUS is not set + +# +# I2C support +# +CONFIG_I2C=y +CONFIG_I2C_BOARDINFO=y +CONFIG_I2C_COMPAT=y +CONFIG_I2C_CHARDEV=y +CONFIG_I2C_MUX=y + +# +# Multiplexer I2C Chip support +# +CONFIG_I2C_ARB_GPIO_CHALLENGE=y +CONFIG_I2C_MUX_GPIO=y +CONFIG_I2C_MUX_PCA9541=y +# CONFIG_I2C_MUX_PCA954x is not set +CONFIG_I2C_MUX_PINCTRL=y +# CONFIG_I2C_MUX_REG is not set +CONFIG_I2C_HELPER_AUTO=y +CONFIG_I2C_ALGOBIT=y + +# +# I2C Hardware Bus support +# + +# +# PC SMBus host controller drivers +# +# CONFIG_I2C_ALI1535 is not set +# CONFIG_I2C_ALI1563 is not set +# CONFIG_I2C_ALI15X3 is not set +# CONFIG_I2C_AMD756 is not set +# CONFIG_I2C_AMD8111 is not set +# CONFIG_I2C_I801 is not set +# CONFIG_I2C_ISCH is not set +# CONFIG_I2C_PIIX4 is not set +# CONFIG_I2C_NFORCE2 is not set +# CONFIG_I2C_SIS5595 is not set +# CONFIG_I2C_SIS630 is not set +# CONFIG_I2C_SIS96X is not set +# CONFIG_I2C_VIA is not set +# CONFIG_I2C_VIAPRO is not set + +# +# I2C system bus drivers (mostly embedded / system-on-chip) +# +# CONFIG_I2C_CBUS_GPIO is not set +CONFIG_I2C_DESIGNWARE_CORE=m +CONFIG_I2C_DESIGNWARE_PLATFORM=m +# CONFIG_I2C_DESIGNWARE_PCI is not set +# CONFIG_I2C_EMEV2 is not set +CONFIG_I2C_GPIO=y +CONFIG_I2C_IMX=y +CONFIG_I2C_OCORES=y +# CONFIG_I2C_PCA_PLATFORM is not set +# CONFIG_I2C_PXA_PCI is not set +# CONFIG_I2C_RK3X is not set +# CONFIG_I2C_SIMTEC is not set +# CONFIG_I2C_XILINX is not set + +# +# External I2C/SMBus adapter drivers +# +# CONFIG_I2C_DIOLAN_U2C is not set +# CONFIG_I2C_PARPORT_LIGHT is not set +# CONFIG_I2C_ROBOTFUZZ_OSIF is not set +# CONFIG_I2C_TAOS_EVM is not set +# CONFIG_I2C_TINY_USB is not set + +# +# Other I2C/SMBus bus drivers +# +# CONFIG_I2C_STUB is not set +CONFIG_I2C_SLAVE=y +CONFIG_I2C_SLAVE_EEPROM=m +# CONFIG_I2C_DEBUG_CORE is not set +# CONFIG_I2C_DEBUG_ALGO is not set +# CONFIG_I2C_DEBUG_BUS is not set +CONFIG_SPI=y +CONFIG_SPI_MASTER=y + +# +# SPI Master Controller Drivers +# +# CONFIG_SPI_ALTERA is not set +CONFIG_SPI_BITBANG=y +# CONFIG_SPI_CADENCE is not set +CONFIG_SPI_GPIO=y +CONFIG_SPI_IMX=m +# CONFIG_SPI_FSL_SPI is not set +# CONFIG_SPI_OC_TINY is not set +# CONFIG_SPI_PXA2XX is not set +# CONFIG_SPI_PXA2XX_PCI is not set +# CONFIG_SPI_ROCKCHIP is not set +# CONFIG_SPI_SC18IS602 is not set +# CONFIG_SPI_XCOMM is not set +# CONFIG_SPI_XILINX is not set +# CONFIG_SPI_ZYNQMP_GQSPI is not set +# CONFIG_SPI_DESIGNWARE is not set + +# +# SPI Protocol Masters +# +CONFIG_SPI_SPIDEV=y +# CONFIG_SPI_TLE62X0 is not set +# CONFIG_SPMI is not set +# CONFIG_HSI is not set + +# +# PPS support +# +CONFIG_PPS=y +# CONFIG_PPS_DEBUG is not set +# CONFIG_NTP_PPS is not set + +# +# PPS clients support +# +# CONFIG_PPS_CLIENT_KTIMER is not set +CONFIG_PPS_CLIENT_LDISC=m +CONFIG_PPS_CLIENT_GPIO=m + +# +# PPS generators support +# + +# +# PTP clock support +# +CONFIG_PTP_1588_CLOCK=y +CONFIG_PTP_1588_CLOCK_GIANFAR=y + +# +# Enable PHYLIB and NETWORK_PHY_TIMESTAMPING to see the additional clocks. +# +CONFIG_PINCTRL=y + +# +# Pin controllers +# +CONFIG_PINMUX=y +CONFIG_PINCONF=y +CONFIG_GENERIC_PINCONF=y +# CONFIG_PINCTRL_AMD is not set +CONFIG_PINCTRL_SINGLE=y +CONFIG_PINCTRL_IMX=y +CONFIG_PINCTRL_IMX6Q=y +CONFIG_ARCH_HAVE_CUSTOM_GPIO_H=y +CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y +CONFIG_ARCH_REQUIRE_GPIOLIB=y +CONFIG_GPIOLIB=y +CONFIG_GPIO_DEVRES=y +CONFIG_OF_GPIO=y +CONFIG_GPIOLIB_IRQCHIP=y +CONFIG_GPIO_SYSFS=y +CONFIG_GPIO_GENERIC=y + +# +# Memory mapped GPIO drivers +# +CONFIG_GPIO_74XX_MMIO=y +# CONFIG_GPIO_ALTERA is not set +# CONFIG_GPIO_DWAPB is not set +# CONFIG_GPIO_EM is not set +CONFIG_GPIO_GENERIC_PLATFORM=y +# CONFIG_GPIO_GRGPIO is not set +CONFIG_GPIO_MXC=y +CONFIG_GPIO_SYSCON=y +# CONFIG_GPIO_VX855 is not set +# CONFIG_GPIO_XILINX is not set +# CONFIG_GPIO_ZEVIO is not set +# CONFIG_GPIO_ZX is not set + +# +# I2C GPIO expanders +# +CONFIG_GPIO_ADP5588=m +CONFIG_GPIO_ADNP=m +# CONFIG_GPIO_MAX7300 is not set +# CONFIG_GPIO_MAX732X is not set +CONFIG_GPIO_PCA953X=y +CONFIG_GPIO_PCA953X_IRQ=y +CONFIG_GPIO_PCF857X=m +CONFIG_GPIO_SX150X=y + +# +# MFD GPIO expanders +# +# CONFIG_GPIO_DA9052 is not set + +# +# PCI GPIO expanders +# +# CONFIG_GPIO_AMD8111 is not set +# CONFIG_GPIO_ML_IOH is not set +# CONFIG_GPIO_RDC321X is not set + +# +# SPI GPIO expanders +# +CONFIG_GPIO_74X164=y +# CONFIG_GPIO_MAX7301 is not set +CONFIG_GPIO_MC33880=y + +# +# SPI or I2C GPIO expanders +# +CONFIG_GPIO_MCP23S08=y + +# +# USB GPIO expanders +# +CONFIG_W1=m +CONFIG_W1_CON=y + +# +# 1-wire Bus Masters +# +CONFIG_W1_MASTER_MATROX=m +CONFIG_W1_MASTER_DS2490=m +CONFIG_W1_MASTER_DS2482=m +CONFIG_W1_MASTER_MXC=m +CONFIG_W1_MASTER_DS1WM=m +CONFIG_W1_MASTER_GPIO=m + +# +# 1-wire Slaves +# +CONFIG_W1_SLAVE_THERM=m +CONFIG_W1_SLAVE_SMEM=m +CONFIG_W1_SLAVE_DS2408=m +CONFIG_W1_SLAVE_DS2408_READBACK=y +CONFIG_W1_SLAVE_DS2413=m +CONFIG_W1_SLAVE_DS2406=m +CONFIG_W1_SLAVE_DS2423=m +CONFIG_W1_SLAVE_DS2431=m +CONFIG_W1_SLAVE_DS2433=m +CONFIG_W1_SLAVE_DS2433_CRC=y +CONFIG_W1_SLAVE_DS2760=m +CONFIG_W1_SLAVE_DS2780=m +CONFIG_W1_SLAVE_DS2781=m +CONFIG_W1_SLAVE_DS28E04=m +CONFIG_W1_SLAVE_BQ27000=m +CONFIG_POWER_SUPPLY=y +# CONFIG_POWER_SUPPLY_DEBUG is not set +# CONFIG_PDA_POWER is not set +# CONFIG_GENERIC_ADC_BATTERY is not set +CONFIG_TEST_POWER=m +# CONFIG_BATTERY_88PM860X is not set +# CONFIG_BATTERY_DS2760 is not set +# CONFIG_BATTERY_DS2780 is not set +# CONFIG_BATTERY_DS2781 is not set +# CONFIG_BATTERY_DS2782 is not set +# CONFIG_BATTERY_SBS is not set +# CONFIG_BATTERY_BQ27XXX is not set +# CONFIG_BATTERY_DA9052 is not set +# CONFIG_BATTERY_MAX17040 is not set +# CONFIG_BATTERY_MAX17042 is not set +# CONFIG_CHARGER_ISP1704 is not set +# CONFIG_CHARGER_MAX8903 is not set +# CONFIG_CHARGER_LP8727 is not set +CONFIG_CHARGER_GPIO=m +# CONFIG_CHARGER_MANAGER is not set +# CONFIG_CHARGER_BQ2415X is not set +# CONFIG_CHARGER_BQ24190 is not set +# CONFIG_CHARGER_BQ24257 is not set +# CONFIG_CHARGER_BQ24735 is not set +# CONFIG_CHARGER_BQ25890 is not set +# CONFIG_CHARGER_SMB347 is not set +# CONFIG_BATTERY_GAUGE_LTC2941 is not set +# CONFIG_CHARGER_RT9455 is not set +CONFIG_POWER_RESET=y +# CONFIG_POWER_RESET_BRCMSTB is not set +CONFIG_POWER_RESET_GPIO=y +CONFIG_POWER_RESET_GPIO_RESTART=y +CONFIG_POWER_RESET_IMX=y +CONFIG_POWER_RESET_LTC2952=y +CONFIG_POWER_RESET_RESTART=y +CONFIG_POWER_RESET_VERSATILE=y +# CONFIG_POWER_RESET_SNVS is not set +CONFIG_POWER_RESET_SYSCON=y +# CONFIG_POWER_RESET_SYSCON_POWEROFF is not set +CONFIG_POWER_AVS=y +CONFIG_HWMON=y +# CONFIG_HWMON_VID is not set +# CONFIG_HWMON_DEBUG_CHIP is not set + +# +# Native drivers +# +# CONFIG_SENSORS_AD7314 is not set +# CONFIG_SENSORS_AD7414 is not set +# CONFIG_SENSORS_AD7418 is not set +# CONFIG_SENSORS_ADM1021 is not set +# CONFIG_SENSORS_ADM1025 is not set +# CONFIG_SENSORS_ADM1026 is not set +# CONFIG_SENSORS_ADM1029 is not set +# CONFIG_SENSORS_ADM1031 is not set +# CONFIG_SENSORS_ADM9240 is not set +# CONFIG_SENSORS_ADT7310 is not set +# CONFIG_SENSORS_ADT7410 is not set +# CONFIG_SENSORS_ADT7411 is not set +# CONFIG_SENSORS_ADT7462 is not set +# CONFIG_SENSORS_ADT7470 is not set +# CONFIG_SENSORS_ADT7475 is not set +# CONFIG_SENSORS_ASC7621 is not set +# CONFIG_SENSORS_ATXP1 is not set +# CONFIG_SENSORS_DS620 is not set +# CONFIG_SENSORS_DS1621 is not set +# CONFIG_SENSORS_DA9052_ADC is not set +# CONFIG_SENSORS_I5K_AMB is not set +# CONFIG_SENSORS_F71805F is not set +# CONFIG_SENSORS_F71882FG is not set +# CONFIG_SENSORS_F75375S is not set +CONFIG_SENSORS_MC13783_ADC=y +# CONFIG_SENSORS_GL518SM is not set +# CONFIG_SENSORS_GL520SM is not set +# CONFIG_SENSORS_G760A is not set +# CONFIG_SENSORS_G762 is not set +# CONFIG_SENSORS_GPIO_FAN is not set +# CONFIG_SENSORS_HIH6130 is not set +# CONFIG_SENSORS_IIO_HWMON is not set +# CONFIG_SENSORS_IT87 is not set +# CONFIG_SENSORS_JC42 is not set +# CONFIG_SENSORS_POWR1220 is not set +# CONFIG_SENSORS_LINEAGE is not set +# CONFIG_SENSORS_LTC2945 is not set +# CONFIG_SENSORS_LTC4151 is not set +# CONFIG_SENSORS_LTC4215 is not set +# CONFIG_SENSORS_LTC4222 is not set +# CONFIG_SENSORS_LTC4245 is not set +# CONFIG_SENSORS_LTC4260 is not set +# CONFIG_SENSORS_LTC4261 is not set +CONFIG_SENSORS_MAX1111=y +CONFIG_SENSORS_MAX16065=y +CONFIG_SENSORS_MAX1619=y +CONFIG_SENSORS_MAX1668=y +# CONFIG_SENSORS_MAX197 is not set +# CONFIG_SENSORS_MAX6639 is not set +# CONFIG_SENSORS_MAX6642 is not set +# CONFIG_SENSORS_MAX6650 is not set +# CONFIG_SENSORS_MAX6697 is not set +# CONFIG_SENSORS_MAX31790 is not set +# CONFIG_SENSORS_HTU21 is not set +# CONFIG_SENSORS_MCP3021 is not set +# CONFIG_SENSORS_ADCXX is not set +# CONFIG_SENSORS_LM63 is not set +# CONFIG_SENSORS_LM70 is not set +# CONFIG_SENSORS_LM73 is not set +# CONFIG_SENSORS_LM75 is not set +# CONFIG_SENSORS_LM77 is not set +# CONFIG_SENSORS_LM78 is not set +# CONFIG_SENSORS_LM80 is not set +# CONFIG_SENSORS_LM83 is not set +# CONFIG_SENSORS_LM85 is not set +# CONFIG_SENSORS_LM87 is not set +# CONFIG_SENSORS_LM90 is not set +# CONFIG_SENSORS_LM92 is not set +# CONFIG_SENSORS_LM93 is not set +# CONFIG_SENSORS_LM95234 is not set +# CONFIG_SENSORS_LM95241 is not set +# CONFIG_SENSORS_LM95245 is not set +# CONFIG_SENSORS_PC87360 is not set +# CONFIG_SENSORS_PC87427 is not set +# CONFIG_SENSORS_NTC_THERMISTOR is not set +# CONFIG_SENSORS_NCT6683 is not set +# CONFIG_SENSORS_NCT6775 is not set +# CONFIG_SENSORS_NCT7802 is not set +# CONFIG_SENSORS_NCT7904 is not set +# CONFIG_SENSORS_PCF8591 is not set +# CONFIG_PMBUS is not set +CONFIG_SENSORS_PWM_FAN=y +# CONFIG_SENSORS_SHT15 is not set +# CONFIG_SENSORS_SHT21 is not set +# CONFIG_SENSORS_SHTC1 is not set +# CONFIG_SENSORS_SIS5595 is not set +# CONFIG_SENSORS_DME1737 is not set +# CONFIG_SENSORS_EMC1403 is not set +# CONFIG_SENSORS_EMC2103 is not set +# CONFIG_SENSORS_EMC6W201 is not set +# CONFIG_SENSORS_SMSC47M1 is not set +# CONFIG_SENSORS_SMSC47M192 is not set +# CONFIG_SENSORS_SMSC47B397 is not set +# CONFIG_SENSORS_SCH56XX_COMMON is not set +# CONFIG_SENSORS_SCH5627 is not set +# CONFIG_SENSORS_SCH5636 is not set +# CONFIG_SENSORS_SMM665 is not set +# CONFIG_SENSORS_ADC128D818 is not set +# CONFIG_SENSORS_ADS1015 is not set +# CONFIG_SENSORS_ADS7828 is not set +# CONFIG_SENSORS_ADS7871 is not set +# CONFIG_SENSORS_AMC6821 is not set +# CONFIG_SENSORS_INA209 is not set +# CONFIG_SENSORS_INA2XX is not set +# CONFIG_SENSORS_TC74 is not set +# CONFIG_SENSORS_THMC50 is not set +# CONFIG_SENSORS_TMP102 is not set +# CONFIG_SENSORS_TMP103 is not set +# CONFIG_SENSORS_TMP401 is not set +# CONFIG_SENSORS_TMP421 is not set +# CONFIG_SENSORS_VIA686A is not set +# CONFIG_SENSORS_VT1211 is not set +# CONFIG_SENSORS_VT8231 is not set +# CONFIG_SENSORS_W83781D is not set +# CONFIG_SENSORS_W83791D is not set +# CONFIG_SENSORS_W83792D is not set +# CONFIG_SENSORS_W83793 is not set +# CONFIG_SENSORS_W83795 is not set +# CONFIG_SENSORS_W83L785TS is not set +# CONFIG_SENSORS_W83L786NG is not set +# CONFIG_SENSORS_W83627HF is not set +# CONFIG_SENSORS_W83627EHF is not set +CONFIG_THERMAL=y +CONFIG_THERMAL_HWMON=y +CONFIG_THERMAL_OF=y +# CONFIG_THERMAL_WRITABLE_TRIPS is not set +CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE=y +# CONFIG_THERMAL_DEFAULT_GOV_FAIR_SHARE is not set +# CONFIG_THERMAL_DEFAULT_GOV_USER_SPACE is not set +# CONFIG_THERMAL_DEFAULT_GOV_POWER_ALLOCATOR is not set +CONFIG_THERMAL_GOV_FAIR_SHARE=y +CONFIG_THERMAL_GOV_STEP_WISE=y +# CONFIG_THERMAL_GOV_BANG_BANG is not set +CONFIG_THERMAL_GOV_USER_SPACE=y +# CONFIG_THERMAL_GOV_POWER_ALLOCATOR is not set +CONFIG_CPU_THERMAL=y +CONFIG_CLOCK_THERMAL=y +# CONFIG_DEVFREQ_THERMAL is not set +# CONFIG_THERMAL_EMULATION is not set +CONFIG_IMX_THERMAL=y +CONFIG_WATCHDOG=y +CONFIG_WATCHDOG_CORE=y +# CONFIG_WATCHDOG_NOWAYOUT is not set + +# +# Watchdog Device Drivers +# +CONFIG_SOFT_WATCHDOG=m +# CONFIG_DA9052_WATCHDOG is not set +CONFIG_GPIO_WATCHDOG=m +# CONFIG_XILINX_WATCHDOG is not set +# CONFIG_CADENCE_WATCHDOG is not set +# CONFIG_DW_WATCHDOG is not set +# CONFIG_MAX63XX_WATCHDOG is not set +CONFIG_IMX2_WDT=y +# CONFIG_ALIM7101_WDT is not set +# CONFIG_I6300ESB_WDT is not set +# CONFIG_BCM7038_WDT is not set +# CONFIG_MEN_A21_WDT is not set + +# +# PCI-based Watchdog Cards +# +# CONFIG_PCIPCWATCHDOG is not set +# CONFIG_WDTPCI is not set + +# +# USB-based Watchdog Cards +# +# CONFIG_USBPCWATCHDOG is not set +CONFIG_SSB_POSSIBLE=y + +# +# Sonics Silicon Backplane +# +CONFIG_SSB=y +CONFIG_SSB_SPROM=y +CONFIG_SSB_BLOCKIO=y +CONFIG_SSB_PCIHOST_POSSIBLE=y +CONFIG_SSB_PCIHOST=y +CONFIG_SSB_B43_PCI_BRIDGE=y +CONFIG_SSB_SDIOHOST_POSSIBLE=y +CONFIG_SSB_SDIOHOST=y +# CONFIG_SSB_HOST_SOC is not set +# CONFIG_SSB_SILENT is not set +# CONFIG_SSB_DEBUG is not set +CONFIG_SSB_DRIVER_PCICORE_POSSIBLE=y +CONFIG_SSB_DRIVER_PCICORE=y +# CONFIG_SSB_DRIVER_GPIO is not set +CONFIG_BCMA_POSSIBLE=y + +# +# Broadcom specific AMBA +# +CONFIG_BCMA=y +CONFIG_BCMA_BLOCKIO=y +CONFIG_BCMA_HOST_PCI_POSSIBLE=y +CONFIG_BCMA_HOST_PCI=y +# CONFIG_BCMA_HOST_SOC is not set +CONFIG_BCMA_DRIVER_PCI=y +# CONFIG_BCMA_DRIVER_GMAC_CMN is not set +# CONFIG_BCMA_DRIVER_GPIO is not set +# CONFIG_BCMA_DEBUG is not set + +# +# Multifunction device drivers +# +CONFIG_MFD_CORE=y +# CONFIG_MFD_AS3711 is not set +# CONFIG_MFD_AS3722 is not set +# CONFIG_PMIC_ADP5520 is not set +# CONFIG_MFD_AAT2870_CORE is not set +# CONFIG_MFD_ATMEL_FLEXCOM is not set +# CONFIG_MFD_ATMEL_HLCDC is not set +# CONFIG_MFD_BCM590XX is not set +# CONFIG_MFD_AXP20X is not set +# CONFIG_MFD_CROS_EC is not set +# CONFIG_MFD_ASIC3 is not set +# CONFIG_PMIC_DA903X is not set +CONFIG_PMIC_DA9052=y +CONFIG_MFD_DA9052_SPI=y +CONFIG_MFD_DA9052_I2C=y +# CONFIG_MFD_DA9055 is not set +# CONFIG_MFD_DA9062 is not set +# CONFIG_MFD_DA9063 is not set +# CONFIG_MFD_DA9150 is not set +CONFIG_MFD_MXC_HDMI=y +# CONFIG_MFD_DLN2 is not set +CONFIG_MFD_MC13XXX=y +CONFIG_MFD_MC13XXX_SPI=y +CONFIG_MFD_MC13XXX_I2C=y +# CONFIG_MFD_HI6421_PMIC is not set +# CONFIG_HTC_EGPIO is not set +# CONFIG_HTC_PASIC3 is not set +# CONFIG_HTC_I2CPLD is not set +# CONFIG_LPC_ICH is not set +# CONFIG_LPC_SCH is not set +# CONFIG_INTEL_SOC_PMIC is not set +# CONFIG_MFD_JANZ_CMODIO is not set +# CONFIG_MFD_KEMPLD is not set +CONFIG_MFD_88PM800=y +CONFIG_MFD_88PM805=y +CONFIG_MFD_88PM860X=y +# CONFIG_MFD_MAX14577 is not set +# CONFIG_MFD_MAX77686 is not set +# CONFIG_MFD_MAX77693 is not set +# CONFIG_MFD_MAX77843 is not set +# CONFIG_MFD_MAX8907 is not set +# CONFIG_MFD_MAX8925 is not set +# CONFIG_MFD_MAX8997 is not set +# CONFIG_MFD_MAX8998 is not set +# CONFIG_MFD_MT6397 is not set +# CONFIG_MFD_MENF21BMC is not set +# CONFIG_EZX_PCAP is not set +# CONFIG_MFD_VIPERBOARD is not set +# CONFIG_MFD_RETU is not set +# CONFIG_MFD_PCF50633 is not set +# CONFIG_UCB1400_CORE is not set +# CONFIG_MFD_PM8921_CORE is not set +# CONFIG_MFD_RDC321X is not set +# CONFIG_MFD_RTSX_PCI is not set +# CONFIG_MFD_RT5033 is not set +# CONFIG_MFD_RTSX_USB is not set +# CONFIG_MFD_RC5T583 is not set +# CONFIG_MFD_RK808 is not set +# CONFIG_MFD_RN5T618 is not set +# CONFIG_MFD_SEC_CORE is not set +CONFIG_MFD_SI476X_CORE=y +# CONFIG_MFD_SM501 is not set +# CONFIG_MFD_SKY81452 is not set +# CONFIG_MFD_SMSC is not set +# CONFIG_ABX500_CORE is not set +# CONFIG_MFD_STMPE is not set +CONFIG_MFD_SYSCON=y +# CONFIG_MFD_TI_AM335X_TSCADC is not set +# CONFIG_MFD_LP3943 is not set +# CONFIG_MFD_LP8788 is not set +# CONFIG_MFD_PALMAS is not set +# CONFIG_TPS6105X is not set +# CONFIG_TPS65010 is not set +# CONFIG_TPS6507X is not set +# CONFIG_MFD_TPS65090 is not set +# CONFIG_MFD_TPS65217 is not set +# CONFIG_MFD_TPS65218 is not set +# CONFIG_MFD_TPS6586X is not set +# CONFIG_MFD_TPS65910 is not set +# CONFIG_MFD_TPS65912 is not set +# CONFIG_MFD_TPS65912_I2C is not set +# CONFIG_MFD_TPS65912_SPI is not set +# CONFIG_MFD_TPS80031 is not set +# CONFIG_TWL4030_CORE is not set +# CONFIG_TWL6040_CORE is not set +CONFIG_MFD_WL1273_CORE=m +# CONFIG_MFD_LM3533 is not set +# CONFIG_MFD_TC3589X is not set +# CONFIG_MFD_TMIO is not set +# CONFIG_MFD_T7L66XB is not set +# CONFIG_MFD_TC6387XB is not set +# CONFIG_MFD_TC6393XB is not set +# CONFIG_MFD_VX855 is not set +# CONFIG_MFD_ARIZONA_I2C is not set +# CONFIG_MFD_ARIZONA_SPI is not set +# CONFIG_MFD_WM8400 is not set +# CONFIG_MFD_WM831X_I2C is not set +# CONFIG_MFD_WM831X_SPI is not set +# CONFIG_MFD_WM8350_I2C is not set +# CONFIG_MFD_WM8994 is not set +# CONFIG_MFD_TDA1997X is not set +CONFIG_REGULATOR=y +# CONFIG_REGULATOR_DEBUG is not set +CONFIG_REGULATOR_FIXED_VOLTAGE=y +CONFIG_REGULATOR_VIRTUAL_CONSUMER=y +CONFIG_REGULATOR_USERSPACE_CONSUMER=m +CONFIG_REGULATOR_88PM800=y +CONFIG_REGULATOR_88PM8607=y +# CONFIG_REGULATOR_ACT8865 is not set +# CONFIG_REGULATOR_AD5398 is not set +CONFIG_REGULATOR_ANATOP=y +# CONFIG_REGULATOR_DA9052 is not set +# CONFIG_REGULATOR_DA9210 is not set +# CONFIG_REGULATOR_DA9211 is not set +# CONFIG_REGULATOR_FAN53555 is not set +CONFIG_REGULATOR_GPIO=y +# CONFIG_REGULATOR_ISL9305 is not set +# CONFIG_REGULATOR_ISL6271A is not set +# CONFIG_REGULATOR_LP3971 is not set +# CONFIG_REGULATOR_LP3972 is not set +# CONFIG_REGULATOR_LP872X is not set +# CONFIG_REGULATOR_LP8755 is not set +# CONFIG_REGULATOR_LTC3589 is not set +# CONFIG_REGULATOR_LTC3676 is not set +# CONFIG_REGULATOR_MAX1586 is not set +# CONFIG_REGULATOR_MAX8649 is not set +# CONFIG_REGULATOR_MAX8660 is not set +# CONFIG_REGULATOR_MAX8952 is not set +# CONFIG_REGULATOR_MAX8973 is not set +CONFIG_REGULATOR_MC13XXX_CORE=y +CONFIG_REGULATOR_MC13783=y +CONFIG_REGULATOR_MC13892=y +# CONFIG_REGULATOR_MT6311 is not set +CONFIG_REGULATOR_PFUZE100=y +CONFIG_REGULATOR_PWM=y +# CONFIG_REGULATOR_TPS51632 is not set +# CONFIG_REGULATOR_TPS62360 is not set +# CONFIG_REGULATOR_TPS65023 is not set +# CONFIG_REGULATOR_TPS6507X is not set +# CONFIG_REGULATOR_TPS6524X is not set +CONFIG_MEDIA_SUPPORT=y + +# +# Multimedia core support +# +CONFIG_MEDIA_CAMERA_SUPPORT=y +CONFIG_MEDIA_ANALOG_TV_SUPPORT=y +CONFIG_MEDIA_DIGITAL_TV_SUPPORT=y +CONFIG_MEDIA_RADIO_SUPPORT=y +CONFIG_MEDIA_SDR_SUPPORT=y +CONFIG_MEDIA_RC_SUPPORT=y +CONFIG_MEDIA_CONTROLLER=y +CONFIG_VIDEO_DEV=y +CONFIG_VIDEO_V4L2_SUBDEV_API=y +CONFIG_VIDEO_V4L2=y +# CONFIG_VIDEO_ADV_DEBUG is not set +# CONFIG_VIDEO_FIXED_MINOR_RANGES is not set +CONFIG_VIDEO_TUNER=m +CONFIG_V4L2_MEM2MEM_DEV=m +CONFIG_VIDEO_V4L2_INT_DEVICE=m +CONFIG_VIDEOBUF_GEN=y +CONFIG_VIDEOBUF_DMA_SG=m +CONFIG_VIDEOBUF_VMALLOC=m +CONFIG_VIDEOBUF_DMA_CONTIG=y +CONFIG_VIDEOBUF_DVB=m +CONFIG_VIDEOBUF2_CORE=y +CONFIG_VIDEOBUF2_MEMOPS=m +CONFIG_VIDEOBUF2_DMA_CONTIG=m +CONFIG_VIDEOBUF2_VMALLOC=m +CONFIG_VIDEOBUF2_DMA_SG=m +CONFIG_VIDEOBUF2_DVB=m +CONFIG_DVB_CORE=y +CONFIG_DVB_NET=y +CONFIG_TTPCI_EEPROM=m +CONFIG_DVB_MAX_ADAPTERS=8 +# CONFIG_DVB_DYNAMIC_MINORS is not set + +# +# Media drivers +# +CONFIG_RC_CORE=y +CONFIG_RC_MAP=y +CONFIG_RC_DECODERS=y +CONFIG_LIRC=m +CONFIG_IR_LIRC_CODEC=m +CONFIG_IR_NEC_DECODER=m +CONFIG_IR_RC5_DECODER=m +CONFIG_IR_RC6_DECODER=m +CONFIG_IR_JVC_DECODER=m +CONFIG_IR_SONY_DECODER=m +CONFIG_IR_SANYO_DECODER=m +CONFIG_IR_SHARP_DECODER=m +CONFIG_IR_MCE_KBD_DECODER=m +CONFIG_IR_XMP_DECODER=m +CONFIG_RC_DEVICES=y +CONFIG_RC_ATI_REMOTE=m +CONFIG_IR_HIX5HD2=m +CONFIG_IR_IMON=m +CONFIG_IR_MCEUSB=m +CONFIG_IR_REDRAT3=m +CONFIG_IR_STREAMZAP=m +CONFIG_IR_IGORPLUGUSB=m +CONFIG_IR_IGUANA=m +CONFIG_IR_TTUSBIR=m +CONFIG_RC_LOOPBACK=m +CONFIG_IR_GPIO_CIR=m +CONFIG_MEDIA_USB_SUPPORT=y + +# +# Webcam devices +# +CONFIG_USB_VIDEO_CLASS=m +CONFIG_USB_VIDEO_CLASS_INPUT_EVDEV=y +CONFIG_USB_GSPCA=m +CONFIG_USB_M5602=m +CONFIG_USB_STV06XX=m +CONFIG_USB_GL860=m +CONFIG_USB_GSPCA_BENQ=m +CONFIG_USB_GSPCA_CONEX=m +CONFIG_USB_GSPCA_CPIA1=m +CONFIG_USB_GSPCA_DTCS033=m +CONFIG_USB_GSPCA_ETOMS=m +CONFIG_USB_GSPCA_FINEPIX=m +CONFIG_USB_GSPCA_JEILINJ=m +CONFIG_USB_GSPCA_JL2005BCD=m +CONFIG_USB_GSPCA_KINECT=m +CONFIG_USB_GSPCA_KONICA=m +CONFIG_USB_GSPCA_MARS=m +CONFIG_USB_GSPCA_MR97310A=m +CONFIG_USB_GSPCA_NW80X=m +CONFIG_USB_GSPCA_OV519=m +CONFIG_USB_GSPCA_OV534=m +CONFIG_USB_GSPCA_OV534_9=m +CONFIG_USB_GSPCA_PAC207=m +CONFIG_USB_GSPCA_PAC7302=m +CONFIG_USB_GSPCA_PAC7311=m +CONFIG_USB_GSPCA_SE401=m +CONFIG_USB_GSPCA_SN9C2028=m +CONFIG_USB_GSPCA_SN9C20X=m +CONFIG_USB_GSPCA_SONIXB=m +CONFIG_USB_GSPCA_SONIXJ=m +CONFIG_USB_GSPCA_SPCA500=m +CONFIG_USB_GSPCA_SPCA501=m +CONFIG_USB_GSPCA_SPCA505=m +CONFIG_USB_GSPCA_SPCA506=m +CONFIG_USB_GSPCA_SPCA508=m +CONFIG_USB_GSPCA_SPCA561=m +CONFIG_USB_GSPCA_SPCA1528=m +CONFIG_USB_GSPCA_SQ905=m +CONFIG_USB_GSPCA_SQ905C=m +CONFIG_USB_GSPCA_SQ930X=m +CONFIG_USB_GSPCA_STK014=m +CONFIG_USB_GSPCA_STK1135=m +CONFIG_USB_GSPCA_STV0680=m +CONFIG_USB_GSPCA_SUNPLUS=m +CONFIG_USB_GSPCA_T613=m +CONFIG_USB_GSPCA_TOPRO=m +# CONFIG_USB_GSPCA_TOUPTEK is not set +CONFIG_USB_GSPCA_TV8532=m +CONFIG_USB_GSPCA_VC032X=m +CONFIG_USB_GSPCA_VICAM=m +CONFIG_USB_GSPCA_XIRLINK_CIT=m +CONFIG_USB_GSPCA_ZC3XX=m +CONFIG_USB_PWC=m +# CONFIG_USB_PWC_DEBUG is not set +CONFIG_USB_PWC_INPUT_EVDEV=y +CONFIG_VIDEO_CPIA2=m +CONFIG_USB_ZR364XX=m +CONFIG_USB_STKWEBCAM=m +CONFIG_USB_S2255=m +CONFIG_VIDEO_USBTV=m + +# +# Analog TV USB devices +# +CONFIG_VIDEO_PVRUSB2=m +CONFIG_VIDEO_PVRUSB2_SYSFS=y +CONFIG_VIDEO_PVRUSB2_DVB=y +# CONFIG_VIDEO_PVRUSB2_DEBUGIFC is not set +CONFIG_VIDEO_HDPVR=m +CONFIG_VIDEO_USBVISION=m +CONFIG_VIDEO_STK1160_COMMON=m +CONFIG_VIDEO_STK1160_AC97=y +CONFIG_VIDEO_STK1160=m +CONFIG_VIDEO_GO7007=m +CONFIG_VIDEO_GO7007_USB=m +CONFIG_VIDEO_GO7007_LOADER=m +CONFIG_VIDEO_GO7007_USB_S2250_BOARD=m + +# +# Analog/digital TV USB devices +# +CONFIG_VIDEO_AU0828=m +CONFIG_VIDEO_AU0828_V4L2=y +CONFIG_VIDEO_AU0828_RC=y +CONFIG_VIDEO_CX231XX=m +CONFIG_VIDEO_CX231XX_RC=y +CONFIG_VIDEO_CX231XX_ALSA=m +CONFIG_VIDEO_CX231XX_DVB=m +CONFIG_VIDEO_TM6000=m +CONFIG_VIDEO_TM6000_ALSA=m +CONFIG_VIDEO_TM6000_DVB=m + +# +# Digital TV USB devices +# +CONFIG_DVB_USB=m +# CONFIG_DVB_USB_DEBUG is not set +CONFIG_DVB_USB_A800=m +CONFIG_DVB_USB_DIBUSB_MB=m +CONFIG_DVB_USB_DIBUSB_MB_FAULTY=y +CONFIG_DVB_USB_DIBUSB_MC=m +CONFIG_DVB_USB_DIB0700=m +CONFIG_DVB_USB_UMT_010=m +CONFIG_DVB_USB_CXUSB=m +CONFIG_DVB_USB_M920X=m +CONFIG_DVB_USB_DIGITV=m +CONFIG_DVB_USB_VP7045=m +CONFIG_DVB_USB_VP702X=m +CONFIG_DVB_USB_GP8PSK=m +CONFIG_DVB_USB_NOVA_T_USB2=m +CONFIG_DVB_USB_TTUSB2=m +CONFIG_DVB_USB_DTT200U=m +CONFIG_DVB_USB_OPERA1=m +CONFIG_DVB_USB_AF9005=m +CONFIG_DVB_USB_AF9005_REMOTE=m +CONFIG_DVB_USB_PCTV452E=m +CONFIG_DVB_USB_DW2102=m +CONFIG_DVB_USB_CINERGY_T2=m +CONFIG_DVB_USB_DTV5100=m +CONFIG_DVB_USB_FRIIO=m +CONFIG_DVB_USB_AZ6027=m +CONFIG_DVB_USB_TECHNISAT_USB2=m +CONFIG_DVB_USB_V2=m +CONFIG_DVB_USB_AF9015=m +CONFIG_DVB_USB_AF9035=m +CONFIG_DVB_USB_ANYSEE=m +CONFIG_DVB_USB_AU6610=m +CONFIG_DVB_USB_AZ6007=m +CONFIG_DVB_USB_CE6230=m +CONFIG_DVB_USB_EC168=m +CONFIG_DVB_USB_GL861=m +CONFIG_DVB_USB_LME2510=m +CONFIG_DVB_USB_MXL111SF=m +CONFIG_DVB_USB_RTL28XXU=m +CONFIG_DVB_USB_DVBSKY=m +CONFIG_DVB_TTUSB_BUDGET=m +CONFIG_DVB_TTUSB_DEC=m +CONFIG_SMS_USB_DRV=m +CONFIG_DVB_B2C2_FLEXCOP_USB=m +# CONFIG_DVB_B2C2_FLEXCOP_USB_DEBUG is not set +CONFIG_DVB_AS102=m + +# +# Webcam, TV (analog/digital) USB devices +# +CONFIG_VIDEO_EM28XX=m +CONFIG_VIDEO_EM28XX_V4L2=m +CONFIG_VIDEO_EM28XX_ALSA=m +CONFIG_VIDEO_EM28XX_DVB=m +CONFIG_VIDEO_EM28XX_RC=m + +# +# Software defined radio USB devices +# +CONFIG_USB_AIRSPY=m +CONFIG_USB_HACKRF=m +CONFIG_USB_MSI2500=m +CONFIG_MEDIA_PCI_SUPPORT=y + +# +# Media capture support +# +CONFIG_VIDEO_SOLO6X10=m +CONFIG_VIDEO_TW68=m + +# +# Media capture/analog TV support +# +CONFIG_VIDEO_IVTV=m +CONFIG_VIDEO_IVTV_ALSA=m +CONFIG_VIDEO_FB_IVTV=m +CONFIG_VIDEO_HEXIUM_GEMINI=m +CONFIG_VIDEO_HEXIUM_ORION=m +CONFIG_VIDEO_MXB=m +CONFIG_VIDEO_DT3155=m + +# +# Media capture/analog/hybrid TV support +# +CONFIG_VIDEO_CX18=m +CONFIG_VIDEO_CX18_ALSA=m +CONFIG_VIDEO_CX23885=m +CONFIG_MEDIA_ALTERA_CI=m +CONFIG_VIDEO_CX25821=m +CONFIG_VIDEO_CX25821_ALSA=m +CONFIG_VIDEO_CX88=m +CONFIG_VIDEO_CX88_ALSA=m +CONFIG_VIDEO_CX88_BLACKBIRD=m +CONFIG_VIDEO_CX88_DVB=m +CONFIG_VIDEO_CX88_ENABLE_VP3054=y +CONFIG_VIDEO_CX88_VP3054=m +CONFIG_VIDEO_CX88_MPEG=m +CONFIG_VIDEO_BT848=m +CONFIG_DVB_BT8XX=m +CONFIG_VIDEO_SAA7134=m +CONFIG_VIDEO_SAA7134_ALSA=m +CONFIG_VIDEO_SAA7134_RC=y +CONFIG_VIDEO_SAA7134_DVB=m +CONFIG_VIDEO_SAA7134_GO7007=m +CONFIG_VIDEO_SAA7164=m + +# +# Media digital TV PCI Adapters +# +CONFIG_DVB_AV7110_IR=y +CONFIG_DVB_AV7110=m +CONFIG_DVB_AV7110_OSD=y +CONFIG_DVB_BUDGET_CORE=m +CONFIG_DVB_BUDGET=m +CONFIG_DVB_BUDGET_CI=m +CONFIG_DVB_BUDGET_AV=m +CONFIG_DVB_BUDGET_PATCH=m +CONFIG_DVB_B2C2_FLEXCOP_PCI=m +# CONFIG_DVB_B2C2_FLEXCOP_PCI_DEBUG is not set +CONFIG_DVB_PLUTO2=m +CONFIG_DVB_DM1105=m +CONFIG_DVB_PT1=m +CONFIG_DVB_PT3=m +CONFIG_MANTIS_CORE=m +CONFIG_DVB_MANTIS=m +CONFIG_DVB_HOPPER=m +CONFIG_DVB_NGENE=m +CONFIG_DVB_DDBRIDGE=m +CONFIG_DVB_SMIPCIE=m +# CONFIG_DVB_NETUP_UNIDVB is not set +CONFIG_V4L_PLATFORM_DRIVERS=y +# CONFIG_VIDEO_CAFE_CCIC is not set +CONFIG_VIDEO_MXC_OUTPUT=y +CONFIG_VIDEO_MXC_CAPTURE=m + +# +# MXC Camera/V4L2 PRP Features support +# +CONFIG_VIDEO_MXC_IPU_CAMERA=y +# CONFIG_VIDEO_MXC_CSI_CAMERA is not set +# CONFIG_MXC_TVIN_TDA1997X is not set +CONFIG_MXC_CAMERA_OV5640=m +CONFIG_MXC_CAMERA_OV5642=m +CONFIG_MXC_CAMERA_OV5640_MIPI=m +CONFIG_MXC_CAMERA_OV5647_MIPI=m +# CONFIG_MXC_HDMI_CSI2_TC358743 is not set +# CONFIG_MXC_TVIN_ADV7180 is not set +CONFIG_MXC_IPU_DEVICE_QUEUE_SDC=m +CONFIG_MXC_IPU_PRP_ENC=m +CONFIG_MXC_IPU_CSI_ENC=m +CONFIG_VIDEO_MXC_IPU_OUTPUT=y +CONFIG_VIDEO_MXC_PXP_V4L2=y +CONFIG_SOC_CAMERA=y +CONFIG_SOC_CAMERA_PLATFORM=y +# CONFIG_VIDEO_XILINX is not set +CONFIG_V4L_MEM2MEM_DRIVERS=y +# CONFIG_VIDEO_CODA is not set +CONFIG_VIDEO_MEM2MEM_DEINTERLACE=m +CONFIG_VIDEO_SH_VEU=m +# CONFIG_V4L_TEST_DRIVERS is not set +# CONFIG_DVB_PLATFORM_DRIVERS is not set + +# +# Supported MMC/SDIO adapters +# +CONFIG_SMS_SDIO_DRV=m +CONFIG_RADIO_ADAPTERS=y +CONFIG_RADIO_TEA575X=m +CONFIG_RADIO_SI470X=y +CONFIG_USB_SI470X=m +CONFIG_I2C_SI470X=m +CONFIG_RADIO_SI4713=m +CONFIG_USB_SI4713=m +CONFIG_PLATFORM_SI4713=m +CONFIG_I2C_SI4713=m +CONFIG_RADIO_SI476X=m +CONFIG_USB_MR800=m +CONFIG_USB_DSBR=m +CONFIG_RADIO_MAXIRADIO=m +CONFIG_RADIO_SHARK=m +CONFIG_RADIO_SHARK2=m +CONFIG_USB_KEENE=m +CONFIG_USB_RAREMONO=m +CONFIG_USB_MA901=m +CONFIG_RADIO_TEA5764=m +CONFIG_RADIO_SAA7706H=m +CONFIG_RADIO_TEF6862=m +CONFIG_RADIO_WL1273=m + +# +# Texas Instruments WL128x FM driver (ST based) +# +CONFIG_RADIO_WL128X=m +CONFIG_MEDIA_COMMON_OPTIONS=y + +# +# common driver options +# +CONFIG_VIDEO_CX2341X=m +CONFIG_VIDEO_TVEEPROM=m +CONFIG_CYPRESS_FIRMWARE=m +CONFIG_DVB_B2C2_FLEXCOP=m +CONFIG_VIDEO_SAA7146=m +CONFIG_VIDEO_SAA7146_VV=m +CONFIG_SMS_SIANO_MDTV=m +CONFIG_SMS_SIANO_RC=y +# CONFIG_SMS_SIANO_DEBUGFS is not set + +# +# Media ancillary drivers (tuners, sensors, i2c, frontends) +# +# CONFIG_MEDIA_SUBDRV_AUTOSELECT is not set +CONFIG_MEDIA_ATTACH=y +CONFIG_VIDEO_IR_I2C=m + +# +# Encoders, decoders, sensors and other helper chips +# + +# +# Audio decoders, processors and mixers +# +CONFIG_VIDEO_TVAUDIO=m +CONFIG_VIDEO_TDA7432=m +CONFIG_VIDEO_TDA9840=m +CONFIG_VIDEO_TEA6415C=m +CONFIG_VIDEO_TEA6420=m +CONFIG_VIDEO_MSP3400=m +CONFIG_VIDEO_CS5345=m +CONFIG_VIDEO_CS53L32A=m +CONFIG_VIDEO_TLV320AIC23B=m +CONFIG_VIDEO_UDA1342=m +CONFIG_VIDEO_WM8775=m +CONFIG_VIDEO_WM8739=m +CONFIG_VIDEO_VP27SMPX=m +CONFIG_VIDEO_SONY_BTF_MPX=m + +# +# RDS decoders +# +CONFIG_VIDEO_SAA6588=m + +# +# Video decoders +# +CONFIG_VIDEO_ADV7180=m +CONFIG_VIDEO_ADV7183=m +CONFIG_VIDEO_ADV7604=m +CONFIG_VIDEO_ADV7842=m +CONFIG_VIDEO_BT819=m +CONFIG_VIDEO_BT856=m +CONFIG_VIDEO_BT866=m +CONFIG_VIDEO_KS0127=m +CONFIG_VIDEO_ML86V7667=m +CONFIG_VIDEO_SAA7110=m +CONFIG_VIDEO_SAA711X=m +CONFIG_VIDEO_TC358743=m +CONFIG_VIDEO_TVP514X=m +CONFIG_VIDEO_TVP5150=m +CONFIG_VIDEO_TVP7002=m +CONFIG_VIDEO_TW2804=m +CONFIG_VIDEO_TW9903=m +CONFIG_VIDEO_TW9906=m +CONFIG_VIDEO_VPX3220=m + +# +# Video and audio decoders +# +CONFIG_VIDEO_SAA717X=m +CONFIG_VIDEO_CX25840=m + +# +# Video encoders +# +CONFIG_VIDEO_SAA7127=m +CONFIG_VIDEO_SAA7185=m +CONFIG_VIDEO_ADV7170=m +CONFIG_VIDEO_ADV7175=m +CONFIG_VIDEO_ADV7343=m +CONFIG_VIDEO_ADV7393=m +CONFIG_VIDEO_ADV7511=m +CONFIG_VIDEO_AD9389B=m +CONFIG_VIDEO_AK881X=m +CONFIG_VIDEO_THS8200=m + +# +# Camera sensor devices +# +CONFIG_VIDEO_APTINA_PLL=m +CONFIG_VIDEO_SMIAPP_PLL=m +CONFIG_VIDEO_OV2659=m +CONFIG_VIDEO_OV7640=m +CONFIG_VIDEO_OV7670=m +CONFIG_VIDEO_OV9650=m +CONFIG_VIDEO_VS6624=m +CONFIG_VIDEO_MT9M032=m +CONFIG_VIDEO_MT9P031=m +CONFIG_VIDEO_MT9T001=m +CONFIG_VIDEO_MT9V011=m +CONFIG_VIDEO_MT9V032=m +CONFIG_VIDEO_SR030PC30=m +CONFIG_VIDEO_NOON010PC30=m +CONFIG_VIDEO_M5MOLS=m +CONFIG_VIDEO_S5K6AA=m +CONFIG_VIDEO_S5K6A3=m +CONFIG_VIDEO_S5K4ECGX=m +CONFIG_VIDEO_S5K5BAF=m +CONFIG_VIDEO_SMIAPP=m +CONFIG_VIDEO_S5C73M3=m + +# +# Flash devices +# +CONFIG_VIDEO_ADP1653=m +CONFIG_VIDEO_AS3645A=m +CONFIG_VIDEO_LM3560=m +CONFIG_VIDEO_LM3646=m + +# +# Video improvement chips +# +CONFIG_VIDEO_UPD64031A=m +CONFIG_VIDEO_UPD64083=m + +# +# Audio/Video compression chips +# +CONFIG_VIDEO_SAA6752HS=m + +# +# Miscellaneous helper chips +# +CONFIG_VIDEO_THS7303=m +CONFIG_VIDEO_M52790=m + +# +# Sensors used on soc_camera driver +# + +# +# soc_camera sensor drivers +# +CONFIG_SOC_CAMERA_IMX074=m +CONFIG_SOC_CAMERA_MT9M001=m +CONFIG_SOC_CAMERA_MT9M111=m +CONFIG_SOC_CAMERA_MT9T031=m +CONFIG_SOC_CAMERA_MT9T112=m +CONFIG_SOC_CAMERA_MT9V022=m +CONFIG_SOC_CAMERA_OV2640=m +CONFIG_SOC_CAMERA_OV5642=m +CONFIG_SOC_CAMERA_OV6650=m +CONFIG_SOC_CAMERA_OV772X=m +CONFIG_SOC_CAMERA_OV9640=m +CONFIG_SOC_CAMERA_OV9740=m +CONFIG_SOC_CAMERA_RJ54N1=m +CONFIG_SOC_CAMERA_TW9910=m +CONFIG_MEDIA_TUNER=y + +# +# Customize TV tuners +# +CONFIG_MEDIA_TUNER_SIMPLE=m +CONFIG_MEDIA_TUNER_TDA8290=m +CONFIG_MEDIA_TUNER_TDA827X=m +CONFIG_MEDIA_TUNER_TDA18271=m +CONFIG_MEDIA_TUNER_TDA9887=m +CONFIG_MEDIA_TUNER_TEA5761=m +CONFIG_MEDIA_TUNER_TEA5767=m +CONFIG_MEDIA_TUNER_MSI001=m +CONFIG_MEDIA_TUNER_MT20XX=m +CONFIG_MEDIA_TUNER_MT2060=m +CONFIG_MEDIA_TUNER_MT2063=m +CONFIG_MEDIA_TUNER_MT2266=m +CONFIG_MEDIA_TUNER_MT2131=m +CONFIG_MEDIA_TUNER_QT1010=m +CONFIG_MEDIA_TUNER_XC2028=m +CONFIG_MEDIA_TUNER_XC5000=m +CONFIG_MEDIA_TUNER_XC4000=m +CONFIG_MEDIA_TUNER_MXL5005S=m +CONFIG_MEDIA_TUNER_MXL5007T=m +CONFIG_MEDIA_TUNER_MC44S803=m +CONFIG_MEDIA_TUNER_MAX2165=m +CONFIG_MEDIA_TUNER_TDA18218=m +CONFIG_MEDIA_TUNER_FC0011=m +CONFIG_MEDIA_TUNER_FC0012=m +CONFIG_MEDIA_TUNER_FC0013=m +CONFIG_MEDIA_TUNER_TDA18212=m +CONFIG_MEDIA_TUNER_E4000=m +CONFIG_MEDIA_TUNER_FC2580=m +CONFIG_MEDIA_TUNER_M88RS6000T=m +CONFIG_MEDIA_TUNER_TUA9001=m +CONFIG_MEDIA_TUNER_SI2157=m +CONFIG_MEDIA_TUNER_IT913X=m +CONFIG_MEDIA_TUNER_R820T=m +CONFIG_MEDIA_TUNER_MXL301RF=m +CONFIG_MEDIA_TUNER_QM1D1C0042=m + +# +# Customise DVB Frontends +# + +# +# Multistandard (satellite) frontends +# +CONFIG_DVB_STB0899=m +CONFIG_DVB_STB6100=m +CONFIG_DVB_STV090x=m +CONFIG_DVB_STV6110x=m +CONFIG_DVB_M88DS3103=m + +# +# Multistandard (cable + terrestrial) frontends +# +CONFIG_DVB_DRXK=m +CONFIG_DVB_TDA18271C2DD=m +CONFIG_DVB_SI2165=m + +# +# DVB-S (satellite) frontends +# +CONFIG_DVB_CX24110=m +CONFIG_DVB_CX24123=m +CONFIG_DVB_MT312=m +CONFIG_DVB_ZL10036=m +CONFIG_DVB_ZL10039=m +CONFIG_DVB_S5H1420=m +CONFIG_DVB_STV0288=m +CONFIG_DVB_STB6000=m +CONFIG_DVB_STV0299=m +CONFIG_DVB_STV6110=m +CONFIG_DVB_STV0900=m +CONFIG_DVB_TDA8083=m +CONFIG_DVB_TDA10086=m +CONFIG_DVB_TDA8261=m +CONFIG_DVB_VES1X93=m +CONFIG_DVB_TUNER_ITD1000=m +CONFIG_DVB_TUNER_CX24113=m +CONFIG_DVB_TDA826X=m +CONFIG_DVB_TUA6100=m +CONFIG_DVB_CX24116=m +CONFIG_DVB_CX24117=m +CONFIG_DVB_CX24120=m +CONFIG_DVB_SI21XX=m +CONFIG_DVB_TS2020=m +CONFIG_DVB_DS3000=m +CONFIG_DVB_MB86A16=m +CONFIG_DVB_TDA10071=m + +# +# DVB-T (terrestrial) frontends +# +CONFIG_DVB_SP8870=m +CONFIG_DVB_SP887X=m +CONFIG_DVB_CX22700=m +CONFIG_DVB_CX22702=m +CONFIG_DVB_S5H1432=m +CONFIG_DVB_DRXD=m +CONFIG_DVB_L64781=m +CONFIG_DVB_TDA1004X=m +CONFIG_DVB_NXT6000=m +CONFIG_DVB_MT352=m +CONFIG_DVB_ZL10353=m +CONFIG_DVB_DIB3000MB=m +CONFIG_DVB_DIB3000MC=m +CONFIG_DVB_DIB7000M=m +CONFIG_DVB_DIB7000P=m +CONFIG_DVB_DIB9000=m +CONFIG_DVB_TDA10048=m +CONFIG_DVB_AF9013=m +CONFIG_DVB_EC100=m +CONFIG_DVB_HD29L2=m +CONFIG_DVB_STV0367=m +CONFIG_DVB_CXD2820R=m +CONFIG_DVB_CXD2841ER=m +CONFIG_DVB_RTL2830=m +CONFIG_DVB_RTL2832=m +CONFIG_DVB_RTL2832_SDR=m +CONFIG_DVB_SI2168=m +CONFIG_DVB_AS102_FE=m + +# +# DVB-C (cable) frontends +# +CONFIG_DVB_VES1820=m +CONFIG_DVB_TDA10021=m +CONFIG_DVB_TDA10023=m +CONFIG_DVB_STV0297=m + +# +# ATSC (North American/Korean Terrestrial/Cable DTV) frontends +# +CONFIG_DVB_NXT200X=m +CONFIG_DVB_OR51211=m +CONFIG_DVB_OR51132=m +CONFIG_DVB_BCM3510=m +CONFIG_DVB_LGDT330X=m +CONFIG_DVB_LGDT3305=m +CONFIG_DVB_LGDT3306A=m +CONFIG_DVB_LG2160=m +CONFIG_DVB_S5H1409=m +CONFIG_DVB_AU8522=m +CONFIG_DVB_AU8522_DTV=m +CONFIG_DVB_AU8522_V4L=m +CONFIG_DVB_S5H1411=m + +# +# ISDB-T (terrestrial) frontends +# +CONFIG_DVB_S921=m +CONFIG_DVB_DIB8000=m +CONFIG_DVB_MB86A20S=m + +# +# ISDB-S (satellite) & ISDB-T (terrestrial) frontends +# +CONFIG_DVB_TC90522=m + +# +# Digital terrestrial only tuners/PLL +# +CONFIG_DVB_PLL=m +CONFIG_DVB_TUNER_DIB0070=m +CONFIG_DVB_TUNER_DIB0090=m + +# +# SEC control devices for DVB-S +# +CONFIG_DVB_DRX39XYJ=m +CONFIG_DVB_LNBH25=m +CONFIG_DVB_LNBP21=m +CONFIG_DVB_LNBP22=m +CONFIG_DVB_ISL6405=m +CONFIG_DVB_ISL6421=m +CONFIG_DVB_ISL6423=m +CONFIG_DVB_A8293=m +CONFIG_DVB_SP2=m +CONFIG_DVB_LGS8GL5=m +CONFIG_DVB_LGS8GXX=m +CONFIG_DVB_ATBM8830=m +CONFIG_DVB_TDA665x=m +CONFIG_DVB_IX2505V=m +CONFIG_DVB_M88RS2000=m +CONFIG_DVB_AF9033=m +CONFIG_DVB_HORUS3A=m +CONFIG_DVB_ASCOT2E=m + +# +# Tools to develop new frontends +# +CONFIG_DVB_DUMMY_FE=m + +# +# Graphics support +# +CONFIG_VGA_ARB=y +CONFIG_VGA_ARB_MAX_GPUS=16 +# CONFIG_IMX_IPUV3_CORE is not set +CONFIG_DRM=y +# CONFIG_DRM_FBDEV_EMULATION is not set +# CONFIG_DRM_TDFX is not set +# CONFIG_DRM_R128 is not set +# CONFIG_DRM_RADEON is not set +# CONFIG_DRM_AMDGPU is not set +# CONFIG_DRM_NOUVEAU is not set +# CONFIG_DRM_MGA is not set +# CONFIG_DRM_VIA is not set +# CONFIG_DRM_SAVAGE is not set +# CONFIG_DRM_VGEM is not set +# CONFIG_DRM_EXYNOS is not set +# CONFIG_DRM_UDL is not set +# CONFIG_DRM_AST is not set +# CONFIG_DRM_MGAG200 is not set +# CONFIG_DRM_CIRRUS_QEMU is not set +# CONFIG_DRM_ARMADA is not set +# CONFIG_DRM_TILCDC is not set +# CONFIG_DRM_QXL is not set +# CONFIG_DRM_BOCHS is not set +# CONFIG_DRM_VIRTIO_GPU is not set +# CONFIG_DRM_FSL_DCU is not set +CONFIG_DRM_BRIDGE=y + +# +# Display Interface Bridges +# +# CONFIG_DRM_NXP_PTN3460 is not set +# CONFIG_DRM_PARADE_PS8622 is not set +# CONFIG_DRM_STI is not set +CONFIG_DRM_VIVANTE=m + +# +# Frame buffer Devices +# +CONFIG_FB=y +CONFIG_FIRMWARE_EDID=y +CONFIG_FB_CMDLINE=y +# CONFIG_FB_DDC is not set +# CONFIG_FB_BOOT_VESA_SUPPORT is not set +CONFIG_FB_CFB_FILLRECT=y +CONFIG_FB_CFB_COPYAREA=y +CONFIG_FB_CFB_IMAGEBLIT=y +# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set +CONFIG_FB_SYS_FILLRECT=m +CONFIG_FB_SYS_COPYAREA=m +CONFIG_FB_SYS_IMAGEBLIT=m +# CONFIG_FB_FOREIGN_ENDIAN is not set +CONFIG_FB_SYS_FOPS=m +CONFIG_FB_DEFERRED_IO=y +# CONFIG_FB_SVGALIB is not set +# CONFIG_FB_MACMODES is not set +CONFIG_FB_BACKLIGHT=y +CONFIG_FB_MODE_HELPERS=y +# CONFIG_FB_TILEBLITTING is not set + +# +# Frame buffer hardware drivers +# +# CONFIG_FB_CIRRUS is not set +# CONFIG_FB_PM2 is not set +# CONFIG_FB_IMX is not set +# CONFIG_FB_CYBER2000 is not set +# CONFIG_FB_ASILIANT is not set +# CONFIG_FB_IMSTT is not set +# CONFIG_FB_UVESA is not set +# CONFIG_FB_OPENCORES is not set +# CONFIG_FB_S1D13XXX is not set +# CONFIG_FB_NVIDIA is not set +# CONFIG_FB_RIVA is not set +# CONFIG_FB_I740 is not set +# CONFIG_FB_MATROX is not set +# CONFIG_FB_RADEON is not set +# CONFIG_FB_ATY128 is not set +# CONFIG_FB_ATY is not set +# CONFIG_FB_S3 is not set +# CONFIG_FB_SAVAGE is not set +# CONFIG_FB_SIS is not set +# CONFIG_FB_NEOMAGIC is not set +# CONFIG_FB_KYRO is not set +# CONFIG_FB_3DFX is not set +# CONFIG_FB_VOODOO1 is not set +# CONFIG_FB_VT8623 is not set +# CONFIG_FB_TRIDENT is not set +# CONFIG_FB_ARK is not set +# CONFIG_FB_PM3 is not set +# CONFIG_FB_CARMINE is not set +# CONFIG_FB_SMSCUFX is not set +CONFIG_FB_UDL=m +# CONFIG_FB_IBM_GXT4500 is not set +# CONFIG_FB_VIRTUAL is not set +# CONFIG_FB_METRONOME is not set +# CONFIG_FB_MB862XX is not set +# CONFIG_FB_BROADSHEET is not set +# CONFIG_FB_AUO_K190X is not set +# CONFIG_FB_MXS is not set +# CONFIG_FB_SIMPLE is not set +# CONFIG_FB_SSD1307 is not set +# CONFIG_FB_SM712 is not set +CONFIG_FB_MXC=y +CONFIG_FB_MXC_SYNC_PANEL=y +# CONFIG_FB_MXC_TVOUT_ADV739X is not set +CONFIG_FB_MXC_LDB=y +# CONFIG_FB_MXC_MIPI_DSI is not set +CONFIG_FB_MXC_HDMI=y +CONFIG_FB_MXC_DCIC=y +CONFIG_FB_MXC_EDID=y +# CONFIG_FB_MXC_EINK_PANEL is not set +CONFIG_BACKLIGHT_LCD_SUPPORT=y +CONFIG_LCD_CLASS_DEVICE=m +# CONFIG_LCD_L4F00242T03 is not set +# CONFIG_LCD_LMS283GF05 is not set +# CONFIG_LCD_LTV350QV is not set +# CONFIG_LCD_ILI922X is not set +# CONFIG_LCD_ILI9320 is not set +# CONFIG_LCD_TDO24M is not set +# CONFIG_LCD_VGG2432A4 is not set +CONFIG_LCD_PLATFORM=m +# CONFIG_LCD_S6E63M0 is not set +# CONFIG_LCD_LD9040 is not set +# CONFIG_LCD_AMS369FG06 is not set +# CONFIG_LCD_LMS501KF03 is not set +# CONFIG_LCD_HX8357 is not set +CONFIG_BACKLIGHT_CLASS_DEVICE=y +# CONFIG_BACKLIGHT_GENERIC is not set +CONFIG_BACKLIGHT_PWM=m +# CONFIG_BACKLIGHT_DA9052 is not set +# CONFIG_BACKLIGHT_PM8941_WLED is not set +# CONFIG_BACKLIGHT_ADP8860 is not set +# CONFIG_BACKLIGHT_ADP8870 is not set +# CONFIG_BACKLIGHT_88PM860X is not set +# CONFIG_BACKLIGHT_LM3630A is not set +# CONFIG_BACKLIGHT_LM3639 is not set +# CONFIG_BACKLIGHT_LP855X is not set +# CONFIG_BACKLIGHT_GPIO is not set +# CONFIG_BACKLIGHT_LV5207LP is not set +# CONFIG_BACKLIGHT_BD6107 is not set +# CONFIG_VGASTATE is not set +CONFIG_VIDEOMODE_HELPERS=y +CONFIG_HDMI=y + +# +# Console display driver support +# +CONFIG_DUMMY_CONSOLE=y +CONFIG_FRAMEBUFFER_CONSOLE=y +CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y +# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set +# CONFIG_LOGO is not set +CONFIG_SOUND=y +# CONFIG_SOUND_OSS_CORE is not set +CONFIG_SND=y +CONFIG_SND_TIMER=y +CONFIG_SND_PCM=y +CONFIG_SND_DMAENGINE_PCM=y +CONFIG_SND_HWDEP=m +CONFIG_SND_RAWMIDI=m +CONFIG_SND_JACK=y +# CONFIG_SND_SEQUENCER is not set +# CONFIG_SND_MIXER_OSS is not set +# CONFIG_SND_PCM_OSS is not set +CONFIG_SND_PCM_TIMER=y +CONFIG_SND_HRTIMER=y +# CONFIG_SND_DYNAMIC_MINORS is not set +# CONFIG_SND_SUPPORT_OLD_API is not set +CONFIG_SND_PROC_FS=y +# CONFIG_SND_VERBOSE_PROCFS is not set +# CONFIG_SND_VERBOSE_PRINTK is not set +# CONFIG_SND_DEBUG is not set +CONFIG_SND_VMASTER=y +# CONFIG_SND_RAWMIDI_SEQ is not set +# CONFIG_SND_OPL3_LIB_SEQ is not set +# CONFIG_SND_OPL4_LIB_SEQ is not set +# CONFIG_SND_SBAWE_SEQ is not set +# CONFIG_SND_EMU10K1_SEQ is not set +CONFIG_SND_MPU401_UART=m +CONFIG_SND_AC97_CODEC=m +CONFIG_SND_DRIVERS=y +CONFIG_SND_DUMMY=m +CONFIG_SND_ALOOP=m +CONFIG_SND_MTPAV=m +CONFIG_SND_SERIAL_U16550=m +CONFIG_SND_MPU401=m +CONFIG_SND_AC97_POWER_SAVE=y +CONFIG_SND_AC97_POWER_SAVE_DEFAULT=1 +CONFIG_SND_PCI=y +# CONFIG_SND_AD1889 is not set +# CONFIG_SND_ALS300 is not set +# CONFIG_SND_ALI5451 is not set +# CONFIG_SND_ATIIXP is not set +# CONFIG_SND_ATIIXP_MODEM is not set +# CONFIG_SND_AU8810 is not set +# CONFIG_SND_AU8820 is not set +# CONFIG_SND_AU8830 is not set +# CONFIG_SND_AW2 is not set +# CONFIG_SND_AZT3328 is not set +# CONFIG_SND_BT87X is not set +# CONFIG_SND_CA0106 is not set +# CONFIG_SND_CMIPCI is not set +# CONFIG_SND_OXYGEN is not set +# CONFIG_SND_CS4281 is not set +# CONFIG_SND_CS46XX is not set +# CONFIG_SND_CTXFI is not set +# CONFIG_SND_DARLA20 is not set +# CONFIG_SND_GINA20 is not set +# CONFIG_SND_LAYLA20 is not set +# CONFIG_SND_DARLA24 is not set +# CONFIG_SND_GINA24 is not set +# CONFIG_SND_LAYLA24 is not set +# CONFIG_SND_MONA is not set +# CONFIG_SND_MIA is not set +# CONFIG_SND_ECHO3G is not set +# CONFIG_SND_INDIGO is not set +# CONFIG_SND_INDIGOIO is not set +# CONFIG_SND_INDIGODJ is not set +# CONFIG_SND_INDIGOIOX is not set +# CONFIG_SND_INDIGODJX is not set +# CONFIG_SND_EMU10K1 is not set +# CONFIG_SND_EMU10K1X is not set +# CONFIG_SND_ENS1370 is not set +# CONFIG_SND_ENS1371 is not set +# CONFIG_SND_ES1938 is not set +# CONFIG_SND_ES1968 is not set +# CONFIG_SND_FM801 is not set +# CONFIG_SND_HDSP is not set +# CONFIG_SND_HDSPM is not set +# CONFIG_SND_ICE1712 is not set +# CONFIG_SND_ICE1724 is not set +# CONFIG_SND_INTEL8X0 is not set +# CONFIG_SND_INTEL8X0M is not set +# CONFIG_SND_KORG1212 is not set +# CONFIG_SND_LOLA is not set +# CONFIG_SND_LX6464ES is not set +# CONFIG_SND_MAESTRO3 is not set +# CONFIG_SND_MIXART is not set +# CONFIG_SND_NM256 is not set +# CONFIG_SND_PCXHR is not set +# CONFIG_SND_RIPTIDE is not set +# CONFIG_SND_RME32 is not set +# CONFIG_SND_RME96 is not set +# CONFIG_SND_RME9652 is not set +# CONFIG_SND_SE6X is not set +# CONFIG_SND_SONICVIBES is not set +# CONFIG_SND_TRIDENT is not set +# CONFIG_SND_VIA82XX is not set +# CONFIG_SND_VIA82XX_MODEM is not set +# CONFIG_SND_VIRTUOSO is not set +# CONFIG_SND_VX222 is not set +# CONFIG_SND_YMFPCI is not set + +# +# HD-Audio +# +# CONFIG_SND_HDA_INTEL is not set +CONFIG_SND_HDA_PREALLOC_SIZE=1024 +CONFIG_SND_ARM=y +CONFIG_SND_SPI=y +CONFIG_SND_USB=y +CONFIG_SND_USB_AUDIO=m +CONFIG_SND_USB_UA101=m +CONFIG_SND_USB_CAIAQ=m +CONFIG_SND_USB_CAIAQ_INPUT=y +CONFIG_SND_USB_6FIRE=m +CONFIG_SND_USB_HIFACE=m +CONFIG_SND_BCD2000=m +CONFIG_SND_USB_LINE6=m +CONFIG_SND_USB_POD=m +CONFIG_SND_USB_PODHD=m +CONFIG_SND_USB_TONEPORT=m +CONFIG_SND_USB_VARIAX=m +CONFIG_SND_SOC=y +CONFIG_SND_SOC_AC97_BUS=y +CONFIG_SND_SOC_GENERIC_DMAENGINE_PCM=y +# CONFIG_SND_ATMEL_SOC is not set +# CONFIG_SND_DESIGNWARE_I2S is not set + +# +# SoC Audio for Freescale CPUs +# + +# +# Common SoC Audio options for Freescale CPUs: +# +# CONFIG_SND_SOC_FSL_ASRC is not set +CONFIG_SND_SOC_FSL_SAI=y +CONFIG_SND_SOC_FSL_SSI=y +CONFIG_SND_SOC_FSL_SPDIF=y +CONFIG_SND_SOC_FSL_ESAI=y +CONFIG_SND_SOC_FSL_HDMI=y +CONFIG_SND_SOC_FSL_UTILS=y +CONFIG_SND_SOC_IMX_PCM_DMA=y +CONFIG_SND_SOC_IMX_HDMI_DMA=y +CONFIG_SND_SOC_IMX_AUDMUX=y +CONFIG_SND_IMX_SOC=y + +# +# SoC Audio support for Freescale i.MX boards: +# +# CONFIG_SND_SOC_EUKREA_TLV320 is not set +# CONFIG_SND_SOC_IMX_WM8731 is not set +# CONFIG_SND_SOC_IMX_WM8962 is not set +# CONFIG_SND_SOC_IMX_ES8328 is not set +CONFIG_SND_SOC_IMX_SGTL5000=y +CONFIG_SND_SOC_IMX_AC97_VT1613=y +CONFIG_SND_SOC_IMX_SPDIF=y +# CONFIG_SND_SOC_IMX_MC13783 is not set +CONFIG_SND_SOC_IMX_HDMI=y +CONFIG_SND_SOC_FSL_ASOC_CARD=m +# CONFIG_SND_SOC_IMX_TDA1997X is not set + +# +# Allwinner SoC Audio support +# +# CONFIG_SND_SUN4I_CODEC is not set +# CONFIG_SND_SOC_XTFPGA_I2S is not set +CONFIG_SND_SOC_I2C_AND_SPI=y + +# +# CODEC drivers +# +# CONFIG_SND_SOC_AC97_CODEC is not set +# CONFIG_SND_SOC_ADAU1701 is not set +# CONFIG_SND_SOC_AK4104 is not set +# CONFIG_SND_SOC_AK4554 is not set +# CONFIG_SND_SOC_AK4613 is not set +# CONFIG_SND_SOC_AK4642 is not set +# CONFIG_SND_SOC_AK5386 is not set +# CONFIG_SND_SOC_ALC5623 is not set +# CONFIG_SND_SOC_CS35L32 is not set +# CONFIG_SND_SOC_CS42L51_I2C is not set +# CONFIG_SND_SOC_CS42L52 is not set +# CONFIG_SND_SOC_CS42L56 is not set +# CONFIG_SND_SOC_CS42L73 is not set +# CONFIG_SND_SOC_CS4265 is not set +# CONFIG_SND_SOC_CS4270 is not set +# CONFIG_SND_SOC_CS4271_I2C is not set +# CONFIG_SND_SOC_CS4271_SPI is not set +# CONFIG_SND_SOC_CS42XX8_I2C is not set +# CONFIG_SND_SOC_CS4349 is not set +CONFIG_SND_SOC_HDMI_CODEC=y +# CONFIG_SND_SOC_ES8328 is not set +# CONFIG_SND_SOC_GTM601 is not set +# CONFIG_SND_SOC_PCM1681 is not set +# CONFIG_SND_SOC_PCM1792A is not set +# CONFIG_SND_SOC_PCM512x_I2C is not set +# CONFIG_SND_SOC_PCM512x_SPI is not set +# CONFIG_SND_SOC_RT5631 is not set +# CONFIG_SND_SOC_RT5677_SPI is not set +CONFIG_SND_SOC_SGTL5000=y +CONFIG_SND_SOC_VT1613=y +CONFIG_SND_SOC_SI476X=m +# CONFIG_SND_SOC_SIRF_AUDIO_CODEC is not set +CONFIG_SND_SOC_SPDIF=y +# CONFIG_SND_SOC_SSM2602_SPI is not set +# CONFIG_SND_SOC_SSM2602_I2C is not set +# CONFIG_SND_SOC_SSM4567 is not set +# CONFIG_SND_SOC_STA32X is not set +# CONFIG_SND_SOC_STA350 is not set +# CONFIG_SND_SOC_STI_SAS is not set +# CONFIG_SND_SOC_TAS2552 is not set +# CONFIG_SND_SOC_TAS5086 is not set +# CONFIG_SND_SOC_TAS571X is not set +# CONFIG_SND_SOC_TFA9879 is not set +# CONFIG_SND_SOC_TLV320AIC23_I2C is not set +# CONFIG_SND_SOC_TLV320AIC23_SPI is not set +# CONFIG_SND_SOC_TLV320AIC31XX is not set +# CONFIG_SND_SOC_TLV320AIC3X is not set +# CONFIG_SND_SOC_TS3A227E is not set +# CONFIG_SND_SOC_WM8510 is not set +# CONFIG_SND_SOC_WM8523 is not set +# CONFIG_SND_SOC_WM8580 is not set +# CONFIG_SND_SOC_WM8711 is not set +# CONFIG_SND_SOC_WM8728 is not set +# CONFIG_SND_SOC_WM8731 is not set +# CONFIG_SND_SOC_WM8737 is not set +# CONFIG_SND_SOC_WM8741 is not set +# CONFIG_SND_SOC_WM8750 is not set +# CONFIG_SND_SOC_WM8753 is not set +# CONFIG_SND_SOC_WM8770 is not set +# CONFIG_SND_SOC_WM8776 is not set +# CONFIG_SND_SOC_WM8804_I2C is not set +# CONFIG_SND_SOC_WM8804_SPI is not set +# CONFIG_SND_SOC_WM8903 is not set +CONFIG_SND_SOC_WM8962=m +# CONFIG_SND_SOC_WM8978 is not set +# CONFIG_SND_SOC_TPA6130A2 is not set +# CONFIG_SND_SIMPLE_CARD is not set +# CONFIG_SOUND_PRIME is not set +CONFIG_AC97_BUS=y + +# +# HID support +# +CONFIG_HID=y +CONFIG_HID_BATTERY_STRENGTH=y +CONFIG_HIDRAW=y +CONFIG_UHID=m +CONFIG_HID_GENERIC=y + +# +# Special HID drivers +# +CONFIG_HID_A4TECH=m +CONFIG_HID_ACRUX=m +CONFIG_HID_ACRUX_FF=y +CONFIG_HID_APPLE=m +CONFIG_HID_APPLEIR=m +CONFIG_HID_AUREAL=m +CONFIG_HID_BELKIN=m +CONFIG_HID_BETOP_FF=m +CONFIG_HID_CHERRY=m +CONFIG_HID_CHICONY=m +# CONFIG_HID_CORSAIR is not set +CONFIG_HID_PRODIKEYS=m +CONFIG_HID_CP2112=m +CONFIG_HID_CYPRESS=m +CONFIG_HID_DRAGONRISE=m +CONFIG_DRAGONRISE_FF=y +CONFIG_HID_EMS_FF=m +CONFIG_HID_ELECOM=m +CONFIG_HID_ELO=m +CONFIG_HID_EZKEY=m +# CONFIG_HID_GEMBIRD is not set +# CONFIG_HID_GFRM is not set +CONFIG_HID_HOLTEK=m +CONFIG_HOLTEK_FF=y +CONFIG_HID_GT683R=m +CONFIG_HID_KEYTOUCH=m +CONFIG_HID_KYE=m +CONFIG_HID_UCLOGIC=m +CONFIG_HID_WALTOP=m +CONFIG_HID_GYRATION=m +CONFIG_HID_ICADE=m +CONFIG_HID_TWINHAN=m +CONFIG_HID_KENSINGTON=m +CONFIG_HID_LCPOWER=m +CONFIG_HID_LENOVO=m +CONFIG_HID_LOGITECH=m +CONFIG_HID_LOGITECH_DJ=m +CONFIG_HID_LOGITECH_HIDPP=m +CONFIG_LOGITECH_FF=y +CONFIG_LOGIRUMBLEPAD2_FF=y +CONFIG_LOGIG940_FF=y +CONFIG_LOGIWHEELS_FF=y +CONFIG_HID_MAGICMOUSE=m +CONFIG_HID_MICROSOFT=m +CONFIG_HID_MONTEREY=m +CONFIG_HID_MULTITOUCH=m +CONFIG_HID_NTRIG=m +CONFIG_HID_ORTEK=m +CONFIG_HID_PANTHERLORD=m +CONFIG_PANTHERLORD_FF=y +CONFIG_HID_PENMOUNT=m +CONFIG_HID_PETALYNX=m +CONFIG_HID_PICOLCD=m +CONFIG_HID_PICOLCD_FB=y +CONFIG_HID_PICOLCD_BACKLIGHT=y +CONFIG_HID_PICOLCD_LCD=y +CONFIG_HID_PICOLCD_LEDS=y +CONFIG_HID_PICOLCD_CIR=y +CONFIG_HID_PLANTRONICS=m +CONFIG_HID_PRIMAX=m +CONFIG_HID_ROCCAT=m +CONFIG_HID_SAITEK=m +CONFIG_HID_SAMSUNG=m +CONFIG_HID_SONY=m +CONFIG_SONY_FF=y +CONFIG_HID_SPEEDLINK=m +CONFIG_HID_STEELSERIES=m +CONFIG_HID_SUNPLUS=m +CONFIG_HID_RMI=m +CONFIG_HID_GREENASIA=m +CONFIG_GREENASIA_FF=y +CONFIG_HID_SMARTJOYPLUS=m +CONFIG_SMARTJOYPLUS_FF=y +CONFIG_HID_TIVO=m +CONFIG_HID_TOPSEED=m +CONFIG_HID_THINGM=m +CONFIG_HID_THRUSTMASTER=m +CONFIG_THRUSTMASTER_FF=y +CONFIG_HID_WACOM=m +CONFIG_HID_WIIMOTE=m +CONFIG_HID_XINMO=m +CONFIG_HID_ZEROPLUS=m +CONFIG_ZEROPLUS_FF=y +CONFIG_HID_ZYDACRON=m +CONFIG_HID_SENSOR_HUB=m +CONFIG_HID_SENSOR_CUSTOM_SENSOR=m + +# +# USB HID support +# +CONFIG_USB_HID=y +CONFIG_HID_PID=y +CONFIG_USB_HIDDEV=y + +# +# I2C HID support +# +CONFIG_I2C_HID=m +CONFIG_USB_OHCI_LITTLE_ENDIAN=y +CONFIG_USB_SUPPORT=y +CONFIG_USB_COMMON=y +CONFIG_USB_ARCH_HAS_HCD=y +CONFIG_USB=y +# CONFIG_USB_ANNOUNCE_NEW_DEVICES is not set + +# +# Miscellaneous USB options +# +CONFIG_USB_DEFAULT_PERSIST=y +# CONFIG_USB_DYNAMIC_MINORS is not set +CONFIG_USB_OTG=y +# CONFIG_USB_OTG_WHITELIST is not set +# CONFIG_USB_OTG_BLACKLIST_HUB is not set +CONFIG_USB_OTG_FSM=y +# CONFIG_USB_ULPI_BUS is not set +# CONFIG_USB_MON is not set +# CONFIG_USB_WUSB_CBAF is not set + +# +# USB Host Controller Drivers +# +# CONFIG_USB_C67X00_HCD is not set +CONFIG_USB_XHCI_HCD=y +CONFIG_USB_XHCI_PCI=y +CONFIG_USB_XHCI_PLATFORM=y +CONFIG_USB_EHCI_HCD=y +CONFIG_USB_EHCI_ROOT_HUB_TT=y +CONFIG_USB_EHCI_TT_NEWSCHED=y +CONFIG_USB_FSL_MPH_DR_OF=m +CONFIG_USB_EHCI_PCI=y +CONFIG_USB_EHCI_MXC=y +CONFIG_USB_EHCI_HCD_PLATFORM=y +# CONFIG_USB_OXU210HP_HCD is not set +# CONFIG_USB_ISP116X_HCD is not set +# CONFIG_USB_ISP1362_HCD is not set +# CONFIG_USB_FOTG210_HCD is not set +# CONFIG_USB_MAX3421_HCD is not set +# CONFIG_USB_OHCI_HCD is not set +# CONFIG_USB_UHCI_HCD is not set +# CONFIG_USB_SL811_HCD is not set +# CONFIG_USB_R8A66597_HCD is not set +# CONFIG_USB_IMX21_HCD is not set +# CONFIG_USB_HCD_BCMA is not set +# CONFIG_USB_HCD_SSB is not set +# CONFIG_USB_HCD_TEST_MODE is not set + +# +# USB Device Class drivers +# +CONFIG_USB_ACM=m +CONFIG_USB_PRINTER=m +CONFIG_USB_WDM=m +# CONFIG_USB_TMC is not set + +# +# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may +# + +# +# also be needed; see USB_STORAGE Help for more info +# +CONFIG_USB_STORAGE=y +# CONFIG_USB_STORAGE_DEBUG is not set +CONFIG_USB_STORAGE_REALTEK=y +# CONFIG_REALTEK_AUTOPM is not set +CONFIG_USB_STORAGE_DATAFAB=y +CONFIG_USB_STORAGE_FREECOM=y +CONFIG_USB_STORAGE_ISD200=y +CONFIG_USB_STORAGE_USBAT=y +CONFIG_USB_STORAGE_SDDR09=y +CONFIG_USB_STORAGE_SDDR55=y +CONFIG_USB_STORAGE_JUMPSHOT=y +CONFIG_USB_STORAGE_ALAUDA=y +CONFIG_USB_STORAGE_ONETOUCH=y +CONFIG_USB_STORAGE_KARMA=m +CONFIG_USB_STORAGE_CYPRESS_ATACB=y +CONFIG_USB_STORAGE_ENE_UB6250=y +CONFIG_USB_UAS=y + +# +# USB Imaging devices +# +# CONFIG_USB_MDC800 is not set +# CONFIG_USB_MICROTEK is not set +CONFIG_USBIP_CORE=m +CONFIG_USBIP_VHCI_HCD=m +CONFIG_USBIP_HOST=m +# CONFIG_USBIP_DEBUG is not set +CONFIG_USB_MUSB_HDRC=m +CONFIG_USB_MUSB_HOST=y +# CONFIG_USB_MUSB_GADGET is not set +# CONFIG_USB_MUSB_DUAL_ROLE is not set + +# +# Platform Glue Layer +# + +# +# MUSB DMA mode +# +CONFIG_MUSB_PIO_ONLY=y +CONFIG_USB_DWC3=m +# CONFIG_USB_DWC3_HOST is not set +# CONFIG_USB_DWC3_GADGET is not set +CONFIG_USB_DWC3_DUAL_ROLE=y + +# +# Platform Glue Driver Support +# +CONFIG_USB_DWC3_PCI=m +CONFIG_USB_DWC2=m +# CONFIG_USB_DWC2_HOST is not set + +# +# Gadget/Dual-role mode requires USB Gadget support to be enabled +# +# CONFIG_USB_DWC2_PERIPHERAL is not set +CONFIG_USB_DWC2_DUAL_ROLE=y +CONFIG_USB_DWC2_PCI=m +# CONFIG_USB_DWC2_DEBUG is not set +# CONFIG_USB_DWC2_TRACK_MISSED_SOFS is not set +CONFIG_USB_CHIPIDEA=y +CONFIG_USB_CHIPIDEA_OF=y +CONFIG_USB_CHIPIDEA_PCI=y +# CONFIG_USB_CHIPIDEA_UDC is not set +CONFIG_USB_CHIPIDEA_HOST=y +# CONFIG_USB_CHIPIDEA_DEBUG is not set +# CONFIG_USB_ISP1760 is not set + +# +# USB port drivers +# +CONFIG_USB_SERIAL=y +CONFIG_USB_SERIAL_CONSOLE=y +CONFIG_USB_SERIAL_GENERIC=y +CONFIG_USB_SERIAL_SIMPLE=m +CONFIG_USB_SERIAL_AIRCABLE=m +CONFIG_USB_SERIAL_ARK3116=m +CONFIG_USB_SERIAL_BELKIN=m +CONFIG_USB_SERIAL_CH341=m +CONFIG_USB_SERIAL_WHITEHEAT=m +CONFIG_USB_SERIAL_DIGI_ACCELEPORT=m +CONFIG_USB_SERIAL_CP210X=m +CONFIG_USB_SERIAL_CYPRESS_M8=m +CONFIG_USB_SERIAL_EMPEG=m +CONFIG_USB_SERIAL_FTDI_SIO=m +CONFIG_USB_SERIAL_VISOR=m +CONFIG_USB_SERIAL_IPAQ=m +CONFIG_USB_SERIAL_IR=m +CONFIG_USB_SERIAL_EDGEPORT=m +CONFIG_USB_SERIAL_EDGEPORT_TI=m +CONFIG_USB_SERIAL_F81232=m +CONFIG_USB_SERIAL_GARMIN=m +CONFIG_USB_SERIAL_IPW=m +CONFIG_USB_SERIAL_IUU=m +CONFIG_USB_SERIAL_KEYSPAN_PDA=m +CONFIG_USB_SERIAL_KEYSPAN=m +CONFIG_USB_SERIAL_KEYSPAN_MPR=y +CONFIG_USB_SERIAL_KEYSPAN_USA28=y +CONFIG_USB_SERIAL_KEYSPAN_USA28X=y +CONFIG_USB_SERIAL_KEYSPAN_USA28XA=y +CONFIG_USB_SERIAL_KEYSPAN_USA28XB=y +CONFIG_USB_SERIAL_KEYSPAN_USA19=y +CONFIG_USB_SERIAL_KEYSPAN_USA18X=y +CONFIG_USB_SERIAL_KEYSPAN_USA19W=y +CONFIG_USB_SERIAL_KEYSPAN_USA19QW=y +CONFIG_USB_SERIAL_KEYSPAN_USA19QI=y +CONFIG_USB_SERIAL_KEYSPAN_USA49W=y +CONFIG_USB_SERIAL_KEYSPAN_USA49WLC=y +CONFIG_USB_SERIAL_KLSI=m +CONFIG_USB_SERIAL_KOBIL_SCT=m +CONFIG_USB_SERIAL_MCT_U232=m +CONFIG_USB_SERIAL_METRO=m +CONFIG_USB_SERIAL_MOS7720=m +CONFIG_USB_SERIAL_MOS7840=m +CONFIG_USB_SERIAL_MXUPORT=m +CONFIG_USB_SERIAL_NAVMAN=m +CONFIG_USB_SERIAL_PL2303=m +CONFIG_USB_SERIAL_OTI6858=m +CONFIG_USB_SERIAL_QCAUX=m +CONFIG_USB_SERIAL_QUALCOMM=m +CONFIG_USB_SERIAL_SPCP8X5=m +CONFIG_USB_SERIAL_SAFE=m +CONFIG_USB_SERIAL_SAFE_PADDED=y +CONFIG_USB_SERIAL_SIERRAWIRELESS=m +CONFIG_USB_SERIAL_SYMBOL=m +CONFIG_USB_SERIAL_TI=m +CONFIG_USB_SERIAL_CYBERJACK=m +CONFIG_USB_SERIAL_XIRCOM=m +CONFIG_USB_SERIAL_WWAN=m +CONFIG_USB_SERIAL_OPTION=m +CONFIG_USB_SERIAL_OMNINET=m +CONFIG_USB_SERIAL_OPTICON=m +CONFIG_USB_SERIAL_XSENS_MT=m +CONFIG_USB_SERIAL_WISHBONE=m +CONFIG_USB_SERIAL_SSU100=m +CONFIG_USB_SERIAL_QT2=m +CONFIG_USB_SERIAL_DEBUG=m + +# +# USB Miscellaneous drivers +# +CONFIG_USB_EMI62=m +CONFIG_USB_EMI26=m +# CONFIG_USB_ADUTUX is not set +CONFIG_USB_SEVSEG=m +CONFIG_USB_RIO500=m +CONFIG_USB_LEGOTOWER=m +CONFIG_USB_LCD=m +CONFIG_USB_LED=m +CONFIG_USB_CYPRESS_CY7C63=m +CONFIG_USB_CYTHERM=m +CONFIG_USB_IDMOUSE=m +# CONFIG_USB_FTDI_ELAN is not set +CONFIG_USB_APPLEDISPLAY=m +CONFIG_USB_SISUSBVGA=m +CONFIG_USB_SISUSBVGA_CON=y +CONFIG_USB_LD=m +CONFIG_USB_TRANCEVIBRATOR=m +CONFIG_USB_IOWARRIOR=m +# CONFIG_USB_TEST is not set +# CONFIG_USB_EHSET_TEST_FIXTURE is not set +CONFIG_USB_ISIGHTFW=m +# CONFIG_USB_YUREX is not set +CONFIG_USB_EZUSB_FX2=m +CONFIG_USB_HSIC_USB3503=m +# CONFIG_USB_LINK_LAYER_TEST is not set +# CONFIG_USB_CHAOSKEY is not set + +# +# USB Physical Layer drivers +# +CONFIG_USB_PHY=y +CONFIG_NOP_USB_XCEIV=y +CONFIG_AM335X_CONTROL_USB=y +CONFIG_AM335X_PHY_USB=y +CONFIG_USB_GPIO_VBUS=y +CONFIG_USB_ISP1301=y +CONFIG_USB_MXS_PHY=y +# CONFIG_USB_ULPI is not set +CONFIG_USB_GADGET=y +# CONFIG_USB_GADGET_DEBUG_FILES is not set +# CONFIG_USB_GADGET_DEBUG_FS is not set +CONFIG_USB_GADGET_VBUS_DRAW=2 +CONFIG_USB_GADGET_STORAGE_NUM_BUFFERS=2 + +# +# USB Peripheral Controller +# +CONFIG_USB_FSL_USB2=m +# CONFIG_USB_FUSB300 is not set +# CONFIG_USB_FOTG210_UDC is not set +# CONFIG_USB_GR_UDC is not set +# CONFIG_USB_R8A66597 is not set +# CONFIG_USB_PXA27X is not set +# CONFIG_USB_MV_UDC is not set +CONFIG_USB_MV_U3D=m +# CONFIG_USB_M66592 is not set +# CONFIG_USB_BDC_UDC is not set +# CONFIG_USB_AMD5536UDC is not set +# CONFIG_USB_NET2272 is not set +# CONFIG_USB_NET2280 is not set +# CONFIG_USB_GOKU is not set +# CONFIG_USB_EG20T is not set +# CONFIG_USB_GADGET_XILINX is not set +# CONFIG_USB_DUMMY_HCD is not set +CONFIG_USB_LIBCOMPOSITE=m +CONFIG_USB_F_ACM=m +CONFIG_USB_F_SS_LB=m +CONFIG_USB_U_SERIAL=m +CONFIG_USB_U_ETHER=m +CONFIG_USB_F_SERIAL=m +CONFIG_USB_F_OBEX=m +CONFIG_USB_F_NCM=m +CONFIG_USB_F_ECM=m +CONFIG_USB_F_EEM=m +CONFIG_USB_F_SUBSET=m +CONFIG_USB_F_RNDIS=m +CONFIG_USB_F_MASS_STORAGE=m +CONFIG_USB_F_FS=m +CONFIG_USB_F_UAC1=m +CONFIG_USB_F_UAC2=m +CONFIG_USB_F_UVC=m +CONFIG_USB_F_MIDI=m +CONFIG_USB_F_HID=m +CONFIG_USB_F_PRINTER=m +CONFIG_USB_CONFIGFS=m +CONFIG_USB_CONFIGFS_SERIAL=y +CONFIG_USB_CONFIGFS_ACM=y +CONFIG_USB_CONFIGFS_OBEX=y +CONFIG_USB_CONFIGFS_NCM=y +CONFIG_USB_CONFIGFS_ECM=y +CONFIG_USB_CONFIGFS_ECM_SUBSET=y +CONFIG_USB_CONFIGFS_RNDIS=y +CONFIG_USB_CONFIGFS_EEM=y +CONFIG_USB_CONFIGFS_MASS_STORAGE=y +CONFIG_USB_CONFIGFS_F_LB_SS=y +CONFIG_USB_CONFIGFS_F_FS=y +CONFIG_USB_CONFIGFS_F_UAC1=y +CONFIG_USB_CONFIGFS_F_UAC2=y +CONFIG_USB_CONFIGFS_F_MIDI=y +CONFIG_USB_CONFIGFS_F_HID=y +CONFIG_USB_CONFIGFS_F_UVC=y +CONFIG_USB_CONFIGFS_F_PRINTER=y +CONFIG_USB_ZERO=m +# CONFIG_USB_ZERO_HNPTEST is not set +CONFIG_USB_AUDIO=m +# CONFIG_GADGET_UAC1 is not set +CONFIG_USB_ETH=m +CONFIG_USB_ETH_RNDIS=y +# CONFIG_USB_ETH_EEM is not set +CONFIG_USB_G_NCM=m +CONFIG_USB_GADGETFS=m +CONFIG_USB_FUNCTIONFS=m +# CONFIG_USB_FUNCTIONFS_ETH is not set +# CONFIG_USB_FUNCTIONFS_RNDIS is not set +CONFIG_USB_FUNCTIONFS_GENERIC=y +CONFIG_USB_MASS_STORAGE=m +CONFIG_USB_G_SERIAL=m +CONFIG_USB_MIDI_GADGET=m +CONFIG_USB_G_PRINTER=m +CONFIG_USB_CDC_COMPOSITE=m +CONFIG_USB_G_ACM_MS=m +CONFIG_USB_G_MULTI=m +CONFIG_USB_G_MULTI_RNDIS=y +# CONFIG_USB_G_MULTI_CDC is not set +CONFIG_USB_G_HID=m +# CONFIG_USB_G_DBGP is not set +CONFIG_USB_G_WEBCAM=m +CONFIG_USB_LED_TRIG=y +# CONFIG_UWB is not set +CONFIG_MMC=y +# CONFIG_MMC_DEBUG is not set + +# +# MMC/SD/SDIO Card Drivers +# +CONFIG_MMC_BLOCK=y +CONFIG_MMC_BLOCK_MINORS=8 +CONFIG_MMC_BLOCK_BOUNCE=y +CONFIG_SDIO_UART=y +# CONFIG_MMC_TEST is not set + +# +# MMC/SD/SDIO Host Controller Drivers +# +CONFIG_MMC_SDHCI=y +CONFIG_MMC_SDHCI_IO_ACCESSORS=y +# CONFIG_MMC_SDHCI_PCI is not set +CONFIG_MMC_SDHCI_PLTFM=y +CONFIG_MMC_SDHCI_OF_ARASAN=m +# CONFIG_MMC_SDHCI_OF_AT91 is not set +# CONFIG_MMC_SDHCI_OF_ESDHC is not set +CONFIG_MMC_SDHCI_ESDHC_IMX=y +# CONFIG_MMC_SDHCI_F_SDH30 is not set +# CONFIG_MMC_MXC is not set +CONFIG_MMC_TIFM_SD=m +CONFIG_MMC_CB710=m +# CONFIG_MMC_VIA_SDMMC is not set +# CONFIG_MMC_DW is not set +CONFIG_MMC_VUB300=m +CONFIG_MMC_USHC=y +CONFIG_MMC_USDHI6ROL0=m +CONFIG_MMC_TOSHIBA_PCI=m +# CONFIG_MMC_MTK is not set +# CONFIG_MEMSTICK is not set +CONFIG_NEW_LEDS=y +CONFIG_LEDS_CLASS=y +# CONFIG_LEDS_CLASS_FLASH is not set + +# +# LED drivers +# +CONFIG_LEDS_88PM860X=y +# CONFIG_LEDS_BCM6328 is not set +# CONFIG_LEDS_BCM6358 is not set +# CONFIG_LEDS_LM3530 is not set +# CONFIG_LEDS_LM3642 is not set +# CONFIG_LEDS_PCA9532 is not set +CONFIG_LEDS_GPIO=m +# CONFIG_LEDS_LP3944 is not set +# CONFIG_LEDS_LP5521 is not set +# CONFIG_LEDS_LP5523 is not set +# CONFIG_LEDS_LP5562 is not set +# CONFIG_LEDS_LP8501 is not set +# CONFIG_LEDS_LP8860 is not set +# CONFIG_LEDS_PCA955X is not set +# CONFIG_LEDS_PCA963X is not set +# CONFIG_LEDS_DA9052 is not set +# CONFIG_LEDS_DAC124S085 is not set +CONFIG_LEDS_PWM=y +CONFIG_LEDS_REGULATOR=m +# CONFIG_LEDS_BD2802 is not set +# CONFIG_LEDS_LT3593 is not set +# CONFIG_LEDS_MC13783 is not set +# CONFIG_LEDS_TCA6507 is not set +# CONFIG_LEDS_TLC591XX is not set +# CONFIG_LEDS_LM355x is not set + +# +# LED driver for blink(1) USB RGB LED is under Special HID drivers (HID_THINGM) +# +# CONFIG_LEDS_BLINKM is not set +# CONFIG_LEDS_SYSCON is not set + +# +# LED Triggers +# +CONFIG_LEDS_TRIGGERS=y +CONFIG_LEDS_TRIGGER_TIMER=y +CONFIG_LEDS_TRIGGER_ONESHOT=m +CONFIG_LEDS_TRIGGER_HEARTBEAT=y +CONFIG_LEDS_TRIGGER_BACKLIGHT=m +CONFIG_LEDS_TRIGGER_GPIO=m +CONFIG_LEDS_TRIGGER_DEFAULT_ON=y + +# +# iptables trigger is under Netfilter config (LED target) +# +CONFIG_LEDS_TRIGGER_TRANSIENT=m +CONFIG_LEDS_TRIGGER_CAMERA=m +# CONFIG_ACCESSIBILITY is not set +# CONFIG_INFINIBAND is not set +CONFIG_EDAC_ATOMIC_SCRUB=y +CONFIG_EDAC_SUPPORT=y +# CONFIG_EDAC is not set +CONFIG_RTC_LIB=y +CONFIG_RTC_CLASS=y +CONFIG_RTC_HCTOSYS=y +CONFIG_RTC_HCTOSYS_DEVICE="rtc0" +# CONFIG_RTC_SYSTOHC is not set +# CONFIG_RTC_DEBUG is not set + +# +# RTC interfaces +# +CONFIG_RTC_INTF_SYSFS=y +CONFIG_RTC_INTF_PROC=y +CONFIG_RTC_INTF_DEV=y +CONFIG_RTC_INTF_DEV_UIE_EMUL=y +# CONFIG_RTC_DRV_TEST is not set + +# +# I2C RTC drivers +# +CONFIG_RTC_DRV_88PM860X=y +CONFIG_RTC_DRV_88PM80X=y +# CONFIG_RTC_DRV_ABB5ZES3 is not set +# CONFIG_RTC_DRV_ABX80X is not set +# CONFIG_RTC_DRV_DS1307 is not set +# CONFIG_RTC_DRV_DS1374 is not set +# CONFIG_RTC_DRV_DS1672 is not set +# CONFIG_RTC_DRV_DS3232 is not set +# CONFIG_RTC_DRV_HYM8563 is not set +# CONFIG_RTC_DRV_MAX6900 is not set +# CONFIG_RTC_DRV_RS5C372 is not set +# CONFIG_RTC_DRV_ISL1208 is not set +# CONFIG_RTC_DRV_ISL12022 is not set +# CONFIG_RTC_DRV_ISL12057 is not set +# CONFIG_RTC_DRV_X1205 is not set +# CONFIG_RTC_DRV_PCF2127 is not set +CONFIG_RTC_DRV_PCF8523=y +# CONFIG_RTC_DRV_PCF8563 is not set +# CONFIG_RTC_DRV_PCF85063 is not set +# CONFIG_RTC_DRV_PCF8583 is not set +# CONFIG_RTC_DRV_M41T80 is not set +# CONFIG_RTC_DRV_BQ32K is not set +CONFIG_RTC_DRV_S35390A=y +# CONFIG_RTC_DRV_FM3130 is not set +# CONFIG_RTC_DRV_RX8581 is not set +# CONFIG_RTC_DRV_RX8025 is not set +# CONFIG_RTC_DRV_EM3027 is not set +# CONFIG_RTC_DRV_RV3029C2 is not set +# CONFIG_RTC_DRV_RV8803 is not set + +# +# SPI RTC drivers +# +# CONFIG_RTC_DRV_M41T93 is not set +# CONFIG_RTC_DRV_M41T94 is not set +# CONFIG_RTC_DRV_DS1305 is not set +# CONFIG_RTC_DRV_DS1343 is not set +# CONFIG_RTC_DRV_DS1347 is not set +# CONFIG_RTC_DRV_DS1390 is not set +# CONFIG_RTC_DRV_MAX6902 is not set +# CONFIG_RTC_DRV_R9701 is not set +# CONFIG_RTC_DRV_RS5C348 is not set +# CONFIG_RTC_DRV_DS3234 is not set +# CONFIG_RTC_DRV_PCF2123 is not set +# CONFIG_RTC_DRV_RX4581 is not set +# CONFIG_RTC_DRV_MCP795 is not set + +# +# Platform RTC drivers +# +CONFIG_RTC_DRV_CMOS=y +# CONFIG_RTC_DRV_DS1286 is not set +# CONFIG_RTC_DRV_DS1511 is not set +# CONFIG_RTC_DRV_DS1553 is not set +# CONFIG_RTC_DRV_DS1685_FAMILY is not set +# CONFIG_RTC_DRV_DS1742 is not set +# CONFIG_RTC_DRV_DS2404 is not set +# CONFIG_RTC_DRV_DA9052 is not set +# CONFIG_RTC_DRV_STK17TA8 is not set +# CONFIG_RTC_DRV_M48T86 is not set +# CONFIG_RTC_DRV_M48T35 is not set +# CONFIG_RTC_DRV_M48T59 is not set +# CONFIG_RTC_DRV_MSM6242 is not set +# CONFIG_RTC_DRV_BQ4802 is not set +# CONFIG_RTC_DRV_RP5C01 is not set +# CONFIG_RTC_DRV_V3020 is not set +# CONFIG_RTC_DRV_ZYNQMP is not set + +# +# on-CPU RTC drivers +# +CONFIG_RTC_DRV_IMXDI=y +CONFIG_RTC_DRV_MC13XXX=y +CONFIG_RTC_DRV_MXC=y +CONFIG_RTC_DRV_SNVS=y + +# +# HID Sensor RTC drivers +# +# CONFIG_RTC_DRV_HID_SENSOR_TIME is not set +CONFIG_DMADEVICES=y +# CONFIG_DMADEVICES_DEBUG is not set + +# +# DMA Devices +# +CONFIG_DMA_ENGINE=y +CONFIG_DMA_VIRTUAL_CHANNELS=y +CONFIG_DMA_OF=y +CONFIG_FSL_EDMA=m +# CONFIG_IMX_DMA is not set +CONFIG_IMX_SDMA=y +CONFIG_INTEL_IDMA64=y +CONFIG_MXS_DMA=y +# CONFIG_MX3_IPU is not set +CONFIG_MXC_PXP_V2=y +CONFIG_MXC_PXP_CLIENT_DEVICE=y +# CONFIG_NBPFAXI_DMA is not set +CONFIG_DW_DMAC_CORE=m +CONFIG_DW_DMAC=m +CONFIG_DW_DMAC_PCI=m + +# +# DMA Clients +# +CONFIG_ASYNC_TX_DMA=y +# CONFIG_DMATEST is not set +# CONFIG_AUXDISPLAY is not set +CONFIG_UIO=m +# CONFIG_UIO_CIF is not set +CONFIG_UIO_PDRV_GENIRQ=m +CONFIG_UIO_DMEM_GENIRQ=m +# CONFIG_UIO_AEC is not set +# CONFIG_UIO_SERCOS3 is not set +CONFIG_UIO_PCI_GENERIC=m +# CONFIG_UIO_NETX is not set +# CONFIG_UIO_PRUSS is not set +# CONFIG_UIO_MF624 is not set +# CONFIG_VIRT_DRIVERS is not set +CONFIG_VIRTIO=m + +# +# Virtio drivers +# +# CONFIG_VIRTIO_PCI is not set +# CONFIG_VIRTIO_BALLOON is not set +# CONFIG_VIRTIO_INPUT is not set +# CONFIG_VIRTIO_MMIO is not set + +# +# Microsoft Hyper-V guest support +# +CONFIG_STAGING=y +CONFIG_PRISM2_USB=m +CONFIG_COMEDI=m +# CONFIG_COMEDI_DEBUG is not set +CONFIG_COMEDI_DEFAULT_BUF_SIZE_KB=2048 +CONFIG_COMEDI_DEFAULT_BUF_MAXSIZE_KB=20480 +# CONFIG_COMEDI_MISC_DRIVERS is not set +# CONFIG_COMEDI_ISA_DRIVERS is not set +# CONFIG_COMEDI_PCI_DRIVERS is not set +# CONFIG_COMEDI_USB_DRIVERS is not set +# CONFIG_COMEDI_8255_SA is not set +# CONFIG_COMEDI_KCOMEDILIB is not set +CONFIG_RTL8192U=m +CONFIG_RTLLIB=m +CONFIG_RTLLIB_CRYPTO_CCMP=m +CONFIG_RTLLIB_CRYPTO_TKIP=m +CONFIG_RTLLIB_CRYPTO_WEP=m +CONFIG_RTL8192E=m +CONFIG_R8712U=m +CONFIG_R8188EU=m +CONFIG_88EU_AP_MODE=y +CONFIG_R8723AU=m +CONFIG_8723AU_AP_MODE=y +CONFIG_8723AU_BT_COEXIST=y +CONFIG_RTS5208=m +# CONFIG_VT6655 is not set +# CONFIG_VT6656 is not set + +# +# IIO staging drivers +# + +# +# Accelerometers +# +# CONFIG_ADIS16201 is not set +# CONFIG_ADIS16203 is not set +# CONFIG_ADIS16204 is not set +# CONFIG_ADIS16209 is not set +# CONFIG_ADIS16220 is not set +# CONFIG_ADIS16240 is not set +# CONFIG_LIS3L02DQ is not set +# CONFIG_SCA3000 is not set + +# +# Analog to digital converters +# +# CONFIG_AD7606 is not set +# CONFIG_AD7780 is not set +# CONFIG_AD7816 is not set +# CONFIG_AD7192 is not set +# CONFIG_AD7280 is not set + +# +# Analog digital bi-direction converters +# +# CONFIG_ADT7316 is not set + +# +# Capacitance to digital converters +# +# CONFIG_AD7150 is not set +# CONFIG_AD7152 is not set +# CONFIG_AD7746 is not set + +# +# Direct Digital Synthesis +# +# CONFIG_AD9832 is not set +# CONFIG_AD9834 is not set + +# +# Digital gyroscope sensors +# +# CONFIG_ADIS16060 is not set + +# +# Network Analyzer, Impedance Converters +# +# CONFIG_AD5933 is not set + +# +# Light sensors +# +# CONFIG_SENSORS_ISL29018 is not set +# CONFIG_SENSORS_ISL29028 is not set +# CONFIG_TSL2583 is not set +# CONFIG_TSL2x7x is not set + +# +# Magnetometer sensors +# +# CONFIG_SENSORS_HMC5843_I2C is not set +# CONFIG_SENSORS_HMC5843_SPI is not set + +# +# Active energy metering IC +# +# CONFIG_ADE7753 is not set +# CONFIG_ADE7754 is not set +# CONFIG_ADE7758 is not set +# CONFIG_ADE7759 is not set +# CONFIG_ADE7854 is not set + +# +# Resolver to digital converters +# +# CONFIG_AD2S90 is not set +# CONFIG_AD2S1200 is not set +# CONFIG_AD2S1210 is not set + +# +# Triggers - standalone +# +CONFIG_IIO_PERIODIC_RTC_TRIGGER=m +# CONFIG_IIO_SIMPLE_DUMMY is not set +# CONFIG_FB_SM750 is not set +# CONFIG_FB_XGI is not set + +# +# Speakup console speech +# +CONFIG_SPEAKUP=m +CONFIG_SPEAKUP_SYNTH_ACNTSA=m +CONFIG_SPEAKUP_SYNTH_APOLLO=m +CONFIG_SPEAKUP_SYNTH_AUDPTR=m +CONFIG_SPEAKUP_SYNTH_BNS=m +CONFIG_SPEAKUP_SYNTH_DECTLK=m +CONFIG_SPEAKUP_SYNTH_DECEXT=m +CONFIG_SPEAKUP_SYNTH_LTLK=m +CONFIG_SPEAKUP_SYNTH_SOFT=m +CONFIG_SPEAKUP_SYNTH_SPKOUT=m +CONFIG_SPEAKUP_SYNTH_TXPRT=m +CONFIG_SPEAKUP_SYNTH_DUMMY=m +CONFIG_TOUCHSCREEN_SYNAPTICS_I2C_RMI4=m +CONFIG_STAGING_MEDIA=y +CONFIG_I2C_BCM2048=m +CONFIG_DVB_CXD2099=m +CONFIG_DVB_MN88472=m +CONFIG_DVB_MN88473=m +CONFIG_LIRC_STAGING=y +CONFIG_LIRC_BT829=m +CONFIG_LIRC_IMON=m +CONFIG_LIRC_HB=m +CONFIG_LIRC_XBOX=m +CONFIG_LIRC_SASEM=m +CONFIG_LIRC_SERIAL=m +CONFIG_LIRC_SERIAL_TRANSMITTER=y +CONFIG_LIRC_SIR=m +CONFIG_LIRC_ZILOG=m +CONFIG_LIRC_ATIUSB=m + +# +# Android +# +# CONFIG_STAGING_BOARD is not set +CONFIG_WIMAX_GDM72XX=m +CONFIG_WIMAX_GDM72XX_QOS=y +CONFIG_WIMAX_GDM72XX_K_MODE=y +CONFIG_WIMAX_GDM72XX_WIMAX2=y +CONFIG_WIMAX_GDM72XX_USB=y +# CONFIG_WIMAX_GDM72XX_SDIO is not set +CONFIG_WIMAX_GDM72XX_USB_PM=y +CONFIG_LTE_GDM724X=m +CONFIG_MTD_SPINAND_MT29F=m +# CONFIG_MTD_SPINAND_ONDIEECC is not set +# CONFIG_LUSTRE_FS is not set +CONFIG_DGNC=m +CONFIG_DGAP=m +# CONFIG_GS_FPGABOOT is not set +# CONFIG_COMMON_CLK_XLNX_CLKWZRD is not set +CONFIG_FB_TFT=m +CONFIG_FB_TFT_AGM1264K_FL=m +CONFIG_FB_TFT_BD663474=m +CONFIG_FB_TFT_HX8340BN=m +CONFIG_FB_TFT_HX8347D=m +CONFIG_FB_TFT_HX8353D=m +CONFIG_FB_TFT_HX8357D=m +CONFIG_FB_TFT_ILI9163=m +CONFIG_FB_TFT_ILI9320=m +CONFIG_FB_TFT_ILI9325=m +CONFIG_FB_TFT_ILI9340=m +CONFIG_FB_TFT_ILI9341=m +CONFIG_FB_TFT_ILI9481=m +CONFIG_FB_TFT_ILI9486=m +CONFIG_FB_TFT_PCD8544=m +CONFIG_FB_TFT_RA8875=m +CONFIG_FB_TFT_S6D02A1=m +CONFIG_FB_TFT_S6D1121=m +CONFIG_FB_TFT_SSD1289=m +CONFIG_FB_TFT_SSD1306=m +CONFIG_FB_TFT_SSD1331=m +CONFIG_FB_TFT_SSD1351=m +CONFIG_FB_TFT_ST7735R=m +CONFIG_FB_TFT_ST7789V=m +CONFIG_FB_TFT_TINYLCD=m +CONFIG_FB_TFT_TLS8204=m +CONFIG_FB_TFT_UC1611=m +CONFIG_FB_TFT_UC1701=m +CONFIG_FB_TFT_UPD161704=m +CONFIG_FB_TFT_WATTEROTT=m +CONFIG_FB_FLEX=m +CONFIG_FB_TFT_FBTFT_DEVICE=m +# CONFIG_WILC1000_DRIVER is not set +# CONFIG_MOST is not set +# CONFIG_CHROME_PLATFORMS is not set +CONFIG_CLKDEV_LOOKUP=y +CONFIG_HAVE_CLK_PREPARE=y +CONFIG_COMMON_CLK=y + +# +# Common Clock Framework +# +# CONFIG_COMMON_CLK_SI5351 is not set +# CONFIG_COMMON_CLK_SI514 is not set +# CONFIG_COMMON_CLK_SI570 is not set +# CONFIG_COMMON_CLK_CDCE925 is not set +# CONFIG_CLK_QORIQ is not set +# CONFIG_COMMON_CLK_PWM is not set +# CONFIG_COMMON_CLK_PXA is not set +# CONFIG_COMMON_CLK_CDCE706 is not set + +# +# Hardware Spinlock drivers +# + +# +# Clock Source drivers +# +CONFIG_CLKSRC_OF=y +CONFIG_CLKSRC_PROBE=y +CONFIG_CLKSRC_MMIO=y +# CONFIG_ARM_TIMER_SP804 is not set +# CONFIG_ATMEL_PIT is not set +# CONFIG_SH_TIMER_CMT is not set +# CONFIG_SH_TIMER_MTU2 is not set +# CONFIG_SH_TIMER_TMU is not set +# CONFIG_EM_TIMER_STI is not set +CONFIG_CLKSRC_IMX_GPT=y +# CONFIG_MAILBOX is not set +CONFIG_IOMMU_SUPPORT=y + +# +# Generic IOMMU Pagetable Support +# +# CONFIG_IOMMU_IO_PGTABLE_LPAE is not set +# CONFIG_ARM_SMMU is not set + +# +# Remoteproc drivers +# +# CONFIG_STE_MODEM_RPROC is not set + +# +# Rpmsg drivers +# + +# +# SOC (System On Chip) specific Drivers +# +# CONFIG_SOC_BRCMSTB is not set +# CONFIG_SUNXI_SRAM is not set +# CONFIG_SOC_TI is not set +CONFIG_PM_DEVFREQ=y + +# +# DEVFREQ Governors +# +CONFIG_DEVFREQ_GOV_SIMPLE_ONDEMAND=y +CONFIG_DEVFREQ_GOV_PERFORMANCE=y +CONFIG_DEVFREQ_GOV_POWERSAVE=y +CONFIG_DEVFREQ_GOV_USERSPACE=y + +# +# DEVFREQ Drivers +# +CONFIG_PM_DEVFREQ_EVENT=y +CONFIG_EXTCON=y + +# +# Extcon Device Drivers +# +CONFIG_EXTCON_ADC_JACK=m +CONFIG_EXTCON_GPIO=y +CONFIG_EXTCON_RT8973A=m +CONFIG_EXTCON_SM5502=m +CONFIG_EXTCON_USB_GPIO=y +CONFIG_MEMORY=y +CONFIG_IIO=m +CONFIG_IIO_BUFFER=y +# CONFIG_IIO_BUFFER_CB is not set +CONFIG_IIO_KFIFO_BUF=m +CONFIG_IIO_TRIGGERED_BUFFER=m +CONFIG_IIO_TRIGGER=y +CONFIG_IIO_CONSUMERS_PER_TRIGGER=2 + +# +# Accelerometers +# +# CONFIG_BMA180 is not set +# CONFIG_BMC150_ACCEL is not set +# CONFIG_HID_SENSOR_ACCEL_3D is not set +# CONFIG_IIO_ST_ACCEL_3AXIS is not set +# CONFIG_KXSD9 is not set +# CONFIG_KXCJK1013 is not set +# CONFIG_MMA8452 is not set +# CONFIG_MMA9551 is not set +# CONFIG_MMA9553 is not set +# CONFIG_MXC4005 is not set +# CONFIG_STK8312 is not set +# CONFIG_STK8BA50 is not set + +# +# Analog to digital converters +# +# CONFIG_AD7266 is not set +# CONFIG_AD7291 is not set +# CONFIG_AD7298 is not set +# CONFIG_AD7476 is not set +# CONFIG_AD7791 is not set +# CONFIG_AD7793 is not set +# CONFIG_AD7887 is not set +# CONFIG_AD7923 is not set +# CONFIG_AD799X is not set +# CONFIG_CC10001_ADC is not set +# CONFIG_HI8435 is not set +# CONFIG_MAX1027 is not set +# CONFIG_MAX1363 is not set +# CONFIG_MCP320X is not set +# CONFIG_MCP3422 is not set +# CONFIG_NAU7802 is not set +# CONFIG_TI_ADC081C is not set +# CONFIG_TI_ADC128S052 is not set +# CONFIG_VF610_ADC is not set + +# +# Amplifiers +# +# CONFIG_AD8366 is not set + +# +# Chemical Sensors +# +# CONFIG_VZ89X is not set + +# +# Hid Sensor IIO Common +# +CONFIG_HID_SENSOR_IIO_COMMON=m +CONFIG_HID_SENSOR_IIO_TRIGGER=m + +# +# SSP Sensor Common +# +# CONFIG_IIO_SSP_SENSORHUB is not set + +# +# Digital to analog converters +# +# CONFIG_AD5064 is not set +# CONFIG_AD5360 is not set +# CONFIG_AD5380 is not set +# CONFIG_AD5421 is not set +# CONFIG_AD5446 is not set +# CONFIG_AD5449 is not set +# CONFIG_AD5504 is not set +# CONFIG_AD5624R_SPI is not set +# CONFIG_AD5686 is not set +# CONFIG_AD5755 is not set +# CONFIG_AD5764 is not set +# CONFIG_AD5791 is not set +# CONFIG_AD7303 is not set +# CONFIG_M62332 is not set +# CONFIG_MAX517 is not set +# CONFIG_MAX5821 is not set +# CONFIG_MCP4725 is not set +# CONFIG_MCP4922 is not set + +# +# Frequency Synthesizers DDS/PLL +# + +# +# Clock Generator/Distribution +# +# CONFIG_AD9523 is not set + +# +# Phase-Locked Loop (PLL) frequency synthesizers +# +# CONFIG_ADF4350 is not set + +# +# Digital gyroscope sensors +# +# CONFIG_ADIS16080 is not set +# CONFIG_ADIS16130 is not set +# CONFIG_ADIS16136 is not set +# CONFIG_ADIS16260 is not set +# CONFIG_ADXRS450 is not set +# CONFIG_BMG160 is not set +CONFIG_HID_SENSOR_GYRO_3D=m +# CONFIG_IIO_ST_GYRO_3AXIS is not set +# CONFIG_ITG3200 is not set + +# +# Humidity sensors +# +CONFIG_DHT11=m +# CONFIG_HDC100X is not set +# CONFIG_HTU21 is not set +# CONFIG_SI7005 is not set +# CONFIG_SI7020 is not set + +# +# Inertial measurement units +# +# CONFIG_ADIS16400 is not set +# CONFIG_ADIS16480 is not set +# CONFIG_KMX61 is not set +# CONFIG_INV_MPU6050_IIO is not set + +# +# Light sensors +# +# CONFIG_ADJD_S311 is not set +# CONFIG_AL3320A is not set +# CONFIG_APDS9300 is not set +# CONFIG_APDS9960 is not set +# CONFIG_BH1750 is not set +# CONFIG_CM32181 is not set +# CONFIG_CM3232 is not set +# CONFIG_CM3323 is not set +# CONFIG_CM36651 is not set +# CONFIG_GP2AP020A00F is not set +# CONFIG_ISL29125 is not set +# CONFIG_HID_SENSOR_ALS is not set +# CONFIG_HID_SENSOR_PROX is not set +# CONFIG_JSA1212 is not set +# CONFIG_RPR0521 is not set +# CONFIG_LTR501 is not set +# CONFIG_OPT3001 is not set +# CONFIG_PA12203001 is not set +# CONFIG_STK3310 is not set +# CONFIG_TCS3414 is not set +# CONFIG_TCS3472 is not set +# CONFIG_SENSORS_TSL2563 is not set +# CONFIG_TSL4531 is not set +# CONFIG_US5182D is not set +# CONFIG_VCNL4000 is not set + +# +# Magnetometer sensors +# +# CONFIG_AK8975 is not set +# CONFIG_AK09911 is not set +# CONFIG_BMC150_MAGN is not set +# CONFIG_MAG3110 is not set +# CONFIG_HID_SENSOR_MAGNETOMETER_3D is not set +# CONFIG_MMC35240 is not set +# CONFIG_IIO_ST_MAGN_3AXIS is not set + +# +# Inclinometer sensors +# +# CONFIG_HID_SENSOR_INCLINOMETER_3D is not set +# CONFIG_HID_SENSOR_DEVICE_ROTATION is not set + +# +# Triggers - standalone +# +CONFIG_IIO_INTERRUPT_TRIGGER=m +CONFIG_IIO_SYSFS_TRIGGER=m + +# +# Digital potentiometers +# +# CONFIG_MCP4531 is not set + +# +# Pressure sensors +# +# CONFIG_BMP280 is not set +# CONFIG_HID_SENSOR_PRESS is not set +# CONFIG_MPL115 is not set +# CONFIG_MPL3115 is not set +# CONFIG_MS5611 is not set +# CONFIG_MS5637 is not set +# CONFIG_IIO_ST_PRESS is not set +# CONFIG_T5403 is not set + +# +# Lightning sensors +# +# CONFIG_AS3935 is not set + +# +# Proximity sensors +# +# CONFIG_LIDAR_LITE_V2 is not set +# CONFIG_SX9500 is not set + +# +# Temperature sensors +# +# CONFIG_MLX90614 is not set +# CONFIG_TMP006 is not set +# CONFIG_TSYS01 is not set +# CONFIG_TSYS02D is not set +# CONFIG_NTB is not set +# CONFIG_VME_BUS is not set +CONFIG_PWM=y +CONFIG_PWM_SYSFS=y +CONFIG_PWM_FSL_FTM=y +CONFIG_PWM_IMX=y +CONFIG_PWM_PCA9685=y +CONFIG_IRQCHIP=y +CONFIG_ARM_GIC=y +# CONFIG_IPACK_BUS is not set +CONFIG_ARCH_HAS_RESET_CONTROLLER=y +CONFIG_RESET_CONTROLLER=y +# CONFIG_FMC is not set + +# +# PHY Subsystem +# +CONFIG_GENERIC_PHY=y +CONFIG_PHY_PXA_28NM_HSIC=y +CONFIG_PHY_PXA_28NM_USB2=y +# CONFIG_BCM_KONA_USB2_PHY is not set +# CONFIG_PHY_SAMSUNG_USB2 is not set +CONFIG_POWERCAP=y +# CONFIG_MCB is not set + +# +# Performance monitor support +# +CONFIG_ARM_PMU=y +CONFIG_RAS=y +# CONFIG_THUNDERBOLT is not set + +# +# Android +# +# CONFIG_ANDROID is not set +CONFIG_NVMEM=y +CONFIG_NVMEM_IMX_OCOTP=m +# CONFIG_STM is not set +# CONFIG_STM_DUMMY is not set +# CONFIG_STM_SOURCE_CONSOLE is not set +# CONFIG_INTEL_TH is not set + +# +# FPGA Configuration Support +# +# CONFIG_FPGA is not set + +# +# MXC support drivers +# +CONFIG_MXC_IPU=y + +# +# Vivante GPU support +# +CONFIG_MXC_GPU_VIV=y +CONFIG_MXC_IPU_V3_FSL=y + +# +# MXC VPU(Video Processing Unit) support +# +CONFIG_MXC_VPU=y +# CONFIG_MXC_VPU_DEBUG is not set +# CONFIG_MX6_VPU_352M is not set + +# +# MXC HDMI CEC (Consumer Electronics Control) support +# +# CONFIG_MXC_HDMI_CEC is not set +CONFIG_MXC_HDMI_CEC_SR=y + +# +# MXC MIPI Support +# +CONFIG_MXC_MIPI_CSI2=y + +# +# MXC Media Local Bus Driver +# +CONFIG_MXC_MLB=y +CONFIG_MXC_MLB150=m + +# +# Firmware Drivers +# +CONFIG_FIRMWARE_MEMMAP=y + +# +# File systems +# +CONFIG_DCACHE_WORD_ACCESS=y +# CONFIG_EXT2_FS is not set +# CONFIG_EXT3_FS is not set +CONFIG_EXT4_FS=y +CONFIG_EXT4_USE_FOR_EXT2=y +CONFIG_EXT4_FS_POSIX_ACL=y +CONFIG_EXT4_FS_SECURITY=y +CONFIG_EXT4_ENCRYPTION=y +CONFIG_EXT4_FS_ENCRYPTION=y +# CONFIG_EXT4_DEBUG is not set +CONFIG_JBD2=y +# CONFIG_JBD2_DEBUG is not set +CONFIG_FS_MBCACHE=y +CONFIG_REISERFS_FS=m +# CONFIG_REISERFS_CHECK is not set +# CONFIG_REISERFS_PROC_INFO is not set +CONFIG_REISERFS_FS_XATTR=y +CONFIG_REISERFS_FS_POSIX_ACL=y +# CONFIG_REISERFS_FS_SECURITY is not set +CONFIG_JFS_FS=m +CONFIG_JFS_POSIX_ACL=y +CONFIG_JFS_SECURITY=y +# CONFIG_JFS_DEBUG is not set +# CONFIG_JFS_STATISTICS is not set +CONFIG_XFS_FS=m +CONFIG_XFS_QUOTA=y +CONFIG_XFS_POSIX_ACL=y +# CONFIG_XFS_RT is not set +# CONFIG_XFS_WARN is not set +# CONFIG_XFS_DEBUG is not set +# CONFIG_GFS2_FS is not set +# CONFIG_OCFS2_FS is not set +CONFIG_BTRFS_FS=y +CONFIG_BTRFS_FS_POSIX_ACL=y +# CONFIG_BTRFS_FS_CHECK_INTEGRITY is not set +# CONFIG_BTRFS_FS_RUN_SANITY_TESTS is not set +# CONFIG_BTRFS_DEBUG is not set +# CONFIG_BTRFS_ASSERT is not set +# CONFIG_NILFS2_FS is not set +CONFIG_F2FS_FS=m +CONFIG_F2FS_STAT_FS=y +CONFIG_F2FS_FS_XATTR=y +CONFIG_F2FS_FS_POSIX_ACL=y +# CONFIG_F2FS_FS_SECURITY is not set +# CONFIG_F2FS_CHECK_FS is not set +# CONFIG_F2FS_FS_ENCRYPTION is not set +# CONFIG_F2FS_IO_TRACE is not set +CONFIG_FS_POSIX_ACL=y +CONFIG_EXPORTFS=y +CONFIG_FILE_LOCKING=y +CONFIG_FSNOTIFY=y +CONFIG_DNOTIFY=y +CONFIG_INOTIFY_USER=y +CONFIG_FANOTIFY=y +CONFIG_QUOTA=y +# CONFIG_QUOTA_NETLINK_INTERFACE is not set +CONFIG_PRINT_QUOTA_WARNING=y +# CONFIG_QUOTA_DEBUG is not set +CONFIG_QUOTA_TREE=m +CONFIG_QFMT_V1=m +CONFIG_QFMT_V2=m +CONFIG_QUOTACTL=y +CONFIG_AUTOFS4_FS=y +CONFIG_FUSE_FS=y +CONFIG_CUSE=y +CONFIG_OVERLAY_FS=y + +# +# Caches +# +CONFIG_FSCACHE=m +# CONFIG_FSCACHE_STATS is not set +# CONFIG_FSCACHE_HISTOGRAM is not set +# CONFIG_FSCACHE_DEBUG is not set +# CONFIG_FSCACHE_OBJECT_LIST is not set +CONFIG_CACHEFILES=m +# CONFIG_CACHEFILES_DEBUG is not set +# CONFIG_CACHEFILES_HISTOGRAM is not set + +# +# CD-ROM/DVD Filesystems +# +CONFIG_ISO9660_FS=y +CONFIG_JOLIET=y +CONFIG_ZISOFS=y +CONFIG_UDF_FS=y +CONFIG_UDF_NLS=y + +# +# DOS/FAT/NT Filesystems +# +CONFIG_FAT_FS=y +CONFIG_MSDOS_FS=y +CONFIG_VFAT_FS=y +CONFIG_FAT_DEFAULT_CODEPAGE=437 +CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1" +CONFIG_NTFS_FS=m +# CONFIG_NTFS_DEBUG is not set +CONFIG_NTFS_RW=y + +# +# Pseudo filesystems +# +CONFIG_PROC_FS=y +CONFIG_PROC_SYSCTL=y +CONFIG_PROC_PAGE_MONITOR=y +CONFIG_PROC_CHILDREN=y +CONFIG_KERNFS=y +CONFIG_SYSFS=y +CONFIG_TMPFS=y +CONFIG_TMPFS_POSIX_ACL=y +CONFIG_TMPFS_XATTR=y +# CONFIG_HUGETLB_PAGE is not set +CONFIG_CONFIGFS_FS=y +CONFIG_MISC_FILESYSTEMS=y +# CONFIG_ADFS_FS is not set +# CONFIG_AFFS_FS is not set +# CONFIG_ECRYPT_FS is not set +CONFIG_HFS_FS=m +CONFIG_HFSPLUS_FS=m +# CONFIG_HFSPLUS_FS_POSIX_ACL is not set +# CONFIG_BEFS_FS is not set +# CONFIG_BFS_FS is not set +# CONFIG_EFS_FS is not set +CONFIG_JFFS2_FS=m +CONFIG_JFFS2_FS_DEBUG=0 +CONFIG_JFFS2_FS_WRITEBUFFER=y +# CONFIG_JFFS2_FS_WBUF_VERIFY is not set +# CONFIG_JFFS2_SUMMARY is not set +# CONFIG_JFFS2_FS_XATTR is not set +# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set +CONFIG_JFFS2_ZLIB=y +# CONFIG_JFFS2_LZO is not set +CONFIG_JFFS2_RTIME=y +# CONFIG_JFFS2_RUBIN is not set +CONFIG_UBIFS_FS=m +# CONFIG_UBIFS_FS_ADVANCED_COMPR is not set +CONFIG_UBIFS_FS_LZO=y +CONFIG_UBIFS_FS_ZLIB=y +# CONFIG_UBIFS_ATIME_SUPPORT is not set +CONFIG_LOGFS=m +# CONFIG_CRAMFS is not set +CONFIG_SQUASHFS=y +CONFIG_SQUASHFS_FILE_CACHE=y +# CONFIG_SQUASHFS_FILE_DIRECT is not set +# CONFIG_SQUASHFS_DECOMP_SINGLE is not set +CONFIG_SQUASHFS_DECOMP_MULTI=y +# CONFIG_SQUASHFS_DECOMP_MULTI_PERCPU is not set +CONFIG_SQUASHFS_XATTR=y +CONFIG_SQUASHFS_ZLIB=y +CONFIG_SQUASHFS_LZ4=y +CONFIG_SQUASHFS_LZO=y +CONFIG_SQUASHFS_XZ=y +# CONFIG_SQUASHFS_4K_DEVBLK_SIZE is not set +# CONFIG_SQUASHFS_EMBEDDED is not set +CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE=3 +# CONFIG_VXFS_FS is not set +# CONFIG_MINIX_FS is not set +# CONFIG_OMFS_FS is not set +# CONFIG_HPFS_FS is not set +# CONFIG_QNX4FS_FS is not set +# CONFIG_QNX6FS_FS is not set +CONFIG_ROMFS_FS=m +CONFIG_ROMFS_BACKED_BY_BLOCK=y +# CONFIG_ROMFS_BACKED_BY_MTD is not set +# CONFIG_ROMFS_BACKED_BY_BOTH is not set +CONFIG_ROMFS_ON_BLOCK=y +# CONFIG_PSTORE is not set +CONFIG_SYSV_FS=m +# CONFIG_UFS_FS is not set +CONFIG_NETWORK_FILESYSTEMS=y +CONFIG_NFS_FS=y +CONFIG_NFS_V2=y +CONFIG_NFS_V3=y +CONFIG_NFS_V3_ACL=y +CONFIG_NFS_V4=y +# CONFIG_NFS_SWAP is not set +# CONFIG_NFS_V4_1 is not set +CONFIG_ROOT_NFS=y +# CONFIG_NFS_USE_LEGACY_DNS is not set +CONFIG_NFS_USE_KERNEL_DNS=y +CONFIG_NFS_DEBUG=y +CONFIG_NFSD=m +CONFIG_NFSD_V2_ACL=y +CONFIG_NFSD_V3=y +CONFIG_NFSD_V3_ACL=y +CONFIG_NFSD_V4=y +# CONFIG_NFSD_PNFS is not set +CONFIG_GRACE_PERIOD=y +CONFIG_LOCKD=y +CONFIG_LOCKD_V4=y +CONFIG_NFS_ACL_SUPPORT=y +CONFIG_NFS_COMMON=y +CONFIG_SUNRPC=y +CONFIG_SUNRPC_GSS=y +CONFIG_RPCSEC_GSS_KRB5=m +CONFIG_SUNRPC_DEBUG=y +# CONFIG_CEPH_FS is not set +CONFIG_CIFS=m +# CONFIG_CIFS_STATS is not set +CONFIG_CIFS_WEAK_PW_HASH=y +# CONFIG_CIFS_UPCALL is not set +CONFIG_CIFS_XATTR=y +CONFIG_CIFS_POSIX=y +CONFIG_CIFS_ACL=y +# CONFIG_CIFS_DEBUG is not set +CONFIG_CIFS_DFS_UPCALL=y +CONFIG_CIFS_SMB2=y +CONFIG_CIFS_SMB311=y +CONFIG_CIFS_FSCACHE=y +CONFIG_NCP_FS=m +# CONFIG_NCPFS_PACKET_SIGNING is not set +# CONFIG_NCPFS_IOCTL_LOCKING is not set +# CONFIG_NCPFS_STRONG is not set +# CONFIG_NCPFS_NFS_NS is not set +# CONFIG_NCPFS_OS2_NS is not set +# CONFIG_NCPFS_SMALLDOS is not set +# CONFIG_NCPFS_NLS is not set +# CONFIG_NCPFS_EXTRAS is not set +# CONFIG_CODA_FS is not set +# CONFIG_AFS_FS is not set +CONFIG_NLS=y +CONFIG_NLS_DEFAULT="utf8" +CONFIG_NLS_CODEPAGE_437=y +CONFIG_NLS_CODEPAGE_737=m +CONFIG_NLS_CODEPAGE_775=m +CONFIG_NLS_CODEPAGE_850=y +CONFIG_NLS_CODEPAGE_852=y +CONFIG_NLS_CODEPAGE_855=m +CONFIG_NLS_CODEPAGE_857=m +CONFIG_NLS_CODEPAGE_860=m +CONFIG_NLS_CODEPAGE_861=m +CONFIG_NLS_CODEPAGE_862=m +CONFIG_NLS_CODEPAGE_863=m +CONFIG_NLS_CODEPAGE_864=m +CONFIG_NLS_CODEPAGE_865=m +CONFIG_NLS_CODEPAGE_866=m +CONFIG_NLS_CODEPAGE_869=m +CONFIG_NLS_CODEPAGE_936=m +CONFIG_NLS_CODEPAGE_950=m +CONFIG_NLS_CODEPAGE_932=m +CONFIG_NLS_CODEPAGE_949=m +CONFIG_NLS_CODEPAGE_874=m +CONFIG_NLS_ISO8859_8=m +CONFIG_NLS_CODEPAGE_1250=y +CONFIG_NLS_CODEPAGE_1251=y +CONFIG_NLS_ASCII=y +CONFIG_NLS_ISO8859_1=y +CONFIG_NLS_ISO8859_2=y +CONFIG_NLS_ISO8859_3=m +CONFIG_NLS_ISO8859_4=m +CONFIG_NLS_ISO8859_5=m +CONFIG_NLS_ISO8859_6=m +CONFIG_NLS_ISO8859_7=m +CONFIG_NLS_ISO8859_9=m +CONFIG_NLS_ISO8859_13=m +CONFIG_NLS_ISO8859_14=m +CONFIG_NLS_ISO8859_15=y +CONFIG_NLS_KOI8_R=m +CONFIG_NLS_KOI8_U=m +CONFIG_NLS_MAC_ROMAN=m +CONFIG_NLS_MAC_CELTIC=m +CONFIG_NLS_MAC_CENTEURO=m +CONFIG_NLS_MAC_CROATIAN=m +CONFIG_NLS_MAC_CYRILLIC=m +CONFIG_NLS_MAC_GAELIC=m +CONFIG_NLS_MAC_GREEK=m +CONFIG_NLS_MAC_ICELAND=m +CONFIG_NLS_MAC_INUIT=m +CONFIG_NLS_MAC_ROMANIAN=m +CONFIG_NLS_MAC_TURKISH=m +CONFIG_NLS_UTF8=y +CONFIG_DLM=m +# CONFIG_DLM_DEBUG is not set + +# +# Kernel hacking +# + +# +# printk and dmesg options +# +CONFIG_PRINTK_TIME=y +CONFIG_MESSAGE_LOGLEVEL_DEFAULT=4 +CONFIG_DYNAMIC_DEBUG=y + +# +# Compile-time checks and compiler options +# +CONFIG_ENABLE_WARN_DEPRECATED=y +CONFIG_ENABLE_MUST_CHECK=y +CONFIG_FRAME_WARN=1024 +CONFIG_STRIP_ASM_SYMS=y +# CONFIG_UNUSED_SYMBOLS is not set +CONFIG_DEBUG_FS=y +# CONFIG_HEADERS_CHECK is not set +# CONFIG_DEBUG_SECTION_MISMATCH is not set +CONFIG_SECTION_MISMATCH_WARN_ONLY=y +CONFIG_FRAME_POINTER=y +CONFIG_MAGIC_SYSRQ=y +CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE=0x1 +# CONFIG_DEBUG_KERNEL is not set + +# +# Memory Debugging +# +# CONFIG_PAGE_EXTENSION is not set +# CONFIG_SLUB_STATS is not set +CONFIG_HAVE_DEBUG_KMEMLEAK=y +# CONFIG_DEBUG_MEMORY_INIT is not set + +# +# Debug Lockups and Hangs +# +CONFIG_PANIC_ON_OOPS=y +CONFIG_PANIC_ON_OOPS_VALUE=1 +CONFIG_PANIC_TIMEOUT=1 +# CONFIG_SCHED_INFO is not set +# CONFIG_DEBUG_TIMEKEEPING is not set + +# +# Lock Debugging (spinlocks, mutexes, etc...) +# +CONFIG_STACKTRACE=y +CONFIG_DEBUG_BUGVERBOSE=y + +# +# RCU Debugging +# +# CONFIG_PROVE_RCU is not set +# CONFIG_SPARSE_RCU_POINTER is not set +# CONFIG_TORTURE_TEST is not set +CONFIG_RCU_CPU_STALL_TIMEOUT=21 +CONFIG_NOP_TRACER=y +CONFIG_HAVE_FUNCTION_TRACER=y +CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y +CONFIG_HAVE_DYNAMIC_FTRACE=y +CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y +CONFIG_HAVE_SYSCALL_TRACEPOINTS=y +CONFIG_HAVE_C_RECORDMCOUNT=y +CONFIG_TRACE_CLOCK=y +CONFIG_RING_BUFFER=y +CONFIG_EVENT_TRACING=y +CONFIG_CONTEXT_SWITCH_TRACER=y +CONFIG_TRACING=y +CONFIG_GENERIC_TRACER=y +CONFIG_TRACING_SUPPORT=y +CONFIG_FTRACE=y +CONFIG_FUNCTION_TRACER=y +CONFIG_FUNCTION_GRAPH_TRACER=y +# CONFIG_IRQSOFF_TRACER is not set +# CONFIG_PREEMPT_TRACER is not set +# CONFIG_SCHED_TRACER is not set +# CONFIG_MISSED_TIMER_OFFSETS_HIST is not set +# CONFIG_FTRACE_SYSCALLS is not set +# CONFIG_TRACER_SNAPSHOT is not set +CONFIG_BRANCH_PROFILE_NONE=y +# CONFIG_PROFILE_ANNOTATED_BRANCHES is not set +# CONFIG_PROFILE_ALL_BRANCHES is not set +# CONFIG_STACK_TRACER is not set +# CONFIG_BLK_DEV_IO_TRACE is not set +# CONFIG_UPROBE_EVENT is not set +# CONFIG_PROBE_EVENTS is not set +CONFIG_DYNAMIC_FTRACE=y +# CONFIG_FUNCTION_PROFILER is not set +CONFIG_FTRACE_MCOUNT_RECORD=y +# CONFIG_FTRACE_STARTUP_TEST is not set +# CONFIG_TRACEPOINT_BENCHMARK is not set +# CONFIG_RING_BUFFER_BENCHMARK is not set +# CONFIG_RING_BUFFER_STARTUP_TEST is not set +# CONFIG_TRACE_ENUM_MAP_FILE is not set +# CONFIG_TRACING_EVENTS_GPIO is not set + +# +# Runtime Testing +# +# CONFIG_LKDTM is not set +# CONFIG_ATOMIC64_SELFTEST is not set +# CONFIG_ASYNC_RAID6_TEST is not set +# CONFIG_TEST_HEXDUMP is not set +# CONFIG_TEST_STRING_HELPERS is not set +# CONFIG_TEST_KSTRTOX is not set +# CONFIG_TEST_PRINTF is not set +# CONFIG_TEST_RHASHTABLE is not set +# CONFIG_DMA_API_DEBUG is not set +# CONFIG_TEST_LKM is not set +# CONFIG_TEST_USER_COPY is not set +# CONFIG_TEST_BPF is not set +# CONFIG_TEST_FIRMWARE is not set +# CONFIG_TEST_UDELAY is not set +# CONFIG_MEMTEST is not set +# CONFIG_TEST_STATIC_KEYS is not set +# CONFIG_SAMPLES is not set +CONFIG_HAVE_ARCH_KGDB=y +# CONFIG_STRICT_DEVMEM is not set +CONFIG_ARM_UNWIND=y +CONFIG_OLD_MCOUNT=y +# CONFIG_DEBUG_USER is not set +CONFIG_DEBUG_IMX_UART_PORT=1 +CONFIG_DEBUG_LL_INCLUDE="mach/debug-macro.S" +# CONFIG_DEBUG_UART_8250 is not set +CONFIG_UNCOMPRESS_INCLUDE="debug/uncompress.h" +# CONFIG_PID_IN_CONTEXTIDR is not set +# CONFIG_DEBUG_SET_MODULE_RONX is not set +# CONFIG_CORESIGHT is not set + +# +# Security options +# +CONFIG_KEYS=y +# CONFIG_PERSISTENT_KEYRINGS is not set +# CONFIG_BIG_KEYS is not set +CONFIG_ENCRYPTED_KEYS=y +# CONFIG_SECURITY_DMESG_RESTRICT is not set +# CONFIG_SECURITY is not set +# CONFIG_SECURITYFS is not set +CONFIG_DEFAULT_SECURITY_DAC=y +CONFIG_DEFAULT_SECURITY="" +CONFIG_XOR_BLOCKS=y +CONFIG_ASYNC_CORE=m +CONFIG_ASYNC_MEMCPY=m +CONFIG_ASYNC_XOR=m +CONFIG_ASYNC_PQ=m +CONFIG_ASYNC_RAID6_RECOV=m +CONFIG_CRYPTO=y + +# +# Crypto core or helper +# +CONFIG_CRYPTO_ALGAPI=y +CONFIG_CRYPTO_ALGAPI2=y +CONFIG_CRYPTO_AEAD=y +CONFIG_CRYPTO_AEAD2=y +CONFIG_CRYPTO_BLKCIPHER=y +CONFIG_CRYPTO_BLKCIPHER2=y +CONFIG_CRYPTO_HASH=y +CONFIG_CRYPTO_HASH2=y +CONFIG_CRYPTO_RNG=y +CONFIG_CRYPTO_RNG2=y +CONFIG_CRYPTO_RNG_DEFAULT=y +CONFIG_CRYPTO_PCOMP=y +CONFIG_CRYPTO_PCOMP2=y +CONFIG_CRYPTO_AKCIPHER2=y +CONFIG_CRYPTO_AKCIPHER=m +CONFIG_CRYPTO_RSA=m +CONFIG_CRYPTO_CRYPTODEV=y +CONFIG_CRYPTO_MANAGER=y +CONFIG_CRYPTO_MANAGER2=y +CONFIG_CRYPTO_USER=y +CONFIG_CRYPTO_MANAGER_DISABLE_TESTS=y +CONFIG_CRYPTO_GF128MUL=y +CONFIG_CRYPTO_NULL=y +CONFIG_CRYPTO_NULL2=y +CONFIG_CRYPTO_PCRYPT=y +CONFIG_CRYPTO_WORKQUEUE=y +CONFIG_CRYPTO_CRYPTD=y +CONFIG_CRYPTO_MCRYPTD=m +CONFIG_CRYPTO_AUTHENC=y +# CONFIG_CRYPTO_TEST is not set + +# +# Authenticated Encryption with Associated Data +# +CONFIG_CRYPTO_CCM=y +CONFIG_CRYPTO_GCM=y +CONFIG_CRYPTO_CHACHA20POLY1305=m +CONFIG_CRYPTO_SEQIV=y +CONFIG_CRYPTO_ECHAINIV=m + +# +# Block modes +# +CONFIG_CRYPTO_CBC=y +CONFIG_CRYPTO_CTR=y +CONFIG_CRYPTO_CTS=y +CONFIG_CRYPTO_ECB=y +CONFIG_CRYPTO_LRW=y +CONFIG_CRYPTO_PCBC=y +CONFIG_CRYPTO_XTS=y +CONFIG_CRYPTO_KEYWRAP=m + +# +# Hash modes +# +CONFIG_CRYPTO_CMAC=y +CONFIG_CRYPTO_HMAC=y +CONFIG_CRYPTO_XCBC=y +CONFIG_CRYPTO_VMAC=y + +# +# Digest +# +CONFIG_CRYPTO_CRC32C=y +CONFIG_CRYPTO_CRC32=y +CONFIG_CRYPTO_CRCT10DIF=y +CONFIG_CRYPTO_GHASH=y +CONFIG_CRYPTO_POLY1305=m +CONFIG_CRYPTO_MD4=y +CONFIG_CRYPTO_MD5=y +CONFIG_CRYPTO_MICHAEL_MIC=y +CONFIG_CRYPTO_RMD128=m +CONFIG_CRYPTO_RMD160=m +CONFIG_CRYPTO_RMD256=m +CONFIG_CRYPTO_RMD320=m +CONFIG_CRYPTO_SHA1=y +CONFIG_CRYPTO_SHA256=y +CONFIG_CRYPTO_SHA512=y +CONFIG_CRYPTO_TGR192=m +CONFIG_CRYPTO_WP512=m + +# +# Ciphers +# +CONFIG_CRYPTO_AES=y +CONFIG_CRYPTO_ANUBIS=m +CONFIG_CRYPTO_ARC4=y +CONFIG_CRYPTO_BLOWFISH=m +CONFIG_CRYPTO_BLOWFISH_COMMON=m +CONFIG_CRYPTO_CAMELLIA=m +CONFIG_CRYPTO_CAST_COMMON=m +CONFIG_CRYPTO_CAST5=m +CONFIG_CRYPTO_CAST6=m +CONFIG_CRYPTO_DES=y +CONFIG_CRYPTO_FCRYPT=m +CONFIG_CRYPTO_KHAZAD=m +CONFIG_CRYPTO_SALSA20=m +CONFIG_CRYPTO_CHACHA20=m +CONFIG_CRYPTO_SEED=m +CONFIG_CRYPTO_SERPENT=m +CONFIG_CRYPTO_TEA=y +CONFIG_CRYPTO_TWOFISH=y +CONFIG_CRYPTO_TWOFISH_COMMON=y + +# +# Compression +# +CONFIG_CRYPTO_DEFLATE=y +CONFIG_CRYPTO_ZLIB=y +CONFIG_CRYPTO_LZO=y +CONFIG_CRYPTO_842=y +CONFIG_CRYPTO_LZ4=y +CONFIG_CRYPTO_LZ4HC=y + +# +# Random Number Generation +# +CONFIG_CRYPTO_ANSI_CPRNG=y +CONFIG_CRYPTO_DRBG_MENU=y +CONFIG_CRYPTO_DRBG_HMAC=y +# CONFIG_CRYPTO_DRBG_HASH is not set +# CONFIG_CRYPTO_DRBG_CTR is not set +CONFIG_CRYPTO_DRBG=y +CONFIG_CRYPTO_JITTERENTROPY=y +CONFIG_CRYPTO_USER_API=m +CONFIG_CRYPTO_USER_API_HASH=m +CONFIG_CRYPTO_USER_API_SKCIPHER=m +CONFIG_CRYPTO_USER_API_RNG=m +# CONFIG_CRYPTO_USER_API_AEAD is not set +CONFIG_CRYPTO_HASH_INFO=y +CONFIG_CRYPTO_HW=y +# CONFIG_CRYPTO_DEV_HIFN_795X is not set +CONFIG_CRYPTO_DEV_FSL_CAAM=y +CONFIG_CRYPTO_DEV_FSL_CAAM_JR=y +CONFIG_CRYPTO_DEV_FSL_CAAM_RINGSIZE=9 +# CONFIG_CRYPTO_DEV_FSL_CAAM_INTC is not set +CONFIG_CRYPTO_DEV_FSL_CAAM_CRYPTO_API=y +CONFIG_CRYPTO_DEV_FSL_CAAM_AHASH_API=y +CONFIG_CRYPTO_DEV_FSL_CAAM_RNG_API=y +CONFIG_CRYPTO_DEV_FSL_CAAM_IMX=y +CONFIG_CRYPTO_DEV_FSL_CAAM_LE=y +# CONFIG_CRYPTO_DEV_FSL_CAAM_SM is not set +# CONFIG_CRYPTO_DEV_FSL_CAAM_SECVIO is not set +# CONFIG_CRYPTO_DEV_FSL_CAAM_DEBUG is not set +# CONFIG_CRYPTO_DEV_SAHARA is not set +# CONFIG_CRYPTO_DEV_MXS_DCP is not set +CONFIG_ASYMMETRIC_KEY_TYPE=m +CONFIG_ASYMMETRIC_PUBLIC_KEY_SUBTYPE=m +CONFIG_PUBLIC_KEY_ALGO_RSA=m +CONFIG_X509_CERTIFICATE_PARSER=m +CONFIG_PKCS7_MESSAGE_PARSER=m +# CONFIG_PKCS7_TEST_KEY is not set + +# +# Certificates for signature checking +# +# CONFIG_SYSTEM_TRUSTED_KEYRING is not set +# CONFIG_ARM_CRYPTO is not set +CONFIG_BINARY_PRINTF=y + +# +# Library routines +# +CONFIG_RAID6_PQ=y +CONFIG_BITREVERSE=y +CONFIG_HAVE_ARCH_BITREVERSE=y +CONFIG_RATIONAL=y +CONFIG_GENERIC_STRNCPY_FROM_USER=y +CONFIG_GENERIC_STRNLEN_USER=y +CONFIG_GENERIC_NET_UTILS=y +CONFIG_GENERIC_PCI_IOMAP=y +CONFIG_GENERIC_IO=y +CONFIG_STMP_DEVICE=y +CONFIG_ARCH_USE_CMPXCHG_LOCKREF=y +CONFIG_CRC_CCITT=y +CONFIG_CRC16=y +CONFIG_CRC_T10DIF=y +CONFIG_CRC_ITU_T=y +CONFIG_CRC32=y +# CONFIG_CRC32_SELFTEST is not set +CONFIG_CRC32_SLICEBY8=y +# CONFIG_CRC32_SLICEBY4 is not set +# CONFIG_CRC32_SARWATE is not set +# CONFIG_CRC32_BIT is not set +CONFIG_CRC7=y +CONFIG_LIBCRC32C=y +CONFIG_CRC8=m +# CONFIG_AUDIT_ARCH_COMPAT_GENERIC is not set +# CONFIG_RANDOM32_SELFTEST is not set +CONFIG_842_COMPRESS=y +CONFIG_842_DECOMPRESS=y +CONFIG_ZLIB_INFLATE=y +CONFIG_ZLIB_DEFLATE=y +CONFIG_LZO_COMPRESS=y +CONFIG_LZO_DECOMPRESS=y +CONFIG_LZ4_COMPRESS=y +CONFIG_LZ4HC_COMPRESS=y +CONFIG_LZ4_DECOMPRESS=y +CONFIG_XZ_DEC=y +# CONFIG_XZ_DEC_X86 is not set +# CONFIG_XZ_DEC_POWERPC is not set +# CONFIG_XZ_DEC_IA64 is not set +CONFIG_XZ_DEC_ARM=y +CONFIG_XZ_DEC_ARMTHUMB=y +# CONFIG_XZ_DEC_SPARC is not set +CONFIG_XZ_DEC_BCJ=y +# CONFIG_XZ_DEC_TEST is not set +CONFIG_DECOMPRESS_GZIP=y +CONFIG_DECOMPRESS_LZO=y +CONFIG_GENERIC_ALLOCATOR=y +CONFIG_TEXTSEARCH=y +CONFIG_TEXTSEARCH_KMP=m +CONFIG_TEXTSEARCH_BM=m +CONFIG_TEXTSEARCH_FSM=m +CONFIG_BTREE=y +CONFIG_ASSOCIATIVE_ARRAY=y +CONFIG_HAS_IOMEM=y +CONFIG_HAS_IOPORT_MAP=y +CONFIG_HAS_DMA=y +CONFIG_CPU_RMAP=y +CONFIG_DQL=y +CONFIG_GLOB=y +# CONFIG_GLOB_SELFTEST is not set +CONFIG_NLATTR=y +CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE=y +CONFIG_CLZ_TAB=y +CONFIG_CORDIC=y +# CONFIG_DDR is not set +CONFIG_MPILIB=m +CONFIG_LIBFDT=y +CONFIG_OID_REGISTRY=y +CONFIG_FONT_SUPPORT=y +# CONFIG_FONTS is not set +CONFIG_FONT_8x8=y +CONFIG_FONT_8x16=y +# CONFIG_SG_SPLIT is not set +CONFIG_ARCH_HAS_SG_CHAIN=y +# CONFIG_VIRTUALIZATION is not set diff --git a/projects/imx6/options b/projects/imx6/options index c6716d9617a..179e170d455 100644 --- a/projects/imx6/options +++ b/projects/imx6/options @@ -43,7 +43,6 @@ # Configuration for u-boot UBOOT_CONFIG="mx6_cubox-i_config" UBOOT_CONFIG="$UBOOT_CONFIG matrix" - UBOOT_CONFIG="$UBOOT_CONFIG udoo_config" # Target Configfile for u-boot UBOOT_CONFIGFILE="" @@ -54,15 +53,22 @@ # Kernel extra targets to build KERNEL_UBOOT_EXTRA_TARGET="imx6q-cubox-i.dtb imx6dl-cubox-i.dtb" KERNEL_UBOOT_EXTRA_TARGET="$KERNEL_UBOOT_EXTRA_TARGET imx6q-hummingboard.dtb imx6dl-hummingboard.dtb" + KERNEL_UBOOT_EXTRA_TARGET="$KERNEL_UBOOT_EXTRA_TARGET imx6q-hummingboard2.dtb imx6dl-hummingboard2.dtb" KERNEL_UBOOT_EXTRA_TARGET="$KERNEL_UBOOT_EXTRA_TARGET imx6q-tbs2910.dtb" KERNEL_UBOOT_EXTRA_TARGET="$KERNEL_UBOOT_EXTRA_TARGET imx6q-udoo.dtb imx6dl-udoo.dtb" + KERNEL_UBOOT_EXTRA_TARGET="$KERNEL_UBOOT_EXTRA_TARGET imx6q-udoo-15lvds.dtb imx6q-udoo-7lvds.dtb" + KERNEL_UBOOT_EXTRA_TARGET="$KERNEL_UBOOT_EXTRA_TARGET imx6dl-udoo-15lvds.dtb imx6dl-udoo-7lvds.dtb" # Additional kernel make parameters (for example to specify the u-boot loadaddress) KERNEL_MAKE_EXTRACMD="" - # Kernel to use. values can be: - # default: default mainline kernel - LINUX="imx6" + # Kernel to use. + # default is 4.4 from xbian + if [ -z "$LINUX_VERSION" -o "$LINUX_VERSION" != "sr-3.14" ]; then + LINUX="imx6-4.4-xbian" + else + LINUX="imx6" + fi ################################################################################ @@ -95,8 +101,12 @@ # OpenGL(X) implementation to use (no / mesa) OPENGL="no" - # OpenGL-ES implementation to use (no / bcm2835-driver / gpu-viv-bin-mx6q) - OPENGLES="gpu-viv-bin-mx6q" + # OpenGL-ES implementation to use (no / bcm2835-driver / imx-gpu-viv) + if [ "$LINUX" = "imx6" ]; then + OPENGLES="imx-gpu-viv" + else + OPENGLES="gpu-viv-bin-mx6q" + fi # include uvesafb support (yes / no) UVESAFB_SUPPORT="no" @@ -119,10 +129,14 @@ INITRAMFS_MODULES="" # additional drivers to install: - # for a list of additinoal drivers see packages/linux-drivers + # for a list of additional drivers see packages/linux-drivers # Space separated list is supported, # e.g. ADDITIONAL_DRIVERS="DRIVER1 DRIVER2" - ADDITIONAL_DRIVERS="RTL8192CU RTL8192DU RTL8188EU RTL8812AU dvbhdhomerun" + if [ "$LINUX" = "imx6" ]; then + ADDITIONAL_DRIVERS="RTL8192CU RTL8192DU RTL8188EU dvbhdhomerun" + else + ADDITIONAL_DRIVERS="$ADDITIONAL_DRIVERS" + fi # additional Firmware to use (dvb-firmware, misc-firmware, wlan-firmware) # Space separated list is supported, diff --git a/packages/devel/libcec/patches/libcec-00-imx6-support.patch b/projects/imx6/patches/libcec/libcec-00-imx6-support.patch similarity index 93% rename from packages/devel/libcec/patches/libcec-00-imx6-support.patch rename to projects/imx6/patches/libcec/libcec-00-imx6-support.patch index 2c24635c460..101e535e791 100644 --- a/packages/devel/libcec/patches/libcec-00-imx6-support.patch +++ b/projects/imx6/patches/libcec/libcec-00-imx6-support.patch @@ -1,3 +1,8 @@ +From 3bd000096d6c0d9fb84cb5476b4dcae7e12f17df Mon Sep 17 00:00:00 2001 +From: Peter Vicman <peter.vicman@gmail.com> +Date: Sun, 24 Apr 2016 14:26:55 +0200 +Subject: [PATCH] imx support (rebased again) + From a7f3315333c1a79259a763c6542a6cd71855b357 Mon Sep 17 00:00:00 2001 From: Stefan Saraev <stefan@saraev.ca> Date: Thu, 7 May 2015 11:35:04 +0300 @@ -24,7 +29,7 @@ note. I am NOT the author of the patch. just rebased it create mode 100644 src/libcec/adapter/IMX/IMXCECAdapterDetection.h diff --git a/include/cectypes.h b/include/cectypes.h -index acff259..0cfee8c 100644 +index 0fdd48e..e28c8df 100644 --- a/include/cectypes.h +++ b/include/cectypes.h @@ -309,6 +309,17 @@ namespace CEC { @@ -45,7 +50,7 @@ index acff259..0cfee8c 100644 * Mimimum client version */ #define CEC_MIN_LIB_VERSION 3 -@@ -876,7 +887,8 @@ typedef enum cec_adapter_type +@@ -877,7 +888,8 @@ typedef enum cec_adapter_type ADAPTERTYPE_P8_DAUGHTERBOARD = 0x2, ADAPTERTYPE_RPI = 0x100, ADAPTERTYPE_TDA995x = 0x200, @@ -56,10 +61,10 @@ index acff259..0cfee8c 100644 /** force exporting through swig */ diff --git a/src/libcec/CECTypeUtils.h b/src/libcec/CECTypeUtils.h -index fd8046a..48cb215 100644 +index 0d0cf17..f6c818a 100644 --- a/src/libcec/CECTypeUtils.h +++ b/src/libcec/CECTypeUtils.h -@@ -765,6 +765,8 @@ namespace CEC +@@ -766,6 +766,8 @@ namespace CEC return "Raspberry Pi"; case ADAPTERTYPE_TDA995x: return "TDA995x"; @@ -128,7 +133,7 @@ index da05725..92e378b 100644 } diff --git a/src/libcec/adapter/IMX/AdapterMessageQueue.h b/src/libcec/adapter/IMX/AdapterMessageQueue.h new file mode 100644 -index 0000000..af6742c +index 0000000..7749874 --- /dev/null +++ b/src/libcec/adapter/IMX/AdapterMessageQueue.h @@ -0,0 +1,134 @@ @@ -165,11 +170,11 @@ index 0000000..af6742c + * http://www.pulse-eight.net/ + */ + -+#include "platform/threads/mutex.h" ++#include "p8-platform/threads/mutex.h" + +namespace CEC +{ -+ using namespace PLATFORM; ++ using namespace P8PLATFORM; + + class CAdapterMessageQueueEntry + { @@ -258,8 +263,8 @@ index 0000000..af6742c + + private: + bool m_bWaiting; /**< true while a thread is waiting or when it hasn't started waiting yet */ -+ PLATFORM::CCondition<bool> m_condition; /**< the condition to wait on */ -+ PLATFORM::CMutex m_mutex; /**< mutex for changes to this class */ ++ P8PLATFORM::CCondition<bool> m_condition; /**< the condition to wait on */ ++ P8PLATFORM::CMutex m_mutex; /**< mutex for changes to this class */ + uint32_t m_hash; + uint32_t m_retval; + bool m_bSucceeded; @@ -268,7 +273,7 @@ index 0000000..af6742c +}; diff --git a/src/libcec/adapter/IMX/IMXCECAdapterCommunication.cpp b/src/libcec/adapter/IMX/IMXCECAdapterCommunication.cpp new file mode 100644 -index 0000000..2daa8cb +index 0000000..ba88137 --- /dev/null +++ b/src/libcec/adapter/IMX/IMXCECAdapterCommunication.cpp @@ -0,0 +1,328 @@ @@ -306,9 +311,9 @@ index 0000000..2daa8cb + +#include "CECTypeUtils.h" +#include "LibCEC.h" -+#include "platform/sockets/cdevsocket.h" -+#include "platform/util/StdString.h" -+#include "platform/util/buffer.h" ++#include "p8-platform/sockets/cdevsocket.h" ++#include "p8-platform/util/StdString.h" ++#include "p8-platform/util/buffer.h" + +/* + * Ioctl definitions from kernel header @@ -336,7 +341,7 @@ index 0000000..2daa8cb + +using namespace std; +using namespace CEC; -+using namespace PLATFORM; ++using namespace P8PLATFORM; + +#include "AdapterMessageQueue.h" + @@ -602,7 +607,7 @@ index 0000000..2daa8cb +#endif // HAVE_IMX_API diff --git a/src/libcec/adapter/IMX/IMXCECAdapterCommunication.h b/src/libcec/adapter/IMX/IMXCECAdapterCommunication.h new file mode 100644 -index 0000000..9e899a3 +index 0000000..cebe5b6 --- /dev/null +++ b/src/libcec/adapter/IMX/IMXCECAdapterCommunication.h @@ -0,0 +1,119 @@ @@ -636,9 +641,9 @@ index 0000000..9e899a3 + +#if defined(HAVE_IMX_API) + -+#include "platform/threads/mutex.h" -+#include "platform/threads/threads.h" -+#include "platform/sockets/socket.h" ++#include "p8-platform/threads/mutex.h" ++#include "p8-platform/threads/threads.h" ++#include "p8-platform/sockets/socket.h" +#include "adapter/AdapterCommunication.h" +#include <map> + @@ -647,7 +652,7 @@ index 0000000..9e899a3 + + + -+namespace PLATFORM ++namespace P8PLATFORM +{ + class CCDevSocket; +}; @@ -657,7 +662,7 @@ index 0000000..9e899a3 +{ + class CAdapterMessageQueueEntry; + -+ class CIMXCECAdapterCommunication : public IAdapterCommunication, public PLATFORM::CThread ++ class CIMXCECAdapterCommunication : public IAdapterCommunication, public P8PLATFORM::CThread + { + public: + /*! @@ -698,7 +703,7 @@ index 0000000..9e899a3 + bool RegisterLogicalAddress(const cec_logical_address address); + ///} + -+ /** @name PLATFORM::CThread implementation */ ++ /** @name P8PLATFORM::CThread implementation */ + ///{ + void *Process(void); + ///} @@ -712,12 +717,12 @@ index 0000000..9e899a3 + //cec_logical_addresses m_logicalAddresses; + cec_logical_address m_logicalAddress; + -+ PLATFORM::CMutex m_mutex; -+ PLATFORM::CCDevSocket *m_dev; /**< the device connection */ ++ P8PLATFORM::CMutex m_mutex; ++ P8PLATFORM::CCDevSocket *m_dev; /**< the device connection */ + bool m_bLogicalAddressRegistered; + bool m_bInitialised; + -+ PLATFORM::CMutex m_messageMutex; ++ P8PLATFORM::CMutex m_messageMutex; + uint32_t m_iNextMessage; + std::map<uint32_t, CAdapterMessageQueueEntry *> m_messages; + }; @@ -816,18 +821,18 @@ index 0000000..d54891d + }; +} diff --git a/src/libcec/cmake/CheckPlatformSupport.cmake b/src/libcec/cmake/CheckPlatformSupport.cmake -index 828cdb2..8b47795 100644 +index b8a16c8..dc5bc25 100644 --- a/src/libcec/cmake/CheckPlatformSupport.cmake +++ b/src/libcec/cmake/CheckPlatformSupport.cmake -@@ -8,6 +8,7 @@ - # HAVE_RANDR 1 if xrandr is supported - # HAVE_LIBUDEV 1 if udev is supported - # HAVE_RPI_API 1 if Raspberry Pi is supported -+# HAVE_IMX_API 1 if i.MX is supported - # HAVE_TDA995X_API 1 if TDA995X is supported - # HAVE_EXYNOS_API 1 if Exynos is supported - # HAVE_P8_USB_DETECT 1 if Pulse-Eight devices can be auto-detected -@@ -87,6 +88,15 @@ else() +@@ -7,6 +7,7 @@ + # HAVE_RANDR 1 if xrandr is supported + # HAVE_LIBUDEV 1 if udev is supported + # HAVE_RPI_API 1 if Raspberry Pi is supported ++# HAVE_IMX_API 1 if i.MX is supported + # HAVE_TDA995X_API 1 if TDA995X is supported + # HAVE_EXYNOS_API 1 if Exynos is supported + # HAVE_P8_USB 1 if Pulse-Eight devices are supported +@@ -110,6 +111,15 @@ else() list(APPEND CEC_SOURCES ${CEC_SOURCES_ADAPTER_RPI}) endif() @@ -844,10 +849,10 @@ index 828cdb2..8b47795 100644 check_include_files("tda998x_ioctl.h;comps/tmdlHdmiCEC/inc/tmdlHdmiCEC_Types.h" HAVE_TDA995X_API) if (HAVE_TDA995X_API) diff --git a/src/libcec/cmake/DisplayPlatformSupport.cmake b/src/libcec/cmake/DisplayPlatformSupport.cmake -index feee111..0309c56 100644 +index 9dcaacf..4e24def 100644 --- a/src/libcec/cmake/DisplayPlatformSupport.cmake +++ b/src/libcec/cmake/DisplayPlatformSupport.cmake -@@ -32,6 +32,12 @@ else() +@@ -26,6 +26,12 @@ else() message(STATUS "Raspberry Pi support: no") endif() @@ -861,10 +866,10 @@ index feee111..0309c56 100644 message(STATUS "TDA995x support: yes") else() diff --git a/src/libcec/env.h.in b/src/libcec/env.h.in -index a1a1f26..f90e729 100644 +index 0496aa0..384f1c7 100644 --- a/src/libcec/env.h.in +++ b/src/libcec/env.h.in -@@ -60,6 +60,9 @@ +@@ -66,6 +66,9 @@ /* Define to 1 for Raspberry Pi support */ #cmakedefine HAVE_RPI_API @HAVE_RPI_API@ @@ -875,5 +880,5 @@ index a1a1f26..f90e729 100644 #cmakedefine HAVE_TDA995X_API @HAVE_TDA995X_API@ -- -2.1.4 +2.7.1 diff --git a/projects/imx6/patches/linux/999.01-LLVMLinux_use_static_inline_in_ARM_ftrace.h.patch b/projects/imx6/patches/linux/3.14-mx6-sr/999.01-LLVMLinux_use_static_inline_in_ARM_ftrace.h.patch similarity index 100% rename from projects/imx6/patches/linux/999.01-LLVMLinux_use_static_inline_in_ARM_ftrace.h.patch rename to projects/imx6/patches/linux/3.14-mx6-sr/999.01-LLVMLinux_use_static_inline_in_ARM_ftrace.h.patch diff --git a/projects/imx6/patches/linux/999.02-ARM-LLVMLinux-Change-extern-inline-to-static-inline.patch b/projects/imx6/patches/linux/3.14-mx6-sr/999.02-ARM-LLVMLinux-Change-extern-inline-to-static-inline.patch similarity index 100% rename from projects/imx6/patches/linux/999.02-ARM-LLVMLinux-Change-extern-inline-to-static-inline.patch rename to projects/imx6/patches/linux/3.14-mx6-sr/999.02-ARM-LLVMLinux-Change-extern-inline-to-static-inline.patch diff --git a/projects/imx6/patches/linux/linux-002-rename-sgtl5000-codec.patch b/projects/imx6/patches/linux/3.14-mx6-sr/linux-002-rename-sgtl5000-codec.patch similarity index 100% rename from projects/imx6/patches/linux/linux-002-rename-sgtl5000-codec.patch rename to projects/imx6/patches/linux/3.14-mx6-sr/linux-002-rename-sgtl5000-codec.patch diff --git a/projects/imx6/patches/linux/3.14-mx6-sr/linux-003-no_dev_console.patch b/projects/imx6/patches/linux/3.14-mx6-sr/linux-003-no_dev_console.patch new file mode 100644 index 00000000000..df35a7ab9aa --- /dev/null +++ b/projects/imx6/patches/linux/3.14-mx6-sr/linux-003-no_dev_console.patch @@ -0,0 +1,21 @@ +diff --git a/init/main.c b/init/main.c +index 9484f4b..db55edd 100644 +--- a/init/main.c ++++ b/init/main.c +@@ -880,8 +880,14 @@ static noinline void __init kernel_init_freeable(void) + do_basic_setup(); + + /* Open the /dev/console on the rootfs, this should never fail */ +- if (sys_open((const char __user *) "/dev/console", O_RDWR, 0) < 0) +- pr_err("Warning: unable to open an initial console.\n"); ++ char *console = "/dev_console"; ++ ++ if (sys_open((const char __user *) "/dev/console", O_RDWR, 0) < 0) { ++ sys_mknod(console, S_IFCHR|0600, (TTYAUX_MAJOR<<8)|1); ++ if (sys_open(console, O_RDWR, 0) < 0) ++ printk(KERN_WARNING "Warning: unable to open an initial console.\n"); ++ sys_unlink(console); ++ } + + (void) sys_dup(0); + (void) sys_dup(0); diff --git a/projects/imx6/patches/linux/linux-004-fix-build-with-gcc-5.patch b/projects/imx6/patches/linux/3.14-mx6-sr/linux-004-fix-build-with-gcc-5.patch similarity index 100% rename from projects/imx6/patches/linux/linux-004-fix-build-with-gcc-5.patch rename to projects/imx6/patches/linux/3.14-mx6-sr/linux-004-fix-build-with-gcc-5.patch diff --git a/projects/imx6/patches/linux/linux-007-config_cmdline.patch b/projects/imx6/patches/linux/3.14-mx6-sr/linux-007-config_cmdline.patch similarity index 100% rename from projects/imx6/patches/linux/linux-007-config_cmdline.patch rename to projects/imx6/patches/linux/3.14-mx6-sr/linux-007-config_cmdline.patch diff --git a/projects/imx6/patches/linux/linux-010_tivo_slide_pro.patch b/projects/imx6/patches/linux/3.14-mx6-sr/linux-010_tivo_slide_pro.patch similarity index 100% rename from projects/imx6/patches/linux/linux-010_tivo_slide_pro.patch rename to projects/imx6/patches/linux/3.14-mx6-sr/linux-010_tivo_slide_pro.patch diff --git a/projects/imx6/patches/linux/linux-051-ouya_controller_support.patch b/projects/imx6/patches/linux/3.14-mx6-sr/linux-051-ouya_controller_support.patch similarity index 100% rename from projects/imx6/patches/linux/linux-051-ouya_controller_support.patch rename to projects/imx6/patches/linux/3.14-mx6-sr/linux-051-ouya_controller_support.patch diff --git a/packages/linux/patches/4.4.5/linux-052-XBOX_remote_support.patch b/projects/imx6/patches/linux/3.14-mx6-sr/linux-052-XBOX_remote_support.patch similarity index 100% rename from packages/linux/patches/4.4.5/linux-052-XBOX_remote_support.patch rename to projects/imx6/patches/linux/3.14-mx6-sr/linux-052-XBOX_remote_support.patch diff --git a/projects/imx6/patches/linux/linux-053-spinelplus-remote-0.2.patch b/projects/imx6/patches/linux/3.14-mx6-sr/linux-053-spinelplus-remote-0.2.patch similarity index 100% rename from projects/imx6/patches/linux/linux-053-spinelplus-remote-0.2.patch rename to projects/imx6/patches/linux/3.14-mx6-sr/linux-053-spinelplus-remote-0.2.patch diff --git a/projects/imx6/patches/linux/linux-055-add_Formosa_eHome_Infrared_Receiver.patch b/projects/imx6/patches/linux/3.14-mx6-sr/linux-055-add_Formosa_eHome_Infrared_Receiver.patch similarity index 100% rename from projects/imx6/patches/linux/linux-055-add_Formosa_eHome_Infrared_Receiver.patch rename to projects/imx6/patches/linux/3.14-mx6-sr/linux-055-add_Formosa_eHome_Infrared_Receiver.patch diff --git a/projects/imx6/patches/linux/linux-056-add_Adaptec_eHome_Infrared_Receiver.patch b/projects/imx6/patches/linux/3.14-mx6-sr/linux-056-add_Adaptec_eHome_Infrared_Receiver.patch similarity index 100% rename from projects/imx6/patches/linux/linux-056-add_Adaptec_eHome_Infrared_Receiver.patch rename to projects/imx6/patches/linux/3.14-mx6-sr/linux-056-add_Adaptec_eHome_Infrared_Receiver.patch diff --git a/projects/imx6/patches/linux/linux-057-Removed-MCE-customer-code-restriction-in-rc6-decode.patch b/projects/imx6/patches/linux/3.14-mx6-sr/linux-057-Removed-MCE-customer-code-restriction-in-rc6-decode.patch similarity index 100% rename from projects/imx6/patches/linux/linux-057-Removed-MCE-customer-code-restriction-in-rc6-decode.patch rename to projects/imx6/patches/linux/3.14-mx6-sr/linux-057-Removed-MCE-customer-code-restriction-in-rc6-decode.patch diff --git a/projects/imx6/patches/linux/linux-057-add_SMK_Manufacturing_Inc_Infrared_Receiver.patch b/projects/imx6/patches/linux/3.14-mx6-sr/linux-057-add_SMK_Manufacturing_Inc_Infrared_Receiver.patch similarity index 100% rename from projects/imx6/patches/linux/linux-057-add_SMK_Manufacturing_Inc_Infrared_Receiver.patch rename to projects/imx6/patches/linux/3.14-mx6-sr/linux-057-add_SMK_Manufacturing_Inc_Infrared_Receiver.patch diff --git a/projects/imx6/patches/linux/linux-058.05-hid_sony-add_autorepeat_for_PS3_remotes.patch b/projects/imx6/patches/linux/3.14-mx6-sr/linux-058.05-hid_sony-add_autorepeat_for_PS3_remotes.patch similarity index 100% rename from projects/imx6/patches/linux/linux-058.05-hid_sony-add_autorepeat_for_PS3_remotes.patch rename to projects/imx6/patches/linux/3.14-mx6-sr/linux-058.05-hid_sony-add_autorepeat_for_PS3_remotes.patch diff --git a/projects/imx6/patches/linux/linux-058.06-hid_sony-add_SMK_link.patch b/projects/imx6/patches/linux/3.14-mx6-sr/linux-058.06-hid_sony-add_SMK_link.patch similarity index 100% rename from projects/imx6/patches/linux/linux-058.06-hid_sony-add_SMK_link.patch rename to projects/imx6/patches/linux/3.14-mx6-sr/linux-058.06-hid_sony-add_SMK_link.patch diff --git a/projects/imx6/patches/linux/linux-059-remove_some_xpad_pids-0.2.patch b/projects/imx6/patches/linux/3.14-mx6-sr/linux-059-remove_some_xpad_pids-0.2.patch similarity index 100% rename from projects/imx6/patches/linux/linux-059-remove_some_xpad_pids-0.2.patch rename to projects/imx6/patches/linux/3.14-mx6-sr/linux-059-remove_some_xpad_pids-0.2.patch diff --git a/projects/imx6/patches/linux/linux-060-add_AUGUST_DVB-T205.patch b/projects/imx6/patches/linux/3.14-mx6-sr/linux-060-add_AUGUST_DVB-T205.patch similarity index 100% rename from projects/imx6/patches/linux/linux-060-add_AUGUST_DVB-T205.patch rename to projects/imx6/patches/linux/3.14-mx6-sr/linux-060-add_AUGUST_DVB-T205.patch diff --git a/projects/imx6/patches/linux/linux-061-valve-xpad-rework.patch b/projects/imx6/patches/linux/3.14-mx6-sr/linux-061-valve-xpad-rework.patch similarity index 100% rename from projects/imx6/patches/linux/linux-061-valve-xpad-rework.patch rename to projects/imx6/patches/linux/3.14-mx6-sr/linux-061-valve-xpad-rework.patch diff --git a/projects/imx6/patches/linux/linux-062-imon_pad_ignore_diagonal.patch b/projects/imx6/patches/linux/3.14-mx6-sr/linux-062-imon_pad_ignore_diagonal.patch similarity index 100% rename from projects/imx6/patches/linux/linux-062-imon_pad_ignore_diagonal.patch rename to projects/imx6/patches/linux/3.14-mx6-sr/linux-062-imon_pad_ignore_diagonal.patch diff --git a/projects/imx6/patches/linux/linux-203-stb0899_enable_low_symbol_rate.patch b/projects/imx6/patches/linux/3.14-mx6-sr/linux-203-stb0899_enable_low_symbol_rate.patch similarity index 100% rename from projects/imx6/patches/linux/linux-203-stb0899_enable_low_symbol_rate.patch rename to projects/imx6/patches/linux/3.14-mx6-sr/linux-203-stb0899_enable_low_symbol_rate.patch diff --git a/projects/imx6/patches/linux/linux-210-dvbsky.patch b/projects/imx6/patches/linux/3.14-mx6-sr/linux-210-dvbsky.patch similarity index 100% rename from projects/imx6/patches/linux/linux-210-dvbsky.patch rename to projects/imx6/patches/linux/3.14-mx6-sr/linux-210-dvbsky.patch diff --git a/projects/imx6/patches/linux/linux-212-mantis_stb0899_faster_lock.patch b/projects/imx6/patches/linux/3.14-mx6-sr/linux-212-mantis_stb0899_faster_lock.patch similarity index 100% rename from projects/imx6/patches/linux/linux-212-mantis_stb0899_faster_lock.patch rename to projects/imx6/patches/linux/3.14-mx6-sr/linux-212-mantis_stb0899_faster_lock.patch diff --git a/projects/imx6/patches/linux/linux-222-stb0899_signal_quality.patch b/projects/imx6/patches/linux/3.14-mx6-sr/linux-222-stb0899_signal_quality.patch similarity index 100% rename from projects/imx6/patches/linux/linux-222-stb0899_signal_quality.patch rename to projects/imx6/patches/linux/3.14-mx6-sr/linux-222-stb0899_signal_quality.patch diff --git a/projects/imx6/patches/linux/linux-223-Fix-video-artifacts-with-tt-3600-s2-usb.patch b/projects/imx6/patches/linux/3.14-mx6-sr/linux-223-Fix-video-artifacts-with-tt-3600-s2-usb.patch similarity index 100% rename from projects/imx6/patches/linux/linux-223-Fix-video-artifacts-with-tt-3600-s2-usb.patch rename to projects/imx6/patches/linux/3.14-mx6-sr/linux-223-Fix-video-artifacts-with-tt-3600-s2-usb.patch diff --git a/projects/imx6/patches/linux/linux-224-geniatech-t220-dvb-t2-fix.patch b/projects/imx6/patches/linux/3.14-mx6-sr/linux-224-geniatech-t220-dvb-t2-fix.patch similarity index 100% rename from projects/imx6/patches/linux/linux-224-geniatech-t220-dvb-t2-fix.patch rename to projects/imx6/patches/linux/3.14-mx6-sr/linux-224-geniatech-t220-dvb-t2-fix.patch diff --git a/projects/imx6/patches/linux/linux-225-ct2-devices.patch b/projects/imx6/patches/linux/3.14-mx6-sr/linux-225-ct2-devices.patch similarity index 100% rename from projects/imx6/patches/linux/linux-225-ct2-devices.patch rename to projects/imx6/patches/linux/3.14-mx6-sr/linux-225-ct2-devices.patch diff --git a/projects/imx6/patches/linux/linux-226-pctv292e-devices.patch b/projects/imx6/patches/linux/3.14-mx6-sr/linux-226-pctv292e-devices.patch similarity index 100% rename from projects/imx6/patches/linux/linux-226-pctv292e-devices.patch rename to projects/imx6/patches/linux/3.14-mx6-sr/linux-226-pctv292e-devices.patch diff --git a/projects/imx6/patches/linux/linux-250-fix-dvbsky.patch b/projects/imx6/patches/linux/3.14-mx6-sr/linux-250-fix-dvbsky.patch similarity index 100% rename from projects/imx6/patches/linux/linux-250-fix-dvbsky.patch rename to projects/imx6/patches/linux/3.14-mx6-sr/linux-250-fix-dvbsky.patch diff --git a/projects/imx6/patches/linux/3.14-mx6-sr/linux-310-udoo-lvds-support.patch b/projects/imx6/patches/linux/3.14-mx6-sr/linux-310-udoo-lvds-support.patch new file mode 100644 index 00000000000..76105e569f6 --- /dev/null +++ b/projects/imx6/patches/linux/3.14-mx6-sr/linux-310-udoo-lvds-support.patch @@ -0,0 +1,295 @@ +From 21ecd35bd9e5030a6b33a41dea3a2653609b09d7 Mon Sep 17 00:00:00 2001 +From: Peter Vicman <peter.vicman@gmail.com> +Date: Thu, 24 Mar 2016 15:53:56 +0100 +Subject: [PATCH] dts: udoo: add both lvds displays + +--- + arch/arm/boot/dts/Makefile | 4 +++ + arch/arm/boot/dts/imx6dl-udoo-15lvds.dts | 54 +++++++++++++++++++++++++++++ + arch/arm/boot/dts/imx6dl-udoo-7lvds.dts | 49 +++++++++++++++++++++++++++ + arch/arm/boot/dts/imx6q-udoo-15lvds.dts | 58 ++++++++++++++++++++++++++++++++ + arch/arm/boot/dts/imx6q-udoo-7lvds.dts | 53 +++++++++++++++++++++++++++++ + arch/arm/boot/dts/imx6qdl-udoo.dtsi | 5 +-- + 6 files changed, 221 insertions(+), 2 deletions(-) + create mode 100644 arch/arm/boot/dts/imx6dl-udoo-15lvds.dts + create mode 100644 arch/arm/boot/dts/imx6dl-udoo-7lvds.dts + create mode 100644 arch/arm/boot/dts/imx6q-udoo-15lvds.dts + create mode 100644 arch/arm/boot/dts/imx6q-udoo-7lvds.dts + +diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile +index 08ff98a..ffffb8c 100644 +--- a/arch/arm/boot/dts/Makefile ++++ b/arch/arm/boot/dts/Makefile +@@ -167,6 +167,8 @@ dtb-$(CONFIG_ARCH_MXC) += \ + imx6dl-sabresd-pf200.dtb \ + imx6dl-sabresd-hdcp.dtb \ + imx6dl-udoo.dtb \ ++ imx6dl-udoo-7lvds.dtb \ ++ imx6dl-udoo-15lvds.dtb \ + imx6dl-sbc-fx6.dtb \ + imx6dl-sbc-fx6m.dtb \ + imx6dl-wandboard.dtb \ +@@ -192,6 +194,8 @@ dtb-$(CONFIG_ARCH_MXC) += \ + imx6q-sbc-fx6m.dtb \ + imx6q-sbc6x.dtb \ + imx6q-udoo.dtb \ ++ imx6q-udoo-7lvds.dtb \ ++ imx6q-udoo-15lvds.dtb \ + imx6q-wandboard.dtb \ + imx6q-tbs2910.dtb \ + imx6sl-evk.dtb \ +diff --git a/arch/arm/boot/dts/imx6dl-udoo-15lvds.dts b/arch/arm/boot/dts/imx6dl-udoo-15lvds.dts +new file mode 100644 +index 0000000..ac189cc +--- /dev/null ++++ b/arch/arm/boot/dts/imx6dl-udoo-15lvds.dts +@@ -0,0 +1,54 @@ ++/* ++ * Copyright 2013 Freescale Semiconductor, Inc. ++ * ++ * Author: Fabio Estevam <fabio.estevam@freescale.com> ++ * Author: Ettore Chimenti <ettore.chimenti@udoo.org> ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 as ++ * published by the Free Software Foundation. ++ * ++ */ ++ ++/dts-v1/; ++#include "imx6dl.dtsi" ++#include "imx6qdl-udoo.dtsi" ++ ++/ { ++ model = "Udoo i.MX6 Dual-lite Board"; ++ compatible = "udoo,imx6dl-udoo", "fsl,imx6dl"; ++ ++ mxcfb2: fb@1 { ++ compatible = "fsl,mxc_sdc_fb"; ++ disp_dev = "ldb"; ++ interface_pix_fmt = "RGB24"; ++ mode_str = "1360x768M@60"; ++ default_bpp = <32>; ++ int_clk = <0>; ++ late_init = <1>; ++ status = "okay"; ++ }; ++ ++ regulators { ++ reg_lcd0_pwr: regulator@1 { ++ status = "okay"; ++ }; ++ ++ reg_lcd0_backlight: regulator@2 { ++ status = "okay"; ++ }; ++ }; ++}; ++ ++&ldb { ++ status = "okay"; ++ ++ lvds-channel@0 { ++ status = "okay"; ++ fsl,data-width = <24>; ++ ++ display-timings { ++ native-mode = <&timing2>; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/imx6dl-udoo-7lvds.dts b/arch/arm/boot/dts/imx6dl-udoo-7lvds.dts +new file mode 100644 +index 0000000..da6ba4d +--- /dev/null ++++ b/arch/arm/boot/dts/imx6dl-udoo-7lvds.dts +@@ -0,0 +1,49 @@ ++/* ++ * Copyright 2013 Freescale Semiconductor, Inc. ++ * ++ * Author: Fabio Estevam <fabio.estevam@freescale.com> ++ * Author: Ettore Chimenti <ettore.chimenti@udoo.org> ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 as ++ * published by the Free Software Foundation. ++ * ++ */ ++ ++/dts-v1/; ++#include "imx6dl.dtsi" ++#include "imx6qdl-udoo.dtsi" ++ ++/ { ++ model = "Udoo i.MX6 Dual-lite Board"; ++ compatible = "udoo,imx6dl-udoo", "fsl,imx6dl"; ++ ++ mxcfb2: fb@1 { ++ compatible = "fsl,mxc_sdc_fb"; ++ disp_dev = "ldb"; ++ interface_pix_fmt = "RGB666"; ++ mode_str = "800x480M@60"; ++ default_bpp = <32>; ++ int_clk = <0>; ++ late_init = <0>; ++ status = "okay"; ++ }; ++ ++ regulators { ++ reg_lcd0_pwr: regulator@1 { ++ status = "okay"; ++ }; ++ ++ reg_lcd0_backlight: regulator@2 { ++ status = "okay"; ++ }; ++ }; ++}; ++ ++&ldb { ++ status = "okay"; ++ ++ lvds-channel@0 { ++ status = "okay"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/imx6q-udoo-15lvds.dts b/arch/arm/boot/dts/imx6q-udoo-15lvds.dts +new file mode 100644 +index 0000000..35e7651 +--- /dev/null ++++ b/arch/arm/boot/dts/imx6q-udoo-15lvds.dts +@@ -0,0 +1,58 @@ ++/* ++ * Copyright 2013 Freescale Semiconductor, Inc. ++ * ++ * Author: Fabio Estevam <fabio.estevam@freescale.com> ++ * Author: Ettore Chimenti <ettore.chimenti@udoo.org> ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 as ++ * published by the Free Software Foundation. ++ * ++ */ ++ ++/dts-v1/; ++#include "imx6q.dtsi" ++#include "imx6qdl-udoo.dtsi" ++ ++/ { ++ model = "Udoo i.MX6 Quad Board"; ++ compatible = "udoo,imx6q-udoo", "fsl,imx6q"; ++ ++ mxcfb2: fb@1 { ++ compatible = "fsl,mxc_sdc_fb"; ++ disp_dev = "ldb"; ++ interface_pix_fmt = "RGB24"; ++ mode_str = "1360x768M@60"; ++ default_bpp = <32>; ++ int_clk = <0>; ++ late_init = <1>; ++ status = "okay"; ++ }; ++ ++ regulators { ++ reg_lcd0_pwr: regulator@1 { ++ status = "okay"; ++ }; ++ ++ reg_lcd0_backlight: regulator@2 { ++ status = "okay"; ++ }; ++ }; ++}; ++ ++&sata { ++ status = "okay"; ++}; ++ ++&ldb { ++ status = "okay"; ++ ++ lvds-channel@0 { ++ status = "okay"; ++ fsl,data-width = <24>; ++ ++ display-timings { ++ native-mode = <&timing2>; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/imx6q-udoo-7lvds.dts b/arch/arm/boot/dts/imx6q-udoo-7lvds.dts +new file mode 100644 +index 0000000..e5f3125 +--- /dev/null ++++ b/arch/arm/boot/dts/imx6q-udoo-7lvds.dts +@@ -0,0 +1,53 @@ ++/* ++ * Copyright 2013 Freescale Semiconductor, Inc. ++ * ++ * Author: Fabio Estevam <fabio.estevam@freescale.com> ++ * Author: Ettore Chimenti <ettore.chimenti@udoo.org> ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 as ++ * published by the Free Software Foundation. ++ * ++ */ ++ ++/dts-v1/; ++#include "imx6q.dtsi" ++#include "imx6qdl-udoo.dtsi" ++ ++/ { ++ model = "Udoo i.MX6 Quad Board"; ++ compatible = "udoo,imx6q-udoo", "fsl,imx6q"; ++ ++ mxcfb2: fb@1 { ++ compatible = "fsl,mxc_sdc_fb"; ++ disp_dev = "ldb"; ++ interface_pix_fmt = "RGB666"; ++ mode_str = "800x480M@60"; ++ default_bpp = <32>; ++ int_clk = <0>; ++ late_init = <0>; ++ status = "okay"; ++ }; ++ ++ regulators { ++ reg_lcd0_pwr: regulator@1 { ++ status = "okay"; ++ }; ++ ++ reg_lcd0_backlight: regulator@2 { ++ status = "okay"; ++ }; ++ }; ++}; ++ ++&sata { ++ status = "okay"; ++}; ++ ++&ldb { ++ status = "okay"; ++ ++ lvds-channel@0 { ++ status = "okay"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/imx6qdl-udoo.dtsi b/arch/arm/boot/dts/imx6qdl-udoo.dtsi +index 2f6ec9a..7dca6db 100755 +--- a/arch/arm/boot/dts/imx6qdl-udoo.dtsi ++++ b/arch/arm/boot/dts/imx6qdl-udoo.dtsi +@@ -254,9 +254,10 @@ + vsync-len = <2>; + }; + +- timing2: 1366x768 { // 15.6" display ++ // IPU needs X and Y by modulo 8 ++ timing2: 1360x768 { // 15.6" display + clock-frequency = <76000000>; +- hactive = <1366>; ++ hactive = <1360>; + vactive = <768>; + hback-porch = <220>; + hfront-porch = <40>; diff --git a/projects/imx6/patches/linux/linux-320-cuboxi_led_heartbeat.patch b/projects/imx6/patches/linux/3.14-mx6-sr/linux-320-cuboxi_led_heartbeat.patch similarity index 100% rename from projects/imx6/patches/linux/linux-320-cuboxi_led_heartbeat.patch rename to projects/imx6/patches/linux/3.14-mx6-sr/linux-320-cuboxi_led_heartbeat.patch diff --git a/projects/imx6/patches/linux/linux-704-Support-for-Ubiquiti-WifiStation.patch b/projects/imx6/patches/linux/3.14-mx6-sr/linux-704-Support-for-Ubiquiti-WifiStation.patch similarity index 100% rename from projects/imx6/patches/linux/linux-704-Support-for-Ubiquiti-WifiStation.patch rename to projects/imx6/patches/linux/3.14-mx6-sr/linux-704-Support-for-Ubiquiti-WifiStation.patch diff --git a/projects/imx6/patches/linux/linux-705-Support-for-Buffalo-WLI-UC-G300HP-V1.patch b/projects/imx6/patches/linux/3.14-mx6-sr/linux-705-Support-for-Buffalo-WLI-UC-G300HP-V1.patch similarity index 100% rename from projects/imx6/patches/linux/linux-705-Support-for-Buffalo-WLI-UC-G300HP-V1.patch rename to projects/imx6/patches/linux/3.14-mx6-sr/linux-705-Support-for-Buffalo-WLI-UC-G300HP-V1.patch diff --git a/packages/linux/patches/4.4.5/linux-706-Sitecom-N300.patch b/projects/imx6/patches/linux/3.14-mx6-sr/linux-706-Sitecom-N300.patch similarity index 100% rename from packages/linux/patches/4.4.5/linux-706-Sitecom-N300.patch rename to projects/imx6/patches/linux/3.14-mx6-sr/linux-706-Sitecom-N300.patch diff --git a/projects/imx6/patches/linux/linux-910.01-cec-upstream.patch b/projects/imx6/patches/linux/3.14-mx6-sr/linux-910.01-cec-upstream.patch similarity index 100% rename from projects/imx6/patches/linux/linux-910.01-cec-upstream.patch rename to projects/imx6/patches/linux/3.14-mx6-sr/linux-910.01-cec-upstream.patch diff --git a/projects/imx6/patches/linux/linux-910.02-cec-upstream.patch b/projects/imx6/patches/linux/3.14-mx6-sr/linux-910.02-cec-upstream.patch similarity index 100% rename from projects/imx6/patches/linux/linux-910.02-cec-upstream.patch rename to projects/imx6/patches/linux/3.14-mx6-sr/linux-910.02-cec-upstream.patch diff --git a/projects/imx6/patches/linux/linux-991.01-ptrace_fix.patch b/projects/imx6/patches/linux/3.14-mx6-sr/linux-991.01-ptrace_fix.patch similarity index 100% rename from projects/imx6/patches/linux/linux-991.01-ptrace_fix.patch rename to projects/imx6/patches/linux/3.14-mx6-sr/linux-991.01-ptrace_fix.patch diff --git a/projects/imx6/patches/linux/linux-995-CX24120-13Z_frontend.patch b/projects/imx6/patches/linux/3.14-mx6-sr/linux-995-CX24120-13Z_frontend.patch similarity index 100% rename from projects/imx6/patches/linux/linux-995-CX24120-13Z_frontend.patch rename to projects/imx6/patches/linux/3.14-mx6-sr/linux-995-CX24120-13Z_frontend.patch diff --git a/projects/imx6/patches/linux/linux-999-9-fritz-stick-1.patch b/projects/imx6/patches/linux/3.14-mx6-sr/linux-999-9-fritz-stick-1.patch similarity index 100% rename from projects/imx6/patches/linux/linux-999-9-fritz-stick-1.patch rename to projects/imx6/patches/linux/3.14-mx6-sr/linux-999-9-fritz-stick-1.patch diff --git a/projects/imx6/patches/linux/linux-999-9-fritz-stick-2.patch b/projects/imx6/patches/linux/3.14-mx6-sr/linux-999-9-fritz-stick-2.patch similarity index 100% rename from projects/imx6/patches/linux/linux-999-9-fritz-stick-2.patch rename to projects/imx6/patches/linux/3.14-mx6-sr/linux-999-9-fritz-stick-2.patch diff --git a/projects/imx6/patches/linux/linux-999.02-0001-pm-disable-async-suspend-resume-by-default.patch b/projects/imx6/patches/linux/3.14-mx6-sr/linux-999.02-0001-pm-disable-async-suspend-resume-by-default.patch similarity index 100% rename from projects/imx6/patches/linux/linux-999.02-0001-pm-disable-async-suspend-resume-by-default.patch rename to projects/imx6/patches/linux/3.14-mx6-sr/linux-999.02-0001-pm-disable-async-suspend-resume-by-default.patch diff --git a/projects/imx6/patches/linux/linux-999.03-0001-fix-mceusb.patch b/projects/imx6/patches/linux/3.14-mx6-sr/linux-999.03-0001-fix-mceusb.patch similarity index 100% rename from projects/imx6/patches/linux/linux-999.03-0001-fix-mceusb.patch rename to projects/imx6/patches/linux/3.14-mx6-sr/linux-999.03-0001-fix-mceusb.patch diff --git a/projects/imx6/patches/linux/4.4-xbian/linux-000-commits-d08b62d-ade5a7b.patch b/projects/imx6/patches/linux/4.4-xbian/linux-000-commits-d08b62d-ade5a7b.patch new file mode 100644 index 00000000000..2305cc7d560 --- /dev/null +++ b/projects/imx6/patches/linux/4.4-xbian/linux-000-commits-d08b62d-ade5a7b.patch @@ -0,0 +1,16315 @@ +From eb69269a27cf75c34e22728a5499ce4ca9e3bc4e Mon Sep 17 00:00:00 2001 +From: Fugang Duan <b38611@freescale.com> +Date: Fri, 10 Oct 2014 16:25:26 +0800 +Subject: [PATCH 01/13] ENGR00299323-10 net:fec: add enet AVB Ubuntu Gstreamer + demo support + +Support Gstreamer AVB demo support. + +ring1 -> ClassA, ring2 -> ClassB, ring0 -> Best Effort + +For QoS: ring1 > ring2 > ring0 +For bandwidth reverse: + 50% bandwidth -> ClassA + 33% bandwidth -> ClassB + 17% bandwidth -> Best effort queue + +In general, ClassA run audio, ClassB run video. +Since AVB demo use big bandwidth streaming, video cost more than +33Mbps bandwidth, and with Qos limitation: ClassA >= ClassB > Best effort, +so we have to change ring2 bandwidth equal to ring1 bandwidth (50%). +After validate on FPGA, AVB demo can work fine for audio and video. + +Signed-off-by: Fugang Duan <B38611@freescale.com> +(cherry picked from commit 93d6579a7b3d2dafa721c835df5d5f7d30ed386e) +(cherry picked from commit 2f78438d70c847f0570ece98cd7933041e36f6bd) +Signed-off-by: Matus Kral <matuskral@me.com> +--- + drivers/net/ethernet/freescale/fec_main.c | 35 ++++++++++++++++++++++++++++++- + 1 file changed, 34 insertions(+), 1 deletion(-) + +diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c +index 969922a..d9f1ab3 100644 +--- a/drivers/net/ethernet/freescale/fec_main.c ++++ b/drivers/net/ethernet/freescale/fec_main.c +@@ -18,7 +18,7 @@ + * Bug fixes and cleanup by Philippe De Muyter (phdm@macqel.be) + * Copyright (c) 2004-2006 Macq Electronique SA. + * +- * Copyright (C) 2010-2011 Freescale Semiconductor, Inc. ++ * Copyright (C) 2010-2014 Freescale Semiconductor, Inc. + */ + + #include <linux/module.h> +@@ -70,6 +70,7 @@ static void fec_enet_itr_coal_init(struct net_device *ndev); + #define DRIVER_NAME "fec" + + #define FEC_ENET_GET_QUQUE(_x) ((_x == 0) ? 1 : ((_x == 1) ? 2 : 0)) ++static const u16 fec_enet_vlan_pri_to_queue[8] = {1, 1, 1, 1, 2, 2, 2, 2}; + + /* Pause frame feild and FIFO threshold */ + #define FEC_ENET_FCE (1 << 5) +@@ -3171,10 +3172,42 @@ static int fec_set_features(struct net_device *netdev, + return 0; + } + ++u16 fec_enet_get_raw_vlan_tci(struct sk_buff *skb) ++{ ++ struct vlan_ethhdr *vhdr; ++ unsigned short vlan_TCI = 0; ++ ++ if (skb->protocol == ntohs(ETH_P_ALL)) { ++ vhdr = (struct vlan_ethhdr *)(skb->data); ++ vlan_TCI = ntohs(vhdr->h_vlan_TCI); ++ } ++ ++ return vlan_TCI; ++} ++ ++u16 fec_enet_select_queue(struct net_device *ndev, struct sk_buff *skb, ++ void *accel_priv, select_queue_fallback_t fallback) ++{ ++ struct fec_enet_private *fep = netdev_priv(ndev); ++ const struct platform_device_id *id_entry = ++ platform_get_device_id(fep->pdev); ++ u16 vlan_tag; ++ ++ if (!(id_entry->driver_data & FEC_QUIRK_HAS_AVB)) ++ return skb_tx_hash(ndev, skb); ++ ++ vlan_tag = fec_enet_get_raw_vlan_tci(skb); ++ if (!vlan_tag) ++ return vlan_tag; ++ ++ return fec_enet_vlan_pri_to_queue[vlan_tag >> 13]; ++} ++ + static const struct net_device_ops fec_netdev_ops = { + .ndo_open = fec_enet_open, + .ndo_stop = fec_enet_close, + .ndo_start_xmit = fec_enet_start_xmit, ++ .ndo_select_queue = fec_enet_select_queue, + .ndo_set_rx_mode = set_multicast_list, + .ndo_change_mtu = eth_change_mtu, + .ndo_validate_addr = eth_validate_addr, + +From 4455ed29cc7a523a293bbe766a75aab04a7f9372 Mon Sep 17 00:00:00 2001 +From: Matus Kral <matuskral@me.com> +Date: Sun, 3 Apr 2016 09:09:27 +0200 +Subject: [PATCH 02/13] apply Real-Time patch -rt13 + +--- + Documentation/kernel-parameters.txt | 9 + + Makefile | 3 + + arch/Kconfig | 1 + + arch/arm/kvm/arm.c | 12 +- + arch/arm/kvm/psci.c | 4 +- + arch/arm/mach-at91/Kconfig | 1 + + arch/arm/mach-at91/at91rm9200.c | 2 - + arch/arm/mach-at91/at91sam9.c | 2 - + arch/arm/mach-at91/generic.h | 13 +- + arch/arm/mach-at91/pm.c | 70 +++++- + arch/arm/mach-at91/sama5.c | 2 +- + arch/arm64/kernel/debug-monitors.c | 21 +- + arch/mips/kvm/mips.c | 8 +- + arch/powerpc/include/asm/kvm_host.h | 4 +- + arch/powerpc/kvm/book3s_hv.c | 22 +- + arch/s390/include/asm/kvm_host.h | 2 +- + arch/s390/kvm/interrupt.c | 4 +- + arch/x86/kernel/kvm.c | 37 +-- + arch/x86/kvm/lapic.c | 6 +- + block/blk-core.c | 4 +- + block/blk-mq.c | 4 +- + drivers/block/zram/zram_drv.c | 30 +-- + drivers/block/zram/zram_drv.h | 41 +++ + drivers/clk/at91/clk-generated.c | 95 ++++--- + drivers/clk/at91/clk-h32mx.c | 40 +-- + drivers/clk/at91/clk-main.c | 324 +++++++++++------------- + drivers/clk/at91/clk-master.c | 94 +++---- + drivers/clk/at91/clk-peripheral.c | 136 +++++----- + drivers/clk/at91/clk-pll.c | 150 +++++------ + drivers/clk/at91/clk-plldiv.c | 44 ++-- + drivers/clk/at91/clk-programmable.c | 96 +++---- + drivers/clk/at91/clk-slow.c | 34 +-- + drivers/clk/at91/clk-smd.c | 56 +++-- + drivers/clk/at91/clk-system.c | 96 +++---- + drivers/clk/at91/clk-usb.c | 123 ++++----- + drivers/clk/at91/clk-utmi.c | 80 ++---- + drivers/clk/at91/pmc.c | 426 +------------------------------- + drivers/clk/at91/pmc.h | 98 +------- + drivers/clocksource/tcb_clksrc.c | 33 ++- + drivers/clocksource/timer-atmel-pit.c | 8 +- + drivers/gpu/drm/i915/i915_irq.c | 2 + + drivers/gpu/drm/i915/intel_sprite.c | 11 +- + drivers/gpu/drm/radeon/radeon_display.c | 2 + + drivers/iommu/amd_iommu.c | 12 +- + drivers/tty/serial/sc16is7xx.c | 2 +- + drivers/usb/gadget/function/f_fs.c | 2 +- + drivers/usb/gadget/udc/atmel_usba_udc.c | 20 +- + drivers/usb/gadget/udc/atmel_usba_udc.h | 2 + + fs/btrfs/volumes.c | 1 - + fs/f2fs/f2fs.h | 4 +- + include/linux/blkdev.h | 2 +- + include/linux/clk/at91_pmc.h | 12 - + include/linux/completion.h | 8 +- + include/linux/ftrace.h | 12 + + include/linux/hrtimer.h | 2 +- + include/linux/kvm_host.h | 5 +- + include/linux/list_bl.h | 12 +- + include/linux/locallock.h | 6 +- + include/linux/sched.h | 2 - + include/linux/spinlock_rt.h | 25 +- + include/linux/suspend.h | 6 + + include/linux/swait.h | 173 +++++++++++++ + include/linux/wait-simple.h | 207 ---------------- + include/trace/events/hist.h | 1 + + include/trace/events/writeback.h | 121 ++++----- + kernel/cpu.c | 4 +- + kernel/events/core.c | 1 + + kernel/futex.c | 18 +- + kernel/irq/irqdesc.c | 21 +- + kernel/irq/manage.c | 2 +- + kernel/locking/lglock.c | 6 +- + kernel/locking/rt.c | 2 - + kernel/locking/rtmutex.c | 244 +++++++++++------- + kernel/power/hibernate.c | 7 + + kernel/power/suspend.c | 5 + + kernel/printk/printk.c | 116 ++++----- + kernel/rcu/rcutorture.c | 7 + + kernel/rcu/tree.c | 24 +- + kernel/rcu/tree.h | 15 +- + kernel/rcu/tree_plugin.h | 26 +- + kernel/sched/Makefile | 2 +- + kernel/sched/completion.c | 10 +- + kernel/sched/core.c | 21 +- + kernel/sched/swait.c | 143 +++++++++++ + kernel/sched/wait-simple.c | 115 --------- + kernel/sched/work-simple.c | 8 +- + kernel/softirq.c | 8 +- + kernel/stop_machine.c | 40 +-- + kernel/time/tick-broadcast-hrtimer.c | 1 + + kernel/trace/trace_irqsoff.c | 8 +- + lib/dump_stack.c | 4 +- + localversion-rt | 2 +- + mm/backing-dev.c | 4 +- + mm/zsmalloc.c | 4 +- + net/core/dev.c | 6 +- + virt/kvm/async_pf.c | 4 +- + virt/kvm/kvm_main.c | 17 +- + 97 files changed, 1679 insertions(+), 2103 deletions(-) + create mode 100644 include/linux/swait.h + delete mode 100644 include/linux/wait-simple.h + create mode 100644 kernel/sched/swait.c + delete mode 100644 kernel/sched/wait-simple.c + +diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt +index 742f69d..bcaf28e 100644 +--- a/Documentation/kernel-parameters.txt ++++ b/Documentation/kernel-parameters.txt +@@ -1629,6 +1629,15 @@ bytes respectively. Such letter suffixes can also be entirely omitted. + ip= [IP_PNP] + See Documentation/filesystems/nfs/nfsroot.txt. + ++ irqaffinity= [SMP] Set the default irq affinity mask ++ Format: ++ <cpu number>,...,<cpu number> ++ or ++ <cpu number>-<cpu number> ++ (must be a positive range in ascending order) ++ or a mixture ++ <cpu number>,...,<cpu number>-<cpu number> ++ + irqfixup [HW] + When an interrupt is not handled search all handlers + for it. Intended to get systems with badly broken +diff --git a/Makefile b/Makefile +index 87d12b4..d95c4a4 100644 +--- a/Makefile ++++ b/Makefile +@@ -767,6 +767,9 @@ KBUILD_CFLAGS += $(call cc-option,-Werror=strict-prototypes) + # Prohibit date/time macros, which would make the build non-deterministic + KBUILD_CFLAGS += $(call cc-option,-Werror=date-time) + ++# enforce correct pointer usage ++#KBUILD_CFLAGS += $(call cc-option,-Werror=incompatible-pointer-types) ++ + # use the deterministic mode of AR if available + KBUILD_ARFLAGS := $(call ar-option,D) + +diff --git a/arch/Kconfig b/arch/Kconfig +index 81592b3..3b26d76 100644 +--- a/arch/Kconfig ++++ b/arch/Kconfig +@@ -53,6 +53,7 @@ config KPROBES + config JUMP_LABEL + bool "Optimize very unlikely/likely branches" + depends on HAVE_ARCH_JUMP_LABEL ++ depends on (!INTERRUPT_OFF_HIST && !PREEMPT_OFF_HIST && !WAKEUP_LATENCY_HIST && !MISSED_TIMER_OFFSETS_HIST) + help + This option enables a transparent branch optimization that + makes certain almost-always-true or almost-always-false branch +diff --git a/arch/arm/kvm/arm.c b/arch/arm/kvm/arm.c +index 4f5c42a..bb43bc3 100644 +--- a/arch/arm/kvm/arm.c ++++ b/arch/arm/kvm/arm.c +@@ -498,16 +498,16 @@ static void kvm_arm_resume_guest(struct kvm *kvm) + struct kvm_vcpu *vcpu; + + kvm_for_each_vcpu(i, vcpu, kvm) { +- struct swait_head *wq = kvm_arch_vcpu_wq(vcpu); ++ struct swait_queue_head *wq = kvm_arch_vcpu_wq(vcpu); + + vcpu->arch.pause = false; +- swait_wake_interruptible(wq); ++ swake_up(wq); + } + } + + static void vcpu_sleep(struct kvm_vcpu *vcpu) + { +- struct swait_head *wq = kvm_arch_vcpu_wq(vcpu); ++ struct swait_queue_head *wq = kvm_arch_vcpu_wq(vcpu); + + swait_event_interruptible(*wq, ((!vcpu->arch.power_off) && + (!vcpu->arch.pause))); +@@ -568,7 +568,7 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run) + * involves poking the GIC, which must be done in a + * non-preemptible context. + */ +- preempt_disable(); ++ migrate_disable(); + kvm_timer_flush_hwstate(vcpu); + kvm_vgic_flush_hwstate(vcpu); + +@@ -587,7 +587,7 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run) + local_irq_enable(); + kvm_timer_sync_hwstate(vcpu); + kvm_vgic_sync_hwstate(vcpu); +- preempt_enable(); ++ migrate_enable(); + continue; + } + +@@ -641,7 +641,7 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run) + + kvm_vgic_sync_hwstate(vcpu); + +- preempt_enable(); ++ migrate_enable(); + + ret = handle_exit(vcpu, run, ret); + } +diff --git a/arch/arm/kvm/psci.c b/arch/arm/kvm/psci.c +index 08148c4..c2b1315 100644 +--- a/arch/arm/kvm/psci.c ++++ b/arch/arm/kvm/psci.c +@@ -70,7 +70,7 @@ static unsigned long kvm_psci_vcpu_on(struct kvm_vcpu *source_vcpu) + { + struct kvm *kvm = source_vcpu->kvm; + struct kvm_vcpu *vcpu = NULL; +- struct swait_head *wq; ++ struct swait_queue_head *wq; + unsigned long cpu_id; + unsigned long context_id; + phys_addr_t target_pc; +@@ -119,7 +119,7 @@ static unsigned long kvm_psci_vcpu_on(struct kvm_vcpu *source_vcpu) + smp_mb(); /* Make sure the above is visible */ + + wq = kvm_arch_vcpu_wq(vcpu); +- swait_wake_interruptible(wq); ++ swake_up(wq); + + return PSCI_RET_SUCCESS; + } +diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig +index 28656c2..3f50130 100644 +--- a/arch/arm/mach-at91/Kconfig ++++ b/arch/arm/mach-at91/Kconfig +@@ -99,6 +99,7 @@ config HAVE_AT91_USB_CLK + config COMMON_CLK_AT91 + bool + select COMMON_CLK ++ select MFD_SYSCON + + config HAVE_AT91_SMD + bool +diff --git a/arch/arm/mach-at91/at91rm9200.c b/arch/arm/mach-at91/at91rm9200.c +index c1a7c6c..63b4fa2 100644 +--- a/arch/arm/mach-at91/at91rm9200.c ++++ b/arch/arm/mach-at91/at91rm9200.c +@@ -12,7 +12,6 @@ + #include <linux/of_platform.h> + + #include <asm/mach/arch.h> +-#include <asm/system_misc.h> + + #include "generic.h" + #include "soc.h" +@@ -33,7 +32,6 @@ static void __init at91rm9200_dt_device_init(void) + + of_platform_populate(NULL, of_default_bus_match_table, NULL, soc_dev); + +- arm_pm_idle = at91rm9200_idle; + at91rm9200_pm_init(); + } + +diff --git a/arch/arm/mach-at91/at91sam9.c b/arch/arm/mach-at91/at91sam9.c +index 7eb64f7..cada2a6 100644 +--- a/arch/arm/mach-at91/at91sam9.c ++++ b/arch/arm/mach-at91/at91sam9.c +@@ -62,8 +62,6 @@ static void __init at91sam9_common_init(void) + soc_dev = soc_device_to_device(soc); + + of_platform_populate(NULL, of_default_bus_match_table, NULL, soc_dev); +- +- arm_pm_idle = at91sam9_idle; + } + + static void __init at91sam9_dt_device_init(void) +diff --git a/arch/arm/mach-at91/generic.h b/arch/arm/mach-at91/generic.h +index b0fa7dc..28ca57a 100644 +--- a/arch/arm/mach-at91/generic.h ++++ b/arch/arm/mach-at91/generic.h +@@ -11,27 +11,18 @@ + #ifndef _AT91_GENERIC_H + #define _AT91_GENERIC_H + +-#include <linux/of.h> +-#include <linux/reboot.h> +- +- /* Map io */ +-extern void __init at91_map_io(void); +-extern void __init at91_alt_map_io(void); +- +-/* idle */ +-extern void at91rm9200_idle(void); +-extern void at91sam9_idle(void); +- + #ifdef CONFIG_PM + extern void __init at91rm9200_pm_init(void); + extern void __init at91sam9260_pm_init(void); + extern void __init at91sam9g45_pm_init(void); + extern void __init at91sam9x5_pm_init(void); ++extern void __init sama5_pm_init(void); + #else + static inline void __init at91rm9200_pm_init(void) { } + static inline void __init at91sam9260_pm_init(void) { } + static inline void __init at91sam9g45_pm_init(void) { } + static inline void __init at91sam9x5_pm_init(void) { } ++static inline void __init sama5_pm_init(void) { } + #endif + + #endif /* _AT91_GENERIC_H */ +diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c +index 23726fb3..f062701 100644 +--- a/arch/arm/mach-at91/pm.c ++++ b/arch/arm/mach-at91/pm.c +@@ -31,10 +31,13 @@ + #include <asm/mach/irq.h> + #include <asm/fncpy.h> + #include <asm/cacheflush.h> ++#include <asm/system_misc.h> + + #include "generic.h" + #include "pm.h" + ++static void __iomem *pmc; ++ + /* + * FIXME: this is needed to communicate between the pinctrl driver and + * the PM implementation in the machine. Possibly part of the PM +@@ -87,7 +90,7 @@ static int at91_pm_verify_clocks(void) + unsigned long scsr; + int i; + +- scsr = at91_pmc_read(AT91_PMC_SCSR); ++ scsr = readl(pmc + AT91_PMC_SCSR); + + /* USB must not be using PLLB */ + if ((scsr & at91_pm_data.uhp_udp_mask) != 0) { +@@ -101,8 +104,7 @@ static int at91_pm_verify_clocks(void) + + if ((scsr & (AT91_PMC_PCK0 << i)) == 0) + continue; +- +- css = at91_pmc_read(AT91_PMC_PCKR(i)) & AT91_PMC_CSS; ++ css = readl(pmc + AT91_PMC_PCKR(i)) & AT91_PMC_CSS; + if (css != AT91_PMC_CSS_SLOW) { + pr_err("AT91: PM - Suspend-to-RAM with PCK%d src %d\n", i, css); + return 0; +@@ -145,8 +147,8 @@ static void at91_pm_suspend(suspend_state_t state) + flush_cache_all(); + outer_disable(); + +- at91_suspend_sram_fn(at91_pmc_base, at91_ramc_base[0], +- at91_ramc_base[1], pm_data); ++ at91_suspend_sram_fn(pmc, at91_ramc_base[0], ++ at91_ramc_base[1], pm_data); + + outer_resume(); + } +@@ -353,6 +355,21 @@ static __init void at91_dt_ramc(void) + at91_pm_set_standby(standby); + } + ++void at91rm9200_idle(void) ++{ ++ /* ++ * Disable the processor clock. The processor will be automatically ++ * re-enabled by an interrupt or by a reset. ++ */ ++ writel(AT91_PMC_PCK, pmc + AT91_PMC_SCDR); ++} ++ ++void at91sam9_idle(void) ++{ ++ writel(AT91_PMC_PCK, pmc + AT91_PMC_SCDR); ++ cpu_do_idle(); ++} ++ + static void __init at91_pm_sram_init(void) + { + struct gen_pool *sram_pool; +@@ -399,13 +416,36 @@ static void __init at91_pm_sram_init(void) + &at91_pm_suspend_in_sram, at91_pm_suspend_in_sram_sz); + } + +-static void __init at91_pm_init(void) ++static const struct of_device_id atmel_pmc_ids[] __initconst = { ++ { .compatible = "atmel,at91rm9200-pmc" }, ++ { .compatible = "atmel,at91sam9260-pmc" }, ++ { .compatible = "atmel,at91sam9g45-pmc" }, ++ { .compatible = "atmel,at91sam9n12-pmc" }, ++ { .compatible = "atmel,at91sam9x5-pmc" }, ++ { .compatible = "atmel,sama5d3-pmc" }, ++ { .compatible = "atmel,sama5d2-pmc" }, ++ { /* sentinel */ }, ++}; ++ ++static void __init at91_pm_init(void (*pm_idle)(void)) + { +- at91_pm_sram_init(); ++ struct device_node *pmc_np; + + if (at91_cpuidle_device.dev.platform_data) + platform_device_register(&at91_cpuidle_device); + ++ pmc_np = of_find_matching_node(NULL, atmel_pmc_ids); ++ pmc = of_iomap(pmc_np, 0); ++ if (!pmc) { ++ pr_err("AT91: PM not supported, PMC not found\n"); ++ return; ++ } ++ ++ if (pm_idle) ++ arm_pm_idle = pm_idle; ++ ++ at91_pm_sram_init(); ++ + if (at91_suspend_sram_fn) + suspend_set_ops(&at91_pm_ops); + else +@@ -424,7 +464,7 @@ void __init at91rm9200_pm_init(void) + at91_pm_data.uhp_udp_mask = AT91RM9200_PMC_UHP | AT91RM9200_PMC_UDP; + at91_pm_data.memctrl = AT91_MEMCTRL_MC; + +- at91_pm_init(); ++ at91_pm_init(at91rm9200_idle); + } + + void __init at91sam9260_pm_init(void) +@@ -432,7 +472,7 @@ void __init at91sam9260_pm_init(void) + at91_dt_ramc(); + at91_pm_data.memctrl = AT91_MEMCTRL_SDRAMC; + at91_pm_data.uhp_udp_mask = AT91SAM926x_PMC_UHP | AT91SAM926x_PMC_UDP; +- return at91_pm_init(); ++ at91_pm_init(at91sam9_idle); + } + + void __init at91sam9g45_pm_init(void) +@@ -440,7 +480,7 @@ void __init at91sam9g45_pm_init(void) + at91_dt_ramc(); + at91_pm_data.uhp_udp_mask = AT91SAM926x_PMC_UHP; + at91_pm_data.memctrl = AT91_MEMCTRL_DDRSDR; +- return at91_pm_init(); ++ at91_pm_init(at91sam9_idle); + } + + void __init at91sam9x5_pm_init(void) +@@ -448,5 +488,13 @@ void __init at91sam9x5_pm_init(void) + at91_dt_ramc(); + at91_pm_data.uhp_udp_mask = AT91SAM926x_PMC_UHP | AT91SAM926x_PMC_UDP; + at91_pm_data.memctrl = AT91_MEMCTRL_DDRSDR; +- return at91_pm_init(); ++ at91_pm_init(at91sam9_idle); ++} ++ ++void __init sama5_pm_init(void) ++{ ++ at91_dt_ramc(); ++ at91_pm_data.uhp_udp_mask = AT91SAM926x_PMC_UHP | AT91SAM926x_PMC_UDP; ++ at91_pm_data.memctrl = AT91_MEMCTRL_DDRSDR; ++ at91_pm_init(NULL); + } +diff --git a/arch/arm/mach-at91/sama5.c b/arch/arm/mach-at91/sama5.c +index d9cf679..df8fdf1 100644 +--- a/arch/arm/mach-at91/sama5.c ++++ b/arch/arm/mach-at91/sama5.c +@@ -51,7 +51,7 @@ static void __init sama5_dt_device_init(void) + soc_dev = soc_device_to_device(soc); + + of_platform_populate(NULL, of_default_bus_match_table, NULL, soc_dev); +- at91sam9x5_pm_init(); ++ sama5_pm_init(); + } + + static const char *const sama5_dt_board_compat[] __initconst = { +diff --git a/arch/arm64/kernel/debug-monitors.c b/arch/arm64/kernel/debug-monitors.c +index 8aee3ae..c1492ba 100644 +--- a/arch/arm64/kernel/debug-monitors.c ++++ b/arch/arm64/kernel/debug-monitors.c +@@ -186,20 +186,21 @@ static void clear_regs_spsr_ss(struct pt_regs *regs) + + /* EL1 Single Step Handler hooks */ + static LIST_HEAD(step_hook); +-static DEFINE_RWLOCK(step_hook_lock); ++static DEFINE_SPINLOCK(step_hook_lock); + + void register_step_hook(struct step_hook *hook) + { +- write_lock(&step_hook_lock); +- list_add(&hook->node, &step_hook); +- write_unlock(&step_hook_lock); ++ spin_lock(&step_hook_lock); ++ list_add_rcu(&hook->node, &step_hook); ++ spin_unlock(&step_hook_lock); + } + + void unregister_step_hook(struct step_hook *hook) + { +- write_lock(&step_hook_lock); +- list_del(&hook->node); +- write_unlock(&step_hook_lock); ++ spin_lock(&step_hook_lock); ++ list_del_rcu(&hook->node); ++ spin_unlock(&step_hook_lock); ++ synchronize_rcu(); + } + + /* +@@ -213,15 +214,15 @@ static int call_step_hook(struct pt_regs *regs, unsigned int esr) + struct step_hook *hook; + int retval = DBG_HOOK_ERROR; + +- read_lock(&step_hook_lock); ++ rcu_read_lock(); + +- list_for_each_entry(hook, &step_hook, node) { ++ list_for_each_entry_rcu(hook, &step_hook, node) { + retval = hook->fn(regs, esr); + if (retval == DBG_HOOK_HANDLED) + break; + } + +- read_unlock(&step_hook_lock); ++ rcu_read_unlock(); + + return retval; + } +diff --git a/arch/mips/kvm/mips.c b/arch/mips/kvm/mips.c +index 2683d04..8a11329 100644 +--- a/arch/mips/kvm/mips.c ++++ b/arch/mips/kvm/mips.c +@@ -445,8 +445,8 @@ int kvm_vcpu_ioctl_interrupt(struct kvm_vcpu *vcpu, + + dvcpu->arch.wait = 0; + +- if (waitqueue_active(&dvcpu->wq)) +- wake_up_interruptible(&dvcpu->wq); ++ if (swait_active(&dvcpu->wq)) ++ swake_up(&dvcpu->wq); + + return 0; + } +@@ -1174,8 +1174,8 @@ static void kvm_mips_comparecount_func(unsigned long data) + kvm_mips_callbacks->queue_timer_int(vcpu); + + vcpu->arch.wait = 0; +- if (waitqueue_active(&vcpu->wq)) +- wake_up_interruptible(&vcpu->wq); ++ if (swait_active(&vcpu->wq)) ++ swake_up(&vcpu->wq); + } + + /* low level hrtimer wake routine */ +diff --git a/arch/powerpc/include/asm/kvm_host.h b/arch/powerpc/include/asm/kvm_host.h +index b439518..f8673ff 100644 +--- a/arch/powerpc/include/asm/kvm_host.h ++++ b/arch/powerpc/include/asm/kvm_host.h +@@ -286,7 +286,7 @@ struct kvmppc_vcore { + struct list_head runnable_threads; + struct list_head preempt_list; + spinlock_t lock; +- struct swait_head wq; ++ struct swait_queue_head wq; + spinlock_t stoltb_lock; /* protects stolen_tb and preempt_tb */ + u64 stolen_tb; + u64 preempt_tb; +@@ -626,7 +626,7 @@ struct kvm_vcpu_arch { + u8 prodded; + u32 last_inst; + +- struct swait_head *wqp; ++ struct swait_queue_head *wqp; + struct kvmppc_vcore *vcore; + int ret; + int trap; +diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c +index 32be32b..df34a64 100644 +--- a/arch/powerpc/kvm/book3s_hv.c ++++ b/arch/powerpc/kvm/book3s_hv.c +@@ -114,11 +114,11 @@ static bool kvmppc_ipi_thread(int cpu) + static void kvmppc_fast_vcpu_kick_hv(struct kvm_vcpu *vcpu) + { + int cpu; +- struct swait_head *wqp; ++ struct swait_queue_head *wqp; + + wqp = kvm_arch_vcpu_wq(vcpu); +- if (swaitqueue_active(wqp)) { +- swait_wake_interruptible(wqp); ++ if (swait_active(wqp)) { ++ swake_up(wqp); + ++vcpu->stat.halt_wakeup; + } + +@@ -707,8 +707,8 @@ int kvmppc_pseries_do_hcall(struct kvm_vcpu *vcpu) + tvcpu->arch.prodded = 1; + smp_mb(); + if (vcpu->arch.ceded) { +- if (swaitqueue_active(&vcpu->wq)) { +- swait_wake_interruptible(&vcpu->wq); ++ if (swait_active(&vcpu->wq)) { ++ swake_up(&vcpu->wq); + vcpu->stat.halt_wakeup++; + } + } +@@ -1447,7 +1447,7 @@ static struct kvmppc_vcore *kvmppc_vcore_create(struct kvm *kvm, int core) + INIT_LIST_HEAD(&vcore->runnable_threads); + spin_lock_init(&vcore->lock); + spin_lock_init(&vcore->stoltb_lock); +- init_swait_head(&vcore->wq); ++ init_swait_queue_head(&vcore->wq); + vcore->preempt_tb = TB_NIL; + vcore->lpcr = kvm->arch.lpcr; + vcore->first_vcpuid = core * threads_per_subcore; +@@ -2519,9 +2519,9 @@ static void kvmppc_vcore_blocked(struct kvmppc_vcore *vc) + { + struct kvm_vcpu *vcpu; + int do_sleep = 1; +- DEFINE_SWAITER(wait); ++ DECLARE_SWAITQUEUE(wait); + +- swait_prepare(&vc->wq, &wait, TASK_INTERRUPTIBLE); ++ prepare_to_swait(&vc->wq, &wait, TASK_INTERRUPTIBLE); + + /* + * Check one last time for pending exceptions and ceded state after +@@ -2535,7 +2535,7 @@ static void kvmppc_vcore_blocked(struct kvmppc_vcore *vc) + } + + if (!do_sleep) { +- swait_finish(&vc->wq, &wait); ++ finish_swait(&vc->wq, &wait); + return; + } + +@@ -2543,7 +2543,7 @@ static void kvmppc_vcore_blocked(struct kvmppc_vcore *vc) + trace_kvmppc_vcore_blocked(vc, 0); + spin_unlock(&vc->lock); + schedule(); +- swait_finish(&vc->wq, &wait); ++ finish_swait(&vc->wq, &wait); + spin_lock(&vc->lock); + vc->vcore_state = VCORE_INACTIVE; + trace_kvmppc_vcore_blocked(vc, 1); +@@ -2599,7 +2599,7 @@ static int kvmppc_run_vcpu(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu) + kvmppc_start_thread(vcpu, vc); + trace_kvm_guest_enter(vcpu); + } else if (vc->vcore_state == VCORE_SLEEPING) { +- swait_wake(&vc->wq); ++ swake_up(&vc->wq); + } + + } +diff --git a/arch/s390/include/asm/kvm_host.h b/arch/s390/include/asm/kvm_host.h +index 2a84c76..bbdc539 100644 +--- a/arch/s390/include/asm/kvm_host.h ++++ b/arch/s390/include/asm/kvm_host.h +@@ -427,7 +427,7 @@ struct kvm_s390_irq_payload { + struct kvm_s390_local_interrupt { + spinlock_t lock; + struct kvm_s390_float_interrupt *float_int; +- struct swait_head *wq; ++ struct swait_queue_head *wq; + atomic_t *cpuflags; + DECLARE_BITMAP(sigp_emerg_pending, KVM_MAX_VCPUS); + struct kvm_s390_irq_payload irq; +diff --git a/arch/s390/kvm/interrupt.c b/arch/s390/kvm/interrupt.c +index 8b4516b..cc862c4 100644 +--- a/arch/s390/kvm/interrupt.c ++++ b/arch/s390/kvm/interrupt.c +@@ -868,13 +868,13 @@ int kvm_s390_handle_wait(struct kvm_vcpu *vcpu) + + void kvm_s390_vcpu_wakeup(struct kvm_vcpu *vcpu) + { +- if (swaitqueue_active(&vcpu->wq)) { ++ if (swait_active(&vcpu->wq)) { + /* + * The vcpu gave up the cpu voluntarily, mark it as a good + * yield-candidate. + */ + vcpu->preempted = true; +- swait_wake_interruptible(&vcpu->wq); ++ swake_up(&vcpu->wq); + vcpu->stat.halt_wakeup++; + } + } +diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c +index 47190bd..8079508 100644 +--- a/arch/x86/kernel/kvm.c ++++ b/arch/x86/kernel/kvm.c +@@ -36,6 +36,7 @@ + #include <linux/kprobes.h> + #include <linux/debugfs.h> + #include <linux/nmi.h> ++#include <linux/swait.h> + #include <asm/timer.h> + #include <asm/cpu.h> + #include <asm/traps.h> +@@ -91,14 +92,14 @@ static void kvm_io_delay(void) + + struct kvm_task_sleep_node { + struct hlist_node link; +- wait_queue_head_t wq; ++ struct swait_queue_head wq; + u32 token; + int cpu; + bool halted; + }; + + static struct kvm_task_sleep_head { +- spinlock_t lock; ++ raw_spinlock_t lock; + struct hlist_head list; + } async_pf_sleepers[KVM_TASK_SLEEP_HASHSIZE]; + +@@ -122,17 +123,17 @@ void kvm_async_pf_task_wait(u32 token) + u32 key = hash_32(token, KVM_TASK_SLEEP_HASHBITS); + struct kvm_task_sleep_head *b = &async_pf_sleepers[key]; + struct kvm_task_sleep_node n, *e; +- DEFINE_WAIT(wait); ++ DECLARE_SWAITQUEUE(wait); + + rcu_irq_enter(); + +- spin_lock(&b->lock); ++ raw_spin_lock(&b->lock); + e = _find_apf_task(b, token); + if (e) { + /* dummy entry exist -> wake up was delivered ahead of PF */ + hlist_del(&e->link); + kfree(e); +- spin_unlock(&b->lock); ++ raw_spin_unlock(&b->lock); + + rcu_irq_exit(); + return; +@@ -141,13 +142,13 @@ void kvm_async_pf_task_wait(u32 token) + n.token = token; + n.cpu = smp_processor_id(); + n.halted = is_idle_task(current) || preempt_count() > 1; +- init_waitqueue_head(&n.wq); ++ init_swait_queue_head(&n.wq); + hlist_add_head(&n.link, &b->list); +- spin_unlock(&b->lock); ++ raw_spin_unlock(&b->lock); + + for (;;) { + if (!n.halted) +- prepare_to_wait(&n.wq, &wait, TASK_UNINTERRUPTIBLE); ++ prepare_to_swait(&n.wq, &wait, TASK_UNINTERRUPTIBLE); + if (hlist_unhashed(&n.link)) + break; + +@@ -166,7 +167,7 @@ void kvm_async_pf_task_wait(u32 token) + } + } + if (!n.halted) +- finish_wait(&n.wq, &wait); ++ finish_swait(&n.wq, &wait); + + rcu_irq_exit(); + return; +@@ -178,8 +179,8 @@ static void apf_task_wake_one(struct kvm_task_sleep_node *n) + hlist_del_init(&n->link); + if (n->halted) + smp_send_reschedule(n->cpu); +- else if (waitqueue_active(&n->wq)) +- wake_up(&n->wq); ++ else if (swait_active(&n->wq)) ++ swake_up(&n->wq); + } + + static void apf_task_wake_all(void) +@@ -189,14 +190,14 @@ static void apf_task_wake_all(void) + for (i = 0; i < KVM_TASK_SLEEP_HASHSIZE; i++) { + struct hlist_node *p, *next; + struct kvm_task_sleep_head *b = &async_pf_sleepers[i]; +- spin_lock(&b->lock); ++ raw_spin_lock(&b->lock); + hlist_for_each_safe(p, next, &b->list) { + struct kvm_task_sleep_node *n = + hlist_entry(p, typeof(*n), link); + if (n->cpu == smp_processor_id()) + apf_task_wake_one(n); + } +- spin_unlock(&b->lock); ++ raw_spin_unlock(&b->lock); + } + } + +@@ -212,7 +213,7 @@ void kvm_async_pf_task_wake(u32 token) + } + + again: +- spin_lock(&b->lock); ++ raw_spin_lock(&b->lock); + n = _find_apf_task(b, token); + if (!n) { + /* +@@ -225,17 +226,17 @@ void kvm_async_pf_task_wake(u32 token) + * Allocation failed! Busy wait while other cpu + * handles async PF. + */ +- spin_unlock(&b->lock); ++ raw_spin_unlock(&b->lock); + cpu_relax(); + goto again; + } + n->token = token; + n->cpu = smp_processor_id(); +- init_waitqueue_head(&n->wq); ++ init_swait_queue_head(&n->wq); + hlist_add_head(&n->link, &b->list); + } else + apf_task_wake_one(n); +- spin_unlock(&b->lock); ++ raw_spin_unlock(&b->lock); + return; + } + EXPORT_SYMBOL_GPL(kvm_async_pf_task_wake); +@@ -486,7 +487,7 @@ void __init kvm_guest_init(void) + paravirt_ops_setup(); + register_reboot_notifier(&kvm_pv_reboot_nb); + for (i = 0; i < KVM_TASK_SLEEP_HASHSIZE; i++) +- spin_lock_init(&async_pf_sleepers[i].lock); ++ raw_spin_lock_init(&async_pf_sleepers[i].lock); + if (kvm_para_has_feature(KVM_FEATURE_ASYNC_PF)) + x86_init.irqs.trap_init = kvm_apf_trap_init; + +diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c +index 906a1ec..20d9e9f 100644 +--- a/arch/x86/kvm/lapic.c ++++ b/arch/x86/kvm/lapic.c +@@ -1195,7 +1195,7 @@ static void apic_update_lvtt(struct kvm_lapic *apic) + static void apic_timer_expired(struct kvm_lapic *apic) + { + struct kvm_vcpu *vcpu = apic->vcpu; +- struct swait_head *q = &vcpu->wq; ++ struct swait_queue_head *q = &vcpu->wq; + struct kvm_timer *ktimer = &apic->lapic_timer; + + if (atomic_read(&apic->lapic_timer.pending)) +@@ -1204,8 +1204,8 @@ static void apic_timer_expired(struct kvm_lapic *apic) + atomic_inc(&apic->lapic_timer.pending); + kvm_set_pending_timer(vcpu); + +- if (swaitqueue_active(q)) +- swait_wake_interruptible(q); ++ if (swait_active(q)) ++ swake_up(q); + + if (apic_lvtt_tscdeadline(apic)) + ktimer->expired_tscdeadline = ktimer->tscdeadline; +diff --git a/block/blk-core.c b/block/blk-core.c +index 4c8cefd..2f7afb9 100644 +--- a/block/blk-core.c ++++ b/block/blk-core.c +@@ -680,7 +680,7 @@ static void blk_queue_usage_counter_release(struct percpu_ref *ref) + struct request_queue *q = + container_of(ref, struct request_queue, q_usage_counter); + +- swait_wake_all(&q->mq_freeze_wq); ++ swake_up_all(&q->mq_freeze_wq); + } + + struct request_queue *blk_alloc_queue_node(gfp_t gfp_mask, int node_id) +@@ -742,7 +742,7 @@ struct request_queue *blk_alloc_queue_node(gfp_t gfp_mask, int node_id) + q->bypass_depth = 1; + __set_bit(QUEUE_FLAG_BYPASS, &q->queue_flags); + +- init_swait_head(&q->mq_freeze_wq); ++ init_swait_queue_head(&q->mq_freeze_wq); + + /* + * Init percpu_ref in atomic mode so that it's faster to shutdown. +diff --git a/block/blk-mq.c b/block/blk-mq.c +index 3c70813..7cdf19e 100644 +--- a/block/blk-mq.c ++++ b/block/blk-mq.c +@@ -130,7 +130,7 @@ void blk_mq_unfreeze_queue(struct request_queue *q) + WARN_ON_ONCE(freeze_depth < 0); + if (!freeze_depth) { + percpu_ref_reinit(&q->q_usage_counter); +- swait_wake_all(&q->mq_freeze_wq); ++ swake_up_all(&q->mq_freeze_wq); + } + } + EXPORT_SYMBOL_GPL(blk_mq_unfreeze_queue); +@@ -149,7 +149,7 @@ void blk_mq_wake_waiters(struct request_queue *q) + * dying, we need to ensure that processes currently waiting on + * the queue are notified as well. + */ +- swait_wake_all(&q->mq_freeze_wq); ++ swake_up_all(&q->mq_freeze_wq); + } + + bool blk_mq_can_queue(struct blk_mq_hw_ctx *hctx) +diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c +index 370c2f7..65e0b37 100644 +--- a/drivers/block/zram/zram_drv.c ++++ b/drivers/block/zram/zram_drv.c +@@ -520,6 +520,8 @@ static struct zram_meta *zram_meta_alloc(char *pool_name, u64 disksize) + goto out_error; + } + ++ zram_meta_init_table_locks(meta, disksize); ++ + return meta; + + out_error: +@@ -568,12 +570,12 @@ static int zram_decompress_page(struct zram *zram, char *mem, u32 index) + unsigned long handle; + size_t size; + +- bit_spin_lock(ZRAM_ACCESS, &meta->table[index].value); ++ zram_lock_table(&meta->table[index]); + handle = meta->table[index].handle; + size = zram_get_obj_size(meta, index); + + if (!handle || zram_test_flag(meta, index, ZRAM_ZERO)) { +- bit_spin_unlock(ZRAM_ACCESS, &meta->table[index].value); ++ zram_unlock_table(&meta->table[index]); + clear_page(mem); + return 0; + } +@@ -584,7 +586,7 @@ static int zram_decompress_page(struct zram *zram, char *mem, u32 index) + else + ret = zcomp_decompress(zram->comp, cmem, size, mem); + zs_unmap_object(meta->mem_pool, handle); +- bit_spin_unlock(ZRAM_ACCESS, &meta->table[index].value); ++ zram_unlock_table(&meta->table[index]); + + /* Should NEVER happen. Return bio error if it does. */ + if (unlikely(ret)) { +@@ -604,14 +606,14 @@ static int zram_bvec_read(struct zram *zram, struct bio_vec *bvec, + struct zram_meta *meta = zram->meta; + page = bvec->bv_page; + +- bit_spin_lock(ZRAM_ACCESS, &meta->table[index].value); ++ zram_lock_table(&meta->table[index]); + if (unlikely(!meta->table[index].handle) || + zram_test_flag(meta, index, ZRAM_ZERO)) { +- bit_spin_unlock(ZRAM_ACCESS, &meta->table[index].value); ++ zram_unlock_table(&meta->table[index]); + handle_zero_page(bvec); + return 0; + } +- bit_spin_unlock(ZRAM_ACCESS, &meta->table[index].value); ++ zram_unlock_table(&meta->table[index]); + + if (is_partial_io(bvec)) + /* Use a temporary buffer to decompress the page */ +@@ -689,10 +691,10 @@ static int zram_bvec_write(struct zram *zram, struct bio_vec *bvec, u32 index, + if (user_mem) + kunmap_atomic(user_mem); + /* Free memory associated with this sector now. */ +- bit_spin_lock(ZRAM_ACCESS, &meta->table[index].value); ++ zram_lock_table(&meta->table[index]); + zram_free_page(zram, index); + zram_set_flag(meta, index, ZRAM_ZERO); +- bit_spin_unlock(ZRAM_ACCESS, &meta->table[index].value); ++ zram_unlock_table(&meta->table[index]); + + atomic64_inc(&zram->stats.zero_pages); + ret = 0; +@@ -752,12 +754,12 @@ static int zram_bvec_write(struct zram *zram, struct bio_vec *bvec, u32 index, + * Free memory associated with this sector + * before overwriting unused sectors. + */ +- bit_spin_lock(ZRAM_ACCESS, &meta->table[index].value); ++ zram_lock_table(&meta->table[index]); + zram_free_page(zram, index); + + meta->table[index].handle = handle; + zram_set_obj_size(meta, index, clen); +- bit_spin_unlock(ZRAM_ACCESS, &meta->table[index].value); ++ zram_unlock_table(&meta->table[index]); + + /* Update stats */ + atomic64_add(clen, &zram->stats.compr_data_size); +@@ -800,9 +802,9 @@ static void zram_bio_discard(struct zram *zram, u32 index, + } + + while (n >= PAGE_SIZE) { +- bit_spin_lock(ZRAM_ACCESS, &meta->table[index].value); ++ zram_lock_table(&meta->table[index]); + zram_free_page(zram, index); +- bit_spin_unlock(ZRAM_ACCESS, &meta->table[index].value); ++ zram_unlock_table(&meta->table[index]); + atomic64_inc(&zram->stats.notify_free); + index++; + n -= PAGE_SIZE; +@@ -928,9 +930,9 @@ static void zram_slot_free_notify(struct block_device *bdev, + zram = bdev->bd_disk->private_data; + meta = zram->meta; + +- bit_spin_lock(ZRAM_ACCESS, &meta->table[index].value); ++ zram_lock_table(&meta->table[index]); + zram_free_page(zram, index); +- bit_spin_unlock(ZRAM_ACCESS, &meta->table[index].value); ++ zram_unlock_table(&meta->table[index]); + atomic64_inc(&zram->stats.notify_free); + } + +diff --git a/drivers/block/zram/zram_drv.h b/drivers/block/zram/zram_drv.h +index 8e92339..1e4a3c6 100644 +--- a/drivers/block/zram/zram_drv.h ++++ b/drivers/block/zram/zram_drv.h +@@ -72,6 +72,9 @@ enum zram_pageflags { + struct zram_table_entry { + unsigned long handle; + unsigned long value; ++#ifdef CONFIG_PREEMPT_RT_BASE ++ spinlock_t lock; ++#endif + }; + + struct zram_stats { +@@ -119,4 +122,42 @@ struct zram { + */ + bool claim; /* Protected by bdev->bd_mutex */ + }; ++ ++#ifndef CONFIG_PREEMPT_RT_BASE ++static inline void zram_lock_table(struct zram_table_entry *table) ++{ ++ bit_spin_lock(ZRAM_ACCESS, &table->value); ++} ++ ++static inline void zram_unlock_table(struct zram_table_entry *table) ++{ ++ bit_spin_unlock(ZRAM_ACCESS, &table->value); ++} ++ ++static inline void zram_meta_init_locks(struct zram_meta *meta, u64 disksize) { } ++#else /* CONFIG_PREEMPT_RT_BASE */ ++static inline void zram_lock_table(struct zram_table_entry *table) ++{ ++ spin_lock(&table->lock); ++ __set_bit(ZRAM_ACCESS, &table->value); ++} ++ ++static inline void zram_unlock_table(struct zram_table_entry *table) ++{ ++ __clear_bit(ZRAM_ACCESS, &table->value); ++ spin_unlock(&table->lock); ++} ++ ++static inline void zram_meta_init_table_locks(struct zram_meta *meta, u64 disksize) ++{ ++ size_t num_pages = disksize >> PAGE_SHIFT; ++ size_t index; ++ ++ for (index = 0; index < num_pages; index++) { ++ spinlock_t *lock = &meta->table[index].lock; ++ spin_lock_init(lock); ++ } ++} ++#endif /* CONFIG_PREEMPT_RT_BASE */ ++ + #endif +diff --git a/drivers/clk/at91/clk-generated.c b/drivers/clk/at91/clk-generated.c +index abc8094..4ad3298 100644 +--- a/drivers/clk/at91/clk-generated.c ++++ b/drivers/clk/at91/clk-generated.c +@@ -15,8 +15,8 @@ + #include <linux/clkdev.h> + #include <linux/clk/at91_pmc.h> + #include <linux/of.h> +-#include <linux/of_address.h> +-#include <linux/io.h> ++#include <linux/mfd/syscon.h> ++#include <linux/regmap.h> + + #include "pmc.h" + +@@ -28,8 +28,9 @@ + + struct clk_generated { + struct clk_hw hw; +- struct at91_pmc *pmc; ++ struct regmap *regmap; + struct clk_range range; ++ spinlock_t *lock; + u32 id; + u32 gckdiv; + u8 parent_id; +@@ -41,49 +42,52 @@ struct clk_generated { + static int clk_generated_enable(struct clk_hw *hw) + { + struct clk_generated *gck = to_clk_generated(hw); +- struct at91_pmc *pmc = gck->pmc; +- u32 tmp; ++ unsigned long flags; + + pr_debug("GCLK: %s, gckdiv = %d, parent id = %d\n", + __func__, gck->gckdiv, gck->parent_id); + +- pmc_lock(pmc); +- pmc_write(pmc, AT91_PMC_PCR, (gck->id & AT91_PMC_PCR_PID_MASK)); +- tmp = pmc_read(pmc, AT91_PMC_PCR) & +- ~(AT91_PMC_PCR_GCKDIV_MASK | AT91_PMC_PCR_GCKCSS_MASK); +- pmc_write(pmc, AT91_PMC_PCR, tmp | AT91_PMC_PCR_GCKCSS(gck->parent_id) +- | AT91_PMC_PCR_CMD +- | AT91_PMC_PCR_GCKDIV(gck->gckdiv) +- | AT91_PMC_PCR_GCKEN); +- pmc_unlock(pmc); ++ spin_lock_irqsave(gck->lock, flags); ++ regmap_write(gck->regmap, AT91_PMC_PCR, ++ (gck->id & AT91_PMC_PCR_PID_MASK)); ++ regmap_update_bits(gck->regmap, AT91_PMC_PCR, ++ AT91_PMC_PCR_GCKDIV_MASK | AT91_PMC_PCR_GCKCSS_MASK | ++ AT91_PMC_PCR_CMD | AT91_PMC_PCR_GCKEN, ++ AT91_PMC_PCR_GCKCSS(gck->parent_id) | ++ AT91_PMC_PCR_CMD | ++ AT91_PMC_PCR_GCKDIV(gck->gckdiv) | ++ AT91_PMC_PCR_GCKEN); ++ spin_unlock_irqrestore(gck->lock, flags); + return 0; + } + + static void clk_generated_disable(struct clk_hw *hw) + { + struct clk_generated *gck = to_clk_generated(hw); +- struct at91_pmc *pmc = gck->pmc; +- u32 tmp; +- +- pmc_lock(pmc); +- pmc_write(pmc, AT91_PMC_PCR, (gck->id & AT91_PMC_PCR_PID_MASK)); +- tmp = pmc_read(pmc, AT91_PMC_PCR) & ~AT91_PMC_PCR_GCKEN; +- pmc_write(pmc, AT91_PMC_PCR, tmp | AT91_PMC_PCR_CMD); +- pmc_unlock(pmc); ++ unsigned long flags; ++ ++ spin_lock_irqsave(gck->lock, flags); ++ regmap_write(gck->regmap, AT91_PMC_PCR, ++ (gck->id & AT91_PMC_PCR_PID_MASK)); ++ regmap_update_bits(gck->regmap, AT91_PMC_PCR, ++ AT91_PMC_PCR_CMD | AT91_PMC_PCR_GCKEN, ++ AT91_PMC_PCR_CMD); ++ spin_unlock_irqrestore(gck->lock, flags); + } + + static int clk_generated_is_enabled(struct clk_hw *hw) + { + struct clk_generated *gck = to_clk_generated(hw); +- struct at91_pmc *pmc = gck->pmc; +- int ret; ++ unsigned long flags; ++ unsigned int status; + +- pmc_lock(pmc); +- pmc_write(pmc, AT91_PMC_PCR, (gck->id & AT91_PMC_PCR_PID_MASK)); +- ret = !!(pmc_read(pmc, AT91_PMC_PCR) & AT91_PMC_PCR_GCKEN); +- pmc_unlock(pmc); ++ spin_lock_irqsave(gck->lock, flags); ++ regmap_write(gck->regmap, AT91_PMC_PCR, ++ (gck->id & AT91_PMC_PCR_PID_MASK)); ++ regmap_read(gck->regmap, AT91_PMC_PCR, &status); ++ spin_unlock_irqrestore(gck->lock, flags); + +- return ret; ++ return status & AT91_PMC_PCR_GCKEN ? 1 : 0; + } + + static unsigned long +@@ -214,13 +218,14 @@ static const struct clk_ops generated_ops = { + */ + static void clk_generated_startup(struct clk_generated *gck) + { +- struct at91_pmc *pmc = gck->pmc; + u32 tmp; ++ unsigned long flags; + +- pmc_lock(pmc); +- pmc_write(pmc, AT91_PMC_PCR, (gck->id & AT91_PMC_PCR_PID_MASK)); +- tmp = pmc_read(pmc, AT91_PMC_PCR); +- pmc_unlock(pmc); ++ spin_lock_irqsave(gck->lock, flags); ++ regmap_write(gck->regmap, AT91_PMC_PCR, ++ (gck->id & AT91_PMC_PCR_PID_MASK)); ++ regmap_read(gck->regmap, AT91_PMC_PCR, &tmp); ++ spin_unlock_irqrestore(gck->lock, flags); + + gck->parent_id = (tmp & AT91_PMC_PCR_GCKCSS_MASK) + >> AT91_PMC_PCR_GCKCSS_OFFSET; +@@ -229,8 +234,8 @@ static void clk_generated_startup(struct clk_generated *gck) + } + + static struct clk * __init +-at91_clk_register_generated(struct at91_pmc *pmc, const char *name, +- const char **parent_names, u8 num_parents, ++at91_clk_register_generated(struct regmap *regmap, spinlock_t *lock, const char ++ *name, const char **parent_names, u8 num_parents, + u8 id, const struct clk_range *range) + { + struct clk_generated *gck; +@@ -249,7 +254,8 @@ at91_clk_register_generated(struct at91_pmc *pmc, const char *name, + + gck->id = id; + gck->hw.init = &init; +- gck->pmc = pmc; ++ gck->regmap = regmap; ++ gck->lock = lock; + gck->range = *range; + + clk = clk_register(NULL, &gck->hw); +@@ -261,8 +267,7 @@ at91_clk_register_generated(struct at91_pmc *pmc, const char *name, + return clk; + } + +-void __init of_sama5d2_clk_generated_setup(struct device_node *np, +- struct at91_pmc *pmc) ++void __init of_sama5d2_clk_generated_setup(struct device_node *np) + { + int num; + u32 id; +@@ -272,6 +277,7 @@ void __init of_sama5d2_clk_generated_setup(struct device_node *np, + const char *parent_names[GENERATED_SOURCE_MAX]; + struct device_node *gcknp; + struct clk_range range = CLK_RANGE(0, 0); ++ struct regmap *regmap; + + num_parents = of_clk_get_parent_count(np); + if (num_parents <= 0 || num_parents > GENERATED_SOURCE_MAX) +@@ -283,6 +289,10 @@ void __init of_sama5d2_clk_generated_setup(struct device_node *np, + if (!num || num > PERIPHERAL_MAX) + return; + ++ regmap = syscon_node_to_regmap(of_get_parent(np)); ++ if (IS_ERR(regmap)) ++ return; ++ + for_each_child_of_node(np, gcknp) { + if (of_property_read_u32(gcknp, "reg", &id)) + continue; +@@ -296,11 +306,14 @@ void __init of_sama5d2_clk_generated_setup(struct device_node *np, + of_at91_get_clk_range(gcknp, "atmel,clk-output-range", + &range); + +- clk = at91_clk_register_generated(pmc, name, parent_names, +- num_parents, id, &range); ++ clk = at91_clk_register_generated(regmap, &pmc_pcr_lock, name, ++ parent_names, num_parents, ++ id, &range); + if (IS_ERR(clk)) + continue; + + of_clk_add_provider(gcknp, of_clk_src_simple_get, clk); + } + } ++CLK_OF_DECLARE(of_sama5d2_clk_generated_setup, "atmel,sama5d2-clk-generated", ++ of_sama5d2_clk_generated_setup); +diff --git a/drivers/clk/at91/clk-h32mx.c b/drivers/clk/at91/clk-h32mx.c +index 61566bc..819f584 100644 +--- a/drivers/clk/at91/clk-h32mx.c ++++ b/drivers/clk/at91/clk-h32mx.c +@@ -15,15 +15,9 @@ + #include <linux/clk-provider.h> + #include <linux/clkdev.h> + #include <linux/clk/at91_pmc.h> +-#include <linux/delay.h> + #include <linux/of.h> +-#include <linux/of_address.h> +-#include <linux/of_irq.h> +-#include <linux/io.h> +-#include <linux/interrupt.h> +-#include <linux/irq.h> +-#include <linux/sched.h> +-#include <linux/wait.h> ++#include <linux/regmap.h> ++#include <linux/mfd/syscon.h> + + #include "pmc.h" + +@@ -31,7 +25,7 @@ + + struct clk_sama5d4_h32mx { + struct clk_hw hw; +- struct at91_pmc *pmc; ++ struct regmap *regmap; + }; + + #define to_clk_sama5d4_h32mx(hw) container_of(hw, struct clk_sama5d4_h32mx, hw) +@@ -40,8 +34,10 @@ static unsigned long clk_sama5d4_h32mx_recalc_rate(struct clk_hw *hw, + unsigned long parent_rate) + { + struct clk_sama5d4_h32mx *h32mxclk = to_clk_sama5d4_h32mx(hw); ++ unsigned int mckr; + +- if (pmc_read(h32mxclk->pmc, AT91_PMC_MCKR) & AT91_PMC_H32MXDIV) ++ regmap_read(h32mxclk->regmap, AT91_PMC_MCKR, &mckr); ++ if (mckr & AT91_PMC_H32MXDIV) + return parent_rate / 2; + + if (parent_rate > H32MX_MAX_FREQ) +@@ -70,18 +66,16 @@ static int clk_sama5d4_h32mx_set_rate(struct clk_hw *hw, unsigned long rate, + unsigned long parent_rate) + { + struct clk_sama5d4_h32mx *h32mxclk = to_clk_sama5d4_h32mx(hw); +- struct at91_pmc *pmc = h32mxclk->pmc; +- u32 tmp; ++ u32 mckr = 0; + + if (parent_rate != rate && (parent_rate / 2) != rate) + return -EINVAL; + +- pmc_lock(pmc); +- tmp = pmc_read(pmc, AT91_PMC_MCKR) & ~AT91_PMC_H32MXDIV; + if ((parent_rate / 2) == rate) +- tmp |= AT91_PMC_H32MXDIV; +- pmc_write(pmc, AT91_PMC_MCKR, tmp); +- pmc_unlock(pmc); ++ mckr = AT91_PMC_H32MXDIV; ++ ++ regmap_update_bits(h32mxclk->regmap, AT91_PMC_MCKR, ++ AT91_PMC_H32MXDIV, mckr); + + return 0; + } +@@ -92,14 +86,18 @@ static const struct clk_ops h32mx_ops = { + .set_rate = clk_sama5d4_h32mx_set_rate, + }; + +-void __init of_sama5d4_clk_h32mx_setup(struct device_node *np, +- struct at91_pmc *pmc) ++static void __init of_sama5d4_clk_h32mx_setup(struct device_node *np) + { + struct clk_sama5d4_h32mx *h32mxclk; + struct clk_init_data init; + const char *parent_name; ++ struct regmap *regmap; + struct clk *clk; + ++ regmap = syscon_node_to_regmap(of_get_parent(np)); ++ if (IS_ERR(regmap)) ++ return; ++ + h32mxclk = kzalloc(sizeof(*h32mxclk), GFP_KERNEL); + if (!h32mxclk) + return; +@@ -113,7 +111,7 @@ void __init of_sama5d4_clk_h32mx_setup(struct device_node *np, + init.flags = CLK_SET_RATE_GATE; + + h32mxclk->hw.init = &init; +- h32mxclk->pmc = pmc; ++ h32mxclk->regmap = regmap; + + clk = clk_register(NULL, &h32mxclk->hw); + if (!clk) { +@@ -123,3 +121,5 @@ void __init of_sama5d4_clk_h32mx_setup(struct device_node *np, + + of_clk_add_provider(np, of_clk_src_simple_get, clk); + } ++CLK_OF_DECLARE(of_sama5d4_clk_h32mx_setup, "atmel,sama5d4-clk-h32mx", ++ of_sama5d4_clk_h32mx_setup); +diff --git a/drivers/clk/at91/clk-main.c b/drivers/clk/at91/clk-main.c +index fd7247d..4bfc94d 100644 +--- a/drivers/clk/at91/clk-main.c ++++ b/drivers/clk/at91/clk-main.c +@@ -13,13 +13,8 @@ + #include <linux/clk/at91_pmc.h> + #include <linux/delay.h> + #include <linux/of.h> +-#include <linux/of_address.h> +-#include <linux/of_irq.h> +-#include <linux/io.h> +-#include <linux/interrupt.h> +-#include <linux/irq.h> +-#include <linux/sched.h> +-#include <linux/wait.h> ++#include <linux/mfd/syscon.h> ++#include <linux/regmap.h> + + #include "pmc.h" + +@@ -34,18 +29,14 @@ + + struct clk_main_osc { + struct clk_hw hw; +- struct at91_pmc *pmc; +- unsigned int irq; +- wait_queue_head_t wait; ++ struct regmap *regmap; + }; + + #define to_clk_main_osc(hw) container_of(hw, struct clk_main_osc, hw) + + struct clk_main_rc_osc { + struct clk_hw hw; +- struct at91_pmc *pmc; +- unsigned int irq; +- wait_queue_head_t wait; ++ struct regmap *regmap; + unsigned long frequency; + unsigned long accuracy; + }; +@@ -54,51 +45,47 @@ struct clk_main_rc_osc { + + struct clk_rm9200_main { + struct clk_hw hw; +- struct at91_pmc *pmc; ++ struct regmap *regmap; + }; + + #define to_clk_rm9200_main(hw) container_of(hw, struct clk_rm9200_main, hw) + + struct clk_sam9x5_main { + struct clk_hw hw; +- struct at91_pmc *pmc; +- unsigned int irq; +- wait_queue_head_t wait; ++ struct regmap *regmap; + u8 parent; + }; + + #define to_clk_sam9x5_main(hw) container_of(hw, struct clk_sam9x5_main, hw) + +-static irqreturn_t clk_main_osc_irq_handler(int irq, void *dev_id) ++static inline bool clk_main_osc_ready(struct regmap *regmap) + { +- struct clk_main_osc *osc = dev_id; ++ unsigned int status; + +- wake_up(&osc->wait); +- disable_irq_nosync(osc->irq); ++ regmap_read(regmap, AT91_PMC_SR, &status); + +- return IRQ_HANDLED; ++ return status & AT91_PMC_MOSCS; + } + + static int clk_main_osc_prepare(struct clk_hw *hw) + { + struct clk_main_osc *osc = to_clk_main_osc(hw); +- struct at91_pmc *pmc = osc->pmc; ++ struct regmap *regmap = osc->regmap; + u32 tmp; + +- tmp = pmc_read(pmc, AT91_CKGR_MOR) & ~MOR_KEY_MASK; ++ regmap_read(regmap, AT91_CKGR_MOR, &tmp); ++ tmp &= ~MOR_KEY_MASK; ++ + if (tmp & AT91_PMC_OSCBYPASS) + return 0; + + if (!(tmp & AT91_PMC_MOSCEN)) { + tmp |= AT91_PMC_MOSCEN | AT91_PMC_KEY; +- pmc_write(pmc, AT91_CKGR_MOR, tmp); ++ regmap_write(regmap, AT91_CKGR_MOR, tmp); + } + +- while (!(pmc_read(pmc, AT91_PMC_SR) & AT91_PMC_MOSCS)) { +- enable_irq(osc->irq); +- wait_event(osc->wait, +- pmc_read(pmc, AT91_PMC_SR) & AT91_PMC_MOSCS); +- } ++ while (!clk_main_osc_ready(regmap)) ++ cpu_relax(); + + return 0; + } +@@ -106,9 +93,10 @@ static int clk_main_osc_prepare(struct clk_hw *hw) + static void clk_main_osc_unprepare(struct clk_hw *hw) + { + struct clk_main_osc *osc = to_clk_main_osc(hw); +- struct at91_pmc *pmc = osc->pmc; +- u32 tmp = pmc_read(pmc, AT91_CKGR_MOR); ++ struct regmap *regmap = osc->regmap; ++ u32 tmp; + ++ regmap_read(regmap, AT91_CKGR_MOR, &tmp); + if (tmp & AT91_PMC_OSCBYPASS) + return; + +@@ -116,20 +104,22 @@ static void clk_main_osc_unprepare(struct clk_hw *hw) + return; + + tmp &= ~(AT91_PMC_KEY | AT91_PMC_MOSCEN); +- pmc_write(pmc, AT91_CKGR_MOR, tmp | AT91_PMC_KEY); ++ regmap_write(regmap, AT91_CKGR_MOR, tmp | AT91_PMC_KEY); + } + + static int clk_main_osc_is_prepared(struct clk_hw *hw) + { + struct clk_main_osc *osc = to_clk_main_osc(hw); +- struct at91_pmc *pmc = osc->pmc; +- u32 tmp = pmc_read(pmc, AT91_CKGR_MOR); ++ struct regmap *regmap = osc->regmap; ++ u32 tmp, status; + ++ regmap_read(regmap, AT91_CKGR_MOR, &tmp); + if (tmp & AT91_PMC_OSCBYPASS) + return 1; + +- return !!((pmc_read(pmc, AT91_PMC_SR) & AT91_PMC_MOSCS) && +- (pmc_read(pmc, AT91_CKGR_MOR) & AT91_PMC_MOSCEN)); ++ regmap_read(regmap, AT91_PMC_SR, &status); ++ ++ return (status & AT91_PMC_MOSCS) && (tmp & AT91_PMC_MOSCEN); + } + + static const struct clk_ops main_osc_ops = { +@@ -139,18 +129,16 @@ static const struct clk_ops main_osc_ops = { + }; + + static struct clk * __init +-at91_clk_register_main_osc(struct at91_pmc *pmc, +- unsigned int irq, ++at91_clk_register_main_osc(struct regmap *regmap, + const char *name, + const char *parent_name, + bool bypass) + { +- int ret; + struct clk_main_osc *osc; + struct clk *clk = NULL; + struct clk_init_data init; + +- if (!pmc || !irq || !name || !parent_name) ++ if (!name || !parent_name) + return ERR_PTR(-EINVAL); + + osc = kzalloc(sizeof(*osc), GFP_KERNEL); +@@ -164,85 +152,70 @@ at91_clk_register_main_osc(struct at91_pmc *pmc, + init.flags = CLK_IGNORE_UNUSED; + + osc->hw.init = &init; +- osc->pmc = pmc; +- osc->irq = irq; +- +- init_waitqueue_head(&osc->wait); +- irq_set_status_flags(osc->irq, IRQ_NOAUTOEN); +- ret = request_irq(osc->irq, clk_main_osc_irq_handler, +- IRQF_TRIGGER_HIGH, name, osc); +- if (ret) { +- kfree(osc); +- return ERR_PTR(ret); +- } ++ osc->regmap = regmap; + + if (bypass) +- pmc_write(pmc, AT91_CKGR_MOR, +- (pmc_read(pmc, AT91_CKGR_MOR) & +- ~(MOR_KEY_MASK | AT91_PMC_MOSCEN)) | +- AT91_PMC_OSCBYPASS | AT91_PMC_KEY); ++ regmap_update_bits(regmap, ++ AT91_CKGR_MOR, MOR_KEY_MASK | ++ AT91_PMC_MOSCEN, ++ AT91_PMC_OSCBYPASS | AT91_PMC_KEY); + + clk = clk_register(NULL, &osc->hw); +- if (IS_ERR(clk)) { +- free_irq(irq, osc); ++ if (IS_ERR(clk)) + kfree(osc); +- } + + return clk; + } + +-void __init of_at91rm9200_clk_main_osc_setup(struct device_node *np, +- struct at91_pmc *pmc) ++static void __init of_at91rm9200_clk_main_osc_setup(struct device_node *np) + { + struct clk *clk; +- unsigned int irq; + const char *name = np->name; + const char *parent_name; ++ struct regmap *regmap; + bool bypass; + + of_property_read_string(np, "clock-output-names", &name); + bypass = of_property_read_bool(np, "atmel,osc-bypass"); + parent_name = of_clk_get_parent_name(np, 0); + +- irq = irq_of_parse_and_map(np, 0); +- if (!irq) ++ regmap = syscon_node_to_regmap(of_get_parent(np)); ++ if (IS_ERR(regmap)) + return; + +- clk = at91_clk_register_main_osc(pmc, irq, name, parent_name, bypass); ++ clk = at91_clk_register_main_osc(regmap, name, parent_name, bypass); + if (IS_ERR(clk)) + return; + + of_clk_add_provider(np, of_clk_src_simple_get, clk); + } ++CLK_OF_DECLARE(at91rm9200_clk_main_osc, "atmel,at91rm9200-clk-main-osc", ++ of_at91rm9200_clk_main_osc_setup); + +-static irqreturn_t clk_main_rc_osc_irq_handler(int irq, void *dev_id) ++static bool clk_main_rc_osc_ready(struct regmap *regmap) + { +- struct clk_main_rc_osc *osc = dev_id; ++ unsigned int status; + +- wake_up(&osc->wait); +- disable_irq_nosync(osc->irq); ++ regmap_read(regmap, AT91_PMC_SR, &status); + +- return IRQ_HANDLED; ++ return status & AT91_PMC_MOSCRCS; + } + + static int clk_main_rc_osc_prepare(struct clk_hw *hw) + { + struct clk_main_rc_osc *osc = to_clk_main_rc_osc(hw); +- struct at91_pmc *pmc = osc->pmc; +- u32 tmp; ++ struct regmap *regmap = osc->regmap; ++ unsigned int mor; + +- tmp = pmc_read(pmc, AT91_CKGR_MOR) & ~MOR_KEY_MASK; ++ regmap_read(regmap, AT91_CKGR_MOR, &mor); + +- if (!(tmp & AT91_PMC_MOSCRCEN)) { +- tmp |= AT91_PMC_MOSCRCEN | AT91_PMC_KEY; +- pmc_write(pmc, AT91_CKGR_MOR, tmp); +- } ++ if (!(mor & AT91_PMC_MOSCRCEN)) ++ regmap_update_bits(regmap, AT91_CKGR_MOR, ++ MOR_KEY_MASK | AT91_PMC_MOSCRCEN, ++ AT91_PMC_MOSCRCEN | AT91_PMC_KEY); + +- while (!(pmc_read(pmc, AT91_PMC_SR) & AT91_PMC_MOSCRCS)) { +- enable_irq(osc->irq); +- wait_event(osc->wait, +- pmc_read(pmc, AT91_PMC_SR) & AT91_PMC_MOSCRCS); +- } ++ while (!clk_main_rc_osc_ready(regmap)) ++ cpu_relax(); + + return 0; + } +@@ -250,23 +223,28 @@ static int clk_main_rc_osc_prepare(struct clk_hw *hw) + static void clk_main_rc_osc_unprepare(struct clk_hw *hw) + { + struct clk_main_rc_osc *osc = to_clk_main_rc_osc(hw); +- struct at91_pmc *pmc = osc->pmc; +- u32 tmp = pmc_read(pmc, AT91_CKGR_MOR); ++ struct regmap *regmap = osc->regmap; ++ unsigned int mor; ++ ++ regmap_read(regmap, AT91_CKGR_MOR, &mor); + +- if (!(tmp & AT91_PMC_MOSCRCEN)) ++ if (!(mor & AT91_PMC_MOSCRCEN)) + return; + +- tmp &= ~(MOR_KEY_MASK | AT91_PMC_MOSCRCEN); +- pmc_write(pmc, AT91_CKGR_MOR, tmp | AT91_PMC_KEY); ++ regmap_update_bits(regmap, AT91_CKGR_MOR, ++ MOR_KEY_MASK | AT91_PMC_MOSCRCEN, AT91_PMC_KEY); + } + + static int clk_main_rc_osc_is_prepared(struct clk_hw *hw) + { + struct clk_main_rc_osc *osc = to_clk_main_rc_osc(hw); +- struct at91_pmc *pmc = osc->pmc; ++ struct regmap *regmap = osc->regmap; ++ unsigned int mor, status; + +- return !!((pmc_read(pmc, AT91_PMC_SR) & AT91_PMC_MOSCRCS) && +- (pmc_read(pmc, AT91_CKGR_MOR) & AT91_PMC_MOSCRCEN)); ++ regmap_read(regmap, AT91_CKGR_MOR, &mor); ++ regmap_read(regmap, AT91_PMC_SR, &status); ++ ++ return (mor & AT91_PMC_MOSCRCEN) && (status & AT91_PMC_MOSCRCS); + } + + static unsigned long clk_main_rc_osc_recalc_rate(struct clk_hw *hw, +@@ -294,17 +272,15 @@ static const struct clk_ops main_rc_osc_ops = { + }; + + static struct clk * __init +-at91_clk_register_main_rc_osc(struct at91_pmc *pmc, +- unsigned int irq, ++at91_clk_register_main_rc_osc(struct regmap *regmap, + const char *name, + u32 frequency, u32 accuracy) + { +- int ret; + struct clk_main_rc_osc *osc; + struct clk *clk = NULL; + struct clk_init_data init; + +- if (!pmc || !irq || !name || !frequency) ++ if (!name || !frequency) + return ERR_PTR(-EINVAL); + + osc = kzalloc(sizeof(*osc), GFP_KERNEL); +@@ -318,63 +294,53 @@ at91_clk_register_main_rc_osc(struct at91_pmc *pmc, + init.flags = CLK_IS_ROOT | CLK_IGNORE_UNUSED; + + osc->hw.init = &init; +- osc->pmc = pmc; +- osc->irq = irq; ++ osc->regmap = regmap; + osc->frequency = frequency; + osc->accuracy = accuracy; + +- init_waitqueue_head(&osc->wait); +- irq_set_status_flags(osc->irq, IRQ_NOAUTOEN); +- ret = request_irq(osc->irq, clk_main_rc_osc_irq_handler, +- IRQF_TRIGGER_HIGH, name, osc); +- if (ret) +- return ERR_PTR(ret); +- + clk = clk_register(NULL, &osc->hw); +- if (IS_ERR(clk)) { +- free_irq(irq, osc); ++ if (IS_ERR(clk)) + kfree(osc); +- } + + return clk; + } + +-void __init of_at91sam9x5_clk_main_rc_osc_setup(struct device_node *np, +- struct at91_pmc *pmc) ++static void __init of_at91sam9x5_clk_main_rc_osc_setup(struct device_node *np) + { + struct clk *clk; +- unsigned int irq; + u32 frequency = 0; + u32 accuracy = 0; + const char *name = np->name; ++ struct regmap *regmap; + + of_property_read_string(np, "clock-output-names", &name); + of_property_read_u32(np, "clock-frequency", &frequency); + of_property_read_u32(np, "clock-accuracy", &accuracy); + +- irq = irq_of_parse_and_map(np, 0); +- if (!irq) ++ regmap = syscon_node_to_regmap(of_get_parent(np)); ++ if (IS_ERR(regmap)) + return; + +- clk = at91_clk_register_main_rc_osc(pmc, irq, name, frequency, +- accuracy); ++ clk = at91_clk_register_main_rc_osc(regmap, name, frequency, accuracy); + if (IS_ERR(clk)) + return; + + of_clk_add_provider(np, of_clk_src_simple_get, clk); + } ++CLK_OF_DECLARE(at91sam9x5_clk_main_rc_osc, "atmel,at91sam9x5-clk-main-rc-osc", ++ of_at91sam9x5_clk_main_rc_osc_setup); + + +-static int clk_main_probe_frequency(struct at91_pmc *pmc) ++static int clk_main_probe_frequency(struct regmap *regmap) + { + unsigned long prep_time, timeout; +- u32 tmp; ++ unsigned int mcfr; + + timeout = jiffies + usecs_to_jiffies(MAINFRDY_TIMEOUT); + do { + prep_time = jiffies; +- tmp = pmc_read(pmc, AT91_CKGR_MCFR); +- if (tmp & AT91_PMC_MAINRDY) ++ regmap_read(regmap, AT91_CKGR_MCFR, &mcfr); ++ if (mcfr & AT91_PMC_MAINRDY) + return 0; + usleep_range(MAINF_LOOP_MIN_WAIT, MAINF_LOOP_MAX_WAIT); + } while (time_before(prep_time, timeout)); +@@ -382,34 +348,37 @@ static int clk_main_probe_frequency(struct at91_pmc *pmc) + return -ETIMEDOUT; + } + +-static unsigned long clk_main_recalc_rate(struct at91_pmc *pmc, ++static unsigned long clk_main_recalc_rate(struct regmap *regmap, + unsigned long parent_rate) + { +- u32 tmp; ++ unsigned int mcfr; + + if (parent_rate) + return parent_rate; + + pr_warn("Main crystal frequency not set, using approximate value\n"); +- tmp = pmc_read(pmc, AT91_CKGR_MCFR); +- if (!(tmp & AT91_PMC_MAINRDY)) ++ regmap_read(regmap, AT91_CKGR_MCFR, &mcfr); ++ if (!(mcfr & AT91_PMC_MAINRDY)) + return 0; + +- return ((tmp & AT91_PMC_MAINF) * SLOW_CLOCK_FREQ) / MAINF_DIV; ++ return ((mcfr & AT91_PMC_MAINF) * SLOW_CLOCK_FREQ) / MAINF_DIV; + } + + static int clk_rm9200_main_prepare(struct clk_hw *hw) + { + struct clk_rm9200_main *clkmain = to_clk_rm9200_main(hw); + +- return clk_main_probe_frequency(clkmain->pmc); ++ return clk_main_probe_frequency(clkmain->regmap); + } + + static int clk_rm9200_main_is_prepared(struct clk_hw *hw) + { + struct clk_rm9200_main *clkmain = to_clk_rm9200_main(hw); ++ unsigned int status; ++ ++ regmap_read(clkmain->regmap, AT91_CKGR_MCFR, &status); + +- return !!(pmc_read(clkmain->pmc, AT91_CKGR_MCFR) & AT91_PMC_MAINRDY); ++ return status & AT91_PMC_MAINRDY ? 1 : 0; + } + + static unsigned long clk_rm9200_main_recalc_rate(struct clk_hw *hw, +@@ -417,7 +386,7 @@ static unsigned long clk_rm9200_main_recalc_rate(struct clk_hw *hw, + { + struct clk_rm9200_main *clkmain = to_clk_rm9200_main(hw); + +- return clk_main_recalc_rate(clkmain->pmc, parent_rate); ++ return clk_main_recalc_rate(clkmain->regmap, parent_rate); + } + + static const struct clk_ops rm9200_main_ops = { +@@ -427,7 +396,7 @@ static const struct clk_ops rm9200_main_ops = { + }; + + static struct clk * __init +-at91_clk_register_rm9200_main(struct at91_pmc *pmc, ++at91_clk_register_rm9200_main(struct regmap *regmap, + const char *name, + const char *parent_name) + { +@@ -435,7 +404,7 @@ at91_clk_register_rm9200_main(struct at91_pmc *pmc, + struct clk *clk = NULL; + struct clk_init_data init; + +- if (!pmc || !name) ++ if (!name) + return ERR_PTR(-EINVAL); + + if (!parent_name) +@@ -452,7 +421,7 @@ at91_clk_register_rm9200_main(struct at91_pmc *pmc, + init.flags = 0; + + clkmain->hw.init = &init; +- clkmain->pmc = pmc; ++ clkmain->regmap = regmap; + + clk = clk_register(NULL, &clkmain->hw); + if (IS_ERR(clk)) +@@ -461,52 +430,54 @@ at91_clk_register_rm9200_main(struct at91_pmc *pmc, + return clk; + } + +-void __init of_at91rm9200_clk_main_setup(struct device_node *np, +- struct at91_pmc *pmc) ++static void __init of_at91rm9200_clk_main_setup(struct device_node *np) + { + struct clk *clk; + const char *parent_name; + const char *name = np->name; ++ struct regmap *regmap; + + parent_name = of_clk_get_parent_name(np, 0); + of_property_read_string(np, "clock-output-names", &name); + +- clk = at91_clk_register_rm9200_main(pmc, name, parent_name); ++ regmap = syscon_node_to_regmap(of_get_parent(np)); ++ if (IS_ERR(regmap)) ++ return; ++ ++ clk = at91_clk_register_rm9200_main(regmap, name, parent_name); + if (IS_ERR(clk)) + return; + + of_clk_add_provider(np, of_clk_src_simple_get, clk); + } ++CLK_OF_DECLARE(at91rm9200_clk_main, "atmel,at91rm9200-clk-main", ++ of_at91rm9200_clk_main_setup); + +-static irqreturn_t clk_sam9x5_main_irq_handler(int irq, void *dev_id) ++static inline bool clk_sam9x5_main_ready(struct regmap *regmap) + { +- struct clk_sam9x5_main *clkmain = dev_id; ++ unsigned int status; + +- wake_up(&clkmain->wait); +- disable_irq_nosync(clkmain->irq); ++ regmap_read(regmap, AT91_PMC_SR, &status); + +- return IRQ_HANDLED; ++ return status & AT91_PMC_MOSCSELS ? 1 : 0; + } + + static int clk_sam9x5_main_prepare(struct clk_hw *hw) + { + struct clk_sam9x5_main *clkmain = to_clk_sam9x5_main(hw); +- struct at91_pmc *pmc = clkmain->pmc; ++ struct regmap *regmap = clkmain->regmap; + +- while (!(pmc_read(pmc, AT91_PMC_SR) & AT91_PMC_MOSCSELS)) { +- enable_irq(clkmain->irq); +- wait_event(clkmain->wait, +- pmc_read(pmc, AT91_PMC_SR) & AT91_PMC_MOSCSELS); +- } ++ while (!clk_sam9x5_main_ready(regmap)) ++ cpu_relax(); + +- return clk_main_probe_frequency(pmc); ++ return clk_main_probe_frequency(regmap); + } + + static int clk_sam9x5_main_is_prepared(struct clk_hw *hw) + { + struct clk_sam9x5_main *clkmain = to_clk_sam9x5_main(hw); + +- return !!(pmc_read(clkmain->pmc, AT91_PMC_SR) & AT91_PMC_MOSCSELS); ++ return clk_sam9x5_main_ready(clkmain->regmap); + } + + static unsigned long clk_sam9x5_main_recalc_rate(struct clk_hw *hw, +@@ -514,30 +485,28 @@ static unsigned long clk_sam9x5_main_recalc_rate(struct clk_hw *hw, + { + struct clk_sam9x5_main *clkmain = to_clk_sam9x5_main(hw); + +- return clk_main_recalc_rate(clkmain->pmc, parent_rate); ++ return clk_main_recalc_rate(clkmain->regmap, parent_rate); + } + + static int clk_sam9x5_main_set_parent(struct clk_hw *hw, u8 index) + { + struct clk_sam9x5_main *clkmain = to_clk_sam9x5_main(hw); +- struct at91_pmc *pmc = clkmain->pmc; +- u32 tmp; ++ struct regmap *regmap = clkmain->regmap; ++ unsigned int tmp; + + if (index > 1) + return -EINVAL; + +- tmp = pmc_read(pmc, AT91_CKGR_MOR) & ~MOR_KEY_MASK; ++ regmap_read(regmap, AT91_CKGR_MOR, &tmp); ++ tmp &= ~MOR_KEY_MASK; + + if (index && !(tmp & AT91_PMC_MOSCSEL)) +- pmc_write(pmc, AT91_CKGR_MOR, tmp | AT91_PMC_MOSCSEL); ++ regmap_write(regmap, AT91_CKGR_MOR, tmp | AT91_PMC_MOSCSEL); + else if (!index && (tmp & AT91_PMC_MOSCSEL)) +- pmc_write(pmc, AT91_CKGR_MOR, tmp & ~AT91_PMC_MOSCSEL); ++ regmap_write(regmap, AT91_CKGR_MOR, tmp & ~AT91_PMC_MOSCSEL); + +- while (!(pmc_read(pmc, AT91_PMC_SR) & AT91_PMC_MOSCSELS)) { +- enable_irq(clkmain->irq); +- wait_event(clkmain->wait, +- pmc_read(pmc, AT91_PMC_SR) & AT91_PMC_MOSCSELS); +- } ++ while (!clk_sam9x5_main_ready(regmap)) ++ cpu_relax(); + + return 0; + } +@@ -545,8 +514,11 @@ static int clk_sam9x5_main_set_parent(struct clk_hw *hw, u8 index) + static u8 clk_sam9x5_main_get_parent(struct clk_hw *hw) + { + struct clk_sam9x5_main *clkmain = to_clk_sam9x5_main(hw); ++ unsigned int status; ++ ++ regmap_read(clkmain->regmap, AT91_CKGR_MOR, &status); + +- return !!(pmc_read(clkmain->pmc, AT91_CKGR_MOR) & AT91_PMC_MOSCEN); ++ return status & AT91_PMC_MOSCEN ? 1 : 0; + } + + static const struct clk_ops sam9x5_main_ops = { +@@ -558,18 +530,17 @@ static const struct clk_ops sam9x5_main_ops = { + }; + + static struct clk * __init +-at91_clk_register_sam9x5_main(struct at91_pmc *pmc, +- unsigned int irq, ++at91_clk_register_sam9x5_main(struct regmap *regmap, + const char *name, + const char **parent_names, + int num_parents) + { +- int ret; + struct clk_sam9x5_main *clkmain; + struct clk *clk = NULL; + struct clk_init_data init; ++ unsigned int status; + +- if (!pmc || !irq || !name) ++ if (!name) + return ERR_PTR(-EINVAL); + + if (!parent_names || !num_parents) +@@ -586,51 +557,42 @@ at91_clk_register_sam9x5_main(struct at91_pmc *pmc, + init.flags = CLK_SET_PARENT_GATE; + + clkmain->hw.init = &init; +- clkmain->pmc = pmc; +- clkmain->irq = irq; +- clkmain->parent = !!(pmc_read(clkmain->pmc, AT91_CKGR_MOR) & +- AT91_PMC_MOSCEN); +- init_waitqueue_head(&clkmain->wait); +- irq_set_status_flags(clkmain->irq, IRQ_NOAUTOEN); +- ret = request_irq(clkmain->irq, clk_sam9x5_main_irq_handler, +- IRQF_TRIGGER_HIGH, name, clkmain); +- if (ret) +- return ERR_PTR(ret); ++ clkmain->regmap = regmap; ++ regmap_read(clkmain->regmap, AT91_CKGR_MOR, &status); ++ clkmain->parent = status & AT91_PMC_MOSCEN ? 1 : 0; + + clk = clk_register(NULL, &clkmain->hw); +- if (IS_ERR(clk)) { +- free_irq(clkmain->irq, clkmain); ++ if (IS_ERR(clk)) + kfree(clkmain); +- } + + return clk; + } + +-void __init of_at91sam9x5_clk_main_setup(struct device_node *np, +- struct at91_pmc *pmc) ++static void __init of_at91sam9x5_clk_main_setup(struct device_node *np) + { + struct clk *clk; + const char *parent_names[2]; + int num_parents; +- unsigned int irq; + const char *name = np->name; ++ struct regmap *regmap; + + num_parents = of_clk_get_parent_count(np); + if (num_parents <= 0 || num_parents > 2) + return; + + of_clk_parent_fill(np, parent_names, num_parents); ++ regmap = syscon_node_to_regmap(of_get_parent(np)); ++ if (IS_ERR(regmap)) ++ return; + + of_property_read_string(np, "clock-output-names", &name); + +- irq = irq_of_parse_and_map(np, 0); +- if (!irq) +- return; +- +- clk = at91_clk_register_sam9x5_main(pmc, irq, name, parent_names, ++ clk = at91_clk_register_sam9x5_main(regmap, name, parent_names, + num_parents); + if (IS_ERR(clk)) + return; + + of_clk_add_provider(np, of_clk_src_simple_get, clk); + } ++CLK_OF_DECLARE(at91sam9x5_clk_main, "atmel,at91sam9x5-clk-main", ++ of_at91sam9x5_clk_main_setup); +diff --git a/drivers/clk/at91/clk-master.c b/drivers/clk/at91/clk-master.c +index 620ea32..7d4a186 100644 +--- a/drivers/clk/at91/clk-master.c ++++ b/drivers/clk/at91/clk-master.c +@@ -12,13 +12,8 @@ + #include <linux/clkdev.h> + #include <linux/clk/at91_pmc.h> + #include <linux/of.h> +-#include <linux/of_address.h> +-#include <linux/of_irq.h> +-#include <linux/io.h> +-#include <linux/wait.h> +-#include <linux/sched.h> +-#include <linux/interrupt.h> +-#include <linux/irq.h> ++#include <linux/mfd/syscon.h> ++#include <linux/regmap.h> + + #include "pmc.h" + +@@ -44,32 +39,26 @@ struct clk_master_layout { + + struct clk_master { + struct clk_hw hw; +- struct at91_pmc *pmc; +- unsigned int irq; +- wait_queue_head_t wait; ++ struct regmap *regmap; + const struct clk_master_layout *layout; + const struct clk_master_characteristics *characteristics; + }; + +-static irqreturn_t clk_master_irq_handler(int irq, void *dev_id) ++static inline bool clk_master_ready(struct regmap *regmap) + { +- struct clk_master *master = (struct clk_master *)dev_id; ++ unsigned int status; + +- wake_up(&master->wait); +- disable_irq_nosync(master->irq); ++ regmap_read(regmap, AT91_PMC_SR, &status); + +- return IRQ_HANDLED; ++ return status & AT91_PMC_MCKRDY ? 1 : 0; + } ++ + static int clk_master_prepare(struct clk_hw *hw) + { + struct clk_master *master = to_clk_master(hw); +- struct at91_pmc *pmc = master->pmc; + +- while (!(pmc_read(pmc, AT91_PMC_SR) & AT91_PMC_MCKRDY)) { +- enable_irq(master->irq); +- wait_event(master->wait, +- pmc_read(pmc, AT91_PMC_SR) & AT91_PMC_MCKRDY); +- } ++ while (!clk_master_ready(master->regmap)) ++ cpu_relax(); + + return 0; + } +@@ -78,7 +67,7 @@ static int clk_master_is_prepared(struct clk_hw *hw) + { + struct clk_master *master = to_clk_master(hw); + +- return !!(pmc_read(master->pmc, AT91_PMC_SR) & AT91_PMC_MCKRDY); ++ return clk_master_ready(master->regmap); + } + + static unsigned long clk_master_recalc_rate(struct clk_hw *hw, +@@ -88,18 +77,16 @@ static unsigned long clk_master_recalc_rate(struct clk_hw *hw, + u8 div; + unsigned long rate = parent_rate; + struct clk_master *master = to_clk_master(hw); +- struct at91_pmc *pmc = master->pmc; + const struct clk_master_layout *layout = master->layout; + const struct clk_master_characteristics *characteristics = + master->characteristics; +- u32 tmp; ++ unsigned int mckr; + +- pmc_lock(pmc); +- tmp = pmc_read(pmc, AT91_PMC_MCKR) & layout->mask; +- pmc_unlock(pmc); ++ regmap_read(master->regmap, AT91_PMC_MCKR, &mckr); ++ mckr &= layout->mask; + +- pres = (tmp >> layout->pres_shift) & MASTER_PRES_MASK; +- div = (tmp >> MASTER_DIV_SHIFT) & MASTER_DIV_MASK; ++ pres = (mckr >> layout->pres_shift) & MASTER_PRES_MASK; ++ div = (mckr >> MASTER_DIV_SHIFT) & MASTER_DIV_MASK; + + if (characteristics->have_div3_pres && pres == MASTER_PRES_MAX) + rate /= 3; +@@ -119,9 +106,11 @@ static unsigned long clk_master_recalc_rate(struct clk_hw *hw, + static u8 clk_master_get_parent(struct clk_hw *hw) + { + struct clk_master *master = to_clk_master(hw); +- struct at91_pmc *pmc = master->pmc; ++ unsigned int mckr; + +- return pmc_read(pmc, AT91_PMC_MCKR) & AT91_PMC_CSS; ++ regmap_read(master->regmap, AT91_PMC_MCKR, &mckr); ++ ++ return mckr & AT91_PMC_CSS; + } + + static const struct clk_ops master_ops = { +@@ -132,18 +121,17 @@ static const struct clk_ops master_ops = { + }; + + static struct clk * __init +-at91_clk_register_master(struct at91_pmc *pmc, unsigned int irq, ++at91_clk_register_master(struct regmap *regmap, + const char *name, int num_parents, + const char **parent_names, + const struct clk_master_layout *layout, + const struct clk_master_characteristics *characteristics) + { +- int ret; + struct clk_master *master; + struct clk *clk = NULL; + struct clk_init_data init; + +- if (!pmc || !irq || !name || !num_parents || !parent_names) ++ if (!name || !num_parents || !parent_names) + return ERR_PTR(-EINVAL); + + master = kzalloc(sizeof(*master), GFP_KERNEL); +@@ -159,20 +147,10 @@ at91_clk_register_master(struct at91_pmc *pmc, unsigned int irq, + master->hw.init = &init; + master->layout = layout; + master->characteristics = characteristics; +- master->pmc = pmc; +- master->irq = irq; +- init_waitqueue_head(&master->wait); +- irq_set_status_flags(master->irq, IRQ_NOAUTOEN); +- ret = request_irq(master->irq, clk_master_irq_handler, +- IRQF_TRIGGER_HIGH, "clk-master", master); +- if (ret) { +- kfree(master); +- return ERR_PTR(ret); +- } ++ master->regmap = regmap; + + clk = clk_register(NULL, &master->hw); + if (IS_ERR(clk)) { +- free_irq(master->irq, master); + kfree(master); + } + +@@ -217,15 +195,15 @@ of_at91_clk_master_get_characteristics(struct device_node *np) + } + + static void __init +-of_at91_clk_master_setup(struct device_node *np, struct at91_pmc *pmc, ++of_at91_clk_master_setup(struct device_node *np, + const struct clk_master_layout *layout) + { + struct clk *clk; + int num_parents; +- unsigned int irq; + const char *parent_names[MASTER_SOURCE_MAX]; + const char *name = np->name; + struct clk_master_characteristics *characteristics; ++ struct regmap *regmap; + + num_parents = of_clk_get_parent_count(np); + if (num_parents <= 0 || num_parents > MASTER_SOURCE_MAX) +@@ -239,11 +217,11 @@ of_at91_clk_master_setup(struct device_node *np, struct at91_pmc *pmc, + if (!characteristics) + return; + +- irq = irq_of_parse_and_map(np, 0); +- if (!irq) +- goto out_free_characteristics; ++ regmap = syscon_node_to_regmap(of_get_parent(np)); ++ if (IS_ERR(regmap)) ++ return; + +- clk = at91_clk_register_master(pmc, irq, name, num_parents, ++ clk = at91_clk_register_master(regmap, name, num_parents, + parent_names, layout, + characteristics); + if (IS_ERR(clk)) +@@ -256,14 +234,16 @@ of_at91_clk_master_setup(struct device_node *np, struct at91_pmc *pmc, + kfree(characteristics); + } + +-void __init of_at91rm9200_clk_master_setup(struct device_node *np, +- struct at91_pmc *pmc) ++static void __init of_at91rm9200_clk_master_setup(struct device_node *np) + { +- of_at91_clk_master_setup(np, pmc, &at91rm9200_master_layout); ++ of_at91_clk_master_setup(np, &at91rm9200_master_layout); + } ++CLK_OF_DECLARE(at91rm9200_clk_master, "atmel,at91rm9200-clk-master", ++ of_at91rm9200_clk_master_setup); + +-void __init of_at91sam9x5_clk_master_setup(struct device_node *np, +- struct at91_pmc *pmc) ++static void __init of_at91sam9x5_clk_master_setup(struct device_node *np) + { +- of_at91_clk_master_setup(np, pmc, &at91sam9x5_master_layout); ++ of_at91_clk_master_setup(np, &at91sam9x5_master_layout); + } ++CLK_OF_DECLARE(at91sam9x5_clk_master, "atmel,at91sam9x5-clk-master", ++ of_at91sam9x5_clk_master_setup); +diff --git a/drivers/clk/at91/clk-peripheral.c b/drivers/clk/at91/clk-peripheral.c +index 58f3b56..d69cd2a 100644 +--- a/drivers/clk/at91/clk-peripheral.c ++++ b/drivers/clk/at91/clk-peripheral.c +@@ -12,11 +12,13 @@ + #include <linux/clkdev.h> + #include <linux/clk/at91_pmc.h> + #include <linux/of.h> +-#include <linux/of_address.h> +-#include <linux/io.h> ++#include <linux/mfd/syscon.h> ++#include <linux/regmap.h> + + #include "pmc.h" + ++DEFINE_SPINLOCK(pmc_pcr_lock); ++ + #define PERIPHERAL_MAX 64 + + #define PERIPHERAL_AT91RM9200 0 +@@ -33,7 +35,7 @@ + + struct clk_peripheral { + struct clk_hw hw; +- struct at91_pmc *pmc; ++ struct regmap *regmap; + u32 id; + }; + +@@ -41,8 +43,9 @@ struct clk_peripheral { + + struct clk_sam9x5_peripheral { + struct clk_hw hw; +- struct at91_pmc *pmc; ++ struct regmap *regmap; + struct clk_range range; ++ spinlock_t *lock; + u32 id; + u32 div; + bool auto_div; +@@ -54,7 +57,6 @@ struct clk_sam9x5_peripheral { + static int clk_peripheral_enable(struct clk_hw *hw) + { + struct clk_peripheral *periph = to_clk_peripheral(hw); +- struct at91_pmc *pmc = periph->pmc; + int offset = AT91_PMC_PCER; + u32 id = periph->id; + +@@ -62,14 +64,14 @@ static int clk_peripheral_enable(struct clk_hw *hw) + return 0; + if (id > PERIPHERAL_ID_MAX) + offset = AT91_PMC_PCER1; +- pmc_write(pmc, offset, PERIPHERAL_MASK(id)); ++ regmap_write(periph->regmap, offset, PERIPHERAL_MASK(id)); ++ + return 0; + } + + static void clk_peripheral_disable(struct clk_hw *hw) + { + struct clk_peripheral *periph = to_clk_peripheral(hw); +- struct at91_pmc *pmc = periph->pmc; + int offset = AT91_PMC_PCDR; + u32 id = periph->id; + +@@ -77,21 +79,23 @@ static void clk_peripheral_disable(struct clk_hw *hw) + return; + if (id > PERIPHERAL_ID_MAX) + offset = AT91_PMC_PCDR1; +- pmc_write(pmc, offset, PERIPHERAL_MASK(id)); ++ regmap_write(periph->regmap, offset, PERIPHERAL_MASK(id)); + } + + static int clk_peripheral_is_enabled(struct clk_hw *hw) + { + struct clk_peripheral *periph = to_clk_peripheral(hw); +- struct at91_pmc *pmc = periph->pmc; + int offset = AT91_PMC_PCSR; ++ unsigned int status; + u32 id = periph->id; + + if (id < PERIPHERAL_ID_MIN) + return 1; + if (id > PERIPHERAL_ID_MAX) + offset = AT91_PMC_PCSR1; +- return !!(pmc_read(pmc, offset) & PERIPHERAL_MASK(id)); ++ regmap_read(periph->regmap, offset, &status); ++ ++ return status & PERIPHERAL_MASK(id) ? 1 : 0; + } + + static const struct clk_ops peripheral_ops = { +@@ -101,14 +105,14 @@ static const struct clk_ops peripheral_ops = { + }; + + static struct clk * __init +-at91_clk_register_peripheral(struct at91_pmc *pmc, const char *name, ++at91_clk_register_peripheral(struct regmap *regmap, const char *name, + const char *parent_name, u32 id) + { + struct clk_peripheral *periph; + struct clk *clk = NULL; + struct clk_init_data init; + +- if (!pmc || !name || !parent_name || id > PERIPHERAL_ID_MAX) ++ if (!name || !parent_name || id > PERIPHERAL_ID_MAX) + return ERR_PTR(-EINVAL); + + periph = kzalloc(sizeof(*periph), GFP_KERNEL); +@@ -123,7 +127,7 @@ at91_clk_register_peripheral(struct at91_pmc *pmc, const char *name, + + periph->id = id; + periph->hw.init = &init; +- periph->pmc = pmc; ++ periph->regmap = regmap; + + clk = clk_register(NULL, &periph->hw); + if (IS_ERR(clk)) +@@ -160,53 +164,58 @@ static void clk_sam9x5_peripheral_autodiv(struct clk_sam9x5_peripheral *periph) + static int clk_sam9x5_peripheral_enable(struct clk_hw *hw) + { + struct clk_sam9x5_peripheral *periph = to_clk_sam9x5_peripheral(hw); +- struct at91_pmc *pmc = periph->pmc; +- u32 tmp; ++ unsigned long flags; + + if (periph->id < PERIPHERAL_ID_MIN) + return 0; + +- pmc_lock(pmc); +- pmc_write(pmc, AT91_PMC_PCR, (periph->id & AT91_PMC_PCR_PID_MASK)); +- tmp = pmc_read(pmc, AT91_PMC_PCR) & ~AT91_PMC_PCR_DIV_MASK; +- pmc_write(pmc, AT91_PMC_PCR, tmp | AT91_PMC_PCR_DIV(periph->div) +- | AT91_PMC_PCR_CMD +- | AT91_PMC_PCR_EN); +- pmc_unlock(pmc); ++ spin_lock_irqsave(periph->lock, flags); ++ regmap_write(periph->regmap, AT91_PMC_PCR, ++ (periph->id & AT91_PMC_PCR_PID_MASK)); ++ regmap_update_bits(periph->regmap, AT91_PMC_PCR, ++ AT91_PMC_PCR_DIV_MASK | AT91_PMC_PCR_CMD | ++ AT91_PMC_PCR_EN, ++ AT91_PMC_PCR_DIV(periph->div) | ++ AT91_PMC_PCR_CMD | ++ AT91_PMC_PCR_EN); ++ spin_unlock_irqrestore(periph->lock, flags); ++ + return 0; + } + + static void clk_sam9x5_peripheral_disable(struct clk_hw *hw) + { + struct clk_sam9x5_peripheral *periph = to_clk_sam9x5_peripheral(hw); +- struct at91_pmc *pmc = periph->pmc; +- u32 tmp; ++ unsigned long flags; + + if (periph->id < PERIPHERAL_ID_MIN) + return; + +- pmc_lock(pmc); +- pmc_write(pmc, AT91_PMC_PCR, (periph->id & AT91_PMC_PCR_PID_MASK)); +- tmp = pmc_read(pmc, AT91_PMC_PCR) & ~AT91_PMC_PCR_EN; +- pmc_write(pmc, AT91_PMC_PCR, tmp | AT91_PMC_PCR_CMD); +- pmc_unlock(pmc); ++ spin_lock_irqsave(periph->lock, flags); ++ regmap_write(periph->regmap, AT91_PMC_PCR, ++ (periph->id & AT91_PMC_PCR_PID_MASK)); ++ regmap_update_bits(periph->regmap, AT91_PMC_PCR, ++ AT91_PMC_PCR_EN | AT91_PMC_PCR_CMD, ++ AT91_PMC_PCR_CMD); ++ spin_unlock_irqrestore(periph->lock, flags); + } + + static int clk_sam9x5_peripheral_is_enabled(struct clk_hw *hw) + { + struct clk_sam9x5_peripheral *periph = to_clk_sam9x5_peripheral(hw); +- struct at91_pmc *pmc = periph->pmc; +- int ret; ++ unsigned long flags; ++ unsigned int status; + + if (periph->id < PERIPHERAL_ID_MIN) + return 1; + +- pmc_lock(pmc); +- pmc_write(pmc, AT91_PMC_PCR, (periph->id & AT91_PMC_PCR_PID_MASK)); +- ret = !!(pmc_read(pmc, AT91_PMC_PCR) & AT91_PMC_PCR_EN); +- pmc_unlock(pmc); ++ spin_lock_irqsave(periph->lock, flags); ++ regmap_write(periph->regmap, AT91_PMC_PCR, ++ (periph->id & AT91_PMC_PCR_PID_MASK)); ++ regmap_read(periph->regmap, AT91_PMC_PCR, &status); ++ spin_unlock_irqrestore(periph->lock, flags); + +- return ret; ++ return status & AT91_PMC_PCR_EN ? 1 : 0; + } + + static unsigned long +@@ -214,19 +223,20 @@ clk_sam9x5_peripheral_recalc_rate(struct clk_hw *hw, + unsigned long parent_rate) + { + struct clk_sam9x5_peripheral *periph = to_clk_sam9x5_peripheral(hw); +- struct at91_pmc *pmc = periph->pmc; +- u32 tmp; ++ unsigned long flags; ++ unsigned int status; + + if (periph->id < PERIPHERAL_ID_MIN) + return parent_rate; + +- pmc_lock(pmc); +- pmc_write(pmc, AT91_PMC_PCR, (periph->id & AT91_PMC_PCR_PID_MASK)); +- tmp = pmc_read(pmc, AT91_PMC_PCR); +- pmc_unlock(pmc); ++ spin_lock_irqsave(periph->lock, flags); ++ regmap_write(periph->regmap, AT91_PMC_PCR, ++ (periph->id & AT91_PMC_PCR_PID_MASK)); ++ regmap_read(periph->regmap, AT91_PMC_PCR, &status); ++ spin_unlock_irqrestore(periph->lock, flags); + +- if (tmp & AT91_PMC_PCR_EN) { +- periph->div = PERIPHERAL_RSHIFT(tmp); ++ if (status & AT91_PMC_PCR_EN) { ++ periph->div = PERIPHERAL_RSHIFT(status); + periph->auto_div = false; + } else { + clk_sam9x5_peripheral_autodiv(periph); +@@ -318,15 +328,15 @@ static const struct clk_ops sam9x5_peripheral_ops = { + }; + + static struct clk * __init +-at91_clk_register_sam9x5_peripheral(struct at91_pmc *pmc, const char *name, +- const char *parent_name, u32 id, +- const struct clk_range *range) ++at91_clk_register_sam9x5_peripheral(struct regmap *regmap, spinlock_t *lock, ++ const char *name, const char *parent_name, ++ u32 id, const struct clk_range *range) + { + struct clk_sam9x5_peripheral *periph; + struct clk *clk = NULL; + struct clk_init_data init; + +- if (!pmc || !name || !parent_name) ++ if (!name || !parent_name) + return ERR_PTR(-EINVAL); + + periph = kzalloc(sizeof(*periph), GFP_KERNEL); +@@ -342,7 +352,8 @@ at91_clk_register_sam9x5_peripheral(struct at91_pmc *pmc, const char *name, + periph->id = id; + periph->hw.init = &init; + periph->div = 0; +- periph->pmc = pmc; ++ periph->regmap = regmap; ++ periph->lock = lock; + periph->auto_div = true; + periph->range = *range; + +@@ -356,7 +367,7 @@ at91_clk_register_sam9x5_peripheral(struct at91_pmc *pmc, const char *name, + } + + static void __init +-of_at91_clk_periph_setup(struct device_node *np, struct at91_pmc *pmc, u8 type) ++of_at91_clk_periph_setup(struct device_node *np, u8 type) + { + int num; + u32 id; +@@ -364,6 +375,7 @@ of_at91_clk_periph_setup(struct device_node *np, struct at91_pmc *pmc, u8 type) + const char *parent_name; + const char *name; + struct device_node *periphclknp; ++ struct regmap *regmap; + + parent_name = of_clk_get_parent_name(np, 0); + if (!parent_name) +@@ -373,6 +385,10 @@ of_at91_clk_periph_setup(struct device_node *np, struct at91_pmc *pmc, u8 type) + if (!num || num > PERIPHERAL_MAX) + return; + ++ regmap = syscon_node_to_regmap(of_get_parent(np)); ++ if (IS_ERR(regmap)) ++ return; ++ + for_each_child_of_node(np, periphclknp) { + if (of_property_read_u32(periphclknp, "reg", &id)) + continue; +@@ -384,7 +400,7 @@ of_at91_clk_periph_setup(struct device_node *np, struct at91_pmc *pmc, u8 type) + name = periphclknp->name; + + if (type == PERIPHERAL_AT91RM9200) { +- clk = at91_clk_register_peripheral(pmc, name, ++ clk = at91_clk_register_peripheral(regmap, name, + parent_name, id); + } else { + struct clk_range range = CLK_RANGE(0, 0); +@@ -393,7 +409,9 @@ of_at91_clk_periph_setup(struct device_node *np, struct at91_pmc *pmc, u8 type) + "atmel,clk-output-range", + &range); + +- clk = at91_clk_register_sam9x5_peripheral(pmc, name, ++ clk = at91_clk_register_sam9x5_peripheral(regmap, ++ &pmc_pcr_lock, ++ name, + parent_name, + id, &range); + } +@@ -405,14 +423,16 @@ of_at91_clk_periph_setup(struct device_node *np, struct at91_pmc *pmc, u8 type) + } + } + +-void __init of_at91rm9200_clk_periph_setup(struct device_node *np, +- struct at91_pmc *pmc) ++static void __init of_at91rm9200_clk_periph_setup(struct device_node *np) + { +- of_at91_clk_periph_setup(np, pmc, PERIPHERAL_AT91RM9200); ++ of_at91_clk_periph_setup(np, PERIPHERAL_AT91RM9200); + } ++CLK_OF_DECLARE(at91rm9200_clk_periph, "atmel,at91rm9200-clk-peripheral", ++ of_at91rm9200_clk_periph_setup); + +-void __init of_at91sam9x5_clk_periph_setup(struct device_node *np, +- struct at91_pmc *pmc) ++static void __init of_at91sam9x5_clk_periph_setup(struct device_node *np) + { +- of_at91_clk_periph_setup(np, pmc, PERIPHERAL_AT91SAM9X5); ++ of_at91_clk_periph_setup(np, PERIPHERAL_AT91SAM9X5); + } ++CLK_OF_DECLARE(at91sam9x5_clk_periph, "atmel,at91sam9x5-clk-peripheral", ++ of_at91sam9x5_clk_periph_setup); +diff --git a/drivers/clk/at91/clk-pll.c b/drivers/clk/at91/clk-pll.c +index 18b60f4..fb2e0b5 100644 +--- a/drivers/clk/at91/clk-pll.c ++++ b/drivers/clk/at91/clk-pll.c +@@ -12,14 +12,8 @@ + #include <linux/clkdev.h> + #include <linux/clk/at91_pmc.h> + #include <linux/of.h> +-#include <linux/of_address.h> +-#include <linux/of_irq.h> +-#include <linux/io.h> +-#include <linux/kernel.h> +-#include <linux/wait.h> +-#include <linux/sched.h> +-#include <linux/interrupt.h> +-#include <linux/irq.h> ++#include <linux/mfd/syscon.h> ++#include <linux/regmap.h> + + #include "pmc.h" + +@@ -58,9 +52,7 @@ struct clk_pll_layout { + + struct clk_pll { + struct clk_hw hw; +- struct at91_pmc *pmc; +- unsigned int irq; +- wait_queue_head_t wait; ++ struct regmap *regmap; + u8 id; + u8 div; + u8 range; +@@ -69,20 +61,19 @@ struct clk_pll { + const struct clk_pll_characteristics *characteristics; + }; + +-static irqreturn_t clk_pll_irq_handler(int irq, void *dev_id) ++static inline bool clk_pll_ready(struct regmap *regmap, int id) + { +- struct clk_pll *pll = (struct clk_pll *)dev_id; ++ unsigned int status; + +- wake_up(&pll->wait); +- disable_irq_nosync(pll->irq); ++ regmap_read(regmap, AT91_PMC_SR, &status); + +- return IRQ_HANDLED; ++ return status & PLL_STATUS_MASK(id) ? 1 : 0; + } + + static int clk_pll_prepare(struct clk_hw *hw) + { + struct clk_pll *pll = to_clk_pll(hw); +- struct at91_pmc *pmc = pll->pmc; ++ struct regmap *regmap = pll->regmap; + const struct clk_pll_layout *layout = pll->layout; + const struct clk_pll_characteristics *characteristics = + pll->characteristics; +@@ -90,39 +81,34 @@ static int clk_pll_prepare(struct clk_hw *hw) + u32 mask = PLL_STATUS_MASK(id); + int offset = PLL_REG(id); + u8 out = 0; +- u32 pllr, icpr; ++ unsigned int pllr; ++ unsigned int status; + u8 div; + u16 mul; + +- pllr = pmc_read(pmc, offset); ++ regmap_read(regmap, offset, &pllr); + div = PLL_DIV(pllr); + mul = PLL_MUL(pllr, layout); + +- if ((pmc_read(pmc, AT91_PMC_SR) & mask) && ++ regmap_read(regmap, AT91_PMC_SR, &status); ++ if ((status & mask) && + (div == pll->div && mul == pll->mul)) + return 0; + + if (characteristics->out) + out = characteristics->out[pll->range]; +- if (characteristics->icpll) { +- icpr = pmc_read(pmc, AT91_PMC_PLLICPR) & ~PLL_ICPR_MASK(id); +- icpr |= (characteristics->icpll[pll->range] << +- PLL_ICPR_SHIFT(id)); +- pmc_write(pmc, AT91_PMC_PLLICPR, icpr); +- } + +- pllr &= ~layout->pllr_mask; +- pllr |= layout->pllr_mask & +- (pll->div | (PLL_MAX_COUNT << PLL_COUNT_SHIFT) | +- (out << PLL_OUT_SHIFT) | +- ((pll->mul & layout->mul_mask) << layout->mul_shift)); +- pmc_write(pmc, offset, pllr); +- +- while (!(pmc_read(pmc, AT91_PMC_SR) & mask)) { +- enable_irq(pll->irq); +- wait_event(pll->wait, +- pmc_read(pmc, AT91_PMC_SR) & mask); +- } ++ if (characteristics->icpll) ++ regmap_update_bits(regmap, AT91_PMC_PLLICPR, PLL_ICPR_MASK(id), ++ characteristics->icpll[pll->range] << PLL_ICPR_SHIFT(id)); ++ ++ regmap_update_bits(regmap, offset, layout->pllr_mask, ++ pll->div | (PLL_MAX_COUNT << PLL_COUNT_SHIFT) | ++ (out << PLL_OUT_SHIFT) | ++ ((pll->mul & layout->mul_mask) << layout->mul_shift)); ++ ++ while (!clk_pll_ready(regmap, pll->id)) ++ cpu_relax(); + + return 0; + } +@@ -130,32 +116,35 @@ static int clk_pll_prepare(struct clk_hw *hw) + static int clk_pll_is_prepared(struct clk_hw *hw) + { + struct clk_pll *pll = to_clk_pll(hw); +- struct at91_pmc *pmc = pll->pmc; + +- return !!(pmc_read(pmc, AT91_PMC_SR) & +- PLL_STATUS_MASK(pll->id)); ++ return clk_pll_ready(pll->regmap, pll->id); + } + + static void clk_pll_unprepare(struct clk_hw *hw) + { + struct clk_pll *pll = to_clk_pll(hw); +- struct at91_pmc *pmc = pll->pmc; +- const struct clk_pll_layout *layout = pll->layout; +- int offset = PLL_REG(pll->id); +- u32 tmp = pmc_read(pmc, offset) & ~(layout->pllr_mask); ++ unsigned int mask = pll->layout->pllr_mask; + +- pmc_write(pmc, offset, tmp); ++ regmap_update_bits(pll->regmap, PLL_REG(pll->id), mask, ~mask); + } + + static unsigned long clk_pll_recalc_rate(struct clk_hw *hw, + unsigned long parent_rate) + { + struct clk_pll *pll = to_clk_pll(hw); ++ unsigned int pllr; ++ u16 mul; ++ u8 div; + +- if (!pll->div || !pll->mul) ++ regmap_read(pll->regmap, PLL_REG(pll->id), &pllr); ++ ++ div = PLL_DIV(pllr); ++ mul = PLL_MUL(pllr, pll->layout); ++ ++ if (!div || !mul) + return 0; + +- return (parent_rate / pll->div) * (pll->mul + 1); ++ return (parent_rate / div) * (mul + 1); + } + + static long clk_pll_get_best_div_mul(struct clk_pll *pll, unsigned long rate, +@@ -308,7 +297,7 @@ static const struct clk_ops pll_ops = { + }; + + static struct clk * __init +-at91_clk_register_pll(struct at91_pmc *pmc, unsigned int irq, const char *name, ++at91_clk_register_pll(struct regmap *regmap, const char *name, + const char *parent_name, u8 id, + const struct clk_pll_layout *layout, + const struct clk_pll_characteristics *characteristics) +@@ -316,9 +305,8 @@ at91_clk_register_pll(struct at91_pmc *pmc, unsigned int irq, const char *name, + struct clk_pll *pll; + struct clk *clk = NULL; + struct clk_init_data init; +- int ret; + int offset = PLL_REG(id); +- u32 tmp; ++ unsigned int pllr; + + if (id > PLL_MAX_ID) + return ERR_PTR(-EINVAL); +@@ -337,23 +325,13 @@ at91_clk_register_pll(struct at91_pmc *pmc, unsigned int irq, const char *name, + pll->hw.init = &init; + pll->layout = layout; + pll->characteristics = characteristics; +- pll->pmc = pmc; +- pll->irq = irq; +- tmp = pmc_read(pmc, offset) & layout->pllr_mask; +- pll->div = PLL_DIV(tmp); +- pll->mul = PLL_MUL(tmp, layout); +- init_waitqueue_head(&pll->wait); +- irq_set_status_flags(pll->irq, IRQ_NOAUTOEN); +- ret = request_irq(pll->irq, clk_pll_irq_handler, IRQF_TRIGGER_HIGH, +- id ? "clk-pllb" : "clk-plla", pll); +- if (ret) { +- kfree(pll); +- return ERR_PTR(ret); +- } ++ pll->regmap = regmap; ++ regmap_read(regmap, offset, &pllr); ++ pll->div = PLL_DIV(pllr); ++ pll->mul = PLL_MUL(pllr, layout); + + clk = clk_register(NULL, &pll->hw); + if (IS_ERR(clk)) { +- free_irq(pll->irq, pll); + kfree(pll); + } + +@@ -483,12 +461,12 @@ of_at91_clk_pll_get_characteristics(struct device_node *np) + } + + static void __init +-of_at91_clk_pll_setup(struct device_node *np, struct at91_pmc *pmc, ++of_at91_clk_pll_setup(struct device_node *np, + const struct clk_pll_layout *layout) + { + u32 id; +- unsigned int irq; + struct clk *clk; ++ struct regmap *regmap; + const char *parent_name; + const char *name = np->name; + struct clk_pll_characteristics *characteristics; +@@ -500,15 +478,15 @@ of_at91_clk_pll_setup(struct device_node *np, struct at91_pmc *pmc, + + of_property_read_string(np, "clock-output-names", &name); + +- characteristics = of_at91_clk_pll_get_characteristics(np); +- if (!characteristics) ++ regmap = syscon_node_to_regmap(of_get_parent(np)); ++ if (IS_ERR(regmap)) + return; + +- irq = irq_of_parse_and_map(np, 0); +- if (!irq) ++ characteristics = of_at91_clk_pll_get_characteristics(np); ++ if (!characteristics) + return; + +- clk = at91_clk_register_pll(pmc, irq, name, parent_name, id, layout, ++ clk = at91_clk_register_pll(regmap, name, parent_name, id, layout, + characteristics); + if (IS_ERR(clk)) + goto out_free_characteristics; +@@ -520,26 +498,30 @@ of_at91_clk_pll_setup(struct device_node *np, struct at91_pmc *pmc, + kfree(characteristics); + } + +-void __init of_at91rm9200_clk_pll_setup(struct device_node *np, +- struct at91_pmc *pmc) ++static void __init of_at91rm9200_clk_pll_setup(struct device_node *np) + { +- of_at91_clk_pll_setup(np, pmc, &at91rm9200_pll_layout); ++ of_at91_clk_pll_setup(np, &at91rm9200_pll_layout); + } ++CLK_OF_DECLARE(at91rm9200_clk_pll, "atmel,at91rm9200-clk-pll", ++ of_at91rm9200_clk_pll_setup); + +-void __init of_at91sam9g45_clk_pll_setup(struct device_node *np, +- struct at91_pmc *pmc) ++static void __init of_at91sam9g45_clk_pll_setup(struct device_node *np) + { +- of_at91_clk_pll_setup(np, pmc, &at91sam9g45_pll_layout); ++ of_at91_clk_pll_setup(np, &at91sam9g45_pll_layout); + } ++CLK_OF_DECLARE(at91sam9g45_clk_pll, "atmel,at91sam9g45-clk-pll", ++ of_at91sam9g45_clk_pll_setup); + +-void __init of_at91sam9g20_clk_pllb_setup(struct device_node *np, +- struct at91_pmc *pmc) ++static void __init of_at91sam9g20_clk_pllb_setup(struct device_node *np) + { +- of_at91_clk_pll_setup(np, pmc, &at91sam9g20_pllb_layout); ++ of_at91_clk_pll_setup(np, &at91sam9g20_pllb_layout); + } ++CLK_OF_DECLARE(at91sam9g20_clk_pllb, "atmel,at91sam9g20-clk-pllb", ++ of_at91sam9g20_clk_pllb_setup); + +-void __init of_sama5d3_clk_pll_setup(struct device_node *np, +- struct at91_pmc *pmc) ++static void __init of_sama5d3_clk_pll_setup(struct device_node *np) + { +- of_at91_clk_pll_setup(np, pmc, &sama5d3_pll_layout); ++ of_at91_clk_pll_setup(np, &sama5d3_pll_layout); + } ++CLK_OF_DECLARE(sama5d3_clk_pll, "atmel,sama5d3-clk-pll", ++ of_sama5d3_clk_pll_setup); +diff --git a/drivers/clk/at91/clk-plldiv.c b/drivers/clk/at91/clk-plldiv.c +index ea22656..2bed264 100644 +--- a/drivers/clk/at91/clk-plldiv.c ++++ b/drivers/clk/at91/clk-plldiv.c +@@ -12,8 +12,8 @@ + #include <linux/clkdev.h> + #include <linux/clk/at91_pmc.h> + #include <linux/of.h> +-#include <linux/of_address.h> +-#include <linux/io.h> ++#include <linux/mfd/syscon.h> ++#include <linux/regmap.h> + + #include "pmc.h" + +@@ -21,16 +21,18 @@ + + struct clk_plldiv { + struct clk_hw hw; +- struct at91_pmc *pmc; ++ struct regmap *regmap; + }; + + static unsigned long clk_plldiv_recalc_rate(struct clk_hw *hw, + unsigned long parent_rate) + { + struct clk_plldiv *plldiv = to_clk_plldiv(hw); +- struct at91_pmc *pmc = plldiv->pmc; ++ unsigned int mckr; + +- if (pmc_read(pmc, AT91_PMC_MCKR) & AT91_PMC_PLLADIV2) ++ regmap_read(plldiv->regmap, AT91_PMC_MCKR, &mckr); ++ ++ if (mckr & AT91_PMC_PLLADIV2) + return parent_rate / 2; + + return parent_rate; +@@ -57,18 +59,12 @@ static int clk_plldiv_set_rate(struct clk_hw *hw, unsigned long rate, + unsigned long parent_rate) + { + struct clk_plldiv *plldiv = to_clk_plldiv(hw); +- struct at91_pmc *pmc = plldiv->pmc; +- u32 tmp; + +- if (parent_rate != rate && (parent_rate / 2) != rate) ++ if ((parent_rate != rate) && (parent_rate / 2 != rate)) + return -EINVAL; + +- pmc_lock(pmc); +- tmp = pmc_read(pmc, AT91_PMC_MCKR) & ~AT91_PMC_PLLADIV2; +- if ((parent_rate / 2) == rate) +- tmp |= AT91_PMC_PLLADIV2; +- pmc_write(pmc, AT91_PMC_MCKR, tmp); +- pmc_unlock(pmc); ++ regmap_update_bits(plldiv->regmap, AT91_PMC_MCKR, AT91_PMC_PLLADIV2, ++ parent_rate != rate ? AT91_PMC_PLLADIV2 : 0); + + return 0; + } +@@ -80,7 +76,7 @@ static const struct clk_ops plldiv_ops = { + }; + + static struct clk * __init +-at91_clk_register_plldiv(struct at91_pmc *pmc, const char *name, ++at91_clk_register_plldiv(struct regmap *regmap, const char *name, + const char *parent_name) + { + struct clk_plldiv *plldiv; +@@ -98,7 +94,7 @@ at91_clk_register_plldiv(struct at91_pmc *pmc, const char *name, + init.flags = CLK_SET_RATE_GATE; + + plldiv->hw.init = &init; +- plldiv->pmc = pmc; ++ plldiv->regmap = regmap; + + clk = clk_register(NULL, &plldiv->hw); + +@@ -109,27 +105,27 @@ at91_clk_register_plldiv(struct at91_pmc *pmc, const char *name, + } + + static void __init +-of_at91_clk_plldiv_setup(struct device_node *np, struct at91_pmc *pmc) ++of_at91sam9x5_clk_plldiv_setup(struct device_node *np) + { + struct clk *clk; + const char *parent_name; + const char *name = np->name; ++ struct regmap *regmap; + + parent_name = of_clk_get_parent_name(np, 0); + + of_property_read_string(np, "clock-output-names", &name); + +- clk = at91_clk_register_plldiv(pmc, name, parent_name); ++ regmap = syscon_node_to_regmap(of_get_parent(np)); ++ if (IS_ERR(regmap)) ++ return; + ++ clk = at91_clk_register_plldiv(regmap, name, parent_name); + if (IS_ERR(clk)) + return; + + of_clk_add_provider(np, of_clk_src_simple_get, clk); + return; + } +- +-void __init of_at91sam9x5_clk_plldiv_setup(struct device_node *np, +- struct at91_pmc *pmc) +-{ +- of_at91_clk_plldiv_setup(np, pmc); +-} ++CLK_OF_DECLARE(at91sam9x5_clk_plldiv, "atmel,at91sam9x5-clk-plldiv", ++ of_at91sam9x5_clk_plldiv_setup); +diff --git a/drivers/clk/at91/clk-programmable.c b/drivers/clk/at91/clk-programmable.c +index 14b270b..bc0be62 100644 +--- a/drivers/clk/at91/clk-programmable.c ++++ b/drivers/clk/at91/clk-programmable.c +@@ -12,10 +12,8 @@ + #include <linux/clkdev.h> + #include <linux/clk/at91_pmc.h> + #include <linux/of.h> +-#include <linux/of_address.h> +-#include <linux/io.h> +-#include <linux/wait.h> +-#include <linux/sched.h> ++#include <linux/mfd/syscon.h> ++#include <linux/regmap.h> + + #include "pmc.h" + +@@ -24,6 +22,7 @@ + + #define PROG_STATUS_MASK(id) (1 << ((id) + 8)) + #define PROG_PRES_MASK 0x7 ++#define PROG_PRES(layout, pckr) ((pckr >> layout->pres_shift) & PROG_PRES_MASK) + #define PROG_MAX_RM9200_CSS 3 + + struct clk_programmable_layout { +@@ -34,7 +33,7 @@ struct clk_programmable_layout { + + struct clk_programmable { + struct clk_hw hw; +- struct at91_pmc *pmc; ++ struct regmap *regmap; + u8 id; + const struct clk_programmable_layout *layout; + }; +@@ -44,14 +43,12 @@ struct clk_programmable { + static unsigned long clk_programmable_recalc_rate(struct clk_hw *hw, + unsigned long parent_rate) + { +- u32 pres; + struct clk_programmable *prog = to_clk_programmable(hw); +- struct at91_pmc *pmc = prog->pmc; +- const struct clk_programmable_layout *layout = prog->layout; ++ unsigned int pckr; ++ ++ regmap_read(prog->regmap, AT91_PMC_PCKR(prog->id), &pckr); + +- pres = (pmc_read(pmc, AT91_PMC_PCKR(prog->id)) >> layout->pres_shift) & +- PROG_PRES_MASK; +- return parent_rate >> pres; ++ return parent_rate >> PROG_PRES(prog->layout, pckr); + } + + static int clk_programmable_determine_rate(struct clk_hw *hw, +@@ -101,36 +98,36 @@ static int clk_programmable_set_parent(struct clk_hw *hw, u8 index) + { + struct clk_programmable *prog = to_clk_programmable(hw); + const struct clk_programmable_layout *layout = prog->layout; +- struct at91_pmc *pmc = prog->pmc; +- u32 tmp = pmc_read(pmc, AT91_PMC_PCKR(prog->id)) & ~layout->css_mask; ++ unsigned int mask = layout->css_mask; ++ unsigned int pckr = 0; + + if (layout->have_slck_mck) +- tmp &= AT91_PMC_CSSMCK_MCK; ++ mask |= AT91_PMC_CSSMCK_MCK; + + if (index > layout->css_mask) { +- if (index > PROG_MAX_RM9200_CSS && layout->have_slck_mck) { +- tmp |= AT91_PMC_CSSMCK_MCK; +- return 0; +- } else { ++ if (index > PROG_MAX_RM9200_CSS && !layout->have_slck_mck) + return -EINVAL; +- } ++ ++ pckr |= AT91_PMC_CSSMCK_MCK; + } + +- pmc_write(pmc, AT91_PMC_PCKR(prog->id), tmp | index); ++ regmap_update_bits(prog->regmap, AT91_PMC_PCKR(prog->id), mask, pckr); ++ + return 0; + } + + static u8 clk_programmable_get_parent(struct clk_hw *hw) + { +- u32 tmp; +- u8 ret; + struct clk_programmable *prog = to_clk_programmable(hw); +- struct at91_pmc *pmc = prog->pmc; + const struct clk_programmable_layout *layout = prog->layout; ++ unsigned int pckr; ++ u8 ret; ++ ++ regmap_read(prog->regmap, AT91_PMC_PCKR(prog->id), &pckr); ++ ++ ret = pckr & layout->css_mask; + +- tmp = pmc_read(pmc, AT91_PMC_PCKR(prog->id)); +- ret = tmp & layout->css_mask; +- if (layout->have_slck_mck && (tmp & AT91_PMC_CSSMCK_MCK) && !ret) ++ if (layout->have_slck_mck && (pckr & AT91_PMC_CSSMCK_MCK) && !ret) + ret = PROG_MAX_RM9200_CSS + 1; + + return ret; +@@ -140,26 +137,27 @@ static int clk_programmable_set_rate(struct clk_hw *hw, unsigned long rate, + unsigned long parent_rate) + { + struct clk_programmable *prog = to_clk_programmable(hw); +- struct at91_pmc *pmc = prog->pmc; + const struct clk_programmable_layout *layout = prog->layout; + unsigned long div = parent_rate / rate; ++ unsigned int pckr; + int shift = 0; +- u32 tmp = pmc_read(pmc, AT91_PMC_PCKR(prog->id)) & +- ~(PROG_PRES_MASK << layout->pres_shift); ++ ++ regmap_read(prog->regmap, AT91_PMC_PCKR(prog->id), &pckr); + + if (!div) + return -EINVAL; + + shift = fls(div) - 1; + +- if (div != (1<<shift)) ++ if (div != (1 << shift)) + return -EINVAL; + + if (shift >= PROG_PRES_MASK) + return -EINVAL; + +- pmc_write(pmc, AT91_PMC_PCKR(prog->id), +- tmp | (shift << layout->pres_shift)); ++ regmap_update_bits(prog->regmap, AT91_PMC_PCKR(prog->id), ++ PROG_PRES_MASK << layout->pres_shift, ++ shift << layout->pres_shift); + + return 0; + } +@@ -173,7 +171,7 @@ static const struct clk_ops programmable_ops = { + }; + + static struct clk * __init +-at91_clk_register_programmable(struct at91_pmc *pmc, ++at91_clk_register_programmable(struct regmap *regmap, + const char *name, const char **parent_names, + u8 num_parents, u8 id, + const struct clk_programmable_layout *layout) +@@ -198,7 +196,7 @@ at91_clk_register_programmable(struct at91_pmc *pmc, + prog->id = id; + prog->layout = layout; + prog->hw.init = &init; +- prog->pmc = pmc; ++ prog->regmap = regmap; + + clk = clk_register(NULL, &prog->hw); + if (IS_ERR(clk)) +@@ -226,7 +224,7 @@ static const struct clk_programmable_layout at91sam9x5_programmable_layout = { + }; + + static void __init +-of_at91_clk_prog_setup(struct device_node *np, struct at91_pmc *pmc, ++of_at91_clk_prog_setup(struct device_node *np, + const struct clk_programmable_layout *layout) + { + int num; +@@ -236,6 +234,7 @@ of_at91_clk_prog_setup(struct device_node *np, struct at91_pmc *pmc, + const char *parent_names[PROG_SOURCE_MAX]; + const char *name; + struct device_node *progclknp; ++ struct regmap *regmap; + + num_parents = of_clk_get_parent_count(np); + if (num_parents <= 0 || num_parents > PROG_SOURCE_MAX) +@@ -247,6 +246,10 @@ of_at91_clk_prog_setup(struct device_node *np, struct at91_pmc *pmc, + if (!num || num > (PROG_ID_MAX + 1)) + return; + ++ regmap = syscon_node_to_regmap(of_get_parent(np)); ++ if (IS_ERR(regmap)) ++ return; ++ + for_each_child_of_node(np, progclknp) { + if (of_property_read_u32(progclknp, "reg", &id)) + continue; +@@ -254,7 +257,7 @@ of_at91_clk_prog_setup(struct device_node *np, struct at91_pmc *pmc, + if (of_property_read_string(np, "clock-output-names", &name)) + name = progclknp->name; + +- clk = at91_clk_register_programmable(pmc, name, ++ clk = at91_clk_register_programmable(regmap, name, + parent_names, num_parents, + id, layout); + if (IS_ERR(clk)) +@@ -265,20 +268,23 @@ of_at91_clk_prog_setup(struct device_node *np, struct at91_pmc *pmc, + } + + +-void __init of_at91rm9200_clk_prog_setup(struct device_node *np, +- struct at91_pmc *pmc) ++static void __init of_at91rm9200_clk_prog_setup(struct device_node *np) + { +- of_at91_clk_prog_setup(np, pmc, &at91rm9200_programmable_layout); ++ of_at91_clk_prog_setup(np, &at91rm9200_programmable_layout); + } ++CLK_OF_DECLARE(at91rm9200_clk_prog, "atmel,at91rm9200-clk-programmable", ++ of_at91rm9200_clk_prog_setup); + +-void __init of_at91sam9g45_clk_prog_setup(struct device_node *np, +- struct at91_pmc *pmc) ++static void __init of_at91sam9g45_clk_prog_setup(struct device_node *np) + { +- of_at91_clk_prog_setup(np, pmc, &at91sam9g45_programmable_layout); ++ of_at91_clk_prog_setup(np, &at91sam9g45_programmable_layout); + } ++CLK_OF_DECLARE(at91sam9g45_clk_prog, "atmel,at91sam9g45-clk-programmable", ++ of_at91sam9g45_clk_prog_setup); + +-void __init of_at91sam9x5_clk_prog_setup(struct device_node *np, +- struct at91_pmc *pmc) ++static void __init of_at91sam9x5_clk_prog_setup(struct device_node *np) + { +- of_at91_clk_prog_setup(np, pmc, &at91sam9x5_programmable_layout); ++ of_at91_clk_prog_setup(np, &at91sam9x5_programmable_layout); + } ++CLK_OF_DECLARE(at91sam9x5_clk_prog, "atmel,at91sam9x5-clk-programmable", ++ of_at91sam9x5_clk_prog_setup); +diff --git a/drivers/clk/at91/clk-slow.c b/drivers/clk/at91/clk-slow.c +index d0d5076..221c096 100644 +--- a/drivers/clk/at91/clk-slow.c ++++ b/drivers/clk/at91/clk-slow.c +@@ -13,17 +13,11 @@ + #include <linux/clk.h> + #include <linux/clk-provider.h> + #include <linux/clkdev.h> +-#include <linux/slab.h> + #include <linux/clk/at91_pmc.h> + #include <linux/delay.h> + #include <linux/of.h> +-#include <linux/of_address.h> +-#include <linux/of_irq.h> +-#include <linux/io.h> +-#include <linux/interrupt.h> +-#include <linux/irq.h> +-#include <linux/sched.h> +-#include <linux/wait.h> ++#include <linux/mfd/syscon.h> ++#include <linux/regmap.h> + + #include "pmc.h" + #include "sckc.h" +@@ -59,7 +53,7 @@ struct clk_slow_rc_osc { + + struct clk_sam9260_slow { + struct clk_hw hw; +- struct at91_pmc *pmc; ++ struct regmap *regmap; + }; + + #define to_clk_sam9260_slow(hw) container_of(hw, struct clk_sam9260_slow, hw) +@@ -393,8 +387,11 @@ void __init of_at91sam9x5_clk_slow_setup(struct device_node *np, + static u8 clk_sam9260_slow_get_parent(struct clk_hw *hw) + { + struct clk_sam9260_slow *slowck = to_clk_sam9260_slow(hw); ++ unsigned int status; + +- return !!(pmc_read(slowck->pmc, AT91_PMC_SR) & AT91_PMC_OSCSEL); ++ regmap_read(slowck->regmap, AT91_PMC_SR, &status); ++ ++ return status & AT91_PMC_OSCSEL ? 1 : 0; + } + + static const struct clk_ops sam9260_slow_ops = { +@@ -402,7 +399,7 @@ static const struct clk_ops sam9260_slow_ops = { + }; + + static struct clk * __init +-at91_clk_register_sam9260_slow(struct at91_pmc *pmc, ++at91_clk_register_sam9260_slow(struct regmap *regmap, + const char *name, + const char **parent_names, + int num_parents) +@@ -411,7 +408,7 @@ at91_clk_register_sam9260_slow(struct at91_pmc *pmc, + struct clk *clk = NULL; + struct clk_init_data init; + +- if (!pmc || !name) ++ if (!name) + return ERR_PTR(-EINVAL); + + if (!parent_names || !num_parents) +@@ -428,7 +425,7 @@ at91_clk_register_sam9260_slow(struct at91_pmc *pmc, + init.flags = 0; + + slowck->hw.init = &init; +- slowck->pmc = pmc; ++ slowck->regmap = regmap; + + clk = clk_register(NULL, &slowck->hw); + if (IS_ERR(clk)) +@@ -439,29 +436,34 @@ at91_clk_register_sam9260_slow(struct at91_pmc *pmc, + return clk; + } + +-void __init of_at91sam9260_clk_slow_setup(struct device_node *np, +- struct at91_pmc *pmc) ++static void __init of_at91sam9260_clk_slow_setup(struct device_node *np) + { + struct clk *clk; + const char *parent_names[2]; + int num_parents; + const char *name = np->name; ++ struct regmap *regmap; + + num_parents = of_clk_get_parent_count(np); + if (num_parents != 2) + return; + + of_clk_parent_fill(np, parent_names, num_parents); ++ regmap = syscon_node_to_regmap(of_get_parent(np)); ++ if (IS_ERR(regmap)) ++ return; + + of_property_read_string(np, "clock-output-names", &name); + +- clk = at91_clk_register_sam9260_slow(pmc, name, parent_names, ++ clk = at91_clk_register_sam9260_slow(regmap, name, parent_names, + num_parents); + if (IS_ERR(clk)) + return; + + of_clk_add_provider(np, of_clk_src_simple_get, clk); + } ++CLK_OF_DECLARE(at91sam9260_clk_slow, "atmel,at91sam9260-clk-slow", ++ of_at91sam9260_clk_slow_setup); + + /* + * FIXME: All slow clk users are not properly claiming it (get + prepare + +diff --git a/drivers/clk/at91/clk-smd.c b/drivers/clk/at91/clk-smd.c +index a7f8501..e6948a5 100644 +--- a/drivers/clk/at91/clk-smd.c ++++ b/drivers/clk/at91/clk-smd.c +@@ -12,8 +12,8 @@ + #include <linux/clkdev.h> + #include <linux/clk/at91_pmc.h> + #include <linux/of.h> +-#include <linux/of_address.h> +-#include <linux/io.h> ++#include <linux/mfd/syscon.h> ++#include <linux/regmap.h> + + #include "pmc.h" + +@@ -24,7 +24,7 @@ + + struct at91sam9x5_clk_smd { + struct clk_hw hw; +- struct at91_pmc *pmc; ++ struct regmap *regmap; + }; + + #define to_at91sam9x5_clk_smd(hw) \ +@@ -33,13 +33,13 @@ struct at91sam9x5_clk_smd { + static unsigned long at91sam9x5_clk_smd_recalc_rate(struct clk_hw *hw, + unsigned long parent_rate) + { +- u32 tmp; +- u8 smddiv; + struct at91sam9x5_clk_smd *smd = to_at91sam9x5_clk_smd(hw); +- struct at91_pmc *pmc = smd->pmc; ++ unsigned int smdr; ++ u8 smddiv; ++ ++ regmap_read(smd->regmap, AT91_PMC_SMD, &smdr); ++ smddiv = (smdr & AT91_PMC_SMD_DIV) >> SMD_DIV_SHIFT; + +- tmp = pmc_read(pmc, AT91_PMC_SMD); +- smddiv = (tmp & AT91_PMC_SMD_DIV) >> SMD_DIV_SHIFT; + return parent_rate / (smddiv + 1); + } + +@@ -67,40 +67,38 @@ static long at91sam9x5_clk_smd_round_rate(struct clk_hw *hw, unsigned long rate, + + static int at91sam9x5_clk_smd_set_parent(struct clk_hw *hw, u8 index) + { +- u32 tmp; + struct at91sam9x5_clk_smd *smd = to_at91sam9x5_clk_smd(hw); +- struct at91_pmc *pmc = smd->pmc; + + if (index > 1) + return -EINVAL; +- tmp = pmc_read(pmc, AT91_PMC_SMD) & ~AT91_PMC_SMDS; +- if (index) +- tmp |= AT91_PMC_SMDS; +- pmc_write(pmc, AT91_PMC_SMD, tmp); ++ ++ regmap_update_bits(smd->regmap, AT91_PMC_SMD, AT91_PMC_SMDS, ++ index ? AT91_PMC_SMDS : 0); ++ + return 0; + } + + static u8 at91sam9x5_clk_smd_get_parent(struct clk_hw *hw) + { + struct at91sam9x5_clk_smd *smd = to_at91sam9x5_clk_smd(hw); +- struct at91_pmc *pmc = smd->pmc; ++ unsigned int smdr; + +- return pmc_read(pmc, AT91_PMC_SMD) & AT91_PMC_SMDS; ++ regmap_read(smd->regmap, AT91_PMC_SMD, &smdr); ++ ++ return smdr & AT91_PMC_SMDS; + } + + static int at91sam9x5_clk_smd_set_rate(struct clk_hw *hw, unsigned long rate, + unsigned long parent_rate) + { +- u32 tmp; + struct at91sam9x5_clk_smd *smd = to_at91sam9x5_clk_smd(hw); +- struct at91_pmc *pmc = smd->pmc; + unsigned long div = parent_rate / rate; + + if (parent_rate % rate || div < 1 || div > (SMD_MAX_DIV + 1)) + return -EINVAL; +- tmp = pmc_read(pmc, AT91_PMC_SMD) & ~AT91_PMC_SMD_DIV; +- tmp |= (div - 1) << SMD_DIV_SHIFT; +- pmc_write(pmc, AT91_PMC_SMD, tmp); ++ ++ regmap_update_bits(smd->regmap, AT91_PMC_SMD, AT91_PMC_SMD_DIV, ++ (div - 1) << SMD_DIV_SHIFT); + + return 0; + } +@@ -114,7 +112,7 @@ static const struct clk_ops at91sam9x5_smd_ops = { + }; + + static struct clk * __init +-at91sam9x5_clk_register_smd(struct at91_pmc *pmc, const char *name, ++at91sam9x5_clk_register_smd(struct regmap *regmap, const char *name, + const char **parent_names, u8 num_parents) + { + struct at91sam9x5_clk_smd *smd; +@@ -132,7 +130,7 @@ at91sam9x5_clk_register_smd(struct at91_pmc *pmc, const char *name, + init.flags = CLK_SET_RATE_GATE | CLK_SET_PARENT_GATE; + + smd->hw.init = &init; +- smd->pmc = pmc; ++ smd->regmap = regmap; + + clk = clk_register(NULL, &smd->hw); + if (IS_ERR(clk)) +@@ -141,13 +139,13 @@ at91sam9x5_clk_register_smd(struct at91_pmc *pmc, const char *name, + return clk; + } + +-void __init of_at91sam9x5_clk_smd_setup(struct device_node *np, +- struct at91_pmc *pmc) ++static void __init of_at91sam9x5_clk_smd_setup(struct device_node *np) + { + struct clk *clk; + int num_parents; + const char *parent_names[SMD_SOURCE_MAX]; + const char *name = np->name; ++ struct regmap *regmap; + + num_parents = of_clk_get_parent_count(np); + if (num_parents <= 0 || num_parents > SMD_SOURCE_MAX) +@@ -157,10 +155,16 @@ void __init of_at91sam9x5_clk_smd_setup(struct device_node *np, + + of_property_read_string(np, "clock-output-names", &name); + +- clk = at91sam9x5_clk_register_smd(pmc, name, parent_names, ++ regmap = syscon_node_to_regmap(of_get_parent(np)); ++ if (IS_ERR(regmap)) ++ return; ++ ++ clk = at91sam9x5_clk_register_smd(regmap, name, parent_names, + num_parents); + if (IS_ERR(clk)) + return; + + of_clk_add_provider(np, of_clk_src_simple_get, clk); + } ++CLK_OF_DECLARE(at91sam9x5_clk_smd, "atmel,at91sam9x5-clk-smd", ++ of_at91sam9x5_clk_smd_setup); +diff --git a/drivers/clk/at91/clk-system.c b/drivers/clk/at91/clk-system.c +index 3f53143..8f35d81 100644 +--- a/drivers/clk/at91/clk-system.c ++++ b/drivers/clk/at91/clk-system.c +@@ -12,13 +12,8 @@ + #include <linux/clkdev.h> + #include <linux/clk/at91_pmc.h> + #include <linux/of.h> +-#include <linux/of_address.h> +-#include <linux/io.h> +-#include <linux/irq.h> +-#include <linux/of_irq.h> +-#include <linux/interrupt.h> +-#include <linux/wait.h> +-#include <linux/sched.h> ++#include <linux/mfd/syscon.h> ++#include <linux/regmap.h> + + #include "pmc.h" + +@@ -29,9 +24,7 @@ + #define to_clk_system(hw) container_of(hw, struct clk_system, hw) + struct clk_system { + struct clk_hw hw; +- struct at91_pmc *pmc; +- unsigned int irq; +- wait_queue_head_t wait; ++ struct regmap *regmap; + u8 id; + }; + +@@ -39,58 +32,54 @@ static inline int is_pck(int id) + { + return (id >= 8) && (id <= 15); + } +-static irqreturn_t clk_system_irq_handler(int irq, void *dev_id) ++ ++static inline bool clk_system_ready(struct regmap *regmap, int id) + { +- struct clk_system *sys = (struct clk_system *)dev_id; ++ unsigned int status; + +- wake_up(&sys->wait); +- disable_irq_nosync(sys->irq); ++ regmap_read(regmap, AT91_PMC_SR, &status); + +- return IRQ_HANDLED; ++ return status & (1 << id) ? 1 : 0; + } + + static int clk_system_prepare(struct clk_hw *hw) + { + struct clk_system *sys = to_clk_system(hw); +- struct at91_pmc *pmc = sys->pmc; +- u32 mask = 1 << sys->id; + +- pmc_write(pmc, AT91_PMC_SCER, mask); ++ regmap_write(sys->regmap, AT91_PMC_SCER, 1 << sys->id); + + if (!is_pck(sys->id)) + return 0; + +- while (!(pmc_read(pmc, AT91_PMC_SR) & mask)) { +- if (sys->irq) { +- enable_irq(sys->irq); +- wait_event(sys->wait, +- pmc_read(pmc, AT91_PMC_SR) & mask); +- } else +- cpu_relax(); +- } ++ while (!clk_system_ready(sys->regmap, sys->id)) ++ cpu_relax(); ++ + return 0; + } + + static void clk_system_unprepare(struct clk_hw *hw) + { + struct clk_system *sys = to_clk_system(hw); +- struct at91_pmc *pmc = sys->pmc; + +- pmc_write(pmc, AT91_PMC_SCDR, 1 << sys->id); ++ regmap_write(sys->regmap, AT91_PMC_SCDR, 1 << sys->id); + } + + static int clk_system_is_prepared(struct clk_hw *hw) + { + struct clk_system *sys = to_clk_system(hw); +- struct at91_pmc *pmc = sys->pmc; ++ unsigned int status; ++ ++ regmap_read(sys->regmap, AT91_PMC_SCSR, &status); + +- if (!(pmc_read(pmc, AT91_PMC_SCSR) & (1 << sys->id))) ++ if (!(status & (1 << sys->id))) + return 0; + + if (!is_pck(sys->id)) + return 1; + +- return !!(pmc_read(pmc, AT91_PMC_SR) & (1 << sys->id)); ++ regmap_read(sys->regmap, AT91_PMC_SR, &status); ++ ++ return status & (1 << sys->id) ? 1 : 0; + } + + static const struct clk_ops system_ops = { +@@ -100,13 +89,12 @@ static const struct clk_ops system_ops = { + }; + + static struct clk * __init +-at91_clk_register_system(struct at91_pmc *pmc, const char *name, +- const char *parent_name, u8 id, int irq) ++at91_clk_register_system(struct regmap *regmap, const char *name, ++ const char *parent_name, u8 id) + { + struct clk_system *sys; + struct clk *clk = NULL; + struct clk_init_data init; +- int ret; + + if (!parent_name || id > SYSTEM_MAX_ID) + return ERR_PTR(-EINVAL); +@@ -123,44 +111,33 @@ at91_clk_register_system(struct at91_pmc *pmc, const char *name, + + sys->id = id; + sys->hw.init = &init; +- sys->pmc = pmc; +- sys->irq = irq; +- if (irq) { +- init_waitqueue_head(&sys->wait); +- irq_set_status_flags(sys->irq, IRQ_NOAUTOEN); +- ret = request_irq(sys->irq, clk_system_irq_handler, +- IRQF_TRIGGER_HIGH, name, sys); +- if (ret) { +- kfree(sys); +- return ERR_PTR(ret); +- } +- } ++ sys->regmap = regmap; + + clk = clk_register(NULL, &sys->hw); +- if (IS_ERR(clk)) { +- if (irq) +- free_irq(sys->irq, sys); ++ if (IS_ERR(clk)) + kfree(sys); +- } + + return clk; + } + +-static void __init +-of_at91_clk_sys_setup(struct device_node *np, struct at91_pmc *pmc) ++static void __init of_at91rm9200_clk_sys_setup(struct device_node *np) + { + int num; +- int irq = 0; + u32 id; + struct clk *clk; + const char *name; + struct device_node *sysclknp; + const char *parent_name; ++ struct regmap *regmap; + + num = of_get_child_count(np); + if (num > (SYSTEM_MAX_ID + 1)) + return; + ++ regmap = syscon_node_to_regmap(of_get_parent(np)); ++ if (IS_ERR(regmap)) ++ return; ++ + for_each_child_of_node(np, sysclknp) { + if (of_property_read_u32(sysclknp, "reg", &id)) + continue; +@@ -168,21 +145,14 @@ of_at91_clk_sys_setup(struct device_node *np, struct at91_pmc *pmc) + if (of_property_read_string(np, "clock-output-names", &name)) + name = sysclknp->name; + +- if (is_pck(id)) +- irq = irq_of_parse_and_map(sysclknp, 0); +- + parent_name = of_clk_get_parent_name(sysclknp, 0); + +- clk = at91_clk_register_system(pmc, name, parent_name, id, irq); ++ clk = at91_clk_register_system(regmap, name, parent_name, id); + if (IS_ERR(clk)) + continue; + + of_clk_add_provider(sysclknp, of_clk_src_simple_get, clk); + } + } +- +-void __init of_at91rm9200_clk_sys_setup(struct device_node *np, +- struct at91_pmc *pmc) +-{ +- of_at91_clk_sys_setup(np, pmc); +-} ++CLK_OF_DECLARE(at91rm9200_clk_sys, "atmel,at91rm9200-clk-system", ++ of_at91rm9200_clk_sys_setup); +diff --git a/drivers/clk/at91/clk-usb.c b/drivers/clk/at91/clk-usb.c +index 8ab8502..650ca45 100644 +--- a/drivers/clk/at91/clk-usb.c ++++ b/drivers/clk/at91/clk-usb.c +@@ -12,8 +12,8 @@ + #include <linux/clkdev.h> + #include <linux/clk/at91_pmc.h> + #include <linux/of.h> +-#include <linux/of_address.h> +-#include <linux/io.h> ++#include <linux/mfd/syscon.h> ++#include <linux/regmap.h> + + #include "pmc.h" + +@@ -27,7 +27,7 @@ + + struct at91sam9x5_clk_usb { + struct clk_hw hw; +- struct at91_pmc *pmc; ++ struct regmap *regmap; + }; + + #define to_at91sam9x5_clk_usb(hw) \ +@@ -35,7 +35,7 @@ struct at91sam9x5_clk_usb { + + struct at91rm9200_clk_usb { + struct clk_hw hw; +- struct at91_pmc *pmc; ++ struct regmap *regmap; + u32 divisors[4]; + }; + +@@ -45,13 +45,12 @@ struct at91rm9200_clk_usb { + static unsigned long at91sam9x5_clk_usb_recalc_rate(struct clk_hw *hw, + unsigned long parent_rate) + { +- u32 tmp; +- u8 usbdiv; + struct at91sam9x5_clk_usb *usb = to_at91sam9x5_clk_usb(hw); +- struct at91_pmc *pmc = usb->pmc; ++ unsigned int usbr; ++ u8 usbdiv; + +- tmp = pmc_read(pmc, AT91_PMC_USB); +- usbdiv = (tmp & AT91_PMC_OHCIUSBDIV) >> SAM9X5_USB_DIV_SHIFT; ++ regmap_read(usb->regmap, AT91_PMC_USB, &usbr); ++ usbdiv = (usbr & AT91_PMC_OHCIUSBDIV) >> SAM9X5_USB_DIV_SHIFT; + + return DIV_ROUND_CLOSEST(parent_rate, (usbdiv + 1)); + } +@@ -109,33 +108,31 @@ static int at91sam9x5_clk_usb_determine_rate(struct clk_hw *hw, + + static int at91sam9x5_clk_usb_set_parent(struct clk_hw *hw, u8 index) + { +- u32 tmp; + struct at91sam9x5_clk_usb *usb = to_at91sam9x5_clk_usb(hw); +- struct at91_pmc *pmc = usb->pmc; + + if (index > 1) + return -EINVAL; +- tmp = pmc_read(pmc, AT91_PMC_USB) & ~AT91_PMC_USBS; +- if (index) +- tmp |= AT91_PMC_USBS; +- pmc_write(pmc, AT91_PMC_USB, tmp); ++ ++ regmap_update_bits(usb->regmap, AT91_PMC_USB, AT91_PMC_USBS, ++ index ? AT91_PMC_USBS : 0); ++ + return 0; + } + + static u8 at91sam9x5_clk_usb_get_parent(struct clk_hw *hw) + { + struct at91sam9x5_clk_usb *usb = to_at91sam9x5_clk_usb(hw); +- struct at91_pmc *pmc = usb->pmc; ++ unsigned int usbr; + +- return pmc_read(pmc, AT91_PMC_USB) & AT91_PMC_USBS; ++ regmap_read(usb->regmap, AT91_PMC_USB, &usbr); ++ ++ return usbr & AT91_PMC_USBS; + } + + static int at91sam9x5_clk_usb_set_rate(struct clk_hw *hw, unsigned long rate, + unsigned long parent_rate) + { +- u32 tmp; + struct at91sam9x5_clk_usb *usb = to_at91sam9x5_clk_usb(hw); +- struct at91_pmc *pmc = usb->pmc; + unsigned long div; + + if (!rate) +@@ -145,9 +142,8 @@ static int at91sam9x5_clk_usb_set_rate(struct clk_hw *hw, unsigned long rate, + if (div > SAM9X5_USB_MAX_DIV + 1 || !div) + return -EINVAL; + +- tmp = pmc_read(pmc, AT91_PMC_USB) & ~AT91_PMC_OHCIUSBDIV; +- tmp |= (div - 1) << SAM9X5_USB_DIV_SHIFT; +- pmc_write(pmc, AT91_PMC_USB, tmp); ++ regmap_update_bits(usb->regmap, AT91_PMC_USB, AT91_PMC_OHCIUSBDIV, ++ (div - 1) << SAM9X5_USB_DIV_SHIFT); + + return 0; + } +@@ -163,28 +159,28 @@ static const struct clk_ops at91sam9x5_usb_ops = { + static int at91sam9n12_clk_usb_enable(struct clk_hw *hw) + { + struct at91sam9x5_clk_usb *usb = to_at91sam9x5_clk_usb(hw); +- struct at91_pmc *pmc = usb->pmc; + +- pmc_write(pmc, AT91_PMC_USB, +- pmc_read(pmc, AT91_PMC_USB) | AT91_PMC_USBS); ++ regmap_update_bits(usb->regmap, AT91_PMC_USB, AT91_PMC_USBS, ++ AT91_PMC_USBS); ++ + return 0; + } + + static void at91sam9n12_clk_usb_disable(struct clk_hw *hw) + { + struct at91sam9x5_clk_usb *usb = to_at91sam9x5_clk_usb(hw); +- struct at91_pmc *pmc = usb->pmc; + +- pmc_write(pmc, AT91_PMC_USB, +- pmc_read(pmc, AT91_PMC_USB) & ~AT91_PMC_USBS); ++ regmap_update_bits(usb->regmap, AT91_PMC_USB, AT91_PMC_USBS, 0); + } + + static int at91sam9n12_clk_usb_is_enabled(struct clk_hw *hw) + { + struct at91sam9x5_clk_usb *usb = to_at91sam9x5_clk_usb(hw); +- struct at91_pmc *pmc = usb->pmc; ++ unsigned int usbr; + +- return !!(pmc_read(pmc, AT91_PMC_USB) & AT91_PMC_USBS); ++ regmap_read(usb->regmap, AT91_PMC_USB, &usbr); ++ ++ return usbr & AT91_PMC_USBS; + } + + static const struct clk_ops at91sam9n12_usb_ops = { +@@ -197,7 +193,7 @@ static const struct clk_ops at91sam9n12_usb_ops = { + }; + + static struct clk * __init +-at91sam9x5_clk_register_usb(struct at91_pmc *pmc, const char *name, ++at91sam9x5_clk_register_usb(struct regmap *regmap, const char *name, + const char **parent_names, u8 num_parents) + { + struct at91sam9x5_clk_usb *usb; +@@ -216,7 +212,7 @@ at91sam9x5_clk_register_usb(struct at91_pmc *pmc, const char *name, + CLK_SET_RATE_PARENT; + + usb->hw.init = &init; +- usb->pmc = pmc; ++ usb->regmap = regmap; + + clk = clk_register(NULL, &usb->hw); + if (IS_ERR(clk)) +@@ -226,7 +222,7 @@ at91sam9x5_clk_register_usb(struct at91_pmc *pmc, const char *name, + } + + static struct clk * __init +-at91sam9n12_clk_register_usb(struct at91_pmc *pmc, const char *name, ++at91sam9n12_clk_register_usb(struct regmap *regmap, const char *name, + const char *parent_name) + { + struct at91sam9x5_clk_usb *usb; +@@ -244,7 +240,7 @@ at91sam9n12_clk_register_usb(struct at91_pmc *pmc, const char *name, + init.flags = CLK_SET_RATE_GATE | CLK_SET_RATE_PARENT; + + usb->hw.init = &init; +- usb->pmc = pmc; ++ usb->regmap = regmap; + + clk = clk_register(NULL, &usb->hw); + if (IS_ERR(clk)) +@@ -257,12 +253,12 @@ static unsigned long at91rm9200_clk_usb_recalc_rate(struct clk_hw *hw, + unsigned long parent_rate) + { + struct at91rm9200_clk_usb *usb = to_at91rm9200_clk_usb(hw); +- struct at91_pmc *pmc = usb->pmc; +- u32 tmp; ++ unsigned int pllbr; + u8 usbdiv; + +- tmp = pmc_read(pmc, AT91_CKGR_PLLBR); +- usbdiv = (tmp & AT91_PMC_USBDIV) >> RM9200_USB_DIV_SHIFT; ++ regmap_read(usb->regmap, AT91_CKGR_PLLBR, &pllbr); ++ ++ usbdiv = (pllbr & AT91_PMC_USBDIV) >> RM9200_USB_DIV_SHIFT; + if (usb->divisors[usbdiv]) + return parent_rate / usb->divisors[usbdiv]; + +@@ -310,10 +306,8 @@ static long at91rm9200_clk_usb_round_rate(struct clk_hw *hw, unsigned long rate, + static int at91rm9200_clk_usb_set_rate(struct clk_hw *hw, unsigned long rate, + unsigned long parent_rate) + { +- u32 tmp; + int i; + struct at91rm9200_clk_usb *usb = to_at91rm9200_clk_usb(hw); +- struct at91_pmc *pmc = usb->pmc; + unsigned long div; + + if (!rate) +@@ -323,10 +317,10 @@ static int at91rm9200_clk_usb_set_rate(struct clk_hw *hw, unsigned long rate, + + for (i = 0; i < RM9200_USB_DIV_TAB_SIZE; i++) { + if (usb->divisors[i] == div) { +- tmp = pmc_read(pmc, AT91_CKGR_PLLBR) & +- ~AT91_PMC_USBDIV; +- tmp |= i << RM9200_USB_DIV_SHIFT; +- pmc_write(pmc, AT91_CKGR_PLLBR, tmp); ++ regmap_update_bits(usb->regmap, AT91_CKGR_PLLBR, ++ AT91_PMC_USBDIV, ++ i << RM9200_USB_DIV_SHIFT); ++ + return 0; + } + } +@@ -341,7 +335,7 @@ static const struct clk_ops at91rm9200_usb_ops = { + }; + + static struct clk * __init +-at91rm9200_clk_register_usb(struct at91_pmc *pmc, const char *name, ++at91rm9200_clk_register_usb(struct regmap *regmap, const char *name, + const char *parent_name, const u32 *divisors) + { + struct at91rm9200_clk_usb *usb; +@@ -359,7 +353,7 @@ at91rm9200_clk_register_usb(struct at91_pmc *pmc, const char *name, + init.flags = CLK_SET_RATE_PARENT; + + usb->hw.init = &init; +- usb->pmc = pmc; ++ usb->regmap = regmap; + memcpy(usb->divisors, divisors, sizeof(usb->divisors)); + + clk = clk_register(NULL, &usb->hw); +@@ -369,13 +363,13 @@ at91rm9200_clk_register_usb(struct at91_pmc *pmc, const char *name, + return clk; + } + +-void __init of_at91sam9x5_clk_usb_setup(struct device_node *np, +- struct at91_pmc *pmc) ++static void __init of_at91sam9x5_clk_usb_setup(struct device_node *np) + { + struct clk *clk; + int num_parents; + const char *parent_names[USB_SOURCE_MAX]; + const char *name = np->name; ++ struct regmap *regmap; + + num_parents = of_clk_get_parent_count(np); + if (num_parents <= 0 || num_parents > USB_SOURCE_MAX) +@@ -385,19 +379,26 @@ void __init of_at91sam9x5_clk_usb_setup(struct device_node *np, + + of_property_read_string(np, "clock-output-names", &name); + +- clk = at91sam9x5_clk_register_usb(pmc, name, parent_names, num_parents); ++ regmap = syscon_node_to_regmap(of_get_parent(np)); ++ if (IS_ERR(regmap)) ++ return; ++ ++ clk = at91sam9x5_clk_register_usb(regmap, name, parent_names, ++ num_parents); + if (IS_ERR(clk)) + return; + + of_clk_add_provider(np, of_clk_src_simple_get, clk); + } ++CLK_OF_DECLARE(at91sam9x5_clk_usb, "atmel,at91sam9x5-clk-usb", ++ of_at91sam9x5_clk_usb_setup); + +-void __init of_at91sam9n12_clk_usb_setup(struct device_node *np, +- struct at91_pmc *pmc) ++static void __init of_at91sam9n12_clk_usb_setup(struct device_node *np) + { + struct clk *clk; + const char *parent_name; + const char *name = np->name; ++ struct regmap *regmap; + + parent_name = of_clk_get_parent_name(np, 0); + if (!parent_name) +@@ -405,20 +406,26 @@ void __init of_at91sam9n12_clk_usb_setup(struct device_node *np, + + of_property_read_string(np, "clock-output-names", &name); + +- clk = at91sam9n12_clk_register_usb(pmc, name, parent_name); ++ regmap = syscon_node_to_regmap(of_get_parent(np)); ++ if (IS_ERR(regmap)) ++ return; ++ ++ clk = at91sam9n12_clk_register_usb(regmap, name, parent_name); + if (IS_ERR(clk)) + return; + + of_clk_add_provider(np, of_clk_src_simple_get, clk); + } ++CLK_OF_DECLARE(at91sam9n12_clk_usb, "atmel,at91sam9n12-clk-usb", ++ of_at91sam9n12_clk_usb_setup); + +-void __init of_at91rm9200_clk_usb_setup(struct device_node *np, +- struct at91_pmc *pmc) ++static void __init of_at91rm9200_clk_usb_setup(struct device_node *np) + { + struct clk *clk; + const char *parent_name; + const char *name = np->name; + u32 divisors[4] = {0, 0, 0, 0}; ++ struct regmap *regmap; + + parent_name = of_clk_get_parent_name(np, 0); + if (!parent_name) +@@ -430,9 +437,15 @@ void __init of_at91rm9200_clk_usb_setup(struct device_node *np, + + of_property_read_string(np, "clock-output-names", &name); + +- clk = at91rm9200_clk_register_usb(pmc, name, parent_name, divisors); ++ regmap = syscon_node_to_regmap(of_get_parent(np)); ++ if (IS_ERR(regmap)) ++ return; ++ ++ clk = at91rm9200_clk_register_usb(regmap, name, parent_name, divisors); + if (IS_ERR(clk)) + return; + + of_clk_add_provider(np, of_clk_src_simple_get, clk); + } ++CLK_OF_DECLARE(at91rm9200_clk_usb, "atmel,at91rm9200-clk-usb", ++ of_at91rm9200_clk_usb_setup); +diff --git a/drivers/clk/at91/clk-utmi.c b/drivers/clk/at91/clk-utmi.c +index ca561e9..61fcf39 100644 +--- a/drivers/clk/at91/clk-utmi.c ++++ b/drivers/clk/at91/clk-utmi.c +@@ -11,14 +11,9 @@ + #include <linux/clk-provider.h> + #include <linux/clkdev.h> + #include <linux/clk/at91_pmc.h> +-#include <linux/interrupt.h> +-#include <linux/irq.h> + #include <linux/of.h> +-#include <linux/of_address.h> +-#include <linux/of_irq.h> +-#include <linux/io.h> +-#include <linux/sched.h> +-#include <linux/wait.h> ++#include <linux/mfd/syscon.h> ++#include <linux/regmap.h> + + #include "pmc.h" + +@@ -26,37 +21,30 @@ + + struct clk_utmi { + struct clk_hw hw; +- struct at91_pmc *pmc; +- unsigned int irq; +- wait_queue_head_t wait; ++ struct regmap *regmap; + }; + + #define to_clk_utmi(hw) container_of(hw, struct clk_utmi, hw) + +-static irqreturn_t clk_utmi_irq_handler(int irq, void *dev_id) ++static inline bool clk_utmi_ready(struct regmap *regmap) + { +- struct clk_utmi *utmi = (struct clk_utmi *)dev_id; ++ unsigned int status; + +- wake_up(&utmi->wait); +- disable_irq_nosync(utmi->irq); ++ regmap_read(regmap, AT91_PMC_SR, &status); + +- return IRQ_HANDLED; ++ return status & AT91_PMC_LOCKU; + } + + static int clk_utmi_prepare(struct clk_hw *hw) + { + struct clk_utmi *utmi = to_clk_utmi(hw); +- struct at91_pmc *pmc = utmi->pmc; +- u32 tmp = pmc_read(pmc, AT91_CKGR_UCKR) | AT91_PMC_UPLLEN | +- AT91_PMC_UPLLCOUNT | AT91_PMC_BIASEN; ++ unsigned int uckr = AT91_PMC_UPLLEN | AT91_PMC_UPLLCOUNT | ++ AT91_PMC_BIASEN; + +- pmc_write(pmc, AT91_CKGR_UCKR, tmp); ++ regmap_update_bits(utmi->regmap, AT91_CKGR_UCKR, uckr, uckr); + +- while (!(pmc_read(pmc, AT91_PMC_SR) & AT91_PMC_LOCKU)) { +- enable_irq(utmi->irq); +- wait_event(utmi->wait, +- pmc_read(pmc, AT91_PMC_SR) & AT91_PMC_LOCKU); +- } ++ while (!clk_utmi_ready(utmi->regmap)) ++ cpu_relax(); + + return 0; + } +@@ -64,18 +52,15 @@ static int clk_utmi_prepare(struct clk_hw *hw) + static int clk_utmi_is_prepared(struct clk_hw *hw) + { + struct clk_utmi *utmi = to_clk_utmi(hw); +- struct at91_pmc *pmc = utmi->pmc; + +- return !!(pmc_read(pmc, AT91_PMC_SR) & AT91_PMC_LOCKU); ++ return clk_utmi_ready(utmi->regmap); + } + + static void clk_utmi_unprepare(struct clk_hw *hw) + { + struct clk_utmi *utmi = to_clk_utmi(hw); +- struct at91_pmc *pmc = utmi->pmc; +- u32 tmp = pmc_read(pmc, AT91_CKGR_UCKR) & ~AT91_PMC_UPLLEN; + +- pmc_write(pmc, AT91_CKGR_UCKR, tmp); ++ regmap_update_bits(utmi->regmap, AT91_CKGR_UCKR, AT91_PMC_UPLLEN, 0); + } + + static unsigned long clk_utmi_recalc_rate(struct clk_hw *hw, +@@ -93,10 +78,9 @@ static const struct clk_ops utmi_ops = { + }; + + static struct clk * __init +-at91_clk_register_utmi(struct at91_pmc *pmc, unsigned int irq, ++at91_clk_register_utmi(struct regmap *regmap, + const char *name, const char *parent_name) + { +- int ret; + struct clk_utmi *utmi; + struct clk *clk = NULL; + struct clk_init_data init; +@@ -112,52 +96,36 @@ at91_clk_register_utmi(struct at91_pmc *pmc, unsigned int irq, + init.flags = CLK_SET_RATE_GATE; + + utmi->hw.init = &init; +- utmi->pmc = pmc; +- utmi->irq = irq; +- init_waitqueue_head(&utmi->wait); +- irq_set_status_flags(utmi->irq, IRQ_NOAUTOEN); +- ret = request_irq(utmi->irq, clk_utmi_irq_handler, +- IRQF_TRIGGER_HIGH, "clk-utmi", utmi); +- if (ret) { +- kfree(utmi); +- return ERR_PTR(ret); +- } ++ utmi->regmap = regmap; + + clk = clk_register(NULL, &utmi->hw); +- if (IS_ERR(clk)) { +- free_irq(utmi->irq, utmi); ++ if (IS_ERR(clk)) + kfree(utmi); +- } + + return clk; + } + +-static void __init +-of_at91_clk_utmi_setup(struct device_node *np, struct at91_pmc *pmc) ++static void __init of_at91sam9x5_clk_utmi_setup(struct device_node *np) + { +- unsigned int irq; + struct clk *clk; + const char *parent_name; + const char *name = np->name; ++ struct regmap *regmap; + + parent_name = of_clk_get_parent_name(np, 0); + + of_property_read_string(np, "clock-output-names", &name); + +- irq = irq_of_parse_and_map(np, 0); +- if (!irq) ++ regmap = syscon_node_to_regmap(of_get_parent(np)); ++ if (IS_ERR(regmap)) + return; + +- clk = at91_clk_register_utmi(pmc, irq, name, parent_name); ++ clk = at91_clk_register_utmi(regmap, name, parent_name); + if (IS_ERR(clk)) + return; + + of_clk_add_provider(np, of_clk_src_simple_get, clk); + return; + } +- +-void __init of_at91sam9x5_clk_utmi_setup(struct device_node *np, +- struct at91_pmc *pmc) +-{ +- of_at91_clk_utmi_setup(np, pmc); +-} ++CLK_OF_DECLARE(at91sam9x5_clk_utmi, "atmel,at91sam9x5-clk-utmi", ++ of_at91sam9x5_clk_utmi_setup); +diff --git a/drivers/clk/at91/pmc.c b/drivers/clk/at91/pmc.c +index 8476b57..526df5b 100644 +--- a/drivers/clk/at91/pmc.c ++++ b/drivers/clk/at91/pmc.c +@@ -12,36 +12,13 @@ + #include <linux/clkdev.h> + #include <linux/clk/at91_pmc.h> + #include <linux/of.h> +-#include <linux/of_address.h> +-#include <linux/io.h> +-#include <linux/interrupt.h> +-#include <linux/irq.h> +-#include <linux/irqchip/chained_irq.h> +-#include <linux/irqdomain.h> +-#include <linux/of_irq.h> ++#include <linux/mfd/syscon.h> ++#include <linux/regmap.h> + + #include <asm/proc-fns.h> + + #include "pmc.h" + +-void __iomem *at91_pmc_base; +-EXPORT_SYMBOL_GPL(at91_pmc_base); +- +-void at91rm9200_idle(void) +-{ +- /* +- * Disable the processor clock. The processor will be automatically +- * re-enabled by an interrupt or by a reset. +- */ +- at91_pmc_write(AT91_PMC_SCDR, AT91_PMC_PCK); +-} +- +-void at91sam9_idle(void) +-{ +- at91_pmc_write(AT91_PMC_SCDR, AT91_PMC_PCK); +- cpu_do_idle(); +-} +- + int of_at91_get_clk_range(struct device_node *np, const char *propname, + struct clk_range *range) + { +@@ -64,402 +41,3 @@ int of_at91_get_clk_range(struct device_node *np, const char *propname, + return 0; + } + EXPORT_SYMBOL_GPL(of_at91_get_clk_range); +- +-static void pmc_irq_mask(struct irq_data *d) +-{ +- struct at91_pmc *pmc = irq_data_get_irq_chip_data(d); +- +- pmc_write(pmc, AT91_PMC_IDR, 1 << d->hwirq); +-} +- +-static void pmc_irq_unmask(struct irq_data *d) +-{ +- struct at91_pmc *pmc = irq_data_get_irq_chip_data(d); +- +- pmc_write(pmc, AT91_PMC_IER, 1 << d->hwirq); +-} +- +-static int pmc_irq_set_type(struct irq_data *d, unsigned type) +-{ +- if (type != IRQ_TYPE_LEVEL_HIGH) { +- pr_warn("PMC: type not supported (support only IRQ_TYPE_LEVEL_HIGH type)\n"); +- return -EINVAL; +- } +- +- return 0; +-} +- +-static void pmc_irq_suspend(struct irq_data *d) +-{ +- struct at91_pmc *pmc = irq_data_get_irq_chip_data(d); +- +- pmc->imr = pmc_read(pmc, AT91_PMC_IMR); +- pmc_write(pmc, AT91_PMC_IDR, pmc->imr); +-} +- +-static void pmc_irq_resume(struct irq_data *d) +-{ +- struct at91_pmc *pmc = irq_data_get_irq_chip_data(d); +- +- pmc_write(pmc, AT91_PMC_IER, pmc->imr); +-} +- +-static struct irq_chip pmc_irq = { +- .name = "PMC", +- .irq_disable = pmc_irq_mask, +- .irq_mask = pmc_irq_mask, +- .irq_unmask = pmc_irq_unmask, +- .irq_set_type = pmc_irq_set_type, +- .irq_suspend = pmc_irq_suspend, +- .irq_resume = pmc_irq_resume, +-}; +- +-static struct lock_class_key pmc_lock_class; +- +-static int pmc_irq_map(struct irq_domain *h, unsigned int virq, +- irq_hw_number_t hw) +-{ +- struct at91_pmc *pmc = h->host_data; +- +- irq_set_lockdep_class(virq, &pmc_lock_class); +- +- irq_set_chip_and_handler(virq, &pmc_irq, +- handle_level_irq); +- irq_set_chip_data(virq, pmc); +- +- return 0; +-} +- +-static int pmc_irq_domain_xlate(struct irq_domain *d, +- struct device_node *ctrlr, +- const u32 *intspec, unsigned int intsize, +- irq_hw_number_t *out_hwirq, +- unsigned int *out_type) +-{ +- struct at91_pmc *pmc = d->host_data; +- const struct at91_pmc_caps *caps = pmc->caps; +- +- if (WARN_ON(intsize < 1)) +- return -EINVAL; +- +- *out_hwirq = intspec[0]; +- +- if (!(caps->available_irqs & (1 << *out_hwirq))) +- return -EINVAL; +- +- *out_type = IRQ_TYPE_LEVEL_HIGH; +- +- return 0; +-} +- +-static const struct irq_domain_ops pmc_irq_ops = { +- .map = pmc_irq_map, +- .xlate = pmc_irq_domain_xlate, +-}; +- +-static irqreturn_t pmc_irq_handler(int irq, void *data) +-{ +- struct at91_pmc *pmc = (struct at91_pmc *)data; +- unsigned long sr; +- int n; +- +- sr = pmc_read(pmc, AT91_PMC_SR) & pmc_read(pmc, AT91_PMC_IMR); +- if (!sr) +- return IRQ_NONE; +- +- for_each_set_bit(n, &sr, BITS_PER_LONG) +- generic_handle_irq(irq_find_mapping(pmc->irqdomain, n)); +- +- return IRQ_HANDLED; +-} +- +-static const struct at91_pmc_caps at91rm9200_caps = { +- .available_irqs = AT91_PMC_MOSCS | AT91_PMC_LOCKA | AT91_PMC_LOCKB | +- AT91_PMC_MCKRDY | AT91_PMC_PCK0RDY | +- AT91_PMC_PCK1RDY | AT91_PMC_PCK2RDY | +- AT91_PMC_PCK3RDY, +-}; +- +-static const struct at91_pmc_caps at91sam9260_caps = { +- .available_irqs = AT91_PMC_MOSCS | AT91_PMC_LOCKA | AT91_PMC_LOCKB | +- AT91_PMC_MCKRDY | AT91_PMC_PCK0RDY | +- AT91_PMC_PCK1RDY, +-}; +- +-static const struct at91_pmc_caps at91sam9g45_caps = { +- .available_irqs = AT91_PMC_MOSCS | AT91_PMC_LOCKA | AT91_PMC_MCKRDY | +- AT91_PMC_LOCKU | AT91_PMC_PCK0RDY | +- AT91_PMC_PCK1RDY, +-}; +- +-static const struct at91_pmc_caps at91sam9n12_caps = { +- .available_irqs = AT91_PMC_MOSCS | AT91_PMC_LOCKA | AT91_PMC_LOCKB | +- AT91_PMC_MCKRDY | AT91_PMC_PCK0RDY | +- AT91_PMC_PCK1RDY | AT91_PMC_MOSCSELS | +- AT91_PMC_MOSCRCS | AT91_PMC_CFDEV, +-}; +- +-static const struct at91_pmc_caps at91sam9x5_caps = { +- .available_irqs = AT91_PMC_MOSCS | AT91_PMC_LOCKA | AT91_PMC_MCKRDY | +- AT91_PMC_LOCKU | AT91_PMC_PCK0RDY | +- AT91_PMC_PCK1RDY | AT91_PMC_MOSCSELS | +- AT91_PMC_MOSCRCS | AT91_PMC_CFDEV, +-}; +- +-static const struct at91_pmc_caps sama5d2_caps = { +- .available_irqs = AT91_PMC_MOSCS | AT91_PMC_LOCKA | AT91_PMC_MCKRDY | +- AT91_PMC_LOCKU | AT91_PMC_PCK0RDY | +- AT91_PMC_PCK1RDY | AT91_PMC_PCK2RDY | +- AT91_PMC_MOSCSELS | AT91_PMC_MOSCRCS | +- AT91_PMC_CFDEV | AT91_PMC_GCKRDY, +-}; +- +-static const struct at91_pmc_caps sama5d3_caps = { +- .available_irqs = AT91_PMC_MOSCS | AT91_PMC_LOCKA | AT91_PMC_MCKRDY | +- AT91_PMC_LOCKU | AT91_PMC_PCK0RDY | +- AT91_PMC_PCK1RDY | AT91_PMC_PCK2RDY | +- AT91_PMC_MOSCSELS | AT91_PMC_MOSCRCS | +- AT91_PMC_CFDEV, +-}; +- +-static struct at91_pmc *__init at91_pmc_init(struct device_node *np, +- void __iomem *regbase, int virq, +- const struct at91_pmc_caps *caps) +-{ +- struct at91_pmc *pmc; +- +- if (!regbase || !virq || !caps) +- return NULL; +- +- at91_pmc_base = regbase; +- +- pmc = kzalloc(sizeof(*pmc), GFP_KERNEL); +- if (!pmc) +- return NULL; +- +- spin_lock_init(&pmc->lock); +- pmc->regbase = regbase; +- pmc->virq = virq; +- pmc->caps = caps; +- +- pmc->irqdomain = irq_domain_add_linear(np, 32, &pmc_irq_ops, pmc); +- +- if (!pmc->irqdomain) +- goto out_free_pmc; +- +- pmc_write(pmc, AT91_PMC_IDR, 0xffffffff); +- if (request_irq(pmc->virq, pmc_irq_handler, +- IRQF_SHARED | IRQF_COND_SUSPEND, "pmc", pmc)) +- goto out_remove_irqdomain; +- +- return pmc; +- +-out_remove_irqdomain: +- irq_domain_remove(pmc->irqdomain); +-out_free_pmc: +- kfree(pmc); +- +- return NULL; +-} +- +-static const struct of_device_id pmc_clk_ids[] __initconst = { +- /* Slow oscillator */ +- { +- .compatible = "atmel,at91sam9260-clk-slow", +- .data = of_at91sam9260_clk_slow_setup, +- }, +- /* Main clock */ +- { +- .compatible = "atmel,at91rm9200-clk-main-osc", +- .data = of_at91rm9200_clk_main_osc_setup, +- }, +- { +- .compatible = "atmel,at91sam9x5-clk-main-rc-osc", +- .data = of_at91sam9x5_clk_main_rc_osc_setup, +- }, +- { +- .compatible = "atmel,at91rm9200-clk-main", +- .data = of_at91rm9200_clk_main_setup, +- }, +- { +- .compatible = "atmel,at91sam9x5-clk-main", +- .data = of_at91sam9x5_clk_main_setup, +- }, +- /* PLL clocks */ +- { +- .compatible = "atmel,at91rm9200-clk-pll", +- .data = of_at91rm9200_clk_pll_setup, +- }, +- { +- .compatible = "atmel,at91sam9g45-clk-pll", +- .data = of_at91sam9g45_clk_pll_setup, +- }, +- { +- .compatible = "atmel,at91sam9g20-clk-pllb", +- .data = of_at91sam9g20_clk_pllb_setup, +- }, +- { +- .compatible = "atmel,sama5d3-clk-pll", +- .data = of_sama5d3_clk_pll_setup, +- }, +- { +- .compatible = "atmel,at91sam9x5-clk-plldiv", +- .data = of_at91sam9x5_clk_plldiv_setup, +- }, +- /* Master clock */ +- { +- .compatible = "atmel,at91rm9200-clk-master", +- .data = of_at91rm9200_clk_master_setup, +- }, +- { +- .compatible = "atmel,at91sam9x5-clk-master", +- .data = of_at91sam9x5_clk_master_setup, +- }, +- /* System clocks */ +- { +- .compatible = "atmel,at91rm9200-clk-system", +- .data = of_at91rm9200_clk_sys_setup, +- }, +- /* Peripheral clocks */ +- { +- .compatible = "atmel,at91rm9200-clk-peripheral", +- .data = of_at91rm9200_clk_periph_setup, +- }, +- { +- .compatible = "atmel,at91sam9x5-clk-peripheral", +- .data = of_at91sam9x5_clk_periph_setup, +- }, +- /* Programmable clocks */ +- { +- .compatible = "atmel,at91rm9200-clk-programmable", +- .data = of_at91rm9200_clk_prog_setup, +- }, +- { +- .compatible = "atmel,at91sam9g45-clk-programmable", +- .data = of_at91sam9g45_clk_prog_setup, +- }, +- { +- .compatible = "atmel,at91sam9x5-clk-programmable", +- .data = of_at91sam9x5_clk_prog_setup, +- }, +- /* UTMI clock */ +-#if defined(CONFIG_HAVE_AT91_UTMI) +- { +- .compatible = "atmel,at91sam9x5-clk-utmi", +- .data = of_at91sam9x5_clk_utmi_setup, +- }, +-#endif +- /* USB clock */ +-#if defined(CONFIG_HAVE_AT91_USB_CLK) +- { +- .compatible = "atmel,at91rm9200-clk-usb", +- .data = of_at91rm9200_clk_usb_setup, +- }, +- { +- .compatible = "atmel,at91sam9x5-clk-usb", +- .data = of_at91sam9x5_clk_usb_setup, +- }, +- { +- .compatible = "atmel,at91sam9n12-clk-usb", +- .data = of_at91sam9n12_clk_usb_setup, +- }, +-#endif +- /* SMD clock */ +-#if defined(CONFIG_HAVE_AT91_SMD) +- { +- .compatible = "atmel,at91sam9x5-clk-smd", +- .data = of_at91sam9x5_clk_smd_setup, +- }, +-#endif +-#if defined(CONFIG_HAVE_AT91_H32MX) +- { +- .compatible = "atmel,sama5d4-clk-h32mx", +- .data = of_sama5d4_clk_h32mx_setup, +- }, +-#endif +-#if defined(CONFIG_HAVE_AT91_GENERATED_CLK) +- { +- .compatible = "atmel,sama5d2-clk-generated", +- .data = of_sama5d2_clk_generated_setup, +- }, +-#endif +- { /*sentinel*/ } +-}; +- +-static void __init of_at91_pmc_setup(struct device_node *np, +- const struct at91_pmc_caps *caps) +-{ +- struct at91_pmc *pmc; +- struct device_node *childnp; +- void (*clk_setup)(struct device_node *, struct at91_pmc *); +- const struct of_device_id *clk_id; +- void __iomem *regbase = of_iomap(np, 0); +- int virq; +- +- if (!regbase) +- return; +- +- virq = irq_of_parse_and_map(np, 0); +- if (!virq) +- return; +- +- pmc = at91_pmc_init(np, regbase, virq, caps); +- if (!pmc) +- return; +- for_each_child_of_node(np, childnp) { +- clk_id = of_match_node(pmc_clk_ids, childnp); +- if (!clk_id) +- continue; +- clk_setup = clk_id->data; +- clk_setup(childnp, pmc); +- } +-} +- +-static void __init of_at91rm9200_pmc_setup(struct device_node *np) +-{ +- of_at91_pmc_setup(np, &at91rm9200_caps); +-} +-CLK_OF_DECLARE(at91rm9200_clk_pmc, "atmel,at91rm9200-pmc", +- of_at91rm9200_pmc_setup); +- +-static void __init of_at91sam9260_pmc_setup(struct device_node *np) +-{ +- of_at91_pmc_setup(np, &at91sam9260_caps); +-} +-CLK_OF_DECLARE(at91sam9260_clk_pmc, "atmel,at91sam9260-pmc", +- of_at91sam9260_pmc_setup); +- +-static void __init of_at91sam9g45_pmc_setup(struct device_node *np) +-{ +- of_at91_pmc_setup(np, &at91sam9g45_caps); +-} +-CLK_OF_DECLARE(at91sam9g45_clk_pmc, "atmel,at91sam9g45-pmc", +- of_at91sam9g45_pmc_setup); +- +-static void __init of_at91sam9n12_pmc_setup(struct device_node *np) +-{ +- of_at91_pmc_setup(np, &at91sam9n12_caps); +-} +-CLK_OF_DECLARE(at91sam9n12_clk_pmc, "atmel,at91sam9n12-pmc", +- of_at91sam9n12_pmc_setup); +- +-static void __init of_at91sam9x5_pmc_setup(struct device_node *np) +-{ +- of_at91_pmc_setup(np, &at91sam9x5_caps); +-} +-CLK_OF_DECLARE(at91sam9x5_clk_pmc, "atmel,at91sam9x5-pmc", +- of_at91sam9x5_pmc_setup); +- +-static void __init of_sama5d2_pmc_setup(struct device_node *np) +-{ +- of_at91_pmc_setup(np, &sama5d2_caps); +-} +-CLK_OF_DECLARE(sama5d2_clk_pmc, "atmel,sama5d2-pmc", +- of_sama5d2_pmc_setup); +- +-static void __init of_sama5d3_pmc_setup(struct device_node *np) +-{ +- of_at91_pmc_setup(np, &sama5d3_caps); +-} +-CLK_OF_DECLARE(sama5d3_clk_pmc, "atmel,sama5d3-pmc", +- of_sama5d3_pmc_setup); +diff --git a/drivers/clk/at91/pmc.h b/drivers/clk/at91/pmc.h +index f657392..5771fff 100644 +--- a/drivers/clk/at91/pmc.h ++++ b/drivers/clk/at91/pmc.h +@@ -14,8 +14,11 @@ + + #include <linux/io.h> + #include <linux/irqdomain.h> ++#include <linux/regmap.h> + #include <linux/spinlock.h> + ++extern spinlock_t pmc_pcr_lock; ++ + struct clk_range { + unsigned long min; + unsigned long max; +@@ -23,102 +26,7 @@ struct clk_range { + + #define CLK_RANGE(MIN, MAX) {.min = MIN, .max = MAX,} + +-struct at91_pmc_caps { +- u32 available_irqs; +-}; +- +-struct at91_pmc { +- void __iomem *regbase; +- int virq; +- spinlock_t lock; +- const struct at91_pmc_caps *caps; +- struct irq_domain *irqdomain; +- u32 imr; +-}; +- +-static inline void pmc_lock(struct at91_pmc *pmc) +-{ +- spin_lock(&pmc->lock); +-} +- +-static inline void pmc_unlock(struct at91_pmc *pmc) +-{ +- spin_unlock(&pmc->lock); +-} +- +-static inline u32 pmc_read(struct at91_pmc *pmc, int offset) +-{ +- return readl(pmc->regbase + offset); +-} +- +-static inline void pmc_write(struct at91_pmc *pmc, int offset, u32 value) +-{ +- writel(value, pmc->regbase + offset); +-} +- + int of_at91_get_clk_range(struct device_node *np, const char *propname, + struct clk_range *range); + +-void of_at91sam9260_clk_slow_setup(struct device_node *np, +- struct at91_pmc *pmc); +- +-void of_at91rm9200_clk_main_osc_setup(struct device_node *np, +- struct at91_pmc *pmc); +-void of_at91sam9x5_clk_main_rc_osc_setup(struct device_node *np, +- struct at91_pmc *pmc); +-void of_at91rm9200_clk_main_setup(struct device_node *np, +- struct at91_pmc *pmc); +-void of_at91sam9x5_clk_main_setup(struct device_node *np, +- struct at91_pmc *pmc); +- +-void of_at91rm9200_clk_pll_setup(struct device_node *np, +- struct at91_pmc *pmc); +-void of_at91sam9g45_clk_pll_setup(struct device_node *np, +- struct at91_pmc *pmc); +-void of_at91sam9g20_clk_pllb_setup(struct device_node *np, +- struct at91_pmc *pmc); +-void of_sama5d3_clk_pll_setup(struct device_node *np, +- struct at91_pmc *pmc); +-void of_at91sam9x5_clk_plldiv_setup(struct device_node *np, +- struct at91_pmc *pmc); +- +-void of_at91rm9200_clk_master_setup(struct device_node *np, +- struct at91_pmc *pmc); +-void of_at91sam9x5_clk_master_setup(struct device_node *np, +- struct at91_pmc *pmc); +- +-void of_at91rm9200_clk_sys_setup(struct device_node *np, +- struct at91_pmc *pmc); +- +-void of_at91rm9200_clk_periph_setup(struct device_node *np, +- struct at91_pmc *pmc); +-void of_at91sam9x5_clk_periph_setup(struct device_node *np, +- struct at91_pmc *pmc); +- +-void of_at91rm9200_clk_prog_setup(struct device_node *np, +- struct at91_pmc *pmc); +-void of_at91sam9g45_clk_prog_setup(struct device_node *np, +- struct at91_pmc *pmc); +-void of_at91sam9x5_clk_prog_setup(struct device_node *np, +- struct at91_pmc *pmc); +- +-void of_at91sam9x5_clk_utmi_setup(struct device_node *np, +- struct at91_pmc *pmc); +- +-void of_at91rm9200_clk_usb_setup(struct device_node *np, +- struct at91_pmc *pmc); +-void of_at91sam9x5_clk_usb_setup(struct device_node *np, +- struct at91_pmc *pmc); +-void of_at91sam9n12_clk_usb_setup(struct device_node *np, +- struct at91_pmc *pmc); +- +-void of_at91sam9x5_clk_smd_setup(struct device_node *np, +- struct at91_pmc *pmc); +- +-void of_sama5d4_clk_h32mx_setup(struct device_node *np, +- struct at91_pmc *pmc); +- +-void of_sama5d2_clk_generated_setup(struct device_node *np, +- struct at91_pmc *pmc); +- + #endif /* __PMC_H_ */ +diff --git a/drivers/clocksource/tcb_clksrc.c b/drivers/clocksource/tcb_clksrc.c +index 7524941..5b6f57f 100644 +--- a/drivers/clocksource/tcb_clksrc.c ++++ b/drivers/clocksource/tcb_clksrc.c +@@ -73,6 +73,7 @@ static struct clocksource clksrc = { + struct tc_clkevt_device { + struct clock_event_device clkevt; + struct clk *clk; ++ bool clk_enabled; + u32 freq; + void __iomem *regs; + }; +@@ -84,6 +85,24 @@ static struct tc_clkevt_device *to_tc_clkevt(struct clock_event_device *clkevt) + + static u32 timer_clock; + ++static void tc_clk_disable(struct clock_event_device *d) ++{ ++ struct tc_clkevt_device *tcd = to_tc_clkevt(d); ++ ++ clk_disable(tcd->clk); ++ tcd->clk_enabled = false; ++} ++ ++static void tc_clk_enable(struct clock_event_device *d) ++{ ++ struct tc_clkevt_device *tcd = to_tc_clkevt(d); ++ ++ if (tcd->clk_enabled) ++ return; ++ clk_enable(tcd->clk); ++ tcd->clk_enabled = true; ++} ++ + static int tc_shutdown(struct clock_event_device *d) + { + struct tc_clkevt_device *tcd = to_tc_clkevt(d); +@@ -91,8 +110,14 @@ static int tc_shutdown(struct clock_event_device *d) + + __raw_writel(0xff, regs + ATMEL_TC_REG(2, IDR)); + __raw_writel(ATMEL_TC_CLKDIS, regs + ATMEL_TC_REG(2, CCR)); ++ return 0; ++} ++ ++static int tc_shutdown_clk_off(struct clock_event_device *d) ++{ ++ tc_shutdown(d); + if (!clockevent_state_detached(d)) +- clk_disable(tcd->clk); ++ tc_clk_disable(d); + + return 0; + } +@@ -105,7 +130,7 @@ static int tc_set_oneshot(struct clock_event_device *d) + if (clockevent_state_oneshot(d) || clockevent_state_periodic(d)) + tc_shutdown(d); + +- clk_enable(tcd->clk); ++ tc_clk_enable(d); + + /* count up to RC, then irq and stop */ + __raw_writel(timer_clock | ATMEL_TC_CPCSTOP | ATMEL_TC_WAVE | +@@ -127,7 +152,7 @@ static int tc_set_periodic(struct clock_event_device *d) + /* By not making the gentime core emulate periodic mode on top + * of oneshot, we get lower overhead and improved accuracy. + */ +- clk_enable(tcd->clk); ++ tc_clk_enable(d); + + /* count up to RC, then irq and restart */ + __raw_writel(timer_clock | ATMEL_TC_WAVE | ATMEL_TC_WAVESEL_UP_AUTO, +@@ -165,7 +190,7 @@ static struct tc_clkevt_device clkevt = { + .rating = 200, + #endif + .set_next_event = tc_next_event, +- .set_state_shutdown = tc_shutdown, ++ .set_state_shutdown = tc_shutdown_clk_off, + .set_state_periodic = tc_set_periodic, + .set_state_oneshot = tc_set_oneshot, + }, +diff --git a/drivers/clocksource/timer-atmel-pit.c b/drivers/clocksource/timer-atmel-pit.c +index a7abdb6..7a40f7e 100644 +--- a/drivers/clocksource/timer-atmel-pit.c ++++ b/drivers/clocksource/timer-atmel-pit.c +@@ -46,6 +46,7 @@ struct pit_data { + u32 cycle; + u32 cnt; + unsigned int irq; ++ bool irq_requested; + struct clk *mck; + }; + +@@ -96,7 +97,10 @@ static int pit_clkevt_shutdown(struct clock_event_device *dev) + + /* disable irq, leaving the clocksource active */ + pit_write(data->base, AT91_PIT_MR, (data->cycle - 1) | AT91_PIT_PITEN); +- free_irq(data->irq, data); ++ if (data->irq_requested) { ++ free_irq(data->irq, data); ++ data->irq_requested = false; ++ } + return 0; + } + +@@ -115,6 +119,8 @@ static int pit_clkevt_set_periodic(struct clock_event_device *dev) + if (ret) + panic(pr_fmt("Unable to setup IRQ\n")); + ++ data->irq_requested = true; ++ + /* update clocksource counter */ + data->cnt += data->cycle * PIT_PICNT(pit_read(data->base, AT91_PIT_PIVR)); + pit_write(data->base, AT91_PIT_MR, +diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c +index 0f42a27..80a1db0 100644 +--- a/drivers/gpu/drm/i915/i915_irq.c ++++ b/drivers/gpu/drm/i915/i915_irq.c +@@ -812,6 +812,7 @@ static int i915_get_crtc_scanoutpos(struct drm_device *dev, unsigned int pipe, + spin_lock_irqsave(&dev_priv->uncore.lock, irqflags); + + /* preempt_disable_rt() should go right here in PREEMPT_RT patchset. */ ++ preempt_disable_rt(); + + /* Get optional system timestamp before query. */ + if (stime) +@@ -863,6 +864,7 @@ static int i915_get_crtc_scanoutpos(struct drm_device *dev, unsigned int pipe, + *etime = ktime_get(); + + /* preempt_enable_rt() should go right here in PREEMPT_RT patchset. */ ++ preempt_enable_rt(); + + spin_unlock_irqrestore(&dev_priv->uncore.lock, irqflags); + +diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c +index 56dc132..8771d66 100644 +--- a/drivers/gpu/drm/i915/intel_sprite.c ++++ b/drivers/gpu/drm/i915/intel_sprite.c +@@ -38,6 +38,7 @@ + #include "intel_drv.h" + #include <drm/i915_drm.h> + #include "i915_drv.h" ++#include <linux/locallock.h> + + static bool + format_is_yuv(uint32_t format) +@@ -64,6 +65,8 @@ static int usecs_to_scanlines(const struct drm_display_mode *adjusted_mode, + 1000 * adjusted_mode->crtc_htotal); + } + ++static DEFINE_LOCAL_IRQ_LOCK(pipe_update_lock); ++ + /** + * intel_pipe_update_start() - start update of a set of display registers + * @crtc: the crtc of which the registers are going to be updated +@@ -96,7 +99,7 @@ void intel_pipe_update_start(struct intel_crtc *crtc) + min = vblank_start - usecs_to_scanlines(adjusted_mode, 100); + max = vblank_start - 1; + +- local_irq_disable(); ++ local_lock_irq(pipe_update_lock); + + if (min <= 0 || max <= 0) + return; +@@ -126,11 +129,11 @@ void intel_pipe_update_start(struct intel_crtc *crtc) + break; + } + +- local_irq_enable(); ++ local_unlock_irq(pipe_update_lock); + + timeout = schedule_timeout(timeout); + +- local_irq_disable(); ++ local_lock_irq(pipe_update_lock); + } + + finish_wait(wq, &wait); +@@ -164,7 +167,7 @@ void intel_pipe_update_end(struct intel_crtc *crtc) + + trace_i915_pipe_update_end(crtc, end_vbl_count, scanline_end); + +- local_irq_enable(); ++ local_unlock_irq(pipe_update_lock); + + if (crtc->debug.start_vbl_count && + crtc->debug.start_vbl_count != end_vbl_count) { +diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c +index 3645b22..642854b 100644 +--- a/drivers/gpu/drm/radeon/radeon_display.c ++++ b/drivers/gpu/drm/radeon/radeon_display.c +@@ -1862,6 +1862,7 @@ int radeon_get_crtc_scanoutpos(struct drm_device *dev, unsigned int pipe, + struct radeon_device *rdev = dev->dev_private; + + /* preempt_disable_rt() should go right here in PREEMPT_RT patchset. */ ++ preempt_disable_rt(); + + /* Get optional system timestamp before query. */ + if (stime) +@@ -1954,6 +1955,7 @@ int radeon_get_crtc_scanoutpos(struct drm_device *dev, unsigned int pipe, + *etime = ktime_get(); + + /* preempt_enable_rt() should go right here in PREEMPT_RT patchset. */ ++ preempt_enable_rt(); + + /* Decode into vertical and horizontal scanout position. */ + *vpos = position & 0x1fff; +diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c +index fc836f5..f417aafe 100644 +--- a/drivers/iommu/amd_iommu.c ++++ b/drivers/iommu/amd_iommu.c +@@ -1952,10 +1952,10 @@ static int __attach_device(struct iommu_dev_data *dev_data, + int ret; + + /* +- * Must be called with IRQs disabled. Warn here to detect early +- * when its not. ++ * Must be called with IRQs disabled on a non RT kernel. Warn here to ++ * detect early when its not. + */ +- WARN_ON(!irqs_disabled()); ++ WARN_ON_NONRT(!irqs_disabled()); + + /* lock domain */ + spin_lock(&domain->lock); +@@ -2118,10 +2118,10 @@ static void __detach_device(struct iommu_dev_data *dev_data) + struct protection_domain *domain; + + /* +- * Must be called with IRQs disabled. Warn here to detect early +- * when its not. ++ * Must be called with IRQs disabled on a non RT kernel. Warn here to ++ * detect early when its not. + */ +- WARN_ON(!irqs_disabled()); ++ WARN_ON_NONRT(!irqs_disabled()); + + if (WARN_ON(!dev_data->domain)) + return; +diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c +index edb5305..7d5ee8a 100644 +--- a/drivers/tty/serial/sc16is7xx.c ++++ b/drivers/tty/serial/sc16is7xx.c +@@ -1230,7 +1230,7 @@ static int sc16is7xx_probe(struct device *dev, + + /* Setup interrupt */ + ret = devm_request_irq(dev, irq, sc16is7xx_irq, +- IRQF_ONESHOT | flags, dev_name(dev), s); ++ flags, dev_name(dev), s); + if (!ret) + return 0; + +diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c +index 3ba63db..4d47528 100644 +--- a/drivers/usb/gadget/function/f_fs.c ++++ b/drivers/usb/gadget/function/f_fs.c +@@ -1405,7 +1405,7 @@ static void ffs_data_put(struct ffs_data *ffs) + pr_info("%s(): freeing\n", __func__); + ffs_data_clear(ffs); + BUG_ON(waitqueue_active(&ffs->ev.waitq) || +- swaitqueue_active(&ffs->ep0req_completion.wait)); ++ swait_active(&ffs->ep0req_completion.wait)); + kfree(ffs->dev_name); + kfree(ffs); + } +diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c b/drivers/usb/gadget/udc/atmel_usba_udc.c +index f92f5af..f9bba26 100644 +--- a/drivers/usb/gadget/udc/atmel_usba_udc.c ++++ b/drivers/usb/gadget/udc/atmel_usba_udc.c +@@ -17,7 +17,9 @@ + #include <linux/device.h> + #include <linux/dma-mapping.h> + #include <linux/list.h> ++#include <linux/mfd/syscon.h> + #include <linux/platform_device.h> ++#include <linux/regmap.h> + #include <linux/usb/ch9.h> + #include <linux/usb/gadget.h> + #include <linux/usb/atmel_usba_udc.h> +@@ -1888,20 +1890,15 @@ static int atmel_usba_stop(struct usb_gadget *gadget) + #ifdef CONFIG_OF + static void at91sam9rl_toggle_bias(struct usba_udc *udc, int is_on) + { +- unsigned int uckr = at91_pmc_read(AT91_CKGR_UCKR); +- +- if (is_on) +- at91_pmc_write(AT91_CKGR_UCKR, uckr | AT91_PMC_BIASEN); +- else +- at91_pmc_write(AT91_CKGR_UCKR, uckr & ~(AT91_PMC_BIASEN)); ++ regmap_update_bits(udc->pmc, AT91_CKGR_UCKR, AT91_PMC_BIASEN, ++ is_on ? AT91_PMC_BIASEN : 0); + } + + static void at91sam9g45_pulse_bias(struct usba_udc *udc) + { +- unsigned int uckr = at91_pmc_read(AT91_CKGR_UCKR); +- +- at91_pmc_write(AT91_CKGR_UCKR, uckr & ~(AT91_PMC_BIASEN)); +- at91_pmc_write(AT91_CKGR_UCKR, uckr | AT91_PMC_BIASEN); ++ regmap_update_bits(udc->pmc, AT91_CKGR_UCKR, AT91_PMC_BIASEN, 0); ++ regmap_update_bits(udc->pmc, AT91_CKGR_UCKR, AT91_PMC_BIASEN, ++ AT91_PMC_BIASEN); + } + + static const struct usba_udc_errata at91sam9rl_errata = { +@@ -1938,6 +1935,9 @@ static struct usba_ep * atmel_udc_of_init(struct platform_device *pdev, + return ERR_PTR(-EINVAL); + + udc->errata = match->data; ++ udc->pmc = syscon_regmap_lookup_by_compatible("atmel,at91sam9g45-pmc"); ++ if (udc->errata && IS_ERR(udc->pmc)) ++ return ERR_CAST(udc->pmc); + + udc->num_ep = 0; + +diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.h b/drivers/usb/gadget/udc/atmel_usba_udc.h +index ea448a3..3e1c9d5 100644 +--- a/drivers/usb/gadget/udc/atmel_usba_udc.h ++++ b/drivers/usb/gadget/udc/atmel_usba_udc.h +@@ -354,6 +354,8 @@ struct usba_udc { + struct dentry *debugfs_root; + struct dentry *debugfs_regs; + #endif ++ ++ struct regmap *pmc; + }; + + static inline struct usba_ep *to_usba_ep(struct usb_ep *ep) +diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c +index 9c62a6f..9e08447 100644 +--- a/fs/btrfs/volumes.c ++++ b/fs/btrfs/volumes.c +@@ -232,7 +232,6 @@ static struct btrfs_device *__alloc_device(void) + spin_lock_init(&dev->reada_lock); + atomic_set(&dev->reada_in_flight, 0); + atomic_set(&dev->dev_stats_ccnt, 0); +- btrfs_device_data_ordered_init(dev); + INIT_RADIX_TREE(&dev->reada_zones, GFP_NOFS & ~__GFP_DIRECT_RECLAIM); + INIT_RADIX_TREE(&dev->reada_extents, GFP_NOFS & ~__GFP_DIRECT_RECLAIM); + +diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h +index 9db5500..5951c49 100644 +--- a/fs/f2fs/f2fs.h ++++ b/fs/f2fs/f2fs.h +@@ -24,7 +24,6 @@ + + #ifdef CONFIG_F2FS_CHECK_FS + #define f2fs_bug_on(sbi, condition) BUG_ON(condition) +-#define f2fs_down_write(x, y) down_write_nest_lock(x, y) + #else + #define f2fs_bug_on(sbi, condition) \ + do { \ +@@ -33,7 +32,6 @@ + set_sbi_flag(sbi, SBI_NEED_FSCK); \ + } \ + } while (0) +-#define f2fs_down_write(x, y) down_write(x) + #endif + + /* +@@ -959,7 +957,7 @@ static inline void f2fs_unlock_op(struct f2fs_sb_info *sbi) + + static inline void f2fs_lock_all(struct f2fs_sb_info *sbi) + { +- f2fs_down_write(&sbi->cp_rwsem, &sbi->cp_mutex); ++ down_write(&sbi->cp_rwsem); + } + + static inline void f2fs_unlock_all(struct f2fs_sb_info *sbi) +diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h +index fff4ec1..a8f18e0 100644 +--- a/include/linux/blkdev.h ++++ b/include/linux/blkdev.h +@@ -456,7 +456,7 @@ struct request_queue { + struct throtl_data *td; + #endif + struct rcu_head rcu_head; +- struct swait_head mq_freeze_wq; ++ struct swait_queue_head mq_freeze_wq; + struct percpu_ref q_usage_counter; + struct list_head all_q_node; + +diff --git a/include/linux/clk/at91_pmc.h b/include/linux/clk/at91_pmc.h +index 1e69322..17f413b 100644 +--- a/include/linux/clk/at91_pmc.h ++++ b/include/linux/clk/at91_pmc.h +@@ -16,18 +16,6 @@ + #ifndef AT91_PMC_H + #define AT91_PMC_H + +-#ifndef __ASSEMBLY__ +-extern void __iomem *at91_pmc_base; +- +-#define at91_pmc_read(field) \ +- readl_relaxed(at91_pmc_base + field) +- +-#define at91_pmc_write(field, value) \ +- writel_relaxed(value, at91_pmc_base + field) +-#else +-.extern at91_pmc_base +-#endif +- + #define AT91_PMC_SCER 0x00 /* System Clock Enable Register */ + #define AT91_PMC_SCDR 0x04 /* System Clock Disable Register */ + +diff --git a/include/linux/completion.h b/include/linux/completion.h +index 3fe8d14..3bca159 100644 +--- a/include/linux/completion.h ++++ b/include/linux/completion.h +@@ -7,7 +7,7 @@ + * Atomic wait-for-completion handler data structures. + * See kernel/sched/completion.c for details. + */ +-#include <linux/wait-simple.h> ++#include <linux/swait.h> + + /* + * struct completion - structure used to maintain state for a "completion" +@@ -23,11 +23,11 @@ + */ + struct completion { + unsigned int done; +- struct swait_head wait; ++ struct swait_queue_head wait; + }; + + #define COMPLETION_INITIALIZER(work) \ +- { 0, SWAIT_HEAD_INITIALIZER((work).wait) } ++ { 0, __SWAIT_QUEUE_HEAD_INITIALIZER((work).wait) } + + #define COMPLETION_INITIALIZER_ONSTACK(work) \ + ({ init_completion(&work); work; }) +@@ -72,7 +72,7 @@ struct completion { + static inline void init_completion(struct completion *x) + { + x->done = 0; +- init_swait_head(&x->wait); ++ init_swait_queue_head(&x->wait); + } + + /** +diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h +index 60048c5..f2cd676 100644 +--- a/include/linux/ftrace.h ++++ b/include/linux/ftrace.h +@@ -694,6 +694,18 @@ static inline void __ftrace_enabled_restore(int enabled) + #define CALLER_ADDR5 ((unsigned long)ftrace_return_address(5)) + #define CALLER_ADDR6 ((unsigned long)ftrace_return_address(6)) + ++static inline unsigned long get_lock_parent_ip(void) ++{ ++ unsigned long addr = CALLER_ADDR0; ++ ++ if (!in_lock_functions(addr)) ++ return addr; ++ addr = CALLER_ADDR1; ++ if (!in_lock_functions(addr)) ++ return addr; ++ return CALLER_ADDR2; ++} ++ + #ifdef CONFIG_IRQSOFF_TRACER + extern void time_hardirqs_on(unsigned long a0, unsigned long a1); + extern void time_hardirqs_off(unsigned long a0, unsigned long a1); +diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h +index f606864..8fbcdfa 100644 +--- a/include/linux/hrtimer.h ++++ b/include/linux/hrtimer.h +@@ -91,7 +91,7 @@ enum hrtimer_restart { + * @irqsafe: timer can run in hardirq context + * @praecox: timer expiry time if expired at the time of programming + * @is_rel: Set if the timer was armed relative +- * @start_pid: timer statistics field to store the pid of the task which ++ * @start_pid: timer statistics field to store the pid of the task which + * started the timer + * @start_site: timer statistics field to store the site where the timer + * was started +diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h +index d856ccd..c690acc 100644 +--- a/include/linux/kvm_host.h ++++ b/include/linux/kvm_host.h +@@ -25,6 +25,7 @@ + #include <linux/irqflags.h> + #include <linux/context_tracking.h> + #include <linux/irqbypass.h> ++#include <linux/swait.h> + #include <asm/signal.h> + + #include <linux/kvm.h> +@@ -243,7 +244,7 @@ struct kvm_vcpu { + int fpu_active; + int guest_fpu_loaded, guest_xcr0_loaded; + unsigned char fpu_counter; +- struct swait_head wq; ++ struct swait_queue_head wq; + struct pid *pid; + int sigset_active; + sigset_t sigset; +@@ -794,7 +795,7 @@ static inline bool kvm_arch_has_assigned_device(struct kvm *kvm) + } + #endif + +-static inline struct swait_head *kvm_arch_vcpu_wq(struct kvm_vcpu *vcpu) ++static inline struct swait_queue_head *kvm_arch_vcpu_wq(struct kvm_vcpu *vcpu) + { + #ifdef __KVM_HAVE_ARCH_WQP + return vcpu->arch.wqp; +diff --git a/include/linux/list_bl.h b/include/linux/list_bl.h +index 44f0b55..89ffaa7 100644 +--- a/include/linux/list_bl.h ++++ b/include/linux/list_bl.h +@@ -42,13 +42,15 @@ struct hlist_bl_node { + struct hlist_bl_node *next, **pprev; + }; + +-static inline void INIT_HLIST_BL_HEAD(struct hlist_bl_head *h) +-{ +- h->first = NULL; + #ifdef CONFIG_PREEMPT_RT_BASE +- raw_spin_lock_init(&h->lock); ++#define INIT_HLIST_BL_HEAD(h) \ ++do { \ ++ (h)->first = NULL; \ ++ raw_spin_lock_init(&(h)->lock); \ ++} while (0) ++#else ++#define INIT_HLIST_BL_HEAD(h) (h)->first = NULL + #endif +-} + + static inline void INIT_HLIST_BL_NODE(struct hlist_bl_node *h) + { +diff --git a/include/linux/locallock.h b/include/linux/locallock.h +index 339ba00..6fe5928 100644 +--- a/include/linux/locallock.h ++++ b/include/linux/locallock.h +@@ -43,9 +43,9 @@ struct local_irq_lock { + * for CONFIG_PREEMPT_BASE map to the normal spin_* calls. + */ + #ifdef CONFIG_PREEMPT_RT_FULL +-# define spin_lock_local(lock) rt_spin_lock(lock) +-# define spin_trylock_local(lock) rt_spin_trylock(lock) +-# define spin_unlock_local(lock) rt_spin_unlock(lock) ++# define spin_lock_local(lock) rt_spin_lock__no_mg(lock) ++# define spin_trylock_local(lock) rt_spin_trylock__no_mg(lock) ++# define spin_unlock_local(lock) rt_spin_unlock__no_mg(lock) + #else + # define spin_lock_local(lock) spin_lock(lock) + # define spin_trylock_local(lock) spin_trylock(lock) +diff --git a/include/linux/sched.h b/include/linux/sched.h +index b6a2358..58c5ec8 100644 +--- a/include/linux/sched.h ++++ b/include/linux/sched.h +@@ -183,8 +183,6 @@ extern void update_cpu_load_nohz(void); + static inline void update_cpu_load_nohz(void) { } + #endif + +-extern unsigned long get_parent_ip(unsigned long addr); +- + extern void dump_cpu_task(int cpu); + + struct seq_file; +diff --git a/include/linux/spinlock_rt.h b/include/linux/spinlock_rt.h +index f757096..3b28255 100644 +--- a/include/linux/spinlock_rt.h ++++ b/include/linux/spinlock_rt.h +@@ -18,6 +18,10 @@ do { \ + __rt_spin_lock_init(slock, #slock, &__key); \ + } while (0) + ++void __lockfunc rt_spin_lock__no_mg(spinlock_t *lock); ++void __lockfunc rt_spin_unlock__no_mg(spinlock_t *lock); ++int __lockfunc rt_spin_trylock__no_mg(spinlock_t *lock); ++ + extern void __lockfunc rt_spin_lock(spinlock_t *lock); + extern unsigned long __lockfunc rt_spin_lock_trace_flags(spinlock_t *lock); + extern void __lockfunc rt_spin_lock_nested(spinlock_t *lock, int subclass); +@@ -32,20 +36,16 @@ extern int atomic_dec_and_spin_lock(atomic_t *atomic, spinlock_t *lock); + * lockdep-less calls, for derived types like rwlock: + * (for trylock they can use rt_mutex_trylock() directly. + */ ++extern void __lockfunc __rt_spin_lock__no_mg(struct rt_mutex *lock); + extern void __lockfunc __rt_spin_lock(struct rt_mutex *lock); + extern void __lockfunc __rt_spin_unlock(struct rt_mutex *lock); + extern int __lockfunc __rt_spin_trylock(struct rt_mutex *lock); + +-#define spin_lock(lock) \ +- do { \ +- migrate_disable(); \ +- rt_spin_lock(lock); \ +- } while (0) ++#define spin_lock(lock) rt_spin_lock(lock) + + #define spin_lock_bh(lock) \ + do { \ + local_bh_disable(); \ +- migrate_disable(); \ + rt_spin_lock(lock); \ + } while (0) + +@@ -56,24 +56,19 @@ extern int __lockfunc __rt_spin_trylock(struct rt_mutex *lock); + #define spin_trylock(lock) \ + ({ \ + int __locked; \ +- migrate_disable(); \ + __locked = spin_do_trylock(lock); \ +- if (!__locked) \ +- migrate_enable(); \ + __locked; \ + }) + + #ifdef CONFIG_LOCKDEP + # define spin_lock_nested(lock, subclass) \ + do { \ +- migrate_disable(); \ + rt_spin_lock_nested(lock, subclass); \ + } while (0) + + #define spin_lock_bh_nested(lock, subclass) \ + do { \ + local_bh_disable(); \ +- migrate_disable(); \ + rt_spin_lock_nested(lock, subclass); \ + } while (0) + +@@ -81,7 +76,6 @@ extern int __lockfunc __rt_spin_trylock(struct rt_mutex *lock); + do { \ + typecheck(unsigned long, flags); \ + flags = 0; \ +- migrate_disable(); \ + rt_spin_lock_nested(lock, subclass); \ + } while (0) + #else +@@ -117,16 +111,11 @@ static inline unsigned long spin_lock_trace_flags(spinlock_t *lock) + /* FIXME: we need rt_spin_lock_nest_lock */ + #define spin_lock_nest_lock(lock, nest_lock) spin_lock_nested(lock, 0) + +-#define spin_unlock(lock) \ +- do { \ +- rt_spin_unlock(lock); \ +- migrate_enable(); \ +- } while (0) ++#define spin_unlock(lock) rt_spin_unlock(lock) + + #define spin_unlock_bh(lock) \ + do { \ + rt_spin_unlock(lock); \ +- migrate_enable(); \ + local_bh_enable(); \ + } while (0) + +diff --git a/include/linux/suspend.h b/include/linux/suspend.h +index 8b6ec7e..9b77d4c 100644 +--- a/include/linux/suspend.h ++++ b/include/linux/suspend.h +@@ -194,6 +194,12 @@ struct platform_freeze_ops { + void (*end)(void); + }; + ++#if defined(CONFIG_SUSPEND) || defined(CONFIG_HIBERNATION) ++extern bool pm_in_action; ++#else ++# define pm_in_action false ++#endif ++ + #ifdef CONFIG_SUSPEND + /** + * suspend_set_ops - set platform dependent suspend operations +diff --git a/include/linux/swait.h b/include/linux/swait.h +new file mode 100644 +index 0000000..83f004a +--- /dev/null ++++ b/include/linux/swait.h +@@ -0,0 +1,173 @@ ++#ifndef _LINUX_SWAIT_H ++#define _LINUX_SWAIT_H ++ ++#include <linux/list.h> ++#include <linux/stddef.h> ++#include <linux/spinlock.h> ++#include <asm/current.h> ++ ++/* ++ * Simple wait queues ++ * ++ * While these are very similar to the other/complex wait queues (wait.h) the ++ * most important difference is that the simple waitqueue allows for ++ * deterministic behaviour -- IOW it has strictly bounded IRQ and lock hold ++ * times. ++ * ++ * In order to make this so, we had to drop a fair number of features of the ++ * other waitqueue code; notably: ++ * ++ * - mixing INTERRUPTIBLE and UNINTERRUPTIBLE sleeps on the same waitqueue; ++ * all wakeups are TASK_NORMAL in order to avoid O(n) lookups for the right ++ * sleeper state. ++ * ++ * - the exclusive mode; because this requires preserving the list order ++ * and this is hard. ++ * ++ * - custom wake functions; because you cannot give any guarantees about ++ * random code. ++ * ++ * As a side effect of this; the data structures are slimmer. ++ * ++ * One would recommend using this wait queue where possible. ++ */ ++ ++struct task_struct; ++ ++struct swait_queue_head { ++ raw_spinlock_t lock; ++ struct list_head task_list; ++}; ++ ++struct swait_queue { ++ struct task_struct *task; ++ struct list_head task_list; ++}; ++ ++#define __SWAITQUEUE_INITIALIZER(name) { \ ++ .task = current, \ ++ .task_list = LIST_HEAD_INIT((name).task_list), \ ++} ++ ++#define DECLARE_SWAITQUEUE(name) \ ++ struct swait_queue name = __SWAITQUEUE_INITIALIZER(name) ++ ++#define __SWAIT_QUEUE_HEAD_INITIALIZER(name) { \ ++ .lock = __RAW_SPIN_LOCK_UNLOCKED(name.lock), \ ++ .task_list = LIST_HEAD_INIT((name).task_list), \ ++} ++ ++#define DECLARE_SWAIT_QUEUE_HEAD(name) \ ++ struct swait_queue_head name = __SWAIT_QUEUE_HEAD_INITIALIZER(name) ++ ++extern void __init_swait_queue_head(struct swait_queue_head *q, const char *name, ++ struct lock_class_key *key); ++ ++#define init_swait_queue_head(q) \ ++ do { \ ++ static struct lock_class_key __key; \ ++ __init_swait_queue_head((q), #q, &__key); \ ++ } while (0) ++ ++#ifdef CONFIG_LOCKDEP ++# define __SWAIT_QUEUE_HEAD_INIT_ONSTACK(name) \ ++ ({ init_swait_queue_head(&name); name; }) ++# define DECLARE_SWAIT_QUEUE_HEAD_ONSTACK(name) \ ++ struct swait_queue_head name = __SWAIT_QUEUE_HEAD_INIT_ONSTACK(name) ++#else ++# define DECLARE_SWAIT_QUEUE_HEAD_ONSTACK(name) \ ++ DECLARE_SWAIT_QUEUE_HEAD(name) ++#endif ++ ++static inline int swait_active(struct swait_queue_head *q) ++{ ++ return !list_empty(&q->task_list); ++} ++ ++extern void swake_up(struct swait_queue_head *q); ++extern void swake_up_all(struct swait_queue_head *q); ++extern void swake_up_locked(struct swait_queue_head *q); ++extern void swake_up_all_locked(struct swait_queue_head *q); ++ ++extern void __prepare_to_swait(struct swait_queue_head *q, struct swait_queue *wait); ++extern void prepare_to_swait(struct swait_queue_head *q, struct swait_queue *wait, int state); ++extern long prepare_to_swait_event(struct swait_queue_head *q, struct swait_queue *wait, int state); ++ ++extern void __finish_swait(struct swait_queue_head *q, struct swait_queue *wait); ++extern void finish_swait(struct swait_queue_head *q, struct swait_queue *wait); ++ ++/* as per ___wait_event() but for swait, therefore "exclusive == 0" */ ++#define ___swait_event(wq, condition, state, ret, cmd) \ ++({ \ ++ struct swait_queue __wait; \ ++ long __ret = ret; \ ++ \ ++ INIT_LIST_HEAD(&__wait.task_list); \ ++ for (;;) { \ ++ long __int = prepare_to_swait_event(&wq, &__wait, state);\ ++ \ ++ if (condition) \ ++ break; \ ++ \ ++ if (___wait_is_interruptible(state) && __int) { \ ++ __ret = __int; \ ++ break; \ ++ } \ ++ \ ++ cmd; \ ++ } \ ++ finish_swait(&wq, &__wait); \ ++ __ret; \ ++}) ++ ++#define __swait_event(wq, condition) \ ++ (void)___swait_event(wq, condition, TASK_UNINTERRUPTIBLE, 0, \ ++ schedule()) ++ ++#define swait_event(wq, condition) \ ++do { \ ++ if (condition) \ ++ break; \ ++ __swait_event(wq, condition); \ ++} while (0) ++ ++#define __swait_event_timeout(wq, condition, timeout) \ ++ ___swait_event(wq, ___wait_cond_timeout(condition), \ ++ TASK_UNINTERRUPTIBLE, timeout, \ ++ __ret = schedule_timeout(__ret)) ++ ++#define swait_event_timeout(wq, condition, timeout) \ ++({ \ ++ long __ret = timeout; \ ++ if (!___wait_cond_timeout(condition)) \ ++ __ret = __swait_event_timeout(wq, condition, timeout); \ ++ __ret; \ ++}) ++ ++#define __swait_event_interruptible(wq, condition) \ ++ ___swait_event(wq, condition, TASK_INTERRUPTIBLE, 0, \ ++ schedule()) ++ ++#define swait_event_interruptible(wq, condition) \ ++({ \ ++ int __ret = 0; \ ++ if (!(condition)) \ ++ __ret = __swait_event_interruptible(wq, condition); \ ++ __ret; \ ++}) ++ ++#define __swait_event_interruptible_timeout(wq, condition, timeout) \ ++ ___swait_event(wq, ___wait_cond_timeout(condition), \ ++ TASK_INTERRUPTIBLE, timeout, \ ++ __ret = schedule_timeout(__ret)) ++ ++#define swait_event_interruptible_timeout(wq, condition, timeout) \ ++({ \ ++ long __ret = timeout; \ ++ if (!___wait_cond_timeout(condition)) \ ++ __ret = __swait_event_interruptible_timeout(wq, \ ++ condition, timeout); \ ++ __ret; \ ++}) ++ ++#endif /* _LINUX_SWAIT_H */ +diff --git a/include/linux/wait-simple.h b/include/linux/wait-simple.h +deleted file mode 100644 +index f86bca2..0000000 +--- a/include/linux/wait-simple.h ++++ /dev/null +@@ -1,207 +0,0 @@ +-#ifndef _LINUX_WAIT_SIMPLE_H +-#define _LINUX_WAIT_SIMPLE_H +- +-#include <linux/spinlock.h> +-#include <linux/list.h> +- +-#include <asm/current.h> +- +-struct swaiter { +- struct task_struct *task; +- struct list_head node; +-}; +- +-#define DEFINE_SWAITER(name) \ +- struct swaiter name = { \ +- .task = current, \ +- .node = LIST_HEAD_INIT((name).node), \ +- } +- +-struct swait_head { +- raw_spinlock_t lock; +- struct list_head list; +-}; +- +-#define SWAIT_HEAD_INITIALIZER(name) { \ +- .lock = __RAW_SPIN_LOCK_UNLOCKED(name.lock), \ +- .list = LIST_HEAD_INIT((name).list), \ +- } +- +-#define DEFINE_SWAIT_HEAD(name) \ +- struct swait_head name = SWAIT_HEAD_INITIALIZER(name) +- +-extern void __init_swait_head(struct swait_head *h, struct lock_class_key *key); +- +-#define init_swait_head(swh) \ +- do { \ +- static struct lock_class_key __key; \ +- \ +- __init_swait_head((swh), &__key); \ +- } while (0) +- +-/* +- * Waiter functions +- */ +-extern void swait_prepare_locked(struct swait_head *head, struct swaiter *w); +-extern void swait_prepare(struct swait_head *head, struct swaiter *w, int state); +-extern void swait_finish_locked(struct swait_head *head, struct swaiter *w); +-extern void swait_finish(struct swait_head *head, struct swaiter *w); +- +-/* Check whether a head has waiters enqueued */ +-static inline bool swaitqueue_active(struct swait_head *h) +-{ +- /* Make sure the condition is visible before checking list_empty() */ +- smp_mb(); +- return !list_empty(&h->list); +-} +- +-/* +- * Wakeup functions +- */ +-extern unsigned int __swait_wake(struct swait_head *head, unsigned int state, unsigned int num); +-extern unsigned int __swait_wake_locked(struct swait_head *head, unsigned int state, unsigned int num); +- +-#define swait_wake(head) __swait_wake(head, TASK_NORMAL, 1) +-#define swait_wake_interruptible(head) __swait_wake(head, TASK_INTERRUPTIBLE, 1) +-#define swait_wake_all(head) __swait_wake(head, TASK_NORMAL, 0) +-#define swait_wake_all_interruptible(head) __swait_wake(head, TASK_INTERRUPTIBLE, 0) +- +-/* +- * Event API +- */ +-#define __swait_event(wq, condition) \ +-do { \ +- DEFINE_SWAITER(__wait); \ +- \ +- for (;;) { \ +- swait_prepare(&wq, &__wait, TASK_UNINTERRUPTIBLE); \ +- if (condition) \ +- break; \ +- schedule(); \ +- } \ +- swait_finish(&wq, &__wait); \ +-} while (0) +- +-/** +- * swait_event - sleep until a condition gets true +- * @wq: the waitqueue to wait on +- * @condition: a C expression for the event to wait for +- * +- * The process is put to sleep (TASK_UNINTERRUPTIBLE) until the +- * @condition evaluates to true. The @condition is checked each time +- * the waitqueue @wq is woken up. +- * +- * wake_up() has to be called after changing any variable that could +- * change the result of the wait condition. +- */ +-#define swait_event(wq, condition) \ +-do { \ +- if (condition) \ +- break; \ +- __swait_event(wq, condition); \ +-} while (0) +- +-#define __swait_event_interruptible(wq, condition, ret) \ +-do { \ +- DEFINE_SWAITER(__wait); \ +- \ +- for (;;) { \ +- swait_prepare(&wq, &__wait, TASK_INTERRUPTIBLE); \ +- if (condition) \ +- break; \ +- if (signal_pending(current)) { \ +- ret = -ERESTARTSYS; \ +- break; \ +- } \ +- schedule(); \ +- } \ +- swait_finish(&wq, &__wait); \ +-} while (0) +- +-#define __swait_event_interruptible_timeout(wq, condition, ret) \ +-do { \ +- DEFINE_SWAITER(__wait); \ +- \ +- for (;;) { \ +- swait_prepare(&wq, &__wait, TASK_INTERRUPTIBLE); \ +- if (condition) \ +- break; \ +- if (signal_pending(current)) { \ +- ret = -ERESTARTSYS; \ +- break; \ +- } \ +- ret = schedule_timeout(ret); \ +- if (!ret) \ +- break; \ +- } \ +- swait_finish(&wq, &__wait); \ +-} while (0) +- +-/** +- * swait_event_interruptible - sleep until a condition gets true +- * @wq: the waitqueue to wait on +- * @condition: a C expression for the event to wait for +- * +- * The process is put to sleep (TASK_INTERRUPTIBLE) until the +- * @condition evaluates to true. The @condition is checked each time +- * the waitqueue @wq is woken up. +- * +- * wake_up() has to be called after changing any variable that could +- * change the result of the wait condition. +- */ +-#define swait_event_interruptible(wq, condition) \ +-({ \ +- int __ret = 0; \ +- if (!(condition)) \ +- __swait_event_interruptible(wq, condition, __ret); \ +- __ret; \ +-}) +- +-#define swait_event_interruptible_timeout(wq, condition, timeout) \ +-({ \ +- int __ret = timeout; \ +- if (!(condition)) \ +- __swait_event_interruptible_timeout(wq, condition, __ret); \ +- __ret; \ +-}) +- +-#define __swait_event_timeout(wq, condition, ret) \ +-do { \ +- DEFINE_SWAITER(__wait); \ +- \ +- for (;;) { \ +- swait_prepare(&wq, &__wait, TASK_UNINTERRUPTIBLE); \ +- if (condition) \ +- break; \ +- ret = schedule_timeout(ret); \ +- if (!ret) \ +- break; \ +- } \ +- swait_finish(&wq, &__wait); \ +-} while (0) +- +-/** +- * swait_event_timeout - sleep until a condition gets true or a timeout elapses +- * @wq: the waitqueue to wait on +- * @condition: a C expression for the event to wait for +- * @timeout: timeout, in jiffies +- * +- * The process is put to sleep (TASK_UNINTERRUPTIBLE) until the +- * @condition evaluates to true. The @condition is checked each time +- * the waitqueue @wq is woken up. +- * +- * wake_up() has to be called after changing any variable that could +- * change the result of the wait condition. +- * +- * The function returns 0 if the @timeout elapsed, and the remaining +- * jiffies if the condition evaluated to true before the timeout elapsed. +- */ +-#define swait_event_timeout(wq, condition, timeout) \ +-({ \ +- long __ret = timeout; \ +- if (!(condition)) \ +- __swait_event_timeout(wq, condition, __ret); \ +- __ret; \ +-}) +- +-#endif +diff --git a/include/trace/events/hist.h b/include/trace/events/hist.h +index 6122e42..f7710de 100644 +--- a/include/trace/events/hist.h ++++ b/include/trace/events/hist.h +@@ -9,6 +9,7 @@ + + #if !defined(CONFIG_PREEMPT_OFF_HIST) && !defined(CONFIG_INTERRUPT_OFF_HIST) + #define trace_preemptirqsoff_hist(a, b) ++#define trace_preemptirqsoff_hist_rcuidle(a, b) + #else + TRACE_EVENT(preemptirqsoff_hist, + +diff --git a/include/trace/events/writeback.h b/include/trace/events/writeback.h +index fff846b..73614ce 100644 +--- a/include/trace/events/writeback.h ++++ b/include/trace/events/writeback.h +@@ -134,58 +134,28 @@ DEFINE_EVENT(writeback_dirty_inode_template, writeback_dirty_inode, + #ifdef CREATE_TRACE_POINTS + #ifdef CONFIG_CGROUP_WRITEBACK + +-static inline size_t __trace_wb_cgroup_size(struct bdi_writeback *wb) ++static inline unsigned int __trace_wb_assign_cgroup(struct bdi_writeback *wb) + { +- return kernfs_path_len(wb->memcg_css->cgroup->kn) + 1; ++ return wb->memcg_css->cgroup->kn->ino; + } + +-static inline void __trace_wb_assign_cgroup(char *buf, struct bdi_writeback *wb) +-{ +- struct cgroup *cgrp = wb->memcg_css->cgroup; +- char *path; +- +- path = cgroup_path(cgrp, buf, kernfs_path_len(cgrp->kn) + 1); +- WARN_ON_ONCE(path != buf); +-} +- +-static inline size_t __trace_wbc_cgroup_size(struct writeback_control *wbc) +-{ +- if (wbc->wb) +- return __trace_wb_cgroup_size(wbc->wb); +- else +- return 2; +-} +- +-static inline void __trace_wbc_assign_cgroup(char *buf, +- struct writeback_control *wbc) ++static inline unsigned int __trace_wbc_assign_cgroup(struct writeback_control *wbc) + { + if (wbc->wb) +- __trace_wb_assign_cgroup(buf, wbc->wb); ++ return __trace_wb_assign_cgroup(wbc->wb); + else +- strcpy(buf, "/"); ++ return -1U; + } +- + #else /* CONFIG_CGROUP_WRITEBACK */ + +-static inline size_t __trace_wb_cgroup_size(struct bdi_writeback *wb) +-{ +- return 2; +-} +- +-static inline void __trace_wb_assign_cgroup(char *buf, struct bdi_writeback *wb) +-{ +- strcpy(buf, "/"); +-} +- +-static inline size_t __trace_wbc_cgroup_size(struct writeback_control *wbc) ++static inline unsigned int __trace_wb_assign_cgroup(struct bdi_writeback *wb) + { +- return 2; ++ return -1U; + } + +-static inline void __trace_wbc_assign_cgroup(char *buf, +- struct writeback_control *wbc) ++static inline unsigned int __trace_wbc_assign_cgroup(struct writeback_control *wbc) + { +- strcpy(buf, "/"); ++ return -1U; + } + + #endif /* CONFIG_CGROUP_WRITEBACK */ +@@ -201,7 +171,7 @@ DECLARE_EVENT_CLASS(writeback_write_inode_template, + __array(char, name, 32) + __field(unsigned long, ino) + __field(int, sync_mode) +- __dynamic_array(char, cgroup, __trace_wbc_cgroup_size(wbc)) ++ __field(unsigned int, cgroup_ino) + ), + + TP_fast_assign( +@@ -209,14 +179,14 @@ DECLARE_EVENT_CLASS(writeback_write_inode_template, + dev_name(inode_to_bdi(inode)->dev), 32); + __entry->ino = inode->i_ino; + __entry->sync_mode = wbc->sync_mode; +- __trace_wbc_assign_cgroup(__get_str(cgroup), wbc); ++ __entry->cgroup_ino = __trace_wbc_assign_cgroup(wbc); + ), + +- TP_printk("bdi %s: ino=%lu sync_mode=%d cgroup=%s", ++ TP_printk("bdi %s: ino=%lu sync_mode=%d cgroup_ino=%u", + __entry->name, + __entry->ino, + __entry->sync_mode, +- __get_str(cgroup) ++ __entry->cgroup_ino + ) + ); + +@@ -246,7 +216,7 @@ DECLARE_EVENT_CLASS(writeback_work_class, + __field(int, range_cyclic) + __field(int, for_background) + __field(int, reason) +- __dynamic_array(char, cgroup, __trace_wb_cgroup_size(wb)) ++ __field(unsigned int, cgroup_ino) + ), + TP_fast_assign( + strncpy(__entry->name, +@@ -258,10 +228,10 @@ DECLARE_EVENT_CLASS(writeback_work_class, + __entry->range_cyclic = work->range_cyclic; + __entry->for_background = work->for_background; + __entry->reason = work->reason; +- __trace_wb_assign_cgroup(__get_str(cgroup), wb); ++ __entry->cgroup_ino = __trace_wb_assign_cgroup(wb); + ), + TP_printk("bdi %s: sb_dev %d:%d nr_pages=%ld sync_mode=%d " +- "kupdate=%d range_cyclic=%d background=%d reason=%s cgroup=%s", ++ "kupdate=%d range_cyclic=%d background=%d reason=%s cgroup_ino=%u", + __entry->name, + MAJOR(__entry->sb_dev), MINOR(__entry->sb_dev), + __entry->nr_pages, +@@ -270,7 +240,7 @@ DECLARE_EVENT_CLASS(writeback_work_class, + __entry->range_cyclic, + __entry->for_background, + __print_symbolic(__entry->reason, WB_WORK_REASON), +- __get_str(cgroup) ++ __entry->cgroup_ino + ) + ); + #define DEFINE_WRITEBACK_WORK_EVENT(name) \ +@@ -300,15 +270,15 @@ DECLARE_EVENT_CLASS(writeback_class, + TP_ARGS(wb), + TP_STRUCT__entry( + __array(char, name, 32) +- __dynamic_array(char, cgroup, __trace_wb_cgroup_size(wb)) ++ __field(unsigned int, cgroup_ino) + ), + TP_fast_assign( + strncpy(__entry->name, dev_name(wb->bdi->dev), 32); +- __trace_wb_assign_cgroup(__get_str(cgroup), wb); ++ __entry->cgroup_ino = __trace_wb_assign_cgroup(wb); + ), +- TP_printk("bdi %s: cgroup=%s", ++ TP_printk("bdi %s: cgroup_ino=%u", + __entry->name, +- __get_str(cgroup) ++ __entry->cgroup_ino + ) + ); + #define DEFINE_WRITEBACK_EVENT(name) \ +@@ -347,7 +317,7 @@ DECLARE_EVENT_CLASS(wbc_class, + __field(int, range_cyclic) + __field(long, range_start) + __field(long, range_end) +- __dynamic_array(char, cgroup, __trace_wbc_cgroup_size(wbc)) ++ __field(unsigned int, cgroup_ino) + ), + + TP_fast_assign( +@@ -361,12 +331,12 @@ DECLARE_EVENT_CLASS(wbc_class, + __entry->range_cyclic = wbc->range_cyclic; + __entry->range_start = (long)wbc->range_start; + __entry->range_end = (long)wbc->range_end; +- __trace_wbc_assign_cgroup(__get_str(cgroup), wbc); ++ __entry->cgroup_ino = __trace_wbc_assign_cgroup(wbc); + ), + + TP_printk("bdi %s: towrt=%ld skip=%ld mode=%d kupd=%d " + "bgrd=%d reclm=%d cyclic=%d " +- "start=0x%lx end=0x%lx cgroup=%s", ++ "start=0x%lx end=0x%lx cgroup_ino=%u", + __entry->name, + __entry->nr_to_write, + __entry->pages_skipped, +@@ -377,7 +347,7 @@ DECLARE_EVENT_CLASS(wbc_class, + __entry->range_cyclic, + __entry->range_start, + __entry->range_end, +- __get_str(cgroup) ++ __entry->cgroup_ino + ) + ) + +@@ -398,7 +368,7 @@ TRACE_EVENT(writeback_queue_io, + __field(long, age) + __field(int, moved) + __field(int, reason) +- __dynamic_array(char, cgroup, __trace_wb_cgroup_size(wb)) ++ __field(unsigned int, cgroup_ino) + ), + TP_fast_assign( + unsigned long *older_than_this = work->older_than_this; +@@ -408,15 +378,15 @@ TRACE_EVENT(writeback_queue_io, + (jiffies - *older_than_this) * 1000 / HZ : -1; + __entry->moved = moved; + __entry->reason = work->reason; +- __trace_wb_assign_cgroup(__get_str(cgroup), wb); ++ __entry->cgroup_ino = __trace_wb_assign_cgroup(wb); + ), +- TP_printk("bdi %s: older=%lu age=%ld enqueue=%d reason=%s cgroup=%s", ++ TP_printk("bdi %s: older=%lu age=%ld enqueue=%d reason=%s cgroup_ino=%u", + __entry->name, + __entry->older, /* older_than_this in jiffies */ + __entry->age, /* older_than_this in relative milliseconds */ + __entry->moved, + __print_symbolic(__entry->reason, WB_WORK_REASON), +- __get_str(cgroup) ++ __entry->cgroup_ino + ) + ); + +@@ -484,7 +454,7 @@ TRACE_EVENT(bdi_dirty_ratelimit, + __field(unsigned long, dirty_ratelimit) + __field(unsigned long, task_ratelimit) + __field(unsigned long, balanced_dirty_ratelimit) +- __dynamic_array(char, cgroup, __trace_wb_cgroup_size(wb)) ++ __field(unsigned int, cgroup_ino) + ), + + TP_fast_assign( +@@ -496,13 +466,13 @@ TRACE_EVENT(bdi_dirty_ratelimit, + __entry->task_ratelimit = KBps(task_ratelimit); + __entry->balanced_dirty_ratelimit = + KBps(wb->balanced_dirty_ratelimit); +- __trace_wb_assign_cgroup(__get_str(cgroup), wb); ++ __entry->cgroup_ino = __trace_wb_assign_cgroup(wb); + ), + + TP_printk("bdi %s: " + "write_bw=%lu awrite_bw=%lu dirty_rate=%lu " + "dirty_ratelimit=%lu task_ratelimit=%lu " +- "balanced_dirty_ratelimit=%lu cgroup=%s", ++ "balanced_dirty_ratelimit=%lu cgroup_ino=%u", + __entry->bdi, + __entry->write_bw, /* write bandwidth */ + __entry->avg_write_bw, /* avg write bandwidth */ +@@ -510,7 +480,7 @@ TRACE_EVENT(bdi_dirty_ratelimit, + __entry->dirty_ratelimit, /* base ratelimit */ + __entry->task_ratelimit, /* ratelimit with position control */ + __entry->balanced_dirty_ratelimit, /* the balanced ratelimit */ +- __get_str(cgroup) ++ __entry->cgroup_ino + ) + ); + +@@ -548,7 +518,7 @@ TRACE_EVENT(balance_dirty_pages, + __field( long, pause) + __field(unsigned long, period) + __field( long, think) +- __dynamic_array(char, cgroup, __trace_wb_cgroup_size(wb)) ++ __field(unsigned int, cgroup_ino) + ), + + TP_fast_assign( +@@ -571,7 +541,7 @@ TRACE_EVENT(balance_dirty_pages, + __entry->period = period * 1000 / HZ; + __entry->pause = pause * 1000 / HZ; + __entry->paused = (jiffies - start_time) * 1000 / HZ; +- __trace_wb_assign_cgroup(__get_str(cgroup), wb); ++ __entry->cgroup_ino = __trace_wb_assign_cgroup(wb); + ), + + +@@ -580,7 +550,7 @@ TRACE_EVENT(balance_dirty_pages, + "bdi_setpoint=%lu bdi_dirty=%lu " + "dirty_ratelimit=%lu task_ratelimit=%lu " + "dirtied=%u dirtied_pause=%u " +- "paused=%lu pause=%ld period=%lu think=%ld cgroup=%s", ++ "paused=%lu pause=%ld period=%lu think=%ld cgroup_ino=%u", + __entry->bdi, + __entry->limit, + __entry->setpoint, +@@ -595,7 +565,7 @@ TRACE_EVENT(balance_dirty_pages, + __entry->pause, /* ms */ + __entry->period, /* ms */ + __entry->think, /* ms */ +- __get_str(cgroup) ++ __entry->cgroup_ino + ) + ); + +@@ -609,8 +579,7 @@ TRACE_EVENT(writeback_sb_inodes_requeue, + __field(unsigned long, ino) + __field(unsigned long, state) + __field(unsigned long, dirtied_when) +- __dynamic_array(char, cgroup, +- __trace_wb_cgroup_size(inode_to_wb(inode))) ++ __field(unsigned int, cgroup_ino) + ), + + TP_fast_assign( +@@ -619,16 +588,16 @@ TRACE_EVENT(writeback_sb_inodes_requeue, + __entry->ino = inode->i_ino; + __entry->state = inode->i_state; + __entry->dirtied_when = inode->dirtied_when; +- __trace_wb_assign_cgroup(__get_str(cgroup), inode_to_wb(inode)); ++ __entry->cgroup_ino = __trace_wb_assign_cgroup(inode_to_wb(inode)); + ), + +- TP_printk("bdi %s: ino=%lu state=%s dirtied_when=%lu age=%lu cgroup=%s", ++ TP_printk("bdi %s: ino=%lu state=%s dirtied_when=%lu age=%lu cgroup_ino=%u", + __entry->name, + __entry->ino, + show_inode_state(__entry->state), + __entry->dirtied_when, + (jiffies - __entry->dirtied_when) / HZ, +- __get_str(cgroup) ++ __entry->cgroup_ino + ) + ); + +@@ -684,7 +653,7 @@ DECLARE_EVENT_CLASS(writeback_single_inode_template, + __field(unsigned long, writeback_index) + __field(long, nr_to_write) + __field(unsigned long, wrote) +- __dynamic_array(char, cgroup, __trace_wbc_cgroup_size(wbc)) ++ __field(unsigned int, cgroup_ino) + ), + + TP_fast_assign( +@@ -696,11 +665,11 @@ DECLARE_EVENT_CLASS(writeback_single_inode_template, + __entry->writeback_index = inode->i_mapping->writeback_index; + __entry->nr_to_write = nr_to_write; + __entry->wrote = nr_to_write - wbc->nr_to_write; +- __trace_wbc_assign_cgroup(__get_str(cgroup), wbc); ++ __entry->cgroup_ino = __trace_wbc_assign_cgroup(wbc); + ), + + TP_printk("bdi %s: ino=%lu state=%s dirtied_when=%lu age=%lu " +- "index=%lu to_write=%ld wrote=%lu cgroup=%s", ++ "index=%lu to_write=%ld wrote=%lu cgroup_ino=%u", + __entry->name, + __entry->ino, + show_inode_state(__entry->state), +@@ -709,7 +678,7 @@ DECLARE_EVENT_CLASS(writeback_single_inode_template, + __entry->writeback_index, + __entry->nr_to_write, + __entry->wrote, +- __get_str(cgroup) ++ __entry->cgroup_ino + ) + ); + +diff --git a/kernel/cpu.c b/kernel/cpu.c +index 51aafc2..8edd3c7 100644 +--- a/kernel/cpu.c ++++ b/kernel/cpu.c +@@ -127,8 +127,8 @@ struct hotplug_pcp { + }; + + #ifdef CONFIG_PREEMPT_RT_FULL +-# define hotplug_lock(hp) rt_spin_lock(&(hp)->lock) +-# define hotplug_unlock(hp) rt_spin_unlock(&(hp)->lock) ++# define hotplug_lock(hp) rt_spin_lock__no_mg(&(hp)->lock) ++# define hotplug_unlock(hp) rt_spin_unlock__no_mg(&(hp)->lock) + #else + # define hotplug_lock(hp) mutex_lock(&(hp)->mutex) + # define hotplug_unlock(hp) mutex_unlock(&(hp)->mutex) +diff --git a/kernel/events/core.c b/kernel/events/core.c +index 33c8aa8..760f41d 100644 +--- a/kernel/events/core.c ++++ b/kernel/events/core.c +@@ -802,6 +802,7 @@ static void __perf_mux_hrtimer_init(struct perf_cpu_context *cpuctx, int cpu) + raw_spin_lock_init(&cpuctx->hrtimer_lock); + hrtimer_init(timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS_PINNED); + timer->function = perf_mux_hrtimer_handler; ++ timer->irqsafe = 1; + } + + static int perf_mux_hrtimer_restart(struct perf_cpu_context *cpuctx) +diff --git a/kernel/futex.c b/kernel/futex.c +index a34e5ee..02bb869 100644 +--- a/kernel/futex.c ++++ b/kernel/futex.c +@@ -1226,7 +1226,7 @@ static int wake_futex_pi(u32 __user *uaddr, u32 uval, struct futex_q *this, + if (pi_state->owner != current) + return -EINVAL; + +- raw_spin_lock(&pi_state->pi_mutex.wait_lock); ++ raw_spin_lock_irq(&pi_state->pi_mutex.wait_lock); + new_owner = rt_mutex_next_owner(&pi_state->pi_mutex); + + /* +@@ -1252,22 +1252,22 @@ static int wake_futex_pi(u32 __user *uaddr, u32 uval, struct futex_q *this, + else if (curval != uval) + ret = -EINVAL; + if (ret) { +- raw_spin_unlock(&pi_state->pi_mutex.wait_lock); ++ raw_spin_unlock_irq(&pi_state->pi_mutex.wait_lock); + return ret; + } + +- raw_spin_lock_irq(&pi_state->owner->pi_lock); ++ raw_spin_lock(&pi_state->owner->pi_lock); + WARN_ON(list_empty(&pi_state->list)); + list_del_init(&pi_state->list); +- raw_spin_unlock_irq(&pi_state->owner->pi_lock); ++ raw_spin_unlock(&pi_state->owner->pi_lock); + +- raw_spin_lock_irq(&new_owner->pi_lock); ++ raw_spin_lock(&new_owner->pi_lock); + WARN_ON(!list_empty(&pi_state->list)); + list_add(&pi_state->list, &new_owner->pi_state_list); + pi_state->owner = new_owner; +- raw_spin_unlock_irq(&new_owner->pi_lock); ++ raw_spin_unlock(&new_owner->pi_lock); + +- raw_spin_unlock(&pi_state->pi_mutex.wait_lock); ++ raw_spin_unlock_irq(&pi_state->pi_mutex.wait_lock); + + deboost = rt_mutex_futex_unlock(&pi_state->pi_mutex, &wake_q, + &wake_sleeper_q); +@@ -2144,11 +2144,11 @@ static int fixup_owner(u32 __user *uaddr, struct futex_q *q, int locked) + * we returned due to timeout or signal without taking the + * rt_mutex. Too late. + */ +- raw_spin_lock(&q->pi_state->pi_mutex.wait_lock); ++ raw_spin_lock_irq(&q->pi_state->pi_mutex.wait_lock); + owner = rt_mutex_owner(&q->pi_state->pi_mutex); + if (!owner) + owner = rt_mutex_next_owner(&q->pi_state->pi_mutex); +- raw_spin_unlock(&q->pi_state->pi_mutex.wait_lock); ++ raw_spin_unlock_irq(&q->pi_state->pi_mutex.wait_lock); + ret = fixup_pi_state_owner(uaddr, q, owner); + goto out; + } +diff --git a/kernel/irq/irqdesc.c b/kernel/irq/irqdesc.c +index 239e2ae..0b73349 100644 +--- a/kernel/irq/irqdesc.c ++++ b/kernel/irq/irqdesc.c +@@ -24,10 +24,27 @@ + static struct lock_class_key irq_desc_lock_class; + + #if defined(CONFIG_SMP) ++static int __init irq_affinity_setup(char *str) ++{ ++ zalloc_cpumask_var(&irq_default_affinity, GFP_NOWAIT); ++ cpulist_parse(str, irq_default_affinity); ++ /* ++ * Set at least the boot cpu. We don't want to end up with ++ * bugreports caused by random comandline masks ++ */ ++ cpumask_set_cpu(smp_processor_id(), irq_default_affinity); ++ return 1; ++} ++__setup("irqaffinity=", irq_affinity_setup); ++ + static void __init init_irq_default_affinity(void) + { +- alloc_cpumask_var(&irq_default_affinity, GFP_NOWAIT); +- cpumask_setall(irq_default_affinity); ++#ifdef CONFIG_CPUMASK_OFFSTACK ++ if (!irq_default_affinity) ++ zalloc_cpumask_var(&irq_default_affinity, GFP_NOWAIT); ++#endif ++ if (cpumask_empty(irq_default_affinity)) ++ cpumask_setall(irq_default_affinity); + } + #else + static void __init init_irq_default_affinity(void) +diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c +index ba2a42a..8e89554 100644 +--- a/kernel/irq/manage.c ++++ b/kernel/irq/manage.c +@@ -2060,7 +2060,7 @@ EXPORT_SYMBOL_GPL(irq_get_irqchip_state); + * This call sets the internal irqchip state of an interrupt, + * depending on the value of @which. + * +- * This function should be called with preemption disabled if the ++ * This function should be called with migration disabled if the + * interrupt controller has per-cpu registers. + */ + int irq_set_irqchip_state(unsigned int irq, enum irqchip_irq_state which, +diff --git a/kernel/locking/lglock.c b/kernel/locking/lglock.c +index d8be4fc..57e0ea7 100644 +--- a/kernel/locking/lglock.c ++++ b/kernel/locking/lglock.c +@@ -10,7 +10,7 @@ + # define lg_do_unlock(l) arch_spin_unlock(l) + #else + # define lg_lock_ptr struct rt_mutex +-# define lg_do_lock(l) __rt_spin_lock(l) ++# define lg_do_lock(l) __rt_spin_lock__no_mg(l) + # define lg_do_unlock(l) __rt_spin_unlock(l) + #endif + /* +@@ -86,7 +86,7 @@ void lg_double_lock(struct lglock *lg, int cpu1, int cpu2) + if (cpu2 < cpu1) + swap(cpu1, cpu2); + +- preempt_disable(); ++ preempt_disable_nort(); + lock_acquire_shared(&lg->lock_dep_map, 0, 0, NULL, _RET_IP_); + lg_do_lock(per_cpu_ptr(lg->lock, cpu1)); + lg_do_lock(per_cpu_ptr(lg->lock, cpu2)); +@@ -97,7 +97,7 @@ void lg_double_unlock(struct lglock *lg, int cpu1, int cpu2) + lock_release(&lg->lock_dep_map, 1, _RET_IP_); + lg_do_unlock(per_cpu_ptr(lg->lock, cpu1)); + lg_do_unlock(per_cpu_ptr(lg->lock, cpu2)); +- preempt_enable(); ++ preempt_enable_nort(); + } + + void lg_global_lock(struct lglock *lg) +diff --git a/kernel/locking/rt.c b/kernel/locking/rt.c +index 1bbbcad5..d4ab61c 100644 +--- a/kernel/locking/rt.c ++++ b/kernel/locking/rt.c +@@ -235,7 +235,6 @@ EXPORT_SYMBOL(rt_read_trylock); + void __lockfunc rt_write_lock(rwlock_t *rwlock) + { + rwlock_acquire(&rwlock->dep_map, 0, 0, _RET_IP_); +- migrate_disable(); + __rt_spin_lock(&rwlock->lock); + } + EXPORT_SYMBOL(rt_write_lock); +@@ -249,7 +248,6 @@ void __lockfunc rt_read_lock(rwlock_t *rwlock) + * recursive read locks succeed when current owns the lock + */ + if (rt_mutex_owner(lock) != current) { +- migrate_disable(); + rwlock_acquire(&rwlock->dep_map, 0, 0, _RET_IP_); + __rt_spin_lock(lock); + } +diff --git a/kernel/locking/rtmutex.c b/kernel/locking/rtmutex.c +index e1ddae3..6697100 100644 +--- a/kernel/locking/rtmutex.c ++++ b/kernel/locking/rtmutex.c +@@ -111,13 +111,14 @@ static inline void mark_rt_mutex_waiters(struct rt_mutex *lock) + * 2) Drop lock->wait_lock + * 3) Try to unlock the lock with cmpxchg + */ +-static inline bool unlock_rt_mutex_safe(struct rt_mutex *lock) ++static inline bool unlock_rt_mutex_safe(struct rt_mutex *lock, ++ unsigned long flags) + __releases(lock->wait_lock) + { + struct task_struct *owner = rt_mutex_owner(lock); + + clear_rt_mutex_waiters(lock); +- raw_spin_unlock(&lock->wait_lock); ++ raw_spin_unlock_irqrestore(&lock->wait_lock, flags); + /* + * If a new waiter comes in between the unlock and the cmpxchg + * we have two situations: +@@ -159,11 +160,12 @@ static inline void mark_rt_mutex_waiters(struct rt_mutex *lock) + /* + * Simple slow path only version: lock->owner is protected by lock->wait_lock. + */ +-static inline bool unlock_rt_mutex_safe(struct rt_mutex *lock) ++static inline bool unlock_rt_mutex_safe(struct rt_mutex *lock, ++ unsigned long flags) + __releases(lock->wait_lock) + { + lock->owner = NULL; +- raw_spin_unlock(&lock->wait_lock); ++ raw_spin_unlock_irqrestore(&lock->wait_lock, flags); + return true; + } + #endif +@@ -454,7 +456,6 @@ static int rt_mutex_adjust_prio_chain(struct task_struct *task, + int ret = 0, depth = 0; + struct rt_mutex *lock; + bool detect_deadlock; +- unsigned long flags; + bool requeue = true; + + detect_deadlock = rt_mutex_cond_detect_deadlock(orig_waiter, chwalk); +@@ -497,7 +498,7 @@ static int rt_mutex_adjust_prio_chain(struct task_struct *task, + /* + * [1] Task cannot go away as we did a get_task() before ! + */ +- raw_spin_lock_irqsave(&task->pi_lock, flags); ++ raw_spin_lock_irq(&task->pi_lock); + + /* + * [2] Get the waiter on which @task is blocked on. +@@ -581,7 +582,7 @@ static int rt_mutex_adjust_prio_chain(struct task_struct *task, + * operations. + */ + if (!raw_spin_trylock(&lock->wait_lock)) { +- raw_spin_unlock_irqrestore(&task->pi_lock, flags); ++ raw_spin_unlock_irq(&task->pi_lock); + cpu_relax(); + goto retry; + } +@@ -612,7 +613,7 @@ static int rt_mutex_adjust_prio_chain(struct task_struct *task, + /* + * No requeue[7] here. Just release @task [8] + */ +- raw_spin_unlock_irqrestore(&task->pi_lock, flags); ++ raw_spin_unlock(&task->pi_lock); + put_task_struct(task); + + /* +@@ -620,14 +621,14 @@ static int rt_mutex_adjust_prio_chain(struct task_struct *task, + * If there is no owner of the lock, end of chain. + */ + if (!rt_mutex_owner(lock)) { +- raw_spin_unlock(&lock->wait_lock); ++ raw_spin_unlock_irq(&lock->wait_lock); + return 0; + } + + /* [10] Grab the next task, i.e. owner of @lock */ + task = rt_mutex_owner(lock); + get_task_struct(task); +- raw_spin_lock_irqsave(&task->pi_lock, flags); ++ raw_spin_lock(&task->pi_lock); + + /* + * No requeue [11] here. We just do deadlock detection. +@@ -642,8 +643,8 @@ static int rt_mutex_adjust_prio_chain(struct task_struct *task, + top_waiter = rt_mutex_top_waiter(lock); + + /* [13] Drop locks */ +- raw_spin_unlock_irqrestore(&task->pi_lock, flags); +- raw_spin_unlock(&lock->wait_lock); ++ raw_spin_unlock(&task->pi_lock); ++ raw_spin_unlock_irq(&lock->wait_lock); + + /* If owner is not blocked, end of chain. */ + if (!next_lock) +@@ -664,7 +665,7 @@ static int rt_mutex_adjust_prio_chain(struct task_struct *task, + rt_mutex_enqueue(lock, waiter); + + /* [8] Release the task */ +- raw_spin_unlock_irqrestore(&task->pi_lock, flags); ++ raw_spin_unlock(&task->pi_lock); + put_task_struct(task); + + /* +@@ -685,14 +686,14 @@ static int rt_mutex_adjust_prio_chain(struct task_struct *task, + lock_top_waiter = rt_mutex_top_waiter(lock); + if (prerequeue_top_waiter != lock_top_waiter) + rt_mutex_wake_waiter(lock_top_waiter); +- raw_spin_unlock(&lock->wait_lock); ++ raw_spin_unlock_irq(&lock->wait_lock); + return 0; + } + + /* [10] Grab the next task, i.e. the owner of @lock */ + task = rt_mutex_owner(lock); + get_task_struct(task); +- raw_spin_lock_irqsave(&task->pi_lock, flags); ++ raw_spin_lock(&task->pi_lock); + + /* [11] requeue the pi waiters if necessary */ + if (waiter == rt_mutex_top_waiter(lock)) { +@@ -746,8 +747,8 @@ static int rt_mutex_adjust_prio_chain(struct task_struct *task, + top_waiter = rt_mutex_top_waiter(lock); + + /* [13] Drop the locks */ +- raw_spin_unlock_irqrestore(&task->pi_lock, flags); +- raw_spin_unlock(&lock->wait_lock); ++ raw_spin_unlock(&task->pi_lock); ++ raw_spin_unlock_irq(&lock->wait_lock); + + /* + * Make the actual exit decisions [12], based on the stored +@@ -770,7 +771,7 @@ static int rt_mutex_adjust_prio_chain(struct task_struct *task, + goto again; + + out_unlock_pi: +- raw_spin_unlock_irqrestore(&task->pi_lock, flags); ++ raw_spin_unlock_irq(&task->pi_lock); + out_put_task: + put_task_struct(task); + +@@ -799,7 +800,7 @@ static inline int lock_is_stealable(struct task_struct *task, + /* + * Try to take an rt-mutex + * +- * Must be called with lock->wait_lock held. ++ * Must be called with lock->wait_lock held and interrupts disabled + * + * @lock: The lock to be acquired. + * @task: The task which wants to acquire the lock +@@ -810,8 +811,6 @@ static int __try_to_take_rt_mutex(struct rt_mutex *lock, + struct task_struct *task, + struct rt_mutex_waiter *waiter, int mode) + { +- unsigned long flags; +- + /* + * Before testing whether we can acquire @lock, we set the + * RT_MUTEX_HAS_WAITERS bit in @lock->owner. This forces all +@@ -894,7 +893,7 @@ static int __try_to_take_rt_mutex(struct rt_mutex *lock, + * case, but conditionals are more expensive than a redundant + * store. + */ +- raw_spin_lock_irqsave(&task->pi_lock, flags); ++ raw_spin_lock(&task->pi_lock); + task->pi_blocked_on = NULL; + /* + * Finish the lock acquisition. @task is the new owner. If +@@ -903,7 +902,7 @@ static int __try_to_take_rt_mutex(struct rt_mutex *lock, + */ + if (rt_mutex_has_waiters(lock)) + rt_mutex_enqueue_pi(task, rt_mutex_top_waiter(lock)); +- raw_spin_unlock_irqrestore(&task->pi_lock, flags); ++ raw_spin_unlock(&task->pi_lock); + + takeit: + /* We got the lock. */ +@@ -925,14 +924,19 @@ static int __try_to_take_rt_mutex(struct rt_mutex *lock, + * preemptible spin_lock functions: + */ + static inline void rt_spin_lock_fastlock(struct rt_mutex *lock, +- void (*slowfn)(struct rt_mutex *lock)) ++ void (*slowfn)(struct rt_mutex *lock, ++ bool mg_off), ++ bool do_mig_dis) + { + might_sleep_no_state_check(); + ++ if (do_mig_dis) ++ migrate_disable(); ++ + if (likely(rt_mutex_cmpxchg_acquire(lock, NULL, current))) + rt_mutex_deadlock_account_lock(lock, current); + else +- slowfn(lock); ++ slowfn(lock, do_mig_dis); + } + + static inline void rt_spin_lock_fastunlock(struct rt_mutex *lock, +@@ -979,9 +983,6 @@ static int adaptive_wait(struct rt_mutex *lock, + } + #endif + +-# define pi_lock(lock) raw_spin_lock_irq(lock) +-# define pi_unlock(lock) raw_spin_unlock_irq(lock) +- + static int task_blocks_on_rt_mutex(struct rt_mutex *lock, + struct rt_mutex_waiter *waiter, + struct task_struct *task, +@@ -993,18 +994,20 @@ static int task_blocks_on_rt_mutex(struct rt_mutex *lock, + * We store the current state under p->pi_lock in p->saved_state and + * the try_to_wake_up() code handles this accordingly. + */ +-static void noinline __sched rt_spin_lock_slowlock(struct rt_mutex *lock) ++static void noinline __sched rt_spin_lock_slowlock(struct rt_mutex *lock, ++ bool mg_off) + { + struct task_struct *lock_owner, *self = current; + struct rt_mutex_waiter waiter, *top_waiter; ++ unsigned long flags; + int ret; + + rt_mutex_init_waiter(&waiter, true); + +- raw_spin_lock(&lock->wait_lock); ++ raw_spin_lock_irqsave(&lock->wait_lock, flags); + + if (__try_to_take_rt_mutex(lock, self, NULL, STEAL_LATERAL)) { +- raw_spin_unlock(&lock->wait_lock); ++ raw_spin_unlock_irqrestore(&lock->wait_lock, flags); + return; + } + +@@ -1016,10 +1019,10 @@ static void noinline __sched rt_spin_lock_slowlock(struct rt_mutex *lock) + * as well. We are serialized via pi_lock against wakeups. See + * try_to_wake_up(). + */ +- pi_lock(&self->pi_lock); ++ raw_spin_lock(&self->pi_lock); + self->saved_state = self->state; + __set_current_state_no_track(TASK_UNINTERRUPTIBLE); +- pi_unlock(&self->pi_lock); ++ raw_spin_unlock(&self->pi_lock); + + ret = task_blocks_on_rt_mutex(lock, &waiter, self, RT_MUTEX_MIN_CHAINWALK); + BUG_ON(ret); +@@ -1032,18 +1035,23 @@ static void noinline __sched rt_spin_lock_slowlock(struct rt_mutex *lock) + top_waiter = rt_mutex_top_waiter(lock); + lock_owner = rt_mutex_owner(lock); + +- raw_spin_unlock(&lock->wait_lock); ++ raw_spin_unlock_irqrestore(&lock->wait_lock, flags); + + debug_rt_mutex_print_deadlock(&waiter); + +- if (top_waiter != &waiter || adaptive_wait(lock, lock_owner)) ++ if (top_waiter != &waiter || adaptive_wait(lock, lock_owner)) { ++ if (mg_off) ++ migrate_enable(); + schedule(); ++ if (mg_off) ++ migrate_disable(); ++ } + +- raw_spin_lock(&lock->wait_lock); ++ raw_spin_lock_irqsave(&lock->wait_lock, flags); + +- pi_lock(&self->pi_lock); ++ raw_spin_lock(&self->pi_lock); + __set_current_state_no_track(TASK_UNINTERRUPTIBLE); +- pi_unlock(&self->pi_lock); ++ raw_spin_unlock(&self->pi_lock); + } + + /* +@@ -1053,10 +1061,10 @@ static void noinline __sched rt_spin_lock_slowlock(struct rt_mutex *lock) + * happened while we were blocked. Clear saved_state so + * try_to_wakeup() does not get confused. + */ +- pi_lock(&self->pi_lock); ++ raw_spin_lock(&self->pi_lock); + __set_current_state_no_track(self->saved_state); + self->saved_state = TASK_RUNNING; +- pi_unlock(&self->pi_lock); ++ raw_spin_unlock(&self->pi_lock); + + /* + * try_to_take_rt_mutex() sets the waiter bit +@@ -1067,7 +1075,7 @@ static void noinline __sched rt_spin_lock_slowlock(struct rt_mutex *lock) + BUG_ON(rt_mutex_has_waiters(lock) && &waiter == rt_mutex_top_waiter(lock)); + BUG_ON(!RB_EMPTY_NODE(&waiter.tree_entry)); + +- raw_spin_unlock(&lock->wait_lock); ++ raw_spin_unlock_irqrestore(&lock->wait_lock, flags); + + debug_rt_mutex_free_waiter(&waiter); + } +@@ -1080,10 +1088,11 @@ static void mark_wakeup_next_waiter(struct wake_q_head *wake_q, + */ + static void noinline __sched rt_spin_lock_slowunlock(struct rt_mutex *lock) + { ++ unsigned long flags; + WAKE_Q(wake_q); + WAKE_Q(wake_sleeper_q); + +- raw_spin_lock(&lock->wait_lock); ++ raw_spin_lock_irqsave(&lock->wait_lock, flags); + + debug_rt_mutex_unlock(lock); + +@@ -1091,13 +1100,13 @@ static void noinline __sched rt_spin_lock_slowunlock(struct rt_mutex *lock) + + if (!rt_mutex_has_waiters(lock)) { + lock->owner = NULL; +- raw_spin_unlock(&lock->wait_lock); ++ raw_spin_unlock_irqrestore(&lock->wait_lock, flags); + return; + } + + mark_wakeup_next_waiter(&wake_q, &wake_sleeper_q, lock); + +- raw_spin_unlock(&lock->wait_lock); ++ raw_spin_unlock_irqrestore(&lock->wait_lock, flags); + wake_up_q(&wake_q); + wake_up_q_sleeper(&wake_sleeper_q); + +@@ -1105,33 +1114,55 @@ static void noinline __sched rt_spin_lock_slowunlock(struct rt_mutex *lock) + rt_mutex_adjust_prio(current); + } + ++void __lockfunc rt_spin_lock__no_mg(spinlock_t *lock) ++{ ++ rt_spin_lock_fastlock(&lock->lock, rt_spin_lock_slowlock, false); ++ spin_acquire(&lock->dep_map, 0, 0, _RET_IP_); ++} ++EXPORT_SYMBOL(rt_spin_lock__no_mg); ++ + void __lockfunc rt_spin_lock(spinlock_t *lock) + { +- rt_spin_lock_fastlock(&lock->lock, rt_spin_lock_slowlock); ++ rt_spin_lock_fastlock(&lock->lock, rt_spin_lock_slowlock, true); + spin_acquire(&lock->dep_map, 0, 0, _RET_IP_); + } + EXPORT_SYMBOL(rt_spin_lock); + + void __lockfunc __rt_spin_lock(struct rt_mutex *lock) + { +- rt_spin_lock_fastlock(lock, rt_spin_lock_slowlock); ++ rt_spin_lock_fastlock(lock, rt_spin_lock_slowlock, true); + } + EXPORT_SYMBOL(__rt_spin_lock); + ++void __lockfunc __rt_spin_lock__no_mg(struct rt_mutex *lock) ++{ ++ rt_spin_lock_fastlock(lock, rt_spin_lock_slowlock, false); ++} ++EXPORT_SYMBOL(__rt_spin_lock__no_mg); ++ + #ifdef CONFIG_DEBUG_LOCK_ALLOC + void __lockfunc rt_spin_lock_nested(spinlock_t *lock, int subclass) + { +- rt_spin_lock_fastlock(&lock->lock, rt_spin_lock_slowlock); + spin_acquire(&lock->dep_map, subclass, 0, _RET_IP_); ++ rt_spin_lock_fastlock(&lock->lock, rt_spin_lock_slowlock, true); + } + EXPORT_SYMBOL(rt_spin_lock_nested); + #endif + ++void __lockfunc rt_spin_unlock__no_mg(spinlock_t *lock) ++{ ++ /* NOTE: we always pass in '1' for nested, for simplicity */ ++ spin_release(&lock->dep_map, 1, _RET_IP_); ++ rt_spin_lock_fastunlock(&lock->lock, rt_spin_lock_slowunlock); ++} ++EXPORT_SYMBOL(rt_spin_unlock__no_mg); ++ + void __lockfunc rt_spin_unlock(spinlock_t *lock) + { + /* NOTE: we always pass in '1' for nested, for simplicity */ + spin_release(&lock->dep_map, 1, _RET_IP_); + rt_spin_lock_fastunlock(&lock->lock, rt_spin_lock_slowunlock); ++ migrate_enable(); + } + EXPORT_SYMBOL(rt_spin_unlock); + +@@ -1158,12 +1189,27 @@ int __lockfunc __rt_spin_trylock(struct rt_mutex *lock) + return rt_mutex_trylock(lock); + } + ++int __lockfunc rt_spin_trylock__no_mg(spinlock_t *lock) ++{ ++ int ret; ++ ++ ret = rt_mutex_trylock(&lock->lock); ++ if (ret) ++ spin_acquire(&lock->dep_map, 0, 1, _RET_IP_); ++ return ret; ++} ++EXPORT_SYMBOL(rt_spin_trylock__no_mg); ++ + int __lockfunc rt_spin_trylock(spinlock_t *lock) + { +- int ret = rt_mutex_trylock(&lock->lock); ++ int ret; + ++ migrate_disable(); ++ ret = rt_mutex_trylock(&lock->lock); + if (ret) + spin_acquire(&lock->dep_map, 0, 1, _RET_IP_); ++ else ++ migrate_enable(); + return ret; + } + EXPORT_SYMBOL(rt_spin_trylock); +@@ -1202,12 +1248,10 @@ int atomic_dec_and_spin_lock(atomic_t *atomic, spinlock_t *lock) + /* Subtract 1 from counter unless that drops it to 0 (ie. it was 1) */ + if (atomic_add_unless(atomic, -1, 1)) + return 0; +- migrate_disable(); + rt_spin_lock(lock); + if (atomic_dec_and_test(atomic)) + return 1; + rt_spin_unlock(lock); +- migrate_enable(); + return 0; + } + EXPORT_SYMBOL(atomic_dec_and_spin_lock); +@@ -1273,7 +1317,7 @@ try_to_take_rt_mutex(struct rt_mutex *lock, struct task_struct *task, + * + * Prepare waiter and propagate pi chain + * +- * This must be called with lock->wait_lock held. ++ * This must be called with lock->wait_lock held and interrupts disabled + */ + static int task_blocks_on_rt_mutex(struct rt_mutex *lock, + struct rt_mutex_waiter *waiter, +@@ -1284,7 +1328,6 @@ static int task_blocks_on_rt_mutex(struct rt_mutex *lock, + struct rt_mutex_waiter *top_waiter = waiter; + struct rt_mutex *next_lock; + int chain_walk = 0, res; +- unsigned long flags; + + /* + * Early deadlock detection. We really don't want the task to +@@ -1298,7 +1341,7 @@ static int task_blocks_on_rt_mutex(struct rt_mutex *lock, + if (owner == task) + return -EDEADLK; + +- raw_spin_lock_irqsave(&task->pi_lock, flags); ++ raw_spin_lock(&task->pi_lock); + + /* + * In the case of futex requeue PI, this will be a proxy +@@ -1310,7 +1353,7 @@ static int task_blocks_on_rt_mutex(struct rt_mutex *lock, + * the task if PI_WAKEUP_INPROGRESS is set. + */ + if (task != current && task->pi_blocked_on == PI_WAKEUP_INPROGRESS) { +- raw_spin_unlock_irqrestore(&task->pi_lock, flags); ++ raw_spin_unlock(&task->pi_lock); + return -EAGAIN; + } + +@@ -1328,12 +1371,12 @@ static int task_blocks_on_rt_mutex(struct rt_mutex *lock, + + task->pi_blocked_on = waiter; + +- raw_spin_unlock_irqrestore(&task->pi_lock, flags); ++ raw_spin_unlock(&task->pi_lock); + + if (!owner) + return 0; + +- raw_spin_lock_irqsave(&owner->pi_lock, flags); ++ raw_spin_lock(&owner->pi_lock); + if (waiter == rt_mutex_top_waiter(lock)) { + rt_mutex_dequeue_pi(owner, top_waiter); + rt_mutex_enqueue_pi(owner, waiter); +@@ -1348,7 +1391,7 @@ static int task_blocks_on_rt_mutex(struct rt_mutex *lock, + /* Store the lock on which owner is blocked or NULL */ + next_lock = task_blocked_on_lock(owner); + +- raw_spin_unlock_irqrestore(&owner->pi_lock, flags); ++ raw_spin_unlock(&owner->pi_lock); + /* + * Even if full deadlock detection is on, if the owner is not + * blocked itself, we can avoid finding this out in the chain +@@ -1364,12 +1407,12 @@ static int task_blocks_on_rt_mutex(struct rt_mutex *lock, + */ + get_task_struct(owner); + +- raw_spin_unlock(&lock->wait_lock); ++ raw_spin_unlock_irq(&lock->wait_lock); + + res = rt_mutex_adjust_prio_chain(owner, chwalk, lock, + next_lock, waiter, task); + +- raw_spin_lock(&lock->wait_lock); ++ raw_spin_lock_irq(&lock->wait_lock); + + return res; + } +@@ -1378,16 +1421,15 @@ static int task_blocks_on_rt_mutex(struct rt_mutex *lock, + * Remove the top waiter from the current tasks pi waiter tree and + * queue it up. + * +- * Called with lock->wait_lock held. ++ * Called with lock->wait_lock held and interrupts disabled. + */ + static void mark_wakeup_next_waiter(struct wake_q_head *wake_q, + struct wake_q_head *wake_sleeper_q, + struct rt_mutex *lock) + { + struct rt_mutex_waiter *waiter; +- unsigned long flags; + +- raw_spin_lock_irqsave(&current->pi_lock, flags); ++ raw_spin_lock(&current->pi_lock); + + waiter = rt_mutex_top_waiter(lock); + +@@ -1409,7 +1451,7 @@ static void mark_wakeup_next_waiter(struct wake_q_head *wake_q, + */ + lock->owner = (void *) RT_MUTEX_HAS_WAITERS; + +- raw_spin_unlock_irqrestore(&current->pi_lock, flags); ++ raw_spin_unlock(&current->pi_lock); + + if (waiter->savestate) + wake_q_add(wake_sleeper_q, waiter->task); +@@ -1420,7 +1462,7 @@ static void mark_wakeup_next_waiter(struct wake_q_head *wake_q, + /* + * Remove a waiter from a lock and give up + * +- * Must be called with lock->wait_lock held and ++ * Must be called with lock->wait_lock held and interrupts disabled. I must + * have just failed to try_to_take_rt_mutex(). + */ + static void remove_waiter(struct rt_mutex *lock, +@@ -1429,12 +1471,11 @@ static void remove_waiter(struct rt_mutex *lock, + bool is_top_waiter = (waiter == rt_mutex_top_waiter(lock)); + struct task_struct *owner = rt_mutex_owner(lock); + struct rt_mutex *next_lock = NULL; +- unsigned long flags; + +- raw_spin_lock_irqsave(&current->pi_lock, flags); ++ raw_spin_lock(&current->pi_lock); + rt_mutex_dequeue(lock, waiter); + current->pi_blocked_on = NULL; +- raw_spin_unlock_irqrestore(&current->pi_lock, flags); ++ raw_spin_unlock(&current->pi_lock); + + /* + * Only update priority if the waiter was the highest priority +@@ -1443,7 +1484,7 @@ static void remove_waiter(struct rt_mutex *lock, + if (!owner || !is_top_waiter) + return; + +- raw_spin_lock_irqsave(&owner->pi_lock, flags); ++ raw_spin_lock(&owner->pi_lock); + + rt_mutex_dequeue_pi(owner, waiter); + +@@ -1456,7 +1497,7 @@ static void remove_waiter(struct rt_mutex *lock, + if (rt_mutex_real_waiter(owner->pi_blocked_on)) + next_lock = task_blocked_on_lock(owner); + +- raw_spin_unlock_irqrestore(&owner->pi_lock, flags); ++ raw_spin_unlock(&owner->pi_lock); + + /* + * Don't walk the chain, if the owner task is not blocked +@@ -1468,12 +1509,12 @@ static void remove_waiter(struct rt_mutex *lock, + /* gets dropped in rt_mutex_adjust_prio_chain()! */ + get_task_struct(owner); + +- raw_spin_unlock(&lock->wait_lock); ++ raw_spin_unlock_irq(&lock->wait_lock); + + rt_mutex_adjust_prio_chain(owner, RT_MUTEX_MIN_CHAINWALK, lock, + next_lock, NULL, current); + +- raw_spin_lock(&lock->wait_lock); ++ raw_spin_lock_irq(&lock->wait_lock); + } + + /* +@@ -1509,11 +1550,11 @@ void rt_mutex_adjust_pi(struct task_struct *task) + * __rt_mutex_slowlock() - Perform the wait-wake-try-to-take loop + * @lock: the rt_mutex to take + * @state: the state the task should block in (TASK_INTERRUPTIBLE +- * or TASK_UNINTERRUPTIBLE) ++ * or TASK_UNINTERRUPTIBLE) + * @timeout: the pre-initialized and started timer, or NULL for none + * @waiter: the pre-initialized rt_mutex_waiter + * +- * lock->wait_lock must be held by the caller. ++ * Must be called with lock->wait_lock held and interrupts disabled + */ + static int __sched + __rt_mutex_slowlock(struct rt_mutex *lock, int state, +@@ -1548,13 +1589,13 @@ __rt_mutex_slowlock(struct rt_mutex *lock, int state, + break; + } + +- raw_spin_unlock(&lock->wait_lock); ++ raw_spin_unlock_irq(&lock->wait_lock); + + debug_rt_mutex_print_deadlock(waiter); + + schedule(); + +- raw_spin_lock(&lock->wait_lock); ++ raw_spin_lock_irq(&lock->wait_lock); + set_current_state(state); + } + +@@ -1668,17 +1709,26 @@ rt_mutex_slowlock(struct rt_mutex *lock, int state, + struct ww_acquire_ctx *ww_ctx) + { + struct rt_mutex_waiter waiter; ++ unsigned long flags; + int ret = 0; + + rt_mutex_init_waiter(&waiter, false); + +- raw_spin_lock(&lock->wait_lock); ++ /* ++ * Technically we could use raw_spin_[un]lock_irq() here, but this can ++ * be called in early boot if the cmpxchg() fast path is disabled ++ * (debug, no architecture support). In this case we will acquire the ++ * rtmutex with lock->wait_lock held. But we cannot unconditionally ++ * enable interrupts in that early boot case. So we need to use the ++ * irqsave/restore variants. ++ */ ++ raw_spin_lock_irqsave(&lock->wait_lock, flags); + + /* Try to acquire the lock again: */ + if (try_to_take_rt_mutex(lock, current, NULL)) { + if (ww_ctx) + ww_mutex_account_lock(lock, ww_ctx); +- raw_spin_unlock(&lock->wait_lock); ++ raw_spin_unlock_irqrestore(&lock->wait_lock, flags); + return 0; + } + +@@ -1717,7 +1767,7 @@ rt_mutex_slowlock(struct rt_mutex *lock, int state, + */ + fixup_rt_mutex_waiters(lock); + +- raw_spin_unlock(&lock->wait_lock); ++ raw_spin_unlock_irqrestore(&lock->wait_lock, flags); + + /* Remove pending timer: */ + if (unlikely(timeout)) +@@ -1733,6 +1783,7 @@ rt_mutex_slowlock(struct rt_mutex *lock, int state, + */ + static inline int rt_mutex_slowtrylock(struct rt_mutex *lock) + { ++ unsigned long flags; + int ret; + + /* +@@ -1744,10 +1795,10 @@ static inline int rt_mutex_slowtrylock(struct rt_mutex *lock) + return 0; + + /* +- * The mutex has currently no owner. Lock the wait lock and +- * try to acquire the lock. ++ * The mutex has currently no owner. Lock the wait lock and try to ++ * acquire the lock. We use irqsave here to support early boot calls. + */ +- raw_spin_lock(&lock->wait_lock); ++ raw_spin_lock_irqsave(&lock->wait_lock, flags); + + ret = try_to_take_rt_mutex(lock, current, NULL); + +@@ -1757,7 +1808,7 @@ static inline int rt_mutex_slowtrylock(struct rt_mutex *lock) + */ + fixup_rt_mutex_waiters(lock); + +- raw_spin_unlock(&lock->wait_lock); ++ raw_spin_unlock_irqrestore(&lock->wait_lock, flags); + + return ret; + } +@@ -1770,7 +1821,10 @@ static bool __sched rt_mutex_slowunlock(struct rt_mutex *lock, + struct wake_q_head *wake_q, + struct wake_q_head *wake_sleeper_q) + { +- raw_spin_lock(&lock->wait_lock); ++ unsigned long flags; ++ ++ /* irqsave required to support early boot calls */ ++ raw_spin_lock_irqsave(&lock->wait_lock, flags); + + debug_rt_mutex_unlock(lock); + +@@ -1809,10 +1863,10 @@ static bool __sched rt_mutex_slowunlock(struct rt_mutex *lock, + */ + while (!rt_mutex_has_waiters(lock)) { + /* Drops lock->wait_lock ! */ +- if (unlock_rt_mutex_safe(lock) == true) ++ if (unlock_rt_mutex_safe(lock, flags) == true) + return false; + /* Relock the rtmutex and try again */ +- raw_spin_lock(&lock->wait_lock); ++ raw_spin_lock_irqsave(&lock->wait_lock, flags); + } + + /* +@@ -1823,7 +1877,7 @@ static bool __sched rt_mutex_slowunlock(struct rt_mutex *lock, + */ + mark_wakeup_next_waiter(wake_q, wake_sleeper_q, lock); + +- raw_spin_unlock(&lock->wait_lock); ++ raw_spin_unlock_irqrestore(&lock->wait_lock, flags); + + /* check PI boosting */ + return true; +@@ -2135,10 +2189,10 @@ int rt_mutex_start_proxy_lock(struct rt_mutex *lock, + { + int ret; + +- raw_spin_lock(&lock->wait_lock); ++ raw_spin_lock_irq(&lock->wait_lock); + + if (try_to_take_rt_mutex(lock, task, NULL)) { +- raw_spin_unlock(&lock->wait_lock); ++ raw_spin_unlock_irq(&lock->wait_lock); + return 1; + } + +@@ -2161,14 +2215,14 @@ int rt_mutex_start_proxy_lock(struct rt_mutex *lock, + * PI_REQUEUE_INPROGRESS, so that if the task is waking up + * it will know that we are in the process of requeuing it. + */ +- raw_spin_lock_irq(&task->pi_lock); ++ raw_spin_lock(&task->pi_lock); + if (task->pi_blocked_on) { +- raw_spin_unlock_irq(&task->pi_lock); +- raw_spin_unlock(&lock->wait_lock); ++ raw_spin_unlock(&task->pi_lock); ++ raw_spin_unlock_irq(&lock->wait_lock); + return -EAGAIN; + } + task->pi_blocked_on = PI_REQUEUE_INPROGRESS; +- raw_spin_unlock_irq(&task->pi_lock); ++ raw_spin_unlock(&task->pi_lock); + #endif + + /* We enforce deadlock detection for futexes */ +@@ -2188,7 +2242,7 @@ int rt_mutex_start_proxy_lock(struct rt_mutex *lock, + if (ret && rt_mutex_has_waiters(lock)) + remove_waiter(lock, waiter); + +- raw_spin_unlock(&lock->wait_lock); ++ raw_spin_unlock_irq(&lock->wait_lock); + + debug_rt_mutex_print_deadlock(waiter); + +@@ -2236,7 +2290,7 @@ int rt_mutex_finish_proxy_lock(struct rt_mutex *lock, + { + int ret; + +- raw_spin_lock(&lock->wait_lock); ++ raw_spin_lock_irq(&lock->wait_lock); + + set_current_state(TASK_INTERRUPTIBLE); + +@@ -2252,7 +2306,7 @@ int rt_mutex_finish_proxy_lock(struct rt_mutex *lock, + */ + fixup_rt_mutex_waiters(lock); + +- raw_spin_unlock(&lock->wait_lock); ++ raw_spin_unlock_irq(&lock->wait_lock); + + return ret; + } +diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c +index bfd9e09..fbb23f9 100644 +--- a/kernel/power/hibernate.c ++++ b/kernel/power/hibernate.c +@@ -648,6 +648,10 @@ static void power_down(void) + cpu_relax(); + } + ++#ifndef CONFIG_SUSPEND ++bool pm_in_action; ++#endif ++ + /** + * hibernate - Carry out system hibernation, including saving the image. + */ +@@ -660,6 +664,8 @@ int hibernate(void) + return -EPERM; + } + ++ pm_in_action = true; ++ + lock_system_sleep(); + /* The snapshot device should not be opened while we're running */ + if (!atomic_add_unless(&snapshot_device_available, -1, 0)) { +@@ -725,6 +731,7 @@ int hibernate(void) + atomic_inc(&snapshot_device_available); + Unlock: + unlock_system_sleep(); ++ pm_in_action = false; + return error; + } + +diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c +index 80ebc07..393bc34 100644 +--- a/kernel/power/suspend.c ++++ b/kernel/power/suspend.c +@@ -522,6 +522,8 @@ static int enter_state(suspend_state_t state) + return error; + } + ++bool pm_in_action; ++ + /** + * pm_suspend - Externally visible function for suspending the system. + * @state: System sleep state to enter. +@@ -536,6 +538,8 @@ int pm_suspend(suspend_state_t state) + if (state <= PM_SUSPEND_ON || state >= PM_SUSPEND_MAX) + return -EINVAL; + ++ pm_in_action = true; ++ + error = enter_state(state); + if (error) { + suspend_stats.fail++; +@@ -543,6 +547,7 @@ int pm_suspend(suspend_state_t state) + } else { + suspend_stats.success++; + } ++ pm_in_action = false; + return error; + } + EXPORT_SYMBOL(pm_suspend); +diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c +index 69fbfde..f75e4b0 100644 +--- a/kernel/printk/printk.c ++++ b/kernel/printk/printk.c +@@ -241,6 +241,65 @@ struct printk_log { + */ + static DEFINE_RAW_SPINLOCK(logbuf_lock); + ++#ifdef CONFIG_EARLY_PRINTK ++struct console *early_console; ++ ++static void early_vprintk(const char *fmt, va_list ap) ++{ ++ if (early_console) { ++ char buf[512]; ++ int n = vscnprintf(buf, sizeof(buf), fmt, ap); ++ ++ early_console->write(early_console, buf, n); ++ } ++} ++ ++asmlinkage void early_printk(const char *fmt, ...) ++{ ++ va_list ap; ++ ++ va_start(ap, fmt); ++ early_vprintk(fmt, ap); ++ va_end(ap); ++} ++ ++/* ++ * This is independent of any log levels - a global ++ * kill switch that turns off all of printk. ++ * ++ * Used by the NMI watchdog if early-printk is enabled. ++ */ ++static bool __read_mostly printk_killswitch; ++ ++static int __init force_early_printk_setup(char *str) ++{ ++ printk_killswitch = true; ++ return 0; ++} ++early_param("force_early_printk", force_early_printk_setup); ++ ++void printk_kill(void) ++{ ++ printk_killswitch = true; ++} ++ ++#ifdef CONFIG_PRINTK ++static int forced_early_printk(const char *fmt, va_list ap) ++{ ++ if (!printk_killswitch) ++ return 0; ++ early_vprintk(fmt, ap); ++ return 1; ++} ++#endif ++ ++#else ++static inline int forced_early_printk(const char *fmt, va_list ap) ++{ ++ return 0; ++} ++#endif ++ + #ifdef CONFIG_PRINTK + DECLARE_WAIT_QUEUE_HEAD(log_wait); + /* the next printk record to read by syslog(READ) or /proc/kmsg */ +@@ -1692,62 +1751,6 @@ static size_t cont_print_text(char *text, size_t size) + return textlen; + } + +-#ifdef CONFIG_EARLY_PRINTK +-struct console *early_console; +- +-static void early_vprintk(const char *fmt, va_list ap) +-{ +- if (early_console) { +- char buf[512]; +- int n = vscnprintf(buf, sizeof(buf), fmt, ap); +- +- early_console->write(early_console, buf, n); +- } +-} +- +-asmlinkage void early_printk(const char *fmt, ...) +-{ +- va_list ap; +- +- va_start(ap, fmt); +- early_vprintk(fmt, ap); +- va_end(ap); +-} +- +-/* +- * This is independent of any log levels - a global +- * kill switch that turns off all of printk. +- * +- * Used by the NMI watchdog if early-printk is enabled. +- */ +-static bool __read_mostly printk_killswitch; +- +-static int __init force_early_printk_setup(char *str) +-{ +- printk_killswitch = true; +- return 0; +-} +-early_param("force_early_printk", force_early_printk_setup); +- +-void printk_kill(void) +-{ +- printk_killswitch = true; +-} +- +-static int forced_early_printk(const char *fmt, va_list ap) +-{ +- if (!printk_killswitch) +- return 0; +- early_vprintk(fmt, ap); +- return 1; +-} +-#else +-static inline int forced_early_printk(const char *fmt, va_list ap) +-{ +- return 0; +-} +-#endif +- + asmlinkage int vprintk_emit(int facility, int level, + const char *dict, size_t dictlen, + const char *fmt, va_list args) +@@ -2410,7 +2413,6 @@ void console_unlock(void) + start_critical_timings(); + local_irq_restore(flags); + #endif +- + if (do_cond_resched) + cond_resched(); + } +diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c +index d89328e..5bb3364 100644 +--- a/kernel/rcu/rcutorture.c ++++ b/kernel/rcu/rcutorture.c +@@ -390,6 +390,7 @@ static struct rcu_torture_ops rcu_ops = { + .name = "rcu" + }; + ++#ifndef CONFIG_PREEMPT_RT_FULL + /* + * Definitions for rcu_bh torture testing. + */ +@@ -429,6 +430,12 @@ static struct rcu_torture_ops rcu_bh_ops = { + .name = "rcu_bh" + }; + ++#else ++static struct rcu_torture_ops rcu_bh_ops = { ++ .ttype = INVALID_RCU_FLAVOR, ++}; ++#endif ++ + /* + * Don't even think about trying any of these in real life!!! + * The names includes "busted", and they really means it! +diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c +index 5359091..d862a20 100644 +--- a/kernel/rcu/tree.c ++++ b/kernel/rcu/tree.c +@@ -454,11 +454,13 @@ EXPORT_SYMBOL_GPL(rcu_batches_started_sched); + /* + * Return the number of RCU BH batches started thus far for debug & stats. + */ ++#ifndef CONFIG_PREEMPT_RT_FULL + unsigned long rcu_batches_started_bh(void) + { + return rcu_bh_state.gpnum; + } + EXPORT_SYMBOL_GPL(rcu_batches_started_bh); ++#endif + + /* + * Return the number of RCU batches completed thus far for debug & stats. +@@ -563,9 +565,11 @@ void rcutorture_get_gp_data(enum rcutorture_type test_type, int *flags, + case RCU_FLAVOR: + rsp = rcu_state_p; + break; ++#ifndef CONFIG_PREEMPT_RT_FULL + case RCU_BH_FLAVOR: + rsp = &rcu_bh_state; + break; ++#endif + case RCU_SCHED_FLAVOR: + rsp = &rcu_sched_state; + break; +@@ -1617,7 +1621,6 @@ static int rcu_future_gp_cleanup(struct rcu_state *rsp, struct rcu_node *rnp) + int needmore; + struct rcu_data *rdp = this_cpu_ptr(rsp->rda); + +- rcu_nocb_gp_cleanup(rsp, rnp); + rnp->need_future_gp[c & 0x1] = 0; + needmore = rnp->need_future_gp[(c + 1) & 0x1]; + trace_rcu_future_gp(rnp, rdp, c, +@@ -1638,7 +1641,7 @@ static void rcu_gp_kthread_wake(struct rcu_state *rsp) + !READ_ONCE(rsp->gp_flags) || + !rsp->gp_kthread) + return; +- swait_wake(&rsp->gp_wq); ++ swake_up(&rsp->gp_wq); + } + + /* +@@ -2018,6 +2021,7 @@ static void rcu_gp_cleanup(struct rcu_state *rsp) + int nocb = 0; + struct rcu_data *rdp; + struct rcu_node *rnp = rcu_get_root(rsp); ++ struct swait_queue_head *sq; + + WRITE_ONCE(rsp->gp_activity, jiffies); + raw_spin_lock_irq(&rnp->lock); +@@ -2056,7 +2060,9 @@ static void rcu_gp_cleanup(struct rcu_state *rsp) + needgp = __note_gp_changes(rsp, rnp, rdp) || needgp; + /* smp_mb() provided by prior unlock-lock pair. */ + nocb += rcu_future_gp_cleanup(rsp, rnp); ++ sq = rcu_nocb_gp_get(rnp); + raw_spin_unlock_irq(&rnp->lock); ++ rcu_nocb_gp_cleanup(sq); + cond_resched_rcu_qs(); + WRITE_ONCE(rsp->gp_activity, jiffies); + rcu_gp_slow(rsp, gp_cleanup_delay); +@@ -2257,7 +2263,7 @@ static void rcu_report_qs_rsp(struct rcu_state *rsp, unsigned long flags) + WARN_ON_ONCE(!rcu_gp_in_progress(rsp)); + WRITE_ONCE(rsp->gp_flags, READ_ONCE(rsp->gp_flags) | RCU_GP_FLAG_FQS); + raw_spin_unlock_irqrestore(&rcu_get_root(rsp)->lock, flags); +- rcu_gp_kthread_wake(rsp); ++ swake_up(&rsp->gp_wq); /* Memory barrier implied by swake_up() path. */ + } + + /* +@@ -2918,7 +2924,7 @@ static void force_quiescent_state(struct rcu_state *rsp) + } + WRITE_ONCE(rsp->gp_flags, READ_ONCE(rsp->gp_flags) | RCU_GP_FLAG_FQS); + raw_spin_unlock_irqrestore(&rnp_old->lock, flags); +- rcu_gp_kthread_wake(rsp); ++ swake_up(&rsp->gp_wq); /* Memory barrier implied by swake_up() path. */ + } + + /* +@@ -3641,7 +3647,7 @@ static void __rcu_report_exp_rnp(struct rcu_state *rsp, struct rcu_node *rnp, + raw_spin_unlock_irqrestore(&rnp->lock, flags); + if (wake) { + smp_mb(); /* EGP done before wake_up(). */ +- swait_wake(&rsp->expedited_wq); ++ swake_up(&rsp->expedited_wq); + } + break; + } +@@ -3898,7 +3904,7 @@ static void synchronize_sched_expedited_wait(struct rcu_state *rsp) + jiffies_start = jiffies; + + for (;;) { +- ret = swait_event_interruptible_timeout( ++ ret = swait_event_timeout( + rsp->expedited_wq, + sync_rcu_preempt_exp_done(rnp_root), + jiffies_stall); +@@ -4574,8 +4580,8 @@ static void __init rcu_init_one(struct rcu_state *rsp, + } + } + +- init_swait_head(&rsp->gp_wq); +- init_swait_head(&rsp->expedited_wq); ++ init_swait_queue_head(&rsp->gp_wq); ++ init_swait_queue_head(&rsp->expedited_wq); + rnp = rsp->level[rcu_num_lvls - 1]; + for_each_possible_cpu(i) { + while (i > rnp->grphi) +@@ -4695,7 +4701,9 @@ void __init rcu_init(void) + + rcu_bootup_announce(); + rcu_init_geometry(); ++#ifndef CONFIG_PREEMPT_RT_FULL + rcu_init_one(&rcu_bh_state, &rcu_bh_data); ++#endif + rcu_init_one(&rcu_sched_state, &rcu_sched_data); + if (dump_tree) + rcu_dump_rcu_node_tree(&rcu_sched_state); +diff --git a/kernel/rcu/tree.h b/kernel/rcu/tree.h +index 588509d..c75834d 100644 +--- a/kernel/rcu/tree.h ++++ b/kernel/rcu/tree.h +@@ -27,8 +27,8 @@ + #include <linux/threads.h> + #include <linux/cpumask.h> + #include <linux/seqlock.h> ++#include <linux/swait.h> + #include <linux/stop_machine.h> +-#include <linux/wait-simple.h> + + /* + * Define shape of hierarchy based on NR_CPUS, CONFIG_RCU_FANOUT, and +@@ -242,7 +242,7 @@ struct rcu_node { + /* Refused to boost: not sure why, though. */ + /* This can happen due to race conditions. */ + #ifdef CONFIG_RCU_NOCB_CPU +- struct swait_head nocb_gp_wq[2]; ++ struct swait_queue_head nocb_gp_wq[2]; + /* Place for rcu_nocb_kthread() to wait GP. */ + #endif /* #ifdef CONFIG_RCU_NOCB_CPU */ + int need_future_gp[2]; +@@ -394,7 +394,7 @@ struct rcu_data { + atomic_long_t nocb_q_count_lazy; /* invocation (all stages). */ + struct rcu_head *nocb_follower_head; /* CBs ready to invoke. */ + struct rcu_head **nocb_follower_tail; +- struct swait_head nocb_wq; /* For nocb kthreads to sleep on. */ ++ struct swait_queue_head nocb_wq; /* For nocb kthreads to sleep on. */ + struct task_struct *nocb_kthread; + int nocb_defer_wakeup; /* Defer wakeup of nocb_kthread. */ + +@@ -473,7 +473,7 @@ struct rcu_state { + unsigned long gpnum; /* Current gp number. */ + unsigned long completed; /* # of last completed gp. */ + struct task_struct *gp_kthread; /* Task for grace periods. */ +- struct swait_head gp_wq; /* Where GP task waits. */ ++ struct swait_queue_head gp_wq; /* Where GP task waits. */ + short gp_flags; /* Commands for GP task. */ + short gp_state; /* GP kthread sleep state. */ + +@@ -505,7 +505,7 @@ struct rcu_state { + atomic_long_t expedited_workdone3; /* # done by others #3. */ + atomic_long_t expedited_normal; /* # fallbacks to normal. */ + atomic_t expedited_need_qs; /* # CPUs left to check in. */ +- struct swait_head expedited_wq; /* Wait for check-ins. */ ++ struct swait_queue_head expedited_wq; /* Wait for check-ins. */ + int ncpus_snap; /* # CPUs seen last time. */ + + unsigned long jiffies_force_qs; /* Time at which to invoke */ +@@ -557,7 +557,9 @@ extern struct list_head rcu_struct_flavors; + */ + extern struct rcu_state rcu_sched_state; + ++#ifndef CONFIG_PREEMPT_RT_FULL + extern struct rcu_state rcu_bh_state; ++#endif + + #ifdef CONFIG_PREEMPT_RCU + extern struct rcu_state rcu_preempt_state; +@@ -605,7 +607,8 @@ static void zero_cpu_stall_ticks(struct rcu_data *rdp); + static void increment_cpu_stall_ticks(void); + static bool rcu_nocb_cpu_needs_barrier(struct rcu_state *rsp, int cpu); + static void rcu_nocb_gp_set(struct rcu_node *rnp, int nrq); +-static void rcu_nocb_gp_cleanup(struct rcu_state *rsp, struct rcu_node *rnp); ++static struct swait_queue_head *rcu_nocb_gp_get(struct rcu_node *rnp); ++static void rcu_nocb_gp_cleanup(struct swait_queue_head *sq); + static void rcu_init_one_nocb(struct rcu_node *rnp); + static bool __call_rcu_nocb(struct rcu_data *rdp, struct rcu_head *rhp, + bool lazy, unsigned long flags); +diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h +index 0d2f27f2..8e119cf 100644 +--- a/kernel/rcu/tree_plugin.h ++++ b/kernel/rcu/tree_plugin.h +@@ -1717,9 +1717,9 @@ early_param("rcu_nocb_poll", parse_rcu_nocb_poll); + * Wake up any no-CBs CPUs' kthreads that were waiting on the just-ended + * grace period. + */ +-static void rcu_nocb_gp_cleanup(struct rcu_state *rsp, struct rcu_node *rnp) ++static void rcu_nocb_gp_cleanup(struct swait_queue_head *sq) + { +- swait_wake_all(&rnp->nocb_gp_wq[rnp->completed & 0x1]); ++ swake_up_all(sq); + } + + /* +@@ -1735,10 +1735,15 @@ static void rcu_nocb_gp_set(struct rcu_node *rnp, int nrq) + rnp->need_future_gp[(rnp->completed + 1) & 0x1] += nrq; + } + ++static struct swait_queue_head *rcu_nocb_gp_get(struct rcu_node *rnp) ++{ ++ return &rnp->nocb_gp_wq[rnp->completed & 0x1]; ++} ++ + static void rcu_init_one_nocb(struct rcu_node *rnp) + { +- init_swait_head(&rnp->nocb_gp_wq[0]); +- init_swait_head(&rnp->nocb_gp_wq[1]); ++ init_swait_queue_head(&rnp->nocb_gp_wq[0]); ++ init_swait_queue_head(&rnp->nocb_gp_wq[1]); + } + + #ifndef CONFIG_RCU_NOCB_CPU_ALL +@@ -1763,7 +1768,7 @@ static void wake_nocb_leader(struct rcu_data *rdp, bool force) + if (READ_ONCE(rdp_leader->nocb_leader_sleep) || force) { + /* Prior smp_mb__after_atomic() orders against prior enqueue. */ + WRITE_ONCE(rdp_leader->nocb_leader_sleep, false); +- swait_wake(&rdp_leader->nocb_wq); ++ swake_up(&rdp_leader->nocb_wq); + } + } + +@@ -2079,7 +2084,7 @@ static void nocb_leader_wait(struct rcu_data *my_rdp) + * List was empty, wake up the follower. + * Memory barriers supplied by atomic_long_add(). + */ +- swait_wake(&rdp->nocb_wq); ++ swake_up(&rdp->nocb_wq); + } + } + +@@ -2259,7 +2264,7 @@ void __init rcu_init_nohz(void) + static void __init rcu_boot_init_nocb_percpu_data(struct rcu_data *rdp) + { + rdp->nocb_tail = &rdp->nocb_head; +- init_swait_head(&rdp->nocb_wq); ++ init_swait_queue_head(&rdp->nocb_wq); + rdp->nocb_follower_tail = &rdp->nocb_follower_head; + } + +@@ -2409,7 +2414,7 @@ static bool rcu_nocb_cpu_needs_barrier(struct rcu_state *rsp, int cpu) + return false; + } + +-static void rcu_nocb_gp_cleanup(struct rcu_state *rsp, struct rcu_node *rnp) ++static void rcu_nocb_gp_cleanup(struct swait_queue_head *sq) + { + } + +@@ -2417,6 +2422,11 @@ static void rcu_nocb_gp_set(struct rcu_node *rnp, int nrq) + { + } + ++static struct swait_queue_head *rcu_nocb_gp_get(struct rcu_node *rnp) ++{ ++ return NULL; ++} ++ + static void rcu_init_one_nocb(struct rcu_node *rnp) + { + } +diff --git a/kernel/sched/Makefile b/kernel/sched/Makefile +index a22fdb6..debedbe 100644 +--- a/kernel/sched/Makefile ++++ b/kernel/sched/Makefile +@@ -13,7 +13,7 @@ endif + + obj-y += core.o loadavg.o clock.o cputime.o + obj-y += idle_task.o fair.o rt.o deadline.o stop_task.o +-obj-y += wait.o wait-simple.o work-simple.o completion.o idle.o ++obj-y += wait.o swait.o work-simple.o completion.o idle.o + obj-$(CONFIG_SMP) += cpupri.o cpudeadline.o + obj-$(CONFIG_SCHED_AUTOGROUP) += auto_group.o + obj-$(CONFIG_SCHEDSTATS) += stats.o +diff --git a/kernel/sched/completion.c b/kernel/sched/completion.c +index 45ebcff..b62cf64 100644 +--- a/kernel/sched/completion.c ++++ b/kernel/sched/completion.c +@@ -32,7 +32,7 @@ void complete(struct completion *x) + + raw_spin_lock_irqsave(&x->wait.lock, flags); + x->done++; +- __swait_wake_locked(&x->wait, TASK_NORMAL, 1); ++ swake_up_locked(&x->wait); + raw_spin_unlock_irqrestore(&x->wait.lock, flags); + } + EXPORT_SYMBOL(complete); +@@ -52,7 +52,7 @@ void complete_all(struct completion *x) + + raw_spin_lock_irqsave(&x->wait.lock, flags); + x->done += UINT_MAX/2; +- __swait_wake_locked(&x->wait, TASK_NORMAL, 0); ++ swake_up_all_locked(&x->wait); + raw_spin_unlock_irqrestore(&x->wait.lock, flags); + } + EXPORT_SYMBOL(complete_all); +@@ -62,9 +62,9 @@ do_wait_for_common(struct completion *x, + long (*action)(long), long timeout, int state) + { + if (!x->done) { +- DEFINE_SWAITER(wait); ++ DECLARE_SWAITQUEUE(wait); + +- swait_prepare_locked(&x->wait, &wait); ++ __prepare_to_swait(&x->wait, &wait); + do { + if (signal_pending_state(state, current)) { + timeout = -ERESTARTSYS; +@@ -75,7 +75,7 @@ do_wait_for_common(struct completion *x, + timeout = action(timeout); + raw_spin_lock_irq(&x->wait.lock); + } while (!x->done && timeout); +- swait_finish_locked(&x->wait, &wait); ++ __finish_swait(&x->wait, &wait); + if (!x->done) + return timeout; + } +diff --git a/kernel/sched/core.c b/kernel/sched/core.c +index b2959ea..94827a5 100644 +--- a/kernel/sched/core.c ++++ b/kernel/sched/core.c +@@ -3039,16 +3039,6 @@ u64 scheduler_tick_max_deferment(void) + } + #endif + +-notrace unsigned long get_parent_ip(unsigned long addr) +-{ +- if (in_lock_functions(addr)) { +- addr = CALLER_ADDR2; +- if (in_lock_functions(addr)) +- addr = CALLER_ADDR3; +- } +- return addr; +-} +- + #if defined(CONFIG_PREEMPT) && (defined(CONFIG_DEBUG_PREEMPT) || \ + defined(CONFIG_PREEMPT_TRACER)) + +@@ -3070,7 +3060,7 @@ void preempt_count_add(int val) + PREEMPT_MASK - 10); + #endif + if (preempt_count() == val) { +- unsigned long ip = get_parent_ip(CALLER_ADDR1); ++ unsigned long ip = get_lock_parent_ip(); + #ifdef CONFIG_DEBUG_PREEMPT + current->preempt_disable_ip = ip; + #endif +@@ -3097,7 +3087,7 @@ void preempt_count_sub(int val) + #endif + + if (preempt_count() == val) +- trace_preempt_on(CALLER_ADDR0, get_parent_ip(CALLER_ADDR1)); ++ trace_preempt_on(CALLER_ADDR0, get_lock_parent_ip()); + __preempt_count_sub(val); + } + EXPORT_SYMBOL(preempt_count_sub); +@@ -3157,7 +3147,7 @@ void migrate_disable(void) + { + struct task_struct *p = current; + +- if (in_atomic()) { ++ if (in_atomic() || irqs_disabled()) { + #ifdef CONFIG_SCHED_DEBUG + p->migrate_disable_atomic++; + #endif +@@ -3180,7 +3170,6 @@ void migrate_disable(void) + preempt_lazy_disable(); + pin_current_cpu(); + p->migrate_disable = 1; +- p->nr_cpus_allowed = 1; + preempt_enable(); + } + EXPORT_SYMBOL(migrate_disable); +@@ -3189,7 +3178,7 @@ void migrate_enable(void) + { + struct task_struct *p = current; + +- if (in_atomic()) { ++ if (in_atomic() || irqs_disabled()) { + #ifdef CONFIG_SCHED_DEBUG + p->migrate_disable_atomic--; + #endif +@@ -3470,7 +3459,7 @@ static void __sched notrace preempt_schedule_common(void) + * set by a RT task. Oterwise we try to avoid beeing scheduled out as long as + * preempt_lazy_count counter >0. + */ +-static int preemptible_lazy(void) ++static __always_inline int preemptible_lazy(void) + { + if (test_thread_flag(TIF_NEED_RESCHED)) + return 1; +diff --git a/kernel/sched/swait.c b/kernel/sched/swait.c +new file mode 100644 +index 0000000..205fe36 +--- /dev/null ++++ b/kernel/sched/swait.c +@@ -0,0 +1,143 @@ ++#include <linux/sched.h> ++#include <linux/swait.h> ++#include <linux/suspend.h> ++ ++void __init_swait_queue_head(struct swait_queue_head *q, const char *name, ++ struct lock_class_key *key) ++{ ++ raw_spin_lock_init(&q->lock); ++ lockdep_set_class_and_name(&q->lock, key, name); ++ INIT_LIST_HEAD(&q->task_list); ++} ++EXPORT_SYMBOL(__init_swait_queue_head); ++ ++/* ++ * The thing about the wake_up_state() return value; I think we can ignore it. ++ * ++ * If for some reason it would return 0, that means the previously waiting ++ * task is already running, so it will observe condition true (or has already). ++ */ ++void swake_up_locked(struct swait_queue_head *q) ++{ ++ struct swait_queue *curr; ++ ++ if (list_empty(&q->task_list)) ++ return; ++ ++ curr = list_first_entry(&q->task_list, typeof(*curr), task_list); ++ wake_up_process(curr->task); ++ list_del_init(&curr->task_list); ++} ++EXPORT_SYMBOL(swake_up_locked); ++ ++void swake_up_all_locked(struct swait_queue_head *q) ++{ ++ struct swait_queue *curr; ++ int wakes = 0; ++ ++ while (!list_empty(&q->task_list)) { ++ ++ curr = list_first_entry(&q->task_list, typeof(*curr), ++ task_list); ++ wake_up_process(curr->task); ++ list_del_init(&curr->task_list); ++ wakes++; ++ } ++ if (pm_in_action) ++ return; ++ WARN(wakes > 2, "complate_all() with %d waiters\n", wakes); ++} ++EXPORT_SYMBOL(swake_up_all_locked); ++ ++void swake_up(struct swait_queue_head *q) ++{ ++ unsigned long flags; ++ ++ if (!swait_active(q)) ++ return; ++ ++ raw_spin_lock_irqsave(&q->lock, flags); ++ swake_up_locked(q); ++ raw_spin_unlock_irqrestore(&q->lock, flags); ++} ++EXPORT_SYMBOL(swake_up); ++ ++/* ++ * Does not allow usage from IRQ disabled, since we must be able to ++ * release IRQs to guarantee bounded hold time. ++ */ ++void swake_up_all(struct swait_queue_head *q) ++{ ++ struct swait_queue *curr; ++ LIST_HEAD(tmp); ++ ++ if (!swait_active(q)) ++ return; ++ ++ raw_spin_lock_irq(&q->lock); ++ list_splice_init(&q->task_list, &tmp); ++ while (!list_empty(&tmp)) { ++ curr = list_first_entry(&tmp, typeof(*curr), task_list); ++ ++ wake_up_state(curr->task, TASK_NORMAL); ++ list_del_init(&curr->task_list); ++ ++ if (list_empty(&tmp)) ++ break; ++ ++ raw_spin_unlock_irq(&q->lock); ++ raw_spin_lock_irq(&q->lock); ++ } ++ raw_spin_unlock_irq(&q->lock); ++} ++EXPORT_SYMBOL(swake_up_all); ++ ++void __prepare_to_swait(struct swait_queue_head *q, struct swait_queue *wait) ++{ ++ wait->task = current; ++ if (list_empty(&wait->task_list)) ++ list_add(&wait->task_list, &q->task_list); ++} ++ ++void prepare_to_swait(struct swait_queue_head *q, struct swait_queue *wait, int state) ++{ ++ unsigned long flags; ++ ++ raw_spin_lock_irqsave(&q->lock, flags); ++ __prepare_to_swait(q, wait); ++ set_current_state(state); ++ raw_spin_unlock_irqrestore(&q->lock, flags); ++} ++EXPORT_SYMBOL(prepare_to_swait); ++ ++long prepare_to_swait_event(struct swait_queue_head *q, struct swait_queue *wait, int state) ++{ ++ if (signal_pending_state(state, current)) ++ return -ERESTARTSYS; ++ ++ prepare_to_swait(q, wait, state); ++ ++ return 0; ++} ++EXPORT_SYMBOL(prepare_to_swait_event); ++ ++void __finish_swait(struct swait_queue_head *q, struct swait_queue *wait) ++{ ++ __set_current_state(TASK_RUNNING); ++ if (!list_empty(&wait->task_list)) ++ list_del_init(&wait->task_list); ++} ++ ++void finish_swait(struct swait_queue_head *q, struct swait_queue *wait) ++{ ++ unsigned long flags; ++ ++ __set_current_state(TASK_RUNNING); ++ ++ if (!list_empty_careful(&wait->task_list)) { ++ raw_spin_lock_irqsave(&q->lock, flags); ++ list_del_init(&wait->task_list); ++ raw_spin_unlock_irqrestore(&q->lock, flags); ++ } ++} ++EXPORT_SYMBOL(finish_swait); +diff --git a/kernel/sched/wait-simple.c b/kernel/sched/wait-simple.c +deleted file mode 100644 +index 7dfa86d..0000000 +--- a/kernel/sched/wait-simple.c ++++ /dev/null +@@ -1,115 +0,0 @@ +-/* +- * Simple waitqueues without fancy flags and callbacks +- * +- * (C) 2011 Thomas Gleixner <tglx@linutronix.de> +- * +- * Based on kernel/wait.c +- * +- * For licencing details see kernel-base/COPYING +- */ +-#include <linux/init.h> +-#include <linux/export.h> +-#include <linux/sched.h> +-#include <linux/wait-simple.h> +- +-/* Adds w to head->list. Must be called with head->lock locked. */ +-static inline void __swait_enqueue(struct swait_head *head, struct swaiter *w) +-{ +- list_add(&w->node, &head->list); +- /* We can't let the condition leak before the setting of head */ +- smp_mb(); +-} +- +-/* Removes w from head->list. Must be called with head->lock locked. */ +-static inline void __swait_dequeue(struct swaiter *w) +-{ +- list_del_init(&w->node); +-} +- +-void __init_swait_head(struct swait_head *head, struct lock_class_key *key) +-{ +- raw_spin_lock_init(&head->lock); +- lockdep_set_class(&head->lock, key); +- INIT_LIST_HEAD(&head->list); +-} +-EXPORT_SYMBOL(__init_swait_head); +- +-void swait_prepare_locked(struct swait_head *head, struct swaiter *w) +-{ +- w->task = current; +- if (list_empty(&w->node)) +- __swait_enqueue(head, w); +-} +- +-void swait_prepare(struct swait_head *head, struct swaiter *w, int state) +-{ +- unsigned long flags; +- +- raw_spin_lock_irqsave(&head->lock, flags); +- swait_prepare_locked(head, w); +- __set_current_state(state); +- raw_spin_unlock_irqrestore(&head->lock, flags); +-} +-EXPORT_SYMBOL(swait_prepare); +- +-void swait_finish_locked(struct swait_head *head, struct swaiter *w) +-{ +- __set_current_state(TASK_RUNNING); +- if (w->task) +- __swait_dequeue(w); +-} +- +-void swait_finish(struct swait_head *head, struct swaiter *w) +-{ +- unsigned long flags; +- +- __set_current_state(TASK_RUNNING); +- if (w->task) { +- raw_spin_lock_irqsave(&head->lock, flags); +- __swait_dequeue(w); +- raw_spin_unlock_irqrestore(&head->lock, flags); +- } +-} +-EXPORT_SYMBOL(swait_finish); +- +-unsigned int +-__swait_wake_locked(struct swait_head *head, unsigned int state, unsigned int num) +-{ +- struct swaiter *curr, *next; +- int woken = 0; +- +- list_for_each_entry_safe(curr, next, &head->list, node) { +- if (wake_up_state(curr->task, state)) { +- __swait_dequeue(curr); +- /* +- * The waiting task can free the waiter as +- * soon as curr->task = NULL is written, +- * without taking any locks. A memory barrier +- * is required here to prevent the following +- * store to curr->task from getting ahead of +- * the dequeue operation. +- */ +- smp_wmb(); +- curr->task = NULL; +- if (++woken == num) +- break; +- } +- } +- return woken; +-} +- +-unsigned int +-__swait_wake(struct swait_head *head, unsigned int state, unsigned int num) +-{ +- unsigned long flags; +- int woken; +- +- if (!swaitqueue_active(head)) +- return 0; +- +- raw_spin_lock_irqsave(&head->lock, flags); +- woken = __swait_wake_locked(head, state, num); +- raw_spin_unlock_irqrestore(&head->lock, flags); +- return woken; +-} +-EXPORT_SYMBOL(__swait_wake); +diff --git a/kernel/sched/work-simple.c b/kernel/sched/work-simple.c +index e57a052..9ffe405 100644 +--- a/kernel/sched/work-simple.c ++++ b/kernel/sched/work-simple.c +@@ -5,7 +5,7 @@ + * PREEMPT_RT_FULL safe. The callbacks are executed in kthread context. + */ + +-#include <linux/wait-simple.h> ++#include <linux/swait.h> + #include <linux/work-simple.h> + #include <linux/kthread.h> + #include <linux/slab.h> +@@ -19,7 +19,7 @@ static struct sworker *glob_worker; + + struct sworker { + struct list_head events; +- struct swait_head wq; ++ struct swait_queue_head wq; + + raw_spinlock_t lock; + +@@ -80,7 +80,7 @@ static struct sworker *swork_create(void) + + INIT_LIST_HEAD(&worker->events); + raw_spin_lock_init(&worker->lock); +- init_swait_head(&worker->wq); ++ init_swait_queue_head(&worker->wq); + + worker->task = kthread_run(swork_kthread, worker, "kswork"); + if (IS_ERR(worker->task)) { +@@ -117,7 +117,7 @@ bool swork_queue(struct swork_event *sev) + list_add_tail(&sev->item, &glob_worker->events); + raw_spin_unlock_irqrestore(&glob_worker->lock, flags); + +- swait_wake(&glob_worker->wq); ++ swake_up(&glob_worker->wq); + return true; + } + EXPORT_SYMBOL_GPL(swork_queue); +diff --git a/kernel/softirq.c b/kernel/softirq.c +index d1e999e..cb9c1d5 100644 +--- a/kernel/softirq.c ++++ b/kernel/softirq.c +@@ -287,9 +287,9 @@ void __local_bh_disable_ip(unsigned long ip, unsigned int cnt) + + if (preempt_count() == cnt) { + #ifdef CONFIG_DEBUG_PREEMPT +- current->preempt_disable_ip = get_parent_ip(CALLER_ADDR1); ++ current->preempt_disable_ip = get_lock_parent_ip(); + #endif +- trace_preempt_off(CALLER_ADDR0, get_parent_ip(CALLER_ADDR1)); ++ trace_preempt_off(CALLER_ADDR0, get_lock_parent_ip()); + } + } + EXPORT_SYMBOL(__local_bh_disable_ip); +@@ -563,8 +563,10 @@ static void do_current_softirqs(void) + do_single_softirq(i); + } + softirq_clr_runner(i); +- unlock_softirq(i); + WARN_ON(current->softirq_nestcnt != 1); ++ local_irq_enable(); ++ unlock_softirq(i); ++ local_irq_disable(); + } + } + +diff --git a/kernel/stop_machine.c b/kernel/stop_machine.c +index 2c5acc8..f84d3b4 100644 +--- a/kernel/stop_machine.c ++++ b/kernel/stop_machine.c +@@ -30,7 +30,7 @@ struct cpu_stop_done { + atomic_t nr_todo; /* nr left to execute */ + bool executed; /* actually executed? */ + int ret; /* collected return value */ +- struct task_struct *waiter; /* woken when nr_todo reaches 0 */ ++ struct completion completion; /* fired if nr_todo reaches 0 */ + }; + + /* the actual stopper, one per every possible cpu, enabled on online cpus */ +@@ -59,7 +59,7 @@ static void cpu_stop_init_done(struct cpu_stop_done *done, unsigned int nr_todo) + { + memset(done, 0, sizeof(*done)); + atomic_set(&done->nr_todo, nr_todo); +- done->waiter = current; ++ init_completion(&done->completion); + } + + /* signal completion unless @done is NULL */ +@@ -68,10 +68,8 @@ static void cpu_stop_signal_done(struct cpu_stop_done *done, bool executed) + if (done) { + if (executed) + done->executed = true; +- if (atomic_dec_and_test(&done->nr_todo)) { +- wake_up_process(done->waiter); +- done->waiter = NULL; +- } ++ if (atomic_dec_and_test(&done->nr_todo)) ++ complete(&done->completion); + } + } + +@@ -96,22 +94,6 @@ static void cpu_stop_queue_work(unsigned int cpu, struct cpu_stop_work *work) + raw_spin_unlock_irqrestore(&stopper->lock, flags); + } + +-static void wait_for_stop_done(struct cpu_stop_done *done) +-{ +- set_current_state(TASK_UNINTERRUPTIBLE); +- while (atomic_read(&done->nr_todo)) { +- schedule(); +- set_current_state(TASK_UNINTERRUPTIBLE); +- } +- /* +- * We need to wait until cpu_stop_signal_done() has cleared +- * done->waiter. +- */ +- while (done->waiter) +- cpu_relax(); +- set_current_state(TASK_RUNNING); +-} +- + /** + * stop_one_cpu - stop a cpu + * @cpu: cpu to stop +@@ -143,7 +125,7 @@ int stop_one_cpu(unsigned int cpu, cpu_stop_fn_t fn, void *arg) + + cpu_stop_init_done(&done, 1); + cpu_stop_queue_work(cpu, &work); +- wait_for_stop_done(&done); ++ wait_for_completion(&done.completion); + return done.executed ? done.ret : -ENOENT; + } + +@@ -302,7 +284,7 @@ int stop_two_cpus(unsigned int cpu1, unsigned int cpu2, cpu_stop_fn_t fn, void * + + preempt_enable_nort(); + +- wait_for_stop_done(&done); ++ wait_for_completion(&done.completion); + + return done.executed ? done.ret : -ENOENT; + } +@@ -364,7 +346,7 @@ static int __stop_cpus(const struct cpumask *cpumask, + + cpu_stop_init_done(&done, cpumask_weight(cpumask)); + queue_stop_cpus_work(cpumask, fn, arg, &done, false); +- wait_for_stop_done(&done); ++ wait_for_completion(&done.completion); + return done.executed ? done.ret : -ENOENT; + } + +@@ -495,13 +477,7 @@ static void cpu_stopper_thread(unsigned int cpu) + kallsyms_lookup((unsigned long)fn, NULL, NULL, NULL, + ksym_buf), arg); + +- /* +- * Make sure that the wakeup and setting done->waiter +- * to NULL is atomic. +- */ +- local_irq_disable(); + cpu_stop_signal_done(done, true); +- local_irq_enable(); + goto repeat; + } + } +@@ -663,7 +639,7 @@ int stop_machine_from_inactive_cpu(cpu_stop_fn_t fn, void *data, + ret = multi_cpu_stop(&msdata); + + /* Busy wait for completion. */ +- while (atomic_read(&done.nr_todo)) ++ while (!completion_done(&done.completion)) + cpu_relax(); + + mutex_unlock(&stop_cpus_mutex); +diff --git a/kernel/time/tick-broadcast-hrtimer.c b/kernel/time/tick-broadcast-hrtimer.c +index 53d7184..1b4ac33 100644 +--- a/kernel/time/tick-broadcast-hrtimer.c ++++ b/kernel/time/tick-broadcast-hrtimer.c +@@ -106,5 +106,6 @@ void tick_setup_hrtimer_broadcast(void) + { + hrtimer_init(&bctimer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS); + bctimer.function = bc_handler; ++ bctimer.irqsafe = true; + clockevents_register_device(&ce_broadcast_hrtimer); + } +diff --git a/kernel/trace/trace_irqsoff.c b/kernel/trace/trace_irqsoff.c +index 36e584f..069942c 100644 +--- a/kernel/trace/trace_irqsoff.c ++++ b/kernel/trace/trace_irqsoff.c +@@ -421,13 +421,13 @@ void start_critical_timings(void) + { + if (preempt_trace() || irq_trace()) + start_critical_timing(CALLER_ADDR0, CALLER_ADDR1); +- trace_preemptirqsoff_hist(TRACE_START, 1); ++ trace_preemptirqsoff_hist_rcuidle(TRACE_START, 1); + } + EXPORT_SYMBOL_GPL(start_critical_timings); + + void stop_critical_timings(void) + { +- trace_preemptirqsoff_hist(TRACE_STOP, 0); ++ trace_preemptirqsoff_hist_rcuidle(TRACE_STOP, 0); + if (preempt_trace() || irq_trace()) + stop_critical_timing(CALLER_ADDR0, CALLER_ADDR1); + } +@@ -437,7 +437,7 @@ EXPORT_SYMBOL_GPL(stop_critical_timings); + #ifdef CONFIG_PROVE_LOCKING + void time_hardirqs_on(unsigned long a0, unsigned long a1) + { +- trace_preemptirqsoff_hist(IRQS_ON, 0); ++ trace_preemptirqsoff_hist_rcuidle(IRQS_ON, 0); + if (!preempt_trace() && irq_trace()) + stop_critical_timing(a0, a1); + } +@@ -446,7 +446,7 @@ void time_hardirqs_off(unsigned long a0, unsigned long a1) + { + if (!preempt_trace() && irq_trace()) + start_critical_timing(a0, a1); +- trace_preemptirqsoff_hist(IRQS_OFF, 1); ++ trace_preemptirqsoff_hist_rcuidle(IRQS_OFF, 1); + } + + #else /* !CONFIG_PROVE_LOCKING */ +diff --git a/lib/dump_stack.c b/lib/dump_stack.c +index 7ccbc6f..6745c62 100644 +--- a/lib/dump_stack.c ++++ b/lib/dump_stack.c +@@ -33,7 +33,7 @@ asmlinkage __visible void dump_stack(void) + * Permit this cpu to perform nested stack dumps while serialising + * against other CPUs + */ +- migrate_disable(); ++ preempt_disable(); + + retry: + cpu = smp_processor_id(); +@@ -52,7 +52,7 @@ asmlinkage __visible void dump_stack(void) + if (!was_locked) + atomic_set(&dump_lock, -1); + +- migrate_enable(); ++ preempt_enable(); + } + #else + asmlinkage __visible void dump_stack(void) +diff --git a/localversion-rt b/localversion-rt +index 5c84f62..76db1e9 100644 +--- a/localversion-rt ++++ b/localversion-rt +@@ -1 +1 @@ +-+rt3 +++rt13 +diff --git a/mm/backing-dev.c b/mm/backing-dev.c +index cbe6f0b..6871838 100644 +--- a/mm/backing-dev.c ++++ b/mm/backing-dev.c +@@ -457,9 +457,9 @@ void wb_congested_put(struct bdi_writeback_congested *congested) + { + unsigned long flags; + +- local_irq_save(flags); ++ local_irq_save_nort(flags); + if (!atomic_dec_and_lock(&congested->refcnt, &cgwb_lock)) { +- local_irq_restore(flags); ++ local_irq_restore_nort(flags); + return; + } + +diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c +index fc08399..18cc59f 100644 +--- a/mm/zsmalloc.c ++++ b/mm/zsmalloc.c +@@ -1289,7 +1289,7 @@ void *zs_map_object(struct zs_pool *pool, unsigned long handle, + class = pool->size_class[class_idx]; + off = obj_idx_to_offset(page, obj_idx, class->size); + +- area = &get_cpu_var(zs_map_area); ++ area = per_cpu_ptr(&zs_map_area, get_cpu_light()); + area->vm_mm = mm; + if (off + class->size <= PAGE_SIZE) { + /* this object is contained entirely within a page */ +@@ -1342,7 +1342,7 @@ void zs_unmap_object(struct zs_pool *pool, unsigned long handle) + + __zs_unmap_object(area, pages, off, class->size); + } +- put_cpu_var(zs_map_area); ++ put_cpu_light(); + unpin_tag(handle); + } + EXPORT_SYMBOL_GPL(zs_unmap_object); +diff --git a/net/core/dev.c b/net/core/dev.c +index 5ec7abf..0e17592 100644 +--- a/net/core/dev.c ++++ b/net/core/dev.c +@@ -2891,7 +2891,11 @@ static inline int __dev_xmit_skb(struct sk_buff *skb, struct Qdisc *q, + * This permits __QDISC___STATE_RUNNING owner to get the lock more + * often and dequeue packets faster. + */ ++#ifdef CONFIG_PREEMPT_RT_FULL ++ contended = true; ++#else + contended = qdisc_is_running(q); ++#endif + if (unlikely(contended)) + spin_lock(&q->busylock); + +@@ -2983,7 +2987,7 @@ static inline void xmit_rec_inc(void) + __this_cpu_inc(xmit_recursion); + } + +-static inline int xmit_rec_dec(void) ++static inline void xmit_rec_dec(void) + { + __this_cpu_dec(xmit_recursion); + } +diff --git a/virt/kvm/async_pf.c b/virt/kvm/async_pf.c +index 57d9436..9378d09 100644 +--- a/virt/kvm/async_pf.c ++++ b/virt/kvm/async_pf.c +@@ -98,8 +98,8 @@ static void async_pf_execute(struct work_struct *work) + * This memory barrier pairs with prepare_to_wait's set_current_state() + */ + smp_mb(); +- if (swaitqueue_active(&vcpu->wq)) +- swait_wake_interruptible(&vcpu->wq); ++ if (swait_active(&vcpu->wq)) ++ swake_up(&vcpu->wq); + + mmput(mm); + kvm_put_kvm(vcpu->kvm); +diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c +index a076690..eeed326 100644 +--- a/virt/kvm/kvm_main.c ++++ b/virt/kvm/kvm_main.c +@@ -226,8 +226,7 @@ int kvm_vcpu_init(struct kvm_vcpu *vcpu, struct kvm *kvm, unsigned id) + vcpu->kvm = kvm; + vcpu->vcpu_id = id; + vcpu->pid = NULL; +- vcpu->halt_poll_ns = 0; +- init_swait_head(&vcpu->wq); ++ init_swait_queue_head(&vcpu->wq); + kvm_async_pf_vcpu_init(vcpu); + + vcpu->pre_pcpu = -1; +@@ -2002,7 +2001,7 @@ static int kvm_vcpu_check_block(struct kvm_vcpu *vcpu) + void kvm_vcpu_block(struct kvm_vcpu *vcpu) + { + ktime_t start, cur; +- DEFINE_SWAITER(wait); ++ DECLARE_SWAITQUEUE(wait); + bool waited = false; + u64 block_ns; + +@@ -2027,7 +2026,7 @@ void kvm_vcpu_block(struct kvm_vcpu *vcpu) + kvm_arch_vcpu_blocking(vcpu); + + for (;;) { +- swait_prepare(&vcpu->wq, &wait, TASK_INTERRUPTIBLE); ++ prepare_to_swait(&vcpu->wq, &wait, TASK_INTERRUPTIBLE); + + if (kvm_vcpu_check_block(vcpu) < 0) + break; +@@ -2036,7 +2035,7 @@ void kvm_vcpu_block(struct kvm_vcpu *vcpu) + schedule(); + } + +- swait_finish(&vcpu->wq, &wait); ++ finish_swait(&vcpu->wq, &wait); + cur = ktime_get(); + + kvm_arch_vcpu_unblocking(vcpu); +@@ -2068,11 +2067,11 @@ void kvm_vcpu_kick(struct kvm_vcpu *vcpu) + { + int me; + int cpu = vcpu->cpu; +- struct swait_head *wqp; ++ struct swait_queue_head *wqp; + + wqp = kvm_arch_vcpu_wq(vcpu); +- if (swaitqueue_active(wqp)) { +- swait_wake_interruptible(wqp); ++ if (swait_active(wqp)) { ++ swake_up(wqp); + ++vcpu->stat.halt_wakeup; + } + +@@ -2173,7 +2172,7 @@ void kvm_vcpu_on_spin(struct kvm_vcpu *me) + continue; + if (vcpu == me) + continue; +- if (swaitqueue_active(&vcpu->wq) && !kvm_arch_vcpu_runnable(vcpu)) ++ if (swait_active(&vcpu->wq) && !kvm_arch_vcpu_runnable(vcpu)) + continue; + if (!kvm_vcpu_eligible_for_directed_yield(vcpu)) + continue; + +From 7885305d87ec4603480459d48f5f54ebcc71fe20 Mon Sep 17 00:00:00 2001 +From: Jon Nettleton <jon.nettleton@gmail.com> +Date: Tue, 11 Aug 2015 13:36:09 +0200 +Subject: [PATCH 03/13] gpu: galcore: Don't abuse the dma_* apis + +There is no reason we can't pass the device to the dma_* api's, +so do it. This does not follow the traditional vivante syntax +but it is more correct for in kernel drivers. + +(cherry picked from commit 3010fb04e38c5952d156afb1290e69a44c3017b8) +Signed-off-by: Matus Kral <matuskral@me.com> +--- + drivers/gpu/galcore/gc_hal_kernel_device.c | 3 +++ + drivers/gpu/galcore/gc_hal_kernel_device.h | 3 +++ + drivers/gpu/galcore/gc_hal_kernel_os.c | 20 ++++++++++---------- + drivers/gpu/galcore/gc_hal_kernel_probe.c | 5 +++-- + 4 files changed, 19 insertions(+), 12 deletions(-) + +diff --git a/drivers/gpu/galcore/gc_hal_kernel_device.c b/drivers/gpu/galcore/gc_hal_kernel_device.c +index e99d29f..42a0b24 100644 +--- a/drivers/gpu/galcore/gc_hal_kernel_device.c ++++ b/drivers/gpu/galcore/gc_hal_kernel_device.c +@@ -683,6 +683,7 @@ gckGALDEVICE_Construct( + IN gctINT PowerManagement, + IN gctINT GpuProfiler, + IN gcsDEVICE_CONSTRUCT_ARGS * Args, ++ IN struct device *dev, + OUT gckGALDEVICE *Device + ) + { +@@ -729,6 +730,8 @@ gckGALDEVICE_Construct( + + device->platform = Args->platform; + ++ device->dev = dev; ++ + gcmkONERROR(_DebugfsInit(device)); + + if (gckDEBUGFS_CreateNode( +diff --git a/drivers/gpu/galcore/gc_hal_kernel_device.h b/drivers/gpu/galcore/gc_hal_kernel_device.h +index c94d67c..4d66a6a 100644 +--- a/drivers/gpu/galcore/gc_hal_kernel_device.h ++++ b/drivers/gpu/galcore/gc_hal_kernel_device.h +@@ -30,6 +30,8 @@ + + typedef struct _gckGALDEVICE + { ++ struct device *dev; ++ + /* Objects. */ + gckOS os; + gckKERNEL kernels[gcdMAX_GPU_COUNT]; +@@ -175,6 +177,7 @@ gceSTATUS gckGALDEVICE_Construct( + IN gctINT PowerManagement, + IN gctINT GpuProfiler, + IN gcsDEVICE_CONSTRUCT_ARGS * Args, ++ IN struct device *dev, + OUT gckGALDEVICE *Device + ); + +diff --git a/drivers/gpu/galcore/gc_hal_kernel_os.c b/drivers/gpu/galcore/gc_hal_kernel_os.c +index e05262b..0457574 100644 +--- a/drivers/gpu/galcore/gc_hal_kernel_os.c ++++ b/drivers/gpu/galcore/gc_hal_kernel_os.c +@@ -1092,7 +1092,7 @@ gckOS_MapMemory( + } + + #ifndef NO_DMA_COHERENT +- if (dma_mmap_writecombine(gcvNULL, ++ if (dma_mmap_writecombine(Os->device->dev, + mdlMap->vma, + mdl->addr, + mdl->dmaHandle, +@@ -1411,9 +1411,9 @@ gckOS_AllocateNonPagedMemory( + + #ifndef NO_DMA_COHERENT + #ifdef CONFIG_ARM64 +- addr = dma_alloc_coherent(gcvNULL, ++ addr = dma_alloc_coherent(Os->device->dev, + #else +- addr = dma_alloc_writecombine(gcvNULL, ++ addr = dma_alloc_writecombine(Os->device->dev, + #endif + mdl->numPages * PAGE_SIZE, + &mdl->dmaHandle, +@@ -1442,7 +1442,7 @@ gckOS_AllocateNonPagedMemory( + #if !defined(CONFIG_PPC) + /* Cache invalidate. */ + dma_sync_single_for_device( +- gcvNULL, ++ Os->device->dev, + page_to_phys(page), + bytes, + DMA_FROM_DEVICE); +@@ -1523,7 +1523,7 @@ gckOS_AllocateNonPagedMemory( + } + + #ifndef NO_DMA_COHERENT +- if (dma_mmap_coherent(gcvNULL, ++ if (dma_mmap_coherent(Os->device->dev, + mdlMap->vma, + mdl->addr, + mdl->dmaHandle, +@@ -1681,9 +1681,9 @@ gceSTATUS gckOS_FreeNonPagedMemory( + + #ifndef NO_DMA_COHERENT + #ifdef CONFIG_ARM64 +- dma_free_coherent(gcvNULL, ++ dma_free_coherent(Os->device->dev, + #else +- dma_free_writecombine(gcvNULL, ++ dma_free_writecombine(Os->device->dev, + #endif + mdl->numPages * PAGE_SIZE, + mdl->addr, +@@ -5383,7 +5383,7 @@ gckOS_CacheClean( + } + + dma_sync_single_for_device( +- gcvNULL, ++ Os->device->dev, + (dma_addr_t)Physical, + Bytes, + DMA_TO_DEVICE); +@@ -5457,7 +5457,7 @@ gckOS_CacheInvalidate( + } + + dma_sync_single_for_device( +- gcvNULL, ++ Os->device->dev, + (dma_addr_t)Physical, + Bytes, + DMA_FROM_DEVICE); +@@ -5533,7 +5533,7 @@ gckOS_CacheFlush( + if (Physical != gcvINVALID_ADDRESS) + { + dma_sync_single_for_device( +- gcvNULL, ++ Os->device->dev, + (dma_addr_t)Physical, + Bytes, + DMA_BIDIRECTIONAL); +diff --git a/drivers/gpu/galcore/gc_hal_kernel_probe.c b/drivers/gpu/galcore/gc_hal_kernel_probe.c +index 10098c3..9c904bd 100644 +--- a/drivers/gpu/galcore/gc_hal_kernel_probe.c ++++ b/drivers/gpu/galcore/gc_hal_kernel_probe.c +@@ -758,7 +758,7 @@ static int drv_mmap( + } + + +-static int drv_init(void) ++static int drv_init(struct platform_device *pdev) + { + int ret; + int result = -EINVAL; +@@ -812,6 +812,7 @@ static int drv_init(void) + powerManagement, + gpuProfiler, + &args, ++ &pdev->dev, + &device + ); + +@@ -975,7 +976,7 @@ static int gpu_probe(struct platform_device *pdev) + _UpdateModuleParam(&moduleParam); + } + +- ret = drv_init(); ++ ret = drv_init(pdev); + + if (!ret) + { + +From 6376b35377c9cdac5465b89c4401b6ceb3dee91e Mon Sep 17 00:00:00 2001 +From: Matus Kral <matuskral@me.com> +Date: Sun, 3 Apr 2016 13:29:34 +0200 +Subject: [PATCH 04/13] gpu: galcore: -rt13 updates + +--- + drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.c b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.c +index 1685e57..ef8a9d2 100644 +--- a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.c ++++ b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.c +@@ -7730,8 +7730,8 @@ gckOS_WaitSignal( + : Wait * HZ / 1000; + #endif + +- DEFINE_SWAITER(wait); +- swait_prepare_locked(&signal->obj.wait, &wait); ++ DECLARE_SWAITQUEUE(wait); ++ __prepare_to_swait(&signal->obj.wait, &wait); + + while (gcvTRUE) + { +@@ -7809,7 +7809,7 @@ gckOS_WaitSignal( + } + } + +- swait_finish_locked(&signal->obj.wait, &wait); ++ __finish_swait(&signal->obj.wait, &wait); + + #if gcdDETECT_TIMEOUT + if (complained) + +From a665ce6296067e0685b559d9b355d10718c08ff3 Mon Sep 17 00:00:00 2001 +From: Matus Kral <matuskral@me.com> +Date: Sun, 3 Apr 2016 13:32:02 +0200 +Subject: [PATCH 05/13] mxc_hdmi: remove blank_state() and abort_stream() + handling + +--- + drivers/video/mxc/mxc_hdmi.c | 5 ----- + 1 file changed, 5 deletions(-) + +diff --git a/drivers/video/mxc/mxc_hdmi.c b/drivers/video/mxc/mxc_hdmi.c +index 5587165..df91138 100644 +--- a/drivers/video/mxc/mxc_hdmi.c ++++ b/drivers/video/mxc/mxc_hdmi.c +@@ -1904,7 +1904,6 @@ static void mxc_hdmi_phy_disable(struct mxc_hdmi *hdmi) + if (!hdmi->phy_enabled) + return; + +- mxc_hdmi_abort_stream(); + hdmi_disable_overflow_interrupts(); + + /* Setting PHY to reset status */ +@@ -2489,7 +2488,6 @@ static void hotplug_worker(struct work_struct *work) + } else if (!(hdmi_phy_pol0 & hdmi->plug_mask)) { + /* Plugout event */ + dev_dbg(&hdmi->pdev->dev, "EVENT=plugout\n"); +- mxc_hdmi_abort_stream(); + mxc_hdmi_cable_disconnected(hdmi); + #if defined(CONFIG_MXC_HDMI_CEC) + mxc_hdmi_cec_handle(0x0); +@@ -2812,13 +2810,10 @@ static int mxc_hdmi_fb_event(struct notifier_block *nb, + + if (hdmi->hp_state > HDMI_HOTPLUG_DISCONNECTED) + mxc_hdmi_setup(hdmi, val); +- hdmi_set_blank_state(1); + + } else if (*((int *)event->data) != hdmi->blank) { + dev_dbg(&hdmi->pdev->dev, + "event=FB_EVENT_BLANK - BLANK\n"); +- mxc_hdmi_abort_stream(); +- hdmi_set_blank_state(0); + + mxc_hdmi_phy_disable(hdmi); + + +From fa3ba4775d9154b53411fbccd4ecc2599d534d26 Mon Sep 17 00:00:00 2001 +From: Matus Kral <matuskral@me.com> +Date: Mon, 4 Apr 2016 01:43:46 +0200 +Subject: [PATCH 06/13] clk: cosmetics, reorder + +--- + drivers/clk/imx/clk-imx6q.c | 23 +++++++++++++---------- + 1 file changed, 13 insertions(+), 10 deletions(-) + +diff --git a/drivers/clk/imx/clk-imx6q.c b/drivers/clk/imx/clk-imx6q.c +index d3366be..ceb8703 100644 +--- a/drivers/clk/imx/clk-imx6q.c ++++ b/drivers/clk/imx/clk-imx6q.c +@@ -507,6 +507,7 @@ static void __init imx6q_clocks_init(struct device_node *ccm_node) + clk_data.clk_num = ARRAY_SIZE(clk); + of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data); + ++ clk_register_clkdev(clk[IMX6QDL_CLK_GPT_3M], "gpt_3m", "imx-gpt.0"); + clk_register_clkdev(clk[IMX6QDL_CLK_ENET_REF], "enet_ref", NULL); + + if ((imx_get_soc_revision() != IMX_CHIP_REVISION_1_0) || +@@ -515,6 +516,10 @@ static void __init imx6q_clocks_init(struct device_node *ccm_node) + imx_clk_set_parent(clk[IMX6QDL_CLK_LDB_DI1_SEL], clk[IMX6QDL_CLK_PLL5_VIDEO_DIV]); + } + ++ imx_clk_set_rate(clk[IMX6QDL_CLK_PLL3_PFD1_540M], 540000000); ++ if (clk_on_imx6dl()) ++ imx_clk_set_parent(clk[IMX6QDL_CLK_IPU1_SEL], clk[IMX6QDL_CLK_PLL3_PFD1_540M]); ++ + imx_clk_set_parent(clk[IMX6QDL_CLK_IPU1_DI0_PRE_SEL], clk[IMX6QDL_CLK_PLL5_VIDEO_DIV]); + imx_clk_set_parent(clk[IMX6QDL_CLK_IPU1_DI1_PRE_SEL], clk[IMX6QDL_CLK_PLL5_VIDEO_DIV]); + imx_clk_set_parent(clk[IMX6QDL_CLK_IPU2_DI0_PRE_SEL], clk[IMX6QDL_CLK_PLL5_VIDEO_DIV]); +@@ -524,8 +529,6 @@ static void __init imx6q_clocks_init(struct device_node *ccm_node) + imx_clk_set_parent(clk[IMX6QDL_CLK_IPU2_DI0_SEL], clk[IMX6QDL_CLK_IPU2_DI0_PRE]); + imx_clk_set_parent(clk[IMX6QDL_CLK_IPU2_DI1_SEL], clk[IMX6QDL_CLK_IPU2_DI1_PRE]); + +- imx_clk_set_rate(clk[IMX6QDL_CLK_PLL3_PFD1_540M], 540000000); +- imx_clk_set_parent(clk[IMX6QDL_CLK_IPU1_SEL], clk[IMX6QDL_CLK_PLL3_PFD1_540M]); + imx_clk_set_parent(clk[IMX6QDL_CLK_AXI_ALT_SEL], clk[IMX6QDL_CLK_PLL3_PFD1_540M]); + imx_clk_set_parent(clk[IMX6QDL_CLK_AXI_SEL], clk[IMX6QDL_CLK_AXI_ALT_SEL]); + /* set epdc/pxp axi clock to 200Mhz */ +@@ -543,6 +546,14 @@ static void __init imx6q_clocks_init(struct device_node *ccm_node) + */ + imx_clk_set_parent(clk[IMX6QDL_CLK_ENFC_SEL], clk[IMX6QDL_CLK_PLL2_PFD2_396M]); + ++ for (i = 0; i < ARRAY_SIZE(clks_init_on); i++) ++ imx_clk_prepare_enable(clk[clks_init_on[i]]); ++ ++ if (IS_ENABLED(CONFIG_USB_MXS_PHY)) { ++ imx_clk_prepare_enable(clk[IMX6QDL_CLK_USBPHY1_GATE]); ++ imx_clk_prepare_enable(clk[IMX6QDL_CLK_USBPHY2_GATE]); ++ } ++ + /* gpu clock initilazation */ + /* + * On mx6dl, 2d core clock sources(sel, podf) is from 3d +@@ -588,14 +599,6 @@ static void __init imx6q_clocks_init(struct device_node *ccm_node) + + imx_register_uart_clocks(uart_clks); + +- for (i = 0; i < ARRAY_SIZE(clks_init_on); i++) +- imx_clk_prepare_enable(clk[clks_init_on[i]]); +- +- if (IS_ENABLED(CONFIG_USB_MXS_PHY)) { +- imx_clk_prepare_enable(clk[IMX6QDL_CLK_USBPHY1_GATE]); +- imx_clk_prepare_enable(clk[IMX6QDL_CLK_USBPHY2_GATE]); +- } +- + imx_clk_set_parent(clk[IMX6QDL_CLK_VPU_AXI_SEL], clk[IMX6QDL_CLK_PLL2_PFD0_352M]); + + if (clk_on_imx6dl()) + +From a0d0665879629b6a24dd94f5206434cb9ab00b87 Mon Sep 17 00:00:00 2001 +From: Matus Kral <matuskral@me.com> +Date: Mon, 4 Apr 2016 03:16:05 +0200 +Subject: [PATCH 07/13] add mxc_v4l2.h to linux-libc-dev headers + +--- + include/uapi/linux/Kbuild | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/include/uapi/linux/Kbuild b/include/uapi/linux/Kbuild +index 18c9229..ba55082 100644 +--- a/include/uapi/linux/Kbuild ++++ b/include/uapi/linux/Kbuild +@@ -274,6 +274,7 @@ header-y += msg.h + header-y += mtio.h + header-y += mxcfb.h + header-y += mxc_dcic.h ++header-y += mxc_v4l2.h + header-y += ipu.h + header-y += nbd.h + header-y += ncp_fs.h + +From 8274eed9c6004cda725a67d12a0fd781326eb2dc Mon Sep 17 00:00:00 2001 +From: Matus Kral <matuskral@me.com> +Date: Mon, 4 Apr 2016 03:17:07 +0200 +Subject: [PATCH 08/13] ipu_device: do not overlap stripes + +--- + drivers/mxc/ipu3/ipu_device.c | 10 ++++++++-- + 1 file changed, 8 insertions(+), 2 deletions(-) + +diff --git a/drivers/mxc/ipu3/ipu_device.c b/drivers/mxc/ipu3/ipu_device.c +index e34e1ba..306639d 100644 +--- a/drivers/mxc/ipu3/ipu_device.c ++++ b/drivers/mxc/ipu3/ipu_device.c +@@ -485,6 +485,7 @@ cs_t colorspaceofpixel(int fmt) + } + EXPORT_SYMBOL_GPL(colorspaceofpixel); + ++inline + int need_csc(int ifmt, int ofmt) + { + cs_t ics, ocs; +@@ -501,26 +502,31 @@ int need_csc(int ifmt, int ofmt) + } + EXPORT_SYMBOL_GPL(need_csc); + ++inline + static int soc_max_in_width(u32 is_vdoa) + { + return is_vdoa ? 8192 : 4096; + } + ++inline + static int soc_max_vdi_in_width(void) + { + return IPU_MAX_VDI_IN_WIDTH; + } ++inline + static int soc_max_in_height(void) + { + return 4096; + } + ++inline + static int soc_max_out_width(void) + { + /* mx51/mx53/mx6q is 1024*/ + return 1024; + } + ++inline + static int soc_max_out_height(void) + { + /* mx51/mx53/mx6q is 1024*/ +@@ -859,7 +865,7 @@ static int update_split_setting(struct ipu_task_entry *t, bool vdi_split) + ret = ipu_calc_stripes_sizes(iw, + ow, + max_width, +- (((unsigned long long)1) << 32), /* 32bit for fractional*/ ++ 0,/*no overlap*/ /* 32bit for fractional*/ + 1, /* equal stripes */ + t->input.format, + t->output.format, +@@ -907,7 +913,7 @@ static int update_split_setting(struct ipu_task_entry *t, bool vdi_split) + ret = ipu_calc_stripes_sizes(ih, + oh, + soc_max_out_height(), +- (((unsigned long long)1) << 32), /* 32bit for fractional*/ ++ 0,/*no overlap*/ /* 32bit for fractional*/ + 0x1 | 0x2, /* equal stripes and vertical */ + t->input.format, + t->output.format, + +From ea5643bec4f6265a95528693c06d330092e05cc8 Mon Sep 17 00:00:00 2001 +From: Matus Kral <matuskral@me.com> +Date: Mon, 4 Apr 2016 03:43:49 +0200 +Subject: [PATCH 09/13] Revert "printk: do cond_resched() between lines while + outputting to consoles" + +This reverts commit a623f87a72de35096a9eae7cc7764d0c9533c2e9. + +Conflicts: + kernel/printk/printk.c +--- + include/linux/console.h | 1 - + kernel/panic.c | 3 ++- + kernel/printk/printk.c | 34 +--------------------------------- + 3 files changed, 3 insertions(+), 35 deletions(-) + +diff --git a/include/linux/console.h b/include/linux/console.h +index ea731af..bd19434 100644 +--- a/include/linux/console.h ++++ b/include/linux/console.h +@@ -150,7 +150,6 @@ extern int console_trylock(void); + extern void console_unlock(void); + extern void console_conditional_schedule(void); + extern void console_unblank(void); +-extern void console_flush_on_panic(void); + extern struct tty_driver *console_device(int *); + extern void console_stop(struct console *); + extern void console_start(struct console *); +diff --git a/kernel/panic.c b/kernel/panic.c +index 50d4ae2..d74f25d 100644 +--- a/kernel/panic.c ++++ b/kernel/panic.c +@@ -157,7 +157,8 @@ void panic(const char *fmt, ...) + * panic() is not being callled from OOPS. + */ + debug_locks_off(); +- console_flush_on_panic(); ++ console_trylock(); ++ console_unlock(); + + if (!panic_blink) + panic_blink = no_blink; +diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c +index f75e4b0..88995de 100644 +--- a/kernel/printk/printk.c ++++ b/kernel/printk/printk.c +@@ -2319,24 +2319,13 @@ void console_unlock(void) + static u64 seen_seq; + unsigned long flags; + bool wake_klogd = false; +- bool do_cond_resched, retry; ++ bool retry; + + if (console_suspended) { + up_console_sem(); + return; + } + +- /* +- * Console drivers are called under logbuf_lock, so +- * @console_may_schedule should be cleared before; however, we may +- * end up dumping a lot of lines, for example, if called from +- * console registration path, and should invoke cond_resched() +- * between lines if allowable. Not doing so can cause a very long +- * scheduling stall on a slow console leading to RCU stall and +- * softlockup warnings which exacerbate the issue with more +- * messages practically incapacitating the system. +- */ +- do_cond_resched = console_may_schedule; + console_may_schedule = 0; + + /* flush buffered message fragment immediately to console */ +@@ -2413,8 +2402,6 @@ void console_unlock(void) + start_critical_timings(); + local_irq_restore(flags); + #endif +- if (do_cond_resched) +- cond_resched(); + } + console_locked = 0; + +@@ -2482,25 +2469,6 @@ void console_unblank(void) + console_unlock(); + } + +-/** +- * console_flush_on_panic - flush console content on panic +- * +- * Immediately output all pending messages no matter what. +- */ +-void console_flush_on_panic(void) +-{ +- /* +- * If someone else is holding the console lock, trylock will fail +- * and may_schedule may be set. Ignore and proceed to unlock so +- * that messages are flushed out. As this can be called from any +- * context and we don't want to get preempted while flushing, +- * ensure may_schedule is cleared. +- */ +- console_trylock(); +- console_may_schedule = 0; +- console_unlock(); +-} +- + /* + * Return the console tty driver structure and its associated index + */ + +From cf227a4cf2222a7d4fcc93016656a4dce684e5ae Mon Sep 17 00:00:00 2001 +From: Matus Kral <matuskral@me.com> +Date: Tue, 5 Apr 2016 10:37:31 +0200 +Subject: [PATCH 10/13] default configs update for xbian_defconfig_imx6_mvebu + +--- + arch/arm/configs/xbian_defconfig_imx6 | 6550 --------------------------- + arch/arm/configs/xbian_defconfig_imx6_mvebu | 199 +- + 2 files changed, 65 insertions(+), 6684 deletions(-) + delete mode 100644 arch/arm/configs/xbian_defconfig_imx6 + +diff --git a/arch/arm/configs/xbian_defconfig_imx6 b/arch/arm/configs/xbian_defconfig_imx6 +deleted file mode 100644 +index 20d0117..0000000 +--- a/arch/arm/configs/xbian_defconfig_imx6 ++++ /dev/null +@@ -1,6550 +0,0 @@ +-# +-# Automatically generated file; DO NOT EDIT. +-# Linux/arm 4.4.1 Kernel Configuration +-# +-CONFIG_ARM=y +-CONFIG_ARM_HAS_SG_CHAIN=y +-CONFIG_MIGHT_HAVE_PCI=y +-CONFIG_SYS_SUPPORTS_APM_EMULATION=y +-CONFIG_HAVE_PROC_CPU=y +-CONFIG_STACKTRACE_SUPPORT=y +-CONFIG_LOCKDEP_SUPPORT=y +-CONFIG_TRACE_IRQFLAGS_SUPPORT=y +-CONFIG_RWSEM_XCHGADD_ALGORITHM=y +-CONFIG_FIX_EARLYCON_MEM=y +-CONFIG_GENERIC_HWEIGHT=y +-CONFIG_GENERIC_CALIBRATE_DELAY=y +-CONFIG_ZONE_DMA=y +-CONFIG_NEED_DMA_MAP_STATE=y +-CONFIG_ARCH_SUPPORTS_UPROBES=y +-CONFIG_VECTORS_BASE=0xffff0000 +-CONFIG_ARM_PATCH_PHYS_VIRT=y +-CONFIG_GENERIC_BUG=y +-CONFIG_PGTABLE_LEVELS=2 +-CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" +-CONFIG_IRQ_WORK=y +-CONFIG_BUILDTIME_EXTABLE_SORT=y +- +-# +-# General setup +-# +-CONFIG_INIT_ENV_ARG_LIMIT=32 +-CONFIG_CROSS_COMPILE="" +-# CONFIG_COMPILE_TEST is not set +-CONFIG_LOCALVERSION="" +-# CONFIG_LOCALVERSION_AUTO is not set +-CONFIG_HAVE_KERNEL_GZIP=y +-CONFIG_HAVE_KERNEL_LZMA=y +-CONFIG_HAVE_KERNEL_XZ=y +-CONFIG_HAVE_KERNEL_LZO=y +-CONFIG_HAVE_KERNEL_LZ4=y +-CONFIG_KERNEL_GZIP=y +-# CONFIG_KERNEL_LZMA is not set +-# CONFIG_KERNEL_XZ is not set +-# CONFIG_KERNEL_LZO is not set +-# CONFIG_KERNEL_LZ4 is not set +-CONFIG_DEFAULT_HOSTNAME="xbian" +-CONFIG_SWAP=y +-CONFIG_SYSVIPC=y +-CONFIG_SYSVIPC_SYSCTL=y +-CONFIG_POSIX_MQUEUE=y +-CONFIG_POSIX_MQUEUE_SYSCTL=y +-CONFIG_CROSS_MEMORY_ATTACH=y +-CONFIG_FHANDLE=y +-# CONFIG_USELIB is not set +-# CONFIG_AUDIT is not set +-CONFIG_HAVE_ARCH_AUDITSYSCALL=y +- +-# +-# IRQ subsystem +-# +-CONFIG_GENERIC_IRQ_PROBE=y +-CONFIG_GENERIC_IRQ_SHOW=y +-CONFIG_GENERIC_IRQ_SHOW_LEVEL=y +-CONFIG_HARDIRQS_SW_RESEND=y +-CONFIG_GENERIC_IRQ_CHIP=y +-CONFIG_IRQ_DOMAIN=y +-CONFIG_IRQ_DOMAIN_HIERARCHY=y +-CONFIG_HANDLE_DOMAIN_IRQ=y +-# CONFIG_IRQ_DOMAIN_DEBUG is not set +-CONFIG_IRQ_FORCED_THREADING=y +-CONFIG_SPARSE_IRQ=y +-CONFIG_GENERIC_TIME_VSYSCALL=y +-CONFIG_GENERIC_CLOCKEVENTS=y +-CONFIG_ARCH_HAS_TICK_BROADCAST=y +-CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y +- +-# +-# Timers subsystem +-# +-CONFIG_TICK_ONESHOT=y +-CONFIG_NO_HZ_COMMON=y +-# CONFIG_HZ_PERIODIC is not set +-CONFIG_NO_HZ_IDLE=y +-# CONFIG_NO_HZ_FULL is not set +-# CONFIG_NO_HZ is not set +-CONFIG_HIGH_RES_TIMERS=y +- +-# +-# CPU/Task time and stats accounting +-# +-# CONFIG_TICK_CPU_ACCOUNTING is not set +-# CONFIG_VIRT_CPU_ACCOUNTING_GEN is not set +-CONFIG_IRQ_TIME_ACCOUNTING=y +-CONFIG_BSD_PROCESS_ACCT=y +-CONFIG_BSD_PROCESS_ACCT_V3=y +-# CONFIG_TASKSTATS is not set +- +-# +-# RCU Subsystem +-# +-CONFIG_PREEMPT_RCU=y +-# CONFIG_RCU_EXPERT is not set +-CONFIG_SRCU=y +-# CONFIG_TASKS_RCU is not set +-CONFIG_RCU_STALL_COMMON=y +-# CONFIG_TREE_RCU_TRACE is not set +-# CONFIG_RCU_EXPEDITE_BOOT is not set +-CONFIG_BUILD_BIN2C=y +-CONFIG_IKCONFIG=y +-CONFIG_IKCONFIG_PROC=y +-CONFIG_LOG_BUF_SHIFT=16 +-CONFIG_LOG_CPU_MAX_BUF_SHIFT=13 +-CONFIG_GENERIC_SCHED_CLOCK=y +-CONFIG_CGROUPS=y +-# CONFIG_CGROUP_DEBUG is not set +-# CONFIG_CGROUP_FREEZER is not set +-# CONFIG_CGROUP_PIDS is not set +-# CONFIG_CGROUP_DEVICE is not set +-# CONFIG_CPUSETS is not set +-CONFIG_CGROUP_CPUACCT=y +-# CONFIG_MEMCG is not set +-# CONFIG_CGROUP_PERF is not set +-CONFIG_CGROUP_SCHED=y +-CONFIG_FAIR_GROUP_SCHED=y +-CONFIG_CFS_BANDWIDTH=y +-CONFIG_RT_GROUP_SCHED=y +-CONFIG_BLK_CGROUP=y +-# CONFIG_DEBUG_BLK_CGROUP is not set +-# CONFIG_CHECKPOINT_RESTORE is not set +-CONFIG_NAMESPACES=y +-CONFIG_UTS_NS=y +-CONFIG_IPC_NS=y +-CONFIG_USER_NS=y +-CONFIG_PID_NS=y +-CONFIG_NET_NS=y +-# CONFIG_SCHED_AUTOGROUP is not set +-# CONFIG_SYSFS_DEPRECATED is not set +-CONFIG_RELAY=y +-CONFIG_BLK_DEV_INITRD=y +-CONFIG_INITRAMFS_SOURCE="" +-CONFIG_RD_GZIP=y +-# CONFIG_RD_BZIP2 is not set +-# CONFIG_RD_LZMA is not set +-# CONFIG_RD_XZ is not set +-CONFIG_RD_LZO=y +-# CONFIG_RD_LZ4 is not set +-# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set +-CONFIG_SYSCTL=y +-CONFIG_ANON_INODES=y +-CONFIG_HAVE_UID16=y +-CONFIG_BPF=y +-CONFIG_EXPERT=y +-# CONFIG_UID16 is not set +-CONFIG_MULTIUSER=y +-# CONFIG_SGETMASK_SYSCALL is not set +-CONFIG_SYSFS_SYSCALL=y +-CONFIG_SYSCTL_SYSCALL=y +-CONFIG_KALLSYMS=y +-CONFIG_KALLSYMS_ALL=y +-CONFIG_PRINTK=y +-CONFIG_BUG=y +-CONFIG_BASE_FULL=y +-CONFIG_FUTEX=y +-CONFIG_EPOLL=y +-CONFIG_SIGNALFD=y +-CONFIG_TIMERFD=y +-CONFIG_EVENTFD=y +-# CONFIG_BPF_SYSCALL is not set +-CONFIG_SHMEM=y +-CONFIG_AIO=y +-# CONFIG_ADVISE_SYSCALLS is not set +-CONFIG_USERFAULTFD=y +-CONFIG_PCI_QUIRKS=y +-CONFIG_MEMBARRIER=y +-CONFIG_EMBEDDED=y +-CONFIG_HAVE_PERF_EVENTS=y +-CONFIG_PERF_USE_VMALLOC=y +- +-# +-# Kernel Performance Events And Counters +-# +-CONFIG_PERF_EVENTS=y +-# CONFIG_DEBUG_PERF_USE_VMALLOC is not set +-# CONFIG_VM_EVENT_COUNTERS is not set +-# CONFIG_SLUB_DEBUG is not set +-# CONFIG_COMPAT_BRK is not set +-# CONFIG_SLAB is not set +-CONFIG_SLUB=y +-# CONFIG_SLOB is not set +-# CONFIG_SLUB_CPU_PARTIAL is not set +-# CONFIG_SYSTEM_DATA_VERIFICATION is not set +-# CONFIG_PROFILING is not set +-CONFIG_TRACEPOINTS=y +-CONFIG_KEXEC_CORE=y +-CONFIG_HAVE_OPROFILE=y +-# CONFIG_KPROBES is not set +-# CONFIG_JUMP_LABEL is not set +-# CONFIG_UPROBES is not set +-# CONFIG_HAVE_64BIT_ALIGNED_ACCESS is not set +-CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y +-CONFIG_ARCH_USE_BUILTIN_BSWAP=y +-CONFIG_HAVE_KPROBES=y +-CONFIG_HAVE_KRETPROBES=y +-CONFIG_HAVE_OPTPROBES=y +-CONFIG_HAVE_ARCH_TRACEHOOK=y +-CONFIG_HAVE_DMA_ATTRS=y +-CONFIG_HAVE_DMA_CONTIGUOUS=y +-CONFIG_GENERIC_SMP_IDLE_THREAD=y +-CONFIG_GENERIC_IDLE_POLL_SETUP=y +-CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y +-CONFIG_HAVE_CLK=y +-CONFIG_HAVE_DMA_API_DEBUG=y +-CONFIG_HAVE_HW_BREAKPOINT=y +-CONFIG_HAVE_PERF_REGS=y +-CONFIG_HAVE_PERF_USER_STACK_DUMP=y +-CONFIG_HAVE_ARCH_JUMP_LABEL=y +-CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y +-CONFIG_HAVE_ARCH_SECCOMP_FILTER=y +-CONFIG_HAVE_CC_STACKPROTECTOR=y +-# CONFIG_CC_STACKPROTECTOR is not set +-CONFIG_CC_STACKPROTECTOR_NONE=y +-# CONFIG_CC_STACKPROTECTOR_REGULAR is not set +-# CONFIG_CC_STACKPROTECTOR_STRONG is not set +-CONFIG_HAVE_CONTEXT_TRACKING=y +-CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y +-CONFIG_HAVE_IRQ_TIME_ACCOUNTING=y +-CONFIG_HAVE_MOD_ARCH_SPECIFIC=y +-CONFIG_MODULES_USE_ELF_REL=y +-CONFIG_ARCH_HAS_ELF_RANDOMIZE=y +-CONFIG_CLONE_BACKWARDS=y +-CONFIG_OLD_SIGSUSPEND3=y +-CONFIG_OLD_SIGACTION=y +- +-# +-# GCOV-based kernel profiling +-# +-# CONFIG_GCOV_KERNEL is not set +-CONFIG_ARCH_HAS_GCOV_PROFILE_ALL=y +-CONFIG_HAVE_GENERIC_DMA_COHERENT=y +-CONFIG_RT_MUTEXES=y +-CONFIG_BASE_SMALL=0 +-CONFIG_MODULES=y +-# CONFIG_MODULE_FORCE_LOAD is not set +-CONFIG_MODULE_UNLOAD=y +-# CONFIG_MODULE_FORCE_UNLOAD is not set +-CONFIG_MODVERSIONS=y +-CONFIG_MODULE_SRCVERSION_ALL=y +-# CONFIG_MODULE_SIG is not set +-# CONFIG_MODULE_COMPRESS is not set +-CONFIG_MODULES_TREE_LOOKUP=y +-CONFIG_BLOCK=y +-CONFIG_LBDAF=y +-CONFIG_BLK_DEV_BSG=y +-CONFIG_BLK_DEV_BSGLIB=y +-CONFIG_BLK_DEV_INTEGRITY=y +-# CONFIG_BLK_DEV_THROTTLING is not set +-# CONFIG_BLK_CMDLINE_PARSER is not set +- +-# +-# Partition Types +-# +-CONFIG_PARTITION_ADVANCED=y +-# CONFIG_ACORN_PARTITION is not set +-# CONFIG_AIX_PARTITION is not set +-# CONFIG_OSF_PARTITION is not set +-# CONFIG_AMIGA_PARTITION is not set +-# CONFIG_ATARI_PARTITION is not set +-CONFIG_MAC_PARTITION=y +-CONFIG_MSDOS_PARTITION=y +-CONFIG_BSD_DISKLABEL=y +-CONFIG_MINIX_SUBPARTITION=y +-CONFIG_SOLARIS_X86_PARTITION=y +-CONFIG_UNIXWARE_DISKLABEL=y +-CONFIG_LDM_PARTITION=y +-# CONFIG_LDM_DEBUG is not set +-# CONFIG_SGI_PARTITION is not set +-# CONFIG_ULTRIX_PARTITION is not set +-CONFIG_SUN_PARTITION=y +-CONFIG_KARMA_PARTITION=y +-CONFIG_EFI_PARTITION=y +-# CONFIG_SYSV68_PARTITION is not set +-# CONFIG_CMDLINE_PARTITION is not set +- +-# +-# IO Schedulers +-# +-CONFIG_IOSCHED_NOOP=y +-CONFIG_IOSCHED_DEADLINE=y +-CONFIG_IOSCHED_CFQ=y +-# CONFIG_CFQ_GROUP_IOSCHED is not set +-CONFIG_IOSCHED_BFQ=y +-# CONFIG_CGROUP_BFQIO is not set +-# CONFIG_DEFAULT_DEADLINE is not set +-# CONFIG_DEFAULT_CFQ is not set +-CONFIG_DEFAULT_BFQ=y +-# CONFIG_DEFAULT_NOOP is not set +-CONFIG_DEFAULT_IOSCHED="bfq" +-CONFIG_PADATA=y +-CONFIG_ASN1=m +-CONFIG_UNINLINE_SPIN_UNLOCK=y +-CONFIG_ARCH_SUPPORTS_ATOMIC_RMW=y +-CONFIG_MUTEX_SPIN_ON_OWNER=y +-CONFIG_RWSEM_SPIN_ON_OWNER=y +-CONFIG_LOCK_SPIN_ON_OWNER=y +-CONFIG_FREEZER=y +- +-# +-# System Type +-# +-CONFIG_MMU=y +-CONFIG_ARCH_MULTIPLATFORM=y +-# CONFIG_ARCH_REALVIEW is not set +-# CONFIG_ARCH_VERSATILE is not set +-# CONFIG_ARCH_CLPS711X is not set +-# CONFIG_ARCH_GEMINI is not set +-# CONFIG_ARCH_EBSA110 is not set +-# CONFIG_ARCH_EP93XX is not set +-# CONFIG_ARCH_FOOTBRIDGE is not set +-# CONFIG_ARCH_NETX is not set +-# CONFIG_ARCH_IOP13XX is not set +-# CONFIG_ARCH_IOP32X is not set +-# CONFIG_ARCH_IOP33X is not set +-# CONFIG_ARCH_IXP4XX is not set +-# CONFIG_ARCH_DOVE is not set +-# CONFIG_ARCH_MV78XX0 is not set +-# CONFIG_ARCH_ORION5X is not set +-# CONFIG_ARCH_MMP is not set +-# CONFIG_ARCH_KS8695 is not set +-# CONFIG_ARCH_W90X900 is not set +-# CONFIG_ARCH_LPC32XX is not set +-# CONFIG_ARCH_PXA is not set +-# CONFIG_ARCH_RPC is not set +-# CONFIG_ARCH_SA1100 is not set +-# CONFIG_ARCH_S3C24XX is not set +-# CONFIG_ARCH_S3C64XX is not set +-# CONFIG_ARCH_DAVINCI is not set +-# CONFIG_ARCH_OMAP1 is not set +- +-# +-# Multiple platform selection +-# +- +-# +-# CPU Core family selection +-# +-# CONFIG_ARCH_MULTI_V6 is not set +-CONFIG_ARCH_MULTI_V7=y +-CONFIG_ARCH_MULTI_V6_V7=y +-# CONFIG_ARCH_MULTI_CPU_AUTO is not set +-# CONFIG_ARCH_VIRT is not set +-# CONFIG_ARCH_MVEBU is not set +-# CONFIG_ARCH_ALPINE is not set +-# CONFIG_ARCH_AT91 is not set +-# CONFIG_ARCH_BCM is not set +-# CONFIG_ARCH_BERLIN is not set +-# CONFIG_ARCH_DIGICOLOR is not set +-# CONFIG_ARCH_HIGHBANK is not set +-# CONFIG_ARCH_HISI is not set +-# CONFIG_ARCH_KEYSTONE is not set +-# CONFIG_ARCH_MESON is not set +-CONFIG_ARCH_MXC=y +-CONFIG_HAVE_IMX_ANATOP=y +-CONFIG_HAVE_IMX_GPC=y +-CONFIG_HAVE_IMX_MMDC=y +-CONFIG_HAVE_IMX_SRC=y +- +-# +-# Device tree only +-# +- +-# +-# Cortex-A platforms +-# +-# CONFIG_SOC_IMX50 is not set +-# CONFIG_SOC_IMX51 is not set +-# CONFIG_SOC_IMX53 is not set +-CONFIG_SOC_IMX6=y +-CONFIG_SOC_IMX6Q=y +-# CONFIG_SOC_IMX6SL is not set +-# CONFIG_SOC_IMX6SX is not set +-# CONFIG_SOC_IMX6UL is not set +-# CONFIG_SOC_IMX7D is not set +-# CONFIG_SOC_LS1021A is not set +- +-# +-# Cortex-A/Cortex-M asymmetric multiprocessing platforms +-# +-# CONFIG_SOC_VF610 is not set +-# CONFIG_ARCH_MEDIATEK is not set +- +-# +-# TI OMAP/AM/DM/DRA Family +-# +-# CONFIG_ARCH_OMAP3 is not set +-# CONFIG_ARCH_OMAP4 is not set +-# CONFIG_SOC_OMAP5 is not set +-# CONFIG_SOC_AM33XX is not set +-# CONFIG_SOC_AM43XX is not set +-# CONFIG_SOC_DRA7XX is not set +-# CONFIG_ARCH_QCOM is not set +-# CONFIG_ARCH_ROCKCHIP is not set +-# CONFIG_ARCH_SOCFPGA is not set +-# CONFIG_PLAT_SPEAR is not set +-# CONFIG_ARCH_STI is not set +-# CONFIG_ARCH_S5PV210 is not set +-# CONFIG_ARCH_EXYNOS is not set +-# CONFIG_ARCH_SHMOBILE_MULTI is not set +-# CONFIG_ARCH_SUNXI is not set +-# CONFIG_ARCH_SIRF is not set +-# CONFIG_ARCH_TEGRA is not set +-# CONFIG_ARCH_UNIPHIER is not set +-# CONFIG_ARCH_U8500 is not set +-# CONFIG_ARCH_VEXPRESS is not set +-# CONFIG_ARCH_WM8850 is not set +-# CONFIG_ARCH_ZX is not set +-# CONFIG_ARCH_ZYNQ is not set +- +-# +-# Processor Type +-# +-CONFIG_CPU_V7=y +-CONFIG_CPU_32v6K=y +-CONFIG_CPU_32v7=y +-CONFIG_CPU_ABRT_EV7=y +-CONFIG_CPU_PABRT_V7=y +-CONFIG_CPU_CACHE_V7=y +-CONFIG_CPU_CACHE_VIPT=y +-CONFIG_CPU_COPY_V6=y +-CONFIG_CPU_TLB_V7=y +-CONFIG_CPU_HAS_ASID=y +-CONFIG_CPU_CP15=y +-CONFIG_CPU_CP15_MMU=y +- +-# +-# Processor Features +-# +-# CONFIG_ARM_LPAE is not set +-# CONFIG_ARCH_PHYS_ADDR_T_64BIT is not set +-CONFIG_ARM_THUMB=y +-# CONFIG_ARM_THUMBEE is not set +-CONFIG_ARM_VIRT_EXT=y +-CONFIG_SWP_EMULATE=y +-# CONFIG_CPU_ICACHE_DISABLE is not set +-# CONFIG_CPU_BPREDICT_DISABLE is not set +-CONFIG_KUSER_HELPERS=y +-CONFIG_VDSO=y +-CONFIG_OUTER_CACHE=y +-CONFIG_OUTER_CACHE_SYNC=y +-CONFIG_MIGHT_HAVE_CACHE_L2X0=y +-CONFIG_CACHE_L2X0=y +-# CONFIG_PL310_ERRATA_588369 is not set +-# CONFIG_PL310_ERRATA_727915 is not set +-# CONFIG_PL310_ERRATA_753970 is not set +-CONFIG_PL310_ERRATA_769419=y +-CONFIG_ARM_L1_CACHE_SHIFT_6=y +-CONFIG_ARM_L1_CACHE_SHIFT=6 +-CONFIG_ARM_DMA_MEM_BUFFERABLE=y +-CONFIG_ARM_HEAVY_MB=y +-# CONFIG_ARM_KERNMEM_PERMS is not set +-CONFIG_MULTI_IRQ_HANDLER=y +-# CONFIG_ARM_ERRATA_430973 is not set +-# CONFIG_ARM_ERRATA_643719 is not set +-# CONFIG_ARM_ERRATA_720789 is not set +-CONFIG_ARM_ERRATA_754322=y +-# CONFIG_ARM_ERRATA_754327 is not set +-CONFIG_ARM_ERRATA_764369=y +-CONFIG_ARM_ERRATA_775420=y +-# CONFIG_ARM_ERRATA_798181 is not set +-# CONFIG_ARM_ERRATA_773022 is not set +- +-# +-# Bus support +-# +-CONFIG_PCI=y +-CONFIG_PCI_DOMAINS=y +-CONFIG_PCI_DOMAINS_GENERIC=y +-CONFIG_PCI_SYSCALL=y +-# CONFIG_PCI_MSI is not set +-# CONFIG_PCI_DEBUG is not set +-# CONFIG_PCI_REALLOC_ENABLE_AUTO is not set +-# CONFIG_PCI_STUB is not set +-# CONFIG_PCI_IOV is not set +-# CONFIG_PCI_PRI is not set +-# CONFIG_PCI_PASID is not set +- +-# +-# PCI host controller drivers +-# +-CONFIG_PCIE_DW=y +-CONFIG_PCI_IMX6=y +-# CONFIG_PCI_HOST_GENERIC is not set +-# CONFIG_PCI_LAYERSCAPE is not set +-# CONFIG_PCIE_IPROC is not set +-# CONFIG_PCIE_ALTERA is not set +-CONFIG_PCIEPORTBUS=y +-CONFIG_PCIEAER=y +-# CONFIG_PCIE_ECRC is not set +-# CONFIG_PCIEAER_INJECT is not set +-CONFIG_PCIEASPM=y +-# CONFIG_PCIEASPM_DEBUG is not set +-CONFIG_PCIEASPM_DEFAULT=y +-# CONFIG_PCIEASPM_POWERSAVE is not set +-# CONFIG_PCIEASPM_PERFORMANCE is not set +-CONFIG_PCIE_PME=y +-# CONFIG_PCCARD is not set +- +-# +-# Kernel Features +-# +-CONFIG_HAVE_SMP=y +-CONFIG_SMP=y +-CONFIG_SMP_ON_UP=y +-CONFIG_ARM_CPU_TOPOLOGY=y +-# CONFIG_SCHED_MC is not set +-# CONFIG_SCHED_SMT is not set +-CONFIG_HAVE_ARM_SCU=y +-# CONFIG_HAVE_ARM_ARCH_TIMER is not set +-CONFIG_HAVE_ARM_TWD=y +-# CONFIG_MCPM is not set +-# CONFIG_BIG_LITTLE is not set +-# CONFIG_VMSPLIT_3G is not set +-# CONFIG_VMSPLIT_3G_OPT is not set +-CONFIG_VMSPLIT_2G=y +-# CONFIG_VMSPLIT_1G is not set +-CONFIG_PAGE_OFFSET=0x80000000 +-CONFIG_NR_CPUS=4 +-CONFIG_HOTPLUG_CPU=y +-# CONFIG_ARM_PSCI is not set +-CONFIG_ARCH_NR_GPIO=0 +-CONFIG_PREEMPT=y +-CONFIG_HAVE_PREEMPT_LAZY=y +-# CONFIG_PREEMPT_NONE is not set +-# CONFIG_PREEMPT_VOLUNTARY is not set +-CONFIG_PREEMPT__LL=y +-# CONFIG_PREEMPT_RTB is not set +-# CONFIG_PREEMPT_RT_FULL is not set +-CONFIG_PREEMPT_COUNT=y +-CONFIG_HZ_FIXED=0 +-# CONFIG_HZ_100 is not set +-# CONFIG_HZ_200 is not set +-# CONFIG_HZ_250 is not set +-CONFIG_HZ_300=y +-# CONFIG_HZ_500 is not set +-# CONFIG_HZ_1000 is not set +-CONFIG_HZ=300 +-CONFIG_SCHED_HRTICK=y +-# CONFIG_THUMB2_KERNEL is not set +-CONFIG_AEABI=y +-# CONFIG_OABI_COMPAT is not set +-# CONFIG_ARCH_SPARSEMEM_DEFAULT is not set +-# CONFIG_ARCH_SELECT_MEMORY_MODEL is not set +-CONFIG_HAVE_ARCH_PFN_VALID=y +-CONFIG_HIGHMEM=y +-# CONFIG_HIGHPTE is not set +-# CONFIG_CPU_SW_DOMAIN_PAN is not set +-CONFIG_HW_PERF_EVENTS=y +-CONFIG_ARCH_WANT_GENERAL_HUGETLB=y +-# CONFIG_ARM_MODULE_PLTS is not set +-CONFIG_FLATMEM=y +-CONFIG_FLAT_NODE_MEM_MAP=y +-CONFIG_HAVE_MEMBLOCK=y +-CONFIG_NO_BOOTMEM=y +-CONFIG_MEMORY_ISOLATION=y +-# CONFIG_HAVE_BOOTMEM_INFO_NODE is not set +-CONFIG_SPLIT_PTLOCK_CPUS=4 +-CONFIG_COMPACTION=y +-CONFIG_MIGRATION=y +-# CONFIG_PHYS_ADDR_T_64BIT is not set +-CONFIG_ZONE_DMA_FLAG=1 +-CONFIG_BOUNCE=y +-# CONFIG_KSM is not set +-CONFIG_DEFAULT_MMAP_MIN_ADDR=16384 +-CONFIG_CLEANCACHE=y +-CONFIG_FRONTSWAP=y +-CONFIG_CMA=y +-# CONFIG_CMA_DEBUG is not set +-# CONFIG_CMA_DEBUGFS is not set +-CONFIG_CMA_AREAS=7 +-# CONFIG_ZSWAP is not set +-# CONFIG_ZPOOL is not set +-# CONFIG_ZBUD is not set +-# CONFIG_ZSMALLOC is not set +-# CONFIG_IDLE_PAGE_TRACKING is not set +-CONFIG_FRAME_VECTOR=y +-CONFIG_FORCE_MAX_ZONEORDER=14 +-CONFIG_ALIGNMENT_TRAP=y +-# CONFIG_UACCESS_WITH_MEMCPY is not set +-# CONFIG_SECCOMP is not set +-CONFIG_SWIOTLB=y +-CONFIG_IOMMU_HELPER=y +-# CONFIG_XEN is not set +- +-# +-# Boot options +-# +-CONFIG_USE_OF=y +-CONFIG_ATAGS=y +-# CONFIG_DEPRECATED_PARAM_STRUCT is not set +-CONFIG_ZBOOT_ROM_TEXT=0 +-CONFIG_ZBOOT_ROM_BSS=0 +-# CONFIG_ARM_APPENDED_DTB is not set +-CONFIG_CMDLINE="console=ttymxc0,115200 rw root=/dev/mmcblk0p2 rootwait" +-CONFIG_CMDLINE_FROM_BOOTLOADER=y +-# CONFIG_CMDLINE_EXTEND is not set +-# CONFIG_CMDLINE_FORCE is not set +-CONFIG_KEXEC=y +-CONFIG_ATAGS_PROC=y +-# CONFIG_CRASH_DUMP is not set +-CONFIG_AUTO_ZRELADDR=y +- +-# +-# CPU Power Management +-# +- +-# +-# CPU Frequency scaling +-# +-CONFIG_CPU_FREQ=y +-CONFIG_CPU_FREQ_GOV_COMMON=y +-CONFIG_CPU_FREQ_STAT=y +-CONFIG_CPU_FREQ_STAT_DETAILS=y +-CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y +-# CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE is not set +-# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set +-# CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set +-# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set +-CONFIG_CPU_FREQ_GOV_PERFORMANCE=y +-CONFIG_CPU_FREQ_GOV_POWERSAVE=y +-CONFIG_CPU_FREQ_GOV_USERSPACE=y +-CONFIG_CPU_FREQ_GOV_ONDEMAND=y +-CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y +- +-# +-# CPU frequency scaling drivers +-# +-# CONFIG_CPUFREQ_DT is not set +-# CONFIG_ARM_BIG_LITTLE_CPUFREQ is not set +-CONFIG_ARM_IMX6Q_CPUFREQ=y +-# CONFIG_ARM_KIRKWOOD_CPUFREQ is not set +-# CONFIG_QORIQ_CPUFREQ is not set +- +-# +-# CPU Idle +-# +-CONFIG_CPU_IDLE=y +-# CONFIG_CPU_IDLE_GOV_LADDER is not set +-CONFIG_CPU_IDLE_GOV_MENU=y +-CONFIG_DT_IDLE_STATES=y +- +-# +-# ARM CPU Idle Drivers +-# +-CONFIG_ARM_CPUIDLE=y +-# CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED is not set +- +-# +-# Floating point emulation +-# +- +-# +-# At least one emulation must be selected +-# +-CONFIG_VFP=y +-CONFIG_VFPv3=y +-CONFIG_NEON=y +-CONFIG_KERNEL_MODE_NEON=y +- +-# +-# Userspace binary formats +-# +-CONFIG_BINFMT_ELF=y +-CONFIG_BINFMT_SCRIPT=y +-# CONFIG_HAVE_AOUT is not set +-CONFIG_BINFMT_MISC=m +-# CONFIG_COREDUMP is not set +- +-# +-# Power management options +-# +-CONFIG_SUSPEND=y +-CONFIG_SUSPEND_FREEZER=y +-# CONFIG_SUSPEND_SKIP_SYNC is not set +-# CONFIG_HIBERNATION is not set +-CONFIG_PM_SLEEP=y +-CONFIG_PM_SLEEP_SMP=y +-# CONFIG_PM_AUTOSLEEP is not set +-# CONFIG_PM_WAKELOCKS is not set +-CONFIG_PM=y +-# CONFIG_PM_DEBUG is not set +-# CONFIG_APM_EMULATION is not set +-CONFIG_PM_OPP=y +-CONFIG_PM_CLK=y +-CONFIG_PM_GENERIC_DOMAINS=y +-# CONFIG_WQ_POWER_EFFICIENT_DEFAULT is not set +-CONFIG_PM_GENERIC_DOMAINS_SLEEP=y +-CONFIG_PM_GENERIC_DOMAINS_OF=y +-CONFIG_CPU_PM=y +-CONFIG_ARCH_SUSPEND_POSSIBLE=y +-CONFIG_ARM_CPU_SUSPEND=y +-CONFIG_ARCH_HIBERNATION_POSSIBLE=y +-CONFIG_NET=y +-CONFIG_NET_INGRESS=y +- +-# +-# Networking options +-# +-CONFIG_PACKET=y +-CONFIG_PACKET_DIAG=y +-CONFIG_UNIX=y +-CONFIG_UNIX_DIAG=y +-CONFIG_XFRM=y +-CONFIG_XFRM_ALGO=y +-CONFIG_XFRM_USER=y +-CONFIG_XFRM_SUB_POLICY=y +-CONFIG_XFRM_MIGRATE=y +-CONFIG_XFRM_STATISTICS=y +-CONFIG_XFRM_IPCOMP=m +-CONFIG_NET_KEY=y +-CONFIG_NET_KEY_MIGRATE=y +-CONFIG_INET=y +-CONFIG_IP_MULTICAST=y +-CONFIG_IP_ADVANCED_ROUTER=y +-# CONFIG_IP_FIB_TRIE_STATS is not set +-CONFIG_IP_MULTIPLE_TABLES=y +-CONFIG_IP_ROUTE_MULTIPATH=y +-CONFIG_IP_ROUTE_VERBOSE=y +-CONFIG_IP_ROUTE_CLASSID=y +-CONFIG_IP_PNP=y +-CONFIG_IP_PNP_DHCP=y +-CONFIG_IP_PNP_BOOTP=y +-# CONFIG_IP_PNP_RARP is not set +-CONFIG_NET_IPIP=m +-CONFIG_NET_IPGRE_DEMUX=m +-CONFIG_NET_IP_TUNNEL=m +-CONFIG_NET_IPGRE=m +-CONFIG_NET_IPGRE_BROADCAST=y +-CONFIG_IP_MROUTE=y +-CONFIG_IP_MROUTE_MULTIPLE_TABLES=y +-CONFIG_IP_PIMSM_V1=y +-CONFIG_IP_PIMSM_V2=y +-CONFIG_SYN_COOKIES=y +-CONFIG_NET_IPVTI=m +-CONFIG_NET_UDP_TUNNEL=m +-# CONFIG_NET_FOU is not set +-# CONFIG_NET_FOU_IP_TUNNELS is not set +-CONFIG_INET_AH=m +-CONFIG_INET_ESP=m +-CONFIG_INET_IPCOMP=m +-CONFIG_INET_XFRM_TUNNEL=m +-CONFIG_INET_TUNNEL=m +-CONFIG_INET_XFRM_MODE_TRANSPORT=m +-CONFIG_INET_XFRM_MODE_TUNNEL=m +-CONFIG_INET_XFRM_MODE_BEET=m +-CONFIG_INET_LRO=m +-CONFIG_INET_DIAG=y +-CONFIG_INET_TCP_DIAG=y +-CONFIG_INET_UDP_DIAG=m +-CONFIG_TCP_CONG_ADVANCED=y +-CONFIG_TCP_CONG_BIC=m +-CONFIG_TCP_CONG_CUBIC=m +-CONFIG_TCP_CONG_WESTWOOD=m +-CONFIG_TCP_CONG_HTCP=m +-CONFIG_TCP_CONG_HSTCP=m +-CONFIG_TCP_CONG_HYBLA=m +-CONFIG_TCP_CONG_VEGAS=y +-CONFIG_TCP_CONG_SCALABLE=m +-CONFIG_TCP_CONG_LP=m +-CONFIG_TCP_CONG_VENO=m +-CONFIG_TCP_CONG_YEAH=y +-CONFIG_TCP_CONG_ILLINOIS=m +-CONFIG_TCP_CONG_DCTCP=m +-# CONFIG_TCP_CONG_CDG is not set +-CONFIG_DEFAULT_VEGAS=y +-# CONFIG_DEFAULT_RENO is not set +-CONFIG_DEFAULT_TCP_CONG="vegas" +-CONFIG_TCP_MD5SIG=y +-CONFIG_IPV6=m +-CONFIG_IPV6_ROUTER_PREF=y +-CONFIG_IPV6_ROUTE_INFO=y +-CONFIG_IPV6_OPTIMISTIC_DAD=y +-CONFIG_INET6_AH=m +-CONFIG_INET6_ESP=m +-CONFIG_INET6_IPCOMP=m +-CONFIG_IPV6_MIP6=m +-CONFIG_IPV6_ILA=m +-CONFIG_INET6_XFRM_TUNNEL=m +-CONFIG_INET6_TUNNEL=m +-CONFIG_INET6_XFRM_MODE_TRANSPORT=m +-CONFIG_INET6_XFRM_MODE_TUNNEL=m +-CONFIG_INET6_XFRM_MODE_BEET=m +-CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION=m +-CONFIG_IPV6_VTI=m +-CONFIG_IPV6_SIT=m +-CONFIG_IPV6_SIT_6RD=y +-CONFIG_IPV6_NDISC_NODETYPE=y +-CONFIG_IPV6_TUNNEL=m +-CONFIG_IPV6_GRE=m +-CONFIG_IPV6_MULTIPLE_TABLES=y +-CONFIG_IPV6_SUBTREES=y +-CONFIG_IPV6_MROUTE=y +-CONFIG_IPV6_MROUTE_MULTIPLE_TABLES=y +-CONFIG_IPV6_PIMSM_V2=y +-CONFIG_NETWORK_SECMARK=y +-CONFIG_NET_PTP_CLASSIFY=y +-# CONFIG_NETWORK_PHY_TIMESTAMPING is not set +-CONFIG_NETFILTER=y +-# CONFIG_NETFILTER_DEBUG is not set +-CONFIG_NETFILTER_ADVANCED=y +-CONFIG_BRIDGE_NETFILTER=m +- +-# +-# Core Netfilter Configuration +-# +-CONFIG_NETFILTER_INGRESS=y +-CONFIG_NETFILTER_NETLINK=m +-CONFIG_NETFILTER_NETLINK_ACCT=m +-CONFIG_NETFILTER_NETLINK_QUEUE=m +-CONFIG_NETFILTER_NETLINK_LOG=m +-CONFIG_NF_CONNTRACK=m +-CONFIG_NF_LOG_COMMON=m +-CONFIG_NF_CONNTRACK_MARK=y +-CONFIG_NF_CONNTRACK_SECMARK=y +-CONFIG_NF_CONNTRACK_ZONES=y +-CONFIG_NF_CONNTRACK_PROCFS=y +-CONFIG_NF_CONNTRACK_EVENTS=y +-CONFIG_NF_CONNTRACK_TIMEOUT=y +-CONFIG_NF_CONNTRACK_TIMESTAMP=y +-CONFIG_NF_CONNTRACK_LABELS=y +-CONFIG_NF_CT_PROTO_DCCP=m +-CONFIG_NF_CT_PROTO_GRE=m +-CONFIG_NF_CT_PROTO_SCTP=m +-CONFIG_NF_CT_PROTO_UDPLITE=m +-CONFIG_NF_CONNTRACK_AMANDA=m +-CONFIG_NF_CONNTRACK_FTP=m +-CONFIG_NF_CONNTRACK_H323=m +-CONFIG_NF_CONNTRACK_IRC=m +-CONFIG_NF_CONNTRACK_BROADCAST=m +-CONFIG_NF_CONNTRACK_NETBIOS_NS=m +-CONFIG_NF_CONNTRACK_SNMP=m +-CONFIG_NF_CONNTRACK_PPTP=m +-CONFIG_NF_CONNTRACK_SANE=m +-CONFIG_NF_CONNTRACK_SIP=m +-CONFIG_NF_CONNTRACK_TFTP=m +-CONFIG_NF_CT_NETLINK=m +-CONFIG_NF_CT_NETLINK_TIMEOUT=m +-# CONFIG_NETFILTER_NETLINK_GLUE_CT is not set +-CONFIG_NF_NAT=m +-CONFIG_NF_NAT_NEEDED=y +-CONFIG_NF_NAT_PROTO_DCCP=m +-CONFIG_NF_NAT_PROTO_UDPLITE=m +-CONFIG_NF_NAT_PROTO_SCTP=m +-CONFIG_NF_NAT_AMANDA=m +-CONFIG_NF_NAT_FTP=m +-CONFIG_NF_NAT_IRC=m +-CONFIG_NF_NAT_SIP=m +-CONFIG_NF_NAT_TFTP=m +-CONFIG_NF_NAT_REDIRECT=m +-CONFIG_NETFILTER_SYNPROXY=m +-CONFIG_NF_TABLES=m +-CONFIG_NF_TABLES_INET=m +-CONFIG_NF_TABLES_NETDEV=m +-CONFIG_NFT_EXTHDR=m +-CONFIG_NFT_META=m +-CONFIG_NFT_CT=m +-CONFIG_NFT_RBTREE=m +-CONFIG_NFT_HASH=m +-CONFIG_NFT_COUNTER=m +-CONFIG_NFT_LOG=m +-CONFIG_NFT_LIMIT=m +-CONFIG_NFT_MASQ=m +-CONFIG_NFT_REDIR=m +-CONFIG_NFT_NAT=m +-CONFIG_NFT_QUEUE=m +-CONFIG_NFT_REJECT=m +-CONFIG_NFT_REJECT_INET=m +-CONFIG_NFT_COMPAT=m +-CONFIG_NETFILTER_XTABLES=m +- +-# +-# Xtables combined modules +-# +-CONFIG_NETFILTER_XT_MARK=m +-CONFIG_NETFILTER_XT_CONNMARK=m +-CONFIG_NETFILTER_XT_SET=m +- +-# +-# Xtables targets +-# +-CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m +-CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m +-CONFIG_NETFILTER_XT_TARGET_CONNMARK=m +-CONFIG_NETFILTER_XT_TARGET_CONNSECMARK=m +-CONFIG_NETFILTER_XT_TARGET_CT=m +-CONFIG_NETFILTER_XT_TARGET_DSCP=m +-CONFIG_NETFILTER_XT_TARGET_HL=m +-CONFIG_NETFILTER_XT_TARGET_HMARK=m +-CONFIG_NETFILTER_XT_TARGET_IDLETIMER=m +-CONFIG_NETFILTER_XT_TARGET_LED=m +-CONFIG_NETFILTER_XT_TARGET_LOG=m +-CONFIG_NETFILTER_XT_TARGET_MARK=m +-CONFIG_NETFILTER_XT_NAT=m +-CONFIG_NETFILTER_XT_TARGET_NETMAP=m +-CONFIG_NETFILTER_XT_TARGET_NFLOG=m +-CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m +-CONFIG_NETFILTER_XT_TARGET_NOTRACK=m +-CONFIG_NETFILTER_XT_TARGET_RATEEST=m +-CONFIG_NETFILTER_XT_TARGET_REDIRECT=m +-CONFIG_NETFILTER_XT_TARGET_TEE=m +-CONFIG_NETFILTER_XT_TARGET_TPROXY=m +-CONFIG_NETFILTER_XT_TARGET_TRACE=m +-CONFIG_NETFILTER_XT_TARGET_SECMARK=m +-CONFIG_NETFILTER_XT_TARGET_TCPMSS=m +-CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP=m +- +-# +-# Xtables matches +-# +-CONFIG_NETFILTER_XT_MATCH_ADDRTYPE=m +-CONFIG_NETFILTER_XT_MATCH_BPF=m +-CONFIG_NETFILTER_XT_MATCH_CGROUP=m +-CONFIG_NETFILTER_XT_MATCH_CLUSTER=m +-CONFIG_NETFILTER_XT_MATCH_COMMENT=m +-CONFIG_NETFILTER_XT_MATCH_CONNBYTES=m +-CONFIG_NETFILTER_XT_MATCH_CONNLABEL=m +-CONFIG_NETFILTER_XT_MATCH_CONNLIMIT=m +-CONFIG_NETFILTER_XT_MATCH_CONNMARK=m +-CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m +-CONFIG_NETFILTER_XT_MATCH_CPU=m +-CONFIG_NETFILTER_XT_MATCH_DCCP=m +-CONFIG_NETFILTER_XT_MATCH_DEVGROUP=m +-CONFIG_NETFILTER_XT_MATCH_DSCP=m +-CONFIG_NETFILTER_XT_MATCH_ECN=m +-CONFIG_NETFILTER_XT_MATCH_ESP=m +-CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=m +-CONFIG_NETFILTER_XT_MATCH_HELPER=m +-CONFIG_NETFILTER_XT_MATCH_HL=m +-CONFIG_NETFILTER_XT_MATCH_IPCOMP=m +-CONFIG_NETFILTER_XT_MATCH_IPRANGE=m +-CONFIG_NETFILTER_XT_MATCH_IPVS=m +-CONFIG_NETFILTER_XT_MATCH_L2TP=m +-CONFIG_NETFILTER_XT_MATCH_LENGTH=m +-CONFIG_NETFILTER_XT_MATCH_LIMIT=m +-CONFIG_NETFILTER_XT_MATCH_MAC=m +-CONFIG_NETFILTER_XT_MATCH_MARK=m +-CONFIG_NETFILTER_XT_MATCH_MULTIPORT=m +-CONFIG_NETFILTER_XT_MATCH_NFACCT=m +-CONFIG_NETFILTER_XT_MATCH_OSF=m +-CONFIG_NETFILTER_XT_MATCH_OWNER=m +-CONFIG_NETFILTER_XT_MATCH_POLICY=m +-CONFIG_NETFILTER_XT_MATCH_PHYSDEV=m +-CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m +-CONFIG_NETFILTER_XT_MATCH_QUOTA=m +-CONFIG_NETFILTER_XT_MATCH_RATEEST=m +-CONFIG_NETFILTER_XT_MATCH_REALM=m +-CONFIG_NETFILTER_XT_MATCH_RECENT=m +-CONFIG_NETFILTER_XT_MATCH_SCTP=m +-CONFIG_NETFILTER_XT_MATCH_SOCKET=m +-CONFIG_NETFILTER_XT_MATCH_STATE=m +-CONFIG_NETFILTER_XT_MATCH_STATISTIC=m +-CONFIG_NETFILTER_XT_MATCH_STRING=m +-CONFIG_NETFILTER_XT_MATCH_TCPMSS=m +-CONFIG_NETFILTER_XT_MATCH_TIME=m +-CONFIG_NETFILTER_XT_MATCH_U32=m +-CONFIG_IP_SET=m +-CONFIG_IP_SET_MAX=256 +-CONFIG_IP_SET_BITMAP_IP=m +-CONFIG_IP_SET_BITMAP_IPMAC=m +-CONFIG_IP_SET_BITMAP_PORT=m +-CONFIG_IP_SET_HASH_IP=m +-CONFIG_IP_SET_HASH_IPMARK=m +-CONFIG_IP_SET_HASH_IPPORT=m +-CONFIG_IP_SET_HASH_IPPORTIP=m +-CONFIG_IP_SET_HASH_IPPORTNET=m +-CONFIG_IP_SET_HASH_MAC=m +-CONFIG_IP_SET_HASH_NETPORTNET=m +-CONFIG_IP_SET_HASH_NET=m +-CONFIG_IP_SET_HASH_NETNET=m +-CONFIG_IP_SET_HASH_NETPORT=m +-CONFIG_IP_SET_HASH_NETIFACE=m +-CONFIG_IP_SET_LIST_SET=m +-CONFIG_IP_VS=m +-CONFIG_IP_VS_IPV6=y +-# CONFIG_IP_VS_DEBUG is not set +-CONFIG_IP_VS_TAB_BITS=12 +- +-# +-# IPVS transport protocol load balancing support +-# +-CONFIG_IP_VS_PROTO_TCP=y +-CONFIG_IP_VS_PROTO_UDP=y +-CONFIG_IP_VS_PROTO_AH_ESP=y +-CONFIG_IP_VS_PROTO_ESP=y +-CONFIG_IP_VS_PROTO_AH=y +-CONFIG_IP_VS_PROTO_SCTP=y +- +-# +-# IPVS scheduler +-# +-CONFIG_IP_VS_RR=m +-CONFIG_IP_VS_WRR=m +-CONFIG_IP_VS_LC=m +-CONFIG_IP_VS_WLC=m +-CONFIG_IP_VS_FO=m +-CONFIG_IP_VS_OVF=m +-CONFIG_IP_VS_LBLC=m +-CONFIG_IP_VS_LBLCR=m +-CONFIG_IP_VS_DH=m +-CONFIG_IP_VS_SH=m +-CONFIG_IP_VS_SED=m +-CONFIG_IP_VS_NQ=m +- +-# +-# IPVS SH scheduler +-# +-CONFIG_IP_VS_SH_TAB_BITS=8 +- +-# +-# IPVS application helper +-# +-CONFIG_IP_VS_FTP=m +-CONFIG_IP_VS_NFCT=y +-CONFIG_IP_VS_PE_SIP=m +- +-# +-# IP: Netfilter Configuration +-# +-CONFIG_NF_DEFRAG_IPV4=m +-CONFIG_NF_CONNTRACK_IPV4=m +-CONFIG_NF_CONNTRACK_PROC_COMPAT=y +-CONFIG_NF_TABLES_IPV4=m +-CONFIG_NFT_CHAIN_ROUTE_IPV4=m +-CONFIG_NFT_REJECT_IPV4=m +-CONFIG_NFT_DUP_IPV4=m +-CONFIG_NF_TABLES_ARP=m +-CONFIG_NF_DUP_IPV4=m +-CONFIG_NF_LOG_ARP=m +-CONFIG_NF_LOG_IPV4=m +-CONFIG_NF_REJECT_IPV4=m +-CONFIG_NF_NAT_IPV4=m +-CONFIG_NFT_CHAIN_NAT_IPV4=m +-CONFIG_NF_NAT_MASQUERADE_IPV4=m +-CONFIG_NFT_MASQ_IPV4=m +-CONFIG_NFT_REDIR_IPV4=m +-CONFIG_NF_NAT_SNMP_BASIC=m +-CONFIG_NF_NAT_PROTO_GRE=m +-CONFIG_NF_NAT_PPTP=m +-CONFIG_NF_NAT_H323=m +-CONFIG_IP_NF_IPTABLES=m +-CONFIG_IP_NF_MATCH_AH=m +-CONFIG_IP_NF_MATCH_ECN=m +-CONFIG_IP_NF_MATCH_RPFILTER=m +-CONFIG_IP_NF_MATCH_TTL=m +-CONFIG_IP_NF_FILTER=m +-CONFIG_IP_NF_TARGET_REJECT=m +-CONFIG_IP_NF_TARGET_SYNPROXY=m +-CONFIG_IP_NF_NAT=m +-CONFIG_IP_NF_TARGET_MASQUERADE=m +-CONFIG_IP_NF_TARGET_NETMAP=m +-CONFIG_IP_NF_TARGET_REDIRECT=m +-CONFIG_IP_NF_MANGLE=m +-CONFIG_IP_NF_TARGET_CLUSTERIP=m +-CONFIG_IP_NF_TARGET_ECN=m +-CONFIG_IP_NF_TARGET_TTL=m +-CONFIG_IP_NF_RAW=m +-CONFIG_IP_NF_ARPTABLES=m +-CONFIG_IP_NF_ARPFILTER=m +-CONFIG_IP_NF_ARP_MANGLE=m +- +-# +-# IPv6: Netfilter Configuration +-# +-CONFIG_NF_DEFRAG_IPV6=m +-CONFIG_NF_CONNTRACK_IPV6=m +-CONFIG_NF_TABLES_IPV6=m +-CONFIG_NFT_CHAIN_ROUTE_IPV6=m +-CONFIG_NFT_REJECT_IPV6=m +-CONFIG_NFT_DUP_IPV6=m +-CONFIG_NF_DUP_IPV6=m +-CONFIG_NF_REJECT_IPV6=m +-CONFIG_NF_LOG_IPV6=m +-CONFIG_NF_NAT_IPV6=m +-CONFIG_NFT_CHAIN_NAT_IPV6=m +-CONFIG_NF_NAT_MASQUERADE_IPV6=m +-CONFIG_NFT_MASQ_IPV6=m +-CONFIG_NFT_REDIR_IPV6=m +-CONFIG_IP6_NF_IPTABLES=m +-CONFIG_IP6_NF_MATCH_AH=m +-CONFIG_IP6_NF_MATCH_EUI64=m +-CONFIG_IP6_NF_MATCH_FRAG=m +-CONFIG_IP6_NF_MATCH_OPTS=m +-CONFIG_IP6_NF_MATCH_HL=m +-CONFIG_IP6_NF_MATCH_IPV6HEADER=m +-CONFIG_IP6_NF_MATCH_MH=m +-CONFIG_IP6_NF_MATCH_RPFILTER=m +-CONFIG_IP6_NF_MATCH_RT=m +-CONFIG_IP6_NF_TARGET_HL=m +-CONFIG_IP6_NF_FILTER=m +-CONFIG_IP6_NF_TARGET_REJECT=m +-CONFIG_IP6_NF_TARGET_SYNPROXY=m +-CONFIG_IP6_NF_MANGLE=m +-CONFIG_IP6_NF_RAW=m +-CONFIG_IP6_NF_NAT=m +-CONFIG_IP6_NF_TARGET_MASQUERADE=m +-CONFIG_IP6_NF_TARGET_NPT=m +-CONFIG_NF_TABLES_BRIDGE=m +-CONFIG_NFT_BRIDGE_META=m +-CONFIG_NFT_BRIDGE_REJECT=m +-CONFIG_NF_LOG_BRIDGE=m +-CONFIG_BRIDGE_NF_EBTABLES=m +-CONFIG_BRIDGE_EBT_BROUTE=m +-CONFIG_BRIDGE_EBT_T_FILTER=m +-CONFIG_BRIDGE_EBT_T_NAT=m +-CONFIG_BRIDGE_EBT_802_3=m +-CONFIG_BRIDGE_EBT_AMONG=m +-CONFIG_BRIDGE_EBT_ARP=m +-CONFIG_BRIDGE_EBT_IP=m +-CONFIG_BRIDGE_EBT_IP6=m +-CONFIG_BRIDGE_EBT_LIMIT=m +-CONFIG_BRIDGE_EBT_MARK=m +-CONFIG_BRIDGE_EBT_PKTTYPE=m +-CONFIG_BRIDGE_EBT_STP=m +-CONFIG_BRIDGE_EBT_VLAN=m +-CONFIG_BRIDGE_EBT_ARPREPLY=m +-CONFIG_BRIDGE_EBT_DNAT=m +-CONFIG_BRIDGE_EBT_MARK_T=m +-CONFIG_BRIDGE_EBT_REDIRECT=m +-CONFIG_BRIDGE_EBT_SNAT=m +-CONFIG_BRIDGE_EBT_LOG=m +-CONFIG_BRIDGE_EBT_NFLOG=m +-CONFIG_IP_DCCP=m +-CONFIG_INET_DCCP_DIAG=m +- +-# +-# DCCP CCIDs Configuration +-# +-# CONFIG_IP_DCCP_CCID2_DEBUG is not set +-CONFIG_IP_DCCP_CCID3=y +-# CONFIG_IP_DCCP_CCID3_DEBUG is not set +-CONFIG_IP_DCCP_TFRC_LIB=y +- +-# +-# DCCP Kernel Hacking +-# +-# CONFIG_IP_DCCP_DEBUG is not set +-CONFIG_IP_SCTP=m +-CONFIG_SCTP_DBG_OBJCNT=y +-CONFIG_SCTP_DEFAULT_COOKIE_HMAC_MD5=y +-# CONFIG_SCTP_DEFAULT_COOKIE_HMAC_SHA1 is not set +-# CONFIG_SCTP_DEFAULT_COOKIE_HMAC_NONE is not set +-CONFIG_SCTP_COOKIE_HMAC_MD5=y +-CONFIG_SCTP_COOKIE_HMAC_SHA1=y +-CONFIG_RDS=m +-# CONFIG_RDS_TCP is not set +-# CONFIG_RDS_DEBUG is not set +-CONFIG_TIPC=m +-CONFIG_TIPC_MEDIA_UDP=y +-# CONFIG_ATM is not set +-CONFIG_L2TP=m +-# CONFIG_L2TP_DEBUGFS is not set +-CONFIG_L2TP_V3=y +-CONFIG_L2TP_IP=m +-CONFIG_L2TP_ETH=m +-CONFIG_STP=m +-CONFIG_BRIDGE=m +-CONFIG_BRIDGE_IGMP_SNOOPING=y +-CONFIG_BRIDGE_VLAN_FILTERING=y +-CONFIG_HAVE_NET_DSA=y +-CONFIG_VLAN_8021Q=m +-# CONFIG_VLAN_8021Q_GVRP is not set +-# CONFIG_VLAN_8021Q_MVRP is not set +-# CONFIG_DECNET is not set +-CONFIG_LLC=m +-CONFIG_LLC2=m +-# CONFIG_IPX is not set +-CONFIG_ATALK=m +-CONFIG_DEV_APPLETALK=m +-CONFIG_IPDDP=m +-CONFIG_IPDDP_ENCAP=y +-# CONFIG_X25 is not set +-# CONFIG_LAPB is not set +-# CONFIG_PHONET is not set +-# CONFIG_6LOWPAN is not set +-# CONFIG_IEEE802154 is not set +-CONFIG_NET_SCHED=y +- +-# +-# Queueing/Scheduling +-# +-CONFIG_NET_SCH_CBQ=y +-CONFIG_NET_SCH_HTB=y +-CONFIG_NET_SCH_HFSC=m +-CONFIG_NET_SCH_PRIO=y +-CONFIG_NET_SCH_MULTIQ=m +-CONFIG_NET_SCH_RED=m +-CONFIG_NET_SCH_SFB=m +-CONFIG_NET_SCH_SFQ=y +-CONFIG_NET_SCH_TEQL=m +-CONFIG_NET_SCH_TBF=m +-CONFIG_NET_SCH_GRED=m +-CONFIG_NET_SCH_DSMARK=m +-CONFIG_NET_SCH_NETEM=m +-CONFIG_NET_SCH_DRR=m +-CONFIG_NET_SCH_MQPRIO=m +-CONFIG_NET_SCH_CHOKE=m +-CONFIG_NET_SCH_QFQ=y +-CONFIG_NET_SCH_CODEL=m +-CONFIG_NET_SCH_FQ_CODEL=m +-CONFIG_NET_SCH_FQ=m +-CONFIG_NET_SCH_HHF=m +-CONFIG_NET_SCH_PIE=m +-CONFIG_NET_SCH_INGRESS=m +-CONFIG_NET_SCH_PLUG=m +- +-# +-# Classification +-# +-CONFIG_NET_CLS=y +-CONFIG_NET_CLS_BASIC=m +-CONFIG_NET_CLS_TCINDEX=m +-CONFIG_NET_CLS_ROUTE4=m +-CONFIG_NET_CLS_FW=m +-CONFIG_NET_CLS_U32=m +-CONFIG_CLS_U32_PERF=y +-CONFIG_CLS_U32_MARK=y +-CONFIG_NET_CLS_RSVP=m +-CONFIG_NET_CLS_RSVP6=m +-CONFIG_NET_CLS_FLOW=m +-CONFIG_NET_CLS_CGROUP=m +-CONFIG_NET_CLS_BPF=m +-CONFIG_NET_CLS_FLOWER=m +-CONFIG_NET_EMATCH=y +-CONFIG_NET_EMATCH_STACK=32 +-CONFIG_NET_EMATCH_CMP=m +-CONFIG_NET_EMATCH_NBYTE=m +-CONFIG_NET_EMATCH_U32=m +-CONFIG_NET_EMATCH_META=m +-CONFIG_NET_EMATCH_TEXT=m +-CONFIG_NET_EMATCH_CANID=m +-CONFIG_NET_EMATCH_IPSET=m +-CONFIG_NET_CLS_ACT=y +-CONFIG_NET_ACT_POLICE=m +-CONFIG_NET_ACT_GACT=m +-CONFIG_GACT_PROB=y +-CONFIG_NET_ACT_MIRRED=m +-CONFIG_NET_ACT_IPT=m +-CONFIG_NET_ACT_NAT=m +-CONFIG_NET_ACT_PEDIT=m +-CONFIG_NET_ACT_SIMP=m +-CONFIG_NET_ACT_SKBEDIT=m +-CONFIG_NET_ACT_CSUM=m +-CONFIG_NET_ACT_VLAN=m +-CONFIG_NET_ACT_BPF=m +-CONFIG_NET_ACT_CONNMARK=m +-CONFIG_NET_CLS_IND=y +-CONFIG_NET_SCH_FIFO=y +-# CONFIG_DCB is not set +-CONFIG_DNS_RESOLVER=y +-# CONFIG_BATMAN_ADV is not set +-CONFIG_OPENVSWITCH=m +-CONFIG_OPENVSWITCH_GRE=m +-CONFIG_OPENVSWITCH_VXLAN=m +-CONFIG_VSOCKETS=m +-CONFIG_NETLINK_MMAP=y +-CONFIG_NETLINK_DIAG=m +-CONFIG_MPLS=y +-CONFIG_NET_MPLS_GSO=m +-# CONFIG_MPLS_ROUTING is not set +-# CONFIG_HSR is not set +-# CONFIG_NET_SWITCHDEV is not set +-# CONFIG_NET_L3_MASTER_DEV is not set +-CONFIG_RPS=y +-CONFIG_RFS_ACCEL=y +-CONFIG_XPS=y +-CONFIG_CGROUP_NET_PRIO=y +-CONFIG_CGROUP_NET_CLASSID=y +-CONFIG_NET_RX_BUSY_POLL=y +-CONFIG_BQL=y +-# CONFIG_BPF_JIT is not set +-CONFIG_NET_FLOW_LIMIT=y +- +-# +-# Network testing +-# +-# CONFIG_NET_PKTGEN is not set +-# CONFIG_NET_DROP_MONITOR is not set +-# CONFIG_HAMRADIO is not set +-CONFIG_CAN=m +-CONFIG_CAN_RAW=m +-CONFIG_CAN_BCM=m +-CONFIG_CAN_GW=m +- +-# +-# CAN Device Drivers +-# +-# CONFIG_CAN_VCAN is not set +-# CONFIG_CAN_SLCAN is not set +-CONFIG_CAN_DEV=m +-CONFIG_CAN_CALC_BITTIMING=y +-# CONFIG_CAN_LEDS is not set +-# CONFIG_CAN_TI_HECC is not set +-CONFIG_CAN_FLEXCAN=m +-# CONFIG_CAN_GRCAN is not set +-# CONFIG_CAN_RCAR is not set +-# CONFIG_CAN_SJA1000 is not set +-# CONFIG_CAN_C_CAN is not set +-# CONFIG_CAN_M_CAN is not set +-# CONFIG_CAN_CC770 is not set +- +-# +-# CAN SPI interfaces +-# +-# CONFIG_CAN_MCP251X is not set +- +-# +-# CAN USB interfaces +-# +-CONFIG_CAN_EMS_USB=m +-CONFIG_CAN_ESD_USB2=m +-CONFIG_CAN_GS_USB=m +-CONFIG_CAN_KVASER_USB=m +-CONFIG_CAN_PEAK_USB=m +-CONFIG_CAN_8DEV_USB=m +-# CONFIG_CAN_SOFTING is not set +-# CONFIG_CAN_DEBUG_DEVICES is not set +-CONFIG_IRDA=m +- +-# +-# IrDA protocols +-# +-CONFIG_IRLAN=m +-CONFIG_IRNET=m +-CONFIG_IRCOMM=m +-CONFIG_IRDA_ULTRA=y +- +-# +-# IrDA options +-# +-# CONFIG_IRDA_CACHE_LAST_LSAP is not set +-CONFIG_IRDA_FAST_RR=y +-# CONFIG_IRDA_DEBUG is not set +- +-# +-# Infrared-port device drivers +-# +- +-# +-# SIR device drivers +-# +-CONFIG_IRTTY_SIR=m +- +-# +-# Dongle support +-# +-CONFIG_DONGLE=y +-CONFIG_ESI_DONGLE=m +-CONFIG_ACTISYS_DONGLE=m +-CONFIG_TEKRAM_DONGLE=m +-CONFIG_TOIM3232_DONGLE=m +-CONFIG_LITELINK_DONGLE=m +-CONFIG_MA600_DONGLE=m +-CONFIG_GIRBIL_DONGLE=m +-CONFIG_MCP2120_DONGLE=m +-CONFIG_OLD_BELKIN_DONGLE=m +-CONFIG_ACT200L_DONGLE=m +-CONFIG_KINGSUN_DONGLE=m +-CONFIG_KSDAZZLE_DONGLE=m +-CONFIG_KS959_DONGLE=m +- +-# +-# FIR device drivers +-# +-CONFIG_USB_IRDA=m +-CONFIG_SIGMATEL_FIR=m +-CONFIG_VLSI_FIR=m +-CONFIG_MCS_FIR=m +-CONFIG_BT=y +-CONFIG_BT_BREDR=y +-CONFIG_BT_RFCOMM=m +-CONFIG_BT_RFCOMM_TTY=y +-CONFIG_BT_BNEP=m +-CONFIG_BT_BNEP_MC_FILTER=y +-CONFIG_BT_BNEP_PROTO_FILTER=y +-CONFIG_BT_CMTP=m +-CONFIG_BT_HIDP=y +-CONFIG_BT_HS=y +-CONFIG_BT_LE=y +-# CONFIG_BT_SELFTEST is not set +-# CONFIG_BT_DEBUGFS is not set +- +-# +-# Bluetooth device drivers +-# +-CONFIG_BT_INTEL=y +-CONFIG_BT_BCM=y +-CONFIG_BT_RTL=m +-CONFIG_BT_QCA=y +-CONFIG_BT_HCIBTUSB=m +-CONFIG_BT_HCIBTUSB_BCM=y +-CONFIG_BT_HCIBTUSB_RTL=y +-# CONFIG_BT_HCIBTSDIO is not set +-CONFIG_BT_HCIUART=y +-CONFIG_BT_HCIUART_H4=y +-CONFIG_BT_HCIUART_BCSP=y +-CONFIG_BT_HCIUART_ATH3K=y +-CONFIG_BT_HCIUART_LL=y +-CONFIG_BT_HCIUART_3WIRE=y +-CONFIG_BT_HCIUART_INTEL=y +-CONFIG_BT_HCIUART_BCM=y +-CONFIG_BT_HCIUART_QCA=y +-CONFIG_BT_HCIBCM203X=m +-CONFIG_BT_HCIBPA10X=m +-CONFIG_BT_HCIBFUSB=m +-CONFIG_BT_HCIVHCI=m +-CONFIG_BT_MRVL=m +-CONFIG_BT_MRVL_SDIO=m +-CONFIG_BT_ATH3K=m +-CONFIG_BT_WILINK=m +-CONFIG_AF_RXRPC=m +-# CONFIG_AF_RXRPC_DEBUG is not set +-# CONFIG_RXKAD is not set +-CONFIG_FIB_RULES=y +-CONFIG_WIRELESS=y +-CONFIG_WIRELESS_EXT=y +-CONFIG_WEXT_CORE=y +-CONFIG_WEXT_PROC=y +-CONFIG_WEXT_SPY=y +-CONFIG_WEXT_PRIV=y +-CONFIG_CFG80211=m +-# CONFIG_NL80211_TESTMODE is not set +-# CONFIG_CFG80211_DEVELOPER_WARNINGS is not set +-# CONFIG_CFG80211_REG_DEBUG is not set +-# CONFIG_CFG80211_CERTIFICATION_ONUS is not set +-# CONFIG_CFG80211_DEFAULT_PS is not set +-# CONFIG_CFG80211_DEBUGFS is not set +-# CONFIG_CFG80211_INTERNAL_REGDB is not set +-CONFIG_CFG80211_CRDA_SUPPORT=y +-CONFIG_CFG80211_WEXT=y +-CONFIG_CFG80211_WEXT_EXPORT=y +-CONFIG_LIB80211=m +-CONFIG_LIB80211_CRYPT_WEP=m +-CONFIG_LIB80211_CRYPT_CCMP=m +-CONFIG_LIB80211_CRYPT_TKIP=m +-# CONFIG_LIB80211_DEBUG is not set +-CONFIG_MAC80211=m +-CONFIG_MAC80211_HAS_RC=y +-CONFIG_MAC80211_RC_MINSTREL=y +-CONFIG_MAC80211_RC_MINSTREL_HT=y +-CONFIG_MAC80211_RC_MINSTREL_VHT=y +-CONFIG_MAC80211_RC_DEFAULT_MINSTREL=y +-CONFIG_MAC80211_RC_DEFAULT="minstrel_ht" +-CONFIG_MAC80211_MESH=y +-CONFIG_MAC80211_LEDS=y +-# CONFIG_MAC80211_DEBUGFS is not set +-# CONFIG_MAC80211_MESSAGE_TRACING is not set +-# CONFIG_MAC80211_DEBUG_MENU is not set +-CONFIG_MAC80211_STA_HASH_MAX_SIZE=0 +-# CONFIG_WIMAX is not set +-CONFIG_RFKILL=y +-CONFIG_RFKILL_LEDS=y +-CONFIG_RFKILL_INPUT=y +-CONFIG_RFKILL_REGULATOR=y +-CONFIG_RFKILL_GPIO=y +-# CONFIG_NET_9P is not set +-CONFIG_CAIF=m +-# CONFIG_CAIF_DEBUG is not set +-CONFIG_CAIF_NETDEV=m +-CONFIG_CAIF_USB=m +-CONFIG_CEPH_LIB=m +-# CONFIG_CEPH_LIB_PRETTYDEBUG is not set +-CONFIG_CEPH_LIB_USE_DNS_RESOLVER=y +-CONFIG_NFC=m +-# CONFIG_NFC_DIGITAL is not set +-# CONFIG_NFC_NCI is not set +-# CONFIG_NFC_HCI is not set +- +-# +-# Near Field Communication (NFC) devices +-# +-# CONFIG_NFC_PN533 is not set +-# CONFIG_NFC_SIM is not set +-CONFIG_LWTUNNEL=y +-CONFIG_HAVE_BPF_JIT=y +- +-# +-# Device Drivers +-# +- +-# +-# Generic Driver Options +-# +-CONFIG_UEVENT_HELPER=y +-CONFIG_UEVENT_HELPER_PATH="" +-CONFIG_DEVTMPFS=y +-CONFIG_DEVTMPFS_MOUNT=y +-# CONFIG_STANDALONE is not set +-# CONFIG_PREVENT_FIRMWARE_BUILD is not set +-CONFIG_FW_LOADER=y +-CONFIG_FIRMWARE_IN_KERNEL=y +-CONFIG_EXTRA_FIRMWARE="" +-CONFIG_FW_LOADER_USER_HELPER=y +-CONFIG_FW_LOADER_USER_HELPER_FALLBACK=y +-CONFIG_WANT_DEV_COREDUMP=y +-CONFIG_ALLOW_DEV_COREDUMP=y +-CONFIG_DEV_COREDUMP=y +-# CONFIG_DEBUG_DRIVER is not set +-# CONFIG_DEBUG_DEVRES is not set +-# CONFIG_SYS_HYPERVISOR is not set +-# CONFIG_GENERIC_CPU_DEVICES is not set +-CONFIG_SOC_BUS=y +-CONFIG_REGMAP=y +-CONFIG_REGMAP_I2C=y +-CONFIG_REGMAP_SPI=y +-CONFIG_REGMAP_MMIO=y +-CONFIG_REGMAP_IRQ=y +-CONFIG_DMA_SHARED_BUFFER=y +-# CONFIG_FENCE_TRACE is not set +-CONFIG_DMA_CMA=y +- +-# +-# Default contiguous memory area size: +-# +-CONFIG_CMA_SIZE_MBYTES=288 +-CONFIG_CMA_SIZE_SEL_MBYTES=y +-# CONFIG_CMA_SIZE_SEL_PERCENTAGE is not set +-# CONFIG_CMA_SIZE_SEL_MIN is not set +-# CONFIG_CMA_SIZE_SEL_MAX is not set +-CONFIG_CMA_ALIGNMENT=8 +- +-# +-# Bus devices +-# +-# CONFIG_ARM_CCI400_PMU is not set +-# CONFIG_ARM_CCI500_PMU is not set +-# CONFIG_ARM_CCN is not set +-# CONFIG_BRCMSTB_GISB_ARB is not set +-CONFIG_IMX_WEIM=y +-# CONFIG_VEXPRESS_CONFIG is not set +-CONFIG_CONNECTOR=y +-CONFIG_PROC_EVENTS=y +-CONFIG_MTD=y +-# CONFIG_MTD_TESTS is not set +-# CONFIG_MTD_REDBOOT_PARTS is not set +-CONFIG_MTD_CMDLINE_PARTS=y +-# CONFIG_MTD_AFS_PARTS is not set +-CONFIG_MTD_OF_PARTS=y +-# CONFIG_MTD_AR7_PARTS is not set +- +-# +-# User Modules And Translation Layers +-# +-CONFIG_MTD_BLKDEVS=y +-CONFIG_MTD_BLOCK=y +-# CONFIG_FTL is not set +-# CONFIG_NFTL is not set +-# CONFIG_INFTL is not set +-# CONFIG_RFD_FTL is not set +-# CONFIG_SSFDC is not set +-# CONFIG_SM_FTL is not set +-# CONFIG_MTD_OOPS is not set +-# CONFIG_MTD_SWAP is not set +-# CONFIG_MTD_PARTITIONED_MASTER is not set +- +-# +-# RAM/ROM/Flash chip drivers +-# +-CONFIG_MTD_CFI=y +-CONFIG_MTD_JEDECPROBE=y +-CONFIG_MTD_GEN_PROBE=y +-# CONFIG_MTD_CFI_ADV_OPTIONS is not set +-CONFIG_MTD_MAP_BANK_WIDTH_1=y +-CONFIG_MTD_MAP_BANK_WIDTH_2=y +-CONFIG_MTD_MAP_BANK_WIDTH_4=y +-# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set +-# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set +-# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set +-CONFIG_MTD_CFI_I1=y +-CONFIG_MTD_CFI_I2=y +-# CONFIG_MTD_CFI_I4 is not set +-# CONFIG_MTD_CFI_I8 is not set +-CONFIG_MTD_CFI_INTELEXT=y +-CONFIG_MTD_CFI_AMDSTD=y +-CONFIG_MTD_CFI_STAA=y +-CONFIG_MTD_CFI_UTIL=y +-# CONFIG_MTD_RAM is not set +-# CONFIG_MTD_ROM is not set +-# CONFIG_MTD_ABSENT is not set +- +-# +-# Mapping drivers for chip access +-# +-# CONFIG_MTD_COMPLEX_MAPPINGS is not set +-# CONFIG_MTD_PHYSMAP is not set +-CONFIG_MTD_PHYSMAP_OF=y +-# CONFIG_MTD_IMPA7 is not set +-# CONFIG_MTD_INTEL_VR_NOR is not set +-# CONFIG_MTD_PLATRAM is not set +- +-# +-# Self-contained MTD device drivers +-# +-# CONFIG_MTD_PMC551 is not set +-CONFIG_MTD_DATAFLASH=y +-# CONFIG_MTD_DATAFLASH_WRITE_VERIFY is not set +-# CONFIG_MTD_DATAFLASH_OTP is not set +-# CONFIG_MTD_M25P80 is not set +-CONFIG_MTD_SST25L=y +-# CONFIG_MTD_SLRAM is not set +-# CONFIG_MTD_PHRAM is not set +-# CONFIG_MTD_MTDRAM is not set +-# CONFIG_MTD_BLOCK2MTD is not set +- +-# +-# Disk-On-Chip Device Drivers +-# +-# CONFIG_MTD_DOCG3 is not set +-CONFIG_MTD_NAND_ECC=y +-# CONFIG_MTD_NAND_ECC_SMC is not set +-CONFIG_MTD_NAND=y +-# CONFIG_MTD_NAND_ECC_BCH is not set +-# CONFIG_MTD_SM_COMMON is not set +-# CONFIG_MTD_NAND_DENALI_PCI is not set +-# CONFIG_MTD_NAND_DENALI_DT is not set +-# CONFIG_MTD_NAND_GPIO is not set +-# CONFIG_MTD_NAND_OMAP_BCH_BUILD is not set +-CONFIG_MTD_NAND_IDS=y +-# CONFIG_MTD_NAND_RICOH is not set +-# CONFIG_MTD_NAND_DISKONCHIP is not set +-# CONFIG_MTD_NAND_DOCG4 is not set +-# CONFIG_MTD_NAND_CAFE is not set +-# CONFIG_MTD_NAND_NANDSIM is not set +-# CONFIG_MTD_NAND_GPMI_NAND is not set +-# CONFIG_MTD_NAND_BRCMNAND is not set +-# CONFIG_MTD_NAND_PLATFORM is not set +-CONFIG_MTD_NAND_MXC=y +-# CONFIG_MTD_NAND_HISI504 is not set +-# CONFIG_MTD_ONENAND is not set +- +-# +-# LPDDR & LPDDR2 PCM memory drivers +-# +-# CONFIG_MTD_LPDDR is not set +-# CONFIG_MTD_LPDDR2_NVM is not set +-CONFIG_MTD_SPI_NOR=m +-CONFIG_MTD_SPI_NOR_USE_4K_SECTORS=y +-CONFIG_SPI_FSL_QUADSPI=m +-CONFIG_MTD_UBI=y +-CONFIG_MTD_UBI_WL_THRESHOLD=4096 +-CONFIG_MTD_UBI_BEB_LIMIT=20 +-# CONFIG_MTD_UBI_FASTMAP is not set +-# CONFIG_MTD_UBI_GLUEBI is not set +-# CONFIG_MTD_UBI_BLOCK is not set +-CONFIG_DTC=y +-CONFIG_OF=y +-# CONFIG_OF_UNITTEST is not set +-CONFIG_OF_FLATTREE=y +-CONFIG_OF_EARLY_FLATTREE=y +-CONFIG_OF_ADDRESS=y +-CONFIG_OF_ADDRESS_PCI=y +-CONFIG_OF_IRQ=y +-CONFIG_OF_NET=y +-CONFIG_OF_MDIO=y +-CONFIG_OF_PCI=y +-CONFIG_OF_PCI_IRQ=y +-CONFIG_OF_MTD=y +-CONFIG_OF_RESERVED_MEM=y +-# CONFIG_OF_OVERLAY is not set +-CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y +-# CONFIG_PARPORT is not set +-CONFIG_BLK_DEV=y +-# CONFIG_BLK_DEV_NULL_BLK is not set +-# CONFIG_BLK_DEV_PCIESSD_MTIP32XX is not set +-# CONFIG_BLK_CPQ_CISS_DA is not set +-# CONFIG_BLK_DEV_DAC960 is not set +-# CONFIG_BLK_DEV_UMEM is not set +-# CONFIG_BLK_DEV_COW_COMMON is not set +-CONFIG_BLK_DEV_LOOP=m +-CONFIG_BLK_DEV_LOOP_MIN_COUNT=8 +-CONFIG_BLK_DEV_CRYPTOLOOP=m +-# CONFIG_BLK_DEV_DRBD is not set +-# CONFIG_BLK_DEV_NBD is not set +-# CONFIG_BLK_DEV_SX8 is not set +-CONFIG_BLK_DEV_RAM=m +-CONFIG_BLK_DEV_RAM_COUNT=16 +-CONFIG_BLK_DEV_RAM_SIZE=65536 +-CONFIG_CDROM_PKTCDVD=m +-CONFIG_CDROM_PKTCDVD_BUFFERS=8 +-# CONFIG_CDROM_PKTCDVD_WCACHE is not set +-# CONFIG_ATA_OVER_ETH is not set +-CONFIG_MG_DISK=y +-CONFIG_MG_DISK_RES=0 +-# CONFIG_BLK_DEV_RBD is not set +-# CONFIG_BLK_DEV_RSXX is not set +-# CONFIG_BLK_DEV_NVME is not set +- +-# +-# Misc devices +-# +-# CONFIG_SENSORS_LIS3LV02D is not set +-# CONFIG_AD525X_DPOT is not set +-# CONFIG_DUMMY_IRQ is not set +-CONFIG_HWLAT_DETECTOR=m +-# CONFIG_PHANTOM is not set +-# CONFIG_SGI_IOC4 is not set +-CONFIG_TIFM_CORE=y +-CONFIG_TIFM_7XX1=y +-# CONFIG_ICS932S401 is not set +-CONFIG_ENCLOSURE_SERVICES=y +-# CONFIG_HP_ILO is not set +-# CONFIG_APDS9802ALS is not set +-# CONFIG_ISL29003 is not set +-# CONFIG_ISL29020 is not set +-# CONFIG_SENSORS_TSL2550 is not set +-# CONFIG_SENSORS_BH1780 is not set +-# CONFIG_SENSORS_BH1770 is not set +-# CONFIG_SENSORS_APDS990X is not set +-# CONFIG_HMC6352 is not set +-# CONFIG_DS1682 is not set +-# CONFIG_TI_DAC7512 is not set +-# CONFIG_BMP085_I2C is not set +-# CONFIG_BMP085_SPI is not set +-# CONFIG_USB_SWITCH_FSA9480 is not set +-# CONFIG_LATTICE_ECP3_CONFIG is not set +-CONFIG_SRAM=y +-# CONFIG_C2PORT is not set +- +-# +-# EEPROM support +-# +-CONFIG_EEPROM_AT24=y +-CONFIG_EEPROM_AT25=y +-# CONFIG_EEPROM_LEGACY is not set +-CONFIG_EEPROM_MAX6875=y +-CONFIG_EEPROM_93CX6=m +-# CONFIG_EEPROM_93XX46 is not set +-CONFIG_CB710_CORE=y +-# CONFIG_CB710_DEBUG is not set +-CONFIG_CB710_DEBUG_ASSUMPTIONS=y +- +-# +-# Texas Instruments shared transport line discipline +-# +-CONFIG_TI_ST=m +-# CONFIG_SENSORS_LIS3_SPI is not set +-# CONFIG_SENSORS_LIS3_I2C is not set +- +-# +-# Altera FPGA firmware download module +-# +-CONFIG_ALTERA_STAPL=m +- +-# +-# Intel MIC Bus Driver +-# +- +-# +-# SCIF Bus Driver +-# +- +-# +-# Intel MIC Host Driver +-# +- +-# +-# Intel MIC Card Driver +-# +- +-# +-# SCIF Driver +-# +- +-# +-# Intel MIC Coprocessor State Management (COSM) Drivers +-# +-CONFIG_ECHO=m +-# CONFIG_CXL_BASE is not set +-# CONFIG_CXL_KERNEL_API is not set +-# CONFIG_CXL_EEH is not set +-CONFIG_HAVE_IDE=y +-# CONFIG_IDE is not set +- +-# +-# SCSI device support +-# +-CONFIG_SCSI_MOD=y +-# CONFIG_RAID_ATTRS is not set +-CONFIG_SCSI=y +-CONFIG_SCSI_DMA=y +-CONFIG_SCSI_NETLINK=y +-# CONFIG_SCSI_MQ_DEFAULT is not set +-CONFIG_SCSI_PROC_FS=y +- +-# +-# SCSI support type (disk, tape, CD-ROM) +-# +-CONFIG_BLK_DEV_SD=y +-# CONFIG_CHR_DEV_ST is not set +-# CONFIG_CHR_DEV_OSST is not set +-CONFIG_BLK_DEV_SR=y +-CONFIG_BLK_DEV_SR_VENDOR=y +-CONFIG_CHR_DEV_SG=y +-CONFIG_CHR_DEV_SCH=y +-CONFIG_SCSI_ENCLOSURE=y +-# CONFIG_SCSI_CONSTANTS is not set +-CONFIG_SCSI_LOGGING=y +-CONFIG_SCSI_SCAN_ASYNC=y +- +-# +-# SCSI Transports +-# +-# CONFIG_SCSI_SPI_ATTRS is not set +-CONFIG_SCSI_FC_ATTRS=m +-CONFIG_SCSI_ISCSI_ATTRS=m +-# CONFIG_SCSI_SAS_ATTRS is not set +-# CONFIG_SCSI_SAS_LIBSAS is not set +-# CONFIG_SCSI_SRP_ATTRS is not set +-CONFIG_SCSI_LOWLEVEL=y +-CONFIG_ISCSI_TCP=m +-CONFIG_ISCSI_BOOT_SYSFS=m +-# CONFIG_SCSI_CXGB3_ISCSI is not set +-# CONFIG_SCSI_CXGB4_ISCSI is not set +-# CONFIG_SCSI_BNX2_ISCSI is not set +-# CONFIG_SCSI_BNX2X_FCOE is not set +-# CONFIG_BE2ISCSI is not set +-# CONFIG_BLK_DEV_3W_XXXX_RAID is not set +-# CONFIG_SCSI_HPSA is not set +-# CONFIG_SCSI_3W_9XXX is not set +-# CONFIG_SCSI_3W_SAS is not set +-# CONFIG_SCSI_ACARD is not set +-# CONFIG_SCSI_AACRAID is not set +-# CONFIG_SCSI_AIC7XXX is not set +-# CONFIG_SCSI_AIC79XX is not set +-# CONFIG_SCSI_AIC94XX is not set +-# CONFIG_SCSI_MVSAS is not set +-# CONFIG_SCSI_MVUMI is not set +-# CONFIG_SCSI_ADVANSYS is not set +-# CONFIG_SCSI_ARCMSR is not set +-# CONFIG_SCSI_ESAS2R is not set +-# CONFIG_MEGARAID_NEWGEN is not set +-# CONFIG_MEGARAID_LEGACY is not set +-# CONFIG_MEGARAID_SAS is not set +-# CONFIG_SCSI_MPT3SAS is not set +-# CONFIG_SCSI_MPT2SAS is not set +-CONFIG_SCSI_UFSHCD=m +-# CONFIG_SCSI_UFSHCD_PCI is not set +-CONFIG_SCSI_UFSHCD_PLATFORM=m +-# CONFIG_SCSI_HPTIOP is not set +-CONFIG_LIBFC=m +-CONFIG_LIBFCOE=m +-# CONFIG_FCOE is not set +-# CONFIG_SCSI_SNIC is not set +-# CONFIG_SCSI_DMX3191D is not set +-# CONFIG_SCSI_FUTURE_DOMAIN is not set +-# CONFIG_SCSI_IPS is not set +-# CONFIG_SCSI_INITIO is not set +-# CONFIG_SCSI_INIA100 is not set +-# CONFIG_SCSI_STEX is not set +-# CONFIG_SCSI_SYM53C8XX_2 is not set +-# CONFIG_SCSI_IPR is not set +-# CONFIG_SCSI_QLOGIC_1280 is not set +-# CONFIG_SCSI_QLA_FC is not set +-# CONFIG_SCSI_QLA_ISCSI is not set +-# CONFIG_SCSI_LPFC is not set +-# CONFIG_SCSI_DC395x is not set +-# CONFIG_SCSI_AM53C974 is not set +-# CONFIG_SCSI_NSP32 is not set +-# CONFIG_SCSI_WD719X is not set +-# CONFIG_SCSI_DEBUG is not set +-# CONFIG_SCSI_PMCRAID is not set +-# CONFIG_SCSI_PM8001 is not set +-# CONFIG_SCSI_BFA_FC is not set +-# CONFIG_SCSI_CHELSIO_FCOE is not set +-# CONFIG_SCSI_DH is not set +-CONFIG_SCSI_OSD_INITIATOR=m +-# CONFIG_SCSI_OSD_ULD is not set +-CONFIG_SCSI_OSD_DPRINT_SENSE=1 +-# CONFIG_SCSI_OSD_DEBUG is not set +-CONFIG_ATA=y +-# CONFIG_ATA_NONSTANDARD is not set +-# CONFIG_ATA_VERBOSE_ERROR is not set +-CONFIG_SATA_PMP=y +- +-# +-# Controllers with non-SFF native interface +-# +-CONFIG_SATA_AHCI=y +-CONFIG_SATA_AHCI_PLATFORM=y +-CONFIG_AHCI_IMX=y +-# CONFIG_AHCI_CEVA is not set +-# CONFIG_AHCI_QORIQ is not set +-# CONFIG_SATA_INIC162X is not set +-# CONFIG_SATA_ACARD_AHCI is not set +-# CONFIG_SATA_SIL24 is not set +-CONFIG_ATA_SFF=y +- +-# +-# SFF controllers with custom DMA interface +-# +-# CONFIG_PDC_ADMA is not set +-# CONFIG_SATA_QSTOR is not set +-# CONFIG_SATA_SX4 is not set +-CONFIG_ATA_BMDMA=y +- +-# +-# SATA SFF controllers with BMDMA +-# +-# CONFIG_ATA_PIIX is not set +-# CONFIG_SATA_MV is not set +-# CONFIG_SATA_NV is not set +-# CONFIG_SATA_PROMISE is not set +-# CONFIG_SATA_SIL is not set +-# CONFIG_SATA_SIS is not set +-# CONFIG_SATA_SVW is not set +-# CONFIG_SATA_ULI is not set +-# CONFIG_SATA_VIA is not set +-# CONFIG_SATA_VITESSE is not set +- +-# +-# PATA SFF controllers with BMDMA +-# +-# CONFIG_PATA_ALI is not set +-# CONFIG_PATA_AMD is not set +-# CONFIG_PATA_ARTOP is not set +-# CONFIG_PATA_ATIIXP is not set +-# CONFIG_PATA_ATP867X is not set +-# CONFIG_PATA_CMD64X is not set +-# CONFIG_PATA_CYPRESS is not set +-# CONFIG_PATA_EFAR is not set +-# CONFIG_PATA_HPT366 is not set +-# CONFIG_PATA_HPT37X is not set +-# CONFIG_PATA_HPT3X2N is not set +-# CONFIG_PATA_HPT3X3 is not set +-CONFIG_PATA_IMX=y +-# CONFIG_PATA_IT8213 is not set +-# CONFIG_PATA_IT821X is not set +-# CONFIG_PATA_JMICRON is not set +-# CONFIG_PATA_MARVELL is not set +-# CONFIG_PATA_NETCELL is not set +-# CONFIG_PATA_NINJA32 is not set +-# CONFIG_PATA_NS87415 is not set +-# CONFIG_PATA_OLDPIIX is not set +-# CONFIG_PATA_OPTIDMA is not set +-# CONFIG_PATA_PDC2027X is not set +-# CONFIG_PATA_PDC_OLD is not set +-# CONFIG_PATA_RADISYS is not set +-# CONFIG_PATA_RDC is not set +-# CONFIG_PATA_SCH is not set +-# CONFIG_PATA_SERVERWORKS is not set +-# CONFIG_PATA_SIL680 is not set +-# CONFIG_PATA_SIS is not set +-# CONFIG_PATA_TOSHIBA is not set +-# CONFIG_PATA_TRIFLEX is not set +-# CONFIG_PATA_VIA is not set +-# CONFIG_PATA_WINBOND is not set +- +-# +-# PIO-only SFF controllers +-# +-# CONFIG_PATA_CMD640_PCI is not set +-# CONFIG_PATA_MPIIX is not set +-# CONFIG_PATA_NS87410 is not set +-# CONFIG_PATA_OPTI is not set +-# CONFIG_PATA_PLATFORM is not set +-# CONFIG_PATA_RZ1000 is not set +- +-# +-# Generic fallback / legacy drivers +-# +-# CONFIG_ATA_GENERIC is not set +-# CONFIG_PATA_LEGACY is not set +-CONFIG_MD=y +-CONFIG_BLK_DEV_MD=y +-CONFIG_MD_AUTODETECT=y +-CONFIG_MD_LINEAR=y +-CONFIG_MD_RAID0=y +-CONFIG_MD_RAID1=y +-CONFIG_MD_RAID10=y +-CONFIG_MD_RAID456=m +-CONFIG_MD_MULTIPATH=m +-CONFIG_MD_FAULTY=m +-# CONFIG_MD_CLUSTER is not set +-CONFIG_BCACHE=m +-# CONFIG_BCACHE_DEBUG is not set +-# CONFIG_BCACHE_CLOSURES_DEBUG is not set +-CONFIG_BLK_DEV_DM_BUILTIN=y +-CONFIG_BLK_DEV_DM=m +-# CONFIG_DM_MQ_DEFAULT is not set +-# CONFIG_DM_DEBUG is not set +-CONFIG_DM_BUFIO=m +-CONFIG_DM_BIO_PRISON=m +-CONFIG_DM_PERSISTENT_DATA=m +-# CONFIG_DM_DEBUG_BLOCK_STACK_TRACING is not set +-CONFIG_DM_CRYPT=m +-CONFIG_DM_SNAPSHOT=m +-CONFIG_DM_THIN_PROVISIONING=m +-CONFIG_DM_CACHE=m +-CONFIG_DM_CACHE_MQ=m +-CONFIG_DM_CACHE_SMQ=m +-CONFIG_DM_CACHE_CLEANER=m +-# CONFIG_DM_ERA is not set +-CONFIG_DM_MIRROR=m +-CONFIG_DM_LOG_USERSPACE=m +-CONFIG_DM_RAID=m +-CONFIG_DM_ZERO=m +-CONFIG_DM_MULTIPATH=m +-CONFIG_DM_MULTIPATH_QL=m +-CONFIG_DM_MULTIPATH_ST=m +-CONFIG_DM_DELAY=m +-CONFIG_DM_UEVENT=y +-CONFIG_DM_FLAKEY=m +-CONFIG_DM_VERITY=m +-# CONFIG_DM_SWITCH is not set +-# CONFIG_DM_LOG_WRITES is not set +-# CONFIG_TARGET_CORE is not set +-# CONFIG_FUSION is not set +- +-# +-# IEEE 1394 (FireWire) support +-# +-# CONFIG_FIREWIRE is not set +-# CONFIG_FIREWIRE_NOSY is not set +-CONFIG_NETDEVICES=y +-CONFIG_MII=y +-CONFIG_NET_CORE=y +-CONFIG_BONDING=m +-CONFIG_DUMMY=m +-# CONFIG_EQUALIZER is not set +-# CONFIG_NET_FC is not set +-# CONFIG_IFB is not set +-CONFIG_NET_TEAM=m +-CONFIG_NET_TEAM_MODE_BROADCAST=m +-CONFIG_NET_TEAM_MODE_ROUNDROBIN=m +-CONFIG_NET_TEAM_MODE_RANDOM=m +-CONFIG_NET_TEAM_MODE_ACTIVEBACKUP=m +-CONFIG_NET_TEAM_MODE_LOADBALANCE=m +-CONFIG_MACVLAN=m +-CONFIG_MACVTAP=m +-CONFIG_IPVLAN=m +-CONFIG_VXLAN=m +-# CONFIG_GENEVE is not set +-CONFIG_NETCONSOLE=m +-CONFIG_NETCONSOLE_DYNAMIC=y +-CONFIG_NETPOLL=y +-CONFIG_NET_POLL_CONTROLLER=y +-CONFIG_TUN=m +-# CONFIG_TUN_VNET_CROSS_LE is not set +-CONFIG_VETH=m +-CONFIG_NLMON=m +-# CONFIG_ARCNET is not set +- +-# +-# CAIF transport drivers +-# +-# CONFIG_CAIF_TTY is not set +-# CONFIG_CAIF_SPI_SLAVE is not set +-# CONFIG_CAIF_HSI is not set +-# CONFIG_CAIF_VIRTIO is not set +- +-# +-# Distributed Switch Architecture drivers +-# +-# CONFIG_NET_DSA_MV88E6XXX is not set +-# CONFIG_NET_DSA_MV88E6XXX_NEED_PPU is not set +-CONFIG_ETHERNET=y +-CONFIG_MDIO=y +-# CONFIG_NET_VENDOR_3COM is not set +-# CONFIG_NET_VENDOR_ADAPTEC is not set +-# CONFIG_NET_VENDOR_AGERE is not set +-# CONFIG_NET_VENDOR_ALTEON is not set +-# CONFIG_ALTERA_TSE is not set +-# CONFIG_NET_VENDOR_AMD is not set +-# CONFIG_NET_VENDOR_ARC is not set +-CONFIG_NET_VENDOR_ATHEROS=y +-CONFIG_ATL2=y +-CONFIG_ATL1=y +-CONFIG_ATL1E=y +-CONFIG_ATL1C=y +-CONFIG_ALX=y +-# CONFIG_NET_VENDOR_AURORA is not set +-# CONFIG_NET_CADENCE is not set +-# CONFIG_NET_VENDOR_BROADCOM is not set +-# CONFIG_NET_VENDOR_BROCADE is not set +-# CONFIG_NET_VENDOR_CAVIUM is not set +-# CONFIG_NET_VENDOR_CHELSIO is not set +-# CONFIG_NET_VENDOR_CIRRUS is not set +-# CONFIG_NET_VENDOR_CISCO is not set +-# CONFIG_DM9000 is not set +-# CONFIG_DNET is not set +-# CONFIG_NET_VENDOR_DEC is not set +-# CONFIG_NET_VENDOR_DLINK is not set +-# CONFIG_NET_VENDOR_EMULEX is not set +-# CONFIG_NET_VENDOR_EZCHIP is not set +-# CONFIG_NET_VENDOR_EXAR is not set +-# CONFIG_NET_VENDOR_FARADAY is not set +-CONFIG_NET_VENDOR_FREESCALE=y +-CONFIG_FEC=y +-CONFIG_FSL_PQ_MDIO=y +-CONFIG_FSL_XGMAC_MDIO=y +-CONFIG_GIANFAR=y +-# CONFIG_NET_VENDOR_HISILICON is not set +-# CONFIG_NET_VENDOR_HP is not set +-# CONFIG_NET_VENDOR_INTEL is not set +-# CONFIG_JME is not set +-# CONFIG_NET_VENDOR_MARVELL is not set +-# CONFIG_NET_VENDOR_MELLANOX is not set +-# CONFIG_NET_VENDOR_MICREL is not set +-# CONFIG_NET_VENDOR_MICROCHIP is not set +-# CONFIG_NET_VENDOR_MYRI is not set +-# CONFIG_FEALNX is not set +-# CONFIG_NET_VENDOR_NATSEMI is not set +-# CONFIG_NET_VENDOR_NVIDIA is not set +-# CONFIG_NET_VENDOR_OKI is not set +-# CONFIG_ETHOC is not set +-# CONFIG_NET_PACKET_ENGINE is not set +-# CONFIG_NET_VENDOR_QLOGIC is not set +-# CONFIG_NET_VENDOR_QUALCOMM is not set +-# CONFIG_NET_VENDOR_REALTEK is not set +-# CONFIG_NET_VENDOR_RENESAS is not set +-# CONFIG_NET_VENDOR_RDC is not set +-# CONFIG_NET_VENDOR_ROCKER is not set +-# CONFIG_NET_VENDOR_SAMSUNG is not set +-# CONFIG_NET_VENDOR_SEEQ is not set +-# CONFIG_NET_VENDOR_SILAN is not set +-# CONFIG_NET_VENDOR_SIS is not set +-# CONFIG_SFC is not set +-# CONFIG_NET_VENDOR_SMSC is not set +-# CONFIG_NET_VENDOR_STMICRO is not set +-# CONFIG_NET_VENDOR_SUN is not set +-# CONFIG_NET_VENDOR_SYNOPSYS is not set +-# CONFIG_NET_VENDOR_TEHUTI is not set +-# CONFIG_NET_VENDOR_TI is not set +-# CONFIG_NET_VENDOR_VIA is not set +-# CONFIG_NET_VENDOR_WIZNET is not set +-# CONFIG_FDDI is not set +-# CONFIG_HIPPI is not set +-CONFIG_PHYLIB=y +- +-# +-# MII PHY device drivers +-# +-# CONFIG_AQUANTIA_PHY is not set +-CONFIG_AT803X_PHY=y +-# CONFIG_AMD_PHY is not set +-# CONFIG_MARVELL_PHY is not set +-# CONFIG_DAVICOM_PHY is not set +-# CONFIG_QSEMI_PHY is not set +-# CONFIG_LXT_PHY is not set +-# CONFIG_CICADA_PHY is not set +-# CONFIG_VITESSE_PHY is not set +-# CONFIG_TERANETICS_PHY is not set +-# CONFIG_SMSC_PHY is not set +-# CONFIG_BROADCOM_PHY is not set +-# CONFIG_BCM7XXX_PHY is not set +-# CONFIG_BCM87XX_PHY is not set +-# CONFIG_ICPLUS_PHY is not set +-# CONFIG_REALTEK_PHY is not set +-# CONFIG_NATIONAL_PHY is not set +-# CONFIG_STE10XP is not set +-# CONFIG_LSI_ET1011C_PHY is not set +-# CONFIG_MICREL_PHY is not set +-# CONFIG_DP83848_PHY is not set +-# CONFIG_DP83867_PHY is not set +-CONFIG_MICROCHIP_PHY=m +-CONFIG_FIXED_PHY=y +-CONFIG_MDIO_BITBANG=y +-CONFIG_MDIO_GPIO=y +-CONFIG_MDIO_BUS_MUX=y +-CONFIG_MDIO_BUS_MUX_GPIO=y +-CONFIG_MDIO_BUS_MUX_MMIOREG=y +-CONFIG_MDIO_BCM_UNIMAC=y +-# CONFIG_MICREL_KS8995MA is not set +-CONFIG_PPP=m +-CONFIG_PPP_BSDCOMP=m +-CONFIG_PPP_DEFLATE=m +-CONFIG_PPP_FILTER=y +-CONFIG_PPP_MPPE=m +-CONFIG_PPP_MULTILINK=y +-CONFIG_PPPOE=m +-CONFIG_PPTP=m +-CONFIG_PPPOL2TP=m +-CONFIG_PPP_ASYNC=m +-CONFIG_PPP_SYNC_TTY=m +-CONFIG_SLIP=m +-CONFIG_SLHC=m +-CONFIG_SLIP_COMPRESSED=y +-CONFIG_SLIP_SMART=y +-CONFIG_SLIP_MODE_SLIP6=y +-CONFIG_USB_NET_DRIVERS=y +-CONFIG_USB_CATC=m +-CONFIG_USB_KAWETH=m +-CONFIG_USB_PEGASUS=m +-CONFIG_USB_RTL8150=m +-CONFIG_USB_RTL8152=m +-CONFIG_USB_LAN78XX=m +-CONFIG_USB_USBNET=m +-CONFIG_USB_NET_AX8817X=m +-CONFIG_USB_NET_AX88179_178A=m +-CONFIG_USB_NET_CDCETHER=m +-CONFIG_USB_NET_CDC_EEM=m +-CONFIG_USB_NET_CDC_NCM=m +-CONFIG_USB_NET_HUAWEI_CDC_NCM=m +-CONFIG_USB_NET_CDC_MBIM=m +-CONFIG_USB_NET_DM9601=m +-CONFIG_USB_NET_SR9700=m +-CONFIG_USB_NET_SR9800=m +-CONFIG_USB_NET_SMSC75XX=m +-CONFIG_USB_NET_SMSC95XX=m +-CONFIG_USB_NET_GL620A=m +-CONFIG_USB_NET_NET1080=m +-CONFIG_USB_NET_PLUSB=m +-CONFIG_USB_NET_MCS7830=m +-CONFIG_USB_NET_RNDIS_HOST=m +-CONFIG_USB_NET_CDC_SUBSET=m +-CONFIG_USB_ALI_M5632=y +-CONFIG_USB_AN2720=y +-CONFIG_USB_BELKIN=y +-CONFIG_USB_ARMLINUX=y +-CONFIG_USB_EPSON2888=y +-CONFIG_USB_KC2190=y +-CONFIG_USB_NET_ZAURUS=m +-CONFIG_USB_NET_CX82310_ETH=m +-CONFIG_USB_NET_KALMIA=m +-CONFIG_USB_NET_QMI_WWAN=m +-CONFIG_USB_HSO=m +-CONFIG_USB_NET_INT51X1=m +-CONFIG_USB_IPHETH=m +-CONFIG_USB_SIERRA_NET=m +-CONFIG_USB_VL600=m +-CONFIG_USB_NET_CH9200=m +-CONFIG_WLAN=y +-CONFIG_LIBERTAS_THINFIRM=m +-# CONFIG_LIBERTAS_THINFIRM_DEBUG is not set +-CONFIG_LIBERTAS_THINFIRM_USB=m +-CONFIG_ATMEL=m +-CONFIG_PCI_ATMEL=m +-CONFIG_AT76C50X_USB=m +-CONFIG_PRISM54=m +-CONFIG_USB_ZD1201=m +-CONFIG_USB_NET_RNDIS_WLAN=m +-CONFIG_ADM8211=m +-CONFIG_RTL8180=m +-CONFIG_RTL8187=m +-CONFIG_RTL8187_LEDS=y +-CONFIG_MAC80211_HWSIM=m +-CONFIG_MWL8K=m +-CONFIG_ATH_COMMON=m +-CONFIG_ATH_CARDS=m +-# CONFIG_ATH_DEBUG is not set +-CONFIG_ATH5K=m +-# CONFIG_ATH5K_DEBUG is not set +-# CONFIG_ATH5K_TRACER is not set +-CONFIG_ATH5K_PCI=y +-CONFIG_ATH9K_HW=m +-CONFIG_ATH9K_COMMON=m +-CONFIG_ATH9K_BTCOEX_SUPPORT=y +-CONFIG_ATH9K=m +-CONFIG_ATH9K_PCI=y +-CONFIG_ATH9K_AHB=y +-# CONFIG_ATH9K_DEBUGFS is not set +-# CONFIG_ATH9K_DYNACK is not set +-CONFIG_ATH9K_WOW=y +-CONFIG_ATH9K_RFKILL=y +-CONFIG_ATH9K_CHANNEL_CONTEXT=y +-CONFIG_ATH9K_PCOEM=y +-CONFIG_ATH9K_HTC=m +-# CONFIG_ATH9K_HTC_DEBUGFS is not set +-CONFIG_CARL9170=m +-CONFIG_CARL9170_LEDS=y +-CONFIG_CARL9170_WPC=y +-CONFIG_CARL9170_HWRNG=y +-CONFIG_ATH6KL=m +-CONFIG_ATH6KL_SDIO=m +-CONFIG_ATH6KL_USB=m +-# CONFIG_ATH6KL_DEBUG is not set +-# CONFIG_ATH6KL_TRACING is not set +-CONFIG_AR5523=m +-CONFIG_WIL6210=m +-CONFIG_WIL6210_ISR_COR=y +-CONFIG_WIL6210_TRACING=y +-CONFIG_ATH10K=m +-CONFIG_ATH10K_PCI=m +-# CONFIG_ATH10K_DEBUG is not set +-# CONFIG_ATH10K_DEBUGFS is not set +-# CONFIG_ATH10K_TRACING is not set +-CONFIG_WCN36XX=m +-# CONFIG_WCN36XX_DEBUGFS is not set +-CONFIG_B43=m +-CONFIG_B43_BCMA=y +-CONFIG_B43_SSB=y +-CONFIG_B43_BUSES_BCMA_AND_SSB=y +-# CONFIG_B43_BUSES_BCMA is not set +-# CONFIG_B43_BUSES_SSB is not set +-CONFIG_B43_PCI_AUTOSELECT=y +-CONFIG_B43_PCICORE_AUTOSELECT=y +-CONFIG_B43_SDIO=y +-CONFIG_B43_BCMA_PIO=y +-CONFIG_B43_PIO=y +-CONFIG_B43_PHY_G=y +-CONFIG_B43_PHY_N=y +-CONFIG_B43_PHY_LP=y +-CONFIG_B43_PHY_HT=y +-CONFIG_B43_LEDS=y +-CONFIG_B43_HWRNG=y +-# CONFIG_B43_DEBUG is not set +-CONFIG_B43LEGACY=m +-CONFIG_B43LEGACY_PCI_AUTOSELECT=y +-CONFIG_B43LEGACY_PCICORE_AUTOSELECT=y +-CONFIG_B43LEGACY_LEDS=y +-CONFIG_B43LEGACY_HWRNG=y +-# CONFIG_B43LEGACY_DEBUG is not set +-CONFIG_B43LEGACY_DMA=y +-CONFIG_B43LEGACY_PIO=y +-CONFIG_B43LEGACY_DMA_AND_PIO_MODE=y +-# CONFIG_B43LEGACY_DMA_MODE is not set +-# CONFIG_B43LEGACY_PIO_MODE is not set +-CONFIG_BRCMUTIL=m +-CONFIG_BRCMSMAC=m +-CONFIG_BRCMFMAC=m +-CONFIG_BRCMFMAC_PROTO_BCDC=y +-CONFIG_BRCMFMAC_PROTO_MSGBUF=y +-CONFIG_BRCMFMAC_SDIO=y +-CONFIG_BRCMFMAC_USB=y +-CONFIG_BRCMFMAC_PCIE=y +-# CONFIG_BRCM_TRACING is not set +-# CONFIG_BRCMDBG is not set +-CONFIG_HOSTAP=m +-CONFIG_HOSTAP_FIRMWARE=y +-CONFIG_HOSTAP_FIRMWARE_NVRAM=y +-CONFIG_HOSTAP_PLX=m +-CONFIG_HOSTAP_PCI=m +-CONFIG_IPW2100=m +-CONFIG_IPW2100_MONITOR=y +-# CONFIG_IPW2100_DEBUG is not set +-CONFIG_IPW2200=m +-CONFIG_IPW2200_MONITOR=y +-CONFIG_IPW2200_RADIOTAP=y +-CONFIG_IPW2200_PROMISCUOUS=y +-CONFIG_IPW2200_QOS=y +-CONFIG_IPW2200_DEBUG=y +-CONFIG_LIBIPW=m +-# CONFIG_LIBIPW_DEBUG is not set +-CONFIG_IWLWIFI=m +-CONFIG_IWLWIFI_LEDS=y +-CONFIG_IWLDVM=m +-CONFIG_IWLMVM=m +-CONFIG_IWLWIFI_OPMODE_MODULAR=y +-CONFIG_IWLWIFI_BCAST_FILTERING=y +-CONFIG_IWLWIFI_UAPSD=y +- +-# +-# Debugging Options +-# +-# CONFIG_IWLWIFI_DEBUG is not set +-CONFIG_IWLWIFI_DEVICE_TRACING=y +-CONFIG_IWLEGACY=m +-CONFIG_IWL4965=m +-CONFIG_IWL3945=m +- +-# +-# iwl3945 / iwl4965 Debugging Options +-# +-# CONFIG_IWLEGACY_DEBUG is not set +-CONFIG_LIBERTAS=m +-CONFIG_LIBERTAS_USB=m +-CONFIG_LIBERTAS_SDIO=m +-CONFIG_LIBERTAS_SPI=m +-# CONFIG_LIBERTAS_DEBUG is not set +-CONFIG_LIBERTAS_MESH=y +-CONFIG_HERMES=m +-CONFIG_HERMES_PRISM=y +-CONFIG_HERMES_CACHE_FW_ON_INIT=y +-CONFIG_PLX_HERMES=m +-CONFIG_TMD_HERMES=m +-CONFIG_NORTEL_HERMES=m +-CONFIG_PCI_HERMES=m +-CONFIG_ORINOCO_USB=m +-CONFIG_P54_COMMON=m +-CONFIG_P54_USB=m +-CONFIG_P54_PCI=m +-CONFIG_P54_SPI=m +-CONFIG_P54_SPI_DEFAULT_EEPROM=y +-CONFIG_P54_LEDS=y +-CONFIG_RT2X00=m +-CONFIG_RT2400PCI=m +-CONFIG_RT2500PCI=m +-CONFIG_RT61PCI=m +-CONFIG_RT2800PCI=m +-CONFIG_RT2800PCI_RT33XX=y +-CONFIG_RT2800PCI_RT35XX=y +-CONFIG_RT2800PCI_RT53XX=y +-CONFIG_RT2800PCI_RT3290=y +-CONFIG_RT2500USB=m +-CONFIG_RT73USB=m +-CONFIG_RT2800USB=m +-CONFIG_RT2800USB_RT33XX=y +-CONFIG_RT2800USB_RT35XX=y +-CONFIG_RT2800USB_RT3573=y +-CONFIG_RT2800USB_RT53XX=y +-CONFIG_RT2800USB_RT55XX=y +-CONFIG_RT2800USB_UNKNOWN=y +-CONFIG_RT2800_LIB=m +-CONFIG_RT2800_LIB_MMIO=m +-CONFIG_RT2X00_LIB_MMIO=m +-CONFIG_RT2X00_LIB_PCI=m +-CONFIG_RT2X00_LIB_USB=m +-CONFIG_RT2X00_LIB=m +-CONFIG_RT2X00_LIB_FIRMWARE=y +-CONFIG_RT2X00_LIB_CRYPTO=y +-CONFIG_RT2X00_LIB_LEDS=y +-# CONFIG_RT2X00_DEBUG is not set +-CONFIG_WL_MEDIATEK=y +-CONFIG_MT7601U=m +-CONFIG_RTL_CARDS=m +-CONFIG_RTL8192CE=m +-CONFIG_RTL8192SE=m +-CONFIG_RTL8192DE=m +-CONFIG_RTL8723AE=m +-CONFIG_RTL8723BE=m +-CONFIG_RTL8188EE=m +-CONFIG_RTL8192EE=m +-CONFIG_RTL8821AE=m +-CONFIG_RTL8192CU=m +-CONFIG_RTLWIFI=m +-CONFIG_RTLWIFI_PCI=m +-CONFIG_RTLWIFI_USB=m +-CONFIG_RTLWIFI_DEBUG=y +-CONFIG_RTL8192C_COMMON=m +-CONFIG_RTL8723_COMMON=m +-CONFIG_RTLBTCOEXIST=m +-# CONFIG_RTL8XXXU is not set +-CONFIG_WL_TI=y +-CONFIG_WL1251=m +-CONFIG_WL1251_SPI=m +-CONFIG_WL1251_SDIO=m +-CONFIG_WL12XX=m +-CONFIG_WL18XX=m +-CONFIG_WLCORE=m +-CONFIG_WLCORE_SPI=m +-CONFIG_WLCORE_SDIO=m +-CONFIG_WILINK_PLATFORM_DATA=y +-CONFIG_ZD1211RW=m +-# CONFIG_ZD1211RW_DEBUG is not set +-CONFIG_MWIFIEX=m +-CONFIG_MWIFIEX_SDIO=m +-CONFIG_MWIFIEX_PCIE=m +-CONFIG_MWIFIEX_USB=m +-CONFIG_CW1200=m +-CONFIG_CW1200_WLAN_SDIO=m +-CONFIG_CW1200_WLAN_SPI=m +-CONFIG_RSI_91X=m +-CONFIG_RSI_DEBUGFS=y +-CONFIG_RSI_SDIO=m +-CONFIG_RSI_USB=m +- +-# +-# Enable WiMAX (Networking options) to see the WiMAX drivers +-# +-CONFIG_WAN=y +-CONFIG_HDLC=m +-CONFIG_HDLC_RAW=m +-CONFIG_HDLC_RAW_ETH=m +-CONFIG_HDLC_CISCO=m +-CONFIG_HDLC_FR=m +-CONFIG_HDLC_PPP=m +- +-# +-# X.25/LAPB support is disabled +-# +-# CONFIG_PCI200SYN is not set +-CONFIG_WANXL=m +-# CONFIG_WANXL_BUILD_FIRMWARE is not set +-CONFIG_PC300TOO=m +-CONFIG_FARSYNC=m +-CONFIG_DSCC4=m +-# CONFIG_DSCC4_PCISYNC is not set +-# CONFIG_DSCC4_PCI_RST is not set +-# CONFIG_DLCI is not set +-# CONFIG_VMXNET3 is not set +-CONFIG_ISDN=y +-CONFIG_ISDN_I4L=m +-# CONFIG_ISDN_PPP is not set +-# CONFIG_ISDN_AUDIO is not set +- +-# +-# ISDN feature submodules +-# +-# CONFIG_ISDN_DIVERSION is not set +- +-# +-# ISDN4Linux hardware drivers +-# +- +-# +-# Passive cards +-# +-# CONFIG_ISDN_DRV_HISAX is not set +- +-# +-# Active cards +-# +-CONFIG_ISDN_CAPI=m +-CONFIG_CAPI_TRACE=y +-# CONFIG_ISDN_CAPI_CAPI20 is not set +-# CONFIG_ISDN_CAPI_CAPIDRV is not set +- +-# +-# CAPI hardware drivers +-# +-# CONFIG_CAPI_AVM is not set +-# CONFIG_CAPI_EICON is not set +-CONFIG_ISDN_DRV_GIGASET=m +-CONFIG_GIGASET_CAPI=y +-# CONFIG_GIGASET_I4L is not set +-# CONFIG_GIGASET_DUMMYLL is not set +-# CONFIG_GIGASET_BASE is not set +-# CONFIG_GIGASET_M105 is not set +-# CONFIG_GIGASET_M101 is not set +-# CONFIG_GIGASET_DEBUG is not set +-CONFIG_HYSDN=m +-CONFIG_HYSDN_CAPI=y +-CONFIG_MISDN=m +-CONFIG_MISDN_DSP=m +-CONFIG_MISDN_L1OIP=m +- +-# +-# mISDN hardware drivers +-# +-CONFIG_MISDN_HFCPCI=m +-CONFIG_MISDN_HFCMULTI=m +-CONFIG_MISDN_HFCUSB=m +-CONFIG_MISDN_AVMFRITZ=m +-CONFIG_MISDN_SPEEDFAX=m +-CONFIG_MISDN_INFINEON=m +-CONFIG_MISDN_W6692=m +-CONFIG_MISDN_NETJET=m +-CONFIG_MISDN_IPAC=m +-CONFIG_MISDN_ISAR=m +-CONFIG_ISDN_HDLC=m +-# CONFIG_NVM is not set +- +-# +-# Input device support +-# +-CONFIG_INPUT=y +-CONFIG_INPUT_LEDS=m +-CONFIG_INPUT_FF_MEMLESS=m +-CONFIG_INPUT_POLLDEV=y +-CONFIG_INPUT_SPARSEKMAP=m +-CONFIG_INPUT_MATRIXKMAP=y +- +-# +-# Userland interfaces +-# +-CONFIG_INPUT_MOUSEDEV=m +-# CONFIG_INPUT_MOUSEDEV_PSAUX is not set +-CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 +-CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 +-CONFIG_INPUT_JOYDEV=m +-CONFIG_INPUT_EVDEV=y +-CONFIG_INPUT_EVBUG=m +- +-# +-# Input Device Drivers +-# +-CONFIG_INPUT_KEYBOARD=y +-# CONFIG_KEYBOARD_ADP5588 is not set +-# CONFIG_KEYBOARD_ADP5589 is not set +-# CONFIG_KEYBOARD_ATKBD is not set +-# CONFIG_KEYBOARD_QT1070 is not set +-# CONFIG_KEYBOARD_QT2160 is not set +-# CONFIG_KEYBOARD_LKKBD is not set +-CONFIG_KEYBOARD_GPIO=y +-CONFIG_KEYBOARD_GPIO_POLLED=y +-CONFIG_KEYBOARD_TCA6416=m +-CONFIG_KEYBOARD_TCA8418=m +-CONFIG_KEYBOARD_MATRIX=m +-# CONFIG_KEYBOARD_LM8323 is not set +-# CONFIG_KEYBOARD_LM8333 is not set +-# CONFIG_KEYBOARD_MAX7359 is not set +-# CONFIG_KEYBOARD_MCS is not set +-# CONFIG_KEYBOARD_MPR121 is not set +-CONFIG_KEYBOARD_IMX=y +-# CONFIG_KEYBOARD_NEWTON is not set +-# CONFIG_KEYBOARD_OPENCORES is not set +-# CONFIG_KEYBOARD_SAMSUNG is not set +-# CONFIG_KEYBOARD_STOWAWAY is not set +-# CONFIG_KEYBOARD_SUNKBD is not set +-# CONFIG_KEYBOARD_OMAP4 is not set +-CONFIG_KEYBOARD_XTKBD=m +-# CONFIG_KEYBOARD_CAP11XX is not set +-# CONFIG_KEYBOARD_BCM is not set +-CONFIG_INPUT_MOUSE=y +-CONFIG_MOUSE_PS2=m +-CONFIG_MOUSE_PS2_ALPS=y +-CONFIG_MOUSE_PS2_LOGIPS2PP=y +-CONFIG_MOUSE_PS2_SYNAPTICS=y +-CONFIG_MOUSE_PS2_CYPRESS=y +-CONFIG_MOUSE_PS2_TRACKPOINT=y +-CONFIG_MOUSE_PS2_ELANTECH=y +-# CONFIG_MOUSE_PS2_SENTELIC is not set +-# CONFIG_MOUSE_PS2_TOUCHKIT is not set +-CONFIG_MOUSE_PS2_FOCALTECH=y +-CONFIG_MOUSE_SERIAL=m +-CONFIG_MOUSE_APPLETOUCH=m +-CONFIG_MOUSE_BCM5974=m +-CONFIG_MOUSE_CYAPA=m +-CONFIG_MOUSE_ELAN_I2C=m +-CONFIG_MOUSE_ELAN_I2C_I2C=y +-# CONFIG_MOUSE_ELAN_I2C_SMBUS is not set +-CONFIG_MOUSE_VSXXXAA=m +-CONFIG_MOUSE_GPIO=m +-CONFIG_MOUSE_SYNAPTICS_I2C=m +-CONFIG_MOUSE_SYNAPTICS_USB=m +-CONFIG_INPUT_JOYSTICK=y +-CONFIG_JOYSTICK_ANALOG=m +-CONFIG_JOYSTICK_A3D=m +-CONFIG_JOYSTICK_ADI=m +-CONFIG_JOYSTICK_COBRA=m +-CONFIG_JOYSTICK_GF2K=m +-CONFIG_JOYSTICK_GRIP=m +-CONFIG_JOYSTICK_GRIP_MP=m +-CONFIG_JOYSTICK_GUILLEMOT=m +-CONFIG_JOYSTICK_INTERACT=m +-CONFIG_JOYSTICK_SIDEWINDER=m +-CONFIG_JOYSTICK_TMDC=m +-CONFIG_JOYSTICK_IFORCE=m +-CONFIG_JOYSTICK_IFORCE_USB=y +-CONFIG_JOYSTICK_IFORCE_232=y +-CONFIG_JOYSTICK_WARRIOR=m +-CONFIG_JOYSTICK_MAGELLAN=m +-CONFIG_JOYSTICK_SPACEORB=m +-CONFIG_JOYSTICK_SPACEBALL=m +-CONFIG_JOYSTICK_STINGER=m +-CONFIG_JOYSTICK_TWIDJOY=m +-CONFIG_JOYSTICK_ZHENHUA=m +-CONFIG_JOYSTICK_AS5011=m +-CONFIG_JOYSTICK_JOYDUMP=m +-CONFIG_JOYSTICK_XPAD=m +-CONFIG_JOYSTICK_XPAD_FF=y +-CONFIG_JOYSTICK_XPAD_LEDS=y +-# CONFIG_INPUT_TABLET is not set +-CONFIG_INPUT_TOUCHSCREEN=y +-CONFIG_TOUCHSCREEN_PROPERTIES=y +-CONFIG_TOUCHSCREEN_ADS7846=m +-CONFIG_TOUCHSCREEN_AD7877=m +-CONFIG_TOUCHSCREEN_AD7879=m +-CONFIG_TOUCHSCREEN_AD7879_I2C=m +-CONFIG_TOUCHSCREEN_AD7879_SPI=m +-CONFIG_TOUCHSCREEN_AR1021_I2C=m +-CONFIG_TOUCHSCREEN_ATMEL_MXT=m +-CONFIG_TOUCHSCREEN_AUO_PIXCIR=m +-CONFIG_TOUCHSCREEN_BU21013=m +-CONFIG_TOUCHSCREEN_CHIPONE_ICN8318=m +-CONFIG_TOUCHSCREEN_CY8CTMG110=m +-CONFIG_TOUCHSCREEN_CYTTSP_CORE=m +-CONFIG_TOUCHSCREEN_CYTTSP_I2C=m +-CONFIG_TOUCHSCREEN_CYTTSP_SPI=m +-CONFIG_TOUCHSCREEN_CYTTSP4_CORE=m +-CONFIG_TOUCHSCREEN_CYTTSP4_I2C=m +-CONFIG_TOUCHSCREEN_CYTTSP4_SPI=m +-CONFIG_TOUCHSCREEN_DA9052=m +-CONFIG_TOUCHSCREEN_DYNAPRO=m +-CONFIG_TOUCHSCREEN_HAMPSHIRE=m +-CONFIG_TOUCHSCREEN_EETI=m +-CONFIG_TOUCHSCREEN_EGALAX=m +-CONFIG_TOUCHSCREEN_FT6236=m +-CONFIG_TOUCHSCREEN_FUJITSU=m +-CONFIG_TOUCHSCREEN_GOODIX=m +-CONFIG_TOUCHSCREEN_ILI210X=m +-CONFIG_TOUCHSCREEN_GUNZE=m +-CONFIG_TOUCHSCREEN_ELAN=m +-CONFIG_TOUCHSCREEN_ELO=m +-CONFIG_TOUCHSCREEN_WACOM_W8001=m +-CONFIG_TOUCHSCREEN_WACOM_I2C=m +-CONFIG_TOUCHSCREEN_MAX11801=m +-CONFIG_TOUCHSCREEN_MCS5000=m +-CONFIG_TOUCHSCREEN_MMS114=m +-CONFIG_TOUCHSCREEN_MTOUCH=m +-CONFIG_TOUCHSCREEN_IMX6UL_TSC=m +-CONFIG_TOUCHSCREEN_INEXIO=m +-CONFIG_TOUCHSCREEN_MK712=m +-CONFIG_TOUCHSCREEN_PENMOUNT=m +-CONFIG_TOUCHSCREEN_EDT_FT5X06=m +-CONFIG_TOUCHSCREEN_TOUCHRIGHT=m +-CONFIG_TOUCHSCREEN_TOUCHWIN=m +-CONFIG_TOUCHSCREEN_PIXCIR=m +-CONFIG_TOUCHSCREEN_WDT87XX_I2C=m +-CONFIG_TOUCHSCREEN_WM97XX=m +-CONFIG_TOUCHSCREEN_WM9705=y +-CONFIG_TOUCHSCREEN_WM9712=y +-CONFIG_TOUCHSCREEN_WM9713=y +-CONFIG_TOUCHSCREEN_USB_COMPOSITE=m +-CONFIG_TOUCHSCREEN_MC13783=m +-CONFIG_TOUCHSCREEN_USB_EGALAX=y +-CONFIG_TOUCHSCREEN_USB_PANJIT=y +-CONFIG_TOUCHSCREEN_USB_3M=y +-CONFIG_TOUCHSCREEN_USB_ITM=y +-CONFIG_TOUCHSCREEN_USB_ETURBO=y +-CONFIG_TOUCHSCREEN_USB_GUNZE=y +-CONFIG_TOUCHSCREEN_USB_DMC_TSC10=y +-CONFIG_TOUCHSCREEN_USB_IRTOUCH=y +-CONFIG_TOUCHSCREEN_USB_IDEALTEK=y +-CONFIG_TOUCHSCREEN_USB_GENERAL_TOUCH=y +-CONFIG_TOUCHSCREEN_USB_GOTOP=y +-CONFIG_TOUCHSCREEN_USB_JASTEC=y +-CONFIG_TOUCHSCREEN_USB_ELO=y +-CONFIG_TOUCHSCREEN_USB_E2I=y +-CONFIG_TOUCHSCREEN_USB_ZYTRONIC=y +-CONFIG_TOUCHSCREEN_USB_ETT_TC45USB=y +-CONFIG_TOUCHSCREEN_USB_NEXIO=y +-CONFIG_TOUCHSCREEN_USB_EASYTOUCH=y +-CONFIG_TOUCHSCREEN_TOUCHIT213=m +-CONFIG_TOUCHSCREEN_TSC_SERIO=m +-CONFIG_TOUCHSCREEN_TSC200X_CORE=m +-CONFIG_TOUCHSCREEN_TSC2004=m +-CONFIG_TOUCHSCREEN_TSC2005=m +-CONFIG_TOUCHSCREEN_TSC2007=m +-CONFIG_TOUCHSCREEN_ST1232=m +-CONFIG_TOUCHSCREEN_SUR40=m +-CONFIG_TOUCHSCREEN_SX8654=m +-CONFIG_TOUCHSCREEN_TPS6507X=m +-CONFIG_TOUCHSCREEN_ZFORCE=m +-CONFIG_TOUCHSCREEN_ROHM_BU21023=m +-CONFIG_INPUT_MISC=y +-CONFIG_INPUT_AD714X=m +-CONFIG_INPUT_AD714X_I2C=m +-CONFIG_INPUT_AD714X_SPI=m +-CONFIG_INPUT_BMA150=m +-CONFIG_INPUT_E3X0_BUTTON=m +-CONFIG_INPUT_MC13783_PWRBUTTON=m +-CONFIG_INPUT_MMA8450=y +-CONFIG_INPUT_MPU3050=m +-CONFIG_INPUT_GP2A=m +-CONFIG_INPUT_GPIO_BEEPER=m +-CONFIG_INPUT_GPIO_TILT_POLLED=m +-CONFIG_INPUT_ATI_REMOTE2=m +-CONFIG_INPUT_KEYSPAN_REMOTE=m +-CONFIG_INPUT_KXTJ9=m +-CONFIG_INPUT_KXTJ9_POLLED_MODE=y +-CONFIG_INPUT_POWERMATE=m +-CONFIG_INPUT_YEALINK=m +-CONFIG_INPUT_CM109=m +-CONFIG_INPUT_REGULATOR_HAPTIC=m +-CONFIG_INPUT_UINPUT=m +-CONFIG_INPUT_PCF8574=m +-CONFIG_INPUT_PWM_BEEPER=m +-CONFIG_INPUT_GPIO_ROTARY_ENCODER=m +-CONFIG_INPUT_DA9052_ONKEY=m +-CONFIG_INPUT_ADXL34X=m +-CONFIG_INPUT_ADXL34X_I2C=m +-CONFIG_INPUT_ADXL34X_SPI=m +-CONFIG_INPUT_IMS_PCU=m +-CONFIG_INPUT_CMA3000=m +-CONFIG_INPUT_CMA3000_I2C=m +-CONFIG_INPUT_SOC_BUTTON_ARRAY=m +-CONFIG_INPUT_DRV260X_HAPTICS=m +-CONFIG_INPUT_DRV2665_HAPTICS=m +-CONFIG_INPUT_DRV2667_HAPTICS=m +- +-# +-# Hardware I/O ports +-# +-CONFIG_SERIO=m +-CONFIG_SERIO_SERPORT=m +-# CONFIG_SERIO_PCIPS2 is not set +-CONFIG_SERIO_LIBPS2=m +-CONFIG_SERIO_RAW=m +-CONFIG_SERIO_ALTERA_PS2=m +-# CONFIG_SERIO_PS2MULT is not set +-# CONFIG_SERIO_ARC_PS2 is not set +-# CONFIG_SERIO_APBPS2 is not set +-# CONFIG_USERIO is not set +-CONFIG_GAMEPORT=m +-# CONFIG_GAMEPORT_NS558 is not set +-# CONFIG_GAMEPORT_L4 is not set +-# CONFIG_GAMEPORT_EMU10K1 is not set +-# CONFIG_GAMEPORT_FM801 is not set +- +-# +-# Character devices +-# +-CONFIG_TTY=y +-CONFIG_VT=y +-CONFIG_CONSOLE_TRANSLATIONS=y +-CONFIG_VT_CONSOLE=y +-CONFIG_VT_CONSOLE_SLEEP=y +-CONFIG_HW_CONSOLE=y +-CONFIG_VT_HW_CONSOLE_BINDING=y +-CONFIG_UNIX98_PTYS=y +-CONFIG_DEVPTS_MULTIPLE_INSTANCES=y +-CONFIG_LEGACY_PTYS=y +-CONFIG_LEGACY_PTY_COUNT=256 +-# CONFIG_SERIAL_NONSTANDARD is not set +-# CONFIG_NOZOMI is not set +-# CONFIG_N_GSM is not set +-# CONFIG_TRACE_SINK is not set +-CONFIG_DEVMEM=y +-# CONFIG_DEVKMEM is not set +- +-# +-# Serial drivers +-# +-CONFIG_SERIAL_EARLYCON=y +-CONFIG_SERIAL_8250=m +-CONFIG_SERIAL_8250_DEPRECATED_OPTIONS=y +-CONFIG_SERIAL_8250_DMA=y +-CONFIG_SERIAL_8250_PCI=m +-CONFIG_SERIAL_8250_NR_UARTS=4 +-CONFIG_SERIAL_8250_RUNTIME_UARTS=4 +-# CONFIG_SERIAL_8250_EXTENDED is not set +-CONFIG_SERIAL_8250_DW=m +-# CONFIG_SERIAL_8250_EM is not set +-# CONFIG_SERIAL_8250_RT288X is not set +-# CONFIG_SERIAL_8250_MID is not set +- +-# +-# Non-8250 serial port support +-# +-CONFIG_SERIAL_EARLYCON_ARM_SEMIHOST=y +-CONFIG_SERIAL_MAX3100=m +-CONFIG_SERIAL_MAX310X=m +-CONFIG_SERIAL_IMX=y +-CONFIG_SERIAL_IMX_CONSOLE=y +-# CONFIG_SERIAL_UARTLITE is not set +-CONFIG_SERIAL_CORE=y +-CONFIG_SERIAL_CORE_CONSOLE=y +-# CONFIG_SERIAL_JSM is not set +-# CONFIG_SERIAL_OF_PLATFORM is not set +-# CONFIG_SERIAL_SCCNXP is not set +-# CONFIG_SERIAL_SC16IS7XX is not set +-CONFIG_SERIAL_BCM63XX=y +-CONFIG_SERIAL_BCM63XX_CONSOLE=y +-# CONFIG_SERIAL_ALTERA_JTAGUART is not set +-# CONFIG_SERIAL_ALTERA_UART is not set +-# CONFIG_SERIAL_IFX6X60 is not set +-# CONFIG_SERIAL_XILINX_PS_UART is not set +-CONFIG_SERIAL_ARC=y +-CONFIG_SERIAL_ARC_CONSOLE=y +-CONFIG_SERIAL_ARC_NR_PORTS=1 +-# CONFIG_SERIAL_RP2 is not set +-CONFIG_SERIAL_FSL_LPUART=y +-CONFIG_SERIAL_FSL_LPUART_CONSOLE=y +-# CONFIG_SERIAL_CONEXANT_DIGICOLOR is not set +-# CONFIG_SERIAL_ST_ASC is not set +-# CONFIG_SERIAL_STM32 is not set +-CONFIG_TTY_PRINTK=m +-CONFIG_HVC_DRIVER=y +-CONFIG_HVC_DCC=y +-# CONFIG_IPMI_HANDLER is not set +-CONFIG_HW_RANDOM=y +-CONFIG_HW_RANDOM_TIMERIOMEM=m +-# CONFIG_NVRAM is not set +-# CONFIG_R3964 is not set +-# CONFIG_APPLICOM is not set +-CONFIG_RAW_DRIVER=m +-CONFIG_MAX_RAW_DEVS=256 +-# CONFIG_TCG_TPM is not set +-CONFIG_DEVPORT=y +-# CONFIG_XILLYBUS is not set +- +-# +-# I2C support +-# +-CONFIG_I2C=y +-CONFIG_I2C_BOARDINFO=y +-CONFIG_I2C_COMPAT=y +-CONFIG_I2C_CHARDEV=y +-CONFIG_I2C_MUX=y +- +-# +-# Multiplexer I2C Chip support +-# +-CONFIG_I2C_ARB_GPIO_CHALLENGE=y +-CONFIG_I2C_MUX_GPIO=y +-CONFIG_I2C_MUX_PCA9541=y +-CONFIG_I2C_MUX_PCA954x=y +-CONFIG_I2C_MUX_PINCTRL=y +-# CONFIG_I2C_MUX_REG is not set +-CONFIG_I2C_HELPER_AUTO=y +-CONFIG_I2C_ALGOBIT=y +- +-# +-# I2C Hardware Bus support +-# +- +-# +-# PC SMBus host controller drivers +-# +-# CONFIG_I2C_ALI1535 is not set +-# CONFIG_I2C_ALI1563 is not set +-# CONFIG_I2C_ALI15X3 is not set +-# CONFIG_I2C_AMD756 is not set +-# CONFIG_I2C_AMD8111 is not set +-# CONFIG_I2C_I801 is not set +-# CONFIG_I2C_ISCH is not set +-# CONFIG_I2C_PIIX4 is not set +-# CONFIG_I2C_NFORCE2 is not set +-# CONFIG_I2C_SIS5595 is not set +-# CONFIG_I2C_SIS630 is not set +-# CONFIG_I2C_SIS96X is not set +-# CONFIG_I2C_VIA is not set +-# CONFIG_I2C_VIAPRO is not set +- +-# +-# I2C system bus drivers (mostly embedded / system-on-chip) +-# +-# CONFIG_I2C_CBUS_GPIO is not set +-CONFIG_I2C_DESIGNWARE_CORE=m +-CONFIG_I2C_DESIGNWARE_PLATFORM=m +-# CONFIG_I2C_DESIGNWARE_PCI is not set +-# CONFIG_I2C_EMEV2 is not set +-CONFIG_I2C_GPIO=y +-CONFIG_I2C_IMX=y +-CONFIG_I2C_OCORES=y +-# CONFIG_I2C_PCA_PLATFORM is not set +-# CONFIG_I2C_PXA_PCI is not set +-# CONFIG_I2C_RK3X is not set +-# CONFIG_I2C_SIMTEC is not set +-# CONFIG_I2C_XILINX is not set +- +-# +-# External I2C/SMBus adapter drivers +-# +-# CONFIG_I2C_DIOLAN_U2C is not set +-# CONFIG_I2C_PARPORT_LIGHT is not set +-# CONFIG_I2C_ROBOTFUZZ_OSIF is not set +-# CONFIG_I2C_TAOS_EVM is not set +-# CONFIG_I2C_TINY_USB is not set +- +-# +-# Other I2C/SMBus bus drivers +-# +-# CONFIG_I2C_STUB is not set +-CONFIG_I2C_SLAVE=y +-CONFIG_I2C_SLAVE_EEPROM=m +-# CONFIG_I2C_DEBUG_CORE is not set +-# CONFIG_I2C_DEBUG_ALGO is not set +-# CONFIG_I2C_DEBUG_BUS is not set +-CONFIG_SPI=y +-# CONFIG_SPI_DEBUG is not set +-CONFIG_SPI_MASTER=y +- +-# +-# SPI Master Controller Drivers +-# +-# CONFIG_SPI_ALTERA is not set +-CONFIG_SPI_BITBANG=m +-# CONFIG_SPI_CADENCE is not set +-CONFIG_SPI_GPIO=m +-CONFIG_SPI_IMX=m +-# CONFIG_SPI_FSL_SPI is not set +-# CONFIG_SPI_OC_TINY is not set +-# CONFIG_SPI_PXA2XX is not set +-# CONFIG_SPI_PXA2XX_PCI is not set +-# CONFIG_SPI_ROCKCHIP is not set +-# CONFIG_SPI_SC18IS602 is not set +-# CONFIG_SPI_XCOMM is not set +-# CONFIG_SPI_XILINX is not set +-# CONFIG_SPI_ZYNQMP_GQSPI is not set +-# CONFIG_SPI_DESIGNWARE is not set +- +-# +-# SPI Protocol Masters +-# +-CONFIG_SPI_SPIDEV=y +-# CONFIG_SPI_TLE62X0 is not set +-# CONFIG_SPMI is not set +-# CONFIG_HSI is not set +- +-# +-# PPS support +-# +-CONFIG_PPS=y +-# CONFIG_PPS_DEBUG is not set +-# CONFIG_NTP_PPS is not set +- +-# +-# PPS clients support +-# +-# CONFIG_PPS_CLIENT_KTIMER is not set +-CONFIG_PPS_CLIENT_LDISC=m +-CONFIG_PPS_CLIENT_GPIO=m +- +-# +-# PPS generators support +-# +- +-# +-# PTP clock support +-# +-CONFIG_PTP_1588_CLOCK=y +-CONFIG_PTP_1588_CLOCK_GIANFAR=y +- +-# +-# Enable PHYLIB and NETWORK_PHY_TIMESTAMPING to see the additional clocks. +-# +-CONFIG_PINCTRL=y +- +-# +-# Pin controllers +-# +-CONFIG_PINMUX=y +-CONFIG_PINCONF=y +-CONFIG_GENERIC_PINCONF=y +-# CONFIG_DEBUG_PINCTRL is not set +-# CONFIG_PINCTRL_AMD is not set +-CONFIG_PINCTRL_SINGLE=y +-CONFIG_PINCTRL_IMX=y +-CONFIG_PINCTRL_IMX6Q=y +-CONFIG_ARCH_HAVE_CUSTOM_GPIO_H=y +-CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y +-CONFIG_ARCH_REQUIRE_GPIOLIB=y +-CONFIG_GPIOLIB=y +-CONFIG_GPIO_DEVRES=y +-CONFIG_OF_GPIO=y +-CONFIG_GPIOLIB_IRQCHIP=y +-# CONFIG_DEBUG_GPIO is not set +-CONFIG_GPIO_SYSFS=y +-CONFIG_GPIO_GENERIC=y +- +-# +-# Memory mapped GPIO drivers +-# +-CONFIG_GPIO_74XX_MMIO=y +-# CONFIG_GPIO_ALTERA is not set +-# CONFIG_GPIO_DWAPB is not set +-# CONFIG_GPIO_EM is not set +-CONFIG_GPIO_GENERIC_PLATFORM=y +-# CONFIG_GPIO_GRGPIO is not set +-CONFIG_GPIO_MXC=y +-CONFIG_GPIO_SYSCON=y +-# CONFIG_GPIO_VX855 is not set +-# CONFIG_GPIO_XILINX is not set +-# CONFIG_GPIO_ZEVIO is not set +-# CONFIG_GPIO_ZX is not set +- +-# +-# I2C GPIO expanders +-# +-CONFIG_GPIO_ADP5588=m +-CONFIG_GPIO_ADNP=m +-# CONFIG_GPIO_MAX7300 is not set +-# CONFIG_GPIO_MAX732X is not set +-CONFIG_GPIO_PCA953X=y +-CONFIG_GPIO_PCA953X_IRQ=y +-CONFIG_GPIO_PCF857X=m +-CONFIG_GPIO_SX150X=y +- +-# +-# MFD GPIO expanders +-# +-# CONFIG_GPIO_DA9052 is not set +- +-# +-# PCI GPIO expanders +-# +-# CONFIG_GPIO_AMD8111 is not set +-# CONFIG_GPIO_ML_IOH is not set +-# CONFIG_GPIO_RDC321X is not set +- +-# +-# SPI GPIO expanders +-# +-CONFIG_GPIO_74X164=y +-# CONFIG_GPIO_MAX7301 is not set +-CONFIG_GPIO_MC33880=y +- +-# +-# SPI or I2C GPIO expanders +-# +-CONFIG_GPIO_MCP23S08=y +- +-# +-# USB GPIO expanders +-# +-CONFIG_W1=m +-CONFIG_W1_CON=y +- +-# +-# 1-wire Bus Masters +-# +-CONFIG_W1_MASTER_MATROX=m +-CONFIG_W1_MASTER_DS2490=m +-CONFIG_W1_MASTER_DS2482=m +-CONFIG_W1_MASTER_MXC=m +-CONFIG_W1_MASTER_DS1WM=m +-CONFIG_W1_MASTER_GPIO=m +- +-# +-# 1-wire Slaves +-# +-CONFIG_W1_SLAVE_THERM=m +-CONFIG_W1_SLAVE_SMEM=m +-CONFIG_W1_SLAVE_DS2408=m +-CONFIG_W1_SLAVE_DS2408_READBACK=y +-CONFIG_W1_SLAVE_DS2413=m +-CONFIG_W1_SLAVE_DS2406=m +-CONFIG_W1_SLAVE_DS2423=m +-CONFIG_W1_SLAVE_DS2431=m +-CONFIG_W1_SLAVE_DS2433=m +-CONFIG_W1_SLAVE_DS2433_CRC=y +-CONFIG_W1_SLAVE_DS2760=m +-CONFIG_W1_SLAVE_DS2780=m +-CONFIG_W1_SLAVE_DS2781=m +-CONFIG_W1_SLAVE_DS28E04=m +-CONFIG_W1_SLAVE_BQ27000=m +-CONFIG_POWER_SUPPLY=y +-# CONFIG_POWER_SUPPLY_DEBUG is not set +-# CONFIG_PDA_POWER is not set +-# CONFIG_GENERIC_ADC_BATTERY is not set +-CONFIG_TEST_POWER=m +-# CONFIG_BATTERY_DS2760 is not set +-# CONFIG_BATTERY_DS2780 is not set +-# CONFIG_BATTERY_DS2781 is not set +-# CONFIG_BATTERY_DS2782 is not set +-# CONFIG_BATTERY_SBS is not set +-# CONFIG_BATTERY_BQ27XXX is not set +-# CONFIG_BATTERY_DA9052 is not set +-# CONFIG_BATTERY_MAX17040 is not set +-# CONFIG_BATTERY_MAX17042 is not set +-# CONFIG_CHARGER_ISP1704 is not set +-# CONFIG_CHARGER_MAX8903 is not set +-# CONFIG_CHARGER_LP8727 is not set +-CONFIG_CHARGER_GPIO=m +-# CONFIG_CHARGER_MANAGER is not set +-# CONFIG_CHARGER_BQ2415X is not set +-# CONFIG_CHARGER_BQ24190 is not set +-# CONFIG_CHARGER_BQ24257 is not set +-# CONFIG_CHARGER_BQ24735 is not set +-# CONFIG_CHARGER_BQ25890 is not set +-# CONFIG_CHARGER_SMB347 is not set +-# CONFIG_BATTERY_GAUGE_LTC2941 is not set +-# CONFIG_CHARGER_RT9455 is not set +-CONFIG_POWER_RESET=y +-# CONFIG_POWER_RESET_BRCMSTB is not set +-CONFIG_POWER_RESET_GPIO=y +-CONFIG_POWER_RESET_GPIO_RESTART=y +-CONFIG_POWER_RESET_IMX=y +-CONFIG_POWER_RESET_LTC2952=y +-CONFIG_POWER_RESET_RESTART=y +-CONFIG_POWER_RESET_VERSATILE=y +-# CONFIG_POWER_RESET_SNVS is not set +-CONFIG_POWER_RESET_SYSCON=y +-# CONFIG_POWER_RESET_SYSCON_POWEROFF is not set +-CONFIG_POWER_AVS=y +-CONFIG_HWMON=y +-# CONFIG_HWMON_VID is not set +-# CONFIG_HWMON_DEBUG_CHIP is not set +- +-# +-# Native drivers +-# +-# CONFIG_SENSORS_AD7314 is not set +-# CONFIG_SENSORS_AD7414 is not set +-# CONFIG_SENSORS_AD7418 is not set +-# CONFIG_SENSORS_ADM1021 is not set +-# CONFIG_SENSORS_ADM1025 is not set +-# CONFIG_SENSORS_ADM1026 is not set +-# CONFIG_SENSORS_ADM1029 is not set +-# CONFIG_SENSORS_ADM1031 is not set +-# CONFIG_SENSORS_ADM9240 is not set +-# CONFIG_SENSORS_ADT7310 is not set +-# CONFIG_SENSORS_ADT7410 is not set +-# CONFIG_SENSORS_ADT7411 is not set +-# CONFIG_SENSORS_ADT7462 is not set +-# CONFIG_SENSORS_ADT7470 is not set +-# CONFIG_SENSORS_ADT7475 is not set +-# CONFIG_SENSORS_ASC7621 is not set +-# CONFIG_SENSORS_ATXP1 is not set +-# CONFIG_SENSORS_DS620 is not set +-# CONFIG_SENSORS_DS1621 is not set +-# CONFIG_SENSORS_DA9052_ADC is not set +-# CONFIG_SENSORS_I5K_AMB is not set +-# CONFIG_SENSORS_F71805F is not set +-# CONFIG_SENSORS_F71882FG is not set +-# CONFIG_SENSORS_F75375S is not set +-CONFIG_SENSORS_MC13783_ADC=y +-# CONFIG_SENSORS_GL518SM is not set +-# CONFIG_SENSORS_GL520SM is not set +-# CONFIG_SENSORS_G760A is not set +-# CONFIG_SENSORS_G762 is not set +-# CONFIG_SENSORS_GPIO_FAN is not set +-# CONFIG_SENSORS_HIH6130 is not set +-# CONFIG_SENSORS_IIO_HWMON is not set +-# CONFIG_SENSORS_IT87 is not set +-# CONFIG_SENSORS_JC42 is not set +-# CONFIG_SENSORS_POWR1220 is not set +-# CONFIG_SENSORS_LINEAGE is not set +-# CONFIG_SENSORS_LTC2945 is not set +-# CONFIG_SENSORS_LTC4151 is not set +-# CONFIG_SENSORS_LTC4215 is not set +-# CONFIG_SENSORS_LTC4222 is not set +-# CONFIG_SENSORS_LTC4245 is not set +-# CONFIG_SENSORS_LTC4260 is not set +-# CONFIG_SENSORS_LTC4261 is not set +-CONFIG_SENSORS_MAX1111=y +-CONFIG_SENSORS_MAX16065=y +-CONFIG_SENSORS_MAX1619=y +-CONFIG_SENSORS_MAX1668=y +-# CONFIG_SENSORS_MAX197 is not set +-# CONFIG_SENSORS_MAX6639 is not set +-# CONFIG_SENSORS_MAX6642 is not set +-# CONFIG_SENSORS_MAX6650 is not set +-# CONFIG_SENSORS_MAX6697 is not set +-# CONFIG_SENSORS_MAX31790 is not set +-# CONFIG_SENSORS_HTU21 is not set +-# CONFIG_SENSORS_MCP3021 is not set +-# CONFIG_SENSORS_ADCXX is not set +-# CONFIG_SENSORS_LM63 is not set +-# CONFIG_SENSORS_LM70 is not set +-# CONFIG_SENSORS_LM73 is not set +-# CONFIG_SENSORS_LM75 is not set +-# CONFIG_SENSORS_LM77 is not set +-# CONFIG_SENSORS_LM78 is not set +-# CONFIG_SENSORS_LM80 is not set +-# CONFIG_SENSORS_LM83 is not set +-# CONFIG_SENSORS_LM85 is not set +-# CONFIG_SENSORS_LM87 is not set +-# CONFIG_SENSORS_LM90 is not set +-# CONFIG_SENSORS_LM92 is not set +-# CONFIG_SENSORS_LM93 is not set +-# CONFIG_SENSORS_LM95234 is not set +-# CONFIG_SENSORS_LM95241 is not set +-# CONFIG_SENSORS_LM95245 is not set +-# CONFIG_SENSORS_PC87360 is not set +-# CONFIG_SENSORS_PC87427 is not set +-# CONFIG_SENSORS_NTC_THERMISTOR is not set +-# CONFIG_SENSORS_NCT6683 is not set +-# CONFIG_SENSORS_NCT6775 is not set +-# CONFIG_SENSORS_NCT7802 is not set +-# CONFIG_SENSORS_NCT7904 is not set +-# CONFIG_SENSORS_PCF8591 is not set +-# CONFIG_PMBUS is not set +-CONFIG_SENSORS_PWM_FAN=y +-# CONFIG_SENSORS_SHT15 is not set +-# CONFIG_SENSORS_SHT21 is not set +-# CONFIG_SENSORS_SHTC1 is not set +-# CONFIG_SENSORS_SIS5595 is not set +-# CONFIG_SENSORS_DME1737 is not set +-# CONFIG_SENSORS_EMC1403 is not set +-# CONFIG_SENSORS_EMC2103 is not set +-# CONFIG_SENSORS_EMC6W201 is not set +-# CONFIG_SENSORS_SMSC47M1 is not set +-# CONFIG_SENSORS_SMSC47M192 is not set +-# CONFIG_SENSORS_SMSC47B397 is not set +-# CONFIG_SENSORS_SCH56XX_COMMON is not set +-# CONFIG_SENSORS_SCH5627 is not set +-# CONFIG_SENSORS_SCH5636 is not set +-# CONFIG_SENSORS_SMM665 is not set +-# CONFIG_SENSORS_ADC128D818 is not set +-# CONFIG_SENSORS_ADS1015 is not set +-# CONFIG_SENSORS_ADS7828 is not set +-# CONFIG_SENSORS_ADS7871 is not set +-# CONFIG_SENSORS_AMC6821 is not set +-# CONFIG_SENSORS_INA209 is not set +-# CONFIG_SENSORS_INA2XX is not set +-# CONFIG_SENSORS_TC74 is not set +-# CONFIG_SENSORS_THMC50 is not set +-# CONFIG_SENSORS_TMP102 is not set +-# CONFIG_SENSORS_TMP103 is not set +-# CONFIG_SENSORS_TMP401 is not set +-# CONFIG_SENSORS_TMP421 is not set +-# CONFIG_SENSORS_VIA686A is not set +-# CONFIG_SENSORS_VT1211 is not set +-# CONFIG_SENSORS_VT8231 is not set +-# CONFIG_SENSORS_W83781D is not set +-# CONFIG_SENSORS_W83791D is not set +-# CONFIG_SENSORS_W83792D is not set +-# CONFIG_SENSORS_W83793 is not set +-# CONFIG_SENSORS_W83795 is not set +-# CONFIG_SENSORS_W83L785TS is not set +-# CONFIG_SENSORS_W83L786NG is not set +-# CONFIG_SENSORS_W83627HF is not set +-# CONFIG_SENSORS_W83627EHF is not set +-CONFIG_THERMAL=y +-CONFIG_THERMAL_HWMON=y +-CONFIG_THERMAL_OF=y +-# CONFIG_THERMAL_WRITABLE_TRIPS is not set +-CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE=y +-# CONFIG_THERMAL_DEFAULT_GOV_FAIR_SHARE is not set +-# CONFIG_THERMAL_DEFAULT_GOV_USER_SPACE is not set +-# CONFIG_THERMAL_DEFAULT_GOV_POWER_ALLOCATOR is not set +-CONFIG_THERMAL_GOV_FAIR_SHARE=y +-CONFIG_THERMAL_GOV_STEP_WISE=y +-# CONFIG_THERMAL_GOV_BANG_BANG is not set +-CONFIG_THERMAL_GOV_USER_SPACE=y +-# CONFIG_THERMAL_GOV_POWER_ALLOCATOR is not set +-CONFIG_CPU_THERMAL=y +-CONFIG_CLOCK_THERMAL=y +-# CONFIG_DEVFREQ_THERMAL is not set +-# CONFIG_THERMAL_EMULATION is not set +-CONFIG_IMX_THERMAL=y +-CONFIG_WATCHDOG=y +-CONFIG_WATCHDOG_CORE=y +-# CONFIG_WATCHDOG_NOWAYOUT is not set +- +-# +-# Watchdog Device Drivers +-# +-CONFIG_SOFT_WATCHDOG=m +-# CONFIG_DA9052_WATCHDOG is not set +-CONFIG_GPIO_WATCHDOG=m +-# CONFIG_XILINX_WATCHDOG is not set +-# CONFIG_CADENCE_WATCHDOG is not set +-# CONFIG_DW_WATCHDOG is not set +-# CONFIG_MAX63XX_WATCHDOG is not set +-CONFIG_IMX2_WDT=y +-# CONFIG_ALIM7101_WDT is not set +-# CONFIG_I6300ESB_WDT is not set +-# CONFIG_BCM7038_WDT is not set +-# CONFIG_MEN_A21_WDT is not set +- +-# +-# PCI-based Watchdog Cards +-# +-# CONFIG_PCIPCWATCHDOG is not set +-# CONFIG_WDTPCI is not set +- +-# +-# USB-based Watchdog Cards +-# +-# CONFIG_USBPCWATCHDOG is not set +-CONFIG_SSB_POSSIBLE=y +- +-# +-# Sonics Silicon Backplane +-# +-CONFIG_SSB=y +-CONFIG_SSB_SPROM=y +-CONFIG_SSB_BLOCKIO=y +-CONFIG_SSB_PCIHOST_POSSIBLE=y +-CONFIG_SSB_PCIHOST=y +-CONFIG_SSB_B43_PCI_BRIDGE=y +-CONFIG_SSB_SDIOHOST_POSSIBLE=y +-CONFIG_SSB_SDIOHOST=y +-# CONFIG_SSB_HOST_SOC is not set +-# CONFIG_SSB_SILENT is not set +-# CONFIG_SSB_DEBUG is not set +-CONFIG_SSB_DRIVER_PCICORE_POSSIBLE=y +-CONFIG_SSB_DRIVER_PCICORE=y +-# CONFIG_SSB_DRIVER_GPIO is not set +-CONFIG_BCMA_POSSIBLE=y +- +-# +-# Broadcom specific AMBA +-# +-CONFIG_BCMA=m +-CONFIG_BCMA_BLOCKIO=y +-CONFIG_BCMA_HOST_PCI_POSSIBLE=y +-# CONFIG_BCMA_HOST_PCI is not set +-# CONFIG_BCMA_HOST_SOC is not set +-# CONFIG_BCMA_DRIVER_PCI is not set +-# CONFIG_BCMA_DRIVER_GMAC_CMN is not set +-# CONFIG_BCMA_DRIVER_GPIO is not set +-# CONFIG_BCMA_DEBUG is not set +- +-# +-# Multifunction device drivers +-# +-CONFIG_MFD_CORE=y +-# CONFIG_MFD_AS3711 is not set +-# CONFIG_MFD_AS3722 is not set +-# CONFIG_PMIC_ADP5520 is not set +-# CONFIG_MFD_AAT2870_CORE is not set +-# CONFIG_MFD_ATMEL_FLEXCOM is not set +-# CONFIG_MFD_ATMEL_HLCDC is not set +-# CONFIG_MFD_BCM590XX is not set +-# CONFIG_MFD_AXP20X is not set +-# CONFIG_MFD_CROS_EC is not set +-# CONFIG_MFD_ASIC3 is not set +-# CONFIG_PMIC_DA903X is not set +-CONFIG_PMIC_DA9052=y +-CONFIG_MFD_DA9052_SPI=y +-CONFIG_MFD_DA9052_I2C=y +-# CONFIG_MFD_DA9055 is not set +-# CONFIG_MFD_DA9062 is not set +-# CONFIG_MFD_DA9063 is not set +-# CONFIG_MFD_DA9150 is not set +-CONFIG_MFD_MXC_HDMI=y +-# CONFIG_MFD_DLN2 is not set +-CONFIG_MFD_MC13XXX=y +-CONFIG_MFD_MC13XXX_SPI=y +-CONFIG_MFD_MC13XXX_I2C=y +-# CONFIG_MFD_HI6421_PMIC is not set +-# CONFIG_HTC_EGPIO is not set +-# CONFIG_HTC_PASIC3 is not set +-# CONFIG_HTC_I2CPLD is not set +-# CONFIG_LPC_ICH is not set +-# CONFIG_LPC_SCH is not set +-# CONFIG_INTEL_SOC_PMIC is not set +-# CONFIG_MFD_JANZ_CMODIO is not set +-# CONFIG_MFD_KEMPLD is not set +-# CONFIG_MFD_88PM800 is not set +-# CONFIG_MFD_88PM805 is not set +-# CONFIG_MFD_88PM860X is not set +-# CONFIG_MFD_MAX14577 is not set +-# CONFIG_MFD_MAX77686 is not set +-# CONFIG_MFD_MAX77693 is not set +-# CONFIG_MFD_MAX77843 is not set +-# CONFIG_MFD_MAX8907 is not set +-# CONFIG_MFD_MAX8925 is not set +-# CONFIG_MFD_MAX8997 is not set +-# CONFIG_MFD_MAX8998 is not set +-# CONFIG_MFD_MT6397 is not set +-# CONFIG_MFD_MENF21BMC is not set +-# CONFIG_EZX_PCAP is not set +-# CONFIG_MFD_VIPERBOARD is not set +-# CONFIG_MFD_RETU is not set +-# CONFIG_MFD_PCF50633 is not set +-# CONFIG_UCB1400_CORE is not set +-# CONFIG_MFD_PM8921_CORE is not set +-# CONFIG_MFD_RDC321X is not set +-# CONFIG_MFD_RTSX_PCI is not set +-# CONFIG_MFD_RT5033 is not set +-# CONFIG_MFD_RTSX_USB is not set +-# CONFIG_MFD_RC5T583 is not set +-# CONFIG_MFD_RK808 is not set +-# CONFIG_MFD_RN5T618 is not set +-# CONFIG_MFD_SEC_CORE is not set +-CONFIG_MFD_SI476X_CORE=y +-# CONFIG_MFD_SM501 is not set +-# CONFIG_MFD_SKY81452 is not set +-# CONFIG_MFD_SMSC is not set +-# CONFIG_ABX500_CORE is not set +-# CONFIG_MFD_STMPE is not set +-CONFIG_MFD_SYSCON=y +-# CONFIG_MFD_TI_AM335X_TSCADC is not set +-# CONFIG_MFD_LP3943 is not set +-# CONFIG_MFD_LP8788 is not set +-# CONFIG_MFD_PALMAS is not set +-# CONFIG_TPS6105X is not set +-# CONFIG_TPS65010 is not set +-# CONFIG_TPS6507X is not set +-# CONFIG_MFD_TPS65090 is not set +-# CONFIG_MFD_TPS65217 is not set +-# CONFIG_MFD_TPS65218 is not set +-# CONFIG_MFD_TPS6586X is not set +-# CONFIG_MFD_TPS65910 is not set +-# CONFIG_MFD_TPS65912 is not set +-# CONFIG_MFD_TPS65912_I2C is not set +-# CONFIG_MFD_TPS65912_SPI is not set +-# CONFIG_MFD_TPS80031 is not set +-# CONFIG_TWL4030_CORE is not set +-# CONFIG_TWL6040_CORE is not set +-CONFIG_MFD_WL1273_CORE=m +-# CONFIG_MFD_LM3533 is not set +-# CONFIG_MFD_TC3589X is not set +-# CONFIG_MFD_TMIO is not set +-# CONFIG_MFD_T7L66XB is not set +-# CONFIG_MFD_TC6387XB is not set +-# CONFIG_MFD_TC6393XB is not set +-# CONFIG_MFD_VX855 is not set +-# CONFIG_MFD_ARIZONA_I2C is not set +-# CONFIG_MFD_ARIZONA_SPI is not set +-# CONFIG_MFD_WM8400 is not set +-# CONFIG_MFD_WM831X_I2C is not set +-# CONFIG_MFD_WM831X_SPI is not set +-# CONFIG_MFD_WM8350_I2C is not set +-# CONFIG_MFD_WM8994 is not set +-# CONFIG_MFD_TDA1997X is not set +-CONFIG_REGULATOR=y +-# CONFIG_REGULATOR_DEBUG is not set +-CONFIG_REGULATOR_FIXED_VOLTAGE=y +-CONFIG_REGULATOR_VIRTUAL_CONSUMER=y +-CONFIG_REGULATOR_USERSPACE_CONSUMER=m +-# CONFIG_REGULATOR_ACT8865 is not set +-# CONFIG_REGULATOR_AD5398 is not set +-CONFIG_REGULATOR_ANATOP=y +-# CONFIG_REGULATOR_DA9052 is not set +-# CONFIG_REGULATOR_DA9210 is not set +-# CONFIG_REGULATOR_DA9211 is not set +-# CONFIG_REGULATOR_FAN53555 is not set +-CONFIG_REGULATOR_GPIO=y +-# CONFIG_REGULATOR_ISL9305 is not set +-# CONFIG_REGULATOR_ISL6271A is not set +-# CONFIG_REGULATOR_LP3971 is not set +-# CONFIG_REGULATOR_LP3972 is not set +-# CONFIG_REGULATOR_LP872X is not set +-# CONFIG_REGULATOR_LP8755 is not set +-# CONFIG_REGULATOR_LTC3589 is not set +-# CONFIG_REGULATOR_LTC3676 is not set +-# CONFIG_REGULATOR_MAX1586 is not set +-# CONFIG_REGULATOR_MAX8649 is not set +-# CONFIG_REGULATOR_MAX8660 is not set +-# CONFIG_REGULATOR_MAX8952 is not set +-# CONFIG_REGULATOR_MAX8973 is not set +-CONFIG_REGULATOR_MC13XXX_CORE=y +-CONFIG_REGULATOR_MC13783=y +-CONFIG_REGULATOR_MC13892=y +-# CONFIG_REGULATOR_MT6311 is not set +-CONFIG_REGULATOR_PFUZE100=y +-CONFIG_REGULATOR_PWM=y +-# CONFIG_REGULATOR_TPS51632 is not set +-# CONFIG_REGULATOR_TPS62360 is not set +-# CONFIG_REGULATOR_TPS65023 is not set +-# CONFIG_REGULATOR_TPS6507X is not set +-# CONFIG_REGULATOR_TPS6524X is not set +-CONFIG_MEDIA_SUPPORT=y +- +-# +-# Multimedia core support +-# +-CONFIG_MEDIA_CAMERA_SUPPORT=y +-CONFIG_MEDIA_ANALOG_TV_SUPPORT=y +-CONFIG_MEDIA_DIGITAL_TV_SUPPORT=y +-CONFIG_MEDIA_RADIO_SUPPORT=y +-CONFIG_MEDIA_SDR_SUPPORT=y +-CONFIG_MEDIA_RC_SUPPORT=y +-CONFIG_MEDIA_CONTROLLER=y +-CONFIG_VIDEO_DEV=y +-CONFIG_VIDEO_V4L2_SUBDEV_API=y +-CONFIG_VIDEO_V4L2=y +-# CONFIG_VIDEO_ADV_DEBUG is not set +-# CONFIG_VIDEO_FIXED_MINOR_RANGES is not set +-CONFIG_VIDEO_TUNER=m +-CONFIG_V4L2_MEM2MEM_DEV=m +-CONFIG_VIDEO_V4L2_INT_DEVICE=m +-CONFIG_VIDEOBUF_GEN=y +-CONFIG_VIDEOBUF_DMA_SG=m +-CONFIG_VIDEOBUF_VMALLOC=m +-CONFIG_VIDEOBUF_DMA_CONTIG=y +-CONFIG_VIDEOBUF_DVB=m +-CONFIG_VIDEOBUF2_CORE=y +-CONFIG_VIDEOBUF2_MEMOPS=m +-CONFIG_VIDEOBUF2_DMA_CONTIG=m +-CONFIG_VIDEOBUF2_VMALLOC=m +-CONFIG_VIDEOBUF2_DMA_SG=m +-CONFIG_VIDEOBUF2_DVB=m +-CONFIG_DVB_CORE=y +-CONFIG_DVB_NET=y +-CONFIG_TTPCI_EEPROM=m +-CONFIG_DVB_MAX_ADAPTERS=8 +-# CONFIG_DVB_DYNAMIC_MINORS is not set +- +-# +-# Media drivers +-# +-CONFIG_RC_CORE=y +-CONFIG_RC_MAP=m +-CONFIG_RC_DECODERS=y +-CONFIG_LIRC=m +-CONFIG_IR_LIRC_CODEC=m +-CONFIG_IR_NEC_DECODER=m +-CONFIG_IR_RC5_DECODER=m +-CONFIG_IR_RC6_DECODER=y +-CONFIG_IR_JVC_DECODER=m +-CONFIG_IR_SONY_DECODER=m +-CONFIG_IR_SANYO_DECODER=m +-CONFIG_IR_SHARP_DECODER=m +-CONFIG_IR_MCE_KBD_DECODER=m +-CONFIG_IR_XMP_DECODER=m +-CONFIG_RC_DEVICES=y +-CONFIG_RC_ATI_REMOTE=m +-CONFIG_IR_HIX5HD2=m +-CONFIG_IR_IMON=m +-CONFIG_IR_MCEUSB=m +-CONFIG_IR_REDRAT3=m +-CONFIG_IR_STREAMZAP=m +-CONFIG_IR_IGORPLUGUSB=m +-CONFIG_IR_IGUANA=m +-CONFIG_IR_TTUSBIR=m +-CONFIG_RC_LOOPBACK=m +-CONFIG_IR_GPIO_CIR=m +-CONFIG_MEDIA_USB_SUPPORT=y +- +-# +-# Webcam devices +-# +-CONFIG_USB_VIDEO_CLASS=m +-CONFIG_USB_VIDEO_CLASS_INPUT_EVDEV=y +-CONFIG_USB_GSPCA=m +-CONFIG_USB_M5602=m +-CONFIG_USB_STV06XX=m +-CONFIG_USB_GL860=m +-CONFIG_USB_GSPCA_BENQ=m +-CONFIG_USB_GSPCA_CONEX=m +-CONFIG_USB_GSPCA_CPIA1=m +-CONFIG_USB_GSPCA_DTCS033=m +-CONFIG_USB_GSPCA_ETOMS=m +-CONFIG_USB_GSPCA_FINEPIX=m +-CONFIG_USB_GSPCA_JEILINJ=m +-CONFIG_USB_GSPCA_JL2005BCD=m +-CONFIG_USB_GSPCA_KINECT=m +-CONFIG_USB_GSPCA_KONICA=m +-CONFIG_USB_GSPCA_MARS=m +-CONFIG_USB_GSPCA_MR97310A=m +-CONFIG_USB_GSPCA_NW80X=m +-CONFIG_USB_GSPCA_OV519=m +-CONFIG_USB_GSPCA_OV534=m +-CONFIG_USB_GSPCA_OV534_9=m +-CONFIG_USB_GSPCA_PAC207=m +-CONFIG_USB_GSPCA_PAC7302=m +-CONFIG_USB_GSPCA_PAC7311=m +-CONFIG_USB_GSPCA_SE401=m +-CONFIG_USB_GSPCA_SN9C2028=m +-CONFIG_USB_GSPCA_SN9C20X=m +-CONFIG_USB_GSPCA_SONIXB=m +-CONFIG_USB_GSPCA_SONIXJ=m +-CONFIG_USB_GSPCA_SPCA500=m +-CONFIG_USB_GSPCA_SPCA501=m +-CONFIG_USB_GSPCA_SPCA505=m +-CONFIG_USB_GSPCA_SPCA506=m +-CONFIG_USB_GSPCA_SPCA508=m +-CONFIG_USB_GSPCA_SPCA561=m +-CONFIG_USB_GSPCA_SPCA1528=m +-CONFIG_USB_GSPCA_SQ905=m +-CONFIG_USB_GSPCA_SQ905C=m +-CONFIG_USB_GSPCA_SQ930X=m +-CONFIG_USB_GSPCA_STK014=m +-CONFIG_USB_GSPCA_STK1135=m +-CONFIG_USB_GSPCA_STV0680=m +-CONFIG_USB_GSPCA_SUNPLUS=m +-CONFIG_USB_GSPCA_T613=m +-CONFIG_USB_GSPCA_TOPRO=m +-# CONFIG_USB_GSPCA_TOUPTEK is not set +-CONFIG_USB_GSPCA_TV8532=m +-CONFIG_USB_GSPCA_VC032X=m +-CONFIG_USB_GSPCA_VICAM=m +-CONFIG_USB_GSPCA_XIRLINK_CIT=m +-CONFIG_USB_GSPCA_ZC3XX=m +-CONFIG_USB_PWC=m +-# CONFIG_USB_PWC_DEBUG is not set +-CONFIG_USB_PWC_INPUT_EVDEV=y +-CONFIG_VIDEO_CPIA2=m +-CONFIG_USB_ZR364XX=m +-CONFIG_USB_STKWEBCAM=m +-CONFIG_USB_S2255=m +-CONFIG_VIDEO_USBTV=m +- +-# +-# Analog TV USB devices +-# +-CONFIG_VIDEO_PVRUSB2=m +-CONFIG_VIDEO_PVRUSB2_SYSFS=y +-CONFIG_VIDEO_PVRUSB2_DVB=y +-# CONFIG_VIDEO_PVRUSB2_DEBUGIFC is not set +-CONFIG_VIDEO_HDPVR=m +-CONFIG_VIDEO_USBVISION=m +-CONFIG_VIDEO_STK1160_COMMON=m +-CONFIG_VIDEO_STK1160_AC97=y +-CONFIG_VIDEO_STK1160=m +-CONFIG_VIDEO_GO7007=m +-CONFIG_VIDEO_GO7007_USB=m +-CONFIG_VIDEO_GO7007_LOADER=m +-CONFIG_VIDEO_GO7007_USB_S2250_BOARD=m +- +-# +-# Analog/digital TV USB devices +-# +-CONFIG_VIDEO_AU0828=m +-CONFIG_VIDEO_AU0828_V4L2=y +-CONFIG_VIDEO_AU0828_RC=y +-CONFIG_VIDEO_CX231XX=m +-CONFIG_VIDEO_CX231XX_RC=y +-CONFIG_VIDEO_CX231XX_ALSA=m +-CONFIG_VIDEO_CX231XX_DVB=m +-CONFIG_VIDEO_TM6000=m +-CONFIG_VIDEO_TM6000_ALSA=m +-CONFIG_VIDEO_TM6000_DVB=m +- +-# +-# Digital TV USB devices +-# +-CONFIG_DVB_USB=m +-# CONFIG_DVB_USB_DEBUG is not set +-CONFIG_DVB_USB_A800=m +-CONFIG_DVB_USB_DIBUSB_MB=m +-CONFIG_DVB_USB_DIBUSB_MB_FAULTY=y +-CONFIG_DVB_USB_DIBUSB_MC=m +-CONFIG_DVB_USB_DIB0700=m +-CONFIG_DVB_USB_UMT_010=m +-CONFIG_DVB_USB_CXUSB=m +-CONFIG_DVB_USB_M920X=m +-CONFIG_DVB_USB_DIGITV=m +-CONFIG_DVB_USB_VP7045=m +-CONFIG_DVB_USB_VP702X=m +-CONFIG_DVB_USB_GP8PSK=m +-CONFIG_DVB_USB_NOVA_T_USB2=m +-CONFIG_DVB_USB_TTUSB2=m +-CONFIG_DVB_USB_DTT200U=m +-CONFIG_DVB_USB_OPERA1=m +-CONFIG_DVB_USB_AF9005=m +-CONFIG_DVB_USB_AF9005_REMOTE=m +-CONFIG_DVB_USB_PCTV452E=m +-CONFIG_DVB_USB_DW2102=m +-CONFIG_DVB_USB_CINERGY_T2=m +-CONFIG_DVB_USB_DTV5100=m +-CONFIG_DVB_USB_FRIIO=m +-CONFIG_DVB_USB_AZ6027=m +-CONFIG_DVB_USB_TECHNISAT_USB2=m +-CONFIG_DVB_USB_V2=m +-CONFIG_DVB_USB_AF9015=m +-CONFIG_DVB_USB_AF9035=m +-CONFIG_DVB_USB_ANYSEE=m +-CONFIG_DVB_USB_AU6610=m +-CONFIG_DVB_USB_AZ6007=m +-CONFIG_DVB_USB_CE6230=m +-CONFIG_DVB_USB_EC168=m +-CONFIG_DVB_USB_GL861=m +-CONFIG_DVB_USB_LME2510=m +-CONFIG_DVB_USB_MXL111SF=m +-CONFIG_DVB_USB_RTL28XXU=m +-CONFIG_DVB_USB_DVBSKY=m +-CONFIG_DVB_TTUSB_BUDGET=m +-CONFIG_DVB_TTUSB_DEC=m +-CONFIG_SMS_USB_DRV=m +-CONFIG_DVB_B2C2_FLEXCOP_USB=m +-# CONFIG_DVB_B2C2_FLEXCOP_USB_DEBUG is not set +-CONFIG_DVB_AS102=m +- +-# +-# Webcam, TV (analog/digital) USB devices +-# +-CONFIG_VIDEO_EM28XX=m +-CONFIG_VIDEO_EM28XX_V4L2=m +-CONFIG_VIDEO_EM28XX_ALSA=m +-CONFIG_VIDEO_EM28XX_DVB=m +-CONFIG_VIDEO_EM28XX_RC=m +- +-# +-# Software defined radio USB devices +-# +-CONFIG_USB_AIRSPY=m +-CONFIG_USB_HACKRF=m +-CONFIG_USB_MSI2500=m +-CONFIG_MEDIA_PCI_SUPPORT=y +- +-# +-# Media capture support +-# +-CONFIG_VIDEO_SOLO6X10=m +-CONFIG_VIDEO_TW68=m +- +-# +-# Media capture/analog TV support +-# +-CONFIG_VIDEO_IVTV=m +-CONFIG_VIDEO_IVTV_ALSA=m +-CONFIG_VIDEO_FB_IVTV=m +-CONFIG_VIDEO_HEXIUM_GEMINI=m +-CONFIG_VIDEO_HEXIUM_ORION=m +-CONFIG_VIDEO_MXB=m +-CONFIG_VIDEO_DT3155=m +- +-# +-# Media capture/analog/hybrid TV support +-# +-CONFIG_VIDEO_CX18=m +-CONFIG_VIDEO_CX18_ALSA=m +-CONFIG_VIDEO_CX23885=m +-CONFIG_MEDIA_ALTERA_CI=m +-CONFIG_VIDEO_CX25821=m +-CONFIG_VIDEO_CX25821_ALSA=m +-CONFIG_VIDEO_CX88=m +-CONFIG_VIDEO_CX88_ALSA=m +-CONFIG_VIDEO_CX88_BLACKBIRD=m +-CONFIG_VIDEO_CX88_DVB=m +-CONFIG_VIDEO_CX88_ENABLE_VP3054=y +-CONFIG_VIDEO_CX88_VP3054=m +-CONFIG_VIDEO_CX88_MPEG=m +-CONFIG_VIDEO_BT848=m +-CONFIG_DVB_BT8XX=m +-CONFIG_VIDEO_SAA7134=m +-CONFIG_VIDEO_SAA7134_ALSA=m +-CONFIG_VIDEO_SAA7134_RC=y +-CONFIG_VIDEO_SAA7134_DVB=m +-CONFIG_VIDEO_SAA7134_GO7007=m +-CONFIG_VIDEO_SAA7164=m +- +-# +-# Media digital TV PCI Adapters +-# +-CONFIG_DVB_AV7110_IR=y +-CONFIG_DVB_AV7110=m +-CONFIG_DVB_AV7110_OSD=y +-CONFIG_DVB_BUDGET_CORE=m +-CONFIG_DVB_BUDGET=m +-CONFIG_DVB_BUDGET_CI=m +-CONFIG_DVB_BUDGET_AV=m +-CONFIG_DVB_BUDGET_PATCH=m +-CONFIG_DVB_B2C2_FLEXCOP_PCI=m +-# CONFIG_DVB_B2C2_FLEXCOP_PCI_DEBUG is not set +-CONFIG_DVB_PLUTO2=m +-CONFIG_DVB_DM1105=m +-CONFIG_DVB_PT1=m +-CONFIG_DVB_PT3=m +-CONFIG_MANTIS_CORE=m +-CONFIG_DVB_MANTIS=m +-CONFIG_DVB_HOPPER=m +-CONFIG_DVB_NGENE=m +-CONFIG_DVB_DDBRIDGE=m +-CONFIG_DVB_SMIPCIE=m +-# CONFIG_DVB_NETUP_UNIDVB is not set +-CONFIG_V4L_PLATFORM_DRIVERS=y +-# CONFIG_VIDEO_CAFE_CCIC is not set +-CONFIG_VIDEO_MXC_OUTPUT=y +-CONFIG_VIDEO_MXC_CAPTURE=m +- +-# +-# MXC Camera/V4L2 PRP Features support +-# +-CONFIG_VIDEO_MXC_IPU_CAMERA=y +-# CONFIG_VIDEO_MXC_CSI_CAMERA is not set +-# CONFIG_MXC_TVIN_TDA1997X is not set +-CONFIG_MXC_CAMERA_OV5640=m +-CONFIG_MXC_CAMERA_OV5642=m +-CONFIG_MXC_CAMERA_OV5640_MIPI=m +-CONFIG_MXC_CAMERA_OV5647_MIPI=m +-# CONFIG_MXC_HDMI_CSI2_TC358743 is not set +-# CONFIG_MXC_TVIN_ADV7180 is not set +-CONFIG_MXC_IPU_DEVICE_QUEUE_SDC=m +-CONFIG_MXC_IPU_PRP_ENC=m +-CONFIG_MXC_IPU_CSI_ENC=m +-CONFIG_VIDEO_MXC_IPU_OUTPUT=y +-CONFIG_VIDEO_MXC_PXP_V4L2=y +-CONFIG_SOC_CAMERA=y +-CONFIG_SOC_CAMERA_PLATFORM=y +-# CONFIG_VIDEO_XILINX is not set +-CONFIG_V4L_MEM2MEM_DRIVERS=y +-# CONFIG_VIDEO_CODA is not set +-CONFIG_VIDEO_MEM2MEM_DEINTERLACE=m +-CONFIG_VIDEO_SH_VEU=m +-# CONFIG_V4L_TEST_DRIVERS is not set +-# CONFIG_DVB_PLATFORM_DRIVERS is not set +- +-# +-# Supported MMC/SDIO adapters +-# +-CONFIG_SMS_SDIO_DRV=m +-CONFIG_RADIO_ADAPTERS=y +-CONFIG_RADIO_TEA575X=m +-CONFIG_RADIO_SI470X=y +-CONFIG_USB_SI470X=m +-CONFIG_I2C_SI470X=m +-CONFIG_RADIO_SI4713=m +-CONFIG_USB_SI4713=m +-CONFIG_PLATFORM_SI4713=m +-CONFIG_I2C_SI4713=m +-CONFIG_RADIO_SI476X=m +-CONFIG_USB_MR800=m +-CONFIG_USB_DSBR=m +-CONFIG_RADIO_MAXIRADIO=m +-CONFIG_RADIO_SHARK=m +-CONFIG_RADIO_SHARK2=m +-CONFIG_USB_KEENE=m +-CONFIG_USB_RAREMONO=m +-CONFIG_USB_MA901=m +-CONFIG_RADIO_TEA5764=m +-CONFIG_RADIO_SAA7706H=m +-CONFIG_RADIO_TEF6862=m +-CONFIG_RADIO_WL1273=m +- +-# +-# Texas Instruments WL128x FM driver (ST based) +-# +-CONFIG_RADIO_WL128X=m +-CONFIG_MEDIA_COMMON_OPTIONS=y +- +-# +-# common driver options +-# +-CONFIG_VIDEO_CX2341X=m +-CONFIG_VIDEO_TVEEPROM=m +-CONFIG_CYPRESS_FIRMWARE=m +-CONFIG_DVB_B2C2_FLEXCOP=m +-CONFIG_VIDEO_SAA7146=m +-CONFIG_VIDEO_SAA7146_VV=m +-CONFIG_SMS_SIANO_MDTV=m +-CONFIG_SMS_SIANO_RC=y +-# CONFIG_SMS_SIANO_DEBUGFS is not set +- +-# +-# Media ancillary drivers (tuners, sensors, i2c, frontends) +-# +-# CONFIG_MEDIA_SUBDRV_AUTOSELECT is not set +-CONFIG_MEDIA_ATTACH=y +-CONFIG_VIDEO_IR_I2C=m +- +-# +-# Encoders, decoders, sensors and other helper chips +-# +- +-# +-# Audio decoders, processors and mixers +-# +-CONFIG_VIDEO_TVAUDIO=m +-CONFIG_VIDEO_TDA7432=m +-CONFIG_VIDEO_TDA9840=m +-CONFIG_VIDEO_TEA6415C=m +-CONFIG_VIDEO_TEA6420=m +-CONFIG_VIDEO_MSP3400=m +-CONFIG_VIDEO_CS5345=m +-CONFIG_VIDEO_CS53L32A=m +-CONFIG_VIDEO_TLV320AIC23B=m +-CONFIG_VIDEO_UDA1342=m +-CONFIG_VIDEO_WM8775=m +-CONFIG_VIDEO_WM8739=m +-CONFIG_VIDEO_VP27SMPX=m +-CONFIG_VIDEO_SONY_BTF_MPX=m +- +-# +-# RDS decoders +-# +-CONFIG_VIDEO_SAA6588=m +- +-# +-# Video decoders +-# +-CONFIG_VIDEO_ADV7180=m +-CONFIG_VIDEO_ADV7183=m +-CONFIG_VIDEO_ADV7604=m +-CONFIG_VIDEO_ADV7842=m +-CONFIG_VIDEO_BT819=m +-CONFIG_VIDEO_BT856=m +-CONFIG_VIDEO_BT866=m +-CONFIG_VIDEO_KS0127=m +-CONFIG_VIDEO_ML86V7667=m +-CONFIG_VIDEO_SAA7110=m +-CONFIG_VIDEO_SAA711X=m +-CONFIG_VIDEO_TC358743=m +-CONFIG_VIDEO_TVP514X=m +-CONFIG_VIDEO_TVP5150=m +-CONFIG_VIDEO_TVP7002=m +-CONFIG_VIDEO_TW2804=m +-CONFIG_VIDEO_TW9903=m +-CONFIG_VIDEO_TW9906=m +-CONFIG_VIDEO_VPX3220=m +- +-# +-# Video and audio decoders +-# +-CONFIG_VIDEO_SAA717X=m +-CONFIG_VIDEO_CX25840=m +- +-# +-# Video encoders +-# +-CONFIG_VIDEO_SAA7127=m +-CONFIG_VIDEO_SAA7185=m +-CONFIG_VIDEO_ADV7170=m +-CONFIG_VIDEO_ADV7175=m +-CONFIG_VIDEO_ADV7343=m +-CONFIG_VIDEO_ADV7393=m +-CONFIG_VIDEO_ADV7511=m +-CONFIG_VIDEO_AD9389B=m +-CONFIG_VIDEO_AK881X=m +-CONFIG_VIDEO_THS8200=m +- +-# +-# Camera sensor devices +-# +-CONFIG_VIDEO_APTINA_PLL=m +-CONFIG_VIDEO_SMIAPP_PLL=m +-CONFIG_VIDEO_OV2659=m +-CONFIG_VIDEO_OV7640=m +-CONFIG_VIDEO_OV7670=m +-CONFIG_VIDEO_OV9650=m +-CONFIG_VIDEO_VS6624=m +-CONFIG_VIDEO_MT9M032=m +-CONFIG_VIDEO_MT9P031=m +-CONFIG_VIDEO_MT9T001=m +-CONFIG_VIDEO_MT9V011=m +-CONFIG_VIDEO_MT9V032=m +-CONFIG_VIDEO_SR030PC30=m +-CONFIG_VIDEO_NOON010PC30=m +-CONFIG_VIDEO_M5MOLS=m +-CONFIG_VIDEO_S5K6AA=m +-CONFIG_VIDEO_S5K6A3=m +-CONFIG_VIDEO_S5K4ECGX=m +-CONFIG_VIDEO_S5K5BAF=m +-CONFIG_VIDEO_SMIAPP=m +-CONFIG_VIDEO_S5C73M3=m +- +-# +-# Flash devices +-# +-CONFIG_VIDEO_ADP1653=m +-CONFIG_VIDEO_AS3645A=m +-CONFIG_VIDEO_LM3560=m +-CONFIG_VIDEO_LM3646=m +- +-# +-# Video improvement chips +-# +-CONFIG_VIDEO_UPD64031A=m +-CONFIG_VIDEO_UPD64083=m +- +-# +-# Audio/Video compression chips +-# +-CONFIG_VIDEO_SAA6752HS=m +- +-# +-# Miscellaneous helper chips +-# +-CONFIG_VIDEO_THS7303=m +-CONFIG_VIDEO_M52790=m +- +-# +-# Sensors used on soc_camera driver +-# +- +-# +-# soc_camera sensor drivers +-# +-CONFIG_SOC_CAMERA_IMX074=m +-CONFIG_SOC_CAMERA_MT9M001=m +-CONFIG_SOC_CAMERA_MT9M111=m +-CONFIG_SOC_CAMERA_MT9T031=m +-CONFIG_SOC_CAMERA_MT9T112=m +-CONFIG_SOC_CAMERA_MT9V022=m +-CONFIG_SOC_CAMERA_OV2640=m +-CONFIG_SOC_CAMERA_OV5642=m +-CONFIG_SOC_CAMERA_OV6650=m +-CONFIG_SOC_CAMERA_OV772X=m +-CONFIG_SOC_CAMERA_OV9640=m +-CONFIG_SOC_CAMERA_OV9740=m +-CONFIG_SOC_CAMERA_RJ54N1=m +-CONFIG_SOC_CAMERA_TW9910=m +-CONFIG_MEDIA_TUNER=y +- +-# +-# Customize TV tuners +-# +-CONFIG_MEDIA_TUNER_SIMPLE=m +-CONFIG_MEDIA_TUNER_TDA8290=m +-CONFIG_MEDIA_TUNER_TDA827X=m +-CONFIG_MEDIA_TUNER_TDA18271=m +-CONFIG_MEDIA_TUNER_TDA9887=m +-CONFIG_MEDIA_TUNER_TEA5761=m +-CONFIG_MEDIA_TUNER_TEA5767=m +-CONFIG_MEDIA_TUNER_MSI001=m +-CONFIG_MEDIA_TUNER_MT20XX=m +-CONFIG_MEDIA_TUNER_MT2060=m +-CONFIG_MEDIA_TUNER_MT2063=m +-CONFIG_MEDIA_TUNER_MT2266=m +-CONFIG_MEDIA_TUNER_MT2131=m +-CONFIG_MEDIA_TUNER_QT1010=m +-CONFIG_MEDIA_TUNER_XC2028=m +-CONFIG_MEDIA_TUNER_XC5000=m +-CONFIG_MEDIA_TUNER_XC4000=m +-CONFIG_MEDIA_TUNER_MXL5005S=m +-CONFIG_MEDIA_TUNER_MXL5007T=m +-CONFIG_MEDIA_TUNER_MC44S803=m +-CONFIG_MEDIA_TUNER_MAX2165=m +-CONFIG_MEDIA_TUNER_TDA18218=m +-CONFIG_MEDIA_TUNER_FC0011=m +-CONFIG_MEDIA_TUNER_FC0012=m +-CONFIG_MEDIA_TUNER_FC0013=m +-CONFIG_MEDIA_TUNER_TDA18212=m +-CONFIG_MEDIA_TUNER_E4000=m +-CONFIG_MEDIA_TUNER_FC2580=m +-CONFIG_MEDIA_TUNER_M88RS6000T=m +-CONFIG_MEDIA_TUNER_TUA9001=m +-CONFIG_MEDIA_TUNER_SI2157=m +-CONFIG_MEDIA_TUNER_IT913X=m +-CONFIG_MEDIA_TUNER_R820T=m +-CONFIG_MEDIA_TUNER_MXL301RF=m +-CONFIG_MEDIA_TUNER_QM1D1C0042=m +- +-# +-# Customise DVB Frontends +-# +- +-# +-# Multistandard (satellite) frontends +-# +-CONFIG_DVB_STB0899=m +-CONFIG_DVB_STB6100=m +-CONFIG_DVB_STV090x=m +-CONFIG_DVB_STV6110x=m +-CONFIG_DVB_M88DS3103=m +- +-# +-# Multistandard (cable + terrestrial) frontends +-# +-CONFIG_DVB_DRXK=m +-CONFIG_DVB_TDA18271C2DD=m +-CONFIG_DVB_SI2165=m +- +-# +-# DVB-S (satellite) frontends +-# +-CONFIG_DVB_CX24110=m +-CONFIG_DVB_CX24123=m +-CONFIG_DVB_MT312=m +-CONFIG_DVB_ZL10036=m +-CONFIG_DVB_ZL10039=m +-CONFIG_DVB_S5H1420=m +-CONFIG_DVB_STV0288=m +-CONFIG_DVB_STB6000=m +-CONFIG_DVB_STV0299=m +-CONFIG_DVB_STV6110=m +-CONFIG_DVB_STV0900=m +-CONFIG_DVB_TDA8083=m +-CONFIG_DVB_TDA10086=m +-CONFIG_DVB_TDA8261=m +-CONFIG_DVB_VES1X93=m +-CONFIG_DVB_TUNER_ITD1000=m +-CONFIG_DVB_TUNER_CX24113=m +-CONFIG_DVB_TDA826X=m +-CONFIG_DVB_TUA6100=m +-CONFIG_DVB_CX24116=m +-CONFIG_DVB_CX24117=m +-CONFIG_DVB_CX24120=m +-CONFIG_DVB_SI21XX=m +-CONFIG_DVB_TS2020=m +-CONFIG_DVB_DS3000=m +-CONFIG_DVB_MB86A16=m +-CONFIG_DVB_TDA10071=m +- +-# +-# DVB-T (terrestrial) frontends +-# +-CONFIG_DVB_SP8870=m +-CONFIG_DVB_SP887X=m +-CONFIG_DVB_CX22700=m +-CONFIG_DVB_CX22702=m +-CONFIG_DVB_S5H1432=m +-CONFIG_DVB_DRXD=m +-CONFIG_DVB_L64781=m +-CONFIG_DVB_TDA1004X=m +-CONFIG_DVB_NXT6000=m +-CONFIG_DVB_MT352=m +-CONFIG_DVB_ZL10353=m +-CONFIG_DVB_DIB3000MB=m +-CONFIG_DVB_DIB3000MC=m +-CONFIG_DVB_DIB7000M=m +-CONFIG_DVB_DIB7000P=m +-CONFIG_DVB_DIB9000=m +-CONFIG_DVB_TDA10048=m +-CONFIG_DVB_AF9013=m +-CONFIG_DVB_EC100=m +-CONFIG_DVB_HD29L2=m +-CONFIG_DVB_STV0367=m +-CONFIG_DVB_CXD2820R=m +-CONFIG_DVB_CXD2841ER=m +-CONFIG_DVB_RTL2830=m +-CONFIG_DVB_RTL2832=m +-CONFIG_DVB_RTL2832_SDR=m +-CONFIG_DVB_SI2168=m +-CONFIG_DVB_AS102_FE=m +- +-# +-# DVB-C (cable) frontends +-# +-CONFIG_DVB_VES1820=m +-CONFIG_DVB_TDA10021=m +-CONFIG_DVB_TDA10023=m +-CONFIG_DVB_STV0297=m +- +-# +-# ATSC (North American/Korean Terrestrial/Cable DTV) frontends +-# +-CONFIG_DVB_NXT200X=m +-CONFIG_DVB_OR51211=m +-CONFIG_DVB_OR51132=m +-CONFIG_DVB_BCM3510=m +-CONFIG_DVB_LGDT330X=m +-CONFIG_DVB_LGDT3305=m +-CONFIG_DVB_LGDT3306A=m +-CONFIG_DVB_LG2160=m +-CONFIG_DVB_S5H1409=m +-CONFIG_DVB_AU8522=m +-CONFIG_DVB_AU8522_DTV=m +-CONFIG_DVB_AU8522_V4L=m +-CONFIG_DVB_S5H1411=m +- +-# +-# ISDB-T (terrestrial) frontends +-# +-CONFIG_DVB_S921=m +-CONFIG_DVB_DIB8000=m +-CONFIG_DVB_MB86A20S=m +- +-# +-# ISDB-S (satellite) & ISDB-T (terrestrial) frontends +-# +-CONFIG_DVB_TC90522=m +- +-# +-# Digital terrestrial only tuners/PLL +-# +-CONFIG_DVB_PLL=m +-CONFIG_DVB_TUNER_DIB0070=m +-CONFIG_DVB_TUNER_DIB0090=m +- +-# +-# SEC control devices for DVB-S +-# +-CONFIG_DVB_DRX39XYJ=m +-CONFIG_DVB_LNBH25=m +-CONFIG_DVB_LNBP21=m +-CONFIG_DVB_LNBP22=m +-CONFIG_DVB_ISL6405=m +-CONFIG_DVB_ISL6421=m +-CONFIG_DVB_ISL6423=m +-CONFIG_DVB_A8293=m +-CONFIG_DVB_SP2=m +-CONFIG_DVB_LGS8GL5=m +-CONFIG_DVB_LGS8GXX=m +-CONFIG_DVB_ATBM8830=m +-CONFIG_DVB_TDA665x=m +-CONFIG_DVB_IX2505V=m +-CONFIG_DVB_M88RS2000=m +-CONFIG_DVB_AF9033=m +-CONFIG_DVB_HORUS3A=m +-CONFIG_DVB_ASCOT2E=m +- +-# +-# Tools to develop new frontends +-# +-CONFIG_DVB_DUMMY_FE=m +- +-# +-# Graphics support +-# +-CONFIG_VGA_ARB=y +-CONFIG_VGA_ARB_MAX_GPUS=16 +-# CONFIG_IMX_IPUV3_CORE is not set +-CONFIG_DRM=y +-# CONFIG_DRM_FBDEV_EMULATION is not set +-# CONFIG_DRM_TDFX is not set +-# CONFIG_DRM_R128 is not set +-# CONFIG_DRM_RADEON is not set +-# CONFIG_DRM_AMDGPU is not set +-# CONFIG_DRM_NOUVEAU is not set +-# CONFIG_DRM_MGA is not set +-# CONFIG_DRM_VIA is not set +-# CONFIG_DRM_SAVAGE is not set +-# CONFIG_DRM_VGEM is not set +-# CONFIG_DRM_EXYNOS is not set +-# CONFIG_DRM_UDL is not set +-# CONFIG_DRM_AST is not set +-# CONFIG_DRM_MGAG200 is not set +-# CONFIG_DRM_CIRRUS_QEMU is not set +-# CONFIG_DRM_ARMADA is not set +-# CONFIG_DRM_TILCDC is not set +-# CONFIG_DRM_QXL is not set +-# CONFIG_DRM_BOCHS is not set +-# CONFIG_DRM_FSL_DCU is not set +-CONFIG_DRM_BRIDGE=y +- +-# +-# Display Interface Bridges +-# +-# CONFIG_DRM_NXP_PTN3460 is not set +-# CONFIG_DRM_PARADE_PS8622 is not set +-# CONFIG_DRM_STI is not set +-CONFIG_DRM_VIVANTE=m +- +-# +-# Frame buffer Devices +-# +-CONFIG_FB=y +-CONFIG_FIRMWARE_EDID=y +-CONFIG_FB_CMDLINE=y +-# CONFIG_FB_DDC is not set +-# CONFIG_FB_BOOT_VESA_SUPPORT is not set +-CONFIG_FB_CFB_FILLRECT=y +-CONFIG_FB_CFB_COPYAREA=y +-CONFIG_FB_CFB_IMAGEBLIT=y +-# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set +-CONFIG_FB_SYS_FILLRECT=m +-CONFIG_FB_SYS_COPYAREA=m +-CONFIG_FB_SYS_IMAGEBLIT=m +-# CONFIG_FB_FOREIGN_ENDIAN is not set +-CONFIG_FB_SYS_FOPS=m +-CONFIG_FB_DEFERRED_IO=y +-# CONFIG_FB_SVGALIB is not set +-# CONFIG_FB_MACMODES is not set +-CONFIG_FB_BACKLIGHT=y +-CONFIG_FB_MODE_HELPERS=y +-# CONFIG_FB_TILEBLITTING is not set +- +-# +-# Frame buffer hardware drivers +-# +-# CONFIG_FB_CIRRUS is not set +-# CONFIG_FB_PM2 is not set +-# CONFIG_FB_IMX is not set +-# CONFIG_FB_CYBER2000 is not set +-# CONFIG_FB_ASILIANT is not set +-# CONFIG_FB_IMSTT is not set +-# CONFIG_FB_UVESA is not set +-# CONFIG_FB_OPENCORES is not set +-# CONFIG_FB_S1D13XXX is not set +-# CONFIG_FB_NVIDIA is not set +-# CONFIG_FB_RIVA is not set +-# CONFIG_FB_I740 is not set +-# CONFIG_FB_MATROX is not set +-# CONFIG_FB_RADEON is not set +-# CONFIG_FB_ATY128 is not set +-# CONFIG_FB_ATY is not set +-# CONFIG_FB_S3 is not set +-# CONFIG_FB_SAVAGE is not set +-# CONFIG_FB_SIS is not set +-# CONFIG_FB_NEOMAGIC is not set +-# CONFIG_FB_KYRO is not set +-# CONFIG_FB_3DFX is not set +-# CONFIG_FB_VOODOO1 is not set +-# CONFIG_FB_VT8623 is not set +-# CONFIG_FB_TRIDENT is not set +-# CONFIG_FB_ARK is not set +-# CONFIG_FB_PM3 is not set +-# CONFIG_FB_CARMINE is not set +-# CONFIG_FB_SMSCUFX is not set +-CONFIG_FB_UDL=m +-# CONFIG_FB_IBM_GXT4500 is not set +-# CONFIG_FB_VIRTUAL is not set +-# CONFIG_FB_METRONOME is not set +-# CONFIG_FB_MB862XX is not set +-# CONFIG_FB_BROADSHEET is not set +-# CONFIG_FB_AUO_K190X is not set +-# CONFIG_FB_MXS is not set +-# CONFIG_FB_SIMPLE is not set +-# CONFIG_FB_SSD1307 is not set +-# CONFIG_FB_SM712 is not set +-CONFIG_FB_MXC=y +-CONFIG_FB_MXC_SYNC_PANEL=y +-# CONFIG_FB_MXC_TVOUT_ADV739X is not set +-CONFIG_FB_MXC_LDB=y +-# CONFIG_FB_MXC_MIPI_DSI is not set +-CONFIG_FB_MXC_HDMI=y +-CONFIG_FB_MXC_DCIC=y +-CONFIG_FB_MXC_EDID=y +-# CONFIG_FB_MXC_EINK_PANEL is not set +-CONFIG_BACKLIGHT_LCD_SUPPORT=y +-CONFIG_LCD_CLASS_DEVICE=m +-# CONFIG_LCD_L4F00242T03 is not set +-# CONFIG_LCD_LMS283GF05 is not set +-# CONFIG_LCD_LTV350QV is not set +-# CONFIG_LCD_ILI922X is not set +-# CONFIG_LCD_ILI9320 is not set +-# CONFIG_LCD_TDO24M is not set +-# CONFIG_LCD_VGG2432A4 is not set +-CONFIG_LCD_PLATFORM=m +-# CONFIG_LCD_S6E63M0 is not set +-# CONFIG_LCD_LD9040 is not set +-# CONFIG_LCD_AMS369FG06 is not set +-# CONFIG_LCD_LMS501KF03 is not set +-# CONFIG_LCD_HX8357 is not set +-CONFIG_BACKLIGHT_CLASS_DEVICE=y +-# CONFIG_BACKLIGHT_GENERIC is not set +-CONFIG_BACKLIGHT_PWM=m +-# CONFIG_BACKLIGHT_DA9052 is not set +-# CONFIG_BACKLIGHT_PM8941_WLED is not set +-# CONFIG_BACKLIGHT_ADP8860 is not set +-# CONFIG_BACKLIGHT_ADP8870 is not set +-# CONFIG_BACKLIGHT_LM3630A is not set +-# CONFIG_BACKLIGHT_LM3639 is not set +-# CONFIG_BACKLIGHT_LP855X is not set +-# CONFIG_BACKLIGHT_GPIO is not set +-# CONFIG_BACKLIGHT_LV5207LP is not set +-# CONFIG_BACKLIGHT_BD6107 is not set +-# CONFIG_VGASTATE is not set +-CONFIG_VIDEOMODE_HELPERS=y +-CONFIG_HDMI=y +- +-# +-# Console display driver support +-# +-CONFIG_DUMMY_CONSOLE=y +-CONFIG_FRAMEBUFFER_CONSOLE=y +-CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y +-# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set +-# CONFIG_LOGO is not set +-CONFIG_SOUND=y +-# CONFIG_SOUND_OSS_CORE is not set +-CONFIG_SND=y +-CONFIG_SND_TIMER=y +-CONFIG_SND_PCM=y +-CONFIG_SND_DMAENGINE_PCM=y +-CONFIG_SND_HWDEP=m +-CONFIG_SND_RAWMIDI=m +-CONFIG_SND_JACK=y +-# CONFIG_SND_SEQUENCER is not set +-# CONFIG_SND_MIXER_OSS is not set +-# CONFIG_SND_PCM_OSS is not set +-CONFIG_SND_PCM_TIMER=y +-CONFIG_SND_HRTIMER=y +-# CONFIG_SND_DYNAMIC_MINORS is not set +-# CONFIG_SND_SUPPORT_OLD_API is not set +-CONFIG_SND_PROC_FS=y +-# CONFIG_SND_VERBOSE_PROCFS is not set +-# CONFIG_SND_VERBOSE_PRINTK is not set +-# CONFIG_SND_DEBUG is not set +-CONFIG_SND_VMASTER=y +-# CONFIG_SND_RAWMIDI_SEQ is not set +-# CONFIG_SND_OPL3_LIB_SEQ is not set +-# CONFIG_SND_OPL4_LIB_SEQ is not set +-# CONFIG_SND_SBAWE_SEQ is not set +-# CONFIG_SND_EMU10K1_SEQ is not set +-CONFIG_SND_MPU401_UART=m +-CONFIG_SND_AC97_CODEC=m +-CONFIG_SND_DRIVERS=y +-CONFIG_SND_DUMMY=m +-CONFIG_SND_ALOOP=m +-CONFIG_SND_MTPAV=m +-CONFIG_SND_SERIAL_U16550=m +-CONFIG_SND_MPU401=m +-CONFIG_SND_AC97_POWER_SAVE=y +-CONFIG_SND_AC97_POWER_SAVE_DEFAULT=1 +-# CONFIG_SND_PCI is not set +- +-# +-# HD-Audio +-# +-CONFIG_SND_HDA_PREALLOC_SIZE=64 +-CONFIG_SND_ARM=y +-CONFIG_SND_SPI=y +-CONFIG_SND_USB=y +-CONFIG_SND_USB_AUDIO=m +-CONFIG_SND_USB_UA101=m +-CONFIG_SND_USB_CAIAQ=m +-CONFIG_SND_USB_CAIAQ_INPUT=y +-CONFIG_SND_USB_6FIRE=m +-CONFIG_SND_USB_HIFACE=m +-CONFIG_SND_BCD2000=m +-CONFIG_SND_USB_LINE6=m +-CONFIG_SND_USB_POD=m +-CONFIG_SND_USB_PODHD=m +-CONFIG_SND_USB_TONEPORT=m +-CONFIG_SND_USB_VARIAX=m +-CONFIG_SND_SOC=y +-CONFIG_SND_SOC_GENERIC_DMAENGINE_PCM=y +-# CONFIG_SND_ATMEL_SOC is not set +-# CONFIG_SND_DESIGNWARE_I2S is not set +- +-# +-# SoC Audio for Freescale CPUs +-# +- +-# +-# Common SoC Audio options for Freescale CPUs: +-# +-# CONFIG_SND_SOC_FSL_ASRC is not set +-CONFIG_SND_SOC_FSL_SAI=y +-CONFIG_SND_SOC_FSL_SSI=y +-CONFIG_SND_SOC_FSL_SPDIF=y +-CONFIG_SND_SOC_FSL_ESAI=y +-CONFIG_SND_SOC_FSL_HDMI=y +-CONFIG_SND_SOC_FSL_UTILS=y +-CONFIG_SND_SOC_IMX_PCM_DMA=y +-CONFIG_SND_SOC_IMX_HDMI_DMA=y +-CONFIG_SND_SOC_IMX_AUDMUX=y +-CONFIG_SND_IMX_SOC=y +- +-# +-# SoC Audio support for Freescale i.MX boards: +-# +-# CONFIG_SND_SOC_EUKREA_TLV320 is not set +-# CONFIG_SND_SOC_IMX_WM8731 is not set +-# CONFIG_SND_SOC_IMX_WM8962 is not set +-# CONFIG_SND_SOC_IMX_ES8328 is not set +-CONFIG_SND_SOC_IMX_SGTL5000=y +-# CONFIG_SND_SOC_IMX_AC97_VT1613 is not set +-CONFIG_SND_SOC_IMX_SPDIF=y +-# CONFIG_SND_SOC_IMX_MC13783 is not set +-CONFIG_SND_SOC_IMX_HDMI=y +-CONFIG_SND_SOC_FSL_ASOC_CARD=m +-# CONFIG_SND_SOC_IMX_TDA1997X is not set +- +-# +-# Allwinner SoC Audio support +-# +-# CONFIG_SND_SUN4I_CODEC is not set +-# CONFIG_SND_SOC_XTFPGA_I2S is not set +-CONFIG_SND_SOC_I2C_AND_SPI=y +- +-# +-# CODEC drivers +-# +-# CONFIG_SND_SOC_AC97_CODEC is not set +-# CONFIG_SND_SOC_ADAU1701 is not set +-# CONFIG_SND_SOC_AK4104 is not set +-# CONFIG_SND_SOC_AK4554 is not set +-# CONFIG_SND_SOC_AK4613 is not set +-# CONFIG_SND_SOC_AK4642 is not set +-# CONFIG_SND_SOC_AK5386 is not set +-# CONFIG_SND_SOC_ALC5623 is not set +-# CONFIG_SND_SOC_CS35L32 is not set +-# CONFIG_SND_SOC_CS42L51_I2C is not set +-# CONFIG_SND_SOC_CS42L52 is not set +-# CONFIG_SND_SOC_CS42L56 is not set +-# CONFIG_SND_SOC_CS42L73 is not set +-# CONFIG_SND_SOC_CS4265 is not set +-# CONFIG_SND_SOC_CS4270 is not set +-# CONFIG_SND_SOC_CS4271_I2C is not set +-# CONFIG_SND_SOC_CS4271_SPI is not set +-# CONFIG_SND_SOC_CS42XX8_I2C is not set +-# CONFIG_SND_SOC_CS4349 is not set +-CONFIG_SND_SOC_HDMI_CODEC=y +-# CONFIG_SND_SOC_ES8328 is not set +-# CONFIG_SND_SOC_GTM601 is not set +-# CONFIG_SND_SOC_PCM1681 is not set +-# CONFIG_SND_SOC_PCM1792A is not set +-# CONFIG_SND_SOC_PCM512x_I2C is not set +-# CONFIG_SND_SOC_PCM512x_SPI is not set +-# CONFIG_SND_SOC_RT5631 is not set +-# CONFIG_SND_SOC_RT5677_SPI is not set +-CONFIG_SND_SOC_SGTL5000=y +-CONFIG_SND_SOC_SI476X=m +-# CONFIG_SND_SOC_SIRF_AUDIO_CODEC is not set +-CONFIG_SND_SOC_SPDIF=y +-# CONFIG_SND_SOC_SSM2602_SPI is not set +-# CONFIG_SND_SOC_SSM2602_I2C is not set +-# CONFIG_SND_SOC_SSM4567 is not set +-# CONFIG_SND_SOC_STA32X is not set +-# CONFIG_SND_SOC_STA350 is not set +-# CONFIG_SND_SOC_STI_SAS is not set +-# CONFIG_SND_SOC_TAS2552 is not set +-# CONFIG_SND_SOC_TAS5086 is not set +-# CONFIG_SND_SOC_TAS571X is not set +-# CONFIG_SND_SOC_TFA9879 is not set +-# CONFIG_SND_SOC_TLV320AIC23_I2C is not set +-# CONFIG_SND_SOC_TLV320AIC23_SPI is not set +-# CONFIG_SND_SOC_TLV320AIC31XX is not set +-# CONFIG_SND_SOC_TLV320AIC3X is not set +-# CONFIG_SND_SOC_TS3A227E is not set +-# CONFIG_SND_SOC_WM8510 is not set +-# CONFIG_SND_SOC_WM8523 is not set +-# CONFIG_SND_SOC_WM8580 is not set +-# CONFIG_SND_SOC_WM8711 is not set +-# CONFIG_SND_SOC_WM8728 is not set +-# CONFIG_SND_SOC_WM8731 is not set +-# CONFIG_SND_SOC_WM8737 is not set +-# CONFIG_SND_SOC_WM8741 is not set +-# CONFIG_SND_SOC_WM8750 is not set +-# CONFIG_SND_SOC_WM8753 is not set +-# CONFIG_SND_SOC_WM8770 is not set +-# CONFIG_SND_SOC_WM8776 is not set +-# CONFIG_SND_SOC_WM8804_I2C is not set +-# CONFIG_SND_SOC_WM8804_SPI is not set +-# CONFIG_SND_SOC_WM8903 is not set +-CONFIG_SND_SOC_WM8962=m +-# CONFIG_SND_SOC_WM8978 is not set +-# CONFIG_SND_SOC_TPA6130A2 is not set +-# CONFIG_SND_SIMPLE_CARD is not set +-# CONFIG_SOUND_PRIME is not set +-CONFIG_AC97_BUS=m +- +-# +-# HID support +-# +-CONFIG_HID=y +-CONFIG_HID_BATTERY_STRENGTH=y +-CONFIG_HIDRAW=y +-CONFIG_UHID=m +-CONFIG_HID_GENERIC=y +- +-# +-# Special HID drivers +-# +-CONFIG_HID_A4TECH=m +-CONFIG_HID_ACRUX=m +-CONFIG_HID_ACRUX_FF=y +-CONFIG_HID_APPLE=m +-CONFIG_HID_APPLEIR=m +-CONFIG_HID_AUREAL=m +-CONFIG_HID_BELKIN=m +-CONFIG_HID_BETOP_FF=m +-CONFIG_HID_CHERRY=m +-CONFIG_HID_CHICONY=m +-# CONFIG_HID_CORSAIR is not set +-CONFIG_HID_PRODIKEYS=m +-CONFIG_HID_CP2112=m +-CONFIG_HID_CYPRESS=m +-CONFIG_HID_DRAGONRISE=m +-CONFIG_DRAGONRISE_FF=y +-CONFIG_HID_EMS_FF=m +-CONFIG_HID_ELECOM=m +-CONFIG_HID_ELO=m +-CONFIG_HID_EZKEY=m +-# CONFIG_HID_GEMBIRD is not set +-# CONFIG_HID_GFRM is not set +-CONFIG_HID_HOLTEK=m +-CONFIG_HOLTEK_FF=y +-CONFIG_HID_GT683R=m +-CONFIG_HID_KEYTOUCH=m +-CONFIG_HID_KYE=m +-CONFIG_HID_UCLOGIC=m +-CONFIG_HID_WALTOP=m +-CONFIG_HID_GYRATION=m +-CONFIG_HID_ICADE=m +-CONFIG_HID_TWINHAN=m +-CONFIG_HID_KENSINGTON=m +-CONFIG_HID_LCPOWER=m +-CONFIG_HID_LENOVO=m +-CONFIG_HID_LOGITECH=m +-CONFIG_HID_LOGITECH_DJ=m +-CONFIG_HID_LOGITECH_HIDPP=m +-CONFIG_LOGITECH_FF=y +-CONFIG_LOGIRUMBLEPAD2_FF=y +-CONFIG_LOGIG940_FF=y +-CONFIG_LOGIWHEELS_FF=y +-CONFIG_HID_MAGICMOUSE=m +-CONFIG_HID_MICROSOFT=m +-CONFIG_HID_MONTEREY=m +-CONFIG_HID_MULTITOUCH=m +-CONFIG_HID_NTRIG=m +-CONFIG_HID_ORTEK=m +-CONFIG_HID_PANTHERLORD=m +-CONFIG_PANTHERLORD_FF=y +-CONFIG_HID_PENMOUNT=m +-CONFIG_HID_PETALYNX=m +-CONFIG_HID_PICOLCD=m +-CONFIG_HID_PICOLCD_FB=y +-CONFIG_HID_PICOLCD_BACKLIGHT=y +-CONFIG_HID_PICOLCD_LCD=y +-CONFIG_HID_PICOLCD_LEDS=y +-CONFIG_HID_PICOLCD_CIR=y +-CONFIG_HID_PLANTRONICS=m +-CONFIG_HID_PRIMAX=m +-CONFIG_HID_ROCCAT=m +-CONFIG_HID_SAITEK=m +-CONFIG_HID_SAMSUNG=m +-CONFIG_HID_SONY=m +-CONFIG_SONY_FF=y +-CONFIG_HID_SPEEDLINK=m +-CONFIG_HID_STEELSERIES=m +-CONFIG_HID_SUNPLUS=m +-CONFIG_HID_RMI=m +-CONFIG_HID_GREENASIA=m +-CONFIG_GREENASIA_FF=y +-CONFIG_HID_SMARTJOYPLUS=m +-CONFIG_SMARTJOYPLUS_FF=y +-CONFIG_HID_TIVO=m +-CONFIG_HID_TOPSEED=m +-CONFIG_HID_THINGM=m +-CONFIG_HID_THRUSTMASTER=m +-CONFIG_THRUSTMASTER_FF=y +-CONFIG_HID_WACOM=m +-CONFIG_HID_WIIMOTE=m +-CONFIG_HID_XINMO=m +-CONFIG_HID_ZEROPLUS=m +-CONFIG_ZEROPLUS_FF=y +-CONFIG_HID_ZYDACRON=m +-CONFIG_HID_SENSOR_HUB=m +-CONFIG_HID_SENSOR_CUSTOM_SENSOR=m +- +-# +-# USB HID support +-# +-CONFIG_USB_HID=y +-CONFIG_HID_PID=y +-CONFIG_USB_HIDDEV=y +- +-# +-# I2C HID support +-# +-CONFIG_I2C_HID=m +-CONFIG_USB_OHCI_LITTLE_ENDIAN=y +-CONFIG_USB_SUPPORT=y +-CONFIG_USB_COMMON=y +-CONFIG_USB_ARCH_HAS_HCD=y +-CONFIG_USB=y +-# CONFIG_USB_ANNOUNCE_NEW_DEVICES is not set +- +-# +-# Miscellaneous USB options +-# +-CONFIG_USB_DEFAULT_PERSIST=y +-# CONFIG_USB_DYNAMIC_MINORS is not set +-CONFIG_USB_OTG=y +-# CONFIG_USB_OTG_WHITELIST is not set +-# CONFIG_USB_OTG_BLACKLIST_HUB is not set +-CONFIG_USB_OTG_FSM=y +-# CONFIG_USB_ULPI_BUS is not set +-# CONFIG_USB_MON is not set +-# CONFIG_USB_WUSB_CBAF is not set +- +-# +-# USB Host Controller Drivers +-# +-# CONFIG_USB_C67X00_HCD is not set +-# CONFIG_USB_XHCI_HCD is not set +-CONFIG_USB_EHCI_HCD=y +-CONFIG_USB_EHCI_ROOT_HUB_TT=y +-CONFIG_USB_EHCI_TT_NEWSCHED=y +-CONFIG_USB_FSL_MPH_DR_OF=m +-CONFIG_USB_EHCI_PCI=y +-CONFIG_USB_EHCI_MXC=y +-CONFIG_USB_EHCI_HCD_PLATFORM=y +-# CONFIG_USB_OXU210HP_HCD is not set +-# CONFIG_USB_ISP116X_HCD is not set +-# CONFIG_USB_ISP1362_HCD is not set +-# CONFIG_USB_FOTG210_HCD is not set +-# CONFIG_USB_MAX3421_HCD is not set +-# CONFIG_USB_OHCI_HCD is not set +-# CONFIG_USB_UHCI_HCD is not set +-# CONFIG_USB_SL811_HCD is not set +-# CONFIG_USB_R8A66597_HCD is not set +-# CONFIG_USB_IMX21_HCD is not set +-# CONFIG_USB_HCD_BCMA is not set +-# CONFIG_USB_HCD_SSB is not set +-# CONFIG_USB_HCD_TEST_MODE is not set +- +-# +-# USB Device Class drivers +-# +-CONFIG_USB_ACM=m +-CONFIG_USB_PRINTER=m +-CONFIG_USB_WDM=m +-# CONFIG_USB_TMC is not set +- +-# +-# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may +-# +- +-# +-# also be needed; see USB_STORAGE Help for more info +-# +-CONFIG_USB_STORAGE=y +-# CONFIG_USB_STORAGE_DEBUG is not set +-CONFIG_USB_STORAGE_REALTEK=y +-CONFIG_REALTEK_AUTOPM=y +-CONFIG_USB_STORAGE_DATAFAB=y +-CONFIG_USB_STORAGE_FREECOM=y +-CONFIG_USB_STORAGE_ISD200=y +-CONFIG_USB_STORAGE_USBAT=y +-CONFIG_USB_STORAGE_SDDR09=y +-CONFIG_USB_STORAGE_SDDR55=y +-CONFIG_USB_STORAGE_JUMPSHOT=y +-CONFIG_USB_STORAGE_ALAUDA=y +-CONFIG_USB_STORAGE_ONETOUCH=y +-CONFIG_USB_STORAGE_KARMA=m +-CONFIG_USB_STORAGE_CYPRESS_ATACB=y +-CONFIG_USB_STORAGE_ENE_UB6250=y +-CONFIG_USB_UAS=y +- +-# +-# USB Imaging devices +-# +-# CONFIG_USB_MDC800 is not set +-# CONFIG_USB_MICROTEK is not set +-CONFIG_USBIP_CORE=m +-CONFIG_USBIP_VHCI_HCD=m +-CONFIG_USBIP_HOST=m +-# CONFIG_USBIP_DEBUG is not set +-CONFIG_USB_MUSB_HDRC=m +-CONFIG_USB_MUSB_HOST=y +-# CONFIG_USB_MUSB_GADGET is not set +-# CONFIG_USB_MUSB_DUAL_ROLE is not set +- +-# +-# Platform Glue Layer +-# +- +-# +-# MUSB DMA mode +-# +-CONFIG_MUSB_PIO_ONLY=y +-CONFIG_USB_DWC3=m +-# CONFIG_USB_DWC3_HOST is not set +-# CONFIG_USB_DWC3_GADGET is not set +-CONFIG_USB_DWC3_DUAL_ROLE=y +- +-# +-# Platform Glue Driver Support +-# +-CONFIG_USB_DWC3_PCI=m +-CONFIG_USB_DWC2=m +-# CONFIG_USB_DWC2_HOST is not set +- +-# +-# Gadget/Dual-role mode requires USB Gadget support to be enabled +-# +-# CONFIG_USB_DWC2_PERIPHERAL is not set +-CONFIG_USB_DWC2_DUAL_ROLE=y +-CONFIG_USB_DWC2_PCI=m +-# CONFIG_USB_DWC2_DEBUG is not set +-# CONFIG_USB_DWC2_TRACK_MISSED_SOFS is not set +-CONFIG_USB_CHIPIDEA=y +-CONFIG_USB_CHIPIDEA_OF=y +-CONFIG_USB_CHIPIDEA_PCI=y +-# CONFIG_USB_CHIPIDEA_UDC is not set +-CONFIG_USB_CHIPIDEA_HOST=y +-# CONFIG_USB_CHIPIDEA_DEBUG is not set +-# CONFIG_USB_ISP1760 is not set +- +-# +-# USB port drivers +-# +-CONFIG_USB_SERIAL=y +-CONFIG_USB_SERIAL_CONSOLE=y +-CONFIG_USB_SERIAL_GENERIC=y +-CONFIG_USB_SERIAL_SIMPLE=m +-CONFIG_USB_SERIAL_AIRCABLE=m +-CONFIG_USB_SERIAL_ARK3116=m +-CONFIG_USB_SERIAL_BELKIN=m +-CONFIG_USB_SERIAL_CH341=m +-CONFIG_USB_SERIAL_WHITEHEAT=m +-CONFIG_USB_SERIAL_DIGI_ACCELEPORT=m +-CONFIG_USB_SERIAL_CP210X=m +-CONFIG_USB_SERIAL_CYPRESS_M8=m +-CONFIG_USB_SERIAL_EMPEG=m +-CONFIG_USB_SERIAL_FTDI_SIO=m +-CONFIG_USB_SERIAL_VISOR=m +-CONFIG_USB_SERIAL_IPAQ=m +-CONFIG_USB_SERIAL_IR=m +-CONFIG_USB_SERIAL_EDGEPORT=m +-CONFIG_USB_SERIAL_EDGEPORT_TI=m +-CONFIG_USB_SERIAL_F81232=m +-CONFIG_USB_SERIAL_GARMIN=m +-CONFIG_USB_SERIAL_IPW=m +-CONFIG_USB_SERIAL_IUU=m +-CONFIG_USB_SERIAL_KEYSPAN_PDA=m +-CONFIG_USB_SERIAL_KEYSPAN=m +-CONFIG_USB_SERIAL_KEYSPAN_MPR=y +-CONFIG_USB_SERIAL_KEYSPAN_USA28=y +-CONFIG_USB_SERIAL_KEYSPAN_USA28X=y +-CONFIG_USB_SERIAL_KEYSPAN_USA28XA=y +-CONFIG_USB_SERIAL_KEYSPAN_USA28XB=y +-CONFIG_USB_SERIAL_KEYSPAN_USA19=y +-CONFIG_USB_SERIAL_KEYSPAN_USA18X=y +-CONFIG_USB_SERIAL_KEYSPAN_USA19W=y +-CONFIG_USB_SERIAL_KEYSPAN_USA19QW=y +-CONFIG_USB_SERIAL_KEYSPAN_USA19QI=y +-CONFIG_USB_SERIAL_KEYSPAN_USA49W=y +-CONFIG_USB_SERIAL_KEYSPAN_USA49WLC=y +-CONFIG_USB_SERIAL_KLSI=m +-CONFIG_USB_SERIAL_KOBIL_SCT=m +-CONFIG_USB_SERIAL_MCT_U232=m +-CONFIG_USB_SERIAL_METRO=m +-CONFIG_USB_SERIAL_MOS7720=m +-CONFIG_USB_SERIAL_MOS7840=m +-CONFIG_USB_SERIAL_MXUPORT=m +-CONFIG_USB_SERIAL_NAVMAN=m +-CONFIG_USB_SERIAL_PL2303=m +-CONFIG_USB_SERIAL_OTI6858=m +-CONFIG_USB_SERIAL_QCAUX=m +-CONFIG_USB_SERIAL_QUALCOMM=m +-CONFIG_USB_SERIAL_SPCP8X5=m +-CONFIG_USB_SERIAL_SAFE=m +-CONFIG_USB_SERIAL_SAFE_PADDED=y +-CONFIG_USB_SERIAL_SIERRAWIRELESS=m +-CONFIG_USB_SERIAL_SYMBOL=m +-CONFIG_USB_SERIAL_TI=m +-CONFIG_USB_SERIAL_CYBERJACK=m +-CONFIG_USB_SERIAL_XIRCOM=m +-CONFIG_USB_SERIAL_WWAN=m +-CONFIG_USB_SERIAL_OPTION=m +-CONFIG_USB_SERIAL_OMNINET=m +-CONFIG_USB_SERIAL_OPTICON=m +-CONFIG_USB_SERIAL_XSENS_MT=m +-CONFIG_USB_SERIAL_WISHBONE=m +-CONFIG_USB_SERIAL_SSU100=m +-CONFIG_USB_SERIAL_QT2=m +-CONFIG_USB_SERIAL_DEBUG=m +- +-# +-# USB Miscellaneous drivers +-# +-CONFIG_USB_EMI62=m +-CONFIG_USB_EMI26=m +-# CONFIG_USB_ADUTUX is not set +-CONFIG_USB_SEVSEG=m +-CONFIG_USB_RIO500=m +-CONFIG_USB_LEGOTOWER=m +-CONFIG_USB_LCD=m +-CONFIG_USB_LED=m +-CONFIG_USB_CYPRESS_CY7C63=m +-CONFIG_USB_CYTHERM=m +-CONFIG_USB_IDMOUSE=m +-# CONFIG_USB_FTDI_ELAN is not set +-CONFIG_USB_APPLEDISPLAY=m +-CONFIG_USB_SISUSBVGA=m +-CONFIG_USB_SISUSBVGA_CON=y +-CONFIG_USB_LD=m +-CONFIG_USB_TRANCEVIBRATOR=m +-CONFIG_USB_IOWARRIOR=m +-# CONFIG_USB_TEST is not set +-# CONFIG_USB_EHSET_TEST_FIXTURE is not set +-CONFIG_USB_ISIGHTFW=m +-# CONFIG_USB_YUREX is not set +-CONFIG_USB_EZUSB_FX2=m +-CONFIG_USB_HSIC_USB3503=m +-# CONFIG_USB_LINK_LAYER_TEST is not set +-# CONFIG_USB_CHAOSKEY is not set +- +-# +-# USB Physical Layer drivers +-# +-CONFIG_USB_PHY=y +-CONFIG_NOP_USB_XCEIV=y +-CONFIG_AM335X_CONTROL_USB=y +-CONFIG_AM335X_PHY_USB=y +-CONFIG_USB_GPIO_VBUS=y +-CONFIG_USB_ISP1301=y +-CONFIG_USB_MXS_PHY=y +-CONFIG_USB_ULPI=y +-CONFIG_USB_ULPI_VIEWPORT=y +-CONFIG_USB_GADGET=y +-# CONFIG_USB_GADGET_DEBUG is not set +-# CONFIG_USB_GADGET_DEBUG_FILES is not set +-# CONFIG_USB_GADGET_DEBUG_FS is not set +-CONFIG_USB_GADGET_VBUS_DRAW=2 +-CONFIG_USB_GADGET_STORAGE_NUM_BUFFERS=2 +- +-# +-# USB Peripheral Controller +-# +-CONFIG_USB_FSL_USB2=m +-# CONFIG_USB_FUSB300 is not set +-# CONFIG_USB_FOTG210_UDC is not set +-# CONFIG_USB_GR_UDC is not set +-# CONFIG_USB_R8A66597 is not set +-# CONFIG_USB_PXA27X is not set +-# CONFIG_USB_MV_UDC is not set +-# CONFIG_USB_MV_U3D is not set +-# CONFIG_USB_M66592 is not set +-# CONFIG_USB_BDC_UDC is not set +-# CONFIG_USB_AMD5536UDC is not set +-# CONFIG_USB_NET2272 is not set +-# CONFIG_USB_NET2280 is not set +-# CONFIG_USB_GOKU is not set +-# CONFIG_USB_EG20T is not set +-# CONFIG_USB_GADGET_XILINX is not set +-# CONFIG_USB_DUMMY_HCD is not set +-CONFIG_USB_LIBCOMPOSITE=m +-CONFIG_USB_F_ACM=m +-CONFIG_USB_F_SS_LB=m +-CONFIG_USB_U_SERIAL=m +-CONFIG_USB_U_ETHER=m +-CONFIG_USB_F_SERIAL=m +-CONFIG_USB_F_OBEX=m +-CONFIG_USB_F_NCM=m +-CONFIG_USB_F_ECM=m +-CONFIG_USB_F_EEM=m +-CONFIG_USB_F_SUBSET=m +-CONFIG_USB_F_RNDIS=m +-CONFIG_USB_F_MASS_STORAGE=m +-CONFIG_USB_F_FS=m +-CONFIG_USB_F_UAC1=m +-CONFIG_USB_F_UAC2=m +-CONFIG_USB_F_UVC=m +-CONFIG_USB_F_MIDI=m +-CONFIG_USB_F_HID=m +-CONFIG_USB_F_PRINTER=m +-CONFIG_USB_CONFIGFS=m +-CONFIG_USB_CONFIGFS_SERIAL=y +-CONFIG_USB_CONFIGFS_ACM=y +-CONFIG_USB_CONFIGFS_OBEX=y +-CONFIG_USB_CONFIGFS_NCM=y +-CONFIG_USB_CONFIGFS_ECM=y +-CONFIG_USB_CONFIGFS_ECM_SUBSET=y +-CONFIG_USB_CONFIGFS_RNDIS=y +-CONFIG_USB_CONFIGFS_EEM=y +-CONFIG_USB_CONFIGFS_MASS_STORAGE=y +-CONFIG_USB_CONFIGFS_F_LB_SS=y +-CONFIG_USB_CONFIGFS_F_FS=y +-CONFIG_USB_CONFIGFS_F_UAC1=y +-CONFIG_USB_CONFIGFS_F_UAC2=y +-CONFIG_USB_CONFIGFS_F_MIDI=y +-CONFIG_USB_CONFIGFS_F_HID=y +-CONFIG_USB_CONFIGFS_F_UVC=y +-CONFIG_USB_CONFIGFS_F_PRINTER=y +-CONFIG_USB_ZERO=m +-# CONFIG_USB_ZERO_HNPTEST is not set +-CONFIG_USB_AUDIO=m +-# CONFIG_GADGET_UAC1 is not set +-CONFIG_USB_ETH=m +-CONFIG_USB_ETH_RNDIS=y +-# CONFIG_USB_ETH_EEM is not set +-CONFIG_USB_G_NCM=m +-CONFIG_USB_GADGETFS=m +-CONFIG_USB_FUNCTIONFS=m +-# CONFIG_USB_FUNCTIONFS_ETH is not set +-# CONFIG_USB_FUNCTIONFS_RNDIS is not set +-CONFIG_USB_FUNCTIONFS_GENERIC=y +-CONFIG_USB_MASS_STORAGE=m +-CONFIG_USB_G_SERIAL=m +-CONFIG_USB_MIDI_GADGET=m +-CONFIG_USB_G_PRINTER=m +-CONFIG_USB_CDC_COMPOSITE=m +-CONFIG_USB_G_ACM_MS=m +-CONFIG_USB_G_MULTI=m +-CONFIG_USB_G_MULTI_RNDIS=y +-# CONFIG_USB_G_MULTI_CDC is not set +-CONFIG_USB_G_HID=m +-# CONFIG_USB_G_DBGP is not set +-CONFIG_USB_G_WEBCAM=m +-CONFIG_USB_LED_TRIG=y +-# CONFIG_UWB is not set +-CONFIG_MMC=y +-# CONFIG_MMC_DEBUG is not set +- +-# +-# MMC/SD/SDIO Card Drivers +-# +-CONFIG_MMC_BLOCK=y +-CONFIG_MMC_BLOCK_MINORS=8 +-CONFIG_MMC_BLOCK_BOUNCE=y +-CONFIG_SDIO_UART=y +-# CONFIG_MMC_TEST is not set +- +-# +-# MMC/SD/SDIO Host Controller Drivers +-# +-CONFIG_MMC_SDHCI=y +-CONFIG_MMC_SDHCI_IO_ACCESSORS=y +-# CONFIG_MMC_SDHCI_PCI is not set +-CONFIG_MMC_SDHCI_PLTFM=y +-CONFIG_MMC_SDHCI_OF_ARASAN=m +-# CONFIG_MMC_SDHCI_OF_AT91 is not set +-# CONFIG_MMC_SDHCI_OF_ESDHC is not set +-CONFIG_MMC_SDHCI_ESDHC_IMX=y +-# CONFIG_MMC_SDHCI_F_SDH30 is not set +-# CONFIG_MMC_MXC is not set +-CONFIG_MMC_TIFM_SD=m +-CONFIG_MMC_CB710=m +-# CONFIG_MMC_VIA_SDMMC is not set +-# CONFIG_MMC_DW is not set +-CONFIG_MMC_VUB300=m +-CONFIG_MMC_USHC=y +-CONFIG_MMC_USDHI6ROL0=m +-CONFIG_MMC_TOSHIBA_PCI=m +-# CONFIG_MMC_MTK is not set +-# CONFIG_MEMSTICK is not set +-CONFIG_NEW_LEDS=y +-CONFIG_LEDS_CLASS=y +-# CONFIG_LEDS_CLASS_FLASH is not set +- +-# +-# LED drivers +-# +-# CONFIG_LEDS_BCM6328 is not set +-# CONFIG_LEDS_BCM6358 is not set +-# CONFIG_LEDS_LM3530 is not set +-# CONFIG_LEDS_LM3642 is not set +-# CONFIG_LEDS_PCA9532 is not set +-CONFIG_LEDS_GPIO=m +-# CONFIG_LEDS_LP3944 is not set +-# CONFIG_LEDS_LP5521 is not set +-# CONFIG_LEDS_LP5523 is not set +-# CONFIG_LEDS_LP5562 is not set +-# CONFIG_LEDS_LP8501 is not set +-# CONFIG_LEDS_LP8860 is not set +-# CONFIG_LEDS_PCA955X is not set +-# CONFIG_LEDS_PCA963X is not set +-# CONFIG_LEDS_DA9052 is not set +-# CONFIG_LEDS_DAC124S085 is not set +-CONFIG_LEDS_PWM=y +-CONFIG_LEDS_REGULATOR=m +-# CONFIG_LEDS_BD2802 is not set +-# CONFIG_LEDS_LT3593 is not set +-# CONFIG_LEDS_MC13783 is not set +-# CONFIG_LEDS_TCA6507 is not set +-# CONFIG_LEDS_TLC591XX is not set +-# CONFIG_LEDS_LM355x is not set +- +-# +-# LED driver for blink(1) USB RGB LED is under Special HID drivers (HID_THINGM) +-# +-# CONFIG_LEDS_BLINKM is not set +-# CONFIG_LEDS_SYSCON is not set +- +-# +-# LED Triggers +-# +-CONFIG_LEDS_TRIGGERS=y +-CONFIG_LEDS_TRIGGER_TIMER=m +-CONFIG_LEDS_TRIGGER_ONESHOT=m +-CONFIG_LEDS_TRIGGER_HEARTBEAT=y +-CONFIG_LEDS_TRIGGER_BACKLIGHT=m +-CONFIG_LEDS_TRIGGER_CPU=y +-CONFIG_LEDS_TRIGGER_GPIO=m +-CONFIG_LEDS_TRIGGER_DEFAULT_ON=y +- +-# +-# iptables trigger is under Netfilter config (LED target) +-# +-CONFIG_LEDS_TRIGGER_TRANSIENT=m +-CONFIG_LEDS_TRIGGER_CAMERA=m +-# CONFIG_ACCESSIBILITY is not set +-# CONFIG_INFINIBAND is not set +-CONFIG_EDAC_ATOMIC_SCRUB=y +-CONFIG_EDAC_SUPPORT=y +-# CONFIG_EDAC is not set +-CONFIG_RTC_LIB=y +-CONFIG_RTC_CLASS=y +-CONFIG_RTC_HCTOSYS=y +-CONFIG_RTC_HCTOSYS_DEVICE="rtc0" +-# CONFIG_RTC_SYSTOHC is not set +-# CONFIG_RTC_DEBUG is not set +- +-# +-# RTC interfaces +-# +-CONFIG_RTC_INTF_SYSFS=y +-CONFIG_RTC_INTF_PROC=y +-CONFIG_RTC_INTF_DEV=y +-CONFIG_RTC_INTF_DEV_UIE_EMUL=y +-# CONFIG_RTC_DRV_TEST is not set +- +-# +-# I2C RTC drivers +-# +-# CONFIG_RTC_DRV_ABB5ZES3 is not set +-# CONFIG_RTC_DRV_ABX80X is not set +-# CONFIG_RTC_DRV_DS1307 is not set +-# CONFIG_RTC_DRV_DS1374 is not set +-# CONFIG_RTC_DRV_DS1672 is not set +-# CONFIG_RTC_DRV_DS3232 is not set +-# CONFIG_RTC_DRV_HYM8563 is not set +-# CONFIG_RTC_DRV_MAX6900 is not set +-# CONFIG_RTC_DRV_RS5C372 is not set +-# CONFIG_RTC_DRV_ISL1208 is not set +-# CONFIG_RTC_DRV_ISL12022 is not set +-# CONFIG_RTC_DRV_ISL12057 is not set +-# CONFIG_RTC_DRV_X1205 is not set +-# CONFIG_RTC_DRV_PCF2127 is not set +-CONFIG_RTC_DRV_PCF8523=y +-# CONFIG_RTC_DRV_PCF8563 is not set +-# CONFIG_RTC_DRV_PCF85063 is not set +-# CONFIG_RTC_DRV_PCF8583 is not set +-# CONFIG_RTC_DRV_M41T80 is not set +-# CONFIG_RTC_DRV_BQ32K is not set +-# CONFIG_RTC_DRV_S35390A is not set +-# CONFIG_RTC_DRV_FM3130 is not set +-# CONFIG_RTC_DRV_RX8581 is not set +-# CONFIG_RTC_DRV_RX8025 is not set +-# CONFIG_RTC_DRV_EM3027 is not set +-# CONFIG_RTC_DRV_RV3029C2 is not set +-# CONFIG_RTC_DRV_RV8803 is not set +- +-# +-# SPI RTC drivers +-# +-# CONFIG_RTC_DRV_M41T93 is not set +-# CONFIG_RTC_DRV_M41T94 is not set +-# CONFIG_RTC_DRV_DS1305 is not set +-# CONFIG_RTC_DRV_DS1343 is not set +-# CONFIG_RTC_DRV_DS1347 is not set +-# CONFIG_RTC_DRV_DS1390 is not set +-# CONFIG_RTC_DRV_MAX6902 is not set +-# CONFIG_RTC_DRV_R9701 is not set +-# CONFIG_RTC_DRV_RS5C348 is not set +-# CONFIG_RTC_DRV_DS3234 is not set +-# CONFIG_RTC_DRV_PCF2123 is not set +-# CONFIG_RTC_DRV_RX4581 is not set +-# CONFIG_RTC_DRV_MCP795 is not set +- +-# +-# Platform RTC drivers +-# +-CONFIG_RTC_DRV_CMOS=y +-# CONFIG_RTC_DRV_DS1286 is not set +-# CONFIG_RTC_DRV_DS1511 is not set +-# CONFIG_RTC_DRV_DS1553 is not set +-# CONFIG_RTC_DRV_DS1685_FAMILY is not set +-# CONFIG_RTC_DRV_DS1742 is not set +-# CONFIG_RTC_DRV_DS2404 is not set +-# CONFIG_RTC_DRV_DA9052 is not set +-# CONFIG_RTC_DRV_STK17TA8 is not set +-# CONFIG_RTC_DRV_M48T86 is not set +-# CONFIG_RTC_DRV_M48T35 is not set +-# CONFIG_RTC_DRV_M48T59 is not set +-# CONFIG_RTC_DRV_MSM6242 is not set +-# CONFIG_RTC_DRV_BQ4802 is not set +-# CONFIG_RTC_DRV_RP5C01 is not set +-# CONFIG_RTC_DRV_V3020 is not set +-# CONFIG_RTC_DRV_ZYNQMP is not set +- +-# +-# on-CPU RTC drivers +-# +-CONFIG_RTC_DRV_IMXDI=y +-CONFIG_RTC_DRV_MC13XXX=y +-CONFIG_RTC_DRV_MXC=y +-CONFIG_RTC_DRV_SNVS=y +- +-# +-# HID Sensor RTC drivers +-# +-# CONFIG_RTC_DRV_HID_SENSOR_TIME is not set +-CONFIG_DMADEVICES=y +-# CONFIG_DMADEVICES_DEBUG is not set +- +-# +-# DMA Devices +-# +-CONFIG_DMA_ENGINE=y +-CONFIG_DMA_VIRTUAL_CHANNELS=m +-CONFIG_DMA_OF=y +-CONFIG_FSL_EDMA=m +-# CONFIG_IMX_DMA is not set +-CONFIG_IMX_SDMA=y +-# CONFIG_INTEL_IDMA64 is not set +-CONFIG_MXS_DMA=y +-# CONFIG_MX3_IPU is not set +-CONFIG_MXC_PXP_V2=y +-CONFIG_MXC_PXP_CLIENT_DEVICE=y +-# CONFIG_NBPFAXI_DMA is not set +-CONFIG_DW_DMAC_CORE=m +-CONFIG_DW_DMAC=m +-CONFIG_DW_DMAC_PCI=m +- +-# +-# DMA Clients +-# +-CONFIG_ASYNC_TX_DMA=y +-# CONFIG_DMATEST is not set +-# CONFIG_AUXDISPLAY is not set +-# CONFIG_UIO is not set +-# CONFIG_VIRT_DRIVERS is not set +- +-# +-# Virtio drivers +-# +-# CONFIG_VIRTIO_PCI is not set +-# CONFIG_VIRTIO_MMIO is not set +- +-# +-# Microsoft Hyper-V guest support +-# +-CONFIG_STAGING=y +-CONFIG_PRISM2_USB=m +-CONFIG_COMEDI=m +-# CONFIG_COMEDI_DEBUG is not set +-CONFIG_COMEDI_DEFAULT_BUF_SIZE_KB=2048 +-CONFIG_COMEDI_DEFAULT_BUF_MAXSIZE_KB=20480 +-# CONFIG_COMEDI_MISC_DRIVERS is not set +-# CONFIG_COMEDI_ISA_DRIVERS is not set +-# CONFIG_COMEDI_PCI_DRIVERS is not set +-# CONFIG_COMEDI_USB_DRIVERS is not set +-# CONFIG_COMEDI_8255_SA is not set +-# CONFIG_COMEDI_KCOMEDILIB is not set +-CONFIG_RTL8192U=m +-CONFIG_RTLLIB=m +-CONFIG_RTLLIB_CRYPTO_CCMP=m +-CONFIG_RTLLIB_CRYPTO_TKIP=m +-CONFIG_RTLLIB_CRYPTO_WEP=m +-CONFIG_RTL8192E=m +-CONFIG_R8712U=m +-CONFIG_R8188EU=m +-CONFIG_88EU_AP_MODE=y +-CONFIG_R8723AU=m +-CONFIG_8723AU_AP_MODE=y +-CONFIG_8723AU_BT_COEXIST=y +-CONFIG_RTS5208=m +-# CONFIG_VT6655 is not set +-# CONFIG_VT6656 is not set +- +-# +-# IIO staging drivers +-# +- +-# +-# Accelerometers +-# +-# CONFIG_ADIS16201 is not set +-# CONFIG_ADIS16203 is not set +-# CONFIG_ADIS16204 is not set +-# CONFIG_ADIS16209 is not set +-# CONFIG_ADIS16220 is not set +-# CONFIG_ADIS16240 is not set +-# CONFIG_LIS3L02DQ is not set +-# CONFIG_SCA3000 is not set +- +-# +-# Analog to digital converters +-# +-# CONFIG_AD7606 is not set +-# CONFIG_AD7780 is not set +-# CONFIG_AD7816 is not set +-# CONFIG_AD7192 is not set +-# CONFIG_AD7280 is not set +- +-# +-# Analog digital bi-direction converters +-# +-# CONFIG_ADT7316 is not set +- +-# +-# Capacitance to digital converters +-# +-# CONFIG_AD7150 is not set +-# CONFIG_AD7152 is not set +-# CONFIG_AD7746 is not set +- +-# +-# Direct Digital Synthesis +-# +-# CONFIG_AD9832 is not set +-# CONFIG_AD9834 is not set +- +-# +-# Digital gyroscope sensors +-# +-# CONFIG_ADIS16060 is not set +- +-# +-# Network Analyzer, Impedance Converters +-# +-# CONFIG_AD5933 is not set +- +-# +-# Light sensors +-# +-# CONFIG_SENSORS_ISL29018 is not set +-# CONFIG_SENSORS_ISL29028 is not set +-# CONFIG_TSL2583 is not set +-# CONFIG_TSL2x7x is not set +- +-# +-# Magnetometer sensors +-# +-# CONFIG_SENSORS_HMC5843_I2C is not set +-# CONFIG_SENSORS_HMC5843_SPI is not set +- +-# +-# Active energy metering IC +-# +-# CONFIG_ADE7753 is not set +-# CONFIG_ADE7754 is not set +-# CONFIG_ADE7758 is not set +-# CONFIG_ADE7759 is not set +-# CONFIG_ADE7854 is not set +- +-# +-# Resolver to digital converters +-# +-# CONFIG_AD2S90 is not set +-# CONFIG_AD2S1200 is not set +-# CONFIG_AD2S1210 is not set +- +-# +-# Triggers - standalone +-# +-CONFIG_IIO_PERIODIC_RTC_TRIGGER=m +-# CONFIG_IIO_SIMPLE_DUMMY is not set +-# CONFIG_FB_SM750 is not set +-# CONFIG_FB_XGI is not set +- +-# +-# Speakup console speech +-# +-CONFIG_SPEAKUP=m +-CONFIG_SPEAKUP_SYNTH_ACNTSA=m +-CONFIG_SPEAKUP_SYNTH_APOLLO=m +-CONFIG_SPEAKUP_SYNTH_AUDPTR=m +-CONFIG_SPEAKUP_SYNTH_BNS=m +-CONFIG_SPEAKUP_SYNTH_DECTLK=m +-CONFIG_SPEAKUP_SYNTH_DECEXT=m +-CONFIG_SPEAKUP_SYNTH_LTLK=m +-CONFIG_SPEAKUP_SYNTH_SOFT=m +-CONFIG_SPEAKUP_SYNTH_SPKOUT=m +-CONFIG_SPEAKUP_SYNTH_TXPRT=m +-CONFIG_SPEAKUP_SYNTH_DUMMY=m +-CONFIG_TOUCHSCREEN_SYNAPTICS_I2C_RMI4=m +-CONFIG_STAGING_MEDIA=y +-CONFIG_I2C_BCM2048=m +-CONFIG_DVB_CXD2099=m +-CONFIG_DVB_MN88472=m +-CONFIG_DVB_MN88473=m +-CONFIG_LIRC_STAGING=y +-CONFIG_LIRC_BT829=m +-CONFIG_LIRC_IMON=m +-CONFIG_LIRC_SASEM=m +-CONFIG_LIRC_SERIAL=m +-CONFIG_LIRC_SERIAL_TRANSMITTER=y +-CONFIG_LIRC_SIR=m +-CONFIG_LIRC_ZILOG=m +- +-# +-# Android +-# +-# CONFIG_STAGING_BOARD is not set +-CONFIG_WIMAX_GDM72XX=m +-CONFIG_WIMAX_GDM72XX_QOS=y +-CONFIG_WIMAX_GDM72XX_K_MODE=y +-CONFIG_WIMAX_GDM72XX_WIMAX2=y +-CONFIG_WIMAX_GDM72XX_USB=y +-# CONFIG_WIMAX_GDM72XX_SDIO is not set +-CONFIG_WIMAX_GDM72XX_USB_PM=y +-CONFIG_LTE_GDM724X=m +-CONFIG_MTD_SPINAND_MT29F=m +-# CONFIG_MTD_SPINAND_ONDIEECC is not set +-# CONFIG_LUSTRE_FS is not set +-CONFIG_DGNC=m +-CONFIG_DGAP=m +-# CONFIG_GS_FPGABOOT is not set +-# CONFIG_COMMON_CLK_XLNX_CLKWZRD is not set +-CONFIG_FB_TFT=m +-CONFIG_FB_TFT_AGM1264K_FL=m +-CONFIG_FB_TFT_BD663474=m +-CONFIG_FB_TFT_HX8340BN=m +-CONFIG_FB_TFT_HX8347D=m +-CONFIG_FB_TFT_HX8353D=m +-CONFIG_FB_TFT_HX8357D=m +-CONFIG_FB_TFT_ILI9163=m +-CONFIG_FB_TFT_ILI9320=m +-CONFIG_FB_TFT_ILI9325=m +-CONFIG_FB_TFT_ILI9340=m +-CONFIG_FB_TFT_ILI9341=m +-CONFIG_FB_TFT_ILI9481=m +-CONFIG_FB_TFT_ILI9486=m +-CONFIG_FB_TFT_PCD8544=m +-CONFIG_FB_TFT_RA8875=m +-CONFIG_FB_TFT_S6D02A1=m +-CONFIG_FB_TFT_S6D1121=m +-CONFIG_FB_TFT_SSD1289=m +-CONFIG_FB_TFT_SSD1306=m +-CONFIG_FB_TFT_SSD1331=m +-CONFIG_FB_TFT_SSD1351=m +-CONFIG_FB_TFT_ST7735R=m +-# CONFIG_FB_TFT_ST7789V is not set +-CONFIG_FB_TFT_TINYLCD=m +-CONFIG_FB_TFT_TLS8204=m +-CONFIG_FB_TFT_UC1611=m +-CONFIG_FB_TFT_UC1701=m +-CONFIG_FB_TFT_UPD161704=m +-CONFIG_FB_TFT_WATTEROTT=m +-CONFIG_FB_FLEX=m +-CONFIG_FB_TFT_FBTFT_DEVICE=m +-# CONFIG_WILC1000_DRIVER is not set +-# CONFIG_MOST is not set +-# CONFIG_CHROME_PLATFORMS is not set +-CONFIG_CLKDEV_LOOKUP=y +-CONFIG_HAVE_CLK_PREPARE=y +-CONFIG_COMMON_CLK=y +- +-# +-# Common Clock Framework +-# +-# CONFIG_COMMON_CLK_SI5351 is not set +-# CONFIG_COMMON_CLK_SI514 is not set +-# CONFIG_COMMON_CLK_SI570 is not set +-# CONFIG_COMMON_CLK_CDCE925 is not set +-# CONFIG_CLK_QORIQ is not set +-# CONFIG_COMMON_CLK_PWM is not set +-# CONFIG_COMMON_CLK_PXA is not set +-# CONFIG_COMMON_CLK_CDCE706 is not set +- +-# +-# Hardware Spinlock drivers +-# +- +-# +-# Clock Source drivers +-# +-CONFIG_CLKSRC_OF=y +-CONFIG_CLKSRC_PROBE=y +-CONFIG_CLKSRC_MMIO=y +-# CONFIG_ARM_TIMER_SP804 is not set +-# CONFIG_ATMEL_PIT is not set +-# CONFIG_SH_TIMER_CMT is not set +-# CONFIG_SH_TIMER_MTU2 is not set +-# CONFIG_SH_TIMER_TMU is not set +-# CONFIG_EM_TIMER_STI is not set +-CONFIG_CLKSRC_IMX_GPT=y +-# CONFIG_MAILBOX is not set +-CONFIG_IOMMU_SUPPORT=y +- +-# +-# Generic IOMMU Pagetable Support +-# +-# CONFIG_IOMMU_IO_PGTABLE_LPAE is not set +-# CONFIG_ARM_SMMU is not set +- +-# +-# Remoteproc drivers +-# +-# CONFIG_STE_MODEM_RPROC is not set +- +-# +-# Rpmsg drivers +-# +- +-# +-# SOC (System On Chip) specific Drivers +-# +-# CONFIG_SOC_BRCMSTB is not set +-# CONFIG_SUNXI_SRAM is not set +-# CONFIG_SOC_TI is not set +-CONFIG_PM_DEVFREQ=y +- +-# +-# DEVFREQ Governors +-# +-CONFIG_DEVFREQ_GOV_SIMPLE_ONDEMAND=y +-CONFIG_DEVFREQ_GOV_PERFORMANCE=y +-CONFIG_DEVFREQ_GOV_POWERSAVE=y +-CONFIG_DEVFREQ_GOV_USERSPACE=y +- +-# +-# DEVFREQ Drivers +-# +-CONFIG_PM_DEVFREQ_EVENT=y +-CONFIG_EXTCON=y +- +-# +-# Extcon Device Drivers +-# +-CONFIG_EXTCON_ADC_JACK=m +-CONFIG_EXTCON_GPIO=y +-CONFIG_EXTCON_RT8973A=m +-CONFIG_EXTCON_SM5502=m +-CONFIG_EXTCON_USB_GPIO=y +-# CONFIG_MEMORY is not set +-CONFIG_IIO=m +-CONFIG_IIO_BUFFER=y +-# CONFIG_IIO_BUFFER_CB is not set +-CONFIG_IIO_KFIFO_BUF=m +-CONFIG_IIO_TRIGGERED_BUFFER=m +-CONFIG_IIO_TRIGGER=y +-CONFIG_IIO_CONSUMERS_PER_TRIGGER=2 +- +-# +-# Accelerometers +-# +-# CONFIG_BMA180 is not set +-# CONFIG_BMC150_ACCEL is not set +-# CONFIG_HID_SENSOR_ACCEL_3D is not set +-# CONFIG_IIO_ST_ACCEL_3AXIS is not set +-# CONFIG_KXSD9 is not set +-# CONFIG_KXCJK1013 is not set +-# CONFIG_MMA8452 is not set +-# CONFIG_MMA9551 is not set +-# CONFIG_MMA9553 is not set +-# CONFIG_MXC4005 is not set +-# CONFIG_STK8312 is not set +-# CONFIG_STK8BA50 is not set +- +-# +-# Analog to digital converters +-# +-# CONFIG_AD7266 is not set +-# CONFIG_AD7291 is not set +-# CONFIG_AD7298 is not set +-# CONFIG_AD7476 is not set +-# CONFIG_AD7791 is not set +-# CONFIG_AD7793 is not set +-# CONFIG_AD7887 is not set +-# CONFIG_AD7923 is not set +-# CONFIG_AD799X is not set +-# CONFIG_CC10001_ADC is not set +-# CONFIG_HI8435 is not set +-# CONFIG_MAX1027 is not set +-# CONFIG_MAX1363 is not set +-# CONFIG_MCP320X is not set +-# CONFIG_MCP3422 is not set +-# CONFIG_NAU7802 is not set +-# CONFIG_TI_ADC081C is not set +-# CONFIG_TI_ADC128S052 is not set +-# CONFIG_VF610_ADC is not set +- +-# +-# Amplifiers +-# +-# CONFIG_AD8366 is not set +- +-# +-# Chemical Sensors +-# +-# CONFIG_VZ89X is not set +- +-# +-# Hid Sensor IIO Common +-# +-CONFIG_HID_SENSOR_IIO_COMMON=m +-CONFIG_HID_SENSOR_IIO_TRIGGER=m +- +-# +-# SSP Sensor Common +-# +-# CONFIG_IIO_SSP_SENSORHUB is not set +- +-# +-# Digital to analog converters +-# +-# CONFIG_AD5064 is not set +-# CONFIG_AD5360 is not set +-# CONFIG_AD5380 is not set +-# CONFIG_AD5421 is not set +-# CONFIG_AD5446 is not set +-# CONFIG_AD5449 is not set +-# CONFIG_AD5504 is not set +-# CONFIG_AD5624R_SPI is not set +-# CONFIG_AD5686 is not set +-# CONFIG_AD5755 is not set +-# CONFIG_AD5764 is not set +-# CONFIG_AD5791 is not set +-# CONFIG_AD7303 is not set +-# CONFIG_M62332 is not set +-# CONFIG_MAX517 is not set +-# CONFIG_MAX5821 is not set +-# CONFIG_MCP4725 is not set +-# CONFIG_MCP4922 is not set +- +-# +-# Frequency Synthesizers DDS/PLL +-# +- +-# +-# Clock Generator/Distribution +-# +-# CONFIG_AD9523 is not set +- +-# +-# Phase-Locked Loop (PLL) frequency synthesizers +-# +-# CONFIG_ADF4350 is not set +- +-# +-# Digital gyroscope sensors +-# +-# CONFIG_ADIS16080 is not set +-# CONFIG_ADIS16130 is not set +-# CONFIG_ADIS16136 is not set +-# CONFIG_ADIS16260 is not set +-# CONFIG_ADXRS450 is not set +-# CONFIG_BMG160 is not set +-CONFIG_HID_SENSOR_GYRO_3D=m +-# CONFIG_IIO_ST_GYRO_3AXIS is not set +-# CONFIG_ITG3200 is not set +- +-# +-# Humidity sensors +-# +-CONFIG_DHT11=m +-# CONFIG_HDC100X is not set +-# CONFIG_HTU21 is not set +-# CONFIG_SI7005 is not set +-# CONFIG_SI7020 is not set +- +-# +-# Inertial measurement units +-# +-# CONFIG_ADIS16400 is not set +-# CONFIG_ADIS16480 is not set +-# CONFIG_KMX61 is not set +-# CONFIG_INV_MPU6050_IIO is not set +- +-# +-# Light sensors +-# +-# CONFIG_ADJD_S311 is not set +-# CONFIG_AL3320A is not set +-# CONFIG_APDS9300 is not set +-# CONFIG_APDS9960 is not set +-# CONFIG_BH1750 is not set +-# CONFIG_CM32181 is not set +-# CONFIG_CM3232 is not set +-# CONFIG_CM3323 is not set +-# CONFIG_CM36651 is not set +-# CONFIG_GP2AP020A00F is not set +-# CONFIG_ISL29125 is not set +-# CONFIG_HID_SENSOR_ALS is not set +-# CONFIG_HID_SENSOR_PROX is not set +-# CONFIG_JSA1212 is not set +-# CONFIG_RPR0521 is not set +-# CONFIG_LTR501 is not set +-# CONFIG_OPT3001 is not set +-# CONFIG_PA12203001 is not set +-# CONFIG_STK3310 is not set +-# CONFIG_TCS3414 is not set +-# CONFIG_TCS3472 is not set +-# CONFIG_SENSORS_TSL2563 is not set +-# CONFIG_TSL4531 is not set +-# CONFIG_US5182D is not set +-# CONFIG_VCNL4000 is not set +- +-# +-# Magnetometer sensors +-# +-# CONFIG_AK8975 is not set +-# CONFIG_AK09911 is not set +-# CONFIG_BMC150_MAGN is not set +-# CONFIG_MAG3110 is not set +-# CONFIG_HID_SENSOR_MAGNETOMETER_3D is not set +-# CONFIG_MMC35240 is not set +-# CONFIG_IIO_ST_MAGN_3AXIS is not set +- +-# +-# Inclinometer sensors +-# +-# CONFIG_HID_SENSOR_INCLINOMETER_3D is not set +-# CONFIG_HID_SENSOR_DEVICE_ROTATION is not set +- +-# +-# Triggers - standalone +-# +-CONFIG_IIO_INTERRUPT_TRIGGER=m +-CONFIG_IIO_SYSFS_TRIGGER=m +- +-# +-# Digital potentiometers +-# +-# CONFIG_MCP4531 is not set +- +-# +-# Pressure sensors +-# +-# CONFIG_BMP280 is not set +-# CONFIG_HID_SENSOR_PRESS is not set +-# CONFIG_MPL115 is not set +-# CONFIG_MPL3115 is not set +-# CONFIG_MS5611 is not set +-# CONFIG_MS5637 is not set +-# CONFIG_IIO_ST_PRESS is not set +-# CONFIG_T5403 is not set +- +-# +-# Lightning sensors +-# +-# CONFIG_AS3935 is not set +- +-# +-# Proximity sensors +-# +-# CONFIG_LIDAR_LITE_V2 is not set +-# CONFIG_SX9500 is not set +- +-# +-# Temperature sensors +-# +-# CONFIG_MLX90614 is not set +-# CONFIG_TMP006 is not set +-# CONFIG_TSYS01 is not set +-# CONFIG_TSYS02D is not set +-# CONFIG_NTB is not set +-# CONFIG_VME_BUS is not set +-CONFIG_PWM=y +-CONFIG_PWM_SYSFS=y +-CONFIG_PWM_FSL_FTM=y +-CONFIG_PWM_IMX=y +-CONFIG_PWM_PCA9685=y +-CONFIG_IRQCHIP=y +-CONFIG_ARM_GIC=y +-# CONFIG_IPACK_BUS is not set +-CONFIG_ARCH_HAS_RESET_CONTROLLER=y +-CONFIG_RESET_CONTROLLER=y +-# CONFIG_FMC is not set +- +-# +-# PHY Subsystem +-# +-CONFIG_GENERIC_PHY=y +-# CONFIG_PHY_PXA_28NM_HSIC is not set +-# CONFIG_PHY_PXA_28NM_USB2 is not set +-# CONFIG_BCM_KONA_USB2_PHY is not set +-# CONFIG_PHY_SAMSUNG_USB2 is not set +-CONFIG_POWERCAP=y +-# CONFIG_MCB is not set +- +-# +-# Performance monitor support +-# +-CONFIG_ARM_PMU=y +-CONFIG_RAS=y +-# CONFIG_THUNDERBOLT is not set +- +-# +-# Android +-# +-# CONFIG_ANDROID is not set +-CONFIG_NVMEM=y +-CONFIG_NVMEM_IMX_OCOTP=m +-# CONFIG_STM is not set +-# CONFIG_STM_DUMMY is not set +-# CONFIG_STM_SOURCE_CONSOLE is not set +-# CONFIG_INTEL_TH is not set +- +-# +-# FPGA Configuration Support +-# +-# CONFIG_FPGA is not set +- +-# +-# MXC support drivers +-# +-CONFIG_MXC_IPU=y +- +-# +-# Vivante GPU support +-# +-CONFIG_MXC_GPU_VIV=y +-CONFIG_MXC_IPU_V3_FSL=y +- +-# +-# MXC VPU(Video Processing Unit) support +-# +-CONFIG_MXC_VPU=y +-# CONFIG_MXC_VPU_DEBUG is not set +-# CONFIG_MX6_VPU_352M is not set +- +-# +-# MXC HDMI CEC (Consumer Electronics Control) support +-# +-CONFIG_MXC_HDMI_CEC=y +- +-# +-# MXC MIPI Support +-# +-CONFIG_MXC_MIPI_CSI2=y +- +-# +-# MXC Media Local Bus Driver +-# +-CONFIG_MXC_MLB=y +-CONFIG_MXC_MLB150=m +- +-# +-# Firmware Drivers +-# +-CONFIG_FIRMWARE_MEMMAP=y +- +-# +-# File systems +-# +-CONFIG_DCACHE_WORD_ACCESS=y +-# CONFIG_EXT2_FS is not set +-# CONFIG_EXT3_FS is not set +-CONFIG_EXT4_FS=y +-CONFIG_EXT4_USE_FOR_EXT2=y +-CONFIG_EXT4_FS_POSIX_ACL=y +-CONFIG_EXT4_FS_SECURITY=y +-CONFIG_EXT4_ENCRYPTION=y +-CONFIG_EXT4_FS_ENCRYPTION=y +-# CONFIG_EXT4_DEBUG is not set +-CONFIG_JBD2=y +-# CONFIG_JBD2_DEBUG is not set +-CONFIG_FS_MBCACHE=y +-CONFIG_REISERFS_FS=m +-# CONFIG_REISERFS_CHECK is not set +-# CONFIG_REISERFS_PROC_INFO is not set +-CONFIG_REISERFS_FS_XATTR=y +-CONFIG_REISERFS_FS_POSIX_ACL=y +-# CONFIG_REISERFS_FS_SECURITY is not set +-CONFIG_JFS_FS=m +-CONFIG_JFS_POSIX_ACL=y +-CONFIG_JFS_SECURITY=y +-# CONFIG_JFS_DEBUG is not set +-# CONFIG_JFS_STATISTICS is not set +-CONFIG_XFS_FS=m +-CONFIG_XFS_QUOTA=y +-CONFIG_XFS_POSIX_ACL=y +-# CONFIG_XFS_RT is not set +-# CONFIG_XFS_WARN is not set +-# CONFIG_XFS_DEBUG is not set +-# CONFIG_GFS2_FS is not set +-# CONFIG_OCFS2_FS is not set +-CONFIG_BTRFS_FS=y +-CONFIG_BTRFS_FS_POSIX_ACL=y +-# CONFIG_BTRFS_FS_CHECK_INTEGRITY is not set +-# CONFIG_BTRFS_FS_RUN_SANITY_TESTS is not set +-# CONFIG_BTRFS_DEBUG is not set +-# CONFIG_BTRFS_ASSERT is not set +-# CONFIG_NILFS2_FS is not set +-CONFIG_F2FS_FS=m +-CONFIG_F2FS_STAT_FS=y +-CONFIG_F2FS_FS_XATTR=y +-CONFIG_F2FS_FS_POSIX_ACL=y +-# CONFIG_F2FS_FS_SECURITY is not set +-# CONFIG_F2FS_CHECK_FS is not set +-# CONFIG_F2FS_FS_ENCRYPTION is not set +-# CONFIG_F2FS_IO_TRACE is not set +-CONFIG_FS_POSIX_ACL=y +-CONFIG_EXPORTFS=y +-CONFIG_FILE_LOCKING=y +-CONFIG_FSNOTIFY=y +-CONFIG_DNOTIFY=y +-CONFIG_INOTIFY_USER=y +-CONFIG_FANOTIFY=y +-CONFIG_QUOTA=y +-# CONFIG_QUOTA_NETLINK_INTERFACE is not set +-CONFIG_PRINT_QUOTA_WARNING=y +-# CONFIG_QUOTA_DEBUG is not set +-CONFIG_QUOTA_TREE=m +-CONFIG_QFMT_V1=m +-CONFIG_QFMT_V2=m +-CONFIG_QUOTACTL=y +-CONFIG_AUTOFS4_FS=y +-CONFIG_FUSE_FS=y +-CONFIG_CUSE=y +-CONFIG_OVERLAY_FS=y +- +-# +-# Caches +-# +-CONFIG_FSCACHE=m +-# CONFIG_FSCACHE_STATS is not set +-# CONFIG_FSCACHE_HISTOGRAM is not set +-# CONFIG_FSCACHE_DEBUG is not set +-# CONFIG_FSCACHE_OBJECT_LIST is not set +-CONFIG_CACHEFILES=m +-# CONFIG_CACHEFILES_DEBUG is not set +-# CONFIG_CACHEFILES_HISTOGRAM is not set +- +-# +-# CD-ROM/DVD Filesystems +-# +-CONFIG_ISO9660_FS=y +-CONFIG_JOLIET=y +-CONFIG_ZISOFS=y +-CONFIG_UDF_FS=y +-CONFIG_UDF_NLS=y +- +-# +-# DOS/FAT/NT Filesystems +-# +-CONFIG_FAT_FS=y +-CONFIG_MSDOS_FS=y +-CONFIG_VFAT_FS=y +-CONFIG_FAT_DEFAULT_CODEPAGE=437 +-CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1" +-CONFIG_NTFS_FS=m +-# CONFIG_NTFS_DEBUG is not set +-CONFIG_NTFS_RW=y +- +-# +-# Pseudo filesystems +-# +-CONFIG_PROC_FS=y +-CONFIG_PROC_SYSCTL=y +-CONFIG_PROC_PAGE_MONITOR=y +-CONFIG_PROC_CHILDREN=y +-CONFIG_KERNFS=y +-CONFIG_SYSFS=y +-CONFIG_TMPFS=y +-CONFIG_TMPFS_POSIX_ACL=y +-CONFIG_TMPFS_XATTR=y +-# CONFIG_HUGETLB_PAGE is not set +-CONFIG_CONFIGFS_FS=y +-CONFIG_MISC_FILESYSTEMS=y +-# CONFIG_ADFS_FS is not set +-# CONFIG_AFFS_FS is not set +-# CONFIG_ECRYPT_FS is not set +-CONFIG_HFS_FS=m +-CONFIG_HFSPLUS_FS=m +-# CONFIG_HFSPLUS_FS_POSIX_ACL is not set +-# CONFIG_BEFS_FS is not set +-# CONFIG_BFS_FS is not set +-# CONFIG_EFS_FS is not set +-CONFIG_JFFS2_FS=m +-CONFIG_JFFS2_FS_DEBUG=0 +-CONFIG_JFFS2_FS_WRITEBUFFER=y +-# CONFIG_JFFS2_FS_WBUF_VERIFY is not set +-# CONFIG_JFFS2_SUMMARY is not set +-# CONFIG_JFFS2_FS_XATTR is not set +-# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set +-CONFIG_JFFS2_ZLIB=y +-# CONFIG_JFFS2_LZO is not set +-CONFIG_JFFS2_RTIME=y +-# CONFIG_JFFS2_RUBIN is not set +-CONFIG_UBIFS_FS=m +-# CONFIG_UBIFS_FS_ADVANCED_COMPR is not set +-CONFIG_UBIFS_FS_LZO=y +-CONFIG_UBIFS_FS_ZLIB=y +-# CONFIG_UBIFS_ATIME_SUPPORT is not set +-CONFIG_LOGFS=m +-# CONFIG_CRAMFS is not set +-CONFIG_SQUASHFS=m +-CONFIG_SQUASHFS_FILE_CACHE=y +-# CONFIG_SQUASHFS_FILE_DIRECT is not set +-CONFIG_SQUASHFS_DECOMP_SINGLE=y +-# CONFIG_SQUASHFS_DECOMP_MULTI is not set +-# CONFIG_SQUASHFS_DECOMP_MULTI_PERCPU is not set +-CONFIG_SQUASHFS_XATTR=y +-CONFIG_SQUASHFS_ZLIB=y +-# CONFIG_SQUASHFS_LZ4 is not set +-# CONFIG_SQUASHFS_LZO is not set +-# CONFIG_SQUASHFS_XZ is not set +-# CONFIG_SQUASHFS_4K_DEVBLK_SIZE is not set +-# CONFIG_SQUASHFS_EMBEDDED is not set +-CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE=3 +-# CONFIG_VXFS_FS is not set +-# CONFIG_MINIX_FS is not set +-# CONFIG_OMFS_FS is not set +-# CONFIG_HPFS_FS is not set +-# CONFIG_QNX4FS_FS is not set +-# CONFIG_QNX6FS_FS is not set +-CONFIG_ROMFS_FS=m +-CONFIG_ROMFS_BACKED_BY_BLOCK=y +-# CONFIG_ROMFS_BACKED_BY_MTD is not set +-# CONFIG_ROMFS_BACKED_BY_BOTH is not set +-CONFIG_ROMFS_ON_BLOCK=y +-# CONFIG_PSTORE is not set +-CONFIG_SYSV_FS=m +-# CONFIG_UFS_FS is not set +-CONFIG_NETWORK_FILESYSTEMS=y +-CONFIG_NFS_FS=y +-CONFIG_NFS_V2=y +-CONFIG_NFS_V3=y +-CONFIG_NFS_V3_ACL=y +-CONFIG_NFS_V4=y +-# CONFIG_NFS_SWAP is not set +-CONFIG_NFS_V4_1=y +-CONFIG_NFS_V4_2=y +-CONFIG_PNFS_FILE_LAYOUT=y +-CONFIG_PNFS_BLOCK=m +-CONFIG_PNFS_FLEXFILE_LAYOUT=m +-CONFIG_NFS_V4_1_IMPLEMENTATION_ID_DOMAIN="kernel.org" +-CONFIG_NFS_V4_1_MIGRATION=y +-CONFIG_ROOT_NFS=y +-# CONFIG_NFS_USE_LEGACY_DNS is not set +-CONFIG_NFS_USE_KERNEL_DNS=y +-CONFIG_NFS_DEBUG=y +-CONFIG_NFSD=m +-CONFIG_NFSD_V2_ACL=y +-CONFIG_NFSD_V3=y +-CONFIG_NFSD_V3_ACL=y +-CONFIG_NFSD_V4=y +-# CONFIG_NFSD_PNFS is not set +-# CONFIG_NFSD_FAULT_INJECTION is not set +-CONFIG_GRACE_PERIOD=y +-CONFIG_LOCKD=y +-CONFIG_LOCKD_V4=y +-CONFIG_NFS_ACL_SUPPORT=y +-CONFIG_NFS_COMMON=y +-CONFIG_SUNRPC=y +-CONFIG_SUNRPC_GSS=y +-CONFIG_SUNRPC_BACKCHANNEL=y +-CONFIG_RPCSEC_GSS_KRB5=m +-CONFIG_SUNRPC_DEBUG=y +-# CONFIG_CEPH_FS is not set +-CONFIG_CIFS=m +-# CONFIG_CIFS_STATS is not set +-CONFIG_CIFS_WEAK_PW_HASH=y +-# CONFIG_CIFS_UPCALL is not set +-CONFIG_CIFS_XATTR=y +-CONFIG_CIFS_POSIX=y +-CONFIG_CIFS_ACL=y +-# CONFIG_CIFS_DEBUG is not set +-CONFIG_CIFS_DFS_UPCALL=y +-CONFIG_CIFS_SMB2=y +-CONFIG_CIFS_SMB311=y +-CONFIG_CIFS_FSCACHE=y +-CONFIG_NCP_FS=m +-# CONFIG_NCPFS_PACKET_SIGNING is not set +-# CONFIG_NCPFS_IOCTL_LOCKING is not set +-# CONFIG_NCPFS_STRONG is not set +-# CONFIG_NCPFS_NFS_NS is not set +-# CONFIG_NCPFS_OS2_NS is not set +-# CONFIG_NCPFS_SMALLDOS is not set +-# CONFIG_NCPFS_NLS is not set +-# CONFIG_NCPFS_EXTRAS is not set +-# CONFIG_CODA_FS is not set +-# CONFIG_AFS_FS is not set +-CONFIG_NLS=y +-CONFIG_NLS_DEFAULT="utf8" +-CONFIG_NLS_CODEPAGE_437=y +-CONFIG_NLS_CODEPAGE_737=m +-CONFIG_NLS_CODEPAGE_775=m +-CONFIG_NLS_CODEPAGE_850=y +-CONFIG_NLS_CODEPAGE_852=y +-CONFIG_NLS_CODEPAGE_855=m +-CONFIG_NLS_CODEPAGE_857=m +-CONFIG_NLS_CODEPAGE_860=m +-CONFIG_NLS_CODEPAGE_861=m +-CONFIG_NLS_CODEPAGE_862=m +-CONFIG_NLS_CODEPAGE_863=m +-CONFIG_NLS_CODEPAGE_864=m +-CONFIG_NLS_CODEPAGE_865=m +-CONFIG_NLS_CODEPAGE_866=m +-CONFIG_NLS_CODEPAGE_869=m +-CONFIG_NLS_CODEPAGE_936=m +-CONFIG_NLS_CODEPAGE_950=m +-CONFIG_NLS_CODEPAGE_932=m +-CONFIG_NLS_CODEPAGE_949=m +-CONFIG_NLS_CODEPAGE_874=m +-CONFIG_NLS_ISO8859_8=m +-CONFIG_NLS_CODEPAGE_1250=y +-CONFIG_NLS_CODEPAGE_1251=y +-CONFIG_NLS_ASCII=y +-CONFIG_NLS_ISO8859_1=y +-CONFIG_NLS_ISO8859_2=y +-CONFIG_NLS_ISO8859_3=m +-CONFIG_NLS_ISO8859_4=m +-CONFIG_NLS_ISO8859_5=m +-CONFIG_NLS_ISO8859_6=m +-CONFIG_NLS_ISO8859_7=m +-CONFIG_NLS_ISO8859_9=m +-CONFIG_NLS_ISO8859_13=m +-CONFIG_NLS_ISO8859_14=m +-CONFIG_NLS_ISO8859_15=y +-CONFIG_NLS_KOI8_R=m +-CONFIG_NLS_KOI8_U=m +-CONFIG_NLS_MAC_ROMAN=m +-CONFIG_NLS_MAC_CELTIC=m +-CONFIG_NLS_MAC_CENTEURO=m +-CONFIG_NLS_MAC_CROATIAN=m +-CONFIG_NLS_MAC_CYRILLIC=m +-CONFIG_NLS_MAC_GAELIC=m +-CONFIG_NLS_MAC_GREEK=m +-CONFIG_NLS_MAC_ICELAND=m +-CONFIG_NLS_MAC_INUIT=m +-CONFIG_NLS_MAC_ROMANIAN=m +-CONFIG_NLS_MAC_TURKISH=m +-CONFIG_NLS_UTF8=y +-CONFIG_DLM=m +-# CONFIG_DLM_DEBUG is not set +- +-# +-# Kernel hacking +-# +- +-# +-# printk and dmesg options +-# +-CONFIG_PRINTK_TIME=y +-CONFIG_MESSAGE_LOGLEVEL_DEFAULT=4 +-# CONFIG_BOOT_PRINTK_DELAY is not set +-CONFIG_DYNAMIC_DEBUG=y +- +-# +-# Compile-time checks and compiler options +-# +-# CONFIG_DEBUG_INFO is not set +-CONFIG_ENABLE_WARN_DEPRECATED=y +-CONFIG_ENABLE_MUST_CHECK=y +-CONFIG_FRAME_WARN=1024 +-CONFIG_STRIP_ASM_SYMS=y +-# CONFIG_READABLE_ASM is not set +-# CONFIG_UNUSED_SYMBOLS is not set +-# CONFIG_PAGE_OWNER is not set +-CONFIG_DEBUG_FS=y +-# CONFIG_HEADERS_CHECK is not set +-# CONFIG_DEBUG_SECTION_MISMATCH is not set +-CONFIG_SECTION_MISMATCH_WARN_ONLY=y +-CONFIG_FRAME_POINTER=y +-# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set +-CONFIG_MAGIC_SYSRQ=y +-CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE=0x1 +-CONFIG_DEBUG_KERNEL=y +- +-# +-# Memory Debugging +-# +-# CONFIG_PAGE_EXTENSION is not set +-# CONFIG_DEBUG_PAGEALLOC is not set +-# CONFIG_DEBUG_OBJECTS is not set +-# CONFIG_SLUB_STATS is not set +-CONFIG_HAVE_DEBUG_KMEMLEAK=y +-# CONFIG_DEBUG_KMEMLEAK is not set +-# CONFIG_DEBUG_STACK_USAGE is not set +-# CONFIG_DEBUG_VM is not set +-# CONFIG_DEBUG_MEMORY_INIT is not set +-# CONFIG_DEBUG_PER_CPU_MAPS is not set +-# CONFIG_DEBUG_HIGHMEM is not set +-# CONFIG_DEBUG_SHIRQ is not set +- +-# +-# Debug Lockups and Hangs +-# +-# CONFIG_LOCKUP_DETECTOR is not set +-# CONFIG_DETECT_HUNG_TASK is not set +-CONFIG_PANIC_ON_OOPS=y +-CONFIG_PANIC_ON_OOPS_VALUE=1 +-CONFIG_PANIC_TIMEOUT=1 +-# CONFIG_SCHED_DEBUG is not set +-# CONFIG_SCHED_INFO is not set +-# CONFIG_SCHEDSTATS is not set +-# CONFIG_SCHED_STACK_END_CHECK is not set +-# CONFIG_DEBUG_TIMEKEEPING is not set +-CONFIG_TIMER_STATS=y +-# CONFIG_DEBUG_PREEMPT is not set +- +-# +-# Lock Debugging (spinlocks, mutexes, etc...) +-# +-# CONFIG_DEBUG_RT_MUTEXES is not set +-# CONFIG_DEBUG_SPINLOCK is not set +-# CONFIG_DEBUG_MUTEXES is not set +-# CONFIG_DEBUG_WW_MUTEX_SLOWPATH is not set +-# CONFIG_DEBUG_LOCK_ALLOC is not set +-# CONFIG_PROVE_LOCKING is not set +-# CONFIG_LOCK_STAT is not set +-# CONFIG_DEBUG_ATOMIC_SLEEP is not set +-# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set +-# CONFIG_LOCK_TORTURE_TEST is not set +-CONFIG_STACKTRACE=y +-# CONFIG_DEBUG_KOBJECT is not set +-# CONFIG_DEBUG_BUGVERBOSE is not set +-# CONFIG_DEBUG_LIST is not set +-# CONFIG_DEBUG_PI_LIST is not set +-# CONFIG_DEBUG_SG is not set +-# CONFIG_DEBUG_NOTIFIERS is not set +-# CONFIG_DEBUG_CREDENTIALS is not set +- +-# +-# RCU Debugging +-# +-# CONFIG_PROVE_RCU is not set +-# CONFIG_SPARSE_RCU_POINTER is not set +-# CONFIG_TORTURE_TEST is not set +-# CONFIG_RCU_TORTURE_TEST is not set +-CONFIG_RCU_CPU_STALL_TIMEOUT=21 +-# CONFIG_RCU_TRACE is not set +-# CONFIG_RCU_EQS_DEBUG is not set +-# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set +-# CONFIG_NOTIFIER_ERROR_INJECTION is not set +-# CONFIG_FAULT_INJECTION is not set +-CONFIG_NOP_TRACER=y +-CONFIG_HAVE_FUNCTION_TRACER=y +-CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y +-CONFIG_HAVE_DYNAMIC_FTRACE=y +-CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y +-CONFIG_HAVE_SYSCALL_TRACEPOINTS=y +-CONFIG_HAVE_C_RECORDMCOUNT=y +-CONFIG_TRACE_CLOCK=y +-CONFIG_RING_BUFFER=y +-CONFIG_EVENT_TRACING=y +-CONFIG_CONTEXT_SWITCH_TRACER=y +-CONFIG_TRACING=y +-CONFIG_GENERIC_TRACER=y +-CONFIG_TRACING_SUPPORT=y +-CONFIG_FTRACE=y +-CONFIG_FUNCTION_TRACER=y +-CONFIG_FUNCTION_GRAPH_TRACER=y +-# CONFIG_IRQSOFF_TRACER is not set +-# CONFIG_PREEMPT_TRACER is not set +-# CONFIG_SCHED_TRACER is not set +-# CONFIG_MISSED_TIMER_OFFSETS_HIST is not set +-# CONFIG_FTRACE_SYSCALLS is not set +-# CONFIG_TRACER_SNAPSHOT is not set +-CONFIG_BRANCH_PROFILE_NONE=y +-# CONFIG_PROFILE_ANNOTATED_BRANCHES is not set +-# CONFIG_PROFILE_ALL_BRANCHES is not set +-# CONFIG_STACK_TRACER is not set +-# CONFIG_BLK_DEV_IO_TRACE is not set +-# CONFIG_UPROBE_EVENT is not set +-# CONFIG_PROBE_EVENTS is not set +-CONFIG_DYNAMIC_FTRACE=y +-# CONFIG_FUNCTION_PROFILER is not set +-CONFIG_FTRACE_MCOUNT_RECORD=y +-# CONFIG_FTRACE_STARTUP_TEST is not set +-# CONFIG_TRACEPOINT_BENCHMARK is not set +-# CONFIG_RING_BUFFER_BENCHMARK is not set +-# CONFIG_RING_BUFFER_STARTUP_TEST is not set +-# CONFIG_TRACE_ENUM_MAP_FILE is not set +-# CONFIG_TRACING_EVENTS_GPIO is not set +- +-# +-# Runtime Testing +-# +-# CONFIG_LKDTM is not set +-# CONFIG_TEST_LIST_SORT is not set +-# CONFIG_BACKTRACE_SELF_TEST is not set +-# CONFIG_RBTREE_TEST is not set +-# CONFIG_INTERVAL_TREE_TEST is not set +-# CONFIG_PERCPU_TEST is not set +-# CONFIG_ATOMIC64_SELFTEST is not set +-# CONFIG_ASYNC_RAID6_TEST is not set +-# CONFIG_TEST_HEXDUMP is not set +-# CONFIG_TEST_STRING_HELPERS is not set +-# CONFIG_TEST_KSTRTOX is not set +-# CONFIG_TEST_PRINTF is not set +-# CONFIG_TEST_RHASHTABLE is not set +-# CONFIG_DMA_API_DEBUG is not set +-# CONFIG_TEST_LKM is not set +-# CONFIG_TEST_USER_COPY is not set +-# CONFIG_TEST_BPF is not set +-# CONFIG_TEST_FIRMWARE is not set +-# CONFIG_TEST_UDELAY is not set +-# CONFIG_MEMTEST is not set +-# CONFIG_TEST_STATIC_KEYS is not set +-# CONFIG_SAMPLES is not set +-CONFIG_HAVE_ARCH_KGDB=y +-# CONFIG_KGDB is not set +-# CONFIG_ARM_PTDUMP is not set +-# CONFIG_STRICT_DEVMEM is not set +-CONFIG_ARM_UNWIND=y +-CONFIG_OLD_MCOUNT=y +-# CONFIG_DEBUG_USER is not set +-# CONFIG_DEBUG_LL is not set +-CONFIG_DEBUG_IMX_UART_PORT=1 +-CONFIG_DEBUG_LL_INCLUDE="mach/debug-macro.S" +-# CONFIG_DEBUG_UART_8250 is not set +-# CONFIG_DEBUG_UART_BCM63XX is not set +-CONFIG_UNCOMPRESS_INCLUDE="debug/uncompress.h" +-# CONFIG_PID_IN_CONTEXTIDR is not set +-# CONFIG_DEBUG_SET_MODULE_RONX is not set +-# CONFIG_CORESIGHT is not set +- +-# +-# Security options +-# +-CONFIG_KEYS=y +-# CONFIG_PERSISTENT_KEYRINGS is not set +-# CONFIG_BIG_KEYS is not set +-CONFIG_ENCRYPTED_KEYS=y +-# CONFIG_SECURITY_DMESG_RESTRICT is not set +-# CONFIG_SECURITY is not set +-# CONFIG_SECURITYFS is not set +-CONFIG_DEFAULT_SECURITY_DAC=y +-CONFIG_DEFAULT_SECURITY="" +-CONFIG_XOR_BLOCKS=y +-CONFIG_ASYNC_CORE=m +-CONFIG_ASYNC_MEMCPY=m +-CONFIG_ASYNC_XOR=m +-CONFIG_ASYNC_PQ=m +-CONFIG_ASYNC_RAID6_RECOV=m +-CONFIG_CRYPTO=y +- +-# +-# Crypto core or helper +-# +-CONFIG_CRYPTO_ALGAPI=y +-CONFIG_CRYPTO_ALGAPI2=y +-CONFIG_CRYPTO_AEAD=y +-CONFIG_CRYPTO_AEAD2=y +-CONFIG_CRYPTO_BLKCIPHER=y +-CONFIG_CRYPTO_BLKCIPHER2=y +-CONFIG_CRYPTO_HASH=y +-CONFIG_CRYPTO_HASH2=y +-CONFIG_CRYPTO_RNG=y +-CONFIG_CRYPTO_RNG2=y +-CONFIG_CRYPTO_RNG_DEFAULT=y +-CONFIG_CRYPTO_PCOMP=y +-CONFIG_CRYPTO_PCOMP2=y +-CONFIG_CRYPTO_AKCIPHER2=y +-CONFIG_CRYPTO_AKCIPHER=m +-CONFIG_CRYPTO_RSA=m +-CONFIG_CRYPTO_CRYPTODEV=y +-CONFIG_CRYPTO_MANAGER=y +-CONFIG_CRYPTO_MANAGER2=y +-CONFIG_CRYPTO_USER=y +-CONFIG_CRYPTO_MANAGER_DISABLE_TESTS=y +-CONFIG_CRYPTO_GF128MUL=y +-CONFIG_CRYPTO_NULL=y +-CONFIG_CRYPTO_NULL2=y +-CONFIG_CRYPTO_PCRYPT=y +-CONFIG_CRYPTO_WORKQUEUE=y +-CONFIG_CRYPTO_CRYPTD=y +-CONFIG_CRYPTO_MCRYPTD=m +-CONFIG_CRYPTO_AUTHENC=y +-# CONFIG_CRYPTO_TEST is not set +-CONFIG_CRYPTO_ABLK_HELPER=m +- +-# +-# Authenticated Encryption with Associated Data +-# +-CONFIG_CRYPTO_CCM=y +-CONFIG_CRYPTO_GCM=y +-CONFIG_CRYPTO_CHACHA20POLY1305=m +-CONFIG_CRYPTO_SEQIV=y +-CONFIG_CRYPTO_ECHAINIV=m +- +-# +-# Block modes +-# +-CONFIG_CRYPTO_CBC=y +-CONFIG_CRYPTO_CTR=y +-CONFIG_CRYPTO_CTS=y +-CONFIG_CRYPTO_ECB=y +-CONFIG_CRYPTO_LRW=y +-CONFIG_CRYPTO_PCBC=y +-CONFIG_CRYPTO_XTS=y +-CONFIG_CRYPTO_KEYWRAP=m +- +-# +-# Hash modes +-# +-CONFIG_CRYPTO_CMAC=y +-CONFIG_CRYPTO_HMAC=y +-CONFIG_CRYPTO_XCBC=y +-CONFIG_CRYPTO_VMAC=y +- +-# +-# Digest +-# +-CONFIG_CRYPTO_CRC32C=y +-CONFIG_CRYPTO_CRC32=y +-CONFIG_CRYPTO_CRCT10DIF=y +-CONFIG_CRYPTO_GHASH=y +-CONFIG_CRYPTO_POLY1305=m +-CONFIG_CRYPTO_MD4=y +-CONFIG_CRYPTO_MD5=y +-CONFIG_CRYPTO_MICHAEL_MIC=y +-CONFIG_CRYPTO_RMD128=m +-CONFIG_CRYPTO_RMD160=m +-CONFIG_CRYPTO_RMD256=m +-CONFIG_CRYPTO_RMD320=m +-CONFIG_CRYPTO_SHA1=y +-CONFIG_CRYPTO_SHA256=y +-CONFIG_CRYPTO_SHA512=y +-CONFIG_CRYPTO_TGR192=m +-CONFIG_CRYPTO_WP512=m +- +-# +-# Ciphers +-# +-CONFIG_CRYPTO_AES=y +-CONFIG_CRYPTO_ANUBIS=m +-CONFIG_CRYPTO_ARC4=y +-CONFIG_CRYPTO_BLOWFISH=m +-CONFIG_CRYPTO_BLOWFISH_COMMON=m +-CONFIG_CRYPTO_CAMELLIA=m +-CONFIG_CRYPTO_CAST_COMMON=m +-CONFIG_CRYPTO_CAST5=m +-CONFIG_CRYPTO_CAST6=m +-CONFIG_CRYPTO_DES=y +-CONFIG_CRYPTO_FCRYPT=m +-CONFIG_CRYPTO_KHAZAD=m +-CONFIG_CRYPTO_SALSA20=m +-CONFIG_CRYPTO_CHACHA20=m +-CONFIG_CRYPTO_SEED=m +-CONFIG_CRYPTO_SERPENT=m +-CONFIG_CRYPTO_TEA=y +-CONFIG_CRYPTO_TWOFISH=y +-CONFIG_CRYPTO_TWOFISH_COMMON=y +- +-# +-# Compression +-# +-CONFIG_CRYPTO_DEFLATE=y +-CONFIG_CRYPTO_ZLIB=y +-CONFIG_CRYPTO_LZO=y +-CONFIG_CRYPTO_842=y +-CONFIG_CRYPTO_LZ4=y +-CONFIG_CRYPTO_LZ4HC=y +- +-# +-# Random Number Generation +-# +-CONFIG_CRYPTO_ANSI_CPRNG=y +-CONFIG_CRYPTO_DRBG_MENU=y +-CONFIG_CRYPTO_DRBG_HMAC=y +-# CONFIG_CRYPTO_DRBG_HASH is not set +-# CONFIG_CRYPTO_DRBG_CTR is not set +-CONFIG_CRYPTO_DRBG=y +-CONFIG_CRYPTO_JITTERENTROPY=y +-CONFIG_CRYPTO_USER_API=m +-CONFIG_CRYPTO_USER_API_HASH=m +-CONFIG_CRYPTO_USER_API_SKCIPHER=m +-CONFIG_CRYPTO_USER_API_RNG=m +-# CONFIG_CRYPTO_USER_API_AEAD is not set +-CONFIG_CRYPTO_HASH_INFO=y +-CONFIG_CRYPTO_HW=y +-# CONFIG_CRYPTO_DEV_HIFN_795X is not set +-CONFIG_CRYPTO_DEV_FSL_CAAM=y +-CONFIG_CRYPTO_DEV_FSL_CAAM_JR=y +-CONFIG_CRYPTO_DEV_FSL_CAAM_RINGSIZE=9 +-# CONFIG_CRYPTO_DEV_FSL_CAAM_INTC is not set +-CONFIG_CRYPTO_DEV_FSL_CAAM_CRYPTO_API=y +-CONFIG_CRYPTO_DEV_FSL_CAAM_AHASH_API=y +-CONFIG_CRYPTO_DEV_FSL_CAAM_RNG_API=y +-CONFIG_CRYPTO_DEV_FSL_CAAM_IMX=y +-CONFIG_CRYPTO_DEV_FSL_CAAM_LE=y +-# CONFIG_CRYPTO_DEV_FSL_CAAM_SM is not set +-# CONFIG_CRYPTO_DEV_FSL_CAAM_SECVIO is not set +-# CONFIG_CRYPTO_DEV_FSL_CAAM_DEBUG is not set +-# CONFIG_CRYPTO_DEV_SAHARA is not set +-# CONFIG_CRYPTO_DEV_MXS_DCP is not set +-CONFIG_ASYMMETRIC_KEY_TYPE=m +-CONFIG_ASYMMETRIC_PUBLIC_KEY_SUBTYPE=m +-CONFIG_PUBLIC_KEY_ALGO_RSA=m +-CONFIG_X509_CERTIFICATE_PARSER=m +-CONFIG_PKCS7_MESSAGE_PARSER=m +-CONFIG_PKCS7_TEST_KEY=m +- +-# +-# Certificates for signature checking +-# +-CONFIG_SYSTEM_TRUSTED_KEYRING=y +-CONFIG_SYSTEM_TRUSTED_KEYS="" +-CONFIG_ARM_CRYPTO=y +-CONFIG_CRYPTO_SHA1_ARM=m +-CONFIG_CRYPTO_SHA1_ARM_NEON=m +-CONFIG_CRYPTO_SHA1_ARM_CE=m +-CONFIG_CRYPTO_SHA2_ARM_CE=m +-CONFIG_CRYPTO_SHA256_ARM=y +-CONFIG_CRYPTO_SHA512_ARM=m +-CONFIG_CRYPTO_AES_ARM=m +-CONFIG_CRYPTO_AES_ARM_BS=m +-CONFIG_CRYPTO_AES_ARM_CE=m +-CONFIG_CRYPTO_GHASH_ARM_CE=m +-CONFIG_BINARY_PRINTF=y +- +-# +-# Library routines +-# +-CONFIG_RAID6_PQ=y +-CONFIG_BITREVERSE=y +-CONFIG_HAVE_ARCH_BITREVERSE=y +-CONFIG_RATIONAL=y +-CONFIG_GENERIC_STRNCPY_FROM_USER=y +-CONFIG_GENERIC_STRNLEN_USER=y +-CONFIG_GENERIC_NET_UTILS=y +-CONFIG_GENERIC_PCI_IOMAP=y +-CONFIG_GENERIC_IO=y +-CONFIG_STMP_DEVICE=y +-CONFIG_ARCH_USE_CMPXCHG_LOCKREF=y +-CONFIG_CRC_CCITT=y +-CONFIG_CRC16=y +-CONFIG_CRC_T10DIF=y +-CONFIG_CRC_ITU_T=y +-CONFIG_CRC32=y +-# CONFIG_CRC32_SELFTEST is not set +-CONFIG_CRC32_SLICEBY8=y +-# CONFIG_CRC32_SLICEBY4 is not set +-# CONFIG_CRC32_SARWATE is not set +-# CONFIG_CRC32_BIT is not set +-CONFIG_CRC7=y +-CONFIG_LIBCRC32C=y +-CONFIG_CRC8=m +-# CONFIG_AUDIT_ARCH_COMPAT_GENERIC is not set +-# CONFIG_RANDOM32_SELFTEST is not set +-CONFIG_842_COMPRESS=y +-CONFIG_842_DECOMPRESS=y +-CONFIG_ZLIB_INFLATE=y +-CONFIG_ZLIB_DEFLATE=y +-CONFIG_LZO_COMPRESS=y +-CONFIG_LZO_DECOMPRESS=y +-CONFIG_LZ4_COMPRESS=y +-CONFIG_LZ4HC_COMPRESS=y +-CONFIG_LZ4_DECOMPRESS=y +-CONFIG_XZ_DEC=m +-# CONFIG_XZ_DEC_X86 is not set +-# CONFIG_XZ_DEC_POWERPC is not set +-# CONFIG_XZ_DEC_IA64 is not set +-CONFIG_XZ_DEC_ARM=y +-CONFIG_XZ_DEC_ARMTHUMB=y +-# CONFIG_XZ_DEC_SPARC is not set +-CONFIG_XZ_DEC_BCJ=y +-# CONFIG_XZ_DEC_TEST is not set +-CONFIG_DECOMPRESS_GZIP=y +-CONFIG_DECOMPRESS_LZO=y +-CONFIG_GENERIC_ALLOCATOR=y +-CONFIG_TEXTSEARCH=y +-CONFIG_TEXTSEARCH_KMP=m +-CONFIG_TEXTSEARCH_BM=m +-CONFIG_TEXTSEARCH_FSM=m +-CONFIG_BTREE=y +-CONFIG_ASSOCIATIVE_ARRAY=y +-CONFIG_HAS_IOMEM=y +-CONFIG_HAS_IOPORT_MAP=y +-CONFIG_HAS_DMA=y +-CONFIG_CPU_RMAP=y +-CONFIG_DQL=y +-CONFIG_GLOB=y +-# CONFIG_GLOB_SELFTEST is not set +-CONFIG_NLATTR=y +-CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE=y +-CONFIG_CLZ_TAB=y +-CONFIG_CORDIC=y +-# CONFIG_DDR is not set +-CONFIG_MPILIB=m +-CONFIG_LIBFDT=y +-CONFIG_OID_REGISTRY=y +-CONFIG_FONT_SUPPORT=y +-# CONFIG_FONTS is not set +-CONFIG_FONT_8x8=y +-CONFIG_FONT_8x16=y +-# CONFIG_SG_SPLIT is not set +-CONFIG_ARCH_HAS_SG_CHAIN=y +-# CONFIG_VIRTUALIZATION is not set +diff --git a/arch/arm/configs/xbian_defconfig_imx6_mvebu b/arch/arm/configs/xbian_defconfig_imx6_mvebu +index 2bc59d8..83cda36 100644 +--- a/arch/arm/configs/xbian_defconfig_imx6_mvebu ++++ b/arch/arm/configs/xbian_defconfig_imx6_mvebu +@@ -1,6 +1,6 @@ + # + # Automatically generated file; DO NOT EDIT. +-# Linux/arm 4.4.1 Kernel Configuration ++# Linux/arm 4.4.6 Kernel Configuration + # + CONFIG_ARM=y + CONFIG_ARM_HAS_SG_CHAIN=y +@@ -83,7 +83,7 @@ CONFIG_NO_HZ_COMMON=y + # CONFIG_HZ_PERIODIC is not set + CONFIG_NO_HZ_IDLE=y + # CONFIG_NO_HZ_FULL is not set +-CONFIG_NO_HZ=y ++# CONFIG_NO_HZ is not set + CONFIG_HIGH_RES_TIMERS=y + + # +@@ -104,12 +104,12 @@ CONFIG_RCU_EXPERT=y + CONFIG_SRCU=y + # CONFIG_TASKS_RCU is not set + CONFIG_RCU_STALL_COMMON=y +-CONFIG_RCU_FANOUT=16 +-CONFIG_RCU_FANOUT_LEAF=8 ++CONFIG_RCU_FANOUT=8 ++CONFIG_RCU_FANOUT_LEAF=2 + # CONFIG_TREE_RCU_TRACE is not set + CONFIG_RCU_BOOST=y + CONFIG_RCU_KTHREAD_PRIO=1 +-CONFIG_RCU_BOOST_DELAY=500 ++CONFIG_RCU_BOOST_DELAY=300 + CONFIG_RCU_NOCB_CPU=y + CONFIG_RCU_NOCB_CPU_NONE=y + # CONFIG_RCU_NOCB_CPU_ZERO is not set +@@ -166,7 +166,6 @@ CONFIG_MULTIUSER=y + CONFIG_SYSFS_SYSCALL=y + CONFIG_SYSCTL_SYSCALL=y + CONFIG_KALLSYMS=y +-CONFIG_KALLSYMS_ALL=y + CONFIG_PRINTK=y + CONFIG_BUG=y + CONFIG_BASE_FULL=y +@@ -178,7 +177,7 @@ CONFIG_EVENTFD=y + # CONFIG_BPF_SYSCALL is not set + CONFIG_SHMEM=y + CONFIG_AIO=y +-# CONFIG_ADVISE_SYSCALLS is not set ++CONFIG_ADVISE_SYSCALLS=y + CONFIG_USERFAULTFD=y + CONFIG_PCI_QUIRKS=y + CONFIG_MEMBARRIER=y +@@ -190,7 +189,6 @@ CONFIG_PERF_USE_VMALLOC=y + # Kernel Performance Events And Counters + # + CONFIG_PERF_EVENTS=y +-# CONFIG_DEBUG_PERF_USE_VMALLOC is not set + # CONFIG_VM_EVENT_COUNTERS is not set + # CONFIG_SLUB_DEBUG is not set + CONFIG_COMPAT_BRK=y +@@ -248,8 +246,8 @@ CONFIG_MODULES=y + # CONFIG_MODULE_FORCE_LOAD is not set + CONFIG_MODULE_UNLOAD=y + # CONFIG_MODULE_FORCE_UNLOAD is not set +-CONFIG_MODVERSIONS=y +-CONFIG_MODULE_SRCVERSION_ALL=y ++# CONFIG_MODVERSIONS is not set ++# CONFIG_MODULE_SRCVERSION_ALL is not set + # CONFIG_MODULE_SIG is not set + # CONFIG_MODULE_COMPRESS is not set + CONFIG_MODULES_TREE_LOOKUP=y +@@ -490,7 +488,6 @@ CONFIG_PCI_DOMAINS=y + CONFIG_PCI_DOMAINS_GENERIC=y + CONFIG_PCI_SYSCALL=y + CONFIG_PCI_MSI=y +-# CONFIG_PCI_DEBUG is not set + CONFIG_PCI_REALLOC_ENABLE_AUTO=y + CONFIG_PCI_STUB=y + CONFIG_PCI_ATS=y +@@ -587,14 +584,12 @@ CONFIG_MIGRATION=y + CONFIG_ZONE_DMA_FLAG=1 + CONFIG_BOUNCE=y + # CONFIG_KSM is not set +-CONFIG_DEFAULT_MMAP_MIN_ADDR=16384 +-CONFIG_CLEANCACHE=y +-CONFIG_FRONTSWAP=y ++CONFIG_DEFAULT_MMAP_MIN_ADDR=8192 ++# CONFIG_CLEANCACHE is not set ++# CONFIG_FRONTSWAP is not set + CONFIG_CMA=y +-# CONFIG_CMA_DEBUG is not set + # CONFIG_CMA_DEBUGFS is not set + CONFIG_CMA_AREAS=7 +-# CONFIG_ZSWAP is not set + # CONFIG_ZPOOL is not set + # CONFIG_ZBUD is not set + # CONFIG_ZSMALLOC is not set +@@ -699,14 +694,18 @@ CONFIG_BINFMT_MISC=m + CONFIG_SUSPEND=y + CONFIG_SUSPEND_FREEZER=y + # CONFIG_SUSPEND_SKIP_SYNC is not set +-# CONFIG_HIBERNATION is not set ++CONFIG_HIBERNATE_CALLBACKS=y ++CONFIG_HIBERNATION=y ++CONFIG_PM_STD_PARTITION="" + CONFIG_PM_SLEEP=y + CONFIG_PM_SLEEP_SMP=y + # CONFIG_PM_AUTOSLEEP is not set +-# CONFIG_PM_WAKELOCKS is not set ++CONFIG_PM_WAKELOCKS=y ++CONFIG_PM_WAKELOCKS_LIMIT=100 ++CONFIG_PM_WAKELOCKS_GC=y + CONFIG_PM=y + # CONFIG_PM_DEBUG is not set +-# CONFIG_APM_EMULATION is not set ++CONFIG_APM_EMULATION=y + CONFIG_PM_OPP=y + CONFIG_PM_CLK=y + CONFIG_PM_GENERIC_DOMAINS=y +@@ -777,7 +776,7 @@ CONFIG_INET_UDP_DIAG=m + CONFIG_TCP_CONG_ADVANCED=y + CONFIG_TCP_CONG_BIC=m + CONFIG_TCP_CONG_CUBIC=m +-CONFIG_TCP_CONG_WESTWOOD=m ++CONFIG_TCP_CONG_WESTWOOD=y + CONFIG_TCP_CONG_HTCP=m + CONFIG_TCP_CONG_HSTCP=m + CONFIG_TCP_CONG_HYBLA=m +@@ -789,9 +788,10 @@ CONFIG_TCP_CONG_YEAH=y + CONFIG_TCP_CONG_ILLINOIS=m + CONFIG_TCP_CONG_DCTCP=m + # CONFIG_TCP_CONG_CDG is not set +-CONFIG_DEFAULT_VEGAS=y ++# CONFIG_DEFAULT_VEGAS is not set ++CONFIG_DEFAULT_WESTWOOD=y + # CONFIG_DEFAULT_RENO is not set +-CONFIG_DEFAULT_TCP_CONG="vegas" ++CONFIG_DEFAULT_TCP_CONG="westwood" + CONFIG_TCP_MD5SIG=y + CONFIG_IPV6=m + CONFIG_IPV6_ROUTER_PREF=y +@@ -821,7 +821,7 @@ CONFIG_IPV6_MROUTE_MULTIPLE_TABLES=y + CONFIG_IPV6_PIMSM_V2=y + # CONFIG_NETWORK_SECMARK is not set + CONFIG_NET_PTP_CLASSIFY=y +-# CONFIG_NETWORK_PHY_TIMESTAMPING is not set ++CONFIG_NETWORK_PHY_TIMESTAMPING=y + CONFIG_NETFILTER=y + # CONFIG_NETFILTER_DEBUG is not set + CONFIG_NETFILTER_ADVANCED=y +@@ -1153,20 +1153,15 @@ CONFIG_INET_DCCP_DIAG=m + CONFIG_IP_DCCP_CCID3=y + # CONFIG_IP_DCCP_CCID3_DEBUG is not set + CONFIG_IP_DCCP_TFRC_LIB=y +- +-# +-# DCCP Kernel Hacking +-# +-# CONFIG_IP_DCCP_DEBUG is not set + CONFIG_IP_SCTP=m + # CONFIG_SCTP_DBG_OBJCNT is not set +-CONFIG_SCTP_DEFAULT_COOKIE_HMAC_MD5=y ++# CONFIG_SCTP_DEFAULT_COOKIE_HMAC_MD5 is not set + # CONFIG_SCTP_DEFAULT_COOKIE_HMAC_SHA1 is not set +-# CONFIG_SCTP_DEFAULT_COOKIE_HMAC_NONE is not set +-CONFIG_SCTP_COOKIE_HMAC_MD5=y +-CONFIG_SCTP_COOKIE_HMAC_SHA1=y ++CONFIG_SCTP_DEFAULT_COOKIE_HMAC_NONE=y ++# CONFIG_SCTP_COOKIE_HMAC_MD5 is not set ++# CONFIG_SCTP_COOKIE_HMAC_SHA1 is not set + CONFIG_RDS=m +-# CONFIG_RDS_TCP is not set ++CONFIG_RDS_TCP=m + # CONFIG_RDS_DEBUG is not set + CONFIG_TIPC=m + CONFIG_TIPC_MEDIA_UDP=y +@@ -1177,6 +1172,8 @@ CONFIG_L2TP_V3=y + CONFIG_L2TP_IP=m + CONFIG_L2TP_ETH=m + CONFIG_STP=m ++CONFIG_GARP=m ++CONFIG_MRP=m + CONFIG_BRIDGE=m + CONFIG_BRIDGE_IGMP_SNOOPING=y + CONFIG_BRIDGE_VLAN_FILTERING=y +@@ -1185,8 +1182,8 @@ CONFIG_NET_DSA=y + CONFIG_NET_DSA_HWMON=y + CONFIG_NET_DSA_TAG_EDSA=y + CONFIG_VLAN_8021Q=m +-# CONFIG_VLAN_8021Q_GVRP is not set +-# CONFIG_VLAN_8021Q_MVRP is not set ++CONFIG_VLAN_8021Q_GVRP=y ++CONFIG_VLAN_8021Q_MVRP=y + # CONFIG_DECNET is not set + CONFIG_LLC=m + CONFIG_LLC2=m +@@ -1197,7 +1194,7 @@ CONFIG_IPDDP=m + CONFIG_IPDDP_ENCAP=y + # CONFIG_X25 is not set + # CONFIG_LAPB is not set +-# CONFIG_PHONET is not set ++CONFIG_PHONET=m + # CONFIG_6LOWPAN is not set + # CONFIG_IEEE802154 is not set + CONFIG_NET_SCHED=y +@@ -1286,7 +1283,7 @@ CONFIG_NET_MPLS_GSO=m + # CONFIG_MPLS_ROUTING is not set + # CONFIG_HSR is not set + CONFIG_NET_SWITCHDEV=y +-# CONFIG_NET_L3_MASTER_DEV is not set ++CONFIG_NET_L3_MASTER_DEV=y + CONFIG_RPS=y + CONFIG_RFS_ACCEL=y + CONFIG_XPS=y +@@ -1403,7 +1400,6 @@ CONFIG_BT_CMTP=m + CONFIG_BT_HIDP=y + CONFIG_BT_HS=y + CONFIG_BT_LE=y +-# CONFIG_BT_SELFTEST is not set + # CONFIG_BT_DEBUGFS is not set + + # +@@ -1523,8 +1519,6 @@ CONFIG_FW_LOADER_USER_HELPER_FALLBACK=y + CONFIG_WANT_DEV_COREDUMP=y + CONFIG_ALLOW_DEV_COREDUMP=y + CONFIG_DEV_COREDUMP=y +-# CONFIG_DEBUG_DRIVER is not set +-# CONFIG_DEBUG_DEVRES is not set + # CONFIG_SYS_HYPERVISOR is not set + # CONFIG_GENERIC_CPU_DEVICES is not set + CONFIG_SOC_BUS=y +@@ -2043,9 +2037,9 @@ CONFIG_DM_VERITY=m + # CONFIG_FIREWIRE is not set + # CONFIG_FIREWIRE_NOSY is not set + CONFIG_NETDEVICES=y +-CONFIG_MII=y ++CONFIG_MII=m + CONFIG_NET_CORE=y +-CONFIG_BONDING=y ++CONFIG_BONDING=m + CONFIG_DUMMY=m + CONFIG_EQUALIZER=m + # CONFIG_NET_FC is not set +@@ -2070,6 +2064,7 @@ CONFIG_TUN=m + CONFIG_VETH=m + # CONFIG_VIRTIO_NET is not set + CONFIG_NLMON=m ++# CONFIG_NET_VRF is not set + # CONFIG_ARCNET is not set + + # +@@ -2096,7 +2091,7 @@ CONFIG_NET_DSA_MV88E6XXX=y + CONFIG_NET_DSA_MV88E6352=y + # CONFIG_NET_DSA_BCM_SF2 is not set + CONFIG_ETHERNET=y +-CONFIG_MDIO=y ++CONFIG_MDIO=m + # CONFIG_NET_VENDOR_3COM is not set + # CONFIG_NET_VENDOR_ADAPTEC is not set + # CONFIG_NET_VENDOR_AGERE is not set +@@ -2105,11 +2100,11 @@ CONFIG_MDIO=y + # CONFIG_NET_VENDOR_AMD is not set + # CONFIG_NET_VENDOR_ARC is not set + CONFIG_NET_VENDOR_ATHEROS=y +-CONFIG_ATL2=y +-CONFIG_ATL1=y +-CONFIG_ATL1E=y +-CONFIG_ATL1C=y +-CONFIG_ALX=y ++CONFIG_ATL2=m ++CONFIG_ATL1=m ++CONFIG_ATL1E=m ++CONFIG_ATL1C=m ++CONFIG_ALX=m + # CONFIG_NET_VENDOR_AURORA is not set + # CONFIG_NET_CADENCE is not set + # CONFIG_NET_VENDOR_BROADCOM is not set +@@ -2129,7 +2124,7 @@ CONFIG_ALX=y + CONFIG_NET_VENDOR_FREESCALE=y + CONFIG_FEC=y + CONFIG_FSL_PQ_MDIO=y +-CONFIG_FSL_XGMAC_MDIO=y ++# CONFIG_FSL_XGMAC_MDIO is not set + CONFIG_GIANFAR=y + # CONFIG_NET_VENDOR_HISILICON is not set + # CONFIG_NET_VENDOR_HP is not set +@@ -2279,6 +2274,7 @@ CONFIG_USB_NET_KALMIA=m + CONFIG_USB_NET_QMI_WWAN=m + CONFIG_USB_HSO=m + CONFIG_USB_NET_INT51X1=m ++# CONFIG_USB_CDC_PHONET is not set + CONFIG_USB_IPHETH=m + CONFIG_USB_SIERRA_NET=m + CONFIG_USB_VL600=m +@@ -2471,24 +2467,9 @@ CONFIG_RT2X00_LIB_LEDS=y + # CONFIG_RT2X00_DEBUG is not set + CONFIG_WL_MEDIATEK=y + CONFIG_MT7601U=m +-CONFIG_RTL_CARDS=m +-CONFIG_RTL8192CE=m +-CONFIG_RTL8192SE=m +-CONFIG_RTL8192DE=m +-CONFIG_RTL8723AE=m +-CONFIG_RTL8723BE=m +-CONFIG_RTL8188EE=m +-CONFIG_RTL8192EE=m +-CONFIG_RTL8821AE=m ++CONFIG_RTL8XXXU=m ++CONFIG_RTL8XXXU_UNTESTED=y + CONFIG_RTL8192CU=m +-CONFIG_RTLWIFI=m +-CONFIG_RTLWIFI_PCI=m +-CONFIG_RTLWIFI_USB=m +-CONFIG_RTLWIFI_DEBUG=y +-CONFIG_RTL8192C_COMMON=m +-CONFIG_RTL8723_COMMON=m +-CONFIG_RTLBTCOEXIST=m +-# CONFIG_RTL8XXXU is not set + CONFIG_WL_TI=y + CONFIG_WL1251=m + CONFIG_WL1251_SPI=m +@@ -2619,6 +2600,7 @@ CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 + CONFIG_INPUT_JOYDEV=m + CONFIG_INPUT_EVDEV=y + CONFIG_INPUT_EVBUG=m ++# CONFIG_INPUT_APMPOWER is not set + + # + # Input Device Drivers +@@ -3007,7 +2989,6 @@ CONFIG_I2C_SLAVE_EEPROM=m + # CONFIG_I2C_DEBUG_ALGO is not set + # CONFIG_I2C_DEBUG_BUS is not set + CONFIG_SPI=y +-# CONFIG_SPI_DEBUG is not set + CONFIG_SPI_MASTER=y + + # +@@ -3016,8 +2997,8 @@ CONFIG_SPI_MASTER=y + # CONFIG_SPI_ALTERA is not set + CONFIG_SPI_BITBANG=y + # CONFIG_SPI_CADENCE is not set +-CONFIG_SPI_GPIO=y +-CONFIG_SPI_IMX=m ++# CONFIG_SPI_GPIO is not set ++CONFIG_SPI_IMX=y + # CONFIG_SPI_FSL_SPI is not set + # CONFIG_SPI_OC_TINY is not set + CONFIG_SPI_ORION=m +@@ -3043,13 +3024,14 @@ CONFIG_SPI_SPIDEV=y + # + CONFIG_PPS=y + # CONFIG_PPS_DEBUG is not set ++CONFIG_NTP_PPS=y + + # + # PPS clients support + # + # CONFIG_PPS_CLIENT_KTIMER is not set +-CONFIG_PPS_CLIENT_LDISC=m +-CONFIG_PPS_CLIENT_GPIO=m ++CONFIG_PPS_CLIENT_LDISC=y ++CONFIG_PPS_CLIENT_GPIO=y + + # + # PPS generators support +@@ -3060,10 +3042,7 @@ CONFIG_PPS_CLIENT_GPIO=m + # + CONFIG_PTP_1588_CLOCK=y + CONFIG_PTP_1588_CLOCK_GIANFAR=y +- +-# +-# Enable PHYLIB and NETWORK_PHY_TIMESTAMPING to see the additional clocks. +-# ++# CONFIG_DP83640_PHY is not set + CONFIG_PINCTRL=y + + # +@@ -3072,7 +3051,6 @@ CONFIG_PINCTRL=y + CONFIG_PINMUX=y + CONFIG_PINCONF=y + CONFIG_GENERIC_PINCONF=y +-# CONFIG_DEBUG_PINCTRL is not set + # CONFIG_PINCTRL_AMD is not set + CONFIG_PINCTRL_SINGLE=y + CONFIG_PINCTRL_IMX=y +@@ -3087,7 +3065,6 @@ CONFIG_GPIOLIB=y + CONFIG_GPIO_DEVRES=y + CONFIG_OF_GPIO=y + CONFIG_GPIOLIB_IRQCHIP=y +-# CONFIG_DEBUG_GPIO is not set + CONFIG_GPIO_SYSFS=y + CONFIG_GPIO_GENERIC=y + +@@ -3101,6 +3078,7 @@ CONFIG_GPIO_74XX_MMIO=y + CONFIG_GPIO_GENERIC_PLATFORM=y + # CONFIG_GPIO_GRGPIO is not set + CONFIG_GPIO_MVEBU=y ++CONFIG_GPIO_MVEBU_PWM=y + CONFIG_GPIO_MXC=y + CONFIG_GPIO_SYSCON=y + # CONFIG_GPIO_VX855 is not set +@@ -3181,6 +3159,7 @@ CONFIG_W1_SLAVE_BQ27000=m + CONFIG_POWER_SUPPLY=y + # CONFIG_POWER_SUPPLY_DEBUG is not set + # CONFIG_PDA_POWER is not set ++# CONFIG_APM_POWER is not set + # CONFIG_GENERIC_ADC_BATTERY is not set + CONFIG_TEST_POWER=m + # CONFIG_BATTERY_88PM860X is not set +@@ -4830,7 +4809,7 @@ CONFIG_USB_XHCI_MVEBU=y + CONFIG_USB_EHCI_HCD=y + CONFIG_USB_EHCI_ROOT_HUB_TT=y + CONFIG_USB_EHCI_TT_NEWSCHED=y +-CONFIG_USB_FSL_MPH_DR_OF=m ++CONFIG_USB_FSL_MPH_DR_OF=y + CONFIG_USB_EHCI_PCI=y + CONFIG_USB_EHCI_MXC=y + CONFIG_USB_EHCI_HCD_ORION=y +@@ -5044,7 +5023,6 @@ CONFIG_USB_ISP1301=y + CONFIG_USB_MXS_PHY=y + # CONFIG_USB_ULPI is not set + CONFIG_USB_GADGET=y +-# CONFIG_USB_GADGET_DEBUG is not set + # CONFIG_USB_GADGET_DEBUG_FILES is not set + # CONFIG_USB_GADGET_DEBUG_FS is not set + CONFIG_USB_GADGET_VBUS_DRAW=2 +@@ -5053,7 +5031,7 @@ CONFIG_USB_GADGET_STORAGE_NUM_BUFFERS=2 + # + # USB Peripheral Controller + # +-CONFIG_USB_FSL_USB2=m ++CONFIG_USB_FSL_USB2=y + # CONFIG_USB_FUSB300 is not set + # CONFIG_USB_FOTG210_UDC is not set + # CONFIG_USB_GR_UDC is not set +@@ -5099,6 +5077,7 @@ CONFIG_USB_CONFIGFS_ECM=y + CONFIG_USB_CONFIGFS_ECM_SUBSET=y + CONFIG_USB_CONFIGFS_RNDIS=y + CONFIG_USB_CONFIGFS_EEM=y ++# CONFIG_USB_CONFIGFS_PHONET is not set + CONFIG_USB_CONFIGFS_MASS_STORAGE=y + CONFIG_USB_CONFIGFS_F_LB_SS=y + CONFIG_USB_CONFIGFS_F_FS=y +@@ -5126,6 +5105,7 @@ CONFIG_USB_G_SERIAL=m + CONFIG_USB_MIDI_GADGET=m + CONFIG_USB_G_PRINTER=m + CONFIG_USB_CDC_COMPOSITE=m ++# CONFIG_USB_G_NOKIA is not set + CONFIG_USB_G_ACM_MS=m + CONFIG_USB_G_MULTI=m + CONFIG_USB_G_MULTI_RNDIS=y +@@ -5531,11 +5511,14 @@ CONFIG_DVB_MN88473=m + CONFIG_LIRC_STAGING=y + CONFIG_LIRC_BT829=m + CONFIG_LIRC_IMON=m ++CONFIG_LIRC_HB=m ++CONFIG_LIRC_XBOX=m + CONFIG_LIRC_SASEM=m + CONFIG_LIRC_SERIAL=m + CONFIG_LIRC_SERIAL_TRANSMITTER=y + CONFIG_LIRC_SIR=m + CONFIG_LIRC_ZILOG=m ++CONFIG_LIRC_ATIUSB=m + + # + # Android +@@ -6177,7 +6160,6 @@ CONFIG_NFSD_V3=y + CONFIG_NFSD_V3_ACL=y + CONFIG_NFSD_V4=y + # CONFIG_NFSD_PNFS is not set +-# CONFIG_NFSD_FAULT_INJECTION is not set + CONFIG_GRACE_PERIOD=y + CONFIG_LOCKD=y + CONFIG_LOCKD_V4=y +@@ -6274,83 +6256,47 @@ CONFIG_DLM=m + # + CONFIG_PRINTK_TIME=y + CONFIG_MESSAGE_LOGLEVEL_DEFAULT=4 +-# CONFIG_BOOT_PRINTK_DELAY is not set + CONFIG_DYNAMIC_DEBUG=y + + # + # Compile-time checks and compiler options + # +-# CONFIG_DEBUG_INFO is not set + CONFIG_ENABLE_WARN_DEPRECATED=y + CONFIG_ENABLE_MUST_CHECK=y + CONFIG_FRAME_WARN=1024 + CONFIG_STRIP_ASM_SYMS=y +-# CONFIG_READABLE_ASM is not set + # CONFIG_UNUSED_SYMBOLS is not set +-# CONFIG_PAGE_OWNER is not set + CONFIG_DEBUG_FS=y + # CONFIG_HEADERS_CHECK is not set + # CONFIG_DEBUG_SECTION_MISMATCH is not set + CONFIG_SECTION_MISMATCH_WARN_ONLY=y + CONFIG_FRAME_POINTER=y +-# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set + CONFIG_MAGIC_SYSRQ=y + CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE=0x1 +-CONFIG_DEBUG_KERNEL=y ++# CONFIG_DEBUG_KERNEL is not set + + # + # Memory Debugging + # + # CONFIG_PAGE_EXTENSION is not set +-# CONFIG_DEBUG_PAGEALLOC is not set +-# CONFIG_DEBUG_OBJECTS is not set + # CONFIG_SLUB_STATS is not set + CONFIG_HAVE_DEBUG_KMEMLEAK=y +-# CONFIG_DEBUG_KMEMLEAK is not set +-# CONFIG_DEBUG_STACK_USAGE is not set +-# CONFIG_DEBUG_VM is not set + # CONFIG_DEBUG_MEMORY_INIT is not set +-# CONFIG_DEBUG_PER_CPU_MAPS is not set +-# CONFIG_DEBUG_HIGHMEM is not set +-# CONFIG_DEBUG_SHIRQ is not set + + # + # Debug Lockups and Hangs + # +-# CONFIG_LOCKUP_DETECTOR is not set +-# CONFIG_DETECT_HUNG_TASK is not set + CONFIG_PANIC_ON_OOPS=y + CONFIG_PANIC_ON_OOPS_VALUE=1 + CONFIG_PANIC_TIMEOUT=1 +-# CONFIG_SCHED_DEBUG is not set + # CONFIG_SCHED_INFO is not set +-# CONFIG_SCHEDSTATS is not set +-# CONFIG_SCHED_STACK_END_CHECK is not set + # CONFIG_DEBUG_TIMEKEEPING is not set +-CONFIG_TIMER_STATS=y +-# CONFIG_DEBUG_PREEMPT is not set + + # + # Lock Debugging (spinlocks, mutexes, etc...) + # +-# CONFIG_DEBUG_RT_MUTEXES is not set +-# CONFIG_DEBUG_SPINLOCK is not set +-# CONFIG_DEBUG_MUTEXES is not set +-# CONFIG_DEBUG_WW_MUTEX_SLOWPATH is not set +-# CONFIG_DEBUG_LOCK_ALLOC is not set +-# CONFIG_PROVE_LOCKING is not set +-# CONFIG_LOCK_STAT is not set +-# CONFIG_DEBUG_ATOMIC_SLEEP is not set +-# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set +-# CONFIG_LOCK_TORTURE_TEST is not set + CONFIG_STACKTRACE=y +-# CONFIG_DEBUG_KOBJECT is not set +-# CONFIG_DEBUG_BUGVERBOSE is not set +-# CONFIG_DEBUG_LIST is not set +-# CONFIG_DEBUG_PI_LIST is not set +-# CONFIG_DEBUG_SG is not set +-# CONFIG_DEBUG_NOTIFIERS is not set +-# CONFIG_DEBUG_CREDENTIALS is not set ++CONFIG_DEBUG_BUGVERBOSE=y + + # + # RCU Debugging +@@ -6358,13 +6304,7 @@ CONFIG_STACKTRACE=y + # CONFIG_PROVE_RCU is not set + # CONFIG_SPARSE_RCU_POINTER is not set + # CONFIG_TORTURE_TEST is not set +-# CONFIG_RCU_TORTURE_TEST is not set + CONFIG_RCU_CPU_STALL_TIMEOUT=21 +-# CONFIG_RCU_TRACE is not set +-# CONFIG_RCU_EQS_DEBUG is not set +-# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set +-# CONFIG_NOTIFIER_ERROR_INJECTION is not set +-# CONFIG_FAULT_INJECTION is not set + CONFIG_NOP_TRACER=y + CONFIG_HAVE_FUNCTION_TRACER=y + CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y +@@ -6409,11 +6349,6 @@ CONFIG_FTRACE_MCOUNT_RECORD=y + # Runtime Testing + # + # CONFIG_LKDTM is not set +-# CONFIG_TEST_LIST_SORT is not set +-# CONFIG_BACKTRACE_SELF_TEST is not set +-# CONFIG_RBTREE_TEST is not set +-# CONFIG_INTERVAL_TREE_TEST is not set +-# CONFIG_PERCPU_TEST is not set + # CONFIG_ATOMIC64_SELFTEST is not set + # CONFIG_ASYNC_RAID6_TEST is not set + # CONFIG_TEST_HEXDUMP is not set +@@ -6431,17 +6366,13 @@ CONFIG_FTRACE_MCOUNT_RECORD=y + # CONFIG_TEST_STATIC_KEYS is not set + # CONFIG_SAMPLES is not set + CONFIG_HAVE_ARCH_KGDB=y +-# CONFIG_KGDB is not set +-# CONFIG_ARM_PTDUMP is not set + # CONFIG_STRICT_DEVMEM is not set + CONFIG_ARM_UNWIND=y + CONFIG_OLD_MCOUNT=y + # CONFIG_DEBUG_USER is not set +-# CONFIG_DEBUG_LL is not set + CONFIG_DEBUG_IMX_UART_PORT=1 + CONFIG_DEBUG_LL_INCLUDE="mach/debug-macro.S" + # CONFIG_DEBUG_UART_8250 is not set +-# CONFIG_DEBUG_UART_BCM63XX is not set + CONFIG_UNCOMPRESS_INCLUDE="debug/uncompress.h" + # CONFIG_PID_IN_CONTEXTIDR is not set + # CONFIG_DEBUG_SET_MODULE_RONX is not set + +From 833b5806b812ad66ada5331c86256c1d43e34505 Mon Sep 17 00:00:00 2001 +From: Troy Kisky <troy.kisky@boundarydevices.com> +Date: Mon, 8 Jun 2015 09:49:47 -0700 +Subject: [PATCH 11/13] fec: Russell Kings corruption fix + +(cherry picked from commit 43e7d29fd2c0df374a95341146991cc449c016b7) +Signed-off-by: Matus Kral <matuskral@me.com> +--- + drivers/net/ethernet/freescale/fec_main.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c +index d9f1ab3..55bab37 100644 +--- a/drivers/net/ethernet/freescale/fec_main.c ++++ b/drivers/net/ethernet/freescale/fec_main.c +@@ -1237,8 +1237,7 @@ fec_enet_tx_queue(struct net_device *ndev, u16 queue_id) + skb = txq->tx_skbuff[index]; + bdnum++; + } +- if (skb_shinfo(skb)->nr_frags && +- (status = bdp_t->cbd_sc) & BD_ENET_TX_READY) ++ if ((status = bdp_t->cbd_sc) & BD_ENET_TX_READY) + break; + + for (i = 0; i < bdnum; i++) { + +From 1a8873f4490146dc03361d30e2d263b823579546 Mon Sep 17 00:00:00 2001 +From: Matus Kral <matuskral@me.com> +Date: Thu, 14 Apr 2016 03:12:49 +0200 +Subject: [PATCH 12/13] sdhci-esdhc-imx: add SDHCI_QUIRK2_TUNING_WORK_AROUND + for imx6q + +--- + drivers/mmc/host/sdhci-esdhc-imx.c | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c +index 5e23d78..83632d2 100644 +--- a/drivers/mmc/host/sdhci-esdhc-imx.c ++++ b/drivers/mmc/host/sdhci-esdhc-imx.c +@@ -136,6 +136,7 @@ + #define ESDHC_FLAG_HS200 BIT(8) + /* The IP supports HS400 mode */ + #define ESDHC_FLAG_HS400 BIT(9) ++#define ESDHC_FLAG_TUNING_WORK_AROUND BIT(10) + + /* A higher clock ferquency than this rate requires strobell dll control */ + #define ESDHC_STROBE_DLL_CLK_FREQ 100000000 +@@ -161,7 +162,8 @@ static struct esdhc_soc_data esdhc_imx53_data = { + }; + + static struct esdhc_soc_data usdhc_imx6q_data = { +- .flags = ESDHC_FLAG_USDHC | ESDHC_FLAG_MAN_TUNING, ++ .flags = ESDHC_FLAG_USDHC | ESDHC_FLAG_MAN_TUNING ++ | ESDHC_FLAG_TUNING_WORK_AROUND, + }; + + static struct esdhc_soc_data usdhc_imx6sl_data = { +@@ -1020,6 +1022,9 @@ sdhci_esdhc_imx_probe_dt(struct platform_device *pdev, + if (!IS_ERR_VALUE(mmc_gpio_get_cd(host->mmc))) + host->quirks &= ~SDHCI_QUIRK_BROKEN_CARD_DETECTION; + ++ if (imx_data->socdata->flags & ESDHC_FLAG_TUNING_WORK_AROUND) ++ host->quirks2 |= SDHCI_QUIRK2_TUNING_WORK_AROUND; ++ + return 0; + } + #else + +From ade5a7b4a7dec8272815ee4253c32427b1e9310c Mon Sep 17 00:00:00 2001 +From: Matus Kral <matuskral@me.com> +Date: Thu, 14 Apr 2016 03:14:31 +0200 +Subject: [PATCH 13/13] mxc_hdmi: edit after + 940144cad331dedf7a6f8b38cb28c16a1d11d03f + +--- + drivers/video/mxc/mxc_hdmi.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/video/mxc/mxc_hdmi.c b/drivers/video/mxc/mxc_hdmi.c +index df91138..5cc3c54 100644 +--- a/drivers/video/mxc/mxc_hdmi.c ++++ b/drivers/video/mxc/mxc_hdmi.c +@@ -2296,6 +2296,8 @@ static void mxc_hdmi_set_mode(struct mxc_hdmi *hdmi, int edid_status) + dev_dbg(&hdmi->pdev->dev, "%s: New video mode\n", __func__); + } + ++ hdmi_set_cable_state(1); ++ + console_lock(); + fb_blank(hdmi->fbi, FB_BLANK_UNBLANK); + console_unlock(); +@@ -2311,8 +2313,6 @@ static int mxc_hdmi_cable_connected(struct mxc_hdmi *hdmi) + + dev_dbg(&hdmi->pdev->dev, "%s\n", __func__); + +- hdmi_set_cable_state(1); +- + hdmi->hp_state = HDMI_HOTPLUG_CONNECTED_NO_EDID; + memcpy(edid_old, hdmi->edid, HDMI_EDID_LEN); + diff --git a/projects/imx6/patches/linux/4.4-xbian/linux-001-systemd-time-fix.patch b/projects/imx6/patches/linux/4.4-xbian/linux-001-systemd-time-fix.patch new file mode 100644 index 00000000000..e0a98e51627 --- /dev/null +++ b/projects/imx6/patches/linux/4.4-xbian/linux-001-systemd-time-fix.patch @@ -0,0 +1,24 @@ +https://github.com/systemd/systemd/issues/1143 + +fix for +Time has been changed +Set up TFD_TIMER_CANCEL_ON_SET timerfd. +which happen on bad RTC battery + +Maybe not setting RTC_HCTOSYS is sufficient enough and not used this patch. + +diff --git a/fs/timerfd.c b/fs/timerfd.c +index b94fa6c..8ec3aeb 100644 +--- a/fs/timerfd.c ++++ b/fs/timerfd.c +@@ -134,7 +134,7 @@ static void timerfd_setup_cancel(struct timerfd_ctx *ctx, int flags) + { + if ((ctx->clockid == CLOCK_REALTIME || + ctx->clockid == CLOCK_REALTIME_ALARM) && +- (flags & TFD_TIMER_ABSTIME) && (flags & TFD_TIMER_CANCEL_ON_SET)) { ++ (flags & TFD_TIMER_CANCEL_ON_SET)) { + if (!ctx->might_cancel) { + ctx->might_cancel = true; + spin_lock(&cancel_lock); + list_add_rcu(&ctx->clist, &cancel_list); + spin_unlock(&cancel_lock); diff --git a/projects/imx6/patches/linux/4.4-xbian/linux-003-no_dev_console.patch b/projects/imx6/patches/linux/4.4-xbian/linux-003-no_dev_console.patch new file mode 100644 index 00000000000..df35a7ab9aa --- /dev/null +++ b/projects/imx6/patches/linux/4.4-xbian/linux-003-no_dev_console.patch @@ -0,0 +1,21 @@ +diff --git a/init/main.c b/init/main.c +index 9484f4b..db55edd 100644 +--- a/init/main.c ++++ b/init/main.c +@@ -880,8 +880,14 @@ static noinline void __init kernel_init_freeable(void) + do_basic_setup(); + + /* Open the /dev/console on the rootfs, this should never fail */ +- if (sys_open((const char __user *) "/dev/console", O_RDWR, 0) < 0) +- pr_err("Warning: unable to open an initial console.\n"); ++ char *console = "/dev_console"; ++ ++ if (sys_open((const char __user *) "/dev/console", O_RDWR, 0) < 0) { ++ sys_mknod(console, S_IFCHR|0600, (TTYAUX_MAJOR<<8)|1); ++ if (sys_open(console, O_RDWR, 0) < 0) ++ printk(KERN_WARNING "Warning: unable to open an initial console.\n"); ++ sys_unlink(console); ++ } + + (void) sys_dup(0); + (void) sys_dup(0); diff --git a/projects/imx6/patches/linux/4.4-xbian/linux-007-config_cmdline.patch b/projects/imx6/patches/linux/4.4-xbian/linux-007-config_cmdline.patch new file mode 100644 index 00000000000..06a4284950b --- /dev/null +++ b/projects/imx6/patches/linux/4.4-xbian/linux-007-config_cmdline.patch @@ -0,0 +1,35 @@ +--- a/drivers/of/fdt.c 2016-01-17 14:32:52.792880390 +0100 ++++ b/drivers/of/fdt.c 2016-01-17 14:34:00.170297953 +0100 +@@ -934,6 +934,7 @@ + { + int l; + const char *p; ++ char tmp_command_line[COMMAND_LINE_SIZE] = CONFIG_CMDLINE; + + pr_debug("search \"chosen\", depth: %d, uname: %s\n", depth, uname); + +@@ -952,12 +953,23 @@ + * CONFIG_CMDLINE is meant to be a default in case nothing else + * managed to set the command line, unless CONFIG_CMDLINE_FORCE + * is set in which case we override whatever was found earlier. ++ * ++ * But we do prepend CONFIG_CMDLINE to bootloader arguments anyway. + */ + #ifdef CONFIG_CMDLINE + #ifndef CONFIG_CMDLINE_FORCE + if (!((char *)data)[0]) +-#endif + strlcpy(data, CONFIG_CMDLINE, COMMAND_LINE_SIZE); ++ else { ++ /* append bootloader arguments to CONFIG_CMDLINE */ ++ strlcat(tmp_command_line, " ", COMMAND_LINE_SIZE); ++ strlcat(tmp_command_line, data, COMMAND_LINE_SIZE); ++ /* copy everything back */ ++ strlcpy(data, tmp_command_line, COMMAND_LINE_SIZE); ++ } ++#else ++ strlcpy(data, CONFIG_CMDLINE, COMMAND_LINE_SIZE); ++#endif /* CONFIG_CMDLINE_FORCE */ + #endif /* CONFIG_CMDLINE */ + + pr_debug("Command line is: %s\n", (char*)data); diff --git a/projects/imx6/patches/linux/4.4-xbian/linux-310-cuboxi_led_heartbeat.patch b/projects/imx6/patches/linux/4.4-xbian/linux-310-cuboxi_led_heartbeat.patch new file mode 100644 index 00000000000..e65e4bd5194 --- /dev/null +++ b/projects/imx6/patches/linux/4.4-xbian/linux-310-cuboxi_led_heartbeat.patch @@ -0,0 +1,10 @@ +--- a/arch/arm/boot/dts/imx6qdl-cubox-i.dtsi 2014-11-25 19:23:06.332485391 +0100 ++++ b/arch/arm/boot/dts/imx6qdl-cubox-i.dtsi 2014-11-25 19:23:24.675776865 +0100 +@@ -31,6 +31,7 @@ + label = "imx6:red:front"; + max-brightness = <248>; + pwms = <&pwm1 0 50000>; ++ linux,default-trigger = "heartbeat"; + }; + }; + diff --git a/projects/imx6/patches/linux/4.4-xbian/linux-320-udoo-lvds-support.patch b/projects/imx6/patches/linux/4.4-xbian/linux-320-udoo-lvds-support.patch new file mode 100644 index 00000000000..45a328b84f6 --- /dev/null +++ b/projects/imx6/patches/linux/4.4-xbian/linux-320-udoo-lvds-support.patch @@ -0,0 +1,268 @@ +device tree for udoo LVDS display + +diff -aurN a/arch/arm/boot/dts/imx6dl-udoo-15lvds.dts b/arch/arm/boot/dts/imx6dl-udoo-15lvds.dts +--- a/arch/arm/boot/dts/imx6dl-udoo-15lvds.dts 1970-01-01 01:00:00.000000000 +0100 ++++ b/arch/arm/boot/dts/imx6dl-udoo-15lvds.dts 2016-02-02 15:33:57.956493214 +0100 +@@ -0,0 +1,54 @@ ++/* ++ * Copyright 2013 Freescale Semiconductor, Inc. ++ * ++ * Author: Fabio Estevam <fabio.estevam@freescale.com> ++ * Author: Ettore Chimenti <ettore.chimenti@udoo.org> ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 as ++ * published by the Free Software Foundation. ++ * ++ */ ++ ++/dts-v1/; ++#include "imx6dl.dtsi" ++#include "imx6qdl-udoo.dtsi" ++ ++/ { ++ model = "Udoo i.MX6 Dual-lite Board"; ++ compatible = "udoo,imx6dl-udoo", "fsl,imx6dl"; ++ ++ mxcfb2: fb@1 { ++ compatible = "fsl,mxc_sdc_fb"; ++ disp_dev = "ldb"; ++ interface_pix_fmt = "RGB24"; ++ mode_str = "1360x768M@60"; ++ default_bpp = <32>; ++ int_clk = <0>; ++ late_init = <1>; ++ status = "okay"; ++ }; ++ ++ regulators { ++ reg_lcd0_pwr: regulator@1 { ++ status = "okay"; ++ }; ++ ++ reg_lcd0_backlight: regulator@2 { ++ status = "okay"; ++ }; ++ }; ++}; ++ ++&ldb { ++ status = "okay"; ++ ++ lvds-channel@0 { ++ status = "okay"; ++ fsl,data-width = <24>; ++ ++ display-timings { ++ native-mode = <&timing2>; ++ }; ++ }; ++}; +diff -aurN a/arch/arm/boot/dts/imx6dl-udoo-7lvds.dts b/arch/arm/boot/dts/imx6dl-udoo-7lvds.dts +--- a/arch/arm/boot/dts/imx6dl-udoo-7lvds.dts 1970-01-01 01:00:00.000000000 +0100 ++++ b/arch/arm/boot/dts/imx6dl-udoo-7lvds.dts 2016-02-02 15:33:57.956493214 +0100 +@@ -0,0 +1,49 @@ ++/* ++ * Copyright 2013 Freescale Semiconductor, Inc. ++ * ++ * Author: Fabio Estevam <fabio.estevam@freescale.com> ++ * Author: Ettore Chimenti <ettore.chimenti@udoo.org> ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 as ++ * published by the Free Software Foundation. ++ * ++ */ ++ ++/dts-v1/; ++#include "imx6dl.dtsi" ++#include "imx6qdl-udoo.dtsi" ++ ++/ { ++ model = "Udoo i.MX6 Dual-lite Board"; ++ compatible = "udoo,imx6dl-udoo", "fsl,imx6dl"; ++ ++ mxcfb2: fb@1 { ++ compatible = "fsl,mxc_sdc_fb"; ++ disp_dev = "ldb"; ++ interface_pix_fmt = "RGB666"; ++ mode_str = "800x480M@60"; ++ default_bpp = <32>; ++ int_clk = <0>; ++ late_init = <0>; ++ status = "okay"; ++ }; ++ ++ regulators { ++ reg_lcd0_pwr: regulator@1 { ++ status = "okay"; ++ }; ++ ++ reg_lcd0_backlight: regulator@2 { ++ status = "okay"; ++ }; ++ }; ++}; ++ ++&ldb { ++ status = "okay"; ++ ++ lvds-channel@0 { ++ status = "okay"; ++ }; ++}; +diff -aurN a/arch/arm/boot/dts/imx6qdl-udoo.dtsi b/arch/arm/boot/dts/imx6qdl-udoo.dtsi +--- a/arch/arm/boot/dts/imx6qdl-udoo.dtsi 2016-02-02 15:32:24.208082208 +0100 ++++ b/arch/arm/boot/dts/imx6qdl-udoo.dtsi 2016-02-02 15:35:33.695723590 +0100 +@@ -254,9 +254,9 @@ + vsync-len = <2>; + }; + +- timing2: 1366x768 { // 15.6" display ++ timing2: 1360x768 { // 15.6" display + clock-frequency = <76000000>; +- hactive = <1366>; ++ hactive = <1360>; // IPU needs x and y modulo 8 + vactive = <768>; + hback-porch = <220>; + hfront-porch = <40>; +diff -aurN a/arch/arm/boot/dts/imx6q-udoo-15lvds.dts b/arch/arm/boot/dts/imx6q-udoo-15lvds.dts +--- a/arch/arm/boot/dts/imx6q-udoo-15lvds.dts 1970-01-01 01:00:00.000000000 +0100 ++++ b/arch/arm/boot/dts/imx6q-udoo-15lvds.dts 2016-02-02 15:33:57.956493214 +0100 +@@ -0,0 +1,58 @@ ++/* ++ * Copyright 2013 Freescale Semiconductor, Inc. ++ * ++ * Author: Fabio Estevam <fabio.estevam@freescale.com> ++ * Author: Ettore Chimenti <ettore.chimenti@udoo.org> ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 as ++ * published by the Free Software Foundation. ++ * ++ */ ++ ++/dts-v1/; ++#include "imx6q.dtsi" ++#include "imx6qdl-udoo.dtsi" ++ ++/ { ++ model = "Udoo i.MX6 Quad Board"; ++ compatible = "udoo,imx6q-udoo", "fsl,imx6q"; ++ ++ mxcfb2: fb@1 { ++ compatible = "fsl,mxc_sdc_fb"; ++ disp_dev = "ldb"; ++ interface_pix_fmt = "RGB24"; ++ mode_str = "1360x768M@60"; ++ default_bpp = <32>; ++ int_clk = <0>; ++ late_init = <1>; ++ status = "okay"; ++ }; ++ ++ regulators { ++ reg_lcd0_pwr: regulator@1 { ++ status = "okay"; ++ }; ++ ++ reg_lcd0_backlight: regulator@2 { ++ status = "okay"; ++ }; ++ }; ++}; ++ ++&sata { ++ status = "okay"; ++}; ++ ++&ldb { ++ status = "okay"; ++ ++ lvds-channel@0 { ++ status = "okay"; ++ fsl,data-width = <24>; ++ ++ display-timings { ++ native-mode = <&timing2>; ++ }; ++ }; ++}; +diff -aurN a/arch/arm/boot/dts/imx6q-udoo-7lvds.dts b/arch/arm/boot/dts/imx6q-udoo-7lvds.dts +--- a/arch/arm/boot/dts/imx6q-udoo-7lvds.dts 1970-01-01 01:00:00.000000000 +0100 ++++ b/arch/arm/boot/dts/imx6q-udoo-7lvds.dts 2016-02-02 15:33:57.956493214 +0100 +@@ -0,0 +1,53 @@ ++/* ++ * Copyright 2013 Freescale Semiconductor, Inc. ++ * ++ * Author: Fabio Estevam <fabio.estevam@freescale.com> ++ * Author: Ettore Chimenti <ettore.chimenti@udoo.org> ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 as ++ * published by the Free Software Foundation. ++ * ++ */ ++ ++/dts-v1/; ++#include "imx6q.dtsi" ++#include "imx6qdl-udoo.dtsi" ++ ++/ { ++ model = "Udoo i.MX6 Quad Board"; ++ compatible = "udoo,imx6q-udoo", "fsl,imx6q"; ++ ++ mxcfb2: fb@1 { ++ compatible = "fsl,mxc_sdc_fb"; ++ disp_dev = "ldb"; ++ interface_pix_fmt = "RGB666"; ++ mode_str = "800x480M@60"; ++ default_bpp = <32>; ++ int_clk = <0>; ++ late_init = <0>; ++ status = "okay"; ++ }; ++ ++ regulators { ++ reg_lcd0_pwr: regulator@1 { ++ status = "okay"; ++ }; ++ ++ reg_lcd0_backlight: regulator@2 { ++ status = "okay"; ++ }; ++ }; ++}; ++ ++&sata { ++ status = "okay"; ++}; ++ ++&ldb { ++ status = "okay"; ++ ++ lvds-channel@0 { ++ status = "okay"; ++ }; ++}; +diff -aurN a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile +--- a/arch/arm/boot/dts/Makefile 2016-02-02 15:33:47.144907214 +0100 ++++ b/arch/arm/boot/dts/Makefile 2016-02-02 15:33:57.956493214 +0100 +@@ -308,6 +308,8 @@ + imx6dl-tx6u-801x.dtb \ + imx6dl-tx6u-811x.dtb \ + imx6dl-udoo.dtb \ ++ imx6dl-udoo-7lvds.dtb \ ++ imx6dl-udoo-15lvds.dtb \ + imx6dl-sbc-fx6.dtb \ + imx6dl-sbc-fx6m.dtb \ + imx6dl-wandboard.dtb \ +@@ -351,6 +353,8 @@ + imx6q-tx6q-1020-comtft.dtb \ + imx6q-tx6q-1110.dtb \ + imx6q-udoo.dtb \ ++ imx6q-udoo-7lvds.dtb \ ++ imx6q-udoo-15lvds.dtb \ + imx6q-wandboard.dtb \ + imx6q-wandboard-revb1.dtb \ + imx6dl-vero.dtb diff --git a/projects/imx6/patches/linux/4.4-xbian/linux-330-tbs2910-dts-fix.patch b/projects/imx6/patches/linux/4.4-xbian/linux-330-tbs2910-dts-fix.patch new file mode 100644 index 00000000000..2db33fd8394 --- /dev/null +++ b/projects/imx6/patches/linux/4.4-xbian/linux-330-tbs2910-dts-fix.patch @@ -0,0 +1,11 @@ +--- a/arch/arm/boot/dts/imx6q-tbs2910.dts 2016-02-05 10:04:37.142403520 +0100 ++++ b/arch/arm/boot/dts/imx6q-tbs2910.dts 2016-02-05 10:04:45.102099522 +0100 +@@ -154,7 +154,7 @@ + status = "okay"; + }; + +-&hdmi { ++&hdmi_core { + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_hdmi>; + ddc-i2c-bus = <&i2c2>; diff --git a/projects/imx6/patches/linux/999.03-rtl8712-avoid-lots-of-build-warnings.patch b/projects/imx6/patches/linux/999.03-rtl8712-avoid-lots-of-build-warnings.patch deleted file mode 100644 index db4bd5fb747..00000000000 --- a/projects/imx6/patches/linux/999.03-rtl8712-avoid-lots-of-build-warnings.patch +++ /dev/null @@ -1,68 +0,0 @@ -diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211.h b/drivers/staging/rtl8192u/ieee80211/ieee80211.h -index bc64f05..b1a0380 100644 ---- a/drivers/staging/rtl8192u/ieee80211/ieee80211.h -+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211.h -@@ -2250,7 +2250,7 @@ static inline void *ieee80211_priv(struct net_device *dev) - return ((struct ieee80211_device *)netdev_priv(dev))->priv; - } - --extern inline int ieee80211_is_empty_essid(const char *essid, int essid_len) -+static inline int ieee80211_is_empty_essid(const char *essid, int essid_len) - { - /* Single white space is for Linksys APs */ - if (essid_len == 1 && essid[0] == ' ') -@@ -2266,7 +2266,7 @@ extern inline int ieee80211_is_empty_essid(const char *essid, int essid_len) - return 1; - } - --extern inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee, int mode) -+static inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee, int mode) - { - /* - * It is possible for both access points and our device to support -@@ -2292,7 +2292,7 @@ extern inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee, int mod - return 0; - } - --extern inline int ieee80211_get_hdrlen(u16 fc) -+static inline int ieee80211_get_hdrlen(u16 fc) - { - int hdrlen = IEEE80211_3ADDR_LEN; - -@@ -2578,12 +2578,12 @@ void ieee80211_softmac_scan_syncro(struct ieee80211_device *ieee); - - extern const long ieee80211_wlan_frequencies[]; - --extern inline void ieee80211_increment_scans(struct ieee80211_device *ieee) -+static inline void ieee80211_increment_scans(struct ieee80211_device *ieee) - { - ieee->scans++; - } - --extern inline int ieee80211_get_scans(struct ieee80211_device *ieee) -+static inline int ieee80211_get_scans(struct ieee80211_device *ieee) - { - return ieee->scans; - } -diff --git a/drivers/staging/rtl8712/ieee80211.h b/drivers/staging/rtl8712/ieee80211.h -index da4000e..8269be8 100644 ---- a/drivers/staging/rtl8712/ieee80211.h -+++ b/drivers/staging/rtl8712/ieee80211.h -@@ -734,7 +734,7 @@ enum ieee80211_state { - #define IEEE_G (1<<2) - #define IEEE_MODE_MASK (IEEE_A|IEEE_B|IEEE_G) - --extern inline int ieee80211_is_empty_essid(const char *essid, int essid_len) -+static inline int ieee80211_is_empty_essid(const char *essid, int essid_len) - { - /* Single white space is for Linksys APs */ - if (essid_len == 1 && essid[0] == ' ') -@@ -748,7 +748,7 @@ extern inline int ieee80211_is_empty_essid(const char *essid, int essid_len) - return 1; - } - --extern inline int ieee80211_get_hdrlen(u16 fc) -+static inline int ieee80211_get_hdrlen(u16 fc) - { - int hdrlen = 24; - diff --git a/projects/imx6/patches/linux/linux-000-patch-3.14.14-15.patch b/projects/imx6/patches/linux/linux-000-patch-3.14.14-15.patch deleted file mode 100644 index f1730277b6e..00000000000 --- a/projects/imx6/patches/linux/linux-000-patch-3.14.14-15.patch +++ /dev/null @@ -1,893 +0,0 @@ -diff --git a/Makefile b/Makefile -index 230c7f694ab7..188523e9e880 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,6 +1,6 @@ - VERSION = 3 - PATCHLEVEL = 14 --SUBLEVEL = 14 -+SUBLEVEL = 15 - EXTRAVERSION = - NAME = Remembering Coco - -@@ -639,6 +639,8 @@ KBUILD_CFLAGS += -fomit-frame-pointer - endif - endif - -+KBUILD_CFLAGS += $(call cc-option, -fno-var-tracking-assignments) -+ - ifdef CONFIG_DEBUG_INFO - KBUILD_CFLAGS += -g - KBUILD_AFLAGS += -Wa,--gdwarf-2 -diff --git a/arch/parisc/include/uapi/asm/signal.h b/arch/parisc/include/uapi/asm/signal.h -index a2fa297196bc..f5645d6a89f2 100644 ---- a/arch/parisc/include/uapi/asm/signal.h -+++ b/arch/parisc/include/uapi/asm/signal.h -@@ -69,8 +69,6 @@ - #define SA_NOMASK SA_NODEFER - #define SA_ONESHOT SA_RESETHAND - --#define SA_RESTORER 0x04000000 /* obsolete -- ignored */ -- - #define MINSIGSTKSZ 2048 - #define SIGSTKSZ 8192 - -diff --git a/arch/s390/kernel/ptrace.c b/arch/s390/kernel/ptrace.c -index a48bc79a111f..184d305af3e7 100644 ---- a/arch/s390/kernel/ptrace.c -+++ b/arch/s390/kernel/ptrace.c -@@ -323,9 +323,14 @@ static int __poke_user(struct task_struct *child, addr_t addr, addr_t data) - unsigned long mask = PSW_MASK_USER; - - mask |= is_ri_task(child) ? PSW_MASK_RI : 0; -- if ((data & ~mask) != PSW_USER_BITS) -+ if ((data ^ PSW_USER_BITS) & ~mask) -+ /* Invalid psw mask. */ -+ return -EINVAL; -+ if ((data & PSW_MASK_ASC) == PSW_ASC_HOME) -+ /* Invalid address-space-control bits */ - return -EINVAL; - if ((data & PSW_MASK_EA) && !(data & PSW_MASK_BA)) -+ /* Invalid addressing mode bits */ - return -EINVAL; - } - *(addr_t *)((addr_t) &task_pt_regs(child)->psw + addr) = data; -@@ -661,9 +666,12 @@ static int __poke_user_compat(struct task_struct *child, - - mask |= is_ri_task(child) ? PSW32_MASK_RI : 0; - /* Build a 64 bit psw mask from 31 bit mask. */ -- if ((tmp & ~mask) != PSW32_USER_BITS) -+ if ((tmp ^ PSW32_USER_BITS) & ~mask) - /* Invalid psw mask. */ - return -EINVAL; -+ if ((data & PSW32_MASK_ASC) == PSW32_ASC_HOME) -+ /* Invalid address-space-control bits */ -+ return -EINVAL; - regs->psw.mask = (regs->psw.mask & ~PSW_MASK_USER) | - (regs->psw.mask & PSW_MASK_BA) | - (__u64)(tmp & mask) << 32; -diff --git a/arch/x86/boot/header.S b/arch/x86/boot/header.S -index ec3b8ba68096..04da6c2194ba 100644 ---- a/arch/x86/boot/header.S -+++ b/arch/x86/boot/header.S -@@ -91,10 +91,9 @@ bs_die: - - .section ".bsdata", "a" - bugger_off_msg: -- .ascii "Direct floppy boot is not supported. " -- .ascii "Use a boot loader program instead.\r\n" -+ .ascii "Use a boot loader.\r\n" - .ascii "\n" -- .ascii "Remove disk and press any key to reboot ...\r\n" -+ .ascii "Remove disk and press any key to reboot...\r\n" - .byte 0 - - #ifdef CONFIG_EFI_STUB -@@ -108,7 +107,7 @@ coff_header: - #else - .word 0x8664 # x86-64 - #endif -- .word 3 # nr_sections -+ .word 4 # nr_sections - .long 0 # TimeDateStamp - .long 0 # PointerToSymbolTable - .long 1 # NumberOfSymbols -@@ -250,6 +249,25 @@ section_table: - .word 0 # NumberOfLineNumbers - .long 0x60500020 # Characteristics (section flags) - -+ # -+ # The offset & size fields are filled in by build.c. -+ # -+ .ascii ".bss" -+ .byte 0 -+ .byte 0 -+ .byte 0 -+ .byte 0 -+ .long 0 -+ .long 0x0 -+ .long 0 # Size of initialized data -+ # on disk -+ .long 0x0 -+ .long 0 # PointerToRelocations -+ .long 0 # PointerToLineNumbers -+ .word 0 # NumberOfRelocations -+ .word 0 # NumberOfLineNumbers -+ .long 0xc8000080 # Characteristics (section flags) -+ - #endif /* CONFIG_EFI_STUB */ - - # Kernel attributes; used by setup. This is part 1 of the -diff --git a/arch/x86/boot/tools/build.c b/arch/x86/boot/tools/build.c -index 8e15b22391fc..3dafaeb9f549 100644 ---- a/arch/x86/boot/tools/build.c -+++ b/arch/x86/boot/tools/build.c -@@ -142,7 +142,7 @@ static void usage(void) - - #ifdef CONFIG_EFI_STUB - --static void update_pecoff_section_header(char *section_name, u32 offset, u32 size) -+static void update_pecoff_section_header_fields(char *section_name, u32 vma, u32 size, u32 datasz, u32 offset) - { - unsigned int pe_header; - unsigned short num_sections; -@@ -163,10 +163,10 @@ static void update_pecoff_section_header(char *section_name, u32 offset, u32 siz - put_unaligned_le32(size, section + 0x8); - - /* section header vma field */ -- put_unaligned_le32(offset, section + 0xc); -+ put_unaligned_le32(vma, section + 0xc); - - /* section header 'size of initialised data' field */ -- put_unaligned_le32(size, section + 0x10); -+ put_unaligned_le32(datasz, section + 0x10); - - /* section header 'file offset' field */ - put_unaligned_le32(offset, section + 0x14); -@@ -178,6 +178,11 @@ static void update_pecoff_section_header(char *section_name, u32 offset, u32 siz - } - } - -+static void update_pecoff_section_header(char *section_name, u32 offset, u32 size) -+{ -+ update_pecoff_section_header_fields(section_name, offset, size, size, offset); -+} -+ - static void update_pecoff_setup_and_reloc(unsigned int size) - { - u32 setup_offset = 0x200; -@@ -202,9 +207,6 @@ static void update_pecoff_text(unsigned int text_start, unsigned int file_sz) - - pe_header = get_unaligned_le32(&buf[0x3c]); - -- /* Size of image */ -- put_unaligned_le32(file_sz, &buf[pe_header + 0x50]); -- - /* - * Size of code: Subtract the size of the first sector (512 bytes) - * which includes the header. -@@ -219,6 +221,22 @@ static void update_pecoff_text(unsigned int text_start, unsigned int file_sz) - update_pecoff_section_header(".text", text_start, text_sz); - } - -+static void update_pecoff_bss(unsigned int file_sz, unsigned int init_sz) -+{ -+ unsigned int pe_header; -+ unsigned int bss_sz = init_sz - file_sz; -+ -+ pe_header = get_unaligned_le32(&buf[0x3c]); -+ -+ /* Size of uninitialized data */ -+ put_unaligned_le32(bss_sz, &buf[pe_header + 0x24]); -+ -+ /* Size of image */ -+ put_unaligned_le32(init_sz, &buf[pe_header + 0x50]); -+ -+ update_pecoff_section_header_fields(".bss", file_sz, bss_sz, 0, 0); -+} -+ - #endif /* CONFIG_EFI_STUB */ - - -@@ -270,6 +288,9 @@ int main(int argc, char ** argv) - int fd; - void *kernel; - u32 crc = 0xffffffffUL; -+#ifdef CONFIG_EFI_STUB -+ unsigned int init_sz; -+#endif - - /* Defaults for old kernel */ - #ifdef CONFIG_X86_32 -@@ -343,7 +364,9 @@ int main(int argc, char ** argv) - put_unaligned_le32(sys_size, &buf[0x1f4]); - - #ifdef CONFIG_EFI_STUB -- update_pecoff_text(setup_sectors * 512, sz + i + ((sys_size * 16) - sz)); -+ update_pecoff_text(setup_sectors * 512, i + (sys_size * 16)); -+ init_sz = get_unaligned_le32(&buf[0x260]); -+ update_pecoff_bss(i + (sys_size * 16), init_sz); - - #ifdef CONFIG_X86_64 /* Yes, this is really how we defined it :( */ - efi_stub_entry -= 0x200; -diff --git a/arch/x86/kernel/entry_32.S b/arch/x86/kernel/entry_32.S -index 6491353cc9aa..c87810b1b557 100644 ---- a/arch/x86/kernel/entry_32.S -+++ b/arch/x86/kernel/entry_32.S -@@ -433,8 +433,8 @@ sysenter_do_call: - cmpl $(NR_syscalls), %eax - jae sysenter_badsys - call *sys_call_table(,%eax,4) -- movl %eax,PT_EAX(%esp) - sysenter_after_call: -+ movl %eax,PT_EAX(%esp) - LOCKDEP_SYS_EXIT - DISABLE_INTERRUPTS(CLBR_ANY) - TRACE_IRQS_OFF -@@ -514,6 +514,7 @@ ENTRY(system_call) - jae syscall_badsys - syscall_call: - call *sys_call_table(,%eax,4) -+syscall_after_call: - movl %eax,PT_EAX(%esp) # store the return value - syscall_exit: - LOCKDEP_SYS_EXIT -@@ -683,12 +684,12 @@ syscall_fault: - END(syscall_fault) - - syscall_badsys: -- movl $-ENOSYS,PT_EAX(%esp) -- jmp syscall_exit -+ movl $-ENOSYS,%eax -+ jmp syscall_after_call - END(syscall_badsys) - - sysenter_badsys: -- movl $-ENOSYS,PT_EAX(%esp) -+ movl $-ENOSYS,%eax - jmp sysenter_after_call - END(syscall_badsys) - CFI_ENDPROC -diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c -index dd0dd2d4ceca..d8f80e733cf8 100644 ---- a/block/blk-cgroup.c -+++ b/block/blk-cgroup.c -@@ -859,6 +859,13 @@ void blkcg_drain_queue(struct request_queue *q) - { - lockdep_assert_held(q->queue_lock); - -+ /* -+ * @q could be exiting and already have destroyed all blkgs as -+ * indicated by NULL root_blkg. If so, don't confuse policies. -+ */ -+ if (!q->root_blkg) -+ return; -+ - blk_throtl_drain(q); - } - -diff --git a/block/blk-tag.c b/block/blk-tag.c -index 3f33d8672268..a185b86741e5 100644 ---- a/block/blk-tag.c -+++ b/block/blk-tag.c -@@ -27,18 +27,15 @@ struct request *blk_queue_find_tag(struct request_queue *q, int tag) - EXPORT_SYMBOL(blk_queue_find_tag); - - /** -- * __blk_free_tags - release a given set of tag maintenance info -+ * blk_free_tags - release a given set of tag maintenance info - * @bqt: the tag map to free - * -- * Tries to free the specified @bqt. Returns true if it was -- * actually freed and false if there are still references using it -+ * Drop the reference count on @bqt and frees it when the last reference -+ * is dropped. - */ --static int __blk_free_tags(struct blk_queue_tag *bqt) -+void blk_free_tags(struct blk_queue_tag *bqt) - { -- int retval; -- -- retval = atomic_dec_and_test(&bqt->refcnt); -- if (retval) { -+ if (atomic_dec_and_test(&bqt->refcnt)) { - BUG_ON(find_first_bit(bqt->tag_map, bqt->max_depth) < - bqt->max_depth); - -@@ -50,9 +47,8 @@ static int __blk_free_tags(struct blk_queue_tag *bqt) - - kfree(bqt); - } -- -- return retval; - } -+EXPORT_SYMBOL(blk_free_tags); - - /** - * __blk_queue_free_tags - release tag maintenance info -@@ -69,28 +65,13 @@ void __blk_queue_free_tags(struct request_queue *q) - if (!bqt) - return; - -- __blk_free_tags(bqt); -+ blk_free_tags(bqt); - - q->queue_tags = NULL; - queue_flag_clear_unlocked(QUEUE_FLAG_QUEUED, q); - } - - /** -- * blk_free_tags - release a given set of tag maintenance info -- * @bqt: the tag map to free -- * -- * For externally managed @bqt frees the map. Callers of this -- * function must guarantee to have released all the queues that -- * might have been using this tag map. -- */ --void blk_free_tags(struct blk_queue_tag *bqt) --{ -- if (unlikely(!__blk_free_tags(bqt))) -- BUG(); --} --EXPORT_SYMBOL(blk_free_tags); -- --/** - * blk_queue_free_tags - release tag maintenance info - * @q: the request queue for the device - * -diff --git a/block/compat_ioctl.c b/block/compat_ioctl.c -index fbd5a67cb773..a0926a6094b2 100644 ---- a/block/compat_ioctl.c -+++ b/block/compat_ioctl.c -@@ -690,6 +690,7 @@ long compat_blkdev_ioctl(struct file *file, unsigned cmd, unsigned long arg) - case BLKROSET: - case BLKDISCARD: - case BLKSECDISCARD: -+ case BLKZEROOUT: - /* - * the ones below are implemented in blkdev_locked_ioctl, - * but we call blkdev_ioctl, which gets the lock for us -diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c -index 9aa42998d757..b54f8b3c7924 100644 ---- a/drivers/ata/ahci.c -+++ b/drivers/ata/ahci.c -@@ -457,6 +457,7 @@ static const struct pci_device_id ahci_pci_tbl[] = { - - /* Promise */ - { PCI_VDEVICE(PROMISE, 0x3f20), board_ahci }, /* PDC42819 */ -+ { PCI_VDEVICE(PROMISE, 0x3781), board_ahci }, /* FastTrak TX8660 ahci-mode */ - - /* Asmedia */ - { PCI_VDEVICE(ASMEDIA, 0x0601), board_ahci }, /* ASM1060 */ -diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c -index 62fda16c8377..f7616036663b 100644 ---- a/drivers/ata/libata-core.c -+++ b/drivers/ata/libata-core.c -@@ -4787,6 +4787,10 @@ void swap_buf_le16(u16 *buf, unsigned int buf_words) - * ata_qc_new - Request an available ATA command, for queueing - * @ap: target port - * -+ * Some ATA host controllers may implement a queue depth which is less -+ * than ATA_MAX_QUEUE. So we shouldn't allocate a tag which is beyond -+ * the hardware limitation. -+ * - * LOCKING: - * None. - */ -@@ -4794,14 +4798,15 @@ void swap_buf_le16(u16 *buf, unsigned int buf_words) - static struct ata_queued_cmd *ata_qc_new(struct ata_port *ap) - { - struct ata_queued_cmd *qc = NULL; -+ unsigned int max_queue = ap->host->n_tags; - unsigned int i, tag; - - /* no command while frozen */ - if (unlikely(ap->pflags & ATA_PFLAG_FROZEN)) - return NULL; - -- for (i = 0; i < ATA_MAX_QUEUE; i++) { -- tag = (i + ap->last_tag + 1) % ATA_MAX_QUEUE; -+ for (i = 0, tag = ap->last_tag + 1; i < max_queue; i++, tag++) { -+ tag = tag < max_queue ? tag : 0; - - /* the last tag is reserved for internal command. */ - if (tag == ATA_TAG_INTERNAL) -@@ -6103,6 +6108,7 @@ void ata_host_init(struct ata_host *host, struct device *dev, - { - spin_lock_init(&host->lock); - mutex_init(&host->eh_mutex); -+ host->n_tags = ATA_MAX_QUEUE - 1; - host->dev = dev; - host->ops = ops; - } -@@ -6184,6 +6190,8 @@ int ata_host_register(struct ata_host *host, struct scsi_host_template *sht) - { - int i, rc; - -+ host->n_tags = clamp(sht->can_queue, 1, ATA_MAX_QUEUE - 1); -+ - /* host must have been started */ - if (!(host->flags & ATA_HOST_STARTED)) { - dev_err(host->dev, "BUG: trying to register unstarted host\n"); -diff --git a/drivers/base/platform.c b/drivers/base/platform.c -index 3c51eb0bd659..9dbf4ef2b2a3 100644 ---- a/drivers/base/platform.c -+++ b/drivers/base/platform.c -@@ -89,8 +89,13 @@ int platform_get_irq(struct platform_device *dev, unsigned int num) - return dev->archdata.irqs[num]; - #else - struct resource *r; -- if (IS_ENABLED(CONFIG_OF_IRQ) && dev->dev.of_node) -- return of_irq_get(dev->dev.of_node, num); -+ if (IS_ENABLED(CONFIG_OF_IRQ) && dev->dev.of_node) { -+ int ret; -+ -+ ret = of_irq_get(dev->dev.of_node, num); -+ if (ret >= 0 || ret == -EPROBE_DEFER) -+ return ret; -+ } - - r = platform_get_resource(dev, IORESOURCE_IRQ, num); - -diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c -index 270f68a6b724..7164045c06e4 100644 ---- a/drivers/gpu/drm/radeon/cik.c -+++ b/drivers/gpu/drm/radeon/cik.c -@@ -2219,6 +2219,7 @@ static void cik_tiling_mode_table_init(struct radeon_device *rdev) - gb_tile_moden = 0; - break; - } -+ rdev->config.cik.macrotile_mode_array[reg_offset] = gb_tile_moden; - WREG32(GB_MACROTILE_MODE0 + (reg_offset * 4), gb_tile_moden); - } - } else if (num_pipe_configs == 8) { -@@ -7270,6 +7271,7 @@ static inline u32 cik_get_ih_wptr(struct radeon_device *rdev) - tmp = RREG32(IH_RB_CNTL); - tmp |= IH_WPTR_OVERFLOW_CLEAR; - WREG32(IH_RB_CNTL, tmp); -+ wptr &= ~RB_OVERFLOW; - } - return (wptr & rdev->ih.ptr_mask); - } -diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c -index 64108dbc7d45..4b3c5f7ae63b 100644 ---- a/drivers/gpu/drm/radeon/evergreen.c -+++ b/drivers/gpu/drm/radeon/evergreen.c -@@ -4763,6 +4763,7 @@ static u32 evergreen_get_ih_wptr(struct radeon_device *rdev) - tmp = RREG32(IH_RB_CNTL); - tmp |= IH_WPTR_OVERFLOW_CLEAR; - WREG32(IH_RB_CNTL, tmp); -+ wptr &= ~RB_OVERFLOW; - } - return (wptr & rdev->ih.ptr_mask); - } -diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c -index f28ab840cc23..788f602e8989 100644 ---- a/drivers/gpu/drm/radeon/r600.c -+++ b/drivers/gpu/drm/radeon/r600.c -@@ -3795,6 +3795,7 @@ static u32 r600_get_ih_wptr(struct radeon_device *rdev) - tmp = RREG32(IH_RB_CNTL); - tmp |= IH_WPTR_OVERFLOW_CLEAR; - WREG32(IH_RB_CNTL, tmp); -+ wptr &= ~RB_OVERFLOW; - } - return (wptr & rdev->ih.ptr_mask); - } -diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c -index cb7508dc94f3..ea93393374df 100644 ---- a/drivers/gpu/drm/radeon/si.c -+++ b/drivers/gpu/drm/radeon/si.c -@@ -6098,6 +6098,7 @@ static inline u32 si_get_ih_wptr(struct radeon_device *rdev) - tmp = RREG32(IH_RB_CNTL); - tmp |= IH_WPTR_OVERFLOW_CLEAR; - WREG32(IH_RB_CNTL, tmp); -+ wptr &= ~RB_OVERFLOW; - } - return (wptr & rdev->ih.ptr_mask); - } -diff --git a/drivers/hwmon/smsc47m192.c b/drivers/hwmon/smsc47m192.c -index efee4c59239f..34b9a601ad07 100644 ---- a/drivers/hwmon/smsc47m192.c -+++ b/drivers/hwmon/smsc47m192.c -@@ -86,7 +86,7 @@ static inline u8 IN_TO_REG(unsigned long val, int n) - */ - static inline s8 TEMP_TO_REG(int val) - { -- return clamp_val(SCALE(val, 1, 1000), -128000, 127000); -+ return SCALE(clamp_val(val, -128000, 127000), 1, 1000); - } - - static inline int TEMP_FROM_REG(s8 val) -@@ -384,6 +384,8 @@ static ssize_t set_vrm(struct device *dev, struct device_attribute *attr, - err = kstrtoul(buf, 10, &val); - if (err) - return err; -+ if (val > 255) -+ return -EINVAL; - - data->vrm = val; - return count; -diff --git a/drivers/input/input.c b/drivers/input/input.c -index 1c4c0db05550..29ca0bb4f561 100644 ---- a/drivers/input/input.c -+++ b/drivers/input/input.c -@@ -257,9 +257,10 @@ static int input_handle_abs_event(struct input_dev *dev, - } - - static int input_get_disposition(struct input_dev *dev, -- unsigned int type, unsigned int code, int value) -+ unsigned int type, unsigned int code, int *pval) - { - int disposition = INPUT_IGNORE_EVENT; -+ int value = *pval; - - switch (type) { - -@@ -357,6 +358,7 @@ static int input_get_disposition(struct input_dev *dev, - break; - } - -+ *pval = value; - return disposition; - } - -@@ -365,7 +367,7 @@ static void input_handle_event(struct input_dev *dev, - { - int disposition; - -- disposition = input_get_disposition(dev, type, code, value); -+ disposition = input_get_disposition(dev, type, code, &value); - - if ((disposition & INPUT_PASS_TO_DEVICE) && dev->event) - dev->event(dev, type, code, value); -diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c -index ec772d962f06..ef9e0b8a9aa7 100644 ---- a/drivers/input/mouse/synaptics.c -+++ b/drivers/input/mouse/synaptics.c -@@ -132,7 +132,8 @@ static const struct min_max_quirk min_max_pnpid_table[] = { - 1232, 5710, 1156, 4696 - }, - { -- (const char * const []){"LEN0034", "LEN0036", "LEN2004", NULL}, -+ (const char * const []){"LEN0034", "LEN0036", "LEN2002", -+ "LEN2004", NULL}, - 1024, 5112, 2024, 4832 - }, - { -@@ -168,7 +169,7 @@ static const char * const topbuttonpad_pnp_ids[] = { - "LEN0049", - "LEN2000", - "LEN2001", /* Edge E431 */ -- "LEN2002", -+ "LEN2002", /* Edge E531 */ - "LEN2003", - "LEN2004", /* L440 */ - "LEN2005", -diff --git a/drivers/media/dvb-frontends/tda10071.c b/drivers/media/dvb-frontends/tda10071.c -index 8ad3a57cf640..287b977862e2 100644 ---- a/drivers/media/dvb-frontends/tda10071.c -+++ b/drivers/media/dvb-frontends/tda10071.c -@@ -667,6 +667,7 @@ static int tda10071_set_frontend(struct dvb_frontend *fe) - struct dtv_frontend_properties *c = &fe->dtv_property_cache; - int ret, i; - u8 mode, rolloff, pilot, inversion, div; -+ fe_modulation_t modulation; - - dev_dbg(&priv->i2c->dev, "%s: delivery_system=%d modulation=%d " \ - "frequency=%d symbol_rate=%d inversion=%d pilot=%d " \ -@@ -701,10 +702,13 @@ static int tda10071_set_frontend(struct dvb_frontend *fe) - - switch (c->delivery_system) { - case SYS_DVBS: -+ modulation = QPSK; - rolloff = 0; - pilot = 2; - break; - case SYS_DVBS2: -+ modulation = c->modulation; -+ - switch (c->rolloff) { - case ROLLOFF_20: - rolloff = 2; -@@ -749,7 +753,7 @@ static int tda10071_set_frontend(struct dvb_frontend *fe) - - for (i = 0, mode = 0xff; i < ARRAY_SIZE(TDA10071_MODCOD); i++) { - if (c->delivery_system == TDA10071_MODCOD[i].delivery_system && -- c->modulation == TDA10071_MODCOD[i].modulation && -+ modulation == TDA10071_MODCOD[i].modulation && - c->fec_inner == TDA10071_MODCOD[i].fec) { - mode = TDA10071_MODCOD[i].val; - dev_dbg(&priv->i2c->dev, "%s: mode found=%02x\n", -diff --git a/drivers/media/usb/hdpvr/hdpvr-video.c b/drivers/media/usb/hdpvr/hdpvr-video.c -index 0500c4175d5f..6bce01a674f9 100644 ---- a/drivers/media/usb/hdpvr/hdpvr-video.c -+++ b/drivers/media/usb/hdpvr/hdpvr-video.c -@@ -82,7 +82,7 @@ static void hdpvr_read_bulk_callback(struct urb *urb) - } - - /*=========================================================================*/ --/* bufffer bits */ -+/* buffer bits */ - - /* function expects dev->io_mutex to be hold by caller */ - int hdpvr_cancel_queue(struct hdpvr_device *dev) -@@ -926,7 +926,7 @@ static int hdpvr_s_ctrl(struct v4l2_ctrl *ctrl) - case V4L2_CID_MPEG_AUDIO_ENCODING: - if (dev->flags & HDPVR_FLAG_AC3_CAP) { - opt->audio_codec = ctrl->val; -- return hdpvr_set_audio(dev, opt->audio_input, -+ return hdpvr_set_audio(dev, opt->audio_input + 1, - opt->audio_codec); - } - return 0; -@@ -1198,7 +1198,7 @@ int hdpvr_register_videodev(struct hdpvr_device *dev, struct device *parent, - v4l2_ctrl_new_std_menu(hdl, &hdpvr_ctrl_ops, - V4L2_CID_MPEG_AUDIO_ENCODING, - ac3 ? V4L2_MPEG_AUDIO_ENCODING_AC3 : V4L2_MPEG_AUDIO_ENCODING_AAC, -- 0x7, V4L2_MPEG_AUDIO_ENCODING_AAC); -+ 0x7, ac3 ? dev->options.audio_codec : V4L2_MPEG_AUDIO_ENCODING_AAC); - v4l2_ctrl_new_std_menu(hdl, &hdpvr_ctrl_ops, - V4L2_CID_MPEG_VIDEO_ENCODING, - V4L2_MPEG_VIDEO_ENCODING_MPEG_4_AVC, 0x3, -diff --git a/drivers/media/v4l2-core/v4l2-dv-timings.c b/drivers/media/v4l2-core/v4l2-dv-timings.c -index a2e257970fec..78d99b137d91 100644 ---- a/drivers/media/v4l2-core/v4l2-dv-timings.c -+++ b/drivers/media/v4l2-core/v4l2-dv-timings.c -@@ -595,10 +595,10 @@ struct v4l2_fract v4l2_calc_aspect_ratio(u8 hor_landscape, u8 vert_portrait) - aspect.denominator = 9; - } else if (ratio == 34) { - aspect.numerator = 4; -- aspect.numerator = 3; -+ aspect.denominator = 3; - } else if (ratio == 68) { - aspect.numerator = 15; -- aspect.numerator = 9; -+ aspect.denominator = 9; - } else { - aspect.numerator = hor_landscape + 99; - aspect.denominator = 100; -diff --git a/drivers/parport/Kconfig b/drivers/parport/Kconfig -index 2872ece81f35..44333bd8f908 100644 ---- a/drivers/parport/Kconfig -+++ b/drivers/parport/Kconfig -@@ -5,6 +5,12 @@ - # Parport configuration. - # - -+config ARCH_MIGHT_HAVE_PC_PARPORT -+ bool -+ help -+ Select this config option from the architecture Kconfig if -+ the architecture might have PC parallel port hardware. -+ - menuconfig PARPORT - tristate "Parallel port support" - depends on HAS_IOMEM -@@ -31,12 +37,6 @@ menuconfig PARPORT - - If unsure, say Y. - --config ARCH_MIGHT_HAVE_PC_PARPORT -- bool -- help -- Select this config option from the architecture Kconfig if -- the architecture might have PC parallel port hardware. -- - if PARPORT - - config PARPORT_PC -diff --git a/drivers/staging/media/omap4iss/Kconfig b/drivers/staging/media/omap4iss/Kconfig -index b9fe753969bd..15940f8fdd24 100644 ---- a/drivers/staging/media/omap4iss/Kconfig -+++ b/drivers/staging/media/omap4iss/Kconfig -@@ -1,6 +1,6 @@ - config VIDEO_OMAP4 - bool "OMAP 4 Camera support" -- depends on VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API && I2C && ARCH_OMAP4 -+ depends on VIDEO_V4L2=y && VIDEO_V4L2_SUBDEV_API && I2C=y && ARCH_OMAP4 - select VIDEOBUF2_DMA_CONTIG - ---help--- - Driver for an OMAP 4 ISS controller. -diff --git a/fs/coredump.c b/fs/coredump.c -index 0b2528fb640e..a93f7e6ea4cf 100644 ---- a/fs/coredump.c -+++ b/fs/coredump.c -@@ -306,7 +306,7 @@ static int zap_threads(struct task_struct *tsk, struct mm_struct *mm, - if (unlikely(nr < 0)) - return nr; - -- tsk->flags = PF_DUMPCORE; -+ tsk->flags |= PF_DUMPCORE; - if (atomic_read(&mm->mm_users) == nr + 1) - goto done; - /* -diff --git a/fs/namei.c b/fs/namei.c -index 8274c8d39b03..bdea10963aa5 100644 ---- a/fs/namei.c -+++ b/fs/namei.c -@@ -2247,9 +2247,10 @@ done: - goto out; - } - path->dentry = dentry; -- path->mnt = mntget(nd->path.mnt); -+ path->mnt = nd->path.mnt; - if (should_follow_link(dentry, nd->flags & LOOKUP_FOLLOW)) - return 1; -+ mntget(path->mnt); - follow_mount(path); - error = 0; - out: -diff --git a/fs/nfs/nfs3acl.c b/fs/nfs/nfs3acl.c -index 871d6eda8dba..8f854dde4150 100644 ---- a/fs/nfs/nfs3acl.c -+++ b/fs/nfs/nfs3acl.c -@@ -247,3 +247,46 @@ const struct xattr_handler *nfs3_xattr_handlers[] = { - &posix_acl_default_xattr_handler, - NULL, - }; -+ -+static int -+nfs3_list_one_acl(struct inode *inode, int type, const char *name, void *data, -+ size_t size, ssize_t *result) -+{ -+ struct posix_acl *acl; -+ char *p = data + *result; -+ -+ acl = get_acl(inode, type); -+ if (!acl) -+ return 0; -+ -+ posix_acl_release(acl); -+ -+ *result += strlen(name); -+ *result += 1; -+ if (!size) -+ return 0; -+ if (*result > size) -+ return -ERANGE; -+ -+ strcpy(p, name); -+ return 0; -+} -+ -+ssize_t -+nfs3_listxattr(struct dentry *dentry, char *data, size_t size) -+{ -+ struct inode *inode = dentry->d_inode; -+ ssize_t result = 0; -+ int error; -+ -+ error = nfs3_list_one_acl(inode, ACL_TYPE_ACCESS, -+ POSIX_ACL_XATTR_ACCESS, data, size, &result); -+ if (error) -+ return error; -+ -+ error = nfs3_list_one_acl(inode, ACL_TYPE_DEFAULT, -+ POSIX_ACL_XATTR_DEFAULT, data, size, &result); -+ if (error) -+ return error; -+ return result; -+} -diff --git a/fs/nfs/nfs3proc.c b/fs/nfs/nfs3proc.c -index a462ef0fb5d6..8a18b4a0a4ee 100644 ---- a/fs/nfs/nfs3proc.c -+++ b/fs/nfs/nfs3proc.c -@@ -926,7 +926,7 @@ static const struct inode_operations nfs3_dir_inode_operations = { - .getattr = nfs_getattr, - .setattr = nfs_setattr, - #ifdef CONFIG_NFS_V3_ACL -- .listxattr = generic_listxattr, -+ .listxattr = nfs3_listxattr, - .getxattr = generic_getxattr, - .setxattr = generic_setxattr, - .removexattr = generic_removexattr, -@@ -940,7 +940,7 @@ static const struct inode_operations nfs3_file_inode_operations = { - .getattr = nfs_getattr, - .setattr = nfs_setattr, - #ifdef CONFIG_NFS_V3_ACL -- .listxattr = generic_listxattr, -+ .listxattr = nfs3_listxattr, - .getxattr = generic_getxattr, - .setxattr = generic_setxattr, - .removexattr = generic_removexattr, -diff --git a/include/linux/libata.h b/include/linux/libata.h -index 3fee55e73e5e..e13b3aef0b0c 100644 ---- a/include/linux/libata.h -+++ b/include/linux/libata.h -@@ -593,6 +593,7 @@ struct ata_host { - struct device *dev; - void __iomem * const *iomap; - unsigned int n_ports; -+ unsigned int n_tags; /* nr of NCQ tags */ - void *private_data; - struct ata_port_operations *ops; - unsigned long flags; -diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c -index 7e259b2bdf44..71136720ffa1 100644 ---- a/kernel/trace/trace.c -+++ b/kernel/trace/trace.c -@@ -811,7 +811,7 @@ static struct { - { trace_clock_local, "local", 1 }, - { trace_clock_global, "global", 1 }, - { trace_clock_counter, "counter", 0 }, -- { trace_clock_jiffies, "uptime", 1 }, -+ { trace_clock_jiffies, "uptime", 0 }, - { trace_clock, "perf", 1 }, - ARCH_TRACE_CLOCKS - }; -diff --git a/kernel/trace/trace_clock.c b/kernel/trace/trace_clock.c -index 26dc348332b7..57b67b1f24d1 100644 ---- a/kernel/trace/trace_clock.c -+++ b/kernel/trace/trace_clock.c -@@ -59,13 +59,14 @@ u64 notrace trace_clock(void) - - /* - * trace_jiffy_clock(): Simply use jiffies as a clock counter. -+ * Note that this use of jiffies_64 is not completely safe on -+ * 32-bit systems. But the window is tiny, and the effect if -+ * we are affected is that we will have an obviously bogus -+ * timestamp on a trace event - i.e. not life threatening. - */ - u64 notrace trace_clock_jiffies(void) - { -- u64 jiffy = jiffies - INITIAL_JIFFIES; -- -- /* Return nsecs */ -- return (u64)jiffies_to_usecs(jiffy) * 1000ULL; -+ return jiffies_64_to_clock_t(jiffies_64 - INITIAL_JIFFIES); - } - - /* -diff --git a/mm/hugetlb.c b/mm/hugetlb.c -index 30dd6265a141..923f38e62bcf 100644 ---- a/mm/hugetlb.c -+++ b/mm/hugetlb.c -@@ -2422,6 +2422,7 @@ int copy_hugetlb_page_range(struct mm_struct *dst, struct mm_struct *src, - } else { - if (cow) - huge_ptep_set_wrprotect(src, addr, src_pte); -+ entry = huge_ptep_get(src_pte); - ptepage = pte_page(entry); - get_page(ptepage); - page_dup_rmap(ptepage); -diff --git a/mm/slab_common.c b/mm/slab_common.c -index 1ec3c619ba04..f149e6724411 100644 ---- a/mm/slab_common.c -+++ b/mm/slab_common.c -@@ -56,7 +56,7 @@ static int kmem_cache_sanity_check(struct mem_cgroup *memcg, const char *name, - continue; - } - --#if !defined(CONFIG_SLUB) || !defined(CONFIG_SLUB_DEBUG_ON) -+#if !defined(CONFIG_SLUB) - /* - * For simplicity, we won't check this in the list of memcg - * caches. We have control over memcg naming, and if there -diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c -index 4fe2e6e2bc76..e6283464a8e6 100644 ---- a/net/wireless/nl80211.c -+++ b/net/wireless/nl80211.c -@@ -1450,18 +1450,17 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *dev, - } - CMD(start_p2p_device, START_P2P_DEVICE); - CMD(set_mcast_rate, SET_MCAST_RATE); -+#ifdef CONFIG_NL80211_TESTMODE -+ CMD(testmode_cmd, TESTMODE); -+#endif - if (state->split) { - CMD(crit_proto_start, CRIT_PROTOCOL_START); - CMD(crit_proto_stop, CRIT_PROTOCOL_STOP); - if (dev->wiphy.flags & WIPHY_FLAG_HAS_CHANNEL_SWITCH) - CMD(channel_switch, CHANNEL_SWITCH); -+ CMD(set_qos_map, SET_QOS_MAP); - } -- CMD(set_qos_map, SET_QOS_MAP); -- --#ifdef CONFIG_NL80211_TESTMODE -- CMD(testmode_cmd, TESTMODE); --#endif -- -+ /* add into the if now */ - #undef CMD - - if (dev->ops->connect || dev->ops->auth) { diff --git a/projects/imx6/patches/linux/linux-000-patch-3.14.15-16.patch b/projects/imx6/patches/linux/linux-000-patch-3.14.15-16.patch deleted file mode 100644 index 346b103783b..00000000000 --- a/projects/imx6/patches/linux/linux-000-patch-3.14.15-16.patch +++ /dev/null @@ -1,1740 +0,0 @@ -diff --git a/Documentation/x86/x86_64/mm.txt b/Documentation/x86/x86_64/mm.txt -index c584a51add15..afe68ddbe6a4 100644 ---- a/Documentation/x86/x86_64/mm.txt -+++ b/Documentation/x86/x86_64/mm.txt -@@ -12,6 +12,8 @@ ffffc90000000000 - ffffe8ffffffffff (=45 bits) vmalloc/ioremap space - ffffe90000000000 - ffffe9ffffffffff (=40 bits) hole - ffffea0000000000 - ffffeaffffffffff (=40 bits) virtual memory map (1TB) - ... unused hole ... -+ffffff0000000000 - ffffff7fffffffff (=39 bits) %esp fixup stacks -+... unused hole ... - ffffffff80000000 - ffffffffa0000000 (=512 MB) kernel text mapping, from phys 0 - ffffffffa0000000 - ffffffffff5fffff (=1525 MB) module mapping space - ffffffffff600000 - ffffffffffdfffff (=8 MB) vsyscalls -diff --git a/Makefile b/Makefile -index 188523e9e880..8b22e24a2d8e 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,6 +1,6 @@ - VERSION = 3 - PATCHLEVEL = 14 --SUBLEVEL = 15 -+SUBLEVEL = 16 - EXTRAVERSION = - NAME = Remembering Coco - -diff --git a/arch/arm/boot/dts/dra7-evm.dts b/arch/arm/boot/dts/dra7-evm.dts -index 5babba0a3a75..904dcf5973f3 100644 ---- a/arch/arm/boot/dts/dra7-evm.dts -+++ b/arch/arm/boot/dts/dra7-evm.dts -@@ -182,6 +182,7 @@ - regulator-name = "ldo3"; - regulator-min-microvolt = <1800000>; - regulator-max-microvolt = <1800000>; -+ regulator-always-on; - regulator-boot-on; - }; - -diff --git a/arch/arm/boot/dts/hi3620.dtsi b/arch/arm/boot/dts/hi3620.dtsi -index ab1116d086be..83a5b8685bd9 100644 ---- a/arch/arm/boot/dts/hi3620.dtsi -+++ b/arch/arm/boot/dts/hi3620.dtsi -@@ -73,7 +73,7 @@ - - L2: l2-cache { - compatible = "arm,pl310-cache"; -- reg = <0xfc10000 0x100000>; -+ reg = <0x100000 0x100000>; - interrupts = <0 15 4>; - cache-unified; - cache-level = <2>; -diff --git a/arch/arm/crypto/aesbs-glue.c b/arch/arm/crypto/aesbs-glue.c -index 4522366da759..15468fbbdea3 100644 ---- a/arch/arm/crypto/aesbs-glue.c -+++ b/arch/arm/crypto/aesbs-glue.c -@@ -137,7 +137,7 @@ static int aesbs_cbc_encrypt(struct blkcipher_desc *desc, - dst += AES_BLOCK_SIZE; - } while (--blocks); - } -- err = blkcipher_walk_done(desc, &walk, 0); -+ err = blkcipher_walk_done(desc, &walk, walk.nbytes % AES_BLOCK_SIZE); - } - return err; - } -@@ -158,7 +158,7 @@ static int aesbs_cbc_decrypt(struct blkcipher_desc *desc, - bsaes_cbc_encrypt(walk.src.virt.addr, walk.dst.virt.addr, - walk.nbytes, &ctx->dec, walk.iv); - kernel_neon_end(); -- err = blkcipher_walk_done(desc, &walk, 0); -+ err = blkcipher_walk_done(desc, &walk, walk.nbytes % AES_BLOCK_SIZE); - } - while (walk.nbytes) { - u32 blocks = walk.nbytes / AES_BLOCK_SIZE; -@@ -182,7 +182,7 @@ static int aesbs_cbc_decrypt(struct blkcipher_desc *desc, - dst += AES_BLOCK_SIZE; - src += AES_BLOCK_SIZE; - } while (--blocks); -- err = blkcipher_walk_done(desc, &walk, 0); -+ err = blkcipher_walk_done(desc, &walk, walk.nbytes % AES_BLOCK_SIZE); - } - return err; - } -@@ -268,7 +268,7 @@ static int aesbs_xts_encrypt(struct blkcipher_desc *desc, - bsaes_xts_encrypt(walk.src.virt.addr, walk.dst.virt.addr, - walk.nbytes, &ctx->enc, walk.iv); - kernel_neon_end(); -- err = blkcipher_walk_done(desc, &walk, 0); -+ err = blkcipher_walk_done(desc, &walk, walk.nbytes % AES_BLOCK_SIZE); - } - return err; - } -@@ -292,7 +292,7 @@ static int aesbs_xts_decrypt(struct blkcipher_desc *desc, - bsaes_xts_decrypt(walk.src.virt.addr, walk.dst.virt.addr, - walk.nbytes, &ctx->dec, walk.iv); - kernel_neon_end(); -- err = blkcipher_walk_done(desc, &walk, 0); -+ err = blkcipher_walk_done(desc, &walk, walk.nbytes % AES_BLOCK_SIZE); - } - return err; - } -diff --git a/arch/arm/mm/idmap.c b/arch/arm/mm/idmap.c -index 8e0e52eb76b5..d7a0ee898d24 100644 ---- a/arch/arm/mm/idmap.c -+++ b/arch/arm/mm/idmap.c -@@ -25,6 +25,13 @@ static void idmap_add_pmd(pud_t *pud, unsigned long addr, unsigned long end, - pr_warning("Failed to allocate identity pmd.\n"); - return; - } -+ /* -+ * Copy the original PMD to ensure that the PMD entries for -+ * the kernel image are preserved. -+ */ -+ if (!pud_none(*pud)) -+ memcpy(pmd, pmd_offset(pud, 0), -+ PTRS_PER_PMD * sizeof(pmd_t)); - pud_populate(&init_mm, pud, pmd); - pmd += pmd_index(addr); - } else -diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c -index b68c6b22e1c8..f15c22e8bcd5 100644 ---- a/arch/arm/mm/mmu.c -+++ b/arch/arm/mm/mmu.c -@@ -1436,8 +1436,8 @@ void __init early_paging_init(const struct machine_desc *mdesc, - return; - - /* remap kernel code and data */ -- map_start = init_mm.start_code; -- map_end = init_mm.brk; -+ map_start = init_mm.start_code & PMD_MASK; -+ map_end = ALIGN(init_mm.brk, PMD_SIZE); - - /* get a handle on things... */ - pgd0 = pgd_offset_k(0); -@@ -1472,7 +1472,7 @@ void __init early_paging_init(const struct machine_desc *mdesc, - } - - /* remap pmds for kernel mapping */ -- phys = __pa(map_start) & PMD_MASK; -+ phys = __pa(map_start); - do { - *pmdk++ = __pmd(phys | pmdprot); - phys += PMD_SIZE; -diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig -index 7324107acb40..c718d9f25900 100644 ---- a/arch/x86/Kconfig -+++ b/arch/x86/Kconfig -@@ -966,10 +966,27 @@ config VM86 - default y - depends on X86_32 - ---help--- -- This option is required by programs like DOSEMU to run 16-bit legacy -- code on X86 processors. It also may be needed by software like -- XFree86 to initialize some video cards via BIOS. Disabling this -- option saves about 6k. -+ This option is required by programs like DOSEMU to run -+ 16-bit real mode legacy code on x86 processors. It also may -+ be needed by software like XFree86 to initialize some video -+ cards via BIOS. Disabling this option saves about 6K. -+ -+config X86_16BIT -+ bool "Enable support for 16-bit segments" if EXPERT -+ default y -+ ---help--- -+ This option is required by programs like Wine to run 16-bit -+ protected mode legacy code on x86 processors. Disabling -+ this option saves about 300 bytes on i386, or around 6K text -+ plus 16K runtime memory on x86-64, -+ -+config X86_ESPFIX32 -+ def_bool y -+ depends on X86_16BIT && X86_32 -+ -+config X86_ESPFIX64 -+ def_bool y -+ depends on X86_16BIT && X86_64 - - config TOSHIBA - tristate "Toshiba Laptop support" -diff --git a/arch/x86/include/asm/espfix.h b/arch/x86/include/asm/espfix.h -new file mode 100644 -index 000000000000..99efebb2f69d ---- /dev/null -+++ b/arch/x86/include/asm/espfix.h -@@ -0,0 +1,16 @@ -+#ifndef _ASM_X86_ESPFIX_H -+#define _ASM_X86_ESPFIX_H -+ -+#ifdef CONFIG_X86_64 -+ -+#include <asm/percpu.h> -+ -+DECLARE_PER_CPU_READ_MOSTLY(unsigned long, espfix_stack); -+DECLARE_PER_CPU_READ_MOSTLY(unsigned long, espfix_waddr); -+ -+extern void init_espfix_bsp(void); -+extern void init_espfix_ap(void); -+ -+#endif /* CONFIG_X86_64 */ -+ -+#endif /* _ASM_X86_ESPFIX_H */ -diff --git a/arch/x86/include/asm/irqflags.h b/arch/x86/include/asm/irqflags.h -index bba3cf88e624..0a8b519226b8 100644 ---- a/arch/x86/include/asm/irqflags.h -+++ b/arch/x86/include/asm/irqflags.h -@@ -129,7 +129,7 @@ static inline notrace unsigned long arch_local_irq_save(void) - - #define PARAVIRT_ADJUST_EXCEPTION_FRAME /* */ - --#define INTERRUPT_RETURN iretq -+#define INTERRUPT_RETURN jmp native_iret - #define USERGS_SYSRET64 \ - swapgs; \ - sysretq; -diff --git a/arch/x86/include/asm/pgtable_64_types.h b/arch/x86/include/asm/pgtable_64_types.h -index c883bf726398..7166e25ecb57 100644 ---- a/arch/x86/include/asm/pgtable_64_types.h -+++ b/arch/x86/include/asm/pgtable_64_types.h -@@ -61,6 +61,8 @@ typedef struct { pteval_t pte; } pte_t; - #define MODULES_VADDR (__START_KERNEL_map + KERNEL_IMAGE_SIZE) - #define MODULES_END _AC(0xffffffffff000000, UL) - #define MODULES_LEN (MODULES_END - MODULES_VADDR) -+#define ESPFIX_PGD_ENTRY _AC(-2, UL) -+#define ESPFIX_BASE_ADDR (ESPFIX_PGD_ENTRY << PGDIR_SHIFT) - - #define EARLY_DYNAMIC_PAGE_TABLES 64 - -diff --git a/arch/x86/include/asm/setup.h b/arch/x86/include/asm/setup.h -index d62c9f809bc5..75b14ca135be 100644 ---- a/arch/x86/include/asm/setup.h -+++ b/arch/x86/include/asm/setup.h -@@ -65,6 +65,8 @@ static inline void x86_ce4100_early_setup(void) { } - - #ifndef _SETUP - -+#include <asm/espfix.h> -+ - /* - * This is set up by the setup-routine at boot-time - */ -diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile -index cb648c84b327..56bac868cb91 100644 ---- a/arch/x86/kernel/Makefile -+++ b/arch/x86/kernel/Makefile -@@ -29,6 +29,7 @@ obj-$(CONFIG_X86_64) += sys_x86_64.o x8664_ksyms_64.o - obj-y += syscall_$(BITS).o - obj-$(CONFIG_X86_64) += vsyscall_64.o - obj-$(CONFIG_X86_64) += vsyscall_emu_64.o -+obj-$(CONFIG_X86_ESPFIX64) += espfix_64.o - obj-$(CONFIG_SYSFS) += ksysfs.o - obj-y += bootflag.o e820.o - obj-y += pci-dma.o quirks.o topology.o kdebugfs.o -diff --git a/arch/x86/kernel/entry_32.S b/arch/x86/kernel/entry_32.S -index c87810b1b557..c5a9cb94dee6 100644 ---- a/arch/x86/kernel/entry_32.S -+++ b/arch/x86/kernel/entry_32.S -@@ -529,6 +529,7 @@ syscall_exit: - restore_all: - TRACE_IRQS_IRET - restore_all_notrace: -+#ifdef CONFIG_X86_ESPFIX32 - movl PT_EFLAGS(%esp), %eax # mix EFLAGS, SS and CS - # Warning: PT_OLDSS(%esp) contains the wrong/random values if we - # are returning to the kernel. -@@ -539,6 +540,7 @@ restore_all_notrace: - cmpl $((SEGMENT_LDT << 8) | USER_RPL), %eax - CFI_REMEMBER_STATE - je ldt_ss # returning to user-space with LDT SS -+#endif - restore_nocheck: - RESTORE_REGS 4 # skip orig_eax/error_code - irq_return: -@@ -551,6 +553,7 @@ ENTRY(iret_exc) - .previous - _ASM_EXTABLE(irq_return,iret_exc) - -+#ifdef CONFIG_X86_ESPFIX32 - CFI_RESTORE_STATE - ldt_ss: - #ifdef CONFIG_PARAVIRT -@@ -594,6 +597,7 @@ ldt_ss: - lss (%esp), %esp /* switch to espfix segment */ - CFI_ADJUST_CFA_OFFSET -8 - jmp restore_nocheck -+#endif - CFI_ENDPROC - ENDPROC(system_call) - -@@ -706,6 +710,7 @@ END(syscall_badsys) - * the high word of the segment base from the GDT and swiches to the - * normal stack and adjusts ESP with the matching offset. - */ -+#ifdef CONFIG_X86_ESPFIX32 - /* fixup the stack */ - mov GDT_ESPFIX_SS + 4, %al /* bits 16..23 */ - mov GDT_ESPFIX_SS + 7, %ah /* bits 24..31 */ -@@ -715,8 +720,10 @@ END(syscall_badsys) - pushl_cfi %eax - lss (%esp), %esp /* switch to the normal stack segment */ - CFI_ADJUST_CFA_OFFSET -8 -+#endif - .endm - .macro UNWIND_ESPFIX_STACK -+#ifdef CONFIG_X86_ESPFIX32 - movl %ss, %eax - /* see if on espfix stack */ - cmpw $__ESPFIX_SS, %ax -@@ -727,6 +734,7 @@ END(syscall_badsys) - /* switch to normal stack */ - FIXUP_ESPFIX_STACK - 27: -+#endif - .endm - - /* -@@ -1357,11 +1365,13 @@ END(debug) - ENTRY(nmi) - RING0_INT_FRAME - ASM_CLAC -+#ifdef CONFIG_X86_ESPFIX32 - pushl_cfi %eax - movl %ss, %eax - cmpw $__ESPFIX_SS, %ax - popl_cfi %eax - je nmi_espfix_stack -+#endif - cmpl $ia32_sysenter_target,(%esp) - je nmi_stack_fixup - pushl_cfi %eax -@@ -1401,6 +1411,7 @@ nmi_debug_stack_check: - FIX_STACK 24, nmi_stack_correct, 1 - jmp nmi_stack_correct - -+#ifdef CONFIG_X86_ESPFIX32 - nmi_espfix_stack: - /* We have a RING0_INT_FRAME here. - * -@@ -1422,6 +1433,7 @@ nmi_espfix_stack: - lss 12+4(%esp), %esp # back to espfix stack - CFI_ADJUST_CFA_OFFSET -24 - jmp irq_return -+#endif - CFI_ENDPROC - END(nmi) - -diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S -index 1e96c3628bf2..03cd2a8f6009 100644 ---- a/arch/x86/kernel/entry_64.S -+++ b/arch/x86/kernel/entry_64.S -@@ -58,6 +58,7 @@ - #include <asm/asm.h> - #include <asm/context_tracking.h> - #include <asm/smap.h> -+#include <asm/pgtable_types.h> - #include <linux/err.h> - - /* Avoid __ASSEMBLER__'ifying <linux/audit.h> just for this. */ -@@ -1041,12 +1042,45 @@ restore_args: - - irq_return: - INTERRUPT_RETURN -- _ASM_EXTABLE(irq_return, bad_iret) - --#ifdef CONFIG_PARAVIRT - ENTRY(native_iret) -+ /* -+ * Are we returning to a stack segment from the LDT? Note: in -+ * 64-bit mode SS:RSP on the exception stack is always valid. -+ */ -+#ifdef CONFIG_X86_ESPFIX64 -+ testb $4,(SS-RIP)(%rsp) -+ jnz native_irq_return_ldt -+#endif -+ -+native_irq_return_iret: - iretq -- _ASM_EXTABLE(native_iret, bad_iret) -+ _ASM_EXTABLE(native_irq_return_iret, bad_iret) -+ -+#ifdef CONFIG_X86_ESPFIX64 -+native_irq_return_ldt: -+ pushq_cfi %rax -+ pushq_cfi %rdi -+ SWAPGS -+ movq PER_CPU_VAR(espfix_waddr),%rdi -+ movq %rax,(0*8)(%rdi) /* RAX */ -+ movq (2*8)(%rsp),%rax /* RIP */ -+ movq %rax,(1*8)(%rdi) -+ movq (3*8)(%rsp),%rax /* CS */ -+ movq %rax,(2*8)(%rdi) -+ movq (4*8)(%rsp),%rax /* RFLAGS */ -+ movq %rax,(3*8)(%rdi) -+ movq (6*8)(%rsp),%rax /* SS */ -+ movq %rax,(5*8)(%rdi) -+ movq (5*8)(%rsp),%rax /* RSP */ -+ movq %rax,(4*8)(%rdi) -+ andl $0xffff0000,%eax -+ popq_cfi %rdi -+ orq PER_CPU_VAR(espfix_stack),%rax -+ SWAPGS -+ movq %rax,%rsp -+ popq_cfi %rax -+ jmp native_irq_return_iret - #endif - - .section .fixup,"ax" -@@ -1110,9 +1144,40 @@ ENTRY(retint_kernel) - call preempt_schedule_irq - jmp exit_intr - #endif -- - CFI_ENDPROC - END(common_interrupt) -+ -+ /* -+ * If IRET takes a fault on the espfix stack, then we -+ * end up promoting it to a doublefault. In that case, -+ * modify the stack to make it look like we just entered -+ * the #GP handler from user space, similar to bad_iret. -+ */ -+#ifdef CONFIG_X86_ESPFIX64 -+ ALIGN -+__do_double_fault: -+ XCPT_FRAME 1 RDI+8 -+ movq RSP(%rdi),%rax /* Trap on the espfix stack? */ -+ sarq $PGDIR_SHIFT,%rax -+ cmpl $ESPFIX_PGD_ENTRY,%eax -+ jne do_double_fault /* No, just deliver the fault */ -+ cmpl $__KERNEL_CS,CS(%rdi) -+ jne do_double_fault -+ movq RIP(%rdi),%rax -+ cmpq $native_irq_return_iret,%rax -+ jne do_double_fault /* This shouldn't happen... */ -+ movq PER_CPU_VAR(kernel_stack),%rax -+ subq $(6*8-KERNEL_STACK_OFFSET),%rax /* Reset to original stack */ -+ movq %rax,RSP(%rdi) -+ movq $0,(%rax) /* Missing (lost) #GP error code */ -+ movq $general_protection,RIP(%rdi) -+ retq -+ CFI_ENDPROC -+END(__do_double_fault) -+#else -+# define __do_double_fault do_double_fault -+#endif -+ - /* - * End of kprobes section - */ -@@ -1314,7 +1379,7 @@ zeroentry overflow do_overflow - zeroentry bounds do_bounds - zeroentry invalid_op do_invalid_op - zeroentry device_not_available do_device_not_available --paranoiderrorentry double_fault do_double_fault -+paranoiderrorentry double_fault __do_double_fault - zeroentry coprocessor_segment_overrun do_coprocessor_segment_overrun - errorentry invalid_TSS do_invalid_TSS - errorentry segment_not_present do_segment_not_present -@@ -1601,7 +1666,7 @@ error_sti: - */ - error_kernelspace: - incl %ebx -- leaq irq_return(%rip),%rcx -+ leaq native_irq_return_iret(%rip),%rcx - cmpq %rcx,RIP+8(%rsp) - je error_swapgs - movl %ecx,%eax /* zero extend */ -diff --git a/arch/x86/kernel/espfix_64.c b/arch/x86/kernel/espfix_64.c -new file mode 100644 -index 000000000000..94d857fb1033 ---- /dev/null -+++ b/arch/x86/kernel/espfix_64.c -@@ -0,0 +1,208 @@ -+/* ----------------------------------------------------------------------- * -+ * -+ * Copyright 2014 Intel Corporation; author: H. Peter Anvin -+ * -+ * This program is free software; you can redistribute it and/or modify it -+ * under the terms and conditions of the GNU General Public License, -+ * version 2, as published by the Free Software Foundation. -+ * -+ * This program is distributed in the hope it will be useful, but WITHOUT -+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -+ * more details. -+ * -+ * ----------------------------------------------------------------------- */ -+ -+/* -+ * The IRET instruction, when returning to a 16-bit segment, only -+ * restores the bottom 16 bits of the user space stack pointer. This -+ * causes some 16-bit software to break, but it also leaks kernel state -+ * to user space. -+ * -+ * This works around this by creating percpu "ministacks", each of which -+ * is mapped 2^16 times 64K apart. When we detect that the return SS is -+ * on the LDT, we copy the IRET frame to the ministack and use the -+ * relevant alias to return to userspace. The ministacks are mapped -+ * readonly, so if the IRET fault we promote #GP to #DF which is an IST -+ * vector and thus has its own stack; we then do the fixup in the #DF -+ * handler. -+ * -+ * This file sets up the ministacks and the related page tables. The -+ * actual ministack invocation is in entry_64.S. -+ */ -+ -+#include <linux/init.h> -+#include <linux/init_task.h> -+#include <linux/kernel.h> -+#include <linux/percpu.h> -+#include <linux/gfp.h> -+#include <linux/random.h> -+#include <asm/pgtable.h> -+#include <asm/pgalloc.h> -+#include <asm/setup.h> -+#include <asm/espfix.h> -+ -+/* -+ * Note: we only need 6*8 = 48 bytes for the espfix stack, but round -+ * it up to a cache line to avoid unnecessary sharing. -+ */ -+#define ESPFIX_STACK_SIZE (8*8UL) -+#define ESPFIX_STACKS_PER_PAGE (PAGE_SIZE/ESPFIX_STACK_SIZE) -+ -+/* There is address space for how many espfix pages? */ -+#define ESPFIX_PAGE_SPACE (1UL << (PGDIR_SHIFT-PAGE_SHIFT-16)) -+ -+#define ESPFIX_MAX_CPUS (ESPFIX_STACKS_PER_PAGE * ESPFIX_PAGE_SPACE) -+#if CONFIG_NR_CPUS > ESPFIX_MAX_CPUS -+# error "Need more than one PGD for the ESPFIX hack" -+#endif -+ -+#define PGALLOC_GFP (GFP_KERNEL | __GFP_NOTRACK | __GFP_REPEAT | __GFP_ZERO) -+ -+/* This contains the *bottom* address of the espfix stack */ -+DEFINE_PER_CPU_READ_MOSTLY(unsigned long, espfix_stack); -+DEFINE_PER_CPU_READ_MOSTLY(unsigned long, espfix_waddr); -+ -+/* Initialization mutex - should this be a spinlock? */ -+static DEFINE_MUTEX(espfix_init_mutex); -+ -+/* Page allocation bitmap - each page serves ESPFIX_STACKS_PER_PAGE CPUs */ -+#define ESPFIX_MAX_PAGES DIV_ROUND_UP(CONFIG_NR_CPUS, ESPFIX_STACKS_PER_PAGE) -+static void *espfix_pages[ESPFIX_MAX_PAGES]; -+ -+static __page_aligned_bss pud_t espfix_pud_page[PTRS_PER_PUD] -+ __aligned(PAGE_SIZE); -+ -+static unsigned int page_random, slot_random; -+ -+/* -+ * This returns the bottom address of the espfix stack for a specific CPU. -+ * The math allows for a non-power-of-two ESPFIX_STACK_SIZE, in which case -+ * we have to account for some amount of padding at the end of each page. -+ */ -+static inline unsigned long espfix_base_addr(unsigned int cpu) -+{ -+ unsigned long page, slot; -+ unsigned long addr; -+ -+ page = (cpu / ESPFIX_STACKS_PER_PAGE) ^ page_random; -+ slot = (cpu + slot_random) % ESPFIX_STACKS_PER_PAGE; -+ addr = (page << PAGE_SHIFT) + (slot * ESPFIX_STACK_SIZE); -+ addr = (addr & 0xffffUL) | ((addr & ~0xffffUL) << 16); -+ addr += ESPFIX_BASE_ADDR; -+ return addr; -+} -+ -+#define PTE_STRIDE (65536/PAGE_SIZE) -+#define ESPFIX_PTE_CLONES (PTRS_PER_PTE/PTE_STRIDE) -+#define ESPFIX_PMD_CLONES PTRS_PER_PMD -+#define ESPFIX_PUD_CLONES (65536/(ESPFIX_PTE_CLONES*ESPFIX_PMD_CLONES)) -+ -+#define PGTABLE_PROT ((_KERNPG_TABLE & ~_PAGE_RW) | _PAGE_NX) -+ -+static void init_espfix_random(void) -+{ -+ unsigned long rand; -+ -+ /* -+ * This is run before the entropy pools are initialized, -+ * but this is hopefully better than nothing. -+ */ -+ if (!arch_get_random_long(&rand)) { -+ /* The constant is an arbitrary large prime */ -+ rdtscll(rand); -+ rand *= 0xc345c6b72fd16123UL; -+ } -+ -+ slot_random = rand % ESPFIX_STACKS_PER_PAGE; -+ page_random = (rand / ESPFIX_STACKS_PER_PAGE) -+ & (ESPFIX_PAGE_SPACE - 1); -+} -+ -+void __init init_espfix_bsp(void) -+{ -+ pgd_t *pgd_p; -+ pteval_t ptemask; -+ -+ ptemask = __supported_pte_mask; -+ -+ /* Install the espfix pud into the kernel page directory */ -+ pgd_p = &init_level4_pgt[pgd_index(ESPFIX_BASE_ADDR)]; -+ pgd_populate(&init_mm, pgd_p, (pud_t *)espfix_pud_page); -+ -+ /* Randomize the locations */ -+ init_espfix_random(); -+ -+ /* The rest is the same as for any other processor */ -+ init_espfix_ap(); -+} -+ -+void init_espfix_ap(void) -+{ -+ unsigned int cpu, page; -+ unsigned long addr; -+ pud_t pud, *pud_p; -+ pmd_t pmd, *pmd_p; -+ pte_t pte, *pte_p; -+ int n; -+ void *stack_page; -+ pteval_t ptemask; -+ -+ /* We only have to do this once... */ -+ if (likely(this_cpu_read(espfix_stack))) -+ return; /* Already initialized */ -+ -+ cpu = smp_processor_id(); -+ addr = espfix_base_addr(cpu); -+ page = cpu/ESPFIX_STACKS_PER_PAGE; -+ -+ /* Did another CPU already set this up? */ -+ stack_page = ACCESS_ONCE(espfix_pages[page]); -+ if (likely(stack_page)) -+ goto done; -+ -+ mutex_lock(&espfix_init_mutex); -+ -+ /* Did we race on the lock? */ -+ stack_page = ACCESS_ONCE(espfix_pages[page]); -+ if (stack_page) -+ goto unlock_done; -+ -+ ptemask = __supported_pte_mask; -+ -+ pud_p = &espfix_pud_page[pud_index(addr)]; -+ pud = *pud_p; -+ if (!pud_present(pud)) { -+ pmd_p = (pmd_t *)__get_free_page(PGALLOC_GFP); -+ pud = __pud(__pa(pmd_p) | (PGTABLE_PROT & ptemask)); -+ paravirt_alloc_pmd(&init_mm, __pa(pmd_p) >> PAGE_SHIFT); -+ for (n = 0; n < ESPFIX_PUD_CLONES; n++) -+ set_pud(&pud_p[n], pud); -+ } -+ -+ pmd_p = pmd_offset(&pud, addr); -+ pmd = *pmd_p; -+ if (!pmd_present(pmd)) { -+ pte_p = (pte_t *)__get_free_page(PGALLOC_GFP); -+ pmd = __pmd(__pa(pte_p) | (PGTABLE_PROT & ptemask)); -+ paravirt_alloc_pte(&init_mm, __pa(pte_p) >> PAGE_SHIFT); -+ for (n = 0; n < ESPFIX_PMD_CLONES; n++) -+ set_pmd(&pmd_p[n], pmd); -+ } -+ -+ pte_p = pte_offset_kernel(&pmd, addr); -+ stack_page = (void *)__get_free_page(GFP_KERNEL); -+ pte = __pte(__pa(stack_page) | (__PAGE_KERNEL_RO & ptemask)); -+ for (n = 0; n < ESPFIX_PTE_CLONES; n++) -+ set_pte(&pte_p[n*PTE_STRIDE], pte); -+ -+ /* Job is done for this CPU and any CPU which shares this page */ -+ ACCESS_ONCE(espfix_pages[page]) = stack_page; -+ -+unlock_done: -+ mutex_unlock(&espfix_init_mutex); -+done: -+ this_cpu_write(espfix_stack, addr); -+ this_cpu_write(espfix_waddr, (unsigned long)stack_page -+ + (addr & ~PAGE_MASK)); -+} -diff --git a/arch/x86/kernel/ldt.c b/arch/x86/kernel/ldt.c -index dcbbaa165bde..c37886d759cc 100644 ---- a/arch/x86/kernel/ldt.c -+++ b/arch/x86/kernel/ldt.c -@@ -20,8 +20,6 @@ - #include <asm/mmu_context.h> - #include <asm/syscalls.h> - --int sysctl_ldt16 = 0; -- - #ifdef CONFIG_SMP - static void flush_ldt(void *current_mm) - { -@@ -231,16 +229,10 @@ static int write_ldt(void __user *ptr, unsigned long bytecount, int oldmode) - } - } - -- /* -- * On x86-64 we do not support 16-bit segments due to -- * IRET leaking the high bits of the kernel stack address. -- */ --#ifdef CONFIG_X86_64 -- if (!ldt_info.seg_32bit && !sysctl_ldt16) { -+ if (!IS_ENABLED(CONFIG_X86_16BIT) && !ldt_info.seg_32bit) { - error = -EINVAL; - goto out_unlock; - } --#endif - - fill_ldt(&ldt, &ldt_info); - if (oldmode) -diff --git a/arch/x86/kernel/paravirt_patch_64.c b/arch/x86/kernel/paravirt_patch_64.c -index 3f08f34f93eb..a1da6737ba5b 100644 ---- a/arch/x86/kernel/paravirt_patch_64.c -+++ b/arch/x86/kernel/paravirt_patch_64.c -@@ -6,7 +6,6 @@ DEF_NATIVE(pv_irq_ops, irq_disable, "cli"); - DEF_NATIVE(pv_irq_ops, irq_enable, "sti"); - DEF_NATIVE(pv_irq_ops, restore_fl, "pushq %rdi; popfq"); - DEF_NATIVE(pv_irq_ops, save_fl, "pushfq; popq %rax"); --DEF_NATIVE(pv_cpu_ops, iret, "iretq"); - DEF_NATIVE(pv_mmu_ops, read_cr2, "movq %cr2, %rax"); - DEF_NATIVE(pv_mmu_ops, read_cr3, "movq %cr3, %rax"); - DEF_NATIVE(pv_mmu_ops, write_cr3, "movq %rdi, %cr3"); -@@ -50,7 +49,6 @@ unsigned native_patch(u8 type, u16 clobbers, void *ibuf, - PATCH_SITE(pv_irq_ops, save_fl); - PATCH_SITE(pv_irq_ops, irq_enable); - PATCH_SITE(pv_irq_ops, irq_disable); -- PATCH_SITE(pv_cpu_ops, iret); - PATCH_SITE(pv_cpu_ops, irq_enable_sysexit); - PATCH_SITE(pv_cpu_ops, usergs_sysret32); - PATCH_SITE(pv_cpu_ops, usergs_sysret64); -diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c -index a32da804252e..395be6d8bbde 100644 ---- a/arch/x86/kernel/smpboot.c -+++ b/arch/x86/kernel/smpboot.c -@@ -243,6 +243,13 @@ static void notrace start_secondary(void *unused) - check_tsc_sync_target(); - - /* -+ * Enable the espfix hack for this CPU -+ */ -+#ifdef CONFIG_X86_ESPFIX64 -+ init_espfix_ap(); -+#endif -+ -+ /* - * We need to hold vector_lock so there the set of online cpus - * does not change while we are assigning vectors to cpus. Holding - * this lock ensures we don't half assign or remove an irq from a cpu. -diff --git a/arch/x86/mm/dump_pagetables.c b/arch/x86/mm/dump_pagetables.c -index 0002a3a33081..3620928631ce 100644 ---- a/arch/x86/mm/dump_pagetables.c -+++ b/arch/x86/mm/dump_pagetables.c -@@ -30,11 +30,13 @@ struct pg_state { - unsigned long start_address; - unsigned long current_address; - const struct addr_marker *marker; -+ unsigned long lines; - }; - - struct addr_marker { - unsigned long start_address; - const char *name; -+ unsigned long max_lines; - }; - - /* indices for address_markers; keep sync'd w/ address_markers below */ -@@ -45,6 +47,7 @@ enum address_markers_idx { - LOW_KERNEL_NR, - VMALLOC_START_NR, - VMEMMAP_START_NR, -+ ESPFIX_START_NR, - HIGH_KERNEL_NR, - MODULES_VADDR_NR, - MODULES_END_NR, -@@ -67,6 +70,7 @@ static struct addr_marker address_markers[] = { - { PAGE_OFFSET, "Low Kernel Mapping" }, - { VMALLOC_START, "vmalloc() Area" }, - { VMEMMAP_START, "Vmemmap" }, -+ { ESPFIX_BASE_ADDR, "ESPfix Area", 16 }, - { __START_KERNEL_map, "High Kernel Mapping" }, - { MODULES_VADDR, "Modules" }, - { MODULES_END, "End Modules" }, -@@ -163,7 +167,7 @@ static void note_page(struct seq_file *m, struct pg_state *st, - pgprot_t new_prot, int level) - { - pgprotval_t prot, cur; -- static const char units[] = "KMGTPE"; -+ static const char units[] = "BKMGTPE"; - - /* - * If we have a "break" in the series, we need to flush the state that -@@ -178,6 +182,7 @@ static void note_page(struct seq_file *m, struct pg_state *st, - st->current_prot = new_prot; - st->level = level; - st->marker = address_markers; -+ st->lines = 0; - seq_printf(m, "---[ %s ]---\n", st->marker->name); - } else if (prot != cur || level != st->level || - st->current_address >= st->marker[1].start_address) { -@@ -188,17 +193,21 @@ static void note_page(struct seq_file *m, struct pg_state *st, - /* - * Now print the actual finished series - */ -- seq_printf(m, "0x%0*lx-0x%0*lx ", -- width, st->start_address, -- width, st->current_address); -- -- delta = (st->current_address - st->start_address) >> 10; -- while (!(delta & 1023) && unit[1]) { -- delta >>= 10; -- unit++; -+ if (!st->marker->max_lines || -+ st->lines < st->marker->max_lines) { -+ seq_printf(m, "0x%0*lx-0x%0*lx ", -+ width, st->start_address, -+ width, st->current_address); -+ -+ delta = (st->current_address - st->start_address) >> 10; -+ while (!(delta & 1023) && unit[1]) { -+ delta >>= 10; -+ unit++; -+ } -+ seq_printf(m, "%9lu%c ", delta, *unit); -+ printk_prot(m, st->current_prot, st->level); - } -- seq_printf(m, "%9lu%c ", delta, *unit); -- printk_prot(m, st->current_prot, st->level); -+ st->lines++; - - /* - * We print markers for special areas of address space, -diff --git a/arch/x86/vdso/vdso32-setup.c b/arch/x86/vdso/vdso32-setup.c -index f1d633a43f8e..d6bfb876cfb0 100644 ---- a/arch/x86/vdso/vdso32-setup.c -+++ b/arch/x86/vdso/vdso32-setup.c -@@ -41,7 +41,6 @@ enum { - #ifdef CONFIG_X86_64 - #define vdso_enabled sysctl_vsyscall32 - #define arch_setup_additional_pages syscall32_setup_pages --extern int sysctl_ldt16; - #endif - - /* -@@ -381,13 +380,6 @@ static struct ctl_table abi_table2[] = { - .mode = 0644, - .proc_handler = proc_dointvec - }, -- { -- .procname = "ldt16", -- .data = &sysctl_ldt16, -- .maxlen = sizeof(int), -- .mode = 0644, -- .proc_handler = proc_dointvec -- }, - {} - }; - -diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c -index 0982233b9b84..a6a72ce8630f 100644 ---- a/arch/x86/xen/setup.c -+++ b/arch/x86/xen/setup.c -@@ -574,13 +574,7 @@ void xen_enable_syscall(void) - } - #endif /* CONFIG_X86_64 */ - } --void xen_enable_nmi(void) --{ --#ifdef CONFIG_X86_64 -- if (register_callback(CALLBACKTYPE_nmi, (char *)nmi)) -- BUG(); --#endif --} -+ - void __init xen_pvmmu_arch_setup(void) - { - HYPERVISOR_vm_assist(VMASST_CMD_enable, VMASST_TYPE_4gb_segments); -@@ -595,7 +589,6 @@ void __init xen_pvmmu_arch_setup(void) - - xen_enable_sysenter(); - xen_enable_syscall(); -- xen_enable_nmi(); - } - - /* This function is not called for HVM domains */ -diff --git a/arch/xtensa/kernel/vectors.S b/arch/xtensa/kernel/vectors.S -index f9e1ec346e35..8453e6e39895 100644 ---- a/arch/xtensa/kernel/vectors.S -+++ b/arch/xtensa/kernel/vectors.S -@@ -376,38 +376,42 @@ _DoubleExceptionVector_WindowOverflow: - beqz a2, 1f # if at start of vector, don't restore - - addi a0, a0, -128 -- bbsi a0, 8, 1f # don't restore except for overflow 8 and 12 -- bbsi a0, 7, 2f -+ bbsi.l a0, 8, 1f # don't restore except for overflow 8 and 12 -+ -+ /* -+ * This fixup handler is for the extremely unlikely case where the -+ * overflow handler's reference thru a0 gets a hardware TLB refill -+ * that bumps out the (distinct, aliasing) TLB entry that mapped its -+ * prior references thru a9/a13, and where our reference now thru -+ * a9/a13 gets a 2nd-level miss exception (not hardware TLB refill). -+ */ -+ movi a2, window_overflow_restore_a0_fixup -+ s32i a2, a3, EXC_TABLE_FIXUP -+ l32i a2, a3, EXC_TABLE_DOUBLE_SAVE -+ xsr a3, excsave1 -+ -+ bbsi.l a0, 7, 2f - - /* - * Restore a0 as saved by _WindowOverflow8(). -- * -- * FIXME: we really need a fixup handler for this L32E, -- * for the extremely unlikely case where the overflow handler's -- * reference thru a0 gets a hardware TLB refill that bumps out -- * the (distinct, aliasing) TLB entry that mapped its prior -- * references thru a9, and where our reference now thru a9 -- * gets a 2nd-level miss exception (not hardware TLB refill). - */ - -- l32e a2, a9, -16 -- wsr a2, depc # replace the saved a0 -- j 1f -+ l32e a0, a9, -16 -+ wsr a0, depc # replace the saved a0 -+ j 3f - - 2: - /* - * Restore a0 as saved by _WindowOverflow12(). -- * -- * FIXME: we really need a fixup handler for this L32E, -- * for the extremely unlikely case where the overflow handler's -- * reference thru a0 gets a hardware TLB refill that bumps out -- * the (distinct, aliasing) TLB entry that mapped its prior -- * references thru a13, and where our reference now thru a13 -- * gets a 2nd-level miss exception (not hardware TLB refill). - */ - -- l32e a2, a13, -16 -- wsr a2, depc # replace the saved a0 -+ l32e a0, a13, -16 -+ wsr a0, depc # replace the saved a0 -+3: -+ xsr a3, excsave1 -+ movi a0, 0 -+ s32i a0, a3, EXC_TABLE_FIXUP -+ s32i a2, a3, EXC_TABLE_DOUBLE_SAVE - 1: - /* - * Restore WindowBase while leaving all address registers restored. -@@ -449,6 +453,7 @@ _DoubleExceptionVector_WindowOverflow: - - s32i a0, a2, PT_DEPC - -+_DoubleExceptionVector_handle_exception: - addx4 a0, a0, a3 - l32i a0, a0, EXC_TABLE_FAST_USER - xsr a3, excsave1 -@@ -464,11 +469,120 @@ _DoubleExceptionVector_WindowOverflow: - rotw -3 - j 1b - -- .end literal_prefix - - ENDPROC(_DoubleExceptionVector) - - /* -+ * Fixup handler for TLB miss in double exception handler for window owerflow. -+ * We get here with windowbase set to the window that was being spilled and -+ * a0 trashed. a0 bit 7 determines if this is a call8 (bit clear) or call12 -+ * (bit set) window. -+ * -+ * We do the following here: -+ * - go to the original window retaining a0 value; -+ * - set up exception stack to return back to appropriate a0 restore code -+ * (we'll need to rotate window back and there's no place to save this -+ * information, use different return address for that); -+ * - handle the exception; -+ * - go to the window that was being spilled; -+ * - set up window_overflow_restore_a0_fixup as a fixup routine; -+ * - reload a0; -+ * - restore the original window; -+ * - reset the default fixup routine; -+ * - return to user. By the time we get to this fixup handler all information -+ * about the conditions of the original double exception that happened in -+ * the window overflow handler is lost, so we just return to userspace to -+ * retry overflow from start. -+ * -+ * a0: value of depc, original value in depc -+ * a2: trashed, original value in EXC_TABLE_DOUBLE_SAVE -+ * a3: exctable, original value in excsave1 -+ */ -+ -+ENTRY(window_overflow_restore_a0_fixup) -+ -+ rsr a0, ps -+ extui a0, a0, PS_OWB_SHIFT, PS_OWB_WIDTH -+ rsr a2, windowbase -+ sub a0, a2, a0 -+ extui a0, a0, 0, 3 -+ l32i a2, a3, EXC_TABLE_DOUBLE_SAVE -+ xsr a3, excsave1 -+ -+ _beqi a0, 1, .Lhandle_1 -+ _beqi a0, 3, .Lhandle_3 -+ -+ .macro overflow_fixup_handle_exception_pane n -+ -+ rsr a0, depc -+ rotw -\n -+ -+ xsr a3, excsave1 -+ wsr a2, depc -+ l32i a2, a3, EXC_TABLE_KSTK -+ s32i a0, a2, PT_AREG0 -+ -+ movi a0, .Lrestore_\n -+ s32i a0, a2, PT_DEPC -+ rsr a0, exccause -+ j _DoubleExceptionVector_handle_exception -+ -+ .endm -+ -+ overflow_fixup_handle_exception_pane 2 -+.Lhandle_1: -+ overflow_fixup_handle_exception_pane 1 -+.Lhandle_3: -+ overflow_fixup_handle_exception_pane 3 -+ -+ .macro overflow_fixup_restore_a0_pane n -+ -+ rotw \n -+ /* Need to preserve a0 value here to be able to handle exception -+ * that may occur on a0 reload from stack. It may occur because -+ * TLB miss handler may not be atomic and pointer to page table -+ * may be lost before we get here. There are no free registers, -+ * so we need to use EXC_TABLE_DOUBLE_SAVE area. -+ */ -+ xsr a3, excsave1 -+ s32i a2, a3, EXC_TABLE_DOUBLE_SAVE -+ movi a2, window_overflow_restore_a0_fixup -+ s32i a2, a3, EXC_TABLE_FIXUP -+ l32i a2, a3, EXC_TABLE_DOUBLE_SAVE -+ xsr a3, excsave1 -+ bbsi.l a0, 7, 1f -+ l32e a0, a9, -16 -+ j 2f -+1: -+ l32e a0, a13, -16 -+2: -+ rotw -\n -+ -+ .endm -+ -+.Lrestore_2: -+ overflow_fixup_restore_a0_pane 2 -+ -+.Lset_default_fixup: -+ xsr a3, excsave1 -+ s32i a2, a3, EXC_TABLE_DOUBLE_SAVE -+ movi a2, 0 -+ s32i a2, a3, EXC_TABLE_FIXUP -+ l32i a2, a3, EXC_TABLE_DOUBLE_SAVE -+ xsr a3, excsave1 -+ rfe -+ -+.Lrestore_1: -+ overflow_fixup_restore_a0_pane 1 -+ j .Lset_default_fixup -+.Lrestore_3: -+ overflow_fixup_restore_a0_pane 3 -+ j .Lset_default_fixup -+ -+ENDPROC(window_overflow_restore_a0_fixup) -+ -+ .end literal_prefix -+/* - * Debug interrupt vector - * - * There is not much space here, so simply jump to another handler. -diff --git a/arch/xtensa/kernel/vmlinux.lds.S b/arch/xtensa/kernel/vmlinux.lds.S -index ee32c0085dff..d16db6df86f8 100644 ---- a/arch/xtensa/kernel/vmlinux.lds.S -+++ b/arch/xtensa/kernel/vmlinux.lds.S -@@ -269,13 +269,13 @@ SECTIONS - .UserExceptionVector.literal) - SECTION_VECTOR (_DoubleExceptionVector_literal, - .DoubleExceptionVector.literal, -- DOUBLEEXC_VECTOR_VADDR - 16, -+ DOUBLEEXC_VECTOR_VADDR - 40, - SIZEOF(.UserExceptionVector.text), - .UserExceptionVector.text) - SECTION_VECTOR (_DoubleExceptionVector_text, - .DoubleExceptionVector.text, - DOUBLEEXC_VECTOR_VADDR, -- 32, -+ 40, - .DoubleExceptionVector.literal) - - . = (LOADADDR( .DoubleExceptionVector.text ) + SIZEOF( .DoubleExceptionVector.text ) + 3) & ~ 3; -diff --git a/crypto/af_alg.c b/crypto/af_alg.c -index 966f893711b3..6a3ad8011585 100644 ---- a/crypto/af_alg.c -+++ b/crypto/af_alg.c -@@ -21,6 +21,7 @@ - #include <linux/module.h> - #include <linux/net.h> - #include <linux/rwsem.h> -+#include <linux/security.h> - - struct alg_type_list { - const struct af_alg_type *type; -@@ -243,6 +244,7 @@ int af_alg_accept(struct sock *sk, struct socket *newsock) - - sock_init_data(newsock, sk2); - sock_graft(sk2, newsock); -+ security_sk_clone(sk, sk2); - - err = type->accept(ask->private, sk2); - if (err) { -diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c -index 199b52b7c3e1..153f4b92cc05 100644 ---- a/drivers/cpufreq/cpufreq.c -+++ b/drivers/cpufreq/cpufreq.c -@@ -1089,10 +1089,12 @@ static int __cpufreq_add_dev(struct device *dev, struct subsys_interface *sif, - * the creation of a brand new one. So we need to perform this update - * by invoking update_policy_cpu(). - */ -- if (frozen && cpu != policy->cpu) -+ if (frozen && cpu != policy->cpu) { - update_policy_cpu(policy, cpu); -- else -+ WARN_ON(kobject_move(&policy->kobj, &dev->kobj)); -+ } else { - policy->cpu = cpu; -+ } - - policy->governor = CPUFREQ_DEFAULT_GOVERNOR; - cpumask_copy(policy->cpus, cpumask_of(cpu)); -diff --git a/drivers/iio/accel/bma180.c b/drivers/iio/accel/bma180.c -index bfec313492b3..fe83d04784c8 100644 ---- a/drivers/iio/accel/bma180.c -+++ b/drivers/iio/accel/bma180.c -@@ -68,13 +68,13 @@ - /* Defaults values */ - #define BMA180_DEF_PMODE 0 - #define BMA180_DEF_BW 20 --#define BMA180_DEF_SCALE 250 -+#define BMA180_DEF_SCALE 2452 - - /* Available values for sysfs */ - #define BMA180_FLP_FREQ_AVAILABLE \ - "10 20 40 75 150 300" - #define BMA180_SCALE_AVAILABLE \ -- "0.000130 0.000190 0.000250 0.000380 0.000500 0.000990 0.001980" -+ "0.001275 0.001863 0.002452 0.003727 0.004903 0.009709 0.019417" - - struct bma180_data { - struct i2c_client *client; -@@ -94,7 +94,7 @@ enum bma180_axis { - }; - - static int bw_table[] = { 10, 20, 40, 75, 150, 300 }; /* Hz */ --static int scale_table[] = { 130, 190, 250, 380, 500, 990, 1980 }; -+static int scale_table[] = { 1275, 1863, 2452, 3727, 4903, 9709, 19417 }; - - static int bma180_get_acc_reg(struct bma180_data *data, enum bma180_axis axis) - { -@@ -376,6 +376,8 @@ static int bma180_write_raw(struct iio_dev *indio_dev, - mutex_unlock(&data->mutex); - return ret; - case IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY: -+ if (val2) -+ return -EINVAL; - mutex_lock(&data->mutex); - ret = bma180_set_bw(data, val); - mutex_unlock(&data->mutex); -diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c -index fe25042f056a..0f1d9b2ccdfa 100644 ---- a/drivers/iio/industrialio-buffer.c -+++ b/drivers/iio/industrialio-buffer.c -@@ -953,7 +953,7 @@ static int iio_buffer_update_demux(struct iio_dev *indio_dev, - - /* Now we have the two masks, work from least sig and build up sizes */ - for_each_set_bit(out_ind, -- indio_dev->active_scan_mask, -+ buffer->scan_mask, - indio_dev->masklength) { - in_ind = find_next_bit(indio_dev->active_scan_mask, - indio_dev->masklength, -diff --git a/drivers/md/dm-bufio.c b/drivers/md/dm-bufio.c -index 66c5d130c8c2..0e722c103562 100644 ---- a/drivers/md/dm-bufio.c -+++ b/drivers/md/dm-bufio.c -@@ -1541,7 +1541,7 @@ struct dm_bufio_client *dm_bufio_client_create(struct block_device *bdev, unsign - BUG_ON(block_size < 1 << SECTOR_SHIFT || - (block_size & (block_size - 1))); - -- c = kmalloc(sizeof(*c), GFP_KERNEL); -+ c = kzalloc(sizeof(*c), GFP_KERNEL); - if (!c) { - r = -ENOMEM; - goto bad_client; -diff --git a/drivers/md/dm-cache-target.c b/drivers/md/dm-cache-target.c -index c0ad90d91252..735e939a846d 100644 ---- a/drivers/md/dm-cache-target.c -+++ b/drivers/md/dm-cache-target.c -@@ -231,7 +231,7 @@ struct cache { - /* - * cache_size entries, dirty if set - */ -- dm_cblock_t nr_dirty; -+ atomic_t nr_dirty; - unsigned long *dirty_bitset; - - /* -@@ -493,7 +493,7 @@ static bool is_dirty(struct cache *cache, dm_cblock_t b) - static void set_dirty(struct cache *cache, dm_oblock_t oblock, dm_cblock_t cblock) - { - if (!test_and_set_bit(from_cblock(cblock), cache->dirty_bitset)) { -- cache->nr_dirty = to_cblock(from_cblock(cache->nr_dirty) + 1); -+ atomic_inc(&cache->nr_dirty); - policy_set_dirty(cache->policy, oblock); - } - } -@@ -502,8 +502,7 @@ static void clear_dirty(struct cache *cache, dm_oblock_t oblock, dm_cblock_t cbl - { - if (test_and_clear_bit(from_cblock(cblock), cache->dirty_bitset)) { - policy_clear_dirty(cache->policy, oblock); -- cache->nr_dirty = to_cblock(from_cblock(cache->nr_dirty) - 1); -- if (!from_cblock(cache->nr_dirty)) -+ if (atomic_dec_return(&cache->nr_dirty) == 0) - dm_table_event(cache->ti->table); - } - } -@@ -2286,7 +2285,7 @@ static int cache_create(struct cache_args *ca, struct cache **result) - atomic_set(&cache->quiescing_ack, 0); - - r = -ENOMEM; -- cache->nr_dirty = 0; -+ atomic_set(&cache->nr_dirty, 0); - cache->dirty_bitset = alloc_bitset(from_cblock(cache->cache_size)); - if (!cache->dirty_bitset) { - *error = "could not allocate dirty bitset"; -@@ -2828,7 +2827,7 @@ static void cache_status(struct dm_target *ti, status_type_t type, - - residency = policy_residency(cache->policy); - -- DMEMIT("%u %llu/%llu %u %llu/%llu %u %u %u %u %u %u %llu ", -+ DMEMIT("%u %llu/%llu %u %llu/%llu %u %u %u %u %u %u %lu ", - (unsigned)(DM_CACHE_METADATA_BLOCK_SIZE >> SECTOR_SHIFT), - (unsigned long long)(nr_blocks_metadata - nr_free_blocks_metadata), - (unsigned long long)nr_blocks_metadata, -@@ -2841,7 +2840,7 @@ static void cache_status(struct dm_target *ti, status_type_t type, - (unsigned) atomic_read(&cache->stats.write_miss), - (unsigned) atomic_read(&cache->stats.demotion), - (unsigned) atomic_read(&cache->stats.promotion), -- (unsigned long long) from_cblock(cache->nr_dirty)); -+ (unsigned long) atomic_read(&cache->nr_dirty)); - - if (writethrough_mode(&cache->features)) - DMEMIT("1 writethrough "); -diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c -index 0526ddff977d..0fe7674ad100 100644 ---- a/drivers/net/wireless/ath/ath9k/xmit.c -+++ b/drivers/net/wireless/ath/ath9k/xmit.c -@@ -890,6 +890,15 @@ ath_tx_get_tid_subframe(struct ath_softc *sc, struct ath_txq *txq, - - tx_info = IEEE80211_SKB_CB(skb); - tx_info->flags &= ~IEEE80211_TX_CTL_CLEAR_PS_FILT; -+ -+ /* -+ * No aggregation session is running, but there may be frames -+ * from a previous session or a failed attempt in the queue. -+ * Send them out as normal data frames -+ */ -+ if (!tid->active) -+ tx_info->flags &= ~IEEE80211_TX_CTL_AMPDU; -+ - if (!(tx_info->flags & IEEE80211_TX_CTL_AMPDU)) { - bf->bf_state.bf_type = 0; - return bf; -diff --git a/drivers/pnp/pnpacpi/core.c b/drivers/pnp/pnpacpi/core.c -index c31aa07b3ba5..da1c6cb1a41e 100644 ---- a/drivers/pnp/pnpacpi/core.c -+++ b/drivers/pnp/pnpacpi/core.c -@@ -339,8 +339,7 @@ static int __init acpi_pnp_match(struct device *dev, void *_pnp) - struct pnp_dev *pnp = _pnp; - - /* true means it matched */ -- return !acpi->physical_node_count -- && compare_pnp_id(pnp->id, acpi_device_hid(acpi)); -+ return pnp->data == acpi; - } - - static struct acpi_device * __init acpi_pnp_find_companion(struct device *dev) -diff --git a/drivers/rapidio/devices/tsi721_dma.c b/drivers/rapidio/devices/tsi721_dma.c -index 91245f5dbe81..47257b6eea84 100644 ---- a/drivers/rapidio/devices/tsi721_dma.c -+++ b/drivers/rapidio/devices/tsi721_dma.c -@@ -287,6 +287,12 @@ struct tsi721_tx_desc *tsi721_desc_get(struct tsi721_bdma_chan *bdma_chan) - "desc %p not ACKed\n", tx_desc); - } - -+ if (ret == NULL) { -+ dev_dbg(bdma_chan->dchan.device->dev, -+ "%s: unable to obtain tx descriptor\n", __func__); -+ goto err_out; -+ } -+ - i = bdma_chan->wr_count_next % bdma_chan->bd_num; - if (i == bdma_chan->bd_num - 1) { - i = 0; -@@ -297,7 +303,7 @@ struct tsi721_tx_desc *tsi721_desc_get(struct tsi721_bdma_chan *bdma_chan) - tx_desc->txd.phys = bdma_chan->bd_phys + - i * sizeof(struct tsi721_dma_desc); - tx_desc->hw_desc = &((struct tsi721_dma_desc *)bdma_chan->bd_base)[i]; -- -+err_out: - spin_unlock_bh(&bdma_chan->lock); - - return ret; -diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c -index 62ec84b42e31..64e487a8bf59 100644 ---- a/drivers/scsi/scsi_lib.c -+++ b/drivers/scsi/scsi_lib.c -@@ -831,6 +831,14 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes) - scsi_next_command(cmd); - return; - } -+ } else if (blk_rq_bytes(req) == 0 && result && !sense_deferred) { -+ /* -+ * Certain non BLOCK_PC requests are commands that don't -+ * actually transfer anything (FLUSH), so cannot use -+ * good_bytes != blk_rq_bytes(req) as the signal for an error. -+ * This sets the error explicitly for the problem case. -+ */ -+ error = __scsi_error_from_host_byte(cmd, result); - } - - /* no bidi support for !REQ_TYPE_BLOCK_PC yet */ -diff --git a/drivers/staging/vt6655/bssdb.c b/drivers/staging/vt6655/bssdb.c -index d7efd0173a9a..7d7578872a84 100644 ---- a/drivers/staging/vt6655/bssdb.c -+++ b/drivers/staging/vt6655/bssdb.c -@@ -983,7 +983,7 @@ start: - pDevice->byERPFlag &= ~(WLAN_SET_ERP_USE_PROTECTION(1)); - } - -- { -+ if (pDevice->eCommandState == WLAN_ASSOCIATE_WAIT) { - pDevice->byReAssocCount++; - /* 10 sec timeout */ - if ((pDevice->byReAssocCount > 10) && (!pDevice->bLinkPass)) { -diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c -index a952df1bf9d6..6f13f0e597f8 100644 ---- a/drivers/staging/vt6655/device_main.c -+++ b/drivers/staging/vt6655/device_main.c -@@ -2430,6 +2430,7 @@ static irqreturn_t device_intr(int irq, void *dev_instance) { - int handled = 0; - unsigned char byData = 0; - int ii = 0; -+ unsigned long flags; - // unsigned char byRSSI; - - MACvReadISR(pDevice->PortOffset, &pDevice->dwIsr); -@@ -2455,7 +2456,8 @@ static irqreturn_t device_intr(int irq, void *dev_instance) { - - handled = 1; - MACvIntDisable(pDevice->PortOffset); -- spin_lock_irq(&pDevice->lock); -+ -+ spin_lock_irqsave(&pDevice->lock, flags); - - //Make sure current page is 0 - VNSvInPortB(pDevice->PortOffset + MAC_REG_PAGE1SEL, &byOrgPageSel); -@@ -2696,7 +2698,8 @@ static irqreturn_t device_intr(int irq, void *dev_instance) { - MACvSelectPage1(pDevice->PortOffset); - } - -- spin_unlock_irq(&pDevice->lock); -+ spin_unlock_irqrestore(&pDevice->lock, flags); -+ - MACvIntEnable(pDevice->PortOffset, IMR_MASK_VALUE); - - return IRQ_RETVAL(handled); -diff --git a/include/dt-bindings/pinctrl/dra.h b/include/dt-bindings/pinctrl/dra.h -index 002a2855c046..3d33794e4f3e 100644 ---- a/include/dt-bindings/pinctrl/dra.h -+++ b/include/dt-bindings/pinctrl/dra.h -@@ -30,7 +30,8 @@ - #define MUX_MODE14 0xe - #define MUX_MODE15 0xf - --#define PULL_ENA (1 << 16) -+#define PULL_ENA (0 << 16) -+#define PULL_DIS (1 << 16) - #define PULL_UP (1 << 17) - #define INPUT_EN (1 << 18) - #define SLEWCONTROL (1 << 19) -@@ -38,10 +39,10 @@ - #define WAKEUP_EVENT (1 << 25) - - /* Active pin states */ --#define PIN_OUTPUT 0 -+#define PIN_OUTPUT (0 | PULL_DIS) - #define PIN_OUTPUT_PULLUP (PIN_OUTPUT | PULL_ENA | PULL_UP) - #define PIN_OUTPUT_PULLDOWN (PIN_OUTPUT | PULL_ENA) --#define PIN_INPUT INPUT_EN -+#define PIN_INPUT (INPUT_EN | PULL_DIS) - #define PIN_INPUT_SLEW (INPUT_EN | SLEWCONTROL) - #define PIN_INPUT_PULLUP (PULL_ENA | INPUT_EN | PULL_UP) - #define PIN_INPUT_PULLDOWN (PULL_ENA | INPUT_EN) -diff --git a/include/linux/printk.h b/include/linux/printk.h -index fa47e2708c01..cbf094f993f4 100644 ---- a/include/linux/printk.h -+++ b/include/linux/printk.h -@@ -132,9 +132,9 @@ asmlinkage __printf(1, 2) __cold - int printk(const char *fmt, ...); - - /* -- * Special printk facility for scheduler use only, _DO_NOT_USE_ ! -+ * Special printk facility for scheduler/timekeeping use only, _DO_NOT_USE_ ! - */ --__printf(1, 2) __cold int printk_sched(const char *fmt, ...); -+__printf(1, 2) __cold int printk_deferred(const char *fmt, ...); - - /* - * Please don't use printk_ratelimit(), because it shares ratelimiting state -@@ -169,7 +169,7 @@ int printk(const char *s, ...) - return 0; - } - static inline __printf(1, 2) __cold --int printk_sched(const char *s, ...) -+int printk_deferred(const char *s, ...) - { - return 0; - } -diff --git a/init/main.c b/init/main.c -index 9c7fd4c9249f..58c132d7de4b 100644 ---- a/init/main.c -+++ b/init/main.c -@@ -617,6 +617,10 @@ asmlinkage void __init start_kernel(void) - if (efi_enabled(EFI_RUNTIME_SERVICES)) - efi_enter_virtual_mode(); - #endif -+#ifdef CONFIG_X86_ESPFIX64 -+ /* Should be run before the first non-init thread is created */ -+ init_espfix_bsp(); -+#endif - thread_info_cache_init(); - cred_init(); - fork_init(totalram_pages); -diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c -index 4dae9cbe9259..8c086e6049b9 100644 ---- a/kernel/printk/printk.c -+++ b/kernel/printk/printk.c -@@ -2468,7 +2468,7 @@ void wake_up_klogd(void) - preempt_enable(); - } - --int printk_sched(const char *fmt, ...) -+int printk_deferred(const char *fmt, ...) - { - unsigned long flags; - va_list args; -diff --git a/kernel/sched/core.c b/kernel/sched/core.c -index 0aae0fcec026..515e212421c0 100644 ---- a/kernel/sched/core.c -+++ b/kernel/sched/core.c -@@ -1322,7 +1322,7 @@ out: - * leave kernel. - */ - if (p->mm && printk_ratelimit()) { -- printk_sched("process %d (%s) no longer affine to cpu%d\n", -+ printk_deferred("process %d (%s) no longer affine to cpu%d\n", - task_pid_nr(p), p->comm, cpu); - } - } -diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c -index ce852643854b..37dac98c0749 100644 ---- a/kernel/sched/deadline.c -+++ b/kernel/sched/deadline.c -@@ -329,7 +329,7 @@ static void replenish_dl_entity(struct sched_dl_entity *dl_se, - - if (!lag_once) { - lag_once = true; -- printk_sched("sched: DL replenish lagged to much\n"); -+ printk_deferred("sched: DL replenish lagged to much\n"); - } - dl_se->deadline = rq_clock(rq) + pi_se->dl_deadline; - dl_se->runtime = pi_se->dl_runtime; -diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c -index 1999021042c7..27b8e836307f 100644 ---- a/kernel/sched/rt.c -+++ b/kernel/sched/rt.c -@@ -837,7 +837,7 @@ static int sched_rt_runtime_exceeded(struct rt_rq *rt_rq) - - if (!once) { - once = true; -- printk_sched("sched: RT throttling activated\n"); -+ printk_deferred("sched: RT throttling activated\n"); - } - } else { - /* -diff --git a/kernel/time/clockevents.c b/kernel/time/clockevents.c -index 086ad6043bcb..60ba1af801c3 100644 ---- a/kernel/time/clockevents.c -+++ b/kernel/time/clockevents.c -@@ -146,7 +146,8 @@ static int clockevents_increase_min_delta(struct clock_event_device *dev) - { - /* Nothing to do if we already reached the limit */ - if (dev->min_delta_ns >= MIN_DELTA_LIMIT) { -- printk(KERN_WARNING "CE: Reprogramming failure. Giving up\n"); -+ printk_deferred(KERN_WARNING -+ "CE: Reprogramming failure. Giving up\n"); - dev->next_event.tv64 = KTIME_MAX; - return -ETIME; - } -@@ -159,9 +160,10 @@ static int clockevents_increase_min_delta(struct clock_event_device *dev) - if (dev->min_delta_ns > MIN_DELTA_LIMIT) - dev->min_delta_ns = MIN_DELTA_LIMIT; - -- printk(KERN_WARNING "CE: %s increased min_delta_ns to %llu nsec\n", -- dev->name ? dev->name : "?", -- (unsigned long long) dev->min_delta_ns); -+ printk_deferred(KERN_WARNING -+ "CE: %s increased min_delta_ns to %llu nsec\n", -+ dev->name ? dev->name : "?", -+ (unsigned long long) dev->min_delta_ns); - return 0; - } - -diff --git a/kernel/time/sched_clock.c b/kernel/time/sched_clock.c -index 4d23dc4d8139..313a662911b1 100644 ---- a/kernel/time/sched_clock.c -+++ b/kernel/time/sched_clock.c -@@ -204,7 +204,8 @@ void __init sched_clock_postinit(void) - - static int sched_clock_suspend(void) - { -- sched_clock_poll(&sched_clock_timer); -+ update_sched_clock(); -+ hrtimer_cancel(&sched_clock_timer); - cd.suspended = true; - return 0; - } -@@ -212,6 +213,7 @@ static int sched_clock_suspend(void) - static void sched_clock_resume(void) - { - cd.epoch_cyc = read_sched_clock(); -+ hrtimer_start(&sched_clock_timer, cd.wrap_kt, HRTIMER_MODE_REL); - cd.suspended = false; - } - -diff --git a/lib/btree.c b/lib/btree.c -index f9a484676cb6..4264871ea1a0 100644 ---- a/lib/btree.c -+++ b/lib/btree.c -@@ -198,6 +198,7 @@ EXPORT_SYMBOL_GPL(btree_init); - - void btree_destroy(struct btree_head *head) - { -+ mempool_free(head->node, head->mempool); - mempool_destroy(head->mempool); - head->mempool = NULL; - } -diff --git a/mm/memcontrol.c b/mm/memcontrol.c -index 5b6b0039f725..9b35da28b587 100644 ---- a/mm/memcontrol.c -+++ b/mm/memcontrol.c -@@ -5670,8 +5670,12 @@ static int mem_cgroup_oom_notify_cb(struct mem_cgroup *memcg) - { - struct mem_cgroup_eventfd_list *ev; - -+ spin_lock(&memcg_oom_lock); -+ - list_for_each_entry(ev, &memcg->oom_notify, list) - eventfd_signal(ev->eventfd, 1); -+ -+ spin_unlock(&memcg_oom_lock); - return 0; - } - -diff --git a/mm/page-writeback.c b/mm/page-writeback.c -index d013dba21429..9f45f87a5859 100644 ---- a/mm/page-writeback.c -+++ b/mm/page-writeback.c -@@ -1324,9 +1324,9 @@ static inline void bdi_dirty_limits(struct backing_dev_info *bdi, - *bdi_thresh = bdi_dirty_limit(bdi, dirty_thresh); - - if (bdi_bg_thresh) -- *bdi_bg_thresh = div_u64((u64)*bdi_thresh * -- background_thresh, -- dirty_thresh); -+ *bdi_bg_thresh = dirty_thresh ? div_u64((u64)*bdi_thresh * -+ background_thresh, -+ dirty_thresh) : 0; - - /* - * In order to avoid the stacked BDI deadlock we need -diff --git a/mm/page_alloc.c b/mm/page_alloc.c -index 7e7f94755ab5..62e400d00e3f 100644 ---- a/mm/page_alloc.c -+++ b/mm/page_alloc.c -@@ -2434,7 +2434,7 @@ static inline int - gfp_to_alloc_flags(gfp_t gfp_mask) - { - int alloc_flags = ALLOC_WMARK_MIN | ALLOC_CPUSET; -- const gfp_t wait = gfp_mask & __GFP_WAIT; -+ const bool atomic = !(gfp_mask & (__GFP_WAIT | __GFP_NO_KSWAPD)); - - /* __GFP_HIGH is assumed to be the same as ALLOC_HIGH to save a branch. */ - BUILD_BUG_ON(__GFP_HIGH != (__force gfp_t) ALLOC_HIGH); -@@ -2443,20 +2443,20 @@ gfp_to_alloc_flags(gfp_t gfp_mask) - * The caller may dip into page reserves a bit more if the caller - * cannot run direct reclaim, or if the caller has realtime scheduling - * policy or is asking for __GFP_HIGH memory. GFP_ATOMIC requests will -- * set both ALLOC_HARDER (!wait) and ALLOC_HIGH (__GFP_HIGH). -+ * set both ALLOC_HARDER (atomic == true) and ALLOC_HIGH (__GFP_HIGH). - */ - alloc_flags |= (__force int) (gfp_mask & __GFP_HIGH); - -- if (!wait) { -+ if (atomic) { - /* -- * Not worth trying to allocate harder for -- * __GFP_NOMEMALLOC even if it can't schedule. -+ * Not worth trying to allocate harder for __GFP_NOMEMALLOC even -+ * if it can't schedule. - */ -- if (!(gfp_mask & __GFP_NOMEMALLOC)) -+ if (!(gfp_mask & __GFP_NOMEMALLOC)) - alloc_flags |= ALLOC_HARDER; - /* -- * Ignore cpuset if GFP_ATOMIC (!wait) rather than fail alloc. -- * See also cpuset_zone_allowed() comment in kernel/cpuset.c. -+ * Ignore cpuset mems for GFP_ATOMIC rather than fail, see the -+ * comment for __cpuset_node_allowed_softwall(). - */ - alloc_flags &= ~ALLOC_CPUSET; - } else if (unlikely(rt_task(current)) && !in_interrupt()) -diff --git a/net/l2tp/l2tp_ppp.c b/net/l2tp/l2tp_ppp.c -index ec6606325cda..1e05bbde47ba 100644 ---- a/net/l2tp/l2tp_ppp.c -+++ b/net/l2tp/l2tp_ppp.c -@@ -1368,7 +1368,7 @@ static int pppol2tp_setsockopt(struct socket *sock, int level, int optname, - int err; - - if (level != SOL_PPPOL2TP) -- return udp_prot.setsockopt(sk, level, optname, optval, optlen); -+ return -EINVAL; - - if (optlen < sizeof(int)) - return -EINVAL; -@@ -1494,7 +1494,7 @@ static int pppol2tp_getsockopt(struct socket *sock, int level, int optname, - struct pppol2tp_session *ps; - - if (level != SOL_PPPOL2TP) -- return udp_prot.getsockopt(sk, level, optname, optval, optlen); -+ return -EINVAL; - - if (get_user(len, optlen)) - return -EFAULT; -diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c -index c14c16a6d62d..e5a7ac2f3687 100644 ---- a/net/mac80211/tx.c -+++ b/net/mac80211/tx.c -@@ -414,6 +414,9 @@ ieee80211_tx_h_multicast_ps_buf(struct ieee80211_tx_data *tx) - if (ieee80211_has_order(hdr->frame_control)) - return TX_CONTINUE; - -+ if (ieee80211_is_probe_req(hdr->frame_control)) -+ return TX_CONTINUE; -+ - if (tx->local->hw.flags & IEEE80211_HW_QUEUE_CONTROL) - info->hw_queue = tx->sdata->vif.cab_queue; - -@@ -464,6 +467,7 @@ ieee80211_tx_h_unicast_ps_buf(struct ieee80211_tx_data *tx) - { - struct sta_info *sta = tx->sta; - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb); -+ struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data; - struct ieee80211_local *local = tx->local; - - if (unlikely(!sta)) -@@ -474,6 +478,15 @@ ieee80211_tx_h_unicast_ps_buf(struct ieee80211_tx_data *tx) - !(info->flags & IEEE80211_TX_CTL_NO_PS_BUFFER))) { - int ac = skb_get_queue_mapping(tx->skb); - -+ /* only deauth, disassoc and action are bufferable MMPDUs */ -+ if (ieee80211_is_mgmt(hdr->frame_control) && -+ !ieee80211_is_deauth(hdr->frame_control) && -+ !ieee80211_is_disassoc(hdr->frame_control) && -+ !ieee80211_is_action(hdr->frame_control)) { -+ info->flags |= IEEE80211_TX_CTL_NO_PS_BUFFER; -+ return TX_CONTINUE; -+ } -+ - ps_dbg(sta->sdata, "STA %pM aid %d: PS buffer for AC %d\n", - sta->sta.addr, sta->sta.aid, ac); - if (tx->local->total_ps_buffered >= TOTAL_MAX_TX_BUFFER) -@@ -532,22 +545,8 @@ ieee80211_tx_h_unicast_ps_buf(struct ieee80211_tx_data *tx) - static ieee80211_tx_result debug_noinline - ieee80211_tx_h_ps_buf(struct ieee80211_tx_data *tx) - { -- struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb); -- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data; -- - if (unlikely(tx->flags & IEEE80211_TX_PS_BUFFERED)) - return TX_CONTINUE; -- -- /* only deauth, disassoc and action are bufferable MMPDUs */ -- if (ieee80211_is_mgmt(hdr->frame_control) && -- !ieee80211_is_deauth(hdr->frame_control) && -- !ieee80211_is_disassoc(hdr->frame_control) && -- !ieee80211_is_action(hdr->frame_control)) { -- if (tx->flags & IEEE80211_TX_UNICAST) -- info->flags |= IEEE80211_TX_CTL_NO_PS_BUFFER; -- return TX_CONTINUE; -- } -- - if (tx->flags & IEEE80211_TX_UNICAST) - return ieee80211_tx_h_unicast_ps_buf(tx); - else -diff --git a/net/wireless/trace.h b/net/wireless/trace.h -index fbcc23edee54..b89eb3990f0a 100644 ---- a/net/wireless/trace.h -+++ b/net/wireless/trace.h -@@ -2068,7 +2068,8 @@ TRACE_EVENT(cfg80211_michael_mic_failure, - MAC_ASSIGN(addr, addr); - __entry->key_type = key_type; - __entry->key_id = key_id; -- memcpy(__entry->tsc, tsc, 6); -+ if (tsc) -+ memcpy(__entry->tsc, tsc, 6); - ), - TP_printk(NETDEV_PR_FMT ", " MAC_PR_FMT ", key type: %d, key id: %d, tsc: %pm", - NETDEV_PR_ARG, MAC_PR_ARG(addr), __entry->key_type, diff --git a/projects/imx6/patches/linux/linux-000-patch-3.14.16-17.patch b/projects/imx6/patches/linux/linux-000-patch-3.14.16-17.patch deleted file mode 100644 index 19c672077f9..00000000000 --- a/projects/imx6/patches/linux/linux-000-patch-3.14.16-17.patch +++ /dev/null @@ -1,1765 +0,0 @@ -diff --git a/Makefile b/Makefile -index 8b22e24a2d8e..12aac0325888 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,6 +1,6 @@ - VERSION = 3 - PATCHLEVEL = 14 --SUBLEVEL = 16 -+SUBLEVEL = 17 - EXTRAVERSION = - NAME = Remembering Coco - -diff --git a/arch/sparc/include/asm/pgtable_64.h b/arch/sparc/include/asm/pgtable_64.h -index 0f9e94537eee..1a49ffdf9da9 100644 ---- a/arch/sparc/include/asm/pgtable_64.h -+++ b/arch/sparc/include/asm/pgtable_64.h -@@ -24,7 +24,8 @@ - - /* The kernel image occupies 0x4000000 to 0x6000000 (4MB --> 96MB). - * The page copy blockops can use 0x6000000 to 0x8000000. -- * The TSB is mapped in the 0x8000000 to 0xa000000 range. -+ * The 8K TSB is mapped in the 0x8000000 to 0x8400000 range. -+ * The 4M TSB is mapped in the 0x8400000 to 0x8800000 range. - * The PROM resides in an area spanning 0xf0000000 to 0x100000000. - * The vmalloc area spans 0x100000000 to 0x200000000. - * Since modules need to be in the lowest 32-bits of the address space, -@@ -33,7 +34,8 @@ - * 0x400000000. - */ - #define TLBTEMP_BASE _AC(0x0000000006000000,UL) --#define TSBMAP_BASE _AC(0x0000000008000000,UL) -+#define TSBMAP_8K_BASE _AC(0x0000000008000000,UL) -+#define TSBMAP_4M_BASE _AC(0x0000000008400000,UL) - #define MODULES_VADDR _AC(0x0000000010000000,UL) - #define MODULES_LEN _AC(0x00000000e0000000,UL) - #define MODULES_END _AC(0x00000000f0000000,UL) -@@ -71,6 +73,23 @@ - - #include <linux/sched.h> - -+extern unsigned long sparc64_valid_addr_bitmap[]; -+ -+/* Needs to be defined here and not in linux/mm.h, as it is arch dependent */ -+static inline bool __kern_addr_valid(unsigned long paddr) -+{ -+ if ((paddr >> MAX_PHYS_ADDRESS_BITS) != 0UL) -+ return false; -+ return test_bit(paddr >> ILOG2_4MB, sparc64_valid_addr_bitmap); -+} -+ -+static inline bool kern_addr_valid(unsigned long addr) -+{ -+ unsigned long paddr = __pa(addr); -+ -+ return __kern_addr_valid(paddr); -+} -+ - /* Entries per page directory level. */ - #define PTRS_PER_PTE (1UL << (PAGE_SHIFT-3)) - #define PTRS_PER_PMD (1UL << PMD_BITS) -@@ -79,9 +98,12 @@ - /* Kernel has a separate 44bit address space. */ - #define FIRST_USER_ADDRESS 0 - --#define pte_ERROR(e) __builtin_trap() --#define pmd_ERROR(e) __builtin_trap() --#define pgd_ERROR(e) __builtin_trap() -+#define pmd_ERROR(e) \ -+ pr_err("%s:%d: bad pmd %p(%016lx) seen at (%pS)\n", \ -+ __FILE__, __LINE__, &(e), pmd_val(e), __builtin_return_address(0)) -+#define pgd_ERROR(e) \ -+ pr_err("%s:%d: bad pgd %p(%016lx) seen at (%pS)\n", \ -+ __FILE__, __LINE__, &(e), pgd_val(e), __builtin_return_address(0)) - - #endif /* !(__ASSEMBLY__) */ - -@@ -258,8 +280,8 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t prot) - { - unsigned long mask, tmp; - -- /* SUN4U: 0x600307ffffffecb8 (negated == 0x9ffcf80000001347) -- * SUN4V: 0x30ffffffffffee17 (negated == 0xcf000000000011e8) -+ /* SUN4U: 0x630107ffffffec38 (negated == 0x9cfef800000013c7) -+ * SUN4V: 0x33ffffffffffee07 (negated == 0xcc000000000011f8) - * - * Even if we use negation tricks the result is still a 6 - * instruction sequence, so don't try to play fancy and just -@@ -289,10 +311,10 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t prot) - " .previous\n" - : "=r" (mask), "=r" (tmp) - : "i" (_PAGE_PADDR_4U | _PAGE_MODIFIED_4U | _PAGE_ACCESSED_4U | -- _PAGE_CP_4U | _PAGE_CV_4U | _PAGE_E_4U | _PAGE_PRESENT_4U | -+ _PAGE_CP_4U | _PAGE_CV_4U | _PAGE_E_4U | - _PAGE_SPECIAL | _PAGE_PMD_HUGE | _PAGE_SZALL_4U), - "i" (_PAGE_PADDR_4V | _PAGE_MODIFIED_4V | _PAGE_ACCESSED_4V | -- _PAGE_CP_4V | _PAGE_CV_4V | _PAGE_E_4V | _PAGE_PRESENT_4V | -+ _PAGE_CP_4V | _PAGE_CV_4V | _PAGE_E_4V | - _PAGE_SPECIAL | _PAGE_PMD_HUGE | _PAGE_SZALL_4V)); - - return __pte((pte_val(pte) & mask) | (pgprot_val(prot) & ~mask)); -@@ -633,7 +655,7 @@ static inline unsigned long pmd_large(pmd_t pmd) - { - pte_t pte = __pte(pmd_val(pmd)); - -- return (pte_val(pte) & _PAGE_PMD_HUGE) && pte_present(pte); -+ return pte_val(pte) & _PAGE_PMD_HUGE; - } - - #ifdef CONFIG_TRANSPARENT_HUGEPAGE -@@ -719,20 +741,6 @@ static inline pmd_t pmd_mkwrite(pmd_t pmd) - return __pmd(pte_val(pte)); - } - --static inline pmd_t pmd_mknotpresent(pmd_t pmd) --{ -- unsigned long mask; -- -- if (tlb_type == hypervisor) -- mask = _PAGE_PRESENT_4V; -- else -- mask = _PAGE_PRESENT_4U; -- -- pmd_val(pmd) &= ~mask; -- -- return pmd; --} -- - static inline pmd_t pmd_mksplitting(pmd_t pmd) - { - pte_t pte = __pte(pmd_val(pmd)); -@@ -757,6 +765,20 @@ static inline int pmd_present(pmd_t pmd) - - #define pmd_none(pmd) (!pmd_val(pmd)) - -+/* pmd_bad() is only called on non-trans-huge PMDs. Our encoding is -+ * very simple, it's just the physical address. PTE tables are of -+ * size PAGE_SIZE so make sure the sub-PAGE_SIZE bits are clear and -+ * the top bits outside of the range of any physical address size we -+ * support are clear as well. We also validate the physical itself. -+ */ -+#define pmd_bad(pmd) ((pmd_val(pmd) & ~PAGE_MASK) || \ -+ !__kern_addr_valid(pmd_val(pmd))) -+ -+#define pud_none(pud) (!pud_val(pud)) -+ -+#define pud_bad(pud) ((pud_val(pud) & ~PAGE_MASK) || \ -+ !__kern_addr_valid(pud_val(pud))) -+ - #ifdef CONFIG_TRANSPARENT_HUGEPAGE - extern void set_pmd_at(struct mm_struct *mm, unsigned long addr, - pmd_t *pmdp, pmd_t pmd); -@@ -790,10 +812,7 @@ static inline unsigned long __pmd_page(pmd_t pmd) - #define pud_page_vaddr(pud) \ - ((unsigned long) __va(pud_val(pud))) - #define pud_page(pud) virt_to_page((void *)pud_page_vaddr(pud)) --#define pmd_bad(pmd) (0) - #define pmd_clear(pmdp) (pmd_val(*(pmdp)) = 0UL) --#define pud_none(pud) (!pud_val(pud)) --#define pud_bad(pud) (0) - #define pud_present(pud) (pud_val(pud) != 0U) - #define pud_clear(pudp) (pud_val(*(pudp)) = 0UL) - -@@ -893,6 +912,10 @@ extern void update_mmu_cache(struct vm_area_struct *, unsigned long, pte_t *); - extern void update_mmu_cache_pmd(struct vm_area_struct *vma, unsigned long addr, - pmd_t *pmd); - -+#define __HAVE_ARCH_PMDP_INVALIDATE -+extern void pmdp_invalidate(struct vm_area_struct *vma, unsigned long address, -+ pmd_t *pmdp); -+ - #define __HAVE_ARCH_PGTABLE_DEPOSIT - extern void pgtable_trans_huge_deposit(struct mm_struct *mm, pmd_t *pmdp, - pgtable_t pgtable); -@@ -919,18 +942,6 @@ extern unsigned long pte_file(pte_t); - extern pte_t pgoff_to_pte(unsigned long); - #define PTE_FILE_MAX_BITS (64UL - PAGE_SHIFT - 1UL) - --extern unsigned long sparc64_valid_addr_bitmap[]; -- --/* Needs to be defined here and not in linux/mm.h, as it is arch dependent */ --static inline bool kern_addr_valid(unsigned long addr) --{ -- unsigned long paddr = __pa(addr); -- -- if ((paddr >> 41UL) != 0UL) -- return false; -- return test_bit(paddr >> 22, sparc64_valid_addr_bitmap); --} -- - extern int page_in_phys_avail(unsigned long paddr); - - /* -diff --git a/arch/sparc/include/asm/tlbflush_64.h b/arch/sparc/include/asm/tlbflush_64.h -index 3c3c89f52643..7f9bab26a499 100644 ---- a/arch/sparc/include/asm/tlbflush_64.h -+++ b/arch/sparc/include/asm/tlbflush_64.h -@@ -34,6 +34,8 @@ static inline void flush_tlb_range(struct vm_area_struct *vma, - { - } - -+void flush_tlb_kernel_range(unsigned long start, unsigned long end); -+ - #define __HAVE_ARCH_ENTER_LAZY_MMU_MODE - - extern void flush_tlb_pending(void); -@@ -48,11 +50,6 @@ extern void __flush_tlb_kernel_range(unsigned long start, unsigned long end); - - #ifndef CONFIG_SMP - --#define flush_tlb_kernel_range(start,end) \ --do { flush_tsb_kernel_range(start,end); \ -- __flush_tlb_kernel_range(start,end); \ --} while (0) -- - static inline void global_flush_tlb_page(struct mm_struct *mm, unsigned long vaddr) - { - __flush_tlb_page(CTX_HWBITS(mm->context), vaddr); -@@ -63,11 +60,6 @@ static inline void global_flush_tlb_page(struct mm_struct *mm, unsigned long vad - extern void smp_flush_tlb_kernel_range(unsigned long start, unsigned long end); - extern void smp_flush_tlb_page(struct mm_struct *mm, unsigned long vaddr); - --#define flush_tlb_kernel_range(start, end) \ --do { flush_tsb_kernel_range(start,end); \ -- smp_flush_tlb_kernel_range(start, end); \ --} while (0) -- - #define global_flush_tlb_page(mm, vaddr) \ - smp_flush_tlb_page(mm, vaddr) - -diff --git a/arch/sparc/include/asm/tsb.h b/arch/sparc/include/asm/tsb.h -index 2230f80d9fe3..90916f955cac 100644 ---- a/arch/sparc/include/asm/tsb.h -+++ b/arch/sparc/include/asm/tsb.h -@@ -171,7 +171,8 @@ extern struct tsb_phys_patch_entry __tsb_phys_patch, __tsb_phys_patch_end; - andcc REG1, REG2, %g0; \ - be,pt %xcc, 700f; \ - sethi %hi(4 * 1024 * 1024), REG2; \ -- andn REG1, REG2, REG1; \ -+ brgez,pn REG1, FAIL_LABEL; \ -+ andn REG1, REG2, REG1; \ - and VADDR, REG2, REG2; \ - brlz,pt REG1, PTE_LABEL; \ - or REG1, REG2, REG1; \ -diff --git a/arch/sparc/kernel/head_64.S b/arch/sparc/kernel/head_64.S -index 26b706a1867d..452f04fe8da6 100644 ---- a/arch/sparc/kernel/head_64.S -+++ b/arch/sparc/kernel/head_64.S -@@ -282,8 +282,8 @@ sun4v_chip_type: - stx %l2, [%l4 + 0x0] - ldx [%sp + 2047 + 128 + 0x50], %l3 ! physaddr low - /* 4MB align */ -- srlx %l3, 22, %l3 -- sllx %l3, 22, %l3 -+ srlx %l3, ILOG2_4MB, %l3 -+ sllx %l3, ILOG2_4MB, %l3 - stx %l3, [%l4 + 0x8] - - /* Leave service as-is, "call-method" */ -diff --git a/arch/sparc/kernel/ktlb.S b/arch/sparc/kernel/ktlb.S -index 542e96ac4d39..605d49204580 100644 ---- a/arch/sparc/kernel/ktlb.S -+++ b/arch/sparc/kernel/ktlb.S -@@ -277,7 +277,7 @@ kvmap_dtlb_load: - #ifdef CONFIG_SPARSEMEM_VMEMMAP - kvmap_vmemmap: - sub %g4, %g5, %g5 -- srlx %g5, 22, %g5 -+ srlx %g5, ILOG2_4MB, %g5 - sethi %hi(vmemmap_table), %g1 - sllx %g5, 3, %g5 - or %g1, %lo(vmemmap_table), %g1 -diff --git a/arch/sparc/kernel/ldc.c b/arch/sparc/kernel/ldc.c -index e01d75d40329..66dacd56bb10 100644 ---- a/arch/sparc/kernel/ldc.c -+++ b/arch/sparc/kernel/ldc.c -@@ -1336,7 +1336,7 @@ int ldc_connect(struct ldc_channel *lp) - if (!(lp->flags & LDC_FLAG_ALLOCED_QUEUES) || - !(lp->flags & LDC_FLAG_REGISTERED_QUEUES) || - lp->hs_state != LDC_HS_OPEN) -- err = -EINVAL; -+ err = ((lp->hs_state > LDC_HS_OPEN) ? 0 : -EINVAL); - else - err = start_handshake(lp); - -diff --git a/arch/sparc/kernel/smp_64.c b/arch/sparc/kernel/smp_64.c -index b085311dcd0e..8416d7fadcce 100644 ---- a/arch/sparc/kernel/smp_64.c -+++ b/arch/sparc/kernel/smp_64.c -@@ -151,7 +151,7 @@ void cpu_panic(void) - #define NUM_ROUNDS 64 /* magic value */ - #define NUM_ITERS 5 /* likewise */ - --static DEFINE_SPINLOCK(itc_sync_lock); -+static DEFINE_RAW_SPINLOCK(itc_sync_lock); - static unsigned long go[SLAVE + 1]; - - #define DEBUG_TICK_SYNC 0 -@@ -259,7 +259,7 @@ static void smp_synchronize_one_tick(int cpu) - go[MASTER] = 0; - membar_safe("#StoreLoad"); - -- spin_lock_irqsave(&itc_sync_lock, flags); -+ raw_spin_lock_irqsave(&itc_sync_lock, flags); - { - for (i = 0; i < NUM_ROUNDS*NUM_ITERS; i++) { - while (!go[MASTER]) -@@ -270,7 +270,7 @@ static void smp_synchronize_one_tick(int cpu) - membar_safe("#StoreLoad"); - } - } -- spin_unlock_irqrestore(&itc_sync_lock, flags); -+ raw_spin_unlock_irqrestore(&itc_sync_lock, flags); - } - - #if defined(CONFIG_SUN_LDOMS) && defined(CONFIG_HOTPLUG_CPU) -diff --git a/arch/sparc/kernel/sys32.S b/arch/sparc/kernel/sys32.S -index f7c72b6efc27..d066eb18650c 100644 ---- a/arch/sparc/kernel/sys32.S -+++ b/arch/sparc/kernel/sys32.S -@@ -44,7 +44,7 @@ SIGN1(sys32_timer_settime, compat_sys_timer_settime, %o1) - SIGN1(sys32_io_submit, compat_sys_io_submit, %o1) - SIGN1(sys32_mq_open, compat_sys_mq_open, %o1) - SIGN1(sys32_select, compat_sys_select, %o0) --SIGN3(sys32_futex, compat_sys_futex, %o1, %o2, %o5) -+SIGN1(sys32_futex, compat_sys_futex, %o1) - SIGN1(sys32_recvfrom, compat_sys_recvfrom, %o0) - SIGN1(sys32_recvmsg, compat_sys_recvmsg, %o0) - SIGN1(sys32_sendmsg, compat_sys_sendmsg, %o0) -diff --git a/arch/sparc/kernel/unaligned_64.c b/arch/sparc/kernel/unaligned_64.c -index 3c1a7cb31579..35ab8b60d256 100644 ---- a/arch/sparc/kernel/unaligned_64.c -+++ b/arch/sparc/kernel/unaligned_64.c -@@ -166,17 +166,23 @@ static unsigned long *fetch_reg_addr(unsigned int reg, struct pt_regs *regs) - unsigned long compute_effective_address(struct pt_regs *regs, - unsigned int insn, unsigned int rd) - { -+ int from_kernel = (regs->tstate & TSTATE_PRIV) != 0; - unsigned int rs1 = (insn >> 14) & 0x1f; - unsigned int rs2 = insn & 0x1f; -- int from_kernel = (regs->tstate & TSTATE_PRIV) != 0; -+ unsigned long addr; - - if (insn & 0x2000) { - maybe_flush_windows(rs1, 0, rd, from_kernel); -- return (fetch_reg(rs1, regs) + sign_extend_imm13(insn)); -+ addr = (fetch_reg(rs1, regs) + sign_extend_imm13(insn)); - } else { - maybe_flush_windows(rs1, rs2, rd, from_kernel); -- return (fetch_reg(rs1, regs) + fetch_reg(rs2, regs)); -+ addr = (fetch_reg(rs1, regs) + fetch_reg(rs2, regs)); - } -+ -+ if (!from_kernel && test_thread_flag(TIF_32BIT)) -+ addr &= 0xffffffff; -+ -+ return addr; - } - - /* This is just to make gcc think die_if_kernel does return... */ -diff --git a/arch/sparc/lib/NG2memcpy.S b/arch/sparc/lib/NG2memcpy.S -index 2c20ad63ddbf..30eee6e8a81b 100644 ---- a/arch/sparc/lib/NG2memcpy.S -+++ b/arch/sparc/lib/NG2memcpy.S -@@ -236,6 +236,7 @@ FUNC_NAME: /* %o0=dst, %o1=src, %o2=len */ - */ - VISEntryHalf - -+ membar #Sync - alignaddr %o1, %g0, %g0 - - add %o1, (64 - 1), %o4 -diff --git a/arch/sparc/math-emu/math_32.c b/arch/sparc/math-emu/math_32.c -index aa4d55b0bdf0..5ce8f2f64604 100644 ---- a/arch/sparc/math-emu/math_32.c -+++ b/arch/sparc/math-emu/math_32.c -@@ -499,7 +499,7 @@ static int do_one_mathemu(u32 insn, unsigned long *pfsr, unsigned long *fregs) - case 0: fsr = *pfsr; - if (IR == -1) IR = 2; - /* fcc is always fcc0 */ -- fsr &= ~0xc00; fsr |= (IR << 10); break; -+ fsr &= ~0xc00; fsr |= (IR << 10); - *pfsr = fsr; - break; - case 1: rd->s = IR; break; -diff --git a/arch/sparc/mm/fault_64.c b/arch/sparc/mm/fault_64.c -index 69bb818fdd79..4ced3fc66130 100644 ---- a/arch/sparc/mm/fault_64.c -+++ b/arch/sparc/mm/fault_64.c -@@ -96,38 +96,51 @@ static unsigned int get_user_insn(unsigned long tpc) - pte_t *ptep, pte; - unsigned long pa; - u32 insn = 0; -- unsigned long pstate; - -- if (pgd_none(*pgdp)) -- goto outret; -+ if (pgd_none(*pgdp) || unlikely(pgd_bad(*pgdp))) -+ goto out; - pudp = pud_offset(pgdp, tpc); -- if (pud_none(*pudp)) -- goto outret; -- pmdp = pmd_offset(pudp, tpc); -- if (pmd_none(*pmdp)) -- goto outret; -+ if (pud_none(*pudp) || unlikely(pud_bad(*pudp))) -+ goto out; - - /* This disables preemption for us as well. */ -- __asm__ __volatile__("rdpr %%pstate, %0" : "=r" (pstate)); -- __asm__ __volatile__("wrpr %0, %1, %%pstate" -- : : "r" (pstate), "i" (PSTATE_IE)); -- ptep = pte_offset_map(pmdp, tpc); -- pte = *ptep; -- if (!pte_present(pte)) -- goto out; -+ local_irq_disable(); -+ -+ pmdp = pmd_offset(pudp, tpc); -+ if (pmd_none(*pmdp) || unlikely(pmd_bad(*pmdp))) -+ goto out_irq_enable; - -- pa = (pte_pfn(pte) << PAGE_SHIFT); -- pa += (tpc & ~PAGE_MASK); -+#ifdef CONFIG_TRANSPARENT_HUGEPAGE -+ if (pmd_trans_huge(*pmdp)) { -+ if (pmd_trans_splitting(*pmdp)) -+ goto out_irq_enable; - -- /* Use phys bypass so we don't pollute dtlb/dcache. */ -- __asm__ __volatile__("lduwa [%1] %2, %0" -- : "=r" (insn) -- : "r" (pa), "i" (ASI_PHYS_USE_EC)); -+ pa = pmd_pfn(*pmdp) << PAGE_SHIFT; -+ pa += tpc & ~HPAGE_MASK; - -+ /* Use phys bypass so we don't pollute dtlb/dcache. */ -+ __asm__ __volatile__("lduwa [%1] %2, %0" -+ : "=r" (insn) -+ : "r" (pa), "i" (ASI_PHYS_USE_EC)); -+ } else -+#endif -+ { -+ ptep = pte_offset_map(pmdp, tpc); -+ pte = *ptep; -+ if (pte_present(pte)) { -+ pa = (pte_pfn(pte) << PAGE_SHIFT); -+ pa += (tpc & ~PAGE_MASK); -+ -+ /* Use phys bypass so we don't pollute dtlb/dcache. */ -+ __asm__ __volatile__("lduwa [%1] %2, %0" -+ : "=r" (insn) -+ : "r" (pa), "i" (ASI_PHYS_USE_EC)); -+ } -+ pte_unmap(ptep); -+ } -+out_irq_enable: -+ local_irq_enable(); - out: -- pte_unmap(ptep); -- __asm__ __volatile__("wrpr %0, 0x0, %%pstate" : : "r" (pstate)); --outret: - return insn; - } - -@@ -153,7 +166,8 @@ show_signal_msg(struct pt_regs *regs, int sig, int code, - } - - static void do_fault_siginfo(int code, int sig, struct pt_regs *regs, -- unsigned int insn, int fault_code) -+ unsigned long fault_addr, unsigned int insn, -+ int fault_code) - { - unsigned long addr; - siginfo_t info; -@@ -161,10 +175,18 @@ static void do_fault_siginfo(int code, int sig, struct pt_regs *regs, - info.si_code = code; - info.si_signo = sig; - info.si_errno = 0; -- if (fault_code & FAULT_CODE_ITLB) -+ if (fault_code & FAULT_CODE_ITLB) { - addr = regs->tpc; -- else -- addr = compute_effective_address(regs, insn, 0); -+ } else { -+ /* If we were able to probe the faulting instruction, use it -+ * to compute a precise fault address. Otherwise use the fault -+ * time provided address which may only have page granularity. -+ */ -+ if (insn) -+ addr = compute_effective_address(regs, insn, 0); -+ else -+ addr = fault_addr; -+ } - info.si_addr = (void __user *) addr; - info.si_trapno = 0; - -@@ -239,7 +261,7 @@ static void __kprobes do_kernel_fault(struct pt_regs *regs, int si_code, - /* The si_code was set to make clear whether - * this was a SEGV_MAPERR or SEGV_ACCERR fault. - */ -- do_fault_siginfo(si_code, SIGSEGV, regs, insn, fault_code); -+ do_fault_siginfo(si_code, SIGSEGV, regs, address, insn, fault_code); - return; - } - -@@ -259,18 +281,6 @@ static void noinline __kprobes bogus_32bit_fault_tpc(struct pt_regs *regs) - show_regs(regs); - } - --static void noinline __kprobes bogus_32bit_fault_address(struct pt_regs *regs, -- unsigned long addr) --{ -- static int times; -- -- if (times++ < 10) -- printk(KERN_ERR "FAULT[%s:%d]: 32-bit process " -- "reports 64-bit fault address [%lx]\n", -- current->comm, current->pid, addr); -- show_regs(regs); --} -- - asmlinkage void __kprobes do_sparc64_fault(struct pt_regs *regs) - { - enum ctx_state prev_state = exception_enter(); -@@ -300,10 +310,8 @@ asmlinkage void __kprobes do_sparc64_fault(struct pt_regs *regs) - goto intr_or_no_mm; - } - } -- if (unlikely((address >> 32) != 0)) { -- bogus_32bit_fault_address(regs, address); -+ if (unlikely((address >> 32) != 0)) - goto intr_or_no_mm; -- } - } - - if (regs->tstate & TSTATE_PRIV) { -@@ -525,7 +533,7 @@ do_sigbus: - * Send a sigbus, regardless of whether we were in kernel - * or user mode. - */ -- do_fault_siginfo(BUS_ADRERR, SIGBUS, regs, insn, fault_code); -+ do_fault_siginfo(BUS_ADRERR, SIGBUS, regs, address, insn, fault_code); - - /* Kernel mode? Handle exceptions or die */ - if (regs->tstate & TSTATE_PRIV) -diff --git a/arch/sparc/mm/gup.c b/arch/sparc/mm/gup.c -index c4d3da68b800..1aed0432c64b 100644 ---- a/arch/sparc/mm/gup.c -+++ b/arch/sparc/mm/gup.c -@@ -73,7 +73,7 @@ static int gup_huge_pmd(pmd_t *pmdp, pmd_t pmd, unsigned long addr, - struct page *head, *page, *tail; - int refs; - -- if (!pmd_large(pmd)) -+ if (!(pmd_val(pmd) & _PAGE_VALID)) - return 0; - - if (write && !pmd_write(pmd)) -diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c -index eafbc65c9c47..96862241b342 100644 ---- a/arch/sparc/mm/init_64.c -+++ b/arch/sparc/mm/init_64.c -@@ -350,6 +350,10 @@ void update_mmu_cache(struct vm_area_struct *vma, unsigned long address, pte_t * - - mm = vma->vm_mm; - -+ /* Don't insert a non-valid PTE into the TSB, we'll deadlock. */ -+ if (!pte_accessible(mm, pte)) -+ return; -+ - spin_lock_irqsave(&mm->context.lock, flags); - - #if defined(CONFIG_HUGETLB_PAGE) || defined(CONFIG_TRANSPARENT_HUGEPAGE) -@@ -588,7 +592,7 @@ static void __init remap_kernel(void) - int i, tlb_ent = sparc64_highest_locked_tlbent(); - - tte_vaddr = (unsigned long) KERNBASE; -- phys_page = (prom_boot_mapping_phys_low >> 22UL) << 22UL; -+ phys_page = (prom_boot_mapping_phys_low >> ILOG2_4MB) << ILOG2_4MB; - tte_data = kern_large_tte(phys_page); - - kern_locked_tte_data = tte_data; -@@ -1881,7 +1885,7 @@ void __init paging_init(void) - - BUILD_BUG_ON(NR_CPUS > 4096); - -- kern_base = (prom_boot_mapping_phys_low >> 22UL) << 22UL; -+ kern_base = (prom_boot_mapping_phys_low >> ILOG2_4MB) << ILOG2_4MB; - kern_size = (unsigned long)&_end - (unsigned long)KERNBASE; - - /* Invalidate both kernel TSBs. */ -@@ -1937,7 +1941,7 @@ void __init paging_init(void) - shift = kern_base + PAGE_OFFSET - ((unsigned long)KERNBASE); - - real_end = (unsigned long)_end; -- num_kernel_image_mappings = DIV_ROUND_UP(real_end - KERNBASE, 1 << 22); -+ num_kernel_image_mappings = DIV_ROUND_UP(real_end - KERNBASE, 1 << ILOG2_4MB); - printk("Kernel: Using %d locked TLB entries for main kernel image.\n", - num_kernel_image_mappings); - -@@ -2094,7 +2098,7 @@ static void __init setup_valid_addr_bitmap_from_pavail(unsigned long *bitmap) - - if (new_start <= old_start && - new_end >= (old_start + PAGE_SIZE)) { -- set_bit(old_start >> 22, bitmap); -+ set_bit(old_start >> ILOG2_4MB, bitmap); - goto do_next_page; - } - } -@@ -2143,7 +2147,7 @@ void __init mem_init(void) - addr = PAGE_OFFSET + kern_base; - last = PAGE_ALIGN(kern_size) + addr; - while (addr < last) { -- set_bit(__pa(addr) >> 22, sparc64_valid_addr_bitmap); -+ set_bit(__pa(addr) >> ILOG2_4MB, sparc64_valid_addr_bitmap); - addr += PAGE_SIZE; - } - -@@ -2267,7 +2271,7 @@ int __meminit vmemmap_populate(unsigned long vstart, unsigned long vend, - void *block; - - if (!(*vmem_pp & _PAGE_VALID)) { -- block = vmemmap_alloc_block(1UL << 22, node); -+ block = vmemmap_alloc_block(1UL << ILOG2_4MB, node); - if (!block) - return -ENOMEM; - -@@ -2614,6 +2618,10 @@ void update_mmu_cache_pmd(struct vm_area_struct *vma, unsigned long addr, - - pte = pmd_val(entry); - -+ /* Don't insert a non-valid PMD into the TSB, we'll deadlock. */ -+ if (!(pte & _PAGE_VALID)) -+ return; -+ - /* We are fabricating 8MB pages using 4MB real hw pages. */ - pte |= (addr & (1UL << REAL_HPAGE_SHIFT)); - -@@ -2694,3 +2702,26 @@ void hugetlb_setup(struct pt_regs *regs) - } - } - #endif -+ -+#ifdef CONFIG_SMP -+#define do_flush_tlb_kernel_range smp_flush_tlb_kernel_range -+#else -+#define do_flush_tlb_kernel_range __flush_tlb_kernel_range -+#endif -+ -+void flush_tlb_kernel_range(unsigned long start, unsigned long end) -+{ -+ if (start < HI_OBP_ADDRESS && end > LOW_OBP_ADDRESS) { -+ if (start < LOW_OBP_ADDRESS) { -+ flush_tsb_kernel_range(start, LOW_OBP_ADDRESS); -+ do_flush_tlb_kernel_range(start, LOW_OBP_ADDRESS); -+ } -+ if (end > HI_OBP_ADDRESS) { -+ flush_tsb_kernel_range(end, HI_OBP_ADDRESS); -+ do_flush_tlb_kernel_range(end, HI_OBP_ADDRESS); -+ } -+ } else { -+ flush_tsb_kernel_range(start, end); -+ do_flush_tlb_kernel_range(start, end); -+ } -+} -diff --git a/arch/sparc/mm/tlb.c b/arch/sparc/mm/tlb.c -index b12cb5e72812..b89aba217e3b 100644 ---- a/arch/sparc/mm/tlb.c -+++ b/arch/sparc/mm/tlb.c -@@ -134,7 +134,7 @@ no_cache_flush: - - #ifdef CONFIG_TRANSPARENT_HUGEPAGE - static void tlb_batch_pmd_scan(struct mm_struct *mm, unsigned long vaddr, -- pmd_t pmd, bool exec) -+ pmd_t pmd) - { - unsigned long end; - pte_t *pte; -@@ -142,8 +142,11 @@ static void tlb_batch_pmd_scan(struct mm_struct *mm, unsigned long vaddr, - pte = pte_offset_map(&pmd, vaddr); - end = vaddr + HPAGE_SIZE; - while (vaddr < end) { -- if (pte_val(*pte) & _PAGE_VALID) -+ if (pte_val(*pte) & _PAGE_VALID) { -+ bool exec = pte_exec(*pte); -+ - tlb_batch_add_one(mm, vaddr, exec); -+ } - pte++; - vaddr += PAGE_SIZE; - } -@@ -177,19 +180,30 @@ void set_pmd_at(struct mm_struct *mm, unsigned long addr, - } - - if (!pmd_none(orig)) { -- pte_t orig_pte = __pte(pmd_val(orig)); -- bool exec = pte_exec(orig_pte); -- - addr &= HPAGE_MASK; - if (pmd_trans_huge(orig)) { -+ pte_t orig_pte = __pte(pmd_val(orig)); -+ bool exec = pte_exec(orig_pte); -+ - tlb_batch_add_one(mm, addr, exec); - tlb_batch_add_one(mm, addr + REAL_HPAGE_SIZE, exec); - } else { -- tlb_batch_pmd_scan(mm, addr, orig, exec); -+ tlb_batch_pmd_scan(mm, addr, orig); - } - } - } - -+void pmdp_invalidate(struct vm_area_struct *vma, unsigned long address, -+ pmd_t *pmdp) -+{ -+ pmd_t entry = *pmdp; -+ -+ pmd_val(entry) &= ~_PAGE_VALID; -+ -+ set_pmd_at(vma->vm_mm, address, pmdp, entry); -+ flush_tlb_range(vma, address, address + HPAGE_PMD_SIZE); -+} -+ - void pgtable_trans_huge_deposit(struct mm_struct *mm, pmd_t *pmdp, - pgtable_t pgtable) - { -diff --git a/arch/sparc/mm/tsb.c b/arch/sparc/mm/tsb.c -index f5d506fdddad..fe19b81acc09 100644 ---- a/arch/sparc/mm/tsb.c -+++ b/arch/sparc/mm/tsb.c -@@ -133,7 +133,19 @@ static void setup_tsb_params(struct mm_struct *mm, unsigned long tsb_idx, unsign - mm->context.tsb_block[tsb_idx].tsb_nentries = - tsb_bytes / sizeof(struct tsb); - -- base = TSBMAP_BASE; -+ switch (tsb_idx) { -+ case MM_TSB_BASE: -+ base = TSBMAP_8K_BASE; -+ break; -+#if defined(CONFIG_HUGETLB_PAGE) || defined(CONFIG_TRANSPARENT_HUGEPAGE) -+ case MM_TSB_HUGE: -+ base = TSBMAP_4M_BASE; -+ break; -+#endif -+ default: -+ BUG(); -+ } -+ - tte = pgprot_val(PAGE_KERNEL_LOCKED); - tsb_paddr = __pa(mm->context.tsb_block[tsb_idx].tsb); - BUG_ON(tsb_paddr & (tsb_bytes - 1UL)); -diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h -index 391f29ef6d2e..1fbeaa9dd202 100644 ---- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h -+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h -@@ -337,6 +337,7 @@ struct sw_tx_bd { - u8 flags; - /* Set on the first BD descriptor when there is a split BD */ - #define BNX2X_TSO_SPLIT_BD (1<<0) -+#define BNX2X_HAS_SECOND_PBD (1<<1) - }; - - struct sw_rx_page { -diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c -index 5ed512473b12..afa4a1f63270 100644 ---- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c -+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c -@@ -223,6 +223,12 @@ static u16 bnx2x_free_tx_pkt(struct bnx2x *bp, struct bnx2x_fp_txdata *txdata, - --nbd; - bd_idx = TX_BD(NEXT_TX_IDX(bd_idx)); - -+ if (tx_buf->flags & BNX2X_HAS_SECOND_PBD) { -+ /* Skip second parse bd... */ -+ --nbd; -+ bd_idx = TX_BD(NEXT_TX_IDX(bd_idx)); -+ } -+ - /* TSO headers+data bds share a common mapping. See bnx2x_tx_split() */ - if (tx_buf->flags & BNX2X_TSO_SPLIT_BD) { - tx_data_bd = &txdata->tx_desc_ring[bd_idx].reg_bd; -@@ -3868,6 +3874,9 @@ netdev_tx_t bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev) - /* set encapsulation flag in start BD */ - SET_FLAG(tx_start_bd->general_data, - ETH_TX_START_BD_TUNNEL_EXIST, 1); -+ -+ tx_buf->flags |= BNX2X_HAS_SECOND_PBD; -+ - nbd++; - } else if (xmit_type & XMIT_CSUM) { - /* Set PBD in checksum offload case w/o encapsulation */ -diff --git a/drivers/net/ethernet/brocade/bna/bnad.c b/drivers/net/ethernet/brocade/bna/bnad.c -index 4ad1187e82fb..669eeb4eb247 100644 ---- a/drivers/net/ethernet/brocade/bna/bnad.c -+++ b/drivers/net/ethernet/brocade/bna/bnad.c -@@ -600,9 +600,9 @@ bnad_cq_process(struct bnad *bnad, struct bna_ccb *ccb, int budget) - prefetch(bnad->netdev); - - cq = ccb->sw_q; -- cmpl = &cq[ccb->producer_index]; - - while (packets < budget) { -+ cmpl = &cq[ccb->producer_index]; - if (!cmpl->valid) - break; - /* The 'valid' field is set by the adapter, only after writing -diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c -index 5adecc5f52b7..7f1abb7c18f2 100644 ---- a/drivers/net/macvlan.c -+++ b/drivers/net/macvlan.c -@@ -548,6 +548,7 @@ static int macvlan_init(struct net_device *dev) - (lowerdev->state & MACVLAN_STATE_MASK); - dev->features = lowerdev->features & MACVLAN_FEATURES; - dev->features |= ALWAYS_ON_FEATURES; -+ dev->vlan_features = lowerdev->vlan_features & MACVLAN_FEATURES; - dev->gso_max_size = lowerdev->gso_max_size; - dev->iflink = lowerdev->ifindex; - dev->hard_header_len = lowerdev->hard_header_len; -diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c -index 365375408904..25f74191a788 100644 ---- a/drivers/net/phy/phy_device.c -+++ b/drivers/net/phy/phy_device.c -@@ -353,7 +353,7 @@ int phy_device_register(struct phy_device *phydev) - phydev->bus->phy_map[phydev->addr] = phydev; - - /* Run all of the fixups for this PHY */ -- err = phy_init_hw(phydev); -+ err = phy_scan_fixups(phydev); - if (err) { - pr_err("PHY %d failed to initialize\n", phydev->addr); - goto out; -diff --git a/drivers/net/ppp/pptp.c b/drivers/net/ppp/pptp.c -index 01805319e1e0..1aff970be33e 100644 ---- a/drivers/net/ppp/pptp.c -+++ b/drivers/net/ppp/pptp.c -@@ -281,7 +281,7 @@ static int pptp_xmit(struct ppp_channel *chan, struct sk_buff *skb) - nf_reset(skb); - - skb->ip_summed = CHECKSUM_NONE; -- ip_select_ident(skb, &rt->dst, NULL); -+ ip_select_ident(skb, NULL); - ip_send_check(iph); - - ip_local_out(skb); -diff --git a/drivers/sbus/char/bbc_envctrl.c b/drivers/sbus/char/bbc_envctrl.c -index 160e7510aca6..0787b9756165 100644 ---- a/drivers/sbus/char/bbc_envctrl.c -+++ b/drivers/sbus/char/bbc_envctrl.c -@@ -452,6 +452,9 @@ static void attach_one_temp(struct bbc_i2c_bus *bp, struct platform_device *op, - if (!tp) - return; - -+ INIT_LIST_HEAD(&tp->bp_list); -+ INIT_LIST_HEAD(&tp->glob_list); -+ - tp->client = bbc_i2c_attach(bp, op); - if (!tp->client) { - kfree(tp); -@@ -497,6 +500,9 @@ static void attach_one_fan(struct bbc_i2c_bus *bp, struct platform_device *op, - if (!fp) - return; - -+ INIT_LIST_HEAD(&fp->bp_list); -+ INIT_LIST_HEAD(&fp->glob_list); -+ - fp->client = bbc_i2c_attach(bp, op); - if (!fp->client) { - kfree(fp); -diff --git a/drivers/sbus/char/bbc_i2c.c b/drivers/sbus/char/bbc_i2c.c -index c7763e482eb2..812b5f0361b6 100644 ---- a/drivers/sbus/char/bbc_i2c.c -+++ b/drivers/sbus/char/bbc_i2c.c -@@ -300,13 +300,18 @@ static struct bbc_i2c_bus * attach_one_i2c(struct platform_device *op, int index - if (!bp) - return NULL; - -+ INIT_LIST_HEAD(&bp->temps); -+ INIT_LIST_HEAD(&bp->fans); -+ - bp->i2c_control_regs = of_ioremap(&op->resource[0], 0, 0x2, "bbc_i2c_regs"); - if (!bp->i2c_control_regs) - goto fail; - -- bp->i2c_bussel_reg = of_ioremap(&op->resource[1], 0, 0x1, "bbc_i2c_bussel"); -- if (!bp->i2c_bussel_reg) -- goto fail; -+ if (op->num_resources == 2) { -+ bp->i2c_bussel_reg = of_ioremap(&op->resource[1], 0, 0x1, "bbc_i2c_bussel"); -+ if (!bp->i2c_bussel_reg) -+ goto fail; -+ } - - bp->waiting = 0; - init_waitqueue_head(&bp->wq); -diff --git a/drivers/tty/serial/sunsab.c b/drivers/tty/serial/sunsab.c -index 80a58eca785b..e8f77606561b 100644 ---- a/drivers/tty/serial/sunsab.c -+++ b/drivers/tty/serial/sunsab.c -@@ -157,6 +157,15 @@ receive_chars(struct uart_sunsab_port *up, - (up->port.line == up->port.cons->index)) - saw_console_brk = 1; - -+ if (count == 0) { -+ if (unlikely(stat->sreg.isr1 & SAB82532_ISR1_BRK)) { -+ stat->sreg.isr0 &= ~(SAB82532_ISR0_PERR | -+ SAB82532_ISR0_FERR); -+ up->port.icount.brk++; -+ uart_handle_break(&up->port); -+ } -+ } -+ - for (i = 0; i < count; i++) { - unsigned char ch = buf[i], flag; - -diff --git a/fs/xfs/xfs_log.h b/fs/xfs/xfs_log.h -index b0f4ef77fa70..bf9781e9fd92 100644 ---- a/fs/xfs/xfs_log.h -+++ b/fs/xfs/xfs_log.h -@@ -24,7 +24,8 @@ struct xfs_log_vec { - struct xfs_log_iovec *lv_iovecp; /* iovec array */ - struct xfs_log_item *lv_item; /* owner */ - char *lv_buf; /* formatted buffer */ -- int lv_buf_len; /* size of formatted buffer */ -+ int lv_bytes; /* accounted space in buffer */ -+ int lv_buf_len; /* aligned size of buffer */ - int lv_size; /* size of allocated lv */ - }; - -@@ -52,15 +53,21 @@ xlog_prepare_iovec(struct xfs_log_vec *lv, struct xfs_log_iovec **vecp, - return vec->i_addr; - } - -+/* -+ * We need to make sure the next buffer is naturally aligned for the biggest -+ * basic data type we put into it. We already accounted for this padding when -+ * sizing the buffer. -+ * -+ * However, this padding does not get written into the log, and hence we have to -+ * track the space used by the log vectors separately to prevent log space hangs -+ * due to inaccurate accounting (i.e. a leak) of the used log space through the -+ * CIL context ticket. -+ */ - static inline void - xlog_finish_iovec(struct xfs_log_vec *lv, struct xfs_log_iovec *vec, int len) - { -- /* -- * We need to make sure the next buffer is naturally aligned for the -- * biggest basic data type we put into it. We already accounted for -- * this when sizing the buffer. -- */ - lv->lv_buf_len += round_up(len, sizeof(uint64_t)); -+ lv->lv_bytes += len; - vec->i_len = len; - } - -diff --git a/fs/xfs/xfs_log_cil.c b/fs/xfs/xfs_log_cil.c -index 4ef6fdbced78..bcfbaae4702c 100644 ---- a/fs/xfs/xfs_log_cil.c -+++ b/fs/xfs/xfs_log_cil.c -@@ -97,7 +97,7 @@ xfs_cil_prepare_item( - { - /* Account for the new LV being passed in */ - if (lv->lv_buf_len != XFS_LOG_VEC_ORDERED) { -- *diff_len += lv->lv_buf_len; -+ *diff_len += lv->lv_bytes; - *diff_iovecs += lv->lv_niovecs; - } - -@@ -111,7 +111,7 @@ xfs_cil_prepare_item( - else if (old_lv != lv) { - ASSERT(lv->lv_buf_len != XFS_LOG_VEC_ORDERED); - -- *diff_len -= old_lv->lv_buf_len; -+ *diff_len -= old_lv->lv_bytes; - *diff_iovecs -= old_lv->lv_niovecs; - kmem_free(old_lv); - } -@@ -239,7 +239,7 @@ xlog_cil_insert_format_items( - * that the space reservation accounting is correct. - */ - *diff_iovecs -= lv->lv_niovecs; -- *diff_len -= lv->lv_buf_len; -+ *diff_len -= lv->lv_bytes; - } else { - /* allocate new data chunk */ - lv = kmem_zalloc(buf_size, KM_SLEEP|KM_NOFS); -@@ -259,6 +259,7 @@ xlog_cil_insert_format_items( - - /* The allocated data region lies beyond the iovec region */ - lv->lv_buf_len = 0; -+ lv->lv_bytes = 0; - lv->lv_buf = (char *)lv + buf_size - nbytes; - ASSERT(IS_ALIGNED((unsigned long)lv->lv_buf, sizeof(uint64_t))); - -diff --git a/include/net/inetpeer.h b/include/net/inetpeer.h -index 058271bde27a..823ec7bb9c67 100644 ---- a/include/net/inetpeer.h -+++ b/include/net/inetpeer.h -@@ -41,14 +41,13 @@ struct inet_peer { - struct rcu_head gc_rcu; - }; - /* -- * Once inet_peer is queued for deletion (refcnt == -1), following fields -- * are not available: rid, ip_id_count -+ * Once inet_peer is queued for deletion (refcnt == -1), following field -+ * is not available: rid - * We can share memory with rcu_head to help keep inet_peer small. - */ - union { - struct { - atomic_t rid; /* Frag reception counter */ -- atomic_t ip_id_count; /* IP ID for the next packet */ - }; - struct rcu_head rcu; - struct inet_peer *gc_next; -@@ -165,7 +164,7 @@ bool inet_peer_xrlim_allow(struct inet_peer *peer, int timeout); - void inetpeer_invalidate_tree(struct inet_peer_base *); - - /* -- * temporary check to make sure we dont access rid, ip_id_count, tcp_ts, -+ * temporary check to make sure we dont access rid, tcp_ts, - * tcp_ts_stamp if no refcount is taken on inet_peer - */ - static inline void inet_peer_refcheck(const struct inet_peer *p) -@@ -173,13 +172,4 @@ static inline void inet_peer_refcheck(const struct inet_peer *p) - WARN_ON_ONCE(atomic_read(&p->refcnt) <= 0); - } - -- --/* can be called with or without local BH being disabled */ --static inline int inet_getid(struct inet_peer *p, int more) --{ -- more++; -- inet_peer_refcheck(p); -- return atomic_add_return(more, &p->ip_id_count) - more; --} -- - #endif /* _NET_INETPEER_H */ -diff --git a/include/net/ip.h b/include/net/ip.h -index 23be0fd37937..937f19681426 100644 ---- a/include/net/ip.h -+++ b/include/net/ip.h -@@ -297,9 +297,10 @@ static inline unsigned int ip_skb_dst_mtu(const struct sk_buff *skb) - } - } - --void __ip_select_ident(struct iphdr *iph, struct dst_entry *dst, int more); -+u32 ip_idents_reserve(u32 hash, int segs); -+void __ip_select_ident(struct iphdr *iph, int segs); - --static inline void ip_select_ident(struct sk_buff *skb, struct dst_entry *dst, struct sock *sk) -+static inline void ip_select_ident_segs(struct sk_buff *skb, struct sock *sk, int segs) - { - struct iphdr *iph = ip_hdr(skb); - -@@ -309,24 +310,20 @@ static inline void ip_select_ident(struct sk_buff *skb, struct dst_entry *dst, s - * does not change, they drop every other packet in - * a TCP stream using header compression. - */ -- iph->id = (sk && inet_sk(sk)->inet_daddr) ? -- htons(inet_sk(sk)->inet_id++) : 0; -- } else -- __ip_select_ident(iph, dst, 0); --} -- --static inline void ip_select_ident_more(struct sk_buff *skb, struct dst_entry *dst, struct sock *sk, int more) --{ -- struct iphdr *iph = ip_hdr(skb); -- -- if ((iph->frag_off & htons(IP_DF)) && !skb->local_df) { - if (sk && inet_sk(sk)->inet_daddr) { - iph->id = htons(inet_sk(sk)->inet_id); -- inet_sk(sk)->inet_id += 1 + more; -- } else -+ inet_sk(sk)->inet_id += segs; -+ } else { - iph->id = 0; -- } else -- __ip_select_ident(iph, dst, more); -+ } -+ } else { -+ __ip_select_ident(iph, segs); -+ } -+} -+ -+static inline void ip_select_ident(struct sk_buff *skb, struct sock *sk) -+{ -+ ip_select_ident_segs(skb, sk, 1); - } - - /* -diff --git a/include/net/ip_tunnels.h b/include/net/ip_tunnels.h -index e77c10405d51..7b9ec5837496 100644 ---- a/include/net/ip_tunnels.h -+++ b/include/net/ip_tunnels.h -@@ -40,6 +40,7 @@ struct ip_tunnel_prl_entry { - - struct ip_tunnel_dst { - struct dst_entry __rcu *dst; -+ __be32 saddr; - }; - - struct ip_tunnel { -diff --git a/include/net/ipv6.h b/include/net/ipv6.h -index 4f541f11ce63..9ac65781d44b 100644 ---- a/include/net/ipv6.h -+++ b/include/net/ipv6.h -@@ -660,8 +660,6 @@ static inline int ipv6_addr_diff(const struct in6_addr *a1, const struct in6_add - return __ipv6_addr_diff(a1, a2, sizeof(struct in6_addr)); - } - --void ipv6_select_ident(struct frag_hdr *fhdr, struct rt6_info *rt); -- - int ip6_dst_hoplimit(struct dst_entry *dst); - - /* -diff --git a/include/net/secure_seq.h b/include/net/secure_seq.h -index f257486f17be..3f36d45b714a 100644 ---- a/include/net/secure_seq.h -+++ b/include/net/secure_seq.h -@@ -3,8 +3,6 @@ - - #include <linux/types.h> - --__u32 secure_ip_id(__be32 daddr); --__u32 secure_ipv6_id(const __be32 daddr[4]); - u32 secure_ipv4_port_ephemeral(__be32 saddr, __be32 daddr, __be16 dport); - u32 secure_ipv6_port_ephemeral(const __be32 *saddr, const __be32 *daddr, - __be16 dport); -diff --git a/net/batman-adv/fragmentation.c b/net/batman-adv/fragmentation.c -index cc1cfd60c094..c46387a46535 100644 ---- a/net/batman-adv/fragmentation.c -+++ b/net/batman-adv/fragmentation.c -@@ -128,6 +128,7 @@ static bool batadv_frag_insert_packet(struct batadv_orig_node *orig_node, - { - struct batadv_frag_table_entry *chain; - struct batadv_frag_list_entry *frag_entry_new = NULL, *frag_entry_curr; -+ struct batadv_frag_list_entry *frag_entry_last = NULL; - struct batadv_frag_packet *frag_packet; - uint8_t bucket; - uint16_t seqno, hdr_size = sizeof(struct batadv_frag_packet); -@@ -180,11 +181,14 @@ static bool batadv_frag_insert_packet(struct batadv_orig_node *orig_node, - ret = true; - goto out; - } -+ -+ /* store current entry because it could be the last in list */ -+ frag_entry_last = frag_entry_curr; - } - -- /* Reached the end of the list, so insert after 'frag_entry_curr'. */ -- if (likely(frag_entry_curr)) { -- hlist_add_after(&frag_entry_curr->list, &frag_entry_new->list); -+ /* Reached the end of the list, so insert after 'frag_entry_last'. */ -+ if (likely(frag_entry_last)) { -+ hlist_add_after(&frag_entry_last->list, &frag_entry_new->list); - chain->size += skb->len - hdr_size; - chain->timestamp = jiffies; - ret = true; -diff --git a/net/compat.c b/net/compat.c -index f50161fb812e..cbc1a2a26587 100644 ---- a/net/compat.c -+++ b/net/compat.c -@@ -85,7 +85,7 @@ int verify_compat_iovec(struct msghdr *kern_msg, struct iovec *kern_iov, - { - int tot_len; - -- if (kern_msg->msg_namelen) { -+ if (kern_msg->msg_name && kern_msg->msg_namelen) { - if (mode == VERIFY_READ) { - int err = move_addr_to_kernel(kern_msg->msg_name, - kern_msg->msg_namelen, -@@ -93,10 +93,11 @@ int verify_compat_iovec(struct msghdr *kern_msg, struct iovec *kern_iov, - if (err < 0) - return err; - } -- if (kern_msg->msg_name) -- kern_msg->msg_name = kern_address; -- } else -+ kern_msg->msg_name = kern_address; -+ } else { - kern_msg->msg_name = NULL; -+ kern_msg->msg_namelen = 0; -+ } - - tot_len = iov_from_user_compat_to_kern(kern_iov, - (struct compat_iovec __user *)kern_msg->msg_iov, -diff --git a/net/core/iovec.c b/net/core/iovec.c -index b61869429f4c..26dc0062652f 100644 ---- a/net/core/iovec.c -+++ b/net/core/iovec.c -@@ -39,7 +39,7 @@ int verify_iovec(struct msghdr *m, struct iovec *iov, struct sockaddr_storage *a - { - int size, ct, err; - -- if (m->msg_namelen) { -+ if (m->msg_name && m->msg_namelen) { - if (mode == VERIFY_READ) { - void __user *namep; - namep = (void __user __force *) m->msg_name; -@@ -48,10 +48,10 @@ int verify_iovec(struct msghdr *m, struct iovec *iov, struct sockaddr_storage *a - if (err < 0) - return err; - } -- if (m->msg_name) -- m->msg_name = address; -+ m->msg_name = address; - } else { - m->msg_name = NULL; -+ m->msg_namelen = 0; - } - - size = m->msg_iovlen * sizeof(struct iovec); -@@ -107,6 +107,10 @@ EXPORT_SYMBOL(memcpy_toiovecend); - int memcpy_fromiovecend(unsigned char *kdata, const struct iovec *iov, - int offset, int len) - { -+ /* No data? Done! */ -+ if (len == 0) -+ return 0; -+ - /* Skip over the finished iovecs */ - while (offset >= iov->iov_len) { - offset -= iov->iov_len; -diff --git a/net/core/secure_seq.c b/net/core/secure_seq.c -index 897da56f3aff..ba71212f0251 100644 ---- a/net/core/secure_seq.c -+++ b/net/core/secure_seq.c -@@ -85,31 +85,6 @@ EXPORT_SYMBOL(secure_ipv6_port_ephemeral); - #endif - - #ifdef CONFIG_INET --__u32 secure_ip_id(__be32 daddr) --{ -- u32 hash[MD5_DIGEST_WORDS]; -- -- net_secret_init(); -- hash[0] = (__force __u32) daddr; -- hash[1] = net_secret[13]; -- hash[2] = net_secret[14]; -- hash[3] = net_secret[15]; -- -- md5_transform(hash, net_secret); -- -- return hash[0]; --} -- --__u32 secure_ipv6_id(const __be32 daddr[4]) --{ -- __u32 hash[4]; -- -- net_secret_init(); -- memcpy(hash, daddr, 16); -- md5_transform(hash, net_secret); -- -- return hash[0]; --} - - __u32 secure_tcp_sequence_number(__be32 saddr, __be32 daddr, - __be16 sport, __be16 dport) -diff --git a/net/core/skbuff.c b/net/core/skbuff.c -index 7f2e1fce706e..8f6391bbf509 100644 ---- a/net/core/skbuff.c -+++ b/net/core/skbuff.c -@@ -2968,9 +2968,9 @@ struct sk_buff *skb_segment(struct sk_buff *head_skb, - tail = nskb; - - __copy_skb_header(nskb, head_skb); -- nskb->mac_len = head_skb->mac_len; - - skb_headers_offset_update(nskb, skb_headroom(nskb) - headroom); -+ skb_reset_mac_len(nskb); - - skb_copy_from_linear_data_offset(head_skb, -tnl_hlen, - nskb->data - tnl_hlen, -diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c -index 9db3b877fcaf..0ffcd4d64e0a 100644 ---- a/net/ipv4/igmp.c -+++ b/net/ipv4/igmp.c -@@ -369,7 +369,7 @@ static struct sk_buff *igmpv3_newpack(struct net_device *dev, int size) - pip->saddr = fl4.saddr; - pip->protocol = IPPROTO_IGMP; - pip->tot_len = 0; /* filled in later */ -- ip_select_ident(skb, &rt->dst, NULL); -+ ip_select_ident(skb, NULL); - ((u8 *)&pip[1])[0] = IPOPT_RA; - ((u8 *)&pip[1])[1] = 4; - ((u8 *)&pip[1])[2] = 0; -@@ -714,7 +714,7 @@ static int igmp_send_report(struct in_device *in_dev, struct ip_mc_list *pmc, - iph->daddr = dst; - iph->saddr = fl4.saddr; - iph->protocol = IPPROTO_IGMP; -- ip_select_ident(skb, &rt->dst, NULL); -+ ip_select_ident(skb, NULL); - ((u8 *)&iph[1])[0] = IPOPT_RA; - ((u8 *)&iph[1])[1] = 4; - ((u8 *)&iph[1])[2] = 0; -diff --git a/net/ipv4/inetpeer.c b/net/ipv4/inetpeer.c -index 48f424465112..bf2cb4a4714b 100644 ---- a/net/ipv4/inetpeer.c -+++ b/net/ipv4/inetpeer.c -@@ -26,20 +26,7 @@ - * Theory of operations. - * We keep one entry for each peer IP address. The nodes contains long-living - * information about the peer which doesn't depend on routes. -- * At this moment this information consists only of ID field for the next -- * outgoing IP packet. This field is incremented with each packet as encoded -- * in inet_getid() function (include/net/inetpeer.h). -- * At the moment of writing this notes identifier of IP packets is generated -- * to be unpredictable using this code only for packets subjected -- * (actually or potentially) to defragmentation. I.e. DF packets less than -- * PMTU in size when local fragmentation is disabled use a constant ID and do -- * not use this code (see ip_select_ident() in include/net/ip.h). - * -- * Route cache entries hold references to our nodes. -- * New cache entries get references via lookup by destination IP address in -- * the avl tree. The reference is grabbed only when it's needed i.e. only -- * when we try to output IP packet which needs an unpredictable ID (see -- * __ip_select_ident() in net/ipv4/route.c). - * Nodes are removed only when reference counter goes to 0. - * When it's happened the node may be removed when a sufficient amount of - * time has been passed since its last use. The less-recently-used entry can -@@ -62,7 +49,6 @@ - * refcnt: atomically against modifications on other CPU; - * usually under some other lock to prevent node disappearing - * daddr: unchangeable -- * ip_id_count: atomic value (no lock needed) - */ - - static struct kmem_cache *peer_cachep __read_mostly; -@@ -497,10 +483,6 @@ relookup: - p->daddr = *daddr; - atomic_set(&p->refcnt, 1); - atomic_set(&p->rid, 0); -- atomic_set(&p->ip_id_count, -- (daddr->family == AF_INET) ? -- secure_ip_id(daddr->addr.a4) : -- secure_ipv6_id(daddr->addr.a6)); - p->metrics[RTAX_LOCK-1] = INETPEER_METRICS_NEW; - p->rate_tokens = 0; - /* 60*HZ is arbitrary, but chosen enough high so that the first -diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c -index 73c6b63bba74..ed88d781248f 100644 ---- a/net/ipv4/ip_output.c -+++ b/net/ipv4/ip_output.c -@@ -148,7 +148,7 @@ int ip_build_and_send_pkt(struct sk_buff *skb, struct sock *sk, - iph->daddr = (opt && opt->opt.srr ? opt->opt.faddr : daddr); - iph->saddr = saddr; - iph->protocol = sk->sk_protocol; -- ip_select_ident(skb, &rt->dst, sk); -+ ip_select_ident(skb, sk); - - if (opt && opt->opt.optlen) { - iph->ihl += opt->opt.optlen>>2; -@@ -386,8 +386,7 @@ packet_routed: - ip_options_build(skb, &inet_opt->opt, inet->inet_daddr, rt, 0); - } - -- ip_select_ident_more(skb, &rt->dst, sk, -- (skb_shinfo(skb)->gso_segs ?: 1) - 1); -+ ip_select_ident_segs(skb, sk, skb_shinfo(skb)->gso_segs ?: 1); - - skb->priority = sk->sk_priority; - skb->mark = sk->sk_mark; -@@ -1338,7 +1337,7 @@ struct sk_buff *__ip_make_skb(struct sock *sk, - iph->ttl = ttl; - iph->protocol = sk->sk_protocol; - ip_copy_addrs(iph, fl4); -- ip_select_ident(skb, &rt->dst, sk); -+ ip_select_ident(skb, sk); - - if (opt) { - iph->ihl += opt->optlen>>2; -diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c -index 62cd9e0ae35b..0a4af0920af3 100644 ---- a/net/ipv4/ip_tunnel.c -+++ b/net/ipv4/ip_tunnel.c -@@ -69,23 +69,25 @@ static unsigned int ip_tunnel_hash(__be32 key, __be32 remote) - } - - static void __tunnel_dst_set(struct ip_tunnel_dst *idst, -- struct dst_entry *dst) -+ struct dst_entry *dst, __be32 saddr) - { - struct dst_entry *old_dst; - - dst_clone(dst); - old_dst = xchg((__force struct dst_entry **)&idst->dst, dst); - dst_release(old_dst); -+ idst->saddr = saddr; - } - --static void tunnel_dst_set(struct ip_tunnel *t, struct dst_entry *dst) -+static void tunnel_dst_set(struct ip_tunnel *t, -+ struct dst_entry *dst, __be32 saddr) - { -- __tunnel_dst_set(this_cpu_ptr(t->dst_cache), dst); -+ __tunnel_dst_set(this_cpu_ptr(t->dst_cache), dst, saddr); - } - - static void tunnel_dst_reset(struct ip_tunnel *t) - { -- tunnel_dst_set(t, NULL); -+ tunnel_dst_set(t, NULL, 0); - } - - void ip_tunnel_dst_reset_all(struct ip_tunnel *t) -@@ -93,20 +95,25 @@ void ip_tunnel_dst_reset_all(struct ip_tunnel *t) - int i; - - for_each_possible_cpu(i) -- __tunnel_dst_set(per_cpu_ptr(t->dst_cache, i), NULL); -+ __tunnel_dst_set(per_cpu_ptr(t->dst_cache, i), NULL, 0); - } - EXPORT_SYMBOL(ip_tunnel_dst_reset_all); - --static struct rtable *tunnel_rtable_get(struct ip_tunnel *t, u32 cookie) -+static struct rtable *tunnel_rtable_get(struct ip_tunnel *t, -+ u32 cookie, __be32 *saddr) - { -+ struct ip_tunnel_dst *idst; - struct dst_entry *dst; - - rcu_read_lock(); -- dst = rcu_dereference(this_cpu_ptr(t->dst_cache)->dst); -+ idst = this_cpu_ptr(t->dst_cache); -+ dst = rcu_dereference(idst->dst); - if (dst && !atomic_inc_not_zero(&dst->__refcnt)) - dst = NULL; - if (dst) { -- if (dst->obsolete && dst->ops->check(dst, cookie) == NULL) { -+ if (!dst->obsolete || dst->ops->check(dst, cookie)) { -+ *saddr = idst->saddr; -+ } else { - tunnel_dst_reset(t); - dst_release(dst); - dst = NULL; -@@ -362,7 +369,7 @@ static int ip_tunnel_bind_dev(struct net_device *dev) - - if (!IS_ERR(rt)) { - tdev = rt->dst.dev; -- tunnel_dst_set(tunnel, &rt->dst); -+ tunnel_dst_set(tunnel, &rt->dst, fl4.saddr); - ip_rt_put(rt); - } - if (dev->type != ARPHRD_ETHER) -@@ -606,7 +613,7 @@ void ip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev, - init_tunnel_flow(&fl4, protocol, dst, tnl_params->saddr, - tunnel->parms.o_key, RT_TOS(tos), tunnel->parms.link); - -- rt = connected ? tunnel_rtable_get(tunnel, 0) : NULL; -+ rt = connected ? tunnel_rtable_get(tunnel, 0, &fl4.saddr) : NULL; - - if (!rt) { - rt = ip_route_output_key(tunnel->net, &fl4); -@@ -616,7 +623,7 @@ void ip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev, - goto tx_error; - } - if (connected) -- tunnel_dst_set(tunnel, &rt->dst); -+ tunnel_dst_set(tunnel, &rt->dst, fl4.saddr); - } - - if (rt->dst.dev == dev) { -diff --git a/net/ipv4/ip_tunnel_core.c b/net/ipv4/ip_tunnel_core.c -index 8d69626f2206..65b664d30fa1 100644 ---- a/net/ipv4/ip_tunnel_core.c -+++ b/net/ipv4/ip_tunnel_core.c -@@ -74,7 +74,7 @@ int iptunnel_xmit(struct rtable *rt, struct sk_buff *skb, - iph->daddr = dst; - iph->saddr = src; - iph->ttl = ttl; -- __ip_select_ident(iph, &rt->dst, (skb_shinfo(skb)->gso_segs ?: 1) - 1); -+ __ip_select_ident(iph, skb_shinfo(skb)->gso_segs ?: 1); - - err = ip_local_out(skb); - if (unlikely(net_xmit_eval(err))) -diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c -index 28863570dd60..1149fc2290e2 100644 ---- a/net/ipv4/ipmr.c -+++ b/net/ipv4/ipmr.c -@@ -1663,7 +1663,7 @@ static void ip_encap(struct sk_buff *skb, __be32 saddr, __be32 daddr) - iph->protocol = IPPROTO_IPIP; - iph->ihl = 5; - iph->tot_len = htons(skb->len); -- ip_select_ident(skb, skb_dst(skb), NULL); -+ ip_select_ident(skb, NULL); - ip_send_check(iph); - - memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt)); -diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c -index c04518f4850a..11c8d81fdc59 100644 ---- a/net/ipv4/raw.c -+++ b/net/ipv4/raw.c -@@ -389,7 +389,7 @@ static int raw_send_hdrinc(struct sock *sk, struct flowi4 *fl4, - iph->check = 0; - iph->tot_len = htons(length); - if (!iph->id) -- ip_select_ident(skb, &rt->dst, NULL); -+ ip_select_ident(skb, NULL); - - iph->check = ip_fast_csum((unsigned char *)iph, iph->ihl); - } -diff --git a/net/ipv4/route.c b/net/ipv4/route.c -index 031553f8a306..ca5a01ed8ed6 100644 ---- a/net/ipv4/route.c -+++ b/net/ipv4/route.c -@@ -89,6 +89,7 @@ - #include <linux/rcupdate.h> - #include <linux/times.h> - #include <linux/slab.h> -+#include <linux/jhash.h> - #include <net/dst.h> - #include <net/net_namespace.h> - #include <net/protocol.h> -@@ -462,39 +463,45 @@ static struct neighbour *ipv4_neigh_lookup(const struct dst_entry *dst, - return neigh_create(&arp_tbl, pkey, dev); - } - --/* -- * Peer allocation may fail only in serious out-of-memory conditions. However -- * we still can generate some output. -- * Random ID selection looks a bit dangerous because we have no chances to -- * select ID being unique in a reasonable period of time. -- * But broken packet identifier may be better than no packet at all. -+#define IP_IDENTS_SZ 2048u -+struct ip_ident_bucket { -+ atomic_t id; -+ u32 stamp32; -+}; -+ -+static struct ip_ident_bucket *ip_idents __read_mostly; -+ -+/* In order to protect privacy, we add a perturbation to identifiers -+ * if one generator is seldom used. This makes hard for an attacker -+ * to infer how many packets were sent between two points in time. - */ --static void ip_select_fb_ident(struct iphdr *iph) -+u32 ip_idents_reserve(u32 hash, int segs) - { -- static DEFINE_SPINLOCK(ip_fb_id_lock); -- static u32 ip_fallback_id; -- u32 salt; -+ struct ip_ident_bucket *bucket = ip_idents + hash % IP_IDENTS_SZ; -+ u32 old = ACCESS_ONCE(bucket->stamp32); -+ u32 now = (u32)jiffies; -+ u32 delta = 0; -+ -+ if (old != now && cmpxchg(&bucket->stamp32, old, now) == old) -+ delta = prandom_u32_max(now - old); - -- spin_lock_bh(&ip_fb_id_lock); -- salt = secure_ip_id((__force __be32)ip_fallback_id ^ iph->daddr); -- iph->id = htons(salt & 0xFFFF); -- ip_fallback_id = salt; -- spin_unlock_bh(&ip_fb_id_lock); -+ return atomic_add_return(segs + delta, &bucket->id) - segs; - } -+EXPORT_SYMBOL(ip_idents_reserve); - --void __ip_select_ident(struct iphdr *iph, struct dst_entry *dst, int more) -+void __ip_select_ident(struct iphdr *iph, int segs) - { -- struct net *net = dev_net(dst->dev); -- struct inet_peer *peer; -+ static u32 ip_idents_hashrnd __read_mostly; -+ u32 hash, id; - -- peer = inet_getpeer_v4(net->ipv4.peers, iph->daddr, 1); -- if (peer) { -- iph->id = htons(inet_getid(peer, more)); -- inet_putpeer(peer); -- return; -- } -+ net_get_random_once(&ip_idents_hashrnd, sizeof(ip_idents_hashrnd)); - -- ip_select_fb_ident(iph); -+ hash = jhash_3words((__force u32)iph->daddr, -+ (__force u32)iph->saddr, -+ iph->protocol, -+ ip_idents_hashrnd); -+ id = ip_idents_reserve(hash, segs); -+ iph->id = htons(id); - } - EXPORT_SYMBOL(__ip_select_ident); - -@@ -2718,6 +2725,12 @@ int __init ip_rt_init(void) - { - int rc = 0; - -+ ip_idents = kmalloc(IP_IDENTS_SZ * sizeof(*ip_idents), GFP_KERNEL); -+ if (!ip_idents) -+ panic("IP: failed to allocate ip_idents\n"); -+ -+ prandom_bytes(ip_idents, IP_IDENTS_SZ * sizeof(*ip_idents)); -+ - #ifdef CONFIG_IP_ROUTE_CLASSID - ip_rt_acct = __alloc_percpu(256 * sizeof(struct ip_rt_acct), __alignof__(struct ip_rt_acct)); - if (!ip_rt_acct) -diff --git a/net/ipv4/tcp_vegas.c b/net/ipv4/tcp_vegas.c -index 06cae62bf208..6b1a5fd60598 100644 ---- a/net/ipv4/tcp_vegas.c -+++ b/net/ipv4/tcp_vegas.c -@@ -219,7 +219,8 @@ static void tcp_vegas_cong_avoid(struct sock *sk, u32 ack, u32 acked, - * This is: - * (actual rate in segments) * baseRTT - */ -- target_cwnd = tp->snd_cwnd * vegas->baseRTT / rtt; -+ target_cwnd = (u64)tp->snd_cwnd * vegas->baseRTT; -+ do_div(target_cwnd, rtt); - - /* Calculate the difference between the window we had, - * and the window we would like to have. This quantity -diff --git a/net/ipv4/tcp_veno.c b/net/ipv4/tcp_veno.c -index 326475a94865..603ad498e18a 100644 ---- a/net/ipv4/tcp_veno.c -+++ b/net/ipv4/tcp_veno.c -@@ -145,7 +145,7 @@ static void tcp_veno_cong_avoid(struct sock *sk, u32 ack, u32 acked, - - rtt = veno->minrtt; - -- target_cwnd = (tp->snd_cwnd * veno->basertt); -+ target_cwnd = (u64)tp->snd_cwnd * veno->basertt; - target_cwnd <<= V_PARAM_SHIFT; - do_div(target_cwnd, rtt); - -diff --git a/net/ipv4/xfrm4_mode_tunnel.c b/net/ipv4/xfrm4_mode_tunnel.c -index 31b18152528f..1f564a1487a3 100644 ---- a/net/ipv4/xfrm4_mode_tunnel.c -+++ b/net/ipv4/xfrm4_mode_tunnel.c -@@ -117,12 +117,12 @@ static int xfrm4_mode_tunnel_output(struct xfrm_state *x, struct sk_buff *skb) - - top_iph->frag_off = (flags & XFRM_STATE_NOPMTUDISC) ? - 0 : (XFRM_MODE_SKB_CB(skb)->frag_off & htons(IP_DF)); -- ip_select_ident(skb, dst->child, NULL); - - top_iph->ttl = ip4_dst_hoplimit(dst->child); - - top_iph->saddr = x->props.saddr.a4; - top_iph->daddr = x->id.daddr.a4; -+ ip_select_ident(skb, NULL); - - return 0; - } -diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c -index a62b610307ec..073e5a6fc631 100644 ---- a/net/ipv6/ip6_output.c -+++ b/net/ipv6/ip6_output.c -@@ -537,6 +537,20 @@ static void ip6_copy_metadata(struct sk_buff *to, struct sk_buff *from) - skb_copy_secmark(to, from); - } - -+static void ipv6_select_ident(struct frag_hdr *fhdr, struct rt6_info *rt) -+{ -+ static u32 ip6_idents_hashrnd __read_mostly; -+ u32 hash, id; -+ -+ net_get_random_once(&ip6_idents_hashrnd, sizeof(ip6_idents_hashrnd)); -+ -+ hash = __ipv6_addr_jhash(&rt->rt6i_dst.addr, ip6_idents_hashrnd); -+ hash = __ipv6_addr_jhash(&rt->rt6i_src.addr, hash); -+ -+ id = ip_idents_reserve(hash, 1); -+ fhdr->identification = htonl(id); -+} -+ - int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *)) - { - struct sk_buff *frag; -diff --git a/net/ipv6/output_core.c b/net/ipv6/output_core.c -index b31a01263185..798eb0f79078 100644 ---- a/net/ipv6/output_core.c -+++ b/net/ipv6/output_core.c -@@ -7,29 +7,6 @@ - #include <net/ip6_fib.h> - #include <net/addrconf.h> - --void ipv6_select_ident(struct frag_hdr *fhdr, struct rt6_info *rt) --{ -- static atomic_t ipv6_fragmentation_id; -- int ident; -- --#if IS_ENABLED(CONFIG_IPV6) -- if (rt && !(rt->dst.flags & DST_NOPEER)) { -- struct inet_peer *peer; -- struct net *net; -- -- net = dev_net(rt->dst.dev); -- peer = inet_getpeer_v6(net->ipv6.peers, &rt->rt6i_dst.addr, 1); -- if (peer) { -- fhdr->identification = htonl(inet_getid(peer, 0)); -- inet_putpeer(peer); -- return; -- } -- } --#endif -- ident = atomic_inc_return(&ipv6_fragmentation_id); -- fhdr->identification = htonl(ident); --} --EXPORT_SYMBOL(ipv6_select_ident); - - int ip6_find_1stfragopt(struct sk_buff *skb, u8 **nexthdr) - { -diff --git a/net/netfilter/ipvs/ip_vs_xmit.c b/net/netfilter/ipvs/ip_vs_xmit.c -index c47444e4cf8c..7f0e1cf2d7e8 100644 ---- a/net/netfilter/ipvs/ip_vs_xmit.c -+++ b/net/netfilter/ipvs/ip_vs_xmit.c -@@ -883,7 +883,7 @@ ip_vs_tunnel_xmit(struct sk_buff *skb, struct ip_vs_conn *cp, - iph->daddr = cp->daddr.ip; - iph->saddr = saddr; - iph->ttl = old_iph->ttl; -- ip_select_ident(skb, &rt->dst, NULL); -+ ip_select_ident(skb, NULL); - - /* Another hack: avoid icmp_send in ip_fragment */ - skb->local_df = 1; -diff --git a/net/sctp/associola.c b/net/sctp/associola.c -index a4d570126f5d..5d97d8fe4be7 100644 ---- a/net/sctp/associola.c -+++ b/net/sctp/associola.c -@@ -1151,6 +1151,7 @@ void sctp_assoc_update(struct sctp_association *asoc, - asoc->c = new->c; - asoc->peer.rwnd = new->peer.rwnd; - asoc->peer.sack_needed = new->peer.sack_needed; -+ asoc->peer.auth_capable = new->peer.auth_capable; - asoc->peer.i = new->peer.i; - sctp_tsnmap_init(&asoc->peer.tsn_map, SCTP_TSN_MAP_INITIAL, - asoc->peer.i.initial_tsn, GFP_ATOMIC); -diff --git a/net/sctp/output.c b/net/sctp/output.c -index 0f4d15fc2627..8267b06c3646 100644 ---- a/net/sctp/output.c -+++ b/net/sctp/output.c -@@ -599,7 +599,7 @@ out: - return err; - no_route: - kfree_skb(nskb); -- IP_INC_STATS_BH(sock_net(asoc->base.sk), IPSTATS_MIB_OUTNOROUTES); -+ IP_INC_STATS(sock_net(asoc->base.sk), IPSTATS_MIB_OUTNOROUTES); - - /* FIXME: Returning the 'err' will effect all the associations - * associated with a socket, although only one of the paths of the -diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c -index b10d04fa3933..3bea4ddc699d 100644 ---- a/net/xfrm/xfrm_user.c -+++ b/net/xfrm/xfrm_user.c -@@ -176,9 +176,7 @@ static int verify_newsa_info(struct xfrm_usersa_info *p, - attrs[XFRMA_ALG_AEAD] || - attrs[XFRMA_ALG_CRYPT] || - attrs[XFRMA_ALG_COMP] || -- attrs[XFRMA_TFCPAD] || -- (ntohl(p->id.spi) >= 0x10000)) -- -+ attrs[XFRMA_TFCPAD]) - goto out; - break; - -@@ -206,7 +204,8 @@ static int verify_newsa_info(struct xfrm_usersa_info *p, - attrs[XFRMA_ALG_AUTH] || - attrs[XFRMA_ALG_AUTH_TRUNC] || - attrs[XFRMA_ALG_CRYPT] || -- attrs[XFRMA_TFCPAD]) -+ attrs[XFRMA_TFCPAD] || -+ (ntohl(p->id.spi) >= 0x10000)) - goto out; - break; - diff --git a/projects/imx6/patches/linux/linux-000-patch-3.14.17-18.patch b/projects/imx6/patches/linux/linux-000-patch-3.14.17-18.patch deleted file mode 100644 index 077896b3121..00000000000 --- a/projects/imx6/patches/linux/linux-000-patch-3.14.17-18.patch +++ /dev/null @@ -1,3331 +0,0 @@ -diff --git a/Documentation/sound/alsa/ALSA-Configuration.txt b/Documentation/sound/alsa/ALSA-Configuration.txt -index b8dd0df76952..0fd40b15e2d5 100644 ---- a/Documentation/sound/alsa/ALSA-Configuration.txt -+++ b/Documentation/sound/alsa/ALSA-Configuration.txt -@@ -2026,8 +2026,8 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. - ------------------- - - Module for sound cards based on the Asus AV66/AV100/AV200 chips, -- i.e., Xonar D1, DX, D2, D2X, DS, Essence ST (Deluxe), Essence STX, -- HDAV1.3 (Deluxe), and HDAV1.3 Slim. -+ i.e., Xonar D1, DX, D2, D2X, DS, DSX, Essence ST (Deluxe), -+ Essence STX (II), HDAV1.3 (Deluxe), and HDAV1.3 Slim. - - This module supports autoprobe and multiple cards. - -diff --git a/Documentation/stable_kernel_rules.txt b/Documentation/stable_kernel_rules.txt -index b0714d8f678a..8dfb6a5f427d 100644 ---- a/Documentation/stable_kernel_rules.txt -+++ b/Documentation/stable_kernel_rules.txt -@@ -29,6 +29,9 @@ Rules on what kind of patches are accepted, and which ones are not, into the - - Procedure for submitting patches to the -stable tree: - -+ - If the patch covers files in net/ or drivers/net please follow netdev stable -+ submission guidelines as described in -+ Documentation/networking/netdev-FAQ.txt - - Send the patch, after verifying that it follows the above rules, to - stable@vger.kernel.org. You must note the upstream commit ID in the - changelog of your submission, as well as the kernel version you wish -diff --git a/Makefile b/Makefile -index 12aac0325888..05279d4f44c9 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,6 +1,6 @@ - VERSION = 3 - PATCHLEVEL = 14 --SUBLEVEL = 17 -+SUBLEVEL = 18 - EXTRAVERSION = - NAME = Remembering Coco - -diff --git a/arch/arm/boot/dts/am4372.dtsi b/arch/arm/boot/dts/am4372.dtsi -index c6bd4d986c29..8775681df7ed 100644 ---- a/arch/arm/boot/dts/am4372.dtsi -+++ b/arch/arm/boot/dts/am4372.dtsi -@@ -161,9 +161,6 @@ - ti,hwmods = "mailbox"; - ti,mbox-num-users = <4>; - ti,mbox-num-fifos = <8>; -- ti,mbox-names = "wkup_m3"; -- ti,mbox-data = <0 0 0 0>; -- status = "disabled"; - }; - - timer1: timer@44e31000 { -diff --git a/arch/arm/include/asm/unistd.h b/arch/arm/include/asm/unistd.h -index 43876245fc57..21ca0cebcab0 100644 ---- a/arch/arm/include/asm/unistd.h -+++ b/arch/arm/include/asm/unistd.h -@@ -15,7 +15,17 @@ - - #include <uapi/asm/unistd.h> - -+/* -+ * This may need to be greater than __NR_last_syscall+1 in order to -+ * account for the padding in the syscall table -+ */ - #define __NR_syscalls (384) -+ -+/* -+ * *NOTE*: This is a ghost syscall private to the kernel. Only the -+ * __kuser_cmpxchg code in entry-armv.S should be aware of its -+ * existence. Don't ever use this from user code. -+ */ - #define __ARM_NR_cmpxchg (__ARM_NR_BASE+0x00fff0) - - #define __ARCH_WANT_STAT64 -diff --git a/arch/arm/include/uapi/asm/unistd.h b/arch/arm/include/uapi/asm/unistd.h -index fb5584d0cc05..c3776331f407 100644 ---- a/arch/arm/include/uapi/asm/unistd.h -+++ b/arch/arm/include/uapi/asm/unistd.h -@@ -410,11 +410,6 @@ - #define __NR_sched_getattr (__NR_SYSCALL_BASE+381) - - /* -- * This may need to be greater than __NR_last_syscall+1 in order to -- * account for the padding in the syscall table -- */ -- --/* - * The following SWIs are ARM private. - */ - #define __ARM_NR_BASE (__NR_SYSCALL_BASE+0x0f0000) -@@ -425,12 +420,6 @@ - #define __ARM_NR_set_tls (__ARM_NR_BASE+5) - - /* -- * *NOTE*: This is a ghost syscall private to the kernel. Only the -- * __kuser_cmpxchg code in entry-armv.S should be aware of its -- * existence. Don't ever use this from user code. -- */ -- --/* - * The following syscalls are obsolete and no longer available for EABI. - */ - #if !defined(__KERNEL__) -diff --git a/arch/arm/mach-omap2/control.c b/arch/arm/mach-omap2/control.c -index 44bb4d544dcf..89cde0786d25 100644 ---- a/arch/arm/mach-omap2/control.c -+++ b/arch/arm/mach-omap2/control.c -@@ -314,7 +314,8 @@ void omap3_save_scratchpad_contents(void) - scratchpad_contents.public_restore_ptr = - virt_to_phys(omap3_restore_3630); - else if (omap_rev() != OMAP3430_REV_ES3_0 && -- omap_rev() != OMAP3430_REV_ES3_1) -+ omap_rev() != OMAP3430_REV_ES3_1 && -+ omap_rev() != OMAP3430_REV_ES3_1_2) - scratchpad_contents.public_restore_ptr = - virt_to_phys(omap3_restore); - else -diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c -index 66c60fe1104c..c914b0052fb9 100644 ---- a/arch/arm/mach-omap2/omap_hwmod.c -+++ b/arch/arm/mach-omap2/omap_hwmod.c -@@ -2185,6 +2185,8 @@ static int _enable(struct omap_hwmod *oh) - oh->mux->pads_dynamic))) { - omap_hwmod_mux(oh->mux, _HWMOD_STATE_ENABLED); - _reconfigure_io_chain(); -+ } else if (oh->flags & HWMOD_FORCE_MSTANDBY) { -+ _reconfigure_io_chain(); - } - - _add_initiator_dep(oh, mpu_oh); -@@ -2291,6 +2293,8 @@ static int _idle(struct omap_hwmod *oh) - if (oh->mux && oh->mux->pads_dynamic) { - omap_hwmod_mux(oh->mux, _HWMOD_STATE_IDLE); - _reconfigure_io_chain(); -+ } else if (oh->flags & HWMOD_FORCE_MSTANDBY) { -+ _reconfigure_io_chain(); - } - - oh->_state = _HWMOD_STATE_IDLE; -diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c -index 3b2b4fb3585b..beedaf0c5e75 100644 ---- a/arch/powerpc/platforms/powernv/pci-ioda.c -+++ b/arch/powerpc/platforms/powernv/pci-ioda.c -@@ -491,6 +491,7 @@ static int pnv_pci_ioda_dma_set_mask(struct pnv_phb *phb, - set_dma_ops(&pdev->dev, &dma_iommu_ops); - set_iommu_table_base(&pdev->dev, &pe->tce32_table); - } -+ *pdev->dev.dma_mask = dma_mask; - return 0; - } - -diff --git a/arch/powerpc/platforms/pseries/pci_dlpar.c b/arch/powerpc/platforms/pseries/pci_dlpar.c -index efe61374f6ea..e68922b0d4f5 100644 ---- a/arch/powerpc/platforms/pseries/pci_dlpar.c -+++ b/arch/powerpc/platforms/pseries/pci_dlpar.c -@@ -118,10 +118,10 @@ int remove_phb_dynamic(struct pci_controller *phb) - } - } - -- /* Unregister the bridge device from sysfs and remove the PCI bus */ -- device_unregister(b->bridge); -+ /* Remove the PCI bus and unregister the bridge device from sysfs */ - phb->bus = NULL; - pci_remove_bus(b); -+ device_unregister(b->bridge); - - /* Now release the IO resource */ - if (res->flags & IORESOURCE_IO) -diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig -index c718d9f25900..e4098912fef2 100644 ---- a/arch/x86/Kconfig -+++ b/arch/x86/Kconfig -@@ -1597,6 +1597,7 @@ config EFI - config EFI_STUB - bool "EFI stub support" - depends on EFI -+ select RELOCATABLE - ---help--- - This kernel feature allows a bzImage to be loaded directly - by EFI firmware without the use of a bootloader. -diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h -index 3092300a07cd..d71d5ac78e42 100644 ---- a/arch/x86/include/asm/kvm_host.h -+++ b/arch/x86/include/asm/kvm_host.h -@@ -99,7 +99,7 @@ static inline gfn_t gfn_to_index(gfn_t gfn, gfn_t base_gfn, int level) - #define KVM_REFILL_PAGES 25 - #define KVM_MAX_CPUID_ENTRIES 80 - #define KVM_NR_FIXED_MTRR_REGION 88 --#define KVM_NR_VAR_MTRR 10 -+#define KVM_NR_VAR_MTRR 8 - - #define ASYNC_PF_PER_VCPU 64 - -diff --git a/arch/x86/kernel/resource.c b/arch/x86/kernel/resource.c -index 2a26819bb6a8..80eab01c1a68 100644 ---- a/arch/x86/kernel/resource.c -+++ b/arch/x86/kernel/resource.c -@@ -37,10 +37,12 @@ static void remove_e820_regions(struct resource *avail) - - void arch_remove_reservations(struct resource *avail) - { -- /* Trim out BIOS areas (low 1MB and high 2MB) and E820 regions */ -+ /* -+ * Trim out BIOS area (high 2MB) and E820 regions. We do not remove -+ * the low 1MB unconditionally, as this area is needed for some ISA -+ * cards requiring a memory range, e.g. the i82365 PCMCIA controller. -+ */ - if (avail->flags & IORESOURCE_MEM) { -- if (avail->start < BIOS_END) -- avail->start = BIOS_END; - resource_clip(avail, BIOS_ROM_BASE, BIOS_ROM_END); - - remove_e820_regions(avail); -diff --git a/arch/x86/kernel/vsyscall_64.c b/arch/x86/kernel/vsyscall_64.c -index 1f96f9347ed9..09ce23ae370c 100644 ---- a/arch/x86/kernel/vsyscall_64.c -+++ b/arch/x86/kernel/vsyscall_64.c -@@ -125,10 +125,10 @@ static void warn_bad_vsyscall(const char *level, struct pt_regs *regs, - if (!show_unhandled_signals) - return; - -- pr_notice_ratelimited("%s%s[%d] %s ip:%lx cs:%lx sp:%lx ax:%lx si:%lx di:%lx\n", -- level, current->comm, task_pid_nr(current), -- message, regs->ip, regs->cs, -- regs->sp, regs->ax, regs->si, regs->di); -+ printk_ratelimited("%s%s[%d] %s ip:%lx cs:%lx sp:%lx ax:%lx si:%lx di:%lx\n", -+ level, current->comm, task_pid_nr(current), -+ message, regs->ip, regs->cs, -+ regs->sp, regs->ax, regs->si, regs->di); - } - - static int addr_to_vsyscall_nr(unsigned long addr) -diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c -index 07ffca0a89e9..7bff3e2a7a11 100644 ---- a/arch/x86/kvm/emulate.c -+++ b/arch/x86/kvm/emulate.c -@@ -2006,6 +2006,7 @@ static int em_ret_far(struct x86_emulate_ctxt *ctxt) - { - int rc; - unsigned long cs; -+ int cpl = ctxt->ops->cpl(ctxt); - - rc = emulate_pop(ctxt, &ctxt->_eip, ctxt->op_bytes); - if (rc != X86EMUL_CONTINUE) -@@ -2015,6 +2016,9 @@ static int em_ret_far(struct x86_emulate_ctxt *ctxt) - rc = emulate_pop(ctxt, &cs, ctxt->op_bytes); - if (rc != X86EMUL_CONTINUE) - return rc; -+ /* Outer-privilege level return is not implemented */ -+ if (ctxt->mode >= X86EMUL_MODE_PROT16 && (cs & 3) > cpl) -+ return X86EMUL_UNHANDLEABLE; - rc = load_segment_descriptor(ctxt, (u16)cs, VCPU_SREG_CS); - return rc; - } -diff --git a/arch/x86/kvm/irq.c b/arch/x86/kvm/irq.c -index 484bc874688b..3ec38cb56bd5 100644 ---- a/arch/x86/kvm/irq.c -+++ b/arch/x86/kvm/irq.c -@@ -108,7 +108,7 @@ int kvm_cpu_get_interrupt(struct kvm_vcpu *v) - - vector = kvm_cpu_get_extint(v); - -- if (kvm_apic_vid_enabled(v->kvm) || vector != -1) -+ if (vector != -1) - return vector; /* PIC */ - - return kvm_get_apic_interrupt(v); /* APIC */ -diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c -index 006911858174..453e5fbbb7ae 100644 ---- a/arch/x86/kvm/lapic.c -+++ b/arch/x86/kvm/lapic.c -@@ -352,25 +352,46 @@ static inline int apic_find_highest_irr(struct kvm_lapic *apic) - - static inline void apic_clear_irr(int vec, struct kvm_lapic *apic) - { -- apic->irr_pending = false; -+ struct kvm_vcpu *vcpu; -+ -+ vcpu = apic->vcpu; -+ - apic_clear_vector(vec, apic->regs + APIC_IRR); -- if (apic_search_irr(apic) != -1) -- apic->irr_pending = true; -+ if (unlikely(kvm_apic_vid_enabled(vcpu->kvm))) -+ /* try to update RVI */ -+ kvm_make_request(KVM_REQ_EVENT, vcpu); -+ else { -+ vec = apic_search_irr(apic); -+ apic->irr_pending = (vec != -1); -+ } - } - - static inline void apic_set_isr(int vec, struct kvm_lapic *apic) - { -- /* Note that we never get here with APIC virtualization enabled. */ -+ struct kvm_vcpu *vcpu; -+ -+ if (__apic_test_and_set_vector(vec, apic->regs + APIC_ISR)) -+ return; -+ -+ vcpu = apic->vcpu; - -- if (!__apic_test_and_set_vector(vec, apic->regs + APIC_ISR)) -- ++apic->isr_count; -- BUG_ON(apic->isr_count > MAX_APIC_VECTOR); - /* -- * ISR (in service register) bit is set when injecting an interrupt. -- * The highest vector is injected. Thus the latest bit set matches -- * the highest bit in ISR. -+ * With APIC virtualization enabled, all caching is disabled -+ * because the processor can modify ISR under the hood. Instead -+ * just set SVI. - */ -- apic->highest_isr_cache = vec; -+ if (unlikely(kvm_apic_vid_enabled(vcpu->kvm))) -+ kvm_x86_ops->hwapic_isr_update(vcpu->kvm, vec); -+ else { -+ ++apic->isr_count; -+ BUG_ON(apic->isr_count > MAX_APIC_VECTOR); -+ /* -+ * ISR (in service register) bit is set when injecting an interrupt. -+ * The highest vector is injected. Thus the latest bit set matches -+ * the highest bit in ISR. -+ */ -+ apic->highest_isr_cache = vec; -+ } - } - - static inline int apic_find_highest_isr(struct kvm_lapic *apic) -@@ -1627,11 +1648,16 @@ int kvm_get_apic_interrupt(struct kvm_vcpu *vcpu) - int vector = kvm_apic_has_interrupt(vcpu); - struct kvm_lapic *apic = vcpu->arch.apic; - -- /* Note that we never get here with APIC virtualization enabled. */ -- - if (vector == -1) - return -1; - -+ /* -+ * We get here even with APIC virtualization enabled, if doing -+ * nested virtualization and L1 runs with the "acknowledge interrupt -+ * on exit" mode. Then we cannot inject the interrupt via RVI, -+ * because the process would deliver it through the IDT. -+ */ -+ - apic_set_isr(vector, apic); - apic_update_ppr(apic); - apic_clear_irr(vector, apic); -diff --git a/arch/x86/pci/i386.c b/arch/x86/pci/i386.c -index db6b1ab43255..96a159afe3c6 100644 ---- a/arch/x86/pci/i386.c -+++ b/arch/x86/pci/i386.c -@@ -162,6 +162,10 @@ pcibios_align_resource(void *data, const struct resource *res, - return start; - if (start & 0x300) - start = (start + 0x3ff) & ~0x3ff; -+ } else if (res->flags & IORESOURCE_MEM) { -+ /* The low 1MB range is reserved for ISA cards */ -+ if (start < BIOS_END) -+ start = BIOS_END; - } - return start; - } -diff --git a/arch/x86/xen/grant-table.c b/arch/x86/xen/grant-table.c -index c98583588580..5b406fc45674 100644 ---- a/arch/x86/xen/grant-table.c -+++ b/arch/x86/xen/grant-table.c -@@ -134,6 +134,7 @@ static int __init xlated_setup_gnttab_pages(void) - { - struct page **pages; - xen_pfn_t *pfns; -+ void *vaddr; - int rc; - unsigned int i; - unsigned long nr_grant_frames = gnttab_max_grant_frames(); -@@ -159,21 +160,20 @@ static int __init xlated_setup_gnttab_pages(void) - for (i = 0; i < nr_grant_frames; i++) - pfns[i] = page_to_pfn(pages[i]); - -- rc = arch_gnttab_map_shared(pfns, nr_grant_frames, nr_grant_frames, -- &xen_auto_xlat_grant_frames.vaddr); -- -- if (rc) { -+ vaddr = vmap(pages, nr_grant_frames, 0, PAGE_KERNEL); -+ if (!vaddr) { - pr_warn("%s Couldn't map %ld pfns rc:%d\n", __func__, - nr_grant_frames, rc); - free_xenballooned_pages(nr_grant_frames, pages); - kfree(pages); - kfree(pfns); -- return rc; -+ return -ENOMEM; - } - kfree(pages); - - xen_auto_xlat_grant_frames.pfn = pfns; - xen_auto_xlat_grant_frames.count = nr_grant_frames; -+ xen_auto_xlat_grant_frames.vaddr = vaddr; - - return 0; - } -diff --git a/arch/x86/xen/time.c b/arch/x86/xen/time.c -index 7b78f88c1707..5718b0b58b60 100644 ---- a/arch/x86/xen/time.c -+++ b/arch/x86/xen/time.c -@@ -444,7 +444,7 @@ void xen_setup_timer(int cpu) - - irq = bind_virq_to_irqhandler(VIRQ_TIMER, cpu, xen_timer_interrupt, - IRQF_PERCPU|IRQF_NOBALANCING|IRQF_TIMER| -- IRQF_FORCE_RESUME, -+ IRQF_FORCE_RESUME|IRQF_EARLY_RESUME, - name, NULL); - (void)xen_set_irq_priority(irq, XEN_IRQ_PRIORITY_MAX); - -diff --git a/drivers/char/tpm/tpm_i2c_stm_st33.c b/drivers/char/tpm/tpm_i2c_stm_st33.c -index 5b0dd8ef74c0..be9af2e6ca5a 100644 ---- a/drivers/char/tpm/tpm_i2c_stm_st33.c -+++ b/drivers/char/tpm/tpm_i2c_stm_st33.c -@@ -715,6 +715,7 @@ tpm_st33_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id) - } - - tpm_get_timeouts(chip); -+ tpm_do_selftest(chip); - - dev_info(chip->dev, "TPM I2C Initialized\n"); - return 0; -diff --git a/drivers/crypto/ux500/cryp/cryp_core.c b/drivers/crypto/ux500/cryp/cryp_core.c -index a999f537228f..92105f3dc8e0 100644 ---- a/drivers/crypto/ux500/cryp/cryp_core.c -+++ b/drivers/crypto/ux500/cryp/cryp_core.c -@@ -190,7 +190,7 @@ static void add_session_id(struct cryp_ctx *ctx) - static irqreturn_t cryp_interrupt_handler(int irq, void *param) - { - struct cryp_ctx *ctx; -- int i; -+ int count; - struct cryp_device_data *device_data; - - if (param == NULL) { -@@ -215,12 +215,11 @@ static irqreturn_t cryp_interrupt_handler(int irq, void *param) - if (cryp_pending_irq_src(device_data, - CRYP_IRQ_SRC_OUTPUT_FIFO)) { - if (ctx->outlen / ctx->blocksize > 0) { -- for (i = 0; i < ctx->blocksize / 4; i++) { -- *(ctx->outdata) = readl_relaxed( -- &device_data->base->dout); -- ctx->outdata += 4; -- ctx->outlen -= 4; -- } -+ count = ctx->blocksize / 4; -+ -+ readsl(&device_data->base->dout, ctx->outdata, count); -+ ctx->outdata += count; -+ ctx->outlen -= count; - - if (ctx->outlen == 0) { - cryp_disable_irq_src(device_data, -@@ -230,12 +229,12 @@ static irqreturn_t cryp_interrupt_handler(int irq, void *param) - } else if (cryp_pending_irq_src(device_data, - CRYP_IRQ_SRC_INPUT_FIFO)) { - if (ctx->datalen / ctx->blocksize > 0) { -- for (i = 0 ; i < ctx->blocksize / 4; i++) { -- writel_relaxed(ctx->indata, -- &device_data->base->din); -- ctx->indata += 4; -- ctx->datalen -= 4; -- } -+ count = ctx->blocksize / 4; -+ -+ writesl(&device_data->base->din, ctx->indata, count); -+ -+ ctx->indata += count; -+ ctx->datalen -= count; - - if (ctx->datalen == 0) - cryp_disable_irq_src(device_data, -diff --git a/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c b/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c -index f926b4caf449..56c60552abba 100644 ---- a/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c -+++ b/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c -@@ -199,7 +199,7 @@ static struct dmm_txn *dmm_txn_init(struct dmm *dmm, struct tcm *tcm) - static void dmm_txn_append(struct dmm_txn *txn, struct pat_area *area, - struct page **pages, uint32_t npages, uint32_t roll) - { -- dma_addr_t pat_pa = 0; -+ dma_addr_t pat_pa = 0, data_pa = 0; - uint32_t *data; - struct pat *pat; - struct refill_engine *engine = txn->engine_handle; -@@ -223,7 +223,9 @@ static void dmm_txn_append(struct dmm_txn *txn, struct pat_area *area, - .lut_id = engine->tcm->lut_id, - }; - -- data = alloc_dma(txn, 4*i, &pat->data_pa); -+ data = alloc_dma(txn, 4*i, &data_pa); -+ /* FIXME: what if data_pa is more than 32-bit ? */ -+ pat->data_pa = data_pa; - - while (i--) { - int n = i + roll; -diff --git a/drivers/gpu/drm/omapdrm/omap_gem.c b/drivers/gpu/drm/omapdrm/omap_gem.c -index 5aec3e81fe24..5fd3bab8b803 100644 ---- a/drivers/gpu/drm/omapdrm/omap_gem.c -+++ b/drivers/gpu/drm/omapdrm/omap_gem.c -@@ -791,7 +791,7 @@ int omap_gem_get_paddr(struct drm_gem_object *obj, - omap_obj->paddr = tiler_ssptr(block); - omap_obj->block = block; - -- DBG("got paddr: %08x", omap_obj->paddr); -+ DBG("got paddr: %pad", &omap_obj->paddr); - } - - omap_obj->paddr_cnt++; -@@ -988,9 +988,9 @@ void omap_gem_describe(struct drm_gem_object *obj, struct seq_file *m) - - off = drm_vma_node_start(&obj->vma_node); - -- seq_printf(m, "%08x: %2d (%2d) %08llx %08Zx (%2d) %p %4d", -+ seq_printf(m, "%08x: %2d (%2d) %08llx %pad (%2d) %p %4d", - omap_obj->flags, obj->name, obj->refcount.refcount.counter, -- off, omap_obj->paddr, omap_obj->paddr_cnt, -+ off, &omap_obj->paddr, omap_obj->paddr_cnt, - omap_obj->vaddr, omap_obj->roll); - - if (omap_obj->flags & OMAP_BO_TILED) { -@@ -1468,8 +1468,8 @@ void omap_gem_init(struct drm_device *dev) - entry->paddr = tiler_ssptr(block); - entry->block = block; - -- DBG("%d:%d: %dx%d: paddr=%08x stride=%d", i, j, w, h, -- entry->paddr, -+ DBG("%d:%d: %dx%d: paddr=%pad stride=%d", i, j, w, h, -+ &entry->paddr, - usergart[i].stride_pfn << PAGE_SHIFT); - } - } -diff --git a/drivers/gpu/drm/omapdrm/omap_plane.c b/drivers/gpu/drm/omapdrm/omap_plane.c -index 046d5e660c04..5b62e212cbe5 100644 ---- a/drivers/gpu/drm/omapdrm/omap_plane.c -+++ b/drivers/gpu/drm/omapdrm/omap_plane.c -@@ -142,8 +142,8 @@ static void omap_plane_pre_apply(struct omap_drm_apply *apply) - DBG("%dx%d -> %dx%d (%d)", info->width, info->height, - info->out_width, info->out_height, - info->screen_width); -- DBG("%d,%d %08x %08x", info->pos_x, info->pos_y, -- info->paddr, info->p_uv_addr); -+ DBG("%d,%d %pad %pad", info->pos_x, info->pos_y, -+ &info->paddr, &info->p_uv_addr); - - /* TODO: */ - ilace = false; -diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c -index 7164045c06e4..bc9e56eb4e9c 100644 ---- a/drivers/gpu/drm/radeon/cik.c -+++ b/drivers/gpu/drm/radeon/cik.c -@@ -3231,6 +3231,7 @@ static void cik_gpu_init(struct radeon_device *rdev) - (rdev->pdev->device == 0x130B) || - (rdev->pdev->device == 0x130E) || - (rdev->pdev->device == 0x1315) || -+ (rdev->pdev->device == 0x1318) || - (rdev->pdev->device == 0x131B)) { - rdev->config.cik.max_cu_per_sh = 4; - rdev->config.cik.max_backends_per_se = 1; -diff --git a/drivers/hid/hid-cherry.c b/drivers/hid/hid-cherry.c -index 1bdcccc54a1d..f745d2c1325e 100644 ---- a/drivers/hid/hid-cherry.c -+++ b/drivers/hid/hid-cherry.c -@@ -28,7 +28,7 @@ - static __u8 *ch_report_fixup(struct hid_device *hdev, __u8 *rdesc, - unsigned int *rsize) - { -- if (*rsize >= 17 && rdesc[11] == 0x3c && rdesc[12] == 0x02) { -+ if (*rsize >= 18 && rdesc[11] == 0x3c && rdesc[12] == 0x02) { - hid_info(hdev, "fixing up Cherry Cymotion report descriptor\n"); - rdesc[11] = rdesc[16] = 0xff; - rdesc[12] = rdesc[17] = 0x03; -diff --git a/drivers/hid/hid-kye.c b/drivers/hid/hid-kye.c -index e77696367591..b92bf01a1ae8 100644 ---- a/drivers/hid/hid-kye.c -+++ b/drivers/hid/hid-kye.c -@@ -300,7 +300,7 @@ static __u8 *kye_report_fixup(struct hid_device *hdev, __u8 *rdesc, - * - change the button usage range to 4-7 for the extra - * buttons - */ -- if (*rsize >= 74 && -+ if (*rsize >= 75 && - rdesc[61] == 0x05 && rdesc[62] == 0x08 && - rdesc[63] == 0x19 && rdesc[64] == 0x08 && - rdesc[65] == 0x29 && rdesc[66] == 0x0f && -diff --git a/drivers/hid/hid-lg.c b/drivers/hid/hid-lg.c -index 9fe9d4ac3114..b8207e0bfdc0 100644 ---- a/drivers/hid/hid-lg.c -+++ b/drivers/hid/hid-lg.c -@@ -345,14 +345,14 @@ static __u8 *lg_report_fixup(struct hid_device *hdev, __u8 *rdesc, - struct usb_device_descriptor *udesc; - __u16 bcdDevice, rev_maj, rev_min; - -- if ((drv_data->quirks & LG_RDESC) && *rsize >= 90 && rdesc[83] == 0x26 && -+ if ((drv_data->quirks & LG_RDESC) && *rsize >= 91 && rdesc[83] == 0x26 && - rdesc[84] == 0x8c && rdesc[85] == 0x02) { - hid_info(hdev, - "fixing up Logitech keyboard report descriptor\n"); - rdesc[84] = rdesc[89] = 0x4d; - rdesc[85] = rdesc[90] = 0x10; - } -- if ((drv_data->quirks & LG_RDESC_REL_ABS) && *rsize >= 50 && -+ if ((drv_data->quirks & LG_RDESC_REL_ABS) && *rsize >= 51 && - rdesc[32] == 0x81 && rdesc[33] == 0x06 && - rdesc[49] == 0x81 && rdesc[50] == 0x06) { - hid_info(hdev, -diff --git a/drivers/hid/hid-logitech-dj.c b/drivers/hid/hid-logitech-dj.c -index f45279c3b11a..0b14d3261531 100644 ---- a/drivers/hid/hid-logitech-dj.c -+++ b/drivers/hid/hid-logitech-dj.c -@@ -237,13 +237,6 @@ static void logi_dj_recv_add_djhid_device(struct dj_receiver_dev *djrcv_dev, - return; - } - -- if ((dj_report->device_index < DJ_DEVICE_INDEX_MIN) || -- (dj_report->device_index > DJ_DEVICE_INDEX_MAX)) { -- dev_err(&djrcv_hdev->dev, "%s: invalid device index:%d\n", -- __func__, dj_report->device_index); -- return; -- } -- - if (djrcv_dev->paired_dj_devices[dj_report->device_index]) { - /* The device is already known. No need to reallocate it. */ - dbg_hid("%s: device is already known\n", __func__); -@@ -721,6 +714,12 @@ static int logi_dj_raw_event(struct hid_device *hdev, - * device (via hid_input_report() ) and return 1 so hid-core does not do - * anything else with it. - */ -+ if ((dj_report->device_index < DJ_DEVICE_INDEX_MIN) || -+ (dj_report->device_index > DJ_DEVICE_INDEX_MAX)) { -+ dev_err(&hdev->dev, "%s: invalid device index:%d\n", -+ __func__, dj_report->device_index); -+ return false; -+ } - - spin_lock_irqsave(&djrcv_dev->lock, flags); - if (dj_report->report_id == REPORT_ID_DJ_SHORT) { -diff --git a/drivers/hid/hid-monterey.c b/drivers/hid/hid-monterey.c -index 9e14c00eb1b6..25daf28b26bd 100644 ---- a/drivers/hid/hid-monterey.c -+++ b/drivers/hid/hid-monterey.c -@@ -24,7 +24,7 @@ - static __u8 *mr_report_fixup(struct hid_device *hdev, __u8 *rdesc, - unsigned int *rsize) - { -- if (*rsize >= 30 && rdesc[29] == 0x05 && rdesc[30] == 0x09) { -+ if (*rsize >= 31 && rdesc[29] == 0x05 && rdesc[30] == 0x09) { - hid_info(hdev, "fixing up button/consumer in HID report descriptor\n"); - rdesc[30] = 0x0c; - } -diff --git a/drivers/hid/hid-petalynx.c b/drivers/hid/hid-petalynx.c -index 736b2502df4f..6aca4f2554bf 100644 ---- a/drivers/hid/hid-petalynx.c -+++ b/drivers/hid/hid-petalynx.c -@@ -25,7 +25,7 @@ - static __u8 *pl_report_fixup(struct hid_device *hdev, __u8 *rdesc, - unsigned int *rsize) - { -- if (*rsize >= 60 && rdesc[39] == 0x2a && rdesc[40] == 0xf5 && -+ if (*rsize >= 62 && rdesc[39] == 0x2a && rdesc[40] == 0xf5 && - rdesc[41] == 0x00 && rdesc[59] == 0x26 && - rdesc[60] == 0xf9 && rdesc[61] == 0x00) { - hid_info(hdev, "fixing up Petalynx Maxter Remote report descriptor\n"); -diff --git a/drivers/hid/hid-sunplus.c b/drivers/hid/hid-sunplus.c -index 87fc91e1c8de..91072fa54663 100644 ---- a/drivers/hid/hid-sunplus.c -+++ b/drivers/hid/hid-sunplus.c -@@ -24,7 +24,7 @@ - static __u8 *sp_report_fixup(struct hid_device *hdev, __u8 *rdesc, - unsigned int *rsize) - { -- if (*rsize >= 107 && rdesc[104] == 0x26 && rdesc[105] == 0x80 && -+ if (*rsize >= 112 && rdesc[104] == 0x26 && rdesc[105] == 0x80 && - rdesc[106] == 0x03) { - hid_info(hdev, "fixing up Sunplus Wireless Desktop report descriptor\n"); - rdesc[105] = rdesc[110] = 0x03; -diff --git a/drivers/hwmon/ads1015.c b/drivers/hwmon/ads1015.c -index 7f9dc2f86b63..126516414c11 100644 ---- a/drivers/hwmon/ads1015.c -+++ b/drivers/hwmon/ads1015.c -@@ -198,7 +198,7 @@ static int ads1015_get_channels_config_of(struct i2c_client *client) - } - - channel = be32_to_cpup(property); -- if (channel > ADS1015_CHANNELS) { -+ if (channel >= ADS1015_CHANNELS) { - dev_err(&client->dev, - "invalid channel index %d on %s\n", - channel, node->full_name); -@@ -212,6 +212,7 @@ static int ads1015_get_channels_config_of(struct i2c_client *client) - dev_err(&client->dev, - "invalid gain on %s\n", - node->full_name); -+ return -EINVAL; - } - } - -@@ -222,6 +223,7 @@ static int ads1015_get_channels_config_of(struct i2c_client *client) - dev_err(&client->dev, - "invalid data_rate on %s\n", - node->full_name); -+ return -EINVAL; - } - } - -diff --git a/drivers/hwmon/amc6821.c b/drivers/hwmon/amc6821.c -index 9f2be3dd28f3..8a67ec6279a4 100644 ---- a/drivers/hwmon/amc6821.c -+++ b/drivers/hwmon/amc6821.c -@@ -360,11 +360,13 @@ static ssize_t set_pwm1_enable( - if (config) - return config; - -+ mutex_lock(&data->update_lock); - config = i2c_smbus_read_byte_data(client, AMC6821_REG_CONF1); - if (config < 0) { - dev_err(&client->dev, - "Error reading configuration register, aborting.\n"); -- return config; -+ count = config; -+ goto unlock; - } - - switch (val) { -@@ -381,14 +383,15 @@ static ssize_t set_pwm1_enable( - config |= AMC6821_CONF1_FDRC1; - break; - default: -- return -EINVAL; -+ count = -EINVAL; -+ goto unlock; - } -- mutex_lock(&data->update_lock); - if (i2c_smbus_write_byte_data(client, AMC6821_REG_CONF1, config)) { - dev_err(&client->dev, - "Configuration register write error, aborting.\n"); - count = -EIO; - } -+unlock: - mutex_unlock(&data->update_lock); - return count; - } -@@ -493,8 +496,9 @@ static ssize_t set_temp_auto_point_temp( - return -EINVAL; - } - -- data->valid = 0; - mutex_lock(&data->update_lock); -+ data->valid = 0; -+ - switch (ix) { - case 0: - ptemp[0] = clamp_val(val / 1000, 0, -@@ -658,13 +662,14 @@ static ssize_t set_fan1_div( - if (config) - return config; - -+ mutex_lock(&data->update_lock); - config = i2c_smbus_read_byte_data(client, AMC6821_REG_CONF4); - if (config < 0) { - dev_err(&client->dev, - "Error reading configuration register, aborting.\n"); -- return config; -+ count = config; -+ goto EXIT; - } -- mutex_lock(&data->update_lock); - switch (val) { - case 2: - config &= ~AMC6821_CONF4_PSPR; -diff --git a/drivers/hwmon/dme1737.c b/drivers/hwmon/dme1737.c -index 4ae3fff13f44..bea0a344fab5 100644 ---- a/drivers/hwmon/dme1737.c -+++ b/drivers/hwmon/dme1737.c -@@ -247,8 +247,8 @@ struct dme1737_data { - u8 pwm_acz[3]; - u8 pwm_freq[6]; - u8 pwm_rr[2]; -- u8 zone_low[3]; -- u8 zone_abs[3]; -+ s8 zone_low[3]; -+ s8 zone_abs[3]; - u8 zone_hyst[2]; - u32 alarms; - }; -@@ -277,7 +277,7 @@ static inline int IN_FROM_REG(int reg, int nominal, int res) - return (reg * nominal + (3 << (res - 3))) / (3 << (res - 2)); - } - --static inline int IN_TO_REG(int val, int nominal) -+static inline int IN_TO_REG(long val, int nominal) - { - return clamp_val((val * 192 + nominal / 2) / nominal, 0, 255); - } -@@ -293,7 +293,7 @@ static inline int TEMP_FROM_REG(int reg, int res) - return (reg * 1000) >> (res - 8); - } - --static inline int TEMP_TO_REG(int val) -+static inline int TEMP_TO_REG(long val) - { - return clamp_val((val < 0 ? val - 500 : val + 500) / 1000, -128, 127); - } -@@ -308,7 +308,7 @@ static inline int TEMP_RANGE_FROM_REG(int reg) - return TEMP_RANGE[(reg >> 4) & 0x0f]; - } - --static int TEMP_RANGE_TO_REG(int val, int reg) -+static int TEMP_RANGE_TO_REG(long val, int reg) - { - int i; - -@@ -331,7 +331,7 @@ static inline int TEMP_HYST_FROM_REG(int reg, int ix) - return (((ix == 1) ? reg : reg >> 4) & 0x0f) * 1000; - } - --static inline int TEMP_HYST_TO_REG(int val, int ix, int reg) -+static inline int TEMP_HYST_TO_REG(long val, int ix, int reg) - { - int hyst = clamp_val((val + 500) / 1000, 0, 15); - -@@ -347,7 +347,7 @@ static inline int FAN_FROM_REG(int reg, int tpc) - return (reg == 0 || reg == 0xffff) ? 0 : 90000 * 60 / reg; - } - --static inline int FAN_TO_REG(int val, int tpc) -+static inline int FAN_TO_REG(long val, int tpc) - { - if (tpc) { - return clamp_val(val / tpc, 0, 0xffff); -@@ -379,7 +379,7 @@ static inline int FAN_TYPE_FROM_REG(int reg) - return (edge > 0) ? 1 << (edge - 1) : 0; - } - --static inline int FAN_TYPE_TO_REG(int val, int reg) -+static inline int FAN_TYPE_TO_REG(long val, int reg) - { - int edge = (val == 4) ? 3 : val; - -@@ -402,7 +402,7 @@ static int FAN_MAX_FROM_REG(int reg) - return 1000 + i * 500; - } - --static int FAN_MAX_TO_REG(int val) -+static int FAN_MAX_TO_REG(long val) - { - int i; - -@@ -460,7 +460,7 @@ static inline int PWM_ACZ_FROM_REG(int reg) - return acz[(reg >> 5) & 0x07]; - } - --static inline int PWM_ACZ_TO_REG(int val, int reg) -+static inline int PWM_ACZ_TO_REG(long val, int reg) - { - int acz = (val == 4) ? 2 : val - 1; - -@@ -476,7 +476,7 @@ static inline int PWM_FREQ_FROM_REG(int reg) - return PWM_FREQ[reg & 0x0f]; - } - --static int PWM_FREQ_TO_REG(int val, int reg) -+static int PWM_FREQ_TO_REG(long val, int reg) - { - int i; - -@@ -510,7 +510,7 @@ static inline int PWM_RR_FROM_REG(int reg, int ix) - return (rr & 0x08) ? PWM_RR[rr & 0x07] : 0; - } - --static int PWM_RR_TO_REG(int val, int ix, int reg) -+static int PWM_RR_TO_REG(long val, int ix, int reg) - { - int i; - -@@ -528,7 +528,7 @@ static inline int PWM_RR_EN_FROM_REG(int reg, int ix) - return PWM_RR_FROM_REG(reg, ix) ? 1 : 0; - } - --static inline int PWM_RR_EN_TO_REG(int val, int ix, int reg) -+static inline int PWM_RR_EN_TO_REG(long val, int ix, int reg) - { - int en = (ix == 1) ? 0x80 : 0x08; - -@@ -1481,13 +1481,16 @@ static ssize_t set_vrm(struct device *dev, struct device_attribute *attr, - const char *buf, size_t count) - { - struct dme1737_data *data = dev_get_drvdata(dev); -- long val; -+ unsigned long val; - int err; - -- err = kstrtol(buf, 10, &val); -+ err = kstrtoul(buf, 10, &val); - if (err) - return err; - -+ if (val > 255) -+ return -EINVAL; -+ - data->vrm = val; - return count; - } -diff --git a/drivers/hwmon/gpio-fan.c b/drivers/hwmon/gpio-fan.c -index 73181be5b30b..814f7ee9026b 100644 ---- a/drivers/hwmon/gpio-fan.c -+++ b/drivers/hwmon/gpio-fan.c -@@ -173,7 +173,7 @@ static int get_fan_speed_index(struct gpio_fan_data *fan_data) - return -ENODEV; - } - --static int rpm_to_speed_index(struct gpio_fan_data *fan_data, int rpm) -+static int rpm_to_speed_index(struct gpio_fan_data *fan_data, unsigned long rpm) - { - struct gpio_fan_speed *speed = fan_data->speed; - int i; -diff --git a/drivers/hwmon/lm78.c b/drivers/hwmon/lm78.c -index 9efadfc851bc..c1eb464f0fd0 100644 ---- a/drivers/hwmon/lm78.c -+++ b/drivers/hwmon/lm78.c -@@ -108,7 +108,7 @@ static inline int FAN_FROM_REG(u8 val, int div) - * TEMP: mC (-128C to +127C) - * REG: 1C/bit, two's complement - */ --static inline s8 TEMP_TO_REG(int val) -+static inline s8 TEMP_TO_REG(long val) - { - int nval = clamp_val(val, -128000, 127000) ; - return nval < 0 ? (nval - 500) / 1000 : (nval + 500) / 1000; -diff --git a/drivers/hwmon/lm85.c b/drivers/hwmon/lm85.c -index bed4af358308..21d6cc813a6d 100644 ---- a/drivers/hwmon/lm85.c -+++ b/drivers/hwmon/lm85.c -@@ -158,7 +158,7 @@ static inline u16 FAN_TO_REG(unsigned long val) - - /* Temperature is reported in .001 degC increments */ - #define TEMP_TO_REG(val) \ -- clamp_val(SCALE(val, 1000, 1), -127, 127) -+ DIV_ROUND_CLOSEST(clamp_val((val), -127000, 127000), 1000) - #define TEMPEXT_FROM_REG(val, ext) \ - SCALE(((val) << 4) + (ext), 16, 1000) - #define TEMP_FROM_REG(val) ((val) * 1000) -@@ -192,7 +192,7 @@ static const int lm85_range_map[] = { - 13300, 16000, 20000, 26600, 32000, 40000, 53300, 80000 - }; - --static int RANGE_TO_REG(int range) -+static int RANGE_TO_REG(long range) - { - int i; - -@@ -214,7 +214,7 @@ static const int adm1027_freq_map[8] = { /* 1 Hz */ - 11, 15, 22, 29, 35, 44, 59, 88 - }; - --static int FREQ_TO_REG(const int *map, int freq) -+static int FREQ_TO_REG(const int *map, unsigned long freq) - { - int i; - -@@ -463,6 +463,9 @@ static ssize_t store_vrm_reg(struct device *dev, struct device_attribute *attr, - if (err) - return err; - -+ if (val > 255) -+ return -EINVAL; -+ - data->vrm = val; - return count; - } -diff --git a/drivers/hwmon/sis5595.c b/drivers/hwmon/sis5595.c -index 3532026e25da..bf1d7893d51c 100644 ---- a/drivers/hwmon/sis5595.c -+++ b/drivers/hwmon/sis5595.c -@@ -159,7 +159,7 @@ static inline int TEMP_FROM_REG(s8 val) - { - return val * 830 + 52120; - } --static inline s8 TEMP_TO_REG(int val) -+static inline s8 TEMP_TO_REG(long val) - { - int nval = clamp_val(val, -54120, 157530) ; - return nval < 0 ? (nval - 5212 - 415) / 830 : (nval - 5212 + 415) / 830; -diff --git a/drivers/i2c/busses/i2c-at91.c b/drivers/i2c/busses/i2c-at91.c -index 843d01268ae9..c56be739006b 100644 ---- a/drivers/i2c/busses/i2c-at91.c -+++ b/drivers/i2c/busses/i2c-at91.c -@@ -210,7 +210,7 @@ static void at91_twi_write_data_dma_callback(void *data) - struct at91_twi_dev *dev = (struct at91_twi_dev *)data; - - dma_unmap_single(dev->dev, sg_dma_address(&dev->dma.sg), -- dev->buf_len, DMA_MEM_TO_DEV); -+ dev->buf_len, DMA_TO_DEVICE); - - at91_twi_write(dev, AT91_TWI_CR, AT91_TWI_STOP); - } -@@ -289,7 +289,7 @@ static void at91_twi_read_data_dma_callback(void *data) - struct at91_twi_dev *dev = (struct at91_twi_dev *)data; - - dma_unmap_single(dev->dev, sg_dma_address(&dev->dma.sg), -- dev->buf_len, DMA_DEV_TO_MEM); -+ dev->buf_len, DMA_FROM_DEVICE); - - /* The last two bytes have to be read without using dma */ - dev->buf += dev->buf_len - 2; -diff --git a/drivers/misc/mei/client.c b/drivers/misc/mei/client.c -index 5a9bfa71df86..540fe114ec60 100644 ---- a/drivers/misc/mei/client.c -+++ b/drivers/misc/mei/client.c -@@ -459,6 +459,7 @@ int mei_cl_disconnect(struct mei_cl *cl) - cl_err(dev, cl, "failed to disconnect.\n"); - goto free; - } -+ cl->timer_count = MEI_CONNECT_TIMEOUT; - mdelay(10); /* Wait for hardware disconnection ready */ - list_add_tail(&cb->list, &dev->ctrl_rd_list.list); - } else { -@@ -563,6 +564,7 @@ int mei_cl_connect(struct mei_cl *cl, struct file *file) - cl->timer_count = MEI_CONNECT_TIMEOUT; - list_add_tail(&cb->list, &dev->ctrl_rd_list.list); - } else { -+ cl->state = MEI_FILE_INITIALIZING; - list_add_tail(&cb->list, &dev->ctrl_wr_list.list); - } - -diff --git a/drivers/misc/mei/nfc.c b/drivers/misc/mei/nfc.c -index a58320c0c049..31149010224b 100644 ---- a/drivers/misc/mei/nfc.c -+++ b/drivers/misc/mei/nfc.c -@@ -342,9 +342,10 @@ static int mei_nfc_send(struct mei_cl_device *cldev, u8 *buf, size_t length) - ndev = (struct mei_nfc_dev *) cldev->priv_data; - dev = ndev->cl->dev; - -+ err = -ENOMEM; - mei_buf = kzalloc(length + MEI_NFC_HEADER_SIZE, GFP_KERNEL); - if (!mei_buf) -- return -ENOMEM; -+ goto out; - - hdr = (struct mei_nfc_hci_hdr *) mei_buf; - hdr->cmd = MEI_NFC_CMD_HCI_SEND; -@@ -354,12 +355,9 @@ static int mei_nfc_send(struct mei_cl_device *cldev, u8 *buf, size_t length) - hdr->data_size = length; - - memcpy(mei_buf + MEI_NFC_HEADER_SIZE, buf, length); -- - err = __mei_cl_send(ndev->cl, mei_buf, length + MEI_NFC_HEADER_SIZE); - if (err < 0) -- return err; -- -- kfree(mei_buf); -+ goto out; - - if (!wait_event_interruptible_timeout(ndev->send_wq, - ndev->recv_req_id == ndev->req_id, HZ)) { -@@ -368,7 +366,8 @@ static int mei_nfc_send(struct mei_cl_device *cldev, u8 *buf, size_t length) - } else { - ndev->req_id++; - } -- -+out: -+ kfree(mei_buf); - return err; - } - -diff --git a/drivers/pci/pci-label.c b/drivers/pci/pci-label.c -index 45113daaa778..e27a3dc9f4e8 100644 ---- a/drivers/pci/pci-label.c -+++ b/drivers/pci/pci-label.c -@@ -168,8 +168,8 @@ enum acpi_attr_enum { - static void dsm_label_utf16s_to_utf8s(union acpi_object *obj, char *buf) - { - int len; -- len = utf16s_to_utf8s((const wchar_t *)obj->string.pointer, -- obj->string.length, -+ len = utf16s_to_utf8s((const wchar_t *)obj->buffer.pointer, -+ obj->buffer.length, - UTF16_LITTLE_ENDIAN, - buf, PAGE_SIZE); - buf[len] = '\n'; -@@ -194,16 +194,22 @@ dsm_get_label(struct device *dev, char *buf, enum acpi_attr_enum attr) - tmp = obj->package.elements; - if (obj->type == ACPI_TYPE_PACKAGE && obj->package.count == 2 && - tmp[0].type == ACPI_TYPE_INTEGER && -- tmp[1].type == ACPI_TYPE_STRING) { -+ (tmp[1].type == ACPI_TYPE_STRING || -+ tmp[1].type == ACPI_TYPE_BUFFER)) { - /* - * The second string element is optional even when - * this _DSM is implemented; when not implemented, - * this entry must return a null string. - */ -- if (attr == ACPI_ATTR_INDEX_SHOW) -+ if (attr == ACPI_ATTR_INDEX_SHOW) { - scnprintf(buf, PAGE_SIZE, "%llu\n", tmp->integer.value); -- else if (attr == ACPI_ATTR_LABEL_SHOW) -- dsm_label_utf16s_to_utf8s(tmp + 1, buf); -+ } else if (attr == ACPI_ATTR_LABEL_SHOW) { -+ if (tmp[1].type == ACPI_TYPE_STRING) -+ scnprintf(buf, PAGE_SIZE, "%s\n", -+ tmp[1].string.pointer); -+ else if (tmp[1].type == ACPI_TYPE_BUFFER) -+ dsm_label_utf16s_to_utf8s(tmp + 1, buf); -+ } - len = strlen(buf) > 0 ? strlen(buf) : -1; - } - -diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c -index be36adf33ab0..dae70d216762 100644 ---- a/drivers/pci/pci.c -+++ b/drivers/pci/pci.c -@@ -830,12 +830,6 @@ int pci_set_power_state(struct pci_dev *dev, pci_power_t state) - - if (!__pci_complete_power_transition(dev, state)) - error = 0; -- /* -- * When aspm_policy is "powersave" this call ensures -- * that ASPM is configured. -- */ -- if (!error && dev->bus->self) -- pcie_aspm_powersave_config_link(dev->bus->self); - - return error; - } -@@ -1181,12 +1175,18 @@ EXPORT_SYMBOL_GPL(pci_load_and_free_saved_state); - static int do_pci_enable_device(struct pci_dev *dev, int bars) - { - int err; -+ struct pci_dev *bridge; - u16 cmd; - u8 pin; - - err = pci_set_power_state(dev, PCI_D0); - if (err < 0 && err != -EIO) - return err; -+ -+ bridge = pci_upstream_bridge(dev); -+ if (bridge) -+ pcie_aspm_powersave_config_link(bridge); -+ - err = pcibios_enable_device(dev, bars); - if (err < 0) - return err; -diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c -index 868318a7067c..528bff5ec91f 100644 ---- a/drivers/scsi/hpsa.c -+++ b/drivers/scsi/hpsa.c -@@ -3131,7 +3131,7 @@ static int hpsa_big_passthru_ioctl(struct ctlr_info *h, void __user *argp) - } - if (ioc->Request.Type.Direction == XFER_WRITE) { - if (copy_from_user(buff[sg_used], data_ptr, sz)) { -- status = -ENOMEM; -+ status = -EFAULT; - goto cleanup1; - } - } else -@@ -4367,9 +4367,9 @@ static inline void hpsa_set_driver_support_bits(struct ctlr_info *h) - { - u32 driver_support; - --#ifdef CONFIG_X86 -- /* Need to enable prefetch in the SCSI core for 6400 in x86 */ - driver_support = readl(&(h->cfgtable->driver_support)); -+ /* Need to enable prefetch in the SCSI core for 6400 in x86 */ -+#ifdef CONFIG_X86 - driver_support |= ENABLE_SCSI_PREFETCH; - #endif - driver_support |= ENABLE_UNIT_ATTN; -diff --git a/drivers/staging/et131x/et131x.c b/drivers/staging/et131x/et131x.c -index e516bb69f3b4..907aa3078946 100644 ---- a/drivers/staging/et131x/et131x.c -+++ b/drivers/staging/et131x/et131x.c -@@ -1422,22 +1422,16 @@ static int et131x_mii_read(struct et131x_adapter *adapter, u8 reg, u16 *value) - * @reg: the register to read - * @value: 16-bit value to write - */ --static int et131x_mii_write(struct et131x_adapter *adapter, u8 reg, u16 value) -+static int et131x_mii_write(struct et131x_adapter *adapter, u8 addr, u8 reg, -+ u16 value) - { - struct mac_regs __iomem *mac = &adapter->regs->mac; -- struct phy_device *phydev = adapter->phydev; - int status = 0; -- u8 addr; - u32 delay = 0; - u32 mii_addr; - u32 mii_cmd; - u32 mii_indicator; - -- if (!phydev) -- return -EIO; -- -- addr = phydev->addr; -- - /* Save a local copy of the registers we are dealing with so we can - * set them back - */ -@@ -1632,17 +1626,7 @@ static int et131x_mdio_write(struct mii_bus *bus, int phy_addr, - struct net_device *netdev = bus->priv; - struct et131x_adapter *adapter = netdev_priv(netdev); - -- return et131x_mii_write(adapter, reg, value); --} -- --static int et131x_mdio_reset(struct mii_bus *bus) --{ -- struct net_device *netdev = bus->priv; -- struct et131x_adapter *adapter = netdev_priv(netdev); -- -- et131x_mii_write(adapter, MII_BMCR, BMCR_RESET); -- -- return 0; -+ return et131x_mii_write(adapter, phy_addr, reg, value); - } - - /* et1310_phy_power_switch - PHY power control -@@ -1657,18 +1641,20 @@ static int et131x_mdio_reset(struct mii_bus *bus) - static void et1310_phy_power_switch(struct et131x_adapter *adapter, bool down) - { - u16 data; -+ struct phy_device *phydev = adapter->phydev; - - et131x_mii_read(adapter, MII_BMCR, &data); - data &= ~BMCR_PDOWN; - if (down) - data |= BMCR_PDOWN; -- et131x_mii_write(adapter, MII_BMCR, data); -+ et131x_mii_write(adapter, phydev->addr, MII_BMCR, data); - } - - /* et131x_xcvr_init - Init the phy if we are setting it into force mode */ - static void et131x_xcvr_init(struct et131x_adapter *adapter) - { - u16 lcr2; -+ struct phy_device *phydev = adapter->phydev; - - /* Set the LED behavior such that LED 1 indicates speed (off = - * 10Mbits, blink = 100Mbits, on = 1000Mbits) and LED 2 indicates -@@ -1689,7 +1675,7 @@ static void et131x_xcvr_init(struct et131x_adapter *adapter) - else - lcr2 |= (LED_VAL_LINKON << LED_TXRX_SHIFT); - -- et131x_mii_write(adapter, PHY_LED_2, lcr2); -+ et131x_mii_write(adapter, phydev->addr, PHY_LED_2, lcr2); - } - } - -@@ -3638,14 +3624,14 @@ static void et131x_adjust_link(struct net_device *netdev) - - et131x_mii_read(adapter, PHY_MPHY_CONTROL_REG, - &register18); -- et131x_mii_write(adapter, PHY_MPHY_CONTROL_REG, -- register18 | 0x4); -- et131x_mii_write(adapter, PHY_INDEX_REG, -+ et131x_mii_write(adapter, phydev->addr, -+ PHY_MPHY_CONTROL_REG, register18 | 0x4); -+ et131x_mii_write(adapter, phydev->addr, PHY_INDEX_REG, - register18 | 0x8402); -- et131x_mii_write(adapter, PHY_DATA_REG, -+ et131x_mii_write(adapter, phydev->addr, PHY_DATA_REG, - register18 | 511); -- et131x_mii_write(adapter, PHY_MPHY_CONTROL_REG, -- register18); -+ et131x_mii_write(adapter, phydev->addr, -+ PHY_MPHY_CONTROL_REG, register18); - } - - et1310_config_flow_control(adapter); -@@ -3657,7 +3643,8 @@ static void et131x_adjust_link(struct net_device *netdev) - et131x_mii_read(adapter, PHY_CONFIG, &reg); - reg &= ~ET_PHY_CONFIG_TX_FIFO_DEPTH; - reg |= ET_PHY_CONFIG_FIFO_DEPTH_32; -- et131x_mii_write(adapter, PHY_CONFIG, reg); -+ et131x_mii_write(adapter, phydev->addr, PHY_CONFIG, -+ reg); - } - - et131x_set_rx_dma_timer(adapter); -@@ -3670,14 +3657,14 @@ static void et131x_adjust_link(struct net_device *netdev) - - et131x_mii_read(adapter, PHY_MPHY_CONTROL_REG, - &register18); -- et131x_mii_write(adapter, PHY_MPHY_CONTROL_REG, -- register18 | 0x4); -- et131x_mii_write(adapter, PHY_INDEX_REG, -- register18 | 0x8402); -- et131x_mii_write(adapter, PHY_DATA_REG, -- register18 | 511); -- et131x_mii_write(adapter, PHY_MPHY_CONTROL_REG, -- register18); -+ et131x_mii_write(adapter, phydev->addr, -+ PHY_MPHY_CONTROL_REG, register18 | 0x4); -+ et131x_mii_write(adapter, phydev->addr, -+ PHY_INDEX_REG, register18 | 0x8402); -+ et131x_mii_write(adapter, phydev->addr, -+ PHY_DATA_REG, register18 | 511); -+ et131x_mii_write(adapter, phydev->addr, -+ PHY_MPHY_CONTROL_REG, register18); - } - - /* Free the packets being actively sent & stopped */ -@@ -4646,10 +4633,6 @@ static int et131x_pci_setup(struct pci_dev *pdev, - /* Copy address into the net_device struct */ - memcpy(netdev->dev_addr, adapter->addr, ETH_ALEN); - -- /* Init variable for counting how long we do not have link status */ -- adapter->boot_coma = 0; -- et1310_disable_phy_coma(adapter); -- - rc = -ENOMEM; - - /* Setup the mii_bus struct */ -@@ -4665,7 +4648,6 @@ static int et131x_pci_setup(struct pci_dev *pdev, - adapter->mii_bus->priv = netdev; - adapter->mii_bus->read = et131x_mdio_read; - adapter->mii_bus->write = et131x_mdio_write; -- adapter->mii_bus->reset = et131x_mdio_reset; - adapter->mii_bus->irq = kmalloc_array(PHY_MAX_ADDR, sizeof(int), - GFP_KERNEL); - if (!adapter->mii_bus->irq) -@@ -4689,6 +4671,10 @@ static int et131x_pci_setup(struct pci_dev *pdev, - /* Setup et1310 as per the documentation */ - et131x_adapter_setup(adapter); - -+ /* Init variable for counting how long we do not have link status */ -+ adapter->boot_coma = 0; -+ et1310_disable_phy_coma(adapter); -+ - /* We can enable interrupts now - * - * NOTE - Because registration of interrupt handler is done in the -diff --git a/drivers/staging/rtl8188eu/os_dep/usb_intf.c b/drivers/staging/rtl8188eu/os_dep/usb_intf.c -index 2f40ff5901d6..fed699fc5918 100644 ---- a/drivers/staging/rtl8188eu/os_dep/usb_intf.c -+++ b/drivers/staging/rtl8188eu/os_dep/usb_intf.c -@@ -53,9 +53,11 @@ static struct usb_device_id rtw_usb_id_tbl[] = { - {USB_DEVICE(USB_VENDER_ID_REALTEK, 0x0179)}, /* 8188ETV */ - /*=== Customer ID ===*/ - /****** 8188EUS ********/ -+ {USB_DEVICE(0x056e, 0x4008)}, /* Elecom WDC-150SU2M */ - {USB_DEVICE(0x07b8, 0x8179)}, /* Abocom - Abocom */ - {USB_DEVICE(0x2001, 0x330F)}, /* DLink DWA-125 REV D1 */ - {USB_DEVICE(0x2001, 0x3310)}, /* Dlink DWA-123 REV D1 */ -+ {USB_DEVICE(0x0df6, 0x0076)}, /* Sitecom N150 v2 */ - {} /* Terminating entry */ - }; - -diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c -index ece2049bd270..25b8f6868788 100644 ---- a/drivers/tty/serial/serial_core.c -+++ b/drivers/tty/serial/serial_core.c -@@ -235,6 +235,9 @@ static void uart_shutdown(struct tty_struct *tty, struct uart_state *state) - /* - * Turn off DTR and RTS early. - */ -+ if (uart_console(uport) && tty) -+ uport->cons->cflag = tty->termios.c_cflag; -+ - if (!tty || (tty->termios.c_cflag & HUPCL)) - uart_clear_mctrl(uport, TIOCM_DTR | TIOCM_RTS); - -diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c -index 90e18f6fa2bb..9ca77166d37e 100644 ---- a/drivers/usb/core/devio.c -+++ b/drivers/usb/core/devio.c -@@ -1411,7 +1411,7 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb, - u = (is_in ? URB_DIR_IN : URB_DIR_OUT); - if (uurb->flags & USBDEVFS_URB_ISO_ASAP) - u |= URB_ISO_ASAP; -- if (uurb->flags & USBDEVFS_URB_SHORT_NOT_OK) -+ if (uurb->flags & USBDEVFS_URB_SHORT_NOT_OK && is_in) - u |= URB_SHORT_NOT_OK; - if (uurb->flags & USBDEVFS_URB_NO_FSBR) - u |= URB_NO_FSBR; -diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c -index 36b1e856bd00..6650df70bb35 100644 ---- a/drivers/usb/core/hub.c -+++ b/drivers/usb/core/hub.c -@@ -1695,8 +1695,14 @@ static int hub_probe(struct usb_interface *intf, const struct usb_device_id *id) - * - Change autosuspend delay of hub can avoid unnecessary auto - * suspend timer for hub, also may decrease power consumption - * of USB bus. -+ * -+ * - If user has indicated to prevent autosuspend by passing -+ * usbcore.autosuspend = -1 then keep autosuspend disabled. - */ -- pm_runtime_set_autosuspend_delay(&hdev->dev, 0); -+#ifdef CONFIG_PM_RUNTIME -+ if (hdev->dev.power.autosuspend_delay >= 0) -+ pm_runtime_set_autosuspend_delay(&hdev->dev, 0); -+#endif - - /* - * Hubs have proper suspend/resume support, except for root hubs -@@ -3174,6 +3180,43 @@ static int finish_port_resume(struct usb_device *udev) - } - - /* -+ * There are some SS USB devices which take longer time for link training. -+ * XHCI specs 4.19.4 says that when Link training is successful, port -+ * sets CSC bit to 1. So if SW reads port status before successful link -+ * training, then it will not find device to be present. -+ * USB Analyzer log with such buggy devices show that in some cases -+ * device switch on the RX termination after long delay of host enabling -+ * the VBUS. In few other cases it has been seen that device fails to -+ * negotiate link training in first attempt. It has been -+ * reported till now that few devices take as long as 2000 ms to train -+ * the link after host enabling its VBUS and termination. Following -+ * routine implements a 2000 ms timeout for link training. If in a case -+ * link trains before timeout, loop will exit earlier. -+ * -+ * FIXME: If a device was connected before suspend, but was removed -+ * while system was asleep, then the loop in the following routine will -+ * only exit at timeout. -+ * -+ * This routine should only be called when persist is enabled for a SS -+ * device. -+ */ -+static int wait_for_ss_port_enable(struct usb_device *udev, -+ struct usb_hub *hub, int *port1, -+ u16 *portchange, u16 *portstatus) -+{ -+ int status = 0, delay_ms = 0; -+ -+ while (delay_ms < 2000) { -+ if (status || *portstatus & USB_PORT_STAT_CONNECTION) -+ break; -+ msleep(20); -+ delay_ms += 20; -+ status = hub_port_status(hub, *port1, portstatus, portchange); -+ } -+ return status; -+} -+ -+/* - * usb_port_resume - re-activate a suspended usb device's upstream port - * @udev: device to re-activate, not a root hub - * Context: must be able to sleep; device not locked; pm locks held -@@ -3275,6 +3318,10 @@ int usb_port_resume(struct usb_device *udev, pm_message_t msg) - - clear_bit(port1, hub->busy_bits); - -+ if (udev->persist_enabled && hub_is_superspeed(hub->hdev)) -+ status = wait_for_ss_port_enable(udev, hub, &port1, &portchange, -+ &portstatus); -+ - status = check_port_resume_type(udev, - hub, port1, status, portchange, portstatus); - if (status == 0) -diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c -index 7ae0c4d51741..7d6f64c447bf 100644 ---- a/drivers/usb/host/ehci-hub.c -+++ b/drivers/usb/host/ehci-hub.c -@@ -1239,7 +1239,7 @@ static int ehci_hub_control ( - if (selector == EHSET_TEST_SINGLE_STEP_SET_FEATURE) { - spin_unlock_irqrestore(&ehci->lock, flags); - retval = ehset_single_step_set_feature(hcd, -- wIndex); -+ wIndex + 1); - spin_lock_irqsave(&ehci->lock, flags); - break; - } -diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c -index 3e86bf4371b3..ca7b964124af 100644 ---- a/drivers/usb/host/ehci-pci.c -+++ b/drivers/usb/host/ehci-pci.c -@@ -35,6 +35,21 @@ static const char hcd_name[] = "ehci-pci"; - #define PCI_DEVICE_ID_INTEL_CE4100_USB 0x2e70 - - /*-------------------------------------------------------------------------*/ -+#define PCI_DEVICE_ID_INTEL_QUARK_X1000_SOC 0x0939 -+static inline bool is_intel_quark_x1000(struct pci_dev *pdev) -+{ -+ return pdev->vendor == PCI_VENDOR_ID_INTEL && -+ pdev->device == PCI_DEVICE_ID_INTEL_QUARK_X1000_SOC; -+} -+ -+/* -+ * 0x84 is the offset of in/out threshold register, -+ * and it is the same offset as the register of 'hostpc'. -+ */ -+#define intel_quark_x1000_insnreg01 hostpc -+ -+/* Maximum usable threshold value is 0x7f dwords for both IN and OUT */ -+#define INTEL_QUARK_X1000_EHCI_MAX_THRESHOLD 0x007f007f - - /* called after powerup, by probe or system-pm "wakeup" */ - static int ehci_pci_reinit(struct ehci_hcd *ehci, struct pci_dev *pdev) -@@ -50,6 +65,16 @@ static int ehci_pci_reinit(struct ehci_hcd *ehci, struct pci_dev *pdev) - if (!retval) - ehci_dbg(ehci, "MWI active\n"); - -+ /* Reset the threshold limit */ -+ if (is_intel_quark_x1000(pdev)) { -+ /* -+ * For the Intel QUARK X1000, raise the I/O threshold to the -+ * maximum usable value in order to improve performance. -+ */ -+ ehci_writel(ehci, INTEL_QUARK_X1000_EHCI_MAX_THRESHOLD, -+ ehci->regs->intel_quark_x1000_insnreg01); -+ } -+ - return 0; - } - -diff --git a/drivers/usb/host/ohci-dbg.c b/drivers/usb/host/ohci-dbg.c -index 45032e933e18..04f2186939d2 100644 ---- a/drivers/usb/host/ohci-dbg.c -+++ b/drivers/usb/host/ohci-dbg.c -@@ -236,7 +236,7 @@ ohci_dump_roothub ( - } - } - --static void ohci_dump (struct ohci_hcd *controller, int verbose) -+static void ohci_dump(struct ohci_hcd *controller) - { - ohci_dbg (controller, "OHCI controller state\n"); - -@@ -464,15 +464,16 @@ show_list (struct ohci_hcd *ohci, char *buf, size_t count, struct ed *ed) - static ssize_t fill_async_buffer(struct debug_buffer *buf) - { - struct ohci_hcd *ohci; -- size_t temp; -+ size_t temp, size; - unsigned long flags; - - ohci = buf->ohci; -+ size = PAGE_SIZE; - - /* display control and bulk lists together, for simplicity */ - spin_lock_irqsave (&ohci->lock, flags); -- temp = show_list(ohci, buf->page, buf->count, ohci->ed_controltail); -- temp += show_list(ohci, buf->page + temp, buf->count - temp, -+ temp = show_list(ohci, buf->page, size, ohci->ed_controltail); -+ temp += show_list(ohci, buf->page + temp, size - temp, - ohci->ed_bulktail); - spin_unlock_irqrestore (&ohci->lock, flags); - -diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c -index 3586460fb2a1..34fc86ccb591 100644 ---- a/drivers/usb/host/ohci-hcd.c -+++ b/drivers/usb/host/ohci-hcd.c -@@ -76,8 +76,8 @@ static const char hcd_name [] = "ohci_hcd"; - #include "ohci.h" - #include "pci-quirks.h" - --static void ohci_dump (struct ohci_hcd *ohci, int verbose); --static void ohci_stop (struct usb_hcd *hcd); -+static void ohci_dump(struct ohci_hcd *ohci); -+static void ohci_stop(struct usb_hcd *hcd); - - #include "ohci-hub.c" - #include "ohci-dbg.c" -@@ -744,7 +744,7 @@ retry: - ohci->ed_to_check = NULL; - } - -- ohci_dump (ohci, 1); -+ ohci_dump(ohci); - - return 0; - } -@@ -825,7 +825,7 @@ static irqreturn_t ohci_irq (struct usb_hcd *hcd) - usb_hc_died(hcd); - } - -- ohci_dump (ohci, 1); -+ ohci_dump(ohci); - ohci_usb_reset (ohci); - } - -@@ -925,7 +925,7 @@ static void ohci_stop (struct usb_hcd *hcd) - { - struct ohci_hcd *ohci = hcd_to_ohci (hcd); - -- ohci_dump (ohci, 1); -+ ohci_dump(ohci); - - if (quirk_nec(ohci)) - flush_work(&ohci->nec_work); -diff --git a/drivers/usb/host/ohci-q.c b/drivers/usb/host/ohci-q.c -index d4253e319428..a8bde5b8cbdd 100644 ---- a/drivers/usb/host/ohci-q.c -+++ b/drivers/usb/host/ohci-q.c -@@ -311,8 +311,7 @@ static void periodic_unlink (struct ohci_hcd *ohci, struct ed *ed) - * - ED_OPER: when there's any request queued, the ED gets rescheduled - * immediately. HC should be working on them. - * -- * - ED_IDLE: when there's no TD queue. there's no reason for the HC -- * to care about this ED; safe to disable the endpoint. -+ * - ED_IDLE: when there's no TD queue or the HC isn't running. - * - * When finish_unlinks() runs later, after SOF interrupt, it will often - * complete one or more URB unlinks before making that state change. -@@ -926,6 +925,10 @@ rescan_all: - int completed, modified; - __hc32 *prev; - -+ /* Is this ED already invisible to the hardware? */ -+ if (ed->state == ED_IDLE) -+ goto ed_idle; -+ - /* only take off EDs that the HC isn't using, accounting for - * frame counter wraps and EDs with partially retired TDs - */ -@@ -955,12 +958,20 @@ skip_ed: - } - } - -+ /* ED's now officially unlinked, hc doesn't see */ -+ ed->state = ED_IDLE; -+ if (quirk_zfmicro(ohci) && ed->type == PIPE_INTERRUPT) -+ ohci->eds_scheduled--; -+ ed->hwHeadP &= ~cpu_to_hc32(ohci, ED_H); -+ ed->hwNextED = 0; -+ wmb(); -+ ed->hwINFO &= ~cpu_to_hc32(ohci, ED_SKIP | ED_DEQUEUE); -+ed_idle: -+ - /* reentrancy: if we drop the schedule lock, someone might - * have modified this list. normally it's just prepending - * entries (which we'd ignore), but paranoia won't hurt. - */ -- *last = ed->ed_next; -- ed->ed_next = NULL; - modified = 0; - - /* unlink urbs as requested, but rescan the list after -@@ -1018,19 +1029,20 @@ rescan_this: - if (completed && !list_empty (&ed->td_list)) - goto rescan_this; - -- /* ED's now officially unlinked, hc doesn't see */ -- ed->state = ED_IDLE; -- if (quirk_zfmicro(ohci) && ed->type == PIPE_INTERRUPT) -- ohci->eds_scheduled--; -- ed->hwHeadP &= ~cpu_to_hc32(ohci, ED_H); -- ed->hwNextED = 0; -- wmb (); -- ed->hwINFO &= ~cpu_to_hc32 (ohci, ED_SKIP | ED_DEQUEUE); -- -- /* but if there's work queued, reschedule */ -- if (!list_empty (&ed->td_list)) { -- if (ohci->rh_state == OHCI_RH_RUNNING) -- ed_schedule (ohci, ed); -+ /* -+ * If no TDs are queued, take ED off the ed_rm_list. -+ * Otherwise, if the HC is running, reschedule. -+ * If not, leave it on the list for further dequeues. -+ */ -+ if (list_empty(&ed->td_list)) { -+ *last = ed->ed_next; -+ ed->ed_next = NULL; -+ } else if (ohci->rh_state == OHCI_RH_RUNNING) { -+ *last = ed->ed_next; -+ ed->ed_next = NULL; -+ ed_schedule(ohci, ed); -+ } else { -+ last = &ed->ed_next; - } - - if (modified) -diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c -index 08a5f92d6c54..75cb1ff9d26b 100644 ---- a/drivers/usb/host/xhci-pci.c -+++ b/drivers/usb/host/xhci-pci.c -@@ -101,6 +101,10 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) - /* AMD PLL quirk */ - if (pdev->vendor == PCI_VENDOR_ID_AMD && usb_amd_find_chipset_info()) - xhci->quirks |= XHCI_AMD_PLL_FIX; -+ -+ if (pdev->vendor == PCI_VENDOR_ID_AMD) -+ xhci->quirks |= XHCI_TRUST_TX_LENGTH; -+ - if (pdev->vendor == PCI_VENDOR_ID_INTEL) { - xhci->quirks |= XHCI_LPM_SUPPORT; - xhci->quirks |= XHCI_INTEL_HOST; -diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c -index 65091d9aa997..0e6665a82e88 100644 ---- a/drivers/usb/host/xhci-ring.c -+++ b/drivers/usb/host/xhci-ring.c -@@ -2612,7 +2612,8 @@ static int handle_tx_event(struct xhci_hcd *xhci, - * last TRB of the previous TD. The command completion handle - * will take care the rest. - */ -- if (!event_seg && trb_comp_code == COMP_STOP_INVAL) { -+ if (!event_seg && (trb_comp_code == COMP_STOP || -+ trb_comp_code == COMP_STOP_INVAL)) { - ret = 0; - goto cleanup; - } -diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c -index 8a3813be1b28..8b0f517abb6b 100644 ---- a/drivers/usb/serial/ftdi_sio.c -+++ b/drivers/usb/serial/ftdi_sio.c -@@ -151,6 +151,7 @@ static const struct usb_device_id id_table_combined[] = { - { USB_DEVICE(FTDI_VID, FTDI_AMC232_PID) }, - { USB_DEVICE(FTDI_VID, FTDI_CANUSB_PID) }, - { USB_DEVICE(FTDI_VID, FTDI_CANDAPTER_PID) }, -+ { USB_DEVICE(FTDI_VID, FTDI_BM_ATOM_NANO_PID) }, - { USB_DEVICE(FTDI_VID, FTDI_NXTCAM_PID) }, - { USB_DEVICE(FTDI_VID, FTDI_EV3CON_PID) }, - { USB_DEVICE(FTDI_VID, FTDI_SCS_DEVICE_0_PID) }, -@@ -673,6 +674,8 @@ static const struct usb_device_id id_table_combined[] = { - { USB_DEVICE(FTDI_VID, XSENS_CONVERTER_5_PID) }, - { USB_DEVICE(FTDI_VID, XSENS_CONVERTER_6_PID) }, - { USB_DEVICE(FTDI_VID, XSENS_CONVERTER_7_PID) }, -+ { USB_DEVICE(XSENS_VID, XSENS_CONVERTER_PID) }, -+ { USB_DEVICE(XSENS_VID, XSENS_MTW_PID) }, - { USB_DEVICE(FTDI_VID, FTDI_OMNI1509) }, - { USB_DEVICE(MOBILITY_VID, MOBILITY_USB_SERIAL_PID) }, - { USB_DEVICE(FTDI_VID, FTDI_ACTIVE_ROBOTS_PID) }, -@@ -945,6 +948,8 @@ static const struct usb_device_id id_table_combined[] = { - { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_842_2_PID) }, - { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_842_3_PID) }, - { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_842_4_PID) }, -+ /* ekey Devices */ -+ { USB_DEVICE(FTDI_VID, FTDI_EKEY_CONV_USB_PID) }, - /* Infineon Devices */ - { USB_DEVICE_INTERFACE_NUMBER(INFINEON_VID, INFINEON_TRIBOARD_PID, 1) }, - { } /* Terminating entry */ -diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h -index c4777bc6aee0..70b0b1d88ae9 100644 ---- a/drivers/usb/serial/ftdi_sio_ids.h -+++ b/drivers/usb/serial/ftdi_sio_ids.h -@@ -42,6 +42,8 @@ - /* www.candapter.com Ewert Energy Systems CANdapter device */ - #define FTDI_CANDAPTER_PID 0x9F80 /* Product Id */ - -+#define FTDI_BM_ATOM_NANO_PID 0xa559 /* Basic Micro ATOM Nano USB2Serial */ -+ - /* - * Texas Instruments XDS100v2 JTAG / BeagleBone A3 - * http://processors.wiki.ti.com/index.php/XDS100 -@@ -140,12 +142,15 @@ - /* - * Xsens Technologies BV products (http://www.xsens.com). - */ --#define XSENS_CONVERTER_0_PID 0xD388 --#define XSENS_CONVERTER_1_PID 0xD389 -+#define XSENS_VID 0x2639 -+#define XSENS_CONVERTER_PID 0xD00D /* Xsens USB-serial converter */ -+#define XSENS_MTW_PID 0x0200 /* Xsens MTw */ -+#define XSENS_CONVERTER_0_PID 0xD388 /* Xsens USB converter */ -+#define XSENS_CONVERTER_1_PID 0xD389 /* Xsens Wireless Receiver */ - #define XSENS_CONVERTER_2_PID 0xD38A --#define XSENS_CONVERTER_3_PID 0xD38B --#define XSENS_CONVERTER_4_PID 0xD38C --#define XSENS_CONVERTER_5_PID 0xD38D -+#define XSENS_CONVERTER_3_PID 0xD38B /* Xsens USB-serial converter */ -+#define XSENS_CONVERTER_4_PID 0xD38C /* Xsens Wireless Receiver */ -+#define XSENS_CONVERTER_5_PID 0xD38D /* Xsens Awinda Station */ - #define XSENS_CONVERTER_6_PID 0xD38E - #define XSENS_CONVERTER_7_PID 0xD38F - -@@ -1375,3 +1380,8 @@ - #define BRAINBOXES_US_160_6_PID 0x9006 /* US-160 16xRS232 1Mbaud Port 11 and 12 */ - #define BRAINBOXES_US_160_7_PID 0x9007 /* US-160 16xRS232 1Mbaud Port 13 and 14 */ - #define BRAINBOXES_US_160_8_PID 0x9008 /* US-160 16xRS232 1Mbaud Port 15 and 16 */ -+ -+/* -+ * ekey biometric systems GmbH (http://ekey.net/) -+ */ -+#define FTDI_EKEY_CONV_USB_PID 0xCB08 /* Converter USB */ -diff --git a/drivers/usb/serial/whiteheat.c b/drivers/usb/serial/whiteheat.c -index e62f2dff8b7d..6c3734d2b45a 100644 ---- a/drivers/usb/serial/whiteheat.c -+++ b/drivers/usb/serial/whiteheat.c -@@ -514,6 +514,10 @@ static void command_port_read_callback(struct urb *urb) - dev_dbg(&urb->dev->dev, "%s - command_info is NULL, exiting.\n", __func__); - return; - } -+ if (!urb->actual_length) { -+ dev_dbg(&urb->dev->dev, "%s - empty response, exiting.\n", __func__); -+ return; -+ } - if (status) { - dev_dbg(&urb->dev->dev, "%s - nonzero urb status: %d\n", __func__, status); - if (status != -ENOENT) -@@ -534,7 +538,8 @@ static void command_port_read_callback(struct urb *urb) - /* These are unsolicited reports from the firmware, hence no - waiting command to wakeup */ - dev_dbg(&urb->dev->dev, "%s - event received\n", __func__); -- } else if (data[0] == WHITEHEAT_GET_DTR_RTS) { -+ } else if ((data[0] == WHITEHEAT_GET_DTR_RTS) && -+ (urb->actual_length - 1 <= sizeof(command_info->result_buffer))) { - memcpy(command_info->result_buffer, &data[1], - urb->actual_length - 1); - command_info->command_finished = WHITEHEAT_CMD_COMPLETE; -diff --git a/drivers/xen/events/events_fifo.c b/drivers/xen/events/events_fifo.c -index 640b3cf1a338..172a8bc27abd 100644 ---- a/drivers/xen/events/events_fifo.c -+++ b/drivers/xen/events/events_fifo.c -@@ -67,10 +67,9 @@ static event_word_t *event_array[MAX_EVENT_ARRAY_PAGES] __read_mostly; - static unsigned event_array_pages __read_mostly; - - /* -- * sync_set_bit() and friends must be unsigned long aligned on non-x86 -- * platforms. -+ * sync_set_bit() and friends must be unsigned long aligned. - */ --#if !defined(CONFIG_X86) && BITS_PER_LONG > 32 -+#if BITS_PER_LONG > 32 - - #define BM(w) (unsigned long *)((unsigned long)w & ~0x7UL) - #define EVTCHN_FIFO_BIT(b, w) \ -diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c -index 14d29d02097d..6244f9cf8ae3 100644 ---- a/fs/btrfs/backref.c -+++ b/fs/btrfs/backref.c -@@ -275,9 +275,8 @@ static int add_all_parents(struct btrfs_root *root, struct btrfs_path *path, - } - if (ret > 0) - goto next; -- ret = ulist_add_merge(parents, eb->start, -- (uintptr_t)eie, -- (u64 *)&old, GFP_NOFS); -+ ret = ulist_add_merge_ptr(parents, eb->start, -+ eie, (void **)&old, GFP_NOFS); - if (ret < 0) - break; - if (!ret && extent_item_pos) { -@@ -985,16 +984,19 @@ again: - ret = -EIO; - goto out; - } -+ btrfs_tree_read_lock(eb); -+ btrfs_set_lock_blocking_rw(eb, BTRFS_READ_LOCK); - ret = find_extent_in_eb(eb, bytenr, - *extent_item_pos, &eie); -+ btrfs_tree_read_unlock_blocking(eb); - free_extent_buffer(eb); - if (ret < 0) - goto out; - ref->inode_list = eie; - } -- ret = ulist_add_merge(refs, ref->parent, -- (uintptr_t)ref->inode_list, -- (u64 *)&eie, GFP_NOFS); -+ ret = ulist_add_merge_ptr(refs, ref->parent, -+ ref->inode_list, -+ (void **)&eie, GFP_NOFS); - if (ret < 0) - goto out; - if (!ret && extent_item_pos) { -diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c -index 2eea43f5067c..1a858947006e 100644 ---- a/fs/btrfs/extent_io.c -+++ b/fs/btrfs/extent_io.c -@@ -2525,6 +2525,7 @@ static void end_bio_extent_readpage(struct bio *bio, int err) - test_bit(BIO_UPTODATE, &bio->bi_flags); - if (err) - uptodate = 0; -+ offset += len; - continue; - } - } -diff --git a/fs/btrfs/file-item.c b/fs/btrfs/file-item.c -index 127555b29f58..ca248b0687f4 100644 ---- a/fs/btrfs/file-item.c -+++ b/fs/btrfs/file-item.c -@@ -756,7 +756,7 @@ again: - found_next = 1; - if (ret != 0) - goto insert; -- slot = 0; -+ slot = path->slots[0]; - } - btrfs_item_key_to_cpu(path->nodes[0], &found_key, slot); - if (found_key.objectid != BTRFS_EXTENT_CSUM_OBJECTID || -diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c -index d3d44486290b..c69c76351f12 100644 ---- a/fs/btrfs/inode.c -+++ b/fs/btrfs/inode.c -@@ -701,6 +701,18 @@ retry: - unlock_extent(io_tree, async_extent->start, - async_extent->start + - async_extent->ram_size - 1); -+ -+ /* -+ * we need to redirty the pages if we decide to -+ * fallback to uncompressed IO, otherwise we -+ * will not submit these pages down to lower -+ * layers. -+ */ -+ extent_range_redirty_for_io(inode, -+ async_extent->start, -+ async_extent->start + -+ async_extent->ram_size - 1); -+ - goto retry; - } - goto out_free; -diff --git a/fs/btrfs/ulist.h b/fs/btrfs/ulist.h -index 7f78cbf5cf41..4c29db604bbe 100644 ---- a/fs/btrfs/ulist.h -+++ b/fs/btrfs/ulist.h -@@ -57,6 +57,21 @@ void ulist_free(struct ulist *ulist); - int ulist_add(struct ulist *ulist, u64 val, u64 aux, gfp_t gfp_mask); - int ulist_add_merge(struct ulist *ulist, u64 val, u64 aux, - u64 *old_aux, gfp_t gfp_mask); -+ -+/* just like ulist_add_merge() but take a pointer for the aux data */ -+static inline int ulist_add_merge_ptr(struct ulist *ulist, u64 val, void *aux, -+ void **old_aux, gfp_t gfp_mask) -+{ -+#if BITS_PER_LONG == 32 -+ u64 old64 = (uintptr_t)*old_aux; -+ int ret = ulist_add_merge(ulist, val, (uintptr_t)aux, &old64, gfp_mask); -+ *old_aux = (void *)((uintptr_t)old64); -+ return ret; -+#else -+ return ulist_add_merge(ulist, val, (u64)aux, (u64 *)old_aux, gfp_mask); -+#endif -+} -+ - struct ulist_node *ulist_next(struct ulist *ulist, - struct ulist_iterator *uiter); - -diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c -index 9c0444cccbe1..15761957cc3f 100644 ---- a/fs/debugfs/inode.c -+++ b/fs/debugfs/inode.c -@@ -533,7 +533,7 @@ EXPORT_SYMBOL_GPL(debugfs_remove); - */ - void debugfs_remove_recursive(struct dentry *dentry) - { -- struct dentry *child, *next, *parent; -+ struct dentry *child, *parent; - - if (IS_ERR_OR_NULL(dentry)) - return; -@@ -545,30 +545,49 @@ void debugfs_remove_recursive(struct dentry *dentry) - parent = dentry; - down: - mutex_lock(&parent->d_inode->i_mutex); -- list_for_each_entry_safe(child, next, &parent->d_subdirs, d_u.d_child) { -+ loop: -+ /* -+ * The parent->d_subdirs is protected by the d_lock. Outside that -+ * lock, the child can be unlinked and set to be freed which can -+ * use the d_u.d_child as the rcu head and corrupt this list. -+ */ -+ spin_lock(&parent->d_lock); -+ list_for_each_entry(child, &parent->d_subdirs, d_u.d_child) { - if (!debugfs_positive(child)) - continue; - - /* perhaps simple_empty(child) makes more sense */ - if (!list_empty(&child->d_subdirs)) { -+ spin_unlock(&parent->d_lock); - mutex_unlock(&parent->d_inode->i_mutex); - parent = child; - goto down; - } -- up: -+ -+ spin_unlock(&parent->d_lock); -+ - if (!__debugfs_remove(child, parent)) - simple_release_fs(&debugfs_mount, &debugfs_mount_count); -+ -+ /* -+ * The parent->d_lock protects agaist child from unlinking -+ * from d_subdirs. When releasing the parent->d_lock we can -+ * no longer trust that the next pointer is valid. -+ * Restart the loop. We'll skip this one with the -+ * debugfs_positive() check. -+ */ -+ goto loop; - } -+ spin_unlock(&parent->d_lock); - - mutex_unlock(&parent->d_inode->i_mutex); - child = parent; - parent = parent->d_parent; - mutex_lock(&parent->d_inode->i_mutex); - -- if (child != dentry) { -- next = list_next_entry(child, d_u.d_child); -- goto up; -- } -+ if (child != dentry) -+ /* go up */ -+ goto loop; - - if (!__debugfs_remove(child, parent)) - simple_release_fs(&debugfs_mount, &debugfs_mount_count); -diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c -index a7029f481b7b..b56062dc8b62 100644 ---- a/fs/ext4/inode.c -+++ b/fs/ext4/inode.c -@@ -2195,6 +2195,7 @@ static int mpage_map_and_submit_extent(handle_t *handle, - struct ext4_map_blocks *map = &mpd->map; - int err; - loff_t disksize; -+ int progress = 0; - - mpd->io_submit.io_end->offset = - ((loff_t)map->m_lblk) << inode->i_blkbits; -@@ -2211,8 +2212,11 @@ static int mpage_map_and_submit_extent(handle_t *handle, - * is non-zero, a commit should free up blocks. - */ - if ((err == -ENOMEM) || -- (err == -ENOSPC && ext4_count_free_clusters(sb))) -+ (err == -ENOSPC && ext4_count_free_clusters(sb))) { -+ if (progress) -+ goto update_disksize; - return err; -+ } - ext4_msg(sb, KERN_CRIT, - "Delayed block allocation failed for " - "inode %lu at logical offset %llu with" -@@ -2229,15 +2233,17 @@ static int mpage_map_and_submit_extent(handle_t *handle, - *give_up_on_write = true; - return err; - } -+ progress = 1; - /* - * Update buffer state, submit mapped pages, and get us new - * extent to map - */ - err = mpage_map_and_submit_buffers(mpd); - if (err < 0) -- return err; -+ goto update_disksize; - } while (map->m_len); - -+update_disksize: - /* - * Update on-disk size after IO is submitted. Races with - * truncate are avoided by checking i_size under i_data_sem. -diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c -index 502f0fd71470..242226a87be7 100644 ---- a/fs/ext4/mballoc.c -+++ b/fs/ext4/mballoc.c -@@ -1398,6 +1398,8 @@ static void mb_free_blocks(struct inode *inode, struct ext4_buddy *e4b, - int last = first + count - 1; - struct super_block *sb = e4b->bd_sb; - -+ if (WARN_ON(count == 0)) -+ return; - BUG_ON(last >= (sb->s_blocksize << 3)); - assert_spin_locked(ext4_group_lock_ptr(sb, e4b->bd_group)); - /* Don't bother if the block group is corrupt. */ -@@ -3196,8 +3198,30 @@ static void ext4_mb_collect_stats(struct ext4_allocation_context *ac) - static void ext4_discard_allocated_blocks(struct ext4_allocation_context *ac) - { - struct ext4_prealloc_space *pa = ac->ac_pa; -+ struct ext4_buddy e4b; -+ int err; - -- if (pa && pa->pa_type == MB_INODE_PA) -+ if (pa == NULL) { -+ if (ac->ac_f_ex.fe_len == 0) -+ return; -+ err = ext4_mb_load_buddy(ac->ac_sb, ac->ac_f_ex.fe_group, &e4b); -+ if (err) { -+ /* -+ * This should never happen since we pin the -+ * pages in the ext4_allocation_context so -+ * ext4_mb_load_buddy() should never fail. -+ */ -+ WARN(1, "mb_load_buddy failed (%d)", err); -+ return; -+ } -+ ext4_lock_group(ac->ac_sb, ac->ac_f_ex.fe_group); -+ mb_free_blocks(ac->ac_inode, &e4b, ac->ac_f_ex.fe_start, -+ ac->ac_f_ex.fe_len); -+ ext4_unlock_group(ac->ac_sb, ac->ac_f_ex.fe_group); -+ ext4_mb_unload_buddy(&e4b); -+ return; -+ } -+ if (pa->pa_type == MB_INODE_PA) - pa->pa_free += ac->ac_b_ex.fe_len; - } - -diff --git a/fs/ext4/super.c b/fs/ext4/super.c -index 25b327e87318..a46030d6b4af 100644 ---- a/fs/ext4/super.c -+++ b/fs/ext4/super.c -@@ -3169,9 +3169,9 @@ static int set_journal_csum_feature_set(struct super_block *sb) - - if (EXT4_HAS_RO_COMPAT_FEATURE(sb, - EXT4_FEATURE_RO_COMPAT_METADATA_CSUM)) { -- /* journal checksum v2 */ -+ /* journal checksum v3 */ - compat = 0; -- incompat = JBD2_FEATURE_INCOMPAT_CSUM_V2; -+ incompat = JBD2_FEATURE_INCOMPAT_CSUM_V3; - } else { - /* journal checksum v1 */ - compat = JBD2_FEATURE_COMPAT_CHECKSUM; -@@ -3193,6 +3193,7 @@ static int set_journal_csum_feature_set(struct super_block *sb) - jbd2_journal_clear_features(sbi->s_journal, - JBD2_FEATURE_COMPAT_CHECKSUM, 0, - JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT | -+ JBD2_FEATURE_INCOMPAT_CSUM_V3 | - JBD2_FEATURE_INCOMPAT_CSUM_V2); - } - -diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c -index 4a9e10ea13f2..a9daccbd8fe7 100644 ---- a/fs/isofs/inode.c -+++ b/fs/isofs/inode.c -@@ -61,7 +61,7 @@ static void isofs_put_super(struct super_block *sb) - return; - } - --static int isofs_read_inode(struct inode *); -+static int isofs_read_inode(struct inode *, int relocated); - static int isofs_statfs (struct dentry *, struct kstatfs *); - - static struct kmem_cache *isofs_inode_cachep; -@@ -1258,7 +1258,7 @@ out_toomany: - goto out; - } - --static int isofs_read_inode(struct inode *inode) -+static int isofs_read_inode(struct inode *inode, int relocated) - { - struct super_block *sb = inode->i_sb; - struct isofs_sb_info *sbi = ISOFS_SB(sb); -@@ -1403,7 +1403,7 @@ static int isofs_read_inode(struct inode *inode) - */ - - if (!high_sierra) { -- parse_rock_ridge_inode(de, inode); -+ parse_rock_ridge_inode(de, inode, relocated); - /* if we want uid/gid set, override the rock ridge setting */ - if (sbi->s_uid_set) - inode->i_uid = sbi->s_uid; -@@ -1482,9 +1482,10 @@ static int isofs_iget5_set(struct inode *ino, void *data) - * offset that point to the underlying meta-data for the inode. The - * code below is otherwise similar to the iget() code in - * include/linux/fs.h */ --struct inode *isofs_iget(struct super_block *sb, -- unsigned long block, -- unsigned long offset) -+struct inode *__isofs_iget(struct super_block *sb, -+ unsigned long block, -+ unsigned long offset, -+ int relocated) - { - unsigned long hashval; - struct inode *inode; -@@ -1506,7 +1507,7 @@ struct inode *isofs_iget(struct super_block *sb, - return ERR_PTR(-ENOMEM); - - if (inode->i_state & I_NEW) { -- ret = isofs_read_inode(inode); -+ ret = isofs_read_inode(inode, relocated); - if (ret < 0) { - iget_failed(inode); - inode = ERR_PTR(ret); -diff --git a/fs/isofs/isofs.h b/fs/isofs/isofs.h -index 99167238518d..0ac4c1f73fbd 100644 ---- a/fs/isofs/isofs.h -+++ b/fs/isofs/isofs.h -@@ -107,7 +107,7 @@ extern int iso_date(char *, int); - - struct inode; /* To make gcc happy */ - --extern int parse_rock_ridge_inode(struct iso_directory_record *, struct inode *); -+extern int parse_rock_ridge_inode(struct iso_directory_record *, struct inode *, int relocated); - extern int get_rock_ridge_filename(struct iso_directory_record *, char *, struct inode *); - extern int isofs_name_translate(struct iso_directory_record *, char *, struct inode *); - -@@ -118,9 +118,24 @@ extern struct dentry *isofs_lookup(struct inode *, struct dentry *, unsigned int - extern struct buffer_head *isofs_bread(struct inode *, sector_t); - extern int isofs_get_blocks(struct inode *, sector_t, struct buffer_head **, unsigned long); - --extern struct inode *isofs_iget(struct super_block *sb, -- unsigned long block, -- unsigned long offset); -+struct inode *__isofs_iget(struct super_block *sb, -+ unsigned long block, -+ unsigned long offset, -+ int relocated); -+ -+static inline struct inode *isofs_iget(struct super_block *sb, -+ unsigned long block, -+ unsigned long offset) -+{ -+ return __isofs_iget(sb, block, offset, 0); -+} -+ -+static inline struct inode *isofs_iget_reloc(struct super_block *sb, -+ unsigned long block, -+ unsigned long offset) -+{ -+ return __isofs_iget(sb, block, offset, 1); -+} - - /* Because the inode number is no longer relevant to finding the - * underlying meta-data for an inode, we are free to choose a more -diff --git a/fs/isofs/rock.c b/fs/isofs/rock.c -index c0bf42472e40..f488bbae541a 100644 ---- a/fs/isofs/rock.c -+++ b/fs/isofs/rock.c -@@ -288,12 +288,16 @@ eio: - goto out; - } - -+#define RR_REGARD_XA 1 -+#define RR_RELOC_DE 2 -+ - static int - parse_rock_ridge_inode_internal(struct iso_directory_record *de, -- struct inode *inode, int regard_xa) -+ struct inode *inode, int flags) - { - int symlink_len = 0; - int cnt, sig; -+ unsigned int reloc_block; - struct inode *reloc; - struct rock_ridge *rr; - int rootflag; -@@ -305,7 +309,7 @@ parse_rock_ridge_inode_internal(struct iso_directory_record *de, - - init_rock_state(&rs, inode); - setup_rock_ridge(de, inode, &rs); -- if (regard_xa) { -+ if (flags & RR_REGARD_XA) { - rs.chr += 14; - rs.len -= 14; - if (rs.len < 0) -@@ -485,12 +489,22 @@ repeat: - "relocated directory\n"); - goto out; - case SIG('C', 'L'): -- ISOFS_I(inode)->i_first_extent = -- isonum_733(rr->u.CL.location); -- reloc = -- isofs_iget(inode->i_sb, -- ISOFS_I(inode)->i_first_extent, -- 0); -+ if (flags & RR_RELOC_DE) { -+ printk(KERN_ERR -+ "ISOFS: Recursive directory relocation " -+ "is not supported\n"); -+ goto eio; -+ } -+ reloc_block = isonum_733(rr->u.CL.location); -+ if (reloc_block == ISOFS_I(inode)->i_iget5_block && -+ ISOFS_I(inode)->i_iget5_offset == 0) { -+ printk(KERN_ERR -+ "ISOFS: Directory relocation points to " -+ "itself\n"); -+ goto eio; -+ } -+ ISOFS_I(inode)->i_first_extent = reloc_block; -+ reloc = isofs_iget_reloc(inode->i_sb, reloc_block, 0); - if (IS_ERR(reloc)) { - ret = PTR_ERR(reloc); - goto out; -@@ -637,9 +651,11 @@ static char *get_symlink_chunk(char *rpnt, struct rock_ridge *rr, char *plimit) - return rpnt; - } - --int parse_rock_ridge_inode(struct iso_directory_record *de, struct inode *inode) -+int parse_rock_ridge_inode(struct iso_directory_record *de, struct inode *inode, -+ int relocated) - { -- int result = parse_rock_ridge_inode_internal(de, inode, 0); -+ int flags = relocated ? RR_RELOC_DE : 0; -+ int result = parse_rock_ridge_inode_internal(de, inode, flags); - - /* - * if rockridge flag was reset and we didn't look for attributes -@@ -647,7 +663,8 @@ int parse_rock_ridge_inode(struct iso_directory_record *de, struct inode *inode) - */ - if ((ISOFS_SB(inode->i_sb)->s_rock_offset == -1) - && (ISOFS_SB(inode->i_sb)->s_rock == 2)) { -- result = parse_rock_ridge_inode_internal(de, inode, 14); -+ result = parse_rock_ridge_inode_internal(de, inode, -+ flags | RR_REGARD_XA); - } - return result; - } -diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c -index cf2fc0594063..9181c2b22b3c 100644 ---- a/fs/jbd2/commit.c -+++ b/fs/jbd2/commit.c -@@ -97,7 +97,7 @@ static void jbd2_commit_block_csum_set(journal_t *j, struct buffer_head *bh) - struct commit_header *h; - __u32 csum; - -- if (!JBD2_HAS_INCOMPAT_FEATURE(j, JBD2_FEATURE_INCOMPAT_CSUM_V2)) -+ if (!jbd2_journal_has_csum_v2or3(j)) - return; - - h = (struct commit_header *)(bh->b_data); -@@ -313,11 +313,11 @@ static __u32 jbd2_checksum_data(__u32 crc32_sum, struct buffer_head *bh) - return checksum; - } - --static void write_tag_block(int tag_bytes, journal_block_tag_t *tag, -+static void write_tag_block(journal_t *j, journal_block_tag_t *tag, - unsigned long long block) - { - tag->t_blocknr = cpu_to_be32(block & (u32)~0); -- if (tag_bytes > JBD2_TAG_SIZE32) -+ if (JBD2_HAS_INCOMPAT_FEATURE(j, JBD2_FEATURE_INCOMPAT_64BIT)) - tag->t_blocknr_high = cpu_to_be32((block >> 31) >> 1); - } - -@@ -327,7 +327,7 @@ static void jbd2_descr_block_csum_set(journal_t *j, - struct jbd2_journal_block_tail *tail; - __u32 csum; - -- if (!JBD2_HAS_INCOMPAT_FEATURE(j, JBD2_FEATURE_INCOMPAT_CSUM_V2)) -+ if (!jbd2_journal_has_csum_v2or3(j)) - return; - - tail = (struct jbd2_journal_block_tail *)(bh->b_data + j->j_blocksize - -@@ -340,12 +340,13 @@ static void jbd2_descr_block_csum_set(journal_t *j, - static void jbd2_block_tag_csum_set(journal_t *j, journal_block_tag_t *tag, - struct buffer_head *bh, __u32 sequence) - { -+ journal_block_tag3_t *tag3 = (journal_block_tag3_t *)tag; - struct page *page = bh->b_page; - __u8 *addr; - __u32 csum32; - __be32 seq; - -- if (!JBD2_HAS_INCOMPAT_FEATURE(j, JBD2_FEATURE_INCOMPAT_CSUM_V2)) -+ if (!jbd2_journal_has_csum_v2or3(j)) - return; - - seq = cpu_to_be32(sequence); -@@ -355,8 +356,10 @@ static void jbd2_block_tag_csum_set(journal_t *j, journal_block_tag_t *tag, - bh->b_size); - kunmap_atomic(addr); - -- /* We only have space to store the lower 16 bits of the crc32c. */ -- tag->t_checksum = cpu_to_be16(csum32); -+ if (JBD2_HAS_INCOMPAT_FEATURE(j, JBD2_FEATURE_INCOMPAT_CSUM_V3)) -+ tag3->t_checksum = cpu_to_be32(csum32); -+ else -+ tag->t_checksum = cpu_to_be16(csum32); - } - /* - * jbd2_journal_commit_transaction -@@ -396,7 +399,7 @@ void jbd2_journal_commit_transaction(journal_t *journal) - LIST_HEAD(io_bufs); - LIST_HEAD(log_bufs); - -- if (JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_CSUM_V2)) -+ if (jbd2_journal_has_csum_v2or3(journal)) - csum_size = sizeof(struct jbd2_journal_block_tail); - - /* -@@ -692,7 +695,7 @@ void jbd2_journal_commit_transaction(journal_t *journal) - tag_flag |= JBD2_FLAG_SAME_UUID; - - tag = (journal_block_tag_t *) tagp; -- write_tag_block(tag_bytes, tag, jh2bh(jh)->b_blocknr); -+ write_tag_block(journal, tag, jh2bh(jh)->b_blocknr); - tag->t_flags = cpu_to_be16(tag_flag); - jbd2_block_tag_csum_set(journal, tag, wbuf[bufs], - commit_transaction->t_tid); -diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c -index 5fa344afb49a..f2d78a3dae43 100644 ---- a/fs/jbd2/journal.c -+++ b/fs/jbd2/journal.c -@@ -124,7 +124,7 @@ EXPORT_SYMBOL(__jbd2_debug); - /* Checksumming functions */ - int jbd2_verify_csum_type(journal_t *j, journal_superblock_t *sb) - { -- if (!JBD2_HAS_INCOMPAT_FEATURE(j, JBD2_FEATURE_INCOMPAT_CSUM_V2)) -+ if (!jbd2_journal_has_csum_v2or3(j)) - return 1; - - return sb->s_checksum_type == JBD2_CRC32C_CHKSUM; -@@ -145,7 +145,7 @@ static __be32 jbd2_superblock_csum(journal_t *j, journal_superblock_t *sb) - - int jbd2_superblock_csum_verify(journal_t *j, journal_superblock_t *sb) - { -- if (!JBD2_HAS_INCOMPAT_FEATURE(j, JBD2_FEATURE_INCOMPAT_CSUM_V2)) -+ if (!jbd2_journal_has_csum_v2or3(j)) - return 1; - - return sb->s_checksum == jbd2_superblock_csum(j, sb); -@@ -153,7 +153,7 @@ int jbd2_superblock_csum_verify(journal_t *j, journal_superblock_t *sb) - - void jbd2_superblock_csum_set(journal_t *j, journal_superblock_t *sb) - { -- if (!JBD2_HAS_INCOMPAT_FEATURE(j, JBD2_FEATURE_INCOMPAT_CSUM_V2)) -+ if (!jbd2_journal_has_csum_v2or3(j)) - return; - - sb->s_checksum = jbd2_superblock_csum(j, sb); -@@ -1522,21 +1522,29 @@ static int journal_get_superblock(journal_t *journal) - goto out; - } - -- if (JBD2_HAS_COMPAT_FEATURE(journal, JBD2_FEATURE_COMPAT_CHECKSUM) && -- JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_CSUM_V2)) { -+ if (jbd2_journal_has_csum_v2or3(journal) && -+ JBD2_HAS_COMPAT_FEATURE(journal, JBD2_FEATURE_COMPAT_CHECKSUM)) { - /* Can't have checksum v1 and v2 on at the same time! */ - printk(KERN_ERR "JBD2: Can't enable checksumming v1 and v2 " - "at the same time!\n"); - goto out; - } - -+ if (JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_CSUM_V2) && -+ JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_CSUM_V3)) { -+ /* Can't have checksum v2 and v3 at the same time! */ -+ printk(KERN_ERR "JBD2: Can't enable checksumming v2 and v3 " -+ "at the same time!\n"); -+ goto out; -+ } -+ - if (!jbd2_verify_csum_type(journal, sb)) { - printk(KERN_ERR "JBD2: Unknown checksum type\n"); - goto out; - } - - /* Load the checksum driver */ -- if (JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_CSUM_V2)) { -+ if (jbd2_journal_has_csum_v2or3(journal)) { - journal->j_chksum_driver = crypto_alloc_shash("crc32c", 0, 0); - if (IS_ERR(journal->j_chksum_driver)) { - printk(KERN_ERR "JBD2: Cannot load crc32c driver.\n"); -@@ -1553,7 +1561,7 @@ static int journal_get_superblock(journal_t *journal) - } - - /* Precompute checksum seed for all metadata */ -- if (JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_CSUM_V2)) -+ if (jbd2_journal_has_csum_v2or3(journal)) - journal->j_csum_seed = jbd2_chksum(journal, ~0, sb->s_uuid, - sizeof(sb->s_uuid)); - -@@ -1813,8 +1821,14 @@ int jbd2_journal_set_features (journal_t *journal, unsigned long compat, - if (!jbd2_journal_check_available_features(journal, compat, ro, incompat)) - return 0; - -- /* Asking for checksumming v2 and v1? Only give them v2. */ -- if (incompat & JBD2_FEATURE_INCOMPAT_CSUM_V2 && -+ /* If enabling v2 checksums, turn on v3 instead */ -+ if (incompat & JBD2_FEATURE_INCOMPAT_CSUM_V2) { -+ incompat &= ~JBD2_FEATURE_INCOMPAT_CSUM_V2; -+ incompat |= JBD2_FEATURE_INCOMPAT_CSUM_V3; -+ } -+ -+ /* Asking for checksumming v3 and v1? Only give them v3. */ -+ if (incompat & JBD2_FEATURE_INCOMPAT_CSUM_V3 && - compat & JBD2_FEATURE_COMPAT_CHECKSUM) - compat &= ~JBD2_FEATURE_COMPAT_CHECKSUM; - -@@ -1823,8 +1837,8 @@ int jbd2_journal_set_features (journal_t *journal, unsigned long compat, - - sb = journal->j_superblock; - -- /* If enabling v2 checksums, update superblock */ -- if (INCOMPAT_FEATURE_ON(JBD2_FEATURE_INCOMPAT_CSUM_V2)) { -+ /* If enabling v3 checksums, update superblock */ -+ if (INCOMPAT_FEATURE_ON(JBD2_FEATURE_INCOMPAT_CSUM_V3)) { - sb->s_checksum_type = JBD2_CRC32C_CHKSUM; - sb->s_feature_compat &= - ~cpu_to_be32(JBD2_FEATURE_COMPAT_CHECKSUM); -@@ -1842,8 +1856,7 @@ int jbd2_journal_set_features (journal_t *journal, unsigned long compat, - } - - /* Precompute checksum seed for all metadata */ -- if (JBD2_HAS_INCOMPAT_FEATURE(journal, -- JBD2_FEATURE_INCOMPAT_CSUM_V2)) -+ if (jbd2_journal_has_csum_v2or3(journal)) - journal->j_csum_seed = jbd2_chksum(journal, ~0, - sb->s_uuid, - sizeof(sb->s_uuid)); -@@ -1852,7 +1865,8 @@ int jbd2_journal_set_features (journal_t *journal, unsigned long compat, - /* If enabling v1 checksums, downgrade superblock */ - if (COMPAT_FEATURE_ON(JBD2_FEATURE_COMPAT_CHECKSUM)) - sb->s_feature_incompat &= -- ~cpu_to_be32(JBD2_FEATURE_INCOMPAT_CSUM_V2); -+ ~cpu_to_be32(JBD2_FEATURE_INCOMPAT_CSUM_V2 | -+ JBD2_FEATURE_INCOMPAT_CSUM_V3); - - sb->s_feature_compat |= cpu_to_be32(compat); - sb->s_feature_ro_compat |= cpu_to_be32(ro); -@@ -2165,16 +2179,20 @@ int jbd2_journal_blocks_per_page(struct inode *inode) - */ - size_t journal_tag_bytes(journal_t *journal) - { -- journal_block_tag_t tag; -- size_t x = 0; -+ size_t sz; -+ -+ if (JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_CSUM_V3)) -+ return sizeof(journal_block_tag3_t); -+ -+ sz = sizeof(journal_block_tag_t); - - if (JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_CSUM_V2)) -- x += sizeof(tag.t_checksum); -+ sz += sizeof(__u16); - - if (JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_64BIT)) -- return x + JBD2_TAG_SIZE64; -+ return sz; - else -- return x + JBD2_TAG_SIZE32; -+ return sz - sizeof(__u32); - } - - /* -diff --git a/fs/jbd2/recovery.c b/fs/jbd2/recovery.c -index 3b6bb19d60b1..9b329b55ffe3 100644 ---- a/fs/jbd2/recovery.c -+++ b/fs/jbd2/recovery.c -@@ -181,7 +181,7 @@ static int jbd2_descr_block_csum_verify(journal_t *j, - __be32 provided; - __u32 calculated; - -- if (!JBD2_HAS_INCOMPAT_FEATURE(j, JBD2_FEATURE_INCOMPAT_CSUM_V2)) -+ if (!jbd2_journal_has_csum_v2or3(j)) - return 1; - - tail = (struct jbd2_journal_block_tail *)(buf + j->j_blocksize - -@@ -205,7 +205,7 @@ static int count_tags(journal_t *journal, struct buffer_head *bh) - int nr = 0, size = journal->j_blocksize; - int tag_bytes = journal_tag_bytes(journal); - -- if (JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_CSUM_V2)) -+ if (jbd2_journal_has_csum_v2or3(journal)) - size -= sizeof(struct jbd2_journal_block_tail); - - tagp = &bh->b_data[sizeof(journal_header_t)]; -@@ -338,10 +338,11 @@ int jbd2_journal_skip_recovery(journal_t *journal) - return err; - } - --static inline unsigned long long read_tag_block(int tag_bytes, journal_block_tag_t *tag) -+static inline unsigned long long read_tag_block(journal_t *journal, -+ journal_block_tag_t *tag) - { - unsigned long long block = be32_to_cpu(tag->t_blocknr); -- if (tag_bytes > JBD2_TAG_SIZE32) -+ if (JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_64BIT)) - block |= (u64)be32_to_cpu(tag->t_blocknr_high) << 32; - return block; - } -@@ -384,7 +385,7 @@ static int jbd2_commit_block_csum_verify(journal_t *j, void *buf) - __be32 provided; - __u32 calculated; - -- if (!JBD2_HAS_INCOMPAT_FEATURE(j, JBD2_FEATURE_INCOMPAT_CSUM_V2)) -+ if (!jbd2_journal_has_csum_v2or3(j)) - return 1; - - h = buf; -@@ -399,17 +400,21 @@ static int jbd2_commit_block_csum_verify(journal_t *j, void *buf) - static int jbd2_block_tag_csum_verify(journal_t *j, journal_block_tag_t *tag, - void *buf, __u32 sequence) - { -+ journal_block_tag3_t *tag3 = (journal_block_tag3_t *)tag; - __u32 csum32; - __be32 seq; - -- if (!JBD2_HAS_INCOMPAT_FEATURE(j, JBD2_FEATURE_INCOMPAT_CSUM_V2)) -+ if (!jbd2_journal_has_csum_v2or3(j)) - return 1; - - seq = cpu_to_be32(sequence); - csum32 = jbd2_chksum(j, j->j_csum_seed, (__u8 *)&seq, sizeof(seq)); - csum32 = jbd2_chksum(j, csum32, buf, j->j_blocksize); - -- return tag->t_checksum == cpu_to_be16(csum32); -+ if (JBD2_HAS_INCOMPAT_FEATURE(j, JBD2_FEATURE_INCOMPAT_CSUM_V3)) -+ return tag3->t_checksum == cpu_to_be32(csum32); -+ else -+ return tag->t_checksum == cpu_to_be16(csum32); - } - - static int do_one_pass(journal_t *journal, -@@ -426,6 +431,7 @@ static int do_one_pass(journal_t *journal, - int tag_bytes = journal_tag_bytes(journal); - __u32 crc32_sum = ~0; /* Transactional Checksums */ - int descr_csum_size = 0; -+ int block_error = 0; - - /* - * First thing is to establish what we expect to find in the log -@@ -512,8 +518,7 @@ static int do_one_pass(journal_t *journal, - switch(blocktype) { - case JBD2_DESCRIPTOR_BLOCK: - /* Verify checksum first */ -- if (JBD2_HAS_INCOMPAT_FEATURE(journal, -- JBD2_FEATURE_INCOMPAT_CSUM_V2)) -+ if (jbd2_journal_has_csum_v2or3(journal)) - descr_csum_size = - sizeof(struct jbd2_journal_block_tail); - if (descr_csum_size > 0 && -@@ -574,7 +579,7 @@ static int do_one_pass(journal_t *journal, - unsigned long long blocknr; - - J_ASSERT(obh != NULL); -- blocknr = read_tag_block(tag_bytes, -+ blocknr = read_tag_block(journal, - tag); - - /* If the block has been -@@ -598,7 +603,8 @@ static int do_one_pass(journal_t *journal, - "checksum recovering " - "block %llu in log\n", - blocknr); -- continue; -+ block_error = 1; -+ goto skip_write; - } - - /* Find a buffer for the new -@@ -797,7 +803,8 @@ static int do_one_pass(journal_t *journal, - success = -EIO; - } - } -- -+ if (block_error && success == 0) -+ success = -EIO; - return success; - - failed: -@@ -811,7 +818,7 @@ static int jbd2_revoke_block_csum_verify(journal_t *j, - __be32 provided; - __u32 calculated; - -- if (!JBD2_HAS_INCOMPAT_FEATURE(j, JBD2_FEATURE_INCOMPAT_CSUM_V2)) -+ if (!jbd2_journal_has_csum_v2or3(j)) - return 1; - - tail = (struct jbd2_journal_revoke_tail *)(buf + j->j_blocksize - -diff --git a/fs/jbd2/revoke.c b/fs/jbd2/revoke.c -index 198c9c10276d..d5e95a175c92 100644 ---- a/fs/jbd2/revoke.c -+++ b/fs/jbd2/revoke.c -@@ -91,8 +91,8 @@ - #include <linux/list.h> - #include <linux/init.h> - #include <linux/bio.h> --#endif - #include <linux/log2.h> -+#endif - - static struct kmem_cache *jbd2_revoke_record_cache; - static struct kmem_cache *jbd2_revoke_table_cache; -@@ -597,7 +597,7 @@ static void write_one_revoke_record(journal_t *journal, - offset = *offsetp; - - /* Do we need to leave space at the end for a checksum? */ -- if (JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_CSUM_V2)) -+ if (jbd2_journal_has_csum_v2or3(journal)) - csum_size = sizeof(struct jbd2_journal_revoke_tail); - - /* Make sure we have a descriptor with space left for the record */ -@@ -644,7 +644,7 @@ static void jbd2_revoke_csum_set(journal_t *j, struct buffer_head *bh) - struct jbd2_journal_revoke_tail *tail; - __u32 csum; - -- if (!JBD2_HAS_INCOMPAT_FEATURE(j, JBD2_FEATURE_INCOMPAT_CSUM_V2)) -+ if (!jbd2_journal_has_csum_v2or3(j)) - return; - - tail = (struct jbd2_journal_revoke_tail *)(bh->b_data + j->j_blocksize - -diff --git a/fs/nfs/nfs3acl.c b/fs/nfs/nfs3acl.c -index 8f854dde4150..24c6898159cc 100644 ---- a/fs/nfs/nfs3acl.c -+++ b/fs/nfs/nfs3acl.c -@@ -129,7 +129,10 @@ static int __nfs3_proc_setacls(struct inode *inode, struct posix_acl *acl, - .rpc_argp = &args, - .rpc_resp = &fattr, - }; -- int status; -+ int status = 0; -+ -+ if (acl == NULL && (!S_ISDIR(inode->i_mode) || dfacl == NULL)) -+ goto out; - - status = -EOPNOTSUPP; - if (!nfs_server_capable(inode, NFS_CAP_ACLS)) -@@ -256,7 +259,7 @@ nfs3_list_one_acl(struct inode *inode, int type, const char *name, void *data, - char *p = data + *result; - - acl = get_acl(inode, type); -- if (!acl) -+ if (IS_ERR_OR_NULL(acl)) - return 0; - - posix_acl_release(acl); -diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c -index d5d06e868841..17f91a72840b 100644 ---- a/fs/nfs/nfs4proc.c -+++ b/fs/nfs/nfs4proc.c -@@ -2546,6 +2546,7 @@ static void nfs4_close_prepare(struct rpc_task *task, void *data) - struct nfs4_closedata *calldata = data; - struct nfs4_state *state = calldata->state; - struct inode *inode = calldata->inode; -+ bool is_rdonly, is_wronly, is_rdwr; - int call_close = 0; - - dprintk("%s: begin!\n", __func__); -@@ -2553,18 +2554,24 @@ static void nfs4_close_prepare(struct rpc_task *task, void *data) - goto out_wait; - - task->tk_msg.rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_OPEN_DOWNGRADE]; -- calldata->arg.fmode = FMODE_READ|FMODE_WRITE; - spin_lock(&state->owner->so_lock); -+ is_rdwr = test_bit(NFS_O_RDWR_STATE, &state->flags); -+ is_rdonly = test_bit(NFS_O_RDONLY_STATE, &state->flags); -+ is_wronly = test_bit(NFS_O_WRONLY_STATE, &state->flags); -+ /* Calculate the current open share mode */ -+ calldata->arg.fmode = 0; -+ if (is_rdonly || is_rdwr) -+ calldata->arg.fmode |= FMODE_READ; -+ if (is_wronly || is_rdwr) -+ calldata->arg.fmode |= FMODE_WRITE; - /* Calculate the change in open mode */ - if (state->n_rdwr == 0) { - if (state->n_rdonly == 0) { -- call_close |= test_bit(NFS_O_RDONLY_STATE, &state->flags); -- call_close |= test_bit(NFS_O_RDWR_STATE, &state->flags); -+ call_close |= is_rdonly || is_rdwr; - calldata->arg.fmode &= ~FMODE_READ; - } - if (state->n_wronly == 0) { -- call_close |= test_bit(NFS_O_WRONLY_STATE, &state->flags); -- call_close |= test_bit(NFS_O_RDWR_STATE, &state->flags); -+ call_close |= is_wronly || is_rdwr; - calldata->arg.fmode &= ~FMODE_WRITE; - } - } -diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c -index 3eaa6e30a2dc..cc8c5b32043c 100644 ---- a/fs/nfsd/nfs4callback.c -+++ b/fs/nfsd/nfs4callback.c -@@ -672,7 +672,8 @@ static int setup_callback_client(struct nfs4_client *clp, struct nfs4_cb_conn *c - clp->cl_cb_session = ses; - args.bc_xprt = conn->cb_xprt; - args.prognumber = clp->cl_cb_session->se_cb_prog; -- args.protocol = XPRT_TRANSPORT_BC_TCP; -+ args.protocol = conn->cb_xprt->xpt_class->xcl_ident | -+ XPRT_TRANSPORT_BC; - args.authflavor = ses->se_cb_sec.flavor; - } - /* Create RPC client */ -diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c -index 9a4a5f9e7468..c34e45d1539b 100644 ---- a/fs/nfsd/nfssvc.c -+++ b/fs/nfsd/nfssvc.c -@@ -221,7 +221,8 @@ static int nfsd_startup_generic(int nrservs) - */ - ret = nfsd_racache_init(2*nrservs); - if (ret) -- return ret; -+ goto dec_users; -+ - ret = nfs4_state_start(); - if (ret) - goto out_racache; -@@ -229,6 +230,8 @@ static int nfsd_startup_generic(int nrservs) - - out_racache: - nfsd_racache_shutdown(); -+dec_users: -+ nfsd_users--; - return ret; - } - -diff --git a/include/drm/drm_pciids.h b/include/drm/drm_pciids.h -index 49376aec2fbb..bcec4c46cc2e 100644 ---- a/include/drm/drm_pciids.h -+++ b/include/drm/drm_pciids.h -@@ -17,6 +17,7 @@ - {0x1002, 0x1315, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ - {0x1002, 0x1316, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ - {0x1002, 0x1317, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ -+ {0x1002, 0x1318, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ - {0x1002, 0x131B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ - {0x1002, 0x131C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ - {0x1002, 0x131D, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ -@@ -164,8 +165,11 @@ - {0x1002, 0x6601, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ - {0x1002, 0x6602, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ - {0x1002, 0x6603, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ -+ {0x1002, 0x6604, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ -+ {0x1002, 0x6605, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ - {0x1002, 0x6606, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ - {0x1002, 0x6607, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ -+ {0x1002, 0x6608, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_NEW_MEMMAP}, \ - {0x1002, 0x6610, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_NEW_MEMMAP}, \ - {0x1002, 0x6611, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_NEW_MEMMAP}, \ - {0x1002, 0x6613, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_NEW_MEMMAP}, \ -@@ -175,6 +179,8 @@ - {0x1002, 0x6631, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_NEW_MEMMAP}, \ - {0x1002, 0x6640, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ - {0x1002, 0x6641, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ -+ {0x1002, 0x6646, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ -+ {0x1002, 0x6647, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ - {0x1002, 0x6649, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_NEW_MEMMAP}, \ - {0x1002, 0x6650, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_NEW_MEMMAP}, \ - {0x1002, 0x6651, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_NEW_MEMMAP}, \ -@@ -297,6 +303,7 @@ - {0x1002, 0x6829, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_NEW_MEMMAP}, \ - {0x1002, 0x682A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ - {0x1002, 0x682B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ -+ {0x1002, 0x682C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_NEW_MEMMAP}, \ - {0x1002, 0x682D, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ - {0x1002, 0x682F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ - {0x1002, 0x6830, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ -diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h -index d5b50a19463c..0dae71e9971c 100644 ---- a/include/linux/jbd2.h -+++ b/include/linux/jbd2.h -@@ -159,7 +159,11 @@ typedef struct journal_header_s - * journal_block_tag (in the descriptor). The other h_chksum* fields are - * not used. - * -- * Checksum v1 and v2 are mutually exclusive features. -+ * If FEATURE_INCOMPAT_CSUM_V3 is set, the descriptor block uses -+ * journal_block_tag3_t to store a full 32-bit checksum. Everything else -+ * is the same as v2. -+ * -+ * Checksum v1, v2, and v3 are mutually exclusive features. - */ - struct commit_header { - __be32 h_magic; -@@ -179,6 +183,14 @@ struct commit_header { - * raw struct shouldn't be used for pointer math or sizeof() - use - * journal_tag_bytes(journal) instead to compute this. - */ -+typedef struct journal_block_tag3_s -+{ -+ __be32 t_blocknr; /* The on-disk block number */ -+ __be32 t_flags; /* See below */ -+ __be32 t_blocknr_high; /* most-significant high 32bits. */ -+ __be32 t_checksum; /* crc32c(uuid+seq+block) */ -+} journal_block_tag3_t; -+ - typedef struct journal_block_tag_s - { - __be32 t_blocknr; /* The on-disk block number */ -@@ -187,9 +199,6 @@ typedef struct journal_block_tag_s - __be32 t_blocknr_high; /* most-significant high 32bits. */ - } journal_block_tag_t; - --#define JBD2_TAG_SIZE32 (offsetof(journal_block_tag_t, t_blocknr_high)) --#define JBD2_TAG_SIZE64 (sizeof(journal_block_tag_t)) -- - /* Tail of descriptor block, for checksumming */ - struct jbd2_journal_block_tail { - __be32 t_checksum; /* crc32c(uuid+descr_block) */ -@@ -284,6 +293,7 @@ typedef struct journal_superblock_s - #define JBD2_FEATURE_INCOMPAT_64BIT 0x00000002 - #define JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT 0x00000004 - #define JBD2_FEATURE_INCOMPAT_CSUM_V2 0x00000008 -+#define JBD2_FEATURE_INCOMPAT_CSUM_V3 0x00000010 - - /* Features known to this kernel version: */ - #define JBD2_KNOWN_COMPAT_FEATURES JBD2_FEATURE_COMPAT_CHECKSUM -@@ -291,7 +301,8 @@ typedef struct journal_superblock_s - #define JBD2_KNOWN_INCOMPAT_FEATURES (JBD2_FEATURE_INCOMPAT_REVOKE | \ - JBD2_FEATURE_INCOMPAT_64BIT | \ - JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT | \ -- JBD2_FEATURE_INCOMPAT_CSUM_V2) -+ JBD2_FEATURE_INCOMPAT_CSUM_V2 | \ -+ JBD2_FEATURE_INCOMPAT_CSUM_V3) - - #ifdef __KERNEL__ - -@@ -1296,6 +1307,15 @@ static inline int tid_geq(tid_t x, tid_t y) - extern int jbd2_journal_blocks_per_page(struct inode *inode); - extern size_t journal_tag_bytes(journal_t *journal); - -+static inline int jbd2_journal_has_csum_v2or3(journal_t *journal) -+{ -+ if (JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_CSUM_V2) || -+ JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_CSUM_V3)) -+ return 1; -+ -+ return 0; -+} -+ - /* - * We reserve t_outstanding_credits >> JBD2_CONTROL_BLOCKS_SHIFT for - * transaction control blocks. -diff --git a/include/linux/sunrpc/svc_xprt.h b/include/linux/sunrpc/svc_xprt.h -index b05963f09ebf..f5bfb1a80abe 100644 ---- a/include/linux/sunrpc/svc_xprt.h -+++ b/include/linux/sunrpc/svc_xprt.h -@@ -32,6 +32,7 @@ struct svc_xprt_class { - struct svc_xprt_ops *xcl_ops; - struct list_head xcl_list; - u32 xcl_max_payload; -+ int xcl_ident; - }; - - /* -diff --git a/kernel/sched/core.c b/kernel/sched/core.c -index 515e212421c0..677ebad70ce1 100644 ---- a/kernel/sched/core.c -+++ b/kernel/sched/core.c -@@ -3511,9 +3511,10 @@ static int _sched_setscheduler(struct task_struct *p, int policy, - }; - - /* -- * Fixup the legacy SCHED_RESET_ON_FORK hack -+ * Fixup the legacy SCHED_RESET_ON_FORK hack, except if -+ * the policy=-1 was passed by sched_setparam(). - */ -- if (policy & SCHED_RESET_ON_FORK) { -+ if ((policy != -1) && (policy & SCHED_RESET_ON_FORK)) { - attr.sched_flags |= SCHED_FLAG_RESET_ON_FORK; - policy &= ~SCHED_RESET_ON_FORK; - attr.sched_policy = policy; -diff --git a/mm/util.c b/mm/util.c -index a24aa22f2473..c1010cb7ca0c 100644 ---- a/mm/util.c -+++ b/mm/util.c -@@ -275,17 +275,14 @@ pid_t vm_is_stack(struct task_struct *task, - - if (in_group) { - struct task_struct *t; -- rcu_read_lock(); -- if (!pid_alive(task)) -- goto done; - -- t = task; -- do { -+ rcu_read_lock(); -+ for_each_thread(task, t) { - if (vm_is_stack_for_task(t, vma)) { - ret = t->pid; - goto done; - } -- } while_each_thread(task, t); -+ } - done: - rcu_read_unlock(); - } -diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c -index d06cb8752dcd..5e8fe777772b 100644 ---- a/net/sunrpc/svcsock.c -+++ b/net/sunrpc/svcsock.c -@@ -685,6 +685,7 @@ static struct svc_xprt_class svc_udp_class = { - .xcl_owner = THIS_MODULE, - .xcl_ops = &svc_udp_ops, - .xcl_max_payload = RPCSVC_MAXPAYLOAD_UDP, -+ .xcl_ident = XPRT_TRANSPORT_UDP, - }; - - static void svc_udp_init(struct svc_sock *svsk, struct svc_serv *serv) -@@ -1279,6 +1280,7 @@ static struct svc_xprt_class svc_tcp_class = { - .xcl_owner = THIS_MODULE, - .xcl_ops = &svc_tcp_ops, - .xcl_max_payload = RPCSVC_MAXPAYLOAD_TCP, -+ .xcl_ident = XPRT_TRANSPORT_TCP, - }; - - void svc_init_xprt_sock(void) -diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c -index 7d4df99f761f..03ac88431984 100644 ---- a/net/sunrpc/xprt.c -+++ b/net/sunrpc/xprt.c -@@ -1316,7 +1316,7 @@ struct rpc_xprt *xprt_create_transport(struct xprt_create *args) - } - } - spin_unlock(&xprt_list_lock); -- printk(KERN_ERR "RPC: transport (%d) not supported\n", args->ident); -+ dprintk("RPC: transport (%d) not supported\n", args->ident); - return ERR_PTR(-EIO); - - found: -diff --git a/net/sunrpc/xprtrdma/svc_rdma_transport.c b/net/sunrpc/xprtrdma/svc_rdma_transport.c -index 62e4f9bcc387..ed36cb52cd86 100644 ---- a/net/sunrpc/xprtrdma/svc_rdma_transport.c -+++ b/net/sunrpc/xprtrdma/svc_rdma_transport.c -@@ -89,6 +89,7 @@ struct svc_xprt_class svc_rdma_class = { - .xcl_owner = THIS_MODULE, - .xcl_ops = &svc_rdma_ops, - .xcl_max_payload = RPCSVC_MAXPAYLOAD_TCP, -+ .xcl_ident = XPRT_TRANSPORT_RDMA, - }; - - struct svc_rdma_op_ctxt *svc_rdma_get_context(struct svcxprt_rdma *xprt) -diff --git a/sound/pci/Kconfig b/sound/pci/Kconfig -index 8756c8e32922..46e563046bfb 100644 ---- a/sound/pci/Kconfig -+++ b/sound/pci/Kconfig -@@ -859,8 +859,8 @@ config SND_VIRTUOSO - select SND_JACK if INPUT=y || INPUT=SND - help - Say Y here to include support for sound cards based on the -- Asus AV66/AV100/AV200 chips, i.e., Xonar D1, DX, D2, D2X, DS, -- Essence ST (Deluxe), and Essence STX. -+ Asus AV66/AV100/AV200 chips, i.e., Xonar D1, DX, D2, D2X, DS, DSX, -+ Essence ST (Deluxe), and Essence STX (II). - Support for the HDAV1.3 (Deluxe) and HDAV1.3 Slim is experimental; - for the Xense, missing. - -diff --git a/sound/pci/hda/patch_ca0132.c b/sound/pci/hda/patch_ca0132.c -index 46ecdbb9053f..d5843da4ae19 100644 ---- a/sound/pci/hda/patch_ca0132.c -+++ b/sound/pci/hda/patch_ca0132.c -@@ -4379,6 +4379,9 @@ static void ca0132_download_dsp(struct hda_codec *codec) - return; /* NOP */ - #endif - -+ if (spec->dsp_state == DSP_DOWNLOAD_FAILED) -+ return; /* don't retry failures */ -+ - chipio_enable_clocks(codec); - spec->dsp_state = DSP_DOWNLOADING; - if (!ca0132_download_dsp_images(codec)) -@@ -4555,7 +4558,8 @@ static int ca0132_init(struct hda_codec *codec) - struct auto_pin_cfg *cfg = &spec->autocfg; - int i; - -- spec->dsp_state = DSP_DOWNLOAD_INIT; -+ if (spec->dsp_state != DSP_DOWNLOAD_FAILED) -+ spec->dsp_state = DSP_DOWNLOAD_INIT; - spec->curr_chip_addx = INVALID_CHIP_ADDRESS; - - snd_hda_power_up(codec); -@@ -4666,6 +4670,7 @@ static int patch_ca0132(struct hda_codec *codec) - codec->spec = spec; - spec->codec = codec; - -+ spec->dsp_state = DSP_DOWNLOAD_INIT; - spec->num_mixers = 1; - spec->mixers[0] = ca0132_mixer; - -diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c -index 2a16a90fd952..b35dbe25a6e3 100644 ---- a/sound/pci/hda/patch_realtek.c -+++ b/sound/pci/hda/patch_realtek.c -@@ -180,6 +180,8 @@ static void alc_fix_pll(struct hda_codec *codec) - spec->pll_coef_idx); - val = snd_hda_codec_read(codec, spec->pll_nid, 0, - AC_VERB_GET_PROC_COEF, 0); -+ if (val == -1) -+ return; - snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, - spec->pll_coef_idx); - snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF, -@@ -2765,6 +2767,8 @@ static int alc269_parse_auto_config(struct hda_codec *codec) - static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up) - { - int val = alc_read_coef_idx(codec, 0x04); -+ if (val == -1) -+ return; - if (power_up) - val |= 1 << 11; - else -@@ -3064,6 +3068,15 @@ static int alc269_resume(struct hda_codec *codec) - snd_hda_codec_resume_cache(codec); - alc_inv_dmic_sync(codec, true); - hda_call_check_power_status(codec, 0x01); -+ -+ /* on some machine, the BIOS will clear the codec gpio data when enter -+ * suspend, and won't restore the data after resume, so we restore it -+ * in the driver. -+ */ -+ if (spec->gpio_led) -+ snd_hda_codec_write(codec, codec->afg, 0, AC_VERB_SET_GPIO_DATA, -+ spec->gpio_led); -+ - if (spec->has_alc5505_dsp) - alc5505_dsp_resume(codec); - -@@ -4435,6 +4448,8 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { - SND_PCI_QUIRK(0x103c, 0x1983, "HP Pavilion", ALC269_FIXUP_HP_MUTE_LED_MIC1), - SND_PCI_QUIRK(0x103c, 0x218b, "HP", ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED), - /* ALC282 */ -+ SND_PCI_QUIRK(0x103c, 0x2191, "HP Touchsmart 14", ALC269_FIXUP_HP_MUTE_LED_MIC1), -+ SND_PCI_QUIRK(0x103c, 0x2192, "HP Touchsmart 15", ALC269_FIXUP_HP_MUTE_LED_MIC1), - SND_PCI_QUIRK(0x103c, 0x220d, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), - SND_PCI_QUIRK(0x103c, 0x220e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), - SND_PCI_QUIRK(0x103c, 0x220f, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), -@@ -4633,27 +4648,30 @@ static void alc269_fill_coef(struct hda_codec *codec) - if ((alc_get_coef0(codec) & 0x00ff) == 0x017) { - val = alc_read_coef_idx(codec, 0x04); - /* Power up output pin */ -- alc_write_coef_idx(codec, 0x04, val | (1<<11)); -+ if (val != -1) -+ alc_write_coef_idx(codec, 0x04, val | (1<<11)); - } - - if ((alc_get_coef0(codec) & 0x00ff) == 0x018) { - val = alc_read_coef_idx(codec, 0xd); -- if ((val & 0x0c00) >> 10 != 0x1) { -+ if (val != -1 && (val & 0x0c00) >> 10 != 0x1) { - /* Capless ramp up clock control */ - alc_write_coef_idx(codec, 0xd, val | (1<<10)); - } - val = alc_read_coef_idx(codec, 0x17); -- if ((val & 0x01c0) >> 6 != 0x4) { -+ if (val != -1 && (val & 0x01c0) >> 6 != 0x4) { - /* Class D power on reset */ - alc_write_coef_idx(codec, 0x17, val | (1<<7)); - } - } - - val = alc_read_coef_idx(codec, 0xd); /* Class D */ -- alc_write_coef_idx(codec, 0xd, val | (1<<14)); -+ if (val != -1) -+ alc_write_coef_idx(codec, 0xd, val | (1<<14)); - - val = alc_read_coef_idx(codec, 0x4); /* HP */ -- alc_write_coef_idx(codec, 0x4, val | (1<<11)); -+ if (val != -1) -+ alc_write_coef_idx(codec, 0x4, val | (1<<11)); - } - - /* -diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c -index 3bc29c9b2529..978df990f27c 100644 ---- a/sound/pci/hda/patch_sigmatel.c -+++ b/sound/pci/hda/patch_sigmatel.c -@@ -84,6 +84,7 @@ enum { - STAC_DELL_EQ, - STAC_ALIENWARE_M17X, - STAC_92HD89XX_HP_FRONT_JACK, -+ STAC_92HD89XX_HP_Z1_G2_RIGHT_MIC_JACK, - STAC_92HD73XX_MODELS - }; - -@@ -1803,6 +1804,11 @@ static const struct hda_pintbl stac92hd89xx_hp_front_jack_pin_configs[] = { - {} - }; - -+static const struct hda_pintbl stac92hd89xx_hp_z1_g2_right_mic_jack_pin_configs[] = { -+ { 0x0e, 0x400000f0 }, -+ {} -+}; -+ - static void stac92hd73xx_fixup_ref(struct hda_codec *codec, - const struct hda_fixup *fix, int action) - { -@@ -1925,6 +1931,10 @@ static const struct hda_fixup stac92hd73xx_fixups[] = { - [STAC_92HD89XX_HP_FRONT_JACK] = { - .type = HDA_FIXUP_PINS, - .v.pins = stac92hd89xx_hp_front_jack_pin_configs, -+ }, -+ [STAC_92HD89XX_HP_Z1_G2_RIGHT_MIC_JACK] = { -+ .type = HDA_FIXUP_PINS, -+ .v.pins = stac92hd89xx_hp_z1_g2_right_mic_jack_pin_configs, - } - }; - -@@ -1985,6 +1995,8 @@ static const struct snd_pci_quirk stac92hd73xx_fixup_tbl[] = { - "Alienware M17x", STAC_ALIENWARE_M17X), - SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0490, - "Alienware M17x R3", STAC_DELL_EQ), -+ SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1927, -+ "HP Z1 G2", STAC_92HD89XX_HP_Z1_G2_RIGHT_MIC_JACK), - SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2b17, - "unknown HP", STAC_92HD89XX_HP_FRONT_JACK), - {} /* terminator */ -diff --git a/sound/pci/oxygen/virtuoso.c b/sound/pci/oxygen/virtuoso.c -index 64b9fda5f04a..dbbbacfd535e 100644 ---- a/sound/pci/oxygen/virtuoso.c -+++ b/sound/pci/oxygen/virtuoso.c -@@ -53,6 +53,7 @@ static DEFINE_PCI_DEVICE_TABLE(xonar_ids) = { - { OXYGEN_PCI_SUBID(0x1043, 0x835e) }, - { OXYGEN_PCI_SUBID(0x1043, 0x838e) }, - { OXYGEN_PCI_SUBID(0x1043, 0x8522) }, -+ { OXYGEN_PCI_SUBID(0x1043, 0x85f4) }, - { OXYGEN_PCI_SUBID_BROKEN_EEPROM }, - { } - }; -diff --git a/sound/pci/oxygen/xonar_pcm179x.c b/sound/pci/oxygen/xonar_pcm179x.c -index c8c7f2c9b355..e02605931669 100644 ---- a/sound/pci/oxygen/xonar_pcm179x.c -+++ b/sound/pci/oxygen/xonar_pcm179x.c -@@ -100,8 +100,8 @@ - */ - - /* -- * Xonar Essence ST (Deluxe)/STX -- * ----------------------------- -+ * Xonar Essence ST (Deluxe)/STX (II) -+ * ---------------------------------- - * - * CMI8788: - * -@@ -1138,6 +1138,14 @@ int get_xonar_pcm179x_model(struct oxygen *chip, - chip->model.resume = xonar_stx_resume; - chip->model.set_dac_params = set_pcm1796_params; - break; -+ case 0x85f4: -+ chip->model = model_xonar_st; -+ /* TODO: daughterboard support */ -+ chip->model.shortname = "Xonar STX II"; -+ chip->model.init = xonar_stx_init; -+ chip->model.resume = xonar_stx_resume; -+ chip->model.set_dac_params = set_pcm1796_params; -+ break; - default: - return -EINVAL; - } -diff --git a/sound/usb/quirks-table.h b/sound/usb/quirks-table.h -index f652b10ce905..223c47b33ba3 100644 ---- a/sound/usb/quirks-table.h -+++ b/sound/usb/quirks-table.h -@@ -1581,6 +1581,35 @@ YAMAHA_DEVICE(0x7010, "UB99"), - } - }, - { -+ /* BOSS ME-25 */ -+ USB_DEVICE(0x0582, 0x0113), -+ .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { -+ .ifnum = QUIRK_ANY_INTERFACE, -+ .type = QUIRK_COMPOSITE, -+ .data = (const struct snd_usb_audio_quirk[]) { -+ { -+ .ifnum = 0, -+ .type = QUIRK_AUDIO_STANDARD_INTERFACE -+ }, -+ { -+ .ifnum = 1, -+ .type = QUIRK_AUDIO_STANDARD_INTERFACE -+ }, -+ { -+ .ifnum = 2, -+ .type = QUIRK_MIDI_FIXED_ENDPOINT, -+ .data = & (const struct snd_usb_midi_endpoint_info) { -+ .out_cables = 0x0001, -+ .in_cables = 0x0001 -+ } -+ }, -+ { -+ .ifnum = -1 -+ } -+ } -+ } -+}, -+{ - /* only 44.1 kHz works at the moment */ - USB_DEVICE(0x0582, 0x0120), - .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { -diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c -index 89730707614c..c64a3d96db22 100644 ---- a/sound/usb/quirks.c -+++ b/sound/usb/quirks.c -@@ -666,7 +666,7 @@ static int snd_usb_gamecon780_boot_quirk(struct usb_device *dev) - /* set the initial volume and don't change; other values are either - * too loud or silent due to firmware bug (bko#65251) - */ -- u8 buf[2] = { 0x74, 0xdc }; -+ u8 buf[2] = { 0x74, 0xe3 }; - return snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), UAC_SET_CUR, - USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_OUT, - UAC_FU_VOLUME << 8, 9 << 8, buf, 2); -diff --git a/virt/kvm/ioapic.c b/virt/kvm/ioapic.c -index 8c805a071507..b47541dd798f 100644 ---- a/virt/kvm/ioapic.c -+++ b/virt/kvm/ioapic.c -@@ -203,10 +203,9 @@ void kvm_ioapic_scan_entry(struct kvm_vcpu *vcpu, u64 *eoi_exit_bitmap, - spin_lock(&ioapic->lock); - for (index = 0; index < IOAPIC_NUM_PINS; index++) { - e = &ioapic->redirtbl[index]; -- if (!e->fields.mask && -- (e->fields.trig_mode == IOAPIC_LEVEL_TRIG || -- kvm_irq_has_notifier(ioapic->kvm, KVM_IRQCHIP_IOAPIC, -- index) || index == RTC_GSI)) { -+ if (e->fields.trig_mode == IOAPIC_LEVEL_TRIG || -+ kvm_irq_has_notifier(ioapic->kvm, KVM_IRQCHIP_IOAPIC, index) || -+ index == RTC_GSI) { - if (kvm_apic_match_dest(vcpu, NULL, 0, - e->fields.dest_id, e->fields.dest_mode)) { - __set_bit(e->fields.vector, -diff --git a/virt/kvm/iommu.c b/virt/kvm/iommu.c -index 0df7d4b34dfe..714b94932312 100644 ---- a/virt/kvm/iommu.c -+++ b/virt/kvm/iommu.c -@@ -61,6 +61,14 @@ static pfn_t kvm_pin_pages(struct kvm_memory_slot *slot, gfn_t gfn, - return pfn; - } - -+static void kvm_unpin_pages(struct kvm *kvm, pfn_t pfn, unsigned long npages) -+{ -+ unsigned long i; -+ -+ for (i = 0; i < npages; ++i) -+ kvm_release_pfn_clean(pfn + i); -+} -+ - int kvm_iommu_map_pages(struct kvm *kvm, struct kvm_memory_slot *slot) - { - gfn_t gfn, end_gfn; -@@ -123,6 +131,7 @@ int kvm_iommu_map_pages(struct kvm *kvm, struct kvm_memory_slot *slot) - if (r) { - printk(KERN_ERR "kvm_iommu_map_address:" - "iommu failed to map pfn=%llx\n", pfn); -+ kvm_unpin_pages(kvm, pfn, page_size); - goto unmap_pages; - } - -@@ -134,7 +143,7 @@ int kvm_iommu_map_pages(struct kvm *kvm, struct kvm_memory_slot *slot) - return 0; - - unmap_pages: -- kvm_iommu_put_pages(kvm, slot->base_gfn, gfn); -+ kvm_iommu_put_pages(kvm, slot->base_gfn, gfn - slot->base_gfn); - return r; - } - -@@ -266,14 +275,6 @@ out_unlock: - return r; - } - --static void kvm_unpin_pages(struct kvm *kvm, pfn_t pfn, unsigned long npages) --{ -- unsigned long i; -- -- for (i = 0; i < npages; ++i) -- kvm_release_pfn_clean(pfn + i); --} -- - static void kvm_iommu_put_pages(struct kvm *kvm, - gfn_t base_gfn, unsigned long npages) - { diff --git a/projects/imx6/patches/linux/linux-000-patch-3.14.18-19.patch b/projects/imx6/patches/linux/linux-000-patch-3.14.18-19.patch deleted file mode 100644 index 3b52b4ab6e6..00000000000 --- a/projects/imx6/patches/linux/linux-000-patch-3.14.18-19.patch +++ /dev/null @@ -1,4843 +0,0 @@ -diff --git a/Documentation/devicetree/bindings/sound/adi,axi-spdif-tx.txt b/Documentation/devicetree/bindings/sound/adi,axi-spdif-tx.txt -index 46f344965313..4eb7997674a0 100644 ---- a/Documentation/devicetree/bindings/sound/adi,axi-spdif-tx.txt -+++ b/Documentation/devicetree/bindings/sound/adi,axi-spdif-tx.txt -@@ -1,7 +1,7 @@ - ADI AXI-SPDIF controller - - Required properties: -- - compatible : Must be "adi,axi-spdif-1.00.a" -+ - compatible : Must be "adi,axi-spdif-tx-1.00.a" - - reg : Must contain SPDIF core's registers location and length - - clocks : Pairs of phandle and specifier referencing the controller's clocks. - The controller expects two clocks, the clock used for the AXI interface and -diff --git a/Makefile b/Makefile -index 05279d4f44c9..b1746b486646 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,6 +1,6 @@ - VERSION = 3 - PATCHLEVEL = 14 --SUBLEVEL = 18 -+SUBLEVEL = 19 - EXTRAVERSION = - NAME = Remembering Coco - -diff --git a/arch/mips/cavium-octeon/setup.c b/arch/mips/cavium-octeon/setup.c -index 331b837cec57..270cb3c6c498 100644 ---- a/arch/mips/cavium-octeon/setup.c -+++ b/arch/mips/cavium-octeon/setup.c -@@ -458,6 +458,18 @@ static void octeon_halt(void) - octeon_kill_core(NULL); - } - -+static char __read_mostly octeon_system_type[80]; -+ -+static int __init init_octeon_system_type(void) -+{ -+ snprintf(octeon_system_type, sizeof(octeon_system_type), "%s (%s)", -+ cvmx_board_type_to_string(octeon_bootinfo->board_type), -+ octeon_model_get_string(read_c0_prid())); -+ -+ return 0; -+} -+early_initcall(init_octeon_system_type); -+ - /** - * Return a string representing the system type - * -@@ -465,11 +477,7 @@ static void octeon_halt(void) - */ - const char *octeon_board_type_string(void) - { -- static char name[80]; -- sprintf(name, "%s (%s)", -- cvmx_board_type_to_string(octeon_bootinfo->board_type), -- octeon_model_get_string(read_c0_prid())); -- return name; -+ return octeon_system_type; - } - - const char *get_system_type(void) -diff --git a/arch/mips/include/asm/ptrace.h b/arch/mips/include/asm/ptrace.h -index 7bba9da110af..6d019ca1bead 100644 ---- a/arch/mips/include/asm/ptrace.h -+++ b/arch/mips/include/asm/ptrace.h -@@ -23,7 +23,7 @@ - struct pt_regs { - #ifdef CONFIG_32BIT - /* Pad bytes for argument save space on the stack. */ -- unsigned long pad0[6]; -+ unsigned long pad0[8]; - #endif - - /* Saved main processor registers. */ -diff --git a/arch/mips/include/asm/reg.h b/arch/mips/include/asm/reg.h -index 910e71a12466..b8343ccbc989 100644 ---- a/arch/mips/include/asm/reg.h -+++ b/arch/mips/include/asm/reg.h -@@ -12,116 +12,194 @@ - #ifndef __ASM_MIPS_REG_H - #define __ASM_MIPS_REG_H - -- --#if defined(CONFIG_32BIT) || defined(WANT_COMPAT_REG_H) -- --#define EF_R0 6 --#define EF_R1 7 --#define EF_R2 8 --#define EF_R3 9 --#define EF_R4 10 --#define EF_R5 11 --#define EF_R6 12 --#define EF_R7 13 --#define EF_R8 14 --#define EF_R9 15 --#define EF_R10 16 --#define EF_R11 17 --#define EF_R12 18 --#define EF_R13 19 --#define EF_R14 20 --#define EF_R15 21 --#define EF_R16 22 --#define EF_R17 23 --#define EF_R18 24 --#define EF_R19 25 --#define EF_R20 26 --#define EF_R21 27 --#define EF_R22 28 --#define EF_R23 29 --#define EF_R24 30 --#define EF_R25 31 -+#define MIPS32_EF_R0 6 -+#define MIPS32_EF_R1 7 -+#define MIPS32_EF_R2 8 -+#define MIPS32_EF_R3 9 -+#define MIPS32_EF_R4 10 -+#define MIPS32_EF_R5 11 -+#define MIPS32_EF_R6 12 -+#define MIPS32_EF_R7 13 -+#define MIPS32_EF_R8 14 -+#define MIPS32_EF_R9 15 -+#define MIPS32_EF_R10 16 -+#define MIPS32_EF_R11 17 -+#define MIPS32_EF_R12 18 -+#define MIPS32_EF_R13 19 -+#define MIPS32_EF_R14 20 -+#define MIPS32_EF_R15 21 -+#define MIPS32_EF_R16 22 -+#define MIPS32_EF_R17 23 -+#define MIPS32_EF_R18 24 -+#define MIPS32_EF_R19 25 -+#define MIPS32_EF_R20 26 -+#define MIPS32_EF_R21 27 -+#define MIPS32_EF_R22 28 -+#define MIPS32_EF_R23 29 -+#define MIPS32_EF_R24 30 -+#define MIPS32_EF_R25 31 - - /* - * k0/k1 unsaved - */ --#define EF_R26 32 --#define EF_R27 33 -+#define MIPS32_EF_R26 32 -+#define MIPS32_EF_R27 33 - --#define EF_R28 34 --#define EF_R29 35 --#define EF_R30 36 --#define EF_R31 37 -+#define MIPS32_EF_R28 34 -+#define MIPS32_EF_R29 35 -+#define MIPS32_EF_R30 36 -+#define MIPS32_EF_R31 37 - - /* - * Saved special registers - */ --#define EF_LO 38 --#define EF_HI 39 -- --#define EF_CP0_EPC 40 --#define EF_CP0_BADVADDR 41 --#define EF_CP0_STATUS 42 --#define EF_CP0_CAUSE 43 --#define EF_UNUSED0 44 -- --#define EF_SIZE 180 -- --#endif -- --#if defined(CONFIG_64BIT) && !defined(WANT_COMPAT_REG_H) -- --#define EF_R0 0 --#define EF_R1 1 --#define EF_R2 2 --#define EF_R3 3 --#define EF_R4 4 --#define EF_R5 5 --#define EF_R6 6 --#define EF_R7 7 --#define EF_R8 8 --#define EF_R9 9 --#define EF_R10 10 --#define EF_R11 11 --#define EF_R12 12 --#define EF_R13 13 --#define EF_R14 14 --#define EF_R15 15 --#define EF_R16 16 --#define EF_R17 17 --#define EF_R18 18 --#define EF_R19 19 --#define EF_R20 20 --#define EF_R21 21 --#define EF_R22 22 --#define EF_R23 23 --#define EF_R24 24 --#define EF_R25 25 -+#define MIPS32_EF_LO 38 -+#define MIPS32_EF_HI 39 -+ -+#define MIPS32_EF_CP0_EPC 40 -+#define MIPS32_EF_CP0_BADVADDR 41 -+#define MIPS32_EF_CP0_STATUS 42 -+#define MIPS32_EF_CP0_CAUSE 43 -+#define MIPS32_EF_UNUSED0 44 -+ -+#define MIPS32_EF_SIZE 180 -+ -+#define MIPS64_EF_R0 0 -+#define MIPS64_EF_R1 1 -+#define MIPS64_EF_R2 2 -+#define MIPS64_EF_R3 3 -+#define MIPS64_EF_R4 4 -+#define MIPS64_EF_R5 5 -+#define MIPS64_EF_R6 6 -+#define MIPS64_EF_R7 7 -+#define MIPS64_EF_R8 8 -+#define MIPS64_EF_R9 9 -+#define MIPS64_EF_R10 10 -+#define MIPS64_EF_R11 11 -+#define MIPS64_EF_R12 12 -+#define MIPS64_EF_R13 13 -+#define MIPS64_EF_R14 14 -+#define MIPS64_EF_R15 15 -+#define MIPS64_EF_R16 16 -+#define MIPS64_EF_R17 17 -+#define MIPS64_EF_R18 18 -+#define MIPS64_EF_R19 19 -+#define MIPS64_EF_R20 20 -+#define MIPS64_EF_R21 21 -+#define MIPS64_EF_R22 22 -+#define MIPS64_EF_R23 23 -+#define MIPS64_EF_R24 24 -+#define MIPS64_EF_R25 25 - - /* - * k0/k1 unsaved - */ --#define EF_R26 26 --#define EF_R27 27 -+#define MIPS64_EF_R26 26 -+#define MIPS64_EF_R27 27 - - --#define EF_R28 28 --#define EF_R29 29 --#define EF_R30 30 --#define EF_R31 31 -+#define MIPS64_EF_R28 28 -+#define MIPS64_EF_R29 29 -+#define MIPS64_EF_R30 30 -+#define MIPS64_EF_R31 31 - - /* - * Saved special registers - */ --#define EF_LO 32 --#define EF_HI 33 -- --#define EF_CP0_EPC 34 --#define EF_CP0_BADVADDR 35 --#define EF_CP0_STATUS 36 --#define EF_CP0_CAUSE 37 -- --#define EF_SIZE 304 /* size in bytes */ -+#define MIPS64_EF_LO 32 -+#define MIPS64_EF_HI 33 -+ -+#define MIPS64_EF_CP0_EPC 34 -+#define MIPS64_EF_CP0_BADVADDR 35 -+#define MIPS64_EF_CP0_STATUS 36 -+#define MIPS64_EF_CP0_CAUSE 37 -+ -+#define MIPS64_EF_SIZE 304 /* size in bytes */ -+ -+#if defined(CONFIG_32BIT) -+ -+#define EF_R0 MIPS32_EF_R0 -+#define EF_R1 MIPS32_EF_R1 -+#define EF_R2 MIPS32_EF_R2 -+#define EF_R3 MIPS32_EF_R3 -+#define EF_R4 MIPS32_EF_R4 -+#define EF_R5 MIPS32_EF_R5 -+#define EF_R6 MIPS32_EF_R6 -+#define EF_R7 MIPS32_EF_R7 -+#define EF_R8 MIPS32_EF_R8 -+#define EF_R9 MIPS32_EF_R9 -+#define EF_R10 MIPS32_EF_R10 -+#define EF_R11 MIPS32_EF_R11 -+#define EF_R12 MIPS32_EF_R12 -+#define EF_R13 MIPS32_EF_R13 -+#define EF_R14 MIPS32_EF_R14 -+#define EF_R15 MIPS32_EF_R15 -+#define EF_R16 MIPS32_EF_R16 -+#define EF_R17 MIPS32_EF_R17 -+#define EF_R18 MIPS32_EF_R18 -+#define EF_R19 MIPS32_EF_R19 -+#define EF_R20 MIPS32_EF_R20 -+#define EF_R21 MIPS32_EF_R21 -+#define EF_R22 MIPS32_EF_R22 -+#define EF_R23 MIPS32_EF_R23 -+#define EF_R24 MIPS32_EF_R24 -+#define EF_R25 MIPS32_EF_R25 -+#define EF_R26 MIPS32_EF_R26 -+#define EF_R27 MIPS32_EF_R27 -+#define EF_R28 MIPS32_EF_R28 -+#define EF_R29 MIPS32_EF_R29 -+#define EF_R30 MIPS32_EF_R30 -+#define EF_R31 MIPS32_EF_R31 -+#define EF_LO MIPS32_EF_LO -+#define EF_HI MIPS32_EF_HI -+#define EF_CP0_EPC MIPS32_EF_CP0_EPC -+#define EF_CP0_BADVADDR MIPS32_EF_CP0_BADVADDR -+#define EF_CP0_STATUS MIPS32_EF_CP0_STATUS -+#define EF_CP0_CAUSE MIPS32_EF_CP0_CAUSE -+#define EF_UNUSED0 MIPS32_EF_UNUSED0 -+#define EF_SIZE MIPS32_EF_SIZE -+ -+#elif defined(CONFIG_64BIT) -+ -+#define EF_R0 MIPS64_EF_R0 -+#define EF_R1 MIPS64_EF_R1 -+#define EF_R2 MIPS64_EF_R2 -+#define EF_R3 MIPS64_EF_R3 -+#define EF_R4 MIPS64_EF_R4 -+#define EF_R5 MIPS64_EF_R5 -+#define EF_R6 MIPS64_EF_R6 -+#define EF_R7 MIPS64_EF_R7 -+#define EF_R8 MIPS64_EF_R8 -+#define EF_R9 MIPS64_EF_R9 -+#define EF_R10 MIPS64_EF_R10 -+#define EF_R11 MIPS64_EF_R11 -+#define EF_R12 MIPS64_EF_R12 -+#define EF_R13 MIPS64_EF_R13 -+#define EF_R14 MIPS64_EF_R14 -+#define EF_R15 MIPS64_EF_R15 -+#define EF_R16 MIPS64_EF_R16 -+#define EF_R17 MIPS64_EF_R17 -+#define EF_R18 MIPS64_EF_R18 -+#define EF_R19 MIPS64_EF_R19 -+#define EF_R20 MIPS64_EF_R20 -+#define EF_R21 MIPS64_EF_R21 -+#define EF_R22 MIPS64_EF_R22 -+#define EF_R23 MIPS64_EF_R23 -+#define EF_R24 MIPS64_EF_R24 -+#define EF_R25 MIPS64_EF_R25 -+#define EF_R26 MIPS64_EF_R26 -+#define EF_R27 MIPS64_EF_R27 -+#define EF_R28 MIPS64_EF_R28 -+#define EF_R29 MIPS64_EF_R29 -+#define EF_R30 MIPS64_EF_R30 -+#define EF_R31 MIPS64_EF_R31 -+#define EF_LO MIPS64_EF_LO -+#define EF_HI MIPS64_EF_HI -+#define EF_CP0_EPC MIPS64_EF_CP0_EPC -+#define EF_CP0_BADVADDR MIPS64_EF_CP0_BADVADDR -+#define EF_CP0_STATUS MIPS64_EF_CP0_STATUS -+#define EF_CP0_CAUSE MIPS64_EF_CP0_CAUSE -+#define EF_SIZE MIPS64_EF_SIZE - - #endif /* CONFIG_64BIT */ - -diff --git a/arch/mips/kernel/binfmt_elfo32.c b/arch/mips/kernel/binfmt_elfo32.c -index 7faf5f2bee25..71df942fb77c 100644 ---- a/arch/mips/kernel/binfmt_elfo32.c -+++ b/arch/mips/kernel/binfmt_elfo32.c -@@ -72,12 +72,6 @@ typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG]; - - #include <asm/processor.h> - --/* -- * When this file is selected, we are definitely running a 64bit kernel. -- * So using the right regs define in asm/reg.h -- */ --#define WANT_COMPAT_REG_H -- - /* These MUST be defined before elf.h gets included */ - extern void elf32_core_copy_regs(elf_gregset_t grp, struct pt_regs *regs); - #define ELF_CORE_COPY_REGS(_dest, _regs) elf32_core_copy_regs(_dest, _regs); -@@ -149,21 +143,21 @@ void elf32_core_copy_regs(elf_gregset_t grp, struct pt_regs *regs) - { - int i; - -- for (i = 0; i < EF_R0; i++) -+ for (i = 0; i < MIPS32_EF_R0; i++) - grp[i] = 0; -- grp[EF_R0] = 0; -+ grp[MIPS32_EF_R0] = 0; - for (i = 1; i <= 31; i++) -- grp[EF_R0 + i] = (elf_greg_t) regs->regs[i]; -- grp[EF_R26] = 0; -- grp[EF_R27] = 0; -- grp[EF_LO] = (elf_greg_t) regs->lo; -- grp[EF_HI] = (elf_greg_t) regs->hi; -- grp[EF_CP0_EPC] = (elf_greg_t) regs->cp0_epc; -- grp[EF_CP0_BADVADDR] = (elf_greg_t) regs->cp0_badvaddr; -- grp[EF_CP0_STATUS] = (elf_greg_t) regs->cp0_status; -- grp[EF_CP0_CAUSE] = (elf_greg_t) regs->cp0_cause; --#ifdef EF_UNUSED0 -- grp[EF_UNUSED0] = 0; -+ grp[MIPS32_EF_R0 + i] = (elf_greg_t) regs->regs[i]; -+ grp[MIPS32_EF_R26] = 0; -+ grp[MIPS32_EF_R27] = 0; -+ grp[MIPS32_EF_LO] = (elf_greg_t) regs->lo; -+ grp[MIPS32_EF_HI] = (elf_greg_t) regs->hi; -+ grp[MIPS32_EF_CP0_EPC] = (elf_greg_t) regs->cp0_epc; -+ grp[MIPS32_EF_CP0_BADVADDR] = (elf_greg_t) regs->cp0_badvaddr; -+ grp[MIPS32_EF_CP0_STATUS] = (elf_greg_t) regs->cp0_status; -+ grp[MIPS32_EF_CP0_CAUSE] = (elf_greg_t) regs->cp0_cause; -+#ifdef MIPS32_EF_UNUSED0 -+ grp[MIPS32_EF_UNUSED0] = 0; - #endif - } - -diff --git a/arch/mips/kernel/irq-gic.c b/arch/mips/kernel/irq-gic.c -index 5b5ddb231f26..78f18436cdf2 100644 ---- a/arch/mips/kernel/irq-gic.c -+++ b/arch/mips/kernel/irq-gic.c -@@ -255,11 +255,13 @@ static void __init gic_setup_intr(unsigned int intr, unsigned int cpu, - - /* Setup Intr to Pin mapping */ - if (pin & GIC_MAP_TO_NMI_MSK) { -+ int i; -+ - GICWRITE(GIC_REG_ADDR(SHARED, GIC_SH_MAP_TO_PIN(intr)), pin); - /* FIXME: hack to route NMI to all cpu's */ -- for (cpu = 0; cpu < NR_CPUS; cpu += 32) { -+ for (i = 0; i < NR_CPUS; i += 32) { - GICWRITE(GIC_REG_ADDR(SHARED, -- GIC_SH_MAP_TO_VPE_REG_OFF(intr, cpu)), -+ GIC_SH_MAP_TO_VPE_REG_OFF(intr, i)), - 0xffffffff); - } - } else { -diff --git a/arch/mips/kernel/ptrace.c b/arch/mips/kernel/ptrace.c -index 7da9b76db4d9..60f48febe762 100644 ---- a/arch/mips/kernel/ptrace.c -+++ b/arch/mips/kernel/ptrace.c -@@ -170,6 +170,7 @@ int ptrace_setfpregs(struct task_struct *child, __u32 __user *data) - __get_user(fregs[i], i + (__u64 __user *) data); - - __get_user(child->thread.fpu.fcr31, data + 64); -+ child->thread.fpu.fcr31 &= ~FPU_CSR_ALL_X; - - /* FIR may not be written. */ - -@@ -265,36 +266,160 @@ int ptrace_set_watch_regs(struct task_struct *child, - - /* regset get/set implementations */ - --static int gpr_get(struct task_struct *target, -- const struct user_regset *regset, -- unsigned int pos, unsigned int count, -- void *kbuf, void __user *ubuf) -+#if defined(CONFIG_32BIT) || defined(CONFIG_MIPS32_O32) -+ -+static int gpr32_get(struct task_struct *target, -+ const struct user_regset *regset, -+ unsigned int pos, unsigned int count, -+ void *kbuf, void __user *ubuf) - { - struct pt_regs *regs = task_pt_regs(target); -+ u32 uregs[ELF_NGREG] = {}; -+ unsigned i; - -- return user_regset_copyout(&pos, &count, &kbuf, &ubuf, -- regs, 0, sizeof(*regs)); -+ for (i = MIPS32_EF_R1; i <= MIPS32_EF_R31; i++) { -+ /* k0/k1 are copied as zero. */ -+ if (i == MIPS32_EF_R26 || i == MIPS32_EF_R27) -+ continue; -+ -+ uregs[i] = regs->regs[i - MIPS32_EF_R0]; -+ } -+ -+ uregs[MIPS32_EF_LO] = regs->lo; -+ uregs[MIPS32_EF_HI] = regs->hi; -+ uregs[MIPS32_EF_CP0_EPC] = regs->cp0_epc; -+ uregs[MIPS32_EF_CP0_BADVADDR] = regs->cp0_badvaddr; -+ uregs[MIPS32_EF_CP0_STATUS] = regs->cp0_status; -+ uregs[MIPS32_EF_CP0_CAUSE] = regs->cp0_cause; -+ -+ return user_regset_copyout(&pos, &count, &kbuf, &ubuf, uregs, 0, -+ sizeof(uregs)); - } - --static int gpr_set(struct task_struct *target, -- const struct user_regset *regset, -- unsigned int pos, unsigned int count, -- const void *kbuf, const void __user *ubuf) -+static int gpr32_set(struct task_struct *target, -+ const struct user_regset *regset, -+ unsigned int pos, unsigned int count, -+ const void *kbuf, const void __user *ubuf) - { -- struct pt_regs newregs; -- int ret; -+ struct pt_regs *regs = task_pt_regs(target); -+ u32 uregs[ELF_NGREG]; -+ unsigned start, num_regs, i; -+ int err; - -- ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, -- &newregs, -- 0, sizeof(newregs)); -- if (ret) -- return ret; -+ start = pos / sizeof(u32); -+ num_regs = count / sizeof(u32); - -- *task_pt_regs(target) = newregs; -+ if (start + num_regs > ELF_NGREG) -+ return -EIO; -+ -+ err = user_regset_copyin(&pos, &count, &kbuf, &ubuf, uregs, 0, -+ sizeof(uregs)); -+ if (err) -+ return err; -+ -+ for (i = start; i < num_regs; i++) { -+ /* -+ * Cast all values to signed here so that if this is a 64-bit -+ * kernel, the supplied 32-bit values will be sign extended. -+ */ -+ switch (i) { -+ case MIPS32_EF_R1 ... MIPS32_EF_R25: -+ /* k0/k1 are ignored. */ -+ case MIPS32_EF_R28 ... MIPS32_EF_R31: -+ regs->regs[i - MIPS32_EF_R0] = (s32)uregs[i]; -+ break; -+ case MIPS32_EF_LO: -+ regs->lo = (s32)uregs[i]; -+ break; -+ case MIPS32_EF_HI: -+ regs->hi = (s32)uregs[i]; -+ break; -+ case MIPS32_EF_CP0_EPC: -+ regs->cp0_epc = (s32)uregs[i]; -+ break; -+ } -+ } - - return 0; - } - -+#endif /* CONFIG_32BIT || CONFIG_MIPS32_O32 */ -+ -+#ifdef CONFIG_64BIT -+ -+static int gpr64_get(struct task_struct *target, -+ const struct user_regset *regset, -+ unsigned int pos, unsigned int count, -+ void *kbuf, void __user *ubuf) -+{ -+ struct pt_regs *regs = task_pt_regs(target); -+ u64 uregs[ELF_NGREG] = {}; -+ unsigned i; -+ -+ for (i = MIPS64_EF_R1; i <= MIPS64_EF_R31; i++) { -+ /* k0/k1 are copied as zero. */ -+ if (i == MIPS64_EF_R26 || i == MIPS64_EF_R27) -+ continue; -+ -+ uregs[i] = regs->regs[i - MIPS64_EF_R0]; -+ } -+ -+ uregs[MIPS64_EF_LO] = regs->lo; -+ uregs[MIPS64_EF_HI] = regs->hi; -+ uregs[MIPS64_EF_CP0_EPC] = regs->cp0_epc; -+ uregs[MIPS64_EF_CP0_BADVADDR] = regs->cp0_badvaddr; -+ uregs[MIPS64_EF_CP0_STATUS] = regs->cp0_status; -+ uregs[MIPS64_EF_CP0_CAUSE] = regs->cp0_cause; -+ -+ return user_regset_copyout(&pos, &count, &kbuf, &ubuf, uregs, 0, -+ sizeof(uregs)); -+} -+ -+static int gpr64_set(struct task_struct *target, -+ const struct user_regset *regset, -+ unsigned int pos, unsigned int count, -+ const void *kbuf, const void __user *ubuf) -+{ -+ struct pt_regs *regs = task_pt_regs(target); -+ u64 uregs[ELF_NGREG]; -+ unsigned start, num_regs, i; -+ int err; -+ -+ start = pos / sizeof(u64); -+ num_regs = count / sizeof(u64); -+ -+ if (start + num_regs > ELF_NGREG) -+ return -EIO; -+ -+ err = user_regset_copyin(&pos, &count, &kbuf, &ubuf, uregs, 0, -+ sizeof(uregs)); -+ if (err) -+ return err; -+ -+ for (i = start; i < num_regs; i++) { -+ switch (i) { -+ case MIPS64_EF_R1 ... MIPS64_EF_R25: -+ /* k0/k1 are ignored. */ -+ case MIPS64_EF_R28 ... MIPS64_EF_R31: -+ regs->regs[i - MIPS64_EF_R0] = uregs[i]; -+ break; -+ case MIPS64_EF_LO: -+ regs->lo = uregs[i]; -+ break; -+ case MIPS64_EF_HI: -+ regs->hi = uregs[i]; -+ break; -+ case MIPS64_EF_CP0_EPC: -+ regs->cp0_epc = uregs[i]; -+ break; -+ } -+ } -+ -+ return 0; -+} -+ -+#endif /* CONFIG_64BIT */ -+ - static int fpr_get(struct task_struct *target, - const struct user_regset *regset, - unsigned int pos, unsigned int count, -@@ -322,14 +447,16 @@ enum mips_regset { - REGSET_FPR, - }; - -+#if defined(CONFIG_32BIT) || defined(CONFIG_MIPS32_O32) -+ - static const struct user_regset mips_regsets[] = { - [REGSET_GPR] = { - .core_note_type = NT_PRSTATUS, - .n = ELF_NGREG, - .size = sizeof(unsigned int), - .align = sizeof(unsigned int), -- .get = gpr_get, -- .set = gpr_set, -+ .get = gpr32_get, -+ .set = gpr32_set, - }, - [REGSET_FPR] = { - .core_note_type = NT_PRFPREG, -@@ -349,14 +476,18 @@ static const struct user_regset_view user_mips_view = { - .n = ARRAY_SIZE(mips_regsets), - }; - -+#endif /* CONFIG_32BIT || CONFIG_MIPS32_O32 */ -+ -+#ifdef CONFIG_64BIT -+ - static const struct user_regset mips64_regsets[] = { - [REGSET_GPR] = { - .core_note_type = NT_PRSTATUS, - .n = ELF_NGREG, - .size = sizeof(unsigned long), - .align = sizeof(unsigned long), -- .get = gpr_get, -- .set = gpr_set, -+ .get = gpr64_get, -+ .set = gpr64_set, - }, - [REGSET_FPR] = { - .core_note_type = NT_PRFPREG, -@@ -369,25 +500,26 @@ static const struct user_regset mips64_regsets[] = { - }; - - static const struct user_regset_view user_mips64_view = { -- .name = "mips", -+ .name = "mips64", - .e_machine = ELF_ARCH, - .ei_osabi = ELF_OSABI, - .regsets = mips64_regsets, -- .n = ARRAY_SIZE(mips_regsets), -+ .n = ARRAY_SIZE(mips64_regsets), - }; - -+#endif /* CONFIG_64BIT */ -+ - const struct user_regset_view *task_user_regset_view(struct task_struct *task) - { - #ifdef CONFIG_32BIT - return &user_mips_view; --#endif -- -+#else - #ifdef CONFIG_MIPS32_O32 -- if (test_thread_flag(TIF_32BIT_REGS)) -- return &user_mips_view; -+ if (test_tsk_thread_flag(task, TIF_32BIT_REGS)) -+ return &user_mips_view; - #endif -- - return &user_mips64_view; -+#endif - } - - long arch_ptrace(struct task_struct *child, long request, -@@ -593,7 +725,7 @@ long arch_ptrace(struct task_struct *child, long request, - break; - #endif - case FPC_CSR: -- child->thread.fpu.fcr31 = data; -+ child->thread.fpu.fcr31 = data & ~FPU_CSR_ALL_X; - break; - case DSP_BASE ... DSP_BASE + 5: { - dspreg_t *dregs; -diff --git a/arch/mips/kernel/unaligned.c b/arch/mips/kernel/unaligned.c -index c369a5d35527..b897dde93e7a 100644 ---- a/arch/mips/kernel/unaligned.c -+++ b/arch/mips/kernel/unaligned.c -@@ -605,7 +605,6 @@ static void emulate_load_store_insn(struct pt_regs *regs, - case sdc1_op: - die_if_kernel("Unaligned FP access in kernel code", regs); - BUG_ON(!used_math()); -- BUG_ON(!is_fpu_owner()); - - lose_fpu(1); /* Save FPU state for the emulator. */ - res = fpu_emulator_cop1Handler(regs, &current->thread.fpu, 1, -diff --git a/arch/mips/mm/tlbex.c b/arch/mips/mm/tlbex.c -index b234b1b5ccad..65d452aa1fda 100644 ---- a/arch/mips/mm/tlbex.c -+++ b/arch/mips/mm/tlbex.c -@@ -1295,6 +1295,7 @@ static void build_r4000_tlb_refill_handler(void) - } - #ifdef CONFIG_MIPS_HUGE_TLB_SUPPORT - uasm_l_tlb_huge_update(&l, p); -+ UASM_i_LW(&p, K0, 0, K1); - build_huge_update_entries(&p, htlb_info.huge_pte, K1); - build_huge_tlb_write_entry(&p, &l, &r, K0, tlb_random, - htlb_info.restore_scratch); -diff --git a/arch/powerpc/include/asm/machdep.h b/arch/powerpc/include/asm/machdep.h -index ad3025d0880b..f20786825b8f 100644 ---- a/arch/powerpc/include/asm/machdep.h -+++ b/arch/powerpc/include/asm/machdep.h -@@ -57,10 +57,10 @@ struct machdep_calls { - void (*hpte_removebolted)(unsigned long ea, - int psize, int ssize); - void (*flush_hash_range)(unsigned long number, int local); -- void (*hugepage_invalidate)(struct mm_struct *mm, -+ void (*hugepage_invalidate)(unsigned long vsid, -+ unsigned long addr, - unsigned char *hpte_slot_array, -- unsigned long addr, int psize); -- -+ int psize, int ssize); - /* special for kexec, to be called in real mode, linear mapping is - * destroyed as well */ - void (*hpte_clear_all)(void); -diff --git a/arch/powerpc/include/asm/pgtable-ppc64.h b/arch/powerpc/include/asm/pgtable-ppc64.h -index eb9261024f51..7b3d54fae46f 100644 ---- a/arch/powerpc/include/asm/pgtable-ppc64.h -+++ b/arch/powerpc/include/asm/pgtable-ppc64.h -@@ -413,7 +413,7 @@ static inline char *get_hpte_slot_array(pmd_t *pmdp) - } - - extern void hpte_do_hugepage_flush(struct mm_struct *mm, unsigned long addr, -- pmd_t *pmdp); -+ pmd_t *pmdp, unsigned long old_pmd); - #ifdef CONFIG_TRANSPARENT_HUGEPAGE - extern pmd_t pfn_pmd(unsigned long pfn, pgprot_t pgprot); - extern pmd_t mk_pmd(struct page *page, pgprot_t pgprot); -diff --git a/arch/powerpc/include/asm/pte-hash64-64k.h b/arch/powerpc/include/asm/pte-hash64-64k.h -index d836d945068d..9ecede1e124c 100644 ---- a/arch/powerpc/include/asm/pte-hash64-64k.h -+++ b/arch/powerpc/include/asm/pte-hash64-64k.h -@@ -46,11 +46,31 @@ - * in order to deal with 64K made of 4K HW pages. Thus we override the - * generic accessors and iterators here - */ --#define __real_pte(e,p) ((real_pte_t) { \ -- (e), (pte_val(e) & _PAGE_COMBO) ? \ -- (pte_val(*((p) + PTRS_PER_PTE))) : 0 }) --#define __rpte_to_hidx(r,index) ((pte_val((r).pte) & _PAGE_COMBO) ? \ -- (((r).hidx >> ((index)<<2)) & 0xf) : ((pte_val((r).pte) >> 12) & 0xf)) -+#define __real_pte __real_pte -+static inline real_pte_t __real_pte(pte_t pte, pte_t *ptep) -+{ -+ real_pte_t rpte; -+ -+ rpte.pte = pte; -+ rpte.hidx = 0; -+ if (pte_val(pte) & _PAGE_COMBO) { -+ /* -+ * Make sure we order the hidx load against the _PAGE_COMBO -+ * check. The store side ordering is done in __hash_page_4K -+ */ -+ smp_rmb(); -+ rpte.hidx = pte_val(*((ptep) + PTRS_PER_PTE)); -+ } -+ return rpte; -+} -+ -+static inline unsigned long __rpte_to_hidx(real_pte_t rpte, unsigned long index) -+{ -+ if ((pte_val(rpte.pte) & _PAGE_COMBO)) -+ return (rpte.hidx >> (index<<2)) & 0xf; -+ return (pte_val(rpte.pte) >> 12) & 0xf; -+} -+ - #define __rpte_to_pte(r) ((r).pte) - #define __rpte_sub_valid(rpte, index) \ - (pte_val(rpte.pte) & (_PAGE_HPTE_SUB0 >> (index))) -diff --git a/arch/powerpc/mm/hash_native_64.c b/arch/powerpc/mm/hash_native_64.c -index 3ea26c25590b..838de8e17dc5 100644 ---- a/arch/powerpc/mm/hash_native_64.c -+++ b/arch/powerpc/mm/hash_native_64.c -@@ -418,18 +418,18 @@ static void native_hpte_invalidate(unsigned long slot, unsigned long vpn, - local_irq_restore(flags); - } - --static void native_hugepage_invalidate(struct mm_struct *mm, -+static void native_hugepage_invalidate(unsigned long vsid, -+ unsigned long addr, - unsigned char *hpte_slot_array, -- unsigned long addr, int psize) -+ int psize, int ssize) - { -- int ssize = 0, i; -- int lock_tlbie; -+ int i; - struct hash_pte *hptep; - int actual_psize = MMU_PAGE_16M; - unsigned int max_hpte_count, valid; - unsigned long flags, s_addr = addr; - unsigned long hpte_v, want_v, shift; -- unsigned long hidx, vpn = 0, vsid, hash, slot; -+ unsigned long hidx, vpn = 0, hash, slot; - - shift = mmu_psize_defs[psize].shift; - max_hpte_count = 1U << (PMD_SHIFT - shift); -@@ -443,15 +443,6 @@ static void native_hugepage_invalidate(struct mm_struct *mm, - - /* get the vpn */ - addr = s_addr + (i * (1ul << shift)); -- if (!is_kernel_addr(addr)) { -- ssize = user_segment_size(addr); -- vsid = get_vsid(mm->context.id, addr, ssize); -- WARN_ON(vsid == 0); -- } else { -- vsid = get_kernel_vsid(addr, mmu_kernel_ssize); -- ssize = mmu_kernel_ssize; -- } -- - vpn = hpt_vpn(addr, vsid, ssize); - hash = hpt_hash(vpn, shift, ssize); - if (hidx & _PTEIDX_SECONDARY) -@@ -471,22 +462,13 @@ static void native_hugepage_invalidate(struct mm_struct *mm, - else - /* Invalidate the hpte. NOTE: this also unlocks it */ - hptep->v = 0; -+ /* -+ * We need to do tlb invalidate for all the address, tlbie -+ * instruction compares entry_VA in tlb with the VA specified -+ * here -+ */ -+ tlbie(vpn, psize, actual_psize, ssize, 0); - } -- /* -- * Since this is a hugepage, we just need a single tlbie. -- * use the last vpn. -- */ -- lock_tlbie = !mmu_has_feature(MMU_FTR_LOCKLESS_TLBIE); -- if (lock_tlbie) -- raw_spin_lock(&native_tlbie_lock); -- -- asm volatile("ptesync":::"memory"); -- __tlbie(vpn, psize, actual_psize, ssize); -- asm volatile("eieio; tlbsync; ptesync":::"memory"); -- -- if (lock_tlbie) -- raw_spin_unlock(&native_tlbie_lock); -- - local_irq_restore(flags); - } - -diff --git a/arch/powerpc/mm/hugepage-hash64.c b/arch/powerpc/mm/hugepage-hash64.c -index 826893fcb3a7..5f5e6328c21c 100644 ---- a/arch/powerpc/mm/hugepage-hash64.c -+++ b/arch/powerpc/mm/hugepage-hash64.c -@@ -18,6 +18,57 @@ - #include <linux/mm.h> - #include <asm/machdep.h> - -+static void invalidate_old_hpte(unsigned long vsid, unsigned long addr, -+ pmd_t *pmdp, unsigned int psize, int ssize) -+{ -+ int i, max_hpte_count, valid; -+ unsigned long s_addr; -+ unsigned char *hpte_slot_array; -+ unsigned long hidx, shift, vpn, hash, slot; -+ -+ s_addr = addr & HPAGE_PMD_MASK; -+ hpte_slot_array = get_hpte_slot_array(pmdp); -+ /* -+ * IF we try to do a HUGE PTE update after a withdraw is done. -+ * we will find the below NULL. This happens when we do -+ * split_huge_page_pmd -+ */ -+ if (!hpte_slot_array) -+ return; -+ -+ if (ppc_md.hugepage_invalidate) -+ return ppc_md.hugepage_invalidate(vsid, s_addr, hpte_slot_array, -+ psize, ssize); -+ /* -+ * No bluk hpte removal support, invalidate each entry -+ */ -+ shift = mmu_psize_defs[psize].shift; -+ max_hpte_count = HPAGE_PMD_SIZE >> shift; -+ for (i = 0; i < max_hpte_count; i++) { -+ /* -+ * 8 bits per each hpte entries -+ * 000| [ secondary group (one bit) | hidx (3 bits) | valid bit] -+ */ -+ valid = hpte_valid(hpte_slot_array, i); -+ if (!valid) -+ continue; -+ hidx = hpte_hash_index(hpte_slot_array, i); -+ -+ /* get the vpn */ -+ addr = s_addr + (i * (1ul << shift)); -+ vpn = hpt_vpn(addr, vsid, ssize); -+ hash = hpt_hash(vpn, shift, ssize); -+ if (hidx & _PTEIDX_SECONDARY) -+ hash = ~hash; -+ -+ slot = (hash & htab_hash_mask) * HPTES_PER_GROUP; -+ slot += hidx & _PTEIDX_GROUP_IX; -+ ppc_md.hpte_invalidate(slot, vpn, psize, -+ MMU_PAGE_16M, ssize, 0); -+ } -+} -+ -+ - int __hash_page_thp(unsigned long ea, unsigned long access, unsigned long vsid, - pmd_t *pmdp, unsigned long trap, int local, int ssize, - unsigned int psize) -@@ -33,7 +84,9 @@ int __hash_page_thp(unsigned long ea, unsigned long access, unsigned long vsid, - * atomically mark the linux large page PMD busy and dirty - */ - do { -- old_pmd = pmd_val(*pmdp); -+ pmd_t pmd = ACCESS_ONCE(*pmdp); -+ -+ old_pmd = pmd_val(pmd); - /* If PMD busy, retry the access */ - if (unlikely(old_pmd & _PAGE_BUSY)) - return 0; -@@ -85,6 +138,15 @@ int __hash_page_thp(unsigned long ea, unsigned long access, unsigned long vsid, - vpn = hpt_vpn(ea, vsid, ssize); - hash = hpt_hash(vpn, shift, ssize); - hpte_slot_array = get_hpte_slot_array(pmdp); -+ if (psize == MMU_PAGE_4K) { -+ /* -+ * invalidate the old hpte entry if we have that mapped via 64K -+ * base page size. This is because demote_segment won't flush -+ * hash page table entries. -+ */ -+ if ((old_pmd & _PAGE_HASHPTE) && !(old_pmd & _PAGE_COMBO)) -+ invalidate_old_hpte(vsid, ea, pmdp, MMU_PAGE_64K, ssize); -+ } - - valid = hpte_valid(hpte_slot_array, index); - if (valid) { -@@ -107,11 +169,8 @@ int __hash_page_thp(unsigned long ea, unsigned long access, unsigned long vsid, - * safely update this here. - */ - valid = 0; -- new_pmd &= ~_PAGE_HPTEFLAGS; - hpte_slot_array[index] = 0; -- } else -- /* clear the busy bits and set the hash pte bits */ -- new_pmd = (new_pmd & ~_PAGE_HPTEFLAGS) | _PAGE_HASHPTE; -+ } - } - - if (!valid) { -@@ -119,11 +178,7 @@ int __hash_page_thp(unsigned long ea, unsigned long access, unsigned long vsid, - - /* insert new entry */ - pa = pmd_pfn(__pmd(old_pmd)) << PAGE_SHIFT; --repeat: -- hpte_group = ((hash & htab_hash_mask) * HPTES_PER_GROUP) & ~0x7UL; -- -- /* clear the busy bits and set the hash pte bits */ -- new_pmd = (new_pmd & ~_PAGE_HPTEFLAGS) | _PAGE_HASHPTE; -+ new_pmd |= _PAGE_HASHPTE; - - /* Add in WIMG bits */ - rflags |= (new_pmd & (_PAGE_WRITETHRU | _PAGE_NO_CACHE | -@@ -132,6 +187,8 @@ repeat: - * enable the memory coherence always - */ - rflags |= HPTE_R_M; -+repeat: -+ hpte_group = ((hash & htab_hash_mask) * HPTES_PER_GROUP) & ~0x7UL; - - /* Insert into the hash table, primary slot */ - slot = ppc_md.hpte_insert(hpte_group, vpn, pa, rflags, 0, -@@ -172,8 +229,17 @@ repeat: - mark_hpte_slot_valid(hpte_slot_array, index, slot); - } - /* -- * No need to use ldarx/stdcx here -+ * Mark the pte with _PAGE_COMBO, if we are trying to hash it with -+ * base page size 4k. -+ */ -+ if (psize == MMU_PAGE_4K) -+ new_pmd |= _PAGE_COMBO; -+ /* -+ * The hpte valid is stored in the pgtable whose address is in the -+ * second half of the PMD. Order this against clearing of the busy bit in -+ * huge pmd. - */ -+ smp_wmb(); - *pmdp = __pmd(new_pmd & ~_PAGE_BUSY); - return 0; - } -diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c -index 30a42e24bf14..a5fff173be4f 100644 ---- a/arch/powerpc/mm/numa.c -+++ b/arch/powerpc/mm/numa.c -@@ -610,8 +610,8 @@ static int cpu_numa_callback(struct notifier_block *nfb, unsigned long action, - case CPU_UP_CANCELED: - case CPU_UP_CANCELED_FROZEN: - unmap_cpu_from_node(lcpu); -- break; - ret = NOTIFY_OK; -+ break; - #endif - } - return ret; -diff --git a/arch/powerpc/mm/pgtable_64.c b/arch/powerpc/mm/pgtable_64.c -index 62bf5e8e78da..c64da56d7582 100644 ---- a/arch/powerpc/mm/pgtable_64.c -+++ b/arch/powerpc/mm/pgtable_64.c -@@ -538,7 +538,7 @@ unsigned long pmd_hugepage_update(struct mm_struct *mm, unsigned long addr, - *pmdp = __pmd((old & ~clr) | set); - #endif - if (old & _PAGE_HASHPTE) -- hpte_do_hugepage_flush(mm, addr, pmdp); -+ hpte_do_hugepage_flush(mm, addr, pmdp, old); - return old; - } - -@@ -645,7 +645,7 @@ void pmdp_splitting_flush(struct vm_area_struct *vma, - if (!(old & _PAGE_SPLITTING)) { - /* We need to flush the hpte */ - if (old & _PAGE_HASHPTE) -- hpte_do_hugepage_flush(vma->vm_mm, address, pmdp); -+ hpte_do_hugepage_flush(vma->vm_mm, address, pmdp, old); - } - } - -@@ -718,7 +718,7 @@ void pmdp_invalidate(struct vm_area_struct *vma, unsigned long address, - * neesd to be flushed. - */ - void hpte_do_hugepage_flush(struct mm_struct *mm, unsigned long addr, -- pmd_t *pmdp) -+ pmd_t *pmdp, unsigned long old_pmd) - { - int ssize, i; - unsigned long s_addr; -@@ -740,12 +740,29 @@ void hpte_do_hugepage_flush(struct mm_struct *mm, unsigned long addr, - if (!hpte_slot_array) - return; - -- /* get the base page size */ -+ /* get the base page size,vsid and segment size */ -+#ifdef CONFIG_DEBUG_VM - psize = get_slice_psize(mm, s_addr); -+ BUG_ON(psize == MMU_PAGE_16M); -+#endif -+ if (old_pmd & _PAGE_COMBO) -+ psize = MMU_PAGE_4K; -+ else -+ psize = MMU_PAGE_64K; -+ -+ if (!is_kernel_addr(s_addr)) { -+ ssize = user_segment_size(s_addr); -+ vsid = get_vsid(mm->context.id, s_addr, ssize); -+ WARN_ON(vsid == 0); -+ } else { -+ vsid = get_kernel_vsid(s_addr, mmu_kernel_ssize); -+ ssize = mmu_kernel_ssize; -+ } - - if (ppc_md.hugepage_invalidate) -- return ppc_md.hugepage_invalidate(mm, hpte_slot_array, -- s_addr, psize); -+ return ppc_md.hugepage_invalidate(vsid, s_addr, -+ hpte_slot_array, -+ psize, ssize); - /* - * No bluk hpte removal support, invalidate each entry - */ -@@ -763,15 +780,6 @@ void hpte_do_hugepage_flush(struct mm_struct *mm, unsigned long addr, - - /* get the vpn */ - addr = s_addr + (i * (1ul << shift)); -- if (!is_kernel_addr(addr)) { -- ssize = user_segment_size(addr); -- vsid = get_vsid(mm->context.id, addr, ssize); -- WARN_ON(vsid == 0); -- } else { -- vsid = get_kernel_vsid(addr, mmu_kernel_ssize); -- ssize = mmu_kernel_ssize; -- } -- - vpn = hpt_vpn(addr, vsid, ssize); - hash = hpt_hash(vpn, shift, ssize); - if (hidx & _PTEIDX_SECONDARY) -diff --git a/arch/powerpc/mm/tlb_hash64.c b/arch/powerpc/mm/tlb_hash64.c -index c99f6510a0b2..9adda5790463 100644 ---- a/arch/powerpc/mm/tlb_hash64.c -+++ b/arch/powerpc/mm/tlb_hash64.c -@@ -216,7 +216,7 @@ void __flush_hash_table_range(struct mm_struct *mm, unsigned long start, - if (!(pte & _PAGE_HASHPTE)) - continue; - if (unlikely(hugepage_shift && pmd_trans_huge(*(pmd_t *)pte))) -- hpte_do_hugepage_flush(mm, start, (pmd_t *)pte); -+ hpte_do_hugepage_flush(mm, start, (pmd_t *)ptep, pte); - else - hpte_need_flush(mm, start, ptep, pte, 0); - } -diff --git a/arch/powerpc/platforms/pseries/hotplug-memory.c b/arch/powerpc/platforms/pseries/hotplug-memory.c -index 9590dbb756f2..b9a82042760f 100644 ---- a/arch/powerpc/platforms/pseries/hotplug-memory.c -+++ b/arch/powerpc/platforms/pseries/hotplug-memory.c -@@ -160,7 +160,7 @@ static int pseries_remove_memory(struct device_node *np) - static inline int pseries_remove_memblock(unsigned long base, - unsigned int memblock_size) - { -- return -EOPNOTSUPP; -+ return 0; - } - static inline int pseries_remove_memory(struct device_node *np) - { -diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c -index 33b552ffbe57..4642d6a4d356 100644 ---- a/arch/powerpc/platforms/pseries/iommu.c -+++ b/arch/powerpc/platforms/pseries/iommu.c -@@ -721,13 +721,13 @@ static int __init disable_ddw_setup(char *str) - - early_param("disable_ddw", disable_ddw_setup); - --static void remove_ddw(struct device_node *np) -+static void remove_ddw(struct device_node *np, bool remove_prop) - { - struct dynamic_dma_window_prop *dwp; - struct property *win64; - const u32 *ddw_avail; - u64 liobn; -- int len, ret; -+ int len, ret = 0; - - ddw_avail = of_get_property(np, "ibm,ddw-applicable", &len); - win64 = of_find_property(np, DIRECT64_PROPNAME, NULL); -@@ -761,7 +761,8 @@ static void remove_ddw(struct device_node *np) - np->full_name, ret, ddw_avail[2], liobn); - - delprop: -- ret = of_remove_property(np, win64); -+ if (remove_prop) -+ ret = of_remove_property(np, win64); - if (ret) - pr_warning("%s: failed to remove direct window property: %d\n", - np->full_name, ret); -@@ -805,7 +806,7 @@ static int find_existing_ddw_windows(void) - window = kzalloc(sizeof(*window), GFP_KERNEL); - if (!window || len < sizeof(struct dynamic_dma_window_prop)) { - kfree(window); -- remove_ddw(pdn); -+ remove_ddw(pdn, true); - continue; - } - -@@ -1045,7 +1046,7 @@ out_free_window: - kfree(window); - - out_clear_window: -- remove_ddw(pdn); -+ remove_ddw(pdn, true); - - out_free_prop: - kfree(win64->name); -@@ -1255,7 +1256,14 @@ static int iommu_reconfig_notifier(struct notifier_block *nb, unsigned long acti - - switch (action) { - case OF_RECONFIG_DETACH_NODE: -- remove_ddw(np); -+ /* -+ * Removing the property will invoke the reconfig -+ * notifier again, which causes dead-lock on the -+ * read-write semaphore of the notifier chain. So -+ * we have to remove the property when releasing -+ * the device node. -+ */ -+ remove_ddw(np, false); - if (pci && pci->iommu_table) - iommu_free_table(pci->iommu_table, np->full_name); - -diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c -index b02af9ef3ff6..ccf6f162f69c 100644 ---- a/arch/powerpc/platforms/pseries/lpar.c -+++ b/arch/powerpc/platforms/pseries/lpar.c -@@ -430,16 +430,17 @@ static void __pSeries_lpar_hugepage_invalidate(unsigned long *slot, - spin_unlock_irqrestore(&pSeries_lpar_tlbie_lock, flags); - } - --static void pSeries_lpar_hugepage_invalidate(struct mm_struct *mm, -- unsigned char *hpte_slot_array, -- unsigned long addr, int psize) -+static void pSeries_lpar_hugepage_invalidate(unsigned long vsid, -+ unsigned long addr, -+ unsigned char *hpte_slot_array, -+ int psize, int ssize) - { -- int ssize = 0, i, index = 0; -+ int i, index = 0; - unsigned long s_addr = addr; - unsigned int max_hpte_count, valid; - unsigned long vpn_array[PPC64_HUGE_HPTE_BATCH]; - unsigned long slot_array[PPC64_HUGE_HPTE_BATCH]; -- unsigned long shift, hidx, vpn = 0, vsid, hash, slot; -+ unsigned long shift, hidx, vpn = 0, hash, slot; - - shift = mmu_psize_defs[psize].shift; - max_hpte_count = 1U << (PMD_SHIFT - shift); -@@ -452,15 +453,6 @@ static void pSeries_lpar_hugepage_invalidate(struct mm_struct *mm, - - /* get the vpn */ - addr = s_addr + (i * (1ul << shift)); -- if (!is_kernel_addr(addr)) { -- ssize = user_segment_size(addr); -- vsid = get_vsid(mm->context.id, addr, ssize); -- WARN_ON(vsid == 0); -- } else { -- vsid = get_kernel_vsid(addr, mmu_kernel_ssize); -- ssize = mmu_kernel_ssize; -- } -- - vpn = hpt_vpn(addr, vsid, ssize); - hash = hpt_hash(vpn, shift, ssize); - if (hidx & _PTEIDX_SECONDARY) -diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig -index bb74b21f007a..a0a3bed6e4dc 100644 ---- a/arch/s390/Kconfig -+++ b/arch/s390/Kconfig -@@ -93,6 +93,7 @@ config S390 - select ARCH_INLINE_WRITE_UNLOCK_IRQ - select ARCH_INLINE_WRITE_UNLOCK_IRQRESTORE - select ARCH_SAVE_PAGE_KEYS if HIBERNATION -+ select ARCH_SUPPORTS_ATOMIC_RMW - select ARCH_USE_CMPXCHG_LOCKREF - select ARCH_WANT_IPC_PARSE_VERSION - select BUILDTIME_EXTABLE_SORT -diff --git a/drivers/acpi/acpica/utcopy.c b/drivers/acpi/acpica/utcopy.c -index edff4e653d9a..c66bca17e736 100644 ---- a/drivers/acpi/acpica/utcopy.c -+++ b/drivers/acpi/acpica/utcopy.c -@@ -1001,5 +1001,11 @@ acpi_ut_copy_iobject_to_iobject(union acpi_operand_object *source_desc, - status = acpi_ut_copy_simple_object(source_desc, *dest_desc); - } - -+ /* Delete the allocated object if copy failed */ -+ -+ if (ACPI_FAILURE(status)) { -+ acpi_ut_remove_reference(*dest_desc); -+ } -+ - return_ACPI_STATUS(status); - } -diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c -index 3dca36d4ad26..17f9ec501972 100644 ---- a/drivers/acpi/processor_idle.c -+++ b/drivers/acpi/processor_idle.c -@@ -1071,9 +1071,9 @@ int acpi_processor_cst_has_changed(struct acpi_processor *pr) - - if (pr->id == 0 && cpuidle_get_driver() == &acpi_idle_driver) { - -- cpuidle_pause_and_lock(); - /* Protect against cpu-hotplug */ - get_online_cpus(); -+ cpuidle_pause_and_lock(); - - /* Disable all cpuidle devices */ - for_each_online_cpu(cpu) { -@@ -1100,8 +1100,8 @@ int acpi_processor_cst_has_changed(struct acpi_processor *pr) - cpuidle_enable_device(dev); - } - } -- put_online_cpus(); - cpuidle_resume_and_unlock(); -+ put_online_cpus(); - } - - return 0; -diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c -index 57b053f424d1..92d5184e3654 100644 ---- a/drivers/acpi/scan.c -+++ b/drivers/acpi/scan.c -@@ -329,7 +329,8 @@ static int acpi_scan_hot_remove(struct acpi_device *device) - unsigned long long sta; - acpi_status status; - -- if (device->handler->hotplug.demand_offline && !acpi_force_hot_remove) { -+ if (device->handler && device->handler->hotplug.demand_offline -+ && !acpi_force_hot_remove) { - if (!acpi_scan_is_offline(device, true)) - return -EBUSY; - } else { -@@ -660,8 +661,14 @@ static ssize_t - acpi_device_sun_show(struct device *dev, struct device_attribute *attr, - char *buf) { - struct acpi_device *acpi_dev = to_acpi_device(dev); -+ acpi_status status; -+ unsigned long long sun; -+ -+ status = acpi_evaluate_integer(acpi_dev->handle, "_SUN", NULL, &sun); -+ if (ACPI_FAILURE(status)) -+ return -ENODEV; - -- return sprintf(buf, "%lu\n", acpi_dev->pnp.sun); -+ return sprintf(buf, "%llu\n", sun); - } - static DEVICE_ATTR(sun, 0444, acpi_device_sun_show, NULL); - -@@ -683,7 +690,6 @@ static int acpi_device_setup_files(struct acpi_device *dev) - { - struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; - acpi_status status; -- unsigned long long sun; - int result = 0; - - /* -@@ -724,14 +730,10 @@ static int acpi_device_setup_files(struct acpi_device *dev) - if (dev->pnp.unique_id) - result = device_create_file(&dev->dev, &dev_attr_uid); - -- status = acpi_evaluate_integer(dev->handle, "_SUN", NULL, &sun); -- if (ACPI_SUCCESS(status)) { -- dev->pnp.sun = (unsigned long)sun; -+ if (acpi_has_method(dev->handle, "_SUN")) { - result = device_create_file(&dev->dev, &dev_attr_sun); - if (result) - goto end; -- } else { -- dev->pnp.sun = (unsigned long)-1; - } - - if (acpi_has_method(dev->handle, "_STA")) { -@@ -915,12 +917,17 @@ static void acpi_device_notify(acpi_handle handle, u32 event, void *data) - device->driver->ops.notify(device, event); - } - --static acpi_status acpi_device_notify_fixed(void *data) -+static void acpi_device_notify_fixed(void *data) - { - struct acpi_device *device = data; - - /* Fixed hardware devices have no handles */ - acpi_device_notify(NULL, ACPI_FIXED_HARDWARE_EVENT, device); -+} -+ -+static acpi_status acpi_device_fixed_event(void *data) -+{ -+ acpi_os_execute(OSL_NOTIFY_HANDLER, acpi_device_notify_fixed, data); - return AE_OK; - } - -@@ -931,12 +938,12 @@ static int acpi_device_install_notify_handler(struct acpi_device *device) - if (device->device_type == ACPI_BUS_TYPE_POWER_BUTTON) - status = - acpi_install_fixed_event_handler(ACPI_EVENT_POWER_BUTTON, -- acpi_device_notify_fixed, -+ acpi_device_fixed_event, - device); - else if (device->device_type == ACPI_BUS_TYPE_SLEEP_BUTTON) - status = - acpi_install_fixed_event_handler(ACPI_EVENT_SLEEP_BUTTON, -- acpi_device_notify_fixed, -+ acpi_device_fixed_event, - device); - else - status = acpi_install_notify_handler(device->handle, -@@ -953,10 +960,10 @@ static void acpi_device_remove_notify_handler(struct acpi_device *device) - { - if (device->device_type == ACPI_BUS_TYPE_POWER_BUTTON) - acpi_remove_fixed_event_handler(ACPI_EVENT_POWER_BUTTON, -- acpi_device_notify_fixed); -+ acpi_device_fixed_event); - else if (device->device_type == ACPI_BUS_TYPE_SLEEP_BUTTON) - acpi_remove_fixed_event_handler(ACPI_EVENT_SLEEP_BUTTON, -- acpi_device_notify_fixed); -+ acpi_device_fixed_event); - else - acpi_remove_notify_handler(device->handle, ACPI_DEVICE_NOTIFY, - acpi_device_notify); -diff --git a/drivers/bluetooth/btmrvl_drv.h b/drivers/bluetooth/btmrvl_drv.h -index 7399303d7d99..9e81a3d01d2b 100644 ---- a/drivers/bluetooth/btmrvl_drv.h -+++ b/drivers/bluetooth/btmrvl_drv.h -@@ -66,6 +66,7 @@ struct btmrvl_adapter { - u8 hs_state; - u8 wakeup_tries; - wait_queue_head_t cmd_wait_q; -+ wait_queue_head_t event_hs_wait_q; - u8 cmd_complete; - bool is_suspended; - }; -diff --git a/drivers/bluetooth/btmrvl_main.c b/drivers/bluetooth/btmrvl_main.c -index 1e0320af00c6..49d20989b45a 100644 ---- a/drivers/bluetooth/btmrvl_main.c -+++ b/drivers/bluetooth/btmrvl_main.c -@@ -112,6 +112,7 @@ int btmrvl_process_event(struct btmrvl_private *priv, struct sk_buff *skb) - adapter->hs_state = HS_ACTIVATED; - if (adapter->psmode) - adapter->ps_state = PS_SLEEP; -+ wake_up_interruptible(&adapter->event_hs_wait_q); - BT_DBG("HS ACTIVATED!"); - } else { - BT_DBG("HS Enable failed"); -@@ -251,11 +252,31 @@ EXPORT_SYMBOL_GPL(btmrvl_enable_ps); - - int btmrvl_enable_hs(struct btmrvl_private *priv) - { -+ struct btmrvl_adapter *adapter = priv->adapter; - int ret; - - ret = btmrvl_send_sync_cmd(priv, BT_CMD_HOST_SLEEP_ENABLE, NULL, 0); -- if (ret) -+ if (ret) { - BT_ERR("Host sleep enable command failed\n"); -+ return ret; -+ } -+ -+ ret = wait_event_interruptible_timeout(adapter->event_hs_wait_q, -+ adapter->hs_state, -+ msecs_to_jiffies(WAIT_UNTIL_HS_STATE_CHANGED)); -+ if (ret < 0) { -+ BT_ERR("event_hs_wait_q terminated (%d): %d,%d,%d", -+ ret, adapter->hs_state, adapter->ps_state, -+ adapter->wakeup_tries); -+ } else if (!ret) { -+ BT_ERR("hs_enable timeout: %d,%d,%d", adapter->hs_state, -+ adapter->ps_state, adapter->wakeup_tries); -+ ret = -ETIMEDOUT; -+ } else { -+ BT_DBG("host sleep enabled: %d,%d,%d", adapter->hs_state, -+ adapter->ps_state, adapter->wakeup_tries); -+ ret = 0; -+ } - - return ret; - } -@@ -341,6 +362,7 @@ static void btmrvl_init_adapter(struct btmrvl_private *priv) - priv->adapter->ps_state = PS_AWAKE; - - init_waitqueue_head(&priv->adapter->cmd_wait_q); -+ init_waitqueue_head(&priv->adapter->event_hs_wait_q); - } - - static void btmrvl_free_adapter(struct btmrvl_private *priv) -@@ -648,6 +670,7 @@ int btmrvl_remove_card(struct btmrvl_private *priv) - hdev = priv->btmrvl_dev.hcidev; - - wake_up_interruptible(&priv->adapter->cmd_wait_q); -+ wake_up_interruptible(&priv->adapter->event_hs_wait_q); - - kthread_stop(priv->main_thread.task); - -diff --git a/drivers/char/tpm/tpm-interface.c b/drivers/char/tpm/tpm-interface.c -index 62e10fd1e1cb..6af17002a115 100644 ---- a/drivers/char/tpm/tpm-interface.c -+++ b/drivers/char/tpm/tpm-interface.c -@@ -491,11 +491,10 @@ static int tpm_startup(struct tpm_chip *chip, __be16 startup_type) - int tpm_get_timeouts(struct tpm_chip *chip) - { - struct tpm_cmd_t tpm_cmd; -- struct timeout_t *timeout_cap; -+ unsigned long new_timeout[4]; -+ unsigned long old_timeout[4]; - struct duration_t *duration_cap; - ssize_t rc; -- u32 timeout; -- unsigned int scale = 1; - - tpm_cmd.header.in = tpm_getcap_header; - tpm_cmd.params.getcap_in.cap = TPM_CAP_PROP; -@@ -529,25 +528,46 @@ int tpm_get_timeouts(struct tpm_chip *chip) - != sizeof(tpm_cmd.header.out) + sizeof(u32) + 4 * sizeof(u32)) - return -EINVAL; - -- timeout_cap = &tpm_cmd.params.getcap_out.cap.timeout; -- /* Don't overwrite default if value is 0 */ -- timeout = be32_to_cpu(timeout_cap->a); -- if (timeout && timeout < 1000) { -- /* timeouts in msec rather usec */ -- scale = 1000; -- chip->vendor.timeout_adjusted = true; -+ old_timeout[0] = be32_to_cpu(tpm_cmd.params.getcap_out.cap.timeout.a); -+ old_timeout[1] = be32_to_cpu(tpm_cmd.params.getcap_out.cap.timeout.b); -+ old_timeout[2] = be32_to_cpu(tpm_cmd.params.getcap_out.cap.timeout.c); -+ old_timeout[3] = be32_to_cpu(tpm_cmd.params.getcap_out.cap.timeout.d); -+ memcpy(new_timeout, old_timeout, sizeof(new_timeout)); -+ -+ /* -+ * Provide ability for vendor overrides of timeout values in case -+ * of misreporting. -+ */ -+ if (chip->ops->update_timeouts != NULL) -+ chip->vendor.timeout_adjusted = -+ chip->ops->update_timeouts(chip, new_timeout); -+ -+ if (!chip->vendor.timeout_adjusted) { -+ /* Don't overwrite default if value is 0 */ -+ if (new_timeout[0] != 0 && new_timeout[0] < 1000) { -+ int i; -+ -+ /* timeouts in msec rather usec */ -+ for (i = 0; i != ARRAY_SIZE(new_timeout); i++) -+ new_timeout[i] *= 1000; -+ chip->vendor.timeout_adjusted = true; -+ } -+ } -+ -+ /* Report adjusted timeouts */ -+ if (chip->vendor.timeout_adjusted) { -+ dev_info(chip->dev, -+ HW_ERR "Adjusting reported timeouts: A %lu->%luus B %lu->%luus C %lu->%luus D %lu->%luus\n", -+ old_timeout[0], new_timeout[0], -+ old_timeout[1], new_timeout[1], -+ old_timeout[2], new_timeout[2], -+ old_timeout[3], new_timeout[3]); - } -- if (timeout) -- chip->vendor.timeout_a = usecs_to_jiffies(timeout * scale); -- timeout = be32_to_cpu(timeout_cap->b); -- if (timeout) -- chip->vendor.timeout_b = usecs_to_jiffies(timeout * scale); -- timeout = be32_to_cpu(timeout_cap->c); -- if (timeout) -- chip->vendor.timeout_c = usecs_to_jiffies(timeout * scale); -- timeout = be32_to_cpu(timeout_cap->d); -- if (timeout) -- chip->vendor.timeout_d = usecs_to_jiffies(timeout * scale); -+ -+ chip->vendor.timeout_a = usecs_to_jiffies(new_timeout[0]); -+ chip->vendor.timeout_b = usecs_to_jiffies(new_timeout[1]); -+ chip->vendor.timeout_c = usecs_to_jiffies(new_timeout[2]); -+ chip->vendor.timeout_d = usecs_to_jiffies(new_timeout[3]); - - duration: - tpm_cmd.header.in = tpm_getcap_header; -@@ -991,13 +1011,13 @@ int tpm_get_random(u32 chip_num, u8 *out, size_t max) - int err, total = 0, retries = 5; - u8 *dest = out; - -+ if (!out || !num_bytes || max > TPM_MAX_RNG_DATA) -+ return -EINVAL; -+ - chip = tpm_chip_find_get(chip_num); - if (chip == NULL) - return -ENODEV; - -- if (!out || !num_bytes || max > TPM_MAX_RNG_DATA) -- return -EINVAL; -- - do { - tpm_cmd.header.in = tpm_getrandom_header; - tpm_cmd.params.getrandom_in.num_bytes = cpu_to_be32(num_bytes); -@@ -1016,6 +1036,7 @@ int tpm_get_random(u32 chip_num, u8 *out, size_t max) - num_bytes -= recd; - } while (retries-- && total < max); - -+ tpm_chip_put(chip); - return total ? total : -EIO; - } - EXPORT_SYMBOL_GPL(tpm_get_random); -@@ -1095,7 +1116,7 @@ struct tpm_chip *tpm_register_hardware(struct device *dev, - goto del_misc; - - if (tpm_add_ppi(&dev->kobj)) -- goto del_misc; -+ goto del_sysfs; - - chip->bios_dir = tpm_bios_log_setup(chip->devname); - -@@ -1106,6 +1127,8 @@ struct tpm_chip *tpm_register_hardware(struct device *dev, - - return chip; - -+del_sysfs: -+ tpm_sysfs_del_device(chip); - del_misc: - tpm_dev_del_device(chip); - put_device: -diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c -index a9ed2270c25d..2c46734b266d 100644 ---- a/drivers/char/tpm/tpm_tis.c -+++ b/drivers/char/tpm/tpm_tis.c -@@ -373,6 +373,36 @@ out_err: - return rc; - } - -+struct tis_vendor_timeout_override { -+ u32 did_vid; -+ unsigned long timeout_us[4]; -+}; -+ -+static const struct tis_vendor_timeout_override vendor_timeout_overrides[] = { -+ /* Atmel 3204 */ -+ { 0x32041114, { (TIS_SHORT_TIMEOUT*1000), (TIS_LONG_TIMEOUT*1000), -+ (TIS_SHORT_TIMEOUT*1000), (TIS_SHORT_TIMEOUT*1000) } }, -+}; -+ -+static bool tpm_tis_update_timeouts(struct tpm_chip *chip, -+ unsigned long *timeout_cap) -+{ -+ int i; -+ u32 did_vid; -+ -+ did_vid = ioread32(chip->vendor.iobase + TPM_DID_VID(0)); -+ -+ for (i = 0; i != ARRAY_SIZE(vendor_timeout_overrides); i++) { -+ if (vendor_timeout_overrides[i].did_vid != did_vid) -+ continue; -+ memcpy(timeout_cap, vendor_timeout_overrides[i].timeout_us, -+ sizeof(vendor_timeout_overrides[i].timeout_us)); -+ return true; -+ } -+ -+ return false; -+} -+ - /* - * Early probing for iTPM with STS_DATA_EXPECT flaw. - * Try sending command without itpm flag set and if that -@@ -437,6 +467,7 @@ static const struct tpm_class_ops tpm_tis = { - .recv = tpm_tis_recv, - .send = tpm_tis_send, - .cancel = tpm_tis_ready, -+ .update_timeouts = tpm_tis_update_timeouts, - .req_complete_mask = TPM_STS_DATA_AVAIL | TPM_STS_VALID, - .req_complete_val = TPM_STS_DATA_AVAIL | TPM_STS_VALID, - .req_canceled = tpm_tis_req_canceled, -diff --git a/drivers/firmware/efi/vars.c b/drivers/firmware/efi/vars.c -index b22659cccca4..e6125522860a 100644 ---- a/drivers/firmware/efi/vars.c -+++ b/drivers/firmware/efi/vars.c -@@ -481,7 +481,7 @@ EXPORT_SYMBOL_GPL(efivar_entry_remove); - */ - static void efivar_entry_list_del_unlock(struct efivar_entry *entry) - { -- WARN_ON(!spin_is_locked(&__efivars->lock)); -+ lockdep_assert_held(&__efivars->lock); - - list_del(&entry->list); - spin_unlock_irq(&__efivars->lock); -@@ -507,7 +507,7 @@ int __efivar_entry_delete(struct efivar_entry *entry) - const struct efivar_operations *ops = __efivars->ops; - efi_status_t status; - -- WARN_ON(!spin_is_locked(&__efivars->lock)); -+ lockdep_assert_held(&__efivars->lock); - - status = ops->set_variable(entry->var.VariableName, - &entry->var.VendorGuid, -@@ -667,7 +667,7 @@ struct efivar_entry *efivar_entry_find(efi_char16_t *name, efi_guid_t guid, - int strsize1, strsize2; - bool found = false; - -- WARN_ON(!spin_is_locked(&__efivars->lock)); -+ lockdep_assert_held(&__efivars->lock); - - list_for_each_entry_safe(entry, n, head, list) { - strsize1 = ucs2_strsize(name, 1024); -@@ -739,7 +739,7 @@ int __efivar_entry_get(struct efivar_entry *entry, u32 *attributes, - const struct efivar_operations *ops = __efivars->ops; - efi_status_t status; - -- WARN_ON(!spin_is_locked(&__efivars->lock)); -+ lockdep_assert_held(&__efivars->lock); - - status = ops->get_variable(entry->var.VariableName, - &entry->var.VendorGuid, -diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.h b/drivers/gpu/drm/nouveau/nouveau_drm.h -index 23ca7a517246..74ed08a750f4 100644 ---- a/drivers/gpu/drm/nouveau/nouveau_drm.h -+++ b/drivers/gpu/drm/nouveau/nouveau_drm.h -@@ -10,7 +10,7 @@ - - #define DRIVER_MAJOR 1 - #define DRIVER_MINOR 1 --#define DRIVER_PATCHLEVEL 1 -+#define DRIVER_PATCHLEVEL 2 - - /* - * 1.1.1: -@@ -21,6 +21,8 @@ - * to control registers on the MPs to enable performance counters, - * and to control the warp error enable mask (OpenGL requires out of - * bounds access to local memory to be silently ignored / return 0). -+ * 1.1.2: -+ * - fixes multiple bugs in flip completion events and timestamping - */ - - #include <core/client.h> -diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c -index bc9e56eb4e9c..7b3537c55c77 100644 ---- a/drivers/gpu/drm/radeon/cik.c -+++ b/drivers/gpu/drm/radeon/cik.c -@@ -7779,6 +7779,7 @@ restart_ih: - static int cik_startup(struct radeon_device *rdev) - { - struct radeon_ring *ring; -+ u32 nop; - int r; - - /* enable pcie gen2/3 link */ -@@ -7896,9 +7897,15 @@ static int cik_startup(struct radeon_device *rdev) - } - cik_irq_set(rdev); - -+ if (rdev->family == CHIP_HAWAII) { -+ nop = RADEON_CP_PACKET2; -+ } else { -+ nop = PACKET3(PACKET3_NOP, 0x3FFF); -+ } -+ - ring = &rdev->ring[RADEON_RING_TYPE_GFX_INDEX]; - r = radeon_ring_init(rdev, ring, ring->ring_size, RADEON_WB_CP_RPTR_OFFSET, -- PACKET3(PACKET3_NOP, 0x3FFF)); -+ nop); - if (r) - return r; - -@@ -7906,7 +7913,7 @@ static int cik_startup(struct radeon_device *rdev) - /* type-2 packets are deprecated on MEC, use type-3 instead */ - ring = &rdev->ring[CAYMAN_RING_TYPE_CP1_INDEX]; - r = radeon_ring_init(rdev, ring, ring->ring_size, RADEON_WB_CP1_RPTR_OFFSET, -- PACKET3(PACKET3_NOP, 0x3FFF)); -+ nop); - if (r) - return r; - ring->me = 1; /* first MEC */ -@@ -7917,7 +7924,7 @@ static int cik_startup(struct radeon_device *rdev) - /* type-2 packets are deprecated on MEC, use type-3 instead */ - ring = &rdev->ring[CAYMAN_RING_TYPE_CP2_INDEX]; - r = radeon_ring_init(rdev, ring, ring->ring_size, RADEON_WB_CP2_RPTR_OFFSET, -- PACKET3(PACKET3_NOP, 0x3FFF)); -+ nop); - if (r) - return r; - /* dGPU only have 1 MEC */ -diff --git a/drivers/infiniband/core/iwcm.c b/drivers/infiniband/core/iwcm.c -index 3d2e489ab732..ff9163dc1596 100644 ---- a/drivers/infiniband/core/iwcm.c -+++ b/drivers/infiniband/core/iwcm.c -@@ -46,6 +46,7 @@ - #include <linux/completion.h> - #include <linux/slab.h> - #include <linux/module.h> -+#include <linux/sysctl.h> - - #include <rdma/iw_cm.h> - #include <rdma/ib_addr.h> -@@ -65,6 +66,20 @@ struct iwcm_work { - struct list_head free_list; - }; - -+static unsigned int default_backlog = 256; -+ -+static struct ctl_table_header *iwcm_ctl_table_hdr; -+static struct ctl_table iwcm_ctl_table[] = { -+ { -+ .procname = "default_backlog", -+ .data = &default_backlog, -+ .maxlen = sizeof(default_backlog), -+ .mode = 0644, -+ .proc_handler = proc_dointvec, -+ }, -+ { } -+}; -+ - /* - * The following services provide a mechanism for pre-allocating iwcm_work - * elements. The design pre-allocates them based on the cm_id type: -@@ -425,6 +440,9 @@ int iw_cm_listen(struct iw_cm_id *cm_id, int backlog) - - cm_id_priv = container_of(cm_id, struct iwcm_id_private, id); - -+ if (!backlog) -+ backlog = default_backlog; -+ - ret = alloc_work_entries(cm_id_priv, backlog); - if (ret) - return ret; -@@ -1030,11 +1048,20 @@ static int __init iw_cm_init(void) - if (!iwcm_wq) - return -ENOMEM; - -+ iwcm_ctl_table_hdr = register_net_sysctl(&init_net, "net/iw_cm", -+ iwcm_ctl_table); -+ if (!iwcm_ctl_table_hdr) { -+ pr_err("iw_cm: couldn't register sysctl paths\n"); -+ destroy_workqueue(iwcm_wq); -+ return -ENOMEM; -+ } -+ - return 0; - } - - static void __exit iw_cm_cleanup(void) - { -+ unregister_net_sysctl_table(iwcm_ctl_table_hdr); - destroy_workqueue(iwcm_wq); - } - -diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c -index e96c07ee6756..ca0bc6c67abe 100644 ---- a/drivers/infiniband/ulp/srp/ib_srp.c -+++ b/drivers/infiniband/ulp/srp/ib_srp.c -@@ -120,6 +120,7 @@ static void srp_send_completion(struct ib_cq *cq, void *target_ptr); - static int srp_cm_handler(struct ib_cm_id *cm_id, struct ib_cm_event *event); - - static struct scsi_transport_template *ib_srp_transport_template; -+static struct workqueue_struct *srp_remove_wq; - - static struct ib_client srp_client = { - .name = "srp", -@@ -539,7 +540,7 @@ static bool srp_queue_remove_work(struct srp_target_port *target) - spin_unlock_irq(&target->lock); - - if (changed) -- queue_work(system_long_wq, &target->remove_work); -+ queue_work(srp_remove_wq, &target->remove_work); - - return changed; - } -@@ -2886,9 +2887,10 @@ static void srp_remove_one(struct ib_device *device) - spin_unlock(&host->target_lock); - - /* -- * Wait for target port removal tasks. -+ * Wait for tl_err and target port removal tasks. - */ - flush_workqueue(system_long_wq); -+ flush_workqueue(srp_remove_wq); - - kfree(host); - } -@@ -2940,16 +2942,22 @@ static int __init srp_init_module(void) - indirect_sg_entries = cmd_sg_entries; - } - -+ srp_remove_wq = create_workqueue("srp_remove"); -+ if (IS_ERR(srp_remove_wq)) { -+ ret = PTR_ERR(srp_remove_wq); -+ goto out; -+ } -+ -+ ret = -ENOMEM; - ib_srp_transport_template = - srp_attach_transport(&ib_srp_transport_functions); - if (!ib_srp_transport_template) -- return -ENOMEM; -+ goto destroy_wq; - - ret = class_register(&srp_class); - if (ret) { - pr_err("couldn't register class infiniband_srp\n"); -- srp_release_transport(ib_srp_transport_template); -- return ret; -+ goto release_tr; - } - - ib_sa_register_client(&srp_sa_client); -@@ -2957,13 +2965,22 @@ static int __init srp_init_module(void) - ret = ib_register_client(&srp_client); - if (ret) { - pr_err("couldn't register IB client\n"); -- srp_release_transport(ib_srp_transport_template); -- ib_sa_unregister_client(&srp_sa_client); -- class_unregister(&srp_class); -- return ret; -+ goto unreg_sa; - } - -- return 0; -+out: -+ return ret; -+ -+unreg_sa: -+ ib_sa_unregister_client(&srp_sa_client); -+ class_unregister(&srp_class); -+ -+release_tr: -+ srp_release_transport(ib_srp_transport_template); -+ -+destroy_wq: -+ destroy_workqueue(srp_remove_wq); -+ goto out; - } - - static void __exit srp_cleanup_module(void) -@@ -2972,6 +2989,7 @@ static void __exit srp_cleanup_module(void) - ib_sa_unregister_client(&srp_sa_client); - class_unregister(&srp_class); - srp_release_transport(ib_srp_transport_template); -+ destroy_workqueue(srp_remove_wq); - } - - module_init(srp_init_module); -diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c -index 71776ff5aedc..9cbef59d404a 100644 ---- a/drivers/iommu/amd_iommu.c -+++ b/drivers/iommu/amd_iommu.c -@@ -3227,14 +3227,16 @@ free_domains: - - static void cleanup_domain(struct protection_domain *domain) - { -- struct iommu_dev_data *dev_data, *next; -+ struct iommu_dev_data *entry; - unsigned long flags; - - write_lock_irqsave(&amd_iommu_devtable_lock, flags); - -- list_for_each_entry_safe(dev_data, next, &domain->dev_list, list) { -- __detach_device(dev_data); -- atomic_set(&dev_data->bind, 0); -+ while (!list_empty(&domain->dev_list)) { -+ entry = list_first_entry(&domain->dev_list, -+ struct iommu_dev_data, list); -+ __detach_device(entry); -+ atomic_set(&entry->bind, 0); - } - - write_unlock_irqrestore(&amd_iommu_devtable_lock, flags); -diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c -index 56e24c072b62..d7690f86fdb9 100644 ---- a/drivers/md/raid1.c -+++ b/drivers/md/raid1.c -@@ -1501,12 +1501,12 @@ static void error(struct mddev *mddev, struct md_rdev *rdev) - mddev->degraded++; - set_bit(Faulty, &rdev->flags); - spin_unlock_irqrestore(&conf->device_lock, flags); -- /* -- * if recovery is running, make sure it aborts. -- */ -- set_bit(MD_RECOVERY_INTR, &mddev->recovery); - } else - set_bit(Faulty, &rdev->flags); -+ /* -+ * if recovery is running, make sure it aborts. -+ */ -+ set_bit(MD_RECOVERY_INTR, &mddev->recovery); - set_bit(MD_CHANGE_DEVS, &mddev->flags); - printk(KERN_ALERT - "md/raid1:%s: Disk failure on %s, disabling device.\n" -diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c -index cb882aae9e20..a46124ecafc7 100644 ---- a/drivers/md/raid10.c -+++ b/drivers/md/raid10.c -@@ -1684,13 +1684,12 @@ static void error(struct mddev *mddev, struct md_rdev *rdev) - spin_unlock_irqrestore(&conf->device_lock, flags); - return; - } -- if (test_and_clear_bit(In_sync, &rdev->flags)) { -+ if (test_and_clear_bit(In_sync, &rdev->flags)) - mddev->degraded++; -- /* -- * if recovery is running, make sure it aborts. -- */ -- set_bit(MD_RECOVERY_INTR, &mddev->recovery); -- } -+ /* -+ * If recovery is running, make sure it aborts. -+ */ -+ set_bit(MD_RECOVERY_INTR, &mddev->recovery); - set_bit(Blocked, &rdev->flags); - set_bit(Faulty, &rdev->flags); - set_bit(MD_CHANGE_DEVS, &mddev->flags); -@@ -2954,6 +2953,7 @@ static sector_t sync_request(struct mddev *mddev, sector_t sector_nr, - */ - if (test_bit(MD_RECOVERY_RESHAPE, &mddev->recovery)) { - end_reshape(conf); -+ close_sync(conf); - return 0; - } - -@@ -4411,7 +4411,7 @@ read_more: - read_bio->bi_private = r10_bio; - read_bio->bi_end_io = end_sync_read; - read_bio->bi_rw = READ; -- read_bio->bi_flags &= ~(BIO_POOL_MASK - 1); -+ read_bio->bi_flags &= (~0UL << BIO_RESET_BITS); - read_bio->bi_flags |= 1 << BIO_UPTODATE; - read_bio->bi_vcnt = 0; - read_bio->bi_iter.bi_size = 0; -diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c -index 16f5c21963db..18cda77b4f79 100644 ---- a/drivers/md/raid5.c -+++ b/drivers/md/raid5.c -@@ -3779,6 +3779,8 @@ static void handle_stripe(struct stripe_head *sh) - set_bit(R5_Wantwrite, &dev->flags); - if (prexor) - continue; -+ if (s.failed > 1) -+ continue; - if (!test_bit(R5_Insync, &dev->flags) || - ((i == sh->pd_idx || i == sh->qd_idx) && - s.failed == 0)) -diff --git a/drivers/media/common/siano/Kconfig b/drivers/media/common/siano/Kconfig -index f953d33ee151..4bfbd5f463d1 100644 ---- a/drivers/media/common/siano/Kconfig -+++ b/drivers/media/common/siano/Kconfig -@@ -22,8 +22,7 @@ config SMS_SIANO_DEBUGFS - bool "Enable debugfs for smsdvb" - depends on SMS_SIANO_MDTV - depends on DEBUG_FS -- depends on SMS_USB_DRV -- depends on CONFIG_SMS_USB_DRV = CONFIG_SMS_SDIO_DRV -+ depends on SMS_USB_DRV = SMS_SDIO_DRV - - ---help--- - Choose Y to enable visualizing a dump of the frontend -diff --git a/drivers/media/i2c/mt9v032.c b/drivers/media/i2c/mt9v032.c -index 36c504b78f2c..008ac87a9031 100644 ---- a/drivers/media/i2c/mt9v032.c -+++ b/drivers/media/i2c/mt9v032.c -@@ -305,8 +305,8 @@ mt9v032_update_hblank(struct mt9v032 *mt9v032) - - if (mt9v032->version->version == MT9V034_CHIP_ID_REV1) - min_hblank += (mt9v032->hratio - 1) * 10; -- min_hblank = max_t(unsigned int, (int)mt9v032->model->data->min_row_time - crop->width, -- (int)min_hblank); -+ min_hblank = max_t(int, mt9v032->model->data->min_row_time - crop->width, -+ min_hblank); - hblank = max_t(unsigned int, mt9v032->hblank, min_hblank); - - return mt9v032_write(client, MT9V032_HORIZONTAL_BLANKING, hblank); -diff --git a/drivers/media/media-device.c b/drivers/media/media-device.c -index 703560fa5e73..88c1606fd555 100644 ---- a/drivers/media/media-device.c -+++ b/drivers/media/media-device.c -@@ -106,8 +106,6 @@ static long media_device_enum_entities(struct media_device *mdev, - if (ent->name) { - strncpy(u_ent.name, ent->name, sizeof(u_ent.name)); - u_ent.name[sizeof(u_ent.name) - 1] = '\0'; -- } else { -- memset(u_ent.name, 0, sizeof(u_ent.name)); - } - u_ent.type = ent->type; - u_ent.revision = ent->revision; -diff --git a/drivers/media/platform/vsp1/vsp1_video.c b/drivers/media/platform/vsp1/vsp1_video.c -index b4687a834f85..7245cca89257 100644 ---- a/drivers/media/platform/vsp1/vsp1_video.c -+++ b/drivers/media/platform/vsp1/vsp1_video.c -@@ -635,8 +635,6 @@ static int vsp1_video_buffer_prepare(struct vb2_buffer *vb) - if (vb->num_planes < format->num_planes) - return -EINVAL; - -- buf->video = video; -- - for (i = 0; i < vb->num_planes; ++i) { - buf->addr[i] = vb2_dma_contig_plane_dma_addr(vb, i); - buf->length[i] = vb2_plane_size(vb, i); -diff --git a/drivers/media/platform/vsp1/vsp1_video.h b/drivers/media/platform/vsp1/vsp1_video.h -index d8612a378345..47b7a8ab5e2f 100644 ---- a/drivers/media/platform/vsp1/vsp1_video.h -+++ b/drivers/media/platform/vsp1/vsp1_video.h -@@ -89,7 +89,6 @@ static inline struct vsp1_pipeline *to_vsp1_pipeline(struct media_entity *e) - } - - struct vsp1_video_buffer { -- struct vsp1_video *video; - struct vb2_buffer buf; - struct list_head queue; - -diff --git a/drivers/media/tuners/xc4000.c b/drivers/media/tuners/xc4000.c -index 2018befabb5a..e71decbfd0af 100644 ---- a/drivers/media/tuners/xc4000.c -+++ b/drivers/media/tuners/xc4000.c -@@ -93,7 +93,7 @@ struct xc4000_priv { - struct firmware_description *firm; - int firm_size; - u32 if_khz; -- u32 freq_hz; -+ u32 freq_hz, freq_offset; - u32 bandwidth; - u8 video_standard; - u8 rf_mode; -@@ -1157,14 +1157,14 @@ static int xc4000_set_params(struct dvb_frontend *fe) - case SYS_ATSC: - dprintk(1, "%s() VSB modulation\n", __func__); - priv->rf_mode = XC_RF_MODE_AIR; -- priv->freq_hz = c->frequency - 1750000; -+ priv->freq_offset = 1750000; - priv->video_standard = XC4000_DTV6; - type = DTV6; - break; - case SYS_DVBC_ANNEX_B: - dprintk(1, "%s() QAM modulation\n", __func__); - priv->rf_mode = XC_RF_MODE_CABLE; -- priv->freq_hz = c->frequency - 1750000; -+ priv->freq_offset = 1750000; - priv->video_standard = XC4000_DTV6; - type = DTV6; - break; -@@ -1173,23 +1173,23 @@ static int xc4000_set_params(struct dvb_frontend *fe) - dprintk(1, "%s() OFDM\n", __func__); - if (bw == 0) { - if (c->frequency < 400000000) { -- priv->freq_hz = c->frequency - 2250000; -+ priv->freq_offset = 2250000; - } else { -- priv->freq_hz = c->frequency - 2750000; -+ priv->freq_offset = 2750000; - } - priv->video_standard = XC4000_DTV7_8; - type = DTV78; - } else if (bw <= 6000000) { - priv->video_standard = XC4000_DTV6; -- priv->freq_hz = c->frequency - 1750000; -+ priv->freq_offset = 1750000; - type = DTV6; - } else if (bw <= 7000000) { - priv->video_standard = XC4000_DTV7; -- priv->freq_hz = c->frequency - 2250000; -+ priv->freq_offset = 2250000; - type = DTV7; - } else { - priv->video_standard = XC4000_DTV8; -- priv->freq_hz = c->frequency - 2750000; -+ priv->freq_offset = 2750000; - type = DTV8; - } - priv->rf_mode = XC_RF_MODE_AIR; -@@ -1200,6 +1200,8 @@ static int xc4000_set_params(struct dvb_frontend *fe) - goto fail; - } - -+ priv->freq_hz = c->frequency - priv->freq_offset; -+ - dprintk(1, "%s() frequency=%d (compensated)\n", - __func__, priv->freq_hz); - -@@ -1520,7 +1522,7 @@ static int xc4000_get_frequency(struct dvb_frontend *fe, u32 *freq) - { - struct xc4000_priv *priv = fe->tuner_priv; - -- *freq = priv->freq_hz; -+ *freq = priv->freq_hz + priv->freq_offset; - - if (debug) { - mutex_lock(&priv->lock); -diff --git a/drivers/media/tuners/xc5000.c b/drivers/media/tuners/xc5000.c -index 5cd09a681b6a..b2d9e9cb97f7 100644 ---- a/drivers/media/tuners/xc5000.c -+++ b/drivers/media/tuners/xc5000.c -@@ -55,7 +55,7 @@ struct xc5000_priv { - - u32 if_khz; - u16 xtal_khz; -- u32 freq_hz; -+ u32 freq_hz, freq_offset; - u32 bandwidth; - u8 video_standard; - u8 rf_mode; -@@ -755,13 +755,13 @@ static int xc5000_set_params(struct dvb_frontend *fe) - case SYS_ATSC: - dprintk(1, "%s() VSB modulation\n", __func__); - priv->rf_mode = XC_RF_MODE_AIR; -- priv->freq_hz = freq - 1750000; -+ priv->freq_offset = 1750000; - priv->video_standard = DTV6; - break; - case SYS_DVBC_ANNEX_B: - dprintk(1, "%s() QAM modulation\n", __func__); - priv->rf_mode = XC_RF_MODE_CABLE; -- priv->freq_hz = freq - 1750000; -+ priv->freq_offset = 1750000; - priv->video_standard = DTV6; - break; - case SYS_ISDBT: -@@ -776,15 +776,15 @@ static int xc5000_set_params(struct dvb_frontend *fe) - switch (bw) { - case 6000000: - priv->video_standard = DTV6; -- priv->freq_hz = freq - 1750000; -+ priv->freq_offset = 1750000; - break; - case 7000000: - priv->video_standard = DTV7; -- priv->freq_hz = freq - 2250000; -+ priv->freq_offset = 2250000; - break; - case 8000000: - priv->video_standard = DTV8; -- priv->freq_hz = freq - 2750000; -+ priv->freq_offset = 2750000; - break; - default: - printk(KERN_ERR "xc5000 bandwidth not set!\n"); -@@ -798,15 +798,15 @@ static int xc5000_set_params(struct dvb_frontend *fe) - priv->rf_mode = XC_RF_MODE_CABLE; - if (bw <= 6000000) { - priv->video_standard = DTV6; -- priv->freq_hz = freq - 1750000; -+ priv->freq_offset = 1750000; - b = 6; - } else if (bw <= 7000000) { - priv->video_standard = DTV7; -- priv->freq_hz = freq - 2250000; -+ priv->freq_offset = 2250000; - b = 7; - } else { - priv->video_standard = DTV7_8; -- priv->freq_hz = freq - 2750000; -+ priv->freq_offset = 2750000; - b = 8; - } - dprintk(1, "%s() Bandwidth %dMHz (%d)\n", __func__, -@@ -817,6 +817,8 @@ static int xc5000_set_params(struct dvb_frontend *fe) - return -EINVAL; - } - -+ priv->freq_hz = freq - priv->freq_offset; -+ - dprintk(1, "%s() frequency=%d (compensated to %d)\n", - __func__, freq, priv->freq_hz); - -@@ -1067,7 +1069,7 @@ static int xc5000_get_frequency(struct dvb_frontend *fe, u32 *freq) - { - struct xc5000_priv *priv = fe->tuner_priv; - dprintk(1, "%s()\n", __func__); -- *freq = priv->freq_hz; -+ *freq = priv->freq_hz + priv->freq_offset; - return 0; - } - -diff --git a/drivers/media/usb/au0828/au0828-video.c b/drivers/media/usb/au0828/au0828-video.c -index f6154546b5c0..7ed75efa1c36 100644 ---- a/drivers/media/usb/au0828/au0828-video.c -+++ b/drivers/media/usb/au0828/au0828-video.c -@@ -787,11 +787,27 @@ static int au0828_i2s_init(struct au0828_dev *dev) - - /* - * Auvitek au0828 analog stream enable -- * Please set interface0 to AS5 before enable the stream - */ - static int au0828_analog_stream_enable(struct au0828_dev *d) - { -+ struct usb_interface *iface; -+ int ret; -+ - dprintk(1, "au0828_analog_stream_enable called\n"); -+ -+ iface = usb_ifnum_to_if(d->usbdev, 0); -+ if (iface && iface->cur_altsetting->desc.bAlternateSetting != 5) { -+ dprintk(1, "Changing intf#0 to alt 5\n"); -+ /* set au0828 interface0 to AS5 here again */ -+ ret = usb_set_interface(d->usbdev, 0, 5); -+ if (ret < 0) { -+ printk(KERN_INFO "Au0828 can't set alt setting to 5!\n"); -+ return -EBUSY; -+ } -+ } -+ -+ /* FIXME: size should be calculated using d->width, d->height */ -+ - au0828_writereg(d, AU0828_SENSORCTRL_VBI_103, 0x00); - au0828_writereg(d, 0x106, 0x00); - /* set x position */ -@@ -1002,15 +1018,6 @@ static int au0828_v4l2_open(struct file *filp) - return -ERESTARTSYS; - } - if (dev->users == 0) { -- /* set au0828 interface0 to AS5 here again */ -- ret = usb_set_interface(dev->usbdev, 0, 5); -- if (ret < 0) { -- mutex_unlock(&dev->lock); -- printk(KERN_INFO "Au0828 can't set alternate to 5!\n"); -- kfree(fh); -- return -EBUSY; -- } -- - au0828_analog_stream_enable(dev); - au0828_analog_stream_reset(dev); - -@@ -1252,13 +1259,6 @@ static int au0828_set_format(struct au0828_dev *dev, unsigned int cmd, - } - } - -- /* set au0828 interface0 to AS5 here again */ -- ret = usb_set_interface(dev->usbdev, 0, 5); -- if (ret < 0) { -- printk(KERN_INFO "Au0828 can't set alt setting to 5!\n"); -- return -EBUSY; -- } -- - au0828_analog_stream_enable(dev); - - return 0; -diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c -index 90b630ccc8bc..0aefe501fd3c 100644 ---- a/drivers/mfd/omap-usb-host.c -+++ b/drivers/mfd/omap-usb-host.c -@@ -445,7 +445,7 @@ static unsigned omap_usbhs_rev1_hostconfig(struct usbhs_hcd_omap *omap, - - for (i = 0; i < omap->nports; i++) { - if (is_ehci_phy_mode(pdata->port_mode[i])) { -- reg &= OMAP_UHH_HOSTCONFIG_ULPI_BYPASS; -+ reg &= ~OMAP_UHH_HOSTCONFIG_ULPI_BYPASS; - break; - } - } -diff --git a/drivers/mtd/ftl.c b/drivers/mtd/ftl.c -index 19d637266fcd..71e4f6ccae2f 100644 ---- a/drivers/mtd/ftl.c -+++ b/drivers/mtd/ftl.c -@@ -1075,7 +1075,6 @@ static void ftl_add_mtd(struct mtd_blktrans_ops *tr, struct mtd_info *mtd) - return; - } - -- ftl_freepart(partition); - kfree(partition); - } - -diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c -index 6f55d92dc233..64d8e32b6ca0 100644 ---- a/drivers/mtd/nand/omap2.c -+++ b/drivers/mtd/nand/omap2.c -@@ -933,7 +933,7 @@ static int omap_calculate_ecc(struct mtd_info *mtd, const u_char *dat, - u32 val; - - val = readl(info->reg.gpmc_ecc_config); -- if (((val >> ECC_CONFIG_CS_SHIFT) & ~CS_MASK) != info->gpmc_cs) -+ if (((val >> ECC_CONFIG_CS_SHIFT) & CS_MASK) != info->gpmc_cs) - return -EINVAL; - - /* read ecc result */ -diff --git a/drivers/power/bq2415x_charger.c b/drivers/power/bq2415x_charger.c -index 79a37f6d3307..e384844a1ae1 100644 ---- a/drivers/power/bq2415x_charger.c -+++ b/drivers/power/bq2415x_charger.c -@@ -840,8 +840,7 @@ static int bq2415x_notifier_call(struct notifier_block *nb, - if (bq->automode < 1) - return NOTIFY_OK; - -- sysfs_notify(&bq->charger.dev->kobj, NULL, "reported_mode"); -- bq2415x_set_mode(bq, bq->reported_mode); -+ schedule_delayed_work(&bq->work, 0); - - return NOTIFY_OK; - } -@@ -892,6 +891,11 @@ static void bq2415x_timer_work(struct work_struct *work) - int error; - int boost; - -+ if (bq->automode > 0 && (bq->reported_mode != bq->mode)) { -+ sysfs_notify(&bq->charger.dev->kobj, NULL, "reported_mode"); -+ bq2415x_set_mode(bq, bq->reported_mode); -+ } -+ - if (!bq->autotimer) - return; - -diff --git a/drivers/regulator/arizona-ldo1.c b/drivers/regulator/arizona-ldo1.c -index f0ea4fdfde87..8b963a757883 100644 ---- a/drivers/regulator/arizona-ldo1.c -+++ b/drivers/regulator/arizona-ldo1.c -@@ -141,8 +141,6 @@ static struct regulator_ops arizona_ldo1_ops = { - .map_voltage = regulator_map_voltage_linear, - .get_voltage_sel = regulator_get_voltage_sel_regmap, - .set_voltage_sel = regulator_set_voltage_sel_regmap, -- .get_bypass = regulator_get_bypass_regmap, -- .set_bypass = regulator_set_bypass_regmap, - }; - - static const struct regulator_desc arizona_ldo1 = { -diff --git a/drivers/scsi/bfa/bfa_ioc.h b/drivers/scsi/bfa/bfa_ioc.h -index 2e28392c2fb6..a38aafa030b3 100644 ---- a/drivers/scsi/bfa/bfa_ioc.h -+++ b/drivers/scsi/bfa/bfa_ioc.h -@@ -72,7 +72,7 @@ struct bfa_sge_s { - } while (0) - - #define bfa_swap_words(_x) ( \ -- ((_x) << 32) | ((_x) >> 32)) -+ ((u64)(_x) << 32) | ((u64)(_x) >> 32)) - - #ifdef __BIG_ENDIAN - #define bfa_sge_to_be(_x) -diff --git a/drivers/scsi/scsi_devinfo.c b/drivers/scsi/scsi_devinfo.c -index f969aca0b54e..49014a143c6a 100644 ---- a/drivers/scsi/scsi_devinfo.c -+++ b/drivers/scsi/scsi_devinfo.c -@@ -222,6 +222,7 @@ static struct { - {"PIONEER", "CD-ROM DRM-602X", NULL, BLIST_FORCELUN | BLIST_SINGLELUN}, - {"PIONEER", "CD-ROM DRM-604X", NULL, BLIST_FORCELUN | BLIST_SINGLELUN}, - {"PIONEER", "CD-ROM DRM-624X", NULL, BLIST_FORCELUN | BLIST_SINGLELUN}, -+ {"Promise", "VTrak E610f", NULL, BLIST_SPARSELUN | BLIST_NO_RSOC}, - {"Promise", "", NULL, BLIST_SPARSELUN}, - {"QUANTUM", "XP34301", "1071", BLIST_NOTQ}, - {"REGAL", "CDC-4X", NULL, BLIST_MAX5LUN | BLIST_SINGLELUN}, -diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c -index 4109530e92a0..054ec2c412a4 100644 ---- a/drivers/scsi/scsi_scan.c -+++ b/drivers/scsi/scsi_scan.c -@@ -922,6 +922,12 @@ static int scsi_add_lun(struct scsi_device *sdev, unsigned char *inq_result, - if (*bflags & BLIST_USE_10_BYTE_MS) - sdev->use_10_for_ms = 1; - -+ /* some devices don't like REPORT SUPPORTED OPERATION CODES -+ * and will simply timeout causing sd_mod init to take a very -+ * very long time */ -+ if (*bflags & BLIST_NO_RSOC) -+ sdev->no_report_opcodes = 1; -+ - /* set the device running here so that slave configure - * may do I/O */ - ret = scsi_device_set_state(sdev, SDEV_RUNNING); -@@ -950,7 +956,9 @@ static int scsi_add_lun(struct scsi_device *sdev, unsigned char *inq_result, - - sdev->eh_timeout = SCSI_DEFAULT_EH_TIMEOUT; - -- if (*bflags & BLIST_SKIP_VPD_PAGES) -+ if (*bflags & BLIST_TRY_VPD_PAGES) -+ sdev->try_vpd_pages = 1; -+ else if (*bflags & BLIST_SKIP_VPD_PAGES) - sdev->skip_vpd_pages = 1; - - transport_configure_device(&sdev->sdev_gendev); -@@ -1236,6 +1244,12 @@ static void scsi_sequential_lun_scan(struct scsi_target *starget, - max_dev_lun = min(8U, max_dev_lun); - - /* -+ * Stop scanning at 255 unless BLIST_SCSI3LUN -+ */ -+ if (!(bflags & BLIST_SCSI3LUN)) -+ max_dev_lun = min(256U, max_dev_lun); -+ -+ /* - * We have already scanned LUN 0, so start at LUN 1. Keep scanning - * until we reach the max, or no LUN is found and we are not - * sparse_lun. -diff --git a/drivers/scsi/scsi_transport_srp.c b/drivers/scsi/scsi_transport_srp.c -index d47ffc8d3e43..e3e794ee7ddd 100644 ---- a/drivers/scsi/scsi_transport_srp.c -+++ b/drivers/scsi/scsi_transport_srp.c -@@ -473,7 +473,8 @@ static void __srp_start_tl_fail_timers(struct srp_rport *rport) - if (delay > 0) - queue_delayed_work(system_long_wq, &rport->reconnect_work, - 1UL * delay * HZ); -- if (srp_rport_set_state(rport, SRP_RPORT_BLOCKED) == 0) { -+ if ((fast_io_fail_tmo >= 0 || dev_loss_tmo >= 0) && -+ srp_rport_set_state(rport, SRP_RPORT_BLOCKED) == 0) { - pr_debug("%s new state: %d\n", dev_name(&shost->shost_gendev), - rport->state); - scsi_target_block(&shost->shost_gendev); -diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c -index 36d1a23f14be..e8abb731c7ec 100644 ---- a/drivers/scsi/sd.c -+++ b/drivers/scsi/sd.c -@@ -2686,6 +2686,11 @@ static void sd_read_write_same(struct scsi_disk *sdkp, unsigned char *buffer) - - static int sd_try_extended_inquiry(struct scsi_device *sdp) - { -+ /* Attempt VPD inquiry if the device blacklist explicitly calls -+ * for it. -+ */ -+ if (sdp->try_vpd_pages) -+ return 1; - /* - * Although VPD inquiries can go to SCSI-2 type devices, - * some USB ones crash on receiving them, and the pages -diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c -index 9969fa1ef7c4..ed0f899e8aa5 100644 ---- a/drivers/scsi/storvsc_drv.c -+++ b/drivers/scsi/storvsc_drv.c -@@ -33,6 +33,7 @@ - #include <linux/device.h> - #include <linux/hyperv.h> - #include <linux/mempool.h> -+#include <linux/blkdev.h> - #include <scsi/scsi.h> - #include <scsi/scsi_cmnd.h> - #include <scsi/scsi_host.h> -@@ -330,17 +331,17 @@ static int storvsc_timeout = 180; - - static void storvsc_on_channel_callback(void *context); - --/* -- * In Hyper-V, each port/path/target maps to 1 scsi host adapter. In -- * reality, the path/target is not used (ie always set to 0) so our -- * scsi host adapter essentially has 1 bus with 1 target that contains -- * up to 256 luns. -- */ --#define STORVSC_MAX_LUNS_PER_TARGET 64 --#define STORVSC_MAX_TARGETS 1 --#define STORVSC_MAX_CHANNELS 1 -+#define STORVSC_MAX_LUNS_PER_TARGET 255 -+#define STORVSC_MAX_TARGETS 2 -+#define STORVSC_MAX_CHANNELS 8 - -+#define STORVSC_FC_MAX_LUNS_PER_TARGET 255 -+#define STORVSC_FC_MAX_TARGETS 128 -+#define STORVSC_FC_MAX_CHANNELS 8 - -+#define STORVSC_IDE_MAX_LUNS_PER_TARGET 64 -+#define STORVSC_IDE_MAX_TARGETS 1 -+#define STORVSC_IDE_MAX_CHANNELS 1 - - struct storvsc_cmd_request { - struct list_head entry; -@@ -1017,6 +1018,13 @@ static void storvsc_handle_error(struct vmscsi_request *vm_srb, - case ATA_12: - set_host_byte(scmnd, DID_PASSTHROUGH); - break; -+ /* -+ * On Some Windows hosts TEST_UNIT_READY command can return -+ * SRB_STATUS_ERROR, let the upper level code deal with it -+ * based on the sense information. -+ */ -+ case TEST_UNIT_READY: -+ break; - default: - set_host_byte(scmnd, DID_TARGET_FAILURE); - } -@@ -1518,6 +1526,16 @@ static int storvsc_host_reset_handler(struct scsi_cmnd *scmnd) - return SUCCESS; - } - -+/* -+ * The host guarantees to respond to each command, although I/O latencies might -+ * be unbounded on Azure. Reset the timer unconditionally to give the host a -+ * chance to perform EH. -+ */ -+static enum blk_eh_timer_return storvsc_eh_timed_out(struct scsi_cmnd *scmnd) -+{ -+ return BLK_EH_RESET_TIMER; -+} -+ - static bool storvsc_scsi_cmd_ok(struct scsi_cmnd *scmnd) - { - bool allowed = true; -@@ -1553,9 +1571,19 @@ static int storvsc_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *scmnd) - struct vmscsi_request *vm_srb; - struct stor_mem_pools *memp = scmnd->device->hostdata; - -- if (!storvsc_scsi_cmd_ok(scmnd)) { -- scmnd->scsi_done(scmnd); -- return 0; -+ if (vmstor_current_major <= VMSTOR_WIN8_MAJOR) { -+ /* -+ * On legacy hosts filter unimplemented commands. -+ * Future hosts are expected to correctly handle -+ * unsupported commands. Furthermore, it is -+ * possible that some of the currently -+ * unsupported commands maybe supported in -+ * future versions of the host. -+ */ -+ if (!storvsc_scsi_cmd_ok(scmnd)) { -+ scmnd->scsi_done(scmnd); -+ return 0; -+ } - } - - request_size = sizeof(struct storvsc_cmd_request); -@@ -1580,26 +1608,24 @@ static int storvsc_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *scmnd) - vm_srb = &cmd_request->vstor_packet.vm_srb; - vm_srb->win8_extension.time_out_value = 60; - -+ vm_srb->win8_extension.srb_flags |= -+ (SRB_FLAGS_QUEUE_ACTION_ENABLE | -+ SRB_FLAGS_DISABLE_SYNCH_TRANSFER); - - /* Build the SRB */ - switch (scmnd->sc_data_direction) { - case DMA_TO_DEVICE: - vm_srb->data_in = WRITE_TYPE; - vm_srb->win8_extension.srb_flags |= SRB_FLAGS_DATA_OUT; -- vm_srb->win8_extension.srb_flags |= -- (SRB_FLAGS_QUEUE_ACTION_ENABLE | -- SRB_FLAGS_DISABLE_SYNCH_TRANSFER); - break; - case DMA_FROM_DEVICE: - vm_srb->data_in = READ_TYPE; - vm_srb->win8_extension.srb_flags |= SRB_FLAGS_DATA_IN; -- vm_srb->win8_extension.srb_flags |= -- (SRB_FLAGS_QUEUE_ACTION_ENABLE | -- SRB_FLAGS_DISABLE_SYNCH_TRANSFER); - break; - default: - vm_srb->data_in = UNKNOWN_TYPE; -- vm_srb->win8_extension.srb_flags = 0; -+ vm_srb->win8_extension.srb_flags |= (SRB_FLAGS_DATA_IN | -+ SRB_FLAGS_DATA_OUT); - break; - } - -@@ -1687,11 +1713,11 @@ static struct scsi_host_template scsi_driver = { - .bios_param = storvsc_get_chs, - .queuecommand = storvsc_queuecommand, - .eh_host_reset_handler = storvsc_host_reset_handler, -+ .eh_timed_out = storvsc_eh_timed_out, - .slave_alloc = storvsc_device_alloc, - .slave_destroy = storvsc_device_destroy, - .slave_configure = storvsc_device_configure, -- .cmd_per_lun = 1, -- /* 64 max_queue * 1 target */ -+ .cmd_per_lun = 255, - .can_queue = STORVSC_MAX_IO_REQUESTS*STORVSC_MAX_TARGETS, - .this_id = -1, - /* no use setting to 0 since ll_blk_rw reset it to 1 */ -@@ -1743,19 +1769,25 @@ static int storvsc_probe(struct hv_device *device, - * set state to properly communicate with the host. - */ - -- if (vmbus_proto_version == VERSION_WIN8) { -- sense_buffer_size = POST_WIN7_STORVSC_SENSE_BUFFER_SIZE; -- vmscsi_size_delta = 0; -- vmstor_current_major = VMSTOR_WIN8_MAJOR; -- vmstor_current_minor = VMSTOR_WIN8_MINOR; -- } else { -+ switch (vmbus_proto_version) { -+ case VERSION_WS2008: -+ case VERSION_WIN7: - sense_buffer_size = PRE_WIN8_STORVSC_SENSE_BUFFER_SIZE; - vmscsi_size_delta = sizeof(struct vmscsi_win8_extension); - vmstor_current_major = VMSTOR_WIN7_MAJOR; - vmstor_current_minor = VMSTOR_WIN7_MINOR; -+ break; -+ default: -+ sense_buffer_size = POST_WIN7_STORVSC_SENSE_BUFFER_SIZE; -+ vmscsi_size_delta = 0; -+ vmstor_current_major = VMSTOR_WIN8_MAJOR; -+ vmstor_current_minor = VMSTOR_WIN8_MINOR; -+ break; - } - -- -+ if (dev_id->driver_data == SFC_GUID) -+ scsi_driver.can_queue = (STORVSC_MAX_IO_REQUESTS * -+ STORVSC_FC_MAX_TARGETS); - host = scsi_host_alloc(&scsi_driver, - sizeof(struct hv_host_device)); - if (!host) -@@ -1789,12 +1821,25 @@ static int storvsc_probe(struct hv_device *device, - host_dev->path = stor_device->path_id; - host_dev->target = stor_device->target_id; - -- /* max # of devices per target */ -- host->max_lun = STORVSC_MAX_LUNS_PER_TARGET; -- /* max # of targets per channel */ -- host->max_id = STORVSC_MAX_TARGETS; -- /* max # of channels */ -- host->max_channel = STORVSC_MAX_CHANNELS - 1; -+ switch (dev_id->driver_data) { -+ case SFC_GUID: -+ host->max_lun = STORVSC_FC_MAX_LUNS_PER_TARGET; -+ host->max_id = STORVSC_FC_MAX_TARGETS; -+ host->max_channel = STORVSC_FC_MAX_CHANNELS - 1; -+ break; -+ -+ case SCSI_GUID: -+ host->max_lun = STORVSC_MAX_LUNS_PER_TARGET; -+ host->max_id = STORVSC_MAX_TARGETS; -+ host->max_channel = STORVSC_MAX_CHANNELS - 1; -+ break; -+ -+ default: -+ host->max_lun = STORVSC_IDE_MAX_LUNS_PER_TARGET; -+ host->max_id = STORVSC_IDE_MAX_TARGETS; -+ host->max_channel = STORVSC_IDE_MAX_CHANNELS - 1; -+ break; -+ } - /* max cmd length */ - host->max_cmd_len = STORVSC_MAX_CMD_LEN; - -diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c -index a72127f08e39..a64f1557c156 100644 ---- a/drivers/spi/spi-omap2-mcspi.c -+++ b/drivers/spi/spi-omap2-mcspi.c -@@ -147,6 +147,7 @@ struct omap2_mcspi_cs { - void __iomem *base; - unsigned long phys; - int word_len; -+ u16 mode; - struct list_head node; - /* Context save and restore shadow register */ - u32 chconf0; -@@ -899,6 +900,8 @@ static int omap2_mcspi_setup_transfer(struct spi_device *spi, - - mcspi_write_chconf0(spi, l); - -+ cs->mode = spi->mode; -+ - dev_dbg(&spi->dev, "setup: speed %d, sample %s edge, clk %s\n", - OMAP2_MCSPI_MAX_FREQ >> div, - (spi->mode & SPI_CPHA) ? "trailing" : "leading", -@@ -971,6 +974,7 @@ static int omap2_mcspi_setup(struct spi_device *spi) - return -ENOMEM; - cs->base = mcspi->base + spi->chip_select * 0x14; - cs->phys = mcspi->phys + spi->chip_select * 0x14; -+ cs->mode = 0; - cs->chconf0 = 0; - spi->controller_state = cs; - /* Link this to context save list */ -@@ -1051,6 +1055,16 @@ static void omap2_mcspi_work(struct omap2_mcspi *mcspi, struct spi_message *m) - cs = spi->controller_state; - cd = spi->controller_data; - -+ /* -+ * The slave driver could have changed spi->mode in which case -+ * it will be different from cs->mode (the current hardware setup). -+ * If so, set par_override (even though its not a parity issue) so -+ * omap2_mcspi_setup_transfer will be called to configure the hardware -+ * with the correct mode on the first iteration of the loop below. -+ */ -+ if (spi->mode != cs->mode) -+ par_override = 1; -+ - omap2_mcspi_set_enable(spi, 0); - list_for_each_entry(t, &m->transfers, transfer_list) { - if (t->tx_buf == NULL && t->rx_buf == NULL && t->len) { -diff --git a/drivers/spi/spi-orion.c b/drivers/spi/spi-orion.c -index 7f2121fe2622..977b0619bb78 100644 ---- a/drivers/spi/spi-orion.c -+++ b/drivers/spi/spi-orion.c -@@ -404,8 +404,6 @@ static int orion_spi_probe(struct platform_device *pdev) - struct resource *r; - unsigned long tclk_hz; - int status = 0; -- const u32 *iprop; -- int size; - - master = spi_alloc_master(&pdev->dev, sizeof(*spi)); - if (master == NULL) { -@@ -416,10 +414,10 @@ static int orion_spi_probe(struct platform_device *pdev) - if (pdev->id != -1) - master->bus_num = pdev->id; - if (pdev->dev.of_node) { -- iprop = of_get_property(pdev->dev.of_node, "cell-index", -- &size); -- if (iprop && size == sizeof(*iprop)) -- master->bus_num = *iprop; -+ u32 cell_index; -+ if (!of_property_read_u32(pdev->dev.of_node, "cell-index", -+ &cell_index)) -+ master->bus_num = cell_index; - } - - /* we support only mode 0, and no options */ -diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c -index c702fc536a77..ced9ecffa163 100644 ---- a/drivers/spi/spi-pxa2xx.c -+++ b/drivers/spi/spi-pxa2xx.c -@@ -1078,6 +1078,7 @@ static struct acpi_device_id pxa2xx_spi_acpi_match[] = { - { "INT3430", 0 }, - { "INT3431", 0 }, - { "80860F0E", 0 }, -+ { "8086228E", 0 }, - { }, - }; - MODULE_DEVICE_TABLE(acpi, pxa2xx_spi_acpi_match); -diff --git a/drivers/xen/events/events_fifo.c b/drivers/xen/events/events_fifo.c -index 172a8bc27abd..ef7d446e07ee 100644 ---- a/drivers/xen/events/events_fifo.c -+++ b/drivers/xen/events/events_fifo.c -@@ -99,6 +99,25 @@ static unsigned evtchn_fifo_nr_channels(void) - return event_array_pages * EVENT_WORDS_PER_PAGE; - } - -+static int init_control_block(int cpu, -+ struct evtchn_fifo_control_block *control_block) -+{ -+ struct evtchn_fifo_queue *q = &per_cpu(cpu_queue, cpu); -+ struct evtchn_init_control init_control; -+ unsigned int i; -+ -+ /* Reset the control block and the local HEADs. */ -+ clear_page(control_block); -+ for (i = 0; i < EVTCHN_FIFO_MAX_QUEUES; i++) -+ q->head[i] = 0; -+ -+ init_control.control_gfn = virt_to_mfn(control_block); -+ init_control.offset = 0; -+ init_control.vcpu = cpu; -+ -+ return HYPERVISOR_event_channel_op(EVTCHNOP_init_control, &init_control); -+} -+ - static void free_unused_array_pages(void) - { - unsigned i; -@@ -327,7 +346,6 @@ static void evtchn_fifo_resume(void) - - for_each_possible_cpu(cpu) { - void *control_block = per_cpu(cpu_control_block, cpu); -- struct evtchn_init_control init_control; - int ret; - - if (!control_block) -@@ -344,12 +362,7 @@ static void evtchn_fifo_resume(void) - continue; - } - -- init_control.control_gfn = virt_to_mfn(control_block); -- init_control.offset = 0; -- init_control.vcpu = cpu; -- -- ret = HYPERVISOR_event_channel_op(EVTCHNOP_init_control, -- &init_control); -+ ret = init_control_block(cpu, control_block); - if (ret < 0) - BUG(); - } -@@ -377,30 +390,25 @@ static const struct evtchn_ops evtchn_ops_fifo = { - .resume = evtchn_fifo_resume, - }; - --static int evtchn_fifo_init_control_block(unsigned cpu) -+static int evtchn_fifo_alloc_control_block(unsigned cpu) - { -- struct page *control_block = NULL; -- struct evtchn_init_control init_control; -+ void *control_block = NULL; - int ret = -ENOMEM; - -- control_block = alloc_page(GFP_KERNEL|__GFP_ZERO); -+ control_block = (void *)__get_free_page(GFP_KERNEL); - if (control_block == NULL) - goto error; - -- init_control.control_gfn = virt_to_mfn(page_address(control_block)); -- init_control.offset = 0; -- init_control.vcpu = cpu; -- -- ret = HYPERVISOR_event_channel_op(EVTCHNOP_init_control, &init_control); -+ ret = init_control_block(cpu, control_block); - if (ret < 0) - goto error; - -- per_cpu(cpu_control_block, cpu) = page_address(control_block); -+ per_cpu(cpu_control_block, cpu) = control_block; - - return 0; - - error: -- __free_page(control_block); -+ free_page((unsigned long)control_block); - return ret; - } - -@@ -414,7 +422,7 @@ static int evtchn_fifo_cpu_notification(struct notifier_block *self, - switch (action) { - case CPU_UP_PREPARE: - if (!per_cpu(cpu_control_block, cpu)) -- ret = evtchn_fifo_init_control_block(cpu); -+ ret = evtchn_fifo_alloc_control_block(cpu); - break; - default: - break; -@@ -431,7 +439,7 @@ int __init xen_evtchn_fifo_init(void) - int cpu = get_cpu(); - int ret; - -- ret = evtchn_fifo_init_control_block(cpu); -+ ret = evtchn_fifo_alloc_control_block(cpu); - if (ret < 0) - goto out; - -diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h -index 30f6e9251a4a..f15d4353f30f 100644 ---- a/fs/cifs/cifsglob.h -+++ b/fs/cifs/cifsglob.h -@@ -70,11 +70,6 @@ - #define SERVER_NAME_LENGTH 40 - #define SERVER_NAME_LEN_WITH_NULL (SERVER_NAME_LENGTH + 1) - --/* used to define string lengths for reversing unicode strings */ --/* (256+1)*2 = 514 */ --/* (max path length + 1 for null) * 2 for unicode */ --#define MAX_NAME 514 -- - /* SMB echo "timeout" -- FIXME: tunable? */ - #define SMB_ECHO_INTERVAL (60 * HZ) - -diff --git a/fs/cifs/file.c b/fs/cifs/file.c -index 87c4dd072cde..8175b18df819 100644 ---- a/fs/cifs/file.c -+++ b/fs/cifs/file.c -@@ -2844,7 +2844,7 @@ cifs_uncached_read_into_pages(struct TCP_Server_Info *server, - total_read += result; - } - -- return total_read > 0 ? total_read : result; -+ return total_read > 0 && result != -EAGAIN ? total_read : result; - } - - static ssize_t -@@ -3267,7 +3267,7 @@ cifs_readpages_read_into_pages(struct TCP_Server_Info *server, - total_read += result; - } - -- return total_read > 0 ? total_read : result; -+ return total_read > 0 && result != -EAGAIN ? total_read : result; - } - - static int cifs_readpages(struct file *file, struct address_space *mapping, -diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c -index aadc2b68678b..f2ddcf7ac9c3 100644 ---- a/fs/cifs/inode.c -+++ b/fs/cifs/inode.c -@@ -1706,13 +1706,22 @@ cifs_rename(struct inode *source_dir, struct dentry *source_dentry, - unlink_target: - /* Try unlinking the target dentry if it's not negative */ - if (target_dentry->d_inode && (rc == -EACCES || rc == -EEXIST)) { -- tmprc = cifs_unlink(target_dir, target_dentry); -+ if (d_is_dir(target_dentry)) -+ tmprc = cifs_rmdir(target_dir, target_dentry); -+ else -+ tmprc = cifs_unlink(target_dir, target_dentry); - if (tmprc) - goto cifs_rename_exit; - rc = cifs_do_rename(xid, source_dentry, from_name, - target_dentry, to_name); - } - -+ /* force revalidate to go get info when needed */ -+ CIFS_I(source_dir)->time = CIFS_I(target_dir)->time = 0; -+ -+ source_dir->i_ctime = source_dir->i_mtime = target_dir->i_ctime = -+ target_dir->i_mtime = current_fs_time(source_dir->i_sb); -+ - cifs_rename_exit: - kfree(info_buf_source); - kfree(from_name); -diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c -index b15862e0f68c..2bbf11b09214 100644 ---- a/fs/cifs/readdir.c -+++ b/fs/cifs/readdir.c -@@ -596,8 +596,8 @@ find_cifs_entry(const unsigned int xid, struct cifs_tcon *tcon, loff_t pos, - if (!cfile->srch_inf.endOfSearch && !cfile->invalidHandle) { - cfile->invalidHandle = true; - spin_unlock(&cifs_file_list_lock); -- if (server->ops->close) -- server->ops->close(xid, tcon, &cfile->fid); -+ if (server->ops->close_dir) -+ server->ops->close_dir(xid, tcon, &cfile->fid); - } else - spin_unlock(&cifs_file_list_lock); - if (cfile->srch_inf.ntwrk_buf_start) { -diff --git a/fs/cifs/smb2file.c b/fs/cifs/smb2file.c -index 3f17b4550831..45992944e238 100644 ---- a/fs/cifs/smb2file.c -+++ b/fs/cifs/smb2file.c -@@ -50,7 +50,7 @@ smb2_open_file(const unsigned int xid, struct cifs_open_parms *oparms, - goto out; - } - -- smb2_data = kzalloc(sizeof(struct smb2_file_all_info) + MAX_NAME * 2, -+ smb2_data = kzalloc(sizeof(struct smb2_file_all_info) + PATH_MAX * 2, - GFP_KERNEL); - if (smb2_data == NULL) { - rc = -ENOMEM; -diff --git a/fs/cifs/smb2inode.c b/fs/cifs/smb2inode.c -index 84c012a6aba0..215f8d3e3e53 100644 ---- a/fs/cifs/smb2inode.c -+++ b/fs/cifs/smb2inode.c -@@ -131,7 +131,7 @@ smb2_query_path_info(const unsigned int xid, struct cifs_tcon *tcon, - *adjust_tz = false; - *symlink = false; - -- smb2_data = kzalloc(sizeof(struct smb2_file_all_info) + MAX_NAME * 2, -+ smb2_data = kzalloc(sizeof(struct smb2_file_all_info) + PATH_MAX * 2, - GFP_KERNEL); - if (smb2_data == NULL) - return -ENOMEM; -diff --git a/fs/cifs/smb2maperror.c b/fs/cifs/smb2maperror.c -index 94bd4fbb13d3..e31a9dfdcd39 100644 ---- a/fs/cifs/smb2maperror.c -+++ b/fs/cifs/smb2maperror.c -@@ -605,7 +605,7 @@ static const struct status_to_posix_error smb2_error_map_table[] = { - {STATUS_MAPPED_FILE_SIZE_ZERO, -EIO, "STATUS_MAPPED_FILE_SIZE_ZERO"}, - {STATUS_TOO_MANY_OPENED_FILES, -EMFILE, "STATUS_TOO_MANY_OPENED_FILES"}, - {STATUS_CANCELLED, -EIO, "STATUS_CANCELLED"}, -- {STATUS_CANNOT_DELETE, -EIO, "STATUS_CANNOT_DELETE"}, -+ {STATUS_CANNOT_DELETE, -EACCES, "STATUS_CANNOT_DELETE"}, - {STATUS_INVALID_COMPUTER_NAME, -EIO, "STATUS_INVALID_COMPUTER_NAME"}, - {STATUS_FILE_DELETED, -EIO, "STATUS_FILE_DELETED"}, - {STATUS_SPECIAL_ACCOUNT, -EIO, "STATUS_SPECIAL_ACCOUNT"}, -diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c -index 35ddc3ed119d..f8977b2d9187 100644 ---- a/fs/cifs/smb2ops.c -+++ b/fs/cifs/smb2ops.c -@@ -339,7 +339,7 @@ smb2_query_file_info(const unsigned int xid, struct cifs_tcon *tcon, - int rc; - struct smb2_file_all_info *smb2_data; - -- smb2_data = kzalloc(sizeof(struct smb2_file_all_info) + MAX_NAME * 2, -+ smb2_data = kzalloc(sizeof(struct smb2_file_all_info) + PATH_MAX * 2, - GFP_KERNEL); - if (smb2_data == NULL) - return -ENOMEM; -diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c -index 049a3f2693ba..9aab8fe0e508 100644 ---- a/fs/cifs/smb2pdu.c -+++ b/fs/cifs/smb2pdu.c -@@ -916,7 +916,8 @@ tcon_exit: - tcon_error_exit: - if (rsp->hdr.Status == STATUS_BAD_NETWORK_NAME) { - cifs_dbg(VFS, "BAD_NETWORK_NAME: %s\n", tree); -- tcon->bad_network_name = true; -+ if (tcon) -+ tcon->bad_network_name = true; - } - goto tcon_exit; - } -@@ -1539,7 +1540,7 @@ SMB2_query_info(const unsigned int xid, struct cifs_tcon *tcon, - { - return query_info(xid, tcon, persistent_fid, volatile_fid, - FILE_ALL_INFORMATION, -- sizeof(struct smb2_file_all_info) + MAX_NAME * 2, -+ sizeof(struct smb2_file_all_info) + PATH_MAX * 2, - sizeof(struct smb2_file_all_info), data); - } - -diff --git a/fs/dcache.c b/fs/dcache.c -index 7f3b4004c6c3..58d57da91d2a 100644 ---- a/fs/dcache.c -+++ b/fs/dcache.c -@@ -106,8 +106,7 @@ static inline struct hlist_bl_head *d_hash(const struct dentry *parent, - unsigned int hash) - { - hash += (unsigned long) parent / L1_CACHE_BYTES; -- hash = hash + (hash >> d_hash_shift); -- return dentry_hashtable + (hash & d_hash_mask); -+ return dentry_hashtable + hash_32(hash, d_hash_shift); - } - - /* Statistics gathering. */ -diff --git a/fs/namei.c b/fs/namei.c -index bdea10963aa5..d5a4faeb39a5 100644 ---- a/fs/namei.c -+++ b/fs/namei.c -@@ -34,6 +34,7 @@ - #include <linux/device_cgroup.h> - #include <linux/fs_struct.h> - #include <linux/posix_acl.h> -+#include <linux/hash.h> - #include <asm/uaccess.h> - - #include "internal.h" -@@ -1624,8 +1625,7 @@ static inline int nested_symlink(struct path *path, struct nameidata *nd) - - static inline unsigned int fold_hash(unsigned long hash) - { -- hash += hash >> (8*sizeof(int)); -- return hash; -+ return hash_64(hash, 32); - } - - #else /* 32-bit case */ -@@ -1797,7 +1797,7 @@ static int link_path_walk(const char *name, struct nameidata *nd) - if (err) - return err; - } -- if (!d_is_directory(nd->path.dentry)) { -+ if (!d_can_lookup(nd->path.dentry)) { - err = -ENOTDIR; - break; - } -@@ -1818,7 +1818,7 @@ static int path_init(int dfd, const char *name, unsigned int flags, - struct dentry *root = nd->root.dentry; - struct inode *inode = root->d_inode; - if (*name) { -- if (!d_is_directory(root)) -+ if (!d_can_lookup(root)) - return -ENOTDIR; - retval = inode_permission(inode, MAY_EXEC); - if (retval) -@@ -1874,7 +1874,7 @@ static int path_init(int dfd, const char *name, unsigned int flags, - dentry = f.file->f_path.dentry; - - if (*name) { -- if (!d_is_directory(dentry)) { -+ if (!d_can_lookup(dentry)) { - fdput(f); - return -ENOTDIR; - } -@@ -1956,7 +1956,7 @@ static int path_lookupat(int dfd, const char *name, - err = complete_walk(nd); - - if (!err && nd->flags & LOOKUP_DIRECTORY) { -- if (!d_is_directory(nd->path.dentry)) { -+ if (!d_can_lookup(nd->path.dentry)) { - path_put(&nd->path); - err = -ENOTDIR; - } -@@ -2416,11 +2416,11 @@ static int may_delete(struct inode *dir, struct dentry *victim, bool isdir) - IS_IMMUTABLE(inode) || IS_SWAPFILE(inode)) - return -EPERM; - if (isdir) { -- if (!d_is_directory(victim) && !d_is_autodir(victim)) -+ if (!d_is_dir(victim)) - return -ENOTDIR; - if (IS_ROOT(victim)) - return -EBUSY; -- } else if (d_is_directory(victim) || d_is_autodir(victim)) -+ } else if (d_is_dir(victim)) - return -EISDIR; - if (IS_DEADDIR(dir)) - return -ENOENT; -@@ -3018,11 +3018,10 @@ finish_open: - } - audit_inode(name, nd->path.dentry, 0); - error = -EISDIR; -- if ((open_flag & O_CREAT) && -- (d_is_directory(nd->path.dentry) || d_is_autodir(nd->path.dentry))) -+ if ((open_flag & O_CREAT) && d_is_dir(nd->path.dentry)) - goto out; - error = -ENOTDIR; -- if ((nd->flags & LOOKUP_DIRECTORY) && !d_is_directory(nd->path.dentry)) -+ if ((nd->flags & LOOKUP_DIRECTORY) && !d_can_lookup(nd->path.dentry)) - goto out; - if (!S_ISREG(nd->inode->i_mode)) - will_truncate = false; -@@ -3746,7 +3745,7 @@ exit1: - slashes: - if (d_is_negative(dentry)) - error = -ENOENT; -- else if (d_is_directory(dentry) || d_is_autodir(dentry)) -+ else if (d_is_dir(dentry)) - error = -EISDIR; - else - error = -ENOTDIR; -@@ -4125,7 +4124,7 @@ int vfs_rename(struct inode *old_dir, struct dentry *old_dentry, - struct inode **delegated_inode) - { - int error; -- int is_dir = d_is_directory(old_dentry) || d_is_autodir(old_dentry); -+ int is_dir = d_is_dir(old_dentry); - const unsigned char *old_name; - - if (old_dentry->d_inode == new_dentry->d_inode) -@@ -4218,7 +4217,7 @@ retry_deleg: - if (d_is_negative(old_dentry)) - goto exit4; - /* unless the source is a directory trailing slashes give -ENOTDIR */ -- if (!d_is_directory(old_dentry) && !d_is_autodir(old_dentry)) { -+ if (!d_is_dir(old_dentry)) { - error = -ENOTDIR; - if (oldnd.last.name[oldnd.last.len]) - goto exit4; -diff --git a/fs/namespace.c b/fs/namespace.c -index 65233a5f390a..75536db4b69b 100644 ---- a/fs/namespace.c -+++ b/fs/namespace.c -@@ -777,6 +777,20 @@ static void attach_mnt(struct mount *mnt, - list_add_tail(&mnt->mnt_child, &parent->mnt_mounts); - } - -+static void attach_shadowed(struct mount *mnt, -+ struct mount *parent, -+ struct mount *shadows) -+{ -+ if (shadows) { -+ hlist_add_after_rcu(&shadows->mnt_hash, &mnt->mnt_hash); -+ list_add(&mnt->mnt_child, &shadows->mnt_child); -+ } else { -+ hlist_add_head_rcu(&mnt->mnt_hash, -+ m_hash(&parent->mnt, mnt->mnt_mountpoint)); -+ list_add_tail(&mnt->mnt_child, &parent->mnt_mounts); -+ } -+} -+ - /* - * vfsmount lock must be held for write - */ -@@ -795,12 +809,7 @@ static void commit_tree(struct mount *mnt, struct mount *shadows) - - list_splice(&head, n->list.prev); - -- if (shadows) -- hlist_add_after_rcu(&shadows->mnt_hash, &mnt->mnt_hash); -- else -- hlist_add_head_rcu(&mnt->mnt_hash, -- m_hash(&parent->mnt, mnt->mnt_mountpoint)); -- list_add_tail(&mnt->mnt_child, &parent->mnt_mounts); -+ attach_shadowed(mnt, parent, shadows); - touch_mnt_namespace(n); - } - -@@ -887,8 +896,21 @@ static struct mount *clone_mnt(struct mount *old, struct dentry *root, - - mnt->mnt.mnt_flags = old->mnt.mnt_flags & ~(MNT_WRITE_HOLD|MNT_MARKED); - /* Don't allow unprivileged users to change mount flags */ -- if ((flag & CL_UNPRIVILEGED) && (mnt->mnt.mnt_flags & MNT_READONLY)) -- mnt->mnt.mnt_flags |= MNT_LOCK_READONLY; -+ if (flag & CL_UNPRIVILEGED) { -+ mnt->mnt.mnt_flags |= MNT_LOCK_ATIME; -+ -+ if (mnt->mnt.mnt_flags & MNT_READONLY) -+ mnt->mnt.mnt_flags |= MNT_LOCK_READONLY; -+ -+ if (mnt->mnt.mnt_flags & MNT_NODEV) -+ mnt->mnt.mnt_flags |= MNT_LOCK_NODEV; -+ -+ if (mnt->mnt.mnt_flags & MNT_NOSUID) -+ mnt->mnt.mnt_flags |= MNT_LOCK_NOSUID; -+ -+ if (mnt->mnt.mnt_flags & MNT_NOEXEC) -+ mnt->mnt.mnt_flags |= MNT_LOCK_NOEXEC; -+ } - - /* Don't allow unprivileged users to reveal what is under a mount */ - if ((flag & CL_UNPRIVILEGED) && list_empty(&old->mnt_expire)) -@@ -1204,6 +1226,11 @@ static void namespace_unlock(void) - head.first->pprev = &head.first; - INIT_HLIST_HEAD(&unmounted); - -+ /* undo decrements we'd done in umount_tree() */ -+ hlist_for_each_entry(mnt, &head, mnt_hash) -+ if (mnt->mnt_ex_mountpoint.mnt) -+ mntget(mnt->mnt_ex_mountpoint.mnt); -+ - up_write(&namespace_sem); - - synchronize_rcu(); -@@ -1240,6 +1267,9 @@ void umount_tree(struct mount *mnt, int how) - hlist_add_head(&p->mnt_hash, &tmp_list); - } - -+ hlist_for_each_entry(p, &tmp_list, mnt_hash) -+ list_del_init(&p->mnt_child); -+ - if (how) - propagate_umount(&tmp_list); - -@@ -1250,9 +1280,9 @@ void umount_tree(struct mount *mnt, int how) - p->mnt_ns = NULL; - if (how < 2) - p->mnt.mnt_flags |= MNT_SYNC_UMOUNT; -- list_del_init(&p->mnt_child); - if (mnt_has_parent(p)) { - put_mountpoint(p->mnt_mp); -+ mnt_add_count(p->mnt_parent, -1); - /* move the reference to mountpoint into ->mnt_ex_mountpoint */ - p->mnt_ex_mountpoint.dentry = p->mnt_mountpoint; - p->mnt_ex_mountpoint.mnt = &p->mnt_parent->mnt; -@@ -1483,6 +1513,7 @@ struct mount *copy_tree(struct mount *mnt, struct dentry *dentry, - continue; - - for (s = r; s; s = next_mnt(s, r)) { -+ struct mount *t = NULL; - if (!(flag & CL_COPY_UNBINDABLE) && - IS_MNT_UNBINDABLE(s)) { - s = skip_mnt_tree(s); -@@ -1504,7 +1535,14 @@ struct mount *copy_tree(struct mount *mnt, struct dentry *dentry, - goto out; - lock_mount_hash(); - list_add_tail(&q->mnt_list, &res->mnt_list); -- attach_mnt(q, parent, p->mnt_mp); -+ mnt_set_mountpoint(parent, p->mnt_mp, q); -+ if (!list_empty(&parent->mnt_mounts)) { -+ t = list_last_entry(&parent->mnt_mounts, -+ struct mount, mnt_child); -+ if (t->mnt_mp != p->mnt_mp) -+ t = NULL; -+ } -+ attach_shadowed(q, parent, t); - unlock_mount_hash(); - } - } -@@ -1887,9 +1925,6 @@ static int change_mount_flags(struct vfsmount *mnt, int ms_flags) - if (readonly_request == __mnt_is_readonly(mnt)) - return 0; - -- if (mnt->mnt_flags & MNT_LOCK_READONLY) -- return -EPERM; -- - if (readonly_request) - error = mnt_make_readonly(real_mount(mnt)); - else -@@ -1915,6 +1950,33 @@ static int do_remount(struct path *path, int flags, int mnt_flags, - if (path->dentry != path->mnt->mnt_root) - return -EINVAL; - -+ /* Don't allow changing of locked mnt flags. -+ * -+ * No locks need to be held here while testing the various -+ * MNT_LOCK flags because those flags can never be cleared -+ * once they are set. -+ */ -+ if ((mnt->mnt.mnt_flags & MNT_LOCK_READONLY) && -+ !(mnt_flags & MNT_READONLY)) { -+ return -EPERM; -+ } -+ if ((mnt->mnt.mnt_flags & MNT_LOCK_NODEV) && -+ !(mnt_flags & MNT_NODEV)) { -+ return -EPERM; -+ } -+ if ((mnt->mnt.mnt_flags & MNT_LOCK_NOSUID) && -+ !(mnt_flags & MNT_NOSUID)) { -+ return -EPERM; -+ } -+ if ((mnt->mnt.mnt_flags & MNT_LOCK_NOEXEC) && -+ !(mnt_flags & MNT_NOEXEC)) { -+ return -EPERM; -+ } -+ if ((mnt->mnt.mnt_flags & MNT_LOCK_ATIME) && -+ ((mnt->mnt.mnt_flags & MNT_ATIME_MASK) != (mnt_flags & MNT_ATIME_MASK))) { -+ return -EPERM; -+ } -+ - err = security_sb_remount(sb, data); - if (err) - return err; -@@ -1928,7 +1990,7 @@ static int do_remount(struct path *path, int flags, int mnt_flags, - err = do_remount_sb(sb, flags, data, 0); - if (!err) { - lock_mount_hash(); -- mnt_flags |= mnt->mnt.mnt_flags & MNT_PROPAGATION_MASK; -+ mnt_flags |= mnt->mnt.mnt_flags & ~MNT_USER_SETTABLE_MASK; - mnt->mnt.mnt_flags = mnt_flags; - touch_mnt_namespace(mnt->mnt_ns); - unlock_mount_hash(); -@@ -2113,7 +2175,7 @@ static int do_new_mount(struct path *path, const char *fstype, int flags, - */ - if (!(type->fs_flags & FS_USERNS_DEV_MOUNT)) { - flags |= MS_NODEV; -- mnt_flags |= MNT_NODEV; -+ mnt_flags |= MNT_NODEV | MNT_LOCK_NODEV; - } - } - -@@ -2427,6 +2489,14 @@ long do_mount(const char *dev_name, const char *dir_name, - if (flags & MS_RDONLY) - mnt_flags |= MNT_READONLY; - -+ /* The default atime for remount is preservation */ -+ if ((flags & MS_REMOUNT) && -+ ((flags & (MS_NOATIME | MS_NODIRATIME | MS_RELATIME | -+ MS_STRICTATIME)) == 0)) { -+ mnt_flags &= ~MNT_ATIME_MASK; -+ mnt_flags |= path.mnt->mnt_flags & MNT_ATIME_MASK; -+ } -+ - flags &= ~(MS_NOSUID | MS_NOEXEC | MS_NODEV | MS_ACTIVE | MS_BORN | - MS_NOATIME | MS_NODIRATIME | MS_RELATIME| MS_KERNMOUNT | - MS_STRICTATIME); -diff --git a/fs/pnode.c b/fs/pnode.c -index a364a704333b..b7f831089500 100644 ---- a/fs/pnode.c -+++ b/fs/pnode.c -@@ -381,6 +381,7 @@ static void __propagate_umount(struct mount *mnt) - * other children - */ - if (child && list_empty(&child->mnt_mounts)) { -+ list_del_init(&child->mnt_child); - hlist_del_init_rcu(&child->mnt_hash); - hlist_add_before_rcu(&child->mnt_hash, &mnt->mnt_hash); - } -diff --git a/fs/proc/array.c b/fs/proc/array.c -index 656e401794de..baf3464bbce0 100644 ---- a/fs/proc/array.c -+++ b/fs/proc/array.c -@@ -297,15 +297,11 @@ static void render_cap_t(struct seq_file *m, const char *header, - seq_puts(m, header); - CAP_FOR_EACH_U32(__capi) { - seq_printf(m, "%08x", -- a->cap[(_KERNEL_CAPABILITY_U32S-1) - __capi]); -+ a->cap[CAP_LAST_U32 - __capi]); - } - seq_putc(m, '\n'); - } - --/* Remove non-existent capabilities */ --#define NORM_CAPS(v) (v.cap[CAP_TO_INDEX(CAP_LAST_CAP)] &= \ -- CAP_TO_MASK(CAP_LAST_CAP + 1) - 1) -- - static inline void task_cap(struct seq_file *m, struct task_struct *p) - { - const struct cred *cred; -@@ -319,11 +315,6 @@ static inline void task_cap(struct seq_file *m, struct task_struct *p) - cap_bset = cred->cap_bset; - rcu_read_unlock(); - -- NORM_CAPS(cap_inheritable); -- NORM_CAPS(cap_permitted); -- NORM_CAPS(cap_effective); -- NORM_CAPS(cap_bset); -- - render_cap_t(m, "CapInh:\t", &cap_inheritable); - render_cap_t(m, "CapPrm:\t", &cap_permitted); - render_cap_t(m, "CapEff:\t", &cap_effective); -diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c -index db2cfb067d0b..5d2518b24cea 100644 ---- a/fs/xfs/xfs_aops.c -+++ b/fs/xfs/xfs_aops.c -@@ -1660,11 +1660,72 @@ xfs_vm_readpages( - return mpage_readpages(mapping, pages, nr_pages, xfs_get_blocks); - } - -+/* -+ * This is basically a copy of __set_page_dirty_buffers() with one -+ * small tweak: buffers beyond EOF do not get marked dirty. If we mark them -+ * dirty, we'll never be able to clean them because we don't write buffers -+ * beyond EOF, and that means we can't invalidate pages that span EOF -+ * that have been marked dirty. Further, the dirty state can leak into -+ * the file interior if the file is extended, resulting in all sorts of -+ * bad things happening as the state does not match the underlying data. -+ * -+ * XXX: this really indicates that bufferheads in XFS need to die. Warts like -+ * this only exist because of bufferheads and how the generic code manages them. -+ */ -+STATIC int -+xfs_vm_set_page_dirty( -+ struct page *page) -+{ -+ struct address_space *mapping = page->mapping; -+ struct inode *inode = mapping->host; -+ loff_t end_offset; -+ loff_t offset; -+ int newly_dirty; -+ -+ if (unlikely(!mapping)) -+ return !TestSetPageDirty(page); -+ -+ end_offset = i_size_read(inode); -+ offset = page_offset(page); -+ -+ spin_lock(&mapping->private_lock); -+ if (page_has_buffers(page)) { -+ struct buffer_head *head = page_buffers(page); -+ struct buffer_head *bh = head; -+ -+ do { -+ if (offset < end_offset) -+ set_buffer_dirty(bh); -+ bh = bh->b_this_page; -+ offset += 1 << inode->i_blkbits; -+ } while (bh != head); -+ } -+ newly_dirty = !TestSetPageDirty(page); -+ spin_unlock(&mapping->private_lock); -+ -+ if (newly_dirty) { -+ /* sigh - __set_page_dirty() is static, so copy it here, too */ -+ unsigned long flags; -+ -+ spin_lock_irqsave(&mapping->tree_lock, flags); -+ if (page->mapping) { /* Race with truncate? */ -+ WARN_ON_ONCE(!PageUptodate(page)); -+ account_page_dirtied(page, mapping); -+ radix_tree_tag_set(&mapping->page_tree, -+ page_index(page), PAGECACHE_TAG_DIRTY); -+ } -+ spin_unlock_irqrestore(&mapping->tree_lock, flags); -+ __mark_inode_dirty(mapping->host, I_DIRTY_PAGES); -+ } -+ return newly_dirty; -+} -+ - const struct address_space_operations xfs_address_space_operations = { - .readpage = xfs_vm_readpage, - .readpages = xfs_vm_readpages, - .writepage = xfs_vm_writepage, - .writepages = xfs_vm_writepages, -+ .set_page_dirty = xfs_vm_set_page_dirty, - .releasepage = xfs_vm_releasepage, - .invalidatepage = xfs_vm_invalidatepage, - .write_begin = xfs_vm_write_begin, -diff --git a/fs/xfs/xfs_dquot.c b/fs/xfs/xfs_dquot.c -index 7aeb4c895b32..95f94483c3d7 100644 ---- a/fs/xfs/xfs_dquot.c -+++ b/fs/xfs/xfs_dquot.c -@@ -1011,7 +1011,8 @@ xfs_qm_dqflush( - * Get the buffer containing the on-disk dquot - */ - error = xfs_trans_read_buf(mp, NULL, mp->m_ddev_targp, dqp->q_blkno, -- mp->m_quotainfo->qi_dqchunklen, 0, &bp, NULL); -+ mp->m_quotainfo->qi_dqchunklen, 0, &bp, -+ &xfs_dquot_buf_ops); - if (error) - goto out_unlock; - -diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c -index 64b48eade91d..f50def6018a9 100644 ---- a/fs/xfs/xfs_file.c -+++ b/fs/xfs/xfs_file.c -@@ -302,7 +302,16 @@ xfs_file_aio_read( - xfs_rw_iunlock(ip, XFS_IOLOCK_EXCL); - return ret; - } -- truncate_pagecache_range(VFS_I(ip), pos, -1); -+ -+ /* -+ * Invalidate whole pages. This can return an error if -+ * we fail to invalidate a page, but this should never -+ * happen on XFS. Warn if it does fail. -+ */ -+ ret = invalidate_inode_pages2_range(VFS_I(ip)->i_mapping, -+ pos >> PAGE_CACHE_SHIFT, -1); -+ WARN_ON_ONCE(ret); -+ ret = 0; - } - xfs_rw_ilock_demote(ip, XFS_IOLOCK_EXCL); - } -@@ -683,7 +692,15 @@ xfs_file_dio_aio_write( - pos, -1); - if (ret) - goto out; -- truncate_pagecache_range(VFS_I(ip), pos, -1); -+ /* -+ * Invalidate whole pages. This can return an error if -+ * we fail to invalidate a page, but this should never -+ * happen on XFS. Warn if it does fail. -+ */ -+ ret = invalidate_inode_pages2_range(VFS_I(ip)->i_mapping, -+ pos >> PAGE_CACHE_SHIFT, -1); -+ WARN_ON_ONCE(ret); -+ ret = 0; - } - - /* -diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c -index bce53ac81096..eb26418814fe 100644 ---- a/fs/xfs/xfs_log_recover.c -+++ b/fs/xfs/xfs_log_recover.c -@@ -2125,6 +2125,17 @@ xlog_recover_validate_buf_type( - __uint16_t magic16; - __uint16_t magicda; - -+ /* -+ * We can only do post recovery validation on items on CRC enabled -+ * fielsystems as we need to know when the buffer was written to be able -+ * to determine if we should have replayed the item. If we replay old -+ * metadata over a newer buffer, then it will enter a temporarily -+ * inconsistent state resulting in verification failures. Hence for now -+ * just avoid the verification stage for non-crc filesystems -+ */ -+ if (!xfs_sb_version_hascrc(&mp->m_sb)) -+ return; -+ - magic32 = be32_to_cpu(*(__be32 *)bp->b_addr); - magic16 = be16_to_cpu(*(__be16*)bp->b_addr); - magicda = be16_to_cpu(info->magic); -@@ -2160,8 +2171,6 @@ xlog_recover_validate_buf_type( - bp->b_ops = &xfs_agf_buf_ops; - break; - case XFS_BLFT_AGFL_BUF: -- if (!xfs_sb_version_hascrc(&mp->m_sb)) -- break; - if (magic32 != XFS_AGFL_MAGIC) { - xfs_warn(mp, "Bad AGFL block magic!"); - ASSERT(0); -@@ -2194,10 +2203,6 @@ xlog_recover_validate_buf_type( - #endif - break; - case XFS_BLFT_DINO_BUF: -- /* -- * we get here with inode allocation buffers, not buffers that -- * track unlinked list changes. -- */ - if (magic16 != XFS_DINODE_MAGIC) { - xfs_warn(mp, "Bad INODE block magic!"); - ASSERT(0); -@@ -2277,8 +2282,6 @@ xlog_recover_validate_buf_type( - bp->b_ops = &xfs_attr3_leaf_buf_ops; - break; - case XFS_BLFT_ATTR_RMT_BUF: -- if (!xfs_sb_version_hascrc(&mp->m_sb)) -- break; - if (magic32 != XFS_ATTR3_RMT_MAGIC) { - xfs_warn(mp, "Bad attr remote magic!"); - ASSERT(0); -@@ -2385,16 +2388,7 @@ xlog_recover_do_reg_buffer( - /* Shouldn't be any more regions */ - ASSERT(i == item->ri_total); - -- /* -- * We can only do post recovery validation on items on CRC enabled -- * fielsystems as we need to know when the buffer was written to be able -- * to determine if we should have replayed the item. If we replay old -- * metadata over a newer buffer, then it will enter a temporarily -- * inconsistent state resulting in verification failures. Hence for now -- * just avoid the verification stage for non-crc filesystems -- */ -- if (xfs_sb_version_hascrc(&mp->m_sb)) -- xlog_recover_validate_buf_type(mp, bp, buf_f); -+ xlog_recover_validate_buf_type(mp, bp, buf_f); - } - - /* -@@ -2502,12 +2496,29 @@ xlog_recover_buffer_pass2( - } - - /* -- * recover the buffer only if we get an LSN from it and it's less than -+ * Recover the buffer only if we get an LSN from it and it's less than - * the lsn of the transaction we are replaying. -+ * -+ * Note that we have to be extremely careful of readahead here. -+ * Readahead does not attach verfiers to the buffers so if we don't -+ * actually do any replay after readahead because of the LSN we found -+ * in the buffer if more recent than that current transaction then we -+ * need to attach the verifier directly. Failure to do so can lead to -+ * future recovery actions (e.g. EFI and unlinked list recovery) can -+ * operate on the buffers and they won't get the verifier attached. This -+ * can lead to blocks on disk having the correct content but a stale -+ * CRC. -+ * -+ * It is safe to assume these clean buffers are currently up to date. -+ * If the buffer is dirtied by a later transaction being replayed, then -+ * the verifier will be reset to match whatever recover turns that -+ * buffer into. - */ - lsn = xlog_recover_get_buf_lsn(mp, bp); -- if (lsn && lsn != -1 && XFS_LSN_CMP(lsn, current_lsn) >= 0) -+ if (lsn && lsn != -1 && XFS_LSN_CMP(lsn, current_lsn) >= 0) { -+ xlog_recover_validate_buf_type(mp, bp, buf_f); - goto out_release; -+ } - - if (buf_f->blf_flags & XFS_BLF_INODE_BUF) { - error = xlog_recover_do_inode_buffer(mp, item, bp, buf_f); -diff --git a/fs/xfs/xfs_qm.c b/fs/xfs/xfs_qm.c -index 348e4d2ed6e6..6d7d1de13403 100644 ---- a/fs/xfs/xfs_qm.c -+++ b/fs/xfs/xfs_qm.c -@@ -1176,6 +1176,12 @@ xfs_qm_dqiter_bufs( - if (error) - break; - -+ /* -+ * A corrupt buffer might not have a verifier attached, so -+ * make sure we have the correct one attached before writeback -+ * occurs. -+ */ -+ bp->b_ops = &xfs_dquot_buf_ops; - xfs_qm_reset_dqcounts(mp, bp, firstid, type); - xfs_buf_delwri_queue(bp, buffer_list); - xfs_buf_relse(bp); -@@ -1261,7 +1267,7 @@ xfs_qm_dqiterate( - xfs_buf_readahead(mp->m_ddev_targp, - XFS_FSB_TO_DADDR(mp, rablkno), - mp->m_quotainfo->qi_dqchunklen, -- NULL); -+ &xfs_dquot_buf_ops); - rablkno++; - } - } -diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h -index 8256eb4ad057..e9c4f190ffae 100644 ---- a/include/acpi/acpi_bus.h -+++ b/include/acpi/acpi_bus.h -@@ -228,7 +228,6 @@ struct acpi_device_pnp { - acpi_device_name device_name; /* Driver-determined */ - acpi_device_class device_class; /* " */ - union acpi_object *str_obj; /* unicode string for _STR method */ -- unsigned long sun; /* _SUN */ - }; - - #define acpi_device_bid(d) ((d)->pnp.bus_id) -diff --git a/include/linux/capability.h b/include/linux/capability.h -index 84b13ad67c1c..aa93e5ef594c 100644 ---- a/include/linux/capability.h -+++ b/include/linux/capability.h -@@ -78,8 +78,11 @@ extern const kernel_cap_t __cap_init_eff_set; - # error Fix up hand-coded capability macro initializers - #else /* HAND-CODED capability initializers */ - -+#define CAP_LAST_U32 ((_KERNEL_CAPABILITY_U32S) - 1) -+#define CAP_LAST_U32_VALID_MASK (CAP_TO_MASK(CAP_LAST_CAP + 1) -1) -+ - # define CAP_EMPTY_SET ((kernel_cap_t){{ 0, 0 }}) --# define CAP_FULL_SET ((kernel_cap_t){{ ~0, ~0 }}) -+# define CAP_FULL_SET ((kernel_cap_t){{ ~0, CAP_LAST_U32_VALID_MASK }}) - # define CAP_FS_SET ((kernel_cap_t){{ CAP_FS_MASK_B0 \ - | CAP_TO_MASK(CAP_LINUX_IMMUTABLE), \ - CAP_FS_MASK_B1 } }) -diff --git a/include/linux/dcache.h b/include/linux/dcache.h -index bf72e9ac6de0..3b50cac7ccb3 100644 ---- a/include/linux/dcache.h -+++ b/include/linux/dcache.h -@@ -429,7 +429,7 @@ static inline unsigned __d_entry_type(const struct dentry *dentry) - return dentry->d_flags & DCACHE_ENTRY_TYPE; - } - --static inline bool d_is_directory(const struct dentry *dentry) -+static inline bool d_can_lookup(const struct dentry *dentry) - { - return __d_entry_type(dentry) == DCACHE_DIRECTORY_TYPE; - } -@@ -439,6 +439,11 @@ static inline bool d_is_autodir(const struct dentry *dentry) - return __d_entry_type(dentry) == DCACHE_AUTODIR_TYPE; - } - -+static inline bool d_is_dir(const struct dentry *dentry) -+{ -+ return d_can_lookup(dentry) || d_is_autodir(dentry); -+} -+ - static inline bool d_is_symlink(const struct dentry *dentry) - { - return __d_entry_type(dentry) == DCACHE_SYMLINK_TYPE; -diff --git a/include/linux/mount.h b/include/linux/mount.h -index 839bac270904..b0c1e6574e7f 100644 ---- a/include/linux/mount.h -+++ b/include/linux/mount.h -@@ -42,13 +42,20 @@ struct mnt_namespace; - * flag, consider how it interacts with shared mounts. - */ - #define MNT_SHARED_MASK (MNT_UNBINDABLE) --#define MNT_PROPAGATION_MASK (MNT_SHARED | MNT_UNBINDABLE) -+#define MNT_USER_SETTABLE_MASK (MNT_NOSUID | MNT_NODEV | MNT_NOEXEC \ -+ | MNT_NOATIME | MNT_NODIRATIME | MNT_RELATIME \ -+ | MNT_READONLY) -+#define MNT_ATIME_MASK (MNT_NOATIME | MNT_NODIRATIME | MNT_RELATIME ) - - #define MNT_INTERNAL_FLAGS (MNT_SHARED | MNT_WRITE_HOLD | MNT_INTERNAL | \ - MNT_DOOMED | MNT_SYNC_UMOUNT | MNT_MARKED) - - #define MNT_INTERNAL 0x4000 - -+#define MNT_LOCK_ATIME 0x040000 -+#define MNT_LOCK_NOEXEC 0x080000 -+#define MNT_LOCK_NOSUID 0x100000 -+#define MNT_LOCK_NODEV 0x200000 - #define MNT_LOCK_READONLY 0x400000 - #define MNT_LOCKED 0x800000 - #define MNT_DOOMED 0x1000000 -diff --git a/include/linux/tpm.h b/include/linux/tpm.h -index fff1d0976f80..8350c538b486 100644 ---- a/include/linux/tpm.h -+++ b/include/linux/tpm.h -@@ -39,6 +39,9 @@ struct tpm_class_ops { - int (*send) (struct tpm_chip *chip, u8 *buf, size_t len); - void (*cancel) (struct tpm_chip *chip); - u8 (*status) (struct tpm_chip *chip); -+ bool (*update_timeouts)(struct tpm_chip *chip, -+ unsigned long *timeout_cap); -+ - }; - - #if defined(CONFIG_TCG_TPM) || defined(CONFIG_TCG_TPM_MODULE) -diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h -index b4f1effc9216..409fafb63f63 100644 ---- a/include/scsi/scsi_device.h -+++ b/include/scsi/scsi_device.h -@@ -149,6 +149,7 @@ struct scsi_device { - unsigned skip_ms_page_8:1; /* do not use MODE SENSE page 0x08 */ - unsigned skip_ms_page_3f:1; /* do not use MODE SENSE page 0x3f */ - unsigned skip_vpd_pages:1; /* do not read VPD pages */ -+ unsigned try_vpd_pages:1; /* attempt to read VPD pages */ - unsigned use_192_bytes_for_3f:1; /* ask for 192 bytes from page 0x3f */ - unsigned no_start_on_add:1; /* do not issue start on add */ - unsigned allow_restart:1; /* issue START_UNIT in error handler */ -diff --git a/include/scsi/scsi_devinfo.h b/include/scsi/scsi_devinfo.h -index 447d2d7466fc..183eaab7c380 100644 ---- a/include/scsi/scsi_devinfo.h -+++ b/include/scsi/scsi_devinfo.h -@@ -32,4 +32,9 @@ - #define BLIST_ATTACH_PQ3 0x1000000 /* Scan: Attach to PQ3 devices */ - #define BLIST_NO_DIF 0x2000000 /* Disable T10 PI (DIF) */ - #define BLIST_SKIP_VPD_PAGES 0x4000000 /* Ignore SBC-3 VPD pages */ -+#define BLIST_SCSI3LUN 0x8000000 /* Scan more than 256 LUNs -+ for sequential scan */ -+#define BLIST_TRY_VPD_PAGES 0x10000000 /* Attempt to read VPD pages */ -+#define BLIST_NO_RSOC 0x20000000 /* don't try to issue RSOC */ -+ - #endif -diff --git a/include/uapi/rdma/rdma_user_cm.h b/include/uapi/rdma/rdma_user_cm.h -index 99b80abf360a..3066718eb120 100644 ---- a/include/uapi/rdma/rdma_user_cm.h -+++ b/include/uapi/rdma/rdma_user_cm.h -@@ -34,6 +34,7 @@ - #define RDMA_USER_CM_H - - #include <linux/types.h> -+#include <linux/socket.h> - #include <linux/in6.h> - #include <rdma/ib_user_verbs.h> - #include <rdma/ib_user_sa.h> -diff --git a/kernel/audit.c b/kernel/audit.c -index 0c9dc860cc15..2c0ecd1753de 100644 ---- a/kernel/audit.c -+++ b/kernel/audit.c -@@ -1628,7 +1628,7 @@ void audit_log_cap(struct audit_buffer *ab, char *prefix, kernel_cap_t *cap) - audit_log_format(ab, " %s=", prefix); - CAP_FOR_EACH_U32(i) { - audit_log_format(ab, "%08x", -- cap->cap[(_KERNEL_CAPABILITY_U32S-1) - i]); -+ cap->cap[CAP_LAST_U32 - i]); - } - } - -diff --git a/kernel/capability.c b/kernel/capability.c -index 1191a44786df..00adb2193d01 100644 ---- a/kernel/capability.c -+++ b/kernel/capability.c -@@ -268,6 +268,10 @@ SYSCALL_DEFINE2(capset, cap_user_header_t, header, const cap_user_data_t, data) - i++; - } - -+ effective.cap[CAP_LAST_U32] &= CAP_LAST_U32_VALID_MASK; -+ permitted.cap[CAP_LAST_U32] &= CAP_LAST_U32_VALID_MASK; -+ inheritable.cap[CAP_LAST_U32] &= CAP_LAST_U32_VALID_MASK; -+ - new = prepare_creds(); - if (!new) - return -ENOMEM; -diff --git a/kernel/smp.c b/kernel/smp.c -index ffee35bef179..ff87d4479558 100644 ---- a/kernel/smp.c -+++ b/kernel/smp.c -@@ -617,7 +617,7 @@ void on_each_cpu_cond(bool (*cond_func)(int cpu, void *info), - if (cond_func(cpu, info)) { - ret = smp_call_function_single(cpu, func, - info, wait); -- WARN_ON_ONCE(!ret); -+ WARN_ON_ONCE(ret); - } - preempt_enable(); - } -diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c -index 0954450df7dc..a53f1bbc546b 100644 ---- a/kernel/trace/ring_buffer.c -+++ b/kernel/trace/ring_buffer.c -@@ -1981,7 +1981,7 @@ rb_add_time_stamp(struct ring_buffer_event *event, u64 delta) - - /** - * rb_update_event - update event type and data -- * @event: the even to update -+ * @event: the event to update - * @type: the type of event - * @length: the size of the event field in the ring buffer - * -@@ -3354,21 +3354,16 @@ static void rb_iter_reset(struct ring_buffer_iter *iter) - struct ring_buffer_per_cpu *cpu_buffer = iter->cpu_buffer; - - /* Iterator usage is expected to have record disabled */ -- if (list_empty(&cpu_buffer->reader_page->list)) { -- iter->head_page = rb_set_head_page(cpu_buffer); -- if (unlikely(!iter->head_page)) -- return; -- iter->head = iter->head_page->read; -- } else { -- iter->head_page = cpu_buffer->reader_page; -- iter->head = cpu_buffer->reader_page->read; -- } -+ iter->head_page = cpu_buffer->reader_page; -+ iter->head = cpu_buffer->reader_page->read; -+ -+ iter->cache_reader_page = iter->head_page; -+ iter->cache_read = iter->head; -+ - if (iter->head) - iter->read_stamp = cpu_buffer->read_stamp; - else - iter->read_stamp = iter->head_page->page->time_stamp; -- iter->cache_reader_page = cpu_buffer->reader_page; -- iter->cache_read = cpu_buffer->read; - } - - /** -@@ -3761,12 +3756,14 @@ rb_iter_peek(struct ring_buffer_iter *iter, u64 *ts) - return NULL; - - /* -- * We repeat when a time extend is encountered. -- * Since the time extend is always attached to a data event, -- * we should never loop more than once. -- * (We never hit the following condition more than twice). -+ * We repeat when a time extend is encountered or we hit -+ * the end of the page. Since the time extend is always attached -+ * to a data event, we should never loop more than three times. -+ * Once for going to next page, once on time extend, and -+ * finally once to get the event. -+ * (We never hit the following condition more than thrice). - */ -- if (RB_WARN_ON(cpu_buffer, ++nr_loops > 2)) -+ if (RB_WARN_ON(cpu_buffer, ++nr_loops > 3)) - return NULL; - - if (rb_per_cpu_empty(cpu_buffer)) -diff --git a/lib/assoc_array.c b/lib/assoc_array.c -index c0b1007011e1..2404d03e251a 100644 ---- a/lib/assoc_array.c -+++ b/lib/assoc_array.c -@@ -1723,11 +1723,13 @@ ascend_old_tree: - shortcut = assoc_array_ptr_to_shortcut(ptr); - slot = shortcut->parent_slot; - cursor = shortcut->back_pointer; -+ if (!cursor) -+ goto gc_complete; - } else { - slot = node->parent_slot; - cursor = ptr; - } -- BUG_ON(!ptr); -+ BUG_ON(!cursor); - node = assoc_array_ptr_to_node(cursor); - slot++; - goto continue_node; -@@ -1735,7 +1737,7 @@ ascend_old_tree: - gc_complete: - edit->set[0].to = new_root; - assoc_array_apply_edit(edit); -- edit->array->nr_leaves_on_tree = nr_leaves_on_tree; -+ array->nr_leaves_on_tree = nr_leaves_on_tree; - return 0; - - enomem: -diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c -index 27ae84154586..06a7a769737f 100644 ---- a/net/bluetooth/l2cap_sock.c -+++ b/net/bluetooth/l2cap_sock.c -@@ -1112,7 +1112,8 @@ static int l2cap_sock_shutdown(struct socket *sock, int how) - l2cap_chan_close(chan, 0); - lock_sock(sk); - -- if (sock_flag(sk, SOCK_LINGER) && sk->sk_lingertime) -+ if (sock_flag(sk, SOCK_LINGER) && sk->sk_lingertime && -+ !(current->flags & PF_EXITING)) - err = bt_sock_wait_state(sk, BT_CLOSED, - sk->sk_lingertime); - } -diff --git a/net/bluetooth/rfcomm/core.c b/net/bluetooth/rfcomm/core.c -index facd8a79c038..b08865111024 100644 ---- a/net/bluetooth/rfcomm/core.c -+++ b/net/bluetooth/rfcomm/core.c -@@ -1859,10 +1859,13 @@ static struct rfcomm_session *rfcomm_process_rx(struct rfcomm_session *s) - /* Get data directly from socket receive queue without copying it. */ - while ((skb = skb_dequeue(&sk->sk_receive_queue))) { - skb_orphan(skb); -- if (!skb_linearize(skb)) -+ if (!skb_linearize(skb)) { - s = rfcomm_recv_frame(s, skb); -- else -+ if (!s) -+ break; -+ } else { - kfree_skb(skb); -+ } - } - - if (s && (sk->sk_state == BT_CLOSED)) -diff --git a/net/bluetooth/rfcomm/sock.c b/net/bluetooth/rfcomm/sock.c -index 3c2d3e4aa2f5..a0050de6f1f1 100644 ---- a/net/bluetooth/rfcomm/sock.c -+++ b/net/bluetooth/rfcomm/sock.c -@@ -898,7 +898,8 @@ static int rfcomm_sock_shutdown(struct socket *sock, int how) - sk->sk_shutdown = SHUTDOWN_MASK; - __rfcomm_sock_close(sk); - -- if (sock_flag(sk, SOCK_LINGER) && sk->sk_lingertime) -+ if (sock_flag(sk, SOCK_LINGER) && sk->sk_lingertime && -+ !(current->flags & PF_EXITING)) - err = bt_sock_wait_state(sk, BT_CLOSED, sk->sk_lingertime); - } - release_sock(sk); -diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c -index 24fa3964b3c8..316dd4e0af39 100644 ---- a/net/bluetooth/sco.c -+++ b/net/bluetooth/sco.c -@@ -909,7 +909,8 @@ static int sco_sock_shutdown(struct socket *sock, int how) - sco_sock_clear_timer(sk); - __sco_sock_close(sk); - -- if (sock_flag(sk, SOCK_LINGER) && sk->sk_lingertime) -+ if (sock_flag(sk, SOCK_LINGER) && sk->sk_lingertime && -+ !(current->flags & PF_EXITING)) - err = bt_sock_wait_state(sk, BT_CLOSED, - sk->sk_lingertime); - } -@@ -929,7 +930,8 @@ static int sco_sock_release(struct socket *sock) - - sco_sock_close(sk); - -- if (sock_flag(sk, SOCK_LINGER) && sk->sk_lingertime) { -+ if (sock_flag(sk, SOCK_LINGER) && sk->sk_lingertime && -+ !(current->flags & PF_EXITING)) { - lock_sock(sk); - err = bt_sock_wait_state(sk, BT_CLOSED, sk->sk_lingertime); - release_sock(sk); -diff --git a/net/ceph/auth_x.c b/net/ceph/auth_x.c -index 96238ba95f2b..de6662b14e1f 100644 ---- a/net/ceph/auth_x.c -+++ b/net/ceph/auth_x.c -@@ -13,8 +13,6 @@ - #include "auth_x.h" - #include "auth_x_protocol.h" - --#define TEMP_TICKET_BUF_LEN 256 -- - static void ceph_x_validate_tickets(struct ceph_auth_client *ac, int *pneed); - - static int ceph_x_is_authenticated(struct ceph_auth_client *ac) -@@ -64,7 +62,7 @@ static int ceph_x_encrypt(struct ceph_crypto_key *secret, - } - - static int ceph_x_decrypt(struct ceph_crypto_key *secret, -- void **p, void *end, void *obuf, size_t olen) -+ void **p, void *end, void **obuf, size_t olen) - { - struct ceph_x_encrypt_header head; - size_t head_len = sizeof(head); -@@ -75,8 +73,14 @@ static int ceph_x_decrypt(struct ceph_crypto_key *secret, - return -EINVAL; - - dout("ceph_x_decrypt len %d\n", len); -- ret = ceph_decrypt2(secret, &head, &head_len, obuf, &olen, -- *p, len); -+ if (*obuf == NULL) { -+ *obuf = kmalloc(len, GFP_NOFS); -+ if (!*obuf) -+ return -ENOMEM; -+ olen = len; -+ } -+ -+ ret = ceph_decrypt2(secret, &head, &head_len, *obuf, &olen, *p, len); - if (ret) - return ret; - if (head.struct_v != 1 || le64_to_cpu(head.magic) != CEPHX_ENC_MAGIC) -@@ -129,139 +133,120 @@ static void remove_ticket_handler(struct ceph_auth_client *ac, - kfree(th); - } - --static int ceph_x_proc_ticket_reply(struct ceph_auth_client *ac, -- struct ceph_crypto_key *secret, -- void *buf, void *end) -+static int process_one_ticket(struct ceph_auth_client *ac, -+ struct ceph_crypto_key *secret, -+ void **p, void *end) - { - struct ceph_x_info *xi = ac->private; -- int num; -- void *p = buf; -+ int type; -+ u8 tkt_struct_v, blob_struct_v; -+ struct ceph_x_ticket_handler *th; -+ void *dbuf = NULL; -+ void *dp, *dend; -+ int dlen; -+ char is_enc; -+ struct timespec validity; -+ struct ceph_crypto_key old_key; -+ void *ticket_buf = NULL; -+ void *tp, *tpend; -+ struct ceph_timespec new_validity; -+ struct ceph_crypto_key new_session_key; -+ struct ceph_buffer *new_ticket_blob; -+ unsigned long new_expires, new_renew_after; -+ u64 new_secret_id; - int ret; -- char *dbuf; -- char *ticket_buf; -- u8 reply_struct_v; - -- dbuf = kmalloc(TEMP_TICKET_BUF_LEN, GFP_NOFS); -- if (!dbuf) -- return -ENOMEM; -+ ceph_decode_need(p, end, sizeof(u32) + 1, bad); - -- ret = -ENOMEM; -- ticket_buf = kmalloc(TEMP_TICKET_BUF_LEN, GFP_NOFS); -- if (!ticket_buf) -- goto out_dbuf; -+ type = ceph_decode_32(p); -+ dout(" ticket type %d %s\n", type, ceph_entity_type_name(type)); - -- ceph_decode_need(&p, end, 1 + sizeof(u32), bad); -- reply_struct_v = ceph_decode_8(&p); -- if (reply_struct_v != 1) -+ tkt_struct_v = ceph_decode_8(p); -+ if (tkt_struct_v != 1) - goto bad; -- num = ceph_decode_32(&p); -- dout("%d tickets\n", num); -- while (num--) { -- int type; -- u8 tkt_struct_v, blob_struct_v; -- struct ceph_x_ticket_handler *th; -- void *dp, *dend; -- int dlen; -- char is_enc; -- struct timespec validity; -- struct ceph_crypto_key old_key; -- void *tp, *tpend; -- struct ceph_timespec new_validity; -- struct ceph_crypto_key new_session_key; -- struct ceph_buffer *new_ticket_blob; -- unsigned long new_expires, new_renew_after; -- u64 new_secret_id; -- -- ceph_decode_need(&p, end, sizeof(u32) + 1, bad); -- -- type = ceph_decode_32(&p); -- dout(" ticket type %d %s\n", type, ceph_entity_type_name(type)); -- -- tkt_struct_v = ceph_decode_8(&p); -- if (tkt_struct_v != 1) -- goto bad; -- -- th = get_ticket_handler(ac, type); -- if (IS_ERR(th)) { -- ret = PTR_ERR(th); -- goto out; -- } - -- /* blob for me */ -- dlen = ceph_x_decrypt(secret, &p, end, dbuf, -- TEMP_TICKET_BUF_LEN); -- if (dlen <= 0) { -- ret = dlen; -- goto out; -- } -- dout(" decrypted %d bytes\n", dlen); -- dend = dbuf + dlen; -- dp = dbuf; -+ th = get_ticket_handler(ac, type); -+ if (IS_ERR(th)) { -+ ret = PTR_ERR(th); -+ goto out; -+ } - -- tkt_struct_v = ceph_decode_8(&dp); -- if (tkt_struct_v != 1) -- goto bad; -+ /* blob for me */ -+ dlen = ceph_x_decrypt(secret, p, end, &dbuf, 0); -+ if (dlen <= 0) { -+ ret = dlen; -+ goto out; -+ } -+ dout(" decrypted %d bytes\n", dlen); -+ dp = dbuf; -+ dend = dp + dlen; - -- memcpy(&old_key, &th->session_key, sizeof(old_key)); -- ret = ceph_crypto_key_decode(&new_session_key, &dp, dend); -- if (ret) -- goto out; -+ tkt_struct_v = ceph_decode_8(&dp); -+ if (tkt_struct_v != 1) -+ goto bad; - -- ceph_decode_copy(&dp, &new_validity, sizeof(new_validity)); -- ceph_decode_timespec(&validity, &new_validity); -- new_expires = get_seconds() + validity.tv_sec; -- new_renew_after = new_expires - (validity.tv_sec / 4); -- dout(" expires=%lu renew_after=%lu\n", new_expires, -- new_renew_after); -+ memcpy(&old_key, &th->session_key, sizeof(old_key)); -+ ret = ceph_crypto_key_decode(&new_session_key, &dp, dend); -+ if (ret) -+ goto out; - -- /* ticket blob for service */ -- ceph_decode_8_safe(&p, end, is_enc, bad); -- tp = ticket_buf; -- if (is_enc) { -- /* encrypted */ -- dout(" encrypted ticket\n"); -- dlen = ceph_x_decrypt(&old_key, &p, end, ticket_buf, -- TEMP_TICKET_BUF_LEN); -- if (dlen < 0) { -- ret = dlen; -- goto out; -- } -- dlen = ceph_decode_32(&tp); -- } else { -- /* unencrypted */ -- ceph_decode_32_safe(&p, end, dlen, bad); -- ceph_decode_need(&p, end, dlen, bad); -- ceph_decode_copy(&p, ticket_buf, dlen); -+ ceph_decode_copy(&dp, &new_validity, sizeof(new_validity)); -+ ceph_decode_timespec(&validity, &new_validity); -+ new_expires = get_seconds() + validity.tv_sec; -+ new_renew_after = new_expires - (validity.tv_sec / 4); -+ dout(" expires=%lu renew_after=%lu\n", new_expires, -+ new_renew_after); -+ -+ /* ticket blob for service */ -+ ceph_decode_8_safe(p, end, is_enc, bad); -+ if (is_enc) { -+ /* encrypted */ -+ dout(" encrypted ticket\n"); -+ dlen = ceph_x_decrypt(&old_key, p, end, &ticket_buf, 0); -+ if (dlen < 0) { -+ ret = dlen; -+ goto out; - } -- tpend = tp + dlen; -- dout(" ticket blob is %d bytes\n", dlen); -- ceph_decode_need(&tp, tpend, 1 + sizeof(u64), bad); -- blob_struct_v = ceph_decode_8(&tp); -- new_secret_id = ceph_decode_64(&tp); -- ret = ceph_decode_buffer(&new_ticket_blob, &tp, tpend); -- if (ret) -+ tp = ticket_buf; -+ dlen = ceph_decode_32(&tp); -+ } else { -+ /* unencrypted */ -+ ceph_decode_32_safe(p, end, dlen, bad); -+ ticket_buf = kmalloc(dlen, GFP_NOFS); -+ if (!ticket_buf) { -+ ret = -ENOMEM; - goto out; -- -- /* all is well, update our ticket */ -- ceph_crypto_key_destroy(&th->session_key); -- if (th->ticket_blob) -- ceph_buffer_put(th->ticket_blob); -- th->session_key = new_session_key; -- th->ticket_blob = new_ticket_blob; -- th->validity = new_validity; -- th->secret_id = new_secret_id; -- th->expires = new_expires; -- th->renew_after = new_renew_after; -- dout(" got ticket service %d (%s) secret_id %lld len %d\n", -- type, ceph_entity_type_name(type), th->secret_id, -- (int)th->ticket_blob->vec.iov_len); -- xi->have_keys |= th->service; -+ } -+ tp = ticket_buf; -+ ceph_decode_need(p, end, dlen, bad); -+ ceph_decode_copy(p, ticket_buf, dlen); - } -+ tpend = tp + dlen; -+ dout(" ticket blob is %d bytes\n", dlen); -+ ceph_decode_need(&tp, tpend, 1 + sizeof(u64), bad); -+ blob_struct_v = ceph_decode_8(&tp); -+ new_secret_id = ceph_decode_64(&tp); -+ ret = ceph_decode_buffer(&new_ticket_blob, &tp, tpend); -+ if (ret) -+ goto out; -+ -+ /* all is well, update our ticket */ -+ ceph_crypto_key_destroy(&th->session_key); -+ if (th->ticket_blob) -+ ceph_buffer_put(th->ticket_blob); -+ th->session_key = new_session_key; -+ th->ticket_blob = new_ticket_blob; -+ th->validity = new_validity; -+ th->secret_id = new_secret_id; -+ th->expires = new_expires; -+ th->renew_after = new_renew_after; -+ dout(" got ticket service %d (%s) secret_id %lld len %d\n", -+ type, ceph_entity_type_name(type), th->secret_id, -+ (int)th->ticket_blob->vec.iov_len); -+ xi->have_keys |= th->service; - -- ret = 0; - out: - kfree(ticket_buf); --out_dbuf: - kfree(dbuf); - return ret; - -@@ -270,6 +255,34 @@ bad: - goto out; - } - -+static int ceph_x_proc_ticket_reply(struct ceph_auth_client *ac, -+ struct ceph_crypto_key *secret, -+ void *buf, void *end) -+{ -+ void *p = buf; -+ u8 reply_struct_v; -+ u32 num; -+ int ret; -+ -+ ceph_decode_8_safe(&p, end, reply_struct_v, bad); -+ if (reply_struct_v != 1) -+ return -EINVAL; -+ -+ ceph_decode_32_safe(&p, end, num, bad); -+ dout("%d tickets\n", num); -+ -+ while (num--) { -+ ret = process_one_ticket(ac, secret, &p, end); -+ if (ret) -+ return ret; -+ } -+ -+ return 0; -+ -+bad: -+ return -EINVAL; -+} -+ - static int ceph_x_build_authorizer(struct ceph_auth_client *ac, - struct ceph_x_ticket_handler *th, - struct ceph_x_authorizer *au) -@@ -583,13 +596,14 @@ static int ceph_x_verify_authorizer_reply(struct ceph_auth_client *ac, - struct ceph_x_ticket_handler *th; - int ret = 0; - struct ceph_x_authorize_reply reply; -+ void *preply = &reply; - void *p = au->reply_buf; - void *end = p + sizeof(au->reply_buf); - - th = get_ticket_handler(ac, au->service); - if (IS_ERR(th)) - return PTR_ERR(th); -- ret = ceph_x_decrypt(&th->session_key, &p, end, &reply, sizeof(reply)); -+ ret = ceph_x_decrypt(&th->session_key, &p, end, &preply, sizeof(reply)); - if (ret < 0) - return ret; - if (ret != sizeof(reply)) -diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c -index 988721a629eb..0a31298737ac 100644 ---- a/net/ceph/messenger.c -+++ b/net/ceph/messenger.c -@@ -900,7 +900,7 @@ static void ceph_msg_data_pages_cursor_init(struct ceph_msg_data_cursor *cursor, - BUG_ON(page_count > (int)USHRT_MAX); - cursor->page_count = (unsigned short)page_count; - BUG_ON(length > SIZE_MAX - cursor->page_offset); -- cursor->last_piece = (size_t)cursor->page_offset + length <= PAGE_SIZE; -+ cursor->last_piece = cursor->page_offset + cursor->resid <= PAGE_SIZE; - } - - static struct page * -diff --git a/net/ceph/mon_client.c b/net/ceph/mon_client.c -index 2ac9ef35110b..dbcbf5a4707f 100644 ---- a/net/ceph/mon_client.c -+++ b/net/ceph/mon_client.c -@@ -1041,7 +1041,15 @@ static struct ceph_msg *mon_alloc_msg(struct ceph_connection *con, - if (!m) { - pr_info("alloc_msg unknown type %d\n", type); - *skip = 1; -+ } else if (front_len > m->front_alloc_len) { -+ pr_warning("mon_alloc_msg front %d > prealloc %d (%u#%llu)\n", -+ front_len, m->front_alloc_len, -+ (unsigned int)con->peer_name.type, -+ le64_to_cpu(con->peer_name.num)); -+ ceph_msg_put(m); -+ m = ceph_msg_new(type, front_len, GFP_NOFS, false); - } -+ - return m; - } - -diff --git a/security/commoncap.c b/security/commoncap.c -index b9d613e0ef14..963dc5981661 100644 ---- a/security/commoncap.c -+++ b/security/commoncap.c -@@ -421,6 +421,9 @@ int get_vfs_caps_from_disk(const struct dentry *dentry, struct cpu_vfs_cap_data - cpu_caps->inheritable.cap[i] = le32_to_cpu(caps.data[i].inheritable); - } - -+ cpu_caps->permitted.cap[CAP_LAST_U32] &= CAP_LAST_U32_VALID_MASK; -+ cpu_caps->inheritable.cap[CAP_LAST_U32] &= CAP_LAST_U32_VALID_MASK; -+ - return 0; - } - -diff --git a/sound/soc/blackfin/bf5xx-i2s-pcm.c b/sound/soc/blackfin/bf5xx-i2s-pcm.c -index a3881c4381c9..bcf591373a7a 100644 ---- a/sound/soc/blackfin/bf5xx-i2s-pcm.c -+++ b/sound/soc/blackfin/bf5xx-i2s-pcm.c -@@ -290,19 +290,19 @@ static int bf5xx_pcm_silence(struct snd_pcm_substream *substream, - unsigned int sample_size = runtime->sample_bits / 8; - void *buf = runtime->dma_area; - struct bf5xx_i2s_pcm_data *dma_data; -- unsigned int offset, size; -+ unsigned int offset, samples; - - dma_data = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream); - - if (dma_data->tdm_mode) { - offset = pos * 8 * sample_size; -- size = count * 8 * sample_size; -+ samples = count * 8; - } else { - offset = frames_to_bytes(runtime, pos); -- size = frames_to_bytes(runtime, count); -+ samples = count * runtime->channels; - } - -- snd_pcm_format_set_silence(runtime->format, buf + offset, size); -+ snd_pcm_format_set_silence(runtime->format, buf + offset, samples); - - return 0; - } -diff --git a/sound/soc/codecs/adau1701.c b/sound/soc/codecs/adau1701.c -index d71c59cf7bdd..370b742117ef 100644 ---- a/sound/soc/codecs/adau1701.c -+++ b/sound/soc/codecs/adau1701.c -@@ -230,8 +230,10 @@ static int adau1701_reg_read(void *context, unsigned int reg, - - *value = 0; - -- for (i = 0; i < size; i++) -- *value |= recv_buf[i] << (i * 8); -+ for (i = 0; i < size; i++) { -+ *value <<= 8; -+ *value |= recv_buf[i]; -+ } - - return 0; - } -diff --git a/sound/soc/codecs/max98090.c b/sound/soc/codecs/max98090.c -index b3f7c9026a29..ddfb0fddd030 100644 ---- a/sound/soc/codecs/max98090.c -+++ b/sound/soc/codecs/max98090.c -@@ -2250,7 +2250,7 @@ static int max98090_probe(struct snd_soc_codec *codec) - /* Register for interrupts */ - dev_dbg(codec->dev, "irq = %d\n", max98090->irq); - -- ret = request_threaded_irq(max98090->irq, NULL, -+ ret = devm_request_threaded_irq(codec->dev, max98090->irq, NULL, - max98090_interrupt, IRQF_TRIGGER_FALLING | IRQF_ONESHOT, - "max98090_interrupt", codec); - if (ret < 0) { -diff --git a/sound/soc/codecs/rt5640.c b/sound/soc/codecs/rt5640.c -index 886924934aa5..5cb515b08a32 100644 ---- a/sound/soc/codecs/rt5640.c -+++ b/sound/soc/codecs/rt5640.c -@@ -2071,6 +2071,7 @@ static struct snd_soc_codec_driver soc_codec_dev_rt5640 = { - static const struct regmap_config rt5640_regmap = { - .reg_bits = 8, - .val_bits = 16, -+ .use_single_rw = true, - - .max_register = RT5640_VENDOR_ID2 + 1 + (ARRAY_SIZE(rt5640_ranges) * - RT5640_PR_SPACING), -diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c -index adb72063d44e..d98e52f647d2 100644 ---- a/sound/soc/codecs/wm8994.c -+++ b/sound/soc/codecs/wm8994.c -@@ -3497,6 +3497,7 @@ static irqreturn_t wm8994_mic_irq(int irq, void *data) - return IRQ_HANDLED; - } - -+/* Should be called with accdet_lock held */ - static void wm1811_micd_stop(struct snd_soc_codec *codec) - { - struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); -@@ -3504,14 +3505,10 @@ static void wm1811_micd_stop(struct snd_soc_codec *codec) - if (!wm8994->jackdet) - return; - -- mutex_lock(&wm8994->accdet_lock); -- - snd_soc_update_bits(codec, WM8958_MIC_DETECT_1, WM8958_MICD_ENA, 0); - - wm1811_jackdet_set_mode(codec, WM1811_JACKDET_MODE_JACK); - -- mutex_unlock(&wm8994->accdet_lock); -- - if (wm8994->wm8994->pdata.jd_ext_cap) - snd_soc_dapm_disable_pin(&codec->dapm, - "MICBIAS2"); -@@ -3552,10 +3549,10 @@ static void wm8958_open_circuit_work(struct work_struct *work) - open_circuit_work.work); - struct device *dev = wm8994->wm8994->dev; - -- wm1811_micd_stop(wm8994->hubs.codec); -- - mutex_lock(&wm8994->accdet_lock); - -+ wm1811_micd_stop(wm8994->hubs.codec); -+ - dev_dbg(dev, "Reporting open circuit\n"); - - wm8994->jack_mic = false; -diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c -index 444626fcab40..53c03aff762e 100644 ---- a/sound/soc/codecs/wm_adsp.c -+++ b/sound/soc/codecs/wm_adsp.c -@@ -1745,3 +1745,5 @@ int wm_adsp2_init(struct wm_adsp *adsp, bool dvfs) - return 0; - } - EXPORT_SYMBOL_GPL(wm_adsp2_init); -+ -+MODULE_LICENSE("GPL v2"); -diff --git a/sound/soc/pxa/pxa-ssp.c b/sound/soc/pxa/pxa-ssp.c -index a3119a00d8fa..6c6b35e471c8 100644 ---- a/sound/soc/pxa/pxa-ssp.c -+++ b/sound/soc/pxa/pxa-ssp.c -@@ -725,7 +725,8 @@ static int pxa_ssp_probe(struct snd_soc_dai *dai) - ssp_handle = of_parse_phandle(dev->of_node, "port", 0); - if (!ssp_handle) { - dev_err(dev, "unable to get 'port' phandle\n"); -- return -ENODEV; -+ ret = -ENODEV; -+ goto err_priv; - } - - priv->ssp = pxa_ssp_request_of(ssp_handle, "SoC audio"); -@@ -766,9 +767,7 @@ static int pxa_ssp_remove(struct snd_soc_dai *dai) - SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_64000 | \ - SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000) - --#define PXA_SSP_FORMATS (SNDRV_PCM_FMTBIT_S16_LE |\ -- SNDRV_PCM_FMTBIT_S24_LE | \ -- SNDRV_PCM_FMTBIT_S32_LE) -+#define PXA_SSP_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S32_LE) - - static const struct snd_soc_dai_ops pxa_ssp_dai_ops = { - .startup = pxa_ssp_startup, -diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c -index 0a9b44c940ce..5dae66002a11 100644 ---- a/sound/soc/samsung/i2s.c -+++ b/sound/soc/samsung/i2s.c -@@ -915,11 +915,9 @@ static int i2s_suspend(struct snd_soc_dai *dai) - { - struct i2s_dai *i2s = to_info(dai); - -- if (dai->active) { -- i2s->suspend_i2smod = readl(i2s->addr + I2SMOD); -- i2s->suspend_i2scon = readl(i2s->addr + I2SCON); -- i2s->suspend_i2spsr = readl(i2s->addr + I2SPSR); -- } -+ i2s->suspend_i2smod = readl(i2s->addr + I2SMOD); -+ i2s->suspend_i2scon = readl(i2s->addr + I2SCON); -+ i2s->suspend_i2spsr = readl(i2s->addr + I2SPSR); - - return 0; - } -@@ -928,11 +926,9 @@ static int i2s_resume(struct snd_soc_dai *dai) - { - struct i2s_dai *i2s = to_info(dai); - -- if (dai->active) { -- writel(i2s->suspend_i2scon, i2s->addr + I2SCON); -- writel(i2s->suspend_i2smod, i2s->addr + I2SMOD); -- writel(i2s->suspend_i2spsr, i2s->addr + I2SPSR); -- } -+ writel(i2s->suspend_i2scon, i2s->addr + I2SCON); -+ writel(i2s->suspend_i2smod, i2s->addr + I2SMOD); -+ writel(i2s->suspend_i2spsr, i2s->addr + I2SPSR); - - return 0; - } -diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c -index 47e1ce771e65..02733ded2cb1 100644 ---- a/sound/soc/soc-pcm.c -+++ b/sound/soc/soc-pcm.c -@@ -2011,6 +2011,7 @@ int soc_dpcm_runtime_update(struct snd_soc_card *card) - dpcm_be_disconnect(fe, SNDRV_PCM_STREAM_PLAYBACK); - } - -+ dpcm_path_put(&list); - capture: - /* skip if FE doesn't have capture capability */ - if (!fe->cpu_dai->driver->capture.channels_min) -diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile -index 32487ed18354..3d5979b23e50 100644 ---- a/tools/testing/selftests/Makefile -+++ b/tools/testing/selftests/Makefile -@@ -4,6 +4,7 @@ TARGETS += efivarfs - TARGETS += kcmp - TARGETS += memory-hotplug - TARGETS += mqueue -+TARGETS += mount - TARGETS += net - TARGETS += ptrace - TARGETS += timers -diff --git a/tools/testing/selftests/mount/Makefile b/tools/testing/selftests/mount/Makefile -new file mode 100644 -index 000000000000..337d853c2b72 ---- /dev/null -+++ b/tools/testing/selftests/mount/Makefile -@@ -0,0 +1,17 @@ -+# Makefile for mount selftests. -+ -+all: unprivileged-remount-test -+ -+unprivileged-remount-test: unprivileged-remount-test.c -+ gcc -Wall -O2 unprivileged-remount-test.c -o unprivileged-remount-test -+ -+# Allow specific tests to be selected. -+test_unprivileged_remount: unprivileged-remount-test -+ @if [ -f /proc/self/uid_map ] ; then ./unprivileged-remount-test ; fi -+ -+run_tests: all test_unprivileged_remount -+ -+clean: -+ rm -f unprivileged-remount-test -+ -+.PHONY: all test_unprivileged_remount -diff --git a/tools/testing/selftests/mount/unprivileged-remount-test.c b/tools/testing/selftests/mount/unprivileged-remount-test.c -new file mode 100644 -index 000000000000..1b3ff2fda4d0 ---- /dev/null -+++ b/tools/testing/selftests/mount/unprivileged-remount-test.c -@@ -0,0 +1,242 @@ -+#define _GNU_SOURCE -+#include <sched.h> -+#include <stdio.h> -+#include <errno.h> -+#include <string.h> -+#include <sys/types.h> -+#include <sys/mount.h> -+#include <sys/wait.h> -+#include <stdlib.h> -+#include <unistd.h> -+#include <fcntl.h> -+#include <grp.h> -+#include <stdbool.h> -+#include <stdarg.h> -+ -+#ifndef CLONE_NEWNS -+# define CLONE_NEWNS 0x00020000 -+#endif -+#ifndef CLONE_NEWUTS -+# define CLONE_NEWUTS 0x04000000 -+#endif -+#ifndef CLONE_NEWIPC -+# define CLONE_NEWIPC 0x08000000 -+#endif -+#ifndef CLONE_NEWNET -+# define CLONE_NEWNET 0x40000000 -+#endif -+#ifndef CLONE_NEWUSER -+# define CLONE_NEWUSER 0x10000000 -+#endif -+#ifndef CLONE_NEWPID -+# define CLONE_NEWPID 0x20000000 -+#endif -+ -+#ifndef MS_RELATIME -+#define MS_RELATIME (1 << 21) -+#endif -+#ifndef MS_STRICTATIME -+#define MS_STRICTATIME (1 << 24) -+#endif -+ -+static void die(char *fmt, ...) -+{ -+ va_list ap; -+ va_start(ap, fmt); -+ vfprintf(stderr, fmt, ap); -+ va_end(ap); -+ exit(EXIT_FAILURE); -+} -+ -+static void write_file(char *filename, char *fmt, ...) -+{ -+ char buf[4096]; -+ int fd; -+ ssize_t written; -+ int buf_len; -+ va_list ap; -+ -+ va_start(ap, fmt); -+ buf_len = vsnprintf(buf, sizeof(buf), fmt, ap); -+ va_end(ap); -+ if (buf_len < 0) { -+ die("vsnprintf failed: %s\n", -+ strerror(errno)); -+ } -+ if (buf_len >= sizeof(buf)) { -+ die("vsnprintf output truncated\n"); -+ } -+ -+ fd = open(filename, O_WRONLY); -+ if (fd < 0) { -+ die("open of %s failed: %s\n", -+ filename, strerror(errno)); -+ } -+ written = write(fd, buf, buf_len); -+ if (written != buf_len) { -+ if (written >= 0) { -+ die("short write to %s\n", filename); -+ } else { -+ die("write to %s failed: %s\n", -+ filename, strerror(errno)); -+ } -+ } -+ if (close(fd) != 0) { -+ die("close of %s failed: %s\n", -+ filename, strerror(errno)); -+ } -+} -+ -+static void create_and_enter_userns(void) -+{ -+ uid_t uid; -+ gid_t gid; -+ -+ uid = getuid(); -+ gid = getgid(); -+ -+ if (unshare(CLONE_NEWUSER) !=0) { -+ die("unshare(CLONE_NEWUSER) failed: %s\n", -+ strerror(errno)); -+ } -+ -+ write_file("/proc/self/uid_map", "0 %d 1", uid); -+ write_file("/proc/self/gid_map", "0 %d 1", gid); -+ -+ if (setgroups(0, NULL) != 0) { -+ die("setgroups failed: %s\n", -+ strerror(errno)); -+ } -+ if (setgid(0) != 0) { -+ die ("setgid(0) failed %s\n", -+ strerror(errno)); -+ } -+ if (setuid(0) != 0) { -+ die("setuid(0) failed %s\n", -+ strerror(errno)); -+ } -+} -+ -+static -+bool test_unpriv_remount(int mount_flags, int remount_flags, int invalid_flags) -+{ -+ pid_t child; -+ -+ child = fork(); -+ if (child == -1) { -+ die("fork failed: %s\n", -+ strerror(errno)); -+ } -+ if (child != 0) { /* parent */ -+ pid_t pid; -+ int status; -+ pid = waitpid(child, &status, 0); -+ if (pid == -1) { -+ die("waitpid failed: %s\n", -+ strerror(errno)); -+ } -+ if (pid != child) { -+ die("waited for %d got %d\n", -+ child, pid); -+ } -+ if (!WIFEXITED(status)) { -+ die("child did not terminate cleanly\n"); -+ } -+ return WEXITSTATUS(status) == EXIT_SUCCESS ? true : false; -+ } -+ -+ create_and_enter_userns(); -+ if (unshare(CLONE_NEWNS) != 0) { -+ die("unshare(CLONE_NEWNS) failed: %s\n", -+ strerror(errno)); -+ } -+ -+ if (mount("testing", "/tmp", "ramfs", mount_flags, NULL) != 0) { -+ die("mount of /tmp failed: %s\n", -+ strerror(errno)); -+ } -+ -+ create_and_enter_userns(); -+ -+ if (unshare(CLONE_NEWNS) != 0) { -+ die("unshare(CLONE_NEWNS) failed: %s\n", -+ strerror(errno)); -+ } -+ -+ if (mount("/tmp", "/tmp", "none", -+ MS_REMOUNT | MS_BIND | remount_flags, NULL) != 0) { -+ /* system("cat /proc/self/mounts"); */ -+ die("remount of /tmp failed: %s\n", -+ strerror(errno)); -+ } -+ -+ if (mount("/tmp", "/tmp", "none", -+ MS_REMOUNT | MS_BIND | invalid_flags, NULL) == 0) { -+ /* system("cat /proc/self/mounts"); */ -+ die("remount of /tmp with invalid flags " -+ "succeeded unexpectedly\n"); -+ } -+ exit(EXIT_SUCCESS); -+} -+ -+static bool test_unpriv_remount_simple(int mount_flags) -+{ -+ return test_unpriv_remount(mount_flags, mount_flags, 0); -+} -+ -+static bool test_unpriv_remount_atime(int mount_flags, int invalid_flags) -+{ -+ return test_unpriv_remount(mount_flags, mount_flags, invalid_flags); -+} -+ -+int main(int argc, char **argv) -+{ -+ if (!test_unpriv_remount_simple(MS_RDONLY|MS_NODEV)) { -+ die("MS_RDONLY malfunctions\n"); -+ } -+ if (!test_unpriv_remount_simple(MS_NODEV)) { -+ die("MS_NODEV malfunctions\n"); -+ } -+ if (!test_unpriv_remount_simple(MS_NOSUID|MS_NODEV)) { -+ die("MS_NOSUID malfunctions\n"); -+ } -+ if (!test_unpriv_remount_simple(MS_NOEXEC|MS_NODEV)) { -+ die("MS_NOEXEC malfunctions\n"); -+ } -+ if (!test_unpriv_remount_atime(MS_RELATIME|MS_NODEV, -+ MS_NOATIME|MS_NODEV)) -+ { -+ die("MS_RELATIME malfunctions\n"); -+ } -+ if (!test_unpriv_remount_atime(MS_STRICTATIME|MS_NODEV, -+ MS_NOATIME|MS_NODEV)) -+ { -+ die("MS_STRICTATIME malfunctions\n"); -+ } -+ if (!test_unpriv_remount_atime(MS_NOATIME|MS_NODEV, -+ MS_STRICTATIME|MS_NODEV)) -+ { -+ die("MS_RELATIME malfunctions\n"); -+ } -+ if (!test_unpriv_remount_atime(MS_RELATIME|MS_NODIRATIME|MS_NODEV, -+ MS_NOATIME|MS_NODEV)) -+ { -+ die("MS_RELATIME malfunctions\n"); -+ } -+ if (!test_unpriv_remount_atime(MS_STRICTATIME|MS_NODIRATIME|MS_NODEV, -+ MS_NOATIME|MS_NODEV)) -+ { -+ die("MS_RELATIME malfunctions\n"); -+ } -+ if (!test_unpriv_remount_atime(MS_NOATIME|MS_NODIRATIME|MS_NODEV, -+ MS_STRICTATIME|MS_NODEV)) -+ { -+ die("MS_RELATIME malfunctions\n"); -+ } -+ if (!test_unpriv_remount(MS_STRICTATIME|MS_NODEV, MS_NODEV, -+ MS_NOATIME|MS_NODEV)) -+ { -+ die("Default atime malfunctions\n"); -+ } -+ return EXIT_SUCCESS; -+} diff --git a/projects/imx6/patches/linux/linux-000-patch-3.14.19-20.patch b/projects/imx6/patches/linux/linux-000-patch-3.14.19-20.patch deleted file mode 100644 index e3560ed49fd..00000000000 --- a/projects/imx6/patches/linux/linux-000-patch-3.14.19-20.patch +++ /dev/null @@ -1,7387 +0,0 @@ -diff --git a/Documentation/devicetree/bindings/interrupt-controller/interrupts.txt b/Documentation/devicetree/bindings/interrupt-controller/interrupts.txt -index 1486497a24c1..ce6a1a072028 100644 ---- a/Documentation/devicetree/bindings/interrupt-controller/interrupts.txt -+++ b/Documentation/devicetree/bindings/interrupt-controller/interrupts.txt -@@ -4,11 +4,13 @@ Specifying interrupt information for devices - 1) Interrupt client nodes - ------------------------- - --Nodes that describe devices which generate interrupts must contain an either an --"interrupts" property or an "interrupts-extended" property. These properties --contain a list of interrupt specifiers, one per output interrupt. The format of --the interrupt specifier is determined by the interrupt controller to which the --interrupts are routed; see section 2 below for details. -+Nodes that describe devices which generate interrupts must contain an -+"interrupts" property, an "interrupts-extended" property, or both. If both are -+present, the latter should take precedence; the former may be provided simply -+for compatibility with software that does not recognize the latter. These -+properties contain a list of interrupt specifiers, one per output interrupt. The -+format of the interrupt specifier is determined by the interrupt controller to -+which the interrupts are routed; see section 2 below for details. - - Example: - interrupt-parent = <&intc1>; -diff --git a/Makefile b/Makefile -index b1746b486646..beb7e6f0803b 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,6 +1,6 @@ - VERSION = 3 - PATCHLEVEL = 14 --SUBLEVEL = 19 -+SUBLEVEL = 20 - EXTRAVERSION = - NAME = Remembering Coco - -diff --git a/arch/arm/boot/dts/dra7-evm.dts b/arch/arm/boot/dts/dra7-evm.dts -index 904dcf5973f3..9381754b35cc 100644 ---- a/arch/arm/boot/dts/dra7-evm.dts -+++ b/arch/arm/boot/dts/dra7-evm.dts -@@ -50,13 +50,13 @@ - - mcspi1_pins: pinmux_mcspi1_pins { - pinctrl-single,pins = < -- 0x3a4 (PIN_INPUT | MUX_MODE0) /* spi2_clk */ -- 0x3a8 (PIN_INPUT | MUX_MODE0) /* spi2_d1 */ -- 0x3ac (PIN_INPUT | MUX_MODE0) /* spi2_d0 */ -- 0x3b0 (PIN_INPUT_SLEW | MUX_MODE0) /* spi2_cs0 */ -- 0x3b4 (PIN_INPUT_SLEW | MUX_MODE0) /* spi2_cs1 */ -- 0x3b8 (PIN_INPUT_SLEW | MUX_MODE6) /* spi2_cs2 */ -- 0x3bc (PIN_INPUT_SLEW | MUX_MODE6) /* spi2_cs3 */ -+ 0x3a4 (PIN_INPUT | MUX_MODE0) /* spi1_sclk */ -+ 0x3a8 (PIN_INPUT | MUX_MODE0) /* spi1_d1 */ -+ 0x3ac (PIN_INPUT | MUX_MODE0) /* spi1_d0 */ -+ 0x3b0 (PIN_INPUT_SLEW | MUX_MODE0) /* spi1_cs0 */ -+ 0x3b4 (PIN_INPUT_SLEW | MUX_MODE0) /* spi1_cs1 */ -+ 0x3b8 (PIN_INPUT_SLEW | MUX_MODE6) /* spi1_cs2.hdmi1_hpd */ -+ 0x3bc (PIN_INPUT_SLEW | MUX_MODE6) /* spi1_cs3.hdmi1_cec */ - >; - }; - -diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi -index 1fd75aa4639d..767f0e376f4d 100644 ---- a/arch/arm/boot/dts/dra7.dtsi -+++ b/arch/arm/boot/dts/dra7.dtsi -@@ -178,7 +178,7 @@ - gpio-controller; - #gpio-cells = <2>; - interrupt-controller; -- #interrupt-cells = <1>; -+ #interrupt-cells = <2>; - }; - - gpio2: gpio@48055000 { -@@ -189,7 +189,7 @@ - gpio-controller; - #gpio-cells = <2>; - interrupt-controller; -- #interrupt-cells = <1>; -+ #interrupt-cells = <2>; - }; - - gpio3: gpio@48057000 { -@@ -200,7 +200,7 @@ - gpio-controller; - #gpio-cells = <2>; - interrupt-controller; -- #interrupt-cells = <1>; -+ #interrupt-cells = <2>; - }; - - gpio4: gpio@48059000 { -@@ -211,7 +211,7 @@ - gpio-controller; - #gpio-cells = <2>; - interrupt-controller; -- #interrupt-cells = <1>; -+ #interrupt-cells = <2>; - }; - - gpio5: gpio@4805b000 { -@@ -222,7 +222,7 @@ - gpio-controller; - #gpio-cells = <2>; - interrupt-controller; -- #interrupt-cells = <1>; -+ #interrupt-cells = <2>; - }; - - gpio6: gpio@4805d000 { -@@ -233,7 +233,7 @@ - gpio-controller; - #gpio-cells = <2>; - interrupt-controller; -- #interrupt-cells = <1>; -+ #interrupt-cells = <2>; - }; - - gpio7: gpio@48051000 { -@@ -244,7 +244,7 @@ - gpio-controller; - #gpio-cells = <2>; - interrupt-controller; -- #interrupt-cells = <1>; -+ #interrupt-cells = <2>; - }; - - gpio8: gpio@48053000 { -@@ -255,7 +255,7 @@ - gpio-controller; - #gpio-cells = <2>; - interrupt-controller; -- #interrupt-cells = <1>; -+ #interrupt-cells = <2>; - }; - - uart1: serial@4806a000 { -diff --git a/arch/arm/include/asm/tls.h b/arch/arm/include/asm/tls.h -index 83259b873333..5f833f7adba1 100644 ---- a/arch/arm/include/asm/tls.h -+++ b/arch/arm/include/asm/tls.h -@@ -1,6 +1,9 @@ - #ifndef __ASMARM_TLS_H - #define __ASMARM_TLS_H - -+#include <linux/compiler.h> -+#include <asm/thread_info.h> -+ - #ifdef __ASSEMBLY__ - #include <asm/asm-offsets.h> - .macro switch_tls_none, base, tp, tpuser, tmp1, tmp2 -@@ -50,6 +53,49 @@ - #endif - - #ifndef __ASSEMBLY__ -+ -+static inline void set_tls(unsigned long val) -+{ -+ struct thread_info *thread; -+ -+ thread = current_thread_info(); -+ -+ thread->tp_value[0] = val; -+ -+ /* -+ * This code runs with preemption enabled and therefore must -+ * be reentrant with respect to switch_tls. -+ * -+ * We need to ensure ordering between the shadow state and the -+ * hardware state, so that we don't corrupt the hardware state -+ * with a stale shadow state during context switch. -+ * -+ * If we're preempted here, switch_tls will load TPIDRURO from -+ * thread_info upon resuming execution and the following mcr -+ * is merely redundant. -+ */ -+ barrier(); -+ -+ if (!tls_emu) { -+ if (has_tls_reg) { -+ asm("mcr p15, 0, %0, c13, c0, 3" -+ : : "r" (val)); -+ } else { -+#ifdef CONFIG_KUSER_HELPERS -+ /* -+ * User space must never try to access this -+ * directly. Expect your app to break -+ * eventually if you do so. The user helper -+ * at 0xffff0fe0 must be used instead. (see -+ * entry-armv.S for details) -+ */ -+ *((unsigned int *)0xffff0ff0) = val; -+#endif -+ } -+ -+ } -+} -+ - static inline unsigned long get_tpuser(void) - { - unsigned long reg = 0; -@@ -59,5 +105,23 @@ static inline unsigned long get_tpuser(void) - - return reg; - } -+ -+static inline void set_tpuser(unsigned long val) -+{ -+ /* Since TPIDRURW is fully context-switched (unlike TPIDRURO), -+ * we need not update thread_info. -+ */ -+ if (has_tls_reg && !tls_emu) { -+ asm("mcr p15, 0, %0, c13, c0, 2" -+ : : "r" (val)); -+ } -+} -+ -+static inline void flush_tls(void) -+{ -+ set_tls(0); -+ set_tpuser(0); -+} -+ - #endif - #endif /* __ASMARM_TLS_H */ -diff --git a/arch/arm/kernel/irq.c b/arch/arm/kernel/irq.c -index 9723d17b8f38..1e782bdeee49 100644 ---- a/arch/arm/kernel/irq.c -+++ b/arch/arm/kernel/irq.c -@@ -163,7 +163,7 @@ static bool migrate_one_irq(struct irq_desc *desc) - c = irq_data_get_irq_chip(d); - if (!c->irq_set_affinity) - pr_debug("IRQ%u: unable to set affinity\n", d->irq); -- else if (c->irq_set_affinity(d, affinity, true) == IRQ_SET_MASK_OK && ret) -+ else if (c->irq_set_affinity(d, affinity, false) == IRQ_SET_MASK_OK && ret) - cpumask_copy(d->affinity, affinity); - - return ret; -diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c -index 92f7b15dd221..5f6e650ec9ab 100644 ---- a/arch/arm/kernel/process.c -+++ b/arch/arm/kernel/process.c -@@ -334,6 +334,8 @@ void flush_thread(void) - memset(&tsk->thread.debug, 0, sizeof(struct debug_info)); - memset(&thread->fpstate, 0, sizeof(union fp_state)); - -+ flush_tls(); -+ - thread_notify(THREAD_NOTIFY_FLUSH, thread); - } - -diff --git a/arch/arm/kernel/thumbee.c b/arch/arm/kernel/thumbee.c -index 7b8403b76666..80f0d69205e7 100644 ---- a/arch/arm/kernel/thumbee.c -+++ b/arch/arm/kernel/thumbee.c -@@ -45,7 +45,7 @@ static int thumbee_notifier(struct notifier_block *self, unsigned long cmd, void - - switch (cmd) { - case THREAD_NOTIFY_FLUSH: -- thread->thumbee_state = 0; -+ teehbr_write(0); - break; - case THREAD_NOTIFY_SWITCH: - current_thread_info()->thumbee_state = teehbr_read(); -diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c -index 172ee18ff124..9265b8bb529a 100644 ---- a/arch/arm/kernel/traps.c -+++ b/arch/arm/kernel/traps.c -@@ -578,7 +578,6 @@ do_cache_op(unsigned long start, unsigned long end, int flags) - #define NR(x) ((__ARM_NR_##x) - __ARM_NR_BASE) - asmlinkage int arm_syscall(int no, struct pt_regs *regs) - { -- struct thread_info *thread = current_thread_info(); - siginfo_t info; - - if ((no >> 16) != (__ARM_NR_BASE>> 16)) -@@ -629,21 +628,7 @@ asmlinkage int arm_syscall(int no, struct pt_regs *regs) - return regs->ARM_r0; - - case NR(set_tls): -- thread->tp_value[0] = regs->ARM_r0; -- if (tls_emu) -- return 0; -- if (has_tls_reg) { -- asm ("mcr p15, 0, %0, c13, c0, 3" -- : : "r" (regs->ARM_r0)); -- } else { -- /* -- * User space must never try to access this directly. -- * Expect your app to break eventually if you do so. -- * The user helper at 0xffff0fe0 must be used instead. -- * (see entry-armv.S for details) -- */ -- *((unsigned int *)0xffff0ff0) = regs->ARM_r0; -- } -+ set_tls(regs->ARM_r0); - return 0; - - #ifdef CONFIG_NEEDS_SYSCALL_FOR_CMPXCHG -diff --git a/arch/arm/kvm/handle_exit.c b/arch/arm/kvm/handle_exit.c -index 0de91fc6de0f..ec4fa868a7ba 100644 ---- a/arch/arm/kvm/handle_exit.c -+++ b/arch/arm/kvm/handle_exit.c -@@ -89,6 +89,8 @@ static int kvm_handle_wfx(struct kvm_vcpu *vcpu, struct kvm_run *run) - else - kvm_vcpu_block(vcpu); - -+ kvm_skip_instr(vcpu, kvm_vcpu_trap_il_is32bit(vcpu)); -+ - return 1; - } - -diff --git a/arch/arm/kvm/init.S b/arch/arm/kvm/init.S -index 1b9844d369cc..ee4f7447a1d3 100644 ---- a/arch/arm/kvm/init.S -+++ b/arch/arm/kvm/init.S -@@ -98,6 +98,10 @@ __do_hyp_init: - mrc p15, 0, r0, c10, c2, 1 - mcr p15, 4, r0, c10, c2, 1 - -+ @ Invalidate the stale TLBs from Bootloader -+ mcr p15, 4, r0, c8, c7, 0 @ TLBIALLH -+ dsb ish -+ - @ Set the HSCTLR to: - @ - ARM/THUMB exceptions: Kernel config (Thumb-2 kernel) - @ - Endianness: Kernel config -diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c -index c914b0052fb9..4551efd28f8d 100644 ---- a/arch/arm/mach-omap2/omap_hwmod.c -+++ b/arch/arm/mach-omap2/omap_hwmod.c -@@ -3349,6 +3349,9 @@ int __init omap_hwmod_register_links(struct omap_hwmod_ocp_if **ois) - if (!ois) - return 0; - -+ if (ois[0] == NULL) /* Empty list */ -+ return 0; -+ - if (!linkspace) { - if (_alloc_linkspace(ois)) { - pr_err("omap_hwmod: could not allocate link space\n"); -diff --git a/arch/arm/mach-omap2/omap_hwmod_7xx_data.c b/arch/arm/mach-omap2/omap_hwmod_7xx_data.c -index 810c205d668b..2e35ff99f60e 100644 ---- a/arch/arm/mach-omap2/omap_hwmod_7xx_data.c -+++ b/arch/arm/mach-omap2/omap_hwmod_7xx_data.c -@@ -35,6 +35,7 @@ - #include "i2c.h" - #include "mmc.h" - #include "wd_timer.h" -+#include "soc.h" - - /* Base offset for all DRA7XX interrupts external to MPUSS */ - #define DRA7XX_IRQ_GIC_START 32 -@@ -2707,7 +2708,6 @@ static struct omap_hwmod_ocp_if *dra7xx_hwmod_ocp_ifs[] __initdata = { - &dra7xx_l4_per3__usb_otg_ss1, - &dra7xx_l4_per3__usb_otg_ss2, - &dra7xx_l4_per3__usb_otg_ss3, -- &dra7xx_l4_per3__usb_otg_ss4, - &dra7xx_l3_main_1__vcp1, - &dra7xx_l4_per2__vcp1, - &dra7xx_l3_main_1__vcp2, -@@ -2716,8 +2716,26 @@ static struct omap_hwmod_ocp_if *dra7xx_hwmod_ocp_ifs[] __initdata = { - NULL, - }; - -+static struct omap_hwmod_ocp_if *dra74x_hwmod_ocp_ifs[] __initdata = { -+ &dra7xx_l4_per3__usb_otg_ss4, -+ NULL, -+}; -+ -+static struct omap_hwmod_ocp_if *dra72x_hwmod_ocp_ifs[] __initdata = { -+ NULL, -+}; -+ - int __init dra7xx_hwmod_init(void) - { -+ int ret; -+ - omap_hwmod_init(); -- return omap_hwmod_register_links(dra7xx_hwmod_ocp_ifs); -+ ret = omap_hwmod_register_links(dra7xx_hwmod_ocp_ifs); -+ -+ if (!ret && soc_is_dra74x()) -+ return omap_hwmod_register_links(dra74x_hwmod_ocp_ifs); -+ else if (!ret && soc_is_dra72x()) -+ return omap_hwmod_register_links(dra72x_hwmod_ocp_ifs); -+ -+ return ret; - } -diff --git a/arch/arm/mach-omap2/soc.h b/arch/arm/mach-omap2/soc.h -index 076bd90a6ce0..8a9be09d9f38 100644 ---- a/arch/arm/mach-omap2/soc.h -+++ b/arch/arm/mach-omap2/soc.h -@@ -245,6 +245,8 @@ IS_AM_SUBCLASS(437x, 0x437) - #define soc_is_omap54xx() 0 - #define soc_is_omap543x() 0 - #define soc_is_dra7xx() 0 -+#define soc_is_dra74x() 0 -+#define soc_is_dra72x() 0 - - #if defined(MULTI_OMAP2) - # if defined(CONFIG_ARCH_OMAP2) -@@ -393,7 +395,11 @@ IS_OMAP_TYPE(3430, 0x3430) - - #if defined(CONFIG_SOC_DRA7XX) - #undef soc_is_dra7xx -+#undef soc_is_dra74x -+#undef soc_is_dra72x - #define soc_is_dra7xx() (of_machine_is_compatible("ti,dra7")) -+#define soc_is_dra74x() (of_machine_is_compatible("ti,dra74")) -+#define soc_is_dra72x() (of_machine_is_compatible("ti,dra72")) - #endif - - /* Various silicon revisions for omap2 */ -diff --git a/arch/arm/mm/abort-ev6.S b/arch/arm/mm/abort-ev6.S -index 3815a8262af0..8c48c5c22a33 100644 ---- a/arch/arm/mm/abort-ev6.S -+++ b/arch/arm/mm/abort-ev6.S -@@ -17,12 +17,6 @@ - */ - .align 5 - ENTRY(v6_early_abort) --#ifdef CONFIG_CPU_V6 -- sub r1, sp, #4 @ Get unused stack location -- strex r0, r1, [r1] @ Clear the exclusive monitor --#elif defined(CONFIG_CPU_32v6K) -- clrex --#endif - mrc p15, 0, r1, c5, c0, 0 @ get FSR - mrc p15, 0, r0, c6, c0, 0 @ get FAR - /* -diff --git a/arch/arm/mm/abort-ev7.S b/arch/arm/mm/abort-ev7.S -index 703375277ba6..4812ad054214 100644 ---- a/arch/arm/mm/abort-ev7.S -+++ b/arch/arm/mm/abort-ev7.S -@@ -13,12 +13,6 @@ - */ - .align 5 - ENTRY(v7_early_abort) -- /* -- * The effect of data aborts on on the exclusive access monitor are -- * UNPREDICTABLE. Do a CLREX to clear the state -- */ -- clrex -- - mrc p15, 0, r1, c5, c0, 0 @ get FSR - mrc p15, 0, r0, c6, c0, 0 @ get FAR - -diff --git a/arch/arm/mm/alignment.c b/arch/arm/mm/alignment.c -index 924036473b16..d301662b7b32 100644 ---- a/arch/arm/mm/alignment.c -+++ b/arch/arm/mm/alignment.c -@@ -40,6 +40,7 @@ - * This code is not portable to processors with late data abort handling. - */ - #define CODING_BITS(i) (i & 0x0e000000) -+#define COND_BITS(i) (i & 0xf0000000) - - #define LDST_I_BIT(i) (i & (1 << 26)) /* Immediate constant */ - #define LDST_P_BIT(i) (i & (1 << 24)) /* Preindex */ -@@ -817,6 +818,8 @@ do_alignment(unsigned long addr, unsigned int fsr, struct pt_regs *regs) - break; - - case 0x04000000: /* ldr or str immediate */ -+ if (COND_BITS(instr) == 0xf0000000) /* NEON VLDn, VSTn */ -+ goto bad; - offset.un = OFFSET_BITS(instr); - handler = do_alignment_ldrstr; - break; -diff --git a/arch/arm64/include/asm/hw_breakpoint.h b/arch/arm64/include/asm/hw_breakpoint.h -index d064047612b1..52b484b6aa1a 100644 ---- a/arch/arm64/include/asm/hw_breakpoint.h -+++ b/arch/arm64/include/asm/hw_breakpoint.h -@@ -79,7 +79,6 @@ static inline void decode_ctrl_reg(u32 reg, - */ - #define ARM_MAX_BRP 16 - #define ARM_MAX_WRP 16 --#define ARM_MAX_HBP_SLOTS (ARM_MAX_BRP + ARM_MAX_WRP) - - /* Virtual debug register bases. */ - #define AARCH64_DBG_REG_BVR 0 -diff --git a/arch/arm64/kernel/irq.c b/arch/arm64/kernel/irq.c -index 0f08dfd69ebc..dfa6e3e74fdd 100644 ---- a/arch/arm64/kernel/irq.c -+++ b/arch/arm64/kernel/irq.c -@@ -97,19 +97,15 @@ static bool migrate_one_irq(struct irq_desc *desc) - if (irqd_is_per_cpu(d) || !cpumask_test_cpu(smp_processor_id(), affinity)) - return false; - -- if (cpumask_any_and(affinity, cpu_online_mask) >= nr_cpu_ids) -+ if (cpumask_any_and(affinity, cpu_online_mask) >= nr_cpu_ids) { -+ affinity = cpu_online_mask; - ret = true; -+ } - -- /* -- * when using forced irq_set_affinity we must ensure that the cpu -- * being offlined is not present in the affinity mask, it may be -- * selected as the target CPU otherwise -- */ -- affinity = cpu_online_mask; - c = irq_data_get_irq_chip(d); - if (!c->irq_set_affinity) - pr_debug("IRQ%u: unable to set affinity\n", d->irq); -- else if (c->irq_set_affinity(d, affinity, true) == IRQ_SET_MASK_OK && ret) -+ else if (c->irq_set_affinity(d, affinity, false) == IRQ_SET_MASK_OK && ret) - cpumask_copy(d->affinity, affinity); - - return ret; -diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c -index 1c0a9be2ffa8..6e7e579c629d 100644 ---- a/arch/arm64/kernel/process.c -+++ b/arch/arm64/kernel/process.c -@@ -187,9 +187,27 @@ void exit_thread(void) - { - } - -+static void tls_thread_flush(void) -+{ -+ asm ("msr tpidr_el0, xzr"); -+ -+ if (is_compat_task()) { -+ current->thread.tp_value = 0; -+ -+ /* -+ * We need to ensure ordering between the shadow state and the -+ * hardware state, so that we don't corrupt the hardware state -+ * with a stale shadow state during context switch. -+ */ -+ barrier(); -+ asm ("msr tpidrro_el0, xzr"); -+ } -+} -+ - void flush_thread(void) - { - fpsimd_flush_thread(); -+ tls_thread_flush(); - flush_ptrace_hw_breakpoint(current); - } - -diff --git a/arch/arm64/kernel/ptrace.c b/arch/arm64/kernel/ptrace.c -index 7a50b86464cc..b1269dac1289 100644 ---- a/arch/arm64/kernel/ptrace.c -+++ b/arch/arm64/kernel/ptrace.c -@@ -81,7 +81,8 @@ static void ptrace_hbptriggered(struct perf_event *bp, - break; - } - } -- for (i = ARM_MAX_BRP; i < ARM_MAX_HBP_SLOTS && !bp; ++i) { -+ -+ for (i = 0; i < ARM_MAX_WRP; ++i) { - if (current->thread.debug.hbp_watch[i] == bp) { - info.si_errno = -((i << 1) + 1); - break; -diff --git a/arch/arm64/kernel/sys_compat.c b/arch/arm64/kernel/sys_compat.c -index 26e9c4eeaba8..78039927c807 100644 ---- a/arch/arm64/kernel/sys_compat.c -+++ b/arch/arm64/kernel/sys_compat.c -@@ -79,6 +79,12 @@ long compat_arm_syscall(struct pt_regs *regs) - - case __ARM_NR_compat_set_tls: - current->thread.tp_value = regs->regs[0]; -+ -+ /* -+ * Protect against register corruption from context switch. -+ * See comment in tls_thread_flush. -+ */ -+ barrier(); - asm ("msr tpidrro_el0, %0" : : "r" (regs->regs[0])); - return 0; - -diff --git a/arch/arm64/kvm/handle_exit.c b/arch/arm64/kvm/handle_exit.c -index 7bc41eab4c64..fd9aeba99683 100644 ---- a/arch/arm64/kvm/handle_exit.c -+++ b/arch/arm64/kvm/handle_exit.c -@@ -62,6 +62,8 @@ static int kvm_handle_wfx(struct kvm_vcpu *vcpu, struct kvm_run *run) - else - kvm_vcpu_block(vcpu); - -+ kvm_skip_instr(vcpu, kvm_vcpu_trap_il_is32bit(vcpu)); -+ - return 1; - } - -diff --git a/arch/arm64/kvm/hyp-init.S b/arch/arm64/kvm/hyp-init.S -index 2b0244d65c16..12e26f358c31 100644 ---- a/arch/arm64/kvm/hyp-init.S -+++ b/arch/arm64/kvm/hyp-init.S -@@ -74,6 +74,10 @@ __do_hyp_init: - msr mair_el2, x4 - isb - -+ /* Invalidate the stale TLBs from Bootloader */ -+ tlbi alle2 -+ dsb sy -+ - mrs x4, sctlr_el2 - and x4, x4, #SCTLR_EL2_EE // preserve endianness of EL2 - ldr x5, =SCTLR_EL2_FLAGS -diff --git a/arch/mips/boot/compressed/decompress.c b/arch/mips/boot/compressed/decompress.c -index c00c4ddf4514..5244cecf1e45 100644 ---- a/arch/mips/boot/compressed/decompress.c -+++ b/arch/mips/boot/compressed/decompress.c -@@ -13,6 +13,7 @@ - - #include <linux/types.h> - #include <linux/kernel.h> -+#include <linux/string.h> - - #include <asm/addrspace.h> - -diff --git a/arch/mips/kernel/mcount.S b/arch/mips/kernel/mcount.S -index 539b6294b613..8f89ff4ed524 100644 ---- a/arch/mips/kernel/mcount.S -+++ b/arch/mips/kernel/mcount.S -@@ -123,7 +123,11 @@ NESTED(_mcount, PT_SIZE, ra) - nop - #endif - b ftrace_stub -+#ifdef CONFIG_32BIT -+ addiu sp, sp, 8 -+#else - nop -+#endif - - static_trace: - MCOUNT_SAVE_REGS -@@ -133,6 +137,9 @@ static_trace: - move a1, AT /* arg2: parent's return address */ - - MCOUNT_RESTORE_REGS -+#ifdef CONFIG_32BIT -+ addiu sp, sp, 8 -+#endif - .globl ftrace_stub - ftrace_stub: - RETURN_BACK -@@ -177,6 +184,11 @@ NESTED(ftrace_graph_caller, PT_SIZE, ra) - jal prepare_ftrace_return - nop - MCOUNT_RESTORE_REGS -+#ifndef CONFIG_DYNAMIC_FTRACE -+#ifdef CONFIG_32BIT -+ addiu sp, sp, 8 -+#endif -+#endif - RETURN_BACK - END(ftrace_graph_caller) - -diff --git a/arch/parisc/Makefile b/arch/parisc/Makefile -index 7187664034c3..5db8882f732c 100644 ---- a/arch/parisc/Makefile -+++ b/arch/parisc/Makefile -@@ -48,7 +48,12 @@ cflags-y := -pipe - - # These flags should be implied by an hppa-linux configuration, but they - # are not in gcc 3.2. --cflags-y += -mno-space-regs -mfast-indirect-calls -+cflags-y += -mno-space-regs -+ -+# -mfast-indirect-calls is only relevant for 32-bit kernels. -+ifndef CONFIG_64BIT -+cflags-y += -mfast-indirect-calls -+endif - - # Currently we save and restore fpregs on all kernel entry/interruption paths. - # If that gets optimized, we might need to disable the use of fpregs in the -diff --git a/arch/parisc/kernel/syscall.S b/arch/parisc/kernel/syscall.S -index 838786011037..7ef22e3387e0 100644 ---- a/arch/parisc/kernel/syscall.S -+++ b/arch/parisc/kernel/syscall.S -@@ -74,7 +74,7 @@ ENTRY(linux_gateway_page) - /* ADDRESS 0xb0 to 0xb8, lws uses two insns for entry */ - /* Light-weight-syscall entry must always be located at 0xb0 */ - /* WARNING: Keep this number updated with table size changes */ --#define __NR_lws_entries (2) -+#define __NR_lws_entries (3) - - lws_entry: - gate lws_start, %r0 /* increase privilege */ -@@ -502,7 +502,7 @@ lws_exit: - - - /*************************************************** -- Implementing CAS as an atomic operation: -+ Implementing 32bit CAS as an atomic operation: - - %r26 - Address to examine - %r25 - Old value to check (old) -@@ -659,6 +659,230 @@ cas_action: - ASM_EXCEPTIONTABLE_ENTRY(2b-linux_gateway_page, 3b-linux_gateway_page) - - -+ /*************************************************** -+ New CAS implementation which uses pointers and variable size -+ information. The value pointed by old and new MUST NOT change -+ while performing CAS. The lock only protect the value at %r26. -+ -+ %r26 - Address to examine -+ %r25 - Pointer to the value to check (old) -+ %r24 - Pointer to the value to set (new) -+ %r23 - Size of the variable (0/1/2/3 for 8/16/32/64 bit) -+ %r28 - Return non-zero on failure -+ %r21 - Kernel error code -+ -+ %r21 has the following meanings: -+ -+ EAGAIN - CAS is busy, ldcw failed, try again. -+ EFAULT - Read or write failed. -+ -+ Scratch: r20, r22, r28, r29, r1, fr4 (32bit for 64bit CAS only) -+ -+ ****************************************************/ -+ -+ /* ELF32 Process entry path */ -+lws_compare_and_swap_2: -+#ifdef CONFIG_64BIT -+ /* Clip the input registers */ -+ depdi 0, 31, 32, %r26 -+ depdi 0, 31, 32, %r25 -+ depdi 0, 31, 32, %r24 -+ depdi 0, 31, 32, %r23 -+#endif -+ -+ /* Check the validity of the size pointer */ -+ subi,>>= 4, %r23, %r0 -+ b,n lws_exit_nosys -+ -+ /* Jump to the functions which will load the old and new values into -+ registers depending on the their size */ -+ shlw %r23, 2, %r29 -+ blr %r29, %r0 -+ nop -+ -+ /* 8bit load */ -+4: ldb 0(%sr3,%r25), %r25 -+ b cas2_lock_start -+5: ldb 0(%sr3,%r24), %r24 -+ nop -+ nop -+ nop -+ nop -+ nop -+ -+ /* 16bit load */ -+6: ldh 0(%sr3,%r25), %r25 -+ b cas2_lock_start -+7: ldh 0(%sr3,%r24), %r24 -+ nop -+ nop -+ nop -+ nop -+ nop -+ -+ /* 32bit load */ -+8: ldw 0(%sr3,%r25), %r25 -+ b cas2_lock_start -+9: ldw 0(%sr3,%r24), %r24 -+ nop -+ nop -+ nop -+ nop -+ nop -+ -+ /* 64bit load */ -+#ifdef CONFIG_64BIT -+10: ldd 0(%sr3,%r25), %r25 -+11: ldd 0(%sr3,%r24), %r24 -+#else -+ /* Load new value into r22/r23 - high/low */ -+10: ldw 0(%sr3,%r25), %r22 -+11: ldw 4(%sr3,%r25), %r23 -+ /* Load new value into fr4 for atomic store later */ -+12: flddx 0(%sr3,%r24), %fr4 -+#endif -+ -+cas2_lock_start: -+ /* Load start of lock table */ -+ ldil L%lws_lock_start, %r20 -+ ldo R%lws_lock_start(%r20), %r28 -+ -+ /* Extract four bits from r26 and hash lock (Bits 4-7) */ -+ extru %r26, 27, 4, %r20 -+ -+ /* Find lock to use, the hash is either one of 0 to -+ 15, multiplied by 16 (keep it 16-byte aligned) -+ and add to the lock table offset. */ -+ shlw %r20, 4, %r20 -+ add %r20, %r28, %r20 -+ -+ rsm PSW_SM_I, %r0 /* Disable interrupts */ -+ /* COW breaks can cause contention on UP systems */ -+ LDCW 0(%sr2,%r20), %r28 /* Try to acquire the lock */ -+ cmpb,<>,n %r0, %r28, cas2_action /* Did we get it? */ -+cas2_wouldblock: -+ ldo 2(%r0), %r28 /* 2nd case */ -+ ssm PSW_SM_I, %r0 -+ b lws_exit /* Contended... */ -+ ldo -EAGAIN(%r0), %r21 /* Spin in userspace */ -+ -+ /* -+ prev = *addr; -+ if ( prev == old ) -+ *addr = new; -+ return prev; -+ */ -+ -+ /* NOTES: -+ This all works becuse intr_do_signal -+ and schedule both check the return iasq -+ and see that we are on the kernel page -+ so this process is never scheduled off -+ or is ever sent any signal of any sort, -+ thus it is wholly atomic from usrspaces -+ perspective -+ */ -+cas2_action: -+ /* Jump to the correct function */ -+ blr %r29, %r0 -+ /* Set %r28 as non-zero for now */ -+ ldo 1(%r0),%r28 -+ -+ /* 8bit CAS */ -+13: ldb,ma 0(%sr3,%r26), %r29 -+ sub,= %r29, %r25, %r0 -+ b,n cas2_end -+14: stb,ma %r24, 0(%sr3,%r26) -+ b cas2_end -+ copy %r0, %r28 -+ nop -+ nop -+ -+ /* 16bit CAS */ -+15: ldh,ma 0(%sr3,%r26), %r29 -+ sub,= %r29, %r25, %r0 -+ b,n cas2_end -+16: sth,ma %r24, 0(%sr3,%r26) -+ b cas2_end -+ copy %r0, %r28 -+ nop -+ nop -+ -+ /* 32bit CAS */ -+17: ldw,ma 0(%sr3,%r26), %r29 -+ sub,= %r29, %r25, %r0 -+ b,n cas2_end -+18: stw,ma %r24, 0(%sr3,%r26) -+ b cas2_end -+ copy %r0, %r28 -+ nop -+ nop -+ -+ /* 64bit CAS */ -+#ifdef CONFIG_64BIT -+19: ldd,ma 0(%sr3,%r26), %r29 -+ sub,= %r29, %r25, %r0 -+ b,n cas2_end -+20: std,ma %r24, 0(%sr3,%r26) -+ copy %r0, %r28 -+#else -+ /* Compare first word */ -+19: ldw,ma 0(%sr3,%r26), %r29 -+ sub,= %r29, %r22, %r0 -+ b,n cas2_end -+ /* Compare second word */ -+20: ldw,ma 4(%sr3,%r26), %r29 -+ sub,= %r29, %r23, %r0 -+ b,n cas2_end -+ /* Perform the store */ -+21: fstdx %fr4, 0(%sr3,%r26) -+ copy %r0, %r28 -+#endif -+ -+cas2_end: -+ /* Free lock */ -+ stw,ma %r20, 0(%sr2,%r20) -+ /* Enable interrupts */ -+ ssm PSW_SM_I, %r0 -+ /* Return to userspace, set no error */ -+ b lws_exit -+ copy %r0, %r21 -+ -+22: -+ /* Error occurred on load or store */ -+ /* Free lock */ -+ stw %r20, 0(%sr2,%r20) -+ ssm PSW_SM_I, %r0 -+ ldo 1(%r0),%r28 -+ b lws_exit -+ ldo -EFAULT(%r0),%r21 /* set errno */ -+ nop -+ nop -+ nop -+ -+ /* Exception table entries, for the load and store, return EFAULT. -+ Each of the entries must be relocated. */ -+ ASM_EXCEPTIONTABLE_ENTRY(4b-linux_gateway_page, 22b-linux_gateway_page) -+ ASM_EXCEPTIONTABLE_ENTRY(5b-linux_gateway_page, 22b-linux_gateway_page) -+ ASM_EXCEPTIONTABLE_ENTRY(6b-linux_gateway_page, 22b-linux_gateway_page) -+ ASM_EXCEPTIONTABLE_ENTRY(7b-linux_gateway_page, 22b-linux_gateway_page) -+ ASM_EXCEPTIONTABLE_ENTRY(8b-linux_gateway_page, 22b-linux_gateway_page) -+ ASM_EXCEPTIONTABLE_ENTRY(9b-linux_gateway_page, 22b-linux_gateway_page) -+ ASM_EXCEPTIONTABLE_ENTRY(10b-linux_gateway_page, 22b-linux_gateway_page) -+ ASM_EXCEPTIONTABLE_ENTRY(11b-linux_gateway_page, 22b-linux_gateway_page) -+ ASM_EXCEPTIONTABLE_ENTRY(13b-linux_gateway_page, 22b-linux_gateway_page) -+ ASM_EXCEPTIONTABLE_ENTRY(14b-linux_gateway_page, 22b-linux_gateway_page) -+ ASM_EXCEPTIONTABLE_ENTRY(15b-linux_gateway_page, 22b-linux_gateway_page) -+ ASM_EXCEPTIONTABLE_ENTRY(16b-linux_gateway_page, 22b-linux_gateway_page) -+ ASM_EXCEPTIONTABLE_ENTRY(17b-linux_gateway_page, 22b-linux_gateway_page) -+ ASM_EXCEPTIONTABLE_ENTRY(18b-linux_gateway_page, 22b-linux_gateway_page) -+ ASM_EXCEPTIONTABLE_ENTRY(19b-linux_gateway_page, 22b-linux_gateway_page) -+ ASM_EXCEPTIONTABLE_ENTRY(20b-linux_gateway_page, 22b-linux_gateway_page) -+#ifndef CONFIG_64BIT -+ ASM_EXCEPTIONTABLE_ENTRY(12b-linux_gateway_page, 22b-linux_gateway_page) -+ ASM_EXCEPTIONTABLE_ENTRY(21b-linux_gateway_page, 22b-linux_gateway_page) -+#endif -+ - /* Make sure nothing else is placed on this page */ - .align PAGE_SIZE - END(linux_gateway_page) -@@ -675,8 +899,9 @@ ENTRY(end_linux_gateway_page) - /* Light-weight-syscall table */ - /* Start of lws table. */ - ENTRY(lws_table) -- LWS_ENTRY(compare_and_swap32) /* 0 - ELF32 Atomic compare and swap */ -- LWS_ENTRY(compare_and_swap64) /* 1 - ELF64 Atomic compare and swap */ -+ LWS_ENTRY(compare_and_swap32) /* 0 - ELF32 Atomic 32bit CAS */ -+ LWS_ENTRY(compare_and_swap64) /* 1 - ELF64 Atomic 32bit CAS */ -+ LWS_ENTRY(compare_and_swap_2) /* 2 - ELF32 Atomic 64bit CAS */ - END(lws_table) - /* End of lws table */ - -diff --git a/arch/powerpc/include/asm/ptrace.h b/arch/powerpc/include/asm/ptrace.h -index 279b80f3bb29..c0c61fa9cd9e 100644 ---- a/arch/powerpc/include/asm/ptrace.h -+++ b/arch/powerpc/include/asm/ptrace.h -@@ -47,6 +47,12 @@ - STACK_FRAME_OVERHEAD + KERNEL_REDZONE_SIZE) - #define STACK_FRAME_MARKER 12 - -+#if defined(_CALL_ELF) && _CALL_ELF == 2 -+#define STACK_FRAME_MIN_SIZE 32 -+#else -+#define STACK_FRAME_MIN_SIZE STACK_FRAME_OVERHEAD -+#endif -+ - /* Size of dummy stack frame allocated when calling signal handler. */ - #define __SIGNAL_FRAMESIZE 128 - #define __SIGNAL_FRAMESIZE32 64 -@@ -60,6 +66,7 @@ - #define STACK_FRAME_REGS_MARKER ASM_CONST(0x72656773) - #define STACK_INT_FRAME_SIZE (sizeof(struct pt_regs) + STACK_FRAME_OVERHEAD) - #define STACK_FRAME_MARKER 2 -+#define STACK_FRAME_MIN_SIZE STACK_FRAME_OVERHEAD - - /* Size of stack frame allocated when calling signal handler. */ - #define __SIGNAL_FRAMESIZE 64 -diff --git a/arch/powerpc/include/asm/spinlock.h b/arch/powerpc/include/asm/spinlock.h -index 35aa339410bd..4dbe072eecbe 100644 ---- a/arch/powerpc/include/asm/spinlock.h -+++ b/arch/powerpc/include/asm/spinlock.h -@@ -61,6 +61,7 @@ static __always_inline int arch_spin_value_unlocked(arch_spinlock_t lock) - - static inline int arch_spin_is_locked(arch_spinlock_t *lock) - { -+ smp_mb(); - return !arch_spin_value_unlocked(*lock); - } - -diff --git a/arch/powerpc/lib/locks.c b/arch/powerpc/lib/locks.c -index 0c9c8d7d0734..170a0346f756 100644 ---- a/arch/powerpc/lib/locks.c -+++ b/arch/powerpc/lib/locks.c -@@ -70,12 +70,16 @@ void __rw_yield(arch_rwlock_t *rw) - - void arch_spin_unlock_wait(arch_spinlock_t *lock) - { -+ smp_mb(); -+ - while (lock->slock) { - HMT_low(); - if (SHARED_PROCESSOR) - __spin_yield(lock); - } - HMT_medium(); -+ -+ smp_mb(); - } - - EXPORT_SYMBOL(arch_spin_unlock_wait); -diff --git a/arch/powerpc/perf/callchain.c b/arch/powerpc/perf/callchain.c -index 74d1e780748b..2396dda282cd 100644 ---- a/arch/powerpc/perf/callchain.c -+++ b/arch/powerpc/perf/callchain.c -@@ -35,7 +35,7 @@ static int valid_next_sp(unsigned long sp, unsigned long prev_sp) - return 0; /* must be 16-byte aligned */ - if (!validate_sp(sp, current, STACK_FRAME_OVERHEAD)) - return 0; -- if (sp >= prev_sp + STACK_FRAME_OVERHEAD) -+ if (sp >= prev_sp + STACK_FRAME_MIN_SIZE) - return 1; - /* - * sp could decrease when we jump off an interrupt stack -diff --git a/arch/s390/mm/pgtable.c b/arch/s390/mm/pgtable.c -index 3584ed9b20a1..e309c5c41158 100644 ---- a/arch/s390/mm/pgtable.c -+++ b/arch/s390/mm/pgtable.c -@@ -810,11 +810,21 @@ int set_guest_storage_key(struct mm_struct *mm, unsigned long addr, - pte_t *ptep; - - down_read(&mm->mmap_sem); -+retry: - ptep = get_locked_pte(current->mm, addr, &ptl); - if (unlikely(!ptep)) { - up_read(&mm->mmap_sem); - return -EFAULT; - } -+ if (!(pte_val(*ptep) & _PAGE_INVALID) && -+ (pte_val(*ptep) & _PAGE_PROTECT)) { -+ pte_unmap_unlock(*ptep, ptl); -+ if (fixup_user_fault(current, mm, addr, FAULT_FLAG_WRITE)) { -+ up_read(&mm->mmap_sem); -+ return -EFAULT; -+ } -+ goto retry; -+ } - - new = old = pgste_get_lock(ptep); - pgste_val(new) &= ~(PGSTE_GR_BIT | PGSTE_GC_BIT | -diff --git a/arch/x86/boot/compressed/aslr.c b/arch/x86/boot/compressed/aslr.c -index 4dbf967da50d..6cfcf2a2eb93 100644 ---- a/arch/x86/boot/compressed/aslr.c -+++ b/arch/x86/boot/compressed/aslr.c -@@ -183,12 +183,27 @@ static void mem_avoid_init(unsigned long input, unsigned long input_size, - static bool mem_avoid_overlap(struct mem_vector *img) - { - int i; -+ struct setup_data *ptr; - - for (i = 0; i < MEM_AVOID_MAX; i++) { - if (mem_overlaps(img, &mem_avoid[i])) - return true; - } - -+ /* Avoid all entries in the setup_data linked list. */ -+ ptr = (struct setup_data *)(unsigned long)real_mode->hdr.setup_data; -+ while (ptr) { -+ struct mem_vector avoid; -+ -+ avoid.start = (u64)ptr; -+ avoid.size = sizeof(*ptr) + ptr->len; -+ -+ if (mem_overlaps(img, &avoid)) -+ return true; -+ -+ ptr = (struct setup_data *)(unsigned long)ptr->next; -+ } -+ - return false; - } - -diff --git a/arch/x86/include/asm/fixmap.h b/arch/x86/include/asm/fixmap.h -index 7252cd339175..6762a55b798a 100644 ---- a/arch/x86/include/asm/fixmap.h -+++ b/arch/x86/include/asm/fixmap.h -@@ -123,14 +123,14 @@ enum fixed_addresses { - __end_of_permanent_fixed_addresses, - - /* -- * 256 temporary boot-time mappings, used by early_ioremap(), -+ * 512 temporary boot-time mappings, used by early_ioremap(), - * before ioremap() is functional. - * -- * If necessary we round it up to the next 256 pages boundary so -+ * If necessary we round it up to the next 512 pages boundary so - * that we can have a single pgd entry and a single pte table: - */ - #define NR_FIX_BTMAPS 64 --#define FIX_BTMAPS_SLOTS 4 -+#define FIX_BTMAPS_SLOTS 8 - #define TOTAL_FIX_BTMAPS (NR_FIX_BTMAPS * FIX_BTMAPS_SLOTS) - FIX_BTMAP_END = - (__end_of_permanent_fixed_addresses ^ -diff --git a/arch/x86/include/asm/pgtable_64.h b/arch/x86/include/asm/pgtable_64.h -index e22c1dbf7feb..d869931bde62 100644 ---- a/arch/x86/include/asm/pgtable_64.h -+++ b/arch/x86/include/asm/pgtable_64.h -@@ -19,6 +19,7 @@ extern pud_t level3_ident_pgt[512]; - extern pmd_t level2_kernel_pgt[512]; - extern pmd_t level2_fixmap_pgt[512]; - extern pmd_t level2_ident_pgt[512]; -+extern pte_t level1_fixmap_pgt[512]; - extern pgd_t init_level4_pgt[]; - - #define swapper_pg_dir init_level4_pgt -diff --git a/arch/x86/kernel/cpu/perf_event_intel_rapl.c b/arch/x86/kernel/cpu/perf_event_intel_rapl.c -index 5ad35ad94d0f..95700e52061d 100644 ---- a/arch/x86/kernel/cpu/perf_event_intel_rapl.c -+++ b/arch/x86/kernel/cpu/perf_event_intel_rapl.c -@@ -511,6 +511,7 @@ static int rapl_cpu_prepare(int cpu) - struct rapl_pmu *pmu = per_cpu(rapl_pmu, cpu); - int phys_id = topology_physical_package_id(cpu); - u64 ms; -+ u64 msr_rapl_power_unit_bits; - - if (pmu) - return 0; -@@ -518,6 +519,9 @@ static int rapl_cpu_prepare(int cpu) - if (phys_id < 0) - return -1; - -+ if (!rdmsrl_safe(MSR_RAPL_POWER_UNIT, &msr_rapl_power_unit_bits)) -+ return -1; -+ - pmu = kzalloc_node(sizeof(*pmu), GFP_KERNEL, cpu_to_node(cpu)); - if (!pmu) - return -1; -@@ -531,8 +535,7 @@ static int rapl_cpu_prepare(int cpu) - * - * we cache in local PMU instance - */ -- rdmsrl(MSR_RAPL_POWER_UNIT, pmu->hw_unit); -- pmu->hw_unit = (pmu->hw_unit >> 8) & 0x1FULL; -+ pmu->hw_unit = (msr_rapl_power_unit_bits >> 8) & 0x1FULL; - pmu->pmu = &rapl_pmu_class; - - /* -@@ -649,7 +652,9 @@ static int __init rapl_pmu_init(void) - get_online_cpus(); - - for_each_online_cpu(cpu) { -- rapl_cpu_prepare(cpu); -+ ret = rapl_cpu_prepare(cpu); -+ if (ret) -+ goto out; - rapl_cpu_init(cpu); - } - -@@ -672,6 +677,7 @@ static int __init rapl_pmu_init(void) - hweight32(rapl_cntr_mask), - ktime_to_ms(pmu->timer_interval)); - -+out: - put_online_cpus(); - - return 0; -diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c -index 395be6d8bbde..682876533ed9 100644 ---- a/arch/x86/kernel/smpboot.c -+++ b/arch/x86/kernel/smpboot.c -@@ -1287,6 +1287,9 @@ static void remove_siblinginfo(int cpu) - - for_each_cpu(sibling, cpu_sibling_mask(cpu)) - cpumask_clear_cpu(cpu, cpu_sibling_mask(sibling)); -+ for_each_cpu(sibling, cpu_llc_shared_mask(cpu)) -+ cpumask_clear_cpu(cpu, cpu_llc_shared_mask(sibling)); -+ cpumask_clear(cpu_llc_shared_mask(cpu)); - cpumask_clear(cpu_sibling_mask(cpu)); - cpumask_clear(cpu_core_mask(cpu)); - c->phys_proc_id = 0; -diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c -index 2423ef04ffea..c83da6fb2dee 100644 ---- a/arch/x86/xen/mmu.c -+++ b/arch/x86/xen/mmu.c -@@ -1866,12 +1866,11 @@ static void __init check_pt_base(unsigned long *pt_base, unsigned long *pt_end, - * - * We can construct this by grafting the Xen provided pagetable into - * head_64.S's preconstructed pagetables. We copy the Xen L2's into -- * level2_ident_pgt, level2_kernel_pgt and level2_fixmap_pgt. This -- * means that only the kernel has a physical mapping to start with - -- * but that's enough to get __va working. We need to fill in the rest -- * of the physical mapping once some sort of allocator has been set -- * up. -- * NOTE: for PVH, the page tables are native. -+ * level2_ident_pgt, and level2_kernel_pgt. This means that only the -+ * kernel has a physical mapping to start with - but that's enough to -+ * get __va working. We need to fill in the rest of the physical -+ * mapping once some sort of allocator has been set up. NOTE: for -+ * PVH, the page tables are native. - */ - void __init xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pfn) - { -@@ -1902,8 +1901,11 @@ void __init xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pfn) - /* L3_i[0] -> level2_ident_pgt */ - convert_pfn_mfn(level3_ident_pgt); - /* L3_k[510] -> level2_kernel_pgt -- * L3_i[511] -> level2_fixmap_pgt */ -+ * L3_k[511] -> level2_fixmap_pgt */ - convert_pfn_mfn(level3_kernel_pgt); -+ -+ /* L3_k[511][506] -> level1_fixmap_pgt */ -+ convert_pfn_mfn(level2_fixmap_pgt); - } - /* We get [511][511] and have Xen's version of level2_kernel_pgt */ - l3 = m2v(pgd[pgd_index(__START_KERNEL_map)].pgd); -@@ -1913,21 +1915,15 @@ void __init xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pfn) - addr[1] = (unsigned long)l3; - addr[2] = (unsigned long)l2; - /* Graft it onto L4[272][0]. Note that we creating an aliasing problem: -- * Both L4[272][0] and L4[511][511] have entries that point to the same -+ * Both L4[272][0] and L4[511][510] have entries that point to the same - * L2 (PMD) tables. Meaning that if you modify it in __va space - * it will be also modified in the __ka space! (But if you just - * modify the PMD table to point to other PTE's or none, then you - * are OK - which is what cleanup_highmap does) */ - copy_page(level2_ident_pgt, l2); -- /* Graft it onto L4[511][511] */ -+ /* Graft it onto L4[511][510] */ - copy_page(level2_kernel_pgt, l2); - -- /* Get [511][510] and graft that in level2_fixmap_pgt */ -- l3 = m2v(pgd[pgd_index(__START_KERNEL_map + PMD_SIZE)].pgd); -- l2 = m2v(l3[pud_index(__START_KERNEL_map + PMD_SIZE)].pud); -- copy_page(level2_fixmap_pgt, l2); -- /* Note that we don't do anything with level1_fixmap_pgt which -- * we don't need. */ - if (!xen_feature(XENFEAT_auto_translated_physmap)) { - /* Make pagetable pieces RO */ - set_page_prot(init_level4_pgt, PAGE_KERNEL_RO); -@@ -1937,6 +1933,7 @@ void __init xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pfn) - set_page_prot(level2_ident_pgt, PAGE_KERNEL_RO); - set_page_prot(level2_kernel_pgt, PAGE_KERNEL_RO); - set_page_prot(level2_fixmap_pgt, PAGE_KERNEL_RO); -+ set_page_prot(level1_fixmap_pgt, PAGE_KERNEL_RO); - - /* Pin down new L4 */ - pin_pagetable_pfn(MMUEXT_PIN_L4_TABLE, -diff --git a/arch/xtensa/include/asm/pgtable.h b/arch/xtensa/include/asm/pgtable.h -index 216446295ada..51230ba97bef 100644 ---- a/arch/xtensa/include/asm/pgtable.h -+++ b/arch/xtensa/include/asm/pgtable.h -@@ -67,7 +67,12 @@ - #define VMALLOC_START 0xC0000000 - #define VMALLOC_END 0xC7FEFFFF - #define TLBTEMP_BASE_1 0xC7FF0000 --#define TLBTEMP_BASE_2 0xC7FF8000 -+#define TLBTEMP_BASE_2 (TLBTEMP_BASE_1 + DCACHE_WAY_SIZE) -+#if 2 * DCACHE_WAY_SIZE > ICACHE_WAY_SIZE -+#define TLBTEMP_SIZE (2 * DCACHE_WAY_SIZE) -+#else -+#define TLBTEMP_SIZE ICACHE_WAY_SIZE -+#endif - - /* - * For the Xtensa architecture, the PTE layout is as follows: -diff --git a/arch/xtensa/include/asm/uaccess.h b/arch/xtensa/include/asm/uaccess.h -index fd686dc45d1a..c7211e7e182d 100644 ---- a/arch/xtensa/include/asm/uaccess.h -+++ b/arch/xtensa/include/asm/uaccess.h -@@ -52,7 +52,12 @@ - */ - .macro get_fs ad, sp - GET_CURRENT(\ad,\sp) -+#if THREAD_CURRENT_DS > 1020 -+ addi \ad, \ad, TASK_THREAD -+ l32i \ad, \ad, THREAD_CURRENT_DS - TASK_THREAD -+#else - l32i \ad, \ad, THREAD_CURRENT_DS -+#endif - .endm - - /* -diff --git a/arch/xtensa/include/uapi/asm/ioctls.h b/arch/xtensa/include/uapi/asm/ioctls.h -index b4cb1100c0fb..a47909f0c34b 100644 ---- a/arch/xtensa/include/uapi/asm/ioctls.h -+++ b/arch/xtensa/include/uapi/asm/ioctls.h -@@ -28,17 +28,17 @@ - #define TCSETSW 0x5403 - #define TCSETSF 0x5404 - --#define TCGETA _IOR('t', 23, struct termio) --#define TCSETA _IOW('t', 24, struct termio) --#define TCSETAW _IOW('t', 25, struct termio) --#define TCSETAF _IOW('t', 28, struct termio) -+#define TCGETA 0x80127417 /* _IOR('t', 23, struct termio) */ -+#define TCSETA 0x40127418 /* _IOW('t', 24, struct termio) */ -+#define TCSETAW 0x40127419 /* _IOW('t', 25, struct termio) */ -+#define TCSETAF 0x4012741C /* _IOW('t', 28, struct termio) */ - - #define TCSBRK _IO('t', 29) - #define TCXONC _IO('t', 30) - #define TCFLSH _IO('t', 31) - --#define TIOCSWINSZ _IOW('t', 103, struct winsize) --#define TIOCGWINSZ _IOR('t', 104, struct winsize) -+#define TIOCSWINSZ 0x40087467 /* _IOW('t', 103, struct winsize) */ -+#define TIOCGWINSZ 0x80087468 /* _IOR('t', 104, struct winsize) */ - #define TIOCSTART _IO('t', 110) /* start output, like ^Q */ - #define TIOCSTOP _IO('t', 111) /* stop output, like ^S */ - #define TIOCOUTQ _IOR('t', 115, int) /* output queue size */ -@@ -88,7 +88,6 @@ - #define TIOCSETD _IOW('T', 35, int) - #define TIOCGETD _IOR('T', 36, int) - #define TCSBRKP _IOW('T', 37, int) /* Needed for POSIX tcsendbreak()*/ --#define TIOCTTYGSTRUCT _IOR('T', 38, struct tty_struct) /* For debugging only*/ - #define TIOCSBRK _IO('T', 39) /* BSD compatibility */ - #define TIOCCBRK _IO('T', 40) /* BSD compatibility */ - #define TIOCGSID _IOR('T', 41, pid_t) /* Return the session ID of FD*/ -@@ -114,8 +113,10 @@ - #define TIOCSERGETLSR _IOR('T', 89, unsigned int) /* Get line status reg. */ - /* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */ - # define TIOCSER_TEMT 0x01 /* Transmitter physically empty */ --#define TIOCSERGETMULTI _IOR('T', 90, struct serial_multiport_struct) /* Get multiport config */ --#define TIOCSERSETMULTI _IOW('T', 91, struct serial_multiport_struct) /* Set multiport config */ -+#define TIOCSERGETMULTI 0x80a8545a /* Get multiport config */ -+ /* _IOR('T', 90, struct serial_multiport_struct) */ -+#define TIOCSERSETMULTI 0x40a8545b /* Set multiport config */ -+ /* _IOW('T', 91, struct serial_multiport_struct) */ - - #define TIOCMIWAIT _IO('T', 92) /* wait for a change on serial input line(s) */ - #define TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */ -diff --git a/arch/xtensa/kernel/entry.S b/arch/xtensa/kernel/entry.S -index ef7f4990722b..a06b7efaae82 100644 ---- a/arch/xtensa/kernel/entry.S -+++ b/arch/xtensa/kernel/entry.S -@@ -1001,9 +1001,8 @@ ENTRY(fast_syscall_xtensa) - movi a7, 4 # sizeof(unsigned int) - access_ok a3, a7, a0, a2, .Leac # a0: scratch reg, a2: sp - -- addi a6, a6, -1 # assuming SYS_XTENSA_ATOMIC_SET = 1 -- _bgeui a6, SYS_XTENSA_COUNT - 1, .Lill -- _bnei a6, SYS_XTENSA_ATOMIC_CMP_SWP - 1, .Lnswp -+ _bgeui a6, SYS_XTENSA_COUNT, .Lill -+ _bnei a6, SYS_XTENSA_ATOMIC_CMP_SWP, .Lnswp - - /* Fall through for ATOMIC_CMP_SWP. */ - -@@ -1015,27 +1014,26 @@ TRY s32i a5, a3, 0 # different, modify value - l32i a7, a2, PT_AREG7 # restore a7 - l32i a0, a2, PT_AREG0 # restore a0 - movi a2, 1 # and return 1 -- addi a6, a6, 1 # restore a6 (really necessary?) - rfe - - 1: l32i a7, a2, PT_AREG7 # restore a7 - l32i a0, a2, PT_AREG0 # restore a0 - movi a2, 0 # return 0 (note that we cannot set -- addi a6, a6, 1 # restore a6 (really necessary?) - rfe - - .Lnswp: /* Atomic set, add, and exg_add. */ - - TRY l32i a7, a3, 0 # orig -+ addi a6, a6, -SYS_XTENSA_ATOMIC_SET - add a0, a4, a7 # + arg - moveqz a0, a4, a6 # set -+ addi a6, a6, SYS_XTENSA_ATOMIC_SET - TRY s32i a0, a3, 0 # write new value - - mov a0, a2 - mov a2, a7 - l32i a7, a0, PT_AREG7 # restore a7 - l32i a0, a0, PT_AREG0 # restore a0 -- addi a6, a6, 1 # restore a6 (really necessary?) - rfe - - CATCH -@@ -1044,7 +1042,7 @@ CATCH - movi a2, -EFAULT - rfe - --.Lill: l32i a7, a2, PT_AREG0 # restore a7 -+.Lill: l32i a7, a2, PT_AREG7 # restore a7 - l32i a0, a2, PT_AREG0 # restore a0 - movi a2, -EINVAL - rfe -@@ -1565,7 +1563,7 @@ ENTRY(fast_second_level_miss) - rsr a0, excvaddr - bltu a0, a3, 2f - -- addi a1, a0, -(2 << (DCACHE_ALIAS_ORDER + PAGE_SHIFT)) -+ addi a1, a0, -TLBTEMP_SIZE - bgeu a1, a3, 2f - - /* Check if we have to restore an ITLB mapping. */ -@@ -1820,7 +1818,6 @@ ENTRY(_switch_to) - - entry a1, 16 - -- mov a10, a2 # preserve 'prev' (a2) - mov a11, a3 # and 'next' (a3) - - l32i a4, a2, TASK_THREAD_INFO -@@ -1828,8 +1825,14 @@ ENTRY(_switch_to) - - save_xtregs_user a4 a6 a8 a9 a12 a13 THREAD_XTREGS_USER - -- s32i a0, a10, THREAD_RA # save return address -- s32i a1, a10, THREAD_SP # save stack pointer -+#if THREAD_RA > 1020 || THREAD_SP > 1020 -+ addi a10, a2, TASK_THREAD -+ s32i a0, a10, THREAD_RA - TASK_THREAD # save return address -+ s32i a1, a10, THREAD_SP - TASK_THREAD # save stack pointer -+#else -+ s32i a0, a2, THREAD_RA # save return address -+ s32i a1, a2, THREAD_SP # save stack pointer -+#endif - - /* Disable ints while we manipulate the stack pointer. */ - -@@ -1870,7 +1873,6 @@ ENTRY(_switch_to) - load_xtregs_user a5 a6 a8 a9 a12 a13 THREAD_XTREGS_USER - - wsr a14, ps -- mov a2, a10 # return 'prev' - rsync - - retw -diff --git a/arch/xtensa/kernel/pci-dma.c b/arch/xtensa/kernel/pci-dma.c -index 2d9cc6dbfd78..e8b76b8e4b29 100644 ---- a/arch/xtensa/kernel/pci-dma.c -+++ b/arch/xtensa/kernel/pci-dma.c -@@ -49,9 +49,8 @@ dma_alloc_coherent(struct device *dev,size_t size,dma_addr_t *handle,gfp_t flag) - - /* We currently don't support coherent memory outside KSEG */ - -- if (ret < XCHAL_KSEG_CACHED_VADDR -- || ret >= XCHAL_KSEG_CACHED_VADDR + XCHAL_KSEG_SIZE) -- BUG(); -+ BUG_ON(ret < XCHAL_KSEG_CACHED_VADDR || -+ ret > XCHAL_KSEG_CACHED_VADDR + XCHAL_KSEG_SIZE - 1); - - - if (ret != 0) { -@@ -68,10 +67,11 @@ EXPORT_SYMBOL(dma_alloc_coherent); - void dma_free_coherent(struct device *hwdev, size_t size, - void *vaddr, dma_addr_t dma_handle) - { -- long addr=(long)vaddr+XCHAL_KSEG_CACHED_VADDR-XCHAL_KSEG_BYPASS_VADDR; -+ unsigned long addr = (unsigned long)vaddr + -+ XCHAL_KSEG_CACHED_VADDR - XCHAL_KSEG_BYPASS_VADDR; - -- if (addr < 0 || addr >= XCHAL_KSEG_SIZE) -- BUG(); -+ BUG_ON(addr < XCHAL_KSEG_CACHED_VADDR || -+ addr > XCHAL_KSEG_CACHED_VADDR + XCHAL_KSEG_SIZE - 1); - - free_pages(addr, get_order(size)); - } -diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c -index 744833b630c6..91c25f261c91 100644 ---- a/block/cfq-iosched.c -+++ b/block/cfq-iosched.c -@@ -1275,12 +1275,16 @@ __cfq_group_service_tree_add(struct cfq_rb_root *st, struct cfq_group *cfqg) - static void - cfq_update_group_weight(struct cfq_group *cfqg) - { -- BUG_ON(!RB_EMPTY_NODE(&cfqg->rb_node)); -- - if (cfqg->new_weight) { - cfqg->weight = cfqg->new_weight; - cfqg->new_weight = 0; - } -+} -+ -+static void -+cfq_update_group_leaf_weight(struct cfq_group *cfqg) -+{ -+ BUG_ON(!RB_EMPTY_NODE(&cfqg->rb_node)); - - if (cfqg->new_leaf_weight) { - cfqg->leaf_weight = cfqg->new_leaf_weight; -@@ -1299,7 +1303,7 @@ cfq_group_service_tree_add(struct cfq_rb_root *st, struct cfq_group *cfqg) - /* add to the service tree */ - BUG_ON(!RB_EMPTY_NODE(&cfqg->rb_node)); - -- cfq_update_group_weight(cfqg); -+ cfq_update_group_leaf_weight(cfqg); - __cfq_group_service_tree_add(st, cfqg); - - /* -@@ -1323,6 +1327,7 @@ cfq_group_service_tree_add(struct cfq_rb_root *st, struct cfq_group *cfqg) - */ - while ((parent = cfqg_parent(pos))) { - if (propagate) { -+ cfq_update_group_weight(pos); - propagate = !parent->nr_active++; - parent->children_weight += pos->weight; - } -diff --git a/block/genhd.c b/block/genhd.c -index 791f41943132..e6723bd4d7a1 100644 ---- a/block/genhd.c -+++ b/block/genhd.c -@@ -28,10 +28,10 @@ struct kobject *block_depr; - /* for extended dynamic devt allocation, currently only one major is used */ - #define NR_EXT_DEVT (1 << MINORBITS) - --/* For extended devt allocation. ext_devt_mutex prevents look up -+/* For extended devt allocation. ext_devt_lock prevents look up - * results from going away underneath its user. - */ --static DEFINE_MUTEX(ext_devt_mutex); -+static DEFINE_SPINLOCK(ext_devt_lock); - static DEFINE_IDR(ext_devt_idr); - - static struct device_type disk_type; -@@ -420,9 +420,13 @@ int blk_alloc_devt(struct hd_struct *part, dev_t *devt) - } - - /* allocate ext devt */ -- mutex_lock(&ext_devt_mutex); -- idx = idr_alloc(&ext_devt_idr, part, 0, NR_EXT_DEVT, GFP_KERNEL); -- mutex_unlock(&ext_devt_mutex); -+ idr_preload(GFP_KERNEL); -+ -+ spin_lock(&ext_devt_lock); -+ idx = idr_alloc(&ext_devt_idr, part, 0, NR_EXT_DEVT, GFP_NOWAIT); -+ spin_unlock(&ext_devt_lock); -+ -+ idr_preload_end(); - if (idx < 0) - return idx == -ENOSPC ? -EBUSY : idx; - -@@ -441,15 +445,13 @@ int blk_alloc_devt(struct hd_struct *part, dev_t *devt) - */ - void blk_free_devt(dev_t devt) - { -- might_sleep(); -- - if (devt == MKDEV(0, 0)) - return; - - if (MAJOR(devt) == BLOCK_EXT_MAJOR) { -- mutex_lock(&ext_devt_mutex); -+ spin_lock(&ext_devt_lock); - idr_remove(&ext_devt_idr, blk_mangle_minor(MINOR(devt))); -- mutex_unlock(&ext_devt_mutex); -+ spin_unlock(&ext_devt_lock); - } - } - -@@ -665,7 +667,6 @@ void del_gendisk(struct gendisk *disk) - sysfs_remove_link(block_depr, dev_name(disk_to_dev(disk))); - pm_runtime_set_memalloc_noio(disk_to_dev(disk), false); - device_del(disk_to_dev(disk)); -- blk_free_devt(disk_to_dev(disk)->devt); - } - EXPORT_SYMBOL(del_gendisk); - -@@ -690,13 +691,13 @@ struct gendisk *get_gendisk(dev_t devt, int *partno) - } else { - struct hd_struct *part; - -- mutex_lock(&ext_devt_mutex); -+ spin_lock(&ext_devt_lock); - part = idr_find(&ext_devt_idr, blk_mangle_minor(MINOR(devt))); - if (part && get_disk(part_to_disk(part))) { - *partno = part->partno; - disk = part_to_disk(part); - } -- mutex_unlock(&ext_devt_mutex); -+ spin_unlock(&ext_devt_lock); - } - - return disk; -@@ -1098,6 +1099,7 @@ static void disk_release(struct device *dev) - { - struct gendisk *disk = dev_to_disk(dev); - -+ blk_free_devt(dev->devt); - disk_release_events(disk); - kfree(disk->random); - disk_replace_part_tbl(disk, NULL); -diff --git a/block/partition-generic.c b/block/partition-generic.c -index 789cdea05893..0d9e5f97f0a8 100644 ---- a/block/partition-generic.c -+++ b/block/partition-generic.c -@@ -211,6 +211,7 @@ static const struct attribute_group *part_attr_groups[] = { - static void part_release(struct device *dev) - { - struct hd_struct *p = dev_to_part(dev); -+ blk_free_devt(dev->devt); - free_part_stats(p); - free_part_info(p); - kfree(p); -@@ -253,7 +254,6 @@ void delete_partition(struct gendisk *disk, int partno) - rcu_assign_pointer(ptbl->last_lookup, NULL); - kobject_put(part->holder_dir); - device_del(part_to_dev(part)); -- blk_free_devt(part_devt(part)); - - hd_struct_put(part); - } -diff --git a/block/partitions/aix.c b/block/partitions/aix.c -index 43be471d9b1d..0931f5136ab2 100644 ---- a/block/partitions/aix.c -+++ b/block/partitions/aix.c -@@ -253,7 +253,7 @@ int aix_partition(struct parsed_partitions *state) - continue; - } - lv_ix = be16_to_cpu(p->lv_ix) - 1; -- if (lv_ix > state->limit) { -+ if (lv_ix >= state->limit) { - cur_lv_ix = -1; - continue; - } -diff --git a/drivers/acpi/acpi_cmos_rtc.c b/drivers/acpi/acpi_cmos_rtc.c -index 84190ed89c04..aff69d9bfcbf 100644 ---- a/drivers/acpi/acpi_cmos_rtc.c -+++ b/drivers/acpi/acpi_cmos_rtc.c -@@ -35,7 +35,7 @@ acpi_cmos_rtc_space_handler(u32 function, acpi_physical_address address, - void *handler_context, void *region_context) - { - int i; -- u8 *value = (u8 *)&value64; -+ u8 *value = (u8 *)value64; - - if (address > 0xff || !value64) - return AE_BAD_PARAMETER; -diff --git a/drivers/acpi/acpica/aclocal.h b/drivers/acpi/acpica/aclocal.h -index d95ca5449ace..e6ab104afe42 100644 ---- a/drivers/acpi/acpica/aclocal.h -+++ b/drivers/acpi/acpica/aclocal.h -@@ -254,6 +254,7 @@ struct acpi_create_field_info { - u32 field_bit_position; - u32 field_bit_length; - u16 resource_length; -+ u16 pin_number_index; - u8 field_flags; - u8 attribute; - u8 field_type; -diff --git a/drivers/acpi/acpica/acobject.h b/drivers/acpi/acpica/acobject.h -index cc7ab6dd724e..a47cc78ffd4f 100644 ---- a/drivers/acpi/acpica/acobject.h -+++ b/drivers/acpi/acpica/acobject.h -@@ -263,6 +263,7 @@ struct acpi_object_region_field { - ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO u16 resource_length; - union acpi_operand_object *region_obj; /* Containing op_region object */ - u8 *resource_buffer; /* resource_template for serial regions/fields */ -+ u16 pin_number_index; /* Index relative to previous Connection/Template */ - }; - - struct acpi_object_bank_field { -diff --git a/drivers/acpi/acpica/dsfield.c b/drivers/acpi/acpica/dsfield.c -index e7a57c554e84..9af55bd6c4d7 100644 ---- a/drivers/acpi/acpica/dsfield.c -+++ b/drivers/acpi/acpica/dsfield.c -@@ -360,6 +360,7 @@ acpi_ds_get_field_names(struct acpi_create_field_info *info, - */ - info->resource_buffer = NULL; - info->connection_node = NULL; -+ info->pin_number_index = 0; - - /* - * A Connection() is either an actual resource descriptor (buffer) -@@ -437,6 +438,7 @@ acpi_ds_get_field_names(struct acpi_create_field_info *info, - } - - info->field_bit_position += info->field_bit_length; -+ info->pin_number_index++; /* Index relative to previous Connection() */ - break; - - default: -diff --git a/drivers/acpi/acpica/evregion.c b/drivers/acpi/acpica/evregion.c -index 144cbb9b73bc..cd4b231ae760 100644 ---- a/drivers/acpi/acpica/evregion.c -+++ b/drivers/acpi/acpica/evregion.c -@@ -142,6 +142,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, - union acpi_operand_object *region_obj2; - void *region_context = NULL; - struct acpi_connection_info *context; -+ acpi_physical_address address; - - ACPI_FUNCTION_TRACE(ev_address_space_dispatch); - -@@ -231,25 +232,23 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, - /* We have everything we need, we can invoke the address space handler */ - - handler = handler_desc->address_space.handler; -- -- ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, -- "Handler %p (@%p) Address %8.8X%8.8X [%s]\n", -- &region_obj->region.handler->address_space, handler, -- ACPI_FORMAT_NATIVE_UINT(region_obj->region.address + -- region_offset), -- acpi_ut_get_region_name(region_obj->region. -- space_id))); -+ address = (region_obj->region.address + region_offset); - - /* - * Special handling for generic_serial_bus and general_purpose_io: - * There are three extra parameters that must be passed to the - * handler via the context: -- * 1) Connection buffer, a resource template from Connection() op. -- * 2) Length of the above buffer. -- * 3) Actual access length from the access_as() op. -+ * 1) Connection buffer, a resource template from Connection() op -+ * 2) Length of the above buffer -+ * 3) Actual access length from the access_as() op -+ * -+ * In addition, for general_purpose_io, the Address and bit_width fields -+ * are defined as follows: -+ * 1) Address is the pin number index of the field (bit offset from -+ * the previous Connection) -+ * 2) bit_width is the actual bit length of the field (number of pins) - */ -- if (((region_obj->region.space_id == ACPI_ADR_SPACE_GSBUS) || -- (region_obj->region.space_id == ACPI_ADR_SPACE_GPIO)) && -+ if ((region_obj->region.space_id == ACPI_ADR_SPACE_GSBUS) && - context && field_obj) { - - /* Get the Connection (resource_template) buffer */ -@@ -258,6 +257,24 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, - context->length = field_obj->field.resource_length; - context->access_length = field_obj->field.access_length; - } -+ if ((region_obj->region.space_id == ACPI_ADR_SPACE_GPIO) && -+ context && field_obj) { -+ -+ /* Get the Connection (resource_template) buffer */ -+ -+ context->connection = field_obj->field.resource_buffer; -+ context->length = field_obj->field.resource_length; -+ context->access_length = field_obj->field.access_length; -+ address = field_obj->field.pin_number_index; -+ bit_width = field_obj->field.bit_length; -+ } -+ -+ ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, -+ "Handler %p (@%p) Address %8.8X%8.8X [%s]\n", -+ &region_obj->region.handler->address_space, handler, -+ ACPI_FORMAT_NATIVE_UINT(address), -+ acpi_ut_get_region_name(region_obj->region. -+ space_id))); - - if (!(handler_desc->address_space.handler_flags & - ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)) { -@@ -271,9 +288,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, - - /* Call the handler */ - -- status = handler(function, -- (region_obj->region.address + region_offset), -- bit_width, value, context, -+ status = handler(function, address, bit_width, value, context, - region_obj2->extra.region_context); - - if (ACPI_FAILURE(status)) { -diff --git a/drivers/acpi/acpica/exfield.c b/drivers/acpi/acpica/exfield.c -index cfd875243421..d36894a228b1 100644 ---- a/drivers/acpi/acpica/exfield.c -+++ b/drivers/acpi/acpica/exfield.c -@@ -178,6 +178,37 @@ acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state, - buffer = &buffer_desc->integer.value; - } - -+ if ((obj_desc->common.type == ACPI_TYPE_LOCAL_REGION_FIELD) && -+ (obj_desc->field.region_obj->region.space_id == -+ ACPI_ADR_SPACE_GPIO)) { -+ /* -+ * For GPIO (general_purpose_io), the Address will be the bit offset -+ * from the previous Connection() operator, making it effectively a -+ * pin number index. The bit_length is the length of the field, which -+ * is thus the number of pins. -+ */ -+ ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, -+ "GPIO FieldRead [FROM]: Pin %u Bits %u\n", -+ obj_desc->field.pin_number_index, -+ obj_desc->field.bit_length)); -+ -+ /* Lock entire transaction if requested */ -+ -+ acpi_ex_acquire_global_lock(obj_desc->common_field.field_flags); -+ -+ /* Perform the write */ -+ -+ status = acpi_ex_access_region(obj_desc, 0, -+ (u64 *)buffer, ACPI_READ); -+ acpi_ex_release_global_lock(obj_desc->common_field.field_flags); -+ if (ACPI_FAILURE(status)) { -+ acpi_ut_remove_reference(buffer_desc); -+ } else { -+ *ret_buffer_desc = buffer_desc; -+ } -+ return_ACPI_STATUS(status); -+ } -+ - ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, - "FieldRead [TO]: Obj %p, Type %X, Buf %p, ByteLen %X\n", - obj_desc, obj_desc->common.type, buffer, -@@ -325,6 +356,42 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc, - - *result_desc = buffer_desc; - return_ACPI_STATUS(status); -+ } else if ((obj_desc->common.type == ACPI_TYPE_LOCAL_REGION_FIELD) && -+ (obj_desc->field.region_obj->region.space_id == -+ ACPI_ADR_SPACE_GPIO)) { -+ /* -+ * For GPIO (general_purpose_io), we will bypass the entire field -+ * mechanism and handoff the bit address and bit width directly to -+ * the handler. The Address will be the bit offset -+ * from the previous Connection() operator, making it effectively a -+ * pin number index. The bit_length is the length of the field, which -+ * is thus the number of pins. -+ */ -+ if (source_desc->common.type != ACPI_TYPE_INTEGER) { -+ return_ACPI_STATUS(AE_AML_OPERAND_TYPE); -+ } -+ -+ ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, -+ "GPIO FieldWrite [FROM]: (%s:%X), Val %.8X [TO]: Pin %u Bits %u\n", -+ acpi_ut_get_type_name(source_desc->common. -+ type), -+ source_desc->common.type, -+ (u32)source_desc->integer.value, -+ obj_desc->field.pin_number_index, -+ obj_desc->field.bit_length)); -+ -+ buffer = &source_desc->integer.value; -+ -+ /* Lock entire transaction if requested */ -+ -+ acpi_ex_acquire_global_lock(obj_desc->common_field.field_flags); -+ -+ /* Perform the write */ -+ -+ status = acpi_ex_access_region(obj_desc, 0, -+ (u64 *)buffer, ACPI_WRITE); -+ acpi_ex_release_global_lock(obj_desc->common_field.field_flags); -+ return_ACPI_STATUS(status); - } - - /* Get a pointer to the data to be written */ -diff --git a/drivers/acpi/acpica/exprep.c b/drivers/acpi/acpica/exprep.c -index 5a588611ab48..8c88cfdec441 100644 ---- a/drivers/acpi/acpica/exprep.c -+++ b/drivers/acpi/acpica/exprep.c -@@ -484,6 +484,8 @@ acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info) - obj_desc->field.resource_length = info->resource_length; - } - -+ obj_desc->field.pin_number_index = info->pin_number_index; -+ - /* Allow full data read from EC address space */ - - if ((obj_desc->field.region_obj->region.space_id == -diff --git a/drivers/acpi/container.c b/drivers/acpi/container.c -index 368f9ddb8480..e4a6f78f3bbc 100644 ---- a/drivers/acpi/container.c -+++ b/drivers/acpi/container.c -@@ -96,6 +96,13 @@ static void container_device_detach(struct acpi_device *adev) - device_unregister(dev); - } - -+static void container_device_online(struct acpi_device *adev) -+{ -+ struct device *dev = acpi_driver_data(adev); -+ -+ kobject_uevent(&dev->kobj, KOBJ_ONLINE); -+} -+ - static struct acpi_scan_handler container_handler = { - .ids = container_device_ids, - .attach = container_device_attach, -@@ -103,6 +110,7 @@ static struct acpi_scan_handler container_handler = { - .hotplug = { - .enabled = true, - .demand_offline = true, -+ .notify_online = container_device_online, - }, - }; - -diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c -index 92d5184e3654..493a342efa44 100644 ---- a/drivers/acpi/scan.c -+++ b/drivers/acpi/scan.c -@@ -106,7 +106,7 @@ static int create_modalias(struct acpi_device *acpi_dev, char *modalias, - list_for_each_entry(id, &acpi_dev->pnp.ids, list) { - count = snprintf(&modalias[len], size, "%s:", id->id); - if (count < 0) -- return EINVAL; -+ return -EINVAL; - if (count >= size) - return -ENOMEM; - len += count; -@@ -2068,6 +2068,9 @@ static void acpi_bus_attach(struct acpi_device *device) - ok: - list_for_each_entry(child, &device->children, node) - acpi_bus_attach(child); -+ -+ if (device->handler && device->handler->hotplug.notify_online) -+ device->handler->hotplug.notify_online(device); - } - - /** -diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c -index b54f8b3c7924..00663d60f6d4 100644 ---- a/drivers/ata/ahci.c -+++ b/drivers/ata/ahci.c -@@ -306,6 +306,14 @@ static const struct pci_device_id ahci_pci_tbl[] = { - { PCI_VDEVICE(INTEL, 0x9c85), board_ahci }, /* Wildcat Point-LP RAID */ - { PCI_VDEVICE(INTEL, 0x9c87), board_ahci }, /* Wildcat Point-LP RAID */ - { PCI_VDEVICE(INTEL, 0x9c8f), board_ahci }, /* Wildcat Point-LP RAID */ -+ { PCI_VDEVICE(INTEL, 0x8c82), board_ahci }, /* 9 Series AHCI */ -+ { PCI_VDEVICE(INTEL, 0x8c83), board_ahci }, /* 9 Series AHCI */ -+ { PCI_VDEVICE(INTEL, 0x8c84), board_ahci }, /* 9 Series RAID */ -+ { PCI_VDEVICE(INTEL, 0x8c85), board_ahci }, /* 9 Series RAID */ -+ { PCI_VDEVICE(INTEL, 0x8c86), board_ahci }, /* 9 Series RAID */ -+ { PCI_VDEVICE(INTEL, 0x8c87), board_ahci }, /* 9 Series RAID */ -+ { PCI_VDEVICE(INTEL, 0x8c8e), board_ahci }, /* 9 Series RAID */ -+ { PCI_VDEVICE(INTEL, 0x8c8f), board_ahci }, /* 9 Series RAID */ - - /* JMicron 360/1/3/5/6, match class to avoid IDE function */ - { PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, -@@ -443,6 +451,8 @@ static const struct pci_device_id ahci_pci_tbl[] = { - { PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x917a), - .driver_data = board_ahci_yes_fbs }, /* 88se9172 */ - { PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x9172), -+ .driver_data = board_ahci_yes_fbs }, /* 88se9182 */ -+ { PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x9182), - .driver_data = board_ahci_yes_fbs }, /* 88se9172 */ - { PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x9192), - .driver_data = board_ahci_yes_fbs }, /* 88se9172 on some Gigabyte */ -diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c -index 6334c8d7c3f1..39f76b987c75 100644 ---- a/drivers/ata/ata_piix.c -+++ b/drivers/ata/ata_piix.c -@@ -340,6 +340,14 @@ static const struct pci_device_id piix_pci_tbl[] = { - { 0x8086, 0x0F21, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata_byt }, - /* SATA Controller IDE (Coleto Creek) */ - { 0x8086, 0x23a6, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, -+ /* SATA Controller IDE (9 Series) */ -+ { 0x8086, 0x8c88, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata_snb }, -+ /* SATA Controller IDE (9 Series) */ -+ { 0x8086, 0x8c89, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata_snb }, -+ /* SATA Controller IDE (9 Series) */ -+ { 0x8086, 0x8c80, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_snb }, -+ /* SATA Controller IDE (9 Series) */ -+ { 0x8086, 0x8c81, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_snb }, - - { } /* terminate list */ - }; -diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c -index f7616036663b..538574f98e22 100644 ---- a/drivers/ata/libata-core.c -+++ b/drivers/ata/libata-core.c -@@ -4227,7 +4227,7 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { - { "Micron_M500*", NULL, ATA_HORKAGE_NO_NCQ_TRIM, }, - { "Crucial_CT???M500SSD*", NULL, ATA_HORKAGE_NO_NCQ_TRIM, }, - { "Micron_M550*", NULL, ATA_HORKAGE_NO_NCQ_TRIM, }, -- { "Crucial_CT???M550SSD*", NULL, ATA_HORKAGE_NO_NCQ_TRIM, }, -+ { "Crucial_CT*M550SSD*", NULL, ATA_HORKAGE_NO_NCQ_TRIM, }, - - /* - * Some WD SATA-I drives spin up and down erratically when the link -diff --git a/drivers/ata/pata_scc.c b/drivers/ata/pata_scc.c -index f35f15f4d83e..f7badaa39eb6 100644 ---- a/drivers/ata/pata_scc.c -+++ b/drivers/ata/pata_scc.c -@@ -586,7 +586,7 @@ static int scc_wait_after_reset(struct ata_link *link, unsigned int devmask, - * Note: Original code is ata_bus_softreset(). - */ - --static unsigned int scc_bus_softreset(struct ata_port *ap, unsigned int devmask, -+static int scc_bus_softreset(struct ata_port *ap, unsigned int devmask, - unsigned long deadline) - { - struct ata_ioports *ioaddr = &ap->ioaddr; -@@ -600,9 +600,7 @@ static unsigned int scc_bus_softreset(struct ata_port *ap, unsigned int devmask, - udelay(20); - out_be32(ioaddr->ctl_addr, ap->ctl); - -- scc_wait_after_reset(&ap->link, devmask, deadline); -- -- return 0; -+ return scc_wait_after_reset(&ap->link, devmask, deadline); - } - - /** -@@ -619,7 +617,8 @@ static int scc_softreset(struct ata_link *link, unsigned int *classes, - { - struct ata_port *ap = link->ap; - unsigned int slave_possible = ap->flags & ATA_FLAG_SLAVE_POSS; -- unsigned int devmask = 0, err_mask; -+ unsigned int devmask = 0; -+ int rc; - u8 err; - - DPRINTK("ENTER\n"); -@@ -635,9 +634,9 @@ static int scc_softreset(struct ata_link *link, unsigned int *classes, - - /* issue bus reset */ - DPRINTK("about to softreset, devmask=%x\n", devmask); -- err_mask = scc_bus_softreset(ap, devmask, deadline); -- if (err_mask) { -- ata_port_err(ap, "SRST failed (err_mask=0x%x)\n", err_mask); -+ rc = scc_bus_softreset(ap, devmask, deadline); -+ if (rc) { -+ ata_port_err(ap, "SRST failed (err_mask=0x%x)\n", rc); - return -EIO; - } - -diff --git a/drivers/base/regmap/regcache.c b/drivers/base/regmap/regcache.c -index d4dd77134814..154e7a8c0a04 100644 ---- a/drivers/base/regmap/regcache.c -+++ b/drivers/base/regmap/regcache.c -@@ -701,7 +701,7 @@ int regcache_sync_block(struct regmap *map, void *block, - unsigned int block_base, unsigned int start, - unsigned int end) - { -- if (regmap_can_raw_write(map)) -+ if (regmap_can_raw_write(map) && !map->use_single_rw) - return regcache_sync_block_raw(map, block, cache_present, - block_base, start, end); - else -diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c -index 6a19515f8a45..2ea056c09aeb 100644 ---- a/drivers/base/regmap/regmap.c -+++ b/drivers/base/regmap/regmap.c -@@ -105,7 +105,7 @@ bool regmap_readable(struct regmap *map, unsigned int reg) - - bool regmap_volatile(struct regmap *map, unsigned int reg) - { -- if (!regmap_readable(map, reg)) -+ if (!map->format.format_write && !regmap_readable(map, reg)) - return false; - - if (map->volatile_reg) -diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c -index b94a311e5ab6..f9c4632d4dd3 100644 ---- a/drivers/clk/clk.c -+++ b/drivers/clk/clk.c -@@ -1487,6 +1487,7 @@ static struct clk *clk_propagate_rate_change(struct clk *clk, unsigned long even - static void clk_change_rate(struct clk *clk) - { - struct clk *child; -+ struct hlist_node *tmp; - unsigned long old_rate; - unsigned long best_parent_rate = 0; - bool skip_set_rate = false; -@@ -1525,7 +1526,11 @@ static void clk_change_rate(struct clk *clk) - if (clk->notifier_count && old_rate != clk->rate) - __clk_notify(clk, POST_RATE_CHANGE, old_rate, clk->rate); - -- hlist_for_each_entry(child, &clk->children, child_node) { -+ /* -+ * Use safe iteration, as change_rate can actually swap parents -+ * for certain clock types. -+ */ -+ hlist_for_each_entry_safe(child, tmp, &clk->children, child_node) { - /* Skip children who will be reparented to another clock */ - if (child->new_parent && child->new_parent != clk) - continue; -diff --git a/drivers/clk/qcom/mmcc-msm8960.c b/drivers/clk/qcom/mmcc-msm8960.c -index 9be47a829144..f3c95d648a53 100644 ---- a/drivers/clk/qcom/mmcc-msm8960.c -+++ b/drivers/clk/qcom/mmcc-msm8960.c -@@ -37,6 +37,8 @@ - #define P_PLL2 2 - #define P_PLL3 3 - -+#define F_MN(f, s, _m, _n) { .freq = f, .src = s, .m = _m, .n = _n } -+ - static u8 mmcc_pxo_pll8_pll2_map[] = { - [P_PXO] = 0, - [P_PLL8] = 2, -@@ -58,8 +60,8 @@ static u8 mmcc_pxo_pll8_pll2_pll3_map[] = { - - static const char *mmcc_pxo_pll8_pll2_pll3[] = { - "pxo", -- "pll2", - "pll8_vote", -+ "pll2", - "pll3", - }; - -@@ -709,18 +711,18 @@ static struct clk_branch csiphy2_timer_clk = { - }; - - static struct freq_tbl clk_tbl_gfx2d[] = { -- { 27000000, P_PXO, 1, 0 }, -- { 48000000, P_PLL8, 1, 8 }, -- { 54857000, P_PLL8, 1, 7 }, -- { 64000000, P_PLL8, 1, 6 }, -- { 76800000, P_PLL8, 1, 5 }, -- { 96000000, P_PLL8, 1, 4 }, -- { 128000000, P_PLL8, 1, 3 }, -- { 145455000, P_PLL2, 2, 11 }, -- { 160000000, P_PLL2, 1, 5 }, -- { 177778000, P_PLL2, 2, 9 }, -- { 200000000, P_PLL2, 1, 4 }, -- { 228571000, P_PLL2, 2, 7 }, -+ F_MN( 27000000, P_PXO, 1, 0), -+ F_MN( 48000000, P_PLL8, 1, 8), -+ F_MN( 54857000, P_PLL8, 1, 7), -+ F_MN( 64000000, P_PLL8, 1, 6), -+ F_MN( 76800000, P_PLL8, 1, 5), -+ F_MN( 96000000, P_PLL8, 1, 4), -+ F_MN(128000000, P_PLL8, 1, 3), -+ F_MN(145455000, P_PLL2, 2, 11), -+ F_MN(160000000, P_PLL2, 1, 5), -+ F_MN(177778000, P_PLL2, 2, 9), -+ F_MN(200000000, P_PLL2, 1, 4), -+ F_MN(228571000, P_PLL2, 2, 7), - { } - }; - -@@ -841,22 +843,22 @@ static struct clk_branch gfx2d1_clk = { - }; - - static struct freq_tbl clk_tbl_gfx3d[] = { -- { 27000000, P_PXO, 1, 0 }, -- { 48000000, P_PLL8, 1, 8 }, -- { 54857000, P_PLL8, 1, 7 }, -- { 64000000, P_PLL8, 1, 6 }, -- { 76800000, P_PLL8, 1, 5 }, -- { 96000000, P_PLL8, 1, 4 }, -- { 128000000, P_PLL8, 1, 3 }, -- { 145455000, P_PLL2, 2, 11 }, -- { 160000000, P_PLL2, 1, 5 }, -- { 177778000, P_PLL2, 2, 9 }, -- { 200000000, P_PLL2, 1, 4 }, -- { 228571000, P_PLL2, 2, 7 }, -- { 266667000, P_PLL2, 1, 3 }, -- { 300000000, P_PLL3, 1, 4 }, -- { 320000000, P_PLL2, 2, 5 }, -- { 400000000, P_PLL2, 1, 2 }, -+ F_MN( 27000000, P_PXO, 1, 0), -+ F_MN( 48000000, P_PLL8, 1, 8), -+ F_MN( 54857000, P_PLL8, 1, 7), -+ F_MN( 64000000, P_PLL8, 1, 6), -+ F_MN( 76800000, P_PLL8, 1, 5), -+ F_MN( 96000000, P_PLL8, 1, 4), -+ F_MN(128000000, P_PLL8, 1, 3), -+ F_MN(145455000, P_PLL2, 2, 11), -+ F_MN(160000000, P_PLL2, 1, 5), -+ F_MN(177778000, P_PLL2, 2, 9), -+ F_MN(200000000, P_PLL2, 1, 4), -+ F_MN(228571000, P_PLL2, 2, 7), -+ F_MN(266667000, P_PLL2, 1, 3), -+ F_MN(300000000, P_PLL3, 1, 4), -+ F_MN(320000000, P_PLL2, 2, 5), -+ F_MN(400000000, P_PLL2, 1, 2), - { } - }; - -@@ -896,7 +898,7 @@ static struct clk_dyn_rcg gfx3d_src = { - .hw.init = &(struct clk_init_data){ - .name = "gfx3d_src", - .parent_names = mmcc_pxo_pll8_pll2_pll3, -- .num_parents = 3, -+ .num_parents = 4, - .ops = &clk_dyn_rcg_ops, - }, - }, -@@ -994,7 +996,7 @@ static struct clk_rcg jpegd_src = { - .ns_reg = 0x00ac, - .p = { - .pre_div_shift = 12, -- .pre_div_width = 2, -+ .pre_div_width = 4, - }, - .s = { - .src_sel_shift = 0, -@@ -1114,7 +1116,7 @@ static struct clk_branch mdp_lut_clk = { - .enable_reg = 0x016c, - .enable_mask = BIT(0), - .hw.init = &(struct clk_init_data){ -- .parent_names = (const char *[]){ "mdp_clk" }, -+ .parent_names = (const char *[]){ "mdp_src" }, - .num_parents = 1, - .name = "mdp_lut_clk", - .ops = &clk_branch_ops, -@@ -1341,15 +1343,15 @@ static struct clk_branch hdmi_app_clk = { - }; - - static struct freq_tbl clk_tbl_vcodec[] = { -- { 27000000, P_PXO, 1, 0 }, -- { 32000000, P_PLL8, 1, 12 }, -- { 48000000, P_PLL8, 1, 8 }, -- { 54860000, P_PLL8, 1, 7 }, -- { 96000000, P_PLL8, 1, 4 }, -- { 133330000, P_PLL2, 1, 6 }, -- { 200000000, P_PLL2, 1, 4 }, -- { 228570000, P_PLL2, 2, 7 }, -- { 266670000, P_PLL2, 1, 3 }, -+ F_MN( 27000000, P_PXO, 1, 0), -+ F_MN( 32000000, P_PLL8, 1, 12), -+ F_MN( 48000000, P_PLL8, 1, 8), -+ F_MN( 54860000, P_PLL8, 1, 7), -+ F_MN( 96000000, P_PLL8, 1, 4), -+ F_MN(133330000, P_PLL2, 1, 6), -+ F_MN(200000000, P_PLL2, 1, 4), -+ F_MN(228570000, P_PLL2, 2, 7), -+ F_MN(266670000, P_PLL2, 1, 3), - { } - }; - -diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c -index 153f4b92cc05..415923606164 100644 ---- a/drivers/cpufreq/cpufreq.c -+++ b/drivers/cpufreq/cpufreq.c -@@ -1225,6 +1225,8 @@ err_get_freq: - per_cpu(cpufreq_cpu_data, j) = NULL; - write_unlock_irqrestore(&cpufreq_driver_lock, flags); - -+ up_write(&policy->rwsem); -+ - if (cpufreq_driver->exit) - cpufreq_driver->exit(policy); - err_set_policy_cpu: -diff --git a/drivers/dma/TODO b/drivers/dma/TODO -index 734ed0206cd5..b8045cd42ee1 100644 ---- a/drivers/dma/TODO -+++ b/drivers/dma/TODO -@@ -7,7 +7,6 @@ TODO for slave dma - - imx-dma - - imx-sdma - - mxs-dma.c -- - dw_dmac - - intel_mid_dma - 4. Check other subsystems for dma drivers and merge/move to dmaengine - 5. Remove dma_slave_config's dma direction. -diff --git a/drivers/dma/dw/core.c b/drivers/dma/dw/core.c -index 01a200cd0189..b0972b3869c7 100644 ---- a/drivers/dma/dw/core.c -+++ b/drivers/dma/dw/core.c -@@ -279,6 +279,15 @@ static void dwc_dostart(struct dw_dma_chan *dwc, struct dw_desc *first) - channel_set_bit(dw, CH_EN, dwc->mask); - } - -+static void dwc_dostart_first_queued(struct dw_dma_chan *dwc) -+{ -+ if (list_empty(&dwc->queue)) -+ return; -+ -+ list_move(dwc->queue.next, &dwc->active_list); -+ dwc_dostart(dwc, dwc_first_active(dwc)); -+} -+ - /*----------------------------------------------------------------------*/ - - static void -@@ -335,10 +344,7 @@ static void dwc_complete_all(struct dw_dma *dw, struct dw_dma_chan *dwc) - * the completed ones. - */ - list_splice_init(&dwc->active_list, &list); -- if (!list_empty(&dwc->queue)) { -- list_move(dwc->queue.next, &dwc->active_list); -- dwc_dostart(dwc, dwc_first_active(dwc)); -- } -+ dwc_dostart_first_queued(dwc); - - spin_unlock_irqrestore(&dwc->lock, flags); - -@@ -467,10 +473,7 @@ static void dwc_scan_descriptors(struct dw_dma *dw, struct dw_dma_chan *dwc) - /* Try to continue after resetting the channel... */ - dwc_chan_disable(dw, dwc); - -- if (!list_empty(&dwc->queue)) { -- list_move(dwc->queue.next, &dwc->active_list); -- dwc_dostart(dwc, dwc_first_active(dwc)); -- } -+ dwc_dostart_first_queued(dwc); - spin_unlock_irqrestore(&dwc->lock, flags); - } - -@@ -677,17 +680,9 @@ static dma_cookie_t dwc_tx_submit(struct dma_async_tx_descriptor *tx) - * possible, perhaps even appending to those already submitted - * for DMA. But this is hard to do in a race-free manner. - */ -- if (list_empty(&dwc->active_list)) { -- dev_vdbg(chan2dev(tx->chan), "%s: started %u\n", __func__, -- desc->txd.cookie); -- list_add_tail(&desc->desc_node, &dwc->active_list); -- dwc_dostart(dwc, dwc_first_active(dwc)); -- } else { -- dev_vdbg(chan2dev(tx->chan), "%s: queued %u\n", __func__, -- desc->txd.cookie); - -- list_add_tail(&desc->desc_node, &dwc->queue); -- } -+ dev_vdbg(chan2dev(tx->chan), "%s: queued %u\n", __func__, desc->txd.cookie); -+ list_add_tail(&desc->desc_node, &dwc->queue); - - spin_unlock_irqrestore(&dwc->lock, flags); - -@@ -1092,9 +1087,12 @@ dwc_tx_status(struct dma_chan *chan, - static void dwc_issue_pending(struct dma_chan *chan) - { - struct dw_dma_chan *dwc = to_dw_dma_chan(chan); -+ unsigned long flags; - -- if (!list_empty(&dwc->queue)) -- dwc_scan_descriptors(to_dw_dma(chan->device), dwc); -+ spin_lock_irqsave(&dwc->lock, flags); -+ if (list_empty(&dwc->active_list)) -+ dwc_dostart_first_queued(dwc); -+ spin_unlock_irqrestore(&dwc->lock, flags); - } - - static int dwc_alloc_chan_resources(struct dma_chan *chan) -diff --git a/drivers/gpu/drm/ast/ast_main.c b/drivers/gpu/drm/ast/ast_main.c -index 50535fd5a88d..d830b38e54f6 100644 ---- a/drivers/gpu/drm/ast/ast_main.c -+++ b/drivers/gpu/drm/ast/ast_main.c -@@ -100,7 +100,7 @@ static int ast_detect_chip(struct drm_device *dev) - } - ast->vga2_clone = false; - } else { -- ast->chip = 2000; -+ ast->chip = AST2000; - DRM_INFO("AST 2000 detected\n"); - } - } -diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c -index 3ecb332e7cfa..7410a507eacc 100644 ---- a/drivers/gpu/drm/i915/i915_gem.c -+++ b/drivers/gpu/drm/i915/i915_gem.c -@@ -1426,10 +1426,13 @@ unlock: - out: - switch (ret) { - case -EIO: -- /* If this -EIO is due to a gpu hang, give the reset code a -- * chance to clean up the mess. Otherwise return the proper -- * SIGBUS. */ -- if (i915_terminally_wedged(&dev_priv->gpu_error)) { -+ /* -+ * We eat errors when the gpu is terminally wedged to avoid -+ * userspace unduly crashing (gl has no provisions for mmaps to -+ * fail). But any other -EIO isn't ours (e.g. swap in failure) -+ * and so needs to be reported. -+ */ -+ if (!i915_terminally_wedged(&dev_priv->gpu_error)) { - ret = VM_FAULT_SIGBUS; - break; - } -diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c -index f22041973f3a..08105fddfd2a 100644 ---- a/drivers/gpu/drm/i915/intel_bios.c -+++ b/drivers/gpu/drm/i915/intel_bios.c -@@ -839,7 +839,7 @@ init_vbt_defaults(struct drm_i915_private *dev_priv) - } - } - --static int __init intel_no_opregion_vbt_callback(const struct dmi_system_id *id) -+static int intel_no_opregion_vbt_callback(const struct dmi_system_id *id) - { - DRM_DEBUG_KMS("Falling back to manually reading VBT from " - "VBIOS ROM for %s\n", -diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c -index b19ddacbe19d..834847527982 100644 ---- a/drivers/gpu/drm/i915/intel_crt.c -+++ b/drivers/gpu/drm/i915/intel_crt.c -@@ -750,7 +750,7 @@ static const struct drm_encoder_funcs intel_crt_enc_funcs = { - .destroy = intel_encoder_destroy, - }; - --static int __init intel_no_crt_dmi_callback(const struct dmi_system_id *id) -+static int intel_no_crt_dmi_callback(const struct dmi_system_id *id) - { - DRM_INFO("Skipping CRT initialization for %s\n", id->ident); - return 1; -diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c -index eb8f64b5fb85..67c9ff389989 100644 ---- a/drivers/gpu/drm/i915/intel_lvds.c -+++ b/drivers/gpu/drm/i915/intel_lvds.c -@@ -544,7 +544,7 @@ static const struct drm_encoder_funcs intel_lvds_enc_funcs = { - .destroy = intel_encoder_destroy, - }; - --static int __init intel_no_lvds_dmi_callback(const struct dmi_system_id *id) -+static int intel_no_lvds_dmi_callback(const struct dmi_system_id *id) - { - DRM_INFO("Skipping LVDS initialization for %s\n", id->ident); - return 1; -diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c -index 31b36c5ac894..d488fc71ef49 100644 ---- a/drivers/gpu/drm/i915/intel_ringbuffer.c -+++ b/drivers/gpu/drm/i915/intel_ringbuffer.c -@@ -475,6 +475,9 @@ static int init_ring_common(struct intel_ring_buffer *ring) - } - } - -+ /* Enforce ordering by reading HEAD register back */ -+ I915_READ_HEAD(ring); -+ - /* Initialize the ring. This must happen _after_ we've cleared the ring - * registers with the above sequence (the readback of the HEAD registers - * also enforces ordering), otherwise the hw might lose the new ring -diff --git a/drivers/gpu/drm/i915/intel_tv.c b/drivers/gpu/drm/i915/intel_tv.c -index 365c7c47c46c..9c9606c8bb1a 100644 ---- a/drivers/gpu/drm/i915/intel_tv.c -+++ b/drivers/gpu/drm/i915/intel_tv.c -@@ -854,6 +854,10 @@ intel_enable_tv(struct intel_encoder *encoder) - struct drm_device *dev = encoder->base.dev; - struct drm_i915_private *dev_priv = dev->dev_private; - -+ /* Prevents vblank waits from timing out in intel_tv_detect_type() */ -+ intel_wait_for_vblank(encoder->base.dev, -+ to_intel_crtc(encoder->base.crtc)->pipe); -+ - I915_WRITE(TV_CTL, I915_READ(TV_CTL) | TV_ENC_ENABLE); - } - -diff --git a/drivers/gpu/drm/nouveau/nouveau_vga.c b/drivers/gpu/drm/nouveau/nouveau_vga.c -index 471347edc27e..a92fb01459c9 100644 ---- a/drivers/gpu/drm/nouveau/nouveau_vga.c -+++ b/drivers/gpu/drm/nouveau/nouveau_vga.c -@@ -100,7 +100,16 @@ void - nouveau_vga_fini(struct nouveau_drm *drm) - { - struct drm_device *dev = drm->dev; -+ bool runtime = false; -+ -+ if (nouveau_runtime_pm == 1) -+ runtime = true; -+ if ((nouveau_runtime_pm == -1) && (nouveau_is_optimus() || nouveau_is_v1_dsm())) -+ runtime = true; -+ - vga_switcheroo_unregister_client(dev->pdev); -+ if (runtime && nouveau_is_v1_dsm() && !nouveau_is_optimus()) -+ vga_switcheroo_fini_domain_pm_ops(drm->dev->dev); - vga_client_register(dev->pdev, NULL, NULL, NULL); - } - -diff --git a/drivers/gpu/drm/radeon/ci_dpm.c b/drivers/gpu/drm/radeon/ci_dpm.c -index 5fa854c84d62..543ba2d4a659 100644 ---- a/drivers/gpu/drm/radeon/ci_dpm.c -+++ b/drivers/gpu/drm/radeon/ci_dpm.c -@@ -851,6 +851,9 @@ static int ci_set_thermal_temperature_range(struct radeon_device *rdev, - WREG32_SMC(CG_THERMAL_CTRL, tmp); - #endif - -+ rdev->pm.dpm.thermal.min_temp = low_temp; -+ rdev->pm.dpm.thermal.max_temp = high_temp; -+ - return 0; - } - -@@ -922,7 +925,18 @@ static void ci_get_leakage_voltages(struct radeon_device *rdev) - pi->vddc_leakage.count = 0; - pi->vddci_leakage.count = 0; - -- if (radeon_atom_get_leakage_id_from_vbios(rdev, &leakage_id) == 0) { -+ if (rdev->pm.dpm.platform_caps & ATOM_PP_PLATFORM_CAP_EVV) { -+ for (i = 0; i < CISLANDS_MAX_LEAKAGE_COUNT; i++) { -+ virtual_voltage_id = ATOM_VIRTUAL_VOLTAGE_ID0 + i; -+ if (radeon_atom_get_voltage_evv(rdev, virtual_voltage_id, &vddc) != 0) -+ continue; -+ if (vddc != 0 && vddc != virtual_voltage_id) { -+ pi->vddc_leakage.actual_voltage[pi->vddc_leakage.count] = vddc; -+ pi->vddc_leakage.leakage_id[pi->vddc_leakage.count] = virtual_voltage_id; -+ pi->vddc_leakage.count++; -+ } -+ } -+ } else if (radeon_atom_get_leakage_id_from_vbios(rdev, &leakage_id) == 0) { - for (i = 0; i < CISLANDS_MAX_LEAKAGE_COUNT; i++) { - virtual_voltage_id = ATOM_VIRTUAL_VOLTAGE_ID0 + i; - if (radeon_atom_get_leakage_vddc_based_on_leakage_params(rdev, &vddc, &vddci, -diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c -index 7b3537c55c77..ab5c26575622 100644 ---- a/drivers/gpu/drm/radeon/cik.c -+++ b/drivers/gpu/drm/radeon/cik.c -@@ -4392,7 +4392,7 @@ struct bonaire_mqd - */ - static int cik_cp_compute_resume(struct radeon_device *rdev) - { -- int r, i, idx; -+ int r, i, j, idx; - u32 tmp; - bool use_doorbell = true; - u64 hqd_gpu_addr; -@@ -4511,7 +4511,7 @@ static int cik_cp_compute_resume(struct radeon_device *rdev) - mqd->queue_state.cp_hqd_pq_wptr= 0; - if (RREG32(CP_HQD_ACTIVE) & 1) { - WREG32(CP_HQD_DEQUEUE_REQUEST, 1); -- for (i = 0; i < rdev->usec_timeout; i++) { -+ for (j = 0; j < rdev->usec_timeout; j++) { - if (!(RREG32(CP_HQD_ACTIVE) & 1)) - break; - udelay(1); -@@ -5545,12 +5545,13 @@ static void cik_vm_decode_fault(struct radeon_device *rdev, - void cik_vm_flush(struct radeon_device *rdev, int ridx, struct radeon_vm *vm) - { - struct radeon_ring *ring = &rdev->ring[ridx]; -+ int usepfp = (ridx == RADEON_RING_TYPE_GFX_INDEX); - - if (vm == NULL) - return; - - radeon_ring_write(ring, PACKET3(PACKET3_WRITE_DATA, 3)); -- radeon_ring_write(ring, (WRITE_DATA_ENGINE_SEL(0) | -+ radeon_ring_write(ring, (WRITE_DATA_ENGINE_SEL(usepfp) | - WRITE_DATA_DST_SEL(0))); - if (vm->id < 8) { - radeon_ring_write(ring, -@@ -5600,7 +5601,7 @@ void cik_vm_flush(struct radeon_device *rdev, int ridx, struct radeon_vm *vm) - radeon_ring_write(ring, 1 << vm->id); - - /* compute doesn't have PFP */ -- if (ridx == RADEON_RING_TYPE_GFX_INDEX) { -+ if (usepfp) { - /* sync PFP to ME, otherwise we might get invalid PFP reads */ - radeon_ring_write(ring, PACKET3(PACKET3_PFP_SYNC_ME, 0)); - radeon_ring_write(ring, 0x0); -diff --git a/drivers/gpu/drm/radeon/cik_sdma.c b/drivers/gpu/drm/radeon/cik_sdma.c -index aac8f487e6df..66ba713ba7d7 100644 ---- a/drivers/gpu/drm/radeon/cik_sdma.c -+++ b/drivers/gpu/drm/radeon/cik_sdma.c -@@ -461,13 +461,6 @@ int cik_sdma_resume(struct radeon_device *rdev) - { - int r; - -- /* Reset dma */ -- WREG32(SRBM_SOFT_RESET, SOFT_RESET_SDMA | SOFT_RESET_SDMA1); -- RREG32(SRBM_SOFT_RESET); -- udelay(50); -- WREG32(SRBM_SOFT_RESET, 0); -- RREG32(SRBM_SOFT_RESET); -- - r = cik_sdma_load_microcode(rdev); - if (r) - return r; -diff --git a/drivers/gpu/drm/radeon/ni_dma.c b/drivers/gpu/drm/radeon/ni_dma.c -index 7cf96b15377f..94fa49e974eb 100644 ---- a/drivers/gpu/drm/radeon/ni_dma.c -+++ b/drivers/gpu/drm/radeon/ni_dma.c -@@ -191,12 +191,6 @@ int cayman_dma_resume(struct radeon_device *rdev) - u32 reg_offset, wb_offset; - int i, r; - -- /* Reset dma */ -- WREG32(SRBM_SOFT_RESET, SOFT_RESET_DMA | SOFT_RESET_DMA1); -- RREG32(SRBM_SOFT_RESET); -- udelay(50); -- WREG32(SRBM_SOFT_RESET, 0); -- - for (i = 0; i < 2; i++) { - if (i == 0) { - ring = &rdev->ring[R600_RING_TYPE_DMA_INDEX]; -diff --git a/drivers/gpu/drm/radeon/r600_dma.c b/drivers/gpu/drm/radeon/r600_dma.c -index b2d4c91e6272..99495513f6b1 100644 ---- a/drivers/gpu/drm/radeon/r600_dma.c -+++ b/drivers/gpu/drm/radeon/r600_dma.c -@@ -124,15 +124,6 @@ int r600_dma_resume(struct radeon_device *rdev) - u32 rb_bufsz; - int r; - -- /* Reset dma */ -- if (rdev->family >= CHIP_RV770) -- WREG32(SRBM_SOFT_RESET, RV770_SOFT_RESET_DMA); -- else -- WREG32(SRBM_SOFT_RESET, SOFT_RESET_DMA); -- RREG32(SRBM_SOFT_RESET); -- udelay(50); -- WREG32(SRBM_SOFT_RESET, 0); -- - WREG32(DMA_SEM_INCOMPLETE_TIMER_CNTL, 0); - WREG32(DMA_SEM_WAIT_FAIL_TIMER_CNTL, 0); - -diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h -index 08e86f90c9a4..b837e9f9f8ce 100644 ---- a/drivers/gpu/drm/radeon/radeon.h -+++ b/drivers/gpu/drm/radeon/radeon.h -@@ -294,6 +294,9 @@ int radeon_atom_get_leakage_vddc_based_on_leakage_params(struct radeon_device *r - u16 *vddc, u16 *vddci, - u16 virtual_voltage_id, - u16 vbios_voltage_id); -+int radeon_atom_get_voltage_evv(struct radeon_device *rdev, -+ u16 virtual_voltage_id, -+ u16 *voltage); - int radeon_atom_round_to_true_voltage(struct radeon_device *rdev, - u8 voltage_type, - u16 nominal_voltage, -diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c b/drivers/gpu/drm/radeon/radeon_atombios.c -index 30844814c25a..e2de749327ad 100644 ---- a/drivers/gpu/drm/radeon/radeon_atombios.c -+++ b/drivers/gpu/drm/radeon/radeon_atombios.c -@@ -447,6 +447,13 @@ static bool radeon_atom_apply_quirks(struct drm_device *dev, - } - } - -+ /* Fujitsu D3003-S2 board lists DVI-I as DVI-I and VGA */ -+ if ((dev->pdev->device == 0x9805) && -+ (dev->pdev->subsystem_vendor == 0x1734) && -+ (dev->pdev->subsystem_device == 0x11bd)) { -+ if (*connector_type == DRM_MODE_CONNECTOR_VGA) -+ return false; -+ } - - return true; - } -@@ -1955,7 +1962,7 @@ static const char *thermal_controller_names[] = { - "adm1032", - "adm1030", - "max6649", -- "lm64", -+ "lm63", /* lm64 */ - "f75375", - "asc7xxx", - }; -@@ -1966,7 +1973,7 @@ static const char *pp_lib_thermal_controller_names[] = { - "adm1032", - "adm1030", - "max6649", -- "lm64", -+ "lm63", /* lm64 */ - "f75375", - "RV6xx", - "RV770", -@@ -2273,19 +2280,31 @@ static void radeon_atombios_add_pplib_thermal_controller(struct radeon_device *r - (controller->ucFanParameters & - ATOM_PP_FANPARAMETERS_NOFAN) ? "without" : "with"); - rdev->pm.int_thermal_type = THERMAL_TYPE_KV; -- } else if ((controller->ucType == -- ATOM_PP_THERMALCONTROLLER_EXTERNAL_GPIO) || -- (controller->ucType == -- ATOM_PP_THERMALCONTROLLER_ADT7473_WITH_INTERNAL) || -- (controller->ucType == -- ATOM_PP_THERMALCONTROLLER_EMC2103_WITH_INTERNAL)) { -- DRM_INFO("Special thermal controller config\n"); -+ } else if (controller->ucType == -+ ATOM_PP_THERMALCONTROLLER_EXTERNAL_GPIO) { -+ DRM_INFO("External GPIO thermal controller %s fan control\n", -+ (controller->ucFanParameters & -+ ATOM_PP_FANPARAMETERS_NOFAN) ? "without" : "with"); -+ rdev->pm.int_thermal_type = THERMAL_TYPE_EXTERNAL_GPIO; -+ } else if (controller->ucType == -+ ATOM_PP_THERMALCONTROLLER_ADT7473_WITH_INTERNAL) { -+ DRM_INFO("ADT7473 with internal thermal controller %s fan control\n", -+ (controller->ucFanParameters & -+ ATOM_PP_FANPARAMETERS_NOFAN) ? "without" : "with"); -+ rdev->pm.int_thermal_type = THERMAL_TYPE_ADT7473_WITH_INTERNAL; -+ } else if (controller->ucType == -+ ATOM_PP_THERMALCONTROLLER_EMC2103_WITH_INTERNAL) { -+ DRM_INFO("EMC2103 with internal thermal controller %s fan control\n", -+ (controller->ucFanParameters & -+ ATOM_PP_FANPARAMETERS_NOFAN) ? "without" : "with"); -+ rdev->pm.int_thermal_type = THERMAL_TYPE_EMC2103_WITH_INTERNAL; - } else if (controller->ucType < ARRAY_SIZE(pp_lib_thermal_controller_names)) { - DRM_INFO("Possible %s thermal controller at 0x%02x %s fan control\n", - pp_lib_thermal_controller_names[controller->ucType], - controller->ucI2cAddress >> 1, - (controller->ucFanParameters & - ATOM_PP_FANPARAMETERS_NOFAN) ? "without" : "with"); -+ rdev->pm.int_thermal_type = THERMAL_TYPE_EXTERNAL; - i2c_bus = radeon_lookup_i2c_gpio(rdev, controller->ucI2cLine); - rdev->pm.i2c_bus = radeon_i2c_lookup(rdev, &i2c_bus); - if (rdev->pm.i2c_bus) { -@@ -3228,6 +3247,41 @@ int radeon_atom_get_leakage_vddc_based_on_leakage_params(struct radeon_device *r - return 0; - } - -+union get_voltage_info { -+ struct _GET_VOLTAGE_INFO_INPUT_PARAMETER_V1_2 in; -+ struct _GET_EVV_VOLTAGE_INFO_OUTPUT_PARAMETER_V1_2 evv_out; -+}; -+ -+int radeon_atom_get_voltage_evv(struct radeon_device *rdev, -+ u16 virtual_voltage_id, -+ u16 *voltage) -+{ -+ int index = GetIndexIntoMasterTable(COMMAND, GetVoltageInfo); -+ u32 entry_id; -+ u32 count = rdev->pm.dpm.dyn_state.vddc_dependency_on_sclk.count; -+ union get_voltage_info args; -+ -+ for (entry_id = 0; entry_id < count; entry_id++) { -+ if (rdev->pm.dpm.dyn_state.vddc_dependency_on_sclk.entries[entry_id].v == -+ virtual_voltage_id) -+ break; -+ } -+ -+ if (entry_id >= count) -+ return -EINVAL; -+ -+ args.in.ucVoltageType = VOLTAGE_TYPE_VDDC; -+ args.in.ucVoltageMode = ATOM_GET_VOLTAGE_EVV_VOLTAGE; -+ args.in.ulSCLKFreq = -+ cpu_to_le32(rdev->pm.dpm.dyn_state.vddc_dependency_on_sclk.entries[entry_id].clk); -+ -+ atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args); -+ -+ *voltage = le16_to_cpu(args.evv_out.usVoltageLevel); -+ -+ return 0; -+} -+ - int radeon_atom_get_voltage_gpio_settings(struct radeon_device *rdev, - u16 voltage_level, u8 voltage_type, - u32 *gpio_value, u32 *gpio_mask) -diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c -index 0bf6f4a2bb97..e39026cc7d07 100644 ---- a/drivers/gpu/drm/radeon/radeon_device.c -+++ b/drivers/gpu/drm/radeon/radeon_device.c -@@ -1314,7 +1314,7 @@ int radeon_device_init(struct radeon_device *rdev, - - r = radeon_init(rdev); - if (r) -- return r; -+ goto failed; - - r = radeon_ib_ring_tests(rdev); - if (r) -@@ -1334,7 +1334,7 @@ int radeon_device_init(struct radeon_device *rdev, - radeon_agp_disable(rdev); - r = radeon_init(rdev); - if (r) -- return r; -+ goto failed; - } - - if ((radeon_testing & 1)) { -@@ -1356,6 +1356,11 @@ int radeon_device_init(struct radeon_device *rdev, - DRM_INFO("radeon: acceleration disabled, skipping benchmarks\n"); - } - return 0; -+ -+failed: -+ if (runtime) -+ vga_switcheroo_fini_domain_pm_ops(rdev->dev); -+ return r; - } - - static void radeon_debugfs_remove_files(struct radeon_device *rdev); -@@ -1376,6 +1381,8 @@ void radeon_device_fini(struct radeon_device *rdev) - radeon_bo_evict_vram(rdev); - radeon_fini(rdev); - vga_switcheroo_unregister_client(rdev->pdev); -+ if (rdev->flags & RADEON_IS_PX) -+ vga_switcheroo_fini_domain_pm_ops(rdev->dev); - vga_client_register(rdev->pdev, NULL, NULL, NULL); - if (rdev->rio_mem) - pci_iounmap(rdev->pdev, rdev->rio_mem); -@@ -1600,7 +1607,6 @@ int radeon_gpu_reset(struct radeon_device *rdev) - radeon_save_bios_scratch_regs(rdev); - /* block TTM */ - resched = ttm_bo_lock_delayed_workqueue(&rdev->mman.bdev); -- radeon_pm_suspend(rdev); - radeon_suspend(rdev); - - for (i = 0; i < RADEON_NUM_RINGS; ++i) { -@@ -1646,9 +1652,24 @@ retry: - } - } - -- radeon_pm_resume(rdev); -+ if ((rdev->pm.pm_method == PM_METHOD_DPM) && rdev->pm.dpm_enabled) { -+ /* do dpm late init */ -+ r = radeon_pm_late_init(rdev); -+ if (r) { -+ rdev->pm.dpm_enabled = false; -+ DRM_ERROR("radeon_pm_late_init failed, disabling dpm\n"); -+ } -+ } else { -+ /* resume old pm late */ -+ radeon_pm_resume(rdev); -+ } -+ - drm_helper_resume_force_mode(rdev->ddev); - -+ /* set the power state here in case we are a PX system or headless */ -+ if ((rdev->pm.pm_method == PM_METHOD_DPM) && rdev->pm.dpm_enabled) -+ radeon_pm_compute_clocks(rdev); -+ - ttm_bo_unlock_delayed_workqueue(&rdev->mman.bdev, resched); - if (r) { - /* bad news, how to tell it to userspace ? */ -diff --git a/drivers/gpu/drm/radeon/radeon_kms.c b/drivers/gpu/drm/radeon/radeon_kms.c -index ea34a31d3bc8..0bc9106ef435 100644 ---- a/drivers/gpu/drm/radeon/radeon_kms.c -+++ b/drivers/gpu/drm/radeon/radeon_kms.c -@@ -254,7 +254,14 @@ static int radeon_info_ioctl(struct drm_device *dev, void *data, struct drm_file - } - break; - case RADEON_INFO_ACCEL_WORKING2: -- *value = rdev->accel_working; -+ if (rdev->family == CHIP_HAWAII) { -+ if (rdev->accel_working) -+ *value = 2; -+ else -+ *value = 0; -+ } else { -+ *value = rdev->accel_working; -+ } - break; - case RADEON_INFO_TILING_CONFIG: - if (rdev->family >= CHIP_BONAIRE) -diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c -index f77d9d0d54b5..cfb513f933d5 100644 ---- a/drivers/gpu/drm/radeon/radeon_pm.c -+++ b/drivers/gpu/drm/radeon/radeon_pm.c -@@ -458,10 +458,6 @@ static ssize_t radeon_get_dpm_state(struct device *dev, - struct radeon_device *rdev = ddev->dev_private; - enum radeon_pm_state_type pm = rdev->pm.dpm.user_state; - -- if ((rdev->flags & RADEON_IS_PX) && -- (ddev->switch_power_state != DRM_SWITCH_POWER_ON)) -- return snprintf(buf, PAGE_SIZE, "off\n"); -- - return snprintf(buf, PAGE_SIZE, "%s\n", - (pm == POWER_STATE_TYPE_BATTERY) ? "battery" : - (pm == POWER_STATE_TYPE_BALANCED) ? "balanced" : "performance"); -@@ -475,11 +471,6 @@ static ssize_t radeon_set_dpm_state(struct device *dev, - struct drm_device *ddev = dev_get_drvdata(dev); - struct radeon_device *rdev = ddev->dev_private; - -- /* Can't set dpm state when the card is off */ -- if ((rdev->flags & RADEON_IS_PX) && -- (ddev->switch_power_state != DRM_SWITCH_POWER_ON)) -- return -EINVAL; -- - mutex_lock(&rdev->pm.mutex); - if (strncmp("battery", buf, strlen("battery")) == 0) - rdev->pm.dpm.user_state = POWER_STATE_TYPE_BATTERY; -@@ -493,7 +484,12 @@ static ssize_t radeon_set_dpm_state(struct device *dev, - goto fail; - } - mutex_unlock(&rdev->pm.mutex); -- radeon_pm_compute_clocks(rdev); -+ -+ /* Can't set dpm state when the card is off */ -+ if (!(rdev->flags & RADEON_IS_PX) || -+ (ddev->switch_power_state == DRM_SWITCH_POWER_ON)) -+ radeon_pm_compute_clocks(rdev); -+ - fail: - return count; - } -@@ -1276,10 +1272,6 @@ int radeon_pm_init(struct radeon_device *rdev) - case CHIP_RS780: - case CHIP_RS880: - case CHIP_RV770: -- case CHIP_BARTS: -- case CHIP_TURKS: -- case CHIP_CAICOS: -- case CHIP_CAYMAN: - /* DPM requires the RLC, RV770+ dGPU requires SMC */ - if (!rdev->rlc_fw) - rdev->pm.pm_method = PM_METHOD_PROFILE; -@@ -1303,6 +1295,10 @@ int radeon_pm_init(struct radeon_device *rdev) - case CHIP_PALM: - case CHIP_SUMO: - case CHIP_SUMO2: -+ case CHIP_BARTS: -+ case CHIP_TURKS: -+ case CHIP_CAICOS: -+ case CHIP_CAYMAN: - case CHIP_ARUBA: - case CHIP_TAHITI: - case CHIP_PITCAIRN: -diff --git a/drivers/gpu/drm/radeon/radeon_semaphore.c b/drivers/gpu/drm/radeon/radeon_semaphore.c -index 9006b32d5eed..eb7b60047e86 100644 ---- a/drivers/gpu/drm/radeon/radeon_semaphore.c -+++ b/drivers/gpu/drm/radeon/radeon_semaphore.c -@@ -34,7 +34,7 @@ - int radeon_semaphore_create(struct radeon_device *rdev, - struct radeon_semaphore **semaphore) - { -- uint32_t *cpu_addr; -+ uint64_t *cpu_addr; - int i, r; - - *semaphore = kmalloc(sizeof(struct radeon_semaphore), GFP_KERNEL); -diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c -index ea93393374df..559564c1dc97 100644 ---- a/drivers/gpu/drm/radeon/si.c -+++ b/drivers/gpu/drm/radeon/si.c -@@ -4810,7 +4810,7 @@ void si_vm_flush(struct radeon_device *rdev, int ridx, struct radeon_vm *vm) - - /* write new base address */ - radeon_ring_write(ring, PACKET3(PACKET3_WRITE_DATA, 3)); -- radeon_ring_write(ring, (WRITE_DATA_ENGINE_SEL(0) | -+ radeon_ring_write(ring, (WRITE_DATA_ENGINE_SEL(1) | - WRITE_DATA_DST_SEL(0))); - - if (vm->id < 8) { -diff --git a/drivers/gpu/drm/radeon/trinity_dpm.c b/drivers/gpu/drm/radeon/trinity_dpm.c -index 2da0e17eb960..d9cfa09b2e3f 100644 ---- a/drivers/gpu/drm/radeon/trinity_dpm.c -+++ b/drivers/gpu/drm/radeon/trinity_dpm.c -@@ -1877,7 +1877,16 @@ int trinity_dpm_init(struct radeon_device *rdev) - for (i = 0; i < SUMO_MAX_HARDWARE_POWERLEVELS; i++) - pi->at[i] = TRINITY_AT_DFLT; - -- pi->enable_bapm = false; -+ /* There are stability issues reported on with -+ * bapm enabled when switching between AC and battery -+ * power. At the same time, some MSI boards hang -+ * if it's not enabled and dpm is enabled. Just enable -+ * it for MSI boards right now. -+ */ -+ if (rdev->pdev->subsystem_vendor == 0x1462) -+ pi->enable_bapm = true; -+ else -+ pi->enable_bapm = false; - pi->enable_nbps_policy = true; - pi->enable_sclk_ds = true; - pi->enable_gfx_power_gating = true; -diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c b/drivers/gpu/drm/tilcdc/tilcdc_drv.c -index 171a8203892c..0644429f8559 100644 ---- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c -+++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c -@@ -122,6 +122,7 @@ static int tilcdc_unload(struct drm_device *dev) - struct tilcdc_drm_private *priv = dev->dev_private; - struct tilcdc_module *mod, *cur; - -+ drm_fbdev_cma_fini(priv->fbdev); - drm_kms_helper_poll_fini(dev); - drm_mode_config_cleanup(dev); - drm_vblank_cleanup(dev); -@@ -628,10 +629,10 @@ static int __init tilcdc_drm_init(void) - static void __exit tilcdc_drm_fini(void) - { - DBG("fini"); -- tilcdc_tfp410_fini(); -- tilcdc_slave_fini(); -- tilcdc_panel_fini(); - platform_driver_unregister(&tilcdc_platform_driver); -+ tilcdc_panel_fini(); -+ tilcdc_slave_fini(); -+ tilcdc_tfp410_fini(); - } - - late_initcall(tilcdc_drm_init); -diff --git a/drivers/gpu/drm/tilcdc/tilcdc_panel.c b/drivers/gpu/drm/tilcdc/tilcdc_panel.c -index 86c67329b605..b085dcc54fb5 100644 ---- a/drivers/gpu/drm/tilcdc/tilcdc_panel.c -+++ b/drivers/gpu/drm/tilcdc/tilcdc_panel.c -@@ -151,6 +151,7 @@ struct panel_connector { - static void panel_connector_destroy(struct drm_connector *connector) - { - struct panel_connector *panel_connector = to_panel_connector(connector); -+ drm_sysfs_connector_remove(connector); - drm_connector_cleanup(connector); - kfree(panel_connector); - } -@@ -285,10 +286,8 @@ static void panel_destroy(struct tilcdc_module *mod) - { - struct panel_module *panel_mod = to_panel_module(mod); - -- if (panel_mod->timings) { -+ if (panel_mod->timings) - display_timings_release(panel_mod->timings); -- kfree(panel_mod->timings); -- } - - tilcdc_module_cleanup(mod); - kfree(panel_mod->info); -diff --git a/drivers/gpu/drm/tilcdc/tilcdc_slave.c b/drivers/gpu/drm/tilcdc/tilcdc_slave.c -index 595068ba2d5e..2f83ffb7f37e 100644 ---- a/drivers/gpu/drm/tilcdc/tilcdc_slave.c -+++ b/drivers/gpu/drm/tilcdc/tilcdc_slave.c -@@ -166,6 +166,7 @@ struct slave_connector { - static void slave_connector_destroy(struct drm_connector *connector) - { - struct slave_connector *slave_connector = to_slave_connector(connector); -+ drm_sysfs_connector_remove(connector); - drm_connector_cleanup(connector); - kfree(slave_connector); - } -diff --git a/drivers/gpu/drm/tilcdc/tilcdc_tfp410.c b/drivers/gpu/drm/tilcdc/tilcdc_tfp410.c -index c38b56b268ac..ce75ac8de4f8 100644 ---- a/drivers/gpu/drm/tilcdc/tilcdc_tfp410.c -+++ b/drivers/gpu/drm/tilcdc/tilcdc_tfp410.c -@@ -167,6 +167,7 @@ struct tfp410_connector { - static void tfp410_connector_destroy(struct drm_connector *connector) - { - struct tfp410_connector *tfp410_connector = to_tfp410_connector(connector); -+ drm_sysfs_connector_remove(connector); - drm_connector_cleanup(connector); - kfree(tfp410_connector); - } -diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc.c b/drivers/gpu/drm/ttm/ttm_page_alloc.c -index 863bef9f9234..cf4bad2c1d59 100644 ---- a/drivers/gpu/drm/ttm/ttm_page_alloc.c -+++ b/drivers/gpu/drm/ttm/ttm_page_alloc.c -@@ -297,8 +297,10 @@ static void ttm_pool_update_free_locked(struct ttm_page_pool *pool, - * - * @pool: to free the pages from - * @free_all: If set to true will free all pages in pool -+ * @gfp: GFP flags. - **/ --static int ttm_page_pool_free(struct ttm_page_pool *pool, unsigned nr_free) -+static int ttm_page_pool_free(struct ttm_page_pool *pool, unsigned nr_free, -+ gfp_t gfp) - { - unsigned long irq_flags; - struct page *p; -@@ -309,8 +311,7 @@ static int ttm_page_pool_free(struct ttm_page_pool *pool, unsigned nr_free) - if (NUM_PAGES_TO_ALLOC < nr_free) - npages_to_free = NUM_PAGES_TO_ALLOC; - -- pages_to_free = kmalloc(npages_to_free * sizeof(struct page *), -- GFP_KERNEL); -+ pages_to_free = kmalloc(npages_to_free * sizeof(struct page *), gfp); - if (!pages_to_free) { - pr_err("Failed to allocate memory for pool free operation\n"); - return 0; -@@ -382,32 +383,35 @@ out: - * - * XXX: (dchinner) Deadlock warning! - * -- * ttm_page_pool_free() does memory allocation using GFP_KERNEL. that means -- * this can deadlock when called a sc->gfp_mask that is not equal to -- * GFP_KERNEL. -+ * We need to pass sc->gfp_mask to ttm_page_pool_free(). - * - * This code is crying out for a shrinker per pool.... - */ - static unsigned long - ttm_pool_shrink_scan(struct shrinker *shrink, struct shrink_control *sc) - { -- static atomic_t start_pool = ATOMIC_INIT(0); -+ static DEFINE_MUTEX(lock); -+ static unsigned start_pool; - unsigned i; -- unsigned pool_offset = atomic_add_return(1, &start_pool); -+ unsigned pool_offset; - struct ttm_page_pool *pool; - int shrink_pages = sc->nr_to_scan; - unsigned long freed = 0; - -- pool_offset = pool_offset % NUM_POOLS; -+ if (!mutex_trylock(&lock)) -+ return SHRINK_STOP; -+ pool_offset = ++start_pool % NUM_POOLS; - /* select start pool in round robin fashion */ - for (i = 0; i < NUM_POOLS; ++i) { - unsigned nr_free = shrink_pages; - if (shrink_pages == 0) - break; - pool = &_manager->pools[(i + pool_offset)%NUM_POOLS]; -- shrink_pages = ttm_page_pool_free(pool, nr_free); -+ shrink_pages = ttm_page_pool_free(pool, nr_free, -+ sc->gfp_mask); - freed += nr_free - shrink_pages; - } -+ mutex_unlock(&lock); - return freed; - } - -@@ -706,7 +710,7 @@ static void ttm_put_pages(struct page **pages, unsigned npages, int flags, - } - spin_unlock_irqrestore(&pool->lock, irq_flags); - if (npages) -- ttm_page_pool_free(pool, npages); -+ ttm_page_pool_free(pool, npages, GFP_KERNEL); - } - - /* -@@ -846,7 +850,8 @@ void ttm_page_alloc_fini(void) - ttm_pool_mm_shrink_fini(_manager); - - for (i = 0; i < NUM_POOLS; ++i) -- ttm_page_pool_free(&_manager->pools[i], FREE_ALL_PAGES); -+ ttm_page_pool_free(&_manager->pools[i], FREE_ALL_PAGES, -+ GFP_KERNEL); - - kobject_put(&_manager->kobj); - _manager = NULL; -diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c b/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c -index fb8259f69839..ca65df144765 100644 ---- a/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c -+++ b/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c -@@ -411,8 +411,10 @@ static void ttm_dma_page_put(struct dma_pool *pool, struct dma_page *d_page) - * - * @pool: to free the pages from - * @nr_free: If set to true will free all pages in pool -+ * @gfp: GFP flags. - **/ --static unsigned ttm_dma_page_pool_free(struct dma_pool *pool, unsigned nr_free) -+static unsigned ttm_dma_page_pool_free(struct dma_pool *pool, unsigned nr_free, -+ gfp_t gfp) - { - unsigned long irq_flags; - struct dma_page *dma_p, *tmp; -@@ -430,8 +432,7 @@ static unsigned ttm_dma_page_pool_free(struct dma_pool *pool, unsigned nr_free) - npages_to_free, nr_free); - } - #endif -- pages_to_free = kmalloc(npages_to_free * sizeof(struct page *), -- GFP_KERNEL); -+ pages_to_free = kmalloc(npages_to_free * sizeof(struct page *), gfp); - - if (!pages_to_free) { - pr_err("%s: Failed to allocate memory for pool free operation\n", -@@ -530,7 +531,7 @@ static void ttm_dma_free_pool(struct device *dev, enum pool_type type) - if (pool->type != type) - continue; - /* Takes a spinlock.. */ -- ttm_dma_page_pool_free(pool, FREE_ALL_PAGES); -+ ttm_dma_page_pool_free(pool, FREE_ALL_PAGES, GFP_KERNEL); - WARN_ON(((pool->npages_in_use + pool->npages_free) != 0)); - /* This code path is called after _all_ references to the - * struct device has been dropped - so nobody should be -@@ -983,7 +984,7 @@ void ttm_dma_unpopulate(struct ttm_dma_tt *ttm_dma, struct device *dev) - - /* shrink pool if necessary (only on !is_cached pools)*/ - if (npages) -- ttm_dma_page_pool_free(pool, npages); -+ ttm_dma_page_pool_free(pool, npages, GFP_KERNEL); - ttm->state = tt_unpopulated; - } - EXPORT_SYMBOL_GPL(ttm_dma_unpopulate); -@@ -993,10 +994,7 @@ EXPORT_SYMBOL_GPL(ttm_dma_unpopulate); - * - * XXX: (dchinner) Deadlock warning! - * -- * ttm_dma_page_pool_free() does GFP_KERNEL memory allocation, and so attention -- * needs to be paid to sc->gfp_mask to determine if this can be done or not. -- * GFP_KERNEL memory allocation in a GFP_ATOMIC reclaim context woul dbe really -- * bad. -+ * We need to pass sc->gfp_mask to ttm_dma_page_pool_free(). - * - * I'm getting sadder as I hear more pathetical whimpers about needing per-pool - * shrinkers -@@ -1004,9 +1002,9 @@ EXPORT_SYMBOL_GPL(ttm_dma_unpopulate); - static unsigned long - ttm_dma_pool_shrink_scan(struct shrinker *shrink, struct shrink_control *sc) - { -- static atomic_t start_pool = ATOMIC_INIT(0); -+ static unsigned start_pool; - unsigned idx = 0; -- unsigned pool_offset = atomic_add_return(1, &start_pool); -+ unsigned pool_offset; - unsigned shrink_pages = sc->nr_to_scan; - struct device_pools *p; - unsigned long freed = 0; -@@ -1014,8 +1012,11 @@ ttm_dma_pool_shrink_scan(struct shrinker *shrink, struct shrink_control *sc) - if (list_empty(&_manager->pools)) - return SHRINK_STOP; - -- mutex_lock(&_manager->lock); -- pool_offset = pool_offset % _manager->npools; -+ if (!mutex_trylock(&_manager->lock)) -+ return SHRINK_STOP; -+ if (!_manager->npools) -+ goto out; -+ pool_offset = ++start_pool % _manager->npools; - list_for_each_entry(p, &_manager->pools, pools) { - unsigned nr_free; - -@@ -1027,13 +1028,15 @@ ttm_dma_pool_shrink_scan(struct shrinker *shrink, struct shrink_control *sc) - if (++idx < pool_offset) - continue; - nr_free = shrink_pages; -- shrink_pages = ttm_dma_page_pool_free(p->pool, nr_free); -+ shrink_pages = ttm_dma_page_pool_free(p->pool, nr_free, -+ sc->gfp_mask); - freed += nr_free - shrink_pages; - - pr_debug("%s: (%s:%d) Asked to shrink %d, have %d more to go\n", - p->pool->dev_name, p->pool->name, current->pid, - nr_free, shrink_pages); - } -+out: - mutex_unlock(&_manager->lock); - return freed; - } -@@ -1044,7 +1047,8 @@ ttm_dma_pool_shrink_count(struct shrinker *shrink, struct shrink_control *sc) - struct device_pools *p; - unsigned long count = 0; - -- mutex_lock(&_manager->lock); -+ if (!mutex_trylock(&_manager->lock)) -+ return 0; - list_for_each_entry(p, &_manager->pools, pools) - count += p->pool->npages_free; - mutex_unlock(&_manager->lock); -diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c b/drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c -index 6ccd993e26bf..6eae14d2a3f7 100644 ---- a/drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c -+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c -@@ -180,8 +180,9 @@ void vmw_fifo_release(struct vmw_private *dev_priv, struct vmw_fifo_state *fifo) - - mutex_lock(&dev_priv->hw_mutex); - -+ vmw_write(dev_priv, SVGA_REG_SYNC, SVGA_SYNC_GENERIC); - while (vmw_read(dev_priv, SVGA_REG_BUSY) != 0) -- vmw_write(dev_priv, SVGA_REG_SYNC, SVGA_SYNC_GENERIC); -+ ; - - dev_priv->last_read_seqno = ioread32(fifo_mem + SVGA_FIFO_FENCE); - -diff --git a/drivers/gpu/vga/vga_switcheroo.c b/drivers/gpu/vga/vga_switcheroo.c -index 6866448083b2..37ac7b5dbd06 100644 ---- a/drivers/gpu/vga/vga_switcheroo.c -+++ b/drivers/gpu/vga/vga_switcheroo.c -@@ -660,6 +660,12 @@ int vga_switcheroo_init_domain_pm_ops(struct device *dev, struct dev_pm_domain * - } - EXPORT_SYMBOL(vga_switcheroo_init_domain_pm_ops); - -+void vga_switcheroo_fini_domain_pm_ops(struct device *dev) -+{ -+ dev->pm_domain = NULL; -+} -+EXPORT_SYMBOL(vga_switcheroo_fini_domain_pm_ops); -+ - static int vga_switcheroo_runtime_resume_hdmi_audio(struct device *dev) - { - struct pci_dev *pdev = to_pci_dev(dev); -diff --git a/drivers/hid/hid-logitech-dj.c b/drivers/hid/hid-logitech-dj.c -index 0b14d3261531..5da115a6fd22 100644 ---- a/drivers/hid/hid-logitech-dj.c -+++ b/drivers/hid/hid-logitech-dj.c -@@ -687,7 +687,6 @@ static int logi_dj_raw_event(struct hid_device *hdev, - struct dj_receiver_dev *djrcv_dev = hid_get_drvdata(hdev); - struct dj_report *dj_report = (struct dj_report *) data; - unsigned long flags; -- bool report_processed = false; - - dbg_hid("%s, size:%d\n", __func__, size); - -@@ -714,34 +713,42 @@ static int logi_dj_raw_event(struct hid_device *hdev, - * device (via hid_input_report() ) and return 1 so hid-core does not do - * anything else with it. - */ -+ -+ /* case 1) */ -+ if (data[0] != REPORT_ID_DJ_SHORT) -+ return false; -+ - if ((dj_report->device_index < DJ_DEVICE_INDEX_MIN) || - (dj_report->device_index > DJ_DEVICE_INDEX_MAX)) { -- dev_err(&hdev->dev, "%s: invalid device index:%d\n", -+ /* -+ * Device index is wrong, bail out. -+ * This driver can ignore safely the receiver notifications, -+ * so ignore those reports too. -+ */ -+ if (dj_report->device_index != DJ_RECEIVER_INDEX) -+ dev_err(&hdev->dev, "%s: invalid device index:%d\n", - __func__, dj_report->device_index); - return false; - } - - spin_lock_irqsave(&djrcv_dev->lock, flags); -- if (dj_report->report_id == REPORT_ID_DJ_SHORT) { -- switch (dj_report->report_type) { -- case REPORT_TYPE_NOTIF_DEVICE_PAIRED: -- case REPORT_TYPE_NOTIF_DEVICE_UNPAIRED: -- logi_dj_recv_queue_notification(djrcv_dev, dj_report); -- break; -- case REPORT_TYPE_NOTIF_CONNECTION_STATUS: -- if (dj_report->report_params[CONNECTION_STATUS_PARAM_STATUS] == -- STATUS_LINKLOSS) { -- logi_dj_recv_forward_null_report(djrcv_dev, dj_report); -- } -- break; -- default: -- logi_dj_recv_forward_report(djrcv_dev, dj_report); -+ switch (dj_report->report_type) { -+ case REPORT_TYPE_NOTIF_DEVICE_PAIRED: -+ case REPORT_TYPE_NOTIF_DEVICE_UNPAIRED: -+ logi_dj_recv_queue_notification(djrcv_dev, dj_report); -+ break; -+ case REPORT_TYPE_NOTIF_CONNECTION_STATUS: -+ if (dj_report->report_params[CONNECTION_STATUS_PARAM_STATUS] == -+ STATUS_LINKLOSS) { -+ logi_dj_recv_forward_null_report(djrcv_dev, dj_report); - } -- report_processed = true; -+ break; -+ default: -+ logi_dj_recv_forward_report(djrcv_dev, dj_report); - } - spin_unlock_irqrestore(&djrcv_dev->lock, flags); - -- return report_processed; -+ return true; - } - - static int logi_dj_probe(struct hid_device *hdev, -diff --git a/drivers/hid/hid-logitech-dj.h b/drivers/hid/hid-logitech-dj.h -index 4a4000340ce1..daeb0aa4bee9 100644 ---- a/drivers/hid/hid-logitech-dj.h -+++ b/drivers/hid/hid-logitech-dj.h -@@ -27,6 +27,7 @@ - - #define DJ_MAX_PAIRED_DEVICES 6 - #define DJ_MAX_NUMBER_NOTIFICATIONS 8 -+#define DJ_RECEIVER_INDEX 0 - #define DJ_DEVICE_INDEX_MIN 1 - #define DJ_DEVICE_INDEX_MAX 6 - -diff --git a/drivers/hid/hid-magicmouse.c b/drivers/hid/hid-magicmouse.c -index 3b43d1cfa936..991ba79cfc72 100644 ---- a/drivers/hid/hid-magicmouse.c -+++ b/drivers/hid/hid-magicmouse.c -@@ -290,6 +290,11 @@ static int magicmouse_raw_event(struct hid_device *hdev, - if (size < 4 || ((size - 4) % 9) != 0) - return 0; - npoints = (size - 4) / 9; -+ if (npoints > 15) { -+ hid_warn(hdev, "invalid size value (%d) for TRACKPAD_REPORT_ID\n", -+ size); -+ return 0; -+ } - msc->ntouches = 0; - for (ii = 0; ii < npoints; ii++) - magicmouse_emit_touch(msc, ii, data + ii * 9 + 4); -@@ -307,6 +312,11 @@ static int magicmouse_raw_event(struct hid_device *hdev, - if (size < 6 || ((size - 6) % 8) != 0) - return 0; - npoints = (size - 6) / 8; -+ if (npoints > 15) { -+ hid_warn(hdev, "invalid size value (%d) for MOUSE_REPORT_ID\n", -+ size); -+ return 0; -+ } - msc->ntouches = 0; - for (ii = 0; ii < npoints; ii++) - magicmouse_emit_touch(msc, ii, data + ii * 8 + 6); -diff --git a/drivers/hid/hid-picolcd_core.c b/drivers/hid/hid-picolcd_core.c -index acbb021065ec..020df3c2e8b4 100644 ---- a/drivers/hid/hid-picolcd_core.c -+++ b/drivers/hid/hid-picolcd_core.c -@@ -350,6 +350,12 @@ static int picolcd_raw_event(struct hid_device *hdev, - if (!data) - return 1; - -+ if (size > 64) { -+ hid_warn(hdev, "invalid size value (%d) for picolcd raw event\n", -+ size); -+ return 0; -+ } -+ - if (report->id == REPORT_KEY_STATE) { - if (data->input_keys) - ret = picolcd_raw_keypad(data, report, raw_data+1, size-1); -diff --git a/drivers/hwmon/ds1621.c b/drivers/hwmon/ds1621.c -index fc6f5d54e7f7..8890870309e4 100644 ---- a/drivers/hwmon/ds1621.c -+++ b/drivers/hwmon/ds1621.c -@@ -309,6 +309,7 @@ static ssize_t set_convrate(struct device *dev, struct device_attribute *da, - data->conf |= (resol << DS1621_REG_CONFIG_RESOL_SHIFT); - i2c_smbus_write_byte_data(client, DS1621_REG_CONF, data->conf); - data->update_interval = ds1721_convrates[resol]; -+ data->zbits = 7 - resol; - mutex_unlock(&data->update_lock); - - return count; -diff --git a/drivers/i2c/busses/i2c-at91.c b/drivers/i2c/busses/i2c-at91.c -index c56be739006b..11e9c7f9bf9b 100644 ---- a/drivers/i2c/busses/i2c-at91.c -+++ b/drivers/i2c/busses/i2c-at91.c -@@ -101,6 +101,7 @@ struct at91_twi_dev { - unsigned twi_cwgr_reg; - struct at91_twi_pdata *pdata; - bool use_dma; -+ bool recv_len_abort; - struct at91_twi_dma dma; - }; - -@@ -267,12 +268,24 @@ static void at91_twi_read_next_byte(struct at91_twi_dev *dev) - *dev->buf = at91_twi_read(dev, AT91_TWI_RHR) & 0xff; - --dev->buf_len; - -+ /* return if aborting, we only needed to read RHR to clear RXRDY*/ -+ if (dev->recv_len_abort) -+ return; -+ - /* handle I2C_SMBUS_BLOCK_DATA */ - if (unlikely(dev->msg->flags & I2C_M_RECV_LEN)) { -- dev->msg->flags &= ~I2C_M_RECV_LEN; -- dev->buf_len += *dev->buf; -- dev->msg->len = dev->buf_len + 1; -- dev_dbg(dev->dev, "received block length %d\n", dev->buf_len); -+ /* ensure length byte is a valid value */ -+ if (*dev->buf <= I2C_SMBUS_BLOCK_MAX && *dev->buf > 0) { -+ dev->msg->flags &= ~I2C_M_RECV_LEN; -+ dev->buf_len += *dev->buf; -+ dev->msg->len = dev->buf_len + 1; -+ dev_dbg(dev->dev, "received block length %d\n", -+ dev->buf_len); -+ } else { -+ /* abort and send the stop by reading one more byte */ -+ dev->recv_len_abort = true; -+ dev->buf_len = 1; -+ } - } - - /* send stop if second but last byte has been read */ -@@ -421,8 +434,8 @@ static int at91_do_twi_transfer(struct at91_twi_dev *dev) - } - } - -- ret = wait_for_completion_interruptible_timeout(&dev->cmd_complete, -- dev->adapter.timeout); -+ ret = wait_for_completion_io_timeout(&dev->cmd_complete, -+ dev->adapter.timeout); - if (ret == 0) { - dev_err(dev->dev, "controller timed out\n"); - at91_init_twi_bus(dev); -@@ -444,6 +457,12 @@ static int at91_do_twi_transfer(struct at91_twi_dev *dev) - ret = -EIO; - goto error; - } -+ if (dev->recv_len_abort) { -+ dev_err(dev->dev, "invalid smbus block length recvd\n"); -+ ret = -EPROTO; -+ goto error; -+ } -+ - dev_dbg(dev->dev, "transfer complete\n"); - - return 0; -@@ -500,6 +519,7 @@ static int at91_twi_xfer(struct i2c_adapter *adap, struct i2c_msg *msg, int num) - dev->buf_len = m_start->len; - dev->buf = m_start->buf; - dev->msg = m_start; -+ dev->recv_len_abort = false; - - ret = at91_do_twi_transfer(dev); - -diff --git a/drivers/i2c/busses/i2c-ismt.c b/drivers/i2c/busses/i2c-ismt.c -index 8ce4f517fc56..6e932d140573 100644 ---- a/drivers/i2c/busses/i2c-ismt.c -+++ b/drivers/i2c/busses/i2c-ismt.c -@@ -497,7 +497,7 @@ static int ismt_access(struct i2c_adapter *adap, u16 addr, - desc->wr_len_cmd = dma_size; - desc->control |= ISMT_DESC_BLK; - priv->dma_buffer[0] = command; -- memcpy(&priv->dma_buffer[1], &data->block[1], dma_size); -+ memcpy(&priv->dma_buffer[1], &data->block[1], dma_size - 1); - } else { - /* Block Read */ - dev_dbg(dev, "I2C_SMBUS_BLOCK_DATA: READ\n"); -@@ -525,7 +525,7 @@ static int ismt_access(struct i2c_adapter *adap, u16 addr, - desc->wr_len_cmd = dma_size; - desc->control |= ISMT_DESC_I2C; - priv->dma_buffer[0] = command; -- memcpy(&priv->dma_buffer[1], &data->block[1], dma_size); -+ memcpy(&priv->dma_buffer[1], &data->block[1], dma_size - 1); - } else { - /* i2c Block Read */ - dev_dbg(dev, "I2C_SMBUS_I2C_BLOCK_DATA: READ\n"); -diff --git a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c -index d52d84937ad3..cf891752cc73 100644 ---- a/drivers/i2c/busses/i2c-mv64xxx.c -+++ b/drivers/i2c/busses/i2c-mv64xxx.c -@@ -748,8 +748,7 @@ mv64xxx_of_config(struct mv64xxx_i2c_data *drv_data, - } - tclk = clk_get_rate(drv_data->clk); - -- rc = of_property_read_u32(np, "clock-frequency", &bus_freq); -- if (rc) -+ if (of_property_read_u32(np, "clock-frequency", &bus_freq)) - bus_freq = 100000; /* 100kHz by default */ - - if (!mv64xxx_find_baud_factors(bus_freq, tclk, -diff --git a/drivers/iio/accel/bma180.c b/drivers/iio/accel/bma180.c -index fe83d04784c8..6f039c300141 100644 ---- a/drivers/iio/accel/bma180.c -+++ b/drivers/iio/accel/bma180.c -@@ -571,7 +571,7 @@ static int bma180_probe(struct i2c_client *client, - trig->ops = &bma180_trigger_ops; - iio_trigger_set_drvdata(trig, indio_dev); - data->trig = trig; -- indio_dev->trig = trig; -+ indio_dev->trig = iio_trigger_get(trig); - - ret = iio_trigger_register(trig); - if (ret) -diff --git a/drivers/iio/adc/ad_sigma_delta.c b/drivers/iio/adc/ad_sigma_delta.c -index 9a4e0e32a771..eb799a43aef0 100644 ---- a/drivers/iio/adc/ad_sigma_delta.c -+++ b/drivers/iio/adc/ad_sigma_delta.c -@@ -472,7 +472,7 @@ static int ad_sd_probe_trigger(struct iio_dev *indio_dev) - goto error_free_irq; - - /* select default trigger */ -- indio_dev->trig = sigma_delta->trig; -+ indio_dev->trig = iio_trigger_get(sigma_delta->trig); - - return 0; - -diff --git a/drivers/iio/common/hid-sensors/hid-sensor-trigger.c b/drivers/iio/common/hid-sensors/hid-sensor-trigger.c -index 7dcf83998e6f..1be235b01934 100644 ---- a/drivers/iio/common/hid-sensors/hid-sensor-trigger.c -+++ b/drivers/iio/common/hid-sensors/hid-sensor-trigger.c -@@ -99,7 +99,8 @@ int hid_sensor_setup_trigger(struct iio_dev *indio_dev, const char *name, - dev_err(&indio_dev->dev, "Trigger Register Failed\n"); - goto error_free_trig; - } -- indio_dev->trig = attrb->trigger = trig; -+ attrb->trigger = trig; -+ indio_dev->trig = iio_trigger_get(trig); - - return ret; - -diff --git a/drivers/iio/common/st_sensors/st_sensors_trigger.c b/drivers/iio/common/st_sensors/st_sensors_trigger.c -index 8fc3a97eb266..8d8ca6f1e16a 100644 ---- a/drivers/iio/common/st_sensors/st_sensors_trigger.c -+++ b/drivers/iio/common/st_sensors/st_sensors_trigger.c -@@ -49,7 +49,7 @@ int st_sensors_allocate_trigger(struct iio_dev *indio_dev, - dev_err(&indio_dev->dev, "failed to register iio trigger.\n"); - goto iio_trigger_register_error; - } -- indio_dev->trig = sdata->trig; -+ indio_dev->trig = iio_trigger_get(sdata->trig); - - return 0; - -diff --git a/drivers/iio/gyro/itg3200_buffer.c b/drivers/iio/gyro/itg3200_buffer.c -index e3b3c5084070..eef50e91f17c 100644 ---- a/drivers/iio/gyro/itg3200_buffer.c -+++ b/drivers/iio/gyro/itg3200_buffer.c -@@ -132,7 +132,7 @@ int itg3200_probe_trigger(struct iio_dev *indio_dev) - goto error_free_irq; - - /* select default trigger */ -- indio_dev->trig = st->trig; -+ indio_dev->trig = iio_trigger_get(st->trig); - - return 0; - -diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_trigger.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_trigger.c -index 03b9372c1212..926fccea8de0 100644 ---- a/drivers/iio/imu/inv_mpu6050/inv_mpu_trigger.c -+++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_trigger.c -@@ -135,7 +135,7 @@ int inv_mpu6050_probe_trigger(struct iio_dev *indio_dev) - ret = iio_trigger_register(st->trig); - if (ret) - goto error_free_irq; -- indio_dev->trig = st->trig; -+ indio_dev->trig = iio_trigger_get(st->trig); - - return 0; - -diff --git a/drivers/iio/inkern.c b/drivers/iio/inkern.c -index 1e8e94d4db7d..4fc88e617acf 100644 ---- a/drivers/iio/inkern.c -+++ b/drivers/iio/inkern.c -@@ -178,7 +178,7 @@ static struct iio_channel *of_iio_channel_get_by_name(struct device_node *np, - index = of_property_match_string(np, "io-channel-names", - name); - chan = of_iio_channel_get(np, index); -- if (!IS_ERR(chan)) -+ if (!IS_ERR(chan) || PTR_ERR(chan) == -EPROBE_DEFER) - break; - else if (name && index >= 0) { - pr_err("ERROR: could not get IIO channel %s:%s(%i)\n", -diff --git a/drivers/iio/magnetometer/st_magn_core.c b/drivers/iio/magnetometer/st_magn_core.c -index 52bbcfa1e077..476aa132a192 100644 ---- a/drivers/iio/magnetometer/st_magn_core.c -+++ b/drivers/iio/magnetometer/st_magn_core.c -@@ -42,7 +42,8 @@ - #define ST_MAGN_FS_AVL_5600MG 5600 - #define ST_MAGN_FS_AVL_8000MG 8000 - #define ST_MAGN_FS_AVL_8100MG 8100 --#define ST_MAGN_FS_AVL_10000MG 10000 -+#define ST_MAGN_FS_AVL_12000MG 12000 -+#define ST_MAGN_FS_AVL_16000MG 16000 - - /* CUSTOM VALUES FOR SENSOR 1 */ - #define ST_MAGN_1_WAI_EXP 0x3c -@@ -69,20 +70,20 @@ - #define ST_MAGN_1_FS_AVL_4700_VAL 0x05 - #define ST_MAGN_1_FS_AVL_5600_VAL 0x06 - #define ST_MAGN_1_FS_AVL_8100_VAL 0x07 --#define ST_MAGN_1_FS_AVL_1300_GAIN_XY 1100 --#define ST_MAGN_1_FS_AVL_1900_GAIN_XY 855 --#define ST_MAGN_1_FS_AVL_2500_GAIN_XY 670 --#define ST_MAGN_1_FS_AVL_4000_GAIN_XY 450 --#define ST_MAGN_1_FS_AVL_4700_GAIN_XY 400 --#define ST_MAGN_1_FS_AVL_5600_GAIN_XY 330 --#define ST_MAGN_1_FS_AVL_8100_GAIN_XY 230 --#define ST_MAGN_1_FS_AVL_1300_GAIN_Z 980 --#define ST_MAGN_1_FS_AVL_1900_GAIN_Z 760 --#define ST_MAGN_1_FS_AVL_2500_GAIN_Z 600 --#define ST_MAGN_1_FS_AVL_4000_GAIN_Z 400 --#define ST_MAGN_1_FS_AVL_4700_GAIN_Z 355 --#define ST_MAGN_1_FS_AVL_5600_GAIN_Z 295 --#define ST_MAGN_1_FS_AVL_8100_GAIN_Z 205 -+#define ST_MAGN_1_FS_AVL_1300_GAIN_XY 909 -+#define ST_MAGN_1_FS_AVL_1900_GAIN_XY 1169 -+#define ST_MAGN_1_FS_AVL_2500_GAIN_XY 1492 -+#define ST_MAGN_1_FS_AVL_4000_GAIN_XY 2222 -+#define ST_MAGN_1_FS_AVL_4700_GAIN_XY 2500 -+#define ST_MAGN_1_FS_AVL_5600_GAIN_XY 3030 -+#define ST_MAGN_1_FS_AVL_8100_GAIN_XY 4347 -+#define ST_MAGN_1_FS_AVL_1300_GAIN_Z 1020 -+#define ST_MAGN_1_FS_AVL_1900_GAIN_Z 1315 -+#define ST_MAGN_1_FS_AVL_2500_GAIN_Z 1666 -+#define ST_MAGN_1_FS_AVL_4000_GAIN_Z 2500 -+#define ST_MAGN_1_FS_AVL_4700_GAIN_Z 2816 -+#define ST_MAGN_1_FS_AVL_5600_GAIN_Z 3389 -+#define ST_MAGN_1_FS_AVL_8100_GAIN_Z 4878 - #define ST_MAGN_1_MULTIREAD_BIT false - - /* CUSTOM VALUES FOR SENSOR 2 */ -@@ -105,10 +106,12 @@ - #define ST_MAGN_2_FS_MASK 0x60 - #define ST_MAGN_2_FS_AVL_4000_VAL 0x00 - #define ST_MAGN_2_FS_AVL_8000_VAL 0x01 --#define ST_MAGN_2_FS_AVL_10000_VAL 0x02 --#define ST_MAGN_2_FS_AVL_4000_GAIN 430 --#define ST_MAGN_2_FS_AVL_8000_GAIN 230 --#define ST_MAGN_2_FS_AVL_10000_GAIN 230 -+#define ST_MAGN_2_FS_AVL_12000_VAL 0x02 -+#define ST_MAGN_2_FS_AVL_16000_VAL 0x03 -+#define ST_MAGN_2_FS_AVL_4000_GAIN 146 -+#define ST_MAGN_2_FS_AVL_8000_GAIN 292 -+#define ST_MAGN_2_FS_AVL_12000_GAIN 438 -+#define ST_MAGN_2_FS_AVL_16000_GAIN 584 - #define ST_MAGN_2_MULTIREAD_BIT false - #define ST_MAGN_2_OUT_X_L_ADDR 0x28 - #define ST_MAGN_2_OUT_Y_L_ADDR 0x2a -@@ -266,9 +269,14 @@ static const struct st_sensors st_magn_sensors[] = { - .gain = ST_MAGN_2_FS_AVL_8000_GAIN, - }, - [2] = { -- .num = ST_MAGN_FS_AVL_10000MG, -- .value = ST_MAGN_2_FS_AVL_10000_VAL, -- .gain = ST_MAGN_2_FS_AVL_10000_GAIN, -+ .num = ST_MAGN_FS_AVL_12000MG, -+ .value = ST_MAGN_2_FS_AVL_12000_VAL, -+ .gain = ST_MAGN_2_FS_AVL_12000_GAIN, -+ }, -+ [3] = { -+ .num = ST_MAGN_FS_AVL_16000MG, -+ .value = ST_MAGN_2_FS_AVL_16000_VAL, -+ .gain = ST_MAGN_2_FS_AVL_16000_GAIN, - }, - }, - }, -diff --git a/drivers/infiniband/core/uverbs_marshall.c b/drivers/infiniband/core/uverbs_marshall.c -index e7bee46868d1..abd97247443e 100644 ---- a/drivers/infiniband/core/uverbs_marshall.c -+++ b/drivers/infiniband/core/uverbs_marshall.c -@@ -140,5 +140,9 @@ void ib_copy_path_rec_from_user(struct ib_sa_path_rec *dst, - dst->packet_life_time = src->packet_life_time; - dst->preference = src->preference; - dst->packet_life_time_selector = src->packet_life_time_selector; -+ -+ memset(dst->smac, 0, sizeof(dst->smac)); -+ memset(dst->dmac, 0, sizeof(dst->dmac)); -+ dst->vlan_id = 0xffff; - } - EXPORT_SYMBOL(ib_copy_path_rec_from_user); -diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c -index f9c12e92fdd6..11f0606792bb 100644 ---- a/drivers/infiniband/hw/mlx4/main.c -+++ b/drivers/infiniband/hw/mlx4/main.c -@@ -1622,6 +1622,7 @@ static void mlx4_ib_get_dev_addr(struct net_device *dev, - struct inet6_dev *in6_dev; - union ib_gid *pgid; - struct inet6_ifaddr *ifp; -+ union ib_gid default_gid; - #endif - union ib_gid gid; - -@@ -1642,12 +1643,15 @@ static void mlx4_ib_get_dev_addr(struct net_device *dev, - in_dev_put(in_dev); - } - #if IS_ENABLED(CONFIG_IPV6) -+ mlx4_make_default_gid(dev, &default_gid); - /* IPv6 gids */ - in6_dev = in6_dev_get(dev); - if (in6_dev) { - read_lock_bh(&in6_dev->lock); - list_for_each_entry(ifp, &in6_dev->addr_list, if_list) { - pgid = (union ib_gid *)&ifp->addr; -+ if (!memcmp(pgid, &default_gid, sizeof(*pgid))) -+ continue; - update_gid_table(ibdev, port, pgid, 0, 0); - } - read_unlock_bh(&in6_dev->lock); -@@ -1723,31 +1727,34 @@ static void mlx4_ib_scan_netdevs(struct mlx4_ib_dev *ibdev) - port_state = (netif_running(curr_netdev) && netif_carrier_ok(curr_netdev)) ? - IB_PORT_ACTIVE : IB_PORT_DOWN; - mlx4_ib_set_default_gid(ibdev, curr_netdev, port); -- } else { -- reset_gid_table(ibdev, port); -- } -- /* if using bonding/team and a slave port is down, we don't the bond IP -- * based gids in the table since flows that select port by gid may get -- * the down port. -- */ -- if (curr_master && (port_state == IB_PORT_DOWN)) { -- reset_gid_table(ibdev, port); -- mlx4_ib_set_default_gid(ibdev, curr_netdev, port); -- } -- /* if bonding is used it is possible that we add it to masters -- * only after IP address is assigned to the net bonding -- * interface. -- */ -- if (curr_master && (old_master != curr_master)) { -- reset_gid_table(ibdev, port); -- mlx4_ib_set_default_gid(ibdev, curr_netdev, port); -- mlx4_ib_get_dev_addr(curr_master, ibdev, port); -- } -+ /* if using bonding/team and a slave port is down, we -+ * don't the bond IP based gids in the table since -+ * flows that select port by gid may get the down port. -+ */ -+ if (curr_master && (port_state == IB_PORT_DOWN)) { -+ reset_gid_table(ibdev, port); -+ mlx4_ib_set_default_gid(ibdev, -+ curr_netdev, port); -+ } -+ /* if bonding is used it is possible that we add it to -+ * masters only after IP address is assigned to the -+ * net bonding interface. -+ */ -+ if (curr_master && (old_master != curr_master)) { -+ reset_gid_table(ibdev, port); -+ mlx4_ib_set_default_gid(ibdev, -+ curr_netdev, port); -+ mlx4_ib_get_dev_addr(curr_master, ibdev, port); -+ } - -- if (!curr_master && (old_master != curr_master)) { -+ if (!curr_master && (old_master != curr_master)) { -+ reset_gid_table(ibdev, port); -+ mlx4_ib_set_default_gid(ibdev, -+ curr_netdev, port); -+ mlx4_ib_get_dev_addr(curr_netdev, ibdev, port); -+ } -+ } else { - reset_gid_table(ibdev, port); -- mlx4_ib_set_default_gid(ibdev, curr_netdev, port); -- mlx4_ib_get_dev_addr(curr_netdev, ibdev, port); - } - } - -diff --git a/drivers/infiniband/hw/qib/qib_debugfs.c b/drivers/infiniband/hw/qib/qib_debugfs.c -index 799a0c3bffc4..6abd3ed3cd51 100644 ---- a/drivers/infiniband/hw/qib/qib_debugfs.c -+++ b/drivers/infiniband/hw/qib/qib_debugfs.c -@@ -193,6 +193,7 @@ static void *_qp_stats_seq_start(struct seq_file *s, loff_t *pos) - struct qib_qp_iter *iter; - loff_t n = *pos; - -+ rcu_read_lock(); - iter = qib_qp_iter_init(s->private); - if (!iter) - return NULL; -@@ -224,7 +225,7 @@ static void *_qp_stats_seq_next(struct seq_file *s, void *iter_ptr, - - static void _qp_stats_seq_stop(struct seq_file *s, void *iter_ptr) - { -- /* nothing for now */ -+ rcu_read_unlock(); - } - - static int _qp_stats_seq_show(struct seq_file *s, void *iter_ptr) -diff --git a/drivers/infiniband/hw/qib/qib_qp.c b/drivers/infiniband/hw/qib/qib_qp.c -index 0cad0c40d742..6a71b2b41b27 100644 ---- a/drivers/infiniband/hw/qib/qib_qp.c -+++ b/drivers/infiniband/hw/qib/qib_qp.c -@@ -1324,7 +1324,6 @@ int qib_qp_iter_next(struct qib_qp_iter *iter) - struct qib_qp *pqp = iter->qp; - struct qib_qp *qp; - -- rcu_read_lock(); - for (; n < dev->qp_table_size; n++) { - if (pqp) - qp = rcu_dereference(pqp->next); -@@ -1332,18 +1331,11 @@ int qib_qp_iter_next(struct qib_qp_iter *iter) - qp = rcu_dereference(dev->qp_table[n]); - pqp = qp; - if (qp) { -- if (iter->qp) -- atomic_dec(&iter->qp->refcount); -- atomic_inc(&qp->refcount); -- rcu_read_unlock(); - iter->qp = qp; - iter->n = n; - return 0; - } - } -- rcu_read_unlock(); -- if (iter->qp) -- atomic_dec(&iter->qp->refcount); - return ret; - } - -diff --git a/drivers/infiniband/ulp/isert/ib_isert.c b/drivers/infiniband/ulp/isert/ib_isert.c -index 156205a81523..c5c194c2e0b6 100644 ---- a/drivers/infiniband/ulp/isert/ib_isert.c -+++ b/drivers/infiniband/ulp/isert/ib_isert.c -@@ -511,7 +511,6 @@ isert_connect_request(struct rdma_cm_id *cma_id, struct rdma_cm_event *event) - init_completion(&isert_conn->conn_wait); - init_completion(&isert_conn->conn_wait_comp_err); - kref_init(&isert_conn->conn_kref); -- kref_get(&isert_conn->conn_kref); - mutex_init(&isert_conn->conn_mutex); - spin_lock_init(&isert_conn->conn_lock); - INIT_LIST_HEAD(&isert_conn->conn_fr_pool); -@@ -663,7 +662,9 @@ isert_connect_release(struct isert_conn *isert_conn) - static void - isert_connected_handler(struct rdma_cm_id *cma_id) - { -- return; -+ struct isert_conn *isert_conn = cma_id->context; -+ -+ kref_get(&isert_conn->conn_kref); - } - - static void -@@ -715,7 +716,6 @@ isert_disconnect_work(struct work_struct *work) - - wake_up: - complete(&isert_conn->conn_wait); -- isert_put_conn(isert_conn); - } - - static void -@@ -2800,6 +2800,7 @@ static void isert_wait_conn(struct iscsi_conn *conn) - wait_for_completion(&isert_conn->conn_wait_comp_err); - - wait_for_completion(&isert_conn->conn_wait); -+ isert_put_conn(isert_conn); - } - - static void isert_free_conn(struct iscsi_conn *conn) -diff --git a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c -index 2dd1d0dd4f7d..6f5d79569136 100644 ---- a/drivers/input/keyboard/atkbd.c -+++ b/drivers/input/keyboard/atkbd.c -@@ -1791,14 +1791,6 @@ static const struct dmi_system_id atkbd_dmi_quirk_table[] __initconst = { - { - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "LG Electronics"), -- DMI_MATCH(DMI_PRODUCT_NAME, "LW25-B7HV"), -- }, -- .callback = atkbd_deactivate_fixup, -- }, -- { -- .matches = { -- DMI_MATCH(DMI_SYS_VENDOR, "LG Electronics"), -- DMI_MATCH(DMI_PRODUCT_NAME, "P1-J273B"), - }, - .callback = atkbd_deactivate_fixup, - }, -diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c -index 233516aff595..0b75b5764f31 100644 ---- a/drivers/input/mouse/elantech.c -+++ b/drivers/input/mouse/elantech.c -@@ -1253,6 +1253,13 @@ static bool elantech_is_signature_valid(const unsigned char *param) - if (param[1] == 0) - return true; - -+ /* -+ * Some models have a revision higher then 20. Meaning param[2] may -+ * be 10 or 20, skip the rates check for these. -+ */ -+ if (param[0] == 0x46 && (param[1] & 0xef) == 0x0f && param[2] < 40) -+ return true; -+ - for (i = 0; i < ARRAY_SIZE(rates); i++) - if (param[2] == rates[i]) - return false; -diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c -index ef9e0b8a9aa7..a50a2a7a43f7 100644 ---- a/drivers/input/mouse/synaptics.c -+++ b/drivers/input/mouse/synaptics.c -@@ -626,10 +626,61 @@ static int synaptics_parse_hw_state(const unsigned char buf[], - ((buf[0] & 0x04) >> 1) | - ((buf[3] & 0x04) >> 2)); - -+ if ((SYN_CAP_ADV_GESTURE(priv->ext_cap_0c) || -+ SYN_CAP_IMAGE_SENSOR(priv->ext_cap_0c)) && -+ hw->w == 2) { -+ synaptics_parse_agm(buf, priv, hw); -+ return 1; -+ } -+ -+ hw->x = (((buf[3] & 0x10) << 8) | -+ ((buf[1] & 0x0f) << 8) | -+ buf[4]); -+ hw->y = (((buf[3] & 0x20) << 7) | -+ ((buf[1] & 0xf0) << 4) | -+ buf[5]); -+ hw->z = buf[2]; -+ - hw->left = (buf[0] & 0x01) ? 1 : 0; - hw->right = (buf[0] & 0x02) ? 1 : 0; - -- if (SYN_CAP_CLICKPAD(priv->ext_cap_0c)) { -+ if (SYN_CAP_FORCEPAD(priv->ext_cap_0c)) { -+ /* -+ * ForcePads, like Clickpads, use middle button -+ * bits to report primary button clicks. -+ * Unfortunately they report primary button not -+ * only when user presses on the pad above certain -+ * threshold, but also when there are more than one -+ * finger on the touchpad, which interferes with -+ * out multi-finger gestures. -+ */ -+ if (hw->z == 0) { -+ /* No contacts */ -+ priv->press = priv->report_press = false; -+ } else if (hw->w >= 4 && ((buf[0] ^ buf[3]) & 0x01)) { -+ /* -+ * Single-finger touch with pressure above -+ * the threshold. If pressure stays long -+ * enough, we'll start reporting primary -+ * button. We rely on the device continuing -+ * sending data even if finger does not -+ * move. -+ */ -+ if (!priv->press) { -+ priv->press_start = jiffies; -+ priv->press = true; -+ } else if (time_after(jiffies, -+ priv->press_start + -+ msecs_to_jiffies(50))) { -+ priv->report_press = true; -+ } -+ } else { -+ priv->press = false; -+ } -+ -+ hw->left = priv->report_press; -+ -+ } else if (SYN_CAP_CLICKPAD(priv->ext_cap_0c)) { - /* - * Clickpad's button is transmitted as middle button, - * however, since it is primary button, we will report -@@ -648,21 +699,6 @@ static int synaptics_parse_hw_state(const unsigned char buf[], - hw->down = ((buf[0] ^ buf[3]) & 0x02) ? 1 : 0; - } - -- if ((SYN_CAP_ADV_GESTURE(priv->ext_cap_0c) || -- SYN_CAP_IMAGE_SENSOR(priv->ext_cap_0c)) && -- hw->w == 2) { -- synaptics_parse_agm(buf, priv, hw); -- return 1; -- } -- -- hw->x = (((buf[3] & 0x10) << 8) | -- ((buf[1] & 0x0f) << 8) | -- buf[4]); -- hw->y = (((buf[3] & 0x20) << 7) | -- ((buf[1] & 0xf0) << 4) | -- buf[5]); -- hw->z = buf[2]; -- - if (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap) && - ((buf[0] ^ buf[3]) & 0x02)) { - switch (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap) & ~0x01) { -diff --git a/drivers/input/mouse/synaptics.h b/drivers/input/mouse/synaptics.h -index e594af0b264b..fb2e076738ae 100644 ---- a/drivers/input/mouse/synaptics.h -+++ b/drivers/input/mouse/synaptics.h -@@ -78,6 +78,11 @@ - * 2 0x08 image sensor image sensor tracks 5 fingers, but only - * reports 2. - * 2 0x20 report min query 0x0f gives min coord reported -+ * 2 0x80 forcepad forcepad is a variant of clickpad that -+ * does not have physical buttons but rather -+ * uses pressure above certain threshold to -+ * report primary clicks. Forcepads also have -+ * clickpad bit set. - */ - #define SYN_CAP_CLICKPAD(ex0c) ((ex0c) & 0x100000) /* 1-button ClickPad */ - #define SYN_CAP_CLICKPAD2BTN(ex0c) ((ex0c) & 0x000100) /* 2-button ClickPad */ -@@ -86,6 +91,7 @@ - #define SYN_CAP_ADV_GESTURE(ex0c) ((ex0c) & 0x080000) - #define SYN_CAP_REDUCED_FILTERING(ex0c) ((ex0c) & 0x000400) - #define SYN_CAP_IMAGE_SENSOR(ex0c) ((ex0c) & 0x000800) -+#define SYN_CAP_FORCEPAD(ex0c) ((ex0c) & 0x008000) - - /* synaptics modes query bits */ - #define SYN_MODE_ABSOLUTE(m) ((m) & (1 << 7)) -@@ -177,6 +183,11 @@ struct synaptics_data { - */ - struct synaptics_hw_state agm; - bool agm_pending; /* new AGM packet received */ -+ -+ /* ForcePad handling */ -+ unsigned long press_start; -+ bool press; -+ bool report_press; - }; - - void synaptics_module_init(void); -diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h -index 381b20d4c561..f1da362c3e65 100644 ---- a/drivers/input/serio/i8042-x86ia64io.h -+++ b/drivers/input/serio/i8042-x86ia64io.h -@@ -458,6 +458,13 @@ static const struct dmi_system_id __initconst i8042_dmi_nomux_table[] = { - DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion dv4 Notebook PC"), - }, - }, -+ { -+ /* Avatar AVIU-145A6 */ -+ .matches = { -+ DMI_MATCH(DMI_SYS_VENDOR, "Intel"), -+ DMI_MATCH(DMI_PRODUCT_NAME, "IC4I"), -+ }, -+ }, - { } - }; - -@@ -601,6 +608,14 @@ static const struct dmi_system_id __initconst i8042_dmi_notimeout_table[] = { - DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion dv4 Notebook PC"), - }, - }, -+ { -+ /* Fujitsu U574 laptop */ -+ /* https://bugzilla.kernel.org/show_bug.cgi?id=69731 */ -+ .matches = { -+ DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"), -+ DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK U574"), -+ }, -+ }, - { } - }; - -diff --git a/drivers/input/serio/serport.c b/drivers/input/serio/serport.c -index 0cb7ef59071b..69175b825346 100644 ---- a/drivers/input/serio/serport.c -+++ b/drivers/input/serio/serport.c -@@ -21,6 +21,7 @@ - #include <linux/init.h> - #include <linux/serio.h> - #include <linux/tty.h> -+#include <linux/compat.h> - - MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>"); - MODULE_DESCRIPTION("Input device TTY line discipline"); -@@ -198,28 +199,55 @@ static ssize_t serport_ldisc_read(struct tty_struct * tty, struct file * file, u - return 0; - } - -+static void serport_set_type(struct tty_struct *tty, unsigned long type) -+{ -+ struct serport *serport = tty->disc_data; -+ -+ serport->id.proto = type & 0x000000ff; -+ serport->id.id = (type & 0x0000ff00) >> 8; -+ serport->id.extra = (type & 0x00ff0000) >> 16; -+} -+ - /* - * serport_ldisc_ioctl() allows to set the port protocol, and device ID - */ - --static int serport_ldisc_ioctl(struct tty_struct * tty, struct file * file, unsigned int cmd, unsigned long arg) -+static int serport_ldisc_ioctl(struct tty_struct *tty, struct file *file, -+ unsigned int cmd, unsigned long arg) - { -- struct serport *serport = (struct serport*) tty->disc_data; -- unsigned long type; -- - if (cmd == SPIOCSTYPE) { -+ unsigned long type; -+ - if (get_user(type, (unsigned long __user *) arg)) - return -EFAULT; - -- serport->id.proto = type & 0x000000ff; -- serport->id.id = (type & 0x0000ff00) >> 8; -- serport->id.extra = (type & 0x00ff0000) >> 16; -+ serport_set_type(tty, type); -+ return 0; -+ } -+ -+ return -EINVAL; -+} -+ -+#ifdef CONFIG_COMPAT -+#define COMPAT_SPIOCSTYPE _IOW('q', 0x01, compat_ulong_t) -+static long serport_ldisc_compat_ioctl(struct tty_struct *tty, -+ struct file *file, -+ unsigned int cmd, unsigned long arg) -+{ -+ if (cmd == COMPAT_SPIOCSTYPE) { -+ void __user *uarg = compat_ptr(arg); -+ compat_ulong_t compat_type; -+ -+ if (get_user(compat_type, (compat_ulong_t __user *)uarg)) -+ return -EFAULT; - -+ serport_set_type(tty, compat_type); - return 0; - } - - return -EINVAL; - } -+#endif - - static void serport_ldisc_write_wakeup(struct tty_struct * tty) - { -@@ -243,6 +271,9 @@ static struct tty_ldisc_ops serport_ldisc = { - .close = serport_ldisc_close, - .read = serport_ldisc_read, - .ioctl = serport_ldisc_ioctl, -+#ifdef CONFIG_COMPAT -+ .compat_ioctl = serport_ldisc_compat_ioctl, -+#endif - .receive_buf = serport_ldisc_receive, - .write_wakeup = serport_ldisc_write_wakeup - }; -diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c -index 1d9ab39af29f..2ecac467f78f 100644 ---- a/drivers/iommu/arm-smmu.c -+++ b/drivers/iommu/arm-smmu.c -@@ -794,8 +794,11 @@ static void arm_smmu_init_context_bank(struct arm_smmu_domain *smmu_domain) - reg |= TTBCR_EAE | - (TTBCR_SH_IS << TTBCR_SH0_SHIFT) | - (TTBCR_RGN_WBWA << TTBCR_ORGN0_SHIFT) | -- (TTBCR_RGN_WBWA << TTBCR_IRGN0_SHIFT) | -- (TTBCR_SL0_LVL_1 << TTBCR_SL0_SHIFT); -+ (TTBCR_RGN_WBWA << TTBCR_IRGN0_SHIFT); -+ -+ if (!stage1) -+ reg |= (TTBCR_SL0_LVL_1 << TTBCR_SL0_SHIFT); -+ - writel_relaxed(reg, cb_base + ARM_SMMU_CB_TTBCR); - - /* MAIR0 (stage-1 only) */ -diff --git a/drivers/md/dm-cache-target.c b/drivers/md/dm-cache-target.c -index 735e939a846d..2331543005b2 100644 ---- a/drivers/md/dm-cache-target.c -+++ b/drivers/md/dm-cache-target.c -@@ -890,8 +890,8 @@ static void migration_success_pre_commit(struct dm_cache_migration *mg) - struct cache *cache = mg->cache; - - if (mg->writeback) { -- cell_defer(cache, mg->old_ocell, false); - clear_dirty(cache, mg->old_oblock, mg->cblock); -+ cell_defer(cache, mg->old_ocell, false); - cleanup_migration(mg); - return; - -@@ -946,13 +946,13 @@ static void migration_success_post_commit(struct dm_cache_migration *mg) - } - - } else { -+ clear_dirty(cache, mg->new_oblock, mg->cblock); - if (mg->requeue_holder) - cell_defer(cache, mg->new_ocell, true); - else { - bio_endio(mg->new_ocell->holder, 0); - cell_defer(cache, mg->new_ocell, false); - } -- clear_dirty(cache, mg->new_oblock, mg->cblock); - cleanup_migration(mg); - } - } -diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c -index 53b213226c01..9533f835ce07 100644 ---- a/drivers/md/dm-crypt.c -+++ b/drivers/md/dm-crypt.c -@@ -1681,6 +1681,7 @@ static int crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv) - unsigned int key_size, opt_params; - unsigned long long tmpll; - int ret; -+ size_t iv_size_padding; - struct dm_arg_set as; - const char *opt_string; - char dummy; -@@ -1717,12 +1718,23 @@ static int crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv) - - cc->dmreq_start = sizeof(struct ablkcipher_request); - cc->dmreq_start += crypto_ablkcipher_reqsize(any_tfm(cc)); -- cc->dmreq_start = ALIGN(cc->dmreq_start, crypto_tfm_ctx_alignment()); -- cc->dmreq_start += crypto_ablkcipher_alignmask(any_tfm(cc)) & -- ~(crypto_tfm_ctx_alignment() - 1); -+ cc->dmreq_start = ALIGN(cc->dmreq_start, __alignof__(struct dm_crypt_request)); -+ -+ if (crypto_ablkcipher_alignmask(any_tfm(cc)) < CRYPTO_MINALIGN) { -+ /* Allocate the padding exactly */ -+ iv_size_padding = -(cc->dmreq_start + sizeof(struct dm_crypt_request)) -+ & crypto_ablkcipher_alignmask(any_tfm(cc)); -+ } else { -+ /* -+ * If the cipher requires greater alignment than kmalloc -+ * alignment, we don't know the exact position of the -+ * initialization vector. We must assume worst case. -+ */ -+ iv_size_padding = crypto_ablkcipher_alignmask(any_tfm(cc)); -+ } - - cc->req_pool = mempool_create_kmalloc_pool(MIN_IOS, cc->dmreq_start + -- sizeof(struct dm_crypt_request) + cc->iv_size); -+ sizeof(struct dm_crypt_request) + iv_size_padding + cc->iv_size); - if (!cc->req_pool) { - ti->error = "Cannot allocate crypt request mempool"; - goto bad; -diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c -index d7690f86fdb9..55de4f6f7eaf 100644 ---- a/drivers/md/raid1.c -+++ b/drivers/md/raid1.c -@@ -540,11 +540,7 @@ static int read_balance(struct r1conf *conf, struct r1bio *r1_bio, int *max_sect - has_nonrot_disk = 0; - choose_next_idle = 0; - -- if (conf->mddev->recovery_cp < MaxSector && -- (this_sector + sectors >= conf->next_resync)) -- choose_first = 1; -- else -- choose_first = 0; -+ choose_first = (conf->mddev->recovery_cp < this_sector + sectors); - - for (disk = 0 ; disk < conf->raid_disks * 2 ; disk++) { - sector_t dist; -@@ -831,7 +827,7 @@ static void flush_pending_writes(struct r1conf *conf) - * there is no normal IO happeing. It must arrange to call - * lower_barrier when the particular background IO completes. - */ --static void raise_barrier(struct r1conf *conf) -+static void raise_barrier(struct r1conf *conf, sector_t sector_nr) - { - spin_lock_irq(&conf->resync_lock); - -@@ -841,6 +837,7 @@ static void raise_barrier(struct r1conf *conf) - - /* block any new IO from starting */ - conf->barrier++; -+ conf->next_resync = sector_nr; - - /* For these conditions we must wait: - * A: while the array is in frozen state -@@ -849,14 +846,17 @@ static void raise_barrier(struct r1conf *conf) - * C: next_resync + RESYNC_SECTORS > start_next_window, meaning - * next resync will reach to the window which normal bios are - * handling. -+ * D: while there are any active requests in the current window. - */ - wait_event_lock_irq(conf->wait_barrier, - !conf->array_frozen && - conf->barrier < RESYNC_DEPTH && -+ conf->current_window_requests == 0 && - (conf->start_next_window >= - conf->next_resync + RESYNC_SECTORS), - conf->resync_lock); - -+ conf->nr_pending++; - spin_unlock_irq(&conf->resync_lock); - } - -@@ -866,6 +866,7 @@ static void lower_barrier(struct r1conf *conf) - BUG_ON(conf->barrier <= 0); - spin_lock_irqsave(&conf->resync_lock, flags); - conf->barrier--; -+ conf->nr_pending--; - spin_unlock_irqrestore(&conf->resync_lock, flags); - wake_up(&conf->wait_barrier); - } -@@ -877,12 +878,10 @@ static bool need_to_wait_for_sync(struct r1conf *conf, struct bio *bio) - if (conf->array_frozen || !bio) - wait = true; - else if (conf->barrier && bio_data_dir(bio) == WRITE) { -- if (conf->next_resync < RESYNC_WINDOW_SECTORS) -- wait = true; -- else if ((conf->next_resync - RESYNC_WINDOW_SECTORS -- >= bio_end_sector(bio)) || -- (conf->next_resync + NEXT_NORMALIO_DISTANCE -- <= bio->bi_iter.bi_sector)) -+ if ((conf->mddev->curr_resync_completed -+ >= bio_end_sector(bio)) || -+ (conf->next_resync + NEXT_NORMALIO_DISTANCE -+ <= bio->bi_iter.bi_sector)) - wait = false; - else - wait = true; -@@ -919,8 +918,8 @@ static sector_t wait_barrier(struct r1conf *conf, struct bio *bio) - } - - if (bio && bio_data_dir(bio) == WRITE) { -- if (conf->next_resync + NEXT_NORMALIO_DISTANCE -- <= bio->bi_iter.bi_sector) { -+ if (bio->bi_iter.bi_sector >= -+ conf->mddev->curr_resync_completed) { - if (conf->start_next_window == MaxSector) - conf->start_next_window = - conf->next_resync + -@@ -1186,6 +1185,7 @@ read_again: - atomic_read(&bitmap->behind_writes) == 0); - } - r1_bio->read_disk = rdisk; -+ r1_bio->start_next_window = 0; - - read_bio = bio_clone_mddev(bio, GFP_NOIO, mddev); - bio_trim(read_bio, r1_bio->sector - bio->bi_iter.bi_sector, -@@ -1548,8 +1548,13 @@ static void close_sync(struct r1conf *conf) - mempool_destroy(conf->r1buf_pool); - conf->r1buf_pool = NULL; - -+ spin_lock_irq(&conf->resync_lock); - conf->next_resync = 0; - conf->start_next_window = MaxSector; -+ conf->current_window_requests += -+ conf->next_window_requests; -+ conf->next_window_requests = 0; -+ spin_unlock_irq(&conf->resync_lock); - } - - static int raid1_spare_active(struct mddev *mddev) -@@ -2150,7 +2155,7 @@ static void fix_read_error(struct r1conf *conf, int read_disk, - d--; - rdev = conf->mirrors[d].rdev; - if (rdev && -- test_bit(In_sync, &rdev->flags)) -+ !test_bit(Faulty, &rdev->flags)) - r1_sync_page_io(rdev, sect, s, - conf->tmppage, WRITE); - } -@@ -2162,7 +2167,7 @@ static void fix_read_error(struct r1conf *conf, int read_disk, - d--; - rdev = conf->mirrors[d].rdev; - if (rdev && -- test_bit(In_sync, &rdev->flags)) { -+ !test_bit(Faulty, &rdev->flags)) { - if (r1_sync_page_io(rdev, sect, s, - conf->tmppage, READ)) { - atomic_add(s, &rdev->corrected_errors); -@@ -2541,9 +2546,8 @@ static sector_t sync_request(struct mddev *mddev, sector_t sector_nr, int *skipp - - bitmap_cond_end_sync(mddev->bitmap, sector_nr); - r1_bio = mempool_alloc(conf->r1buf_pool, GFP_NOIO); -- raise_barrier(conf); - -- conf->next_resync = sector_nr; -+ raise_barrier(conf, sector_nr); - - rcu_read_lock(); - /* -diff --git a/drivers/media/dvb-core/dvb-usb-ids.h b/drivers/media/dvb-core/dvb-usb-ids.h -index 80643ef9183f..fabe2fce9bc5 100644 ---- a/drivers/media/dvb-core/dvb-usb-ids.h -+++ b/drivers/media/dvb-core/dvb-usb-ids.h -@@ -279,6 +279,8 @@ - #define USB_PID_PCTV_400E 0x020f - #define USB_PID_PCTV_450E 0x0222 - #define USB_PID_PCTV_452E 0x021f -+#define USB_PID_PCTV_78E 0x025a -+#define USB_PID_PCTV_79E 0x0262 - #define USB_PID_REALTEK_RTL2831U 0x2831 - #define USB_PID_REALTEK_RTL2832U 0x2832 - #define USB_PID_TECHNOTREND_CONNECT_S2_3600 0x3007 -diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c -index 71c8570bd9ea..112394d138c9 100644 ---- a/drivers/media/i2c/adv7604.c -+++ b/drivers/media/i2c/adv7604.c -@@ -1984,7 +1984,7 @@ static int adv7604_log_status(struct v4l2_subdev *sd) - v4l2_info(sd, "HDCP keys read: %s%s\n", - (hdmi_read(sd, 0x04) & 0x20) ? "yes" : "no", - (hdmi_read(sd, 0x04) & 0x10) ? "ERROR" : ""); -- if (!is_hdmi(sd)) { -+ if (is_hdmi(sd)) { - bool audio_pll_locked = hdmi_read(sd, 0x04) & 0x01; - bool audio_sample_packet_detect = hdmi_read(sd, 0x18) & 0x01; - bool audio_mute = io_read(sd, 0x65) & 0x40; -diff --git a/drivers/media/pci/cx18/cx18-driver.c b/drivers/media/pci/cx18/cx18-driver.c -index 716bdc57fac6..83f5074706f9 100644 ---- a/drivers/media/pci/cx18/cx18-driver.c -+++ b/drivers/media/pci/cx18/cx18-driver.c -@@ -1091,6 +1091,7 @@ static int cx18_probe(struct pci_dev *pci_dev, - setup.addr = ADDR_UNSET; - setup.type = cx->options.tuner; - setup.mode_mask = T_ANALOG_TV; /* matches TV tuners */ -+ setup.config = NULL; - if (cx->options.radio > 0) - setup.mode_mask |= T_RADIO; - setup.tuner_callback = (setup.type == TUNER_XC2028) ? -diff --git a/drivers/media/usb/dvb-usb-v2/af9035.c b/drivers/media/usb/dvb-usb-v2/af9035.c -index 8ede8ea762e6..88228f735342 100644 ---- a/drivers/media/usb/dvb-usb-v2/af9035.c -+++ b/drivers/media/usb/dvb-usb-v2/af9035.c -@@ -1541,6 +1541,10 @@ static const struct usb_device_id af9035_id_table[] = { - &af9035_props, "Leadtek WinFast DTV Dongle Dual", NULL) }, - { DVB_USB_DEVICE(USB_VID_HAUPPAUGE, 0xf900, - &af9035_props, "Hauppauge WinTV-MiniStick 2", NULL) }, -+ { DVB_USB_DEVICE(USB_VID_PCTV, USB_PID_PCTV_78E, -+ &af9035_props, "PCTV 78e", RC_MAP_IT913X_V1) }, -+ { DVB_USB_DEVICE(USB_VID_PCTV, USB_PID_PCTV_79E, -+ &af9035_props, "PCTV 79e", RC_MAP_IT913X_V2) }, - { } - }; - MODULE_DEVICE_TABLE(usb, af9035_id_table); -diff --git a/drivers/net/ethernet/ibm/ibmveth.c b/drivers/net/ethernet/ibm/ibmveth.c -index 1fc8334fc181..55e3075492da 100644 ---- a/drivers/net/ethernet/ibm/ibmveth.c -+++ b/drivers/net/ethernet/ibm/ibmveth.c -@@ -292,6 +292,18 @@ failure: - atomic_add(buffers_added, &(pool->available)); - } - -+/* -+ * The final 8 bytes of the buffer list is a counter of frames dropped -+ * because there was not a buffer in the buffer list capable of holding -+ * the frame. -+ */ -+static void ibmveth_update_rx_no_buffer(struct ibmveth_adapter *adapter) -+{ -+ __be64 *p = adapter->buffer_list_addr + 4096 - 8; -+ -+ adapter->rx_no_buffer = be64_to_cpup(p); -+} -+ - /* replenish routine */ - static void ibmveth_replenish_task(struct ibmveth_adapter *adapter) - { -@@ -307,8 +319,7 @@ static void ibmveth_replenish_task(struct ibmveth_adapter *adapter) - ibmveth_replenish_buffer_pool(adapter, pool); - } - -- adapter->rx_no_buffer = *(u64 *)(((char*)adapter->buffer_list_addr) + -- 4096 - 8); -+ ibmveth_update_rx_no_buffer(adapter); - } - - /* empty and free ana buffer pool - also used to do cleanup in error paths */ -@@ -698,8 +709,7 @@ static int ibmveth_close(struct net_device *netdev) - - free_irq(netdev->irq, netdev); - -- adapter->rx_no_buffer = *(u64 *)(((char *)adapter->buffer_list_addr) + -- 4096 - 8); -+ ibmveth_update_rx_no_buffer(adapter); - - ibmveth_cleanup(adapter); - -diff --git a/drivers/net/wireless/ath/carl9170/carl9170.h b/drivers/net/wireless/ath/carl9170/carl9170.h -index 8596aba34f96..237d0cda1bcb 100644 ---- a/drivers/net/wireless/ath/carl9170/carl9170.h -+++ b/drivers/net/wireless/ath/carl9170/carl9170.h -@@ -256,6 +256,7 @@ struct ar9170 { - atomic_t rx_work_urbs; - atomic_t rx_pool_urbs; - kernel_ulong_t features; -+ bool usb_ep_cmd_is_bulk; - - /* firmware settings */ - struct completion fw_load_wait; -diff --git a/drivers/net/wireless/ath/carl9170/usb.c b/drivers/net/wireless/ath/carl9170/usb.c -index ca115f33746f..bc931f6f1f0f 100644 ---- a/drivers/net/wireless/ath/carl9170/usb.c -+++ b/drivers/net/wireless/ath/carl9170/usb.c -@@ -621,9 +621,16 @@ int __carl9170_exec_cmd(struct ar9170 *ar, struct carl9170_cmd *cmd, - goto err_free; - } - -- usb_fill_int_urb(urb, ar->udev, usb_sndintpipe(ar->udev, -- AR9170_USB_EP_CMD), cmd, cmd->hdr.len + 4, -- carl9170_usb_cmd_complete, ar, 1); -+ if (ar->usb_ep_cmd_is_bulk) -+ usb_fill_bulk_urb(urb, ar->udev, -+ usb_sndbulkpipe(ar->udev, AR9170_USB_EP_CMD), -+ cmd, cmd->hdr.len + 4, -+ carl9170_usb_cmd_complete, ar); -+ else -+ usb_fill_int_urb(urb, ar->udev, -+ usb_sndintpipe(ar->udev, AR9170_USB_EP_CMD), -+ cmd, cmd->hdr.len + 4, -+ carl9170_usb_cmd_complete, ar, 1); - - if (free_buf) - urb->transfer_flags |= URB_FREE_BUFFER; -@@ -1032,9 +1039,10 @@ static void carl9170_usb_firmware_step2(const struct firmware *fw, - static int carl9170_usb_probe(struct usb_interface *intf, - const struct usb_device_id *id) - { -+ struct usb_endpoint_descriptor *ep; - struct ar9170 *ar; - struct usb_device *udev; -- int err; -+ int i, err; - - err = usb_reset_device(interface_to_usbdev(intf)); - if (err) -@@ -1050,6 +1058,21 @@ static int carl9170_usb_probe(struct usb_interface *intf, - ar->intf = intf; - ar->features = id->driver_info; - -+ /* We need to remember the type of endpoint 4 because it differs -+ * between high- and full-speed configuration. The high-speed -+ * configuration specifies it as interrupt and the full-speed -+ * configuration as bulk endpoint. This information is required -+ * later when sending urbs to that endpoint. -+ */ -+ for (i = 0; i < intf->cur_altsetting->desc.bNumEndpoints; ++i) { -+ ep = &intf->cur_altsetting->endpoint[i].desc; -+ -+ if (usb_endpoint_num(ep) == AR9170_USB_EP_CMD && -+ usb_endpoint_dir_out(ep) && -+ usb_endpoint_type(ep) == USB_ENDPOINT_XFER_BULK) -+ ar->usb_ep_cmd_is_bulk = true; -+ } -+ - usb_set_intfdata(intf, ar); - SET_IEEE80211_DEV(ar->hw, &intf->dev); - -diff --git a/drivers/net/wireless/brcm80211/brcmfmac/fweh.c b/drivers/net/wireless/brcm80211/brcmfmac/fweh.c -index fad77dd2a3a5..3f9cb894d001 100644 ---- a/drivers/net/wireless/brcm80211/brcmfmac/fweh.c -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fweh.c -@@ -185,7 +185,13 @@ static void brcmf_fweh_handle_if_event(struct brcmf_pub *drvr, - ifevent->action, ifevent->ifidx, ifevent->bssidx, - ifevent->flags, ifevent->role); - -- if (ifevent->flags & BRCMF_E_IF_FLAG_NOIF) { -+ /* The P2P Device interface event must not be ignored -+ * contrary to what firmware tells us. The only way to -+ * distinguish the P2P Device is by looking at the ifidx -+ * and bssidx received. -+ */ -+ if (!(ifevent->ifidx == 0 && ifevent->bssidx == 1) && -+ (ifevent->flags & BRCMF_E_IF_FLAG_NOIF)) { - brcmf_dbg(EVENT, "event can be ignored\n"); - return; - } -@@ -210,12 +216,12 @@ static void brcmf_fweh_handle_if_event(struct brcmf_pub *drvr, - return; - } - -- if (ifevent->action == BRCMF_E_IF_CHANGE) -+ if (ifp && ifevent->action == BRCMF_E_IF_CHANGE) - brcmf_fws_reset_interface(ifp); - - err = brcmf_fweh_call_event_handler(ifp, emsg->event_code, emsg, data); - -- if (ifevent->action == BRCMF_E_IF_DEL) { -+ if (ifp && ifevent->action == BRCMF_E_IF_DEL) { - brcmf_fws_del_interface(ifp); - brcmf_del_if(drvr, ifevent->bssidx); - } -diff --git a/drivers/net/wireless/brcm80211/brcmfmac/fweh.h b/drivers/net/wireless/brcm80211/brcmfmac/fweh.h -index 51b53a73d074..d26b47698f68 100644 ---- a/drivers/net/wireless/brcm80211/brcmfmac/fweh.h -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fweh.h -@@ -167,6 +167,8 @@ enum brcmf_fweh_event_code { - #define BRCMF_E_IF_ROLE_STA 0 - #define BRCMF_E_IF_ROLE_AP 1 - #define BRCMF_E_IF_ROLE_WDS 2 -+#define BRCMF_E_IF_ROLE_P2P_GO 3 -+#define BRCMF_E_IF_ROLE_P2P_CLIENT 4 - - /** - * definitions for event packet validation. -diff --git a/drivers/net/wireless/iwlwifi/dvm/rxon.c b/drivers/net/wireless/iwlwifi/dvm/rxon.c -index c1e311341b74..503a81e58185 100644 ---- a/drivers/net/wireless/iwlwifi/dvm/rxon.c -+++ b/drivers/net/wireless/iwlwifi/dvm/rxon.c -@@ -1068,6 +1068,13 @@ int iwlagn_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx) - /* recalculate basic rates */ - iwl_calc_basic_rates(priv, ctx); - -+ /* -+ * force CTS-to-self frames protection if RTS-CTS is not preferred -+ * one aggregation protection method -+ */ -+ if (!priv->hw_params.use_rts_for_aggregation) -+ ctx->staging.flags |= RXON_FLG_SELF_CTS_EN; -+ - if ((ctx->vif && ctx->vif->bss_conf.use_short_slot) || - !(ctx->staging.flags & RXON_FLG_BAND_24G_MSK)) - ctx->staging.flags |= RXON_FLG_SHORT_SLOT_MSK; -@@ -1473,6 +1480,11 @@ void iwlagn_bss_info_changed(struct ieee80211_hw *hw, - else - ctx->staging.flags &= ~RXON_FLG_TGG_PROTECT_MSK; - -+ if (bss_conf->use_cts_prot) -+ ctx->staging.flags |= RXON_FLG_SELF_CTS_EN; -+ else -+ ctx->staging.flags &= ~RXON_FLG_SELF_CTS_EN; -+ - memcpy(ctx->staging.bssid_addr, bss_conf->bssid, ETH_ALEN); - - if (vif->type == NL80211_IFTYPE_AP || -diff --git a/drivers/net/wireless/iwlwifi/iwl-config.h b/drivers/net/wireless/iwlwifi/iwl-config.h -index 1ced525157dc..b45d78f53f08 100644 ---- a/drivers/net/wireless/iwlwifi/iwl-config.h -+++ b/drivers/net/wireless/iwlwifi/iwl-config.h -@@ -119,6 +119,8 @@ enum iwl_led_mode { - #define IWL_LONG_WD_TIMEOUT 10000 - #define IWL_MAX_WD_TIMEOUT 120000 - -+#define IWL_DEFAULT_MAX_TX_POWER 22 -+ - /* Antenna presence definitions */ - #define ANT_NONE 0x0 - #define ANT_A BIT(0) -diff --git a/drivers/net/wireless/iwlwifi/iwl-nvm-parse.c b/drivers/net/wireless/iwlwifi/iwl-nvm-parse.c -index 725e954d8475..3c3eb7842c62 100644 ---- a/drivers/net/wireless/iwlwifi/iwl-nvm-parse.c -+++ b/drivers/net/wireless/iwlwifi/iwl-nvm-parse.c -@@ -118,8 +118,6 @@ static const u8 iwl_nvm_channels[] = { - #define LAST_2GHZ_HT_PLUS 9 - #define LAST_5GHZ_HT 161 - --#define DEFAULT_MAX_TX_POWER 16 -- - /* rate data (static) */ - static struct ieee80211_rate iwl_cfg80211_rates[] = { - { .bitrate = 1 * 10, .hw_value = 0, .hw_value_short = 0, }, -@@ -242,7 +240,7 @@ static int iwl_init_channel_map(struct device *dev, const struct iwl_cfg *cfg, - * Default value - highest tx power value. max_power - * is not used in mvm, and is used for backwards compatibility - */ -- channel->max_power = DEFAULT_MAX_TX_POWER; -+ channel->max_power = IWL_DEFAULT_MAX_TX_POWER; - is_5ghz = channel->band == IEEE80211_BAND_5GHZ; - IWL_DEBUG_EEPROM(dev, - "Ch. %d [%sGHz] %s%s%s%s%s%s(0x%02x %ddBm): Ad-Hoc %ssupported\n", -diff --git a/drivers/net/wireless/iwlwifi/mvm/fw-api.h b/drivers/net/wireless/iwlwifi/mvm/fw-api.h -index 989d7dbdca6c..d0a04779d734 100644 ---- a/drivers/net/wireless/iwlwifi/mvm/fw-api.h -+++ b/drivers/net/wireless/iwlwifi/mvm/fw-api.h -@@ -1415,14 +1415,14 @@ enum iwl_sf_scenario { - - /** - * Smart Fifo configuration command. -- * @state: smart fifo state, types listed in iwl_sf_sate. -+ * @state: smart fifo state, types listed in enum %iwl_sf_sate. - * @watermark: Minimum allowed availabe free space in RXF for transient state. - * @long_delay_timeouts: aging and idle timer values for each scenario - * in long delay state. - * @full_on_timeouts: timer values for each scenario in full on state. - */ - struct iwl_sf_cfg_cmd { -- enum iwl_sf_state state; -+ __le32 state; - __le32 watermark[SF_TRANSIENT_STATES_NUMBER]; - __le32 long_delay_timeouts[SF_NUM_SCENARIO][SF_NUM_TIMEOUT_TYPES]; - __le32 full_on_timeouts[SF_NUM_SCENARIO][SF_NUM_TIMEOUT_TYPES]; -diff --git a/drivers/net/wireless/iwlwifi/mvm/sf.c b/drivers/net/wireless/iwlwifi/mvm/sf.c -index 88809b2d1654..dab8fd13857a 100644 ---- a/drivers/net/wireless/iwlwifi/mvm/sf.c -+++ b/drivers/net/wireless/iwlwifi/mvm/sf.c -@@ -172,7 +172,7 @@ static int iwl_mvm_sf_config(struct iwl_mvm *mvm, u8 sta_id, - enum iwl_sf_state new_state) - { - struct iwl_sf_cfg_cmd sf_cmd = { -- .state = new_state, -+ .state = cpu_to_le32(new_state), - }; - struct ieee80211_sta *sta; - int ret = 0; -diff --git a/drivers/net/wireless/iwlwifi/mvm/tx.c b/drivers/net/wireless/iwlwifi/mvm/tx.c -index 76ee486039d7..2ca62af3f81b 100644 ---- a/drivers/net/wireless/iwlwifi/mvm/tx.c -+++ b/drivers/net/wireless/iwlwifi/mvm/tx.c -@@ -173,10 +173,14 @@ static void iwl_mvm_set_tx_cmd_rate(struct iwl_mvm *mvm, - - /* - * for data packets, rate info comes from the table inside the fw. This -- * table is controlled by LINK_QUALITY commands -+ * table is controlled by LINK_QUALITY commands. Exclude ctrl port -+ * frames like EAPOLs which should be treated as mgmt frames. This -+ * avoids them being sent initially in high rates which increases the -+ * chances for completion of the 4-Way handshake. - */ - -- if (ieee80211_is_data(fc) && sta) { -+ if (ieee80211_is_data(fc) && sta && -+ !(info->control.flags & IEEE80211_TX_CTRL_PORT_CTRL_PROTO)) { - tx_cmd->initial_rate_index = 0; - tx_cmd->tx_flags |= cpu_to_le32(TX_CMD_FLG_STA_RATE); - return; -diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c -index c61311084d7e..f58316769159 100644 ---- a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c -+++ b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c -@@ -317,6 +317,7 @@ static struct usb_device_id rtl8192c_usb_ids[] = { - {RTL_USB_DEVICE(0x0bda, 0x5088, rtl92cu_hal_cfg)}, /*Thinkware-CC&C*/ - {RTL_USB_DEVICE(0x0df6, 0x0052, rtl92cu_hal_cfg)}, /*Sitecom - Edimax*/ - {RTL_USB_DEVICE(0x0df6, 0x005c, rtl92cu_hal_cfg)}, /*Sitecom - Edimax*/ -+ {RTL_USB_DEVICE(0x0df6, 0x0070, rtl92cu_hal_cfg)}, /*Sitecom - 150N */ - {RTL_USB_DEVICE(0x0df6, 0x0077, rtl92cu_hal_cfg)}, /*Sitecom-WLA2100V2*/ - {RTL_USB_DEVICE(0x0eb0, 0x9071, rtl92cu_hal_cfg)}, /*NO Brand - Etop*/ - {RTL_USB_DEVICE(0x4856, 0x0091, rtl92cu_hal_cfg)}, /*NetweeN - Feixun*/ -diff --git a/drivers/nfc/microread/microread.c b/drivers/nfc/microread/microread.c -index f868333271aa..963a4a5dc88e 100644 ---- a/drivers/nfc/microread/microread.c -+++ b/drivers/nfc/microread/microread.c -@@ -501,9 +501,13 @@ static void microread_target_discovered(struct nfc_hci_dev *hdev, u8 gate, - targets->sens_res = - be16_to_cpu(*(u16 *)&skb->data[MICROREAD_EMCF_A_ATQA]); - targets->sel_res = skb->data[MICROREAD_EMCF_A_SAK]; -- memcpy(targets->nfcid1, &skb->data[MICROREAD_EMCF_A_UID], -- skb->data[MICROREAD_EMCF_A_LEN]); - targets->nfcid1_len = skb->data[MICROREAD_EMCF_A_LEN]; -+ if (targets->nfcid1_len > sizeof(targets->nfcid1)) { -+ r = -EINVAL; -+ goto exit_free; -+ } -+ memcpy(targets->nfcid1, &skb->data[MICROREAD_EMCF_A_UID], -+ targets->nfcid1_len); - break; - case MICROREAD_GATE_ID_MREAD_ISO_A_3: - targets->supported_protocols = -@@ -511,9 +515,13 @@ static void microread_target_discovered(struct nfc_hci_dev *hdev, u8 gate, - targets->sens_res = - be16_to_cpu(*(u16 *)&skb->data[MICROREAD_EMCF_A3_ATQA]); - targets->sel_res = skb->data[MICROREAD_EMCF_A3_SAK]; -- memcpy(targets->nfcid1, &skb->data[MICROREAD_EMCF_A3_UID], -- skb->data[MICROREAD_EMCF_A3_LEN]); - targets->nfcid1_len = skb->data[MICROREAD_EMCF_A3_LEN]; -+ if (targets->nfcid1_len > sizeof(targets->nfcid1)) { -+ r = -EINVAL; -+ goto exit_free; -+ } -+ memcpy(targets->nfcid1, &skb->data[MICROREAD_EMCF_A3_UID], -+ targets->nfcid1_len); - break; - case MICROREAD_GATE_ID_MREAD_ISO_B: - targets->supported_protocols = NFC_PROTO_ISO14443_B_MASK; -diff --git a/drivers/of/irq.c b/drivers/of/irq.c -index ca0189308d72..48f20ff1add9 100644 ---- a/drivers/of/irq.c -+++ b/drivers/of/irq.c -@@ -301,16 +301,17 @@ int of_irq_parse_one(struct device_node *device, int index, struct of_phandle_ar - /* Get the reg property (if any) */ - addr = of_get_property(device, "reg", NULL); - -+ /* Try the new-style interrupts-extended first */ -+ res = of_parse_phandle_with_args(device, "interrupts-extended", -+ "#interrupt-cells", index, out_irq); -+ if (!res) -+ return of_irq_parse_raw(addr, out_irq); -+ - /* Get the interrupts property */ - intspec = of_get_property(device, "interrupts", &intlen); -- if (intspec == NULL) { -- /* Try the new-style interrupts-extended */ -- res = of_parse_phandle_with_args(device, "interrupts-extended", -- "#interrupt-cells", index, out_irq); -- if (res) -- return -EINVAL; -- return of_irq_parse_raw(addr, out_irq); -- } -+ if (intspec == NULL) -+ return -EINVAL; -+ - intlen /= sizeof(*intspec); - - pr_debug(" intspec=%d intlen=%d\n", be32_to_cpup(intspec), intlen); -diff --git a/drivers/phy/phy-twl4030-usb.c b/drivers/phy/phy-twl4030-usb.c -index c3ace1db8136..aaac3594f83b 100644 ---- a/drivers/phy/phy-twl4030-usb.c -+++ b/drivers/phy/phy-twl4030-usb.c -@@ -34,6 +34,7 @@ - #include <linux/delay.h> - #include <linux/usb/otg.h> - #include <linux/phy/phy.h> -+#include <linux/pm_runtime.h> - #include <linux/usb/musb-omap.h> - #include <linux/usb/ulpi.h> - #include <linux/i2c/twl.h> -@@ -422,37 +423,55 @@ static void twl4030_phy_power(struct twl4030_usb *twl, int on) - } - } - --static int twl4030_phy_power_off(struct phy *phy) -+static int twl4030_usb_runtime_suspend(struct device *dev) - { -- struct twl4030_usb *twl = phy_get_drvdata(phy); -+ struct twl4030_usb *twl = dev_get_drvdata(dev); - -+ dev_dbg(twl->dev, "%s\n", __func__); - if (twl->asleep) - return 0; - - twl4030_phy_power(twl, 0); - twl->asleep = 1; -- dev_dbg(twl->dev, "%s\n", __func__); -+ - return 0; - } - --static void __twl4030_phy_power_on(struct twl4030_usb *twl) -+static int twl4030_usb_runtime_resume(struct device *dev) - { -+ struct twl4030_usb *twl = dev_get_drvdata(dev); -+ -+ dev_dbg(twl->dev, "%s\n", __func__); -+ if (!twl->asleep) -+ return 0; -+ - twl4030_phy_power(twl, 1); -- twl4030_i2c_access(twl, 1); -- twl4030_usb_set_mode(twl, twl->usb_mode); -- if (twl->usb_mode == T2_USB_MODE_ULPI) -- twl4030_i2c_access(twl, 0); -+ twl->asleep = 0; -+ -+ return 0; -+} -+ -+static int twl4030_phy_power_off(struct phy *phy) -+{ -+ struct twl4030_usb *twl = phy_get_drvdata(phy); -+ -+ dev_dbg(twl->dev, "%s\n", __func__); -+ pm_runtime_mark_last_busy(twl->dev); -+ pm_runtime_put_autosuspend(twl->dev); -+ -+ return 0; - } - - static int twl4030_phy_power_on(struct phy *phy) - { - struct twl4030_usb *twl = phy_get_drvdata(phy); - -- if (!twl->asleep) -- return 0; -- __twl4030_phy_power_on(twl); -- twl->asleep = 0; - dev_dbg(twl->dev, "%s\n", __func__); -+ pm_runtime_get_sync(twl->dev); -+ twl4030_i2c_access(twl, 1); -+ twl4030_usb_set_mode(twl, twl->usb_mode); -+ if (twl->usb_mode == T2_USB_MODE_ULPI) -+ twl4030_i2c_access(twl, 0); - - /* - * XXX When VBUS gets driven after musb goes to A mode, -@@ -558,9 +577,27 @@ static irqreturn_t twl4030_usb_irq(int irq, void *_twl) - * USB_LINK_VBUS state. musb_hdrc won't care until it - * starts to handle softconnect right. - */ -+ if ((status == OMAP_MUSB_VBUS_VALID) || -+ (status == OMAP_MUSB_ID_GROUND)) { -+ if (twl->asleep) -+ pm_runtime_get_sync(twl->dev); -+ } else { -+ if (!twl->asleep) { -+ pm_runtime_mark_last_busy(twl->dev); -+ pm_runtime_put_autosuspend(twl->dev); -+ } -+ } - omap_musb_mailbox(status); - } -- sysfs_notify(&twl->dev->kobj, NULL, "vbus"); -+ -+ /* don't schedule during sleep - irq works right then */ -+ if (status == OMAP_MUSB_ID_GROUND && !twl->asleep) { -+ cancel_delayed_work(&twl->id_workaround_work); -+ schedule_delayed_work(&twl->id_workaround_work, HZ); -+ } -+ -+ if (irq) -+ sysfs_notify(&twl->dev->kobj, NULL, "vbus"); - - return IRQ_HANDLED; - } -@@ -569,29 +606,8 @@ static void twl4030_id_workaround_work(struct work_struct *work) - { - struct twl4030_usb *twl = container_of(work, struct twl4030_usb, - id_workaround_work.work); -- enum omap_musb_vbus_id_status status; -- bool status_changed = false; -- -- status = twl4030_usb_linkstat(twl); -- -- spin_lock_irq(&twl->lock); -- if (status >= 0 && status != twl->linkstat) { -- twl->linkstat = status; -- status_changed = true; -- } -- spin_unlock_irq(&twl->lock); -- -- if (status_changed) { -- dev_dbg(twl->dev, "handle missing status change to %d\n", -- status); -- omap_musb_mailbox(status); -- } - -- /* don't schedule during sleep - irq works right then */ -- if (status == OMAP_MUSB_ID_GROUND && !twl->asleep) { -- cancel_delayed_work(&twl->id_workaround_work); -- schedule_delayed_work(&twl->id_workaround_work, HZ); -- } -+ twl4030_usb_irq(0, twl); - } - - static int twl4030_phy_init(struct phy *phy) -@@ -599,22 +615,17 @@ static int twl4030_phy_init(struct phy *phy) - struct twl4030_usb *twl = phy_get_drvdata(phy); - enum omap_musb_vbus_id_status status; - -- /* -- * Start in sleep state, we'll get called through set_suspend() -- * callback when musb is runtime resumed and it's time to start. -- */ -- __twl4030_phy_power(twl, 0); -- twl->asleep = 1; -- -+ pm_runtime_get_sync(twl->dev); - status = twl4030_usb_linkstat(twl); - twl->linkstat = status; - -- if (status == OMAP_MUSB_ID_GROUND || status == OMAP_MUSB_VBUS_VALID) { -+ if (status == OMAP_MUSB_ID_GROUND || status == OMAP_MUSB_VBUS_VALID) - omap_musb_mailbox(twl->linkstat); -- twl4030_phy_power_on(phy); -- } - - sysfs_notify(&twl->dev->kobj, NULL, "vbus"); -+ pm_runtime_mark_last_busy(twl->dev); -+ pm_runtime_put_autosuspend(twl->dev); -+ - return 0; - } - -@@ -650,6 +661,11 @@ static const struct phy_ops ops = { - .owner = THIS_MODULE, - }; - -+static const struct dev_pm_ops twl4030_usb_pm_ops = { -+ SET_RUNTIME_PM_OPS(twl4030_usb_runtime_suspend, -+ twl4030_usb_runtime_resume, NULL) -+}; -+ - static int twl4030_usb_probe(struct platform_device *pdev) - { - struct twl4030_usb_data *pdata = dev_get_platdata(&pdev->dev); -@@ -726,6 +742,11 @@ static int twl4030_usb_probe(struct platform_device *pdev) - - ATOMIC_INIT_NOTIFIER_HEAD(&twl->phy.notifier); - -+ pm_runtime_use_autosuspend(&pdev->dev); -+ pm_runtime_set_autosuspend_delay(&pdev->dev, 2000); -+ pm_runtime_enable(&pdev->dev); -+ pm_runtime_get_sync(&pdev->dev); -+ - /* Our job is to use irqs and status from the power module - * to keep the transceiver disabled when nothing's connected. - * -@@ -744,6 +765,9 @@ static int twl4030_usb_probe(struct platform_device *pdev) - return status; - } - -+ pm_runtime_mark_last_busy(&pdev->dev); -+ pm_runtime_put_autosuspend(twl->dev); -+ - dev_info(&pdev->dev, "Initialized TWL4030 USB module\n"); - return 0; - } -@@ -753,6 +777,7 @@ static int twl4030_usb_remove(struct platform_device *pdev) - struct twl4030_usb *twl = platform_get_drvdata(pdev); - int val; - -+ pm_runtime_get_sync(twl->dev); - cancel_delayed_work(&twl->id_workaround_work); - device_remove_file(twl->dev, &dev_attr_vbus); - -@@ -772,9 +797,8 @@ static int twl4030_usb_remove(struct platform_device *pdev) - - /* disable complete OTG block */ - twl4030_usb_clear_bits(twl, POWER_CTRL, POWER_CTRL_OTG_ENAB); -- -- if (!twl->asleep) -- twl4030_phy_power(twl, 0); -+ pm_runtime_mark_last_busy(twl->dev); -+ pm_runtime_put(twl->dev); - - return 0; - } -@@ -792,6 +816,7 @@ static struct platform_driver twl4030_usb_driver = { - .remove = twl4030_usb_remove, - .driver = { - .name = "twl4030_usb", -+ .pm = &twl4030_usb_pm_ops, - .owner = THIS_MODULE, - .of_match_table = of_match_ptr(twl4030_usb_id_table), - }, -diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c -index 40462415291e..454998669c2a 100644 ---- a/drivers/scsi/libiscsi.c -+++ b/drivers/scsi/libiscsi.c -@@ -717,11 +717,21 @@ __iscsi_conn_send_pdu(struct iscsi_conn *conn, struct iscsi_hdr *hdr, - return NULL; - } - -+ if (data_size > ISCSI_DEF_MAX_RECV_SEG_LEN) { -+ iscsi_conn_printk(KERN_ERR, conn, "Invalid buffer len of %u for login task. Max len is %u\n", data_size, ISCSI_DEF_MAX_RECV_SEG_LEN); -+ return NULL; -+ } -+ - task = conn->login_task; - } else { - if (session->state != ISCSI_STATE_LOGGED_IN) - return NULL; - -+ if (data_size != 0) { -+ iscsi_conn_printk(KERN_ERR, conn, "Can not send data buffer of len %u for op 0x%x\n", data_size, opcode); -+ return NULL; -+ } -+ - BUG_ON(conn->c_stage == ISCSI_CONN_INITIAL_STAGE); - BUG_ON(conn->c_stage == ISCSI_CONN_STOPPED); - -diff --git a/drivers/spi/spi-dw-pci.c b/drivers/spi/spi-dw-pci.c -index 3f3dc1226edf..e14960470d8d 100644 ---- a/drivers/spi/spi-dw-pci.c -+++ b/drivers/spi/spi-dw-pci.c -@@ -62,6 +62,8 @@ static int spi_pci_probe(struct pci_dev *pdev, - if (ret) - return ret; - -+ dws->regs = pcim_iomap_table(pdev)[pci_bar]; -+ - dws->bus_num = 0; - dws->num_cs = 4; - dws->irq = pdev->irq; -diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c -index a64f1557c156..b0059e7552b0 100644 ---- a/drivers/spi/spi-omap2-mcspi.c -+++ b/drivers/spi/spi-omap2-mcspi.c -@@ -321,7 +321,8 @@ static void omap2_mcspi_set_fifo(const struct spi_device *spi, - disable_fifo: - if (t->rx_buf != NULL) - chconf &= ~OMAP2_MCSPI_CHCONF_FFER; -- else -+ -+ if (t->tx_buf != NULL) - chconf &= ~OMAP2_MCSPI_CHCONF_FFET; - - mcspi_write_chconf0(spi, chconf); -diff --git a/drivers/staging/iio/meter/ade7758_trigger.c b/drivers/staging/iio/meter/ade7758_trigger.c -index 7a94ddd42f59..8c4f2896cd0d 100644 ---- a/drivers/staging/iio/meter/ade7758_trigger.c -+++ b/drivers/staging/iio/meter/ade7758_trigger.c -@@ -85,7 +85,7 @@ int ade7758_probe_trigger(struct iio_dev *indio_dev) - ret = iio_trigger_register(st->trig); - - /* select default trigger */ -- indio_dev->trig = st->trig; -+ indio_dev->trig = iio_trigger_get(st->trig); - if (ret) - goto error_free_irq; - -diff --git a/drivers/staging/imx-drm/ipuv3-plane.c b/drivers/staging/imx-drm/ipuv3-plane.c -index 34b642a12f8b..c70f1734b274 100644 ---- a/drivers/staging/imx-drm/ipuv3-plane.c -+++ b/drivers/staging/imx-drm/ipuv3-plane.c -@@ -277,7 +277,8 @@ static void ipu_plane_dpms(struct ipu_plane *ipu_plane, int mode) - - ipu_idmac_put(ipu_plane->ipu_ch); - ipu_dmfc_put(ipu_plane->dmfc); -- ipu_dp_put(ipu_plane->dp); -+ if (ipu_plane->dp) -+ ipu_dp_put(ipu_plane->dp); - } - } - -diff --git a/drivers/staging/lustre/lustre/Kconfig b/drivers/staging/lustre/lustre/Kconfig -index 209e4c7e6f8a..4f65ba1158bf 100644 ---- a/drivers/staging/lustre/lustre/Kconfig -+++ b/drivers/staging/lustre/lustre/Kconfig -@@ -57,4 +57,5 @@ config LUSTRE_TRANSLATE_ERRNOS - config LUSTRE_LLITE_LLOOP - tristate "Lustre virtual block device" - depends on LUSTRE_FS && BLOCK -+ depends on !PPC_64K_PAGES && !ARM64_64K_PAGES - default m -diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c -index f329ad294fc0..104f29e6b290 100644 ---- a/drivers/target/iscsi/iscsi_target.c -+++ b/drivers/target/iscsi/iscsi_target.c -@@ -4513,6 +4513,7 @@ static void iscsit_logout_post_handler_diffcid( - { - struct iscsi_conn *l_conn; - struct iscsi_session *sess = conn->sess; -+ bool conn_found = false; - - if (!sess) - return; -@@ -4521,12 +4522,13 @@ static void iscsit_logout_post_handler_diffcid( - list_for_each_entry(l_conn, &sess->sess_conn_list, conn_list) { - if (l_conn->cid == cid) { - iscsit_inc_conn_usage_count(l_conn); -+ conn_found = true; - break; - } - } - spin_unlock_bh(&sess->conn_lock); - -- if (!l_conn) -+ if (!conn_found) - return; - - if (l_conn->sock) -diff --git a/drivers/target/iscsi/iscsi_target_parameters.c b/drivers/target/iscsi/iscsi_target_parameters.c -index 4d2e23fc76fd..43b7e6a616b8 100644 ---- a/drivers/target/iscsi/iscsi_target_parameters.c -+++ b/drivers/target/iscsi/iscsi_target_parameters.c -@@ -601,7 +601,7 @@ int iscsi_copy_param_list( - param_list = kzalloc(sizeof(struct iscsi_param_list), GFP_KERNEL); - if (!param_list) { - pr_err("Unable to allocate memory for struct iscsi_param_list.\n"); -- goto err_out; -+ return -1; - } - INIT_LIST_HEAD(&param_list->param_list); - INIT_LIST_HEAD(&param_list->extra_response_list); -diff --git a/drivers/target/target_core_configfs.c b/drivers/target/target_core_configfs.c -index 483d324020a6..f30385385544 100644 ---- a/drivers/target/target_core_configfs.c -+++ b/drivers/target/target_core_configfs.c -@@ -2359,7 +2359,7 @@ static ssize_t target_core_alua_tg_pt_gp_store_attr_alua_support_##_name(\ - pr_err("Invalid value '%ld', must be '0' or '1'\n", tmp); \ - return -EINVAL; \ - } \ -- if (!tmp) \ -+ if (tmp) \ - t->_var |= _bit; \ - else \ - t->_var &= ~_bit; \ -diff --git a/drivers/tty/serial/8250/8250_dma.c b/drivers/tty/serial/8250/8250_dma.c -index ab9096dc3849..148ffe4c232f 100644 ---- a/drivers/tty/serial/8250/8250_dma.c -+++ b/drivers/tty/serial/8250/8250_dma.c -@@ -192,21 +192,28 @@ int serial8250_request_dma(struct uart_8250_port *p) - - dma->rx_buf = dma_alloc_coherent(dma->rxchan->device->dev, dma->rx_size, - &dma->rx_addr, GFP_KERNEL); -- if (!dma->rx_buf) { -- dma_release_channel(dma->rxchan); -- dma_release_channel(dma->txchan); -- return -ENOMEM; -- } -+ if (!dma->rx_buf) -+ goto err; - - /* TX buffer */ - dma->tx_addr = dma_map_single(dma->txchan->device->dev, - p->port.state->xmit.buf, - UART_XMIT_SIZE, - DMA_TO_DEVICE); -+ if (dma_mapping_error(dma->txchan->device->dev, dma->tx_addr)) { -+ dma_free_coherent(dma->rxchan->device->dev, dma->rx_size, -+ dma->rx_buf, dma->rx_addr); -+ goto err; -+ } - - dev_dbg_ratelimited(p->port.dev, "got both dma channels\n"); - - return 0; -+err: -+ dma_release_channel(dma->rxchan); -+ dma_release_channel(dma->txchan); -+ -+ return -ENOMEM; - } - EXPORT_SYMBOL_GPL(serial8250_request_dma); - -diff --git a/drivers/usb/chipidea/ci_hdrc_msm.c b/drivers/usb/chipidea/ci_hdrc_msm.c -index 2d51d852b474..ca1123d415c5 100644 ---- a/drivers/usb/chipidea/ci_hdrc_msm.c -+++ b/drivers/usb/chipidea/ci_hdrc_msm.c -@@ -20,13 +20,13 @@ - static void ci_hdrc_msm_notify_event(struct ci_hdrc *ci, unsigned event) - { - struct device *dev = ci->gadget.dev.parent; -- int val; - - switch (event) { - case CI_HDRC_CONTROLLER_RESET_EVENT: - dev_dbg(dev, "CI_HDRC_CONTROLLER_RESET_EVENT received\n"); - writel(0, USB_AHBBURST); - writel(0, USB_AHBMODE); -+ usb_phy_init(ci->transceiver); - break; - case CI_HDRC_CONTROLLER_STOPPED_EVENT: - dev_dbg(dev, "CI_HDRC_CONTROLLER_STOPPED_EVENT received\n"); -@@ -34,10 +34,7 @@ static void ci_hdrc_msm_notify_event(struct ci_hdrc *ci, unsigned event) - * Put the transceiver in non-driving mode. Otherwise host - * may not detect soft-disconnection. - */ -- val = usb_phy_io_read(ci->transceiver, ULPI_FUNC_CTRL); -- val &= ~ULPI_FUNC_CTRL_OPMODE_MASK; -- val |= ULPI_FUNC_CTRL_OPMODE_NONDRIVING; -- usb_phy_io_write(ci->transceiver, val, ULPI_FUNC_CTRL); -+ usb_phy_notify_disconnect(ci->transceiver, USB_SPEED_UNKNOWN); - break; - default: - dev_dbg(dev, "unknown ci_hdrc event\n"); -diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c -index 6650df70bb35..263612ce1f62 100644 ---- a/drivers/usb/core/hub.c -+++ b/drivers/usb/core/hub.c -@@ -4764,9 +4764,10 @@ static void hub_events(void) - - hub = list_entry(tmp, struct usb_hub, event_list); - kref_get(&hub->kref); -+ hdev = hub->hdev; -+ usb_get_dev(hdev); - spin_unlock_irq(&hub_event_lock); - -- hdev = hub->hdev; - hub_dev = hub->intfdev; - intf = to_usb_interface(hub_dev); - dev_dbg(hub_dev, "state %d ports %d chg %04x evt %04x\n", -@@ -4979,6 +4980,7 @@ static void hub_events(void) - usb_autopm_put_interface(intf); - loop_disconnected: - usb_unlock_device(hdev); -+ usb_put_dev(hdev); - kref_put(&hub->kref, hub_release); - - } /* end while (1) */ -diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c -index a49217ae3533..f074755372a0 100644 ---- a/drivers/usb/dwc3/core.c -+++ b/drivers/usb/dwc3/core.c -@@ -583,12 +583,6 @@ static int dwc3_remove(struct platform_device *pdev) - { - struct dwc3 *dwc = platform_get_drvdata(pdev); - -- usb_phy_set_suspend(dwc->usb2_phy, 1); -- usb_phy_set_suspend(dwc->usb3_phy, 1); -- -- pm_runtime_put_sync(&pdev->dev); -- pm_runtime_disable(&pdev->dev); -- - dwc3_debugfs_exit(dwc); - - switch (dwc->dr_mode) { -@@ -609,8 +603,15 @@ static int dwc3_remove(struct platform_device *pdev) - - dwc3_event_buffers_cleanup(dwc); - dwc3_free_event_buffers(dwc); -+ -+ usb_phy_set_suspend(dwc->usb2_phy, 1); -+ usb_phy_set_suspend(dwc->usb3_phy, 1); -+ - dwc3_core_exit(dwc); - -+ pm_runtime_put_sync(&pdev->dev); -+ pm_runtime_disable(&pdev->dev); -+ - return 0; - } - -diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c -index b269dbd47fc4..2a6841c95b64 100644 ---- a/drivers/usb/dwc3/dwc3-omap.c -+++ b/drivers/usb/dwc3/dwc3-omap.c -@@ -582,9 +582,9 @@ static int dwc3_omap_remove(struct platform_device *pdev) - if (omap->extcon_id_dev.edev) - extcon_unregister_interest(&omap->extcon_id_dev); - dwc3_omap_disable_irqs(omap); -+ device_for_each_child(&pdev->dev, NULL, dwc3_omap_remove_core); - pm_runtime_put_sync(&pdev->dev); - pm_runtime_disable(&pdev->dev); -- device_for_each_child(&pdev->dev, NULL, dwc3_omap_remove_core); - - return 0; - } -diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c -index 81cda09b47e3..488a30836c36 100644 ---- a/drivers/usb/host/ehci-hcd.c -+++ b/drivers/usb/host/ehci-hcd.c -@@ -965,8 +965,6 @@ rescan: - } - - qh->exception = 1; -- if (ehci->rh_state < EHCI_RH_RUNNING) -- qh->qh_state = QH_STATE_IDLE; - switch (qh->qh_state) { - case QH_STATE_LINKED: - WARN_ON(!list_empty(&qh->qtd_list)); -diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c -index 9992fbfec85f..93fe089cd51a 100644 ---- a/drivers/usb/host/xhci-hub.c -+++ b/drivers/usb/host/xhci-hub.c -@@ -470,7 +470,8 @@ static void xhci_hub_report_usb2_link_state(u32 *status, u32 status_reg) - } - - /* Updates Link Status for super Speed port */ --static void xhci_hub_report_usb3_link_state(u32 *status, u32 status_reg) -+static void xhci_hub_report_usb3_link_state(struct xhci_hcd *xhci, -+ u32 *status, u32 status_reg) - { - u32 pls = status_reg & PORT_PLS_MASK; - -@@ -509,7 +510,8 @@ static void xhci_hub_report_usb3_link_state(u32 *status, u32 status_reg) - * in which sometimes the port enters compliance mode - * caused by a delay on the host-device negotiation. - */ -- if (pls == USB_SS_PORT_LS_COMP_MOD) -+ if ((xhci->quirks & XHCI_COMP_MODE_QUIRK) && -+ (pls == USB_SS_PORT_LS_COMP_MOD)) - pls |= USB_PORT_STAT_CONNECTION; - } - -@@ -668,7 +670,7 @@ static u32 xhci_get_port_status(struct usb_hcd *hcd, - } - /* Update Port Link State */ - if (hcd->speed == HCD_USB3) { -- xhci_hub_report_usb3_link_state(&status, raw_port_status); -+ xhci_hub_report_usb3_link_state(xhci, &status, raw_port_status); - /* - * Verify if all USB3 Ports Have entered U0 already. - * Delete Compliance Mode Timer if so. -diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c -index 4133a00461b1..9bce4f0e99be 100644 ---- a/drivers/usb/host/xhci-mem.c -+++ b/drivers/usb/host/xhci-mem.c -@@ -1723,7 +1723,7 @@ void xhci_mem_cleanup(struct xhci_hcd *xhci) - } - - num_ports = HCS_MAX_PORTS(xhci->hcs_params1); -- for (i = 0; i < num_ports; i++) { -+ for (i = 0; i < num_ports && xhci->rh_bw; i++) { - struct xhci_interval_bw_table *bwt = &xhci->rh_bw[i].bw_table; - for (j = 0; j < XHCI_MAX_INTERVAL; j++) { - struct list_head *ep = &bwt->interval_bw[j].endpoints; -diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c -index ab831048e8a4..82b563fc4fd6 100644 ---- a/drivers/usb/host/xhci.c -+++ b/drivers/usb/host/xhci.c -@@ -3928,13 +3928,21 @@ static int __maybe_unused xhci_change_max_exit_latency(struct xhci_hcd *xhci, - int ret; - - spin_lock_irqsave(&xhci->lock, flags); -- if (max_exit_latency == xhci->devs[udev->slot_id]->current_mel) { -+ -+ virt_dev = xhci->devs[udev->slot_id]; -+ -+ /* -+ * virt_dev might not exists yet if xHC resumed from hibernate (S4) and -+ * xHC was re-initialized. Exit latency will be set later after -+ * hub_port_finish_reset() is done and xhci->devs[] are re-allocated -+ */ -+ -+ if (!virt_dev || max_exit_latency == virt_dev->current_mel) { - spin_unlock_irqrestore(&xhci->lock, flags); - return 0; - } - - /* Attempt to issue an Evaluate Context command to change the MEL. */ -- virt_dev = xhci->devs[udev->slot_id]; - command = xhci->lpm_command; - ctrl_ctx = xhci_get_input_control_ctx(xhci, command->in_ctx); - if (!ctrl_ctx) { -diff --git a/drivers/usb/misc/sisusbvga/sisusb.c b/drivers/usb/misc/sisusbvga/sisusb.c -index de98906f786d..0aef801edbc1 100644 ---- a/drivers/usb/misc/sisusbvga/sisusb.c -+++ b/drivers/usb/misc/sisusbvga/sisusb.c -@@ -3248,6 +3248,7 @@ static const struct usb_device_id sisusb_table[] = { - { USB_DEVICE(0x0711, 0x0918) }, - { USB_DEVICE(0x0711, 0x0920) }, - { USB_DEVICE(0x0711, 0x0950) }, -+ { USB_DEVICE(0x0711, 0x5200) }, - { USB_DEVICE(0x182d, 0x021c) }, - { USB_DEVICE(0x182d, 0x0269) }, - { } -diff --git a/drivers/usb/phy/phy-tegra-usb.c b/drivers/usb/phy/phy-tegra-usb.c -index bbe4f8e6e8d7..8834b70c868c 100644 ---- a/drivers/usb/phy/phy-tegra-usb.c -+++ b/drivers/usb/phy/phy-tegra-usb.c -@@ -881,8 +881,8 @@ static int utmi_phy_probe(struct tegra_usb_phy *tegra_phy, - return -ENOMEM; - } - -- tegra_phy->config = devm_kzalloc(&pdev->dev, -- sizeof(*tegra_phy->config), GFP_KERNEL); -+ tegra_phy->config = devm_kzalloc(&pdev->dev, sizeof(*config), -+ GFP_KERNEL); - if (!tegra_phy->config) { - dev_err(&pdev->dev, - "unable to allocate memory for USB UTMIP config\n"); -diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c -index 8b0f517abb6b..3614620e09e1 100644 ---- a/drivers/usb/serial/ftdi_sio.c -+++ b/drivers/usb/serial/ftdi_sio.c -@@ -741,6 +741,7 @@ static const struct usb_device_id id_table_combined[] = { - { USB_DEVICE(FTDI_VID, FTDI_NDI_AURORA_SCU_PID), - .driver_info = (kernel_ulong_t)&ftdi_NDI_device_quirk }, - { USB_DEVICE(TELLDUS_VID, TELLDUS_TELLSTICK_PID) }, -+ { USB_DEVICE(NOVITUS_VID, NOVITUS_BONO_E_PID) }, - { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_S03_PID) }, - { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_59_PID) }, - { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_57A_PID) }, -@@ -952,6 +953,8 @@ static const struct usb_device_id id_table_combined[] = { - { USB_DEVICE(FTDI_VID, FTDI_EKEY_CONV_USB_PID) }, - /* Infineon Devices */ - { USB_DEVICE_INTERFACE_NUMBER(INFINEON_VID, INFINEON_TRIBOARD_PID, 1) }, -+ /* GE Healthcare devices */ -+ { USB_DEVICE(GE_HEALTHCARE_VID, GE_HEALTHCARE_NEMO_TRACKER_PID) }, - { } /* Terminating entry */ - }; - -diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h -index 70b0b1d88ae9..5937b2d242f2 100644 ---- a/drivers/usb/serial/ftdi_sio_ids.h -+++ b/drivers/usb/serial/ftdi_sio_ids.h -@@ -837,6 +837,12 @@ - #define TELLDUS_TELLSTICK_PID 0x0C30 /* RF control dongle 433 MHz using FT232RL */ - - /* -+ * NOVITUS printers -+ */ -+#define NOVITUS_VID 0x1a28 -+#define NOVITUS_BONO_E_PID 0x6010 -+ -+/* - * RT Systems programming cables for various ham radios - */ - #define RTSYSTEMS_VID 0x2100 /* Vendor ID */ -@@ -1385,3 +1391,9 @@ - * ekey biometric systems GmbH (http://ekey.net/) - */ - #define FTDI_EKEY_CONV_USB_PID 0xCB08 /* Converter USB */ -+ -+/* -+ * GE Healthcare devices -+ */ -+#define GE_HEALTHCARE_VID 0x1901 -+#define GE_HEALTHCARE_NEMO_TRACKER_PID 0x0015 -diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c -index 9da566a3f5c8..e47aabe0c760 100644 ---- a/drivers/usb/serial/option.c -+++ b/drivers/usb/serial/option.c -@@ -275,8 +275,12 @@ static void option_instat_callback(struct urb *urb); - #define ZTE_PRODUCT_MF622 0x0001 - #define ZTE_PRODUCT_MF628 0x0015 - #define ZTE_PRODUCT_MF626 0x0031 --#define ZTE_PRODUCT_MC2718 0xffe8 - #define ZTE_PRODUCT_AC2726 0xfff1 -+#define ZTE_PRODUCT_CDMA_TECH 0xfffe -+#define ZTE_PRODUCT_AC8710T 0xffff -+#define ZTE_PRODUCT_MC2718 0xffe8 -+#define ZTE_PRODUCT_AD3812 0xffeb -+#define ZTE_PRODUCT_MC2716 0xffed - - #define BENQ_VENDOR_ID 0x04a5 - #define BENQ_PRODUCT_H10 0x4068 -@@ -494,6 +498,10 @@ static void option_instat_callback(struct urb *urb); - #define INOVIA_VENDOR_ID 0x20a6 - #define INOVIA_SEW858 0x1105 - -+/* VIA Telecom */ -+#define VIATELECOM_VENDOR_ID 0x15eb -+#define VIATELECOM_PRODUCT_CDS7 0x0001 -+ - /* some devices interfaces need special handling due to a number of reasons */ - enum option_blacklist_reason { - OPTION_BLACKLIST_NONE = 0, -@@ -527,10 +535,18 @@ static const struct option_blacklist_info zte_k3765_z_blacklist = { - .reserved = BIT(4), - }; - -+static const struct option_blacklist_info zte_ad3812_z_blacklist = { -+ .sendsetup = BIT(0) | BIT(1) | BIT(2), -+}; -+ - static const struct option_blacklist_info zte_mc2718_z_blacklist = { - .sendsetup = BIT(1) | BIT(2) | BIT(3) | BIT(4), - }; - -+static const struct option_blacklist_info zte_mc2716_z_blacklist = { -+ .sendsetup = BIT(1) | BIT(2) | BIT(3), -+}; -+ - static const struct option_blacklist_info huawei_cdc12_blacklist = { - .reserved = BIT(1) | BIT(2), - }; -@@ -1070,6 +1086,7 @@ static const struct usb_device_id option_ids[] = { - { USB_DEVICE_INTERFACE_CLASS(BANDRICH_VENDOR_ID, BANDRICH_PRODUCT_1012, 0xff) }, - { USB_DEVICE(KYOCERA_VENDOR_ID, KYOCERA_PRODUCT_KPC650) }, - { USB_DEVICE(KYOCERA_VENDOR_ID, KYOCERA_PRODUCT_KPC680) }, -+ { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x6000)}, /* ZTE AC8700 */ - { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x6613)}, /* Onda H600/ZTE MF330 */ - { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x0023)}, /* ONYX 3G device */ - { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x9000)}, /* SIMCom SIM5218 */ -@@ -1544,13 +1561,18 @@ static const struct usb_device_id option_ids[] = { - { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff93, 0xff, 0xff, 0xff) }, - { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff94, 0xff, 0xff, 0xff) }, - -- /* NOTE: most ZTE CDMA devices should be driven by zte_ev, not option */ -+ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_CDMA_TECH, 0xff, 0xff, 0xff) }, -+ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC2726, 0xff, 0xff, 0xff) }, -+ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC8710T, 0xff, 0xff, 0xff) }, - { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MC2718, 0xff, 0xff, 0xff), - .driver_info = (kernel_ulong_t)&zte_mc2718_z_blacklist }, -+ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AD3812, 0xff, 0xff, 0xff), -+ .driver_info = (kernel_ulong_t)&zte_ad3812_z_blacklist }, -+ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MC2716, 0xff, 0xff, 0xff), -+ .driver_info = (kernel_ulong_t)&zte_mc2716_z_blacklist }, - { USB_VENDOR_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff, 0x02, 0x01) }, - { USB_VENDOR_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff, 0x02, 0x05) }, - { USB_VENDOR_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff, 0x86, 0x10) }, -- { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC2726, 0xff, 0xff, 0xff) }, - - { USB_DEVICE(BENQ_VENDOR_ID, BENQ_PRODUCT_H10) }, - { USB_DEVICE(DLINK_VENDOR_ID, DLINK_PRODUCT_DWM_652) }, -@@ -1724,6 +1746,7 @@ static const struct usb_device_id option_ids[] = { - { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x3e01, 0xff, 0xff, 0xff) }, /* D-Link DWM-152/C1 */ - { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x3e02, 0xff, 0xff, 0xff) }, /* D-Link DWM-156/C1 */ - { USB_DEVICE(INOVIA_VENDOR_ID, INOVIA_SEW858) }, -+ { USB_DEVICE(VIATELECOM_VENDOR_ID, VIATELECOM_PRODUCT_CDS7) }, - { } /* Terminating entry */ - }; - MODULE_DEVICE_TABLE(usb, option_ids); -diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c -index b3d5a35c0d4b..e9bad928039f 100644 ---- a/drivers/usb/serial/pl2303.c -+++ b/drivers/usb/serial/pl2303.c -@@ -45,6 +45,7 @@ static const struct usb_device_id id_table[] = { - { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_GPRS) }, - { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_HCR331) }, - { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_MOTOROLA) }, -+ { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_ZTEK) }, - { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID) }, - { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID_RSAQ5) }, - { USB_DEVICE(ATEN_VENDOR_ID, ATEN_PRODUCT_ID) }, -diff --git a/drivers/usb/serial/pl2303.h b/drivers/usb/serial/pl2303.h -index 42bc082896ac..71fd9da1d6e7 100644 ---- a/drivers/usb/serial/pl2303.h -+++ b/drivers/usb/serial/pl2303.h -@@ -22,6 +22,7 @@ - #define PL2303_PRODUCT_ID_GPRS 0x0609 - #define PL2303_PRODUCT_ID_HCR331 0x331a - #define PL2303_PRODUCT_ID_MOTOROLA 0x0307 -+#define PL2303_PRODUCT_ID_ZTEK 0xe1f1 - - #define ATEN_VENDOR_ID 0x0557 - #define ATEN_VENDOR_ID2 0x0547 -diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c -index 37480348e39b..74a9375a9bb5 100644 ---- a/drivers/usb/serial/sierra.c -+++ b/drivers/usb/serial/sierra.c -@@ -282,14 +282,19 @@ static const struct usb_device_id id_table[] = { - /* Sierra Wireless HSPA Non-Composite Device */ - { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x6892, 0xFF, 0xFF, 0xFF)}, - { USB_DEVICE(0x1199, 0x6893) }, /* Sierra Wireless Device */ -- { USB_DEVICE(0x1199, 0x68A3), /* Sierra Wireless Direct IP modems */ -+ /* Sierra Wireless Direct IP modems */ -+ { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x68A3, 0xFF, 0xFF, 0xFF), -+ .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist -+ }, -+ { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x68AA, 0xFF, 0xFF, 0xFF), - .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist - }, - /* AT&T Direct IP LTE modems */ - { USB_DEVICE_AND_INTERFACE_INFO(0x0F3D, 0x68AA, 0xFF, 0xFF, 0xFF), - .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist - }, -- { USB_DEVICE(0x0f3d, 0x68A3), /* Airprime/Sierra Wireless Direct IP modems */ -+ /* Airprime/Sierra Wireless Direct IP modems */ -+ { USB_DEVICE_AND_INTERFACE_INFO(0x0F3D, 0x68A3, 0xFF, 0xFF, 0xFF), - .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist - }, - -diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c -index b169b0f9b3a2..9a08e18e09b9 100644 ---- a/drivers/usb/serial/usb-serial.c -+++ b/drivers/usb/serial/usb-serial.c -@@ -764,29 +764,39 @@ static int usb_serial_probe(struct usb_interface *interface, - if (usb_endpoint_is_bulk_in(endpoint)) { - /* we found a bulk in endpoint */ - dev_dbg(ddev, "found bulk in on endpoint %d\n", i); -- bulk_in_endpoint[num_bulk_in] = endpoint; -- ++num_bulk_in; -+ if (num_bulk_in < MAX_NUM_PORTS) { -+ bulk_in_endpoint[num_bulk_in] = endpoint; -+ ++num_bulk_in; -+ } - } - - if (usb_endpoint_is_bulk_out(endpoint)) { - /* we found a bulk out endpoint */ - dev_dbg(ddev, "found bulk out on endpoint %d\n", i); -- bulk_out_endpoint[num_bulk_out] = endpoint; -- ++num_bulk_out; -+ if (num_bulk_out < MAX_NUM_PORTS) { -+ bulk_out_endpoint[num_bulk_out] = endpoint; -+ ++num_bulk_out; -+ } - } - - if (usb_endpoint_is_int_in(endpoint)) { - /* we found a interrupt in endpoint */ - dev_dbg(ddev, "found interrupt in on endpoint %d\n", i); -- interrupt_in_endpoint[num_interrupt_in] = endpoint; -- ++num_interrupt_in; -+ if (num_interrupt_in < MAX_NUM_PORTS) { -+ interrupt_in_endpoint[num_interrupt_in] = -+ endpoint; -+ ++num_interrupt_in; -+ } - } - - if (usb_endpoint_is_int_out(endpoint)) { - /* we found an interrupt out endpoint */ - dev_dbg(ddev, "found interrupt out on endpoint %d\n", i); -- interrupt_out_endpoint[num_interrupt_out] = endpoint; -- ++num_interrupt_out; -+ if (num_interrupt_out < MAX_NUM_PORTS) { -+ interrupt_out_endpoint[num_interrupt_out] = -+ endpoint; -+ ++num_interrupt_out; -+ } - } - } - -@@ -809,8 +819,10 @@ static int usb_serial_probe(struct usb_interface *interface, - if (usb_endpoint_is_int_in(endpoint)) { - /* we found a interrupt in endpoint */ - dev_dbg(ddev, "found interrupt in for Prolific device on separate interface\n"); -- interrupt_in_endpoint[num_interrupt_in] = endpoint; -- ++num_interrupt_in; -+ if (num_interrupt_in < MAX_NUM_PORTS) { -+ interrupt_in_endpoint[num_interrupt_in] = endpoint; -+ ++num_interrupt_in; -+ } - } - } - } -@@ -850,6 +862,11 @@ static int usb_serial_probe(struct usb_interface *interface, - num_ports = type->num_ports; - } - -+ if (num_ports > MAX_NUM_PORTS) { -+ dev_warn(ddev, "too many ports requested: %d\n", num_ports); -+ num_ports = MAX_NUM_PORTS; -+ } -+ - serial->num_ports = num_ports; - serial->num_bulk_in = num_bulk_in; - serial->num_bulk_out = num_bulk_out; -diff --git a/drivers/usb/serial/zte_ev.c b/drivers/usb/serial/zte_ev.c -index e40ab739c4a6..c9bb107d5e5c 100644 ---- a/drivers/usb/serial/zte_ev.c -+++ b/drivers/usb/serial/zte_ev.c -@@ -272,28 +272,16 @@ static void zte_ev_usb_serial_close(struct usb_serial_port *port) - } - - static const struct usb_device_id id_table[] = { -- /* AC8710, AC8710T */ -- { USB_DEVICE_AND_INTERFACE_INFO(0x19d2, 0xffff, 0xff, 0xff, 0xff) }, -- /* AC8700 */ -- { USB_DEVICE_AND_INTERFACE_INFO(0x19d2, 0xfffe, 0xff, 0xff, 0xff) }, -- /* MG880 */ -- { USB_DEVICE(0x19d2, 0xfffd) }, -- { USB_DEVICE(0x19d2, 0xfffc) }, -- { USB_DEVICE(0x19d2, 0xfffb) }, -- /* AC8710_V3 */ -+ { USB_DEVICE(0x19d2, 0xffec) }, -+ { USB_DEVICE(0x19d2, 0xffee) }, - { USB_DEVICE(0x19d2, 0xfff6) }, - { USB_DEVICE(0x19d2, 0xfff7) }, - { USB_DEVICE(0x19d2, 0xfff8) }, - { USB_DEVICE(0x19d2, 0xfff9) }, -- { USB_DEVICE(0x19d2, 0xffee) }, -- /* AC2716, MC2716 */ -- { USB_DEVICE_AND_INTERFACE_INFO(0x19d2, 0xffed, 0xff, 0xff, 0xff) }, -- /* AD3812 */ -- { USB_DEVICE_AND_INTERFACE_INFO(0x19d2, 0xffeb, 0xff, 0xff, 0xff) }, -- { USB_DEVICE(0x19d2, 0xffec) }, -- { USB_DEVICE(0x05C6, 0x3197) }, -- { USB_DEVICE(0x05C6, 0x6000) }, -- { USB_DEVICE(0x05C6, 0x9008) }, -+ { USB_DEVICE(0x19d2, 0xfffb) }, -+ { USB_DEVICE(0x19d2, 0xfffc) }, -+ /* MG880 */ -+ { USB_DEVICE(0x19d2, 0xfffd) }, - { }, - }; - MODULE_DEVICE_TABLE(usb, id_table); -diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h -index 042c83b01046..7f625306ea80 100644 ---- a/drivers/usb/storage/unusual_devs.h -+++ b/drivers/usb/storage/unusual_devs.h -@@ -101,6 +101,12 @@ UNUSUAL_DEV( 0x03f0, 0x4002, 0x0001, 0x0001, - "PhotoSmart R707", - USB_SC_DEVICE, USB_PR_DEVICE, NULL, US_FL_FIX_CAPACITY), - -+UNUSUAL_DEV( 0x03f3, 0x0001, 0x0000, 0x9999, -+ "Adaptec", -+ "USBConnect 2000", -+ USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_euscsi_init, -+ US_FL_SCM_MULT_TARG ), -+ - /* Reported by Sebastian Kapfer <sebastian_kapfer@gmx.net> - * and Olaf Hering <olh@suse.de> (different bcd's, same vendor/product) - * for USB floppies that need the SINGLE_LUN enforcement. -@@ -741,6 +747,12 @@ UNUSUAL_DEV( 0x059b, 0x0001, 0x0100, 0x0100, - USB_SC_DEVICE, USB_PR_DEVICE, NULL, - US_FL_SINGLE_LUN ), - -+UNUSUAL_DEV( 0x059b, 0x0040, 0x0100, 0x0100, -+ "Iomega", -+ "Jaz USB Adapter", -+ USB_SC_DEVICE, USB_PR_DEVICE, NULL, -+ US_FL_SINGLE_LUN ), -+ - /* Reported by <Hendryk.Pfeiffer@gmx.de> */ - UNUSUAL_DEV( 0x059f, 0x0643, 0x0000, 0x0000, - "LaCie", -@@ -1113,6 +1125,18 @@ UNUSUAL_DEV( 0x0851, 0x1543, 0x0200, 0x0200, - USB_SC_DEVICE, USB_PR_DEVICE, NULL, - US_FL_NOT_LOCKABLE), - -+UNUSUAL_DEV( 0x085a, 0x0026, 0x0100, 0x0133, -+ "Xircom", -+ "PortGear USB-SCSI (Mac USB Dock)", -+ USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_euscsi_init, -+ US_FL_SCM_MULT_TARG ), -+ -+UNUSUAL_DEV( 0x085a, 0x0028, 0x0100, 0x0133, -+ "Xircom", -+ "PortGear USB to SCSI Converter", -+ USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_euscsi_init, -+ US_FL_SCM_MULT_TARG ), -+ - /* Submitted by Jan De Luyck <lkml@kcore.org> */ - UNUSUAL_DEV( 0x08bd, 0x1100, 0x0000, 0x0000, - "CITIZEN", -@@ -1945,6 +1969,14 @@ UNUSUAL_DEV( 0x152d, 0x2329, 0x0100, 0x0100, - USB_SC_DEVICE, USB_PR_DEVICE, NULL, - US_FL_IGNORE_RESIDUE | US_FL_SANE_SENSE ), - -+/* Entrega Technologies U1-SC25 (later Xircom PortGear PGSCSI) -+ * and Mac USB Dock USB-SCSI */ -+UNUSUAL_DEV( 0x1645, 0x0007, 0x0100, 0x0133, -+ "Entrega Technologies", -+ "USB to SCSI Converter", -+ USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_euscsi_init, -+ US_FL_SCM_MULT_TARG ), -+ - /* Reported by Robert Schedel <r.schedel@yahoo.de> - * Note: this is a 'super top' device like the above 14cd/6600 device */ - UNUSUAL_DEV( 0x1652, 0x6600, 0x0201, 0x0201, -@@ -1967,6 +1999,12 @@ UNUSUAL_DEV( 0x177f, 0x0400, 0x0000, 0x0000, - USB_SC_DEVICE, USB_PR_DEVICE, NULL, - US_FL_BULK_IGNORE_TAG | US_FL_MAX_SECTORS_64 ), - -+UNUSUAL_DEV( 0x1822, 0x0001, 0x0000, 0x9999, -+ "Ariston Technologies", -+ "iConnect USB to SCSI adapter", -+ USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_euscsi_init, -+ US_FL_SCM_MULT_TARG ), -+ - /* Reported by Hans de Goede <hdegoede@redhat.com> - * These Appotech controllers are found in Picture Frames, they provide a - * (buggy) emulation of a cdrom drive which contains the windows software -diff --git a/drivers/uwb/lc-dev.c b/drivers/uwb/lc-dev.c -index 80079b8fed15..d0303f0dbe15 100644 ---- a/drivers/uwb/lc-dev.c -+++ b/drivers/uwb/lc-dev.c -@@ -431,16 +431,19 @@ void uwbd_dev_onair(struct uwb_rc *rc, struct uwb_beca_e *bce) - uwb_dev->mac_addr = *bce->mac_addr; - uwb_dev->dev_addr = bce->dev_addr; - dev_set_name(&uwb_dev->dev, "%s", macbuf); -+ -+ /* plug the beacon cache */ -+ bce->uwb_dev = uwb_dev; -+ uwb_dev->bce = bce; -+ uwb_bce_get(bce); /* released in uwb_dev_sys_release() */ -+ - result = uwb_dev_add(uwb_dev, &rc->uwb_dev.dev, rc); - if (result < 0) { - dev_err(dev, "new device %s: cannot instantiate device\n", - macbuf); - goto error_dev_add; - } -- /* plug the beacon cache */ -- bce->uwb_dev = uwb_dev; -- uwb_dev->bce = bce; -- uwb_bce_get(bce); /* released in uwb_dev_sys_release() */ -+ - dev_info(dev, "uwb device (mac %s dev %s) connected to %s %s\n", - macbuf, devbuf, rc->uwb_dev.dev.parent->bus->name, - dev_name(rc->uwb_dev.dev.parent)); -@@ -448,6 +451,8 @@ void uwbd_dev_onair(struct uwb_rc *rc, struct uwb_beca_e *bce) - return; - - error_dev_add: -+ bce->uwb_dev = NULL; -+ uwb_bce_put(bce); - kfree(uwb_dev); - return; - } -diff --git a/drivers/xen/manage.c b/drivers/xen/manage.c -index 624e8dc24532..602913d7ae03 100644 ---- a/drivers/xen/manage.c -+++ b/drivers/xen/manage.c -@@ -111,16 +111,11 @@ static void do_suspend(void) - - shutting_down = SHUTDOWN_SUSPEND; - --#ifdef CONFIG_PREEMPT -- /* If the kernel is preemptible, we need to freeze all the processes -- to prevent them from being in the middle of a pagetable update -- during suspend. */ - err = freeze_processes(); - if (err) { - pr_err("%s: freeze failed %d\n", __func__, err); - goto out; - } --#endif - - err = dpm_suspend_start(PMSG_FREEZE); - if (err) { -@@ -169,10 +164,8 @@ out_resume: - dpm_resume_end(si.cancelled ? PMSG_THAW : PMSG_RESTORE); - - out_thaw: --#ifdef CONFIG_PREEMPT - thaw_processes(); - out: --#endif - shutting_down = SHUTDOWN_INVALID; - } - #endif /* CONFIG_HIBERNATE_CALLBACKS */ -diff --git a/fs/aio.c b/fs/aio.c -index 6d68e01dc7ca..f45ddaa4fffa 100644 ---- a/fs/aio.c -+++ b/fs/aio.c -@@ -141,6 +141,7 @@ struct kioctx { - - struct { - unsigned tail; -+ unsigned completed_events; - spinlock_t completion_lock; - } ____cacheline_aligned_in_smp; - -@@ -796,6 +797,9 @@ void exit_aio(struct mm_struct *mm) - unsigned i = 0; - - while (1) { -+ struct completion requests_done = -+ COMPLETION_INITIALIZER_ONSTACK(requests_done); -+ - rcu_read_lock(); - table = rcu_dereference(mm->ioctx_table); - -@@ -823,7 +827,10 @@ void exit_aio(struct mm_struct *mm) - */ - ctx->mmap_size = 0; - -- kill_ioctx(mm, ctx, NULL); -+ kill_ioctx(mm, ctx, &requests_done); -+ -+ /* Wait until all IO for the context are done. */ -+ wait_for_completion(&requests_done); - } - } - -@@ -880,6 +887,68 @@ out: - return ret; - } - -+/* refill_reqs_available -+ * Updates the reqs_available reference counts used for tracking the -+ * number of free slots in the completion ring. This can be called -+ * from aio_complete() (to optimistically update reqs_available) or -+ * from aio_get_req() (the we're out of events case). It must be -+ * called holding ctx->completion_lock. -+ */ -+static void refill_reqs_available(struct kioctx *ctx, unsigned head, -+ unsigned tail) -+{ -+ unsigned events_in_ring, completed; -+ -+ /* Clamp head since userland can write to it. */ -+ head %= ctx->nr_events; -+ if (head <= tail) -+ events_in_ring = tail - head; -+ else -+ events_in_ring = ctx->nr_events - (head - tail); -+ -+ completed = ctx->completed_events; -+ if (events_in_ring < completed) -+ completed -= events_in_ring; -+ else -+ completed = 0; -+ -+ if (!completed) -+ return; -+ -+ ctx->completed_events -= completed; -+ put_reqs_available(ctx, completed); -+} -+ -+/* user_refill_reqs_available -+ * Called to refill reqs_available when aio_get_req() encounters an -+ * out of space in the completion ring. -+ */ -+static void user_refill_reqs_available(struct kioctx *ctx) -+{ -+ spin_lock_irq(&ctx->completion_lock); -+ if (ctx->completed_events) { -+ struct aio_ring *ring; -+ unsigned head; -+ -+ /* Access of ring->head may race with aio_read_events_ring() -+ * here, but that's okay since whether we read the old version -+ * or the new version, and either will be valid. The important -+ * part is that head cannot pass tail since we prevent -+ * aio_complete() from updating tail by holding -+ * ctx->completion_lock. Even if head is invalid, the check -+ * against ctx->completed_events below will make sure we do the -+ * safe/right thing. -+ */ -+ ring = kmap_atomic(ctx->ring_pages[0]); -+ head = ring->head; -+ kunmap_atomic(ring); -+ -+ refill_reqs_available(ctx, head, ctx->tail); -+ } -+ -+ spin_unlock_irq(&ctx->completion_lock); -+} -+ - /* aio_get_req - * Allocate a slot for an aio request. - * Returns NULL if no requests are free. -@@ -888,8 +957,11 @@ static inline struct kiocb *aio_get_req(struct kioctx *ctx) - { - struct kiocb *req; - -- if (!get_reqs_available(ctx)) -- return NULL; -+ if (!get_reqs_available(ctx)) { -+ user_refill_reqs_available(ctx); -+ if (!get_reqs_available(ctx)) -+ return NULL; -+ } - - req = kmem_cache_alloc(kiocb_cachep, GFP_KERNEL|__GFP_ZERO); - if (unlikely(!req)) -@@ -948,8 +1020,8 @@ void aio_complete(struct kiocb *iocb, long res, long res2) - struct kioctx *ctx = iocb->ki_ctx; - struct aio_ring *ring; - struct io_event *ev_page, *event; -+ unsigned tail, pos, head; - unsigned long flags; -- unsigned tail, pos; - - /* - * Special case handling for sync iocbs: -@@ -1010,10 +1082,14 @@ void aio_complete(struct kiocb *iocb, long res, long res2) - ctx->tail = tail; - - ring = kmap_atomic(ctx->ring_pages[0]); -+ head = ring->head; - ring->tail = tail; - kunmap_atomic(ring); - flush_dcache_page(ctx->ring_pages[0]); - -+ ctx->completed_events++; -+ if (ctx->completed_events > 1) -+ refill_reqs_available(ctx, head, tail); - spin_unlock_irqrestore(&ctx->completion_lock, flags); - - pr_debug("added to ring %p at [%u]\n", iocb, tail); -@@ -1028,7 +1104,6 @@ void aio_complete(struct kiocb *iocb, long res, long res2) - - /* everything turned out well, dispose of the aiocb. */ - kiocb_free(iocb); -- put_reqs_available(ctx, 1); - - /* - * We have to order our ring_info tail store above and test -@@ -1065,6 +1140,12 @@ static long aio_read_events_ring(struct kioctx *ctx, - tail = ring->tail; - kunmap_atomic(ring); - -+ /* -+ * Ensure that once we've read the current tail pointer, that -+ * we also see the events that were stored up to the tail. -+ */ -+ smp_rmb(); -+ - pr_debug("h%u t%u m%u\n", head, tail, ctx->nr_events); - - if (head == tail) -diff --git a/fs/buffer.c b/fs/buffer.c -index 27265a8b43c1..71e2d0ed8530 100644 ---- a/fs/buffer.c -+++ b/fs/buffer.c -@@ -1029,7 +1029,8 @@ grow_dev_page(struct block_device *bdev, sector_t block, - bh = page_buffers(page); - if (bh->b_size == size) { - end_block = init_page_buffers(page, bdev, -- index << sizebits, size); -+ (sector_t)index << sizebits, -+ size); - goto done; - } - if (!try_to_free_buffers(page)) -@@ -1050,7 +1051,8 @@ grow_dev_page(struct block_device *bdev, sector_t block, - */ - spin_lock(&inode->i_mapping->private_lock); - link_dev_buffers(page, bh); -- end_block = init_page_buffers(page, bdev, index << sizebits, size); -+ end_block = init_page_buffers(page, bdev, (sector_t)index << sizebits, -+ size); - spin_unlock(&inode->i_mapping->private_lock); - done: - ret = (block < end_block) ? 1 : -ENXIO; -diff --git a/fs/cifs/link.c b/fs/cifs/link.c -index 68559fd557fb..a5c2812ead68 100644 ---- a/fs/cifs/link.c -+++ b/fs/cifs/link.c -@@ -213,8 +213,12 @@ create_mf_symlink(const unsigned int xid, struct cifs_tcon *tcon, - if (rc) - goto out; - -- rc = tcon->ses->server->ops->create_mf_symlink(xid, tcon, cifs_sb, -- fromName, buf, &bytes_written); -+ if (tcon->ses->server->ops->create_mf_symlink) -+ rc = tcon->ses->server->ops->create_mf_symlink(xid, tcon, -+ cifs_sb, fromName, buf, &bytes_written); -+ else -+ rc = -EOPNOTSUPP; -+ - if (rc) - goto out; - -diff --git a/fs/eventpoll.c b/fs/eventpoll.c -index ead00467282d..f50d79eb52db 100644 ---- a/fs/eventpoll.c -+++ b/fs/eventpoll.c -@@ -1852,7 +1852,8 @@ SYSCALL_DEFINE4(epoll_ctl, int, epfd, int, op, int, fd, - goto error_tgt_fput; - - /* Check if EPOLLWAKEUP is allowed */ -- ep_take_care_of_epollwakeup(&epds); -+ if (ep_op_has_event(op)) -+ ep_take_care_of_epollwakeup(&epds); - - /* - * We have to check that the file structure underneath the file descriptor -diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c -index 5c524180c98e..bc643b97423c 100644 ---- a/fs/gfs2/inode.c -+++ b/fs/gfs2/inode.c -@@ -606,8 +606,10 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry, - if (!IS_ERR(inode)) { - d = d_splice_alias(inode, dentry); - error = PTR_ERR(d); -- if (IS_ERR(d)) -+ if (IS_ERR(d)) { -+ inode = ERR_CAST(d); - goto fail_gunlock; -+ } - error = 0; - if (file) { - if (S_ISREG(inode->i_mode)) { -@@ -823,7 +825,6 @@ static struct dentry *__gfs2_lookup(struct inode *dir, struct dentry *dentry, - - d = d_splice_alias(inode, dentry); - if (IS_ERR(d)) { -- iput(inode); - gfs2_glock_dq_uninit(&gh); - return d; - } -diff --git a/fs/lockd/svc.c b/fs/lockd/svc.c -index 6bf06a07f3e0..223e1cb14345 100644 ---- a/fs/lockd/svc.c -+++ b/fs/lockd/svc.c -@@ -253,13 +253,11 @@ static int lockd_up_net(struct svc_serv *serv, struct net *net) - - error = make_socks(serv, net); - if (error < 0) -- goto err_socks; -+ goto err_bind; - set_grace_period(net); - dprintk("lockd_up_net: per-net data created; net=%p\n", net); - return 0; - --err_socks: -- svc_rpcb_cleanup(serv, net); - err_bind: - ln->nlmsvc_users--; - return error; -diff --git a/fs/namei.c b/fs/namei.c -index d5a4faeb39a5..dd2f2c5bda55 100644 ---- a/fs/namei.c -+++ b/fs/namei.c -@@ -642,24 +642,22 @@ static int complete_walk(struct nameidata *nd) - - static __always_inline void set_root(struct nameidata *nd) - { -- if (!nd->root.mnt) -- get_fs_root(current->fs, &nd->root); -+ get_fs_root(current->fs, &nd->root); - } - - static int link_path_walk(const char *, struct nameidata *); - --static __always_inline void set_root_rcu(struct nameidata *nd) -+static __always_inline unsigned set_root_rcu(struct nameidata *nd) - { -- if (!nd->root.mnt) { -- struct fs_struct *fs = current->fs; -- unsigned seq; -+ struct fs_struct *fs = current->fs; -+ unsigned seq, res; - -- do { -- seq = read_seqcount_begin(&fs->seq); -- nd->root = fs->root; -- nd->seq = __read_seqcount_begin(&nd->root.dentry->d_seq); -- } while (read_seqcount_retry(&fs->seq, seq)); -- } -+ do { -+ seq = read_seqcount_begin(&fs->seq); -+ nd->root = fs->root; -+ res = __read_seqcount_begin(&nd->root.dentry->d_seq); -+ } while (read_seqcount_retry(&fs->seq, seq)); -+ return res; - } - - static void path_put_conditional(struct path *path, struct nameidata *nd) -@@ -859,7 +857,8 @@ follow_link(struct path *link, struct nameidata *nd, void **p) - return PTR_ERR(s); - } - if (*s == '/') { -- set_root(nd); -+ if (!nd->root.mnt) -+ set_root(nd); - path_put(&nd->path); - nd->path = nd->root; - path_get(&nd->root); -@@ -1132,7 +1131,8 @@ static bool __follow_mount_rcu(struct nameidata *nd, struct path *path, - - static int follow_dotdot_rcu(struct nameidata *nd) - { -- set_root_rcu(nd); -+ if (!nd->root.mnt) -+ set_root_rcu(nd); - - while (1) { - if (nd->path.dentry == nd->root.dentry && -@@ -1244,7 +1244,8 @@ static void follow_mount(struct path *path) - - static void follow_dotdot(struct nameidata *nd) - { -- set_root(nd); -+ if (!nd->root.mnt) -+ set_root(nd); - - while(1) { - struct dentry *old = nd->path.dentry; -@@ -1842,7 +1843,7 @@ static int path_init(int dfd, const char *name, unsigned int flags, - if (*name=='/') { - if (flags & LOOKUP_RCU) { - rcu_read_lock(); -- set_root_rcu(nd); -+ nd->seq = set_root_rcu(nd); - } else { - set_root(nd); - path_get(&nd->root); -diff --git a/fs/nfs/nfs4client.c b/fs/nfs/nfs4client.c -index 0e46d3d1b6cc..1abe4f55dea2 100644 ---- a/fs/nfs/nfs4client.c -+++ b/fs/nfs/nfs4client.c -@@ -482,6 +482,16 @@ int nfs40_walk_client_list(struct nfs_client *new, - - spin_lock(&nn->nfs_client_lock); - list_for_each_entry(pos, &nn->nfs_client_list, cl_share_link) { -+ -+ if (pos->rpc_ops != new->rpc_ops) -+ continue; -+ -+ if (pos->cl_proto != new->cl_proto) -+ continue; -+ -+ if (pos->cl_minorversion != new->cl_minorversion) -+ continue; -+ - /* If "pos" isn't marked ready, we can't trust the - * remaining fields in "pos" */ - if (pos->cl_cons_state > NFS_CS_READY) { -@@ -501,15 +511,6 @@ int nfs40_walk_client_list(struct nfs_client *new, - if (pos->cl_cons_state != NFS_CS_READY) - continue; - -- if (pos->rpc_ops != new->rpc_ops) -- continue; -- -- if (pos->cl_proto != new->cl_proto) -- continue; -- -- if (pos->cl_minorversion != new->cl_minorversion) -- continue; -- - if (pos->cl_clientid != new->cl_clientid) - continue; - -@@ -615,6 +616,16 @@ int nfs41_walk_client_list(struct nfs_client *new, - - spin_lock(&nn->nfs_client_lock); - list_for_each_entry(pos, &nn->nfs_client_list, cl_share_link) { -+ -+ if (pos->rpc_ops != new->rpc_ops) -+ continue; -+ -+ if (pos->cl_proto != new->cl_proto) -+ continue; -+ -+ if (pos->cl_minorversion != new->cl_minorversion) -+ continue; -+ - /* If "pos" isn't marked ready, we can't trust the - * remaining fields in "pos", especially the client - * ID and serverowner fields. Wait for CREATE_SESSION -@@ -640,15 +651,6 @@ int nfs41_walk_client_list(struct nfs_client *new, - if (pos->cl_cons_state != NFS_CS_READY) - continue; - -- if (pos->rpc_ops != new->rpc_ops) -- continue; -- -- if (pos->cl_proto != new->cl_proto) -- continue; -- -- if (pos->cl_minorversion != new->cl_minorversion) -- continue; -- - if (!nfs4_match_clientids(pos, new)) - continue; - -diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c -index 17f91a72840b..2e9662ea5451 100644 ---- a/fs/nfs/nfs4proc.c -+++ b/fs/nfs/nfs4proc.c -@@ -2558,23 +2558,23 @@ static void nfs4_close_prepare(struct rpc_task *task, void *data) - is_rdwr = test_bit(NFS_O_RDWR_STATE, &state->flags); - is_rdonly = test_bit(NFS_O_RDONLY_STATE, &state->flags); - is_wronly = test_bit(NFS_O_WRONLY_STATE, &state->flags); -- /* Calculate the current open share mode */ -- calldata->arg.fmode = 0; -- if (is_rdonly || is_rdwr) -- calldata->arg.fmode |= FMODE_READ; -- if (is_wronly || is_rdwr) -- calldata->arg.fmode |= FMODE_WRITE; - /* Calculate the change in open mode */ -+ calldata->arg.fmode = 0; - if (state->n_rdwr == 0) { -- if (state->n_rdonly == 0) { -- call_close |= is_rdonly || is_rdwr; -- calldata->arg.fmode &= ~FMODE_READ; -- } -- if (state->n_wronly == 0) { -- call_close |= is_wronly || is_rdwr; -- calldata->arg.fmode &= ~FMODE_WRITE; -- } -- } -+ if (state->n_rdonly == 0) -+ call_close |= is_rdonly; -+ else if (is_rdonly) -+ calldata->arg.fmode |= FMODE_READ; -+ if (state->n_wronly == 0) -+ call_close |= is_wronly; -+ else if (is_wronly) -+ calldata->arg.fmode |= FMODE_WRITE; -+ } else if (is_rdwr) -+ calldata->arg.fmode |= FMODE_READ|FMODE_WRITE; -+ -+ if (calldata->arg.fmode == 0) -+ call_close |= is_rdwr; -+ - if (!nfs4_valid_open_stateid(state)) - call_close = 0; - spin_unlock(&state->owner->so_lock); -diff --git a/fs/nilfs2/inode.c b/fs/nilfs2/inode.c -index 7e350c562e0e..1e0bbae06ee7 100644 ---- a/fs/nilfs2/inode.c -+++ b/fs/nilfs2/inode.c -@@ -24,6 +24,7 @@ - #include <linux/buffer_head.h> - #include <linux/gfp.h> - #include <linux/mpage.h> -+#include <linux/pagemap.h> - #include <linux/writeback.h> - #include <linux/aio.h> - #include "nilfs.h" -@@ -219,10 +220,10 @@ static int nilfs_writepage(struct page *page, struct writeback_control *wbc) - - static int nilfs_set_page_dirty(struct page *page) - { -+ struct inode *inode = page->mapping->host; - int ret = __set_page_dirty_nobuffers(page); - - if (page_has_buffers(page)) { -- struct inode *inode = page->mapping->host; - unsigned nr_dirty = 0; - struct buffer_head *bh, *head; - -@@ -245,6 +246,10 @@ static int nilfs_set_page_dirty(struct page *page) - - if (nr_dirty) - nilfs_set_file_dirty(inode, nr_dirty); -+ } else if (ret) { -+ unsigned nr_dirty = 1 << (PAGE_CACHE_SHIFT - inode->i_blkbits); -+ -+ nilfs_set_file_dirty(inode, nr_dirty); - } - return ret; - } -diff --git a/fs/notify/fdinfo.c b/fs/notify/fdinfo.c -index 238a5930cb3c..9d7e2b9659cb 100644 ---- a/fs/notify/fdinfo.c -+++ b/fs/notify/fdinfo.c -@@ -42,7 +42,7 @@ static int show_mark_fhandle(struct seq_file *m, struct inode *inode) - { - struct { - struct file_handle handle; -- u8 pad[64]; -+ u8 pad[MAX_HANDLE_SZ]; - } f; - int size, ret, i; - -@@ -50,7 +50,7 @@ static int show_mark_fhandle(struct seq_file *m, struct inode *inode) - size = f.handle.handle_bytes >> 2; - - ret = exportfs_encode_inode_fh(inode, (struct fid *)f.handle.f_handle, &size, 0); -- if ((ret == 255) || (ret == -ENOSPC)) { -+ if ((ret == FILEID_INVALID) || (ret < 0)) { - WARN_ONCE(1, "Can't encode file handler for inotify: %d\n", ret); - return 0; - } -diff --git a/fs/ocfs2/dlm/dlmmaster.c b/fs/ocfs2/dlm/dlmmaster.c -index af3f7aa73e13..1be3398c96f6 100644 ---- a/fs/ocfs2/dlm/dlmmaster.c -+++ b/fs/ocfs2/dlm/dlmmaster.c -@@ -650,12 +650,9 @@ void dlm_lockres_clear_refmap_bit(struct dlm_ctxt *dlm, - clear_bit(bit, res->refmap); - } - -- --void dlm_lockres_grab_inflight_ref(struct dlm_ctxt *dlm, -+static void __dlm_lockres_grab_inflight_ref(struct dlm_ctxt *dlm, - struct dlm_lock_resource *res) - { -- assert_spin_locked(&res->spinlock); -- - res->inflight_locks++; - - mlog(0, "%s: res %.*s, inflight++: now %u, %ps()\n", dlm->name, -@@ -663,6 +660,13 @@ void dlm_lockres_grab_inflight_ref(struct dlm_ctxt *dlm, - __builtin_return_address(0)); - } - -+void dlm_lockres_grab_inflight_ref(struct dlm_ctxt *dlm, -+ struct dlm_lock_resource *res) -+{ -+ assert_spin_locked(&res->spinlock); -+ __dlm_lockres_grab_inflight_ref(dlm, res); -+} -+ - void dlm_lockres_drop_inflight_ref(struct dlm_ctxt *dlm, - struct dlm_lock_resource *res) - { -@@ -852,10 +856,8 @@ lookup: - /* finally add the lockres to its hash bucket */ - __dlm_insert_lockres(dlm, res); - -- /* Grab inflight ref to pin the resource */ -- spin_lock(&res->spinlock); -- dlm_lockres_grab_inflight_ref(dlm, res); -- spin_unlock(&res->spinlock); -+ /* since this lockres is new it doesn't not require the spinlock */ -+ __dlm_lockres_grab_inflight_ref(dlm, res); - - /* get an extra ref on the mle in case this is a BLOCK - * if so, the creator of the BLOCK may try to put the last -diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h -index e9c4f190ffae..ac46782c10d3 100644 ---- a/include/acpi/acpi_bus.h -+++ b/include/acpi/acpi_bus.h -@@ -118,6 +118,7 @@ struct acpi_device; - struct acpi_hotplug_profile { - struct kobject kobj; - int (*scan_dependent)(struct acpi_device *adev); -+ void (*notify_online)(struct acpi_device *adev); - bool enabled:1; - bool demand_offline:1; - }; -diff --git a/include/linux/iio/trigger.h b/include/linux/iio/trigger.h -index 369cf2cd5144..68f46cd5d514 100644 ---- a/include/linux/iio/trigger.h -+++ b/include/linux/iio/trigger.h -@@ -84,10 +84,12 @@ static inline void iio_trigger_put(struct iio_trigger *trig) - put_device(&trig->dev); - } - --static inline void iio_trigger_get(struct iio_trigger *trig) -+static inline struct iio_trigger *iio_trigger_get(struct iio_trigger *trig) - { - get_device(&trig->dev); - __module_get(trig->ops->owner); -+ -+ return trig; - } - - /** -diff --git a/include/linux/seqlock.h b/include/linux/seqlock.h -index 535f158977b9..8cf350325dc6 100644 ---- a/include/linux/seqlock.h -+++ b/include/linux/seqlock.h -@@ -164,8 +164,6 @@ static inline unsigned read_seqcount_begin(const seqcount_t *s) - static inline unsigned raw_seqcount_begin(const seqcount_t *s) - { - unsigned ret = ACCESS_ONCE(s->sequence); -- -- seqcount_lockdep_reader_access(s); - smp_rmb(); - return ret & ~1; - } -diff --git a/include/linux/vga_switcheroo.h b/include/linux/vga_switcheroo.h -index 502073a53dd3..b483abd34493 100644 ---- a/include/linux/vga_switcheroo.h -+++ b/include/linux/vga_switcheroo.h -@@ -64,6 +64,7 @@ int vga_switcheroo_get_client_state(struct pci_dev *dev); - void vga_switcheroo_set_dynamic_switch(struct pci_dev *pdev, enum vga_switcheroo_state dynamic); - - int vga_switcheroo_init_domain_pm_ops(struct device *dev, struct dev_pm_domain *domain); -+void vga_switcheroo_fini_domain_pm_ops(struct device *dev); - int vga_switcheroo_init_domain_pm_optimus_hdmi_audio(struct device *dev, struct dev_pm_domain *domain); - #else - -@@ -82,6 +83,7 @@ static inline int vga_switcheroo_get_client_state(struct pci_dev *dev) { return - static inline void vga_switcheroo_set_dynamic_switch(struct pci_dev *pdev, enum vga_switcheroo_state dynamic) {} - - static inline int vga_switcheroo_init_domain_pm_ops(struct device *dev, struct dev_pm_domain *domain) { return -EINVAL; } -+static inline void vga_switcheroo_fini_domain_pm_ops(struct device *dev) {} - static inline int vga_switcheroo_init_domain_pm_optimus_hdmi_audio(struct device *dev, struct dev_pm_domain *domain) { return -EINVAL; } - - #endif -diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h -index 704f4f652d0a..6c62cfa25f1a 100644 ---- a/include/linux/workqueue.h -+++ b/include/linux/workqueue.h -@@ -452,7 +452,7 @@ __alloc_workqueue_key(const char *fmt, unsigned int flags, int max_active, - alloc_workqueue("%s", WQ_FREEZABLE | WQ_UNBOUND | WQ_MEM_RECLAIM, \ - 1, (name)) - #define create_singlethread_workqueue(name) \ -- alloc_workqueue("%s", WQ_UNBOUND | WQ_MEM_RECLAIM, 1, (name)) -+ alloc_ordered_workqueue("%s", WQ_MEM_RECLAIM, name) - - extern void destroy_workqueue(struct workqueue_struct *wq); - -diff --git a/include/net/regulatory.h b/include/net/regulatory.h -index b07cdc9fa454..f103f30122a1 100644 ---- a/include/net/regulatory.h -+++ b/include/net/regulatory.h -@@ -160,7 +160,7 @@ struct ieee80211_reg_rule { - struct ieee80211_regdomain { - struct rcu_head rcu_head; - u32 n_reg_rules; -- char alpha2[2]; -+ char alpha2[3]; - enum nl80211_dfs_regions dfs_region; - struct ieee80211_reg_rule reg_rules[]; - }; -diff --git a/include/uapi/linux/usb/functionfs.h b/include/uapi/linux/usb/functionfs.h -index 29e9c7aa9c66..f279394aafb0 100644 ---- a/include/uapi/linux/usb/functionfs.h -+++ b/include/uapi/linux/usb/functionfs.h -@@ -27,24 +27,18 @@ struct usb_endpoint_descriptor_no_audio { - __u8 bInterval; - } __attribute__((packed)); - --/* Legacy format, deprecated as of 3.14. */ --struct usb_functionfs_descs_head { -- __le32 magic; -- __le32 length; -- __le32 fs_count; -- __le32 hs_count; --} __attribute__((packed, deprecated)); - - /* - * All numbers must be in little endian order. - */ - -+/* Legacy format, deprecated as of 3.14. */ - struct usb_functionfs_descs_head { - __le32 magic; - __le32 length; - __le32 fs_count; - __le32 hs_count; --} __attribute__((packed)); -+} __attribute__((packed, deprecated)); - - /* - * Descriptors format: -diff --git a/include/uapi/linux/xattr.h b/include/uapi/linux/xattr.h -index c38355c1f3c9..1590c49cae57 100644 ---- a/include/uapi/linux/xattr.h -+++ b/include/uapi/linux/xattr.h -@@ -13,7 +13,7 @@ - #ifndef _UAPI_LINUX_XATTR_H - #define _UAPI_LINUX_XATTR_H - --#ifdef __UAPI_DEF_XATTR -+#if __UAPI_DEF_XATTR - #define __USE_KERNEL_XATTR_DEFS - - #define XATTR_CREATE 0x1 /* set value, fail if attr already exists */ -diff --git a/kernel/cgroup.c b/kernel/cgroup.c -index 0c753ddd223b..550e2050d778 100644 ---- a/kernel/cgroup.c -+++ b/kernel/cgroup.c -@@ -3663,7 +3663,6 @@ static int pidlist_array_load(struct cgroup *cgrp, enum cgroup_filetype type, - - l = cgroup_pidlist_find_create(cgrp, type); - if (!l) { -- mutex_unlock(&cgrp->pidlist_mutex); - pidlist_free(array); - return -ENOMEM; - } -diff --git a/kernel/events/core.c b/kernel/events/core.c -index f774e9365a03..3a140ca37777 100644 ---- a/kernel/events/core.c -+++ b/kernel/events/core.c -@@ -1516,6 +1516,11 @@ retry: - */ - if (ctx->is_active) { - raw_spin_unlock_irq(&ctx->lock); -+ /* -+ * Reload the task pointer, it might have been changed by -+ * a concurrent perf_event_context_sched_out(). -+ */ -+ task = ctx->task; - goto retry; - } - -@@ -1957,6 +1962,11 @@ retry: - */ - if (ctx->is_active) { - raw_spin_unlock_irq(&ctx->lock); -+ /* -+ * Reload the task pointer, it might have been changed by -+ * a concurrent perf_event_context_sched_out(). -+ */ -+ task = ctx->task; - goto retry; - } - -diff --git a/kernel/futex.c b/kernel/futex.c -index e3087afb7429..0b0dc02aabce 100644 ---- a/kernel/futex.c -+++ b/kernel/futex.c -@@ -2614,6 +2614,7 @@ static int futex_wait_requeue_pi(u32 __user *uaddr, unsigned int flags, - * shared futexes. We need to compare the keys: - */ - if (match_futex(&q.key, &key2)) { -+ queue_unlock(hb); - ret = -EINVAL; - goto out_put_keys; - } -diff --git a/kernel/kcmp.c b/kernel/kcmp.c -index e30ac0fe61c3..0aa69ea1d8fd 100644 ---- a/kernel/kcmp.c -+++ b/kernel/kcmp.c -@@ -44,11 +44,12 @@ static long kptr_obfuscate(long v, int type) - */ - static int kcmp_ptr(void *v1, void *v2, enum kcmp_type type) - { -- long ret; -+ long t1, t2; - -- ret = kptr_obfuscate((long)v1, type) - kptr_obfuscate((long)v2, type); -+ t1 = kptr_obfuscate((long)v1, type); -+ t2 = kptr_obfuscate((long)v2, type); - -- return (ret < 0) | ((ret > 0) << 1); -+ return (t1 < t2) | ((t1 > t2) << 1); - } - - /* The caller must have pinned the task */ -diff --git a/kernel/power/main.c b/kernel/power/main.c -index 1d1bf630e6e9..3ae41cdd804a 100644 ---- a/kernel/power/main.c -+++ b/kernel/power/main.c -@@ -293,12 +293,12 @@ static ssize_t state_show(struct kobject *kobj, struct kobj_attribute *attr, - { - char *s = buf; - #ifdef CONFIG_SUSPEND -- int i; -+ suspend_state_t i; -+ -+ for (i = PM_SUSPEND_MIN; i < PM_SUSPEND_MAX; i++) -+ if (pm_states[i].state) -+ s += sprintf(s,"%s ", pm_states[i].label); - -- for (i = 0; i < PM_SUSPEND_MAX; i++) { -- if (pm_states[i] && valid_state(i)) -- s += sprintf(s,"%s ", pm_states[i]); -- } - #endif - #ifdef CONFIG_HIBERNATION - s += sprintf(s, "%s\n", "disk"); -@@ -314,7 +314,7 @@ static suspend_state_t decode_state(const char *buf, size_t n) - { - #ifdef CONFIG_SUSPEND - suspend_state_t state = PM_SUSPEND_MIN; -- const char * const *s; -+ struct pm_sleep_state *s; - #endif - char *p; - int len; -@@ -328,8 +328,9 @@ static suspend_state_t decode_state(const char *buf, size_t n) - - #ifdef CONFIG_SUSPEND - for (s = &pm_states[state]; state < PM_SUSPEND_MAX; s++, state++) -- if (*s && len == strlen(*s) && !strncmp(buf, *s, len)) -- return state; -+ if (s->state && len == strlen(s->label) -+ && !strncmp(buf, s->label, len)) -+ return s->state; - #endif - - return PM_SUSPEND_ON; -@@ -447,8 +448,8 @@ static ssize_t autosleep_show(struct kobject *kobj, - - #ifdef CONFIG_SUSPEND - if (state < PM_SUSPEND_MAX) -- return sprintf(buf, "%s\n", valid_state(state) ? -- pm_states[state] : "error"); -+ return sprintf(buf, "%s\n", pm_states[state].state ? -+ pm_states[state].label : "error"); - #endif - #ifdef CONFIG_HIBERNATION - return sprintf(buf, "disk\n"); -diff --git a/kernel/power/power.h b/kernel/power/power.h -index 7d4b7ffb3c1d..f770cad3666c 100644 ---- a/kernel/power/power.h -+++ b/kernel/power/power.h -@@ -175,17 +175,20 @@ extern void swsusp_show_speed(struct timeval *, struct timeval *, - unsigned int, char *); - - #ifdef CONFIG_SUSPEND -+struct pm_sleep_state { -+ const char *label; -+ suspend_state_t state; -+}; -+ - /* kernel/power/suspend.c */ --extern const char *const pm_states[]; -+extern struct pm_sleep_state pm_states[]; - --extern bool valid_state(suspend_state_t state); - extern int suspend_devices_and_enter(suspend_state_t state); - #else /* !CONFIG_SUSPEND */ - static inline int suspend_devices_and_enter(suspend_state_t state) - { - return -ENOSYS; - } --static inline bool valid_state(suspend_state_t state) { return false; } - #endif /* !CONFIG_SUSPEND */ - - #ifdef CONFIG_PM_TEST_SUSPEND -diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c -index 62ee437b5c7e..5455d5c3c149 100644 ---- a/kernel/power/suspend.c -+++ b/kernel/power/suspend.c -@@ -29,10 +29,10 @@ - - #include "power.h" - --const char *const pm_states[PM_SUSPEND_MAX] = { -- [PM_SUSPEND_FREEZE] = "freeze", -- [PM_SUSPEND_STANDBY] = "standby", -- [PM_SUSPEND_MEM] = "mem", -+struct pm_sleep_state pm_states[PM_SUSPEND_MAX] = { -+ [PM_SUSPEND_FREEZE] = { .label = "freeze", .state = PM_SUSPEND_FREEZE }, -+ [PM_SUSPEND_STANDBY] = { .label = "standby", }, -+ [PM_SUSPEND_MEM] = { .label = "mem", }, - }; - - static const struct platform_suspend_ops *suspend_ops; -@@ -62,42 +62,34 @@ void freeze_wake(void) - } - EXPORT_SYMBOL_GPL(freeze_wake); - -+static bool valid_state(suspend_state_t state) -+{ -+ /* -+ * PM_SUSPEND_STANDBY and PM_SUSPEND_MEM states need low level -+ * support and need to be valid to the low level -+ * implementation, no valid callback implies that none are valid. -+ */ -+ return suspend_ops && suspend_ops->valid && suspend_ops->valid(state); -+} -+ - /** - * suspend_set_ops - Set the global suspend method table. - * @ops: Suspend operations to use. - */ - void suspend_set_ops(const struct platform_suspend_ops *ops) - { -+ suspend_state_t i; -+ - lock_system_sleep(); -+ - suspend_ops = ops; -+ for (i = PM_SUSPEND_STANDBY; i <= PM_SUSPEND_MEM; i++) -+ pm_states[i].state = valid_state(i) ? i : 0; -+ - unlock_system_sleep(); - } - EXPORT_SYMBOL_GPL(suspend_set_ops); - --bool valid_state(suspend_state_t state) --{ -- if (state == PM_SUSPEND_FREEZE) { --#ifdef CONFIG_PM_DEBUG -- if (pm_test_level != TEST_NONE && -- pm_test_level != TEST_FREEZER && -- pm_test_level != TEST_DEVICES && -- pm_test_level != TEST_PLATFORM) { -- printk(KERN_WARNING "Unsupported pm_test mode for " -- "freeze state, please choose " -- "none/freezer/devices/platform.\n"); -- return false; -- } --#endif -- return true; -- } -- /* -- * PM_SUSPEND_STANDBY and PM_SUSPEND_MEMORY states need lowlevel -- * support and need to be valid to the lowlevel -- * implementation, no valid callback implies that none are valid. -- */ -- return suspend_ops && suspend_ops->valid && suspend_ops->valid(state); --} -- - /** - * suspend_valid_only_mem - Generic memory-only valid callback. - * -@@ -324,9 +316,17 @@ static int enter_state(suspend_state_t state) - { - int error; - -- if (!valid_state(state)) -- return -ENODEV; -- -+ if (state == PM_SUSPEND_FREEZE) { -+#ifdef CONFIG_PM_DEBUG -+ if (pm_test_level != TEST_NONE && pm_test_level <= TEST_CPUS) { -+ pr_warning("PM: Unsupported test mode for freeze state," -+ "please choose none/freezer/devices/platform.\n"); -+ return -EAGAIN; -+ } -+#endif -+ } else if (!valid_state(state)) { -+ return -EINVAL; -+ } - if (!mutex_trylock(&pm_mutex)) - return -EBUSY; - -@@ -337,7 +337,7 @@ static int enter_state(suspend_state_t state) - sys_sync(); - printk("done.\n"); - -- pr_debug("PM: Preparing system for %s sleep\n", pm_states[state]); -+ pr_debug("PM: Preparing system for %s sleep\n", pm_states[state].label); - error = suspend_prepare(state); - if (error) - goto Unlock; -@@ -345,7 +345,7 @@ static int enter_state(suspend_state_t state) - if (suspend_test(TEST_FREEZER)) - goto Finish; - -- pr_debug("PM: Entering %s sleep\n", pm_states[state]); -+ pr_debug("PM: Entering %s sleep\n", pm_states[state].label); - pm_restrict_gfp_mask(); - error = suspend_devices_and_enter(state); - pm_restore_gfp_mask(); -diff --git a/kernel/power/suspend_test.c b/kernel/power/suspend_test.c -index 9b2a1d58558d..269b097e78ea 100644 ---- a/kernel/power/suspend_test.c -+++ b/kernel/power/suspend_test.c -@@ -92,13 +92,13 @@ static void __init test_wakealarm(struct rtc_device *rtc, suspend_state_t state) - } - - if (state == PM_SUSPEND_MEM) { -- printk(info_test, pm_states[state]); -+ printk(info_test, pm_states[state].label); - status = pm_suspend(state); - if (status == -ENODEV) - state = PM_SUSPEND_STANDBY; - } - if (state == PM_SUSPEND_STANDBY) { -- printk(info_test, pm_states[state]); -+ printk(info_test, pm_states[state].label); - status = pm_suspend(state); - } - if (status < 0) -@@ -136,18 +136,16 @@ static char warn_bad_state[] __initdata = - - static int __init setup_test_suspend(char *value) - { -- unsigned i; -+ suspend_state_t i; - - /* "=mem" ==> "mem" */ - value++; -- for (i = 0; i < PM_SUSPEND_MAX; i++) { -- if (!pm_states[i]) -- continue; -- if (strcmp(pm_states[i], value) != 0) -- continue; -- test_state = (__force suspend_state_t) i; -- return 0; -- } -+ for (i = PM_SUSPEND_MIN; i < PM_SUSPEND_MAX; i++) -+ if (!strcmp(pm_states[i].label, value)) { -+ test_state = pm_states[i].state; -+ return 0; -+ } -+ - printk(warn_bad_state, value); - return 0; - } -@@ -164,8 +162,8 @@ static int __init test_suspend(void) - /* PM is initialized by now; is that state testable? */ - if (test_state == PM_SUSPEND_ON) - goto done; -- if (!valid_state(test_state)) { -- printk(warn_bad_state, pm_states[test_state]); -+ if (!pm_states[test_state].state) { -+ printk(warn_bad_state, pm_states[test_state].label); - goto done; - } - -diff --git a/kernel/time/alarmtimer.c b/kernel/time/alarmtimer.c -index fe75444ae7ec..cd45a0727a16 100644 ---- a/kernel/time/alarmtimer.c -+++ b/kernel/time/alarmtimer.c -@@ -464,18 +464,26 @@ static enum alarmtimer_type clock2alarm(clockid_t clockid) - static enum alarmtimer_restart alarm_handle_timer(struct alarm *alarm, - ktime_t now) - { -+ unsigned long flags; - struct k_itimer *ptr = container_of(alarm, struct k_itimer, - it.alarm.alarmtimer); -- if (posix_timer_event(ptr, 0) != 0) -- ptr->it_overrun++; -+ enum alarmtimer_restart result = ALARMTIMER_NORESTART; -+ -+ spin_lock_irqsave(&ptr->it_lock, flags); -+ if ((ptr->it_sigev_notify & ~SIGEV_THREAD_ID) != SIGEV_NONE) { -+ if (posix_timer_event(ptr, 0) != 0) -+ ptr->it_overrun++; -+ } - - /* Re-add periodic timers */ - if (ptr->it.alarm.interval.tv64) { - ptr->it_overrun += alarm_forward(alarm, now, - ptr->it.alarm.interval); -- return ALARMTIMER_RESTART; -+ result = ALARMTIMER_RESTART; - } -- return ALARMTIMER_NORESTART; -+ spin_unlock_irqrestore(&ptr->it_lock, flags); -+ -+ return result; - } - - /** -@@ -541,18 +549,22 @@ static int alarm_timer_create(struct k_itimer *new_timer) - * @new_timer: k_itimer pointer - * @cur_setting: itimerspec data to fill - * -- * Copies the itimerspec data out from the k_itimer -+ * Copies out the current itimerspec data - */ - static void alarm_timer_get(struct k_itimer *timr, - struct itimerspec *cur_setting) - { -- memset(cur_setting, 0, sizeof(struct itimerspec)); -+ ktime_t relative_expiry_time = -+ alarm_expires_remaining(&(timr->it.alarm.alarmtimer)); -+ -+ if (ktime_to_ns(relative_expiry_time) > 0) { -+ cur_setting->it_value = ktime_to_timespec(relative_expiry_time); -+ } else { -+ cur_setting->it_value.tv_sec = 0; -+ cur_setting->it_value.tv_nsec = 0; -+ } - -- cur_setting->it_interval = -- ktime_to_timespec(timr->it.alarm.interval); -- cur_setting->it_value = -- ktime_to_timespec(timr->it.alarm.alarmtimer.node.expires); -- return; -+ cur_setting->it_interval = ktime_to_timespec(timr->it.alarm.interval); - } - - /** -diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c -index a53f1bbc546b..773aba836e81 100644 ---- a/kernel/trace/ring_buffer.c -+++ b/kernel/trace/ring_buffer.c -@@ -626,8 +626,22 @@ int ring_buffer_poll_wait(struct ring_buffer *buffer, int cpu, - work = &cpu_buffer->irq_work; - } - -- work->waiters_pending = true; - poll_wait(filp, &work->waiters, poll_table); -+ work->waiters_pending = true; -+ /* -+ * There's a tight race between setting the waiters_pending and -+ * checking if the ring buffer is empty. Once the waiters_pending bit -+ * is set, the next event will wake the task up, but we can get stuck -+ * if there's only a single event in. -+ * -+ * FIXME: Ideally, we need a memory barrier on the writer side as well, -+ * but adding a memory barrier to all events will cause too much of a -+ * performance hit in the fast path. We only need a memory barrier when -+ * the buffer goes from empty to having content. But as this race is -+ * extremely small, and it's not a problem if another event comes in, we -+ * will fix it later. -+ */ -+ smp_mb(); - - if ((cpu == RING_BUFFER_ALL_CPUS && !ring_buffer_empty(buffer)) || - (cpu != RING_BUFFER_ALL_CPUS && !ring_buffer_empty_cpu(buffer, cpu))) -diff --git a/mm/memblock.c b/mm/memblock.c -index 39a31e7f0045..0739dc1b4095 100644 ---- a/mm/memblock.c -+++ b/mm/memblock.c -@@ -183,8 +183,7 @@ phys_addr_t __init_memblock memblock_find_in_range_node(phys_addr_t size, - phys_addr_t align, phys_addr_t start, - phys_addr_t end, int nid) - { -- int ret; -- phys_addr_t kernel_end; -+ phys_addr_t kernel_end, ret; - - /* pump up @end */ - if (end == MEMBLOCK_ALLOC_ACCESSIBLE) -diff --git a/mm/memory.c b/mm/memory.c -index 2121d8b8db56..492e36f27f43 100644 ---- a/mm/memory.c -+++ b/mm/memory.c -@@ -1120,7 +1120,7 @@ again: - addr) != page->index) { - pte_t ptfile = pgoff_to_pte(page->index); - if (pte_soft_dirty(ptent)) -- pte_file_mksoft_dirty(ptfile); -+ ptfile = pte_file_mksoft_dirty(ptfile); - set_pte_at(mm, addr, pte, ptfile); - } - if (PageAnon(page)) -diff --git a/mm/percpu-vm.c b/mm/percpu-vm.c -index 3707c71ae4cd..51108165f829 100644 ---- a/mm/percpu-vm.c -+++ b/mm/percpu-vm.c -@@ -108,7 +108,7 @@ static int pcpu_alloc_pages(struct pcpu_chunk *chunk, - int page_start, int page_end) - { - const gfp_t gfp = GFP_KERNEL | __GFP_HIGHMEM | __GFP_COLD; -- unsigned int cpu; -+ unsigned int cpu, tcpu; - int i; - - for_each_possible_cpu(cpu) { -@@ -116,14 +116,23 @@ static int pcpu_alloc_pages(struct pcpu_chunk *chunk, - struct page **pagep = &pages[pcpu_page_idx(cpu, i)]; - - *pagep = alloc_pages_node(cpu_to_node(cpu), gfp, 0); -- if (!*pagep) { -- pcpu_free_pages(chunk, pages, populated, -- page_start, page_end); -- return -ENOMEM; -- } -+ if (!*pagep) -+ goto err; - } - } - return 0; -+ -+err: -+ while (--i >= page_start) -+ __free_page(pages[pcpu_page_idx(cpu, i)]); -+ -+ for_each_possible_cpu(tcpu) { -+ if (tcpu == cpu) -+ break; -+ for (i = page_start; i < page_end; i++) -+ __free_page(pages[pcpu_page_idx(tcpu, i)]); -+ } -+ return -ENOMEM; - } - - /** -@@ -263,6 +272,7 @@ err: - __pcpu_unmap_pages(pcpu_chunk_addr(chunk, tcpu, page_start), - page_end - page_start); - } -+ pcpu_post_unmap_tlb_flush(chunk, page_start, page_end); - return err; - } - -diff --git a/mm/percpu.c b/mm/percpu.c -index a2a54a85f691..8cd4308471c3 100644 ---- a/mm/percpu.c -+++ b/mm/percpu.c -@@ -1917,6 +1917,8 @@ void __init setup_per_cpu_areas(void) - - if (pcpu_setup_first_chunk(ai, fc) < 0) - panic("Failed to initialize percpu areas."); -+ -+ pcpu_free_alloc_info(ai); - } - - #endif /* CONFIG_SMP */ -diff --git a/mm/shmem.c b/mm/shmem.c -index ff85863587ee..f0d698ba7d0f 100644 ---- a/mm/shmem.c -+++ b/mm/shmem.c -@@ -2143,8 +2143,10 @@ static int shmem_rename(struct inode *old_dir, struct dentry *old_dentry, struct - - if (new_dentry->d_inode) { - (void) shmem_unlink(new_dir, new_dentry); -- if (they_are_dirs) -+ if (they_are_dirs) { -+ drop_nlink(new_dentry->d_inode); - drop_nlink(old_dir); -+ } - } else if (they_are_dirs) { - drop_nlink(old_dir); - inc_nlink(new_dir); -diff --git a/mm/slab.c b/mm/slab.c -index 6dd8d5f3a3ac..ea854eb2388c 100644 ---- a/mm/slab.c -+++ b/mm/slab.c -@@ -2189,7 +2189,8 @@ static int __init_refok setup_cpu_cache(struct kmem_cache *cachep, gfp_t gfp) - int - __kmem_cache_create (struct kmem_cache *cachep, unsigned long flags) - { -- size_t left_over, freelist_size, ralign; -+ size_t left_over, freelist_size; -+ size_t ralign = BYTES_PER_WORD; - gfp_t gfp; - int err; - size_t size = cachep->size; -@@ -2222,14 +2223,6 @@ __kmem_cache_create (struct kmem_cache *cachep, unsigned long flags) - size &= ~(BYTES_PER_WORD - 1); - } - -- /* -- * Redzoning and user store require word alignment or possibly larger. -- * Note this will be overridden by architecture or caller mandated -- * alignment if either is greater than BYTES_PER_WORD. -- */ -- if (flags & SLAB_STORE_USER) -- ralign = BYTES_PER_WORD; -- - if (flags & SLAB_RED_ZONE) { - ralign = REDZONE_ALIGN; - /* If redzoning, ensure that the second redzone is suitably -diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c -index e6a84cb1a5e4..189eef014c4f 100644 ---- a/net/mac80211/mlme.c -+++ b/net/mac80211/mlme.c -@@ -4240,8 +4240,7 @@ int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata, - rcu_read_unlock(); - - if (bss->wmm_used && bss->uapsd_supported && -- (sdata->local->hw.flags & IEEE80211_HW_SUPPORTS_UAPSD) && -- sdata->wmm_acm != 0xff) { -+ (sdata->local->hw.flags & IEEE80211_HW_SUPPORTS_UAPSD)) { - assoc_data->uapsd = true; - ifmgd->flags |= IEEE80211_STA_UAPSD_ENABLED; - } else { -diff --git a/net/netfilter/ipvs/ip_vs_conn.c b/net/netfilter/ipvs/ip_vs_conn.c -index a8eb0a89326a..610e19c0e13f 100644 ---- a/net/netfilter/ipvs/ip_vs_conn.c -+++ b/net/netfilter/ipvs/ip_vs_conn.c -@@ -797,7 +797,6 @@ static void ip_vs_conn_expire(unsigned long data) - ip_vs_control_del(cp); - - if (cp->flags & IP_VS_CONN_F_NFCT) { -- ip_vs_conn_drop_conntrack(cp); - /* Do not access conntracks during subsys cleanup - * because nf_conntrack_find_get can not be used after - * conntrack cleanup for the net. -diff --git a/net/netfilter/ipvs/ip_vs_core.c b/net/netfilter/ipvs/ip_vs_core.c -index 3d2d2c8108ca..27d3f40de3cd 100644 ---- a/net/netfilter/ipvs/ip_vs_core.c -+++ b/net/netfilter/ipvs/ip_vs_core.c -@@ -1906,7 +1906,7 @@ static struct nf_hook_ops ip_vs_ops[] __read_mostly = { - { - .hook = ip_vs_local_reply6, - .owner = THIS_MODULE, -- .pf = NFPROTO_IPV4, -+ .pf = NFPROTO_IPV6, - .hooknum = NF_INET_LOCAL_OUT, - .priority = NF_IP6_PRI_NAT_DST + 1, - }, -diff --git a/net/netfilter/ipvs/ip_vs_xmit.c b/net/netfilter/ipvs/ip_vs_xmit.c -index 7f0e1cf2d7e8..1692e7534759 100644 ---- a/net/netfilter/ipvs/ip_vs_xmit.c -+++ b/net/netfilter/ipvs/ip_vs_xmit.c -@@ -967,8 +967,8 @@ ip_vs_tunnel_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp, - iph->nexthdr = IPPROTO_IPV6; - iph->payload_len = old_iph->payload_len; - be16_add_cpu(&iph->payload_len, sizeof(*old_iph)); -- iph->priority = old_iph->priority; - memset(&iph->flow_lbl, 0, sizeof(iph->flow_lbl)); -+ ipv6_change_dsfield(iph, 0, ipv6_get_dsfield(old_iph)); - iph->daddr = cp->daddr.in6; - iph->saddr = saddr; - iph->hop_limit = old_iph->hop_limit; -diff --git a/net/netfilter/xt_cgroup.c b/net/netfilter/xt_cgroup.c -index 9a8e77e7f8d4..ef5c75a5b200 100644 ---- a/net/netfilter/xt_cgroup.c -+++ b/net/netfilter/xt_cgroup.c -@@ -31,7 +31,7 @@ static int cgroup_mt_check(const struct xt_mtchk_param *par) - if (info->invert & ~1) - return -EINVAL; - -- return info->id ? 0 : -EINVAL; -+ return 0; - } - - static bool -diff --git a/net/netfilter/xt_hashlimit.c b/net/netfilter/xt_hashlimit.c -index a3910fc2122b..47dc6836830a 100644 ---- a/net/netfilter/xt_hashlimit.c -+++ b/net/netfilter/xt_hashlimit.c -@@ -104,7 +104,7 @@ struct xt_hashlimit_htable { - spinlock_t lock; /* lock for list_head */ - u_int32_t rnd; /* random seed for hash */ - unsigned int count; /* number entries in table */ -- struct timer_list timer; /* timer for gc */ -+ struct delayed_work gc_work; - - /* seq_file stuff */ - struct proc_dir_entry *pde; -@@ -213,7 +213,7 @@ dsthash_free(struct xt_hashlimit_htable *ht, struct dsthash_ent *ent) - call_rcu_bh(&ent->rcu, dsthash_free_rcu); - ht->count--; - } --static void htable_gc(unsigned long htlong); -+static void htable_gc(struct work_struct *work); - - static int htable_create(struct net *net, struct xt_hashlimit_mtinfo1 *minfo, - u_int8_t family) -@@ -273,9 +273,9 @@ static int htable_create(struct net *net, struct xt_hashlimit_mtinfo1 *minfo, - } - hinfo->net = net; - -- setup_timer(&hinfo->timer, htable_gc, (unsigned long)hinfo); -- hinfo->timer.expires = jiffies + msecs_to_jiffies(hinfo->cfg.gc_interval); -- add_timer(&hinfo->timer); -+ INIT_DEFERRABLE_WORK(&hinfo->gc_work, htable_gc); -+ queue_delayed_work(system_power_efficient_wq, &hinfo->gc_work, -+ msecs_to_jiffies(hinfo->cfg.gc_interval)); - - hlist_add_head(&hinfo->node, &hashlimit_net->htables); - -@@ -300,29 +300,30 @@ static void htable_selective_cleanup(struct xt_hashlimit_htable *ht, - { - unsigned int i; - -- /* lock hash table and iterate over it */ -- spin_lock_bh(&ht->lock); - for (i = 0; i < ht->cfg.size; i++) { - struct dsthash_ent *dh; - struct hlist_node *n; -+ -+ spin_lock_bh(&ht->lock); - hlist_for_each_entry_safe(dh, n, &ht->hash[i], node) { - if ((*select)(ht, dh)) - dsthash_free(ht, dh); - } -+ spin_unlock_bh(&ht->lock); -+ cond_resched(); - } -- spin_unlock_bh(&ht->lock); - } - --/* hash table garbage collector, run by timer */ --static void htable_gc(unsigned long htlong) -+static void htable_gc(struct work_struct *work) - { -- struct xt_hashlimit_htable *ht = (struct xt_hashlimit_htable *)htlong; -+ struct xt_hashlimit_htable *ht; -+ -+ ht = container_of(work, struct xt_hashlimit_htable, gc_work.work); - - htable_selective_cleanup(ht, select_gc); - -- /* re-add the timer accordingly */ -- ht->timer.expires = jiffies + msecs_to_jiffies(ht->cfg.gc_interval); -- add_timer(&ht->timer); -+ queue_delayed_work(system_power_efficient_wq, -+ &ht->gc_work, msecs_to_jiffies(ht->cfg.gc_interval)); - } - - static void htable_remove_proc_entry(struct xt_hashlimit_htable *hinfo) -@@ -341,7 +342,7 @@ static void htable_remove_proc_entry(struct xt_hashlimit_htable *hinfo) - - static void htable_destroy(struct xt_hashlimit_htable *hinfo) - { -- del_timer_sync(&hinfo->timer); -+ cancel_delayed_work_sync(&hinfo->gc_work); - htable_remove_proc_entry(hinfo); - htable_selective_cleanup(hinfo, select_all); - kfree(hinfo->name); -diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c -index e6283464a8e6..df33156ecd2d 100644 ---- a/net/wireless/nl80211.c -+++ b/net/wireless/nl80211.c -@@ -6796,6 +6796,9 @@ void __cfg80211_send_event_skb(struct sk_buff *skb, gfp_t gfp) - struct nlattr *data = ((void **)skb->cb)[2]; - enum nl80211_multicast_groups mcgrp = NL80211_MCGRP_TESTMODE; - -+ /* clear CB data for netlink core to own from now on */ -+ memset(skb->cb, 0, sizeof(skb->cb)); -+ - nla_nest_end(skb, data); - genlmsg_end(skb, hdr); - -@@ -9075,6 +9078,9 @@ int cfg80211_vendor_cmd_reply(struct sk_buff *skb) - void *hdr = ((void **)skb->cb)[1]; - struct nlattr *data = ((void **)skb->cb)[2]; - -+ /* clear CB data for netlink core to own from now on */ -+ memset(skb->cb, 0, sizeof(skb->cb)); -+ - if (WARN_ON(!rdev->cur_cmd_info)) { - kfree_skb(skb); - return -EINVAL; -diff --git a/sound/core/info.c b/sound/core/info.c -index e79baa11b60e..08070e1eefeb 100644 ---- a/sound/core/info.c -+++ b/sound/core/info.c -@@ -679,7 +679,7 @@ int snd_info_card_free(struct snd_card *card) - * snd_info_get_line - read one line from the procfs buffer - * @buffer: the procfs buffer - * @line: the buffer to store -- * @len: the max. buffer size - 1 -+ * @len: the max. buffer size - * - * Reads one line from the buffer and stores the string. - * -@@ -699,7 +699,7 @@ int snd_info_get_line(struct snd_info_buffer *buffer, char *line, int len) - buffer->stop = 1; - if (c == '\n') - break; -- if (len) { -+ if (len > 1) { - len--; - *line++ = c; - } -diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c -index a2104671f51d..e1ef106c8a6f 100644 ---- a/sound/core/pcm_lib.c -+++ b/sound/core/pcm_lib.c -@@ -1783,14 +1783,16 @@ static int snd_pcm_lib_ioctl_fifo_size(struct snd_pcm_substream *substream, - { - struct snd_pcm_hw_params *params = arg; - snd_pcm_format_t format; -- int channels, width; -+ int channels; -+ ssize_t frame_size; - - params->fifo_size = substream->runtime->hw.fifo_size; - if (!(substream->runtime->hw.info & SNDRV_PCM_INFO_FIFO_IN_FRAMES)) { - format = params_format(params); - channels = params_channels(params); -- width = snd_pcm_format_physical_width(format); -- params->fifo_size /= width * channels; -+ frame_size = snd_pcm_format_size(format, channels); -+ if (frame_size > 0) -+ params->fifo_size /= (unsigned)frame_size; - } - return 0; - } -diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c -index bcf91bea3317..ffc19464b978 100644 ---- a/sound/pci/hda/patch_conexant.c -+++ b/sound/pci/hda/patch_conexant.c -@@ -3237,6 +3237,7 @@ enum { - CXT_FIXUP_HEADPHONE_MIC_PIN, - CXT_FIXUP_HEADPHONE_MIC, - CXT_FIXUP_GPIO1, -+ CXT_FIXUP_ASPIRE_DMIC, - CXT_FIXUP_THINKPAD_ACPI, - }; - -@@ -3397,6 +3398,12 @@ static const struct hda_fixup cxt_fixups[] = { - { } - }, - }, -+ [CXT_FIXUP_ASPIRE_DMIC] = { -+ .type = HDA_FIXUP_FUNC, -+ .v.func = cxt_fixup_stereo_dmic, -+ .chained = true, -+ .chain_id = CXT_FIXUP_GPIO1, -+ }, - [CXT_FIXUP_THINKPAD_ACPI] = { - .type = HDA_FIXUP_FUNC, - .v.func = hda_fixup_thinkpad_acpi, -@@ -3410,7 +3417,7 @@ static const struct snd_pci_quirk cxt5051_fixups[] = { - - static const struct snd_pci_quirk cxt5066_fixups[] = { - SND_PCI_QUIRK(0x1025, 0x0543, "Acer Aspire One 522", CXT_FIXUP_STEREO_DMIC), -- SND_PCI_QUIRK(0x1025, 0x054c, "Acer Aspire 3830TG", CXT_FIXUP_GPIO1), -+ SND_PCI_QUIRK(0x1025, 0x054c, "Acer Aspire 3830TG", CXT_FIXUP_ASPIRE_DMIC), - SND_PCI_QUIRK(0x1043, 0x138d, "Asus", CXT_FIXUP_HEADPHONE_MIC_PIN), - SND_PCI_QUIRK(0x17aa, 0x20f2, "Lenovo T400", CXT_PINCFG_LENOVO_TP410), - SND_PCI_QUIRK(0x17aa, 0x215e, "Lenovo T410", CXT_PINCFG_LENOVO_TP410), -diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c -index b35dbe25a6e3..5d0058bd6259 100644 ---- a/sound/pci/hda/patch_realtek.c -+++ b/sound/pci/hda/patch_realtek.c -@@ -327,6 +327,7 @@ static void alc_auto_init_amp(struct hda_codec *codec, int type) - case 0x10ec0885: - case 0x10ec0887: - /*case 0x10ec0889:*/ /* this causes an SPDIF problem */ -+ case 0x10ec0900: - alc889_coef_init(codec); - break; - case 0x10ec0888: -@@ -2330,6 +2331,7 @@ static int patch_alc882(struct hda_codec *codec) - switch (codec->vendor_id) { - case 0x10ec0882: - case 0x10ec0885: -+ case 0x10ec0900: - break; - default: - /* ALC883 and variants */ -diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c -index 978df990f27c..15270a2e71cc 100644 ---- a/sound/pci/hda/patch_sigmatel.c -+++ b/sound/pci/hda/patch_sigmatel.c -@@ -559,8 +559,8 @@ static void stac_init_power_map(struct hda_codec *codec) - if (snd_hda_jack_tbl_get(codec, nid)) - continue; - if (def_conf == AC_JACK_PORT_COMPLEX && -- !(spec->vref_mute_led_nid == nid || -- is_jack_detectable(codec, nid))) { -+ spec->vref_mute_led_nid != nid && -+ is_jack_detectable(codec, nid)) { - snd_hda_jack_detect_enable_callback(codec, nid, - STAC_PWR_EVENT, - jack_update_power); -@@ -4212,11 +4212,18 @@ static int stac_parse_auto_config(struct hda_codec *codec) - return err; - } - -- stac_init_power_map(codec); -- - return 0; - } - -+static int stac_build_controls(struct hda_codec *codec) -+{ -+ int err = snd_hda_gen_build_controls(codec); -+ -+ if (err < 0) -+ return err; -+ stac_init_power_map(codec); -+ return 0; -+} - - static int stac_init(struct hda_codec *codec) - { -@@ -4328,7 +4335,7 @@ static int stac_suspend(struct hda_codec *codec) - #endif /* CONFIG_PM */ - - static const struct hda_codec_ops stac_patch_ops = { -- .build_controls = snd_hda_gen_build_controls, -+ .build_controls = stac_build_controls, - .build_pcms = snd_hda_gen_build_pcms, - .init = stac_init, - .free = stac_free, -diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c -index 670afa29e30d..7350ebbae642 100644 ---- a/sound/soc/davinci/davinci-mcasp.c -+++ b/sound/soc/davinci/davinci-mcasp.c -@@ -418,8 +418,17 @@ static int davinci_config_channel_size(struct davinci_mcasp *mcasp, - { - u32 fmt; - u32 tx_rotate = (word_length / 4) & 0x7; -- u32 rx_rotate = (32 - word_length) / 4; - u32 mask = (1ULL << word_length) - 1; -+ /* -+ * For captured data we should not rotate, inversion and masking is -+ * enoguh to get the data to the right position: -+ * Format data from bus after reverse (XRBUF) -+ * S16_LE: |LSB|MSB|xxx|xxx| |xxx|xxx|MSB|LSB| -+ * S24_3LE: |LSB|DAT|MSB|xxx| |xxx|MSB|DAT|LSB| -+ * S24_LE: |LSB|DAT|MSB|xxx| |xxx|MSB|DAT|LSB| -+ * S32_LE: |LSB|DAT|DAT|MSB| |MSB|DAT|DAT|LSB| -+ */ -+ u32 rx_rotate = 0; - - /* - * if s BCLK-to-LRCLK ratio has been configured via the set_clkdiv() diff --git a/projects/imx6/patches/linux/linux-000-patch-3.14.20-21.patch b/projects/imx6/patches/linux/linux-000-patch-3.14.20-21.patch deleted file mode 100644 index a8ab18d36d1..00000000000 --- a/projects/imx6/patches/linux/linux-000-patch-3.14.20-21.patch +++ /dev/null @@ -1,2520 +0,0 @@ -diff --git a/Makefile b/Makefile -index beb7e6f0803b..41e6e19fe2e9 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,6 +1,6 @@ - VERSION = 3 - PATCHLEVEL = 14 --SUBLEVEL = 20 -+SUBLEVEL = 21 - EXTRAVERSION = - NAME = Remembering Coco - -diff --git a/arch/unicore32/include/asm/mmu_context.h b/arch/unicore32/include/asm/mmu_context.h -index fb5e4c658f7a..ef470a7a3d0f 100644 ---- a/arch/unicore32/include/asm/mmu_context.h -+++ b/arch/unicore32/include/asm/mmu_context.h -@@ -14,6 +14,8 @@ - - #include <linux/compiler.h> - #include <linux/sched.h> -+#include <linux/mm.h> -+#include <linux/vmacache.h> - #include <linux/io.h> - - #include <asm/cacheflush.h> -@@ -73,7 +75,7 @@ do { \ - else \ - mm->mmap = NULL; \ - rb_erase(&high_vma->vm_rb, &mm->mm_rb); \ -- mm->mmap_cache = NULL; \ -+ vmacache_invalidate(mm); \ - mm->map_count--; \ - remove_vma(high_vma); \ - } \ -diff --git a/drivers/block/drbd/drbd_nl.c b/drivers/block/drbd/drbd_nl.c -index c706d50a8b06..8c16c2f97026 100644 ---- a/drivers/block/drbd/drbd_nl.c -+++ b/drivers/block/drbd/drbd_nl.c -@@ -525,6 +525,12 @@ void conn_try_outdate_peer_async(struct drbd_tconn *tconn) - struct task_struct *opa; - - kref_get(&tconn->kref); -+ /* We may just have force_sig()'ed this thread -+ * to get it out of some blocking network function. -+ * Clear signals; otherwise kthread_run(), which internally uses -+ * wait_on_completion_killable(), will mistake our pending signal -+ * for a new fatal signal and fail. */ -+ flush_signals(current); - opa = kthread_run(_try_outdate_peer_async, tconn, "drbd_async_h"); - if (IS_ERR(opa)) { - conn_err(tconn, "out of mem, failed to invoke fence-peer helper\n"); -diff --git a/drivers/cpufreq/integrator-cpufreq.c b/drivers/cpufreq/integrator-cpufreq.c -index 0e27844e8c2d..8089dd2cd9d8 100644 ---- a/drivers/cpufreq/integrator-cpufreq.c -+++ b/drivers/cpufreq/integrator-cpufreq.c -@@ -213,9 +213,9 @@ static int __init integrator_cpufreq_probe(struct platform_device *pdev) - return cpufreq_register_driver(&integrator_driver); - } - --static void __exit integrator_cpufreq_remove(struct platform_device *pdev) -+static int __exit integrator_cpufreq_remove(struct platform_device *pdev) - { -- cpufreq_unregister_driver(&integrator_driver); -+ return cpufreq_unregister_driver(&integrator_driver); - } - - static const struct of_device_id integrator_cpufreq_match[] = { -diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c -index d278be110805..1855cdca39cd 100644 ---- a/drivers/gpu/drm/i915/i915_gem_gtt.c -+++ b/drivers/gpu/drm/i915/i915_gem_gtt.c -@@ -827,6 +827,16 @@ void i915_check_and_clear_faults(struct drm_device *dev) - POSTING_READ(RING_FAULT_REG(&dev_priv->ring[RCS])); - } - -+static void i915_ggtt_flush(struct drm_i915_private *dev_priv) -+{ -+ if (INTEL_INFO(dev_priv->dev)->gen < 6) { -+ intel_gtt_chipset_flush(); -+ } else { -+ I915_WRITE(GFX_FLSH_CNTL_GEN6, GFX_FLSH_CNTL_EN); -+ POSTING_READ(GFX_FLSH_CNTL_GEN6); -+ } -+} -+ - void i915_gem_suspend_gtt_mappings(struct drm_device *dev) - { - struct drm_i915_private *dev_priv = dev->dev_private; -@@ -843,6 +853,8 @@ void i915_gem_suspend_gtt_mappings(struct drm_device *dev) - dev_priv->gtt.base.start / PAGE_SIZE, - dev_priv->gtt.base.total / PAGE_SIZE, - true); -+ -+ i915_ggtt_flush(dev_priv); - } - - void i915_gem_restore_gtt_mappings(struct drm_device *dev) -@@ -863,7 +875,7 @@ void i915_gem_restore_gtt_mappings(struct drm_device *dev) - i915_gem_gtt_bind_object(obj, obj->cache_level); - } - -- i915_gem_chipset_flush(dev); -+ i915_ggtt_flush(dev_priv); - } - - int i915_gem_gtt_prepare_object(struct drm_i915_gem_object *obj) -diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c -index 18cda77b4f79..4913c0690872 100644 ---- a/drivers/md/raid5.c -+++ b/drivers/md/raid5.c -@@ -64,6 +64,10 @@ - #define cpu_to_group(cpu) cpu_to_node(cpu) - #define ANY_GROUP NUMA_NO_NODE - -+static bool devices_handle_discard_safely = false; -+module_param(devices_handle_discard_safely, bool, 0644); -+MODULE_PARM_DESC(devices_handle_discard_safely, -+ "Set to Y if all devices in each array reliably return zeroes on reads from discarded regions"); - static struct workqueue_struct *raid5_wq; - /* - * Stripe cache -@@ -6117,7 +6121,7 @@ static int run(struct mddev *mddev) - mddev->queue->limits.discard_granularity = stripe; - /* - * unaligned part of discard request will be ignored, so can't -- * guarantee discard_zerors_data -+ * guarantee discard_zeroes_data - */ - mddev->queue->limits.discard_zeroes_data = 0; - -@@ -6142,6 +6146,18 @@ static int run(struct mddev *mddev) - !bdev_get_queue(rdev->bdev)-> - limits.discard_zeroes_data) - discard_supported = false; -+ /* Unfortunately, discard_zeroes_data is not currently -+ * a guarantee - just a hint. So we only allow DISCARD -+ * if the sysadmin has confirmed that only safe devices -+ * are in use by setting a module parameter. -+ */ -+ if (!devices_handle_discard_safely) { -+ if (discard_supported) { -+ pr_info("md/raid456: discard support disabled due to uncertainty.\n"); -+ pr_info("Set raid456.devices_handle_discard_safely=Y to override.\n"); -+ } -+ discard_supported = false; -+ } - } - - if (discard_supported && -diff --git a/drivers/media/v4l2-core/videobuf2-core.c b/drivers/media/v4l2-core/videobuf2-core.c -index a127925c9d61..06faea4d60ee 100644 ---- a/drivers/media/v4l2-core/videobuf2-core.c -+++ b/drivers/media/v4l2-core/videobuf2-core.c -@@ -745,6 +745,7 @@ static int __reqbufs(struct vb2_queue *q, struct v4l2_requestbuffers *req) - * to the userspace. - */ - req->count = allocated_buffers; -+ q->waiting_for_buffers = !V4L2_TYPE_IS_OUTPUT(q->type); - - return 0; - } -@@ -793,6 +794,7 @@ static int __create_bufs(struct vb2_queue *q, struct v4l2_create_buffers *create - memset(q->plane_sizes, 0, sizeof(q->plane_sizes)); - memset(q->alloc_ctx, 0, sizeof(q->alloc_ctx)); - q->memory = create->memory; -+ q->waiting_for_buffers = !V4L2_TYPE_IS_OUTPUT(q->type); - } - - num_buffers = min(create->count, VIDEO_MAX_FRAME - q->num_buffers); -@@ -1447,6 +1449,7 @@ static int vb2_internal_qbuf(struct vb2_queue *q, struct v4l2_buffer *b) - * dequeued in dqbuf. - */ - list_add_tail(&vb->queued_entry, &q->queued_list); -+ q->waiting_for_buffers = false; - vb->state = VB2_BUF_STATE_QUEUED; - - /* -@@ -1841,6 +1844,7 @@ static int vb2_internal_streamoff(struct vb2_queue *q, enum v4l2_buf_type type) - * and videobuf, effectively returning control over them to userspace. - */ - __vb2_queue_cancel(q); -+ q->waiting_for_buffers = !V4L2_TYPE_IS_OUTPUT(q->type); - - dprintk(3, "Streamoff successful\n"); - return 0; -@@ -2150,9 +2154,16 @@ unsigned int vb2_poll(struct vb2_queue *q, struct file *file, poll_table *wait) - } - - /* -- * There is nothing to wait for if no buffers have already been queued. -+ * There is nothing to wait for if the queue isn't streaming. - */ -- if (list_empty(&q->queued_list)) -+ if (!vb2_is_streaming(q)) -+ return res | POLLERR; -+ /* -+ * For compatibility with vb1: if QBUF hasn't been called yet, then -+ * return POLLERR as well. This only affects capture queues, output -+ * queues will always initialize waiting_for_buffers to false. -+ */ -+ if (q->waiting_for_buffers) - return res | POLLERR; - - if (list_empty(&q->done_list)) -diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h -index f15d4353f30f..5d12d69e2045 100644 ---- a/fs/cifs/cifsglob.h -+++ b/fs/cifs/cifsglob.h -@@ -399,6 +399,8 @@ struct smb_version_operations { - const struct cifs_fid *, u32 *); - int (*set_acl)(struct cifs_ntsd *, __u32, struct inode *, const char *, - int); -+ /* check if we need to issue closedir */ -+ bool (*dir_needs_close)(struct cifsFileInfo *); - }; - - struct smb_version_values { -diff --git a/fs/cifs/file.c b/fs/cifs/file.c -index 8175b18df819..d375322b6cec 100644 ---- a/fs/cifs/file.c -+++ b/fs/cifs/file.c -@@ -762,7 +762,7 @@ int cifs_closedir(struct inode *inode, struct file *file) - - cifs_dbg(FYI, "Freeing private data in close dir\n"); - spin_lock(&cifs_file_list_lock); -- if (!cfile->srch_inf.endOfSearch && !cfile->invalidHandle) { -+ if (server->ops->dir_needs_close(cfile)) { - cfile->invalidHandle = true; - spin_unlock(&cifs_file_list_lock); - if (server->ops->close_dir) -diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c -index 2bbf11b09214..b334a89d6a66 100644 ---- a/fs/cifs/readdir.c -+++ b/fs/cifs/readdir.c -@@ -593,7 +593,7 @@ find_cifs_entry(const unsigned int xid, struct cifs_tcon *tcon, loff_t pos, - /* close and restart search */ - cifs_dbg(FYI, "search backing up - close and restart search\n"); - spin_lock(&cifs_file_list_lock); -- if (!cfile->srch_inf.endOfSearch && !cfile->invalidHandle) { -+ if (server->ops->dir_needs_close(cfile)) { - cfile->invalidHandle = true; - spin_unlock(&cifs_file_list_lock); - if (server->ops->close_dir) -diff --git a/fs/cifs/smb1ops.c b/fs/cifs/smb1ops.c -index d1fdfa848703..e9ad8d37bb00 100644 ---- a/fs/cifs/smb1ops.c -+++ b/fs/cifs/smb1ops.c -@@ -586,7 +586,7 @@ cifs_query_path_info(const unsigned int xid, struct cifs_tcon *tcon, - tmprc = CIFS_open(xid, &oparms, &oplock, NULL); - if (tmprc == -EOPNOTSUPP) - *symlink = true; -- else -+ else if (tmprc == 0) - CIFSSMBClose(xid, tcon, fid.netfid); - } - -@@ -1009,6 +1009,12 @@ cifs_is_read_op(__u32 oplock) - return oplock == OPLOCK_READ; - } - -+static bool -+cifs_dir_needs_close(struct cifsFileInfo *cfile) -+{ -+ return !cfile->srch_inf.endOfSearch && !cfile->invalidHandle; -+} -+ - struct smb_version_operations smb1_operations = { - .send_cancel = send_nt_cancel, - .compare_fids = cifs_compare_fids, -@@ -1078,6 +1084,7 @@ struct smb_version_operations smb1_operations = { - .query_mf_symlink = cifs_query_mf_symlink, - .create_mf_symlink = cifs_create_mf_symlink, - .is_read_op = cifs_is_read_op, -+ .dir_needs_close = cifs_dir_needs_close, - #ifdef CONFIG_CIFS_XATTR - .query_all_EAs = CIFSSMBQAllEAs, - .set_EA = CIFSSMBSetEA, -diff --git a/fs/cifs/smb2maperror.c b/fs/cifs/smb2maperror.c -index e31a9dfdcd39..a491814cb2c0 100644 ---- a/fs/cifs/smb2maperror.c -+++ b/fs/cifs/smb2maperror.c -@@ -214,7 +214,7 @@ static const struct status_to_posix_error smb2_error_map_table[] = { - {STATUS_BREAKPOINT, -EIO, "STATUS_BREAKPOINT"}, - {STATUS_SINGLE_STEP, -EIO, "STATUS_SINGLE_STEP"}, - {STATUS_BUFFER_OVERFLOW, -EIO, "STATUS_BUFFER_OVERFLOW"}, -- {STATUS_NO_MORE_FILES, -EIO, "STATUS_NO_MORE_FILES"}, -+ {STATUS_NO_MORE_FILES, -ENODATA, "STATUS_NO_MORE_FILES"}, - {STATUS_WAKE_SYSTEM_DEBUGGER, -EIO, "STATUS_WAKE_SYSTEM_DEBUGGER"}, - {STATUS_HANDLES_CLOSED, -EIO, "STATUS_HANDLES_CLOSED"}, - {STATUS_NO_INHERITANCE, -EIO, "STATUS_NO_INHERITANCE"}, -@@ -256,6 +256,8 @@ static const struct status_to_posix_error smb2_error_map_table[] = { - {STATUS_DLL_MIGHT_BE_INCOMPATIBLE, -EIO, - "STATUS_DLL_MIGHT_BE_INCOMPATIBLE"}, - {STATUS_STOPPED_ON_SYMLINK, -EOPNOTSUPP, "STATUS_STOPPED_ON_SYMLINK"}, -+ {STATUS_IO_REPARSE_TAG_NOT_HANDLED, -EOPNOTSUPP, -+ "STATUS_REPARSE_NOT_HANDLED"}, - {STATUS_DEVICE_REQUIRES_CLEANING, -EIO, - "STATUS_DEVICE_REQUIRES_CLEANING"}, - {STATUS_DEVICE_DOOR_OPEN, -EIO, "STATUS_DEVICE_DOOR_OPEN"}, -diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c -index f8977b2d9187..34a17d425be6 100644 ---- a/fs/cifs/smb2ops.c -+++ b/fs/cifs/smb2ops.c -@@ -1102,6 +1102,12 @@ smb3_parse_lease_buf(void *buf, unsigned int *epoch) - return le32_to_cpu(lc->lcontext.LeaseState); - } - -+static bool -+smb2_dir_needs_close(struct cifsFileInfo *cfile) -+{ -+ return !cfile->invalidHandle; -+} -+ - struct smb_version_operations smb20_operations = { - .compare_fids = smb2_compare_fids, - .setup_request = smb2_setup_request, -@@ -1175,6 +1181,7 @@ struct smb_version_operations smb20_operations = { - .create_lease_buf = smb2_create_lease_buf, - .parse_lease_buf = smb2_parse_lease_buf, - .clone_range = smb2_clone_range, -+ .dir_needs_close = smb2_dir_needs_close, - }; - - struct smb_version_operations smb21_operations = { -@@ -1250,6 +1257,7 @@ struct smb_version_operations smb21_operations = { - .create_lease_buf = smb2_create_lease_buf, - .parse_lease_buf = smb2_parse_lease_buf, - .clone_range = smb2_clone_range, -+ .dir_needs_close = smb2_dir_needs_close, - }; - - struct smb_version_operations smb30_operations = { -@@ -1328,6 +1336,7 @@ struct smb_version_operations smb30_operations = { - .parse_lease_buf = smb3_parse_lease_buf, - .clone_range = smb2_clone_range, - .validate_negotiate = smb3_validate_negotiate, -+ .dir_needs_close = smb2_dir_needs_close, - }; - - struct smb_version_values smb20_values = { -diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c -index 9aab8fe0e508..348792911e1f 100644 ---- a/fs/cifs/smb2pdu.c -+++ b/fs/cifs/smb2pdu.c -@@ -2136,6 +2136,10 @@ SMB2_query_directory(const unsigned int xid, struct cifs_tcon *tcon, - rsp = (struct smb2_query_directory_rsp *)iov[0].iov_base; - - if (rc) { -+ if (rc == -ENODATA && rsp->hdr.Status == STATUS_NO_MORE_FILES) { -+ srch_inf->endOfSearch = true; -+ rc = 0; -+ } - cifs_stats_fail_inc(tcon, SMB2_QUERY_DIRECTORY_HE); - goto qdir_exit; - } -@@ -2173,11 +2177,6 @@ SMB2_query_directory(const unsigned int xid, struct cifs_tcon *tcon, - else - cifs_dbg(VFS, "illegal search buffer type\n"); - -- if (rsp->hdr.Status == STATUS_NO_MORE_FILES) -- srch_inf->endOfSearch = 1; -- else -- srch_inf->endOfSearch = 0; -- - return rc; - - qdir_exit: -diff --git a/fs/exec.c b/fs/exec.c -index 31e46b1b358b..ea4449d0536a 100644 ---- a/fs/exec.c -+++ b/fs/exec.c -@@ -26,6 +26,7 @@ - #include <linux/file.h> - #include <linux/fdtable.h> - #include <linux/mm.h> -+#include <linux/vmacache.h> - #include <linux/stat.h> - #include <linux/fcntl.h> - #include <linux/swap.h> -@@ -820,7 +821,7 @@ EXPORT_SYMBOL(read_code); - static int exec_mmap(struct mm_struct *mm) - { - struct task_struct *tsk; -- struct mm_struct * old_mm, *active_mm; -+ struct mm_struct *old_mm, *active_mm; - - /* Notify parent that we're no longer interested in the old VM */ - tsk = current; -@@ -846,6 +847,8 @@ static int exec_mmap(struct mm_struct *mm) - tsk->mm = mm; - tsk->active_mm = mm; - activate_mm(active_mm, mm); -+ tsk->mm->vmacache_seqnum = 0; -+ vmacache_flush(tsk); - task_unlock(tsk); - if (old_mm) { - up_read(&old_mm->mmap_sem); -diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c -index d19b30ababf1..a4a8ed56e438 100644 ---- a/fs/hugetlbfs/inode.c -+++ b/fs/hugetlbfs/inode.c -@@ -1017,6 +1017,11 @@ static int __init init_hugetlbfs_fs(void) - int error; - int i; - -+ if (!hugepages_supported()) { -+ pr_info("hugetlbfs: disabling because there are no supported hugepage sizes\n"); -+ return -ENOTSUPP; -+ } -+ - error = bdi_init(&hugetlbfs_backing_dev_info); - if (error) - return error; -diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c -index 8f788193e3d4..c4b2646b6d7c 100644 ---- a/fs/proc/task_mmu.c -+++ b/fs/proc/task_mmu.c -@@ -1,4 +1,5 @@ - #include <linux/mm.h> -+#include <linux/vmacache.h> - #include <linux/hugetlb.h> - #include <linux/huge_mm.h> - #include <linux/mount.h> -@@ -152,7 +153,7 @@ static void *m_start(struct seq_file *m, loff_t *pos) - - /* - * We remember last_addr rather than next_addr to hit with -- * mmap_cache most of the time. We have zero last_addr at -+ * vmacache most of the time. We have zero last_addr at - * the beginning and also after lseek. We will have -1 last_addr - * after the end of the vmas. - */ -diff --git a/fs/udf/inode.c b/fs/udf/inode.c -index 982ce05c87ed..287cd5f23421 100644 ---- a/fs/udf/inode.c -+++ b/fs/udf/inode.c -@@ -1271,13 +1271,22 @@ update_time: - return 0; - } - -+/* -+ * Maximum length of linked list formed by ICB hierarchy. The chosen number is -+ * arbitrary - just that we hopefully don't limit any real use of rewritten -+ * inode on write-once media but avoid looping for too long on corrupted media. -+ */ -+#define UDF_MAX_ICB_NESTING 1024 -+ - static void __udf_read_inode(struct inode *inode) - { - struct buffer_head *bh = NULL; - struct fileEntry *fe; - uint16_t ident; - struct udf_inode_info *iinfo = UDF_I(inode); -+ unsigned int indirections = 0; - -+reread: - /* - * Set defaults, but the inode is still incomplete! - * Note: get_new_inode() sets the following on a new inode: -@@ -1314,28 +1323,26 @@ static void __udf_read_inode(struct inode *inode) - ibh = udf_read_ptagged(inode->i_sb, &iinfo->i_location, 1, - &ident); - if (ident == TAG_IDENT_IE && ibh) { -- struct buffer_head *nbh = NULL; - struct kernel_lb_addr loc; - struct indirectEntry *ie; - - ie = (struct indirectEntry *)ibh->b_data; - loc = lelb_to_cpu(ie->indirectICB.extLocation); - -- if (ie->indirectICB.extLength && -- (nbh = udf_read_ptagged(inode->i_sb, &loc, 0, -- &ident))) { -- if (ident == TAG_IDENT_FE || -- ident == TAG_IDENT_EFE) { -- memcpy(&iinfo->i_location, -- &loc, -- sizeof(struct kernel_lb_addr)); -- brelse(bh); -- brelse(ibh); -- brelse(nbh); -- __udf_read_inode(inode); -+ if (ie->indirectICB.extLength) { -+ brelse(bh); -+ brelse(ibh); -+ memcpy(&iinfo->i_location, &loc, -+ sizeof(struct kernel_lb_addr)); -+ if (++indirections > UDF_MAX_ICB_NESTING) { -+ udf_err(inode->i_sb, -+ "too many ICBs in ICB hierarchy" -+ " (max %d supported)\n", -+ UDF_MAX_ICB_NESTING); -+ make_bad_inode(inode); - return; - } -- brelse(nbh); -+ goto reread; - } - } - brelse(ibh); -diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h -index 3fe661fe96d1..b19d3dc2e651 100644 ---- a/include/linux/cpuset.h -+++ b/include/linux/cpuset.h -@@ -87,25 +87,26 @@ extern void rebuild_sched_domains(void); - extern void cpuset_print_task_mems_allowed(struct task_struct *p); - - /* -- * get_mems_allowed is required when making decisions involving mems_allowed -- * such as during page allocation. mems_allowed can be updated in parallel -- * and depending on the new value an operation can fail potentially causing -- * process failure. A retry loop with get_mems_allowed and put_mems_allowed -- * prevents these artificial failures. -+ * read_mems_allowed_begin is required when making decisions involving -+ * mems_allowed such as during page allocation. mems_allowed can be updated in -+ * parallel and depending on the new value an operation can fail potentially -+ * causing process failure. A retry loop with read_mems_allowed_begin and -+ * read_mems_allowed_retry prevents these artificial failures. - */ --static inline unsigned int get_mems_allowed(void) -+static inline unsigned int read_mems_allowed_begin(void) - { - return read_seqcount_begin(&current->mems_allowed_seq); - } - - /* -- * If this returns false, the operation that took place after get_mems_allowed -- * may have failed. It is up to the caller to retry the operation if -+ * If this returns true, the operation that took place after -+ * read_mems_allowed_begin may have failed artificially due to a concurrent -+ * update of mems_allowed. It is up to the caller to retry the operation if - * appropriate. - */ --static inline bool put_mems_allowed(unsigned int seq) -+static inline bool read_mems_allowed_retry(unsigned int seq) - { -- return !read_seqcount_retry(&current->mems_allowed_seq, seq); -+ return read_seqcount_retry(&current->mems_allowed_seq, seq); - } - - static inline void set_mems_allowed(nodemask_t nodemask) -@@ -225,14 +226,14 @@ static inline void set_mems_allowed(nodemask_t nodemask) - { - } - --static inline unsigned int get_mems_allowed(void) -+static inline unsigned int read_mems_allowed_begin(void) - { - return 0; - } - --static inline bool put_mems_allowed(unsigned int seq) -+static inline bool read_mems_allowed_retry(unsigned int seq) - { -- return true; -+ return false; - } - - #endif /* !CONFIG_CPUSETS */ -diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h -index bd1e9bcec547..42b05c4c53e5 100644 ---- a/include/linux/hugetlb.h -+++ b/include/linux/hugetlb.h -@@ -400,6 +400,16 @@ static inline spinlock_t *huge_pte_lockptr(struct hstate *h, - return &mm->page_table_lock; - } - -+static inline bool hugepages_supported(void) -+{ -+ /* -+ * Some platform decide whether they support huge pages at boot -+ * time. On these, such as powerpc, HPAGE_SHIFT is set to 0 when -+ * there is no such support -+ */ -+ return HPAGE_SHIFT != 0; -+} -+ - #else /* CONFIG_HUGETLB_PAGE */ - struct hstate {}; - #define alloc_huge_page_node(h, nid) NULL -diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h -index 1f44466c1e9d..c367cbdf73ab 100644 ---- a/include/linux/jiffies.h -+++ b/include/linux/jiffies.h -@@ -258,23 +258,11 @@ extern unsigned long preset_lpj; - #define SEC_JIFFIE_SC (32 - SHIFT_HZ) - #endif - #define NSEC_JIFFIE_SC (SEC_JIFFIE_SC + 29) --#define USEC_JIFFIE_SC (SEC_JIFFIE_SC + 19) - #define SEC_CONVERSION ((unsigned long)((((u64)NSEC_PER_SEC << SEC_JIFFIE_SC) +\ - TICK_NSEC -1) / (u64)TICK_NSEC)) - - #define NSEC_CONVERSION ((unsigned long)((((u64)1 << NSEC_JIFFIE_SC) +\ - TICK_NSEC -1) / (u64)TICK_NSEC)) --#define USEC_CONVERSION \ -- ((unsigned long)((((u64)NSEC_PER_USEC << USEC_JIFFIE_SC) +\ -- TICK_NSEC -1) / (u64)TICK_NSEC)) --/* -- * USEC_ROUND is used in the timeval to jiffie conversion. See there -- * for more details. It is the scaled resolution rounding value. Note -- * that it is a 64-bit value. Since, when it is applied, we are already -- * in jiffies (albit scaled), it is nothing but the bits we will shift -- * off. -- */ --#define USEC_ROUND (u64)(((u64)1 << USEC_JIFFIE_SC) - 1) - /* - * The maximum jiffie value is (MAX_INT >> 1). Here we translate that - * into seconds. The 64-bit case will overflow if we are not careful, -diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h -index 290901a8c1de..2b58d192ea24 100644 ---- a/include/linux/mm_types.h -+++ b/include/linux/mm_types.h -@@ -342,9 +342,9 @@ struct mm_rss_stat { - - struct kioctx_table; - struct mm_struct { -- struct vm_area_struct * mmap; /* list of VMAs */ -+ struct vm_area_struct *mmap; /* list of VMAs */ - struct rb_root mm_rb; -- struct vm_area_struct * mmap_cache; /* last find_vma result */ -+ u32 vmacache_seqnum; /* per-thread vmacache */ - #ifdef CONFIG_MMU - unsigned long (*get_unmapped_area) (struct file *filp, - unsigned long addr, unsigned long len, -diff --git a/include/linux/plist.h b/include/linux/plist.h -index aa0fb390bd29..8b6c970cff6c 100644 ---- a/include/linux/plist.h -+++ b/include/linux/plist.h -@@ -98,6 +98,13 @@ struct plist_node { - } - - /** -+ * PLIST_HEAD - declare and init plist_head -+ * @head: name for struct plist_head variable -+ */ -+#define PLIST_HEAD(head) \ -+ struct plist_head head = PLIST_HEAD_INIT(head) -+ -+/** - * PLIST_NODE_INIT - static struct plist_node initializer - * @node: struct plist_node variable name - * @__prio: initial node priority -@@ -134,6 +141,8 @@ static inline void plist_node_init(struct plist_node *node, int prio) - extern void plist_add(struct plist_node *node, struct plist_head *head); - extern void plist_del(struct plist_node *node, struct plist_head *head); - -+extern void plist_requeue(struct plist_node *node, struct plist_head *head); -+ - /** - * plist_for_each - iterate over the plist - * @pos: the type * to use as a loop counter -@@ -143,6 +152,16 @@ extern void plist_del(struct plist_node *node, struct plist_head *head); - list_for_each_entry(pos, &(head)->node_list, node_list) - - /** -+ * plist_for_each_continue - continue iteration over the plist -+ * @pos: the type * to use as a loop cursor -+ * @head: the head for your list -+ * -+ * Continue to iterate over plist, continuing after the current position. -+ */ -+#define plist_for_each_continue(pos, head) \ -+ list_for_each_entry_continue(pos, &(head)->node_list, node_list) -+ -+/** - * plist_for_each_safe - iterate safely over a plist of given type - * @pos: the type * to use as a loop counter - * @n: another type * to use as temporary storage -@@ -163,6 +182,18 @@ extern void plist_del(struct plist_node *node, struct plist_head *head); - list_for_each_entry(pos, &(head)->node_list, mem.node_list) - - /** -+ * plist_for_each_entry_continue - continue iteration over list of given type -+ * @pos: the type * to use as a loop cursor -+ * @head: the head for your list -+ * @m: the name of the list_struct within the struct -+ * -+ * Continue to iterate over list of given type, continuing after -+ * the current position. -+ */ -+#define plist_for_each_entry_continue(pos, head, m) \ -+ list_for_each_entry_continue(pos, &(head)->node_list, m.node_list) -+ -+/** - * plist_for_each_entry_safe - iterate safely over list of given type - * @pos: the type * to use as a loop counter - * @n: another type * to use as temporary storage -@@ -229,6 +260,20 @@ static inline int plist_node_empty(const struct plist_node *node) - #endif - - /** -+ * plist_next - get the next entry in list -+ * @pos: the type * to cursor -+ */ -+#define plist_next(pos) \ -+ list_next_entry(pos, node_list) -+ -+/** -+ * plist_prev - get the prev entry in list -+ * @pos: the type * to cursor -+ */ -+#define plist_prev(pos) \ -+ list_prev_entry(pos, node_list) -+ -+/** - * plist_first - return the first node (and thus, highest priority) - * @head: the &struct plist_head pointer - * -diff --git a/include/linux/sched.h b/include/linux/sched.h -index ccd0c6f24f2c..d7ca410ace93 100644 ---- a/include/linux/sched.h -+++ b/include/linux/sched.h -@@ -59,6 +59,10 @@ struct sched_param { - - #define SCHED_ATTR_SIZE_VER0 48 /* sizeof first published struct */ - -+#define VMACACHE_BITS 2 -+#define VMACACHE_SIZE (1U << VMACACHE_BITS) -+#define VMACACHE_MASK (VMACACHE_SIZE - 1) -+ - /* - * Extended scheduling parameters data structure. - * -@@ -1228,6 +1232,9 @@ struct task_struct { - #ifdef CONFIG_COMPAT_BRK - unsigned brk_randomized:1; - #endif -+ /* per-thread vma caching */ -+ u32 vmacache_seqnum; -+ struct vm_area_struct *vmacache[VMACACHE_SIZE]; - #if defined(SPLIT_RSS_COUNTING) - struct task_rss_stat rss_stat; - #endif -diff --git a/include/linux/swap.h b/include/linux/swap.h -index 46ba0c6c219f..789324976801 100644 ---- a/include/linux/swap.h -+++ b/include/linux/swap.h -@@ -214,8 +214,9 @@ struct percpu_cluster { - struct swap_info_struct { - unsigned long flags; /* SWP_USED etc: see above */ - signed short prio; /* swap priority of this type */ -+ struct plist_node list; /* entry in swap_active_head */ -+ struct plist_node avail_list; /* entry in swap_avail_head */ - signed char type; /* strange name for an index */ -- signed char next; /* next type on the swap list */ - unsigned int max; /* extent of the swap_map */ - unsigned char *swap_map; /* vmalloc'ed array of usage counts */ - struct swap_cluster_info *cluster_info; /* cluster info. Only for SSD */ -@@ -255,11 +256,6 @@ struct swap_info_struct { - struct swap_cluster_info discard_cluster_tail; /* list tail of discard clusters */ - }; - --struct swap_list_t { -- int head; /* head of priority-ordered swapfile list */ -- int next; /* swapfile to be used next */ --}; -- - /* linux/mm/page_alloc.c */ - extern unsigned long totalram_pages; - extern unsigned long totalreserve_pages; -diff --git a/include/linux/swapfile.h b/include/linux/swapfile.h -index e282624e8c10..388293a91e8c 100644 ---- a/include/linux/swapfile.h -+++ b/include/linux/swapfile.h -@@ -6,7 +6,7 @@ - * want to expose them to the dozens of source files that include swap.h - */ - extern spinlock_t swap_lock; --extern struct swap_list_t swap_list; -+extern struct plist_head swap_active_head; - extern struct swap_info_struct *swap_info[]; - extern int try_to_unuse(unsigned int, bool, unsigned long); - -diff --git a/include/linux/vmacache.h b/include/linux/vmacache.h -new file mode 100644 -index 000000000000..c3fa0fd43949 ---- /dev/null -+++ b/include/linux/vmacache.h -@@ -0,0 +1,38 @@ -+#ifndef __LINUX_VMACACHE_H -+#define __LINUX_VMACACHE_H -+ -+#include <linux/sched.h> -+#include <linux/mm.h> -+ -+/* -+ * Hash based on the page number. Provides a good hit rate for -+ * workloads with good locality and those with random accesses as well. -+ */ -+#define VMACACHE_HASH(addr) ((addr >> PAGE_SHIFT) & VMACACHE_MASK) -+ -+static inline void vmacache_flush(struct task_struct *tsk) -+{ -+ memset(tsk->vmacache, 0, sizeof(tsk->vmacache)); -+} -+ -+extern void vmacache_flush_all(struct mm_struct *mm); -+extern void vmacache_update(unsigned long addr, struct vm_area_struct *newvma); -+extern struct vm_area_struct *vmacache_find(struct mm_struct *mm, -+ unsigned long addr); -+ -+#ifndef CONFIG_MMU -+extern struct vm_area_struct *vmacache_find_exact(struct mm_struct *mm, -+ unsigned long start, -+ unsigned long end); -+#endif -+ -+static inline void vmacache_invalidate(struct mm_struct *mm) -+{ -+ mm->vmacache_seqnum++; -+ -+ /* deal with overflows */ -+ if (unlikely(mm->vmacache_seqnum == 0)) -+ vmacache_flush_all(mm); -+} -+ -+#endif /* __LINUX_VMACACHE_H */ -diff --git a/include/media/videobuf2-core.h b/include/media/videobuf2-core.h -index bef53ce555d2..b10682cb138c 100644 ---- a/include/media/videobuf2-core.h -+++ b/include/media/videobuf2-core.h -@@ -329,6 +329,9 @@ struct v4l2_fh; - * @retry_start_streaming: start_streaming() was called, but there were not enough - * buffers queued. If set, then retry calling start_streaming when - * queuing a new buffer. -+ * @waiting_for_buffers: used in poll() to check if vb2 is still waiting for -+ * buffers. Only set for capture queues if qbuf has not yet been -+ * called since poll() needs to return POLLERR in that situation. - * @fileio: file io emulator internal data, used only if emulator is active - */ - struct vb2_queue { -@@ -362,6 +365,7 @@ struct vb2_queue { - - unsigned int streaming:1; - unsigned int retry_start_streaming:1; -+ unsigned int waiting_for_buffers:1; - - struct vb2_fileio_data *fileio; - }; -diff --git a/init/Kconfig b/init/Kconfig -index 93c5ef0c5210..8b9521a2d2c1 100644 ---- a/init/Kconfig -+++ b/init/Kconfig -@@ -1389,6 +1389,7 @@ config FUTEX - - config HAVE_FUTEX_CMPXCHG - bool -+ depends on FUTEX - help - Architectures should select this if futex_atomic_cmpxchg_inatomic() - is implemented and always working. This removes a couple of runtime -diff --git a/kernel/cpuset.c b/kernel/cpuset.c -index 6b27e5c0cd86..15b3ea693225 100644 ---- a/kernel/cpuset.c -+++ b/kernel/cpuset.c -@@ -1022,7 +1022,7 @@ static void cpuset_change_task_nodemask(struct task_struct *tsk, - task_lock(tsk); - /* - * Determine if a loop is necessary if another thread is doing -- * get_mems_allowed(). If at least one node remains unchanged and -+ * read_mems_allowed_begin(). If at least one node remains unchanged and - * tsk does not have a mempolicy, then an empty nodemask will not be - * possible when mems_allowed is larger than a word. - */ -diff --git a/kernel/debug/debug_core.c b/kernel/debug/debug_core.c -index 334b3980ffc1..8865caec45fb 100644 ---- a/kernel/debug/debug_core.c -+++ b/kernel/debug/debug_core.c -@@ -49,6 +49,7 @@ - #include <linux/pid.h> - #include <linux/smp.h> - #include <linux/mm.h> -+#include <linux/vmacache.h> - #include <linux/rcupdate.h> - - #include <asm/cacheflush.h> -@@ -224,10 +225,17 @@ static void kgdb_flush_swbreak_addr(unsigned long addr) - if (!CACHE_FLUSH_IS_SAFE) - return; - -- if (current->mm && current->mm->mmap_cache) { -- flush_cache_range(current->mm->mmap_cache, -- addr, addr + BREAK_INSTR_SIZE); -+ if (current->mm) { -+ int i; -+ -+ for (i = 0; i < VMACACHE_SIZE; i++) { -+ if (!current->vmacache[i]) -+ continue; -+ flush_cache_range(current->vmacache[i], -+ addr, addr + BREAK_INSTR_SIZE); -+ } - } -+ - /* Force flush instruction cache if it was outside the mm */ - flush_icache_range(addr, addr + BREAK_INSTR_SIZE); - } -diff --git a/kernel/events/core.c b/kernel/events/core.c -index 3a140ca37777..4ced342f1ba9 100644 ---- a/kernel/events/core.c -+++ b/kernel/events/core.c -@@ -7836,8 +7836,10 @@ int perf_event_init_task(struct task_struct *child) - - for_each_task_context_nr(ctxn) { - ret = perf_event_init_context(child, ctxn); -- if (ret) -+ if (ret) { -+ perf_event_free_task(child); - return ret; -+ } - } - - return 0; -diff --git a/kernel/fork.c b/kernel/fork.c -index c44bff8097f5..e2c685396295 100644 ---- a/kernel/fork.c -+++ b/kernel/fork.c -@@ -28,6 +28,8 @@ - #include <linux/mman.h> - #include <linux/mmu_notifier.h> - #include <linux/fs.h> -+#include <linux/mm.h> -+#include <linux/vmacache.h> - #include <linux/nsproxy.h> - #include <linux/capability.h> - #include <linux/cpu.h> -@@ -363,7 +365,7 @@ static int dup_mmap(struct mm_struct *mm, struct mm_struct *oldmm) - - mm->locked_vm = 0; - mm->mmap = NULL; -- mm->mmap_cache = NULL; -+ mm->vmacache_seqnum = 0; - mm->map_count = 0; - cpumask_clear(mm_cpumask(mm)); - mm->mm_rb = RB_ROOT; -@@ -876,6 +878,9 @@ static int copy_mm(unsigned long clone_flags, struct task_struct *tsk) - if (!oldmm) - return 0; - -+ /* initialize the new vmacache entries */ -+ vmacache_flush(tsk); -+ - if (clone_flags & CLONE_VM) { - atomic_inc(&oldmm->mm_users); - mm = oldmm; -@@ -1323,7 +1328,7 @@ static struct task_struct *copy_process(unsigned long clone_flags, - goto bad_fork_cleanup_policy; - retval = audit_alloc(p); - if (retval) -- goto bad_fork_cleanup_policy; -+ goto bad_fork_cleanup_perf; - /* copy all the process information */ - retval = copy_semundo(clone_flags, p); - if (retval) -@@ -1522,8 +1527,9 @@ bad_fork_cleanup_semundo: - exit_sem(p); - bad_fork_cleanup_audit: - audit_free(p); --bad_fork_cleanup_policy: -+bad_fork_cleanup_perf: - perf_event_free_task(p); -+bad_fork_cleanup_policy: - #ifdef CONFIG_NUMA - mpol_put(p->mempolicy); - bad_fork_cleanup_cgroup: -diff --git a/kernel/time.c b/kernel/time.c -index 7c7964c33ae7..3c49ab45f822 100644 ---- a/kernel/time.c -+++ b/kernel/time.c -@@ -496,17 +496,20 @@ EXPORT_SYMBOL(usecs_to_jiffies); - * that a remainder subtract here would not do the right thing as the - * resolution values don't fall on second boundries. I.e. the line: - * nsec -= nsec % TICK_NSEC; is NOT a correct resolution rounding. -+ * Note that due to the small error in the multiplier here, this -+ * rounding is incorrect for sufficiently large values of tv_nsec, but -+ * well formed timespecs should have tv_nsec < NSEC_PER_SEC, so we're -+ * OK. - * - * Rather, we just shift the bits off the right. - * - * The >> (NSEC_JIFFIE_SC - SEC_JIFFIE_SC) converts the scaled nsec - * value to a scaled second value. - */ --unsigned long --timespec_to_jiffies(const struct timespec *value) -+static unsigned long -+__timespec_to_jiffies(unsigned long sec, long nsec) - { -- unsigned long sec = value->tv_sec; -- long nsec = value->tv_nsec + TICK_NSEC - 1; -+ nsec = nsec + TICK_NSEC - 1; - - if (sec >= MAX_SEC_IN_JIFFIES){ - sec = MAX_SEC_IN_JIFFIES; -@@ -517,6 +520,13 @@ timespec_to_jiffies(const struct timespec *value) - (NSEC_JIFFIE_SC - SEC_JIFFIE_SC))) >> SEC_JIFFIE_SC; - - } -+ -+unsigned long -+timespec_to_jiffies(const struct timespec *value) -+{ -+ return __timespec_to_jiffies(value->tv_sec, value->tv_nsec); -+} -+ - EXPORT_SYMBOL(timespec_to_jiffies); - - void -@@ -533,31 +543,27 @@ jiffies_to_timespec(const unsigned long jiffies, struct timespec *value) - } - EXPORT_SYMBOL(jiffies_to_timespec); - --/* Same for "timeval" -+/* -+ * We could use a similar algorithm to timespec_to_jiffies (with a -+ * different multiplier for usec instead of nsec). But this has a -+ * problem with rounding: we can't exactly add TICK_NSEC - 1 to the -+ * usec value, since it's not necessarily integral. - * -- * Well, almost. The problem here is that the real system resolution is -- * in nanoseconds and the value being converted is in micro seconds. -- * Also for some machines (those that use HZ = 1024, in-particular), -- * there is a LARGE error in the tick size in microseconds. -- -- * The solution we use is to do the rounding AFTER we convert the -- * microsecond part. Thus the USEC_ROUND, the bits to be shifted off. -- * Instruction wise, this should cost only an additional add with carry -- * instruction above the way it was done above. -+ * We could instead round in the intermediate scaled representation -+ * (i.e. in units of 1/2^(large scale) jiffies) but that's also -+ * perilous: the scaling introduces a small positive error, which -+ * combined with a division-rounding-upward (i.e. adding 2^(scale) - 1 -+ * units to the intermediate before shifting) leads to accidental -+ * overflow and overestimates. -+ * -+ * At the cost of one additional multiplication by a constant, just -+ * use the timespec implementation. - */ - unsigned long - timeval_to_jiffies(const struct timeval *value) - { -- unsigned long sec = value->tv_sec; -- long usec = value->tv_usec; -- -- if (sec >= MAX_SEC_IN_JIFFIES){ -- sec = MAX_SEC_IN_JIFFIES; -- usec = 0; -- } -- return (((u64)sec * SEC_CONVERSION) + -- (((u64)usec * USEC_CONVERSION + USEC_ROUND) >> -- (USEC_JIFFIE_SC - SEC_JIFFIE_SC))) >> SEC_JIFFIE_SC; -+ return __timespec_to_jiffies(value->tv_sec, -+ value->tv_usec * NSEC_PER_USEC); - } - EXPORT_SYMBOL(timeval_to_jiffies); - -diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c -index 773aba836e81..774a0807fe81 100644 ---- a/kernel/trace/ring_buffer.c -+++ b/kernel/trace/ring_buffer.c -@@ -3372,7 +3372,7 @@ static void rb_iter_reset(struct ring_buffer_iter *iter) - iter->head = cpu_buffer->reader_page->read; - - iter->cache_reader_page = iter->head_page; -- iter->cache_read = iter->head; -+ iter->cache_read = cpu_buffer->read; - - if (iter->head) - iter->read_stamp = cpu_buffer->read_stamp; -diff --git a/lib/plist.c b/lib/plist.c -index 1ebc95f7a46f..0f2084d30798 100644 ---- a/lib/plist.c -+++ b/lib/plist.c -@@ -134,6 +134,46 @@ void plist_del(struct plist_node *node, struct plist_head *head) - plist_check_head(head); - } - -+/** -+ * plist_requeue - Requeue @node at end of same-prio entries. -+ * -+ * This is essentially an optimized plist_del() followed by -+ * plist_add(). It moves an entry already in the plist to -+ * after any other same-priority entries. -+ * -+ * @node: &struct plist_node pointer - entry to be moved -+ * @head: &struct plist_head pointer - list head -+ */ -+void plist_requeue(struct plist_node *node, struct plist_head *head) -+{ -+ struct plist_node *iter; -+ struct list_head *node_next = &head->node_list; -+ -+ plist_check_head(head); -+ BUG_ON(plist_head_empty(head)); -+ BUG_ON(plist_node_empty(node)); -+ -+ if (node == plist_last(head)) -+ return; -+ -+ iter = plist_next(node); -+ -+ if (node->prio != iter->prio) -+ return; -+ -+ plist_del(node, head); -+ -+ plist_for_each_continue(iter, head) { -+ if (node->prio != iter->prio) { -+ node_next = &iter->node_list; -+ break; -+ } -+ } -+ list_add_tail(&node->node_list, node_next); -+ -+ plist_check_head(head); -+} -+ - #ifdef CONFIG_DEBUG_PI_LIST - #include <linux/sched.h> - #include <linux/module.h> -@@ -170,6 +210,14 @@ static void __init plist_test_check(int nr_expect) - BUG_ON(prio_pos->prio_list.next != &first->prio_list); - } - -+static void __init plist_test_requeue(struct plist_node *node) -+{ -+ plist_requeue(node, &test_head); -+ -+ if (node != plist_last(&test_head)) -+ BUG_ON(node->prio == plist_next(node)->prio); -+} -+ - static int __init plist_test(void) - { - int nr_expect = 0, i, loop; -@@ -193,6 +241,10 @@ static int __init plist_test(void) - nr_expect--; - } - plist_test_check(nr_expect); -+ if (!plist_node_empty(test_node + i)) { -+ plist_test_requeue(test_node + i); -+ plist_test_check(nr_expect); -+ } - } - - for (i = 0; i < ARRAY_SIZE(test_node); i++) { -diff --git a/mm/Makefile b/mm/Makefile -index 310c90a09264..c561f1f6bca0 100644 ---- a/mm/Makefile -+++ b/mm/Makefile -@@ -16,7 +16,7 @@ obj-y := filemap.o mempool.o oom_kill.o fadvise.o \ - readahead.o swap.o truncate.o vmscan.o shmem.o \ - util.o mmzone.o vmstat.o backing-dev.o \ - mm_init.o mmu_context.o percpu.o slab_common.o \ -- compaction.o balloon_compaction.o \ -+ compaction.o balloon_compaction.o vmacache.o \ - interval_tree.o list_lru.o $(mmu-y) - - obj-y += init-mm.o -diff --git a/mm/compaction.c b/mm/compaction.c -index 5f702ef0a65f..5e38e5706f62 100644 ---- a/mm/compaction.c -+++ b/mm/compaction.c -@@ -217,21 +217,12 @@ static inline bool compact_trylock_irqsave(spinlock_t *lock, - /* Returns true if the page is within a block suitable for migration to */ - static bool suitable_migration_target(struct page *page) - { -- int migratetype = get_pageblock_migratetype(page); -- -- /* Don't interfere with memory hot-remove or the min_free_kbytes blocks */ -- if (migratetype == MIGRATE_RESERVE) -- return false; -- -- if (is_migrate_isolate(migratetype)) -- return false; -- -- /* If the page is a large free page, then allow migration */ -+ /* If the page is a large free page, then disallow migration */ - if (PageBuddy(page) && page_order(page) >= pageblock_order) -- return true; -+ return false; - - /* If the block is MIGRATE_MOVABLE or MIGRATE_CMA, allow migration */ -- if (migrate_async_suitable(migratetype)) -+ if (migrate_async_suitable(get_pageblock_migratetype(page))) - return true; - - /* Otherwise skip the block */ -@@ -253,6 +244,7 @@ static unsigned long isolate_freepages_block(struct compact_control *cc, - struct page *cursor, *valid_page = NULL; - unsigned long flags; - bool locked = false; -+ bool checked_pageblock = false; - - cursor = pfn_to_page(blockpfn); - -@@ -284,8 +276,16 @@ static unsigned long isolate_freepages_block(struct compact_control *cc, - break; - - /* Recheck this is a suitable migration target under lock */ -- if (!strict && !suitable_migration_target(page)) -- break; -+ if (!strict && !checked_pageblock) { -+ /* -+ * We need to check suitability of pageblock only once -+ * and this isolate_freepages_block() is called with -+ * pageblock range, so just check once is sufficient. -+ */ -+ checked_pageblock = true; -+ if (!suitable_migration_target(page)) -+ break; -+ } - - /* Recheck this is a buddy page under lock */ - if (!PageBuddy(page)) -@@ -460,12 +460,13 @@ isolate_migratepages_range(struct zone *zone, struct compact_control *cc, - unsigned long last_pageblock_nr = 0, pageblock_nr; - unsigned long nr_scanned = 0, nr_isolated = 0; - struct list_head *migratelist = &cc->migratepages; -- isolate_mode_t mode = 0; - struct lruvec *lruvec; - unsigned long flags; - bool locked = false; - struct page *page = NULL, *valid_page = NULL; - bool skipped_async_unsuitable = false; -+ const isolate_mode_t mode = (!cc->sync ? ISOLATE_ASYNC_MIGRATE : 0) | -+ (unevictable ? ISOLATE_UNEVICTABLE : 0); - - /* - * Ensure that there are not too many pages isolated from the LRU -@@ -487,7 +488,7 @@ isolate_migratepages_range(struct zone *zone, struct compact_control *cc, - cond_resched(); - for (; low_pfn < end_pfn; low_pfn++) { - /* give a chance to irqs before checking need_resched() */ -- if (locked && !((low_pfn+1) % SWAP_CLUSTER_MAX)) { -+ if (locked && !(low_pfn % SWAP_CLUSTER_MAX)) { - if (should_release_lock(&zone->lru_lock)) { - spin_unlock_irqrestore(&zone->lru_lock, flags); - locked = false; -@@ -526,8 +527,25 @@ isolate_migratepages_range(struct zone *zone, struct compact_control *cc, - - /* If isolation recently failed, do not retry */ - pageblock_nr = low_pfn >> pageblock_order; -- if (!isolation_suitable(cc, page)) -- goto next_pageblock; -+ if (last_pageblock_nr != pageblock_nr) { -+ int mt; -+ -+ last_pageblock_nr = pageblock_nr; -+ if (!isolation_suitable(cc, page)) -+ goto next_pageblock; -+ -+ /* -+ * For async migration, also only scan in MOVABLE -+ * blocks. Async migration is optimistic to see if -+ * the minimum amount of work satisfies the allocation -+ */ -+ mt = get_pageblock_migratetype(page); -+ if (!cc->sync && !migrate_async_suitable(mt)) { -+ cc->finished_update_migrate = true; -+ skipped_async_unsuitable = true; -+ goto next_pageblock; -+ } -+ } - - /* - * Skip if free. page_order cannot be used without zone->lock -@@ -537,18 +555,6 @@ isolate_migratepages_range(struct zone *zone, struct compact_control *cc, - continue; - - /* -- * For async migration, also only scan in MOVABLE blocks. Async -- * migration is optimistic to see if the minimum amount of work -- * satisfies the allocation -- */ -- if (!cc->sync && last_pageblock_nr != pageblock_nr && -- !migrate_async_suitable(get_pageblock_migratetype(page))) { -- cc->finished_update_migrate = true; -- skipped_async_unsuitable = true; -- goto next_pageblock; -- } -- -- /* - * Check may be lockless but that's ok as we recheck later. - * It's possible to migrate LRU pages and balloon pages - * Skip any other type of page -@@ -557,11 +563,7 @@ isolate_migratepages_range(struct zone *zone, struct compact_control *cc, - if (unlikely(balloon_page_movable(page))) { - if (locked && balloon_page_isolate(page)) { - /* Successfully isolated */ -- cc->finished_update_migrate = true; -- list_add(&page->lru, migratelist); -- cc->nr_migratepages++; -- nr_isolated++; -- goto check_compact_cluster; -+ goto isolate_success; - } - } - continue; -@@ -584,6 +586,15 @@ isolate_migratepages_range(struct zone *zone, struct compact_control *cc, - continue; - } - -+ /* -+ * Migration will fail if an anonymous page is pinned in memory, -+ * so avoid taking lru_lock and isolating it unnecessarily in an -+ * admittedly racy check. -+ */ -+ if (!page_mapping(page) && -+ page_count(page) > page_mapcount(page)) -+ continue; -+ - /* Check if it is ok to still hold the lock */ - locked = compact_checklock_irqsave(&zone->lru_lock, &flags, - locked, cc); -@@ -598,12 +609,6 @@ isolate_migratepages_range(struct zone *zone, struct compact_control *cc, - continue; - } - -- if (!cc->sync) -- mode |= ISOLATE_ASYNC_MIGRATE; -- -- if (unevictable) -- mode |= ISOLATE_UNEVICTABLE; -- - lruvec = mem_cgroup_page_lruvec(page, zone); - - /* Try isolate the page */ -@@ -613,13 +618,14 @@ isolate_migratepages_range(struct zone *zone, struct compact_control *cc, - VM_BUG_ON_PAGE(PageTransCompound(page), page); - - /* Successfully isolated */ -- cc->finished_update_migrate = true; - del_page_from_lru_list(page, lruvec, page_lru(page)); -+ -+isolate_success: -+ cc->finished_update_migrate = true; - list_add(&page->lru, migratelist); - cc->nr_migratepages++; - nr_isolated++; - --check_compact_cluster: - /* Avoid isolating too much */ - if (cc->nr_migratepages == COMPACT_CLUSTER_MAX) { - ++low_pfn; -@@ -630,7 +636,6 @@ check_compact_cluster: - - next_pageblock: - low_pfn = ALIGN(low_pfn + 1, pageblock_nr_pages) - 1; -- last_pageblock_nr = pageblock_nr; - } - - acct_isolated(zone, locked, cc); -@@ -1188,6 +1193,7 @@ static void compact_node(int nid) - struct compact_control cc = { - .order = -1, - .sync = true, -+ .ignore_skip_hint = true, - }; - - __compact_pgdat(NODE_DATA(nid), &cc); -diff --git a/mm/filemap.c b/mm/filemap.c -index 7a13f6ac5421..c2cc7c95eff1 100644 ---- a/mm/filemap.c -+++ b/mm/filemap.c -@@ -192,9 +192,11 @@ static int filemap_check_errors(struct address_space *mapping) - { - int ret = 0; - /* Check for outstanding write errors */ -- if (test_and_clear_bit(AS_ENOSPC, &mapping->flags)) -+ if (test_bit(AS_ENOSPC, &mapping->flags) && -+ test_and_clear_bit(AS_ENOSPC, &mapping->flags)) - ret = -ENOSPC; -- if (test_and_clear_bit(AS_EIO, &mapping->flags)) -+ if (test_bit(AS_EIO, &mapping->flags) && -+ test_and_clear_bit(AS_EIO, &mapping->flags)) - ret = -EIO; - return ret; - } -@@ -520,10 +522,10 @@ struct page *__page_cache_alloc(gfp_t gfp) - if (cpuset_do_page_mem_spread()) { - unsigned int cpuset_mems_cookie; - do { -- cpuset_mems_cookie = get_mems_allowed(); -+ cpuset_mems_cookie = read_mems_allowed_begin(); - n = cpuset_mem_spread_node(); - page = alloc_pages_exact_node(n, gfp, 0); -- } while (!put_mems_allowed(cpuset_mems_cookie) && !page); -+ } while (!page && read_mems_allowed_retry(cpuset_mems_cookie)); - - return page; - } -diff --git a/mm/frontswap.c b/mm/frontswap.c -index 1b24bdcb3197..c30eec536f03 100644 ---- a/mm/frontswap.c -+++ b/mm/frontswap.c -@@ -327,15 +327,12 @@ EXPORT_SYMBOL(__frontswap_invalidate_area); - - static unsigned long __frontswap_curr_pages(void) - { -- int type; - unsigned long totalpages = 0; - struct swap_info_struct *si = NULL; - - assert_spin_locked(&swap_lock); -- for (type = swap_list.head; type >= 0; type = si->next) { -- si = swap_info[type]; -+ plist_for_each_entry(si, &swap_active_head, list) - totalpages += atomic_read(&si->frontswap_pages); -- } - return totalpages; - } - -@@ -347,11 +344,9 @@ static int __frontswap_unuse_pages(unsigned long total, unsigned long *unused, - int si_frontswap_pages; - unsigned long total_pages_to_unuse = total; - unsigned long pages = 0, pages_to_unuse = 0; -- int type; - - assert_spin_locked(&swap_lock); -- for (type = swap_list.head; type >= 0; type = si->next) { -- si = swap_info[type]; -+ plist_for_each_entry(si, &swap_active_head, list) { - si_frontswap_pages = atomic_read(&si->frontswap_pages); - if (total_pages_to_unuse < si_frontswap_pages) { - pages = pages_to_unuse = total_pages_to_unuse; -@@ -366,7 +361,7 @@ static int __frontswap_unuse_pages(unsigned long total, unsigned long *unused, - } - vm_unacct_memory(pages); - *unused = pages_to_unuse; -- *swapid = type; -+ *swapid = si->type; - ret = 0; - break; - } -@@ -413,7 +408,7 @@ void frontswap_shrink(unsigned long target_pages) - /* - * we don't want to hold swap_lock while doing a very - * lengthy try_to_unuse, but swap_list may change -- * so restart scan from swap_list.head each time -+ * so restart scan from swap_active_head each time - */ - spin_lock(&swap_lock); - ret = __frontswap_shrink(target_pages, &pages_to_unuse, &type); -diff --git a/mm/huge_memory.c b/mm/huge_memory.c -index 1c42d0c36d0b..718bfa16a36f 100644 ---- a/mm/huge_memory.c -+++ b/mm/huge_memory.c -@@ -1819,21 +1819,24 @@ static int __split_huge_page_map(struct page *page, - if (pmd) { - pgtable = pgtable_trans_huge_withdraw(mm, pmd); - pmd_populate(mm, &_pmd, pgtable); -+ if (pmd_write(*pmd)) -+ BUG_ON(page_mapcount(page) != 1); - - haddr = address; - for (i = 0; i < HPAGE_PMD_NR; i++, haddr += PAGE_SIZE) { - pte_t *pte, entry; - BUG_ON(PageCompound(page+i)); -+ /* -+ * Note that pmd_numa is not transferred deliberately -+ * to avoid any possibility that pte_numa leaks to -+ * a PROT_NONE VMA by accident. -+ */ - entry = mk_pte(page + i, vma->vm_page_prot); - entry = maybe_mkwrite(pte_mkdirty(entry), vma); - if (!pmd_write(*pmd)) - entry = pte_wrprotect(entry); -- else -- BUG_ON(page_mapcount(page) != 1); - if (!pmd_young(*pmd)) - entry = pte_mkold(entry); -- if (pmd_numa(*pmd)) -- entry = pte_mknuma(entry); - pte = pte_offset_map(&_pmd, haddr); - BUG_ON(!pte_none(*pte)); - set_pte_at(mm, haddr, pte, entry); -diff --git a/mm/hugetlb.c b/mm/hugetlb.c -index 923f38e62bcf..67d0c175efcf 100644 ---- a/mm/hugetlb.c -+++ b/mm/hugetlb.c -@@ -540,7 +540,7 @@ static struct page *dequeue_huge_page_vma(struct hstate *h, - goto err; - - retry_cpuset: -- cpuset_mems_cookie = get_mems_allowed(); -+ cpuset_mems_cookie = read_mems_allowed_begin(); - zonelist = huge_zonelist(vma, address, - htlb_alloc_mask(h), &mpol, &nodemask); - -@@ -562,7 +562,7 @@ retry_cpuset: - } - - mpol_cond_put(mpol); -- if (unlikely(!put_mems_allowed(cpuset_mems_cookie) && !page)) -+ if (unlikely(!page && read_mems_allowed_retry(cpuset_mems_cookie))) - goto retry_cpuset; - return page; - -@@ -2071,6 +2071,9 @@ static int hugetlb_sysctl_handler_common(bool obey_mempolicy, - unsigned long tmp; - int ret; - -+ if (!hugepages_supported()) -+ return -ENOTSUPP; -+ - tmp = h->max_huge_pages; - - if (write && h->order >= MAX_ORDER) -@@ -2124,6 +2127,9 @@ int hugetlb_overcommit_handler(struct ctl_table *table, int write, - unsigned long tmp; - int ret; - -+ if (!hugepages_supported()) -+ return -ENOTSUPP; -+ - tmp = h->nr_overcommit_huge_pages; - - if (write && h->order >= MAX_ORDER) -@@ -2149,6 +2155,8 @@ out: - void hugetlb_report_meminfo(struct seq_file *m) - { - struct hstate *h = &default_hstate; -+ if (!hugepages_supported()) -+ return; - seq_printf(m, - "HugePages_Total: %5lu\n" - "HugePages_Free: %5lu\n" -@@ -2165,6 +2173,8 @@ void hugetlb_report_meminfo(struct seq_file *m) - int hugetlb_report_node_meminfo(int nid, char *buf) - { - struct hstate *h = &default_hstate; -+ if (!hugepages_supported()) -+ return 0; - return sprintf(buf, - "Node %d HugePages_Total: %5u\n" - "Node %d HugePages_Free: %5u\n" -@@ -2179,6 +2189,9 @@ void hugetlb_show_meminfo(void) - struct hstate *h; - int nid; - -+ if (!hugepages_supported()) -+ return; -+ - for_each_node_state(nid, N_MEMORY) - for_each_hstate(h) - pr_info("Node %d hugepages_total=%u hugepages_free=%u hugepages_surp=%u hugepages_size=%lukB\n", -diff --git a/mm/mempolicy.c b/mm/mempolicy.c -index 15a8ea031526..796c7e6cf93b 100644 ---- a/mm/mempolicy.c -+++ b/mm/mempolicy.c -@@ -1897,7 +1897,7 @@ int node_random(const nodemask_t *maskp) - * If the effective policy is 'BIND, returns a pointer to the mempolicy's - * @nodemask for filtering the zonelist. - * -- * Must be protected by get_mems_allowed() -+ * Must be protected by read_mems_allowed_begin() - */ - struct zonelist *huge_zonelist(struct vm_area_struct *vma, unsigned long addr, - gfp_t gfp_flags, struct mempolicy **mpol, -@@ -2061,7 +2061,7 @@ alloc_pages_vma(gfp_t gfp, int order, struct vm_area_struct *vma, - - retry_cpuset: - pol = get_vma_policy(current, vma, addr); -- cpuset_mems_cookie = get_mems_allowed(); -+ cpuset_mems_cookie = read_mems_allowed_begin(); - - if (unlikely(pol->mode == MPOL_INTERLEAVE)) { - unsigned nid; -@@ -2069,7 +2069,7 @@ retry_cpuset: - nid = interleave_nid(pol, vma, addr, PAGE_SHIFT + order); - mpol_cond_put(pol); - page = alloc_page_interleave(gfp, order, nid); -- if (unlikely(!put_mems_allowed(cpuset_mems_cookie) && !page)) -+ if (unlikely(!page && read_mems_allowed_retry(cpuset_mems_cookie))) - goto retry_cpuset; - - return page; -@@ -2079,7 +2079,7 @@ retry_cpuset: - policy_nodemask(gfp, pol)); - if (unlikely(mpol_needs_cond_ref(pol))) - __mpol_put(pol); -- if (unlikely(!put_mems_allowed(cpuset_mems_cookie) && !page)) -+ if (unlikely(!page && read_mems_allowed_retry(cpuset_mems_cookie))) - goto retry_cpuset; - return page; - } -@@ -2113,7 +2113,7 @@ struct page *alloc_pages_current(gfp_t gfp, unsigned order) - pol = &default_policy; - - retry_cpuset: -- cpuset_mems_cookie = get_mems_allowed(); -+ cpuset_mems_cookie = read_mems_allowed_begin(); - - /* - * No reference counting needed for current->mempolicy -@@ -2126,7 +2126,7 @@ retry_cpuset: - policy_zonelist(gfp, pol, numa_node_id()), - policy_nodemask(gfp, pol)); - -- if (unlikely(!put_mems_allowed(cpuset_mems_cookie) && !page)) -+ if (unlikely(!page && read_mems_allowed_retry(cpuset_mems_cookie))) - goto retry_cpuset; - - return page; -diff --git a/mm/migrate.c b/mm/migrate.c -index bed48809e5d0..13f47fbe3550 100644 ---- a/mm/migrate.c -+++ b/mm/migrate.c -@@ -148,8 +148,11 @@ static int remove_migration_pte(struct page *new, struct vm_area_struct *vma, - pte = pte_mkold(mk_pte(new, vma->vm_page_prot)); - if (pte_swp_soft_dirty(*ptep)) - pte = pte_mksoft_dirty(pte); -+ -+ /* Recheck VMA as permissions can change since migration started */ - if (is_write_migration_entry(entry)) -- pte = pte_mkwrite(pte); -+ pte = maybe_mkwrite(pte, vma); -+ - #ifdef CONFIG_HUGETLB_PAGE - if (PageHuge(new)) { - pte = pte_mkhuge(pte); -diff --git a/mm/mmap.c b/mm/mmap.c -index 20ff0c33274c..dfe90657a6db 100644 ---- a/mm/mmap.c -+++ b/mm/mmap.c -@@ -10,6 +10,7 @@ - #include <linux/slab.h> - #include <linux/backing-dev.h> - #include <linux/mm.h> -+#include <linux/vmacache.h> - #include <linux/shm.h> - #include <linux/mman.h> - #include <linux/pagemap.h> -@@ -681,8 +682,9 @@ __vma_unlink(struct mm_struct *mm, struct vm_area_struct *vma, - prev->vm_next = next = vma->vm_next; - if (next) - next->vm_prev = prev; -- if (mm->mmap_cache == vma) -- mm->mmap_cache = prev; -+ -+ /* Kill the cache */ -+ vmacache_invalidate(mm); - } - - /* -@@ -1989,34 +1991,33 @@ EXPORT_SYMBOL(get_unmapped_area); - /* Look up the first VMA which satisfies addr < vm_end, NULL if none. */ - struct vm_area_struct *find_vma(struct mm_struct *mm, unsigned long addr) - { -- struct vm_area_struct *vma = NULL; -+ struct rb_node *rb_node; -+ struct vm_area_struct *vma; - - /* Check the cache first. */ -- /* (Cache hit rate is typically around 35%.) */ -- vma = ACCESS_ONCE(mm->mmap_cache); -- if (!(vma && vma->vm_end > addr && vma->vm_start <= addr)) { -- struct rb_node *rb_node; -+ vma = vmacache_find(mm, addr); -+ if (likely(vma)) -+ return vma; - -- rb_node = mm->mm_rb.rb_node; -- vma = NULL; -+ rb_node = mm->mm_rb.rb_node; -+ vma = NULL; - -- while (rb_node) { -- struct vm_area_struct *vma_tmp; -- -- vma_tmp = rb_entry(rb_node, -- struct vm_area_struct, vm_rb); -- -- if (vma_tmp->vm_end > addr) { -- vma = vma_tmp; -- if (vma_tmp->vm_start <= addr) -- break; -- rb_node = rb_node->rb_left; -- } else -- rb_node = rb_node->rb_right; -- } -- if (vma) -- mm->mmap_cache = vma; -+ while (rb_node) { -+ struct vm_area_struct *tmp; -+ -+ tmp = rb_entry(rb_node, struct vm_area_struct, vm_rb); -+ -+ if (tmp->vm_end > addr) { -+ vma = tmp; -+ if (tmp->vm_start <= addr) -+ break; -+ rb_node = rb_node->rb_left; -+ } else -+ rb_node = rb_node->rb_right; - } -+ -+ if (vma) -+ vmacache_update(addr, vma); - return vma; - } - -@@ -2388,7 +2389,9 @@ detach_vmas_to_be_unmapped(struct mm_struct *mm, struct vm_area_struct *vma, - } else - mm->highest_vm_end = prev ? prev->vm_end : 0; - tail_vma->vm_next = NULL; -- mm->mmap_cache = NULL; /* Kill the cache. */ -+ -+ /* Kill the cache */ -+ vmacache_invalidate(mm); - } - - /* -diff --git a/mm/nommu.c b/mm/nommu.c -index 8740213b1647..3ee4f74fbfbe 100644 ---- a/mm/nommu.c -+++ b/mm/nommu.c -@@ -15,6 +15,7 @@ - - #include <linux/export.h> - #include <linux/mm.h> -+#include <linux/vmacache.h> - #include <linux/mman.h> - #include <linux/swap.h> - #include <linux/file.h> -@@ -768,16 +769,23 @@ static void add_vma_to_mm(struct mm_struct *mm, struct vm_area_struct *vma) - */ - static void delete_vma_from_mm(struct vm_area_struct *vma) - { -+ int i; - struct address_space *mapping; - struct mm_struct *mm = vma->vm_mm; -+ struct task_struct *curr = current; - - kenter("%p", vma); - - protect_vma(vma, 0); - - mm->map_count--; -- if (mm->mmap_cache == vma) -- mm->mmap_cache = NULL; -+ for (i = 0; i < VMACACHE_SIZE; i++) { -+ /* if the vma is cached, invalidate the entire cache */ -+ if (curr->vmacache[i] == vma) { -+ vmacache_invalidate(curr->mm); -+ break; -+ } -+ } - - /* remove the VMA from the mapping */ - if (vma->vm_file) { -@@ -825,8 +833,8 @@ struct vm_area_struct *find_vma(struct mm_struct *mm, unsigned long addr) - struct vm_area_struct *vma; - - /* check the cache first */ -- vma = ACCESS_ONCE(mm->mmap_cache); -- if (vma && vma->vm_start <= addr && vma->vm_end > addr) -+ vma = vmacache_find(mm, addr); -+ if (likely(vma)) - return vma; - - /* trawl the list (there may be multiple mappings in which addr -@@ -835,7 +843,7 @@ struct vm_area_struct *find_vma(struct mm_struct *mm, unsigned long addr) - if (vma->vm_start > addr) - return NULL; - if (vma->vm_end > addr) { -- mm->mmap_cache = vma; -+ vmacache_update(addr, vma); - return vma; - } - } -@@ -874,8 +882,8 @@ static struct vm_area_struct *find_vma_exact(struct mm_struct *mm, - unsigned long end = addr + len; - - /* check the cache first */ -- vma = mm->mmap_cache; -- if (vma && vma->vm_start == addr && vma->vm_end == end) -+ vma = vmacache_find_exact(mm, addr, end); -+ if (vma) - return vma; - - /* trawl the list (there may be multiple mappings in which addr -@@ -886,7 +894,7 @@ static struct vm_area_struct *find_vma_exact(struct mm_struct *mm, - if (vma->vm_start > addr) - return NULL; - if (vma->vm_end == end) { -- mm->mmap_cache = vma; -+ vmacache_update(addr, vma); - return vma; - } - } -diff --git a/mm/page_alloc.c b/mm/page_alloc.c -index 62e400d00e3f..ff0f6b13f32f 100644 ---- a/mm/page_alloc.c -+++ b/mm/page_alloc.c -@@ -1869,7 +1869,7 @@ static void __paginginit init_zone_allows_reclaim(int nid) - { - int i; - -- for_each_online_node(i) -+ for_each_node_state(i, N_MEMORY) - if (node_distance(nid, i) <= RECLAIM_DISTANCE) - node_set(i, NODE_DATA(nid)->reclaim_nodes); - else -@@ -2736,7 +2736,7 @@ __alloc_pages_nodemask(gfp_t gfp_mask, unsigned int order, - return NULL; - - retry_cpuset: -- cpuset_mems_cookie = get_mems_allowed(); -+ cpuset_mems_cookie = read_mems_allowed_begin(); - - /* The preferred zone is used for statistics later */ - first_zones_zonelist(zonelist, high_zoneidx, -@@ -2791,7 +2791,7 @@ out: - * the mask is being updated. If a page allocation is about to fail, - * check if the cpuset changed during allocation and if so, retry. - */ -- if (unlikely(!put_mems_allowed(cpuset_mems_cookie) && !page)) -+ if (unlikely(!page && read_mems_allowed_retry(cpuset_mems_cookie))) - goto retry_cpuset; - - memcg_kmem_commit_charge(page, memcg, order); -@@ -3059,9 +3059,9 @@ bool skip_free_areas_node(unsigned int flags, int nid) - goto out; - - do { -- cpuset_mems_cookie = get_mems_allowed(); -+ cpuset_mems_cookie = read_mems_allowed_begin(); - ret = !node_isset(nid, cpuset_current_mems_allowed); -- } while (!put_mems_allowed(cpuset_mems_cookie)); -+ } while (read_mems_allowed_retry(cpuset_mems_cookie)); - out: - return ret; - } -@@ -4933,7 +4933,8 @@ void __paginginit free_area_init_node(int nid, unsigned long *zones_size, - - pgdat->node_id = nid; - pgdat->node_start_pfn = node_start_pfn; -- init_zone_allows_reclaim(nid); -+ if (node_state(nid, N_MEMORY)) -+ init_zone_allows_reclaim(nid); - #ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP - get_pfn_range_for_nid(nid, &start_pfn, &end_pfn); - #endif -diff --git a/mm/readahead.c b/mm/readahead.c -index 0de2360d65f3..1fa0d6fca556 100644 ---- a/mm/readahead.c -+++ b/mm/readahead.c -@@ -233,14 +233,14 @@ int force_page_cache_readahead(struct address_space *mapping, struct file *filp, - return 0; - } - -+#define MAX_READAHEAD ((512*4096)/PAGE_CACHE_SIZE) - /* - * Given a desired number of PAGE_CACHE_SIZE readahead pages, return a - * sensible upper limit. - */ - unsigned long max_sane_readahead(unsigned long nr) - { -- return min(nr, (node_page_state(numa_node_id(), NR_INACTIVE_FILE) -- + node_page_state(numa_node_id(), NR_FREE_PAGES)) / 2); -+ return min(nr, MAX_READAHEAD); - } - - /* -diff --git a/mm/slab.c b/mm/slab.c -index ea854eb2388c..0b1c2a58559d 100644 ---- a/mm/slab.c -+++ b/mm/slab.c -@@ -3122,7 +3122,7 @@ static void *fallback_alloc(struct kmem_cache *cache, gfp_t flags) - local_flags = flags & (GFP_CONSTRAINT_MASK|GFP_RECLAIM_MASK); - - retry_cpuset: -- cpuset_mems_cookie = get_mems_allowed(); -+ cpuset_mems_cookie = read_mems_allowed_begin(); - zonelist = node_zonelist(slab_node(), flags); - - retry: -@@ -3180,7 +3180,7 @@ retry: - } - } - -- if (unlikely(!put_mems_allowed(cpuset_mems_cookie) && !obj)) -+ if (unlikely(!obj && read_mems_allowed_retry(cpuset_mems_cookie))) - goto retry_cpuset; - return obj; - } -diff --git a/mm/slub.c b/mm/slub.c -index 25f14ad8f817..7611f148ee81 100644 ---- a/mm/slub.c -+++ b/mm/slub.c -@@ -1684,7 +1684,7 @@ static void *get_any_partial(struct kmem_cache *s, gfp_t flags, - return NULL; - - do { -- cpuset_mems_cookie = get_mems_allowed(); -+ cpuset_mems_cookie = read_mems_allowed_begin(); - zonelist = node_zonelist(slab_node(), flags); - for_each_zone_zonelist(zone, z, zonelist, high_zoneidx) { - struct kmem_cache_node *n; -@@ -1696,19 +1696,17 @@ static void *get_any_partial(struct kmem_cache *s, gfp_t flags, - object = get_partial_node(s, n, c, flags); - if (object) { - /* -- * Return the object even if -- * put_mems_allowed indicated that -- * the cpuset mems_allowed was -- * updated in parallel. It's a -- * harmless race between the alloc -- * and the cpuset update. -+ * Don't check read_mems_allowed_retry() -+ * here - if mems_allowed was updated in -+ * parallel, that was a harmless race -+ * between allocation and the cpuset -+ * update - */ -- put_mems_allowed(cpuset_mems_cookie); - return object; - } - } - } -- } while (!put_mems_allowed(cpuset_mems_cookie)); -+ } while (read_mems_allowed_retry(cpuset_mems_cookie)); - #endif - return NULL; - } -diff --git a/mm/swapfile.c b/mm/swapfile.c -index 4a7f7e6992b6..beeeef8a1b2d 100644 ---- a/mm/swapfile.c -+++ b/mm/swapfile.c -@@ -51,14 +51,32 @@ atomic_long_t nr_swap_pages; - /* protected with swap_lock. reading in vm_swap_full() doesn't need lock */ - long total_swap_pages; - static int least_priority; --static atomic_t highest_priority_index = ATOMIC_INIT(-1); - - static const char Bad_file[] = "Bad swap file entry "; - static const char Unused_file[] = "Unused swap file entry "; - static const char Bad_offset[] = "Bad swap offset entry "; - static const char Unused_offset[] = "Unused swap offset entry "; - --struct swap_list_t swap_list = {-1, -1}; -+/* -+ * all active swap_info_structs -+ * protected with swap_lock, and ordered by priority. -+ */ -+PLIST_HEAD(swap_active_head); -+ -+/* -+ * all available (active, not full) swap_info_structs -+ * protected with swap_avail_lock, ordered by priority. -+ * This is used by get_swap_page() instead of swap_active_head -+ * because swap_active_head includes all swap_info_structs, -+ * but get_swap_page() doesn't need to look at full ones. -+ * This uses its own lock instead of swap_lock because when a -+ * swap_info_struct changes between not-full/full, it needs to -+ * add/remove itself to/from this list, but the swap_info_struct->lock -+ * is held and the locking order requires swap_lock to be taken -+ * before any swap_info_struct->lock. -+ */ -+static PLIST_HEAD(swap_avail_head); -+static DEFINE_SPINLOCK(swap_avail_lock); - - struct swap_info_struct *swap_info[MAX_SWAPFILES]; - -@@ -591,6 +609,9 @@ checks: - if (si->inuse_pages == si->pages) { - si->lowest_bit = si->max; - si->highest_bit = 0; -+ spin_lock(&swap_avail_lock); -+ plist_del(&si->avail_list, &swap_avail_head); -+ spin_unlock(&swap_avail_lock); - } - si->swap_map[offset] = usage; - inc_cluster_info_page(si, si->cluster_info, offset); -@@ -640,71 +661,65 @@ no_page: - - swp_entry_t get_swap_page(void) - { -- struct swap_info_struct *si; -+ struct swap_info_struct *si, *next; - pgoff_t offset; -- int type, next; -- int wrapped = 0; -- int hp_index; - -- spin_lock(&swap_lock); - if (atomic_long_read(&nr_swap_pages) <= 0) - goto noswap; - atomic_long_dec(&nr_swap_pages); - -- for (type = swap_list.next; type >= 0 && wrapped < 2; type = next) { -- hp_index = atomic_xchg(&highest_priority_index, -1); -- /* -- * highest_priority_index records current highest priority swap -- * type which just frees swap entries. If its priority is -- * higher than that of swap_list.next swap type, we use it. It -- * isn't protected by swap_lock, so it can be an invalid value -- * if the corresponding swap type is swapoff. We double check -- * the flags here. It's even possible the swap type is swapoff -- * and swapon again and its priority is changed. In such rare -- * case, low prority swap type might be used, but eventually -- * high priority swap will be used after several rounds of -- * swap. -- */ -- if (hp_index != -1 && hp_index != type && -- swap_info[type]->prio < swap_info[hp_index]->prio && -- (swap_info[hp_index]->flags & SWP_WRITEOK)) { -- type = hp_index; -- swap_list.next = type; -- } -- -- si = swap_info[type]; -- next = si->next; -- if (next < 0 || -- (!wrapped && si->prio != swap_info[next]->prio)) { -- next = swap_list.head; -- wrapped++; -- } -+ spin_lock(&swap_avail_lock); - -+start_over: -+ plist_for_each_entry_safe(si, next, &swap_avail_head, avail_list) { -+ /* requeue si to after same-priority siblings */ -+ plist_requeue(&si->avail_list, &swap_avail_head); -+ spin_unlock(&swap_avail_lock); - spin_lock(&si->lock); -- if (!si->highest_bit) { -+ if (!si->highest_bit || !(si->flags & SWP_WRITEOK)) { -+ spin_lock(&swap_avail_lock); -+ if (plist_node_empty(&si->avail_list)) { -+ spin_unlock(&si->lock); -+ goto nextsi; -+ } -+ WARN(!si->highest_bit, -+ "swap_info %d in list but !highest_bit\n", -+ si->type); -+ WARN(!(si->flags & SWP_WRITEOK), -+ "swap_info %d in list but !SWP_WRITEOK\n", -+ si->type); -+ plist_del(&si->avail_list, &swap_avail_head); - spin_unlock(&si->lock); -- continue; -+ goto nextsi; - } -- if (!(si->flags & SWP_WRITEOK)) { -- spin_unlock(&si->lock); -- continue; -- } -- -- swap_list.next = next; - -- spin_unlock(&swap_lock); - /* This is called for allocating swap entry for cache */ - offset = scan_swap_map(si, SWAP_HAS_CACHE); - spin_unlock(&si->lock); - if (offset) -- return swp_entry(type, offset); -- spin_lock(&swap_lock); -- next = swap_list.next; -+ return swp_entry(si->type, offset); -+ pr_debug("scan_swap_map of si %d failed to find offset\n", -+ si->type); -+ spin_lock(&swap_avail_lock); -+nextsi: -+ /* -+ * if we got here, it's likely that si was almost full before, -+ * and since scan_swap_map() can drop the si->lock, multiple -+ * callers probably all tried to get a page from the same si -+ * and it filled up before we could get one; or, the si filled -+ * up between us dropping swap_avail_lock and taking si->lock. -+ * Since we dropped the swap_avail_lock, the swap_avail_head -+ * list may have been modified; so if next is still in the -+ * swap_avail_head list then try it, otherwise start over. -+ */ -+ if (plist_node_empty(&next->avail_list)) -+ goto start_over; - } - -+ spin_unlock(&swap_avail_lock); -+ - atomic_long_inc(&nr_swap_pages); - noswap: -- spin_unlock(&swap_lock); - return (swp_entry_t) {0}; - } - -@@ -766,27 +781,6 @@ out: - return NULL; - } - --/* -- * This swap type frees swap entry, check if it is the highest priority swap -- * type which just frees swap entry. get_swap_page() uses -- * highest_priority_index to search highest priority swap type. The -- * swap_info_struct.lock can't protect us if there are multiple swap types -- * active, so we use atomic_cmpxchg. -- */ --static void set_highest_priority_index(int type) --{ -- int old_hp_index, new_hp_index; -- -- do { -- old_hp_index = atomic_read(&highest_priority_index); -- if (old_hp_index != -1 && -- swap_info[old_hp_index]->prio >= swap_info[type]->prio) -- break; -- new_hp_index = type; -- } while (atomic_cmpxchg(&highest_priority_index, -- old_hp_index, new_hp_index) != old_hp_index); --} -- - static unsigned char swap_entry_free(struct swap_info_struct *p, - swp_entry_t entry, unsigned char usage) - { -@@ -828,9 +822,18 @@ static unsigned char swap_entry_free(struct swap_info_struct *p, - dec_cluster_info_page(p, p->cluster_info, offset); - if (offset < p->lowest_bit) - p->lowest_bit = offset; -- if (offset > p->highest_bit) -+ if (offset > p->highest_bit) { -+ bool was_full = !p->highest_bit; - p->highest_bit = offset; -- set_highest_priority_index(p->type); -+ if (was_full && (p->flags & SWP_WRITEOK)) { -+ spin_lock(&swap_avail_lock); -+ WARN_ON(!plist_node_empty(&p->avail_list)); -+ if (plist_node_empty(&p->avail_list)) -+ plist_add(&p->avail_list, -+ &swap_avail_head); -+ spin_unlock(&swap_avail_lock); -+ } -+ } - atomic_long_inc(&nr_swap_pages); - p->inuse_pages--; - frontswap_invalidate_page(p->type, offset); -@@ -1765,30 +1768,37 @@ static void _enable_swap_info(struct swap_info_struct *p, int prio, - unsigned char *swap_map, - struct swap_cluster_info *cluster_info) - { -- int i, prev; -- - if (prio >= 0) - p->prio = prio; - else - p->prio = --least_priority; -+ /* -+ * the plist prio is negated because plist ordering is -+ * low-to-high, while swap ordering is high-to-low -+ */ -+ p->list.prio = -p->prio; -+ p->avail_list.prio = -p->prio; - p->swap_map = swap_map; - p->cluster_info = cluster_info; - p->flags |= SWP_WRITEOK; - atomic_long_add(p->pages, &nr_swap_pages); - total_swap_pages += p->pages; - -- /* insert swap space into swap_list: */ -- prev = -1; -- for (i = swap_list.head; i >= 0; i = swap_info[i]->next) { -- if (p->prio >= swap_info[i]->prio) -- break; -- prev = i; -- } -- p->next = i; -- if (prev < 0) -- swap_list.head = swap_list.next = p->type; -- else -- swap_info[prev]->next = p->type; -+ assert_spin_locked(&swap_lock); -+ /* -+ * both lists are plists, and thus priority ordered. -+ * swap_active_head needs to be priority ordered for swapoff(), -+ * which on removal of any swap_info_struct with an auto-assigned -+ * (i.e. negative) priority increments the auto-assigned priority -+ * of any lower-priority swap_info_structs. -+ * swap_avail_head needs to be priority ordered for get_swap_page(), -+ * which allocates swap pages from the highest available priority -+ * swap_info_struct. -+ */ -+ plist_add(&p->list, &swap_active_head); -+ spin_lock(&swap_avail_lock); -+ plist_add(&p->avail_list, &swap_avail_head); -+ spin_unlock(&swap_avail_lock); - } - - static void enable_swap_info(struct swap_info_struct *p, int prio, -@@ -1823,8 +1833,7 @@ SYSCALL_DEFINE1(swapoff, const char __user *, specialfile) - struct address_space *mapping; - struct inode *inode; - struct filename *pathname; -- int i, type, prev; -- int err; -+ int err, found = 0; - unsigned int old_block_size; - - if (!capable(CAP_SYS_ADMIN)) -@@ -1842,17 +1851,16 @@ SYSCALL_DEFINE1(swapoff, const char __user *, specialfile) - goto out; - - mapping = victim->f_mapping; -- prev = -1; - spin_lock(&swap_lock); -- for (type = swap_list.head; type >= 0; type = swap_info[type]->next) { -- p = swap_info[type]; -+ plist_for_each_entry(p, &swap_active_head, list) { - if (p->flags & SWP_WRITEOK) { -- if (p->swap_file->f_mapping == mapping) -+ if (p->swap_file->f_mapping == mapping) { -+ found = 1; - break; -+ } - } -- prev = type; - } -- if (type < 0) { -+ if (!found) { - err = -EINVAL; - spin_unlock(&swap_lock); - goto out_dput; -@@ -1864,20 +1872,21 @@ SYSCALL_DEFINE1(swapoff, const char __user *, specialfile) - spin_unlock(&swap_lock); - goto out_dput; - } -- if (prev < 0) -- swap_list.head = p->next; -- else -- swap_info[prev]->next = p->next; -- if (type == swap_list.next) { -- /* just pick something that's safe... */ -- swap_list.next = swap_list.head; -- } -+ spin_lock(&swap_avail_lock); -+ plist_del(&p->avail_list, &swap_avail_head); -+ spin_unlock(&swap_avail_lock); - spin_lock(&p->lock); - if (p->prio < 0) { -- for (i = p->next; i >= 0; i = swap_info[i]->next) -- swap_info[i]->prio = p->prio--; -+ struct swap_info_struct *si = p; -+ -+ plist_for_each_entry_continue(si, &swap_active_head, list) { -+ si->prio++; -+ si->list.prio--; -+ si->avail_list.prio--; -+ } - least_priority++; - } -+ plist_del(&p->list, &swap_active_head); - atomic_long_sub(p->pages, &nr_swap_pages); - total_swap_pages -= p->pages; - p->flags &= ~SWP_WRITEOK; -@@ -1885,7 +1894,7 @@ SYSCALL_DEFINE1(swapoff, const char __user *, specialfile) - spin_unlock(&swap_lock); - - set_current_oom_origin(); -- err = try_to_unuse(type, false, 0); /* force all pages to be unused */ -+ err = try_to_unuse(p->type, false, 0); /* force unuse all pages */ - clear_current_oom_origin(); - - if (err) { -@@ -1926,7 +1935,7 @@ SYSCALL_DEFINE1(swapoff, const char __user *, specialfile) - frontswap_map = frontswap_map_get(p); - spin_unlock(&p->lock); - spin_unlock(&swap_lock); -- frontswap_invalidate_area(type); -+ frontswap_invalidate_area(p->type); - frontswap_map_set(p, NULL); - mutex_unlock(&swapon_mutex); - free_percpu(p->percpu_cluster); -@@ -1935,7 +1944,7 @@ SYSCALL_DEFINE1(swapoff, const char __user *, specialfile) - vfree(cluster_info); - vfree(frontswap_map); - /* Destroy swap account information */ -- swap_cgroup_swapoff(type); -+ swap_cgroup_swapoff(p->type); - - inode = mapping->host; - if (S_ISBLK(inode->i_mode)) { -@@ -2142,8 +2151,9 @@ static struct swap_info_struct *alloc_swap_info(void) - */ - } - INIT_LIST_HEAD(&p->first_swap_extent.list); -+ plist_node_init(&p->list, 0); -+ plist_node_init(&p->avail_list, 0); - p->flags = SWP_USED; -- p->next = -1; - spin_unlock(&swap_lock); - spin_lock_init(&p->lock); - -diff --git a/mm/vmacache.c b/mm/vmacache.c -new file mode 100644 -index 000000000000..1037a3bab505 ---- /dev/null -+++ b/mm/vmacache.c -@@ -0,0 +1,114 @@ -+/* -+ * Copyright (C) 2014 Davidlohr Bueso. -+ */ -+#include <linux/sched.h> -+#include <linux/mm.h> -+#include <linux/vmacache.h> -+ -+/* -+ * Flush vma caches for threads that share a given mm. -+ * -+ * The operation is safe because the caller holds the mmap_sem -+ * exclusively and other threads accessing the vma cache will -+ * have mmap_sem held at least for read, so no extra locking -+ * is required to maintain the vma cache. -+ */ -+void vmacache_flush_all(struct mm_struct *mm) -+{ -+ struct task_struct *g, *p; -+ -+ rcu_read_lock(); -+ for_each_process_thread(g, p) { -+ /* -+ * Only flush the vmacache pointers as the -+ * mm seqnum is already set and curr's will -+ * be set upon invalidation when the next -+ * lookup is done. -+ */ -+ if (mm == p->mm) -+ vmacache_flush(p); -+ } -+ rcu_read_unlock(); -+} -+ -+/* -+ * This task may be accessing a foreign mm via (for example) -+ * get_user_pages()->find_vma(). The vmacache is task-local and this -+ * task's vmacache pertains to a different mm (ie, its own). There is -+ * nothing we can do here. -+ * -+ * Also handle the case where a kernel thread has adopted this mm via use_mm(). -+ * That kernel thread's vmacache is not applicable to this mm. -+ */ -+static bool vmacache_valid_mm(struct mm_struct *mm) -+{ -+ return current->mm == mm && !(current->flags & PF_KTHREAD); -+} -+ -+void vmacache_update(unsigned long addr, struct vm_area_struct *newvma) -+{ -+ if (vmacache_valid_mm(newvma->vm_mm)) -+ current->vmacache[VMACACHE_HASH(addr)] = newvma; -+} -+ -+static bool vmacache_valid(struct mm_struct *mm) -+{ -+ struct task_struct *curr; -+ -+ if (!vmacache_valid_mm(mm)) -+ return false; -+ -+ curr = current; -+ if (mm->vmacache_seqnum != curr->vmacache_seqnum) { -+ /* -+ * First attempt will always be invalid, initialize -+ * the new cache for this task here. -+ */ -+ curr->vmacache_seqnum = mm->vmacache_seqnum; -+ vmacache_flush(curr); -+ return false; -+ } -+ return true; -+} -+ -+struct vm_area_struct *vmacache_find(struct mm_struct *mm, unsigned long addr) -+{ -+ int i; -+ -+ if (!vmacache_valid(mm)) -+ return NULL; -+ -+ for (i = 0; i < VMACACHE_SIZE; i++) { -+ struct vm_area_struct *vma = current->vmacache[i]; -+ -+ if (!vma) -+ continue; -+ if (WARN_ON_ONCE(vma->vm_mm != mm)) -+ break; -+ if (vma->vm_start <= addr && vma->vm_end > addr) -+ return vma; -+ } -+ -+ return NULL; -+} -+ -+#ifndef CONFIG_MMU -+struct vm_area_struct *vmacache_find_exact(struct mm_struct *mm, -+ unsigned long start, -+ unsigned long end) -+{ -+ int i; -+ -+ if (!vmacache_valid(mm)) -+ return NULL; -+ -+ for (i = 0; i < VMACACHE_SIZE; i++) { -+ struct vm_area_struct *vma = current->vmacache[i]; -+ -+ if (vma && vma->vm_start == start && vma->vm_end == end) -+ return vma; -+ } -+ -+ return NULL; -+} -+#endif -diff --git a/mm/vmscan.c b/mm/vmscan.c -index 6ef484f0777f..0c0b36e5b4f8 100644 ---- a/mm/vmscan.c -+++ b/mm/vmscan.c -@@ -224,15 +224,15 @@ shrink_slab_node(struct shrink_control *shrinkctl, struct shrinker *shrinker, - unsigned long freed = 0; - unsigned long long delta; - long total_scan; -- long max_pass; -+ long freeable; - long nr; - long new_nr; - int nid = shrinkctl->nid; - long batch_size = shrinker->batch ? shrinker->batch - : SHRINK_BATCH; - -- max_pass = shrinker->count_objects(shrinker, shrinkctl); -- if (max_pass == 0) -+ freeable = shrinker->count_objects(shrinker, shrinkctl); -+ if (freeable == 0) - return 0; - - /* -@@ -244,14 +244,14 @@ shrink_slab_node(struct shrink_control *shrinkctl, struct shrinker *shrinker, - - total_scan = nr; - delta = (4 * nr_pages_scanned) / shrinker->seeks; -- delta *= max_pass; -+ delta *= freeable; - do_div(delta, lru_pages + 1); - total_scan += delta; - if (total_scan < 0) { - printk(KERN_ERR - "shrink_slab: %pF negative objects to delete nr=%ld\n", - shrinker->scan_objects, total_scan); -- total_scan = max_pass; -+ total_scan = freeable; - } - - /* -@@ -260,26 +260,26 @@ shrink_slab_node(struct shrink_control *shrinkctl, struct shrinker *shrinker, - * shrinkers to return -1 all the time. This results in a large - * nr being built up so when a shrink that can do some work - * comes along it empties the entire cache due to nr >>> -- * max_pass. This is bad for sustaining a working set in -+ * freeable. This is bad for sustaining a working set in - * memory. - * - * Hence only allow the shrinker to scan the entire cache when - * a large delta change is calculated directly. - */ -- if (delta < max_pass / 4) -- total_scan = min(total_scan, max_pass / 2); -+ if (delta < freeable / 4) -+ total_scan = min(total_scan, freeable / 2); - - /* - * Avoid risking looping forever due to too large nr value: - * never try to free more than twice the estimate number of - * freeable entries. - */ -- if (total_scan > max_pass * 2) -- total_scan = max_pass * 2; -+ if (total_scan > freeable * 2) -+ total_scan = freeable * 2; - - trace_mm_shrink_slab_start(shrinker, shrinkctl, nr, - nr_pages_scanned, lru_pages, -- max_pass, delta, total_scan); -+ freeable, delta, total_scan); - - /* - * Normally, we should not scan less than batch_size objects in one -@@ -292,12 +292,12 @@ shrink_slab_node(struct shrink_control *shrinkctl, struct shrinker *shrinker, - * - * We detect the "tight on memory" situations by looking at the total - * number of objects we want to scan (total_scan). If it is greater -- * than the total number of objects on slab (max_pass), we must be -+ * than the total number of objects on slab (freeable), we must be - * scanning at high prio and therefore should try to reclaim as much as - * possible. - */ - while (total_scan >= batch_size || -- total_scan >= max_pass) { -+ total_scan >= freeable) { - unsigned long ret; - unsigned long nr_to_scan = min(batch_size, total_scan); - -@@ -1144,7 +1144,7 @@ unsigned long reclaim_clean_pages_from_list(struct zone *zone, - TTU_UNMAP|TTU_IGNORE_ACCESS, - &dummy1, &dummy2, &dummy3, &dummy4, &dummy5, true); - list_splice(&clean_pages, page_list); -- __mod_zone_page_state(zone, NR_ISOLATED_FILE, -ret); -+ mod_zone_page_state(zone, NR_ISOLATED_FILE, -ret); - return ret; - } - -@@ -2424,8 +2424,8 @@ static unsigned long do_try_to_free_pages(struct zonelist *zonelist, - unsigned long lru_pages = 0; - - nodes_clear(shrink->nodes_to_scan); -- for_each_zone_zonelist(zone, z, zonelist, -- gfp_zone(sc->gfp_mask)) { -+ for_each_zone_zonelist_nodemask(zone, z, zonelist, -+ gfp_zone(sc->gfp_mask), sc->nodemask) { - if (!cpuset_zone_allowed_hardwall(zone, GFP_KERNEL)) - continue; - diff --git a/projects/imx6/patches/linux/linux-000-patch-3.14.21-22.patch b/projects/imx6/patches/linux/linux-000-patch-3.14.21-22.patch deleted file mode 100644 index 23599bd3410..00000000000 --- a/projects/imx6/patches/linux/linux-000-patch-3.14.21-22.patch +++ /dev/null @@ -1,1795 +0,0 @@ -diff --git a/Makefile b/Makefile -index 41e6e19fe2e9..a59980eb4557 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,6 +1,6 @@ - VERSION = 3 - PATCHLEVEL = 14 --SUBLEVEL = 21 -+SUBLEVEL = 22 - EXTRAVERSION = - NAME = Remembering Coco - -diff --git a/drivers/crypto/caam/caamhash.c b/drivers/crypto/caam/caamhash.c -index 0378328f47a7..a4127453baae 100644 ---- a/drivers/crypto/caam/caamhash.c -+++ b/drivers/crypto/caam/caamhash.c -@@ -1348,9 +1348,9 @@ static int ahash_update_first(struct ahash_request *req) - struct device *jrdev = ctx->jrdev; - gfp_t flags = (req->base.flags & (CRYPTO_TFM_REQ_MAY_BACKLOG | - CRYPTO_TFM_REQ_MAY_SLEEP)) ? GFP_KERNEL : GFP_ATOMIC; -- u8 *next_buf = state->buf_0 + state->current_buf * -- CAAM_MAX_HASH_BLOCK_SIZE; -- int *next_buflen = &state->buflen_0 + state->current_buf; -+ u8 *next_buf = state->current_buf ? state->buf_1 : state->buf_0; -+ int *next_buflen = state->current_buf ? -+ &state->buflen_1 : &state->buflen_0; - int to_hash; - u32 *sh_desc = ctx->sh_desc_update_first, *desc; - dma_addr_t ptr = ctx->sh_desc_update_first_dma; -diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c -index a95b322f0924..cc38948cf65d 100644 ---- a/drivers/net/bonding/bond_main.c -+++ b/drivers/net/bonding/bond_main.c -@@ -3624,8 +3624,14 @@ static int bond_xmit_roundrobin(struct sk_buff *skb, struct net_device *bond_dev - else - bond_xmit_slave_id(bond, skb, 0); - } else { -- slave_id = bond_rr_gen_slave_id(bond); -- bond_xmit_slave_id(bond, skb, slave_id % bond->slave_cnt); -+ int slave_cnt = ACCESS_ONCE(bond->slave_cnt); -+ -+ if (likely(slave_cnt)) { -+ slave_id = bond_rr_gen_slave_id(bond); -+ bond_xmit_slave_id(bond, skb, slave_id % slave_cnt); -+ } else { -+ dev_kfree_skb_any(skb); -+ } - } - - return NETDEV_TX_OK; -@@ -3656,8 +3662,13 @@ static int bond_xmit_activebackup(struct sk_buff *skb, struct net_device *bond_d - static int bond_xmit_xor(struct sk_buff *skb, struct net_device *bond_dev) - { - struct bonding *bond = netdev_priv(bond_dev); -+ int slave_cnt = ACCESS_ONCE(bond->slave_cnt); - -- bond_xmit_slave_id(bond, skb, bond_xmit_hash(bond, skb, bond->slave_cnt)); -+ if (likely(slave_cnt)) -+ bond_xmit_slave_id(bond, skb, -+ bond_xmit_hash(bond, skb, bond->slave_cnt)); -+ else -+ dev_kfree_skb_any(skb); - - return NETDEV_TX_OK; - } -diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c -index a210766279d3..9373f1f59605 100644 ---- a/drivers/net/ethernet/broadcom/tg3.c -+++ b/drivers/net/ethernet/broadcom/tg3.c -@@ -6923,7 +6923,8 @@ static int tg3_rx(struct tg3_napi *tnapi, int budget) - skb->protocol = eth_type_trans(skb, tp->dev); - - if (len > (tp->dev->mtu + ETH_HLEN) && -- skb->protocol != htons(ETH_P_8021Q)) { -+ skb->protocol != htons(ETH_P_8021Q) && -+ skb->protocol != htons(ETH_P_8021AD)) { - dev_kfree_skb(skb); - goto drop_it_no_recycle; - } -@@ -7915,8 +7916,6 @@ static netdev_tx_t tg3_start_xmit(struct sk_buff *skb, struct net_device *dev) - - entry = tnapi->tx_prod; - base_flags = 0; -- if (skb->ip_summed == CHECKSUM_PARTIAL) -- base_flags |= TXD_FLAG_TCPUDP_CSUM; - - mss = skb_shinfo(skb)->gso_size; - if (mss) { -@@ -7932,6 +7931,13 @@ static netdev_tx_t tg3_start_xmit(struct sk_buff *skb, struct net_device *dev) - - hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb) - ETH_HLEN; - -+ /* HW/FW can not correctly segment packets that have been -+ * vlan encapsulated. -+ */ -+ if (skb->protocol == htons(ETH_P_8021Q) || -+ skb->protocol == htons(ETH_P_8021AD)) -+ return tg3_tso_bug(tp, skb); -+ - if (!skb_is_gso_v6(skb)) { - iph->check = 0; - iph->tot_len = htons(mss + hdr_len); -@@ -7978,6 +7984,17 @@ static netdev_tx_t tg3_start_xmit(struct sk_buff *skb, struct net_device *dev) - base_flags |= tsflags << 12; - } - } -+ } else if (skb->ip_summed == CHECKSUM_PARTIAL) { -+ /* HW/FW can not correctly checksum packets that have been -+ * vlan encapsulated. -+ */ -+ if (skb->protocol == htons(ETH_P_8021Q) || -+ skb->protocol == htons(ETH_P_8021AD)) { -+ if (skb_checksum_help(skb)) -+ goto drop; -+ } else { -+ base_flags |= TXD_FLAG_TCPUDP_CSUM; -+ } - } - - if (tg3_flag(tp, USE_JUMBO_BDFLAG) && -diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c -index d0c38e01e99f..0085476a0258 100644 ---- a/drivers/net/ethernet/cadence/macb.c -+++ b/drivers/net/ethernet/cadence/macb.c -@@ -30,7 +30,6 @@ - #include <linux/of_device.h> - #include <linux/of_mdio.h> - #include <linux/of_net.h> --#include <linux/pinctrl/consumer.h> - - #include "macb.h" - -@@ -1810,7 +1809,6 @@ static int __init macb_probe(struct platform_device *pdev) - struct phy_device *phydev; - u32 config; - int err = -ENXIO; -- struct pinctrl *pinctrl; - const char *mac; - - regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); -@@ -1819,15 +1817,6 @@ static int __init macb_probe(struct platform_device *pdev) - goto err_out; - } - -- pinctrl = devm_pinctrl_get_select_default(&pdev->dev); -- if (IS_ERR(pinctrl)) { -- err = PTR_ERR(pinctrl); -- if (err == -EPROBE_DEFER) -- goto err_out; -- -- dev_warn(&pdev->dev, "No pinctrl provided\n"); -- } -- - err = -ENOMEM; - dev = alloc_etherdev(sizeof(*bp)); - if (!dev) -diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c -index b901371ca361..5d3206d5cb07 100644 ---- a/drivers/net/ethernet/intel/i40e/i40e_main.c -+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c -@@ -4024,6 +4024,9 @@ static int i40e_init_pf_dcb(struct i40e_pf *pf) - DCB_CAP_DCBX_VER_IEEE; - pf->flags |= I40E_FLAG_DCB_ENABLED; - } -+ } else { -+ dev_info(&pf->pdev->dev, "AQ Querying DCB configuration failed: %d\n", -+ pf->hw.aq.asq_last_status); - } - - out: -@@ -8003,7 +8006,7 @@ static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent) - if (err) { - dev_info(&pdev->dev, "init_pf_dcb failed: %d\n", err); - pf->flags &= ~I40E_FLAG_DCB_ENABLED; -- goto err_init_dcb; -+ /* Continue without DCB enabled */ - } - #endif /* CONFIG_I40E_DCB */ - -@@ -8119,9 +8122,6 @@ err_vsis: - err_switch_setup: - i40e_reset_interrupt_capability(pf); - del_timer_sync(&pf->service_timer); --#ifdef CONFIG_I40E_DCB --err_init_dcb: --#endif /* CONFIG_I40E_DCB */ - err_mac_addr: - err_configure_lan_hmc: - (void)i40e_shutdown_lan_hmc(hw); -diff --git a/drivers/net/ethernet/myricom/myri10ge/myri10ge.c b/drivers/net/ethernet/myricom/myri10ge/myri10ge.c -index 68026f7e8ba3..4a474dd9c910 100644 ---- a/drivers/net/ethernet/myricom/myri10ge/myri10ge.c -+++ b/drivers/net/ethernet/myricom/myri10ge/myri10ge.c -@@ -872,6 +872,10 @@ static int myri10ge_dma_test(struct myri10ge_priv *mgp, int test_type) - return -ENOMEM; - dmatest_bus = pci_map_page(mgp->pdev, dmatest_page, 0, PAGE_SIZE, - DMA_BIDIRECTIONAL); -+ if (unlikely(pci_dma_mapping_error(mgp->pdev, dmatest_bus))) { -+ __free_page(dmatest_page); -+ return -ENOMEM; -+ } - - /* Run a small DMA test. - * The magic multipliers to the length tell the firmware -@@ -1293,6 +1297,7 @@ myri10ge_alloc_rx_pages(struct myri10ge_priv *mgp, struct myri10ge_rx_buf *rx, - int bytes, int watchdog) - { - struct page *page; -+ dma_addr_t bus; - int idx; - #if MYRI10GE_ALLOC_SIZE > 4096 - int end_offset; -@@ -1317,11 +1322,21 @@ myri10ge_alloc_rx_pages(struct myri10ge_priv *mgp, struct myri10ge_rx_buf *rx, - rx->watchdog_needed = 1; - return; - } -+ -+ bus = pci_map_page(mgp->pdev, page, 0, -+ MYRI10GE_ALLOC_SIZE, -+ PCI_DMA_FROMDEVICE); -+ if (unlikely(pci_dma_mapping_error(mgp->pdev, bus))) { -+ __free_pages(page, MYRI10GE_ALLOC_ORDER); -+ if (rx->fill_cnt - rx->cnt < 16) -+ rx->watchdog_needed = 1; -+ return; -+ } -+ - rx->page = page; - rx->page_offset = 0; -- rx->bus = pci_map_page(mgp->pdev, page, 0, -- MYRI10GE_ALLOC_SIZE, -- PCI_DMA_FROMDEVICE); -+ rx->bus = bus; -+ - } - rx->info[idx].page = rx->page; - rx->info[idx].page_offset = rx->page_offset; -@@ -2765,6 +2780,35 @@ myri10ge_submit_req(struct myri10ge_tx_buf *tx, struct mcp_kreq_ether_send *src, - mb(); - } - -+static void myri10ge_unmap_tx_dma(struct myri10ge_priv *mgp, -+ struct myri10ge_tx_buf *tx, int idx) -+{ -+ unsigned int len; -+ int last_idx; -+ -+ /* Free any DMA resources we've alloced and clear out the skb slot */ -+ last_idx = (idx + 1) & tx->mask; -+ idx = tx->req & tx->mask; -+ do { -+ len = dma_unmap_len(&tx->info[idx], len); -+ if (len) { -+ if (tx->info[idx].skb != NULL) -+ pci_unmap_single(mgp->pdev, -+ dma_unmap_addr(&tx->info[idx], -+ bus), len, -+ PCI_DMA_TODEVICE); -+ else -+ pci_unmap_page(mgp->pdev, -+ dma_unmap_addr(&tx->info[idx], -+ bus), len, -+ PCI_DMA_TODEVICE); -+ dma_unmap_len_set(&tx->info[idx], len, 0); -+ tx->info[idx].skb = NULL; -+ } -+ idx = (idx + 1) & tx->mask; -+ } while (idx != last_idx); -+} -+ - /* - * Transmit a packet. We need to split the packet so that a single - * segment does not cross myri10ge->tx_boundary, so this makes segment -@@ -2788,7 +2832,7 @@ static netdev_tx_t myri10ge_xmit(struct sk_buff *skb, - u32 low; - __be32 high_swapped; - unsigned int len; -- int idx, last_idx, avail, frag_cnt, frag_idx, count, mss, max_segments; -+ int idx, avail, frag_cnt, frag_idx, count, mss, max_segments; - u16 pseudo_hdr_offset, cksum_offset, queue; - int cum_len, seglen, boundary, rdma_count; - u8 flags, odd_flag; -@@ -2885,9 +2929,12 @@ again: - - /* map the skb for DMA */ - len = skb_headlen(skb); -+ bus = pci_map_single(mgp->pdev, skb->data, len, PCI_DMA_TODEVICE); -+ if (unlikely(pci_dma_mapping_error(mgp->pdev, bus))) -+ goto drop; -+ - idx = tx->req & tx->mask; - tx->info[idx].skb = skb; -- bus = pci_map_single(mgp->pdev, skb->data, len, PCI_DMA_TODEVICE); - dma_unmap_addr_set(&tx->info[idx], bus, bus); - dma_unmap_len_set(&tx->info[idx], len, len); - -@@ -2986,12 +3033,16 @@ again: - break; - - /* map next fragment for DMA */ -- idx = (count + tx->req) & tx->mask; - frag = &skb_shinfo(skb)->frags[frag_idx]; - frag_idx++; - len = skb_frag_size(frag); - bus = skb_frag_dma_map(&mgp->pdev->dev, frag, 0, len, - DMA_TO_DEVICE); -+ if (unlikely(pci_dma_mapping_error(mgp->pdev, bus))) { -+ myri10ge_unmap_tx_dma(mgp, tx, idx); -+ goto drop; -+ } -+ idx = (count + tx->req) & tx->mask; - dma_unmap_addr_set(&tx->info[idx], bus, bus); - dma_unmap_len_set(&tx->info[idx], len, len); - } -@@ -3022,31 +3073,8 @@ again: - return NETDEV_TX_OK; - - abort_linearize: -- /* Free any DMA resources we've alloced and clear out the skb -- * slot so as to not trip up assertions, and to avoid a -- * double-free if linearizing fails */ -+ myri10ge_unmap_tx_dma(mgp, tx, idx); - -- last_idx = (idx + 1) & tx->mask; -- idx = tx->req & tx->mask; -- tx->info[idx].skb = NULL; -- do { -- len = dma_unmap_len(&tx->info[idx], len); -- if (len) { -- if (tx->info[idx].skb != NULL) -- pci_unmap_single(mgp->pdev, -- dma_unmap_addr(&tx->info[idx], -- bus), len, -- PCI_DMA_TODEVICE); -- else -- pci_unmap_page(mgp->pdev, -- dma_unmap_addr(&tx->info[idx], -- bus), len, -- PCI_DMA_TODEVICE); -- dma_unmap_len_set(&tx->info[idx], len, 0); -- tx->info[idx].skb = NULL; -- } -- idx = (idx + 1) & tx->mask; -- } while (idx != last_idx); - if (skb_is_gso(skb)) { - netdev_err(mgp->dev, "TSO but wanted to linearize?!?!?\n"); - goto drop; -diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c -index d6fce9750b95..3c1c33ceffba 100644 ---- a/drivers/net/hyperv/netvsc_drv.c -+++ b/drivers/net/hyperv/netvsc_drv.c -@@ -146,6 +146,7 @@ static int netvsc_start_xmit(struct sk_buff *skb, struct net_device *net) - struct hv_netvsc_packet *packet; - int ret; - unsigned int i, num_pages, npg_data; -+ u32 skb_length = skb->len; - - /* Add multipages for skb->data and additional 2 for RNDIS */ - npg_data = (((unsigned long)skb->data + skb_headlen(skb) - 1) -@@ -216,7 +217,7 @@ static int netvsc_start_xmit(struct sk_buff *skb, struct net_device *net) - ret = rndis_filter_send(net_device_ctx->device_ctx, - packet); - if (ret == 0) { -- net->stats.tx_bytes += skb->len; -+ net->stats.tx_bytes += skb_length; - net->stats.tx_packets++; - } else { - kfree(packet); -diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c -index 7f1abb7c18f2..fbf7dcdc22b0 100644 ---- a/drivers/net/macvlan.c -+++ b/drivers/net/macvlan.c -@@ -709,6 +709,7 @@ static netdev_features_t macvlan_fix_features(struct net_device *dev, - features, - mask); - features |= ALWAYS_ON_FEATURES; -+ features &= ~NETIF_F_NETNS_LOCAL; - - return features; - } -diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c -index 3381c4f91a8c..0c6adaaf898c 100644 ---- a/drivers/net/macvtap.c -+++ b/drivers/net/macvtap.c -@@ -112,17 +112,15 @@ out: - return err; - } - -+/* Requires RTNL */ - static int macvtap_set_queue(struct net_device *dev, struct file *file, - struct macvtap_queue *q) - { - struct macvlan_dev *vlan = netdev_priv(dev); -- int err = -EBUSY; - -- rtnl_lock(); - if (vlan->numqueues == MAX_MACVTAP_QUEUES) -- goto out; -+ return -EBUSY; - -- err = 0; - rcu_assign_pointer(q->vlan, vlan); - rcu_assign_pointer(vlan->taps[vlan->numvtaps], q); - sock_hold(&q->sk); -@@ -136,9 +134,7 @@ static int macvtap_set_queue(struct net_device *dev, struct file *file, - vlan->numvtaps++; - vlan->numqueues++; - --out: -- rtnl_unlock(); -- return err; -+ return 0; - } - - static int macvtap_disable_queue(struct macvtap_queue *q) -@@ -454,11 +450,12 @@ static void macvtap_sock_destruct(struct sock *sk) - static int macvtap_open(struct inode *inode, struct file *file) - { - struct net *net = current->nsproxy->net_ns; -- struct net_device *dev = dev_get_by_macvtap_minor(iminor(inode)); -+ struct net_device *dev; - struct macvtap_queue *q; -- int err; -+ int err = -ENODEV; - -- err = -ENODEV; -+ rtnl_lock(); -+ dev = dev_get_by_macvtap_minor(iminor(inode)); - if (!dev) - goto out; - -@@ -498,6 +495,7 @@ out: - if (dev) - dev_put(dev); - -+ rtnl_unlock(); - return err; - } - -diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c -index 26d8c29b59de..979fe433278c 100644 ---- a/drivers/net/team/team.c -+++ b/drivers/net/team/team.c -@@ -647,7 +647,7 @@ static void team_notify_peers(struct team *team) - { - if (!team->notify_peers.count || !netif_running(team->dev)) - return; -- atomic_set(&team->notify_peers.count_pending, team->notify_peers.count); -+ atomic_add(team->notify_peers.count, &team->notify_peers.count_pending); - schedule_delayed_work(&team->notify_peers.dw, 0); - } - -@@ -687,7 +687,7 @@ static void team_mcast_rejoin(struct team *team) - { - if (!team->mcast_rejoin.count || !netif_running(team->dev)) - return; -- atomic_set(&team->mcast_rejoin.count_pending, team->mcast_rejoin.count); -+ atomic_add(team->mcast_rejoin.count, &team->mcast_rejoin.count_pending); - schedule_delayed_work(&team->mcast_rejoin.dw, 0); - } - -diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c -index 40ad25d7f28b..9b40532041cb 100644 ---- a/drivers/net/vxlan.c -+++ b/drivers/net/vxlan.c -@@ -1334,7 +1334,7 @@ static int arp_reduce(struct net_device *dev, struct sk_buff *skb) - } else if (vxlan->flags & VXLAN_F_L3MISS) { - union vxlan_addr ipa = { - .sin.sin_addr.s_addr = tip, -- .sa.sa_family = AF_INET, -+ .sin.sin_family = AF_INET, - }; - - vxlan_ip_miss(dev, &ipa); -@@ -1495,7 +1495,7 @@ static int neigh_reduce(struct net_device *dev, struct sk_buff *skb) - } else if (vxlan->flags & VXLAN_F_L3MISS) { - union vxlan_addr ipa = { - .sin6.sin6_addr = msg->target, -- .sa.sa_family = AF_INET6, -+ .sin6.sin6_family = AF_INET6, - }; - - vxlan_ip_miss(dev, &ipa); -@@ -1528,7 +1528,7 @@ static bool route_shortcircuit(struct net_device *dev, struct sk_buff *skb) - if (!n && (vxlan->flags & VXLAN_F_L3MISS)) { - union vxlan_addr ipa = { - .sin.sin_addr.s_addr = pip->daddr, -- .sa.sa_family = AF_INET, -+ .sin.sin_family = AF_INET, - }; - - vxlan_ip_miss(dev, &ipa); -@@ -1549,7 +1549,7 @@ static bool route_shortcircuit(struct net_device *dev, struct sk_buff *skb) - if (!n && (vxlan->flags & VXLAN_F_L3MISS)) { - union vxlan_addr ipa = { - .sin6.sin6_addr = pip6->daddr, -- .sa.sa_family = AF_INET6, -+ .sin6.sin6_family = AF_INET6, - }; - - vxlan_ip_miss(dev, &ipa); -diff --git a/drivers/tty/serial/8250/8250_pci.c b/drivers/tty/serial/8250/8250_pci.c -index 0ff3e3624d4c..feda34404ed0 100644 ---- a/drivers/tty/serial/8250/8250_pci.c -+++ b/drivers/tty/serial/8250/8250_pci.c -@@ -1766,6 +1766,7 @@ pci_wch_ch353_setup(struct serial_private *priv, - #define PCI_DEVICE_ID_COMMTECH_4222PCIE 0x0022 - #define PCI_DEVICE_ID_BROADCOM_TRUMANAGE 0x160a - #define PCI_DEVICE_ID_AMCC_ADDIDATA_APCI7800 0x818e -+#define PCI_DEVICE_ID_INTEL_QRK_UART 0x0936 - - #define PCI_VENDOR_ID_SUNIX 0x1fd4 - #define PCI_DEVICE_ID_SUNIX_1999 0x1999 -@@ -1876,6 +1877,13 @@ static struct pci_serial_quirk pci_serial_quirks[] __refdata = { - .subdevice = PCI_ANY_ID, - .setup = byt_serial_setup, - }, -+ { -+ .vendor = PCI_VENDOR_ID_INTEL, -+ .device = PCI_DEVICE_ID_INTEL_QRK_UART, -+ .subvendor = PCI_ANY_ID, -+ .subdevice = PCI_ANY_ID, -+ .setup = pci_default_setup, -+ }, - /* - * ITE - */ -@@ -2710,6 +2718,7 @@ enum pci_board_num_t { - pbn_ADDIDATA_PCIe_8_3906250, - pbn_ce4100_1_115200, - pbn_byt, -+ pbn_qrk, - pbn_omegapci, - pbn_NETMOS9900_2s_115200, - pbn_brcm_trumanage, -@@ -3456,6 +3465,12 @@ static struct pciserial_board pci_boards[] = { - .uart_offset = 0x80, - .reg_shift = 2, - }, -+ [pbn_qrk] = { -+ .flags = FL_BASE0, -+ .num_ports = 1, -+ .base_baud = 2764800, -+ .reg_shift = 2, -+ }, - [pbn_omegapci] = { - .flags = FL_BASE0, - .num_ports = 8, -@@ -5150,6 +5165,12 @@ static struct pci_device_id serial_pci_tbl[] = { - pbn_byt }, - - /* -+ * Intel Quark x1000 -+ */ -+ { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_QRK_UART, -+ PCI_ANY_ID, PCI_ANY_ID, 0, 0, -+ pbn_qrk }, -+ /* - * Cronyx Omega PCI - */ - { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_CRONYX_OMEGA, -diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c -index 263612ce1f62..445d62a4316a 100644 ---- a/drivers/usb/core/hub.c -+++ b/drivers/usb/core/hub.c -@@ -1948,8 +1948,10 @@ void usb_set_device_state(struct usb_device *udev, - || new_state == USB_STATE_SUSPENDED) - ; /* No change to wakeup settings */ - else if (new_state == USB_STATE_CONFIGURED) -- wakeup = udev->actconfig->desc.bmAttributes -- & USB_CONFIG_ATT_WAKEUP; -+ wakeup = (udev->quirks & -+ USB_QUIRK_IGNORE_REMOTE_WAKEUP) ? 0 : -+ udev->actconfig->desc.bmAttributes & -+ USB_CONFIG_ATT_WAKEUP; - else - wakeup = 0; - } -diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c -index 739ee8e8bdfd..5144d11d032c 100644 ---- a/drivers/usb/core/quirks.c -+++ b/drivers/usb/core/quirks.c -@@ -160,6 +160,10 @@ static const struct usb_device_id usb_interface_quirk_list[] = { - { USB_VENDOR_AND_INTERFACE_INFO(0x046d, USB_CLASS_VIDEO, 1, 0), - .driver_info = USB_QUIRK_RESET_RESUME }, - -+ /* ASUS Base Station(T100) */ -+ { USB_DEVICE(0x0b05, 0x17e0), .driver_info = -+ USB_QUIRK_IGNORE_REMOTE_WAKEUP }, -+ - { } /* terminating entry must be last */ - }; - -diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c -index 7a109eae9b9a..85f5215871de 100644 ---- a/drivers/usb/musb/musb_dsps.c -+++ b/drivers/usb/musb/musb_dsps.c -@@ -707,6 +707,7 @@ static int dsps_suspend(struct device *dev) - struct musb *musb = platform_get_drvdata(glue->musb); - void __iomem *mbase = musb->ctrl_base; - -+ del_timer_sync(&glue->timer); - glue->context.control = dsps_readl(mbase, wrp->control); - glue->context.epintr = dsps_readl(mbase, wrp->epintr_set); - glue->context.coreintr = dsps_readl(mbase, wrp->coreintr_set); -@@ -732,6 +733,7 @@ static int dsps_resume(struct device *dev) - dsps_writel(mbase, wrp->mode, glue->context.mode); - dsps_writel(mbase, wrp->tx_mode, glue->context.tx_mode); - dsps_writel(mbase, wrp->rx_mode, glue->context.rx_mode); -+ setup_timer(&glue->timer, otg_timer, (unsigned long) musb); - - return 0; - } -diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c -index 330df5ce435b..63b2af2a87c0 100644 ---- a/drivers/usb/serial/cp210x.c -+++ b/drivers/usb/serial/cp210x.c -@@ -122,6 +122,7 @@ static const struct usb_device_id id_table[] = { - { USB_DEVICE(0x10C4, 0x8665) }, /* AC-Services OBD-IF */ - { USB_DEVICE(0x10C4, 0x88A4) }, /* MMB Networks ZigBee USB Device */ - { USB_DEVICE(0x10C4, 0x88A5) }, /* Planet Innovation Ingeni ZigBee USB Device */ -+ { USB_DEVICE(0x10C4, 0x8946) }, /* Ketra N1 Wireless Interface */ - { USB_DEVICE(0x10C4, 0xEA60) }, /* Silicon Labs factory default */ - { USB_DEVICE(0x10C4, 0xEA61) }, /* Silicon Labs factory default */ - { USB_DEVICE(0x10C4, 0xEA70) }, /* Silicon Labs factory default */ -@@ -155,6 +156,7 @@ static const struct usb_device_id id_table[] = { - { USB_DEVICE(0x1ADB, 0x0001) }, /* Schweitzer Engineering C662 Cable */ - { USB_DEVICE(0x1B1C, 0x1C00) }, /* Corsair USB Dongle */ - { USB_DEVICE(0x1BE3, 0x07A6) }, /* WAGO 750-923 USB Service Cable */ -+ { USB_DEVICE(0x1D6F, 0x0010) }, /* Seluxit ApS RF Dongle */ - { USB_DEVICE(0x1E29, 0x0102) }, /* Festo CPX-USB */ - { USB_DEVICE(0x1E29, 0x0501) }, /* Festo CMSP */ - { USB_DEVICE(0x1FB9, 0x0100) }, /* Lake Shore Model 121 Current Source */ -diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h -index 72ba6f5cbc8d..2abe67bd4df8 100644 ---- a/include/linux/if_vlan.h -+++ b/include/linux/if_vlan.h -@@ -186,7 +186,6 @@ vlan_dev_get_egress_qos_mask(struct net_device *dev, u32 skprio) - } - - extern bool vlan_do_receive(struct sk_buff **skb); --extern struct sk_buff *vlan_untag(struct sk_buff *skb); - - extern int vlan_vid_add(struct net_device *dev, __be16 proto, u16 vid); - extern void vlan_vid_del(struct net_device *dev, __be16 proto, u16 vid); -@@ -228,11 +227,6 @@ static inline bool vlan_do_receive(struct sk_buff **skb) - return false; - } - --static inline struct sk_buff *vlan_untag(struct sk_buff *skb) --{ -- return skb; --} -- - static inline int vlan_vid_add(struct net_device *dev, __be16 proto, u16 vid) - { - return 0; -diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h -index 15ede6a823a6..ad8f85908a56 100644 ---- a/include/linux/skbuff.h -+++ b/include/linux/skbuff.h -@@ -2458,6 +2458,7 @@ int skb_shift(struct sk_buff *tgt, struct sk_buff *skb, int shiftlen); - void skb_scrub_packet(struct sk_buff *skb, bool xnet); - unsigned int skb_gso_transport_seglen(const struct sk_buff *skb); - struct sk_buff *skb_segment(struct sk_buff *skb, netdev_features_t features); -+struct sk_buff *skb_vlan_untag(struct sk_buff *skb); - - struct skb_checksum_ops { - __wsum (*update)(const void *mem, int len, __wsum wsum); -diff --git a/include/linux/usb/quirks.h b/include/linux/usb/quirks.h -index 52f944dfe2fd..49587dc22f5d 100644 ---- a/include/linux/usb/quirks.h -+++ b/include/linux/usb/quirks.h -@@ -30,4 +30,7 @@ - descriptor */ - #define USB_QUIRK_DELAY_INIT 0x00000040 - -+/* device generates spurious wakeup, ignore remote wakeup capability */ -+#define USB_QUIRK_IGNORE_REMOTE_WAKEUP 0x00000200 -+ - #endif /* __LINUX_USB_QUIRKS_H */ -diff --git a/include/net/dst.h b/include/net/dst.h -index 77eb53fabfb0..909032821c37 100644 ---- a/include/net/dst.h -+++ b/include/net/dst.h -@@ -466,6 +466,7 @@ void dst_init(void); - /* Flags for xfrm_lookup flags argument. */ - enum { - XFRM_LOOKUP_ICMP = 1 << 0, -+ XFRM_LOOKUP_QUEUE = 1 << 1, - }; - - struct flowi; -@@ -476,7 +477,16 @@ static inline struct dst_entry *xfrm_lookup(struct net *net, - int flags) - { - return dst_orig; --} -+} -+ -+static inline struct dst_entry *xfrm_lookup_route(struct net *net, -+ struct dst_entry *dst_orig, -+ const struct flowi *fl, -+ struct sock *sk, -+ int flags) -+{ -+ return dst_orig; -+} - - static inline struct xfrm_state *dst_xfrm(const struct dst_entry *dst) - { -@@ -488,6 +498,10 @@ struct dst_entry *xfrm_lookup(struct net *net, struct dst_entry *dst_orig, - const struct flowi *fl, struct sock *sk, - int flags); - -+struct dst_entry *xfrm_lookup_route(struct net *net, struct dst_entry *dst_orig, -+ const struct flowi *fl, struct sock *sk, -+ int flags); -+ - /* skb attached with this dst needs transformation if dst->xfrm is valid */ - static inline struct xfrm_state *dst_xfrm(const struct dst_entry *dst) - { -diff --git a/include/net/inet_connection_sock.h b/include/net/inet_connection_sock.h -index c55aeed41ace..cf9272807788 100644 ---- a/include/net/inet_connection_sock.h -+++ b/include/net/inet_connection_sock.h -@@ -62,6 +62,7 @@ struct inet_connection_sock_af_ops { - void (*addr2sockaddr)(struct sock *sk, struct sockaddr *); - int (*bind_conflict)(const struct sock *sk, - const struct inet_bind_bucket *tb, bool relax); -+ void (*mtu_reduced)(struct sock *sk); - }; - - /** inet_connection_sock - INET connection oriented sock -diff --git a/include/net/sctp/command.h b/include/net/sctp/command.h -index 4b7cd695e431..cfcbc3f627bd 100644 ---- a/include/net/sctp/command.h -+++ b/include/net/sctp/command.h -@@ -115,7 +115,7 @@ typedef enum { - * analysis of the state functions, but in reality just taken from - * thin air in the hopes othat we don't trigger a kernel panic. - */ --#define SCTP_MAX_NUM_COMMANDS 14 -+#define SCTP_MAX_NUM_COMMANDS 20 - - typedef union { - __s32 i32; -diff --git a/include/net/sock.h b/include/net/sock.h -index 2f7bc435c93d..f66b2b19a6e4 100644 ---- a/include/net/sock.h -+++ b/include/net/sock.h -@@ -969,7 +969,6 @@ struct proto { - struct sk_buff *skb); - - void (*release_cb)(struct sock *sk); -- void (*mtu_reduced)(struct sock *sk); - - /* Keeping track of sk's, looking them up, and port selection methods. */ - void (*hash)(struct sock *sk); -diff --git a/include/net/tcp.h b/include/net/tcp.h -index 743accec6c76..1f0d8479e15f 100644 ---- a/include/net/tcp.h -+++ b/include/net/tcp.h -@@ -453,6 +453,7 @@ const u8 *tcp_parse_md5sig_option(const struct tcphdr *th); - */ - - void tcp_v4_send_check(struct sock *sk, struct sk_buff *skb); -+void tcp_v4_mtu_reduced(struct sock *sk); - int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb); - struct sock *tcp_create_openreq_child(struct sock *sk, - struct request_sock *req, -@@ -720,8 +721,10 @@ struct tcp_skb_cb { - #define TCPCB_SACKED_RETRANS 0x02 /* SKB retransmitted */ - #define TCPCB_LOST 0x04 /* SKB is lost */ - #define TCPCB_TAGBITS 0x07 /* All tag bits */ -+#define TCPCB_REPAIRED 0x10 /* SKB repaired (no skb_mstamp) */ - #define TCPCB_EVER_RETRANS 0x80 /* Ever retransmitted frame */ --#define TCPCB_RETRANS (TCPCB_SACKED_RETRANS|TCPCB_EVER_RETRANS) -+#define TCPCB_RETRANS (TCPCB_SACKED_RETRANS|TCPCB_EVER_RETRANS| \ -+ TCPCB_REPAIRED) - - __u8 ip_dsfield; /* IPv4 tos or IPv6 dsfield */ - /* 1 byte hole */ -diff --git a/net/8021q/vlan_core.c b/net/8021q/vlan_core.c -index 7e57135c7cc4..5d56e05d83dd 100644 ---- a/net/8021q/vlan_core.c -+++ b/net/8021q/vlan_core.c -@@ -106,59 +106,6 @@ u16 vlan_dev_vlan_id(const struct net_device *dev) - } - EXPORT_SYMBOL(vlan_dev_vlan_id); - --static struct sk_buff *vlan_reorder_header(struct sk_buff *skb) --{ -- if (skb_cow(skb, skb_headroom(skb)) < 0) { -- kfree_skb(skb); -- return NULL; -- } -- -- memmove(skb->data - ETH_HLEN, skb->data - VLAN_ETH_HLEN, 2 * ETH_ALEN); -- skb->mac_header += VLAN_HLEN; -- return skb; --} -- --struct sk_buff *vlan_untag(struct sk_buff *skb) --{ -- struct vlan_hdr *vhdr; -- u16 vlan_tci; -- -- if (unlikely(vlan_tx_tag_present(skb))) { -- /* vlan_tci is already set-up so leave this for another time */ -- return skb; -- } -- -- skb = skb_share_check(skb, GFP_ATOMIC); -- if (unlikely(!skb)) -- goto err_free; -- -- if (unlikely(!pskb_may_pull(skb, VLAN_HLEN))) -- goto err_free; -- -- vhdr = (struct vlan_hdr *) skb->data; -- vlan_tci = ntohs(vhdr->h_vlan_TCI); -- __vlan_hwaccel_put_tag(skb, skb->protocol, vlan_tci); -- -- skb_pull_rcsum(skb, VLAN_HLEN); -- vlan_set_encap_proto(skb, vhdr); -- -- skb = vlan_reorder_header(skb); -- if (unlikely(!skb)) -- goto err_free; -- -- skb_reset_network_header(skb); -- skb_reset_transport_header(skb); -- skb_reset_mac_len(skb); -- -- return skb; -- --err_free: -- kfree_skb(skb); -- return NULL; --} --EXPORT_SYMBOL(vlan_untag); -- -- - /* - * vlan info and vid list - */ -diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h -index f2d254b69353..4acfc3eef56a 100644 ---- a/net/bridge/br_private.h -+++ b/net/bridge/br_private.h -@@ -302,6 +302,9 @@ struct br_input_skb_cb { - int igmp; - int mrouters_only; - #endif -+#ifdef CONFIG_BRIDGE_VLAN_FILTERING -+ bool vlan_filtered; -+#endif - }; - - #define BR_INPUT_SKB_CB(__skb) ((struct br_input_skb_cb *)(__skb)->cb) -diff --git a/net/bridge/br_vlan.c b/net/bridge/br_vlan.c -index b1c637208497..e1bd2539f9dc 100644 ---- a/net/bridge/br_vlan.c -+++ b/net/bridge/br_vlan.c -@@ -125,7 +125,8 @@ struct sk_buff *br_handle_vlan(struct net_bridge *br, - { - u16 vid; - -- if (!br->vlan_enabled) -+ /* If this packet was not filtered at input, let it pass */ -+ if (!BR_INPUT_SKB_CB(skb)->vlan_filtered) - goto out; - - /* Vlan filter table must be configured at this point. The -@@ -163,8 +164,10 @@ bool br_allowed_ingress(struct net_bridge *br, struct net_port_vlans *v, - /* If VLAN filtering is disabled on the bridge, all packets are - * permitted. - */ -- if (!br->vlan_enabled) -+ if (!br->vlan_enabled) { -+ BR_INPUT_SKB_CB(skb)->vlan_filtered = false; - return true; -+ } - - /* If there are no vlan in the permitted list, all packets are - * rejected. -@@ -172,6 +175,8 @@ bool br_allowed_ingress(struct net_bridge *br, struct net_port_vlans *v, - if (!v) - goto drop; - -+ BR_INPUT_SKB_CB(skb)->vlan_filtered = true; -+ - /* If vlan tx offload is disabled on bridge device and frame was - * sent from vlan device on the bridge device, it does not have - * HW accelerated vlan tag. -@@ -179,7 +184,7 @@ bool br_allowed_ingress(struct net_bridge *br, struct net_port_vlans *v, - if (unlikely(!vlan_tx_tag_present(skb) && - (skb->protocol == htons(ETH_P_8021Q) || - skb->protocol == htons(ETH_P_8021AD)))) { -- skb = vlan_untag(skb); -+ skb = skb_vlan_untag(skb); - if (unlikely(!skb)) - return false; - } -@@ -228,7 +233,8 @@ bool br_allowed_egress(struct net_bridge *br, - { - u16 vid; - -- if (!br->vlan_enabled) -+ /* If this packet was not filtered at input, let it pass */ -+ if (!BR_INPUT_SKB_CB(skb)->vlan_filtered) - return true; - - if (!v) -@@ -247,6 +253,7 @@ bool br_should_learn(struct net_bridge_port *p, struct sk_buff *skb, u16 *vid) - struct net_bridge *br = p->br; - struct net_port_vlans *v; - -+ /* If filtering was disabled at input, let it pass. */ - if (!br->vlan_enabled) - return true; - -diff --git a/net/core/dev.c b/net/core/dev.c -index 37bddf729e77..3ed11a555834 100644 ---- a/net/core/dev.c -+++ b/net/core/dev.c -@@ -3554,7 +3554,7 @@ another_round: - - if (skb->protocol == cpu_to_be16(ETH_P_8021Q) || - skb->protocol == cpu_to_be16(ETH_P_8021AD)) { -- skb = vlan_untag(skb); -+ skb = skb_vlan_untag(skb); - if (unlikely(!skb)) - goto unlock; - } -diff --git a/net/core/netpoll.c b/net/core/netpoll.c -index df9e6b1a9759..723fa7da8025 100644 ---- a/net/core/netpoll.c -+++ b/net/core/netpoll.c -@@ -788,7 +788,7 @@ int __netpoll_rx(struct sk_buff *skb, struct netpoll_info *npinfo) - } - - if (skb->protocol == cpu_to_be16(ETH_P_8021Q)) { -- skb = vlan_untag(skb); -+ skb = skb_vlan_untag(skb); - if (unlikely(!skb)) - goto out; - } -diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c -index aef1500ebc05..b0db904f083d 100644 ---- a/net/core/rtnetlink.c -+++ b/net/core/rtnetlink.c -@@ -799,7 +799,8 @@ static inline int rtnl_vfinfo_size(const struct net_device *dev, - (nla_total_size(sizeof(struct ifla_vf_mac)) + - nla_total_size(sizeof(struct ifla_vf_vlan)) + - nla_total_size(sizeof(struct ifla_vf_tx_rate)) + -- nla_total_size(sizeof(struct ifla_vf_spoofchk))); -+ nla_total_size(sizeof(struct ifla_vf_spoofchk)) + -+ nla_total_size(sizeof(struct ifla_vf_link_state))); - return size; - } else - return 0; -diff --git a/net/core/skbuff.c b/net/core/skbuff.c -index 8f6391bbf509..baf6fc457df9 100644 ---- a/net/core/skbuff.c -+++ b/net/core/skbuff.c -@@ -62,6 +62,7 @@ - #include <linux/scatterlist.h> - #include <linux/errqueue.h> - #include <linux/prefetch.h> -+#include <linux/if_vlan.h> - - #include <net/protocol.h> - #include <net/dst.h> -@@ -3139,6 +3140,9 @@ int skb_gro_receive(struct sk_buff **head, struct sk_buff *skb) - NAPI_GRO_CB(skb)->free = NAPI_GRO_FREE_STOLEN_HEAD; - goto done; - } -+ /* switch back to head shinfo */ -+ pinfo = skb_shinfo(p); -+ - if (pinfo->frag_list) - goto merge; - if (skb_gro_len(p) != pinfo->gso_size) -@@ -3963,3 +3967,55 @@ unsigned int skb_gso_transport_seglen(const struct sk_buff *skb) - return shinfo->gso_size; - } - EXPORT_SYMBOL_GPL(skb_gso_transport_seglen); -+ -+static struct sk_buff *skb_reorder_vlan_header(struct sk_buff *skb) -+{ -+ if (skb_cow(skb, skb_headroom(skb)) < 0) { -+ kfree_skb(skb); -+ return NULL; -+ } -+ -+ memmove(skb->data - ETH_HLEN, skb->data - VLAN_ETH_HLEN, 2 * ETH_ALEN); -+ skb->mac_header += VLAN_HLEN; -+ return skb; -+} -+ -+struct sk_buff *skb_vlan_untag(struct sk_buff *skb) -+{ -+ struct vlan_hdr *vhdr; -+ u16 vlan_tci; -+ -+ if (unlikely(vlan_tx_tag_present(skb))) { -+ /* vlan_tci is already set-up so leave this for another time */ -+ return skb; -+ } -+ -+ skb = skb_share_check(skb, GFP_ATOMIC); -+ if (unlikely(!skb)) -+ goto err_free; -+ -+ if (unlikely(!pskb_may_pull(skb, VLAN_HLEN))) -+ goto err_free; -+ -+ vhdr = (struct vlan_hdr *)skb->data; -+ vlan_tci = ntohs(vhdr->h_vlan_TCI); -+ __vlan_hwaccel_put_tag(skb, skb->protocol, vlan_tci); -+ -+ skb_pull_rcsum(skb, VLAN_HLEN); -+ vlan_set_encap_proto(skb, vhdr); -+ -+ skb = skb_reorder_vlan_header(skb); -+ if (unlikely(!skb)) -+ goto err_free; -+ -+ skb_reset_network_header(skb); -+ skb_reset_transport_header(skb); -+ skb_reset_mac_len(skb); -+ -+ return skb; -+ -+err_free: -+ kfree_skb(skb); -+ return NULL; -+} -+EXPORT_SYMBOL(skb_vlan_untag); -diff --git a/net/ipv4/route.c b/net/ipv4/route.c -index ca5a01ed8ed6..487bb6252520 100644 ---- a/net/ipv4/route.c -+++ b/net/ipv4/route.c -@@ -2268,9 +2268,9 @@ struct rtable *ip_route_output_flow(struct net *net, struct flowi4 *flp4, - return rt; - - if (flp4->flowi4_proto) -- rt = (struct rtable *) xfrm_lookup(net, &rt->dst, -- flowi4_to_flowi(flp4), -- sk, 0); -+ rt = (struct rtable *)xfrm_lookup_route(net, &rt->dst, -+ flowi4_to_flowi(flp4), -+ sk, 0); - - return rt; - } -diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c -index b48fba0aaa92..f7d71ec72a47 100644 ---- a/net/ipv4/tcp.c -+++ b/net/ipv4/tcp.c -@@ -1175,13 +1175,6 @@ new_segment: - goto wait_for_memory; - - /* -- * All packets are restored as if they have -- * already been sent. -- */ -- if (tp->repair) -- TCP_SKB_CB(skb)->when = tcp_time_stamp; -- -- /* - * Check whether we can use HW checksum. - */ - if (sk->sk_route_caps & NETIF_F_ALL_CSUM) -@@ -1190,6 +1183,13 @@ new_segment: - skb_entail(sk, skb); - copy = size_goal; - max = size_goal; -+ -+ /* All packets are restored as if they have -+ * already been sent. skb_mstamp isn't set to -+ * avoid wrong rtt estimation. -+ */ -+ if (tp->repair) -+ TCP_SKB_CB(skb)->sacked |= TCPCB_REPAIRED; - } - - /* Try to append data to the end of skb. */ -diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c -index 3898694d0300..22917918fa80 100644 ---- a/net/ipv4/tcp_input.c -+++ b/net/ipv4/tcp_input.c -@@ -2678,7 +2678,6 @@ static void tcp_enter_recovery(struct sock *sk, bool ece_ack) - */ - static void tcp_process_loss(struct sock *sk, int flag, bool is_dupack) - { -- struct inet_connection_sock *icsk = inet_csk(sk); - struct tcp_sock *tp = tcp_sk(sk); - bool recovered = !before(tp->snd_una, tp->high_seq); - -@@ -2704,12 +2703,9 @@ static void tcp_process_loss(struct sock *sk, int flag, bool is_dupack) - - if (recovered) { - /* F-RTO RFC5682 sec 3.1 step 2.a and 1st part of step 3.a */ -- icsk->icsk_retransmits = 0; - tcp_try_undo_recovery(sk); - return; - } -- if (flag & FLAG_DATA_ACKED) -- icsk->icsk_retransmits = 0; - if (tcp_is_reno(tp)) { - /* A Reno DUPACK means new data in F-RTO step 2.b above are - * delivered. Lower inflight to clock out (re)tranmissions. -@@ -3398,8 +3394,10 @@ static int tcp_ack(struct sock *sk, const struct sk_buff *skb, int flag) - icsk->icsk_pending == ICSK_TIME_LOSS_PROBE) - tcp_rearm_rto(sk); - -- if (after(ack, prior_snd_una)) -+ if (after(ack, prior_snd_una)) { - flag |= FLAG_SND_UNA_ADVANCED; -+ icsk->icsk_retransmits = 0; -+ } - - prior_fackets = tp->fackets_out; - prior_in_flight = tcp_packets_in_flight(tp); -diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c -index 1e4eac779f51..a782d5be132e 100644 ---- a/net/ipv4/tcp_ipv4.c -+++ b/net/ipv4/tcp_ipv4.c -@@ -269,7 +269,7 @@ EXPORT_SYMBOL(tcp_v4_connect); - * It can be called through tcp_release_cb() if socket was owned by user - * at the time tcp_v4_err() was called to handle ICMP message. - */ --static void tcp_v4_mtu_reduced(struct sock *sk) -+void tcp_v4_mtu_reduced(struct sock *sk) - { - struct dst_entry *dst; - struct inet_sock *inet = inet_sk(sk); -@@ -300,6 +300,7 @@ static void tcp_v4_mtu_reduced(struct sock *sk) - tcp_simple_retransmit(sk); - } /* else let the usual retransmit timer handle it */ - } -+EXPORT_SYMBOL(tcp_v4_mtu_reduced); - - static void do_redirect(struct sk_buff *skb, struct sock *sk) - { -@@ -2117,6 +2118,7 @@ const struct inet_connection_sock_af_ops ipv4_specific = { - .compat_setsockopt = compat_ip_setsockopt, - .compat_getsockopt = compat_ip_getsockopt, - #endif -+ .mtu_reduced = tcp_v4_mtu_reduced, - }; - EXPORT_SYMBOL(ipv4_specific); - -@@ -2736,7 +2738,6 @@ struct proto tcp_prot = { - .sendpage = tcp_sendpage, - .backlog_rcv = tcp_v4_do_rcv, - .release_cb = tcp_release_cb, -- .mtu_reduced = tcp_v4_mtu_reduced, - .hash = inet_hash, - .unhash = inet_unhash, - .get_port = inet_csk_get_port, -diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c -index b3d1addd816b..91b98e5a17aa 100644 ---- a/net/ipv4/tcp_output.c -+++ b/net/ipv4/tcp_output.c -@@ -787,7 +787,7 @@ void tcp_release_cb(struct sock *sk) - __sock_put(sk); - } - if (flags & (1UL << TCP_MTU_REDUCED_DEFERRED)) { -- sk->sk_prot->mtu_reduced(sk); -+ inet_csk(sk)->icsk_af_ops->mtu_reduced(sk); - __sock_put(sk); - } - } -@@ -1876,8 +1876,11 @@ static bool tcp_write_xmit(struct sock *sk, unsigned int mss_now, int nonagle, - tso_segs = tcp_init_tso_segs(sk, skb, mss_now); - BUG_ON(!tso_segs); - -- if (unlikely(tp->repair) && tp->repair_queue == TCP_SEND_QUEUE) -+ if (unlikely(tp->repair) && tp->repair_queue == TCP_SEND_QUEUE) { -+ /* "when" is used as a start point for the retransmit timer */ -+ TCP_SKB_CB(skb)->when = tcp_time_stamp; - goto repair; /* Skip network transmission */ -+ } - - cwnd_quota = tcp_cwnd_test(tp, skb); - if (!cwnd_quota) { -@@ -2066,9 +2069,7 @@ void tcp_send_loss_probe(struct sock *sk) - if (WARN_ON(!skb || !tcp_skb_pcount(skb))) - goto rearm_timer; - -- /* Probe with zero data doesn't trigger fast recovery. */ -- if (skb->len > 0) -- err = __tcp_retransmit_skb(sk, skb); -+ err = __tcp_retransmit_skb(sk, skb); - - /* Record snd_nxt for loss detection. */ - if (likely(!err)) -diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c -index 6c7fa0853fc7..3f0ec063d7f8 100644 ---- a/net/ipv6/addrconf.c -+++ b/net/ipv6/addrconf.c -@@ -1684,14 +1684,12 @@ void addrconf_dad_failure(struct inet6_ifaddr *ifp) - addrconf_mod_dad_work(ifp, 0); - } - --/* Join to solicited addr multicast group. */ -- -+/* Join to solicited addr multicast group. -+ * caller must hold RTNL */ - void addrconf_join_solict(struct net_device *dev, const struct in6_addr *addr) - { - struct in6_addr maddr; - -- ASSERT_RTNL(); -- - if (dev->flags&(IFF_LOOPBACK|IFF_NOARP)) - return; - -@@ -1699,12 +1697,11 @@ void addrconf_join_solict(struct net_device *dev, const struct in6_addr *addr) - ipv6_dev_mc_inc(dev, &maddr); - } - -+/* caller must hold RTNL */ - void addrconf_leave_solict(struct inet6_dev *idev, const struct in6_addr *addr) - { - struct in6_addr maddr; - -- ASSERT_RTNL(); -- - if (idev->dev->flags&(IFF_LOOPBACK|IFF_NOARP)) - return; - -@@ -1712,12 +1709,11 @@ void addrconf_leave_solict(struct inet6_dev *idev, const struct in6_addr *addr) - __ipv6_dev_mc_dec(idev, &maddr); - } - -+/* caller must hold RTNL */ - static void addrconf_join_anycast(struct inet6_ifaddr *ifp) - { - struct in6_addr addr; - -- ASSERT_RTNL(); -- - if (ifp->prefix_len >= 127) /* RFC 6164 */ - return; - ipv6_addr_prefix(&addr, &ifp->addr, ifp->prefix_len); -@@ -1726,12 +1722,11 @@ static void addrconf_join_anycast(struct inet6_ifaddr *ifp) - ipv6_dev_ac_inc(ifp->idev->dev, &addr); - } - -+/* caller must hold RTNL */ - static void addrconf_leave_anycast(struct inet6_ifaddr *ifp) - { - struct in6_addr addr; - -- ASSERT_RTNL(); -- - if (ifp->prefix_len >= 127) /* RFC 6164 */ - return; - ipv6_addr_prefix(&addr, &ifp->addr, ifp->prefix_len); -diff --git a/net/ipv6/anycast.c b/net/ipv6/anycast.c -index 210183244689..ff2de7d9d8e6 100644 ---- a/net/ipv6/anycast.c -+++ b/net/ipv6/anycast.c -@@ -77,6 +77,7 @@ int ipv6_sock_ac_join(struct sock *sk, int ifindex, const struct in6_addr *addr) - pac->acl_next = NULL; - pac->acl_addr = *addr; - -+ rtnl_lock(); - rcu_read_lock(); - if (ifindex == 0) { - struct rt6_info *rt; -@@ -137,6 +138,7 @@ int ipv6_sock_ac_join(struct sock *sk, int ifindex, const struct in6_addr *addr) - - error: - rcu_read_unlock(); -+ rtnl_unlock(); - if (pac) - sock_kfree_s(sk, pac, sizeof(*pac)); - return err; -@@ -171,11 +173,13 @@ int ipv6_sock_ac_drop(struct sock *sk, int ifindex, const struct in6_addr *addr) - - spin_unlock_bh(&ipv6_sk_ac_lock); - -+ rtnl_lock(); - rcu_read_lock(); - dev = dev_get_by_index_rcu(net, pac->acl_ifindex); - if (dev) - ipv6_dev_ac_dec(dev, &pac->acl_addr); - rcu_read_unlock(); -+ rtnl_unlock(); - - sock_kfree_s(sk, pac, sizeof(*pac)); - return 0; -@@ -198,6 +202,7 @@ void ipv6_sock_ac_close(struct sock *sk) - spin_unlock_bh(&ipv6_sk_ac_lock); - - prev_index = 0; -+ rtnl_lock(); - rcu_read_lock(); - while (pac) { - struct ipv6_ac_socklist *next = pac->acl_next; -@@ -212,6 +217,7 @@ void ipv6_sock_ac_close(struct sock *sk) - pac = next; - } - rcu_read_unlock(); -+ rtnl_unlock(); - } - - static void aca_put(struct ifacaddr6 *ac) -@@ -233,6 +239,8 @@ int ipv6_dev_ac_inc(struct net_device *dev, const struct in6_addr *addr) - struct rt6_info *rt; - int err; - -+ ASSERT_RTNL(); -+ - idev = in6_dev_get(dev); - - if (idev == NULL) -@@ -302,6 +310,8 @@ int __ipv6_dev_ac_dec(struct inet6_dev *idev, const struct in6_addr *addr) - { - struct ifacaddr6 *aca, *prev_aca; - -+ ASSERT_RTNL(); -+ - write_lock_bh(&idev->lock); - prev_aca = NULL; - for (aca = idev->ac_list; aca; aca = aca->aca_next) { -diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c -index 2465d18e8a26..cb57aa862177 100644 ---- a/net/ipv6/ip6_gre.c -+++ b/net/ipv6/ip6_gre.c -@@ -787,7 +787,7 @@ static inline int ip6gre_xmit_ipv4(struct sk_buff *skb, struct net_device *dev) - encap_limit = t->parms.encap_limit; - - memcpy(&fl6, &t->fl.u.ip6, sizeof(fl6)); -- fl6.flowi6_proto = IPPROTO_IPIP; -+ fl6.flowi6_proto = IPPROTO_GRE; - - dsfield = ipv4_get_dsfield(iph); - -@@ -837,7 +837,7 @@ static inline int ip6gre_xmit_ipv6(struct sk_buff *skb, struct net_device *dev) - encap_limit = t->parms.encap_limit; - - memcpy(&fl6, &t->fl.u.ip6, sizeof(fl6)); -- fl6.flowi6_proto = IPPROTO_IPV6; -+ fl6.flowi6_proto = IPPROTO_GRE; - - dsfield = ipv6_get_dsfield(ipv6h); - if (t->parms.flags & IP6_TNL_F_USE_ORIG_TCLASS) -diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c -index 073e5a6fc631..12f7ef0f243a 100644 ---- a/net/ipv6/ip6_output.c -+++ b/net/ipv6/ip6_output.c -@@ -1008,7 +1008,7 @@ struct dst_entry *ip6_dst_lookup_flow(struct sock *sk, struct flowi6 *fl6, - if (final_dst) - fl6->daddr = *final_dst; - -- return xfrm_lookup(sock_net(sk), dst, flowi6_to_flowi(fl6), sk, 0); -+ return xfrm_lookup_route(sock_net(sk), dst, flowi6_to_flowi(fl6), sk, 0); - } - EXPORT_SYMBOL_GPL(ip6_dst_lookup_flow); - -@@ -1040,7 +1040,7 @@ struct dst_entry *ip6_sk_dst_lookup_flow(struct sock *sk, struct flowi6 *fl6, - if (final_dst) - fl6->daddr = *final_dst; - -- return xfrm_lookup(sock_net(sk), dst, flowi6_to_flowi(fl6), sk, 0); -+ return xfrm_lookup_route(sock_net(sk), dst, flowi6_to_flowi(fl6), sk, 0); - } - EXPORT_SYMBOL_GPL(ip6_sk_dst_lookup_flow); - -diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c -index 08b367c6b9cf..761e4586ab5f 100644 ---- a/net/ipv6/mcast.c -+++ b/net/ipv6/mcast.c -@@ -172,6 +172,7 @@ int ipv6_sock_mc_join(struct sock *sk, int ifindex, const struct in6_addr *addr) - mc_lst->next = NULL; - mc_lst->addr = *addr; - -+ rtnl_lock(); - rcu_read_lock(); - if (ifindex == 0) { - struct rt6_info *rt; -@@ -185,6 +186,7 @@ int ipv6_sock_mc_join(struct sock *sk, int ifindex, const struct in6_addr *addr) - - if (dev == NULL) { - rcu_read_unlock(); -+ rtnl_unlock(); - sock_kfree_s(sk, mc_lst, sizeof(*mc_lst)); - return -ENODEV; - } -@@ -202,6 +204,7 @@ int ipv6_sock_mc_join(struct sock *sk, int ifindex, const struct in6_addr *addr) - - if (err) { - rcu_read_unlock(); -+ rtnl_unlock(); - sock_kfree_s(sk, mc_lst, sizeof(*mc_lst)); - return err; - } -@@ -212,6 +215,7 @@ int ipv6_sock_mc_join(struct sock *sk, int ifindex, const struct in6_addr *addr) - spin_unlock(&ipv6_sk_mc_lock); - - rcu_read_unlock(); -+ rtnl_unlock(); - - return 0; - } -@@ -229,6 +233,7 @@ int ipv6_sock_mc_drop(struct sock *sk, int ifindex, const struct in6_addr *addr) - if (!ipv6_addr_is_multicast(addr)) - return -EINVAL; - -+ rtnl_lock(); - spin_lock(&ipv6_sk_mc_lock); - for (lnk = &np->ipv6_mc_list; - (mc_lst = rcu_dereference_protected(*lnk, -@@ -252,12 +257,15 @@ int ipv6_sock_mc_drop(struct sock *sk, int ifindex, const struct in6_addr *addr) - } else - (void) ip6_mc_leave_src(sk, mc_lst, NULL); - rcu_read_unlock(); -+ rtnl_unlock(); -+ - atomic_sub(sizeof(*mc_lst), &sk->sk_omem_alloc); - kfree_rcu(mc_lst, rcu); - return 0; - } - } - spin_unlock(&ipv6_sk_mc_lock); -+ rtnl_unlock(); - - return -EADDRNOTAVAIL; - } -@@ -302,6 +310,7 @@ void ipv6_sock_mc_close(struct sock *sk) - if (!rcu_access_pointer(np->ipv6_mc_list)) - return; - -+ rtnl_lock(); - spin_lock(&ipv6_sk_mc_lock); - while ((mc_lst = rcu_dereference_protected(np->ipv6_mc_list, - lockdep_is_held(&ipv6_sk_mc_lock))) != NULL) { -@@ -328,6 +337,7 @@ void ipv6_sock_mc_close(struct sock *sk) - spin_lock(&ipv6_sk_mc_lock); - } - spin_unlock(&ipv6_sk_mc_lock); -+ rtnl_unlock(); - } - - int ip6_mc_source(int add, int omode, struct sock *sk, -@@ -845,6 +855,8 @@ int ipv6_dev_mc_inc(struct net_device *dev, const struct in6_addr *addr) - struct ifmcaddr6 *mc; - struct inet6_dev *idev; - -+ ASSERT_RTNL(); -+ - /* we need to take a reference on idev */ - idev = in6_dev_get(dev); - -@@ -916,6 +928,8 @@ int __ipv6_dev_mc_dec(struct inet6_dev *idev, const struct in6_addr *addr) - { - struct ifmcaddr6 *ma, **map; - -+ ASSERT_RTNL(); -+ - write_lock_bh(&idev->lock); - for (map = &idev->mc_list; (ma=*map) != NULL; map = &ma->next) { - if (ipv6_addr_equal(&ma->mca_addr, addr)) { -diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c -index fe548ba72687..b12b11b123ff 100644 ---- a/net/ipv6/sit.c -+++ b/net/ipv6/sit.c -@@ -101,19 +101,19 @@ static struct ip_tunnel *ipip6_tunnel_lookup(struct net *net, - for_each_ip_tunnel_rcu(t, sitn->tunnels_r_l[h0 ^ h1]) { - if (local == t->parms.iph.saddr && - remote == t->parms.iph.daddr && -- (!dev || !t->parms.link || dev->iflink == t->parms.link) && -+ (!dev || !t->parms.link || dev->ifindex == t->parms.link) && - (t->dev->flags & IFF_UP)) - return t; - } - for_each_ip_tunnel_rcu(t, sitn->tunnels_r[h0]) { - if (remote == t->parms.iph.daddr && -- (!dev || !t->parms.link || dev->iflink == t->parms.link) && -+ (!dev || !t->parms.link || dev->ifindex == t->parms.link) && - (t->dev->flags & IFF_UP)) - return t; - } - for_each_ip_tunnel_rcu(t, sitn->tunnels_l[h1]) { - if (local == t->parms.iph.saddr && -- (!dev || !t->parms.link || dev->iflink == t->parms.link) && -+ (!dev || !t->parms.link || dev->ifindex == t->parms.link) && - (t->dev->flags & IFF_UP)) - return t; - } -diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c -index 889079b2ea85..a4f890dd223a 100644 ---- a/net/ipv6/tcp_ipv6.c -+++ b/net/ipv6/tcp_ipv6.c -@@ -1668,6 +1668,7 @@ static const struct inet_connection_sock_af_ops ipv6_specific = { - .compat_setsockopt = compat_ipv6_setsockopt, - .compat_getsockopt = compat_ipv6_getsockopt, - #endif -+ .mtu_reduced = tcp_v6_mtu_reduced, - }; - - #ifdef CONFIG_TCP_MD5SIG -@@ -1699,6 +1700,7 @@ static const struct inet_connection_sock_af_ops ipv6_mapped = { - .compat_setsockopt = compat_ipv6_setsockopt, - .compat_getsockopt = compat_ipv6_getsockopt, - #endif -+ .mtu_reduced = tcp_v4_mtu_reduced, - }; - - #ifdef CONFIG_TCP_MD5SIG -@@ -1935,7 +1937,6 @@ struct proto tcpv6_prot = { - .sendpage = tcp_sendpage, - .backlog_rcv = tcp_v6_do_rcv, - .release_cb = tcp_release_cb, -- .mtu_reduced = tcp_v6_mtu_reduced, - .hash = tcp_v6_hash, - .unhash = inet_unhash, - .get_port = inet_csk_get_port, -diff --git a/net/l2tp/l2tp_ppp.c b/net/l2tp/l2tp_ppp.c -index 1e05bbde47ba..da8d067d6107 100644 ---- a/net/l2tp/l2tp_ppp.c -+++ b/net/l2tp/l2tp_ppp.c -@@ -758,7 +758,8 @@ static int pppol2tp_connect(struct socket *sock, struct sockaddr *uservaddr, - /* If PMTU discovery was enabled, use the MTU that was discovered */ - dst = sk_dst_get(tunnel->sock); - if (dst != NULL) { -- u32 pmtu = dst_mtu(__sk_dst_get(tunnel->sock)); -+ u32 pmtu = dst_mtu(dst); -+ - if (pmtu != 0) - session->mtu = session->mru = pmtu - - PPPOL2TP_HEADER_OVERHEAD; -diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c -index 0dfe894afd48..c375d731587f 100644 ---- a/net/netlink/af_netlink.c -+++ b/net/netlink/af_netlink.c -@@ -205,7 +205,7 @@ static int __netlink_deliver_tap_skb(struct sk_buff *skb, - nskb->protocol = htons((u16) sk->sk_protocol); - nskb->pkt_type = netlink_is_kernel(sk) ? - PACKET_KERNEL : PACKET_USER; -- -+ skb_reset_network_header(nskb); - ret = dev_queue_xmit(nskb); - if (unlikely(ret > 0)) - ret = net_xmit_errno(ret); -diff --git a/net/openvswitch/actions.c b/net/openvswitch/actions.c -index 2c77e7b1a913..600c7646b3d3 100644 ---- a/net/openvswitch/actions.c -+++ b/net/openvswitch/actions.c -@@ -42,6 +42,9 @@ static int do_execute_actions(struct datapath *dp, struct sk_buff *skb, - - static int make_writable(struct sk_buff *skb, int write_len) - { -+ if (!pskb_may_pull(skb, write_len)) -+ return -ENOMEM; -+ - if (!skb_cloned(skb) || skb_clone_writable(skb, write_len)) - return 0; - -@@ -70,6 +73,8 @@ static int __pop_vlan_tci(struct sk_buff *skb, __be16 *current_tci) - - vlan_set_encap_proto(skb, vhdr); - skb->mac_header += VLAN_HLEN; -+ if (skb_network_offset(skb) < ETH_HLEN) -+ skb_set_network_header(skb, ETH_HLEN); - skb_reset_mac_len(skb); - - return 0; -diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c -index 48a6a93db296..48b181797d7b 100644 ---- a/net/packet/af_packet.c -+++ b/net/packet/af_packet.c -@@ -635,6 +635,7 @@ static void init_prb_bdqc(struct packet_sock *po, - p1->tov_in_jiffies = msecs_to_jiffies(p1->retire_blk_tov); - p1->blk_sizeof_priv = req_u->req3.tp_sizeof_priv; - -+ p1->max_frame_len = p1->kblk_size - BLK_PLUS_PRIV(p1->blk_sizeof_priv); - prb_init_ft_ops(p1, req_u); - prb_setup_retire_blk_timer(po, tx_ring); - prb_open_block(p1, pbd); -@@ -1946,6 +1947,18 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev, - if ((int)snaplen < 0) - snaplen = 0; - } -+ } else if (unlikely(macoff + snaplen > -+ GET_PBDQC_FROM_RB(&po->rx_ring)->max_frame_len)) { -+ u32 nval; -+ -+ nval = GET_PBDQC_FROM_RB(&po->rx_ring)->max_frame_len - macoff; -+ pr_err_once("tpacket_rcv: packet too big, clamped from %u to %u. macoff=%u\n", -+ snaplen, nval, macoff); -+ snaplen = nval; -+ if (unlikely((int)snaplen < 0)) { -+ snaplen = 0; -+ macoff = GET_PBDQC_FROM_RB(&po->rx_ring)->max_frame_len; -+ } - } - spin_lock(&sk->sk_receive_queue.lock); - h.raw = packet_current_rx_frame(po, skb, -@@ -3779,6 +3792,10 @@ static int packet_set_ring(struct sock *sk, union tpacket_req_u *req_u, - goto out; - if (unlikely(req->tp_block_size & (PAGE_SIZE - 1))) - goto out; -+ if (po->tp_version >= TPACKET_V3 && -+ (int)(req->tp_block_size - -+ BLK_PLUS_PRIV(req_u->req3.tp_sizeof_priv)) <= 0) -+ goto out; - if (unlikely(req->tp_frame_size < po->tp_hdrlen + - po->tp_reserve)) - goto out; -diff --git a/net/packet/internal.h b/net/packet/internal.h -index eb9580a6b25f..cdddf6a30399 100644 ---- a/net/packet/internal.h -+++ b/net/packet/internal.h -@@ -29,6 +29,7 @@ struct tpacket_kbdq_core { - char *pkblk_start; - char *pkblk_end; - int kblk_size; -+ unsigned int max_frame_len; - unsigned int knum_blocks; - uint64_t knxt_seq_num; - char *prev; -diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c -index 5170a1ff95a1..7194fe8589b0 100644 ---- a/net/sctp/sm_statefuns.c -+++ b/net/sctp/sm_statefuns.c -@@ -1775,9 +1775,22 @@ static sctp_disposition_t sctp_sf_do_dupcook_a(struct net *net, - /* Update the content of current association. */ - sctp_add_cmd_sf(commands, SCTP_CMD_UPDATE_ASSOC, SCTP_ASOC(new_asoc)); - sctp_add_cmd_sf(commands, SCTP_CMD_EVENT_ULP, SCTP_ULPEVENT(ev)); -- sctp_add_cmd_sf(commands, SCTP_CMD_NEW_STATE, -- SCTP_STATE(SCTP_STATE_ESTABLISHED)); -- sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(repl)); -+ if (sctp_state(asoc, SHUTDOWN_PENDING) && -+ (sctp_sstate(asoc->base.sk, CLOSING) || -+ sock_flag(asoc->base.sk, SOCK_DEAD))) { -+ /* if were currently in SHUTDOWN_PENDING, but the socket -+ * has been closed by user, don't transition to ESTABLISHED. -+ * Instead trigger SHUTDOWN bundled with COOKIE_ACK. -+ */ -+ sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(repl)); -+ return sctp_sf_do_9_2_start_shutdown(net, ep, asoc, -+ SCTP_ST_CHUNK(0), NULL, -+ commands); -+ } else { -+ sctp_add_cmd_sf(commands, SCTP_CMD_NEW_STATE, -+ SCTP_STATE(SCTP_STATE_ESTABLISHED)); -+ sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(repl)); -+ } - return SCTP_DISPOSITION_CONSUME; - - nomem_ev: -diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c -index 1d5c7bf29938..59cf325f2772 100644 ---- a/net/xfrm/xfrm_policy.c -+++ b/net/xfrm/xfrm_policy.c -@@ -41,6 +41,11 @@ - - static struct dst_entry *xfrm_policy_sk_bundles; - -+struct xfrm_flo { -+ struct dst_entry *dst_orig; -+ u8 flags; -+}; -+ - static DEFINE_SPINLOCK(xfrm_policy_afinfo_lock); - static struct xfrm_policy_afinfo __rcu *xfrm_policy_afinfo[NPROTO] - __read_mostly; -@@ -1889,13 +1894,14 @@ static int xdst_queue_output(struct sk_buff *skb) - } - - static struct xfrm_dst *xfrm_create_dummy_bundle(struct net *net, -- struct dst_entry *dst, -+ struct xfrm_flo *xflo, - const struct flowi *fl, - int num_xfrms, - u16 family) - { - int err; - struct net_device *dev; -+ struct dst_entry *dst; - struct dst_entry *dst1; - struct xfrm_dst *xdst; - -@@ -1903,9 +1909,12 @@ static struct xfrm_dst *xfrm_create_dummy_bundle(struct net *net, - if (IS_ERR(xdst)) - return xdst; - -- if (net->xfrm.sysctl_larval_drop || num_xfrms <= 0) -+ if (!(xflo->flags & XFRM_LOOKUP_QUEUE) || -+ net->xfrm.sysctl_larval_drop || -+ num_xfrms <= 0) - return xdst; - -+ dst = xflo->dst_orig; - dst1 = &xdst->u.dst; - dst_hold(dst); - xdst->route = dst; -@@ -1947,7 +1956,7 @@ static struct flow_cache_object * - xfrm_bundle_lookup(struct net *net, const struct flowi *fl, u16 family, u8 dir, - struct flow_cache_object *oldflo, void *ctx) - { -- struct dst_entry *dst_orig = (struct dst_entry *)ctx; -+ struct xfrm_flo *xflo = (struct xfrm_flo *)ctx; - struct xfrm_policy *pols[XFRM_POLICY_TYPE_MAX]; - struct xfrm_dst *xdst, *new_xdst; - int num_pols = 0, num_xfrms = 0, i, err, pol_dead; -@@ -1988,7 +1997,8 @@ xfrm_bundle_lookup(struct net *net, const struct flowi *fl, u16 family, u8 dir, - goto make_dummy_bundle; - } - -- new_xdst = xfrm_resolve_and_create_bundle(pols, num_pols, fl, family, dst_orig); -+ new_xdst = xfrm_resolve_and_create_bundle(pols, num_pols, fl, family, -+ xflo->dst_orig); - if (IS_ERR(new_xdst)) { - err = PTR_ERR(new_xdst); - if (err != -EAGAIN) -@@ -2022,7 +2032,7 @@ make_dummy_bundle: - /* We found policies, but there's no bundles to instantiate: - * either because the policy blocks, has no transformations or - * we could not build template (no xfrm_states).*/ -- xdst = xfrm_create_dummy_bundle(net, dst_orig, fl, num_xfrms, family); -+ xdst = xfrm_create_dummy_bundle(net, xflo, fl, num_xfrms, family); - if (IS_ERR(xdst)) { - xfrm_pols_put(pols, num_pols); - return ERR_CAST(xdst); -@@ -2121,13 +2131,18 @@ struct dst_entry *xfrm_lookup(struct net *net, struct dst_entry *dst_orig, - } - - if (xdst == NULL) { -+ struct xfrm_flo xflo; -+ -+ xflo.dst_orig = dst_orig; -+ xflo.flags = flags; -+ - /* To accelerate a bit... */ - if ((dst_orig->flags & DST_NOXFRM) || - !net->xfrm.policy_count[XFRM_POLICY_OUT]) - goto nopol; - - flo = flow_cache_lookup(net, fl, family, dir, -- xfrm_bundle_lookup, dst_orig); -+ xfrm_bundle_lookup, &xflo); - if (flo == NULL) - goto nopol; - if (IS_ERR(flo)) { -@@ -2155,7 +2170,7 @@ struct dst_entry *xfrm_lookup(struct net *net, struct dst_entry *dst_orig, - xfrm_pols_put(pols, drop_pols); - XFRM_INC_STATS(net, LINUX_MIB_XFRMOUTNOSTATES); - -- return make_blackhole(net, family, dst_orig); -+ return ERR_PTR(-EREMOTE); - } - - err = -EAGAIN; -@@ -2212,6 +2227,23 @@ dropdst: - } - EXPORT_SYMBOL(xfrm_lookup); - -+/* Callers of xfrm_lookup_route() must ensure a call to dst_output(). -+ * Otherwise we may send out blackholed packets. -+ */ -+struct dst_entry *xfrm_lookup_route(struct net *net, struct dst_entry *dst_orig, -+ const struct flowi *fl, -+ struct sock *sk, int flags) -+{ -+ struct dst_entry *dst = xfrm_lookup(net, dst_orig, fl, sk, -+ flags | XFRM_LOOKUP_QUEUE); -+ -+ if (IS_ERR(dst) && PTR_ERR(dst) == -EREMOTE) -+ return make_blackhole(net, dst_orig->ops->family, dst_orig); -+ -+ return dst; -+} -+EXPORT_SYMBOL(xfrm_lookup_route); -+ - static inline int - xfrm_secpath_reject(int idx, struct sk_buff *skb, const struct flowi *fl) - { -@@ -2477,7 +2509,7 @@ int __xfrm_route_forward(struct sk_buff *skb, unsigned short family) - - skb_dst_force(skb); - -- dst = xfrm_lookup(net, skb_dst(skb), &fl, NULL, 0); -+ dst = xfrm_lookup(net, skb_dst(skb), &fl, NULL, XFRM_LOOKUP_QUEUE); - if (IS_ERR(dst)) { - res = 0; - dst = NULL; diff --git a/projects/imx6/patches/linux/linux-000-patch-3.14.22-23.patch b/projects/imx6/patches/linux/linux-000-patch-3.14.22-23.patch deleted file mode 100644 index 62db8b47c1b..00000000000 --- a/projects/imx6/patches/linux/linux-000-patch-3.14.22-23.patch +++ /dev/null @@ -1,5877 +0,0 @@ -diff --git a/Documentation/lzo.txt b/Documentation/lzo.txt -new file mode 100644 -index 000000000000..ea45dd3901e3 ---- /dev/null -+++ b/Documentation/lzo.txt -@@ -0,0 +1,164 @@ -+ -+LZO stream format as understood by Linux's LZO decompressor -+=========================================================== -+ -+Introduction -+ -+ This is not a specification. No specification seems to be publicly available -+ for the LZO stream format. This document describes what input format the LZO -+ decompressor as implemented in the Linux kernel understands. The file subject -+ of this analysis is lib/lzo/lzo1x_decompress_safe.c. No analysis was made on -+ the compressor nor on any other implementations though it seems likely that -+ the format matches the standard one. The purpose of this document is to -+ better understand what the code does in order to propose more efficient fixes -+ for future bug reports. -+ -+Description -+ -+ The stream is composed of a series of instructions, operands, and data. The -+ instructions consist in a few bits representing an opcode, and bits forming -+ the operands for the instruction, whose size and position depend on the -+ opcode and on the number of literals copied by previous instruction. The -+ operands are used to indicate : -+ -+ - a distance when copying data from the dictionary (past output buffer) -+ - a length (number of bytes to copy from dictionary) -+ - the number of literals to copy, which is retained in variable "state" -+ as a piece of information for next instructions. -+ -+ Optionally depending on the opcode and operands, extra data may follow. These -+ extra data can be a complement for the operand (eg: a length or a distance -+ encoded on larger values), or a literal to be copied to the output buffer. -+ -+ The first byte of the block follows a different encoding from other bytes, it -+ seems to be optimized for literal use only, since there is no dictionary yet -+ prior to that byte. -+ -+ Lengths are always encoded on a variable size starting with a small number -+ of bits in the operand. If the number of bits isn't enough to represent the -+ length, up to 255 may be added in increments by consuming more bytes with a -+ rate of at most 255 per extra byte (thus the compression ratio cannot exceed -+ around 255:1). The variable length encoding using #bits is always the same : -+ -+ length = byte & ((1 << #bits) - 1) -+ if (!length) { -+ length = ((1 << #bits) - 1) -+ length += 255*(number of zero bytes) -+ length += first-non-zero-byte -+ } -+ length += constant (generally 2 or 3) -+ -+ For references to the dictionary, distances are relative to the output -+ pointer. Distances are encoded using very few bits belonging to certain -+ ranges, resulting in multiple copy instructions using different encodings. -+ Certain encodings involve one extra byte, others involve two extra bytes -+ forming a little-endian 16-bit quantity (marked LE16 below). -+ -+ After any instruction except the large literal copy, 0, 1, 2 or 3 literals -+ are copied before starting the next instruction. The number of literals that -+ were copied may change the meaning and behaviour of the next instruction. In -+ practice, only one instruction needs to know whether 0, less than 4, or more -+ literals were copied. This is the information stored in the <state> variable -+ in this implementation. This number of immediate literals to be copied is -+ generally encoded in the last two bits of the instruction but may also be -+ taken from the last two bits of an extra operand (eg: distance). -+ -+ End of stream is declared when a block copy of distance 0 is seen. Only one -+ instruction may encode this distance (0001HLLL), it takes one LE16 operand -+ for the distance, thus requiring 3 bytes. -+ -+ IMPORTANT NOTE : in the code some length checks are missing because certain -+ instructions are called under the assumption that a certain number of bytes -+ follow because it has already been garanteed before parsing the instructions. -+ They just have to "refill" this credit if they consume extra bytes. This is -+ an implementation design choice independant on the algorithm or encoding. -+ -+Byte sequences -+ -+ First byte encoding : -+ -+ 0..17 : follow regular instruction encoding, see below. It is worth -+ noting that codes 16 and 17 will represent a block copy from -+ the dictionary which is empty, and that they will always be -+ invalid at this place. -+ -+ 18..21 : copy 0..3 literals -+ state = (byte - 17) = 0..3 [ copy <state> literals ] -+ skip byte -+ -+ 22..255 : copy literal string -+ length = (byte - 17) = 4..238 -+ state = 4 [ don't copy extra literals ] -+ skip byte -+ -+ Instruction encoding : -+ -+ 0 0 0 0 X X X X (0..15) -+ Depends on the number of literals copied by the last instruction. -+ If last instruction did not copy any literal (state == 0), this -+ encoding will be a copy of 4 or more literal, and must be interpreted -+ like this : -+ -+ 0 0 0 0 L L L L (0..15) : copy long literal string -+ length = 3 + (L ?: 15 + (zero_bytes * 255) + non_zero_byte) -+ state = 4 (no extra literals are copied) -+ -+ If last instruction used to copy between 1 to 3 literals (encoded in -+ the instruction's opcode or distance), the instruction is a copy of a -+ 2-byte block from the dictionary within a 1kB distance. It is worth -+ noting that this instruction provides little savings since it uses 2 -+ bytes to encode a copy of 2 other bytes but it encodes the number of -+ following literals for free. It must be interpreted like this : -+ -+ 0 0 0 0 D D S S (0..15) : copy 2 bytes from <= 1kB distance -+ length = 2 -+ state = S (copy S literals after this block) -+ Always followed by exactly one byte : H H H H H H H H -+ distance = (H << 2) + D + 1 -+ -+ If last instruction used to copy 4 or more literals (as detected by -+ state == 4), the instruction becomes a copy of a 3-byte block from the -+ dictionary from a 2..3kB distance, and must be interpreted like this : -+ -+ 0 0 0 0 D D S S (0..15) : copy 3 bytes from 2..3 kB distance -+ length = 3 -+ state = S (copy S literals after this block) -+ Always followed by exactly one byte : H H H H H H H H -+ distance = (H << 2) + D + 2049 -+ -+ 0 0 0 1 H L L L (16..31) -+ Copy of a block within 16..48kB distance (preferably less than 10B) -+ length = 2 + (L ?: 7 + (zero_bytes * 255) + non_zero_byte) -+ Always followed by exactly one LE16 : D D D D D D D D : D D D D D D S S -+ distance = 16384 + (H << 14) + D -+ state = S (copy S literals after this block) -+ End of stream is reached if distance == 16384 -+ -+ 0 0 1 L L L L L (32..63) -+ Copy of small block within 16kB distance (preferably less than 34B) -+ length = 2 + (L ?: 31 + (zero_bytes * 255) + non_zero_byte) -+ Always followed by exactly one LE16 : D D D D D D D D : D D D D D D S S -+ distance = D + 1 -+ state = S (copy S literals after this block) -+ -+ 0 1 L D D D S S (64..127) -+ Copy 3-4 bytes from block within 2kB distance -+ state = S (copy S literals after this block) -+ length = 3 + L -+ Always followed by exactly one byte : H H H H H H H H -+ distance = (H << 3) + D + 1 -+ -+ 1 L L D D D S S (128..255) -+ Copy 5-8 bytes from block within 2kB distance -+ state = S (copy S literals after this block) -+ length = 5 + L -+ Always followed by exactly one byte : H H H H H H H H -+ distance = (H << 3) + D + 1 -+ -+Authors -+ -+ This document was written by Willy Tarreau <w@1wt.eu> on 2014/07/19 during an -+ analysis of the decompression code available in Linux 3.16-rc5. The code is -+ tricky, it is possible that this document contains mistakes or that a few -+ corner cases were overlooked. In any case, please report any doubt, fix, or -+ proposed updates to the author(s) so that the document can be updated. -diff --git a/Documentation/virtual/kvm/mmu.txt b/Documentation/virtual/kvm/mmu.txt -index 290894176142..53838d9c6295 100644 ---- a/Documentation/virtual/kvm/mmu.txt -+++ b/Documentation/virtual/kvm/mmu.txt -@@ -425,6 +425,20 @@ fault through the slow path. - Since only 19 bits are used to store generation-number on mmio spte, all - pages are zapped when there is an overflow. - -+Unfortunately, a single memory access might access kvm_memslots(kvm) multiple -+times, the last one happening when the generation number is retrieved and -+stored into the MMIO spte. Thus, the MMIO spte might be created based on -+out-of-date information, but with an up-to-date generation number. -+ -+To avoid this, the generation number is incremented again after synchronize_srcu -+returns; thus, the low bit of kvm_memslots(kvm)->generation is only 1 during a -+memslot update, while some SRCU readers might be using the old copy. We do not -+want to use an MMIO sptes created with an odd generation number, and we can do -+this without losing a bit in the MMIO spte. The low bit of the generation -+is not stored in MMIO spte, and presumed zero when it is extracted out of the -+spte. If KVM is unlucky and creates an MMIO spte while the low bit is 1, -+the next access to the spte will always be a cache miss. -+ - - Further reading - =============== -diff --git a/Makefile b/Makefile -index a59980eb4557..135a04a26076 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,6 +1,6 @@ - VERSION = 3 - PATCHLEVEL = 14 --SUBLEVEL = 22 -+SUBLEVEL = 23 - EXTRAVERSION = - NAME = Remembering Coco - -diff --git a/arch/arm/boot/dts/armada-370-netgear-rn102.dts b/arch/arm/boot/dts/armada-370-netgear-rn102.dts -index 651aeb5ef439..f3188e953de4 100644 ---- a/arch/arm/boot/dts/armada-370-netgear-rn102.dts -+++ b/arch/arm/boot/dts/armada-370-netgear-rn102.dts -@@ -144,6 +144,10 @@ - marvell,nand-enable-arbiter; - nand-on-flash-bbt; - -+ /* Use Hardware BCH ECC */ -+ nand-ecc-strength = <4>; -+ nand-ecc-step-size = <512>; -+ - partition@0 { - label = "u-boot"; - reg = <0x0000000 0x180000>; /* 1.5MB */ -diff --git a/arch/arm/boot/dts/armada-370-netgear-rn104.dts b/arch/arm/boot/dts/armada-370-netgear-rn104.dts -index 4e27587667bf..da406c1c726a 100644 ---- a/arch/arm/boot/dts/armada-370-netgear-rn104.dts -+++ b/arch/arm/boot/dts/armada-370-netgear-rn104.dts -@@ -146,6 +146,10 @@ - marvell,nand-enable-arbiter; - nand-on-flash-bbt; - -+ /* Use Hardware BCH ECC */ -+ nand-ecc-strength = <4>; -+ nand-ecc-step-size = <512>; -+ - partition@0 { - label = "u-boot"; - reg = <0x0000000 0x180000>; /* 1.5MB */ -diff --git a/arch/arm/boot/dts/armada-xp-netgear-rn2120.dts b/arch/arm/boot/dts/armada-xp-netgear-rn2120.dts -index ff049ee862eb..b4aba09de911 100644 ---- a/arch/arm/boot/dts/armada-xp-netgear-rn2120.dts -+++ b/arch/arm/boot/dts/armada-xp-netgear-rn2120.dts -@@ -224,6 +224,10 @@ - marvell,nand-enable-arbiter; - nand-on-flash-bbt; - -+ /* Use Hardware BCH ECC */ -+ nand-ecc-strength = <4>; -+ nand-ecc-step-size = <512>; -+ - partition@0 { - label = "u-boot"; - reg = <0x0000000 0x180000>; /* 1.5MB */ -diff --git a/arch/arm/boot/dts/at91sam9263.dtsi b/arch/arm/boot/dts/at91sam9263.dtsi -index fece8665fb63..b8f234bf7de8 100644 ---- a/arch/arm/boot/dts/at91sam9263.dtsi -+++ b/arch/arm/boot/dts/at91sam9263.dtsi -@@ -535,6 +535,7 @@ - compatible = "atmel,hsmci"; - reg = <0xfff80000 0x600>; - interrupts = <10 IRQ_TYPE_LEVEL_HIGH 0>; -+ pinctrl-names = "default"; - #address-cells = <1>; - #size-cells = <0>; - status = "disabled"; -@@ -544,6 +545,7 @@ - compatible = "atmel,hsmci"; - reg = <0xfff84000 0x600>; - interrupts = <11 IRQ_TYPE_LEVEL_HIGH 0>; -+ pinctrl-names = "default"; - #address-cells = <1>; - #size-cells = <0>; - status = "disabled"; -diff --git a/arch/arm/boot/dts/sama5d3_can.dtsi b/arch/arm/boot/dts/sama5d3_can.dtsi -index a0775851cce5..eaf41451ad0c 100644 ---- a/arch/arm/boot/dts/sama5d3_can.dtsi -+++ b/arch/arm/boot/dts/sama5d3_can.dtsi -@@ -40,7 +40,7 @@ - atmel,clk-output-range = <0 66000000>; - }; - -- can1_clk: can0_clk { -+ can1_clk: can1_clk { - #clock-cells = <0>; - reg = <41>; - atmel,clk-output-range = <0 66000000>; -diff --git a/arch/arm/mach-at91/clock.c b/arch/arm/mach-at91/clock.c -index 034529d801b2..d66f102c352a 100644 ---- a/arch/arm/mach-at91/clock.c -+++ b/arch/arm/mach-at91/clock.c -@@ -962,6 +962,7 @@ static int __init at91_clock_reset(void) - } - - at91_pmc_write(AT91_PMC_SCDR, scdr); -+ at91_pmc_write(AT91_PMC_PCDR, pcdr); - if (cpu_is_sama5d3()) - at91_pmc_write(AT91_PMC_PCDR1, pcdr1); - -diff --git a/arch/arm64/include/asm/compat.h b/arch/arm64/include/asm/compat.h -index fda2704b3f9f..e72289a97367 100644 ---- a/arch/arm64/include/asm/compat.h -+++ b/arch/arm64/include/asm/compat.h -@@ -37,8 +37,8 @@ typedef s32 compat_ssize_t; - typedef s32 compat_time_t; - typedef s32 compat_clock_t; - typedef s32 compat_pid_t; --typedef u32 __compat_uid_t; --typedef u32 __compat_gid_t; -+typedef u16 __compat_uid_t; -+typedef u16 __compat_gid_t; - typedef u16 __compat_uid16_t; - typedef u16 __compat_gid16_t; - typedef u32 __compat_uid32_t; -diff --git a/arch/m68k/mm/hwtest.c b/arch/m68k/mm/hwtest.c -index 2c7dde3c6430..2a5259fd23eb 100644 ---- a/arch/m68k/mm/hwtest.c -+++ b/arch/m68k/mm/hwtest.c -@@ -28,9 +28,11 @@ - int hwreg_present( volatile void *regp ) - { - int ret = 0; -+ unsigned long flags; - long save_sp, save_vbr; - long tmp_vectors[3]; - -+ local_irq_save(flags); - __asm__ __volatile__ - ( "movec %/vbr,%2\n\t" - "movel #Lberr1,%4@(8)\n\t" -@@ -46,6 +48,7 @@ int hwreg_present( volatile void *regp ) - : "=&d" (ret), "=&r" (save_sp), "=&r" (save_vbr) - : "a" (regp), "a" (tmp_vectors) - ); -+ local_irq_restore(flags); - - return( ret ); - } -@@ -58,9 +61,11 @@ EXPORT_SYMBOL(hwreg_present); - int hwreg_write( volatile void *regp, unsigned short val ) - { - int ret; -+ unsigned long flags; - long save_sp, save_vbr; - long tmp_vectors[3]; - -+ local_irq_save(flags); - __asm__ __volatile__ - ( "movec %/vbr,%2\n\t" - "movel #Lberr2,%4@(8)\n\t" -@@ -78,6 +83,7 @@ int hwreg_write( volatile void *regp, unsigned short val ) - : "=&d" (ret), "=&r" (save_sp), "=&r" (save_vbr) - : "a" (regp), "a" (tmp_vectors), "g" (val) - ); -+ local_irq_restore(flags); - - return( ret ); - } -diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c -index 4642d6a4d356..de1ec54a2a57 100644 ---- a/arch/powerpc/platforms/pseries/iommu.c -+++ b/arch/powerpc/platforms/pseries/iommu.c -@@ -329,16 +329,16 @@ struct direct_window { - - /* Dynamic DMA Window support */ - struct ddw_query_response { -- __be32 windows_available; -- __be32 largest_available_block; -- __be32 page_size; -- __be32 migration_capable; -+ u32 windows_available; -+ u32 largest_available_block; -+ u32 page_size; -+ u32 migration_capable; - }; - - struct ddw_create_response { -- __be32 liobn; -- __be32 addr_hi; -- __be32 addr_lo; -+ u32 liobn; -+ u32 addr_hi; -+ u32 addr_lo; - }; - - static LIST_HEAD(direct_window_list); -@@ -725,16 +725,18 @@ static void remove_ddw(struct device_node *np, bool remove_prop) - { - struct dynamic_dma_window_prop *dwp; - struct property *win64; -- const u32 *ddw_avail; -+ u32 ddw_avail[3]; - u64 liobn; -- int len, ret = 0; -+ int ret = 0; -+ -+ ret = of_property_read_u32_array(np, "ibm,ddw-applicable", -+ &ddw_avail[0], 3); - -- ddw_avail = of_get_property(np, "ibm,ddw-applicable", &len); - win64 = of_find_property(np, DIRECT64_PROPNAME, NULL); - if (!win64) - return; - -- if (!ddw_avail || len < 3 * sizeof(u32) || win64->length < sizeof(*dwp)) -+ if (ret || win64->length < sizeof(*dwp)) - goto delprop; - - dwp = win64->value; -@@ -872,8 +874,9 @@ static int create_ddw(struct pci_dev *dev, const u32 *ddw_avail, - - do { - /* extra outputs are LIOBN and dma-addr (hi, lo) */ -- ret = rtas_call(ddw_avail[1], 5, 4, (u32 *)create, cfg_addr, -- BUID_HI(buid), BUID_LO(buid), page_shift, window_shift); -+ ret = rtas_call(ddw_avail[1], 5, 4, (u32 *)create, -+ cfg_addr, BUID_HI(buid), BUID_LO(buid), -+ page_shift, window_shift); - } while (rtas_busy_delay(ret)); - dev_info(&dev->dev, - "ibm,create-pe-dma-window(%x) %x %x %x %x %x returned %d " -@@ -910,7 +913,7 @@ static u64 enable_ddw(struct pci_dev *dev, struct device_node *pdn) - int page_shift; - u64 dma_addr, max_addr; - struct device_node *dn; -- const u32 *uninitialized_var(ddw_avail); -+ u32 ddw_avail[3]; - struct direct_window *window; - struct property *win64; - struct dynamic_dma_window_prop *ddwprop; -@@ -942,8 +945,9 @@ static u64 enable_ddw(struct pci_dev *dev, struct device_node *pdn) - * for the given node in that order. - * the property is actually in the parent, not the PE - */ -- ddw_avail = of_get_property(pdn, "ibm,ddw-applicable", &len); -- if (!ddw_avail || len < 3 * sizeof(u32)) -+ ret = of_property_read_u32_array(pdn, "ibm,ddw-applicable", -+ &ddw_avail[0], 3); -+ if (ret) - goto out_failed; - - /* -@@ -966,11 +970,11 @@ static u64 enable_ddw(struct pci_dev *dev, struct device_node *pdn) - dev_dbg(&dev->dev, "no free dynamic windows"); - goto out_failed; - } -- if (be32_to_cpu(query.page_size) & 4) { -+ if (query.page_size & 4) { - page_shift = 24; /* 16MB */ -- } else if (be32_to_cpu(query.page_size) & 2) { -+ } else if (query.page_size & 2) { - page_shift = 16; /* 64kB */ -- } else if (be32_to_cpu(query.page_size) & 1) { -+ } else if (query.page_size & 1) { - page_shift = 12; /* 4kB */ - } else { - dev_dbg(&dev->dev, "no supported direct page size in mask %x", -@@ -980,7 +984,7 @@ static u64 enable_ddw(struct pci_dev *dev, struct device_node *pdn) - /* verify the window * number of ptes will map the partition */ - /* check largest block * page size > max memory hotplug addr */ - max_addr = memory_hotplug_max(); -- if (be32_to_cpu(query.largest_available_block) < (max_addr >> page_shift)) { -+ if (query.largest_available_block < (max_addr >> page_shift)) { - dev_dbg(&dev->dev, "can't map partiton max 0x%llx with %u " - "%llu-sized pages\n", max_addr, query.largest_available_block, - 1ULL << page_shift); -@@ -1006,8 +1010,9 @@ static u64 enable_ddw(struct pci_dev *dev, struct device_node *pdn) - if (ret != 0) - goto out_free_prop; - -- ddwprop->liobn = create.liobn; -- ddwprop->dma_base = cpu_to_be64(of_read_number(&create.addr_hi, 2)); -+ ddwprop->liobn = cpu_to_be32(create.liobn); -+ ddwprop->dma_base = cpu_to_be64(((u64)create.addr_hi << 32) | -+ create.addr_lo); - ddwprop->tce_shift = cpu_to_be32(page_shift); - ddwprop->window_shift = cpu_to_be32(len); - -@@ -1039,7 +1044,7 @@ static u64 enable_ddw(struct pci_dev *dev, struct device_node *pdn) - list_add(&window->list, &direct_window_list); - spin_unlock(&direct_window_list_lock); - -- dma_addr = of_read_number(&create.addr_hi, 2); -+ dma_addr = be64_to_cpu(ddwprop->dma_base); - goto out_unlock; - - out_free_window: -diff --git a/arch/s390/kvm/interrupt.c b/arch/s390/kvm/interrupt.c -index 5f79d2d79ca7..f1ba119878ec 100644 ---- a/arch/s390/kvm/interrupt.c -+++ b/arch/s390/kvm/interrupt.c -@@ -71,6 +71,7 @@ static int __interrupt_is_deliverable(struct kvm_vcpu *vcpu, - return 0; - if (vcpu->arch.sie_block->gcr[0] & 0x2000ul) - return 1; -+ return 0; - case KVM_S390_INT_EMERGENCY: - if (psw_extint_disabled(vcpu)) - return 0; -diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig -index b398c68b2713..a38513c33a62 100644 ---- a/arch/sparc/Kconfig -+++ b/arch/sparc/Kconfig -@@ -67,6 +67,7 @@ config SPARC64 - select HAVE_SYSCALL_TRACEPOINTS - select HAVE_CONTEXT_TRACKING - select HAVE_DEBUG_KMEMLEAK -+ select SPARSE_IRQ - select RTC_DRV_CMOS - select RTC_DRV_BQ4802 - select RTC_DRV_SUN4V -diff --git a/arch/sparc/include/asm/hypervisor.h b/arch/sparc/include/asm/hypervisor.h -index ca121f0fa3ec..17be9d618335 100644 ---- a/arch/sparc/include/asm/hypervisor.h -+++ b/arch/sparc/include/asm/hypervisor.h -@@ -2944,6 +2944,16 @@ extern unsigned long sun4v_vt_set_perfreg(unsigned long reg_num, - unsigned long reg_val); - #endif - -+#define HV_FAST_T5_GET_PERFREG 0x1a8 -+#define HV_FAST_T5_SET_PERFREG 0x1a9 -+ -+#ifndef __ASSEMBLY__ -+unsigned long sun4v_t5_get_perfreg(unsigned long reg_num, -+ unsigned long *reg_val); -+unsigned long sun4v_t5_set_perfreg(unsigned long reg_num, -+ unsigned long reg_val); -+#endif -+ - /* Function numbers for HV_CORE_TRAP. */ - #define HV_CORE_SET_VER 0x00 - #define HV_CORE_PUTCHAR 0x01 -@@ -2975,6 +2985,7 @@ extern unsigned long sun4v_vt_set_perfreg(unsigned long reg_num, - #define HV_GRP_VF_CPU 0x0205 - #define HV_GRP_KT_CPU 0x0209 - #define HV_GRP_VT_CPU 0x020c -+#define HV_GRP_T5_CPU 0x0211 - #define HV_GRP_DIAG 0x0300 - - #ifndef __ASSEMBLY__ -diff --git a/arch/sparc/include/asm/irq_64.h b/arch/sparc/include/asm/irq_64.h -index abf6afe82ca8..3deb07ff1e00 100644 ---- a/arch/sparc/include/asm/irq_64.h -+++ b/arch/sparc/include/asm/irq_64.h -@@ -37,7 +37,7 @@ - * - * ino_bucket->irq allocation is made during {sun4v_,}build_irq(). - */ --#define NR_IRQS 255 -+#define NR_IRQS (2048) - - extern void irq_install_pre_handler(int irq, - void (*func)(unsigned int, void *, void *), -@@ -57,11 +57,8 @@ extern unsigned int sun4u_build_msi(u32 portid, unsigned int *irq_p, - unsigned long iclr_base); - extern void sun4u_destroy_msi(unsigned int irq); - --extern unsigned char irq_alloc(unsigned int dev_handle, -- unsigned int dev_ino); --#ifdef CONFIG_PCI_MSI --extern void irq_free(unsigned int irq); --#endif -+unsigned int irq_alloc(unsigned int dev_handle, unsigned int dev_ino); -+void irq_free(unsigned int irq); - - extern void __init init_IRQ(void); - extern void fixup_irqs(void); -diff --git a/arch/sparc/include/asm/ldc.h b/arch/sparc/include/asm/ldc.h -index bdb524a7b814..8732ed391aff 100644 ---- a/arch/sparc/include/asm/ldc.h -+++ b/arch/sparc/include/asm/ldc.h -@@ -53,13 +53,14 @@ struct ldc_channel; - /* Allocate state for a channel. */ - extern struct ldc_channel *ldc_alloc(unsigned long id, - const struct ldc_channel_config *cfgp, -- void *event_arg); -+ void *event_arg, -+ const char *name); - - /* Shut down and free state for a channel. */ - extern void ldc_free(struct ldc_channel *lp); - - /* Register TX and RX queues of the link with the hypervisor. */ --extern int ldc_bind(struct ldc_channel *lp, const char *name); -+extern int ldc_bind(struct ldc_channel *lp); - - /* For non-RAW protocols we need to complete a handshake before - * communication can proceed. ldc_connect() does that, if the -diff --git a/arch/sparc/include/asm/oplib_64.h b/arch/sparc/include/asm/oplib_64.h -index a12dbe3b7762..e48fdf4e16ff 100644 ---- a/arch/sparc/include/asm/oplib_64.h -+++ b/arch/sparc/include/asm/oplib_64.h -@@ -62,7 +62,8 @@ struct linux_mem_p1275 { - /* You must call prom_init() before using any of the library services, - * preferably as early as possible. Pass it the romvec pointer. - */ --extern void prom_init(void *cif_handler, void *cif_stack); -+extern void prom_init(void *cif_handler); -+extern void prom_init_report(void); - - /* Boot argument acquisition, returns the boot command line string. */ - extern char *prom_getbootargs(void); -diff --git a/arch/sparc/include/asm/page_64.h b/arch/sparc/include/asm/page_64.h -index aac53fcea807..b18e602fcac4 100644 ---- a/arch/sparc/include/asm/page_64.h -+++ b/arch/sparc/include/asm/page_64.h -@@ -57,18 +57,21 @@ extern void copy_user_page(void *to, void *from, unsigned long vaddr, struct pag - typedef struct { unsigned long pte; } pte_t; - typedef struct { unsigned long iopte; } iopte_t; - typedef struct { unsigned long pmd; } pmd_t; -+typedef struct { unsigned long pud; } pud_t; - typedef struct { unsigned long pgd; } pgd_t; - typedef struct { unsigned long pgprot; } pgprot_t; - - #define pte_val(x) ((x).pte) - #define iopte_val(x) ((x).iopte) - #define pmd_val(x) ((x).pmd) -+#define pud_val(x) ((x).pud) - #define pgd_val(x) ((x).pgd) - #define pgprot_val(x) ((x).pgprot) - - #define __pte(x) ((pte_t) { (x) } ) - #define __iopte(x) ((iopte_t) { (x) } ) - #define __pmd(x) ((pmd_t) { (x) } ) -+#define __pud(x) ((pud_t) { (x) } ) - #define __pgd(x) ((pgd_t) { (x) } ) - #define __pgprot(x) ((pgprot_t) { (x) } ) - -@@ -77,18 +80,21 @@ typedef struct { unsigned long pgprot; } pgprot_t; - typedef unsigned long pte_t; - typedef unsigned long iopte_t; - typedef unsigned long pmd_t; -+typedef unsigned long pud_t; - typedef unsigned long pgd_t; - typedef unsigned long pgprot_t; - - #define pte_val(x) (x) - #define iopte_val(x) (x) - #define pmd_val(x) (x) -+#define pud_val(x) (x) - #define pgd_val(x) (x) - #define pgprot_val(x) (x) - - #define __pte(x) (x) - #define __iopte(x) (x) - #define __pmd(x) (x) -+#define __pud(x) (x) - #define __pgd(x) (x) - #define __pgprot(x) (x) - -@@ -96,21 +102,14 @@ typedef unsigned long pgprot_t; - - typedef pte_t *pgtable_t; - --/* These two values define the virtual address space range in which we -- * must forbid 64-bit user processes from making mappings. It used to -- * represent precisely the virtual address space hole present in most -- * early sparc64 chips including UltraSPARC-I. But now it also is -- * further constrained by the limits of our page tables, which is -- * 43-bits of virtual address. -- */ --#define SPARC64_VA_HOLE_TOP _AC(0xfffffc0000000000,UL) --#define SPARC64_VA_HOLE_BOTTOM _AC(0x0000040000000000,UL) -+extern unsigned long sparc64_va_hole_top; -+extern unsigned long sparc64_va_hole_bottom; - - /* The next two defines specify the actual exclusion region we - * enforce, wherein we use a 4GB red zone on each side of the VA hole. - */ --#define VA_EXCLUDE_START (SPARC64_VA_HOLE_BOTTOM - (1UL << 32UL)) --#define VA_EXCLUDE_END (SPARC64_VA_HOLE_TOP + (1UL << 32UL)) -+#define VA_EXCLUDE_START (sparc64_va_hole_bottom - (1UL << 32UL)) -+#define VA_EXCLUDE_END (sparc64_va_hole_top + (1UL << 32UL)) - - #define TASK_UNMAPPED_BASE (test_thread_flag(TIF_32BIT) ? \ - _AC(0x0000000070000000,UL) : \ -@@ -118,20 +117,16 @@ typedef pte_t *pgtable_t; - - #include <asm-generic/memory_model.h> - --#define PAGE_OFFSET_BY_BITS(X) (-(_AC(1,UL) << (X))) - extern unsigned long PAGE_OFFSET; - - #endif /* !(__ASSEMBLY__) */ - --/* The maximum number of physical memory address bits we support, this -- * is used to size various tables used to manage kernel TLB misses and -- * also the sparsemem code. -+/* The maximum number of physical memory address bits we support. The -+ * largest value we can support is whatever "KPGD_SHIFT + KPTE_BITS" -+ * evaluates to. - */ --#define MAX_PHYS_ADDRESS_BITS 47 -+#define MAX_PHYS_ADDRESS_BITS 53 - --/* These two shift counts are used when indexing sparc64_valid_addr_bitmap -- * and kpte_linear_bitmap. -- */ - #define ILOG2_4MB 22 - #define ILOG2_256MB 28 - -diff --git a/arch/sparc/include/asm/pgalloc_64.h b/arch/sparc/include/asm/pgalloc_64.h -index bcfe063bce23..2c8d41fb13a4 100644 ---- a/arch/sparc/include/asm/pgalloc_64.h -+++ b/arch/sparc/include/asm/pgalloc_64.h -@@ -15,6 +15,13 @@ - - extern struct kmem_cache *pgtable_cache; - -+static inline void __pgd_populate(pgd_t *pgd, pud_t *pud) -+{ -+ pgd_set(pgd, pud); -+} -+ -+#define pgd_populate(MM, PGD, PUD) __pgd_populate(PGD, PUD) -+ - static inline pgd_t *pgd_alloc(struct mm_struct *mm) - { - return kmem_cache_alloc(pgtable_cache, GFP_KERNEL); -@@ -25,7 +32,23 @@ static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd) - kmem_cache_free(pgtable_cache, pgd); - } - --#define pud_populate(MM, PUD, PMD) pud_set(PUD, PMD) -+static inline void __pud_populate(pud_t *pud, pmd_t *pmd) -+{ -+ pud_set(pud, pmd); -+} -+ -+#define pud_populate(MM, PUD, PMD) __pud_populate(PUD, PMD) -+ -+static inline pud_t *pud_alloc_one(struct mm_struct *mm, unsigned long addr) -+{ -+ return kmem_cache_alloc(pgtable_cache, -+ GFP_KERNEL|__GFP_REPEAT); -+} -+ -+static inline void pud_free(struct mm_struct *mm, pud_t *pud) -+{ -+ kmem_cache_free(pgtable_cache, pud); -+} - - static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long addr) - { -@@ -91,4 +114,7 @@ static inline void __pte_free_tlb(struct mmu_gather *tlb, pte_t *pte, - #define __pmd_free_tlb(tlb, pmd, addr) \ - pgtable_free_tlb(tlb, pmd, false) - -+#define __pud_free_tlb(tlb, pud, addr) \ -+ pgtable_free_tlb(tlb, pud, false) -+ - #endif /* _SPARC64_PGALLOC_H */ -diff --git a/arch/sparc/include/asm/pgtable_64.h b/arch/sparc/include/asm/pgtable_64.h -index 1a49ffdf9da9..e8dfabf156c7 100644 ---- a/arch/sparc/include/asm/pgtable_64.h -+++ b/arch/sparc/include/asm/pgtable_64.h -@@ -20,8 +20,6 @@ - #include <asm/page.h> - #include <asm/processor.h> - --#include <asm-generic/pgtable-nopud.h> -- - /* The kernel image occupies 0x4000000 to 0x6000000 (4MB --> 96MB). - * The page copy blockops can use 0x6000000 to 0x8000000. - * The 8K TSB is mapped in the 0x8000000 to 0x8400000 range. -@@ -42,10 +40,7 @@ - #define LOW_OBP_ADDRESS _AC(0x00000000f0000000,UL) - #define HI_OBP_ADDRESS _AC(0x0000000100000000,UL) - #define VMALLOC_START _AC(0x0000000100000000,UL) --#define VMALLOC_END _AC(0x0000010000000000,UL) --#define VMEMMAP_BASE _AC(0x0000010000000000,UL) -- --#define vmemmap ((struct page *)VMEMMAP_BASE) -+#define VMEMMAP_BASE VMALLOC_END - - /* PMD_SHIFT determines the size of the area a second-level page - * table can map -@@ -55,13 +50,25 @@ - #define PMD_MASK (~(PMD_SIZE-1)) - #define PMD_BITS (PAGE_SHIFT - 3) - --/* PGDIR_SHIFT determines what a third-level page table entry can map */ --#define PGDIR_SHIFT (PAGE_SHIFT + (PAGE_SHIFT-3) + PMD_BITS) -+/* PUD_SHIFT determines the size of the area a third-level page -+ * table can map -+ */ -+#define PUD_SHIFT (PMD_SHIFT + PMD_BITS) -+#define PUD_SIZE (_AC(1,UL) << PUD_SHIFT) -+#define PUD_MASK (~(PUD_SIZE-1)) -+#define PUD_BITS (PAGE_SHIFT - 3) -+ -+/* PGDIR_SHIFT determines what a fourth-level page table entry can map */ -+#define PGDIR_SHIFT (PUD_SHIFT + PUD_BITS) - #define PGDIR_SIZE (_AC(1,UL) << PGDIR_SHIFT) - #define PGDIR_MASK (~(PGDIR_SIZE-1)) - #define PGDIR_BITS (PAGE_SHIFT - 3) - --#if (PGDIR_SHIFT + PGDIR_BITS) != 43 -+#if (MAX_PHYS_ADDRESS_BITS > PGDIR_SHIFT + PGDIR_BITS) -+#error MAX_PHYS_ADDRESS_BITS exceeds what kernel page tables can support -+#endif -+ -+#if (PGDIR_SHIFT + PGDIR_BITS) != 53 - #error Page table parameters do not cover virtual address space properly. - #endif - -@@ -71,28 +78,18 @@ - - #ifndef __ASSEMBLY__ - --#include <linux/sched.h> -- --extern unsigned long sparc64_valid_addr_bitmap[]; -+extern unsigned long VMALLOC_END; - --/* Needs to be defined here and not in linux/mm.h, as it is arch dependent */ --static inline bool __kern_addr_valid(unsigned long paddr) --{ -- if ((paddr >> MAX_PHYS_ADDRESS_BITS) != 0UL) -- return false; -- return test_bit(paddr >> ILOG2_4MB, sparc64_valid_addr_bitmap); --} -+#define vmemmap ((struct page *)VMEMMAP_BASE) - --static inline bool kern_addr_valid(unsigned long addr) --{ -- unsigned long paddr = __pa(addr); -+#include <linux/sched.h> - -- return __kern_addr_valid(paddr); --} -+bool kern_addr_valid(unsigned long addr); - - /* Entries per page directory level. */ - #define PTRS_PER_PTE (1UL << (PAGE_SHIFT-3)) - #define PTRS_PER_PMD (1UL << PMD_BITS) -+#define PTRS_PER_PUD (1UL << PUD_BITS) - #define PTRS_PER_PGD (1UL << PGDIR_BITS) - - /* Kernel has a separate 44bit address space. */ -@@ -101,6 +98,9 @@ static inline bool kern_addr_valid(unsigned long addr) - #define pmd_ERROR(e) \ - pr_err("%s:%d: bad pmd %p(%016lx) seen at (%pS)\n", \ - __FILE__, __LINE__, &(e), pmd_val(e), __builtin_return_address(0)) -+#define pud_ERROR(e) \ -+ pr_err("%s:%d: bad pud %p(%016lx) seen at (%pS)\n", \ -+ __FILE__, __LINE__, &(e), pud_val(e), __builtin_return_address(0)) - #define pgd_ERROR(e) \ - pr_err("%s:%d: bad pgd %p(%016lx) seen at (%pS)\n", \ - __FILE__, __LINE__, &(e), pgd_val(e), __builtin_return_address(0)) -@@ -112,6 +112,7 @@ static inline bool kern_addr_valid(unsigned long addr) - #define _PAGE_R _AC(0x8000000000000000,UL) /* Keep ref bit uptodate*/ - #define _PAGE_SPECIAL _AC(0x0200000000000000,UL) /* Special page */ - #define _PAGE_PMD_HUGE _AC(0x0100000000000000,UL) /* Huge page */ -+#define _PAGE_PUD_HUGE _PAGE_PMD_HUGE - - /* Advertise support for _PAGE_SPECIAL */ - #define __HAVE_ARCH_PTE_SPECIAL -@@ -658,26 +659,26 @@ static inline unsigned long pmd_large(pmd_t pmd) - return pte_val(pte) & _PAGE_PMD_HUGE; - } - --#ifdef CONFIG_TRANSPARENT_HUGEPAGE --static inline unsigned long pmd_young(pmd_t pmd) -+static inline unsigned long pmd_pfn(pmd_t pmd) - { - pte_t pte = __pte(pmd_val(pmd)); - -- return pte_young(pte); -+ return pte_pfn(pte); - } - --static inline unsigned long pmd_write(pmd_t pmd) -+#ifdef CONFIG_TRANSPARENT_HUGEPAGE -+static inline unsigned long pmd_young(pmd_t pmd) - { - pte_t pte = __pte(pmd_val(pmd)); - -- return pte_write(pte); -+ return pte_young(pte); - } - --static inline unsigned long pmd_pfn(pmd_t pmd) -+static inline unsigned long pmd_write(pmd_t pmd) - { - pte_t pte = __pte(pmd_val(pmd)); - -- return pte_pfn(pte); -+ return pte_write(pte); - } - - static inline unsigned long pmd_trans_huge(pmd_t pmd) -@@ -771,13 +772,15 @@ static inline int pmd_present(pmd_t pmd) - * the top bits outside of the range of any physical address size we - * support are clear as well. We also validate the physical itself. - */ --#define pmd_bad(pmd) ((pmd_val(pmd) & ~PAGE_MASK) || \ -- !__kern_addr_valid(pmd_val(pmd))) -+#define pmd_bad(pmd) (pmd_val(pmd) & ~PAGE_MASK) - - #define pud_none(pud) (!pud_val(pud)) - --#define pud_bad(pud) ((pud_val(pud) & ~PAGE_MASK) || \ -- !__kern_addr_valid(pud_val(pud))) -+#define pud_bad(pud) (pud_val(pud) & ~PAGE_MASK) -+ -+#define pgd_none(pgd) (!pgd_val(pgd)) -+ -+#define pgd_bad(pgd) (pgd_val(pgd) & ~PAGE_MASK) - - #ifdef CONFIG_TRANSPARENT_HUGEPAGE - extern void set_pmd_at(struct mm_struct *mm, unsigned long addr, -@@ -815,10 +818,31 @@ static inline unsigned long __pmd_page(pmd_t pmd) - #define pmd_clear(pmdp) (pmd_val(*(pmdp)) = 0UL) - #define pud_present(pud) (pud_val(pud) != 0U) - #define pud_clear(pudp) (pud_val(*(pudp)) = 0UL) -+#define pgd_page_vaddr(pgd) \ -+ ((unsigned long) __va(pgd_val(pgd))) -+#define pgd_present(pgd) (pgd_val(pgd) != 0U) -+#define pgd_clear(pgdp) (pgd_val(*(pgd)) = 0UL) -+ -+static inline unsigned long pud_large(pud_t pud) -+{ -+ pte_t pte = __pte(pud_val(pud)); -+ -+ return pte_val(pte) & _PAGE_PMD_HUGE; -+} -+ -+static inline unsigned long pud_pfn(pud_t pud) -+{ -+ pte_t pte = __pte(pud_val(pud)); -+ -+ return pte_pfn(pte); -+} - - /* Same in both SUN4V and SUN4U. */ - #define pte_none(pte) (!pte_val(pte)) - -+#define pgd_set(pgdp, pudp) \ -+ (pgd_val(*(pgdp)) = (__pa((unsigned long) (pudp)))) -+ - /* to find an entry in a page-table-directory. */ - #define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD - 1)) - #define pgd_offset(mm, address) ((mm)->pgd + pgd_index(address)) -@@ -826,6 +850,11 @@ static inline unsigned long __pmd_page(pmd_t pmd) - /* to find an entry in a kernel page-table-directory */ - #define pgd_offset_k(address) pgd_offset(&init_mm, address) - -+/* Find an entry in the third-level page table.. */ -+#define pud_index(address) (((address) >> PUD_SHIFT) & (PTRS_PER_PUD - 1)) -+#define pud_offset(pgdp, address) \ -+ ((pud_t *) pgd_page_vaddr(*(pgdp)) + pud_index(address)) -+ - /* Find an entry in the second-level page table.. */ - #define pmd_offset(pudp, address) \ - ((pmd_t *) pud_page_vaddr(*(pudp)) + \ -@@ -898,7 +927,6 @@ static inline void __set_pte_at(struct mm_struct *mm, unsigned long addr, - #endif - - extern pgd_t swapper_pg_dir[PTRS_PER_PGD]; --extern pmd_t swapper_low_pmd_dir[PTRS_PER_PMD]; - - extern void paging_init(void); - extern unsigned long find_ecache_flush_span(unsigned long size); -diff --git a/arch/sparc/include/asm/setup.h b/arch/sparc/include/asm/setup.h -index 5e35e0517318..acd614668ec1 100644 ---- a/arch/sparc/include/asm/setup.h -+++ b/arch/sparc/include/asm/setup.h -@@ -24,6 +24,10 @@ static inline int con_is_present(void) - } - #endif - -+#ifdef CONFIG_SPARC64 -+extern void __init start_early_boot(void); -+#endif -+ - extern void sun_do_break(void); - extern int stop_a_enabled; - extern int scons_pwroff; -diff --git a/arch/sparc/include/asm/spitfire.h b/arch/sparc/include/asm/spitfire.h -index 6b67e50fb9b4..69424d48cbb7 100644 ---- a/arch/sparc/include/asm/spitfire.h -+++ b/arch/sparc/include/asm/spitfire.h -@@ -45,6 +45,8 @@ - #define SUN4V_CHIP_NIAGARA3 0x03 - #define SUN4V_CHIP_NIAGARA4 0x04 - #define SUN4V_CHIP_NIAGARA5 0x05 -+#define SUN4V_CHIP_SPARC_M6 0x06 -+#define SUN4V_CHIP_SPARC_M7 0x07 - #define SUN4V_CHIP_SPARC64X 0x8a - #define SUN4V_CHIP_UNKNOWN 0xff - -diff --git a/arch/sparc/include/asm/thread_info_64.h b/arch/sparc/include/asm/thread_info_64.h -index a5f01ac6d0f1..cc6275c931a5 100644 ---- a/arch/sparc/include/asm/thread_info_64.h -+++ b/arch/sparc/include/asm/thread_info_64.h -@@ -63,7 +63,8 @@ struct thread_info { - struct pt_regs *kern_una_regs; - unsigned int kern_una_insn; - -- unsigned long fpregs[0] __attribute__ ((aligned(64))); -+ unsigned long fpregs[(7 * 256) / sizeof(unsigned long)] -+ __attribute__ ((aligned(64))); - }; - - #endif /* !(__ASSEMBLY__) */ -@@ -102,6 +103,7 @@ struct thread_info { - #define FAULT_CODE_ITLB 0x04 /* Miss happened in I-TLB */ - #define FAULT_CODE_WINFIXUP 0x08 /* Miss happened during spill/fill */ - #define FAULT_CODE_BLKCOMMIT 0x10 /* Use blk-commit ASI in copy_page */ -+#define FAULT_CODE_BAD_RA 0x20 /* Bad RA for sun4v */ - - #if PAGE_SHIFT == 13 - #define THREAD_SIZE (2*PAGE_SIZE) -diff --git a/arch/sparc/include/asm/tsb.h b/arch/sparc/include/asm/tsb.h -index 90916f955cac..ecb49cfa3be9 100644 ---- a/arch/sparc/include/asm/tsb.h -+++ b/arch/sparc/include/asm/tsb.h -@@ -133,9 +133,24 @@ extern struct tsb_phys_patch_entry __tsb_phys_patch, __tsb_phys_patch_end; - sub TSB, 0x8, TSB; \ - TSB_STORE(TSB, TAG); - -- /* Do a kernel page table walk. Leaves physical PTE pointer in -- * REG1. Jumps to FAIL_LABEL on early page table walk termination. -- * VADDR will not be clobbered, but REG2 will. -+ /* Do a kernel page table walk. Leaves valid PTE value in -+ * REG1. Jumps to FAIL_LABEL on early page table walk -+ * termination. VADDR will not be clobbered, but REG2 will. -+ * -+ * There are two masks we must apply to propagate bits from -+ * the virtual address into the PTE physical address field -+ * when dealing with huge pages. This is because the page -+ * table boundaries do not match the huge page size(s) the -+ * hardware supports. -+ * -+ * In these cases we propagate the bits that are below the -+ * page table level where we saw the huge page mapping, but -+ * are still within the relevant physical bits for the huge -+ * page size in question. So for PMD mappings (which fall on -+ * bit 23, for 8MB per PMD) we must propagate bit 22 for a -+ * 4MB huge page. For huge PUDs (which fall on bit 33, for -+ * 8GB per PUD), we have to accomodate 256MB and 2GB huge -+ * pages. So for those we propagate bits 32 to 28. - */ - #define KERN_PGTABLE_WALK(VADDR, REG1, REG2, FAIL_LABEL) \ - sethi %hi(swapper_pg_dir), REG1; \ -@@ -145,15 +160,40 @@ extern struct tsb_phys_patch_entry __tsb_phys_patch, __tsb_phys_patch_end; - andn REG2, 0x7, REG2; \ - ldx [REG1 + REG2], REG1; \ - brz,pn REG1, FAIL_LABEL; \ -- sllx VADDR, 64 - (PMD_SHIFT + PMD_BITS), REG2; \ -+ sllx VADDR, 64 - (PUD_SHIFT + PUD_BITS), REG2; \ - srlx REG2, 64 - PAGE_SHIFT, REG2; \ - andn REG2, 0x7, REG2; \ - ldxa [REG1 + REG2] ASI_PHYS_USE_EC, REG1; \ - brz,pn REG1, FAIL_LABEL; \ -- sllx VADDR, 64 - PMD_SHIFT, REG2; \ -+ sethi %uhi(_PAGE_PUD_HUGE), REG2; \ -+ brz,pn REG1, FAIL_LABEL; \ -+ sllx REG2, 32, REG2; \ -+ andcc REG1, REG2, %g0; \ -+ sethi %hi(0xf8000000), REG2; \ -+ bne,pt %xcc, 697f; \ -+ sllx REG2, 1, REG2; \ -+ sllx VADDR, 64 - (PMD_SHIFT + PMD_BITS), REG2; \ - srlx REG2, 64 - PAGE_SHIFT, REG2; \ - andn REG2, 0x7, REG2; \ -- add REG1, REG2, REG1; -+ ldxa [REG1 + REG2] ASI_PHYS_USE_EC, REG1; \ -+ sethi %uhi(_PAGE_PMD_HUGE), REG2; \ -+ brz,pn REG1, FAIL_LABEL; \ -+ sllx REG2, 32, REG2; \ -+ andcc REG1, REG2, %g0; \ -+ be,pn %xcc, 698f; \ -+ sethi %hi(0x400000), REG2; \ -+697: brgez,pn REG1, FAIL_LABEL; \ -+ andn REG1, REG2, REG1; \ -+ and VADDR, REG2, REG2; \ -+ ba,pt %xcc, 699f; \ -+ or REG1, REG2, REG1; \ -+698: sllx VADDR, 64 - PMD_SHIFT, REG2; \ -+ srlx REG2, 64 - PAGE_SHIFT, REG2; \ -+ andn REG2, 0x7, REG2; \ -+ ldxa [REG1 + REG2] ASI_PHYS_USE_EC, REG1; \ -+ brgez,pn REG1, FAIL_LABEL; \ -+ nop; \ -+699: - - /* PMD has been loaded into REG1, interpret the value, seeing - * if it is a HUGE PMD or a normal one. If it is not valid -@@ -198,6 +238,11 @@ extern struct tsb_phys_patch_entry __tsb_phys_patch, __tsb_phys_patch_end; - andn REG2, 0x7, REG2; \ - ldxa [PHYS_PGD + REG2] ASI_PHYS_USE_EC, REG1; \ - brz,pn REG1, FAIL_LABEL; \ -+ sllx VADDR, 64 - (PUD_SHIFT + PUD_BITS), REG2; \ -+ srlx REG2, 64 - PAGE_SHIFT, REG2; \ -+ andn REG2, 0x7, REG2; \ -+ ldxa [REG1 + REG2] ASI_PHYS_USE_EC, REG1; \ -+ brz,pn REG1, FAIL_LABEL; \ - sllx VADDR, 64 - (PMD_SHIFT + PMD_BITS), REG2; \ - srlx REG2, 64 - PAGE_SHIFT, REG2; \ - andn REG2, 0x7, REG2; \ -@@ -246,8 +291,6 @@ extern struct tsb_phys_patch_entry __tsb_phys_patch, __tsb_phys_patch_end; - (KERNEL_TSB_SIZE_BYTES / 16) - #define KERNEL_TSB4M_NENTRIES 4096 - --#define KTSB_PHYS_SHIFT 15 -- - /* Do a kernel TSB lookup at tl>0 on VADDR+TAG, branch to OK_LABEL - * on TSB hit. REG1, REG2, REG3, and REG4 are used as temporaries - * and the found TTE will be left in REG1. REG3 and REG4 must -@@ -256,17 +299,15 @@ extern struct tsb_phys_patch_entry __tsb_phys_patch, __tsb_phys_patch_end; - * VADDR and TAG will be preserved and not clobbered by this macro. - */ - #define KERN_TSB_LOOKUP_TL1(VADDR, TAG, REG1, REG2, REG3, REG4, OK_LABEL) \ --661: sethi %hi(swapper_tsb), REG1; \ -- or REG1, %lo(swapper_tsb), REG1; \ -+661: sethi %uhi(swapper_tsb), REG1; \ -+ sethi %hi(swapper_tsb), REG2; \ -+ or REG1, %ulo(swapper_tsb), REG1; \ -+ or REG2, %lo(swapper_tsb), REG2; \ - .section .swapper_tsb_phys_patch, "ax"; \ - .word 661b; \ - .previous; \ --661: nop; \ -- .section .tsb_ldquad_phys_patch, "ax"; \ -- .word 661b; \ -- sllx REG1, KTSB_PHYS_SHIFT, REG1; \ -- sllx REG1, KTSB_PHYS_SHIFT, REG1; \ -- .previous; \ -+ sllx REG1, 32, REG1; \ -+ or REG1, REG2, REG1; \ - srlx VADDR, PAGE_SHIFT, REG2; \ - and REG2, (KERNEL_TSB_NENTRIES - 1), REG2; \ - sllx REG2, 4, REG2; \ -@@ -281,17 +322,15 @@ extern struct tsb_phys_patch_entry __tsb_phys_patch, __tsb_phys_patch_end; - * we can make use of that for the index computation. - */ - #define KERN_TSB4M_LOOKUP_TL1(TAG, REG1, REG2, REG3, REG4, OK_LABEL) \ --661: sethi %hi(swapper_4m_tsb), REG1; \ -- or REG1, %lo(swapper_4m_tsb), REG1; \ -+661: sethi %uhi(swapper_4m_tsb), REG1; \ -+ sethi %hi(swapper_4m_tsb), REG2; \ -+ or REG1, %ulo(swapper_4m_tsb), REG1; \ -+ or REG2, %lo(swapper_4m_tsb), REG2; \ - .section .swapper_4m_tsb_phys_patch, "ax"; \ - .word 661b; \ - .previous; \ --661: nop; \ -- .section .tsb_ldquad_phys_patch, "ax"; \ -- .word 661b; \ -- sllx REG1, KTSB_PHYS_SHIFT, REG1; \ -- sllx REG1, KTSB_PHYS_SHIFT, REG1; \ -- .previous; \ -+ sllx REG1, 32, REG1; \ -+ or REG1, REG2, REG1; \ - and TAG, (KERNEL_TSB4M_NENTRIES - 1), REG2; \ - sllx REG2, 4, REG2; \ - add REG1, REG2, REG2; \ -diff --git a/arch/sparc/include/asm/visasm.h b/arch/sparc/include/asm/visasm.h -index 39ca301920db..11fdf0ef50bb 100644 ---- a/arch/sparc/include/asm/visasm.h -+++ b/arch/sparc/include/asm/visasm.h -@@ -39,6 +39,14 @@ - 297: wr %o5, FPRS_FEF, %fprs; \ - 298: - -+#define VISEntryHalfFast(fail_label) \ -+ rd %fprs, %o5; \ -+ andcc %o5, FPRS_FEF, %g0; \ -+ be,pt %icc, 297f; \ -+ nop; \ -+ ba,a,pt %xcc, fail_label; \ -+297: wr %o5, FPRS_FEF, %fprs; -+ - #define VISExitHalf \ - wr %o5, 0, %fprs; - -diff --git a/arch/sparc/kernel/cpu.c b/arch/sparc/kernel/cpu.c -index 5c5125895db8..52e10defedc4 100644 ---- a/arch/sparc/kernel/cpu.c -+++ b/arch/sparc/kernel/cpu.c -@@ -493,6 +493,18 @@ static void __init sun4v_cpu_probe(void) - sparc_pmu_type = "niagara5"; - break; - -+ case SUN4V_CHIP_SPARC_M6: -+ sparc_cpu_type = "SPARC-M6"; -+ sparc_fpu_type = "SPARC-M6 integrated FPU"; -+ sparc_pmu_type = "sparc-m6"; -+ break; -+ -+ case SUN4V_CHIP_SPARC_M7: -+ sparc_cpu_type = "SPARC-M7"; -+ sparc_fpu_type = "SPARC-M7 integrated FPU"; -+ sparc_pmu_type = "sparc-m7"; -+ break; -+ - case SUN4V_CHIP_SPARC64X: - sparc_cpu_type = "SPARC64-X"; - sparc_fpu_type = "SPARC64-X integrated FPU"; -diff --git a/arch/sparc/kernel/cpumap.c b/arch/sparc/kernel/cpumap.c -index de1c844dfabc..e69ec0e3f155 100644 ---- a/arch/sparc/kernel/cpumap.c -+++ b/arch/sparc/kernel/cpumap.c -@@ -326,6 +326,8 @@ static int iterate_cpu(struct cpuinfo_tree *t, unsigned int root_index) - case SUN4V_CHIP_NIAGARA3: - case SUN4V_CHIP_NIAGARA4: - case SUN4V_CHIP_NIAGARA5: -+ case SUN4V_CHIP_SPARC_M6: -+ case SUN4V_CHIP_SPARC_M7: - case SUN4V_CHIP_SPARC64X: - rover_inc_table = niagara_iterate_method; - break; -diff --git a/arch/sparc/kernel/ds.c b/arch/sparc/kernel/ds.c -index dff60abbea01..f87a55d77094 100644 ---- a/arch/sparc/kernel/ds.c -+++ b/arch/sparc/kernel/ds.c -@@ -1200,14 +1200,14 @@ static int ds_probe(struct vio_dev *vdev, const struct vio_device_id *id) - ds_cfg.tx_irq = vdev->tx_irq; - ds_cfg.rx_irq = vdev->rx_irq; - -- lp = ldc_alloc(vdev->channel_id, &ds_cfg, dp); -+ lp = ldc_alloc(vdev->channel_id, &ds_cfg, dp, "DS"); - if (IS_ERR(lp)) { - err = PTR_ERR(lp); - goto out_free_ds_states; - } - dp->lp = lp; - -- err = ldc_bind(lp, "DS"); -+ err = ldc_bind(lp); - if (err) - goto out_free_ldc; - -diff --git a/arch/sparc/kernel/dtlb_prot.S b/arch/sparc/kernel/dtlb_prot.S -index b2c2c5be281c..d668ca149e64 100644 ---- a/arch/sparc/kernel/dtlb_prot.S -+++ b/arch/sparc/kernel/dtlb_prot.S -@@ -24,11 +24,11 @@ - mov TLB_TAG_ACCESS, %g4 ! For reload of vaddr - - /* PROT ** ICACHE line 2: More real fault processing */ -+ ldxa [%g4] ASI_DMMU, %g5 ! Put tagaccess in %g5 - bgu,pn %xcc, winfix_trampoline ! Yes, perform winfixup -- ldxa [%g4] ASI_DMMU, %g5 ! Put tagaccess in %g5 -- ba,pt %xcc, sparc64_realfault_common ! Nope, normal fault - mov FAULT_CODE_DTLB | FAULT_CODE_WRITE, %g4 -- nop -+ ba,pt %xcc, sparc64_realfault_common ! Nope, normal fault -+ nop - nop - nop - nop -diff --git a/arch/sparc/kernel/entry.h b/arch/sparc/kernel/entry.h -index 140966fbd303..c88ffb9ee482 100644 ---- a/arch/sparc/kernel/entry.h -+++ b/arch/sparc/kernel/entry.h -@@ -66,13 +66,10 @@ struct pause_patch_entry { - extern struct pause_patch_entry __pause_3insn_patch, - __pause_3insn_patch_end; - --extern void __init per_cpu_patch(void); - extern void sun4v_patch_1insn_range(struct sun4v_1insn_patch_entry *, - struct sun4v_1insn_patch_entry *); - extern void sun4v_patch_2insn_range(struct sun4v_2insn_patch_entry *, - struct sun4v_2insn_patch_entry *); --extern void __init sun4v_patch(void); --extern void __init boot_cpu_id_too_large(int cpu); - extern unsigned int dcache_parity_tl1_occurred; - extern unsigned int icache_parity_tl1_occurred; - -diff --git a/arch/sparc/kernel/head_64.S b/arch/sparc/kernel/head_64.S -index 452f04fe8da6..3d61fcae7ee3 100644 ---- a/arch/sparc/kernel/head_64.S -+++ b/arch/sparc/kernel/head_64.S -@@ -427,6 +427,12 @@ sun4v_chip_type: - cmp %g2, '5' - be,pt %xcc, 5f - mov SUN4V_CHIP_NIAGARA5, %g4 -+ cmp %g2, '6' -+ be,pt %xcc, 5f -+ mov SUN4V_CHIP_SPARC_M6, %g4 -+ cmp %g2, '7' -+ be,pt %xcc, 5f -+ mov SUN4V_CHIP_SPARC_M7, %g4 - ba,pt %xcc, 49f - nop - -@@ -585,6 +591,12 @@ niagara_tlb_fixup: - cmp %g1, SUN4V_CHIP_NIAGARA5 - be,pt %xcc, niagara4_patch - nop -+ cmp %g1, SUN4V_CHIP_SPARC_M6 -+ be,pt %xcc, niagara4_patch -+ nop -+ cmp %g1, SUN4V_CHIP_SPARC_M7 -+ be,pt %xcc, niagara4_patch -+ nop - - call generic_patch_copyops - nop -@@ -660,14 +672,12 @@ tlb_fixup_done: - sethi %hi(init_thread_union), %g6 - or %g6, %lo(init_thread_union), %g6 - ldx [%g6 + TI_TASK], %g4 -- mov %sp, %l6 - - wr %g0, ASI_P, %asi - mov 1, %g1 - sllx %g1, THREAD_SHIFT, %g1 - sub %g1, (STACKFRAME_SZ + STACK_BIAS), %g1 - add %g6, %g1, %sp -- mov 0, %fp - - /* Set per-cpu pointer initially to zero, this makes - * the boot-cpu use the in-kernel-image per-cpu areas -@@ -694,44 +704,14 @@ tlb_fixup_done: - nop - #endif - -- mov %l6, %o1 ! OpenPROM stack - call prom_init - mov %l7, %o0 ! OpenPROM cif handler - -- /* Initialize current_thread_info()->cpu as early as possible. -- * In order to do that accurately we have to patch up the get_cpuid() -- * assembler sequences. And that, in turn, requires that we know -- * if we are on a Starfire box or not. While we're here, patch up -- * the sun4v sequences as well. -+ /* To create a one-register-window buffer between the kernel's -+ * initial stack and the last stack frame we use from the firmware, -+ * do the rest of the boot from a C helper function. - */ -- call check_if_starfire -- nop -- call per_cpu_patch -- nop -- call sun4v_patch -- nop -- --#ifdef CONFIG_SMP -- call hard_smp_processor_id -- nop -- cmp %o0, NR_CPUS -- blu,pt %xcc, 1f -- nop -- call boot_cpu_id_too_large -- nop -- /* Not reached... */ -- --1: --#else -- mov 0, %o0 --#endif -- sth %o0, [%g6 + TI_CPU] -- -- call prom_init_report -- nop -- -- /* Off we go.... */ -- call start_kernel -+ call start_early_boot - nop - /* Not reached... */ - -diff --git a/arch/sparc/kernel/hvapi.c b/arch/sparc/kernel/hvapi.c -index c0a2de0fd624..5c55145bfbf0 100644 ---- a/arch/sparc/kernel/hvapi.c -+++ b/arch/sparc/kernel/hvapi.c -@@ -46,6 +46,7 @@ static struct api_info api_table[] = { - { .group = HV_GRP_VF_CPU, }, - { .group = HV_GRP_KT_CPU, }, - { .group = HV_GRP_VT_CPU, }, -+ { .group = HV_GRP_T5_CPU, }, - { .group = HV_GRP_DIAG, .flags = FLAG_PRE_API }, - }; - -diff --git a/arch/sparc/kernel/hvcalls.S b/arch/sparc/kernel/hvcalls.S -index f3ab509b76a8..caedf8320416 100644 ---- a/arch/sparc/kernel/hvcalls.S -+++ b/arch/sparc/kernel/hvcalls.S -@@ -821,3 +821,19 @@ ENTRY(sun4v_vt_set_perfreg) - retl - nop - ENDPROC(sun4v_vt_set_perfreg) -+ -+ENTRY(sun4v_t5_get_perfreg) -+ mov %o1, %o4 -+ mov HV_FAST_T5_GET_PERFREG, %o5 -+ ta HV_FAST_TRAP -+ stx %o1, [%o4] -+ retl -+ nop -+ENDPROC(sun4v_t5_get_perfreg) -+ -+ENTRY(sun4v_t5_set_perfreg) -+ mov HV_FAST_T5_SET_PERFREG, %o5 -+ ta HV_FAST_TRAP -+ retl -+ nop -+ENDPROC(sun4v_t5_set_perfreg) -diff --git a/arch/sparc/kernel/hvtramp.S b/arch/sparc/kernel/hvtramp.S -index b7ddcdd1dea9..cdbfec299f2f 100644 ---- a/arch/sparc/kernel/hvtramp.S -+++ b/arch/sparc/kernel/hvtramp.S -@@ -109,7 +109,6 @@ hv_cpu_startup: - sllx %g5, THREAD_SHIFT, %g5 - sub %g5, (STACKFRAME_SZ + STACK_BIAS), %g5 - add %g6, %g5, %sp -- mov 0, %fp - - call init_irqwork_curcpu - nop -diff --git a/arch/sparc/kernel/ioport.c b/arch/sparc/kernel/ioport.c -index e7e215dfa866..c2d81ad62e78 100644 ---- a/arch/sparc/kernel/ioport.c -+++ b/arch/sparc/kernel/ioport.c -@@ -278,7 +278,8 @@ static void *sbus_alloc_coherent(struct device *dev, size_t len, - } - - order = get_order(len_total); -- if ((va = __get_free_pages(GFP_KERNEL|__GFP_COMP, order)) == 0) -+ va = __get_free_pages(gfp, order); -+ if (va == 0) - goto err_nopages; - - if ((res = kzalloc(sizeof(struct resource), GFP_KERNEL)) == NULL) -@@ -443,7 +444,7 @@ static void *pci32_alloc_coherent(struct device *dev, size_t len, - } - - order = get_order(len_total); -- va = (void *) __get_free_pages(GFP_KERNEL, order); -+ va = (void *) __get_free_pages(gfp, order); - if (va == NULL) { - printk("pci_alloc_consistent: no %ld pages\n", len_total>>PAGE_SHIFT); - goto err_nopages; -diff --git a/arch/sparc/kernel/irq_64.c b/arch/sparc/kernel/irq_64.c -index 666193f4e8bb..4033c23bdfa6 100644 ---- a/arch/sparc/kernel/irq_64.c -+++ b/arch/sparc/kernel/irq_64.c -@@ -47,8 +47,6 @@ - #include "cpumap.h" - #include "kstack.h" - --#define NUM_IVECS (IMAP_INR + 1) -- - struct ino_bucket *ivector_table; - unsigned long ivector_table_pa; - -@@ -107,55 +105,196 @@ static void bucket_set_irq(unsigned long bucket_pa, unsigned int irq) - - #define irq_work_pa(__cpu) &(trap_block[(__cpu)].irq_worklist_pa) - --static struct { -- unsigned int dev_handle; -- unsigned int dev_ino; -- unsigned int in_use; --} irq_table[NR_IRQS]; --static DEFINE_SPINLOCK(irq_alloc_lock); -+static unsigned long hvirq_major __initdata; -+static int __init early_hvirq_major(char *p) -+{ -+ int rc = kstrtoul(p, 10, &hvirq_major); -+ -+ return rc; -+} -+early_param("hvirq", early_hvirq_major); -+ -+static int hv_irq_version; -+ -+/* Major version 2.0 of HV_GRP_INTR added support for the VIRQ cookie -+ * based interfaces, but: -+ * -+ * 1) Several OSs, Solaris and Linux included, use them even when only -+ * negotiating version 1.0 (or failing to negotiate at all). So the -+ * hypervisor has a workaround that provides the VIRQ interfaces even -+ * when only verion 1.0 of the API is in use. -+ * -+ * 2) Second, and more importantly, with major version 2.0 these VIRQ -+ * interfaces only were actually hooked up for LDC interrupts, even -+ * though the Hypervisor specification clearly stated: -+ * -+ * The new interrupt API functions will be available to a guest -+ * when it negotiates version 2.0 in the interrupt API group 0x2. When -+ * a guest negotiates version 2.0, all interrupt sources will only -+ * support using the cookie interface, and any attempt to use the -+ * version 1.0 interrupt APIs numbered 0xa0 to 0xa6 will result in the -+ * ENOTSUPPORTED error being returned. -+ * -+ * with an emphasis on "all interrupt sources". -+ * -+ * To correct this, major version 3.0 was created which does actually -+ * support VIRQs for all interrupt sources (not just LDC devices). So -+ * if we want to move completely over the cookie based VIRQs we must -+ * negotiate major version 3.0 or later of HV_GRP_INTR. -+ */ -+static bool sun4v_cookie_only_virqs(void) -+{ -+ if (hv_irq_version >= 3) -+ return true; -+ return false; -+} - --unsigned char irq_alloc(unsigned int dev_handle, unsigned int dev_ino) -+static void __init irq_init_hv(void) - { -- unsigned long flags; -- unsigned char ent; -+ unsigned long hv_error, major, minor = 0; -+ -+ if (tlb_type != hypervisor) -+ return; - -- BUILD_BUG_ON(NR_IRQS >= 256); -+ if (hvirq_major) -+ major = hvirq_major; -+ else -+ major = 3; - -- spin_lock_irqsave(&irq_alloc_lock, flags); -+ hv_error = sun4v_hvapi_register(HV_GRP_INTR, major, &minor); -+ if (!hv_error) -+ hv_irq_version = major; -+ else -+ hv_irq_version = 1; - -- for (ent = 1; ent < NR_IRQS; ent++) { -- if (!irq_table[ent].in_use) -+ pr_info("SUN4V: Using IRQ API major %d, cookie only virqs %s\n", -+ hv_irq_version, -+ sun4v_cookie_only_virqs() ? "enabled" : "disabled"); -+} -+ -+/* This function is for the timer interrupt.*/ -+int __init arch_probe_nr_irqs(void) -+{ -+ return 1; -+} -+ -+#define DEFAULT_NUM_IVECS (0xfffU) -+static unsigned int nr_ivec = DEFAULT_NUM_IVECS; -+#define NUM_IVECS (nr_ivec) -+ -+static unsigned int __init size_nr_ivec(void) -+{ -+ if (tlb_type == hypervisor) { -+ switch (sun4v_chip_type) { -+ /* Athena's devhandle|devino is large.*/ -+ case SUN4V_CHIP_SPARC64X: -+ nr_ivec = 0xffff; - break; -+ } - } -- if (ent >= NR_IRQS) { -- printk(KERN_ERR "IRQ: Out of virtual IRQs.\n"); -- ent = 0; -- } else { -- irq_table[ent].dev_handle = dev_handle; -- irq_table[ent].dev_ino = dev_ino; -- irq_table[ent].in_use = 1; -- } -+ return nr_ivec; -+} -+ -+struct irq_handler_data { -+ union { -+ struct { -+ unsigned int dev_handle; -+ unsigned int dev_ino; -+ }; -+ unsigned long sysino; -+ }; -+ struct ino_bucket bucket; -+ unsigned long iclr; -+ unsigned long imap; -+}; -+ -+static inline unsigned int irq_data_to_handle(struct irq_data *data) -+{ -+ struct irq_handler_data *ihd = data->handler_data; -+ -+ return ihd->dev_handle; -+} -+ -+static inline unsigned int irq_data_to_ino(struct irq_data *data) -+{ -+ struct irq_handler_data *ihd = data->handler_data; - -- spin_unlock_irqrestore(&irq_alloc_lock, flags); -+ return ihd->dev_ino; -+} -+ -+static inline unsigned long irq_data_to_sysino(struct irq_data *data) -+{ -+ struct irq_handler_data *ihd = data->handler_data; - -- return ent; -+ return ihd->sysino; - } - --#ifdef CONFIG_PCI_MSI - void irq_free(unsigned int irq) - { -- unsigned long flags; -+ void *data = irq_get_handler_data(irq); - -- if (irq >= NR_IRQS) -- return; -+ kfree(data); -+ irq_set_handler_data(irq, NULL); -+ irq_free_descs(irq, 1); -+} - -- spin_lock_irqsave(&irq_alloc_lock, flags); -+unsigned int irq_alloc(unsigned int dev_handle, unsigned int dev_ino) -+{ -+ int irq; - -- irq_table[irq].in_use = 0; -+ irq = __irq_alloc_descs(-1, 1, 1, numa_node_id(), NULL); -+ if (irq <= 0) -+ goto out; - -- spin_unlock_irqrestore(&irq_alloc_lock, flags); -+ return irq; -+out: -+ return 0; -+} -+ -+static unsigned int cookie_exists(u32 devhandle, unsigned int devino) -+{ -+ unsigned long hv_err, cookie; -+ struct ino_bucket *bucket; -+ unsigned int irq = 0U; -+ -+ hv_err = sun4v_vintr_get_cookie(devhandle, devino, &cookie); -+ if (hv_err) { -+ pr_err("HV get cookie failed hv_err = %ld\n", hv_err); -+ goto out; -+ } -+ -+ if (cookie & ((1UL << 63UL))) { -+ cookie = ~cookie; -+ bucket = (struct ino_bucket *) __va(cookie); -+ irq = bucket->__irq; -+ } -+out: -+ return irq; -+} -+ -+static unsigned int sysino_exists(u32 devhandle, unsigned int devino) -+{ -+ unsigned long sysino = sun4v_devino_to_sysino(devhandle, devino); -+ struct ino_bucket *bucket; -+ unsigned int irq; -+ -+ bucket = &ivector_table[sysino]; -+ irq = bucket_get_irq(__pa(bucket)); -+ -+ return irq; -+} -+ -+void ack_bad_irq(unsigned int irq) -+{ -+ pr_crit("BAD IRQ ack %d\n", irq); -+} -+ -+void irq_install_pre_handler(int irq, -+ void (*func)(unsigned int, void *, void *), -+ void *arg1, void *arg2) -+{ -+ pr_warn("IRQ pre handler NOT supported.\n"); - } --#endif - - /* - * /proc/interrupts printing: -@@ -206,15 +345,6 @@ static unsigned int sun4u_compute_tid(unsigned long imap, unsigned long cpuid) - return tid; - } - --struct irq_handler_data { -- unsigned long iclr; -- unsigned long imap; -- -- void (*pre_handler)(unsigned int, void *, void *); -- void *arg1; -- void *arg2; --}; -- - #ifdef CONFIG_SMP - static int irq_choose_cpu(unsigned int irq, const struct cpumask *affinity) - { -@@ -316,8 +446,8 @@ static void sun4u_irq_eoi(struct irq_data *data) - - static void sun4v_irq_enable(struct irq_data *data) - { -- unsigned int ino = irq_table[data->irq].dev_ino; - unsigned long cpuid = irq_choose_cpu(data->irq, data->affinity); -+ unsigned int ino = irq_data_to_sysino(data); - int err; - - err = sun4v_intr_settarget(ino, cpuid); -@@ -337,8 +467,8 @@ static void sun4v_irq_enable(struct irq_data *data) - static int sun4v_set_affinity(struct irq_data *data, - const struct cpumask *mask, bool force) - { -- unsigned int ino = irq_table[data->irq].dev_ino; - unsigned long cpuid = irq_choose_cpu(data->irq, mask); -+ unsigned int ino = irq_data_to_sysino(data); - int err; - - err = sun4v_intr_settarget(ino, cpuid); -@@ -351,7 +481,7 @@ static int sun4v_set_affinity(struct irq_data *data, - - static void sun4v_irq_disable(struct irq_data *data) - { -- unsigned int ino = irq_table[data->irq].dev_ino; -+ unsigned int ino = irq_data_to_sysino(data); - int err; - - err = sun4v_intr_setenabled(ino, HV_INTR_DISABLED); -@@ -362,7 +492,7 @@ static void sun4v_irq_disable(struct irq_data *data) - - static void sun4v_irq_eoi(struct irq_data *data) - { -- unsigned int ino = irq_table[data->irq].dev_ino; -+ unsigned int ino = irq_data_to_sysino(data); - int err; - - err = sun4v_intr_setstate(ino, HV_INTR_STATE_IDLE); -@@ -373,14 +503,13 @@ static void sun4v_irq_eoi(struct irq_data *data) - - static void sun4v_virq_enable(struct irq_data *data) - { -- unsigned long cpuid, dev_handle, dev_ino; -+ unsigned long dev_handle = irq_data_to_handle(data); -+ unsigned long dev_ino = irq_data_to_ino(data); -+ unsigned long cpuid; - int err; - - cpuid = irq_choose_cpu(data->irq, data->affinity); - -- dev_handle = irq_table[data->irq].dev_handle; -- dev_ino = irq_table[data->irq].dev_ino; -- - err = sun4v_vintr_set_target(dev_handle, dev_ino, cpuid); - if (err != HV_EOK) - printk(KERN_ERR "sun4v_vintr_set_target(%lx,%lx,%lu): " -@@ -403,14 +532,13 @@ static void sun4v_virq_enable(struct irq_data *data) - static int sun4v_virt_set_affinity(struct irq_data *data, - const struct cpumask *mask, bool force) - { -- unsigned long cpuid, dev_handle, dev_ino; -+ unsigned long dev_handle = irq_data_to_handle(data); -+ unsigned long dev_ino = irq_data_to_ino(data); -+ unsigned long cpuid; - int err; - - cpuid = irq_choose_cpu(data->irq, mask); - -- dev_handle = irq_table[data->irq].dev_handle; -- dev_ino = irq_table[data->irq].dev_ino; -- - err = sun4v_vintr_set_target(dev_handle, dev_ino, cpuid); - if (err != HV_EOK) - printk(KERN_ERR "sun4v_vintr_set_target(%lx,%lx,%lu): " -@@ -422,11 +550,10 @@ static int sun4v_virt_set_affinity(struct irq_data *data, - - static void sun4v_virq_disable(struct irq_data *data) - { -- unsigned long dev_handle, dev_ino; -+ unsigned long dev_handle = irq_data_to_handle(data); -+ unsigned long dev_ino = irq_data_to_ino(data); - int err; - -- dev_handle = irq_table[data->irq].dev_handle; -- dev_ino = irq_table[data->irq].dev_ino; - - err = sun4v_vintr_set_valid(dev_handle, dev_ino, - HV_INTR_DISABLED); -@@ -438,12 +565,10 @@ static void sun4v_virq_disable(struct irq_data *data) - - static void sun4v_virq_eoi(struct irq_data *data) - { -- unsigned long dev_handle, dev_ino; -+ unsigned long dev_handle = irq_data_to_handle(data); -+ unsigned long dev_ino = irq_data_to_ino(data); - int err; - -- dev_handle = irq_table[data->irq].dev_handle; -- dev_ino = irq_table[data->irq].dev_ino; -- - err = sun4v_vintr_set_state(dev_handle, dev_ino, - HV_INTR_STATE_IDLE); - if (err != HV_EOK) -@@ -479,31 +604,10 @@ static struct irq_chip sun4v_virq = { - .flags = IRQCHIP_EOI_IF_HANDLED, - }; - --static void pre_flow_handler(struct irq_data *d) --{ -- struct irq_handler_data *handler_data = irq_data_get_irq_handler_data(d); -- unsigned int ino = irq_table[d->irq].dev_ino; -- -- handler_data->pre_handler(ino, handler_data->arg1, handler_data->arg2); --} -- --void irq_install_pre_handler(int irq, -- void (*func)(unsigned int, void *, void *), -- void *arg1, void *arg2) --{ -- struct irq_handler_data *handler_data = irq_get_handler_data(irq); -- -- handler_data->pre_handler = func; -- handler_data->arg1 = arg1; -- handler_data->arg2 = arg2; -- -- __irq_set_preflow_handler(irq, pre_flow_handler); --} -- - unsigned int build_irq(int inofixup, unsigned long iclr, unsigned long imap) - { -- struct ino_bucket *bucket; - struct irq_handler_data *handler_data; -+ struct ino_bucket *bucket; - unsigned int irq; - int ino; - -@@ -537,119 +641,166 @@ out: - return irq; - } - --static unsigned int sun4v_build_common(unsigned long sysino, -- struct irq_chip *chip) -+static unsigned int sun4v_build_common(u32 devhandle, unsigned int devino, -+ void (*handler_data_init)(struct irq_handler_data *data, -+ u32 devhandle, unsigned int devino), -+ struct irq_chip *chip) - { -- struct ino_bucket *bucket; -- struct irq_handler_data *handler_data; -+ struct irq_handler_data *data; - unsigned int irq; - -- BUG_ON(tlb_type != hypervisor); -+ irq = irq_alloc(devhandle, devino); -+ if (!irq) -+ goto out; - -- bucket = &ivector_table[sysino]; -- irq = bucket_get_irq(__pa(bucket)); -- if (!irq) { -- irq = irq_alloc(0, sysino); -- bucket_set_irq(__pa(bucket), irq); -- irq_set_chip_and_handler_name(irq, chip, handle_fasteoi_irq, -- "IVEC"); -+ data = kzalloc(sizeof(struct irq_handler_data), GFP_ATOMIC); -+ if (unlikely(!data)) { -+ pr_err("IRQ handler data allocation failed.\n"); -+ irq_free(irq); -+ irq = 0; -+ goto out; - } - -- handler_data = irq_get_handler_data(irq); -- if (unlikely(handler_data)) -- goto out; -+ irq_set_handler_data(irq, data); -+ handler_data_init(data, devhandle, devino); -+ irq_set_chip_and_handler_name(irq, chip, handle_fasteoi_irq, "IVEC"); -+ data->imap = ~0UL; -+ data->iclr = ~0UL; -+out: -+ return irq; -+} - -- handler_data = kzalloc(sizeof(struct irq_handler_data), GFP_ATOMIC); -- if (unlikely(!handler_data)) { -- prom_printf("IRQ: kzalloc(irq_handler_data) failed.\n"); -- prom_halt(); -- } -- irq_set_handler_data(irq, handler_data); -+static unsigned long cookie_assign(unsigned int irq, u32 devhandle, -+ unsigned int devino) -+{ -+ struct irq_handler_data *ihd = irq_get_handler_data(irq); -+ unsigned long hv_error, cookie; - -- /* Catch accidental accesses to these things. IMAP/ICLR handling -- * is done by hypervisor calls on sun4v platforms, not by direct -- * register accesses. -+ /* handler_irq needs to find the irq. cookie is seen signed in -+ * sun4v_dev_mondo and treated as a non ivector_table delivery. - */ -- handler_data->imap = ~0UL; -- handler_data->iclr = ~0UL; -+ ihd->bucket.__irq = irq; -+ cookie = ~__pa(&ihd->bucket); - --out: -- return irq; -+ hv_error = sun4v_vintr_set_cookie(devhandle, devino, cookie); -+ if (hv_error) -+ pr_err("HV vintr set cookie failed = %ld\n", hv_error); -+ -+ return hv_error; - } - --unsigned int sun4v_build_irq(u32 devhandle, unsigned int devino) -+static void cookie_handler_data(struct irq_handler_data *data, -+ u32 devhandle, unsigned int devino) - { -- unsigned long sysino = sun4v_devino_to_sysino(devhandle, devino); -+ data->dev_handle = devhandle; -+ data->dev_ino = devino; -+} - -- return sun4v_build_common(sysino, &sun4v_irq); -+static unsigned int cookie_build_irq(u32 devhandle, unsigned int devino, -+ struct irq_chip *chip) -+{ -+ unsigned long hv_error; -+ unsigned int irq; -+ -+ irq = sun4v_build_common(devhandle, devino, cookie_handler_data, chip); -+ -+ hv_error = cookie_assign(irq, devhandle, devino); -+ if (hv_error) { -+ irq_free(irq); -+ irq = 0; -+ } -+ -+ return irq; - } - --unsigned int sun4v_build_virq(u32 devhandle, unsigned int devino) -+static unsigned int sun4v_build_cookie(u32 devhandle, unsigned int devino) - { -- struct irq_handler_data *handler_data; -- unsigned long hv_err, cookie; -- struct ino_bucket *bucket; - unsigned int irq; - -- bucket = kzalloc(sizeof(struct ino_bucket), GFP_ATOMIC); -- if (unlikely(!bucket)) -- return 0; -+ irq = cookie_exists(devhandle, devino); -+ if (irq) -+ goto out; - -- /* The only reference we store to the IRQ bucket is -- * by physical address which kmemleak can't see, tell -- * it that this object explicitly is not a leak and -- * should be scanned. -- */ -- kmemleak_not_leak(bucket); -+ irq = cookie_build_irq(devhandle, devino, &sun4v_virq); - -- __flush_dcache_range((unsigned long) bucket, -- ((unsigned long) bucket + -- sizeof(struct ino_bucket))); -+out: -+ return irq; -+} - -- irq = irq_alloc(devhandle, devino); -+static void sysino_set_bucket(unsigned int irq) -+{ -+ struct irq_handler_data *ihd = irq_get_handler_data(irq); -+ struct ino_bucket *bucket; -+ unsigned long sysino; -+ -+ sysino = sun4v_devino_to_sysino(ihd->dev_handle, ihd->dev_ino); -+ BUG_ON(sysino >= nr_ivec); -+ bucket = &ivector_table[sysino]; - bucket_set_irq(__pa(bucket), irq); -+} - -- irq_set_chip_and_handler_name(irq, &sun4v_virq, handle_fasteoi_irq, -- "IVEC"); -+static void sysino_handler_data(struct irq_handler_data *data, -+ u32 devhandle, unsigned int devino) -+{ -+ unsigned long sysino; - -- handler_data = kzalloc(sizeof(struct irq_handler_data), GFP_ATOMIC); -- if (unlikely(!handler_data)) -- return 0; -+ sysino = sun4v_devino_to_sysino(devhandle, devino); -+ data->sysino = sysino; -+} - -- /* In order to make the LDC channel startup sequence easier, -- * especially wrt. locking, we do not let request_irq() enable -- * the interrupt. -- */ -- irq_set_status_flags(irq, IRQ_NOAUTOEN); -- irq_set_handler_data(irq, handler_data); -+static unsigned int sysino_build_irq(u32 devhandle, unsigned int devino, -+ struct irq_chip *chip) -+{ -+ unsigned int irq; - -- /* Catch accidental accesses to these things. IMAP/ICLR handling -- * is done by hypervisor calls on sun4v platforms, not by direct -- * register accesses. -- */ -- handler_data->imap = ~0UL; -- handler_data->iclr = ~0UL; -+ irq = sun4v_build_common(devhandle, devino, sysino_handler_data, chip); -+ if (!irq) -+ goto out; - -- cookie = ~__pa(bucket); -- hv_err = sun4v_vintr_set_cookie(devhandle, devino, cookie); -- if (hv_err) { -- prom_printf("IRQ: Fatal, cannot set cookie for [%x:%x] " -- "err=%lu\n", devhandle, devino, hv_err); -- prom_halt(); -- } -+ sysino_set_bucket(irq); -+out: -+ return irq; -+} - -+static int sun4v_build_sysino(u32 devhandle, unsigned int devino) -+{ -+ int irq; -+ -+ irq = sysino_exists(devhandle, devino); -+ if (irq) -+ goto out; -+ -+ irq = sysino_build_irq(devhandle, devino, &sun4v_irq); -+out: - return irq; - } - --void ack_bad_irq(unsigned int irq) -+unsigned int sun4v_build_irq(u32 devhandle, unsigned int devino) - { -- unsigned int ino = irq_table[irq].dev_ino; -+ unsigned int irq; - -- if (!ino) -- ino = 0xdeadbeef; -+ if (sun4v_cookie_only_virqs()) -+ irq = sun4v_build_cookie(devhandle, devino); -+ else -+ irq = sun4v_build_sysino(devhandle, devino); - -- printk(KERN_CRIT "Unexpected IRQ from ino[%x] irq[%u]\n", -- ino, irq); -+ return irq; -+} -+ -+unsigned int sun4v_build_virq(u32 devhandle, unsigned int devino) -+{ -+ int irq; -+ -+ irq = cookie_build_irq(devhandle, devino, &sun4v_virq); -+ if (!irq) -+ goto out; -+ -+ /* This is borrowed from the original function. -+ */ -+ irq_set_status_flags(irq, IRQ_NOAUTOEN); -+ -+out: -+ return irq; - } - - void *hardirq_stack[NR_CPUS]; -@@ -720,9 +871,12 @@ void fixup_irqs(void) - - for (irq = 0; irq < NR_IRQS; irq++) { - struct irq_desc *desc = irq_to_desc(irq); -- struct irq_data *data = irq_desc_get_irq_data(desc); -+ struct irq_data *data; - unsigned long flags; - -+ if (!desc) -+ continue; -+ data = irq_desc_get_irq_data(desc); - raw_spin_lock_irqsave(&desc->lock, flags); - if (desc->action && !irqd_is_per_cpu(data)) { - if (data->chip->irq_set_affinity) -@@ -922,16 +1076,22 @@ static struct irqaction timer_irq_action = { - .name = "timer", - }; - --/* Only invoked on boot processor. */ --void __init init_IRQ(void) -+static void __init irq_ivector_init(void) - { -- unsigned long size; -+ unsigned long size, order; -+ unsigned int ivecs; - -- map_prom_timers(); -- kill_prom_timer(); -+ /* If we are doing cookie only VIRQs then we do not need the ivector -+ * table to process interrupts. -+ */ -+ if (sun4v_cookie_only_virqs()) -+ return; - -- size = sizeof(struct ino_bucket) * NUM_IVECS; -- ivector_table = kzalloc(size, GFP_KERNEL); -+ ivecs = size_nr_ivec(); -+ size = sizeof(struct ino_bucket) * ivecs; -+ order = get_order(size); -+ ivector_table = (struct ino_bucket *) -+ __get_free_pages(GFP_KERNEL | __GFP_ZERO, order); - if (!ivector_table) { - prom_printf("Fatal error, cannot allocate ivector_table\n"); - prom_halt(); -@@ -940,6 +1100,15 @@ void __init init_IRQ(void) - ((unsigned long) ivector_table) + size); - - ivector_table_pa = __pa(ivector_table); -+} -+ -+/* Only invoked on boot processor.*/ -+void __init init_IRQ(void) -+{ -+ irq_init_hv(); -+ irq_ivector_init(); -+ map_prom_timers(); -+ kill_prom_timer(); - - if (tlb_type == hypervisor) - sun4v_init_mondo_queues(); -diff --git a/arch/sparc/kernel/ktlb.S b/arch/sparc/kernel/ktlb.S -index 605d49204580..ef0d8e9e1210 100644 ---- a/arch/sparc/kernel/ktlb.S -+++ b/arch/sparc/kernel/ktlb.S -@@ -47,14 +47,6 @@ kvmap_itlb_vmalloc_addr: - KERN_PGTABLE_WALK(%g4, %g5, %g2, kvmap_itlb_longpath) - - TSB_LOCK_TAG(%g1, %g2, %g7) -- -- /* Load and check PTE. */ -- ldxa [%g5] ASI_PHYS_USE_EC, %g5 -- mov 1, %g7 -- sllx %g7, TSB_TAG_INVALID_BIT, %g7 -- brgez,a,pn %g5, kvmap_itlb_longpath -- TSB_STORE(%g1, %g7) -- - TSB_WRITE(%g1, %g5, %g6) - - /* fallthrough to TLB load */ -@@ -118,6 +110,12 @@ kvmap_dtlb_obp: - ba,pt %xcc, kvmap_dtlb_load - nop - -+kvmap_linear_early: -+ sethi %hi(kern_linear_pte_xor), %g7 -+ ldx [%g7 + %lo(kern_linear_pte_xor)], %g2 -+ ba,pt %xcc, kvmap_dtlb_tsb4m_load -+ xor %g2, %g4, %g5 -+ - .align 32 - kvmap_dtlb_tsb4m_load: - TSB_LOCK_TAG(%g1, %g2, %g7) -@@ -146,105 +144,17 @@ kvmap_dtlb_4v: - /* Correct TAG_TARGET is already in %g6, check 4mb TSB. */ - KERN_TSB4M_LOOKUP_TL1(%g6, %g5, %g1, %g2, %g3, kvmap_dtlb_load) - #endif -- /* TSB entry address left in %g1, lookup linear PTE. -- * Must preserve %g1 and %g6 (TAG). -- */ --kvmap_dtlb_tsb4m_miss: -- /* Clear the PAGE_OFFSET top virtual bits, shift -- * down to get PFN, and make sure PFN is in range. -- */ --661: sllx %g4, 0, %g5 -- .section .page_offset_shift_patch, "ax" -- .word 661b -- .previous -- -- /* Check to see if we know about valid memory at the 4MB -- * chunk this physical address will reside within. -+ /* Linear mapping TSB lookup failed. Fallthrough to kernel -+ * page table based lookup. - */ --661: srlx %g5, MAX_PHYS_ADDRESS_BITS, %g2 -- .section .page_offset_shift_patch, "ax" -- .word 661b -- .previous -- -- brnz,pn %g2, kvmap_dtlb_longpath -- nop -- -- /* This unconditional branch and delay-slot nop gets patched -- * by the sethi sequence once the bitmap is properly setup. -- */ -- .globl valid_addr_bitmap_insn --valid_addr_bitmap_insn: -- ba,pt %xcc, 2f -- nop -- .subsection 2 -- .globl valid_addr_bitmap_patch --valid_addr_bitmap_patch: -- sethi %hi(sparc64_valid_addr_bitmap), %g7 -- or %g7, %lo(sparc64_valid_addr_bitmap), %g7 -- .previous -- --661: srlx %g5, ILOG2_4MB, %g2 -- .section .page_offset_shift_patch, "ax" -- .word 661b -- .previous -- -- srlx %g2, 6, %g5 -- and %g2, 63, %g2 -- sllx %g5, 3, %g5 -- ldx [%g7 + %g5], %g5 -- mov 1, %g7 -- sllx %g7, %g2, %g7 -- andcc %g5, %g7, %g0 -- be,pn %xcc, kvmap_dtlb_longpath -- --2: sethi %hi(kpte_linear_bitmap), %g2 -- -- /* Get the 256MB physical address index. */ --661: sllx %g4, 0, %g5 -- .section .page_offset_shift_patch, "ax" -- .word 661b -- .previous -- -- or %g2, %lo(kpte_linear_bitmap), %g2 -- --661: srlx %g5, ILOG2_256MB, %g5 -- .section .page_offset_shift_patch, "ax" -- .word 661b -- .previous -- -- and %g5, (32 - 1), %g7 -- -- /* Divide by 32 to get the offset into the bitmask. */ -- srlx %g5, 5, %g5 -- add %g7, %g7, %g7 -- sllx %g5, 3, %g5 -- -- /* kern_linear_pte_xor[(mask >> shift) & 3)] */ -- ldx [%g2 + %g5], %g2 -- srlx %g2, %g7, %g7 -- sethi %hi(kern_linear_pte_xor), %g5 -- and %g7, 3, %g7 -- or %g5, %lo(kern_linear_pte_xor), %g5 -- sllx %g7, 3, %g7 -- ldx [%g5 + %g7], %g2 -- - .globl kvmap_linear_patch - kvmap_linear_patch: -- ba,pt %xcc, kvmap_dtlb_tsb4m_load -- xor %g2, %g4, %g5 -+ ba,a,pt %xcc, kvmap_linear_early - - kvmap_dtlb_vmalloc_addr: - KERN_PGTABLE_WALK(%g4, %g5, %g2, kvmap_dtlb_longpath) - - TSB_LOCK_TAG(%g1, %g2, %g7) -- -- /* Load and check PTE. */ -- ldxa [%g5] ASI_PHYS_USE_EC, %g5 -- mov 1, %g7 -- sllx %g7, TSB_TAG_INVALID_BIT, %g7 -- brgez,a,pn %g5, kvmap_dtlb_longpath -- TSB_STORE(%g1, %g7) -- - TSB_WRITE(%g1, %g5, %g6) - - /* fallthrough to TLB load */ -@@ -276,13 +186,8 @@ kvmap_dtlb_load: - - #ifdef CONFIG_SPARSEMEM_VMEMMAP - kvmap_vmemmap: -- sub %g4, %g5, %g5 -- srlx %g5, ILOG2_4MB, %g5 -- sethi %hi(vmemmap_table), %g1 -- sllx %g5, 3, %g5 -- or %g1, %lo(vmemmap_table), %g1 -- ba,pt %xcc, kvmap_dtlb_load -- ldx [%g1 + %g5], %g5 -+ KERN_PGTABLE_WALK(%g4, %g5, %g2, kvmap_dtlb_longpath) -+ ba,a,pt %xcc, kvmap_dtlb_load - #endif - - kvmap_dtlb_nonlinear: -@@ -294,8 +199,8 @@ kvmap_dtlb_nonlinear: - - #ifdef CONFIG_SPARSEMEM_VMEMMAP - /* Do not use the TSB for vmemmap. */ -- mov (VMEMMAP_BASE >> 40), %g5 -- sllx %g5, 40, %g5 -+ sethi %hi(VMEMMAP_BASE), %g5 -+ ldx [%g5 + %lo(VMEMMAP_BASE)], %g5 - cmp %g4,%g5 - bgeu,pn %xcc, kvmap_vmemmap - nop -@@ -307,8 +212,8 @@ kvmap_dtlb_tsbmiss: - sethi %hi(MODULES_VADDR), %g5 - cmp %g4, %g5 - blu,pn %xcc, kvmap_dtlb_longpath -- mov (VMALLOC_END >> 40), %g5 -- sllx %g5, 40, %g5 -+ sethi %hi(VMALLOC_END), %g5 -+ ldx [%g5 + %lo(VMALLOC_END)], %g5 - cmp %g4, %g5 - bgeu,pn %xcc, kvmap_dtlb_longpath - nop -diff --git a/arch/sparc/kernel/ldc.c b/arch/sparc/kernel/ldc.c -index 66dacd56bb10..27bb55485472 100644 ---- a/arch/sparc/kernel/ldc.c -+++ b/arch/sparc/kernel/ldc.c -@@ -1078,7 +1078,8 @@ static void ldc_iommu_release(struct ldc_channel *lp) - - struct ldc_channel *ldc_alloc(unsigned long id, - const struct ldc_channel_config *cfgp, -- void *event_arg) -+ void *event_arg, -+ const char *name) - { - struct ldc_channel *lp; - const struct ldc_mode_ops *mops; -@@ -1093,6 +1094,8 @@ struct ldc_channel *ldc_alloc(unsigned long id, - err = -EINVAL; - if (!cfgp) - goto out_err; -+ if (!name) -+ goto out_err; - - switch (cfgp->mode) { - case LDC_MODE_RAW: -@@ -1185,6 +1188,21 @@ struct ldc_channel *ldc_alloc(unsigned long id, - - INIT_HLIST_HEAD(&lp->mh_list); - -+ snprintf(lp->rx_irq_name, LDC_IRQ_NAME_MAX, "%s RX", name); -+ snprintf(lp->tx_irq_name, LDC_IRQ_NAME_MAX, "%s TX", name); -+ -+ err = request_irq(lp->cfg.rx_irq, ldc_rx, 0, -+ lp->rx_irq_name, lp); -+ if (err) -+ goto out_free_txq; -+ -+ err = request_irq(lp->cfg.tx_irq, ldc_tx, 0, -+ lp->tx_irq_name, lp); -+ if (err) { -+ free_irq(lp->cfg.rx_irq, lp); -+ goto out_free_txq; -+ } -+ - return lp; - - out_free_txq: -@@ -1237,31 +1255,14 @@ EXPORT_SYMBOL(ldc_free); - * state. This does not initiate a handshake, ldc_connect() does - * that. - */ --int ldc_bind(struct ldc_channel *lp, const char *name) -+int ldc_bind(struct ldc_channel *lp) - { - unsigned long hv_err, flags; - int err = -EINVAL; - -- if (!name || -- (lp->state != LDC_STATE_INIT)) -+ if (lp->state != LDC_STATE_INIT) - return -EINVAL; - -- snprintf(lp->rx_irq_name, LDC_IRQ_NAME_MAX, "%s RX", name); -- snprintf(lp->tx_irq_name, LDC_IRQ_NAME_MAX, "%s TX", name); -- -- err = request_irq(lp->cfg.rx_irq, ldc_rx, 0, -- lp->rx_irq_name, lp); -- if (err) -- return err; -- -- err = request_irq(lp->cfg.tx_irq, ldc_tx, 0, -- lp->tx_irq_name, lp); -- if (err) { -- free_irq(lp->cfg.rx_irq, lp); -- return err; -- } -- -- - spin_lock_irqsave(&lp->lock, flags); - - enable_irq(lp->cfg.rx_irq); -diff --git a/arch/sparc/kernel/nmi.c b/arch/sparc/kernel/nmi.c -index 6479256fd5a4..fce8ab17bcbb 100644 ---- a/arch/sparc/kernel/nmi.c -+++ b/arch/sparc/kernel/nmi.c -@@ -141,7 +141,6 @@ static inline unsigned int get_nmi_count(int cpu) - - static __init void nmi_cpu_busy(void *data) - { -- local_irq_enable_in_hardirq(); - while (endflag == 0) - mb(); - } -diff --git a/arch/sparc/kernel/pcr.c b/arch/sparc/kernel/pcr.c -index 269af58497aa..7e967c8018c8 100644 ---- a/arch/sparc/kernel/pcr.c -+++ b/arch/sparc/kernel/pcr.c -@@ -191,12 +191,41 @@ static const struct pcr_ops n4_pcr_ops = { - .pcr_nmi_disable = PCR_N4_PICNPT, - }; - -+static u64 n5_pcr_read(unsigned long reg_num) -+{ -+ unsigned long val; -+ -+ (void) sun4v_t5_get_perfreg(reg_num, &val); -+ -+ return val; -+} -+ -+static void n5_pcr_write(unsigned long reg_num, u64 val) -+{ -+ (void) sun4v_t5_set_perfreg(reg_num, val); -+} -+ -+static const struct pcr_ops n5_pcr_ops = { -+ .read_pcr = n5_pcr_read, -+ .write_pcr = n5_pcr_write, -+ .read_pic = n4_pic_read, -+ .write_pic = n4_pic_write, -+ .nmi_picl_value = n4_picl_value, -+ .pcr_nmi_enable = (PCR_N4_PICNPT | PCR_N4_STRACE | -+ PCR_N4_UTRACE | PCR_N4_TOE | -+ (26 << PCR_N4_SL_SHIFT)), -+ .pcr_nmi_disable = PCR_N4_PICNPT, -+}; -+ -+ - static unsigned long perf_hsvc_group; - static unsigned long perf_hsvc_major; - static unsigned long perf_hsvc_minor; - - static int __init register_perf_hsvc(void) - { -+ unsigned long hverror; -+ - if (tlb_type == hypervisor) { - switch (sun4v_chip_type) { - case SUN4V_CHIP_NIAGARA1: -@@ -215,6 +244,10 @@ static int __init register_perf_hsvc(void) - perf_hsvc_group = HV_GRP_VT_CPU; - break; - -+ case SUN4V_CHIP_NIAGARA5: -+ perf_hsvc_group = HV_GRP_T5_CPU; -+ break; -+ - default: - return -ENODEV; - } -@@ -222,10 +255,12 @@ static int __init register_perf_hsvc(void) - - perf_hsvc_major = 1; - perf_hsvc_minor = 0; -- if (sun4v_hvapi_register(perf_hsvc_group, -- perf_hsvc_major, -- &perf_hsvc_minor)) { -- printk("perfmon: Could not register hvapi.\n"); -+ hverror = sun4v_hvapi_register(perf_hsvc_group, -+ perf_hsvc_major, -+ &perf_hsvc_minor); -+ if (hverror) { -+ pr_err("perfmon: Could not register hvapi(0x%lx).\n", -+ hverror); - return -ENODEV; - } - } -@@ -254,6 +289,10 @@ static int __init setup_sun4v_pcr_ops(void) - pcr_ops = &n4_pcr_ops; - break; - -+ case SUN4V_CHIP_NIAGARA5: -+ pcr_ops = &n5_pcr_ops; -+ break; -+ - default: - ret = -ENODEV; - break; -diff --git a/arch/sparc/kernel/perf_event.c b/arch/sparc/kernel/perf_event.c -index b5c38faa4ead..617b9fe33771 100644 ---- a/arch/sparc/kernel/perf_event.c -+++ b/arch/sparc/kernel/perf_event.c -@@ -1662,7 +1662,8 @@ static bool __init supported_pmu(void) - sparc_pmu = &niagara2_pmu; - return true; - } -- if (!strcmp(sparc_pmu_type, "niagara4")) { -+ if (!strcmp(sparc_pmu_type, "niagara4") || -+ !strcmp(sparc_pmu_type, "niagara5")) { - sparc_pmu = &niagara4_pmu; - return true; - } -@@ -1671,9 +1672,12 @@ static bool __init supported_pmu(void) - - int __init init_hw_perf_events(void) - { -+ int err; -+ - pr_info("Performance events: "); - -- if (!supported_pmu()) { -+ err = pcr_arch_init(); -+ if (err || !supported_pmu()) { - pr_cont("No support for PMU type '%s'\n", sparc_pmu_type); - return 0; - } -@@ -1685,7 +1689,7 @@ int __init init_hw_perf_events(void) - - return 0; - } --early_initcall(init_hw_perf_events); -+pure_initcall(init_hw_perf_events); - - void perf_callchain_kernel(struct perf_callchain_entry *entry, - struct pt_regs *regs) -diff --git a/arch/sparc/kernel/process_64.c b/arch/sparc/kernel/process_64.c -index d7b4967f8fa6..c6f7113b6e2f 100644 ---- a/arch/sparc/kernel/process_64.c -+++ b/arch/sparc/kernel/process_64.c -@@ -306,6 +306,9 @@ static void __global_pmu_self(int this_cpu) - struct global_pmu_snapshot *pp; - int i, num; - -+ if (!pcr_ops) -+ return; -+ - pp = &global_cpu_snapshot[this_cpu].pmu; - - num = 1; -diff --git a/arch/sparc/kernel/setup_64.c b/arch/sparc/kernel/setup_64.c -index 3fdb455e3318..61a519808cb7 100644 ---- a/arch/sparc/kernel/setup_64.c -+++ b/arch/sparc/kernel/setup_64.c -@@ -30,6 +30,7 @@ - #include <linux/cpu.h> - #include <linux/initrd.h> - #include <linux/module.h> -+#include <linux/start_kernel.h> - - #include <asm/io.h> - #include <asm/processor.h> -@@ -174,7 +175,7 @@ char reboot_command[COMMAND_LINE_SIZE]; - - static struct pt_regs fake_swapper_regs = { { 0, }, 0, 0, 0, 0 }; - --void __init per_cpu_patch(void) -+static void __init per_cpu_patch(void) - { - struct cpuid_patch_entry *p; - unsigned long ver; -@@ -266,7 +267,7 @@ void sun4v_patch_2insn_range(struct sun4v_2insn_patch_entry *start, - } - } - --void __init sun4v_patch(void) -+static void __init sun4v_patch(void) - { - extern void sun4v_hvapi_init(void); - -@@ -335,14 +336,25 @@ static void __init pause_patch(void) - } - } - --#ifdef CONFIG_SMP --void __init boot_cpu_id_too_large(int cpu) -+void __init start_early_boot(void) - { -- prom_printf("Serious problem, boot cpu id (%d) >= NR_CPUS (%d)\n", -- cpu, NR_CPUS); -- prom_halt(); -+ int cpu; -+ -+ check_if_starfire(); -+ per_cpu_patch(); -+ sun4v_patch(); -+ -+ cpu = hard_smp_processor_id(); -+ if (cpu >= NR_CPUS) { -+ prom_printf("Serious problem, boot cpu id (%d) >= NR_CPUS (%d)\n", -+ cpu, NR_CPUS); -+ prom_halt(); -+ } -+ current_thread_info()->cpu = cpu; -+ -+ prom_init_report(); -+ start_kernel(); - } --#endif - - /* On Ultra, we support all of the v8 capabilities. */ - unsigned long sparc64_elf_hwcap = (HWCAP_SPARC_FLUSH | HWCAP_SPARC_STBAR | -@@ -500,12 +512,16 @@ static void __init init_sparc64_elf_hwcap(void) - sun4v_chip_type == SUN4V_CHIP_NIAGARA3 || - sun4v_chip_type == SUN4V_CHIP_NIAGARA4 || - sun4v_chip_type == SUN4V_CHIP_NIAGARA5 || -+ sun4v_chip_type == SUN4V_CHIP_SPARC_M6 || -+ sun4v_chip_type == SUN4V_CHIP_SPARC_M7 || - sun4v_chip_type == SUN4V_CHIP_SPARC64X) - cap |= HWCAP_SPARC_BLKINIT; - if (sun4v_chip_type == SUN4V_CHIP_NIAGARA2 || - sun4v_chip_type == SUN4V_CHIP_NIAGARA3 || - sun4v_chip_type == SUN4V_CHIP_NIAGARA4 || - sun4v_chip_type == SUN4V_CHIP_NIAGARA5 || -+ sun4v_chip_type == SUN4V_CHIP_SPARC_M6 || -+ sun4v_chip_type == SUN4V_CHIP_SPARC_M7 || - sun4v_chip_type == SUN4V_CHIP_SPARC64X) - cap |= HWCAP_SPARC_N2; - } -@@ -533,6 +549,8 @@ static void __init init_sparc64_elf_hwcap(void) - sun4v_chip_type == SUN4V_CHIP_NIAGARA3 || - sun4v_chip_type == SUN4V_CHIP_NIAGARA4 || - sun4v_chip_type == SUN4V_CHIP_NIAGARA5 || -+ sun4v_chip_type == SUN4V_CHIP_SPARC_M6 || -+ sun4v_chip_type == SUN4V_CHIP_SPARC_M7 || - sun4v_chip_type == SUN4V_CHIP_SPARC64X) - cap |= (AV_SPARC_VIS | AV_SPARC_VIS2 | - AV_SPARC_ASI_BLK_INIT | -@@ -540,6 +558,8 @@ static void __init init_sparc64_elf_hwcap(void) - if (sun4v_chip_type == SUN4V_CHIP_NIAGARA3 || - sun4v_chip_type == SUN4V_CHIP_NIAGARA4 || - sun4v_chip_type == SUN4V_CHIP_NIAGARA5 || -+ sun4v_chip_type == SUN4V_CHIP_SPARC_M6 || -+ sun4v_chip_type == SUN4V_CHIP_SPARC_M7 || - sun4v_chip_type == SUN4V_CHIP_SPARC64X) - cap |= (AV_SPARC_VIS3 | AV_SPARC_HPC | - AV_SPARC_FMAF); -diff --git a/arch/sparc/kernel/smp_64.c b/arch/sparc/kernel/smp_64.c -index 8416d7fadcce..50c3dd03be31 100644 ---- a/arch/sparc/kernel/smp_64.c -+++ b/arch/sparc/kernel/smp_64.c -@@ -1395,7 +1395,6 @@ void __cpu_die(unsigned int cpu) - - void __init smp_cpus_done(unsigned int max_cpus) - { -- pcr_arch_init(); - } - - void smp_send_reschedule(int cpu) -@@ -1480,6 +1479,13 @@ static void __init pcpu_populate_pte(unsigned long addr) - pud_t *pud; - pmd_t *pmd; - -+ if (pgd_none(*pgd)) { -+ pud_t *new; -+ -+ new = __alloc_bootmem(PAGE_SIZE, PAGE_SIZE, PAGE_SIZE); -+ pgd_populate(&init_mm, pgd, new); -+ } -+ - pud = pud_offset(pgd, addr); - if (pud_none(*pud)) { - pmd_t *new; -diff --git a/arch/sparc/kernel/sun4v_tlb_miss.S b/arch/sparc/kernel/sun4v_tlb_miss.S -index e0c09bf85610..6179e19bc9b9 100644 ---- a/arch/sparc/kernel/sun4v_tlb_miss.S -+++ b/arch/sparc/kernel/sun4v_tlb_miss.S -@@ -195,6 +195,11 @@ sun4v_tsb_miss_common: - ldx [%g2 + TRAP_PER_CPU_PGD_PADDR], %g7 - - sun4v_itlb_error: -+ rdpr %tl, %g1 -+ cmp %g1, 1 -+ ble,pt %icc, sun4v_bad_ra -+ or %g0, FAULT_CODE_BAD_RA | FAULT_CODE_ITLB, %g1 -+ - sethi %hi(sun4v_err_itlb_vaddr), %g1 - stx %g4, [%g1 + %lo(sun4v_err_itlb_vaddr)] - sethi %hi(sun4v_err_itlb_ctx), %g1 -@@ -206,15 +211,10 @@ sun4v_itlb_error: - sethi %hi(sun4v_err_itlb_error), %g1 - stx %o0, [%g1 + %lo(sun4v_err_itlb_error)] - -+ sethi %hi(1f), %g7 - rdpr %tl, %g4 -- cmp %g4, 1 -- ble,pt %icc, 1f -- sethi %hi(2f), %g7 - ba,pt %xcc, etraptl1 -- or %g7, %lo(2f), %g7 -- --1: ba,pt %xcc, etrap --2: or %g7, %lo(2b), %g7 -+1: or %g7, %lo(1f), %g7 - mov %l4, %o1 - call sun4v_itlb_error_report - add %sp, PTREGS_OFF, %o0 -@@ -222,6 +222,11 @@ sun4v_itlb_error: - /* NOTREACHED */ - - sun4v_dtlb_error: -+ rdpr %tl, %g1 -+ cmp %g1, 1 -+ ble,pt %icc, sun4v_bad_ra -+ or %g0, FAULT_CODE_BAD_RA | FAULT_CODE_DTLB, %g1 -+ - sethi %hi(sun4v_err_dtlb_vaddr), %g1 - stx %g4, [%g1 + %lo(sun4v_err_dtlb_vaddr)] - sethi %hi(sun4v_err_dtlb_ctx), %g1 -@@ -233,21 +238,23 @@ sun4v_dtlb_error: - sethi %hi(sun4v_err_dtlb_error), %g1 - stx %o0, [%g1 + %lo(sun4v_err_dtlb_error)] - -+ sethi %hi(1f), %g7 - rdpr %tl, %g4 -- cmp %g4, 1 -- ble,pt %icc, 1f -- sethi %hi(2f), %g7 - ba,pt %xcc, etraptl1 -- or %g7, %lo(2f), %g7 -- --1: ba,pt %xcc, etrap --2: or %g7, %lo(2b), %g7 -+1: or %g7, %lo(1f), %g7 - mov %l4, %o1 - call sun4v_dtlb_error_report - add %sp, PTREGS_OFF, %o0 - - /* NOTREACHED */ - -+sun4v_bad_ra: -+ or %g0, %g4, %g5 -+ ba,pt %xcc, sparc64_realfault_common -+ or %g1, %g0, %g4 -+ -+ /* NOTREACHED */ -+ - /* Instruction Access Exception, tl0. */ - sun4v_iacc: - ldxa [%g0] ASI_SCRATCHPAD, %g2 -diff --git a/arch/sparc/kernel/trampoline_64.S b/arch/sparc/kernel/trampoline_64.S -index 737f8cbc7d56..88ede1d53b4c 100644 ---- a/arch/sparc/kernel/trampoline_64.S -+++ b/arch/sparc/kernel/trampoline_64.S -@@ -109,10 +109,13 @@ startup_continue: - brnz,pn %g1, 1b - nop - -- sethi %hi(p1275buf), %g2 -- or %g2, %lo(p1275buf), %g2 -- ldx [%g2 + 0x10], %l2 -- add %l2, -(192 + 128), %sp -+ /* Get onto temporary stack which will be in the locked -+ * kernel image. -+ */ -+ sethi %hi(tramp_stack), %g1 -+ or %g1, %lo(tramp_stack), %g1 -+ add %g1, TRAMP_STACK_SIZE, %g1 -+ sub %g1, STACKFRAME_SZ + STACK_BIAS + 256, %sp - flushw - - /* Setup the loop variables: -@@ -394,7 +397,6 @@ after_lock_tlb: - sllx %g5, THREAD_SHIFT, %g5 - sub %g5, (STACKFRAME_SZ + STACK_BIAS), %g5 - add %g6, %g5, %sp -- mov 0, %fp - - rdpr %pstate, %o1 - or %o1, PSTATE_IE, %o1 -diff --git a/arch/sparc/kernel/traps_64.c b/arch/sparc/kernel/traps_64.c -index 4ced92f05358..25d0c7ece9cc 100644 ---- a/arch/sparc/kernel/traps_64.c -+++ b/arch/sparc/kernel/traps_64.c -@@ -2102,6 +2102,11 @@ void sun4v_nonresum_overflow(struct pt_regs *regs) - atomic_inc(&sun4v_nonresum_oflow_cnt); - } - -+static void sun4v_tlb_error(struct pt_regs *regs) -+{ -+ die_if_kernel("TLB/TSB error", regs); -+} -+ - unsigned long sun4v_err_itlb_vaddr; - unsigned long sun4v_err_itlb_ctx; - unsigned long sun4v_err_itlb_pte; -@@ -2109,8 +2114,7 @@ unsigned long sun4v_err_itlb_error; - - void sun4v_itlb_error_report(struct pt_regs *regs, int tl) - { -- if (tl > 1) -- dump_tl1_traplog((struct tl1_traplog *)(regs + 1)); -+ dump_tl1_traplog((struct tl1_traplog *)(regs + 1)); - - printk(KERN_EMERG "SUN4V-ITLB: Error at TPC[%lx], tl %d\n", - regs->tpc, tl); -@@ -2123,7 +2127,7 @@ void sun4v_itlb_error_report(struct pt_regs *regs, int tl) - sun4v_err_itlb_vaddr, sun4v_err_itlb_ctx, - sun4v_err_itlb_pte, sun4v_err_itlb_error); - -- prom_halt(); -+ sun4v_tlb_error(regs); - } - - unsigned long sun4v_err_dtlb_vaddr; -@@ -2133,8 +2137,7 @@ unsigned long sun4v_err_dtlb_error; - - void sun4v_dtlb_error_report(struct pt_regs *regs, int tl) - { -- if (tl > 1) -- dump_tl1_traplog((struct tl1_traplog *)(regs + 1)); -+ dump_tl1_traplog((struct tl1_traplog *)(regs + 1)); - - printk(KERN_EMERG "SUN4V-DTLB: Error at TPC[%lx], tl %d\n", - regs->tpc, tl); -@@ -2147,7 +2150,7 @@ void sun4v_dtlb_error_report(struct pt_regs *regs, int tl) - sun4v_err_dtlb_vaddr, sun4v_err_dtlb_ctx, - sun4v_err_dtlb_pte, sun4v_err_dtlb_error); - -- prom_halt(); -+ sun4v_tlb_error(regs); - } - - void hypervisor_tlbop_error(unsigned long err, unsigned long op) -diff --git a/arch/sparc/kernel/tsb.S b/arch/sparc/kernel/tsb.S -index 14158d40ba76..be98685c14c6 100644 ---- a/arch/sparc/kernel/tsb.S -+++ b/arch/sparc/kernel/tsb.S -@@ -162,10 +162,10 @@ tsb_miss_page_table_walk_sun4v_fastpath: - nop - .previous - -- rdpr %tl, %g3 -- cmp %g3, 1 -+ rdpr %tl, %g7 -+ cmp %g7, 1 - bne,pn %xcc, winfix_trampoline -- nop -+ mov %g3, %g4 - ba,pt %xcc, etrap - rd %pc, %g7 - call hugetlb_setup -diff --git a/arch/sparc/kernel/viohs.c b/arch/sparc/kernel/viohs.c -index f8e7dd53e1c7..9c5fbd0b8a04 100644 ---- a/arch/sparc/kernel/viohs.c -+++ b/arch/sparc/kernel/viohs.c -@@ -714,7 +714,7 @@ int vio_ldc_alloc(struct vio_driver_state *vio, - cfg.tx_irq = vio->vdev->tx_irq; - cfg.rx_irq = vio->vdev->rx_irq; - -- lp = ldc_alloc(vio->vdev->channel_id, &cfg, event_arg); -+ lp = ldc_alloc(vio->vdev->channel_id, &cfg, event_arg, vio->name); - if (IS_ERR(lp)) - return PTR_ERR(lp); - -@@ -746,7 +746,7 @@ void vio_port_up(struct vio_driver_state *vio) - - err = 0; - if (state == LDC_STATE_INIT) { -- err = ldc_bind(vio->lp, vio->name); -+ err = ldc_bind(vio->lp); - if (err) - printk(KERN_WARNING "%s: Port %lu bind failed, " - "err=%d\n", -diff --git a/arch/sparc/kernel/vmlinux.lds.S b/arch/sparc/kernel/vmlinux.lds.S -index 932ff90fd760..09243057cb0b 100644 ---- a/arch/sparc/kernel/vmlinux.lds.S -+++ b/arch/sparc/kernel/vmlinux.lds.S -@@ -35,8 +35,9 @@ jiffies = jiffies_64; - - SECTIONS - { -- /* swapper_low_pmd_dir is sparc64 only */ -- swapper_low_pmd_dir = 0x0000000000402000; -+#ifdef CONFIG_SPARC64 -+ swapper_pg_dir = 0x0000000000402000; -+#endif - . = INITIAL_ADDRESS; - .text TEXTSTART : - { -@@ -122,11 +123,6 @@ SECTIONS - *(.swapper_4m_tsb_phys_patch) - __swapper_4m_tsb_phys_patch_end = .; - } -- .page_offset_shift_patch : { -- __page_offset_shift_patch = .; -- *(.page_offset_shift_patch) -- __page_offset_shift_patch_end = .; -- } - .popc_3insn_patch : { - __popc_3insn_patch = .; - *(.popc_3insn_patch) -diff --git a/arch/sparc/lib/NG4memcpy.S b/arch/sparc/lib/NG4memcpy.S -index 9cf2ee01cee3..140527a20e7d 100644 ---- a/arch/sparc/lib/NG4memcpy.S -+++ b/arch/sparc/lib/NG4memcpy.S -@@ -41,6 +41,10 @@ - #endif - #endif - -+#if !defined(EX_LD) && !defined(EX_ST) -+#define NON_USER_COPY -+#endif -+ - #ifndef EX_LD - #define EX_LD(x) x - #endif -@@ -197,9 +201,13 @@ FUNC_NAME: /* %o0=dst, %o1=src, %o2=len */ - mov EX_RETVAL(%o3), %o0 - - .Llarge_src_unaligned: -+#ifdef NON_USER_COPY -+ VISEntryHalfFast(.Lmedium_vis_entry_fail) -+#else -+ VISEntryHalf -+#endif - andn %o2, 0x3f, %o4 - sub %o2, %o4, %o2 -- VISEntryHalf - alignaddr %o1, %g0, %g1 - add %o1, %o4, %o1 - EX_LD(LOAD(ldd, %g1 + 0x00, %f0)) -@@ -240,6 +248,10 @@ FUNC_NAME: /* %o0=dst, %o1=src, %o2=len */ - nop - ba,a,pt %icc, .Lmedium_unaligned - -+#ifdef NON_USER_COPY -+.Lmedium_vis_entry_fail: -+ or %o0, %o1, %g2 -+#endif - .Lmedium: - LOAD(prefetch, %o1 + 0x40, #n_reads_strong) - andcc %g2, 0x7, %g0 -diff --git a/arch/sparc/lib/memset.S b/arch/sparc/lib/memset.S -index 99c017be8719..f75e6906df14 100644 ---- a/arch/sparc/lib/memset.S -+++ b/arch/sparc/lib/memset.S -@@ -3,8 +3,9 @@ - * Copyright (C) 1996,1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz) - * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu) - * -- * Returns 0, if ok, and number of bytes not yet set if exception -- * occurs and we were called as clear_user. -+ * Calls to memset returns initial %o0. Calls to bzero returns 0, if ok, and -+ * number of bytes not yet set if exception occurs and we were called as -+ * clear_user. - */ - - #include <asm/ptrace.h> -@@ -65,6 +66,8 @@ __bzero_begin: - .globl __memset_start, __memset_end - __memset_start: - memset: -+ mov %o0, %g1 -+ mov 1, %g4 - and %o1, 0xff, %g3 - sll %g3, 8, %g2 - or %g3, %g2, %g3 -@@ -89,6 +92,7 @@ memset: - sub %o0, %o2, %o0 - - __bzero: -+ clr %g4 - mov %g0, %g3 - 1: - cmp %o1, 7 -@@ -151,8 +155,8 @@ __bzero: - bne,a 8f - EX(stb %g3, [%o0], and %o1, 1) - 8: -- retl -- clr %o0 -+ b 0f -+ nop - 7: - be 13b - orcc %o1, 0, %g0 -@@ -164,6 +168,12 @@ __bzero: - bne 8b - EX(stb %g3, [%o0 - 1], add %o1, 1) - 0: -+ andcc %g4, 1, %g0 -+ be 5f -+ nop -+ retl -+ mov %g1, %o0 -+5: - retl - clr %o0 - __memset_end: -diff --git a/arch/sparc/mm/fault_64.c b/arch/sparc/mm/fault_64.c -index 4ced3fc66130..45a413e4380a 100644 ---- a/arch/sparc/mm/fault_64.c -+++ b/arch/sparc/mm/fault_64.c -@@ -348,6 +348,9 @@ retry: - down_read(&mm->mmap_sem); - } - -+ if (fault_code & FAULT_CODE_BAD_RA) -+ goto do_sigbus; -+ - vma = find_vma(mm, address); - if (!vma) - goto bad_area; -diff --git a/arch/sparc/mm/gup.c b/arch/sparc/mm/gup.c -index 1aed0432c64b..ae6ce383d4df 100644 ---- a/arch/sparc/mm/gup.c -+++ b/arch/sparc/mm/gup.c -@@ -160,6 +160,36 @@ static int gup_pud_range(pgd_t pgd, unsigned long addr, unsigned long end, - return 1; - } - -+int __get_user_pages_fast(unsigned long start, int nr_pages, int write, -+ struct page **pages) -+{ -+ struct mm_struct *mm = current->mm; -+ unsigned long addr, len, end; -+ unsigned long next, flags; -+ pgd_t *pgdp; -+ int nr = 0; -+ -+ start &= PAGE_MASK; -+ addr = start; -+ len = (unsigned long) nr_pages << PAGE_SHIFT; -+ end = start + len; -+ -+ local_irq_save(flags); -+ pgdp = pgd_offset(mm, addr); -+ do { -+ pgd_t pgd = *pgdp; -+ -+ next = pgd_addr_end(addr, end); -+ if (pgd_none(pgd)) -+ break; -+ if (!gup_pud_range(pgd, addr, next, write, pages, &nr)) -+ break; -+ } while (pgdp++, addr = next, addr != end); -+ local_irq_restore(flags); -+ -+ return nr; -+} -+ - int get_user_pages_fast(unsigned long start, int nr_pages, int write, - struct page **pages) - { -diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c -index 96862241b342..34506f292533 100644 ---- a/arch/sparc/mm/init_64.c -+++ b/arch/sparc/mm/init_64.c -@@ -73,7 +73,6 @@ unsigned long kern_linear_pte_xor[4] __read_mostly; - * 'cpu' properties, but we need to have this table setup before the - * MDESC is initialized. - */ --unsigned long kpte_linear_bitmap[KPTE_BITMAP_BYTES / sizeof(unsigned long)]; - - #ifndef CONFIG_DEBUG_PAGEALLOC - /* A special kernel TSB for 4MB, 256MB, 2GB and 16GB linear mappings. -@@ -82,10 +81,11 @@ unsigned long kpte_linear_bitmap[KPTE_BITMAP_BYTES / sizeof(unsigned long)]; - */ - extern struct tsb swapper_4m_tsb[KERNEL_TSB4M_NENTRIES]; - #endif -+extern struct tsb swapper_tsb[KERNEL_TSB_NENTRIES]; - - static unsigned long cpu_pgsz_mask; - --#define MAX_BANKS 32 -+#define MAX_BANKS 1024 - - static struct linux_prom64_registers pavail[MAX_BANKS]; - static int pavail_ents; -@@ -163,10 +163,6 @@ static void __init read_obp_memory(const char *property, - cmp_p64, NULL); - } - --unsigned long sparc64_valid_addr_bitmap[VALID_ADDR_BITMAP_BYTES / -- sizeof(unsigned long)]; --EXPORT_SYMBOL(sparc64_valid_addr_bitmap); -- - /* Kernel physical address base and size in bytes. */ - unsigned long kern_base __read_mostly; - unsigned long kern_size __read_mostly; -@@ -838,7 +834,10 @@ static int find_node(unsigned long addr) - if ((addr & p->mask) == p->val) - return i; - } -- return -1; -+ /* The following condition has been observed on LDOM guests.*/ -+ WARN_ONCE(1, "find_node: A physical address doesn't match a NUMA node" -+ " rule. Some physical memory will be owned by node 0."); -+ return 0; - } - - static u64 memblock_nid_range(u64 start, u64 end, int *nid) -@@ -1360,9 +1359,144 @@ static unsigned long __init bootmem_init(unsigned long phys_base) - static struct linux_prom64_registers pall[MAX_BANKS] __initdata; - static int pall_ents __initdata; - --#ifdef CONFIG_DEBUG_PAGEALLOC -+static unsigned long max_phys_bits = 40; -+ -+bool kern_addr_valid(unsigned long addr) -+{ -+ pgd_t *pgd; -+ pud_t *pud; -+ pmd_t *pmd; -+ pte_t *pte; -+ -+ if ((long)addr < 0L) { -+ unsigned long pa = __pa(addr); -+ -+ if ((addr >> max_phys_bits) != 0UL) -+ return false; -+ -+ return pfn_valid(pa >> PAGE_SHIFT); -+ } -+ -+ if (addr >= (unsigned long) KERNBASE && -+ addr < (unsigned long)&_end) -+ return true; -+ -+ pgd = pgd_offset_k(addr); -+ if (pgd_none(*pgd)) -+ return 0; -+ -+ pud = pud_offset(pgd, addr); -+ if (pud_none(*pud)) -+ return 0; -+ -+ if (pud_large(*pud)) -+ return pfn_valid(pud_pfn(*pud)); -+ -+ pmd = pmd_offset(pud, addr); -+ if (pmd_none(*pmd)) -+ return 0; -+ -+ if (pmd_large(*pmd)) -+ return pfn_valid(pmd_pfn(*pmd)); -+ -+ pte = pte_offset_kernel(pmd, addr); -+ if (pte_none(*pte)) -+ return 0; -+ -+ return pfn_valid(pte_pfn(*pte)); -+} -+EXPORT_SYMBOL(kern_addr_valid); -+ -+static unsigned long __ref kernel_map_hugepud(unsigned long vstart, -+ unsigned long vend, -+ pud_t *pud) -+{ -+ const unsigned long mask16gb = (1UL << 34) - 1UL; -+ u64 pte_val = vstart; -+ -+ /* Each PUD is 8GB */ -+ if ((vstart & mask16gb) || -+ (vend - vstart <= mask16gb)) { -+ pte_val ^= kern_linear_pte_xor[2]; -+ pud_val(*pud) = pte_val | _PAGE_PUD_HUGE; -+ -+ return vstart + PUD_SIZE; -+ } -+ -+ pte_val ^= kern_linear_pte_xor[3]; -+ pte_val |= _PAGE_PUD_HUGE; -+ -+ vend = vstart + mask16gb + 1UL; -+ while (vstart < vend) { -+ pud_val(*pud) = pte_val; -+ -+ pte_val += PUD_SIZE; -+ vstart += PUD_SIZE; -+ pud++; -+ } -+ return vstart; -+} -+ -+static bool kernel_can_map_hugepud(unsigned long vstart, unsigned long vend, -+ bool guard) -+{ -+ if (guard && !(vstart & ~PUD_MASK) && (vend - vstart) >= PUD_SIZE) -+ return true; -+ -+ return false; -+} -+ -+static unsigned long __ref kernel_map_hugepmd(unsigned long vstart, -+ unsigned long vend, -+ pmd_t *pmd) -+{ -+ const unsigned long mask256mb = (1UL << 28) - 1UL; -+ const unsigned long mask2gb = (1UL << 31) - 1UL; -+ u64 pte_val = vstart; -+ -+ /* Each PMD is 8MB */ -+ if ((vstart & mask256mb) || -+ (vend - vstart <= mask256mb)) { -+ pte_val ^= kern_linear_pte_xor[0]; -+ pmd_val(*pmd) = pte_val | _PAGE_PMD_HUGE; -+ -+ return vstart + PMD_SIZE; -+ } -+ -+ if ((vstart & mask2gb) || -+ (vend - vstart <= mask2gb)) { -+ pte_val ^= kern_linear_pte_xor[1]; -+ pte_val |= _PAGE_PMD_HUGE; -+ vend = vstart + mask256mb + 1UL; -+ } else { -+ pte_val ^= kern_linear_pte_xor[2]; -+ pte_val |= _PAGE_PMD_HUGE; -+ vend = vstart + mask2gb + 1UL; -+ } -+ -+ while (vstart < vend) { -+ pmd_val(*pmd) = pte_val; -+ -+ pte_val += PMD_SIZE; -+ vstart += PMD_SIZE; -+ pmd++; -+ } -+ -+ return vstart; -+} -+ -+static bool kernel_can_map_hugepmd(unsigned long vstart, unsigned long vend, -+ bool guard) -+{ -+ if (guard && !(vstart & ~PMD_MASK) && (vend - vstart) >= PMD_SIZE) -+ return true; -+ -+ return false; -+} -+ - static unsigned long __ref kernel_map_range(unsigned long pstart, -- unsigned long pend, pgprot_t prot) -+ unsigned long pend, pgprot_t prot, -+ bool use_huge) - { - unsigned long vstart = PAGE_OFFSET + pstart; - unsigned long vend = PAGE_OFFSET + pend; -@@ -1381,19 +1515,34 @@ static unsigned long __ref kernel_map_range(unsigned long pstart, - pmd_t *pmd; - pte_t *pte; - -+ if (pgd_none(*pgd)) { -+ pud_t *new; -+ -+ new = __alloc_bootmem(PAGE_SIZE, PAGE_SIZE, PAGE_SIZE); -+ alloc_bytes += PAGE_SIZE; -+ pgd_populate(&init_mm, pgd, new); -+ } - pud = pud_offset(pgd, vstart); - if (pud_none(*pud)) { - pmd_t *new; - -+ if (kernel_can_map_hugepud(vstart, vend, use_huge)) { -+ vstart = kernel_map_hugepud(vstart, vend, pud); -+ continue; -+ } - new = __alloc_bootmem(PAGE_SIZE, PAGE_SIZE, PAGE_SIZE); - alloc_bytes += PAGE_SIZE; - pud_populate(&init_mm, pud, new); - } - - pmd = pmd_offset(pud, vstart); -- if (!pmd_present(*pmd)) { -+ if (pmd_none(*pmd)) { - pte_t *new; - -+ if (kernel_can_map_hugepmd(vstart, vend, use_huge)) { -+ vstart = kernel_map_hugepmd(vstart, vend, pmd); -+ continue; -+ } - new = __alloc_bootmem(PAGE_SIZE, PAGE_SIZE, PAGE_SIZE); - alloc_bytes += PAGE_SIZE; - pmd_populate_kernel(&init_mm, pmd, new); -@@ -1416,100 +1565,34 @@ static unsigned long __ref kernel_map_range(unsigned long pstart, - return alloc_bytes; - } - --extern unsigned int kvmap_linear_patch[1]; --#endif /* CONFIG_DEBUG_PAGEALLOC */ -- --static void __init kpte_set_val(unsigned long index, unsigned long val) -+static void __init flush_all_kernel_tsbs(void) - { -- unsigned long *ptr = kpte_linear_bitmap; -- -- val <<= ((index % (BITS_PER_LONG / 2)) * 2); -- ptr += (index / (BITS_PER_LONG / 2)); -- -- *ptr |= val; --} -- --static const unsigned long kpte_shift_min = 28; /* 256MB */ --static const unsigned long kpte_shift_max = 34; /* 16GB */ --static const unsigned long kpte_shift_incr = 3; -- --static unsigned long kpte_mark_using_shift(unsigned long start, unsigned long end, -- unsigned long shift) --{ -- unsigned long size = (1UL << shift); -- unsigned long mask = (size - 1UL); -- unsigned long remains = end - start; -- unsigned long val; -- -- if (remains < size || (start & mask)) -- return start; -- -- /* VAL maps: -- * -- * shift 28 --> kern_linear_pte_xor index 1 -- * shift 31 --> kern_linear_pte_xor index 2 -- * shift 34 --> kern_linear_pte_xor index 3 -- */ -- val = ((shift - kpte_shift_min) / kpte_shift_incr) + 1; -- -- remains &= ~mask; -- if (shift != kpte_shift_max) -- remains = size; -- -- while (remains) { -- unsigned long index = start >> kpte_shift_min; -+ int i; - -- kpte_set_val(index, val); -+ for (i = 0; i < KERNEL_TSB_NENTRIES; i++) { -+ struct tsb *ent = &swapper_tsb[i]; - -- start += 1UL << kpte_shift_min; -- remains -= 1UL << kpte_shift_min; -+ ent->tag = (1UL << TSB_TAG_INVALID_BIT); - } -+#ifndef CONFIG_DEBUG_PAGEALLOC -+ for (i = 0; i < KERNEL_TSB4M_NENTRIES; i++) { -+ struct tsb *ent = &swapper_4m_tsb[i]; - -- return start; --} -- --static void __init mark_kpte_bitmap(unsigned long start, unsigned long end) --{ -- unsigned long smallest_size, smallest_mask; -- unsigned long s; -- -- smallest_size = (1UL << kpte_shift_min); -- smallest_mask = (smallest_size - 1UL); -- -- while (start < end) { -- unsigned long orig_start = start; -- -- for (s = kpte_shift_max; s >= kpte_shift_min; s -= kpte_shift_incr) { -- start = kpte_mark_using_shift(start, end, s); -- -- if (start != orig_start) -- break; -- } -- -- if (start == orig_start) -- start = (start + smallest_size) & ~smallest_mask; -+ ent->tag = (1UL << TSB_TAG_INVALID_BIT); - } -+#endif - } - --static void __init init_kpte_bitmap(void) --{ -- unsigned long i; -- -- for (i = 0; i < pall_ents; i++) { -- unsigned long phys_start, phys_end; -- -- phys_start = pall[i].phys_addr; -- phys_end = phys_start + pall[i].reg_size; -- -- mark_kpte_bitmap(phys_start, phys_end); -- } --} -+extern unsigned int kvmap_linear_patch[1]; - - static void __init kernel_physical_mapping_init(void) - { --#ifdef CONFIG_DEBUG_PAGEALLOC - unsigned long i, mem_alloced = 0UL; -+ bool use_huge = true; - -+#ifdef CONFIG_DEBUG_PAGEALLOC -+ use_huge = false; -+#endif - for (i = 0; i < pall_ents; i++) { - unsigned long phys_start, phys_end; - -@@ -1517,7 +1600,7 @@ static void __init kernel_physical_mapping_init(void) - phys_end = phys_start + pall[i].reg_size; - - mem_alloced += kernel_map_range(phys_start, phys_end, -- PAGE_KERNEL); -+ PAGE_KERNEL, use_huge); - } - - printk("Allocated %ld bytes for kernel page tables.\n", -@@ -1526,8 +1609,9 @@ static void __init kernel_physical_mapping_init(void) - kvmap_linear_patch[0] = 0x01000000; /* nop */ - flushi(&kvmap_linear_patch[0]); - -+ flush_all_kernel_tsbs(); -+ - __flush_tlb_all(); --#endif - } - - #ifdef CONFIG_DEBUG_PAGEALLOC -@@ -1537,7 +1621,7 @@ void kernel_map_pages(struct page *page, int numpages, int enable) - unsigned long phys_end = phys_start + (numpages * PAGE_SIZE); - - kernel_map_range(phys_start, phys_end, -- (enable ? PAGE_KERNEL : __pgprot(0))); -+ (enable ? PAGE_KERNEL : __pgprot(0)), false); - - flush_tsb_kernel_range(PAGE_OFFSET + phys_start, - PAGE_OFFSET + phys_end); -@@ -1565,76 +1649,56 @@ unsigned long __init find_ecache_flush_span(unsigned long size) - unsigned long PAGE_OFFSET; - EXPORT_SYMBOL(PAGE_OFFSET); - --static void __init page_offset_shift_patch_one(unsigned int *insn, unsigned long phys_bits) --{ -- unsigned long final_shift; -- unsigned int val = *insn; -- unsigned int cnt; -- -- /* We are patching in ilog2(max_supported_phys_address), and -- * we are doing so in a manner similar to a relocation addend. -- * That is, we are adding the shift value to whatever value -- * is in the shift instruction count field already. -- */ -- cnt = (val & 0x3f); -- val &= ~0x3f; -- -- /* If we are trying to shift >= 64 bits, clear the destination -- * register. This can happen when phys_bits ends up being equal -- * to MAX_PHYS_ADDRESS_BITS. -- */ -- final_shift = (cnt + (64 - phys_bits)); -- if (final_shift >= 64) { -- unsigned int rd = (val >> 25) & 0x1f; -- -- val = 0x80100000 | (rd << 25); -- } else { -- val |= final_shift; -- } -- *insn = val; -- -- __asm__ __volatile__("flush %0" -- : /* no outputs */ -- : "r" (insn)); --} -- --static void __init page_offset_shift_patch(unsigned long phys_bits) --{ -- extern unsigned int __page_offset_shift_patch; -- extern unsigned int __page_offset_shift_patch_end; -- unsigned int *p; -- -- p = &__page_offset_shift_patch; -- while (p < &__page_offset_shift_patch_end) { -- unsigned int *insn = (unsigned int *)(unsigned long)*p; -+unsigned long VMALLOC_END = 0x0000010000000000UL; -+EXPORT_SYMBOL(VMALLOC_END); - -- page_offset_shift_patch_one(insn, phys_bits); -- -- p++; -- } --} -+unsigned long sparc64_va_hole_top = 0xfffff80000000000UL; -+unsigned long sparc64_va_hole_bottom = 0x0000080000000000UL; - - static void __init setup_page_offset(void) - { -- unsigned long max_phys_bits = 40; -- - if (tlb_type == cheetah || tlb_type == cheetah_plus) { -+ /* Cheetah/Panther support a full 64-bit virtual -+ * address, so we can use all that our page tables -+ * support. -+ */ -+ sparc64_va_hole_top = 0xfff0000000000000UL; -+ sparc64_va_hole_bottom = 0x0010000000000000UL; -+ - max_phys_bits = 42; - } else if (tlb_type == hypervisor) { - switch (sun4v_chip_type) { - case SUN4V_CHIP_NIAGARA1: - case SUN4V_CHIP_NIAGARA2: -+ /* T1 and T2 support 48-bit virtual addresses. */ -+ sparc64_va_hole_top = 0xffff800000000000UL; -+ sparc64_va_hole_bottom = 0x0000800000000000UL; -+ - max_phys_bits = 39; - break; - case SUN4V_CHIP_NIAGARA3: -+ /* T3 supports 48-bit virtual addresses. */ -+ sparc64_va_hole_top = 0xffff800000000000UL; -+ sparc64_va_hole_bottom = 0x0000800000000000UL; -+ - max_phys_bits = 43; - break; - case SUN4V_CHIP_NIAGARA4: - case SUN4V_CHIP_NIAGARA5: - case SUN4V_CHIP_SPARC64X: -- default: -+ case SUN4V_CHIP_SPARC_M6: -+ /* T4 and later support 52-bit virtual addresses. */ -+ sparc64_va_hole_top = 0xfff8000000000000UL; -+ sparc64_va_hole_bottom = 0x0008000000000000UL; - max_phys_bits = 47; - break; -+ case SUN4V_CHIP_SPARC_M7: -+ default: -+ /* M7 and later support 52-bit virtual addresses. */ -+ sparc64_va_hole_top = 0xfff8000000000000UL; -+ sparc64_va_hole_bottom = 0x0008000000000000UL; -+ max_phys_bits = 49; -+ break; - } - } - -@@ -1644,12 +1708,16 @@ static void __init setup_page_offset(void) - prom_halt(); - } - -- PAGE_OFFSET = PAGE_OFFSET_BY_BITS(max_phys_bits); -+ PAGE_OFFSET = sparc64_va_hole_top; -+ VMALLOC_END = ((sparc64_va_hole_bottom >> 1) + -+ (sparc64_va_hole_bottom >> 2)); - -- pr_info("PAGE_OFFSET is 0x%016lx (max_phys_bits == %lu)\n", -+ pr_info("MM: PAGE_OFFSET is 0x%016lx (max_phys_bits == %lu)\n", - PAGE_OFFSET, max_phys_bits); -- -- page_offset_shift_patch(max_phys_bits); -+ pr_info("MM: VMALLOC [0x%016lx --> 0x%016lx]\n", -+ VMALLOC_START, VMALLOC_END); -+ pr_info("MM: VMEMMAP [0x%016lx --> 0x%016lx]\n", -+ VMEMMAP_BASE, VMEMMAP_BASE << 1); - } - - static void __init tsb_phys_patch(void) -@@ -1694,21 +1762,42 @@ static void __init tsb_phys_patch(void) - #define NUM_KTSB_DESCR 1 - #endif - static struct hv_tsb_descr ktsb_descr[NUM_KTSB_DESCR]; --extern struct tsb swapper_tsb[KERNEL_TSB_NENTRIES]; -+ -+/* The swapper TSBs are loaded with a base sequence of: -+ * -+ * sethi %uhi(SYMBOL), REG1 -+ * sethi %hi(SYMBOL), REG2 -+ * or REG1, %ulo(SYMBOL), REG1 -+ * or REG2, %lo(SYMBOL), REG2 -+ * sllx REG1, 32, REG1 -+ * or REG1, REG2, REG1 -+ * -+ * When we use physical addressing for the TSB accesses, we patch the -+ * first four instructions in the above sequence. -+ */ - - static void patch_one_ktsb_phys(unsigned int *start, unsigned int *end, unsigned long pa) - { -- pa >>= KTSB_PHYS_SHIFT; -+ unsigned long high_bits, low_bits; -+ -+ high_bits = (pa >> 32) & 0xffffffff; -+ low_bits = (pa >> 0) & 0xffffffff; - - while (start < end) { - unsigned int *ia = (unsigned int *)(unsigned long)*start; - -- ia[0] = (ia[0] & ~0x3fffff) | (pa >> 10); -+ ia[0] = (ia[0] & ~0x3fffff) | (high_bits >> 10); - __asm__ __volatile__("flush %0" : : "r" (ia)); - -- ia[1] = (ia[1] & ~0x3ff) | (pa & 0x3ff); -+ ia[1] = (ia[1] & ~0x3fffff) | (low_bits >> 10); - __asm__ __volatile__("flush %0" : : "r" (ia + 1)); - -+ ia[2] = (ia[2] & ~0x1fff) | (high_bits & 0x3ff); -+ __asm__ __volatile__("flush %0" : : "r" (ia + 2)); -+ -+ ia[3] = (ia[3] & ~0x1fff) | (low_bits & 0x3ff); -+ __asm__ __volatile__("flush %0" : : "r" (ia + 3)); -+ - start++; - } - } -@@ -1847,7 +1936,6 @@ static void __init sun4v_linear_pte_xor_finalize(void) - /* paging_init() sets up the page tables */ - - static unsigned long last_valid_pfn; --pgd_t swapper_pg_dir[PTRS_PER_PGD]; - - static void sun4u_pgprot_init(void); - static void sun4v_pgprot_init(void); -@@ -1950,16 +2038,10 @@ void __init paging_init(void) - */ - init_mm.pgd += ((shift) / (sizeof(pgd_t))); - -- memset(swapper_low_pmd_dir, 0, sizeof(swapper_low_pmd_dir)); -+ memset(swapper_pg_dir, 0, sizeof(swapper_pg_dir)); - -- /* Now can init the kernel/bad page tables. */ -- pud_set(pud_offset(&swapper_pg_dir[0], 0), -- swapper_low_pmd_dir + (shift / sizeof(pgd_t))); -- - inherit_prom_mappings(); - -- init_kpte_bitmap(); -- - /* Ok, we can use our TLB miss and window trap handlers safely. */ - setup_tba(); - -@@ -2066,70 +2148,6 @@ int page_in_phys_avail(unsigned long paddr) - return 0; - } - --static struct linux_prom64_registers pavail_rescan[MAX_BANKS] __initdata; --static int pavail_rescan_ents __initdata; -- --/* Certain OBP calls, such as fetching "available" properties, can -- * claim physical memory. So, along with initializing the valid -- * address bitmap, what we do here is refetch the physical available -- * memory list again, and make sure it provides at least as much -- * memory as 'pavail' does. -- */ --static void __init setup_valid_addr_bitmap_from_pavail(unsigned long *bitmap) --{ -- int i; -- -- read_obp_memory("available", &pavail_rescan[0], &pavail_rescan_ents); -- -- for (i = 0; i < pavail_ents; i++) { -- unsigned long old_start, old_end; -- -- old_start = pavail[i].phys_addr; -- old_end = old_start + pavail[i].reg_size; -- while (old_start < old_end) { -- int n; -- -- for (n = 0; n < pavail_rescan_ents; n++) { -- unsigned long new_start, new_end; -- -- new_start = pavail_rescan[n].phys_addr; -- new_end = new_start + -- pavail_rescan[n].reg_size; -- -- if (new_start <= old_start && -- new_end >= (old_start + PAGE_SIZE)) { -- set_bit(old_start >> ILOG2_4MB, bitmap); -- goto do_next_page; -- } -- } -- -- prom_printf("mem_init: Lost memory in pavail\n"); -- prom_printf("mem_init: OLD start[%lx] size[%lx]\n", -- pavail[i].phys_addr, -- pavail[i].reg_size); -- prom_printf("mem_init: NEW start[%lx] size[%lx]\n", -- pavail_rescan[i].phys_addr, -- pavail_rescan[i].reg_size); -- prom_printf("mem_init: Cannot continue, aborting.\n"); -- prom_halt(); -- -- do_next_page: -- old_start += PAGE_SIZE; -- } -- } --} -- --static void __init patch_tlb_miss_handler_bitmap(void) --{ -- extern unsigned int valid_addr_bitmap_insn[]; -- extern unsigned int valid_addr_bitmap_patch[]; -- -- valid_addr_bitmap_insn[1] = valid_addr_bitmap_patch[1]; -- mb(); -- valid_addr_bitmap_insn[0] = valid_addr_bitmap_patch[0]; -- flushi(&valid_addr_bitmap_insn[0]); --} -- - static void __init register_page_bootmem_info(void) - { - #ifdef CONFIG_NEED_MULTIPLE_NODES -@@ -2142,18 +2160,6 @@ static void __init register_page_bootmem_info(void) - } - void __init mem_init(void) - { -- unsigned long addr, last; -- -- addr = PAGE_OFFSET + kern_base; -- last = PAGE_ALIGN(kern_size) + addr; -- while (addr < last) { -- set_bit(__pa(addr) >> ILOG2_4MB, sparc64_valid_addr_bitmap); -- addr += PAGE_SIZE; -- } -- -- setup_valid_addr_bitmap_from_pavail(sparc64_valid_addr_bitmap); -- patch_tlb_miss_handler_bitmap(); -- - high_memory = __va(last_valid_pfn << PAGE_SHIFT); - - register_page_bootmem_info(); -@@ -2243,18 +2249,9 @@ unsigned long _PAGE_CACHE __read_mostly; - EXPORT_SYMBOL(_PAGE_CACHE); - - #ifdef CONFIG_SPARSEMEM_VMEMMAP --unsigned long vmemmap_table[VMEMMAP_SIZE]; -- --static long __meminitdata addr_start, addr_end; --static int __meminitdata node_start; -- - int __meminit vmemmap_populate(unsigned long vstart, unsigned long vend, - int node) - { -- unsigned long phys_start = (vstart - VMEMMAP_BASE); -- unsigned long phys_end = (vend - VMEMMAP_BASE); -- unsigned long addr = phys_start & VMEMMAP_CHUNK_MASK; -- unsigned long end = VMEMMAP_ALIGN(phys_end); - unsigned long pte_base; - - pte_base = (_PAGE_VALID | _PAGE_SZ4MB_4U | -@@ -2265,47 +2262,52 @@ int __meminit vmemmap_populate(unsigned long vstart, unsigned long vend, - _PAGE_CP_4V | _PAGE_CV_4V | - _PAGE_P_4V | _PAGE_W_4V); - -- for (; addr < end; addr += VMEMMAP_CHUNK) { -- unsigned long *vmem_pp = -- vmemmap_table + (addr >> VMEMMAP_CHUNK_SHIFT); -- void *block; -+ pte_base |= _PAGE_PMD_HUGE; - -- if (!(*vmem_pp & _PAGE_VALID)) { -- block = vmemmap_alloc_block(1UL << ILOG2_4MB, node); -- if (!block) -+ vstart = vstart & PMD_MASK; -+ vend = ALIGN(vend, PMD_SIZE); -+ for (; vstart < vend; vstart += PMD_SIZE) { -+ pgd_t *pgd = pgd_offset_k(vstart); -+ unsigned long pte; -+ pud_t *pud; -+ pmd_t *pmd; -+ -+ if (pgd_none(*pgd)) { -+ pud_t *new = vmemmap_alloc_block(PAGE_SIZE, node); -+ -+ if (!new) - return -ENOMEM; -+ pgd_populate(&init_mm, pgd, new); -+ } - -- *vmem_pp = pte_base | __pa(block); -+ pud = pud_offset(pgd, vstart); -+ if (pud_none(*pud)) { -+ pmd_t *new = vmemmap_alloc_block(PAGE_SIZE, node); - -- /* check to see if we have contiguous blocks */ -- if (addr_end != addr || node_start != node) { -- if (addr_start) -- printk(KERN_DEBUG " [%lx-%lx] on node %d\n", -- addr_start, addr_end-1, node_start); -- addr_start = addr; -- node_start = node; -- } -- addr_end = addr + VMEMMAP_CHUNK; -+ if (!new) -+ return -ENOMEM; -+ pud_populate(&init_mm, pud, new); - } -- } -- return 0; --} - --void __meminit vmemmap_populate_print_last(void) --{ -- if (addr_start) { -- printk(KERN_DEBUG " [%lx-%lx] on node %d\n", -- addr_start, addr_end-1, node_start); -- addr_start = 0; -- addr_end = 0; -- node_start = 0; -+ pmd = pmd_offset(pud, vstart); -+ -+ pte = pmd_val(*pmd); -+ if (!(pte & _PAGE_VALID)) { -+ void *block = vmemmap_alloc_block(PMD_SIZE, node); -+ -+ if (!block) -+ return -ENOMEM; -+ -+ pmd_val(*pmd) = pte_base | __pa(block); -+ } - } -+ -+ return 0; - } - - void vmemmap_free(unsigned long start, unsigned long end) - { - } -- - #endif /* CONFIG_SPARSEMEM_VMEMMAP */ - - static void prot_init_common(unsigned long page_none, -@@ -2717,8 +2719,8 @@ void flush_tlb_kernel_range(unsigned long start, unsigned long end) - do_flush_tlb_kernel_range(start, LOW_OBP_ADDRESS); - } - if (end > HI_OBP_ADDRESS) { -- flush_tsb_kernel_range(end, HI_OBP_ADDRESS); -- do_flush_tlb_kernel_range(end, HI_OBP_ADDRESS); -+ flush_tsb_kernel_range(HI_OBP_ADDRESS, end); -+ do_flush_tlb_kernel_range(HI_OBP_ADDRESS, end); - } - } else { - flush_tsb_kernel_range(start, end); -diff --git a/arch/sparc/mm/init_64.h b/arch/sparc/mm/init_64.h -index 5d3782deb403..ac491193cb54 100644 ---- a/arch/sparc/mm/init_64.h -+++ b/arch/sparc/mm/init_64.h -@@ -8,15 +8,8 @@ - */ - - #define MAX_PHYS_ADDRESS (1UL << MAX_PHYS_ADDRESS_BITS) --#define KPTE_BITMAP_CHUNK_SZ (256UL * 1024UL * 1024UL) --#define KPTE_BITMAP_BYTES \ -- ((MAX_PHYS_ADDRESS / KPTE_BITMAP_CHUNK_SZ) / 4) --#define VALID_ADDR_BITMAP_CHUNK_SZ (4UL * 1024UL * 1024UL) --#define VALID_ADDR_BITMAP_BYTES \ -- ((MAX_PHYS_ADDRESS / VALID_ADDR_BITMAP_CHUNK_SZ) / 8) - - extern unsigned long kern_linear_pte_xor[4]; --extern unsigned long kpte_linear_bitmap[KPTE_BITMAP_BYTES / sizeof(unsigned long)]; - extern unsigned int sparc64_highest_unlocked_tlb_ent; - extern unsigned long sparc64_kern_pri_context; - extern unsigned long sparc64_kern_pri_nuc_bits; -@@ -38,15 +31,4 @@ extern unsigned long kern_locked_tte_data; - - extern void prom_world(int enter); - --#ifdef CONFIG_SPARSEMEM_VMEMMAP --#define VMEMMAP_CHUNK_SHIFT 22 --#define VMEMMAP_CHUNK (1UL << VMEMMAP_CHUNK_SHIFT) --#define VMEMMAP_CHUNK_MASK ~(VMEMMAP_CHUNK - 1UL) --#define VMEMMAP_ALIGN(x) (((x)+VMEMMAP_CHUNK-1UL)&VMEMMAP_CHUNK_MASK) -- --#define VMEMMAP_SIZE ((((1UL << MAX_PHYSADDR_BITS) >> PAGE_SHIFT) * \ -- sizeof(struct page)) >> VMEMMAP_CHUNK_SHIFT) --extern unsigned long vmemmap_table[VMEMMAP_SIZE]; --#endif -- - #endif /* _SPARC64_MM_INIT_H */ -diff --git a/arch/sparc/power/hibernate_asm.S b/arch/sparc/power/hibernate_asm.S -index 79942166df84..d7d9017dcb15 100644 ---- a/arch/sparc/power/hibernate_asm.S -+++ b/arch/sparc/power/hibernate_asm.S -@@ -54,8 +54,8 @@ ENTRY(swsusp_arch_resume) - nop - - /* Write PAGE_OFFSET to %g7 */ -- sethi %uhi(PAGE_OFFSET), %g7 -- sllx %g7, 32, %g7 -+ sethi %hi(PAGE_OFFSET), %g7 -+ ldx [%g7 + %lo(PAGE_OFFSET)], %g7 - - setuw (PAGE_SIZE-8), %g3 - -diff --git a/arch/sparc/prom/bootstr_64.c b/arch/sparc/prom/bootstr_64.c -index ab9ccc63b388..7149e77714a4 100644 ---- a/arch/sparc/prom/bootstr_64.c -+++ b/arch/sparc/prom/bootstr_64.c -@@ -14,7 +14,10 @@ - * the .bss section or it will break things. - */ - --#define BARG_LEN 256 -+/* We limit BARG_LEN to 1024 because this is the size of the -+ * 'barg_out' command line buffer in the SILO bootloader. -+ */ -+#define BARG_LEN 1024 - struct { - int bootstr_len; - int bootstr_valid; -diff --git a/arch/sparc/prom/cif.S b/arch/sparc/prom/cif.S -index 9c86b4b7d429..8050f381f518 100644 ---- a/arch/sparc/prom/cif.S -+++ b/arch/sparc/prom/cif.S -@@ -11,11 +11,10 @@ - .text - .globl prom_cif_direct - prom_cif_direct: -+ save %sp, -192, %sp - sethi %hi(p1275buf), %o1 - or %o1, %lo(p1275buf), %o1 -- ldx [%o1 + 0x0010], %o2 ! prom_cif_stack -- save %o2, -192, %sp -- ldx [%i1 + 0x0008], %l2 ! prom_cif_handler -+ ldx [%o1 + 0x0008], %l2 ! prom_cif_handler - mov %g4, %l0 - mov %g5, %l1 - mov %g6, %l3 -diff --git a/arch/sparc/prom/init_64.c b/arch/sparc/prom/init_64.c -index d95db755828f..110b0d78b864 100644 ---- a/arch/sparc/prom/init_64.c -+++ b/arch/sparc/prom/init_64.c -@@ -26,13 +26,13 @@ phandle prom_chosen_node; - * It gets passed the pointer to the PROM vector. - */ - --extern void prom_cif_init(void *, void *); -+extern void prom_cif_init(void *); - --void __init prom_init(void *cif_handler, void *cif_stack) -+void __init prom_init(void *cif_handler) - { - phandle node; - -- prom_cif_init(cif_handler, cif_stack); -+ prom_cif_init(cif_handler); - - prom_chosen_node = prom_finddevice(prom_chosen_path); - if (!prom_chosen_node || (s32)prom_chosen_node == -1) -diff --git a/arch/sparc/prom/p1275.c b/arch/sparc/prom/p1275.c -index e58b81726319..545d8bb79b65 100644 ---- a/arch/sparc/prom/p1275.c -+++ b/arch/sparc/prom/p1275.c -@@ -9,6 +9,7 @@ - #include <linux/smp.h> - #include <linux/string.h> - #include <linux/spinlock.h> -+#include <linux/irqflags.h> - - #include <asm/openprom.h> - #include <asm/oplib.h> -@@ -19,7 +20,6 @@ - struct { - long prom_callback; /* 0x00 */ - void (*prom_cif_handler)(long *); /* 0x08 */ -- unsigned long prom_cif_stack; /* 0x10 */ - } p1275buf; - - extern void prom_world(int); -@@ -36,8 +36,8 @@ void p1275_cmd_direct(unsigned long *args) - { - unsigned long flags; - -- raw_local_save_flags(flags); -- raw_local_irq_restore((unsigned long)PIL_NMI); -+ local_save_flags(flags); -+ local_irq_restore((unsigned long)PIL_NMI); - raw_spin_lock(&prom_entry_lock); - - prom_world(1); -@@ -45,11 +45,10 @@ void p1275_cmd_direct(unsigned long *args) - prom_world(0); - - raw_spin_unlock(&prom_entry_lock); -- raw_local_irq_restore(flags); -+ local_irq_restore(flags); - } - - void prom_cif_init(void *cif_handler, void *cif_stack) - { - p1275buf.prom_cif_handler = (void (*)(long *))cif_handler; -- p1275buf.prom_cif_stack = (unsigned long)cif_stack; - } -diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h -index d71d5ac78e42..ac63ea4af5b0 100644 ---- a/arch/x86/include/asm/kvm_host.h -+++ b/arch/x86/include/asm/kvm_host.h -@@ -480,6 +480,7 @@ struct kvm_vcpu_arch { - u64 mmio_gva; - unsigned access; - gfn_t mmio_gfn; -+ u64 mmio_gen; - - struct kvm_pmu pmu; - -diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c -index 5cd9bfabd645..c1a07d33e67e 100644 ---- a/arch/x86/kernel/cpu/intel.c -+++ b/arch/x86/kernel/cpu/intel.c -@@ -153,6 +153,21 @@ static void early_init_intel(struct cpuinfo_x86 *c) - setup_clear_cpu_cap(X86_FEATURE_ERMS); - } - } -+ -+ /* -+ * Intel Quark Core DevMan_001.pdf section 6.4.11 -+ * "The operating system also is required to invalidate (i.e., flush) -+ * the TLB when any changes are made to any of the page table entries. -+ * The operating system must reload CR3 to cause the TLB to be flushed" -+ * -+ * As a result cpu_has_pge() in arch/x86/include/asm/tlbflush.h should -+ * be false so that __flush_tlb_all() causes CR3 insted of CR4.PGE -+ * to be modified -+ */ -+ if (c->x86 == 5 && c->x86_model == 9) { -+ pr_info("Disabling PGE capability bit\n"); -+ setup_clear_cpu_cap(X86_FEATURE_PGE); -+ } - } - - #ifdef CONFIG_X86_32 -diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c -index 9b531351a587..49088b8a3ee3 100644 ---- a/arch/x86/kvm/mmu.c -+++ b/arch/x86/kvm/mmu.c -@@ -198,16 +198,20 @@ void kvm_mmu_set_mmio_spte_mask(u64 mmio_mask) - EXPORT_SYMBOL_GPL(kvm_mmu_set_mmio_spte_mask); - - /* -- * spte bits of bit 3 ~ bit 11 are used as low 9 bits of generation number, -- * the bits of bits 52 ~ bit 61 are used as high 10 bits of generation -- * number. -+ * the low bit of the generation number is always presumed to be zero. -+ * This disables mmio caching during memslot updates. The concept is -+ * similar to a seqcount but instead of retrying the access we just punt -+ * and ignore the cache. -+ * -+ * spte bits 3-11 are used as bits 1-9 of the generation number, -+ * the bits 52-61 are used as bits 10-19 of the generation number. - */ --#define MMIO_SPTE_GEN_LOW_SHIFT 3 -+#define MMIO_SPTE_GEN_LOW_SHIFT 2 - #define MMIO_SPTE_GEN_HIGH_SHIFT 52 - --#define MMIO_GEN_SHIFT 19 --#define MMIO_GEN_LOW_SHIFT 9 --#define MMIO_GEN_LOW_MASK ((1 << MMIO_GEN_LOW_SHIFT) - 1) -+#define MMIO_GEN_SHIFT 20 -+#define MMIO_GEN_LOW_SHIFT 10 -+#define MMIO_GEN_LOW_MASK ((1 << MMIO_GEN_LOW_SHIFT) - 2) - #define MMIO_GEN_MASK ((1 << MMIO_GEN_SHIFT) - 1) - #define MMIO_MAX_GEN ((1 << MMIO_GEN_SHIFT) - 1) - -@@ -3157,7 +3161,7 @@ static void mmu_sync_roots(struct kvm_vcpu *vcpu) - if (!VALID_PAGE(vcpu->arch.mmu.root_hpa)) - return; - -- vcpu_clear_mmio_info(vcpu, ~0ul); -+ vcpu_clear_mmio_info(vcpu, MMIO_GVA_ANY); - kvm_mmu_audit(vcpu, AUDIT_PRE_SYNC); - if (vcpu->arch.mmu.root_level == PT64_ROOT_LEVEL) { - hpa_t root = vcpu->arch.mmu.root_hpa; -@@ -4379,7 +4383,7 @@ void kvm_mmu_invalidate_mmio_sptes(struct kvm *kvm) - * The very rare case: if the generation-number is round, - * zap all shadow pages. - */ -- if (unlikely(kvm_current_mmio_generation(kvm) >= MMIO_MAX_GEN)) { -+ if (unlikely(kvm_current_mmio_generation(kvm) == 0)) { - printk_ratelimited(KERN_INFO "kvm: zapping shadow pages for mmio generation wraparound\n"); - kvm_mmu_invalidate_zap_all_pages(kvm); - } -diff --git a/arch/x86/kvm/x86.h b/arch/x86/kvm/x86.h -index 8da5823bcde6..21ea4fc91b5b 100644 ---- a/arch/x86/kvm/x86.h -+++ b/arch/x86/kvm/x86.h -@@ -78,15 +78,23 @@ static inline void vcpu_cache_mmio_info(struct kvm_vcpu *vcpu, - vcpu->arch.mmio_gva = gva & PAGE_MASK; - vcpu->arch.access = access; - vcpu->arch.mmio_gfn = gfn; -+ vcpu->arch.mmio_gen = kvm_memslots(vcpu->kvm)->generation; -+} -+ -+static inline bool vcpu_match_mmio_gen(struct kvm_vcpu *vcpu) -+{ -+ return vcpu->arch.mmio_gen == kvm_memslots(vcpu->kvm)->generation; - } - - /* -- * Clear the mmio cache info for the given gva, -- * specially, if gva is ~0ul, we clear all mmio cache info. -+ * Clear the mmio cache info for the given gva. If gva is MMIO_GVA_ANY, we -+ * clear all mmio cache info. - */ -+#define MMIO_GVA_ANY (~(gva_t)0) -+ - static inline void vcpu_clear_mmio_info(struct kvm_vcpu *vcpu, gva_t gva) - { -- if (gva != (~0ul) && vcpu->arch.mmio_gva != (gva & PAGE_MASK)) -+ if (gva != MMIO_GVA_ANY && vcpu->arch.mmio_gva != (gva & PAGE_MASK)) - return; - - vcpu->arch.mmio_gva = 0; -@@ -94,7 +102,8 @@ static inline void vcpu_clear_mmio_info(struct kvm_vcpu *vcpu, gva_t gva) - - static inline bool vcpu_match_mmio_gva(struct kvm_vcpu *vcpu, unsigned long gva) - { -- if (vcpu->arch.mmio_gva && vcpu->arch.mmio_gva == (gva & PAGE_MASK)) -+ if (vcpu_match_mmio_gen(vcpu) && vcpu->arch.mmio_gva && -+ vcpu->arch.mmio_gva == (gva & PAGE_MASK)) - return true; - - return false; -@@ -102,7 +111,8 @@ static inline bool vcpu_match_mmio_gva(struct kvm_vcpu *vcpu, unsigned long gva) - - static inline bool vcpu_match_mmio_gpa(struct kvm_vcpu *vcpu, gpa_t gpa) - { -- if (vcpu->arch.mmio_gfn && vcpu->arch.mmio_gfn == gpa >> PAGE_SHIFT) -+ if (vcpu_match_mmio_gen(vcpu) && vcpu->arch.mmio_gfn && -+ vcpu->arch.mmio_gfn == gpa >> PAGE_SHIFT) - return true; - - return false; -diff --git a/crypto/async_tx/async_xor.c b/crypto/async_tx/async_xor.c -index 3c562f5a60bb..e1bce26cd4f9 100644 ---- a/crypto/async_tx/async_xor.c -+++ b/crypto/async_tx/async_xor.c -@@ -78,8 +78,6 @@ do_async_xor(struct dma_chan *chan, struct dmaengine_unmap_data *unmap, - tx = dma->device_prep_dma_xor(chan, dma_dest, src_list, - xor_src_cnt, unmap->len, - dma_flags); -- src_list[0] = tmp; -- - - if (unlikely(!tx)) - async_tx_quiesce(&submit->depend_tx); -@@ -92,6 +90,7 @@ do_async_xor(struct dma_chan *chan, struct dmaengine_unmap_data *unmap, - xor_src_cnt, unmap->len, - dma_flags); - } -+ src_list[0] = tmp; - - dma_set_unmap(tx, unmap); - async_tx_submit(chan, tx, submit); -diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c -index c30df50e4440..2495ee577a64 100644 ---- a/drivers/base/firmware_class.c -+++ b/drivers/base/firmware_class.c -@@ -1081,6 +1081,9 @@ _request_firmware(const struct firmware **firmware_p, const char *name, - if (!firmware_p) - return -EINVAL; - -+ if (!name || name[0] == '\0') -+ return -EINVAL; -+ - ret = _request_firmware_prepare(&fw, name, device); - if (ret <= 0) /* error or already assigned */ - goto out; -diff --git a/drivers/base/regmap/regmap-debugfs.c b/drivers/base/regmap/regmap-debugfs.c -index c5471cd6ebb7..d39fd610aa3b 100644 ---- a/drivers/base/regmap/regmap-debugfs.c -+++ b/drivers/base/regmap/regmap-debugfs.c -@@ -473,6 +473,7 @@ void regmap_debugfs_init(struct regmap *map, const char *name) - { - struct rb_node *next; - struct regmap_range_node *range_node; -+ const char *devname = "dummy"; - - /* If we don't have the debugfs root yet, postpone init */ - if (!regmap_debugfs_root) { -@@ -491,12 +492,15 @@ void regmap_debugfs_init(struct regmap *map, const char *name) - INIT_LIST_HEAD(&map->debugfs_off_cache); - mutex_init(&map->cache_lock); - -+ if (map->dev) -+ devname = dev_name(map->dev); -+ - if (name) { - map->debugfs_name = kasprintf(GFP_KERNEL, "%s-%s", -- dev_name(map->dev), name); -+ devname, name); - name = map->debugfs_name; - } else { -- name = dev_name(map->dev); -+ name = devname; - } - - map->debugfs = debugfs_create_dir(name, regmap_debugfs_root); -diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c -index 2ea056c09aeb..f6cff3be0ed7 100644 ---- a/drivers/base/regmap/regmap.c -+++ b/drivers/base/regmap/regmap.c -@@ -1308,7 +1308,7 @@ int _regmap_write(struct regmap *map, unsigned int reg, - } - - #ifdef LOG_DEVICE -- if (strcmp(dev_name(map->dev), LOG_DEVICE) == 0) -+ if (map->dev && strcmp(dev_name(map->dev), LOG_DEVICE) == 0) - dev_info(map->dev, "%x <= %x\n", reg, val); - #endif - -@@ -1557,6 +1557,9 @@ int regmap_bulk_write(struct regmap *map, unsigned int reg, const void *val, - } else { - void *wval; - -+ if (!val_count) -+ return -EINVAL; -+ - wval = kmemdup(val, val_count * val_bytes, GFP_KERNEL); - if (!wval) { - ret = -ENOMEM; -@@ -1739,7 +1742,7 @@ static int _regmap_read(struct regmap *map, unsigned int reg, - ret = map->reg_read(context, reg, val); - if (ret == 0) { - #ifdef LOG_DEVICE -- if (strcmp(dev_name(map->dev), LOG_DEVICE) == 0) -+ if (map->dev && strcmp(dev_name(map->dev), LOG_DEVICE) == 0) - dev_info(map->dev, "%x => %x\n", reg, *val); - #endif - -diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c -index 1c7b5040d921..e00c3f84a4cf 100644 ---- a/drivers/bluetooth/btusb.c -+++ b/drivers/bluetooth/btusb.c -@@ -309,6 +309,9 @@ static void btusb_intr_complete(struct urb *urb) - BT_ERR("%s corrupted event packet", hdev->name); - hdev->stat.err_rx++; - } -+ } else if (urb->status == -ENOENT) { -+ /* Avoid suspend failed when usb_kill_urb */ -+ return; - } - - if (!test_bit(BTUSB_INTR_RUNNING, &data->flags)) -@@ -397,6 +400,9 @@ static void btusb_bulk_complete(struct urb *urb) - BT_ERR("%s corrupted ACL packet", hdev->name); - hdev->stat.err_rx++; - } -+ } else if (urb->status == -ENOENT) { -+ /* Avoid suspend failed when usb_kill_urb */ -+ return; - } - - if (!test_bit(BTUSB_BULK_RUNNING, &data->flags)) -@@ -491,6 +497,9 @@ static void btusb_isoc_complete(struct urb *urb) - hdev->stat.err_rx++; - } - } -+ } else if (urb->status == -ENOENT) { -+ /* Avoid suspend failed when usb_kill_urb */ -+ return; - } - - if (!test_bit(BTUSB_ISOC_RUNNING, &data->flags)) -diff --git a/drivers/bluetooth/hci_h5.c b/drivers/bluetooth/hci_h5.c -index e36a0245f2c1..56519927479f 100644 ---- a/drivers/bluetooth/hci_h5.c -+++ b/drivers/bluetooth/hci_h5.c -@@ -237,7 +237,7 @@ static void h5_pkt_cull(struct h5 *h5) - break; - - to_remove--; -- seq = (seq - 1) % 8; -+ seq = (seq - 1) & 0x07; - } - - if (seq != h5->rx_ack) -diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c -index 69ea36f07b4d..e99e71a6ea59 100644 ---- a/drivers/hv/channel.c -+++ b/drivers/hv/channel.c -@@ -164,8 +164,10 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size, - ret = vmbus_post_msg(open_msg, - sizeof(struct vmbus_channel_open_channel)); - -- if (ret != 0) -+ if (ret != 0) { -+ err = ret; - goto error1; -+ } - - t = wait_for_completion_timeout(&open_info->waitevent, 5*HZ); - if (t == 0) { -@@ -362,7 +364,6 @@ int vmbus_establish_gpadl(struct vmbus_channel *channel, void *kbuffer, - u32 next_gpadl_handle; - unsigned long flags; - int ret = 0; -- int t; - - next_gpadl_handle = atomic_read(&vmbus_connection.next_gpadl_handle); - atomic_inc(&vmbus_connection.next_gpadl_handle); -@@ -409,9 +410,7 @@ int vmbus_establish_gpadl(struct vmbus_channel *channel, void *kbuffer, - - } - } -- t = wait_for_completion_timeout(&msginfo->waitevent, 5*HZ); -- BUG_ON(t == 0); -- -+ wait_for_completion(&msginfo->waitevent); - - /* At this point, we received the gpadl created msg */ - *gpadl_handle = gpadlmsg->gpadl; -@@ -434,7 +433,7 @@ int vmbus_teardown_gpadl(struct vmbus_channel *channel, u32 gpadl_handle) - struct vmbus_channel_gpadl_teardown *msg; - struct vmbus_channel_msginfo *info; - unsigned long flags; -- int ret, t; -+ int ret; - - info = kmalloc(sizeof(*info) + - sizeof(struct vmbus_channel_gpadl_teardown), GFP_KERNEL); -@@ -456,11 +455,12 @@ int vmbus_teardown_gpadl(struct vmbus_channel *channel, u32 gpadl_handle) - ret = vmbus_post_msg(msg, - sizeof(struct vmbus_channel_gpadl_teardown)); - -- BUG_ON(ret != 0); -- t = wait_for_completion_timeout(&info->waitevent, 5*HZ); -- BUG_ON(t == 0); -+ if (ret) -+ goto post_msg_err; -+ -+ wait_for_completion(&info->waitevent); - -- /* Received a torndown response */ -+post_msg_err: - spin_lock_irqsave(&vmbus_connection.channelmsg_lock, flags); - list_del(&info->msglistentry); - spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock, flags); -@@ -470,7 +470,7 @@ int vmbus_teardown_gpadl(struct vmbus_channel *channel, u32 gpadl_handle) - } - EXPORT_SYMBOL_GPL(vmbus_teardown_gpadl); - --static void vmbus_close_internal(struct vmbus_channel *channel) -+static int vmbus_close_internal(struct vmbus_channel *channel) - { - struct vmbus_channel_close_channel *msg; - int ret; -@@ -492,11 +492,28 @@ static void vmbus_close_internal(struct vmbus_channel *channel) - - ret = vmbus_post_msg(msg, sizeof(struct vmbus_channel_close_channel)); - -- BUG_ON(ret != 0); -+ if (ret) { -+ pr_err("Close failed: close post msg return is %d\n", ret); -+ /* -+ * If we failed to post the close msg, -+ * it is perhaps better to leak memory. -+ */ -+ return ret; -+ } -+ - /* Tear down the gpadl for the channel's ring buffer */ -- if (channel->ringbuffer_gpadlhandle) -- vmbus_teardown_gpadl(channel, -- channel->ringbuffer_gpadlhandle); -+ if (channel->ringbuffer_gpadlhandle) { -+ ret = vmbus_teardown_gpadl(channel, -+ channel->ringbuffer_gpadlhandle); -+ if (ret) { -+ pr_err("Close failed: teardown gpadl return %d\n", ret); -+ /* -+ * If we failed to teardown gpadl, -+ * it is perhaps better to leak memory. -+ */ -+ return ret; -+ } -+ } - - /* Cleanup the ring buffers for this channel */ - hv_ringbuffer_cleanup(&channel->outbound); -@@ -505,7 +522,7 @@ static void vmbus_close_internal(struct vmbus_channel *channel) - free_pages((unsigned long)channel->ringbuffer_pages, - get_order(channel->ringbuffer_pagecount * PAGE_SIZE)); - -- -+ return ret; - } - - /* -diff --git a/drivers/hv/connection.c b/drivers/hv/connection.c -index ce5a9f2584f3..d8fd95cb0456 100644 ---- a/drivers/hv/connection.c -+++ b/drivers/hv/connection.c -@@ -408,10 +408,21 @@ int vmbus_post_msg(void *buffer, size_t buflen) - * insufficient resources. Retry the operation a couple of - * times before giving up. - */ -- while (retries < 3) { -- ret = hv_post_message(conn_id, 1, buffer, buflen); -- if (ret != HV_STATUS_INSUFFICIENT_BUFFERS) -+ while (retries < 10) { -+ ret = hv_post_message(conn_id, 1, buffer, buflen); -+ -+ switch (ret) { -+ case HV_STATUS_INSUFFICIENT_BUFFERS: -+ ret = -ENOMEM; -+ case -ENOMEM: -+ break; -+ case HV_STATUS_SUCCESS: - return ret; -+ default: -+ pr_err("hv_post_msg() failed; error code:%d\n", ret); -+ return -EINVAL; -+ } -+ - retries++; - msleep(100); - } -diff --git a/drivers/message/fusion/mptspi.c b/drivers/message/fusion/mptspi.c -index 5653e505f91f..424f51d1e2ce 100644 ---- a/drivers/message/fusion/mptspi.c -+++ b/drivers/message/fusion/mptspi.c -@@ -1422,6 +1422,11 @@ mptspi_probe(struct pci_dev *pdev, const struct pci_device_id *id) - goto out_mptspi_probe; - } - -+ /* VMWare emulation doesn't properly implement WRITE_SAME -+ */ -+ if (pdev->subsystem_vendor == 0x15AD) -+ sh->no_write_same = 1; -+ - spin_lock_irqsave(&ioc->FreeQlock, flags); - - /* Attach the SCSI Host to the IOC structure -diff --git a/drivers/misc/mei/bus.c b/drivers/misc/mei/bus.c -index 4bc7d620d695..9a07bba3ade4 100644 ---- a/drivers/misc/mei/bus.c -+++ b/drivers/misc/mei/bus.c -@@ -71,7 +71,7 @@ static int mei_cl_device_probe(struct device *dev) - - dev_dbg(dev, "Device probe\n"); - -- strncpy(id.name, dev_name(dev), sizeof(id.name)); -+ strlcpy(id.name, dev_name(dev), sizeof(id.name)); - - return driver->probe(device, &id); - } -diff --git a/drivers/net/wireless/iwlwifi/pcie/drv.c b/drivers/net/wireless/iwlwifi/pcie/drv.c -index df1f5e732ab5..1ac33d9cd396 100644 ---- a/drivers/net/wireless/iwlwifi/pcie/drv.c -+++ b/drivers/net/wireless/iwlwifi/pcie/drv.c -@@ -272,6 +272,8 @@ static DEFINE_PCI_DEVICE_TABLE(iwl_hw_card_ids) = { - {IWL_PCI_DEVICE(0x08B1, 0x4070, iwl7260_2ac_cfg)}, - {IWL_PCI_DEVICE(0x08B1, 0x4072, iwl7260_2ac_cfg)}, - {IWL_PCI_DEVICE(0x08B1, 0x4170, iwl7260_2ac_cfg)}, -+ {IWL_PCI_DEVICE(0x08B1, 0x4C60, iwl7260_2ac_cfg)}, -+ {IWL_PCI_DEVICE(0x08B1, 0x4C70, iwl7260_2ac_cfg)}, - {IWL_PCI_DEVICE(0x08B1, 0x4060, iwl7260_2n_cfg)}, - {IWL_PCI_DEVICE(0x08B1, 0x406A, iwl7260_2n_cfg)}, - {IWL_PCI_DEVICE(0x08B1, 0x4160, iwl7260_2n_cfg)}, -@@ -315,6 +317,8 @@ static DEFINE_PCI_DEVICE_TABLE(iwl_hw_card_ids) = { - {IWL_PCI_DEVICE(0x08B1, 0xC770, iwl7260_2ac_cfg)}, - {IWL_PCI_DEVICE(0x08B1, 0xC760, iwl7260_2n_cfg)}, - {IWL_PCI_DEVICE(0x08B2, 0xC270, iwl7260_2ac_cfg)}, -+ {IWL_PCI_DEVICE(0x08B1, 0xCC70, iwl7260_2ac_cfg)}, -+ {IWL_PCI_DEVICE(0x08B1, 0xCC60, iwl7260_2ac_cfg)}, - {IWL_PCI_DEVICE(0x08B2, 0xC272, iwl7260_2ac_cfg)}, - {IWL_PCI_DEVICE(0x08B2, 0xC260, iwl7260_2n_cfg)}, - {IWL_PCI_DEVICE(0x08B2, 0xC26A, iwl7260_n_cfg)}, -diff --git a/drivers/net/wireless/rt2x00/rt2800.h b/drivers/net/wireless/rt2x00/rt2800.h -index a394a9a95919..7cf6081a05a1 100644 ---- a/drivers/net/wireless/rt2x00/rt2800.h -+++ b/drivers/net/wireless/rt2x00/rt2800.h -@@ -2039,7 +2039,7 @@ struct mac_iveiv_entry { - * 2 - drop tx power by 12dBm, - * 3 - increase tx power by 6dBm - */ --#define BBP1_TX_POWER_CTRL FIELD8(0x07) -+#define BBP1_TX_POWER_CTRL FIELD8(0x03) - #define BBP1_TX_ANTENNA FIELD8(0x18) - - /* -diff --git a/drivers/pci/host/pci-mvebu.c b/drivers/pci/host/pci-mvebu.c -index 483d9ad89705..97736674ddcd 100644 ---- a/drivers/pci/host/pci-mvebu.c -+++ b/drivers/pci/host/pci-mvebu.c -@@ -855,7 +855,7 @@ static int mvebu_get_tgt_attr(struct device_node *np, int devfn, - rangesz = pna + na + ns; - nranges = rlen / sizeof(__be32) / rangesz; - -- for (i = 0; i < nranges; i++) { -+ for (i = 0; i < nranges; i++, range += rangesz) { - u32 flags = of_read_number(range, 1); - u32 slot = of_read_number(range + 1, 1); - u64 cpuaddr = of_read_number(range + na, pna); -@@ -865,14 +865,14 @@ static int mvebu_get_tgt_attr(struct device_node *np, int devfn, - rtype = IORESOURCE_IO; - else if (DT_FLAGS_TO_TYPE(flags) == DT_TYPE_MEM32) - rtype = IORESOURCE_MEM; -+ else -+ continue; - - if (slot == PCI_SLOT(devfn) && type == rtype) { - *tgt = DT_CPUADDR_TO_TARGET(cpuaddr); - *attr = DT_CPUADDR_TO_ATTR(cpuaddr); - return 0; - } -- -- range += rangesz; - } - - return -ENOENT; -diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c -index 276ef9c18802..39a207abaa10 100644 ---- a/drivers/pci/pci-sysfs.c -+++ b/drivers/pci/pci-sysfs.c -@@ -178,7 +178,7 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *attr, - { - struct pci_dev *pci_dev = to_pci_dev(dev); - -- return sprintf(buf, "pci:v%08Xd%08Xsv%08Xsd%08Xbc%02Xsc%02Xi%02x\n", -+ return sprintf(buf, "pci:v%08Xd%08Xsv%08Xsd%08Xbc%02Xsc%02Xi%02X\n", - pci_dev->vendor, pci_dev->device, - pci_dev->subsystem_vendor, pci_dev->subsystem_device, - (u8)(pci_dev->class >> 16), (u8)(pci_dev->class >> 8), -diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c -index 813f437f3ee8..6e8776b59a2c 100644 ---- a/drivers/pci/quirks.c -+++ b/drivers/pci/quirks.c -@@ -24,6 +24,7 @@ - #include <linux/ioport.h> - #include <linux/sched.h> - #include <linux/ktime.h> -+#include <linux/mm.h> - #include <asm/dma.h> /* isa_dma_bridge_buggy */ - #include "pci.h" - -@@ -287,6 +288,25 @@ static void quirk_citrine(struct pci_dev *dev) - } - DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_CITRINE, quirk_citrine); - -+/* On IBM Crocodile ipr SAS adapters, expand BAR to system page size */ -+static void quirk_extend_bar_to_page(struct pci_dev *dev) -+{ -+ int i; -+ -+ for (i = 0; i < PCI_STD_RESOURCE_END; i++) { -+ struct resource *r = &dev->resource[i]; -+ -+ if (r->flags & IORESOURCE_MEM && resource_size(r) < PAGE_SIZE) { -+ r->end = PAGE_SIZE - 1; -+ r->start = 0; -+ r->flags |= IORESOURCE_UNSET; -+ dev_info(&dev->dev, "expanded BAR %d to page size: %pR\n", -+ i, r); -+ } -+ } -+} -+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_IBM, 0x034a, quirk_extend_bar_to_page); -+ - /* - * S3 868 and 968 chips report region size equal to 32M, but they decode 64M. - * If it's needed, re-allocate the region. -diff --git a/drivers/scsi/be2iscsi/be_mgmt.c b/drivers/scsi/be2iscsi/be_mgmt.c -index b2fcac78feaa..5bb9406688c9 100644 ---- a/drivers/scsi/be2iscsi/be_mgmt.c -+++ b/drivers/scsi/be2iscsi/be_mgmt.c -@@ -897,17 +897,20 @@ mgmt_static_ip_modify(struct beiscsi_hba *phba, - - if (ip_action == IP_ACTION_ADD) { - memcpy(req->ip_params.ip_record.ip_addr.addr, ip_param->value, -- ip_param->len); -+ sizeof(req->ip_params.ip_record.ip_addr.addr)); - - if (subnet_param) - memcpy(req->ip_params.ip_record.ip_addr.subnet_mask, -- subnet_param->value, subnet_param->len); -+ subnet_param->value, -+ sizeof(req->ip_params.ip_record.ip_addr.subnet_mask)); - } else { - memcpy(req->ip_params.ip_record.ip_addr.addr, -- if_info->ip_addr.addr, ip_param->len); -+ if_info->ip_addr.addr, -+ sizeof(req->ip_params.ip_record.ip_addr.addr)); - - memcpy(req->ip_params.ip_record.ip_addr.subnet_mask, -- if_info->ip_addr.subnet_mask, ip_param->len); -+ if_info->ip_addr.subnet_mask, -+ sizeof(req->ip_params.ip_record.ip_addr.subnet_mask)); - } - - rc = mgmt_exec_nonemb_cmd(phba, &nonemb_cmd, NULL, 0); -@@ -935,7 +938,7 @@ static int mgmt_modify_gateway(struct beiscsi_hba *phba, uint8_t *gt_addr, - req->action = gtway_action; - req->ip_addr.ip_type = BE2_IPV4; - -- memcpy(req->ip_addr.addr, gt_addr, param_len); -+ memcpy(req->ip_addr.addr, gt_addr, sizeof(req->ip_addr.addr)); - - return mgmt_exec_nonemb_cmd(phba, &nonemb_cmd, NULL, 0); - } -diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c -index 83cb61266979..23c1b0cd3074 100644 ---- a/drivers/scsi/qla2xxx/qla_os.c -+++ b/drivers/scsi/qla2xxx/qla_os.c -@@ -3039,10 +3039,8 @@ qla2x00_unmap_iobases(struct qla_hw_data *ha) - } - - static void --qla2x00_clear_drv_active(scsi_qla_host_t *vha) -+qla2x00_clear_drv_active(struct qla_hw_data *ha) - { -- struct qla_hw_data *ha = vha->hw; -- - if (IS_QLA8044(ha)) { - qla8044_idc_lock(ha); - qla8044_clear_drv_active(ha); -@@ -3111,7 +3109,7 @@ qla2x00_remove_one(struct pci_dev *pdev) - - scsi_host_put(base_vha->host); - -- qla2x00_clear_drv_active(base_vha); -+ qla2x00_clear_drv_active(ha); - - qla2x00_unmap_iobases(ha); - -diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c -index 0cb73074c199..2f264ac79546 100644 ---- a/drivers/scsi/qla2xxx/qla_target.c -+++ b/drivers/scsi/qla2xxx/qla_target.c -@@ -1382,12 +1382,10 @@ static inline void qlt_unmap_sg(struct scsi_qla_host *vha, - static int qlt_check_reserve_free_req(struct scsi_qla_host *vha, - uint32_t req_cnt) - { -- struct qla_hw_data *ha = vha->hw; -- device_reg_t __iomem *reg = ha->iobase; - uint32_t cnt; - - if (vha->req->cnt < (req_cnt + 2)) { -- cnt = (uint16_t)RD_REG_DWORD(&reg->isp24.req_q_out); -+ cnt = (uint16_t)RD_REG_DWORD(vha->req->req_q_out); - - ql_dbg(ql_dbg_tgt, vha, 0xe00a, - "Request ring circled: cnt=%d, vha->->ring_index=%d, " -diff --git a/drivers/spi/spi-dw-mid.c b/drivers/spi/spi-dw-mid.c -index 6d207afec8cb..a4c45ea8f688 100644 ---- a/drivers/spi/spi-dw-mid.c -+++ b/drivers/spi/spi-dw-mid.c -@@ -89,7 +89,13 @@ err_exit: - - static void mid_spi_dma_exit(struct dw_spi *dws) - { -+ if (!dws->dma_inited) -+ return; -+ -+ dmaengine_terminate_all(dws->txchan); - dma_release_channel(dws->txchan); -+ -+ dmaengine_terminate_all(dws->rxchan); - dma_release_channel(dws->rxchan); - } - -@@ -136,7 +142,7 @@ static int mid_spi_dma_transfer(struct dw_spi *dws, int cs_change) - txconf.dst_addr = dws->dma_addr; - txconf.dst_maxburst = LNW_DMA_MSIZE_16; - txconf.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; -- txconf.dst_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES; -+ txconf.dst_addr_width = dws->dma_width; - txconf.device_fc = false; - - txchan->device->device_control(txchan, DMA_SLAVE_CONFIG, -@@ -159,7 +165,7 @@ static int mid_spi_dma_transfer(struct dw_spi *dws, int cs_change) - rxconf.src_addr = dws->dma_addr; - rxconf.src_maxburst = LNW_DMA_MSIZE_16; - rxconf.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; -- rxconf.src_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES; -+ rxconf.src_addr_width = dws->dma_width; - rxconf.device_fc = false; - - rxchan->device->device_control(rxchan, DMA_SLAVE_CONFIG, -diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c -index db8434d3def9..f4e68b3fc39d 100644 ---- a/drivers/tty/serial/omap-serial.c -+++ b/drivers/tty/serial/omap-serial.c -@@ -260,8 +260,16 @@ serial_omap_baud_is_mode16(struct uart_port *port, unsigned int baud) - { - unsigned int n13 = port->uartclk / (13 * baud); - unsigned int n16 = port->uartclk / (16 * baud); -- int baudAbsDiff13 = baud - (port->uartclk / (13 * n13)); -- int baudAbsDiff16 = baud - (port->uartclk / (16 * n16)); -+ int baudAbsDiff13; -+ int baudAbsDiff16; -+ -+ if (n13 == 0) -+ n13 = 1; -+ if (n16 == 0) -+ n16 = 1; -+ -+ baudAbsDiff13 = baud - (port->uartclk / (13 * n13)); -+ baudAbsDiff16 = baud - (port->uartclk / (16 * n16)); - if (baudAbsDiff13 < 0) - baudAbsDiff13 = -baudAbsDiff13; - if (baudAbsDiff16 < 0) -diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig -index 8154165aa601..fd13ef0a96c9 100644 ---- a/drivers/usb/gadget/Kconfig -+++ b/drivers/usb/gadget/Kconfig -@@ -445,7 +445,7 @@ config USB_GOKU - gadget drivers to also be dynamically linked. - - config USB_EG20T -- tristate "Intel EG20T PCH/LAPIS Semiconductor IOH(ML7213/ML7831) UDC" -+ tristate "Intel QUARK X1000/EG20T PCH/LAPIS Semiconductor IOH(ML7213/ML7831) UDC" - depends on PCI - help - This is a USB device driver for EG20T PCH. -@@ -466,6 +466,7 @@ config USB_EG20T - ML7213/ML7831 is companion chip for Intel Atom E6xx series. - ML7213/ML7831 is completely compatible for Intel EG20T PCH. - -+ This driver can be used with Intel's Quark X1000 SOC platform - # - # LAST -- dummy/emulated controller - # -diff --git a/drivers/usb/gadget/pch_udc.c b/drivers/usb/gadget/pch_udc.c -index eb8c3bedb57a..460d953c91b6 100644 ---- a/drivers/usb/gadget/pch_udc.c -+++ b/drivers/usb/gadget/pch_udc.c -@@ -343,6 +343,7 @@ struct pch_vbus_gpio_data { - * @setup_data: Received setup data - * @phys_addr: of device memory - * @base_addr: for mapped device memory -+ * @bar: Indicates which PCI BAR for USB regs - * @irq: IRQ line for the device - * @cfg_data: current cfg, intf, and alt in use - * @vbus_gpio: GPIO informaton for detecting VBUS -@@ -370,14 +371,17 @@ struct pch_udc_dev { - struct usb_ctrlrequest setup_data; - unsigned long phys_addr; - void __iomem *base_addr; -+ unsigned bar; - unsigned irq; - struct pch_udc_cfg_data cfg_data; - struct pch_vbus_gpio_data vbus_gpio; - }; - #define to_pch_udc(g) (container_of((g), struct pch_udc_dev, gadget)) - -+#define PCH_UDC_PCI_BAR_QUARK_X1000 0 - #define PCH_UDC_PCI_BAR 1 - #define PCI_DEVICE_ID_INTEL_EG20T_UDC 0x8808 -+#define PCI_DEVICE_ID_INTEL_QUARK_X1000_UDC 0x0939 - #define PCI_VENDOR_ID_ROHM 0x10DB - #define PCI_DEVICE_ID_ML7213_IOH_UDC 0x801D - #define PCI_DEVICE_ID_ML7831_IOH_UDC 0x8808 -@@ -3076,7 +3080,7 @@ static void pch_udc_remove(struct pci_dev *pdev) - iounmap(dev->base_addr); - if (dev->mem_region) - release_mem_region(dev->phys_addr, -- pci_resource_len(pdev, PCH_UDC_PCI_BAR)); -+ pci_resource_len(pdev, dev->bar)); - if (dev->active) - pci_disable_device(pdev); - kfree(dev); -@@ -3144,9 +3148,15 @@ static int pch_udc_probe(struct pci_dev *pdev, - dev->active = 1; - pci_set_drvdata(pdev, dev); - -+ /* Determine BAR based on PCI ID */ -+ if (id->device == PCI_DEVICE_ID_INTEL_QUARK_X1000_UDC) -+ dev->bar = PCH_UDC_PCI_BAR_QUARK_X1000; -+ else -+ dev->bar = PCH_UDC_PCI_BAR; -+ - /* PCI resource allocation */ -- resource = pci_resource_start(pdev, 1); -- len = pci_resource_len(pdev, 1); -+ resource = pci_resource_start(pdev, dev->bar); -+ len = pci_resource_len(pdev, dev->bar); - - if (!request_mem_region(resource, len, KBUILD_MODNAME)) { - dev_err(&pdev->dev, "%s: pci device used already\n", __func__); -@@ -3212,6 +3222,12 @@ finished: - - static const struct pci_device_id pch_udc_pcidev_id[] = { - { -+ PCI_DEVICE(PCI_VENDOR_ID_INTEL, -+ PCI_DEVICE_ID_INTEL_QUARK_X1000_UDC), -+ .class = (PCI_CLASS_SERIAL_USB << 8) | 0xfe, -+ .class_mask = 0xffffffff, -+ }, -+ { - PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_EG20T_UDC), - .class = (PCI_CLASS_SERIAL_USB << 8) | 0xfe, - .class_mask = 0xffffffff, -diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c -index 0165b8672f09..a9a881ed8cbe 100644 ---- a/fs/btrfs/file.c -+++ b/fs/btrfs/file.c -@@ -2510,23 +2510,28 @@ static int find_desired_extent(struct inode *inode, loff_t *offset, int whence) - struct btrfs_root *root = BTRFS_I(inode)->root; - struct extent_map *em = NULL; - struct extent_state *cached_state = NULL; -- u64 lockstart = *offset; -- u64 lockend = i_size_read(inode); -- u64 start = *offset; -- u64 len = i_size_read(inode); -+ u64 lockstart; -+ u64 lockend; -+ u64 start; -+ u64 len; - int ret = 0; - -- lockend = max_t(u64, root->sectorsize, lockend); -+ if (inode->i_size == 0) -+ return -ENXIO; -+ -+ /* -+ * *offset can be negative, in this case we start finding DATA/HOLE from -+ * the very start of the file. -+ */ -+ start = max_t(loff_t, 0, *offset); -+ -+ lockstart = round_down(start, root->sectorsize); -+ lockend = round_up(i_size_read(inode), root->sectorsize); - if (lockend <= lockstart) - lockend = lockstart + root->sectorsize; -- - lockend--; - len = lockend - lockstart + 1; - -- len = max_t(u64, len, root->sectorsize); -- if (inode->i_size == 0) -- return -ENXIO; -- - lock_extent_bits(&BTRFS_I(inode)->io_tree, lockstart, lockend, 0, - &cached_state); - -diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c -index c69c76351f12..d68a7250f00b 100644 ---- a/fs/btrfs/inode.c -+++ b/fs/btrfs/inode.c -@@ -3596,7 +3596,8 @@ noinline int btrfs_update_inode(struct btrfs_trans_handle *trans, - * without delay - */ - if (!btrfs_is_free_space_inode(inode) -- && root->root_key.objectid != BTRFS_DATA_RELOC_TREE_OBJECTID) { -+ && root->root_key.objectid != BTRFS_DATA_RELOC_TREE_OBJECTID -+ && !root->fs_info->log_root_recovering) { - btrfs_update_root_times(trans, root); - - ret = btrfs_delayed_update_inode(trans, root, inode); -diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c -index a6d8efa46bfe..0b72006aecbe 100644 ---- a/fs/btrfs/ioctl.c -+++ b/fs/btrfs/ioctl.c -@@ -302,6 +302,9 @@ static int btrfs_ioctl_setflags(struct file *file, void __user *arg) - goto out_drop; - - } else { -+ ret = btrfs_set_prop(inode, "btrfs.compression", NULL, 0, 0); -+ if (ret && ret != -ENODATA) -+ goto out_drop; - ip->flags &= ~(BTRFS_INODE_COMPRESS | BTRFS_INODE_NOCOMPRESS); - } - -@@ -4750,6 +4753,12 @@ long btrfs_ioctl(struct file *file, unsigned int - if (ret) - return ret; - ret = btrfs_sync_fs(file->f_dentry->d_sb, 1); -+ /* -+ * The transaction thread may want to do more work, -+ * namely it pokes the cleaner ktread that will start -+ * processing uncleaned subvols. -+ */ -+ wake_up_process(root->fs_info->transaction_kthread); - return ret; - } - case BTRFS_IOC_START_SYNC: -diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c -index 07b3b36f40ee..01f977e3ce09 100644 ---- a/fs/btrfs/relocation.c -+++ b/fs/btrfs/relocation.c -@@ -736,7 +736,8 @@ again: - err = ret; - goto out; - } -- BUG_ON(!ret || !path1->slots[0]); -+ ASSERT(ret); -+ ASSERT(path1->slots[0]); - - path1->slots[0]--; - -@@ -746,10 +747,10 @@ again: - * the backref was added previously when processing - * backref of type BTRFS_TREE_BLOCK_REF_KEY - */ -- BUG_ON(!list_is_singular(&cur->upper)); -+ ASSERT(list_is_singular(&cur->upper)); - edge = list_entry(cur->upper.next, struct backref_edge, - list[LOWER]); -- BUG_ON(!list_empty(&edge->list[UPPER])); -+ ASSERT(list_empty(&edge->list[UPPER])); - exist = edge->node[UPPER]; - /* - * add the upper level block to pending list if we need -@@ -831,7 +832,7 @@ again: - cur->cowonly = 1; - } - #else -- BUG_ON(key.type == BTRFS_EXTENT_REF_V0_KEY); -+ ASSERT(key.type != BTRFS_EXTENT_REF_V0_KEY); - if (key.type == BTRFS_SHARED_BLOCK_REF_KEY) { - #endif - if (key.objectid == key.offset) { -@@ -840,7 +841,7 @@ again: - * backref of this type. - */ - root = find_reloc_root(rc, cur->bytenr); -- BUG_ON(!root); -+ ASSERT(root); - cur->root = root; - break; - } -@@ -868,7 +869,7 @@ again: - } else { - upper = rb_entry(rb_node, struct backref_node, - rb_node); -- BUG_ON(!upper->checked); -+ ASSERT(upper->checked); - INIT_LIST_HEAD(&edge->list[UPPER]); - } - list_add_tail(&edge->list[LOWER], &cur->upper); -@@ -892,7 +893,7 @@ again: - - if (btrfs_root_level(&root->root_item) == cur->level) { - /* tree root */ -- BUG_ON(btrfs_root_bytenr(&root->root_item) != -+ ASSERT(btrfs_root_bytenr(&root->root_item) == - cur->bytenr); - if (should_ignore_root(root)) - list_add(&cur->list, &useless); -@@ -927,7 +928,7 @@ again: - need_check = true; - for (; level < BTRFS_MAX_LEVEL; level++) { - if (!path2->nodes[level]) { -- BUG_ON(btrfs_root_bytenr(&root->root_item) != -+ ASSERT(btrfs_root_bytenr(&root->root_item) == - lower->bytenr); - if (should_ignore_root(root)) - list_add(&lower->list, &useless); -@@ -976,12 +977,15 @@ again: - need_check = false; - list_add_tail(&edge->list[UPPER], - &list); -- } else -+ } else { -+ if (upper->checked) -+ need_check = true; - INIT_LIST_HEAD(&edge->list[UPPER]); -+ } - } else { - upper = rb_entry(rb_node, struct backref_node, - rb_node); -- BUG_ON(!upper->checked); -+ ASSERT(upper->checked); - INIT_LIST_HEAD(&edge->list[UPPER]); - if (!upper->owner) - upper->owner = btrfs_header_owner(eb); -@@ -1025,7 +1029,7 @@ next: - * everything goes well, connect backref nodes and insert backref nodes - * into the cache. - */ -- BUG_ON(!node->checked); -+ ASSERT(node->checked); - cowonly = node->cowonly; - if (!cowonly) { - rb_node = tree_insert(&cache->rb_root, node->bytenr, -@@ -1061,8 +1065,21 @@ next: - continue; - } - -- BUG_ON(!upper->checked); -- BUG_ON(cowonly != upper->cowonly); -+ if (!upper->checked) { -+ /* -+ * Still want to blow up for developers since this is a -+ * logic bug. -+ */ -+ ASSERT(0); -+ err = -EINVAL; -+ goto out; -+ } -+ if (cowonly != upper->cowonly) { -+ ASSERT(0); -+ err = -EINVAL; -+ goto out; -+ } -+ - if (!cowonly) { - rb_node = tree_insert(&cache->rb_root, upper->bytenr, - &upper->rb_node); -@@ -1085,7 +1102,7 @@ next: - while (!list_empty(&useless)) { - upper = list_entry(useless.next, struct backref_node, list); - list_del_init(&upper->list); -- BUG_ON(!list_empty(&upper->upper)); -+ ASSERT(list_empty(&upper->upper)); - if (upper == node) - node = NULL; - if (upper->lowest) { -@@ -1118,29 +1135,45 @@ out: - if (err) { - while (!list_empty(&useless)) { - lower = list_entry(useless.next, -- struct backref_node, upper); -- list_del_init(&lower->upper); -+ struct backref_node, list); -+ list_del_init(&lower->list); - } -- upper = node; -- INIT_LIST_HEAD(&list); -- while (upper) { -- if (RB_EMPTY_NODE(&upper->rb_node)) { -- list_splice_tail(&upper->upper, &list); -- free_backref_node(cache, upper); -- } -- -- if (list_empty(&list)) -- break; -- -- edge = list_entry(list.next, struct backref_edge, -- list[LOWER]); -+ while (!list_empty(&list)) { -+ edge = list_first_entry(&list, struct backref_edge, -+ list[UPPER]); -+ list_del(&edge->list[UPPER]); - list_del(&edge->list[LOWER]); -+ lower = edge->node[LOWER]; - upper = edge->node[UPPER]; - free_backref_edge(cache, edge); -+ -+ /* -+ * Lower is no longer linked to any upper backref nodes -+ * and isn't in the cache, we can free it ourselves. -+ */ -+ if (list_empty(&lower->upper) && -+ RB_EMPTY_NODE(&lower->rb_node)) -+ list_add(&lower->list, &useless); -+ -+ if (!RB_EMPTY_NODE(&upper->rb_node)) -+ continue; -+ -+ /* Add this guy's upper edges to the list to proces */ -+ list_for_each_entry(edge, &upper->upper, list[LOWER]) -+ list_add_tail(&edge->list[UPPER], &list); -+ if (list_empty(&upper->upper)) -+ list_add(&upper->list, &useless); -+ } -+ -+ while (!list_empty(&useless)) { -+ lower = list_entry(useless.next, -+ struct backref_node, list); -+ list_del_init(&lower->list); -+ free_backref_node(cache, lower); - } - return ERR_PTR(err); - } -- BUG_ON(node && node->detached); -+ ASSERT(!node || !node->detached); - return node; - } - -diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c -index a65ed4cb436b..20d793542096 100644 ---- a/fs/btrfs/send.c -+++ b/fs/btrfs/send.c -@@ -4728,7 +4728,9 @@ static int finish_inode_if_needed(struct send_ctx *sctx, int at_end) - - if (S_ISREG(sctx->cur_inode_mode)) { - if (need_send_hole(sctx)) { -- if (sctx->cur_inode_last_extent == (u64)-1) { -+ if (sctx->cur_inode_last_extent == (u64)-1 || -+ sctx->cur_inode_last_extent < -+ sctx->cur_inode_size) { - ret = get_last_extent(sctx, (u64)-1); - if (ret) - goto out; -diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c -index b05bf58b9395..a0b65a01fed7 100644 ---- a/fs/btrfs/transaction.c -+++ b/fs/btrfs/transaction.c -@@ -592,7 +592,6 @@ int btrfs_wait_for_commit(struct btrfs_root *root, u64 transid) - if (transid <= root->fs_info->last_trans_committed) - goto out; - -- ret = -EINVAL; - /* find specified transaction */ - spin_lock(&root->fs_info->trans_lock); - list_for_each_entry(t, &root->fs_info->trans_list, list) { -@@ -608,9 +607,16 @@ int btrfs_wait_for_commit(struct btrfs_root *root, u64 transid) - } - } - spin_unlock(&root->fs_info->trans_lock); -- /* The specified transaction doesn't exist */ -- if (!cur_trans) -+ -+ /* -+ * The specified transaction doesn't exist, or we -+ * raced with btrfs_commit_transaction -+ */ -+ if (!cur_trans) { -+ if (transid > root->fs_info->last_trans_committed) -+ ret = -EINVAL; - goto out; -+ } - } else { - /* find newest transaction that is committing | committed */ - spin_lock(&root->fs_info->trans_lock); -diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c -index b167ca48b8ee..a85ceb7c91bc 100644 ---- a/fs/ecryptfs/inode.c -+++ b/fs/ecryptfs/inode.c -@@ -1039,7 +1039,7 @@ ecryptfs_setxattr(struct dentry *dentry, const char *name, const void *value, - } - - rc = vfs_setxattr(lower_dentry, name, value, size, flags); -- if (!rc) -+ if (!rc && dentry->d_inode) - fsstack_copy_attr_all(dentry->d_inode, lower_dentry->d_inode); - out: - return rc; -diff --git a/fs/namespace.c b/fs/namespace.c -index 75536db4b69b..c7d4a0ae2c65 100644 ---- a/fs/namespace.c -+++ b/fs/namespace.c -@@ -1365,6 +1365,8 @@ static int do_umount(struct mount *mnt, int flags) - * Special case for "unmounting" root ... - * we just try to remount it readonly. - */ -+ if (!capable(CAP_SYS_ADMIN)) -+ return -EPERM; - down_write(&sb->s_umount); - if (!(sb->s_flags & MS_RDONLY)) - retval = do_remount_sb(sb, MS_RDONLY, NULL, 0); -diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c -index 2e9662ea5451..da657b7804a5 100644 ---- a/fs/nfs/nfs4proc.c -+++ b/fs/nfs/nfs4proc.c -@@ -7242,7 +7242,7 @@ static int nfs41_proc_async_sequence(struct nfs_client *clp, struct rpc_cred *cr - int ret = 0; - - if ((renew_flags & NFS4_RENEW_TIMEOUT) == 0) -- return 0; -+ return -EAGAIN; - task = _nfs41_proc_sequence(clp, cred, false); - if (IS_ERR(task)) - ret = PTR_ERR(task); -diff --git a/fs/nfs/nfs4renewd.c b/fs/nfs/nfs4renewd.c -index 1720d32ffa54..e1ba58c3d1ad 100644 ---- a/fs/nfs/nfs4renewd.c -+++ b/fs/nfs/nfs4renewd.c -@@ -88,10 +88,18 @@ nfs4_renew_state(struct work_struct *work) - } - nfs_expire_all_delegations(clp); - } else { -+ int ret; -+ - /* Queue an asynchronous RENEW. */ -- ops->sched_state_renewal(clp, cred, renew_flags); -+ ret = ops->sched_state_renewal(clp, cred, renew_flags); - put_rpccred(cred); -- goto out_exp; -+ switch (ret) { -+ default: -+ goto out_exp; -+ case -EAGAIN: -+ case -ENOMEM: -+ break; -+ } - } - } else { - dprintk("%s: failed to call renewd. Reason: lease not expired \n", -diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c -index 27f5f858502b..b4f177f1d405 100644 ---- a/fs/nfs/nfs4state.c -+++ b/fs/nfs/nfs4state.c -@@ -1732,7 +1732,8 @@ restart: - if (status < 0) { - set_bit(ops->owner_flag_bit, &sp->so_flags); - nfs4_put_state_owner(sp); -- return nfs4_recovery_handle_error(clp, status); -+ status = nfs4_recovery_handle_error(clp, status); -+ return (status != 0) ? status : -EAGAIN; - } - - nfs4_put_state_owner(sp); -@@ -1741,7 +1742,7 @@ restart: - spin_unlock(&clp->cl_lock); - } - rcu_read_unlock(); -- return status; -+ return 0; - } - - static int nfs4_check_lease(struct nfs_client *clp) -@@ -1788,7 +1789,6 @@ static int nfs4_handle_reclaim_lease_error(struct nfs_client *clp, int status) - break; - case -NFS4ERR_STALE_CLIENTID: - clear_bit(NFS4CLNT_LEASE_CONFIRM, &clp->cl_state); -- nfs4_state_clear_reclaim_reboot(clp); - nfs4_state_start_reclaim_reboot(clp); - break; - case -NFS4ERR_CLID_INUSE: -@@ -2370,6 +2370,7 @@ static void nfs4_state_manager(struct nfs_client *clp) - status = nfs4_check_lease(clp); - if (status < 0) - goto out_error; -+ continue; - } - - if (test_and_clear_bit(NFS4CLNT_MOVED, &clp->cl_state)) { -@@ -2391,14 +2392,11 @@ static void nfs4_state_manager(struct nfs_client *clp) - section = "reclaim reboot"; - status = nfs4_do_reclaim(clp, - clp->cl_mvops->reboot_recovery_ops); -- if (test_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state) || -- test_bit(NFS4CLNT_SESSION_RESET, &clp->cl_state)) -- continue; -- nfs4_state_end_reclaim_reboot(clp); -- if (test_bit(NFS4CLNT_RECLAIM_NOGRACE, &clp->cl_state)) -+ if (status == -EAGAIN) - continue; - if (status < 0) - goto out_error; -+ nfs4_state_end_reclaim_reboot(clp); - } - - /* Now recover expired state... */ -@@ -2406,9 +2404,7 @@ static void nfs4_state_manager(struct nfs_client *clp) - section = "reclaim nograce"; - status = nfs4_do_reclaim(clp, - clp->cl_mvops->nograce_recovery_ops); -- if (test_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state) || -- test_bit(NFS4CLNT_SESSION_RESET, &clp->cl_state) || -- test_bit(NFS4CLNT_RECLAIM_REBOOT, &clp->cl_state)) -+ if (status == -EAGAIN) - continue; - if (status < 0) - goto out_error; -diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c -index 287a22c04149..de6323eb0113 100644 ---- a/fs/notify/fanotify/fanotify_user.c -+++ b/fs/notify/fanotify/fanotify_user.c -@@ -71,7 +71,7 @@ static int create_fd(struct fsnotify_group *group, - - pr_debug("%s: group=%p event=%p\n", __func__, group, event); - -- client_fd = get_unused_fd(); -+ client_fd = get_unused_fd_flags(group->fanotify_data.f_flags); - if (client_fd < 0) - return client_fd; - -diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c -index 5d2518b24cea..0461fbe405b7 100644 ---- a/fs/xfs/xfs_aops.c -+++ b/fs/xfs/xfs_aops.c -@@ -434,10 +434,22 @@ xfs_start_page_writeback( - { - ASSERT(PageLocked(page)); - ASSERT(!PageWriteback(page)); -- if (clear_dirty) -+ -+ /* -+ * if the page was not fully cleaned, we need to ensure that the higher -+ * layers come back to it correctly. That means we need to keep the page -+ * dirty, and for WB_SYNC_ALL writeback we need to ensure the -+ * PAGECACHE_TAG_TOWRITE index mark is not removed so another attempt to -+ * write this page in this writeback sweep will be made. -+ */ -+ if (clear_dirty) { - clear_page_dirty_for_io(page); -- set_page_writeback(page); -+ set_page_writeback(page); -+ } else -+ set_page_writeback_keepwrite(page); -+ - unlock_page(page); -+ - /* If no buffers on the page are to be written, finish it here */ - if (!buffers) - end_page_writeback(page); -diff --git a/include/linux/compiler-gcc5.h b/include/linux/compiler-gcc5.h -new file mode 100644 -index 000000000000..cdd1cc202d51 ---- /dev/null -+++ b/include/linux/compiler-gcc5.h -@@ -0,0 +1,66 @@ -+#ifndef __LINUX_COMPILER_H -+#error "Please don't include <linux/compiler-gcc5.h> directly, include <linux/compiler.h> instead." -+#endif -+ -+#define __used __attribute__((__used__)) -+#define __must_check __attribute__((warn_unused_result)) -+#define __compiler_offsetof(a, b) __builtin_offsetof(a, b) -+ -+/* Mark functions as cold. gcc will assume any path leading to a call -+ to them will be unlikely. This means a lot of manual unlikely()s -+ are unnecessary now for any paths leading to the usual suspects -+ like BUG(), printk(), panic() etc. [but let's keep them for now for -+ older compilers] -+ -+ Early snapshots of gcc 4.3 don't support this and we can't detect this -+ in the preprocessor, but we can live with this because they're unreleased. -+ Maketime probing would be overkill here. -+ -+ gcc also has a __attribute__((__hot__)) to move hot functions into -+ a special section, but I don't see any sense in this right now in -+ the kernel context */ -+#define __cold __attribute__((__cold__)) -+ -+#define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__) -+ -+#ifndef __CHECKER__ -+# define __compiletime_warning(message) __attribute__((warning(message))) -+# define __compiletime_error(message) __attribute__((error(message))) -+#endif /* __CHECKER__ */ -+ -+/* -+ * Mark a position in code as unreachable. This can be used to -+ * suppress control flow warnings after asm blocks that transfer -+ * control elsewhere. -+ * -+ * Early snapshots of gcc 4.5 don't support this and we can't detect -+ * this in the preprocessor, but we can live with this because they're -+ * unreleased. Really, we need to have autoconf for the kernel. -+ */ -+#define unreachable() __builtin_unreachable() -+ -+/* Mark a function definition as prohibited from being cloned. */ -+#define __noclone __attribute__((__noclone__)) -+ -+/* -+ * Tell the optimizer that something else uses this function or variable. -+ */ -+#define __visible __attribute__((externally_visible)) -+ -+/* -+ * GCC 'asm goto' miscompiles certain code sequences: -+ * -+ * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670 -+ * -+ * Work it around via a compiler barrier quirk suggested by Jakub Jelinek. -+ * Fixed in GCC 4.8.2 and later versions. -+ * -+ * (asm goto is automatically volatile - the naming reflects this.) -+ */ -+#define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0) -+ -+#ifdef CONFIG_ARCH_USE_BUILTIN_BSWAP -+#define __HAVE_BUILTIN_BSWAP32__ -+#define __HAVE_BUILTIN_BSWAP64__ -+#define __HAVE_BUILTIN_BSWAP16__ -+#endif /* CONFIG_ARCH_USE_BUILTIN_BSWAP */ -diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h -index 97fbecdd7a40..057c1d8c77e5 100644 ---- a/include/linux/pci_ids.h -+++ b/include/linux/pci_ids.h -@@ -2551,6 +2551,7 @@ - #define PCI_DEVICE_ID_INTEL_MFD_EMMC0 0x0823 - #define PCI_DEVICE_ID_INTEL_MFD_EMMC1 0x0824 - #define PCI_DEVICE_ID_INTEL_MRST_SD2 0x084F -+#define PCI_DEVICE_ID_INTEL_QUARK_X1000_ILB 0x095E - #define PCI_DEVICE_ID_INTEL_I960 0x0960 - #define PCI_DEVICE_ID_INTEL_I960RM 0x0962 - #define PCI_DEVICE_ID_INTEL_CENTERTON_ILB 0x0c60 -diff --git a/include/linux/sched.h b/include/linux/sched.h -index d7ca410ace93..218b058060f1 100644 ---- a/include/linux/sched.h -+++ b/include/linux/sched.h -@@ -1876,11 +1876,13 @@ extern void thread_group_cputime_adjusted(struct task_struct *p, cputime_t *ut, - #define tsk_used_math(p) ((p)->flags & PF_USED_MATH) - #define used_math() tsk_used_math(current) - --/* __GFP_IO isn't allowed if PF_MEMALLOC_NOIO is set in current->flags */ -+/* __GFP_IO isn't allowed if PF_MEMALLOC_NOIO is set in current->flags -+ * __GFP_FS is also cleared as it implies __GFP_IO. -+ */ - static inline gfp_t memalloc_noio_flags(gfp_t flags) - { - if (unlikely(current->flags & PF_MEMALLOC_NOIO)) -- flags &= ~__GFP_IO; -+ flags &= ~(__GFP_IO | __GFP_FS); - return flags; - } - -diff --git a/kernel/futex.c b/kernel/futex.c -index 0b0dc02aabce..fda2950f2ce4 100644 ---- a/kernel/futex.c -+++ b/kernel/futex.c -@@ -329,6 +329,8 @@ static void get_futex_key_refs(union futex_key *key) - case FUT_OFF_MMSHARED: - futex_get_mm(key); /* implies MB (B) */ - break; -+ default: -+ smp_mb(); /* explicit MB (B) */ - } - } - -diff --git a/lib/lzo/lzo1x_decompress_safe.c b/lib/lzo/lzo1x_decompress_safe.c -index 8563081e8da3..a1c387f6afba 100644 ---- a/lib/lzo/lzo1x_decompress_safe.c -+++ b/lib/lzo/lzo1x_decompress_safe.c -@@ -19,31 +19,21 @@ - #include <linux/lzo.h> - #include "lzodefs.h" - --#define HAVE_IP(t, x) \ -- (((size_t)(ip_end - ip) >= (size_t)(t + x)) && \ -- (((t + x) >= t) && ((t + x) >= x))) -+#define HAVE_IP(x) ((size_t)(ip_end - ip) >= (size_t)(x)) -+#define HAVE_OP(x) ((size_t)(op_end - op) >= (size_t)(x)) -+#define NEED_IP(x) if (!HAVE_IP(x)) goto input_overrun -+#define NEED_OP(x) if (!HAVE_OP(x)) goto output_overrun -+#define TEST_LB(m_pos) if ((m_pos) < out) goto lookbehind_overrun - --#define HAVE_OP(t, x) \ -- (((size_t)(op_end - op) >= (size_t)(t + x)) && \ -- (((t + x) >= t) && ((t + x) >= x))) -- --#define NEED_IP(t, x) \ -- do { \ -- if (!HAVE_IP(t, x)) \ -- goto input_overrun; \ -- } while (0) -- --#define NEED_OP(t, x) \ -- do { \ -- if (!HAVE_OP(t, x)) \ -- goto output_overrun; \ -- } while (0) -- --#define TEST_LB(m_pos) \ -- do { \ -- if ((m_pos) < out) \ -- goto lookbehind_overrun; \ -- } while (0) -+/* This MAX_255_COUNT is the maximum number of times we can add 255 to a base -+ * count without overflowing an integer. The multiply will overflow when -+ * multiplying 255 by more than MAXINT/255. The sum will overflow earlier -+ * depending on the base count. Since the base count is taken from a u8 -+ * and a few bits, it is safe to assume that it will always be lower than -+ * or equal to 2*255, thus we can always prevent any overflow by accepting -+ * two less 255 steps. See Documentation/lzo.txt for more information. -+ */ -+#define MAX_255_COUNT ((((size_t)~0) / 255) - 2) - - int lzo1x_decompress_safe(const unsigned char *in, size_t in_len, - unsigned char *out, size_t *out_len) -@@ -75,17 +65,24 @@ int lzo1x_decompress_safe(const unsigned char *in, size_t in_len, - if (t < 16) { - if (likely(state == 0)) { - if (unlikely(t == 0)) { -+ size_t offset; -+ const unsigned char *ip_last = ip; -+ - while (unlikely(*ip == 0)) { -- t += 255; - ip++; -- NEED_IP(1, 0); -+ NEED_IP(1); - } -- t += 15 + *ip++; -+ offset = ip - ip_last; -+ if (unlikely(offset > MAX_255_COUNT)) -+ return LZO_E_ERROR; -+ -+ offset = (offset << 8) - offset; -+ t += offset + 15 + *ip++; - } - t += 3; - copy_literal_run: - #if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) -- if (likely(HAVE_IP(t, 15) && HAVE_OP(t, 15))) { -+ if (likely(HAVE_IP(t + 15) && HAVE_OP(t + 15))) { - const unsigned char *ie = ip + t; - unsigned char *oe = op + t; - do { -@@ -101,8 +98,8 @@ copy_literal_run: - } else - #endif - { -- NEED_OP(t, 0); -- NEED_IP(t, 3); -+ NEED_OP(t); -+ NEED_IP(t + 3); - do { - *op++ = *ip++; - } while (--t > 0); -@@ -115,7 +112,7 @@ copy_literal_run: - m_pos -= t >> 2; - m_pos -= *ip++ << 2; - TEST_LB(m_pos); -- NEED_OP(2, 0); -+ NEED_OP(2); - op[0] = m_pos[0]; - op[1] = m_pos[1]; - op += 2; -@@ -136,13 +133,20 @@ copy_literal_run: - } else if (t >= 32) { - t = (t & 31) + (3 - 1); - if (unlikely(t == 2)) { -+ size_t offset; -+ const unsigned char *ip_last = ip; -+ - while (unlikely(*ip == 0)) { -- t += 255; - ip++; -- NEED_IP(1, 0); -+ NEED_IP(1); - } -- t += 31 + *ip++; -- NEED_IP(2, 0); -+ offset = ip - ip_last; -+ if (unlikely(offset > MAX_255_COUNT)) -+ return LZO_E_ERROR; -+ -+ offset = (offset << 8) - offset; -+ t += offset + 31 + *ip++; -+ NEED_IP(2); - } - m_pos = op - 1; - next = get_unaligned_le16(ip); -@@ -154,13 +158,20 @@ copy_literal_run: - m_pos -= (t & 8) << 11; - t = (t & 7) + (3 - 1); - if (unlikely(t == 2)) { -+ size_t offset; -+ const unsigned char *ip_last = ip; -+ - while (unlikely(*ip == 0)) { -- t += 255; - ip++; -- NEED_IP(1, 0); -+ NEED_IP(1); - } -- t += 7 + *ip++; -- NEED_IP(2, 0); -+ offset = ip - ip_last; -+ if (unlikely(offset > MAX_255_COUNT)) -+ return LZO_E_ERROR; -+ -+ offset = (offset << 8) - offset; -+ t += offset + 7 + *ip++; -+ NEED_IP(2); - } - next = get_unaligned_le16(ip); - ip += 2; -@@ -174,7 +185,7 @@ copy_literal_run: - #if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) - if (op - m_pos >= 8) { - unsigned char *oe = op + t; -- if (likely(HAVE_OP(t, 15))) { -+ if (likely(HAVE_OP(t + 15))) { - do { - COPY8(op, m_pos); - op += 8; -@@ -184,7 +195,7 @@ copy_literal_run: - m_pos += 8; - } while (op < oe); - op = oe; -- if (HAVE_IP(6, 0)) { -+ if (HAVE_IP(6)) { - state = next; - COPY4(op, ip); - op += next; -@@ -192,7 +203,7 @@ copy_literal_run: - continue; - } - } else { -- NEED_OP(t, 0); -+ NEED_OP(t); - do { - *op++ = *m_pos++; - } while (op < oe); -@@ -201,7 +212,7 @@ copy_literal_run: - #endif - { - unsigned char *oe = op + t; -- NEED_OP(t, 0); -+ NEED_OP(t); - op[0] = m_pos[0]; - op[1] = m_pos[1]; - op += 2; -@@ -214,15 +225,15 @@ match_next: - state = next; - t = next; - #if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) -- if (likely(HAVE_IP(6, 0) && HAVE_OP(4, 0))) { -+ if (likely(HAVE_IP(6) && HAVE_OP(4))) { - COPY4(op, ip); - op += t; - ip += t; - } else - #endif - { -- NEED_IP(t, 3); -- NEED_OP(t, 0); -+ NEED_IP(t + 3); -+ NEED_OP(t); - while (t > 0) { - *op++ = *ip++; - t--; -diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c -index 6afa3b45f25a..0007c9e9853a 100644 ---- a/net/bluetooth/l2cap_core.c -+++ b/net/bluetooth/l2cap_core.c -@@ -2608,12 +2608,8 @@ static int l2cap_segment_le_sdu(struct l2cap_chan *chan, - - BT_DBG("chan %p, msg %p, len %zu", chan, msg, len); - -- pdu_len = chan->conn->mtu - L2CAP_HDR_SIZE; -- -- pdu_len = min_t(size_t, pdu_len, chan->remote_mps); -- - sdu_len = len; -- pdu_len -= L2CAP_SDULEN_SIZE; -+ pdu_len = chan->remote_mps - L2CAP_SDULEN_SIZE; - - while (len > 0) { - if (len <= pdu_len) -diff --git a/security/integrity/ima/ima_appraise.c b/security/integrity/ima/ima_appraise.c -index 734e9468aca0..6df1b2527d02 100644 ---- a/security/integrity/ima/ima_appraise.c -+++ b/security/integrity/ima/ima_appraise.c -@@ -194,8 +194,11 @@ int ima_appraise_measurement(int func, struct integrity_iint_cache *iint, - goto out; - - cause = "missing-hash"; -- status = -- (inode->i_size == 0) ? INTEGRITY_PASS : INTEGRITY_NOLABEL; -+ status = INTEGRITY_NOLABEL; -+ if (inode->i_size == 0) { -+ iint->flags |= IMA_NEW_FILE; -+ status = INTEGRITY_PASS; -+ } - goto out; - } - -diff --git a/security/integrity/ima/ima_main.c b/security/integrity/ima/ima_main.c -index 76d8aad146a8..9f70efd08058 100644 ---- a/security/integrity/ima/ima_main.c -+++ b/security/integrity/ima/ima_main.c -@@ -131,11 +131,13 @@ static void ima_check_last_writer(struct integrity_iint_cache *iint, - return; - - mutex_lock(&inode->i_mutex); -- if (atomic_read(&inode->i_writecount) == 1 && -- iint->version != inode->i_version) { -- iint->flags &= ~IMA_DONE_MASK; -- if (iint->flags & IMA_APPRAISE) -- ima_update_xattr(iint, file); -+ if (atomic_read(&inode->i_writecount) == 1) { -+ if ((iint->version != inode->i_version) || -+ (iint->flags & IMA_NEW_FILE)) { -+ iint->flags &= ~(IMA_DONE_MASK | IMA_NEW_FILE); -+ if (iint->flags & IMA_APPRAISE) -+ ima_update_xattr(iint, file); -+ } - } - mutex_unlock(&inode->i_mutex); - } -diff --git a/security/integrity/integrity.h b/security/integrity/integrity.h -index 33c0a70f6b15..2f8715d77a5a 100644 ---- a/security/integrity/integrity.h -+++ b/security/integrity/integrity.h -@@ -31,6 +31,7 @@ - #define IMA_DIGSIG 0x01000000 - #define IMA_DIGSIG_REQUIRED 0x02000000 - #define IMA_PERMIT_DIRECTIO 0x04000000 -+#define IMA_NEW_FILE 0x08000000 - - #define IMA_DO_MASK (IMA_MEASURE | IMA_APPRAISE | IMA_AUDIT | \ - IMA_APPRAISE_SUBMASK) -diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c -index 01a5e05ede95..566b0f69d628 100644 ---- a/sound/core/pcm_native.c -+++ b/sound/core/pcm_native.c -@@ -3189,7 +3189,7 @@ static const struct vm_operations_struct snd_pcm_vm_ops_data_fault = { - - #ifndef ARCH_HAS_DMA_MMAP_COHERENT - /* This should be defined / handled globally! */ --#ifdef CONFIG_ARM -+#if defined(CONFIG_ARM) || defined(CONFIG_ARM64) - #define ARCH_HAS_DMA_MMAP_COHERENT - #endif - #endif -diff --git a/sound/pci/emu10k1/emu10k1_callback.c b/sound/pci/emu10k1/emu10k1_callback.c -index cae36597aa71..0a34b5f1c475 100644 ---- a/sound/pci/emu10k1/emu10k1_callback.c -+++ b/sound/pci/emu10k1/emu10k1_callback.c -@@ -85,6 +85,8 @@ snd_emu10k1_ops_setup(struct snd_emux *emux) - * get more voice for pcm - * - * terminate most inactive voice and give it as a pcm voice. -+ * -+ * voice_lock is already held. - */ - int - snd_emu10k1_synth_get_voice(struct snd_emu10k1 *hw) -@@ -92,12 +94,10 @@ snd_emu10k1_synth_get_voice(struct snd_emu10k1 *hw) - struct snd_emux *emu; - struct snd_emux_voice *vp; - struct best_voice best[V_END]; -- unsigned long flags; - int i; - - emu = hw->synth; - -- spin_lock_irqsave(&emu->voice_lock, flags); - lookup_voices(emu, hw, best, 1); /* no OFF voices */ - for (i = 0; i < V_END; i++) { - if (best[i].voice >= 0) { -@@ -113,11 +113,9 @@ snd_emu10k1_synth_get_voice(struct snd_emu10k1 *hw) - vp->emu->num_voices--; - vp->ch = -1; - vp->state = SNDRV_EMUX_ST_OFF; -- spin_unlock_irqrestore(&emu->voice_lock, flags); - return ch; - } - } -- spin_unlock_irqrestore(&emu->voice_lock, flags); - - /* not found */ - return -ENOMEM; -diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c -index d135c906caff..8253b48a435b 100644 ---- a/sound/pci/hda/patch_hdmi.c -+++ b/sound/pci/hda/patch_hdmi.c -@@ -1557,19 +1557,22 @@ static bool hdmi_present_sense(struct hdmi_spec_per_pin *per_pin, int repoll) - } - } - -- if (pin_eld->eld_valid && !eld->eld_valid) { -- update_eld = true; -+ if (pin_eld->eld_valid != eld->eld_valid) - eld_changed = true; -- } -+ -+ if (pin_eld->eld_valid && !eld->eld_valid) -+ update_eld = true; -+ - if (update_eld) { - bool old_eld_valid = pin_eld->eld_valid; - pin_eld->eld_valid = eld->eld_valid; -- eld_changed = pin_eld->eld_size != eld->eld_size || -+ if (pin_eld->eld_size != eld->eld_size || - memcmp(pin_eld->eld_buffer, eld->eld_buffer, -- eld->eld_size) != 0; -- if (eld_changed) -+ eld->eld_size) != 0) { - memcpy(pin_eld->eld_buffer, eld->eld_buffer, - eld->eld_size); -+ eld_changed = true; -+ } - pin_eld->eld_size = eld->eld_size; - pin_eld->info = eld->info; - -diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c -index 5d0058bd6259..4c826a40705c 100644 ---- a/sound/pci/hda/patch_realtek.c -+++ b/sound/pci/hda/patch_realtek.c -@@ -2926,6 +2926,9 @@ static void alc283_shutup(struct hda_codec *codec) - - alc_write_coef_idx(codec, 0x43, 0x9004); - -+ /*depop hp during suspend*/ -+ alc_write_coef_idx(codec, 0x06, 0x2100); -+ - snd_hda_codec_write(codec, hp_pin, 0, - AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE); - -diff --git a/sound/usb/quirks-table.h b/sound/usb/quirks-table.h -index 223c47b33ba3..c657752a420c 100644 ---- a/sound/usb/quirks-table.h -+++ b/sound/usb/quirks-table.h -@@ -385,6 +385,36 @@ YAMAHA_DEVICE(0x105d, NULL), - } - }, - { -+ USB_DEVICE(0x0499, 0x1509), -+ .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { -+ /* .vendor_name = "Yamaha", */ -+ /* .product_name = "Steinberg UR22", */ -+ .ifnum = QUIRK_ANY_INTERFACE, -+ .type = QUIRK_COMPOSITE, -+ .data = (const struct snd_usb_audio_quirk[]) { -+ { -+ .ifnum = 1, -+ .type = QUIRK_AUDIO_STANDARD_INTERFACE -+ }, -+ { -+ .ifnum = 2, -+ .type = QUIRK_AUDIO_STANDARD_INTERFACE -+ }, -+ { -+ .ifnum = 3, -+ .type = QUIRK_MIDI_YAMAHA -+ }, -+ { -+ .ifnum = 4, -+ .type = QUIRK_IGNORE_INTERFACE -+ }, -+ { -+ .ifnum = -1 -+ } -+ } -+ } -+}, -+{ - USB_DEVICE(0x0499, 0x150a), - .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { - /* .vendor_name = "Yamaha", */ -diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c -index 03a0381b1cb7..66112533b1e9 100644 ---- a/virt/kvm/kvm_main.c -+++ b/virt/kvm/kvm_main.c -@@ -52,6 +52,7 @@ - - #include <asm/processor.h> - #include <asm/io.h> -+#include <asm/ioctl.h> - #include <asm/uaccess.h> - #include <asm/pgtable.h> - -@@ -95,8 +96,6 @@ static int hardware_enable_all(void); - static void hardware_disable_all(void); - - static void kvm_io_bus_destroy(struct kvm_io_bus *bus); --static void update_memslots(struct kvm_memslots *slots, -- struct kvm_memory_slot *new, u64 last_generation); - - static void kvm_release_pfn_dirty(pfn_t pfn); - static void mark_page_dirty_in_slot(struct kvm *kvm, -@@ -682,8 +681,7 @@ static void sort_memslots(struct kvm_memslots *slots) - } - - static void update_memslots(struct kvm_memslots *slots, -- struct kvm_memory_slot *new, -- u64 last_generation) -+ struct kvm_memory_slot *new) - { - if (new) { - int id = new->id; -@@ -694,8 +692,6 @@ static void update_memslots(struct kvm_memslots *slots, - if (new->npages != npages) - sort_memslots(slots); - } -- -- slots->generation = last_generation + 1; - } - - static int check_memory_region_flags(struct kvm_userspace_memory_region *mem) -@@ -717,10 +713,24 @@ static struct kvm_memslots *install_new_memslots(struct kvm *kvm, - { - struct kvm_memslots *old_memslots = kvm->memslots; - -- update_memslots(slots, new, kvm->memslots->generation); -+ /* -+ * Set the low bit in the generation, which disables SPTE caching -+ * until the end of synchronize_srcu_expedited. -+ */ -+ WARN_ON(old_memslots->generation & 1); -+ slots->generation = old_memslots->generation + 1; -+ -+ update_memslots(slots, new); - rcu_assign_pointer(kvm->memslots, slots); - synchronize_srcu_expedited(&kvm->srcu); - -+ /* -+ * Increment the new memslot generation a second time. This prevents -+ * vm exits that race with memslot updates from caching a memslot -+ * generation that will (potentially) be valid forever. -+ */ -+ slots->generation++; -+ - kvm_arch_memslots_updated(kvm); - - return old_memslots; -@@ -1970,6 +1980,9 @@ static long kvm_vcpu_ioctl(struct file *filp, - if (vcpu->kvm->mm != current->mm) - return -EIO; - -+ if (unlikely(_IOC_TYPE(ioctl) != KVMIO)) -+ return -EINVAL; -+ - #if defined(CONFIG_S390) || defined(CONFIG_PPC) || defined(CONFIG_MIPS) - /* - * Special cases: vcpu ioctls that are asynchronous to vcpu execution, diff --git a/projects/imx6/patches/linux/linux-000-patch-3.14.23-24.patch b/projects/imx6/patches/linux/linux-000-patch-3.14.23-24.patch deleted file mode 100644 index 0e862921c36..00000000000 --- a/projects/imx6/patches/linux/linux-000-patch-3.14.23-24.patch +++ /dev/null @@ -1,7091 +0,0 @@ -diff --git a/Makefile b/Makefile -index 135a04a26076..8fd06101c482 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,6 +1,6 @@ - VERSION = 3 - PATCHLEVEL = 14 --SUBLEVEL = 23 -+SUBLEVEL = 24 - EXTRAVERSION = - NAME = Remembering Coco - -diff --git a/arch/arc/boot/dts/nsimosci.dts b/arch/arc/boot/dts/nsimosci.dts -index 4f31b2eb5cdf..398064cef746 100644 ---- a/arch/arc/boot/dts/nsimosci.dts -+++ b/arch/arc/boot/dts/nsimosci.dts -@@ -20,7 +20,7 @@ - /* this is for console on PGU */ - /* bootargs = "console=tty0 consoleblank=0"; */ - /* this is for console on serial */ -- bootargs = "earlycon=uart8250,mmio32,0xc0000000,115200n8 console=ttyS0,115200n8 consoleblank=0 debug"; -+ bootargs = "earlycon=uart8250,mmio32,0xc0000000,115200n8 console=tty0 console=ttyS0,115200n8 consoleblank=0 debug"; - }; - - aliases { -diff --git a/arch/arc/include/asm/cache.h b/arch/arc/include/asm/cache.h -index 2fd3162ec4df..c1d3d2da1191 100644 ---- a/arch/arc/include/asm/cache.h -+++ b/arch/arc/include/asm/cache.h -@@ -55,4 +55,31 @@ extern void read_decode_cache_bcr(void); - - #endif /* !__ASSEMBLY__ */ - -+/* Instruction cache related Auxiliary registers */ -+#define ARC_REG_IC_BCR 0x77 /* Build Config reg */ -+#define ARC_REG_IC_IVIC 0x10 -+#define ARC_REG_IC_CTRL 0x11 -+#define ARC_REG_IC_IVIL 0x19 -+#if defined(CONFIG_ARC_MMU_V3) || defined (CONFIG_ARC_MMU_V4) -+#define ARC_REG_IC_PTAG 0x1E -+#endif -+ -+/* Bit val in IC_CTRL */ -+#define IC_CTRL_CACHE_DISABLE 0x1 -+ -+/* Data cache related Auxiliary registers */ -+#define ARC_REG_DC_BCR 0x72 /* Build Config reg */ -+#define ARC_REG_DC_IVDC 0x47 -+#define ARC_REG_DC_CTRL 0x48 -+#define ARC_REG_DC_IVDL 0x4A -+#define ARC_REG_DC_FLSH 0x4B -+#define ARC_REG_DC_FLDL 0x4C -+#if defined(CONFIG_ARC_MMU_V3) || defined (CONFIG_ARC_MMU_V4) -+#define ARC_REG_DC_PTAG 0x5C -+#endif -+ -+/* Bit val in DC_CTRL */ -+#define DC_CTRL_INV_MODE_FLUSH 0x40 -+#define DC_CTRL_FLUSH_STATUS 0x100 -+ - #endif /* _ASM_CACHE_H */ -diff --git a/arch/arc/include/asm/kgdb.h b/arch/arc/include/asm/kgdb.h -index b65fca7ffeb5..fea931634136 100644 ---- a/arch/arc/include/asm/kgdb.h -+++ b/arch/arc/include/asm/kgdb.h -@@ -19,7 +19,7 @@ - * register API yet */ - #undef DBG_MAX_REG_NUM - --#define GDB_MAX_REGS 39 -+#define GDB_MAX_REGS 87 - - #define BREAK_INSTR_SIZE 2 - #define CACHE_FLUSH_IS_SAFE 1 -@@ -33,23 +33,27 @@ static inline void arch_kgdb_breakpoint(void) - - extern void kgdb_trap(struct pt_regs *regs); - --enum arc700_linux_regnums { -+/* This is the numbering of registers according to the GDB. See GDB's -+ * arc-tdep.h for details. -+ * -+ * Registers are ordered for GDB 7.5. It is incompatible with GDB 6.8. */ -+enum arc_linux_regnums { - _R0 = 0, - _R1, _R2, _R3, _R4, _R5, _R6, _R7, _R8, _R9, _R10, _R11, _R12, _R13, - _R14, _R15, _R16, _R17, _R18, _R19, _R20, _R21, _R22, _R23, _R24, - _R25, _R26, -- _BTA = 27, -- _LP_START = 28, -- _LP_END = 29, -- _LP_COUNT = 30, -- _STATUS32 = 31, -- _BLINK = 32, -- _FP = 33, -- __SP = 34, -- _EFA = 35, -- _RET = 36, -- _ORIG_R8 = 37, -- _STOP_PC = 38 -+ _FP = 27, -+ __SP = 28, -+ _R30 = 30, -+ _BLINK = 31, -+ _LP_COUNT = 60, -+ _STOP_PC = 64, -+ _RET = 64, -+ _LP_START = 65, -+ _LP_END = 66, -+ _STATUS32 = 67, -+ _ECR = 76, -+ _BTA = 82, - }; - - #else -diff --git a/arch/arc/kernel/head.S b/arch/arc/kernel/head.S -index 991997269d02..07a58f2d3077 100644 ---- a/arch/arc/kernel/head.S -+++ b/arch/arc/kernel/head.S -@@ -12,10 +12,42 @@ - * to skip certain things during boot on simulator - */ - -+#include <linux/linkage.h> - #include <asm/asm-offsets.h> - #include <asm/entry.h> --#include <linux/linkage.h> - #include <asm/arcregs.h> -+#include <asm/cache.h> -+ -+.macro CPU_EARLY_SETUP -+ -+ ; Setting up Vectror Table (in case exception happens in early boot -+ sr @_int_vec_base_lds, [AUX_INTR_VEC_BASE] -+ -+ ; Disable I-cache/D-cache if kernel so configured -+ lr r5, [ARC_REG_IC_BCR] -+ breq r5, 0, 1f ; I$ doesn't exist -+ lr r5, [ARC_REG_IC_CTRL] -+#ifdef CONFIG_ARC_HAS_ICACHE -+ bclr r5, r5, 0 ; 0 - Enable, 1 is Disable -+#else -+ bset r5, r5, 0 ; I$ exists, but is not used -+#endif -+ sr r5, [ARC_REG_IC_CTRL] -+ -+1: -+ lr r5, [ARC_REG_DC_BCR] -+ breq r5, 0, 1f ; D$ doesn't exist -+ lr r5, [ARC_REG_DC_CTRL] -+ bclr r5, r5, 6 ; Invalidate (discard w/o wback) -+#ifdef CONFIG_ARC_HAS_DCACHE -+ bclr r5, r5, 0 ; Enable (+Inv) -+#else -+ bset r5, r5, 0 ; Disable (+Inv) -+#endif -+ sr r5, [ARC_REG_DC_CTRL] -+ -+1: -+.endm - - .cpu A7 - -@@ -24,13 +56,13 @@ - .globl stext - stext: - ;------------------------------------------------------------------- -- ; Don't clobber r0-r4 yet. It might have bootloader provided info -+ ; Don't clobber r0-r2 yet. It might have bootloader provided info - ;------------------------------------------------------------------- - -- sr @_int_vec_base_lds, [AUX_INTR_VEC_BASE] -+ CPU_EARLY_SETUP - - #ifdef CONFIG_SMP -- ; Only Boot (Master) proceeds. Others wait in platform dependent way -+ ; Ensure Boot (Master) proceeds. Others wait in platform dependent way - ; IDENTITY Reg [ 3 2 1 0 ] - ; (cpu-id) ^^^ => Zero for UP ARC700 - ; => #Core-ID if SMP (Master 0) -@@ -39,7 +71,8 @@ stext: - ; need to make sure only boot cpu takes this path. - GET_CPU_ID r5 - cmp r5, 0 -- jnz arc_platform_smp_wait_to_boot -+ mov.ne r0, r5 -+ jne arc_platform_smp_wait_to_boot - #endif - ; Clear BSS before updating any globals - ; XXX: use ZOL here -@@ -89,7 +122,7 @@ stext: - - first_lines_of_secondary: - -- sr @_int_vec_base_lds, [AUX_INTR_VEC_BASE] -+ CPU_EARLY_SETUP - - ; setup per-cpu idle task as "current" on this CPU - ld r0, [@secondary_idle_tsk] -diff --git a/arch/arc/mm/cache_arc700.c b/arch/arc/mm/cache_arc700.c -index 400c663b21c2..1f676c4794e0 100644 ---- a/arch/arc/mm/cache_arc700.c -+++ b/arch/arc/mm/cache_arc700.c -@@ -73,37 +73,9 @@ - #include <asm/cachectl.h> - #include <asm/setup.h> - --/* Instruction cache related Auxiliary registers */ --#define ARC_REG_IC_BCR 0x77 /* Build Config reg */ --#define ARC_REG_IC_IVIC 0x10 --#define ARC_REG_IC_CTRL 0x11 --#define ARC_REG_IC_IVIL 0x19 --#if (CONFIG_ARC_MMU_VER > 2) --#define ARC_REG_IC_PTAG 0x1E --#endif -- --/* Bit val in IC_CTRL */ --#define IC_CTRL_CACHE_DISABLE 0x1 -- --/* Data cache related Auxiliary registers */ --#define ARC_REG_DC_BCR 0x72 /* Build Config reg */ --#define ARC_REG_DC_IVDC 0x47 --#define ARC_REG_DC_CTRL 0x48 --#define ARC_REG_DC_IVDL 0x4A --#define ARC_REG_DC_FLSH 0x4B --#define ARC_REG_DC_FLDL 0x4C --#if (CONFIG_ARC_MMU_VER > 2) --#define ARC_REG_DC_PTAG 0x5C --#endif -- --/* Bit val in DC_CTRL */ --#define DC_CTRL_INV_MODE_FLUSH 0x40 --#define DC_CTRL_FLUSH_STATUS 0x100 -- --char *arc_cache_mumbojumbo(int cpu_id, char *buf, int len) -+char *arc_cache_mumbojumbo(int c, char *buf, int len) - { - int n = 0; -- unsigned int c = smp_processor_id(); - - #define PR_CACHE(p, enb, str) \ - { \ -@@ -169,72 +141,43 @@ void read_decode_cache_bcr(void) - */ - void arc_cache_init(void) - { -- unsigned int cpu = smp_processor_id(); -- struct cpuinfo_arc_cache *ic = &cpuinfo_arc700[cpu].icache; -- struct cpuinfo_arc_cache *dc = &cpuinfo_arc700[cpu].dcache; -- unsigned int dcache_does_alias, temp; -+ unsigned int __maybe_unused cpu = smp_processor_id(); -+ struct cpuinfo_arc_cache __maybe_unused *ic, __maybe_unused *dc; - char str[256]; - - printk(arc_cache_mumbojumbo(0, str, sizeof(str))); - -- if (!ic->ver) -- goto chk_dc; -- --#ifdef CONFIG_ARC_HAS_ICACHE -- /* 1. Confirm some of I-cache params which Linux assumes */ -- if (ic->line_len != L1_CACHE_BYTES) -- panic("Cache H/W doesn't match kernel Config"); -- -- if (ic->ver != CONFIG_ARC_MMU_VER) -- panic("Cache ver doesn't match MMU ver\n"); --#endif -- -- /* Enable/disable I-Cache */ -- temp = read_aux_reg(ARC_REG_IC_CTRL); -- - #ifdef CONFIG_ARC_HAS_ICACHE -- temp &= ~IC_CTRL_CACHE_DISABLE; --#else -- temp |= IC_CTRL_CACHE_DISABLE; -+ ic = &cpuinfo_arc700[cpu].icache; -+ if (ic->ver) { -+ if (ic->line_len != L1_CACHE_BYTES) -+ panic("ICache line [%d] != kernel Config [%d]", -+ ic->line_len, L1_CACHE_BYTES); -+ -+ if (ic->ver != CONFIG_ARC_MMU_VER) -+ panic("Cache ver [%d] doesn't match MMU ver [%d]\n", -+ ic->ver, CONFIG_ARC_MMU_VER); -+ } - #endif - -- write_aux_reg(ARC_REG_IC_CTRL, temp); -- --chk_dc: -- if (!dc->ver) -- return; -- - #ifdef CONFIG_ARC_HAS_DCACHE -- if (dc->line_len != L1_CACHE_BYTES) -- panic("Cache H/W doesn't match kernel Config"); -+ dc = &cpuinfo_arc700[cpu].dcache; -+ if (dc->ver) { -+ unsigned int dcache_does_alias; - -- /* check for D-Cache aliasing */ -- dcache_does_alias = (dc->sz / dc->assoc) > PAGE_SIZE; -+ if (dc->line_len != L1_CACHE_BYTES) -+ panic("DCache line [%d] != kernel Config [%d]", -+ dc->line_len, L1_CACHE_BYTES); - -- if (dcache_does_alias && !cache_is_vipt_aliasing()) -- panic("Enable CONFIG_ARC_CACHE_VIPT_ALIASING\n"); -- else if (!dcache_does_alias && cache_is_vipt_aliasing()) -- panic("Don't need CONFIG_ARC_CACHE_VIPT_ALIASING\n"); --#endif -- -- /* Set the default Invalidate Mode to "simpy discard dirty lines" -- * as this is more frequent then flush before invalidate -- * Ofcourse we toggle this default behviour when desired -- */ -- temp = read_aux_reg(ARC_REG_DC_CTRL); -- temp &= ~DC_CTRL_INV_MODE_FLUSH; -+ /* check for D-Cache aliasing */ -+ dcache_does_alias = (dc->sz / dc->assoc) > PAGE_SIZE; - --#ifdef CONFIG_ARC_HAS_DCACHE -- /* Enable D-Cache: Clear Bit 0 */ -- write_aux_reg(ARC_REG_DC_CTRL, temp & ~IC_CTRL_CACHE_DISABLE); --#else -- /* Flush D cache */ -- write_aux_reg(ARC_REG_DC_FLSH, 0x1); -- /* Disable D cache */ -- write_aux_reg(ARC_REG_DC_CTRL, temp | IC_CTRL_CACHE_DISABLE); -+ if (dcache_does_alias && !cache_is_vipt_aliasing()) -+ panic("Enable CONFIG_ARC_CACHE_VIPT_ALIASING\n"); -+ else if (!dcache_does_alias && cache_is_vipt_aliasing()) -+ panic("Don't need CONFIG_ARC_CACHE_VIPT_ALIASING\n"); -+ } - #endif -- -- return; - } - - #define OP_INV 0x1 -@@ -254,12 +197,16 @@ static inline void __cache_line_loop(unsigned long paddr, unsigned long vaddr, - - if (cacheop == OP_INV_IC) { - aux_cmd = ARC_REG_IC_IVIL; -+#if (CONFIG_ARC_MMU_VER > 2) - aux_tag = ARC_REG_IC_PTAG; -+#endif - } - else { - /* d$ cmd: INV (discard or wback-n-discard) OR FLUSH (wback) */ - aux_cmd = cacheop & OP_INV ? ARC_REG_DC_IVDL : ARC_REG_DC_FLDL; -+#if (CONFIG_ARC_MMU_VER > 2) - aux_tag = ARC_REG_DC_PTAG; -+#endif - } - - /* Ensure we properly floor/ceil the non-line aligned/sized requests -diff --git a/arch/mips/include/asm/ftrace.h b/arch/mips/include/asm/ftrace.h -index 992aaba603b5..b463f2aa5a61 100644 ---- a/arch/mips/include/asm/ftrace.h -+++ b/arch/mips/include/asm/ftrace.h -@@ -24,7 +24,7 @@ do { \ - asm volatile ( \ - "1: " load " %[tmp_dst], 0(%[tmp_src])\n" \ - " li %[tmp_err], 0\n" \ -- "2:\n" \ -+ "2: .insn\n" \ - \ - ".section .fixup, \"ax\"\n" \ - "3: li %[tmp_err], 1\n" \ -@@ -46,7 +46,7 @@ do { \ - asm volatile ( \ - "1: " store " %[tmp_src], 0(%[tmp_dst])\n"\ - " li %[tmp_err], 0\n" \ -- "2:\n" \ -+ "2: .insn\n" \ - \ - ".section .fixup, \"ax\"\n" \ - "3: li %[tmp_err], 1\n" \ -diff --git a/arch/mips/mm/tlbex.c b/arch/mips/mm/tlbex.c -index 65d452aa1fda..dd012c599ad1 100644 ---- a/arch/mips/mm/tlbex.c -+++ b/arch/mips/mm/tlbex.c -@@ -1057,6 +1057,7 @@ static void build_update_entries(u32 **p, unsigned int tmp, unsigned int ptep) - struct mips_huge_tlb_info { - int huge_pte; - int restore_scratch; -+ bool need_reload_pte; - }; - - static struct mips_huge_tlb_info -@@ -1071,6 +1072,7 @@ build_fast_tlb_refill_handler (u32 **p, struct uasm_label **l, - - rv.huge_pte = scratch; - rv.restore_scratch = 0; -+ rv.need_reload_pte = false; - - if (check_for_high_segbits) { - UASM_i_MFC0(p, tmp, C0_BADVADDR); -@@ -1259,6 +1261,7 @@ static void build_r4000_tlb_refill_handler(void) - } else { - htlb_info.huge_pte = K0; - htlb_info.restore_scratch = 0; -+ htlb_info.need_reload_pte = true; - vmalloc_mode = refill_noscratch; - /* - * create the plain linear handler -@@ -1295,7 +1298,8 @@ static void build_r4000_tlb_refill_handler(void) - } - #ifdef CONFIG_MIPS_HUGE_TLB_SUPPORT - uasm_l_tlb_huge_update(&l, p); -- UASM_i_LW(&p, K0, 0, K1); -+ if (htlb_info.need_reload_pte) -+ UASM_i_LW(&p, htlb_info.huge_pte, 0, K1); - build_huge_update_entries(&p, htlb_info.huge_pte, K1); - build_huge_tlb_write_entry(&p, &l, &r, K0, tlb_random, - htlb_info.restore_scratch); -diff --git a/arch/powerpc/platforms/pseries/dlpar.c b/arch/powerpc/platforms/pseries/dlpar.c -index a8fe5aa3d34f..3b46eed1dcf6 100644 ---- a/arch/powerpc/platforms/pseries/dlpar.c -+++ b/arch/powerpc/platforms/pseries/dlpar.c -@@ -380,7 +380,7 @@ static int dlpar_online_cpu(struct device_node *dn) - BUG_ON(get_cpu_current_state(cpu) - != CPU_STATE_OFFLINE); - cpu_maps_update_done(); -- rc = cpu_up(cpu); -+ rc = device_online(get_cpu_device(cpu)); - if (rc) - goto out; - cpu_maps_update_begin(); -@@ -463,7 +463,7 @@ static int dlpar_offline_cpu(struct device_node *dn) - if (get_cpu_current_state(cpu) == CPU_STATE_ONLINE) { - set_preferred_offline_state(cpu, CPU_STATE_OFFLINE); - cpu_maps_update_done(); -- rc = cpu_down(cpu); -+ rc = device_offline(get_cpu_device(cpu)); - if (rc) - goto out; - cpu_maps_update_begin(); -diff --git a/arch/sh/kernel/cpu/sh3/setup-sh770x.c b/arch/sh/kernel/cpu/sh3/setup-sh770x.c -index ff1465c0519c..5acf89c1afc5 100644 ---- a/arch/sh/kernel/cpu/sh3/setup-sh770x.c -+++ b/arch/sh/kernel/cpu/sh3/setup-sh770x.c -@@ -118,7 +118,7 @@ static struct plat_sci_port scif0_platform_data = { - }; - - static struct resource scif0_resources[] = { -- DEFINE_RES_MEM(0xfffffe80, 0x100), -+ DEFINE_RES_MEM(0xfffffe80, 0x10), - DEFINE_RES_IRQ(evt2irq(0x4e0)), - }; - -@@ -143,7 +143,7 @@ static struct plat_sci_port scif1_platform_data = { - }; - - static struct resource scif1_resources[] = { -- DEFINE_RES_MEM(0xa4000150, 0x100), -+ DEFINE_RES_MEM(0xa4000150, 0x10), - DEFINE_RES_IRQ(evt2irq(0x900)), - }; - -@@ -169,7 +169,7 @@ static struct plat_sci_port scif2_platform_data = { - }; - - static struct resource scif2_resources[] = { -- DEFINE_RES_MEM(0xa4000140, 0x100), -+ DEFINE_RES_MEM(0xa4000140, 0x10), - DEFINE_RES_IRQ(evt2irq(0x880)), - }; - -diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c -index 3716e6952554..e8ab93c3e638 100644 ---- a/arch/um/drivers/ubd_kern.c -+++ b/arch/um/drivers/ubd_kern.c -@@ -1277,7 +1277,7 @@ static void do_ubd_request(struct request_queue *q) - - while(1){ - struct ubd *dev = q->queuedata; -- if(dev->end_sg == 0){ -+ if(dev->request == NULL){ - struct request *req = blk_fetch_request(q); - if(req == NULL) - return; -@@ -1299,7 +1299,8 @@ static void do_ubd_request(struct request_queue *q) - return; - } - prepare_flush_request(req, io_req); -- submit_request(io_req, dev); -+ if (submit_request(io_req, dev) == false) -+ return; - } - - while(dev->start_sg < dev->end_sg){ -diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig -index e4098912fef2..98aa930230ec 100644 ---- a/arch/x86/Kconfig -+++ b/arch/x86/Kconfig -@@ -2436,12 +2436,9 @@ config X86_DMA_REMAP - depends on STA2X11 - - config IOSF_MBI -- bool -+ tristate -+ default m - depends on PCI -- ---help--- -- To be selected by modules requiring access to the Intel OnChip System -- Fabric (IOSF) Sideband MailBox Interface (MBI). For MBI platforms -- enumerable by PCI. - - source "net/Kconfig" - -diff --git a/arch/x86/ia32/ia32entry.S b/arch/x86/ia32/ia32entry.S -index 4299eb05023c..92a2e9333620 100644 ---- a/arch/x86/ia32/ia32entry.S -+++ b/arch/x86/ia32/ia32entry.S -@@ -151,6 +151,16 @@ ENTRY(ia32_sysenter_target) - 1: movl (%rbp),%ebp - _ASM_EXTABLE(1b,ia32_badarg) - ASM_CLAC -+ -+ /* -+ * Sysenter doesn't filter flags, so we need to clear NT -+ * ourselves. To save a few cycles, we can check whether -+ * NT was set instead of doing an unconditional popfq. -+ */ -+ testl $X86_EFLAGS_NT,EFLAGS-ARGOFFSET(%rsp) -+ jnz sysenter_fix_flags -+sysenter_flags_fixed: -+ - orl $TS_COMPAT,TI_status+THREAD_INFO(%rsp,RIP-ARGOFFSET) - testl $_TIF_WORK_SYSCALL_ENTRY,TI_flags+THREAD_INFO(%rsp,RIP-ARGOFFSET) - CFI_REMEMBER_STATE -@@ -184,6 +194,8 @@ sysexit_from_sys_call: - TRACE_IRQS_ON - ENABLE_INTERRUPTS_SYSEXIT32 - -+ CFI_RESTORE_STATE -+ - #ifdef CONFIG_AUDITSYSCALL - .macro auditsys_entry_common - movl %esi,%r9d /* 6th arg: 4th syscall arg */ -@@ -226,7 +238,6 @@ sysexit_from_sys_call: - .endm - - sysenter_auditsys: -- CFI_RESTORE_STATE - auditsys_entry_common - movl %ebp,%r9d /* reload 6th syscall arg */ - jmp sysenter_dispatch -@@ -235,6 +246,11 @@ sysexit_audit: - auditsys_exit sysexit_from_sys_call - #endif - -+sysenter_fix_flags: -+ pushq_cfi $(X86_EFLAGS_IF|X86_EFLAGS_FIXED) -+ popfq_cfi -+ jmp sysenter_flags_fixed -+ - sysenter_tracesys: - #ifdef CONFIG_AUDITSYSCALL - testl $(_TIF_WORK_SYSCALL_ENTRY & ~_TIF_SYSCALL_AUDIT),TI_flags+THREAD_INFO(%rsp,RIP-ARGOFFSET) -diff --git a/arch/x86/include/asm/elf.h b/arch/x86/include/asm/elf.h -index 9c999c1674fa..01f15b227d7e 100644 ---- a/arch/x86/include/asm/elf.h -+++ b/arch/x86/include/asm/elf.h -@@ -155,8 +155,9 @@ do { \ - #define elf_check_arch(x) \ - ((x)->e_machine == EM_X86_64) - --#define compat_elf_check_arch(x) \ -- (elf_check_arch_ia32(x) || (x)->e_machine == EM_X86_64) -+#define compat_elf_check_arch(x) \ -+ (elf_check_arch_ia32(x) || \ -+ (IS_ENABLED(CONFIG_X86_X32_ABI) && (x)->e_machine == EM_X86_64)) - - #if __USER32_DS != __USER_DS - # error "The following code assumes __USER32_DS == __USER_DS" -diff --git a/arch/x86/include/asm/iosf_mbi.h b/arch/x86/include/asm/iosf_mbi.h -index 8e71c7941767..57995f0596a6 100644 ---- a/arch/x86/include/asm/iosf_mbi.h -+++ b/arch/x86/include/asm/iosf_mbi.h -@@ -50,6 +50,32 @@ - #define BT_MBI_PCIE_READ 0x00 - #define BT_MBI_PCIE_WRITE 0x01 - -+/* Quark available units */ -+#define QRK_MBI_UNIT_HBA 0x00 -+#define QRK_MBI_UNIT_HB 0x03 -+#define QRK_MBI_UNIT_RMU 0x04 -+#define QRK_MBI_UNIT_MM 0x05 -+#define QRK_MBI_UNIT_MMESRAM 0x05 -+#define QRK_MBI_UNIT_SOC 0x31 -+ -+/* Quark read/write opcodes */ -+#define QRK_MBI_HBA_READ 0x10 -+#define QRK_MBI_HBA_WRITE 0x11 -+#define QRK_MBI_HB_READ 0x10 -+#define QRK_MBI_HB_WRITE 0x11 -+#define QRK_MBI_RMU_READ 0x10 -+#define QRK_MBI_RMU_WRITE 0x11 -+#define QRK_MBI_MM_READ 0x10 -+#define QRK_MBI_MM_WRITE 0x11 -+#define QRK_MBI_MMESRAM_READ 0x12 -+#define QRK_MBI_MMESRAM_WRITE 0x13 -+#define QRK_MBI_SOC_READ 0x06 -+#define QRK_MBI_SOC_WRITE 0x07 -+ -+#if IS_ENABLED(CONFIG_IOSF_MBI) -+ -+bool iosf_mbi_available(void); -+ - /** - * iosf_mbi_read() - MailBox Interface read command - * @port: port indicating subunit being accessed -@@ -87,4 +113,33 @@ int iosf_mbi_write(u8 port, u8 opcode, u32 offset, u32 mdr); - */ - int iosf_mbi_modify(u8 port, u8 opcode, u32 offset, u32 mdr, u32 mask); - -+#else /* CONFIG_IOSF_MBI is not enabled */ -+static inline -+bool iosf_mbi_available(void) -+{ -+ return false; -+} -+ -+static inline -+int iosf_mbi_read(u8 port, u8 opcode, u32 offset, u32 *mdr) -+{ -+ WARN(1, "IOSF_MBI driver not available"); -+ return -EPERM; -+} -+ -+static inline -+int iosf_mbi_write(u8 port, u8 opcode, u32 offset, u32 mdr) -+{ -+ WARN(1, "IOSF_MBI driver not available"); -+ return -EPERM; -+} -+ -+static inline -+int iosf_mbi_modify(u8 port, u8 opcode, u32 offset, u32 mdr, u32 mask) -+{ -+ WARN(1, "IOSF_MBI driver not available"); -+ return -EPERM; -+} -+#endif /* CONFIG_IOSF_MBI */ -+ - #endif /* IOSF_MBI_SYMS_H */ -diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h -index ac63ea4af5b0..e9dc02968cf8 100644 ---- a/arch/x86/include/asm/kvm_host.h -+++ b/arch/x86/include/asm/kvm_host.h -@@ -984,6 +984,20 @@ static inline void kvm_inject_gp(struct kvm_vcpu *vcpu, u32 error_code) - kvm_queue_exception_e(vcpu, GP_VECTOR, error_code); - } - -+static inline u64 get_canonical(u64 la) -+{ -+ return ((int64_t)la << 16) >> 16; -+} -+ -+static inline bool is_noncanonical_address(u64 la) -+{ -+#ifdef CONFIG_X86_64 -+ return get_canonical(la) != la; -+#else -+ return false; -+#endif -+} -+ - #define TSS_IOPB_BASE_OFFSET 0x66 - #define TSS_BASE_SIZE 0x68 - #define TSS_IOPB_SIZE (65536 / 8) -@@ -1042,7 +1056,7 @@ int kvm_cpu_get_interrupt(struct kvm_vcpu *v); - void kvm_vcpu_reset(struct kvm_vcpu *vcpu); - - void kvm_define_shared_msr(unsigned index, u32 msr); --void kvm_set_shared_msr(unsigned index, u64 val, u64 mask); -+int kvm_set_shared_msr(unsigned index, u64 val, u64 mask); - - bool kvm_is_linear_rip(struct kvm_vcpu *vcpu, unsigned long linear_rip); - -diff --git a/arch/x86/include/uapi/asm/vmx.h b/arch/x86/include/uapi/asm/vmx.h -index 0e79420376eb..990a2fe1588d 100644 ---- a/arch/x86/include/uapi/asm/vmx.h -+++ b/arch/x86/include/uapi/asm/vmx.h -@@ -67,6 +67,7 @@ - #define EXIT_REASON_EPT_MISCONFIG 49 - #define EXIT_REASON_INVEPT 50 - #define EXIT_REASON_PREEMPTION_TIMER 52 -+#define EXIT_REASON_INVVPID 53 - #define EXIT_REASON_WBINVD 54 - #define EXIT_REASON_XSETBV 55 - #define EXIT_REASON_APIC_WRITE 56 -@@ -114,6 +115,7 @@ - { EXIT_REASON_EOI_INDUCED, "EOI_INDUCED" }, \ - { EXIT_REASON_INVALID_STATE, "INVALID_STATE" }, \ - { EXIT_REASON_INVD, "INVD" }, \ -+ { EXIT_REASON_INVVPID, "INVVPID" }, \ - { EXIT_REASON_INVPCID, "INVPCID" } - - #endif /* _UAPIVMX_H */ -diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c -index 7f26c9a70a9e..523f147b2470 100644 ---- a/arch/x86/kernel/apic/apic.c -+++ b/arch/x86/kernel/apic/apic.c -@@ -1290,7 +1290,7 @@ void setup_local_APIC(void) - unsigned int value, queued; - int i, j, acked = 0; - unsigned long long tsc = 0, ntsc; -- long long max_loops = cpu_khz; -+ long long max_loops = cpu_khz ? cpu_khz : 1000000; - - if (cpu_has_tsc) - rdtscll(tsc); -@@ -1387,7 +1387,7 @@ void setup_local_APIC(void) - break; - } - if (queued) { -- if (cpu_has_tsc) { -+ if (cpu_has_tsc && cpu_khz) { - rdtscll(ntsc); - max_loops = (cpu_khz << 10) - (ntsc - tsc); - } else -diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c -index 8e28bf2fc3ef..3f27f5fd0847 100644 ---- a/arch/x86/kernel/cpu/common.c -+++ b/arch/x86/kernel/cpu/common.c -@@ -1141,7 +1141,7 @@ void syscall_init(void) - /* Flags to clear on syscall */ - wrmsrl(MSR_SYSCALL_MASK, - X86_EFLAGS_TF|X86_EFLAGS_DF|X86_EFLAGS_IF| -- X86_EFLAGS_IOPL|X86_EFLAGS_AC); -+ X86_EFLAGS_IOPL|X86_EFLAGS_AC|X86_EFLAGS_NT); - } - - /* -diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c -index c1a07d33e67e..66746a880dec 100644 ---- a/arch/x86/kernel/cpu/intel.c -+++ b/arch/x86/kernel/cpu/intel.c -@@ -383,6 +383,13 @@ static void init_intel(struct cpuinfo_x86 *c) - detect_extended_topology(c); - - l2 = init_intel_cacheinfo(c); -+ -+ /* Detect legacy cache sizes if init_intel_cacheinfo did not */ -+ if (l2 == 0) { -+ cpu_detect_cache_sizes(c); -+ l2 = c->x86_cache_size; -+ } -+ - if (c->cpuid_level > 9) { - unsigned eax = cpuid_eax(10); - /* Check for version and the number of counters */ -@@ -497,6 +504,13 @@ static unsigned int intel_size_cache(struct cpuinfo_x86 *c, unsigned int size) - */ - if ((c->x86 == 6) && (c->x86_model == 11) && (size == 0)) - size = 256; -+ -+ /* -+ * Intel Quark SoC X1000 contains a 4-way set associative -+ * 16K cache with a 16 byte cache line and 256 lines per tag -+ */ -+ if ((c->x86 == 5) && (c->x86_model == 9)) -+ size = 16; - return size; - } - #endif -@@ -724,7 +738,8 @@ static const struct cpu_dev intel_cpu_dev = { - [3] = "OverDrive PODP5V83", - [4] = "Pentium MMX", - [7] = "Mobile Pentium 75 - 200", -- [8] = "Mobile Pentium MMX" -+ [8] = "Mobile Pentium MMX", -+ [9] = "Quark SoC X1000", - } - }, - { .family = 6, .model_names = -diff --git a/arch/x86/kernel/iosf_mbi.c b/arch/x86/kernel/iosf_mbi.c -index c3aae6672843..2e97b3cfa6c7 100644 ---- a/arch/x86/kernel/iosf_mbi.c -+++ b/arch/x86/kernel/iosf_mbi.c -@@ -25,6 +25,10 @@ - - #include <asm/iosf_mbi.h> - -+#define PCI_DEVICE_ID_BAYTRAIL 0x0F00 -+#define PCI_DEVICE_ID_BRASWELL 0x2280 -+#define PCI_DEVICE_ID_QUARK_X1000 0x0958 -+ - static DEFINE_SPINLOCK(iosf_mbi_lock); - - static inline u32 iosf_mbi_form_mcr(u8 op, u8 port, u8 offset) -@@ -177,6 +181,13 @@ int iosf_mbi_modify(u8 port, u8 opcode, u32 offset, u32 mdr, u32 mask) - } - EXPORT_SYMBOL(iosf_mbi_modify); - -+bool iosf_mbi_available(void) -+{ -+ /* Mbi isn't hot-pluggable. No remove routine is provided */ -+ return mbi_pdev; -+} -+EXPORT_SYMBOL(iosf_mbi_available); -+ - static int iosf_mbi_probe(struct pci_dev *pdev, - const struct pci_device_id *unused) - { -@@ -193,7 +204,9 @@ static int iosf_mbi_probe(struct pci_dev *pdev, - } - - static DEFINE_PCI_DEVICE_TABLE(iosf_mbi_pci_ids) = { -- { PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x0F00) }, -+ { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_BAYTRAIL) }, -+ { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_BRASWELL) }, -+ { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_QUARK_X1000) }, - { 0, }, - }; - MODULE_DEVICE_TABLE(pci, iosf_mbi_pci_ids); -diff --git a/arch/x86/kernel/signal.c b/arch/x86/kernel/signal.c -index 9e5de6813e1f..b88fc86309bc 100644 ---- a/arch/x86/kernel/signal.c -+++ b/arch/x86/kernel/signal.c -@@ -673,6 +673,11 @@ handle_signal(struct ksignal *ksig, struct pt_regs *regs) - * handler too. - */ - regs->flags &= ~(X86_EFLAGS_DF|X86_EFLAGS_RF|X86_EFLAGS_TF); -+ /* -+ * Ensure the signal handler starts with the new fpu state. -+ */ -+ if (used_math()) -+ drop_init_fpu(current); - } - signal_setup_done(failed, ksig, test_thread_flag(TIF_SINGLESTEP)); - } -diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c -index e0d1d7a8354e..de0290605903 100644 ---- a/arch/x86/kernel/tsc.c -+++ b/arch/x86/kernel/tsc.c -@@ -1173,14 +1173,17 @@ void __init tsc_init(void) - - x86_init.timers.tsc_pre_init(); - -- if (!cpu_has_tsc) -+ if (!cpu_has_tsc) { -+ setup_clear_cpu_cap(X86_FEATURE_TSC_DEADLINE_TIMER); - return; -+ } - - tsc_khz = x86_platform.calibrate_tsc(); - cpu_khz = tsc_khz; - - if (!tsc_khz) { - mark_tsc_unstable("could not calculate TSC khz"); -+ setup_clear_cpu_cap(X86_FEATURE_TSC_DEADLINE_TIMER); - return; - } - -diff --git a/arch/x86/kernel/xsave.c b/arch/x86/kernel/xsave.c -index a4b451c6addf..dd50e26c58f6 100644 ---- a/arch/x86/kernel/xsave.c -+++ b/arch/x86/kernel/xsave.c -@@ -268,8 +268,6 @@ int save_xstate_sig(void __user *buf, void __user *buf_fx, int size) - if (use_fxsr() && save_xstate_epilog(buf_fx, ia32_fxstate)) - return -1; - -- drop_init_fpu(tsk); /* trigger finit */ -- - return 0; - } - -@@ -399,8 +397,11 @@ int __restore_xstate_sig(void __user *buf, void __user *buf_fx, int size) - set_used_math(); - } - -- if (use_eager_fpu()) -+ if (use_eager_fpu()) { -+ preempt_disable(); - math_state_restore(); -+ preempt_enable(); -+ } - - return err; - } else { -diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c -index 7bff3e2a7a11..38d3751472e4 100644 ---- a/arch/x86/kvm/emulate.c -+++ b/arch/x86/kvm/emulate.c -@@ -498,11 +498,6 @@ static void rsp_increment(struct x86_emulate_ctxt *ctxt, int inc) - masked_increment(reg_rmw(ctxt, VCPU_REGS_RSP), stack_mask(ctxt), inc); - } - --static inline void jmp_rel(struct x86_emulate_ctxt *ctxt, int rel) --{ -- register_address_increment(ctxt, &ctxt->_eip, rel); --} -- - static u32 desc_limit_scaled(struct desc_struct *desc) - { - u32 limit = get_desc_limit(desc); -@@ -576,6 +571,38 @@ static int emulate_nm(struct x86_emulate_ctxt *ctxt) - return emulate_exception(ctxt, NM_VECTOR, 0, false); - } - -+static inline int assign_eip_far(struct x86_emulate_ctxt *ctxt, ulong dst, -+ int cs_l) -+{ -+ switch (ctxt->op_bytes) { -+ case 2: -+ ctxt->_eip = (u16)dst; -+ break; -+ case 4: -+ ctxt->_eip = (u32)dst; -+ break; -+ case 8: -+ if ((cs_l && is_noncanonical_address(dst)) || -+ (!cs_l && (dst & ~(u32)-1))) -+ return emulate_gp(ctxt, 0); -+ ctxt->_eip = dst; -+ break; -+ default: -+ WARN(1, "unsupported eip assignment size\n"); -+ } -+ return X86EMUL_CONTINUE; -+} -+ -+static inline int assign_eip_near(struct x86_emulate_ctxt *ctxt, ulong dst) -+{ -+ return assign_eip_far(ctxt, dst, ctxt->mode == X86EMUL_MODE_PROT64); -+} -+ -+static inline int jmp_rel(struct x86_emulate_ctxt *ctxt, int rel) -+{ -+ return assign_eip_near(ctxt, ctxt->_eip + rel); -+} -+ - static u16 get_segment_selector(struct x86_emulate_ctxt *ctxt, unsigned seg) - { - u16 selector; -@@ -1958,13 +1985,15 @@ static int em_grp45(struct x86_emulate_ctxt *ctxt) - case 2: /* call near abs */ { - long int old_eip; - old_eip = ctxt->_eip; -- ctxt->_eip = ctxt->src.val; -+ rc = assign_eip_near(ctxt, ctxt->src.val); -+ if (rc != X86EMUL_CONTINUE) -+ break; - ctxt->src.val = old_eip; - rc = em_push(ctxt); - break; - } - case 4: /* jmp abs */ -- ctxt->_eip = ctxt->src.val; -+ rc = assign_eip_near(ctxt, ctxt->src.val); - break; - case 5: /* jmp far */ - rc = em_jmp_far(ctxt); -@@ -1996,10 +2025,14 @@ static int em_cmpxchg8b(struct x86_emulate_ctxt *ctxt) - - static int em_ret(struct x86_emulate_ctxt *ctxt) - { -- ctxt->dst.type = OP_REG; -- ctxt->dst.addr.reg = &ctxt->_eip; -- ctxt->dst.bytes = ctxt->op_bytes; -- return em_pop(ctxt); -+ int rc; -+ unsigned long eip; -+ -+ rc = emulate_pop(ctxt, &eip, ctxt->op_bytes); -+ if (rc != X86EMUL_CONTINUE) -+ return rc; -+ -+ return assign_eip_near(ctxt, eip); - } - - static int em_ret_far(struct x86_emulate_ctxt *ctxt) -@@ -2277,7 +2310,7 @@ static int em_sysexit(struct x86_emulate_ctxt *ctxt) - { - const struct x86_emulate_ops *ops = ctxt->ops; - struct desc_struct cs, ss; -- u64 msr_data; -+ u64 msr_data, rcx, rdx; - int usermode; - u16 cs_sel = 0, ss_sel = 0; - -@@ -2293,6 +2326,9 @@ static int em_sysexit(struct x86_emulate_ctxt *ctxt) - else - usermode = X86EMUL_MODE_PROT32; - -+ rcx = reg_read(ctxt, VCPU_REGS_RCX); -+ rdx = reg_read(ctxt, VCPU_REGS_RDX); -+ - cs.dpl = 3; - ss.dpl = 3; - ops->get_msr(ctxt, MSR_IA32_SYSENTER_CS, &msr_data); -@@ -2310,6 +2346,9 @@ static int em_sysexit(struct x86_emulate_ctxt *ctxt) - ss_sel = cs_sel + 8; - cs.d = 0; - cs.l = 1; -+ if (is_noncanonical_address(rcx) || -+ is_noncanonical_address(rdx)) -+ return emulate_gp(ctxt, 0); - break; - } - cs_sel |= SELECTOR_RPL_MASK; -@@ -2318,8 +2357,8 @@ static int em_sysexit(struct x86_emulate_ctxt *ctxt) - ops->set_segment(ctxt, cs_sel, &cs, 0, VCPU_SREG_CS); - ops->set_segment(ctxt, ss_sel, &ss, 0, VCPU_SREG_SS); - -- ctxt->_eip = reg_read(ctxt, VCPU_REGS_RDX); -- *reg_write(ctxt, VCPU_REGS_RSP) = reg_read(ctxt, VCPU_REGS_RCX); -+ ctxt->_eip = rdx; -+ *reg_write(ctxt, VCPU_REGS_RSP) = rcx; - - return X86EMUL_CONTINUE; - } -@@ -2858,10 +2897,13 @@ static int em_aad(struct x86_emulate_ctxt *ctxt) - - static int em_call(struct x86_emulate_ctxt *ctxt) - { -+ int rc; - long rel = ctxt->src.val; - - ctxt->src.val = (unsigned long)ctxt->_eip; -- jmp_rel(ctxt, rel); -+ rc = jmp_rel(ctxt, rel); -+ if (rc != X86EMUL_CONTINUE) -+ return rc; - return em_push(ctxt); - } - -@@ -2893,11 +2935,12 @@ static int em_call_far(struct x86_emulate_ctxt *ctxt) - static int em_ret_near_imm(struct x86_emulate_ctxt *ctxt) - { - int rc; -+ unsigned long eip; - -- ctxt->dst.type = OP_REG; -- ctxt->dst.addr.reg = &ctxt->_eip; -- ctxt->dst.bytes = ctxt->op_bytes; -- rc = emulate_pop(ctxt, &ctxt->dst.val, ctxt->op_bytes); -+ rc = emulate_pop(ctxt, &eip, ctxt->op_bytes); -+ if (rc != X86EMUL_CONTINUE) -+ return rc; -+ rc = assign_eip_near(ctxt, eip); - if (rc != X86EMUL_CONTINUE) - return rc; - rsp_increment(ctxt, ctxt->src.val); -@@ -3227,20 +3270,24 @@ static int em_lmsw(struct x86_emulate_ctxt *ctxt) - - static int em_loop(struct x86_emulate_ctxt *ctxt) - { -+ int rc = X86EMUL_CONTINUE; -+ - register_address_increment(ctxt, reg_rmw(ctxt, VCPU_REGS_RCX), -1); - if ((address_mask(ctxt, reg_read(ctxt, VCPU_REGS_RCX)) != 0) && - (ctxt->b == 0xe2 || test_cc(ctxt->b ^ 0x5, ctxt->eflags))) -- jmp_rel(ctxt, ctxt->src.val); -+ rc = jmp_rel(ctxt, ctxt->src.val); - -- return X86EMUL_CONTINUE; -+ return rc; - } - - static int em_jcxz(struct x86_emulate_ctxt *ctxt) - { -+ int rc = X86EMUL_CONTINUE; -+ - if (address_mask(ctxt, reg_read(ctxt, VCPU_REGS_RCX)) == 0) -- jmp_rel(ctxt, ctxt->src.val); -+ rc = jmp_rel(ctxt, ctxt->src.val); - -- return X86EMUL_CONTINUE; -+ return rc; - } - - static int em_in(struct x86_emulate_ctxt *ctxt) -@@ -4637,7 +4684,7 @@ special_insn: - break; - case 0x70 ... 0x7f: /* jcc (short) */ - if (test_cc(ctxt->b, ctxt->eflags)) -- jmp_rel(ctxt, ctxt->src.val); -+ rc = jmp_rel(ctxt, ctxt->src.val); - break; - case 0x8d: /* lea r16/r32, m */ - ctxt->dst.val = ctxt->src.addr.mem.ea; -@@ -4666,7 +4713,7 @@ special_insn: - break; - case 0xe9: /* jmp rel */ - case 0xeb: /* jmp rel short */ -- jmp_rel(ctxt, ctxt->src.val); -+ rc = jmp_rel(ctxt, ctxt->src.val); - ctxt->dst.type = OP_NONE; /* Disable writeback. */ - break; - case 0xf4: /* hlt */ -@@ -4786,7 +4833,7 @@ twobyte_insn: - break; - case 0x80 ... 0x8f: /* jnz rel, etc*/ - if (test_cc(ctxt->b, ctxt->eflags)) -- jmp_rel(ctxt, ctxt->src.val); -+ rc = jmp_rel(ctxt, ctxt->src.val); - break; - case 0x90 ... 0x9f: /* setcc r/m8 */ - ctxt->dst.val = test_cc(ctxt->b, ctxt->eflags); -diff --git a/arch/x86/kvm/i8254.c b/arch/x86/kvm/i8254.c -index 518d86471b76..298781d4cfb4 100644 ---- a/arch/x86/kvm/i8254.c -+++ b/arch/x86/kvm/i8254.c -@@ -262,8 +262,10 @@ void __kvm_migrate_pit_timer(struct kvm_vcpu *vcpu) - return; - - timer = &pit->pit_state.timer; -+ mutex_lock(&pit->pit_state.lock); - if (hrtimer_cancel(timer)) - hrtimer_start_expires(timer, HRTIMER_MODE_ABS); -+ mutex_unlock(&pit->pit_state.lock); - } - - static void destroy_pit_timer(struct kvm_pit *pit) -diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c -index 2de1bc09a8d4..9643eda60a52 100644 ---- a/arch/x86/kvm/svm.c -+++ b/arch/x86/kvm/svm.c -@@ -3213,7 +3213,7 @@ static int wrmsr_interception(struct vcpu_svm *svm) - msr.host_initiated = false; - - svm->next_rip = kvm_rip_read(&svm->vcpu) + 2; -- if (svm_set_msr(&svm->vcpu, &msr)) { -+ if (kvm_set_msr(&svm->vcpu, &msr)) { - trace_kvm_msr_write_ex(ecx, data); - kvm_inject_gp(&svm->vcpu, 0); - } else { -@@ -3495,9 +3495,9 @@ static int handle_exit(struct kvm_vcpu *vcpu) - - if (exit_code >= ARRAY_SIZE(svm_exit_handlers) - || !svm_exit_handlers[exit_code]) { -- kvm_run->exit_reason = KVM_EXIT_UNKNOWN; -- kvm_run->hw.hardware_exit_reason = exit_code; -- return 0; -+ WARN_ONCE(1, "vmx: unexpected exit reason 0x%x\n", exit_code); -+ kvm_queue_exception(vcpu, UD_VECTOR); -+ return 1; - } - - return svm_exit_handlers[exit_code](svm); -diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c -index 392752834751..0c90f4b3f835 100644 ---- a/arch/x86/kvm/vmx.c -+++ b/arch/x86/kvm/vmx.c -@@ -2582,12 +2582,15 @@ static int vmx_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info) - default: - msr = find_msr_entry(vmx, msr_index); - if (msr) { -+ u64 old_msr_data = msr->data; - msr->data = data; - if (msr - vmx->guest_msrs < vmx->save_nmsrs) { - preempt_disable(); -- kvm_set_shared_msr(msr->index, msr->data, -- msr->mask); -+ ret = kvm_set_shared_msr(msr->index, msr->data, -+ msr->mask); - preempt_enable(); -+ if (ret) -+ msr->data = old_msr_data; - } - break; - } -@@ -5169,7 +5172,7 @@ static int handle_wrmsr(struct kvm_vcpu *vcpu) - msr.data = data; - msr.index = ecx; - msr.host_initiated = false; -- if (vmx_set_msr(vcpu, &msr) != 0) { -+ if (kvm_set_msr(vcpu, &msr) != 0) { - trace_kvm_msr_write_ex(ecx, data); - kvm_inject_gp(vcpu, 0); - return 1; -@@ -6441,6 +6444,12 @@ static int handle_invept(struct kvm_vcpu *vcpu) - return 1; - } - -+static int handle_invvpid(struct kvm_vcpu *vcpu) -+{ -+ kvm_queue_exception(vcpu, UD_VECTOR); -+ return 1; -+} -+ - /* - * The exit handlers return 1 if the exit was handled fully and guest execution - * may resume. Otherwise they set the kvm_run parameter to indicate what needs -@@ -6486,6 +6495,7 @@ static int (*const kvm_vmx_exit_handlers[])(struct kvm_vcpu *vcpu) = { - [EXIT_REASON_MWAIT_INSTRUCTION] = handle_invalid_op, - [EXIT_REASON_MONITOR_INSTRUCTION] = handle_invalid_op, - [EXIT_REASON_INVEPT] = handle_invept, -+ [EXIT_REASON_INVVPID] = handle_invvpid, - }; - - static const int kvm_vmx_max_exit_handlers = -@@ -6719,7 +6729,7 @@ static bool nested_vmx_exit_handled(struct kvm_vcpu *vcpu) - case EXIT_REASON_VMPTRST: case EXIT_REASON_VMREAD: - case EXIT_REASON_VMRESUME: case EXIT_REASON_VMWRITE: - case EXIT_REASON_VMOFF: case EXIT_REASON_VMON: -- case EXIT_REASON_INVEPT: -+ case EXIT_REASON_INVEPT: case EXIT_REASON_INVVPID: - /* - * VMX instructions trap unconditionally. This allows L1 to - * emulate them for its L2 guest, i.e., allows 3-level nesting! -@@ -6884,10 +6894,10 @@ static int vmx_handle_exit(struct kvm_vcpu *vcpu) - && kvm_vmx_exit_handlers[exit_reason]) - return kvm_vmx_exit_handlers[exit_reason](vcpu); - else { -- vcpu->run->exit_reason = KVM_EXIT_UNKNOWN; -- vcpu->run->hw.hardware_exit_reason = exit_reason; -+ WARN_ONCE(1, "vmx: unexpected exit reason 0x%x\n", exit_reason); -+ kvm_queue_exception(vcpu, UD_VECTOR); -+ return 1; - } -- return 0; - } - - static void update_cr8_intercept(struct kvm_vcpu *vcpu, int tpr, int irr) -diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c -index 8fbd1a772272..51c2851ca243 100644 ---- a/arch/x86/kvm/x86.c -+++ b/arch/x86/kvm/x86.c -@@ -225,20 +225,25 @@ static void kvm_shared_msr_cpu_online(void) - shared_msr_update(i, shared_msrs_global.msrs[i]); - } - --void kvm_set_shared_msr(unsigned slot, u64 value, u64 mask) -+int kvm_set_shared_msr(unsigned slot, u64 value, u64 mask) - { - unsigned int cpu = smp_processor_id(); - struct kvm_shared_msrs *smsr = per_cpu_ptr(shared_msrs, cpu); -+ int err; - - if (((value ^ smsr->values[slot].curr) & mask) == 0) -- return; -+ return 0; - smsr->values[slot].curr = value; -- wrmsrl(shared_msrs_global.msrs[slot], value); -+ err = wrmsrl_safe(shared_msrs_global.msrs[slot], value); -+ if (err) -+ return 1; -+ - if (!smsr->registered) { - smsr->urn.on_user_return = kvm_on_user_return; - user_return_notifier_register(&smsr->urn); - smsr->registered = true; - } -+ return 0; - } - EXPORT_SYMBOL_GPL(kvm_set_shared_msr); - -@@ -946,7 +951,6 @@ void kvm_enable_efer_bits(u64 mask) - } - EXPORT_SYMBOL_GPL(kvm_enable_efer_bits); - -- - /* - * Writes msr value into into the appropriate "register". - * Returns 0 on success, non-0 otherwise. -@@ -954,8 +958,34 @@ EXPORT_SYMBOL_GPL(kvm_enable_efer_bits); - */ - int kvm_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr) - { -+ switch (msr->index) { -+ case MSR_FS_BASE: -+ case MSR_GS_BASE: -+ case MSR_KERNEL_GS_BASE: -+ case MSR_CSTAR: -+ case MSR_LSTAR: -+ if (is_noncanonical_address(msr->data)) -+ return 1; -+ break; -+ case MSR_IA32_SYSENTER_EIP: -+ case MSR_IA32_SYSENTER_ESP: -+ /* -+ * IA32_SYSENTER_ESP and IA32_SYSENTER_EIP cause #GP if -+ * non-canonical address is written on Intel but not on -+ * AMD (which ignores the top 32-bits, because it does -+ * not implement 64-bit SYSENTER). -+ * -+ * 64-bit code should hence be able to write a non-canonical -+ * value on AMD. Making the address canonical ensures that -+ * vmentry does not fail on Intel after writing a non-canonical -+ * value, and that something deterministic happens if the guest -+ * invokes 64-bit SYSENTER. -+ */ -+ msr->data = get_canonical(msr->data); -+ } - return kvm_x86_ops->set_msr(vcpu, msr); - } -+EXPORT_SYMBOL_GPL(kvm_set_msr); - - /* - * Adapt set_msr() to msr_io()'s calling convention -diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c -index a3488689e301..fed892de9baf 100644 ---- a/arch/x86/mm/pageattr.c -+++ b/arch/x86/mm/pageattr.c -@@ -405,7 +405,7 @@ phys_addr_t slow_virt_to_phys(void *__virt_addr) - psize = page_level_size(level); - pmask = page_level_mask(level); - offset = virt_addr & ~pmask; -- phys_addr = pte_pfn(*pte) << PAGE_SHIFT; -+ phys_addr = (phys_addr_t)pte_pfn(*pte) << PAGE_SHIFT; - return (phys_addr | offset); - } - EXPORT_SYMBOL_GPL(slow_virt_to_phys); -diff --git a/block/blk-settings.c b/block/blk-settings.c -index 5d21239bc859..95138e9d0ad5 100644 ---- a/block/blk-settings.c -+++ b/block/blk-settings.c -@@ -553,7 +553,7 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b, - bottom = max(b->physical_block_size, b->io_min) + alignment; - - /* Verify that top and bottom intervals line up */ -- if (max(top, bottom) & (min(top, bottom) - 1)) { -+ if (max(top, bottom) % min(top, bottom)) { - t->misaligned = 1; - ret = -1; - } -@@ -598,7 +598,7 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b, - - /* Find lowest common alignment_offset */ - t->alignment_offset = lcm(t->alignment_offset, alignment) -- & (max(t->physical_block_size, t->io_min) - 1); -+ % max(t->physical_block_size, t->io_min); - - /* Verify that new alignment_offset is on a logical block boundary */ - if (t->alignment_offset & (t->logical_block_size - 1)) { -diff --git a/block/scsi_ioctl.c b/block/scsi_ioctl.c -index 26487972ac54..4044cf789c7a 100644 ---- a/block/scsi_ioctl.c -+++ b/block/scsi_ioctl.c -@@ -489,7 +489,7 @@ int sg_scsi_ioctl(struct request_queue *q, struct gendisk *disk, fmode_t mode, - - if (bytes && blk_rq_map_kern(q, rq, buffer, bytes, __GFP_WAIT)) { - err = DRIVER_ERROR << 24; -- goto out; -+ goto error; - } - - memset(sense, 0, sizeof(sense)); -@@ -499,7 +499,6 @@ int sg_scsi_ioctl(struct request_queue *q, struct gendisk *disk, fmode_t mode, - - blk_execute_rq(q, disk, rq, 0); - --out: - err = rq->errors & 0xff; /* only 8 bit SCSI status */ - if (err) { - if (rq->sense_len && rq->sense) { -diff --git a/crypto/algif_skcipher.c b/crypto/algif_skcipher.c -index a19c027b29bd..83187f497c7c 100644 ---- a/crypto/algif_skcipher.c -+++ b/crypto/algif_skcipher.c -@@ -49,7 +49,7 @@ struct skcipher_ctx { - struct ablkcipher_request req; - }; - --#define MAX_SGL_ENTS ((PAGE_SIZE - sizeof(struct skcipher_sg_list)) / \ -+#define MAX_SGL_ENTS ((4096 - sizeof(struct skcipher_sg_list)) / \ - sizeof(struct scatterlist) - 1) - - static inline int skcipher_sndbuf(struct sock *sk) -diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c -index b603720b877d..37acda6fa7e4 100644 ---- a/drivers/ata/libata-sff.c -+++ b/drivers/ata/libata-sff.c -@@ -2008,13 +2008,15 @@ static int ata_bus_softreset(struct ata_port *ap, unsigned int devmask, - - DPRINTK("ata%u: bus reset via SRST\n", ap->print_id); - -- /* software reset. causes dev0 to be selected */ -- iowrite8(ap->ctl, ioaddr->ctl_addr); -- udelay(20); /* FIXME: flush */ -- iowrite8(ap->ctl | ATA_SRST, ioaddr->ctl_addr); -- udelay(20); /* FIXME: flush */ -- iowrite8(ap->ctl, ioaddr->ctl_addr); -- ap->last_ctl = ap->ctl; -+ if (ap->ioaddr.ctl_addr) { -+ /* software reset. causes dev0 to be selected */ -+ iowrite8(ap->ctl, ioaddr->ctl_addr); -+ udelay(20); /* FIXME: flush */ -+ iowrite8(ap->ctl | ATA_SRST, ioaddr->ctl_addr); -+ udelay(20); /* FIXME: flush */ -+ iowrite8(ap->ctl, ioaddr->ctl_addr); -+ ap->last_ctl = ap->ctl; -+ } - - /* wait the port to become ready */ - return ata_sff_wait_after_reset(&ap->link, devmask, deadline); -@@ -2215,10 +2217,6 @@ void ata_sff_error_handler(struct ata_port *ap) - - spin_unlock_irqrestore(ap->lock, flags); - -- /* ignore ata_sff_softreset if ctl isn't accessible */ -- if (softreset == ata_sff_softreset && !ap->ioaddr.ctl_addr) -- softreset = NULL; -- - /* ignore built-in hardresets if SCR access is not available */ - if ((hardreset == sata_std_hardreset || - hardreset == sata_sff_hardreset) && !sata_scr_valid(&ap->link)) -diff --git a/drivers/ata/pata_serverworks.c b/drivers/ata/pata_serverworks.c -index 96c6a79ef606..79dedbae282c 100644 ---- a/drivers/ata/pata_serverworks.c -+++ b/drivers/ata/pata_serverworks.c -@@ -252,12 +252,18 @@ static void serverworks_set_dmamode(struct ata_port *ap, struct ata_device *adev - pci_write_config_byte(pdev, 0x54, ultra_cfg); - } - --static struct scsi_host_template serverworks_sht = { -+static struct scsi_host_template serverworks_osb4_sht = { -+ ATA_BMDMA_SHT(DRV_NAME), -+ .sg_tablesize = LIBATA_DUMB_MAX_PRD, -+}; -+ -+static struct scsi_host_template serverworks_csb_sht = { - ATA_BMDMA_SHT(DRV_NAME), - }; - - static struct ata_port_operations serverworks_osb4_port_ops = { - .inherits = &ata_bmdma_port_ops, -+ .qc_prep = ata_bmdma_dumb_qc_prep, - .cable_detect = serverworks_cable_detect, - .mode_filter = serverworks_osb4_filter, - .set_piomode = serverworks_set_piomode, -@@ -266,6 +272,7 @@ static struct ata_port_operations serverworks_osb4_port_ops = { - - static struct ata_port_operations serverworks_csb_port_ops = { - .inherits = &serverworks_osb4_port_ops, -+ .qc_prep = ata_bmdma_qc_prep, - .mode_filter = serverworks_csb_filter, - }; - -@@ -405,6 +412,7 @@ static int serverworks_init_one(struct pci_dev *pdev, const struct pci_device_id - } - }; - const struct ata_port_info *ppi[] = { &info[id->driver_data], NULL }; -+ struct scsi_host_template *sht = &serverworks_csb_sht; - int rc; - - rc = pcim_enable_device(pdev); -@@ -418,6 +426,7 @@ static int serverworks_init_one(struct pci_dev *pdev, const struct pci_device_id - /* Select non UDMA capable OSB4 if we can't do fixups */ - if (rc < 0) - ppi[0] = &info[1]; -+ sht = &serverworks_osb4_sht; - } - /* setup CSB5/CSB6 : South Bridge and IDE option RAID */ - else if ((pdev->device == PCI_DEVICE_ID_SERVERWORKS_CSB5IDE) || -@@ -434,7 +443,7 @@ static int serverworks_init_one(struct pci_dev *pdev, const struct pci_device_id - ppi[1] = &ata_dummy_port_info; - } - -- return ata_pci_bmdma_init_one(pdev, ppi, &serverworks_sht, NULL, 0); -+ return ata_pci_bmdma_init_one(pdev, ppi, sht, NULL, 0); - } - - #ifdef CONFIG_PM -diff --git a/drivers/base/core.c b/drivers/base/core.c -index 2b567177ef78..6a8955e78610 100644 ---- a/drivers/base/core.c -+++ b/drivers/base/core.c -@@ -741,12 +741,12 @@ class_dir_create_and_add(struct class *class, struct kobject *parent_kobj) - return &dir->kobj; - } - -+static DEFINE_MUTEX(gdp_mutex); - - static struct kobject *get_device_parent(struct device *dev, - struct device *parent) - { - if (dev->class) { -- static DEFINE_MUTEX(gdp_mutex); - struct kobject *kobj = NULL; - struct kobject *parent_kobj; - struct kobject *k; -@@ -810,7 +810,9 @@ static void cleanup_glue_dir(struct device *dev, struct kobject *glue_dir) - glue_dir->kset != &dev->class->p->glue_dirs) - return; - -+ mutex_lock(&gdp_mutex); - kobject_put(glue_dir); -+ mutex_unlock(&gdp_mutex); - } - - static void cleanup_device_parent(struct device *dev) -diff --git a/drivers/block/drbd/drbd_interval.c b/drivers/block/drbd/drbd_interval.c -index 89c497c630b4..04a14e0f8878 100644 ---- a/drivers/block/drbd/drbd_interval.c -+++ b/drivers/block/drbd/drbd_interval.c -@@ -79,6 +79,7 @@ bool - drbd_insert_interval(struct rb_root *root, struct drbd_interval *this) - { - struct rb_node **new = &root->rb_node, *parent = NULL; -+ sector_t this_end = this->sector + (this->size >> 9); - - BUG_ON(!IS_ALIGNED(this->size, 512)); - -@@ -87,6 +88,8 @@ drbd_insert_interval(struct rb_root *root, struct drbd_interval *this) - rb_entry(*new, struct drbd_interval, rb); - - parent = *new; -+ if (here->end < this_end) -+ here->end = this_end; - if (this->sector < here->sector) - new = &(*new)->rb_left; - else if (this->sector > here->sector) -@@ -99,6 +102,7 @@ drbd_insert_interval(struct rb_root *root, struct drbd_interval *this) - return false; - } - -+ this->end = this_end; - rb_link_node(&this->rb, parent, new); - rb_insert_augmented(&this->rb, root, &augment_callbacks); - return true; -diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c -index 7296c7f074bd..255ca232ecc7 100644 ---- a/drivers/block/rbd.c -+++ b/drivers/block/rbd.c -@@ -3217,7 +3217,7 @@ static int rbd_obj_read_sync(struct rbd_device *rbd_dev, - page_count = (u32) calc_pages_for(offset, length); - pages = ceph_alloc_page_vector(page_count, GFP_KERNEL); - if (IS_ERR(pages)) -- ret = PTR_ERR(pages); -+ return PTR_ERR(pages); - - ret = -ENOMEM; - obj_request = rbd_obj_request_create(object_name, offset, length, -diff --git a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blkback/blkback.c -index 64c60edcdfbc..63fc7f06a014 100644 ---- a/drivers/block/xen-blkback/blkback.c -+++ b/drivers/block/xen-blkback/blkback.c -@@ -763,6 +763,7 @@ again: - BUG_ON(new_map_idx >= segs_to_map); - if (unlikely(map[new_map_idx].status != 0)) { - pr_debug(DRV_PFX "invalid buffer -- could not remap it\n"); -+ put_free_pages(blkif, &pages[seg_idx]->page, 1); - pages[seg_idx]->handle = BLKBACK_INVALID_HANDLE; - ret |= 1; - goto next; -diff --git a/drivers/char/random.c b/drivers/char/random.c -index 429b75bb60e8..8a64dbeae7b1 100644 ---- a/drivers/char/random.c -+++ b/drivers/char/random.c -@@ -1063,8 +1063,8 @@ static void extract_buf(struct entropy_store *r, __u8 *out) - * pool while mixing, and hash one final time. - */ - sha_transform(hash.w, extract, workspace); -- memset(extract, 0, sizeof(extract)); -- memset(workspace, 0, sizeof(workspace)); -+ memzero_explicit(extract, sizeof(extract)); -+ memzero_explicit(workspace, sizeof(workspace)); - - /* - * In case the hash function has some recognizable output -@@ -1076,7 +1076,7 @@ static void extract_buf(struct entropy_store *r, __u8 *out) - hash.w[2] ^= rol32(hash.w[2], 16); - - memcpy(out, &hash, EXTRACT_SIZE); -- memset(&hash, 0, sizeof(hash)); -+ memzero_explicit(&hash, sizeof(hash)); - } - - static ssize_t extract_entropy(struct entropy_store *r, void *buf, -@@ -1124,7 +1124,7 @@ static ssize_t extract_entropy(struct entropy_store *r, void *buf, - } - - /* Wipe data just returned from memory */ -- memset(tmp, 0, sizeof(tmp)); -+ memzero_explicit(tmp, sizeof(tmp)); - - return ret; - } -@@ -1162,7 +1162,7 @@ static ssize_t extract_entropy_user(struct entropy_store *r, void __user *buf, - } - - /* Wipe data just returned from memory */ -- memset(tmp, 0, sizeof(tmp)); -+ memzero_explicit(tmp, sizeof(tmp)); - - return ret; - } -diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c -index 415923606164..4854f81d038b 100644 ---- a/drivers/cpufreq/cpufreq.c -+++ b/drivers/cpufreq/cpufreq.c -@@ -460,7 +460,18 @@ show_one(cpuinfo_max_freq, cpuinfo.max_freq); - show_one(cpuinfo_transition_latency, cpuinfo.transition_latency); - show_one(scaling_min_freq, min); - show_one(scaling_max_freq, max); --show_one(scaling_cur_freq, cur); -+ -+static ssize_t show_scaling_cur_freq( -+ struct cpufreq_policy *policy, char *buf) -+{ -+ ssize_t ret; -+ -+ if (cpufreq_driver && cpufreq_driver->setpolicy && cpufreq_driver->get) -+ ret = sprintf(buf, "%u\n", cpufreq_driver->get(policy->cpu)); -+ else -+ ret = sprintf(buf, "%u\n", policy->cur); -+ return ret; -+} - - static int cpufreq_set_policy(struct cpufreq_policy *policy, - struct cpufreq_policy *new_policy); -@@ -854,11 +865,11 @@ static int cpufreq_add_dev_interface(struct cpufreq_policy *policy, - if (ret) - goto err_out_kobj_put; - } -- if (has_target()) { -- ret = sysfs_create_file(&policy->kobj, &scaling_cur_freq.attr); -- if (ret) -- goto err_out_kobj_put; -- } -+ -+ ret = sysfs_create_file(&policy->kobj, &scaling_cur_freq.attr); -+ if (ret) -+ goto err_out_kobj_put; -+ - if (cpufreq_driver->bios_limit) { - ret = sysfs_create_file(&policy->kobj, &bios_limit.attr); - if (ret) -diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c -index ae52c777339d..533a509439ca 100644 ---- a/drivers/cpufreq/intel_pstate.c -+++ b/drivers/cpufreq/intel_pstate.c -@@ -55,6 +55,17 @@ static inline int32_t div_fp(int32_t x, int32_t y) - return div_s64((int64_t)x << FRAC_BITS, (int64_t)y); - } - -+static inline int ceiling_fp(int32_t x) -+{ -+ int mask, ret; -+ -+ ret = fp_toint(x); -+ mask = (1 << FRAC_BITS) - 1; -+ if (x & mask) -+ ret += 1; -+ return ret; -+} -+ - struct sample { - int32_t core_pct_busy; - u64 aperf; -@@ -67,6 +78,7 @@ struct pstate_data { - int current_pstate; - int min_pstate; - int max_pstate; -+ int scaling; - int turbo_pstate; - }; - -@@ -118,6 +130,7 @@ struct pstate_funcs { - int (*get_max)(void); - int (*get_min)(void); - int (*get_turbo)(void); -+ int (*get_scaling)(void); - void (*set)(struct cpudata*, int pstate); - void (*get_vid)(struct cpudata *); - }; -@@ -397,7 +410,7 @@ static void byt_set_pstate(struct cpudata *cpudata, int pstate) - cpudata->vid.ratio); - - vid_fp = clamp_t(int32_t, vid_fp, cpudata->vid.min, cpudata->vid.max); -- vid = fp_toint(vid_fp); -+ vid = ceiling_fp(vid_fp); - - if (pstate > cpudata->pstate.max_pstate) - vid = cpudata->vid.turbo; -@@ -407,6 +420,22 @@ static void byt_set_pstate(struct cpudata *cpudata, int pstate) - wrmsrl(MSR_IA32_PERF_CTL, val); - } - -+#define BYT_BCLK_FREQS 5 -+static int byt_freq_table[BYT_BCLK_FREQS] = { 833, 1000, 1333, 1167, 800}; -+ -+static int byt_get_scaling(void) -+{ -+ u64 value; -+ int i; -+ -+ rdmsrl(MSR_FSB_FREQ, value); -+ i = value & 0x3; -+ -+ BUG_ON(i > BYT_BCLK_FREQS); -+ -+ return byt_freq_table[i] * 100; -+} -+ - static void byt_get_vid(struct cpudata *cpudata) - { - u64 value; -@@ -451,6 +480,11 @@ static int core_get_turbo_pstate(void) - return ret; - } - -+static inline int core_get_scaling(void) -+{ -+ return 100000; -+} -+ - static void core_set_pstate(struct cpudata *cpudata, int pstate) - { - u64 val; -@@ -475,6 +509,7 @@ static struct cpu_defaults core_params = { - .get_max = core_get_max_pstate, - .get_min = core_get_min_pstate, - .get_turbo = core_get_turbo_pstate, -+ .get_scaling = core_get_scaling, - .set = core_set_pstate, - }, - }; -@@ -493,6 +528,7 @@ static struct cpu_defaults byt_params = { - .get_min = byt_get_min_pstate, - .get_turbo = byt_get_turbo_pstate, - .set = byt_set_pstate, -+ .get_scaling = byt_get_scaling, - .get_vid = byt_get_vid, - }, - }; -@@ -526,7 +562,7 @@ static void intel_pstate_set_pstate(struct cpudata *cpu, int pstate) - if (pstate == cpu->pstate.current_pstate) - return; - -- trace_cpu_frequency(pstate * 100000, cpu->cpu); -+ trace_cpu_frequency(pstate * cpu->pstate.scaling, cpu->cpu); - - cpu->pstate.current_pstate = pstate; - -@@ -555,6 +591,7 @@ static void intel_pstate_get_cpu_pstates(struct cpudata *cpu) - cpu->pstate.min_pstate = pstate_funcs.get_min(); - cpu->pstate.max_pstate = pstate_funcs.get_max(); - cpu->pstate.turbo_pstate = pstate_funcs.get_turbo(); -+ cpu->pstate.scaling = pstate_funcs.get_scaling(); - - if (pstate_funcs.get_vid) - pstate_funcs.get_vid(cpu); -@@ -574,7 +611,9 @@ static inline void intel_pstate_calc_busy(struct cpudata *cpu, - core_pct += 1; - - sample->freq = fp_toint( -- mul_fp(int_tofp(cpu->pstate.max_pstate * 1000), core_pct)); -+ mul_fp(int_tofp( -+ cpu->pstate.max_pstate * cpu->pstate.scaling / 100), -+ core_pct)); - - sample->core_pct_busy = (int32_t)core_pct; - } -@@ -685,10 +724,14 @@ static const struct x86_cpu_id intel_pstate_cpu_ids[] = { - ICPU(0x37, byt_params), - ICPU(0x3a, core_params), - ICPU(0x3c, core_params), -+ ICPU(0x3d, core_params), - ICPU(0x3e, core_params), - ICPU(0x3f, core_params), - ICPU(0x45, core_params), - ICPU(0x46, core_params), -+ ICPU(0x4c, byt_params), -+ ICPU(0x4f, core_params), -+ ICPU(0x56, core_params), - {} - }; - MODULE_DEVICE_TABLE(x86cpu, intel_pstate_cpu_ids); -@@ -751,6 +794,7 @@ static int intel_pstate_set_policy(struct cpufreq_policy *policy) - if (policy->policy == CPUFREQ_POLICY_PERFORMANCE) { - limits.min_perf_pct = 100; - limits.min_perf = int_tofp(1); -+ limits.max_policy_pct = 100; - limits.max_perf_pct = 100; - limits.max_perf = int_tofp(1); - limits.no_turbo = limits.turbo_disabled; -@@ -812,12 +856,13 @@ static int intel_pstate_cpu_init(struct cpufreq_policy *policy) - else - policy->policy = CPUFREQ_POLICY_POWERSAVE; - -- policy->min = cpu->pstate.min_pstate * 100000; -- policy->max = cpu->pstate.turbo_pstate * 100000; -+ policy->min = cpu->pstate.min_pstate * cpu->pstate.scaling; -+ policy->max = cpu->pstate.turbo_pstate * cpu->pstate.scaling; - - /* cpuinfo and default policy values */ -- policy->cpuinfo.min_freq = cpu->pstate.min_pstate * 100000; -- policy->cpuinfo.max_freq = cpu->pstate.turbo_pstate * 100000; -+ policy->cpuinfo.min_freq = cpu->pstate.min_pstate * cpu->pstate.scaling; -+ policy->cpuinfo.max_freq = -+ cpu->pstate.turbo_pstate * cpu->pstate.scaling; - policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL; - cpumask_set_cpu(policy->cpu, policy->cpus); - -@@ -875,6 +920,7 @@ static void copy_cpu_funcs(struct pstate_funcs *funcs) - pstate_funcs.get_max = funcs->get_max; - pstate_funcs.get_min = funcs->get_min; - pstate_funcs.get_turbo = funcs->get_turbo; -+ pstate_funcs.get_scaling = funcs->get_scaling; - pstate_funcs.set = funcs->set; - pstate_funcs.get_vid = funcs->get_vid; - } -diff --git a/drivers/edac/cpc925_edac.c b/drivers/edac/cpc925_edac.c -index df6575f1430d..682288ced4ac 100644 ---- a/drivers/edac/cpc925_edac.c -+++ b/drivers/edac/cpc925_edac.c -@@ -562,7 +562,7 @@ static void cpc925_mc_check(struct mem_ctl_info *mci) - - if (apiexcp & UECC_EXCP_DETECTED) { - cpc925_mc_printk(mci, KERN_INFO, "DRAM UECC Fault\n"); -- edac_mc_handle_error(HW_EVENT_ERR_CORRECTED, mci, 1, -+ edac_mc_handle_error(HW_EVENT_ERR_UNCORRECTED, mci, 1, - pfn, offset, 0, - csrow, -1, -1, - mci->ctl_name, ""); -diff --git a/drivers/edac/e7xxx_edac.c b/drivers/edac/e7xxx_edac.c -index 3cda79bc8b00..ece3aef16bb1 100644 ---- a/drivers/edac/e7xxx_edac.c -+++ b/drivers/edac/e7xxx_edac.c -@@ -226,7 +226,7 @@ static void process_ce(struct mem_ctl_info *mci, struct e7xxx_error_info *info) - static void process_ce_no_info(struct mem_ctl_info *mci) - { - edac_dbg(3, "\n"); -- edac_mc_handle_error(HW_EVENT_ERR_UNCORRECTED, mci, 1, 0, 0, 0, -1, -1, -1, -+ edac_mc_handle_error(HW_EVENT_ERR_CORRECTED, mci, 1, 0, 0, 0, -1, -1, -1, - "e7xxx CE log register overflow", ""); - } - -diff --git a/drivers/edac/i3200_edac.c b/drivers/edac/i3200_edac.c -index fa1326e5a4b0..ad76f10865c6 100644 ---- a/drivers/edac/i3200_edac.c -+++ b/drivers/edac/i3200_edac.c -@@ -242,11 +242,11 @@ static void i3200_process_error_info(struct mem_ctl_info *mci, - -1, -1, - "i3000 UE", ""); - } else if (log & I3200_ECCERRLOG_CE) { -- edac_mc_handle_error(HW_EVENT_ERR_UNCORRECTED, mci, 1, -+ edac_mc_handle_error(HW_EVENT_ERR_CORRECTED, mci, 1, - 0, 0, eccerrlog_syndrome(log), - eccerrlog_row(channel, log), - -1, -1, -- "i3000 UE", ""); -+ "i3000 CE", ""); - } - } - } -diff --git a/drivers/edac/i82860_edac.c b/drivers/edac/i82860_edac.c -index 3382f6344e42..4382343a7c60 100644 ---- a/drivers/edac/i82860_edac.c -+++ b/drivers/edac/i82860_edac.c -@@ -124,7 +124,7 @@ static int i82860_process_error_info(struct mem_ctl_info *mci, - dimm->location[0], dimm->location[1], -1, - "i82860 UE", ""); - else -- edac_mc_handle_error(HW_EVENT_ERR_UNCORRECTED, mci, 1, -+ edac_mc_handle_error(HW_EVENT_ERR_CORRECTED, mci, 1, - info->eap, 0, info->derrsyn, - dimm->location[0], dimm->location[1], -1, - "i82860 CE", ""); -diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c -index cca063b11083..d2e56e95d886 100644 ---- a/drivers/gpu/drm/ast/ast_mode.c -+++ b/drivers/gpu/drm/ast/ast_mode.c -@@ -1012,8 +1012,8 @@ static u32 copy_cursor_image(u8 *src, u8 *dst, int width, int height) - srcdata32[1].ul = *((u32 *)(srcxor + 4)) & 0xf0f0f0f0; - data32.b[0] = srcdata32[0].b[1] | (srcdata32[0].b[0] >> 4); - data32.b[1] = srcdata32[0].b[3] | (srcdata32[0].b[2] >> 4); -- data32.b[2] = srcdata32[0].b[1] | (srcdata32[1].b[0] >> 4); -- data32.b[3] = srcdata32[0].b[3] | (srcdata32[1].b[2] >> 4); -+ data32.b[2] = srcdata32[1].b[1] | (srcdata32[1].b[0] >> 4); -+ data32.b[3] = srcdata32[1].b[3] | (srcdata32[1].b[2] >> 4); - - writel(data32.ul, dstxor); - csum += data32.ul; -diff --git a/drivers/gpu/drm/cirrus/cirrus_drv.c b/drivers/gpu/drm/cirrus/cirrus_drv.c -index 08ce520f61a5..faa1f421f1b8 100644 ---- a/drivers/gpu/drm/cirrus/cirrus_drv.c -+++ b/drivers/gpu/drm/cirrus/cirrus_drv.c -@@ -32,6 +32,8 @@ static struct drm_driver driver; - static DEFINE_PCI_DEVICE_TABLE(pciidlist) = { - { PCI_VENDOR_ID_CIRRUS, PCI_DEVICE_ID_CIRRUS_5446, 0x1af4, 0x1100, 0, - 0, 0 }, -+ { PCI_VENDOR_ID_CIRRUS, PCI_DEVICE_ID_CIRRUS_5446, PCI_VENDOR_ID_XEN, -+ 0x0001, 0, 0, 0 }, - {0,} - }; - -diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c -index fd98bec78816..c6d9777bdb45 100644 ---- a/drivers/gpu/drm/i915/intel_panel.c -+++ b/drivers/gpu/drm/i915/intel_panel.c -@@ -645,7 +645,7 @@ static void pch_enable_backlight(struct intel_connector *connector) - - cpu_ctl2 = I915_READ(BLC_PWM_CPU_CTL2); - if (cpu_ctl2 & BLM_PWM_ENABLE) { -- WARN(1, "cpu backlight already enabled\n"); -+ DRM_DEBUG_KMS("cpu backlight already enabled\n"); - cpu_ctl2 &= ~BLM_PWM_ENABLE; - I915_WRITE(BLC_PWM_CPU_CTL2, cpu_ctl2); - } -@@ -693,7 +693,7 @@ static void i9xx_enable_backlight(struct intel_connector *connector) - - ctl = I915_READ(BLC_PWM_CTL); - if (ctl & BACKLIGHT_DUTY_CYCLE_MASK_PNV) { -- WARN(1, "backlight already enabled\n"); -+ DRM_DEBUG_KMS("backlight already enabled\n"); - I915_WRITE(BLC_PWM_CTL, 0); - } - -@@ -724,7 +724,7 @@ static void i965_enable_backlight(struct intel_connector *connector) - - ctl2 = I915_READ(BLC_PWM_CTL2); - if (ctl2 & BLM_PWM_ENABLE) { -- WARN(1, "backlight already enabled\n"); -+ DRM_DEBUG_KMS("backlight already enabled\n"); - ctl2 &= ~BLM_PWM_ENABLE; - I915_WRITE(BLC_PWM_CTL2, ctl2); - } -@@ -758,7 +758,7 @@ static void vlv_enable_backlight(struct intel_connector *connector) - - ctl2 = I915_READ(VLV_BLC_PWM_CTL2(pipe)); - if (ctl2 & BLM_PWM_ENABLE) { -- WARN(1, "backlight already enabled\n"); -+ DRM_DEBUG_KMS("backlight already enabled\n"); - ctl2 &= ~BLM_PWM_ENABLE; - I915_WRITE(VLV_BLC_PWM_CTL2(pipe), ctl2); - } -diff --git a/drivers/gpu/drm/nouveau/core/subdev/bios/dcb.c b/drivers/gpu/drm/nouveau/core/subdev/bios/dcb.c -index 2d9b9d7a7992..f3edd2841f2d 100644 ---- a/drivers/gpu/drm/nouveau/core/subdev/bios/dcb.c -+++ b/drivers/gpu/drm/nouveau/core/subdev/bios/dcb.c -@@ -124,6 +124,7 @@ dcb_outp_parse(struct nouveau_bios *bios, u8 idx, u8 *ver, u8 *len, - struct dcb_output *outp) - { - u16 dcb = dcb_outp(bios, idx, ver, len); -+ memset(outp, 0x00, sizeof(*outp)); - if (dcb) { - if (*ver >= 0x20) { - u32 conn = nv_ro32(bios, dcb + 0x00); -diff --git a/drivers/gpu/drm/qxl/qxl_display.c b/drivers/gpu/drm/qxl/qxl_display.c -index 798bde2e5881..c39c414c7751 100644 ---- a/drivers/gpu/drm/qxl/qxl_display.c -+++ b/drivers/gpu/drm/qxl/qxl_display.c -@@ -523,7 +523,6 @@ static int qxl_crtc_mode_set(struct drm_crtc *crtc, - struct qxl_framebuffer *qfb; - struct qxl_bo *bo, *old_bo = NULL; - struct qxl_crtc *qcrtc = to_qxl_crtc(crtc); -- uint32_t width, height, base_offset; - bool recreate_primary = false; - int ret; - int surf_id; -@@ -553,9 +552,10 @@ static int qxl_crtc_mode_set(struct drm_crtc *crtc, - if (qcrtc->index == 0) - recreate_primary = true; - -- width = mode->hdisplay; -- height = mode->vdisplay; -- base_offset = 0; -+ if (bo->surf.stride * bo->surf.height > qdev->vram_size) { -+ DRM_ERROR("Mode doesn't fit in vram size (vgamem)"); -+ return -EINVAL; -+ } - - ret = qxl_bo_reserve(bo, false); - if (ret != 0) -@@ -569,10 +569,10 @@ static int qxl_crtc_mode_set(struct drm_crtc *crtc, - if (recreate_primary) { - qxl_io_destroy_primary(qdev); - qxl_io_log(qdev, -- "recreate primary: %dx%d (was %dx%d,%d,%d)\n", -- width, height, bo->surf.width, -- bo->surf.height, bo->surf.stride, bo->surf.format); -- qxl_io_create_primary(qdev, base_offset, bo); -+ "recreate primary: %dx%d,%d,%d\n", -+ bo->surf.width, bo->surf.height, -+ bo->surf.stride, bo->surf.format); -+ qxl_io_create_primary(qdev, 0, bo); - bo->is_primary = true; - surf_id = 0; - } else { -diff --git a/drivers/gpu/drm/radeon/si_dpm.c b/drivers/gpu/drm/radeon/si_dpm.c -index 0a2f5b4bca43..879e62844b2b 100644 ---- a/drivers/gpu/drm/radeon/si_dpm.c -+++ b/drivers/gpu/drm/radeon/si_dpm.c -@@ -6200,7 +6200,7 @@ static void si_parse_pplib_clock_info(struct radeon_device *rdev, - if ((rps->class2 & ATOM_PPLIB_CLASSIFICATION2_ULV) && - index == 0) { - /* XXX disable for A0 tahiti */ -- si_pi->ulv.supported = true; -+ si_pi->ulv.supported = false; - si_pi->ulv.pl = *pl; - si_pi->ulv.one_pcie_lane_in_ulv = false; - si_pi->ulv.volt_change_delay = SISLANDS_ULVVOLTAGECHANGEDELAY_DFLT; -diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c b/drivers/gpu/drm/tilcdc/tilcdc_drv.c -index 0644429f8559..52b47115b5cb 100644 ---- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c -+++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c -@@ -84,6 +84,7 @@ static int modeset_init(struct drm_device *dev) - if ((priv->num_encoders == 0) || (priv->num_connectors == 0)) { - /* oh nos! */ - dev_err(dev->dev, "no encoders/connectors found\n"); -+ drm_mode_config_cleanup(dev); - return -ENXIO; - } - -@@ -178,33 +179,37 @@ static int tilcdc_load(struct drm_device *dev, unsigned long flags) - dev->dev_private = priv; - - priv->wq = alloc_ordered_workqueue("tilcdc", 0); -+ if (!priv->wq) { -+ ret = -ENOMEM; -+ goto fail_free_priv; -+ } - - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) { - dev_err(dev->dev, "failed to get memory resource\n"); - ret = -EINVAL; -- goto fail; -+ goto fail_free_wq; - } - - priv->mmio = ioremap_nocache(res->start, resource_size(res)); - if (!priv->mmio) { - dev_err(dev->dev, "failed to ioremap\n"); - ret = -ENOMEM; -- goto fail; -+ goto fail_free_wq; - } - - priv->clk = clk_get(dev->dev, "fck"); - if (IS_ERR(priv->clk)) { - dev_err(dev->dev, "failed to get functional clock\n"); - ret = -ENODEV; -- goto fail; -+ goto fail_iounmap; - } - - priv->disp_clk = clk_get(dev->dev, "dpll_disp_ck"); - if (IS_ERR(priv->clk)) { - dev_err(dev->dev, "failed to get display clock\n"); - ret = -ENODEV; -- goto fail; -+ goto fail_put_clk; - } - - #ifdef CONFIG_CPU_FREQ -@@ -214,7 +219,7 @@ static int tilcdc_load(struct drm_device *dev, unsigned long flags) - CPUFREQ_TRANSITION_NOTIFIER); - if (ret) { - dev_err(dev->dev, "failed to register cpufreq notifier\n"); -- goto fail; -+ goto fail_put_disp_clk; - } - #endif - -@@ -259,13 +264,13 @@ static int tilcdc_load(struct drm_device *dev, unsigned long flags) - ret = modeset_init(dev); - if (ret < 0) { - dev_err(dev->dev, "failed to initialize mode setting\n"); -- goto fail; -+ goto fail_cpufreq_unregister; - } - - ret = drm_vblank_init(dev, 1); - if (ret < 0) { - dev_err(dev->dev, "failed to initialize vblank\n"); -- goto fail; -+ goto fail_mode_config_cleanup; - } - - pm_runtime_get_sync(dev->dev); -@@ -273,7 +278,7 @@ static int tilcdc_load(struct drm_device *dev, unsigned long flags) - pm_runtime_put_sync(dev->dev); - if (ret < 0) { - dev_err(dev->dev, "failed to install IRQ handler\n"); -- goto fail; -+ goto fail_vblank_cleanup; - } - - platform_set_drvdata(pdev, dev); -@@ -289,13 +294,48 @@ static int tilcdc_load(struct drm_device *dev, unsigned long flags) - priv->fbdev = drm_fbdev_cma_init(dev, bpp, - dev->mode_config.num_crtc, - dev->mode_config.num_connector); -+ if (IS_ERR(priv->fbdev)) { -+ ret = PTR_ERR(priv->fbdev); -+ goto fail_irq_uninstall; -+ } - - drm_kms_helper_poll_init(dev); - - return 0; - --fail: -- tilcdc_unload(dev); -+fail_irq_uninstall: -+ pm_runtime_get_sync(dev->dev); -+ drm_irq_uninstall(dev); -+ pm_runtime_put_sync(dev->dev); -+ -+fail_vblank_cleanup: -+ drm_vblank_cleanup(dev); -+ -+fail_mode_config_cleanup: -+ drm_mode_config_cleanup(dev); -+ -+fail_cpufreq_unregister: -+ pm_runtime_disable(dev->dev); -+#ifdef CONFIG_CPU_FREQ -+ cpufreq_unregister_notifier(&priv->freq_transition, -+ CPUFREQ_TRANSITION_NOTIFIER); -+fail_put_disp_clk: -+ clk_put(priv->disp_clk); -+#endif -+ -+fail_put_clk: -+ clk_put(priv->clk); -+ -+fail_iounmap: -+ iounmap(priv->mmio); -+ -+fail_free_wq: -+ flush_workqueue(priv->wq); -+ destroy_workqueue(priv->wq); -+ -+fail_free_priv: -+ dev->dev_private = NULL; -+ kfree(priv); - return ret; - } - -diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c -index 0083cbf99edf..fb7c36e93fd4 100644 ---- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c -+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c -@@ -688,7 +688,11 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset) - goto out_err0; - } - -- if (unlikely(dev_priv->prim_bb_mem < dev_priv->vram_size)) -+ /* -+ * Limit back buffer size to VRAM size. Remove this once -+ * screen targets are implemented. -+ */ -+ if (dev_priv->prim_bb_mem > dev_priv->vram_size) - dev_priv->prim_bb_mem = dev_priv->vram_size; - - mutex_unlock(&dev_priv->hw_mutex); -diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c -index 8a650413dea5..c8f8ecf7b282 100644 ---- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c -+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c -@@ -1954,6 +1954,14 @@ int vmw_du_connector_fill_modes(struct drm_connector *connector, - DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) - }; - int i; -+ u32 assumed_bpp = 2; -+ -+ /* -+ * If using screen objects, then assume 32-bpp because that's what the -+ * SVGA device is assuming -+ */ -+ if (dev_priv->sou_priv) -+ assumed_bpp = 4; - - /* Add preferred mode */ - { -@@ -1964,8 +1972,9 @@ int vmw_du_connector_fill_modes(struct drm_connector *connector, - mode->vdisplay = du->pref_height; - vmw_guess_mode_timing(mode); - -- if (vmw_kms_validate_mode_vram(dev_priv, mode->hdisplay * 2, -- mode->vdisplay)) { -+ if (vmw_kms_validate_mode_vram(dev_priv, -+ mode->hdisplay * assumed_bpp, -+ mode->vdisplay)) { - drm_mode_probed_add(connector, mode); - } else { - drm_mode_destroy(dev, mode); -@@ -1987,7 +1996,8 @@ int vmw_du_connector_fill_modes(struct drm_connector *connector, - bmode->vdisplay > max_height) - continue; - -- if (!vmw_kms_validate_mode_vram(dev_priv, bmode->hdisplay * 2, -+ if (!vmw_kms_validate_mode_vram(dev_priv, -+ bmode->hdisplay * assumed_bpp, - bmode->vdisplay)) - continue; - -diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h -index 6e12cd0317f6..91bc66b4b151 100644 ---- a/drivers/hid/hid-ids.h -+++ b/drivers/hid/hid-ids.h -@@ -292,6 +292,11 @@ - #define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_73F7 0x73f7 - #define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_A001 0xa001 - -+#define USB_VENDOR_ID_ELAN 0x04f3 -+#define USB_DEVICE_ID_ELAN_TOUCHSCREEN 0x0089 -+#define USB_DEVICE_ID_ELAN_TOUCHSCREEN_009B 0x009b -+#define USB_DEVICE_ID_ELAN_TOUCHSCREEN_016F 0x016f -+ - #define USB_VENDOR_ID_ELECOM 0x056e - #define USB_DEVICE_ID_ELECOM_BM084 0x0061 - -diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c -index 44df131d390a..617c47f9ebe6 100644 ---- a/drivers/hid/usbhid/hid-core.c -+++ b/drivers/hid/usbhid/hid-core.c -@@ -82,7 +82,7 @@ static int hid_start_in(struct hid_device *hid) - struct usbhid_device *usbhid = hid->driver_data; - - spin_lock_irqsave(&usbhid->lock, flags); -- if (hid->open > 0 && -+ if ((hid->open > 0 || hid->quirks & HID_QUIRK_ALWAYS_POLL) && - !test_bit(HID_DISCONNECTED, &usbhid->iofl) && - !test_bit(HID_SUSPENDED, &usbhid->iofl) && - !test_and_set_bit(HID_IN_RUNNING, &usbhid->iofl)) { -@@ -292,6 +292,8 @@ static void hid_irq_in(struct urb *urb) - case 0: /* success */ - usbhid_mark_busy(usbhid); - usbhid->retry_delay = 0; -+ if ((hid->quirks & HID_QUIRK_ALWAYS_POLL) && !hid->open) -+ break; - hid_input_report(urb->context, HID_INPUT_REPORT, - urb->transfer_buffer, - urb->actual_length, 1); -@@ -734,8 +736,10 @@ void usbhid_close(struct hid_device *hid) - if (!--hid->open) { - spin_unlock_irq(&usbhid->lock); - hid_cancel_delayed_stuff(usbhid); -- usb_kill_urb(usbhid->urbin); -- usbhid->intf->needs_remote_wakeup = 0; -+ if (!(hid->quirks & HID_QUIRK_ALWAYS_POLL)) { -+ usb_kill_urb(usbhid->urbin); -+ usbhid->intf->needs_remote_wakeup = 0; -+ } - } else { - spin_unlock_irq(&usbhid->lock); - } -@@ -1119,6 +1123,19 @@ static int usbhid_start(struct hid_device *hid) - - set_bit(HID_STARTED, &usbhid->iofl); - -+ if (hid->quirks & HID_QUIRK_ALWAYS_POLL) { -+ ret = usb_autopm_get_interface(usbhid->intf); -+ if (ret) -+ goto fail; -+ usbhid->intf->needs_remote_wakeup = 1; -+ ret = hid_start_in(hid); -+ if (ret) { -+ dev_err(&hid->dev, -+ "failed to start in urb: %d\n", ret); -+ } -+ usb_autopm_put_interface(usbhid->intf); -+ } -+ - /* Some keyboards don't work until their LEDs have been set. - * Since BIOSes do set the LEDs, it must be safe for any device - * that supports the keyboard boot protocol. -@@ -1151,6 +1168,9 @@ static void usbhid_stop(struct hid_device *hid) - if (WARN_ON(!usbhid)) - return; - -+ if (hid->quirks & HID_QUIRK_ALWAYS_POLL) -+ usbhid->intf->needs_remote_wakeup = 0; -+ - clear_bit(HID_STARTED, &usbhid->iofl); - spin_lock_irq(&usbhid->lock); /* Sync with error and led handlers */ - set_bit(HID_DISCONNECTED, &usbhid->iofl); -diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c -index 8e4ddb369883..deb364306636 100644 ---- a/drivers/hid/usbhid/hid-quirks.c -+++ b/drivers/hid/usbhid/hid-quirks.c -@@ -69,6 +69,9 @@ static const struct hid_blacklist { - { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_3AXIS_5BUTTON_STICK, HID_QUIRK_NOGET }, - { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_AXIS_295, HID_QUIRK_NOGET }, - { USB_VENDOR_ID_DMI, USB_DEVICE_ID_DMI_ENC, HID_QUIRK_NOGET }, -+ { USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHSCREEN, HID_QUIRK_ALWAYS_POLL }, -+ { USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHSCREEN_009B, HID_QUIRK_ALWAYS_POLL }, -+ { USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHSCREEN_016F, HID_QUIRK_ALWAYS_POLL }, - { USB_VENDOR_ID_ELO, USB_DEVICE_ID_ELO_TS2700, HID_QUIRK_NOGET }, - { USB_VENDOR_ID_FORMOSA, USB_DEVICE_ID_FORMOSA_IR_RECEIVER, HID_QUIRK_NO_INIT_REPORTS }, - { USB_VENDOR_ID_FREESCALE, USB_DEVICE_ID_FREESCALE_MX28, HID_QUIRK_NOGET }, -diff --git a/drivers/i2c/busses/i2c-at91.c b/drivers/i2c/busses/i2c-at91.c -index 11e9c7f9bf9b..8873d84e1d4f 100644 ---- a/drivers/i2c/busses/i2c-at91.c -+++ b/drivers/i2c/busses/i2c-at91.c -@@ -434,7 +434,7 @@ static int at91_do_twi_transfer(struct at91_twi_dev *dev) - } - } - -- ret = wait_for_completion_io_timeout(&dev->cmd_complete, -+ ret = wait_for_completion_timeout(&dev->cmd_complete, - dev->adapter.timeout); - if (ret == 0) { - dev_err(dev->dev, "controller timed out\n"); -diff --git a/drivers/iio/common/st_sensors/st_sensors_buffer.c b/drivers/iio/common/st_sensors/st_sensors_buffer.c -index 1665c8e4b62b..e18bc6782256 100644 ---- a/drivers/iio/common/st_sensors/st_sensors_buffer.c -+++ b/drivers/iio/common/st_sensors/st_sensors_buffer.c -@@ -71,7 +71,7 @@ int st_sensors_get_buffer_element(struct iio_dev *indio_dev, u8 *buf) - goto st_sensors_free_memory; - } - -- for (i = 0; i < n * num_data_channels; i++) { -+ for (i = 0; i < n * byte_for_channel; i++) { - if (i < n) - buf[i] = rx_array[i]; - else -diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h -index f1da362c3e65..8fca488fdc15 100644 ---- a/drivers/input/serio/i8042-x86ia64io.h -+++ b/drivers/input/serio/i8042-x86ia64io.h -@@ -101,6 +101,12 @@ static const struct dmi_system_id __initconst i8042_dmi_noloop_table[] = { - }, - { - .matches = { -+ DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), -+ DMI_MATCH(DMI_PRODUCT_NAME, "X750LN"), -+ }, -+ }, -+ { -+ .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "Compaq"), - DMI_MATCH(DMI_PRODUCT_NAME , "ProLiant"), - DMI_MATCH(DMI_PRODUCT_VERSION, "8500"), -@@ -609,6 +615,22 @@ static const struct dmi_system_id __initconst i8042_dmi_notimeout_table[] = { - }, - }, - { -+ /* Fujitsu A544 laptop */ -+ /* https://bugzilla.redhat.com/show_bug.cgi?id=1111138 */ -+ .matches = { -+ DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"), -+ DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK A544"), -+ }, -+ }, -+ { -+ /* Fujitsu AH544 laptop */ -+ /* https://bugzilla.kernel.org/show_bug.cgi?id=69731 */ -+ .matches = { -+ DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"), -+ DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK AH544"), -+ }, -+ }, -+ { - /* Fujitsu U574 laptop */ - /* https://bugzilla.kernel.org/show_bug.cgi?id=69731 */ - .matches = { -diff --git a/drivers/md/dm-bufio.c b/drivers/md/dm-bufio.c -index 0e722c103562..ca1621b49453 100644 ---- a/drivers/md/dm-bufio.c -+++ b/drivers/md/dm-bufio.c -@@ -465,6 +465,7 @@ static void __relink_lru(struct dm_buffer *b, int dirty) - c->n_buffers[dirty]++; - b->list_mode = dirty; - list_move(&b->lru_list, &c->lru[dirty]); -+ b->last_accessed = jiffies; - } - - /*---------------------------------------------------------------- -@@ -1485,9 +1486,9 @@ static long __scan(struct dm_bufio_client *c, unsigned long nr_to_scan, - list_for_each_entry_safe_reverse(b, tmp, &c->lru[l], lru_list) { - freed += __cleanup_old_buffer(b, gfp_mask, 0); - if (!--nr_to_scan) -- break; -+ return freed; -+ dm_bufio_cond_resched(); - } -- dm_bufio_cond_resched(); - } - return freed; - } -diff --git a/drivers/md/dm-log-userspace-transfer.c b/drivers/md/dm-log-userspace-transfer.c -index 08d9a207259a..c69d0b787746 100644 ---- a/drivers/md/dm-log-userspace-transfer.c -+++ b/drivers/md/dm-log-userspace-transfer.c -@@ -272,7 +272,7 @@ int dm_ulog_tfr_init(void) - - r = cn_add_callback(&ulog_cn_id, "dmlogusr", cn_ulog_callback); - if (r) { -- cn_del_callback(&ulog_cn_id); -+ kfree(prealloced_cn_msg); - return r; - } - -diff --git a/drivers/media/dvb-frontends/ds3000.c b/drivers/media/dvb-frontends/ds3000.c -index 1e344b033277..22e8c2032f6d 100644 ---- a/drivers/media/dvb-frontends/ds3000.c -+++ b/drivers/media/dvb-frontends/ds3000.c -@@ -864,6 +864,13 @@ struct dvb_frontend *ds3000_attach(const struct ds3000_config *config, - memcpy(&state->frontend.ops, &ds3000_ops, - sizeof(struct dvb_frontend_ops)); - state->frontend.demodulator_priv = state; -+ -+ /* -+ * Some devices like T480 starts with voltage on. Be sure -+ * to turn voltage off during init, as this can otherwise -+ * interfere with Unicable SCR systems. -+ */ -+ ds3000_set_voltage(&state->frontend, SEC_VOLTAGE_OFF); - return &state->frontend; - - error3: -diff --git a/drivers/media/i2c/tda7432.c b/drivers/media/i2c/tda7432.c -index 72af644fa051..cf93021a6500 100644 ---- a/drivers/media/i2c/tda7432.c -+++ b/drivers/media/i2c/tda7432.c -@@ -293,7 +293,7 @@ static int tda7432_s_ctrl(struct v4l2_ctrl *ctrl) - if (t->mute->val) { - lf |= TDA7432_MUTE; - lr |= TDA7432_MUTE; -- lf |= TDA7432_MUTE; -+ rf |= TDA7432_MUTE; - rr |= TDA7432_MUTE; - } - /* Mute & update balance*/ -diff --git a/drivers/media/tuners/m88ts2022.c b/drivers/media/tuners/m88ts2022.c -index 40c42dec721b..7a62097aa9ea 100644 ---- a/drivers/media/tuners/m88ts2022.c -+++ b/drivers/media/tuners/m88ts2022.c -@@ -314,7 +314,7 @@ static int m88ts2022_set_params(struct dvb_frontend *fe) - div_min = gdiv28 * 78 / 100; - div_max = clamp_val(div_max, 0U, 63U); - -- f_3db_hz = c->symbol_rate * 135UL / 200UL; -+ f_3db_hz = mult_frac(c->symbol_rate, 135, 200); - f_3db_hz += 2000000U + (frequency_offset_khz * 1000U); - f_3db_hz = clamp(f_3db_hz, 7000000U, 40000000U); - -diff --git a/drivers/media/usb/em28xx/em28xx-cards.c b/drivers/media/usb/em28xx/em28xx-cards.c -index 4d97a76cc3b0..c1a3f8f95750 100644 ---- a/drivers/media/usb/em28xx/em28xx-cards.c -+++ b/drivers/media/usb/em28xx/em28xx-cards.c -@@ -2993,16 +2993,6 @@ static int em28xx_init_dev(struct em28xx *dev, struct usb_device *udev, - } - } - -- if (dev->chip_id == CHIP_ID_EM2870 || -- dev->chip_id == CHIP_ID_EM2874 || -- dev->chip_id == CHIP_ID_EM28174 || -- dev->chip_id == CHIP_ID_EM28178) { -- /* Digital only device - don't load any alsa module */ -- dev->audio_mode.has_audio = false; -- dev->has_audio_class = false; -- dev->has_alsa_audio = false; -- } -- - if (chip_name != default_chip_name) - printk(KERN_INFO DRIVER_NAME - ": chip ID is %s\n", chip_name); -@@ -3272,7 +3262,6 @@ static int em28xx_usb_probe(struct usb_interface *interface, - dev->alt = -1; - dev->is_audio_only = has_audio && !(has_video || has_dvb); - dev->has_alsa_audio = has_audio; -- dev->audio_mode.has_audio = has_audio; - dev->has_video = has_video; - dev->ifnum = ifnum; - -diff --git a/drivers/media/usb/em28xx/em28xx-core.c b/drivers/media/usb/em28xx/em28xx-core.c -index 898fb9bd88a2..97fd881a4e7b 100644 ---- a/drivers/media/usb/em28xx/em28xx-core.c -+++ b/drivers/media/usb/em28xx/em28xx-core.c -@@ -506,8 +506,18 @@ int em28xx_audio_setup(struct em28xx *dev) - int vid1, vid2, feat, cfg; - u32 vid; - -- if (!dev->audio_mode.has_audio) -+ if (dev->chip_id == CHIP_ID_EM2870 || -+ dev->chip_id == CHIP_ID_EM2874 || -+ dev->chip_id == CHIP_ID_EM28174 || -+ dev->chip_id == CHIP_ID_EM28178) { -+ /* Digital only device - don't load any alsa module */ -+ dev->audio_mode.has_audio = false; -+ dev->has_audio_class = false; -+ dev->has_alsa_audio = false; - return 0; -+ } -+ -+ dev->audio_mode.has_audio = true; - - /* See how this device is configured */ - cfg = em28xx_read_reg(dev, EM28XX_R00_CHIPCFG); -diff --git a/drivers/media/usb/em28xx/em28xx-video.c b/drivers/media/usb/em28xx/em28xx-video.c -index c3c928937dcd..e24ee08e634e 100644 ---- a/drivers/media/usb/em28xx/em28xx-video.c -+++ b/drivers/media/usb/em28xx/em28xx-video.c -@@ -953,13 +953,16 @@ static int em28xx_stop_streaming(struct vb2_queue *vq) - } - - spin_lock_irqsave(&dev->slock, flags); -+ if (dev->usb_ctl.vid_buf != NULL) { -+ vb2_buffer_done(&dev->usb_ctl.vid_buf->vb, VB2_BUF_STATE_ERROR); -+ dev->usb_ctl.vid_buf = NULL; -+ } - while (!list_empty(&vidq->active)) { - struct em28xx_buffer *buf; - buf = list_entry(vidq->active.next, struct em28xx_buffer, list); - list_del(&buf->list); - vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR); - } -- dev->usb_ctl.vid_buf = NULL; - spin_unlock_irqrestore(&dev->slock, flags); - - return 0; -@@ -981,13 +984,16 @@ int em28xx_stop_vbi_streaming(struct vb2_queue *vq) - } - - spin_lock_irqsave(&dev->slock, flags); -+ if (dev->usb_ctl.vbi_buf != NULL) { -+ vb2_buffer_done(&dev->usb_ctl.vbi_buf->vb, VB2_BUF_STATE_ERROR); -+ dev->usb_ctl.vbi_buf = NULL; -+ } - while (!list_empty(&vbiq->active)) { - struct em28xx_buffer *buf; - buf = list_entry(vbiq->active.next, struct em28xx_buffer, list); - list_del(&buf->list); - vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR); - } -- dev->usb_ctl.vbi_buf = NULL; - spin_unlock_irqrestore(&dev->slock, flags); - - return 0; -diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c -index c3bb2502225b..753ad4cfc118 100644 ---- a/drivers/media/usb/uvc/uvc_driver.c -+++ b/drivers/media/usb/uvc/uvc_driver.c -@@ -2210,6 +2210,15 @@ static struct usb_device_id uvc_ids[] = { - .bInterfaceSubClass = 1, - .bInterfaceProtocol = 0, - .driver_info = UVC_QUIRK_PROBE_DEF }, -+ /* Dell XPS M1330 (OmniVision OV7670 webcam) */ -+ { .match_flags = USB_DEVICE_ID_MATCH_DEVICE -+ | USB_DEVICE_ID_MATCH_INT_INFO, -+ .idVendor = 0x05a9, -+ .idProduct = 0x7670, -+ .bInterfaceClass = USB_CLASS_VIDEO, -+ .bInterfaceSubClass = 1, -+ .bInterfaceProtocol = 0, -+ .driver_info = UVC_QUIRK_PROBE_DEF }, - /* Apple Built-In iSight */ - { .match_flags = USB_DEVICE_ID_MATCH_DEVICE - | USB_DEVICE_ID_MATCH_INT_INFO, -diff --git a/drivers/media/v4l2-core/v4l2-common.c b/drivers/media/v4l2-core/v4l2-common.c -index 433d6d77942e..c5521cec933b 100644 ---- a/drivers/media/v4l2-core/v4l2-common.c -+++ b/drivers/media/v4l2-core/v4l2-common.c -@@ -431,16 +431,13 @@ static unsigned int clamp_align(unsigned int x, unsigned int min, - /* Bits that must be zero to be aligned */ - unsigned int mask = ~((1 << align) - 1); - -+ /* Clamp to aligned min and max */ -+ x = clamp(x, (min + ~mask) & mask, max & mask); -+ - /* Round to nearest aligned value */ - if (align) - x = (x + (1 << (align - 1))) & mask; - -- /* Clamp to aligned value of min and max */ -- if (x < min) -- x = (min + ~mask) & mask; -- else if (x > max) -- x = max & mask; -- - return x; - } - -diff --git a/drivers/mfd/rtsx_pcr.c b/drivers/mfd/rtsx_pcr.c -index 1d15735f9ef9..89b4c4216d0c 100644 ---- a/drivers/mfd/rtsx_pcr.c -+++ b/drivers/mfd/rtsx_pcr.c -@@ -1177,7 +1177,7 @@ static int rtsx_pci_probe(struct pci_dev *pcidev, - pcr->msi_en = msi_en; - if (pcr->msi_en) { - ret = pci_enable_msi(pcidev); -- if (ret < 0) -+ if (ret) - pcr->msi_en = false; - } - -diff --git a/drivers/mfd/ti_am335x_tscadc.c b/drivers/mfd/ti_am335x_tscadc.c -index d4e860413bb5..e87a2485468f 100644 ---- a/drivers/mfd/ti_am335x_tscadc.c -+++ b/drivers/mfd/ti_am335x_tscadc.c -@@ -54,11 +54,11 @@ void am335x_tsc_se_set_cache(struct ti_tscadc_dev *tsadc, u32 val) - unsigned long flags; - - spin_lock_irqsave(&tsadc->reg_lock, flags); -- tsadc->reg_se_cache = val; -+ tsadc->reg_se_cache |= val; - if (tsadc->adc_waiting) - wake_up(&tsadc->reg_se_wait); - else if (!tsadc->adc_in_use) -- tscadc_writel(tsadc, REG_SE, val); -+ tscadc_writel(tsadc, REG_SE, tsadc->reg_se_cache); - - spin_unlock_irqrestore(&tsadc->reg_lock, flags); - } -@@ -97,6 +97,7 @@ static void am335x_tscadc_need_adc(struct ti_tscadc_dev *tsadc) - void am335x_tsc_se_set_once(struct ti_tscadc_dev *tsadc, u32 val) - { - spin_lock_irq(&tsadc->reg_lock); -+ tsadc->reg_se_cache |= val; - am335x_tscadc_need_adc(tsadc); - - tscadc_writel(tsadc, REG_SE, val); -diff --git a/drivers/mmc/host/rtsx_pci_sdmmc.c b/drivers/mmc/host/rtsx_pci_sdmmc.c -index 7e1866175e7b..ca297d741207 100644 ---- a/drivers/mmc/host/rtsx_pci_sdmmc.c -+++ b/drivers/mmc/host/rtsx_pci_sdmmc.c -@@ -342,6 +342,13 @@ static void sd_send_cmd_get_rsp(struct realtek_pci_sdmmc *host, - } - - if (rsp_type == SD_RSP_TYPE_R2) { -+ /* -+ * The controller offloads the last byte {CRC-7, end bit 1'b1} -+ * of response type R2. Assign dummy CRC, 0, and end bit to the -+ * byte(ptr[16], goes into the LSB of resp[3] later). -+ */ -+ ptr[16] = 1; -+ - for (i = 0; i < 4; i++) { - cmd->resp[i] = get_unaligned_be32(ptr + 1 + i * 4); - dev_dbg(sdmmc_dev(host), "cmd->resp[%d] = 0x%08x\n", -diff --git a/drivers/mmc/host/sdhci-pci.c b/drivers/mmc/host/sdhci-pci.c -index 0955777b6c7e..19bfa0ad70c4 100644 ---- a/drivers/mmc/host/sdhci-pci.c -+++ b/drivers/mmc/host/sdhci-pci.c -@@ -103,6 +103,10 @@ static const struct sdhci_pci_fixes sdhci_cafe = { - SDHCI_QUIRK_BROKEN_TIMEOUT_VAL, - }; - -+static const struct sdhci_pci_fixes sdhci_intel_qrk = { -+ .quirks = SDHCI_QUIRK_NO_HISPD_BIT, -+}; -+ - static int mrst_hc_probe_slot(struct sdhci_pci_slot *slot) - { - slot->host->mmc->caps |= MMC_CAP_8_BIT_DATA; -@@ -733,6 +737,14 @@ static const struct pci_device_id pci_ids[] = { - - { - .vendor = PCI_VENDOR_ID_INTEL, -+ .device = PCI_DEVICE_ID_INTEL_QRK_SD, -+ .subvendor = PCI_ANY_ID, -+ .subdevice = PCI_ANY_ID, -+ .driver_data = (kernel_ulong_t)&sdhci_intel_qrk, -+ }, -+ -+ { -+ .vendor = PCI_VENDOR_ID_INTEL, - .device = PCI_DEVICE_ID_INTEL_MRST_SD0, - .subvendor = PCI_ANY_ID, - .subdevice = PCI_ANY_ID, -diff --git a/drivers/mmc/host/sdhci-pci.h b/drivers/mmc/host/sdhci-pci.h -index 6d718719659e..c101477ef3be 100644 ---- a/drivers/mmc/host/sdhci-pci.h -+++ b/drivers/mmc/host/sdhci-pci.h -@@ -17,6 +17,7 @@ - #define PCI_DEVICE_ID_INTEL_CLV_SDIO2 0x08fb - #define PCI_DEVICE_ID_INTEL_CLV_EMMC0 0x08e5 - #define PCI_DEVICE_ID_INTEL_CLV_EMMC1 0x08e6 -+#define PCI_DEVICE_ID_INTEL_QRK_SD 0x08A7 - - /* - * PCI registers -diff --git a/drivers/mtd/ubi/fastmap.c b/drivers/mtd/ubi/fastmap.c -index c5dad652614d..904b4517fc1e 100644 ---- a/drivers/mtd/ubi/fastmap.c -+++ b/drivers/mtd/ubi/fastmap.c -@@ -330,6 +330,7 @@ static int process_pool_aeb(struct ubi_device *ubi, struct ubi_attach_info *ai, - av = tmp_av; - else { - ubi_err("orphaned volume in fastmap pool!"); -+ kmem_cache_free(ai->aeb_slab_cache, new_aeb); - return UBI_BAD_FASTMAP; - } - -diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig -index 494b888a6568..7e5c6a8b89e7 100644 ---- a/drivers/net/Kconfig -+++ b/drivers/net/Kconfig -@@ -135,6 +135,7 @@ config MACVLAN - config MACVTAP - tristate "MAC-VLAN based tap driver" - depends on MACVLAN -+ depends on INET - help - This adds a specialized tap character device driver that is based - on the MAC-VLAN network interface, called macvtap. A macvtap device -@@ -205,6 +206,7 @@ config RIONET_RX_SIZE - - config TUN - tristate "Universal TUN/TAP device driver support" -+ depends on INET - select CRC32 - ---help--- - TUN/TAP provides packet reception and transmission for user space -diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c -index 0c6adaaf898c..f30ceb17d5fc 100644 ---- a/drivers/net/macvtap.c -+++ b/drivers/net/macvtap.c -@@ -16,6 +16,7 @@ - #include <linux/idr.h> - #include <linux/fs.h> - -+#include <net/ipv6.h> - #include <net/net_namespace.h> - #include <net/rtnetlink.h> - #include <net/sock.h> -@@ -65,7 +66,7 @@ static struct cdev macvtap_cdev; - static const struct proto_ops macvtap_socket_ops; - - #define TUN_OFFLOADS (NETIF_F_HW_CSUM | NETIF_F_TSO_ECN | NETIF_F_TSO | \ -- NETIF_F_TSO6 | NETIF_F_UFO) -+ NETIF_F_TSO6) - #define RX_OFFLOADS (NETIF_F_GRO | NETIF_F_LRO) - #define TAP_FEATURES (NETIF_F_GSO | NETIF_F_SG) - -@@ -569,7 +570,11 @@ static int macvtap_skb_from_vnet_hdr(struct sk_buff *skb, - gso_type = SKB_GSO_TCPV6; - break; - case VIRTIO_NET_HDR_GSO_UDP: -+ pr_warn_once("macvtap: %s: using disabled UFO feature; please fix this program\n", -+ current->comm); - gso_type = SKB_GSO_UDP; -+ if (skb->protocol == htons(ETH_P_IPV6)) -+ ipv6_proxy_select_ident(skb); - break; - default: - return -EINVAL; -@@ -614,8 +619,6 @@ static void macvtap_skb_to_vnet_hdr(const struct sk_buff *skb, - vnet_hdr->gso_type = VIRTIO_NET_HDR_GSO_TCPV4; - else if (sinfo->gso_type & SKB_GSO_TCPV6) - vnet_hdr->gso_type = VIRTIO_NET_HDR_GSO_TCPV6; -- else if (sinfo->gso_type & SKB_GSO_UDP) -- vnet_hdr->gso_type = VIRTIO_NET_HDR_GSO_UDP; - else - BUG(); - if (sinfo->gso_type & SKB_GSO_TCP_ECN) -@@ -950,9 +953,6 @@ static int set_offload(struct macvtap_queue *q, unsigned long arg) - if (arg & TUN_F_TSO6) - feature_mask |= NETIF_F_TSO6; - } -- -- if (arg & TUN_F_UFO) -- feature_mask |= NETIF_F_UFO; - } - - /* tun/tap driver inverts the usage for TSO offloads, where -@@ -963,7 +963,7 @@ static int set_offload(struct macvtap_queue *q, unsigned long arg) - * When user space turns off TSO, we turn off GSO/LRO so that - * user-space will not receive TSO frames. - */ -- if (feature_mask & (NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_UFO)) -+ if (feature_mask & (NETIF_F_TSO | NETIF_F_TSO6)) - features |= RX_OFFLOADS; - else - features &= ~RX_OFFLOADS; -@@ -1064,7 +1064,7 @@ static long macvtap_ioctl(struct file *file, unsigned int cmd, - case TUNSETOFFLOAD: - /* let the user check for future flags */ - if (arg & ~(TUN_F_CSUM | TUN_F_TSO4 | TUN_F_TSO6 | -- TUN_F_TSO_ECN | TUN_F_UFO)) -+ TUN_F_TSO_ECN)) - return -EINVAL; - - rtnl_lock(); -diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c -index 72ff14b811c6..5a1897d86e94 100644 ---- a/drivers/net/ppp/ppp_generic.c -+++ b/drivers/net/ppp/ppp_generic.c -@@ -601,7 +601,7 @@ static long ppp_ioctl(struct file *file, unsigned int cmd, unsigned long arg) - if (file == ppp->owner) - ppp_shutdown_interface(ppp); - } -- if (atomic_long_read(&file->f_count) <= 2) { -+ if (atomic_long_read(&file->f_count) < 2) { - ppp_release(NULL, file); - err = 0; - } else -diff --git a/drivers/net/tun.c b/drivers/net/tun.c -index 26f8635b027d..2c8b1c21c452 100644 ---- a/drivers/net/tun.c -+++ b/drivers/net/tun.c -@@ -65,6 +65,7 @@ - #include <linux/nsproxy.h> - #include <linux/virtio_net.h> - #include <linux/rcupdate.h> -+#include <net/ipv6.h> - #include <net/net_namespace.h> - #include <net/netns/generic.h> - #include <net/rtnetlink.h> -@@ -174,7 +175,7 @@ struct tun_struct { - struct net_device *dev; - netdev_features_t set_features; - #define TUN_USER_FEATURES (NETIF_F_HW_CSUM|NETIF_F_TSO_ECN|NETIF_F_TSO| \ -- NETIF_F_TSO6|NETIF_F_UFO) -+ NETIF_F_TSO6) - - int vnet_hdr_sz; - int sndbuf; -@@ -1140,6 +1141,8 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile, - break; - } - -+ skb_reset_network_header(skb); -+ - if (gso.gso_type != VIRTIO_NET_HDR_GSO_NONE) { - pr_debug("GSO!\n"); - switch (gso.gso_type & ~VIRTIO_NET_HDR_GSO_ECN) { -@@ -1150,8 +1153,20 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile, - skb_shinfo(skb)->gso_type = SKB_GSO_TCPV6; - break; - case VIRTIO_NET_HDR_GSO_UDP: -+ { -+ static bool warned; -+ -+ if (!warned) { -+ warned = true; -+ netdev_warn(tun->dev, -+ "%s: using disabled UFO feature; please fix this program\n", -+ current->comm); -+ } - skb_shinfo(skb)->gso_type = SKB_GSO_UDP; -+ if (skb->protocol == htons(ETH_P_IPV6)) -+ ipv6_proxy_select_ident(skb); - break; -+ } - default: - tun->dev->stats.rx_frame_errors++; - kfree_skb(skb); -@@ -1180,7 +1195,6 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile, - skb_shinfo(skb)->tx_flags |= SKBTX_SHARED_FRAG; - } - -- skb_reset_network_header(skb); - skb_probe_transport_header(skb, 0); - - rxhash = skb_get_hash(skb); -@@ -1252,8 +1266,6 @@ static ssize_t tun_put_user(struct tun_struct *tun, - gso.gso_type = VIRTIO_NET_HDR_GSO_TCPV4; - else if (sinfo->gso_type & SKB_GSO_TCPV6) - gso.gso_type = VIRTIO_NET_HDR_GSO_TCPV6; -- else if (sinfo->gso_type & SKB_GSO_UDP) -- gso.gso_type = VIRTIO_NET_HDR_GSO_UDP; - else { - pr_err("unexpected GSO type: " - "0x%x, gso_size %d, hdr_len %d\n", -@@ -1783,11 +1795,6 @@ static int set_offload(struct tun_struct *tun, unsigned long arg) - features |= NETIF_F_TSO6; - arg &= ~(TUN_F_TSO4|TUN_F_TSO6); - } -- -- if (arg & TUN_F_UFO) { -- features |= NETIF_F_UFO; -- arg &= ~TUN_F_UFO; -- } - } - - /* This gives the user a way to test for new features in future by -diff --git a/drivers/net/usb/ax88179_178a.c b/drivers/net/usb/ax88179_178a.c -index 054e59ca6946..8cee173eefb2 100644 ---- a/drivers/net/usb/ax88179_178a.c -+++ b/drivers/net/usb/ax88179_178a.c -@@ -696,6 +696,7 @@ static int ax88179_set_mac_addr(struct net_device *net, void *p) - { - struct usbnet *dev = netdev_priv(net); - struct sockaddr *addr = p; -+ int ret; - - if (netif_running(net)) - return -EBUSY; -@@ -705,8 +706,12 @@ static int ax88179_set_mac_addr(struct net_device *net, void *p) - memcpy(net->dev_addr, addr->sa_data, ETH_ALEN); - - /* Set the MAC address */ -- return ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_NODE_ID, ETH_ALEN, -+ ret = ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_NODE_ID, ETH_ALEN, - ETH_ALEN, net->dev_addr); -+ if (ret < 0) -+ return ret; -+ -+ return 0; - } - - static const struct net_device_ops ax88179_netdev_ops = { -diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c -index 841b60831df1..07a3255fd3cc 100644 ---- a/drivers/net/virtio_net.c -+++ b/drivers/net/virtio_net.c -@@ -496,8 +496,17 @@ static void receive_buf(struct receive_queue *rq, void *buf, unsigned int len) - skb_shinfo(skb)->gso_type = SKB_GSO_TCPV4; - break; - case VIRTIO_NET_HDR_GSO_UDP: -+ { -+ static bool warned; -+ -+ if (!warned) { -+ warned = true; -+ netdev_warn(dev, -+ "host using disabled UFO feature; please fix it\n"); -+ } - skb_shinfo(skb)->gso_type = SKB_GSO_UDP; - break; -+ } - case VIRTIO_NET_HDR_GSO_TCPV6: - skb_shinfo(skb)->gso_type = SKB_GSO_TCPV6; - break; -@@ -836,8 +845,6 @@ static int xmit_skb(struct send_queue *sq, struct sk_buff *skb) - hdr->hdr.gso_type = VIRTIO_NET_HDR_GSO_TCPV4; - else if (skb_shinfo(skb)->gso_type & SKB_GSO_TCPV6) - hdr->hdr.gso_type = VIRTIO_NET_HDR_GSO_TCPV6; -- else if (skb_shinfo(skb)->gso_type & SKB_GSO_UDP) -- hdr->hdr.gso_type = VIRTIO_NET_HDR_GSO_UDP; - else - BUG(); - if (skb_shinfo(skb)->gso_type & SKB_GSO_TCP_ECN) -@@ -1657,7 +1664,7 @@ static int virtnet_probe(struct virtio_device *vdev) - dev->features |= NETIF_F_HW_CSUM|NETIF_F_SG|NETIF_F_FRAGLIST; - - if (virtio_has_feature(vdev, VIRTIO_NET_F_GSO)) { -- dev->hw_features |= NETIF_F_TSO | NETIF_F_UFO -+ dev->hw_features |= NETIF_F_TSO - | NETIF_F_TSO_ECN | NETIF_F_TSO6; - } - /* Individual feature bits: what can host handle? */ -@@ -1667,11 +1674,9 @@ static int virtnet_probe(struct virtio_device *vdev) - dev->hw_features |= NETIF_F_TSO6; - if (virtio_has_feature(vdev, VIRTIO_NET_F_HOST_ECN)) - dev->hw_features |= NETIF_F_TSO_ECN; -- if (virtio_has_feature(vdev, VIRTIO_NET_F_HOST_UFO)) -- dev->hw_features |= NETIF_F_UFO; - - if (gso) -- dev->features |= dev->hw_features & (NETIF_F_ALL_TSO|NETIF_F_UFO); -+ dev->features |= dev->hw_features & NETIF_F_ALL_TSO; - /* (!csum && gso) case will be fixed by register_netdev() */ - } - if (virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_CSUM)) -@@ -1711,8 +1716,7 @@ static int virtnet_probe(struct virtio_device *vdev) - /* If we can receive ANY GSO packets, we must allocate large ones. */ - if (virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_TSO4) || - virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_TSO6) || -- virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_ECN) || -- virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_UFO)) -+ virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_ECN)) - vi->big_packets = true; - - if (virtio_has_feature(vdev, VIRTIO_NET_F_MRG_RXBUF)) -@@ -1903,9 +1907,9 @@ static struct virtio_device_id id_table[] = { - static unsigned int features[] = { - VIRTIO_NET_F_CSUM, VIRTIO_NET_F_GUEST_CSUM, - VIRTIO_NET_F_GSO, VIRTIO_NET_F_MAC, -- VIRTIO_NET_F_HOST_TSO4, VIRTIO_NET_F_HOST_UFO, VIRTIO_NET_F_HOST_TSO6, -+ VIRTIO_NET_F_HOST_TSO4, VIRTIO_NET_F_HOST_TSO6, - VIRTIO_NET_F_HOST_ECN, VIRTIO_NET_F_GUEST_TSO4, VIRTIO_NET_F_GUEST_TSO6, -- VIRTIO_NET_F_GUEST_ECN, VIRTIO_NET_F_GUEST_UFO, -+ VIRTIO_NET_F_GUEST_ECN, - VIRTIO_NET_F_MRG_RXBUF, VIRTIO_NET_F_STATUS, VIRTIO_NET_F_CTRL_VQ, - VIRTIO_NET_F_CTRL_RX, VIRTIO_NET_F_CTRL_VLAN, - VIRTIO_NET_F_GUEST_ANNOUNCE, VIRTIO_NET_F_MQ, -diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c -index 9b40532041cb..0704a0402897 100644 ---- a/drivers/net/vxlan.c -+++ b/drivers/net/vxlan.c -@@ -1447,9 +1447,6 @@ static int neigh_reduce(struct net_device *dev, struct sk_buff *skb) - if (!in6_dev) - goto out; - -- if (!pskb_may_pull(skb, skb->len)) -- goto out; -- - iphdr = ipv6_hdr(skb); - saddr = &iphdr->saddr; - daddr = &iphdr->daddr; -@@ -1770,6 +1767,8 @@ static void vxlan_encap_bypass(struct sk_buff *skb, struct vxlan_dev *src_vxlan, - struct pcpu_sw_netstats *tx_stats, *rx_stats; - union vxlan_addr loopback; - union vxlan_addr *remote_ip = &dst_vxlan->default_dst.remote_ip; -+ struct net_device *dev = skb->dev; -+ int len = skb->len; - - tx_stats = this_cpu_ptr(src_vxlan->dev->tstats); - rx_stats = this_cpu_ptr(dst_vxlan->dev->tstats); -@@ -1793,16 +1792,16 @@ static void vxlan_encap_bypass(struct sk_buff *skb, struct vxlan_dev *src_vxlan, - - u64_stats_update_begin(&tx_stats->syncp); - tx_stats->tx_packets++; -- tx_stats->tx_bytes += skb->len; -+ tx_stats->tx_bytes += len; - u64_stats_update_end(&tx_stats->syncp); - - if (netif_rx(skb) == NET_RX_SUCCESS) { - u64_stats_update_begin(&rx_stats->syncp); - rx_stats->rx_packets++; -- rx_stats->rx_bytes += skb->len; -+ rx_stats->rx_bytes += len; - u64_stats_update_end(&rx_stats->syncp); - } else { -- skb->dev->stats.rx_dropped++; -+ dev->stats.rx_dropped++; - } - } - -@@ -1977,7 +1976,8 @@ static netdev_tx_t vxlan_xmit(struct sk_buff *skb, struct net_device *dev) - return arp_reduce(dev, skb); - #if IS_ENABLED(CONFIG_IPV6) - else if (ntohs(eth->h_proto) == ETH_P_IPV6 && -- skb->len >= sizeof(struct ipv6hdr) + sizeof(struct nd_msg) && -+ pskb_may_pull(skb, sizeof(struct ipv6hdr) -+ + sizeof(struct nd_msg)) && - ipv6_hdr(skb)->nexthdr == IPPROTO_ICMPV6) { - struct nd_msg *msg; - -@@ -1986,6 +1986,7 @@ static netdev_tx_t vxlan_xmit(struct sk_buff *skb, struct net_device *dev) - msg->icmph.icmp6_type == NDISC_NEIGHBOUR_SOLICITATION) - return neigh_reduce(dev, skb); - } -+ eth = eth_hdr(skb); - #endif - } - -diff --git a/drivers/net/wireless/iwlwifi/mvm/tx.c b/drivers/net/wireless/iwlwifi/mvm/tx.c -index 2ca62af3f81b..76ee486039d7 100644 ---- a/drivers/net/wireless/iwlwifi/mvm/tx.c -+++ b/drivers/net/wireless/iwlwifi/mvm/tx.c -@@ -173,14 +173,10 @@ static void iwl_mvm_set_tx_cmd_rate(struct iwl_mvm *mvm, - - /* - * for data packets, rate info comes from the table inside the fw. This -- * table is controlled by LINK_QUALITY commands. Exclude ctrl port -- * frames like EAPOLs which should be treated as mgmt frames. This -- * avoids them being sent initially in high rates which increases the -- * chances for completion of the 4-Way handshake. -+ * table is controlled by LINK_QUALITY commands - */ - -- if (ieee80211_is_data(fc) && sta && -- !(info->control.flags & IEEE80211_TX_CTRL_PORT_CTRL_PROTO)) { -+ if (ieee80211_is_data(fc) && sta) { - tx_cmd->initial_rate_index = 0; - tx_cmd->tx_flags |= cpu_to_le32(TX_CMD_FLG_STA_RATE); - return; -diff --git a/drivers/net/wireless/rt2x00/rt2800.h b/drivers/net/wireless/rt2x00/rt2800.h -index 7cf6081a05a1..ebd5625d13f1 100644 ---- a/drivers/net/wireless/rt2x00/rt2800.h -+++ b/drivers/net/wireless/rt2x00/rt2800.h -@@ -52,6 +52,7 @@ - * RF5592 2.4G/5G 2T2R - * RF3070 2.4G 1T1R - * RF5360 2.4G 1T1R -+ * RF5362 2.4G 1T1R - * RF5370 2.4G 1T1R - * RF5390 2.4G 1T1R - */ -@@ -72,6 +73,7 @@ - #define RF3070 0x3070 - #define RF3290 0x3290 - #define RF5360 0x5360 -+#define RF5362 0x5362 - #define RF5370 0x5370 - #define RF5372 0x5372 - #define RF5390 0x5390 -@@ -2145,7 +2147,7 @@ struct mac_iveiv_entry { - /* Bits [7-4] for RF3320 (RT3370/RT3390), on other chipsets reserved */ - #define RFCSR3_PA1_BIAS_CCK FIELD8(0x70) - #define RFCSR3_PA2_CASCODE_BIAS_CCKK FIELD8(0x80) --/* Bits for RF3290/RF5360/RF5370/RF5372/RF5390/RF5392 */ -+/* Bits for RF3290/RF5360/RF5362/RF5370/RF5372/RF5390/RF5392 */ - #define RFCSR3_VCOCAL_EN FIELD8(0x80) - /* Bits for RF3050 */ - #define RFCSR3_BIT1 FIELD8(0x02) -diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c -index 41d4a8167dc3..4e16d4da9d82 100644 ---- a/drivers/net/wireless/rt2x00/rt2800lib.c -+++ b/drivers/net/wireless/rt2x00/rt2800lib.c -@@ -3142,6 +3142,7 @@ static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev, - break; - case RF3070: - case RF5360: -+ case RF5362: - case RF5370: - case RF5372: - case RF5390: -@@ -3159,6 +3160,7 @@ static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev, - rt2x00_rf(rt2x00dev, RF3290) || - rt2x00_rf(rt2x00dev, RF3322) || - rt2x00_rf(rt2x00dev, RF5360) || -+ rt2x00_rf(rt2x00dev, RF5362) || - rt2x00_rf(rt2x00dev, RF5370) || - rt2x00_rf(rt2x00dev, RF5372) || - rt2x00_rf(rt2x00dev, RF5390) || -@@ -4273,6 +4275,7 @@ void rt2800_vco_calibration(struct rt2x00_dev *rt2x00dev) - case RF3070: - case RF3290: - case RF5360: -+ case RF5362: - case RF5370: - case RF5372: - case RF5390: -@@ -7073,6 +7076,7 @@ static int rt2800_init_eeprom(struct rt2x00_dev *rt2x00dev) - case RF3320: - case RF3322: - case RF5360: -+ case RF5362: - case RF5370: - case RF5372: - case RF5390: -@@ -7529,6 +7533,7 @@ static int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev) - case RF3320: - case RF3322: - case RF5360: -+ case RF5362: - case RF5370: - case RF5372: - case RF5390: -@@ -7658,6 +7663,7 @@ static int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev) - case RF3070: - case RF3290: - case RF5360: -+ case RF5362: - case RF5370: - case RF5372: - case RF5390: -diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c -index caddc1b427a9..57d3967de32f 100644 ---- a/drivers/net/wireless/rt2x00/rt2800usb.c -+++ b/drivers/net/wireless/rt2x00/rt2800usb.c -@@ -1062,6 +1062,7 @@ static struct usb_device_id rt2800usb_device_table[] = { - /* Ovislink */ - { USB_DEVICE(0x1b75, 0x3071) }, - { USB_DEVICE(0x1b75, 0x3072) }, -+ { USB_DEVICE(0x1b75, 0xa200) }, - /* Para */ - { USB_DEVICE(0x20b8, 0x8888) }, - /* Pegatron */ -@@ -1235,6 +1236,8 @@ static struct usb_device_id rt2800usb_device_table[] = { - /* Arcadyan */ - { USB_DEVICE(0x043e, 0x7a12) }, - { USB_DEVICE(0x043e, 0x7a32) }, -+ /* ASUS */ -+ { USB_DEVICE(0x0b05, 0x17e8) }, - /* Azurewave */ - { USB_DEVICE(0x13d3, 0x3329) }, - { USB_DEVICE(0x13d3, 0x3365) }, -@@ -1271,6 +1274,7 @@ static struct usb_device_id rt2800usb_device_table[] = { - { USB_DEVICE(0x057c, 0x8501) }, - /* Buffalo */ - { USB_DEVICE(0x0411, 0x0241) }, -+ { USB_DEVICE(0x0411, 0x0253) }, - /* D-Link */ - { USB_DEVICE(0x2001, 0x3c1a) }, - { USB_DEVICE(0x2001, 0x3c21) }, -@@ -1361,6 +1365,7 @@ static struct usb_device_id rt2800usb_device_table[] = { - { USB_DEVICE(0x0df6, 0x0053) }, - { USB_DEVICE(0x0df6, 0x0069) }, - { USB_DEVICE(0x0df6, 0x006f) }, -+ { USB_DEVICE(0x0df6, 0x0078) }, - /* SMC */ - { USB_DEVICE(0x083a, 0xa512) }, - { USB_DEVICE(0x083a, 0xc522) }, -diff --git a/drivers/of/base.c b/drivers/of/base.c -index 89e888a78899..3935614274eb 100644 ---- a/drivers/of/base.c -+++ b/drivers/of/base.c -@@ -1117,52 +1117,6 @@ int of_property_read_string(struct device_node *np, const char *propname, - EXPORT_SYMBOL_GPL(of_property_read_string); - - /** -- * of_property_read_string_index - Find and read a string from a multiple -- * strings property. -- * @np: device node from which the property value is to be read. -- * @propname: name of the property to be searched. -- * @index: index of the string in the list of strings -- * @out_string: pointer to null terminated return string, modified only if -- * return value is 0. -- * -- * Search for a property in a device tree node and retrieve a null -- * terminated string value (pointer to data, not a copy) in the list of strings -- * contained in that property. -- * Returns 0 on success, -EINVAL if the property does not exist, -ENODATA if -- * property does not have a value, and -EILSEQ if the string is not -- * null-terminated within the length of the property data. -- * -- * The out_string pointer is modified only if a valid string can be decoded. -- */ --int of_property_read_string_index(struct device_node *np, const char *propname, -- int index, const char **output) --{ -- struct property *prop = of_find_property(np, propname, NULL); -- int i = 0; -- size_t l = 0, total = 0; -- const char *p; -- -- if (!prop) -- return -EINVAL; -- if (!prop->value) -- return -ENODATA; -- if (strnlen(prop->value, prop->length) >= prop->length) -- return -EILSEQ; -- -- p = prop->value; -- -- for (i = 0; total < prop->length; total += l, p += l) { -- l = strlen(p) + 1; -- if (i++ == index) { -- *output = p; -- return 0; -- } -- } -- return -ENODATA; --} --EXPORT_SYMBOL_GPL(of_property_read_string_index); -- --/** - * of_property_match_string() - Find string in a list and return index - * @np: pointer to node containing string list property - * @propname: string list property name -@@ -1188,7 +1142,7 @@ int of_property_match_string(struct device_node *np, const char *propname, - end = p + prop->length; - - for (i = 0; p < end; i++, p += l) { -- l = strlen(p) + 1; -+ l = strnlen(p, end - p) + 1; - if (p + l > end) - return -EILSEQ; - pr_debug("comparing %s with %s\n", string, p); -@@ -1200,39 +1154,41 @@ int of_property_match_string(struct device_node *np, const char *propname, - EXPORT_SYMBOL_GPL(of_property_match_string); - - /** -- * of_property_count_strings - Find and return the number of strings from a -- * multiple strings property. -+ * of_property_read_string_util() - Utility helper for parsing string properties - * @np: device node from which the property value is to be read. - * @propname: name of the property to be searched. -+ * @out_strs: output array of string pointers. -+ * @sz: number of array elements to read. -+ * @skip: Number of strings to skip over at beginning of list. - * -- * Search for a property in a device tree node and retrieve the number of null -- * terminated string contain in it. Returns the number of strings on -- * success, -EINVAL if the property does not exist, -ENODATA if property -- * does not have a value, and -EILSEQ if the string is not null-terminated -- * within the length of the property data. -+ * Don't call this function directly. It is a utility helper for the -+ * of_property_read_string*() family of functions. - */ --int of_property_count_strings(struct device_node *np, const char *propname) -+int of_property_read_string_helper(struct device_node *np, const char *propname, -+ const char **out_strs, size_t sz, int skip) - { - struct property *prop = of_find_property(np, propname, NULL); -- int i = 0; -- size_t l = 0, total = 0; -- const char *p; -+ int l = 0, i = 0; -+ const char *p, *end; - - if (!prop) - return -EINVAL; - if (!prop->value) - return -ENODATA; -- if (strnlen(prop->value, prop->length) >= prop->length) -- return -EILSEQ; -- - p = prop->value; -+ end = p + prop->length; - -- for (i = 0; total < prop->length; total += l, p += l, i++) -- l = strlen(p) + 1; -- -- return i; -+ for (i = 0; p < end && (!out_strs || i < skip + sz); i++, p += l) { -+ l = strnlen(p, end - p) + 1; -+ if (p + l > end) -+ return -EILSEQ; -+ if (out_strs && i >= skip) -+ *out_strs++ = p; -+ } -+ i -= skip; -+ return i <= 0 ? -ENODATA : i; - } --EXPORT_SYMBOL_GPL(of_property_count_strings); -+EXPORT_SYMBOL_GPL(of_property_read_string_helper); - - void of_print_phandle_args(const char *msg, const struct of_phandle_args *args) - { -diff --git a/drivers/of/selftest.c b/drivers/of/selftest.c -index 6643d1920985..70c61d75b75e 100644 ---- a/drivers/of/selftest.c -+++ b/drivers/of/selftest.c -@@ -132,8 +132,9 @@ static void __init of_selftest_parse_phandle_with_args(void) - selftest(rc == -EINVAL, "expected:%i got:%i\n", -EINVAL, rc); - } - --static void __init of_selftest_property_match_string(void) -+static void __init of_selftest_property_string(void) - { -+ const char *strings[4]; - struct device_node *np; - int rc; - -@@ -150,13 +151,66 @@ static void __init of_selftest_property_match_string(void) - rc = of_property_match_string(np, "phandle-list-names", "third"); - selftest(rc == 2, "third expected:0 got:%i\n", rc); - rc = of_property_match_string(np, "phandle-list-names", "fourth"); -- selftest(rc == -ENODATA, "unmatched string; rc=%i", rc); -+ selftest(rc == -ENODATA, "unmatched string; rc=%i\n", rc); - rc = of_property_match_string(np, "missing-property", "blah"); -- selftest(rc == -EINVAL, "missing property; rc=%i", rc); -+ selftest(rc == -EINVAL, "missing property; rc=%i\n", rc); - rc = of_property_match_string(np, "empty-property", "blah"); -- selftest(rc == -ENODATA, "empty property; rc=%i", rc); -+ selftest(rc == -ENODATA, "empty property; rc=%i\n", rc); - rc = of_property_match_string(np, "unterminated-string", "blah"); -- selftest(rc == -EILSEQ, "unterminated string; rc=%i", rc); -+ selftest(rc == -EILSEQ, "unterminated string; rc=%i\n", rc); -+ -+ /* of_property_count_strings() tests */ -+ rc = of_property_count_strings(np, "string-property"); -+ selftest(rc == 1, "Incorrect string count; rc=%i\n", rc); -+ rc = of_property_count_strings(np, "phandle-list-names"); -+ selftest(rc == 3, "Incorrect string count; rc=%i\n", rc); -+ rc = of_property_count_strings(np, "unterminated-string"); -+ selftest(rc == -EILSEQ, "unterminated string; rc=%i\n", rc); -+ rc = of_property_count_strings(np, "unterminated-string-list"); -+ selftest(rc == -EILSEQ, "unterminated string array; rc=%i\n", rc); -+ -+ /* of_property_read_string_index() tests */ -+ rc = of_property_read_string_index(np, "string-property", 0, strings); -+ selftest(rc == 0 && !strcmp(strings[0], "foobar"), "of_property_read_string_index() failure; rc=%i\n", rc); -+ strings[0] = NULL; -+ rc = of_property_read_string_index(np, "string-property", 1, strings); -+ selftest(rc == -ENODATA && strings[0] == NULL, "of_property_read_string_index() failure; rc=%i\n", rc); -+ rc = of_property_read_string_index(np, "phandle-list-names", 0, strings); -+ selftest(rc == 0 && !strcmp(strings[0], "first"), "of_property_read_string_index() failure; rc=%i\n", rc); -+ rc = of_property_read_string_index(np, "phandle-list-names", 1, strings); -+ selftest(rc == 0 && !strcmp(strings[0], "second"), "of_property_read_string_index() failure; rc=%i\n", rc); -+ rc = of_property_read_string_index(np, "phandle-list-names", 2, strings); -+ selftest(rc == 0 && !strcmp(strings[0], "third"), "of_property_read_string_index() failure; rc=%i\n", rc); -+ strings[0] = NULL; -+ rc = of_property_read_string_index(np, "phandle-list-names", 3, strings); -+ selftest(rc == -ENODATA && strings[0] == NULL, "of_property_read_string_index() failure; rc=%i\n", rc); -+ strings[0] = NULL; -+ rc = of_property_read_string_index(np, "unterminated-string", 0, strings); -+ selftest(rc == -EILSEQ && strings[0] == NULL, "of_property_read_string_index() failure; rc=%i\n", rc); -+ rc = of_property_read_string_index(np, "unterminated-string-list", 0, strings); -+ selftest(rc == 0 && !strcmp(strings[0], "first"), "of_property_read_string_index() failure; rc=%i\n", rc); -+ strings[0] = NULL; -+ rc = of_property_read_string_index(np, "unterminated-string-list", 2, strings); /* should fail */ -+ selftest(rc == -EILSEQ && strings[0] == NULL, "of_property_read_string_index() failure; rc=%i\n", rc); -+ strings[1] = NULL; -+ -+ /* of_property_read_string_array() tests */ -+ rc = of_property_read_string_array(np, "string-property", strings, 4); -+ selftest(rc == 1, "Incorrect string count; rc=%i\n", rc); -+ rc = of_property_read_string_array(np, "phandle-list-names", strings, 4); -+ selftest(rc == 3, "Incorrect string count; rc=%i\n", rc); -+ rc = of_property_read_string_array(np, "unterminated-string", strings, 4); -+ selftest(rc == -EILSEQ, "unterminated string; rc=%i\n", rc); -+ /* -- An incorrectly formed string should cause a failure */ -+ rc = of_property_read_string_array(np, "unterminated-string-list", strings, 4); -+ selftest(rc == -EILSEQ, "unterminated string array; rc=%i\n", rc); -+ /* -- parsing the correctly formed strings should still work: */ -+ strings[2] = NULL; -+ rc = of_property_read_string_array(np, "unterminated-string-list", strings, 2); -+ selftest(rc == 2 && strings[2] == NULL, "of_property_read_string_array() failure; rc=%i\n", rc); -+ strings[1] = NULL; -+ rc = of_property_read_string_array(np, "phandle-list-names", strings, 1); -+ selftest(rc == 1 && strings[1] == NULL, "Overwrote end of string array; rc=%i, str='%s'\n", rc, strings[1]); - } - - static void __init of_selftest_parse_interrupts(void) -@@ -379,7 +433,7 @@ static int __init of_selftest(void) - - pr_info("start of selftest - you will see error messages\n"); - of_selftest_parse_phandle_with_args(); -- of_selftest_property_match_string(); -+ of_selftest_property_string(); - of_selftest_parse_interrupts(); - of_selftest_parse_interrupts_extended(); - of_selftest_match_node(); -diff --git a/drivers/of/testcase-data/tests-phandle.dtsi b/drivers/of/testcase-data/tests-phandle.dtsi -index 0007d3cd7dc2..eedee37d70d7 100644 ---- a/drivers/of/testcase-data/tests-phandle.dtsi -+++ b/drivers/of/testcase-data/tests-phandle.dtsi -@@ -32,7 +32,9 @@ - phandle-list-bad-args = <&provider2 1 0>, - <&provider3 0>; - empty-property; -+ string-property = "foobar"; - unterminated-string = [40 41 42 43]; -+ unterminated-string-list = "first", "second", [40 41 42 43]; - }; - }; - }; -diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c -index 39a207abaa10..a943c6c0f206 100644 ---- a/drivers/pci/pci-sysfs.c -+++ b/drivers/pci/pci-sysfs.c -@@ -186,9 +186,9 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *attr, - } - static DEVICE_ATTR_RO(modalias); - --static ssize_t enabled_store(struct device *dev, -- struct device_attribute *attr, const char *buf, -- size_t count) -+static ssize_t enable_store(struct device *dev, -+ struct device_attribute *attr, const char *buf, -+ size_t count) - { - struct pci_dev *pdev = to_pci_dev(dev); - unsigned long val; -@@ -212,15 +212,15 @@ static ssize_t enabled_store(struct device *dev, - return result < 0 ? result : count; - } - --static ssize_t enabled_show(struct device *dev, -- struct device_attribute *attr, char *buf) -+static ssize_t enable_show(struct device *dev, -+ struct device_attribute *attr, char *buf) - { - struct pci_dev *pdev; - - pdev = to_pci_dev (dev); - return sprintf (buf, "%u\n", atomic_read(&pdev->enable_cnt)); - } --static DEVICE_ATTR_RW(enabled); -+static DEVICE_ATTR_RW(enable); - - #ifdef CONFIG_NUMA - static ssize_t -@@ -526,7 +526,7 @@ static struct attribute *pci_dev_attrs[] = { - #endif - &dev_attr_dma_mask_bits.attr, - &dev_attr_consistent_dma_mask_bits.attr, -- &dev_attr_enabled.attr, -+ &dev_attr_enable.attr, - &dev_attr_broken_parity_status.attr, - &dev_attr_msi_bus.attr, - #if defined(CONFIG_PM_RUNTIME) && defined(CONFIG_ACPI) -diff --git a/drivers/pinctrl/pinctrl-baytrail.c b/drivers/pinctrl/pinctrl-baytrail.c -index 665b96bc0c3a..eb9f1906952a 100644 ---- a/drivers/pinctrl/pinctrl-baytrail.c -+++ b/drivers/pinctrl/pinctrl-baytrail.c -@@ -263,7 +263,7 @@ static int byt_gpio_direction_output(struct gpio_chip *chip, - spin_lock_irqsave(&vg->lock, flags); - - reg_val = readl(reg) | BYT_DIR_MASK; -- reg_val &= ~BYT_OUTPUT_EN; -+ reg_val &= ~(BYT_OUTPUT_EN | BYT_INPUT_EN); - - if (value) - writel(reg_val | BYT_LEVEL, reg); -diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c -index c91f69b39db4..dcfcaea76048 100644 ---- a/drivers/platform/x86/acer-wmi.c -+++ b/drivers/platform/x86/acer-wmi.c -@@ -570,6 +570,17 @@ static const struct dmi_system_id video_vendor_dmi_table[] = { - DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5750"), - }, - }, -+ { -+ /* -+ * Note no video_set_backlight_video_vendor, we must use the -+ * acer interface, as there is no native backlight interface. -+ */ -+ .ident = "Acer KAV80", -+ .matches = { -+ DMI_MATCH(DMI_SYS_VENDOR, "Acer"), -+ DMI_MATCH(DMI_PRODUCT_NAME, "KAV80"), -+ }, -+ }, - {} - }; - -diff --git a/drivers/power/charger-manager.c b/drivers/power/charger-manager.c -index 9e4dab46eefd..ef1f4c928431 100644 ---- a/drivers/power/charger-manager.c -+++ b/drivers/power/charger-manager.c -@@ -1720,6 +1720,11 @@ static int charger_manager_probe(struct platform_device *pdev) - return -EINVAL; - } - -+ if (!desc->psy_fuel_gauge) { -+ dev_err(&pdev->dev, "No fuel gauge power supply defined\n"); -+ return -EINVAL; -+ } -+ - /* Counting index only */ - while (desc->psy_charger_stat[i]) - i++; -diff --git a/drivers/regulator/max77693.c b/drivers/regulator/max77693.c -index 5fb899f461d0..24c926bfe6d4 100644 ---- a/drivers/regulator/max77693.c -+++ b/drivers/regulator/max77693.c -@@ -232,7 +232,7 @@ static int max77693_pmic_probe(struct platform_device *pdev) - struct max77693_pmic_dev *max77693_pmic; - struct max77693_regulator_data *rdata = NULL; - int num_rdata, i; -- struct regulator_config config; -+ struct regulator_config config = { }; - - num_rdata = max77693_pmic_init_rdata(&pdev->dev, &rdata); - if (!rdata || num_rdata <= 0) { -diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.c b/drivers/scsi/qla2xxx/tcm_qla2xxx.c -index 788c4fe2b0c9..9d81f7693f99 100644 ---- a/drivers/scsi/qla2xxx/tcm_qla2xxx.c -+++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.c -@@ -707,7 +707,16 @@ static void tcm_qla2xxx_clear_nacl_from_fcport_map(struct qla_tgt_sess *sess) - pr_debug("fc_rport domain: port_id 0x%06x\n", nacl->nport_id); - - node = btree_remove32(&lport->lport_fcport_map, nacl->nport_id); -- WARN_ON(node && (node != se_nacl)); -+ if (WARN_ON(node && (node != se_nacl))) { -+ /* -+ * The nacl no longer matches what we think it should be. -+ * Most likely a new dynamic acl has been added while -+ * someone dropped the hardware lock. It clearly is a -+ * bug elsewhere, but this bit can't make things worse. -+ */ -+ btree_insert32(&lport->lport_fcport_map, nacl->nport_id, -+ node, GFP_ATOMIC); -+ } - - pr_debug("Removed from fcport_map: %p for WWNN: 0x%016LX, port_id: 0x%06x\n", - se_nacl, nacl->nport_wwnn, nacl->nport_id); -diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c -index a25392065d9b..a5db6f930fa3 100644 ---- a/drivers/spi/spi-fsl-dspi.c -+++ b/drivers/spi/spi-fsl-dspi.c -@@ -45,7 +45,7 @@ - - #define SPI_TCR 0x08 - --#define SPI_CTAR(x) (0x0c + (x * 4)) -+#define SPI_CTAR(x) (0x0c + (((x) & 0x3) * 4)) - #define SPI_CTAR_FMSZ(x) (((x) & 0x0000000f) << 27) - #define SPI_CTAR_CPOL(x) ((x) << 26) - #define SPI_CTAR_CPHA(x) ((x) << 25) -@@ -69,7 +69,7 @@ - - #define SPI_PUSHR 0x34 - #define SPI_PUSHR_CONT (1 << 31) --#define SPI_PUSHR_CTAS(x) (((x) & 0x00000007) << 28) -+#define SPI_PUSHR_CTAS(x) (((x) & 0x00000003) << 28) - #define SPI_PUSHR_EOQ (1 << 27) - #define SPI_PUSHR_CTCNT (1 << 26) - #define SPI_PUSHR_PCS(x) (((1 << x) & 0x0000003f) << 16) -diff --git a/drivers/spi/spi-pl022.c b/drivers/spi/spi-pl022.c -index 2789b452e711..971855e859c7 100644 ---- a/drivers/spi/spi-pl022.c -+++ b/drivers/spi/spi-pl022.c -@@ -1075,7 +1075,7 @@ err_rxdesc: - pl022->sgt_tx.nents, DMA_TO_DEVICE); - err_tx_sgmap: - dma_unmap_sg(rxchan->device->dev, pl022->sgt_rx.sgl, -- pl022->sgt_tx.nents, DMA_FROM_DEVICE); -+ pl022->sgt_rx.nents, DMA_FROM_DEVICE); - err_rx_sgmap: - sg_free_table(&pl022->sgt_tx); - err_alloc_tx_sg: -diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c -index ced9ecffa163..7ab3ccb592eb 100644 ---- a/drivers/spi/spi-pxa2xx.c -+++ b/drivers/spi/spi-pxa2xx.c -@@ -1280,7 +1280,9 @@ static int pxa2xx_spi_suspend(struct device *dev) - if (status != 0) - return status; - write_SSCR0(0, drv_data->ioaddr); -- clk_disable_unprepare(ssp->clk); -+ -+ if (!pm_runtime_suspended(dev)) -+ clk_disable_unprepare(ssp->clk); - - return 0; - } -@@ -1294,7 +1296,8 @@ static int pxa2xx_spi_resume(struct device *dev) - pxa2xx_spi_dma_resume(drv_data); - - /* Enable the SSP clock */ -- clk_prepare_enable(ssp->clk); -+ if (!pm_runtime_suspended(dev)) -+ clk_prepare_enable(ssp->clk); - - /* Restore LPSS private register bits */ - lpss_ssp_setup(drv_data); -diff --git a/drivers/staging/iio/impedance-analyzer/ad5933.c b/drivers/staging/iio/impedance-analyzer/ad5933.c -index 2b96665da8a2..97d4b3fb7e95 100644 ---- a/drivers/staging/iio/impedance-analyzer/ad5933.c -+++ b/drivers/staging/iio/impedance-analyzer/ad5933.c -@@ -115,6 +115,7 @@ static const struct iio_chan_spec ad5933_channels[] = { - .channel = 0, - .info_mask_separate = BIT(IIO_CHAN_INFO_PROCESSED), - .address = AD5933_REG_TEMP_DATA, -+ .scan_index = -1, - .scan_type = { - .sign = 's', - .realbits = 14, -@@ -124,9 +125,7 @@ static const struct iio_chan_spec ad5933_channels[] = { - .type = IIO_VOLTAGE, - .indexed = 1, - .channel = 0, -- .extend_name = "real_raw", -- .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | -- BIT(IIO_CHAN_INFO_SCALE), -+ .extend_name = "real", - .address = AD5933_REG_REAL_DATA, - .scan_index = 0, - .scan_type = { -@@ -138,9 +137,7 @@ static const struct iio_chan_spec ad5933_channels[] = { - .type = IIO_VOLTAGE, - .indexed = 1, - .channel = 0, -- .extend_name = "imag_raw", -- .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | -- BIT(IIO_CHAN_INFO_SCALE), -+ .extend_name = "imag", - .address = AD5933_REG_IMAG_DATA, - .scan_index = 1, - .scan_type = { -@@ -748,14 +745,14 @@ static int ad5933_probe(struct i2c_client *client, - indio_dev->name = id->name; - indio_dev->modes = INDIO_DIRECT_MODE; - indio_dev->channels = ad5933_channels; -- indio_dev->num_channels = 1; /* only register temp0_input */ -+ indio_dev->num_channels = ARRAY_SIZE(ad5933_channels); - - ret = ad5933_register_ring_funcs_and_init(indio_dev); - if (ret) - goto error_disable_reg; - -- /* skip temp0_input, register in0_(real|imag)_raw */ -- ret = iio_buffer_register(indio_dev, &ad5933_channels[1], 2); -+ ret = iio_buffer_register(indio_dev, ad5933_channels, -+ ARRAY_SIZE(ad5933_channels)); - if (ret) - goto error_unreg_ring; - -diff --git a/drivers/staging/iio/meter/ade7758.h b/drivers/staging/iio/meter/ade7758.h -index 07318203a836..e8c98cf57070 100644 ---- a/drivers/staging/iio/meter/ade7758.h -+++ b/drivers/staging/iio/meter/ade7758.h -@@ -119,7 +119,6 @@ struct ade7758_state { - u8 *tx; - u8 *rx; - struct mutex buf_lock; -- const struct iio_chan_spec *ade7758_ring_channels; - struct spi_transfer ring_xfer[4]; - struct spi_message ring_msg; - /* -diff --git a/drivers/staging/iio/meter/ade7758_core.c b/drivers/staging/iio/meter/ade7758_core.c -index cba183e24838..94d9914a602c 100644 ---- a/drivers/staging/iio/meter/ade7758_core.c -+++ b/drivers/staging/iio/meter/ade7758_core.c -@@ -630,9 +630,6 @@ static const struct iio_chan_spec ade7758_channels[] = { - .type = IIO_VOLTAGE, - .indexed = 1, - .channel = 0, -- .extend_name = "raw", -- .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), -- .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), - .address = AD7758_WT(AD7758_PHASE_A, AD7758_VOLTAGE), - .scan_index = 0, - .scan_type = { -@@ -644,9 +641,6 @@ static const struct iio_chan_spec ade7758_channels[] = { - .type = IIO_CURRENT, - .indexed = 1, - .channel = 0, -- .extend_name = "raw", -- .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), -- .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), - .address = AD7758_WT(AD7758_PHASE_A, AD7758_CURRENT), - .scan_index = 1, - .scan_type = { -@@ -658,9 +652,7 @@ static const struct iio_chan_spec ade7758_channels[] = { - .type = IIO_POWER, - .indexed = 1, - .channel = 0, -- .extend_name = "apparent_raw", -- .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), -- .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), -+ .extend_name = "apparent", - .address = AD7758_WT(AD7758_PHASE_A, AD7758_APP_PWR), - .scan_index = 2, - .scan_type = { -@@ -672,9 +664,7 @@ static const struct iio_chan_spec ade7758_channels[] = { - .type = IIO_POWER, - .indexed = 1, - .channel = 0, -- .extend_name = "active_raw", -- .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), -- .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), -+ .extend_name = "active", - .address = AD7758_WT(AD7758_PHASE_A, AD7758_ACT_PWR), - .scan_index = 3, - .scan_type = { -@@ -686,9 +676,7 @@ static const struct iio_chan_spec ade7758_channels[] = { - .type = IIO_POWER, - .indexed = 1, - .channel = 0, -- .extend_name = "reactive_raw", -- .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), -- .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), -+ .extend_name = "reactive", - .address = AD7758_WT(AD7758_PHASE_A, AD7758_REACT_PWR), - .scan_index = 4, - .scan_type = { -@@ -700,9 +688,6 @@ static const struct iio_chan_spec ade7758_channels[] = { - .type = IIO_VOLTAGE, - .indexed = 1, - .channel = 1, -- .extend_name = "raw", -- .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), -- .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), - .address = AD7758_WT(AD7758_PHASE_B, AD7758_VOLTAGE), - .scan_index = 5, - .scan_type = { -@@ -714,9 +699,6 @@ static const struct iio_chan_spec ade7758_channels[] = { - .type = IIO_CURRENT, - .indexed = 1, - .channel = 1, -- .extend_name = "raw", -- .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), -- .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), - .address = AD7758_WT(AD7758_PHASE_B, AD7758_CURRENT), - .scan_index = 6, - .scan_type = { -@@ -728,9 +710,7 @@ static const struct iio_chan_spec ade7758_channels[] = { - .type = IIO_POWER, - .indexed = 1, - .channel = 1, -- .extend_name = "apparent_raw", -- .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), -- .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), -+ .extend_name = "apparent", - .address = AD7758_WT(AD7758_PHASE_B, AD7758_APP_PWR), - .scan_index = 7, - .scan_type = { -@@ -742,9 +722,7 @@ static const struct iio_chan_spec ade7758_channels[] = { - .type = IIO_POWER, - .indexed = 1, - .channel = 1, -- .extend_name = "active_raw", -- .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), -- .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), -+ .extend_name = "active", - .address = AD7758_WT(AD7758_PHASE_B, AD7758_ACT_PWR), - .scan_index = 8, - .scan_type = { -@@ -756,9 +734,7 @@ static const struct iio_chan_spec ade7758_channels[] = { - .type = IIO_POWER, - .indexed = 1, - .channel = 1, -- .extend_name = "reactive_raw", -- .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), -- .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), -+ .extend_name = "reactive", - .address = AD7758_WT(AD7758_PHASE_B, AD7758_REACT_PWR), - .scan_index = 9, - .scan_type = { -@@ -770,9 +746,6 @@ static const struct iio_chan_spec ade7758_channels[] = { - .type = IIO_VOLTAGE, - .indexed = 1, - .channel = 2, -- .extend_name = "raw", -- .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), -- .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), - .address = AD7758_WT(AD7758_PHASE_C, AD7758_VOLTAGE), - .scan_index = 10, - .scan_type = { -@@ -784,9 +757,6 @@ static const struct iio_chan_spec ade7758_channels[] = { - .type = IIO_CURRENT, - .indexed = 1, - .channel = 2, -- .extend_name = "raw", -- .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), -- .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), - .address = AD7758_WT(AD7758_PHASE_C, AD7758_CURRENT), - .scan_index = 11, - .scan_type = { -@@ -798,9 +768,7 @@ static const struct iio_chan_spec ade7758_channels[] = { - .type = IIO_POWER, - .indexed = 1, - .channel = 2, -- .extend_name = "apparent_raw", -- .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), -- .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), -+ .extend_name = "apparent", - .address = AD7758_WT(AD7758_PHASE_C, AD7758_APP_PWR), - .scan_index = 12, - .scan_type = { -@@ -812,9 +780,7 @@ static const struct iio_chan_spec ade7758_channels[] = { - .type = IIO_POWER, - .indexed = 1, - .channel = 2, -- .extend_name = "active_raw", -- .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), -- .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), -+ .extend_name = "active", - .address = AD7758_WT(AD7758_PHASE_C, AD7758_ACT_PWR), - .scan_index = 13, - .scan_type = { -@@ -826,9 +792,7 @@ static const struct iio_chan_spec ade7758_channels[] = { - .type = IIO_POWER, - .indexed = 1, - .channel = 2, -- .extend_name = "reactive_raw", -- .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), -- .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), -+ .extend_name = "reactive", - .address = AD7758_WT(AD7758_PHASE_C, AD7758_REACT_PWR), - .scan_index = 14, - .scan_type = { -@@ -869,13 +833,14 @@ static int ade7758_probe(struct spi_device *spi) - goto error_free_rx; - } - st->us = spi; -- st->ade7758_ring_channels = &ade7758_channels[0]; - mutex_init(&st->buf_lock); - - indio_dev->name = spi->dev.driver->name; - indio_dev->dev.parent = &spi->dev; - indio_dev->info = &ade7758_info; - indio_dev->modes = INDIO_DIRECT_MODE; -+ indio_dev->channels = ade7758_channels; -+ indio_dev->num_channels = ARRAY_SIZE(ade7758_channels); - - ret = ade7758_configure_ring(indio_dev); - if (ret) -diff --git a/drivers/staging/iio/meter/ade7758_ring.c b/drivers/staging/iio/meter/ade7758_ring.c -index c0accf8cce93..6e9006490742 100644 ---- a/drivers/staging/iio/meter/ade7758_ring.c -+++ b/drivers/staging/iio/meter/ade7758_ring.c -@@ -85,17 +85,16 @@ static irqreturn_t ade7758_trigger_handler(int irq, void *p) - **/ - static int ade7758_ring_preenable(struct iio_dev *indio_dev) - { -- struct ade7758_state *st = iio_priv(indio_dev); - unsigned channel; - -- if (!bitmap_empty(indio_dev->active_scan_mask, indio_dev->masklength)) -+ if (bitmap_empty(indio_dev->active_scan_mask, indio_dev->masklength)) - return -EINVAL; - - channel = find_first_bit(indio_dev->active_scan_mask, - indio_dev->masklength); - - ade7758_write_waveform_type(&indio_dev->dev, -- st->ade7758_ring_channels[channel].address); -+ indio_dev->channels[channel].address); - - return 0; - } -diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c -index 6ea95d216eb8..38b4be24d13f 100644 ---- a/drivers/target/target_core_device.c -+++ b/drivers/target/target_core_device.c -@@ -1409,7 +1409,8 @@ int core_dev_add_initiator_node_lun_acl( - * Check to see if there are any existing persistent reservation APTPL - * pre-registrations that need to be enabled for this LUN ACL.. - */ -- core_scsi3_check_aptpl_registration(lun->lun_se_dev, tpg, lun, lacl); -+ core_scsi3_check_aptpl_registration(lun->lun_se_dev, tpg, lun, nacl, -+ lacl->mapped_lun); - return 0; - } - -diff --git a/drivers/target/target_core_pr.c b/drivers/target/target_core_pr.c -index 3013287a2aaa..1205dbd4f83d 100644 ---- a/drivers/target/target_core_pr.c -+++ b/drivers/target/target_core_pr.c -@@ -944,10 +944,10 @@ int core_scsi3_check_aptpl_registration( - struct se_device *dev, - struct se_portal_group *tpg, - struct se_lun *lun, -- struct se_lun_acl *lun_acl) -+ struct se_node_acl *nacl, -+ u32 mapped_lun) - { -- struct se_node_acl *nacl = lun_acl->se_lun_nacl; -- struct se_dev_entry *deve = nacl->device_list[lun_acl->mapped_lun]; -+ struct se_dev_entry *deve = nacl->device_list[mapped_lun]; - - if (dev->dev_reservation_flags & DRF_SPC2_RESERVATIONS) - return 0; -diff --git a/drivers/target/target_core_pr.h b/drivers/target/target_core_pr.h -index 2ee2936fa0bd..749fd7bb7510 100644 ---- a/drivers/target/target_core_pr.h -+++ b/drivers/target/target_core_pr.h -@@ -60,7 +60,7 @@ extern int core_scsi3_alloc_aptpl_registration( - unsigned char *, u16, u32, int, int, u8); - extern int core_scsi3_check_aptpl_registration(struct se_device *, - struct se_portal_group *, struct se_lun *, -- struct se_lun_acl *); -+ struct se_node_acl *, u32); - extern void core_scsi3_free_pr_reg_from_nacl(struct se_device *, - struct se_node_acl *); - extern void core_scsi3_free_all_registrations(struct se_device *); -diff --git a/drivers/target/target_core_tpg.c b/drivers/target/target_core_tpg.c -index c036595b17cf..fb8a1a12dda9 100644 ---- a/drivers/target/target_core_tpg.c -+++ b/drivers/target/target_core_tpg.c -@@ -40,6 +40,7 @@ - #include <target/target_core_fabric.h> - - #include "target_core_internal.h" -+#include "target_core_pr.h" - - extern struct se_device *g_lun0_dev; - -@@ -166,6 +167,13 @@ void core_tpg_add_node_to_devs( - - core_enable_device_list_for_node(lun, NULL, lun->unpacked_lun, - lun_access, acl, tpg); -+ /* -+ * Check to see if there are any existing persistent reservation -+ * APTPL pre-registrations that need to be enabled for this dynamic -+ * LUN ACL now.. -+ */ -+ core_scsi3_check_aptpl_registration(dev, tpg, lun, acl, -+ lun->unpacked_lun); - spin_lock(&tpg->tpg_lun_lock); - } - spin_unlock(&tpg->tpg_lun_lock); -diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c -index 24f527977ddb..9232c7738ed1 100644 ---- a/drivers/target/target_core_transport.c -+++ b/drivers/target/target_core_transport.c -@@ -1855,8 +1855,7 @@ static void transport_complete_qf(struct se_cmd *cmd) - if (cmd->se_cmd_flags & SCF_TRANSPORT_TASK_SENSE) { - trace_target_cmd_complete(cmd); - ret = cmd->se_tfo->queue_status(cmd); -- if (ret) -- goto out; -+ goto out; - } - - switch (cmd->data_direction) { -diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c -index 25b8f6868788..27b5554e20d9 100644 ---- a/drivers/tty/serial/serial_core.c -+++ b/drivers/tty/serial/serial_core.c -@@ -353,7 +353,7 @@ uart_get_baud_rate(struct uart_port *port, struct ktermios *termios, - * The spd_hi, spd_vhi, spd_shi, spd_warp kludge... - * Die! Die! Die! - */ -- if (baud == 38400) -+ if (try == 0 && baud == 38400) - baud = altbaud; - - /* -diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c -index d3448a90f0f9..25d07412e08e 100644 ---- a/drivers/tty/tty_io.c -+++ b/drivers/tty/tty_io.c -@@ -1701,6 +1701,7 @@ int tty_release(struct inode *inode, struct file *filp) - int pty_master, tty_closing, o_tty_closing, do_sleep; - int idx; - char buf[64]; -+ long timeout = 0; - - if (tty_paranoia_check(tty, inode, __func__)) - return 0; -@@ -1785,7 +1786,11 @@ int tty_release(struct inode *inode, struct file *filp) - __func__, tty_name(tty, buf)); - tty_unlock_pair(tty, o_tty); - mutex_unlock(&tty_mutex); -- schedule(); -+ schedule_timeout_killable(timeout); -+ if (timeout < 120 * HZ) -+ timeout = 2 * timeout + 1; -+ else -+ timeout = MAX_SCHEDULE_TIMEOUT; - } - - /* -diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c -index eabccd45f4e8..331f06a91cc3 100644 ---- a/drivers/usb/class/cdc-acm.c -+++ b/drivers/usb/class/cdc-acm.c -@@ -965,11 +965,12 @@ static void acm_tty_set_termios(struct tty_struct *tty, - /* FIXME: Needs to clear unsupported bits in the termios */ - acm->clocal = ((termios->c_cflag & CLOCAL) != 0); - -- if (!newline.dwDTERate) { -+ if (C_BAUD(tty) == B0) { - newline.dwDTERate = acm->line.dwDTERate; - newctrl &= ~ACM_CTRL_DTR; -- } else -+ } else if (termios_old && (termios_old->c_cflag & CBAUD) == B0) { - newctrl |= ACM_CTRL_DTR; -+ } - - if (newctrl != acm->ctrlout) - acm_set_control(acm, acm->ctrlout = newctrl); -@@ -1672,6 +1673,7 @@ static const struct usb_device_id acm_ids[] = { - { USB_DEVICE(0x0572, 0x1328), /* Shiro / Aztech USB MODEM UM-3100 */ - .driver_info = NO_UNION_NORMAL, /* has no union descriptor */ - }, -+ { USB_DEVICE(0x2184, 0x001c) }, /* GW Instek AFG-2225 */ - { USB_DEVICE(0x22b8, 0x6425), /* Motorola MOTOMAGX phones */ - }, - /* Motorola H24 HSPA module: */ -diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c -index 2518c3250750..ef6ec13b6ae5 100644 ---- a/drivers/usb/core/hcd.c -+++ b/drivers/usb/core/hcd.c -@@ -2057,6 +2057,8 @@ int usb_alloc_streams(struct usb_interface *interface, - return -EINVAL; - if (dev->speed != USB_SPEED_SUPER) - return -EINVAL; -+ if (dev->state < USB_STATE_CONFIGURED) -+ return -ENODEV; - - /* Streams only apply to bulk endpoints. */ - for (i = 0; i < num_eps; i++) -diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c -index 445d62a4316a..d2bd9d7c8f4b 100644 ---- a/drivers/usb/core/hub.c -+++ b/drivers/usb/core/hub.c -@@ -4378,6 +4378,9 @@ check_highspeed (struct usb_hub *hub, struct usb_device *udev, int port1) - struct usb_qualifier_descriptor *qual; - int status; - -+ if (udev->quirks & USB_QUIRK_DEVICE_QUALIFIER) -+ return; -+ - qual = kmalloc (sizeof *qual, GFP_KERNEL); - if (qual == NULL) - return; -diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c -index 5144d11d032c..c85459338991 100644 ---- a/drivers/usb/core/quirks.c -+++ b/drivers/usb/core/quirks.c -@@ -93,6 +93,16 @@ static const struct usb_device_id usb_quirk_list[] = { - { USB_DEVICE(0x04e8, 0x6601), .driver_info = - USB_QUIRK_CONFIG_INTF_STRINGS }, - -+ /* Elan Touchscreen */ -+ { USB_DEVICE(0x04f3, 0x0089), .driver_info = -+ USB_QUIRK_DEVICE_QUALIFIER }, -+ -+ { USB_DEVICE(0x04f3, 0x009b), .driver_info = -+ USB_QUIRK_DEVICE_QUALIFIER }, -+ -+ { USB_DEVICE(0x04f3, 0x016f), .driver_info = -+ USB_QUIRK_DEVICE_QUALIFIER }, -+ - /* Roland SC-8820 */ - { USB_DEVICE(0x0582, 0x0007), .driver_info = USB_QUIRK_RESET_RESUME }, - -diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c -index 21a352079bc2..0985ff715c0c 100644 ---- a/drivers/usb/dwc3/ep0.c -+++ b/drivers/usb/dwc3/ep0.c -@@ -251,7 +251,7 @@ static void dwc3_ep0_stall_and_restart(struct dwc3 *dwc) - - /* stall is always issued on EP0 */ - dep = dwc->eps[0]; -- __dwc3_gadget_ep_set_halt(dep, 1); -+ __dwc3_gadget_ep_set_halt(dep, 1, false); - dep->flags = DWC3_EP_ENABLED; - dwc->delayed_status = false; - -@@ -461,7 +461,7 @@ static int dwc3_ep0_handle_feature(struct dwc3 *dwc, - return -EINVAL; - if (set == 0 && (dep->flags & DWC3_EP_WEDGE)) - break; -- ret = __dwc3_gadget_ep_set_halt(dep, set); -+ ret = __dwc3_gadget_ep_set_halt(dep, set, true); - if (ret) - return -EINVAL; - break; -diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c -index 09e9619ae381..d90c70c23adb 100644 ---- a/drivers/usb/dwc3/gadget.c -+++ b/drivers/usb/dwc3/gadget.c -@@ -532,12 +532,11 @@ static int __dwc3_gadget_ep_enable(struct dwc3_ep *dep, - if (!usb_endpoint_xfer_isoc(desc)) - return 0; - -- memset(&trb_link, 0, sizeof(trb_link)); -- - /* Link TRB for ISOC. The HWO bit is never reset */ - trb_st_hw = &dep->trb_pool[0]; - - trb_link = &dep->trb_pool[DWC3_TRB_NUM - 1]; -+ memset(trb_link, 0, sizeof(*trb_link)); - - trb_link->bpl = lower_32_bits(dwc3_trb_dma_offset(dep, trb_st_hw)); - trb_link->bph = upper_32_bits(dwc3_trb_dma_offset(dep, trb_st_hw)); -@@ -588,7 +587,7 @@ static int __dwc3_gadget_ep_disable(struct dwc3_ep *dep) - - /* make sure HW endpoint isn't stalled */ - if (dep->flags & DWC3_EP_STALL) -- __dwc3_gadget_ep_set_halt(dep, 0); -+ __dwc3_gadget_ep_set_halt(dep, 0, false); - - reg = dwc3_readl(dwc->regs, DWC3_DALEPENA); - reg &= ~DWC3_DALEPENA_EP(dep->number); -@@ -1186,7 +1185,7 @@ out0: - return ret; - } - --int __dwc3_gadget_ep_set_halt(struct dwc3_ep *dep, int value) -+int __dwc3_gadget_ep_set_halt(struct dwc3_ep *dep, int value, int protocol) - { - struct dwc3_gadget_ep_cmd_params params; - struct dwc3 *dwc = dep->dwc; -@@ -1195,6 +1194,14 @@ int __dwc3_gadget_ep_set_halt(struct dwc3_ep *dep, int value) - memset(&params, 0x00, sizeof(params)); - - if (value) { -+ if (!protocol && ((dep->direction && dep->flags & DWC3_EP_BUSY) || -+ (!list_empty(&dep->req_queued) || -+ !list_empty(&dep->request_list)))) { -+ dev_dbg(dwc->dev, "%s: pending request, cannot halt\n", -+ dep->name); -+ return -EAGAIN; -+ } -+ - ret = dwc3_send_gadget_ep_cmd(dwc, dep->number, - DWC3_DEPCMD_SETSTALL, &params); - if (ret) -@@ -1234,7 +1241,7 @@ static int dwc3_gadget_ep_set_halt(struct usb_ep *ep, int value) - goto out; - } - -- ret = __dwc3_gadget_ep_set_halt(dep, value); -+ ret = __dwc3_gadget_ep_set_halt(dep, value, false); - out: - spin_unlock_irqrestore(&dwc->lock, flags); - -@@ -1254,7 +1261,7 @@ static int dwc3_gadget_ep_set_wedge(struct usb_ep *ep) - if (dep->number == 0 || dep->number == 1) - return dwc3_gadget_ep0_set_halt(ep, 1); - else -- return dwc3_gadget_ep_set_halt(ep, 1); -+ return __dwc3_gadget_ep_set_halt(dep, 1, false); - } - - /* -------------------------------------------------------------------------- */ -diff --git a/drivers/usb/dwc3/gadget.h b/drivers/usb/dwc3/gadget.h -index a0ee75b68a80..ac62558231be 100644 ---- a/drivers/usb/dwc3/gadget.h -+++ b/drivers/usb/dwc3/gadget.h -@@ -85,7 +85,7 @@ void dwc3_ep0_out_start(struct dwc3 *dwc); - int dwc3_gadget_ep0_set_halt(struct usb_ep *ep, int value); - int dwc3_gadget_ep0_queue(struct usb_ep *ep, struct usb_request *request, - gfp_t gfp_flags); --int __dwc3_gadget_ep_set_halt(struct dwc3_ep *dep, int value); -+int __dwc3_gadget_ep_set_halt(struct dwc3_ep *dep, int value, int protocol); - - /** - * dwc3_gadget_ep_get_transfer_index - Gets transfer index from HW -diff --git a/drivers/usb/gadget/f_acm.c b/drivers/usb/gadget/f_acm.c -index ab1065afbbd0..3384486c2884 100644 ---- a/drivers/usb/gadget/f_acm.c -+++ b/drivers/usb/gadget/f_acm.c -@@ -430,11 +430,12 @@ static int acm_set_alt(struct usb_function *f, unsigned intf, unsigned alt) - if (acm->notify->driver_data) { - VDBG(cdev, "reset acm control interface %d\n", intf); - usb_ep_disable(acm->notify); -- } else { -- VDBG(cdev, "init acm ctrl interface %d\n", intf); -+ } -+ -+ if (!acm->notify->desc) - if (config_ep_by_speed(cdev->gadget, f, acm->notify)) - return -EINVAL; -- } -+ - usb_ep_enable(acm->notify); - acm->notify->driver_data = acm; - -diff --git a/drivers/usb/gadget/f_fs.c b/drivers/usb/gadget/f_fs.c -index 5bcf7d001259..afd0a159fe61 100644 ---- a/drivers/usb/gadget/f_fs.c -+++ b/drivers/usb/gadget/f_fs.c -@@ -1995,8 +1995,6 @@ static inline struct f_fs_opts *ffs_do_functionfs_bind(struct usb_function *f, - func->conf = c; - func->gadget = c->cdev->gadget; - -- ffs_data_get(func->ffs); -- - /* - * in drivers/usb/gadget/configfs.c:configfs_composite_bind() - * configurations are bound in sequence with list_for_each_entry, -diff --git a/drivers/usb/gadget/udc-core.c b/drivers/usb/gadget/udc-core.c -index 27768a7d986a..9ce0b135c8c8 100644 ---- a/drivers/usb/gadget/udc-core.c -+++ b/drivers/usb/gadget/udc-core.c -@@ -456,6 +456,11 @@ static ssize_t usb_udc_softconn_store(struct device *dev, - { - struct usb_udc *udc = container_of(dev, struct usb_udc, dev); - -+ if (!udc->driver) { -+ dev_err(dev, "soft-connect without a gadget driver\n"); -+ return -EOPNOTSUPP; -+ } -+ - if (sysfs_streq(buf, "connect")) { - usb_gadget_udc_start(udc->gadget, udc->driver); - usb_gadget_connect(udc->gadget); -diff --git a/drivers/usb/musb/musb_cppi41.c b/drivers/usb/musb/musb_cppi41.c -index c2d5afc57e22..1d29bbfeb9d5 100644 ---- a/drivers/usb/musb/musb_cppi41.c -+++ b/drivers/usb/musb/musb_cppi41.c -@@ -190,7 +190,8 @@ static enum hrtimer_restart cppi41_recheck_tx_req(struct hrtimer *timer) - } - } - -- if (!list_empty(&controller->early_tx_list)) { -+ if (!list_empty(&controller->early_tx_list) && -+ !hrtimer_is_queued(&controller->early_tx)) { - ret = HRTIMER_RESTART; - hrtimer_forward_now(&controller->early_tx, - ktime_set(0, 150 * NSEC_PER_USEC)); -diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c -index 85f5215871de..865243e818b7 100644 ---- a/drivers/usb/musb/musb_dsps.c -+++ b/drivers/usb/musb/musb_dsps.c -@@ -733,7 +733,9 @@ static int dsps_resume(struct device *dev) - dsps_writel(mbase, wrp->mode, glue->context.mode); - dsps_writel(mbase, wrp->tx_mode, glue->context.tx_mode); - dsps_writel(mbase, wrp->rx_mode, glue->context.rx_mode); -- setup_timer(&glue->timer, otg_timer, (unsigned long) musb); -+ if (musb->xceiv->state == OTG_STATE_B_IDLE && -+ musb->port_mode == MUSB_PORT_MODE_DUAL_ROLE) -+ mod_timer(&glue->timer, jiffies + wrp->poll_seconds * HZ); - - return 0; - } -diff --git a/drivers/usb/phy/phy.c b/drivers/usb/phy/phy.c -index 8afa813d690b..0180eef05656 100644 ---- a/drivers/usb/phy/phy.c -+++ b/drivers/usb/phy/phy.c -@@ -229,6 +229,9 @@ struct usb_phy *usb_get_phy_dev(struct device *dev, u8 index) - phy = __usb_find_phy_dev(dev, &phy_bind_list, index); - if (IS_ERR(phy) || !try_module_get(phy->dev->driver->owner)) { - dev_dbg(dev, "unable to find transceiver\n"); -+ if (!IS_ERR(phy)) -+ phy = ERR_PTR(-ENODEV); -+ - goto err0; - } - -diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c -index 63b2af2a87c0..3beae723ad3a 100644 ---- a/drivers/usb/serial/cp210x.c -+++ b/drivers/usb/serial/cp210x.c -@@ -155,6 +155,7 @@ static const struct usb_device_id id_table[] = { - { USB_DEVICE(0x18EF, 0xE00F) }, /* ELV USB-I2C-Interface */ - { USB_DEVICE(0x1ADB, 0x0001) }, /* Schweitzer Engineering C662 Cable */ - { USB_DEVICE(0x1B1C, 0x1C00) }, /* Corsair USB Dongle */ -+ { USB_DEVICE(0x1BA4, 0x0002) }, /* Silicon Labs 358x factory default */ - { USB_DEVICE(0x1BE3, 0x07A6) }, /* WAGO 750-923 USB Service Cable */ - { USB_DEVICE(0x1D6F, 0x0010) }, /* Seluxit ApS RF Dongle */ - { USB_DEVICE(0x1E29, 0x0102) }, /* Festo CPX-USB */ -diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c -index 3614620e09e1..a523adad6380 100644 ---- a/drivers/usb/serial/ftdi_sio.c -+++ b/drivers/usb/serial/ftdi_sio.c -@@ -145,6 +145,7 @@ static struct ftdi_sio_quirk ftdi_8u2232c_quirk = { - * /sys/bus/usb-serial/drivers/ftdi_sio/new_id and send a patch or report. - */ - static const struct usb_device_id id_table_combined[] = { -+ { USB_DEVICE(FTDI_VID, FTDI_BRICK_PID) }, - { USB_DEVICE(FTDI_VID, FTDI_ZEITCONTROL_TAGTRACE_MIFARE_PID) }, - { USB_DEVICE(FTDI_VID, FTDI_CTI_MINI_PID) }, - { USB_DEVICE(FTDI_VID, FTDI_CTI_NANO_PID) }, -@@ -674,6 +675,8 @@ static const struct usb_device_id id_table_combined[] = { - { USB_DEVICE(FTDI_VID, XSENS_CONVERTER_5_PID) }, - { USB_DEVICE(FTDI_VID, XSENS_CONVERTER_6_PID) }, - { USB_DEVICE(FTDI_VID, XSENS_CONVERTER_7_PID) }, -+ { USB_DEVICE(XSENS_VID, XSENS_AWINDA_DONGLE_PID) }, -+ { USB_DEVICE(XSENS_VID, XSENS_AWINDA_STATION_PID) }, - { USB_DEVICE(XSENS_VID, XSENS_CONVERTER_PID) }, - { USB_DEVICE(XSENS_VID, XSENS_MTW_PID) }, - { USB_DEVICE(FTDI_VID, FTDI_OMNI1509) }, -diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h -index 5937b2d242f2..6786b705ccf6 100644 ---- a/drivers/usb/serial/ftdi_sio_ids.h -+++ b/drivers/usb/serial/ftdi_sio_ids.h -@@ -30,6 +30,12 @@ - - /*** third-party PIDs (using FTDI_VID) ***/ - -+/* -+ * Certain versions of the official Windows FTDI driver reprogrammed -+ * counterfeit FTDI devices to PID 0. Support these devices anyway. -+ */ -+#define FTDI_BRICK_PID 0x0000 -+ - #define FTDI_LUMEL_PD12_PID 0x6002 - - /* -@@ -143,8 +149,12 @@ - * Xsens Technologies BV products (http://www.xsens.com). - */ - #define XSENS_VID 0x2639 --#define XSENS_CONVERTER_PID 0xD00D /* Xsens USB-serial converter */ -+#define XSENS_AWINDA_STATION_PID 0x0101 -+#define XSENS_AWINDA_DONGLE_PID 0x0102 - #define XSENS_MTW_PID 0x0200 /* Xsens MTw */ -+#define XSENS_CONVERTER_PID 0xD00D /* Xsens USB-serial converter */ -+ -+/* Xsens devices using FTDI VID */ - #define XSENS_CONVERTER_0_PID 0xD388 /* Xsens USB converter */ - #define XSENS_CONVERTER_1_PID 0xD389 /* Xsens Wireless Receiver */ - #define XSENS_CONVERTER_2_PID 0xD38A -diff --git a/drivers/usb/serial/kobil_sct.c b/drivers/usb/serial/kobil_sct.c -index 618c1c1f227e..5cdb32b37e85 100644 ---- a/drivers/usb/serial/kobil_sct.c -+++ b/drivers/usb/serial/kobil_sct.c -@@ -335,7 +335,8 @@ static int kobil_write(struct tty_struct *tty, struct usb_serial_port *port, - port->interrupt_out_urb->transfer_buffer_length = length; - - priv->cur_pos = priv->cur_pos + length; -- result = usb_submit_urb(port->interrupt_out_urb, GFP_NOIO); -+ result = usb_submit_urb(port->interrupt_out_urb, -+ GFP_ATOMIC); - dev_dbg(&port->dev, "%s - Send write URB returns: %i\n", __func__, result); - todo = priv->filled - priv->cur_pos; - -@@ -350,7 +351,7 @@ static int kobil_write(struct tty_struct *tty, struct usb_serial_port *port, - if (priv->device_type == KOBIL_ADAPTER_B_PRODUCT_ID || - priv->device_type == KOBIL_ADAPTER_K_PRODUCT_ID) { - result = usb_submit_urb(port->interrupt_in_urb, -- GFP_NOIO); -+ GFP_ATOMIC); - dev_dbg(&port->dev, "%s - Send read URB returns: %i\n", __func__, result); - } - } -diff --git a/drivers/usb/serial/opticon.c b/drivers/usb/serial/opticon.c -index 4856fb7e637e..4b7bfb394a32 100644 ---- a/drivers/usb/serial/opticon.c -+++ b/drivers/usb/serial/opticon.c -@@ -215,7 +215,7 @@ static int opticon_write(struct tty_struct *tty, struct usb_serial_port *port, - - /* The connected devices do not have a bulk write endpoint, - * to transmit data to de barcode device the control endpoint is used */ -- dr = kmalloc(sizeof(struct usb_ctrlrequest), GFP_NOIO); -+ dr = kmalloc(sizeof(struct usb_ctrlrequest), GFP_ATOMIC); - if (!dr) { - count = -ENOMEM; - goto error_no_dr; -diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c -index e47aabe0c760..8b3484134ab0 100644 ---- a/drivers/usb/serial/option.c -+++ b/drivers/usb/serial/option.c -@@ -269,6 +269,7 @@ static void option_instat_callback(struct urb *urb); - #define TELIT_PRODUCT_DE910_DUAL 0x1010 - #define TELIT_PRODUCT_UE910_V2 0x1012 - #define TELIT_PRODUCT_LE920 0x1200 -+#define TELIT_PRODUCT_LE910 0x1201 - - /* ZTE PRODUCTS */ - #define ZTE_VENDOR_ID 0x19d2 -@@ -361,6 +362,7 @@ static void option_instat_callback(struct urb *urb); - - /* Haier products */ - #define HAIER_VENDOR_ID 0x201e -+#define HAIER_PRODUCT_CE81B 0x10f8 - #define HAIER_PRODUCT_CE100 0x2009 - - /* Cinterion (formerly Siemens) products */ -@@ -588,6 +590,11 @@ static const struct option_blacklist_info zte_1255_blacklist = { - .reserved = BIT(3) | BIT(4), - }; - -+static const struct option_blacklist_info telit_le910_blacklist = { -+ .sendsetup = BIT(0), -+ .reserved = BIT(1) | BIT(2), -+}; -+ - static const struct option_blacklist_info telit_le920_blacklist = { - .sendsetup = BIT(0), - .reserved = BIT(1) | BIT(5), -@@ -1137,6 +1144,8 @@ static const struct usb_device_id option_ids[] = { - { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_CC864_SINGLE) }, - { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_DE910_DUAL) }, - { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_UE910_V2) }, -+ { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE910), -+ .driver_info = (kernel_ulong_t)&telit_le910_blacklist }, - { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE920), - .driver_info = (kernel_ulong_t)&telit_le920_blacklist }, - { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MF622, 0xff, 0xff, 0xff) }, /* ZTE WCDMA products */ -@@ -1612,6 +1621,7 @@ static const struct usb_device_id option_ids[] = { - { USB_DEVICE(LONGCHEER_VENDOR_ID, ZOOM_PRODUCT_4597) }, - { USB_DEVICE(LONGCHEER_VENDOR_ID, IBALL_3_5G_CONNECT) }, - { USB_DEVICE(HAIER_VENDOR_ID, HAIER_PRODUCT_CE100) }, -+ { USB_DEVICE_AND_INTERFACE_INFO(HAIER_VENDOR_ID, HAIER_PRODUCT_CE81B, 0xff, 0xff, 0xff) }, - /* Pirelli */ - { USB_DEVICE_INTERFACE_CLASS(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_C100_1, 0xff) }, - { USB_DEVICE_INTERFACE_CLASS(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_C100_2, 0xff) }, -diff --git a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c -index 22c7d4360fa2..b1d815eb6d0b 100644 ---- a/drivers/usb/storage/transport.c -+++ b/drivers/usb/storage/transport.c -@@ -1118,6 +1118,31 @@ int usb_stor_Bulk_transport(struct scsi_cmnd *srb, struct us_data *us) - */ - if (result == USB_STOR_XFER_LONG) - fake_sense = 1; -+ -+ /* -+ * Sometimes a device will mistakenly skip the data phase -+ * and go directly to the status phase without sending a -+ * zero-length packet. If we get a 13-byte response here, -+ * check whether it really is a CSW. -+ */ -+ if (result == USB_STOR_XFER_SHORT && -+ srb->sc_data_direction == DMA_FROM_DEVICE && -+ transfer_length - scsi_get_resid(srb) == -+ US_BULK_CS_WRAP_LEN) { -+ struct scatterlist *sg = NULL; -+ unsigned int offset = 0; -+ -+ if (usb_stor_access_xfer_buf((unsigned char *) bcs, -+ US_BULK_CS_WRAP_LEN, srb, &sg, -+ &offset, FROM_XFER_BUF) == -+ US_BULK_CS_WRAP_LEN && -+ bcs->Signature == -+ cpu_to_le32(US_BULK_CS_SIGN)) { -+ usb_stor_dbg(us, "Device skipped data phase\n"); -+ scsi_set_resid(srb, transfer_length); -+ goto skipped_data_phase; -+ } -+ } - } - - /* See flow chart on pg 15 of the Bulk Only Transport spec for -@@ -1153,6 +1178,7 @@ int usb_stor_Bulk_transport(struct scsi_cmnd *srb, struct us_data *us) - if (result != USB_STOR_XFER_GOOD) - return USB_STOR_TRANSPORT_ERROR; - -+ skipped_data_phase: - /* check bulk status */ - residue = le32_to_cpu(bcs->Residue); - usb_stor_dbg(us, "Bulk Status S 0x%x T 0x%x R %u Stat 0x%x\n", -diff --git a/drivers/video/console/bitblit.c b/drivers/video/console/bitblit.c -index 61b182bf32a2..dbfe4eecf12e 100644 ---- a/drivers/video/console/bitblit.c -+++ b/drivers/video/console/bitblit.c -@@ -205,7 +205,6 @@ static void bit_putcs(struct vc_data *vc, struct fb_info *info, - static void bit_clear_margins(struct vc_data *vc, struct fb_info *info, - int bottom_only) - { -- int bgshift = (vc->vc_hi_font_mask) ? 13 : 12; - unsigned int cw = vc->vc_font.width; - unsigned int ch = vc->vc_font.height; - unsigned int rw = info->var.xres - (vc->vc_cols*cw); -@@ -214,7 +213,7 @@ static void bit_clear_margins(struct vc_data *vc, struct fb_info *info, - unsigned int bs = info->var.yres - bh; - struct fb_fillrect region; - -- region.color = attr_bgcol_ec(bgshift, vc, info); -+ region.color = 0; - region.rop = ROP_COPY; - - if (rw && !bottom_only) { -diff --git a/drivers/video/console/fbcon_ccw.c b/drivers/video/console/fbcon_ccw.c -index 41b32ae23dac..5a3cbf6dff4d 100644 ---- a/drivers/video/console/fbcon_ccw.c -+++ b/drivers/video/console/fbcon_ccw.c -@@ -197,9 +197,8 @@ static void ccw_clear_margins(struct vc_data *vc, struct fb_info *info, - unsigned int bh = info->var.xres - (vc->vc_rows*ch); - unsigned int bs = vc->vc_rows*ch; - struct fb_fillrect region; -- int bgshift = (vc->vc_hi_font_mask) ? 13 : 12; - -- region.color = attr_bgcol_ec(bgshift,vc,info); -+ region.color = 0; - region.rop = ROP_COPY; - - if (rw && !bottom_only) { -diff --git a/drivers/video/console/fbcon_cw.c b/drivers/video/console/fbcon_cw.c -index a93670ef7f89..e7ee44db4e98 100644 ---- a/drivers/video/console/fbcon_cw.c -+++ b/drivers/video/console/fbcon_cw.c -@@ -180,9 +180,8 @@ static void cw_clear_margins(struct vc_data *vc, struct fb_info *info, - unsigned int bh = info->var.xres - (vc->vc_rows*ch); - unsigned int rs = info->var.yres - rw; - struct fb_fillrect region; -- int bgshift = (vc->vc_hi_font_mask) ? 13 : 12; - -- region.color = attr_bgcol_ec(bgshift,vc,info); -+ region.color = 0; - region.rop = ROP_COPY; - - if (rw && !bottom_only) { -diff --git a/drivers/video/console/fbcon_ud.c b/drivers/video/console/fbcon_ud.c -index ff0872c0498b..19e3714abfe8 100644 ---- a/drivers/video/console/fbcon_ud.c -+++ b/drivers/video/console/fbcon_ud.c -@@ -227,9 +227,8 @@ static void ud_clear_margins(struct vc_data *vc, struct fb_info *info, - unsigned int rw = info->var.xres - (vc->vc_cols*cw); - unsigned int bh = info->var.yres - (vc->vc_rows*ch); - struct fb_fillrect region; -- int bgshift = (vc->vc_hi_font_mask) ? 13 : 12; - -- region.color = attr_bgcol_ec(bgshift,vc,info); -+ region.color = 0; - region.rop = ROP_COPY; - - if (rw && !bottom_only) { -diff --git a/drivers/virtio/virtio_pci.c b/drivers/virtio/virtio_pci.c -index a416f9b2a7f6..827b5f8e6297 100644 ---- a/drivers/virtio/virtio_pci.c -+++ b/drivers/virtio/virtio_pci.c -@@ -791,6 +791,7 @@ static int virtio_pci_restore(struct device *dev) - struct pci_dev *pci_dev = to_pci_dev(dev); - struct virtio_pci_device *vp_dev = pci_get_drvdata(pci_dev); - struct virtio_driver *drv; -+ unsigned status = 0; - int ret; - - drv = container_of(vp_dev->vdev.dev.driver, -@@ -801,14 +802,40 @@ static int virtio_pci_restore(struct device *dev) - return ret; - - pci_set_master(pci_dev); -+ /* We always start by resetting the device, in case a previous -+ * driver messed it up. */ -+ vp_reset(&vp_dev->vdev); -+ -+ /* Acknowledge that we've seen the device. */ -+ status |= VIRTIO_CONFIG_S_ACKNOWLEDGE; -+ vp_set_status(&vp_dev->vdev, status); -+ -+ /* Maybe driver failed before freeze. -+ * Restore the failed status, for debugging. */ -+ status |= vp_dev->saved_status & VIRTIO_CONFIG_S_FAILED; -+ vp_set_status(&vp_dev->vdev, status); -+ -+ if (!drv) -+ return 0; -+ -+ /* We have a driver! */ -+ status |= VIRTIO_CONFIG_S_DRIVER; -+ vp_set_status(&vp_dev->vdev, status); -+ - vp_finalize_features(&vp_dev->vdev); - -- if (drv && drv->restore) -+ if (drv->restore) { - ret = drv->restore(&vp_dev->vdev); -+ if (ret) { -+ status |= VIRTIO_CONFIG_S_FAILED; -+ vp_set_status(&vp_dev->vdev, status); -+ return ret; -+ } -+ } - - /* Finally, tell the device we're all set */ -- if (!ret) -- vp_set_status(&vp_dev->vdev, vp_dev->saved_status); -+ status |= VIRTIO_CONFIG_S_DRIVER_OK; -+ vp_set_status(&vp_dev->vdev, status); - - return ret; - } -diff --git a/fs/btrfs/file-item.c b/fs/btrfs/file-item.c -index ca248b0687f4..196b089b0052 100644 ---- a/fs/btrfs/file-item.c -+++ b/fs/btrfs/file-item.c -@@ -423,7 +423,7 @@ int btrfs_lookup_csums_range(struct btrfs_root *root, u64 start, u64 end, - ret = 0; - fail: - while (ret < 0 && !list_empty(&tmplist)) { -- sums = list_entry(&tmplist, struct btrfs_ordered_sum, list); -+ sums = list_entry(tmplist.next, struct btrfs_ordered_sum, list); - list_del(&sums->list); - kfree(sums); - } -diff --git a/fs/buffer.c b/fs/buffer.c -index 71e2d0ed8530..4d06a573d199 100644 ---- a/fs/buffer.c -+++ b/fs/buffer.c -@@ -2077,6 +2077,7 @@ int generic_write_end(struct file *file, struct address_space *mapping, - struct page *page, void *fsdata) - { - struct inode *inode = mapping->host; -+ loff_t old_size = inode->i_size; - int i_size_changed = 0; - - copied = block_write_end(file, mapping, pos, len, copied, page, fsdata); -@@ -2096,6 +2097,8 @@ int generic_write_end(struct file *file, struct address_space *mapping, - unlock_page(page); - page_cache_release(page); - -+ if (old_size < pos) -+ pagecache_isize_extended(inode, old_size, pos); - /* - * Don't mark the inode dirty under page lock. First, it unnecessarily - * makes the holding time of page lock longer. Second, it forces lock -@@ -2313,6 +2316,11 @@ static int cont_expand_zero(struct file *file, struct address_space *mapping, - err = 0; - - balance_dirty_pages_ratelimited(mapping); -+ -+ if (unlikely(fatal_signal_pending(current))) { -+ err = -EINTR; -+ goto out; -+ } - } - - /* page covers the boundary, find the boundary offset */ -diff --git a/fs/dcache.c b/fs/dcache.c -index 58d57da91d2a..436612777203 100644 ---- a/fs/dcache.c -+++ b/fs/dcache.c -@@ -2824,6 +2824,9 @@ static int prepend(char **buffer, int *buflen, const char *str, int namelen) - * the beginning of the name. The sequence number check at the caller will - * retry it again when a d_move() does happen. So any garbage in the buffer - * due to mismatched pointer and length will be discarded. -+ * -+ * Data dependency barrier is needed to make sure that we see that terminating -+ * NUL. Alpha strikes again, film at 11... - */ - static int prepend_name(char **buffer, int *buflen, struct qstr *name) - { -@@ -2831,6 +2834,8 @@ static int prepend_name(char **buffer, int *buflen, struct qstr *name) - u32 dlen = ACCESS_ONCE(name->len); - char *p; - -+ smp_read_barrier_depends(); -+ - *buflen -= dlen + 1; - if (*buflen < 0) - return -ENAMETOOLONG; -diff --git a/fs/ext3/super.c b/fs/ext3/super.c -index 37fd31ed16e7..0498390f309e 100644 ---- a/fs/ext3/super.c -+++ b/fs/ext3/super.c -@@ -1354,13 +1354,6 @@ set_qf_format: - "not specified."); - return 0; - } -- } else { -- if (sbi->s_jquota_fmt) { -- ext3_msg(sb, KERN_ERR, "error: journaled quota format " -- "specified with no journaling " -- "enabled."); -- return 0; -- } - } - #endif - return 1; -diff --git a/fs/ext4/bitmap.c b/fs/ext4/bitmap.c -index 3285aa5a706a..b610779a958c 100644 ---- a/fs/ext4/bitmap.c -+++ b/fs/ext4/bitmap.c -@@ -24,8 +24,7 @@ int ext4_inode_bitmap_csum_verify(struct super_block *sb, ext4_group_t group, - __u32 provided, calculated; - struct ext4_sb_info *sbi = EXT4_SB(sb); - -- if (!EXT4_HAS_RO_COMPAT_FEATURE(sb, -- EXT4_FEATURE_RO_COMPAT_METADATA_CSUM)) -+ if (!ext4_has_metadata_csum(sb)) - return 1; - - provided = le16_to_cpu(gdp->bg_inode_bitmap_csum_lo); -@@ -46,8 +45,7 @@ void ext4_inode_bitmap_csum_set(struct super_block *sb, ext4_group_t group, - __u32 csum; - struct ext4_sb_info *sbi = EXT4_SB(sb); - -- if (!EXT4_HAS_RO_COMPAT_FEATURE(sb, -- EXT4_FEATURE_RO_COMPAT_METADATA_CSUM)) -+ if (!ext4_has_metadata_csum(sb)) - return; - - csum = ext4_chksum(sbi, sbi->s_csum_seed, (__u8 *)bh->b_data, sz); -@@ -65,8 +63,7 @@ int ext4_block_bitmap_csum_verify(struct super_block *sb, ext4_group_t group, - struct ext4_sb_info *sbi = EXT4_SB(sb); - int sz = EXT4_CLUSTERS_PER_GROUP(sb) / 8; - -- if (!EXT4_HAS_RO_COMPAT_FEATURE(sb, -- EXT4_FEATURE_RO_COMPAT_METADATA_CSUM)) -+ if (!ext4_has_metadata_csum(sb)) - return 1; - - provided = le16_to_cpu(gdp->bg_block_bitmap_csum_lo); -@@ -91,8 +88,7 @@ void ext4_block_bitmap_csum_set(struct super_block *sb, ext4_group_t group, - __u32 csum; - struct ext4_sb_info *sbi = EXT4_SB(sb); - -- if (!EXT4_HAS_RO_COMPAT_FEATURE(sb, -- EXT4_FEATURE_RO_COMPAT_METADATA_CSUM)) -+ if (!ext4_has_metadata_csum(sb)) - return; - - csum = ext4_chksum(sbi, sbi->s_csum_seed, (__u8 *)bh->b_data, sz); -diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h -index 62f024c051ce..2a6830a7af33 100644 ---- a/fs/ext4/ext4.h -+++ b/fs/ext4/ext4.h -@@ -2110,6 +2110,7 @@ int do_journal_get_write_access(handle_t *handle, - #define CONVERT_INLINE_DATA 2 - - extern struct inode *ext4_iget(struct super_block *, unsigned long); -+extern struct inode *ext4_iget_normal(struct super_block *, unsigned long); - extern int ext4_write_inode(struct inode *, struct writeback_control *); - extern int ext4_setattr(struct dentry *, struct iattr *); - extern int ext4_getattr(struct vfsmount *mnt, struct dentry *dentry, -@@ -2340,10 +2341,18 @@ extern int ext4_register_li_request(struct super_block *sb, - static inline int ext4_has_group_desc_csum(struct super_block *sb) - { - return EXT4_HAS_RO_COMPAT_FEATURE(sb, -- EXT4_FEATURE_RO_COMPAT_GDT_CSUM | -- EXT4_FEATURE_RO_COMPAT_METADATA_CSUM); -+ EXT4_FEATURE_RO_COMPAT_GDT_CSUM) || -+ (EXT4_SB(sb)->s_chksum_driver != NULL); - } - -+static inline int ext4_has_metadata_csum(struct super_block *sb) -+{ -+ WARN_ON_ONCE(EXT4_HAS_RO_COMPAT_FEATURE(sb, -+ EXT4_FEATURE_RO_COMPAT_METADATA_CSUM) && -+ !EXT4_SB(sb)->s_chksum_driver); -+ -+ return (EXT4_SB(sb)->s_chksum_driver != NULL); -+} - static inline ext4_fsblk_t ext4_blocks_count(struct ext4_super_block *es) - { - return ((ext4_fsblk_t)le32_to_cpu(es->s_blocks_count_hi) << 32) | -diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c -index 47188916dd8d..96a1ce159f51 100644 ---- a/fs/ext4/extents.c -+++ b/fs/ext4/extents.c -@@ -74,8 +74,7 @@ static int ext4_extent_block_csum_verify(struct inode *inode, - { - struct ext4_extent_tail *et; - -- if (!EXT4_HAS_RO_COMPAT_FEATURE(inode->i_sb, -- EXT4_FEATURE_RO_COMPAT_METADATA_CSUM)) -+ if (!ext4_has_metadata_csum(inode->i_sb)) - return 1; - - et = find_ext4_extent_tail(eh); -@@ -89,8 +88,7 @@ static void ext4_extent_block_csum_set(struct inode *inode, - { - struct ext4_extent_tail *et; - -- if (!EXT4_HAS_RO_COMPAT_FEATURE(inode->i_sb, -- EXT4_FEATURE_RO_COMPAT_METADATA_CSUM)) -+ if (!ext4_has_metadata_csum(inode->i_sb)) - return; - - et = find_ext4_extent_tail(eh); -diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c -index 64bb32f17903..a8d1a64d8cb0 100644 ---- a/fs/ext4/ialloc.c -+++ b/fs/ext4/ialloc.c -@@ -864,6 +864,10 @@ got: - struct buffer_head *block_bitmap_bh; - - block_bitmap_bh = ext4_read_block_bitmap(sb, group); -+ if (!block_bitmap_bh) { -+ err = -EIO; -+ goto out; -+ } - BUFFER_TRACE(block_bitmap_bh, "get block bitmap access"); - err = ext4_journal_get_write_access(handle, block_bitmap_bh); - if (err) { -@@ -988,8 +992,7 @@ got: - spin_unlock(&sbi->s_next_gen_lock); - - /* Precompute checksum seed for inode metadata */ -- if (EXT4_HAS_RO_COMPAT_FEATURE(sb, -- EXT4_FEATURE_RO_COMPAT_METADATA_CSUM)) { -+ if (ext4_has_metadata_csum(sb)) { - __u32 csum; - __le32 inum = cpu_to_le32(inode->i_ino); - __le32 gen = cpu_to_le32(inode->i_generation); -diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c -index 82edf5b93352..8c03b747021b 100644 ---- a/fs/ext4/inline.c -+++ b/fs/ext4/inline.c -@@ -1128,8 +1128,7 @@ static int ext4_finish_convert_inline_dir(handle_t *handle, - memcpy((void *)de, buf + EXT4_INLINE_DOTDOT_SIZE, - inline_size - EXT4_INLINE_DOTDOT_SIZE); - -- if (EXT4_HAS_RO_COMPAT_FEATURE(inode->i_sb, -- EXT4_FEATURE_RO_COMPAT_METADATA_CSUM)) -+ if (ext4_has_metadata_csum(inode->i_sb)) - csum_size = sizeof(struct ext4_dir_entry_tail); - - inode->i_size = inode->i_sb->s_blocksize; -diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c -index b56062dc8b62..3a7e0341447f 100644 ---- a/fs/ext4/inode.c -+++ b/fs/ext4/inode.c -@@ -83,8 +83,7 @@ static int ext4_inode_csum_verify(struct inode *inode, struct ext4_inode *raw, - - if (EXT4_SB(inode->i_sb)->s_es->s_creator_os != - cpu_to_le32(EXT4_OS_LINUX) || -- !EXT4_HAS_RO_COMPAT_FEATURE(inode->i_sb, -- EXT4_FEATURE_RO_COMPAT_METADATA_CSUM)) -+ !ext4_has_metadata_csum(inode->i_sb)) - return 1; - - provided = le16_to_cpu(raw->i_checksum_lo); -@@ -105,8 +104,7 @@ static void ext4_inode_csum_set(struct inode *inode, struct ext4_inode *raw, - - if (EXT4_SB(inode->i_sb)->s_es->s_creator_os != - cpu_to_le32(EXT4_OS_LINUX) || -- !EXT4_HAS_RO_COMPAT_FEATURE(inode->i_sb, -- EXT4_FEATURE_RO_COMPAT_METADATA_CSUM)) -+ !ext4_has_metadata_csum(inode->i_sb)) - return; - - csum = ext4_inode_csum(inode, raw, ei); -@@ -2633,6 +2631,20 @@ static int ext4_nonda_switch(struct super_block *sb) - return 0; - } - -+/* We always reserve for an inode update; the superblock could be there too */ -+static int ext4_da_write_credits(struct inode *inode, loff_t pos, unsigned len) -+{ -+ if (likely(EXT4_HAS_RO_COMPAT_FEATURE(inode->i_sb, -+ EXT4_FEATURE_RO_COMPAT_LARGE_FILE))) -+ return 1; -+ -+ if (pos + len <= 0x7fffffffULL) -+ return 1; -+ -+ /* We might need to update the superblock to set LARGE_FILE */ -+ return 2; -+} -+ - static int ext4_da_write_begin(struct file *file, struct address_space *mapping, - loff_t pos, unsigned len, unsigned flags, - struct page **pagep, void **fsdata) -@@ -2683,7 +2695,8 @@ retry_grab: - * of file which has an already mapped buffer. - */ - retry_journal: -- handle = ext4_journal_start(inode, EXT4_HT_WRITE_PAGE, 1); -+ handle = ext4_journal_start(inode, EXT4_HT_WRITE_PAGE, -+ ext4_da_write_credits(inode, pos, len)); - if (IS_ERR(handle)) { - page_cache_release(page); - return PTR_ERR(handle); -@@ -4061,8 +4074,7 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino) - ei->i_extra_isize = 0; - - /* Precompute checksum seed for inode metadata */ -- if (EXT4_HAS_RO_COMPAT_FEATURE(sb, -- EXT4_FEATURE_RO_COMPAT_METADATA_CSUM)) { -+ if (ext4_has_metadata_csum(sb)) { - struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb); - __u32 csum; - __le32 inum = cpu_to_le32(inode->i_ino); -@@ -4250,6 +4262,13 @@ bad_inode: - return ERR_PTR(ret); - } - -+struct inode *ext4_iget_normal(struct super_block *sb, unsigned long ino) -+{ -+ if (ino < EXT4_FIRST_INO(sb) && ino != EXT4_ROOT_INO) -+ return ERR_PTR(-EIO); -+ return ext4_iget(sb, ino); -+} -+ - static int ext4_inode_blocks_set(handle_t *handle, - struct ext4_inode *raw_inode, - struct ext4_inode_info *ei) -@@ -4645,8 +4664,12 @@ int ext4_setattr(struct dentry *dentry, struct iattr *attr) - ext4_orphan_del(NULL, inode); - goto err_out; - } -- } else -+ } else { -+ loff_t oldsize = inode->i_size; -+ - i_size_write(inode, attr->ia_size); -+ pagecache_isize_extended(inode, oldsize, inode->i_size); -+ } - - /* - * Blocks are going to be removed from the inode. Wait -diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c -index a2a837f00407..dfe982dee0b3 100644 ---- a/fs/ext4/ioctl.c -+++ b/fs/ext4/ioctl.c -@@ -343,8 +343,7 @@ flags_out: - if (!inode_owner_or_capable(inode)) - return -EPERM; - -- if (EXT4_HAS_RO_COMPAT_FEATURE(inode->i_sb, -- EXT4_FEATURE_RO_COMPAT_METADATA_CSUM)) { -+ if (ext4_has_metadata_csum(inode->i_sb)) { - ext4_warning(sb, "Setting inode version is not " - "supported with metadata_csum enabled."); - return -ENOTTY; -@@ -544,9 +543,17 @@ group_add_out: - } - - case EXT4_IOC_SWAP_BOOT: -+ { -+ int err; - if (!(filp->f_mode & FMODE_WRITE)) - return -EBADF; -- return swap_inode_boot_loader(sb, inode); -+ err = mnt_want_write_file(filp); -+ if (err) -+ return err; -+ err = swap_inode_boot_loader(sb, inode); -+ mnt_drop_write_file(filp); -+ return err; -+ } - - case EXT4_IOC_RESIZE_FS: { - ext4_fsblk_t n_blocks_count; -diff --git a/fs/ext4/mmp.c b/fs/ext4/mmp.c -index 04434ad3e8e0..1268a1b5afa9 100644 ---- a/fs/ext4/mmp.c -+++ b/fs/ext4/mmp.c -@@ -20,8 +20,7 @@ static __le32 ext4_mmp_csum(struct super_block *sb, struct mmp_struct *mmp) - - int ext4_mmp_csum_verify(struct super_block *sb, struct mmp_struct *mmp) - { -- if (!EXT4_HAS_RO_COMPAT_FEATURE(sb, -- EXT4_FEATURE_RO_COMPAT_METADATA_CSUM)) -+ if (!ext4_has_metadata_csum(sb)) - return 1; - - return mmp->mmp_checksum == ext4_mmp_csum(sb, mmp); -@@ -29,8 +28,7 @@ int ext4_mmp_csum_verify(struct super_block *sb, struct mmp_struct *mmp) - - void ext4_mmp_csum_set(struct super_block *sb, struct mmp_struct *mmp) - { -- if (!EXT4_HAS_RO_COMPAT_FEATURE(sb, -- EXT4_FEATURE_RO_COMPAT_METADATA_CSUM)) -+ if (!ext4_has_metadata_csum(sb)) - return; - - mmp->mmp_checksum = ext4_mmp_csum(sb, mmp); -diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c -index d050e043e884..2dcbfb6245d8 100644 ---- a/fs/ext4/namei.c -+++ b/fs/ext4/namei.c -@@ -123,8 +123,7 @@ static struct buffer_head *__ext4_read_dirblock(struct inode *inode, - "directory leaf block found instead of index block"); - return ERR_PTR(-EIO); - } -- if (!EXT4_HAS_RO_COMPAT_FEATURE(inode->i_sb, -- EXT4_FEATURE_RO_COMPAT_METADATA_CSUM) || -+ if (!ext4_has_metadata_csum(inode->i_sb) || - buffer_verified(bh)) - return bh; - -@@ -339,8 +338,7 @@ int ext4_dirent_csum_verify(struct inode *inode, struct ext4_dir_entry *dirent) - { - struct ext4_dir_entry_tail *t; - -- if (!EXT4_HAS_RO_COMPAT_FEATURE(inode->i_sb, -- EXT4_FEATURE_RO_COMPAT_METADATA_CSUM)) -+ if (!ext4_has_metadata_csum(inode->i_sb)) - return 1; - - t = get_dirent_tail(inode, dirent); -@@ -361,8 +359,7 @@ static void ext4_dirent_csum_set(struct inode *inode, - { - struct ext4_dir_entry_tail *t; - -- if (!EXT4_HAS_RO_COMPAT_FEATURE(inode->i_sb, -- EXT4_FEATURE_RO_COMPAT_METADATA_CSUM)) -+ if (!ext4_has_metadata_csum(inode->i_sb)) - return; - - t = get_dirent_tail(inode, dirent); -@@ -437,8 +434,7 @@ static int ext4_dx_csum_verify(struct inode *inode, - struct dx_tail *t; - int count_offset, limit, count; - -- if (!EXT4_HAS_RO_COMPAT_FEATURE(inode->i_sb, -- EXT4_FEATURE_RO_COMPAT_METADATA_CSUM)) -+ if (!ext4_has_metadata_csum(inode->i_sb)) - return 1; - - c = get_dx_countlimit(inode, dirent, &count_offset); -@@ -467,8 +463,7 @@ static void ext4_dx_csum_set(struct inode *inode, struct ext4_dir_entry *dirent) - struct dx_tail *t; - int count_offset, limit, count; - -- if (!EXT4_HAS_RO_COMPAT_FEATURE(inode->i_sb, -- EXT4_FEATURE_RO_COMPAT_METADATA_CSUM)) -+ if (!ext4_has_metadata_csum(inode->i_sb)) - return; - - c = get_dx_countlimit(inode, dirent, &count_offset); -@@ -556,8 +551,7 @@ static inline unsigned dx_root_limit(struct inode *dir, unsigned infosize) - unsigned entry_space = dir->i_sb->s_blocksize - EXT4_DIR_REC_LEN(1) - - EXT4_DIR_REC_LEN(2) - infosize; - -- if (EXT4_HAS_RO_COMPAT_FEATURE(dir->i_sb, -- EXT4_FEATURE_RO_COMPAT_METADATA_CSUM)) -+ if (ext4_has_metadata_csum(dir->i_sb)) - entry_space -= sizeof(struct dx_tail); - return entry_space / sizeof(struct dx_entry); - } -@@ -566,8 +560,7 @@ static inline unsigned dx_node_limit(struct inode *dir) - { - unsigned entry_space = dir->i_sb->s_blocksize - EXT4_DIR_REC_LEN(0); - -- if (EXT4_HAS_RO_COMPAT_FEATURE(dir->i_sb, -- EXT4_FEATURE_RO_COMPAT_METADATA_CSUM)) -+ if (ext4_has_metadata_csum(dir->i_sb)) - entry_space -= sizeof(struct dx_tail); - return entry_space / sizeof(struct dx_entry); - } -@@ -1429,7 +1422,7 @@ static struct dentry *ext4_lookup(struct inode *dir, struct dentry *dentry, unsi - dentry); - return ERR_PTR(-EIO); - } -- inode = ext4_iget(dir->i_sb, ino); -+ inode = ext4_iget_normal(dir->i_sb, ino); - if (inode == ERR_PTR(-ESTALE)) { - EXT4_ERROR_INODE(dir, - "deleted inode referenced: %u", -@@ -1460,7 +1453,7 @@ struct dentry *ext4_get_parent(struct dentry *child) - return ERR_PTR(-EIO); - } - -- return d_obtain_alias(ext4_iget(child->d_inode->i_sb, ino)); -+ return d_obtain_alias(ext4_iget_normal(child->d_inode->i_sb, ino)); - } - - /* -@@ -1534,8 +1527,7 @@ static struct ext4_dir_entry_2 *do_split(handle_t *handle, struct inode *dir, - int csum_size = 0; - int err = 0, i; - -- if (EXT4_HAS_RO_COMPAT_FEATURE(dir->i_sb, -- EXT4_FEATURE_RO_COMPAT_METADATA_CSUM)) -+ if (ext4_has_metadata_csum(dir->i_sb)) - csum_size = sizeof(struct ext4_dir_entry_tail); - - bh2 = ext4_append(handle, dir, &newblock); -@@ -1704,8 +1696,7 @@ static int add_dirent_to_buf(handle_t *handle, struct dentry *dentry, - int csum_size = 0; - int err; - -- if (EXT4_HAS_RO_COMPAT_FEATURE(inode->i_sb, -- EXT4_FEATURE_RO_COMPAT_METADATA_CSUM)) -+ if (ext4_has_metadata_csum(inode->i_sb)) - csum_size = sizeof(struct ext4_dir_entry_tail); - - if (!de) { -@@ -1772,8 +1763,7 @@ static int make_indexed_dir(handle_t *handle, struct dentry *dentry, - struct fake_dirent *fde; - int csum_size = 0; - -- if (EXT4_HAS_RO_COMPAT_FEATURE(inode->i_sb, -- EXT4_FEATURE_RO_COMPAT_METADATA_CSUM)) -+ if (ext4_has_metadata_csum(inode->i_sb)) - csum_size = sizeof(struct ext4_dir_entry_tail); - - blocksize = dir->i_sb->s_blocksize; -@@ -1889,8 +1879,7 @@ static int ext4_add_entry(handle_t *handle, struct dentry *dentry, - ext4_lblk_t block, blocks; - int csum_size = 0; - -- if (EXT4_HAS_RO_COMPAT_FEATURE(inode->i_sb, -- EXT4_FEATURE_RO_COMPAT_METADATA_CSUM)) -+ if (ext4_has_metadata_csum(inode->i_sb)) - csum_size = sizeof(struct ext4_dir_entry_tail); - - sb = dir->i_sb; -@@ -2152,8 +2141,7 @@ static int ext4_delete_entry(handle_t *handle, - return err; - } - -- if (EXT4_HAS_RO_COMPAT_FEATURE(dir->i_sb, -- EXT4_FEATURE_RO_COMPAT_METADATA_CSUM)) -+ if (ext4_has_metadata_csum(dir->i_sb)) - csum_size = sizeof(struct ext4_dir_entry_tail); - - BUFFER_TRACE(bh, "get_write_access"); -@@ -2372,8 +2360,7 @@ static int ext4_init_new_dir(handle_t *handle, struct inode *dir, - int csum_size = 0; - int err; - -- if (EXT4_HAS_RO_COMPAT_FEATURE(dir->i_sb, -- EXT4_FEATURE_RO_COMPAT_METADATA_CSUM)) -+ if (ext4_has_metadata_csum(dir->i_sb)) - csum_size = sizeof(struct ext4_dir_entry_tail); - - if (ext4_test_inode_state(inode, EXT4_STATE_MAY_INLINE_DATA)) { -diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c -index f3b84cd9de56..2400ad1c3d12 100644 ---- a/fs/ext4/resize.c -+++ b/fs/ext4/resize.c -@@ -1071,7 +1071,7 @@ static void update_backups(struct super_block *sb, int blk_off, char *data, - break; - - if (meta_bg == 0) -- backup_block = group * bpg + blk_off; -+ backup_block = ((ext4_fsblk_t)group) * bpg + blk_off; - else - backup_block = (ext4_group_first_block_no(sb, group) + - ext4_bg_has_super(sb, group)); -@@ -1200,8 +1200,7 @@ static int ext4_set_bitmap_checksums(struct super_block *sb, - { - struct buffer_head *bh; - -- if (!EXT4_HAS_RO_COMPAT_FEATURE(sb, -- EXT4_FEATURE_RO_COMPAT_METADATA_CSUM)) -+ if (!ext4_has_metadata_csum(sb)) - return 0; - - bh = ext4_get_bitmap(sb, group_data->inode_bitmap); -diff --git a/fs/ext4/super.c b/fs/ext4/super.c -index a46030d6b4af..9fb3e6c0c578 100644 ---- a/fs/ext4/super.c -+++ b/fs/ext4/super.c -@@ -140,8 +140,7 @@ static __le32 ext4_superblock_csum(struct super_block *sb, - int ext4_superblock_csum_verify(struct super_block *sb, - struct ext4_super_block *es) - { -- if (!EXT4_HAS_RO_COMPAT_FEATURE(sb, -- EXT4_FEATURE_RO_COMPAT_METADATA_CSUM)) -+ if (!ext4_has_metadata_csum(sb)) - return 1; - - return es->s_checksum == ext4_superblock_csum(sb, es); -@@ -151,8 +150,7 @@ void ext4_superblock_csum_set(struct super_block *sb) - { - struct ext4_super_block *es = EXT4_SB(sb)->s_es; - -- if (!EXT4_HAS_RO_COMPAT_FEATURE(sb, -- EXT4_FEATURE_RO_COMPAT_METADATA_CSUM)) -+ if (!ext4_has_metadata_csum(sb)) - return; - - es->s_checksum = ext4_superblock_csum(sb, es); -@@ -996,7 +994,7 @@ static struct inode *ext4_nfs_get_inode(struct super_block *sb, - * Currently we don't know the generation for parent directory, so - * a generation of 0 means "accept any" - */ -- inode = ext4_iget(sb, ino); -+ inode = ext4_iget_normal(sb, ino); - if (IS_ERR(inode)) - return ERR_CAST(inode); - if (generation && inode->i_generation != generation) { -@@ -1706,13 +1704,6 @@ static int parse_options(char *options, struct super_block *sb, - "not specified"); - return 0; - } -- } else { -- if (sbi->s_jquota_fmt) { -- ext4_msg(sb, KERN_ERR, "journaled quota format " -- "specified with no journaling " -- "enabled"); -- return 0; -- } - } - #endif - if (test_opt(sb, DIOREAD_NOLOCK)) { -@@ -2010,8 +2001,7 @@ static __le16 ext4_group_desc_csum(struct ext4_sb_info *sbi, __u32 block_group, - __u16 crc = 0; - __le32 le_group = cpu_to_le32(block_group); - -- if ((sbi->s_es->s_feature_ro_compat & -- cpu_to_le32(EXT4_FEATURE_RO_COMPAT_METADATA_CSUM))) { -+ if (ext4_has_metadata_csum(sbi->s_sb)) { - /* Use new metadata_csum algorithm */ - __le16 save_csum; - __u32 csum32; -@@ -2029,6 +2019,10 @@ static __le16 ext4_group_desc_csum(struct ext4_sb_info *sbi, __u32 block_group, - } - - /* old crc16 code */ -+ if (!(sbi->s_es->s_feature_ro_compat & -+ cpu_to_le32(EXT4_FEATURE_RO_COMPAT_GDT_CSUM))) -+ return 0; -+ - offset = offsetof(struct ext4_group_desc, bg_checksum); - - crc = crc16(~0, sbi->s_es->s_uuid, sizeof(sbi->s_es->s_uuid)); -@@ -3167,8 +3161,7 @@ static int set_journal_csum_feature_set(struct super_block *sb) - int compat, incompat; - struct ext4_sb_info *sbi = EXT4_SB(sb); - -- if (EXT4_HAS_RO_COMPAT_FEATURE(sb, -- EXT4_FEATURE_RO_COMPAT_METADATA_CSUM)) { -+ if (ext4_has_metadata_csum(sb)) { - /* journal checksum v3 */ - compat = 0; - incompat = JBD2_FEATURE_INCOMPAT_CSUM_V3; -@@ -3475,8 +3468,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) - } - - /* Precompute checksum seed for all metadata */ -- if (EXT4_HAS_RO_COMPAT_FEATURE(sb, -- EXT4_FEATURE_RO_COMPAT_METADATA_CSUM)) -+ if (ext4_has_metadata_csum(sb)) - sbi->s_csum_seed = ext4_chksum(sbi, ~0, es->s_uuid, - sizeof(es->s_uuid)); - -@@ -3494,6 +3486,10 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) - #ifdef CONFIG_EXT4_FS_POSIX_ACL - set_opt(sb, POSIX_ACL); - #endif -+ /* don't forget to enable journal_csum when metadata_csum is enabled. */ -+ if (ext4_has_metadata_csum(sb)) -+ set_opt(sb, JOURNAL_CHECKSUM); -+ - if ((def_mount_opts & EXT4_DEFM_JMODE) == EXT4_DEFM_JMODE_DATA) - set_opt(sb, JOURNAL_DATA); - else if ((def_mount_opts & EXT4_DEFM_JMODE) == EXT4_DEFM_JMODE_ORDERED) -diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c -index 55e611c1513c..8825154b20b6 100644 ---- a/fs/ext4/xattr.c -+++ b/fs/ext4/xattr.c -@@ -141,8 +141,7 @@ static int ext4_xattr_block_csum_verify(struct inode *inode, - sector_t block_nr, - struct ext4_xattr_header *hdr) - { -- if (EXT4_HAS_RO_COMPAT_FEATURE(inode->i_sb, -- EXT4_FEATURE_RO_COMPAT_METADATA_CSUM) && -+ if (ext4_has_metadata_csum(inode->i_sb) && - (hdr->h_checksum != ext4_xattr_block_csum(inode, block_nr, hdr))) - return 0; - return 1; -@@ -152,8 +151,7 @@ static void ext4_xattr_block_csum_set(struct inode *inode, - sector_t block_nr, - struct ext4_xattr_header *hdr) - { -- if (!EXT4_HAS_RO_COMPAT_FEATURE(inode->i_sb, -- EXT4_FEATURE_RO_COMPAT_METADATA_CSUM)) -+ if (!ext4_has_metadata_csum(inode->i_sb)) - return; - - hdr->h_checksum = ext4_xattr_block_csum(inode, block_nr, hdr); -@@ -189,14 +187,28 @@ ext4_listxattr(struct dentry *dentry, char *buffer, size_t size) - } - - static int --ext4_xattr_check_names(struct ext4_xattr_entry *entry, void *end) -+ext4_xattr_check_names(struct ext4_xattr_entry *entry, void *end, -+ void *value_start) - { -- while (!IS_LAST_ENTRY(entry)) { -- struct ext4_xattr_entry *next = EXT4_XATTR_NEXT(entry); -+ struct ext4_xattr_entry *e = entry; -+ -+ while (!IS_LAST_ENTRY(e)) { -+ struct ext4_xattr_entry *next = EXT4_XATTR_NEXT(e); - if ((void *)next >= end) - return -EIO; -- entry = next; -+ e = next; - } -+ -+ while (!IS_LAST_ENTRY(entry)) { -+ if (entry->e_value_size != 0 && -+ (value_start + le16_to_cpu(entry->e_value_offs) < -+ (void *)e + sizeof(__u32) || -+ value_start + le16_to_cpu(entry->e_value_offs) + -+ le32_to_cpu(entry->e_value_size) > end)) -+ return -EIO; -+ entry = EXT4_XATTR_NEXT(entry); -+ } -+ - return 0; - } - -@@ -213,7 +225,8 @@ ext4_xattr_check_block(struct inode *inode, struct buffer_head *bh) - return -EIO; - if (!ext4_xattr_block_csum_verify(inode, bh->b_blocknr, BHDR(bh))) - return -EIO; -- error = ext4_xattr_check_names(BFIRST(bh), bh->b_data + bh->b_size); -+ error = ext4_xattr_check_names(BFIRST(bh), bh->b_data + bh->b_size, -+ bh->b_data); - if (!error) - set_buffer_verified(bh); - return error; -@@ -329,7 +342,7 @@ ext4_xattr_ibody_get(struct inode *inode, int name_index, const char *name, - header = IHDR(inode, raw_inode); - entry = IFIRST(header); - end = (void *)raw_inode + EXT4_SB(inode->i_sb)->s_inode_size; -- error = ext4_xattr_check_names(entry, end); -+ error = ext4_xattr_check_names(entry, end, entry); - if (error) - goto cleanup; - error = ext4_xattr_find_entry(&entry, name_index, name, -@@ -457,7 +470,7 @@ ext4_xattr_ibody_list(struct dentry *dentry, char *buffer, size_t buffer_size) - raw_inode = ext4_raw_inode(&iloc); - header = IHDR(inode, raw_inode); - end = (void *)raw_inode + EXT4_SB(inode->i_sb)->s_inode_size; -- error = ext4_xattr_check_names(IFIRST(header), end); -+ error = ext4_xattr_check_names(IFIRST(header), end, IFIRST(header)); - if (error) - goto cleanup; - error = ext4_xattr_list_entries(dentry, IFIRST(header), -@@ -972,7 +985,8 @@ int ext4_xattr_ibody_find(struct inode *inode, struct ext4_xattr_info *i, - is->s.here = is->s.first; - is->s.end = (void *)raw_inode + EXT4_SB(inode->i_sb)->s_inode_size; - if (ext4_test_inode_state(inode, EXT4_STATE_XATTR)) { -- error = ext4_xattr_check_names(IFIRST(header), is->s.end); -+ error = ext4_xattr_check_names(IFIRST(header), is->s.end, -+ IFIRST(header)); - if (error) - return error; - /* Find the named attribute. */ -diff --git a/fs/jbd2/recovery.c b/fs/jbd2/recovery.c -index 9b329b55ffe3..bcbef08a4d8f 100644 ---- a/fs/jbd2/recovery.c -+++ b/fs/jbd2/recovery.c -@@ -525,6 +525,7 @@ static int do_one_pass(journal_t *journal, - !jbd2_descr_block_csum_verify(journal, - bh->b_data)) { - err = -EIO; -+ brelse(bh); - goto failed; - } - -diff --git a/fs/jffs2/jffs2_fs_sb.h b/fs/jffs2/jffs2_fs_sb.h -index 413ef89c2d1b..046fee8b6e9b 100644 ---- a/fs/jffs2/jffs2_fs_sb.h -+++ b/fs/jffs2/jffs2_fs_sb.h -@@ -134,8 +134,6 @@ struct jffs2_sb_info { - struct rw_semaphore wbuf_sem; /* Protects the write buffer */ - - struct delayed_work wbuf_dwork; /* write-buffer write-out work */ -- int wbuf_queued; /* non-zero delayed work is queued */ -- spinlock_t wbuf_dwork_lock; /* protects wbuf_dwork and and wbuf_queued */ - - unsigned char *oobbuf; - int oobavail; /* How many bytes are available for JFFS2 in OOB */ -diff --git a/fs/jffs2/wbuf.c b/fs/jffs2/wbuf.c -index a6597d60d76d..09ed55190ee2 100644 ---- a/fs/jffs2/wbuf.c -+++ b/fs/jffs2/wbuf.c -@@ -1162,10 +1162,6 @@ static void delayed_wbuf_sync(struct work_struct *work) - struct jffs2_sb_info *c = work_to_sb(work); - struct super_block *sb = OFNI_BS_2SFFJ(c); - -- spin_lock(&c->wbuf_dwork_lock); -- c->wbuf_queued = 0; -- spin_unlock(&c->wbuf_dwork_lock); -- - if (!(sb->s_flags & MS_RDONLY)) { - jffs2_dbg(1, "%s()\n", __func__); - jffs2_flush_wbuf_gc(c, 0); -@@ -1180,14 +1176,9 @@ void jffs2_dirty_trigger(struct jffs2_sb_info *c) - if (sb->s_flags & MS_RDONLY) - return; - -- spin_lock(&c->wbuf_dwork_lock); -- if (!c->wbuf_queued) { -+ delay = msecs_to_jiffies(dirty_writeback_interval * 10); -+ if (queue_delayed_work(system_long_wq, &c->wbuf_dwork, delay)) - jffs2_dbg(1, "%s()\n", __func__); -- delay = msecs_to_jiffies(dirty_writeback_interval * 10); -- queue_delayed_work(system_long_wq, &c->wbuf_dwork, delay); -- c->wbuf_queued = 1; -- } -- spin_unlock(&c->wbuf_dwork_lock); - } - - int jffs2_nand_flash_setup(struct jffs2_sb_info *c) -@@ -1211,7 +1202,6 @@ int jffs2_nand_flash_setup(struct jffs2_sb_info *c) - - /* Initialise write buffer */ - init_rwsem(&c->wbuf_sem); -- spin_lock_init(&c->wbuf_dwork_lock); - INIT_DELAYED_WORK(&c->wbuf_dwork, delayed_wbuf_sync); - c->wbuf_pagesize = c->mtd->writesize; - c->wbuf_ofs = 0xFFFFFFFF; -@@ -1251,7 +1241,6 @@ int jffs2_dataflash_setup(struct jffs2_sb_info *c) { - - /* Initialize write buffer */ - init_rwsem(&c->wbuf_sem); -- spin_lock_init(&c->wbuf_dwork_lock); - INIT_DELAYED_WORK(&c->wbuf_dwork, delayed_wbuf_sync); - c->wbuf_pagesize = c->mtd->erasesize; - -@@ -1311,7 +1300,6 @@ int jffs2_nor_wbuf_flash_setup(struct jffs2_sb_info *c) { - - /* Initialize write buffer */ - init_rwsem(&c->wbuf_sem); -- spin_lock_init(&c->wbuf_dwork_lock); - INIT_DELAYED_WORK(&c->wbuf_dwork, delayed_wbuf_sync); - - c->wbuf_pagesize = c->mtd->writesize; -@@ -1346,7 +1334,6 @@ int jffs2_ubivol_setup(struct jffs2_sb_info *c) { - return 0; - - init_rwsem(&c->wbuf_sem); -- spin_lock_init(&c->wbuf_dwork_lock); - INIT_DELAYED_WORK(&c->wbuf_dwork, delayed_wbuf_sync); - - c->wbuf_pagesize = c->mtd->writesize; -diff --git a/fs/lockd/mon.c b/fs/lockd/mon.c -index 1812f026960c..6ae664b489af 100644 ---- a/fs/lockd/mon.c -+++ b/fs/lockd/mon.c -@@ -159,6 +159,12 @@ static int nsm_mon_unmon(struct nsm_handle *nsm, u32 proc, struct nsm_res *res, - - msg.rpc_proc = &clnt->cl_procinfo[proc]; - status = rpc_call_sync(clnt, &msg, RPC_TASK_SOFTCONN); -+ if (status == -ECONNREFUSED) { -+ dprintk("lockd: NSM upcall RPC failed, status=%d, forcing rebind\n", -+ status); -+ rpc_force_rebind(clnt); -+ status = rpc_call_sync(clnt, &msg, RPC_TASK_SOFTCONN); -+ } - if (status < 0) - dprintk("lockd: NSM upcall RPC failed, status=%d\n", - status); -diff --git a/fs/namei.c b/fs/namei.c -index dd2f2c5bda55..0dd72c8e65fd 100644 ---- a/fs/namei.c -+++ b/fs/namei.c -@@ -3128,7 +3128,8 @@ static int do_tmpfile(int dfd, struct filename *pathname, - if (error) - goto out2; - audit_inode(pathname, nd->path.dentry, 0); -- error = may_open(&nd->path, op->acc_mode, op->open_flag); -+ /* Don't check for other permissions, the inode was just created */ -+ error = may_open(&nd->path, MAY_OPEN, op->open_flag); - if (error) - goto out2; - file->f_path.mnt = nd->path.mnt; -diff --git a/fs/namespace.c b/fs/namespace.c -index c7d4a0ae2c65..d9bf3efbf040 100644 ---- a/fs/namespace.c -+++ b/fs/namespace.c -@@ -2831,6 +2831,9 @@ SYSCALL_DEFINE2(pivot_root, const char __user *, new_root, - /* make sure we can reach put_old from new_root */ - if (!is_path_reachable(old_mnt, old.dentry, &new)) - goto out4; -+ /* make certain new is below the root */ -+ if (!is_path_reachable(new_mnt, new.dentry, &root)) -+ goto out4; - root_mp->m_count++; /* pin it so it won't go away */ - lock_mount_hash(); - detach_mnt(new_mnt, &parent_path); -diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c -index f23a6ca37504..86f5d3e474bf 100644 ---- a/fs/nfsd/nfs4proc.c -+++ b/fs/nfsd/nfs4proc.c -@@ -1243,7 +1243,8 @@ static bool need_wrongsec_check(struct svc_rqst *rqstp) - */ - if (argp->opcnt == resp->opcnt) - return false; -- -+ if (next->opnum == OP_ILLEGAL) -+ return false; - nextd = OPDESC(next); - /* - * Rest of 2.6.3.1.1: certain operations will return WRONGSEC -diff --git a/fs/pstore/inode.c b/fs/pstore/inode.c -index 12823845d324..14120a3c6195 100644 ---- a/fs/pstore/inode.c -+++ b/fs/pstore/inode.c -@@ -319,10 +319,10 @@ int pstore_mkfile(enum pstore_type_id type, char *psname, u64 id, int count, - compressed ? ".enc.z" : ""); - break; - case PSTORE_TYPE_CONSOLE: -- sprintf(name, "console-%s", psname); -+ sprintf(name, "console-%s-%lld", psname, id); - break; - case PSTORE_TYPE_FTRACE: -- sprintf(name, "ftrace-%s", psname); -+ sprintf(name, "ftrace-%s-%lld", psname, id); - break; - case PSTORE_TYPE_MCE: - sprintf(name, "mce-%s-%lld", psname, id); -diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c -index ce87c9007b0f..89da95700c69 100644 ---- a/fs/quota/dquot.c -+++ b/fs/quota/dquot.c -@@ -637,7 +637,7 @@ int dquot_writeback_dquots(struct super_block *sb, int type) - dqstats_inc(DQST_LOOKUPS); - err = sb->dq_op->write_dquot(dquot); - if (!ret && err) -- err = ret; -+ ret = err; - dqput(dquot); - spin_lock(&dq_list_lock); - } -diff --git a/fs/super.c b/fs/super.c -index 7624267b2043..88a6bc6e3cc9 100644 ---- a/fs/super.c -+++ b/fs/super.c -@@ -81,6 +81,8 @@ static unsigned long super_cache_scan(struct shrinker *shrink, - inodes = list_lru_count_node(&sb->s_inode_lru, sc->nid); - dentries = list_lru_count_node(&sb->s_dentry_lru, sc->nid); - total_objects = dentries + inodes + fs_objects + 1; -+ if (!total_objects) -+ total_objects = 1; - - /* proportion the scan between the caches */ - dentries = mult_frac(sc->nr_to_scan, dentries, total_objects); -diff --git a/fs/ubifs/commit.c b/fs/ubifs/commit.c -index ff8229340cd5..26b69b2d4a45 100644 ---- a/fs/ubifs/commit.c -+++ b/fs/ubifs/commit.c -@@ -166,15 +166,10 @@ static int do_commit(struct ubifs_info *c) - err = ubifs_orphan_end_commit(c); - if (err) - goto out; -- old_ltail_lnum = c->ltail_lnum; -- err = ubifs_log_end_commit(c, new_ltail_lnum); -- if (err) -- goto out; - err = dbg_check_old_index(c, &zroot); - if (err) - goto out; - -- mutex_lock(&c->mst_mutex); - c->mst_node->cmt_no = cpu_to_le64(c->cmt_no); - c->mst_node->log_lnum = cpu_to_le32(new_ltail_lnum); - c->mst_node->root_lnum = cpu_to_le32(zroot.lnum); -@@ -203,8 +198,9 @@ static int do_commit(struct ubifs_info *c) - c->mst_node->flags |= cpu_to_le32(UBIFS_MST_NO_ORPHS); - else - c->mst_node->flags &= ~cpu_to_le32(UBIFS_MST_NO_ORPHS); -- err = ubifs_write_master(c); -- mutex_unlock(&c->mst_mutex); -+ -+ old_ltail_lnum = c->ltail_lnum; -+ err = ubifs_log_end_commit(c, new_ltail_lnum); - if (err) - goto out; - -diff --git a/fs/ubifs/log.c b/fs/ubifs/log.c -index a902c5919e42..8d59de86dc9a 100644 ---- a/fs/ubifs/log.c -+++ b/fs/ubifs/log.c -@@ -106,10 +106,14 @@ static inline long long empty_log_bytes(const struct ubifs_info *c) - h = (long long)c->lhead_lnum * c->leb_size + c->lhead_offs; - t = (long long)c->ltail_lnum * c->leb_size; - -- if (h >= t) -+ if (h > t) - return c->log_bytes - h + t; -- else -+ else if (h != t) - return t - h; -+ else if (c->lhead_lnum != c->ltail_lnum) -+ return 0; -+ else -+ return c->log_bytes; - } - - /** -@@ -447,9 +451,9 @@ out: - * @ltail_lnum: new log tail LEB number - * - * This function is called on when the commit operation was finished. It -- * moves log tail to new position and unmaps LEBs which contain obsolete data. -- * Returns zero in case of success and a negative error code in case of -- * failure. -+ * moves log tail to new position and updates the master node so that it stores -+ * the new log tail LEB number. Returns zero in case of success and a negative -+ * error code in case of failure. - */ - int ubifs_log_end_commit(struct ubifs_info *c, int ltail_lnum) - { -@@ -477,7 +481,12 @@ int ubifs_log_end_commit(struct ubifs_info *c, int ltail_lnum) - spin_unlock(&c->buds_lock); - - err = dbg_check_bud_bytes(c); -+ if (err) -+ goto out; - -+ err = ubifs_write_master(c); -+ -+out: - mutex_unlock(&c->log_mutex); - return err; - } -diff --git a/fs/ubifs/master.c b/fs/ubifs/master.c -index ab83ace9910a..1a4bb9e8b3b8 100644 ---- a/fs/ubifs/master.c -+++ b/fs/ubifs/master.c -@@ -352,10 +352,9 @@ int ubifs_read_master(struct ubifs_info *c) - * ubifs_write_master - write master node. - * @c: UBIFS file-system description object - * -- * This function writes the master node. The caller has to take the -- * @c->mst_mutex lock before calling this function. Returns zero in case of -- * success and a negative error code in case of failure. The master node is -- * written twice to enable recovery. -+ * This function writes the master node. Returns zero in case of success and a -+ * negative error code in case of failure. The master node is written twice to -+ * enable recovery. - */ - int ubifs_write_master(struct ubifs_info *c) - { -diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c -index 5ded8490c0c6..94d9a64287b7 100644 ---- a/fs/ubifs/super.c -+++ b/fs/ubifs/super.c -@@ -1957,7 +1957,6 @@ static struct ubifs_info *alloc_ubifs_info(struct ubi_volume_desc *ubi) - mutex_init(&c->lp_mutex); - mutex_init(&c->tnc_mutex); - mutex_init(&c->log_mutex); -- mutex_init(&c->mst_mutex); - mutex_init(&c->umount_mutex); - mutex_init(&c->bu_mutex); - mutex_init(&c->write_reserve_mutex); -diff --git a/fs/ubifs/ubifs.h b/fs/ubifs/ubifs.h -index e8c8cfe1435c..7ab9c710c749 100644 ---- a/fs/ubifs/ubifs.h -+++ b/fs/ubifs/ubifs.h -@@ -1042,7 +1042,6 @@ struct ubifs_debug_info; - * - * @mst_node: master node - * @mst_offs: offset of valid master node -- * @mst_mutex: protects the master node area, @mst_node, and @mst_offs - * - * @max_bu_buf_len: maximum bulk-read buffer length - * @bu_mutex: protects the pre-allocated bulk-read buffer and @c->bu -@@ -1282,7 +1281,6 @@ struct ubifs_info { - - struct ubifs_mst_node *mst_node; - int mst_offs; -- struct mutex mst_mutex; - - int max_bu_buf_len; - struct mutex bu_mutex; -diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c -index c6ff3cf5a5bb..0eaaa2d296f0 100644 ---- a/fs/xfs/xfs_mount.c -+++ b/fs/xfs/xfs_mount.c -@@ -321,7 +321,6 @@ reread: - * Initialize the mount structure from the superblock. - */ - xfs_sb_from_disk(sbp, XFS_BUF_TO_SBP(bp)); -- xfs_sb_quota_from_disk(sbp); - - /* - * If we haven't validated the superblock, do so now before we try -diff --git a/fs/xfs/xfs_sb.c b/fs/xfs/xfs_sb.c -index 1e116794bb66..4afd393846d3 100644 ---- a/fs/xfs/xfs_sb.c -+++ b/fs/xfs/xfs_sb.c -@@ -397,10 +397,11 @@ xfs_sb_quota_from_disk(struct xfs_sb *sbp) - } - } - --void --xfs_sb_from_disk( -+static void -+__xfs_sb_from_disk( - struct xfs_sb *to, -- xfs_dsb_t *from) -+ xfs_dsb_t *from, -+ bool convert_xquota) - { - to->sb_magicnum = be32_to_cpu(from->sb_magicnum); - to->sb_blocksize = be32_to_cpu(from->sb_blocksize); -@@ -456,6 +457,17 @@ xfs_sb_from_disk( - to->sb_pad = 0; - to->sb_pquotino = be64_to_cpu(from->sb_pquotino); - to->sb_lsn = be64_to_cpu(from->sb_lsn); -+ /* Convert on-disk flags to in-memory flags? */ -+ if (convert_xquota) -+ xfs_sb_quota_from_disk(to); -+} -+ -+void -+xfs_sb_from_disk( -+ struct xfs_sb *to, -+ xfs_dsb_t *from) -+{ -+ __xfs_sb_from_disk(to, from, true); - } - - static inline void -@@ -571,7 +583,11 @@ xfs_sb_verify( - struct xfs_mount *mp = bp->b_target->bt_mount; - struct xfs_sb sb; - -- xfs_sb_from_disk(&sb, XFS_BUF_TO_SBP(bp)); -+ /* -+ * Use call variant which doesn't convert quota flags from disk -+ * format, because xfs_mount_validate_sb checks the on-disk flags. -+ */ -+ __xfs_sb_from_disk(&sb, XFS_BUF_TO_SBP(bp), false); - - /* - * Only check the in progress field for the primary superblock as -diff --git a/include/drm/drm_pciids.h b/include/drm/drm_pciids.h -index bcec4c46cc2e..ca52de5a5c97 100644 ---- a/include/drm/drm_pciids.h -+++ b/include/drm/drm_pciids.h -@@ -74,7 +74,6 @@ - {0x1002, 0x4C64, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV250|RADEON_IS_MOBILITY}, \ - {0x1002, 0x4C66, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV250|RADEON_IS_MOBILITY}, \ - {0x1002, 0x4C67, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV250|RADEON_IS_MOBILITY}, \ -- {0x1002, 0x4C6E, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280|RADEON_IS_MOBILITY}, \ - {0x1002, 0x4E44, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R300}, \ - {0x1002, 0x4E45, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R300}, \ - {0x1002, 0x4E46, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R300}, \ -diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h -index 4afa4f8f6090..a693c6d29328 100644 ---- a/include/linux/blkdev.h -+++ b/include/linux/blkdev.h -@@ -1232,10 +1232,9 @@ static inline int queue_alignment_offset(struct request_queue *q) - static inline int queue_limit_alignment_offset(struct queue_limits *lim, sector_t sector) - { - unsigned int granularity = max(lim->physical_block_size, lim->io_min); -- unsigned int alignment = (sector << 9) & (granularity - 1); -+ unsigned int alignment = sector_div(sector, granularity >> 9) << 9; - -- return (granularity + lim->alignment_offset - alignment) -- & (granularity - 1); -+ return (granularity + lim->alignment_offset - alignment) % granularity; - } - - static inline int bdev_alignment_offset(struct block_device *bdev) -diff --git a/include/linux/hid.h b/include/linux/hid.h -index 31b9d299ef6c..00c88fccd162 100644 ---- a/include/linux/hid.h -+++ b/include/linux/hid.h -@@ -286,6 +286,7 @@ struct hid_item { - #define HID_QUIRK_HIDINPUT_FORCE 0x00000080 - #define HID_QUIRK_NO_EMPTY_INPUT 0x00000100 - #define HID_QUIRK_NO_INIT_INPUT_REPORTS 0x00000200 -+#define HID_QUIRK_ALWAYS_POLL 0x00000400 - #define HID_QUIRK_SKIP_OUTPUT_REPORTS 0x00010000 - #define HID_QUIRK_FULLSPEED_INTERVAL 0x10000000 - #define HID_QUIRK_NO_INIT_REPORTS 0x20000000 -diff --git a/include/linux/mm.h b/include/linux/mm.h -index c1b7414c7bef..0a0b024ec7e8 100644 ---- a/include/linux/mm.h -+++ b/include/linux/mm.h -@@ -1123,6 +1123,7 @@ static inline void unmap_shared_mapping_range(struct address_space *mapping, - - extern void truncate_pagecache(struct inode *inode, loff_t new); - extern void truncate_setsize(struct inode *inode, loff_t newsize); -+void pagecache_isize_extended(struct inode *inode, loff_t from, loff_t to); - void truncate_pagecache_range(struct inode *inode, loff_t offset, loff_t end); - int truncate_inode_page(struct address_space *mapping, struct page *page); - int generic_error_remove_page(struct address_space *mapping, struct page *page); -diff --git a/include/linux/of.h b/include/linux/of.h -index 435cb995904d..3f8144dadaef 100644 ---- a/include/linux/of.h -+++ b/include/linux/of.h -@@ -215,14 +215,12 @@ extern int of_property_read_u64(const struct device_node *np, - extern int of_property_read_string(struct device_node *np, - const char *propname, - const char **out_string); --extern int of_property_read_string_index(struct device_node *np, -- const char *propname, -- int index, const char **output); - extern int of_property_match_string(struct device_node *np, - const char *propname, - const char *string); --extern int of_property_count_strings(struct device_node *np, -- const char *propname); -+extern int of_property_read_string_helper(struct device_node *np, -+ const char *propname, -+ const char **out_strs, size_t sz, int index); - extern int of_device_is_compatible(const struct device_node *device, - const char *); - extern int of_device_is_available(const struct device_node *device); -@@ -422,15 +420,9 @@ static inline int of_property_read_string(struct device_node *np, - return -ENOSYS; - } - --static inline int of_property_read_string_index(struct device_node *np, -- const char *propname, int index, -- const char **out_string) --{ -- return -ENOSYS; --} -- --static inline int of_property_count_strings(struct device_node *np, -- const char *propname) -+static inline int of_property_read_string_helper(struct device_node *np, -+ const char *propname, -+ const char **out_strs, size_t sz, int index) - { - return -ENOSYS; - } -@@ -536,6 +528,70 @@ static inline struct device_node *of_find_matching_node( - } - - /** -+ * of_property_read_string_array() - Read an array of strings from a multiple -+ * strings property. -+ * @np: device node from which the property value is to be read. -+ * @propname: name of the property to be searched. -+ * @out_strs: output array of string pointers. -+ * @sz: number of array elements to read. -+ * -+ * Search for a property in a device tree node and retrieve a list of -+ * terminated string values (pointer to data, not a copy) in that property. -+ * -+ * If @out_strs is NULL, the number of strings in the property is returned. -+ */ -+static inline int of_property_read_string_array(struct device_node *np, -+ const char *propname, const char **out_strs, -+ size_t sz) -+{ -+ return of_property_read_string_helper(np, propname, out_strs, sz, 0); -+} -+ -+/** -+ * of_property_count_strings() - Find and return the number of strings from a -+ * multiple strings property. -+ * @np: device node from which the property value is to be read. -+ * @propname: name of the property to be searched. -+ * -+ * Search for a property in a device tree node and retrieve the number of null -+ * terminated string contain in it. Returns the number of strings on -+ * success, -EINVAL if the property does not exist, -ENODATA if property -+ * does not have a value, and -EILSEQ if the string is not null-terminated -+ * within the length of the property data. -+ */ -+static inline int of_property_count_strings(struct device_node *np, -+ const char *propname) -+{ -+ return of_property_read_string_helper(np, propname, NULL, 0, 0); -+} -+ -+/** -+ * of_property_read_string_index() - Find and read a string from a multiple -+ * strings property. -+ * @np: device node from which the property value is to be read. -+ * @propname: name of the property to be searched. -+ * @index: index of the string in the list of strings -+ * @out_string: pointer to null terminated return string, modified only if -+ * return value is 0. -+ * -+ * Search for a property in a device tree node and retrieve a null -+ * terminated string value (pointer to data, not a copy) in the list of strings -+ * contained in that property. -+ * Returns 0 on success, -EINVAL if the property does not exist, -ENODATA if -+ * property does not have a value, and -EILSEQ if the string is not -+ * null-terminated within the length of the property data. -+ * -+ * The out_string pointer is modified only if a valid string can be decoded. -+ */ -+static inline int of_property_read_string_index(struct device_node *np, -+ const char *propname, -+ int index, const char **output) -+{ -+ int rc = of_property_read_string_helper(np, propname, output, 1, index); -+ return rc < 0 ? rc : 0; -+} -+ -+/** - * of_property_read_bool - Findfrom a property - * @np: device node from which the property value is to be read. - * @propname: name of the property to be searched. -diff --git a/include/linux/oom.h b/include/linux/oom.h -index 4cd62677feb9..17f0949bd822 100644 ---- a/include/linux/oom.h -+++ b/include/linux/oom.h -@@ -50,6 +50,9 @@ static inline bool oom_task_origin(const struct task_struct *p) - extern unsigned long oom_badness(struct task_struct *p, - struct mem_cgroup *memcg, const nodemask_t *nodemask, - unsigned long totalpages); -+ -+extern int oom_kills_count(void); -+extern void note_oom_kill(void); - extern void oom_kill_process(struct task_struct *p, gfp_t gfp_mask, int order, - unsigned int points, unsigned long totalpages, - struct mem_cgroup *memcg, nodemask_t *nodemask, -diff --git a/include/linux/string.h b/include/linux/string.h -index ac889c5ea11b..0ed878d0465c 100644 ---- a/include/linux/string.h -+++ b/include/linux/string.h -@@ -129,7 +129,7 @@ int bprintf(u32 *bin_buf, size_t size, const char *fmt, ...) __printf(3, 4); - #endif - - extern ssize_t memory_read_from_buffer(void *to, size_t count, loff_t *ppos, -- const void *from, size_t available); -+ const void *from, size_t available); - - /** - * strstarts - does @str start with @prefix? -@@ -141,7 +141,8 @@ static inline bool strstarts(const char *str, const char *prefix) - return strncmp(str, prefix, strlen(prefix)) == 0; - } - --extern size_t memweight(const void *ptr, size_t bytes); -+size_t memweight(const void *ptr, size_t bytes); -+void memzero_explicit(void *s, size_t count); - - /** - * kbasename - return the last part of a pathname. -diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h -index 8097b9df6773..51009d280ac7 100644 ---- a/include/linux/sunrpc/xprt.h -+++ b/include/linux/sunrpc/xprt.h -@@ -340,6 +340,7 @@ int xs_swapper(struct rpc_xprt *xprt, int enable); - #define XPRT_CONNECTION_ABORT (7) - #define XPRT_CONNECTION_CLOSE (8) - #define XPRT_CONGESTED (9) -+#define XPRT_CONNECTION_REUSE (10) - - static inline void xprt_set_connected(struct rpc_xprt *xprt) - { -diff --git a/include/linux/usb/quirks.h b/include/linux/usb/quirks.h -index 49587dc22f5d..8b96ae2a38fe 100644 ---- a/include/linux/usb/quirks.h -+++ b/include/linux/usb/quirks.h -@@ -33,4 +33,7 @@ - /* device generates spurious wakeup, ignore remote wakeup capability */ - #define USB_QUIRK_IGNORE_REMOTE_WAKEUP 0x00000200 - -+/* device can't handle device_qualifier descriptor requests */ -+#define USB_QUIRK_DEVICE_QUALIFIER 0x00000100 -+ - #endif /* __LINUX_USB_QUIRKS_H */ -diff --git a/include/net/ipv6.h b/include/net/ipv6.h -index 9ac65781d44b..a60948d7bcea 100644 ---- a/include/net/ipv6.h -+++ b/include/net/ipv6.h -@@ -660,6 +660,8 @@ static inline int ipv6_addr_diff(const struct in6_addr *a1, const struct in6_add - return __ipv6_addr_diff(a1, a2, sizeof(struct in6_addr)); - } - -+void ipv6_proxy_select_ident(struct sk_buff *skb); -+ - int ip6_dst_hoplimit(struct dst_entry *dst); - - /* -diff --git a/include/uapi/drm/vmwgfx_drm.h b/include/uapi/drm/vmwgfx_drm.h -index 87792a5fee3b..33b739522840 100644 ---- a/include/uapi/drm/vmwgfx_drm.h -+++ b/include/uapi/drm/vmwgfx_drm.h -@@ -29,7 +29,7 @@ - #define __VMWGFX_DRM_H__ - - #ifndef __KERNEL__ --#include <drm.h> -+#include <drm/drm.h> - #endif - - #define DRM_VMW_MAX_SURFACE_FACES 6 -diff --git a/kernel/freezer.c b/kernel/freezer.c -index aa6a8aadb911..8f9279b9c6d7 100644 ---- a/kernel/freezer.c -+++ b/kernel/freezer.c -@@ -42,6 +42,9 @@ bool freezing_slow_path(struct task_struct *p) - if (p->flags & (PF_NOFREEZE | PF_SUSPEND_TASK)) - return false; - -+ if (test_thread_flag(TIF_MEMDIE)) -+ return false; -+ - if (pm_nosig_freezing || cgroup_freezing(p)) - return true; - -diff --git a/kernel/module.c b/kernel/module.c -index 6716a1fa618b..1d679a6c942f 100644 ---- a/kernel/module.c -+++ b/kernel/module.c -@@ -1841,7 +1841,9 @@ static void free_module(struct module *mod) - - /* We leave it in list to prevent duplicate loads, but make sure - * that noone uses it while it's being deconstructed. */ -+ mutex_lock(&module_mutex); - mod->state = MODULE_STATE_UNFORMED; -+ mutex_unlock(&module_mutex); - - /* Remove dynamic debug info */ - ddebug_remove_module(mod->name); -diff --git a/kernel/posix-timers.c b/kernel/posix-timers.c -index 424c2d4265c9..77e6b83c0431 100644 ---- a/kernel/posix-timers.c -+++ b/kernel/posix-timers.c -@@ -634,6 +634,7 @@ SYSCALL_DEFINE3(timer_create, const clockid_t, which_clock, - goto out; - } - } else { -+ memset(&event.sigev_value, 0, sizeof(event.sigev_value)); - event.sigev_notify = SIGEV_SIGNAL; - event.sigev_signo = SIGALRM; - event.sigev_value.sival_int = new_timer->it_id; -diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c -index 37170d4dd9a6..126586a31408 100644 ---- a/kernel/power/hibernate.c -+++ b/kernel/power/hibernate.c -@@ -492,8 +492,14 @@ int hibernation_restore(int platform_mode) - error = dpm_suspend_start(PMSG_QUIESCE); - if (!error) { - error = resume_target_kernel(platform_mode); -- dpm_resume_end(PMSG_RECOVER); -+ /* -+ * The above should either succeed and jump to the new kernel, -+ * or return with an error. Otherwise things are just -+ * undefined, so let's be paranoid. -+ */ -+ BUG_ON(!error); - } -+ dpm_resume_end(PMSG_RECOVER); - pm_restore_gfp_mask(); - ftrace_start(); - resume_console(); -diff --git a/kernel/power/process.c b/kernel/power/process.c -index 14f9a8d4725d..f1fe7ec110bb 100644 ---- a/kernel/power/process.c -+++ b/kernel/power/process.c -@@ -107,6 +107,28 @@ static int try_to_freeze_tasks(bool user_only) - return todo ? -EBUSY : 0; - } - -+/* -+ * Returns true if all freezable tasks (except for current) are frozen already -+ */ -+static bool check_frozen_processes(void) -+{ -+ struct task_struct *g, *p; -+ bool ret = true; -+ -+ read_lock(&tasklist_lock); -+ for_each_process_thread(g, p) { -+ if (p != current && !freezer_should_skip(p) && -+ !frozen(p)) { -+ ret = false; -+ goto done; -+ } -+ } -+done: -+ read_unlock(&tasklist_lock); -+ -+ return ret; -+} -+ - /** - * freeze_processes - Signal user space processes to enter the refrigerator. - * The current thread will not be frozen. The same process that calls -@@ -117,6 +139,7 @@ static int try_to_freeze_tasks(bool user_only) - int freeze_processes(void) - { - int error; -+ int oom_kills_saved; - - error = __usermodehelper_disable(UMH_FREEZING); - if (error) -@@ -130,12 +153,27 @@ int freeze_processes(void) - - printk("Freezing user space processes ... "); - pm_freezing = true; -+ oom_kills_saved = oom_kills_count(); - error = try_to_freeze_tasks(true); - if (!error) { -- printk("done."); - __usermodehelper_set_disable_depth(UMH_DISABLED); - oom_killer_disable(); -+ -+ /* -+ * There might have been an OOM kill while we were -+ * freezing tasks and the killed task might be still -+ * on the way out so we have to double check for race. -+ */ -+ if (oom_kills_count() != oom_kills_saved && -+ !check_frozen_processes()) { -+ __usermodehelper_set_disable_depth(UMH_ENABLED); -+ printk("OOM in progress."); -+ error = -EBUSY; -+ goto done; -+ } -+ printk("done."); - } -+done: - printk("\n"); - BUG_ON(in_atomic()); - -diff --git a/kernel/sched/core.c b/kernel/sched/core.c -index 677ebad70ce1..9a3f3c4e1f5a 100644 ---- a/kernel/sched/core.c -+++ b/kernel/sched/core.c -@@ -1895,6 +1895,8 @@ unsigned long to_ratio(u64 period, u64 runtime) - #ifdef CONFIG_SMP - inline struct dl_bw *dl_bw_of(int i) - { -+ rcu_lockdep_assert(rcu_read_lock_sched_held(), -+ "sched RCU must be held"); - return &cpu_rq(i)->rd->dl_bw; - } - -@@ -1903,6 +1905,8 @@ static inline int dl_bw_cpus(int i) - struct root_domain *rd = cpu_rq(i)->rd; - int cpus = 0; - -+ rcu_lockdep_assert(rcu_read_lock_sched_held(), -+ "sched RCU must be held"); - for_each_cpu_and(i, rd->span, cpu_active_mask) - cpus++; - -@@ -3937,13 +3941,14 @@ long sched_setaffinity(pid_t pid, const struct cpumask *in_mask) - * root_domain. - */ - #ifdef CONFIG_SMP -- if (task_has_dl_policy(p)) { -- const struct cpumask *span = task_rq(p)->rd->span; -- -- if (dl_bandwidth_enabled() && !cpumask_subset(span, new_mask)) { -+ if (task_has_dl_policy(p) && dl_bandwidth_enabled()) { -+ rcu_read_lock(); -+ if (!cpumask_subset(task_rq(p)->rd->span, new_mask)) { - retval = -EBUSY; -+ rcu_read_unlock(); - goto out_unlock; - } -+ rcu_read_unlock(); - } - #endif - again: -@@ -7458,6 +7463,8 @@ static int sched_dl_global_constraints(void) - int cpu, ret = 0; - unsigned long flags; - -+ rcu_read_lock(); -+ - /* - * Here we want to check the bandwidth not being set to some - * value smaller than the currently allocated bandwidth in -@@ -7479,6 +7486,8 @@ static int sched_dl_global_constraints(void) - break; - } - -+ rcu_read_unlock(); -+ - return ret; - } - -@@ -7494,6 +7503,7 @@ static void sched_dl_do_global(void) - if (global_rt_runtime() != RUNTIME_INF) - new_bw = to_ratio(global_rt_period(), global_rt_runtime()); - -+ rcu_read_lock(); - /* - * FIXME: As above... - */ -@@ -7504,6 +7514,7 @@ static void sched_dl_do_global(void) - dl_b->bw = new_bw; - raw_spin_unlock_irqrestore(&dl_b->lock, flags); - } -+ rcu_read_unlock(); - } - - static int sched_rt_global_validate(void) -diff --git a/kernel/trace/trace_syscalls.c b/kernel/trace/trace_syscalls.c -index 759d5e004517..7e3cd7aaec83 100644 ---- a/kernel/trace/trace_syscalls.c -+++ b/kernel/trace/trace_syscalls.c -@@ -313,7 +313,7 @@ static void ftrace_syscall_enter(void *data, struct pt_regs *regs, long id) - int size; - - syscall_nr = trace_get_syscall_nr(current, regs); -- if (syscall_nr < 0) -+ if (syscall_nr < 0 || syscall_nr >= NR_syscalls) - return; - - /* Here we're inside tp handler's rcu_read_lock_sched (__DO_TRACE) */ -@@ -360,7 +360,7 @@ static void ftrace_syscall_exit(void *data, struct pt_regs *regs, long ret) - int syscall_nr; - - syscall_nr = trace_get_syscall_nr(current, regs); -- if (syscall_nr < 0) -+ if (syscall_nr < 0 || syscall_nr >= NR_syscalls) - return; - - /* Here we're inside tp handler's rcu_read_lock_sched (__DO_TRACE()) */ -@@ -567,7 +567,7 @@ static void perf_syscall_enter(void *ignore, struct pt_regs *regs, long id) - int size; - - syscall_nr = trace_get_syscall_nr(current, regs); -- if (syscall_nr < 0) -+ if (syscall_nr < 0 || syscall_nr >= NR_syscalls) - return; - if (!test_bit(syscall_nr, enabled_perf_enter_syscalls)) - return; -@@ -641,7 +641,7 @@ static void perf_syscall_exit(void *ignore, struct pt_regs *regs, long ret) - int size; - - syscall_nr = trace_get_syscall_nr(current, regs); -- if (syscall_nr < 0) -+ if (syscall_nr < 0 || syscall_nr >= NR_syscalls) - return; - if (!test_bit(syscall_nr, enabled_perf_exit_syscalls)) - return; -diff --git a/lib/bitmap.c b/lib/bitmap.c -index 06f7e4fe8d2d..e5c4ebe586ba 100644 ---- a/lib/bitmap.c -+++ b/lib/bitmap.c -@@ -131,7 +131,9 @@ void __bitmap_shift_right(unsigned long *dst, - lower = src[off + k]; - if (left && off + k == lim - 1) - lower &= mask; -- dst[k] = upper << (BITS_PER_LONG - rem) | lower >> rem; -+ dst[k] = lower >> rem; -+ if (rem) -+ dst[k] |= upper << (BITS_PER_LONG - rem); - if (left && k == lim - 1) - dst[k] &= mask; - } -@@ -172,7 +174,9 @@ void __bitmap_shift_left(unsigned long *dst, - upper = src[k]; - if (left && k == lim - 1) - upper &= (1UL << left) - 1; -- dst[k + off] = lower >> (BITS_PER_LONG - rem) | upper << rem; -+ dst[k + off] = upper << rem; -+ if (rem) -+ dst[k + off] |= lower >> (BITS_PER_LONG - rem); - if (left && k + off == lim - 1) - dst[k + off] &= (1UL << left) - 1; - } -diff --git a/lib/string.c b/lib/string.c -index e5878de4f101..43d0781daf47 100644 ---- a/lib/string.c -+++ b/lib/string.c -@@ -586,6 +586,22 @@ void *memset(void *s, int c, size_t count) - EXPORT_SYMBOL(memset); - #endif - -+/** -+ * memzero_explicit - Fill a region of memory (e.g. sensitive -+ * keying data) with 0s. -+ * @s: Pointer to the start of the area. -+ * @count: The size of the area. -+ * -+ * memzero_explicit() doesn't need an arch-specific version as -+ * it just invokes the one of memset() implicitly. -+ */ -+void memzero_explicit(void *s, size_t count) -+{ -+ memset(s, 0, count); -+ OPTIMIZER_HIDE_VAR(s); -+} -+EXPORT_SYMBOL(memzero_explicit); -+ - #ifndef __HAVE_ARCH_MEMCPY - /** - * memcpy - Copy one area of memory to another -diff --git a/mm/huge_memory.c b/mm/huge_memory.c -index 718bfa16a36f..331faa5c0d5e 100644 ---- a/mm/huge_memory.c -+++ b/mm/huge_memory.c -@@ -199,7 +199,7 @@ retry: - preempt_disable(); - if (cmpxchg(&huge_zero_page, NULL, zero_page)) { - preempt_enable(); -- __free_page(zero_page); -+ __free_pages(zero_page, compound_order(zero_page)); - goto retry; - } - -@@ -231,7 +231,7 @@ static unsigned long shrink_huge_zero_page_scan(struct shrinker *shrink, - if (atomic_cmpxchg(&huge_zero_refcount, 1, 0) == 1) { - struct page *zero_page = xchg(&huge_zero_page, NULL); - BUG_ON(zero_page == NULL); -- __free_page(zero_page); -+ __free_pages(zero_page, compound_order(zero_page)); - return HPAGE_PMD_NR; - } - -diff --git a/mm/memcontrol.c b/mm/memcontrol.c -index 9b35da28b587..b58d4fbe6c48 100644 ---- a/mm/memcontrol.c -+++ b/mm/memcontrol.c -@@ -292,6 +292,9 @@ struct mem_cgroup { - /* vmpressure notifications */ - struct vmpressure vmpressure; - -+ /* css_online() has been completed */ -+ int initialized; -+ - /* - * the counter to account for mem+swap usage. - */ -@@ -1127,9 +1130,21 @@ skip_node: - * skipping css reference should be safe. - */ - if (next_css) { -- if ((next_css == &root->css) || -- ((next_css->flags & CSS_ONLINE) && css_tryget(next_css))) -- return mem_cgroup_from_css(next_css); -+ struct mem_cgroup *memcg = mem_cgroup_from_css(next_css); -+ -+ if (next_css == &root->css) -+ return memcg; -+ -+ if (css_tryget(next_css)) { -+ /* -+ * Make sure the memcg is initialized: -+ * mem_cgroup_css_online() orders the the -+ * initialization against setting the flag. -+ */ -+ if (smp_load_acquire(&memcg->initialized)) -+ return memcg; -+ css_put(next_css); -+ } - - prev_css = next_css; - goto skip_node; -@@ -6538,6 +6553,7 @@ mem_cgroup_css_online(struct cgroup_subsys_state *css) - { - struct mem_cgroup *memcg = mem_cgroup_from_css(css); - struct mem_cgroup *parent = mem_cgroup_from_css(css_parent(css)); -+ int ret; - - if (css->cgroup->id > MEM_CGROUP_ID_MAX) - return -ENOSPC; -@@ -6574,7 +6590,18 @@ mem_cgroup_css_online(struct cgroup_subsys_state *css) - } - mutex_unlock(&memcg_create_mutex); - -- return memcg_init_kmem(memcg, &mem_cgroup_subsys); -+ ret = memcg_init_kmem(memcg, &mem_cgroup_subsys); -+ if (ret) -+ return ret; -+ -+ /* -+ * Make sure the memcg is initialized: mem_cgroup_iter() -+ * orders reading memcg->initialized against its callers -+ * reading the memcg members. -+ */ -+ smp_store_release(&memcg->initialized, 1); -+ -+ return 0; - } - - /* -diff --git a/mm/oom_kill.c b/mm/oom_kill.c -index 3291e82d4352..171c00f2e495 100644 ---- a/mm/oom_kill.c -+++ b/mm/oom_kill.c -@@ -406,6 +406,23 @@ static void dump_header(struct task_struct *p, gfp_t gfp_mask, int order, - dump_tasks(memcg, nodemask); - } - -+/* -+ * Number of OOM killer invocations (including memcg OOM killer). -+ * Primarily used by PM freezer to check for potential races with -+ * OOM killed frozen task. -+ */ -+static atomic_t oom_kills = ATOMIC_INIT(0); -+ -+int oom_kills_count(void) -+{ -+ return atomic_read(&oom_kills); -+} -+ -+void note_oom_kill(void) -+{ -+ atomic_inc(&oom_kills); -+} -+ - #define K(x) ((x) << (PAGE_SHIFT-10)) - /* - * Must be called while holding a reference to p, which will be released upon -diff --git a/mm/page_alloc.c b/mm/page_alloc.c -index ff0f6b13f32f..7b2611a055a7 100644 ---- a/mm/page_alloc.c -+++ b/mm/page_alloc.c -@@ -1957,7 +1957,7 @@ zonelist_scan: - if (alloc_flags & ALLOC_FAIR) { - if (!zone_local(preferred_zone, zone)) - continue; -- if (zone_page_state(zone, NR_ALLOC_BATCH) <= 0) -+ if (atomic_long_read(&zone->vm_stat[NR_ALLOC_BATCH]) <= 0) - continue; - } - /* -@@ -2196,6 +2196,14 @@ __alloc_pages_may_oom(gfp_t gfp_mask, unsigned int order, - } - - /* -+ * PM-freezer should be notified that there might be an OOM killer on -+ * its way to kill and wake somebody up. This is too early and we might -+ * end up not killing anything but false positives are acceptable. -+ * See freeze_processes. -+ */ -+ note_oom_kill(); -+ -+ /* - * Go through the zonelist yet one more time, keep very high watermark - * here, this is only to catch a parallel oom killing, we must fail if - * we're still under heavy pressure. -@@ -5662,9 +5670,8 @@ static void __setup_per_zone_wmarks(void) - zone->watermark[WMARK_HIGH] = min_wmark_pages(zone) + (tmp >> 1); - - __mod_zone_page_state(zone, NR_ALLOC_BATCH, -- high_wmark_pages(zone) - -- low_wmark_pages(zone) - -- zone_page_state(zone, NR_ALLOC_BATCH)); -+ high_wmark_pages(zone) - low_wmark_pages(zone) - -+ atomic_long_read(&zone->vm_stat[NR_ALLOC_BATCH])); - - setup_zone_migrate_reserve(zone); - spin_unlock_irqrestore(&zone->lock, flags); -diff --git a/mm/page_cgroup.c b/mm/page_cgroup.c -index cfd162882c00..0e9a319d5f8d 100644 ---- a/mm/page_cgroup.c -+++ b/mm/page_cgroup.c -@@ -171,6 +171,7 @@ static void free_page_cgroup(void *addr) - sizeof(struct page_cgroup) * PAGES_PER_SECTION; - - BUG_ON(PageReserved(page)); -+ kmemleak_free(addr); - free_pages_exact(addr, table_size); - } - } -diff --git a/mm/percpu.c b/mm/percpu.c -index 8cd4308471c3..a2a54a85f691 100644 ---- a/mm/percpu.c -+++ b/mm/percpu.c -@@ -1917,8 +1917,6 @@ void __init setup_per_cpu_areas(void) - - if (pcpu_setup_first_chunk(ai, fc) < 0) - panic("Failed to initialize percpu areas."); -- -- pcpu_free_alloc_info(ai); - } - - #endif /* CONFIG_SMP */ -diff --git a/mm/truncate.c b/mm/truncate.c -index 353b683afd6e..ac18edc30649 100644 ---- a/mm/truncate.c -+++ b/mm/truncate.c -@@ -20,6 +20,7 @@ - #include <linux/buffer_head.h> /* grr. try_to_release_page, - do_invalidatepage */ - #include <linux/cleancache.h> -+#include <linux/rmap.h> - #include "internal.h" - - -@@ -613,12 +614,67 @@ EXPORT_SYMBOL(truncate_pagecache); - */ - void truncate_setsize(struct inode *inode, loff_t newsize) - { -+ loff_t oldsize = inode->i_size; -+ - i_size_write(inode, newsize); -+ if (newsize > oldsize) -+ pagecache_isize_extended(inode, oldsize, newsize); - truncate_pagecache(inode, newsize); - } - EXPORT_SYMBOL(truncate_setsize); - - /** -+ * pagecache_isize_extended - update pagecache after extension of i_size -+ * @inode: inode for which i_size was extended -+ * @from: original inode size -+ * @to: new inode size -+ * -+ * Handle extension of inode size either caused by extending truncate or by -+ * write starting after current i_size. We mark the page straddling current -+ * i_size RO so that page_mkwrite() is called on the nearest write access to -+ * the page. This way filesystem can be sure that page_mkwrite() is called on -+ * the page before user writes to the page via mmap after the i_size has been -+ * changed. -+ * -+ * The function must be called after i_size is updated so that page fault -+ * coming after we unlock the page will already see the new i_size. -+ * The function must be called while we still hold i_mutex - this not only -+ * makes sure i_size is stable but also that userspace cannot observe new -+ * i_size value before we are prepared to store mmap writes at new inode size. -+ */ -+void pagecache_isize_extended(struct inode *inode, loff_t from, loff_t to) -+{ -+ int bsize = 1 << inode->i_blkbits; -+ loff_t rounded_from; -+ struct page *page; -+ pgoff_t index; -+ -+ WARN_ON(to > inode->i_size); -+ -+ if (from >= to || bsize == PAGE_CACHE_SIZE) -+ return; -+ /* Page straddling @from will not have any hole block created? */ -+ rounded_from = round_up(from, bsize); -+ if (to <= rounded_from || !(rounded_from & (PAGE_CACHE_SIZE - 1))) -+ return; -+ -+ index = from >> PAGE_CACHE_SHIFT; -+ page = find_lock_page(inode->i_mapping, index); -+ /* Page not cached? Nothing to do */ -+ if (!page) -+ return; -+ /* -+ * See clear_page_dirty_for_io() for details why set_page_dirty() -+ * is needed. -+ */ -+ if (page_mkclean(page)) -+ set_page_dirty(page); -+ unlock_page(page); -+ page_cache_release(page); -+} -+EXPORT_SYMBOL(pagecache_isize_extended); -+ -+/** - * truncate_pagecache_range - unmap and remove pagecache that is hole-punched - * @inode: inode - * @lstart: offset of beginning of hole -diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c -index 0a31298737ac..2e87eecec8f6 100644 ---- a/net/ceph/messenger.c -+++ b/net/ceph/messenger.c -@@ -291,7 +291,11 @@ int ceph_msgr_init(void) - if (ceph_msgr_slab_init()) - return -ENOMEM; - -- ceph_msgr_wq = alloc_workqueue("ceph-msgr", 0, 0); -+ /* -+ * The number of active work items is limited by the number of -+ * connections, so leave @max_active at default. -+ */ -+ ceph_msgr_wq = alloc_workqueue("ceph-msgr", WQ_MEM_RECLAIM, 0); - if (ceph_msgr_wq) - return 0; - -diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c -index 9d43468722ed..017fa5e17594 100644 ---- a/net/ipv4/fib_semantics.c -+++ b/net/ipv4/fib_semantics.c -@@ -535,7 +535,7 @@ int fib_nh_match(struct fib_config *cfg, struct fib_info *fi) - return 1; - - attrlen = rtnh_attrlen(rtnh); -- if (attrlen < 0) { -+ if (attrlen > 0) { - struct nlattr *nla, *attrs = rtnh_attrs(rtnh); - - nla = nla_find(attrs, attrlen, RTA_GATEWAY); -diff --git a/net/ipv4/gre_offload.c b/net/ipv4/gre_offload.c -index 2d24f293f977..8c8493ea6b1c 100644 ---- a/net/ipv4/gre_offload.c -+++ b/net/ipv4/gre_offload.c -@@ -50,7 +50,7 @@ static struct sk_buff *gre_gso_segment(struct sk_buff *skb, - - greh = (struct gre_base_hdr *)skb_transport_header(skb); - -- ghl = skb_inner_network_header(skb) - skb_transport_header(skb); -+ ghl = skb_inner_mac_header(skb) - skb_transport_header(skb); - if (unlikely(ghl < sizeof(*greh))) - goto out; - -diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c -index ed88d781248f..844323b6cfb9 100644 ---- a/net/ipv4/ip_output.c -+++ b/net/ipv4/ip_output.c -@@ -1487,6 +1487,7 @@ void ip_send_unicast_reply(struct net *net, struct sk_buff *skb, __be32 daddr, - struct sk_buff *nskb; - struct sock *sk; - struct inet_sock *inet; -+ int err; - - if (ip_options_echo(&replyopts.opt.opt, skb)) - return; -@@ -1525,8 +1526,13 @@ void ip_send_unicast_reply(struct net *net, struct sk_buff *skb, __be32 daddr, - sock_net_set(sk, net); - __skb_queue_head_init(&sk->sk_write_queue); - sk->sk_sndbuf = sysctl_wmem_default; -- ip_append_data(sk, &fl4, ip_reply_glue_bits, arg->iov->iov_base, len, 0, -- &ipc, &rt, MSG_DONTWAIT); -+ err = ip_append_data(sk, &fl4, ip_reply_glue_bits, arg->iov->iov_base, -+ len, 0, &ipc, &rt, MSG_DONTWAIT); -+ if (unlikely(err)) { -+ ip_flush_pending_frames(sk); -+ goto out; -+ } -+ - nskb = skb_peek(&sk->sk_write_queue); - if (nskb) { - if (arg->csumoffset >= 0) -@@ -1538,7 +1544,7 @@ void ip_send_unicast_reply(struct net *net, struct sk_buff *skb, __be32 daddr, - skb_set_queue_mapping(nskb, skb_get_queue_mapping(skb)); - ip_push_pending_frames(sk, &fl4); - } -- -+out: - put_cpu_var(unicast_sock); - - ip_rt_put(rt); -diff --git a/net/ipv4/ip_tunnel_core.c b/net/ipv4/ip_tunnel_core.c -index 65b664d30fa1..791a419f0699 100644 ---- a/net/ipv4/ip_tunnel_core.c -+++ b/net/ipv4/ip_tunnel_core.c -@@ -91,11 +91,12 @@ int iptunnel_pull_header(struct sk_buff *skb, int hdr_len, __be16 inner_proto) - skb_pull_rcsum(skb, hdr_len); - - if (inner_proto == htons(ETH_P_TEB)) { -- struct ethhdr *eh = (struct ethhdr *)skb->data; -+ struct ethhdr *eh; - - if (unlikely(!pskb_may_pull(skb, ETH_HLEN))) - return -ENOMEM; - -+ eh = (struct ethhdr *)skb->data; - if (likely(ntohs(eh->h_proto) >= ETH_P_802_3_MIN)) - skb->protocol = eh->h_proto; - else -diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c -index f7d71ec72a47..29d240b87af1 100644 ---- a/net/ipv4/tcp.c -+++ b/net/ipv4/tcp.c -@@ -2954,61 +2954,42 @@ EXPORT_SYMBOL(compat_tcp_getsockopt); - #endif - - #ifdef CONFIG_TCP_MD5SIG --static struct tcp_md5sig_pool __percpu *tcp_md5sig_pool __read_mostly; -+static DEFINE_PER_CPU(struct tcp_md5sig_pool, tcp_md5sig_pool); - static DEFINE_MUTEX(tcp_md5sig_mutex); -- --static void __tcp_free_md5sig_pool(struct tcp_md5sig_pool __percpu *pool) --{ -- int cpu; -- -- for_each_possible_cpu(cpu) { -- struct tcp_md5sig_pool *p = per_cpu_ptr(pool, cpu); -- -- if (p->md5_desc.tfm) -- crypto_free_hash(p->md5_desc.tfm); -- } -- free_percpu(pool); --} -+static bool tcp_md5sig_pool_populated = false; - - static void __tcp_alloc_md5sig_pool(void) - { - int cpu; -- struct tcp_md5sig_pool __percpu *pool; -- -- pool = alloc_percpu(struct tcp_md5sig_pool); -- if (!pool) -- return; - - for_each_possible_cpu(cpu) { -- struct crypto_hash *hash; -- -- hash = crypto_alloc_hash("md5", 0, CRYPTO_ALG_ASYNC); -- if (IS_ERR_OR_NULL(hash)) -- goto out_free; -+ if (!per_cpu(tcp_md5sig_pool, cpu).md5_desc.tfm) { -+ struct crypto_hash *hash; - -- per_cpu_ptr(pool, cpu)->md5_desc.tfm = hash; -+ hash = crypto_alloc_hash("md5", 0, CRYPTO_ALG_ASYNC); -+ if (IS_ERR_OR_NULL(hash)) -+ return; -+ per_cpu(tcp_md5sig_pool, cpu).md5_desc.tfm = hash; -+ } - } -- /* before setting tcp_md5sig_pool, we must commit all writes -- * to memory. See ACCESS_ONCE() in tcp_get_md5sig_pool() -+ /* before setting tcp_md5sig_pool_populated, we must commit all writes -+ * to memory. See smp_rmb() in tcp_get_md5sig_pool() - */ - smp_wmb(); -- tcp_md5sig_pool = pool; -- return; --out_free: -- __tcp_free_md5sig_pool(pool); -+ tcp_md5sig_pool_populated = true; - } - - bool tcp_alloc_md5sig_pool(void) - { -- if (unlikely(!tcp_md5sig_pool)) { -+ if (unlikely(!tcp_md5sig_pool_populated)) { - mutex_lock(&tcp_md5sig_mutex); - -- if (!tcp_md5sig_pool) -+ if (!tcp_md5sig_pool_populated) - __tcp_alloc_md5sig_pool(); - - mutex_unlock(&tcp_md5sig_mutex); - } -- return tcp_md5sig_pool != NULL; -+ return tcp_md5sig_pool_populated; - } - EXPORT_SYMBOL(tcp_alloc_md5sig_pool); - -@@ -3022,13 +3003,13 @@ EXPORT_SYMBOL(tcp_alloc_md5sig_pool); - */ - struct tcp_md5sig_pool *tcp_get_md5sig_pool(void) - { -- struct tcp_md5sig_pool __percpu *p; -- - local_bh_disable(); -- p = ACCESS_ONCE(tcp_md5sig_pool); -- if (p) -- return __this_cpu_ptr(p); - -+ if (tcp_md5sig_pool_populated) { -+ /* coupled with smp_wmb() in __tcp_alloc_md5sig_pool() */ -+ smp_rmb(); -+ return this_cpu_ptr(&tcp_md5sig_pool); -+ } - local_bh_enable(); - return NULL; - } -diff --git a/net/ipv6/output_core.c b/net/ipv6/output_core.c -index 798eb0f79078..ae4a06be14df 100644 ---- a/net/ipv6/output_core.c -+++ b/net/ipv6/output_core.c -@@ -3,10 +3,43 @@ - * not configured or static. These functions are needed by GSO/GRO implementation. - */ - #include <linux/export.h> -+#include <net/ip.h> - #include <net/ipv6.h> - #include <net/ip6_fib.h> - #include <net/addrconf.h> - -+/* This function exists only for tap drivers that must support broken -+ * clients requesting UFO without specifying an IPv6 fragment ID. -+ * -+ * This is similar to ipv6_select_ident() but we use an independent hash -+ * seed to limit information leakage. -+ * -+ * The network header must be set before calling this. -+ */ -+void ipv6_proxy_select_ident(struct sk_buff *skb) -+{ -+ static u32 ip6_proxy_idents_hashrnd __read_mostly; -+ struct in6_addr buf[2]; -+ struct in6_addr *addrs; -+ u32 hash, id; -+ -+ addrs = skb_header_pointer(skb, -+ skb_network_offset(skb) + -+ offsetof(struct ipv6hdr, saddr), -+ sizeof(buf), buf); -+ if (!addrs) -+ return; -+ -+ net_get_random_once(&ip6_proxy_idents_hashrnd, -+ sizeof(ip6_proxy_idents_hashrnd)); -+ -+ hash = __ipv6_addr_jhash(&addrs[1], ip6_proxy_idents_hashrnd); -+ hash = __ipv6_addr_jhash(&addrs[0], hash); -+ -+ id = ip_idents_reserve(hash, 1); -+ skb_shinfo(skb)->ip6_frag_id = htonl(id); -+} -+EXPORT_SYMBOL_GPL(ipv6_proxy_select_ident); - - int ip6_find_1stfragopt(struct sk_buff *skb, u8 **nexthdr) - { -diff --git a/net/mac80211/rate.c b/net/mac80211/rate.c -index 22b223f13c9f..74350c3863b8 100644 ---- a/net/mac80211/rate.c -+++ b/net/mac80211/rate.c -@@ -462,7 +462,7 @@ static void rate_fixup_ratelist(struct ieee80211_vif *vif, - */ - if (!(rates[0].flags & IEEE80211_TX_RC_MCS)) { - u32 basic_rates = vif->bss_conf.basic_rates; -- s8 baserate = basic_rates ? ffs(basic_rates - 1) : 0; -+ s8 baserate = basic_rates ? ffs(basic_rates) - 1 : 0; - - rate = &sband->bitrates[rates[0].idx]; - -diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c -index c375d731587f..7c177bc43806 100644 ---- a/net/netlink/af_netlink.c -+++ b/net/netlink/af_netlink.c -@@ -707,7 +707,7 @@ static int netlink_mmap_sendmsg(struct sock *sk, struct msghdr *msg, - * after validation, the socket and the ring may only be used by a - * single process, otherwise we fall back to copying. - */ -- if (atomic_long_read(&sk->sk_socket->file->f_count) > 2 || -+ if (atomic_long_read(&sk->sk_socket->file->f_count) > 1 || - atomic_read(&nlk->mapped) > 1) - excl = false; - -diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c -index 3ea5cda787c7..5ff8b87c3d04 100644 ---- a/net/sunrpc/clnt.c -+++ b/net/sunrpc/clnt.c -@@ -533,6 +533,8 @@ struct rpc_clnt *rpc_create(struct rpc_create_args *args) - - if (args->flags & RPC_CLNT_CREATE_AUTOBIND) - clnt->cl_autobind = 1; -+ if (args->flags & RPC_CLNT_CREATE_NO_RETRANS_TIMEOUT) -+ clnt->cl_noretranstimeo = 1; - if (args->flags & RPC_CLNT_CREATE_DISCRTRY) - clnt->cl_discrtry = 1; - if (!(args->flags & RPC_CLNT_CREATE_QUIET)) -@@ -571,6 +573,7 @@ static struct rpc_clnt *__rpc_clone_client(struct rpc_create_args *args, - /* Turn off autobind on clones */ - new->cl_autobind = 0; - new->cl_softrtry = clnt->cl_softrtry; -+ new->cl_noretranstimeo = clnt->cl_noretranstimeo; - new->cl_discrtry = clnt->cl_discrtry; - new->cl_chatty = clnt->cl_chatty; - return new; -diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c -index 0addefca8e77..41c2f9d7a148 100644 ---- a/net/sunrpc/xprtsock.c -+++ b/net/sunrpc/xprtsock.c -@@ -842,6 +842,8 @@ static void xs_error_report(struct sock *sk) - dprintk("RPC: xs_error_report client %p, error=%d...\n", - xprt, -err); - trace_rpc_socket_error(xprt, sk->sk_socket, err); -+ if (test_bit(XPRT_CONNECTION_REUSE, &xprt->state)) -+ goto out; - xprt_wake_pending_tasks(xprt, err); - out: - read_unlock_bh(&sk->sk_callback_lock); -@@ -2251,7 +2253,9 @@ static void xs_tcp_setup_socket(struct work_struct *work) - abort_and_exit = test_and_clear_bit(XPRT_CONNECTION_ABORT, - &xprt->state); - /* "close" the socket, preserving the local port */ -+ set_bit(XPRT_CONNECTION_REUSE, &xprt->state); - xs_tcp_reuse_connection(transport); -+ clear_bit(XPRT_CONNECTION_REUSE, &xprt->state); - - if (abort_and_exit) - goto out_eagain; -diff --git a/security/integrity/evm/evm_main.c b/security/integrity/evm/evm_main.c -index 3c5cbb977254..7e71e066198f 100644 ---- a/security/integrity/evm/evm_main.c -+++ b/security/integrity/evm/evm_main.c -@@ -269,6 +269,13 @@ static int evm_protect_xattr(struct dentry *dentry, const char *xattr_name, - goto out; - } - evm_status = evm_verify_current_integrity(dentry); -+ if (evm_status == INTEGRITY_NOXATTRS) { -+ struct integrity_iint_cache *iint; -+ -+ iint = integrity_iint_find(dentry->d_inode); -+ if (iint && (iint->flags & IMA_NEW_FILE)) -+ return 0; -+ } - out: - if (evm_status != INTEGRITY_PASS) - integrity_audit_msg(AUDIT_INTEGRITY_METADATA, dentry->d_inode, -@@ -296,9 +303,12 @@ int evm_inode_setxattr(struct dentry *dentry, const char *xattr_name, - { - const struct evm_ima_xattr_data *xattr_data = xattr_value; - -- if ((strcmp(xattr_name, XATTR_NAME_EVM) == 0) -- && (xattr_data->type == EVM_XATTR_HMAC)) -- return -EPERM; -+ if (strcmp(xattr_name, XATTR_NAME_EVM) == 0) { -+ if (!xattr_value_len) -+ return -EINVAL; -+ if (xattr_data->type != EVM_IMA_XATTR_DIGSIG) -+ return -EPERM; -+ } - return evm_protect_xattr(dentry, xattr_name, xattr_value, - xattr_value_len); - } -diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c -index e294b86c8d88..47b5c69e4605 100644 ---- a/security/selinux/hooks.c -+++ b/security/selinux/hooks.c -@@ -470,6 +470,7 @@ next_inode: - list_entry(sbsec->isec_head.next, - struct inode_security_struct, list); - struct inode *inode = isec->inode; -+ list_del_init(&isec->list); - spin_unlock(&sbsec->isec_lock); - inode = igrab(inode); - if (inode) { -@@ -478,7 +479,6 @@ next_inode: - iput(inode); - } - spin_lock(&sbsec->isec_lock); -- list_del_init(&isec->list); - goto next_inode; - } - spin_unlock(&sbsec->isec_lock); -diff --git a/sound/core/pcm_compat.c b/sound/core/pcm_compat.c -index af49721ba0e3..c4ac3c1e19af 100644 ---- a/sound/core/pcm_compat.c -+++ b/sound/core/pcm_compat.c -@@ -206,6 +206,8 @@ static int snd_pcm_status_user_compat(struct snd_pcm_substream *substream, - if (err < 0) - return err; - -+ if (clear_user(src, sizeof(*src))) -+ return -EFAULT; - if (put_user(status.state, &src->state) || - compat_put_timespec(&status.trigger_tstamp, &src->trigger_tstamp) || - compat_put_timespec(&status.tstamp, &src->tstamp) || -diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c -index 7ec91424ba22..103e85a13f35 100644 ---- a/sound/pci/hda/hda_intel.c -+++ b/sound/pci/hda/hda_intel.c -@@ -4027,6 +4027,9 @@ static DEFINE_PCI_DEVICE_TABLE(azx_ids) = { - /* BayTrail */ - { PCI_DEVICE(0x8086, 0x0f04), - .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH_NOPM }, -+ /* Braswell */ -+ { PCI_DEVICE(0x8086, 0x2284), -+ .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH }, - /* ICH */ - { PCI_DEVICE(0x8086, 0x2668), - .driver_data = AZX_DRIVER_ICH | AZX_DCAPS_OLD_SSYNC | -diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c -index 8253b48a435b..611110a3f1a4 100644 ---- a/sound/pci/hda/patch_hdmi.c -+++ b/sound/pci/hda/patch_hdmi.c -@@ -3317,6 +3317,7 @@ static const struct hda_codec_preset snd_hda_preset_hdmi[] = { - { .id = 0x80862808, .name = "Broadwell HDMI", .patch = patch_generic_hdmi }, - { .id = 0x80862880, .name = "CedarTrail HDMI", .patch = patch_generic_hdmi }, - { .id = 0x80862882, .name = "Valleyview2 HDMI", .patch = patch_generic_hdmi }, -+{ .id = 0x80862883, .name = "Braswell HDMI", .patch = patch_generic_hdmi }, - { .id = 0x808629fb, .name = "Crestline HDMI", .patch = patch_generic_hdmi }, - {} /* terminator */ - }; -@@ -3373,6 +3374,7 @@ MODULE_ALIAS("snd-hda-codec-id:80862807"); - MODULE_ALIAS("snd-hda-codec-id:80862808"); - MODULE_ALIAS("snd-hda-codec-id:80862880"); - MODULE_ALIAS("snd-hda-codec-id:80862882"); -+MODULE_ALIAS("snd-hda-codec-id:80862883"); - MODULE_ALIAS("snd-hda-codec-id:808629fb"); - - MODULE_LICENSE("GPL"); -diff --git a/sound/soc/codecs/tlv320aic3x.c b/sound/soc/codecs/tlv320aic3x.c -index eb241c6571a9..fd53d37e1181 100644 ---- a/sound/soc/codecs/tlv320aic3x.c -+++ b/sound/soc/codecs/tlv320aic3x.c -@@ -1121,6 +1121,7 @@ static int aic3x_regulator_event(struct notifier_block *nb, - static int aic3x_set_power(struct snd_soc_codec *codec, int power) - { - struct aic3x_priv *aic3x = snd_soc_codec_get_drvdata(codec); -+ unsigned int pll_c, pll_d; - int ret; - - if (power) { -@@ -1138,6 +1139,18 @@ static int aic3x_set_power(struct snd_soc_codec *codec, int power) - /* Sync reg_cache with the hardware */ - regcache_cache_only(aic3x->regmap, false); - regcache_sync(aic3x->regmap); -+ -+ /* Rewrite paired PLL D registers in case cached sync skipped -+ * writing one of them and thus caused other one also not -+ * being written -+ */ -+ pll_c = snd_soc_read(codec, AIC3X_PLL_PROGC_REG); -+ pll_d = snd_soc_read(codec, AIC3X_PLL_PROGD_REG); -+ if (pll_c == aic3x_reg[AIC3X_PLL_PROGC_REG].def || -+ pll_d == aic3x_reg[AIC3X_PLL_PROGD_REG].def) { -+ snd_soc_write(codec, AIC3X_PLL_PROGC_REG, pll_c); -+ snd_soc_write(codec, AIC3X_PLL_PROGD_REG, pll_d); -+ } - } else { - /* - * Do soft reset to this codec instance in order to clear -diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c -index 731d47b64daa..e4da224d7253 100644 ---- a/sound/soc/soc-dapm.c -+++ b/sound/soc/soc-dapm.c -@@ -689,9 +689,9 @@ static int dapm_create_or_share_mixmux_kcontrol(struct snd_soc_dapm_widget *w, - int shared; - struct snd_kcontrol *kcontrol; - bool wname_in_long_name, kcname_in_long_name; -- char *long_name; -+ char *long_name = NULL; - const char *name; -- int ret; -+ int ret = 0; - - if (dapm->codec) - prefix = dapm->codec->name_prefix; -@@ -756,15 +756,17 @@ static int dapm_create_or_share_mixmux_kcontrol(struct snd_soc_dapm_widget *w, - - kcontrol = snd_soc_cnew(&w->kcontrol_news[kci], NULL, name, - prefix); -- kfree(long_name); -- if (!kcontrol) -- return -ENOMEM; -+ if (!kcontrol) { -+ ret = -ENOMEM; -+ goto exit_free; -+ } -+ - kcontrol->private_free = dapm_kcontrol_free; - - ret = dapm_kcontrol_data_alloc(w, kcontrol); - if (ret) { - snd_ctl_free_one(kcontrol); -- return ret; -+ goto exit_free; - } - - ret = snd_ctl_add(card, kcontrol); -@@ -772,17 +774,18 @@ static int dapm_create_or_share_mixmux_kcontrol(struct snd_soc_dapm_widget *w, - dev_err(dapm->dev, - "ASoC: failed to add widget %s dapm kcontrol %s: %d\n", - w->name, name, ret); -- return ret; -+ goto exit_free; - } - } - - ret = dapm_kcontrol_add_widget(kcontrol, w); -- if (ret) -- return ret; -+ if (ret == 0) -+ w->kcontrols[kci] = kcontrol; - -- w->kcontrols[kci] = kcontrol; -+exit_free: -+ kfree(long_name); - -- return 0; -+ return ret; - } - - /* create new dapm mixer control */ -diff --git a/sound/usb/card.c b/sound/usb/card.c -index af1956042c9e..ab433a02dbf1 100644 ---- a/sound/usb/card.c -+++ b/sound/usb/card.c -@@ -586,18 +586,19 @@ static void snd_usb_audio_disconnect(struct usb_device *dev, - { - struct snd_card *card; - struct list_head *p; -+ bool was_shutdown; - - if (chip == (void *)-1L) - return; - - card = chip->card; - down_write(&chip->shutdown_rwsem); -+ was_shutdown = chip->shutdown; - chip->shutdown = 1; - up_write(&chip->shutdown_rwsem); - - mutex_lock(&register_mutex); -- chip->num_interfaces--; -- if (chip->num_interfaces <= 0) { -+ if (!was_shutdown) { - struct snd_usb_endpoint *ep; - - snd_card_disconnect(card); -@@ -617,6 +618,10 @@ static void snd_usb_audio_disconnect(struct usb_device *dev, - list_for_each(p, &chip->mixer_list) { - snd_usb_mixer_disconnect(p); - } -+ } -+ -+ chip->num_interfaces--; -+ if (chip->num_interfaces <= 0) { - usb_chip[chip->index] = NULL; - mutex_unlock(&register_mutex); - snd_card_free_when_closed(card); -diff --git a/virt/kvm/iommu.c b/virt/kvm/iommu.c -index 714b94932312..1f0dc1e5f1f0 100644 ---- a/virt/kvm/iommu.c -+++ b/virt/kvm/iommu.c -@@ -43,13 +43,13 @@ static void kvm_iommu_put_pages(struct kvm *kvm, - gfn_t base_gfn, unsigned long npages); - - static pfn_t kvm_pin_pages(struct kvm_memory_slot *slot, gfn_t gfn, -- unsigned long size) -+ unsigned long npages) - { - gfn_t end_gfn; - pfn_t pfn; - - pfn = gfn_to_pfn_memslot(slot, gfn); -- end_gfn = gfn + (size >> PAGE_SHIFT); -+ end_gfn = gfn + npages; - gfn += 1; - - if (is_error_noslot_pfn(pfn)) -@@ -119,7 +119,7 @@ int kvm_iommu_map_pages(struct kvm *kvm, struct kvm_memory_slot *slot) - * Pin all pages we are about to map in memory. This is - * important because we unmap and unpin in 4kb steps later. - */ -- pfn = kvm_pin_pages(slot, gfn, page_size); -+ pfn = kvm_pin_pages(slot, gfn, page_size >> PAGE_SHIFT); - if (is_error_noslot_pfn(pfn)) { - gfn += 1; - continue; -@@ -131,7 +131,7 @@ int kvm_iommu_map_pages(struct kvm *kvm, struct kvm_memory_slot *slot) - if (r) { - printk(KERN_ERR "kvm_iommu_map_address:" - "iommu failed to map pfn=%llx\n", pfn); -- kvm_unpin_pages(kvm, pfn, page_size); -+ kvm_unpin_pages(kvm, pfn, page_size >> PAGE_SHIFT); - goto unmap_pages; - } - diff --git a/projects/imx6/patches/linux/linux-000-patch-3.14.24-25.patch b/projects/imx6/patches/linux/linux-000-patch-3.14.24-25.patch deleted file mode 100644 index 03df3d2b238..00000000000 --- a/projects/imx6/patches/linux/linux-000-patch-3.14.24-25.patch +++ /dev/null @@ -1,7549 +0,0 @@ -diff --git a/Documentation/devicetree/bindings/ata/sata_rcar.txt b/Documentation/devicetree/bindings/ata/sata_rcar.txt -index 1e6111333fa8..7dd32d321a34 100644 ---- a/Documentation/devicetree/bindings/ata/sata_rcar.txt -+++ b/Documentation/devicetree/bindings/ata/sata_rcar.txt -@@ -3,7 +3,8 @@ - Required properties: - - compatible : should contain one of the following: - - "renesas,sata-r8a7779" for R-Car H1 -- - "renesas,sata-r8a7790" for R-Car H2 -+ - "renesas,sata-r8a7790-es1" for R-Car H2 ES1 -+ - "renesas,sata-r8a7790" for R-Car H2 other than ES1 - - "renesas,sata-r8a7791" for R-Car M2 - - reg : address and length of the SATA registers; - - interrupts : must consist of one interrupt specifier. -diff --git a/Makefile b/Makefile -index 8fd06101c482..eb96e40238f7 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,6 +1,6 @@ - VERSION = 3 - PATCHLEVEL = 14 --SUBLEVEL = 24 -+SUBLEVEL = 25 - EXTRAVERSION = - NAME = Remembering Coco - -diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S -index 066b03480b63..8017cde13648 100644 ---- a/arch/arm/boot/compressed/head.S -+++ b/arch/arm/boot/compressed/head.S -@@ -400,8 +400,7 @@ dtb_check_done: - add sp, sp, r6 - #endif - -- tst r4, #1 -- bleq cache_clean_flush -+ bl cache_clean_flush - - adr r0, BSYM(restart) - add r0, r0, r6 -@@ -1050,6 +1049,8 @@ cache_clean_flush: - b call_cache_fn - - __armv4_mpu_cache_flush: -+ tst r4, #1 -+ movne pc, lr - mov r2, #1 - mov r3, #0 - mcr p15, 0, ip, c7, c6, 0 @ invalidate D cache -@@ -1067,6 +1068,8 @@ __armv4_mpu_cache_flush: - mov pc, lr - - __fa526_cache_flush: -+ tst r4, #1 -+ movne pc, lr - mov r1, #0 - mcr p15, 0, r1, c7, c14, 0 @ clean and invalidate D cache - mcr p15, 0, r1, c7, c5, 0 @ flush I cache -@@ -1075,13 +1078,16 @@ __fa526_cache_flush: - - __armv6_mmu_cache_flush: - mov r1, #0 -- mcr p15, 0, r1, c7, c14, 0 @ clean+invalidate D -+ tst r4, #1 -+ mcreq p15, 0, r1, c7, c14, 0 @ clean+invalidate D - mcr p15, 0, r1, c7, c5, 0 @ invalidate I+BTB -- mcr p15, 0, r1, c7, c15, 0 @ clean+invalidate unified -+ mcreq p15, 0, r1, c7, c15, 0 @ clean+invalidate unified - mcr p15, 0, r1, c7, c10, 4 @ drain WB - mov pc, lr - - __armv7_mmu_cache_flush: -+ tst r4, #1 -+ bne iflush - mrc p15, 0, r10, c0, c1, 5 @ read ID_MMFR1 - tst r10, #0xf << 16 @ hierarchical cache (ARMv7) - mov r10, #0 -@@ -1142,6 +1148,8 @@ iflush: - mov pc, lr - - __armv5tej_mmu_cache_flush: -+ tst r4, #1 -+ movne pc, lr - 1: mrc p15, 0, r15, c7, c14, 3 @ test,clean,invalidate D cache - bne 1b - mcr p15, 0, r0, c7, c5, 0 @ flush I cache -@@ -1149,6 +1157,8 @@ __armv5tej_mmu_cache_flush: - mov pc, lr - - __armv4_mmu_cache_flush: -+ tst r4, #1 -+ movne pc, lr - mov r2, #64*1024 @ default: 32K dcache size (*2) - mov r11, #32 @ default: 32 byte line size - mrc p15, 0, r3, c0, c0, 1 @ read cache type -@@ -1182,6 +1192,8 @@ no_cache_id: - - __armv3_mmu_cache_flush: - __armv3_mpu_cache_flush: -+ tst r4, #1 -+ movne pc, lr - mov r1, #0 - mcr p15, 0, r1, c7, c0, 0 @ invalidate whole cache v3 - mov pc, lr -diff --git a/arch/arm/kernel/kprobes-common.c b/arch/arm/kernel/kprobes-common.c -index 18a76282970e..380c20fb9c85 100644 ---- a/arch/arm/kernel/kprobes-common.c -+++ b/arch/arm/kernel/kprobes-common.c -@@ -14,6 +14,7 @@ - #include <linux/kernel.h> - #include <linux/kprobes.h> - #include <asm/system_info.h> -+#include <asm/opcodes.h> - - #include "kprobes.h" - -@@ -305,7 +306,8 @@ kprobe_decode_ldmstm(kprobe_opcode_t insn, struct arch_specific_insn *asi) - - if (handler) { - /* We can emulate the instruction in (possibly) modified form */ -- asi->insn[0] = (insn & 0xfff00000) | (rn << 16) | reglist; -+ asi->insn[0] = __opcode_to_mem_arm((insn & 0xfff00000) | -+ (rn << 16) | reglist); - asi->insn_handler = handler; - return INSN_GOOD; - } -@@ -334,13 +336,14 @@ prepare_emulated_insn(kprobe_opcode_t insn, struct arch_specific_insn *asi, - #ifdef CONFIG_THUMB2_KERNEL - if (thumb) { - u16 *thumb_insn = (u16 *)asi->insn; -- thumb_insn[1] = 0x4770; /* Thumb bx lr */ -- thumb_insn[2] = 0x4770; /* Thumb bx lr */ -+ /* Thumb bx lr */ -+ thumb_insn[1] = __opcode_to_mem_thumb16(0x4770); -+ thumb_insn[2] = __opcode_to_mem_thumb16(0x4770); - return insn; - } -- asi->insn[1] = 0xe12fff1e; /* ARM bx lr */ -+ asi->insn[1] = __opcode_to_mem_arm(0xe12fff1e); /* ARM bx lr */ - #else -- asi->insn[1] = 0xe1a0f00e; /* mov pc, lr */ -+ asi->insn[1] = __opcode_to_mem_arm(0xe1a0f00e); /* mov pc, lr */ - #endif - /* Make an ARM instruction unconditional */ - if (insn < 0xe0000000) -@@ -360,12 +363,12 @@ set_emulated_insn(kprobe_opcode_t insn, struct arch_specific_insn *asi, - if (thumb) { - u16 *ip = (u16 *)asi->insn; - if (is_wide_instruction(insn)) -- *ip++ = insn >> 16; -- *ip++ = insn; -+ *ip++ = __opcode_to_mem_thumb16(insn >> 16); -+ *ip++ = __opcode_to_mem_thumb16(insn); - return; - } - #endif -- asi->insn[0] = insn; -+ asi->insn[0] = __opcode_to_mem_arm(insn); - } - - /* -diff --git a/arch/arm/kernel/kprobes-thumb.c b/arch/arm/kernel/kprobes-thumb.c -index 6123daf397a7..241222c66a13 100644 ---- a/arch/arm/kernel/kprobes-thumb.c -+++ b/arch/arm/kernel/kprobes-thumb.c -@@ -11,6 +11,7 @@ - #include <linux/kernel.h> - #include <linux/kprobes.h> - #include <linux/module.h> -+#include <asm/opcodes.h> - - #include "kprobes.h" - -@@ -163,9 +164,9 @@ t32_decode_ldmstm(kprobe_opcode_t insn, struct arch_specific_insn *asi) - enum kprobe_insn ret = kprobe_decode_ldmstm(insn, asi); - - /* Fixup modified instruction to have halfwords in correct order...*/ -- insn = asi->insn[0]; -- ((u16 *)asi->insn)[0] = insn >> 16; -- ((u16 *)asi->insn)[1] = insn & 0xffff; -+ insn = __mem_to_opcode_arm(asi->insn[0]); -+ ((u16 *)asi->insn)[0] = __opcode_to_mem_thumb16(insn >> 16); -+ ((u16 *)asi->insn)[1] = __opcode_to_mem_thumb16(insn & 0xffff); - - return ret; - } -@@ -1153,7 +1154,7 @@ t16_decode_hiregs(kprobe_opcode_t insn, struct arch_specific_insn *asi) - { - insn &= ~0x00ff; - insn |= 0x001; /* Set Rdn = R1 and Rm = R0 */ -- ((u16 *)asi->insn)[0] = insn; -+ ((u16 *)asi->insn)[0] = __opcode_to_mem_thumb16(insn); - asi->insn_handler = t16_emulate_hiregs; - return INSN_GOOD; - } -@@ -1182,8 +1183,10 @@ t16_decode_push(kprobe_opcode_t insn, struct arch_specific_insn *asi) - * and call it with R9=SP and LR in the register list represented - * by R8. - */ -- ((u16 *)asi->insn)[0] = 0xe929; /* 1st half STMDB R9!,{} */ -- ((u16 *)asi->insn)[1] = insn & 0x1ff; /* 2nd half (register list) */ -+ /* 1st half STMDB R9!,{} */ -+ ((u16 *)asi->insn)[0] = __opcode_to_mem_thumb16(0xe929); -+ /* 2nd half (register list) */ -+ ((u16 *)asi->insn)[1] = __opcode_to_mem_thumb16(insn & 0x1ff); - asi->insn_handler = t16_emulate_push; - return INSN_GOOD; - } -@@ -1232,8 +1235,10 @@ t16_decode_pop(kprobe_opcode_t insn, struct arch_specific_insn *asi) - * and call it with R9=SP and PC in the register list represented - * by R8. - */ -- ((u16 *)asi->insn)[0] = 0xe8b9; /* 1st half LDMIA R9!,{} */ -- ((u16 *)asi->insn)[1] = insn & 0x1ff; /* 2nd half (register list) */ -+ /* 1st half LDMIA R9!,{} */ -+ ((u16 *)asi->insn)[0] = __opcode_to_mem_thumb16(0xe8b9); -+ /* 2nd half (register list) */ -+ ((u16 *)asi->insn)[1] = __opcode_to_mem_thumb16(insn & 0x1ff); - asi->insn_handler = insn & 0x100 ? t16_emulate_pop_pc - : t16_emulate_pop_nopc; - return INSN_GOOD; -diff --git a/arch/arm/kernel/kprobes.c b/arch/arm/kernel/kprobes.c -index a7b621ece23d..49a87b6d0bf3 100644 ---- a/arch/arm/kernel/kprobes.c -+++ b/arch/arm/kernel/kprobes.c -@@ -26,6 +26,7 @@ - #include <linux/stop_machine.h> - #include <linux/stringify.h> - #include <asm/traps.h> -+#include <asm/opcodes.h> - #include <asm/cacheflush.h> - - #include "kprobes.h" -@@ -62,10 +63,10 @@ int __kprobes arch_prepare_kprobe(struct kprobe *p) - #ifdef CONFIG_THUMB2_KERNEL - thumb = true; - addr &= ~1; /* Bit 0 would normally be set to indicate Thumb code */ -- insn = ((u16 *)addr)[0]; -+ insn = __mem_to_opcode_thumb16(((u16 *)addr)[0]); - if (is_wide_instruction(insn)) { -- insn <<= 16; -- insn |= ((u16 *)addr)[1]; -+ u16 inst2 = __mem_to_opcode_thumb16(((u16 *)addr)[1]); -+ insn = __opcode_thumb32_compose(insn, inst2); - decode_insn = thumb32_kprobe_decode_insn; - } else - decode_insn = thumb16_kprobe_decode_insn; -@@ -73,7 +74,7 @@ int __kprobes arch_prepare_kprobe(struct kprobe *p) - thumb = false; - if (addr & 0x3) - return -EINVAL; -- insn = *p->addr; -+ insn = __mem_to_opcode_arm(*p->addr); - decode_insn = arm_kprobe_decode_insn; - #endif - -diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig -index ca8ecdee47d8..e9c290c21744 100644 ---- a/arch/arm/mm/Kconfig -+++ b/arch/arm/mm/Kconfig -@@ -798,6 +798,7 @@ config NEED_KUSER_HELPERS - - config KUSER_HELPERS - bool "Enable kuser helpers in vector page" if !NEED_KUSER_HELPERS -+ depends on MMU - default y - help - Warning: disabling this option may break user programs. -diff --git a/arch/arm64/kernel/insn.c b/arch/arm64/kernel/insn.c -index 92f36835486b..565e26f23f31 100644 ---- a/arch/arm64/kernel/insn.c -+++ b/arch/arm64/kernel/insn.c -@@ -156,9 +156,10 @@ static int __kprobes aarch64_insn_patch_text_cb(void *arg) - * which ends with "dsb; isb" pair guaranteeing global - * visibility. - */ -- atomic_set(&pp->cpu_count, -1); -+ /* Notify other processors with an additional increment. */ -+ atomic_inc(&pp->cpu_count); - } else { -- while (atomic_read(&pp->cpu_count) != -1) -+ while (atomic_read(&pp->cpu_count) <= num_online_cpus()) - cpu_relax(); - isb(); - } -diff --git a/arch/arm64/lib/clear_user.S b/arch/arm64/lib/clear_user.S -index 6e0ed93d51fe..c17967fdf5f6 100644 ---- a/arch/arm64/lib/clear_user.S -+++ b/arch/arm64/lib/clear_user.S -@@ -46,7 +46,7 @@ USER(9f, strh wzr, [x0], #2 ) - sub x1, x1, #2 - 4: adds x1, x1, #1 - b.mi 5f -- strb wzr, [x0] -+USER(9f, strb wzr, [x0] ) - 5: mov x0, #0 - ret - ENDPROC(__clear_user) -diff --git a/arch/parisc/include/uapi/asm/shmbuf.h b/arch/parisc/include/uapi/asm/shmbuf.h -index 0a3eada1863b..f395cde7b593 100644 ---- a/arch/parisc/include/uapi/asm/shmbuf.h -+++ b/arch/parisc/include/uapi/asm/shmbuf.h -@@ -36,23 +36,16 @@ struct shmid64_ds { - unsigned int __unused2; - }; - --#ifdef CONFIG_64BIT --/* The 'unsigned int' (formerly 'unsigned long') data types below will -- * ensure that a 32-bit app calling shmctl(*,IPC_INFO,*) will work on -- * a wide kernel, but if some of these values are meant to contain pointers -- * they may need to be 'long long' instead. -PB XXX FIXME -- */ --#endif - struct shminfo64 { -- unsigned int shmmax; -- unsigned int shmmin; -- unsigned int shmmni; -- unsigned int shmseg; -- unsigned int shmall; -- unsigned int __unused1; -- unsigned int __unused2; -- unsigned int __unused3; -- unsigned int __unused4; -+ unsigned long shmmax; -+ unsigned long shmmin; -+ unsigned long shmmni; -+ unsigned long shmseg; -+ unsigned long shmall; -+ unsigned long __unused1; -+ unsigned long __unused2; -+ unsigned long __unused3; -+ unsigned long __unused4; - }; - - #endif /* _PARISC_SHMBUF_H */ -diff --git a/arch/parisc/kernel/syscall_table.S b/arch/parisc/kernel/syscall_table.S -index 7dd8a3b22147..fc77d53e2ca5 100644 ---- a/arch/parisc/kernel/syscall_table.S -+++ b/arch/parisc/kernel/syscall_table.S -@@ -286,11 +286,11 @@ - ENTRY_COMP(msgsnd) - ENTRY_COMP(msgrcv) - ENTRY_SAME(msgget) /* 190 */ -- ENTRY_SAME(msgctl) -- ENTRY_SAME(shmat) -+ ENTRY_COMP(msgctl) -+ ENTRY_COMP(shmat) - ENTRY_SAME(shmdt) - ENTRY_SAME(shmget) -- ENTRY_SAME(shmctl) /* 195 */ -+ ENTRY_COMP(shmctl) /* 195 */ - ENTRY_SAME(ni_syscall) /* streams1 */ - ENTRY_SAME(ni_syscall) /* streams2 */ - ENTRY_SAME(lstat64) -@@ -323,7 +323,7 @@ - ENTRY_SAME(epoll_ctl) /* 225 */ - ENTRY_SAME(epoll_wait) - ENTRY_SAME(remap_file_pages) -- ENTRY_SAME(semtimedop) -+ ENTRY_COMP(semtimedop) - ENTRY_COMP(mq_open) - ENTRY_SAME(mq_unlink) /* 230 */ - ENTRY_COMP(mq_timedsend) -diff --git a/arch/sparc/include/asm/atomic_32.h b/arch/sparc/include/asm/atomic_32.h -index 905832aa9e9e..a0ed182ae73c 100644 ---- a/arch/sparc/include/asm/atomic_32.h -+++ b/arch/sparc/include/asm/atomic_32.h -@@ -21,7 +21,7 @@ - - extern int __atomic_add_return(int, atomic_t *); - extern int atomic_cmpxchg(atomic_t *, int, int); --#define atomic_xchg(v, new) (xchg(&((v)->counter), new)) -+extern int atomic_xchg(atomic_t *, int); - extern int __atomic_add_unless(atomic_t *, int, int); - extern void atomic_set(atomic_t *, int); - -diff --git a/arch/sparc/include/asm/cmpxchg_32.h b/arch/sparc/include/asm/cmpxchg_32.h -index 1fae1a02e3c2..ae0f9a7a314d 100644 ---- a/arch/sparc/include/asm/cmpxchg_32.h -+++ b/arch/sparc/include/asm/cmpxchg_32.h -@@ -11,22 +11,14 @@ - #ifndef __ARCH_SPARC_CMPXCHG__ - #define __ARCH_SPARC_CMPXCHG__ - --static inline unsigned long xchg_u32(__volatile__ unsigned long *m, unsigned long val) --{ -- __asm__ __volatile__("swap [%2], %0" -- : "=&r" (val) -- : "0" (val), "r" (m) -- : "memory"); -- return val; --} -- -+extern unsigned long __xchg_u32(volatile u32 *m, u32 new); - extern void __xchg_called_with_bad_pointer(void); - - static inline unsigned long __xchg(unsigned long x, __volatile__ void * ptr, int size) - { - switch (size) { - case 4: -- return xchg_u32(ptr, x); -+ return __xchg_u32(ptr, x); - } - __xchg_called_with_bad_pointer(); - return x; -diff --git a/arch/sparc/include/asm/vio.h b/arch/sparc/include/asm/vio.h -index 432afa838861..55841c184e6d 100644 ---- a/arch/sparc/include/asm/vio.h -+++ b/arch/sparc/include/asm/vio.h -@@ -118,12 +118,18 @@ struct vio_disk_attr_info { - u8 vdisk_type; - #define VD_DISK_TYPE_SLICE 0x01 /* Slice in block device */ - #define VD_DISK_TYPE_DISK 0x02 /* Entire block device */ -- u16 resv1; -+ u8 vdisk_mtype; /* v1.1 */ -+#define VD_MEDIA_TYPE_FIXED 0x01 /* Fixed device */ -+#define VD_MEDIA_TYPE_CD 0x02 /* CD Device */ -+#define VD_MEDIA_TYPE_DVD 0x03 /* DVD Device */ -+ u8 resv1; - u32 vdisk_block_size; - u64 operations; -- u64 vdisk_size; -+ u64 vdisk_size; /* v1.1 */ - u64 max_xfer_size; -- u64 resv2[2]; -+ u32 phys_block_size; /* v1.2 */ -+ u32 resv2; -+ u64 resv3[1]; - }; - - struct vio_disk_desc { -@@ -259,7 +265,7 @@ static inline u32 vio_dring_avail(struct vio_dring_state *dr, - unsigned int ring_size) - { - return (dr->pending - -- ((dr->prod - dr->cons) & (ring_size - 1))); -+ ((dr->prod - dr->cons) & (ring_size - 1)) - 1); - } - - #define VIO_MAX_TYPE_LEN 32 -diff --git a/arch/sparc/kernel/pci_schizo.c b/arch/sparc/kernel/pci_schizo.c -index 8f76f23dac38..f9c6813c132d 100644 ---- a/arch/sparc/kernel/pci_schizo.c -+++ b/arch/sparc/kernel/pci_schizo.c -@@ -581,7 +581,7 @@ static irqreturn_t schizo_pcierr_intr_other(struct pci_pbm_info *pbm) - { - unsigned long csr_reg, csr, csr_error_bits; - irqreturn_t ret = IRQ_NONE; -- u16 stat; -+ u32 stat; - - csr_reg = pbm->pbm_regs + SCHIZO_PCI_CTRL; - csr = upa_readq(csr_reg); -@@ -617,7 +617,7 @@ static irqreturn_t schizo_pcierr_intr_other(struct pci_pbm_info *pbm) - pbm->name); - ret = IRQ_HANDLED; - } -- pci_read_config_word(pbm->pci_bus->self, PCI_STATUS, &stat); -+ pbm->pci_ops->read(pbm->pci_bus, 0, PCI_STATUS, 2, &stat); - if (stat & (PCI_STATUS_PARITY | - PCI_STATUS_SIG_TARGET_ABORT | - PCI_STATUS_REC_TARGET_ABORT | -@@ -625,7 +625,7 @@ static irqreturn_t schizo_pcierr_intr_other(struct pci_pbm_info *pbm) - PCI_STATUS_SIG_SYSTEM_ERROR)) { - printk("%s: PCI bus error, PCI_STATUS[%04x]\n", - pbm->name, stat); -- pci_write_config_word(pbm->pci_bus->self, PCI_STATUS, 0xffff); -+ pbm->pci_ops->write(pbm->pci_bus, 0, PCI_STATUS, 2, 0xffff); - ret = IRQ_HANDLED; - } - return ret; -diff --git a/arch/sparc/kernel/smp_64.c b/arch/sparc/kernel/smp_64.c -index 50c3dd03be31..9af0a5dbb36d 100644 ---- a/arch/sparc/kernel/smp_64.c -+++ b/arch/sparc/kernel/smp_64.c -@@ -823,13 +823,17 @@ void arch_send_call_function_single_ipi(int cpu) - void __irq_entry smp_call_function_client(int irq, struct pt_regs *regs) - { - clear_softint(1 << irq); -+ irq_enter(); - generic_smp_call_function_interrupt(); -+ irq_exit(); - } - - void __irq_entry smp_call_function_single_client(int irq, struct pt_regs *regs) - { - clear_softint(1 << irq); -+ irq_enter(); - generic_smp_call_function_single_interrupt(); -+ irq_exit(); - } - - static void tsb_sync(void *info) -diff --git a/arch/sparc/lib/atomic32.c b/arch/sparc/lib/atomic32.c -index 1d32b54089aa..8f2f94d53434 100644 ---- a/arch/sparc/lib/atomic32.c -+++ b/arch/sparc/lib/atomic32.c -@@ -40,6 +40,19 @@ int __atomic_add_return(int i, atomic_t *v) - } - EXPORT_SYMBOL(__atomic_add_return); - -+int atomic_xchg(atomic_t *v, int new) -+{ -+ int ret; -+ unsigned long flags; -+ -+ spin_lock_irqsave(ATOMIC_HASH(v), flags); -+ ret = v->counter; -+ v->counter = new; -+ spin_unlock_irqrestore(ATOMIC_HASH(v), flags); -+ return ret; -+} -+EXPORT_SYMBOL(atomic_xchg); -+ - int atomic_cmpxchg(atomic_t *v, int old, int new) - { - int ret; -@@ -132,3 +145,17 @@ unsigned long __cmpxchg_u32(volatile u32 *ptr, u32 old, u32 new) - return (unsigned long)prev; - } - EXPORT_SYMBOL(__cmpxchg_u32); -+ -+unsigned long __xchg_u32(volatile u32 *ptr, u32 new) -+{ -+ unsigned long flags; -+ u32 prev; -+ -+ spin_lock_irqsave(ATOMIC_HASH(ptr), flags); -+ prev = *ptr; -+ *ptr = new; -+ spin_unlock_irqrestore(ATOMIC_HASH(ptr), flags); -+ -+ return (unsigned long)prev; -+} -+EXPORT_SYMBOL(__xchg_u32); -diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile -index 0fcd9133790c..14fe7cba21d1 100644 ---- a/arch/x86/boot/compressed/Makefile -+++ b/arch/x86/boot/compressed/Makefile -@@ -75,8 +75,10 @@ suffix-$(CONFIG_KERNEL_XZ) := xz - suffix-$(CONFIG_KERNEL_LZO) := lzo - suffix-$(CONFIG_KERNEL_LZ4) := lz4 - -+RUN_SIZE = $(shell objdump -h vmlinux | \ -+ perl $(srctree)/arch/x86/tools/calc_run_size.pl) - quiet_cmd_mkpiggy = MKPIGGY $@ -- cmd_mkpiggy = $(obj)/mkpiggy $< > $@ || ( rm -f $@ ; false ) -+ cmd_mkpiggy = $(obj)/mkpiggy $< $(RUN_SIZE) > $@ || ( rm -f $@ ; false ) - - targets += piggy.S - $(obj)/piggy.S: $(obj)/vmlinux.bin.$(suffix-y) $(obj)/mkpiggy FORCE -diff --git a/arch/x86/boot/compressed/head_32.S b/arch/x86/boot/compressed/head_32.S -index f45ab7a36fb6..c5b56ed10aff 100644 ---- a/arch/x86/boot/compressed/head_32.S -+++ b/arch/x86/boot/compressed/head_32.S -@@ -186,7 +186,8 @@ relocated: - * Do the decompression, and jump to the new kernel.. - */ - /* push arguments for decompress_kernel: */ -- pushl $z_output_len /* decompressed length */ -+ pushl $z_run_size /* size of kernel with .bss and .brk */ -+ pushl $z_output_len /* decompressed length, end of relocs */ - leal z_extract_offset_negative(%ebx), %ebp - pushl %ebp /* output address */ - pushl $z_input_len /* input_len */ -@@ -196,7 +197,7 @@ relocated: - pushl %eax /* heap area */ - pushl %esi /* real mode pointer */ - call decompress_kernel /* returns kernel location in %eax */ -- addl $24, %esp -+ addl $28, %esp - - /* - * Jump to the decompressed kernel. -diff --git a/arch/x86/boot/compressed/head_64.S b/arch/x86/boot/compressed/head_64.S -index b10fa66a2540..34bbc0911b7c 100644 ---- a/arch/x86/boot/compressed/head_64.S -+++ b/arch/x86/boot/compressed/head_64.S -@@ -334,13 +334,16 @@ relocated: - * Do the decompression, and jump to the new kernel.. - */ - pushq %rsi /* Save the real mode argument */ -+ movq $z_run_size, %r9 /* size of kernel with .bss and .brk */ -+ pushq %r9 - movq %rsi, %rdi /* real mode address */ - leaq boot_heap(%rip), %rsi /* malloc area for uncompression */ - leaq input_data(%rip), %rdx /* input_data */ - movl $z_input_len, %ecx /* input_len */ - movq %rbp, %r8 /* output target address */ -- movq $z_output_len, %r9 /* decompressed length */ -+ movq $z_output_len, %r9 /* decompressed length, end of relocs */ - call decompress_kernel /* returns kernel location in %rax */ -+ popq %r9 - popq %rsi - - /* -diff --git a/arch/x86/boot/compressed/misc.c b/arch/x86/boot/compressed/misc.c -index 196eaf373a06..eb25ca1eb6da 100644 ---- a/arch/x86/boot/compressed/misc.c -+++ b/arch/x86/boot/compressed/misc.c -@@ -393,7 +393,8 @@ asmlinkage void *decompress_kernel(void *rmode, memptr heap, - unsigned char *input_data, - unsigned long input_len, - unsigned char *output, -- unsigned long output_len) -+ unsigned long output_len, -+ unsigned long run_size) - { - real_mode = rmode; - -@@ -416,8 +417,14 @@ asmlinkage void *decompress_kernel(void *rmode, memptr heap, - free_mem_ptr = heap; /* Heap */ - free_mem_end_ptr = heap + BOOT_HEAP_SIZE; - -- output = choose_kernel_location(input_data, input_len, -- output, output_len); -+ /* -+ * The memory hole needed for the kernel is the larger of either -+ * the entire decompressed kernel plus relocation table, or the -+ * entire decompressed kernel plus .bss and .brk sections. -+ */ -+ output = choose_kernel_location(input_data, input_len, output, -+ output_len > run_size ? output_len -+ : run_size); - - /* Validate memory location choices. */ - if ((unsigned long)output & (MIN_KERNEL_ALIGN - 1)) -diff --git a/arch/x86/boot/compressed/mkpiggy.c b/arch/x86/boot/compressed/mkpiggy.c -index b669ab65bf6c..d8222f213182 100644 ---- a/arch/x86/boot/compressed/mkpiggy.c -+++ b/arch/x86/boot/compressed/mkpiggy.c -@@ -36,11 +36,13 @@ int main(int argc, char *argv[]) - uint32_t olen; - long ilen; - unsigned long offs; -+ unsigned long run_size; - FILE *f = NULL; - int retval = 1; - -- if (argc < 2) { -- fprintf(stderr, "Usage: %s compressed_file\n", argv[0]); -+ if (argc < 3) { -+ fprintf(stderr, "Usage: %s compressed_file run_size\n", -+ argv[0]); - goto bail; - } - -@@ -74,6 +76,7 @@ int main(int argc, char *argv[]) - offs += olen >> 12; /* Add 8 bytes for each 32K block */ - offs += 64*1024 + 128; /* Add 64K + 128 bytes slack */ - offs = (offs+4095) & ~4095; /* Round to a 4K boundary */ -+ run_size = atoi(argv[2]); - - printf(".section \".rodata..compressed\",\"a\",@progbits\n"); - printf(".globl z_input_len\n"); -@@ -85,6 +88,8 @@ int main(int argc, char *argv[]) - /* z_extract_offset_negative allows simplification of head_32.S */ - printf(".globl z_extract_offset_negative\n"); - printf("z_extract_offset_negative = -0x%lx\n", offs); -+ printf(".globl z_run_size\n"); -+ printf("z_run_size = %lu\n", run_size); - - printf(".globl input_data, input_data_end\n"); - printf("input_data:\n"); -diff --git a/arch/x86/kernel/cpu/microcode/amd_early.c b/arch/x86/kernel/cpu/microcode/amd_early.c -index 617a9e284245..b63773ba1646 100644 ---- a/arch/x86/kernel/cpu/microcode/amd_early.c -+++ b/arch/x86/kernel/cpu/microcode/amd_early.c -@@ -108,12 +108,13 @@ static size_t compute_container_size(u8 *data, u32 total_size) - * load_microcode_amd() to save equivalent cpu table and microcode patches in - * kernel heap memory. - */ --static void apply_ucode_in_initrd(void *ucode, size_t size) -+static void apply_ucode_in_initrd(void *ucode, size_t size, bool save_patch) - { - struct equiv_cpu_entry *eq; - size_t *cont_sz; - u32 *header; - u8 *data, **cont; -+ u8 (*patch)[PATCH_MAX_SIZE]; - u16 eq_id = 0; - int offset, left; - u32 rev, eax, ebx, ecx, edx; -@@ -123,10 +124,12 @@ static void apply_ucode_in_initrd(void *ucode, size_t size) - new_rev = (u32 *)__pa_nodebug(&ucode_new_rev); - cont_sz = (size_t *)__pa_nodebug(&container_size); - cont = (u8 **)__pa_nodebug(&container); -+ patch = (u8 (*)[PATCH_MAX_SIZE])__pa_nodebug(&amd_ucode_patch); - #else - new_rev = &ucode_new_rev; - cont_sz = &container_size; - cont = &container; -+ patch = &amd_ucode_patch; - #endif - - data = ucode; -@@ -213,9 +216,9 @@ static void apply_ucode_in_initrd(void *ucode, size_t size) - rev = mc->hdr.patch_id; - *new_rev = rev; - -- /* save ucode patch */ -- memcpy(amd_ucode_patch, mc, -- min_t(u32, header[1], PATCH_MAX_SIZE)); -+ if (save_patch) -+ memcpy(patch, mc, -+ min_t(u32, header[1], PATCH_MAX_SIZE)); - } - } - -@@ -246,7 +249,7 @@ void __init load_ucode_amd_bsp(void) - *data = cp.data; - *size = cp.size; - -- apply_ucode_in_initrd(cp.data, cp.size); -+ apply_ucode_in_initrd(cp.data, cp.size, true); - } - - #ifdef CONFIG_X86_32 -@@ -263,7 +266,7 @@ void load_ucode_amd_ap(void) - size_t *usize; - void **ucode; - -- mc = (struct microcode_amd *)__pa(amd_ucode_patch); -+ mc = (struct microcode_amd *)__pa_nodebug(amd_ucode_patch); - if (mc->hdr.patch_id && mc->hdr.processor_rev_id) { - __apply_microcode_amd(mc); - return; -@@ -275,7 +278,7 @@ void load_ucode_amd_ap(void) - if (!*ucode || !*usize) - return; - -- apply_ucode_in_initrd(*ucode, *usize); -+ apply_ucode_in_initrd(*ucode, *usize, false); - } - - static void __init collect_cpu_sig_on_bsp(void *arg) -@@ -339,7 +342,7 @@ void load_ucode_amd_ap(void) - * AP has a different equivalence ID than BSP, looks like - * mixed-steppings silicon so go through the ucode blob anew. - */ -- apply_ucode_in_initrd(ucode_cpio.data, ucode_cpio.size); -+ apply_ucode_in_initrd(ucode_cpio.data, ucode_cpio.size, false); - } - } - #endif -@@ -347,7 +350,9 @@ void load_ucode_amd_ap(void) - int __init save_microcode_in_initrd_amd(void) - { - unsigned long cont; -+ int retval = 0; - enum ucode_state ret; -+ u8 *cont_va; - u32 eax; - - if (!container) -@@ -355,13 +360,15 @@ int __init save_microcode_in_initrd_amd(void) - - #ifdef CONFIG_X86_32 - get_bsp_sig(); -- cont = (unsigned long)container; -+ cont = (unsigned long)container; -+ cont_va = __va(container); - #else - /* - * We need the physical address of the container for both bitness since - * boot_params.hdr.ramdisk_image is a physical address. - */ -- cont = __pa(container); -+ cont = __pa(container); -+ cont_va = container; - #endif - - /* -@@ -372,6 +379,8 @@ int __init save_microcode_in_initrd_amd(void) - if (relocated_ramdisk) - container = (u8 *)(__va(relocated_ramdisk) + - (cont - boot_params.hdr.ramdisk_image)); -+ else -+ container = cont_va; - - if (ucode_new_rev) - pr_info("microcode: updated early to new patch_level=0x%08x\n", -@@ -382,7 +391,7 @@ int __init save_microcode_in_initrd_amd(void) - - ret = load_microcode_amd(eax, container, container_size); - if (ret != UCODE_OK) -- return -EINVAL; -+ retval = -EINVAL; - - /* - * This will be freed any msec now, stash patches for the current -@@ -391,5 +400,5 @@ int __init save_microcode_in_initrd_amd(void) - container = NULL; - container_size = 0; - -- return 0; -+ return retval; - } -diff --git a/arch/x86/kernel/cpu/perf_event_intel.c b/arch/x86/kernel/cpu/perf_event_intel.c -index 1340ebfcb467..5ee8064bd1d2 100644 ---- a/arch/x86/kernel/cpu/perf_event_intel.c -+++ b/arch/x86/kernel/cpu/perf_event_intel.c -@@ -2475,6 +2475,9 @@ __init int intel_pmu_init(void) - case 62: /* IvyBridge EP */ - memcpy(hw_cache_event_ids, snb_hw_cache_event_ids, - sizeof(hw_cache_event_ids)); -+ /* dTLB-load-misses on IVB is different than SNB */ -+ hw_cache_event_ids[C(DTLB)][C(OP_READ)][C(RESULT_MISS)] = 0x8108; /* DTLB_LOAD_MISSES.DEMAND_LD_MISS_CAUSES_A_WALK */ -+ - memcpy(hw_cache_extra_regs, snb_hw_cache_extra_regs, - sizeof(hw_cache_extra_regs)); - -diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c -index 7461f50d5bb1..0686fe313b3b 100644 ---- a/arch/x86/kernel/ptrace.c -+++ b/arch/x86/kernel/ptrace.c -@@ -1441,15 +1441,6 @@ void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs, - force_sig_info(SIGTRAP, &info, tsk); - } - -- --#ifdef CONFIG_X86_32 --# define IS_IA32 1 --#elif defined CONFIG_IA32_EMULATION --# define IS_IA32 is_compat_task() --#else --# define IS_IA32 0 --#endif -- - /* - * We must return the syscall number to actually look up in the table. - * This can be -1L to skip running any syscall at all. -@@ -1487,7 +1478,7 @@ long syscall_trace_enter(struct pt_regs *regs) - if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT))) - trace_sys_enter(regs, regs->orig_ax); - -- if (IS_IA32) -+ if (is_ia32_task()) - audit_syscall_entry(AUDIT_ARCH_I386, - regs->orig_ax, - regs->bx, regs->cx, -diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c -index 51c2851ca243..fab97ade0fc8 100644 ---- a/arch/x86/kvm/x86.c -+++ b/arch/x86/kvm/x86.c -@@ -4911,7 +4911,7 @@ static int handle_emulation_failure(struct kvm_vcpu *vcpu) - - ++vcpu->stat.insn_emulation_fail; - trace_kvm_emulate_insn_failed(vcpu); -- if (!is_guest_mode(vcpu)) { -+ if (!is_guest_mode(vcpu) && kvm_x86_ops->get_cpl(vcpu) == 0) { - vcpu->run->exit_reason = KVM_EXIT_INTERNAL_ERROR; - vcpu->run->internal.suberror = KVM_INTERNAL_ERROR_EMULATION; - vcpu->run->internal.ndata = 0; -diff --git a/arch/x86/mm/pgtable.c b/arch/x86/mm/pgtable.c -index c96314abd144..0004ac72dbdd 100644 ---- a/arch/x86/mm/pgtable.c -+++ b/arch/x86/mm/pgtable.c -@@ -399,13 +399,20 @@ int pmdp_test_and_clear_young(struct vm_area_struct *vma, - int ptep_clear_flush_young(struct vm_area_struct *vma, - unsigned long address, pte_t *ptep) - { -- int young; -- -- young = ptep_test_and_clear_young(vma, address, ptep); -- if (young) -- flush_tlb_page(vma, address); -- -- return young; -+ /* -+ * On x86 CPUs, clearing the accessed bit without a TLB flush -+ * doesn't cause data corruption. [ It could cause incorrect -+ * page aging and the (mistaken) reclaim of hot pages, but the -+ * chance of that should be relatively low. ] -+ * -+ * So as a performance optimization don't flush the TLB when -+ * clearing the accessed bit, it will eventually be flushed by -+ * a context switch or a VM operation anyway. [ In the rare -+ * event of it not getting flushed for a long time the delay -+ * shouldn't really matter because there's no real memory -+ * pressure for swapout to react to. ] -+ */ -+ return ptep_test_and_clear_young(vma, address, ptep); - } - - #ifdef CONFIG_TRANSPARENT_HUGEPAGE -diff --git a/arch/x86/tools/calc_run_size.pl b/arch/x86/tools/calc_run_size.pl -new file mode 100644 -index 000000000000..0b0b124d3ece ---- /dev/null -+++ b/arch/x86/tools/calc_run_size.pl -@@ -0,0 +1,30 @@ -+#!/usr/bin/perl -+# -+# Calculate the amount of space needed to run the kernel, including room for -+# the .bss and .brk sections. -+# -+# Usage: -+# objdump -h a.out | perl calc_run_size.pl -+use strict; -+ -+my $mem_size = 0; -+my $file_offset = 0; -+ -+my $sections=" *[0-9]+ \.(?:bss|brk) +"; -+while (<>) { -+ if (/^$sections([0-9a-f]+) +(?:[0-9a-f]+ +){2}([0-9a-f]+)/) { -+ my $size = hex($1); -+ my $offset = hex($2); -+ $mem_size += $size; -+ if ($file_offset == 0) { -+ $file_offset = $offset; -+ } elsif ($file_offset != $offset) { -+ die ".bss and .brk lack common file offset\n"; -+ } -+ } -+} -+ -+if ($file_offset == 0) { -+ die "Never found .bss or .brk file offset\n"; -+} -+printf("%d\n", $mem_size + $file_offset); -diff --git a/arch/xtensa/include/uapi/asm/unistd.h b/arch/xtensa/include/uapi/asm/unistd.h -index b9395529f02d..50084f7c01c8 100644 ---- a/arch/xtensa/include/uapi/asm/unistd.h -+++ b/arch/xtensa/include/uapi/asm/unistd.h -@@ -384,7 +384,8 @@ __SYSCALL(174, sys_chroot, 1) - #define __NR_pivot_root 175 - __SYSCALL(175, sys_pivot_root, 2) - #define __NR_umount 176 --__SYSCALL(176, sys_umount, 2) -+__SYSCALL(176, sys_oldumount, 1) -+#define __ARCH_WANT_SYS_OLDUMOUNT - #define __NR_swapoff 177 - __SYSCALL(177, sys_swapoff, 1) - #define __NR_sync 178 -diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c -index 00663d60f6d4..e662f147d436 100644 ---- a/drivers/ata/ahci.c -+++ b/drivers/ata/ahci.c -@@ -61,6 +61,7 @@ enum board_ids { - /* board IDs by feature in alphabetical order */ - board_ahci, - board_ahci_ign_iferr, -+ board_ahci_nomsi, - board_ahci_noncq, - board_ahci_nosntf, - board_ahci_yes_fbs, -@@ -122,6 +123,13 @@ static const struct ata_port_info ahci_port_info[] = { - .udma_mask = ATA_UDMA6, - .port_ops = &ahci_ops, - }, -+ [board_ahci_nomsi] = { -+ AHCI_HFLAGS (AHCI_HFLAG_NO_MSI), -+ .flags = AHCI_FLAG_COMMON, -+ .pio_mask = ATA_PIO4, -+ .udma_mask = ATA_UDMA6, -+ .port_ops = &ahci_ops, -+ }, - [board_ahci_noncq] = { - AHCI_HFLAGS (AHCI_HFLAG_NO_NCQ), - .flags = AHCI_FLAG_COMMON, -@@ -314,6 +322,11 @@ static const struct pci_device_id ahci_pci_tbl[] = { - { PCI_VDEVICE(INTEL, 0x8c87), board_ahci }, /* 9 Series RAID */ - { PCI_VDEVICE(INTEL, 0x8c8e), board_ahci }, /* 9 Series RAID */ - { PCI_VDEVICE(INTEL, 0x8c8f), board_ahci }, /* 9 Series RAID */ -+ { PCI_VDEVICE(INTEL, 0xa103), board_ahci }, /* Sunrise Point-H AHCI */ -+ { PCI_VDEVICE(INTEL, 0xa103), board_ahci }, /* Sunrise Point-H RAID */ -+ { PCI_VDEVICE(INTEL, 0xa105), board_ahci }, /* Sunrise Point-H RAID */ -+ { PCI_VDEVICE(INTEL, 0xa107), board_ahci }, /* Sunrise Point-H RAID */ -+ { PCI_VDEVICE(INTEL, 0xa10f), board_ahci }, /* Sunrise Point-H RAID */ - - /* JMicron 360/1/3/5/6, match class to avoid IDE function */ - { PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, -@@ -476,10 +489,10 @@ static const struct pci_device_id ahci_pci_tbl[] = { - { PCI_VDEVICE(ASMEDIA, 0x0612), board_ahci }, /* ASM1062 */ - - /* -- * Samsung SSDs found on some macbooks. NCQ times out. -- * https://bugzilla.kernel.org/show_bug.cgi?id=60731 -+ * Samsung SSDs found on some macbooks. NCQ times out if MSI is -+ * enabled. https://bugzilla.kernel.org/show_bug.cgi?id=60731 - */ -- { PCI_VDEVICE(SAMSUNG, 0x1600), board_ahci_noncq }, -+ { PCI_VDEVICE(SAMSUNG, 0x1600), board_ahci_nomsi }, - - /* Enmotus */ - { PCI_DEVICE(0x1c44, 0x8000), board_ahci }, -diff --git a/drivers/ata/sata_rcar.c b/drivers/ata/sata_rcar.c -index 2b25bd83fc9d..c1ea780fca07 100644 ---- a/drivers/ata/sata_rcar.c -+++ b/drivers/ata/sata_rcar.c -@@ -146,6 +146,7 @@ - enum sata_rcar_type { - RCAR_GEN1_SATA, - RCAR_GEN2_SATA, -+ RCAR_R8A7790_ES1_SATA, - }; - - struct sata_rcar_priv { -@@ -763,6 +764,9 @@ static void sata_rcar_setup_port(struct ata_host *host) - ap->udma_mask = ATA_UDMA6; - ap->flags |= ATA_FLAG_SATA; - -+ if (priv->type == RCAR_R8A7790_ES1_SATA) -+ ap->flags |= ATA_FLAG_NO_DIPM; -+ - ioaddr->cmd_addr = base + SDATA_REG; - ioaddr->ctl_addr = base + SSDEVCON_REG; - ioaddr->scr_addr = base + SCRSSTS_REG; -@@ -792,6 +796,7 @@ static void sata_rcar_init_controller(struct ata_host *host) - sata_rcar_gen1_phy_init(priv); - break; - case RCAR_GEN2_SATA: -+ case RCAR_R8A7790_ES1_SATA: - sata_rcar_gen2_phy_init(priv); - break; - default: -@@ -838,6 +843,10 @@ static struct of_device_id sata_rcar_match[] = { - .data = (void *)RCAR_GEN2_SATA - }, - { -+ .compatible = "renesas,sata-r8a7790-es1", -+ .data = (void *)RCAR_R8A7790_ES1_SATA -+ }, -+ { - .compatible = "renesas,sata-r8a7791", - .data = (void *)RCAR_GEN2_SATA - }, -@@ -849,6 +858,7 @@ static const struct platform_device_id sata_rcar_id_table[] = { - { "sata_rcar", RCAR_GEN1_SATA }, /* Deprecated by "sata-r8a7779" */ - { "sata-r8a7779", RCAR_GEN1_SATA }, - { "sata-r8a7790", RCAR_GEN2_SATA }, -+ { "sata-r8a7790-es1", RCAR_R8A7790_ES1_SATA }, - { "sata-r8a7791", RCAR_GEN2_SATA }, - { }, - }; -diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c -index f6cff3be0ed7..2f9a3d8ecbbf 100644 ---- a/drivers/base/regmap/regmap.c -+++ b/drivers/base/regmap/regmap.c -@@ -1557,8 +1557,10 @@ int regmap_bulk_write(struct regmap *map, unsigned int reg, const void *val, - } else { - void *wval; - -- if (!val_count) -- return -EINVAL; -+ if (!val_count) { -+ ret = -EINVAL; -+ goto out; -+ } - - wval = kmemdup(val, val_count * val_bytes, GFP_KERNEL); - if (!wval) { -diff --git a/drivers/block/sunvdc.c b/drivers/block/sunvdc.c -index 5814deb6963d..0ebadf93b6c5 100644 ---- a/drivers/block/sunvdc.c -+++ b/drivers/block/sunvdc.c -@@ -9,6 +9,7 @@ - #include <linux/blkdev.h> - #include <linux/hdreg.h> - #include <linux/genhd.h> -+#include <linux/cdrom.h> - #include <linux/slab.h> - #include <linux/spinlock.h> - #include <linux/completion.h> -@@ -22,8 +23,8 @@ - - #define DRV_MODULE_NAME "sunvdc" - #define PFX DRV_MODULE_NAME ": " --#define DRV_MODULE_VERSION "1.0" --#define DRV_MODULE_RELDATE "June 25, 2007" -+#define DRV_MODULE_VERSION "1.1" -+#define DRV_MODULE_RELDATE "February 13, 2013" - - static char version[] = - DRV_MODULE_NAME ".c:v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n"; -@@ -32,7 +33,7 @@ MODULE_DESCRIPTION("Sun LDOM virtual disk client driver"); - MODULE_LICENSE("GPL"); - MODULE_VERSION(DRV_MODULE_VERSION); - --#define VDC_TX_RING_SIZE 256 -+#define VDC_TX_RING_SIZE 512 - - #define WAITING_FOR_LINK_UP 0x01 - #define WAITING_FOR_TX_SPACE 0x02 -@@ -65,11 +66,9 @@ struct vdc_port { - u64 operations; - u32 vdisk_size; - u8 vdisk_type; -+ u8 vdisk_mtype; - - char disk_name[32]; -- -- struct vio_disk_geom geom; -- struct vio_disk_vtoc label; - }; - - static inline struct vdc_port *to_vdc_port(struct vio_driver_state *vio) -@@ -79,9 +78,16 @@ static inline struct vdc_port *to_vdc_port(struct vio_driver_state *vio) - - /* Ordered from largest major to lowest */ - static struct vio_version vdc_versions[] = { -+ { .major = 1, .minor = 1 }, - { .major = 1, .minor = 0 }, - }; - -+static inline int vdc_version_supported(struct vdc_port *port, -+ u16 major, u16 minor) -+{ -+ return port->vio.ver.major == major && port->vio.ver.minor >= minor; -+} -+ - #define VDCBLK_NAME "vdisk" - static int vdc_major; - #define PARTITION_SHIFT 3 -@@ -94,18 +100,54 @@ static inline u32 vdc_tx_dring_avail(struct vio_dring_state *dr) - static int vdc_getgeo(struct block_device *bdev, struct hd_geometry *geo) - { - struct gendisk *disk = bdev->bd_disk; -- struct vdc_port *port = disk->private_data; -+ sector_t nsect = get_capacity(disk); -+ sector_t cylinders = nsect; - -- geo->heads = (u8) port->geom.num_hd; -- geo->sectors = (u8) port->geom.num_sec; -- geo->cylinders = port->geom.num_cyl; -+ geo->heads = 0xff; -+ geo->sectors = 0x3f; -+ sector_div(cylinders, geo->heads * geo->sectors); -+ geo->cylinders = cylinders; -+ if ((sector_t)(geo->cylinders + 1) * geo->heads * geo->sectors < nsect) -+ geo->cylinders = 0xffff; - - return 0; - } - -+/* Add ioctl/CDROM_GET_CAPABILITY to support cdrom_id in udev -+ * when vdisk_mtype is VD_MEDIA_TYPE_CD or VD_MEDIA_TYPE_DVD. -+ * Needed to be able to install inside an ldom from an iso image. -+ */ -+static int vdc_ioctl(struct block_device *bdev, fmode_t mode, -+ unsigned command, unsigned long argument) -+{ -+ int i; -+ struct gendisk *disk; -+ -+ switch (command) { -+ case CDROMMULTISESSION: -+ pr_debug(PFX "Multisession CDs not supported\n"); -+ for (i = 0; i < sizeof(struct cdrom_multisession); i++) -+ if (put_user(0, (char __user *)(argument + i))) -+ return -EFAULT; -+ return 0; -+ -+ case CDROM_GET_CAPABILITY: -+ disk = bdev->bd_disk; -+ -+ if (bdev->bd_disk && (disk->flags & GENHD_FL_CD)) -+ return 0; -+ return -EINVAL; -+ -+ default: -+ pr_debug(PFX "ioctl %08x not supported\n", command); -+ return -EINVAL; -+ } -+} -+ - static const struct block_device_operations vdc_fops = { - .owner = THIS_MODULE, - .getgeo = vdc_getgeo, -+ .ioctl = vdc_ioctl, - }; - - static void vdc_finish(struct vio_driver_state *vio, int err, int waiting_for) -@@ -165,9 +207,9 @@ static int vdc_handle_attr(struct vio_driver_state *vio, void *arg) - struct vio_disk_attr_info *pkt = arg; - - viodbg(HS, "GOT ATTR stype[0x%x] ops[%llx] disk_size[%llu] disk_type[%x] " -- "xfer_mode[0x%x] blksz[%u] max_xfer[%llu]\n", -+ "mtype[0x%x] xfer_mode[0x%x] blksz[%u] max_xfer[%llu]\n", - pkt->tag.stype, pkt->operations, -- pkt->vdisk_size, pkt->vdisk_type, -+ pkt->vdisk_size, pkt->vdisk_type, pkt->vdisk_mtype, - pkt->xfer_mode, pkt->vdisk_block_size, - pkt->max_xfer_size); - -@@ -192,8 +234,11 @@ static int vdc_handle_attr(struct vio_driver_state *vio, void *arg) - } - - port->operations = pkt->operations; -- port->vdisk_size = pkt->vdisk_size; - port->vdisk_type = pkt->vdisk_type; -+ if (vdc_version_supported(port, 1, 1)) { -+ port->vdisk_size = pkt->vdisk_size; -+ port->vdisk_mtype = pkt->vdisk_mtype; -+ } - if (pkt->max_xfer_size < port->max_xfer_size) - port->max_xfer_size = pkt->max_xfer_size; - port->vdisk_block_size = pkt->vdisk_block_size; -@@ -236,7 +281,9 @@ static void vdc_end_one(struct vdc_port *port, struct vio_dring_state *dr, - - __blk_end_request(req, (desc->status ? -EIO : 0), desc->size); - -- if (blk_queue_stopped(port->disk->queue)) -+ /* restart blk queue when ring is half emptied */ -+ if (blk_queue_stopped(port->disk->queue) && -+ vdc_tx_dring_avail(dr) * 100 / VDC_TX_RING_SIZE >= 50) - blk_start_queue(port->disk->queue); - } - -@@ -388,12 +435,6 @@ static int __send_request(struct request *req) - for (i = 0; i < nsg; i++) - len += sg[i].length; - -- if (unlikely(vdc_tx_dring_avail(dr) < 1)) { -- blk_stop_queue(port->disk->queue); -- err = -ENOMEM; -- goto out; -- } -- - desc = vio_dring_cur(dr); - - err = ldc_map_sg(port->vio.lp, sg, nsg, -@@ -433,21 +474,32 @@ static int __send_request(struct request *req) - port->req_id++; - dr->prod = (dr->prod + 1) & (VDC_TX_RING_SIZE - 1); - } --out: - - return err; - } - --static void do_vdc_request(struct request_queue *q) -+static void do_vdc_request(struct request_queue *rq) - { -- while (1) { -- struct request *req = blk_fetch_request(q); -+ struct request *req; - -- if (!req) -- break; -+ while ((req = blk_peek_request(rq)) != NULL) { -+ struct vdc_port *port; -+ struct vio_dring_state *dr; - -- if (__send_request(req) < 0) -- __blk_end_request_all(req, -EIO); -+ port = req->rq_disk->private_data; -+ dr = &port->vio.drings[VIO_DRIVER_TX_RING]; -+ if (unlikely(vdc_tx_dring_avail(dr) < 1)) -+ goto wait; -+ -+ blk_start_request(req); -+ -+ if (__send_request(req) < 0) { -+ blk_requeue_request(rq, req); -+wait: -+ /* Avoid pointless unplugs. */ -+ blk_stop_queue(rq); -+ break; -+ } - } - } - -@@ -656,25 +708,27 @@ static int probe_disk(struct vdc_port *port) - if (comp.err) - return comp.err; - -- err = generic_request(port, VD_OP_GET_VTOC, -- &port->label, sizeof(port->label)); -- if (err < 0) { -- printk(KERN_ERR PFX "VD_OP_GET_VTOC returns error %d\n", err); -- return err; -- } -- -- err = generic_request(port, VD_OP_GET_DISKGEOM, -- &port->geom, sizeof(port->geom)); -- if (err < 0) { -- printk(KERN_ERR PFX "VD_OP_GET_DISKGEOM returns " -- "error %d\n", err); -- return err; -+ if (vdc_version_supported(port, 1, 1)) { -+ /* vdisk_size should be set during the handshake, if it wasn't -+ * then the underlying disk is reserved by another system -+ */ -+ if (port->vdisk_size == -1) -+ return -ENODEV; -+ } else { -+ struct vio_disk_geom geom; -+ -+ err = generic_request(port, VD_OP_GET_DISKGEOM, -+ &geom, sizeof(geom)); -+ if (err < 0) { -+ printk(KERN_ERR PFX "VD_OP_GET_DISKGEOM returns " -+ "error %d\n", err); -+ return err; -+ } -+ port->vdisk_size = ((u64)geom.num_cyl * -+ (u64)geom.num_hd * -+ (u64)geom.num_sec); - } - -- port->vdisk_size = ((u64)port->geom.num_cyl * -- (u64)port->geom.num_hd * -- (u64)port->geom.num_sec); -- - q = blk_init_queue(do_vdc_request, &port->vio.lock); - if (!q) { - printk(KERN_ERR PFX "%s: Could not allocate queue.\n", -@@ -691,6 +745,10 @@ static int probe_disk(struct vdc_port *port) - - port->disk = g; - -+ /* Each segment in a request is up to an aligned page in size. */ -+ blk_queue_segment_boundary(q, PAGE_SIZE - 1); -+ blk_queue_max_segment_size(q, PAGE_SIZE); -+ - blk_queue_max_segments(q, port->ring_cookies); - blk_queue_max_hw_sectors(q, port->max_xfer_size); - g->major = vdc_major; -@@ -704,9 +762,32 @@ static int probe_disk(struct vdc_port *port) - - set_capacity(g, port->vdisk_size); - -- printk(KERN_INFO PFX "%s: %u sectors (%u MB)\n", -+ if (vdc_version_supported(port, 1, 1)) { -+ switch (port->vdisk_mtype) { -+ case VD_MEDIA_TYPE_CD: -+ pr_info(PFX "Virtual CDROM %s\n", port->disk_name); -+ g->flags |= GENHD_FL_CD; -+ g->flags |= GENHD_FL_REMOVABLE; -+ set_disk_ro(g, 1); -+ break; -+ -+ case VD_MEDIA_TYPE_DVD: -+ pr_info(PFX "Virtual DVD %s\n", port->disk_name); -+ g->flags |= GENHD_FL_CD; -+ g->flags |= GENHD_FL_REMOVABLE; -+ set_disk_ro(g, 1); -+ break; -+ -+ case VD_MEDIA_TYPE_FIXED: -+ pr_info(PFX "Virtual Hard disk %s\n", port->disk_name); -+ break; -+ } -+ } -+ -+ pr_info(PFX "%s: %u sectors (%u MB) protocol %d.%d\n", - g->disk_name, -- port->vdisk_size, (port->vdisk_size >> (20 - 9))); -+ port->vdisk_size, (port->vdisk_size >> (20 - 9)), -+ port->vio.ver.major, port->vio.ver.minor); - - add_disk(g); - -@@ -765,6 +846,7 @@ static int vdc_port_probe(struct vio_dev *vdev, const struct vio_device_id *id) - else - snprintf(port->disk_name, sizeof(port->disk_name), - VDCBLK_NAME "%c", 'a' + ((int)vdev->dev_no % 26)); -+ port->vdisk_size = -1; - - err = vio_driver_init(&port->vio, vdev, VDEV_DISK, - vdc_versions, ARRAY_SIZE(vdc_versions), -diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c -index 51c557cfd92b..d8ddb8e2adc1 100644 ---- a/drivers/block/zram/zram_drv.c -+++ b/drivers/block/zram/zram_drv.c -@@ -447,7 +447,8 @@ static int zram_bvec_write(struct zram *zram, struct bio_vec *bvec, u32 index, - } - - if (page_zero_filled(uncmem)) { -- kunmap_atomic(user_mem); -+ if (user_mem) -+ kunmap_atomic(user_mem); - /* Free memory associated with this sector now. */ - write_lock(&zram->meta->tb_lock); - zram_free_page(zram, index); -diff --git a/drivers/char/hw_random/pseries-rng.c b/drivers/char/hw_random/pseries-rng.c -index ab7ffdec0ec3..f38f2c13e79c 100644 ---- a/drivers/char/hw_random/pseries-rng.c -+++ b/drivers/char/hw_random/pseries-rng.c -@@ -25,18 +25,21 @@ - #include <asm/vio.h> - - --static int pseries_rng_data_read(struct hwrng *rng, u32 *data) -+static int pseries_rng_read(struct hwrng *rng, void *data, size_t max, bool wait) - { -+ u64 buffer[PLPAR_HCALL_BUFSIZE]; -+ size_t size = max < 8 ? max : 8; - int rc; - -- rc = plpar_hcall(H_RANDOM, (unsigned long *)data); -+ rc = plpar_hcall(H_RANDOM, (unsigned long *)buffer); - if (rc != H_SUCCESS) { - pr_err_ratelimited("H_RANDOM call failed %d\n", rc); - return -EIO; - } -+ memcpy(data, buffer, size); - - /* The hypervisor interface returns 64 bits */ -- return 8; -+ return size; - } - - /** -@@ -55,7 +58,7 @@ static unsigned long pseries_rng_get_desired_dma(struct vio_dev *vdev) - - static struct hwrng pseries_rng = { - .name = KBUILD_MODNAME, -- .data_read = pseries_rng_data_read, -+ .read = pseries_rng_read, - }; - - static int __init pseries_rng_probe(struct vio_dev *dev, -diff --git a/drivers/crypto/caam/caamhash.c b/drivers/crypto/caam/caamhash.c -index a4127453baae..d97a03dbf42c 100644 ---- a/drivers/crypto/caam/caamhash.c -+++ b/drivers/crypto/caam/caamhash.c -@@ -835,8 +835,9 @@ static int ahash_update_ctx(struct ahash_request *req) - edesc->sec4_sg + sec4_sg_src_index, - chained); - if (*next_buflen) { -- sg_copy_part(next_buf, req->src, to_hash - -- *buflen, req->nbytes); -+ scatterwalk_map_and_copy(next_buf, req->src, -+ to_hash - *buflen, -+ *next_buflen, 0); - state->current_buf = !state->current_buf; - } - } else { -@@ -869,7 +870,8 @@ static int ahash_update_ctx(struct ahash_request *req) - kfree(edesc); - } - } else if (*next_buflen) { -- sg_copy(buf + *buflen, req->src, req->nbytes); -+ scatterwalk_map_and_copy(buf + *buflen, req->src, 0, -+ req->nbytes, 0); - *buflen = *next_buflen; - *next_buflen = last_buflen; - } -@@ -1216,8 +1218,9 @@ static int ahash_update_no_ctx(struct ahash_request *req) - src_map_to_sec4_sg(jrdev, req->src, src_nents, - edesc->sec4_sg + 1, chained); - if (*next_buflen) { -- sg_copy_part(next_buf, req->src, to_hash - *buflen, -- req->nbytes); -+ scatterwalk_map_and_copy(next_buf, req->src, -+ to_hash - *buflen, -+ *next_buflen, 0); - state->current_buf = !state->current_buf; - } - -@@ -1248,7 +1251,8 @@ static int ahash_update_no_ctx(struct ahash_request *req) - kfree(edesc); - } - } else if (*next_buflen) { -- sg_copy(buf + *buflen, req->src, req->nbytes); -+ scatterwalk_map_and_copy(buf + *buflen, req->src, 0, -+ req->nbytes, 0); - *buflen = *next_buflen; - *next_buflen = 0; - } -@@ -1405,7 +1409,8 @@ static int ahash_update_first(struct ahash_request *req) - } - - if (*next_buflen) -- sg_copy_part(next_buf, req->src, to_hash, req->nbytes); -+ scatterwalk_map_and_copy(next_buf, req->src, to_hash, -+ *next_buflen, 0); - - sh_len = desc_len(sh_desc); - desc = edesc->hw_desc; -@@ -1438,7 +1443,8 @@ static int ahash_update_first(struct ahash_request *req) - state->update = ahash_update_no_ctx; - state->finup = ahash_finup_no_ctx; - state->final = ahash_final_no_ctx; -- sg_copy(next_buf, req->src, req->nbytes); -+ scatterwalk_map_and_copy(next_buf, req->src, 0, -+ req->nbytes, 0); - } - #ifdef DEBUG - print_hex_dump(KERN_ERR, "next buf@"__stringify(__LINE__)": ", -diff --git a/drivers/crypto/caam/key_gen.c b/drivers/crypto/caam/key_gen.c -index ea2e406610eb..b872eed2957b 100644 ---- a/drivers/crypto/caam/key_gen.c -+++ b/drivers/crypto/caam/key_gen.c -@@ -51,23 +51,29 @@ int gen_split_key(struct device *jrdev, u8 *key_out, int split_key_len, - u32 *desc; - struct split_key_result result; - dma_addr_t dma_addr_in, dma_addr_out; -- int ret = 0; -+ int ret = -ENOMEM; - - desc = kmalloc(CAAM_CMD_SZ * 6 + CAAM_PTR_SZ * 2, GFP_KERNEL | GFP_DMA); - if (!desc) { - dev_err(jrdev, "unable to allocate key input memory\n"); -- return -ENOMEM; -+ return ret; - } - -- init_job_desc(desc, 0); -- - dma_addr_in = dma_map_single(jrdev, (void *)key_in, keylen, - DMA_TO_DEVICE); - if (dma_mapping_error(jrdev, dma_addr_in)) { - dev_err(jrdev, "unable to map key input memory\n"); -- kfree(desc); -- return -ENOMEM; -+ goto out_free; - } -+ -+ dma_addr_out = dma_map_single(jrdev, key_out, split_key_pad_len, -+ DMA_FROM_DEVICE); -+ if (dma_mapping_error(jrdev, dma_addr_out)) { -+ dev_err(jrdev, "unable to map key output memory\n"); -+ goto out_unmap_in; -+ } -+ -+ init_job_desc(desc, 0); - append_key(desc, dma_addr_in, keylen, CLASS_2 | KEY_DEST_CLASS_REG); - - /* Sets MDHA up into an HMAC-INIT */ -@@ -84,13 +90,6 @@ int gen_split_key(struct device *jrdev, u8 *key_out, int split_key_len, - * FIFO_STORE with the explicit split-key content store - * (0x26 output type) - */ -- dma_addr_out = dma_map_single(jrdev, key_out, split_key_pad_len, -- DMA_FROM_DEVICE); -- if (dma_mapping_error(jrdev, dma_addr_out)) { -- dev_err(jrdev, "unable to map key output memory\n"); -- kfree(desc); -- return -ENOMEM; -- } - append_fifo_store(desc, dma_addr_out, split_key_len, - LDST_CLASS_2_CCB | FIFOST_TYPE_SPLIT_KEK); - -@@ -118,10 +117,10 @@ int gen_split_key(struct device *jrdev, u8 *key_out, int split_key_len, - - dma_unmap_single(jrdev, dma_addr_out, split_key_pad_len, - DMA_FROM_DEVICE); -+out_unmap_in: - dma_unmap_single(jrdev, dma_addr_in, keylen, DMA_TO_DEVICE); -- -+out_free: - kfree(desc); -- - return ret; - } - EXPORT_SYMBOL(gen_split_key); -diff --git a/drivers/crypto/caam/sg_sw_sec4.h b/drivers/crypto/caam/sg_sw_sec4.h -index b12ff85f4241..ce28a563effc 100644 ---- a/drivers/crypto/caam/sg_sw_sec4.h -+++ b/drivers/crypto/caam/sg_sw_sec4.h -@@ -116,57 +116,3 @@ static int dma_unmap_sg_chained(struct device *dev, struct scatterlist *sg, - } - return nents; - } -- --/* Map SG page in kernel virtual address space and copy */ --static inline void sg_map_copy(u8 *dest, struct scatterlist *sg, -- int len, int offset) --{ -- u8 *mapped_addr; -- -- /* -- * Page here can be user-space pinned using get_user_pages -- * Same must be kmapped before use and kunmapped subsequently -- */ -- mapped_addr = kmap_atomic(sg_page(sg)); -- memcpy(dest, mapped_addr + offset, len); -- kunmap_atomic(mapped_addr); --} -- --/* Copy from len bytes of sg to dest, starting from beginning */ --static inline void sg_copy(u8 *dest, struct scatterlist *sg, unsigned int len) --{ -- struct scatterlist *current_sg = sg; -- int cpy_index = 0, next_cpy_index = current_sg->length; -- -- while (next_cpy_index < len) { -- sg_map_copy(dest + cpy_index, current_sg, current_sg->length, -- current_sg->offset); -- current_sg = scatterwalk_sg_next(current_sg); -- cpy_index = next_cpy_index; -- next_cpy_index += current_sg->length; -- } -- if (cpy_index < len) -- sg_map_copy(dest + cpy_index, current_sg, len-cpy_index, -- current_sg->offset); --} -- --/* Copy sg data, from to_skip to end, to dest */ --static inline void sg_copy_part(u8 *dest, struct scatterlist *sg, -- int to_skip, unsigned int end) --{ -- struct scatterlist *current_sg = sg; -- int sg_index, cpy_index, offset; -- -- sg_index = current_sg->length; -- while (sg_index <= to_skip) { -- current_sg = scatterwalk_sg_next(current_sg); -- sg_index += current_sg->length; -- } -- cpy_index = sg_index - to_skip; -- offset = current_sg->offset + current_sg->length - cpy_index; -- sg_map_copy(dest, current_sg, cpy_index, offset); -- if (end - sg_index) { -- current_sg = scatterwalk_sg_next(current_sg); -- sg_copy(dest + cpy_index, current_sg, end - sg_index); -- } --} -diff --git a/drivers/firewire/core-cdev.c b/drivers/firewire/core-cdev.c -index d7d5c8af92b9..6d4456898007 100644 ---- a/drivers/firewire/core-cdev.c -+++ b/drivers/firewire/core-cdev.c -@@ -1637,8 +1637,7 @@ static int dispatch_ioctl(struct client *client, - _IOC_SIZE(cmd) > sizeof(buffer)) - return -ENOTTY; - -- if (_IOC_DIR(cmd) == _IOC_READ) -- memset(&buffer, 0, _IOC_SIZE(cmd)); -+ memset(&buffer, 0, sizeof(buffer)); - - if (_IOC_DIR(cmd) & _IOC_WRITE) - if (copy_from_user(&buffer, arg, _IOC_SIZE(cmd))) -diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c -index ab5c26575622..ddf70d6c0270 100644 ---- a/drivers/gpu/drm/radeon/cik.c -+++ b/drivers/gpu/drm/radeon/cik.c -@@ -3936,8 +3936,8 @@ static int cik_cp_gfx_start(struct radeon_device *rdev) - /* init the CE partitions. CE only used for gfx on CIK */ - radeon_ring_write(ring, PACKET3(PACKET3_SET_BASE, 2)); - radeon_ring_write(ring, PACKET3_BASE_INDEX(CE_PARTITION_BASE)); -- radeon_ring_write(ring, 0xc000); -- radeon_ring_write(ring, 0xc000); -+ radeon_ring_write(ring, 0x8000); -+ radeon_ring_write(ring, 0x8000); - - /* setup clear context state */ - radeon_ring_write(ring, PACKET3(PACKET3_PREAMBLE_CNTL, 0)); -@@ -8893,6 +8893,9 @@ void dce8_bandwidth_update(struct radeon_device *rdev) - u32 num_heads = 0, lb_size; - int i; - -+ if (!rdev->mode_info.mode_config_initialized) -+ return; -+ - radeon_update_display_priority(rdev); - - for (i = 0; i < rdev->num_crtc; i++) { -diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c -index 4b3c5f7ae63b..7138f3e31b7c 100644 ---- a/drivers/gpu/drm/radeon/evergreen.c -+++ b/drivers/gpu/drm/radeon/evergreen.c -@@ -2362,6 +2362,9 @@ void evergreen_bandwidth_update(struct radeon_device *rdev) - u32 num_heads = 0, lb_size; - int i; - -+ if (!rdev->mode_info.mode_config_initialized) -+ return; -+ - radeon_update_display_priority(rdev); - - for (i = 0; i < rdev->num_crtc; i++) { -@@ -2570,6 +2573,7 @@ void evergreen_mc_stop(struct radeon_device *rdev, struct evergreen_mc_save *sav - WREG32(EVERGREEN_CRTC_UPDATE_LOCK + crtc_offsets[i], 1); - tmp |= EVERGREEN_CRTC_BLANK_DATA_EN; - WREG32(EVERGREEN_CRTC_BLANK_CONTROL + crtc_offsets[i], tmp); -+ WREG32(EVERGREEN_CRTC_UPDATE_LOCK + crtc_offsets[i], 0); - } - } else { - tmp = RREG32(EVERGREEN_CRTC_CONTROL + crtc_offsets[i]); -diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c -index 3cc78bb66042..07620e198a6d 100644 ---- a/drivers/gpu/drm/radeon/r100.c -+++ b/drivers/gpu/drm/radeon/r100.c -@@ -3219,6 +3219,9 @@ void r100_bandwidth_update(struct radeon_device *rdev) - uint32_t pixel_bytes1 = 0; - uint32_t pixel_bytes2 = 0; - -+ if (!rdev->mode_info.mode_config_initialized) -+ return; -+ - radeon_update_display_priority(rdev); - - if (rdev->mode_info.crtcs[0]->base.enabled) { -diff --git a/drivers/gpu/drm/radeon/rs600.c b/drivers/gpu/drm/radeon/rs600.c -index 95b693c11640..e5619d5e2a30 100644 ---- a/drivers/gpu/drm/radeon/rs600.c -+++ b/drivers/gpu/drm/radeon/rs600.c -@@ -890,6 +890,9 @@ void rs600_bandwidth_update(struct radeon_device *rdev) - u32 d1mode_priority_a_cnt, d2mode_priority_a_cnt; - /* FIXME: implement full support */ - -+ if (!rdev->mode_info.mode_config_initialized) -+ return; -+ - radeon_update_display_priority(rdev); - - if (rdev->mode_info.crtcs[0]->base.enabled) -diff --git a/drivers/gpu/drm/radeon/rs690.c b/drivers/gpu/drm/radeon/rs690.c -index 3462b64369bf..0a2d36e81108 100644 ---- a/drivers/gpu/drm/radeon/rs690.c -+++ b/drivers/gpu/drm/radeon/rs690.c -@@ -579,6 +579,9 @@ void rs690_bandwidth_update(struct radeon_device *rdev) - u32 d1mode_priority_a_cnt, d1mode_priority_b_cnt; - u32 d2mode_priority_a_cnt, d2mode_priority_b_cnt; - -+ if (!rdev->mode_info.mode_config_initialized) -+ return; -+ - radeon_update_display_priority(rdev); - - if (rdev->mode_info.crtcs[0]->base.enabled) -diff --git a/drivers/gpu/drm/radeon/rv515.c b/drivers/gpu/drm/radeon/rv515.c -index 237dd29d9f1c..b49965a21a2d 100644 ---- a/drivers/gpu/drm/radeon/rv515.c -+++ b/drivers/gpu/drm/radeon/rv515.c -@@ -1276,6 +1276,9 @@ void rv515_bandwidth_update(struct radeon_device *rdev) - struct drm_display_mode *mode0 = NULL; - struct drm_display_mode *mode1 = NULL; - -+ if (!rdev->mode_info.mode_config_initialized) -+ return; -+ - radeon_update_display_priority(rdev); - - if (rdev->mode_info.crtcs[0]->base.enabled) -diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c -index 559564c1dc97..52b64ad285d6 100644 ---- a/drivers/gpu/drm/radeon/si.c -+++ b/drivers/gpu/drm/radeon/si.c -@@ -2227,6 +2227,9 @@ void dce6_bandwidth_update(struct radeon_device *rdev) - u32 num_heads = 0, lb_size; - int i; - -+ if (!rdev->mode_info.mode_config_initialized) -+ return; -+ - radeon_update_display_priority(rdev); - - for (i = 0; i < rdev->num_crtc; i++) { -diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c -index ea6203ee7bcc..23467a2abd62 100644 ---- a/drivers/infiniband/core/uverbs_cmd.c -+++ b/drivers/infiniband/core/uverbs_cmd.c -@@ -2425,6 +2425,8 @@ ssize_t ib_uverbs_create_ah(struct ib_uverbs_file *file, - attr.grh.sgid_index = cmd.attr.grh.sgid_index; - attr.grh.hop_limit = cmd.attr.grh.hop_limit; - attr.grh.traffic_class = cmd.attr.grh.traffic_class; -+ attr.vlan_id = 0; -+ memset(&attr.dmac, 0, sizeof(attr.dmac)); - memcpy(attr.grh.dgid.raw, cmd.attr.grh.dgid, 16); - - ah = ib_create_ah(pd, &attr); -diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c -index fb15c64ffb95..4979b00fbf04 100644 ---- a/drivers/input/mouse/alps.c -+++ b/drivers/input/mouse/alps.c -@@ -1047,7 +1047,13 @@ static psmouse_ret_t alps_process_byte(struct psmouse *psmouse) - { - struct alps_data *priv = psmouse->private; - -- if ((psmouse->packet[0] & 0xc8) == 0x08) { /* PS/2 packet */ -+ /* -+ * Check if we are dealing with a bare PS/2 packet, presumably from -+ * a device connected to the external PS/2 port. Because bare PS/2 -+ * protocol does not have enough constant bits to self-synchronize -+ * properly we only do this if the device is fully synchronized. -+ */ -+ if (!psmouse->out_of_sync_cnt && (psmouse->packet[0] & 0xc8) == 0x08) { - if (psmouse->pktcnt == 3) { - alps_report_bare_ps2_packet(psmouse, psmouse->packet, - true); -@@ -1071,12 +1077,27 @@ static psmouse_ret_t alps_process_byte(struct psmouse *psmouse) - } - - /* Bytes 2 - pktsize should have 0 in the highest bit */ -- if ((priv->proto_version < ALPS_PROTO_V5) && -+ if (priv->proto_version < ALPS_PROTO_V5 && - psmouse->pktcnt >= 2 && psmouse->pktcnt <= psmouse->pktsize && - (psmouse->packet[psmouse->pktcnt - 1] & 0x80)) { - psmouse_dbg(psmouse, "refusing packet[%i] = %x\n", - psmouse->pktcnt - 1, - psmouse->packet[psmouse->pktcnt - 1]); -+ -+ if (priv->proto_version == ALPS_PROTO_V3 && -+ psmouse->pktcnt == psmouse->pktsize) { -+ /* -+ * Some Dell boxes, such as Latitude E6440 or E7440 -+ * with closed lid, quite often smash last byte of -+ * otherwise valid packet with 0xff. Given that the -+ * next packet is very likely to be valid let's -+ * report PSMOUSE_FULL_PACKET but not process data, -+ * rather than reporting PSMOUSE_BAD_DATA and -+ * filling the logs. -+ */ -+ return PSMOUSE_FULL_PACKET; -+ } -+ - return PSMOUSE_BAD_DATA; - } - -@@ -2148,6 +2169,9 @@ int alps_init(struct psmouse *psmouse) - /* We are having trouble resyncing ALPS touchpads so disable it for now */ - psmouse->resync_time = 0; - -+ /* Allow 2 invalid packets without resetting device */ -+ psmouse->resetafter = psmouse->pktsize * 2; -+ - return 0; - - init_fail: -diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c -index a50a2a7a43f7..1e76eb8f06c7 100644 ---- a/drivers/input/mouse/synaptics.c -+++ b/drivers/input/mouse/synaptics.c -@@ -132,8 +132,8 @@ static const struct min_max_quirk min_max_pnpid_table[] = { - 1232, 5710, 1156, 4696 - }, - { -- (const char * const []){"LEN0034", "LEN0036", "LEN2002", -- "LEN2004", NULL}, -+ (const char * const []){"LEN0034", "LEN0036", "LEN0039", -+ "LEN2002", "LEN2004", NULL}, - 1024, 5112, 2024, 4832 - }, - { -@@ -160,6 +160,7 @@ static const char * const topbuttonpad_pnp_ids[] = { - "LEN0036", /* T440 */ - "LEN0037", - "LEN0038", -+ "LEN0039", /* T440s */ - "LEN0041", - "LEN0042", /* Yoga */ - "LEN0045", -diff --git a/drivers/md/dm-bufio.c b/drivers/md/dm-bufio.c -index ca1621b49453..a1cebf745b22 100644 ---- a/drivers/md/dm-bufio.c -+++ b/drivers/md/dm-bufio.c -@@ -1448,9 +1448,9 @@ static void drop_buffers(struct dm_bufio_client *c) - - /* - * Test if the buffer is unused and too old, and commit it. -- * At if noio is set, we must not do any I/O because we hold -- * dm_bufio_clients_lock and we would risk deadlock if the I/O gets rerouted to -- * different bufio client. -+ * And if GFP_NOFS is used, we must not do any I/O because we hold -+ * dm_bufio_clients_lock and we would risk deadlock if the I/O gets -+ * rerouted to different bufio client. - */ - static int __cleanup_old_buffer(struct dm_buffer *b, gfp_t gfp, - unsigned long max_jiffies) -@@ -1458,7 +1458,7 @@ static int __cleanup_old_buffer(struct dm_buffer *b, gfp_t gfp, - if (jiffies - b->last_accessed < max_jiffies) - return 0; - -- if (!(gfp & __GFP_IO)) { -+ if (!(gfp & __GFP_FS)) { - if (test_bit(B_READING, &b->state) || - test_bit(B_WRITING, &b->state) || - test_bit(B_DIRTY, &b->state)) -@@ -1500,7 +1500,7 @@ dm_bufio_shrink_scan(struct shrinker *shrink, struct shrink_control *sc) - unsigned long freed; - - c = container_of(shrink, struct dm_bufio_client, shrinker); -- if (sc->gfp_mask & __GFP_IO) -+ if (sc->gfp_mask & __GFP_FS) - dm_bufio_lock(c); - else if (!dm_bufio_trylock(c)) - return SHRINK_STOP; -@@ -1517,7 +1517,7 @@ dm_bufio_shrink_count(struct shrinker *shrink, struct shrink_control *sc) - unsigned long count; - - c = container_of(shrink, struct dm_bufio_client, shrinker); -- if (sc->gfp_mask & __GFP_IO) -+ if (sc->gfp_mask & __GFP_FS) - dm_bufio_lock(c); - else if (!dm_bufio_trylock(c)) - return 0; -diff --git a/drivers/md/dm-raid.c b/drivers/md/dm-raid.c -index 4880b69e2e9e..59715389b3cf 100644 ---- a/drivers/md/dm-raid.c -+++ b/drivers/md/dm-raid.c -@@ -785,8 +785,7 @@ struct dm_raid_superblock { - __le32 layout; - __le32 stripe_sectors; - -- __u8 pad[452]; /* Round struct to 512 bytes. */ -- /* Always set to 0 when writing. */ -+ /* Remainder of a logical block is zero-filled when writing (see super_sync()). */ - } __packed; - - static int read_disk_sb(struct md_rdev *rdev, int size) -@@ -823,7 +822,7 @@ static void super_sync(struct mddev *mddev, struct md_rdev *rdev) - test_bit(Faulty, &(rs->dev[i].rdev.flags))) - failed_devices |= (1ULL << i); - -- memset(sb, 0, sizeof(*sb)); -+ memset(sb + 1, 0, rdev->sb_size - sizeof(*sb)); - - sb->magic = cpu_to_le32(DM_RAID_MAGIC); - sb->features = cpu_to_le32(0); /* No features yet */ -@@ -858,7 +857,11 @@ static int super_load(struct md_rdev *rdev, struct md_rdev *refdev) - uint64_t events_sb, events_refsb; - - rdev->sb_start = 0; -- rdev->sb_size = sizeof(*sb); -+ rdev->sb_size = bdev_logical_block_size(rdev->meta_bdev); -+ if (rdev->sb_size < sizeof(*sb) || rdev->sb_size > PAGE_SIZE) { -+ DMERR("superblock size of a logical block is no longer valid"); -+ return -EINVAL; -+ } - - ret = read_disk_sb(rdev, rdev->sb_size); - if (ret) -diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c -index 359af3a519b5..37f2648c112b 100644 ---- a/drivers/md/dm-thin.c -+++ b/drivers/md/dm-thin.c -@@ -1704,6 +1704,14 @@ static int thin_bio_map(struct dm_target *ti, struct bio *bio) - return DM_MAPIO_SUBMITTED; - } - -+ /* -+ * We must hold the virtual cell before doing the lookup, otherwise -+ * there's a race with discard. -+ */ -+ build_virtual_key(tc->td, block, &key); -+ if (dm_bio_detain(tc->pool->prison, &key, bio, &cell1, &cell_result)) -+ return DM_MAPIO_SUBMITTED; -+ - r = dm_thin_find_block(td, block, 0, &result); - - /* -@@ -1727,13 +1735,10 @@ static int thin_bio_map(struct dm_target *ti, struct bio *bio) - * shared flag will be set in their case. - */ - thin_defer_bio(tc, bio); -+ cell_defer_no_holder_no_free(tc, &cell1); - return DM_MAPIO_SUBMITTED; - } - -- build_virtual_key(tc->td, block, &key); -- if (dm_bio_detain(tc->pool->prison, &key, bio, &cell1, &cell_result)) -- return DM_MAPIO_SUBMITTED; -- - build_data_key(tc->td, result.block, &key); - if (dm_bio_detain(tc->pool->prison, &key, bio, &cell2, &cell_result)) { - cell_defer_no_holder_no_free(tc, &cell1); -@@ -1754,6 +1759,7 @@ static int thin_bio_map(struct dm_target *ti, struct bio *bio) - * of doing so. - */ - handle_unserviceable_bio(tc->pool, bio); -+ cell_defer_no_holder_no_free(tc, &cell1); - return DM_MAPIO_SUBMITTED; - } - /* fall through */ -@@ -1764,6 +1770,7 @@ static int thin_bio_map(struct dm_target *ti, struct bio *bio) - * provide the hint to load the metadata into cache. - */ - thin_defer_bio(tc, bio); -+ cell_defer_no_holder_no_free(tc, &cell1); - return DM_MAPIO_SUBMITTED; - - default: -@@ -1773,6 +1780,7 @@ static int thin_bio_map(struct dm_target *ti, struct bio *bio) - * pool is switched to fail-io mode. - */ - bio_io_error(bio); -+ cell_defer_no_holder_no_free(tc, &cell1); - return DM_MAPIO_SUBMITTED; - } - } -diff --git a/drivers/md/md.c b/drivers/md/md.c -index 73aedcb639c0..40959ee73583 100644 ---- a/drivers/md/md.c -+++ b/drivers/md/md.c -@@ -5333,6 +5333,7 @@ static int md_set_readonly(struct mddev *mddev, struct block_device *bdev) - printk("md: %s still in use.\n",mdname(mddev)); - if (did_freeze) { - clear_bit(MD_RECOVERY_FROZEN, &mddev->recovery); -+ set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); - md_wakeup_thread(mddev->thread); - } - err = -EBUSY; -@@ -5347,6 +5348,8 @@ static int md_set_readonly(struct mddev *mddev, struct block_device *bdev) - mddev->ro = 1; - set_disk_ro(mddev->gendisk, 1); - clear_bit(MD_RECOVERY_FROZEN, &mddev->recovery); -+ set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); -+ md_wakeup_thread(mddev->thread); - sysfs_notify_dirent_safe(mddev->sysfs_state); - err = 0; - } -@@ -5390,6 +5393,7 @@ static int do_md_stop(struct mddev * mddev, int mode, - mutex_unlock(&mddev->open_mutex); - if (did_freeze) { - clear_bit(MD_RECOVERY_FROZEN, &mddev->recovery); -+ set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); - md_wakeup_thread(mddev->thread); - } - return -EBUSY; -diff --git a/drivers/md/persistent-data/dm-btree-internal.h b/drivers/md/persistent-data/dm-btree-internal.h -index 37d367bb9aa8..bf2b80d5c470 100644 ---- a/drivers/md/persistent-data/dm-btree-internal.h -+++ b/drivers/md/persistent-data/dm-btree-internal.h -@@ -42,6 +42,12 @@ struct btree_node { - } __packed; - - -+/* -+ * Locks a block using the btree node validator. -+ */ -+int bn_read_lock(struct dm_btree_info *info, dm_block_t b, -+ struct dm_block **result); -+ - void inc_children(struct dm_transaction_manager *tm, struct btree_node *n, - struct dm_btree_value_type *vt); - -diff --git a/drivers/md/persistent-data/dm-btree-spine.c b/drivers/md/persistent-data/dm-btree-spine.c -index cf9fd676ae44..1b5e13ec7f96 100644 ---- a/drivers/md/persistent-data/dm-btree-spine.c -+++ b/drivers/md/persistent-data/dm-btree-spine.c -@@ -92,7 +92,7 @@ struct dm_block_validator btree_node_validator = { - - /*----------------------------------------------------------------*/ - --static int bn_read_lock(struct dm_btree_info *info, dm_block_t b, -+int bn_read_lock(struct dm_btree_info *info, dm_block_t b, - struct dm_block **result) - { - return dm_tm_read_lock(info->tm, b, &btree_node_validator, result); -diff --git a/drivers/md/persistent-data/dm-btree.c b/drivers/md/persistent-data/dm-btree.c -index 416060c25709..200ac12a1d40 100644 ---- a/drivers/md/persistent-data/dm-btree.c -+++ b/drivers/md/persistent-data/dm-btree.c -@@ -847,22 +847,26 @@ EXPORT_SYMBOL_GPL(dm_btree_find_lowest_key); - * FIXME: We shouldn't use a recursive algorithm when we have limited stack - * space. Also this only works for single level trees. - */ --static int walk_node(struct ro_spine *s, dm_block_t block, -+static int walk_node(struct dm_btree_info *info, dm_block_t block, - int (*fn)(void *context, uint64_t *keys, void *leaf), - void *context) - { - int r; - unsigned i, nr; -+ struct dm_block *node; - struct btree_node *n; - uint64_t keys; - -- r = ro_step(s, block); -- n = ro_node(s); -+ r = bn_read_lock(info, block, &node); -+ if (r) -+ return r; -+ -+ n = dm_block_data(node); - - nr = le32_to_cpu(n->header.nr_entries); - for (i = 0; i < nr; i++) { - if (le32_to_cpu(n->header.flags) & INTERNAL_NODE) { -- r = walk_node(s, value64(n, i), fn, context); -+ r = walk_node(info, value64(n, i), fn, context); - if (r) - goto out; - } else { -@@ -874,7 +878,7 @@ static int walk_node(struct ro_spine *s, dm_block_t block, - } - - out: -- ro_pop(s); -+ dm_tm_unlock(info->tm, node); - return r; - } - -@@ -882,15 +886,7 @@ int dm_btree_walk(struct dm_btree_info *info, dm_block_t root, - int (*fn)(void *context, uint64_t *keys, void *leaf), - void *context) - { -- int r; -- struct ro_spine spine; -- - BUG_ON(info->levels > 1); -- -- init_ro_spine(&spine, info); -- r = walk_node(&spine, root, fn, context); -- exit_ro_spine(&spine); -- -- return r; -+ return walk_node(info, root, fn, context); - } - EXPORT_SYMBOL_GPL(dm_btree_walk); -diff --git a/drivers/media/usb/ttusb-dec/ttusbdecfe.c b/drivers/media/usb/ttusb-dec/ttusbdecfe.c -index 5c45c9d0712d..9c29552aedec 100644 ---- a/drivers/media/usb/ttusb-dec/ttusbdecfe.c -+++ b/drivers/media/usb/ttusb-dec/ttusbdecfe.c -@@ -156,6 +156,9 @@ static int ttusbdecfe_dvbs_diseqc_send_master_cmd(struct dvb_frontend* fe, struc - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00 }; - -+ if (cmd->msg_len > sizeof(b) - 4) -+ return -EINVAL; -+ - memcpy(&b[4], cmd->msg, cmd->msg_len); - - state->config->send_command(fe, 0x72, -diff --git a/drivers/net/ethernet/smsc/smsc911x.c b/drivers/net/ethernet/smsc/smsc911x.c -index 6382b7c416f4..e10f5ed26181 100644 ---- a/drivers/net/ethernet/smsc/smsc911x.c -+++ b/drivers/net/ethernet/smsc/smsc911x.c -@@ -1341,6 +1341,42 @@ static void smsc911x_rx_multicast_update_workaround(struct smsc911x_data *pdata) - spin_unlock(&pdata->mac_lock); - } - -+static int smsc911x_phy_general_power_up(struct smsc911x_data *pdata) -+{ -+ int rc = 0; -+ -+ if (!pdata->phy_dev) -+ return rc; -+ -+ /* If the internal PHY is in General Power-Down mode, all, except the -+ * management interface, is powered-down and stays in that condition as -+ * long as Phy register bit 0.11 is HIGH. -+ * -+ * In that case, clear the bit 0.11, so the PHY powers up and we can -+ * access to the phy registers. -+ */ -+ rc = phy_read(pdata->phy_dev, MII_BMCR); -+ if (rc < 0) { -+ SMSC_WARN(pdata, drv, "Failed reading PHY control reg"); -+ return rc; -+ } -+ -+ /* If the PHY general power-down bit is not set is not necessary to -+ * disable the general power down-mode. -+ */ -+ if (rc & BMCR_PDOWN) { -+ rc = phy_write(pdata->phy_dev, MII_BMCR, rc & ~BMCR_PDOWN); -+ if (rc < 0) { -+ SMSC_WARN(pdata, drv, "Failed writing PHY control reg"); -+ return rc; -+ } -+ -+ usleep_range(1000, 1500); -+ } -+ -+ return 0; -+} -+ - static int smsc911x_phy_disable_energy_detect(struct smsc911x_data *pdata) - { - int rc = 0; -@@ -1414,6 +1450,16 @@ static int smsc911x_soft_reset(struct smsc911x_data *pdata) - int ret; - - /* -+ * Make sure to power-up the PHY chip before doing a reset, otherwise -+ * the reset fails. -+ */ -+ ret = smsc911x_phy_general_power_up(pdata); -+ if (ret) { -+ SMSC_WARN(pdata, drv, "Failed to power-up the PHY chip"); -+ return ret; -+ } -+ -+ /* - * LAN9210/LAN9211/LAN9220/LAN9221 chips have an internal PHY that - * are initialized in a Energy Detect Power-Down mode that prevents - * the MAC chip to be software reseted. So we have to wakeup the PHY -diff --git a/drivers/net/ethernet/sun/sunvnet.c b/drivers/net/ethernet/sun/sunvnet.c -index fd411d6e19a2..03ae9def0e0c 100644 ---- a/drivers/net/ethernet/sun/sunvnet.c -+++ b/drivers/net/ethernet/sun/sunvnet.c -@@ -656,7 +656,7 @@ static int vnet_start_xmit(struct sk_buff *skb, struct net_device *dev) - spin_lock_irqsave(&port->vio.lock, flags); - - dr = &port->vio.drings[VIO_DRIVER_TX_RING]; -- if (unlikely(vnet_tx_dring_avail(dr) < 2)) { -+ if (unlikely(vnet_tx_dring_avail(dr) < 1)) { - if (!netif_queue_stopped(dev)) { - netif_stop_queue(dev); - -@@ -704,7 +704,7 @@ static int vnet_start_xmit(struct sk_buff *skb, struct net_device *dev) - dev->stats.tx_bytes += skb->len; - - dr->prod = (dr->prod + 1) & (VNET_TX_RING_SIZE - 1); -- if (unlikely(vnet_tx_dring_avail(dr) < 2)) { -+ if (unlikely(vnet_tx_dring_avail(dr) < 1)) { - netif_stop_queue(dev); - if (vnet_tx_dring_avail(dr) > VNET_TX_WAKEUP_THRESH(dr)) - netif_wake_queue(dev); -diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c -index f30ceb17d5fc..07c942b6ae01 100644 ---- a/drivers/net/macvtap.c -+++ b/drivers/net/macvtap.c -@@ -66,7 +66,7 @@ static struct cdev macvtap_cdev; - static const struct proto_ops macvtap_socket_ops; - - #define TUN_OFFLOADS (NETIF_F_HW_CSUM | NETIF_F_TSO_ECN | NETIF_F_TSO | \ -- NETIF_F_TSO6) -+ NETIF_F_TSO6 | NETIF_F_UFO) - #define RX_OFFLOADS (NETIF_F_GRO | NETIF_F_LRO) - #define TAP_FEATURES (NETIF_F_GSO | NETIF_F_SG) - -@@ -570,8 +570,6 @@ static int macvtap_skb_from_vnet_hdr(struct sk_buff *skb, - gso_type = SKB_GSO_TCPV6; - break; - case VIRTIO_NET_HDR_GSO_UDP: -- pr_warn_once("macvtap: %s: using disabled UFO feature; please fix this program\n", -- current->comm); - gso_type = SKB_GSO_UDP; - if (skb->protocol == htons(ETH_P_IPV6)) - ipv6_proxy_select_ident(skb); -@@ -619,6 +617,8 @@ static void macvtap_skb_to_vnet_hdr(const struct sk_buff *skb, - vnet_hdr->gso_type = VIRTIO_NET_HDR_GSO_TCPV4; - else if (sinfo->gso_type & SKB_GSO_TCPV6) - vnet_hdr->gso_type = VIRTIO_NET_HDR_GSO_TCPV6; -+ else if (sinfo->gso_type & SKB_GSO_UDP) -+ vnet_hdr->gso_type = VIRTIO_NET_HDR_GSO_UDP; - else - BUG(); - if (sinfo->gso_type & SKB_GSO_TCP_ECN) -@@ -629,6 +629,8 @@ static void macvtap_skb_to_vnet_hdr(const struct sk_buff *skb, - if (skb->ip_summed == CHECKSUM_PARTIAL) { - vnet_hdr->flags = VIRTIO_NET_HDR_F_NEEDS_CSUM; - vnet_hdr->csum_start = skb_checksum_start_offset(skb); -+ if (vlan_tx_tag_present(skb)) -+ vnet_hdr->csum_start += VLAN_HLEN; - vnet_hdr->csum_offset = skb->csum_offset; - } else if (skb->ip_summed == CHECKSUM_UNNECESSARY) { - vnet_hdr->flags = VIRTIO_NET_HDR_F_DATA_VALID; -@@ -953,6 +955,9 @@ static int set_offload(struct macvtap_queue *q, unsigned long arg) - if (arg & TUN_F_TSO6) - feature_mask |= NETIF_F_TSO6; - } -+ -+ if (arg & TUN_F_UFO) -+ feature_mask |= NETIF_F_UFO; - } - - /* tun/tap driver inverts the usage for TSO offloads, where -@@ -963,7 +968,7 @@ static int set_offload(struct macvtap_queue *q, unsigned long arg) - * When user space turns off TSO, we turn off GSO/LRO so that - * user-space will not receive TSO frames. - */ -- if (feature_mask & (NETIF_F_TSO | NETIF_F_TSO6)) -+ if (feature_mask & (NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_UFO)) - features |= RX_OFFLOADS; - else - features &= ~RX_OFFLOADS; -@@ -1064,7 +1069,7 @@ static long macvtap_ioctl(struct file *file, unsigned int cmd, - case TUNSETOFFLOAD: - /* let the user check for future flags */ - if (arg & ~(TUN_F_CSUM | TUN_F_TSO4 | TUN_F_TSO6 | -- TUN_F_TSO_ECN)) -+ TUN_F_TSO_ECN | TUN_F_UFO)) - return -EINVAL; - - rtnl_lock(); -diff --git a/drivers/net/tun.c b/drivers/net/tun.c -index 2c8b1c21c452..ec63314d6480 100644 ---- a/drivers/net/tun.c -+++ b/drivers/net/tun.c -@@ -175,7 +175,7 @@ struct tun_struct { - struct net_device *dev; - netdev_features_t set_features; - #define TUN_USER_FEATURES (NETIF_F_HW_CSUM|NETIF_F_TSO_ECN|NETIF_F_TSO| \ -- NETIF_F_TSO6) -+ NETIF_F_TSO6|NETIF_F_UFO) - - int vnet_hdr_sz; - int sndbuf; -@@ -1153,20 +1153,10 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile, - skb_shinfo(skb)->gso_type = SKB_GSO_TCPV6; - break; - case VIRTIO_NET_HDR_GSO_UDP: -- { -- static bool warned; -- -- if (!warned) { -- warned = true; -- netdev_warn(tun->dev, -- "%s: using disabled UFO feature; please fix this program\n", -- current->comm); -- } - skb_shinfo(skb)->gso_type = SKB_GSO_UDP; - if (skb->protocol == htons(ETH_P_IPV6)) - ipv6_proxy_select_ident(skb); - break; -- } - default: - tun->dev->stats.rx_frame_errors++; - kfree_skb(skb); -@@ -1236,6 +1226,10 @@ static ssize_t tun_put_user(struct tun_struct *tun, - struct tun_pi pi = { 0, skb->protocol }; - ssize_t total = 0; - int vlan_offset = 0, copied; -+ int vlan_hlen = 0; -+ -+ if (vlan_tx_tag_present(skb)) -+ vlan_hlen = VLAN_HLEN; - - if (!(tun->flags & TUN_NO_PI)) { - if ((len -= sizeof(pi)) < 0) -@@ -1266,6 +1260,8 @@ static ssize_t tun_put_user(struct tun_struct *tun, - gso.gso_type = VIRTIO_NET_HDR_GSO_TCPV4; - else if (sinfo->gso_type & SKB_GSO_TCPV6) - gso.gso_type = VIRTIO_NET_HDR_GSO_TCPV6; -+ else if (sinfo->gso_type & SKB_GSO_UDP) -+ gso.gso_type = VIRTIO_NET_HDR_GSO_UDP; - else { - pr_err("unexpected GSO type: " - "0x%x, gso_size %d, hdr_len %d\n", -@@ -1285,7 +1281,8 @@ static ssize_t tun_put_user(struct tun_struct *tun, - - if (skb->ip_summed == CHECKSUM_PARTIAL) { - gso.flags = VIRTIO_NET_HDR_F_NEEDS_CSUM; -- gso.csum_start = skb_checksum_start_offset(skb); -+ gso.csum_start = skb_checksum_start_offset(skb) + -+ vlan_hlen; - gso.csum_offset = skb->csum_offset; - } else if (skb->ip_summed == CHECKSUM_UNNECESSARY) { - gso.flags = VIRTIO_NET_HDR_F_DATA_VALID; -@@ -1298,10 +1295,9 @@ static ssize_t tun_put_user(struct tun_struct *tun, - } - - copied = total; -- total += skb->len; -- if (!vlan_tx_tag_present(skb)) { -- len = min_t(int, skb->len, len); -- } else { -+ len = min_t(int, skb->len + vlan_hlen, len); -+ total += skb->len + vlan_hlen; -+ if (vlan_hlen) { - int copy, ret; - struct { - __be16 h_vlan_proto; -@@ -1312,8 +1308,6 @@ static ssize_t tun_put_user(struct tun_struct *tun, - veth.h_vlan_TCI = htons(vlan_tx_tag_get(skb)); - - vlan_offset = offsetof(struct vlan_ethhdr, h_vlan_proto); -- len = min_t(int, skb->len + VLAN_HLEN, len); -- total += VLAN_HLEN; - - copy = min_t(int, vlan_offset, len); - ret = skb_copy_datagram_const_iovec(skb, 0, iv, copied, copy); -@@ -1795,6 +1789,11 @@ static int set_offload(struct tun_struct *tun, unsigned long arg) - features |= NETIF_F_TSO6; - arg &= ~(TUN_F_TSO4|TUN_F_TSO6); - } -+ -+ if (arg & TUN_F_UFO) { -+ features |= NETIF_F_UFO; -+ arg &= ~TUN_F_UFO; -+ } - } - - /* This gives the user a way to test for new features in future by -diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c -index 07a3255fd3cc..841b60831df1 100644 ---- a/drivers/net/virtio_net.c -+++ b/drivers/net/virtio_net.c -@@ -496,17 +496,8 @@ static void receive_buf(struct receive_queue *rq, void *buf, unsigned int len) - skb_shinfo(skb)->gso_type = SKB_GSO_TCPV4; - break; - case VIRTIO_NET_HDR_GSO_UDP: -- { -- static bool warned; -- -- if (!warned) { -- warned = true; -- netdev_warn(dev, -- "host using disabled UFO feature; please fix it\n"); -- } - skb_shinfo(skb)->gso_type = SKB_GSO_UDP; - break; -- } - case VIRTIO_NET_HDR_GSO_TCPV6: - skb_shinfo(skb)->gso_type = SKB_GSO_TCPV6; - break; -@@ -845,6 +836,8 @@ static int xmit_skb(struct send_queue *sq, struct sk_buff *skb) - hdr->hdr.gso_type = VIRTIO_NET_HDR_GSO_TCPV4; - else if (skb_shinfo(skb)->gso_type & SKB_GSO_TCPV6) - hdr->hdr.gso_type = VIRTIO_NET_HDR_GSO_TCPV6; -+ else if (skb_shinfo(skb)->gso_type & SKB_GSO_UDP) -+ hdr->hdr.gso_type = VIRTIO_NET_HDR_GSO_UDP; - else - BUG(); - if (skb_shinfo(skb)->gso_type & SKB_GSO_TCP_ECN) -@@ -1664,7 +1657,7 @@ static int virtnet_probe(struct virtio_device *vdev) - dev->features |= NETIF_F_HW_CSUM|NETIF_F_SG|NETIF_F_FRAGLIST; - - if (virtio_has_feature(vdev, VIRTIO_NET_F_GSO)) { -- dev->hw_features |= NETIF_F_TSO -+ dev->hw_features |= NETIF_F_TSO | NETIF_F_UFO - | NETIF_F_TSO_ECN | NETIF_F_TSO6; - } - /* Individual feature bits: what can host handle? */ -@@ -1674,9 +1667,11 @@ static int virtnet_probe(struct virtio_device *vdev) - dev->hw_features |= NETIF_F_TSO6; - if (virtio_has_feature(vdev, VIRTIO_NET_F_HOST_ECN)) - dev->hw_features |= NETIF_F_TSO_ECN; -+ if (virtio_has_feature(vdev, VIRTIO_NET_F_HOST_UFO)) -+ dev->hw_features |= NETIF_F_UFO; - - if (gso) -- dev->features |= dev->hw_features & NETIF_F_ALL_TSO; -+ dev->features |= dev->hw_features & (NETIF_F_ALL_TSO|NETIF_F_UFO); - /* (!csum && gso) case will be fixed by register_netdev() */ - } - if (virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_CSUM)) -@@ -1716,7 +1711,8 @@ static int virtnet_probe(struct virtio_device *vdev) - /* If we can receive ANY GSO packets, we must allocate large ones. */ - if (virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_TSO4) || - virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_TSO6) || -- virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_ECN)) -+ virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_ECN) || -+ virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_UFO)) - vi->big_packets = true; - - if (virtio_has_feature(vdev, VIRTIO_NET_F_MRG_RXBUF)) -@@ -1907,9 +1903,9 @@ static struct virtio_device_id id_table[] = { - static unsigned int features[] = { - VIRTIO_NET_F_CSUM, VIRTIO_NET_F_GUEST_CSUM, - VIRTIO_NET_F_GSO, VIRTIO_NET_F_MAC, -- VIRTIO_NET_F_HOST_TSO4, VIRTIO_NET_F_HOST_TSO6, -+ VIRTIO_NET_F_HOST_TSO4, VIRTIO_NET_F_HOST_UFO, VIRTIO_NET_F_HOST_TSO6, - VIRTIO_NET_F_HOST_ECN, VIRTIO_NET_F_GUEST_TSO4, VIRTIO_NET_F_GUEST_TSO6, -- VIRTIO_NET_F_GUEST_ECN, -+ VIRTIO_NET_F_GUEST_ECN, VIRTIO_NET_F_GUEST_UFO, - VIRTIO_NET_F_MRG_RXBUF, VIRTIO_NET_F_STATUS, VIRTIO_NET_F_CTRL_VQ, - VIRTIO_NET_F_CTRL_RX, VIRTIO_NET_F_CTRL_VLAN, - VIRTIO_NET_F_GUEST_ANNOUNCE, VIRTIO_NET_F_MQ, -diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c -index 0704a0402897..5441b49ef89d 100644 ---- a/drivers/net/vxlan.c -+++ b/drivers/net/vxlan.c -@@ -279,13 +279,15 @@ static inline struct vxlan_rdst *first_remote_rtnl(struct vxlan_fdb *fdb) - return list_first_entry(&fdb->remotes, struct vxlan_rdst, list); - } - --/* Find VXLAN socket based on network namespace and UDP port */ --static struct vxlan_sock *vxlan_find_sock(struct net *net, __be16 port) -+/* Find VXLAN socket based on network namespace, address family and UDP port */ -+static struct vxlan_sock *vxlan_find_sock(struct net *net, -+ sa_family_t family, __be16 port) - { - struct vxlan_sock *vs; - - hlist_for_each_entry_rcu(vs, vs_head(net, port), hlist) { -- if (inet_sk(vs->sock->sk)->inet_sport == port) -+ if (inet_sk(vs->sock->sk)->inet_sport == port && -+ inet_sk(vs->sock->sk)->sk.sk_family == family) - return vs; - } - return NULL; -@@ -304,11 +306,12 @@ static struct vxlan_dev *vxlan_vs_find_vni(struct vxlan_sock *vs, u32 id) - } - - /* Look up VNI in a per net namespace table */ --static struct vxlan_dev *vxlan_find_vni(struct net *net, u32 id, __be16 port) -+static struct vxlan_dev *vxlan_find_vni(struct net *net, u32 id, -+ sa_family_t family, __be16 port) - { - struct vxlan_sock *vs; - -- vs = vxlan_find_sock(net, port); -+ vs = vxlan_find_sock(net, family, port); - if (!vs) - return NULL; - -@@ -1872,7 +1875,8 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev, - struct vxlan_dev *dst_vxlan; - - ip_rt_put(rt); -- dst_vxlan = vxlan_find_vni(dev_net(dev), vni, dst_port); -+ dst_vxlan = vxlan_find_vni(dev_net(dev), vni, -+ dst->sa.sa_family, dst_port); - if (!dst_vxlan) - goto tx_error; - vxlan_encap_bypass(skb, vxlan, dst_vxlan); -@@ -1925,7 +1929,8 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev, - struct vxlan_dev *dst_vxlan; - - dst_release(ndst); -- dst_vxlan = vxlan_find_vni(dev_net(dev), vni, dst_port); -+ dst_vxlan = vxlan_find_vni(dev_net(dev), vni, -+ dst->sa.sa_family, dst_port); - if (!dst_vxlan) - goto tx_error; - vxlan_encap_bypass(skb, vxlan, dst_vxlan); -@@ -2083,6 +2088,7 @@ static int vxlan_init(struct net_device *dev) - { - struct vxlan_dev *vxlan = netdev_priv(dev); - struct vxlan_net *vn = net_generic(dev_net(dev), vxlan_net_id); -+ bool ipv6 = vxlan->flags & VXLAN_F_IPV6; - struct vxlan_sock *vs; - int i; - -@@ -2098,7 +2104,8 @@ static int vxlan_init(struct net_device *dev) - - - spin_lock(&vn->sock_lock); -- vs = vxlan_find_sock(dev_net(dev), vxlan->dst_port); -+ vs = vxlan_find_sock(dev_net(dev), ipv6 ? AF_INET6 : AF_INET, -+ vxlan->dst_port); - if (vs) { - /* If we have a socket with same port already, reuse it */ - atomic_inc(&vs->refcnt); -@@ -2566,7 +2573,7 @@ struct vxlan_sock *vxlan_sock_add(struct net *net, __be16 port, - return vs; - - spin_lock(&vn->sock_lock); -- vs = vxlan_find_sock(net, port); -+ vs = vxlan_find_sock(net, ipv6 ? AF_INET6 : AF_INET, port); - if (vs) { - if (vs->rcv == rcv) - atomic_inc(&vs->refcnt); -@@ -2712,7 +2719,8 @@ static int vxlan_newlink(struct net *net, struct net_device *dev, - if (data[IFLA_VXLAN_PORT]) - vxlan->dst_port = nla_get_be16(data[IFLA_VXLAN_PORT]); - -- if (vxlan_find_vni(net, vni, vxlan->dst_port)) { -+ if (vxlan_find_vni(net, vni, use_ipv6 ? AF_INET6 : AF_INET, -+ vxlan->dst_port)) { - pr_info("duplicate VNI %u\n", vni); - return -EEXIST; - } -diff --git a/drivers/net/wireless/iwlwifi/iwl-trans.h b/drivers/net/wireless/iwlwifi/iwl-trans.h -index 1f065cf4a4ba..d090ed79ada0 100644 ---- a/drivers/net/wireless/iwlwifi/iwl-trans.h -+++ b/drivers/net/wireless/iwlwifi/iwl-trans.h -@@ -514,6 +514,7 @@ enum iwl_trans_state { - * Set during transport allocation. - * @hw_id_str: a string with info about HW ID. Set during transport allocation. - * @pm_support: set to true in start_hw if link pm is supported -+ * @ltr_enabled: set to true if the LTR is enabled - * @dev_cmd_pool: pool for Tx cmd allocation - for internal use only. - * The user should use iwl_trans_{alloc,free}_tx_cmd. - * @dev_cmd_headroom: room needed for the transport's private use before the -@@ -539,6 +540,7 @@ struct iwl_trans { - u8 rx_mpdu_cmd, rx_mpdu_cmd_hdr_size; - - bool pm_support; -+ bool ltr_enabled; - - /* The following fields are internal only */ - struct kmem_cache *dev_cmd_pool; -diff --git a/drivers/net/wireless/iwlwifi/mvm/fw-api-power.h b/drivers/net/wireless/iwlwifi/mvm/fw-api-power.h -index 884c08725308..fa66471283d9 100644 ---- a/drivers/net/wireless/iwlwifi/mvm/fw-api-power.h -+++ b/drivers/net/wireless/iwlwifi/mvm/fw-api-power.h -@@ -66,13 +66,46 @@ - - /* Power Management Commands, Responses, Notifications */ - -+/** -+ * enum iwl_ltr_config_flags - masks for LTR config command flags -+ * @LTR_CFG_FLAG_FEATURE_ENABLE: Feature operational status -+ * @LTR_CFG_FLAG_HW_DIS_ON_SHADOW_REG_ACCESS: allow LTR change on shadow -+ * memory access -+ * @LTR_CFG_FLAG_HW_EN_SHRT_WR_THROUGH: allow LTR msg send on ANY LTR -+ * reg change -+ * @LTR_CFG_FLAG_HW_DIS_ON_D0_2_D3: allow LTR msg send on transition from -+ * D0 to D3 -+ * @LTR_CFG_FLAG_SW_SET_SHORT: fixed static short LTR register -+ * @LTR_CFG_FLAG_SW_SET_LONG: fixed static short LONG register -+ * @LTR_CFG_FLAG_DENIE_C10_ON_PD: allow going into C10 on PD -+ */ -+enum iwl_ltr_config_flags { -+ LTR_CFG_FLAG_FEATURE_ENABLE = BIT(0), -+ LTR_CFG_FLAG_HW_DIS_ON_SHADOW_REG_ACCESS = BIT(1), -+ LTR_CFG_FLAG_HW_EN_SHRT_WR_THROUGH = BIT(2), -+ LTR_CFG_FLAG_HW_DIS_ON_D0_2_D3 = BIT(3), -+ LTR_CFG_FLAG_SW_SET_SHORT = BIT(4), -+ LTR_CFG_FLAG_SW_SET_LONG = BIT(5), -+ LTR_CFG_FLAG_DENIE_C10_ON_PD = BIT(6), -+}; -+ -+/** -+ * struct iwl_ltr_config_cmd - configures the LTR -+ * @flags: See %enum iwl_ltr_config_flags -+ */ -+struct iwl_ltr_config_cmd { -+ __le32 flags; -+ __le32 static_long; -+ __le32 static_short; -+} __packed; -+ - /* Radio LP RX Energy Threshold measured in dBm */ - #define POWER_LPRX_RSSI_THRESHOLD 75 - #define POWER_LPRX_RSSI_THRESHOLD_MAX 94 - #define POWER_LPRX_RSSI_THRESHOLD_MIN 30 - - /** -- * enum iwl_scan_flags - masks for power table command flags -+ * enum iwl_power_flags - masks for power table command flags - * @POWER_FLAGS_POWER_SAVE_ENA_MSK: '1' Allow to save power by turning off - * receiver and transmitter. '0' - does not allow. - * @POWER_FLAGS_POWER_MANAGEMENT_ENA_MSK: '0' Driver disables power management, -diff --git a/drivers/net/wireless/iwlwifi/mvm/fw-api.h b/drivers/net/wireless/iwlwifi/mvm/fw-api.h -index d0a04779d734..d8948aa9c2d2 100644 ---- a/drivers/net/wireless/iwlwifi/mvm/fw-api.h -+++ b/drivers/net/wireless/iwlwifi/mvm/fw-api.h -@@ -142,6 +142,7 @@ enum { - /* Power - legacy power table command */ - POWER_TABLE_CMD = 0x77, - PSM_UAPSD_AP_MISBEHAVING_NOTIFICATION = 0x78, -+ LTR_CONFIG = 0xee, - - /* Thermal Throttling*/ - REPLY_THERMAL_MNG_BACKOFF = 0x7e, -diff --git a/drivers/net/wireless/iwlwifi/mvm/fw.c b/drivers/net/wireless/iwlwifi/mvm/fw.c -index c03d39541f9e..2ef344fc0acb 100644 ---- a/drivers/net/wireless/iwlwifi/mvm/fw.c -+++ b/drivers/net/wireless/iwlwifi/mvm/fw.c -@@ -439,6 +439,15 @@ int iwl_mvm_up(struct iwl_mvm *mvm) - goto error; - } - -+ if (mvm->trans->ltr_enabled) { -+ struct iwl_ltr_config_cmd cmd = { -+ .flags = cpu_to_le32(LTR_CFG_FLAG_FEATURE_ENABLE), -+ }; -+ -+ WARN_ON(iwl_mvm_send_cmd_pdu(mvm, LTR_CONFIG, 0, -+ sizeof(cmd), &cmd)); -+ } -+ - ret = iwl_mvm_power_update_device_mode(mvm); - if (ret) - goto error; -diff --git a/drivers/net/wireless/iwlwifi/mvm/ops.c b/drivers/net/wireless/iwlwifi/mvm/ops.c -index a3d43de342d7..dbff7f0bc6a8 100644 ---- a/drivers/net/wireless/iwlwifi/mvm/ops.c -+++ b/drivers/net/wireless/iwlwifi/mvm/ops.c -@@ -313,6 +313,7 @@ static const char *iwl_mvm_cmd_strings[REPLY_MAX] = { - CMD(REPLY_BEACON_FILTERING_CMD), - CMD(REPLY_THERMAL_MNG_BACKOFF), - CMD(MAC_PM_POWER_TABLE), -+ CMD(LTR_CONFIG), - CMD(BT_COEX_CI), - CMD(PSM_UAPSD_AP_MISBEHAVING_NOTIFICATION), - }; -diff --git a/drivers/net/wireless/iwlwifi/pcie/trans.c b/drivers/net/wireless/iwlwifi/pcie/trans.c -index 16be0c07c64a..fb62927ca44d 100644 ---- a/drivers/net/wireless/iwlwifi/pcie/trans.c -+++ b/drivers/net/wireless/iwlwifi/pcie/trans.c -@@ -94,6 +94,7 @@ static void iwl_pcie_apm_config(struct iwl_trans *trans) - { - struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); - u16 lctl; -+ u16 cap; - - /* - * HW bug W/A for instability in PCIe bus L0S->L1 transition. -@@ -104,16 +105,17 @@ static void iwl_pcie_apm_config(struct iwl_trans *trans) - * power savings, even without L1. - */ - pcie_capability_read_word(trans_pcie->pci_dev, PCI_EXP_LNKCTL, &lctl); -- if (lctl & PCI_EXP_LNKCTL_ASPM_L1) { -- /* L1-ASPM enabled; disable(!) L0S */ -+ if (lctl & PCI_EXP_LNKCTL_ASPM_L1) - iwl_set_bit(trans, CSR_GIO_REG, CSR_GIO_REG_VAL_L0S_ENABLED); -- dev_info(trans->dev, "L1 Enabled; Disabling L0S\n"); -- } else { -- /* L1-ASPM disabled; enable(!) L0S */ -+ else - iwl_clear_bit(trans, CSR_GIO_REG, CSR_GIO_REG_VAL_L0S_ENABLED); -- dev_info(trans->dev, "L1 Disabled; Enabling L0S\n"); -- } - trans->pm_support = !(lctl & PCI_EXP_LNKCTL_ASPM_L0S); -+ -+ pcie_capability_read_word(trans_pcie->pci_dev, PCI_EXP_DEVCTL2, &cap); -+ trans->ltr_enabled = cap & PCI_EXP_DEVCTL2_LTR_EN; -+ dev_info(trans->dev, "L1 %sabled - LTR %sabled\n", -+ (lctl & PCI_EXP_LNKCTL_ASPM_L1) ? "En" : "Dis", -+ trans->ltr_enabled ? "En" : "Dis"); - } - - /* -diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c -index 69d4c3179d04..505ff601d9f4 100644 ---- a/drivers/net/wireless/mac80211_hwsim.c -+++ b/drivers/net/wireless/mac80211_hwsim.c -@@ -1974,7 +1974,7 @@ static int mac80211_hwsim_create_radio(int channels, const char *reg_alpha2, - if (err != 0) { - printk(KERN_DEBUG "mac80211_hwsim: device_bind_driver failed (%d)\n", - err); -- goto failed_hw; -+ goto failed_bind; - } - - skb_queue_head_init(&data->pending); -@@ -2157,6 +2157,8 @@ static int mac80211_hwsim_create_radio(int channels, const char *reg_alpha2, - return idx; - - failed_hw: -+ device_release_driver(data->dev); -+failed_bind: - device_unregister(data->dev); - failed_drvdata: - ieee80211_free_hw(hw); -diff --git a/drivers/platform/x86/dell-wmi.c b/drivers/platform/x86/dell-wmi.c -index 390e8e33d5e3..25721bf20092 100644 ---- a/drivers/platform/x86/dell-wmi.c -+++ b/drivers/platform/x86/dell-wmi.c -@@ -163,18 +163,24 @@ static void dell_wmi_notify(u32 value, void *context) - const struct key_entry *key; - int reported_key; - u16 *buffer_entry = (u16 *)obj->buffer.pointer; -+ int buffer_size = obj->buffer.length/2; - -- if (dell_new_hk_type && (buffer_entry[1] != 0x10)) { -+ if (buffer_size >= 2 && dell_new_hk_type && buffer_entry[1] != 0x10) { - pr_info("Received unknown WMI event (0x%x)\n", - buffer_entry[1]); - kfree(obj); - return; - } - -- if (dell_new_hk_type || buffer_entry[1] == 0x0) -+ if (buffer_size >= 3 && (dell_new_hk_type || buffer_entry[1] == 0x0)) - reported_key = (int)buffer_entry[2]; -- else -+ else if (buffer_size >= 2) - reported_key = (int)buffer_entry[1] & 0xffff; -+ else { -+ pr_info("Received unknown WMI event\n"); -+ kfree(obj); -+ return; -+ } - - key = sparse_keymap_entry_from_scancode(dell_wmi_input_dev, - reported_key); -diff --git a/drivers/power/bq2415x_charger.c b/drivers/power/bq2415x_charger.c -index e384844a1ae1..1f49986fc605 100644 ---- a/drivers/power/bq2415x_charger.c -+++ b/drivers/power/bq2415x_charger.c -@@ -1579,8 +1579,15 @@ static int bq2415x_probe(struct i2c_client *client, - if (np) { - bq->notify_psy = power_supply_get_by_phandle(np, "ti,usb-charger-detection"); - -- if (!bq->notify_psy) -- return -EPROBE_DEFER; -+ if (IS_ERR(bq->notify_psy)) { -+ dev_info(&client->dev, -+ "no 'ti,usb-charger-detection' property (err=%ld)\n", -+ PTR_ERR(bq->notify_psy)); -+ bq->notify_psy = NULL; -+ } else if (!bq->notify_psy) { -+ ret = -EPROBE_DEFER; -+ goto error_2; -+ } - } - else if (pdata->notify_device) - bq->notify_psy = power_supply_get_by_name(pdata->notify_device); -@@ -1602,27 +1609,27 @@ static int bq2415x_probe(struct i2c_client *client, - ret = of_property_read_u32(np, "ti,current-limit", - &bq->init_data.current_limit); - if (ret) -- return ret; -+ goto error_2; - ret = of_property_read_u32(np, "ti,weak-battery-voltage", - &bq->init_data.weak_battery_voltage); - if (ret) -- return ret; -+ goto error_2; - ret = of_property_read_u32(np, "ti,battery-regulation-voltage", - &bq->init_data.battery_regulation_voltage); - if (ret) -- return ret; -+ goto error_2; - ret = of_property_read_u32(np, "ti,charge-current", - &bq->init_data.charge_current); - if (ret) -- return ret; -+ goto error_2; - ret = of_property_read_u32(np, "ti,termination-current", - &bq->init_data.termination_current); - if (ret) -- return ret; -+ goto error_2; - ret = of_property_read_u32(np, "ti,resistor-sense", - &bq->init_data.resistor_sense); - if (ret) -- return ret; -+ goto error_2; - } else { - memcpy(&bq->init_data, pdata, sizeof(bq->init_data)); - } -diff --git a/drivers/power/charger-manager.c b/drivers/power/charger-manager.c -index ef1f4c928431..03bfac3655ef 100644 ---- a/drivers/power/charger-manager.c -+++ b/drivers/power/charger-manager.c -@@ -97,6 +97,7 @@ static struct charger_global_desc *g_desc; /* init with setup_charger_manager */ - static bool is_batt_present(struct charger_manager *cm) - { - union power_supply_propval val; -+ struct power_supply *psy; - bool present = false; - int i, ret; - -@@ -107,16 +108,27 @@ static bool is_batt_present(struct charger_manager *cm) - case CM_NO_BATTERY: - break; - case CM_FUEL_GAUGE: -- ret = cm->fuel_gauge->get_property(cm->fuel_gauge, -+ psy = power_supply_get_by_name(cm->desc->psy_fuel_gauge); -+ if (!psy) -+ break; -+ -+ ret = psy->get_property(psy, - POWER_SUPPLY_PROP_PRESENT, &val); - if (ret == 0 && val.intval) - present = true; - break; - case CM_CHARGER_STAT: -- for (i = 0; cm->charger_stat[i]; i++) { -- ret = cm->charger_stat[i]->get_property( -- cm->charger_stat[i], -- POWER_SUPPLY_PROP_PRESENT, &val); -+ for (i = 0; cm->desc->psy_charger_stat[i]; i++) { -+ psy = power_supply_get_by_name( -+ cm->desc->psy_charger_stat[i]); -+ if (!psy) { -+ dev_err(cm->dev, "Cannot find power supply \"%s\"\n", -+ cm->desc->psy_charger_stat[i]); -+ continue; -+ } -+ -+ ret = psy->get_property(psy, POWER_SUPPLY_PROP_PRESENT, -+ &val); - if (ret == 0 && val.intval) { - present = true; - break; -@@ -139,14 +151,20 @@ static bool is_batt_present(struct charger_manager *cm) - static bool is_ext_pwr_online(struct charger_manager *cm) - { - union power_supply_propval val; -+ struct power_supply *psy; - bool online = false; - int i, ret; - - /* If at least one of them has one, it's yes. */ -- for (i = 0; cm->charger_stat[i]; i++) { -- ret = cm->charger_stat[i]->get_property( -- cm->charger_stat[i], -- POWER_SUPPLY_PROP_ONLINE, &val); -+ for (i = 0; cm->desc->psy_charger_stat[i]; i++) { -+ psy = power_supply_get_by_name(cm->desc->psy_charger_stat[i]); -+ if (!psy) { -+ dev_err(cm->dev, "Cannot find power supply \"%s\"\n", -+ cm->desc->psy_charger_stat[i]); -+ continue; -+ } -+ -+ ret = psy->get_property(psy, POWER_SUPPLY_PROP_ONLINE, &val); - if (ret == 0 && val.intval) { - online = true; - break; -@@ -167,12 +185,14 @@ static bool is_ext_pwr_online(struct charger_manager *cm) - static int get_batt_uV(struct charger_manager *cm, int *uV) - { - union power_supply_propval val; -+ struct power_supply *fuel_gauge; - int ret; - -- if (!cm->fuel_gauge) -+ fuel_gauge = power_supply_get_by_name(cm->desc->psy_fuel_gauge); -+ if (!fuel_gauge) - return -ENODEV; - -- ret = cm->fuel_gauge->get_property(cm->fuel_gauge, -+ ret = fuel_gauge->get_property(fuel_gauge, - POWER_SUPPLY_PROP_VOLTAGE_NOW, &val); - if (ret) - return ret; -@@ -189,6 +209,7 @@ static bool is_charging(struct charger_manager *cm) - { - int i, ret; - bool charging = false; -+ struct power_supply *psy; - union power_supply_propval val; - - /* If there is no battery, it cannot be charged */ -@@ -196,17 +217,22 @@ static bool is_charging(struct charger_manager *cm) - return false; - - /* If at least one of the charger is charging, return yes */ -- for (i = 0; cm->charger_stat[i]; i++) { -+ for (i = 0; cm->desc->psy_charger_stat[i]; i++) { - /* 1. The charger sholuld not be DISABLED */ - if (cm->emergency_stop) - continue; - if (!cm->charger_enabled) - continue; - -+ psy = power_supply_get_by_name(cm->desc->psy_charger_stat[i]); -+ if (!psy) { -+ dev_err(cm->dev, "Cannot find power supply \"%s\"\n", -+ cm->desc->psy_charger_stat[i]); -+ continue; -+ } -+ - /* 2. The charger should be online (ext-power) */ -- ret = cm->charger_stat[i]->get_property( -- cm->charger_stat[i], -- POWER_SUPPLY_PROP_ONLINE, &val); -+ ret = psy->get_property(psy, POWER_SUPPLY_PROP_ONLINE, &val); - if (ret) { - dev_warn(cm->dev, "Cannot read ONLINE value from %s\n", - cm->desc->psy_charger_stat[i]); -@@ -219,9 +245,7 @@ static bool is_charging(struct charger_manager *cm) - * 3. The charger should not be FULL, DISCHARGING, - * or NOT_CHARGING. - */ -- ret = cm->charger_stat[i]->get_property( -- cm->charger_stat[i], -- POWER_SUPPLY_PROP_STATUS, &val); -+ ret = psy->get_property(psy, POWER_SUPPLY_PROP_STATUS, &val); - if (ret) { - dev_warn(cm->dev, "Cannot read STATUS value from %s\n", - cm->desc->psy_charger_stat[i]); -@@ -248,6 +272,7 @@ static bool is_full_charged(struct charger_manager *cm) - { - struct charger_desc *desc = cm->desc; - union power_supply_propval val; -+ struct power_supply *fuel_gauge; - int ret = 0; - int uV; - -@@ -255,11 +280,15 @@ static bool is_full_charged(struct charger_manager *cm) - if (!is_batt_present(cm)) - return false; - -- if (cm->fuel_gauge && desc->fullbatt_full_capacity > 0) { -+ fuel_gauge = power_supply_get_by_name(cm->desc->psy_fuel_gauge); -+ if (!fuel_gauge) -+ return false; -+ -+ if (desc->fullbatt_full_capacity > 0) { - val.intval = 0; - - /* Not full if capacity of fuel gauge isn't full */ -- ret = cm->fuel_gauge->get_property(cm->fuel_gauge, -+ ret = fuel_gauge->get_property(fuel_gauge, - POWER_SUPPLY_PROP_CHARGE_FULL, &val); - if (!ret && val.intval > desc->fullbatt_full_capacity) - return true; -@@ -273,10 +302,10 @@ static bool is_full_charged(struct charger_manager *cm) - } - - /* Full, if the capacity is more than fullbatt_soc */ -- if (cm->fuel_gauge && desc->fullbatt_soc > 0) { -+ if (desc->fullbatt_soc > 0) { - val.intval = 0; - -- ret = cm->fuel_gauge->get_property(cm->fuel_gauge, -+ ret = fuel_gauge->get_property(fuel_gauge, - POWER_SUPPLY_PROP_CAPACITY, &val); - if (!ret && val.intval >= desc->fullbatt_soc) - return true; -@@ -551,6 +580,20 @@ static int check_charging_duration(struct charger_manager *cm) - return ret; - } - -+static int cm_get_battery_temperature_by_psy(struct charger_manager *cm, -+ int *temp) -+{ -+ struct power_supply *fuel_gauge; -+ -+ fuel_gauge = power_supply_get_by_name(cm->desc->psy_fuel_gauge); -+ if (!fuel_gauge) -+ return -ENODEV; -+ -+ return fuel_gauge->get_property(fuel_gauge, -+ POWER_SUPPLY_PROP_TEMP, -+ (union power_supply_propval *)temp); -+} -+ - static int cm_get_battery_temperature(struct charger_manager *cm, - int *temp) - { -@@ -560,15 +603,18 @@ static int cm_get_battery_temperature(struct charger_manager *cm, - return -ENODEV; - - #ifdef CONFIG_THERMAL -- ret = thermal_zone_get_temp(cm->tzd_batt, (unsigned long *)temp); -- if (!ret) -- /* Calibrate temperature unit */ -- *temp /= 100; --#else -- ret = cm->fuel_gauge->get_property(cm->fuel_gauge, -- POWER_SUPPLY_PROP_TEMP, -- (union power_supply_propval *)temp); -+ if (cm->tzd_batt) { -+ ret = thermal_zone_get_temp(cm->tzd_batt, (unsigned long *)temp); -+ if (!ret) -+ /* Calibrate temperature unit */ -+ *temp /= 100; -+ } else - #endif -+ { -+ /* if-else continued from CONFIG_THERMAL */ -+ ret = cm_get_battery_temperature_by_psy(cm, temp); -+ } -+ - return ret; - } - -@@ -827,6 +873,7 @@ static int charger_get_property(struct power_supply *psy, - struct charger_manager *cm = container_of(psy, - struct charger_manager, charger_psy); - struct charger_desc *desc = cm->desc; -+ struct power_supply *fuel_gauge; - int ret = 0; - int uV; - -@@ -857,14 +904,20 @@ static int charger_get_property(struct power_supply *psy, - ret = get_batt_uV(cm, &val->intval); - break; - case POWER_SUPPLY_PROP_CURRENT_NOW: -- ret = cm->fuel_gauge->get_property(cm->fuel_gauge, -+ fuel_gauge = power_supply_get_by_name(cm->desc->psy_fuel_gauge); -+ if (!fuel_gauge) { -+ ret = -ENODEV; -+ break; -+ } -+ ret = fuel_gauge->get_property(fuel_gauge, - POWER_SUPPLY_PROP_CURRENT_NOW, val); - break; - case POWER_SUPPLY_PROP_TEMP: - case POWER_SUPPLY_PROP_TEMP_AMBIENT: - return cm_get_battery_temperature(cm, &val->intval); - case POWER_SUPPLY_PROP_CAPACITY: -- if (!cm->fuel_gauge) { -+ fuel_gauge = power_supply_get_by_name(cm->desc->psy_fuel_gauge); -+ if (!fuel_gauge) { - ret = -ENODEV; - break; - } -@@ -875,7 +928,7 @@ static int charger_get_property(struct power_supply *psy, - break; - } - -- ret = cm->fuel_gauge->get_property(cm->fuel_gauge, -+ ret = fuel_gauge->get_property(fuel_gauge, - POWER_SUPPLY_PROP_CAPACITY, val); - if (ret) - break; -@@ -924,7 +977,14 @@ static int charger_get_property(struct power_supply *psy, - break; - case POWER_SUPPLY_PROP_CHARGE_NOW: - if (is_charging(cm)) { -- ret = cm->fuel_gauge->get_property(cm->fuel_gauge, -+ fuel_gauge = power_supply_get_by_name( -+ cm->desc->psy_fuel_gauge); -+ if (!fuel_gauge) { -+ ret = -ENODEV; -+ break; -+ } -+ -+ ret = fuel_gauge->get_property(fuel_gauge, - POWER_SUPPLY_PROP_CHARGE_NOW, - val); - if (ret) { -@@ -1485,14 +1545,15 @@ err: - return ret; - } - --static int cm_init_thermal_data(struct charger_manager *cm) -+static int cm_init_thermal_data(struct charger_manager *cm, -+ struct power_supply *fuel_gauge) - { - struct charger_desc *desc = cm->desc; - union power_supply_propval val; - int ret; - - /* Verify whether fuel gauge provides battery temperature */ -- ret = cm->fuel_gauge->get_property(cm->fuel_gauge, -+ ret = fuel_gauge->get_property(fuel_gauge, - POWER_SUPPLY_PROP_TEMP, &val); - - if (!ret) { -@@ -1502,8 +1563,6 @@ static int cm_init_thermal_data(struct charger_manager *cm) - cm->desc->measure_battery_temp = true; - } - #ifdef CONFIG_THERMAL -- cm->tzd_batt = cm->fuel_gauge->tzd; -- - if (ret && desc->thermal_zone) { - cm->tzd_batt = - thermal_zone_get_zone_by_name(desc->thermal_zone); -@@ -1666,6 +1725,7 @@ static int charger_manager_probe(struct platform_device *pdev) - int ret = 0, i = 0; - int j = 0; - union power_supply_propval val; -+ struct power_supply *fuel_gauge; - - if (g_desc && !rtc_dev && g_desc->rtc_name) { - rtc_dev = rtc_class_open(g_desc->rtc_name); -@@ -1729,23 +1789,20 @@ static int charger_manager_probe(struct platform_device *pdev) - while (desc->psy_charger_stat[i]) - i++; - -- cm->charger_stat = devm_kzalloc(&pdev->dev, -- sizeof(struct power_supply *) * i, GFP_KERNEL); -- if (!cm->charger_stat) -- return -ENOMEM; -- -+ /* Check if charger's supplies are present at probe */ - for (i = 0; desc->psy_charger_stat[i]; i++) { -- cm->charger_stat[i] = power_supply_get_by_name( -- desc->psy_charger_stat[i]); -- if (!cm->charger_stat[i]) { -+ struct power_supply *psy; -+ -+ psy = power_supply_get_by_name(desc->psy_charger_stat[i]); -+ if (!psy) { - dev_err(&pdev->dev, "Cannot find power supply \"%s\"\n", - desc->psy_charger_stat[i]); - return -ENODEV; - } - } - -- cm->fuel_gauge = power_supply_get_by_name(desc->psy_fuel_gauge); -- if (!cm->fuel_gauge) { -+ fuel_gauge = power_supply_get_by_name(desc->psy_fuel_gauge); -+ if (!fuel_gauge) { - dev_err(&pdev->dev, "Cannot find power supply \"%s\"\n", - desc->psy_fuel_gauge); - return -ENODEV; -@@ -1788,13 +1845,13 @@ static int charger_manager_probe(struct platform_device *pdev) - cm->charger_psy.num_properties = psy_default.num_properties; - - /* Find which optional psy-properties are available */ -- if (!cm->fuel_gauge->get_property(cm->fuel_gauge, -+ if (!fuel_gauge->get_property(fuel_gauge, - POWER_SUPPLY_PROP_CHARGE_NOW, &val)) { - cm->charger_psy.properties[cm->charger_psy.num_properties] = - POWER_SUPPLY_PROP_CHARGE_NOW; - cm->charger_psy.num_properties++; - } -- if (!cm->fuel_gauge->get_property(cm->fuel_gauge, -+ if (!fuel_gauge->get_property(fuel_gauge, - POWER_SUPPLY_PROP_CURRENT_NOW, - &val)) { - cm->charger_psy.properties[cm->charger_psy.num_properties] = -@@ -1802,7 +1859,7 @@ static int charger_manager_probe(struct platform_device *pdev) - cm->charger_psy.num_properties++; - } - -- ret = cm_init_thermal_data(cm); -+ ret = cm_init_thermal_data(cm, fuel_gauge); - if (ret) { - dev_err(&pdev->dev, "Failed to initialize thermal data\n"); - cm->desc->measure_battery_temp = false; -@@ -2059,8 +2116,8 @@ static bool find_power_supply(struct charger_manager *cm, - int i; - bool found = false; - -- for (i = 0; cm->charger_stat[i]; i++) { -- if (psy == cm->charger_stat[i]) { -+ for (i = 0; cm->desc->psy_charger_stat[i]; i++) { -+ if (!strcmp(psy->name, cm->desc->psy_charger_stat[i])) { - found = true; - break; - } -diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c -index edb4d46fa874..96b6664bb1cf 100644 ---- a/drivers/scsi/scsi_error.c -+++ b/drivers/scsi/scsi_error.c -@@ -1984,8 +1984,10 @@ static void scsi_restart_operations(struct Scsi_Host *shost) - * is no point trying to lock the door of an off-line device. - */ - shost_for_each_device(sdev, shost) { -- if (scsi_device_online(sdev) && sdev->locked) -+ if (scsi_device_online(sdev) && sdev->was_reset && sdev->locked) { - scsi_eh_lock_door(sdev); -+ sdev->was_reset = 0; -+ } - } - - /* -diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c -index b01fb6c527e3..d43c544d3b68 100644 ---- a/fs/btrfs/compression.c -+++ b/fs/btrfs/compression.c -@@ -472,7 +472,7 @@ static noinline int add_ra_bio_pages(struct inode *inode, - rcu_read_lock(); - page = radix_tree_lookup(&mapping->page_tree, pg_index); - rcu_read_unlock(); -- if (page) { -+ if (page && !radix_tree_exceptional_entry(page)) { - misses++; - if (misses > 4) - break; -diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c -index a9a881ed8cbe..f6d00df99a8c 100644 ---- a/fs/btrfs/file.c -+++ b/fs/btrfs/file.c -@@ -425,13 +425,8 @@ static noinline int btrfs_copy_from_user(loff_t pos, int num_pages, - struct page *page = prepared_pages[pg]; - /* - * Copy data from userspace to the current page -- * -- * Disable pagefault to avoid recursive lock since -- * the pages are already locked - */ -- pagefault_disable(); - copied = iov_iter_copy_from_user_atomic(page, i, offset, count); -- pagefault_enable(); - - /* Flush processor's dcache for this page */ - flush_dcache_page(page); -diff --git a/fs/cramfs/inode.c b/fs/cramfs/inode.c -index 06610cf94d57..a1f801c14fbc 100644 ---- a/fs/cramfs/inode.c -+++ b/fs/cramfs/inode.c -@@ -195,8 +195,7 @@ static void *cramfs_read(struct super_block *sb, unsigned int offset, unsigned i - struct page *page = NULL; - - if (blocknr + i < devsize) { -- page = read_mapping_page_async(mapping, blocknr + i, -- NULL); -+ page = read_mapping_page(mapping, blocknr + i, NULL); - /* synchronous error? */ - if (IS_ERR(page)) - page = NULL; -diff --git a/fs/fuse/file.c b/fs/fuse/file.c -index 77bcc303c3ae..a91d3b4d32f3 100644 ---- a/fs/fuse/file.c -+++ b/fs/fuse/file.c -@@ -1003,9 +1003,7 @@ static ssize_t fuse_fill_write_pages(struct fuse_req *req, - if (mapping_writably_mapped(mapping)) - flush_dcache_page(page); - -- pagefault_disable(); - tmp = iov_iter_copy_from_user_atomic(page, ii, offset, bytes); -- pagefault_enable(); - flush_dcache_page(page); - - mark_page_accessed(page); -diff --git a/fs/gfs2/meta_io.c b/fs/gfs2/meta_io.c -index c7f24690ed05..b82a9c99e18b 100644 ---- a/fs/gfs2/meta_io.c -+++ b/fs/gfs2/meta_io.c -@@ -97,6 +97,11 @@ const struct address_space_operations gfs2_meta_aops = { - .releasepage = gfs2_releasepage, - }; - -+const struct address_space_operations gfs2_rgrp_aops = { -+ .writepage = gfs2_aspace_writepage, -+ .releasepage = gfs2_releasepage, -+}; -+ - /** - * gfs2_getbuf - Get a buffer with a given address space - * @gl: the glock -diff --git a/fs/gfs2/meta_io.h b/fs/gfs2/meta_io.h -index 4823b934208a..ac5d8027d335 100644 ---- a/fs/gfs2/meta_io.h -+++ b/fs/gfs2/meta_io.h -@@ -38,12 +38,15 @@ static inline void gfs2_buffer_copy_tail(struct buffer_head *to_bh, - } - - extern const struct address_space_operations gfs2_meta_aops; -+extern const struct address_space_operations gfs2_rgrp_aops; - - static inline struct gfs2_sbd *gfs2_mapping2sbd(struct address_space *mapping) - { - struct inode *inode = mapping->host; - if (mapping->a_ops == &gfs2_meta_aops) - return (((struct gfs2_glock *)mapping) - 1)->gl_sbd; -+ else if (mapping->a_ops == &gfs2_rgrp_aops) -+ return container_of(mapping, struct gfs2_sbd, sd_aspace); - else - return inode->i_sb->s_fs_info; - } -diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c -index c6872d09561a..f6c9d83aa39b 100644 ---- a/fs/gfs2/ops_fstype.c -+++ b/fs/gfs2/ops_fstype.c -@@ -104,7 +104,7 @@ static struct gfs2_sbd *init_sbd(struct super_block *sb) - mapping = &sdp->sd_aspace; - - address_space_init_once(mapping); -- mapping->a_ops = &gfs2_meta_aops; -+ mapping->a_ops = &gfs2_rgrp_aops; - mapping->host = sb->s_bdev->bd_inode; - mapping->flags = 0; - mapping_set_gfp_mask(mapping, GFP_NOFS); -diff --git a/fs/ioprio.c b/fs/ioprio.c -index e50170ca7c33..31666c92b46a 100644 ---- a/fs/ioprio.c -+++ b/fs/ioprio.c -@@ -157,14 +157,16 @@ out: - - int ioprio_best(unsigned short aprio, unsigned short bprio) - { -- unsigned short aclass = IOPRIO_PRIO_CLASS(aprio); -- unsigned short bclass = IOPRIO_PRIO_CLASS(bprio); -+ unsigned short aclass; -+ unsigned short bclass; - -- if (aclass == IOPRIO_CLASS_NONE) -- aclass = IOPRIO_CLASS_BE; -- if (bclass == IOPRIO_CLASS_NONE) -- bclass = IOPRIO_CLASS_BE; -+ if (!ioprio_valid(aprio)) -+ aprio = IOPRIO_PRIO_VALUE(IOPRIO_CLASS_BE, IOPRIO_NORM); -+ if (!ioprio_valid(bprio)) -+ bprio = IOPRIO_PRIO_VALUE(IOPRIO_CLASS_BE, IOPRIO_NORM); - -+ aclass = IOPRIO_PRIO_CLASS(aprio); -+ bclass = IOPRIO_PRIO_CLASS(bprio); - if (aclass == bclass) - return min(aprio, bprio); - if (aclass > bclass) -diff --git a/fs/jffs2/fs.c b/fs/jffs2/fs.c -index a69e426435dd..5b234db85854 100644 ---- a/fs/jffs2/fs.c -+++ b/fs/jffs2/fs.c -@@ -687,7 +687,7 @@ unsigned char *jffs2_gc_fetch_page(struct jffs2_sb_info *c, - struct inode *inode = OFNI_EDONI_2SFFJ(f); - struct page *pg; - -- pg = read_cache_page_async(inode->i_mapping, offset >> PAGE_CACHE_SHIFT, -+ pg = read_cache_page(inode->i_mapping, offset >> PAGE_CACHE_SHIFT, - (void *)jffs2_do_readpage_unlock, inode); - if (IS_ERR(pg)) - return (void *)pg; -diff --git a/fs/nfs/blocklayout/blocklayout.c b/fs/nfs/blocklayout/blocklayout.c -index 56ff823ca82e..65d849bdf77a 100644 ---- a/fs/nfs/blocklayout/blocklayout.c -+++ b/fs/nfs/blocklayout/blocklayout.c -@@ -1213,7 +1213,7 @@ static u64 pnfs_num_cont_bytes(struct inode *inode, pgoff_t idx) - end = DIV_ROUND_UP(i_size_read(inode), PAGE_CACHE_SIZE); - if (end != NFS_I(inode)->npages) { - rcu_read_lock(); -- end = radix_tree_next_hole(&mapping->page_tree, idx + 1, ULONG_MAX); -+ end = page_cache_next_hole(mapping, idx + 1, ULONG_MAX); - rcu_read_unlock(); - } - -diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c -index 5d8ccecf5f5c..3ed1be9aade3 100644 ---- a/fs/nfs/delegation.c -+++ b/fs/nfs/delegation.c -@@ -109,6 +109,8 @@ again: - continue; - if (!test_bit(NFS_DELEGATED_STATE, &state->flags)) - continue; -+ if (!nfs4_valid_open_stateid(state)) -+ continue; - if (!nfs4_stateid_match(&state->stateid, stateid)) - continue; - get_nfs_open_context(ctx); -@@ -177,7 +179,11 @@ static int nfs_do_return_delegation(struct inode *inode, struct nfs_delegation * - { - int res = 0; - -- res = nfs4_proc_delegreturn(inode, delegation->cred, &delegation->stateid, issync); -+ if (!test_bit(NFS_DELEGATION_REVOKED, &delegation->flags)) -+ res = nfs4_proc_delegreturn(inode, -+ delegation->cred, -+ &delegation->stateid, -+ issync); - nfs_free_delegation(delegation); - return res; - } -@@ -364,11 +370,13 @@ static int nfs_end_delegation_return(struct inode *inode, struct nfs_delegation - { - struct nfs_client *clp = NFS_SERVER(inode)->nfs_client; - struct nfs_inode *nfsi = NFS_I(inode); -- int err; -+ int err = 0; - - if (delegation == NULL) - return 0; - do { -+ if (test_bit(NFS_DELEGATION_REVOKED, &delegation->flags)) -+ break; - err = nfs_delegation_claim_opens(inode, &delegation->stateid); - if (!issync || err != -EAGAIN) - break; -@@ -589,10 +597,23 @@ static void nfs_client_mark_return_unused_delegation_types(struct nfs_client *cl - rcu_read_unlock(); - } - -+static void nfs_revoke_delegation(struct inode *inode) -+{ -+ struct nfs_delegation *delegation; -+ rcu_read_lock(); -+ delegation = rcu_dereference(NFS_I(inode)->delegation); -+ if (delegation != NULL) { -+ set_bit(NFS_DELEGATION_REVOKED, &delegation->flags); -+ nfs_mark_return_delegation(NFS_SERVER(inode), delegation); -+ } -+ rcu_read_unlock(); -+} -+ - void nfs_remove_bad_delegation(struct inode *inode) - { - struct nfs_delegation *delegation; - -+ nfs_revoke_delegation(inode); - delegation = nfs_inode_detach_delegation(inode); - if (delegation) { - nfs_inode_find_state_and_recover(inode, &delegation->stateid); -diff --git a/fs/nfs/delegation.h b/fs/nfs/delegation.h -index 9a79c7a99d6d..e02b090ab9da 100644 ---- a/fs/nfs/delegation.h -+++ b/fs/nfs/delegation.h -@@ -31,6 +31,7 @@ enum { - NFS_DELEGATION_RETURN_IF_CLOSED, - NFS_DELEGATION_REFERENCED, - NFS_DELEGATION_RETURNING, -+ NFS_DELEGATION_REVOKED, - }; - - int nfs_inode_set_delegation(struct inode *inode, struct rpc_cred *cred, struct nfs_openres *res); -diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c -index b8797ae6831f..de2543d3c283 100644 ---- a/fs/nfs/direct.c -+++ b/fs/nfs/direct.c -@@ -178,6 +178,7 @@ static void nfs_direct_req_free(struct kref *kref) - { - struct nfs_direct_req *dreq = container_of(kref, struct nfs_direct_req, kref); - -+ nfs_free_pnfs_ds_cinfo(&dreq->ds_cinfo); - if (dreq->l_ctx != NULL) - nfs_put_lock_context(dreq->l_ctx); - if (dreq->ctx != NULL) -diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c -index 15f9d98627a4..6659ce545f15 100644 ---- a/fs/nfs/inode.c -+++ b/fs/nfs/inode.c -@@ -592,7 +592,7 @@ int nfs_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat) - { - struct inode *inode = dentry->d_inode; - int need_atime = NFS_I(inode)->cache_validity & NFS_INO_INVALID_ATIME; -- int err; -+ int err = 0; - - trace_nfs_getattr_enter(inode); - /* Flush out writes to the server in order to update c/mtime. */ -diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c -index da657b7804a5..bd01803d0656 100644 ---- a/fs/nfs/nfs4proc.c -+++ b/fs/nfs/nfs4proc.c -@@ -1587,7 +1587,7 @@ static int nfs4_handle_delegation_recall_error(struct nfs_server *server, struct - nfs_inode_find_state_and_recover(state->inode, - stateid); - nfs4_schedule_stateid_recovery(server, state); -- return 0; -+ return -EAGAIN; - case -NFS4ERR_DELAY: - case -NFS4ERR_GRACE: - set_bit(NFS_DELEGATED_STATE, &state->flags); -@@ -2034,46 +2034,60 @@ static int nfs4_open_expired(struct nfs4_state_owner *sp, struct nfs4_state *sta - return ret; - } - -+static void nfs_finish_clear_delegation_stateid(struct nfs4_state *state) -+{ -+ nfs_remove_bad_delegation(state->inode); -+ write_seqlock(&state->seqlock); -+ nfs4_stateid_copy(&state->stateid, &state->open_stateid); -+ write_sequnlock(&state->seqlock); -+ clear_bit(NFS_DELEGATED_STATE, &state->flags); -+} -+ -+static void nfs40_clear_delegation_stateid(struct nfs4_state *state) -+{ -+ if (rcu_access_pointer(NFS_I(state->inode)->delegation) != NULL) -+ nfs_finish_clear_delegation_stateid(state); -+} -+ -+static int nfs40_open_expired(struct nfs4_state_owner *sp, struct nfs4_state *state) -+{ -+ /* NFSv4.0 doesn't allow for delegation recovery on open expire */ -+ nfs40_clear_delegation_stateid(state); -+ return nfs4_open_expired(sp, state); -+} -+ - #if defined(CONFIG_NFS_V4_1) --static void nfs41_clear_delegation_stateid(struct nfs4_state *state) -+static void nfs41_check_delegation_stateid(struct nfs4_state *state) - { - struct nfs_server *server = NFS_SERVER(state->inode); -- nfs4_stateid *stateid = &state->stateid; -+ nfs4_stateid stateid; - struct nfs_delegation *delegation; -- struct rpc_cred *cred = NULL; -- int status = -NFS4ERR_BAD_STATEID; -- -- /* If a state reset has been done, test_stateid is unneeded */ -- if (test_bit(NFS_DELEGATED_STATE, &state->flags) == 0) -- return; -+ struct rpc_cred *cred; -+ int status; - - /* Get the delegation credential for use by test/free_stateid */ - rcu_read_lock(); - delegation = rcu_dereference(NFS_I(state->inode)->delegation); -- if (delegation != NULL && -- nfs4_stateid_match(&delegation->stateid, stateid)) { -- cred = get_rpccred(delegation->cred); -- rcu_read_unlock(); -- status = nfs41_test_stateid(server, stateid, cred); -- trace_nfs4_test_delegation_stateid(state, NULL, status); -- } else -+ if (delegation == NULL) { - rcu_read_unlock(); -+ return; -+ } -+ -+ nfs4_stateid_copy(&stateid, &delegation->stateid); -+ cred = get_rpccred(delegation->cred); -+ rcu_read_unlock(); -+ status = nfs41_test_stateid(server, &stateid, cred); -+ trace_nfs4_test_delegation_stateid(state, NULL, status); - - if (status != NFS_OK) { - /* Free the stateid unless the server explicitly - * informs us the stateid is unrecognized. */ - if (status != -NFS4ERR_BAD_STATEID) -- nfs41_free_stateid(server, stateid, cred); -- nfs_remove_bad_delegation(state->inode); -- -- write_seqlock(&state->seqlock); -- nfs4_stateid_copy(&state->stateid, &state->open_stateid); -- write_sequnlock(&state->seqlock); -- clear_bit(NFS_DELEGATED_STATE, &state->flags); -+ nfs41_free_stateid(server, &stateid, cred); -+ nfs_finish_clear_delegation_stateid(state); - } - -- if (cred != NULL) -- put_rpccred(cred); -+ put_rpccred(cred); - } - - /** -@@ -2117,7 +2131,7 @@ static int nfs41_open_expired(struct nfs4_state_owner *sp, struct nfs4_state *st - { - int status; - -- nfs41_clear_delegation_stateid(state); -+ nfs41_check_delegation_stateid(state); - status = nfs41_check_open_stateid(state); - if (status != NFS_OK) - status = nfs4_open_expired(sp, state); -@@ -8255,7 +8269,7 @@ static const struct nfs4_state_recovery_ops nfs41_reboot_recovery_ops = { - static const struct nfs4_state_recovery_ops nfs40_nograce_recovery_ops = { - .owner_flag_bit = NFS_OWNER_RECLAIM_NOGRACE, - .state_flag_bit = NFS_STATE_RECLAIM_NOGRACE, -- .recover_open = nfs4_open_expired, -+ .recover_open = nfs40_open_expired, - .recover_lock = nfs4_lock_expired, - .establish_clid = nfs4_init_clientid, - }; -diff --git a/fs/super.c b/fs/super.c -index 88a6bc6e3cc9..440ef51cd696 100644 ---- a/fs/super.c -+++ b/fs/super.c -@@ -114,9 +114,14 @@ static unsigned long super_cache_count(struct shrinker *shrink, - - sb = container_of(shrink, struct super_block, s_shrink); - -- if (!grab_super_passive(sb)) -- return 0; -- -+ /* -+ * Don't call grab_super_passive as it is a potential -+ * scalability bottleneck. The counts could get updated -+ * between super_cache_count and super_cache_scan anyway. -+ * Call to super_cache_count with shrinker_rwsem held -+ * ensures the safety of call to list_lru_count_node() and -+ * s_op->nr_cached_objects(). -+ */ - if (sb->s_op && sb->s_op->nr_cached_objects) - total_objects = sb->s_op->nr_cached_objects(sb, - sc->nid); -@@ -127,7 +132,6 @@ static unsigned long super_cache_count(struct shrinker *shrink, - sc->nid); - - total_objects = vfs_pressure_ratio(total_objects); -- drop_super(sb); - return total_objects; - } - -@@ -278,10 +282,8 @@ void deactivate_locked_super(struct super_block *s) - struct file_system_type *fs = s->s_type; - if (atomic_dec_and_test(&s->s_active)) { - cleancache_invalidate_fs(s); -- fs->kill_sb(s); -- -- /* caches are now gone, we can safely kill the shrinker now */ - unregister_shrinker(&s->s_shrink); -+ fs->kill_sb(s); - - put_filesystem(fs); - put_super(s); -diff --git a/include/dt-bindings/pinctrl/dra.h b/include/dt-bindings/pinctrl/dra.h -index 3d33794e4f3e..7448edff4723 100644 ---- a/include/dt-bindings/pinctrl/dra.h -+++ b/include/dt-bindings/pinctrl/dra.h -@@ -40,8 +40,8 @@ - - /* Active pin states */ - #define PIN_OUTPUT (0 | PULL_DIS) --#define PIN_OUTPUT_PULLUP (PIN_OUTPUT | PULL_ENA | PULL_UP) --#define PIN_OUTPUT_PULLDOWN (PIN_OUTPUT | PULL_ENA) -+#define PIN_OUTPUT_PULLUP (PULL_UP) -+#define PIN_OUTPUT_PULLDOWN (0) - #define PIN_INPUT (INPUT_EN | PULL_DIS) - #define PIN_INPUT_SLEW (INPUT_EN | SLEWCONTROL) - #define PIN_INPUT_PULLUP (PULL_ENA | INPUT_EN | PULL_UP) -diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h -index 67301a405712..879065d8d208 100644 ---- a/include/linux/clocksource.h -+++ b/include/linux/clocksource.h -@@ -289,7 +289,7 @@ extern struct clocksource* clocksource_get_next(void); - extern void clocksource_change_rating(struct clocksource *cs, int rating); - extern void clocksource_suspend(void); - extern void clocksource_resume(void); --extern struct clocksource * __init __weak clocksource_default_clock(void); -+extern struct clocksource * __init clocksource_default_clock(void); - extern void clocksource_mark_unstable(struct clocksource *cs); - - extern u64 -diff --git a/include/linux/compaction.h b/include/linux/compaction.h -index 7e1c76e3cd68..01e3132820da 100644 ---- a/include/linux/compaction.h -+++ b/include/linux/compaction.h -@@ -22,7 +22,7 @@ extern int sysctl_extfrag_handler(struct ctl_table *table, int write, - extern int fragmentation_index(struct zone *zone, unsigned int order); - extern unsigned long try_to_compact_pages(struct zonelist *zonelist, - int order, gfp_t gfp_mask, nodemask_t *mask, -- bool sync, bool *contended); -+ enum migrate_mode mode, bool *contended); - extern void compact_pgdat(pg_data_t *pgdat, int order); - extern void reset_isolation_suitable(pg_data_t *pgdat); - extern unsigned long compaction_suitable(struct zone *zone, int order); -@@ -91,7 +91,7 @@ static inline bool compaction_restarting(struct zone *zone, int order) - #else - static inline unsigned long try_to_compact_pages(struct zonelist *zonelist, - int order, gfp_t gfp_mask, nodemask_t *nodemask, -- bool sync, bool *contended) -+ enum migrate_mode mode, bool *contended) - { - return COMPACT_CONTINUE; - } -diff --git a/include/linux/crash_dump.h b/include/linux/crash_dump.h -index 7032518f8542..60023e5d3169 100644 ---- a/include/linux/crash_dump.h -+++ b/include/linux/crash_dump.h -@@ -14,14 +14,13 @@ - extern unsigned long long elfcorehdr_addr; - extern unsigned long long elfcorehdr_size; - --extern int __weak elfcorehdr_alloc(unsigned long long *addr, -- unsigned long long *size); --extern void __weak elfcorehdr_free(unsigned long long addr); --extern ssize_t __weak elfcorehdr_read(char *buf, size_t count, u64 *ppos); --extern ssize_t __weak elfcorehdr_read_notes(char *buf, size_t count, u64 *ppos); --extern int __weak remap_oldmem_pfn_range(struct vm_area_struct *vma, -- unsigned long from, unsigned long pfn, -- unsigned long size, pgprot_t prot); -+extern int elfcorehdr_alloc(unsigned long long *addr, unsigned long long *size); -+extern void elfcorehdr_free(unsigned long long addr); -+extern ssize_t elfcorehdr_read(char *buf, size_t count, u64 *ppos); -+extern ssize_t elfcorehdr_read_notes(char *buf, size_t count, u64 *ppos); -+extern int remap_oldmem_pfn_range(struct vm_area_struct *vma, -+ unsigned long from, unsigned long pfn, -+ unsigned long size, pgprot_t prot); - - extern ssize_t copy_oldmem_page(unsigned long, char *, size_t, - unsigned long, int); -diff --git a/include/linux/kgdb.h b/include/linux/kgdb.h -index 6b06d378f3df..e465bb15912d 100644 ---- a/include/linux/kgdb.h -+++ b/include/linux/kgdb.h -@@ -283,7 +283,7 @@ struct kgdb_io { - - extern struct kgdb_arch arch_kgdb_ops; - --extern unsigned long __weak kgdb_arch_pc(int exception, struct pt_regs *regs); -+extern unsigned long kgdb_arch_pc(int exception, struct pt_regs *regs); - - #ifdef CONFIG_SERIAL_KGDB_NMI - extern int kgdb_register_nmi_console(void); -diff --git a/include/linux/memory.h b/include/linux/memory.h -index bb7384e3c3d8..8b8d8d12348e 100644 ---- a/include/linux/memory.h -+++ b/include/linux/memory.h -@@ -35,7 +35,7 @@ struct memory_block { - }; - - int arch_get_memory_phys_device(unsigned long start_pfn); --unsigned long __weak memory_block_size_bytes(void); -+unsigned long memory_block_size_bytes(void); - - /* These states are exposed to userspace as text strings in sysfs */ - #define MEM_ONLINE (1<<0) /* exposed to userspace */ -diff --git a/include/linux/migrate.h b/include/linux/migrate.h -index 84a31ad0b791..a2901c414664 100644 ---- a/include/linux/migrate.h -+++ b/include/linux/migrate.h -@@ -5,7 +5,9 @@ - #include <linux/mempolicy.h> - #include <linux/migrate_mode.h> - --typedef struct page *new_page_t(struct page *, unsigned long private, int **); -+typedef struct page *new_page_t(struct page *page, unsigned long private, -+ int **reason); -+typedef void free_page_t(struct page *page, unsigned long private); - - /* - * Return values from addresss_space_operations.migratepage(): -@@ -38,7 +40,7 @@ enum migrate_reason { - extern void putback_movable_pages(struct list_head *l); - extern int migrate_page(struct address_space *, - struct page *, struct page *, enum migrate_mode); --extern int migrate_pages(struct list_head *l, new_page_t x, -+extern int migrate_pages(struct list_head *l, new_page_t new, free_page_t free, - unsigned long private, enum migrate_mode mode, int reason); - - extern int migrate_prep(void); -@@ -56,8 +58,9 @@ extern int migrate_page_move_mapping(struct address_space *mapping, - #else - - static inline void putback_movable_pages(struct list_head *l) {} --static inline int migrate_pages(struct list_head *l, new_page_t x, -- unsigned long private, enum migrate_mode mode, int reason) -+static inline int migrate_pages(struct list_head *l, new_page_t new, -+ free_page_t free, unsigned long private, enum migrate_mode mode, -+ int reason) - { return -ENOSYS; } - - static inline int migrate_prep(void) { return -ENOSYS; } -diff --git a/include/linux/mm.h b/include/linux/mm.h -index 0a0b024ec7e8..d5039daf1e1c 100644 ---- a/include/linux/mm.h -+++ b/include/linux/mm.h -@@ -1041,6 +1041,14 @@ extern void show_free_areas(unsigned int flags); - extern bool skip_free_areas_node(unsigned int flags, int nid); - - int shmem_zero_setup(struct vm_area_struct *); -+#ifdef CONFIG_SHMEM -+bool shmem_mapping(struct address_space *mapping); -+#else -+static inline bool shmem_mapping(struct address_space *mapping) -+{ -+ return false; -+} -+#endif - - extern int can_do_mlock(void); - extern int user_shm_lock(size_t, struct user_struct *); -@@ -1848,9 +1856,6 @@ void page_cache_async_readahead(struct address_space *mapping, - unsigned long size); - - unsigned long max_sane_readahead(unsigned long nr); --unsigned long ra_submit(struct file_ra_state *ra, -- struct address_space *mapping, -- struct file *filp); - - /* Generic expand stack which grows the stack according to GROWS{UP,DOWN} */ - extern int expand_stack(struct vm_area_struct *vma, unsigned long address); -diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h -index e6800f0c0d7b..18843532a0c9 100644 ---- a/include/linux/mmzone.h -+++ b/include/linux/mmzone.h -@@ -361,9 +361,10 @@ struct zone { - /* Set to true when the PG_migrate_skip bits should be cleared */ - bool compact_blockskip_flush; - -- /* pfns where compaction scanners should start */ -+ /* pfn where compaction free scanner should start */ - unsigned long compact_cached_free_pfn; -- unsigned long compact_cached_migrate_pfn; -+ /* pfn where async and sync compaction migration scanner should start */ -+ unsigned long compact_cached_migrate_pfn[2]; - #endif - #ifdef CONFIG_MEMORY_HOTPLUG - /* see spanned/present_pages for more description */ -diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h -index 5624e4e2763c..53988cb3c05a 100644 ---- a/include/linux/nfs_xdr.h -+++ b/include/linux/nfs_xdr.h -@@ -1247,11 +1247,22 @@ struct nfs41_free_stateid_res { - unsigned int status; - }; - -+static inline void -+nfs_free_pnfs_ds_cinfo(struct pnfs_ds_commit_info *cinfo) -+{ -+ kfree(cinfo->buckets); -+} -+ - #else - - struct pnfs_ds_commit_info { - }; - -+static inline void -+nfs_free_pnfs_ds_cinfo(struct pnfs_ds_commit_info *cinfo) -+{ -+} -+ - #endif /* CONFIG_NFS_V4_1 */ - - struct nfs_page; -diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h -index 1710d1b060ba..09c1b03867d9 100644 ---- a/include/linux/pagemap.h -+++ b/include/linux/pagemap.h -@@ -243,12 +243,20 @@ static inline struct page *page_cache_alloc_readahead(struct address_space *x) - - typedef int filler_t(void *, struct page *); - --extern struct page * find_get_page(struct address_space *mapping, -- pgoff_t index); --extern struct page * find_lock_page(struct address_space *mapping, -- pgoff_t index); --extern struct page * find_or_create_page(struct address_space *mapping, -- pgoff_t index, gfp_t gfp_mask); -+pgoff_t page_cache_next_hole(struct address_space *mapping, -+ pgoff_t index, unsigned long max_scan); -+pgoff_t page_cache_prev_hole(struct address_space *mapping, -+ pgoff_t index, unsigned long max_scan); -+ -+struct page *find_get_entry(struct address_space *mapping, pgoff_t offset); -+struct page *find_get_page(struct address_space *mapping, pgoff_t offset); -+struct page *find_lock_entry(struct address_space *mapping, pgoff_t offset); -+struct page *find_lock_page(struct address_space *mapping, pgoff_t offset); -+struct page *find_or_create_page(struct address_space *mapping, pgoff_t index, -+ gfp_t gfp_mask); -+unsigned find_get_entries(struct address_space *mapping, pgoff_t start, -+ unsigned int nr_entries, struct page **entries, -+ pgoff_t *indices); - unsigned find_get_pages(struct address_space *mapping, pgoff_t start, - unsigned int nr_pages, struct page **pages); - unsigned find_get_pages_contig(struct address_space *mapping, pgoff_t start, -@@ -270,8 +278,6 @@ static inline struct page *grab_cache_page(struct address_space *mapping, - - extern struct page * grab_cache_page_nowait(struct address_space *mapping, - pgoff_t index); --extern struct page * read_cache_page_async(struct address_space *mapping, -- pgoff_t index, filler_t *filler, void *data); - extern struct page * read_cache_page(struct address_space *mapping, - pgoff_t index, filler_t *filler, void *data); - extern struct page * read_cache_page_gfp(struct address_space *mapping, -@@ -279,14 +285,6 @@ extern struct page * read_cache_page_gfp(struct address_space *mapping, - extern int read_cache_pages(struct address_space *mapping, - struct list_head *pages, filler_t *filler, void *data); - --static inline struct page *read_mapping_page_async( -- struct address_space *mapping, -- pgoff_t index, void *data) --{ -- filler_t *filler = (filler_t *)mapping->a_ops->readpage; -- return read_cache_page_async(mapping, index, filler, data); --} -- - static inline struct page *read_mapping_page(struct address_space *mapping, - pgoff_t index, void *data) - { -diff --git a/include/linux/pagevec.h b/include/linux/pagevec.h -index e4dbfab37729..b45d391b4540 100644 ---- a/include/linux/pagevec.h -+++ b/include/linux/pagevec.h -@@ -22,6 +22,11 @@ struct pagevec { - - void __pagevec_release(struct pagevec *pvec); - void __pagevec_lru_add(struct pagevec *pvec); -+unsigned pagevec_lookup_entries(struct pagevec *pvec, -+ struct address_space *mapping, -+ pgoff_t start, unsigned nr_entries, -+ pgoff_t *indices); -+void pagevec_remove_exceptionals(struct pagevec *pvec); - unsigned pagevec_lookup(struct pagevec *pvec, struct address_space *mapping, - pgoff_t start, unsigned nr_pages); - unsigned pagevec_lookup_tag(struct pagevec *pvec, -diff --git a/include/linux/power/charger-manager.h b/include/linux/power/charger-manager.h -index 07e7945a1ff2..e97fc656a058 100644 ---- a/include/linux/power/charger-manager.h -+++ b/include/linux/power/charger-manager.h -@@ -253,9 +253,6 @@ struct charger_manager { - struct device *dev; - struct charger_desc *desc; - -- struct power_supply *fuel_gauge; -- struct power_supply **charger_stat; -- - #ifdef CONFIG_THERMAL - struct thermal_zone_device *tzd_batt; - #endif -diff --git a/include/linux/radix-tree.h b/include/linux/radix-tree.h -index 403940787be1..e8be53ecfc45 100644 ---- a/include/linux/radix-tree.h -+++ b/include/linux/radix-tree.h -@@ -219,6 +219,7 @@ static inline void radix_tree_replace_slot(void **pslot, void *item) - int radix_tree_insert(struct radix_tree_root *, unsigned long, void *); - void *radix_tree_lookup(struct radix_tree_root *, unsigned long); - void **radix_tree_lookup_slot(struct radix_tree_root *, unsigned long); -+void *radix_tree_delete_item(struct radix_tree_root *, unsigned long, void *); - void *radix_tree_delete(struct radix_tree_root *, unsigned long); - unsigned int - radix_tree_gang_lookup(struct radix_tree_root *root, void **results, -@@ -226,10 +227,6 @@ radix_tree_gang_lookup(struct radix_tree_root *root, void **results, - unsigned int radix_tree_gang_lookup_slot(struct radix_tree_root *root, - void ***results, unsigned long *indices, - unsigned long first_index, unsigned int max_items); --unsigned long radix_tree_next_hole(struct radix_tree_root *root, -- unsigned long index, unsigned long max_scan); --unsigned long radix_tree_prev_hole(struct radix_tree_root *root, -- unsigned long index, unsigned long max_scan); - int radix_tree_preload(gfp_t gfp_mask); - int radix_tree_maybe_preload(gfp_t gfp_mask); - void radix_tree_init(void); -diff --git a/include/linux/shmem_fs.h b/include/linux/shmem_fs.h -index 9d55438bc4ad..4d1771c2d29f 100644 ---- a/include/linux/shmem_fs.h -+++ b/include/linux/shmem_fs.h -@@ -51,6 +51,7 @@ extern struct file *shmem_kernel_file_setup(const char *name, loff_t size, - unsigned long flags); - extern int shmem_zero_setup(struct vm_area_struct *); - extern int shmem_lock(struct file *file, int lock, struct user_struct *user); -+extern bool shmem_mapping(struct address_space *mapping); - extern void shmem_unlock_mapping(struct address_space *mapping); - extern struct page *shmem_read_mapping_page_gfp(struct address_space *mapping, - pgoff_t index, gfp_t gfp_mask); -diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h -index a3353f45ef94..ba41e01ebc54 100644 ---- a/include/net/sctp/sctp.h -+++ b/include/net/sctp/sctp.h -@@ -433,6 +433,11 @@ static inline void sctp_assoc_pending_pmtu(struct sock *sk, struct sctp_associat - asoc->pmtu_pending = 0; - } - -+static inline bool sctp_chunk_pending(const struct sctp_chunk *chunk) -+{ -+ return !list_empty(&chunk->list); -+} -+ - /* Walk through a list of TLV parameters. Don't trust the - * individual parameter lengths and instead depend on - * the chunk length to indicate when to stop. Make sure -diff --git a/include/net/sctp/sm.h b/include/net/sctp/sm.h -index 7f4eeb340a54..72a31db47ded 100644 ---- a/include/net/sctp/sm.h -+++ b/include/net/sctp/sm.h -@@ -248,9 +248,9 @@ struct sctp_chunk *sctp_make_asconf_update_ip(struct sctp_association *, - int, __be16); - struct sctp_chunk *sctp_make_asconf_set_prim(struct sctp_association *asoc, - union sctp_addr *addr); --int sctp_verify_asconf(const struct sctp_association *asoc, -- struct sctp_paramhdr *param_hdr, void *chunk_end, -- struct sctp_paramhdr **errp); -+bool sctp_verify_asconf(const struct sctp_association *asoc, -+ struct sctp_chunk *chunk, bool addr_param_needed, -+ struct sctp_paramhdr **errp); - struct sctp_chunk *sctp_process_asconf(struct sctp_association *asoc, - struct sctp_chunk *asconf); - int sctp_process_asconf_ack(struct sctp_association *asoc, -diff --git a/include/trace/events/compaction.h b/include/trace/events/compaction.h -index 06f544ef2f6f..c6814b917bdf 100644 ---- a/include/trace/events/compaction.h -+++ b/include/trace/events/compaction.h -@@ -5,6 +5,7 @@ - #define _TRACE_COMPACTION_H - - #include <linux/types.h> -+#include <linux/list.h> - #include <linux/tracepoint.h> - #include <trace/events/gfpflags.h> - -@@ -47,10 +48,11 @@ DEFINE_EVENT(mm_compaction_isolate_template, mm_compaction_isolate_freepages, - - TRACE_EVENT(mm_compaction_migratepages, - -- TP_PROTO(unsigned long nr_migrated, -- unsigned long nr_failed), -+ TP_PROTO(unsigned long nr_all, -+ int migrate_rc, -+ struct list_head *migratepages), - -- TP_ARGS(nr_migrated, nr_failed), -+ TP_ARGS(nr_all, migrate_rc, migratepages), - - TP_STRUCT__entry( - __field(unsigned long, nr_migrated) -@@ -58,7 +60,22 @@ TRACE_EVENT(mm_compaction_migratepages, - ), - - TP_fast_assign( -- __entry->nr_migrated = nr_migrated; -+ unsigned long nr_failed = 0; -+ struct list_head *page_lru; -+ -+ /* -+ * migrate_pages() returns either a non-negative number -+ * with the number of pages that failed migration, or an -+ * error code, in which case we need to count the remaining -+ * pages manually -+ */ -+ if (migrate_rc >= 0) -+ nr_failed = migrate_rc; -+ else -+ list_for_each(page_lru, migratepages) -+ nr_failed++; -+ -+ __entry->nr_migrated = nr_all - nr_failed; - __entry->nr_failed = nr_failed; - ), - -diff --git a/include/uapi/linux/netfilter/xt_bpf.h b/include/uapi/linux/netfilter/xt_bpf.h -index 5dda450eb55b..2ec9fbcd06f9 100644 ---- a/include/uapi/linux/netfilter/xt_bpf.h -+++ b/include/uapi/linux/netfilter/xt_bpf.h -@@ -6,6 +6,8 @@ - - #define XT_BPF_MAX_NUM_INSTR 64 - -+struct sk_filter; -+ - struct xt_bpf_info { - __u16 bpf_program_num_elem; - struct sock_filter bpf_program[XT_BPF_MAX_NUM_INSTR]; -diff --git a/ipc/ipc_sysctl.c b/ipc/ipc_sysctl.c -index 17028648cfeb..cadddc8388f3 100644 ---- a/ipc/ipc_sysctl.c -+++ b/ipc/ipc_sysctl.c -@@ -123,7 +123,6 @@ static int proc_ipcauto_dointvec_minmax(ctl_table *table, int write, - void __user *buffer, size_t *lenp, loff_t *ppos) - { - struct ctl_table ipc_table; -- size_t lenp_bef = *lenp; - int oldval; - int rc; - -@@ -133,7 +132,7 @@ static int proc_ipcauto_dointvec_minmax(ctl_table *table, int write, - - rc = proc_dointvec_minmax(&ipc_table, write, buffer, lenp, ppos); - -- if (write && !rc && lenp_bef == *lenp) { -+ if (write && !rc) { - int newval = *((int *)(ipc_table.data)); - /* - * The file "auto_msgmni" has correctly been set. -diff --git a/kernel/audit.c b/kernel/audit.c -index 2c0ecd1753de..b45b2daa9f92 100644 ---- a/kernel/audit.c -+++ b/kernel/audit.c -@@ -687,7 +687,7 @@ static int audit_get_feature(struct sk_buff *skb) - - seq = nlmsg_hdr(skb)->nlmsg_seq; - -- audit_send_reply(skb, seq, AUDIT_GET, 0, 0, &af, sizeof(af)); -+ audit_send_reply(skb, seq, AUDIT_GET_FEATURE, 0, 0, &af, sizeof(af)); - - return 0; - } -@@ -702,7 +702,7 @@ static void audit_log_feature_change(int which, u32 old_feature, u32 new_feature - - ab = audit_log_start(NULL, GFP_KERNEL, AUDIT_FEATURE_CHANGE); - audit_log_task_info(ab, current); -- audit_log_format(ab, "feature=%s old=%u new=%u old_lock=%u new_lock=%u res=%d", -+ audit_log_format(ab, " feature=%s old=%u new=%u old_lock=%u new_lock=%u res=%d", - audit_feature_names[which], !!old_feature, !!new_feature, - !!old_lock, !!new_lock, res); - audit_log_end(ab); -diff --git a/kernel/audit_tree.c b/kernel/audit_tree.c -index 135944a7b28a..a79db03990db 100644 ---- a/kernel/audit_tree.c -+++ b/kernel/audit_tree.c -@@ -154,6 +154,7 @@ static struct audit_chunk *alloc_chunk(int count) - chunk->owners[i].index = i; - } - fsnotify_init_mark(&chunk->mark, audit_tree_destroy_watch); -+ chunk->mark.mask = FS_IN_IGNORED; - return chunk; - } - -diff --git a/kernel/events/core.c b/kernel/events/core.c -index 4ced342f1ba9..4bbb27adf23d 100644 ---- a/kernel/events/core.c -+++ b/kernel/events/core.c -@@ -39,6 +39,7 @@ - #include <linux/hw_breakpoint.h> - #include <linux/mm_types.h> - #include <linux/cgroup.h> -+#include <linux/compat.h> - - #include "internal.h" - -@@ -3693,6 +3694,26 @@ static long perf_ioctl(struct file *file, unsigned int cmd, unsigned long arg) - return 0; - } - -+#ifdef CONFIG_COMPAT -+static long perf_compat_ioctl(struct file *file, unsigned int cmd, -+ unsigned long arg) -+{ -+ switch (_IOC_NR(cmd)) { -+ case _IOC_NR(PERF_EVENT_IOC_SET_FILTER): -+ case _IOC_NR(PERF_EVENT_IOC_ID): -+ /* Fix up pointer size (usually 4 -> 8 in 32-on-64-bit case */ -+ if (_IOC_SIZE(cmd) == sizeof(compat_uptr_t)) { -+ cmd &= ~IOCSIZE_MASK; -+ cmd |= sizeof(void *) << IOCSIZE_SHIFT; -+ } -+ break; -+ } -+ return perf_ioctl(file, cmd, arg); -+} -+#else -+# define perf_compat_ioctl NULL -+#endif -+ - int perf_event_task_enable(void) - { - struct perf_event *event; -@@ -4185,7 +4206,7 @@ static const struct file_operations perf_fops = { - .read = perf_read, - .poll = perf_poll, - .unlocked_ioctl = perf_ioctl, -- .compat_ioctl = perf_ioctl, -+ .compat_ioctl = perf_compat_ioctl, - .mmap = perf_mmap, - .fasync = perf_fasync, - }; -diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c -index b3d116cd072d..6705d947ef14 100644 ---- a/kernel/rcu/tree.c -+++ b/kernel/rcu/tree.c -@@ -1228,6 +1228,22 @@ static int rcu_future_gp_cleanup(struct rcu_state *rsp, struct rcu_node *rnp) - } - - /* -+ * Awaken the grace-period kthread for the specified flavor of RCU. -+ * Don't do a self-awaken, and don't bother awakening when there is -+ * nothing for the grace-period kthread to do (as in several CPUs -+ * raced to awaken, and we lost), and finally don't try to awaken -+ * a kthread that has not yet been created. -+ */ -+static void rcu_gp_kthread_wake(struct rcu_state *rsp) -+{ -+ if (current == rsp->gp_kthread || -+ !ACCESS_ONCE(rsp->gp_flags) || -+ !rsp->gp_kthread) -+ return; -+ wake_up(&rsp->gp_wq); -+} -+ -+/* - * If there is room, assign a ->completed number to any callbacks on - * this CPU that have not already been assigned. Also accelerate any - * callbacks that were previously assigned a ->completed number that has -@@ -1670,7 +1686,7 @@ static void rsp_wakeup(struct irq_work *work) - struct rcu_state *rsp = container_of(work, struct rcu_state, wakeup_work); - - /* Wake up rcu_gp_kthread() to start the grace period. */ -- wake_up(&rsp->gp_wq); -+ rcu_gp_kthread_wake(rsp); - } - - /* -@@ -1746,7 +1762,7 @@ static void rcu_report_qs_rsp(struct rcu_state *rsp, unsigned long flags) - { - WARN_ON_ONCE(!rcu_gp_in_progress(rsp)); - raw_spin_unlock_irqrestore(&rcu_get_root(rsp)->lock, flags); -- wake_up(&rsp->gp_wq); /* Memory barrier implied by wake_up() path. */ -+ rcu_gp_kthread_wake(rsp); - } - - /* -@@ -2322,7 +2338,7 @@ static void force_quiescent_state(struct rcu_state *rsp) - } - rsp->gp_flags |= RCU_GP_FLAG_FQS; - raw_spin_unlock_irqrestore(&rnp_old->lock, flags); -- wake_up(&rsp->gp_wq); /* Memory barrier implied by wake_up() path. */ -+ rcu_gp_kthread_wake(rsp); - } - - /* -diff --git a/lib/radix-tree.c b/lib/radix-tree.c -index bd4a8dfdf0b8..7e30d2a7f346 100644 ---- a/lib/radix-tree.c -+++ b/lib/radix-tree.c -@@ -946,81 +946,6 @@ next: - } - EXPORT_SYMBOL(radix_tree_range_tag_if_tagged); - -- --/** -- * radix_tree_next_hole - find the next hole (not-present entry) -- * @root: tree root -- * @index: index key -- * @max_scan: maximum range to search -- * -- * Search the set [index, min(index+max_scan-1, MAX_INDEX)] for the lowest -- * indexed hole. -- * -- * Returns: the index of the hole if found, otherwise returns an index -- * outside of the set specified (in which case 'return - index >= max_scan' -- * will be true). In rare cases of index wrap-around, 0 will be returned. -- * -- * radix_tree_next_hole may be called under rcu_read_lock. However, like -- * radix_tree_gang_lookup, this will not atomically search a snapshot of -- * the tree at a single point in time. For example, if a hole is created -- * at index 5, then subsequently a hole is created at index 10, -- * radix_tree_next_hole covering both indexes may return 10 if called -- * under rcu_read_lock. -- */ --unsigned long radix_tree_next_hole(struct radix_tree_root *root, -- unsigned long index, unsigned long max_scan) --{ -- unsigned long i; -- -- for (i = 0; i < max_scan; i++) { -- if (!radix_tree_lookup(root, index)) -- break; -- index++; -- if (index == 0) -- break; -- } -- -- return index; --} --EXPORT_SYMBOL(radix_tree_next_hole); -- --/** -- * radix_tree_prev_hole - find the prev hole (not-present entry) -- * @root: tree root -- * @index: index key -- * @max_scan: maximum range to search -- * -- * Search backwards in the range [max(index-max_scan+1, 0), index] -- * for the first hole. -- * -- * Returns: the index of the hole if found, otherwise returns an index -- * outside of the set specified (in which case 'index - return >= max_scan' -- * will be true). In rare cases of wrap-around, ULONG_MAX will be returned. -- * -- * radix_tree_next_hole may be called under rcu_read_lock. However, like -- * radix_tree_gang_lookup, this will not atomically search a snapshot of -- * the tree at a single point in time. For example, if a hole is created -- * at index 10, then subsequently a hole is created at index 5, -- * radix_tree_prev_hole covering both indexes may return 5 if called under -- * rcu_read_lock. -- */ --unsigned long radix_tree_prev_hole(struct radix_tree_root *root, -- unsigned long index, unsigned long max_scan) --{ -- unsigned long i; -- -- for (i = 0; i < max_scan; i++) { -- if (!radix_tree_lookup(root, index)) -- break; -- index--; -- if (index == ULONG_MAX) -- break; -- } -- -- return index; --} --EXPORT_SYMBOL(radix_tree_prev_hole); -- - /** - * radix_tree_gang_lookup - perform multiple lookup on a radix tree - * @root: radix tree root -@@ -1337,15 +1262,18 @@ static inline void radix_tree_shrink(struct radix_tree_root *root) - } - - /** -- * radix_tree_delete - delete an item from a radix tree -+ * radix_tree_delete_item - delete an item from a radix tree - * @root: radix tree root - * @index: index key -+ * @item: expected item - * -- * Remove the item at @index from the radix tree rooted at @root. -+ * Remove @item at @index from the radix tree rooted at @root. - * -- * Returns the address of the deleted item, or NULL if it was not present. -+ * Returns the address of the deleted item, or NULL if it was not present -+ * or the entry at the given @index was not @item. - */ --void *radix_tree_delete(struct radix_tree_root *root, unsigned long index) -+void *radix_tree_delete_item(struct radix_tree_root *root, -+ unsigned long index, void *item) - { - struct radix_tree_node *node = NULL; - struct radix_tree_node *slot = NULL; -@@ -1380,6 +1308,11 @@ void *radix_tree_delete(struct radix_tree_root *root, unsigned long index) - if (slot == NULL) - goto out; - -+ if (item && slot != item) { -+ slot = NULL; -+ goto out; -+ } -+ - /* - * Clear all tags associated with the item to be deleted. - * This way of doing it would be inefficient, but seldom is any set. -@@ -1424,6 +1357,21 @@ void *radix_tree_delete(struct radix_tree_root *root, unsigned long index) - out: - return slot; - } -+EXPORT_SYMBOL(radix_tree_delete_item); -+ -+/** -+ * radix_tree_delete - delete an item from a radix tree -+ * @root: radix tree root -+ * @index: index key -+ * -+ * Remove the item at @index from the radix tree rooted at @root. -+ * -+ * Returns the address of the deleted item, or NULL if it was not present. -+ */ -+void *radix_tree_delete(struct radix_tree_root *root, unsigned long index) -+{ -+ return radix_tree_delete_item(root, index, NULL); -+} - EXPORT_SYMBOL(radix_tree_delete); - - /** -diff --git a/mm/compaction.c b/mm/compaction.c -index 5e38e5706f62..4229fc22a477 100644 ---- a/mm/compaction.c -+++ b/mm/compaction.c -@@ -89,7 +89,8 @@ static void __reset_isolation_suitable(struct zone *zone) - unsigned long end_pfn = zone_end_pfn(zone); - unsigned long pfn; - -- zone->compact_cached_migrate_pfn = start_pfn; -+ zone->compact_cached_migrate_pfn[0] = start_pfn; -+ zone->compact_cached_migrate_pfn[1] = start_pfn; - zone->compact_cached_free_pfn = end_pfn; - zone->compact_blockskip_flush = false; - -@@ -131,9 +132,10 @@ void reset_isolation_suitable(pg_data_t *pgdat) - */ - static void update_pageblock_skip(struct compact_control *cc, - struct page *page, unsigned long nr_isolated, -- bool migrate_scanner) -+ bool set_unsuitable, bool migrate_scanner) - { - struct zone *zone = cc->zone; -+ unsigned long pfn; - - if (cc->ignore_skip_hint) - return; -@@ -141,20 +143,32 @@ static void update_pageblock_skip(struct compact_control *cc, - if (!page) - return; - -- if (!nr_isolated) { -- unsigned long pfn = page_to_pfn(page); -+ if (nr_isolated) -+ return; -+ -+ /* -+ * Only skip pageblocks when all forms of compaction will be known to -+ * fail in the near future. -+ */ -+ if (set_unsuitable) - set_pageblock_skip(page); - -- /* Update where compaction should restart */ -- if (migrate_scanner) { -- if (!cc->finished_update_migrate && -- pfn > zone->compact_cached_migrate_pfn) -- zone->compact_cached_migrate_pfn = pfn; -- } else { -- if (!cc->finished_update_free && -- pfn < zone->compact_cached_free_pfn) -- zone->compact_cached_free_pfn = pfn; -- } -+ pfn = page_to_pfn(page); -+ -+ /* Update where async and sync compaction should restart */ -+ if (migrate_scanner) { -+ if (cc->finished_update_migrate) -+ return; -+ if (pfn > zone->compact_cached_migrate_pfn[0]) -+ zone->compact_cached_migrate_pfn[0] = pfn; -+ if (cc->mode != MIGRATE_ASYNC && -+ pfn > zone->compact_cached_migrate_pfn[1]) -+ zone->compact_cached_migrate_pfn[1] = pfn; -+ } else { -+ if (cc->finished_update_free) -+ return; -+ if (pfn < zone->compact_cached_free_pfn) -+ zone->compact_cached_free_pfn = pfn; - } - } - #else -@@ -166,7 +180,7 @@ static inline bool isolation_suitable(struct compact_control *cc, - - static void update_pageblock_skip(struct compact_control *cc, - struct page *page, unsigned long nr_isolated, -- bool migrate_scanner) -+ bool set_unsuitable, bool migrate_scanner) - { - } - #endif /* CONFIG_COMPACTION */ -@@ -195,7 +209,7 @@ static bool compact_checklock_irqsave(spinlock_t *lock, unsigned long *flags, - } - - /* async aborts if taking too long or contended */ -- if (!cc->sync) { -+ if (cc->mode == MIGRATE_ASYNC) { - cc->contended = true; - return false; - } -@@ -208,10 +222,28 @@ static bool compact_checklock_irqsave(spinlock_t *lock, unsigned long *flags, - return true; - } - --static inline bool compact_trylock_irqsave(spinlock_t *lock, -- unsigned long *flags, struct compact_control *cc) -+/* -+ * Aside from avoiding lock contention, compaction also periodically checks -+ * need_resched() and either schedules in sync compaction or aborts async -+ * compaction. This is similar to what compact_checklock_irqsave() does, but -+ * is used where no lock is concerned. -+ * -+ * Returns false when no scheduling was needed, or sync compaction scheduled. -+ * Returns true when async compaction should abort. -+ */ -+static inline bool compact_should_abort(struct compact_control *cc) - { -- return compact_checklock_irqsave(lock, flags, false, cc); -+ /* async compaction aborts if contended */ -+ if (need_resched()) { -+ if (cc->mode == MIGRATE_ASYNC) { -+ cc->contended = true; -+ return true; -+ } -+ -+ cond_resched(); -+ } -+ -+ return false; - } - - /* Returns true if the page is within a block suitable for migration to */ -@@ -329,7 +361,8 @@ isolate_fail: - - /* Update the pageblock-skip if the whole pageblock was scanned */ - if (blockpfn == end_pfn) -- update_pageblock_skip(cc, valid_page, total_isolated, false); -+ update_pageblock_skip(cc, valid_page, total_isolated, true, -+ false); - - count_compact_events(COMPACTFREE_SCANNED, nr_scanned); - if (total_isolated) -@@ -464,8 +497,9 @@ isolate_migratepages_range(struct zone *zone, struct compact_control *cc, - unsigned long flags; - bool locked = false; - struct page *page = NULL, *valid_page = NULL; -- bool skipped_async_unsuitable = false; -- const isolate_mode_t mode = (!cc->sync ? ISOLATE_ASYNC_MIGRATE : 0) | -+ bool set_unsuitable = true; -+ const isolate_mode_t mode = (cc->mode == MIGRATE_ASYNC ? -+ ISOLATE_ASYNC_MIGRATE : 0) | - (unevictable ? ISOLATE_UNEVICTABLE : 0); - - /* -@@ -475,7 +509,7 @@ isolate_migratepages_range(struct zone *zone, struct compact_control *cc, - */ - while (unlikely(too_many_isolated(zone))) { - /* async migration should just abort */ -- if (!cc->sync) -+ if (cc->mode == MIGRATE_ASYNC) - return 0; - - congestion_wait(BLK_RW_ASYNC, HZ/10); -@@ -484,8 +518,10 @@ isolate_migratepages_range(struct zone *zone, struct compact_control *cc, - return 0; - } - -+ if (compact_should_abort(cc)) -+ return 0; -+ - /* Time to isolate some pages for migration */ -- cond_resched(); - for (; low_pfn < end_pfn; low_pfn++) { - /* give a chance to irqs before checking need_resched() */ - if (locked && !(low_pfn % SWAP_CLUSTER_MAX)) { -@@ -540,9 +576,9 @@ isolate_migratepages_range(struct zone *zone, struct compact_control *cc, - * the minimum amount of work satisfies the allocation - */ - mt = get_pageblock_migratetype(page); -- if (!cc->sync && !migrate_async_suitable(mt)) { -- cc->finished_update_migrate = true; -- skipped_async_unsuitable = true; -+ if (cc->mode == MIGRATE_ASYNC && -+ !migrate_async_suitable(mt)) { -+ set_unsuitable = false; - goto next_pageblock; - } - } -@@ -646,11 +682,10 @@ next_pageblock: - /* - * Update the pageblock-skip information and cached scanner pfn, - * if the whole pageblock was scanned without isolating any page. -- * This is not done when pageblock was skipped due to being unsuitable -- * for async compaction, so that eventual sync compaction can try. - */ -- if (low_pfn == end_pfn && !skipped_async_unsuitable) -- update_pageblock_skip(cc, valid_page, nr_isolated, true); -+ if (low_pfn == end_pfn) -+ update_pageblock_skip(cc, valid_page, nr_isolated, -+ set_unsuitable, true); - - trace_mm_compaction_isolate_migratepages(nr_scanned, nr_isolated); - -@@ -671,7 +706,9 @@ static void isolate_freepages(struct zone *zone, - struct compact_control *cc) - { - struct page *page; -- unsigned long high_pfn, low_pfn, pfn, z_end_pfn; -+ unsigned long block_start_pfn; /* start of current pageblock */ -+ unsigned long block_end_pfn; /* end of current pageblock */ -+ unsigned long low_pfn; /* lowest pfn scanner is able to scan */ - int nr_freepages = cc->nr_freepages; - struct list_head *freelist = &cc->freepages; - -@@ -679,41 +716,38 @@ static void isolate_freepages(struct zone *zone, - * Initialise the free scanner. The starting point is where we last - * successfully isolated from, zone-cached value, or the end of the - * zone when isolating for the first time. We need this aligned to -- * the pageblock boundary, because we do pfn -= pageblock_nr_pages -- * in the for loop. -+ * the pageblock boundary, because we do -+ * block_start_pfn -= pageblock_nr_pages in the for loop. -+ * For ending point, take care when isolating in last pageblock of a -+ * a zone which ends in the middle of a pageblock. - * The low boundary is the end of the pageblock the migration scanner - * is using. - */ -- pfn = cc->free_pfn & ~(pageblock_nr_pages-1); -+ block_start_pfn = cc->free_pfn & ~(pageblock_nr_pages-1); -+ block_end_pfn = min(block_start_pfn + pageblock_nr_pages, -+ zone_end_pfn(zone)); - low_pfn = ALIGN(cc->migrate_pfn + 1, pageblock_nr_pages); - - /* -- * Take care that if the migration scanner is at the end of the zone -- * that the free scanner does not accidentally move to the next zone -- * in the next isolation cycle. -- */ -- high_pfn = min(low_pfn, pfn); -- -- z_end_pfn = zone_end_pfn(zone); -- -- /* - * Isolate free pages until enough are available to migrate the - * pages on cc->migratepages. We stop searching if the migrate - * and free page scanners meet or enough free pages are isolated. - */ -- for (; pfn >= low_pfn && cc->nr_migratepages > nr_freepages; -- pfn -= pageblock_nr_pages) { -+ for (; block_start_pfn >= low_pfn && cc->nr_migratepages > nr_freepages; -+ block_end_pfn = block_start_pfn, -+ block_start_pfn -= pageblock_nr_pages) { - unsigned long isolated; -- unsigned long end_pfn; - - /* - * This can iterate a massively long zone without finding any - * suitable migration targets, so periodically check if we need -- * to schedule. -+ * to schedule, or even abort async compaction. - */ -- cond_resched(); -+ if (!(block_start_pfn % (SWAP_CLUSTER_MAX * pageblock_nr_pages)) -+ && compact_should_abort(cc)) -+ break; - -- if (!pfn_valid(pfn)) -+ if (!pfn_valid(block_start_pfn)) - continue; - - /* -@@ -723,7 +757,7 @@ static void isolate_freepages(struct zone *zone, - * i.e. it's possible that all pages within a zones range of - * pages do not belong to a single zone. - */ -- page = pfn_to_page(pfn); -+ page = pfn_to_page(block_start_pfn); - if (page_zone(page) != zone) - continue; - -@@ -736,26 +770,26 @@ static void isolate_freepages(struct zone *zone, - continue; - - /* Found a block suitable for isolating free pages from */ -- isolated = 0; -+ cc->free_pfn = block_start_pfn; -+ isolated = isolate_freepages_block(cc, block_start_pfn, -+ block_end_pfn, freelist, false); -+ nr_freepages += isolated; - - /* -- * Take care when isolating in last pageblock of a zone which -- * ends in the middle of a pageblock. -+ * Set a flag that we successfully isolated in this pageblock. -+ * In the next loop iteration, zone->compact_cached_free_pfn -+ * will not be updated and thus it will effectively contain the -+ * highest pageblock we isolated pages from. - */ -- end_pfn = min(pfn + pageblock_nr_pages, z_end_pfn); -- isolated = isolate_freepages_block(cc, pfn, end_pfn, -- freelist, false); -- nr_freepages += isolated; -+ if (isolated) -+ cc->finished_update_free = true; - - /* -- * Record the highest PFN we isolated pages from. When next -- * looking for free pages, the search will restart here as -- * page migration may have returned some pages to the allocator -+ * isolate_freepages_block() might have aborted due to async -+ * compaction being contended - */ -- if (isolated) { -- cc->finished_update_free = true; -- high_pfn = max(high_pfn, pfn); -- } -+ if (cc->contended) -+ break; - } - - /* split_free_page does not map the pages */ -@@ -765,10 +799,9 @@ static void isolate_freepages(struct zone *zone, - * If we crossed the migrate scanner, we want to keep it that way - * so that compact_finished() may detect this - */ -- if (pfn < low_pfn) -- cc->free_pfn = max(pfn, zone->zone_start_pfn); -- else -- cc->free_pfn = high_pfn; -+ if (block_start_pfn < low_pfn) -+ cc->free_pfn = cc->migrate_pfn; -+ - cc->nr_freepages = nr_freepages; - } - -@@ -783,9 +816,13 @@ static struct page *compaction_alloc(struct page *migratepage, - struct compact_control *cc = (struct compact_control *)data; - struct page *freepage; - -- /* Isolate free pages if necessary */ -+ /* -+ * Isolate free pages if necessary, and if we are not aborting due to -+ * contention. -+ */ - if (list_empty(&cc->freepages)) { -- isolate_freepages(cc->zone, cc); -+ if (!cc->contended) -+ isolate_freepages(cc->zone, cc); - - if (list_empty(&cc->freepages)) - return NULL; -@@ -799,23 +836,16 @@ static struct page *compaction_alloc(struct page *migratepage, - } - - /* -- * We cannot control nr_migratepages and nr_freepages fully when migration is -- * running as migrate_pages() has no knowledge of compact_control. When -- * migration is complete, we count the number of pages on the lists by hand. -+ * This is a migrate-callback that "frees" freepages back to the isolated -+ * freelist. All pages on the freelist are from the same zone, so there is no -+ * special handling needed for NUMA. - */ --static void update_nr_listpages(struct compact_control *cc) -+static void compaction_free(struct page *page, unsigned long data) - { -- int nr_migratepages = 0; -- int nr_freepages = 0; -- struct page *page; -- -- list_for_each_entry(page, &cc->migratepages, lru) -- nr_migratepages++; -- list_for_each_entry(page, &cc->freepages, lru) -- nr_freepages++; -+ struct compact_control *cc = (struct compact_control *)data; - -- cc->nr_migratepages = nr_migratepages; -- cc->nr_freepages = nr_freepages; -+ list_add(&page->lru, &cc->freepages); -+ cc->nr_freepages++; - } - - /* possible outcome of isolate_migratepages */ -@@ -862,13 +892,14 @@ static int compact_finished(struct zone *zone, - unsigned int order; - unsigned long watermark; - -- if (fatal_signal_pending(current)) -+ if (cc->contended || fatal_signal_pending(current)) - return COMPACT_PARTIAL; - - /* Compaction run completes if the migrate and free scanner meet */ - if (cc->free_pfn <= cc->migrate_pfn) { - /* Let the next compaction start anew. */ -- zone->compact_cached_migrate_pfn = zone->zone_start_pfn; -+ zone->compact_cached_migrate_pfn[0] = zone->zone_start_pfn; -+ zone->compact_cached_migrate_pfn[1] = zone->zone_start_pfn; - zone->compact_cached_free_pfn = zone_end_pfn(zone); - - /* -@@ -968,6 +999,7 @@ static int compact_zone(struct zone *zone, struct compact_control *cc) - int ret; - unsigned long start_pfn = zone->zone_start_pfn; - unsigned long end_pfn = zone_end_pfn(zone); -+ const bool sync = cc->mode != MIGRATE_ASYNC; - - ret = compaction_suitable(zone, cc->order); - switch (ret) { -@@ -993,7 +1025,7 @@ static int compact_zone(struct zone *zone, struct compact_control *cc) - * information on where the scanners should start but check that it - * is initialised by ensuring the values are within zone boundaries. - */ -- cc->migrate_pfn = zone->compact_cached_migrate_pfn; -+ cc->migrate_pfn = zone->compact_cached_migrate_pfn[sync]; - cc->free_pfn = zone->compact_cached_free_pfn; - if (cc->free_pfn < start_pfn || cc->free_pfn > end_pfn) { - cc->free_pfn = end_pfn & ~(pageblock_nr_pages-1); -@@ -1001,7 +1033,8 @@ static int compact_zone(struct zone *zone, struct compact_control *cc) - } - if (cc->migrate_pfn < start_pfn || cc->migrate_pfn > end_pfn) { - cc->migrate_pfn = start_pfn; -- zone->compact_cached_migrate_pfn = cc->migrate_pfn; -+ zone->compact_cached_migrate_pfn[0] = cc->migrate_pfn; -+ zone->compact_cached_migrate_pfn[1] = cc->migrate_pfn; - } - - trace_mm_compaction_begin(start_pfn, cc->migrate_pfn, cc->free_pfn, end_pfn); -@@ -1009,7 +1042,6 @@ static int compact_zone(struct zone *zone, struct compact_control *cc) - migrate_prep_local(); - - while ((ret = compact_finished(zone, cc)) == COMPACT_CONTINUE) { -- unsigned long nr_migrate, nr_remaining; - int err; - - switch (isolate_migratepages(zone, cc)) { -@@ -1024,21 +1056,20 @@ static int compact_zone(struct zone *zone, struct compact_control *cc) - ; - } - -- nr_migrate = cc->nr_migratepages; -+ if (!cc->nr_migratepages) -+ continue; -+ - err = migrate_pages(&cc->migratepages, compaction_alloc, -- (unsigned long)cc, -- cc->sync ? MIGRATE_SYNC_LIGHT : MIGRATE_ASYNC, -+ compaction_free, (unsigned long)cc, cc->mode, - MR_COMPACTION); -- update_nr_listpages(cc); -- nr_remaining = cc->nr_migratepages; - -- trace_mm_compaction_migratepages(nr_migrate - nr_remaining, -- nr_remaining); -+ trace_mm_compaction_migratepages(cc->nr_migratepages, err, -+ &cc->migratepages); - -- /* Release isolated pages not migrated */ -+ /* All pages were either migrated or will be released */ -+ cc->nr_migratepages = 0; - if (err) { - putback_movable_pages(&cc->migratepages); -- cc->nr_migratepages = 0; - /* - * migrate_pages() may return -ENOMEM when scanners meet - * and we want compact_finished() to detect it -@@ -1060,9 +1091,8 @@ out: - return ret; - } - --static unsigned long compact_zone_order(struct zone *zone, -- int order, gfp_t gfp_mask, -- bool sync, bool *contended) -+static unsigned long compact_zone_order(struct zone *zone, int order, -+ gfp_t gfp_mask, enum migrate_mode mode, bool *contended) - { - unsigned long ret; - struct compact_control cc = { -@@ -1071,7 +1101,7 @@ static unsigned long compact_zone_order(struct zone *zone, - .order = order, - .migratetype = allocflags_to_migratetype(gfp_mask), - .zone = zone, -- .sync = sync, -+ .mode = mode, - }; - INIT_LIST_HEAD(&cc.freepages); - INIT_LIST_HEAD(&cc.migratepages); -@@ -1093,7 +1123,7 @@ int sysctl_extfrag_threshold = 500; - * @order: The order of the current allocation - * @gfp_mask: The GFP mask of the current allocation - * @nodemask: The allowed nodes to allocate from -- * @sync: Whether migration is synchronous or not -+ * @mode: The migration mode for async, sync light, or sync migration - * @contended: Return value that is true if compaction was aborted due to lock contention - * @page: Optionally capture a free page of the requested order during compaction - * -@@ -1101,7 +1131,7 @@ int sysctl_extfrag_threshold = 500; - */ - unsigned long try_to_compact_pages(struct zonelist *zonelist, - int order, gfp_t gfp_mask, nodemask_t *nodemask, -- bool sync, bool *contended) -+ enum migrate_mode mode, bool *contended) - { - enum zone_type high_zoneidx = gfp_zone(gfp_mask); - int may_enter_fs = gfp_mask & __GFP_FS; -@@ -1126,7 +1156,7 @@ unsigned long try_to_compact_pages(struct zonelist *zonelist, - nodemask) { - int status; - -- status = compact_zone_order(zone, order, gfp_mask, sync, -+ status = compact_zone_order(zone, order, gfp_mask, mode, - contended); - rc = max(status, rc); - -@@ -1165,9 +1195,6 @@ static void __compact_pgdat(pg_data_t *pgdat, struct compact_control *cc) - if (zone_watermark_ok(zone, cc->order, - low_wmark_pages(zone), 0, 0)) - compaction_defer_reset(zone, cc->order, false); -- /* Currently async compaction is never deferred. */ -- else if (cc->sync) -- defer_compaction(zone, cc->order); - } - - VM_BUG_ON(!list_empty(&cc->freepages)); -@@ -1179,7 +1206,7 @@ void compact_pgdat(pg_data_t *pgdat, int order) - { - struct compact_control cc = { - .order = order, -- .sync = false, -+ .mode = MIGRATE_ASYNC, - }; - - if (!order) -@@ -1192,7 +1219,7 @@ static void compact_node(int nid) - { - struct compact_control cc = { - .order = -1, -- .sync = true, -+ .mode = MIGRATE_SYNC, - .ignore_skip_hint = true, - }; - -diff --git a/mm/filemap.c b/mm/filemap.c -index c2cc7c95eff1..bdaa21555abe 100644 ---- a/mm/filemap.c -+++ b/mm/filemap.c -@@ -448,6 +448,29 @@ int replace_page_cache_page(struct page *old, struct page *new, gfp_t gfp_mask) - } - EXPORT_SYMBOL_GPL(replace_page_cache_page); - -+static int page_cache_tree_insert(struct address_space *mapping, -+ struct page *page) -+{ -+ void **slot; -+ int error; -+ -+ slot = radix_tree_lookup_slot(&mapping->page_tree, page->index); -+ if (slot) { -+ void *p; -+ -+ p = radix_tree_deref_slot_protected(slot, &mapping->tree_lock); -+ if (!radix_tree_exceptional_entry(p)) -+ return -EEXIST; -+ radix_tree_replace_slot(slot, page); -+ mapping->nrpages++; -+ return 0; -+ } -+ error = radix_tree_insert(&mapping->page_tree, page->index, page); -+ if (!error) -+ mapping->nrpages++; -+ return error; -+} -+ - /** - * add_to_page_cache_locked - add a locked page to the pagecache - * @page: page to add -@@ -482,11 +505,10 @@ int add_to_page_cache_locked(struct page *page, struct address_space *mapping, - page->index = offset; - - spin_lock_irq(&mapping->tree_lock); -- error = radix_tree_insert(&mapping->page_tree, offset, page); -+ error = page_cache_tree_insert(mapping, page); - radix_tree_preload_end(); - if (unlikely(error)) - goto err_insert; -- mapping->nrpages++; - __inc_zone_page_state(page, NR_FILE_PAGES); - spin_unlock_irq(&mapping->tree_lock); - trace_mm_filemap_add_to_page_cache(page); -@@ -688,14 +710,101 @@ int __lock_page_or_retry(struct page *page, struct mm_struct *mm, - } - - /** -- * find_get_page - find and get a page reference -+ * page_cache_next_hole - find the next hole (not-present entry) -+ * @mapping: mapping -+ * @index: index -+ * @max_scan: maximum range to search -+ * -+ * Search the set [index, min(index+max_scan-1, MAX_INDEX)] for the -+ * lowest indexed hole. -+ * -+ * Returns: the index of the hole if found, otherwise returns an index -+ * outside of the set specified (in which case 'return - index >= -+ * max_scan' will be true). In rare cases of index wrap-around, 0 will -+ * be returned. -+ * -+ * page_cache_next_hole may be called under rcu_read_lock. However, -+ * like radix_tree_gang_lookup, this will not atomically search a -+ * snapshot of the tree at a single point in time. For example, if a -+ * hole is created at index 5, then subsequently a hole is created at -+ * index 10, page_cache_next_hole covering both indexes may return 10 -+ * if called under rcu_read_lock. -+ */ -+pgoff_t page_cache_next_hole(struct address_space *mapping, -+ pgoff_t index, unsigned long max_scan) -+{ -+ unsigned long i; -+ -+ for (i = 0; i < max_scan; i++) { -+ struct page *page; -+ -+ page = radix_tree_lookup(&mapping->page_tree, index); -+ if (!page || radix_tree_exceptional_entry(page)) -+ break; -+ index++; -+ if (index == 0) -+ break; -+ } -+ -+ return index; -+} -+EXPORT_SYMBOL(page_cache_next_hole); -+ -+/** -+ * page_cache_prev_hole - find the prev hole (not-present entry) -+ * @mapping: mapping -+ * @index: index -+ * @max_scan: maximum range to search -+ * -+ * Search backwards in the range [max(index-max_scan+1, 0), index] for -+ * the first hole. -+ * -+ * Returns: the index of the hole if found, otherwise returns an index -+ * outside of the set specified (in which case 'index - return >= -+ * max_scan' will be true). In rare cases of wrap-around, ULONG_MAX -+ * will be returned. -+ * -+ * page_cache_prev_hole may be called under rcu_read_lock. However, -+ * like radix_tree_gang_lookup, this will not atomically search a -+ * snapshot of the tree at a single point in time. For example, if a -+ * hole is created at index 10, then subsequently a hole is created at -+ * index 5, page_cache_prev_hole covering both indexes may return 5 if -+ * called under rcu_read_lock. -+ */ -+pgoff_t page_cache_prev_hole(struct address_space *mapping, -+ pgoff_t index, unsigned long max_scan) -+{ -+ unsigned long i; -+ -+ for (i = 0; i < max_scan; i++) { -+ struct page *page; -+ -+ page = radix_tree_lookup(&mapping->page_tree, index); -+ if (!page || radix_tree_exceptional_entry(page)) -+ break; -+ index--; -+ if (index == ULONG_MAX) -+ break; -+ } -+ -+ return index; -+} -+EXPORT_SYMBOL(page_cache_prev_hole); -+ -+/** -+ * find_get_entry - find and get a page cache entry - * @mapping: the address_space to search -- * @offset: the page index -+ * @offset: the page cache index - * -- * Is there a pagecache struct page at the given (mapping, offset) tuple? -- * If yes, increment its refcount and return it; if no, return NULL. -+ * Looks up the page cache slot at @mapping & @offset. If there is a -+ * page cache page, it is returned with an increased refcount. -+ * -+ * If the slot holds a shadow entry of a previously evicted page, it -+ * is returned. -+ * -+ * Otherwise, %NULL is returned. - */ --struct page *find_get_page(struct address_space *mapping, pgoff_t offset) -+struct page *find_get_entry(struct address_space *mapping, pgoff_t offset) - { - void **pagep; - struct page *page; -@@ -736,24 +845,50 @@ out: - - return page; - } --EXPORT_SYMBOL(find_get_page); -+EXPORT_SYMBOL(find_get_entry); - - /** -- * find_lock_page - locate, pin and lock a pagecache page -+ * find_get_page - find and get a page reference - * @mapping: the address_space to search - * @offset: the page index - * -- * Locates the desired pagecache page, locks it, increments its reference -- * count and returns its address. -+ * Looks up the page cache slot at @mapping & @offset. If there is a -+ * page cache page, it is returned with an increased refcount. - * -- * Returns zero if the page was not present. find_lock_page() may sleep. -+ * Otherwise, %NULL is returned. - */ --struct page *find_lock_page(struct address_space *mapping, pgoff_t offset) -+struct page *find_get_page(struct address_space *mapping, pgoff_t offset) -+{ -+ struct page *page = find_get_entry(mapping, offset); -+ -+ if (radix_tree_exceptional_entry(page)) -+ page = NULL; -+ return page; -+} -+EXPORT_SYMBOL(find_get_page); -+ -+/** -+ * find_lock_entry - locate, pin and lock a page cache entry -+ * @mapping: the address_space to search -+ * @offset: the page cache index -+ * -+ * Looks up the page cache slot at @mapping & @offset. If there is a -+ * page cache page, it is returned locked and with an increased -+ * refcount. -+ * -+ * If the slot holds a shadow entry of a previously evicted page, it -+ * is returned. -+ * -+ * Otherwise, %NULL is returned. -+ * -+ * find_lock_entry() may sleep. -+ */ -+struct page *find_lock_entry(struct address_space *mapping, pgoff_t offset) - { - struct page *page; - - repeat: -- page = find_get_page(mapping, offset); -+ page = find_get_entry(mapping, offset); - if (page && !radix_tree_exception(page)) { - lock_page(page); - /* Has the page been truncated? */ -@@ -766,6 +901,29 @@ repeat: - } - return page; - } -+EXPORT_SYMBOL(find_lock_entry); -+ -+/** -+ * find_lock_page - locate, pin and lock a pagecache page -+ * @mapping: the address_space to search -+ * @offset: the page index -+ * -+ * Looks up the page cache slot at @mapping & @offset. If there is a -+ * page cache page, it is returned locked and with an increased -+ * refcount. -+ * -+ * Otherwise, %NULL is returned. -+ * -+ * find_lock_page() may sleep. -+ */ -+struct page *find_lock_page(struct address_space *mapping, pgoff_t offset) -+{ -+ struct page *page = find_lock_entry(mapping, offset); -+ -+ if (radix_tree_exceptional_entry(page)) -+ page = NULL; -+ return page; -+} - EXPORT_SYMBOL(find_lock_page); - - /** -@@ -774,16 +932,18 @@ EXPORT_SYMBOL(find_lock_page); - * @index: the page's index into the mapping - * @gfp_mask: page allocation mode - * -- * Locates a page in the pagecache. If the page is not present, a new page -- * is allocated using @gfp_mask and is added to the pagecache and to the VM's -- * LRU list. The returned page is locked and has its reference count -- * incremented. -+ * Looks up the page cache slot at @mapping & @offset. If there is a -+ * page cache page, it is returned locked and with an increased -+ * refcount. -+ * -+ * If the page is not present, a new page is allocated using @gfp_mask -+ * and added to the page cache and the VM's LRU list. The page is -+ * returned locked and with an increased refcount. - * -- * find_or_create_page() may sleep, even if @gfp_flags specifies an atomic -- * allocation! -+ * On memory exhaustion, %NULL is returned. - * -- * find_or_create_page() returns the desired page's address, or zero on -- * memory exhaustion. -+ * find_or_create_page() may sleep, even if @gfp_flags specifies an -+ * atomic allocation! - */ - struct page *find_or_create_page(struct address_space *mapping, - pgoff_t index, gfp_t gfp_mask) -@@ -816,6 +976,76 @@ repeat: - EXPORT_SYMBOL(find_or_create_page); - - /** -+ * find_get_entries - gang pagecache lookup -+ * @mapping: The address_space to search -+ * @start: The starting page cache index -+ * @nr_entries: The maximum number of entries -+ * @entries: Where the resulting entries are placed -+ * @indices: The cache indices corresponding to the entries in @entries -+ * -+ * find_get_entries() will search for and return a group of up to -+ * @nr_entries entries in the mapping. The entries are placed at -+ * @entries. find_get_entries() takes a reference against any actual -+ * pages it returns. -+ * -+ * The search returns a group of mapping-contiguous page cache entries -+ * with ascending indexes. There may be holes in the indices due to -+ * not-present pages. -+ * -+ * Any shadow entries of evicted pages are included in the returned -+ * array. -+ * -+ * find_get_entries() returns the number of pages and shadow entries -+ * which were found. -+ */ -+unsigned find_get_entries(struct address_space *mapping, -+ pgoff_t start, unsigned int nr_entries, -+ struct page **entries, pgoff_t *indices) -+{ -+ void **slot; -+ unsigned int ret = 0; -+ struct radix_tree_iter iter; -+ -+ if (!nr_entries) -+ return 0; -+ -+ rcu_read_lock(); -+restart: -+ radix_tree_for_each_slot(slot, &mapping->page_tree, &iter, start) { -+ struct page *page; -+repeat: -+ page = radix_tree_deref_slot(slot); -+ if (unlikely(!page)) -+ continue; -+ if (radix_tree_exception(page)) { -+ if (radix_tree_deref_retry(page)) -+ goto restart; -+ /* -+ * Otherwise, we must be storing a swap entry -+ * here as an exceptional entry: so return it -+ * without attempting to raise page count. -+ */ -+ goto export; -+ } -+ if (!page_cache_get_speculative(page)) -+ goto repeat; -+ -+ /* Has the page moved? */ -+ if (unlikely(page != *slot)) { -+ page_cache_release(page); -+ goto repeat; -+ } -+export: -+ indices[ret] = iter.index; -+ entries[ret] = page; -+ if (++ret == nr_entries) -+ break; -+ } -+ rcu_read_unlock(); -+ return ret; -+} -+ -+/** - * find_get_pages - gang pagecache lookup - * @mapping: The address_space to search - * @start: The starting page index -@@ -1797,6 +2027,18 @@ int generic_file_readonly_mmap(struct file * file, struct vm_area_struct * vma) - EXPORT_SYMBOL(generic_file_mmap); - EXPORT_SYMBOL(generic_file_readonly_mmap); - -+static struct page *wait_on_page_read(struct page *page) -+{ -+ if (!IS_ERR(page)) { -+ wait_on_page_locked(page); -+ if (!PageUptodate(page)) { -+ page_cache_release(page); -+ page = ERR_PTR(-EIO); -+ } -+ } -+ return page; -+} -+ - static struct page *__read_cache_page(struct address_space *mapping, - pgoff_t index, - int (*filler)(void *, struct page *), -@@ -1823,6 +2065,8 @@ repeat: - if (err < 0) { - page_cache_release(page); - page = ERR_PTR(err); -+ } else { -+ page = wait_on_page_read(page); - } - } - return page; -@@ -1859,6 +2103,10 @@ retry: - if (err < 0) { - page_cache_release(page); - return ERR_PTR(err); -+ } else { -+ page = wait_on_page_read(page); -+ if (IS_ERR(page)) -+ return page; - } - out: - mark_page_accessed(page); -@@ -1866,40 +2114,25 @@ out: - } - - /** -- * read_cache_page_async - read into page cache, fill it if needed -+ * read_cache_page - read into page cache, fill it if needed - * @mapping: the page's address_space - * @index: the page index - * @filler: function to perform the read - * @data: first arg to filler(data, page) function, often left as NULL - * -- * Same as read_cache_page, but don't wait for page to become unlocked -- * after submitting it to the filler. -- * - * Read into the page cache. If a page already exists, and PageUptodate() is -- * not set, try to fill the page but don't wait for it to become unlocked. -+ * not set, try to fill the page and wait for it to become unlocked. - * - * If the page does not get brought uptodate, return -EIO. - */ --struct page *read_cache_page_async(struct address_space *mapping, -+struct page *read_cache_page(struct address_space *mapping, - pgoff_t index, - int (*filler)(void *, struct page *), - void *data) - { - return do_read_cache_page(mapping, index, filler, data, mapping_gfp_mask(mapping)); - } --EXPORT_SYMBOL(read_cache_page_async); -- --static struct page *wait_on_page_read(struct page *page) --{ -- if (!IS_ERR(page)) { -- wait_on_page_locked(page); -- if (!PageUptodate(page)) { -- page_cache_release(page); -- page = ERR_PTR(-EIO); -- } -- } -- return page; --} -+EXPORT_SYMBOL(read_cache_page); - - /** - * read_cache_page_gfp - read into page cache, using specified page allocation flags. -@@ -1918,31 +2151,10 @@ struct page *read_cache_page_gfp(struct address_space *mapping, - { - filler_t *filler = (filler_t *)mapping->a_ops->readpage; - -- return wait_on_page_read(do_read_cache_page(mapping, index, filler, NULL, gfp)); -+ return do_read_cache_page(mapping, index, filler, NULL, gfp); - } - EXPORT_SYMBOL(read_cache_page_gfp); - --/** -- * read_cache_page - read into page cache, fill it if needed -- * @mapping: the page's address_space -- * @index: the page index -- * @filler: function to perform the read -- * @data: first arg to filler(data, page) function, often left as NULL -- * -- * Read into the page cache. If a page already exists, and PageUptodate() is -- * not set, try to fill the page then wait for it to become unlocked. -- * -- * If the page does not get brought uptodate, return -EIO. -- */ --struct page *read_cache_page(struct address_space *mapping, -- pgoff_t index, -- int (*filler)(void *, struct page *), -- void *data) --{ -- return wait_on_page_read(read_cache_page_async(mapping, index, filler, data)); --} --EXPORT_SYMBOL(read_cache_page); -- - static size_t __iovec_copy_from_user_inatomic(char *vaddr, - const struct iovec *iov, size_t base, size_t bytes) - { -@@ -1976,7 +2188,6 @@ size_t iov_iter_copy_from_user_atomic(struct page *page, - char *kaddr; - size_t copied; - -- BUG_ON(!in_atomic()); - kaddr = kmap_atomic(page); - if (likely(i->nr_segs == 1)) { - int left; -@@ -2350,9 +2561,7 @@ again: - if (mapping_writably_mapped(mapping)) - flush_dcache_page(page); - -- pagefault_disable(); - copied = iov_iter_copy_from_user_atomic(page, i, offset, bytes); -- pagefault_enable(); - flush_dcache_page(page); - - mark_page_accessed(page); -diff --git a/mm/internal.h b/mm/internal.h -index 3e910000fda4..1a8a0d4b687a 100644 ---- a/mm/internal.h -+++ b/mm/internal.h -@@ -11,6 +11,7 @@ - #ifndef __MM_INTERNAL_H - #define __MM_INTERNAL_H - -+#include <linux/fs.h> - #include <linux/mm.h> - - void free_pgtables(struct mmu_gather *tlb, struct vm_area_struct *start_vma, -@@ -21,6 +22,20 @@ static inline void set_page_count(struct page *page, int v) - atomic_set(&page->_count, v); - } - -+extern int __do_page_cache_readahead(struct address_space *mapping, -+ struct file *filp, pgoff_t offset, unsigned long nr_to_read, -+ unsigned long lookahead_size); -+ -+/* -+ * Submit IO for the read-ahead request in file_ra_state. -+ */ -+static inline unsigned long ra_submit(struct file_ra_state *ra, -+ struct address_space *mapping, struct file *filp) -+{ -+ return __do_page_cache_readahead(mapping, filp, -+ ra->start, ra->size, ra->async_size); -+} -+ - /* - * Turn a non-refcounted page (->_count == 0) into refcounted with - * a count of one. -@@ -119,7 +134,7 @@ struct compact_control { - unsigned long nr_migratepages; /* Number of pages to migrate */ - unsigned long free_pfn; /* isolate_freepages search base */ - unsigned long migrate_pfn; /* isolate_migratepages search base */ -- bool sync; /* Synchronous migration */ -+ enum migrate_mode mode; /* Async or sync migration mode */ - bool ignore_skip_hint; /* Scan blocks even if marked skip */ - bool finished_update_free; /* True when the zone cached pfns are - * no longer being updated -@@ -129,7 +144,10 @@ struct compact_control { - int order; /* order a direct compactor needs */ - int migratetype; /* MOVABLE, RECLAIMABLE etc */ - struct zone *zone; -- bool contended; /* True if a lock was contended */ -+ bool contended; /* True if a lock was contended, or -+ * need_resched() true during async -+ * compaction -+ */ - }; - - unsigned long -diff --git a/mm/madvise.c b/mm/madvise.c -index 539eeb96b323..a402f8fdc68e 100644 ---- a/mm/madvise.c -+++ b/mm/madvise.c -@@ -195,7 +195,7 @@ static void force_shm_swapin_readahead(struct vm_area_struct *vma, - for (; start < end; start += PAGE_SIZE) { - index = ((start - vma->vm_start) >> PAGE_SHIFT) + vma->vm_pgoff; - -- page = find_get_page(mapping, index); -+ page = find_get_entry(mapping, index); - if (!radix_tree_exceptional_entry(page)) { - if (page) - page_cache_release(page); -diff --git a/mm/memory-failure.c b/mm/memory-failure.c -index 33365e9ce6a7..a98c7fce470a 100644 ---- a/mm/memory-failure.c -+++ b/mm/memory-failure.c -@@ -1540,7 +1540,7 @@ static int soft_offline_huge_page(struct page *page, int flags) - - /* Keep page count to indicate a given hugepage is isolated. */ - list_move(&hpage->lru, &pagelist); -- ret = migrate_pages(&pagelist, new_page, MPOL_MF_MOVE_ALL, -+ ret = migrate_pages(&pagelist, new_page, NULL, MPOL_MF_MOVE_ALL, - MIGRATE_SYNC, MR_MEMORY_FAILURE); - if (ret) { - pr_info("soft offline: %#lx: migration failed %d, type %lx\n", -@@ -1621,7 +1621,7 @@ static int __soft_offline_page(struct page *page, int flags) - inc_zone_page_state(page, NR_ISOLATED_ANON + - page_is_file_cache(page)); - list_add(&page->lru, &pagelist); -- ret = migrate_pages(&pagelist, new_page, MPOL_MF_MOVE_ALL, -+ ret = migrate_pages(&pagelist, new_page, NULL, MPOL_MF_MOVE_ALL, - MIGRATE_SYNC, MR_MEMORY_FAILURE); - if (ret) { - if (!list_empty(&pagelist)) { -diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c -index a650db29606f..f6f23833de44 100644 ---- a/mm/memory_hotplug.c -+++ b/mm/memory_hotplug.c -@@ -1332,7 +1332,7 @@ do_migrate_range(unsigned long start_pfn, unsigned long end_pfn) - * alloc_migrate_target should be improooooved!! - * migrate_pages returns # of failed pages. - */ -- ret = migrate_pages(&source, alloc_migrate_target, 0, -+ ret = migrate_pages(&source, alloc_migrate_target, NULL, 0, - MIGRATE_SYNC, MR_MEMORY_HOTPLUG); - if (ret) - putback_movable_pages(&source); -diff --git a/mm/mempolicy.c b/mm/mempolicy.c -index 796c7e6cf93b..e8fff0fa1202 100644 ---- a/mm/mempolicy.c -+++ b/mm/mempolicy.c -@@ -1060,7 +1060,7 @@ static int migrate_to_node(struct mm_struct *mm, int source, int dest, - flags | MPOL_MF_DISCONTIG_OK, &pagelist); - - if (!list_empty(&pagelist)) { -- err = migrate_pages(&pagelist, new_node_page, dest, -+ err = migrate_pages(&pagelist, new_node_page, NULL, dest, - MIGRATE_SYNC, MR_SYSCALL); - if (err) - putback_movable_pages(&pagelist); -@@ -1306,7 +1306,7 @@ static long do_mbind(unsigned long start, unsigned long len, - - if (!list_empty(&pagelist)) { - WARN_ON_ONCE(flags & MPOL_MF_LAZY); -- nr_failed = migrate_pages(&pagelist, new_page, -+ nr_failed = migrate_pages(&pagelist, new_page, NULL, - start, MIGRATE_SYNC, MR_MEMPOLICY_MBIND); - if (nr_failed) - putback_movable_pages(&pagelist); -diff --git a/mm/migrate.c b/mm/migrate.c -index 13f47fbe3550..3acac4a62c4b 100644 ---- a/mm/migrate.c -+++ b/mm/migrate.c -@@ -941,8 +941,9 @@ out: - * Obtain the lock on page, remove all ptes and migrate the page - * to the newly allocated page in newpage. - */ --static int unmap_and_move(new_page_t get_new_page, unsigned long private, -- struct page *page, int force, enum migrate_mode mode) -+static int unmap_and_move(new_page_t get_new_page, free_page_t put_new_page, -+ unsigned long private, struct page *page, int force, -+ enum migrate_mode mode) - { - int rc = 0; - int *result = NULL; -@@ -986,11 +987,18 @@ out: - page_is_file_cache(page)); - putback_lru_page(page); - } -+ - /* -- * Move the new page to the LRU. If migration was not successful -- * then this will free the page. -+ * If migration was not successful and there's a freeing callback, use -+ * it. Otherwise, putback_lru_page() will drop the reference grabbed -+ * during isolation. - */ -- putback_lru_page(newpage); -+ if (rc != MIGRATEPAGE_SUCCESS && put_new_page) { -+ ClearPageSwapBacked(newpage); -+ put_new_page(newpage, private); -+ } else -+ putback_lru_page(newpage); -+ - if (result) { - if (rc) - *result = rc; -@@ -1019,8 +1027,9 @@ out: - * will wait in the page fault for migration to complete. - */ - static int unmap_and_move_huge_page(new_page_t get_new_page, -- unsigned long private, struct page *hpage, -- int force, enum migrate_mode mode) -+ free_page_t put_new_page, unsigned long private, -+ struct page *hpage, int force, -+ enum migrate_mode mode) - { - int rc = 0; - int *result = NULL; -@@ -1059,20 +1068,30 @@ static int unmap_and_move_huge_page(new_page_t get_new_page, - if (!page_mapped(hpage)) - rc = move_to_new_page(new_hpage, hpage, 1, mode); - -- if (rc) -+ if (rc != MIGRATEPAGE_SUCCESS) - remove_migration_ptes(hpage, hpage); - - if (anon_vma) - put_anon_vma(anon_vma); - -- if (!rc) -+ if (rc == MIGRATEPAGE_SUCCESS) - hugetlb_cgroup_migrate(hpage, new_hpage); - - unlock_page(hpage); - out: - if (rc != -EAGAIN) - putback_active_hugepage(hpage); -- put_page(new_hpage); -+ -+ /* -+ * If migration was not successful and there's a freeing callback, use -+ * it. Otherwise, put_page() will drop the reference grabbed during -+ * isolation. -+ */ -+ if (rc != MIGRATEPAGE_SUCCESS && put_new_page) -+ put_new_page(new_hpage, private); -+ else -+ put_page(new_hpage); -+ - if (result) { - if (rc) - *result = rc; -@@ -1089,6 +1108,8 @@ out: - * @from: The list of pages to be migrated. - * @get_new_page: The function used to allocate free pages to be used - * as the target of the page migration. -+ * @put_new_page: The function used to free target pages if migration -+ * fails, or NULL if no special handling is necessary. - * @private: Private data to be passed on to get_new_page() - * @mode: The migration mode that specifies the constraints for - * page migration, if any. -@@ -1102,7 +1123,8 @@ out: - * Returns the number of pages that were not migrated, or an error code. - */ - int migrate_pages(struct list_head *from, new_page_t get_new_page, -- unsigned long private, enum migrate_mode mode, int reason) -+ free_page_t put_new_page, unsigned long private, -+ enum migrate_mode mode, int reason) - { - int retry = 1; - int nr_failed = 0; -@@ -1124,10 +1146,11 @@ int migrate_pages(struct list_head *from, new_page_t get_new_page, - - if (PageHuge(page)) - rc = unmap_and_move_huge_page(get_new_page, -- private, page, pass > 2, mode); -+ put_new_page, private, page, -+ pass > 2, mode); - else -- rc = unmap_and_move(get_new_page, private, -- page, pass > 2, mode); -+ rc = unmap_and_move(get_new_page, put_new_page, -+ private, page, pass > 2, mode); - - switch(rc) { - case -ENOMEM: -@@ -1276,7 +1299,7 @@ set_status: - - err = 0; - if (!list_empty(&pagelist)) { -- err = migrate_pages(&pagelist, new_page_node, -+ err = migrate_pages(&pagelist, new_page_node, NULL, - (unsigned long)pm, MIGRATE_SYNC, MR_SYSCALL); - if (err) - putback_movable_pages(&pagelist); -@@ -1732,7 +1755,8 @@ int migrate_misplaced_page(struct page *page, struct vm_area_struct *vma, - - list_add(&page->lru, &migratepages); - nr_remaining = migrate_pages(&migratepages, alloc_misplaced_dst_page, -- node, MIGRATE_ASYNC, MR_NUMA_MISPLACED); -+ NULL, node, MIGRATE_ASYNC, -+ MR_NUMA_MISPLACED); - if (nr_remaining) { - if (!list_empty(&migratepages)) { - list_del(&page->lru); -diff --git a/mm/mincore.c b/mm/mincore.c -index 101623378fbf..725c80961048 100644 ---- a/mm/mincore.c -+++ b/mm/mincore.c -@@ -70,13 +70,21 @@ static unsigned char mincore_page(struct address_space *mapping, pgoff_t pgoff) - * any other file mapping (ie. marked !present and faulted in with - * tmpfs's .fault). So swapped out tmpfs mappings are tested here. - */ -- page = find_get_page(mapping, pgoff); - #ifdef CONFIG_SWAP -- /* shmem/tmpfs may return swap: account for swapcache page too. */ -- if (radix_tree_exceptional_entry(page)) { -- swp_entry_t swap = radix_to_swp_entry(page); -- page = find_get_page(swap_address_space(swap), swap.val); -- } -+ if (shmem_mapping(mapping)) { -+ page = find_get_entry(mapping, pgoff); -+ /* -+ * shmem/tmpfs may return swap: account for swapcache -+ * page too. -+ */ -+ if (radix_tree_exceptional_entry(page)) { -+ swp_entry_t swp = radix_to_swp_entry(page); -+ page = find_get_page(swap_address_space(swp), swp.val); -+ } -+ } else -+ page = find_get_page(mapping, pgoff); -+#else -+ page = find_get_page(mapping, pgoff); - #endif - if (page) { - present = PageUptodate(page); -diff --git a/mm/page_alloc.c b/mm/page_alloc.c -index 7b2611a055a7..4b258297cc7c 100644 ---- a/mm/page_alloc.c -+++ b/mm/page_alloc.c -@@ -943,6 +943,7 @@ struct page *__rmqueue_smallest(struct zone *zone, unsigned int order, - rmv_page_order(page); - area->nr_free--; - expand(zone, page, order, current_order, area, migratetype); -+ set_freepage_migratetype(page, migratetype); - return page; - } - -@@ -1069,7 +1070,9 @@ static int try_to_steal_freepages(struct zone *zone, struct page *page, - - /* - * When borrowing from MIGRATE_CMA, we need to release the excess -- * buddy pages to CMA itself. -+ * buddy pages to CMA itself. We also ensure the freepage_migratetype -+ * is set to CMA so it is returned to the correct freelist in case -+ * the page ends up being not actually allocated from the pcp lists. - */ - if (is_migrate_cma(fallback_type)) - return fallback_type; -@@ -1137,6 +1140,12 @@ __rmqueue_fallback(struct zone *zone, int order, int start_migratetype) - - expand(zone, page, order, current_order, area, - new_type); -+ /* The freepage_migratetype may differ from pageblock's -+ * migratetype depending on the decisions in -+ * try_to_steal_freepages. This is OK as long as it does -+ * not differ for MIGRATE_CMA type. -+ */ -+ set_freepage_migratetype(page, new_type); - - trace_mm_page_alloc_extfrag(page, order, current_order, - start_migratetype, migratetype, new_type); -@@ -1187,7 +1196,7 @@ static int rmqueue_bulk(struct zone *zone, unsigned int order, - unsigned long count, struct list_head *list, - int migratetype, int cold) - { -- int mt = migratetype, i; -+ int i; - - spin_lock(&zone->lock); - for (i = 0; i < count; ++i) { -@@ -1208,14 +1217,8 @@ static int rmqueue_bulk(struct zone *zone, unsigned int order, - list_add(&page->lru, list); - else - list_add_tail(&page->lru, list); -- if (IS_ENABLED(CONFIG_CMA)) { -- mt = get_pageblock_migratetype(page); -- if (!is_migrate_cma(mt) && !is_migrate_isolate(mt)) -- mt = migratetype; -- } -- set_freepage_migratetype(page, mt); - list = &page->lru; -- if (is_migrate_cma(mt)) -+ if (is_migrate_cma(get_freepage_migratetype(page))) - __mod_zone_page_state(zone, NR_FREE_CMA_PAGES, - -(1 << order)); - } -@@ -1584,7 +1587,7 @@ again: - if (!page) - goto failed; - __mod_zone_freepage_state(zone, -(1 << order), -- get_pageblock_migratetype(page)); -+ get_freepage_migratetype(page)); - } - - __mod_zone_page_state(zone, NR_ALLOC_BATCH, -(1 << order)); -@@ -2246,7 +2249,7 @@ static struct page * - __alloc_pages_direct_compact(gfp_t gfp_mask, unsigned int order, - struct zonelist *zonelist, enum zone_type high_zoneidx, - nodemask_t *nodemask, int alloc_flags, struct zone *preferred_zone, -- int migratetype, bool sync_migration, -+ int migratetype, enum migrate_mode mode, - bool *contended_compaction, bool *deferred_compaction, - unsigned long *did_some_progress) - { -@@ -2260,7 +2263,7 @@ __alloc_pages_direct_compact(gfp_t gfp_mask, unsigned int order, - - current->flags |= PF_MEMALLOC; - *did_some_progress = try_to_compact_pages(zonelist, order, gfp_mask, -- nodemask, sync_migration, -+ nodemask, mode, - contended_compaction); - current->flags &= ~PF_MEMALLOC; - -@@ -2293,7 +2296,7 @@ __alloc_pages_direct_compact(gfp_t gfp_mask, unsigned int order, - * As async compaction considers a subset of pageblocks, only - * defer if the failure was a sync compaction failure. - */ -- if (sync_migration) -+ if (mode != MIGRATE_ASYNC) - defer_compaction(preferred_zone, order); - - cond_resched(); -@@ -2306,9 +2309,8 @@ static inline struct page * - __alloc_pages_direct_compact(gfp_t gfp_mask, unsigned int order, - struct zonelist *zonelist, enum zone_type high_zoneidx, - nodemask_t *nodemask, int alloc_flags, struct zone *preferred_zone, -- int migratetype, bool sync_migration, -- bool *contended_compaction, bool *deferred_compaction, -- unsigned long *did_some_progress) -+ int migratetype, enum migrate_mode mode, bool *contended_compaction, -+ bool *deferred_compaction, unsigned long *did_some_progress) - { - return NULL; - } -@@ -2503,7 +2505,7 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order, - int alloc_flags; - unsigned long pages_reclaimed = 0; - unsigned long did_some_progress; -- bool sync_migration = false; -+ enum migrate_mode migration_mode = MIGRATE_ASYNC; - bool deferred_compaction = false; - bool contended_compaction = false; - -@@ -2597,17 +2599,15 @@ rebalance: - * Try direct compaction. The first pass is asynchronous. Subsequent - * attempts after direct reclaim are synchronous - */ -- page = __alloc_pages_direct_compact(gfp_mask, order, -- zonelist, high_zoneidx, -- nodemask, -- alloc_flags, preferred_zone, -- migratetype, sync_migration, -- &contended_compaction, -+ page = __alloc_pages_direct_compact(gfp_mask, order, zonelist, -+ high_zoneidx, nodemask, alloc_flags, -+ preferred_zone, migratetype, -+ migration_mode, &contended_compaction, - &deferred_compaction, - &did_some_progress); - if (page) - goto got_pg; -- sync_migration = true; -+ migration_mode = MIGRATE_SYNC_LIGHT; - - /* - * If compaction is deferred for high-order allocations, it is because -@@ -2682,12 +2682,10 @@ rebalance: - * direct reclaim and reclaim/compaction depends on compaction - * being called after reclaim so call directly if necessary - */ -- page = __alloc_pages_direct_compact(gfp_mask, order, -- zonelist, high_zoneidx, -- nodemask, -- alloc_flags, preferred_zone, -- migratetype, sync_migration, -- &contended_compaction, -+ page = __alloc_pages_direct_compact(gfp_mask, order, zonelist, -+ high_zoneidx, nodemask, alloc_flags, -+ preferred_zone, migratetype, -+ migration_mode, &contended_compaction, - &deferred_compaction, - &did_some_progress); - if (page) -@@ -6261,7 +6259,7 @@ static int __alloc_contig_migrate_range(struct compact_control *cc, - cc->nr_migratepages -= nr_reclaimed; - - ret = migrate_pages(&cc->migratepages, alloc_migrate_target, -- 0, MIGRATE_SYNC, MR_CMA); -+ NULL, 0, cc->mode, MR_CMA); - } - if (ret < 0) { - putback_movable_pages(&cc->migratepages); -@@ -6300,7 +6298,7 @@ int alloc_contig_range(unsigned long start, unsigned long end, - .nr_migratepages = 0, - .order = -1, - .zone = page_zone(pfn_to_page(start)), -- .sync = true, -+ .mode = MIGRATE_SYNC, - .ignore_skip_hint = true, - }; - INIT_LIST_HEAD(&cc.migratepages); -diff --git a/mm/readahead.c b/mm/readahead.c -index 1fa0d6fca556..0ca36a7770b1 100644 ---- a/mm/readahead.c -+++ b/mm/readahead.c -@@ -8,9 +8,7 @@ - */ - - #include <linux/kernel.h> --#include <linux/fs.h> - #include <linux/gfp.h> --#include <linux/mm.h> - #include <linux/export.h> - #include <linux/blkdev.h> - #include <linux/backing-dev.h> -@@ -20,6 +18,8 @@ - #include <linux/syscalls.h> - #include <linux/file.h> - -+#include "internal.h" -+ - /* - * Initialise a struct file's readahead state. Assumes that the caller has - * memset *ra to zero. -@@ -149,8 +149,7 @@ out: - * - * Returns the number of pages requested, or the maximum amount of I/O allowed. - */ --static int --__do_page_cache_readahead(struct address_space *mapping, struct file *filp, -+int __do_page_cache_readahead(struct address_space *mapping, struct file *filp, - pgoff_t offset, unsigned long nr_to_read, - unsigned long lookahead_size) - { -@@ -179,7 +178,7 @@ __do_page_cache_readahead(struct address_space *mapping, struct file *filp, - rcu_read_lock(); - page = radix_tree_lookup(&mapping->page_tree, page_offset); - rcu_read_unlock(); -- if (page) -+ if (page && !radix_tree_exceptional_entry(page)) - continue; - - page = page_cache_alloc_readahead(mapping); -@@ -244,20 +243,6 @@ unsigned long max_sane_readahead(unsigned long nr) - } - - /* -- * Submit IO for the read-ahead request in file_ra_state. -- */ --unsigned long ra_submit(struct file_ra_state *ra, -- struct address_space *mapping, struct file *filp) --{ -- int actual; -- -- actual = __do_page_cache_readahead(mapping, filp, -- ra->start, ra->size, ra->async_size); -- -- return actual; --} -- --/* - * Set the initial window size, round to next power of 2 and square - * for small size, x 4 for medium, and x 2 for large - * for 128k (32 page) max ra -@@ -347,7 +332,7 @@ static pgoff_t count_history_pages(struct address_space *mapping, - pgoff_t head; - - rcu_read_lock(); -- head = radix_tree_prev_hole(&mapping->page_tree, offset - 1, max); -+ head = page_cache_prev_hole(mapping, offset - 1, max); - rcu_read_unlock(); - - return offset - 1 - head; -@@ -427,7 +412,7 @@ ondemand_readahead(struct address_space *mapping, - pgoff_t start; - - rcu_read_lock(); -- start = radix_tree_next_hole(&mapping->page_tree, offset+1,max); -+ start = page_cache_next_hole(mapping, offset + 1, max); - rcu_read_unlock(); - - if (!start || start - offset > max) -diff --git a/mm/shmem.c b/mm/shmem.c -index f0d698ba7d0f..0f1447563f17 100644 ---- a/mm/shmem.c -+++ b/mm/shmem.c -@@ -243,19 +243,17 @@ static int shmem_radix_tree_replace(struct address_space *mapping, - pgoff_t index, void *expected, void *replacement) - { - void **pslot; -- void *item = NULL; -+ void *item; - - VM_BUG_ON(!expected); -+ VM_BUG_ON(!replacement); - pslot = radix_tree_lookup_slot(&mapping->page_tree, index); -- if (pslot) -- item = radix_tree_deref_slot_protected(pslot, -- &mapping->tree_lock); -+ if (!pslot) -+ return -ENOENT; -+ item = radix_tree_deref_slot_protected(pslot, &mapping->tree_lock); - if (item != expected) - return -ENOENT; -- if (replacement) -- radix_tree_replace_slot(pslot, replacement); -- else -- radix_tree_delete(&mapping->page_tree, index); -+ radix_tree_replace_slot(pslot, replacement); - return 0; - } - -@@ -332,84 +330,20 @@ static void shmem_delete_from_page_cache(struct page *page, void *radswap) - } - - /* -- * Like find_get_pages, but collecting swap entries as well as pages. -- */ --static unsigned shmem_find_get_pages_and_swap(struct address_space *mapping, -- pgoff_t start, unsigned int nr_pages, -- struct page **pages, pgoff_t *indices) --{ -- void **slot; -- unsigned int ret = 0; -- struct radix_tree_iter iter; -- -- if (!nr_pages) -- return 0; -- -- rcu_read_lock(); --restart: -- radix_tree_for_each_slot(slot, &mapping->page_tree, &iter, start) { -- struct page *page; --repeat: -- page = radix_tree_deref_slot(slot); -- if (unlikely(!page)) -- continue; -- if (radix_tree_exception(page)) { -- if (radix_tree_deref_retry(page)) -- goto restart; -- /* -- * Otherwise, we must be storing a swap entry -- * here as an exceptional entry: so return it -- * without attempting to raise page count. -- */ -- goto export; -- } -- if (!page_cache_get_speculative(page)) -- goto repeat; -- -- /* Has the page moved? */ -- if (unlikely(page != *slot)) { -- page_cache_release(page); -- goto repeat; -- } --export: -- indices[ret] = iter.index; -- pages[ret] = page; -- if (++ret == nr_pages) -- break; -- } -- rcu_read_unlock(); -- return ret; --} -- --/* - * Remove swap entry from radix tree, free the swap and its page cache. - */ - static int shmem_free_swap(struct address_space *mapping, - pgoff_t index, void *radswap) - { -- int error; -+ void *old; - - spin_lock_irq(&mapping->tree_lock); -- error = shmem_radix_tree_replace(mapping, index, radswap, NULL); -+ old = radix_tree_delete_item(&mapping->page_tree, index, radswap); - spin_unlock_irq(&mapping->tree_lock); -- if (!error) -- free_swap_and_cache(radix_to_swp_entry(radswap)); -- return error; --} -- --/* -- * Pagevec may contain swap entries, so shuffle up pages before releasing. -- */ --static void shmem_deswap_pagevec(struct pagevec *pvec) --{ -- int i, j; -- -- for (i = 0, j = 0; i < pagevec_count(pvec); i++) { -- struct page *page = pvec->pages[i]; -- if (!radix_tree_exceptional_entry(page)) -- pvec->pages[j++] = page; -- } -- pvec->nr = j; -+ if (old != radswap) -+ return -ENOENT; -+ free_swap_and_cache(radix_to_swp_entry(radswap)); -+ return 0; - } - - /* -@@ -430,12 +364,12 @@ void shmem_unlock_mapping(struct address_space *mapping) - * Avoid pagevec_lookup(): find_get_pages() returns 0 as if it - * has finished, if it hits a row of PAGEVEC_SIZE swap entries. - */ -- pvec.nr = shmem_find_get_pages_and_swap(mapping, index, -- PAGEVEC_SIZE, pvec.pages, indices); -+ pvec.nr = find_get_entries(mapping, index, -+ PAGEVEC_SIZE, pvec.pages, indices); - if (!pvec.nr) - break; - index = indices[pvec.nr - 1] + 1; -- shmem_deswap_pagevec(&pvec); -+ pagevec_remove_exceptionals(&pvec); - check_move_unevictable_pages(pvec.pages, pvec.nr); - pagevec_release(&pvec); - cond_resched(); -@@ -467,9 +401,9 @@ static void shmem_undo_range(struct inode *inode, loff_t lstart, loff_t lend, - pagevec_init(&pvec, 0); - index = start; - while (index < end) { -- pvec.nr = shmem_find_get_pages_and_swap(mapping, index, -- min(end - index, (pgoff_t)PAGEVEC_SIZE), -- pvec.pages, indices); -+ pvec.nr = find_get_entries(mapping, index, -+ min(end - index, (pgoff_t)PAGEVEC_SIZE), -+ pvec.pages, indices); - if (!pvec.nr) - break; - mem_cgroup_uncharge_start(); -@@ -498,7 +432,7 @@ static void shmem_undo_range(struct inode *inode, loff_t lstart, loff_t lend, - } - unlock_page(page); - } -- shmem_deswap_pagevec(&pvec); -+ pagevec_remove_exceptionals(&pvec); - pagevec_release(&pvec); - mem_cgroup_uncharge_end(); - cond_resched(); -@@ -536,9 +470,10 @@ static void shmem_undo_range(struct inode *inode, loff_t lstart, loff_t lend, - index = start; - while (index < end) { - cond_resched(); -- pvec.nr = shmem_find_get_pages_and_swap(mapping, index, -+ -+ pvec.nr = find_get_entries(mapping, index, - min(end - index, (pgoff_t)PAGEVEC_SIZE), -- pvec.pages, indices); -+ pvec.pages, indices); - if (!pvec.nr) { - /* If all gone or hole-punch or unfalloc, we're done */ - if (index == start || end != -1) -@@ -581,7 +516,7 @@ static void shmem_undo_range(struct inode *inode, loff_t lstart, loff_t lend, - } - unlock_page(page); - } -- shmem_deswap_pagevec(&pvec); -+ pagevec_remove_exceptionals(&pvec); - pagevec_release(&pvec); - mem_cgroup_uncharge_end(); - index++; -@@ -1088,7 +1023,7 @@ static int shmem_getpage_gfp(struct inode *inode, pgoff_t index, - return -EFBIG; - repeat: - swap.val = 0; -- page = find_lock_page(mapping, index); -+ page = find_lock_entry(mapping, index); - if (radix_tree_exceptional_entry(page)) { - swap = radix_to_swp_entry(page); - page = NULL; -@@ -1483,6 +1418,11 @@ static struct inode *shmem_get_inode(struct super_block *sb, const struct inode - return inode; - } - -+bool shmem_mapping(struct address_space *mapping) -+{ -+ return mapping->backing_dev_info == &shmem_backing_dev_info; -+} -+ - #ifdef CONFIG_TMPFS - static const struct inode_operations shmem_symlink_inode_operations; - static const struct inode_operations shmem_short_symlink_operations; -@@ -1795,7 +1735,7 @@ static pgoff_t shmem_seek_hole_data(struct address_space *mapping, - pagevec_init(&pvec, 0); - pvec.nr = 1; /* start small: we may be there already */ - while (!done) { -- pvec.nr = shmem_find_get_pages_and_swap(mapping, index, -+ pvec.nr = find_get_entries(mapping, index, - pvec.nr, pvec.pages, indices); - if (!pvec.nr) { - if (whence == SEEK_DATA) -@@ -1822,7 +1762,7 @@ static pgoff_t shmem_seek_hole_data(struct address_space *mapping, - break; - } - } -- shmem_deswap_pagevec(&pvec); -+ pagevec_remove_exceptionals(&pvec); - pagevec_release(&pvec); - pvec.nr = PAGEVEC_SIZE; - cond_resched(); -diff --git a/mm/swap.c b/mm/swap.c -index 0092097b3f4c..c8048d71c642 100644 ---- a/mm/swap.c -+++ b/mm/swap.c -@@ -948,6 +948,57 @@ void __pagevec_lru_add(struct pagevec *pvec) - EXPORT_SYMBOL(__pagevec_lru_add); - - /** -+ * pagevec_lookup_entries - gang pagecache lookup -+ * @pvec: Where the resulting entries are placed -+ * @mapping: The address_space to search -+ * @start: The starting entry index -+ * @nr_entries: The maximum number of entries -+ * @indices: The cache indices corresponding to the entries in @pvec -+ * -+ * pagevec_lookup_entries() will search for and return a group of up -+ * to @nr_entries pages and shadow entries in the mapping. All -+ * entries are placed in @pvec. pagevec_lookup_entries() takes a -+ * reference against actual pages in @pvec. -+ * -+ * The search returns a group of mapping-contiguous entries with -+ * ascending indexes. There may be holes in the indices due to -+ * not-present entries. -+ * -+ * pagevec_lookup_entries() returns the number of entries which were -+ * found. -+ */ -+unsigned pagevec_lookup_entries(struct pagevec *pvec, -+ struct address_space *mapping, -+ pgoff_t start, unsigned nr_pages, -+ pgoff_t *indices) -+{ -+ pvec->nr = find_get_entries(mapping, start, nr_pages, -+ pvec->pages, indices); -+ return pagevec_count(pvec); -+} -+ -+/** -+ * pagevec_remove_exceptionals - pagevec exceptionals pruning -+ * @pvec: The pagevec to prune -+ * -+ * pagevec_lookup_entries() fills both pages and exceptional radix -+ * tree entries into the pagevec. This function prunes all -+ * exceptionals from @pvec without leaving holes, so that it can be -+ * passed on to page-only pagevec operations. -+ */ -+void pagevec_remove_exceptionals(struct pagevec *pvec) -+{ -+ int i, j; -+ -+ for (i = 0, j = 0; i < pagevec_count(pvec); i++) { -+ struct page *page = pvec->pages[i]; -+ if (!radix_tree_exceptional_entry(page)) -+ pvec->pages[j++] = page; -+ } -+ pvec->nr = j; -+} -+ -+/** - * pagevec_lookup - gang pagecache lookup - * @pvec: Where the resulting pages are placed - * @mapping: The address_space to search -diff --git a/mm/truncate.c b/mm/truncate.c -index ac18edc30649..827ad8d2b5cd 100644 ---- a/mm/truncate.c -+++ b/mm/truncate.c -@@ -23,6 +23,22 @@ - #include <linux/rmap.h> - #include "internal.h" - -+static void clear_exceptional_entry(struct address_space *mapping, -+ pgoff_t index, void *entry) -+{ -+ /* Handled by shmem itself */ -+ if (shmem_mapping(mapping)) -+ return; -+ -+ spin_lock_irq(&mapping->tree_lock); -+ /* -+ * Regular page slots are stabilized by the page lock even -+ * without the tree itself locked. These unlocked entries -+ * need verification under the tree lock. -+ */ -+ radix_tree_delete_item(&mapping->page_tree, index, entry); -+ spin_unlock_irq(&mapping->tree_lock); -+} - - /** - * do_invalidatepage - invalidate part or all of a page -@@ -209,6 +225,7 @@ void truncate_inode_pages_range(struct address_space *mapping, - unsigned int partial_start; /* inclusive */ - unsigned int partial_end; /* exclusive */ - struct pagevec pvec; -+ pgoff_t indices[PAGEVEC_SIZE]; - pgoff_t index; - int i; - -@@ -239,17 +256,23 @@ void truncate_inode_pages_range(struct address_space *mapping, - - pagevec_init(&pvec, 0); - index = start; -- while (index < end && pagevec_lookup(&pvec, mapping, index, -- min(end - index, (pgoff_t)PAGEVEC_SIZE))) { -+ while (index < end && pagevec_lookup_entries(&pvec, mapping, index, -+ min(end - index, (pgoff_t)PAGEVEC_SIZE), -+ indices)) { - mem_cgroup_uncharge_start(); - for (i = 0; i < pagevec_count(&pvec); i++) { - struct page *page = pvec.pages[i]; - - /* We rely upon deletion not changing page->index */ -- index = page->index; -+ index = indices[i]; - if (index >= end) - break; - -+ if (radix_tree_exceptional_entry(page)) { -+ clear_exceptional_entry(mapping, index, page); -+ continue; -+ } -+ - if (!trylock_page(page)) - continue; - WARN_ON(page->index != index); -@@ -260,6 +283,7 @@ void truncate_inode_pages_range(struct address_space *mapping, - truncate_inode_page(mapping, page); - unlock_page(page); - } -+ pagevec_remove_exceptionals(&pvec); - pagevec_release(&pvec); - mem_cgroup_uncharge_end(); - cond_resched(); -@@ -308,14 +332,16 @@ void truncate_inode_pages_range(struct address_space *mapping, - index = start; - for ( ; ; ) { - cond_resched(); -- if (!pagevec_lookup(&pvec, mapping, index, -- min(end - index, (pgoff_t)PAGEVEC_SIZE))) { -+ if (!pagevec_lookup_entries(&pvec, mapping, index, -+ min(end - index, (pgoff_t)PAGEVEC_SIZE), -+ indices)) { - if (index == start) - break; - index = start; - continue; - } -- if (index == start && pvec.pages[0]->index >= end) { -+ if (index == start && indices[0] >= end) { -+ pagevec_remove_exceptionals(&pvec); - pagevec_release(&pvec); - break; - } -@@ -324,16 +350,22 @@ void truncate_inode_pages_range(struct address_space *mapping, - struct page *page = pvec.pages[i]; - - /* We rely upon deletion not changing page->index */ -- index = page->index; -+ index = indices[i]; - if (index >= end) - break; - -+ if (radix_tree_exceptional_entry(page)) { -+ clear_exceptional_entry(mapping, index, page); -+ continue; -+ } -+ - lock_page(page); - WARN_ON(page->index != index); - wait_on_page_writeback(page); - truncate_inode_page(mapping, page); - unlock_page(page); - } -+ pagevec_remove_exceptionals(&pvec); - pagevec_release(&pvec); - mem_cgroup_uncharge_end(); - index++; -@@ -376,6 +408,7 @@ EXPORT_SYMBOL(truncate_inode_pages); - unsigned long invalidate_mapping_pages(struct address_space *mapping, - pgoff_t start, pgoff_t end) - { -+ pgoff_t indices[PAGEVEC_SIZE]; - struct pagevec pvec; - pgoff_t index = start; - unsigned long ret; -@@ -391,17 +424,23 @@ unsigned long invalidate_mapping_pages(struct address_space *mapping, - */ - - pagevec_init(&pvec, 0); -- while (index <= end && pagevec_lookup(&pvec, mapping, index, -- min(end - index, (pgoff_t)PAGEVEC_SIZE - 1) + 1)) { -+ while (index <= end && pagevec_lookup_entries(&pvec, mapping, index, -+ min(end - index, (pgoff_t)PAGEVEC_SIZE - 1) + 1, -+ indices)) { - mem_cgroup_uncharge_start(); - for (i = 0; i < pagevec_count(&pvec); i++) { - struct page *page = pvec.pages[i]; - - /* We rely upon deletion not changing page->index */ -- index = page->index; -+ index = indices[i]; - if (index > end) - break; - -+ if (radix_tree_exceptional_entry(page)) { -+ clear_exceptional_entry(mapping, index, page); -+ continue; -+ } -+ - if (!trylock_page(page)) - continue; - WARN_ON(page->index != index); -@@ -415,6 +454,7 @@ unsigned long invalidate_mapping_pages(struct address_space *mapping, - deactivate_page(page); - count += ret; - } -+ pagevec_remove_exceptionals(&pvec); - pagevec_release(&pvec); - mem_cgroup_uncharge_end(); - cond_resched(); -@@ -482,6 +522,7 @@ static int do_launder_page(struct address_space *mapping, struct page *page) - int invalidate_inode_pages2_range(struct address_space *mapping, - pgoff_t start, pgoff_t end) - { -+ pgoff_t indices[PAGEVEC_SIZE]; - struct pagevec pvec; - pgoff_t index; - int i; -@@ -492,17 +533,23 @@ int invalidate_inode_pages2_range(struct address_space *mapping, - cleancache_invalidate_inode(mapping); - pagevec_init(&pvec, 0); - index = start; -- while (index <= end && pagevec_lookup(&pvec, mapping, index, -- min(end - index, (pgoff_t)PAGEVEC_SIZE - 1) + 1)) { -+ while (index <= end && pagevec_lookup_entries(&pvec, mapping, index, -+ min(end - index, (pgoff_t)PAGEVEC_SIZE - 1) + 1, -+ indices)) { - mem_cgroup_uncharge_start(); - for (i = 0; i < pagevec_count(&pvec); i++) { - struct page *page = pvec.pages[i]; - - /* We rely upon deletion not changing page->index */ -- index = page->index; -+ index = indices[i]; - if (index > end) - break; - -+ if (radix_tree_exceptional_entry(page)) { -+ clear_exceptional_entry(mapping, index, page); -+ continue; -+ } -+ - lock_page(page); - WARN_ON(page->index != index); - if (page->mapping != mapping) { -@@ -540,6 +587,7 @@ int invalidate_inode_pages2_range(struct address_space *mapping, - ret = ret2; - unlock_page(page); - } -+ pagevec_remove_exceptionals(&pvec); - pagevec_release(&pvec); - mem_cgroup_uncharge_end(); - cond_resched(); -diff --git a/mm/vmscan.c b/mm/vmscan.c -index 0c0b36e5b4f8..deb139e6b8ed 100644 ---- a/mm/vmscan.c -+++ b/mm/vmscan.c -@@ -2018,13 +2018,27 @@ static void shrink_lruvec(struct lruvec *lruvec, struct scan_control *sc) - unsigned long nr_reclaimed = 0; - unsigned long nr_to_reclaim = sc->nr_to_reclaim; - struct blk_plug plug; -- bool scan_adjusted = false; -+ bool scan_adjusted; - - get_scan_count(lruvec, sc, nr); - - /* Record the original scan target for proportional adjustments later */ - memcpy(targets, nr, sizeof(nr)); - -+ /* -+ * Global reclaiming within direct reclaim at DEF_PRIORITY is a normal -+ * event that can occur when there is little memory pressure e.g. -+ * multiple streaming readers/writers. Hence, we do not abort scanning -+ * when the requested number of pages are reclaimed when scanning at -+ * DEF_PRIORITY on the assumption that the fact we are direct -+ * reclaiming implies that kswapd is not keeping up and it is best to -+ * do a batch of work at once. For memcg reclaim one check is made to -+ * abort proportional reclaim if either the file or anon lru has already -+ * dropped to zero at the first pass. -+ */ -+ scan_adjusted = (global_reclaim(sc) && !current_is_kswapd() && -+ sc->priority == DEF_PRIORITY); -+ - blk_start_plug(&plug); - while (nr[LRU_INACTIVE_ANON] || nr[LRU_ACTIVE_FILE] || - nr[LRU_INACTIVE_FILE]) { -@@ -2045,17 +2059,8 @@ static void shrink_lruvec(struct lruvec *lruvec, struct scan_control *sc) - continue; - - /* -- * For global direct reclaim, reclaim only the number of pages -- * requested. Less care is taken to scan proportionally as it -- * is more important to minimise direct reclaim stall latency -- * than it is to properly age the LRU lists. -- */ -- if (global_reclaim(sc) && !current_is_kswapd()) -- break; -- -- /* - * For kswapd and memcg, reclaim at least the number of pages -- * requested. Ensure that the anon and file LRUs shrink -+ * requested. Ensure that the anon and file LRUs are scanned - * proportionally what was requested by get_scan_count(). We - * stop reclaiming one LRU and reduce the amount scanning - * proportional to the original scan target. -@@ -2063,6 +2068,15 @@ static void shrink_lruvec(struct lruvec *lruvec, struct scan_control *sc) - nr_file = nr[LRU_INACTIVE_FILE] + nr[LRU_ACTIVE_FILE]; - nr_anon = nr[LRU_INACTIVE_ANON] + nr[LRU_ACTIVE_ANON]; - -+ /* -+ * It's just vindictive to attack the larger once the smaller -+ * has gone to zero. And given the way we stop scanning the -+ * smaller below, this makes sure that we only make one nudge -+ * towards proportionality once we've got nr_to_reclaim. -+ */ -+ if (!nr_file || !nr_anon) -+ break; -+ - if (nr_file > nr_anon) { - unsigned long scan_target = targets[LRU_INACTIVE_ANON] + - targets[LRU_ACTIVE_ANON] + 1; -diff --git a/net/ceph/crypto.c b/net/ceph/crypto.c -index 6e7a236525b6..06f19b9e159a 100644 ---- a/net/ceph/crypto.c -+++ b/net/ceph/crypto.c -@@ -89,11 +89,82 @@ static struct crypto_blkcipher *ceph_crypto_alloc_cipher(void) - - static const u8 *aes_iv = (u8 *)CEPH_AES_IV; - -+/* -+ * Should be used for buffers allocated with ceph_kvmalloc(). -+ * Currently these are encrypt out-buffer (ceph_buffer) and decrypt -+ * in-buffer (msg front). -+ * -+ * Dispose of @sgt with teardown_sgtable(). -+ * -+ * @prealloc_sg is to avoid memory allocation inside sg_alloc_table() -+ * in cases where a single sg is sufficient. No attempt to reduce the -+ * number of sgs by squeezing physically contiguous pages together is -+ * made though, for simplicity. -+ */ -+static int setup_sgtable(struct sg_table *sgt, struct scatterlist *prealloc_sg, -+ const void *buf, unsigned int buf_len) -+{ -+ struct scatterlist *sg; -+ const bool is_vmalloc = is_vmalloc_addr(buf); -+ unsigned int off = offset_in_page(buf); -+ unsigned int chunk_cnt = 1; -+ unsigned int chunk_len = PAGE_ALIGN(off + buf_len); -+ int i; -+ int ret; -+ -+ if (buf_len == 0) { -+ memset(sgt, 0, sizeof(*sgt)); -+ return -EINVAL; -+ } -+ -+ if (is_vmalloc) { -+ chunk_cnt = chunk_len >> PAGE_SHIFT; -+ chunk_len = PAGE_SIZE; -+ } -+ -+ if (chunk_cnt > 1) { -+ ret = sg_alloc_table(sgt, chunk_cnt, GFP_NOFS); -+ if (ret) -+ return ret; -+ } else { -+ WARN_ON(chunk_cnt != 1); -+ sg_init_table(prealloc_sg, 1); -+ sgt->sgl = prealloc_sg; -+ sgt->nents = sgt->orig_nents = 1; -+ } -+ -+ for_each_sg(sgt->sgl, sg, sgt->orig_nents, i) { -+ struct page *page; -+ unsigned int len = min(chunk_len - off, buf_len); -+ -+ if (is_vmalloc) -+ page = vmalloc_to_page(buf); -+ else -+ page = virt_to_page(buf); -+ -+ sg_set_page(sg, page, len, off); -+ -+ off = 0; -+ buf += len; -+ buf_len -= len; -+ } -+ WARN_ON(buf_len != 0); -+ -+ return 0; -+} -+ -+static void teardown_sgtable(struct sg_table *sgt) -+{ -+ if (sgt->orig_nents > 1) -+ sg_free_table(sgt); -+} -+ - static int ceph_aes_encrypt(const void *key, int key_len, - void *dst, size_t *dst_len, - const void *src, size_t src_len) - { -- struct scatterlist sg_in[2], sg_out[1]; -+ struct scatterlist sg_in[2], prealloc_sg; -+ struct sg_table sg_out; - struct crypto_blkcipher *tfm = ceph_crypto_alloc_cipher(); - struct blkcipher_desc desc = { .tfm = tfm, .flags = 0 }; - int ret; -@@ -109,16 +180,18 @@ static int ceph_aes_encrypt(const void *key, int key_len, - - *dst_len = src_len + zero_padding; - -- crypto_blkcipher_setkey((void *)tfm, key, key_len); - sg_init_table(sg_in, 2); - sg_set_buf(&sg_in[0], src, src_len); - sg_set_buf(&sg_in[1], pad, zero_padding); -- sg_init_table(sg_out, 1); -- sg_set_buf(sg_out, dst, *dst_len); -+ ret = setup_sgtable(&sg_out, &prealloc_sg, dst, *dst_len); -+ if (ret) -+ goto out_tfm; -+ -+ crypto_blkcipher_setkey((void *)tfm, key, key_len); - iv = crypto_blkcipher_crt(tfm)->iv; - ivsize = crypto_blkcipher_ivsize(tfm); -- - memcpy(iv, aes_iv, ivsize); -+ - /* - print_hex_dump(KERN_ERR, "enc key: ", DUMP_PREFIX_NONE, 16, 1, - key, key_len, 1); -@@ -127,16 +200,22 @@ static int ceph_aes_encrypt(const void *key, int key_len, - print_hex_dump(KERN_ERR, "enc pad: ", DUMP_PREFIX_NONE, 16, 1, - pad, zero_padding, 1); - */ -- ret = crypto_blkcipher_encrypt(&desc, sg_out, sg_in, -+ ret = crypto_blkcipher_encrypt(&desc, sg_out.sgl, sg_in, - src_len + zero_padding); -- crypto_free_blkcipher(tfm); -- if (ret < 0) -+ if (ret < 0) { - pr_err("ceph_aes_crypt failed %d\n", ret); -+ goto out_sg; -+ } - /* - print_hex_dump(KERN_ERR, "enc out: ", DUMP_PREFIX_NONE, 16, 1, - dst, *dst_len, 1); - */ -- return 0; -+ -+out_sg: -+ teardown_sgtable(&sg_out); -+out_tfm: -+ crypto_free_blkcipher(tfm); -+ return ret; - } - - static int ceph_aes_encrypt2(const void *key, int key_len, void *dst, -@@ -144,7 +223,8 @@ static int ceph_aes_encrypt2(const void *key, int key_len, void *dst, - const void *src1, size_t src1_len, - const void *src2, size_t src2_len) - { -- struct scatterlist sg_in[3], sg_out[1]; -+ struct scatterlist sg_in[3], prealloc_sg; -+ struct sg_table sg_out; - struct crypto_blkcipher *tfm = ceph_crypto_alloc_cipher(); - struct blkcipher_desc desc = { .tfm = tfm, .flags = 0 }; - int ret; -@@ -160,17 +240,19 @@ static int ceph_aes_encrypt2(const void *key, int key_len, void *dst, - - *dst_len = src1_len + src2_len + zero_padding; - -- crypto_blkcipher_setkey((void *)tfm, key, key_len); - sg_init_table(sg_in, 3); - sg_set_buf(&sg_in[0], src1, src1_len); - sg_set_buf(&sg_in[1], src2, src2_len); - sg_set_buf(&sg_in[2], pad, zero_padding); -- sg_init_table(sg_out, 1); -- sg_set_buf(sg_out, dst, *dst_len); -+ ret = setup_sgtable(&sg_out, &prealloc_sg, dst, *dst_len); -+ if (ret) -+ goto out_tfm; -+ -+ crypto_blkcipher_setkey((void *)tfm, key, key_len); - iv = crypto_blkcipher_crt(tfm)->iv; - ivsize = crypto_blkcipher_ivsize(tfm); -- - memcpy(iv, aes_iv, ivsize); -+ - /* - print_hex_dump(KERN_ERR, "enc key: ", DUMP_PREFIX_NONE, 16, 1, - key, key_len, 1); -@@ -181,23 +263,30 @@ static int ceph_aes_encrypt2(const void *key, int key_len, void *dst, - print_hex_dump(KERN_ERR, "enc pad: ", DUMP_PREFIX_NONE, 16, 1, - pad, zero_padding, 1); - */ -- ret = crypto_blkcipher_encrypt(&desc, sg_out, sg_in, -+ ret = crypto_blkcipher_encrypt(&desc, sg_out.sgl, sg_in, - src1_len + src2_len + zero_padding); -- crypto_free_blkcipher(tfm); -- if (ret < 0) -+ if (ret < 0) { - pr_err("ceph_aes_crypt2 failed %d\n", ret); -+ goto out_sg; -+ } - /* - print_hex_dump(KERN_ERR, "enc out: ", DUMP_PREFIX_NONE, 16, 1, - dst, *dst_len, 1); - */ -- return 0; -+ -+out_sg: -+ teardown_sgtable(&sg_out); -+out_tfm: -+ crypto_free_blkcipher(tfm); -+ return ret; - } - - static int ceph_aes_decrypt(const void *key, int key_len, - void *dst, size_t *dst_len, - const void *src, size_t src_len) - { -- struct scatterlist sg_in[1], sg_out[2]; -+ struct sg_table sg_in; -+ struct scatterlist sg_out[2], prealloc_sg; - struct crypto_blkcipher *tfm = ceph_crypto_alloc_cipher(); - struct blkcipher_desc desc = { .tfm = tfm }; - char pad[16]; -@@ -209,16 +298,16 @@ static int ceph_aes_decrypt(const void *key, int key_len, - if (IS_ERR(tfm)) - return PTR_ERR(tfm); - -- crypto_blkcipher_setkey((void *)tfm, key, key_len); -- sg_init_table(sg_in, 1); - sg_init_table(sg_out, 2); -- sg_set_buf(sg_in, src, src_len); - sg_set_buf(&sg_out[0], dst, *dst_len); - sg_set_buf(&sg_out[1], pad, sizeof(pad)); -+ ret = setup_sgtable(&sg_in, &prealloc_sg, src, src_len); -+ if (ret) -+ goto out_tfm; - -+ crypto_blkcipher_setkey((void *)tfm, key, key_len); - iv = crypto_blkcipher_crt(tfm)->iv; - ivsize = crypto_blkcipher_ivsize(tfm); -- - memcpy(iv, aes_iv, ivsize); - - /* -@@ -227,12 +316,10 @@ static int ceph_aes_decrypt(const void *key, int key_len, - print_hex_dump(KERN_ERR, "dec in: ", DUMP_PREFIX_NONE, 16, 1, - src, src_len, 1); - */ -- -- ret = crypto_blkcipher_decrypt(&desc, sg_out, sg_in, src_len); -- crypto_free_blkcipher(tfm); -+ ret = crypto_blkcipher_decrypt(&desc, sg_out, sg_in.sgl, src_len); - if (ret < 0) { - pr_err("ceph_aes_decrypt failed %d\n", ret); -- return ret; -+ goto out_sg; - } - - if (src_len <= *dst_len) -@@ -250,7 +337,12 @@ static int ceph_aes_decrypt(const void *key, int key_len, - print_hex_dump(KERN_ERR, "dec out: ", DUMP_PREFIX_NONE, 16, 1, - dst, *dst_len, 1); - */ -- return 0; -+ -+out_sg: -+ teardown_sgtable(&sg_in); -+out_tfm: -+ crypto_free_blkcipher(tfm); -+ return ret; - } - - static int ceph_aes_decrypt2(const void *key, int key_len, -@@ -258,7 +350,8 @@ static int ceph_aes_decrypt2(const void *key, int key_len, - void *dst2, size_t *dst2_len, - const void *src, size_t src_len) - { -- struct scatterlist sg_in[1], sg_out[3]; -+ struct sg_table sg_in; -+ struct scatterlist sg_out[3], prealloc_sg; - struct crypto_blkcipher *tfm = ceph_crypto_alloc_cipher(); - struct blkcipher_desc desc = { .tfm = tfm }; - char pad[16]; -@@ -270,17 +363,17 @@ static int ceph_aes_decrypt2(const void *key, int key_len, - if (IS_ERR(tfm)) - return PTR_ERR(tfm); - -- sg_init_table(sg_in, 1); -- sg_set_buf(sg_in, src, src_len); - sg_init_table(sg_out, 3); - sg_set_buf(&sg_out[0], dst1, *dst1_len); - sg_set_buf(&sg_out[1], dst2, *dst2_len); - sg_set_buf(&sg_out[2], pad, sizeof(pad)); -+ ret = setup_sgtable(&sg_in, &prealloc_sg, src, src_len); -+ if (ret) -+ goto out_tfm; - - crypto_blkcipher_setkey((void *)tfm, key, key_len); - iv = crypto_blkcipher_crt(tfm)->iv; - ivsize = crypto_blkcipher_ivsize(tfm); -- - memcpy(iv, aes_iv, ivsize); - - /* -@@ -289,12 +382,10 @@ static int ceph_aes_decrypt2(const void *key, int key_len, - print_hex_dump(KERN_ERR, "dec in: ", DUMP_PREFIX_NONE, 16, 1, - src, src_len, 1); - */ -- -- ret = crypto_blkcipher_decrypt(&desc, sg_out, sg_in, src_len); -- crypto_free_blkcipher(tfm); -+ ret = crypto_blkcipher_decrypt(&desc, sg_out, sg_in.sgl, src_len); - if (ret < 0) { - pr_err("ceph_aes_decrypt failed %d\n", ret); -- return ret; -+ goto out_sg; - } - - if (src_len <= *dst1_len) -@@ -324,7 +415,11 @@ static int ceph_aes_decrypt2(const void *key, int key_len, - dst2, *dst2_len, 1); - */ - -- return 0; -+out_sg: -+ teardown_sgtable(&sg_in); -+out_tfm: -+ crypto_free_blkcipher(tfm); -+ return ret; - } - - -diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c -index cb57aa862177..b27f6d34762b 100644 ---- a/net/ipv6/ip6_gre.c -+++ b/net/ipv6/ip6_gre.c -@@ -962,8 +962,6 @@ static void ip6gre_tnl_link_config(struct ip6_tnl *t, int set_mtu) - else - dev->flags &= ~IFF_POINTOPOINT; - -- dev->iflink = p->link; -- - /* Precalculate GRE options length */ - if (t->parms.o_flags&(GRE_CSUM|GRE_KEY|GRE_SEQ)) { - if (t->parms.o_flags&GRE_CSUM) -@@ -1273,6 +1271,7 @@ static int ip6gre_tunnel_init(struct net_device *dev) - u64_stats_init(&ip6gre_tunnel_stats->syncp); - } - -+ dev->iflink = tunnel->parms.link; - - return 0; - } -@@ -1474,6 +1473,8 @@ static int ip6gre_tap_init(struct net_device *dev) - u64_stats_init(&ip6gre_tap_stats->syncp); - } - -+ dev->iflink = tunnel->parms.link; -+ - return 0; - } - -diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c -index 912033957ad3..657639d39f70 100644 ---- a/net/ipv6/ip6_tunnel.c -+++ b/net/ipv6/ip6_tunnel.c -@@ -272,9 +272,6 @@ static int ip6_tnl_create2(struct net_device *dev) - int err; - - t = netdev_priv(dev); -- err = ip6_tnl_dev_init(dev); -- if (err < 0) -- goto out; - - err = register_netdevice(dev); - if (err < 0) -@@ -1456,6 +1453,7 @@ ip6_tnl_change_mtu(struct net_device *dev, int new_mtu) - - - static const struct net_device_ops ip6_tnl_netdev_ops = { -+ .ndo_init = ip6_tnl_dev_init, - .ndo_uninit = ip6_tnl_dev_uninit, - .ndo_start_xmit = ip6_tnl_xmit, - .ndo_do_ioctl = ip6_tnl_ioctl, -@@ -1547,16 +1545,10 @@ static int __net_init ip6_fb_tnl_dev_init(struct net_device *dev) - struct ip6_tnl *t = netdev_priv(dev); - struct net *net = dev_net(dev); - struct ip6_tnl_net *ip6n = net_generic(net, ip6_tnl_net_id); -- int err = ip6_tnl_dev_init_gen(dev); -- -- if (err) -- return err; - - t->parms.proto = IPPROTO_IPV6; - dev_hold(dev); - -- ip6_tnl_link_config(t); -- - rcu_assign_pointer(ip6n->tnls_wc[0], t); - return 0; - } -diff --git a/net/ipv6/ip6_vti.c b/net/ipv6/ip6_vti.c -index 2d19272b8cee..9a5339fcb450 100644 ---- a/net/ipv6/ip6_vti.c -+++ b/net/ipv6/ip6_vti.c -@@ -172,10 +172,6 @@ static int vti6_tnl_create2(struct net_device *dev) - struct vti6_net *ip6n = net_generic(net, vti6_net_id); - int err; - -- err = vti6_dev_init(dev); -- if (err < 0) -- goto out; -- - err = register_netdevice(dev); - if (err < 0) - goto out; -@@ -693,6 +689,7 @@ static int vti6_change_mtu(struct net_device *dev, int new_mtu) - } - - static const struct net_device_ops vti6_netdev_ops = { -+ .ndo_init = vti6_dev_init, - .ndo_uninit = vti6_dev_uninit, - .ndo_start_xmit = vti6_tnl_xmit, - .ndo_do_ioctl = vti6_ioctl, -@@ -772,16 +769,10 @@ static int __net_init vti6_fb_tnl_dev_init(struct net_device *dev) - struct ip6_tnl *t = netdev_priv(dev); - struct net *net = dev_net(dev); - struct vti6_net *ip6n = net_generic(net, vti6_net_id); -- int err = vti6_dev_init_gen(dev); -- -- if (err) -- return err; - - t->parms.proto = IPPROTO_IPV6; - dev_hold(dev); - -- vti6_link_config(t); -- - rcu_assign_pointer(ip6n->tnls_wc[0], t); - return 0; - } -diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c -index b12b11b123ff..317b6dbf3190 100644 ---- a/net/ipv6/sit.c -+++ b/net/ipv6/sit.c -@@ -195,10 +195,8 @@ static int ipip6_tunnel_create(struct net_device *dev) - struct sit_net *sitn = net_generic(net, sit_net_id); - int err; - -- err = ipip6_tunnel_init(dev); -- if (err < 0) -- goto out; -- ipip6_tunnel_clone_6rd(dev, sitn); -+ memcpy(dev->dev_addr, &t->parms.iph.saddr, 4); -+ memcpy(dev->broadcast, &t->parms.iph.daddr, 4); - - if ((__force u16)t->parms.i_flags & SIT_ISATAP) - dev->priv_flags |= IFF_ISATAP; -@@ -207,7 +205,8 @@ static int ipip6_tunnel_create(struct net_device *dev) - if (err < 0) - goto out; - -- strcpy(t->parms.name, dev->name); -+ ipip6_tunnel_clone_6rd(dev, sitn); -+ - dev->rtnl_link_ops = &sit_link_ops; - - dev_hold(dev); -@@ -1321,6 +1320,7 @@ static int ipip6_tunnel_change_mtu(struct net_device *dev, int new_mtu) - } - - static const struct net_device_ops ipip6_netdev_ops = { -+ .ndo_init = ipip6_tunnel_init, - .ndo_uninit = ipip6_tunnel_uninit, - .ndo_start_xmit = sit_tunnel_xmit, - .ndo_do_ioctl = ipip6_tunnel_ioctl, -@@ -1367,9 +1367,7 @@ static int ipip6_tunnel_init(struct net_device *dev) - - tunnel->dev = dev; - tunnel->net = dev_net(dev); -- -- memcpy(dev->dev_addr, &tunnel->parms.iph.saddr, 4); -- memcpy(dev->broadcast, &tunnel->parms.iph.daddr, 4); -+ strcpy(tunnel->parms.name, dev->name); - - ipip6_tunnel_bind_dev(dev); - dev->tstats = alloc_percpu(struct pcpu_sw_netstats); -@@ -1401,7 +1399,6 @@ static int __net_init ipip6_fb_tunnel_init(struct net_device *dev) - - tunnel->dev = dev; - tunnel->net = dev_net(dev); -- strcpy(tunnel->parms.name, dev->name); - - iph->version = 4; - iph->protocol = IPPROTO_IPV6; -diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c -index ea7013cb7e52..3f076b9c9308 100644 ---- a/net/mac80211/ibss.c -+++ b/net/mac80211/ibss.c -@@ -815,7 +815,7 @@ ieee80211_ibss_process_chanswitch(struct ieee80211_sub_if_data *sdata, - - memset(&params, 0, sizeof(params)); - memset(&csa_ie, 0, sizeof(csa_ie)); -- err = ieee80211_parse_ch_switch_ie(sdata, elems, beacon, -+ err = ieee80211_parse_ch_switch_ie(sdata, elems, - ifibss->chandef.chan->band, - sta_flags, ifibss->bssid, &csa_ie); - /* can't switch to destination channel, fail */ -diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h -index b127902361f4..bf7a1bbb975f 100644 ---- a/net/mac80211/ieee80211_i.h -+++ b/net/mac80211/ieee80211_i.h -@@ -1569,7 +1569,6 @@ void ieee80211_process_measurement_req(struct ieee80211_sub_if_data *sdata, - * ieee80211_parse_ch_switch_ie - parses channel switch IEs - * @sdata: the sdata of the interface which has received the frame - * @elems: parsed 802.11 elements received with the frame -- * @beacon: indicates if the frame was a beacon or probe response - * @current_band: indicates the current band - * @sta_flags: contains information about own capabilities and restrictions - * to decide which channel switch announcements can be accepted. Only the -@@ -1583,7 +1582,7 @@ void ieee80211_process_measurement_req(struct ieee80211_sub_if_data *sdata, - * Return: 0 on success, <0 on error and >0 if there is nothing to parse. - */ - int ieee80211_parse_ch_switch_ie(struct ieee80211_sub_if_data *sdata, -- struct ieee802_11_elems *elems, bool beacon, -+ struct ieee802_11_elems *elems, - enum ieee80211_band current_band, - u32 sta_flags, u8 *bssid, - struct ieee80211_csa_ie *csa_ie); -diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c -index 8f7fabc46c97..06f5de4e4fbb 100644 ---- a/net/mac80211/iface.c -+++ b/net/mac80211/iface.c -@@ -760,10 +760,12 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, - int i, flushed; - struct ps_data *ps; - struct cfg80211_chan_def chandef; -+ bool cancel_scan; - - clear_bit(SDATA_STATE_RUNNING, &sdata->state); - -- if (rcu_access_pointer(local->scan_sdata) == sdata) -+ cancel_scan = rcu_access_pointer(local->scan_sdata) == sdata; -+ if (cancel_scan) - ieee80211_scan_cancel(local); - - /* -@@ -973,6 +975,9 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, - - ieee80211_recalc_ps(local, -1); - -+ if (cancel_scan) -+ flush_delayed_work(&local->scan_work); -+ - if (local->open_count == 0) { - ieee80211_stop_device(local); - -diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c -index 5b919cab1de0..3d52d1d68431 100644 ---- a/net/mac80211/mesh.c -+++ b/net/mac80211/mesh.c -@@ -885,7 +885,7 @@ ieee80211_mesh_process_chnswitch(struct ieee80211_sub_if_data *sdata, - - memset(&params, 0, sizeof(params)); - memset(&csa_ie, 0, sizeof(csa_ie)); -- err = ieee80211_parse_ch_switch_ie(sdata, elems, beacon, band, -+ err = ieee80211_parse_ch_switch_ie(sdata, elems, band, - sta_flags, sdata->vif.addr, - &csa_ie); - if (err < 0) -diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c -index 189eef014c4f..c9535a976b56 100644 ---- a/net/mac80211/mlme.c -+++ b/net/mac80211/mlme.c -@@ -1001,7 +1001,7 @@ ieee80211_sta_process_chanswitch(struct ieee80211_sub_if_data *sdata, - - current_band = cbss->channel->band; - memset(&csa_ie, 0, sizeof(csa_ie)); -- res = ieee80211_parse_ch_switch_ie(sdata, elems, beacon, current_band, -+ res = ieee80211_parse_ch_switch_ie(sdata, elems, current_band, - ifmgd->flags, - ifmgd->associated->bssid, &csa_ie); - if (res < 0) -@@ -1086,7 +1086,8 @@ ieee80211_sta_process_chanswitch(struct ieee80211_sub_if_data *sdata, - ieee80211_queue_work(&local->hw, &ifmgd->chswitch_work); - else - mod_timer(&ifmgd->chswitch_timer, -- TU_TO_EXP_TIME(csa_ie.count * cbss->beacon_interval)); -+ TU_TO_EXP_TIME((csa_ie.count - 1) * -+ cbss->beacon_interval)); - } - - static u32 ieee80211_handle_pwr_constr(struct ieee80211_sub_if_data *sdata, -diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c -index 3e57f96c9666..095c16037bc5 100644 ---- a/net/mac80211/rx.c -+++ b/net/mac80211/rx.c -@@ -1679,11 +1679,14 @@ ieee80211_rx_h_defragment(struct ieee80211_rx_data *rx) - sc = le16_to_cpu(hdr->seq_ctrl); - frag = sc & IEEE80211_SCTL_FRAG; - -- if (likely((!ieee80211_has_morefrags(fc) && frag == 0) || -- is_multicast_ether_addr(hdr->addr1))) { -- /* not fragmented */ -+ if (likely(!ieee80211_has_morefrags(fc) && frag == 0)) -+ goto out; -+ -+ if (is_multicast_ether_addr(hdr->addr1)) { -+ rx->local->dot11MulticastReceivedFrameCount++; - goto out; - } -+ - I802_DEBUG_INC(rx->local->rx_handlers_fragments); - - if (skb_linearize(rx->skb)) -@@ -1776,10 +1779,7 @@ ieee80211_rx_h_defragment(struct ieee80211_rx_data *rx) - out: - if (rx->sta) - rx->sta->rx_packets++; -- if (is_multicast_ether_addr(hdr->addr1)) -- rx->local->dot11MulticastReceivedFrameCount++; -- else -- ieee80211_led_rx(rx->local); -+ ieee80211_led_rx(rx->local); - return RX_CONTINUE; - } - -diff --git a/net/mac80211/spectmgmt.c b/net/mac80211/spectmgmt.c -index 6ab009070084..efeba56c913b 100644 ---- a/net/mac80211/spectmgmt.c -+++ b/net/mac80211/spectmgmt.c -@@ -22,7 +22,7 @@ - #include "wme.h" - - int ieee80211_parse_ch_switch_ie(struct ieee80211_sub_if_data *sdata, -- struct ieee802_11_elems *elems, bool beacon, -+ struct ieee802_11_elems *elems, - enum ieee80211_band current_band, - u32 sta_flags, u8 *bssid, - struct ieee80211_csa_ie *csa_ie) -@@ -91,19 +91,13 @@ int ieee80211_parse_ch_switch_ie(struct ieee80211_sub_if_data *sdata, - return -EINVAL; - } - -- if (!beacon && sec_chan_offs) { -+ if (sec_chan_offs) { - secondary_channel_offset = sec_chan_offs->sec_chan_offs; -- } else if (beacon && ht_oper) { -- secondary_channel_offset = -- ht_oper->ht_param & IEEE80211_HT_PARAM_CHA_SEC_OFFSET; - } else if (!(sta_flags & IEEE80211_STA_DISABLE_HT)) { -- /* If it's not a beacon, HT is enabled and the IE not present, -- * it's 20 MHz, 802.11-2012 8.5.2.6: -- * This element [the Secondary Channel Offset Element] is -- * present when switching to a 40 MHz channel. It may be -- * present when switching to a 20 MHz channel (in which -- * case the secondary channel offset is set to SCN). -- */ -+ /* If the secondary channel offset IE is not present, -+ * we can't know what's the post-CSA offset, so the -+ * best we can do is use 20MHz. -+ */ - secondary_channel_offset = IEEE80211_HT_PARAM_CHA_SEC_NONE; - } - -diff --git a/net/netfilter/ipset/ip_set_core.c b/net/netfilter/ipset/ip_set_core.c -index de770ec39e51..cf9937743abb 100644 ---- a/net/netfilter/ipset/ip_set_core.c -+++ b/net/netfilter/ipset/ip_set_core.c -@@ -636,7 +636,7 @@ ip_set_nfnl_get_byindex(struct net *net, ip_set_id_t index) - struct ip_set *set; - struct ip_set_net *inst = ip_set_pernet(net); - -- if (index > inst->ip_set_max) -+ if (index >= inst->ip_set_max) - return IPSET_INVALID_ID; - - nfnl_lock(NFNL_SUBSYS_IPSET); -diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c -index a155d19a225e..6ff12a191400 100644 ---- a/net/netfilter/nfnetlink_log.c -+++ b/net/netfilter/nfnetlink_log.c -@@ -45,7 +45,8 @@ - #define NFULNL_NLBUFSIZ_DEFAULT NLMSG_GOODSIZE - #define NFULNL_TIMEOUT_DEFAULT 100 /* every second */ - #define NFULNL_QTHRESH_DEFAULT 100 /* 100 packets */ --#define NFULNL_COPY_RANGE_MAX 0xFFFF /* max packet size is limited by 16-bit struct nfattr nfa_len field */ -+/* max packet size is limited by 16-bit struct nfattr nfa_len field */ -+#define NFULNL_COPY_RANGE_MAX (0xFFFF - NLA_HDRLEN) - - #define PRINTR(x, args...) do { if (net_ratelimit()) \ - printk(x, ## args); } while (0); -@@ -255,6 +256,8 @@ nfulnl_set_mode(struct nfulnl_instance *inst, u_int8_t mode, - - case NFULNL_COPY_PACKET: - inst->copy_mode = mode; -+ if (range == 0) -+ range = NFULNL_COPY_RANGE_MAX; - inst->copy_range = min_t(unsigned int, - range, NFULNL_COPY_RANGE_MAX); - break; -@@ -346,26 +349,25 @@ nfulnl_alloc_skb(struct net *net, u32 peer_portid, unsigned int inst_size, - return skb; - } - --static int -+static void - __nfulnl_send(struct nfulnl_instance *inst) - { -- int status = -1; -- - if (inst->qlen > 1) { - struct nlmsghdr *nlh = nlmsg_put(inst->skb, 0, 0, - NLMSG_DONE, - sizeof(struct nfgenmsg), - 0); -- if (!nlh) -+ if (WARN_ONCE(!nlh, "bad nlskb size: %u, tailroom %d\n", -+ inst->skb->len, skb_tailroom(inst->skb))) { -+ kfree_skb(inst->skb); - goto out; -+ } - } -- status = nfnetlink_unicast(inst->skb, inst->net, inst->peer_portid, -- MSG_DONTWAIT); -- -+ nfnetlink_unicast(inst->skb, inst->net, inst->peer_portid, -+ MSG_DONTWAIT); -+out: - inst->qlen = 0; - inst->skb = NULL; --out: -- return status; - } - - static void -@@ -652,7 +654,8 @@ nfulnl_log_packet(struct net *net, - + nla_total_size(sizeof(u_int32_t)) /* gid */ - + nla_total_size(plen) /* prefix */ - + nla_total_size(sizeof(struct nfulnl_msg_packet_hw)) -- + nla_total_size(sizeof(struct nfulnl_msg_packet_timestamp)); -+ + nla_total_size(sizeof(struct nfulnl_msg_packet_timestamp)) -+ + nla_total_size(sizeof(struct nfgenmsg)); /* NLMSG_DONE */ - - if (in && skb_mac_header_was_set(skb)) { - size += nla_total_size(skb->dev->hard_header_len) -@@ -681,8 +684,7 @@ nfulnl_log_packet(struct net *net, - break; - - case NFULNL_COPY_PACKET: -- if (inst->copy_range == 0 -- || inst->copy_range > skb->len) -+ if (inst->copy_range > skb->len) - data_len = skb->len; - else - data_len = inst->copy_range; -@@ -695,8 +697,7 @@ nfulnl_log_packet(struct net *net, - goto unlock_and_release; - } - -- if (inst->skb && -- size > skb_tailroom(inst->skb) - sizeof(struct nfgenmsg)) { -+ if (inst->skb && size > skb_tailroom(inst->skb)) { - /* either the queue len is too high or we don't have - * enough room in the skb left. flush to userspace. */ - __nfulnl_flush(inst); -diff --git a/net/netfilter/nft_compat.c b/net/netfilter/nft_compat.c -index 82cb8236f8a1..ad979612238a 100644 ---- a/net/netfilter/nft_compat.c -+++ b/net/netfilter/nft_compat.c -@@ -678,7 +678,7 @@ nft_target_select_ops(const struct nft_ctx *ctx, - family = ctx->afi->family; - - /* Re-use the existing target if it's already loaded. */ -- list_for_each_entry(nft_target, &nft_match_list, head) { -+ list_for_each_entry(nft_target, &nft_target_list, head) { - struct xt_target *target = nft_target->ops.data; - - if (strcmp(target->name, tg_name) == 0 && -diff --git a/net/sctp/associola.c b/net/sctp/associola.c -index 5d97d8fe4be7..d477d476714d 100644 ---- a/net/sctp/associola.c -+++ b/net/sctp/associola.c -@@ -1627,6 +1627,8 @@ struct sctp_chunk *sctp_assoc_lookup_asconf_ack( - * ack chunk whose serial number matches that of the request. - */ - list_for_each_entry(ack, &asoc->asconf_ack_list, transmitted_list) { -+ if (sctp_chunk_pending(ack)) -+ continue; - if (ack->subh.addip_hdr->serial == serial) { - sctp_chunk_hold(ack); - return ack; -diff --git a/net/sctp/auth.c b/net/sctp/auth.c -index 0e8529113dc5..fb7976aee61c 100644 ---- a/net/sctp/auth.c -+++ b/net/sctp/auth.c -@@ -862,8 +862,6 @@ int sctp_auth_set_key(struct sctp_endpoint *ep, - list_add(&cur_key->key_list, sh_keys); - - cur_key->key = key; -- sctp_auth_key_hold(key); -- - return 0; - nomem: - if (!replace) -diff --git a/net/sctp/inqueue.c b/net/sctp/inqueue.c -index 4de12afa13d4..7e8a16c77039 100644 ---- a/net/sctp/inqueue.c -+++ b/net/sctp/inqueue.c -@@ -140,18 +140,9 @@ struct sctp_chunk *sctp_inq_pop(struct sctp_inq *queue) - } else { - /* Nothing to do. Next chunk in the packet, please. */ - ch = (sctp_chunkhdr_t *) chunk->chunk_end; -- - /* Force chunk->skb->data to chunk->chunk_end. */ -- skb_pull(chunk->skb, -- chunk->chunk_end - chunk->skb->data); -- -- /* Verify that we have at least chunk headers -- * worth of buffer left. -- */ -- if (skb_headlen(chunk->skb) < sizeof(sctp_chunkhdr_t)) { -- sctp_chunk_free(chunk); -- chunk = queue->in_progress = NULL; -- } -+ skb_pull(chunk->skb, chunk->chunk_end - chunk->skb->data); -+ /* We are guaranteed to pull a SCTP header. */ - } - } - -@@ -187,24 +178,14 @@ struct sctp_chunk *sctp_inq_pop(struct sctp_inq *queue) - skb_pull(chunk->skb, sizeof(sctp_chunkhdr_t)); - chunk->subh.v = NULL; /* Subheader is no longer valid. */ - -- if (chunk->chunk_end < skb_tail_pointer(chunk->skb)) { -+ if (chunk->chunk_end + sizeof(sctp_chunkhdr_t) < -+ skb_tail_pointer(chunk->skb)) { - /* This is not a singleton */ - chunk->singleton = 0; - } else if (chunk->chunk_end > skb_tail_pointer(chunk->skb)) { -- /* RFC 2960, Section 6.10 Bundling -- * -- * Partial chunks MUST NOT be placed in an SCTP packet. -- * If the receiver detects a partial chunk, it MUST drop -- * the chunk. -- * -- * Since the end of the chunk is past the end of our buffer -- * (which contains the whole packet, we can freely discard -- * the whole packet. -- */ -- sctp_chunk_free(chunk); -- chunk = queue->in_progress = NULL; -- -- return NULL; -+ /* Discard inside state machine. */ -+ chunk->pdiscard = 1; -+ chunk->chunk_end = skb_tail_pointer(chunk->skb); - } else { - /* We are at the end of the packet, so mark the chunk - * in case we need to send a SACK. -diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c -index fee5552ddf92..43abb643f3a1 100644 ---- a/net/sctp/sm_make_chunk.c -+++ b/net/sctp/sm_make_chunk.c -@@ -2609,6 +2609,9 @@ do_addr_param: - addr_param = param.v + sizeof(sctp_addip_param_t); - - af = sctp_get_af_specific(param_type2af(param.p->type)); -+ if (af == NULL) -+ break; -+ - af->from_addr_param(&addr, addr_param, - htons(asoc->peer.port), 0); - -@@ -3110,50 +3113,63 @@ static __be16 sctp_process_asconf_param(struct sctp_association *asoc, - return SCTP_ERROR_NO_ERROR; - } - --/* Verify the ASCONF packet before we process it. */ --int sctp_verify_asconf(const struct sctp_association *asoc, -- struct sctp_paramhdr *param_hdr, void *chunk_end, -- struct sctp_paramhdr **errp) { -- sctp_addip_param_t *asconf_param; -+/* Verify the ASCONF packet before we process it. */ -+bool sctp_verify_asconf(const struct sctp_association *asoc, -+ struct sctp_chunk *chunk, bool addr_param_needed, -+ struct sctp_paramhdr **errp) -+{ -+ sctp_addip_chunk_t *addip = (sctp_addip_chunk_t *) chunk->chunk_hdr; - union sctp_params param; -- int length, plen; -+ bool addr_param_seen = false; - -- param.v = (sctp_paramhdr_t *) param_hdr; -- while (param.v <= chunk_end - sizeof(sctp_paramhdr_t)) { -- length = ntohs(param.p->length); -- *errp = param.p; -- -- if (param.v > chunk_end - length || -- length < sizeof(sctp_paramhdr_t)) -- return 0; -+ sctp_walk_params(param, addip, addip_hdr.params) { -+ size_t length = ntohs(param.p->length); - -+ *errp = param.p; - switch (param.p->type) { -+ case SCTP_PARAM_ERR_CAUSE: -+ break; -+ case SCTP_PARAM_IPV4_ADDRESS: -+ if (length != sizeof(sctp_ipv4addr_param_t)) -+ return false; -+ addr_param_seen = true; -+ break; -+ case SCTP_PARAM_IPV6_ADDRESS: -+ if (length != sizeof(sctp_ipv6addr_param_t)) -+ return false; -+ addr_param_seen = true; -+ break; - case SCTP_PARAM_ADD_IP: - case SCTP_PARAM_DEL_IP: - case SCTP_PARAM_SET_PRIMARY: -- asconf_param = (sctp_addip_param_t *)param.v; -- plen = ntohs(asconf_param->param_hdr.length); -- if (plen < sizeof(sctp_addip_param_t) + -- sizeof(sctp_paramhdr_t)) -- return 0; -+ /* In ASCONF chunks, these need to be first. */ -+ if (addr_param_needed && !addr_param_seen) -+ return false; -+ length = ntohs(param.addip->param_hdr.length); -+ if (length < sizeof(sctp_addip_param_t) + -+ sizeof(sctp_paramhdr_t)) -+ return false; - break; - case SCTP_PARAM_SUCCESS_REPORT: - case SCTP_PARAM_ADAPTATION_LAYER_IND: - if (length != sizeof(sctp_addip_param_t)) -- return 0; -- -+ return false; - break; - default: -- break; -+ /* This is unkown to us, reject! */ -+ return false; - } -- -- param.v += WORD_ROUND(length); - } - -- if (param.v != chunk_end) -- return 0; -+ /* Remaining sanity checks. */ -+ if (addr_param_needed && !addr_param_seen) -+ return false; -+ if (!addr_param_needed && addr_param_seen) -+ return false; -+ if (param.v != chunk->chunk_end) -+ return false; - -- return 1; -+ return true; - } - - /* Process an incoming ASCONF chunk with the next expected serial no. and -@@ -3162,16 +3178,17 @@ int sctp_verify_asconf(const struct sctp_association *asoc, - struct sctp_chunk *sctp_process_asconf(struct sctp_association *asoc, - struct sctp_chunk *asconf) - { -+ sctp_addip_chunk_t *addip = (sctp_addip_chunk_t *) asconf->chunk_hdr; -+ bool all_param_pass = true; -+ union sctp_params param; - sctp_addiphdr_t *hdr; - union sctp_addr_param *addr_param; - sctp_addip_param_t *asconf_param; - struct sctp_chunk *asconf_ack; -- - __be16 err_code; - int length = 0; - int chunk_len; - __u32 serial; -- int all_param_pass = 1; - - chunk_len = ntohs(asconf->chunk_hdr->length) - sizeof(sctp_chunkhdr_t); - hdr = (sctp_addiphdr_t *)asconf->skb->data; -@@ -3199,9 +3216,14 @@ struct sctp_chunk *sctp_process_asconf(struct sctp_association *asoc, - goto done; - - /* Process the TLVs contained within the ASCONF chunk. */ -- while (chunk_len > 0) { -+ sctp_walk_params(param, addip, addip_hdr.params) { -+ /* Skip preceeding address parameters. */ -+ if (param.p->type == SCTP_PARAM_IPV4_ADDRESS || -+ param.p->type == SCTP_PARAM_IPV6_ADDRESS) -+ continue; -+ - err_code = sctp_process_asconf_param(asoc, asconf, -- asconf_param); -+ param.addip); - /* ADDIP 4.1 A7) - * If an error response is received for a TLV parameter, - * all TLVs with no response before the failed TLV are -@@ -3209,28 +3231,20 @@ struct sctp_chunk *sctp_process_asconf(struct sctp_association *asoc, - * the failed response are considered unsuccessful unless - * a specific success indication is present for the parameter. - */ -- if (SCTP_ERROR_NO_ERROR != err_code) -- all_param_pass = 0; -- -+ if (err_code != SCTP_ERROR_NO_ERROR) -+ all_param_pass = false; - if (!all_param_pass) -- sctp_add_asconf_response(asconf_ack, -- asconf_param->crr_id, err_code, -- asconf_param); -+ sctp_add_asconf_response(asconf_ack, param.addip->crr_id, -+ err_code, param.addip); - - /* ADDIP 4.3 D11) When an endpoint receiving an ASCONF to add - * an IP address sends an 'Out of Resource' in its response, it - * MUST also fail any subsequent add or delete requests bundled - * in the ASCONF. - */ -- if (SCTP_ERROR_RSRC_LOW == err_code) -+ if (err_code == SCTP_ERROR_RSRC_LOW) - goto done; -- -- /* Move to the next ASCONF param. */ -- length = ntohs(asconf_param->param_hdr.length); -- asconf_param = (void *)asconf_param + length; -- chunk_len -= length; - } -- - done: - asoc->peer.addip_serial++; - -diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c -index 7194fe8589b0..3e287a3fa03b 100644 ---- a/net/sctp/sm_statefuns.c -+++ b/net/sctp/sm_statefuns.c -@@ -170,6 +170,9 @@ sctp_chunk_length_valid(struct sctp_chunk *chunk, - { - __u16 chunk_length = ntohs(chunk->chunk_hdr->length); - -+ /* Previously already marked? */ -+ if (unlikely(chunk->pdiscard)) -+ return 0; - if (unlikely(chunk_length < required_length)) - return 0; - -@@ -3591,9 +3594,7 @@ sctp_disposition_t sctp_sf_do_asconf(struct net *net, - struct sctp_chunk *asconf_ack = NULL; - struct sctp_paramhdr *err_param = NULL; - sctp_addiphdr_t *hdr; -- union sctp_addr_param *addr_param; - __u32 serial; -- int length; - - if (!sctp_vtag_verify(chunk, asoc)) { - sctp_add_cmd_sf(commands, SCTP_CMD_REPORT_BAD_TAG, -@@ -3618,17 +3619,8 @@ sctp_disposition_t sctp_sf_do_asconf(struct net *net, - hdr = (sctp_addiphdr_t *)chunk->skb->data; - serial = ntohl(hdr->serial); - -- addr_param = (union sctp_addr_param *)hdr->params; -- length = ntohs(addr_param->p.length); -- if (length < sizeof(sctp_paramhdr_t)) -- return sctp_sf_violation_paramlen(net, ep, asoc, type, arg, -- (void *)addr_param, commands); -- - /* Verify the ASCONF chunk before processing it. */ -- if (!sctp_verify_asconf(asoc, -- (sctp_paramhdr_t *)((void *)addr_param + length), -- (void *)chunk->chunk_end, -- &err_param)) -+ if (!sctp_verify_asconf(asoc, chunk, true, &err_param)) - return sctp_sf_violation_paramlen(net, ep, asoc, type, arg, - (void *)err_param, commands); - -@@ -3745,10 +3737,7 @@ sctp_disposition_t sctp_sf_do_asconf_ack(struct net *net, - rcvd_serial = ntohl(addip_hdr->serial); - - /* Verify the ASCONF-ACK chunk before processing it. */ -- if (!sctp_verify_asconf(asoc, -- (sctp_paramhdr_t *)addip_hdr->params, -- (void *)asconf_ack->chunk_end, -- &err_param)) -+ if (!sctp_verify_asconf(asoc, asconf_ack, false, &err_param)) - return sctp_sf_violation_paramlen(net, ep, asoc, type, arg, - (void *)err_param, commands); - -diff --git a/sound/usb/mixer_quirks.c b/sound/usb/mixer_quirks.c -index f4b12c216f1c..5a723df670b4 100644 ---- a/sound/usb/mixer_quirks.c -+++ b/sound/usb/mixer_quirks.c -@@ -885,6 +885,11 @@ static int snd_ftu_eff_switch_put(struct snd_kcontrol *kctl, - return changed; - } - -+static void kctl_private_value_free(struct snd_kcontrol *kctl) -+{ -+ kfree((void *)kctl->private_value); -+} -+ - static int snd_ftu_create_effect_switch(struct usb_mixer_interface *mixer, - int validx, int bUnitID) - { -@@ -919,6 +924,7 @@ static int snd_ftu_create_effect_switch(struct usb_mixer_interface *mixer, - return -ENOMEM; - } - -+ kctl->private_free = kctl_private_value_free; - err = snd_ctl_add(mixer->chip->card, kctl); - if (err < 0) - return err; diff --git a/projects/imx6/patches/linux/linux-000-patch-3.14.25-26.patch b/projects/imx6/patches/linux/linux-000-patch-3.14.25-26.patch deleted file mode 100644 index f4c60ef9d1d..00000000000 --- a/projects/imx6/patches/linux/linux-000-patch-3.14.25-26.patch +++ /dev/null @@ -1,2603 +0,0 @@ -diff --git a/Documentation/devicetree/bindings/interrupt-controller/interrupts.txt b/Documentation/devicetree/bindings/interrupt-controller/interrupts.txt -index ce6a1a0..8a3c408 100644 ---- a/Documentation/devicetree/bindings/interrupt-controller/interrupts.txt -+++ b/Documentation/devicetree/bindings/interrupt-controller/interrupts.txt -@@ -30,10 +30,6 @@ should only be used when a device has multiple interrupt parents. - Example: - interrupts-extended = <&intc1 5 1>, <&intc2 1 0>; - --A device node may contain either "interrupts" or "interrupts-extended", but not --both. If both properties are present, then the operating system should log an --error and use only the data in "interrupts". -- - 2) Interrupt controller nodes - ----------------------------- - -diff --git a/Makefile b/Makefile -index eb96e40..63a5ee8 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,6 +1,6 @@ - VERSION = 3 - PATCHLEVEL = 14 --SUBLEVEL = 25 -+SUBLEVEL = 26 - EXTRAVERSION = - NAME = Remembering Coco - -diff --git a/arch/arm/include/asm/thread_info.h b/arch/arm/include/asm/thread_info.h -index 71a06b2..3e635ee 100644 ---- a/arch/arm/include/asm/thread_info.h -+++ b/arch/arm/include/asm/thread_info.h -@@ -43,16 +43,6 @@ struct cpu_context_save { - __u32 extra[2]; /* Xscale 'acc' register, etc */ - }; - --struct arm_restart_block { -- union { -- /* For user cache flushing */ -- struct { -- unsigned long start; -- unsigned long end; -- } cache; -- }; --}; -- - /* - * low level task data that entry.S needs immediate access to. - * __switch_to() assumes cpu_context follows immediately after cpu_domain. -@@ -78,7 +68,6 @@ struct thread_info { - unsigned long thumbee_state; /* ThumbEE Handler Base register */ - #endif - struct restart_block restart_block; -- struct arm_restart_block arm_restart_block; - }; - - #define INIT_THREAD_INFO(tsk) \ -diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c -index 9265b8b..3f31443 100644 ---- a/arch/arm/kernel/traps.c -+++ b/arch/arm/kernel/traps.c -@@ -510,8 +510,6 @@ static int bad_syscall(int n, struct pt_regs *regs) - return regs->ARM_r0; - } - --static long do_cache_op_restart(struct restart_block *); -- - static inline int - __do_cache_op(unsigned long start, unsigned long end) - { -@@ -520,24 +518,8 @@ __do_cache_op(unsigned long start, unsigned long end) - do { - unsigned long chunk = min(PAGE_SIZE, end - start); - -- if (signal_pending(current)) { -- struct thread_info *ti = current_thread_info(); -- -- ti->restart_block = (struct restart_block) { -- .fn = do_cache_op_restart, -- }; -- -- ti->arm_restart_block = (struct arm_restart_block) { -- { -- .cache = { -- .start = start, -- .end = end, -- }, -- }, -- }; -- -- return -ERESTART_RESTARTBLOCK; -- } -+ if (fatal_signal_pending(current)) -+ return 0; - - ret = flush_cache_user_range(start, start + chunk); - if (ret) -@@ -550,15 +532,6 @@ __do_cache_op(unsigned long start, unsigned long end) - return 0; - } - --static long do_cache_op_restart(struct restart_block *unused) --{ -- struct arm_restart_block *restart_block; -- -- restart_block = &current_thread_info()->arm_restart_block; -- return __do_cache_op(restart_block->cache.start, -- restart_block->cache.end); --} -- - static inline int - do_cache_op(unsigned long start, unsigned long end, int flags) - { -diff --git a/arch/arm/mm/proc-v7.S b/arch/arm/mm/proc-v7.S -index 74f6033..fdedc31 100644 ---- a/arch/arm/mm/proc-v7.S -+++ b/arch/arm/mm/proc-v7.S -@@ -211,7 +211,6 @@ __v7_pj4b_setup: - /* Auxiliary Debug Modes Control 1 Register */ - #define PJ4B_STATIC_BP (1 << 2) /* Enable Static BP */ - #define PJ4B_INTER_PARITY (1 << 8) /* Disable Internal Parity Handling */ --#define PJ4B_BCK_OFF_STREX (1 << 5) /* Enable the back off of STREX instr */ - #define PJ4B_CLEAN_LINE (1 << 16) /* Disable data transfer for clean line */ - - /* Auxiliary Debug Modes Control 2 Register */ -@@ -234,7 +233,6 @@ __v7_pj4b_setup: - /* Auxiliary Debug Modes Control 1 Register */ - mrc p15, 1, r0, c15, c1, 1 - orr r0, r0, #PJ4B_CLEAN_LINE -- orr r0, r0, #PJ4B_BCK_OFF_STREX - orr r0, r0, #PJ4B_INTER_PARITY - bic r0, r0, #PJ4B_STATIC_BP - mcr p15, 1, r0, c15, c1, 1 -diff --git a/arch/arm/mm/proc-xscale.S b/arch/arm/mm/proc-xscale.S -index d19b1cf..b34b95f 100644 ---- a/arch/arm/mm/proc-xscale.S -+++ b/arch/arm/mm/proc-xscale.S -@@ -535,7 +535,7 @@ ENTRY(cpu_xscale_do_suspend) - mrc p15, 0, r5, c15, c1, 0 @ CP access reg - mrc p15, 0, r6, c13, c0, 0 @ PID - mrc p15, 0, r7, c3, c0, 0 @ domain ID -- mrc p15, 0, r8, c1, c1, 0 @ auxiliary control reg -+ mrc p15, 0, r8, c1, c0, 1 @ auxiliary control reg - mrc p15, 0, r9, c1, c0, 0 @ control reg - bic r4, r4, #2 @ clear frequency change bit - stmia r0, {r4 - r9} @ store cp regs -@@ -552,7 +552,7 @@ ENTRY(cpu_xscale_do_resume) - mcr p15, 0, r6, c13, c0, 0 @ PID - mcr p15, 0, r7, c3, c0, 0 @ domain ID - mcr p15, 0, r1, c2, c0, 0 @ translation table base addr -- mcr p15, 0, r8, c1, c1, 0 @ auxiliary control reg -+ mcr p15, 0, r8, c1, c0, 1 @ auxiliary control reg - mov r0, r9 @ control register - b cpu_resume_mmu - ENDPROC(cpu_xscale_do_resume) -diff --git a/arch/mips/loongson/common/Makefile b/arch/mips/loongson/common/Makefile -index 9e4484c..9005a8d6 100644 ---- a/arch/mips/loongson/common/Makefile -+++ b/arch/mips/loongson/common/Makefile -@@ -11,7 +11,8 @@ obj-$(CONFIG_PCI) += pci.o - # Serial port support - # - obj-$(CONFIG_EARLY_PRINTK) += early_printk.o --obj-$(CONFIG_SERIAL_8250) += serial.o -+loongson-serial-$(CONFIG_SERIAL_8250) := serial.o -+obj-y += $(loongson-serial-m) $(loongson-serial-y) - obj-$(CONFIG_LOONGSON_UART_BASE) += uart_base.o - obj-$(CONFIG_LOONGSON_MC146818) += rtc.o - -diff --git a/arch/mips/oprofile/backtrace.c b/arch/mips/oprofile/backtrace.c -index 6854ed5..83a1dfd 100644 ---- a/arch/mips/oprofile/backtrace.c -+++ b/arch/mips/oprofile/backtrace.c -@@ -92,7 +92,7 @@ static inline int unwind_user_frame(struct stackframe *old_frame, - /* This marks the end of the previous function, - which means we overran. */ - break; -- stack_size = (unsigned) stack_adjustment; -+ stack_size = (unsigned long) stack_adjustment; - } else if (is_ra_save_ins(&ip)) { - int ra_slot = ip.i_format.simmediate; - if (ra_slot < 0) -diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c -index beedaf0..d558b85 100644 ---- a/arch/powerpc/platforms/powernv/pci-ioda.c -+++ b/arch/powerpc/platforms/powernv/pci-ioda.c -@@ -902,7 +902,6 @@ static int pnv_pci_ioda_msi_setup(struct pnv_phb *phb, struct pci_dev *dev, - unsigned int is_64, struct msi_msg *msg) - { - struct pnv_ioda_pe *pe = pnv_ioda_get_pe(dev); -- struct pci_dn *pdn = pci_get_pdn(dev); - struct irq_data *idata; - struct irq_chip *ichip; - unsigned int xive_num = hwirq - phb->msi_base; -@@ -918,7 +917,7 @@ static int pnv_pci_ioda_msi_setup(struct pnv_phb *phb, struct pci_dev *dev, - return -ENXIO; - - /* Force 32-bit MSI on some broken devices */ -- if (pdn && pdn->force_32bit_msi) -+ if (dev->no_64bit_msi) - is_64 = 0; - - /* Assign XIVE to PE */ -diff --git a/arch/powerpc/platforms/powernv/pci.c b/arch/powerpc/platforms/powernv/pci.c -index 8518817..52c1162 100644 ---- a/arch/powerpc/platforms/powernv/pci.c -+++ b/arch/powerpc/platforms/powernv/pci.c -@@ -1,3 +1,4 @@ -+ - /* - * Support PCI/PCIe on PowerNV platforms - * -@@ -50,9 +51,8 @@ static int pnv_msi_check_device(struct pci_dev* pdev, int nvec, int type) - { - struct pci_controller *hose = pci_bus_to_host(pdev->bus); - struct pnv_phb *phb = hose->private_data; -- struct pci_dn *pdn = pci_get_pdn(pdev); - -- if (pdn && pdn->force_32bit_msi && !phb->msi32_support) -+ if (pdev->no_64bit_msi && !phb->msi32_support) - return -ENODEV; - - return (phb && phb->msi_bmp.bitmap) ? 0 : -ENODEV; -diff --git a/arch/powerpc/platforms/pseries/msi.c b/arch/powerpc/platforms/pseries/msi.c -index 0c882e8..6849d85 100644 ---- a/arch/powerpc/platforms/pseries/msi.c -+++ b/arch/powerpc/platforms/pseries/msi.c -@@ -428,7 +428,7 @@ static int rtas_setup_msi_irqs(struct pci_dev *pdev, int nvec_in, int type) - */ - again: - if (type == PCI_CAP_ID_MSI) { -- if (pdn->force_32bit_msi) { -+ if (pdev->no_64bit_msi) { - rc = rtas_change_msi(pdn, RTAS_CHANGE_32MSI_FN, nvec); - if (rc < 0) { - /* -diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c -index b079098..bc5fbc2 100644 ---- a/arch/powerpc/xmon/xmon.c -+++ b/arch/powerpc/xmon/xmon.c -@@ -288,10 +288,10 @@ static inline void disable_surveillance(void) - args.token = rtas_token("set-indicator"); - if (args.token == RTAS_UNKNOWN_SERVICE) - return; -- args.nargs = 3; -- args.nret = 1; -+ args.nargs = cpu_to_be32(3); -+ args.nret = cpu_to_be32(1); - args.rets = &args.args[3]; -- args.args[0] = SURVEILLANCE_TOKEN; -+ args.args[0] = cpu_to_be32(SURVEILLANCE_TOKEN); - args.args[1] = 0; - args.args[2] = 0; - enter_rtas(__pa(&args)); -diff --git a/arch/sparc/include/uapi/asm/swab.h b/arch/sparc/include/uapi/asm/swab.h -index a34ad07..4c7c12d 100644 ---- a/arch/sparc/include/uapi/asm/swab.h -+++ b/arch/sparc/include/uapi/asm/swab.h -@@ -9,9 +9,9 @@ static inline __u16 __arch_swab16p(const __u16 *addr) - { - __u16 ret; - -- __asm__ __volatile__ ("lduha [%1] %2, %0" -+ __asm__ __volatile__ ("lduha [%2] %3, %0" - : "=r" (ret) -- : "r" (addr), "i" (ASI_PL)); -+ : "m" (*addr), "r" (addr), "i" (ASI_PL)); - return ret; - } - #define __arch_swab16p __arch_swab16p -@@ -20,9 +20,9 @@ static inline __u32 __arch_swab32p(const __u32 *addr) - { - __u32 ret; - -- __asm__ __volatile__ ("lduwa [%1] %2, %0" -+ __asm__ __volatile__ ("lduwa [%2] %3, %0" - : "=r" (ret) -- : "r" (addr), "i" (ASI_PL)); -+ : "m" (*addr), "r" (addr), "i" (ASI_PL)); - return ret; - } - #define __arch_swab32p __arch_swab32p -@@ -31,9 +31,9 @@ static inline __u64 __arch_swab64p(const __u64 *addr) - { - __u64 ret; - -- __asm__ __volatile__ ("ldxa [%1] %2, %0" -+ __asm__ __volatile__ ("ldxa [%2] %3, %0" - : "=r" (ret) -- : "r" (addr), "i" (ASI_PL)); -+ : "m" (*addr), "r" (addr), "i" (ASI_PL)); - return ret; - } - #define __arch_swab64p __arch_swab64p -diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h -index 5f12968..1717156 100644 ---- a/arch/x86/include/asm/cpufeature.h -+++ b/arch/x86/include/asm/cpufeature.h -@@ -203,6 +203,7 @@ - #define X86_FEATURE_DECODEASSISTS (8*32+12) /* AMD Decode Assists support */ - #define X86_FEATURE_PAUSEFILTER (8*32+13) /* AMD filtered pause intercept */ - #define X86_FEATURE_PFTHRESHOLD (8*32+14) /* AMD pause filter threshold */ -+#define X86_FEATURE_VMMCALL (8*32+15) /* Prefer vmmcall to vmcall */ - - - /* Intel-defined CPU features, CPUID level 0x00000007:0 (ebx), word 9 */ -diff --git a/arch/x86/include/asm/kvm_para.h b/arch/x86/include/asm/kvm_para.h -index c7678e4..e62cf89 100644 ---- a/arch/x86/include/asm/kvm_para.h -+++ b/arch/x86/include/asm/kvm_para.h -@@ -2,6 +2,7 @@ - #define _ASM_X86_KVM_PARA_H - - #include <asm/processor.h> -+#include <asm/alternative.h> - #include <uapi/asm/kvm_para.h> - - extern void kvmclock_init(void); -@@ -16,10 +17,15 @@ static inline bool kvm_check_and_clear_guest_paused(void) - } - #endif /* CONFIG_KVM_GUEST */ - --/* This instruction is vmcall. On non-VT architectures, it will generate a -- * trap that we will then rewrite to the appropriate instruction. -+#ifdef CONFIG_DEBUG_RODATA -+#define KVM_HYPERCALL \ -+ ALTERNATIVE(".byte 0x0f,0x01,0xc1", ".byte 0x0f,0x01,0xd9", X86_FEATURE_VMMCALL) -+#else -+/* On AMD processors, vmcall will generate a trap that we will -+ * then rewrite to the appropriate instruction. - */ - #define KVM_HYPERCALL ".byte 0x0f,0x01,0xc1" -+#endif - - /* For KVM hypercalls, a three-byte sequence of either the vmcall or the vmmcall - * instruction. The hypervisor may replace it with something else but only the -diff --git a/arch/x86/include/asm/page_32_types.h b/arch/x86/include/asm/page_32_types.h -index f48b17d..3a52ee0 100644 ---- a/arch/x86/include/asm/page_32_types.h -+++ b/arch/x86/include/asm/page_32_types.h -@@ -20,7 +20,6 @@ - #define THREAD_SIZE_ORDER 1 - #define THREAD_SIZE (PAGE_SIZE << THREAD_SIZE_ORDER) - --#define STACKFAULT_STACK 0 - #define DOUBLEFAULT_STACK 1 - #define NMI_STACK 0 - #define DEBUG_STACK 0 -diff --git a/arch/x86/include/asm/page_64_types.h b/arch/x86/include/asm/page_64_types.h -index 8de6d9c..d54d1ee 100644 ---- a/arch/x86/include/asm/page_64_types.h -+++ b/arch/x86/include/asm/page_64_types.h -@@ -14,12 +14,11 @@ - #define IRQ_STACK_ORDER 2 - #define IRQ_STACK_SIZE (PAGE_SIZE << IRQ_STACK_ORDER) - --#define STACKFAULT_STACK 1 --#define DOUBLEFAULT_STACK 2 --#define NMI_STACK 3 --#define DEBUG_STACK 4 --#define MCE_STACK 5 --#define N_EXCEPTION_STACKS 5 /* hw limit: 7 */ -+#define DOUBLEFAULT_STACK 1 -+#define NMI_STACK 2 -+#define DEBUG_STACK 3 -+#define MCE_STACK 4 -+#define N_EXCEPTION_STACKS 4 /* hw limit: 7 */ - - #define PUD_PAGE_SIZE (_AC(1, UL) << PUD_SHIFT) - #define PUD_PAGE_MASK (~(PUD_PAGE_SIZE-1)) -diff --git a/arch/x86/include/asm/thread_info.h b/arch/x86/include/asm/thread_info.h -index e1940c0..e870ea9 100644 ---- a/arch/x86/include/asm/thread_info.h -+++ b/arch/x86/include/asm/thread_info.h -@@ -144,7 +144,7 @@ struct thread_info { - /* Only used for 64 bit */ - #define _TIF_DO_NOTIFY_MASK \ - (_TIF_SIGPENDING | _TIF_MCE_NOTIFY | _TIF_NOTIFY_RESUME | \ -- _TIF_USER_RETURN_NOTIFY) -+ _TIF_USER_RETURN_NOTIFY | _TIF_UPROBE) - - /* flags to check in __switch_to() */ - #define _TIF_WORK_CTXSW \ -diff --git a/arch/x86/include/asm/traps.h b/arch/x86/include/asm/traps.h -index 58d66fe..b409b17 100644 ---- a/arch/x86/include/asm/traps.h -+++ b/arch/x86/include/asm/traps.h -@@ -39,6 +39,7 @@ asmlinkage void simd_coprocessor_error(void); - - #ifdef CONFIG_TRACING - asmlinkage void trace_page_fault(void); -+#define trace_stack_segment stack_segment - #define trace_divide_error divide_error - #define trace_bounds bounds - #define trace_invalid_op invalid_op -diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c -index c67ffa6..c005fdd 100644 ---- a/arch/x86/kernel/cpu/amd.c -+++ b/arch/x86/kernel/cpu/amd.c -@@ -508,6 +508,13 @@ static void early_init_amd(struct cpuinfo_x86 *c) - } - #endif - -+ /* -+ * This is only needed to tell the kernel whether to use VMCALL -+ * and VMMCALL. VMMCALL is never executed except under virt, so -+ * we can set it unconditionally. -+ */ -+ set_cpu_cap(c, X86_FEATURE_VMMCALL); -+ - /* F16h erratum 793, CVE-2013-6885 */ - if (c->x86 == 0x16 && c->x86_model <= 0xf) { - u64 val; -diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c -index 3f27f5fd..e6bddd5 100644 ---- a/arch/x86/kernel/cpu/common.c -+++ b/arch/x86/kernel/cpu/common.c -@@ -144,6 +144,8 @@ EXPORT_PER_CPU_SYMBOL_GPL(gdt_page); - - static int __init x86_xsave_setup(char *s) - { -+ if (strlen(s)) -+ return 0; - setup_clear_cpu_cap(X86_FEATURE_XSAVE); - setup_clear_cpu_cap(X86_FEATURE_XSAVEOPT); - setup_clear_cpu_cap(X86_FEATURE_AVX); -diff --git a/arch/x86/kernel/dumpstack_64.c b/arch/x86/kernel/dumpstack_64.c -index addb207..66e274a 100644 ---- a/arch/x86/kernel/dumpstack_64.c -+++ b/arch/x86/kernel/dumpstack_64.c -@@ -24,7 +24,6 @@ static char x86_stack_ids[][8] = { - [ DEBUG_STACK-1 ] = "#DB", - [ NMI_STACK-1 ] = "NMI", - [ DOUBLEFAULT_STACK-1 ] = "#DF", -- [ STACKFAULT_STACK-1 ] = "#SS", - [ MCE_STACK-1 ] = "#MC", - #if DEBUG_STKSZ > EXCEPTION_STKSZ - [ N_EXCEPTION_STACKS ... -diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S -index 03cd2a8..02553d6 100644 ---- a/arch/x86/kernel/entry_64.S -+++ b/arch/x86/kernel/entry_64.S -@@ -1053,9 +1053,15 @@ ENTRY(native_iret) - jnz native_irq_return_ldt - #endif - -+.global native_irq_return_iret - native_irq_return_iret: -+ /* -+ * This may fault. Non-paranoid faults on return to userspace are -+ * handled by fixup_bad_iret. These include #SS, #GP, and #NP. -+ * Double-faults due to espfix64 are handled in do_double_fault. -+ * Other faults here are fatal. -+ */ - iretq -- _ASM_EXTABLE(native_irq_return_iret, bad_iret) - - #ifdef CONFIG_X86_ESPFIX64 - native_irq_return_ldt: -@@ -1083,25 +1089,6 @@ native_irq_return_ldt: - jmp native_irq_return_iret - #endif - -- .section .fixup,"ax" --bad_iret: -- /* -- * The iret traps when the %cs or %ss being restored is bogus. -- * We've lost the original trap vector and error code. -- * #GPF is the most likely one to get for an invalid selector. -- * So pretend we completed the iret and took the #GPF in user mode. -- * -- * We are now running with the kernel GS after exception recovery. -- * But error_entry expects us to have user GS to match the user %cs, -- * so swap back. -- */ -- pushq $0 -- -- SWAPGS -- jmp general_protection -- -- .previous -- - /* edi: workmask, edx: work */ - retint_careful: - CFI_RESTORE_STATE -@@ -1147,37 +1134,6 @@ ENTRY(retint_kernel) - CFI_ENDPROC - END(common_interrupt) - -- /* -- * If IRET takes a fault on the espfix stack, then we -- * end up promoting it to a doublefault. In that case, -- * modify the stack to make it look like we just entered -- * the #GP handler from user space, similar to bad_iret. -- */ --#ifdef CONFIG_X86_ESPFIX64 -- ALIGN --__do_double_fault: -- XCPT_FRAME 1 RDI+8 -- movq RSP(%rdi),%rax /* Trap on the espfix stack? */ -- sarq $PGDIR_SHIFT,%rax -- cmpl $ESPFIX_PGD_ENTRY,%eax -- jne do_double_fault /* No, just deliver the fault */ -- cmpl $__KERNEL_CS,CS(%rdi) -- jne do_double_fault -- movq RIP(%rdi),%rax -- cmpq $native_irq_return_iret,%rax -- jne do_double_fault /* This shouldn't happen... */ -- movq PER_CPU_VAR(kernel_stack),%rax -- subq $(6*8-KERNEL_STACK_OFFSET),%rax /* Reset to original stack */ -- movq %rax,RSP(%rdi) -- movq $0,(%rax) /* Missing (lost) #GP error code */ -- movq $general_protection,RIP(%rdi) -- retq -- CFI_ENDPROC --END(__do_double_fault) --#else --# define __do_double_fault do_double_fault --#endif -- - /* - * End of kprobes section - */ -@@ -1379,7 +1335,7 @@ zeroentry overflow do_overflow - zeroentry bounds do_bounds - zeroentry invalid_op do_invalid_op - zeroentry device_not_available do_device_not_available --paranoiderrorentry double_fault __do_double_fault -+paranoiderrorentry double_fault do_double_fault - zeroentry coprocessor_segment_overrun do_coprocessor_segment_overrun - errorentry invalid_TSS do_invalid_TSS - errorentry segment_not_present do_segment_not_present -@@ -1549,7 +1505,7 @@ apicinterrupt3 HYPERVISOR_CALLBACK_VECTOR \ - - paranoidzeroentry_ist debug do_debug DEBUG_STACK - paranoidzeroentry_ist int3 do_int3 DEBUG_STACK --paranoiderrorentry stack_segment do_stack_segment -+errorentry stack_segment do_stack_segment - #ifdef CONFIG_XEN - zeroentry xen_debug do_debug - zeroentry xen_int3 do_int3 -@@ -1659,16 +1615,15 @@ error_sti: - - /* - * There are two places in the kernel that can potentially fault with -- * usergs. Handle them here. The exception handlers after iret run with -- * kernel gs again, so don't set the user space flag. B stepping K8s -- * sometimes report an truncated RIP for IRET exceptions returning to -- * compat mode. Check for these here too. -+ * usergs. Handle them here. B stepping K8s sometimes report a -+ * truncated RIP for IRET exceptions returning to compat mode. Check -+ * for these here too. - */ - error_kernelspace: - incl %ebx - leaq native_irq_return_iret(%rip),%rcx - cmpq %rcx,RIP+8(%rsp) -- je error_swapgs -+ je error_bad_iret - movl %ecx,%eax /* zero extend */ - cmpq %rax,RIP+8(%rsp) - je bstep_iret -@@ -1679,7 +1634,15 @@ error_kernelspace: - bstep_iret: - /* Fix truncated RIP */ - movq %rcx,RIP+8(%rsp) -- jmp error_swapgs -+ /* fall through */ -+ -+error_bad_iret: -+ SWAPGS -+ mov %rsp,%rdi -+ call fixup_bad_iret -+ mov %rax,%rsp -+ decl %ebx /* Return to usergs */ -+ jmp error_sti - CFI_ENDPROC - END(error_entry) - -diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c -index 57409f6..f9d976e 100644 ---- a/arch/x86/kernel/traps.c -+++ b/arch/x86/kernel/traps.c -@@ -218,32 +218,40 @@ DO_ERROR_INFO(X86_TRAP_UD, SIGILL, "invalid opcode", invalid_op, ILL - DO_ERROR (X86_TRAP_OLD_MF, SIGFPE, "coprocessor segment overrun", coprocessor_segment_overrun ) - DO_ERROR (X86_TRAP_TS, SIGSEGV, "invalid TSS", invalid_TSS ) - DO_ERROR (X86_TRAP_NP, SIGBUS, "segment not present", segment_not_present ) --#ifdef CONFIG_X86_32 - DO_ERROR (X86_TRAP_SS, SIGBUS, "stack segment", stack_segment ) --#endif - DO_ERROR_INFO(X86_TRAP_AC, SIGBUS, "alignment check", alignment_check, BUS_ADRALN, 0 ) - - #ifdef CONFIG_X86_64 - /* Runs on IST stack */ --dotraplinkage void do_stack_segment(struct pt_regs *regs, long error_code) --{ -- enum ctx_state prev_state; -- -- prev_state = exception_enter(); -- if (notify_die(DIE_TRAP, "stack segment", regs, error_code, -- X86_TRAP_SS, SIGBUS) != NOTIFY_STOP) { -- preempt_conditional_sti(regs); -- do_trap(X86_TRAP_SS, SIGBUS, "stack segment", regs, error_code, NULL); -- preempt_conditional_cli(regs); -- } -- exception_exit(prev_state); --} -- - dotraplinkage void do_double_fault(struct pt_regs *regs, long error_code) - { - static const char str[] = "double fault"; - struct task_struct *tsk = current; - -+#ifdef CONFIG_X86_ESPFIX64 -+ extern unsigned char native_irq_return_iret[]; -+ -+ /* -+ * If IRET takes a non-IST fault on the espfix64 stack, then we -+ * end up promoting it to a doublefault. In that case, modify -+ * the stack to make it look like we just entered the #GP -+ * handler from user space, similar to bad_iret. -+ */ -+ if (((long)regs->sp >> PGDIR_SHIFT) == ESPFIX_PGD_ENTRY && -+ regs->cs == __KERNEL_CS && -+ regs->ip == (unsigned long)native_irq_return_iret) -+ { -+ struct pt_regs *normal_regs = task_pt_regs(current); -+ -+ /* Fake a #GP(0) from userspace. */ -+ memmove(&normal_regs->ip, (void *)regs->sp, 5*8); -+ normal_regs->orig_ax = 0; /* Missing (lost) #GP error code */ -+ regs->ip = (unsigned long)general_protection; -+ regs->sp = (unsigned long)&normal_regs->orig_ax; -+ return; -+ } -+#endif -+ - exception_enter(); - /* Return not checked because double check cannot be ignored */ - notify_die(DIE_TRAP, str, regs, error_code, X86_TRAP_DF, SIGSEGV); -@@ -376,6 +384,35 @@ asmlinkage __kprobes struct pt_regs *sync_regs(struct pt_regs *eregs) - *regs = *eregs; - return regs; - } -+ -+struct bad_iret_stack { -+ void *error_entry_ret; -+ struct pt_regs regs; -+}; -+ -+asmlinkage __visible -+struct bad_iret_stack *fixup_bad_iret(struct bad_iret_stack *s) -+{ -+ /* -+ * This is called from entry_64.S early in handling a fault -+ * caused by a bad iret to user mode. To handle the fault -+ * correctly, we want move our stack frame to task_pt_regs -+ * and we want to pretend that the exception came from the -+ * iret target. -+ */ -+ struct bad_iret_stack *new_stack = -+ container_of(task_pt_regs(current), -+ struct bad_iret_stack, regs); -+ -+ /* Copy the IRET target to the new stack. */ -+ memmove(&new_stack->regs.ip, (void *)s->regs.sp, 5*8); -+ -+ /* Copy the remainder of the stack from the current stack. */ -+ memmove(new_stack, s, offsetof(struct bad_iret_stack, regs.ip)); -+ -+ BUG_ON(!user_mode_vm(&new_stack->regs)); -+ return new_stack; -+} - #endif - - /* -@@ -748,7 +785,7 @@ void __init trap_init(void) - set_intr_gate(X86_TRAP_OLD_MF, coprocessor_segment_overrun); - set_intr_gate(X86_TRAP_TS, invalid_TSS); - set_intr_gate(X86_TRAP_NP, segment_not_present); -- set_intr_gate_ist(X86_TRAP_SS, &stack_segment, STACKFAULT_STACK); -+ set_intr_gate(X86_TRAP_SS, stack_segment); - set_intr_gate(X86_TRAP_GP, general_protection); - set_intr_gate(X86_TRAP_SPURIOUS, spurious_interrupt_bug); - set_intr_gate(X86_TRAP_MF, coprocessor_error); -diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c -index f35c66c..2308a40 100644 ---- a/arch/x86/mm/init_64.c -+++ b/arch/x86/mm/init_64.c -@@ -1110,7 +1110,7 @@ void mark_rodata_ro(void) - unsigned long end = (unsigned long) &__end_rodata_hpage_align; - unsigned long text_end = PFN_ALIGN(&__stop___ex_table); - unsigned long rodata_end = PFN_ALIGN(&__end_rodata); -- unsigned long all_end = PFN_ALIGN(&_end); -+ unsigned long all_end; - - printk(KERN_INFO "Write protecting the kernel read-only data: %luk\n", - (end - start) >> 10); -@@ -1121,7 +1121,16 @@ void mark_rodata_ro(void) - /* - * The rodata/data/bss/brk section (but not the kernel text!) - * should also be not-executable. -+ * -+ * We align all_end to PMD_SIZE because the existing mapping -+ * is a full PMD. If we would align _brk_end to PAGE_SIZE we -+ * split the PMD and the reminder between _brk_end and the end -+ * of the PMD will remain mapped executable. -+ * -+ * Any PMD which was setup after the one which covers _brk_end -+ * has been zapped already via cleanup_highmem(). - */ -+ all_end = roundup((unsigned long)_brk_end, PMD_SIZE); - set_memory_nx(rodata_start, (all_end - rodata_start) >> PAGE_SHIFT); - - rodata_test(); -diff --git a/arch/x86/tools/calc_run_size.pl b/arch/x86/tools/calc_run_size.pl -index 0b0b124..23210ba 100644 ---- a/arch/x86/tools/calc_run_size.pl -+++ b/arch/x86/tools/calc_run_size.pl -@@ -19,7 +19,16 @@ while (<>) { - if ($file_offset == 0) { - $file_offset = $offset; - } elsif ($file_offset != $offset) { -- die ".bss and .brk lack common file offset\n"; -+ # BFD linker shows the same file offset in ELF. -+ # Gold linker shows them as consecutive. -+ next if ($file_offset + $mem_size == $offset + $size); -+ -+ printf STDERR "file_offset: 0x%lx\n", $file_offset; -+ printf STDERR "mem_size: 0x%lx\n", $mem_size; -+ printf STDERR "offset: 0x%lx\n", $offset; -+ printf STDERR "size: 0x%lx\n", $size; -+ -+ die ".bss and .brk are non-contiguous\n"; - } - } - } -diff --git a/drivers/clocksource/sun4i_timer.c b/drivers/clocksource/sun4i_timer.c -index bf497af..7d19f86 100644 ---- a/drivers/clocksource/sun4i_timer.c -+++ b/drivers/clocksource/sun4i_timer.c -@@ -182,6 +182,12 @@ static void __init sun4i_timer_init(struct device_node *node) - /* Make sure timer is stopped before playing with interrupts */ - sun4i_clkevt_time_stop(0); - -+ sun4i_clockevent.cpumask = cpu_possible_mask; -+ sun4i_clockevent.irq = irq; -+ -+ clockevents_config_and_register(&sun4i_clockevent, rate, -+ TIMER_SYNC_TICKS, 0xffffffff); -+ - ret = setup_irq(irq, &sun4i_timer_irq); - if (ret) - pr_warn("failed to setup irq %d\n", irq); -@@ -189,12 +195,6 @@ static void __init sun4i_timer_init(struct device_node *node) - /* Enable timer0 interrupt */ - val = readl(timer_base + TIMER_IRQ_EN_REG); - writel(val | TIMER_IRQ_EN(0), timer_base + TIMER_IRQ_EN_REG); -- -- sun4i_clockevent.cpumask = cpu_possible_mask; -- sun4i_clockevent.irq = irq; -- -- clockevents_config_and_register(&sun4i_clockevent, rate, -- TIMER_SYNC_TICKS, 0xffffffff); - } - CLOCKSOURCE_OF_DECLARE(sun4i, "allwinner,sun4i-timer", - sun4i_timer_init); -diff --git a/drivers/gpu/drm/radeon/r600_dpm.c b/drivers/gpu/drm/radeon/r600_dpm.c -index 813db8d..3334f91 100644 ---- a/drivers/gpu/drm/radeon/r600_dpm.c -+++ b/drivers/gpu/drm/radeon/r600_dpm.c -@@ -1209,7 +1209,7 @@ int r600_parse_extended_power_table(struct radeon_device *rdev) - (mode_info->atom_context->bios + data_offset + - le16_to_cpu(ext_hdr->usPowerTuneTableOffset)); - rdev->pm.dpm.dyn_state.cac_tdp_table->maximum_power_delivery_limit = -- ppt->usMaximumPowerDeliveryLimit; -+ le16_to_cpu(ppt->usMaximumPowerDeliveryLimit); - pt = &ppt->power_tune_table; - } else { - ATOM_PPLIB_POWERTUNE_Table *ppt = (ATOM_PPLIB_POWERTUNE_Table *) -diff --git a/drivers/gpu/drm/radeon/radeon_irq_kms.c b/drivers/gpu/drm/radeon/radeon_irq_kms.c -index 089c9ff..b3f0293 100644 ---- a/drivers/gpu/drm/radeon/radeon_irq_kms.c -+++ b/drivers/gpu/drm/radeon/radeon_irq_kms.c -@@ -202,6 +202,16 @@ static bool radeon_msi_ok(struct radeon_device *rdev) - if (rdev->flags & RADEON_IS_AGP) - return false; - -+ /* -+ * Older chips have a HW limitation, they can only generate 40 bits -+ * of address for "64-bit" MSIs which breaks on some platforms, notably -+ * IBM POWER servers, so we limit them -+ */ -+ if (rdev->family < CHIP_BONAIRE) { -+ dev_info(rdev->dev, "radeon: MSI limited to 32-bit\n"); -+ rdev->pdev->no_64bit_msi = 1; -+ } -+ - /* force MSI on */ - if (radeon_msi == 1) - return true; -diff --git a/drivers/infiniband/ulp/isert/ib_isert.c b/drivers/infiniband/ulp/isert/ib_isert.c -index c5c194c..a96cfc3 100644 ---- a/drivers/infiniband/ulp/isert/ib_isert.c -+++ b/drivers/infiniband/ulp/isert/ib_isert.c -@@ -112,9 +112,12 @@ isert_conn_setup_qp(struct isert_conn *isert_conn, struct rdma_cm_id *cma_id) - attr.cap.max_recv_wr = ISERT_QP_MAX_RECV_DTOS; - /* - * FIXME: Use devattr.max_sge - 2 for max_send_sge as -- * work-around for RDMA_READ.. -+ * work-around for RDMA_READs with ConnectX-2. -+ * -+ * Also, still make sure to have at least two SGEs for -+ * outgoing control PDU responses. - */ -- attr.cap.max_send_sge = device->dev_attr.max_sge - 2; -+ attr.cap.max_send_sge = max(2, device->dev_attr.max_sge - 2); - isert_conn->max_sge = attr.cap.max_send_sge; - - attr.cap.max_recv_sge = 1; -@@ -220,12 +223,16 @@ isert_create_device_ib_res(struct isert_device *device) - struct isert_cq_desc *cq_desc; - struct ib_device_attr *dev_attr; - int ret = 0, i, j; -+ int max_rx_cqe, max_tx_cqe; - - dev_attr = &device->dev_attr; - ret = isert_query_device(ib_dev, dev_attr); - if (ret) - return ret; - -+ max_rx_cqe = min(ISER_MAX_RX_CQ_LEN, dev_attr->max_cqe); -+ max_tx_cqe = min(ISER_MAX_TX_CQ_LEN, dev_attr->max_cqe); -+ - /* asign function handlers */ - if (dev_attr->device_cap_flags & IB_DEVICE_MEM_MGT_EXTENSIONS) { - device->use_fastreg = 1; -@@ -261,7 +268,7 @@ isert_create_device_ib_res(struct isert_device *device) - isert_cq_rx_callback, - isert_cq_event_callback, - (void *)&cq_desc[i], -- ISER_MAX_RX_CQ_LEN, i); -+ max_rx_cqe, i); - if (IS_ERR(device->dev_rx_cq[i])) { - ret = PTR_ERR(device->dev_rx_cq[i]); - device->dev_rx_cq[i] = NULL; -@@ -273,7 +280,7 @@ isert_create_device_ib_res(struct isert_device *device) - isert_cq_tx_callback, - isert_cq_event_callback, - (void *)&cq_desc[i], -- ISER_MAX_TX_CQ_LEN, i); -+ max_tx_cqe, i); - if (IS_ERR(device->dev_tx_cq[i])) { - ret = PTR_ERR(device->dev_tx_cq[i]); - device->dev_tx_cq[i] = NULL; -@@ -718,14 +725,25 @@ wake_up: - complete(&isert_conn->conn_wait); - } - --static void -+static int - isert_disconnected_handler(struct rdma_cm_id *cma_id, bool disconnect) - { -- struct isert_conn *isert_conn = (struct isert_conn *)cma_id->context; -+ struct isert_conn *isert_conn; -+ -+ if (!cma_id->qp) { -+ struct isert_np *isert_np = cma_id->context; -+ -+ isert_np->np_cm_id = NULL; -+ return -1; -+ } -+ -+ isert_conn = (struct isert_conn *)cma_id->context; - - isert_conn->disconnect = disconnect; - INIT_WORK(&isert_conn->conn_logout_work, isert_disconnect_work); - schedule_work(&isert_conn->conn_logout_work); -+ -+ return 0; - } - - static int -@@ -740,6 +758,9 @@ isert_cma_handler(struct rdma_cm_id *cma_id, struct rdma_cm_event *event) - switch (event->event) { - case RDMA_CM_EVENT_CONNECT_REQUEST: - ret = isert_connect_request(cma_id, event); -+ if (ret) -+ pr_err("isert_cma_handler failed RDMA_CM_EVENT: 0x%08x %d\n", -+ event->event, ret); - break; - case RDMA_CM_EVENT_ESTABLISHED: - isert_connected_handler(cma_id); -@@ -749,7 +770,7 @@ isert_cma_handler(struct rdma_cm_id *cma_id, struct rdma_cm_event *event) - case RDMA_CM_EVENT_DEVICE_REMOVAL: /* FALLTHRU */ - disconnect = true; - case RDMA_CM_EVENT_TIMEWAIT_EXIT: /* FALLTHRU */ -- isert_disconnected_handler(cma_id, disconnect); -+ ret = isert_disconnected_handler(cma_id, disconnect); - break; - case RDMA_CM_EVENT_CONNECT_ERROR: - default: -@@ -757,12 +778,6 @@ isert_cma_handler(struct rdma_cm_id *cma_id, struct rdma_cm_event *event) - break; - } - -- if (ret != 0) { -- pr_err("isert_cma_handler failed RDMA_CM_EVENT: 0x%08x %d\n", -- event->event, ret); -- dump_stack(); -- } -- - return ret; - } - -@@ -970,7 +985,8 @@ isert_put_login_tx(struct iscsi_conn *conn, struct iscsi_login *login, - } - if (!login->login_failed) { - if (login->login_complete) { -- if (isert_conn->conn_device->use_fastreg) { -+ if (!conn->sess->sess_ops->SessionType && -+ isert_conn->conn_device->use_fastreg) { - ret = isert_conn_create_fastreg_pool(isert_conn); - if (ret) { - pr_err("Conn: %p failed to create" -@@ -1937,7 +1953,7 @@ isert_put_response(struct iscsi_conn *conn, struct iscsi_cmd *cmd) - isert_cmd->tx_desc.num_sge = 2; - } - -- isert_init_send_wr(isert_conn, isert_cmd, send_wr, true); -+ isert_init_send_wr(isert_conn, isert_cmd, send_wr, false); - - pr_debug("Posting SCSI Response IB_WR_SEND >>>>>>>>>>>>>>>>>>>>>>\n"); - -@@ -2456,7 +2472,7 @@ isert_put_datain(struct iscsi_conn *conn, struct iscsi_cmd *cmd) - &isert_cmd->tx_desc.iscsi_header); - isert_init_tx_hdrs(isert_conn, &isert_cmd->tx_desc); - isert_init_send_wr(isert_conn, isert_cmd, -- &isert_cmd->tx_desc.send_wr, true); -+ &isert_cmd->tx_desc.send_wr, false); - - atomic_add(wr->send_wr_num + 1, &isert_conn->post_send_buf_count); - -@@ -2768,7 +2784,8 @@ isert_free_np(struct iscsi_np *np) - { - struct isert_np *isert_np = (struct isert_np *)np->np_context; - -- rdma_destroy_id(isert_np->np_cm_id); -+ if (isert_np->np_cm_id) -+ rdma_destroy_id(isert_np->np_cm_id); - - np->np_context = NULL; - kfree(isert_np); -diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c -index d1078ce..0097b8d 100644 ---- a/drivers/infiniband/ulp/srpt/ib_srpt.c -+++ b/drivers/infiniband/ulp/srpt/ib_srpt.c -@@ -2091,6 +2091,7 @@ static int srpt_create_ch_ib(struct srpt_rdma_ch *ch) - if (!qp_init) - goto out; - -+retry: - ch->cq = ib_create_cq(sdev->device, srpt_completion, NULL, ch, - ch->rq_size + srp_sq_size, 0); - if (IS_ERR(ch->cq)) { -@@ -2114,6 +2115,13 @@ static int srpt_create_ch_ib(struct srpt_rdma_ch *ch) - ch->qp = ib_create_qp(sdev->pd, qp_init); - if (IS_ERR(ch->qp)) { - ret = PTR_ERR(ch->qp); -+ if (ret == -ENOMEM) { -+ srp_sq_size /= 2; -+ if (srp_sq_size >= MIN_SRPT_SQ_SIZE) { -+ ib_destroy_cq(ch->cq); -+ goto retry; -+ } -+ } - printk(KERN_ERR "failed to create_qp ret= %d\n", ret); - goto err_destroy_cq; - } -diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c -index 603fe0d..517829f 100644 ---- a/drivers/input/joystick/xpad.c -+++ b/drivers/input/joystick/xpad.c -@@ -1003,9 +1003,19 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id - } - - ep_irq_in = &intf->cur_altsetting->endpoint[1].desc; -- usb_fill_bulk_urb(xpad->bulk_out, udev, -- usb_sndbulkpipe(udev, ep_irq_in->bEndpointAddress), -- xpad->bdata, XPAD_PKT_LEN, xpad_bulk_out, xpad); -+ if (usb_endpoint_is_bulk_out(ep_irq_in)) { -+ usb_fill_bulk_urb(xpad->bulk_out, udev, -+ usb_sndbulkpipe(udev, -+ ep_irq_in->bEndpointAddress), -+ xpad->bdata, XPAD_PKT_LEN, -+ xpad_bulk_out, xpad); -+ } else { -+ usb_fill_int_urb(xpad->bulk_out, udev, -+ usb_sndintpipe(udev, -+ ep_irq_in->bEndpointAddress), -+ xpad->bdata, XPAD_PKT_LEN, -+ xpad_bulk_out, xpad, 0); -+ } - - /* - * Submit the int URB immediately rather than waiting for open -diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c -index 1e76eb8..a3769cf 100644 ---- a/drivers/input/mouse/synaptics.c -+++ b/drivers/input/mouse/synaptics.c -@@ -140,6 +140,10 @@ static const struct min_max_quirk min_max_pnpid_table[] = { - (const char * const []){"LEN2001", NULL}, - 1024, 5022, 2508, 4832 - }, -+ { -+ (const char * const []){"LEN2006", NULL}, -+ 1264, 5675, 1171, 4688 -+ }, - { } - }; - -diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c -index cc38948..1537982 100644 ---- a/drivers/net/bonding/bond_main.c -+++ b/drivers/net/bonding/bond_main.c -@@ -2450,9 +2450,9 @@ static void bond_loadbalance_arp_mon(struct work_struct *work) - if (!rtnl_trylock()) - goto re_arm; - -- if (slave_state_changed) { -+ if (slave_state_changed) - bond_slave_state_change(bond); -- } else if (do_failover) { -+ if (do_failover) { - /* the bond_select_active_slave must hold RTNL - * and curr_slave_lock for write. - */ -diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c -index fc59bc6..cc11f7f 100644 ---- a/drivers/net/can/dev.c -+++ b/drivers/net/can/dev.c -@@ -384,7 +384,7 @@ void can_free_echo_skb(struct net_device *dev, unsigned int idx) - BUG_ON(idx >= priv->echo_skb_max); - - if (priv->echo_skb[idx]) { -- kfree_skb(priv->echo_skb[idx]); -+ dev_kfree_skb_any(priv->echo_skb[idx]); - priv->echo_skb[idx] = NULL; - } - } -diff --git a/drivers/net/can/usb/esd_usb2.c b/drivers/net/can/usb/esd_usb2.c -index 7fbe859..f34f7fa 100644 ---- a/drivers/net/can/usb/esd_usb2.c -+++ b/drivers/net/can/usb/esd_usb2.c -@@ -1141,6 +1141,7 @@ static void esd_usb2_disconnect(struct usb_interface *intf) - } - } - unlink_all_urbs(dev); -+ kfree(dev); - } - } - -diff --git a/drivers/net/ieee802154/fakehard.c b/drivers/net/ieee802154/fakehard.c -index bf0d55e..6adbef8 100644 ---- a/drivers/net/ieee802154/fakehard.c -+++ b/drivers/net/ieee802154/fakehard.c -@@ -376,17 +376,20 @@ static int ieee802154fake_probe(struct platform_device *pdev) - - err = wpan_phy_register(phy); - if (err) -- goto out; -+ goto err_phy_reg; - - err = register_netdev(dev); -- if (err < 0) -- goto out; -+ if (err) -+ goto err_netdev_reg; - - dev_info(&pdev->dev, "Added ieee802154 HardMAC hardware\n"); - return 0; - --out: -- unregister_netdev(dev); -+err_netdev_reg: -+ wpan_phy_unregister(phy); -+err_phy_reg: -+ free_netdev(dev); -+ wpan_phy_free(phy); - return err; - } - -diff --git a/drivers/net/ppp/pptp.c b/drivers/net/ppp/pptp.c -index 1aff970..1dc628f 100644 ---- a/drivers/net/ppp/pptp.c -+++ b/drivers/net/ppp/pptp.c -@@ -506,7 +506,9 @@ static int pptp_getname(struct socket *sock, struct sockaddr *uaddr, - int len = sizeof(struct sockaddr_pppox); - struct sockaddr_pppox sp; - -- sp.sa_family = AF_PPPOX; -+ memset(&sp.sa_addr, 0, sizeof(sp.sa_addr)); -+ -+ sp.sa_family = AF_PPPOX; - sp.sa_protocol = PX_PROTO_PPTP; - sp.sa_addr.pptp = pppox_sk(sock->sk)->proto.pptp.src_addr; - -diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c -index d510f1d..db21af8 100644 ---- a/drivers/net/usb/qmi_wwan.c -+++ b/drivers/net/usb/qmi_wwan.c -@@ -769,6 +769,7 @@ static const struct usb_device_id products[] = { - {QMI_FIXED_INTF(0x413c, 0x81a4, 8)}, /* Dell Wireless 5570e HSPA+ (42Mbps) Mobile Broadband Card */ - {QMI_FIXED_INTF(0x413c, 0x81a8, 8)}, /* Dell Wireless 5808 Gobi(TM) 4G LTE Mobile Broadband Card */ - {QMI_FIXED_INTF(0x413c, 0x81a9, 8)}, /* Dell Wireless 5808e Gobi(TM) 4G LTE Mobile Broadband Card */ -+ {QMI_FIXED_INTF(0x03f0, 0x581d, 4)}, /* HP lt4112 LTE/HSPA+ Gobi 4G Module (Huawei me906e) */ - - /* 4. Gobi 1000 devices */ - {QMI_GOBI1K_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */ -diff --git a/drivers/net/wireless/ath/ath9k/ar9003_phy.c b/drivers/net/wireless/ath/ath9k/ar9003_phy.c -index 09facba..390c2de 100644 ---- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c -+++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c -@@ -647,6 +647,19 @@ static void ar9003_hw_override_ini(struct ath_hw *ah) - ah->enabled_cals |= TX_CL_CAL; - else - ah->enabled_cals &= ~TX_CL_CAL; -+ -+ if (AR_SREV_9340(ah) || AR_SREV_9531(ah) || AR_SREV_9550(ah)) { -+ if (ah->is_clk_25mhz) { -+ REG_WRITE(ah, AR_RTC_DERIVED_CLK, 0x17c << 1); -+ REG_WRITE(ah, AR_SLP32_MODE, 0x0010f3d7); -+ REG_WRITE(ah, AR_SLP32_INC, 0x0001e7ae); -+ } else { -+ REG_WRITE(ah, AR_RTC_DERIVED_CLK, 0x261 << 1); -+ REG_WRITE(ah, AR_SLP32_MODE, 0x0010f400); -+ REG_WRITE(ah, AR_SLP32_INC, 0x0001e800); -+ } -+ udelay(100); -+ } - } - - static void ar9003_hw_prog_ini(struct ath_hw *ah, -diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c -index 9078a6c..dcc1494 100644 ---- a/drivers/net/wireless/ath/ath9k/hw.c -+++ b/drivers/net/wireless/ath/ath9k/hw.c -@@ -858,19 +858,6 @@ static void ath9k_hw_init_pll(struct ath_hw *ah, - udelay(RTC_PLL_SETTLE_DELAY); - - REG_WRITE(ah, AR_RTC_SLEEP_CLK, AR_RTC_FORCE_DERIVED_CLK); -- -- if (AR_SREV_9340(ah) || AR_SREV_9550(ah)) { -- if (ah->is_clk_25mhz) { -- REG_WRITE(ah, AR_RTC_DERIVED_CLK, 0x17c << 1); -- REG_WRITE(ah, AR_SLP32_MODE, 0x0010f3d7); -- REG_WRITE(ah, AR_SLP32_INC, 0x0001e7ae); -- } else { -- REG_WRITE(ah, AR_RTC_DERIVED_CLK, 0x261 << 1); -- REG_WRITE(ah, AR_SLP32_MODE, 0x0010f400); -- REG_WRITE(ah, AR_SLP32_INC, 0x0001e800); -- } -- udelay(100); -- } - } - - static void ath9k_hw_init_interrupt_masks(struct ath_hw *ah, -diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.c b/drivers/net/wireless/rt2x00/rt2x00queue.c -index 5642ccc..22d49d5 100644 ---- a/drivers/net/wireless/rt2x00/rt2x00queue.c -+++ b/drivers/net/wireless/rt2x00/rt2x00queue.c -@@ -158,55 +158,29 @@ void rt2x00queue_align_frame(struct sk_buff *skb) - skb_trim(skb, frame_length); - } - --void rt2x00queue_insert_l2pad(struct sk_buff *skb, unsigned int header_length) -+/* -+ * H/W needs L2 padding between the header and the paylod if header size -+ * is not 4 bytes aligned. -+ */ -+void rt2x00queue_insert_l2pad(struct sk_buff *skb, unsigned int hdr_len) - { -- unsigned int payload_length = skb->len - header_length; -- unsigned int header_align = ALIGN_SIZE(skb, 0); -- unsigned int payload_align = ALIGN_SIZE(skb, header_length); -- unsigned int l2pad = payload_length ? L2PAD_SIZE(header_length) : 0; -+ unsigned int l2pad = (skb->len > hdr_len) ? L2PAD_SIZE(hdr_len) : 0; - -- /* -- * Adjust the header alignment if the payload needs to be moved more -- * than the header. -- */ -- if (payload_align > header_align) -- header_align += 4; -- -- /* There is nothing to do if no alignment is needed */ -- if (!header_align) -+ if (!l2pad) - return; - -- /* Reserve the amount of space needed in front of the frame */ -- skb_push(skb, header_align); -- -- /* -- * Move the header. -- */ -- memmove(skb->data, skb->data + header_align, header_length); -- -- /* Move the payload, if present and if required */ -- if (payload_length && payload_align) -- memmove(skb->data + header_length + l2pad, -- skb->data + header_length + l2pad + payload_align, -- payload_length); -- -- /* Trim the skb to the correct size */ -- skb_trim(skb, header_length + l2pad + payload_length); -+ skb_push(skb, l2pad); -+ memmove(skb->data, skb->data + l2pad, hdr_len); - } - --void rt2x00queue_remove_l2pad(struct sk_buff *skb, unsigned int header_length) -+void rt2x00queue_remove_l2pad(struct sk_buff *skb, unsigned int hdr_len) - { -- /* -- * L2 padding is only present if the skb contains more than just the -- * IEEE 802.11 header. -- */ -- unsigned int l2pad = (skb->len > header_length) ? -- L2PAD_SIZE(header_length) : 0; -+ unsigned int l2pad = (skb->len > hdr_len) ? L2PAD_SIZE(hdr_len) : 0; - - if (!l2pad) - return; - -- memmove(skb->data + l2pad, skb->data, header_length); -+ memmove(skb->data + l2pad, skb->data, hdr_len); - skb_pull(skb, l2pad); - } - -diff --git a/drivers/of/address.c b/drivers/of/address.c -index 1a54f1f..005c657 100644 ---- a/drivers/of/address.c -+++ b/drivers/of/address.c -@@ -401,6 +401,21 @@ static struct of_bus *of_match_bus(struct device_node *np) - return NULL; - } - -+static int of_empty_ranges_quirk(void) -+{ -+ if (IS_ENABLED(CONFIG_PPC)) { -+ /* To save cycles, we cache the result */ -+ static int quirk_state = -1; -+ -+ if (quirk_state < 0) -+ quirk_state = -+ of_machine_is_compatible("Power Macintosh") || -+ of_machine_is_compatible("MacRISC"); -+ return quirk_state; -+ } -+ return false; -+} -+ - static int of_translate_one(struct device_node *parent, struct of_bus *bus, - struct of_bus *pbus, __be32 *addr, - int na, int ns, int pna, const char *rprop) -@@ -426,12 +441,10 @@ static int of_translate_one(struct device_node *parent, struct of_bus *bus, - * This code is only enabled on powerpc. --gcl - */ - ranges = of_get_property(parent, rprop, &rlen); --#if !defined(CONFIG_PPC) -- if (ranges == NULL) { -+ if (ranges == NULL && !of_empty_ranges_quirk()) { - pr_err("OF: no ranges; cannot translate\n"); - return 1; - } --#endif /* !defined(CONFIG_PPC) */ - if (ranges == NULL || rlen == 0) { - offset = of_read_number(addr, na); - memset(addr, 0, pna * 4); -diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c -index fb02fc2..ced17f2 100644 ---- a/drivers/pci/msi.c -+++ b/drivers/pci/msi.c -@@ -599,6 +599,20 @@ error_attrs: - return ret; - } - -+static int msi_verify_entries(struct pci_dev *dev) -+{ -+ struct msi_desc *entry; -+ -+ list_for_each_entry(entry, &dev->msi_list, list) { -+ if (!dev->no_64bit_msi || !entry->msg.address_hi) -+ continue; -+ dev_err(&dev->dev, "Device has broken 64-bit MSI but arch" -+ " tried to assign one above 4G\n"); -+ return -EIO; -+ } -+ return 0; -+} -+ - /** - * msi_capability_init - configure device's MSI capability structure - * @dev: pointer to the pci_dev data structure of MSI device function -@@ -652,6 +666,13 @@ static int msi_capability_init(struct pci_dev *dev, int nvec) - return ret; - } - -+ ret = msi_verify_entries(dev); -+ if (ret) { -+ msi_mask_irq(entry, mask, ~mask); -+ free_msi_irqs(dev); -+ return ret; -+ } -+ - ret = populate_msi_sysfs(dev); - if (ret) { - msi_mask_irq(entry, mask, ~mask); -@@ -767,6 +788,11 @@ static int msix_capability_init(struct pci_dev *dev, - if (ret) - goto out_avail; - -+ /* Check if all MSI entries honor device restrictions */ -+ ret = msi_verify_entries(dev); -+ if (ret) -+ goto out_free; -+ - /* - * Some devices require MSI-X to be enabled before we can touch the - * MSI-X registers. We need to mask all the vectors to prevent -diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c -index 6e34498..34dff3a 100644 ---- a/drivers/pci/probe.c -+++ b/drivers/pci/probe.c -@@ -395,15 +395,16 @@ static void pci_read_bridge_mmio_pref(struct pci_bus *child) - { - struct pci_dev *dev = child->self; - u16 mem_base_lo, mem_limit_lo; -- unsigned long base, limit; -+ u64 base64, limit64; -+ dma_addr_t base, limit; - struct pci_bus_region region; - struct resource *res; - - res = child->resource[2]; - pci_read_config_word(dev, PCI_PREF_MEMORY_BASE, &mem_base_lo); - pci_read_config_word(dev, PCI_PREF_MEMORY_LIMIT, &mem_limit_lo); -- base = ((unsigned long) mem_base_lo & PCI_PREF_RANGE_MASK) << 16; -- limit = ((unsigned long) mem_limit_lo & PCI_PREF_RANGE_MASK) << 16; -+ base64 = (mem_base_lo & PCI_PREF_RANGE_MASK) << 16; -+ limit64 = (mem_limit_lo & PCI_PREF_RANGE_MASK) << 16; - - if ((mem_base_lo & PCI_PREF_RANGE_TYPE_MASK) == PCI_PREF_RANGE_TYPE_64) { - u32 mem_base_hi, mem_limit_hi; -@@ -417,18 +418,20 @@ static void pci_read_bridge_mmio_pref(struct pci_bus *child) - * this, just assume they are not being used. - */ - if (mem_base_hi <= mem_limit_hi) { --#if BITS_PER_LONG == 64 -- base |= ((unsigned long) mem_base_hi) << 32; -- limit |= ((unsigned long) mem_limit_hi) << 32; --#else -- if (mem_base_hi || mem_limit_hi) { -- dev_err(&dev->dev, "can't handle 64-bit " -- "address space for bridge\n"); -- return; -- } --#endif -+ base64 |= (u64) mem_base_hi << 32; -+ limit64 |= (u64) mem_limit_hi << 32; - } - } -+ -+ base = (dma_addr_t) base64; -+ limit = (dma_addr_t) limit64; -+ -+ if (base != base64) { -+ dev_err(&dev->dev, "can't handle bridge window above 4GB (bus address %#010llx)\n", -+ (unsigned long long) base64); -+ return; -+ } -+ - if (base <= limit) { - res->flags = (mem_base_lo & PCI_PREF_RANGE_TYPE_MASK) | - IORESOURCE_MEM | IORESOURCE_PREFETCH; -diff --git a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c -index 9b94850..cc6b13b 100644 ---- a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c -+++ b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c -@@ -411,6 +411,7 @@ static int bnx2fc_rcv(struct sk_buff *skb, struct net_device *dev, - struct fc_frame_header *fh; - struct fcoe_rcv_info *fr; - struct fcoe_percpu_s *bg; -+ struct sk_buff *tmp_skb; - unsigned short oxid; - - interface = container_of(ptype, struct bnx2fc_interface, -@@ -423,6 +424,12 @@ static int bnx2fc_rcv(struct sk_buff *skb, struct net_device *dev, - goto err; - } - -+ tmp_skb = skb_share_check(skb, GFP_ATOMIC); -+ if (!tmp_skb) -+ goto err; -+ -+ skb = tmp_skb; -+ - if (unlikely(eth_hdr(skb)->h_proto != htons(ETH_P_FCOE))) { - printk(KERN_ERR PFX "bnx2fc_rcv: Wrong FC type frame\n"); - goto err; -diff --git a/drivers/scsi/scsi_devinfo.c b/drivers/scsi/scsi_devinfo.c -index 49014a1..c1d04d4 100644 ---- a/drivers/scsi/scsi_devinfo.c -+++ b/drivers/scsi/scsi_devinfo.c -@@ -202,6 +202,7 @@ static struct { - {"IOMEGA", "Io20S *F", NULL, BLIST_KEY}, - {"INSITE", "Floptical F*8I", NULL, BLIST_KEY}, - {"INSITE", "I325VM", NULL, BLIST_KEY}, -+ {"Intel", "Multi-Flex", NULL, BLIST_NO_RSOC}, - {"iRiver", "iFP Mass Driver", NULL, BLIST_NOT_LOCKABLE | BLIST_INQUIRY_36}, - {"LASOUND", "CDX7405", "3.10", BLIST_MAX5LUN | BLIST_SINGLELUN}, - {"MATSHITA", "PD-1", NULL, BLIST_FORCELUN | BLIST_SINGLELUN}, -diff --git a/drivers/spi/spi-dw.c b/drivers/spi/spi-dw.c -index e63d270..e543b80 100644 ---- a/drivers/spi/spi-dw.c -+++ b/drivers/spi/spi-dw.c -@@ -394,9 +394,6 @@ static void pump_transfers(unsigned long data) - chip = dws->cur_chip; - spi = message->spi; - -- if (unlikely(!chip->clk_div)) -- chip->clk_div = dws->max_freq / chip->speed_hz; -- - if (message->state == ERROR_STATE) { - message->status = -EIO; - goto early_exit; -@@ -437,7 +434,7 @@ static void pump_transfers(unsigned long data) - if (transfer->speed_hz) { - speed = chip->speed_hz; - -- if (transfer->speed_hz != speed) { -+ if ((transfer->speed_hz != speed) || (!chip->clk_div)) { - speed = transfer->speed_hz; - if (speed > dws->max_freq) { - printk(KERN_ERR "MRST SPI0: unsupported" -@@ -659,7 +656,6 @@ static int dw_spi_setup(struct spi_device *spi) - dev_err(&spi->dev, "No max speed HZ parameter\n"); - return -EINVAL; - } -- chip->speed_hz = spi->max_speed_hz; - - chip->tmode = 0; /* Tx & Rx */ - /* Default SPI mode is SCPOL = 0, SCPH = 0 */ -diff --git a/drivers/staging/rtl8188eu/os_dep/usb_intf.c b/drivers/staging/rtl8188eu/os_dep/usb_intf.c -index fed699f..2185a71 100644 ---- a/drivers/staging/rtl8188eu/os_dep/usb_intf.c -+++ b/drivers/staging/rtl8188eu/os_dep/usb_intf.c -@@ -57,6 +57,7 @@ static struct usb_device_id rtw_usb_id_tbl[] = { - {USB_DEVICE(0x07b8, 0x8179)}, /* Abocom - Abocom */ - {USB_DEVICE(0x2001, 0x330F)}, /* DLink DWA-125 REV D1 */ - {USB_DEVICE(0x2001, 0x3310)}, /* Dlink DWA-123 REV D1 */ -+ {USB_DEVICE(0x2001, 0x3311)}, /* DLink GO-USB-N150 REV B1 */ - {USB_DEVICE(0x0df6, 0x0076)}, /* Sitecom N150 v2 */ - {} /* Terminating entry */ - }; -diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c -index 9232c773..e6463ef 100644 ---- a/drivers/target/target_core_transport.c -+++ b/drivers/target/target_core_transport.c -@@ -2230,7 +2230,7 @@ transport_generic_new_cmd(struct se_cmd *cmd) - * and let it call back once the write buffers are ready. - */ - target_add_to_state_list(cmd); -- if (cmd->data_direction != DMA_TO_DEVICE) { -+ if (cmd->data_direction != DMA_TO_DEVICE || cmd->data_length == 0) { - target_execute_cmd(cmd); - return 0; - } -diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c -index c854593..b195fdb 100644 ---- a/drivers/usb/core/quirks.c -+++ b/drivers/usb/core/quirks.c -@@ -44,6 +44,9 @@ static const struct usb_device_id usb_quirk_list[] = { - /* Creative SB Audigy 2 NX */ - { USB_DEVICE(0x041e, 0x3020), .driver_info = USB_QUIRK_RESET_RESUME }, - -+ /* Microsoft Wireless Laser Mouse 6000 Receiver */ -+ { USB_DEVICE(0x045e, 0x00e1), .driver_info = USB_QUIRK_RESET_RESUME }, -+ - /* Microsoft LifeCam-VX700 v2.0 */ - { USB_DEVICE(0x045e, 0x0770), .driver_info = USB_QUIRK_RESET_RESUME }, - -diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c -index 75cb1ff..73c43e5 100644 ---- a/drivers/usb/host/xhci-pci.c -+++ b/drivers/usb/host/xhci-pci.c -@@ -281,7 +281,7 @@ static int xhci_pci_suspend(struct usb_hcd *hcd, bool do_wakeup) - if (xhci_compliance_mode_recovery_timer_quirk_check()) - pdev->no_d3cold = true; - -- return xhci_suspend(xhci); -+ return xhci_suspend(xhci, do_wakeup); - } - - static int xhci_pci_resume(struct usb_hcd *hcd, bool hibernated) -diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c -index 8abda5c..1d5ba3c 100644 ---- a/drivers/usb/host/xhci-plat.c -+++ b/drivers/usb/host/xhci-plat.c -@@ -205,7 +205,15 @@ static int xhci_plat_suspend(struct device *dev) - struct usb_hcd *hcd = dev_get_drvdata(dev); - struct xhci_hcd *xhci = hcd_to_xhci(hcd); - -- return xhci_suspend(xhci); -+ /* -+ * xhci_suspend() needs `do_wakeup` to know whether host is allowed -+ * to do wakeup during suspend. Since xhci_plat_suspend is currently -+ * only designed for system suspend, device_may_wakeup() is enough -+ * to dertermine whether host is allowed to do wakeup. Need to -+ * reconsider this when xhci_plat_suspend enlarges its scope, e.g., -+ * also applies to runtime suspend. -+ */ -+ return xhci_suspend(xhci, device_may_wakeup(dev)); - } - - static int xhci_plat_resume(struct device *dev) -diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c -index 0e6665a..1710a86 100644 ---- a/drivers/usb/host/xhci-ring.c -+++ b/drivers/usb/host/xhci-ring.c -@@ -1180,9 +1180,8 @@ static void xhci_handle_cmd_reset_ep(struct xhci_hcd *xhci, int slot_id, - false); - xhci_ring_cmd_db(xhci); - } else { -- /* Clear our internal halted state and restart the ring(s) */ -+ /* Clear our internal halted state */ - xhci->devs[slot_id]->eps[ep_index].ep_state &= ~EP_HALTED; -- ring_doorbell_for_active_rings(xhci, slot_id, ep_index); - } - } - -diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c -index 82b563f..17e3987 100644 ---- a/drivers/usb/host/xhci.c -+++ b/drivers/usb/host/xhci.c -@@ -35,6 +35,8 @@ - #define DRIVER_AUTHOR "Sarah Sharp" - #define DRIVER_DESC "'eXtensible' Host Controller (xHC) Driver" - -+#define PORT_WAKE_BITS (PORT_WKOC_E | PORT_WKDISC_E | PORT_WKCONN_E) -+ - /* Some 0.95 hardware can't handle the chain bit on a Link TRB being cleared */ - static int link_quirk; - module_param(link_quirk, int, S_IRUGO | S_IWUSR); -@@ -842,13 +844,47 @@ static void xhci_clear_command_ring(struct xhci_hcd *xhci) - xhci_set_cmd_ring_deq(xhci); - } - -+static void xhci_disable_port_wake_on_bits(struct xhci_hcd *xhci) -+{ -+ int port_index; -+ __le32 __iomem **port_array; -+ unsigned long flags; -+ u32 t1, t2; -+ -+ spin_lock_irqsave(&xhci->lock, flags); -+ -+ /* disble usb3 ports Wake bits*/ -+ port_index = xhci->num_usb3_ports; -+ port_array = xhci->usb3_ports; -+ while (port_index--) { -+ t1 = readl(port_array[port_index]); -+ t1 = xhci_port_state_to_neutral(t1); -+ t2 = t1 & ~PORT_WAKE_BITS; -+ if (t1 != t2) -+ writel(t2, port_array[port_index]); -+ } -+ -+ /* disble usb2 ports Wake bits*/ -+ port_index = xhci->num_usb2_ports; -+ port_array = xhci->usb2_ports; -+ while (port_index--) { -+ t1 = readl(port_array[port_index]); -+ t1 = xhci_port_state_to_neutral(t1); -+ t2 = t1 & ~PORT_WAKE_BITS; -+ if (t1 != t2) -+ writel(t2, port_array[port_index]); -+ } -+ -+ spin_unlock_irqrestore(&xhci->lock, flags); -+} -+ - /* - * Stop HC (not bus-specific) - * - * This is called when the machine transition into S3/S4 mode. - * - */ --int xhci_suspend(struct xhci_hcd *xhci) -+int xhci_suspend(struct xhci_hcd *xhci, bool do_wakeup) - { - int rc = 0; - unsigned int delay = XHCI_MAX_HALT_USEC; -@@ -859,6 +895,10 @@ int xhci_suspend(struct xhci_hcd *xhci) - xhci->shared_hcd->state != HC_STATE_SUSPENDED) - return -EINVAL; - -+ /* Clear root port wake on bits if wakeup not allowed. */ -+ if (!do_wakeup) -+ xhci_disable_port_wake_on_bits(xhci); -+ - /* Don't poll the roothubs on bus suspend. */ - xhci_dbg(xhci, "%s: stopping port polling.\n", __func__); - clear_bit(HCD_FLAG_POLL_RH, &hcd->flags); -diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h -index 8faef64..96e9e78 100644 ---- a/drivers/usb/host/xhci.h -+++ b/drivers/usb/host/xhci.h -@@ -1760,7 +1760,7 @@ void xhci_shutdown(struct usb_hcd *hcd); - int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks); - - #ifdef CONFIG_PM --int xhci_suspend(struct xhci_hcd *xhci); -+int xhci_suspend(struct xhci_hcd *xhci, bool do_wakeup); - int xhci_resume(struct xhci_hcd *xhci, bool hibernated); - #else - #define xhci_suspend NULL -diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c -index 3beae72..5741e94 100644 ---- a/drivers/usb/serial/cp210x.c -+++ b/drivers/usb/serial/cp210x.c -@@ -120,6 +120,7 @@ static const struct usb_device_id id_table[] = { - { USB_DEVICE(0x10C4, 0x85F8) }, /* Virtenio Preon32 */ - { USB_DEVICE(0x10C4, 0x8664) }, /* AC-Services CAN-IF */ - { USB_DEVICE(0x10C4, 0x8665) }, /* AC-Services OBD-IF */ -+ { USB_DEVICE(0x10C4, 0x8875) }, /* CEL MeshConnect USB Stick */ - { USB_DEVICE(0x10C4, 0x88A4) }, /* MMB Networks ZigBee USB Device */ - { USB_DEVICE(0x10C4, 0x88A5) }, /* Planet Innovation Ingeni ZigBee USB Device */ - { USB_DEVICE(0x10C4, 0x8946) }, /* Ketra N1 Wireless Interface */ -diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c -index a523ada..debcdef 100644 ---- a/drivers/usb/serial/ftdi_sio.c -+++ b/drivers/usb/serial/ftdi_sio.c -@@ -483,6 +483,39 @@ static const struct usb_device_id id_table_combined[] = { - { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01FD_PID) }, - { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01FE_PID) }, - { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01FF_PID) }, -+ { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_4701_PID) }, -+ { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9300_PID) }, -+ { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9301_PID) }, -+ { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9302_PID) }, -+ { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9303_PID) }, -+ { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9304_PID) }, -+ { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9305_PID) }, -+ { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9306_PID) }, -+ { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9307_PID) }, -+ { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9308_PID) }, -+ { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9309_PID) }, -+ { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_930A_PID) }, -+ { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_930B_PID) }, -+ { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_930C_PID) }, -+ { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_930D_PID) }, -+ { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_930E_PID) }, -+ { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_930F_PID) }, -+ { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9310_PID) }, -+ { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9311_PID) }, -+ { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9312_PID) }, -+ { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9313_PID) }, -+ { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9314_PID) }, -+ { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9315_PID) }, -+ { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9316_PID) }, -+ { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9317_PID) }, -+ { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9318_PID) }, -+ { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9319_PID) }, -+ { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_931A_PID) }, -+ { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_931B_PID) }, -+ { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_931C_PID) }, -+ { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_931D_PID) }, -+ { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_931E_PID) }, -+ { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_931F_PID) }, - { USB_DEVICE(FTDI_VID, FTDI_PERLE_ULTRAPORT_PID) }, - { USB_DEVICE(FTDI_VID, FTDI_PIEGROUP_PID) }, - { USB_DEVICE(FTDI_VID, FTDI_TNC_X_PID) }, -diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h -index 6786b70..e52409c9 100644 ---- a/drivers/usb/serial/ftdi_sio_ids.h -+++ b/drivers/usb/serial/ftdi_sio_ids.h -@@ -926,8 +926,8 @@ - #define BAYER_CONTOUR_CABLE_PID 0x6001 - - /* -- * The following are the values for the Matrix Orbital FTDI Range -- * Anything in this range will use an FT232RL. -+ * Matrix Orbital Intelligent USB displays. -+ * http://www.matrixorbital.com - */ - #define MTXORB_VID 0x1B3D - #define MTXORB_FTDI_RANGE_0100_PID 0x0100 -@@ -1186,8 +1186,39 @@ - #define MTXORB_FTDI_RANGE_01FD_PID 0x01FD - #define MTXORB_FTDI_RANGE_01FE_PID 0x01FE - #define MTXORB_FTDI_RANGE_01FF_PID 0x01FF -- -- -+#define MTXORB_FTDI_RANGE_4701_PID 0x4701 -+#define MTXORB_FTDI_RANGE_9300_PID 0x9300 -+#define MTXORB_FTDI_RANGE_9301_PID 0x9301 -+#define MTXORB_FTDI_RANGE_9302_PID 0x9302 -+#define MTXORB_FTDI_RANGE_9303_PID 0x9303 -+#define MTXORB_FTDI_RANGE_9304_PID 0x9304 -+#define MTXORB_FTDI_RANGE_9305_PID 0x9305 -+#define MTXORB_FTDI_RANGE_9306_PID 0x9306 -+#define MTXORB_FTDI_RANGE_9307_PID 0x9307 -+#define MTXORB_FTDI_RANGE_9308_PID 0x9308 -+#define MTXORB_FTDI_RANGE_9309_PID 0x9309 -+#define MTXORB_FTDI_RANGE_930A_PID 0x930A -+#define MTXORB_FTDI_RANGE_930B_PID 0x930B -+#define MTXORB_FTDI_RANGE_930C_PID 0x930C -+#define MTXORB_FTDI_RANGE_930D_PID 0x930D -+#define MTXORB_FTDI_RANGE_930E_PID 0x930E -+#define MTXORB_FTDI_RANGE_930F_PID 0x930F -+#define MTXORB_FTDI_RANGE_9310_PID 0x9310 -+#define MTXORB_FTDI_RANGE_9311_PID 0x9311 -+#define MTXORB_FTDI_RANGE_9312_PID 0x9312 -+#define MTXORB_FTDI_RANGE_9313_PID 0x9313 -+#define MTXORB_FTDI_RANGE_9314_PID 0x9314 -+#define MTXORB_FTDI_RANGE_9315_PID 0x9315 -+#define MTXORB_FTDI_RANGE_9316_PID 0x9316 -+#define MTXORB_FTDI_RANGE_9317_PID 0x9317 -+#define MTXORB_FTDI_RANGE_9318_PID 0x9318 -+#define MTXORB_FTDI_RANGE_9319_PID 0x9319 -+#define MTXORB_FTDI_RANGE_931A_PID 0x931A -+#define MTXORB_FTDI_RANGE_931B_PID 0x931B -+#define MTXORB_FTDI_RANGE_931C_PID 0x931C -+#define MTXORB_FTDI_RANGE_931D_PID 0x931D -+#define MTXORB_FTDI_RANGE_931E_PID 0x931E -+#define MTXORB_FTDI_RANGE_931F_PID 0x931F - - /* - * The Mobility Lab (TML) -diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c -index 265c677..49101fe 100644 ---- a/drivers/usb/serial/keyspan.c -+++ b/drivers/usb/serial/keyspan.c -@@ -311,24 +311,30 @@ static void usa26_indat_callback(struct urb *urb) - if ((data[0] & 0x80) == 0) { - /* no errors on individual bytes, only - possible overrun err */ -- if (data[0] & RXERROR_OVERRUN) -- err = TTY_OVERRUN; -- else -- err = 0; -+ if (data[0] & RXERROR_OVERRUN) { -+ tty_insert_flip_char(&port->port, 0, -+ TTY_OVERRUN); -+ } - for (i = 1; i < urb->actual_length ; ++i) -- tty_insert_flip_char(&port->port, data[i], err); -+ tty_insert_flip_char(&port->port, data[i], -+ TTY_NORMAL); - } else { - /* some bytes had errors, every byte has status */ - dev_dbg(&port->dev, "%s - RX error!!!!\n", __func__); - for (i = 0; i + 1 < urb->actual_length; i += 2) { -- int stat = data[i], flag = 0; -- if (stat & RXERROR_OVERRUN) -- flag |= TTY_OVERRUN; -- if (stat & RXERROR_FRAMING) -- flag |= TTY_FRAME; -- if (stat & RXERROR_PARITY) -- flag |= TTY_PARITY; -+ int stat = data[i]; -+ int flag = TTY_NORMAL; -+ -+ if (stat & RXERROR_OVERRUN) { -+ tty_insert_flip_char(&port->port, 0, -+ TTY_OVERRUN); -+ } - /* XXX should handle break (0x10) */ -+ if (stat & RXERROR_PARITY) -+ flag = TTY_PARITY; -+ else if (stat & RXERROR_FRAMING) -+ flag = TTY_FRAME; -+ - tty_insert_flip_char(&port->port, data[i+1], - flag); - } -@@ -666,14 +672,19 @@ static void usa49_indat_callback(struct urb *urb) - } else { - /* some bytes had errors, every byte has status */ - for (i = 0; i + 1 < urb->actual_length; i += 2) { -- int stat = data[i], flag = 0; -- if (stat & RXERROR_OVERRUN) -- flag |= TTY_OVERRUN; -- if (stat & RXERROR_FRAMING) -- flag |= TTY_FRAME; -- if (stat & RXERROR_PARITY) -- flag |= TTY_PARITY; -+ int stat = data[i]; -+ int flag = TTY_NORMAL; -+ -+ if (stat & RXERROR_OVERRUN) { -+ tty_insert_flip_char(&port->port, 0, -+ TTY_OVERRUN); -+ } - /* XXX should handle break (0x10) */ -+ if (stat & RXERROR_PARITY) -+ flag = TTY_PARITY; -+ else if (stat & RXERROR_FRAMING) -+ flag = TTY_FRAME; -+ - tty_insert_flip_char(&port->port, data[i+1], - flag); - } -@@ -730,15 +741,19 @@ static void usa49wg_indat_callback(struct urb *urb) - */ - for (x = 0; x + 1 < len && - i + 1 < urb->actual_length; x += 2) { -- int stat = data[i], flag = 0; -+ int stat = data[i]; -+ int flag = TTY_NORMAL; - -- if (stat & RXERROR_OVERRUN) -- flag |= TTY_OVERRUN; -- if (stat & RXERROR_FRAMING) -- flag |= TTY_FRAME; -- if (stat & RXERROR_PARITY) -- flag |= TTY_PARITY; -+ if (stat & RXERROR_OVERRUN) { -+ tty_insert_flip_char(&port->port, 0, -+ TTY_OVERRUN); -+ } - /* XXX should handle break (0x10) */ -+ if (stat & RXERROR_PARITY) -+ flag = TTY_PARITY; -+ else if (stat & RXERROR_FRAMING) -+ flag = TTY_FRAME; -+ - tty_insert_flip_char(&port->port, data[i+1], - flag); - i += 2; -@@ -790,25 +805,31 @@ static void usa90_indat_callback(struct urb *urb) - if ((data[0] & 0x80) == 0) { - /* no errors on individual bytes, only - possible overrun err*/ -- if (data[0] & RXERROR_OVERRUN) -- err = TTY_OVERRUN; -- else -- err = 0; -+ if (data[0] & RXERROR_OVERRUN) { -+ tty_insert_flip_char(&port->port, 0, -+ TTY_OVERRUN); -+ } - for (i = 1; i < urb->actual_length ; ++i) - tty_insert_flip_char(&port->port, -- data[i], err); -+ data[i], TTY_NORMAL); - } else { - /* some bytes had errors, every byte has status */ - dev_dbg(&port->dev, "%s - RX error!!!!\n", __func__); - for (i = 0; i + 1 < urb->actual_length; i += 2) { -- int stat = data[i], flag = 0; -- if (stat & RXERROR_OVERRUN) -- flag |= TTY_OVERRUN; -- if (stat & RXERROR_FRAMING) -- flag |= TTY_FRAME; -- if (stat & RXERROR_PARITY) -- flag |= TTY_PARITY; -+ int stat = data[i]; -+ int flag = TTY_NORMAL; -+ -+ if (stat & RXERROR_OVERRUN) { -+ tty_insert_flip_char( -+ &port->port, 0, -+ TTY_OVERRUN); -+ } - /* XXX should handle break (0x10) */ -+ if (stat & RXERROR_PARITY) -+ flag = TTY_PARITY; -+ else if (stat & RXERROR_FRAMING) -+ flag = TTY_FRAME; -+ - tty_insert_flip_char(&port->port, - data[i+1], flag); - } -diff --git a/drivers/usb/serial/ssu100.c b/drivers/usb/serial/ssu100.c -index a7fe664b..70a098d 100644 ---- a/drivers/usb/serial/ssu100.c -+++ b/drivers/usb/serial/ssu100.c -@@ -490,10 +490,9 @@ static void ssu100_update_lsr(struct usb_serial_port *port, u8 lsr, - if (*tty_flag == TTY_NORMAL) - *tty_flag = TTY_FRAME; - } -- if (lsr & UART_LSR_OE){ -+ if (lsr & UART_LSR_OE) { - port->icount.overrun++; -- if (*tty_flag == TTY_NORMAL) -- *tty_flag = TTY_OVERRUN; -+ tty_insert_flip_char(&port->port, 0, TTY_OVERRUN); - } - } - -@@ -511,12 +510,8 @@ static void ssu100_process_read_urb(struct urb *urb) - if ((len >= 4) && - (packet[0] == 0x1b) && (packet[1] == 0x1b) && - ((packet[2] == 0x00) || (packet[2] == 0x01))) { -- if (packet[2] == 0x00) { -+ if (packet[2] == 0x00) - ssu100_update_lsr(port, packet[3], &flag); -- if (flag == TTY_OVERRUN) -- tty_insert_flip_char(&port->port, 0, -- TTY_OVERRUN); -- } - if (packet[2] == 0x01) - ssu100_update_msr(port, packet[3]); - -diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c -index e48d4a6..5d0b7b8 100644 ---- a/drivers/vhost/scsi.c -+++ b/drivers/vhost/scsi.c -@@ -1200,6 +1200,7 @@ static int - vhost_scsi_set_endpoint(struct vhost_scsi *vs, - struct vhost_scsi_target *t) - { -+ struct se_portal_group *se_tpg; - struct tcm_vhost_tport *tv_tport; - struct tcm_vhost_tpg *tpg; - struct tcm_vhost_tpg **vs_tpg; -@@ -1247,6 +1248,21 @@ vhost_scsi_set_endpoint(struct vhost_scsi *vs, - ret = -EEXIST; - goto out; - } -+ /* -+ * In order to ensure individual vhost-scsi configfs -+ * groups cannot be removed while in use by vhost ioctl, -+ * go ahead and take an explicit se_tpg->tpg_group.cg_item -+ * dependency now. -+ */ -+ se_tpg = &tpg->se_tpg; -+ ret = configfs_depend_item(se_tpg->se_tpg_tfo->tf_subsys, -+ &se_tpg->tpg_group.cg_item); -+ if (ret) { -+ pr_warn("configfs_depend_item() failed: %d\n", ret); -+ kfree(vs_tpg); -+ mutex_unlock(&tpg->tv_tpg_mutex); -+ goto out; -+ } - tpg->tv_tpg_vhost_count++; - tpg->vhost_scsi = vs; - vs_tpg[tpg->tport_tpgt] = tpg; -@@ -1289,6 +1305,7 @@ static int - vhost_scsi_clear_endpoint(struct vhost_scsi *vs, - struct vhost_scsi_target *t) - { -+ struct se_portal_group *se_tpg; - struct tcm_vhost_tport *tv_tport; - struct tcm_vhost_tpg *tpg; - struct vhost_virtqueue *vq; -@@ -1337,6 +1354,13 @@ vhost_scsi_clear_endpoint(struct vhost_scsi *vs, - vs->vs_tpg[target] = NULL; - match = true; - mutex_unlock(&tpg->tv_tpg_mutex); -+ /* -+ * Release se_tpg->tpg_group.cg_item configfs dependency now -+ * to allow vhost-scsi WWPN se_tpg->tpg_group shutdown to occur. -+ */ -+ se_tpg = &tpg->se_tpg; -+ configfs_undepend_item(se_tpg->se_tpg_tfo->tf_subsys, -+ &se_tpg->tpg_group.cg_item); - } - if (match) { - for (i = 0; i < VHOST_SCSI_MAX_VQ; i++) { -diff --git a/fs/aio.c b/fs/aio.c -index f45ddaa..2f7e8c2 100644 ---- a/fs/aio.c -+++ b/fs/aio.c -@@ -165,6 +165,15 @@ static struct vfsmount *aio_mnt; - static const struct file_operations aio_ring_fops; - static const struct address_space_operations aio_ctx_aops; - -+/* Backing dev info for aio fs. -+ * -no dirty page accounting or writeback happens -+ */ -+static struct backing_dev_info aio_fs_backing_dev_info = { -+ .name = "aiofs", -+ .state = 0, -+ .capabilities = BDI_CAP_NO_ACCT_AND_WRITEBACK | BDI_CAP_MAP_COPY, -+}; -+ - static struct file *aio_private_file(struct kioctx *ctx, loff_t nr_pages) - { - struct qstr this = QSTR_INIT("[aio]", 5); -@@ -176,6 +185,7 @@ static struct file *aio_private_file(struct kioctx *ctx, loff_t nr_pages) - - inode->i_mapping->a_ops = &aio_ctx_aops; - inode->i_mapping->private_data = ctx; -+ inode->i_mapping->backing_dev_info = &aio_fs_backing_dev_info; - inode->i_size = PAGE_SIZE * nr_pages; - - path.dentry = d_alloc_pseudo(aio_mnt->mnt_sb, &this); -@@ -221,6 +231,9 @@ static int __init aio_setup(void) - if (IS_ERR(aio_mnt)) - panic("Failed to create aio fs mount."); - -+ if (bdi_init(&aio_fs_backing_dev_info)) -+ panic("Failed to init aio fs backing dev info."); -+ - kiocb_cachep = KMEM_CACHE(kiocb, SLAB_HWCACHE_ALIGN|SLAB_PANIC); - kioctx_cachep = KMEM_CACHE(kioctx,SLAB_HWCACHE_ALIGN|SLAB_PANIC); - -@@ -282,11 +295,6 @@ static const struct file_operations aio_ring_fops = { - .mmap = aio_ring_mmap, - }; - --static int aio_set_page_dirty(struct page *page) --{ -- return 0; --} -- - #if IS_ENABLED(CONFIG_MIGRATION) - static int aio_migratepage(struct address_space *mapping, struct page *new, - struct page *old, enum migrate_mode mode) -@@ -358,7 +366,7 @@ out: - #endif - - static const struct address_space_operations aio_ctx_aops = { -- .set_page_dirty = aio_set_page_dirty, -+ .set_page_dirty = __set_page_dirty_no_writeback, - #if IS_ENABLED(CONFIG_MIGRATION) - .migratepage = aio_migratepage, - #endif -@@ -413,7 +421,6 @@ static int aio_setup_ring(struct kioctx *ctx) - pr_debug("pid(%d) page[%d]->count=%d\n", - current->pid, i, page_count(page)); - SetPageUptodate(page); -- SetPageDirty(page); - unlock_page(page); - - ctx->ring_pages[i] = page; -diff --git a/fs/locks.c b/fs/locks.c -index 4dd39b9..2c61c4e 100644 ---- a/fs/locks.c -+++ b/fs/locks.c -@@ -2235,16 +2235,28 @@ void locks_remove_flock(struct file *filp) - - while ((fl = *before) != NULL) { - if (fl->fl_file == filp) { -- if (IS_FLOCK(fl)) { -- locks_delete_lock(before); -- continue; -- } - if (IS_LEASE(fl)) { - lease_modify(before, F_UNLCK); - continue; - } -- /* What? */ -- BUG(); -+ -+ /* -+ * There's a leftover lock on the list of a type that -+ * we didn't expect to see. Most likely a classic -+ * POSIX lock that ended up not getting released -+ * properly, or that raced onto the list somehow. Log -+ * some info about it and then just remove it from -+ * the list. -+ */ -+ WARN(!IS_FLOCK(fl), -+ "leftover lock: dev=%u:%u ino=%lu type=%hhd flags=0x%x start=%lld end=%lld\n", -+ MAJOR(inode->i_sb->s_dev), -+ MINOR(inode->i_sb->s_dev), inode->i_ino, -+ fl->fl_type, fl->fl_flags, -+ fl->fl_start, fl->fl_end); -+ -+ locks_delete_lock(before); -+ continue; - } - before = &fl->fl_next; - } -diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c -index 2ffebf2..27d7f27 100644 ---- a/fs/nfs/pagelist.c -+++ b/fs/nfs/pagelist.c -@@ -113,7 +113,7 @@ __nfs_iocounter_wait(struct nfs_io_counter *c) - if (atomic_read(&c->io_count) == 0) - break; - ret = nfs_wait_bit_killable(&c->flags); -- } while (atomic_read(&c->io_count) != 0); -+ } while (atomic_read(&c->io_count) != 0 && !ret); - finish_wait(wq, &q.wait); - return ret; - } -diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c -index cc8c5b3..f42bbe5 100644 ---- a/fs/nfsd/nfs4callback.c -+++ b/fs/nfsd/nfs4callback.c -@@ -784,8 +784,12 @@ static bool nfsd41_cb_get_slot(struct nfs4_client *clp, struct rpc_task *task) - { - if (test_and_set_bit(0, &clp->cl_cb_slot_busy) != 0) { - rpc_sleep_on(&clp->cl_cb_waitq, task, NULL); -- dprintk("%s slot is busy\n", __func__); -- return false; -+ /* Race breaker */ -+ if (test_and_set_bit(0, &clp->cl_cb_slot_busy) != 0) { -+ dprintk("%s slot is busy\n", __func__); -+ return false; -+ } -+ rpc_wake_up_queued_task(&clp->cl_cb_waitq, task); - } - return true; - } -diff --git a/fs/nfsd/nfscache.c b/fs/nfsd/nfscache.c -index f8f060f..6040da8 100644 ---- a/fs/nfsd/nfscache.c -+++ b/fs/nfsd/nfscache.c -@@ -224,13 +224,6 @@ hash_refile(struct svc_cacherep *rp) - hlist_add_head(&rp->c_hash, cache_hash + hash_32(rp->c_xid, maskbits)); - } - --static inline bool --nfsd_cache_entry_expired(struct svc_cacherep *rp) --{ -- return rp->c_state != RC_INPROG && -- time_after(jiffies, rp->c_timestamp + RC_EXPIRE); --} -- - /* - * Walk the LRU list and prune off entries that are older than RC_EXPIRE. - * Also prune the oldest ones when the total exceeds the max number of entries. -@@ -242,8 +235,14 @@ prune_cache_entries(void) - long freed = 0; - - list_for_each_entry_safe(rp, tmp, &lru_head, c_lru) { -- if (!nfsd_cache_entry_expired(rp) && -- num_drc_entries <= max_drc_entries) -+ /* -+ * Don't free entries attached to calls that are still -+ * in-progress, but do keep scanning the list. -+ */ -+ if (rp->c_state == RC_INPROG) -+ continue; -+ if (num_drc_entries <= max_drc_entries && -+ time_before(jiffies, rp->c_timestamp + RC_EXPIRE)) - break; - nfsd_reply_cache_free_locked(rp); - freed++; -diff --git a/fs/nfsd/nfsd.h b/fs/nfsd/nfsd.h -index 479eb68..f417fef 100644 ---- a/fs/nfsd/nfsd.h -+++ b/fs/nfsd/nfsd.h -@@ -328,12 +328,15 @@ void nfsd_lockd_shutdown(void); - (NFSD4_SUPPORTED_ATTRS_WORD2 | FATTR4_WORD2_SUPPATTR_EXCLCREAT) - - #ifdef CONFIG_NFSD_V4_SECURITY_LABEL --#define NFSD4_2_SUPPORTED_ATTRS_WORD2 \ -- (NFSD4_1_SUPPORTED_ATTRS_WORD2 | FATTR4_WORD2_SECURITY_LABEL) -+#define NFSD4_2_SECURITY_ATTRS FATTR4_WORD2_SECURITY_LABEL - #else --#define NFSD4_2_SUPPORTED_ATTRS_WORD2 0 -+#define NFSD4_2_SECURITY_ATTRS 0 - #endif - -+#define NFSD4_2_SUPPORTED_ATTRS_WORD2 \ -+ (NFSD4_1_SUPPORTED_ATTRS_WORD2 | \ -+ NFSD4_2_SECURITY_ATTRS) -+ - static inline u32 nfsd_suppattrs0(u32 minorversion) - { - return minorversion ? NFSD4_1_SUPPORTED_ATTRS_WORD0 -diff --git a/include/linux/bitops.h b/include/linux/bitops.h -index be5fd38..5d858e0 100644 ---- a/include/linux/bitops.h -+++ b/include/linux/bitops.h -@@ -18,8 +18,11 @@ - * position @h. For example - * GENMASK_ULL(39, 21) gives us the 64bit vector 0x000000ffffe00000. - */ --#define GENMASK(h, l) (((U32_C(1) << ((h) - (l) + 1)) - 1) << (l)) --#define GENMASK_ULL(h, l) (((U64_C(1) << ((h) - (l) + 1)) - 1) << (l)) -+#define GENMASK(h, l) \ -+ (((~0UL) << (l)) & (~0UL >> (BITS_PER_LONG - 1 - (h)))) -+ -+#define GENMASK_ULL(h, l) \ -+ (((~0ULL) << (l)) & (~0ULL >> (BITS_PER_LONG_LONG - 1 - (h)))) - - extern unsigned int __sw_hweight8(unsigned int w); - extern unsigned int __sw_hweight16(unsigned int w); -diff --git a/include/linux/iio/events.h b/include/linux/iio/events.h -index 8bbd7bc..03fa332 100644 ---- a/include/linux/iio/events.h -+++ b/include/linux/iio/events.h -@@ -72,7 +72,7 @@ struct iio_event_data { - - #define IIO_EVENT_CODE_EXTRACT_TYPE(mask) ((mask >> 56) & 0xFF) - --#define IIO_EVENT_CODE_EXTRACT_DIR(mask) ((mask >> 48) & 0xCF) -+#define IIO_EVENT_CODE_EXTRACT_DIR(mask) ((mask >> 48) & 0x7F) - - #define IIO_EVENT_CODE_EXTRACT_CHAN_TYPE(mask) ((mask >> 32) & 0xFF) - -diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h -index 0068708..0a21fbe 100644 ---- a/include/linux/inetdevice.h -+++ b/include/linux/inetdevice.h -@@ -242,7 +242,7 @@ static inline void in_dev_put(struct in_device *idev) - static __inline__ __be32 inet_make_mask(int logmask) - { - if (logmask) -- return htonl(~((1<<(32-logmask))-1)); -+ return htonl(~((1U<<(32-logmask))-1)); - return 0; - } - -diff --git a/include/linux/pci.h b/include/linux/pci.h -index 33aa2ca..0e5e16c 100644 ---- a/include/linux/pci.h -+++ b/include/linux/pci.h -@@ -324,6 +324,7 @@ struct pci_dev { - unsigned int is_added:1; - unsigned int is_busmaster:1; /* device is busmaster */ - unsigned int no_msi:1; /* device may not use msi */ -+ unsigned int no_64bit_msi:1; /* device may only use 32-bit MSIs */ - unsigned int block_cfg_access:1; /* config space access is blocked */ - unsigned int broken_parity_status:1; /* Device generates false positive parity */ - unsigned int irq_reroute_variant:2; /* device needs IRQ rerouting variant */ -diff --git a/include/sound/soc-dpcm.h b/include/sound/soc-dpcm.h -index 2883a7a..98f2ade 100644 ---- a/include/sound/soc-dpcm.h -+++ b/include/sound/soc-dpcm.h -@@ -102,6 +102,8 @@ struct snd_soc_dpcm_runtime { - /* state and update */ - enum snd_soc_dpcm_update runtime_update; - enum snd_soc_dpcm_state state; -+ -+ int trigger_pending; /* trigger cmd + 1 if pending, 0 if not */ - }; - - /* can this BE stop and free */ -diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c -index 307d87c..1139b22 100644 ---- a/kernel/events/uprobes.c -+++ b/kernel/events/uprobes.c -@@ -1621,7 +1621,6 @@ bool uprobe_deny_signal(void) - if (__fatal_signal_pending(t) || arch_uprobe_xol_was_trapped(t)) { - utask->state = UTASK_SSTEP_TRAPPED; - set_tsk_thread_flag(t, TIF_UPROBE); -- set_tsk_thread_flag(t, TIF_NOTIFY_RESUME); - } - } - -diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c -index b851cc5..fbda6b5 100644 ---- a/net/batman-adv/hard-interface.c -+++ b/net/batman-adv/hard-interface.c -@@ -83,7 +83,7 @@ static bool batadv_is_on_batman_iface(const struct net_device *net_dev) - return true; - - /* no more parents..stop recursion */ -- if (net_dev->iflink == net_dev->ifindex) -+ if (net_dev->iflink == 0 || net_dev->iflink == net_dev->ifindex) - return false; - - /* recurse over the parent device */ -diff --git a/net/ipv4/fib_rules.c b/net/ipv4/fib_rules.c -index f2e1573..8f7bd56 100644 ---- a/net/ipv4/fib_rules.c -+++ b/net/ipv4/fib_rules.c -@@ -62,6 +62,10 @@ int __fib_lookup(struct net *net, struct flowi4 *flp, struct fib_result *res) - else - res->tclassid = 0; - #endif -+ -+ if (err == -ESRCH) -+ err = -ENETUNREACH; -+ - return err; - } - EXPORT_SYMBOL_GPL(__fib_lookup); -diff --git a/net/ipv4/ping.c b/net/ipv4/ping.c -index e21934b..0d33f94 100644 ---- a/net/ipv4/ping.c -+++ b/net/ipv4/ping.c -@@ -217,6 +217,8 @@ static struct sock *ping_lookup(struct net *net, struct sk_buff *skb, u16 ident) - &ipv6_hdr(skb)->daddr)) - continue; - #endif -+ } else { -+ continue; - } - - if (sk->sk_bound_dev_if && sk->sk_bound_dev_if != dif) -diff --git a/net/ipx/af_ipx.c b/net/ipx/af_ipx.c -index 00b2a6d..d65aea2 100644 ---- a/net/ipx/af_ipx.c -+++ b/net/ipx/af_ipx.c -@@ -1763,6 +1763,7 @@ static int ipx_recvmsg(struct kiocb *iocb, struct socket *sock, - struct ipxhdr *ipx = NULL; - struct sk_buff *skb; - int copied, rc; -+ bool locked = true; - - lock_sock(sk); - /* put the autobinding in */ -@@ -1789,6 +1790,8 @@ static int ipx_recvmsg(struct kiocb *iocb, struct socket *sock, - if (sock_flag(sk, SOCK_ZAPPED)) - goto out; - -+ release_sock(sk); -+ locked = false; - skb = skb_recv_datagram(sk, flags & ~MSG_DONTWAIT, - flags & MSG_DONTWAIT, &rc); - if (!skb) -@@ -1822,7 +1825,8 @@ static int ipx_recvmsg(struct kiocb *iocb, struct socket *sock, - out_free: - skb_free_datagram(sk, skb); - out: -- release_sock(sk); -+ if (locked) -+ release_sock(sk); - return rc; - } - -diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c -index 0fcbe90..12528e9 100644 ---- a/sound/soc/codecs/sgtl5000.c -+++ b/sound/soc/codecs/sgtl5000.c -@@ -1369,8 +1369,7 @@ static int sgtl5000_probe(struct snd_soc_codec *codec) - - /* enable small pop, introduce 400ms delay in turning off */ - snd_soc_update_bits(codec, SGTL5000_CHIP_REF_CTRL, -- SGTL5000_SMALL_POP, -- SGTL5000_SMALL_POP); -+ SGTL5000_SMALL_POP, 1); - - /* disable short cut detector */ - snd_soc_write(codec, SGTL5000_CHIP_SHORT_CTRL, 0); -diff --git a/sound/soc/codecs/sgtl5000.h b/sound/soc/codecs/sgtl5000.h -index 2f8c889..bd7a344 100644 ---- a/sound/soc/codecs/sgtl5000.h -+++ b/sound/soc/codecs/sgtl5000.h -@@ -275,7 +275,7 @@ - #define SGTL5000_BIAS_CTRL_MASK 0x000e - #define SGTL5000_BIAS_CTRL_SHIFT 1 - #define SGTL5000_BIAS_CTRL_WIDTH 3 --#define SGTL5000_SMALL_POP 0x0001 -+#define SGTL5000_SMALL_POP 0 - - /* - * SGTL5000_CHIP_MIC_CTRL -diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c -index 53c03af..0502e3f 100644 ---- a/sound/soc/codecs/wm_adsp.c -+++ b/sound/soc/codecs/wm_adsp.c -@@ -1341,6 +1341,7 @@ static int wm_adsp_load_coeff(struct wm_adsp *dsp) - file, blocks, pos - firmware->size); - - out_fw: -+ regmap_async_complete(regmap); - release_firmware(firmware); - wm_adsp_buf_free(&buf_list); - out: -diff --git a/sound/soc/sh/fsi.c b/sound/soc/sh/fsi.c -index 1967f44..9d0c59c 100644 ---- a/sound/soc/sh/fsi.c -+++ b/sound/soc/sh/fsi.c -@@ -1785,8 +1785,7 @@ static const struct snd_soc_dai_ops fsi_dai_ops = { - static struct snd_pcm_hardware fsi_pcm_hardware = { - .info = SNDRV_PCM_INFO_INTERLEAVED | - SNDRV_PCM_INFO_MMAP | -- SNDRV_PCM_INFO_MMAP_VALID | -- SNDRV_PCM_INFO_PAUSE, -+ SNDRV_PCM_INFO_MMAP_VALID, - .buffer_bytes_max = 64 * 1024, - .period_bytes_min = 32, - .period_bytes_max = 8192, -diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c -index 743de5e..37fcd93 100644 ---- a/sound/soc/sh/rcar/core.c -+++ b/sound/soc/sh/rcar/core.c -@@ -626,8 +626,7 @@ static void rsnd_dai_remove(struct platform_device *pdev, - static struct snd_pcm_hardware rsnd_pcm_hardware = { - .info = SNDRV_PCM_INFO_INTERLEAVED | - SNDRV_PCM_INFO_MMAP | -- SNDRV_PCM_INFO_MMAP_VALID | -- SNDRV_PCM_INFO_PAUSE, -+ SNDRV_PCM_INFO_MMAP_VALID, - .buffer_bytes_max = 64 * 1024, - .period_bytes_min = 32, - .period_bytes_max = 8192, -diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c -index 02733de..e28704e 100644 ---- a/sound/soc/soc-pcm.c -+++ b/sound/soc/soc-pcm.c -@@ -1258,13 +1258,36 @@ static void dpcm_set_fe_runtime(struct snd_pcm_substream *substream) - dpcm_init_runtime_hw(runtime, &cpu_dai_drv->capture); - } - -+static int dpcm_fe_dai_do_trigger(struct snd_pcm_substream *substream, int cmd); -+ -+/* Set FE's runtime_update state; the state is protected via PCM stream lock -+ * for avoiding the race with trigger callback. -+ * If the state is unset and a trigger is pending while the previous operation, -+ * process the pending trigger action here. -+ */ -+static void dpcm_set_fe_update_state(struct snd_soc_pcm_runtime *fe, -+ int stream, enum snd_soc_dpcm_update state) -+{ -+ struct snd_pcm_substream *substream = -+ snd_soc_dpcm_get_substream(fe, stream); -+ -+ snd_pcm_stream_lock_irq(substream); -+ if (state == SND_SOC_DPCM_UPDATE_NO && fe->dpcm[stream].trigger_pending) { -+ dpcm_fe_dai_do_trigger(substream, -+ fe->dpcm[stream].trigger_pending - 1); -+ fe->dpcm[stream].trigger_pending = 0; -+ } -+ fe->dpcm[stream].runtime_update = state; -+ snd_pcm_stream_unlock_irq(substream); -+} -+ - static int dpcm_fe_dai_startup(struct snd_pcm_substream *fe_substream) - { - struct snd_soc_pcm_runtime *fe = fe_substream->private_data; - struct snd_pcm_runtime *runtime = fe_substream->runtime; - int stream = fe_substream->stream, ret = 0; - -- fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_FE; -+ dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); - - ret = dpcm_be_dai_startup(fe, fe_substream->stream); - if (ret < 0) { -@@ -1286,13 +1309,13 @@ static int dpcm_fe_dai_startup(struct snd_pcm_substream *fe_substream) - dpcm_set_fe_runtime(fe_substream); - snd_pcm_limit_hw_rates(runtime); - -- fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO; -+ dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); - return 0; - - unwind: - dpcm_be_dai_startup_unwind(fe, fe_substream->stream); - be_err: -- fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO; -+ dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); - return ret; - } - -@@ -1339,7 +1362,7 @@ static int dpcm_fe_dai_shutdown(struct snd_pcm_substream *substream) - struct snd_soc_pcm_runtime *fe = substream->private_data; - int stream = substream->stream; - -- fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_FE; -+ dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); - - /* shutdown the BEs */ - dpcm_be_dai_shutdown(fe, substream->stream); -@@ -1353,7 +1376,7 @@ static int dpcm_fe_dai_shutdown(struct snd_pcm_substream *substream) - dpcm_dapm_stream_event(fe, stream, SND_SOC_DAPM_STREAM_STOP); - - fe->dpcm[stream].state = SND_SOC_DPCM_STATE_CLOSE; -- fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO; -+ dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); - return 0; - } - -@@ -1401,7 +1424,7 @@ static int dpcm_fe_dai_hw_free(struct snd_pcm_substream *substream) - int err, stream = substream->stream; - - mutex_lock_nested(&fe->card->mutex, SND_SOC_CARD_CLASS_RUNTIME); -- fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_FE; -+ dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); - - dev_dbg(fe->dev, "ASoC: hw_free FE %s\n", fe->dai_link->name); - -@@ -1416,7 +1439,7 @@ static int dpcm_fe_dai_hw_free(struct snd_pcm_substream *substream) - err = dpcm_be_dai_hw_free(fe, stream); - - fe->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_FREE; -- fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO; -+ dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); - - mutex_unlock(&fe->card->mutex); - return 0; -@@ -1509,7 +1532,7 @@ static int dpcm_fe_dai_hw_params(struct snd_pcm_substream *substream, - int ret, stream = substream->stream; - - mutex_lock_nested(&fe->card->mutex, SND_SOC_CARD_CLASS_RUNTIME); -- fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_FE; -+ dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); - - memcpy(&fe->dpcm[substream->stream].hw_params, params, - sizeof(struct snd_pcm_hw_params)); -@@ -1532,7 +1555,7 @@ static int dpcm_fe_dai_hw_params(struct snd_pcm_substream *substream, - fe->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_PARAMS; - - out: -- fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO; -+ dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); - mutex_unlock(&fe->card->mutex); - return ret; - } -@@ -1646,7 +1669,7 @@ int dpcm_be_dai_trigger(struct snd_soc_pcm_runtime *fe, int stream, - } - EXPORT_SYMBOL_GPL(dpcm_be_dai_trigger); - --static int dpcm_fe_dai_trigger(struct snd_pcm_substream *substream, int cmd) -+static int dpcm_fe_dai_do_trigger(struct snd_pcm_substream *substream, int cmd) - { - struct snd_soc_pcm_runtime *fe = substream->private_data; - int stream = substream->stream, ret; -@@ -1720,6 +1743,23 @@ out: - return ret; - } - -+static int dpcm_fe_dai_trigger(struct snd_pcm_substream *substream, int cmd) -+{ -+ struct snd_soc_pcm_runtime *fe = substream->private_data; -+ int stream = substream->stream; -+ -+ /* if FE's runtime_update is already set, we're in race; -+ * process this trigger later at exit -+ */ -+ if (fe->dpcm[stream].runtime_update != SND_SOC_DPCM_UPDATE_NO) { -+ fe->dpcm[stream].trigger_pending = cmd + 1; -+ return 0; /* delayed, assuming it's successful */ -+ } -+ -+ /* we're alone, let's trigger */ -+ return dpcm_fe_dai_do_trigger(substream, cmd); -+} -+ - int dpcm_be_dai_prepare(struct snd_soc_pcm_runtime *fe, int stream) - { - struct snd_soc_dpcm *dpcm; -@@ -1763,7 +1803,7 @@ static int dpcm_fe_dai_prepare(struct snd_pcm_substream *substream) - - dev_dbg(fe->dev, "ASoC: prepare FE %s\n", fe->dai_link->name); - -- fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_FE; -+ dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); - - /* there is no point preparing this FE if there are no BEs */ - if (list_empty(&fe->dpcm[stream].be_clients)) { -@@ -1790,7 +1830,7 @@ static int dpcm_fe_dai_prepare(struct snd_pcm_substream *substream) - fe->dpcm[stream].state = SND_SOC_DPCM_STATE_PREPARE; - - out: -- fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO; -+ dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); - mutex_unlock(&fe->card->mutex); - - return ret; -@@ -1937,11 +1977,11 @@ static int dpcm_run_new_update(struct snd_soc_pcm_runtime *fe, int stream) - { - int ret; - -- fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_BE; -+ dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_BE); - ret = dpcm_run_update_startup(fe, stream); - if (ret < 0) - dev_err(fe->dev, "ASoC: failed to startup some BEs\n"); -- fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO; -+ dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); - - return ret; - } -@@ -1950,11 +1990,11 @@ static int dpcm_run_old_update(struct snd_soc_pcm_runtime *fe, int stream) - { - int ret; - -- fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_BE; -+ dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_BE); - ret = dpcm_run_update_shutdown(fe, stream); - if (ret < 0) - dev_err(fe->dev, "ASoC: failed to shutdown some BEs\n"); -- fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO; -+ dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); - - return ret; - } -diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c -index c64a3d9..827d404 100644 ---- a/sound/usb/quirks.c -+++ b/sound/usb/quirks.c -@@ -1142,6 +1142,20 @@ void snd_usb_ctl_msg_quirk(struct usb_device *dev, unsigned int pipe, - if ((le16_to_cpu(dev->descriptor.idVendor) == 0x23ba) && - (requesttype & USB_TYPE_MASK) == USB_TYPE_CLASS) - mdelay(20); -+ -+ /* Marantz/Denon devices with USB DAC functionality need a delay -+ * after each class compliant request -+ */ -+ if ((le16_to_cpu(dev->descriptor.idVendor) == 0x154e) && -+ (requesttype & USB_TYPE_MASK) == USB_TYPE_CLASS) { -+ -+ switch (le16_to_cpu(dev->descriptor.idProduct)) { -+ case 0x3005: /* Marantz HD-DAC1 */ -+ case 0x3006: /* Marantz SA-14S1 */ -+ mdelay(20); -+ break; -+ } -+ } - } - - /* diff --git a/projects/imx6/patches/linux/linux-000-patch-3.14.26-27.patch b/projects/imx6/patches/linux/linux-000-patch-3.14.26-27.patch deleted file mode 100644 index e788ebdba2d..00000000000 --- a/projects/imx6/patches/linux/linux-000-patch-3.14.26-27.patch +++ /dev/null @@ -1,914 +0,0 @@ -diff --git a/Makefile b/Makefile -index 63a5ee8..944db23 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,6 +1,6 @@ - VERSION = 3 - PATCHLEVEL = 14 --SUBLEVEL = 26 -+SUBLEVEL = 27 - EXTRAVERSION = - NAME = Remembering Coco - -diff --git a/arch/powerpc/kernel/vdso32/getcpu.S b/arch/powerpc/kernel/vdso32/getcpu.S -index 47afd08..fe7e97a 100644 ---- a/arch/powerpc/kernel/vdso32/getcpu.S -+++ b/arch/powerpc/kernel/vdso32/getcpu.S -@@ -30,8 +30,8 @@ - V_FUNCTION_BEGIN(__kernel_getcpu) - .cfi_startproc - mfspr r5,SPRN_USPRG3 -- cmpdi cr0,r3,0 -- cmpdi cr1,r4,0 -+ cmpwi cr0,r3,0 -+ cmpwi cr1,r4,0 - clrlwi r6,r5,16 - rlwinm r7,r5,16,31-15,31-0 - beq cr0,1f -diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile -index 14fe7cb..b5bb498 100644 ---- a/arch/x86/boot/compressed/Makefile -+++ b/arch/x86/boot/compressed/Makefile -@@ -75,7 +75,7 @@ suffix-$(CONFIG_KERNEL_XZ) := xz - suffix-$(CONFIG_KERNEL_LZO) := lzo - suffix-$(CONFIG_KERNEL_LZ4) := lz4 - --RUN_SIZE = $(shell objdump -h vmlinux | \ -+RUN_SIZE = $(shell $(OBJDUMP) -h vmlinux | \ - perl $(srctree)/arch/x86/tools/calc_run_size.pl) - quiet_cmd_mkpiggy = MKPIGGY $@ - cmd_mkpiggy = $(obj)/mkpiggy $< $(RUN_SIZE) > $@ || ( rm -f $@ ; false ) -diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c -index 79f9f84..fb345c4 100644 ---- a/arch/x86/kernel/cpu/perf_event.c -+++ b/arch/x86/kernel/cpu/perf_event.c -@@ -118,6 +118,9 @@ static int x86_pmu_extra_regs(u64 config, struct perf_event *event) - continue; - if (event->attr.config1 & ~er->valid_mask) - return -EINVAL; -+ /* Check if the extra msrs can be safely accessed*/ -+ if (!er->extra_msr_access) -+ return -ENXIO; - - reg->idx = er->idx; - reg->config = event->attr.config1; -diff --git a/arch/x86/kernel/cpu/perf_event.h b/arch/x86/kernel/cpu/perf_event.h -index 4972c24..7876c34 100644 ---- a/arch/x86/kernel/cpu/perf_event.h -+++ b/arch/x86/kernel/cpu/perf_event.h -@@ -293,14 +293,16 @@ struct extra_reg { - u64 config_mask; - u64 valid_mask; - int idx; /* per_xxx->regs[] reg index */ -+ bool extra_msr_access; - }; - - #define EVENT_EXTRA_REG(e, ms, m, vm, i) { \ -- .event = (e), \ -- .msr = (ms), \ -- .config_mask = (m), \ -- .valid_mask = (vm), \ -- .idx = EXTRA_REG_##i, \ -+ .event = (e), \ -+ .msr = (ms), \ -+ .config_mask = (m), \ -+ .valid_mask = (vm), \ -+ .idx = EXTRA_REG_##i, \ -+ .extra_msr_access = true, \ - } - - #define INTEL_EVENT_EXTRA_REG(event, msr, vm, idx) \ -diff --git a/arch/x86/kernel/cpu/perf_event_intel.c b/arch/x86/kernel/cpu/perf_event_intel.c -index 5ee8064..d4c0a0e 100644 ---- a/arch/x86/kernel/cpu/perf_event_intel.c -+++ b/arch/x86/kernel/cpu/perf_event_intel.c -@@ -2183,6 +2183,41 @@ static void intel_snb_check_microcode(void) - } - } - -+/* -+ * Under certain circumstances, access certain MSR may cause #GP. -+ * The function tests if the input MSR can be safely accessed. -+ */ -+static bool check_msr(unsigned long msr, u64 mask) -+{ -+ u64 val_old, val_new, val_tmp; -+ -+ /* -+ * Read the current value, change it and read it back to see if it -+ * matches, this is needed to detect certain hardware emulators -+ * (qemu/kvm) that don't trap on the MSR access and always return 0s. -+ */ -+ if (rdmsrl_safe(msr, &val_old)) -+ return false; -+ -+ /* -+ * Only change the bits which can be updated by wrmsrl. -+ */ -+ val_tmp = val_old ^ mask; -+ if (wrmsrl_safe(msr, val_tmp) || -+ rdmsrl_safe(msr, &val_new)) -+ return false; -+ -+ if (val_new != val_tmp) -+ return false; -+ -+ /* Here it's sure that the MSR can be safely accessed. -+ * Restore the old value and return. -+ */ -+ wrmsrl(msr, val_old); -+ -+ return true; -+} -+ - static __init void intel_sandybridge_quirk(void) - { - x86_pmu.check_microcode = intel_snb_check_microcode; -@@ -2272,7 +2307,8 @@ __init int intel_pmu_init(void) - union cpuid10_ebx ebx; - struct event_constraint *c; - unsigned int unused; -- int version; -+ struct extra_reg *er; -+ int version, i; - - if (!cpu_has(&boot_cpu_data, X86_FEATURE_ARCH_PERFMON)) { - switch (boot_cpu_data.x86) { -@@ -2578,6 +2614,34 @@ __init int intel_pmu_init(void) - } - } - -+ /* -+ * Access LBR MSR may cause #GP under certain circumstances. -+ * E.g. KVM doesn't support LBR MSR -+ * Check all LBT MSR here. -+ * Disable LBR access if any LBR MSRs can not be accessed. -+ */ -+ if (x86_pmu.lbr_nr && !check_msr(x86_pmu.lbr_tos, 0x3UL)) -+ x86_pmu.lbr_nr = 0; -+ for (i = 0; i < x86_pmu.lbr_nr; i++) { -+ if (!(check_msr(x86_pmu.lbr_from + i, 0xffffUL) && -+ check_msr(x86_pmu.lbr_to + i, 0xffffUL))) -+ x86_pmu.lbr_nr = 0; -+ } -+ -+ /* -+ * Access extra MSR may cause #GP under certain circumstances. -+ * E.g. KVM doesn't support offcore event -+ * Check all extra_regs here. -+ */ -+ if (x86_pmu.extra_regs) { -+ for (er = x86_pmu.extra_regs; er->msr; er++) { -+ er->extra_msr_access = check_msr(er->msr, 0x1ffUL); -+ /* Disable LBR select mapping */ -+ if ((er->idx == EXTRA_REG_LBR) && !er->extra_msr_access) -+ x86_pmu.lbr_sel_map = NULL; -+ } -+ } -+ - /* Support full width counters using alternative MSR range */ - if (x86_pmu.intel_cap.full_width_write) { - x86_pmu.max_period = x86_pmu.cntval_mask; -diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c -index e662f14..cc5f102 100644 ---- a/drivers/ata/ahci.c -+++ b/drivers/ata/ahci.c -@@ -322,6 +322,9 @@ static const struct pci_device_id ahci_pci_tbl[] = { - { PCI_VDEVICE(INTEL, 0x8c87), board_ahci }, /* 9 Series RAID */ - { PCI_VDEVICE(INTEL, 0x8c8e), board_ahci }, /* 9 Series RAID */ - { PCI_VDEVICE(INTEL, 0x8c8f), board_ahci }, /* 9 Series RAID */ -+ { PCI_VDEVICE(INTEL, 0x9d03), board_ahci }, /* Sunrise Point-LP AHCI */ -+ { PCI_VDEVICE(INTEL, 0x9d05), board_ahci }, /* Sunrise Point-LP RAID */ -+ { PCI_VDEVICE(INTEL, 0x9d07), board_ahci }, /* Sunrise Point-LP RAID */ - { PCI_VDEVICE(INTEL, 0xa103), board_ahci }, /* Sunrise Point-H AHCI */ - { PCI_VDEVICE(INTEL, 0xa103), board_ahci }, /* Sunrise Point-H RAID */ - { PCI_VDEVICE(INTEL, 0xa105), board_ahci }, /* Sunrise Point-H RAID */ -@@ -493,6 +496,7 @@ static const struct pci_device_id ahci_pci_tbl[] = { - * enabled. https://bugzilla.kernel.org/show_bug.cgi?id=60731 - */ - { PCI_VDEVICE(SAMSUNG, 0x1600), board_ahci_nomsi }, -+ { PCI_VDEVICE(SAMSUNG, 0xa800), board_ahci_nomsi }, - - /* Enmotus */ - { PCI_DEVICE(0x1c44, 0x8000), board_ahci }, -diff --git a/drivers/ata/sata_fsl.c b/drivers/ata/sata_fsl.c -index fb0b40a..ee2780d 100644 ---- a/drivers/ata/sata_fsl.c -+++ b/drivers/ata/sata_fsl.c -@@ -1503,7 +1503,7 @@ static int sata_fsl_probe(struct platform_device *ofdev) - host_priv->csr_base = csr_base; - - irq = irq_of_parse_and_map(ofdev->dev.of_node, 0); -- if (irq < 0) { -+ if (!irq) { - dev_err(&ofdev->dev, "invalid irq from platform\n"); - goto error_exit_with_cleanup; - } -diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c -index b6fb3eb..c514690 100644 ---- a/drivers/gpu/drm/i915/intel_display.c -+++ b/drivers/gpu/drm/i915/intel_display.c -@@ -3817,7 +3817,6 @@ static void ironlake_crtc_disable(struct drm_crtc *crtc) - ironlake_fdi_disable(crtc); - - ironlake_disable_pch_transcoder(dev_priv, pipe); -- intel_set_pch_fifo_underrun_reporting(dev, pipe, true); - - if (HAS_PCH_CPT(dev)) { - /* disable TRANS_DP_CTL */ -@@ -3883,7 +3882,6 @@ static void haswell_crtc_disable(struct drm_crtc *crtc) - - if (intel_crtc->config.has_pch_encoder) { - lpt_disable_pch_transcoder(dev_priv); -- intel_set_pch_fifo_underrun_reporting(dev, TRANSCODER_A, true); - intel_ddi_fdi_disable(crtc); - } - -diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c -index 67c9ff3..af49b24 100644 ---- a/drivers/gpu/drm/i915/intel_lvds.c -+++ b/drivers/gpu/drm/i915/intel_lvds.c -@@ -905,6 +905,17 @@ void intel_lvds_init(struct drm_device *dev) - int pipe; - u8 pin; - -+ /* -+ * Unlock registers and just leave them unlocked. Do this before -+ * checking quirk lists to avoid bogus WARNINGs. -+ */ -+ if (HAS_PCH_SPLIT(dev)) { -+ I915_WRITE(PCH_PP_CONTROL, -+ I915_READ(PCH_PP_CONTROL) | PANEL_UNLOCK_REGS); -+ } else { -+ I915_WRITE(PP_CONTROL, -+ I915_READ(PP_CONTROL) | PANEL_UNLOCK_REGS); -+ } - if (!intel_lvds_supported(dev)) - return; - -@@ -1099,17 +1110,6 @@ out: - DRM_DEBUG_KMS("detected %s-link lvds configuration\n", - lvds_encoder->is_dual_link ? "dual" : "single"); - -- /* -- * Unlock registers and just -- * leave them unlocked -- */ -- if (HAS_PCH_SPLIT(dev)) { -- I915_WRITE(PCH_PP_CONTROL, -- I915_READ(PCH_PP_CONTROL) | PANEL_UNLOCK_REGS); -- } else { -- I915_WRITE(PP_CONTROL, -- I915_READ(PP_CONTROL) | PANEL_UNLOCK_REGS); -- } - lvds_connector->lid_notifier.notifier_call = intel_lid_notify; - if (acpi_lid_notifier_register(&lvds_connector->lid_notifier)) { - DRM_DEBUG_KMS("lid notifier registration failed\n"); -diff --git a/drivers/gpu/drm/radeon/radeon_kms.c b/drivers/gpu/drm/radeon/radeon_kms.c -index 0bc9106..6bffe82 100644 ---- a/drivers/gpu/drm/radeon/radeon_kms.c -+++ b/drivers/gpu/drm/radeon/radeon_kms.c -@@ -740,6 +740,8 @@ int radeon_get_vblank_timestamp_kms(struct drm_device *dev, int crtc, - - /* Get associated drm_crtc: */ - drmcrtc = &rdev->mode_info.crtcs[crtc]->base; -+ if (!drmcrtc) -+ return -EINVAL; - - /* Helper routine in DRM core does all the work: */ - return drm_calc_vbltimestamp_from_scanoutpos(dev, crtc, max_error, -diff --git a/drivers/i2c/busses/i2c-davinci.c b/drivers/i2c/busses/i2c-davinci.c -index af0b583..e3c6a96 100644 ---- a/drivers/i2c/busses/i2c-davinci.c -+++ b/drivers/i2c/busses/i2c-davinci.c -@@ -411,11 +411,9 @@ i2c_davinci_xfer_msg(struct i2c_adapter *adap, struct i2c_msg *msg, int stop) - if (dev->cmd_err & DAVINCI_I2C_STR_NACK) { - if (msg->flags & I2C_M_IGNORE_NAK) - return msg->len; -- if (stop) { -- w = davinci_i2c_read_reg(dev, DAVINCI_I2C_MDR_REG); -- w |= DAVINCI_I2C_MDR_STP; -- davinci_i2c_write_reg(dev, DAVINCI_I2C_MDR_REG, w); -- } -+ w = davinci_i2c_read_reg(dev, DAVINCI_I2C_MDR_REG); -+ w |= DAVINCI_I2C_MDR_STP; -+ davinci_i2c_write_reg(dev, DAVINCI_I2C_MDR_REG, w); - return -EREMOTEIO; - } - return -EIO; -diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c -index 90dcc2e..a686057 100644 ---- a/drivers/i2c/busses/i2c-omap.c -+++ b/drivers/i2c/busses/i2c-omap.c -@@ -926,14 +926,12 @@ omap_i2c_isr_thread(int this_irq, void *dev_id) - if (stat & OMAP_I2C_STAT_NACK) { - err |= OMAP_I2C_STAT_NACK; - omap_i2c_ack_stat(dev, OMAP_I2C_STAT_NACK); -- break; - } - - if (stat & OMAP_I2C_STAT_AL) { - dev_err(dev->dev, "Arbitration lost\n"); - err |= OMAP_I2C_STAT_AL; - omap_i2c_ack_stat(dev, OMAP_I2C_STAT_AL); -- break; - } - - /* -@@ -958,11 +956,13 @@ omap_i2c_isr_thread(int this_irq, void *dev_id) - if (dev->fifo_size) - num_bytes = dev->buf_len; - -- omap_i2c_receive_data(dev, num_bytes, true); -- -- if (dev->errata & I2C_OMAP_ERRATA_I207) -+ if (dev->errata & I2C_OMAP_ERRATA_I207) { - i2c_omap_errata_i207(dev, stat); -+ num_bytes = (omap_i2c_read_reg(dev, -+ OMAP_I2C_BUFSTAT_REG) >> 8) & 0x3F; -+ } - -+ omap_i2c_receive_data(dev, num_bytes, true); - omap_i2c_ack_stat(dev, OMAP_I2C_STAT_RDR); - continue; - } -diff --git a/drivers/media/i2c/smiapp/smiapp-core.c b/drivers/media/i2c/smiapp/smiapp-core.c -index 8741cae..7026ab0 100644 ---- a/drivers/media/i2c/smiapp/smiapp-core.c -+++ b/drivers/media/i2c/smiapp/smiapp-core.c -@@ -2138,7 +2138,7 @@ static int smiapp_set_selection(struct v4l2_subdev *subdev, - ret = smiapp_set_compose(subdev, fh, sel); - break; - default: -- BUG(); -+ ret = -EINVAL; - } - - mutex_unlock(&sensor->mutex); -diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c -index 9373f1f..086eac5 100644 ---- a/drivers/net/ethernet/broadcom/tg3.c -+++ b/drivers/net/ethernet/broadcom/tg3.c -@@ -8548,7 +8548,8 @@ static int tg3_init_rings(struct tg3 *tp) - if (tnapi->rx_rcb) - memset(tnapi->rx_rcb, 0, TG3_RX_RCB_RING_BYTES(tp)); - -- if (tg3_rx_prodring_alloc(tp, &tnapi->prodring)) { -+ if (tnapi->prodring.rx_std && -+ tg3_rx_prodring_alloc(tp, &tnapi->prodring)) { - tg3_free_rings(tp); - return -ENOMEM; - } -diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c -index 5ca8c47..206e79d 100644 ---- a/drivers/net/ethernet/intel/igb/igb_main.c -+++ b/drivers/net/ethernet/intel/igb/igb_main.c -@@ -1613,6 +1613,8 @@ void igb_power_up_link(struct igb_adapter *adapter) - igb_power_up_phy_copper(&adapter->hw); - else - igb_power_up_serdes_link_82575(&adapter->hw); -+ -+ igb_setup_link(&adapter->hw); - } - - /** -diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c -index c4c00d9f..96fc7fe 100644 ---- a/drivers/net/ethernet/marvell/mvneta.c -+++ b/drivers/net/ethernet/marvell/mvneta.c -@@ -213,7 +213,7 @@ - /* Various constants */ - - /* Coalescing */ --#define MVNETA_TXDONE_COAL_PKTS 16 -+#define MVNETA_TXDONE_COAL_PKTS 1 - #define MVNETA_RX_COAL_PKTS 32 - #define MVNETA_RX_COAL_USEC 100 - -@@ -1612,6 +1612,7 @@ static int mvneta_tx(struct sk_buff *skb, struct net_device *dev) - u16 txq_id = skb_get_queue_mapping(skb); - struct mvneta_tx_queue *txq = &pp->txqs[txq_id]; - struct mvneta_tx_desc *tx_desc; -+ int len = skb->len; - struct netdev_queue *nq; - int frags = 0; - u32 tx_cmd; -@@ -1675,7 +1676,7 @@ out: - - u64_stats_update_begin(&stats->syncp); - stats->tx_packets++; -- stats->tx_bytes += skb->len; -+ stats->tx_bytes += len; - u64_stats_update_end(&stats->syncp); - } else { - dev->stats.tx_dropped++; -diff --git a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c -index 57428a0..1e8a4b4 100644 ---- a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c -+++ b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c -@@ -1456,7 +1456,7 @@ static int qp_alloc_res(struct mlx4_dev *dev, int slave, int op, int cmd, - - switch (op) { - case RES_OP_RESERVE: -- count = get_param_l(&in_param); -+ count = get_param_l(&in_param) & 0xffffff; - align = get_param_h(&in_param); - err = mlx4_grant_resource(dev, slave, RES_QP, count, 0); - if (err) -diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c -index 5441b49..5988910 100644 ---- a/drivers/net/vxlan.c -+++ b/drivers/net/vxlan.c -@@ -2106,9 +2106,8 @@ static int vxlan_init(struct net_device *dev) - spin_lock(&vn->sock_lock); - vs = vxlan_find_sock(dev_net(dev), ipv6 ? AF_INET6 : AF_INET, - vxlan->dst_port); -- if (vs) { -+ if (vs && atomic_add_unless(&vs->refcnt, 1, 0)) { - /* If we have a socket with same port already, reuse it */ -- atomic_inc(&vs->refcnt); - vxlan_vs_add_dev(vs, vxlan); - } else { - /* otherwise make new socket outside of RTNL */ -@@ -2574,12 +2573,9 @@ struct vxlan_sock *vxlan_sock_add(struct net *net, __be16 port, - - spin_lock(&vn->sock_lock); - vs = vxlan_find_sock(net, ipv6 ? AF_INET6 : AF_INET, port); -- if (vs) { -- if (vs->rcv == rcv) -- atomic_inc(&vs->refcnt); -- else -+ if (vs && ((vs->rcv != rcv) || -+ !atomic_add_unless(&vs->refcnt, 1, 0))) - vs = ERR_PTR(-EBUSY); -- } - spin_unlock(&vn->sock_lock); - - if (!vs) -diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c -index e30d800..19db057 100644 ---- a/drivers/net/xen-netfront.c -+++ b/drivers/net/xen-netfront.c -@@ -469,9 +469,6 @@ static void xennet_make_frags(struct sk_buff *skb, struct net_device *dev, - len = skb_frag_size(frag); - offset = frag->page_offset; - -- /* Data must not cross a page boundary. */ -- BUG_ON(len + offset > PAGE_SIZE<<compound_order(page)); -- - /* Skip unused frames from start of page */ - page += offset >> PAGE_SHIFT; - offset &= ~PAGE_MASK; -@@ -479,8 +476,6 @@ static void xennet_make_frags(struct sk_buff *skb, struct net_device *dev, - while (len > 0) { - unsigned long bytes; - -- BUG_ON(offset >= PAGE_SIZE); -- - bytes = PAGE_SIZE - offset; - if (bytes > len) - bytes = len; -diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c -index 1710a86..faa8b98 100644 ---- a/drivers/usb/host/xhci-ring.c -+++ b/drivers/usb/host/xhci-ring.c -@@ -1998,22 +1998,13 @@ static int finish_td(struct xhci_hcd *xhci, struct xhci_td *td, - ep->stopped_td = td; - return 0; - } else { -- if (trb_comp_code == COMP_STALL) { -- /* The transfer is completed from the driver's -- * perspective, but we need to issue a set dequeue -- * command for this stalled endpoint to move the dequeue -- * pointer past the TD. We can't do that here because -- * the halt condition must be cleared first. Let the -- * USB class driver clear the stall later. -- */ -- ep->stopped_td = td; -- ep->stopped_stream = ep_ring->stream_id; -- } else if (xhci_requires_manual_halt_cleanup(xhci, -- ep_ctx, trb_comp_code)) { -- /* Other types of errors halt the endpoint, but the -- * class driver doesn't call usb_reset_endpoint() unless -- * the error is -EPIPE. Clear the halted status in the -- * xHCI hardware manually. -+ if (trb_comp_code == COMP_STALL || -+ xhci_requires_manual_halt_cleanup(xhci, ep_ctx, -+ trb_comp_code)) { -+ /* Issue a reset endpoint command to clear the host side -+ * halt, followed by a set dequeue command to move the -+ * dequeue pointer past the TD. -+ * The class driver clears the device side halt later. - */ - xhci_cleanup_halted_endpoint(xhci, - slot_id, ep_index, ep_ring->stream_id, -@@ -2133,9 +2124,7 @@ static int process_ctrl_td(struct xhci_hcd *xhci, struct xhci_td *td, - else - td->urb->actual_length = 0; - -- xhci_cleanup_halted_endpoint(xhci, -- slot_id, ep_index, 0, td, event_trb); -- return finish_td(xhci, td, event_trb, event, ep, status, true); -+ return finish_td(xhci, td, event_trb, event, ep, status, false); - } - /* - * Did we transfer any data, despite the errors that might have -@@ -2689,17 +2678,8 @@ cleanup: - if (ret) { - urb = td->urb; - urb_priv = urb->hcpriv; -- /* Leave the TD around for the reset endpoint function -- * to use(but only if it's not a control endpoint, -- * since we already queued the Set TR dequeue pointer -- * command for stalled control endpoints). -- */ -- if (usb_endpoint_xfer_control(&urb->ep->desc) || -- (trb_comp_code != COMP_STALL && -- trb_comp_code != COMP_BABBLE)) -- xhci_urb_free_priv(xhci, urb_priv); -- else -- kfree(urb_priv); -+ -+ xhci_urb_free_priv(xhci, urb_priv); - - usb_hcd_unlink_urb_from_ep(bus_to_hcd(urb->dev->bus), urb); - if ((urb->actual_length != urb->transfer_buffer_length && -diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c -index 17e3987..16f4f8d 100644 ---- a/drivers/usb/host/xhci.c -+++ b/drivers/usb/host/xhci.c -@@ -2925,63 +2925,33 @@ void xhci_cleanup_stalled_ring(struct xhci_hcd *xhci, - } - } - --/* Deal with stalled endpoints. The core should have sent the control message -- * to clear the halt condition. However, we need to make the xHCI hardware -- * reset its sequence number, since a device will expect a sequence number of -- * zero after the halt condition is cleared. -+/* Called when clearing halted device. The core should have sent the control -+ * message to clear the device halt condition. The host side of the halt should -+ * already be cleared with a reset endpoint command issued when the STALL tx -+ * event was received. -+ * - * Context: in_interrupt - */ -+ - void xhci_endpoint_reset(struct usb_hcd *hcd, - struct usb_host_endpoint *ep) - { - struct xhci_hcd *xhci; -- struct usb_device *udev; -- unsigned int ep_index; -- unsigned long flags; -- int ret; -- struct xhci_virt_ep *virt_ep; - - xhci = hcd_to_xhci(hcd); -- udev = (struct usb_device *) ep->hcpriv; -- /* Called with a root hub endpoint (or an endpoint that wasn't added -- * with xhci_add_endpoint() -- */ -- if (!ep->hcpriv) -- return; -- ep_index = xhci_get_endpoint_index(&ep->desc); -- virt_ep = &xhci->devs[udev->slot_id]->eps[ep_index]; -- if (!virt_ep->stopped_td) { -- xhci_dbg_trace(xhci, trace_xhci_dbg_reset_ep, -- "Endpoint 0x%x not halted, refusing to reset.", -- ep->desc.bEndpointAddress); -- return; -- } -- if (usb_endpoint_xfer_control(&ep->desc)) { -- xhci_dbg_trace(xhci, trace_xhci_dbg_reset_ep, -- "Control endpoint stall already handled."); -- return; -- } - -- xhci_dbg_trace(xhci, trace_xhci_dbg_reset_ep, -- "Queueing reset endpoint command"); -- spin_lock_irqsave(&xhci->lock, flags); -- ret = xhci_queue_reset_ep(xhci, udev->slot_id, ep_index); - /* -- * Can't change the ring dequeue pointer until it's transitioned to the -- * stopped state, which is only upon a successful reset endpoint -- * command. Better hope that last command worked! -+ * We might need to implement the config ep cmd in xhci 4.8.1 note: -+ * The Reset Endpoint Command may only be issued to endpoints in the -+ * Halted state. If software wishes reset the Data Toggle or Sequence -+ * Number of an endpoint that isn't in the Halted state, then software -+ * may issue a Configure Endpoint Command with the Drop and Add bits set -+ * for the target endpoint. that is in the Stopped state. - */ -- if (!ret) { -- xhci_cleanup_stalled_ring(xhci, udev, ep_index); -- kfree(virt_ep->stopped_td); -- xhci_ring_cmd_db(xhci); -- } -- virt_ep->stopped_td = NULL; -- virt_ep->stopped_stream = 0; -- spin_unlock_irqrestore(&xhci->lock, flags); - -- if (ret) -- xhci_warn(xhci, "FIXME allocate a new ring segment\n"); -+ /* For now just print debug to follow the situation */ -+ xhci_dbg(xhci, "Endpoint 0x%x ep reset callback called\n", -+ ep->desc.bEndpointAddress); - } - - static int xhci_check_streams_endpoint(struct xhci_hcd *xhci, -diff --git a/mm/frontswap.c b/mm/frontswap.c -index c30eec5..f2a3571 100644 ---- a/mm/frontswap.c -+++ b/mm/frontswap.c -@@ -244,8 +244,10 @@ int __frontswap_store(struct page *page) - the (older) page from frontswap - */ - inc_frontswap_failed_stores(); -- if (dup) -+ if (dup) { - __frontswap_clear(sis, offset); -+ frontswap_ops->invalidate_page(type, offset); -+ } - } - if (frontswap_writethrough_enabled) - /* report failure so swap also writes to swap device */ -diff --git a/mm/memory.c b/mm/memory.c -index 492e36f..48d7365 100644 ---- a/mm/memory.c -+++ b/mm/memory.c -@@ -808,20 +808,20 @@ copy_one_pte(struct mm_struct *dst_mm, struct mm_struct *src_mm, - if (!pte_file(pte)) { - swp_entry_t entry = pte_to_swp_entry(pte); - -- if (swap_duplicate(entry) < 0) -- return entry.val; -- -- /* make sure dst_mm is on swapoff's mmlist. */ -- if (unlikely(list_empty(&dst_mm->mmlist))) { -- spin_lock(&mmlist_lock); -- if (list_empty(&dst_mm->mmlist)) -- list_add(&dst_mm->mmlist, -- &src_mm->mmlist); -- spin_unlock(&mmlist_lock); -- } -- if (likely(!non_swap_entry(entry))) -+ if (likely(!non_swap_entry(entry))) { -+ if (swap_duplicate(entry) < 0) -+ return entry.val; -+ -+ /* make sure dst_mm is on swapoff's mmlist. */ -+ if (unlikely(list_empty(&dst_mm->mmlist))) { -+ spin_lock(&mmlist_lock); -+ if (list_empty(&dst_mm->mmlist)) -+ list_add(&dst_mm->mmlist, -+ &src_mm->mmlist); -+ spin_unlock(&mmlist_lock); -+ } - rss[MM_SWAPENTS]++; -- else if (is_migration_entry(entry)) { -+ } else if (is_migration_entry(entry)) { - page = migration_entry_to_page(entry); - - if (PageAnon(page)) -diff --git a/mm/mmap.c b/mm/mmap.c -index dfe90657..b91ac80 100644 ---- a/mm/mmap.c -+++ b/mm/mmap.c -@@ -745,8 +745,11 @@ again: remove_next = 1 + (end > next->vm_end); - * shrinking vma had, to cover any anon pages imported. - */ - if (exporter && exporter->anon_vma && !importer->anon_vma) { -- if (anon_vma_clone(importer, exporter)) -- return -ENOMEM; -+ int error; -+ -+ error = anon_vma_clone(importer, exporter); -+ if (error) -+ return error; - importer->anon_vma = exporter->anon_vma; - } - } -@@ -2428,7 +2431,8 @@ static int __split_vma(struct mm_struct * mm, struct vm_area_struct * vma, - if (err) - goto out_free_vma; - -- if (anon_vma_clone(new, vma)) -+ err = anon_vma_clone(new, vma); -+ if (err) - goto out_free_mpol; - - if (new->vm_file) -diff --git a/mm/rmap.c b/mm/rmap.c -index cdbd312..cab9820 100644 ---- a/mm/rmap.c -+++ b/mm/rmap.c -@@ -274,6 +274,7 @@ int anon_vma_fork(struct vm_area_struct *vma, struct vm_area_struct *pvma) - { - struct anon_vma_chain *avc; - struct anon_vma *anon_vma; -+ int error; - - /* Don't bother if the parent process has no anon_vma here. */ - if (!pvma->anon_vma) -@@ -283,8 +284,9 @@ int anon_vma_fork(struct vm_area_struct *vma, struct vm_area_struct *pvma) - * First, attach the new VMA to the parent VMA's anon_vmas, - * so rmap can find non-COWed pages in child processes. - */ -- if (anon_vma_clone(vma, pvma)) -- return -ENOMEM; -+ error = anon_vma_clone(vma, pvma); -+ if (error) -+ return error; - - /* Then add our own anon_vma. */ - anon_vma = anon_vma_alloc(); -diff --git a/mm/vmpressure.c b/mm/vmpressure.c -index d4042e7..c5afd57 100644 ---- a/mm/vmpressure.c -+++ b/mm/vmpressure.c -@@ -165,6 +165,7 @@ static void vmpressure_work_fn(struct work_struct *work) - unsigned long scanned; - unsigned long reclaimed; - -+ spin_lock(&vmpr->sr_lock); - /* - * Several contexts might be calling vmpressure(), so it is - * possible that the work was rescheduled again before the old -@@ -173,11 +174,12 @@ static void vmpressure_work_fn(struct work_struct *work) - * here. No need for any locks here since we don't care if - * vmpr->reclaimed is in sync. - */ -- if (!vmpr->scanned) -+ scanned = vmpr->scanned; -+ if (!scanned) { -+ spin_unlock(&vmpr->sr_lock); - return; -+ } - -- spin_lock(&vmpr->sr_lock); -- scanned = vmpr->scanned; - reclaimed = vmpr->reclaimed; - vmpr->scanned = 0; - vmpr->reclaimed = 0; -diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c -index b0db904..4617586 100644 ---- a/net/core/rtnetlink.c -+++ b/net/core/rtnetlink.c -@@ -1453,6 +1453,7 @@ static int do_setlink(const struct sk_buff *skb, - goto errout; - } - if (!netlink_ns_capable(skb, net->user_ns, CAP_NET_ADMIN)) { -+ put_net(net); - err = -EPERM; - goto errout; - } -diff --git a/net/ipv4/gre_offload.c b/net/ipv4/gre_offload.c -index 8c8493e..278836f 100644 ---- a/net/ipv4/gre_offload.c -+++ b/net/ipv4/gre_offload.c -@@ -271,6 +271,9 @@ static int gre_gro_complete(struct sk_buff *skb, int nhoff) - err = ptype->callbacks.gro_complete(skb, nhoff + grehlen); - - rcu_read_unlock(); -+ -+ skb_set_inner_mac_header(skb, nhoff + grehlen); -+ - return err; - } - -diff --git a/net/ipv4/ip_vti.c b/net/ipv4/ip_vti.c -index e4a8f76..b0a9cb4 100644 ---- a/net/ipv4/ip_vti.c -+++ b/net/ipv4/ip_vti.c -@@ -369,6 +369,7 @@ static struct rtnl_link_ops vti_link_ops __read_mostly = { - .validate = vti_tunnel_validate, - .newlink = vti_newlink, - .changelink = vti_changelink, -+ .dellink = ip_tunnel_dellink, - .get_size = vti_get_size, - .fill_info = vti_fill_info, - }; -diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c -index b27f6d3..4a230b1 100644 ---- a/net/ipv6/ip6_gre.c -+++ b/net/ipv6/ip6_gre.c -@@ -508,11 +508,11 @@ static int ip6gre_rcv(struct sk_buff *skb) - - skb->protocol = gre_proto; - /* WCCP version 1 and 2 protocol decoding. -- * - Change protocol to IP -+ * - Change protocol to IPv6 - * - When dealing with WCCPv2, Skip extra 4 bytes in GRE header - */ - if (flags == 0 && gre_proto == htons(ETH_P_WCCP)) { -- skb->protocol = htons(ETH_P_IP); -+ skb->protocol = htons(ETH_P_IPV6); - if ((*(h + offset) & 0xF0) != 0x40) - offset += 4; - } -diff --git a/net/ipv6/ip6_vti.c b/net/ipv6/ip6_vti.c -index 9a5339f..28456c9 100644 ---- a/net/ipv6/ip6_vti.c -+++ b/net/ipv6/ip6_vti.c -@@ -825,6 +825,15 @@ static int vti6_newlink(struct net *src_net, struct net_device *dev, - return vti6_tnl_create2(dev); - } - -+static void vti6_dellink(struct net_device *dev, struct list_head *head) -+{ -+ struct net *net = dev_net(dev); -+ struct vti6_net *ip6n = net_generic(net, vti6_net_id); -+ -+ if (dev != ip6n->fb_tnl_dev) -+ unregister_netdevice_queue(dev, head); -+} -+ - static int vti6_changelink(struct net_device *dev, struct nlattr *tb[], - struct nlattr *data[]) - { -@@ -900,6 +909,7 @@ static struct rtnl_link_ops vti6_link_ops __read_mostly = { - .setup = vti6_dev_setup, - .validate = vti6_validate, - .newlink = vti6_newlink, -+ .dellink = vti6_dellink, - .changelink = vti6_changelink, - .get_size = vti6_get_size, - .fill_info = vti6_fill_info, -@@ -945,6 +955,7 @@ static int __net_init vti6_init_net(struct net *net) - if (!ip6n->fb_tnl_dev) - goto err_alloc_dev; - dev_net_set(ip6n->fb_tnl_dev, net); -+ ip6n->fb_tnl_dev->rtnl_link_ops = &vti6_link_ops; - - err = vti6_fb_tnl_dev_init(ip6n->fb_tnl_dev); - if (err < 0) -diff --git a/net/mac80211/aes_ccm.c b/net/mac80211/aes_ccm.c -index 7c7df47..f056f9ed 100644 ---- a/net/mac80211/aes_ccm.c -+++ b/net/mac80211/aes_ccm.c -@@ -54,6 +54,9 @@ int ieee80211_aes_ccm_decrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad, - - memset(&aead_req, 0, sizeof(aead_req)); - -+ if (data_len == 0) -+ return -EINVAL; -+ - sg_init_one(&pt, data, data_len); - sg_init_one(&assoc, &aad[2], be16_to_cpup((__be16 *)aad)); - sg_init_table(ct, 2); -diff --git a/net/sctp/output.c b/net/sctp/output.c -index 8267b06..740ca5f 100644 ---- a/net/sctp/output.c -+++ b/net/sctp/output.c -@@ -401,12 +401,12 @@ int sctp_packet_transmit(struct sctp_packet *packet) - sk = chunk->skb->sk; - - /* Allocate the new skb. */ -- nskb = alloc_skb(packet->size + LL_MAX_HEADER, GFP_ATOMIC); -+ nskb = alloc_skb(packet->size + MAX_HEADER, GFP_ATOMIC); - if (!nskb) - goto nomem; - - /* Make sure the outbound skb has enough header room reserved. */ -- skb_reserve(nskb, packet->overhead + LL_MAX_HEADER); -+ skb_reserve(nskb, packet->overhead + MAX_HEADER); - - /* Set the owning socket so that we know where to get the - * destination IP address. -diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c -index eaf64ea..1a05efa 100644 ---- a/sound/pci/hda/patch_analog.c -+++ b/sound/pci/hda/patch_analog.c -@@ -333,6 +333,7 @@ static const struct hda_fixup ad1986a_fixups[] = { - - static const struct snd_pci_quirk ad1986a_fixup_tbl[] = { - SND_PCI_QUIRK(0x103c, 0x30af, "HP B2800", AD1986A_FIXUP_LAPTOP_IMIC), -+ SND_PCI_QUIRK(0x1043, 0x1443, "ASUS Z99He", AD1986A_FIXUP_EAPD), - SND_PCI_QUIRK(0x1043, 0x1447, "ASUS A8JN", AD1986A_FIXUP_EAPD), - SND_PCI_QUIRK_MASK(0x1043, 0xff00, 0x8100, "ASUS P5", AD1986A_FIXUP_3STACK), - SND_PCI_QUIRK_MASK(0x1043, 0xff00, 0x8200, "ASUS M2", AD1986A_FIXUP_3STACK), -diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c -index 4c826a4..910f2db 100644 ---- a/sound/pci/hda/patch_realtek.c -+++ b/sound/pci/hda/patch_realtek.c -@@ -4554,6 +4554,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { - SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), - SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), - SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), -+ SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC), - SND_PCI_QUIRK(0x17aa, 0x3978, "IdeaPad Y410P", ALC269_FIXUP_NO_SHUTUP), - SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), - SND_PCI_QUIRK(0x17aa, 0x501a, "Thinkpad", ALC283_FIXUP_INT_MIC), -diff --git a/sound/usb/midi.c b/sound/usb/midi.c -index b901f46..c7aa71e 100644 ---- a/sound/usb/midi.c -+++ b/sound/usb/midi.c -@@ -364,6 +364,8 @@ static void snd_usbmidi_error_timer(unsigned long data) - if (in && in->error_resubmit) { - in->error_resubmit = 0; - for (j = 0; j < INPUT_URBS; ++j) { -+ if (atomic_read(&in->urbs[j]->use_count)) -+ continue; - in->urbs[j]->dev = umidi->dev; - snd_usbmidi_submit_urb(in->urbs[j], GFP_ATOMIC); - } diff --git a/projects/imx6/patches/linux/linux-000-patch-3.14.27-28.patch b/projects/imx6/patches/linux/linux-000-patch-3.14.27-28.patch deleted file mode 100644 index 0beea302b85..00000000000 --- a/projects/imx6/patches/linux/linux-000-patch-3.14.27-28.patch +++ /dev/null @@ -1,1961 +0,0 @@ -diff --git a/Makefile b/Makefile -index 944db23..a2e572b 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,6 +1,6 @@ - VERSION = 3 - PATCHLEVEL = 14 --SUBLEVEL = 27 -+SUBLEVEL = 28 - EXTRAVERSION = - NAME = Remembering Coco - -diff --git a/arch/arm/boot/dts/armada-370.dtsi b/arch/arm/boot/dts/armada-370.dtsi -index 0d8530c..34841fc 100644 ---- a/arch/arm/boot/dts/armada-370.dtsi -+++ b/arch/arm/boot/dts/armada-370.dtsi -@@ -106,11 +106,6 @@ - reg = <0x11100 0x20>; - }; - -- system-controller@18200 { -- compatible = "marvell,armada-370-xp-system-controller"; -- reg = <0x18200 0x100>; -- }; -- - pinctrl { - compatible = "marvell,mv88f6710-pinctrl"; - reg = <0x18000 0x38>; -@@ -167,6 +162,11 @@ - interrupts = <91>; - }; - -+ system-controller@18200 { -+ compatible = "marvell,armada-370-xp-system-controller"; -+ reg = <0x18200 0x100>; -+ }; -+ - gateclk: clock-gating-control@18220 { - compatible = "marvell,armada-370-gating-clock"; - reg = <0x18220 0x4>; -diff --git a/arch/arm/mach-tegra/reset-handler.S b/arch/arm/mach-tegra/reset-handler.S -index 8c1ba4f..3505799 100644 ---- a/arch/arm/mach-tegra/reset-handler.S -+++ b/arch/arm/mach-tegra/reset-handler.S -@@ -51,6 +51,7 @@ ENTRY(tegra_resume) - THUMB( it ne ) - bne cpu_resume @ no - -+ tegra_get_soc_id TEGRA_APB_MISC_BASE, r6 - /* Are we on Tegra20? */ - cmp r6, #TEGRA20 - beq 1f @ Yes -diff --git a/arch/arm64/include/asm/hwcap.h b/arch/arm64/include/asm/hwcap.h -index 6cddbb0..e0ec201 100644 ---- a/arch/arm64/include/asm/hwcap.h -+++ b/arch/arm64/include/asm/hwcap.h -@@ -30,6 +30,7 @@ - #define COMPAT_HWCAP_IDIVA (1 << 17) - #define COMPAT_HWCAP_IDIVT (1 << 18) - #define COMPAT_HWCAP_IDIV (COMPAT_HWCAP_IDIVA|COMPAT_HWCAP_IDIVT) -+#define COMPAT_HWCAP_LPAE (1 << 20) - #define COMPAT_HWCAP_EVTSTRM (1 << 21) - - #ifndef __ASSEMBLY__ -diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c -index c8e9eff..071c382 100644 ---- a/arch/arm64/kernel/setup.c -+++ b/arch/arm64/kernel/setup.c -@@ -67,7 +67,8 @@ EXPORT_SYMBOL_GPL(elf_hwcap); - COMPAT_HWCAP_FAST_MULT|COMPAT_HWCAP_EDSP|\ - COMPAT_HWCAP_TLS|COMPAT_HWCAP_VFP|\ - COMPAT_HWCAP_VFPv3|COMPAT_HWCAP_VFPv4|\ -- COMPAT_HWCAP_NEON|COMPAT_HWCAP_IDIV) -+ COMPAT_HWCAP_NEON|COMPAT_HWCAP_IDIV|\ -+ COMPAT_HWCAP_LPAE) - unsigned int compat_elf_hwcap __read_mostly = COMPAT_ELF_HWCAP_DEFAULT; - #endif - -diff --git a/arch/s390/kernel/compat_linux.c b/arch/s390/kernel/compat_linux.c -index db02052..5426c9e 100644 ---- a/arch/s390/kernel/compat_linux.c -+++ b/arch/s390/kernel/compat_linux.c -@@ -245,7 +245,7 @@ asmlinkage long sys32_setgroups16(int gidsetsize, u16 __user *grouplist) - struct group_info *group_info; - int retval; - -- if (!capable(CAP_SETGID)) -+ if (!may_setgroups()) - return -EPERM; - if ((unsigned)gidsetsize > NGROUPS_MAX) - return -EINVAL; -diff --git a/arch/x86/include/uapi/asm/ldt.h b/arch/x86/include/uapi/asm/ldt.h -index 46727eb..6e1aaf7 100644 ---- a/arch/x86/include/uapi/asm/ldt.h -+++ b/arch/x86/include/uapi/asm/ldt.h -@@ -28,6 +28,13 @@ struct user_desc { - unsigned int seg_not_present:1; - unsigned int useable:1; - #ifdef __x86_64__ -+ /* -+ * Because this bit is not present in 32-bit user code, user -+ * programs can pass uninitialized values here. Therefore, in -+ * any context in which a user_desc comes from a 32-bit program, -+ * the kernel must act as though lm == 0, regardless of the -+ * actual value. -+ */ - unsigned int lm:1; - #endif - }; -diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c -index 713f1b3..0b1e1d5 100644 ---- a/arch/x86/kernel/kvm.c -+++ b/arch/x86/kernel/kvm.c -@@ -280,7 +280,14 @@ do_async_page_fault(struct pt_regs *regs, unsigned long error_code) - static void __init paravirt_ops_setup(void) - { - pv_info.name = "KVM"; -- pv_info.paravirt_enabled = 1; -+ -+ /* -+ * KVM isn't paravirt in the sense of paravirt_enabled. A KVM -+ * guest kernel works like a bare metal kernel with additional -+ * features, and paravirt_enabled is about features that are -+ * missing. -+ */ -+ pv_info.paravirt_enabled = 0; - - if (kvm_para_has_feature(KVM_FEATURE_NOP_IO_DELAY)) - pv_cpu_ops.io_delay = kvm_io_delay; -diff --git a/arch/x86/kernel/kvmclock.c b/arch/x86/kernel/kvmclock.c -index e604109..c8e98cd 100644 ---- a/arch/x86/kernel/kvmclock.c -+++ b/arch/x86/kernel/kvmclock.c -@@ -263,7 +263,6 @@ void __init kvmclock_init(void) - #endif - kvm_get_preset_lpj(); - clocksource_register_hz(&kvm_clock, NSEC_PER_SEC); -- pv_info.paravirt_enabled = 1; - pv_info.name = "KVM"; - - if (kvm_para_has_feature(KVM_FEATURE_CLOCKSOURCE_STABLE_BIT)) -diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c -index 9c0280f9..e2d26ce 100644 ---- a/arch/x86/kernel/process_64.c -+++ b/arch/x86/kernel/process_64.c -@@ -286,24 +286,9 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p) - - fpu = switch_fpu_prepare(prev_p, next_p, cpu); - -- /* -- * Reload esp0, LDT and the page table pointer: -- */ -+ /* Reload esp0 and ss1. */ - load_sp0(tss, next); - -- /* -- * Switch DS and ES. -- * This won't pick up thread selector changes, but I guess that is ok. -- */ -- savesegment(es, prev->es); -- if (unlikely(next->es | prev->es)) -- loadsegment(es, next->es); -- -- savesegment(ds, prev->ds); -- if (unlikely(next->ds | prev->ds)) -- loadsegment(ds, next->ds); -- -- - /* We must save %fs and %gs before load_TLS() because - * %fs and %gs may be cleared by load_TLS(). - * -@@ -312,41 +297,101 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p) - savesegment(fs, fsindex); - savesegment(gs, gsindex); - -+ /* -+ * Load TLS before restoring any segments so that segment loads -+ * reference the correct GDT entries. -+ */ - load_TLS(next, cpu); - - /* -- * Leave lazy mode, flushing any hypercalls made here. -- * This must be done before restoring TLS segments so -- * the GDT and LDT are properly updated, and must be -- * done before math_state_restore, so the TS bit is up -- * to date. -+ * Leave lazy mode, flushing any hypercalls made here. This -+ * must be done after loading TLS entries in the GDT but before -+ * loading segments that might reference them, and and it must -+ * be done before math_state_restore, so the TS bit is up to -+ * date. - */ - arch_end_context_switch(next_p); - -+ /* Switch DS and ES. -+ * -+ * Reading them only returns the selectors, but writing them (if -+ * nonzero) loads the full descriptor from the GDT or LDT. The -+ * LDT for next is loaded in switch_mm, and the GDT is loaded -+ * above. -+ * -+ * We therefore need to write new values to the segment -+ * registers on every context switch unless both the new and old -+ * values are zero. -+ * -+ * Note that we don't need to do anything for CS and SS, as -+ * those are saved and restored as part of pt_regs. -+ */ -+ savesegment(es, prev->es); -+ if (unlikely(next->es | prev->es)) -+ loadsegment(es, next->es); -+ -+ savesegment(ds, prev->ds); -+ if (unlikely(next->ds | prev->ds)) -+ loadsegment(ds, next->ds); -+ - /* - * Switch FS and GS. - * -- * Segment register != 0 always requires a reload. Also -- * reload when it has changed. When prev process used 64bit -- * base always reload to avoid an information leak. -+ * These are even more complicated than FS and GS: they have -+ * 64-bit bases are that controlled by arch_prctl. Those bases -+ * only differ from the values in the GDT or LDT if the selector -+ * is 0. -+ * -+ * Loading the segment register resets the hidden base part of -+ * the register to 0 or the value from the GDT / LDT. If the -+ * next base address zero, writing 0 to the segment register is -+ * much faster than using wrmsr to explicitly zero the base. -+ * -+ * The thread_struct.fs and thread_struct.gs values are 0 -+ * if the fs and gs bases respectively are not overridden -+ * from the values implied by fsindex and gsindex. They -+ * are nonzero, and store the nonzero base addresses, if -+ * the bases are overridden. -+ * -+ * (fs != 0 && fsindex != 0) || (gs != 0 && gsindex != 0) should -+ * be impossible. -+ * -+ * Therefore we need to reload the segment registers if either -+ * the old or new selector is nonzero, and we need to override -+ * the base address if next thread expects it to be overridden. -+ * -+ * This code is unnecessarily slow in the case where the old and -+ * new indexes are zero and the new base is nonzero -- it will -+ * unnecessarily write 0 to the selector before writing the new -+ * base address. -+ * -+ * Note: This all depends on arch_prctl being the only way that -+ * user code can override the segment base. Once wrfsbase and -+ * wrgsbase are enabled, most of this code will need to change. - */ - if (unlikely(fsindex | next->fsindex | prev->fs)) { - loadsegment(fs, next->fsindex); -+ - /* -- * Check if the user used a selector != 0; if yes -- * clear 64bit base, since overloaded base is always -- * mapped to the Null selector -+ * If user code wrote a nonzero value to FS, then it also -+ * cleared the overridden base address. -+ * -+ * XXX: if user code wrote 0 to FS and cleared the base -+ * address itself, we won't notice and we'll incorrectly -+ * restore the prior base address next time we reschdule -+ * the process. - */ - if (fsindex) - prev->fs = 0; - } -- /* when next process has a 64bit base use it */ - if (next->fs) - wrmsrl(MSR_FS_BASE, next->fs); - prev->fsindex = fsindex; - - if (unlikely(gsindex | next->gsindex | prev->gs)) { - load_gs_index(next->gsindex); -+ -+ /* This works (and fails) the same way as fsindex above. */ - if (gsindex) - prev->gs = 0; - } -diff --git a/arch/x86/kernel/tls.c b/arch/x86/kernel/tls.c -index f7fec09..4e942f3 100644 ---- a/arch/x86/kernel/tls.c -+++ b/arch/x86/kernel/tls.c -@@ -27,6 +27,37 @@ static int get_free_idx(void) - return -ESRCH; - } - -+static bool tls_desc_okay(const struct user_desc *info) -+{ -+ if (LDT_empty(info)) -+ return true; -+ -+ /* -+ * espfix is required for 16-bit data segments, but espfix -+ * only works for LDT segments. -+ */ -+ if (!info->seg_32bit) -+ return false; -+ -+ /* Only allow data segments in the TLS array. */ -+ if (info->contents > 1) -+ return false; -+ -+ /* -+ * Non-present segments with DPL 3 present an interesting attack -+ * surface. The kernel should handle such segments correctly, -+ * but TLS is very difficult to protect in a sandbox, so prevent -+ * such segments from being created. -+ * -+ * If userspace needs to remove a TLS entry, it can still delete -+ * it outright. -+ */ -+ if (info->seg_not_present) -+ return false; -+ -+ return true; -+} -+ - static void set_tls_desc(struct task_struct *p, int idx, - const struct user_desc *info, int n) - { -@@ -66,6 +97,9 @@ int do_set_thread_area(struct task_struct *p, int idx, - if (copy_from_user(&info, u_info, sizeof(info))) - return -EFAULT; - -+ if (!tls_desc_okay(&info)) -+ return -EINVAL; -+ - if (idx == -1) - idx = info.entry_number; - -@@ -192,6 +226,7 @@ int regset_tls_set(struct task_struct *target, const struct user_regset *regset, - { - struct user_desc infobuf[GDT_ENTRY_TLS_ENTRIES]; - const struct user_desc *info; -+ int i; - - if (pos >= GDT_ENTRY_TLS_ENTRIES * sizeof(struct user_desc) || - (pos % sizeof(struct user_desc)) != 0 || -@@ -205,6 +240,10 @@ int regset_tls_set(struct task_struct *target, const struct user_regset *regset, - else - info = infobuf; - -+ for (i = 0; i < count / sizeof(struct user_desc); i++) -+ if (!tls_desc_okay(info + i)) -+ return -EINVAL; -+ - set_tls_desc(target, - GDT_ENTRY_TLS_MIN + (pos / sizeof(struct user_desc)), - info, count / sizeof(struct user_desc)); -diff --git a/crypto/af_alg.c b/crypto/af_alg.c -index 6a3ad80..1de4bee 100644 ---- a/crypto/af_alg.c -+++ b/crypto/af_alg.c -@@ -449,6 +449,9 @@ void af_alg_complete(struct crypto_async_request *req, int err) - { - struct af_alg_completion *completion = req->data; - -+ if (err == -EINPROGRESS) -+ return; -+ - completion->err = err; - complete(&completion->completion); - } -diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c -index 4195a01..8e51b3a 100644 ---- a/drivers/md/bitmap.c -+++ b/drivers/md/bitmap.c -@@ -883,7 +883,6 @@ void bitmap_unplug(struct bitmap *bitmap) - { - unsigned long i; - int dirty, need_write; -- int wait = 0; - - if (!bitmap || !bitmap->storage.filemap || - test_bit(BITMAP_STALE, &bitmap->flags)) -@@ -901,16 +900,13 @@ void bitmap_unplug(struct bitmap *bitmap) - clear_page_attr(bitmap, i, BITMAP_PAGE_PENDING); - write_page(bitmap, bitmap->storage.filemap[i], 0); - } -- if (dirty) -- wait = 1; -- } -- if (wait) { /* if any writes were performed, we need to wait on them */ -- if (bitmap->storage.file) -- wait_event(bitmap->write_wait, -- atomic_read(&bitmap->pending_writes)==0); -- else -- md_super_wait(bitmap->mddev); - } -+ if (bitmap->storage.file) -+ wait_event(bitmap->write_wait, -+ atomic_read(&bitmap->pending_writes)==0); -+ else -+ md_super_wait(bitmap->mddev); -+ - if (test_bit(BITMAP_WRITE_ERROR, &bitmap->flags)) - bitmap_file_kick(bitmap); - } -diff --git a/drivers/md/dm-bufio.c b/drivers/md/dm-bufio.c -index a1cebf7..03c872f 100644 ---- a/drivers/md/dm-bufio.c -+++ b/drivers/md/dm-bufio.c -@@ -532,6 +532,19 @@ static void use_dmio(struct dm_buffer *b, int rw, sector_t block, - end_io(&b->bio, r); - } - -+static void inline_endio(struct bio *bio, int error) -+{ -+ bio_end_io_t *end_fn = bio->bi_private; -+ -+ /* -+ * Reset the bio to free any attached resources -+ * (e.g. bio integrity profiles). -+ */ -+ bio_reset(bio); -+ -+ end_fn(bio, error); -+} -+ - static void use_inline_bio(struct dm_buffer *b, int rw, sector_t block, - bio_end_io_t *end_io) - { -@@ -543,7 +556,12 @@ static void use_inline_bio(struct dm_buffer *b, int rw, sector_t block, - b->bio.bi_max_vecs = DM_BUFIO_INLINE_VECS; - b->bio.bi_iter.bi_sector = block << b->c->sectors_per_block_bits; - b->bio.bi_bdev = b->c->bdev; -- b->bio.bi_end_io = end_io; -+ b->bio.bi_end_io = inline_endio; -+ /* -+ * Use of .bi_private isn't a problem here because -+ * the dm_buffer's inline bio is local to bufio. -+ */ -+ b->bio.bi_private = end_io; - - /* - * We assume that if len >= PAGE_SIZE ptr is page-aligned. -diff --git a/drivers/md/dm-cache-target.c b/drivers/md/dm-cache-target.c -index 2331543..ff284b7 100644 ---- a/drivers/md/dm-cache-target.c -+++ b/drivers/md/dm-cache-target.c -@@ -946,10 +946,14 @@ static void migration_success_post_commit(struct dm_cache_migration *mg) - } - - } else { -- clear_dirty(cache, mg->new_oblock, mg->cblock); -- if (mg->requeue_holder) -+ if (mg->requeue_holder) { -+ clear_dirty(cache, mg->new_oblock, mg->cblock); - cell_defer(cache, mg->new_ocell, true); -- else { -+ } else { -+ /* -+ * The block was promoted via an overwrite, so it's dirty. -+ */ -+ set_dirty(cache, mg->new_oblock, mg->cblock); - bio_endio(mg->new_ocell->holder, 0); - cell_defer(cache, mg->new_ocell, false); - } -@@ -1060,7 +1064,8 @@ static void issue_copy(struct dm_cache_migration *mg) - - avoid = is_discarded_oblock(cache, mg->new_oblock); - -- if (!avoid && bio_writes_complete_block(cache, bio)) { -+ if (writeback_mode(&cache->features) && -+ !avoid && bio_writes_complete_block(cache, bio)) { - issue_overwrite(mg, bio); - return; - } -diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c -index 9533f83..4a8d19d 100644 ---- a/drivers/md/dm-crypt.c -+++ b/drivers/md/dm-crypt.c -@@ -709,7 +709,7 @@ static int crypt_iv_tcw_whitening(struct crypt_config *cc, - for (i = 0; i < ((1 << SECTOR_SHIFT) / 8); i++) - crypto_xor(data + i * 8, buf, 8); - out: -- memset(buf, 0, sizeof(buf)); -+ memzero_explicit(buf, sizeof(buf)); - return r; - } - -diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c -index 37f2648..f7e052c 100644 ---- a/drivers/md/dm-thin.c -+++ b/drivers/md/dm-thin.c -@@ -916,6 +916,24 @@ static void schedule_zero(struct thin_c *tc, dm_block_t virt_block, - } - } - -+static void set_pool_mode(struct pool *pool, enum pool_mode new_mode); -+ -+static void check_for_space(struct pool *pool) -+{ -+ int r; -+ dm_block_t nr_free; -+ -+ if (get_pool_mode(pool) != PM_OUT_OF_DATA_SPACE) -+ return; -+ -+ r = dm_pool_get_free_block_count(pool->pmd, &nr_free); -+ if (r) -+ return; -+ -+ if (nr_free) -+ set_pool_mode(pool, PM_WRITE); -+} -+ - /* - * A non-zero return indicates read_only or fail_io mode. - * Many callers don't care about the return value. -@@ -930,6 +948,8 @@ static int commit(struct pool *pool) - r = dm_pool_commit_metadata(pool->pmd); - if (r) - metadata_operation_failed(pool, "dm_pool_commit_metadata", r); -+ else -+ check_for_space(pool); - - return r; - } -@@ -948,8 +968,6 @@ static void check_low_water_mark(struct pool *pool, dm_block_t free_blocks) - } - } - --static void set_pool_mode(struct pool *pool, enum pool_mode new_mode); -- - static int alloc_data_block(struct thin_c *tc, dm_block_t *result) - { - int r; -@@ -1592,7 +1610,7 @@ static void set_pool_mode(struct pool *pool, enum pool_mode new_mode) - pool->process_bio = process_bio_read_only; - pool->process_discard = process_discard; - pool->process_prepared_mapping = process_prepared_mapping; -- pool->process_prepared_discard = process_prepared_discard_passdown; -+ pool->process_prepared_discard = process_prepared_discard; - - if (!pool->pf.error_if_no_space && no_space_timeout) - queue_delayed_work(pool->wq, &pool->no_space_timeout, no_space_timeout); -diff --git a/drivers/md/persistent-data/dm-space-map-metadata.c b/drivers/md/persistent-data/dm-space-map-metadata.c -index 786b689..f4e22bc 100644 ---- a/drivers/md/persistent-data/dm-space-map-metadata.c -+++ b/drivers/md/persistent-data/dm-space-map-metadata.c -@@ -564,7 +564,9 @@ static int sm_bootstrap_get_nr_blocks(struct dm_space_map *sm, dm_block_t *count - { - struct sm_metadata *smm = container_of(sm, struct sm_metadata, sm); - -- return smm->ll.nr_blocks; -+ *count = smm->ll.nr_blocks; -+ -+ return 0; - } - - static int sm_bootstrap_get_nr_free(struct dm_space_map *sm, dm_block_t *count) -diff --git a/drivers/mfd/tc6393xb.c b/drivers/mfd/tc6393xb.c -index 11c19e5..48579e5 100644 ---- a/drivers/mfd/tc6393xb.c -+++ b/drivers/mfd/tc6393xb.c -@@ -263,6 +263,17 @@ static int tc6393xb_ohci_disable(struct platform_device *dev) - return 0; - } - -+static int tc6393xb_ohci_suspend(struct platform_device *dev) -+{ -+ struct tc6393xb_platform_data *tcpd = dev_get_platdata(dev->dev.parent); -+ -+ /* We can't properly store/restore OHCI state, so fail here */ -+ if (tcpd->resume_restore) -+ return -EBUSY; -+ -+ return tc6393xb_ohci_disable(dev); -+} -+ - static int tc6393xb_fb_enable(struct platform_device *dev) - { - struct tc6393xb *tc6393xb = dev_get_drvdata(dev->dev.parent); -@@ -403,7 +414,7 @@ static struct mfd_cell tc6393xb_cells[] = { - .num_resources = ARRAY_SIZE(tc6393xb_ohci_resources), - .resources = tc6393xb_ohci_resources, - .enable = tc6393xb_ohci_enable, -- .suspend = tc6393xb_ohci_disable, -+ .suspend = tc6393xb_ohci_suspend, - .resume = tc6393xb_ohci_enable, - .disable = tc6393xb_ohci_disable, - }, -diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c -index 7b5424f..df72c47 100644 ---- a/drivers/mmc/card/block.c -+++ b/drivers/mmc/card/block.c -@@ -260,7 +260,7 @@ static ssize_t force_ro_show(struct device *dev, struct device_attribute *attr, - int ret; - struct mmc_blk_data *md = mmc_blk_get(dev_to_disk(dev)); - -- ret = snprintf(buf, PAGE_SIZE, "%d", -+ ret = snprintf(buf, PAGE_SIZE, "%d\n", - get_disk_ro(dev_to_disk(dev)) ^ - md->read_only); - mmc_blk_put(md); -diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c -index 55cd110..caed9d5 100644 ---- a/drivers/mmc/host/dw_mmc.c -+++ b/drivers/mmc/host/dw_mmc.c -@@ -632,6 +632,13 @@ static void dw_mci_ctrl_rd_thld(struct dw_mci *host, struct mmc_data *data) - - WARN_ON(!(data->flags & MMC_DATA_READ)); - -+ /* -+ * CDTHRCTL doesn't exist prior to 240A (in fact that register offset is -+ * in the FIFO region, so we really shouldn't access it). -+ */ -+ if (host->verid < DW_MMC_240A) -+ return; -+ - if (host->timing != MMC_TIMING_MMC_HS200 && - host->timing != MMC_TIMING_UHS_SDR104) - goto disable; -diff --git a/drivers/mmc/host/sdhci-pci-o2micro.c b/drivers/mmc/host/sdhci-pci-o2micro.c -index f49666b..257e9ca 100644 ---- a/drivers/mmc/host/sdhci-pci-o2micro.c -+++ b/drivers/mmc/host/sdhci-pci-o2micro.c -@@ -88,8 +88,6 @@ void sdhci_pci_o2_fujin2_pci_init(struct sdhci_pci_chip *chip) - return; - scratch_32 &= ~((1 << 21) | (1 << 30)); - -- /* Set RTD3 function disabled */ -- scratch_32 |= ((1 << 29) | (1 << 28)); - pci_write_config_dword(chip->pdev, O2_SD_FUNC_REG3, scratch_32); - - /* Set L1 Entrance Timer */ -diff --git a/drivers/scsi/NCR5380.c b/drivers/scsi/NCR5380.c -index 1e9d6ad..7563b3d 100644 ---- a/drivers/scsi/NCR5380.c -+++ b/drivers/scsi/NCR5380.c -@@ -2655,14 +2655,14 @@ static void NCR5380_dma_complete(NCR5380_instance * instance) { - * - * Purpose : abort a command - * -- * Inputs : cmd - the Scsi_Cmnd to abort, code - code to set the -- * host byte of the result field to, if zero DID_ABORTED is -+ * Inputs : cmd - the Scsi_Cmnd to abort, code - code to set the -+ * host byte of the result field to, if zero DID_ABORTED is - * used. - * -- * Returns : 0 - success, -1 on failure. -+ * Returns : SUCCESS - success, FAILED on failure. - * -- * XXX - there is no way to abort the command that is currently -- * connected, you have to wait for it to complete. If this is -+ * XXX - there is no way to abort the command that is currently -+ * connected, you have to wait for it to complete. If this is - * a problem, we could implement longjmp() / setjmp(), setjmp() - * called where the loop started in NCR5380_main(). - * -@@ -2712,7 +2712,7 @@ static int NCR5380_abort(Scsi_Cmnd * cmd) { - * aborted flag and get back into our main loop. - */ - -- return 0; -+ return SUCCESS; - } - #endif - -diff --git a/drivers/scsi/aha1740.c b/drivers/scsi/aha1740.c -index 5f31017..31ace4b 100644 ---- a/drivers/scsi/aha1740.c -+++ b/drivers/scsi/aha1740.c -@@ -531,7 +531,7 @@ static int aha1740_eh_abort_handler (Scsi_Cmnd *dummy) - * quiet as possible... - */ - -- return 0; -+ return SUCCESS; - } - - static struct scsi_host_template aha1740_template = { -diff --git a/drivers/scsi/atari_NCR5380.c b/drivers/scsi/atari_NCR5380.c -index 0f3cdbc..30073d4 100644 ---- a/drivers/scsi/atari_NCR5380.c -+++ b/drivers/scsi/atari_NCR5380.c -@@ -2613,7 +2613,7 @@ static void NCR5380_reselect(struct Scsi_Host *instance) - * host byte of the result field to, if zero DID_ABORTED is - * used. - * -- * Returns : 0 - success, -1 on failure. -+ * Returns : SUCCESS - success, FAILED on failure. - * - * XXX - there is no way to abort the command that is currently - * connected, you have to wait for it to complete. If this is -diff --git a/drivers/scsi/esas2r/esas2r_main.c b/drivers/scsi/esas2r/esas2r_main.c -index f37f3e3..28fe6fe 100644 ---- a/drivers/scsi/esas2r/esas2r_main.c -+++ b/drivers/scsi/esas2r/esas2r_main.c -@@ -1057,7 +1057,7 @@ int esas2r_eh_abort(struct scsi_cmnd *cmd) - - cmd->scsi_done(cmd); - -- return 0; -+ return SUCCESS; - } - - spin_lock_irqsave(&a->queue_lock, flags); -diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c -index 816db12..52587ce 100644 ---- a/drivers/scsi/megaraid.c -+++ b/drivers/scsi/megaraid.c -@@ -1967,7 +1967,7 @@ megaraid_abort_and_reset(adapter_t *adapter, Scsi_Cmnd *cmd, int aor) - cmd->device->id, cmd->device->lun); - - if(list_empty(&adapter->pending_list)) -- return FALSE; -+ return FAILED; - - list_for_each_safe(pos, next, &adapter->pending_list) { - -@@ -1990,7 +1990,7 @@ megaraid_abort_and_reset(adapter_t *adapter, Scsi_Cmnd *cmd, int aor) - (aor==SCB_ABORT) ? "ABORTING":"RESET", - scb->idx); - -- return FALSE; -+ return FAILED; - } - else { - -@@ -2015,12 +2015,12 @@ megaraid_abort_and_reset(adapter_t *adapter, Scsi_Cmnd *cmd, int aor) - list_add_tail(SCSI_LIST(cmd), - &adapter->completed_list); - -- return TRUE; -+ return SUCCESS; - } - } - } - -- return FALSE; -+ return FAILED; - } - - static inline int -diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c -index 3b7ad10..c80afde 100644 ---- a/drivers/scsi/megaraid/megaraid_sas_base.c -+++ b/drivers/scsi/megaraid/megaraid_sas_base.c -@@ -953,7 +953,7 @@ megasas_issue_blocked_abort_cmd(struct megasas_instance *instance, - cpu_to_le32(upper_32_bits(cmd_to_abort->frame_phys_addr)); - - cmd->sync_cmd = 1; -- cmd->cmd_status = 0xFF; -+ cmd->cmd_status = ENODATA; - - instance->instancet->issue_dcmd(instance, cmd); - -diff --git a/drivers/scsi/sun3_NCR5380.c b/drivers/scsi/sun3_NCR5380.c -index 636bbe0..fc57c8a 100644 ---- a/drivers/scsi/sun3_NCR5380.c -+++ b/drivers/scsi/sun3_NCR5380.c -@@ -2597,15 +2597,15 @@ static void NCR5380_reselect (struct Scsi_Host *instance) - * Purpose : abort a command - * - * Inputs : cmd - the struct scsi_cmnd to abort, code - code to set the -- * host byte of the result field to, if zero DID_ABORTED is -+ * host byte of the result field to, if zero DID_ABORTED is - * used. - * -- * Returns : 0 - success, -1 on failure. -+ * Returns : SUCCESS - success, FAILED on failure. - * -- * XXX - there is no way to abort the command that is currently -- * connected, you have to wait for it to complete. If this is -+ * XXX - there is no way to abort the command that is currently -+ * connected, you have to wait for it to complete. If this is - * a problem, we could implement longjmp() / setjmp(), setjmp() -- * called where the loop started in NCR5380_main(). -+ * called where the loop started in NCR5380_main(). - */ - - static int NCR5380_abort(struct scsi_cmnd *cmd) -diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c -index 71b0ec0..284733e 100644 ---- a/drivers/thermal/thermal_core.c -+++ b/drivers/thermal/thermal_core.c -@@ -1824,10 +1824,10 @@ static int __init thermal_init(void) - - exit_netlink: - genetlink_exit(); --unregister_governors: -- thermal_unregister_governors(); - unregister_class: - class_unregister(&thermal_class); -+unregister_governors: -+ thermal_unregister_governors(); - error: - idr_destroy(&thermal_tz_idr); - idr_destroy(&thermal_cdev_idr); -diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c -index 370ef74..0db8ded 100644 ---- a/fs/btrfs/disk-io.c -+++ b/fs/btrfs/disk-io.c -@@ -3978,12 +3978,6 @@ again: - if (ret) - break; - -- /* opt_discard */ -- if (btrfs_test_opt(root, DISCARD)) -- ret = btrfs_error_discard_extent(root, start, -- end + 1 - start, -- NULL); -- - clear_extent_dirty(unpin, start, end, GFP_NOFS); - btrfs_error_unpin_extent_range(root, start, end); - cond_resched(); -diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c -index 3ff98e2..d2f1c01 100644 ---- a/fs/btrfs/extent-tree.c -+++ b/fs/btrfs/extent-tree.c -@@ -5503,7 +5503,8 @@ void btrfs_prepare_extent_commit(struct btrfs_trans_handle *trans, - update_global_block_rsv(fs_info); - } - --static int unpin_extent_range(struct btrfs_root *root, u64 start, u64 end) -+static int unpin_extent_range(struct btrfs_root *root, u64 start, u64 end, -+ const bool return_free_space) - { - struct btrfs_fs_info *fs_info = root->fs_info; - struct btrfs_block_group_cache *cache = NULL; -@@ -5527,7 +5528,8 @@ static int unpin_extent_range(struct btrfs_root *root, u64 start, u64 end) - - if (start < cache->last_byte_to_unpin) { - len = min(len, cache->last_byte_to_unpin - start); -- btrfs_add_free_space(cache, start, len); -+ if (return_free_space) -+ btrfs_add_free_space(cache, start, len); - } - - start += len; -@@ -5590,7 +5592,7 @@ int btrfs_finish_extent_commit(struct btrfs_trans_handle *trans, - end + 1 - start, NULL); - - clear_extent_dirty(unpin, start, end, GFP_NOFS); -- unpin_extent_range(root, start, end); -+ unpin_extent_range(root, start, end, true); - cond_resched(); - } - -@@ -8886,7 +8888,7 @@ out: - - int btrfs_error_unpin_extent_range(struct btrfs_root *root, u64 start, u64 end) - { -- return unpin_extent_range(root, start, end); -+ return unpin_extent_range(root, start, end, false); - } - - int btrfs_error_discard_extent(struct btrfs_root *root, u64 bytenr, -diff --git a/fs/btrfs/extent_map.c b/fs/btrfs/extent_map.c -index 996ad56b..82845a6 100644 ---- a/fs/btrfs/extent_map.c -+++ b/fs/btrfs/extent_map.c -@@ -290,8 +290,6 @@ int unpin_extent_cache(struct extent_map_tree *tree, u64 start, u64 len, - if (!em) - goto out; - -- if (!test_bit(EXTENT_FLAG_LOGGING, &em->flags)) -- list_move(&em->list, &tree->modified_extents); - em->generation = gen; - clear_bit(EXTENT_FLAG_PINNED, &em->flags); - em->mod_start = em->start; -diff --git a/fs/ecryptfs/crypto.c b/fs/ecryptfs/crypto.c -index 2f6735d..31b148f 100644 ---- a/fs/ecryptfs/crypto.c -+++ b/fs/ecryptfs/crypto.c -@@ -1917,7 +1917,6 @@ ecryptfs_decode_from_filename(unsigned char *dst, size_t *dst_size, - break; - case 2: - dst[dst_byte_offset++] |= (src_byte); -- dst[dst_byte_offset] = 0; - current_bit_offset = 0; - break; - } -diff --git a/fs/ecryptfs/file.c b/fs/ecryptfs/file.c -index b1eaa7a..03df502 100644 ---- a/fs/ecryptfs/file.c -+++ b/fs/ecryptfs/file.c -@@ -191,23 +191,11 @@ static int ecryptfs_open(struct inode *inode, struct file *file) - { - int rc = 0; - struct ecryptfs_crypt_stat *crypt_stat = NULL; -- struct ecryptfs_mount_crypt_stat *mount_crypt_stat; - struct dentry *ecryptfs_dentry = file->f_path.dentry; - /* Private value of ecryptfs_dentry allocated in - * ecryptfs_lookup() */ - struct ecryptfs_file_info *file_info; - -- mount_crypt_stat = &ecryptfs_superblock_to_private( -- ecryptfs_dentry->d_sb)->mount_crypt_stat; -- if ((mount_crypt_stat->flags & ECRYPTFS_ENCRYPTED_VIEW_ENABLED) -- && ((file->f_flags & O_WRONLY) || (file->f_flags & O_RDWR) -- || (file->f_flags & O_CREAT) || (file->f_flags & O_TRUNC) -- || (file->f_flags & O_APPEND))) { -- printk(KERN_WARNING "Mount has encrypted view enabled; " -- "files may only be read\n"); -- rc = -EPERM; -- goto out; -- } - /* Released in ecryptfs_release or end of function if failure */ - file_info = kmem_cache_zalloc(ecryptfs_file_info_cache, GFP_KERNEL); - ecryptfs_set_file_private(file, file_info); -diff --git a/fs/ecryptfs/main.c b/fs/ecryptfs/main.c -index 1b119d3..34eb843 100644 ---- a/fs/ecryptfs/main.c -+++ b/fs/ecryptfs/main.c -@@ -493,6 +493,7 @@ static struct dentry *ecryptfs_mount(struct file_system_type *fs_type, int flags - { - struct super_block *s; - struct ecryptfs_sb_info *sbi; -+ struct ecryptfs_mount_crypt_stat *mount_crypt_stat; - struct ecryptfs_dentry_info *root_info; - const char *err = "Getting sb failed"; - struct inode *inode; -@@ -511,6 +512,7 @@ static struct dentry *ecryptfs_mount(struct file_system_type *fs_type, int flags - err = "Error parsing options"; - goto out; - } -+ mount_crypt_stat = &sbi->mount_crypt_stat; - - s = sget(fs_type, NULL, set_anon_super, flags, NULL); - if (IS_ERR(s)) { -@@ -557,11 +559,19 @@ static struct dentry *ecryptfs_mount(struct file_system_type *fs_type, int flags - - /** - * Set the POSIX ACL flag based on whether they're enabled in the lower -- * mount. Force a read-only eCryptfs mount if the lower mount is ro. -- * Allow a ro eCryptfs mount even when the lower mount is rw. -+ * mount. - */ - s->s_flags = flags & ~MS_POSIXACL; -- s->s_flags |= path.dentry->d_sb->s_flags & (MS_RDONLY | MS_POSIXACL); -+ s->s_flags |= path.dentry->d_sb->s_flags & MS_POSIXACL; -+ -+ /** -+ * Force a read-only eCryptfs mount when: -+ * 1) The lower mount is ro -+ * 2) The ecryptfs_encrypted_view mount option is specified -+ */ -+ if (path.dentry->d_sb->s_flags & MS_RDONLY || -+ mount_crypt_stat->flags & ECRYPTFS_ENCRYPTED_VIEW_ENABLED) -+ s->s_flags |= MS_RDONLY; - - s->s_maxbytes = path.dentry->d_sb->s_maxbytes; - s->s_blocksize = path.dentry->d_sb->s_blocksize; -diff --git a/fs/isofs/rock.c b/fs/isofs/rock.c -index f488bba..735d752 100644 ---- a/fs/isofs/rock.c -+++ b/fs/isofs/rock.c -@@ -30,6 +30,7 @@ struct rock_state { - int cont_size; - int cont_extent; - int cont_offset; -+ int cont_loops; - struct inode *inode; - }; - -@@ -73,6 +74,9 @@ static void init_rock_state(struct rock_state *rs, struct inode *inode) - rs->inode = inode; - } - -+/* Maximum number of Rock Ridge continuation entries */ -+#define RR_MAX_CE_ENTRIES 32 -+ - /* - * Returns 0 if the caller should continue scanning, 1 if the scan must end - * and -ve on error. -@@ -105,6 +109,8 @@ static int rock_continue(struct rock_state *rs) - goto out; - } - ret = -EIO; -+ if (++rs->cont_loops >= RR_MAX_CE_ENTRIES) -+ goto out; - bh = sb_bread(rs->inode->i_sb, rs->cont_extent); - if (bh) { - memcpy(rs->buffer, bh->b_data + rs->cont_offset, -@@ -356,6 +362,9 @@ repeat: - rs.cont_size = isonum_733(rr->u.CE.size); - break; - case SIG('E', 'R'): -+ /* Invalid length of ER tag id? */ -+ if (rr->u.ER.len_id + offsetof(struct rock_ridge, u.ER.data) > rr->len) -+ goto out; - ISOFS_SB(inode->i_sb)->s_rock = 1; - printk(KERN_DEBUG "ISO 9660 Extensions: "); - { -diff --git a/fs/namespace.c b/fs/namespace.c -index d9bf3ef..039f380 100644 ---- a/fs/namespace.c -+++ b/fs/namespace.c -@@ -1295,6 +1295,8 @@ void umount_tree(struct mount *mnt, int how) - } - if (last) { - last->mnt_hash.next = unmounted.first; -+ if (unmounted.first) -+ unmounted.first->pprev = &last->mnt_hash.next; - unmounted.first = tmp_list.first; - unmounted.first->pprev = &unmounted.first; - } -@@ -1439,6 +1441,9 @@ SYSCALL_DEFINE2(umount, char __user *, name, int, flags) - goto dput_and_out; - if (mnt->mnt.mnt_flags & MNT_LOCKED) - goto dput_and_out; -+ retval = -EPERM; -+ if (flags & MNT_FORCE && !capable(CAP_SYS_ADMIN)) -+ goto dput_and_out; - - retval = do_umount(mnt, flags); - dput_and_out: -@@ -1964,7 +1969,13 @@ static int do_remount(struct path *path, int flags, int mnt_flags, - } - if ((mnt->mnt.mnt_flags & MNT_LOCK_NODEV) && - !(mnt_flags & MNT_NODEV)) { -- return -EPERM; -+ /* Was the nodev implicitly added in mount? */ -+ if ((mnt->mnt_ns->user_ns != &init_user_ns) && -+ !(sb->s_type->fs_flags & FS_USERNS_DEV_MOUNT)) { -+ mnt_flags |= MNT_NODEV; -+ } else { -+ return -EPERM; -+ } - } - if ((mnt->mnt.mnt_flags & MNT_LOCK_NOSUID) && - !(mnt_flags & MNT_NOSUID)) { -diff --git a/fs/ncpfs/ioctl.c b/fs/ncpfs/ioctl.c -index 60426cc..2f970de 100644 ---- a/fs/ncpfs/ioctl.c -+++ b/fs/ncpfs/ioctl.c -@@ -448,7 +448,6 @@ static long __ncp_ioctl(struct inode *inode, unsigned int cmd, unsigned long arg - result = -EIO; - } - } -- result = 0; - } - mutex_unlock(&server->root_setup_lock); - -diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c -index bd01803..58258ad 100644 ---- a/fs/nfs/nfs4proc.c -+++ b/fs/nfs/nfs4proc.c -@@ -7589,6 +7589,9 @@ nfs4_proc_layoutget(struct nfs4_layoutget *lgp, gfp_t gfp_flags) - - dprintk("--> %s\n", __func__); - -+ /* nfs4_layoutget_release calls pnfs_put_layout_hdr */ -+ pnfs_get_layout_hdr(NFS_I(inode)->layout); -+ - lgp->args.layout.pages = nfs4_alloc_pages(max_pages, gfp_flags); - if (!lgp->args.layout.pages) { - nfs4_layoutget_release(lgp); -@@ -7601,9 +7604,6 @@ nfs4_proc_layoutget(struct nfs4_layoutget *lgp, gfp_t gfp_flags) - lgp->res.seq_res.sr_slot = NULL; - nfs4_init_sequence(&lgp->args.seq_args, &lgp->res.seq_res, 0); - -- /* nfs4_layoutget_release calls pnfs_put_layout_hdr */ -- pnfs_get_layout_hdr(NFS_I(inode)->layout); -- - task = rpc_run_task(&task_setup_data); - if (IS_ERR(task)) - return ERR_CAST(task); -diff --git a/fs/proc/base.c b/fs/proc/base.c -index b976062..489ba8c 100644 ---- a/fs/proc/base.c -+++ b/fs/proc/base.c -@@ -2555,6 +2555,57 @@ static const struct file_operations proc_projid_map_operations = { - .llseek = seq_lseek, - .release = proc_id_map_release, - }; -+ -+static int proc_setgroups_open(struct inode *inode, struct file *file) -+{ -+ struct user_namespace *ns = NULL; -+ struct task_struct *task; -+ int ret; -+ -+ ret = -ESRCH; -+ task = get_proc_task(inode); -+ if (task) { -+ rcu_read_lock(); -+ ns = get_user_ns(task_cred_xxx(task, user_ns)); -+ rcu_read_unlock(); -+ put_task_struct(task); -+ } -+ if (!ns) -+ goto err; -+ -+ if (file->f_mode & FMODE_WRITE) { -+ ret = -EACCES; -+ if (!ns_capable(ns, CAP_SYS_ADMIN)) -+ goto err_put_ns; -+ } -+ -+ ret = single_open(file, &proc_setgroups_show, ns); -+ if (ret) -+ goto err_put_ns; -+ -+ return 0; -+err_put_ns: -+ put_user_ns(ns); -+err: -+ return ret; -+} -+ -+static int proc_setgroups_release(struct inode *inode, struct file *file) -+{ -+ struct seq_file *seq = file->private_data; -+ struct user_namespace *ns = seq->private; -+ int ret = single_release(inode, file); -+ put_user_ns(ns); -+ return ret; -+} -+ -+static const struct file_operations proc_setgroups_operations = { -+ .open = proc_setgroups_open, -+ .write = proc_setgroups_write, -+ .read = seq_read, -+ .llseek = seq_lseek, -+ .release = proc_setgroups_release, -+}; - #endif /* CONFIG_USER_NS */ - - static int proc_pid_personality(struct seq_file *m, struct pid_namespace *ns, -@@ -2663,6 +2714,7 @@ static const struct pid_entry tgid_base_stuff[] = { - REG("uid_map", S_IRUGO|S_IWUSR, proc_uid_map_operations), - REG("gid_map", S_IRUGO|S_IWUSR, proc_gid_map_operations), - REG("projid_map", S_IRUGO|S_IWUSR, proc_projid_map_operations), -+ REG("setgroups", S_IRUGO|S_IWUSR, proc_setgroups_operations), - #endif - #ifdef CONFIG_CHECKPOINT_RESTORE - REG("timers", S_IRUGO, proc_timers_operations), -@@ -2998,6 +3050,7 @@ static const struct pid_entry tid_base_stuff[] = { - REG("uid_map", S_IRUGO|S_IWUSR, proc_uid_map_operations), - REG("gid_map", S_IRUGO|S_IWUSR, proc_gid_map_operations), - REG("projid_map", S_IRUGO|S_IWUSR, proc_projid_map_operations), -+ REG("setgroups", S_IRUGO|S_IWUSR, proc_setgroups_operations), - #endif - }; - -diff --git a/fs/udf/symlink.c b/fs/udf/symlink.c -index d7c6dbe..d89f324 100644 ---- a/fs/udf/symlink.c -+++ b/fs/udf/symlink.c -@@ -80,11 +80,17 @@ static int udf_symlink_filler(struct file *file, struct page *page) - struct inode *inode = page->mapping->host; - struct buffer_head *bh = NULL; - unsigned char *symlink; -- int err = -EIO; -+ int err; - unsigned char *p = kmap(page); - struct udf_inode_info *iinfo; - uint32_t pos; - -+ /* We don't support symlinks longer than one block */ -+ if (inode->i_size > inode->i_sb->s_blocksize) { -+ err = -ENAMETOOLONG; -+ goto out_unmap; -+ } -+ - iinfo = UDF_I(inode); - pos = udf_block_map(inode, 0); - -@@ -94,8 +100,10 @@ static int udf_symlink_filler(struct file *file, struct page *page) - } else { - bh = sb_bread(inode->i_sb, pos); - -- if (!bh) -- goto out; -+ if (!bh) { -+ err = -EIO; -+ goto out_unlock_inode; -+ } - - symlink = bh->b_data; - } -@@ -109,9 +117,10 @@ static int udf_symlink_filler(struct file *file, struct page *page) - unlock_page(page); - return 0; - --out: -+out_unlock_inode: - up_read(&iinfo->i_data_sem); - SetPageError(page); -+out_unmap: - kunmap(page); - unlock_page(page); - return err; -diff --git a/include/linux/audit.h b/include/linux/audit.h -index ec1464d..419b7d7 100644 ---- a/include/linux/audit.h -+++ b/include/linux/audit.h -@@ -47,6 +47,7 @@ struct sk_buff; - - struct audit_krule { - int vers_ops; -+ u32 pflags; - u32 flags; - u32 listnr; - u32 action; -@@ -64,6 +65,9 @@ struct audit_krule { - u64 prio; - }; - -+/* Flag to indicate legacy AUDIT_LOGINUID unset usage */ -+#define AUDIT_LOGINUID_LEGACY 0x1 -+ - struct audit_field { - u32 type; - u32 val; -diff --git a/include/linux/cred.h b/include/linux/cred.h -index 04421e8..6c58dd7 100644 ---- a/include/linux/cred.h -+++ b/include/linux/cred.h -@@ -68,6 +68,7 @@ extern void groups_free(struct group_info *); - extern int set_current_groups(struct group_info *); - extern int set_groups(struct cred *, struct group_info *); - extern int groups_search(const struct group_info *, kgid_t); -+extern bool may_setgroups(void); - - /* access the groups "array" with this macro */ - #define GROUP_AT(gi, i) \ -diff --git a/include/linux/user_namespace.h b/include/linux/user_namespace.h -index 4836ba3..e92abf9 100644 ---- a/include/linux/user_namespace.h -+++ b/include/linux/user_namespace.h -@@ -17,6 +17,10 @@ struct uid_gid_map { /* 64 bytes -- 1 cache line */ - } extent[UID_GID_MAP_MAX_EXTENTS]; - }; - -+#define USERNS_SETGROUPS_ALLOWED 1UL -+ -+#define USERNS_INIT_FLAGS USERNS_SETGROUPS_ALLOWED -+ - struct user_namespace { - struct uid_gid_map uid_map; - struct uid_gid_map gid_map; -@@ -27,6 +31,7 @@ struct user_namespace { - kuid_t owner; - kgid_t group; - unsigned int proc_inum; -+ unsigned long flags; - - /* Register of per-UID persistent keyrings for this namespace */ - #ifdef CONFIG_PERSISTENT_KEYRINGS -@@ -63,6 +68,9 @@ extern struct seq_operations proc_projid_seq_operations; - extern ssize_t proc_uid_map_write(struct file *, const char __user *, size_t, loff_t *); - extern ssize_t proc_gid_map_write(struct file *, const char __user *, size_t, loff_t *); - extern ssize_t proc_projid_map_write(struct file *, const char __user *, size_t, loff_t *); -+extern ssize_t proc_setgroups_write(struct file *, const char __user *, size_t, loff_t *); -+extern int proc_setgroups_show(struct seq_file *m, void *v); -+extern bool userns_may_setgroups(const struct user_namespace *ns); - #else - - static inline struct user_namespace *get_user_ns(struct user_namespace *ns) -@@ -87,6 +95,10 @@ static inline void put_user_ns(struct user_namespace *ns) - { - } - -+static inline bool userns_may_setgroups(const struct user_namespace *ns) -+{ -+ return true; -+} - #endif - - #endif /* _LINUX_USER_H */ -diff --git a/kernel/auditfilter.c b/kernel/auditfilter.c -index 92062fd..598c1dc 100644 ---- a/kernel/auditfilter.c -+++ b/kernel/auditfilter.c -@@ -429,6 +429,7 @@ static struct audit_entry *audit_data_to_entry(struct audit_rule_data *data, - if ((f->type == AUDIT_LOGINUID) && (f->val == AUDIT_UID_UNSET)) { - f->type = AUDIT_LOGINUID_SET; - f->val = 0; -+ entry->rule.pflags |= AUDIT_LOGINUID_LEGACY; - } - - err = audit_field_valid(entry, f); -@@ -604,6 +605,13 @@ static struct audit_rule_data *audit_krule_to_data(struct audit_krule *krule) - data->buflen += data->values[i] = - audit_pack_string(&bufp, krule->filterkey); - break; -+ case AUDIT_LOGINUID_SET: -+ if (krule->pflags & AUDIT_LOGINUID_LEGACY && !f->val) { -+ data->fields[i] = AUDIT_LOGINUID; -+ data->values[i] = AUDIT_UID_UNSET; -+ break; -+ } -+ /* fallthrough if set */ - default: - data->values[i] = f->val; - } -@@ -620,6 +628,7 @@ static int audit_compare_rule(struct audit_krule *a, struct audit_krule *b) - int i; - - if (a->flags != b->flags || -+ a->pflags != b->pflags || - a->listnr != b->listnr || - a->action != b->action || - a->field_count != b->field_count) -@@ -738,6 +747,7 @@ struct audit_entry *audit_dupe_rule(struct audit_krule *old) - new = &entry->rule; - new->vers_ops = old->vers_ops; - new->flags = old->flags; -+ new->pflags = old->pflags; - new->listnr = old->listnr; - new->action = old->action; - for (i = 0; i < AUDIT_BITMASK_SIZE; i++) -diff --git a/kernel/groups.c b/kernel/groups.c -index 90cf1c3..67b4ba3 100644 ---- a/kernel/groups.c -+++ b/kernel/groups.c -@@ -6,6 +6,7 @@ - #include <linux/slab.h> - #include <linux/security.h> - #include <linux/syscalls.h> -+#include <linux/user_namespace.h> - #include <asm/uaccess.h> - - /* init to 2 - one for init_task, one to ensure it is never freed */ -@@ -223,6 +224,14 @@ out: - return i; - } - -+bool may_setgroups(void) -+{ -+ struct user_namespace *user_ns = current_user_ns(); -+ -+ return ns_capable(user_ns, CAP_SETGID) && -+ userns_may_setgroups(user_ns); -+} -+ - /* - * SMP: Our groups are copy-on-write. We can set them safely - * without another task interfering. -@@ -233,7 +242,7 @@ SYSCALL_DEFINE2(setgroups, int, gidsetsize, gid_t __user *, grouplist) - struct group_info *group_info; - int retval; - -- if (!ns_capable(current_user_ns(), CAP_SETGID)) -+ if (!may_setgroups()) - return -EPERM; - if ((unsigned)gidsetsize > NGROUPS_MAX) - return -EINVAL; -diff --git a/kernel/pid.c b/kernel/pid.c -index 9b9a266..82430c8 100644 ---- a/kernel/pid.c -+++ b/kernel/pid.c -@@ -341,6 +341,8 @@ out: - - out_unlock: - spin_unlock_irq(&pidmap_lock); -+ put_pid_ns(ns); -+ - out_free: - while (++i <= ns->level) - free_pidmap(pid->numbers + i); -diff --git a/kernel/uid16.c b/kernel/uid16.c -index 602e5bb..d58cc4d 100644 ---- a/kernel/uid16.c -+++ b/kernel/uid16.c -@@ -176,7 +176,7 @@ SYSCALL_DEFINE2(setgroups16, int, gidsetsize, old_gid_t __user *, grouplist) - struct group_info *group_info; - int retval; - -- if (!ns_capable(current_user_ns(), CAP_SETGID)) -+ if (!may_setgroups()) - return -EPERM; - if ((unsigned)gidsetsize > NGROUPS_MAX) - return -EINVAL; -diff --git a/kernel/user.c b/kernel/user.c -index c006131..c2bbb50 100644 ---- a/kernel/user.c -+++ b/kernel/user.c -@@ -51,6 +51,7 @@ struct user_namespace init_user_ns = { - .owner = GLOBAL_ROOT_UID, - .group = GLOBAL_ROOT_GID, - .proc_inum = PROC_USER_INIT_INO, -+ .flags = USERNS_INIT_FLAGS, - #ifdef CONFIG_PERSISTENT_KEYRINGS - .persistent_keyring_register_sem = - __RWSEM_INITIALIZER(init_user_ns.persistent_keyring_register_sem), -diff --git a/kernel/user_namespace.c b/kernel/user_namespace.c -index 80a57af..153971e 100644 ---- a/kernel/user_namespace.c -+++ b/kernel/user_namespace.c -@@ -24,6 +24,7 @@ - #include <linux/fs_struct.h> - - static struct kmem_cache *user_ns_cachep __read_mostly; -+static DEFINE_MUTEX(userns_state_mutex); - - static bool new_idmap_permitted(const struct file *file, - struct user_namespace *ns, int cap_setid, -@@ -99,6 +100,11 @@ int create_user_ns(struct cred *new) - ns->owner = owner; - ns->group = group; - -+ /* Inherit USERNS_SETGROUPS_ALLOWED from our parent */ -+ mutex_lock(&userns_state_mutex); -+ ns->flags = parent_ns->flags; -+ mutex_unlock(&userns_state_mutex); -+ - set_cred_user_ns(new, ns); - - #ifdef CONFIG_PERSISTENT_KEYRINGS -@@ -581,9 +587,6 @@ static bool mappings_overlap(struct uid_gid_map *new_map, struct uid_gid_extent - return false; - } - -- --static DEFINE_MUTEX(id_map_mutex); -- - static ssize_t map_write(struct file *file, const char __user *buf, - size_t count, loff_t *ppos, - int cap_setid, -@@ -600,7 +603,7 @@ static ssize_t map_write(struct file *file, const char __user *buf, - ssize_t ret = -EINVAL; - - /* -- * The id_map_mutex serializes all writes to any given map. -+ * The userns_state_mutex serializes all writes to any given map. - * - * Any map is only ever written once. - * -@@ -618,7 +621,7 @@ static ssize_t map_write(struct file *file, const char __user *buf, - * order and smp_rmb() is guaranteed that we don't have crazy - * architectures returning stale data. - */ -- mutex_lock(&id_map_mutex); -+ mutex_lock(&userns_state_mutex); - - ret = -EPERM; - /* Only allow one successful write to the map */ -@@ -745,7 +748,7 @@ static ssize_t map_write(struct file *file, const char __user *buf, - *ppos = count; - ret = count; - out: -- mutex_unlock(&id_map_mutex); -+ mutex_unlock(&userns_state_mutex); - if (page) - free_page(page); - return ret; -@@ -804,17 +807,21 @@ static bool new_idmap_permitted(const struct file *file, - struct user_namespace *ns, int cap_setid, - struct uid_gid_map *new_map) - { -- /* Allow mapping to your own filesystem ids */ -- if ((new_map->nr_extents == 1) && (new_map->extent[0].count == 1)) { -+ const struct cred *cred = file->f_cred; -+ /* Don't allow mappings that would allow anything that wouldn't -+ * be allowed without the establishment of unprivileged mappings. -+ */ -+ if ((new_map->nr_extents == 1) && (new_map->extent[0].count == 1) && -+ uid_eq(ns->owner, cred->euid)) { - u32 id = new_map->extent[0].lower_first; - if (cap_setid == CAP_SETUID) { - kuid_t uid = make_kuid(ns->parent, id); -- if (uid_eq(uid, file->f_cred->fsuid)) -+ if (uid_eq(uid, cred->euid)) - return true; -- } -- else if (cap_setid == CAP_SETGID) { -+ } else if (cap_setid == CAP_SETGID) { - kgid_t gid = make_kgid(ns->parent, id); -- if (gid_eq(gid, file->f_cred->fsgid)) -+ if (!(ns->flags & USERNS_SETGROUPS_ALLOWED) && -+ gid_eq(gid, cred->egid)) - return true; - } - } -@@ -834,6 +841,100 @@ static bool new_idmap_permitted(const struct file *file, - return false; - } - -+int proc_setgroups_show(struct seq_file *seq, void *v) -+{ -+ struct user_namespace *ns = seq->private; -+ unsigned long userns_flags = ACCESS_ONCE(ns->flags); -+ -+ seq_printf(seq, "%s\n", -+ (userns_flags & USERNS_SETGROUPS_ALLOWED) ? -+ "allow" : "deny"); -+ return 0; -+} -+ -+ssize_t proc_setgroups_write(struct file *file, const char __user *buf, -+ size_t count, loff_t *ppos) -+{ -+ struct seq_file *seq = file->private_data; -+ struct user_namespace *ns = seq->private; -+ char kbuf[8], *pos; -+ bool setgroups_allowed; -+ ssize_t ret; -+ -+ /* Only allow a very narrow range of strings to be written */ -+ ret = -EINVAL; -+ if ((*ppos != 0) || (count >= sizeof(kbuf))) -+ goto out; -+ -+ /* What was written? */ -+ ret = -EFAULT; -+ if (copy_from_user(kbuf, buf, count)) -+ goto out; -+ kbuf[count] = '\0'; -+ pos = kbuf; -+ -+ /* What is being requested? */ -+ ret = -EINVAL; -+ if (strncmp(pos, "allow", 5) == 0) { -+ pos += 5; -+ setgroups_allowed = true; -+ } -+ else if (strncmp(pos, "deny", 4) == 0) { -+ pos += 4; -+ setgroups_allowed = false; -+ } -+ else -+ goto out; -+ -+ /* Verify there is not trailing junk on the line */ -+ pos = skip_spaces(pos); -+ if (*pos != '\0') -+ goto out; -+ -+ ret = -EPERM; -+ mutex_lock(&userns_state_mutex); -+ if (setgroups_allowed) { -+ /* Enabling setgroups after setgroups has been disabled -+ * is not allowed. -+ */ -+ if (!(ns->flags & USERNS_SETGROUPS_ALLOWED)) -+ goto out_unlock; -+ } else { -+ /* Permanently disabling setgroups after setgroups has -+ * been enabled by writing the gid_map is not allowed. -+ */ -+ if (ns->gid_map.nr_extents != 0) -+ goto out_unlock; -+ ns->flags &= ~USERNS_SETGROUPS_ALLOWED; -+ } -+ mutex_unlock(&userns_state_mutex); -+ -+ /* Report a successful write */ -+ *ppos = count; -+ ret = count; -+out: -+ return ret; -+out_unlock: -+ mutex_unlock(&userns_state_mutex); -+ goto out; -+} -+ -+bool userns_may_setgroups(const struct user_namespace *ns) -+{ -+ bool allowed; -+ -+ mutex_lock(&userns_state_mutex); -+ /* It is not safe to use setgroups until a gid mapping in -+ * the user namespace has been established. -+ */ -+ allowed = ns->gid_map.nr_extents != 0; -+ /* Is setgroups allowed? */ -+ allowed = allowed && (ns->flags & USERNS_SETGROUPS_ALLOWED); -+ mutex_unlock(&userns_state_mutex); -+ -+ return allowed; -+} -+ - static void *userns_get(struct task_struct *task) - { - struct user_namespace *user_ns; -diff --git a/net/mac80211/key.c b/net/mac80211/key.c -index 6ff65a1..d78b37a 100644 ---- a/net/mac80211/key.c -+++ b/net/mac80211/key.c -@@ -652,7 +652,7 @@ void ieee80211_free_sta_keys(struct ieee80211_local *local, - int i; - - mutex_lock(&local->key_mtx); -- for (i = 0; i < NUM_DEFAULT_KEYS; i++) { -+ for (i = 0; i < ARRAY_SIZE(sta->gtk); i++) { - key = key_mtx_dereference(local, sta->gtk[i]); - if (!key) - continue; -diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c -index 095c160..1e4dc4e 100644 ---- a/net/mac80211/rx.c -+++ b/net/mac80211/rx.c -@@ -1679,14 +1679,14 @@ ieee80211_rx_h_defragment(struct ieee80211_rx_data *rx) - sc = le16_to_cpu(hdr->seq_ctrl); - frag = sc & IEEE80211_SCTL_FRAG; - -- if (likely(!ieee80211_has_morefrags(fc) && frag == 0)) -- goto out; -- - if (is_multicast_ether_addr(hdr->addr1)) { - rx->local->dot11MulticastReceivedFrameCount++; -- goto out; -+ goto out_no_led; - } - -+ if (likely(!ieee80211_has_morefrags(fc) && frag == 0)) -+ goto out; -+ - I802_DEBUG_INC(rx->local->rx_handlers_fragments); - - if (skb_linearize(rx->skb)) -@@ -1777,9 +1777,10 @@ ieee80211_rx_h_defragment(struct ieee80211_rx_data *rx) - status->rx_flags |= IEEE80211_RX_FRAGMENTED; - - out: -+ ieee80211_led_rx(rx->local); -+ out_no_led: - if (rx->sta) - rx->sta->rx_packets++; -- ieee80211_led_rx(rx->local); - return RX_CONTINUE; - } - -diff --git a/security/keys/encrypted-keys/encrypted.c b/security/keys/encrypted-keys/encrypted.c -index 9e1e005..c4c8df4 100644 ---- a/security/keys/encrypted-keys/encrypted.c -+++ b/security/keys/encrypted-keys/encrypted.c -@@ -1018,10 +1018,13 @@ static int __init init_encrypted(void) - ret = encrypted_shash_alloc(); - if (ret < 0) - return ret; -+ ret = aes_get_sizes(); -+ if (ret < 0) -+ goto out; - ret = register_key_type(&key_type_encrypted); - if (ret < 0) - goto out; -- return aes_get_sizes(); -+ return 0; - out: - encrypted_shash_release(); - return ret; -diff --git a/tools/testing/selftests/mount/unprivileged-remount-test.c b/tools/testing/selftests/mount/unprivileged-remount-test.c -index 1b3ff2f..5177850 100644 ---- a/tools/testing/selftests/mount/unprivileged-remount-test.c -+++ b/tools/testing/selftests/mount/unprivileged-remount-test.c -@@ -6,6 +6,8 @@ - #include <sys/types.h> - #include <sys/mount.h> - #include <sys/wait.h> -+#include <sys/vfs.h> -+#include <sys/statvfs.h> - #include <stdlib.h> - #include <unistd.h> - #include <fcntl.h> -@@ -32,11 +34,14 @@ - # define CLONE_NEWPID 0x20000000 - #endif - -+#ifndef MS_REC -+# define MS_REC 16384 -+#endif - #ifndef MS_RELATIME --#define MS_RELATIME (1 << 21) -+# define MS_RELATIME (1 << 21) - #endif - #ifndef MS_STRICTATIME --#define MS_STRICTATIME (1 << 24) -+# define MS_STRICTATIME (1 << 24) - #endif - - static void die(char *fmt, ...) -@@ -48,17 +53,14 @@ static void die(char *fmt, ...) - exit(EXIT_FAILURE); - } - --static void write_file(char *filename, char *fmt, ...) -+static void vmaybe_write_file(bool enoent_ok, char *filename, char *fmt, va_list ap) - { - char buf[4096]; - int fd; - ssize_t written; - int buf_len; -- va_list ap; - -- va_start(ap, fmt); - buf_len = vsnprintf(buf, sizeof(buf), fmt, ap); -- va_end(ap); - if (buf_len < 0) { - die("vsnprintf failed: %s\n", - strerror(errno)); -@@ -69,6 +71,8 @@ static void write_file(char *filename, char *fmt, ...) - - fd = open(filename, O_WRONLY); - if (fd < 0) { -+ if ((errno == ENOENT) && enoent_ok) -+ return; - die("open of %s failed: %s\n", - filename, strerror(errno)); - } -@@ -87,6 +91,65 @@ static void write_file(char *filename, char *fmt, ...) - } - } - -+static void maybe_write_file(char *filename, char *fmt, ...) -+{ -+ va_list ap; -+ -+ va_start(ap, fmt); -+ vmaybe_write_file(true, filename, fmt, ap); -+ va_end(ap); -+ -+} -+ -+static void write_file(char *filename, char *fmt, ...) -+{ -+ va_list ap; -+ -+ va_start(ap, fmt); -+ vmaybe_write_file(false, filename, fmt, ap); -+ va_end(ap); -+ -+} -+ -+static int read_mnt_flags(const char *path) -+{ -+ int ret; -+ struct statvfs stat; -+ int mnt_flags; -+ -+ ret = statvfs(path, &stat); -+ if (ret != 0) { -+ die("statvfs of %s failed: %s\n", -+ path, strerror(errno)); -+ } -+ if (stat.f_flag & ~(ST_RDONLY | ST_NOSUID | ST_NODEV | \ -+ ST_NOEXEC | ST_NOATIME | ST_NODIRATIME | ST_RELATIME | \ -+ ST_SYNCHRONOUS | ST_MANDLOCK)) { -+ die("Unrecognized mount flags\n"); -+ } -+ mnt_flags = 0; -+ if (stat.f_flag & ST_RDONLY) -+ mnt_flags |= MS_RDONLY; -+ if (stat.f_flag & ST_NOSUID) -+ mnt_flags |= MS_NOSUID; -+ if (stat.f_flag & ST_NODEV) -+ mnt_flags |= MS_NODEV; -+ if (stat.f_flag & ST_NOEXEC) -+ mnt_flags |= MS_NOEXEC; -+ if (stat.f_flag & ST_NOATIME) -+ mnt_flags |= MS_NOATIME; -+ if (stat.f_flag & ST_NODIRATIME) -+ mnt_flags |= MS_NODIRATIME; -+ if (stat.f_flag & ST_RELATIME) -+ mnt_flags |= MS_RELATIME; -+ if (stat.f_flag & ST_SYNCHRONOUS) -+ mnt_flags |= MS_SYNCHRONOUS; -+ if (stat.f_flag & ST_MANDLOCK) -+ mnt_flags |= ST_MANDLOCK; -+ -+ return mnt_flags; -+} -+ - static void create_and_enter_userns(void) - { - uid_t uid; -@@ -100,13 +163,10 @@ static void create_and_enter_userns(void) - strerror(errno)); - } - -+ maybe_write_file("/proc/self/setgroups", "deny"); - write_file("/proc/self/uid_map", "0 %d 1", uid); - write_file("/proc/self/gid_map", "0 %d 1", gid); - -- if (setgroups(0, NULL) != 0) { -- die("setgroups failed: %s\n", -- strerror(errno)); -- } - if (setgid(0) != 0) { - die ("setgid(0) failed %s\n", - strerror(errno)); -@@ -118,7 +178,8 @@ static void create_and_enter_userns(void) - } - - static --bool test_unpriv_remount(int mount_flags, int remount_flags, int invalid_flags) -+bool test_unpriv_remount(const char *fstype, const char *mount_options, -+ int mount_flags, int remount_flags, int invalid_flags) - { - pid_t child; - -@@ -151,9 +212,11 @@ bool test_unpriv_remount(int mount_flags, int remount_flags, int invalid_flags) - strerror(errno)); - } - -- if (mount("testing", "/tmp", "ramfs", mount_flags, NULL) != 0) { -- die("mount of /tmp failed: %s\n", -- strerror(errno)); -+ if (mount("testing", "/tmp", fstype, mount_flags, mount_options) != 0) { -+ die("mount of %s with options '%s' on /tmp failed: %s\n", -+ fstype, -+ mount_options? mount_options : "", -+ strerror(errno)); - } - - create_and_enter_userns(); -@@ -181,62 +244,127 @@ bool test_unpriv_remount(int mount_flags, int remount_flags, int invalid_flags) - - static bool test_unpriv_remount_simple(int mount_flags) - { -- return test_unpriv_remount(mount_flags, mount_flags, 0); -+ return test_unpriv_remount("ramfs", NULL, mount_flags, mount_flags, 0); - } - - static bool test_unpriv_remount_atime(int mount_flags, int invalid_flags) - { -- return test_unpriv_remount(mount_flags, mount_flags, invalid_flags); -+ return test_unpriv_remount("ramfs", NULL, mount_flags, mount_flags, -+ invalid_flags); -+} -+ -+static bool test_priv_mount_unpriv_remount(void) -+{ -+ pid_t child; -+ int ret; -+ const char *orig_path = "/dev"; -+ const char *dest_path = "/tmp"; -+ int orig_mnt_flags, remount_mnt_flags; -+ -+ child = fork(); -+ if (child == -1) { -+ die("fork failed: %s\n", -+ strerror(errno)); -+ } -+ if (child != 0) { /* parent */ -+ pid_t pid; -+ int status; -+ pid = waitpid(child, &status, 0); -+ if (pid == -1) { -+ die("waitpid failed: %s\n", -+ strerror(errno)); -+ } -+ if (pid != child) { -+ die("waited for %d got %d\n", -+ child, pid); -+ } -+ if (!WIFEXITED(status)) { -+ die("child did not terminate cleanly\n"); -+ } -+ return WEXITSTATUS(status) == EXIT_SUCCESS ? true : false; -+ } -+ -+ orig_mnt_flags = read_mnt_flags(orig_path); -+ -+ create_and_enter_userns(); -+ ret = unshare(CLONE_NEWNS); -+ if (ret != 0) { -+ die("unshare(CLONE_NEWNS) failed: %s\n", -+ strerror(errno)); -+ } -+ -+ ret = mount(orig_path, dest_path, "bind", MS_BIND | MS_REC, NULL); -+ if (ret != 0) { -+ die("recursive bind mount of %s onto %s failed: %s\n", -+ orig_path, dest_path, strerror(errno)); -+ } -+ -+ ret = mount(dest_path, dest_path, "none", -+ MS_REMOUNT | MS_BIND | orig_mnt_flags , NULL); -+ if (ret != 0) { -+ /* system("cat /proc/self/mounts"); */ -+ die("remount of /tmp failed: %s\n", -+ strerror(errno)); -+ } -+ -+ remount_mnt_flags = read_mnt_flags(dest_path); -+ if (orig_mnt_flags != remount_mnt_flags) { -+ die("Mount flags unexpectedly changed during remount of %s originally mounted on %s\n", -+ dest_path, orig_path); -+ } -+ exit(EXIT_SUCCESS); - } - - int main(int argc, char **argv) - { -- if (!test_unpriv_remount_simple(MS_RDONLY|MS_NODEV)) { -+ if (!test_unpriv_remount_simple(MS_RDONLY)) { - die("MS_RDONLY malfunctions\n"); - } -- if (!test_unpriv_remount_simple(MS_NODEV)) { -+ if (!test_unpriv_remount("devpts", "newinstance", MS_NODEV, MS_NODEV, 0)) { - die("MS_NODEV malfunctions\n"); - } -- if (!test_unpriv_remount_simple(MS_NOSUID|MS_NODEV)) { -+ if (!test_unpriv_remount_simple(MS_NOSUID)) { - die("MS_NOSUID malfunctions\n"); - } -- if (!test_unpriv_remount_simple(MS_NOEXEC|MS_NODEV)) { -+ if (!test_unpriv_remount_simple(MS_NOEXEC)) { - die("MS_NOEXEC malfunctions\n"); - } -- if (!test_unpriv_remount_atime(MS_RELATIME|MS_NODEV, -- MS_NOATIME|MS_NODEV)) -+ if (!test_unpriv_remount_atime(MS_RELATIME, -+ MS_NOATIME)) - { - die("MS_RELATIME malfunctions\n"); - } -- if (!test_unpriv_remount_atime(MS_STRICTATIME|MS_NODEV, -- MS_NOATIME|MS_NODEV)) -+ if (!test_unpriv_remount_atime(MS_STRICTATIME, -+ MS_NOATIME)) - { - die("MS_STRICTATIME malfunctions\n"); - } -- if (!test_unpriv_remount_atime(MS_NOATIME|MS_NODEV, -- MS_STRICTATIME|MS_NODEV)) -+ if (!test_unpriv_remount_atime(MS_NOATIME, -+ MS_STRICTATIME)) - { -- die("MS_RELATIME malfunctions\n"); -+ die("MS_NOATIME malfunctions\n"); - } -- if (!test_unpriv_remount_atime(MS_RELATIME|MS_NODIRATIME|MS_NODEV, -- MS_NOATIME|MS_NODEV)) -+ if (!test_unpriv_remount_atime(MS_RELATIME|MS_NODIRATIME, -+ MS_NOATIME)) - { -- die("MS_RELATIME malfunctions\n"); -+ die("MS_RELATIME|MS_NODIRATIME malfunctions\n"); - } -- if (!test_unpriv_remount_atime(MS_STRICTATIME|MS_NODIRATIME|MS_NODEV, -- MS_NOATIME|MS_NODEV)) -+ if (!test_unpriv_remount_atime(MS_STRICTATIME|MS_NODIRATIME, -+ MS_NOATIME)) - { -- die("MS_RELATIME malfunctions\n"); -+ die("MS_STRICTATIME|MS_NODIRATIME malfunctions\n"); - } -- if (!test_unpriv_remount_atime(MS_NOATIME|MS_NODIRATIME|MS_NODEV, -- MS_STRICTATIME|MS_NODEV)) -+ if (!test_unpriv_remount_atime(MS_NOATIME|MS_NODIRATIME, -+ MS_STRICTATIME)) - { -- die("MS_RELATIME malfunctions\n"); -+ die("MS_NOATIME|MS_DIRATIME malfunctions\n"); - } -- if (!test_unpriv_remount(MS_STRICTATIME|MS_NODEV, MS_NODEV, -- MS_NOATIME|MS_NODEV)) -+ if (!test_unpriv_remount("ramfs", NULL, MS_STRICTATIME, 0, MS_NOATIME)) - { - die("Default atime malfunctions\n"); - } -+ if (!test_priv_mount_unpriv_remount()) { -+ die("Mount flags unexpectedly changed after remount\n"); -+ } - return EXIT_SUCCESS; - } diff --git a/projects/imx6/patches/linux/linux-000-patch-3.14.28-29.patch b/projects/imx6/patches/linux/linux-000-patch-3.14.28-29.patch deleted file mode 100644 index 73bfc7ea194..00000000000 --- a/projects/imx6/patches/linux/linux-000-patch-3.14.28-29.patch +++ /dev/null @@ -1,2545 +0,0 @@ -diff --git a/Documentation/ramoops.txt b/Documentation/ramoops.txt -index 69b3cac..5d86756 100644 ---- a/Documentation/ramoops.txt -+++ b/Documentation/ramoops.txt -@@ -14,11 +14,19 @@ survive after a restart. - - 1. Ramoops concepts - --Ramoops uses a predefined memory area to store the dump. The start and size of --the memory area are set using two variables: -+Ramoops uses a predefined memory area to store the dump. The start and size -+and type of the memory area are set using three variables: - * "mem_address" for the start - * "mem_size" for the size. The memory size will be rounded down to a - power of two. -+ * "mem_type" to specifiy if the memory type (default is pgprot_writecombine). -+ -+Typically the default value of mem_type=0 should be used as that sets the pstore -+mapping to pgprot_writecombine. Setting mem_type=1 attempts to use -+pgprot_noncached, which only works on some platforms. This is because pstore -+depends on atomic operations. At least on ARM, pgprot_noncached causes the -+memory to be mapped strongly ordered, and atomic operations on strongly ordered -+memory are implementation defined, and won't work on many ARMs such as omaps. - - The memory area is divided into "record_size" chunks (also rounded down to - power of two) and each oops/panic writes a "record_size" chunk of -@@ -55,6 +63,7 @@ Setting the ramoops parameters can be done in 2 different manners: - static struct ramoops_platform_data ramoops_data = { - .mem_size = <...>, - .mem_address = <...>, -+ .mem_type = <...>, - .record_size = <...>, - .dump_oops = <...>, - .ecc = <...>, -diff --git a/Makefile b/Makefile -index a2e572b..7aff64e 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,6 +1,6 @@ - VERSION = 3 - PATCHLEVEL = 14 --SUBLEVEL = 28 -+SUBLEVEL = 29 - EXTRAVERSION = - NAME = Remembering Coco - -diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi -index 767f0e3..f60aeee 100644 ---- a/arch/arm/boot/dts/dra7.dtsi -+++ b/arch/arm/boot/dts/dra7.dtsi -@@ -458,7 +458,7 @@ - }; - - wdt2: wdt@4ae14000 { -- compatible = "ti,omap4-wdt"; -+ compatible = "ti,omap3-wdt"; - reg = <0x4ae14000 0x80>; - interrupts = <GIC_SPI 80 IRQ_TYPE_LEVEL_HIGH>; - ti,hwmods = "wd_timer2"; -diff --git a/arch/arm/boot/dts/s3c6410-mini6410.dts b/arch/arm/boot/dts/s3c6410-mini6410.dts -index 57e00f9..a25debb 100644 ---- a/arch/arm/boot/dts/s3c6410-mini6410.dts -+++ b/arch/arm/boot/dts/s3c6410-mini6410.dts -@@ -198,10 +198,6 @@ - status = "okay"; - }; - --&pwm { -- status = "okay"; --}; -- - &pinctrl0 { - gpio_leds: gpio-leds { - samsung,pins = "gpk-4", "gpk-5", "gpk-6", "gpk-7"; -diff --git a/arch/arm/boot/dts/s3c64xx.dtsi b/arch/arm/boot/dts/s3c64xx.dtsi -index 4e3be4d..4f1eff3 100644 ---- a/arch/arm/boot/dts/s3c64xx.dtsi -+++ b/arch/arm/boot/dts/s3c64xx.dtsi -@@ -168,7 +168,6 @@ - clocks = <&clocks PCLK_PWM>; - samsung,pwm-outputs = <0>, <1>; - #pwm-cells = <3>; -- status = "disabled"; - }; - - pinctrl0: pinctrl@7f008000 { -diff --git a/arch/arm/configs/multi_v7_defconfig b/arch/arm/configs/multi_v7_defconfig -index ee69829..cf4823b 100644 ---- a/arch/arm/configs/multi_v7_defconfig -+++ b/arch/arm/configs/multi_v7_defconfig -@@ -235,6 +235,7 @@ CONFIG_SND_SOC_TEGRA_MAX98090=y - CONFIG_USB=y - CONFIG_USB_XHCI_HCD=y - CONFIG_USB_EHCI_HCD=y -+CONFIG_USB_EHCI_EXYNOS=y - CONFIG_USB_EHCI_TEGRA=y - CONFIG_USB_EHCI_HCD_PLATFORM=y - CONFIG_USB_ISP1760_HCD=y -diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c -index 1e8b030..aab70f6 100644 ---- a/arch/arm/kernel/setup.c -+++ b/arch/arm/kernel/setup.c -@@ -1021,6 +1021,15 @@ static int c_show(struct seq_file *m, void *v) - seq_printf(m, "model name\t: %s rev %d (%s)\n", - cpu_name, cpuid & 15, elf_platform); - -+#if defined(CONFIG_SMP) -+ seq_printf(m, "BogoMIPS\t: %lu.%02lu\n", -+ per_cpu(cpu_data, i).loops_per_jiffy / (500000UL/HZ), -+ (per_cpu(cpu_data, i).loops_per_jiffy / (5000UL/HZ)) % 100); -+#else -+ seq_printf(m, "BogoMIPS\t: %lu.%02lu\n", -+ loops_per_jiffy / (500000/HZ), -+ (loops_per_jiffy / (5000/HZ)) % 100); -+#endif - /* dump out the processor features */ - seq_puts(m, "Features\t: "); - -diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c -index b7b4c86..8cd3724 100644 ---- a/arch/arm/kernel/smp.c -+++ b/arch/arm/kernel/smp.c -@@ -388,8 +388,17 @@ asmlinkage void secondary_start_kernel(void) - - void __init smp_cpus_done(unsigned int max_cpus) - { -- printk(KERN_INFO "SMP: Total of %d processors activated.\n", -- num_online_cpus()); -+ int cpu; -+ unsigned long bogosum = 0; -+ -+ for_each_online_cpu(cpu) -+ bogosum += per_cpu(cpu_data, cpu).loops_per_jiffy; -+ -+ printk(KERN_INFO "SMP: Total of %d processors activated " -+ "(%lu.%02lu BogoMIPS).\n", -+ num_online_cpus(), -+ bogosum / (500000/HZ), -+ (bogosum / (5000/HZ)) % 100); - - hyp_mode_check(); - } -diff --git a/arch/arm/mach-mvebu/coherency.c b/arch/arm/mach-mvebu/coherency.c -index 4e9d581..c295c10 100644 ---- a/arch/arm/mach-mvebu/coherency.c -+++ b/arch/arm/mach-mvebu/coherency.c -@@ -125,6 +125,29 @@ int __init coherency_init(void) - { - struct device_node *np; - -+ /* -+ * The coherency fabric is needed: -+ * - For coherency between processors on Armada XP, so only -+ * when SMP is enabled. -+ * - For coherency between the processor and I/O devices, but -+ * this coherency requires many pre-requisites (write -+ * allocate cache policy, shareable pages, SMP bit set) that -+ * are only meant in SMP situations. -+ * -+ * Note that this means that on Armada 370, there is currently -+ * no way to use hardware I/O coherency, because even when -+ * CONFIG_SMP is enabled, is_smp() returns false due to the -+ * Armada 370 being a single-core processor. To lift this -+ * limitation, we would have to find a way to make the cache -+ * policy set to write-allocate (on all Armada SoCs), and to -+ * set the shareable attribute in page tables (on all Armada -+ * SoCs except the Armada 370). Unfortunately, such decisions -+ * are taken very early in the kernel boot process, at a point -+ * where we don't know yet on which SoC we are running. -+ */ -+ if (!is_smp()) -+ return 0; -+ - np = of_find_matching_node(NULL, of_coherency_table); - if (np) { - struct resource res; -@@ -151,6 +174,9 @@ static int __init coherency_late_init(void) - { - struct device_node *np; - -+ if (!is_smp()) -+ return 0; -+ - np = of_find_matching_node(NULL, of_coherency_table); - if (np) { - bus_register_notifier(&platform_bus_type, -diff --git a/arch/arm/mach-omap2/pm44xx.c b/arch/arm/mach-omap2/pm44xx.c -index eefb30c..2b9cff9 100644 ---- a/arch/arm/mach-omap2/pm44xx.c -+++ b/arch/arm/mach-omap2/pm44xx.c -@@ -148,26 +148,6 @@ static inline int omap4_init_static_deps(void) - struct clockdomain *ducati_clkdm, *l3_2_clkdm; - int ret = 0; - -- if (omap_rev() == OMAP4430_REV_ES1_0) { -- WARN(1, "Power Management not supported on OMAP4430 ES1.0\n"); -- return -ENODEV; -- } -- -- pr_err("Power Management for TI OMAP4.\n"); -- /* -- * OMAP4 chip PM currently works only with certain (newer) -- * versions of bootloaders. This is due to missing code in the -- * kernel to properly reset and initialize some devices. -- * http://www.spinics.net/lists/arm-kernel/msg218641.html -- */ -- pr_warn("OMAP4 PM: u-boot >= v2012.07 is required for full PM support\n"); -- -- ret = pwrdm_for_each(pwrdms_setup, NULL); -- if (ret) { -- pr_err("Failed to setup powerdomains\n"); -- return ret; -- } -- - /* - * The dynamic dependency between MPUSS -> MEMIF and - * MPUSS -> L4_PER/L3_* and DUCATI -> L3_* doesn't work as -@@ -231,6 +211,15 @@ int __init omap4_pm_init(void) - - pr_info("Power Management for TI OMAP4+ devices.\n"); - -+ /* -+ * OMAP4 chip PM currently works only with certain (newer) -+ * versions of bootloaders. This is due to missing code in the -+ * kernel to properly reset and initialize some devices. -+ * http://www.spinics.net/lists/arm-kernel/msg218641.html -+ */ -+ if (cpu_is_omap44xx()) -+ pr_warn("OMAP4 PM: u-boot >= v2012.07 is required for full PM support\n"); -+ - ret = pwrdm_for_each(pwrdms_setup, NULL); - if (ret) { - pr_err("Failed to setup powerdomains.\n"); -diff --git a/arch/arm64/include/asm/suspend.h b/arch/arm64/include/asm/suspend.h -index e9c149c..456d67c 100644 ---- a/arch/arm64/include/asm/suspend.h -+++ b/arch/arm64/include/asm/suspend.h -@@ -21,6 +21,7 @@ struct sleep_save_sp { - phys_addr_t save_ptr_stash_phys; - }; - -+extern int __cpu_suspend(unsigned long arg, int (*fn)(unsigned long)); - extern void cpu_resume(void); - extern int cpu_suspend(unsigned long); - -diff --git a/arch/arm64/kernel/sleep.S b/arch/arm64/kernel/sleep.S -index b192572..ede186c 100644 ---- a/arch/arm64/kernel/sleep.S -+++ b/arch/arm64/kernel/sleep.S -@@ -49,28 +49,39 @@ - orr \dst, \dst, \mask // dst|=(aff3>>rs3) - .endm - /* -- * Save CPU state for a suspend. This saves callee registers, and allocates -- * space on the kernel stack to save the CPU specific registers + some -- * other data for resume. -+ * Save CPU state for a suspend and execute the suspend finisher. -+ * On success it will return 0 through cpu_resume - ie through a CPU -+ * soft/hard reboot from the reset vector. -+ * On failure it returns the suspend finisher return value or force -+ * -EOPNOTSUPP if the finisher erroneously returns 0 (the suspend finisher -+ * is not allowed to return, if it does this must be considered failure). -+ * It saves callee registers, and allocates space on the kernel stack -+ * to save the CPU specific registers + some other data for resume. - * - * x0 = suspend finisher argument -+ * x1 = suspend finisher function pointer - */ --ENTRY(__cpu_suspend) -+ENTRY(__cpu_suspend_enter) - stp x29, lr, [sp, #-96]! - stp x19, x20, [sp,#16] - stp x21, x22, [sp,#32] - stp x23, x24, [sp,#48] - stp x25, x26, [sp,#64] - stp x27, x28, [sp,#80] -+ /* -+ * Stash suspend finisher and its argument in x20 and x19 -+ */ -+ mov x19, x0 -+ mov x20, x1 - mov x2, sp - sub sp, sp, #CPU_SUSPEND_SZ // allocate cpu_suspend_ctx -- mov x1, sp -+ mov x0, sp - /* -- * x1 now points to struct cpu_suspend_ctx allocated on the stack -+ * x0 now points to struct cpu_suspend_ctx allocated on the stack - */ -- str x2, [x1, #CPU_CTX_SP] -- ldr x2, =sleep_save_sp -- ldr x2, [x2, #SLEEP_SAVE_SP_VIRT] -+ str x2, [x0, #CPU_CTX_SP] -+ ldr x1, =sleep_save_sp -+ ldr x1, [x1, #SLEEP_SAVE_SP_VIRT] - #ifdef CONFIG_SMP - mrs x7, mpidr_el1 - ldr x9, =mpidr_hash -@@ -82,11 +93,21 @@ ENTRY(__cpu_suspend) - ldp w3, w4, [x9, #MPIDR_HASH_SHIFTS] - ldp w5, w6, [x9, #(MPIDR_HASH_SHIFTS + 8)] - compute_mpidr_hash x8, x3, x4, x5, x6, x7, x10 -- add x2, x2, x8, lsl #3 -+ add x1, x1, x8, lsl #3 - #endif -- bl __cpu_suspend_finisher -+ bl __cpu_suspend_save -+ /* -+ * Grab suspend finisher in x20 and its argument in x19 -+ */ -+ mov x0, x19 -+ mov x1, x20 -+ /* -+ * We are ready for power down, fire off the suspend finisher -+ * in x1, with argument in x0 -+ */ -+ blr x1 - /* -- * Never gets here, unless suspend fails. -+ * Never gets here, unless suspend finisher fails. - * Successful cpu_suspend should return from cpu_resume, returning - * through this code path is considered an error - * If the return value is set to 0 force x0 = -EOPNOTSUPP -@@ -103,7 +124,7 @@ ENTRY(__cpu_suspend) - ldp x27, x28, [sp, #80] - ldp x29, lr, [sp], #96 - ret --ENDPROC(__cpu_suspend) -+ENDPROC(__cpu_suspend_enter) - .ltorg - - /* -@@ -126,14 +147,12 @@ cpu_resume_after_mmu: - ret - ENDPROC(cpu_resume_after_mmu) - -- .data - ENTRY(cpu_resume) - bl el2_setup // if in EL2 drop to EL1 cleanly - #ifdef CONFIG_SMP - mrs x1, mpidr_el1 -- adr x4, mpidr_hash_ptr -- ldr x5, [x4] -- add x8, x4, x5 // x8 = struct mpidr_hash phys address -+ adrp x8, mpidr_hash -+ add x8, x8, #:lo12:mpidr_hash // x8 = struct mpidr_hash phys address - /* retrieve mpidr_hash members to compute the hash */ - ldr x2, [x8, #MPIDR_HASH_MASK] - ldp w3, w4, [x8, #MPIDR_HASH_SHIFTS] -@@ -143,14 +162,15 @@ ENTRY(cpu_resume) - #else - mov x7, xzr - #endif -- adr x0, sleep_save_sp -+ adrp x0, sleep_save_sp -+ add x0, x0, #:lo12:sleep_save_sp - ldr x0, [x0, #SLEEP_SAVE_SP_PHYS] - ldr x0, [x0, x7, lsl #3] - /* load sp from context */ - ldr x2, [x0, #CPU_CTX_SP] -- adr x1, sleep_idmap_phys -+ adrp x1, sleep_idmap_phys - /* load physical address of identity map page table in x1 */ -- ldr x1, [x1] -+ ldr x1, [x1, #:lo12:sleep_idmap_phys] - mov sp, x2 - /* - * cpu_do_resume expects x0 to contain context physical address -@@ -159,26 +179,3 @@ ENTRY(cpu_resume) - bl cpu_do_resume // PC relative jump, MMU off - b cpu_resume_mmu // Resume MMU, never returns - ENDPROC(cpu_resume) -- -- .align 3 --mpidr_hash_ptr: -- /* -- * offset of mpidr_hash symbol from current location -- * used to obtain run-time mpidr_hash address with MMU off -- */ -- .quad mpidr_hash - . --/* -- * physical address of identity mapped page tables -- */ -- .type sleep_idmap_phys, #object --ENTRY(sleep_idmap_phys) -- .quad 0 --/* -- * struct sleep_save_sp { -- * phys_addr_t *save_ptr_stash; -- * phys_addr_t save_ptr_stash_phys; -- * }; -- */ -- .type sleep_save_sp, #object --ENTRY(sleep_save_sp) -- .space SLEEP_SAVE_SP_SZ // struct sleep_save_sp -diff --git a/arch/arm64/kernel/suspend.c b/arch/arm64/kernel/suspend.c -index 1fa9ce4..2d6b606 100644 ---- a/arch/arm64/kernel/suspend.c -+++ b/arch/arm64/kernel/suspend.c -@@ -5,26 +5,24 @@ - #include <asm/debug-monitors.h> - #include <asm/pgtable.h> - #include <asm/memory.h> -+#include <asm/mmu_context.h> - #include <asm/smp_plat.h> - #include <asm/suspend.h> - #include <asm/tlbflush.h> - --extern int __cpu_suspend(unsigned long); -+extern int __cpu_suspend_enter(unsigned long arg, int (*fn)(unsigned long)); - /* -- * This is called by __cpu_suspend() to save the state, and do whatever -+ * This is called by __cpu_suspend_enter() to save the state, and do whatever - * flushing is required to ensure that when the CPU goes to sleep we have - * the necessary data available when the caches are not searched. - * -- * @arg: Argument to pass to suspend operations -- * @ptr: CPU context virtual address -- * @save_ptr: address of the location where the context physical address -- * must be saved -+ * ptr: CPU context virtual address -+ * save_ptr: address of the location where the context physical address -+ * must be saved - */ --int __cpu_suspend_finisher(unsigned long arg, struct cpu_suspend_ctx *ptr, -- phys_addr_t *save_ptr) -+void notrace __cpu_suspend_save(struct cpu_suspend_ctx *ptr, -+ phys_addr_t *save_ptr) - { -- int cpu = smp_processor_id(); -- - *save_ptr = virt_to_phys(ptr); - - cpu_do_suspend(ptr); -@@ -35,8 +33,6 @@ int __cpu_suspend_finisher(unsigned long arg, struct cpu_suspend_ctx *ptr, - */ - __flush_dcache_area(ptr, sizeof(*ptr)); - __flush_dcache_area(save_ptr, sizeof(*save_ptr)); -- -- return cpu_ops[cpu]->cpu_suspend(arg); - } - - /* -@@ -56,15 +52,15 @@ void __init cpu_suspend_set_dbg_restorer(void (*hw_bp_restore)(void *)) - } - - /** -- * cpu_suspend -+ * cpu_suspend() - function to enter a low-power state -+ * @arg: argument to pass to CPU suspend operations - * -- * @arg: argument to pass to the finisher function -+ * Return: 0 on success, -EOPNOTSUPP if CPU suspend hook not initialized, CPU -+ * operations back-end error code otherwise. - */ - int cpu_suspend(unsigned long arg) - { -- struct mm_struct *mm = current->active_mm; -- int ret, cpu = smp_processor_id(); -- unsigned long flags; -+ int cpu = smp_processor_id(); - - /* - * If cpu_ops have not been registered or suspend -@@ -72,6 +68,21 @@ int cpu_suspend(unsigned long arg) - */ - if (!cpu_ops[cpu] || !cpu_ops[cpu]->cpu_suspend) - return -EOPNOTSUPP; -+ return cpu_ops[cpu]->cpu_suspend(arg); -+} -+ -+/* -+ * __cpu_suspend -+ * -+ * arg: argument to pass to the finisher function -+ * fn: finisher function pointer -+ * -+ */ -+int __cpu_suspend(unsigned long arg, int (*fn)(unsigned long)) -+{ -+ struct mm_struct *mm = current->active_mm; -+ int ret; -+ unsigned long flags; - - /* - * From this point debug exceptions are disabled to prevent -@@ -86,16 +97,27 @@ int cpu_suspend(unsigned long arg) - * page tables, so that the thread address space is properly - * set-up on function return. - */ -- ret = __cpu_suspend(arg); -+ ret = __cpu_suspend_enter(arg, fn); - if (ret == 0) { -- cpu_switch_mm(mm->pgd, mm); -+ /* -+ * We are resuming from reset with TTBR0_EL1 set to the -+ * idmap to enable the MMU; restore the active_mm mappings in -+ * TTBR0_EL1 unless the active_mm == &init_mm, in which case -+ * the thread entered __cpu_suspend with TTBR0_EL1 set to -+ * reserved TTBR0 page tables and should be restored as such. -+ */ -+ if (mm == &init_mm) -+ cpu_set_reserved_ttbr0(); -+ else -+ cpu_switch_mm(mm->pgd, mm); -+ - flush_tlb_all(); - - /* - * Restore per-cpu offset before any kernel - * subsystem relying on it has a chance to run. - */ -- set_my_cpu_offset(per_cpu_offset(cpu)); -+ set_my_cpu_offset(per_cpu_offset(smp_processor_id())); - - /* - * Restore HW breakpoint registers to sane values -@@ -116,10 +138,10 @@ int cpu_suspend(unsigned long arg) - return ret; - } - --extern struct sleep_save_sp sleep_save_sp; --extern phys_addr_t sleep_idmap_phys; -+struct sleep_save_sp sleep_save_sp; -+phys_addr_t sleep_idmap_phys; - --static int cpu_suspend_init(void) -+static int __init cpu_suspend_init(void) - { - void *ctx_ptr; - -diff --git a/arch/powerpc/kernel/mce_power.c b/arch/powerpc/kernel/mce_power.c -index 27c93f4..fc0927a 100644 ---- a/arch/powerpc/kernel/mce_power.c -+++ b/arch/powerpc/kernel/mce_power.c -@@ -78,7 +78,7 @@ static long mce_handle_derror(uint64_t dsisr, uint64_t slb_error_bits) - } - if (dsisr & P7_DSISR_MC_TLB_MULTIHIT_MFTLB) { - if (cur_cpu_spec && cur_cpu_spec->flush_tlb) -- cur_cpu_spec->flush_tlb(TLBIEL_INVAL_PAGE); -+ cur_cpu_spec->flush_tlb(TLBIEL_INVAL_SET); - /* reset error bits */ - dsisr &= ~P7_DSISR_MC_TLB_MULTIHIT_MFTLB; - } -@@ -109,7 +109,7 @@ static long mce_handle_common_ierror(uint64_t srr1) - break; - case P7_SRR1_MC_IFETCH_TLB_MULTIHIT: - if (cur_cpu_spec && cur_cpu_spec->flush_tlb) { -- cur_cpu_spec->flush_tlb(TLBIEL_INVAL_PAGE); -+ cur_cpu_spec->flush_tlb(TLBIEL_INVAL_SET); - handled = 1; - } - break; -diff --git a/arch/powerpc/kernel/udbg_16550.c b/arch/powerpc/kernel/udbg_16550.c -index 75702e2..f7089fc 100644 ---- a/arch/powerpc/kernel/udbg_16550.c -+++ b/arch/powerpc/kernel/udbg_16550.c -@@ -69,8 +69,12 @@ static void udbg_uart_putc(char c) - - static int udbg_uart_getc_poll(void) - { -- if (!udbg_uart_in || !(udbg_uart_in(UART_LSR) & LSR_DR)) -+ if (!udbg_uart_in) -+ return -1; -+ -+ if (!(udbg_uart_in(UART_LSR) & LSR_DR)) - return udbg_uart_in(UART_RBR); -+ - return -1; - } - -diff --git a/arch/x86/include/asm/vsyscall.h b/arch/x86/include/asm/vsyscall.h -index 2a46ca7..2874be9 100644 ---- a/arch/x86/include/asm/vsyscall.h -+++ b/arch/x86/include/asm/vsyscall.h -@@ -34,7 +34,7 @@ static inline unsigned int __getcpu(void) - native_read_tscp(&p); - } else { - /* Load per CPU data from GDT */ -- asm("lsl %1,%0" : "=r" (p) : "r" (__PER_CPU_SEG)); -+ asm volatile ("lsl %1,%0" : "=r" (p) : "r" (__PER_CPU_SEG)); - } - - return p; -diff --git a/arch/x86/kernel/cpu/perf_event_intel_uncore.c b/arch/x86/kernel/cpu/perf_event_intel_uncore.c -index 047f540..2f98588 100644 ---- a/arch/x86/kernel/cpu/perf_event_intel_uncore.c -+++ b/arch/x86/kernel/cpu/perf_event_intel_uncore.c -@@ -2886,6 +2886,17 @@ static struct intel_uncore_box *uncore_event_to_box(struct perf_event *event) - return uncore_pmu_to_box(uncore_event_to_pmu(event), smp_processor_id()); - } - -+/* -+ * Using uncore_pmu_event_init pmu event_init callback -+ * as a detection point for uncore events. -+ */ -+static int uncore_pmu_event_init(struct perf_event *event); -+ -+static bool is_uncore_event(struct perf_event *event) -+{ -+ return event->pmu->event_init == uncore_pmu_event_init; -+} -+ - static int - uncore_collect_events(struct intel_uncore_box *box, struct perf_event *leader, bool dogrp) - { -@@ -2900,13 +2911,18 @@ uncore_collect_events(struct intel_uncore_box *box, struct perf_event *leader, b - return -EINVAL; - - n = box->n_events; -- box->event_list[n] = leader; -- n++; -+ -+ if (is_uncore_event(leader)) { -+ box->event_list[n] = leader; -+ n++; -+ } -+ - if (!dogrp) - return n; - - list_for_each_entry(event, &leader->sibling_list, group_entry) { -- if (event->state <= PERF_EVENT_STATE_OFF) -+ if (!is_uncore_event(event) || -+ event->state <= PERF_EVENT_STATE_OFF) - continue; - - if (n >= max_count) -diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c -index 49088b8..dcae8fa 100644 ---- a/arch/x86/kvm/mmu.c -+++ b/arch/x86/kvm/mmu.c -@@ -4384,7 +4384,7 @@ void kvm_mmu_invalidate_mmio_sptes(struct kvm *kvm) - * zap all shadow pages. - */ - if (unlikely(kvm_current_mmio_generation(kvm) == 0)) { -- printk_ratelimited(KERN_INFO "kvm: zapping shadow pages for mmio generation wraparound\n"); -+ printk_ratelimited(KERN_DEBUG "kvm: zapping shadow pages for mmio generation wraparound\n"); - kvm_mmu_invalidate_zap_all_pages(kvm); - } - } -diff --git a/arch/x86/vdso/vma.c b/arch/x86/vdso/vma.c -index 431e875..ab6ba35 100644 ---- a/arch/x86/vdso/vma.c -+++ b/arch/x86/vdso/vma.c -@@ -117,30 +117,45 @@ subsys_initcall(init_vdso); - - struct linux_binprm; - --/* Put the vdso above the (randomized) stack with another randomized offset. -- This way there is no hole in the middle of address space. -- To save memory make sure it is still in the same PTE as the stack top. -- This doesn't give that many random bits */ -+/* -+ * Put the vdso above the (randomized) stack with another randomized -+ * offset. This way there is no hole in the middle of address space. -+ * To save memory make sure it is still in the same PTE as the stack -+ * top. This doesn't give that many random bits. -+ * -+ * Note that this algorithm is imperfect: the distribution of the vdso -+ * start address within a PMD is biased toward the end. -+ * -+ * Only used for the 64-bit and x32 vdsos. -+ */ - static unsigned long vdso_addr(unsigned long start, unsigned len) - { - unsigned long addr, end; - unsigned offset; -- end = (start + PMD_SIZE - 1) & PMD_MASK; -+ -+ /* -+ * Round up the start address. It can start out unaligned as a result -+ * of stack start randomization. -+ */ -+ start = PAGE_ALIGN(start); -+ -+ /* Round the lowest possible end address up to a PMD boundary. */ -+ end = (start + len + PMD_SIZE - 1) & PMD_MASK; - if (end >= TASK_SIZE_MAX) - end = TASK_SIZE_MAX; - end -= len; -- /* This loses some more bits than a modulo, but is cheaper */ -- offset = get_random_int() & (PTRS_PER_PTE - 1); -- addr = start + (offset << PAGE_SHIFT); -- if (addr >= end) -- addr = end; -+ -+ if (end > start) { -+ offset = get_random_int() % (((end - start) >> PAGE_SHIFT) + 1); -+ addr = start + (offset << PAGE_SHIFT); -+ } else { -+ addr = start; -+ } - - /* -- * page-align it here so that get_unmapped_area doesn't -- * align it wrongfully again to the next page. addr can come in 4K -- * unaligned here as a result of stack start randomization. -+ * Forcibly align the final address in case we have a hardware -+ * issue that requires alignment for performance reasons. - */ -- addr = PAGE_ALIGN(addr); - addr = align_vdso_addr(addr); - - return addr; -diff --git a/block/blk-mq-cpumap.c b/block/blk-mq-cpumap.c -index f872127..78d3835 100644 ---- a/block/blk-mq-cpumap.c -+++ b/block/blk-mq-cpumap.c -@@ -95,7 +95,7 @@ unsigned int *blk_mq_make_queue_map(struct blk_mq_reg *reg) - unsigned int *map; - - /* If cpus are offline, map them to first hctx */ -- map = kzalloc_node(sizeof(*map) * num_possible_cpus(), GFP_KERNEL, -+ map = kzalloc_node(sizeof(*map) * nr_cpu_ids, GFP_KERNEL, - reg->numa_node); - if (!map) - return NULL; -diff --git a/block/genhd.c b/block/genhd.c -index e6723bd..a8d586a 100644 ---- a/block/genhd.c -+++ b/block/genhd.c -@@ -1070,9 +1070,16 @@ int disk_expand_part_tbl(struct gendisk *disk, int partno) - struct disk_part_tbl *old_ptbl = disk->part_tbl; - struct disk_part_tbl *new_ptbl; - int len = old_ptbl ? old_ptbl->len : 0; -- int target = partno + 1; -+ int i, target; - size_t size; -- int i; -+ -+ /* -+ * check for int overflow, since we can get here from blkpg_ioctl() -+ * with a user passed 'partno'. -+ */ -+ target = partno + 1; -+ if (target < 0) -+ return -EINVAL; - - /* disk_max_parts() is zero during initialization, ignore if so */ - if (disk_max_parts(disk) && target > disk_max_parts(disk)) -diff --git a/drivers/acpi/device_pm.c b/drivers/acpi/device_pm.c -index c14a00d..19f6505 100644 ---- a/drivers/acpi/device_pm.c -+++ b/drivers/acpi/device_pm.c -@@ -257,7 +257,7 @@ int acpi_bus_init_power(struct acpi_device *device) - - device->power.state = ACPI_STATE_UNKNOWN; - if (!acpi_device_is_present(device)) -- return 0; -+ return -ENXIO; - - result = acpi_device_get_power(device, &state); - if (result) -diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c -index 493a342..666beea 100644 ---- a/drivers/acpi/scan.c -+++ b/drivers/acpi/scan.c -@@ -865,7 +865,7 @@ static void acpi_free_power_resources_lists(struct acpi_device *device) - if (device->wakeup.flags.valid) - acpi_power_resources_list_free(&device->wakeup.resources); - -- if (!device->flags.power_manageable) -+ if (!device->power.flags.power_resources) - return; - - for (i = ACPI_STATE_D0; i <= ACPI_STATE_D3_HOT; i++) { -@@ -1554,10 +1554,8 @@ static void acpi_bus_get_power_flags(struct acpi_device *device) - device->power.flags.power_resources) - device->power.states[ACPI_STATE_D3_COLD].flags.os_accessible = 1; - -- if (acpi_bus_init_power(device)) { -- acpi_free_power_resources_lists(device); -+ if (acpi_bus_init_power(device)) - device->flags.power_manageable = 0; -- } - } - - static void acpi_bus_get_flags(struct acpi_device *device) -@@ -2043,13 +2041,18 @@ static void acpi_bus_attach(struct acpi_device *device) - /* Skip devices that are not present. */ - if (!acpi_device_is_present(device)) { - device->flags.visited = false; -+ device->flags.power_manageable = 0; - return; - } - if (device->handler) - goto ok; - - if (!device->flags.initialized) { -- acpi_bus_update_power(device, NULL); -+ device->flags.power_manageable = -+ device->power.states[ACPI_STATE_D0].flags.valid; -+ if (acpi_bus_init_power(device)) -+ device->flags.power_manageable = 0; -+ - device->flags.initialized = true; - } - device->flags.visited = false; -diff --git a/drivers/base/bus.c b/drivers/base/bus.c -index 59dc808..45d0fa7 100644 ---- a/drivers/base/bus.c -+++ b/drivers/base/bus.c -@@ -254,13 +254,15 @@ static ssize_t store_drivers_probe(struct bus_type *bus, - const char *buf, size_t count) - { - struct device *dev; -+ int err = -EINVAL; - - dev = bus_find_device_by_name(bus, NULL, buf); - if (!dev) - return -ENODEV; -- if (bus_rescan_devices_helper(dev, NULL) != 0) -- return -EINVAL; -- return count; -+ if (bus_rescan_devices_helper(dev, NULL) == 0) -+ err = count; -+ put_device(dev); -+ return err; - } - - static struct device *next_device(struct klist_iter *i) -diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c -index 7cd42ea..d92c7d9 100644 ---- a/drivers/hid/hid-core.c -+++ b/drivers/hid/hid-core.c -@@ -1743,6 +1743,7 @@ static const struct hid_device_id hid_have_special_driver[] = { - { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_ERGO_525V) }, - { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_EASYPEN_I405X) }, - { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_MOUSEPEN_I608X) }, -+ { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_MOUSEPEN_I608X_2) }, - { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_EASYPEN_M610X) }, - { HID_USB_DEVICE(USB_VENDOR_ID_LABTEC, USB_DEVICE_ID_LABTEC_WIRELESS_KEYBOARD) }, - { HID_USB_DEVICE(USB_VENDOR_ID_LCPOWER, USB_DEVICE_ID_LCPOWER_LC1000 ) }, -diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h -index 91bc66b..4850da3 100644 ---- a/drivers/hid/hid-ids.h -+++ b/drivers/hid/hid-ids.h -@@ -511,6 +511,7 @@ - #define USB_DEVICE_ID_KYE_GPEN_560 0x5003 - #define USB_DEVICE_ID_KYE_EASYPEN_I405X 0x5010 - #define USB_DEVICE_ID_KYE_MOUSEPEN_I608X 0x5011 -+#define USB_DEVICE_ID_KYE_MOUSEPEN_I608X_2 0x501a - #define USB_DEVICE_ID_KYE_EASYPEN_M610X 0x5013 - - #define USB_VENDOR_ID_LABTEC 0x1020 -diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c -index a713e62..4b87bb1 100644 ---- a/drivers/hid/hid-input.c -+++ b/drivers/hid/hid-input.c -@@ -312,6 +312,9 @@ static const struct hid_device_id hid_battery_quirks[] = { - USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ANSI), - HID_BATTERY_QUIRK_PERCENT | HID_BATTERY_QUIRK_FEATURE }, - { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, -+ USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ISO), -+ HID_BATTERY_QUIRK_PERCENT | HID_BATTERY_QUIRK_FEATURE }, -+ { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, - USB_DEVICE_ID_APPLE_ALU_WIRELESS_ANSI), - HID_BATTERY_QUIRK_PERCENT | HID_BATTERY_QUIRK_FEATURE }, - {} -diff --git a/drivers/hid/hid-kye.c b/drivers/hid/hid-kye.c -index b92bf01..158fcf5 100644 ---- a/drivers/hid/hid-kye.c -+++ b/drivers/hid/hid-kye.c -@@ -323,6 +323,7 @@ static __u8 *kye_report_fixup(struct hid_device *hdev, __u8 *rdesc, - } - break; - case USB_DEVICE_ID_KYE_MOUSEPEN_I608X: -+ case USB_DEVICE_ID_KYE_MOUSEPEN_I608X_2: - if (*rsize == MOUSEPEN_I608X_RDESC_ORIG_SIZE) { - rdesc = mousepen_i608x_rdesc_fixed; - *rsize = sizeof(mousepen_i608x_rdesc_fixed); -@@ -415,6 +416,7 @@ static int kye_probe(struct hid_device *hdev, const struct hid_device_id *id) - switch (id->product) { - case USB_DEVICE_ID_KYE_EASYPEN_I405X: - case USB_DEVICE_ID_KYE_MOUSEPEN_I608X: -+ case USB_DEVICE_ID_KYE_MOUSEPEN_I608X_2: - case USB_DEVICE_ID_KYE_EASYPEN_M610X: - ret = kye_tablet_enable(hdev); - if (ret) { -@@ -446,6 +448,8 @@ static const struct hid_device_id kye_devices[] = { - { HID_USB_DEVICE(USB_VENDOR_ID_KYE, - USB_DEVICE_ID_KYE_MOUSEPEN_I608X) }, - { HID_USB_DEVICE(USB_VENDOR_ID_KYE, -+ USB_DEVICE_ID_KYE_MOUSEPEN_I608X_2) }, -+ { HID_USB_DEVICE(USB_VENDOR_ID_KYE, - USB_DEVICE_ID_KYE_EASYPEN_M610X) }, - { HID_USB_DEVICE(USB_VENDOR_ID_KYE, - USB_DEVICE_ID_GENIUS_GILA_GAMING_MOUSE) }, -diff --git a/drivers/hid/hid-roccat-pyra.c b/drivers/hid/hid-roccat-pyra.c -index 1a07e07..47d7e74 100644 ---- a/drivers/hid/hid-roccat-pyra.c -+++ b/drivers/hid/hid-roccat-pyra.c -@@ -35,6 +35,8 @@ static struct class *pyra_class; - static void profile_activated(struct pyra_device *pyra, - unsigned int new_profile) - { -+ if (new_profile >= ARRAY_SIZE(pyra->profile_settings)) -+ return; - pyra->actual_profile = new_profile; - pyra->actual_cpi = pyra->profile_settings[pyra->actual_profile].y_cpi; - } -@@ -257,9 +259,11 @@ static ssize_t pyra_sysfs_write_settings(struct file *fp, - if (off != 0 || count != PYRA_SIZE_SETTINGS) - return -EINVAL; - -- mutex_lock(&pyra->pyra_lock); -- - settings = (struct pyra_settings const *)buf; -+ if (settings->startup_profile >= ARRAY_SIZE(pyra->profile_settings)) -+ return -EINVAL; -+ -+ mutex_lock(&pyra->pyra_lock); - - retval = pyra_set_settings(usb_dev, settings); - if (retval) { -diff --git a/drivers/hid/i2c-hid/i2c-hid.c b/drivers/hid/i2c-hid/i2c-hid.c -index 42eebd1..6e5d8fe 100644 ---- a/drivers/hid/i2c-hid/i2c-hid.c -+++ b/drivers/hid/i2c-hid/i2c-hid.c -@@ -136,6 +136,7 @@ struct i2c_hid { - * descriptor. */ - unsigned int bufsize; /* i2c buffer size */ - char *inbuf; /* Input buffer */ -+ char *rawbuf; /* Raw Input buffer */ - char *cmdbuf; /* Command buffer */ - char *argsbuf; /* Command arguments buffer */ - -@@ -355,7 +356,7 @@ static int i2c_hid_hwreset(struct i2c_client *client) - static void i2c_hid_get_input(struct i2c_hid *ihid) - { - int ret, ret_size; -- int size = le16_to_cpu(ihid->hdesc.wMaxInputLength); -+ int size = ihid->bufsize; - - ret = i2c_master_recv(ihid->client, ihid->inbuf, size); - if (ret != size) { -@@ -482,9 +483,11 @@ static void i2c_hid_find_max_report(struct hid_device *hid, unsigned int type, - static void i2c_hid_free_buffers(struct i2c_hid *ihid) - { - kfree(ihid->inbuf); -+ kfree(ihid->rawbuf); - kfree(ihid->argsbuf); - kfree(ihid->cmdbuf); - ihid->inbuf = NULL; -+ ihid->rawbuf = NULL; - ihid->cmdbuf = NULL; - ihid->argsbuf = NULL; - ihid->bufsize = 0; -@@ -500,10 +503,11 @@ static int i2c_hid_alloc_buffers(struct i2c_hid *ihid, size_t report_size) - report_size; /* report */ - - ihid->inbuf = kzalloc(report_size, GFP_KERNEL); -+ ihid->rawbuf = kzalloc(report_size, GFP_KERNEL); - ihid->argsbuf = kzalloc(args_len, GFP_KERNEL); - ihid->cmdbuf = kzalloc(sizeof(union command) + args_len, GFP_KERNEL); - -- if (!ihid->inbuf || !ihid->argsbuf || !ihid->cmdbuf) { -+ if (!ihid->inbuf || !ihid->rawbuf || !ihid->argsbuf || !ihid->cmdbuf) { - i2c_hid_free_buffers(ihid); - return -ENOMEM; - } -@@ -530,12 +534,12 @@ static int i2c_hid_get_raw_report(struct hid_device *hid, - - ret = i2c_hid_get_report(client, - report_type == HID_FEATURE_REPORT ? 0x03 : 0x01, -- report_number, ihid->inbuf, ask_count); -+ report_number, ihid->rawbuf, ask_count); - - if (ret < 0) - return ret; - -- ret_count = ihid->inbuf[0] | (ihid->inbuf[1] << 8); -+ ret_count = ihid->rawbuf[0] | (ihid->rawbuf[1] << 8); - - if (ret_count <= 2) - return 0; -@@ -544,7 +548,7 @@ static int i2c_hid_get_raw_report(struct hid_device *hid, - - /* The query buffer contains the size, dropping it in the reply */ - count = min(count, ret_count - 2); -- memcpy(buf, ihid->inbuf + 2, count); -+ memcpy(buf, ihid->rawbuf + 2, count); - - return count; - } -diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c -index deb3643..473c0c4 100644 ---- a/drivers/hid/usbhid/hid-quirks.c -+++ b/drivers/hid/usbhid/hid-quirks.c -@@ -116,6 +116,7 @@ static const struct hid_blacklist { - { USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_WIRELESS, HID_QUIRK_MULTI_INPUT }, - { USB_VENDOR_ID_SIGMA_MICRO, USB_DEVICE_ID_SIGMA_MICRO_KEYBOARD, HID_QUIRK_NO_INIT_REPORTS }, - { USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_MOUSEPEN_I608X, HID_QUIRK_MULTI_INPUT }, -+ { USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_MOUSEPEN_I608X_2, HID_QUIRK_MULTI_INPUT }, - { USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_EASYPEN_M610X, HID_QUIRK_MULTI_INPUT }, - { USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_DUOSENSE, HID_QUIRK_NO_INIT_REPORTS }, - { USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_LTS1, HID_QUIRK_NO_INIT_REPORTS }, -diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c -index fa92046..505fe29 100644 ---- a/drivers/hv/channel_mgmt.c -+++ b/drivers/hv/channel_mgmt.c -@@ -202,9 +202,16 @@ static void vmbus_process_rescind_offer(struct work_struct *work) - unsigned long flags; - struct vmbus_channel *primary_channel; - struct vmbus_channel_relid_released msg; -+ struct device *dev; -+ -+ if (channel->device_obj) { -+ dev = get_device(&channel->device_obj->device); -+ if (dev) { -+ vmbus_device_unregister(channel->device_obj); -+ put_device(dev); -+ } -+ } - -- if (channel->device_obj) -- vmbus_device_unregister(channel->device_obj); - memset(&msg, 0, sizeof(struct vmbus_channel_relid_released)); - msg.child_relid = channel->offermsg.child_relid; - msg.header.msgtype = CHANNELMSG_RELID_RELEASED; -diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c -index 40f6b47..8855ecb 100644 ---- a/drivers/iommu/intel-iommu.c -+++ b/drivers/iommu/intel-iommu.c -@@ -1768,7 +1768,7 @@ static int __domain_mapping(struct dmar_domain *domain, unsigned long iov_pfn, - struct dma_pte *first_pte = NULL, *pte = NULL; - phys_addr_t uninitialized_var(pteval); - int addr_width = agaw_to_width(domain->agaw) - VTD_PAGE_SHIFT; -- unsigned long sg_res; -+ unsigned long sg_res = 0; - unsigned int largepage_lvl = 0; - unsigned long lvl_pages = 0; - -@@ -1779,10 +1779,8 @@ static int __domain_mapping(struct dmar_domain *domain, unsigned long iov_pfn, - - prot &= DMA_PTE_READ | DMA_PTE_WRITE | DMA_PTE_SNP; - -- if (sg) -- sg_res = 0; -- else { -- sg_res = nr_pages + 1; -+ if (!sg) { -+ sg_res = nr_pages; - pteval = ((phys_addr_t)phys_pfn << VTD_PAGE_SHIFT) | prot; - } - -diff --git a/drivers/misc/genwqe/card_utils.c b/drivers/misc/genwqe/card_utils.c -index 6b1a6ef..0c3a647 100644 ---- a/drivers/misc/genwqe/card_utils.c -+++ b/drivers/misc/genwqe/card_utils.c -@@ -490,6 +490,8 @@ int genwqe_user_vmap(struct genwqe_dev *cd, struct dma_mapping *m, void *uaddr, - m->nr_pages, - 1, /* write by caller */ - m->page_list); /* ptrs to pages */ -+ if (rc < 0) -+ goto fail_get_user_pages; - - /* assumption: get_user_pages can be killed by signals. */ - if (rc < m->nr_pages) { -diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c -index 9ddef47..7e01763 100644 ---- a/drivers/mmc/host/sdhci.c -+++ b/drivers/mmc/host/sdhci.c -@@ -1343,6 +1343,8 @@ static void sdhci_request(struct mmc_host *mmc, struct mmc_request *mrq) - - sdhci_runtime_pm_get(host); - -+ present = mmc_gpio_get_cd(host->mmc); -+ - spin_lock_irqsave(&host->lock, flags); - - WARN_ON(host->mrq != NULL); -@@ -1371,7 +1373,6 @@ static void sdhci_request(struct mmc_host *mmc, struct mmc_request *mrq) - * zero: cd-gpio is used, and card is removed - * one: cd-gpio is used, and card is present - */ -- present = mmc_gpio_get_cd(host->mmc); - if (present < 0) { - /* If polling, assume that the card is always present. */ - if (host->quirks & SDHCI_QUIRK_BROKEN_CARD_DETECTION) -@@ -2082,15 +2083,18 @@ static void sdhci_card_event(struct mmc_host *mmc) - { - struct sdhci_host *host = mmc_priv(mmc); - unsigned long flags; -+ int present; - - /* First check if client has provided their own card event */ - if (host->ops->card_event) - host->ops->card_event(host); - -+ present = sdhci_do_get_cd(host); -+ - spin_lock_irqsave(&host->lock, flags); - - /* Check host->mrq first in case we are runtime suspended */ -- if (host->mrq && !sdhci_do_get_cd(host)) { -+ if (host->mrq && !present) { - pr_err("%s: Card removed during transfer!\n", - mmc_hostname(host->mmc)); - pr_err("%s: Resetting controller.\n", -diff --git a/drivers/mtd/tests/torturetest.c b/drivers/mtd/tests/torturetest.c -index eeab969..b55bc52 100644 ---- a/drivers/mtd/tests/torturetest.c -+++ b/drivers/mtd/tests/torturetest.c -@@ -264,7 +264,9 @@ static int __init tort_init(void) - int i; - void *patt; - -- mtdtest_erase_good_eraseblocks(mtd, bad_ebs, eb, ebcnt); -+ err = mtdtest_erase_good_eraseblocks(mtd, bad_ebs, eb, ebcnt); -+ if (err) -+ goto out; - - /* Check if the eraseblocks contain only 0xFF bytes */ - if (check) { -diff --git a/drivers/mtd/ubi/upd.c b/drivers/mtd/ubi/upd.c -index ec2c2dc..2a1b6e0 100644 ---- a/drivers/mtd/ubi/upd.c -+++ b/drivers/mtd/ubi/upd.c -@@ -133,6 +133,10 @@ int ubi_start_update(struct ubi_device *ubi, struct ubi_volume *vol, - ubi_assert(!vol->updating && !vol->changing_leb); - vol->updating = 1; - -+ vol->upd_buf = vmalloc(ubi->leb_size); -+ if (!vol->upd_buf) -+ return -ENOMEM; -+ - err = set_update_marker(ubi, vol); - if (err) - return err; -@@ -152,14 +156,12 @@ int ubi_start_update(struct ubi_device *ubi, struct ubi_volume *vol, - err = clear_update_marker(ubi, vol, 0); - if (err) - return err; -+ -+ vfree(vol->upd_buf); - vol->updating = 0; - return 0; - } - -- vol->upd_buf = vmalloc(ubi->leb_size); -- if (!vol->upd_buf) -- return -ENOMEM; -- - vol->upd_ebs = div_u64(bytes + vol->usable_leb_size - 1, - vol->usable_leb_size); - vol->upd_bytes = bytes; -diff --git a/drivers/mtd/ubi/wl.c b/drivers/mtd/ubi/wl.c -index 02317c1..68b924e 100644 ---- a/drivers/mtd/ubi/wl.c -+++ b/drivers/mtd/ubi/wl.c -@@ -1205,7 +1205,6 @@ static int wear_leveling_worker(struct ubi_device *ubi, struct ubi_work *wrk, - - err = do_sync_erase(ubi, e1, vol_id, lnum, 0); - if (err) { -- kmem_cache_free(ubi_wl_entry_slab, e1); - if (e2) - kmem_cache_free(ubi_wl_entry_slab, e2); - goto out_ro; -@@ -1219,10 +1218,8 @@ static int wear_leveling_worker(struct ubi_device *ubi, struct ubi_work *wrk, - dbg_wl("PEB %d (LEB %d:%d) was put meanwhile, erase", - e2->pnum, vol_id, lnum); - err = do_sync_erase(ubi, e2, vol_id, lnum, 0); -- if (err) { -- kmem_cache_free(ubi_wl_entry_slab, e2); -+ if (err) - goto out_ro; -- } - } - - dbg_wl("done"); -@@ -1258,10 +1255,9 @@ out_not_moved: - - ubi_free_vid_hdr(ubi, vid_hdr); - err = do_sync_erase(ubi, e2, vol_id, lnum, torture); -- if (err) { -- kmem_cache_free(ubi_wl_entry_slab, e2); -+ if (err) - goto out_ro; -- } -+ - mutex_unlock(&ubi->move_mutex); - return 0; - -diff --git a/drivers/net/can/usb/peak_usb/pcan_usb_core.c b/drivers/net/can/usb/peak_usb/pcan_usb_core.c -index 0b7a4c3..03e7f0c 100644 ---- a/drivers/net/can/usb/peak_usb/pcan_usb_core.c -+++ b/drivers/net/can/usb/peak_usb/pcan_usb_core.c -@@ -734,7 +734,7 @@ static int peak_usb_create_dev(struct peak_usb_adapter *peak_usb_adapter, - dev->cmd_buf = kmalloc(PCAN_USB_MAX_CMD_LEN, GFP_KERNEL); - if (!dev->cmd_buf) { - err = -ENOMEM; -- goto lbl_set_intf_data; -+ goto lbl_free_candev; - } - - dev->udev = usb_dev; -@@ -773,7 +773,7 @@ static int peak_usb_create_dev(struct peak_usb_adapter *peak_usb_adapter, - err = register_candev(netdev); - if (err) { - dev_err(&intf->dev, "couldn't register CAN device: %d\n", err); -- goto lbl_free_cmd_buf; -+ goto lbl_restore_intf_data; - } - - if (dev->prev_siblings) -@@ -786,14 +786,14 @@ static int peak_usb_create_dev(struct peak_usb_adapter *peak_usb_adapter, - if (dev->adapter->dev_init) { - err = dev->adapter->dev_init(dev); - if (err) -- goto lbl_free_cmd_buf; -+ goto lbl_unregister_candev; - } - - /* set bus off */ - if (dev->adapter->dev_set_bus) { - err = dev->adapter->dev_set_bus(dev, 0); - if (err) -- goto lbl_free_cmd_buf; -+ goto lbl_unregister_candev; - } - - /* get device number early */ -@@ -805,11 +805,14 @@ static int peak_usb_create_dev(struct peak_usb_adapter *peak_usb_adapter, - - return 0; - --lbl_free_cmd_buf: -- kfree(dev->cmd_buf); -+lbl_unregister_candev: -+ unregister_candev(netdev); - --lbl_set_intf_data: -+lbl_restore_intf_data: - usb_set_intfdata(intf, dev->prev_siblings); -+ kfree(dev->cmd_buf); -+ -+lbl_free_candev: - free_candev(netdev); - - return err; -diff --git a/drivers/net/can/usb/peak_usb/pcan_usb_pro.c b/drivers/net/can/usb/peak_usb/pcan_usb_pro.c -index 263dd92..f7f796a 100644 ---- a/drivers/net/can/usb/peak_usb/pcan_usb_pro.c -+++ b/drivers/net/can/usb/peak_usb/pcan_usb_pro.c -@@ -333,8 +333,6 @@ static int pcan_usb_pro_send_req(struct peak_usb_device *dev, int req_id, - if (!(dev->state & PCAN_USB_STATE_CONNECTED)) - return 0; - -- memset(req_addr, '\0', req_size); -- - req_type = USB_TYPE_VENDOR | USB_RECIP_OTHER; - - switch (req_id) { -@@ -345,6 +343,7 @@ static int pcan_usb_pro_send_req(struct peak_usb_device *dev, int req_id, - default: - p = usb_rcvctrlpipe(dev->udev, 0); - req_type |= USB_DIR_IN; -+ memset(req_addr, '\0', req_size); - break; - } - -diff --git a/drivers/net/wireless/ath/ath5k/qcu.c b/drivers/net/wireless/ath/ath5k/qcu.c -index 0583c69..ddaad71 100644 ---- a/drivers/net/wireless/ath/ath5k/qcu.c -+++ b/drivers/net/wireless/ath/ath5k/qcu.c -@@ -225,13 +225,7 @@ ath5k_hw_setup_tx_queue(struct ath5k_hw *ah, enum ath5k_tx_queue queue_type, - } else { - switch (queue_type) { - case AR5K_TX_QUEUE_DATA: -- for (queue = AR5K_TX_QUEUE_ID_DATA_MIN; -- ah->ah_txq[queue].tqi_type != -- AR5K_TX_QUEUE_INACTIVE; queue++) { -- -- if (queue > AR5K_TX_QUEUE_ID_DATA_MAX) -- return -EINVAL; -- } -+ queue = queue_info->tqi_subtype; - break; - case AR5K_TX_QUEUE_UAPSD: - queue = AR5K_TX_QUEUE_ID_UAPSD; -diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h -index 0acd4b5..32ae0a4 100644 ---- a/drivers/net/wireless/ath/ath9k/hw.h -+++ b/drivers/net/wireless/ath/ath9k/hw.h -@@ -216,8 +216,8 @@ - #define AH_WOW_BEACON_MISS BIT(3) - - enum ath_hw_txq_subtype { -- ATH_TXQ_AC_BE = 0, -- ATH_TXQ_AC_BK = 1, -+ ATH_TXQ_AC_BK = 0, -+ ATH_TXQ_AC_BE = 1, - ATH_TXQ_AC_VI = 2, - ATH_TXQ_AC_VO = 3, - }; -diff --git a/drivers/net/wireless/ath/ath9k/mac.c b/drivers/net/wireless/ath/ath9k/mac.c -index 5f72758..8f93ed3 100644 ---- a/drivers/net/wireless/ath/ath9k/mac.c -+++ b/drivers/net/wireless/ath/ath9k/mac.c -@@ -311,14 +311,7 @@ int ath9k_hw_setuptxqueue(struct ath_hw *ah, enum ath9k_tx_queue type, - q = ATH9K_NUM_TX_QUEUES - 3; - break; - case ATH9K_TX_QUEUE_DATA: -- for (q = 0; q < ATH9K_NUM_TX_QUEUES; q++) -- if (ah->txq[q].tqi_type == -- ATH9K_TX_QUEUE_INACTIVE) -- break; -- if (q == ATH9K_NUM_TX_QUEUES) { -- ath_err(common, "No available TX queue\n"); -- return -1; -- } -+ q = qinfo->tqi_subtype; - break; - default: - ath_err(common, "Invalid TX queue type: %u\n", type); -diff --git a/drivers/net/wireless/iwlwifi/mvm/fw-api.h b/drivers/net/wireless/iwlwifi/mvm/fw-api.h -index d8948aa..60dc387 100644 ---- a/drivers/net/wireless/iwlwifi/mvm/fw-api.h -+++ b/drivers/net/wireless/iwlwifi/mvm/fw-api.h -@@ -1394,7 +1394,7 @@ enum iwl_sf_scenario { - #define SF_NUM_TIMEOUT_TYPES 2 /* Aging timer and Idle timer */ - - /* smart FIFO default values */ --#define SF_W_MARK_SISO 4096 -+#define SF_W_MARK_SISO 6144 - #define SF_W_MARK_MIMO2 8192 - #define SF_W_MARK_MIMO3 6144 - #define SF_W_MARK_LEGACY 4096 -diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c -index 34dff3a..5b428db 100644 ---- a/drivers/pci/probe.c -+++ b/drivers/pci/probe.c -@@ -214,14 +214,17 @@ int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type, - res->flags |= IORESOURCE_SIZEALIGN; - if (res->flags & IORESOURCE_IO) { - l &= PCI_BASE_ADDRESS_IO_MASK; -+ sz &= PCI_BASE_ADDRESS_IO_MASK; - mask = PCI_BASE_ADDRESS_IO_MASK & (u32) IO_SPACE_LIMIT; - } else { - l &= PCI_BASE_ADDRESS_MEM_MASK; -+ sz &= PCI_BASE_ADDRESS_MEM_MASK; - mask = (u32)PCI_BASE_ADDRESS_MEM_MASK; - } - } else { - res->flags |= (l & IORESOURCE_ROM_ENABLE); - l &= PCI_ROM_ADDRESS_MASK; -+ sz &= PCI_ROM_ADDRESS_MASK; - mask = (u32)PCI_ROM_ADDRESS_MASK; - } - -diff --git a/drivers/rtc/rtc-isl12057.c b/drivers/rtc/rtc-isl12057.c -index 7854a65..110eab8 100644 ---- a/drivers/rtc/rtc-isl12057.c -+++ b/drivers/rtc/rtc-isl12057.c -@@ -89,7 +89,7 @@ static void isl12057_rtc_regs_to_tm(struct rtc_time *tm, u8 *regs) - tm->tm_min = bcd2bin(regs[ISL12057_REG_RTC_MN]); - - if (regs[ISL12057_REG_RTC_HR] & ISL12057_REG_RTC_HR_MIL) { /* AM/PM */ -- tm->tm_hour = bcd2bin(regs[ISL12057_REG_RTC_HR] & 0x0f); -+ tm->tm_hour = bcd2bin(regs[ISL12057_REG_RTC_HR] & 0x1f); - if (regs[ISL12057_REG_RTC_HR] & ISL12057_REG_RTC_HR_PM) - tm->tm_hour += 12; - } else { /* 24 hour mode */ -@@ -98,7 +98,7 @@ static void isl12057_rtc_regs_to_tm(struct rtc_time *tm, u8 *regs) - - tm->tm_mday = bcd2bin(regs[ISL12057_REG_RTC_DT]); - tm->tm_wday = bcd2bin(regs[ISL12057_REG_RTC_DW]) - 1; /* starts at 1 */ -- tm->tm_mon = bcd2bin(regs[ISL12057_REG_RTC_MO]) - 1; /* starts at 1 */ -+ tm->tm_mon = bcd2bin(regs[ISL12057_REG_RTC_MO] & 0x1f) - 1; /* ditto */ - tm->tm_year = bcd2bin(regs[ISL12057_REG_RTC_YR]) + 100; - } - -diff --git a/drivers/rtc/rtc-sirfsoc.c b/drivers/rtc/rtc-sirfsoc.c -index 3eb3642..d2b1ab3 100644 ---- a/drivers/rtc/rtc-sirfsoc.c -+++ b/drivers/rtc/rtc-sirfsoc.c -@@ -290,14 +290,6 @@ static int sirfsoc_rtc_probe(struct platform_device *pdev) - rtc_div = ((32768 / RTC_HZ) / 2) - 1; - sirfsoc_rtc_iobrg_writel(rtc_div, rtcdrv->rtc_base + RTC_DIV); - -- rtcdrv->rtc = devm_rtc_device_register(&pdev->dev, pdev->name, -- &sirfsoc_rtc_ops, THIS_MODULE); -- if (IS_ERR(rtcdrv->rtc)) { -- err = PTR_ERR(rtcdrv->rtc); -- dev_err(&pdev->dev, "can't register RTC device\n"); -- return err; -- } -- - /* 0x3 -> RTC_CLK */ - sirfsoc_rtc_iobrg_writel(SIRFSOC_RTC_CLK, - rtcdrv->rtc_base + RTC_CLOCK_SWITCH); -@@ -312,6 +304,14 @@ static int sirfsoc_rtc_probe(struct platform_device *pdev) - rtcdrv->overflow_rtc = - sirfsoc_rtc_iobrg_readl(rtcdrv->rtc_base + RTC_SW_VALUE); - -+ rtcdrv->rtc = devm_rtc_device_register(&pdev->dev, pdev->name, -+ &sirfsoc_rtc_ops, THIS_MODULE); -+ if (IS_ERR(rtcdrv->rtc)) { -+ err = PTR_ERR(rtcdrv->rtc); -+ dev_err(&pdev->dev, "can't register RTC device\n"); -+ return err; -+ } -+ - rtcdrv->irq = platform_get_irq(pdev, 0); - err = devm_request_irq( - &pdev->dev, -diff --git a/drivers/spi/spi-fsl-spi.c b/drivers/spi/spi-fsl-spi.c -index 119f7af..4dcb292 100644 ---- a/drivers/spi/spi-fsl-spi.c -+++ b/drivers/spi/spi-fsl-spi.c -@@ -362,18 +362,28 @@ static int fsl_spi_bufs(struct spi_device *spi, struct spi_transfer *t, - static void fsl_spi_do_one_msg(struct spi_message *m) - { - struct spi_device *spi = m->spi; -- struct spi_transfer *t; -+ struct spi_transfer *t, *first; - unsigned int cs_change; - const int nsecs = 50; - int status; - -- cs_change = 1; -- status = 0; -+ /* Don't allow changes if CS is active */ -+ first = list_first_entry(&m->transfers, struct spi_transfer, -+ transfer_list); - list_for_each_entry(t, &m->transfers, transfer_list) { -- if (t->bits_per_word || t->speed_hz) { -- /* Don't allow changes if CS is active */ -+ if ((first->bits_per_word != t->bits_per_word) || -+ (first->speed_hz != t->speed_hz)) { - status = -EINVAL; -+ dev_err(&spi->dev, -+ "bits_per_word/speed_hz should be same for the same SPI transfer\n"); -+ return; -+ } -+ } - -+ cs_change = 1; -+ status = -EINVAL; -+ list_for_each_entry(t, &m->transfers, transfer_list) { -+ if (t->bits_per_word || t->speed_hz) { - if (cs_change) - status = fsl_spi_setup_transfer(spi, t); - if (status < 0) -diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c -index 28ac3f3..d46b4cc 100644 ---- a/drivers/tty/n_tty.c -+++ b/drivers/tty/n_tty.c -@@ -321,7 +321,8 @@ static void n_tty_check_unthrottle(struct tty_struct *tty) - - static inline void put_tty_queue(unsigned char c, struct n_tty_data *ldata) - { -- *read_buf_addr(ldata, ldata->read_head++) = c; -+ *read_buf_addr(ldata, ldata->read_head) = c; -+ ldata->read_head++; - } - - /** -diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c -index 9cd706d..7d3a3f5 100644 ---- a/drivers/tty/serial/samsung.c -+++ b/drivers/tty/serial/samsung.c -@@ -544,11 +544,15 @@ static void s3c24xx_serial_pm(struct uart_port *port, unsigned int level, - unsigned int old) - { - struct s3c24xx_uart_port *ourport = to_ourport(port); -+ int timeout = 10000; - - ourport->pm_level = level; - - switch (level) { - case 3: -+ while (--timeout && !s3c24xx_serial_txempty_nofifo(port)) -+ udelay(100); -+ - if (!IS_ERR(ourport->baudclk)) - clk_disable_unprepare(ourport->baudclk); - -diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c -index 331f06a..d7049c3 100644 ---- a/drivers/usb/class/cdc-acm.c -+++ b/drivers/usb/class/cdc-acm.c -@@ -1169,10 +1169,11 @@ next_desc: - } else { - control_interface = usb_ifnum_to_if(usb_dev, union_header->bMasterInterface0); - data_interface = usb_ifnum_to_if(usb_dev, (data_interface_num = union_header->bSlaveInterface0)); -- if (!control_interface || !data_interface) { -- dev_dbg(&intf->dev, "no interfaces\n"); -- return -ENODEV; -- } -+ } -+ -+ if (!control_interface || !data_interface) { -+ dev_dbg(&intf->dev, "no interfaces\n"); -+ return -ENODEV; - } - - if (data_interface_num != call_interface_num) -@@ -1448,6 +1449,7 @@ alloc_fail8: - &dev_attr_wCountryCodes); - device_remove_file(&acm->control->dev, - &dev_attr_iCountryCodeRelDate); -+ kfree(acm->country_codes); - } - device_remove_file(&acm->control->dev, &dev_attr_bmCapabilities); - alloc_fail7: -diff --git a/drivers/xen/swiotlb-xen.c b/drivers/xen/swiotlb-xen.c -index ebd8f21..9df5d6e 100644 ---- a/drivers/xen/swiotlb-xen.c -+++ b/drivers/xen/swiotlb-xen.c -@@ -96,8 +96,6 @@ static inline phys_addr_t xen_bus_to_phys(dma_addr_t baddr) - dma_addr_t dma = (dma_addr_t)pfn << PAGE_SHIFT; - phys_addr_t paddr = dma; - -- BUG_ON(paddr != dma); /* truncation has occurred, should never happen */ -- - paddr |= baddr & ~PAGE_MASK; - - return paddr; -@@ -447,11 +445,11 @@ static void xen_unmap_single(struct device *hwdev, dma_addr_t dev_addr, - - BUG_ON(dir == DMA_NONE); - -- xen_dma_unmap_page(hwdev, paddr, size, dir, attrs); -+ xen_dma_unmap_page(hwdev, dev_addr, size, dir, attrs); - - /* NOTE: We use dev_addr here, not paddr! */ - if (is_xen_swiotlb_buffer(dev_addr)) { -- swiotlb_tbl_unmap_single(hwdev, paddr, size, dir); -+ swiotlb_tbl_unmap_single(hwdev, dev_addr, size, dir); - return; - } - -@@ -495,14 +493,14 @@ xen_swiotlb_sync_single(struct device *hwdev, dma_addr_t dev_addr, - BUG_ON(dir == DMA_NONE); - - if (target == SYNC_FOR_CPU) -- xen_dma_sync_single_for_cpu(hwdev, paddr, size, dir); -+ xen_dma_sync_single_for_cpu(hwdev, dev_addr, size, dir); - - /* NOTE: We use dev_addr here, not paddr! */ - if (is_xen_swiotlb_buffer(dev_addr)) - swiotlb_tbl_sync_single(hwdev, paddr, size, dir, target); - - if (target == SYNC_FOR_DEVICE) -- xen_dma_sync_single_for_cpu(hwdev, paddr, size, dir); -+ xen_dma_sync_single_for_device(hwdev, dev_addr, size, dir); - - if (dir != DMA_FROM_DEVICE) - return; -diff --git a/fs/btrfs/delayed-inode.c b/fs/btrfs/delayed-inode.c -index 451b00c..12e3556 100644 ---- a/fs/btrfs/delayed-inode.c -+++ b/fs/btrfs/delayed-inode.c -@@ -1854,6 +1854,14 @@ int btrfs_delayed_delete_inode_ref(struct inode *inode) - { - struct btrfs_delayed_node *delayed_node; - -+ /* -+ * we don't do delayed inode updates during log recovery because it -+ * leads to enospc problems. This means we also can't do -+ * delayed inode refs -+ */ -+ if (BTRFS_I(inode)->root->fs_info->log_root_recovering) -+ return -EAGAIN; -+ - delayed_node = btrfs_get_or_create_delayed_node(inode); - if (IS_ERR(delayed_node)) - return PTR_ERR(delayed_node); -diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c -index b53278c..94a85ee 100644 ---- a/fs/ceph/addr.c -+++ b/fs/ceph/addr.c -@@ -676,7 +676,7 @@ static int ceph_writepages_start(struct address_space *mapping, - int rc = 0; - unsigned wsize = 1 << inode->i_blkbits; - struct ceph_osd_request *req = NULL; -- int do_sync; -+ int do_sync = 0; - u64 truncate_size, snap_size; - u32 truncate_seq; - -diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c -index f4f050a..339c412 100644 ---- a/fs/ceph/mds_client.c -+++ b/fs/ceph/mds_client.c -@@ -1461,15 +1461,18 @@ static void discard_cap_releases(struct ceph_mds_client *mdsc, - - dout("discard_cap_releases mds%d\n", session->s_mds); - -- /* zero out the in-progress message */ -- msg = list_first_entry(&session->s_cap_releases, -- struct ceph_msg, list_head); -- head = msg->front.iov_base; -- num = le32_to_cpu(head->num); -- dout("discard_cap_releases mds%d %p %u\n", session->s_mds, msg, num); -- head->num = cpu_to_le32(0); -- msg->front.iov_len = sizeof(*head); -- session->s_num_cap_releases += num; -+ if (!list_empty(&session->s_cap_releases)) { -+ /* zero out the in-progress message */ -+ msg = list_first_entry(&session->s_cap_releases, -+ struct ceph_msg, list_head); -+ head = msg->front.iov_base; -+ num = le32_to_cpu(head->num); -+ dout("discard_cap_releases mds%d %p %u\n", -+ session->s_mds, msg, num); -+ head->num = cpu_to_le32(0); -+ msg->front.iov_len = sizeof(*head); -+ session->s_num_cap_releases += num; -+ } - - /* requeue completed messages */ - while (!list_empty(&session->s_cap_releases_done)) { -diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c -index a163159..23a51f0 100644 ---- a/fs/fs-writeback.c -+++ b/fs/fs-writeback.c -@@ -476,12 +476,28 @@ __writeback_single_inode(struct inode *inode, struct writeback_control *wbc) - * write_inode() - */ - spin_lock(&inode->i_lock); -- /* Clear I_DIRTY_PAGES if we've written out all dirty pages */ -- if (!mapping_tagged(mapping, PAGECACHE_TAG_DIRTY)) -- inode->i_state &= ~I_DIRTY_PAGES; -+ - dirty = inode->i_state & I_DIRTY; -- inode->i_state &= ~(I_DIRTY_SYNC | I_DIRTY_DATASYNC); -+ inode->i_state &= ~I_DIRTY; -+ -+ /* -+ * Paired with smp_mb() in __mark_inode_dirty(). This allows -+ * __mark_inode_dirty() to test i_state without grabbing i_lock - -+ * either they see the I_DIRTY bits cleared or we see the dirtied -+ * inode. -+ * -+ * I_DIRTY_PAGES is always cleared together above even if @mapping -+ * still has dirty pages. The flag is reinstated after smp_mb() if -+ * necessary. This guarantees that either __mark_inode_dirty() -+ * sees clear I_DIRTY_PAGES or we see PAGECACHE_TAG_DIRTY. -+ */ -+ smp_mb(); -+ -+ if (mapping_tagged(mapping, PAGECACHE_TAG_DIRTY)) -+ inode->i_state |= I_DIRTY_PAGES; -+ - spin_unlock(&inode->i_lock); -+ - /* Don't write the inode if only I_DIRTY_PAGES was set */ - if (dirty & (I_DIRTY_SYNC | I_DIRTY_DATASYNC)) { - int err = write_inode(inode, wbc); -@@ -1145,12 +1161,11 @@ void __mark_inode_dirty(struct inode *inode, int flags) - } - - /* -- * make sure that changes are seen by all cpus before we test i_state -- * -- mikulas -+ * Paired with smp_mb() in __writeback_single_inode() for the -+ * following lockless i_state test. See there for details. - */ - smp_mb(); - -- /* avoid the locking if we can */ - if ((inode->i_state & flags) == flags) - return; - -diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c -index 34d2a1f..daa53da 100644 ---- a/fs/nfsd/nfs4state.c -+++ b/fs/nfsd/nfs4state.c -@@ -1209,15 +1209,14 @@ static int copy_cred(struct svc_cred *target, struct svc_cred *source) - return 0; - } - --static long long -+static int - compare_blob(const struct xdr_netobj *o1, const struct xdr_netobj *o2) - { -- long long res; -- -- res = o1->len - o2->len; -- if (res) -- return res; -- return (long long)memcmp(o1->data, o2->data, o1->len); -+ if (o1->len < o2->len) -+ return -1; -+ if (o1->len > o2->len) -+ return 1; -+ return memcmp(o1->data, o2->data, o1->len); - } - - static int same_name(const char *n1, const char *n2) -@@ -1401,7 +1400,7 @@ add_clp_to_name_tree(struct nfs4_client *new_clp, struct rb_root *root) - static struct nfs4_client * - find_clp_in_name_tree(struct xdr_netobj *name, struct rb_root *root) - { -- long long cmp; -+ int cmp; - struct rb_node *node = root->rb_node; - struct nfs4_client *clp; - -diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c -index 8657335..dd1afa3 100644 ---- a/fs/nfsd/nfs4xdr.c -+++ b/fs/nfsd/nfs4xdr.c -@@ -1809,6 +1809,9 @@ static __be32 nfsd4_encode_components_esc(char sep, char *components, - } - else - end++; -+ if (found_esc) -+ end = next; -+ - str = end; - } - *pp = p; -diff --git a/fs/nilfs2/inode.c b/fs/nilfs2/inode.c -index 1e0bbae..09480c53 100644 ---- a/fs/nilfs2/inode.c -+++ b/fs/nilfs2/inode.c -@@ -49,6 +49,8 @@ struct nilfs_iget_args { - int for_gc; - }; - -+static int nilfs_iget_test(struct inode *inode, void *opaque); -+ - void nilfs_inode_add_blocks(struct inode *inode, int n) - { - struct nilfs_root *root = NILFS_I(inode)->i_root; -@@ -347,6 +349,17 @@ const struct address_space_operations nilfs_aops = { - .is_partially_uptodate = block_is_partially_uptodate, - }; - -+static int nilfs_insert_inode_locked(struct inode *inode, -+ struct nilfs_root *root, -+ unsigned long ino) -+{ -+ struct nilfs_iget_args args = { -+ .ino = ino, .root = root, .cno = 0, .for_gc = 0 -+ }; -+ -+ return insert_inode_locked4(inode, ino, nilfs_iget_test, &args); -+} -+ - struct inode *nilfs_new_inode(struct inode *dir, umode_t mode) - { - struct super_block *sb = dir->i_sb; -@@ -382,7 +395,7 @@ struct inode *nilfs_new_inode(struct inode *dir, umode_t mode) - if (S_ISREG(mode) || S_ISDIR(mode) || S_ISLNK(mode)) { - err = nilfs_bmap_read(ii->i_bmap, NULL); - if (err < 0) -- goto failed_bmap; -+ goto failed_after_creation; - - set_bit(NILFS_I_BMAP, &ii->i_state); - /* No lock is needed; iget() ensures it. */ -@@ -398,21 +411,24 @@ struct inode *nilfs_new_inode(struct inode *dir, umode_t mode) - spin_lock(&nilfs->ns_next_gen_lock); - inode->i_generation = nilfs->ns_next_generation++; - spin_unlock(&nilfs->ns_next_gen_lock); -- insert_inode_hash(inode); -+ if (nilfs_insert_inode_locked(inode, root, ino) < 0) { -+ err = -EIO; -+ goto failed_after_creation; -+ } - - err = nilfs_init_acl(inode, dir); - if (unlikely(err)) -- goto failed_acl; /* never occur. When supporting -+ goto failed_after_creation; /* never occur. When supporting - nilfs_init_acl(), proper cancellation of - above jobs should be considered */ - - return inode; - -- failed_acl: -- failed_bmap: -+ failed_after_creation: - clear_nlink(inode); -+ unlock_new_inode(inode); - iput(inode); /* raw_inode will be deleted through -- generic_delete_inode() */ -+ nilfs_evict_inode() */ - goto failed; - - failed_ifile_create_inode: -@@ -460,8 +476,8 @@ int nilfs_read_inode_common(struct inode *inode, - inode->i_atime.tv_nsec = le32_to_cpu(raw_inode->i_mtime_nsec); - inode->i_ctime.tv_nsec = le32_to_cpu(raw_inode->i_ctime_nsec); - inode->i_mtime.tv_nsec = le32_to_cpu(raw_inode->i_mtime_nsec); -- if (inode->i_nlink == 0 && inode->i_mode == 0) -- return -EINVAL; /* this inode is deleted */ -+ if (inode->i_nlink == 0) -+ return -ESTALE; /* this inode is deleted */ - - inode->i_blocks = le64_to_cpu(raw_inode->i_blocks); - ii->i_flags = le32_to_cpu(raw_inode->i_flags); -diff --git a/fs/nilfs2/namei.c b/fs/nilfs2/namei.c -index 9de78f0..0f84b25 100644 ---- a/fs/nilfs2/namei.c -+++ b/fs/nilfs2/namei.c -@@ -51,9 +51,11 @@ static inline int nilfs_add_nondir(struct dentry *dentry, struct inode *inode) - int err = nilfs_add_link(dentry, inode); - if (!err) { - d_instantiate(dentry, inode); -+ unlock_new_inode(inode); - return 0; - } - inode_dec_link_count(inode); -+ unlock_new_inode(inode); - iput(inode); - return err; - } -@@ -182,6 +184,7 @@ out: - out_fail: - drop_nlink(inode); - nilfs_mark_inode_dirty(inode); -+ unlock_new_inode(inode); - iput(inode); - goto out; - } -@@ -201,11 +204,15 @@ static int nilfs_link(struct dentry *old_dentry, struct inode *dir, - inode_inc_link_count(inode); - ihold(inode); - -- err = nilfs_add_nondir(dentry, inode); -- if (!err) -+ err = nilfs_add_link(dentry, inode); -+ if (!err) { -+ d_instantiate(dentry, inode); - err = nilfs_transaction_commit(dir->i_sb); -- else -+ } else { -+ inode_dec_link_count(inode); -+ iput(inode); - nilfs_transaction_abort(dir->i_sb); -+ } - - return err; - } -@@ -243,6 +250,7 @@ static int nilfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) - - nilfs_mark_inode_dirty(inode); - d_instantiate(dentry, inode); -+ unlock_new_inode(inode); - out: - if (!err) - err = nilfs_transaction_commit(dir->i_sb); -@@ -255,6 +263,7 @@ out_fail: - drop_nlink(inode); - drop_nlink(inode); - nilfs_mark_inode_dirty(inode); -+ unlock_new_inode(inode); - iput(inode); - out_dir: - drop_nlink(dir); -diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c -index aeb44e8..bb6ee06 100644 ---- a/fs/ocfs2/aops.c -+++ b/fs/ocfs2/aops.c -@@ -899,7 +899,7 @@ void ocfs2_unlock_and_free_pages(struct page **pages, int num_pages) - } - } - --static void ocfs2_free_write_ctxt(struct ocfs2_write_ctxt *wc) -+static void ocfs2_unlock_pages(struct ocfs2_write_ctxt *wc) - { - int i; - -@@ -920,7 +920,11 @@ static void ocfs2_free_write_ctxt(struct ocfs2_write_ctxt *wc) - page_cache_release(wc->w_target_page); - } - ocfs2_unlock_and_free_pages(wc->w_pages, wc->w_num_pages); -+} - -+static void ocfs2_free_write_ctxt(struct ocfs2_write_ctxt *wc) -+{ -+ ocfs2_unlock_pages(wc); - brelse(wc->w_di_bh); - kfree(wc); - } -@@ -2045,11 +2049,19 @@ out_write_size: - di->i_mtime_nsec = di->i_ctime_nsec = cpu_to_le32(inode->i_mtime.tv_nsec); - ocfs2_journal_dirty(handle, wc->w_di_bh); - -+ /* unlock pages before dealloc since it needs acquiring j_trans_barrier -+ * lock, or it will cause a deadlock since journal commit threads holds -+ * this lock and will ask for the page lock when flushing the data. -+ * put it here to preserve the unlock order. -+ */ -+ ocfs2_unlock_pages(wc); -+ - ocfs2_commit_trans(osb, handle); - - ocfs2_run_deallocs(osb, &wc->w_dealloc); - -- ocfs2_free_write_ctxt(wc); -+ brelse(wc->w_di_bh); -+ kfree(wc); - - return copied; - } -diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c -index feed025f..b242762 100644 ---- a/fs/ocfs2/namei.c -+++ b/fs/ocfs2/namei.c -@@ -94,6 +94,14 @@ static int ocfs2_create_symlink_data(struct ocfs2_super *osb, - struct inode *inode, - const char *symname); - -+static int ocfs2_double_lock(struct ocfs2_super *osb, -+ struct buffer_head **bh1, -+ struct inode *inode1, -+ struct buffer_head **bh2, -+ struct inode *inode2, -+ int rename); -+ -+static void ocfs2_double_unlock(struct inode *inode1, struct inode *inode2); - /* An orphan dir name is an 8 byte value, printed as a hex string */ - #define OCFS2_ORPHAN_NAMELEN ((int)(2 * sizeof(u64))) - -@@ -656,8 +664,10 @@ static int ocfs2_link(struct dentry *old_dentry, - { - handle_t *handle; - struct inode *inode = old_dentry->d_inode; -+ struct inode *old_dir = old_dentry->d_parent->d_inode; - int err; - struct buffer_head *fe_bh = NULL; -+ struct buffer_head *old_dir_bh = NULL; - struct buffer_head *parent_fe_bh = NULL; - struct ocfs2_dinode *fe = NULL; - struct ocfs2_super *osb = OCFS2_SB(dir->i_sb); -@@ -674,19 +684,33 @@ static int ocfs2_link(struct dentry *old_dentry, - - dquot_initialize(dir); - -- err = ocfs2_inode_lock_nested(dir, &parent_fe_bh, 1, OI_LS_PARENT); -+ err = ocfs2_double_lock(osb, &old_dir_bh, old_dir, -+ &parent_fe_bh, dir, 0); - if (err < 0) { - if (err != -ENOENT) - mlog_errno(err); - return err; - } - -+ /* make sure both dirs have bhs -+ * get an extra ref on old_dir_bh if old==new */ -+ if (!parent_fe_bh) { -+ if (old_dir_bh) { -+ parent_fe_bh = old_dir_bh; -+ get_bh(parent_fe_bh); -+ } else { -+ mlog(ML_ERROR, "%s: no old_dir_bh!\n", osb->uuid_str); -+ err = -EIO; -+ goto out; -+ } -+ } -+ - if (!dir->i_nlink) { - err = -ENOENT; - goto out; - } - -- err = ocfs2_lookup_ino_from_name(dir, old_dentry->d_name.name, -+ err = ocfs2_lookup_ino_from_name(old_dir, old_dentry->d_name.name, - old_dentry->d_name.len, &old_de_ino); - if (err) { - err = -ENOENT; -@@ -779,10 +803,11 @@ out_unlock_inode: - ocfs2_inode_unlock(inode, 1); - - out: -- ocfs2_inode_unlock(dir, 1); -+ ocfs2_double_unlock(old_dir, dir); - - brelse(fe_bh); - brelse(parent_fe_bh); -+ brelse(old_dir_bh); - - ocfs2_free_dir_lookup_result(&lookup); - -@@ -991,14 +1016,15 @@ leave: - } - - /* -- * The only place this should be used is rename! -+ * The only place this should be used is rename and link! - * if they have the same id, then the 1st one is the only one locked. - */ - static int ocfs2_double_lock(struct ocfs2_super *osb, - struct buffer_head **bh1, - struct inode *inode1, - struct buffer_head **bh2, -- struct inode *inode2) -+ struct inode *inode2, -+ int rename) - { - int status; - struct ocfs2_inode_info *oi1 = OCFS2_I(inode1); -@@ -1028,7 +1054,7 @@ static int ocfs2_double_lock(struct ocfs2_super *osb, - } - /* lock id2 */ - status = ocfs2_inode_lock_nested(inode2, bh2, 1, -- OI_LS_RENAME1); -+ rename == 1 ? OI_LS_RENAME1 : OI_LS_PARENT); - if (status < 0) { - if (status != -ENOENT) - mlog_errno(status); -@@ -1037,7 +1063,8 @@ static int ocfs2_double_lock(struct ocfs2_super *osb, - } - - /* lock id1 */ -- status = ocfs2_inode_lock_nested(inode1, bh1, 1, OI_LS_RENAME2); -+ status = ocfs2_inode_lock_nested(inode1, bh1, 1, -+ rename == 1 ? OI_LS_RENAME2 : OI_LS_PARENT); - if (status < 0) { - /* - * An error return must mean that no cluster locks -@@ -1137,7 +1164,7 @@ static int ocfs2_rename(struct inode *old_dir, - - /* if old and new are the same, this'll just do one lock. */ - status = ocfs2_double_lock(osb, &old_dir_bh, old_dir, -- &new_dir_bh, new_dir); -+ &new_dir_bh, new_dir, 1); - if (status < 0) { - mlog_errno(status); - goto bail; -diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c -index fa8cef2..e7d95f9 100644 ---- a/fs/pstore/ram.c -+++ b/fs/pstore/ram.c -@@ -61,6 +61,11 @@ module_param(mem_size, ulong, 0400); - MODULE_PARM_DESC(mem_size, - "size of reserved RAM used to store oops/panic logs"); - -+static unsigned int mem_type; -+module_param(mem_type, uint, 0600); -+MODULE_PARM_DESC(mem_type, -+ "set to 1 to try to use unbuffered memory (default 0)"); -+ - static int dump_oops = 1; - module_param(dump_oops, int, 0600); - MODULE_PARM_DESC(dump_oops, -@@ -79,6 +84,7 @@ struct ramoops_context { - struct persistent_ram_zone *fprz; - phys_addr_t phys_addr; - unsigned long size; -+ unsigned int memtype; - size_t record_size; - size_t console_size; - size_t ftrace_size; -@@ -353,7 +359,8 @@ static int ramoops_init_przs(struct device *dev, struct ramoops_context *cxt, - size_t sz = cxt->record_size; - - cxt->przs[i] = persistent_ram_new(*paddr, sz, 0, -- &cxt->ecc_info); -+ &cxt->ecc_info, -+ cxt->memtype); - if (IS_ERR(cxt->przs[i])) { - err = PTR_ERR(cxt->przs[i]); - dev_err(dev, "failed to request mem region (0x%zx@0x%llx): %d\n", -@@ -383,7 +390,7 @@ static int ramoops_init_prz(struct device *dev, struct ramoops_context *cxt, - return -ENOMEM; - } - -- *prz = persistent_ram_new(*paddr, sz, sig, &cxt->ecc_info); -+ *prz = persistent_ram_new(*paddr, sz, sig, &cxt->ecc_info, cxt->memtype); - if (IS_ERR(*prz)) { - int err = PTR_ERR(*prz); - -@@ -431,6 +438,7 @@ static int ramoops_probe(struct platform_device *pdev) - cxt->dump_read_cnt = 0; - cxt->size = pdata->mem_size; - cxt->phys_addr = pdata->mem_address; -+ cxt->memtype = pdata->mem_type; - cxt->record_size = pdata->record_size; - cxt->console_size = pdata->console_size; - cxt->ftrace_size = pdata->ftrace_size; -@@ -561,6 +569,7 @@ static void ramoops_register_dummy(void) - - dummy_data->mem_size = mem_size; - dummy_data->mem_address = mem_address; -+ dummy_data->mem_type = 0; - dummy_data->record_size = record_size; - dummy_data->console_size = ramoops_console_size; - dummy_data->ftrace_size = ramoops_ftrace_size; -diff --git a/fs/pstore/ram_core.c b/fs/pstore/ram_core.c -index de272d4..bda61a7 100644 ---- a/fs/pstore/ram_core.c -+++ b/fs/pstore/ram_core.c -@@ -380,7 +380,8 @@ void persistent_ram_zap(struct persistent_ram_zone *prz) - persistent_ram_update_header_ecc(prz); - } - --static void *persistent_ram_vmap(phys_addr_t start, size_t size) -+static void *persistent_ram_vmap(phys_addr_t start, size_t size, -+ unsigned int memtype) - { - struct page **pages; - phys_addr_t page_start; -@@ -392,7 +393,10 @@ static void *persistent_ram_vmap(phys_addr_t start, size_t size) - page_start = start - offset_in_page(start); - page_count = DIV_ROUND_UP(size + offset_in_page(start), PAGE_SIZE); - -- prot = pgprot_noncached(PAGE_KERNEL); -+ if (memtype) -+ prot = pgprot_noncached(PAGE_KERNEL); -+ else -+ prot = pgprot_writecombine(PAGE_KERNEL); - - pages = kmalloc(sizeof(struct page *) * page_count, GFP_KERNEL); - if (!pages) { -@@ -411,8 +415,11 @@ static void *persistent_ram_vmap(phys_addr_t start, size_t size) - return vaddr; - } - --static void *persistent_ram_iomap(phys_addr_t start, size_t size) -+static void *persistent_ram_iomap(phys_addr_t start, size_t size, -+ unsigned int memtype) - { -+ void *va; -+ - if (!request_mem_region(start, size, "persistent_ram")) { - pr_err("request mem region (0x%llx@0x%llx) failed\n", - (unsigned long long)size, (unsigned long long)start); -@@ -422,19 +429,24 @@ static void *persistent_ram_iomap(phys_addr_t start, size_t size) - buffer_start_add = buffer_start_add_locked; - buffer_size_add = buffer_size_add_locked; - -- return ioremap(start, size); -+ if (memtype) -+ va = ioremap(start, size); -+ else -+ va = ioremap_wc(start, size); -+ -+ return va; - } - - static int persistent_ram_buffer_map(phys_addr_t start, phys_addr_t size, -- struct persistent_ram_zone *prz) -+ struct persistent_ram_zone *prz, int memtype) - { - prz->paddr = start; - prz->size = size; - - if (pfn_valid(start >> PAGE_SHIFT)) -- prz->vaddr = persistent_ram_vmap(start, size); -+ prz->vaddr = persistent_ram_vmap(start, size, memtype); - else -- prz->vaddr = persistent_ram_iomap(start, size); -+ prz->vaddr = persistent_ram_iomap(start, size, memtype); - - if (!prz->vaddr) { - pr_err("%s: Failed to map 0x%llx pages at 0x%llx\n", __func__, -@@ -502,7 +514,8 @@ void persistent_ram_free(struct persistent_ram_zone *prz) - } - - struct persistent_ram_zone *persistent_ram_new(phys_addr_t start, size_t size, -- u32 sig, struct persistent_ram_ecc_info *ecc_info) -+ u32 sig, struct persistent_ram_ecc_info *ecc_info, -+ unsigned int memtype) - { - struct persistent_ram_zone *prz; - int ret = -ENOMEM; -@@ -513,7 +526,7 @@ struct persistent_ram_zone *persistent_ram_new(phys_addr_t start, size_t size, - goto err; - } - -- ret = persistent_ram_buffer_map(start, size, prz); -+ ret = persistent_ram_buffer_map(start, size, prz, memtype); - if (ret) - goto err; - -diff --git a/include/linux/mm.h b/include/linux/mm.h -index d5039da..46b8ab5 100644 ---- a/include/linux/mm.h -+++ b/include/linux/mm.h -@@ -1866,7 +1866,7 @@ extern int expand_downwards(struct vm_area_struct *vma, - #if VM_GROWSUP - extern int expand_upwards(struct vm_area_struct *vma, unsigned long address); - #else -- #define expand_upwards(vma, address) do { } while (0) -+ #define expand_upwards(vma, address) (0) - #endif - - /* Look up the first VMA which satisfies addr < vm_end, NULL if none. */ -diff --git a/include/linux/pstore_ram.h b/include/linux/pstore_ram.h -index 9974975..4af3fdc 100644 ---- a/include/linux/pstore_ram.h -+++ b/include/linux/pstore_ram.h -@@ -53,7 +53,8 @@ struct persistent_ram_zone { - }; - - struct persistent_ram_zone *persistent_ram_new(phys_addr_t start, size_t size, -- u32 sig, struct persistent_ram_ecc_info *ecc_info); -+ u32 sig, struct persistent_ram_ecc_info *ecc_info, -+ unsigned int memtype); - void persistent_ram_free(struct persistent_ram_zone *prz); - void persistent_ram_zap(struct persistent_ram_zone *prz); - -@@ -76,6 +77,7 @@ ssize_t persistent_ram_ecc_string(struct persistent_ram_zone *prz, - struct ramoops_platform_data { - unsigned long mem_size; - unsigned long mem_address; -+ unsigned int mem_type; - unsigned long record_size; - unsigned long console_size; - unsigned long ftrace_size; -diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h -index 67e1bbf..dc7bb01 100644 ---- a/include/trace/events/sched.h -+++ b/include/trace/events/sched.h -@@ -100,7 +100,7 @@ static inline long __trace_sched_switch_state(struct task_struct *p) - /* - * For all intents and purposes a preempted task is a running task. - */ -- if (task_preempt_count(p) & PREEMPT_ACTIVE) -+ if (preempt_count() & PREEMPT_ACTIVE) - state = TASK_RUNNING | TASK_STATE_MAX; - #endif - -diff --git a/kernel/events/core.c b/kernel/events/core.c -index 4bbb27a..69cffb4 100644 ---- a/kernel/events/core.c -+++ b/kernel/events/core.c -@@ -7240,11 +7240,11 @@ SYSCALL_DEFINE5(perf_event_open, - - if (move_group) { - synchronize_rcu(); -- perf_install_in_context(ctx, group_leader, event->cpu); -+ perf_install_in_context(ctx, group_leader, group_leader->cpu); - get_ctx(ctx); - list_for_each_entry(sibling, &group_leader->sibling_list, - group_entry) { -- perf_install_in_context(ctx, sibling, event->cpu); -+ perf_install_in_context(ctx, sibling, sibling->cpu); - get_ctx(ctx); - } - } -diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c -index 37dac98..8d3c5dd 100644 ---- a/kernel/sched/deadline.c -+++ b/kernel/sched/deadline.c -@@ -550,24 +550,7 @@ void init_dl_task_timer(struct sched_dl_entity *dl_se) - static - int dl_runtime_exceeded(struct rq *rq, struct sched_dl_entity *dl_se) - { -- int dmiss = dl_time_before(dl_se->deadline, rq_clock(rq)); -- int rorun = dl_se->runtime <= 0; -- -- if (!rorun && !dmiss) -- return 0; -- -- /* -- * If we are beyond our current deadline and we are still -- * executing, then we have already used some of the runtime of -- * the next instance. Thus, if we do not account that, we are -- * stealing bandwidth from the system at each deadline miss! -- */ -- if (dmiss) { -- dl_se->runtime = rorun ? dl_se->runtime : 0; -- dl_se->runtime -= rq_clock(rq) - dl_se->deadline; -- } -- -- return 1; -+ return (dl_se->runtime <= 0); - } - - extern bool sched_rt_bandwidth_account(struct rt_rq *rt_rq); -@@ -806,10 +789,10 @@ enqueue_dl_entity(struct sched_dl_entity *dl_se, - * parameters of the task might need updating. Otherwise, - * we want a replenishment of its runtime. - */ -- if (!dl_se->dl_new && flags & ENQUEUE_REPLENISH) -- replenish_dl_entity(dl_se, pi_se); -- else -+ if (dl_se->dl_new || flags & ENQUEUE_WAKEUP) - update_dl_entity(dl_se, pi_se); -+ else if (flags & ENQUEUE_REPLENISH) -+ replenish_dl_entity(dl_se, pi_se); - - __enqueue_dl_entity(dl_se); - } -diff --git a/mm/memory.c b/mm/memory.c -index 48d7365..924429e 100644 ---- a/mm/memory.c -+++ b/mm/memory.c -@@ -3204,7 +3204,7 @@ static inline int check_stack_guard_page(struct vm_area_struct *vma, unsigned lo - if (prev && prev->vm_end == address) - return prev->vm_flags & VM_GROWSDOWN ? 0 : -ENOMEM; - -- expand_downwards(vma, address - PAGE_SIZE); -+ return expand_downwards(vma, address - PAGE_SIZE); - } - if ((vma->vm_flags & VM_GROWSUP) && address + PAGE_SIZE == vma->vm_end) { - struct vm_area_struct *next = vma->vm_next; -@@ -3213,7 +3213,7 @@ static inline int check_stack_guard_page(struct vm_area_struct *vma, unsigned lo - if (next && next->vm_start == address + PAGE_SIZE) - return next->vm_flags & VM_GROWSUP ? 0 : -ENOMEM; - -- expand_upwards(vma, address + PAGE_SIZE); -+ return expand_upwards(vma, address + PAGE_SIZE); - } - return 0; - } -diff --git a/mm/mmap.c b/mm/mmap.c -index b91ac80..085bcd8 100644 ---- a/mm/mmap.c -+++ b/mm/mmap.c -@@ -2058,14 +2058,17 @@ static int acct_stack_growth(struct vm_area_struct *vma, unsigned long size, uns - { - struct mm_struct *mm = vma->vm_mm; - struct rlimit *rlim = current->signal->rlim; -- unsigned long new_start; -+ unsigned long new_start, actual_size; - - /* address space limit tests */ - if (!may_expand_vm(mm, grow)) - return -ENOMEM; - - /* Stack limit test */ -- if (size > ACCESS_ONCE(rlim[RLIMIT_STACK].rlim_cur)) -+ actual_size = size; -+ if (size && (vma->vm_flags & (VM_GROWSUP | VM_GROWSDOWN))) -+ actual_size -= PAGE_SIZE; -+ if (actual_size > ACCESS_ONCE(rlim[RLIMIT_STACK].rlim_cur)) - return -ENOMEM; - - /* mlock limit tests */ -diff --git a/mm/vmscan.c b/mm/vmscan.c -index deb139e..be6a689 100644 ---- a/mm/vmscan.c -+++ b/mm/vmscan.c -@@ -2860,18 +2860,20 @@ static bool prepare_kswapd_sleep(pg_data_t *pgdat, int order, long remaining, - return false; - - /* -- * There is a potential race between when kswapd checks its watermarks -- * and a process gets throttled. There is also a potential race if -- * processes get throttled, kswapd wakes, a large process exits therby -- * balancing the zones that causes kswapd to miss a wakeup. If kswapd -- * is going to sleep, no process should be sleeping on pfmemalloc_wait -- * so wake them now if necessary. If necessary, processes will wake -- * kswapd and get throttled again -+ * The throttled processes are normally woken up in balance_pgdat() as -+ * soon as pfmemalloc_watermark_ok() is true. But there is a potential -+ * race between when kswapd checks the watermarks and a process gets -+ * throttled. There is also a potential race if processes get -+ * throttled, kswapd wakes, a large process exits thereby balancing the -+ * zones, which causes kswapd to exit balance_pgdat() before reaching -+ * the wake up checks. If kswapd is going to sleep, no process should -+ * be sleeping on pfmemalloc_wait, so wake them now if necessary. If -+ * the wake up is premature, processes will wake kswapd and get -+ * throttled again. The difference from wake ups in balance_pgdat() is -+ * that here we are under prepare_to_wait(). - */ -- if (waitqueue_active(&pgdat->pfmemalloc_wait)) { -- wake_up(&pgdat->pfmemalloc_wait); -- return false; -- } -+ if (waitqueue_active(&pgdat->pfmemalloc_wait)) -+ wake_up_all(&pgdat->pfmemalloc_wait); - - return pgdat_balanced(pgdat, order, classzone_idx); - } -diff --git a/scripts/kernel-doc b/scripts/kernel-doc -index da058da..2438cc3 100755 ---- a/scripts/kernel-doc -+++ b/scripts/kernel-doc -@@ -1753,7 +1753,7 @@ sub dump_struct($$) { - # strip kmemcheck_bitfield_{begin,end}.*; - $members =~ s/kmemcheck_bitfield_.*?;//gos; - # strip attributes -- $members =~ s/__aligned\s*\(.+\)//gos; -+ $members =~ s/__aligned\s*\([^;]*\)//gos; - - create_parameterlist($members, ';', $file); - check_sections($file, $declaration_name, "struct", $sectcheck, $struct_actual, $nested); -diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c -index dafcf82..f6e5c4e 100644 ---- a/sound/pci/hda/hda_codec.c -+++ b/sound/pci/hda/hda_codec.c -@@ -338,8 +338,10 @@ int snd_hda_get_sub_nodes(struct hda_codec *codec, hda_nid_t nid, - unsigned int parm; - - parm = snd_hda_param_read(codec, nid, AC_PAR_NODE_COUNT); -- if (parm == -1) -+ if (parm == -1) { -+ *start_id = 0; - return 0; -+ } - *start_id = (parm >> 16) & 0x7fff; - return (int)(parm & 0x7fff); - } -diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c -index 15270a2..12f28d7 100644 ---- a/sound/pci/hda/patch_sigmatel.c -+++ b/sound/pci/hda/patch_sigmatel.c -@@ -593,9 +593,9 @@ static void stac_store_hints(struct hda_codec *codec) - spec->gpio_mask; - } - if (get_int_hint(codec, "gpio_dir", &spec->gpio_dir)) -- spec->gpio_mask &= spec->gpio_mask; -- if (get_int_hint(codec, "gpio_data", &spec->gpio_data)) - spec->gpio_dir &= spec->gpio_mask; -+ if (get_int_hint(codec, "gpio_data", &spec->gpio_data)) -+ spec->gpio_data &= spec->gpio_mask; - if (get_int_hint(codec, "eapd_mask", &spec->eapd_mask)) - spec->eapd_mask &= spec->gpio_mask; - if (get_int_hint(codec, "gpio_mute", &spec->gpio_mute)) -diff --git a/sound/soc/codecs/max98090.c b/sound/soc/codecs/max98090.c -index ddfb0fd..9dd260f 100644 ---- a/sound/soc/codecs/max98090.c -+++ b/sound/soc/codecs/max98090.c -@@ -1378,8 +1378,8 @@ static const struct snd_soc_dapm_route max98090_dapm_routes[] = { - {"STENL Mux", "Sidetone Left", "DMICL"}, - {"STENR Mux", "Sidetone Right", "ADCR"}, - {"STENR Mux", "Sidetone Right", "DMICR"}, -- {"DACL", "NULL", "STENL Mux"}, -- {"DACR", "NULL", "STENL Mux"}, -+ {"DACL", NULL, "STENL Mux"}, -+ {"DACR", NULL, "STENL Mux"}, - - {"AIFINL", NULL, "SHDN"}, - {"AIFINR", NULL, "SHDN"}, -diff --git a/sound/soc/codecs/sigmadsp.c b/sound/soc/codecs/sigmadsp.c -index 4068f24..bb3878c 100644 ---- a/sound/soc/codecs/sigmadsp.c -+++ b/sound/soc/codecs/sigmadsp.c -@@ -176,6 +176,13 @@ static int _process_sigma_firmware(struct device *dev, - goto done; - } - -+ if (ssfw_head->version != 1) { -+ dev_err(dev, -+ "Failed to load firmware: Invalid version %d. Supported firmware versions: 1\n", -+ ssfw_head->version); -+ goto done; -+ } -+ - crc = crc32(0, fw->data + sizeof(*ssfw_head), - fw->size - sizeof(*ssfw_head)); - pr_debug("%s: crc=%x\n", __func__, crc); -diff --git a/sound/soc/dwc/designware_i2s.c b/sound/soc/dwc/designware_i2s.c -index 25c31f1..2f63575 100644 ---- a/sound/soc/dwc/designware_i2s.c -+++ b/sound/soc/dwc/designware_i2s.c -@@ -263,6 +263,19 @@ static void dw_i2s_shutdown(struct snd_pcm_substream *substream, - snd_soc_dai_set_dma_data(dai, substream, NULL); - } - -+static int dw_i2s_prepare(struct snd_pcm_substream *substream, -+ struct snd_soc_dai *dai) -+{ -+ struct dw_i2s_dev *dev = snd_soc_dai_get_drvdata(dai); -+ -+ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) -+ i2s_write_reg(dev->i2s_base, TXFFR, 1); -+ else -+ i2s_write_reg(dev->i2s_base, RXFFR, 1); -+ -+ return 0; -+} -+ - static int dw_i2s_trigger(struct snd_pcm_substream *substream, - int cmd, struct snd_soc_dai *dai) - { -@@ -294,6 +307,7 @@ static struct snd_soc_dai_ops dw_i2s_dai_ops = { - .startup = dw_i2s_startup, - .shutdown = dw_i2s_shutdown, - .hw_params = dw_i2s_hw_params, -+ .prepare = dw_i2s_prepare, - .trigger = dw_i2s_trigger, - }; - -diff --git a/sound/usb/mixer_maps.c b/sound/usb/mixer_maps.c -index d1d72ff..621bc9e 100644 ---- a/sound/usb/mixer_maps.c -+++ b/sound/usb/mixer_maps.c -@@ -328,8 +328,11 @@ static struct usbmix_name_map gamecom780_map[] = { - {} - }; - --static const struct usbmix_name_map kef_x300a_map[] = { -- { 10, NULL }, /* firmware locks up (?) when we try to access this FU */ -+/* some (all?) SCMS USB3318 devices are affected by a firmware lock up -+ * when anything attempts to access FU 10 (control) -+ */ -+static const struct usbmix_name_map scms_usb3318_map[] = { -+ { 10, NULL }, - { 0 } - }; - -@@ -425,8 +428,14 @@ static struct usbmix_ctl_map usbmix_ctl_maps[] = { - .map = ebox44_map, - }, - { -+ /* KEF X300A */ - .id = USB_ID(0x27ac, 0x1000), -- .map = kef_x300a_map, -+ .map = scms_usb3318_map, -+ }, -+ { -+ /* Arcam rPAC */ -+ .id = USB_ID(0x25c4, 0x0003), -+ .map = scms_usb3318_map, - }, - { 0 } /* terminator */ - }; -diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h -index a59743f..0001c9a 100644 ---- a/tools/perf/util/hist.h -+++ b/tools/perf/util/hist.h -@@ -36,6 +36,7 @@ struct events_stats { - u32 nr_invalid_chains; - u32 nr_unknown_id; - u32 nr_unprocessable_samples; -+ u32 nr_unordered_events; - }; - - enum hist_column { -diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c -index 5da6ce7..c1f20e9 100644 ---- a/tools/perf/util/session.c -+++ b/tools/perf/util/session.c -@@ -638,8 +638,7 @@ int perf_session_queue_event(struct perf_session *s, union perf_event *event, - return -ETIME; - - if (timestamp < s->ordered_samples.last_flush) { -- printf("Warning: Timestamp below last timeslice flush\n"); -- return -EINVAL; -+ s->stats.nr_unordered_events++; - } - - if (!list_empty(sc)) { -@@ -1135,6 +1134,8 @@ static void perf_session__warn_about_errors(const struct perf_session *session, - "Do you have a KVM guest running and not using 'perf kvm'?\n", - session->stats.nr_unprocessable_samples); - } -+ if (session->stats.nr_unordered_events != 0) -+ ui__warning("%u out of order events recorded.\n", session->stats.nr_unordered_events); - } - - volatile int session_done; diff --git a/projects/imx6/patches/linux/linux-000-patch-3.14.29-30.patch b/projects/imx6/patches/linux/linux-000-patch-3.14.29-30.patch deleted file mode 100644 index eda2f694ea4..00000000000 --- a/projects/imx6/patches/linux/linux-000-patch-3.14.29-30.patch +++ /dev/null @@ -1,4387 +0,0 @@ -diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt -index 7116fda..5d91ba1 100644 ---- a/Documentation/kernel-parameters.txt -+++ b/Documentation/kernel-parameters.txt -@@ -1172,6 +1172,7 @@ bytes respectively. Such letter suffixes can also be entirely omitted. - i8042.notimeout [HW] Ignore timeout condition signalled by controller - i8042.reset [HW] Reset the controller during init and cleanup - i8042.unlock [HW] Unlock (ignore) the keylock -+ i8042.kbdreset [HW] Reset device connected to KBD port - - i810= [HW,DRM] - -diff --git a/Makefile b/Makefile -index 7aff64e..5b94752 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,6 +1,6 @@ - VERSION = 3 - PATCHLEVEL = 14 --SUBLEVEL = 29 -+SUBLEVEL = 30 - EXTRAVERSION = - NAME = Remembering Coco - -diff --git a/arch/arc/boot/dts/nsimosci.dts b/arch/arc/boot/dts/nsimosci.dts -index 398064c..4c169d8 100644 ---- a/arch/arc/boot/dts/nsimosci.dts -+++ b/arch/arc/boot/dts/nsimosci.dts -@@ -20,7 +20,7 @@ - /* this is for console on PGU */ - /* bootargs = "console=tty0 consoleblank=0"; */ - /* this is for console on serial */ -- bootargs = "earlycon=uart8250,mmio32,0xc0000000,115200n8 console=tty0 console=ttyS0,115200n8 consoleblank=0 debug"; -+ bootargs = "earlycon=uart8250,mmio32,0xf0000000,115200n8 console=tty0 console=ttyS0,115200n8 consoleblank=0 debug"; - }; - - aliases { -@@ -46,9 +46,9 @@ - #interrupt-cells = <1>; - }; - -- uart0: serial@c0000000 { -+ uart0: serial@f0000000 { - compatible = "ns8250"; -- reg = <0xc0000000 0x2000>; -+ reg = <0xf0000000 0x2000>; - interrupts = <11>; - clock-frequency = <3686400>; - baud = <115200>; -@@ -57,21 +57,21 @@ - no-loopback-test = <1>; - }; - -- pgu0: pgu@c9000000 { -+ pgu0: pgu@f9000000 { - compatible = "snps,arcpgufb"; -- reg = <0xc9000000 0x400>; -+ reg = <0xf9000000 0x400>; - }; - -- ps2: ps2@c9001000 { -+ ps2: ps2@f9001000 { - compatible = "snps,arc_ps2"; -- reg = <0xc9000400 0x14>; -+ reg = <0xf9000400 0x14>; - interrupts = <13>; - interrupt-names = "arc_ps2_irq"; - }; - -- eth0: ethernet@c0003000 { -+ eth0: ethernet@f0003000 { - compatible = "snps,oscilan"; -- reg = <0xc0003000 0x44>; -+ reg = <0xf0003000 0x44>; - interrupts = <7>, <8>; - interrupt-names = "rx", "tx"; - }; -diff --git a/arch/arc/include/asm/linkage.h b/arch/arc/include/asm/linkage.h -index 66ee552..5faad17 100644 ---- a/arch/arc/include/asm/linkage.h -+++ b/arch/arc/include/asm/linkage.h -@@ -13,20 +13,6 @@ - - #define ASM_NL ` /* use '`' to mark new line in macro */ - --/* Can't use the ENTRY macro in linux/linkage.h -- * gas considers ';' as comment vs. newline -- */ --.macro ARC_ENTRY name -- .global \name -- .align 4 -- \name: --.endm -- --.macro ARC_EXIT name --#define ASM_PREV_SYM_ADDR(name) .-##name -- .size \ name, ASM_PREV_SYM_ADDR(\name) --.endm -- - /* annotation for data we want in DCCM - if enabled in .config */ - .macro ARCFP_DATA nm - #ifdef CONFIG_ARC_HAS_DCCM -diff --git a/arch/arc/kernel/ctx_sw_asm.S b/arch/arc/kernel/ctx_sw_asm.S -index 65690e7..2ff0347 100644 ---- a/arch/arc/kernel/ctx_sw_asm.S -+++ b/arch/arc/kernel/ctx_sw_asm.S -@@ -62,4 +62,4 @@ __switch_to: - ld.ab blink, [sp, 4] - j [blink] - --ARC_EXIT __switch_to -+END(__switch_to) -diff --git a/arch/arc/kernel/entry.S b/arch/arc/kernel/entry.S -index 6e8f83a..29b82ad 100644 ---- a/arch/arc/kernel/entry.S -+++ b/arch/arc/kernel/entry.S -@@ -141,7 +141,7 @@ VECTOR EV_Extension ; 0x130, Extn Intruction Excp (0x26) - VECTOR reserved ; Reserved Exceptions - .endr - --#include <linux/linkage.h> /* ARC_{EXTRY,EXIT} */ -+#include <linux/linkage.h> /* {EXTRY,EXIT} */ - #include <asm/entry.h> /* SAVE_ALL_{INT1,INT2,SYS...} */ - #include <asm/errno.h> - #include <asm/arcregs.h> -@@ -184,7 +184,7 @@ reserved: ; processor restart - ; --------------------------------------------- - ; Level 2 ISR: Can interrupt a Level 1 ISR - ; --------------------------------------------- --ARC_ENTRY handle_interrupt_level2 -+ENTRY(handle_interrupt_level2) - - ; TODO-vineetg for SMP this wont work - ; free up r9 as scratchpad -@@ -225,14 +225,14 @@ ARC_ENTRY handle_interrupt_level2 - - b ret_from_exception - --ARC_EXIT handle_interrupt_level2 -+END(handle_interrupt_level2) - - #endif - - ; --------------------------------------------- - ; Level 1 ISR - ; --------------------------------------------- --ARC_ENTRY handle_interrupt_level1 -+ENTRY(handle_interrupt_level1) - - /* free up r9 as scratchpad */ - #ifdef CONFIG_SMP -@@ -265,7 +265,7 @@ ARC_ENTRY handle_interrupt_level1 - sr r8, [AUX_IRQ_LV12] ; clear bit in Sticky Status Reg - - b ret_from_exception --ARC_EXIT handle_interrupt_level1 -+END(handle_interrupt_level1) - - ;################### Non TLB Exception Handling ############################# - -@@ -273,7 +273,7 @@ ARC_EXIT handle_interrupt_level1 - ; Instruction Error Exception Handler - ; --------------------------------------------- - --ARC_ENTRY instr_service -+ENTRY(instr_service) - - EXCEPTION_PROLOGUE - -@@ -284,13 +284,13 @@ ARC_ENTRY instr_service - - bl do_insterror_or_kprobe - b ret_from_exception --ARC_EXIT instr_service -+END(instr_service) - - ; --------------------------------------------- - ; Memory Error Exception Handler - ; --------------------------------------------- - --ARC_ENTRY mem_service -+ENTRY(mem_service) - - EXCEPTION_PROLOGUE - -@@ -301,13 +301,13 @@ ARC_ENTRY mem_service - - bl do_memory_error - b ret_from_exception --ARC_EXIT mem_service -+END(mem_service) - - ; --------------------------------------------- - ; Machine Check Exception Handler - ; --------------------------------------------- - --ARC_ENTRY EV_MachineCheck -+ENTRY(EV_MachineCheck) - - EXCEPTION_PROLOGUE - -@@ -331,13 +331,13 @@ ARC_ENTRY EV_MachineCheck - - j do_machine_check_fault - --ARC_EXIT EV_MachineCheck -+END(EV_MachineCheck) - - ; --------------------------------------------- - ; Protection Violation Exception Handler - ; --------------------------------------------- - --ARC_ENTRY EV_TLBProtV -+ENTRY(EV_TLBProtV) - - EXCEPTION_PROLOGUE - -@@ -385,12 +385,12 @@ ARC_ENTRY EV_TLBProtV - - b ret_from_exception - --ARC_EXIT EV_TLBProtV -+END(EV_TLBProtV) - - ; --------------------------------------------- - ; Privilege Violation Exception Handler - ; --------------------------------------------- --ARC_ENTRY EV_PrivilegeV -+ENTRY(EV_PrivilegeV) - - EXCEPTION_PROLOGUE - -@@ -401,12 +401,12 @@ ARC_ENTRY EV_PrivilegeV - - bl do_privilege_fault - b ret_from_exception --ARC_EXIT EV_PrivilegeV -+END(EV_PrivilegeV) - - ; --------------------------------------------- - ; Extension Instruction Exception Handler - ; --------------------------------------------- --ARC_ENTRY EV_Extension -+ENTRY(EV_Extension) - - EXCEPTION_PROLOGUE - -@@ -417,7 +417,7 @@ ARC_ENTRY EV_Extension - - bl do_extension_fault - b ret_from_exception --ARC_EXIT EV_Extension -+END(EV_Extension) - - ;######################### System Call Tracing ######################### - -@@ -504,7 +504,7 @@ trap_with_param: - ; (2) Break Points - ;------------------------------------------------------------------ - --ARC_ENTRY EV_Trap -+ENTRY(EV_Trap) - - EXCEPTION_PROLOGUE - -@@ -534,9 +534,9 @@ ARC_ENTRY EV_Trap - jl [r9] ; Entry into Sys Call Handler - - ; fall through to ret_from_system_call --ARC_EXIT EV_Trap -+END(EV_Trap) - --ARC_ENTRY ret_from_system_call -+ENTRY(ret_from_system_call) - - st r0, [sp, PT_r0] ; sys call return value in pt_regs - -@@ -546,7 +546,7 @@ ARC_ENTRY ret_from_system_call - ; - ; If ret to user mode do we need to handle signals, schedule() et al. - --ARC_ENTRY ret_from_exception -+ENTRY(ret_from_exception) - - ; Pre-{IRQ,Trap,Exception} K/U mode from pt_regs->status32 - ld r8, [sp, PT_status32] ; returning to User/Kernel Mode -@@ -728,9 +728,9 @@ not_level1_interrupt: - debug_marker_syscall: - rtie - --ARC_EXIT ret_from_exception -+END(ret_from_exception) - --ARC_ENTRY ret_from_fork -+ENTRY(ret_from_fork) - ; when the forked child comes here from the __switch_to function - ; r0 has the last task pointer. - ; put last task in scheduler queue -@@ -747,11 +747,11 @@ ARC_ENTRY ret_from_fork - ; special case of kernel_thread entry point returning back due to - ; kernel_execve() - pretend return from syscall to ret to userland - b ret_from_exception --ARC_EXIT ret_from_fork -+END(ret_from_fork) - - ;################### Special Sys Call Wrappers ########################## - --ARC_ENTRY sys_clone_wrapper -+ENTRY(sys_clone_wrapper) - SAVE_CALLEE_SAVED_USER - bl @sys_clone - DISCARD_CALLEE_SAVED_USER -@@ -761,7 +761,7 @@ ARC_ENTRY sys_clone_wrapper - bnz tracesys_exit - - b ret_from_system_call --ARC_EXIT sys_clone_wrapper -+END(sys_clone_wrapper) - - #ifdef CONFIG_ARC_DW2_UNWIND - ; Workaround for bug 94179 (STAR ): -diff --git a/arch/arc/lib/memcmp.S b/arch/arc/lib/memcmp.S -index bc813d5..978bf83 100644 ---- a/arch/arc/lib/memcmp.S -+++ b/arch/arc/lib/memcmp.S -@@ -6,7 +6,7 @@ - * published by the Free Software Foundation. - */ - --#include <asm/linkage.h> -+#include <linux/linkage.h> - - #ifdef __LITTLE_ENDIAN__ - #define WORD2 r2 -@@ -16,7 +16,7 @@ - #define SHIFT r2 - #endif - --ARC_ENTRY memcmp -+ENTRY(memcmp) - or r12,r0,r1 - asl_s r12,r12,30 - sub r3,r2,1 -@@ -121,4 +121,4 @@ ARC_ENTRY memcmp - .Lnil: - j_s.d [blink] - mov r0,0 --ARC_EXIT memcmp -+END(memcmp) -diff --git a/arch/arc/lib/memcpy-700.S b/arch/arc/lib/memcpy-700.S -index b64cc10..3222573 100644 ---- a/arch/arc/lib/memcpy-700.S -+++ b/arch/arc/lib/memcpy-700.S -@@ -6,9 +6,9 @@ - * published by the Free Software Foundation. - */ - --#include <asm/linkage.h> -+#include <linux/linkage.h> - --ARC_ENTRY memcpy -+ENTRY(memcpy) - or r3,r0,r1 - asl_s r3,r3,30 - mov_s r5,r0 -@@ -63,4 +63,4 @@ ARC_ENTRY memcpy - .Lendbloop: - j_s.d [blink] - stb r12,[r5,0] --ARC_EXIT memcpy -+END(memcpy) -diff --git a/arch/arc/lib/memset.S b/arch/arc/lib/memset.S -index 9b2d88d..d36bd43 100644 ---- a/arch/arc/lib/memset.S -+++ b/arch/arc/lib/memset.S -@@ -6,11 +6,11 @@ - * published by the Free Software Foundation. - */ - --#include <asm/linkage.h> -+#include <linux/linkage.h> - - #define SMALL 7 /* Must be at least 6 to deal with alignment/loop issues. */ - --ARC_ENTRY memset -+ENTRY(memset) - mov_s r4,r0 - or r12,r0,r2 - bmsk.f r12,r12,1 -@@ -46,14 +46,14 @@ ARC_ENTRY memset - stb.ab r1,[r4,1] - .Ltiny_end: - j_s [blink] --ARC_EXIT memset -+END(memset) - - ; memzero: @r0 = mem, @r1 = size_t - ; memset: @r0 = mem, @r1 = char, @r2 = size_t - --ARC_ENTRY memzero -+ENTRY(memzero) - ; adjust bzero args to memset args - mov r2, r1 - mov r1, 0 - b memset ;tail call so need to tinker with blink --ARC_EXIT memzero -+END(memzero) -diff --git a/arch/arc/lib/strchr-700.S b/arch/arc/lib/strchr-700.S -index 9c548c7..b725d58 100644 ---- a/arch/arc/lib/strchr-700.S -+++ b/arch/arc/lib/strchr-700.S -@@ -11,9 +11,9 @@ - presence of the norm instruction makes it easier to operate on whole - words branch-free. */ - --#include <asm/linkage.h> -+#include <linux/linkage.h> - --ARC_ENTRY strchr -+ENTRY(strchr) - extb_s r1,r1 - asl r5,r1,8 - bmsk r2,r0,1 -@@ -130,4 +130,4 @@ ARC_ENTRY strchr - j_s.d [blink] - mov.mi r0,0 - #endif /* ENDIAN */ --ARC_EXIT strchr -+END(strchr) -diff --git a/arch/arc/lib/strcmp.S b/arch/arc/lib/strcmp.S -index 5dc802b..3544600 100644 ---- a/arch/arc/lib/strcmp.S -+++ b/arch/arc/lib/strcmp.S -@@ -13,9 +13,9 @@ - source 1; however, that would increase the overhead for loop setup / finish, - and strcmp might often terminate early. */ - --#include <asm/linkage.h> -+#include <linux/linkage.h> - --ARC_ENTRY strcmp -+ENTRY(strcmp) - or r2,r0,r1 - bmsk_s r2,r2,1 - brne r2,0,.Lcharloop -@@ -93,4 +93,4 @@ ARC_ENTRY strcmp - .Lcmpend: - j_s.d [blink] - sub r0,r2,r3 --ARC_EXIT strcmp -+END(strcmp) -diff --git a/arch/arc/lib/strcpy-700.S b/arch/arc/lib/strcpy-700.S -index b7ca4ae..8422f38 100644 ---- a/arch/arc/lib/strcpy-700.S -+++ b/arch/arc/lib/strcpy-700.S -@@ -16,9 +16,9 @@ - there, but the it is not likely to be taken often, and it - would also be likey to cost an unaligned mispredict at the next call. */ - --#include <asm/linkage.h> -+#include <linux/linkage.h> - --ARC_ENTRY strcpy -+ENTRY(strcpy) - or r2,r0,r1 - bmsk_s r2,r2,1 - brne.d r2,0,charloop -@@ -67,4 +67,4 @@ charloop: - brne.d r3,0,charloop - stb.ab r3,[r10,1] - j [blink] --ARC_EXIT strcpy -+END(strcpy) -diff --git a/arch/arc/lib/strlen.S b/arch/arc/lib/strlen.S -index 39759e0..53cfd56 100644 ---- a/arch/arc/lib/strlen.S -+++ b/arch/arc/lib/strlen.S -@@ -6,9 +6,9 @@ - * published by the Free Software Foundation. - */ - --#include <asm/linkage.h> -+#include <linux/linkage.h> - --ARC_ENTRY strlen -+ENTRY(strlen) - or r3,r0,7 - ld r2,[r3,-7] - ld.a r6,[r3,-3] -@@ -80,4 +80,4 @@ ARC_ENTRY strlen - .Learly_end: - b.d .Lend - sub_s.ne r1,r1,r1 --ARC_EXIT strlen -+END(strlen) -diff --git a/arch/arc/mm/tlbex.S b/arch/arc/mm/tlbex.S -index 3fcfdb3..79bfc81 100644 ---- a/arch/arc/mm/tlbex.S -+++ b/arch/arc/mm/tlbex.S -@@ -260,7 +260,7 @@ ARCFP_CODE ;Fast Path Code, candidate for ICCM - ; I-TLB Miss Exception Handler - ;----------------------------------------------------------------------------- - --ARC_ENTRY EV_TLBMissI -+ENTRY(EV_TLBMissI) - - TLBMISS_FREEUP_REGS - -@@ -293,13 +293,13 @@ ARC_ENTRY EV_TLBMissI - TLBMISS_RESTORE_REGS - rtie - --ARC_EXIT EV_TLBMissI -+END(EV_TLBMissI) - - ;----------------------------------------------------------------------------- - ; D-TLB Miss Exception Handler - ;----------------------------------------------------------------------------- - --ARC_ENTRY EV_TLBMissD -+ENTRY(EV_TLBMissD) - - TLBMISS_FREEUP_REGS - -@@ -381,6 +381,4 @@ do_slow_path_pf: - bl do_page_fault - b ret_from_exception - --ARC_EXIT EV_TLBMissD -- --ARC_ENTRY EV_TLBMissB ; Bogus entry to measure sz of DTLBMiss hdlr -+END(EV_TLBMissD) -diff --git a/arch/arm/boot/dts/imx25.dtsi b/arch/arm/boot/dts/imx25.dtsi -index de16119..6a26e79 100644 ---- a/arch/arm/boot/dts/imx25.dtsi -+++ b/arch/arm/boot/dts/imx25.dtsi -@@ -158,7 +158,7 @@ - #size-cells = <0>; - compatible = "fsl,imx25-cspi", "fsl,imx35-cspi"; - reg = <0x43fa4000 0x4000>; -- clocks = <&clks 62>, <&clks 62>; -+ clocks = <&clks 78>, <&clks 78>; - clock-names = "ipg", "per"; - interrupts = <14>; - status = "disabled"; -diff --git a/arch/arm/mach-imx/clk-imx6q.c b/arch/arm/mach-imx/clk-imx6q.c -index 4d677f4..01a5765 100644 ---- a/arch/arm/mach-imx/clk-imx6q.c -+++ b/arch/arm/mach-imx/clk-imx6q.c -@@ -161,8 +161,8 @@ static void __init imx6q_clocks_init(struct device_node *ccm_node) - post_div_table[1].div = 1; - post_div_table[2].div = 1; - video_div_table[1].div = 1; -- video_div_table[2].div = 1; -- }; -+ video_div_table[3].div = 1; -+ } - - /* type name parent_name base div_mask */ - clk[pll1_sys] = imx_clk_pllv3(IMX_PLLV3_SYS, "pll1_sys", "osc", base, 0x7f); -diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c -index 74044aa..73d80b8 100644 ---- a/arch/arm/mach-omap2/timer.c -+++ b/arch/arm/mach-omap2/timer.c -@@ -513,11 +513,11 @@ static void __init realtime_counter_init(void) - rate = clk_get_rate(sys_clk); - /* Numerator/denumerator values refer TRM Realtime Counter section */ - switch (rate) { -- case 1200000: -+ case 12000000: - num = 64; - den = 125; - break; -- case 1300000: -+ case 13000000: - num = 768; - den = 1625; - break; -@@ -529,11 +529,11 @@ static void __init realtime_counter_init(void) - num = 192; - den = 625; - break; -- case 2600000: -+ case 26000000: - num = 384; - den = 1625; - break; -- case 2700000: -+ case 27000000: - num = 256; - den = 1125; - break; -diff --git a/arch/arm/mach-shmobile/setup-sh73a0.c b/arch/arm/mach-shmobile/setup-sh73a0.c -index f74ab53..2b73c8a 100644 ---- a/arch/arm/mach-shmobile/setup-sh73a0.c -+++ b/arch/arm/mach-shmobile/setup-sh73a0.c -@@ -617,6 +617,7 @@ static struct platform_device ipmmu_device = { - - static struct renesas_intc_irqpin_config irqpin0_platform_data = { - .irq_base = irq_pin(0), /* IRQ0 -> IRQ7 */ -+ .control_parent = true, - }; - - static struct resource irqpin0_resources[] = { -@@ -678,6 +679,7 @@ static struct platform_device irqpin1_device = { - - static struct renesas_intc_irqpin_config irqpin2_platform_data = { - .irq_base = irq_pin(16), /* IRQ16 -> IRQ23 */ -+ .control_parent = true, - }; - - static struct resource irqpin2_resources[] = { -@@ -708,6 +710,7 @@ static struct platform_device irqpin2_device = { - - static struct renesas_intc_irqpin_config irqpin3_platform_data = { - .irq_base = irq_pin(24), /* IRQ24 -> IRQ31 */ -+ .control_parent = true, - }; - - static struct resource irqpin3_resources[] = { -diff --git a/arch/parisc/include/asm/ldcw.h b/arch/parisc/include/asm/ldcw.h -index d2d11b7..8121aa6 100644 ---- a/arch/parisc/include/asm/ldcw.h -+++ b/arch/parisc/include/asm/ldcw.h -@@ -33,11 +33,18 @@ - - #endif /*!CONFIG_PA20*/ - --/* LDCW, the only atomic read-write operation PA-RISC has. *sigh*. */ -+/* LDCW, the only atomic read-write operation PA-RISC has. *sigh*. -+ We don't explicitly expose that "*a" may be written as reload -+ fails to find a register in class R1_REGS when "a" needs to be -+ reloaded when generating 64-bit PIC code. Instead, we clobber -+ memory to indicate to the compiler that the assembly code reads -+ or writes to items other than those listed in the input and output -+ operands. This may pessimize the code somewhat but __ldcw is -+ usually used within code blocks surrounded by memory barriors. */ - #define __ldcw(a) ({ \ - unsigned __ret; \ -- __asm__ __volatile__(__LDCW " 0(%2),%0" \ -- : "=r" (__ret), "+m" (*(a)) : "r" (a)); \ -+ __asm__ __volatile__(__LDCW " 0(%1),%0" \ -+ : "=r" (__ret) : "r" (a) : "memory"); \ - __ret; \ - }) - -diff --git a/arch/um/Kconfig.common b/arch/um/Kconfig.common -index 21ca44c..1f0ea55 100644 ---- a/arch/um/Kconfig.common -+++ b/arch/um/Kconfig.common -@@ -2,6 +2,7 @@ config UML - bool - default y - select HAVE_UID16 -+ select HAVE_FUTEX_CMPXCHG if FUTEX - select GENERIC_IRQ_SHOW - select GENERIC_CPU_DEVICES - select GENERIC_IO -diff --git a/arch/x86/kernel/kprobes/core.c b/arch/x86/kernel/kprobes/core.c -index 79a3f96..a1f5b18 100644 ---- a/arch/x86/kernel/kprobes/core.c -+++ b/arch/x86/kernel/kprobes/core.c -@@ -1017,6 +1017,15 @@ int __kprobes setjmp_pre_handler(struct kprobe *p, struct pt_regs *regs) - regs->flags &= ~X86_EFLAGS_IF; - trace_hardirqs_off(); - regs->ip = (unsigned long)(jp->entry); -+ -+ /* -+ * jprobes use jprobe_return() which skips the normal return -+ * path of the function, and this messes up the accounting of the -+ * function graph tracer to get messed up. -+ * -+ * Pause function graph tracing while performing the jprobe function. -+ */ -+ pause_graph_tracing(); - return 1; - } - -@@ -1042,24 +1051,25 @@ int __kprobes longjmp_break_handler(struct kprobe *p, struct pt_regs *regs) - struct kprobe_ctlblk *kcb = get_kprobe_ctlblk(); - u8 *addr = (u8 *) (regs->ip - 1); - struct jprobe *jp = container_of(p, struct jprobe, kp); -+ void *saved_sp = kcb->jprobe_saved_sp; - - if ((addr > (u8 *) jprobe_return) && - (addr < (u8 *) jprobe_return_end)) { -- if (stack_addr(regs) != kcb->jprobe_saved_sp) { -+ if (stack_addr(regs) != saved_sp) { - struct pt_regs *saved_regs = &kcb->jprobe_saved_regs; - printk(KERN_ERR - "current sp %p does not match saved sp %p\n", -- stack_addr(regs), kcb->jprobe_saved_sp); -+ stack_addr(regs), saved_sp); - printk(KERN_ERR "Saved registers for jprobe %p\n", jp); - show_regs(saved_regs); - printk(KERN_ERR "Current registers\n"); - show_regs(regs); - BUG(); - } -+ /* It's OK to start function graph tracing again */ -+ unpause_graph_tracing(); - *regs = kcb->jprobe_saved_regs; -- memcpy((kprobe_opcode_t *)(kcb->jprobe_saved_sp), -- kcb->jprobes_stack, -- MIN_STACK_SIZE(kcb->jprobe_saved_sp)); -+ memcpy(saved_sp, kcb->jprobes_stack, MIN_STACK_SIZE(saved_sp)); - preempt_enable_no_resched(); - return 1; - } -diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c -index 0c90f4b..de42688 100644 ---- a/arch/x86/kvm/vmx.c -+++ b/arch/x86/kvm/vmx.c -@@ -2320,12 +2320,12 @@ static __init void nested_vmx_setup_ctls_msrs(void) - nested_vmx_secondary_ctls_low = 0; - nested_vmx_secondary_ctls_high &= - SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES | -- SECONDARY_EXEC_UNRESTRICTED_GUEST | - SECONDARY_EXEC_WBINVD_EXITING; - - if (enable_ept) { - /* nested EPT: emulate EPT also to L1 */ -- nested_vmx_secondary_ctls_high |= SECONDARY_EXEC_ENABLE_EPT; -+ nested_vmx_secondary_ctls_high |= SECONDARY_EXEC_ENABLE_EPT | -+ SECONDARY_EXEC_UNRESTRICTED_GUEST; - nested_vmx_ept_caps = VMX_EPT_PAGE_WALK_4_BIT | - VMX_EPTP_WB_BIT | VMX_EPT_2MB_PAGE_BIT | - VMX_EPT_INVEPT_BIT; -diff --git a/arch/x86/um/sys_call_table_32.c b/arch/x86/um/sys_call_table_32.c -index 531d426..bd16d6c 100644 ---- a/arch/x86/um/sys_call_table_32.c -+++ b/arch/x86/um/sys_call_table_32.c -@@ -34,7 +34,7 @@ typedef asmlinkage void (*sys_call_ptr_t)(void); - - extern asmlinkage void sys_ni_syscall(void); - --const sys_call_ptr_t sys_call_table[] __cacheline_aligned = { -+const sys_call_ptr_t sys_call_table[] ____cacheline_aligned = { - /* - * Smells like a compiler bug -- it doesn't work - * when the & below is removed. -diff --git a/arch/x86/um/sys_call_table_64.c b/arch/x86/um/sys_call_table_64.c -index f2f0723..9578308 100644 ---- a/arch/x86/um/sys_call_table_64.c -+++ b/arch/x86/um/sys_call_table_64.c -@@ -46,7 +46,7 @@ typedef void (*sys_call_ptr_t)(void); - - extern void sys_ni_syscall(void); - --const sys_call_ptr_t sys_call_table[] __cacheline_aligned = { -+const sys_call_ptr_t sys_call_table[] ____cacheline_aligned = { - /* - * Smells like a compiler bug -- it doesn't work - * when the & below is removed. -diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c -index f9c4632..7145f6d 100644 ---- a/drivers/clk/clk.c -+++ b/drivers/clk/clk.c -@@ -2232,14 +2232,17 @@ int __clk_get(struct clk *clk) - - void __clk_put(struct clk *clk) - { -+ struct module *owner; -+ - if (!clk || WARN_ON_ONCE(IS_ERR(clk))) - return; - - clk_prepare_lock(); -+ owner = clk->owner; - kref_put(&clk->ref, __clk_release); - clk_prepare_unlock(); - -- module_put(clk->owner); -+ module_put(owner); - } - - /*** clk rate change notifiers ***/ -diff --git a/drivers/clk/samsung/clk-exynos-audss.c b/drivers/clk/samsung/clk-exynos-audss.c -index 884187f..7f30b94 100644 ---- a/drivers/clk/samsung/clk-exynos-audss.c -+++ b/drivers/clk/samsung/clk-exynos-audss.c -@@ -210,6 +210,10 @@ static int exynos_audss_clk_remove(struct platform_device *pdev) - { - int i; - -+#ifdef CONFIG_PM_SLEEP -+ unregister_syscore_ops(&exynos_audss_clk_syscore_ops); -+#endif -+ - of_clk_del_provider(pdev->dev.of_node); - - for (i = 0; i < clk_data.clk_num; i++) { -diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c -index e0a98f5..74ed17d 100644 ---- a/drivers/gpio/gpiolib-of.c -+++ b/drivers/gpio/gpiolib-of.c -@@ -44,8 +44,14 @@ static int of_gpiochip_find_and_xlate(struct gpio_chip *gc, void *data) - return false; - - ret = gc->of_xlate(gc, &gg_data->gpiospec, gg_data->flags); -- if (ret < 0) -- return false; -+ if (ret < 0) { -+ /* We've found the gpio chip, but the translation failed. -+ * Return true to stop looking and return the translation -+ * error via out_gpio -+ */ -+ gg_data->out_gpio = ERR_PTR(ret); -+ return true; -+ } - - gg_data->out_gpio = gpio_to_desc(ret + gc->base); - return true; -diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c -index 50c4922..5b88c83 100644 ---- a/drivers/gpio/gpiolib.c -+++ b/drivers/gpio/gpiolib.c -@@ -1222,6 +1222,9 @@ int gpiochip_add(struct gpio_chip *chip) - - spin_unlock_irqrestore(&gpio_lock, flags); - -+ if (status) -+ goto fail; -+ - #ifdef CONFIG_PINCTRL - INIT_LIST_HEAD(&chip->pin_ranges); - #endif -@@ -1229,12 +1232,12 @@ int gpiochip_add(struct gpio_chip *chip) - of_gpiochip_add(chip); - acpi_gpiochip_add(chip); - -- if (status) -- goto fail; -- - status = gpiochip_export(chip); -- if (status) -+ if (status) { -+ acpi_gpiochip_remove(chip); -+ of_gpiochip_remove(chip); - goto fail; -+ } - - pr_debug("%s: registered GPIOs %d to %d on device: %s\n", __func__, - chip->base, chip->base + chip->ngpio - 1, -diff --git a/drivers/gpu/drm/i915/i915_gem_stolen.c b/drivers/gpu/drm/i915/i915_gem_stolen.c -index 3c78b22..800e06c 100644 ---- a/drivers/gpu/drm/i915/i915_gem_stolen.c -+++ b/drivers/gpu/drm/i915/i915_gem_stolen.c -@@ -137,7 +137,11 @@ static unsigned long i915_stolen_to_physical(struct drm_device *dev) - r = devm_request_mem_region(dev->dev, base + 1, - dev_priv->gtt.stolen_size - 1, - "Graphics Stolen Memory"); -- if (r == NULL) { -+ /* -+ * GEN3 firmware likes to smash pci bridges into the stolen -+ * range. Apparently this works. -+ */ -+ if (r == NULL && !IS_GEN3(dev)) { - DRM_ERROR("conflict detected with stolen region: [0x%08x - 0x%08x]\n", - base, base + (uint32_t)dev_priv->gtt.stolen_size); - base = 0; -diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h -index 0a3b938..0c83b3d 100644 ---- a/drivers/gpu/drm/i915/i915_reg.h -+++ b/drivers/gpu/drm/i915/i915_reg.h -@@ -320,6 +320,7 @@ - #define PIPE_CONTROL_GLOBAL_GTT_IVB (1<<24) /* gen7+ */ - #define PIPE_CONTROL_CS_STALL (1<<20) - #define PIPE_CONTROL_TLB_INVALIDATE (1<<18) -+#define PIPE_CONTROL_MEDIA_STATE_CLEAR (1<<16) - #define PIPE_CONTROL_QW_WRITE (1<<14) - #define PIPE_CONTROL_DEPTH_STALL (1<<13) - #define PIPE_CONTROL_WRITE_FLUSH (1<<12) -diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c -index d488fc7..d2af1e1 100644 ---- a/drivers/gpu/drm/i915/intel_ringbuffer.c -+++ b/drivers/gpu/drm/i915/intel_ringbuffer.c -@@ -334,12 +334,15 @@ gen7_render_ring_flush(struct intel_ring_buffer *ring, - flags |= PIPE_CONTROL_VF_CACHE_INVALIDATE; - flags |= PIPE_CONTROL_CONST_CACHE_INVALIDATE; - flags |= PIPE_CONTROL_STATE_CACHE_INVALIDATE; -+ flags |= PIPE_CONTROL_MEDIA_STATE_CLEAR; - /* - * TLB invalidate requires a post-sync write. - */ - flags |= PIPE_CONTROL_QW_WRITE; - flags |= PIPE_CONTROL_GLOBAL_GTT_IVB; - -+ flags |= PIPE_CONTROL_STALL_AT_SCOREBOARD; -+ - /* Workaround: we must issue a pipe_control with CS-stall bit - * set before a pipe_control command that has the state cache - * invalidate bit set. */ -diff --git a/drivers/gpu/drm/i915/intel_uncore.c b/drivers/gpu/drm/i915/intel_uncore.c -index c879631..b6c063c 100644 ---- a/drivers/gpu/drm/i915/intel_uncore.c -+++ b/drivers/gpu/drm/i915/intel_uncore.c -@@ -451,8 +451,8 @@ hsw_unclaimed_reg_check(struct drm_i915_private *dev_priv, u32 reg) - static void - assert_device_not_suspended(struct drm_i915_private *dev_priv) - { -- WARN(HAS_RUNTIME_PM(dev_priv->dev) && dev_priv->pm.suspended, -- "Device suspended\n"); -+ WARN_ONCE(HAS_RUNTIME_PM(dev_priv->dev) && dev_priv->pm.suspended, -+ "Device suspended\n"); - } - - #define REG_READ_HEADER(x) \ -diff --git a/drivers/gpu/drm/nouveau/core/subdev/mc/nv4c.c b/drivers/gpu/drm/nouveau/core/subdev/mc/nv4c.c -index a75c35c..165401c 100644 ---- a/drivers/gpu/drm/nouveau/core/subdev/mc/nv4c.c -+++ b/drivers/gpu/drm/nouveau/core/subdev/mc/nv4c.c -@@ -24,13 +24,6 @@ - - #include "nv04.h" - --static void --nv4c_mc_msi_rearm(struct nouveau_mc *pmc) --{ -- struct nv04_mc_priv *priv = (void *)pmc; -- nv_wr08(priv, 0x088050, 0xff); --} -- - struct nouveau_oclass * - nv4c_mc_oclass = &(struct nouveau_mc_oclass) { - .base.handle = NV_SUBDEV(MC, 0x4c), -@@ -41,5 +34,4 @@ nv4c_mc_oclass = &(struct nouveau_mc_oclass) { - .fini = _nouveau_mc_fini, - }, - .intr = nv04_mc_intr, -- .msi_rearm = nv4c_mc_msi_rearm, - }.base; -diff --git a/drivers/gpu/drm/radeon/atombios_dp.c b/drivers/gpu/drm/radeon/atombios_dp.c -index 5727dbd..b4dbaded 100644 ---- a/drivers/gpu/drm/radeon/atombios_dp.c -+++ b/drivers/gpu/drm/radeon/atombios_dp.c -@@ -576,6 +576,10 @@ int radeon_dp_mode_valid_helper(struct drm_connector *connector, - struct radeon_connector_atom_dig *dig_connector; - int dp_clock; - -+ if ((mode->clock > 340000) && -+ (!radeon_connector_is_dp12_capable(connector))) -+ return MODE_CLOCK_HIGH; -+ - if (!radeon_connector->con_priv) - return MODE_CLOCK_HIGH; - dig_connector = radeon_connector->con_priv; -diff --git a/drivers/gpu/drm/radeon/ci_dpm.c b/drivers/gpu/drm/radeon/ci_dpm.c -index 543ba2d..c7c2856 100644 ---- a/drivers/gpu/drm/radeon/ci_dpm.c -+++ b/drivers/gpu/drm/radeon/ci_dpm.c -@@ -4733,7 +4733,7 @@ void ci_dpm_disable(struct radeon_device *rdev) - ci_enable_spread_spectrum(rdev, false); - ci_enable_auto_throttle_source(rdev, RADEON_DPM_AUTO_THROTTLE_SRC_THERMAL, false); - ci_stop_dpm(rdev); -- ci_enable_ds_master_switch(rdev, true); -+ ci_enable_ds_master_switch(rdev, false); - ci_enable_ulv(rdev, false); - ci_clear_vc(rdev); - ci_reset_to_default(rdev); -diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c -index ddf70d6..8ef67cb 100644 ---- a/drivers/gpu/drm/radeon/cik.c -+++ b/drivers/gpu/drm/radeon/cik.c -@@ -5879,6 +5879,7 @@ static void cik_enable_mgcg(struct radeon_device *rdev, bool enable) - } - - orig = data = RREG32(RLC_CGTT_MGCG_OVERRIDE); -+ data |= 0x00000001; - data &= 0xfffffffd; - if (orig != data) - WREG32(RLC_CGTT_MGCG_OVERRIDE, data); -@@ -5910,7 +5911,7 @@ static void cik_enable_mgcg(struct radeon_device *rdev, bool enable) - } - } else { - orig = data = RREG32(RLC_CGTT_MGCG_OVERRIDE); -- data |= 0x00000002; -+ data |= 0x00000003; - if (orig != data) - WREG32(RLC_CGTT_MGCG_OVERRIDE, data); - -diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c -index 040a2a1..45a9a03 100644 ---- a/drivers/gpu/drm/radeon/radeon_ttm.c -+++ b/drivers/gpu/drm/radeon/radeon_ttm.c -@@ -191,7 +191,7 @@ static void radeon_evict_flags(struct ttm_buffer_object *bo, - rbo = container_of(bo, struct radeon_bo, tbo); - switch (bo->mem.mem_type) { - case TTM_PL_VRAM: -- if (rbo->rdev->ring[RADEON_RING_TYPE_GFX_INDEX].ready == false) -+ if (rbo->rdev->ring[radeon_copy_ring_index(rbo->rdev)].ready == false) - radeon_ttm_placement_from_domain(rbo, RADEON_GEM_DOMAIN_CPU); - else - radeon_ttm_placement_from_domain(rbo, RADEON_GEM_DOMAIN_GTT); -diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc.c b/drivers/gpu/drm/ttm/ttm_page_alloc.c -index cf4bad2..76329d2 100644 ---- a/drivers/gpu/drm/ttm/ttm_page_alloc.c -+++ b/drivers/gpu/drm/ttm/ttm_page_alloc.c -@@ -297,11 +297,12 @@ static void ttm_pool_update_free_locked(struct ttm_page_pool *pool, - * - * @pool: to free the pages from - * @free_all: If set to true will free all pages in pool -- * @gfp: GFP flags. -+ * @use_static: Safe to use static buffer - **/ - static int ttm_page_pool_free(struct ttm_page_pool *pool, unsigned nr_free, -- gfp_t gfp) -+ bool use_static) - { -+ static struct page *static_buf[NUM_PAGES_TO_ALLOC]; - unsigned long irq_flags; - struct page *p; - struct page **pages_to_free; -@@ -311,7 +312,11 @@ static int ttm_page_pool_free(struct ttm_page_pool *pool, unsigned nr_free, - if (NUM_PAGES_TO_ALLOC < nr_free) - npages_to_free = NUM_PAGES_TO_ALLOC; - -- pages_to_free = kmalloc(npages_to_free * sizeof(struct page *), gfp); -+ if (use_static) -+ pages_to_free = static_buf; -+ else -+ pages_to_free = kmalloc(npages_to_free * sizeof(struct page *), -+ GFP_KERNEL); - if (!pages_to_free) { - pr_err("Failed to allocate memory for pool free operation\n"); - return 0; -@@ -374,7 +379,8 @@ restart: - if (freed_pages) - ttm_pages_put(pages_to_free, freed_pages); - out: -- kfree(pages_to_free); -+ if (pages_to_free != static_buf) -+ kfree(pages_to_free); - return nr_free; - } - -@@ -383,8 +389,6 @@ out: - * - * XXX: (dchinner) Deadlock warning! - * -- * We need to pass sc->gfp_mask to ttm_page_pool_free(). -- * - * This code is crying out for a shrinker per pool.... - */ - static unsigned long -@@ -407,8 +411,8 @@ ttm_pool_shrink_scan(struct shrinker *shrink, struct shrink_control *sc) - if (shrink_pages == 0) - break; - pool = &_manager->pools[(i + pool_offset)%NUM_POOLS]; -- shrink_pages = ttm_page_pool_free(pool, nr_free, -- sc->gfp_mask); -+ /* OK to use static buffer since global mutex is held. */ -+ shrink_pages = ttm_page_pool_free(pool, nr_free, true); - freed += nr_free - shrink_pages; - } - mutex_unlock(&lock); -@@ -710,7 +714,7 @@ static void ttm_put_pages(struct page **pages, unsigned npages, int flags, - } - spin_unlock_irqrestore(&pool->lock, irq_flags); - if (npages) -- ttm_page_pool_free(pool, npages, GFP_KERNEL); -+ ttm_page_pool_free(pool, npages, false); - } - - /* -@@ -849,9 +853,9 @@ void ttm_page_alloc_fini(void) - pr_info("Finalizing pool allocator\n"); - ttm_pool_mm_shrink_fini(_manager); - -+ /* OK to use static buffer since global mutex is no longer used. */ - for (i = 0; i < NUM_POOLS; ++i) -- ttm_page_pool_free(&_manager->pools[i], FREE_ALL_PAGES, -- GFP_KERNEL); -+ ttm_page_pool_free(&_manager->pools[i], FREE_ALL_PAGES, true); - - kobject_put(&_manager->kobj); - _manager = NULL; -diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c b/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c -index ca65df1..3dfa97d 100644 ---- a/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c -+++ b/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c -@@ -411,11 +411,12 @@ static void ttm_dma_page_put(struct dma_pool *pool, struct dma_page *d_page) - * - * @pool: to free the pages from - * @nr_free: If set to true will free all pages in pool -- * @gfp: GFP flags. -+ * @use_static: Safe to use static buffer - **/ - static unsigned ttm_dma_page_pool_free(struct dma_pool *pool, unsigned nr_free, -- gfp_t gfp) -+ bool use_static) - { -+ static struct page *static_buf[NUM_PAGES_TO_ALLOC]; - unsigned long irq_flags; - struct dma_page *dma_p, *tmp; - struct page **pages_to_free; -@@ -432,7 +433,11 @@ static unsigned ttm_dma_page_pool_free(struct dma_pool *pool, unsigned nr_free, - npages_to_free, nr_free); - } - #endif -- pages_to_free = kmalloc(npages_to_free * sizeof(struct page *), gfp); -+ if (use_static) -+ pages_to_free = static_buf; -+ else -+ pages_to_free = kmalloc(npages_to_free * sizeof(struct page *), -+ GFP_KERNEL); - - if (!pages_to_free) { - pr_err("%s: Failed to allocate memory for pool free operation\n", -@@ -502,7 +507,8 @@ restart: - if (freed_pages) - ttm_dma_pages_put(pool, &d_pages, pages_to_free, freed_pages); - out: -- kfree(pages_to_free); -+ if (pages_to_free != static_buf) -+ kfree(pages_to_free); - return nr_free; - } - -@@ -531,7 +537,8 @@ static void ttm_dma_free_pool(struct device *dev, enum pool_type type) - if (pool->type != type) - continue; - /* Takes a spinlock.. */ -- ttm_dma_page_pool_free(pool, FREE_ALL_PAGES, GFP_KERNEL); -+ /* OK to use static buffer since global mutex is held. */ -+ ttm_dma_page_pool_free(pool, FREE_ALL_PAGES, true); - WARN_ON(((pool->npages_in_use + pool->npages_free) != 0)); - /* This code path is called after _all_ references to the - * struct device has been dropped - so nobody should be -@@ -984,7 +991,7 @@ void ttm_dma_unpopulate(struct ttm_dma_tt *ttm_dma, struct device *dev) - - /* shrink pool if necessary (only on !is_cached pools)*/ - if (npages) -- ttm_dma_page_pool_free(pool, npages, GFP_KERNEL); -+ ttm_dma_page_pool_free(pool, npages, false); - ttm->state = tt_unpopulated; - } - EXPORT_SYMBOL_GPL(ttm_dma_unpopulate); -@@ -994,8 +1001,6 @@ EXPORT_SYMBOL_GPL(ttm_dma_unpopulate); - * - * XXX: (dchinner) Deadlock warning! - * -- * We need to pass sc->gfp_mask to ttm_dma_page_pool_free(). -- * - * I'm getting sadder as I hear more pathetical whimpers about needing per-pool - * shrinkers - */ -@@ -1028,8 +1033,8 @@ ttm_dma_pool_shrink_scan(struct shrinker *shrink, struct shrink_control *sc) - if (++idx < pool_offset) - continue; - nr_free = shrink_pages; -- shrink_pages = ttm_dma_page_pool_free(p->pool, nr_free, -- sc->gfp_mask); -+ /* OK to use static buffer since global mutex is held. */ -+ shrink_pages = ttm_dma_page_pool_free(p->pool, nr_free, true); - freed += nr_free - shrink_pages; - - pr_debug("%s: (%s:%d) Asked to shrink %d, have %d more to go\n", -diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c b/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c -index 436b013..b65272d 100644 ---- a/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c -+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c -@@ -1049,6 +1049,8 @@ static int vmw_event_fence_action_create(struct drm_file *file_priv, - if (ret != 0) - goto out_no_queue; - -+ return 0; -+ - out_no_queue: - event->base.destroy(&event->base); - out_no_event: -@@ -1124,17 +1126,10 @@ int vmw_fence_event_ioctl(struct drm_device *dev, void *data, - - BUG_ON(fence == NULL); - -- if (arg->flags & DRM_VMW_FE_FLAG_REQ_TIME) -- ret = vmw_event_fence_action_create(file_priv, fence, -- arg->flags, -- arg->user_data, -- true); -- else -- ret = vmw_event_fence_action_create(file_priv, fence, -- arg->flags, -- arg->user_data, -- true); -- -+ ret = vmw_event_fence_action_create(file_priv, fence, -+ arg->flags, -+ arg->user_data, -+ true); - if (unlikely(ret != 0)) { - if (ret != -ERESTARTSYS) - DRM_ERROR("Failed to attach event to fence.\n"); -diff --git a/drivers/infiniband/ulp/isert/ib_isert.c b/drivers/infiniband/ulp/isert/ib_isert.c -index a96cfc3..6014227 100644 ---- a/drivers/infiniband/ulp/isert/ib_isert.c -+++ b/drivers/infiniband/ulp/isert/ib_isert.c -@@ -41,6 +41,7 @@ static DEFINE_MUTEX(device_list_mutex); - static LIST_HEAD(device_list); - static struct workqueue_struct *isert_rx_wq; - static struct workqueue_struct *isert_comp_wq; -+static struct workqueue_struct *isert_release_wq; - - static void - isert_unmap_cmd(struct isert_cmd *isert_cmd, struct isert_conn *isert_conn); -@@ -52,6 +53,11 @@ isert_unreg_rdma(struct isert_cmd *isert_cmd, struct isert_conn *isert_conn); - static int - isert_reg_rdma(struct iscsi_conn *conn, struct iscsi_cmd *cmd, - struct isert_rdma_wr *wr); -+static int -+isert_rdma_post_recvl(struct isert_conn *isert_conn); -+static int -+isert_rdma_accept(struct isert_conn *isert_conn); -+struct rdma_cm_id *isert_setup_id(struct isert_np *isert_np); - - static void - isert_qp_event_callback(struct ib_event *e, void *context) -@@ -132,12 +138,18 @@ isert_conn_setup_qp(struct isert_conn *isert_conn, struct rdma_cm_id *cma_id) - ret = rdma_create_qp(cma_id, isert_conn->conn_pd, &attr); - if (ret) { - pr_err("rdma_create_qp failed for cma_id %d\n", ret); -- return ret; -+ goto err; - } - isert_conn->conn_qp = cma_id->qp; - pr_debug("rdma_create_qp() returned success >>>>>>>>>>>>>>>>>>>>>>>>>.\n"); - - return 0; -+err: -+ mutex_lock(&device_list_mutex); -+ device->cq_active_qps[min_index]--; -+ mutex_unlock(&device_list_mutex); -+ -+ return ret; - } - - static void -@@ -489,8 +501,8 @@ err: - static int - isert_connect_request(struct rdma_cm_id *cma_id, struct rdma_cm_event *event) - { -- struct iscsi_np *np = cma_id->context; -- struct isert_np *isert_np = np->np_context; -+ struct isert_np *isert_np = cma_id->context; -+ struct iscsi_np *np = isert_np->np; - struct isert_conn *isert_conn; - struct isert_device *device; - struct ib_device *ib_dev = cma_id->device; -@@ -515,6 +527,7 @@ isert_connect_request(struct rdma_cm_id *cma_id, struct rdma_cm_event *event) - isert_conn->state = ISER_CONN_INIT; - INIT_LIST_HEAD(&isert_conn->conn_accept_node); - init_completion(&isert_conn->conn_login_comp); -+ init_completion(&isert_conn->login_req_comp); - init_completion(&isert_conn->conn_wait); - init_completion(&isert_conn->conn_wait_comp_err); - kref_init(&isert_conn->conn_kref); -@@ -522,7 +535,6 @@ isert_connect_request(struct rdma_cm_id *cma_id, struct rdma_cm_event *event) - spin_lock_init(&isert_conn->conn_lock); - INIT_LIST_HEAD(&isert_conn->conn_fr_pool); - -- cma_id->context = isert_conn; - isert_conn->conn_cm_id = cma_id; - isert_conn->responder_resources = event->param.conn.responder_resources; - isert_conn->initiator_depth = event->param.conn.initiator_depth; -@@ -596,6 +608,14 @@ isert_connect_request(struct rdma_cm_id *cma_id, struct rdma_cm_event *event) - if (ret) - goto out_conn_dev; - -+ ret = isert_rdma_post_recvl(isert_conn); -+ if (ret) -+ goto out_conn_dev; -+ -+ ret = isert_rdma_accept(isert_conn); -+ if (ret) -+ goto out_conn_dev; -+ - mutex_lock(&isert_np->np_accept_mutex); - list_add_tail(&isert_conn->conn_accept_node, &isert_np->np_accept_list); - mutex_unlock(&isert_np->np_accept_mutex); -@@ -620,6 +640,7 @@ out_login_buf: - kfree(isert_conn->login_buf); - out: - kfree(isert_conn); -+ rdma_reject(cma_id, NULL, 0); - return ret; - } - -@@ -635,18 +656,20 @@ isert_connect_release(struct isert_conn *isert_conn) - if (device && device->use_fastreg) - isert_conn_free_fastreg_pool(isert_conn); - -+ isert_free_rx_descriptors(isert_conn); -+ rdma_destroy_id(isert_conn->conn_cm_id); -+ - if (isert_conn->conn_qp) { - cq_index = ((struct isert_cq_desc *) - isert_conn->conn_qp->recv_cq->cq_context)->cq_index; - pr_debug("isert_connect_release: cq_index: %d\n", cq_index); -+ mutex_lock(&device_list_mutex); - isert_conn->conn_device->cq_active_qps[cq_index]--; -+ mutex_unlock(&device_list_mutex); - -- rdma_destroy_qp(isert_conn->conn_cm_id); -+ ib_destroy_qp(isert_conn->conn_qp); - } - -- isert_free_rx_descriptors(isert_conn); -- rdma_destroy_id(isert_conn->conn_cm_id); -- - ib_dereg_mr(isert_conn->conn_mr); - ib_dealloc_pd(isert_conn->conn_pd); - -@@ -669,9 +692,19 @@ isert_connect_release(struct isert_conn *isert_conn) - static void - isert_connected_handler(struct rdma_cm_id *cma_id) - { -- struct isert_conn *isert_conn = cma_id->context; -+ struct isert_conn *isert_conn = cma_id->qp->qp_context; -+ -+ pr_info("conn %p\n", isert_conn); - -- kref_get(&isert_conn->conn_kref); -+ if (!kref_get_unless_zero(&isert_conn->conn_kref)) { -+ pr_warn("conn %p connect_release is running\n", isert_conn); -+ return; -+ } -+ -+ mutex_lock(&isert_conn->conn_mutex); -+ if (isert_conn->state != ISER_CONN_FULL_FEATURE) -+ isert_conn->state = ISER_CONN_UP; -+ mutex_unlock(&isert_conn->conn_mutex); - } - - static void -@@ -692,65 +725,108 @@ isert_put_conn(struct isert_conn *isert_conn) - kref_put(&isert_conn->conn_kref, isert_release_conn_kref); - } - -+/** -+ * isert_conn_terminate() - Initiate connection termination -+ * @isert_conn: isert connection struct -+ * -+ * Notes: -+ * In case the connection state is FULL_FEATURE, move state -+ * to TEMINATING and start teardown sequence (rdma_disconnect). -+ * In case the connection state is UP, complete flush as well. -+ * -+ * This routine must be called with conn_mutex held. Thus it is -+ * safe to call multiple times. -+ */ - static void --isert_disconnect_work(struct work_struct *work) -+isert_conn_terminate(struct isert_conn *isert_conn) - { -- struct isert_conn *isert_conn = container_of(work, -- struct isert_conn, conn_logout_work); -+ int err; - -- pr_debug("isert_disconnect_work(): >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n"); -- mutex_lock(&isert_conn->conn_mutex); -- if (isert_conn->state == ISER_CONN_UP) -+ switch (isert_conn->state) { -+ case ISER_CONN_TERMINATING: -+ break; -+ case ISER_CONN_UP: -+ /* -+ * No flush completions will occur as we didn't -+ * get to ISER_CONN_FULL_FEATURE yet, complete -+ * to allow teardown progress. -+ */ -+ complete(&isert_conn->conn_wait_comp_err); -+ case ISER_CONN_FULL_FEATURE: /* FALLTHRU */ -+ pr_info("Terminating conn %p state %d\n", -+ isert_conn, isert_conn->state); - isert_conn->state = ISER_CONN_TERMINATING; -- -- if (isert_conn->post_recv_buf_count == 0 && -- atomic_read(&isert_conn->post_send_buf_count) == 0) { -- mutex_unlock(&isert_conn->conn_mutex); -- goto wake_up; -- } -- if (!isert_conn->conn_cm_id) { -- mutex_unlock(&isert_conn->conn_mutex); -- isert_put_conn(isert_conn); -- return; -+ err = rdma_disconnect(isert_conn->conn_cm_id); -+ if (err) -+ pr_warn("Failed rdma_disconnect isert_conn %p\n", -+ isert_conn); -+ break; -+ default: -+ pr_warn("conn %p teminating in state %d\n", -+ isert_conn, isert_conn->state); - } -+} - -- if (isert_conn->disconnect) { -- /* Send DREQ/DREP towards our initiator */ -- rdma_disconnect(isert_conn->conn_cm_id); -- } -+static int -+isert_np_cma_handler(struct isert_np *isert_np, -+ enum rdma_cm_event_type event) -+{ -+ pr_debug("isert np %p, handling event %d\n", isert_np, event); - -- mutex_unlock(&isert_conn->conn_mutex); -+ switch (event) { -+ case RDMA_CM_EVENT_DEVICE_REMOVAL: -+ isert_np->np_cm_id = NULL; -+ break; -+ case RDMA_CM_EVENT_ADDR_CHANGE: -+ isert_np->np_cm_id = isert_setup_id(isert_np); -+ if (IS_ERR(isert_np->np_cm_id)) { -+ pr_err("isert np %p setup id failed: %ld\n", -+ isert_np, PTR_ERR(isert_np->np_cm_id)); -+ isert_np->np_cm_id = NULL; -+ } -+ break; -+ default: -+ pr_err("isert np %p Unexpected event %d\n", -+ isert_np, event); -+ } - --wake_up: -- complete(&isert_conn->conn_wait); -+ return -1; - } - - static int --isert_disconnected_handler(struct rdma_cm_id *cma_id, bool disconnect) -+isert_disconnected_handler(struct rdma_cm_id *cma_id, -+ enum rdma_cm_event_type event) - { -+ struct isert_np *isert_np = cma_id->context; - struct isert_conn *isert_conn; - -- if (!cma_id->qp) { -- struct isert_np *isert_np = cma_id->context; -+ if (isert_np->np_cm_id == cma_id) -+ return isert_np_cma_handler(cma_id->context, event); - -- isert_np->np_cm_id = NULL; -- return -1; -- } -+ isert_conn = cma_id->qp->qp_context; - -- isert_conn = (struct isert_conn *)cma_id->context; -+ mutex_lock(&isert_conn->conn_mutex); -+ isert_conn_terminate(isert_conn); -+ mutex_unlock(&isert_conn->conn_mutex); - -- isert_conn->disconnect = disconnect; -- INIT_WORK(&isert_conn->conn_logout_work, isert_disconnect_work); -- schedule_work(&isert_conn->conn_logout_work); -+ pr_info("conn %p completing conn_wait\n", isert_conn); -+ complete(&isert_conn->conn_wait); - - return 0; - } - -+static void -+isert_connect_error(struct rdma_cm_id *cma_id) -+{ -+ struct isert_conn *isert_conn = cma_id->qp->qp_context; -+ -+ isert_put_conn(isert_conn); -+} -+ - static int - isert_cma_handler(struct rdma_cm_id *cma_id, struct rdma_cm_event *event) - { - int ret = 0; -- bool disconnect = false; - - pr_debug("isert_cma_handler: event %d status %d conn %p id %p\n", - event->event, event->status, cma_id->context, cma_id); -@@ -768,11 +844,14 @@ isert_cma_handler(struct rdma_cm_id *cma_id, struct rdma_cm_event *event) - case RDMA_CM_EVENT_ADDR_CHANGE: /* FALLTHRU */ - case RDMA_CM_EVENT_DISCONNECTED: /* FALLTHRU */ - case RDMA_CM_EVENT_DEVICE_REMOVAL: /* FALLTHRU */ -- disconnect = true; - case RDMA_CM_EVENT_TIMEWAIT_EXIT: /* FALLTHRU */ -- ret = isert_disconnected_handler(cma_id, disconnect); -+ ret = isert_disconnected_handler(cma_id, event->event); - break; -+ case RDMA_CM_EVENT_REJECTED: /* FALLTHRU */ -+ case RDMA_CM_EVENT_UNREACHABLE: /* FALLTHRU */ - case RDMA_CM_EVENT_CONNECT_ERROR: -+ isert_connect_error(cma_id); -+ break; - default: - pr_err("Unhandled RDMA CMA event: %d\n", event->event); - break; -@@ -906,7 +985,7 @@ isert_init_send_wr(struct isert_conn *isert_conn, struct isert_cmd *isert_cmd, - * bit for every ISERT_COMP_BATCH_COUNT number of ib_post_send() calls. - */ - mutex_lock(&isert_conn->conn_mutex); -- if (coalesce && isert_conn->state == ISER_CONN_UP && -+ if (coalesce && isert_conn->state == ISER_CONN_FULL_FEATURE && - ++isert_conn->conn_comp_batch < ISERT_COMP_BATCH_COUNT) { - tx_desc->llnode_active = true; - llist_add(&tx_desc->comp_llnode, &isert_conn->conn_comp_llist); -@@ -1003,7 +1082,10 @@ isert_put_login_tx(struct iscsi_conn *conn, struct iscsi_login *login, - if (ret) - return ret; - -- isert_conn->state = ISER_CONN_UP; -+ /* Now we are in FULL_FEATURE phase */ -+ mutex_lock(&isert_conn->conn_mutex); -+ isert_conn->state = ISER_CONN_FULL_FEATURE; -+ mutex_unlock(&isert_conn->conn_mutex); - goto post_send; - } - -@@ -1020,18 +1102,17 @@ post_send: - } - - static void --isert_rx_login_req(struct iser_rx_desc *rx_desc, int rx_buflen, -- struct isert_conn *isert_conn) -+isert_rx_login_req(struct isert_conn *isert_conn) - { -+ struct iser_rx_desc *rx_desc = (void *)isert_conn->login_req_buf; -+ int rx_buflen = isert_conn->login_req_len; - struct iscsi_conn *conn = isert_conn->conn; - struct iscsi_login *login = conn->conn_login; - int size; - -- if (!login) { -- pr_err("conn->conn_login is NULL\n"); -- dump_stack(); -- return; -- } -+ pr_info("conn %p\n", isert_conn); -+ -+ WARN_ON_ONCE(!login); - - if (login->first_request) { - struct iscsi_login_req *login_req = -@@ -1394,11 +1475,20 @@ isert_rx_completion(struct iser_rx_desc *desc, struct isert_conn *isert_conn, - hdr->opcode, hdr->itt, hdr->flags, - (int)(xfer_len - ISER_HEADERS_LEN)); - -- if ((char *)desc == isert_conn->login_req_buf) -- isert_rx_login_req(desc, xfer_len - ISER_HEADERS_LEN, -- isert_conn); -- else -+ if ((char *)desc == isert_conn->login_req_buf) { -+ isert_conn->login_req_len = xfer_len - ISER_HEADERS_LEN; -+ if (isert_conn->conn) { -+ struct iscsi_login *login = isert_conn->conn->conn_login; -+ -+ if (login && !login->first_request) -+ isert_rx_login_req(isert_conn); -+ } -+ mutex_lock(&isert_conn->conn_mutex); -+ complete(&isert_conn->login_req_comp); -+ mutex_unlock(&isert_conn->conn_mutex); -+ } else { - isert_rx_do_work(desc, isert_conn); -+ } - - ib_dma_sync_single_for_device(ib_dev, rx_dma, rx_buflen, - DMA_FROM_DEVICE); -@@ -1799,7 +1889,7 @@ isert_cq_rx_comp_err(struct isert_conn *isert_conn) - msleep(3000); - - mutex_lock(&isert_conn->conn_mutex); -- isert_conn->state = ISER_CONN_DOWN; -+ isert_conn_terminate(isert_conn); - mutex_unlock(&isert_conn->conn_mutex); - - iscsit_cause_connection_reinstatement(isert_conn->conn, 0); -@@ -2579,13 +2669,51 @@ isert_response_queue(struct iscsi_conn *conn, struct iscsi_cmd *cmd, int state) - return ret; - } - -+struct rdma_cm_id * -+isert_setup_id(struct isert_np *isert_np) -+{ -+ struct iscsi_np *np = isert_np->np; -+ struct rdma_cm_id *id; -+ struct sockaddr *sa; -+ int ret; -+ -+ sa = (struct sockaddr *)&np->np_sockaddr; -+ pr_debug("ksockaddr: %p, sa: %p\n", &np->np_sockaddr, sa); -+ -+ id = rdma_create_id(isert_cma_handler, isert_np, -+ RDMA_PS_TCP, IB_QPT_RC); -+ if (IS_ERR(id)) { -+ pr_err("rdma_create_id() failed: %ld\n", PTR_ERR(id)); -+ ret = PTR_ERR(id); -+ goto out; -+ } -+ pr_debug("id %p context %p\n", id, id->context); -+ -+ ret = rdma_bind_addr(id, sa); -+ if (ret) { -+ pr_err("rdma_bind_addr() failed: %d\n", ret); -+ goto out_id; -+ } -+ -+ ret = rdma_listen(id, ISERT_RDMA_LISTEN_BACKLOG); -+ if (ret) { -+ pr_err("rdma_listen() failed: %d\n", ret); -+ goto out_id; -+ } -+ -+ return id; -+out_id: -+ rdma_destroy_id(id); -+out: -+ return ERR_PTR(ret); -+} -+ - static int - isert_setup_np(struct iscsi_np *np, - struct __kernel_sockaddr_storage *ksockaddr) - { - struct isert_np *isert_np; - struct rdma_cm_id *isert_lid; -- struct sockaddr *sa; - int ret; - - isert_np = kzalloc(sizeof(struct isert_np), GFP_KERNEL); -@@ -2597,9 +2725,8 @@ isert_setup_np(struct iscsi_np *np, - mutex_init(&isert_np->np_accept_mutex); - INIT_LIST_HEAD(&isert_np->np_accept_list); - init_completion(&isert_np->np_login_comp); -+ isert_np->np = np; - -- sa = (struct sockaddr *)ksockaddr; -- pr_debug("ksockaddr: %p, sa: %p\n", ksockaddr, sa); - /* - * Setup the np->np_sockaddr from the passed sockaddr setup - * in iscsi_target_configfs.c code.. -@@ -2607,37 +2734,20 @@ isert_setup_np(struct iscsi_np *np, - memcpy(&np->np_sockaddr, ksockaddr, - sizeof(struct __kernel_sockaddr_storage)); - -- isert_lid = rdma_create_id(isert_cma_handler, np, RDMA_PS_TCP, -- IB_QPT_RC); -+ isert_lid = isert_setup_id(isert_np); - if (IS_ERR(isert_lid)) { -- pr_err("rdma_create_id() for isert_listen_handler failed: %ld\n", -- PTR_ERR(isert_lid)); - ret = PTR_ERR(isert_lid); - goto out; - } - -- ret = rdma_bind_addr(isert_lid, sa); -- if (ret) { -- pr_err("rdma_bind_addr() for isert_lid failed: %d\n", ret); -- goto out_lid; -- } -- -- ret = rdma_listen(isert_lid, ISERT_RDMA_LISTEN_BACKLOG); -- if (ret) { -- pr_err("rdma_listen() for isert_lid failed: %d\n", ret); -- goto out_lid; -- } -- - isert_np->np_cm_id = isert_lid; - np->np_context = isert_np; -- pr_debug("Setup isert_lid->context: %p\n", isert_lid->context); - - return 0; - --out_lid: -- rdma_destroy_id(isert_lid); - out: - kfree(isert_np); -+ - return ret; - } - -@@ -2673,7 +2783,15 @@ isert_get_login_rx(struct iscsi_conn *conn, struct iscsi_login *login) - struct isert_conn *isert_conn = (struct isert_conn *)conn->context; - int ret; - -- pr_debug("isert_get_login_rx before conn_login_comp conn: %p\n", conn); -+ pr_info("before login_req comp conn: %p\n", isert_conn); -+ ret = wait_for_completion_interruptible(&isert_conn->login_req_comp); -+ if (ret) { -+ pr_err("isert_conn %p interrupted before got login req\n", -+ isert_conn); -+ return ret; -+ } -+ reinit_completion(&isert_conn->login_req_comp); -+ - /* - * For login requests after the first PDU, isert_rx_login_req() will - * kick schedule_delayed_work(&conn->login_work) as the packet is -@@ -2683,11 +2801,15 @@ isert_get_login_rx(struct iscsi_conn *conn, struct iscsi_login *login) - if (!login->first_request) - return 0; - -+ isert_rx_login_req(isert_conn); -+ -+ pr_info("before conn_login_comp conn: %p\n", conn); - ret = wait_for_completion_interruptible(&isert_conn->conn_login_comp); - if (ret) - return ret; - -- pr_debug("isert_get_login_rx processing login->req: %p\n", login->req); -+ pr_info("processing login->req: %p\n", login->req); -+ - return 0; - } - -@@ -2765,17 +2887,10 @@ accept_wait: - isert_conn->conn = conn; - max_accept = 0; - -- ret = isert_rdma_post_recvl(isert_conn); -- if (ret) -- return ret; -- -- ret = isert_rdma_accept(isert_conn); -- if (ret) -- return ret; -- - isert_set_conn_info(np, conn, isert_conn); - -- pr_debug("Processing isert_accept_np: isert_conn: %p\n", isert_conn); -+ pr_debug("Processing isert_conn: %p\n", isert_conn); -+ - return 0; - } - -@@ -2791,6 +2906,24 @@ isert_free_np(struct iscsi_np *np) - kfree(isert_np); - } - -+static void isert_release_work(struct work_struct *work) -+{ -+ struct isert_conn *isert_conn = container_of(work, -+ struct isert_conn, -+ release_work); -+ -+ pr_info("Starting release conn %p\n", isert_conn); -+ -+ wait_for_completion(&isert_conn->conn_wait); -+ -+ mutex_lock(&isert_conn->conn_mutex); -+ isert_conn->state = ISER_CONN_DOWN; -+ mutex_unlock(&isert_conn->conn_mutex); -+ -+ pr_info("Destroying conn %p\n", isert_conn); -+ isert_put_conn(isert_conn); -+} -+ - static void isert_wait_conn(struct iscsi_conn *conn) - { - struct isert_conn *isert_conn = conn->context; -@@ -2798,10 +2931,6 @@ static void isert_wait_conn(struct iscsi_conn *conn) - pr_debug("isert_wait_conn: Starting \n"); - - mutex_lock(&isert_conn->conn_mutex); -- if (isert_conn->conn_cm_id) { -- pr_debug("Calling rdma_disconnect from isert_wait_conn\n"); -- rdma_disconnect(isert_conn->conn_cm_id); -- } - /* - * Only wait for conn_wait_comp_err if the isert_conn made it - * into full feature phase.. -@@ -2810,14 +2939,13 @@ static void isert_wait_conn(struct iscsi_conn *conn) - mutex_unlock(&isert_conn->conn_mutex); - return; - } -- if (isert_conn->state == ISER_CONN_UP) -- isert_conn->state = ISER_CONN_TERMINATING; -+ isert_conn_terminate(isert_conn); - mutex_unlock(&isert_conn->conn_mutex); - - wait_for_completion(&isert_conn->conn_wait_comp_err); - -- wait_for_completion(&isert_conn->conn_wait); -- isert_put_conn(isert_conn); -+ INIT_WORK(&isert_conn->release_work, isert_release_work); -+ queue_work(isert_release_wq, &isert_conn->release_work); - } - - static void isert_free_conn(struct iscsi_conn *conn) -@@ -2863,10 +2991,21 @@ static int __init isert_init(void) - goto destroy_rx_wq; - } - -+ isert_release_wq = alloc_workqueue("isert_release_wq", WQ_UNBOUND, -+ WQ_UNBOUND_MAX_ACTIVE); -+ if (!isert_release_wq) { -+ pr_err("Unable to allocate isert_release_wq\n"); -+ ret = -ENOMEM; -+ goto destroy_comp_wq; -+ } -+ - iscsit_register_transport(&iser_target_transport); -- pr_debug("iSER_TARGET[0] - Loaded iser_target_transport\n"); -+ pr_info("iSER_TARGET[0] - Loaded iser_target_transport\n"); -+ - return 0; - -+destroy_comp_wq: -+ destroy_workqueue(isert_comp_wq); - destroy_rx_wq: - destroy_workqueue(isert_rx_wq); - return ret; -@@ -2875,6 +3014,7 @@ destroy_rx_wq: - static void __exit isert_exit(void) - { - flush_scheduled_work(); -+ destroy_workqueue(isert_release_wq); - destroy_workqueue(isert_comp_wq); - destroy_workqueue(isert_rx_wq); - iscsit_unregister_transport(&iser_target_transport); -diff --git a/drivers/infiniband/ulp/isert/ib_isert.h b/drivers/infiniband/ulp/isert/ib_isert.h -index cbecaab..1178c5b 100644 ---- a/drivers/infiniband/ulp/isert/ib_isert.h -+++ b/drivers/infiniband/ulp/isert/ib_isert.h -@@ -23,6 +23,7 @@ enum iser_ib_op_code { - enum iser_conn_state { - ISER_CONN_INIT, - ISER_CONN_UP, -+ ISER_CONN_FULL_FEATURE, - ISER_CONN_TERMINATING, - ISER_CONN_DOWN, - }; -@@ -102,6 +103,7 @@ struct isert_conn { - char *login_req_buf; - char *login_rsp_buf; - u64 login_req_dma; -+ int login_req_len; - u64 login_rsp_dma; - unsigned int conn_rx_desc_head; - struct iser_rx_desc *conn_rx_descs; -@@ -109,13 +111,13 @@ struct isert_conn { - struct iscsi_conn *conn; - struct list_head conn_accept_node; - struct completion conn_login_comp; -+ struct completion login_req_comp; - struct iser_tx_desc conn_login_tx_desc; - struct rdma_cm_id *conn_cm_id; - struct ib_pd *conn_pd; - struct ib_mr *conn_mr; - struct ib_qp *conn_qp; - struct isert_device *conn_device; -- struct work_struct conn_logout_work; - struct mutex conn_mutex; - struct completion conn_wait; - struct completion conn_wait_comp_err; -@@ -124,10 +126,10 @@ struct isert_conn { - int conn_fr_pool_size; - /* lock to protect fastreg pool */ - spinlock_t conn_lock; -+ struct work_struct release_work; - #define ISERT_COMP_BATCH_COUNT 8 - int conn_comp_batch; - struct llist_head conn_comp_llist; -- bool disconnect; - }; - - #define ISERT_MAX_CQ 64 -@@ -158,6 +160,7 @@ struct isert_device { - }; - - struct isert_np { -+ struct iscsi_np *np; - struct semaphore np_sem; - struct rdma_cm_id *np_cm_id; - struct mutex np_accept_mutex; -diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h -index 8fca488f..c43c46f 100644 ---- a/drivers/input/serio/i8042-x86ia64io.h -+++ b/drivers/input/serio/i8042-x86ia64io.h -@@ -408,6 +408,13 @@ static const struct dmi_system_id __initconst i8042_dmi_nomux_table[] = { - }, - }, - { -+ /* Acer Aspire 7738 */ -+ .matches = { -+ DMI_MATCH(DMI_SYS_VENDOR, "Acer"), -+ DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 7738"), -+ }, -+ }, -+ { - /* Gericom Bellagio */ - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "Gericom"), -@@ -721,6 +728,35 @@ static const struct dmi_system_id __initconst i8042_dmi_dritek_table[] = { - { } - }; - -+/* -+ * Some laptops need keyboard reset before probing for the trackpad to get -+ * it detected, initialised & finally work. -+ */ -+static const struct dmi_system_id __initconst i8042_dmi_kbdreset_table[] = { -+ { -+ /* Gigabyte P35 v2 - Elantech touchpad */ -+ .matches = { -+ DMI_MATCH(DMI_SYS_VENDOR, "GIGABYTE"), -+ DMI_MATCH(DMI_PRODUCT_NAME, "P35V2"), -+ }, -+ }, -+ { -+ /* Aorus branded Gigabyte X3 Plus - Elantech touchpad */ -+ .matches = { -+ DMI_MATCH(DMI_SYS_VENDOR, "GIGABYTE"), -+ DMI_MATCH(DMI_PRODUCT_NAME, "X3"), -+ }, -+ }, -+ { -+ /* Gigabyte P34 - Elantech touchpad */ -+ .matches = { -+ DMI_MATCH(DMI_SYS_VENDOR, "GIGABYTE"), -+ DMI_MATCH(DMI_PRODUCT_NAME, "P34"), -+ }, -+ }, -+ { } -+}; -+ - #endif /* CONFIG_X86 */ - - #ifdef CONFIG_PNP -@@ -1016,6 +1052,9 @@ static int __init i8042_platform_init(void) - if (dmi_check_system(i8042_dmi_dritek_table)) - i8042_dritek = true; - -+ if (dmi_check_system(i8042_dmi_kbdreset_table)) -+ i8042_kbdreset = true; -+ - /* - * A20 was already enabled during early kernel init. But some buggy - * BIOSes (in MSI Laptops) require A20 to be enabled using 8042 to -diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c -index 3807c3e..eb796ff 100644 ---- a/drivers/input/serio/i8042.c -+++ b/drivers/input/serio/i8042.c -@@ -67,6 +67,10 @@ static bool i8042_notimeout; - module_param_named(notimeout, i8042_notimeout, bool, 0); - MODULE_PARM_DESC(notimeout, "Ignore timeouts signalled by i8042"); - -+static bool i8042_kbdreset; -+module_param_named(kbdreset, i8042_kbdreset, bool, 0); -+MODULE_PARM_DESC(kbdreset, "Reset device connected to KBD port"); -+ - #ifdef CONFIG_X86 - static bool i8042_dritek; - module_param_named(dritek, i8042_dritek, bool, 0); -@@ -790,6 +794,16 @@ static int __init i8042_check_aux(void) - return -1; - - /* -+ * Reset keyboard (needed on some laptops to successfully detect -+ * touchpad, e.g., some Gigabyte laptop models with Elantech -+ * touchpads). -+ */ -+ if (i8042_kbdreset) { -+ pr_warn("Attempting to reset device connected to KBD port\n"); -+ i8042_kbd_write(NULL, (unsigned char) 0xff); -+ } -+ -+/* - * Test AUX IRQ delivery to make sure BIOS did not grab the IRQ and - * used it for a PCI card or somethig else. - */ -diff --git a/drivers/md/bcache/btree.c b/drivers/md/bcache/btree.c -index 5f9c2a6..fbcb622 100644 ---- a/drivers/md/bcache/btree.c -+++ b/drivers/md/bcache/btree.c -@@ -199,7 +199,7 @@ void bch_btree_node_read_done(struct btree *b) - struct bset *i = btree_bset_first(b); - struct btree_iter *iter; - -- iter = mempool_alloc(b->c->fill_iter, GFP_NOWAIT); -+ iter = mempool_alloc(b->c->fill_iter, GFP_NOIO); - iter->size = b->c->sb.bucket_size / b->c->sb.block_size; - iter->used = 0; - -diff --git a/drivers/media/i2c/smiapp-pll.c b/drivers/media/i2c/smiapp-pll.c -index 2335529..ab5d9a3 100644 ---- a/drivers/media/i2c/smiapp-pll.c -+++ b/drivers/media/i2c/smiapp-pll.c -@@ -67,7 +67,7 @@ static void print_pll(struct device *dev, struct smiapp_pll *pll) - { - dev_dbg(dev, "pre_pll_clk_div\t%d\n", pll->pre_pll_clk_div); - dev_dbg(dev, "pll_multiplier \t%d\n", pll->pll_multiplier); -- if (pll->flags != SMIAPP_PLL_FLAG_NO_OP_CLOCKS) { -+ if (!(pll->flags & SMIAPP_PLL_FLAG_NO_OP_CLOCKS)) { - dev_dbg(dev, "op_sys_clk_div \t%d\n", pll->op_sys_clk_div); - dev_dbg(dev, "op_pix_clk_div \t%d\n", pll->op_pix_clk_div); - } -@@ -77,7 +77,7 @@ static void print_pll(struct device *dev, struct smiapp_pll *pll) - dev_dbg(dev, "ext_clk_freq_hz \t%d\n", pll->ext_clk_freq_hz); - dev_dbg(dev, "pll_ip_clk_freq_hz \t%d\n", pll->pll_ip_clk_freq_hz); - dev_dbg(dev, "pll_op_clk_freq_hz \t%d\n", pll->pll_op_clk_freq_hz); -- if (pll->flags & SMIAPP_PLL_FLAG_NO_OP_CLOCKS) { -+ if (!(pll->flags & SMIAPP_PLL_FLAG_NO_OP_CLOCKS)) { - dev_dbg(dev, "op_sys_clk_freq_hz \t%d\n", - pll->op_sys_clk_freq_hz); - dev_dbg(dev, "op_pix_clk_freq_hz \t%d\n", -diff --git a/drivers/media/i2c/smiapp/smiapp-core.c b/drivers/media/i2c/smiapp/smiapp-core.c -index 7026ab0..873d062 100644 ---- a/drivers/media/i2c/smiapp/smiapp-core.c -+++ b/drivers/media/i2c/smiapp/smiapp-core.c -@@ -2624,7 +2624,9 @@ static int smiapp_registered(struct v4l2_subdev *subdev) - pll->flags |= SMIAPP_PLL_FLAG_OP_PIX_CLOCK_PER_LANE; - pll->scale_n = sensor->limits[SMIAPP_LIMIT_SCALER_N_MIN]; - -+ mutex_lock(&sensor->mutex); - rval = smiapp_update_mode(sensor); -+ mutex_unlock(&sensor->mutex); - if (rval) { - dev_err(&client->dev, "update mode failed\n"); - goto out_nvm_release; -diff --git a/drivers/media/usb/au0828/au0828-cards.c b/drivers/media/usb/au0828/au0828-cards.c -index dd32dec..1d4b110 100644 ---- a/drivers/media/usb/au0828/au0828-cards.c -+++ b/drivers/media/usb/au0828/au0828-cards.c -@@ -36,6 +36,11 @@ static void hvr950q_cs5340_audio(void *priv, int enable) - au0828_clear(dev, REG_000, 0x10); - } - -+/* -+ * WARNING: There's a quirks table at sound/usb/quirks-table.h -+ * that should also be updated every time a new device with V4L2 support -+ * is added here. -+ */ - struct au0828_board au0828_boards[] = { - [AU0828_BOARD_UNKNOWN] = { - .name = "Unknown board", -diff --git a/drivers/media/usb/dvb-usb/af9005.c b/drivers/media/usb/dvb-usb/af9005.c -index af176b6..e6d3561 100644 ---- a/drivers/media/usb/dvb-usb/af9005.c -+++ b/drivers/media/usb/dvb-usb/af9005.c -@@ -1081,9 +1081,12 @@ static int __init af9005_usb_module_init(void) - err("usb_register failed. (%d)", result); - return result; - } -+#if IS_MODULE(CONFIG_DVB_USB_AF9005) || defined(CONFIG_DVB_USB_AF9005_REMOTE) -+ /* FIXME: convert to todays kernel IR infrastructure */ - rc_decode = symbol_request(af9005_rc_decode); - rc_keys = symbol_request(rc_map_af9005_table); - rc_keys_size = symbol_request(rc_map_af9005_table_size); -+#endif - if (rc_decode == NULL || rc_keys == NULL || rc_keys_size == NULL) { - err("af9005_rc_decode function not found, disabling remote"); - af9005_properties.rc.legacy.rc_query = NULL; -diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c -index 753ad4c..4531441 100644 ---- a/drivers/media/usb/uvc/uvc_driver.c -+++ b/drivers/media/usb/uvc/uvc_driver.c -@@ -1603,12 +1603,12 @@ static void uvc_delete(struct uvc_device *dev) - { - struct list_head *p, *n; - -- usb_put_intf(dev->intf); -- usb_put_dev(dev->udev); -- - uvc_status_cleanup(dev); - uvc_ctrl_cleanup_device(dev); - -+ usb_put_intf(dev->intf); -+ usb_put_dev(dev->udev); -+ - if (dev->vdev.dev) - v4l2_device_unregister(&dev->vdev); - #ifdef CONFIG_MEDIA_CONTROLLER -diff --git a/drivers/net/can/usb/kvaser_usb.c b/drivers/net/can/usb/kvaser_usb.c -index e77d110..4e65b35 100644 ---- a/drivers/net/can/usb/kvaser_usb.c -+++ b/drivers/net/can/usb/kvaser_usb.c -@@ -1237,6 +1237,9 @@ static int kvaser_usb_close(struct net_device *netdev) - if (err) - netdev_warn(netdev, "Cannot stop device, error %d\n", err); - -+ /* reset tx contexts */ -+ kvaser_usb_unlink_tx_urbs(priv); -+ - priv->can.state = CAN_STATE_STOPPED; - close_candev(priv->netdev); - -@@ -1285,12 +1288,14 @@ static netdev_tx_t kvaser_usb_start_xmit(struct sk_buff *skb, - if (!urb) { - netdev_err(netdev, "No memory left for URBs\n"); - stats->tx_dropped++; -- goto nourbmem; -+ dev_kfree_skb(skb); -+ return NETDEV_TX_OK; - } - - buf = kmalloc(sizeof(struct kvaser_msg), GFP_ATOMIC); - if (!buf) { - stats->tx_dropped++; -+ dev_kfree_skb(skb); - goto nobufmem; - } - -@@ -1325,6 +1330,7 @@ static netdev_tx_t kvaser_usb_start_xmit(struct sk_buff *skb, - } - } - -+ /* This should never happen; it implies a flow control bug */ - if (!context) { - netdev_warn(netdev, "cannot find free context\n"); - ret = NETDEV_TX_BUSY; -@@ -1355,9 +1361,6 @@ static netdev_tx_t kvaser_usb_start_xmit(struct sk_buff *skb, - if (unlikely(err)) { - can_free_echo_skb(netdev, context->echo_index); - -- skb = NULL; /* set to NULL to avoid double free in -- * dev_kfree_skb(skb) */ -- - atomic_dec(&priv->active_tx_urbs); - usb_unanchor_urb(urb); - -@@ -1379,8 +1382,6 @@ releasebuf: - kfree(buf); - nobufmem: - usb_free_urb(urb); --nourbmem: -- dev_kfree_skb(skb); - return ret; - } - -@@ -1492,6 +1493,10 @@ static int kvaser_usb_init_one(struct usb_interface *intf, - struct kvaser_usb_net_priv *priv; - int i, err; - -+ err = kvaser_usb_send_simple_msg(dev, CMD_RESET_CHIP, channel); -+ if (err) -+ return err; -+ - netdev = alloc_candev(sizeof(*priv), MAX_TX_URBS); - if (!netdev) { - dev_err(&intf->dev, "Cannot alloc candev\n"); -@@ -1595,9 +1600,6 @@ static int kvaser_usb_probe(struct usb_interface *intf, - - usb_set_intfdata(intf, dev); - -- for (i = 0; i < MAX_NET_DEVICES; i++) -- kvaser_usb_send_simple_msg(dev, CMD_RESET_CHIP, i); -- - err = kvaser_usb_get_software_info(dev); - if (err) { - dev_err(&intf->dev, -diff --git a/drivers/net/ethernet/atheros/alx/main.c b/drivers/net/ethernet/atheros/alx/main.c -index 380d249..3e1d7d2 100644 ---- a/drivers/net/ethernet/atheros/alx/main.c -+++ b/drivers/net/ethernet/atheros/alx/main.c -@@ -184,15 +184,16 @@ static void alx_schedule_reset(struct alx_priv *alx) - schedule_work(&alx->reset_wk); - } - --static bool alx_clean_rx_irq(struct alx_priv *alx, int budget) -+static int alx_clean_rx_irq(struct alx_priv *alx, int budget) - { - struct alx_rx_queue *rxq = &alx->rxq; - struct alx_rrd *rrd; - struct alx_buffer *rxb; - struct sk_buff *skb; - u16 length, rfd_cleaned = 0; -+ int work = 0; - -- while (budget > 0) { -+ while (work < budget) { - rrd = &rxq->rrd[rxq->rrd_read_idx]; - if (!(rrd->word3 & cpu_to_le32(1 << RRD_UPDATED_SHIFT))) - break; -@@ -203,7 +204,7 @@ static bool alx_clean_rx_irq(struct alx_priv *alx, int budget) - ALX_GET_FIELD(le32_to_cpu(rrd->word0), - RRD_NOR) != 1) { - alx_schedule_reset(alx); -- return 0; -+ return work; - } - - rxb = &rxq->bufs[rxq->read_idx]; -@@ -243,7 +244,7 @@ static bool alx_clean_rx_irq(struct alx_priv *alx, int budget) - } - - napi_gro_receive(&alx->napi, skb); -- budget--; -+ work++; - - next_pkt: - if (++rxq->read_idx == alx->rx_ringsz) -@@ -258,21 +259,22 @@ next_pkt: - if (rfd_cleaned) - alx_refill_rx_ring(alx, GFP_ATOMIC); - -- return budget > 0; -+ return work; - } - - static int alx_poll(struct napi_struct *napi, int budget) - { - struct alx_priv *alx = container_of(napi, struct alx_priv, napi); - struct alx_hw *hw = &alx->hw; -- bool complete = true; - unsigned long flags; -+ bool tx_complete; -+ int work; - -- complete = alx_clean_tx_irq(alx) && -- alx_clean_rx_irq(alx, budget); -+ tx_complete = alx_clean_tx_irq(alx); -+ work = alx_clean_rx_irq(alx, budget); - -- if (!complete) -- return 1; -+ if (!tx_complete || work == budget) -+ return budget; - - napi_complete(&alx->napi); - -@@ -284,7 +286,7 @@ static int alx_poll(struct napi_struct *napi, int budget) - - alx_post_write(hw); - -- return 0; -+ return work; - } - - static irqreturn_t alx_intr_handle(struct alx_priv *alx, u32 intr) -diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c -index 086eac5..8206113 100644 ---- a/drivers/net/ethernet/broadcom/tg3.c -+++ b/drivers/net/ethernet/broadcom/tg3.c -@@ -17731,23 +17731,6 @@ static int tg3_init_one(struct pci_dev *pdev, - goto err_out_apeunmap; - } - -- /* -- * Reset chip in case UNDI or EFI driver did not shutdown -- * DMA self test will enable WDMAC and we'll see (spurious) -- * pending DMA on the PCI bus at that point. -- */ -- if ((tr32(HOSTCC_MODE) & HOSTCC_MODE_ENABLE) || -- (tr32(WDMAC_MODE) & WDMAC_MODE_ENABLE)) { -- tw32(MEMARB_MODE, MEMARB_MODE_ENABLE); -- tg3_halt(tp, RESET_KIND_SHUTDOWN, 1); -- } -- -- err = tg3_test_dma(tp); -- if (err) { -- dev_err(&pdev->dev, "DMA engine test failed, aborting\n"); -- goto err_out_apeunmap; -- } -- - intmbx = MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW; - rcvmbx = MAILBOX_RCVRET_CON_IDX_0 + TG3_64BIT_REG_LOW; - sndmbx = MAILBOX_SNDHOST_PROD_IDX_0 + TG3_64BIT_REG_LOW; -@@ -17792,6 +17775,23 @@ static int tg3_init_one(struct pci_dev *pdev, - sndmbx += 0xc; - } - -+ /* -+ * Reset chip in case UNDI or EFI driver did not shutdown -+ * DMA self test will enable WDMAC and we'll see (spurious) -+ * pending DMA on the PCI bus at that point. -+ */ -+ if ((tr32(HOSTCC_MODE) & HOSTCC_MODE_ENABLE) || -+ (tr32(WDMAC_MODE) & WDMAC_MODE_ENABLE)) { -+ tw32(MEMARB_MODE, MEMARB_MODE_ENABLE); -+ tg3_halt(tp, RESET_KIND_SHUTDOWN, 1); -+ } -+ -+ err = tg3_test_dma(tp); -+ if (err) { -+ dev_err(&pdev->dev, "DMA engine test failed, aborting\n"); -+ goto err_out_apeunmap; -+ } -+ - tg3_init_coal(tp); - - pci_set_drvdata(pdev, dev); -diff --git a/drivers/net/ethernet/cisco/enic/enic_main.c b/drivers/net/ethernet/cisco/enic/enic_main.c -index b740bfc..ff9b423 100644 ---- a/drivers/net/ethernet/cisco/enic/enic_main.c -+++ b/drivers/net/ethernet/cisco/enic/enic_main.c -@@ -1044,10 +1044,14 @@ static void enic_rq_indicate_buf(struct vnic_rq *rq, - PKT_HASH_TYPE_L4 : PKT_HASH_TYPE_L3); - } - -- if ((netdev->features & NETIF_F_RXCSUM) && !csum_not_calc) { -- skb->csum = htons(checksum); -- skb->ip_summed = CHECKSUM_COMPLETE; -- } -+ /* Hardware does not provide whole packet checksum. It only -+ * provides pseudo checksum. Since hw validates the packet -+ * checksum but not provide us the checksum value. use -+ * CHECSUM_UNNECESSARY. -+ */ -+ if ((netdev->features & NETIF_F_RXCSUM) && tcp_udp_csum_ok && -+ ipv4_csum_ok) -+ skb->ip_summed = CHECKSUM_UNNECESSARY; - - if (vlan_stripped) - __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vlan_tci); -diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c -index 921b9df..316650c 100644 ---- a/drivers/net/ethernet/ti/cpsw.c -+++ b/drivers/net/ethernet/ti/cpsw.c -@@ -596,7 +596,7 @@ static void cpsw_set_promiscious(struct net_device *ndev, bool enable) - - /* Clear all mcast from ALE */ - cpsw_ale_flush_multicast(ale, ALE_ALL_PORTS << -- priv->host_port); -+ priv->host_port, -1); - - /* Flood All Unicast Packets to Host port */ - cpsw_ale_control_set(ale, 0, ALE_P0_UNI_FLOOD, 1); -@@ -620,6 +620,12 @@ static void cpsw_set_promiscious(struct net_device *ndev, bool enable) - static void cpsw_ndo_set_rx_mode(struct net_device *ndev) - { - struct cpsw_priv *priv = netdev_priv(ndev); -+ int vid; -+ -+ if (priv->data.dual_emac) -+ vid = priv->slaves[priv->emac_port].port_vlan; -+ else -+ vid = priv->data.default_vlan; - - if (ndev->flags & IFF_PROMISC) { - /* Enable promiscuous mode */ -@@ -631,7 +637,8 @@ static void cpsw_ndo_set_rx_mode(struct net_device *ndev) - } - - /* Clear all mcast from ALE */ -- cpsw_ale_flush_multicast(priv->ale, ALE_ALL_PORTS << priv->host_port); -+ cpsw_ale_flush_multicast(priv->ale, ALE_ALL_PORTS << priv->host_port, -+ vid); - - if (!netdev_mc_empty(ndev)) { - struct netdev_hw_addr *ha; -@@ -716,6 +723,14 @@ static void cpsw_rx_handler(void *token, int len, int status) - static irqreturn_t cpsw_interrupt(int irq, void *dev_id) - { - struct cpsw_priv *priv = dev_id; -+ int value = irq - priv->irqs_table[0]; -+ -+ /* NOTICE: Ending IRQ here. The trick with the 'value' variable above -+ * is to make sure we will always write the correct value to the EOI -+ * register. Namely 0 for RX_THRESH Interrupt, 1 for RX Interrupt, 2 -+ * for TX Interrupt and 3 for MISC Interrupt. -+ */ -+ cpdma_ctlr_eoi(priv->dma, value); - - cpsw_intr_disable(priv); - if (priv->irq_enabled == true) { -@@ -745,8 +760,6 @@ static int cpsw_poll(struct napi_struct *napi, int budget) - int num_tx, num_rx; - - num_tx = cpdma_chan_process(priv->txch, 128); -- if (num_tx) -- cpdma_ctlr_eoi(priv->dma, CPDMA_EOI_TX); - - num_rx = cpdma_chan_process(priv->rxch, budget); - if (num_rx < budget) { -@@ -754,7 +767,6 @@ static int cpsw_poll(struct napi_struct *napi, int budget) - - napi_complete(napi); - cpsw_intr_enable(priv); -- cpdma_ctlr_eoi(priv->dma, CPDMA_EOI_RX); - prim_cpsw = cpsw_get_slave_priv(priv, 0); - if (prim_cpsw->irq_enabled == false) { - prim_cpsw->irq_enabled = true; -@@ -1265,8 +1277,6 @@ static int cpsw_ndo_open(struct net_device *ndev) - napi_enable(&priv->napi); - cpdma_ctlr_start(priv->dma); - cpsw_intr_enable(priv); -- cpdma_ctlr_eoi(priv->dma, CPDMA_EOI_RX); -- cpdma_ctlr_eoi(priv->dma, CPDMA_EOI_TX); - - if (priv->data.dual_emac) - priv->slaves[priv->emac_port].open_stat = true; -@@ -1512,9 +1522,6 @@ static void cpsw_ndo_tx_timeout(struct net_device *ndev) - cpdma_chan_start(priv->txch); - cpdma_ctlr_int_ctrl(priv->dma, true); - cpsw_intr_enable(priv); -- cpdma_ctlr_eoi(priv->dma, CPDMA_EOI_RX); -- cpdma_ctlr_eoi(priv->dma, CPDMA_EOI_TX); -- - } - - static int cpsw_ndo_set_mac_address(struct net_device *ndev, void *p) -@@ -1560,9 +1567,6 @@ static void cpsw_ndo_poll_controller(struct net_device *ndev) - cpsw_interrupt(ndev->irq, priv); - cpdma_ctlr_int_ctrl(priv->dma, true); - cpsw_intr_enable(priv); -- cpdma_ctlr_eoi(priv->dma, CPDMA_EOI_RX); -- cpdma_ctlr_eoi(priv->dma, CPDMA_EOI_TX); -- - } - #endif - -diff --git a/drivers/net/ethernet/ti/cpsw_ale.c b/drivers/net/ethernet/ti/cpsw_ale.c -index 7f89306..4eceb7e 100644 ---- a/drivers/net/ethernet/ti/cpsw_ale.c -+++ b/drivers/net/ethernet/ti/cpsw_ale.c -@@ -236,7 +236,7 @@ static void cpsw_ale_flush_mcast(struct cpsw_ale *ale, u32 *ale_entry, - cpsw_ale_set_entry_type(ale_entry, ALE_TYPE_FREE); - } - --int cpsw_ale_flush_multicast(struct cpsw_ale *ale, int port_mask) -+int cpsw_ale_flush_multicast(struct cpsw_ale *ale, int port_mask, int vid) - { - u32 ale_entry[ALE_ENTRY_WORDS]; - int ret, idx; -@@ -247,6 +247,14 @@ int cpsw_ale_flush_multicast(struct cpsw_ale *ale, int port_mask) - if (ret != ALE_TYPE_ADDR && ret != ALE_TYPE_VLAN_ADDR) - continue; - -+ /* if vid passed is -1 then remove all multicast entry from -+ * the table irrespective of vlan id, if a valid vlan id is -+ * passed then remove only multicast added to that vlan id. -+ * if vlan id doesn't match then move on to next entry. -+ */ -+ if (vid != -1 && cpsw_ale_get_vlan_id(ale_entry) != vid) -+ continue; -+ - if (cpsw_ale_get_mcast(ale_entry)) { - u8 addr[6]; - -diff --git a/drivers/net/ethernet/ti/cpsw_ale.h b/drivers/net/ethernet/ti/cpsw_ale.h -index de409c3..e701358 100644 ---- a/drivers/net/ethernet/ti/cpsw_ale.h -+++ b/drivers/net/ethernet/ti/cpsw_ale.h -@@ -88,7 +88,7 @@ void cpsw_ale_stop(struct cpsw_ale *ale); - - int cpsw_ale_set_ageout(struct cpsw_ale *ale, int ageout); - int cpsw_ale_flush(struct cpsw_ale *ale, int port_mask); --int cpsw_ale_flush_multicast(struct cpsw_ale *ale, int port_mask); -+int cpsw_ale_flush_multicast(struct cpsw_ale *ale, int port_mask, int vid); - int cpsw_ale_add_ucast(struct cpsw_ale *ale, u8 *addr, int port, - int flags, u16 vid); - int cpsw_ale_del_ucast(struct cpsw_ale *ale, u8 *addr, int port, -diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c -index 979fe43..32efe83 100644 ---- a/drivers/net/team/team.c -+++ b/drivers/net/team/team.c -@@ -629,6 +629,7 @@ static int team_change_mode(struct team *team, const char *kind) - static void team_notify_peers_work(struct work_struct *work) - { - struct team *team; -+ int val; - - team = container_of(work, struct team, notify_peers.dw.work); - -@@ -636,9 +637,14 @@ static void team_notify_peers_work(struct work_struct *work) - schedule_delayed_work(&team->notify_peers.dw, 0); - return; - } -+ val = atomic_dec_if_positive(&team->notify_peers.count_pending); -+ if (val < 0) { -+ rtnl_unlock(); -+ return; -+ } - call_netdevice_notifiers(NETDEV_NOTIFY_PEERS, team->dev); - rtnl_unlock(); -- if (!atomic_dec_and_test(&team->notify_peers.count_pending)) -+ if (val) - schedule_delayed_work(&team->notify_peers.dw, - msecs_to_jiffies(team->notify_peers.interval)); - } -@@ -669,6 +675,7 @@ static void team_notify_peers_fini(struct team *team) - static void team_mcast_rejoin_work(struct work_struct *work) - { - struct team *team; -+ int val; - - team = container_of(work, struct team, mcast_rejoin.dw.work); - -@@ -676,9 +683,14 @@ static void team_mcast_rejoin_work(struct work_struct *work) - schedule_delayed_work(&team->mcast_rejoin.dw, 0); - return; - } -+ val = atomic_dec_if_positive(&team->mcast_rejoin.count_pending); -+ if (val < 0) { -+ rtnl_unlock(); -+ return; -+ } - call_netdevice_notifiers(NETDEV_RESEND_IGMP, team->dev); - rtnl_unlock(); -- if (!atomic_dec_and_test(&team->mcast_rejoin.count_pending)) -+ if (val) - schedule_delayed_work(&team->mcast_rejoin.dw, - msecs_to_jiffies(team->mcast_rejoin.interval)); - } -diff --git a/drivers/platform/x86/hp_accel.c b/drivers/platform/x86/hp_accel.c -index 3dc9344..07fbcb0 100644 ---- a/drivers/platform/x86/hp_accel.c -+++ b/drivers/platform/x86/hp_accel.c -@@ -237,6 +237,7 @@ static struct dmi_system_id lis3lv02d_dmi_ids[] = { - AXIS_DMI_MATCH("HPB64xx", "HP ProBook 64", xy_swap), - AXIS_DMI_MATCH("HPB64xx", "HP EliteBook 84", xy_swap), - AXIS_DMI_MATCH("HPB65xx", "HP ProBook 65", x_inverted), -+ AXIS_DMI_MATCH("HPZBook15", "HP ZBook 15", x_inverted), - { NULL, } - /* Laptop models without axis info (yet): - * "NC6910" "HP Compaq 6910" -diff --git a/drivers/s390/char/con3215.c b/drivers/s390/char/con3215.c -index bb86494..19915c5 100644 ---- a/drivers/s390/char/con3215.c -+++ b/drivers/s390/char/con3215.c -@@ -288,12 +288,16 @@ static void raw3215_timeout(unsigned long __data) - unsigned long flags; - - spin_lock_irqsave(get_ccwdev_lock(raw->cdev), flags); -- if (raw->flags & RAW3215_TIMER_RUNS) { -- del_timer(&raw->timer); -- raw->flags &= ~RAW3215_TIMER_RUNS; -- if (!(raw->port.flags & ASYNC_SUSPENDED)) { -- raw3215_mk_write_req(raw); -- raw3215_start_io(raw); -+ raw->flags &= ~RAW3215_TIMER_RUNS; -+ if (!(raw->port.flags & ASYNC_SUSPENDED)) { -+ raw3215_mk_write_req(raw); -+ raw3215_start_io(raw); -+ if ((raw->queued_read || raw->queued_write) && -+ !(raw->flags & RAW3215_WORKING) && -+ !(raw->flags & RAW3215_TIMER_RUNS)) { -+ raw->timer.expires = RAW3215_TIMEOUT + jiffies; -+ add_timer(&raw->timer); -+ raw->flags |= RAW3215_TIMER_RUNS; - } - } - spin_unlock_irqrestore(get_ccwdev_lock(raw->cdev), flags); -@@ -317,17 +321,15 @@ static inline void raw3215_try_io(struct raw3215_info *raw) - (raw->flags & RAW3215_FLUSHING)) { - /* execute write requests bigger than minimum size */ - raw3215_start_io(raw); -- if (raw->flags & RAW3215_TIMER_RUNS) { -- del_timer(&raw->timer); -- raw->flags &= ~RAW3215_TIMER_RUNS; -- } -- } else if (!(raw->flags & RAW3215_TIMER_RUNS)) { -- /* delay small writes */ -- raw->timer.expires = RAW3215_TIMEOUT + jiffies; -- add_timer(&raw->timer); -- raw->flags |= RAW3215_TIMER_RUNS; - } - } -+ if ((raw->queued_read || raw->queued_write) && -+ !(raw->flags & RAW3215_WORKING) && -+ !(raw->flags & RAW3215_TIMER_RUNS)) { -+ raw->timer.expires = RAW3215_TIMEOUT + jiffies; -+ add_timer(&raw->timer); -+ raw->flags |= RAW3215_TIMER_RUNS; -+ } - } - - /* -@@ -1027,12 +1029,26 @@ static int tty3215_write(struct tty_struct * tty, - const unsigned char *buf, int count) - { - struct raw3215_info *raw; -+ int i, written; - - if (!tty) - return 0; - raw = (struct raw3215_info *) tty->driver_data; -- raw3215_write(raw, buf, count); -- return count; -+ written = count; -+ while (count > 0) { -+ for (i = 0; i < count; i++) -+ if (buf[i] == '\t' || buf[i] == '\n') -+ break; -+ raw3215_write(raw, buf, i); -+ count -= i; -+ buf += i; -+ if (count > 0) { -+ raw3215_putchar(raw, *buf); -+ count--; -+ buf++; -+ } -+ } -+ return written; - } - - /* -@@ -1180,7 +1196,7 @@ static int __init tty3215_init(void) - driver->subtype = SYSTEM_TYPE_TTY; - driver->init_termios = tty_std_termios; - driver->init_termios.c_iflag = IGNBRK | IGNPAR; -- driver->init_termios.c_oflag = ONLCR | XTABS; -+ driver->init_termios.c_oflag = ONLCR; - driver->init_termios.c_lflag = ISIG; - driver->flags = TTY_DRIVER_REAL_RAW; - tty_set_operations(driver, &tty3215_ops); -diff --git a/drivers/scsi/mpt2sas/mpt2sas_transport.c b/drivers/scsi/mpt2sas/mpt2sas_transport.c -index 410f4a3..72f9c55 100644 ---- a/drivers/scsi/mpt2sas/mpt2sas_transport.c -+++ b/drivers/scsi/mpt2sas/mpt2sas_transport.c -@@ -1006,12 +1006,9 @@ mpt2sas_transport_update_links(struct MPT2SAS_ADAPTER *ioc, - &mpt2sas_phy->remote_identify); - _transport_add_phy_to_an_existing_port(ioc, sas_node, - mpt2sas_phy, mpt2sas_phy->remote_identify.sas_address); -- } else { -+ } else - memset(&mpt2sas_phy->remote_identify, 0 , sizeof(struct - sas_identify)); -- _transport_del_phy_from_an_existing_port(ioc, sas_node, -- mpt2sas_phy); -- } - - if (mpt2sas_phy->phy) - mpt2sas_phy->phy->negotiated_linkrate = -diff --git a/drivers/scsi/mpt3sas/mpt3sas_transport.c b/drivers/scsi/mpt3sas/mpt3sas_transport.c -index 65170cb..55aa597 100644 ---- a/drivers/scsi/mpt3sas/mpt3sas_transport.c -+++ b/drivers/scsi/mpt3sas/mpt3sas_transport.c -@@ -1003,12 +1003,9 @@ mpt3sas_transport_update_links(struct MPT3SAS_ADAPTER *ioc, - &mpt3sas_phy->remote_identify); - _transport_add_phy_to_an_existing_port(ioc, sas_node, - mpt3sas_phy, mpt3sas_phy->remote_identify.sas_address); -- } else { -+ } else - memset(&mpt3sas_phy->remote_identify, 0 , sizeof(struct - sas_identify)); -- _transport_del_phy_from_an_existing_port(ioc, sas_node, -- mpt3sas_phy); -- } - - if (mpt3sas_phy->phy) - mpt3sas_phy->phy->negotiated_linkrate = -diff --git a/drivers/scsi/scsi_devinfo.c b/drivers/scsi/scsi_devinfo.c -index c1d04d4..262ab83 100644 ---- a/drivers/scsi/scsi_devinfo.c -+++ b/drivers/scsi/scsi_devinfo.c -@@ -211,6 +211,7 @@ static struct { - {"Medion", "Flash XL MMC/SD", "2.6D", BLIST_FORCELUN}, - {"MegaRAID", "LD", NULL, BLIST_FORCELUN}, - {"MICROP", "4110", NULL, BLIST_NOTQ}, -+ {"MSFT", "Virtual HD", NULL, BLIST_NO_RSOC}, - {"MYLEX", "DACARMRB", "*", BLIST_REPORTLUN2}, - {"nCipher", "Fastness Crypto", NULL, BLIST_FORCELUN}, - {"NAKAMICH", "MJ-4.8S", NULL, BLIST_FORCELUN | BLIST_SINGLELUN}, -diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c -index ed0f899..86b0515 100644 ---- a/drivers/scsi/storvsc_drv.c -+++ b/drivers/scsi/storvsc_drv.c -@@ -1690,13 +1690,12 @@ static int storvsc_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *scmnd) - if (ret == -EAGAIN) { - /* no more space */ - -- if (cmd_request->bounce_sgl_count) { -+ if (cmd_request->bounce_sgl_count) - destroy_bounce_buffer(cmd_request->bounce_sgl, - cmd_request->bounce_sgl_count); - -- ret = SCSI_MLQUEUE_DEVICE_BUSY; -- goto queue_error; -- } -+ ret = SCSI_MLQUEUE_DEVICE_BUSY; -+ goto queue_error; - } - - return 0; -diff --git a/drivers/target/iscsi/iscsi_target_login.c b/drivers/target/iscsi/iscsi_target_login.c -index d509aa7..c5d3811 100644 ---- a/drivers/target/iscsi/iscsi_target_login.c -+++ b/drivers/target/iscsi/iscsi_target_login.c -@@ -1186,6 +1186,9 @@ old_sess_out: - conn->sock = NULL; - } - -+ if (conn->conn_transport->iscsit_wait_conn) -+ conn->conn_transport->iscsit_wait_conn(conn); -+ - if (conn->conn_transport->iscsit_free_conn) - conn->conn_transport->iscsit_free_conn(conn); - -diff --git a/drivers/target/iscsi/iscsi_target_util.c b/drivers/target/iscsi/iscsi_target_util.c -index ab77f80..1e406af 100644 ---- a/drivers/target/iscsi/iscsi_target_util.c -+++ b/drivers/target/iscsi/iscsi_target_util.c -@@ -1356,15 +1356,15 @@ static int iscsit_do_tx_data( - struct iscsi_conn *conn, - struct iscsi_data_count *count) - { -- int data = count->data_length, total_tx = 0, tx_loop = 0, iov_len; -+ int ret, iov_len; - struct kvec *iov_p; - struct msghdr msg; - - if (!conn || !conn->sock || !conn->conn_ops) - return -1; - -- if (data <= 0) { -- pr_err("Data length is: %d\n", data); -+ if (count->data_length <= 0) { -+ pr_err("Data length is: %d\n", count->data_length); - return -1; - } - -@@ -1373,20 +1373,16 @@ static int iscsit_do_tx_data( - iov_p = count->iov; - iov_len = count->iov_count; - -- while (total_tx < data) { -- tx_loop = kernel_sendmsg(conn->sock, &msg, iov_p, iov_len, -- (data - total_tx)); -- if (tx_loop <= 0) { -- pr_debug("tx_loop: %d total_tx %d\n", -- tx_loop, total_tx); -- return tx_loop; -- } -- total_tx += tx_loop; -- pr_debug("tx_loop: %d, total_tx: %d, data: %d\n", -- tx_loop, total_tx, data); -+ ret = kernel_sendmsg(conn->sock, &msg, iov_p, iov_len, -+ count->data_length); -+ if (ret != count->data_length) { -+ pr_err("Unexpected ret: %d send data %d\n", -+ ret, count->data_length); -+ return -EPIPE; - } -+ pr_debug("ret: %d, sent data: %d\n", ret, count->data_length); - -- return total_tx; -+ return ret; - } - - int rx_data( -diff --git a/drivers/target/loopback/tcm_loop.c b/drivers/target/loopback/tcm_loop.c -index fadad7c..67c802c 100644 ---- a/drivers/target/loopback/tcm_loop.c -+++ b/drivers/target/loopback/tcm_loop.c -@@ -153,18 +153,11 @@ static int tcm_loop_change_queue_type(struct scsi_device *sdev, int tag) - /* - * Locate the SAM Task Attr from struct scsi_cmnd * - */ --static int tcm_loop_sam_attr(struct scsi_cmnd *sc) --{ -- if (sc->device->tagged_supported) { -- switch (sc->tag) { -- case HEAD_OF_QUEUE_TAG: -- return MSG_HEAD_TAG; -- case ORDERED_QUEUE_TAG: -- return MSG_ORDERED_TAG; -- default: -- break; -- } -- } -+static int tcm_loop_sam_attr(struct scsi_cmnd *sc, int tag) -+{ -+ if (sc->device->tagged_supported && -+ sc->device->ordered_tags && tag >= 0) -+ return MSG_ORDERED_TAG; - - return MSG_SIMPLE_TAG; - } -@@ -197,7 +190,7 @@ static void tcm_loop_submission_work(struct work_struct *work) - set_host_byte(sc, DID_TRANSPORT_DISRUPTED); - goto out_done; - } -- tl_nexus = tl_hba->tl_nexus; -+ tl_nexus = tl_tpg->tl_nexus; - if (!tl_nexus) { - scmd_printk(KERN_ERR, sc, "TCM_Loop I_T Nexus" - " does not exist\n"); -@@ -214,7 +207,7 @@ static void tcm_loop_submission_work(struct work_struct *work) - } - rc = target_submit_cmd_map_sgls(se_cmd, tl_nexus->se_sess, sc->cmnd, - &tl_cmd->tl_sense_buf[0], tl_cmd->sc->device->lun, -- scsi_bufflen(sc), tcm_loop_sam_attr(sc), -+ scsi_bufflen(sc), tcm_loop_sam_attr(sc, tl_cmd->sc_cmd_tag), - sc->sc_data_direction, 0, - scsi_sglist(sc), scsi_sg_count(sc), - sgl_bidi, sgl_bidi_count, -@@ -252,7 +245,7 @@ static int tcm_loop_queuecommand(struct Scsi_Host *sh, struct scsi_cmnd *sc) - } - - tl_cmd->sc = sc; -- tl_cmd->sc_cmd_tag = sc->tag; -+ tl_cmd->sc_cmd_tag = sc->request->tag; - INIT_WORK(&tl_cmd->work, tcm_loop_submission_work); - queue_work(tcm_loop_workqueue, &tl_cmd->work); - return 0; -@@ -263,16 +256,26 @@ static int tcm_loop_queuecommand(struct Scsi_Host *sh, struct scsi_cmnd *sc) - * to struct scsi_device - */ - static int tcm_loop_issue_tmr(struct tcm_loop_tpg *tl_tpg, -- struct tcm_loop_nexus *tl_nexus, - int lun, int task, enum tcm_tmreq_table tmr) - { - struct se_cmd *se_cmd = NULL; - struct se_session *se_sess; - struct se_portal_group *se_tpg; -+ struct tcm_loop_nexus *tl_nexus; - struct tcm_loop_cmd *tl_cmd = NULL; - struct tcm_loop_tmr *tl_tmr = NULL; - int ret = TMR_FUNCTION_FAILED, rc; - -+ /* -+ * Locate the tl_nexus and se_sess pointers -+ */ -+ tl_nexus = tl_tpg->tl_nexus; -+ if (!tl_nexus) { -+ pr_err("Unable to perform device reset without" -+ " active I_T Nexus\n"); -+ return ret; -+ } -+ - tl_cmd = kmem_cache_zalloc(tcm_loop_cmd_cache, GFP_KERNEL); - if (!tl_cmd) { - pr_err("Unable to allocate memory for tl_cmd\n"); -@@ -288,7 +291,7 @@ static int tcm_loop_issue_tmr(struct tcm_loop_tpg *tl_tpg, - - se_cmd = &tl_cmd->tl_se_cmd; - se_tpg = &tl_tpg->tl_se_tpg; -- se_sess = tl_nexus->se_sess; -+ se_sess = tl_tpg->tl_nexus->se_sess; - /* - * Initialize struct se_cmd descriptor from target_core_mod infrastructure - */ -@@ -333,7 +336,6 @@ release: - static int tcm_loop_abort_task(struct scsi_cmnd *sc) - { - struct tcm_loop_hba *tl_hba; -- struct tcm_loop_nexus *tl_nexus; - struct tcm_loop_tpg *tl_tpg; - int ret = FAILED; - -@@ -341,22 +343,9 @@ static int tcm_loop_abort_task(struct scsi_cmnd *sc) - * Locate the tcm_loop_hba_t pointer - */ - tl_hba = *(struct tcm_loop_hba **)shost_priv(sc->device->host); -- /* -- * Locate the tl_nexus and se_sess pointers -- */ -- tl_nexus = tl_hba->tl_nexus; -- if (!tl_nexus) { -- pr_err("Unable to perform device reset without" -- " active I_T Nexus\n"); -- return FAILED; -- } -- -- /* -- * Locate the tl_tpg pointer from TargetID in sc->device->id -- */ - tl_tpg = &tl_hba->tl_hba_tpgs[sc->device->id]; -- ret = tcm_loop_issue_tmr(tl_tpg, tl_nexus, sc->device->lun, -- sc->tag, TMR_ABORT_TASK); -+ ret = tcm_loop_issue_tmr(tl_tpg, sc->device->lun, -+ sc->request->tag, TMR_ABORT_TASK); - return (ret == TMR_FUNCTION_COMPLETE) ? SUCCESS : FAILED; - } - -@@ -367,7 +356,6 @@ static int tcm_loop_abort_task(struct scsi_cmnd *sc) - static int tcm_loop_device_reset(struct scsi_cmnd *sc) - { - struct tcm_loop_hba *tl_hba; -- struct tcm_loop_nexus *tl_nexus; - struct tcm_loop_tpg *tl_tpg; - int ret = FAILED; - -@@ -375,20 +363,9 @@ static int tcm_loop_device_reset(struct scsi_cmnd *sc) - * Locate the tcm_loop_hba_t pointer - */ - tl_hba = *(struct tcm_loop_hba **)shost_priv(sc->device->host); -- /* -- * Locate the tl_nexus and se_sess pointers -- */ -- tl_nexus = tl_hba->tl_nexus; -- if (!tl_nexus) { -- pr_err("Unable to perform device reset without" -- " active I_T Nexus\n"); -- return FAILED; -- } -- /* -- * Locate the tl_tpg pointer from TargetID in sc->device->id -- */ - tl_tpg = &tl_hba->tl_hba_tpgs[sc->device->id]; -- ret = tcm_loop_issue_tmr(tl_tpg, tl_nexus, sc->device->lun, -+ -+ ret = tcm_loop_issue_tmr(tl_tpg, sc->device->lun, - 0, TMR_LUN_RESET); - return (ret == TMR_FUNCTION_COMPLETE) ? SUCCESS : FAILED; - } -@@ -995,8 +972,8 @@ static int tcm_loop_make_nexus( - struct tcm_loop_nexus *tl_nexus; - int ret = -ENOMEM; - -- if (tl_tpg->tl_hba->tl_nexus) { -- pr_debug("tl_tpg->tl_hba->tl_nexus already exists\n"); -+ if (tl_tpg->tl_nexus) { -+ pr_debug("tl_tpg->tl_nexus already exists\n"); - return -EEXIST; - } - se_tpg = &tl_tpg->tl_se_tpg; -@@ -1031,7 +1008,7 @@ static int tcm_loop_make_nexus( - */ - __transport_register_session(se_tpg, tl_nexus->se_sess->se_node_acl, - tl_nexus->se_sess, tl_nexus); -- tl_tpg->tl_hba->tl_nexus = tl_nexus; -+ tl_tpg->tl_nexus = tl_nexus; - pr_debug("TCM_Loop_ConfigFS: Established I_T Nexus to emulated" - " %s Initiator Port: %s\n", tcm_loop_dump_proto_id(tl_hba), - name); -@@ -1047,12 +1024,8 @@ static int tcm_loop_drop_nexus( - { - struct se_session *se_sess; - struct tcm_loop_nexus *tl_nexus; -- struct tcm_loop_hba *tl_hba = tpg->tl_hba; - -- if (!tl_hba) -- return -ENODEV; -- -- tl_nexus = tl_hba->tl_nexus; -+ tl_nexus = tpg->tl_nexus; - if (!tl_nexus) - return -ENODEV; - -@@ -1068,13 +1041,13 @@ static int tcm_loop_drop_nexus( - } - - pr_debug("TCM_Loop_ConfigFS: Removing I_T Nexus to emulated" -- " %s Initiator Port: %s\n", tcm_loop_dump_proto_id(tl_hba), -+ " %s Initiator Port: %s\n", tcm_loop_dump_proto_id(tpg->tl_hba), - tl_nexus->se_sess->se_node_acl->initiatorname); - /* - * Release the SCSI I_T Nexus to the emulated SAS Target Port - */ - transport_deregister_session(tl_nexus->se_sess); -- tpg->tl_hba->tl_nexus = NULL; -+ tpg->tl_nexus = NULL; - kfree(tl_nexus); - return 0; - } -@@ -1090,7 +1063,7 @@ static ssize_t tcm_loop_tpg_show_nexus( - struct tcm_loop_nexus *tl_nexus; - ssize_t ret; - -- tl_nexus = tl_tpg->tl_hba->tl_nexus; -+ tl_nexus = tl_tpg->tl_nexus; - if (!tl_nexus) - return -ENODEV; - -diff --git a/drivers/target/loopback/tcm_loop.h b/drivers/target/loopback/tcm_loop.h -index 54c59d0..6ae49f2 100644 ---- a/drivers/target/loopback/tcm_loop.h -+++ b/drivers/target/loopback/tcm_loop.h -@@ -27,11 +27,6 @@ struct tcm_loop_tmr { - }; - - struct tcm_loop_nexus { -- int it_nexus_active; -- /* -- * Pointer to Linux/SCSI HBA from linux/include/scsi_host.h -- */ -- struct scsi_host *sh; - /* - * Pointer to TCM session for I_T Nexus - */ -@@ -51,6 +46,7 @@ struct tcm_loop_tpg { - atomic_t tl_tpg_port_count; - struct se_portal_group tl_se_tpg; - struct tcm_loop_hba *tl_hba; -+ struct tcm_loop_nexus *tl_nexus; - }; - - struct tcm_loop_hba { -@@ -59,7 +55,6 @@ struct tcm_loop_hba { - struct se_hba_s *se_hba; - struct se_lun *tl_hba_lun; - struct se_port *tl_hba_lun_sep; -- struct tcm_loop_nexus *tl_nexus; - struct device dev; - struct Scsi_Host *sh; - struct tcm_loop_tpg tl_hba_tpgs[TL_TPGS_PER_HBA]; -diff --git a/drivers/thermal/intel_powerclamp.c b/drivers/thermal/intel_powerclamp.c -index a084325..6e75177 100644 ---- a/drivers/thermal/intel_powerclamp.c -+++ b/drivers/thermal/intel_powerclamp.c -@@ -435,7 +435,6 @@ static int clamp_thread(void *arg) - * allowed. thus jiffies are updated properly. - */ - preempt_disable(); -- tick_nohz_idle_enter(); - /* mwait until target jiffies is reached */ - while (time_before(jiffies, target_jiffies)) { - unsigned long ecx = 1; -@@ -451,7 +450,6 @@ static int clamp_thread(void *arg) - start_critical_timings(); - atomic_inc(&idle_wakeup_counter); - } -- tick_nohz_idle_exit(); - preempt_enable(); - } - del_timer_sync(&wakeup_timer); -diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c -index d90c70c..8f6738d 100644 ---- a/drivers/usb/dwc3/gadget.c -+++ b/drivers/usb/dwc3/gadget.c -@@ -887,8 +887,7 @@ static void dwc3_prepare_trbs(struct dwc3_ep *dep, bool starting) - - if (i == (request->num_mapped_sgs - 1) || - sg_is_last(s)) { -- if (list_is_last(&req->list, -- &dep->request_list)) -+ if (list_empty(&dep->request_list)) - last_one = true; - chain = false; - } -@@ -906,6 +905,9 @@ static void dwc3_prepare_trbs(struct dwc3_ep *dep, bool starting) - if (last_one) - break; - } -+ -+ if (last_one) -+ break; - } else { - dma = req->request.dma; - length = req->request.length; -diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c -index e113fd7..c399606 100644 ---- a/drivers/usb/host/ehci-sched.c -+++ b/drivers/usb/host/ehci-sched.c -@@ -1581,6 +1581,10 @@ iso_stream_schedule ( - else - next = (now + 2 + 7) & ~0x07; /* full frame cache */ - -+ /* If needed, initialize last_iso_frame so that this URB will be seen */ -+ if (ehci->isoc_count == 0) -+ ehci->last_iso_frame = now >> 3; -+ - /* - * Use ehci->last_iso_frame as the base. There can't be any - * TDs scheduled for earlier than that. -@@ -1671,10 +1675,6 @@ iso_stream_schedule ( - urb->start_frame = start & (mod - 1); - if (!stream->highspeed) - urb->start_frame >>= 3; -- -- /* Make sure scan_isoc() sees these */ -- if (ehci->isoc_count == 0) -- ehci->last_iso_frame = now >> 3; - return status; - - fail: -diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c -index 2f3aceb..f4e6b94 100644 ---- a/drivers/usb/host/pci-quirks.c -+++ b/drivers/usb/host/pci-quirks.c -@@ -571,7 +571,8 @@ static void quirk_usb_handoff_ohci(struct pci_dev *pdev) - { - void __iomem *base; - u32 control; -- u32 fminterval; -+ u32 fminterval = 0; -+ bool no_fminterval = false; - int cnt; - - if (!mmio_resource_enabled(pdev, 0)) -@@ -581,6 +582,13 @@ static void quirk_usb_handoff_ohci(struct pci_dev *pdev) - if (base == NULL) - return; - -+ /* -+ * ULi M5237 OHCI controller locks the whole system when accessing -+ * the OHCI_FMINTERVAL offset. -+ */ -+ if (pdev->vendor == PCI_VENDOR_ID_AL && pdev->device == 0x5237) -+ no_fminterval = true; -+ - control = readl(base + OHCI_CONTROL); - - /* On PA-RISC, PDC can leave IR set incorrectly; ignore it there. */ -@@ -619,7 +627,9 @@ static void quirk_usb_handoff_ohci(struct pci_dev *pdev) - } - - /* software reset of the controller, preserving HcFmInterval */ -- fminterval = readl(base + OHCI_FMINTERVAL); -+ if (!no_fminterval) -+ fminterval = readl(base + OHCI_FMINTERVAL); -+ - writel(OHCI_HCR, base + OHCI_CMDSTATUS); - - /* reset requires max 10 us delay */ -@@ -628,7 +638,9 @@ static void quirk_usb_handoff_ohci(struct pci_dev *pdev) - break; - udelay(1); - } -- writel(fminterval, base + OHCI_FMINTERVAL); -+ -+ if (!no_fminterval) -+ writel(fminterval, base + OHCI_FMINTERVAL); - - /* Now the controller is safely in SUSPEND and nothing can wake it up */ - iounmap(base); -diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c -index abb38c3..6b0fb6a 100644 ---- a/drivers/usb/musb/musb_host.c -+++ b/drivers/usb/musb/musb_host.c -@@ -2640,7 +2640,6 @@ void musb_host_cleanup(struct musb *musb) - if (musb->port_mode == MUSB_PORT_MODE_GADGET) - return; - usb_remove_hcd(musb->hcd); -- musb->hcd = NULL; - } - - void musb_host_free(struct musb *musb) -diff --git a/drivers/usb/serial/console.c b/drivers/usb/serial/console.c -index 8d7fc48..29fa1c3 100644 ---- a/drivers/usb/serial/console.c -+++ b/drivers/usb/serial/console.c -@@ -46,6 +46,8 @@ static struct console usbcons; - * ------------------------------------------------------------ - */ - -+static const struct tty_operations usb_console_fake_tty_ops = { -+}; - - /* - * The parsing of the command line works exactly like the -@@ -137,13 +139,17 @@ static int usb_console_setup(struct console *co, char *options) - goto reset_open_count; - } - kref_init(&tty->kref); -- tty_port_tty_set(&port->port, tty); - tty->driver = usb_serial_tty_driver; - tty->index = co->index; -+ init_ldsem(&tty->ldisc_sem); -+ INIT_LIST_HEAD(&tty->tty_files); -+ kref_get(&tty->driver->kref); -+ tty->ops = &usb_console_fake_tty_ops; - if (tty_init_termios(tty)) { - retval = -ENOMEM; -- goto free_tty; -+ goto put_tty; - } -+ tty_port_tty_set(&port->port, tty); - } - - /* only call the device specific open if this -@@ -161,7 +167,7 @@ static int usb_console_setup(struct console *co, char *options) - serial->type->set_termios(tty, port, &dummy); - - tty_port_tty_set(&port->port, NULL); -- kfree(tty); -+ tty_kref_put(tty); - } - set_bit(ASYNCB_INITIALIZED, &port->port.flags); - } -@@ -177,8 +183,8 @@ static int usb_console_setup(struct console *co, char *options) - - fail: - tty_port_tty_set(&port->port, NULL); -- free_tty: -- kfree(tty); -+ put_tty: -+ tty_kref_put(tty); - reset_open_count: - port->port.count = 0; - usb_autopm_put_interface(serial->interface); -diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c -index 5741e94..9e8708c 100644 ---- a/drivers/usb/serial/cp210x.c -+++ b/drivers/usb/serial/cp210x.c -@@ -120,10 +120,12 @@ static const struct usb_device_id id_table[] = { - { USB_DEVICE(0x10C4, 0x85F8) }, /* Virtenio Preon32 */ - { USB_DEVICE(0x10C4, 0x8664) }, /* AC-Services CAN-IF */ - { USB_DEVICE(0x10C4, 0x8665) }, /* AC-Services OBD-IF */ -- { USB_DEVICE(0x10C4, 0x8875) }, /* CEL MeshConnect USB Stick */ -+ { USB_DEVICE(0x10C4, 0x8856) }, /* CEL EM357 ZigBee USB Stick - LR */ -+ { USB_DEVICE(0x10C4, 0x8857) }, /* CEL EM357 ZigBee USB Stick */ - { USB_DEVICE(0x10C4, 0x88A4) }, /* MMB Networks ZigBee USB Device */ - { USB_DEVICE(0x10C4, 0x88A5) }, /* Planet Innovation Ingeni ZigBee USB Device */ - { USB_DEVICE(0x10C4, 0x8946) }, /* Ketra N1 Wireless Interface */ -+ { USB_DEVICE(0x10C4, 0x8977) }, /* CEL MeshWorks DevKit Device */ - { USB_DEVICE(0x10C4, 0xEA60) }, /* Silicon Labs factory default */ - { USB_DEVICE(0x10C4, 0xEA61) }, /* Silicon Labs factory default */ - { USB_DEVICE(0x10C4, 0xEA70) }, /* Silicon Labs factory default */ -diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c -index 49101fe..35297a8 100644 ---- a/drivers/usb/serial/keyspan.c -+++ b/drivers/usb/serial/keyspan.c -@@ -421,6 +421,8 @@ static void usa26_instat_callback(struct urb *urb) - } - port = serial->port[msg->port]; - p_priv = usb_get_serial_port_data(port); -+ if (!p_priv) -+ goto resubmit; - - /* Update handshaking pin state information */ - old_dcd_state = p_priv->dcd_state; -@@ -431,7 +433,7 @@ static void usa26_instat_callback(struct urb *urb) - - if (old_dcd_state != p_priv->dcd_state) - tty_port_tty_hangup(&port->port, true); -- -+resubmit: - /* Resubmit urb so we continue receiving */ - err = usb_submit_urb(urb, GFP_ATOMIC); - if (err != 0) -@@ -541,6 +543,8 @@ static void usa28_instat_callback(struct urb *urb) - } - port = serial->port[msg->port]; - p_priv = usb_get_serial_port_data(port); -+ if (!p_priv) -+ goto resubmit; - - /* Update handshaking pin state information */ - old_dcd_state = p_priv->dcd_state; -@@ -551,7 +555,7 @@ static void usa28_instat_callback(struct urb *urb) - - if (old_dcd_state != p_priv->dcd_state && old_dcd_state) - tty_port_tty_hangup(&port->port, true); -- -+resubmit: - /* Resubmit urb so we continue receiving */ - err = usb_submit_urb(urb, GFP_ATOMIC); - if (err != 0) -@@ -624,6 +628,8 @@ static void usa49_instat_callback(struct urb *urb) - } - port = serial->port[msg->portNumber]; - p_priv = usb_get_serial_port_data(port); -+ if (!p_priv) -+ goto resubmit; - - /* Update handshaking pin state information */ - old_dcd_state = p_priv->dcd_state; -@@ -634,7 +640,7 @@ static void usa49_instat_callback(struct urb *urb) - - if (old_dcd_state != p_priv->dcd_state && old_dcd_state) - tty_port_tty_hangup(&port->port, true); -- -+resubmit: - /* Resubmit urb so we continue receiving */ - err = usb_submit_urb(urb, GFP_ATOMIC); - if (err != 0) -@@ -872,6 +878,8 @@ static void usa90_instat_callback(struct urb *urb) - - port = serial->port[0]; - p_priv = usb_get_serial_port_data(port); -+ if (!p_priv) -+ goto resubmit; - - /* Update handshaking pin state information */ - old_dcd_state = p_priv->dcd_state; -@@ -882,7 +890,7 @@ static void usa90_instat_callback(struct urb *urb) - - if (old_dcd_state != p_priv->dcd_state && old_dcd_state) - tty_port_tty_hangup(&port->port, true); -- -+resubmit: - /* Resubmit urb so we continue receiving */ - err = usb_submit_urb(urb, GFP_ATOMIC); - if (err != 0) -@@ -943,6 +951,8 @@ static void usa67_instat_callback(struct urb *urb) - - port = serial->port[msg->port]; - p_priv = usb_get_serial_port_data(port); -+ if (!p_priv) -+ goto resubmit; - - /* Update handshaking pin state information */ - old_dcd_state = p_priv->dcd_state; -@@ -951,7 +961,7 @@ static void usa67_instat_callback(struct urb *urb) - - if (old_dcd_state != p_priv->dcd_state && old_dcd_state) - tty_port_tty_hangup(&port->port, true); -- -+resubmit: - /* Resubmit urb so we continue receiving */ - err = usb_submit_urb(urb, GFP_ATOMIC); - if (err != 0) -diff --git a/drivers/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c -index 7ba0424..75e1d03 100644 ---- a/drivers/vfio/pci/vfio_pci.c -+++ b/drivers/vfio/pci/vfio_pci.c -@@ -810,13 +810,11 @@ static const struct vfio_device_ops vfio_pci_ops = { - - static int vfio_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) - { -- u8 type; - struct vfio_pci_device *vdev; - struct iommu_group *group; - int ret; - -- pci_read_config_byte(pdev, PCI_HEADER_TYPE, &type); -- if ((type & PCI_HEADER_TYPE) != PCI_HEADER_TYPE_NORMAL) -+ if (pdev->hdr_type != PCI_HEADER_TYPE_NORMAL) - return -EINVAL; - - group = iommu_group_get(&pdev->dev); -diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c -index 5d0b7b8..486d710 100644 ---- a/drivers/vhost/scsi.c -+++ b/drivers/vhost/scsi.c -@@ -861,6 +861,23 @@ vhost_scsi_map_iov_to_sgl(struct tcm_vhost_cmd *cmd, - return 0; - } - -+static int vhost_scsi_to_tcm_attr(int attr) -+{ -+ switch (attr) { -+ case VIRTIO_SCSI_S_SIMPLE: -+ return MSG_SIMPLE_TAG; -+ case VIRTIO_SCSI_S_ORDERED: -+ return MSG_ORDERED_TAG; -+ case VIRTIO_SCSI_S_HEAD: -+ return MSG_HEAD_TAG; -+ case VIRTIO_SCSI_S_ACA: -+ return MSG_ACA_TAG; -+ default: -+ break; -+ } -+ return MSG_SIMPLE_TAG; -+} -+ - static void tcm_vhost_submission_work(struct work_struct *work) - { - struct tcm_vhost_cmd *cmd = -@@ -887,9 +904,10 @@ static void tcm_vhost_submission_work(struct work_struct *work) - rc = target_submit_cmd_map_sgls(se_cmd, tv_nexus->tvn_se_sess, - cmd->tvc_cdb, &cmd->tvc_sense_buf[0], - cmd->tvc_lun, cmd->tvc_exp_data_len, -- cmd->tvc_task_attr, cmd->tvc_data_direction, -- TARGET_SCF_ACK_KREF, sg_ptr, cmd->tvc_sgl_count, -- sg_bidi_ptr, sg_no_bidi, NULL, 0); -+ vhost_scsi_to_tcm_attr(cmd->tvc_task_attr), -+ cmd->tvc_data_direction, TARGET_SCF_ACK_KREF, -+ sg_ptr, cmd->tvc_sgl_count, sg_bidi_ptr, sg_no_bidi, -+ NULL, 0); - if (rc < 0) { - transport_send_check_condition_and_sense(se_cmd, - TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE, 0); -diff --git a/drivers/video/logo/logo.c b/drivers/video/logo/logo.c -index b670cbd..ffe024b 100644 ---- a/drivers/video/logo/logo.c -+++ b/drivers/video/logo/logo.c -@@ -21,6 +21,21 @@ static bool nologo; - module_param(nologo, bool, 0); - MODULE_PARM_DESC(nologo, "Disables startup logo"); - -+/* -+ * Logos are located in the initdata, and will be freed in kernel_init. -+ * Use late_init to mark the logos as freed to prevent any further use. -+ */ -+ -+static bool logos_freed; -+ -+static int __init fb_logo_late_init(void) -+{ -+ logos_freed = true; -+ return 0; -+} -+ -+late_initcall(fb_logo_late_init); -+ - /* logo's are marked __initdata. Use __init_refok to tell - * modpost that it is intended that this function uses data - * marked __initdata. -@@ -29,7 +44,7 @@ const struct linux_logo * __init_refok fb_find_logo(int depth) - { - const struct linux_logo *logo = NULL; - -- if (nologo) -+ if (nologo || logos_freed) - return NULL; - - if (depth >= 1) { -diff --git a/fs/lockd/svc.c b/fs/lockd/svc.c -index 223e1cb..59a53f6 100644 ---- a/fs/lockd/svc.c -+++ b/fs/lockd/svc.c -@@ -137,10 +137,6 @@ lockd(void *vrqstp) - - dprintk("NFS locking service started (ver " LOCKD_VERSION ").\n"); - -- if (!nlm_timeout) -- nlm_timeout = LOCKD_DFLT_TIMEO; -- nlmsvc_timeout = nlm_timeout * HZ; -- - /* - * The main request loop. We don't terminate until the last - * NFS mount or NFS daemon has gone away. -@@ -346,6 +342,10 @@ static struct svc_serv *lockd_create_svc(void) - printk(KERN_WARNING - "lockd_up: no pid, %d users??\n", nlmsvc_users); - -+ if (!nlm_timeout) -+ nlm_timeout = LOCKD_DFLT_TIMEO; -+ nlmsvc_timeout = nlm_timeout * HZ; -+ - serv = svc_create(&nlmsvc_program, LOCKD_BUFSIZE, NULL); - if (!serv) { - printk(KERN_WARNING "lockd_up: create service failed\n"); -diff --git a/fs/nfs/nfs4client.c b/fs/nfs/nfs4client.c -index 1abe4f5..037f957 100644 ---- a/fs/nfs/nfs4client.c -+++ b/fs/nfs/nfs4client.c -@@ -565,20 +565,14 @@ static bool nfs4_match_clientids(struct nfs_client *a, struct nfs_client *b) - } - - /* -- * Returns true if the server owners match -+ * Returns true if the server major ids match - */ - static bool --nfs4_match_serverowners(struct nfs_client *a, struct nfs_client *b) -+nfs4_check_clientid_trunking(struct nfs_client *a, struct nfs_client *b) - { - struct nfs41_server_owner *o1 = a->cl_serverowner; - struct nfs41_server_owner *o2 = b->cl_serverowner; - -- if (o1->minor_id != o2->minor_id) { -- dprintk("NFS: --> %s server owner minor IDs do not match\n", -- __func__); -- return false; -- } -- - if (o1->major_id_sz != o2->major_id_sz) - goto out_major_mismatch; - if (memcmp(o1->major_id, o2->major_id, o1->major_id_sz) != 0) -@@ -654,7 +648,12 @@ int nfs41_walk_client_list(struct nfs_client *new, - if (!nfs4_match_clientids(pos, new)) - continue; - -- if (!nfs4_match_serverowners(pos, new)) -+ /* -+ * Note that session trunking is just a special subcase of -+ * client id trunking. In either case, we want to fall back -+ * to using the existing nfs_client. -+ */ -+ if (!nfs4_check_clientid_trunking(pos, new)) - continue; - - atomic_inc(&pos->cl_count); -diff --git a/fs/notify/inode_mark.c b/fs/notify/inode_mark.c -index 74825be..fbb9dfb 100644 ---- a/fs/notify/inode_mark.c -+++ b/fs/notify/inode_mark.c -@@ -288,20 +288,25 @@ void fsnotify_unmount_inodes(struct list_head *list) - spin_unlock(&inode->i_lock); - - /* In case the dropping of a reference would nuke next_i. */ -- if ((&next_i->i_sb_list != list) && -- atomic_read(&next_i->i_count)) { -+ while (&next_i->i_sb_list != list) { - spin_lock(&next_i->i_lock); -- if (!(next_i->i_state & (I_FREEING | I_WILL_FREE))) { -+ if (!(next_i->i_state & (I_FREEING | I_WILL_FREE)) && -+ atomic_read(&next_i->i_count)) { - __iget(next_i); - need_iput = next_i; -+ spin_unlock(&next_i->i_lock); -+ break; - } - spin_unlock(&next_i->i_lock); -+ next_i = list_entry(next_i->i_sb_list.next, -+ struct inode, i_sb_list); - } - - /* -- * We can safely drop inode_sb_list_lock here because we hold -- * references on both inode and next_i. Also no new inodes -- * will be added since the umount has begun. -+ * We can safely drop inode_sb_list_lock here because either -+ * we actually hold references on both inode and next_i or -+ * end of list. Also no new inodes will be added since the -+ * umount has begun. - */ - spin_unlock(&inode_sb_list_lock); - -diff --git a/fs/proc/stat.c b/fs/proc/stat.c -index 6f599c6..dbd0272 100644 ---- a/fs/proc/stat.c -+++ b/fs/proc/stat.c -@@ -159,7 +159,7 @@ static int show_stat(struct seq_file *p, void *v) - - /* sum again ? it could be updated? */ - for_each_irq_nr(j) -- seq_put_decimal_ull(p, ' ', kstat_irqs(j)); -+ seq_put_decimal_ull(p, ' ', kstat_irqs_usr(j)); - - seq_printf(p, - "\nctxt %llu\n" -diff --git a/include/linux/kernel_stat.h b/include/linux/kernel_stat.h -index 51c72be..4b2053a 100644 ---- a/include/linux/kernel_stat.h -+++ b/include/linux/kernel_stat.h -@@ -74,6 +74,7 @@ static inline unsigned int kstat_softirqs_cpu(unsigned int irq, int cpu) - * Number of interrupts per specific IRQ source, since bootup - */ - extern unsigned int kstat_irqs(unsigned int irq); -+extern unsigned int kstat_irqs_usr(unsigned int irq); - - /* - * Number of interrupts per cpu, since bootup -diff --git a/include/uapi/linux/in6.h b/include/uapi/linux/in6.h -index e9a1d2d..4c399ae 100644 ---- a/include/uapi/linux/in6.h -+++ b/include/uapi/linux/in6.h -@@ -149,7 +149,7 @@ struct in6_flowlabel_req { - /* - * IPV6 socket options - */ -- -+#if __UAPI_DEF_IPV6_OPTIONS - #define IPV6_ADDRFORM 1 - #define IPV6_2292PKTINFO 2 - #define IPV6_2292HOPOPTS 3 -@@ -192,6 +192,7 @@ struct in6_flowlabel_req { - - #define IPV6_IPSEC_POLICY 34 - #define IPV6_XFRM_POLICY 35 -+#endif - - /* - * Multicast: -diff --git a/include/uapi/linux/libc-compat.h b/include/uapi/linux/libc-compat.h -index c140620..e28807a 100644 ---- a/include/uapi/linux/libc-compat.h -+++ b/include/uapi/linux/libc-compat.h -@@ -69,6 +69,7 @@ - #define __UAPI_DEF_SOCKADDR_IN6 0 - #define __UAPI_DEF_IPV6_MREQ 0 - #define __UAPI_DEF_IPPROTO_V6 0 -+#define __UAPI_DEF_IPV6_OPTIONS 0 - - #else - -@@ -82,6 +83,7 @@ - #define __UAPI_DEF_SOCKADDR_IN6 1 - #define __UAPI_DEF_IPV6_MREQ 1 - #define __UAPI_DEF_IPPROTO_V6 1 -+#define __UAPI_DEF_IPV6_OPTIONS 1 - - #endif /* _NETINET_IN_H */ - -@@ -103,6 +105,7 @@ - #define __UAPI_DEF_SOCKADDR_IN6 1 - #define __UAPI_DEF_IPV6_MREQ 1 - #define __UAPI_DEF_IPPROTO_V6 1 -+#define __UAPI_DEF_IPV6_OPTIONS 1 - - /* Definitions for xattr.h */ - #define __UAPI_DEF_XATTR 1 -diff --git a/kernel/irq/internals.h b/kernel/irq/internals.h -index 001fa5b..8a160e8 100644 ---- a/kernel/irq/internals.h -+++ b/kernel/irq/internals.h -@@ -74,6 +74,14 @@ extern void irq_percpu_disable(struct irq_desc *desc, unsigned int cpu); - extern void mask_irq(struct irq_desc *desc); - extern void unmask_irq(struct irq_desc *desc); - -+#ifdef CONFIG_SPARSE_IRQ -+extern void irq_lock_sparse(void); -+extern void irq_unlock_sparse(void); -+#else -+static inline void irq_lock_sparse(void) { } -+static inline void irq_unlock_sparse(void) { } -+#endif -+ - extern void init_kstat_irqs(struct irq_desc *desc, int node, int nr); - - irqreturn_t handle_irq_event_percpu(struct irq_desc *desc, struct irqaction *action); -diff --git a/kernel/irq/irqdesc.c b/kernel/irq/irqdesc.c -index 8ab8e93..07d4551 100644 ---- a/kernel/irq/irqdesc.c -+++ b/kernel/irq/irqdesc.c -@@ -131,6 +131,16 @@ static void free_masks(struct irq_desc *desc) - static inline void free_masks(struct irq_desc *desc) { } - #endif - -+void irq_lock_sparse(void) -+{ -+ mutex_lock(&sparse_irq_lock); -+} -+ -+void irq_unlock_sparse(void) -+{ -+ mutex_unlock(&sparse_irq_lock); -+} -+ - static struct irq_desc *alloc_desc(int irq, int node, struct module *owner) - { - struct irq_desc *desc; -@@ -167,6 +177,12 @@ static void free_desc(unsigned int irq) - - unregister_irq_proc(irq, desc); - -+ /* -+ * sparse_irq_lock protects also show_interrupts() and -+ * kstat_irq_usr(). Once we deleted the descriptor from the -+ * sparse tree we can free it. Access in proc will fail to -+ * lookup the descriptor. -+ */ - mutex_lock(&sparse_irq_lock); - delete_irq_desc(irq); - mutex_unlock(&sparse_irq_lock); -@@ -489,6 +505,15 @@ void dynamic_irq_cleanup(unsigned int irq) - raw_spin_unlock_irqrestore(&desc->lock, flags); - } - -+/** -+ * kstat_irqs_cpu - Get the statistics for an interrupt on a cpu -+ * @irq: The interrupt number -+ * @cpu: The cpu number -+ * -+ * Returns the sum of interrupt counts on @cpu since boot for -+ * @irq. The caller must ensure that the interrupt is not removed -+ * concurrently. -+ */ - unsigned int kstat_irqs_cpu(unsigned int irq, int cpu) - { - struct irq_desc *desc = irq_to_desc(irq); -@@ -497,6 +522,14 @@ unsigned int kstat_irqs_cpu(unsigned int irq, int cpu) - *per_cpu_ptr(desc->kstat_irqs, cpu) : 0; - } - -+/** -+ * kstat_irqs - Get the statistics for an interrupt -+ * @irq: The interrupt number -+ * -+ * Returns the sum of interrupt counts on all cpus since boot for -+ * @irq. The caller must ensure that the interrupt is not removed -+ * concurrently. -+ */ - unsigned int kstat_irqs(unsigned int irq) - { - struct irq_desc *desc = irq_to_desc(irq); -@@ -509,3 +542,22 @@ unsigned int kstat_irqs(unsigned int irq) - sum += *per_cpu_ptr(desc->kstat_irqs, cpu); - return sum; - } -+ -+/** -+ * kstat_irqs_usr - Get the statistics for an interrupt -+ * @irq: The interrupt number -+ * -+ * Returns the sum of interrupt counts on all cpus since boot for -+ * @irq. Contrary to kstat_irqs() this can be called from any -+ * preemptible context. It's protected against concurrent removal of -+ * an interrupt descriptor when sparse irqs are enabled. -+ */ -+unsigned int kstat_irqs_usr(unsigned int irq) -+{ -+ int sum; -+ -+ irq_lock_sparse(); -+ sum = kstat_irqs(irq); -+ irq_unlock_sparse(); -+ return sum; -+} -diff --git a/kernel/irq/proc.c b/kernel/irq/proc.c -index 36f6ee1..095cd72 100644 ---- a/kernel/irq/proc.c -+++ b/kernel/irq/proc.c -@@ -15,6 +15,23 @@ - - #include "internals.h" - -+/* -+ * Access rules: -+ * -+ * procfs protects read/write of /proc/irq/N/ files against a -+ * concurrent free of the interrupt descriptor. remove_proc_entry() -+ * immediately prevents new read/writes to happen and waits for -+ * already running read/write functions to complete. -+ * -+ * We remove the proc entries first and then delete the interrupt -+ * descriptor from the radix tree and free it. So it is guaranteed -+ * that irq_to_desc(N) is valid as long as the read/writes are -+ * permitted by procfs. -+ * -+ * The read from /proc/interrupts is a different problem because there -+ * is no protection. So the lookup and the access to irqdesc -+ * information must be protected by sparse_irq_lock. -+ */ - static struct proc_dir_entry *root_irq_dir; - - #ifdef CONFIG_SMP -@@ -437,9 +454,10 @@ int show_interrupts(struct seq_file *p, void *v) - seq_putc(p, '\n'); - } - -+ irq_lock_sparse(); - desc = irq_to_desc(i); - if (!desc) -- return 0; -+ goto outsparse; - - raw_spin_lock_irqsave(&desc->lock, flags); - for_each_online_cpu(j) -@@ -479,6 +497,8 @@ int show_interrupts(struct seq_file *p, void *v) - seq_putc(p, '\n'); - out: - raw_spin_unlock_irqrestore(&desc->lock, flags); -+outsparse: -+ irq_unlock_sparse(); - return 0; - } - #endif -diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c -index 6558b7a..8c08a6f 100644 ---- a/kernel/time/tick-sched.c -+++ b/kernel/time/tick-sched.c -@@ -807,7 +807,6 @@ void tick_nohz_idle_enter(void) - - local_irq_enable(); - } --EXPORT_SYMBOL_GPL(tick_nohz_idle_enter); - - /** - * tick_nohz_irq_exit - update next tick event from interrupt exit -@@ -934,7 +933,6 @@ void tick_nohz_idle_exit(void) - - local_irq_enable(); - } --EXPORT_SYMBOL_GPL(tick_nohz_idle_exit); - - static int tick_nohz_reprogram(struct tick_sched *ts, ktime_t now) - { -diff --git a/lib/decompress_bunzip2.c b/lib/decompress_bunzip2.c -index 31c5f76..f504027 100644 ---- a/lib/decompress_bunzip2.c -+++ b/lib/decompress_bunzip2.c -@@ -184,7 +184,7 @@ static int INIT get_next_block(struct bunzip_data *bd) - if (get_bits(bd, 1)) - return RETVAL_OBSOLETE_INPUT; - origPtr = get_bits(bd, 24); -- if (origPtr > dbufSize) -+ if (origPtr >= dbufSize) - return RETVAL_DATA_ERROR; - /* mapping table: if some byte values are never used (encoding things - like ascii text), the compression code removes the gaps to have fewer -diff --git a/net/batman-adv/fragmentation.c b/net/batman-adv/fragmentation.c -index c46387a..e5c5f57 100644 ---- a/net/batman-adv/fragmentation.c -+++ b/net/batman-adv/fragmentation.c -@@ -251,7 +251,7 @@ batadv_frag_merge_packets(struct hlist_head *chain, struct sk_buff *skb) - kfree(entry); - - /* Make room for the rest of the fragments. */ -- if (pskb_expand_head(skb_out, 0, size - skb->len, GFP_ATOMIC) < 0) { -+ if (pskb_expand_head(skb_out, 0, size - skb_out->len, GFP_ATOMIC) < 0) { - kfree_skb(skb_out); - skb_out = NULL; - goto free; -@@ -434,7 +434,7 @@ bool batadv_frag_send_packet(struct sk_buff *skb, - * fragments larger than BATADV_FRAG_MAX_FRAG_SIZE - */ - mtu = min_t(unsigned, mtu, BATADV_FRAG_MAX_FRAG_SIZE); -- max_fragment_size = (mtu - header_size - ETH_HLEN); -+ max_fragment_size = mtu - header_size; - max_packet_size = max_fragment_size * BATADV_FRAG_MAX_FRAGMENTS; - - /* Don't even try to fragment, if we need more than 16 fragments */ -diff --git a/net/batman-adv/gateway_client.c b/net/batman-adv/gateway_client.c -index 36b9ae6..2393ea7 100644 ---- a/net/batman-adv/gateway_client.c -+++ b/net/batman-adv/gateway_client.c -@@ -812,7 +812,7 @@ bool batadv_gw_out_of_range(struct batadv_priv *bat_priv, - goto out; - - gw_node = batadv_gw_node_get(bat_priv, orig_dst_node); -- if (!gw_node->bandwidth_down == 0) -+ if (!gw_node) - goto out; - - switch (atomic_read(&bat_priv->gw_mode)) { -diff --git a/net/core/dev.c b/net/core/dev.c -index 3ed11a5..86bb9cc 100644 ---- a/net/core/dev.c -+++ b/net/core/dev.c -@@ -1709,6 +1709,7 @@ int dev_forward_skb(struct net_device *dev, struct sk_buff *skb) - - skb_scrub_packet(skb, true); - skb->protocol = eth_type_trans(skb, dev); -+ skb_postpull_rcsum(skb, eth_hdr(skb), ETH_HLEN); - - return netif_rx_internal(skb); - } -@@ -2529,11 +2530,14 @@ netdev_features_t netif_skb_dev_features(struct sk_buff *skb, - if (skb_shinfo(skb)->gso_segs > dev->gso_max_segs) - features &= ~NETIF_F_GSO_MASK; - -- if (protocol == htons(ETH_P_8021Q) || protocol == htons(ETH_P_8021AD)) { -- struct vlan_ethhdr *veh = (struct vlan_ethhdr *)skb->data; -- protocol = veh->h_vlan_encapsulated_proto; -- } else if (!vlan_tx_tag_present(skb)) { -- return harmonize_features(skb, dev, features); -+ if (!vlan_tx_tag_present(skb)) { -+ if (unlikely(protocol == htons(ETH_P_8021Q) || -+ protocol == htons(ETH_P_8021AD))) { -+ struct vlan_ethhdr *veh = (struct vlan_ethhdr *)skb->data; -+ protocol = veh->h_vlan_encapsulated_proto; -+ } else { -+ return harmonize_features(skb, dev, features); -+ } - } - - features &= (dev->vlan_features | NETIF_F_HW_VLAN_CTAG_TX | -@@ -4701,9 +4705,14 @@ static void netdev_adjacent_sysfs_del(struct net_device *dev, - sysfs_remove_link(&(dev->dev.kobj), linkname); - } - --#define netdev_adjacent_is_neigh_list(dev, dev_list) \ -- (dev_list == &dev->adj_list.upper || \ -- dev_list == &dev->adj_list.lower) -+static inline bool netdev_adjacent_is_neigh_list(struct net_device *dev, -+ struct net_device *adj_dev, -+ struct list_head *dev_list) -+{ -+ return (dev_list == &dev->adj_list.upper || -+ dev_list == &dev->adj_list.lower) && -+ net_eq(dev_net(dev), dev_net(adj_dev)); -+} - - static int __netdev_adjacent_dev_insert(struct net_device *dev, - struct net_device *adj_dev, -@@ -4733,7 +4742,7 @@ static int __netdev_adjacent_dev_insert(struct net_device *dev, - pr_debug("dev_hold for %s, because of link added from %s to %s\n", - adj_dev->name, dev->name, adj_dev->name); - -- if (netdev_adjacent_is_neigh_list(dev, dev_list)) { -+ if (netdev_adjacent_is_neigh_list(dev, adj_dev, dev_list)) { - ret = netdev_adjacent_sysfs_add(dev, adj_dev, dev_list); - if (ret) - goto free_adj; -@@ -4754,7 +4763,7 @@ static int __netdev_adjacent_dev_insert(struct net_device *dev, - return 0; - - remove_symlinks: -- if (netdev_adjacent_is_neigh_list(dev, dev_list)) -+ if (netdev_adjacent_is_neigh_list(dev, adj_dev, dev_list)) - netdev_adjacent_sysfs_del(dev, adj_dev->name, dev_list); - free_adj: - kfree(adj); -@@ -4787,7 +4796,7 @@ static void __netdev_adjacent_dev_remove(struct net_device *dev, - if (adj->master) - sysfs_remove_link(&(dev->dev.kobj), "master"); - -- if (netdev_adjacent_is_neigh_list(dev, dev_list)) -+ if (netdev_adjacent_is_neigh_list(dev, adj_dev, dev_list)) - netdev_adjacent_sysfs_del(dev, adj_dev->name, dev_list); - - list_del_rcu(&adj->list); -@@ -5057,11 +5066,65 @@ void netdev_upper_dev_unlink(struct net_device *dev, - } - EXPORT_SYMBOL(netdev_upper_dev_unlink); - -+void netdev_adjacent_add_links(struct net_device *dev) -+{ -+ struct netdev_adjacent *iter; -+ -+ struct net *net = dev_net(dev); -+ -+ list_for_each_entry(iter, &dev->adj_list.upper, list) { -+ if (!net_eq(net,dev_net(iter->dev))) -+ continue; -+ netdev_adjacent_sysfs_add(iter->dev, dev, -+ &iter->dev->adj_list.lower); -+ netdev_adjacent_sysfs_add(dev, iter->dev, -+ &dev->adj_list.upper); -+ } -+ -+ list_for_each_entry(iter, &dev->adj_list.lower, list) { -+ if (!net_eq(net,dev_net(iter->dev))) -+ continue; -+ netdev_adjacent_sysfs_add(iter->dev, dev, -+ &iter->dev->adj_list.upper); -+ netdev_adjacent_sysfs_add(dev, iter->dev, -+ &dev->adj_list.lower); -+ } -+} -+ -+void netdev_adjacent_del_links(struct net_device *dev) -+{ -+ struct netdev_adjacent *iter; -+ -+ struct net *net = dev_net(dev); -+ -+ list_for_each_entry(iter, &dev->adj_list.upper, list) { -+ if (!net_eq(net,dev_net(iter->dev))) -+ continue; -+ netdev_adjacent_sysfs_del(iter->dev, dev->name, -+ &iter->dev->adj_list.lower); -+ netdev_adjacent_sysfs_del(dev, iter->dev->name, -+ &dev->adj_list.upper); -+ } -+ -+ list_for_each_entry(iter, &dev->adj_list.lower, list) { -+ if (!net_eq(net,dev_net(iter->dev))) -+ continue; -+ netdev_adjacent_sysfs_del(iter->dev, dev->name, -+ &iter->dev->adj_list.upper); -+ netdev_adjacent_sysfs_del(dev, iter->dev->name, -+ &dev->adj_list.lower); -+ } -+} -+ - void netdev_adjacent_rename_links(struct net_device *dev, char *oldname) - { - struct netdev_adjacent *iter; - -+ struct net *net = dev_net(dev); -+ - list_for_each_entry(iter, &dev->adj_list.upper, list) { -+ if (!net_eq(net,dev_net(iter->dev))) -+ continue; - netdev_adjacent_sysfs_del(iter->dev, oldname, - &iter->dev->adj_list.lower); - netdev_adjacent_sysfs_add(iter->dev, dev, -@@ -5069,6 +5132,8 @@ void netdev_adjacent_rename_links(struct net_device *dev, char *oldname) - } - - list_for_each_entry(iter, &dev->adj_list.lower, list) { -+ if (!net_eq(net,dev_net(iter->dev))) -+ continue; - netdev_adjacent_sysfs_del(iter->dev, oldname, - &iter->dev->adj_list.upper); - netdev_adjacent_sysfs_add(iter->dev, dev, -@@ -6675,6 +6740,7 @@ int dev_change_net_namespace(struct net_device *dev, struct net *net, const char - - /* Send a netdev-removed uevent to the old namespace */ - kobject_uevent(&dev->dev.kobj, KOBJ_REMOVE); -+ netdev_adjacent_del_links(dev); - - /* Actually switch the network namespace */ - dev_net_set(dev, net); -@@ -6689,6 +6755,7 @@ int dev_change_net_namespace(struct net_device *dev, struct net *net, const char - - /* Send a netdev-add uevent to the new namespace */ - kobject_uevent(&dev->dev.kobj, KOBJ_ADD); -+ netdev_adjacent_add_links(dev); - - /* Fixup kobjects */ - err = device_rename(&dev->dev, dev->name); -diff --git a/net/core/skbuff.c b/net/core/skbuff.c -index baf6fc4..e2b1bba 100644 ---- a/net/core/skbuff.c -+++ b/net/core/skbuff.c -@@ -3937,6 +3937,7 @@ void skb_scrub_packet(struct sk_buff *skb, bool xnet) - skb->local_df = 0; - skb_dst_drop(skb); - skb->mark = 0; -+ skb_init_secmark(skb); - secpath_reset(skb); - nf_reset(skb); - nf_reset_trace(skb); -diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c -index 94213c8..b40b90d 100644 ---- a/net/ipv4/ip_gre.c -+++ b/net/ipv4/ip_gre.c -@@ -250,10 +250,6 @@ static netdev_tx_t ipgre_xmit(struct sk_buff *skb, - struct ip_tunnel *tunnel = netdev_priv(dev); - const struct iphdr *tnl_params; - -- skb = gre_handle_offloads(skb, !!(tunnel->parms.o_flags&TUNNEL_CSUM)); -- if (IS_ERR(skb)) -- goto out; -- - if (dev->header_ops) { - /* Need space for new headers */ - if (skb_cow_head(skb, dev->needed_headroom - -@@ -266,6 +262,7 @@ static netdev_tx_t ipgre_xmit(struct sk_buff *skb, - * to gre header. - */ - skb_pull(skb, tunnel->hlen + sizeof(struct iphdr)); -+ skb_reset_mac_header(skb); - } else { - if (skb_cow_head(skb, dev->needed_headroom)) - goto free_skb; -@@ -273,6 +270,10 @@ static netdev_tx_t ipgre_xmit(struct sk_buff *skb, - tnl_params = &tunnel->parms.iph; - } - -+ skb = gre_handle_offloads(skb, !!(tunnel->parms.o_flags&TUNNEL_CSUM)); -+ if (IS_ERR(skb)) -+ goto out; -+ - __gre_xmit(skb, dev, tnl_params, skb->protocol); - - return NETDEV_TX_OK; -diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c -index 91b98e5..7efa26b 100644 ---- a/net/ipv4/tcp_output.c -+++ b/net/ipv4/tcp_output.c -@@ -1894,7 +1894,7 @@ static bool tcp_write_xmit(struct sock *sk, unsigned int mss_now, int nonagle, - if (unlikely(!tcp_snd_wnd_test(tp, skb, mss_now))) - break; - -- if (tso_segs == 1) { -+ if (tso_segs == 1 || !sk->sk_gso_max_segs) { - if (unlikely(!tcp_nagle_test(tp, skb, mss_now, - (tcp_skb_is_last(sk, skb) ? - nonagle : TCP_NAGLE_PUSH)))) -@@ -1931,7 +1931,7 @@ static bool tcp_write_xmit(struct sock *sk, unsigned int mss_now, int nonagle, - } - - limit = mss_now; -- if (tso_segs > 1 && !tcp_urg_mode(tp)) -+ if (tso_segs > 1 && sk->sk_gso_max_segs && !tcp_urg_mode(tp)) - limit = tcp_mss_split_point(sk, skb, mss_now, - min_t(unsigned int, - cwnd_quota, -diff --git a/net/netfilter/ipset/ip_set_core.c b/net/netfilter/ipset/ip_set_core.c -index cf99377..53ea164 100644 ---- a/net/netfilter/ipset/ip_set_core.c -+++ b/net/netfilter/ipset/ip_set_core.c -@@ -1839,6 +1839,12 @@ ip_set_sockfn_get(struct sock *sk, int optval, void __user *user, int *len) - if (*op < IP_SET_OP_VERSION) { - /* Check the version at the beginning of operations */ - struct ip_set_req_version *req_version = data; -+ -+ if (*len < sizeof(struct ip_set_req_version)) { -+ ret = -EINVAL; -+ goto done; -+ } -+ - if (req_version->version != IPSET_PROTOCOL) { - ret = -EPROTO; - goto done; -diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c -index 7c177bc..1d52506 100644 ---- a/net/netlink/af_netlink.c -+++ b/net/netlink/af_netlink.c -@@ -510,14 +510,14 @@ out: - return err; - } - --static void netlink_frame_flush_dcache(const struct nl_mmap_hdr *hdr) -+static void netlink_frame_flush_dcache(const struct nl_mmap_hdr *hdr, unsigned int nm_len) - { - #if ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE == 1 - struct page *p_start, *p_end; - - /* First page is flushed through netlink_{get,set}_status */ - p_start = pgvec_to_page(hdr + PAGE_SIZE); -- p_end = pgvec_to_page((void *)hdr + NL_MMAP_HDRLEN + hdr->nm_len - 1); -+ p_end = pgvec_to_page((void *)hdr + NL_MMAP_HDRLEN + nm_len - 1); - while (p_start <= p_end) { - flush_dcache_page(p_start); - p_start++; -@@ -535,9 +535,9 @@ static enum nl_mmap_status netlink_get_status(const struct nl_mmap_hdr *hdr) - static void netlink_set_status(struct nl_mmap_hdr *hdr, - enum nl_mmap_status status) - { -+ smp_mb(); - hdr->nm_status = status; - flush_dcache_page(pgvec_to_page(hdr)); -- smp_wmb(); - } - - static struct nl_mmap_hdr * -@@ -699,24 +699,16 @@ static int netlink_mmap_sendmsg(struct sock *sk, struct msghdr *msg, - struct nl_mmap_hdr *hdr; - struct sk_buff *skb; - unsigned int maxlen; -- bool excl = true; - int err = 0, len = 0; - -- /* Netlink messages are validated by the receiver before processing. -- * In order to avoid userspace changing the contents of the message -- * after validation, the socket and the ring may only be used by a -- * single process, otherwise we fall back to copying. -- */ -- if (atomic_long_read(&sk->sk_socket->file->f_count) > 1 || -- atomic_read(&nlk->mapped) > 1) -- excl = false; -- - mutex_lock(&nlk->pg_vec_lock); - - ring = &nlk->tx_ring; - maxlen = ring->frame_size - NL_MMAP_HDRLEN; - - do { -+ unsigned int nm_len; -+ - hdr = netlink_current_frame(ring, NL_MMAP_STATUS_VALID); - if (hdr == NULL) { - if (!(msg->msg_flags & MSG_DONTWAIT) && -@@ -724,35 +716,23 @@ static int netlink_mmap_sendmsg(struct sock *sk, struct msghdr *msg, - schedule(); - continue; - } -- if (hdr->nm_len > maxlen) { -+ -+ nm_len = ACCESS_ONCE(hdr->nm_len); -+ if (nm_len > maxlen) { - err = -EINVAL; - goto out; - } - -- netlink_frame_flush_dcache(hdr); -+ netlink_frame_flush_dcache(hdr, nm_len); - -- if (likely(dst_portid == 0 && dst_group == 0 && excl)) { -- skb = alloc_skb_head(GFP_KERNEL); -- if (skb == NULL) { -- err = -ENOBUFS; -- goto out; -- } -- sock_hold(sk); -- netlink_ring_setup_skb(skb, sk, ring, hdr); -- NETLINK_CB(skb).flags |= NETLINK_SKB_TX; -- __skb_put(skb, hdr->nm_len); -- netlink_set_status(hdr, NL_MMAP_STATUS_RESERVED); -- atomic_inc(&ring->pending); -- } else { -- skb = alloc_skb(hdr->nm_len, GFP_KERNEL); -- if (skb == NULL) { -- err = -ENOBUFS; -- goto out; -- } -- __skb_put(skb, hdr->nm_len); -- memcpy(skb->data, (void *)hdr + NL_MMAP_HDRLEN, hdr->nm_len); -- netlink_set_status(hdr, NL_MMAP_STATUS_UNUSED); -+ skb = alloc_skb(nm_len, GFP_KERNEL); -+ if (skb == NULL) { -+ err = -ENOBUFS; -+ goto out; - } -+ __skb_put(skb, nm_len); -+ memcpy(skb->data, (void *)hdr + NL_MMAP_HDRLEN, nm_len); -+ netlink_set_status(hdr, NL_MMAP_STATUS_UNUSED); - - netlink_increment_head(ring); - -@@ -798,7 +778,7 @@ static void netlink_queue_mmaped_skb(struct sock *sk, struct sk_buff *skb) - hdr->nm_pid = NETLINK_CB(skb).creds.pid; - hdr->nm_uid = from_kuid(sk_user_ns(sk), NETLINK_CB(skb).creds.uid); - hdr->nm_gid = from_kgid(sk_user_ns(sk), NETLINK_CB(skb).creds.gid); -- netlink_frame_flush_dcache(hdr); -+ netlink_frame_flush_dcache(hdr, hdr->nm_len); - netlink_set_status(hdr, NL_MMAP_STATUS_VALID); - - NETLINK_CB(skb).flags |= NETLINK_SKB_DELIVERED; -diff --git a/net/wireless/chan.c b/net/wireless/chan.c -index 78559b5..27157a78 100644 ---- a/net/wireless/chan.c -+++ b/net/wireless/chan.c -@@ -516,7 +516,7 @@ bool cfg80211_chandef_usable(struct wiphy *wiphy, - { - struct ieee80211_sta_ht_cap *ht_cap; - struct ieee80211_sta_vht_cap *vht_cap; -- u32 width, control_freq; -+ u32 width, control_freq, cap; - - if (WARN_ON(!cfg80211_chandef_valid(chandef))) - return false; -@@ -554,7 +554,8 @@ bool cfg80211_chandef_usable(struct wiphy *wiphy, - return false; - break; - case NL80211_CHAN_WIDTH_80P80: -- if (!(vht_cap->cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ)) -+ cap = vht_cap->cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK; -+ if (cap != IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ) - return false; - case NL80211_CHAN_WIDTH_80: - if (!vht_cap->vht_supported) -@@ -565,7 +566,9 @@ bool cfg80211_chandef_usable(struct wiphy *wiphy, - case NL80211_CHAN_WIDTH_160: - if (!vht_cap->vht_supported) - return false; -- if (!(vht_cap->cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ)) -+ cap = vht_cap->cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK; -+ if (cap != IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ && -+ cap != IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ) - return false; - prohibited_flags |= IEEE80211_CHAN_NO_160MHZ; - width = 160; -diff --git a/net/wireless/reg.c b/net/wireless/reg.c -index 338794e..04d5305 100644 ---- a/net/wireless/reg.c -+++ b/net/wireless/reg.c -@@ -1547,7 +1547,7 @@ static enum reg_request_treatment - reg_process_hint_driver(struct wiphy *wiphy, - struct regulatory_request *driver_request) - { -- const struct ieee80211_regdomain *regd; -+ const struct ieee80211_regdomain *regd, *tmp; - enum reg_request_treatment treatment; - - treatment = __reg_process_hint_driver(driver_request); -@@ -1566,7 +1566,10 @@ reg_process_hint_driver(struct wiphy *wiphy, - kfree(driver_request); - return REG_REQ_IGNORE; - } -+ -+ tmp = get_wiphy_regdom(wiphy); - rcu_assign_pointer(wiphy->regd, regd); -+ rcu_free_regdom(tmp); - } - - -@@ -1625,11 +1628,8 @@ __reg_process_hint_country_ie(struct wiphy *wiphy, - return REG_REQ_IGNORE; - return REG_REQ_ALREADY_SET; - } -- /* -- * Two consecutive Country IE hints on the same wiphy. -- * This should be picked up early by the driver/stack -- */ -- if (WARN_ON(regdom_changes(country_ie_request->alpha2))) -+ -+ if (regdom_changes(country_ie_request->alpha2)) - return REG_REQ_OK; - return REG_REQ_ALREADY_SET; - } -diff --git a/sound/usb/quirks-table.h b/sound/usb/quirks-table.h -index c657752..83bddbd 100644 ---- a/sound/usb/quirks-table.h -+++ b/sound/usb/quirks-table.h -@@ -2804,133 +2804,45 @@ YAMAHA_DEVICE(0x7010, "UB99"), - } - }, - --/* Hauppauge HVR-950Q and HVR-850 */ --{ -- USB_DEVICE_VENDOR_SPEC(0x2040, 0x7200), -- .match_flags = USB_DEVICE_ID_MATCH_DEVICE | -- USB_DEVICE_ID_MATCH_INT_CLASS | -- USB_DEVICE_ID_MATCH_INT_SUBCLASS, -- .bInterfaceClass = USB_CLASS_AUDIO, -- .bInterfaceSubClass = USB_SUBCLASS_AUDIOCONTROL, -- .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) { -- .vendor_name = "Hauppauge", -- .product_name = "HVR-950Q", -- .ifnum = QUIRK_ANY_INTERFACE, -- .type = QUIRK_AUDIO_ALIGN_TRANSFER, -- } --}, --{ -- USB_DEVICE_VENDOR_SPEC(0x2040, 0x7210), -- .match_flags = USB_DEVICE_ID_MATCH_DEVICE | -- USB_DEVICE_ID_MATCH_INT_CLASS | -- USB_DEVICE_ID_MATCH_INT_SUBCLASS, -- .bInterfaceClass = USB_CLASS_AUDIO, -- .bInterfaceSubClass = USB_SUBCLASS_AUDIOCONTROL, -- .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) { -- .vendor_name = "Hauppauge", -- .product_name = "HVR-950Q", -- .ifnum = QUIRK_ANY_INTERFACE, -- .type = QUIRK_AUDIO_ALIGN_TRANSFER, -- } --}, --{ -- USB_DEVICE_VENDOR_SPEC(0x2040, 0x7217), -- .match_flags = USB_DEVICE_ID_MATCH_DEVICE | -- USB_DEVICE_ID_MATCH_INT_CLASS | -- USB_DEVICE_ID_MATCH_INT_SUBCLASS, -- .bInterfaceClass = USB_CLASS_AUDIO, -- .bInterfaceSubClass = USB_SUBCLASS_AUDIOCONTROL, -- .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) { -- .vendor_name = "Hauppauge", -- .product_name = "HVR-950Q", -- .ifnum = QUIRK_ANY_INTERFACE, -- .type = QUIRK_AUDIO_ALIGN_TRANSFER, -- } --}, --{ -- USB_DEVICE_VENDOR_SPEC(0x2040, 0x721b), -- .match_flags = USB_DEVICE_ID_MATCH_DEVICE | -- USB_DEVICE_ID_MATCH_INT_CLASS | -- USB_DEVICE_ID_MATCH_INT_SUBCLASS, -- .bInterfaceClass = USB_CLASS_AUDIO, -- .bInterfaceSubClass = USB_SUBCLASS_AUDIOCONTROL, -- .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) { -- .vendor_name = "Hauppauge", -- .product_name = "HVR-950Q", -- .ifnum = QUIRK_ANY_INTERFACE, -- .type = QUIRK_AUDIO_ALIGN_TRANSFER, -- } --}, --{ -- USB_DEVICE_VENDOR_SPEC(0x2040, 0x721e), -- .match_flags = USB_DEVICE_ID_MATCH_DEVICE | -- USB_DEVICE_ID_MATCH_INT_CLASS | -- USB_DEVICE_ID_MATCH_INT_SUBCLASS, -- .bInterfaceClass = USB_CLASS_AUDIO, -- .bInterfaceSubClass = USB_SUBCLASS_AUDIOCONTROL, -- .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) { -- .vendor_name = "Hauppauge", -- .product_name = "HVR-950Q", -- .ifnum = QUIRK_ANY_INTERFACE, -- .type = QUIRK_AUDIO_ALIGN_TRANSFER, -- } --}, --{ -- USB_DEVICE_VENDOR_SPEC(0x2040, 0x721f), -- .match_flags = USB_DEVICE_ID_MATCH_DEVICE | -- USB_DEVICE_ID_MATCH_INT_CLASS | -- USB_DEVICE_ID_MATCH_INT_SUBCLASS, -- .bInterfaceClass = USB_CLASS_AUDIO, -- .bInterfaceSubClass = USB_SUBCLASS_AUDIOCONTROL, -- .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) { -- .vendor_name = "Hauppauge", -- .product_name = "HVR-950Q", -- .ifnum = QUIRK_ANY_INTERFACE, -- .type = QUIRK_AUDIO_ALIGN_TRANSFER, -- } --}, --{ -- USB_DEVICE_VENDOR_SPEC(0x2040, 0x7240), -- .match_flags = USB_DEVICE_ID_MATCH_DEVICE | -- USB_DEVICE_ID_MATCH_INT_CLASS | -- USB_DEVICE_ID_MATCH_INT_SUBCLASS, -- .bInterfaceClass = USB_CLASS_AUDIO, -- .bInterfaceSubClass = USB_SUBCLASS_AUDIOCONTROL, -- .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) { -- .vendor_name = "Hauppauge", -- .product_name = "HVR-850", -- .ifnum = QUIRK_ANY_INTERFACE, -- .type = QUIRK_AUDIO_ALIGN_TRANSFER, -- } --}, --{ -- USB_DEVICE_VENDOR_SPEC(0x2040, 0x7280), -- .match_flags = USB_DEVICE_ID_MATCH_DEVICE | -- USB_DEVICE_ID_MATCH_INT_CLASS | -- USB_DEVICE_ID_MATCH_INT_SUBCLASS, -- .bInterfaceClass = USB_CLASS_AUDIO, -- .bInterfaceSubClass = USB_SUBCLASS_AUDIOCONTROL, -- .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) { -- .vendor_name = "Hauppauge", -- .product_name = "HVR-950Q", -- .ifnum = QUIRK_ANY_INTERFACE, -- .type = QUIRK_AUDIO_ALIGN_TRANSFER, -- } --}, --{ -- USB_DEVICE_VENDOR_SPEC(0x0fd9, 0x0008), -- .match_flags = USB_DEVICE_ID_MATCH_DEVICE | -- USB_DEVICE_ID_MATCH_INT_CLASS | -- USB_DEVICE_ID_MATCH_INT_SUBCLASS, -- .bInterfaceClass = USB_CLASS_AUDIO, -- .bInterfaceSubClass = USB_SUBCLASS_AUDIOCONTROL, -- .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) { -- .vendor_name = "Hauppauge", -- .product_name = "HVR-950Q", -- .ifnum = QUIRK_ANY_INTERFACE, -- .type = QUIRK_AUDIO_ALIGN_TRANSFER, -- } --}, -+/* -+ * Auvitek au0828 devices with audio interface. -+ * This should be kept in sync with drivers/media/usb/au0828/au0828-cards.c -+ * Please notice that some drivers are DVB only, and don't need to be -+ * here. That's the case, for example, of DVICO_FUSIONHDTV7. -+ */ -+ -+#define AU0828_DEVICE(vid, pid, vname, pname) { \ -+ USB_DEVICE_VENDOR_SPEC(vid, pid), \ -+ .match_flags = USB_DEVICE_ID_MATCH_DEVICE | \ -+ USB_DEVICE_ID_MATCH_INT_CLASS | \ -+ USB_DEVICE_ID_MATCH_INT_SUBCLASS, \ -+ .bInterfaceClass = USB_CLASS_AUDIO, \ -+ .bInterfaceSubClass = USB_SUBCLASS_AUDIOCONTROL, \ -+ .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) { \ -+ .vendor_name = vname, \ -+ .product_name = pname, \ -+ .ifnum = QUIRK_ANY_INTERFACE, \ -+ .type = QUIRK_AUDIO_ALIGN_TRANSFER, \ -+ } \ -+} -+ -+AU0828_DEVICE(0x2040, 0x7200, "Hauppauge", "HVR-950Q"), -+AU0828_DEVICE(0x2040, 0x7240, "Hauppauge", "HVR-850"), -+AU0828_DEVICE(0x2040, 0x7210, "Hauppauge", "HVR-950Q"), -+AU0828_DEVICE(0x2040, 0x7217, "Hauppauge", "HVR-950Q"), -+AU0828_DEVICE(0x2040, 0x721b, "Hauppauge", "HVR-950Q"), -+AU0828_DEVICE(0x2040, 0x721e, "Hauppauge", "HVR-950Q"), -+AU0828_DEVICE(0x2040, 0x721f, "Hauppauge", "HVR-950Q"), -+AU0828_DEVICE(0x2040, 0x7280, "Hauppauge", "HVR-950Q"), -+AU0828_DEVICE(0x0fd9, 0x0008, "Hauppauge", "HVR-950Q"), -+AU0828_DEVICE(0x2040, 0x7201, "Hauppauge", "HVR-950Q-MXL"), -+AU0828_DEVICE(0x2040, 0x7211, "Hauppauge", "HVR-950Q-MXL"), -+AU0828_DEVICE(0x2040, 0x7281, "Hauppauge", "HVR-950Q-MXL"), -+AU0828_DEVICE(0x05e1, 0x0480, "Hauppauge", "Woodbury"), -+AU0828_DEVICE(0x2040, 0x8200, "Hauppauge", "Woodbury"), -+AU0828_DEVICE(0x2040, 0x7260, "Hauppauge", "HVR-950Q"), -+AU0828_DEVICE(0x2040, 0x7213, "Hauppauge", "HVR-950Q"), -+AU0828_DEVICE(0x2040, 0x7270, "Hauppauge", "HVR-950Q"), - - /* Digidesign Mbox */ - { diff --git a/projects/imx6/patches/linux/linux-000-patch-3.14.30-31.patch b/projects/imx6/patches/linux/linux-000-patch-3.14.30-31.patch deleted file mode 100644 index 880a0175422..00000000000 --- a/projects/imx6/patches/linux/linux-000-patch-3.14.30-31.patch +++ /dev/null @@ -1,5731 +0,0 @@ -diff --git a/Makefile b/Makefile -index 5b94752..5abf670 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,6 +1,6 @@ - VERSION = 3 - PATCHLEVEL = 14 --SUBLEVEL = 30 -+SUBLEVEL = 31 - EXTRAVERSION = - NAME = Remembering Coco - -diff --git a/arch/arc/include/asm/barrier.h b/arch/arc/include/asm/barrier.h -deleted file mode 100644 -index c32245c..0000000 ---- a/arch/arc/include/asm/barrier.h -+++ /dev/null -@@ -1,37 +0,0 @@ --/* -- * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com) -- * -- * This program is free software; you can redistribute it and/or modify -- * it under the terms of the GNU General Public License version 2 as -- * published by the Free Software Foundation. -- */ -- --#ifndef __ASM_BARRIER_H --#define __ASM_BARRIER_H -- --#ifndef __ASSEMBLY__ -- --/* TODO-vineetg: Need to see what this does, don't we need sync anywhere */ --#define mb() __asm__ __volatile__ ("" : : : "memory") --#define rmb() mb() --#define wmb() mb() --#define set_mb(var, value) do { var = value; mb(); } while (0) --#define set_wmb(var, value) do { var = value; wmb(); } while (0) --#define read_barrier_depends() mb() -- --/* TODO-vineetg verify the correctness of macros here */ --#ifdef CONFIG_SMP --#define smp_mb() mb() --#define smp_rmb() rmb() --#define smp_wmb() wmb() --#else --#define smp_mb() barrier() --#define smp_rmb() barrier() --#define smp_wmb() barrier() --#endif -- --#define smp_read_barrier_depends() do { } while (0) -- --#endif -- --#endif -diff --git a/arch/arc/kernel/ctx_sw_asm.S b/arch/arc/kernel/ctx_sw_asm.S -index 2ff0347..e248594 100644 ---- a/arch/arc/kernel/ctx_sw_asm.S -+++ b/arch/arc/kernel/ctx_sw_asm.S -@@ -10,9 +10,9 @@ - * -This is the more "natural" hand written assembler - */ - -+#include <linux/linkage.h> - #include <asm/entry.h> /* For the SAVE_* macros */ - #include <asm/asm-offsets.h> --#include <asm/linkage.h> - - #define KSP_WORD_OFF ((TASK_THREAD + THREAD_KSP) / 4) - -diff --git a/arch/arm/boot/dts/imx25.dtsi b/arch/arm/boot/dts/imx25.dtsi -index 6a26e79..cf3300a 100644 ---- a/arch/arm/boot/dts/imx25.dtsi -+++ b/arch/arm/boot/dts/imx25.dtsi -@@ -352,7 +352,7 @@ - compatible = "fsl,imx25-pwm", "fsl,imx27-pwm"; - #pwm-cells = <2>; - reg = <0x53fa0000 0x4000>; -- clocks = <&clks 106>, <&clks 36>; -+ clocks = <&clks 106>, <&clks 52>; - clock-names = "ipg", "per"; - interrupts = <36>; - }; -@@ -371,7 +371,7 @@ - compatible = "fsl,imx25-pwm", "fsl,imx27-pwm"; - #pwm-cells = <2>; - reg = <0x53fa8000 0x4000>; -- clocks = <&clks 107>, <&clks 36>; -+ clocks = <&clks 107>, <&clks 52>; - clock-names = "ipg", "per"; - interrupts = <41>; - }; -@@ -412,7 +412,7 @@ - pwm4: pwm@53fc8000 { - compatible = "fsl,imx25-pwm", "fsl,imx27-pwm"; - reg = <0x53fc8000 0x4000>; -- clocks = <&clks 108>, <&clks 36>; -+ clocks = <&clks 108>, <&clks 52>; - clock-names = "ipg", "per"; - interrupts = <42>; - }; -@@ -458,7 +458,7 @@ - compatible = "fsl,imx25-pwm", "fsl,imx27-pwm"; - #pwm-cells = <2>; - reg = <0x53fe0000 0x4000>; -- clocks = <&clks 105>, <&clks 36>; -+ clocks = <&clks 105>, <&clks 52>; - clock-names = "ipg", "per"; - interrupts = <26>; - }; -diff --git a/arch/arm/crypto/aes_glue.c b/arch/arm/crypto/aes_glue.c -index 3003fa1..0409b8f 100644 ---- a/arch/arm/crypto/aes_glue.c -+++ b/arch/arm/crypto/aes_glue.c -@@ -93,6 +93,6 @@ module_exit(aes_fini); - - MODULE_DESCRIPTION("Rijndael (AES) Cipher Algorithm (ASM)"); - MODULE_LICENSE("GPL"); --MODULE_ALIAS("aes"); --MODULE_ALIAS("aes-asm"); -+MODULE_ALIAS_CRYPTO("aes"); -+MODULE_ALIAS_CRYPTO("aes-asm"); - MODULE_AUTHOR("David McCullough <ucdevel@gmail.com>"); -diff --git a/arch/arm/crypto/sha1_glue.c b/arch/arm/crypto/sha1_glue.c -index 76cd976..ace4cd6 100644 ---- a/arch/arm/crypto/sha1_glue.c -+++ b/arch/arm/crypto/sha1_glue.c -@@ -175,5 +175,5 @@ module_exit(sha1_mod_fini); - - MODULE_LICENSE("GPL"); - MODULE_DESCRIPTION("SHA1 Secure Hash Algorithm (ARM)"); --MODULE_ALIAS("sha1"); -+MODULE_ALIAS_CRYPTO("sha1"); - MODULE_AUTHOR("David McCullough <ucdevel@gmail.com>"); -diff --git a/arch/powerpc/crypto/sha1.c b/arch/powerpc/crypto/sha1.c -index f9e8b94..b51da91 100644 ---- a/arch/powerpc/crypto/sha1.c -+++ b/arch/powerpc/crypto/sha1.c -@@ -154,4 +154,5 @@ module_exit(sha1_powerpc_mod_fini); - MODULE_LICENSE("GPL"); - MODULE_DESCRIPTION("SHA1 Secure Hash Algorithm"); - --MODULE_ALIAS("sha1-powerpc"); -+MODULE_ALIAS_CRYPTO("sha1"); -+MODULE_ALIAS_CRYPTO("sha1-powerpc"); -diff --git a/arch/s390/crypto/aes_s390.c b/arch/s390/crypto/aes_s390.c -index 23223cd..1f272b2 100644 ---- a/arch/s390/crypto/aes_s390.c -+++ b/arch/s390/crypto/aes_s390.c -@@ -979,7 +979,7 @@ static void __exit aes_s390_fini(void) - module_init(aes_s390_init); - module_exit(aes_s390_fini); - --MODULE_ALIAS("aes-all"); -+MODULE_ALIAS_CRYPTO("aes-all"); - - MODULE_DESCRIPTION("Rijndael (AES) Cipher Algorithm"); - MODULE_LICENSE("GPL"); -diff --git a/arch/s390/crypto/des_s390.c b/arch/s390/crypto/des_s390.c -index 7acb77f..9e05cc4 100644 ---- a/arch/s390/crypto/des_s390.c -+++ b/arch/s390/crypto/des_s390.c -@@ -619,8 +619,8 @@ static void __exit des_s390_exit(void) - module_init(des_s390_init); - module_exit(des_s390_exit); - --MODULE_ALIAS("des"); --MODULE_ALIAS("des3_ede"); -+MODULE_ALIAS_CRYPTO("des"); -+MODULE_ALIAS_CRYPTO("des3_ede"); - - MODULE_LICENSE("GPL"); - MODULE_DESCRIPTION("DES & Triple DES EDE Cipher Algorithms"); -diff --git a/arch/s390/crypto/ghash_s390.c b/arch/s390/crypto/ghash_s390.c -index d43485d..7940dc9 100644 ---- a/arch/s390/crypto/ghash_s390.c -+++ b/arch/s390/crypto/ghash_s390.c -@@ -160,7 +160,7 @@ static void __exit ghash_mod_exit(void) - module_init(ghash_mod_init); - module_exit(ghash_mod_exit); - --MODULE_ALIAS("ghash"); -+MODULE_ALIAS_CRYPTO("ghash"); - - MODULE_LICENSE("GPL"); - MODULE_DESCRIPTION("GHASH Message Digest Algorithm, s390 implementation"); -diff --git a/arch/s390/crypto/sha1_s390.c b/arch/s390/crypto/sha1_s390.c -index a1b3a9d..5b2bee3 100644 ---- a/arch/s390/crypto/sha1_s390.c -+++ b/arch/s390/crypto/sha1_s390.c -@@ -103,6 +103,6 @@ static void __exit sha1_s390_fini(void) - module_init(sha1_s390_init); - module_exit(sha1_s390_fini); - --MODULE_ALIAS("sha1"); -+MODULE_ALIAS_CRYPTO("sha1"); - MODULE_LICENSE("GPL"); - MODULE_DESCRIPTION("SHA1 Secure Hash Algorithm"); -diff --git a/arch/s390/crypto/sha256_s390.c b/arch/s390/crypto/sha256_s390.c -index 9b85380..b74ff15 100644 ---- a/arch/s390/crypto/sha256_s390.c -+++ b/arch/s390/crypto/sha256_s390.c -@@ -143,7 +143,7 @@ static void __exit sha256_s390_fini(void) - module_init(sha256_s390_init); - module_exit(sha256_s390_fini); - --MODULE_ALIAS("sha256"); --MODULE_ALIAS("sha224"); -+MODULE_ALIAS_CRYPTO("sha256"); -+MODULE_ALIAS_CRYPTO("sha224"); - MODULE_LICENSE("GPL"); - MODULE_DESCRIPTION("SHA256 and SHA224 Secure Hash Algorithm"); -diff --git a/arch/s390/crypto/sha512_s390.c b/arch/s390/crypto/sha512_s390.c -index 32a8138..0c36989 100644 ---- a/arch/s390/crypto/sha512_s390.c -+++ b/arch/s390/crypto/sha512_s390.c -@@ -86,7 +86,7 @@ static struct shash_alg sha512_alg = { - } - }; - --MODULE_ALIAS("sha512"); -+MODULE_ALIAS_CRYPTO("sha512"); - - static int sha384_init(struct shash_desc *desc) - { -@@ -126,7 +126,7 @@ static struct shash_alg sha384_alg = { - } - }; - --MODULE_ALIAS("sha384"); -+MODULE_ALIAS_CRYPTO("sha384"); - - static int __init init(void) - { -diff --git a/arch/sparc/crypto/aes_glue.c b/arch/sparc/crypto/aes_glue.c -index 503e6d9..ded4cee3 100644 ---- a/arch/sparc/crypto/aes_glue.c -+++ b/arch/sparc/crypto/aes_glue.c -@@ -499,6 +499,6 @@ module_exit(aes_sparc64_mod_fini); - MODULE_LICENSE("GPL"); - MODULE_DESCRIPTION("AES Secure Hash Algorithm, sparc64 aes opcode accelerated"); - --MODULE_ALIAS("aes"); -+MODULE_ALIAS_CRYPTO("aes"); - - #include "crop_devid.c" -diff --git a/arch/sparc/crypto/camellia_glue.c b/arch/sparc/crypto/camellia_glue.c -index 888f6260..641f55c 100644 ---- a/arch/sparc/crypto/camellia_glue.c -+++ b/arch/sparc/crypto/camellia_glue.c -@@ -322,6 +322,6 @@ module_exit(camellia_sparc64_mod_fini); - MODULE_LICENSE("GPL"); - MODULE_DESCRIPTION("Camellia Cipher Algorithm, sparc64 camellia opcode accelerated"); - --MODULE_ALIAS("aes"); -+MODULE_ALIAS_CRYPTO("aes"); - - #include "crop_devid.c" -diff --git a/arch/sparc/crypto/crc32c_glue.c b/arch/sparc/crypto/crc32c_glue.c -index 5162fad..d1064e4 100644 ---- a/arch/sparc/crypto/crc32c_glue.c -+++ b/arch/sparc/crypto/crc32c_glue.c -@@ -176,6 +176,6 @@ module_exit(crc32c_sparc64_mod_fini); - MODULE_LICENSE("GPL"); - MODULE_DESCRIPTION("CRC32c (Castagnoli), sparc64 crc32c opcode accelerated"); - --MODULE_ALIAS("crc32c"); -+MODULE_ALIAS_CRYPTO("crc32c"); - - #include "crop_devid.c" -diff --git a/arch/sparc/crypto/des_glue.c b/arch/sparc/crypto/des_glue.c -index 3065bc6..d115009 100644 ---- a/arch/sparc/crypto/des_glue.c -+++ b/arch/sparc/crypto/des_glue.c -@@ -532,6 +532,6 @@ module_exit(des_sparc64_mod_fini); - MODULE_LICENSE("GPL"); - MODULE_DESCRIPTION("DES & Triple DES EDE Cipher Algorithms, sparc64 des opcode accelerated"); - --MODULE_ALIAS("des"); -+MODULE_ALIAS_CRYPTO("des"); - - #include "crop_devid.c" -diff --git a/arch/sparc/crypto/md5_glue.c b/arch/sparc/crypto/md5_glue.c -index 09a9ea1..64c7ff5 100644 ---- a/arch/sparc/crypto/md5_glue.c -+++ b/arch/sparc/crypto/md5_glue.c -@@ -185,6 +185,6 @@ module_exit(md5_sparc64_mod_fini); - MODULE_LICENSE("GPL"); - MODULE_DESCRIPTION("MD5 Secure Hash Algorithm, sparc64 md5 opcode accelerated"); - --MODULE_ALIAS("md5"); -+MODULE_ALIAS_CRYPTO("md5"); - - #include "crop_devid.c" -diff --git a/arch/sparc/crypto/sha1_glue.c b/arch/sparc/crypto/sha1_glue.c -index 6cd5f29..1b3e47a 100644 ---- a/arch/sparc/crypto/sha1_glue.c -+++ b/arch/sparc/crypto/sha1_glue.c -@@ -180,6 +180,6 @@ module_exit(sha1_sparc64_mod_fini); - MODULE_LICENSE("GPL"); - MODULE_DESCRIPTION("SHA1 Secure Hash Algorithm, sparc64 sha1 opcode accelerated"); - --MODULE_ALIAS("sha1"); -+MODULE_ALIAS_CRYPTO("sha1"); - - #include "crop_devid.c" -diff --git a/arch/sparc/crypto/sha256_glue.c b/arch/sparc/crypto/sha256_glue.c -index 04f555a..41f27cc 100644 ---- a/arch/sparc/crypto/sha256_glue.c -+++ b/arch/sparc/crypto/sha256_glue.c -@@ -237,7 +237,7 @@ module_exit(sha256_sparc64_mod_fini); - MODULE_LICENSE("GPL"); - MODULE_DESCRIPTION("SHA-224 and SHA-256 Secure Hash Algorithm, sparc64 sha256 opcode accelerated"); - --MODULE_ALIAS("sha224"); --MODULE_ALIAS("sha256"); -+MODULE_ALIAS_CRYPTO("sha224"); -+MODULE_ALIAS_CRYPTO("sha256"); - - #include "crop_devid.c" -diff --git a/arch/sparc/crypto/sha512_glue.c b/arch/sparc/crypto/sha512_glue.c -index f04d199..9fff885 100644 ---- a/arch/sparc/crypto/sha512_glue.c -+++ b/arch/sparc/crypto/sha512_glue.c -@@ -222,7 +222,7 @@ module_exit(sha512_sparc64_mod_fini); - MODULE_LICENSE("GPL"); - MODULE_DESCRIPTION("SHA-384 and SHA-512 Secure Hash Algorithm, sparc64 sha512 opcode accelerated"); - --MODULE_ALIAS("sha384"); --MODULE_ALIAS("sha512"); -+MODULE_ALIAS_CRYPTO("sha384"); -+MODULE_ALIAS_CRYPTO("sha512"); - - #include "crop_devid.c" -diff --git a/arch/tile/mm/homecache.c b/arch/tile/mm/homecache.c -index 004ba56..33294fd 100644 ---- a/arch/tile/mm/homecache.c -+++ b/arch/tile/mm/homecache.c -@@ -417,7 +417,7 @@ void __homecache_free_pages(struct page *page, unsigned int order) - if (put_page_testzero(page)) { - homecache_change_page_home(page, order, PAGE_HOME_HASH); - if (order == 0) { -- free_hot_cold_page(page, 0); -+ free_hot_cold_page(page, false); - } else { - init_page_count(page); - __free_pages(page, order); -diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig -index 98aa930..2f645c9 100644 ---- a/arch/x86/Kconfig -+++ b/arch/x86/Kconfig -@@ -854,7 +854,7 @@ source "kernel/Kconfig.preempt" - - config X86_UP_APIC - bool "Local APIC support on uniprocessors" -- depends on X86_32 && !SMP && !X86_32_NON_STANDARD && !PCI_MSI -+ depends on X86_32 && !SMP && !X86_32_NON_STANDARD - ---help--- - A local APIC (Advanced Programmable Interrupt Controller) is an - integrated interrupt controller in the CPU. If you have a single-CPU -@@ -865,6 +865,10 @@ config X86_UP_APIC - performance counters), and the NMI watchdog which detects hard - lockups. - -+config X86_UP_APIC_MSI -+ def_bool y -+ select X86_UP_APIC if X86_32 && !SMP && !X86_32_NON_STANDARD && PCI_MSI -+ - config X86_UP_IOAPIC - bool "IO-APIC support on uniprocessors" - depends on X86_UP_APIC -diff --git a/arch/x86/boot/compressed/misc.c b/arch/x86/boot/compressed/misc.c -index eb25ca1..8f45c85 100644 ---- a/arch/x86/boot/compressed/misc.c -+++ b/arch/x86/boot/compressed/misc.c -@@ -396,6 +396,8 @@ asmlinkage void *decompress_kernel(void *rmode, memptr heap, - unsigned long output_len, - unsigned long run_size) - { -+ unsigned char *output_orig = output; -+ - real_mode = rmode; - - sanitize_boot_params(real_mode); -@@ -444,7 +446,12 @@ asmlinkage void *decompress_kernel(void *rmode, memptr heap, - debug_putstr("\nDecompressing Linux... "); - decompress(input_data, input_len, NULL, NULL, output, NULL, error); - parse_elf(output); -- handle_relocations(output, output_len); -+ /* -+ * 32-bit always performs relocations. 64-bit relocations are only -+ * needed if kASLR has chosen a different load address. -+ */ -+ if (!IS_ENABLED(CONFIG_X86_64) || output != output_orig) -+ handle_relocations(output, output_len); - debug_putstr("done.\nBooting the kernel.\n"); - return output; - } -diff --git a/arch/x86/crypto/aes_glue.c b/arch/x86/crypto/aes_glue.c -index aafe8ce..e26984f 100644 ---- a/arch/x86/crypto/aes_glue.c -+++ b/arch/x86/crypto/aes_glue.c -@@ -66,5 +66,5 @@ module_exit(aes_fini); - - MODULE_DESCRIPTION("Rijndael (AES) Cipher Algorithm, asm optimized"); - MODULE_LICENSE("GPL"); --MODULE_ALIAS("aes"); --MODULE_ALIAS("aes-asm"); -+MODULE_ALIAS_CRYPTO("aes"); -+MODULE_ALIAS_CRYPTO("aes-asm"); -diff --git a/arch/x86/crypto/aesni-intel_glue.c b/arch/x86/crypto/aesni-intel_glue.c -index 948ad0e..6dfb7d0 100644 ---- a/arch/x86/crypto/aesni-intel_glue.c -+++ b/arch/x86/crypto/aesni-intel_glue.c -@@ -1514,4 +1514,4 @@ module_exit(aesni_exit); - - MODULE_DESCRIPTION("Rijndael (AES) Cipher Algorithm, Intel AES-NI instructions optimized"); - MODULE_LICENSE("GPL"); --MODULE_ALIAS("aes"); -+MODULE_ALIAS_CRYPTO("aes"); -diff --git a/arch/x86/crypto/blowfish_glue.c b/arch/x86/crypto/blowfish_glue.c -index 50ec333..1477cfc 100644 ---- a/arch/x86/crypto/blowfish_glue.c -+++ b/arch/x86/crypto/blowfish_glue.c -@@ -481,5 +481,5 @@ module_exit(fini); - - MODULE_LICENSE("GPL"); - MODULE_DESCRIPTION("Blowfish Cipher Algorithm, asm optimized"); --MODULE_ALIAS("blowfish"); --MODULE_ALIAS("blowfish-asm"); -+MODULE_ALIAS_CRYPTO("blowfish"); -+MODULE_ALIAS_CRYPTO("blowfish-asm"); -diff --git a/arch/x86/crypto/camellia_aesni_avx2_glue.c b/arch/x86/crypto/camellia_aesni_avx2_glue.c -index 4209a76..9a07faf 100644 ---- a/arch/x86/crypto/camellia_aesni_avx2_glue.c -+++ b/arch/x86/crypto/camellia_aesni_avx2_glue.c -@@ -582,5 +582,5 @@ module_exit(camellia_aesni_fini); - - MODULE_LICENSE("GPL"); - MODULE_DESCRIPTION("Camellia Cipher Algorithm, AES-NI/AVX2 optimized"); --MODULE_ALIAS("camellia"); --MODULE_ALIAS("camellia-asm"); -+MODULE_ALIAS_CRYPTO("camellia"); -+MODULE_ALIAS_CRYPTO("camellia-asm"); -diff --git a/arch/x86/crypto/camellia_aesni_avx_glue.c b/arch/x86/crypto/camellia_aesni_avx_glue.c -index 87a041a..ed38d95 100644 ---- a/arch/x86/crypto/camellia_aesni_avx_glue.c -+++ b/arch/x86/crypto/camellia_aesni_avx_glue.c -@@ -574,5 +574,5 @@ module_exit(camellia_aesni_fini); - - MODULE_LICENSE("GPL"); - MODULE_DESCRIPTION("Camellia Cipher Algorithm, AES-NI/AVX optimized"); --MODULE_ALIAS("camellia"); --MODULE_ALIAS("camellia-asm"); -+MODULE_ALIAS_CRYPTO("camellia"); -+MODULE_ALIAS_CRYPTO("camellia-asm"); -diff --git a/arch/x86/crypto/camellia_glue.c b/arch/x86/crypto/camellia_glue.c -index c171dcb..5c8b626 100644 ---- a/arch/x86/crypto/camellia_glue.c -+++ b/arch/x86/crypto/camellia_glue.c -@@ -1725,5 +1725,5 @@ module_exit(fini); - - MODULE_LICENSE("GPL"); - MODULE_DESCRIPTION("Camellia Cipher Algorithm, asm optimized"); --MODULE_ALIAS("camellia"); --MODULE_ALIAS("camellia-asm"); -+MODULE_ALIAS_CRYPTO("camellia"); -+MODULE_ALIAS_CRYPTO("camellia-asm"); -diff --git a/arch/x86/crypto/cast5_avx_glue.c b/arch/x86/crypto/cast5_avx_glue.c -index e6a3700..f62e9db 100644 ---- a/arch/x86/crypto/cast5_avx_glue.c -+++ b/arch/x86/crypto/cast5_avx_glue.c -@@ -494,4 +494,4 @@ module_exit(cast5_exit); - - MODULE_DESCRIPTION("Cast5 Cipher Algorithm, AVX optimized"); - MODULE_LICENSE("GPL"); --MODULE_ALIAS("cast5"); -+MODULE_ALIAS_CRYPTO("cast5"); -diff --git a/arch/x86/crypto/cast6_avx_glue.c b/arch/x86/crypto/cast6_avx_glue.c -index 09f3677..0160f68 100644 ---- a/arch/x86/crypto/cast6_avx_glue.c -+++ b/arch/x86/crypto/cast6_avx_glue.c -@@ -611,4 +611,4 @@ module_exit(cast6_exit); - - MODULE_DESCRIPTION("Cast6 Cipher Algorithm, AVX optimized"); - MODULE_LICENSE("GPL"); --MODULE_ALIAS("cast6"); -+MODULE_ALIAS_CRYPTO("cast6"); -diff --git a/arch/x86/crypto/crc32-pclmul_glue.c b/arch/x86/crypto/crc32-pclmul_glue.c -index 9d014a7..1937fc1 100644 ---- a/arch/x86/crypto/crc32-pclmul_glue.c -+++ b/arch/x86/crypto/crc32-pclmul_glue.c -@@ -197,5 +197,5 @@ module_exit(crc32_pclmul_mod_fini); - MODULE_AUTHOR("Alexander Boyko <alexander_boyko@xyratex.com>"); - MODULE_LICENSE("GPL"); - --MODULE_ALIAS("crc32"); --MODULE_ALIAS("crc32-pclmul"); -+MODULE_ALIAS_CRYPTO("crc32"); -+MODULE_ALIAS_CRYPTO("crc32-pclmul"); -diff --git a/arch/x86/crypto/crc32c-intel_glue.c b/arch/x86/crypto/crc32c-intel_glue.c -index 6812ad9..28640c3 100644 ---- a/arch/x86/crypto/crc32c-intel_glue.c -+++ b/arch/x86/crypto/crc32c-intel_glue.c -@@ -280,5 +280,5 @@ MODULE_AUTHOR("Austin Zhang <austin.zhang@intel.com>, Kent Liu <kent.liu@intel.c - MODULE_DESCRIPTION("CRC32c (Castagnoli) optimization using Intel Hardware."); - MODULE_LICENSE("GPL"); - --MODULE_ALIAS("crc32c"); --MODULE_ALIAS("crc32c-intel"); -+MODULE_ALIAS_CRYPTO("crc32c"); -+MODULE_ALIAS_CRYPTO("crc32c-intel"); -diff --git a/arch/x86/crypto/crct10dif-pclmul_glue.c b/arch/x86/crypto/crct10dif-pclmul_glue.c -index 7845d7f..b6c67bf 100644 ---- a/arch/x86/crypto/crct10dif-pclmul_glue.c -+++ b/arch/x86/crypto/crct10dif-pclmul_glue.c -@@ -147,5 +147,5 @@ MODULE_AUTHOR("Tim Chen <tim.c.chen@linux.intel.com>"); - MODULE_DESCRIPTION("T10 DIF CRC calculation accelerated with PCLMULQDQ."); - MODULE_LICENSE("GPL"); - --MODULE_ALIAS("crct10dif"); --MODULE_ALIAS("crct10dif-pclmul"); -+MODULE_ALIAS_CRYPTO("crct10dif"); -+MODULE_ALIAS_CRYPTO("crct10dif-pclmul"); -diff --git a/arch/x86/crypto/fpu.c b/arch/x86/crypto/fpu.c -index 98d7a18..f368ba2 100644 ---- a/arch/x86/crypto/fpu.c -+++ b/arch/x86/crypto/fpu.c -@@ -17,6 +17,7 @@ - #include <linux/kernel.h> - #include <linux/module.h> - #include <linux/slab.h> -+#include <linux/crypto.h> - #include <asm/i387.h> - - struct crypto_fpu_ctx { -@@ -159,3 +160,5 @@ void __exit crypto_fpu_exit(void) - { - crypto_unregister_template(&crypto_fpu_tmpl); - } -+ -+MODULE_ALIAS_CRYPTO("fpu"); -diff --git a/arch/x86/crypto/ghash-clmulni-intel_glue.c b/arch/x86/crypto/ghash-clmulni-intel_glue.c -index d785cf2..a8d6f69 100644 ---- a/arch/x86/crypto/ghash-clmulni-intel_glue.c -+++ b/arch/x86/crypto/ghash-clmulni-intel_glue.c -@@ -341,4 +341,4 @@ module_exit(ghash_pclmulqdqni_mod_exit); - MODULE_LICENSE("GPL"); - MODULE_DESCRIPTION("GHASH Message Digest Algorithm, " - "acclerated by PCLMULQDQ-NI"); --MODULE_ALIAS("ghash"); -+MODULE_ALIAS_CRYPTO("ghash"); -diff --git a/arch/x86/crypto/salsa20_glue.c b/arch/x86/crypto/salsa20_glue.c -index 5e8e677..399a29d 100644 ---- a/arch/x86/crypto/salsa20_glue.c -+++ b/arch/x86/crypto/salsa20_glue.c -@@ -119,5 +119,5 @@ module_exit(fini); - - MODULE_LICENSE("GPL"); - MODULE_DESCRIPTION ("Salsa20 stream cipher algorithm (optimized assembly version)"); --MODULE_ALIAS("salsa20"); --MODULE_ALIAS("salsa20-asm"); -+MODULE_ALIAS_CRYPTO("salsa20"); -+MODULE_ALIAS_CRYPTO("salsa20-asm"); -diff --git a/arch/x86/crypto/serpent_avx2_glue.c b/arch/x86/crypto/serpent_avx2_glue.c -index 2fae489..437e47a 100644 ---- a/arch/x86/crypto/serpent_avx2_glue.c -+++ b/arch/x86/crypto/serpent_avx2_glue.c -@@ -558,5 +558,5 @@ module_exit(fini); - - MODULE_LICENSE("GPL"); - MODULE_DESCRIPTION("Serpent Cipher Algorithm, AVX2 optimized"); --MODULE_ALIAS("serpent"); --MODULE_ALIAS("serpent-asm"); -+MODULE_ALIAS_CRYPTO("serpent"); -+MODULE_ALIAS_CRYPTO("serpent-asm"); -diff --git a/arch/x86/crypto/serpent_avx_glue.c b/arch/x86/crypto/serpent_avx_glue.c -index ff48708..7e21739 100644 ---- a/arch/x86/crypto/serpent_avx_glue.c -+++ b/arch/x86/crypto/serpent_avx_glue.c -@@ -617,4 +617,4 @@ module_exit(serpent_exit); - - MODULE_DESCRIPTION("Serpent Cipher Algorithm, AVX optimized"); - MODULE_LICENSE("GPL"); --MODULE_ALIAS("serpent"); -+MODULE_ALIAS_CRYPTO("serpent"); -diff --git a/arch/x86/crypto/serpent_sse2_glue.c b/arch/x86/crypto/serpent_sse2_glue.c -index 8c95f86..bf025ad 100644 ---- a/arch/x86/crypto/serpent_sse2_glue.c -+++ b/arch/x86/crypto/serpent_sse2_glue.c -@@ -618,4 +618,4 @@ module_exit(serpent_sse2_exit); - - MODULE_DESCRIPTION("Serpent Cipher Algorithm, SSE2 optimized"); - MODULE_LICENSE("GPL"); --MODULE_ALIAS("serpent"); -+MODULE_ALIAS_CRYPTO("serpent"); -diff --git a/arch/x86/crypto/sha1_ssse3_glue.c b/arch/x86/crypto/sha1_ssse3_glue.c -index 4a11a9d..29e1060 100644 ---- a/arch/x86/crypto/sha1_ssse3_glue.c -+++ b/arch/x86/crypto/sha1_ssse3_glue.c -@@ -237,4 +237,4 @@ module_exit(sha1_ssse3_mod_fini); - MODULE_LICENSE("GPL"); - MODULE_DESCRIPTION("SHA1 Secure Hash Algorithm, Supplemental SSE3 accelerated"); - --MODULE_ALIAS("sha1"); -+MODULE_ALIAS_CRYPTO("sha1"); -diff --git a/arch/x86/crypto/sha256_ssse3_glue.c b/arch/x86/crypto/sha256_ssse3_glue.c -index f248546..4dc100d 100644 ---- a/arch/x86/crypto/sha256_ssse3_glue.c -+++ b/arch/x86/crypto/sha256_ssse3_glue.c -@@ -318,5 +318,5 @@ module_exit(sha256_ssse3_mod_fini); - MODULE_LICENSE("GPL"); - MODULE_DESCRIPTION("SHA256 Secure Hash Algorithm, Supplemental SSE3 accelerated"); - --MODULE_ALIAS("sha256"); --MODULE_ALIAS("sha224"); -+MODULE_ALIAS_CRYPTO("sha256"); -+MODULE_ALIAS_CRYPTO("sha224"); -diff --git a/arch/x86/crypto/sha512_ssse3_glue.c b/arch/x86/crypto/sha512_ssse3_glue.c -index 8626b03..26a5898 100644 ---- a/arch/x86/crypto/sha512_ssse3_glue.c -+++ b/arch/x86/crypto/sha512_ssse3_glue.c -@@ -326,5 +326,5 @@ module_exit(sha512_ssse3_mod_fini); - MODULE_LICENSE("GPL"); - MODULE_DESCRIPTION("SHA512 Secure Hash Algorithm, Supplemental SSE3 accelerated"); - --MODULE_ALIAS("sha512"); --MODULE_ALIAS("sha384"); -+MODULE_ALIAS_CRYPTO("sha512"); -+MODULE_ALIAS_CRYPTO("sha384"); -diff --git a/arch/x86/crypto/twofish_avx_glue.c b/arch/x86/crypto/twofish_avx_glue.c -index 4e3c665..1ac531e 100644 ---- a/arch/x86/crypto/twofish_avx_glue.c -+++ b/arch/x86/crypto/twofish_avx_glue.c -@@ -579,4 +579,4 @@ module_exit(twofish_exit); - - MODULE_DESCRIPTION("Twofish Cipher Algorithm, AVX optimized"); - MODULE_LICENSE("GPL"); --MODULE_ALIAS("twofish"); -+MODULE_ALIAS_CRYPTO("twofish"); -diff --git a/arch/x86/crypto/twofish_glue.c b/arch/x86/crypto/twofish_glue.c -index 0a52023..77e06c2 100644 ---- a/arch/x86/crypto/twofish_glue.c -+++ b/arch/x86/crypto/twofish_glue.c -@@ -96,5 +96,5 @@ module_exit(fini); - - MODULE_LICENSE("GPL"); - MODULE_DESCRIPTION ("Twofish Cipher Algorithm, asm optimized"); --MODULE_ALIAS("twofish"); --MODULE_ALIAS("twofish-asm"); -+MODULE_ALIAS_CRYPTO("twofish"); -+MODULE_ALIAS_CRYPTO("twofish-asm"); -diff --git a/arch/x86/crypto/twofish_glue_3way.c b/arch/x86/crypto/twofish_glue_3way.c -index 13e63b3..56d8a08 100644 ---- a/arch/x86/crypto/twofish_glue_3way.c -+++ b/arch/x86/crypto/twofish_glue_3way.c -@@ -495,5 +495,5 @@ module_exit(fini); - - MODULE_LICENSE("GPL"); - MODULE_DESCRIPTION("Twofish Cipher Algorithm, 3-way parallel asm optimized"); --MODULE_ALIAS("twofish"); --MODULE_ALIAS("twofish-asm"); -+MODULE_ALIAS_CRYPTO("twofish"); -+MODULE_ALIAS_CRYPTO("twofish-asm"); -diff --git a/arch/x86/include/asm/desc.h b/arch/x86/include/asm/desc.h -index 50d033a..a94b82e 100644 ---- a/arch/x86/include/asm/desc.h -+++ b/arch/x86/include/asm/desc.h -@@ -251,7 +251,8 @@ static inline void native_load_tls(struct thread_struct *t, unsigned int cpu) - gdt[GDT_ENTRY_TLS_MIN + i] = t->tls_array[i]; - } - --#define _LDT_empty(info) \ -+/* This intentionally ignores lm, since 32-bit apps don't have that field. */ -+#define LDT_empty(info) \ - ((info)->base_addr == 0 && \ - (info)->limit == 0 && \ - (info)->contents == 0 && \ -@@ -261,11 +262,18 @@ static inline void native_load_tls(struct thread_struct *t, unsigned int cpu) - (info)->seg_not_present == 1 && \ - (info)->useable == 0) - --#ifdef CONFIG_X86_64 --#define LDT_empty(info) (_LDT_empty(info) && ((info)->lm == 0)) --#else --#define LDT_empty(info) (_LDT_empty(info)) --#endif -+/* Lots of programs expect an all-zero user_desc to mean "no segment at all". */ -+static inline bool LDT_zero(const struct user_desc *info) -+{ -+ return (info->base_addr == 0 && -+ info->limit == 0 && -+ info->contents == 0 && -+ info->read_exec_only == 0 && -+ info->seg_32bit == 0 && -+ info->limit_in_pages == 0 && -+ info->seg_not_present == 0 && -+ info->useable == 0); -+} - - static inline void clear_LDT(void) - { -diff --git a/arch/x86/kernel/cpu/mshyperv.c b/arch/x86/kernel/cpu/mshyperv.c -index 832d05a..317c811 100644 ---- a/arch/x86/kernel/cpu/mshyperv.c -+++ b/arch/x86/kernel/cpu/mshyperv.c -@@ -67,6 +67,7 @@ static struct clocksource hyperv_cs = { - .rating = 400, /* use this when running on Hyperv*/ - .read = read_hv_clock, - .mask = CLOCKSOURCE_MASK(64), -+ .flags = CLOCK_SOURCE_IS_CONTINUOUS, - }; - - static void __init ms_hyperv_init_platform(void) -diff --git a/arch/x86/kernel/tls.c b/arch/x86/kernel/tls.c -index 4e942f3..7fc5e84 100644 ---- a/arch/x86/kernel/tls.c -+++ b/arch/x86/kernel/tls.c -@@ -29,7 +29,28 @@ static int get_free_idx(void) - - static bool tls_desc_okay(const struct user_desc *info) - { -- if (LDT_empty(info)) -+ /* -+ * For historical reasons (i.e. no one ever documented how any -+ * of the segmentation APIs work), user programs can and do -+ * assume that a struct user_desc that's all zeros except for -+ * entry_number means "no segment at all". This never actually -+ * worked. In fact, up to Linux 3.19, a struct user_desc like -+ * this would create a 16-bit read-write segment with base and -+ * limit both equal to zero. -+ * -+ * That was close enough to "no segment at all" until we -+ * hardened this function to disallow 16-bit TLS segments. Fix -+ * it up by interpreting these zeroed segments the way that they -+ * were almost certainly intended to be interpreted. -+ * -+ * The correct way to ask for "no segment at all" is to specify -+ * a user_desc that satisfies LDT_empty. To keep everything -+ * working, we accept both. -+ * -+ * Note that there's a similar kludge in modify_ldt -- look at -+ * the distinction between modes 1 and 0x11. -+ */ -+ if (LDT_empty(info) || LDT_zero(info)) - return true; - - /* -@@ -71,7 +92,7 @@ static void set_tls_desc(struct task_struct *p, int idx, - cpu = get_cpu(); - - while (n-- > 0) { -- if (LDT_empty(info)) -+ if (LDT_empty(info) || LDT_zero(info)) - desc->a = desc->b = 0; - else - fill_ldt(desc, info); -diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c -index f9d976e..b1d9002 100644 ---- a/arch/x86/kernel/traps.c -+++ b/arch/x86/kernel/traps.c -@@ -365,7 +365,7 @@ exit: - * for scheduling or signal handling. The actual stack switch is done in - * entry.S - */ --asmlinkage __kprobes struct pt_regs *sync_regs(struct pt_regs *eregs) -+asmlinkage notrace __kprobes struct pt_regs *sync_regs(struct pt_regs *eregs) - { - struct pt_regs *regs = eregs; - /* Did already sync */ -@@ -390,7 +390,7 @@ struct bad_iret_stack { - struct pt_regs regs; - }; - --asmlinkage __visible -+asmlinkage __visible notrace __kprobes - struct bad_iret_stack *fixup_bad_iret(struct bad_iret_stack *s) - { - /* -diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c -index de02906..b20bced 100644 ---- a/arch/x86/kernel/tsc.c -+++ b/arch/x86/kernel/tsc.c -@@ -618,7 +618,7 @@ static unsigned long quick_pit_calibrate(void) - goto success; - } - } -- pr_err("Fast TSC calibration failed\n"); -+ pr_info("Fast TSC calibration failed\n"); - return 0; - - success: -diff --git a/crypto/842.c b/crypto/842.c -index 65c7a89c..b48f4f1 100644 ---- a/crypto/842.c -+++ b/crypto/842.c -@@ -180,3 +180,4 @@ module_exit(nx842_mod_exit); - - MODULE_LICENSE("GPL"); - MODULE_DESCRIPTION("842 Compression Algorithm"); -+MODULE_ALIAS_CRYPTO("842"); -diff --git a/crypto/aes_generic.c b/crypto/aes_generic.c -index fd0d6b4..3dd1011 100644 ---- a/crypto/aes_generic.c -+++ b/crypto/aes_generic.c -@@ -1474,4 +1474,5 @@ module_exit(aes_fini); - - MODULE_DESCRIPTION("Rijndael (AES) Cipher Algorithm"); - MODULE_LICENSE("Dual BSD/GPL"); --MODULE_ALIAS("aes"); -+MODULE_ALIAS_CRYPTO("aes"); -+MODULE_ALIAS_CRYPTO("aes-generic"); -diff --git a/crypto/algapi.c b/crypto/algapi.c -index 7a1ae87..00d8d93 100644 ---- a/crypto/algapi.c -+++ b/crypto/algapi.c -@@ -495,8 +495,8 @@ static struct crypto_template *__crypto_lookup_template(const char *name) - - struct crypto_template *crypto_lookup_template(const char *name) - { -- return try_then_request_module(__crypto_lookup_template(name), "%s", -- name); -+ return try_then_request_module(__crypto_lookup_template(name), -+ "crypto-%s", name); - } - EXPORT_SYMBOL_GPL(crypto_lookup_template); - -diff --git a/crypto/ansi_cprng.c b/crypto/ansi_cprng.c -index 666f196..6f5bebc 100644 ---- a/crypto/ansi_cprng.c -+++ b/crypto/ansi_cprng.c -@@ -476,4 +476,5 @@ module_param(dbg, int, 0); - MODULE_PARM_DESC(dbg, "Boolean to enable debugging (0/1 == off/on)"); - module_init(prng_mod_init); - module_exit(prng_mod_fini); --MODULE_ALIAS("stdrng"); -+MODULE_ALIAS_CRYPTO("stdrng"); -+MODULE_ALIAS_CRYPTO("ansi_cprng"); -diff --git a/crypto/anubis.c b/crypto/anubis.c -index 008c8a4..4bb187c 100644 ---- a/crypto/anubis.c -+++ b/crypto/anubis.c -@@ -704,3 +704,4 @@ module_exit(anubis_mod_fini); - - MODULE_LICENSE("GPL"); - MODULE_DESCRIPTION("Anubis Cryptographic Algorithm"); -+MODULE_ALIAS_CRYPTO("anubis"); -diff --git a/crypto/api.c b/crypto/api.c -index a2b39c5..2a81e98 100644 ---- a/crypto/api.c -+++ b/crypto/api.c -@@ -216,11 +216,11 @@ struct crypto_alg *crypto_larval_lookup(const char *name, u32 type, u32 mask) - - alg = crypto_alg_lookup(name, type, mask); - if (!alg) { -- request_module("%s", name); -+ request_module("crypto-%s", name); - - if (!((type ^ CRYPTO_ALG_NEED_FALLBACK) & mask & - CRYPTO_ALG_NEED_FALLBACK)) -- request_module("%s-all", name); -+ request_module("crypto-%s-all", name); - - alg = crypto_alg_lookup(name, type, mask); - } -diff --git a/crypto/arc4.c b/crypto/arc4.c -index 5a772c3..f1a8192 100644 ---- a/crypto/arc4.c -+++ b/crypto/arc4.c -@@ -166,3 +166,4 @@ module_exit(arc4_exit); - MODULE_LICENSE("GPL"); - MODULE_DESCRIPTION("ARC4 Cipher Algorithm"); - MODULE_AUTHOR("Jon Oberheide <jon@oberheide.org>"); -+MODULE_ALIAS_CRYPTO("arc4"); -diff --git a/crypto/authenc.c b/crypto/authenc.c -index e122355..78fb16c 100644 ---- a/crypto/authenc.c -+++ b/crypto/authenc.c -@@ -721,3 +721,4 @@ module_exit(crypto_authenc_module_exit); - - MODULE_LICENSE("GPL"); - MODULE_DESCRIPTION("Simple AEAD wrapper for IPsec"); -+MODULE_ALIAS_CRYPTO("authenc"); -diff --git a/crypto/authencesn.c b/crypto/authencesn.c -index 4be0dd4..024bff2 100644 ---- a/crypto/authencesn.c -+++ b/crypto/authencesn.c -@@ -814,3 +814,4 @@ module_exit(crypto_authenc_esn_module_exit); - MODULE_LICENSE("GPL"); - MODULE_AUTHOR("Steffen Klassert <steffen.klassert@secunet.com>"); - MODULE_DESCRIPTION("AEAD wrapper for IPsec with extended sequence numbers"); -+MODULE_ALIAS_CRYPTO("authencesn"); -diff --git a/crypto/blowfish_generic.c b/crypto/blowfish_generic.c -index 8baf544..87b392a 100644 ---- a/crypto/blowfish_generic.c -+++ b/crypto/blowfish_generic.c -@@ -138,4 +138,5 @@ module_exit(blowfish_mod_fini); - - MODULE_LICENSE("GPL"); - MODULE_DESCRIPTION("Blowfish Cipher Algorithm"); --MODULE_ALIAS("blowfish"); -+MODULE_ALIAS_CRYPTO("blowfish"); -+MODULE_ALIAS_CRYPTO("blowfish-generic"); -diff --git a/crypto/camellia_generic.c b/crypto/camellia_generic.c -index 26bcd7a..a02286b 100644 ---- a/crypto/camellia_generic.c -+++ b/crypto/camellia_generic.c -@@ -1098,4 +1098,5 @@ module_exit(camellia_fini); - - MODULE_DESCRIPTION("Camellia Cipher Algorithm"); - MODULE_LICENSE("GPL"); --MODULE_ALIAS("camellia"); -+MODULE_ALIAS_CRYPTO("camellia"); -+MODULE_ALIAS_CRYPTO("camellia-generic"); -diff --git a/crypto/cast5_generic.c b/crypto/cast5_generic.c -index 5558f63..df5c726 100644 ---- a/crypto/cast5_generic.c -+++ b/crypto/cast5_generic.c -@@ -549,4 +549,5 @@ module_exit(cast5_mod_fini); - - MODULE_LICENSE("GPL"); - MODULE_DESCRIPTION("Cast5 Cipher Algorithm"); --MODULE_ALIAS("cast5"); -+MODULE_ALIAS_CRYPTO("cast5"); -+MODULE_ALIAS_CRYPTO("cast5-generic"); -diff --git a/crypto/cast6_generic.c b/crypto/cast6_generic.c -index de73252..058c8d7 100644 ---- a/crypto/cast6_generic.c -+++ b/crypto/cast6_generic.c -@@ -291,4 +291,5 @@ module_exit(cast6_mod_fini); - - MODULE_LICENSE("GPL"); - MODULE_DESCRIPTION("Cast6 Cipher Algorithm"); --MODULE_ALIAS("cast6"); -+MODULE_ALIAS_CRYPTO("cast6"); -+MODULE_ALIAS_CRYPTO("cast6-generic"); -diff --git a/crypto/cbc.c b/crypto/cbc.c -index 61ac42e..780ee27 100644 ---- a/crypto/cbc.c -+++ b/crypto/cbc.c -@@ -289,3 +289,4 @@ module_exit(crypto_cbc_module_exit); - - MODULE_LICENSE("GPL"); - MODULE_DESCRIPTION("CBC block cipher algorithm"); -+MODULE_ALIAS_CRYPTO("cbc"); -diff --git a/crypto/ccm.c b/crypto/ccm.c -index 1df8421..003bbbd 100644 ---- a/crypto/ccm.c -+++ b/crypto/ccm.c -@@ -879,5 +879,6 @@ module_exit(crypto_ccm_module_exit); - - MODULE_LICENSE("GPL"); - MODULE_DESCRIPTION("Counter with CBC MAC"); --MODULE_ALIAS("ccm_base"); --MODULE_ALIAS("rfc4309"); -+MODULE_ALIAS_CRYPTO("ccm_base"); -+MODULE_ALIAS_CRYPTO("rfc4309"); -+MODULE_ALIAS_CRYPTO("ccm"); -diff --git a/crypto/chainiv.c b/crypto/chainiv.c -index 834d8dd..22b7e55 100644 ---- a/crypto/chainiv.c -+++ b/crypto/chainiv.c -@@ -359,3 +359,4 @@ module_exit(chainiv_module_exit); - - MODULE_LICENSE("GPL"); - MODULE_DESCRIPTION("Chain IV Generator"); -+MODULE_ALIAS_CRYPTO("chainiv"); -diff --git a/crypto/cmac.c b/crypto/cmac.c -index 50880cf..7a8bfbd 100644 ---- a/crypto/cmac.c -+++ b/crypto/cmac.c -@@ -313,3 +313,4 @@ module_exit(crypto_cmac_module_exit); - - MODULE_LICENSE("GPL"); - MODULE_DESCRIPTION("CMAC keyed hash algorithm"); -+MODULE_ALIAS_CRYPTO("cmac"); -diff --git a/crypto/crc32.c b/crypto/crc32.c -index 9d1c415..187ded2 100644 ---- a/crypto/crc32.c -+++ b/crypto/crc32.c -@@ -156,3 +156,4 @@ module_exit(crc32_mod_fini); - MODULE_AUTHOR("Alexander Boyko <alexander_boyko@xyratex.com>"); - MODULE_DESCRIPTION("CRC32 calculations wrapper for lib/crc32"); - MODULE_LICENSE("GPL"); -+MODULE_ALIAS_CRYPTO("crc32"); -diff --git a/crypto/crct10dif_generic.c b/crypto/crct10dif_generic.c -index 877e711..c1229614 100644 ---- a/crypto/crct10dif_generic.c -+++ b/crypto/crct10dif_generic.c -@@ -124,4 +124,5 @@ module_exit(crct10dif_mod_fini); - MODULE_AUTHOR("Tim Chen <tim.c.chen@linux.intel.com>"); - MODULE_DESCRIPTION("T10 DIF CRC calculation."); - MODULE_LICENSE("GPL"); --MODULE_ALIAS("crct10dif"); -+MODULE_ALIAS_CRYPTO("crct10dif"); -+MODULE_ALIAS_CRYPTO("crct10dif-generic"); -diff --git a/crypto/cryptd.c b/crypto/cryptd.c -index 7bdd61b..75c415d 100644 ---- a/crypto/cryptd.c -+++ b/crypto/cryptd.c -@@ -955,3 +955,4 @@ module_exit(cryptd_exit); - - MODULE_LICENSE("GPL"); - MODULE_DESCRIPTION("Software async crypto daemon"); -+MODULE_ALIAS_CRYPTO("cryptd"); -diff --git a/crypto/crypto_null.c b/crypto/crypto_null.c -index fee7265..7b39fa3 100644 ---- a/crypto/crypto_null.c -+++ b/crypto/crypto_null.c -@@ -149,9 +149,9 @@ static struct crypto_alg null_algs[3] = { { - .coa_decompress = null_compress } } - } }; - --MODULE_ALIAS("compress_null"); --MODULE_ALIAS("digest_null"); --MODULE_ALIAS("cipher_null"); -+MODULE_ALIAS_CRYPTO("compress_null"); -+MODULE_ALIAS_CRYPTO("digest_null"); -+MODULE_ALIAS_CRYPTO("cipher_null"); - - static int __init crypto_null_mod_init(void) - { -diff --git a/crypto/ctr.c b/crypto/ctr.c -index f2b94f2..2386f73 100644 ---- a/crypto/ctr.c -+++ b/crypto/ctr.c -@@ -466,4 +466,5 @@ module_exit(crypto_ctr_module_exit); - - MODULE_LICENSE("GPL"); - MODULE_DESCRIPTION("CTR Counter block mode"); --MODULE_ALIAS("rfc3686"); -+MODULE_ALIAS_CRYPTO("rfc3686"); -+MODULE_ALIAS_CRYPTO("ctr"); -diff --git a/crypto/cts.c b/crypto/cts.c -index 042223f..60b9da3 100644 ---- a/crypto/cts.c -+++ b/crypto/cts.c -@@ -350,3 +350,4 @@ module_exit(crypto_cts_module_exit); - - MODULE_LICENSE("Dual BSD/GPL"); - MODULE_DESCRIPTION("CTS-CBC CipherText Stealing for CBC"); -+MODULE_ALIAS_CRYPTO("cts"); -diff --git a/crypto/deflate.c b/crypto/deflate.c -index b57d70e..95d8d37 100644 ---- a/crypto/deflate.c -+++ b/crypto/deflate.c -@@ -222,4 +222,4 @@ module_exit(deflate_mod_fini); - MODULE_LICENSE("GPL"); - MODULE_DESCRIPTION("Deflate Compression Algorithm for IPCOMP"); - MODULE_AUTHOR("James Morris <jmorris@intercode.com.au>"); -- -+MODULE_ALIAS_CRYPTO("deflate"); -diff --git a/crypto/des_generic.c b/crypto/des_generic.c -index f6cf63f..3ec6071 100644 ---- a/crypto/des_generic.c -+++ b/crypto/des_generic.c -@@ -971,8 +971,6 @@ static struct crypto_alg des_algs[2] = { { - .cia_decrypt = des3_ede_decrypt } } - } }; - --MODULE_ALIAS("des3_ede"); -- - static int __init des_generic_mod_init(void) - { - return crypto_register_algs(des_algs, ARRAY_SIZE(des_algs)); -@@ -989,4 +987,7 @@ module_exit(des_generic_mod_fini); - MODULE_LICENSE("GPL"); - MODULE_DESCRIPTION("DES & Triple DES EDE Cipher Algorithms"); - MODULE_AUTHOR("Dag Arne Osvik <da@osvik.no>"); --MODULE_ALIAS("des"); -+MODULE_ALIAS_CRYPTO("des"); -+MODULE_ALIAS_CRYPTO("des-generic"); -+MODULE_ALIAS_CRYPTO("des3_ede"); -+MODULE_ALIAS_CRYPTO("des3_ede-generic"); -diff --git a/crypto/ecb.c b/crypto/ecb.c -index 935cfef..12011af 100644 ---- a/crypto/ecb.c -+++ b/crypto/ecb.c -@@ -185,3 +185,4 @@ module_exit(crypto_ecb_module_exit); - - MODULE_LICENSE("GPL"); - MODULE_DESCRIPTION("ECB block cipher algorithm"); -+MODULE_ALIAS_CRYPTO("ecb"); -diff --git a/crypto/eseqiv.c b/crypto/eseqiv.c -index 42ce9f5..388f582 100644 ---- a/crypto/eseqiv.c -+++ b/crypto/eseqiv.c -@@ -267,3 +267,4 @@ module_exit(eseqiv_module_exit); - - MODULE_LICENSE("GPL"); - MODULE_DESCRIPTION("Encrypted Sequence Number IV Generator"); -+MODULE_ALIAS_CRYPTO("eseqiv"); -diff --git a/crypto/fcrypt.c b/crypto/fcrypt.c -index 021d7fe..77286ea 100644 ---- a/crypto/fcrypt.c -+++ b/crypto/fcrypt.c -@@ -420,3 +420,4 @@ module_exit(fcrypt_mod_fini); - MODULE_LICENSE("Dual BSD/GPL"); - MODULE_DESCRIPTION("FCrypt Cipher Algorithm"); - MODULE_AUTHOR("David Howells <dhowells@redhat.com>"); -+MODULE_ALIAS_CRYPTO("fcrypt"); -diff --git a/crypto/gcm.c b/crypto/gcm.c -index b4f0179..9cea4d0 100644 ---- a/crypto/gcm.c -+++ b/crypto/gcm.c -@@ -1441,6 +1441,7 @@ module_exit(crypto_gcm_module_exit); - MODULE_LICENSE("GPL"); - MODULE_DESCRIPTION("Galois/Counter Mode"); - MODULE_AUTHOR("Mikko Herranen <mh1@iki.fi>"); --MODULE_ALIAS("gcm_base"); --MODULE_ALIAS("rfc4106"); --MODULE_ALIAS("rfc4543"); -+MODULE_ALIAS_CRYPTO("gcm_base"); -+MODULE_ALIAS_CRYPTO("rfc4106"); -+MODULE_ALIAS_CRYPTO("rfc4543"); -+MODULE_ALIAS_CRYPTO("gcm"); -diff --git a/crypto/ghash-generic.c b/crypto/ghash-generic.c -index 9d3f0c6..bac7099 100644 ---- a/crypto/ghash-generic.c -+++ b/crypto/ghash-generic.c -@@ -172,4 +172,5 @@ module_exit(ghash_mod_exit); - - MODULE_LICENSE("GPL"); - MODULE_DESCRIPTION("GHASH Message Digest Algorithm"); --MODULE_ALIAS("ghash"); -+MODULE_ALIAS_CRYPTO("ghash"); -+MODULE_ALIAS_CRYPTO("ghash-generic"); -diff --git a/crypto/hmac.c b/crypto/hmac.c -index 8d9544c..ade790b 100644 ---- a/crypto/hmac.c -+++ b/crypto/hmac.c -@@ -271,3 +271,4 @@ module_exit(hmac_module_exit); - - MODULE_LICENSE("GPL"); - MODULE_DESCRIPTION("HMAC hash algorithm"); -+MODULE_ALIAS_CRYPTO("hmac"); -diff --git a/crypto/khazad.c b/crypto/khazad.c -index 60e7cd6..873eb5d 100644 ---- a/crypto/khazad.c -+++ b/crypto/khazad.c -@@ -880,3 +880,4 @@ module_exit(khazad_mod_fini); - - MODULE_LICENSE("GPL"); - MODULE_DESCRIPTION("Khazad Cryptographic Algorithm"); -+MODULE_ALIAS_CRYPTO("khazad"); -diff --git a/crypto/krng.c b/crypto/krng.c -index a2d2b72..0224841 100644 ---- a/crypto/krng.c -+++ b/crypto/krng.c -@@ -62,4 +62,5 @@ module_exit(krng_mod_fini); - - MODULE_LICENSE("GPL"); - MODULE_DESCRIPTION("Kernel Random Number Generator"); --MODULE_ALIAS("stdrng"); -+MODULE_ALIAS_CRYPTO("stdrng"); -+MODULE_ALIAS_CRYPTO("krng"); -diff --git a/crypto/lrw.c b/crypto/lrw.c -index ba42acc..6f9908a 100644 ---- a/crypto/lrw.c -+++ b/crypto/lrw.c -@@ -400,3 +400,4 @@ module_exit(crypto_module_exit); - - MODULE_LICENSE("GPL"); - MODULE_DESCRIPTION("LRW block cipher mode"); -+MODULE_ALIAS_CRYPTO("lrw"); -diff --git a/crypto/lz4.c b/crypto/lz4.c -index 4586dd1..53279ab 100644 ---- a/crypto/lz4.c -+++ b/crypto/lz4.c -@@ -104,3 +104,4 @@ module_exit(lz4_mod_fini); - - MODULE_LICENSE("GPL"); - MODULE_DESCRIPTION("LZ4 Compression Algorithm"); -+MODULE_ALIAS_CRYPTO("lz4"); -diff --git a/crypto/lz4hc.c b/crypto/lz4hc.c -index 151ba31..eaec5fa 100644 ---- a/crypto/lz4hc.c -+++ b/crypto/lz4hc.c -@@ -104,3 +104,4 @@ module_exit(lz4hc_mod_fini); - - MODULE_LICENSE("GPL"); - MODULE_DESCRIPTION("LZ4HC Compression Algorithm"); -+MODULE_ALIAS_CRYPTO("lz4hc"); -diff --git a/crypto/lzo.c b/crypto/lzo.c -index 1c2aa69..d1ff694 100644 ---- a/crypto/lzo.c -+++ b/crypto/lzo.c -@@ -103,3 +103,4 @@ module_exit(lzo_mod_fini); - - MODULE_LICENSE("GPL"); - MODULE_DESCRIPTION("LZO Compression Algorithm"); -+MODULE_ALIAS_CRYPTO("lzo"); -diff --git a/crypto/md4.c b/crypto/md4.c -index 0477a6a..3515af4 100644 ---- a/crypto/md4.c -+++ b/crypto/md4.c -@@ -255,4 +255,4 @@ module_exit(md4_mod_fini); - - MODULE_LICENSE("GPL"); - MODULE_DESCRIPTION("MD4 Message Digest Algorithm"); -- -+MODULE_ALIAS_CRYPTO("md4"); -diff --git a/crypto/md5.c b/crypto/md5.c -index 7febeaa..36f5e5b 100644 ---- a/crypto/md5.c -+++ b/crypto/md5.c -@@ -168,3 +168,4 @@ module_exit(md5_mod_fini); - - MODULE_LICENSE("GPL"); - MODULE_DESCRIPTION("MD5 Message Digest Algorithm"); -+MODULE_ALIAS_CRYPTO("md5"); -diff --git a/crypto/michael_mic.c b/crypto/michael_mic.c -index 079b761..46195e0 100644 ---- a/crypto/michael_mic.c -+++ b/crypto/michael_mic.c -@@ -184,3 +184,4 @@ module_exit(michael_mic_exit); - MODULE_LICENSE("GPL v2"); - MODULE_DESCRIPTION("Michael MIC"); - MODULE_AUTHOR("Jouni Malinen <j@w1.fi>"); -+MODULE_ALIAS_CRYPTO("michael_mic"); -diff --git a/crypto/pcbc.c b/crypto/pcbc.c -index d1b8bdf..f654965 100644 ---- a/crypto/pcbc.c -+++ b/crypto/pcbc.c -@@ -295,3 +295,4 @@ module_exit(crypto_pcbc_module_exit); - - MODULE_LICENSE("GPL"); - MODULE_DESCRIPTION("PCBC block cipher algorithm"); -+MODULE_ALIAS_CRYPTO("pcbc"); -diff --git a/crypto/pcrypt.c b/crypto/pcrypt.c -index 309d345..c305d41 100644 ---- a/crypto/pcrypt.c -+++ b/crypto/pcrypt.c -@@ -565,3 +565,4 @@ module_exit(pcrypt_exit); - MODULE_LICENSE("GPL"); - MODULE_AUTHOR("Steffen Klassert <steffen.klassert@secunet.com>"); - MODULE_DESCRIPTION("Parallel crypto wrapper"); -+MODULE_ALIAS_CRYPTO("pcrypt"); -diff --git a/crypto/rmd128.c b/crypto/rmd128.c -index 8a0f68b..049486e 100644 ---- a/crypto/rmd128.c -+++ b/crypto/rmd128.c -@@ -327,3 +327,4 @@ module_exit(rmd128_mod_fini); - MODULE_LICENSE("GPL"); - MODULE_AUTHOR("Adrian-Ken Rueegsegger <ken@codelabs.ch>"); - MODULE_DESCRIPTION("RIPEMD-128 Message Digest"); -+MODULE_ALIAS_CRYPTO("rmd128"); -diff --git a/crypto/rmd160.c b/crypto/rmd160.c -index 525d7bb..de585e5 100644 ---- a/crypto/rmd160.c -+++ b/crypto/rmd160.c -@@ -371,3 +371,4 @@ module_exit(rmd160_mod_fini); - MODULE_LICENSE("GPL"); - MODULE_AUTHOR("Adrian-Ken Rueegsegger <ken@codelabs.ch>"); - MODULE_DESCRIPTION("RIPEMD-160 Message Digest"); -+MODULE_ALIAS_CRYPTO("rmd160"); -diff --git a/crypto/rmd256.c b/crypto/rmd256.c -index 69293d9..4ec02a7 100644 ---- a/crypto/rmd256.c -+++ b/crypto/rmd256.c -@@ -346,3 +346,4 @@ module_exit(rmd256_mod_fini); - MODULE_LICENSE("GPL"); - MODULE_AUTHOR("Adrian-Ken Rueegsegger <ken@codelabs.ch>"); - MODULE_DESCRIPTION("RIPEMD-256 Message Digest"); -+MODULE_ALIAS_CRYPTO("rmd256"); -diff --git a/crypto/rmd320.c b/crypto/rmd320.c -index 09f97df..770f2cb 100644 ---- a/crypto/rmd320.c -+++ b/crypto/rmd320.c -@@ -395,3 +395,4 @@ module_exit(rmd320_mod_fini); - MODULE_LICENSE("GPL"); - MODULE_AUTHOR("Adrian-Ken Rueegsegger <ken@codelabs.ch>"); - MODULE_DESCRIPTION("RIPEMD-320 Message Digest"); -+MODULE_ALIAS_CRYPTO("rmd320"); -diff --git a/crypto/salsa20_generic.c b/crypto/salsa20_generic.c -index 9a4770c..f550b5d 100644 ---- a/crypto/salsa20_generic.c -+++ b/crypto/salsa20_generic.c -@@ -248,4 +248,5 @@ module_exit(salsa20_generic_mod_fini); - - MODULE_LICENSE("GPL"); - MODULE_DESCRIPTION ("Salsa20 stream cipher algorithm"); --MODULE_ALIAS("salsa20"); -+MODULE_ALIAS_CRYPTO("salsa20"); -+MODULE_ALIAS_CRYPTO("salsa20-generic"); -diff --git a/crypto/seed.c b/crypto/seed.c -index 9c904d6..c6ba843 100644 ---- a/crypto/seed.c -+++ b/crypto/seed.c -@@ -476,3 +476,4 @@ module_exit(seed_fini); - MODULE_DESCRIPTION("SEED Cipher Algorithm"); - MODULE_LICENSE("GPL"); - MODULE_AUTHOR("Hye-Shik Chang <perky@FreeBSD.org>, Kim Hyun <hkim@kisa.or.kr>"); -+MODULE_ALIAS_CRYPTO("seed"); -diff --git a/crypto/seqiv.c b/crypto/seqiv.c -index f2cba4ed..49a4069 100644 ---- a/crypto/seqiv.c -+++ b/crypto/seqiv.c -@@ -362,3 +362,4 @@ module_exit(seqiv_module_exit); - - MODULE_LICENSE("GPL"); - MODULE_DESCRIPTION("Sequence Number IV Generator"); -+MODULE_ALIAS_CRYPTO("seqiv"); -diff --git a/crypto/serpent_generic.c b/crypto/serpent_generic.c -index 7ddbd7e..94970a7 100644 ---- a/crypto/serpent_generic.c -+++ b/crypto/serpent_generic.c -@@ -665,5 +665,6 @@ module_exit(serpent_mod_fini); - MODULE_LICENSE("GPL"); - MODULE_DESCRIPTION("Serpent and tnepres (kerneli compatible serpent reversed) Cipher Algorithm"); - MODULE_AUTHOR("Dag Arne Osvik <osvik@ii.uib.no>"); --MODULE_ALIAS("tnepres"); --MODULE_ALIAS("serpent"); -+MODULE_ALIAS_CRYPTO("tnepres"); -+MODULE_ALIAS_CRYPTO("serpent"); -+MODULE_ALIAS_CRYPTO("serpent-generic"); -diff --git a/crypto/sha1_generic.c b/crypto/sha1_generic.c -index 4279480..fdf7c00 100644 ---- a/crypto/sha1_generic.c -+++ b/crypto/sha1_generic.c -@@ -153,4 +153,5 @@ module_exit(sha1_generic_mod_fini); - MODULE_LICENSE("GPL"); - MODULE_DESCRIPTION("SHA1 Secure Hash Algorithm"); - --MODULE_ALIAS("sha1"); -+MODULE_ALIAS_CRYPTO("sha1"); -+MODULE_ALIAS_CRYPTO("sha1-generic"); -diff --git a/crypto/sha256_generic.c b/crypto/sha256_generic.c -index 5433667..136381b 100644 ---- a/crypto/sha256_generic.c -+++ b/crypto/sha256_generic.c -@@ -384,5 +384,7 @@ module_exit(sha256_generic_mod_fini); - MODULE_LICENSE("GPL"); - MODULE_DESCRIPTION("SHA-224 and SHA-256 Secure Hash Algorithm"); - --MODULE_ALIAS("sha224"); --MODULE_ALIAS("sha256"); -+MODULE_ALIAS_CRYPTO("sha224"); -+MODULE_ALIAS_CRYPTO("sha224-generic"); -+MODULE_ALIAS_CRYPTO("sha256"); -+MODULE_ALIAS_CRYPTO("sha256-generic"); -diff --git a/crypto/sha512_generic.c b/crypto/sha512_generic.c -index 6ed124f..6c6d901 100644 ---- a/crypto/sha512_generic.c -+++ b/crypto/sha512_generic.c -@@ -287,5 +287,7 @@ module_exit(sha512_generic_mod_fini); - MODULE_LICENSE("GPL"); - MODULE_DESCRIPTION("SHA-512 and SHA-384 Secure Hash Algorithms"); - --MODULE_ALIAS("sha384"); --MODULE_ALIAS("sha512"); -+MODULE_ALIAS_CRYPTO("sha384"); -+MODULE_ALIAS_CRYPTO("sha384-generic"); -+MODULE_ALIAS_CRYPTO("sha512"); -+MODULE_ALIAS_CRYPTO("sha512-generic"); -diff --git a/crypto/tea.c b/crypto/tea.c -index 0a57232..b70b441 100644 ---- a/crypto/tea.c -+++ b/crypto/tea.c -@@ -270,8 +270,9 @@ static void __exit tea_mod_fini(void) - crypto_unregister_algs(tea_algs, ARRAY_SIZE(tea_algs)); - } - --MODULE_ALIAS("xtea"); --MODULE_ALIAS("xeta"); -+MODULE_ALIAS_CRYPTO("tea"); -+MODULE_ALIAS_CRYPTO("xtea"); -+MODULE_ALIAS_CRYPTO("xeta"); - - module_init(tea_mod_init); - module_exit(tea_mod_fini); -diff --git a/crypto/tgr192.c b/crypto/tgr192.c -index 8740355..f7ed2fb 100644 ---- a/crypto/tgr192.c -+++ b/crypto/tgr192.c -@@ -676,8 +676,9 @@ static void __exit tgr192_mod_fini(void) - crypto_unregister_shashes(tgr_algs, ARRAY_SIZE(tgr_algs)); - } - --MODULE_ALIAS("tgr160"); --MODULE_ALIAS("tgr128"); -+MODULE_ALIAS_CRYPTO("tgr192"); -+MODULE_ALIAS_CRYPTO("tgr160"); -+MODULE_ALIAS_CRYPTO("tgr128"); - - module_init(tgr192_mod_init); - module_exit(tgr192_mod_fini); -diff --git a/crypto/twofish_generic.c b/crypto/twofish_generic.c -index 2d50005..ebf7a3e 100644 ---- a/crypto/twofish_generic.c -+++ b/crypto/twofish_generic.c -@@ -211,4 +211,5 @@ module_exit(twofish_mod_fini); - - MODULE_LICENSE("GPL"); - MODULE_DESCRIPTION ("Twofish Cipher Algorithm"); --MODULE_ALIAS("twofish"); -+MODULE_ALIAS_CRYPTO("twofish"); -+MODULE_ALIAS_CRYPTO("twofish-generic"); -diff --git a/crypto/vmac.c b/crypto/vmac.c -index 2eb11a3..bf2d3a8 100644 ---- a/crypto/vmac.c -+++ b/crypto/vmac.c -@@ -713,3 +713,4 @@ module_exit(vmac_module_exit); - - MODULE_LICENSE("GPL"); - MODULE_DESCRIPTION("VMAC hash algorithm"); -+MODULE_ALIAS_CRYPTO("vmac"); -diff --git a/crypto/wp512.c b/crypto/wp512.c -index 180f1d6..253db94 100644 ---- a/crypto/wp512.c -+++ b/crypto/wp512.c -@@ -1167,8 +1167,9 @@ static void __exit wp512_mod_fini(void) - crypto_unregister_shashes(wp_algs, ARRAY_SIZE(wp_algs)); - } - --MODULE_ALIAS("wp384"); --MODULE_ALIAS("wp256"); -+MODULE_ALIAS_CRYPTO("wp512"); -+MODULE_ALIAS_CRYPTO("wp384"); -+MODULE_ALIAS_CRYPTO("wp256"); - - module_init(wp512_mod_init); - module_exit(wp512_mod_fini); -diff --git a/crypto/xcbc.c b/crypto/xcbc.c -index a5fbdf3..df90b33 100644 ---- a/crypto/xcbc.c -+++ b/crypto/xcbc.c -@@ -286,3 +286,4 @@ module_exit(crypto_xcbc_module_exit); - - MODULE_LICENSE("GPL"); - MODULE_DESCRIPTION("XCBC keyed hash algorithm"); -+MODULE_ALIAS_CRYPTO("xcbc"); -diff --git a/crypto/xts.c b/crypto/xts.c -index ca1608f..f6fd43f 100644 ---- a/crypto/xts.c -+++ b/crypto/xts.c -@@ -362,3 +362,4 @@ module_exit(crypto_module_exit); - - MODULE_LICENSE("GPL"); - MODULE_DESCRIPTION("XTS block cipher mode"); -+MODULE_ALIAS_CRYPTO("xts"); -diff --git a/crypto/zlib.c b/crypto/zlib.c -index 06b62e5..d980788 100644 ---- a/crypto/zlib.c -+++ b/crypto/zlib.c -@@ -378,3 +378,4 @@ module_exit(zlib_mod_fini); - MODULE_LICENSE("GPL"); - MODULE_DESCRIPTION("Zlib Compression Algorithm"); - MODULE_AUTHOR("Sony Corporation"); -+MODULE_ALIAS_CRYPTO("zlib"); -diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c -index 37acda6..136803c 100644 ---- a/drivers/ata/libata-sff.c -+++ b/drivers/ata/libata-sff.c -@@ -1333,7 +1333,19 @@ void ata_sff_flush_pio_task(struct ata_port *ap) - DPRINTK("ENTER\n"); - - cancel_delayed_work_sync(&ap->sff_pio_task); -+ -+ /* -+ * We wanna reset the HSM state to IDLE. If we do so without -+ * grabbing the port lock, critical sections protected by it which -+ * expect the HSM state to stay stable may get surprised. For -+ * example, we may set IDLE in between the time -+ * __ata_sff_port_intr() checks for HSM_ST_IDLE and before it calls -+ * ata_sff_hsm_move() causing ata_sff_hsm_move() to BUG(). -+ */ -+ spin_lock_irq(ap->lock); - ap->hsm_task_state = HSM_ST_IDLE; -+ spin_unlock_irq(ap->lock); -+ - ap->sff_pio_task_link = NULL; - - if (ata_msg_ctl(ap)) -diff --git a/drivers/ata/sata_dwc_460ex.c b/drivers/ata/sata_dwc_460ex.c -index 523524b..f71e09d 100644 ---- a/drivers/ata/sata_dwc_460ex.c -+++ b/drivers/ata/sata_dwc_460ex.c -@@ -799,7 +799,7 @@ static int dma_dwc_init(struct sata_dwc_device *hsdev, int irq) - if (err) { - dev_err(host_pvt.dwc_dev, "%s: dma_request_interrupts returns" - " %d\n", __func__, err); -- goto error_out; -+ return err; - } - - /* Enabe DMA */ -@@ -810,11 +810,6 @@ static int dma_dwc_init(struct sata_dwc_device *hsdev, int irq) - sata_dma_regs); - - return 0; -- --error_out: -- dma_dwc_exit(hsdev); -- -- return err; - } - - static int sata_dwc_scr_read(struct ata_link *link, unsigned int scr, u32 *val) -@@ -1664,7 +1659,7 @@ static int sata_dwc_probe(struct platform_device *ofdev) - char *ver = (char *)&versionr; - u8 *base = NULL; - int err = 0; -- int irq, rc; -+ int irq; - struct ata_host *host; - struct ata_port_info pi = sata_dwc_port_info[0]; - const struct ata_port_info *ppi[] = { &pi, NULL }; -@@ -1727,7 +1722,7 @@ static int sata_dwc_probe(struct platform_device *ofdev) - if (irq == NO_IRQ) { - dev_err(&ofdev->dev, "no SATA DMA irq\n"); - err = -ENODEV; -- goto error_out; -+ goto error_iomap; - } - - /* Get physical SATA DMA register base address */ -@@ -1736,14 +1731,16 @@ static int sata_dwc_probe(struct platform_device *ofdev) - dev_err(&ofdev->dev, "ioremap failed for AHBDMA register" - " address\n"); - err = -ENODEV; -- goto error_out; -+ goto error_iomap; - } - - /* Save dev for later use in dev_xxx() routines */ - host_pvt.dwc_dev = &ofdev->dev; - - /* Initialize AHB DMAC */ -- dma_dwc_init(hsdev, irq); -+ err = dma_dwc_init(hsdev, irq); -+ if (err) -+ goto error_dma_iomap; - - /* Enable SATA Interrupts */ - sata_dwc_enable_interrupts(hsdev); -@@ -1761,9 +1758,8 @@ static int sata_dwc_probe(struct platform_device *ofdev) - * device discovery process, invoking our port_start() handler & - * error_handler() to execute a dummy Softreset EH session - */ -- rc = ata_host_activate(host, irq, sata_dwc_isr, 0, &sata_dwc_sht); -- -- if (rc != 0) -+ err = ata_host_activate(host, irq, sata_dwc_isr, 0, &sata_dwc_sht); -+ if (err) - dev_err(&ofdev->dev, "failed to activate host"); - - dev_set_drvdata(&ofdev->dev, host); -@@ -1772,7 +1768,8 @@ static int sata_dwc_probe(struct platform_device *ofdev) - error_out: - /* Free SATA DMA resources */ - dma_dwc_exit(hsdev); -- -+error_dma_iomap: -+ iounmap((void __iomem *)host_pvt.sata_dma_regs); - error_iomap: - iounmap(base); - error_kmalloc: -@@ -1793,6 +1790,7 @@ static int sata_dwc_remove(struct platform_device *ofdev) - /* Free SATA DMA resources */ - dma_dwc_exit(hsdev); - -+ iounmap((void __iomem *)host_pvt.sata_dma_regs); - iounmap(hsdev->reg_base); - kfree(hsdev); - kfree(host); -diff --git a/drivers/block/drbd/drbd_req.c b/drivers/block/drbd/drbd_req.c -index 104a040..6efdbea 100644 ---- a/drivers/block/drbd/drbd_req.c -+++ b/drivers/block/drbd/drbd_req.c -@@ -1310,6 +1310,7 @@ int drbd_merge_bvec(struct request_queue *q, struct bvec_merge_data *bvm, struct - struct request_queue * const b = - mdev->ldev->backing_bdev->bd_disk->queue; - if (b->merge_bvec_fn) { -+ bvm->bi_bdev = mdev->ldev->backing_bdev; - backing_limit = b->merge_bvec_fn(b, bvm, bvec); - limit = min(limit, backing_limit); - } -diff --git a/drivers/bus/mvebu-mbus.c b/drivers/bus/mvebu-mbus.c -index 372ae72..e990dee 100644 ---- a/drivers/bus/mvebu-mbus.c -+++ b/drivers/bus/mvebu-mbus.c -@@ -181,12 +181,25 @@ static void mvebu_mbus_disable_window(struct mvebu_mbus_state *mbus, - } - - /* Checks whether the given window number is available */ -+ -+/* On Armada XP, 375 and 38x the MBus window 13 has the remap -+ * capability, like windows 0 to 7. However, the mvebu-mbus driver -+ * isn't currently taking into account this special case, which means -+ * that when window 13 is actually used, the remap registers are left -+ * to 0, making the device using this MBus window unavailable. The -+ * quick fix for stable is to not use window 13. A follow up patch -+ * will correctly handle this window. -+*/ - static int mvebu_mbus_window_is_free(struct mvebu_mbus_state *mbus, - const int win) - { - void __iomem *addr = mbus->mbuswins_base + - mbus->soc->win_cfg_offset(win); - u32 ctrl = readl(addr + WIN_CTRL_OFF); -+ -+ if (win == 13) -+ return false; -+ - return !(ctrl & WIN_CTRL_ENABLE); - } - -diff --git a/drivers/clocksource/exynos_mct.c b/drivers/clocksource/exynos_mct.c -index e252939..831b482 100644 ---- a/drivers/clocksource/exynos_mct.c -+++ b/drivers/clocksource/exynos_mct.c -@@ -98,8 +98,8 @@ static void exynos4_mct_write(unsigned int value, unsigned long offset) - __raw_writel(value, reg_base + offset); - - if (likely(offset >= EXYNOS4_MCT_L_BASE(0))) { -- stat_addr = (offset & ~EXYNOS4_MCT_L_MASK) + MCT_L_WSTAT_OFFSET; -- switch (offset & EXYNOS4_MCT_L_MASK) { -+ stat_addr = (offset & EXYNOS4_MCT_L_MASK) + MCT_L_WSTAT_OFFSET; -+ switch (offset & ~EXYNOS4_MCT_L_MASK) { - case MCT_L_TCON_OFFSET: - mask = 1 << 3; /* L_TCON write status */ - break; -diff --git a/drivers/crypto/padlock-aes.c b/drivers/crypto/padlock-aes.c -index 633ba94..c178ed8 100644 ---- a/drivers/crypto/padlock-aes.c -+++ b/drivers/crypto/padlock-aes.c -@@ -563,4 +563,4 @@ MODULE_DESCRIPTION("VIA PadLock AES algorithm support"); - MODULE_LICENSE("GPL"); - MODULE_AUTHOR("Michal Ludvig"); - --MODULE_ALIAS("aes"); -+MODULE_ALIAS_CRYPTO("aes"); -diff --git a/drivers/crypto/padlock-sha.c b/drivers/crypto/padlock-sha.c -index 9266c0e..93d7753 100644 ---- a/drivers/crypto/padlock-sha.c -+++ b/drivers/crypto/padlock-sha.c -@@ -593,7 +593,7 @@ MODULE_DESCRIPTION("VIA PadLock SHA1/SHA256 algorithms support."); - MODULE_LICENSE("GPL"); - MODULE_AUTHOR("Michal Ludvig"); - --MODULE_ALIAS("sha1-all"); --MODULE_ALIAS("sha256-all"); --MODULE_ALIAS("sha1-padlock"); --MODULE_ALIAS("sha256-padlock"); -+MODULE_ALIAS_CRYPTO("sha1-all"); -+MODULE_ALIAS_CRYPTO("sha256-all"); -+MODULE_ALIAS_CRYPTO("sha1-padlock"); -+MODULE_ALIAS_CRYPTO("sha256-padlock"); -diff --git a/drivers/crypto/ux500/cryp/cryp_core.c b/drivers/crypto/ux500/cryp/cryp_core.c -index 92105f3..e4cea7c 100644 ---- a/drivers/crypto/ux500/cryp/cryp_core.c -+++ b/drivers/crypto/ux500/cryp/cryp_core.c -@@ -1810,7 +1810,7 @@ module_exit(ux500_cryp_mod_fini); - module_param(cryp_mode, int, 0); - - MODULE_DESCRIPTION("Driver for ST-Ericsson UX500 CRYP crypto engine."); --MODULE_ALIAS("aes-all"); --MODULE_ALIAS("des-all"); -+MODULE_ALIAS_CRYPTO("aes-all"); -+MODULE_ALIAS_CRYPTO("des-all"); - - MODULE_LICENSE("GPL"); -diff --git a/drivers/crypto/ux500/hash/hash_core.c b/drivers/crypto/ux500/hash/hash_core.c -index 1c73f4f..8e5e018 100644 ---- a/drivers/crypto/ux500/hash/hash_core.c -+++ b/drivers/crypto/ux500/hash/hash_core.c -@@ -1995,7 +1995,7 @@ module_exit(ux500_hash_mod_fini); - MODULE_DESCRIPTION("Driver for ST-Ericsson UX500 HASH engine."); - MODULE_LICENSE("GPL"); - --MODULE_ALIAS("sha1-all"); --MODULE_ALIAS("sha256-all"); --MODULE_ALIAS("hmac-sha1-all"); --MODULE_ALIAS("hmac-sha256-all"); -+MODULE_ALIAS_CRYPTO("sha1-all"); -+MODULE_ALIAS_CRYPTO("sha256-all"); -+MODULE_ALIAS_CRYPTO("hmac-sha1-all"); -+MODULE_ALIAS_CRYPTO("hmac-sha256-all"); -diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c -index 5b88c83..ccbffd0 100644 ---- a/drivers/gpio/gpiolib.c -+++ b/drivers/gpio/gpiolib.c -@@ -408,7 +408,7 @@ static ssize_t gpio_value_store(struct device *dev, - return status; - } - --static const DEVICE_ATTR(value, 0644, -+static DEVICE_ATTR(value, 0644, - gpio_value_show, gpio_value_store); - - static irqreturn_t gpio_sysfs_irq(int irq, void *priv) -@@ -633,18 +633,16 @@ static ssize_t gpio_active_low_store(struct device *dev, - return status ? : size; - } - --static const DEVICE_ATTR(active_low, 0644, -+static DEVICE_ATTR(active_low, 0644, - gpio_active_low_show, gpio_active_low_store); - --static const struct attribute *gpio_attrs[] = { -+static struct attribute *gpio_attrs[] = { - &dev_attr_value.attr, - &dev_attr_active_low.attr, - NULL, - }; - --static const struct attribute_group gpio_attr_group = { -- .attrs = (struct attribute **) gpio_attrs, --}; -+ATTRIBUTE_GROUPS(gpio); - - /* - * /sys/class/gpio/gpiochipN/ -@@ -680,16 +678,13 @@ static ssize_t chip_ngpio_show(struct device *dev, - } - static DEVICE_ATTR(ngpio, 0444, chip_ngpio_show, NULL); - --static const struct attribute *gpiochip_attrs[] = { -+static struct attribute *gpiochip_attrs[] = { - &dev_attr_base.attr, - &dev_attr_label.attr, - &dev_attr_ngpio.attr, - NULL, - }; -- --static const struct attribute_group gpiochip_attr_group = { -- .attrs = (struct attribute **) gpiochip_attrs, --}; -+ATTRIBUTE_GROUPS(gpiochip); - - /* - * /sys/class/gpio/export ... write-only -@@ -844,18 +839,15 @@ int gpiod_export(struct gpio_desc *desc, bool direction_may_change) - if (desc->chip->names && desc->chip->names[offset]) - ioname = desc->chip->names[offset]; - -- dev = device_create(&gpio_class, desc->chip->dev, MKDEV(0, 0), -- desc, ioname ? ioname : "gpio%u", -- desc_to_gpio(desc)); -+ dev = device_create_with_groups(&gpio_class, desc->chip->dev, -+ MKDEV(0, 0), desc, gpio_groups, -+ ioname ? ioname : "gpio%u", -+ desc_to_gpio(desc)); - if (IS_ERR(dev)) { - status = PTR_ERR(dev); - goto fail_unlock; - } - -- status = sysfs_create_group(&dev->kobj, &gpio_attr_group); -- if (status) -- goto fail_unregister_device; -- - if (direction_may_change) { - status = device_create_file(dev, &dev_attr_direction); - if (status) -@@ -866,13 +858,15 @@ int gpiod_export(struct gpio_desc *desc, bool direction_may_change) - !test_bit(FLAG_IS_OUT, &desc->flags))) { - status = device_create_file(dev, &dev_attr_edge); - if (status) -- goto fail_unregister_device; -+ goto fail_remove_attr_direction; - } - - set_bit(FLAG_EXPORT, &desc->flags); - mutex_unlock(&sysfs_lock); - return 0; - -+fail_remove_attr_direction: -+ device_remove_file(dev, &dev_attr_direction); - fail_unregister_device: - device_unregister(dev); - fail_unlock: -@@ -1006,6 +1000,8 @@ void gpiod_unexport(struct gpio_desc *desc) - mutex_unlock(&sysfs_lock); - - if (dev) { -+ device_remove_file(dev, &dev_attr_edge); -+ device_remove_file(dev, &dev_attr_direction); - device_unregister(dev); - put_device(dev); - } -@@ -1030,13 +1026,13 @@ static int gpiochip_export(struct gpio_chip *chip) - - /* use chip->base for the ID; it's already known to be unique */ - mutex_lock(&sysfs_lock); -- dev = device_create(&gpio_class, chip->dev, MKDEV(0, 0), chip, -- "gpiochip%d", chip->base); -- if (!IS_ERR(dev)) { -- status = sysfs_create_group(&dev->kobj, -- &gpiochip_attr_group); -- } else -+ dev = device_create_with_groups(&gpio_class, chip->dev, MKDEV(0, 0), -+ chip, gpiochip_groups, -+ "gpiochip%d", chip->base); -+ if (IS_ERR(dev)) - status = PTR_ERR(dev); -+ else -+ status = 0; - chip->exported = (status == 0); - mutex_unlock(&sysfs_lock); - -diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c -index 7410a50..3153eab 100644 ---- a/drivers/gpu/drm/i915/i915_gem.c -+++ b/drivers/gpu/drm/i915/i915_gem.c -@@ -4978,7 +4978,7 @@ static bool mutex_is_locked_by(struct mutex *mutex, struct task_struct *task) - if (!mutex_is_locked(mutex)) - return false; - --#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_MUTEXES) -+#if defined(CONFIG_SMP) && !defined(CONFIG_DEBUG_MUTEXES) - return mutex->owner == task; - #else - /* Since UP may be pre-empted, we cannot assume that we own the lock */ -diff --git a/drivers/gpu/drm/radeon/radeon_asic.c b/drivers/gpu/drm/radeon/radeon_asic.c -index 5600d4c..64d6cfb 100644 ---- a/drivers/gpu/drm/radeon/radeon_asic.c -+++ b/drivers/gpu/drm/radeon/radeon_asic.c -@@ -335,6 +335,20 @@ static struct radeon_asic_ring r300_gfx_ring = { - .set_wptr = &r100_gfx_set_wptr, - }; - -+static struct radeon_asic_ring rv515_gfx_ring = { -+ .ib_execute = &r100_ring_ib_execute, -+ .emit_fence = &r300_fence_ring_emit, -+ .emit_semaphore = &r100_semaphore_ring_emit, -+ .cs_parse = &r300_cs_parse, -+ .ring_start = &rv515_ring_start, -+ .ring_test = &r100_ring_test, -+ .ib_test = &r100_ib_test, -+ .is_lockup = &r100_gpu_is_lockup, -+ .get_rptr = &r100_gfx_get_rptr, -+ .get_wptr = &r100_gfx_get_wptr, -+ .set_wptr = &r100_gfx_set_wptr, -+}; -+ - static struct radeon_asic r300_asic = { - .init = &r300_init, - .fini = &r300_fini, -@@ -756,7 +770,7 @@ static struct radeon_asic rv515_asic = { - .set_page = &rv370_pcie_gart_set_page, - }, - .ring = { -- [RADEON_RING_TYPE_GFX_INDEX] = &r300_gfx_ring -+ [RADEON_RING_TYPE_GFX_INDEX] = &rv515_gfx_ring - }, - .irq = { - .set = &rs600_irq_set, -@@ -823,7 +837,7 @@ static struct radeon_asic r520_asic = { - .set_page = &rv370_pcie_gart_set_page, - }, - .ring = { -- [RADEON_RING_TYPE_GFX_INDEX] = &r300_gfx_ring -+ [RADEON_RING_TYPE_GFX_INDEX] = &rv515_gfx_ring - }, - .irq = { - .set = &rs600_irq_set, -diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c -index cfb513f..0095ee7 100644 ---- a/drivers/gpu/drm/radeon/radeon_pm.c -+++ b/drivers/gpu/drm/radeon/radeon_pm.c -@@ -1260,8 +1260,39 @@ dpm_failed: - return ret; - } - -+struct radeon_dpm_quirk { -+ u32 chip_vendor; -+ u32 chip_device; -+ u32 subsys_vendor; -+ u32 subsys_device; -+}; -+ -+/* cards with dpm stability problems */ -+static struct radeon_dpm_quirk radeon_dpm_quirk_list[] = { -+ /* TURKS - https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1386534 */ -+ { PCI_VENDOR_ID_ATI, 0x6759, 0x1682, 0x3195 }, -+ /* TURKS - https://bugzilla.kernel.org/show_bug.cgi?id=83731 */ -+ { PCI_VENDOR_ID_ATI, 0x6840, 0x1179, 0xfb81 }, -+ { 0, 0, 0, 0 }, -+}; -+ - int radeon_pm_init(struct radeon_device *rdev) - { -+ struct radeon_dpm_quirk *p = radeon_dpm_quirk_list; -+ bool disable_dpm = false; -+ -+ /* Apply dpm quirks */ -+ while (p && p->chip_device != 0) { -+ if (rdev->pdev->vendor == p->chip_vendor && -+ rdev->pdev->device == p->chip_device && -+ rdev->pdev->subsystem_vendor == p->subsys_vendor && -+ rdev->pdev->subsystem_device == p->subsys_device) { -+ disable_dpm = true; -+ break; -+ } -+ ++p; -+ } -+ - /* enable dpm on rv6xx+ */ - switch (rdev->family) { - case CHIP_RV610: -@@ -1316,6 +1347,8 @@ int radeon_pm_init(struct radeon_device *rdev) - (!(rdev->flags & RADEON_IS_IGP)) && - (!rdev->smc_fw)) - rdev->pm.pm_method = PM_METHOD_PROFILE; -+ else if (disable_dpm && (radeon_dpm == -1)) -+ rdev->pm.pm_method = PM_METHOD_PROFILE; - else if (radeon_dpm == 0) - rdev->pm.pm_method = PM_METHOD_PROFILE; - else -diff --git a/drivers/gpu/drm/radeon/si_dpm.c b/drivers/gpu/drm/radeon/si_dpm.c -index 879e628..35bf2bb 100644 ---- a/drivers/gpu/drm/radeon/si_dpm.c -+++ b/drivers/gpu/drm/radeon/si_dpm.c -@@ -2900,6 +2900,22 @@ static int si_init_smc_spll_table(struct radeon_device *rdev) - return ret; - } - -+struct si_dpm_quirk { -+ u32 chip_vendor; -+ u32 chip_device; -+ u32 subsys_vendor; -+ u32 subsys_device; -+ u32 max_sclk; -+ u32 max_mclk; -+}; -+ -+/* cards with dpm stability problems */ -+static struct si_dpm_quirk si_dpm_quirk_list[] = { -+ /* PITCAIRN - https://bugs.freedesktop.org/show_bug.cgi?id=76490 */ -+ { PCI_VENDOR_ID_ATI, 0x6810, 0x1462, 0x3036, 0, 120000 }, -+ { 0, 0, 0, 0 }, -+}; -+ - static void si_apply_state_adjust_rules(struct radeon_device *rdev, - struct radeon_ps *rps) - { -@@ -2910,7 +2926,22 @@ static void si_apply_state_adjust_rules(struct radeon_device *rdev, - u32 mclk, sclk; - u16 vddc, vddci; - u32 max_sclk_vddc, max_mclk_vddci, max_mclk_vddc; -+ u32 max_sclk = 0, max_mclk = 0; - int i; -+ struct si_dpm_quirk *p = si_dpm_quirk_list; -+ -+ /* Apply dpm quirks */ -+ while (p && p->chip_device != 0) { -+ if (rdev->pdev->vendor == p->chip_vendor && -+ rdev->pdev->device == p->chip_device && -+ rdev->pdev->subsystem_vendor == p->subsys_vendor && -+ rdev->pdev->subsystem_device == p->subsys_device) { -+ max_sclk = p->max_sclk; -+ max_mclk = p->max_mclk; -+ break; -+ } -+ ++p; -+ } - - if ((rdev->pm.dpm.new_active_crtc_count > 1) || - ni_dpm_vblank_too_short(rdev)) -@@ -2964,6 +2995,14 @@ static void si_apply_state_adjust_rules(struct radeon_device *rdev, - if (ps->performance_levels[i].mclk > max_mclk_vddc) - ps->performance_levels[i].mclk = max_mclk_vddc; - } -+ if (max_mclk) { -+ if (ps->performance_levels[i].mclk > max_mclk) -+ ps->performance_levels[i].mclk = max_mclk; -+ } -+ if (max_sclk) { -+ if (ps->performance_levels[i].sclk > max_sclk) -+ ps->performance_levels[i].sclk = max_sclk; -+ } - } - - /* XXX validate the min clocks required for display */ -diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c -index ce953d8..fb787c3 100644 ---- a/drivers/input/evdev.c -+++ b/drivers/input/evdev.c -@@ -757,20 +757,23 @@ static int evdev_handle_set_keycode_v2(struct input_dev *dev, void __user *p) - */ - static int evdev_handle_get_val(struct evdev_client *client, - struct input_dev *dev, unsigned int type, -- unsigned long *bits, unsigned int max, -- unsigned int size, void __user *p, int compat) -+ unsigned long *bits, unsigned int maxbit, -+ unsigned int maxlen, void __user *p, -+ int compat) - { - int ret; - unsigned long *mem; -+ size_t len; - -- mem = kmalloc(sizeof(unsigned long) * max, GFP_KERNEL); -+ len = BITS_TO_LONGS(maxbit) * sizeof(unsigned long); -+ mem = kmalloc(len, GFP_KERNEL); - if (!mem) - return -ENOMEM; - - spin_lock_irq(&dev->event_lock); - spin_lock(&client->buffer_lock); - -- memcpy(mem, bits, sizeof(unsigned long) * max); -+ memcpy(mem, bits, len); - - spin_unlock(&dev->event_lock); - -@@ -778,7 +781,7 @@ static int evdev_handle_get_val(struct evdev_client *client, - - spin_unlock_irq(&client->buffer_lock); - -- ret = bits_to_user(mem, max, size, p, compat); -+ ret = bits_to_user(mem, maxbit, maxlen, p, compat); - if (ret < 0) - evdev_queue_syn_dropped(client); - -diff --git a/drivers/md/dm-cache-metadata.c b/drivers/md/dm-cache-metadata.c -index a87d3fa..d290e83 100644 ---- a/drivers/md/dm-cache-metadata.c -+++ b/drivers/md/dm-cache-metadata.c -@@ -94,6 +94,9 @@ struct cache_disk_superblock { - } __packed; - - struct dm_cache_metadata { -+ atomic_t ref_count; -+ struct list_head list; -+ - struct block_device *bdev; - struct dm_block_manager *bm; - struct dm_space_map *metadata_sm; -@@ -669,10 +672,10 @@ static void unpack_value(__le64 value_le, dm_oblock_t *block, unsigned *flags) - - /*----------------------------------------------------------------*/ - --struct dm_cache_metadata *dm_cache_metadata_open(struct block_device *bdev, -- sector_t data_block_size, -- bool may_format_device, -- size_t policy_hint_size) -+static struct dm_cache_metadata *metadata_open(struct block_device *bdev, -+ sector_t data_block_size, -+ bool may_format_device, -+ size_t policy_hint_size) - { - int r; - struct dm_cache_metadata *cmd; -@@ -683,6 +686,7 @@ struct dm_cache_metadata *dm_cache_metadata_open(struct block_device *bdev, - return NULL; - } - -+ atomic_set(&cmd->ref_count, 1); - init_rwsem(&cmd->root_lock); - cmd->bdev = bdev; - cmd->data_block_size = data_block_size; -@@ -705,10 +709,95 @@ struct dm_cache_metadata *dm_cache_metadata_open(struct block_device *bdev, - return cmd; - } - -+/* -+ * We keep a little list of ref counted metadata objects to prevent two -+ * different target instances creating separate bufio instances. This is -+ * an issue if a table is reloaded before the suspend. -+ */ -+static DEFINE_MUTEX(table_lock); -+static LIST_HEAD(table); -+ -+static struct dm_cache_metadata *lookup(struct block_device *bdev) -+{ -+ struct dm_cache_metadata *cmd; -+ -+ list_for_each_entry(cmd, &table, list) -+ if (cmd->bdev == bdev) { -+ atomic_inc(&cmd->ref_count); -+ return cmd; -+ } -+ -+ return NULL; -+} -+ -+static struct dm_cache_metadata *lookup_or_open(struct block_device *bdev, -+ sector_t data_block_size, -+ bool may_format_device, -+ size_t policy_hint_size) -+{ -+ struct dm_cache_metadata *cmd, *cmd2; -+ -+ mutex_lock(&table_lock); -+ cmd = lookup(bdev); -+ mutex_unlock(&table_lock); -+ -+ if (cmd) -+ return cmd; -+ -+ cmd = metadata_open(bdev, data_block_size, may_format_device, policy_hint_size); -+ if (cmd) { -+ mutex_lock(&table_lock); -+ cmd2 = lookup(bdev); -+ if (cmd2) { -+ mutex_unlock(&table_lock); -+ __destroy_persistent_data_objects(cmd); -+ kfree(cmd); -+ return cmd2; -+ } -+ list_add(&cmd->list, &table); -+ mutex_unlock(&table_lock); -+ } -+ -+ return cmd; -+} -+ -+static bool same_params(struct dm_cache_metadata *cmd, sector_t data_block_size) -+{ -+ if (cmd->data_block_size != data_block_size) { -+ DMERR("data_block_size (%llu) different from that in metadata (%llu)\n", -+ (unsigned long long) data_block_size, -+ (unsigned long long) cmd->data_block_size); -+ return false; -+ } -+ -+ return true; -+} -+ -+struct dm_cache_metadata *dm_cache_metadata_open(struct block_device *bdev, -+ sector_t data_block_size, -+ bool may_format_device, -+ size_t policy_hint_size) -+{ -+ struct dm_cache_metadata *cmd = lookup_or_open(bdev, data_block_size, -+ may_format_device, policy_hint_size); -+ if (cmd && !same_params(cmd, data_block_size)) { -+ dm_cache_metadata_close(cmd); -+ return NULL; -+ } -+ -+ return cmd; -+} -+ - void dm_cache_metadata_close(struct dm_cache_metadata *cmd) - { -- __destroy_persistent_data_objects(cmd); -- kfree(cmd); -+ if (atomic_dec_and_test(&cmd->ref_count)) { -+ mutex_lock(&table_lock); -+ list_del(&cmd->list); -+ mutex_unlock(&table_lock); -+ -+ __destroy_persistent_data_objects(cmd); -+ kfree(cmd); -+ } - } - - /* -diff --git a/drivers/md/dm-cache-target.c b/drivers/md/dm-cache-target.c -index ff284b7..c10dec0 100644 ---- a/drivers/md/dm-cache-target.c -+++ b/drivers/md/dm-cache-target.c -@@ -222,7 +222,13 @@ struct cache { - struct list_head need_commit_migrations; - sector_t migration_threshold; - wait_queue_head_t migration_wait; -- atomic_t nr_migrations; -+ atomic_t nr_allocated_migrations; -+ -+ /* -+ * The number of in flight migrations that are performing -+ * background io. eg, promotion, writeback. -+ */ -+ atomic_t nr_io_migrations; - - wait_queue_head_t quiescing_wait; - atomic_t quiescing; -@@ -259,7 +265,6 @@ struct cache { - struct dm_deferred_set *all_io_ds; - - mempool_t *migration_pool; -- struct dm_cache_migration *next_migration; - - struct dm_cache_policy *policy; - unsigned policy_nr_args; -@@ -350,10 +355,31 @@ static void free_prison_cell(struct cache *cache, struct dm_bio_prison_cell *cel - dm_bio_prison_free_cell(cache->prison, cell); - } - -+static struct dm_cache_migration *alloc_migration(struct cache *cache) -+{ -+ struct dm_cache_migration *mg; -+ -+ mg = mempool_alloc(cache->migration_pool, GFP_NOWAIT); -+ if (mg) { -+ mg->cache = cache; -+ atomic_inc(&mg->cache->nr_allocated_migrations); -+ } -+ -+ return mg; -+} -+ -+static void free_migration(struct dm_cache_migration *mg) -+{ -+ if (atomic_dec_and_test(&mg->cache->nr_allocated_migrations)) -+ wake_up(&mg->cache->migration_wait); -+ -+ mempool_free(mg, mg->cache->migration_pool); -+} -+ - static int prealloc_data_structs(struct cache *cache, struct prealloc *p) - { - if (!p->mg) { -- p->mg = mempool_alloc(cache->migration_pool, GFP_NOWAIT); -+ p->mg = alloc_migration(cache); - if (!p->mg) - return -ENOMEM; - } -@@ -382,7 +408,7 @@ static void prealloc_free_structs(struct cache *cache, struct prealloc *p) - free_prison_cell(cache, p->cell1); - - if (p->mg) -- mempool_free(p->mg, cache->migration_pool); -+ free_migration(p->mg); - } - - static struct dm_cache_migration *prealloc_get_migration(struct prealloc *p) -@@ -812,24 +838,14 @@ static void remap_to_origin_then_cache(struct cache *cache, struct bio *bio, - * Migration covers moving data from the origin device to the cache, or - * vice versa. - *--------------------------------------------------------------*/ --static void free_migration(struct dm_cache_migration *mg) --{ -- mempool_free(mg, mg->cache->migration_pool); --} -- --static void inc_nr_migrations(struct cache *cache) -+static void inc_io_migrations(struct cache *cache) - { -- atomic_inc(&cache->nr_migrations); -+ atomic_inc(&cache->nr_io_migrations); - } - --static void dec_nr_migrations(struct cache *cache) -+static void dec_io_migrations(struct cache *cache) - { -- atomic_dec(&cache->nr_migrations); -- -- /* -- * Wake the worker in case we're suspending the target. -- */ -- wake_up(&cache->migration_wait); -+ atomic_dec(&cache->nr_io_migrations); - } - - static void __cell_defer(struct cache *cache, struct dm_bio_prison_cell *cell, -@@ -852,11 +868,10 @@ static void cell_defer(struct cache *cache, struct dm_bio_prison_cell *cell, - wake_worker(cache); - } - --static void cleanup_migration(struct dm_cache_migration *mg) -+static void free_io_migration(struct dm_cache_migration *mg) - { -- struct cache *cache = mg->cache; -+ dec_io_migrations(mg->cache); - free_migration(mg); -- dec_nr_migrations(cache); - } - - static void migration_failure(struct dm_cache_migration *mg) -@@ -881,7 +896,7 @@ static void migration_failure(struct dm_cache_migration *mg) - cell_defer(cache, mg->new_ocell, true); - } - -- cleanup_migration(mg); -+ free_io_migration(mg); - } - - static void migration_success_pre_commit(struct dm_cache_migration *mg) -@@ -892,7 +907,7 @@ static void migration_success_pre_commit(struct dm_cache_migration *mg) - if (mg->writeback) { - clear_dirty(cache, mg->old_oblock, mg->cblock); - cell_defer(cache, mg->old_ocell, false); -- cleanup_migration(mg); -+ free_io_migration(mg); - return; - - } else if (mg->demote) { -@@ -902,14 +917,14 @@ static void migration_success_pre_commit(struct dm_cache_migration *mg) - mg->old_oblock); - if (mg->promote) - cell_defer(cache, mg->new_ocell, true); -- cleanup_migration(mg); -+ free_io_migration(mg); - return; - } - } else { - if (dm_cache_insert_mapping(cache->cmd, mg->cblock, mg->new_oblock)) { - DMWARN_LIMIT("promotion failed; couldn't update on disk metadata"); - policy_remove_mapping(cache->policy, mg->new_oblock); -- cleanup_migration(mg); -+ free_io_migration(mg); - return; - } - } -@@ -942,7 +957,7 @@ static void migration_success_post_commit(struct dm_cache_migration *mg) - } else { - if (mg->invalidate) - policy_remove_mapping(cache->policy, mg->old_oblock); -- cleanup_migration(mg); -+ free_io_migration(mg); - } - - } else { -@@ -957,7 +972,7 @@ static void migration_success_post_commit(struct dm_cache_migration *mg) - bio_endio(mg->new_ocell->holder, 0); - cell_defer(cache, mg->new_ocell, false); - } -- cleanup_migration(mg); -+ free_io_migration(mg); - } - } - -@@ -1169,7 +1184,7 @@ static void promote(struct cache *cache, struct prealloc *structs, - mg->new_ocell = cell; - mg->start_jiffies = jiffies; - -- inc_nr_migrations(cache); -+ inc_io_migrations(cache); - quiesce_migration(mg); - } - -@@ -1192,7 +1207,7 @@ static void writeback(struct cache *cache, struct prealloc *structs, - mg->new_ocell = NULL; - mg->start_jiffies = jiffies; - -- inc_nr_migrations(cache); -+ inc_io_migrations(cache); - quiesce_migration(mg); - } - -@@ -1218,7 +1233,7 @@ static void demote_then_promote(struct cache *cache, struct prealloc *structs, - mg->new_ocell = new_ocell; - mg->start_jiffies = jiffies; - -- inc_nr_migrations(cache); -+ inc_io_migrations(cache); - quiesce_migration(mg); - } - -@@ -1245,7 +1260,7 @@ static void invalidate(struct cache *cache, struct prealloc *structs, - mg->new_ocell = NULL; - mg->start_jiffies = jiffies; - -- inc_nr_migrations(cache); -+ inc_io_migrations(cache); - quiesce_migration(mg); - } - -@@ -1306,7 +1321,7 @@ static void process_discard_bio(struct cache *cache, struct bio *bio) - - static bool spare_migration_bandwidth(struct cache *cache) - { -- sector_t current_volume = (atomic_read(&cache->nr_migrations) + 1) * -+ sector_t current_volume = (atomic_read(&cache->nr_io_migrations) + 1) * - cache->sectors_per_block; - return current_volume < cache->migration_threshold; - } -@@ -1661,7 +1676,7 @@ static void stop_quiescing(struct cache *cache) - - static void wait_for_migrations(struct cache *cache) - { -- wait_event(cache->migration_wait, !atomic_read(&cache->nr_migrations)); -+ wait_event(cache->migration_wait, !atomic_read(&cache->nr_allocated_migrations)); - } - - static void stop_worker(struct cache *cache) -@@ -1772,9 +1787,6 @@ static void destroy(struct cache *cache) - { - unsigned i; - -- if (cache->next_migration) -- mempool_free(cache->next_migration, cache->migration_pool); -- - if (cache->migration_pool) - mempool_destroy(cache->migration_pool); - -@@ -2282,7 +2294,8 @@ static int cache_create(struct cache_args *ca, struct cache **result) - INIT_LIST_HEAD(&cache->quiesced_migrations); - INIT_LIST_HEAD(&cache->completed_migrations); - INIT_LIST_HEAD(&cache->need_commit_migrations); -- atomic_set(&cache->nr_migrations, 0); -+ atomic_set(&cache->nr_allocated_migrations, 0); -+ atomic_set(&cache->nr_io_migrations, 0); - init_waitqueue_head(&cache->migration_wait); - - init_waitqueue_head(&cache->quiescing_wait); -@@ -2342,8 +2355,6 @@ static int cache_create(struct cache_args *ca, struct cache **result) - goto bad; - } - -- cache->next_migration = NULL; -- - cache->need_tick_bio = true; - cache->sized = false; - cache->invalidate = false; -diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c -index 4913c06..175584a 100644 ---- a/drivers/md/raid5.c -+++ b/drivers/md/raid5.c -@@ -2896,7 +2896,8 @@ static int fetch_block(struct stripe_head *sh, struct stripe_head_state *s, - (s->failed >= 2 && fdev[1]->toread) || - (sh->raid_conf->level <= 5 && s->failed && fdev[0]->towrite && - !test_bit(R5_OVERWRITE, &fdev[0]->flags)) || -- (sh->raid_conf->level == 6 && s->failed && s->to_write))) { -+ ((sh->raid_conf->level == 6 || sh->sector >= sh->raid_conf->mddev->recovery_cp) -+ && s->failed && s->to_write))) { - /* we would like to get this block, possibly by computing it, - * otherwise read it if the backing disk is insync - */ -diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c -index cc11f7f..1468c46 100644 ---- a/drivers/net/can/dev.c -+++ b/drivers/net/can/dev.c -@@ -664,10 +664,14 @@ static int can_changelink(struct net_device *dev, - if (dev->flags & IFF_UP) - return -EBUSY; - cm = nla_data(data[IFLA_CAN_CTRLMODE]); -- if (cm->flags & ~priv->ctrlmode_supported) -+ -+ /* check whether changed bits are allowed to be modified */ -+ if (cm->mask & ~priv->ctrlmode_supported) - return -EOPNOTSUPP; -+ -+ /* clear bits to be modified and copy the flag values */ - priv->ctrlmode &= ~cm->mask; -- priv->ctrlmode |= cm->flags; -+ priv->ctrlmode |= (cm->flags & cm->mask); - } - - if (data[IFLA_CAN_RESTART_MS]) { -diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c -index dae70d2..78c65d3 100644 ---- a/drivers/pci/pci.c -+++ b/drivers/pci/pci.c -@@ -3187,7 +3187,8 @@ static int pci_parent_bus_reset(struct pci_dev *dev, int probe) - { - struct pci_dev *pdev; - -- if (pci_is_root_bus(dev->bus) || dev->subordinate || !dev->bus->self) -+ if (pci_is_root_bus(dev->bus) || dev->subordinate || -+ !dev->bus->self || dev->dev_flags & PCI_DEV_FLAGS_NO_BUS_RESET) - return -ENOTTY; - - list_for_each_entry(pdev, &dev->bus->devices, bus_list) -@@ -3221,7 +3222,8 @@ static int pci_dev_reset_slot_function(struct pci_dev *dev, int probe) - { - struct pci_dev *pdev; - -- if (dev->subordinate || !dev->slot) -+ if (dev->subordinate || !dev->slot || -+ dev->dev_flags & PCI_DEV_FLAGS_NO_BUS_RESET) - return -ENOTTY; - - list_for_each_entry(pdev, &dev->bus->devices, bus_list) -@@ -3452,6 +3454,20 @@ int pci_try_reset_function(struct pci_dev *dev) - } - EXPORT_SYMBOL_GPL(pci_try_reset_function); - -+/* Do any devices on or below this bus prevent a bus reset? */ -+static bool pci_bus_resetable(struct pci_bus *bus) -+{ -+ struct pci_dev *dev; -+ -+ list_for_each_entry(dev, &bus->devices, bus_list) { -+ if (dev->dev_flags & PCI_DEV_FLAGS_NO_BUS_RESET || -+ (dev->subordinate && !pci_bus_resetable(dev->subordinate))) -+ return false; -+ } -+ -+ return true; -+} -+ - /* Lock devices from the top of the tree down */ - static void pci_bus_lock(struct pci_bus *bus) - { -@@ -3502,6 +3518,22 @@ unlock: - return 0; - } - -+/* Do any devices on or below this slot prevent a bus reset? */ -+static bool pci_slot_resetable(struct pci_slot *slot) -+{ -+ struct pci_dev *dev; -+ -+ list_for_each_entry(dev, &slot->bus->devices, bus_list) { -+ if (!dev->slot || dev->slot != slot) -+ continue; -+ if (dev->dev_flags & PCI_DEV_FLAGS_NO_BUS_RESET || -+ (dev->subordinate && !pci_bus_resetable(dev->subordinate))) -+ return false; -+ } -+ -+ return true; -+} -+ - /* Lock devices from the top of the tree down */ - static void pci_slot_lock(struct pci_slot *slot) - { -@@ -3623,7 +3655,7 @@ static int pci_slot_reset(struct pci_slot *slot, int probe) - { - int rc; - -- if (!slot) -+ if (!slot || !pci_slot_resetable(slot)) - return -ENOTTY; - - if (!probe) -@@ -3715,7 +3747,7 @@ EXPORT_SYMBOL_GPL(pci_try_reset_slot); - - static int pci_bus_reset(struct pci_bus *bus, int probe) - { -- if (!bus->self) -+ if (!bus->self || !pci_bus_resetable(bus)) - return -ENOTTY; - - if (probe) -diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c -index 6e8776b..27abeb4 100644 ---- a/drivers/pci/quirks.c -+++ b/drivers/pci/quirks.c -@@ -3008,6 +3008,20 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_CHELSIO, 0x0030, - DECLARE_PCI_FIXUP_HEADER(0x1814, 0x0601, /* Ralink RT2800 802.11n PCI */ - quirk_broken_intx_masking); - -+static void quirk_no_bus_reset(struct pci_dev *dev) -+{ -+ dev->dev_flags |= PCI_DEV_FLAGS_NO_BUS_RESET; -+} -+ -+/* -+ * Atheros AR93xx chips do not behave after a bus reset. The device will -+ * throw a Link Down error on AER-capable systems and regardless of AER, -+ * config space of the device is never accessible again and typically -+ * causes the system to hang or reset when access is attempted. -+ * http://www.spinics.net/lists/linux-pci/msg34797.html -+ */ -+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATHEROS, 0x0030, quirk_no_bus_reset); -+ - static void pci_do_fixups(struct pci_dev *dev, struct pci_fixup *f, - struct pci_fixup *end) - { -diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c -index c0fe609..988f5e1 100644 ---- a/drivers/pinctrl/core.c -+++ b/drivers/pinctrl/core.c -@@ -1812,14 +1812,15 @@ void pinctrl_unregister(struct pinctrl_dev *pctldev) - if (pctldev == NULL) - return; - -- mutex_lock(&pinctrldev_list_mutex); - mutex_lock(&pctldev->mutex); -- - pinctrl_remove_device_debugfs(pctldev); -+ mutex_unlock(&pctldev->mutex); - - if (!IS_ERR(pctldev->p)) - pinctrl_put(pctldev->p); - -+ mutex_lock(&pinctrldev_list_mutex); -+ mutex_lock(&pctldev->mutex); - /* TODO: check that no pinmuxes are still active? */ - list_del(&pctldev->node); - /* Destroy descriptor tree */ -diff --git a/drivers/s390/crypto/ap_bus.c b/drivers/s390/crypto/ap_bus.c -index ab3baa7..86ade85 100644 ---- a/drivers/s390/crypto/ap_bus.c -+++ b/drivers/s390/crypto/ap_bus.c -@@ -44,6 +44,7 @@ - #include <linux/hrtimer.h> - #include <linux/ktime.h> - #include <asm/facility.h> -+#include <linux/crypto.h> - - #include "ap_bus.h" - -@@ -71,7 +72,7 @@ MODULE_AUTHOR("IBM Corporation"); - MODULE_DESCRIPTION("Adjunct Processor Bus driver, " \ - "Copyright IBM Corp. 2006, 2012"); - MODULE_LICENSE("GPL"); --MODULE_ALIAS("z90crypt"); -+MODULE_ALIAS_CRYPTO("z90crypt"); - - /* - * Module parameter -diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c -index 3f5b56a..b4ddb73 100644 ---- a/drivers/scsi/ipr.c -+++ b/drivers/scsi/ipr.c -@@ -683,6 +683,7 @@ static void ipr_init_ipr_cmnd(struct ipr_cmnd *ipr_cmd, - ipr_reinit_ipr_cmnd(ipr_cmd); - ipr_cmd->u.scratch = 0; - ipr_cmd->sibling = NULL; -+ ipr_cmd->eh_comp = NULL; - ipr_cmd->fast_done = fast_done; - init_timer(&ipr_cmd->timer); - } -@@ -848,6 +849,8 @@ static void ipr_scsi_eh_done(struct ipr_cmnd *ipr_cmd) - - scsi_dma_unmap(ipr_cmd->scsi_cmd); - scsi_cmd->scsi_done(scsi_cmd); -+ if (ipr_cmd->eh_comp) -+ complete(ipr_cmd->eh_comp); - list_add_tail(&ipr_cmd->queue, &ipr_cmd->hrrq->hrrq_free_q); - } - -@@ -4805,6 +4808,84 @@ static int ipr_slave_alloc(struct scsi_device *sdev) - return rc; - } - -+/** -+ * ipr_match_lun - Match function for specified LUN -+ * @ipr_cmd: ipr command struct -+ * @device: device to match (sdev) -+ * -+ * Returns: -+ * 1 if command matches sdev / 0 if command does not match sdev -+ **/ -+static int ipr_match_lun(struct ipr_cmnd *ipr_cmd, void *device) -+{ -+ if (ipr_cmd->scsi_cmd && ipr_cmd->scsi_cmd->device == device) -+ return 1; -+ return 0; -+} -+ -+/** -+ * ipr_wait_for_ops - Wait for matching commands to complete -+ * @ipr_cmd: ipr command struct -+ * @device: device to match (sdev) -+ * @match: match function to use -+ * -+ * Returns: -+ * SUCCESS / FAILED -+ **/ -+static int ipr_wait_for_ops(struct ipr_ioa_cfg *ioa_cfg, void *device, -+ int (*match)(struct ipr_cmnd *, void *)) -+{ -+ struct ipr_cmnd *ipr_cmd; -+ int wait; -+ unsigned long flags; -+ struct ipr_hrr_queue *hrrq; -+ signed long timeout = IPR_ABORT_TASK_TIMEOUT; -+ DECLARE_COMPLETION_ONSTACK(comp); -+ -+ ENTER; -+ do { -+ wait = 0; -+ -+ for_each_hrrq(hrrq, ioa_cfg) { -+ spin_lock_irqsave(hrrq->lock, flags); -+ list_for_each_entry(ipr_cmd, &hrrq->hrrq_pending_q, queue) { -+ if (match(ipr_cmd, device)) { -+ ipr_cmd->eh_comp = &comp; -+ wait++; -+ } -+ } -+ spin_unlock_irqrestore(hrrq->lock, flags); -+ } -+ -+ if (wait) { -+ timeout = wait_for_completion_timeout(&comp, timeout); -+ -+ if (!timeout) { -+ wait = 0; -+ -+ for_each_hrrq(hrrq, ioa_cfg) { -+ spin_lock_irqsave(hrrq->lock, flags); -+ list_for_each_entry(ipr_cmd, &hrrq->hrrq_pending_q, queue) { -+ if (match(ipr_cmd, device)) { -+ ipr_cmd->eh_comp = NULL; -+ wait++; -+ } -+ } -+ spin_unlock_irqrestore(hrrq->lock, flags); -+ } -+ -+ if (wait) -+ dev_err(&ioa_cfg->pdev->dev, "Timed out waiting for aborted commands\n"); -+ LEAVE; -+ return wait ? FAILED : SUCCESS; -+ } -+ } -+ } while (wait); -+ -+ LEAVE; -+ return SUCCESS; -+} -+ - static int ipr_eh_host_reset(struct scsi_cmnd *cmd) - { - struct ipr_ioa_cfg *ioa_cfg; -@@ -5023,11 +5104,17 @@ static int __ipr_eh_dev_reset(struct scsi_cmnd *scsi_cmd) - static int ipr_eh_dev_reset(struct scsi_cmnd *cmd) - { - int rc; -+ struct ipr_ioa_cfg *ioa_cfg; -+ -+ ioa_cfg = (struct ipr_ioa_cfg *) cmd->device->host->hostdata; - - spin_lock_irq(cmd->device->host->host_lock); - rc = __ipr_eh_dev_reset(cmd); - spin_unlock_irq(cmd->device->host->host_lock); - -+ if (rc == SUCCESS) -+ rc = ipr_wait_for_ops(ioa_cfg, cmd->device, ipr_match_lun); -+ - return rc; - } - -@@ -5205,13 +5292,18 @@ static int ipr_eh_abort(struct scsi_cmnd *scsi_cmd) - { - unsigned long flags; - int rc; -+ struct ipr_ioa_cfg *ioa_cfg; - - ENTER; - -+ ioa_cfg = (struct ipr_ioa_cfg *) scsi_cmd->device->host->hostdata; -+ - spin_lock_irqsave(scsi_cmd->device->host->host_lock, flags); - rc = ipr_cancel_op(scsi_cmd); - spin_unlock_irqrestore(scsi_cmd->device->host->host_lock, flags); - -+ if (rc == SUCCESS) -+ rc = ipr_wait_for_ops(ioa_cfg, scsi_cmd->device, ipr_match_lun); - LEAVE; - return rc; - } -diff --git a/drivers/scsi/ipr.h b/drivers/scsi/ipr.h -index 9ce38a2..0801f3d 100644 ---- a/drivers/scsi/ipr.h -+++ b/drivers/scsi/ipr.h -@@ -1585,6 +1585,7 @@ struct ipr_cmnd { - struct scsi_device *sdev; - } u; - -+ struct completion *eh_comp; - struct ipr_hrr_queue *hrrq; - struct ipr_ioa_cfg *ioa_cfg; - }; -diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c -index d46b4cc..850e232 100644 ---- a/drivers/tty/n_tty.c -+++ b/drivers/tty/n_tty.c -@@ -2417,12 +2417,17 @@ static unsigned int n_tty_poll(struct tty_struct *tty, struct file *file, - - poll_wait(file, &tty->read_wait, wait); - poll_wait(file, &tty->write_wait, wait); -+ if (test_bit(TTY_OTHER_CLOSED, &tty->flags)) -+ mask |= POLLHUP; - if (input_available_p(tty, 1)) - mask |= POLLIN | POLLRDNORM; -+ else if (mask & POLLHUP) { -+ tty_flush_to_ldisc(tty); -+ if (input_available_p(tty, 1)) -+ mask |= POLLIN | POLLRDNORM; -+ } - if (tty->packet && tty->link->ctrl_status) - mask |= POLLPRI | POLLIN | POLLRDNORM; -- if (test_bit(TTY_OTHER_CLOSED, &tty->flags)) -- mask |= POLLHUP; - if (tty_hung_up_p(file)) - mask |= POLLHUP; - if (!(mask & (POLLHUP | POLLIN | POLLRDNORM))) { -diff --git a/drivers/xen/swiotlb-xen.c b/drivers/xen/swiotlb-xen.c -index 9df5d6e..f3a9d83 100644 ---- a/drivers/xen/swiotlb-xen.c -+++ b/drivers/xen/swiotlb-xen.c -@@ -449,7 +449,7 @@ static void xen_unmap_single(struct device *hwdev, dma_addr_t dev_addr, - - /* NOTE: We use dev_addr here, not paddr! */ - if (is_xen_swiotlb_buffer(dev_addr)) { -- swiotlb_tbl_unmap_single(hwdev, dev_addr, size, dir); -+ swiotlb_tbl_unmap_single(hwdev, paddr, size, dir); - return; - } - -diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c -index 1a858947..fa9f900 100644 ---- a/fs/btrfs/extent_io.c -+++ b/fs/btrfs/extent_io.c -@@ -4507,7 +4507,8 @@ static void check_buffer_tree_ref(struct extent_buffer *eb) - spin_unlock(&eb->refs_lock); - } - --static void mark_extent_buffer_accessed(struct extent_buffer *eb) -+static void mark_extent_buffer_accessed(struct extent_buffer *eb, -+ struct page *accessed) - { - unsigned long num_pages, i; - -@@ -4516,7 +4517,8 @@ static void mark_extent_buffer_accessed(struct extent_buffer *eb) - num_pages = num_extent_pages(eb->start, eb->len); - for (i = 0; i < num_pages; i++) { - struct page *p = extent_buffer_page(eb, i); -- mark_page_accessed(p); -+ if (p != accessed) -+ mark_page_accessed(p); - } - } - -@@ -4530,7 +4532,7 @@ struct extent_buffer *find_extent_buffer(struct btrfs_fs_info *fs_info, - start >> PAGE_CACHE_SHIFT); - if (eb && atomic_inc_not_zero(&eb->refs)) { - rcu_read_unlock(); -- mark_extent_buffer_accessed(eb); -+ mark_extent_buffer_accessed(eb, NULL); - return eb; - } - rcu_read_unlock(); -@@ -4578,7 +4580,7 @@ struct extent_buffer *alloc_extent_buffer(struct btrfs_fs_info *fs_info, - spin_unlock(&mapping->private_lock); - unlock_page(p); - page_cache_release(p); -- mark_extent_buffer_accessed(exists); -+ mark_extent_buffer_accessed(exists, p); - goto free_eb; - } - -@@ -4593,7 +4595,6 @@ struct extent_buffer *alloc_extent_buffer(struct btrfs_fs_info *fs_info, - attach_extent_buffer_page(eb, p); - spin_unlock(&mapping->private_lock); - WARN_ON(PageDirty(p)); -- mark_page_accessed(p); - eb->pages[i] = p; - if (!PageUptodate(p)) - uptodate = 0; -diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c -index f6d00df..279b06e 100644 ---- a/fs/btrfs/file.c -+++ b/fs/btrfs/file.c -@@ -470,11 +470,12 @@ static void btrfs_drop_pages(struct page **pages, size_t num_pages) - for (i = 0; i < num_pages; i++) { - /* page checked is some magic around finding pages that - * have been modified without going through btrfs_set_page_dirty -- * clear it here -+ * clear it here. There should be no need to mark the pages -+ * accessed as prepare_pages should have marked them accessed -+ * in prepare_pages via find_or_create_page() - */ - ClearPageChecked(pages[i]); - unlock_page(pages[i]); -- mark_page_accessed(pages[i]); - page_cache_release(pages[i]); - } - } -diff --git a/fs/buffer.c b/fs/buffer.c -index 4d06a57..eef21c6 100644 ---- a/fs/buffer.c -+++ b/fs/buffer.c -@@ -227,7 +227,7 @@ __find_get_block_slow(struct block_device *bdev, sector_t block) - int all_mapped = 1; - - index = block >> (PAGE_CACHE_SHIFT - bd_inode->i_blkbits); -- page = find_get_page(bd_mapping, index); -+ page = find_get_page_flags(bd_mapping, index, FGP_ACCESSED); - if (!page) - goto out; - -@@ -1368,12 +1368,13 @@ __find_get_block(struct block_device *bdev, sector_t block, unsigned size) - struct buffer_head *bh = lookup_bh_lru(bdev, block, size); - - if (bh == NULL) { -+ /* __find_get_block_slow will mark the page accessed */ - bh = __find_get_block_slow(bdev, block); - if (bh) - bh_lru_install(bh); -- } -- if (bh) -+ } else - touch_buffer(bh); -+ - return bh; - } - EXPORT_SYMBOL(__find_get_block); -@@ -1485,16 +1486,27 @@ EXPORT_SYMBOL(set_bh_page); - /* - * Called when truncating a buffer on a page completely. - */ -+ -+/* Bits that are cleared during an invalidate */ -+#define BUFFER_FLAGS_DISCARD \ -+ (1 << BH_Mapped | 1 << BH_New | 1 << BH_Req | \ -+ 1 << BH_Delay | 1 << BH_Unwritten) -+ - static void discard_buffer(struct buffer_head * bh) - { -+ unsigned long b_state, b_state_old; -+ - lock_buffer(bh); - clear_buffer_dirty(bh); - bh->b_bdev = NULL; -- clear_buffer_mapped(bh); -- clear_buffer_req(bh); -- clear_buffer_new(bh); -- clear_buffer_delay(bh); -- clear_buffer_unwritten(bh); -+ b_state = bh->b_state; -+ for (;;) { -+ b_state_old = cmpxchg(&bh->b_state, b_state, -+ (b_state & ~BUFFER_FLAGS_DISCARD)); -+ if (b_state_old == b_state) -+ break; -+ b_state = b_state_old; -+ } - unlock_buffer(bh); - } - -diff --git a/fs/cifs/ioctl.c b/fs/cifs/ioctl.c -index 7749230..dfc9564 100644 ---- a/fs/cifs/ioctl.c -+++ b/fs/cifs/ioctl.c -@@ -86,21 +86,16 @@ static long cifs_ioctl_clone(unsigned int xid, struct file *dst_file, - } - - src_inode = src_file.file->f_dentry->d_inode; -+ rc = -EINVAL; -+ if (S_ISDIR(src_inode->i_mode)) -+ goto out_fput; - - /* - * Note: cifs case is easier than btrfs since server responsible for - * checks for proper open modes and file type and if it wants - * server could even support copy of range where source = target - */ -- -- /* so we do not deadlock racing two ioctls on same files */ -- if (target_inode < src_inode) { -- mutex_lock_nested(&target_inode->i_mutex, I_MUTEX_PARENT); -- mutex_lock_nested(&src_inode->i_mutex, I_MUTEX_CHILD); -- } else { -- mutex_lock_nested(&src_inode->i_mutex, I_MUTEX_PARENT); -- mutex_lock_nested(&target_inode->i_mutex, I_MUTEX_CHILD); -- } -+ lock_two_nondirectories(target_inode, src_inode); - - /* determine range to clone */ - rc = -EINVAL; -@@ -124,13 +119,7 @@ static long cifs_ioctl_clone(unsigned int xid, struct file *dst_file, - out_unlock: - /* although unlocking in the reverse order from locking is not - strictly necessary here it is a little cleaner to be consistent */ -- if (target_inode < src_inode) { -- mutex_unlock(&src_inode->i_mutex); -- mutex_unlock(&target_inode->i_mutex); -- } else { -- mutex_unlock(&target_inode->i_mutex); -- mutex_unlock(&src_inode->i_mutex); -- } -+ unlock_two_nondirectories(src_inode, target_inode); - out_fput: - fdput(src_file); - out_drop_write: -diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c -index 242226a..7620133 100644 ---- a/fs/ext4/mballoc.c -+++ b/fs/ext4/mballoc.c -@@ -1044,6 +1044,8 @@ int ext4_mb_init_group(struct super_block *sb, ext4_group_t group) - * allocating. If we are looking at the buddy cache we would - * have taken a reference using ext4_mb_load_buddy and that - * would have pinned buddy page to page cache. -+ * The call to ext4_mb_get_buddy_page_lock will mark the -+ * page accessed. - */ - ret = ext4_mb_get_buddy_page_lock(sb, group, &e4b); - if (ret || !EXT4_MB_GRP_NEED_INIT(this_grp)) { -@@ -1062,7 +1064,6 @@ int ext4_mb_init_group(struct super_block *sb, ext4_group_t group) - ret = -EIO; - goto err; - } -- mark_page_accessed(page); - - if (e4b.bd_buddy_page == NULL) { - /* -@@ -1082,7 +1083,6 @@ int ext4_mb_init_group(struct super_block *sb, ext4_group_t group) - ret = -EIO; - goto err; - } -- mark_page_accessed(page); - err: - ext4_mb_put_buddy_page_lock(&e4b); - return ret; -@@ -1141,7 +1141,7 @@ ext4_mb_load_buddy(struct super_block *sb, ext4_group_t group, - - /* we could use find_or_create_page(), but it locks page - * what we'd like to avoid in fast path ... */ -- page = find_get_page(inode->i_mapping, pnum); -+ page = find_get_page_flags(inode->i_mapping, pnum, FGP_ACCESSED); - if (page == NULL || !PageUptodate(page)) { - if (page) - /* -@@ -1172,15 +1172,16 @@ ext4_mb_load_buddy(struct super_block *sb, ext4_group_t group, - ret = -EIO; - goto err; - } -+ -+ /* Pages marked accessed already */ - e4b->bd_bitmap_page = page; - e4b->bd_bitmap = page_address(page) + (poff * sb->s_blocksize); -- mark_page_accessed(page); - - block++; - pnum = block / blocks_per_page; - poff = block % blocks_per_page; - -- page = find_get_page(inode->i_mapping, pnum); -+ page = find_get_page_flags(inode->i_mapping, pnum, FGP_ACCESSED); - if (page == NULL || !PageUptodate(page)) { - if (page) - page_cache_release(page); -@@ -1201,9 +1202,10 @@ ext4_mb_load_buddy(struct super_block *sb, ext4_group_t group, - ret = -EIO; - goto err; - } -+ -+ /* Pages marked accessed already */ - e4b->bd_buddy_page = page; - e4b->bd_buddy = page_address(page) + (poff * sb->s_blocksize); -- mark_page_accessed(page); - - BUG_ON(e4b->bd_bitmap_page == NULL); - BUG_ON(e4b->bd_buddy_page == NULL); -diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c -index 293d048..5c6fe27 100644 ---- a/fs/f2fs/checkpoint.c -+++ b/fs/f2fs/checkpoint.c -@@ -71,7 +71,6 @@ repeat: - goto repeat; - } - out: -- mark_page_accessed(page); - return page; - } - -diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c -index b0649b7..bb6478a 100644 ---- a/fs/f2fs/node.c -+++ b/fs/f2fs/node.c -@@ -969,7 +969,6 @@ repeat: - } - got_it: - f2fs_bug_on(nid != nid_of_node(page)); -- mark_page_accessed(page); - return page; - } - -@@ -1024,7 +1023,6 @@ page_hit: - f2fs_put_page(page, 1); - return ERR_PTR(-EIO); - } -- mark_page_accessed(page); - return page; - } - -diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c -index 0a648bb..6eb13c6 100644 ---- a/fs/fuse/dev.c -+++ b/fs/fuse/dev.c -@@ -1614,7 +1614,7 @@ out_finish: - - static void fuse_retrieve_end(struct fuse_conn *fc, struct fuse_req *req) - { -- release_pages(req->pages, req->num_pages, 0); -+ release_pages(req->pages, req->num_pages, false); - } - - static int fuse_retrieve(struct fuse_conn *fc, struct inode *inode, -diff --git a/fs/fuse/file.c b/fs/fuse/file.c -index a91d3b4..d8a6027 100644 ---- a/fs/fuse/file.c -+++ b/fs/fuse/file.c -@@ -1006,8 +1006,6 @@ static ssize_t fuse_fill_write_pages(struct fuse_req *req, - tmp = iov_iter_copy_from_user_atomic(page, ii, offset, bytes); - flush_dcache_page(page); - -- mark_page_accessed(page); -- - if (!tmp) { - unlock_page(page); - page_cache_release(page); -diff --git a/fs/gfs2/aops.c b/fs/gfs2/aops.c -index 49436fa..4ccb60d 100644 ---- a/fs/gfs2/aops.c -+++ b/fs/gfs2/aops.c -@@ -517,7 +517,6 @@ int gfs2_internal_read(struct gfs2_inode *ip, char *buf, loff_t *pos, - p = kmap_atomic(page); - memcpy(buf + copied, p + offset, amt); - kunmap_atomic(p); -- mark_page_accessed(page); - page_cache_release(page); - copied += amt; - index++; -diff --git a/fs/gfs2/meta_io.c b/fs/gfs2/meta_io.c -index b82a9c9..e7b1496 100644 ---- a/fs/gfs2/meta_io.c -+++ b/fs/gfs2/meta_io.c -@@ -136,7 +136,8 @@ struct buffer_head *gfs2_getbuf(struct gfs2_glock *gl, u64 blkno, int create) - yield(); - } - } else { -- page = find_lock_page(mapping, index); -+ page = find_get_page_flags(mapping, index, -+ FGP_LOCK|FGP_ACCESSED); - if (!page) - return NULL; - } -@@ -153,7 +154,6 @@ struct buffer_head *gfs2_getbuf(struct gfs2_glock *gl, u64 blkno, int create) - map_bh(bh, sdp->sd_vfs, blkno); - - unlock_page(page); -- mark_page_accessed(page); - page_cache_release(page); - - return bh; -diff --git a/fs/ntfs/attrib.c b/fs/ntfs/attrib.c -index a27e3fe..250ed5b 100644 ---- a/fs/ntfs/attrib.c -+++ b/fs/ntfs/attrib.c -@@ -1748,7 +1748,6 @@ int ntfs_attr_make_non_resident(ntfs_inode *ni, const u32 data_size) - if (page) { - set_page_dirty(page); - unlock_page(page); -- mark_page_accessed(page); - page_cache_release(page); - } - ntfs_debug("Done."); -diff --git a/fs/ntfs/file.c b/fs/ntfs/file.c -index db9bd8a..86ddab9 100644 ---- a/fs/ntfs/file.c -+++ b/fs/ntfs/file.c -@@ -2060,7 +2060,6 @@ static ssize_t ntfs_file_buffered_write(struct kiocb *iocb, - } - do { - unlock_page(pages[--do_pages]); -- mark_page_accessed(pages[do_pages]); - page_cache_release(pages[do_pages]); - } while (do_pages); - if (unlikely(status)) -diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h -index b19d3dc..ade2390 100644 ---- a/include/linux/cpuset.h -+++ b/include/linux/cpuset.h -@@ -12,10 +12,31 @@ - #include <linux/cpumask.h> - #include <linux/nodemask.h> - #include <linux/mm.h> -+#include <linux/jump_label.h> - - #ifdef CONFIG_CPUSETS - --extern int number_of_cpusets; /* How many cpusets are defined in system? */ -+extern struct static_key cpusets_enabled_key; -+static inline bool cpusets_enabled(void) -+{ -+ return static_key_false(&cpusets_enabled_key); -+} -+ -+static inline int nr_cpusets(void) -+{ -+ /* jump label reference count + the top-level cpuset */ -+ return static_key_count(&cpusets_enabled_key) + 1; -+} -+ -+static inline void cpuset_inc(void) -+{ -+ static_key_slow_inc(&cpusets_enabled_key); -+} -+ -+static inline void cpuset_dec(void) -+{ -+ static_key_slow_dec(&cpusets_enabled_key); -+} - - extern int cpuset_init(void); - extern void cpuset_init_smp(void); -@@ -32,13 +53,13 @@ extern int __cpuset_node_allowed_hardwall(int node, gfp_t gfp_mask); - - static inline int cpuset_node_allowed_softwall(int node, gfp_t gfp_mask) - { -- return number_of_cpusets <= 1 || -+ return nr_cpusets() <= 1 || - __cpuset_node_allowed_softwall(node, gfp_mask); - } - - static inline int cpuset_node_allowed_hardwall(int node, gfp_t gfp_mask) - { -- return number_of_cpusets <= 1 || -+ return nr_cpusets() <= 1 || - __cpuset_node_allowed_hardwall(node, gfp_mask); - } - -@@ -124,6 +145,8 @@ static inline void set_mems_allowed(nodemask_t nodemask) - - #else /* !CONFIG_CPUSETS */ - -+static inline bool cpusets_enabled(void) { return false; } -+ - static inline int cpuset_init(void) { return 0; } - static inline void cpuset_init_smp(void) {} - -diff --git a/include/linux/crypto.h b/include/linux/crypto.h -index b92eadf..2b00d92 100644 ---- a/include/linux/crypto.h -+++ b/include/linux/crypto.h -@@ -26,6 +26,19 @@ - #include <linux/uaccess.h> - - /* -+ * Autoloaded crypto modules should only use a prefixed name to avoid allowing -+ * arbitrary modules to be loaded. Loading from userspace may still need the -+ * unprefixed names, so retains those aliases as well. -+ * This uses __MODULE_INFO directly instead of MODULE_ALIAS because pre-4.3 -+ * gcc (e.g. avr32 toolchain) uses __LINE__ for uniqueness, and this macro -+ * expands twice on the same line. Instead, use a separate base name for the -+ * alias. -+ */ -+#define MODULE_ALIAS_CRYPTO(name) \ -+ __MODULE_INFO(alias, alias_userspace, name); \ -+ __MODULE_INFO(alias, alias_crypto, "crypto-" name) -+ -+/* - * Algorithm masks and types. - */ - #define CRYPTO_ALG_TYPE_MASK 0x0000000f -diff --git a/include/linux/gfp.h b/include/linux/gfp.h -index 39b81dc..3824ac6 100644 ---- a/include/linux/gfp.h -+++ b/include/linux/gfp.h -@@ -369,8 +369,8 @@ void *alloc_pages_exact_nid(int nid, size_t size, gfp_t gfp_mask); - - extern void __free_pages(struct page *page, unsigned int order); - extern void free_pages(unsigned long addr, unsigned int order); --extern void free_hot_cold_page(struct page *page, int cold); --extern void free_hot_cold_page_list(struct list_head *list, int cold); -+extern void free_hot_cold_page(struct page *page, bool cold); -+extern void free_hot_cold_page_list(struct list_head *list, bool cold); - - extern void __free_memcg_kmem_pages(struct page *page, unsigned int order); - extern void free_memcg_kmem_pages(unsigned long addr, unsigned int order); -diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h -index b826239..63579cb8 100644 ---- a/include/linux/huge_mm.h -+++ b/include/linux/huge_mm.h -@@ -93,10 +93,6 @@ extern bool is_vma_temporary_stack(struct vm_area_struct *vma); - #endif /* CONFIG_DEBUG_VM */ - - extern unsigned long transparent_hugepage_flags; --extern int copy_pte_range(struct mm_struct *dst_mm, struct mm_struct *src_mm, -- pmd_t *dst_pmd, pmd_t *src_pmd, -- struct vm_area_struct *vma, -- unsigned long addr, unsigned long end); - extern int split_huge_page_to_list(struct page *page, struct list_head *list); - static inline int split_huge_page(struct page *page) - { -diff --git a/include/linux/jump_label.h b/include/linux/jump_label.h -index 5c1dfb2..784304b 100644 ---- a/include/linux/jump_label.h -+++ b/include/linux/jump_label.h -@@ -69,6 +69,10 @@ struct static_key { - - # include <asm/jump_label.h> - # define HAVE_JUMP_LABEL -+#else -+struct static_key { -+ atomic_t enabled; -+}; - #endif /* CC_HAVE_ASM_GOTO && CONFIG_JUMP_LABEL */ - - enum jump_label_type { -@@ -79,6 +83,12 @@ enum jump_label_type { - struct module; - - #include <linux/atomic.h> -+ -+static inline int static_key_count(struct static_key *key) -+{ -+ return atomic_read(&key->enabled); -+} -+ - #ifdef HAVE_JUMP_LABEL - - #define JUMP_LABEL_TYPE_FALSE_BRANCH 0UL -@@ -134,10 +144,6 @@ extern void jump_label_apply_nops(struct module *mod); - - #else /* !HAVE_JUMP_LABEL */ - --struct static_key { -- atomic_t enabled; --}; -- - static __always_inline void jump_label_init(void) - { - static_key_initialized = true; -@@ -145,14 +151,14 @@ static __always_inline void jump_label_init(void) - - static __always_inline bool static_key_false(struct static_key *key) - { -- if (unlikely(atomic_read(&key->enabled) > 0)) -+ if (unlikely(static_key_count(key) > 0)) - return true; - return false; - } - - static __always_inline bool static_key_true(struct static_key *key) - { -- if (likely(atomic_read(&key->enabled) > 0)) -+ if (likely(static_key_count(key) > 0)) - return true; - return false; - } -@@ -194,7 +200,7 @@ static inline int jump_label_apply_nops(struct module *mod) - - static inline bool static_key_enabled(struct static_key *key) - { -- return (atomic_read(&key->enabled) > 0); -+ return static_key_count(key) > 0; - } - - #endif /* _LINUX_JUMP_LABEL_H */ -diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h -index 1884353..ac819bf 100644 ---- a/include/linux/mmzone.h -+++ b/include/linux/mmzone.h -@@ -78,10 +78,15 @@ extern int page_group_by_mobility_disabled; - #define NR_MIGRATETYPE_BITS (PB_migrate_end - PB_migrate + 1) - #define MIGRATETYPE_MASK ((1UL << NR_MIGRATETYPE_BITS) - 1) - --static inline int get_pageblock_migratetype(struct page *page) -+#define get_pageblock_migratetype(page) \ -+ get_pfnblock_flags_mask(page, page_to_pfn(page), \ -+ PB_migrate_end, MIGRATETYPE_MASK) -+ -+static inline int get_pfnblock_migratetype(struct page *page, unsigned long pfn) - { - BUILD_BUG_ON(PB_migrate_end - PB_migrate != 2); -- return get_pageblock_flags_mask(page, PB_migrate_end, MIGRATETYPE_MASK); -+ return get_pfnblock_flags_mask(page, pfn, PB_migrate_end, -+ MIGRATETYPE_MASK); - } - - struct free_area { -@@ -138,6 +143,7 @@ enum zone_stat_item { - NR_SHMEM, /* shmem pages (included tmpfs/GEM pages) */ - NR_DIRTIED, /* page dirtyings since bootup */ - NR_WRITTEN, /* page writings since bootup */ -+ NR_PAGES_SCANNED, /* pages scanned since last reclaim */ - #ifdef CONFIG_NUMA - NUMA_HIT, /* allocated in intended node */ - NUMA_MISS, /* allocated in non intended node */ -@@ -316,19 +322,12 @@ enum zone_type { - #ifndef __GENERATING_BOUNDS_H - - struct zone { -- /* Fields commonly accessed by the page allocator */ -+ /* Read-mostly fields */ - - /* zone watermarks, access with *_wmark_pages(zone) macros */ - unsigned long watermark[NR_WMARK]; - - /* -- * When free pages are below this point, additional steps are taken -- * when reading the number of free pages to avoid per-cpu counter -- * drift allowing watermarks to be breached -- */ -- unsigned long percpu_drift_mark; -- -- /* - * We don't know if the memory that we're going to allocate will be freeable - * or/and it will be released eventually, so to avoid totally wasting several - * GB of ram we must reserve some of the lower zone memory (otherwise we risk -@@ -336,41 +335,26 @@ struct zone { - * on the higher zones). This array is recalculated at runtime if the - * sysctl_lowmem_reserve_ratio sysctl changes. - */ -- unsigned long lowmem_reserve[MAX_NR_ZONES]; -- -- /* -- * This is a per-zone reserve of pages that should not be -- * considered dirtyable memory. -- */ -- unsigned long dirty_balance_reserve; -+ long lowmem_reserve[MAX_NR_ZONES]; - - #ifdef CONFIG_NUMA - int node; -+#endif -+ - /* -- * zone reclaim becomes active if more unmapped pages exist. -+ * The target ratio of ACTIVE_ANON to INACTIVE_ANON pages on -+ * this zone's LRU. Maintained by the pageout code. - */ -- unsigned long min_unmapped_pages; -- unsigned long min_slab_pages; --#endif -+ unsigned int inactive_ratio; -+ -+ struct pglist_data *zone_pgdat; - struct per_cpu_pageset __percpu *pageset; -+ - /* -- * free areas of different sizes -+ * This is a per-zone reserve of pages that should not be -+ * considered dirtyable memory. - */ -- spinlock_t lock; --#if defined CONFIG_COMPACTION || defined CONFIG_CMA -- /* Set to true when the PG_migrate_skip bits should be cleared */ -- bool compact_blockskip_flush; -- -- /* pfn where compaction free scanner should start */ -- unsigned long compact_cached_free_pfn; -- /* pfn where async and sync compaction migration scanner should start */ -- unsigned long compact_cached_migrate_pfn[2]; --#endif --#ifdef CONFIG_MEMORY_HOTPLUG -- /* see spanned/present_pages for more description */ -- seqlock_t span_seqlock; --#endif -- struct free_area free_area[MAX_ORDER]; -+ unsigned long dirty_balance_reserve; - - #ifndef CONFIG_SPARSEMEM - /* -@@ -380,71 +364,14 @@ struct zone { - unsigned long *pageblock_flags; - #endif /* CONFIG_SPARSEMEM */ - --#ifdef CONFIG_COMPACTION -- /* -- * On compaction failure, 1<<compact_defer_shift compactions -- * are skipped before trying again. The number attempted since -- * last failure is tracked with compact_considered. -- */ -- unsigned int compact_considered; -- unsigned int compact_defer_shift; -- int compact_order_failed; --#endif -- -- ZONE_PADDING(_pad1_) -- -- /* Fields commonly accessed by the page reclaim scanner */ -- spinlock_t lru_lock; -- struct lruvec lruvec; -- -- unsigned long pages_scanned; /* since last reclaim */ -- unsigned long flags; /* zone flags, see below */ -- -- /* Zone statistics */ -- atomic_long_t vm_stat[NR_VM_ZONE_STAT_ITEMS]; -- -- /* -- * The target ratio of ACTIVE_ANON to INACTIVE_ANON pages on -- * this zone's LRU. Maintained by the pageout code. -- */ -- unsigned int inactive_ratio; -- -- -- ZONE_PADDING(_pad2_) -- /* Rarely used or read-mostly fields */ -- -+#ifdef CONFIG_NUMA - /* -- * wait_table -- the array holding the hash table -- * wait_table_hash_nr_entries -- the size of the hash table array -- * wait_table_bits -- wait_table_size == (1 << wait_table_bits) -- * -- * The purpose of all these is to keep track of the people -- * waiting for a page to become available and make them -- * runnable again when possible. The trouble is that this -- * consumes a lot of space, especially when so few things -- * wait on pages at a given time. So instead of using -- * per-page waitqueues, we use a waitqueue hash table. -- * -- * The bucket discipline is to sleep on the same queue when -- * colliding and wake all in that wait queue when removing. -- * When something wakes, it must check to be sure its page is -- * truly available, a la thundering herd. The cost of a -- * collision is great, but given the expected load of the -- * table, they should be so rare as to be outweighed by the -- * benefits from the saved space. -- * -- * __wait_on_page_locked() and unlock_page() in mm/filemap.c, are the -- * primary users of these fields, and in mm/page_alloc.c -- * free_area_init_core() performs the initialization of them. -+ * zone reclaim becomes active if more unmapped pages exist. - */ -- wait_queue_head_t * wait_table; -- unsigned long wait_table_hash_nr_entries; -- unsigned long wait_table_bits; -+ unsigned long min_unmapped_pages; -+ unsigned long min_slab_pages; -+#endif /* CONFIG_NUMA */ - -- /* -- * Discontig memory support fields. -- */ -- struct pglist_data *zone_pgdat; - /* zone_start_pfn == zone_start_paddr >> PAGE_SHIFT */ - unsigned long zone_start_pfn; - -@@ -490,9 +417,11 @@ struct zone { - * adjust_managed_page_count() should be used instead of directly - * touching zone->managed_pages and totalram_pages. - */ -+ unsigned long managed_pages; - unsigned long spanned_pages; - unsigned long present_pages; -- unsigned long managed_pages; -+ -+ const char *name; - - /* - * Number of MIGRATE_RESEVE page block. To maintain for just -@@ -500,10 +429,91 @@ struct zone { - */ - int nr_migrate_reserve_block; - -+#ifdef CONFIG_MEMORY_HOTPLUG -+ /* see spanned/present_pages for more description */ -+ seqlock_t span_seqlock; -+#endif -+ - /* -- * rarely used fields: -+ * wait_table -- the array holding the hash table -+ * wait_table_hash_nr_entries -- the size of the hash table array -+ * wait_table_bits -- wait_table_size == (1 << wait_table_bits) -+ * -+ * The purpose of all these is to keep track of the people -+ * waiting for a page to become available and make them -+ * runnable again when possible. The trouble is that this -+ * consumes a lot of space, especially when so few things -+ * wait on pages at a given time. So instead of using -+ * per-page waitqueues, we use a waitqueue hash table. -+ * -+ * The bucket discipline is to sleep on the same queue when -+ * colliding and wake all in that wait queue when removing. -+ * When something wakes, it must check to be sure its page is -+ * truly available, a la thundering herd. The cost of a -+ * collision is great, but given the expected load of the -+ * table, they should be so rare as to be outweighed by the -+ * benefits from the saved space. -+ * -+ * __wait_on_page_locked() and unlock_page() in mm/filemap.c, are the -+ * primary users of these fields, and in mm/page_alloc.c -+ * free_area_init_core() performs the initialization of them. - */ -- const char *name; -+ wait_queue_head_t *wait_table; -+ unsigned long wait_table_hash_nr_entries; -+ unsigned long wait_table_bits; -+ -+ ZONE_PADDING(_pad1_) -+ -+ /* Write-intensive fields used from the page allocator */ -+ spinlock_t lock; -+ -+ /* free areas of different sizes */ -+ struct free_area free_area[MAX_ORDER]; -+ -+ /* zone flags, see below */ -+ unsigned long flags; -+ -+ ZONE_PADDING(_pad2_) -+ -+ /* Write-intensive fields used by page reclaim */ -+ -+ /* Fields commonly accessed by the page reclaim scanner */ -+ spinlock_t lru_lock; -+ struct lruvec lruvec; -+ -+ /* -+ * When free pages are below this point, additional steps are taken -+ * when reading the number of free pages to avoid per-cpu counter -+ * drift allowing watermarks to be breached -+ */ -+ unsigned long percpu_drift_mark; -+ -+#if defined CONFIG_COMPACTION || defined CONFIG_CMA -+ /* pfn where compaction free scanner should start */ -+ unsigned long compact_cached_free_pfn; -+ /* pfn where async and sync compaction migration scanner should start */ -+ unsigned long compact_cached_migrate_pfn[2]; -+#endif -+ -+#ifdef CONFIG_COMPACTION -+ /* -+ * On compaction failure, 1<<compact_defer_shift compactions -+ * are skipped before trying again. The number attempted since -+ * last failure is tracked with compact_considered. -+ */ -+ unsigned int compact_considered; -+ unsigned int compact_defer_shift; -+ int compact_order_failed; -+#endif -+ -+#if defined CONFIG_COMPACTION || defined CONFIG_CMA -+ /* Set to true when the PG_migrate_skip bits should be cleared */ -+ bool compact_blockskip_flush; -+#endif -+ -+ ZONE_PADDING(_pad3_) -+ /* Zone statistics */ -+ atomic_long_t vm_stat[NR_VM_ZONE_STAT_ITEMS]; - } ____cacheline_internodealigned_in_smp; - - typedef enum { -@@ -519,6 +529,7 @@ typedef enum { - ZONE_WRITEBACK, /* reclaim scanning has recently found - * many pages under writeback - */ -+ ZONE_FAIR_DEPLETED, /* fair zone policy batch depleted */ - } zone_flags_t; - - static inline void zone_set_flag(struct zone *zone, zone_flags_t flag) -@@ -556,6 +567,11 @@ static inline int zone_is_reclaim_locked(const struct zone *zone) - return test_bit(ZONE_RECLAIM_LOCKED, &zone->flags); - } - -+static inline int zone_is_fair_depleted(const struct zone *zone) -+{ -+ return test_bit(ZONE_FAIR_DEPLETED, &zone->flags); -+} -+ - static inline int zone_is_oom_locked(const struct zone *zone) - { - return test_bit(ZONE_OOM_LOCKED, &zone->flags); -@@ -807,10 +823,10 @@ static inline bool pgdat_is_empty(pg_data_t *pgdat) - extern struct mutex zonelists_mutex; - void build_all_zonelists(pg_data_t *pgdat, struct zone *zone); - void wakeup_kswapd(struct zone *zone, int order, enum zone_type classzone_idx); --bool zone_watermark_ok(struct zone *z, int order, unsigned long mark, -- int classzone_idx, int alloc_flags); --bool zone_watermark_ok_safe(struct zone *z, int order, unsigned long mark, -- int classzone_idx, int alloc_flags); -+bool zone_watermark_ok(struct zone *z, unsigned int order, -+ unsigned long mark, int classzone_idx, int alloc_flags); -+bool zone_watermark_ok_safe(struct zone *z, unsigned int order, -+ unsigned long mark, int classzone_idx, int alloc_flags); - enum memmap_context { - MEMMAP_EARLY, - MEMMAP_HOTPLUG, -diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h -index ca71a1d..3c545b4 100644 ---- a/include/linux/page-flags.h -+++ b/include/linux/page-flags.h -@@ -198,6 +198,7 @@ struct page; /* forward declaration */ - TESTPAGEFLAG(Locked, locked) - PAGEFLAG(Error, error) TESTCLEARFLAG(Error, error) - PAGEFLAG(Referenced, referenced) TESTCLEARFLAG(Referenced, referenced) -+ __SETPAGEFLAG(Referenced, referenced) - PAGEFLAG(Dirty, dirty) TESTSCFLAG(Dirty, dirty) __CLEARPAGEFLAG(Dirty, dirty) - PAGEFLAG(LRU, lru) __CLEARPAGEFLAG(LRU, lru) - PAGEFLAG(Active, active) __CLEARPAGEFLAG(Active, active) -@@ -208,6 +209,7 @@ PAGEFLAG(Pinned, pinned) TESTSCFLAG(Pinned, pinned) /* Xen */ - PAGEFLAG(SavePinned, savepinned); /* Xen */ - PAGEFLAG(Reserved, reserved) __CLEARPAGEFLAG(Reserved, reserved) - PAGEFLAG(SwapBacked, swapbacked) __CLEARPAGEFLAG(SwapBacked, swapbacked) -+ __SETPAGEFLAG(SwapBacked, swapbacked) - - __PAGEFLAG(SlobFree, slob_free) - -diff --git a/include/linux/pageblock-flags.h b/include/linux/pageblock-flags.h -index c08730c..2baeee1 100644 ---- a/include/linux/pageblock-flags.h -+++ b/include/linux/pageblock-flags.h -@@ -65,33 +65,26 @@ extern int pageblock_order; - /* Forward declaration */ - struct page; - --unsigned long get_pageblock_flags_mask(struct page *page, -+unsigned long get_pfnblock_flags_mask(struct page *page, -+ unsigned long pfn, - unsigned long end_bitidx, - unsigned long mask); --void set_pageblock_flags_mask(struct page *page, -+ -+void set_pfnblock_flags_mask(struct page *page, - unsigned long flags, -+ unsigned long pfn, - unsigned long end_bitidx, - unsigned long mask); - - /* Declarations for getting and setting flags. See mm/page_alloc.c */ --static inline unsigned long get_pageblock_flags_group(struct page *page, -- int start_bitidx, int end_bitidx) --{ -- unsigned long nr_flag_bits = end_bitidx - start_bitidx + 1; -- unsigned long mask = (1 << nr_flag_bits) - 1; -- -- return get_pageblock_flags_mask(page, end_bitidx, mask); --} -- --static inline void set_pageblock_flags_group(struct page *page, -- unsigned long flags, -- int start_bitidx, int end_bitidx) --{ -- unsigned long nr_flag_bits = end_bitidx - start_bitidx + 1; -- unsigned long mask = (1 << nr_flag_bits) - 1; -- -- set_pageblock_flags_mask(page, flags, end_bitidx, mask); --} -+#define get_pageblock_flags_group(page, start_bitidx, end_bitidx) \ -+ get_pfnblock_flags_mask(page, page_to_pfn(page), \ -+ end_bitidx, \ -+ (1 << (end_bitidx - start_bitidx + 1)) - 1) -+#define set_pageblock_flags_group(page, flags, start_bitidx, end_bitidx) \ -+ set_pfnblock_flags_mask(page, flags, page_to_pfn(page), \ -+ end_bitidx, \ -+ (1 << (end_bitidx - start_bitidx + 1)) - 1) - - #ifdef CONFIG_COMPACTION - #define get_pageblock_skip(page) \ -diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h -index 09c1b03..fcebdda 100644 ---- a/include/linux/pagemap.h -+++ b/include/linux/pagemap.h -@@ -99,7 +99,7 @@ static inline void mapping_set_gfp_mask(struct address_space *m, gfp_t mask) - - #define page_cache_get(page) get_page(page) - #define page_cache_release(page) put_page(page) --void release_pages(struct page **pages, int nr, int cold); -+void release_pages(struct page **pages, int nr, bool cold); - - /* - * speculatively take a reference to a page. -@@ -248,12 +248,108 @@ pgoff_t page_cache_next_hole(struct address_space *mapping, - pgoff_t page_cache_prev_hole(struct address_space *mapping, - pgoff_t index, unsigned long max_scan); - -+#define FGP_ACCESSED 0x00000001 -+#define FGP_LOCK 0x00000002 -+#define FGP_CREAT 0x00000004 -+#define FGP_WRITE 0x00000008 -+#define FGP_NOFS 0x00000010 -+#define FGP_NOWAIT 0x00000020 -+ -+struct page *pagecache_get_page(struct address_space *mapping, pgoff_t offset, -+ int fgp_flags, gfp_t cache_gfp_mask); -+ -+/** -+ * find_get_page - find and get a page reference -+ * @mapping: the address_space to search -+ * @offset: the page index -+ * -+ * Looks up the page cache slot at @mapping & @offset. If there is a -+ * page cache page, it is returned with an increased refcount. -+ * -+ * Otherwise, %NULL is returned. -+ */ -+static inline struct page *find_get_page(struct address_space *mapping, -+ pgoff_t offset) -+{ -+ return pagecache_get_page(mapping, offset, 0, 0); -+} -+ -+static inline struct page *find_get_page_flags(struct address_space *mapping, -+ pgoff_t offset, int fgp_flags) -+{ -+ return pagecache_get_page(mapping, offset, fgp_flags, 0); -+} -+ -+/** -+ * find_lock_page - locate, pin and lock a pagecache page -+ * pagecache_get_page - find and get a page reference -+ * @mapping: the address_space to search -+ * @offset: the page index -+ * -+ * Looks up the page cache slot at @mapping & @offset. If there is a -+ * page cache page, it is returned locked and with an increased -+ * refcount. -+ * -+ * Otherwise, %NULL is returned. -+ * -+ * find_lock_page() may sleep. -+ */ -+static inline struct page *find_lock_page(struct address_space *mapping, -+ pgoff_t offset) -+{ -+ return pagecache_get_page(mapping, offset, FGP_LOCK, 0); -+} -+ -+/** -+ * find_or_create_page - locate or add a pagecache page -+ * @mapping: the page's address_space -+ * @index: the page's index into the mapping -+ * @gfp_mask: page allocation mode -+ * -+ * Looks up the page cache slot at @mapping & @offset. If there is a -+ * page cache page, it is returned locked and with an increased -+ * refcount. -+ * -+ * If the page is not present, a new page is allocated using @gfp_mask -+ * and added to the page cache and the VM's LRU list. The page is -+ * returned locked and with an increased refcount. -+ * -+ * On memory exhaustion, %NULL is returned. -+ * -+ * find_or_create_page() may sleep, even if @gfp_flags specifies an -+ * atomic allocation! -+ */ -+static inline struct page *find_or_create_page(struct address_space *mapping, -+ pgoff_t offset, gfp_t gfp_mask) -+{ -+ return pagecache_get_page(mapping, offset, -+ FGP_LOCK|FGP_ACCESSED|FGP_CREAT, -+ gfp_mask); -+} -+ -+/** -+ * grab_cache_page_nowait - returns locked page at given index in given cache -+ * @mapping: target address_space -+ * @index: the page index -+ * -+ * Same as grab_cache_page(), but do not wait if the page is unavailable. -+ * This is intended for speculative data generators, where the data can -+ * be regenerated if the page couldn't be grabbed. This routine should -+ * be safe to call while holding the lock for another page. -+ * -+ * Clear __GFP_FS when allocating the page to avoid recursion into the fs -+ * and deadlock against the caller's locked page. -+ */ -+static inline struct page *grab_cache_page_nowait(struct address_space *mapping, -+ pgoff_t index) -+{ -+ return pagecache_get_page(mapping, index, -+ FGP_LOCK|FGP_CREAT|FGP_NOFS|FGP_NOWAIT, -+ mapping_gfp_mask(mapping)); -+} -+ - struct page *find_get_entry(struct address_space *mapping, pgoff_t offset); --struct page *find_get_page(struct address_space *mapping, pgoff_t offset); - struct page *find_lock_entry(struct address_space *mapping, pgoff_t offset); --struct page *find_lock_page(struct address_space *mapping, pgoff_t offset); --struct page *find_or_create_page(struct address_space *mapping, pgoff_t index, -- gfp_t gfp_mask); - unsigned find_get_entries(struct address_space *mapping, pgoff_t start, - unsigned int nr_entries, struct page **entries, - pgoff_t *indices); -@@ -276,8 +372,6 @@ static inline struct page *grab_cache_page(struct address_space *mapping, - return find_or_create_page(mapping, index, mapping_gfp_mask(mapping)); - } - --extern struct page * grab_cache_page_nowait(struct address_space *mapping, -- pgoff_t index); - extern struct page * read_cache_page(struct address_space *mapping, - pgoff_t index, filler_t *filler, void *data); - extern struct page * read_cache_page_gfp(struct address_space *mapping, -diff --git a/include/linux/pci.h b/include/linux/pci.h -index 0e5e16c..d662546 100644 ---- a/include/linux/pci.h -+++ b/include/linux/pci.h -@@ -170,6 +170,8 @@ enum pci_dev_flags { - PCI_DEV_FLAGS_NO_D3 = (__force pci_dev_flags_t) 2, - /* Provide indication device is assigned by a Virtual Machine Manager */ - PCI_DEV_FLAGS_ASSIGNED = (__force pci_dev_flags_t) 4, -+ /* Do not use bus resets for device */ -+ PCI_DEV_FLAGS_NO_BUS_RESET = (__force pci_dev_flags_t) (1 << 6), - }; - - enum pci_irq_reroute_variant { -diff --git a/include/linux/swap.h b/include/linux/swap.h -index 7893249..241bf09 100644 ---- a/include/linux/swap.h -+++ b/include/linux/swap.h -@@ -268,12 +268,14 @@ extern unsigned long nr_free_pagecache_pages(void); - - - /* linux/mm/swap.c */ --extern void __lru_cache_add(struct page *); - extern void lru_cache_add(struct page *); -+extern void lru_cache_add_anon(struct page *page); -+extern void lru_cache_add_file(struct page *page); - extern void lru_add_page_tail(struct page *page, struct page *page_tail, - struct lruvec *lruvec, struct list_head *head); - extern void activate_page(struct page *); - extern void mark_page_accessed(struct page *); -+extern void init_page_accessed(struct page *page); - extern void lru_add_drain(void); - extern void lru_add_drain_cpu(int cpu); - extern void lru_add_drain_all(void); -@@ -283,22 +285,6 @@ extern void swap_setup(void); - - extern void add_page_to_unevictable_list(struct page *page); - --/** -- * lru_cache_add: add a page to the page lists -- * @page: the page to add -- */ --static inline void lru_cache_add_anon(struct page *page) --{ -- ClearPageActive(page); -- __lru_cache_add(page); --} -- --static inline void lru_cache_add_file(struct page *page) --{ -- ClearPageActive(page); -- __lru_cache_add(page); --} -- - /* linux/mm/vmscan.c */ - extern unsigned long try_to_free_pages(struct zonelist *zonelist, int order, - gfp_t gfp_mask, nodemask_t *mask); -@@ -456,7 +442,7 @@ mem_cgroup_uncharge_swapcache(struct page *page, swp_entry_t ent, bool swapout) - #define free_page_and_swap_cache(page) \ - page_cache_release(page) - #define free_pages_and_swap_cache(pages, nr) \ -- release_pages((pages), (nr), 0); -+ release_pages((pages), (nr), false); - - static inline void show_swap_cache_info(void) - { -diff --git a/include/linux/time.h b/include/linux/time.h -index d5d229b..7d532a3 100644 ---- a/include/linux/time.h -+++ b/include/linux/time.h -@@ -173,6 +173,19 @@ extern void getboottime(struct timespec *ts); - extern void monotonic_to_bootbased(struct timespec *ts); - extern void get_monotonic_boottime(struct timespec *ts); - -+static inline bool timeval_valid(const struct timeval *tv) -+{ -+ /* Dates before 1970 are bogus */ -+ if (tv->tv_sec < 0) -+ return false; -+ -+ /* Can't have more microseconds then a second */ -+ if (tv->tv_usec < 0 || tv->tv_usec >= USEC_PER_SEC) -+ return false; -+ -+ return true; -+} -+ - extern struct timespec timespec_trunc(struct timespec t, unsigned gran); - extern int timekeeping_valid_for_hres(void); - extern u64 timekeeping_max_deferment(void); -diff --git a/include/trace/events/pagemap.h b/include/trace/events/pagemap.h -index 1c9fabd..ce0803b 100644 ---- a/include/trace/events/pagemap.h -+++ b/include/trace/events/pagemap.h -@@ -28,12 +28,10 @@ TRACE_EVENT(mm_lru_insertion, - - TP_PROTO( - struct page *page, -- unsigned long pfn, -- int lru, -- unsigned long flags -+ int lru - ), - -- TP_ARGS(page, pfn, lru, flags), -+ TP_ARGS(page, lru), - - TP_STRUCT__entry( - __field(struct page *, page ) -@@ -44,9 +42,9 @@ TRACE_EVENT(mm_lru_insertion, - - TP_fast_assign( - __entry->page = page; -- __entry->pfn = pfn; -+ __entry->pfn = page_to_pfn(page); - __entry->lru = lru; -- __entry->flags = flags; -+ __entry->flags = trace_pagemap_flags(page); - ), - - /* Flag format is based on page-types.c formatting for pagemap */ -@@ -64,9 +62,9 @@ TRACE_EVENT(mm_lru_insertion, - - TRACE_EVENT(mm_lru_activate, - -- TP_PROTO(struct page *page, unsigned long pfn), -+ TP_PROTO(struct page *page), - -- TP_ARGS(page, pfn), -+ TP_ARGS(page), - - TP_STRUCT__entry( - __field(struct page *, page ) -@@ -75,7 +73,7 @@ TRACE_EVENT(mm_lru_activate, - - TP_fast_assign( - __entry->page = page; -- __entry->pfn = pfn; -+ __entry->pfn = page_to_pfn(page); - ), - - /* Flag format is based on page-types.c formatting for pagemap */ -diff --git a/kernel/cpuset.c b/kernel/cpuset.c -index 15b3ea6..2fb2877 100644 ---- a/kernel/cpuset.c -+++ b/kernel/cpuset.c -@@ -61,12 +61,7 @@ - #include <linux/cgroup.h> - #include <linux/wait.h> - --/* -- * Tracks how many cpusets are currently defined in system. -- * When there is only one cpuset (the root cpuset) we can -- * short circuit some hooks. -- */ --int number_of_cpusets __read_mostly; -+struct static_key cpusets_enabled_key __read_mostly = STATIC_KEY_INIT_FALSE; - - /* See "Frequency meter" comments, below. */ - -@@ -611,7 +606,7 @@ static int generate_sched_domains(cpumask_var_t **domains, - goto done; - } - -- csa = kmalloc(number_of_cpusets * sizeof(cp), GFP_KERNEL); -+ csa = kmalloc(nr_cpusets() * sizeof(cp), GFP_KERNEL); - if (!csa) - goto done; - csn = 0; -@@ -1961,7 +1956,7 @@ static int cpuset_css_online(struct cgroup_subsys_state *css) - if (is_spread_slab(parent)) - set_bit(CS_SPREAD_SLAB, &cs->flags); - -- number_of_cpusets++; -+ cpuset_inc(); - - if (!test_bit(CGRP_CPUSET_CLONE_CHILDREN, &css->cgroup->flags)) - goto out_unlock; -@@ -2012,7 +2007,7 @@ static void cpuset_css_offline(struct cgroup_subsys_state *css) - if (is_sched_load_balance(cs)) - update_flag(CS_SCHED_LOAD_BALANCE, cs, 0); - -- number_of_cpusets--; -+ cpuset_dec(); - clear_bit(CS_ONLINE, &cs->flags); - - mutex_unlock(&cpuset_mutex); -@@ -2067,7 +2062,6 @@ int __init cpuset_init(void) - if (!alloc_cpumask_var(&cpus_attach, GFP_KERNEL)) - BUG(); - -- number_of_cpusets = 1; - return 0; - } - -diff --git a/kernel/time.c b/kernel/time.c -index 3c49ab4..3eb322e 100644 ---- a/kernel/time.c -+++ b/kernel/time.c -@@ -195,6 +195,10 @@ SYSCALL_DEFINE2(settimeofday, struct timeval __user *, tv, - if (tv) { - if (copy_from_user(&user_tv, tv, sizeof(*tv))) - return -EFAULT; -+ -+ if (!timeval_valid(&user_tv)) -+ return -EINVAL; -+ - new_ts.tv_sec = user_tv.tv_sec; - new_ts.tv_nsec = user_tv.tv_usec * NSEC_PER_USEC; - } -diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c -index af8d1d4..28db9be 100644 ---- a/kernel/time/ntp.c -+++ b/kernel/time/ntp.c -@@ -631,6 +631,13 @@ int ntp_validate_timex(struct timex *txc) - if ((txc->modes & ADJ_SETOFFSET) && (!capable(CAP_SYS_TIME))) - return -EPERM; - -+ if (txc->modes & ADJ_FREQUENCY) { -+ if (LONG_MIN / PPM_SCALE > txc->freq) -+ return -EINVAL; -+ if (LONG_MAX / PPM_SCALE < txc->freq) -+ return -EINVAL; -+ } -+ - return 0; - } - -diff --git a/mm/filemap.c b/mm/filemap.c -index bdaa215..217cfd3 100644 ---- a/mm/filemap.c -+++ b/mm/filemap.c -@@ -644,8 +644,17 @@ EXPORT_SYMBOL(unlock_page); - */ - void end_page_writeback(struct page *page) - { -- if (TestClearPageReclaim(page)) -+ /* -+ * TestClearPageReclaim could be used here but it is an atomic -+ * operation and overkill in this particular case. Failing to -+ * shuffle a page marked for immediate reclaim is too mild to -+ * justify taking an atomic operation penalty at the end of -+ * ever page writeback. -+ */ -+ if (PageReclaim(page)) { -+ ClearPageReclaim(page); - rotate_reclaimable_page(page); -+ } - - if (!test_clear_page_writeback(page)) - BUG(); -@@ -848,26 +857,6 @@ out: - EXPORT_SYMBOL(find_get_entry); - - /** -- * find_get_page - find and get a page reference -- * @mapping: the address_space to search -- * @offset: the page index -- * -- * Looks up the page cache slot at @mapping & @offset. If there is a -- * page cache page, it is returned with an increased refcount. -- * -- * Otherwise, %NULL is returned. -- */ --struct page *find_get_page(struct address_space *mapping, pgoff_t offset) --{ -- struct page *page = find_get_entry(mapping, offset); -- -- if (radix_tree_exceptional_entry(page)) -- page = NULL; -- return page; --} --EXPORT_SYMBOL(find_get_page); -- --/** - * find_lock_entry - locate, pin and lock a page cache entry - * @mapping: the address_space to search - * @offset: the page cache index -@@ -904,66 +893,83 @@ repeat: - EXPORT_SYMBOL(find_lock_entry); - - /** -- * find_lock_page - locate, pin and lock a pagecache page -+ * pagecache_get_page - find and get a page reference - * @mapping: the address_space to search - * @offset: the page index -+ * @fgp_flags: PCG flags -+ * @gfp_mask: gfp mask to use for the page cache data page allocation - * -- * Looks up the page cache slot at @mapping & @offset. If there is a -- * page cache page, it is returned locked and with an increased -- * refcount. -- * -- * Otherwise, %NULL is returned. -+ * Looks up the page cache slot at @mapping & @offset. - * -- * find_lock_page() may sleep. -- */ --struct page *find_lock_page(struct address_space *mapping, pgoff_t offset) --{ -- struct page *page = find_lock_entry(mapping, offset); -- -- if (radix_tree_exceptional_entry(page)) -- page = NULL; -- return page; --} --EXPORT_SYMBOL(find_lock_page); -- --/** -- * find_or_create_page - locate or add a pagecache page -- * @mapping: the page's address_space -- * @index: the page's index into the mapping -- * @gfp_mask: page allocation mode -+ * PCG flags modify how the page is returned - * -- * Looks up the page cache slot at @mapping & @offset. If there is a -- * page cache page, it is returned locked and with an increased -- * refcount. -- * -- * If the page is not present, a new page is allocated using @gfp_mask -- * and added to the page cache and the VM's LRU list. The page is -- * returned locked and with an increased refcount. -+ * FGP_ACCESSED: the page will be marked accessed -+ * FGP_LOCK: Page is return locked -+ * FGP_CREAT: If page is not present then a new page is allocated using -+ * @gfp_mask and added to the page cache and the VM's LRU -+ * list. The page is returned locked and with an increased -+ * refcount. Otherwise, %NULL is returned. - * -- * On memory exhaustion, %NULL is returned. -+ * If FGP_LOCK or FGP_CREAT are specified then the function may sleep even -+ * if the GFP flags specified for FGP_CREAT are atomic. - * -- * find_or_create_page() may sleep, even if @gfp_flags specifies an -- * atomic allocation! -+ * If there is a page cache page, it is returned with an increased refcount. - */ --struct page *find_or_create_page(struct address_space *mapping, -- pgoff_t index, gfp_t gfp_mask) -+struct page *pagecache_get_page(struct address_space *mapping, pgoff_t offset, -+ int fgp_flags, gfp_t gfp_mask) - { - struct page *page; -- int err; -+ - repeat: -- page = find_lock_page(mapping, index); -- if (!page) { -+ page = find_get_entry(mapping, offset); -+ if (radix_tree_exceptional_entry(page)) -+ page = NULL; -+ if (!page) -+ goto no_page; -+ -+ if (fgp_flags & FGP_LOCK) { -+ if (fgp_flags & FGP_NOWAIT) { -+ if (!trylock_page(page)) { -+ page_cache_release(page); -+ return NULL; -+ } -+ } else { -+ lock_page(page); -+ } -+ -+ /* Has the page been truncated? */ -+ if (unlikely(page->mapping != mapping)) { -+ unlock_page(page); -+ page_cache_release(page); -+ goto repeat; -+ } -+ VM_BUG_ON(page->index != offset); -+ } -+ -+ if (page && (fgp_flags & FGP_ACCESSED)) -+ mark_page_accessed(page); -+ -+no_page: -+ if (!page && (fgp_flags & FGP_CREAT)) { -+ int err; -+ if ((fgp_flags & FGP_WRITE) && mapping_cap_account_dirty(mapping)) -+ gfp_mask |= __GFP_WRITE; -+ if (fgp_flags & FGP_NOFS) -+ gfp_mask &= ~__GFP_FS; -+ - page = __page_cache_alloc(gfp_mask); - if (!page) - return NULL; -- /* -- * We want a regular kernel memory (not highmem or DMA etc) -- * allocation for the radix tree nodes, but we need to honour -- * the context-specific requirements the caller has asked for. -- * GFP_RECLAIM_MASK collects those requirements. -- */ -- err = add_to_page_cache_lru(page, mapping, index, -- (gfp_mask & GFP_RECLAIM_MASK)); -+ -+ if (WARN_ON_ONCE(!(fgp_flags & FGP_LOCK))) -+ fgp_flags |= FGP_LOCK; -+ -+ /* Init accessed so avoit atomic mark_page_accessed later */ -+ if (fgp_flags & FGP_ACCESSED) -+ init_page_accessed(page); -+ -+ err = add_to_page_cache_lru(page, mapping, offset, -+ gfp_mask & GFP_RECLAIM_MASK); - if (unlikely(err)) { - page_cache_release(page); - page = NULL; -@@ -971,9 +977,10 @@ repeat: - goto repeat; - } - } -+ - return page; - } --EXPORT_SYMBOL(find_or_create_page); -+EXPORT_SYMBOL(pagecache_get_page); - - /** - * find_get_entries - gang pagecache lookup -@@ -1263,39 +1270,6 @@ repeat: - } - EXPORT_SYMBOL(find_get_pages_tag); - --/** -- * grab_cache_page_nowait - returns locked page at given index in given cache -- * @mapping: target address_space -- * @index: the page index -- * -- * Same as grab_cache_page(), but do not wait if the page is unavailable. -- * This is intended for speculative data generators, where the data can -- * be regenerated if the page couldn't be grabbed. This routine should -- * be safe to call while holding the lock for another page. -- * -- * Clear __GFP_FS when allocating the page to avoid recursion into the fs -- * and deadlock against the caller's locked page. -- */ --struct page * --grab_cache_page_nowait(struct address_space *mapping, pgoff_t index) --{ -- struct page *page = find_get_page(mapping, index); -- -- if (page) { -- if (trylock_page(page)) -- return page; -- page_cache_release(page); -- return NULL; -- } -- page = __page_cache_alloc(mapping_gfp_mask(mapping) & ~__GFP_FS); -- if (page && add_to_page_cache_lru(page, mapping, index, GFP_NOFS)) { -- page_cache_release(page); -- page = NULL; -- } -- return page; --} --EXPORT_SYMBOL(grab_cache_page_nowait); -- - /* - * CD/DVDs are error prone. When a medium error occurs, the driver may fail - * a _large_ part of the i/o request. Imagine the worst scenario: -@@ -2397,7 +2371,6 @@ int pagecache_write_end(struct file *file, struct address_space *mapping, - { - const struct address_space_operations *aops = mapping->a_ops; - -- mark_page_accessed(page); - return aops->write_end(file, mapping, pos, len, copied, page, fsdata); - } - EXPORT_SYMBOL(pagecache_write_end); -@@ -2479,34 +2452,17 @@ EXPORT_SYMBOL(generic_file_direct_write); - struct page *grab_cache_page_write_begin(struct address_space *mapping, - pgoff_t index, unsigned flags) - { -- int status; -- gfp_t gfp_mask; - struct page *page; -- gfp_t gfp_notmask = 0; -+ int fgp_flags = FGP_LOCK|FGP_ACCESSED|FGP_WRITE|FGP_CREAT; - -- gfp_mask = mapping_gfp_mask(mapping); -- if (mapping_cap_account_dirty(mapping)) -- gfp_mask |= __GFP_WRITE; - if (flags & AOP_FLAG_NOFS) -- gfp_notmask = __GFP_FS; --repeat: -- page = find_lock_page(mapping, index); -+ fgp_flags |= FGP_NOFS; -+ -+ page = pagecache_get_page(mapping, index, fgp_flags, -+ mapping_gfp_mask(mapping)); - if (page) -- goto found; -+ wait_for_stable_page(page); - -- page = __page_cache_alloc(gfp_mask & ~gfp_notmask); -- if (!page) -- return NULL; -- status = add_to_page_cache_lru(page, mapping, index, -- GFP_KERNEL & ~gfp_notmask); -- if (unlikely(status)) { -- page_cache_release(page); -- if (status == -EEXIST) -- goto repeat; -- return NULL; -- } --found: -- wait_for_stable_page(page); - return page; - } - EXPORT_SYMBOL(grab_cache_page_write_begin); -@@ -2555,7 +2511,7 @@ again: - - status = a_ops->write_begin(file, mapping, pos, bytes, flags, - &page, &fsdata); -- if (unlikely(status)) -+ if (unlikely(status < 0)) - break; - - if (mapping_writably_mapped(mapping)) -@@ -2564,7 +2520,6 @@ again: - copied = iov_iter_copy_from_user_atomic(page, i, offset, bytes); - flush_dcache_page(page); - -- mark_page_accessed(page); - status = a_ops->write_end(file, mapping, pos, bytes, copied, - page, fsdata); - if (unlikely(status < 0)) -diff --git a/mm/huge_memory.c b/mm/huge_memory.c -index 331faa5..adce656 100644 ---- a/mm/huge_memory.c -+++ b/mm/huge_memory.c -@@ -2273,6 +2273,30 @@ static void khugepaged_alloc_sleep(void) - - static int khugepaged_node_load[MAX_NUMNODES]; - -+static bool khugepaged_scan_abort(int nid) -+{ -+ int i; -+ -+ /* -+ * If zone_reclaim_mode is disabled, then no extra effort is made to -+ * allocate memory locally. -+ */ -+ if (!zone_reclaim_mode) -+ return false; -+ -+ /* If there is a count for this node already, it must be acceptable */ -+ if (khugepaged_node_load[nid]) -+ return false; -+ -+ for (i = 0; i < MAX_NUMNODES; i++) { -+ if (!khugepaged_node_load[i]) -+ continue; -+ if (node_distance(nid, i) > RECLAIM_DISTANCE) -+ return true; -+ } -+ return false; -+} -+ - #ifdef CONFIG_NUMA - static int khugepaged_find_target_node(void) - { -@@ -2589,6 +2613,8 @@ static int khugepaged_scan_pmd(struct mm_struct *mm, - * hit record. - */ - node = page_to_nid(page); -+ if (khugepaged_scan_abort(node)) -+ goto out_unmap; - khugepaged_node_load[node]++; - VM_BUG_ON_PAGE(PageCompound(page), page); - if (!PageLRU(page) || PageLocked(page) || !PageAnon(page)) -diff --git a/mm/memory.c b/mm/memory.c -index 924429e..7f30bea 100644 ---- a/mm/memory.c -+++ b/mm/memory.c -@@ -878,7 +878,7 @@ out_set_pte: - return 0; - } - --int copy_pte_range(struct mm_struct *dst_mm, struct mm_struct *src_mm, -+static int copy_pte_range(struct mm_struct *dst_mm, struct mm_struct *src_mm, - pmd_t *dst_pmd, pmd_t *src_pmd, struct vm_area_struct *vma, - unsigned long addr, unsigned long end) - { -@@ -3646,7 +3646,7 @@ static int handle_pte_fault(struct mm_struct *mm, - pte_t entry; - spinlock_t *ptl; - -- entry = *pte; -+ entry = ACCESS_ONCE(*pte); - if (!pte_present(entry)) { - if (pte_none(entry)) { - if (vma->vm_ops) { -diff --git a/mm/page_alloc.c b/mm/page_alloc.c -index 4b25829..ea41913 100644 ---- a/mm/page_alloc.c -+++ b/mm/page_alloc.c -@@ -408,7 +408,8 @@ static int destroy_compound_page(struct page *page, unsigned long order) - return bad; - } - --static inline void prep_zero_page(struct page *page, int order, gfp_t gfp_flags) -+static inline void prep_zero_page(struct page *page, unsigned int order, -+ gfp_t gfp_flags) - { - int i; - -@@ -452,7 +453,7 @@ static inline void set_page_guard_flag(struct page *page) { } - static inline void clear_page_guard_flag(struct page *page) { } - #endif - --static inline void set_page_order(struct page *page, int order) -+static inline void set_page_order(struct page *page, unsigned int order) - { - set_page_private(page, order); - __SetPageBuddy(page); -@@ -503,21 +504,31 @@ __find_buddy_index(unsigned long page_idx, unsigned int order) - * For recording page's order, we use page_private(page). - */ - static inline int page_is_buddy(struct page *page, struct page *buddy, -- int order) -+ unsigned int order) - { - if (!pfn_valid_within(page_to_pfn(buddy))) - return 0; - -- if (page_zone_id(page) != page_zone_id(buddy)) -- return 0; -- - if (page_is_guard(buddy) && page_order(buddy) == order) { - VM_BUG_ON_PAGE(page_count(buddy) != 0, buddy); -+ -+ if (page_zone_id(page) != page_zone_id(buddy)) -+ return 0; -+ - return 1; - } - - if (PageBuddy(buddy) && page_order(buddy) == order) { - VM_BUG_ON_PAGE(page_count(buddy) != 0, buddy); -+ -+ /* -+ * zone check is done late to avoid uselessly -+ * calculating zone/node ids for pages that could -+ * never merge. -+ */ -+ if (page_zone_id(page) != page_zone_id(buddy)) -+ return 0; -+ - return 1; - } - return 0; -@@ -549,6 +560,7 @@ static inline int page_is_buddy(struct page *page, struct page *buddy, - */ - - static inline void __free_one_page(struct page *page, -+ unsigned long pfn, - struct zone *zone, unsigned int order, - int migratetype) - { -@@ -565,7 +577,7 @@ static inline void __free_one_page(struct page *page, - - VM_BUG_ON(migratetype == -1); - -- page_idx = page_to_pfn(page) & ((1 << MAX_ORDER) - 1); -+ page_idx = pfn & ((1 << MAX_ORDER) - 1); - - VM_BUG_ON_PAGE(page_idx & ((1 << order) - 1), page); - VM_BUG_ON_PAGE(bad_range(zone, page), page); -@@ -666,9 +678,12 @@ static void free_pcppages_bulk(struct zone *zone, int count, - int migratetype = 0; - int batch_free = 0; - int to_free = count; -+ unsigned long nr_scanned; - - spin_lock(&zone->lock); -- zone->pages_scanned = 0; -+ nr_scanned = zone_page_state(zone, NR_PAGES_SCANNED); -+ if (nr_scanned) -+ __mod_zone_page_state(zone, NR_PAGES_SCANNED, -nr_scanned); - - while (to_free) { - struct page *page; -@@ -700,7 +715,7 @@ static void free_pcppages_bulk(struct zone *zone, int count, - list_del(&page->lru); - mt = get_freepage_migratetype(page); - /* MIGRATE_MOVABLE list may include MIGRATE_RESERVEs */ -- __free_one_page(page, zone, 0, mt); -+ __free_one_page(page, page_to_pfn(page), zone, 0, mt); - trace_mm_page_pcpu_drain(page, 0, mt); - if (likely(!is_migrate_isolate_page(page))) { - __mod_zone_page_state(zone, NR_FREE_PAGES, 1); -@@ -712,13 +727,18 @@ static void free_pcppages_bulk(struct zone *zone, int count, - spin_unlock(&zone->lock); - } - --static void free_one_page(struct zone *zone, struct page *page, int order, -+static void free_one_page(struct zone *zone, -+ struct page *page, unsigned long pfn, -+ unsigned int order, - int migratetype) - { -+ unsigned long nr_scanned; - spin_lock(&zone->lock); -- zone->pages_scanned = 0; -+ nr_scanned = zone_page_state(zone, NR_PAGES_SCANNED); -+ if (nr_scanned) -+ __mod_zone_page_state(zone, NR_PAGES_SCANNED, -nr_scanned); - -- __free_one_page(page, zone, order, migratetype); -+ __free_one_page(page, pfn, zone, order, migratetype); - if (unlikely(!is_migrate_isolate(migratetype))) - __mod_zone_freepage_state(zone, 1 << order, migratetype); - spin_unlock(&zone->lock); -@@ -755,15 +775,16 @@ static void __free_pages_ok(struct page *page, unsigned int order) - { - unsigned long flags; - int migratetype; -+ unsigned long pfn = page_to_pfn(page); - - if (!free_pages_prepare(page, order)) - return; - -+ migratetype = get_pfnblock_migratetype(page, pfn); - local_irq_save(flags); - __count_vm_events(PGFREE, 1 << order); -- migratetype = get_pageblock_migratetype(page); - set_freepage_migratetype(page, migratetype); -- free_one_page(page_zone(page), page, order, migratetype); -+ free_one_page(page_zone(page), page, pfn, order, migratetype); - local_irq_restore(flags); - } - -@@ -894,7 +915,7 @@ static inline int check_new_page(struct page *page) - return 0; - } - --static int prep_new_page(struct page *page, int order, gfp_t gfp_flags) -+static int prep_new_page(struct page *page, unsigned int order, gfp_t gfp_flags) - { - int i; - -@@ -1105,16 +1126,17 @@ static int try_to_steal_freepages(struct zone *zone, struct page *page, - - /* Remove an element from the buddy allocator from the fallback list */ - static inline struct page * --__rmqueue_fallback(struct zone *zone, int order, int start_migratetype) -+__rmqueue_fallback(struct zone *zone, unsigned int order, int start_migratetype) - { - struct free_area *area; -- int current_order; -+ unsigned int current_order; - struct page *page; - int migratetype, new_type, i; - - /* Find the largest possible block of pages in the other list */ -- for (current_order = MAX_ORDER-1; current_order >= order; -- --current_order) { -+ for (current_order = MAX_ORDER-1; -+ current_order >= order && current_order <= MAX_ORDER-1; -+ --current_order) { - for (i = 0;; i++) { - migratetype = fallbacks[start_migratetype][i]; - -@@ -1194,7 +1216,7 @@ retry_reserve: - */ - static int rmqueue_bulk(struct zone *zone, unsigned int order, - unsigned long count, struct list_head *list, -- int migratetype, int cold) -+ int migratetype, bool cold) - { - int i; - -@@ -1213,7 +1235,7 @@ static int rmqueue_bulk(struct zone *zone, unsigned int order, - * merge IO requests if the physical pages are ordered - * properly. - */ -- if (likely(cold == 0)) -+ if (likely(!cold)) - list_add(&page->lru, list); - else - list_add_tail(&page->lru, list); -@@ -1342,7 +1364,7 @@ void mark_free_pages(struct zone *zone) - { - unsigned long pfn, max_zone_pfn; - unsigned long flags; -- int order, t; -+ unsigned int order, t; - struct list_head *curr; - - if (zone_is_empty(zone)) -@@ -1374,19 +1396,20 @@ void mark_free_pages(struct zone *zone) - - /* - * Free a 0-order page -- * cold == 1 ? free a cold page : free a hot page -+ * cold == true ? free a cold page : free a hot page - */ --void free_hot_cold_page(struct page *page, int cold) -+void free_hot_cold_page(struct page *page, bool cold) - { - struct zone *zone = page_zone(page); - struct per_cpu_pages *pcp; - unsigned long flags; -+ unsigned long pfn = page_to_pfn(page); - int migratetype; - - if (!free_pages_prepare(page, 0)) - return; - -- migratetype = get_pageblock_migratetype(page); -+ migratetype = get_pfnblock_migratetype(page, pfn); - set_freepage_migratetype(page, migratetype); - local_irq_save(flags); - __count_vm_event(PGFREE); -@@ -1400,17 +1423,17 @@ void free_hot_cold_page(struct page *page, int cold) - */ - if (migratetype >= MIGRATE_PCPTYPES) { - if (unlikely(is_migrate_isolate(migratetype))) { -- free_one_page(zone, page, 0, migratetype); -+ free_one_page(zone, page, pfn, 0, migratetype); - goto out; - } - migratetype = MIGRATE_MOVABLE; - } - - pcp = &this_cpu_ptr(zone->pageset)->pcp; -- if (cold) -- list_add_tail(&page->lru, &pcp->lists[migratetype]); -- else -+ if (!cold) - list_add(&page->lru, &pcp->lists[migratetype]); -+ else -+ list_add_tail(&page->lru, &pcp->lists[migratetype]); - pcp->count++; - if (pcp->count >= pcp->high) { - unsigned long batch = ACCESS_ONCE(pcp->batch); -@@ -1425,7 +1448,7 @@ out: - /* - * Free a list of 0-order pages - */ --void free_hot_cold_page_list(struct list_head *list, int cold) -+void free_hot_cold_page_list(struct list_head *list, bool cold) - { - struct page *page, *next; - -@@ -1537,12 +1560,12 @@ int split_free_page(struct page *page) - */ - static inline - struct page *buffered_rmqueue(struct zone *preferred_zone, -- struct zone *zone, int order, gfp_t gfp_flags, -- int migratetype) -+ struct zone *zone, unsigned int order, -+ gfp_t gfp_flags, int migratetype) - { - unsigned long flags; - struct page *page; -- int cold = !!(gfp_flags & __GFP_COLD); -+ bool cold = ((gfp_flags & __GFP_COLD) != 0); - - again: - if (likely(order == 0)) { -@@ -1591,6 +1614,9 @@ again: - } - - __mod_zone_page_state(zone, NR_ALLOC_BATCH, -(1 << order)); -+ if (zone_page_state(zone, NR_ALLOC_BATCH) == 0 && -+ !zone_is_fair_depleted(zone)) -+ zone_set_flag(zone, ZONE_FAIR_DEPLETED); - - __count_zone_vm_events(PGALLOC, zone, 1 << order); - zone_statistics(preferred_zone, zone, gfp_flags); -@@ -1687,12 +1713,12 @@ static inline bool should_fail_alloc_page(gfp_t gfp_mask, unsigned int order) - * Return true if free pages are above 'mark'. This takes into account the order - * of the allocation. - */ --static bool __zone_watermark_ok(struct zone *z, int order, unsigned long mark, -- int classzone_idx, int alloc_flags, long free_pages) -+static bool __zone_watermark_ok(struct zone *z, unsigned int order, -+ unsigned long mark, int classzone_idx, int alloc_flags, -+ long free_pages) - { - /* free_pages my go negative - that's OK */ - long min = mark; -- long lowmem_reserve = z->lowmem_reserve[classzone_idx]; - int o; - long free_cma = 0; - -@@ -1707,7 +1733,7 @@ static bool __zone_watermark_ok(struct zone *z, int order, unsigned long mark, - free_cma = zone_page_state(z, NR_FREE_CMA_PAGES); - #endif - -- if (free_pages - free_cma <= min + lowmem_reserve) -+ if (free_pages - free_cma <= min + z->lowmem_reserve[classzone_idx]) - return false; - for (o = 0; o < order; o++) { - /* At the next order, this order's pages become unavailable */ -@@ -1722,15 +1748,15 @@ static bool __zone_watermark_ok(struct zone *z, int order, unsigned long mark, - return true; - } - --bool zone_watermark_ok(struct zone *z, int order, unsigned long mark, -+bool zone_watermark_ok(struct zone *z, unsigned int order, unsigned long mark, - int classzone_idx, int alloc_flags) - { - return __zone_watermark_ok(z, order, mark, classzone_idx, alloc_flags, - zone_page_state(z, NR_FREE_PAGES)); - } - --bool zone_watermark_ok_safe(struct zone *z, int order, unsigned long mark, -- int classzone_idx, int alloc_flags) -+bool zone_watermark_ok_safe(struct zone *z, unsigned int order, -+ unsigned long mark, int classzone_idx, int alloc_flags) - { - long free_pages = zone_page_state(z, NR_FREE_PAGES); - -@@ -1915,6 +1941,18 @@ static inline void init_zone_allows_reclaim(int nid) - } - #endif /* CONFIG_NUMA */ - -+static void reset_alloc_batches(struct zone *preferred_zone) -+{ -+ struct zone *zone = preferred_zone->zone_pgdat->node_zones; -+ -+ do { -+ mod_zone_page_state(zone, NR_ALLOC_BATCH, -+ high_wmark_pages(zone) - low_wmark_pages(zone) - -+ atomic_long_read(&zone->vm_stat[NR_ALLOC_BATCH])); -+ zone_clear_flag(zone, ZONE_FAIR_DEPLETED); -+ } while (zone++ != preferred_zone); -+} -+ - /* - * get_page_from_freelist goes through the zonelist trying to allocate - * a page. -@@ -1922,18 +1960,22 @@ static inline void init_zone_allows_reclaim(int nid) - static struct page * - get_page_from_freelist(gfp_t gfp_mask, nodemask_t *nodemask, unsigned int order, - struct zonelist *zonelist, int high_zoneidx, int alloc_flags, -- struct zone *preferred_zone, int migratetype) -+ struct zone *preferred_zone, int classzone_idx, int migratetype) - { - struct zoneref *z; - struct page *page = NULL; -- int classzone_idx; - struct zone *zone; - nodemask_t *allowednodes = NULL;/* zonelist_cache approximation */ - int zlc_active = 0; /* set if using zonelist_cache */ - int did_zlc_setup = 0; /* just call zlc_setup() one time */ -+ bool consider_zone_dirty = (alloc_flags & ALLOC_WMARK_LOW) && -+ (gfp_mask & __GFP_WRITE); -+ int nr_fair_skipped = 0; -+ bool zonelist_rescan; - -- classzone_idx = zone_idx(preferred_zone); - zonelist_scan: -+ zonelist_rescan = false; -+ - /* - * Scan zonelist, looking for a zone with enough free. - * See also __cpuset_node_allowed_softwall() comment in kernel/cpuset.c. -@@ -1945,12 +1987,10 @@ zonelist_scan: - if (IS_ENABLED(CONFIG_NUMA) && zlc_active && - !zlc_zone_worth_trying(zonelist, z, allowednodes)) - continue; -- if ((alloc_flags & ALLOC_CPUSET) && -+ if (cpusets_enabled() && -+ (alloc_flags & ALLOC_CPUSET) && - !cpuset_zone_allowed_softwall(zone, gfp_mask)) - continue; -- BUILD_BUG_ON(ALLOC_NO_WATERMARKS < NR_WMARK); -- if (unlikely(alloc_flags & ALLOC_NO_WATERMARKS)) -- goto try_this_zone; - /* - * Distribute pages in proportion to the individual - * zone size to ensure fair page aging. The zone a -@@ -1959,9 +1999,11 @@ zonelist_scan: - */ - if (alloc_flags & ALLOC_FAIR) { - if (!zone_local(preferred_zone, zone)) -+ break; -+ if (zone_is_fair_depleted(zone)) { -+ nr_fair_skipped++; - continue; -- if (atomic_long_read(&zone->vm_stat[NR_ALLOC_BATCH]) <= 0) -- continue; -+ } - } - /* - * When allocating a page cache page for writing, we -@@ -1989,15 +2031,19 @@ zonelist_scan: - * will require awareness of zones in the - * dirty-throttling and the flusher threads. - */ -- if ((alloc_flags & ALLOC_WMARK_LOW) && -- (gfp_mask & __GFP_WRITE) && !zone_dirty_ok(zone)) -- goto this_zone_full; -+ if (consider_zone_dirty && !zone_dirty_ok(zone)) -+ continue; - - mark = zone->watermark[alloc_flags & ALLOC_WMARK_MASK]; - if (!zone_watermark_ok(zone, order, mark, - classzone_idx, alloc_flags)) { - int ret; - -+ /* Checked here to keep the fast path fast */ -+ BUILD_BUG_ON(ALLOC_NO_WATERMARKS < NR_WMARK); -+ if (alloc_flags & ALLOC_NO_WATERMARKS) -+ goto try_this_zone; -+ - if (IS_ENABLED(CONFIG_NUMA) && - !did_zlc_setup && nr_online_nodes > 1) { - /* -@@ -2059,17 +2105,11 @@ try_this_zone: - if (page) - break; - this_zone_full: -- if (IS_ENABLED(CONFIG_NUMA)) -+ if (IS_ENABLED(CONFIG_NUMA) && zlc_active) - zlc_mark_zone_full(zonelist, z); - } - -- if (unlikely(IS_ENABLED(CONFIG_NUMA) && page == NULL && zlc_active)) { -- /* Disable zlc cache for second zonelist scan */ -- zlc_active = 0; -- goto zonelist_scan; -- } -- -- if (page) -+ if (page) { - /* - * page->pfmemalloc is set when ALLOC_NO_WATERMARKS was - * necessary to allocate the page. The expectation is -@@ -2078,8 +2118,37 @@ this_zone_full: - * for !PFMEMALLOC purposes. - */ - page->pfmemalloc = !!(alloc_flags & ALLOC_NO_WATERMARKS); -+ return page; -+ } - -- return page; -+ /* -+ * The first pass makes sure allocations are spread fairly within the -+ * local node. However, the local node might have free pages left -+ * after the fairness batches are exhausted, and remote zones haven't -+ * even been considered yet. Try once more without fairness, and -+ * include remote zones now, before entering the slowpath and waking -+ * kswapd: prefer spilling to a remote zone over swapping locally. -+ */ -+ if (alloc_flags & ALLOC_FAIR) { -+ alloc_flags &= ~ALLOC_FAIR; -+ if (nr_fair_skipped) { -+ zonelist_rescan = true; -+ reset_alloc_batches(preferred_zone); -+ } -+ if (nr_online_nodes > 1) -+ zonelist_rescan = true; -+ } -+ -+ if (unlikely(IS_ENABLED(CONFIG_NUMA) && zlc_active)) { -+ /* Disable zlc cache for second zonelist scan */ -+ zlc_active = 0; -+ zonelist_rescan = true; -+ } -+ -+ if (zonelist_rescan) -+ goto zonelist_scan; -+ -+ return NULL; - } - - /* -@@ -2188,7 +2257,7 @@ static inline struct page * - __alloc_pages_may_oom(gfp_t gfp_mask, unsigned int order, - struct zonelist *zonelist, enum zone_type high_zoneidx, - nodemask_t *nodemask, struct zone *preferred_zone, -- int migratetype) -+ int classzone_idx, int migratetype) - { - struct page *page; - -@@ -2214,7 +2283,7 @@ __alloc_pages_may_oom(gfp_t gfp_mask, unsigned int order, - page = get_page_from_freelist(gfp_mask|__GFP_HARDWALL, nodemask, - order, zonelist, high_zoneidx, - ALLOC_WMARK_HIGH|ALLOC_CPUSET, -- preferred_zone, migratetype); -+ preferred_zone, classzone_idx, migratetype); - if (page) - goto out; - -@@ -2249,7 +2318,7 @@ static struct page * - __alloc_pages_direct_compact(gfp_t gfp_mask, unsigned int order, - struct zonelist *zonelist, enum zone_type high_zoneidx, - nodemask_t *nodemask, int alloc_flags, struct zone *preferred_zone, -- int migratetype, enum migrate_mode mode, -+ int classzone_idx, int migratetype, enum migrate_mode mode, - bool *contended_compaction, bool *deferred_compaction, - unsigned long *did_some_progress) - { -@@ -2277,7 +2346,7 @@ __alloc_pages_direct_compact(gfp_t gfp_mask, unsigned int order, - page = get_page_from_freelist(gfp_mask, nodemask, - order, zonelist, high_zoneidx, - alloc_flags & ~ALLOC_NO_WATERMARKS, -- preferred_zone, migratetype); -+ preferred_zone, classzone_idx, migratetype); - if (page) { - preferred_zone->compact_blockskip_flush = false; - compaction_defer_reset(preferred_zone, order, true); -@@ -2309,7 +2378,8 @@ static inline struct page * - __alloc_pages_direct_compact(gfp_t gfp_mask, unsigned int order, - struct zonelist *zonelist, enum zone_type high_zoneidx, - nodemask_t *nodemask, int alloc_flags, struct zone *preferred_zone, -- int migratetype, enum migrate_mode mode, bool *contended_compaction, -+ int classzone_idx, int migratetype, -+ enum migrate_mode mode, bool *contended_compaction, - bool *deferred_compaction, unsigned long *did_some_progress) - { - return NULL; -@@ -2349,7 +2419,7 @@ static inline struct page * - __alloc_pages_direct_reclaim(gfp_t gfp_mask, unsigned int order, - struct zonelist *zonelist, enum zone_type high_zoneidx, - nodemask_t *nodemask, int alloc_flags, struct zone *preferred_zone, -- int migratetype, unsigned long *did_some_progress) -+ int classzone_idx, int migratetype, unsigned long *did_some_progress) - { - struct page *page = NULL; - bool drained = false; -@@ -2367,7 +2437,8 @@ retry: - page = get_page_from_freelist(gfp_mask, nodemask, order, - zonelist, high_zoneidx, - alloc_flags & ~ALLOC_NO_WATERMARKS, -- preferred_zone, migratetype); -+ preferred_zone, classzone_idx, -+ migratetype); - - /* - * If an allocation failed after direct reclaim, it could be because -@@ -2390,14 +2461,14 @@ static inline struct page * - __alloc_pages_high_priority(gfp_t gfp_mask, unsigned int order, - struct zonelist *zonelist, enum zone_type high_zoneidx, - nodemask_t *nodemask, struct zone *preferred_zone, -- int migratetype) -+ int classzone_idx, int migratetype) - { - struct page *page; - - do { - page = get_page_from_freelist(gfp_mask, nodemask, order, - zonelist, high_zoneidx, ALLOC_NO_WATERMARKS, -- preferred_zone, migratetype); -+ preferred_zone, classzone_idx, migratetype); - - if (!page && gfp_mask & __GFP_NOFAIL) - wait_iff_congested(preferred_zone, BLK_RW_ASYNC, HZ/50); -@@ -2406,28 +2477,6 @@ __alloc_pages_high_priority(gfp_t gfp_mask, unsigned int order, - return page; - } - --static void reset_alloc_batches(struct zonelist *zonelist, -- enum zone_type high_zoneidx, -- struct zone *preferred_zone) --{ -- struct zoneref *z; -- struct zone *zone; -- -- for_each_zone_zonelist(zone, z, zonelist, high_zoneidx) { -- /* -- * Only reset the batches of zones that were actually -- * considered in the fairness pass, we don't want to -- * trash fairness information for zones that are not -- * actually part of this zonelist's round-robin cycle. -- */ -- if (!zone_local(preferred_zone, zone)) -- continue; -- mod_zone_page_state(zone, NR_ALLOC_BATCH, -- high_wmark_pages(zone) - low_wmark_pages(zone) - -- atomic_long_read(&zone->vm_stat[NR_ALLOC_BATCH])); -- } --} -- - static void wake_all_kswapds(unsigned int order, - struct zonelist *zonelist, - enum zone_type high_zoneidx, -@@ -2498,7 +2547,7 @@ static inline struct page * - __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order, - struct zonelist *zonelist, enum zone_type high_zoneidx, - nodemask_t *nodemask, struct zone *preferred_zone, -- int migratetype) -+ int classzone_idx, int migratetype) - { - const gfp_t wait = gfp_mask & __GFP_WAIT; - struct page *page = NULL; -@@ -2547,15 +2596,19 @@ restart: - * Find the true preferred zone if the allocation is unconstrained by - * cpusets. - */ -- if (!(alloc_flags & ALLOC_CPUSET) && !nodemask) -- first_zones_zonelist(zonelist, high_zoneidx, NULL, -- &preferred_zone); -+ if (!(alloc_flags & ALLOC_CPUSET) && !nodemask) { -+ struct zoneref *preferred_zoneref; -+ preferred_zoneref = first_zones_zonelist(zonelist, high_zoneidx, -+ NULL, -+ &preferred_zone); -+ classzone_idx = zonelist_zone_idx(preferred_zoneref); -+ } - - rebalance: - /* This is the last chance, in general, before the goto nopage. */ - page = get_page_from_freelist(gfp_mask, nodemask, order, zonelist, - high_zoneidx, alloc_flags & ~ALLOC_NO_WATERMARKS, -- preferred_zone, migratetype); -+ preferred_zone, classzone_idx, migratetype); - if (page) - goto got_pg; - -@@ -2570,7 +2623,7 @@ rebalance: - - page = __alloc_pages_high_priority(gfp_mask, order, - zonelist, high_zoneidx, nodemask, -- preferred_zone, migratetype); -+ preferred_zone, classzone_idx, migratetype); - if (page) { - goto got_pg; - } -@@ -2601,7 +2654,8 @@ rebalance: - */ - page = __alloc_pages_direct_compact(gfp_mask, order, zonelist, - high_zoneidx, nodemask, alloc_flags, -- preferred_zone, migratetype, -+ preferred_zone, -+ classzone_idx, migratetype, - migration_mode, &contended_compaction, - &deferred_compaction, - &did_some_progress); -@@ -2624,7 +2678,8 @@ rebalance: - zonelist, high_zoneidx, - nodemask, - alloc_flags, preferred_zone, -- migratetype, &did_some_progress); -+ classzone_idx, migratetype, -+ &did_some_progress); - if (page) - goto got_pg; - -@@ -2643,7 +2698,7 @@ rebalance: - page = __alloc_pages_may_oom(gfp_mask, order, - zonelist, high_zoneidx, - nodemask, preferred_zone, -- migratetype); -+ classzone_idx, migratetype); - if (page) - goto got_pg; - -@@ -2684,7 +2739,8 @@ rebalance: - */ - page = __alloc_pages_direct_compact(gfp_mask, order, zonelist, - high_zoneidx, nodemask, alloc_flags, -- preferred_zone, migratetype, -+ preferred_zone, -+ classzone_idx, migratetype, - migration_mode, &contended_compaction, - &deferred_compaction, - &did_some_progress); -@@ -2711,11 +2767,13 @@ __alloc_pages_nodemask(gfp_t gfp_mask, unsigned int order, - { - enum zone_type high_zoneidx = gfp_zone(gfp_mask); - struct zone *preferred_zone; -+ struct zoneref *preferred_zoneref; - struct page *page = NULL; - int migratetype = allocflags_to_migratetype(gfp_mask); - unsigned int cpuset_mems_cookie; - int alloc_flags = ALLOC_WMARK_LOW|ALLOC_CPUSET|ALLOC_FAIR; - struct mem_cgroup *memcg = NULL; -+ int classzone_idx; - - gfp_mask &= gfp_allowed_mask; - -@@ -2745,39 +2803,23 @@ retry_cpuset: - cpuset_mems_cookie = read_mems_allowed_begin(); - - /* The preferred zone is used for statistics later */ -- first_zones_zonelist(zonelist, high_zoneidx, -+ preferred_zoneref = first_zones_zonelist(zonelist, high_zoneidx, - nodemask ? : &cpuset_current_mems_allowed, - &preferred_zone); - if (!preferred_zone) - goto out; -+ classzone_idx = zonelist_zone_idx(preferred_zoneref); - - #ifdef CONFIG_CMA - if (allocflags_to_migratetype(gfp_mask) == MIGRATE_MOVABLE) - alloc_flags |= ALLOC_CMA; - #endif --retry: - /* First allocation attempt */ - page = get_page_from_freelist(gfp_mask|__GFP_HARDWALL, nodemask, order, - zonelist, high_zoneidx, alloc_flags, -- preferred_zone, migratetype); -+ preferred_zone, classzone_idx, migratetype); - if (unlikely(!page)) { - /* -- * The first pass makes sure allocations are spread -- * fairly within the local node. However, the local -- * node might have free pages left after the fairness -- * batches are exhausted, and remote zones haven't -- * even been considered yet. Try once more without -- * fairness, and include remote zones now, before -- * entering the slowpath and waking kswapd: prefer -- * spilling to a remote zone over swapping locally. -- */ -- if (alloc_flags & ALLOC_FAIR) { -- reset_alloc_batches(zonelist, high_zoneidx, -- preferred_zone); -- alloc_flags &= ~ALLOC_FAIR; -- goto retry; -- } -- /* - * Runtime PM, block IO and its error handling path - * can deadlock because I/O on the device might not - * complete. -@@ -2785,7 +2827,7 @@ retry: - gfp_mask = memalloc_noio_flags(gfp_mask); - page = __alloc_pages_slowpath(gfp_mask, order, - zonelist, high_zoneidx, nodemask, -- preferred_zone, migratetype); -+ preferred_zone, classzone_idx, migratetype); - } - - trace_mm_page_alloc(page, order, gfp_mask, migratetype); -@@ -2836,7 +2878,7 @@ void __free_pages(struct page *page, unsigned int order) - { - if (put_page_testzero(page)) { - if (order == 0) -- free_hot_cold_page(page, 0); -+ free_hot_cold_page(page, false); - else - __free_pages_ok(page, order); - } -@@ -3220,12 +3262,12 @@ void show_free_areas(unsigned int filter) - K(zone_page_state(zone, NR_BOUNCE)), - K(zone_page_state(zone, NR_FREE_CMA_PAGES)), - K(zone_page_state(zone, NR_WRITEBACK_TEMP)), -- zone->pages_scanned, -+ K(zone_page_state(zone, NR_PAGES_SCANNED)), - (!zone_reclaimable(zone) ? "yes" : "no") - ); - printk("lowmem_reserve[]:"); - for (i = 0; i < MAX_NR_ZONES; i++) -- printk(" %lu", zone->lowmem_reserve[i]); -+ printk(" %ld", zone->lowmem_reserve[i]); - printk("\n"); - } - -@@ -4113,7 +4155,7 @@ void __meminit memmap_init_zone(unsigned long size, int nid, unsigned long zone, - - static void __meminit zone_init_free_lists(struct zone *zone) - { -- int order, t; -+ unsigned int order, t; - for_each_migratetype_order(order, t) { - INIT_LIST_HEAD(&zone->free_area[order].free_list[t]); - zone->free_area[order].nr_free = 0; -@@ -5553,7 +5595,7 @@ static void calculate_totalreserve_pages(void) - for_each_online_pgdat(pgdat) { - for (i = 0; i < MAX_NR_ZONES; i++) { - struct zone *zone = pgdat->node_zones + i; -- unsigned long max = 0; -+ long max = 0; - - /* Find valid and maximum lowmem_reserve in the zone */ - for (j = i; j < MAX_NR_ZONES; j++) { -@@ -6041,17 +6083,16 @@ static inline int pfn_to_bitidx(struct zone *zone, unsigned long pfn) - * @end_bitidx: The last bit of interest - * returns pageblock_bits flags - */ --unsigned long get_pageblock_flags_mask(struct page *page, -+unsigned long get_pfnblock_flags_mask(struct page *page, unsigned long pfn, - unsigned long end_bitidx, - unsigned long mask) - { - struct zone *zone; - unsigned long *bitmap; -- unsigned long pfn, bitidx, word_bitidx; -+ unsigned long bitidx, word_bitidx; - unsigned long word; - - zone = page_zone(page); -- pfn = page_to_pfn(page); - bitmap = get_pageblock_bitmap(zone, pfn); - bitidx = pfn_to_bitidx(zone, pfn); - word_bitidx = bitidx / BITS_PER_LONG; -@@ -6063,25 +6104,25 @@ unsigned long get_pageblock_flags_mask(struct page *page, - } - - /** -- * set_pageblock_flags_mask - Set the requested group of flags for a pageblock_nr_pages block of pages -+ * set_pfnblock_flags_mask - Set the requested group of flags for a pageblock_nr_pages block of pages - * @page: The page within the block of interest - * @start_bitidx: The first bit of interest - * @end_bitidx: The last bit of interest - * @flags: The flags to set - */ --void set_pageblock_flags_mask(struct page *page, unsigned long flags, -+void set_pfnblock_flags_mask(struct page *page, unsigned long flags, -+ unsigned long pfn, - unsigned long end_bitidx, - unsigned long mask) - { - struct zone *zone; - unsigned long *bitmap; -- unsigned long pfn, bitidx, word_bitidx; -+ unsigned long bitidx, word_bitidx; - unsigned long old_word, word; - - BUILD_BUG_ON(NR_PAGEBLOCK_BITS != 4); - - zone = page_zone(page); -- pfn = page_to_pfn(page); - bitmap = get_pageblock_bitmap(zone, pfn); - bitidx = pfn_to_bitidx(zone, pfn); - word_bitidx = bitidx / BITS_PER_LONG; -@@ -6453,7 +6494,7 @@ __offline_isolated_pages(unsigned long start_pfn, unsigned long end_pfn) - { - struct page *page; - struct zone *zone; -- int order, i; -+ unsigned int order, i; - unsigned long pfn; - unsigned long flags; - /* find the first valid pfn */ -@@ -6505,7 +6546,7 @@ bool is_free_buddy_page(struct page *page) - struct zone *zone = page_zone(page); - unsigned long pfn = page_to_pfn(page); - unsigned long flags; -- int order; -+ unsigned int order; - - spin_lock_irqsave(&zone->lock, flags); - for (order = 0; order < MAX_ORDER; order++) { -diff --git a/mm/shmem.c b/mm/shmem.c -index 0f14475..85d8a1a 100644 ---- a/mm/shmem.c -+++ b/mm/shmem.c -@@ -1035,6 +1035,9 @@ repeat: - goto failed; - } - -+ if (page && sgp == SGP_WRITE) -+ mark_page_accessed(page); -+ - /* fallocated page? */ - if (page && !PageUptodate(page)) { - if (sgp != SGP_READ) -@@ -1116,6 +1119,9 @@ repeat: - shmem_recalc_inode(inode); - spin_unlock(&info->lock); - -+ if (sgp == SGP_WRITE) -+ mark_page_accessed(page); -+ - delete_from_swap_cache(page); - set_page_dirty(page); - swap_free(swap); -@@ -1140,8 +1146,11 @@ repeat: - goto decused; - } - -- SetPageSwapBacked(page); -+ __SetPageSwapBacked(page); - __set_page_locked(page); -+ if (sgp == SGP_WRITE) -+ init_page_accessed(page); -+ - error = mem_cgroup_cache_charge(page, current->mm, - gfp & GFP_RECLAIM_MASK); - if (error) -diff --git a/mm/swap.c b/mm/swap.c -index c8048d7..d2ceddf 100644 ---- a/mm/swap.c -+++ b/mm/swap.c -@@ -67,7 +67,7 @@ static void __page_cache_release(struct page *page) - static void __put_single_page(struct page *page) - { - __page_cache_release(page); -- free_hot_cold_page(page, 0); -+ free_hot_cold_page(page, false); - } - - static void __put_compound_page(struct page *page) -@@ -469,7 +469,7 @@ static void __activate_page(struct page *page, struct lruvec *lruvec, - SetPageActive(page); - lru += LRU_ACTIVE; - add_page_to_lru_list(page, lruvec, lru); -- trace_mm_lru_activate(page, page_to_pfn(page)); -+ trace_mm_lru_activate(page); - - __count_vm_event(PGACTIVATE); - update_page_reclaim_stat(lruvec, file, 1); -@@ -581,12 +581,17 @@ void mark_page_accessed(struct page *page) - EXPORT_SYMBOL(mark_page_accessed); - - /* -- * Queue the page for addition to the LRU via pagevec. The decision on whether -- * to add the page to the [in]active [file|anon] list is deferred until the -- * pagevec is drained. This gives a chance for the caller of __lru_cache_add() -- * have the page added to the active list using mark_page_accessed(). -+ * Used to mark_page_accessed(page) that is not visible yet and when it is -+ * still safe to use non-atomic ops - */ --void __lru_cache_add(struct page *page) -+void init_page_accessed(struct page *page) -+{ -+ if (!PageReferenced(page)) -+ __SetPageReferenced(page); -+} -+EXPORT_SYMBOL(init_page_accessed); -+ -+static void __lru_cache_add(struct page *page) - { - struct pagevec *pvec = &get_cpu_var(lru_add_pvec); - -@@ -596,11 +601,34 @@ void __lru_cache_add(struct page *page) - pagevec_add(pvec, page); - put_cpu_var(lru_add_pvec); - } --EXPORT_SYMBOL(__lru_cache_add); -+ -+/** -+ * lru_cache_add: add a page to the page lists -+ * @page: the page to add -+ */ -+void lru_cache_add_anon(struct page *page) -+{ -+ if (PageActive(page)) -+ ClearPageActive(page); -+ __lru_cache_add(page); -+} -+ -+void lru_cache_add_file(struct page *page) -+{ -+ if (PageActive(page)) -+ ClearPageActive(page); -+ __lru_cache_add(page); -+} -+EXPORT_SYMBOL(lru_cache_add_file); - - /** - * lru_cache_add - add a page to a page list - * @page: the page to be added to the LRU. -+ * -+ * Queue the page for addition to the LRU via pagevec. The decision on whether -+ * to add the page to the [in]active [file|anon] list is deferred until the -+ * pagevec is drained. This gives a chance for the caller of lru_cache_add() -+ * have the page added to the active list using mark_page_accessed(). - */ - void lru_cache_add(struct page *page) - { -@@ -811,7 +839,7 @@ void lru_add_drain_all(void) - * grabbed the page via the LRU. If it did, give up: shrink_inactive_list() - * will free it. - */ --void release_pages(struct page **pages, int nr, int cold) -+void release_pages(struct page **pages, int nr, bool cold) - { - int i; - LIST_HEAD(pages_to_free); -@@ -852,7 +880,7 @@ void release_pages(struct page **pages, int nr, int cold) - } - - /* Clear Active bit in case of parallel mark_page_accessed */ -- ClearPageActive(page); -+ __ClearPageActive(page); - - list_add(&page->lru, &pages_to_free); - } -@@ -934,7 +962,7 @@ static void __pagevec_lru_add_fn(struct page *page, struct lruvec *lruvec, - SetPageLRU(page); - add_page_to_lru_list(page, lruvec, lru); - update_page_reclaim_stat(lruvec, file, active); -- trace_mm_lru_insertion(page, page_to_pfn(page), lru, trace_pagemap_flags(page)); -+ trace_mm_lru_insertion(page, lru); - } - - /* -diff --git a/mm/swap_state.c b/mm/swap_state.c -index e76ace3..2972eee 100644 ---- a/mm/swap_state.c -+++ b/mm/swap_state.c -@@ -270,7 +270,7 @@ void free_pages_and_swap_cache(struct page **pages, int nr) - - for (i = 0; i < todo; i++) - free_swap_cache(pagep[i]); -- release_pages(pagep, todo, 0); -+ release_pages(pagep, todo, false); - pagep += todo; - nr -= todo; - } -diff --git a/mm/vmalloc.c b/mm/vmalloc.c -index 0fdf968..aa3891e 100644 ---- a/mm/vmalloc.c -+++ b/mm/vmalloc.c -@@ -2681,14 +2681,14 @@ void get_vmalloc_info(struct vmalloc_info *vmi) - - prev_end = VMALLOC_START; - -- spin_lock(&vmap_area_lock); -+ rcu_read_lock(); - - if (list_empty(&vmap_area_list)) { - vmi->largest_chunk = VMALLOC_TOTAL; - goto out; - } - -- list_for_each_entry(va, &vmap_area_list, list) { -+ list_for_each_entry_rcu(va, &vmap_area_list, list) { - unsigned long addr = va->va_start; - - /* -@@ -2715,7 +2715,7 @@ void get_vmalloc_info(struct vmalloc_info *vmi) - vmi->largest_chunk = VMALLOC_END - prev_end; - - out: -- spin_unlock(&vmap_area_lock); -+ rcu_read_unlock(); - } - #endif - -diff --git a/mm/vmscan.c b/mm/vmscan.c -index be6a689..b850ced6 100644 ---- a/mm/vmscan.c -+++ b/mm/vmscan.c -@@ -163,7 +163,8 @@ static unsigned long zone_reclaimable_pages(struct zone *zone) - - bool zone_reclaimable(struct zone *zone) - { -- return zone->pages_scanned < zone_reclaimable_pages(zone) * 6; -+ return zone_page_state(zone, NR_PAGES_SCANNED) < -+ zone_reclaimable_pages(zone) * 6; - } - - static unsigned long get_lru_size(struct lruvec *lruvec, enum lru_list lru) -@@ -1107,7 +1108,7 @@ keep: - VM_BUG_ON_PAGE(PageLRU(page) || PageUnevictable(page), page); - } - -- free_hot_cold_page_list(&free_pages, 1); -+ free_hot_cold_page_list(&free_pages, true); - - list_splice(&ret_pages, page_list); - count_vm_events(PGACTIVATE, pgactivate); -@@ -1470,7 +1471,7 @@ shrink_inactive_list(unsigned long nr_to_scan, struct lruvec *lruvec, - __mod_zone_page_state(zone, NR_ISOLATED_ANON + file, nr_taken); - - if (global_reclaim(sc)) { -- zone->pages_scanned += nr_scanned; -+ __mod_zone_page_state(zone, NR_PAGES_SCANNED, nr_scanned); - if (current_is_kswapd()) - __count_zone_vm_events(PGSCAN_KSWAPD, zone, nr_scanned); - else -@@ -1505,7 +1506,7 @@ shrink_inactive_list(unsigned long nr_to_scan, struct lruvec *lruvec, - - spin_unlock_irq(&zone->lru_lock); - -- free_hot_cold_page_list(&page_list, 1); -+ free_hot_cold_page_list(&page_list, true); - - /* - * If reclaim is isolating dirty pages under writeback, it implies -@@ -1659,7 +1660,7 @@ static void shrink_active_list(unsigned long nr_to_scan, - nr_taken = isolate_lru_pages(nr_to_scan, lruvec, &l_hold, - &nr_scanned, sc, isolate_mode, lru); - if (global_reclaim(sc)) -- zone->pages_scanned += nr_scanned; -+ __mod_zone_page_state(zone, NR_PAGES_SCANNED, nr_scanned); - - reclaim_stat->recent_scanned[file] += nr_taken; - -@@ -1725,7 +1726,7 @@ static void shrink_active_list(unsigned long nr_to_scan, - __mod_zone_page_state(zone, NR_ISOLATED_ANON + file, -nr_taken); - spin_unlock_irq(&zone->lru_lock); - -- free_hot_cold_page_list(&l_hold, 1); -+ free_hot_cold_page_list(&l_hold, true); - } - - #ifdef CONFIG_SWAP -@@ -1847,7 +1848,7 @@ static void get_scan_count(struct lruvec *lruvec, struct scan_control *sc, - struct zone *zone = lruvec_zone(lruvec); - unsigned long anon_prio, file_prio; - enum scan_balance scan_balance; -- unsigned long anon, file, free; -+ unsigned long anon, file; - bool force_scan = false; - unsigned long ap, fp; - enum lru_list lru; -@@ -1895,11 +1896,6 @@ static void get_scan_count(struct lruvec *lruvec, struct scan_control *sc, - goto out; - } - -- anon = get_lru_size(lruvec, LRU_ACTIVE_ANON) + -- get_lru_size(lruvec, LRU_INACTIVE_ANON); -- file = get_lru_size(lruvec, LRU_ACTIVE_FILE) + -- get_lru_size(lruvec, LRU_INACTIVE_FILE); -- - /* - * If it's foreseeable that reclaiming the file cache won't be - * enough to get the zone back into a desirable shape, we have -@@ -1907,8 +1903,14 @@ static void get_scan_count(struct lruvec *lruvec, struct scan_control *sc, - * thrashing - remaining file pages alone. - */ - if (global_reclaim(sc)) { -- free = zone_page_state(zone, NR_FREE_PAGES); -- if (unlikely(file + free <= high_wmark_pages(zone))) { -+ unsigned long zonefile; -+ unsigned long zonefree; -+ -+ zonefree = zone_page_state(zone, NR_FREE_PAGES); -+ zonefile = zone_page_state(zone, NR_ACTIVE_FILE) + -+ zone_page_state(zone, NR_INACTIVE_FILE); -+ -+ if (unlikely(zonefile + zonefree <= high_wmark_pages(zone))) { - scan_balance = SCAN_ANON; - goto out; - } -@@ -1943,6 +1945,12 @@ static void get_scan_count(struct lruvec *lruvec, struct scan_control *sc, - * - * anon in [0], file in [1] - */ -+ -+ anon = get_lru_size(lruvec, LRU_ACTIVE_ANON) + -+ get_lru_size(lruvec, LRU_INACTIVE_ANON); -+ file = get_lru_size(lruvec, LRU_ACTIVE_FILE) + -+ get_lru_size(lruvec, LRU_INACTIVE_FILE); -+ - spin_lock_irq(&zone->lru_lock); - if (unlikely(reclaim_stat->recent_scanned[0] > anon / 4)) { - reclaim_stat->recent_scanned[0] /= 2; -diff --git a/mm/vmstat.c b/mm/vmstat.c -index def5dd2..eded190 100644 ---- a/mm/vmstat.c -+++ b/mm/vmstat.c -@@ -200,7 +200,7 @@ void set_pgdat_percpu_threshold(pg_data_t *pgdat, - continue; - - threshold = (*calculate_pressure)(zone); -- for_each_possible_cpu(cpu) -+ for_each_online_cpu(cpu) - per_cpu_ptr(zone->pageset, cpu)->stat_threshold - = threshold; - } -@@ -761,6 +761,7 @@ const char * const vmstat_text[] = { - "nr_shmem", - "nr_dirtied", - "nr_written", -+ "nr_pages_scanned", - - #ifdef CONFIG_NUMA - "numa_hit", -@@ -1055,7 +1056,7 @@ static void zoneinfo_show_print(struct seq_file *m, pg_data_t *pgdat, - min_wmark_pages(zone), - low_wmark_pages(zone), - high_wmark_pages(zone), -- zone->pages_scanned, -+ zone_page_state(zone, NR_PAGES_SCANNED), - zone->spanned_pages, - zone->present_pages, - zone->managed_pages); -@@ -1065,10 +1066,10 @@ static void zoneinfo_show_print(struct seq_file *m, pg_data_t *pgdat, - zone_page_state(zone, i)); - - seq_printf(m, -- "\n protection: (%lu", -+ "\n protection: (%ld", - zone->lowmem_reserve[0]); - for (i = 1; i < ARRAY_SIZE(zone->lowmem_reserve); i++) -- seq_printf(m, ", %lu", zone->lowmem_reserve[i]); -+ seq_printf(m, ", %ld", zone->lowmem_reserve[i]); - seq_printf(m, - ")" - "\n pagesets"); -diff --git a/net/netfilter/ipvs/ip_vs_ftp.c b/net/netfilter/ipvs/ip_vs_ftp.c -index 77c1732..4a662f1 100644 ---- a/net/netfilter/ipvs/ip_vs_ftp.c -+++ b/net/netfilter/ipvs/ip_vs_ftp.c -@@ -183,6 +183,8 @@ static int ip_vs_ftp_out(struct ip_vs_app *app, struct ip_vs_conn *cp, - struct nf_conn *ct; - struct net *net; - -+ *diff = 0; -+ - #ifdef CONFIG_IP_VS_IPV6 - /* This application helper doesn't work with IPv6 yet, - * so turn this into a no-op for IPv6 packets -@@ -191,8 +193,6 @@ static int ip_vs_ftp_out(struct ip_vs_app *app, struct ip_vs_conn *cp, - return 1; - #endif - -- *diff = 0; -- - /* Only useful for established sessions */ - if (cp->state != IP_VS_TCP_S_ESTABLISHED) - return 1; -@@ -321,6 +321,9 @@ static int ip_vs_ftp_in(struct ip_vs_app *app, struct ip_vs_conn *cp, - struct ip_vs_conn *n_cp; - struct net *net; - -+ /* no diff required for incoming packets */ -+ *diff = 0; -+ - #ifdef CONFIG_IP_VS_IPV6 - /* This application helper doesn't work with IPv6 yet, - * so turn this into a no-op for IPv6 packets -@@ -329,9 +332,6 @@ static int ip_vs_ftp_in(struct ip_vs_app *app, struct ip_vs_conn *cp, - return 1; - #endif - -- /* no diff required for incoming packets */ -- *diff = 0; -- - /* Only useful for established sessions */ - if (cp->state != IP_VS_TCP_S_ESTABLISHED) - return 1; -diff --git a/net/netfilter/nfnetlink.c b/net/netfilter/nfnetlink.c -index bf8a108..6cf2f07 100644 ---- a/net/netfilter/nfnetlink.c -+++ b/net/netfilter/nfnetlink.c -@@ -265,7 +265,8 @@ replay: - nlh = nlmsg_hdr(skb); - err = 0; - -- if (nlh->nlmsg_len < NLMSG_HDRLEN) { -+ if (nlmsg_len(nlh) < sizeof(struct nfgenmsg) || -+ skb->len < nlh->nlmsg_len) { - err = -EINVAL; - goto ack; - } -diff --git a/scripts/recordmcount.pl b/scripts/recordmcount.pl -index 91280b8..513f7bd 100755 ---- a/scripts/recordmcount.pl -+++ b/scripts/recordmcount.pl -@@ -262,7 +262,6 @@ if ($arch eq "x86_64") { - # force flags for this arch - $ld .= " -m shlelf_linux"; - $objcopy .= " -O elf32-sh-linux"; -- $cc .= " -m32"; - - } elsif ($arch eq "powerpc") { - $local_regex = "^[0-9a-fA-F]+\\s+t\\s+(\\.?\\S+)"; -diff --git a/security/keys/gc.c b/security/keys/gc.c -index d3222b6..009d937 100644 ---- a/security/keys/gc.c -+++ b/security/keys/gc.c -@@ -157,12 +157,12 @@ static noinline void key_gc_unused_keys(struct list_head *keys) - if (test_bit(KEY_FLAG_INSTANTIATED, &key->flags)) - atomic_dec(&key->user->nikeys); - -- key_user_put(key->user); -- - /* now throw away the key memory */ - if (key->type->destroy) - key->type->destroy(key); - -+ key_user_put(key->user); -+ - kfree(key->description); - - #ifdef KEY_DEBUGGING -diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c -index 1bed780..2d37b3f 100644 ---- a/sound/usb/mixer.c -+++ b/sound/usb/mixer.c -@@ -886,6 +886,7 @@ static void volume_control_quirks(struct usb_mixer_elem_info *cval, - case USB_ID(0x046d, 0x0807): /* Logitech Webcam C500 */ - case USB_ID(0x046d, 0x0808): - case USB_ID(0x046d, 0x0809): -+ case USB_ID(0x046d, 0x0819): /* Logitech Webcam C210 */ - case USB_ID(0x046d, 0x081b): /* HD Webcam c310 */ - case USB_ID(0x046d, 0x081d): /* HD Webcam c510 */ - case USB_ID(0x046d, 0x0825): /* HD Webcam c270 */ diff --git a/projects/imx6/patches/linux/linux-000-patch-3.14.31-32.patch b/projects/imx6/patches/linux/linux-000-patch-3.14.31-32.patch deleted file mode 100644 index b768d72cfdd..00000000000 --- a/projects/imx6/patches/linux/linux-000-patch-3.14.31-32.patch +++ /dev/null @@ -1,1098 +0,0 @@ -diff --git a/Makefile b/Makefile -index 5abf670..00fffa3 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,6 +1,6 @@ - VERSION = 3 - PATCHLEVEL = 14 --SUBLEVEL = 31 -+SUBLEVEL = 32 - EXTRAVERSION = - NAME = Remembering Coco - -diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c -index 11b3914..42f2fb8 100644 ---- a/arch/arm/mm/dma-mapping.c -+++ b/arch/arm/mm/dma-mapping.c -@@ -464,12 +464,21 @@ void __init dma_contiguous_remap(void) - map.type = MT_MEMORY_DMA_READY; - - /* -- * Clear previous low-memory mapping -+ * Clear previous low-memory mapping to ensure that the -+ * TLB does not see any conflicting entries, then flush -+ * the TLB of the old entries before creating new mappings. -+ * -+ * This ensures that any speculatively loaded TLB entries -+ * (even though they may be rare) can not cause any problems, -+ * and ensures that this code is architecturally compliant. - */ - for (addr = __phys_to_virt(start); addr < __phys_to_virt(end); - addr += PMD_SIZE) - pmd_clear(pmd_off_k(addr)); - -+ flush_tlb_kernel_range(__phys_to_virt(start), -+ __phys_to_virt(end)); -+ - iotable_init(&map, 1); - } - } -diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c -index bc5fbc2..f89389f 100644 ---- a/arch/powerpc/xmon/xmon.c -+++ b/arch/powerpc/xmon/xmon.c -@@ -288,6 +288,7 @@ static inline void disable_surveillance(void) - args.token = rtas_token("set-indicator"); - if (args.token == RTAS_UNKNOWN_SERVICE) - return; -+ args.token = cpu_to_be32(args.token); - args.nargs = cpu_to_be32(3); - args.nret = cpu_to_be32(1); - args.rets = &args.args[3]; -diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile -index b5bb498..67e9f5c 100644 ---- a/arch/x86/boot/compressed/Makefile -+++ b/arch/x86/boot/compressed/Makefile -@@ -76,7 +76,7 @@ suffix-$(CONFIG_KERNEL_LZO) := lzo - suffix-$(CONFIG_KERNEL_LZ4) := lz4 - - RUN_SIZE = $(shell $(OBJDUMP) -h vmlinux | \ -- perl $(srctree)/arch/x86/tools/calc_run_size.pl) -+ $(CONFIG_SHELL) $(srctree)/arch/x86/tools/calc_run_size.sh) - quiet_cmd_mkpiggy = MKPIGGY $@ - cmd_mkpiggy = $(obj)/mkpiggy $< $(RUN_SIZE) > $@ || ( rm -f $@ ; false ) - -diff --git a/arch/x86/tools/calc_run_size.pl b/arch/x86/tools/calc_run_size.pl -deleted file mode 100644 -index 23210ba..0000000 ---- a/arch/x86/tools/calc_run_size.pl -+++ /dev/null -@@ -1,39 +0,0 @@ --#!/usr/bin/perl --# --# Calculate the amount of space needed to run the kernel, including room for --# the .bss and .brk sections. --# --# Usage: --# objdump -h a.out | perl calc_run_size.pl --use strict; -- --my $mem_size = 0; --my $file_offset = 0; -- --my $sections=" *[0-9]+ \.(?:bss|brk) +"; --while (<>) { -- if (/^$sections([0-9a-f]+) +(?:[0-9a-f]+ +){2}([0-9a-f]+)/) { -- my $size = hex($1); -- my $offset = hex($2); -- $mem_size += $size; -- if ($file_offset == 0) { -- $file_offset = $offset; -- } elsif ($file_offset != $offset) { -- # BFD linker shows the same file offset in ELF. -- # Gold linker shows them as consecutive. -- next if ($file_offset + $mem_size == $offset + $size); -- -- printf STDERR "file_offset: 0x%lx\n", $file_offset; -- printf STDERR "mem_size: 0x%lx\n", $mem_size; -- printf STDERR "offset: 0x%lx\n", $offset; -- printf STDERR "size: 0x%lx\n", $size; -- -- die ".bss and .brk are non-contiguous\n"; -- } -- } --} -- --if ($file_offset == 0) { -- die "Never found .bss or .brk file offset\n"; --} --printf("%d\n", $mem_size + $file_offset); -diff --git a/arch/x86/tools/calc_run_size.sh b/arch/x86/tools/calc_run_size.sh -new file mode 100644 -index 0000000..1a4c17b ---- /dev/null -+++ b/arch/x86/tools/calc_run_size.sh -@@ -0,0 +1,42 @@ -+#!/bin/sh -+# -+# Calculate the amount of space needed to run the kernel, including room for -+# the .bss and .brk sections. -+# -+# Usage: -+# objdump -h a.out | sh calc_run_size.sh -+ -+NUM='\([0-9a-fA-F]*[ \t]*\)' -+OUT=$(sed -n 's/^[ \t0-9]*.b[sr][sk][ \t]*'"$NUM$NUM$NUM$NUM"'.*/\1\4/p') -+if [ -z "$OUT" ] ; then -+ echo "Never found .bss or .brk file offset" >&2 -+ exit 1 -+fi -+ -+OUT=$(echo ${OUT# }) -+sizeA=$(printf "%d" 0x${OUT%% *}) -+OUT=${OUT#* } -+offsetA=$(printf "%d" 0x${OUT%% *}) -+OUT=${OUT#* } -+sizeB=$(printf "%d" 0x${OUT%% *}) -+OUT=${OUT#* } -+offsetB=$(printf "%d" 0x${OUT%% *}) -+ -+run_size=$(( $offsetA + $sizeA + $sizeB )) -+ -+# BFD linker shows the same file offset in ELF. -+if [ "$offsetA" -ne "$offsetB" ] ; then -+ # Gold linker shows them as consecutive. -+ endB=$(( $offsetB + $sizeB )) -+ if [ "$endB" != "$run_size" ] ; then -+ printf "sizeA: 0x%x\n" $sizeA >&2 -+ printf "offsetA: 0x%x\n" $offsetA >&2 -+ printf "sizeB: 0x%x\n" $sizeB >&2 -+ printf "offsetB: 0x%x\n" $offsetB >&2 -+ echo ".bss and .brk are non-contiguous" >&2 -+ exit 1 -+ fi -+fi -+ -+printf "%d\n" $run_size -+exit 0 -diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c -index 255ca23..275a7dc 100644 ---- a/drivers/block/rbd.c -+++ b/drivers/block/rbd.c -@@ -1926,32 +1926,26 @@ static void rbd_dev_parent_put(struct rbd_device *rbd_dev) - * If an image has a non-zero parent overlap, get a reference to its - * parent. - * -- * We must get the reference before checking for the overlap to -- * coordinate properly with zeroing the parent overlap in -- * rbd_dev_v2_parent_info() when an image gets flattened. We -- * drop it again if there is no overlap. -- * - * Returns true if the rbd device has a parent with a non-zero - * overlap and a reference for it was successfully taken, or - * false otherwise. - */ - static bool rbd_dev_parent_get(struct rbd_device *rbd_dev) - { -- int counter; -+ int counter = 0; - - if (!rbd_dev->parent_spec) - return false; - -- counter = atomic_inc_return_safe(&rbd_dev->parent_ref); -- if (counter > 0 && rbd_dev->parent_overlap) -- return true; -- -- /* Image was flattened, but parent is not yet torn down */ -+ down_read(&rbd_dev->header_rwsem); -+ if (rbd_dev->parent_overlap) -+ counter = atomic_inc_return_safe(&rbd_dev->parent_ref); -+ up_read(&rbd_dev->header_rwsem); - - if (counter < 0) - rbd_warn(rbd_dev, "parent reference overflow\n"); - -- return false; -+ return counter > 0; - } - - /* -@@ -3904,7 +3898,6 @@ static int rbd_dev_v2_parent_info(struct rbd_device *rbd_dev) - */ - if (rbd_dev->parent_overlap) { - rbd_dev->parent_overlap = 0; -- smp_mb(); - rbd_dev_parent_put(rbd_dev); - pr_info("%s: clone image has been flattened\n", - rbd_dev->disk->disk_name); -@@ -3948,7 +3941,6 @@ static int rbd_dev_v2_parent_info(struct rbd_device *rbd_dev) - * treat it specially. - */ - rbd_dev->parent_overlap = overlap; -- smp_mb(); - if (!overlap) { - - /* A null parent_spec indicates it's the initial probe */ -@@ -4764,10 +4756,7 @@ static void rbd_dev_unprobe(struct rbd_device *rbd_dev) - { - struct rbd_image_header *header; - -- /* Drop parent reference unless it's already been done (or none) */ -- -- if (rbd_dev->parent_overlap) -- rbd_dev_parent_put(rbd_dev); -+ rbd_dev_parent_put(rbd_dev); - - /* Free dynamic fields from the header, then zero it out */ - -diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c -index 3153eab..de5ab48 100644 ---- a/drivers/gpu/drm/i915/i915_gem.c -+++ b/drivers/gpu/drm/i915/i915_gem.c -@@ -2893,6 +2893,13 @@ static void i965_write_fence_reg(struct drm_device *dev, int reg, - u32 size = i915_gem_obj_ggtt_size(obj); - uint64_t val; - -+ /* Adjust fence size to match tiled area */ -+ if (obj->tiling_mode != I915_TILING_NONE) { -+ uint32_t row_size = obj->stride * -+ (obj->tiling_mode == I915_TILING_Y ? 32 : 8); -+ size = (size / row_size) * row_size; -+ } -+ - val = (uint64_t)((i915_gem_obj_ggtt_offset(obj) + size - 4096) & - 0xfffff000) << 32; - val |= i915_gem_obj_ggtt_offset(obj) & 0xfffff000; -diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c -index 93ec376..79a2117 100644 ---- a/drivers/i2c/busses/i2c-s3c2410.c -+++ b/drivers/i2c/busses/i2c-s3c2410.c -@@ -753,14 +753,16 @@ static int s3c24xx_i2c_xfer(struct i2c_adapter *adap, - int ret; - - pm_runtime_get_sync(&adap->dev); -- clk_prepare_enable(i2c->clk); -+ ret = clk_enable(i2c->clk); -+ if (ret) -+ return ret; - - for (retry = 0; retry < adap->retries; retry++) { - - ret = s3c24xx_i2c_doxfer(i2c, msgs, num); - - if (ret != -EAGAIN) { -- clk_disable_unprepare(i2c->clk); -+ clk_disable(i2c->clk); - pm_runtime_put(&adap->dev); - return ret; - } -@@ -770,7 +772,7 @@ static int s3c24xx_i2c_xfer(struct i2c_adapter *adap, - udelay(100); - } - -- clk_disable_unprepare(i2c->clk); -+ clk_disable(i2c->clk); - pm_runtime_put(&adap->dev); - return -EREMOTEIO; - } -@@ -1153,7 +1155,7 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev) - - clk_prepare_enable(i2c->clk); - ret = s3c24xx_i2c_init(i2c); -- clk_disable_unprepare(i2c->clk); -+ clk_disable(i2c->clk); - if (ret != 0) { - dev_err(&pdev->dev, "I2C controller init failed\n"); - return ret; -@@ -1166,6 +1168,7 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev) - i2c->irq = ret = platform_get_irq(pdev, 0); - if (ret <= 0) { - dev_err(&pdev->dev, "cannot find IRQ\n"); -+ clk_unprepare(i2c->clk); - return ret; - } - -@@ -1174,6 +1177,7 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev) - - if (ret != 0) { - dev_err(&pdev->dev, "cannot claim IRQ %d\n", i2c->irq); -+ clk_unprepare(i2c->clk); - return ret; - } - } -@@ -1181,6 +1185,7 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev) - ret = s3c24xx_i2c_register_cpufreq(i2c); - if (ret < 0) { - dev_err(&pdev->dev, "failed to register cpufreq notifier\n"); -+ clk_unprepare(i2c->clk); - return ret; - } - -@@ -1197,6 +1202,7 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev) - if (ret < 0) { - dev_err(&pdev->dev, "failed to add bus to i2c core\n"); - s3c24xx_i2c_deregister_cpufreq(i2c); -+ clk_unprepare(i2c->clk); - return ret; - } - -@@ -1218,6 +1224,8 @@ static int s3c24xx_i2c_remove(struct platform_device *pdev) - { - struct s3c24xx_i2c *i2c = platform_get_drvdata(pdev); - -+ clk_unprepare(i2c->clk); -+ - pm_runtime_disable(&i2c->adap.dev); - pm_runtime_disable(&pdev->dev); - -@@ -1246,10 +1254,13 @@ static int s3c24xx_i2c_resume(struct device *dev) - { - struct platform_device *pdev = to_platform_device(dev); - struct s3c24xx_i2c *i2c = platform_get_drvdata(pdev); -+ int ret; - -- clk_prepare_enable(i2c->clk); -+ ret = clk_enable(i2c->clk); -+ if (ret) -+ return ret; - s3c24xx_i2c_init(i2c); -- clk_disable_unprepare(i2c->clk); -+ clk_disable(i2c->clk); - i2c->suspended = 0; - - return 0; -diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c -index a3769cf..b00e282 100644 ---- a/drivers/input/mouse/synaptics.c -+++ b/drivers/input/mouse/synaptics.c -@@ -132,8 +132,9 @@ static const struct min_max_quirk min_max_pnpid_table[] = { - 1232, 5710, 1156, 4696 - }, - { -- (const char * const []){"LEN0034", "LEN0036", "LEN0039", -- "LEN2002", "LEN2004", NULL}, -+ (const char * const []){"LEN0034", "LEN0036", "LEN0037", -+ "LEN0039", "LEN2002", "LEN2004", -+ NULL}, - 1024, 5112, 2024, 4832 - }, - { -@@ -162,7 +163,7 @@ static const char * const topbuttonpad_pnp_ids[] = { - "LEN0034", /* T431s, L440, L540, T540, W540, X1 Carbon 2nd */ - "LEN0035", /* X240 */ - "LEN0036", /* T440 */ -- "LEN0037", -+ "LEN0037", /* X1 Carbon 2nd */ - "LEN0038", - "LEN0039", /* T440s */ - "LEN0041", -diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h -index c43c46f..dd6d14d 100644 ---- a/drivers/input/serio/i8042-x86ia64io.h -+++ b/drivers/input/serio/i8042-x86ia64io.h -@@ -152,6 +152,14 @@ static const struct dmi_system_id __initconst i8042_dmi_noloop_table[] = { - }, - }, - { -+ /* Medion Akoya E7225 */ -+ .matches = { -+ DMI_MATCH(DMI_SYS_VENDOR, "Medion"), -+ DMI_MATCH(DMI_PRODUCT_NAME, "Akoya E7225"), -+ DMI_MATCH(DMI_PRODUCT_VERSION, "1.0"), -+ }, -+ }, -+ { - /* Blue FB5601 */ - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "blue"), -diff --git a/drivers/md/dm-cache-metadata.c b/drivers/md/dm-cache-metadata.c -index d290e83..b950a80 100644 ---- a/drivers/md/dm-cache-metadata.c -+++ b/drivers/md/dm-cache-metadata.c -@@ -683,7 +683,7 @@ static struct dm_cache_metadata *metadata_open(struct block_device *bdev, - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); - if (!cmd) { - DMERR("could not allocate metadata struct"); -- return NULL; -+ return ERR_PTR(-ENOMEM); - } - - atomic_set(&cmd->ref_count, 1); -@@ -745,7 +745,7 @@ static struct dm_cache_metadata *lookup_or_open(struct block_device *bdev, - return cmd; - - cmd = metadata_open(bdev, data_block_size, may_format_device, policy_hint_size); -- if (cmd) { -+ if (!IS_ERR(cmd)) { - mutex_lock(&table_lock); - cmd2 = lookup(bdev); - if (cmd2) { -@@ -780,9 +780,10 @@ struct dm_cache_metadata *dm_cache_metadata_open(struct block_device *bdev, - { - struct dm_cache_metadata *cmd = lookup_or_open(bdev, data_block_size, - may_format_device, policy_hint_size); -- if (cmd && !same_params(cmd, data_block_size)) { -+ -+ if (!IS_ERR(cmd) && !same_params(cmd, data_block_size)) { - dm_cache_metadata_close(cmd); -- return NULL; -+ return ERR_PTR(-EINVAL); - } - - return cmd; -diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c -index f7e052c..c1120eb 100644 ---- a/drivers/md/dm-thin.c -+++ b/drivers/md/dm-thin.c -@@ -2744,6 +2744,12 @@ static int pool_message(struct dm_target *ti, unsigned argc, char **argv) - struct pool_c *pt = ti->private; - struct pool *pool = pt->pool; - -+ if (get_pool_mode(pool) >= PM_READ_ONLY) { -+ DMERR("%s: unable to service pool target messages in READ_ONLY or FAIL mode", -+ dm_device_name(pool->pool_md)); -+ return -EINVAL; -+ } -+ - if (!strcasecmp(argv[0], "create_thin")) - r = process_create_thin_mesg(argc, argv, pool); - -diff --git a/drivers/net/can/usb/kvaser_usb.c b/drivers/net/can/usb/kvaser_usb.c -index 4e65b35..3d19867 100644 ---- a/drivers/net/can/usb/kvaser_usb.c -+++ b/drivers/net/can/usb/kvaser_usb.c -@@ -578,7 +578,7 @@ static int kvaser_usb_simple_msg_async(struct kvaser_usb_net_priv *priv, - usb_sndbulkpipe(dev->udev, - dev->bulk_out->bEndpointAddress), - buf, msg->len, -- kvaser_usb_simple_msg_callback, priv); -+ kvaser_usb_simple_msg_callback, netdev); - usb_anchor_urb(urb, &priv->tx_submitted); - - err = usb_submit_urb(urb, GFP_ATOMIC); -@@ -653,11 +653,6 @@ static void kvaser_usb_rx_error(const struct kvaser_usb *dev, - priv = dev->nets[channel]; - stats = &priv->netdev->stats; - -- if (status & M16C_STATE_BUS_RESET) { -- kvaser_usb_unlink_tx_urbs(priv); -- return; -- } -- - skb = alloc_can_err_skb(priv->netdev, &cf); - if (!skb) { - stats->rx_dropped++; -@@ -668,7 +663,7 @@ static void kvaser_usb_rx_error(const struct kvaser_usb *dev, - - netdev_dbg(priv->netdev, "Error status: 0x%02x\n", status); - -- if (status & M16C_STATE_BUS_OFF) { -+ if (status & (M16C_STATE_BUS_OFF | M16C_STATE_BUS_RESET)) { - cf->can_id |= CAN_ERR_BUSOFF; - - priv->can.can_stats.bus_off++; -@@ -694,9 +689,7 @@ static void kvaser_usb_rx_error(const struct kvaser_usb *dev, - } - - new_state = CAN_STATE_ERROR_PASSIVE; -- } -- -- if (status == M16C_STATE_BUS_ERROR) { -+ } else if (status & M16C_STATE_BUS_ERROR) { - if ((priv->can.state < CAN_STATE_ERROR_WARNING) && - ((txerr >= 96) || (rxerr >= 96))) { - cf->can_id |= CAN_ERR_CRTL; -@@ -706,7 +699,8 @@ static void kvaser_usb_rx_error(const struct kvaser_usb *dev, - - priv->can.can_stats.error_warning++; - new_state = CAN_STATE_ERROR_WARNING; -- } else if (priv->can.state > CAN_STATE_ERROR_ACTIVE) { -+ } else if ((priv->can.state > CAN_STATE_ERROR_ACTIVE) && -+ ((txerr < 96) && (rxerr < 96))) { - cf->can_id |= CAN_ERR_PROT; - cf->data[2] = CAN_ERR_PROT_ACTIVE; - -@@ -1582,7 +1576,7 @@ static int kvaser_usb_probe(struct usb_interface *intf, - { - struct kvaser_usb *dev; - int err = -ENOMEM; -- int i; -+ int i, retry = 3; - - dev = devm_kzalloc(&intf->dev, sizeof(*dev), GFP_KERNEL); - if (!dev) -@@ -1600,7 +1594,15 @@ static int kvaser_usb_probe(struct usb_interface *intf, - - usb_set_intfdata(intf, dev); - -- err = kvaser_usb_get_software_info(dev); -+ /* On some x86 laptops, plugging a Kvaser device again after -+ * an unplug makes the firmware always ignore the very first -+ * command. For such a case, provide some room for retries -+ * instead of completely exiting the driver. -+ */ -+ do { -+ err = kvaser_usb_get_software_info(dev); -+ } while (--retry && err == -ETIMEDOUT); -+ - if (err) { - dev_err(&intf->dev, - "Cannot get software infos, error %d\n", err); -diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c -index 316650c..4eb091d 100644 ---- a/drivers/net/ethernet/ti/cpsw.c -+++ b/drivers/net/ethernet/ti/cpsw.c -@@ -1610,6 +1610,19 @@ static int cpsw_ndo_vlan_rx_add_vid(struct net_device *ndev, - if (vid == priv->data.default_vlan) - return 0; - -+ if (priv->data.dual_emac) { -+ /* In dual EMAC, reserved VLAN id should not be used for -+ * creating VLAN interfaces as this can break the dual -+ * EMAC port separation -+ */ -+ int i; -+ -+ for (i = 0; i < priv->data.slaves; i++) { -+ if (vid == priv->slaves[i].port_vlan) -+ return -EINVAL; -+ } -+ } -+ - dev_info(priv->dev, "Adding vlanid %d to vlan filter\n", vid); - return cpsw_add_vlan_ale_entry(priv, vid); - } -@@ -1623,6 +1636,15 @@ static int cpsw_ndo_vlan_rx_kill_vid(struct net_device *ndev, - if (vid == priv->data.default_vlan) - return 0; - -+ if (priv->data.dual_emac) { -+ int i; -+ -+ for (i = 0; i < priv->data.slaves; i++) { -+ if (vid == priv->slaves[i].port_vlan) -+ return -EINVAL; -+ } -+ } -+ - dev_info(priv->dev, "removing vlanid %d from vlan filter\n", vid); - ret = cpsw_ale_del_vlan(priv->ale, vid, 0); - if (ret != 0) -diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c -index afca1bc..b798404 100644 ---- a/drivers/regulator/core.c -+++ b/drivers/regulator/core.c -@@ -1479,7 +1479,7 @@ struct regulator *regulator_get_optional(struct device *dev, const char *id) - } - EXPORT_SYMBOL_GPL(regulator_get_optional); - --/* Locks held by regulator_put() */ -+/* regulator_list_mutex lock held by regulator_put() */ - static void _regulator_put(struct regulator *regulator) - { - struct regulator_dev *rdev; -@@ -1494,12 +1494,14 @@ static void _regulator_put(struct regulator *regulator) - /* remove any sysfs entries */ - if (regulator->dev) - sysfs_remove_link(&rdev->dev.kobj, regulator->supply_name); -+ mutex_lock(&rdev->mutex); - kfree(regulator->supply_name); - list_del(&regulator->list); - kfree(regulator); - - rdev->open_count--; - rdev->exclusive = 0; -+ mutex_unlock(&rdev->mutex); - - module_put(rdev->owner); - } -diff --git a/drivers/spi/spi-dw-mid.c b/drivers/spi/spi-dw-mid.c -index a4c45ea..996e16d 100644 ---- a/drivers/spi/spi-dw-mid.c -+++ b/drivers/spi/spi-dw-mid.c -@@ -222,7 +222,6 @@ int dw_spi_mid_init(struct dw_spi *dws) - iounmap(clk_reg); - - dws->num_cs = 16; -- dws->fifo_len = 40; /* FIFO has 40 words buffer */ - - #ifdef CONFIG_SPI_DW_MID_DMA - dws->dma_priv = kzalloc(sizeof(struct mid_dma), GFP_KERNEL); -diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c -index 7ab3ccb..458a148 100644 ---- a/drivers/spi/spi-pxa2xx.c -+++ b/drivers/spi/spi-pxa2xx.c -@@ -400,8 +400,8 @@ static void giveback(struct driver_data *drv_data) - cs_deassert(drv_data); - } - -- spi_finalize_current_message(drv_data->master); - drv_data->cur_chip = NULL; -+ spi_finalize_current_message(drv_data->master); - } - - static void reset_sccr1(struct driver_data *drv_data) -diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c -index 38b4be2..26ae688 100644 ---- a/drivers/target/target_core_device.c -+++ b/drivers/target/target_core_device.c -@@ -1153,10 +1153,10 @@ int se_dev_set_optimal_sectors(struct se_device *dev, u32 optimal_sectors) - " changed for TCM/pSCSI\n", dev); - return -EINVAL; - } -- if (optimal_sectors > dev->dev_attrib.fabric_max_sectors) { -+ if (optimal_sectors > dev->dev_attrib.hw_max_sectors) { - pr_err("dev[%p]: Passed optimal_sectors %u cannot be" -- " greater than fabric_max_sectors: %u\n", dev, -- optimal_sectors, dev->dev_attrib.fabric_max_sectors); -+ " greater than hw_max_sectors: %u\n", dev, -+ optimal_sectors, dev->dev_attrib.hw_max_sectors); - return -EINVAL; - } - -@@ -1565,7 +1565,6 @@ struct se_device *target_alloc_device(struct se_hba *hba, const char *name) - DA_UNMAP_GRANULARITY_ALIGNMENT_DEFAULT; - dev->dev_attrib.max_write_same_len = DA_MAX_WRITE_SAME_LEN; - dev->dev_attrib.fabric_max_sectors = DA_FABRIC_MAX_SECTORS; -- dev->dev_attrib.optimal_sectors = DA_FABRIC_MAX_SECTORS; - - xcopy_lun = &dev->xcopy_lun; - xcopy_lun->lun_se_dev = dev; -@@ -1606,6 +1605,7 @@ int target_configure_device(struct se_device *dev) - dev->dev_attrib.hw_max_sectors = - se_dev_align_max_sectors(dev->dev_attrib.hw_max_sectors, - dev->dev_attrib.hw_block_size); -+ dev->dev_attrib.optimal_sectors = dev->dev_attrib.hw_max_sectors; - - dev->dev_index = scsi_get_new_index(SCSI_DEVICE_INDEX); - dev->creation_time = get_jiffies_64(); -diff --git a/drivers/target/target_core_file.c b/drivers/target/target_core_file.c -index cf991a9..41eff7d 100644 ---- a/drivers/target/target_core_file.c -+++ b/drivers/target/target_core_file.c -@@ -620,7 +620,16 @@ fd_execute_rw(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents, - struct fd_prot fd_prot; - sense_reason_t rc; - int ret = 0; -- -+ /* -+ * We are currently limited by the number of iovecs (2048) per -+ * single vfs_[writev,readv] call. -+ */ -+ if (cmd->data_length > FD_MAX_BYTES) { -+ pr_err("FILEIO: Not able to process I/O of %u bytes due to" -+ "FD_MAX_BYTES: %u iovec count limitiation\n", -+ cmd->data_length, FD_MAX_BYTES); -+ return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; -+ } - /* - * Call vectorized fileio functions to map struct scatterlist - * physical memory addresses to struct iovec virtual memory. -diff --git a/drivers/target/target_core_iblock.c b/drivers/target/target_core_iblock.c -index 9e0232c..feefe24 100644 ---- a/drivers/target/target_core_iblock.c -+++ b/drivers/target/target_core_iblock.c -@@ -123,7 +123,7 @@ static int iblock_configure_device(struct se_device *dev) - q = bdev_get_queue(bd); - - dev->dev_attrib.hw_block_size = bdev_logical_block_size(bd); -- dev->dev_attrib.hw_max_sectors = UINT_MAX; -+ dev->dev_attrib.hw_max_sectors = queue_max_hw_sectors(q); - dev->dev_attrib.hw_queue_depth = q->nr_requests; - - /* -diff --git a/drivers/target/target_core_sbc.c b/drivers/target/target_core_sbc.c -index 379033f..5216acd 100644 ---- a/drivers/target/target_core_sbc.c -+++ b/drivers/target/target_core_sbc.c -@@ -910,21 +910,6 @@ sbc_parse_cdb(struct se_cmd *cmd, struct sbc_ops *ops) - if (cmd->se_cmd_flags & SCF_SCSI_DATA_CDB) { - unsigned long long end_lba; - -- if (sectors > dev->dev_attrib.fabric_max_sectors) { -- printk_ratelimited(KERN_ERR "SCSI OP %02xh with too" -- " big sectors %u exceeds fabric_max_sectors:" -- " %u\n", cdb[0], sectors, -- dev->dev_attrib.fabric_max_sectors); -- return TCM_INVALID_CDB_FIELD; -- } -- if (sectors > dev->dev_attrib.hw_max_sectors) { -- printk_ratelimited(KERN_ERR "SCSI OP %02xh with too" -- " big sectors %u exceeds backend hw_max_sectors:" -- " %u\n", cdb[0], sectors, -- dev->dev_attrib.hw_max_sectors); -- return TCM_INVALID_CDB_FIELD; -- } -- - end_lba = dev->transport->get_blocks(dev) + 1; - if (cmd->t_task_lba + sectors > end_lba) { - pr_err("cmd exceeds last lba %llu " -diff --git a/drivers/target/target_core_spc.c b/drivers/target/target_core_spc.c -index fcdf98f..12a74f6 100644 ---- a/drivers/target/target_core_spc.c -+++ b/drivers/target/target_core_spc.c -@@ -503,7 +503,6 @@ static sense_reason_t - spc_emulate_evpd_b0(struct se_cmd *cmd, unsigned char *buf) - { - struct se_device *dev = cmd->se_dev; -- u32 max_sectors; - int have_tp = 0; - int opt, min; - -@@ -537,9 +536,7 @@ spc_emulate_evpd_b0(struct se_cmd *cmd, unsigned char *buf) - /* - * Set MAXIMUM TRANSFER LENGTH - */ -- max_sectors = min(dev->dev_attrib.fabric_max_sectors, -- dev->dev_attrib.hw_max_sectors); -- put_unaligned_be32(max_sectors, &buf[8]); -+ put_unaligned_be32(dev->dev_attrib.hw_max_sectors, &buf[8]); - - /* - * Set OPTIMAL TRANSFER LENGTH -diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c -index de2543d..7ececa1 100644 ---- a/fs/nfs/direct.c -+++ b/fs/nfs/direct.c -@@ -123,6 +123,12 @@ static inline int put_dreq(struct nfs_direct_req *dreq) - */ - ssize_t nfs_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov, loff_t pos, unsigned long nr_segs) - { -+ struct inode *inode = iocb->ki_filp->f_mapping->host; -+ -+ /* we only support swap file calling nfs_direct_IO */ -+ if (!IS_SWAPFILE(inode)) -+ return 0; -+ - #ifndef CONFIG_NFS_SWAP - dprintk("NFS: nfs_direct_IO (%pD) off/no(%Ld/%lu) EINVAL\n", - iocb->ki_filp, (long long) pos, nr_segs); -diff --git a/fs/nfs/nfs4client.c b/fs/nfs/nfs4client.c -index 037f957..d3f6062 100644 ---- a/fs/nfs/nfs4client.c -+++ b/fs/nfs/nfs4client.c -@@ -633,7 +633,7 @@ int nfs41_walk_client_list(struct nfs_client *new, - prev = pos; - - status = nfs_wait_client_init_complete(pos); -- if (status == 0) { -+ if (pos->cl_cons_state == NFS_CS_SESSION_INITING) { - nfs4_schedule_lease_recovery(pos); - status = nfs4_wait_clnt_recover(pos); - } -diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c -index e7d95f9..fe68d8a 100644 ---- a/fs/pstore/ram.c -+++ b/fs/pstore/ram.c -@@ -92,6 +92,7 @@ struct ramoops_context { - struct persistent_ram_ecc_info ecc_info; - unsigned int max_dump_cnt; - unsigned int dump_write_cnt; -+ /* _read_cnt need clear on ramoops_pstore_open */ - unsigned int dump_read_cnt; - unsigned int console_read_cnt; - unsigned int ftrace_read_cnt; -@@ -107,6 +108,7 @@ static int ramoops_pstore_open(struct pstore_info *psi) - - cxt->dump_read_cnt = 0; - cxt->console_read_cnt = 0; -+ cxt->ftrace_read_cnt = 0; - return 0; - } - -@@ -123,13 +125,15 @@ ramoops_get_next_prz(struct persistent_ram_zone *przs[], uint *c, uint max, - return NULL; - - prz = przs[i]; -+ if (!prz) -+ return NULL; - -- if (update) { -- /* Update old/shadowed buffer. */ -+ /* Update old/shadowed buffer. */ -+ if (update) - persistent_ram_save_old(prz); -- if (!persistent_ram_old_size(prz)) -- return NULL; -- } -+ -+ if (!persistent_ram_old_size(prz)) -+ return NULL; - - *typep = type; - *id = i; -@@ -435,7 +439,6 @@ static int ramoops_probe(struct platform_device *pdev) - if (pdata->ftrace_size && !is_power_of_2(pdata->ftrace_size)) - pdata->ftrace_size = rounddown_pow_of_two(pdata->ftrace_size); - -- cxt->dump_read_cnt = 0; - cxt->size = pdata->mem_size; - cxt->phys_addr = pdata->mem_address; - cxt->memtype = pdata->mem_type; -diff --git a/kernel/workqueue.c b/kernel/workqueue.c -index b4defde..f6f31d8 100644 ---- a/kernel/workqueue.c -+++ b/kernel/workqueue.c -@@ -1962,17 +1962,13 @@ static void pool_mayday_timeout(unsigned long __pool) - * spin_lock_irq(pool->lock) which may be released and regrabbed - * multiple times. Does GFP_KERNEL allocations. Called only from - * manager. -- * -- * Return: -- * %false if no action was taken and pool->lock stayed locked, %true -- * otherwise. - */ --static bool maybe_create_worker(struct worker_pool *pool) -+static void maybe_create_worker(struct worker_pool *pool) - __releases(&pool->lock) - __acquires(&pool->lock) - { - if (!need_to_create_worker(pool)) -- return false; -+ return; - restart: - spin_unlock_irq(&pool->lock); - -@@ -1989,7 +1985,7 @@ restart: - start_worker(worker); - if (WARN_ON_ONCE(need_to_create_worker(pool))) - goto restart; -- return true; -+ return; - } - - if (!need_to_create_worker(pool)) -@@ -2006,7 +2002,7 @@ restart: - spin_lock_irq(&pool->lock); - if (need_to_create_worker(pool)) - goto restart; -- return true; -+ return; - } - - /** -@@ -2019,15 +2015,9 @@ restart: - * LOCKING: - * spin_lock_irq(pool->lock) which may be released and regrabbed - * multiple times. Called only from manager. -- * -- * Return: -- * %false if no action was taken and pool->lock stayed locked, %true -- * otherwise. - */ --static bool maybe_destroy_workers(struct worker_pool *pool) -+static void maybe_destroy_workers(struct worker_pool *pool) - { -- bool ret = false; -- - while (too_many_workers(pool)) { - struct worker *worker; - unsigned long expires; -@@ -2041,10 +2031,7 @@ static bool maybe_destroy_workers(struct worker_pool *pool) - } - - destroy_worker(worker); -- ret = true; - } -- -- return ret; - } - - /** -@@ -2064,16 +2051,14 @@ static bool maybe_destroy_workers(struct worker_pool *pool) - * multiple times. Does GFP_KERNEL allocations. - * - * Return: -- * %false if the pool don't need management and the caller can safely start -- * processing works, %true indicates that the function released pool->lock -- * and reacquired it to perform some management function and that the -- * conditions that the caller verified while holding the lock before -- * calling the function might no longer be true. -+ * %false if the pool doesn't need management and the caller can safely -+ * start processing works, %true if management function was performed and -+ * the conditions that the caller verified before calling the function may -+ * no longer be true. - */ - static bool manage_workers(struct worker *worker) - { - struct worker_pool *pool = worker->pool; -- bool ret = false; - - /* - * Managership is governed by two mutexes - manager_arb and -@@ -2097,7 +2082,7 @@ static bool manage_workers(struct worker *worker) - * manager_mutex. - */ - if (!mutex_trylock(&pool->manager_arb)) -- return ret; -+ return false; - - /* - * With manager arbitration won, manager_mutex would be free in -@@ -2107,7 +2092,6 @@ static bool manage_workers(struct worker *worker) - spin_unlock_irq(&pool->lock); - mutex_lock(&pool->manager_mutex); - spin_lock_irq(&pool->lock); -- ret = true; - } - - pool->flags &= ~POOL_MANAGE_WORKERS; -@@ -2116,12 +2100,12 @@ static bool manage_workers(struct worker *worker) - * Destroy and then create so that may_start_working() is true - * on return. - */ -- ret |= maybe_destroy_workers(pool); -- ret |= maybe_create_worker(pool); -+ maybe_destroy_workers(pool); -+ maybe_create_worker(pool); - - mutex_unlock(&pool->manager_mutex); - mutex_unlock(&pool->manager_arb); -- return ret; -+ return true; - } - - /** -diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c -index 1e4dc4e..815ca56 100644 ---- a/net/mac80211/rx.c -+++ b/net/mac80211/rx.c -@@ -261,7 +261,7 @@ ieee80211_add_rx_radiotap_header(struct ieee80211_local *local, - else if (rate && rate->flags & IEEE80211_RATE_ERP_G) - channel_flags |= IEEE80211_CHAN_OFDM | IEEE80211_CHAN_2GHZ; - else if (rate) -- channel_flags |= IEEE80211_CHAN_OFDM | IEEE80211_CHAN_2GHZ; -+ channel_flags |= IEEE80211_CHAN_CCK | IEEE80211_CHAN_2GHZ; - else - channel_flags |= IEEE80211_CHAN_2GHZ; - put_unaligned_le16(channel_flags, pos); -diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c -index df33156..18d73df 100644 ---- a/net/wireless/nl80211.c -+++ b/net/wireless/nl80211.c -@@ -2697,6 +2697,9 @@ static int nl80211_get_key(struct sk_buff *skb, struct genl_info *info) - if (!rdev->ops->get_key) - return -EOPNOTSUPP; - -+ if (!pairwise && mac_addr && !(rdev->wiphy.flags & WIPHY_FLAG_IBSS_RSN)) -+ return -ENOENT; -+ - msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); - if (!msg) - return -ENOMEM; -@@ -2716,10 +2719,6 @@ static int nl80211_get_key(struct sk_buff *skb, struct genl_info *info) - nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, mac_addr)) - goto nla_put_failure; - -- if (pairwise && mac_addr && -- !(rdev->wiphy.flags & WIPHY_FLAG_IBSS_RSN)) -- return -ENOENT; -- - err = rdev_get_key(rdev, dev, key_idx, pairwise, mac_addr, &cookie, - get_key_callback); - -@@ -2890,7 +2889,7 @@ static int nl80211_del_key(struct sk_buff *skb, struct genl_info *info) - wdev_lock(dev->ieee80211_ptr); - err = nl80211_key_allowed(dev->ieee80211_ptr); - -- if (key.type == NL80211_KEYTYPE_PAIRWISE && mac_addr && -+ if (key.type == NL80211_KEYTYPE_GROUP && mac_addr && - !(rdev->wiphy.flags & WIPHY_FLAG_IBSS_RSN)) - err = -ENOENT; - -diff --git a/sound/core/seq/seq_dummy.c b/sound/core/seq/seq_dummy.c -index dbc5507..f60d814 100644 ---- a/sound/core/seq/seq_dummy.c -+++ b/sound/core/seq/seq_dummy.c -@@ -82,36 +82,6 @@ struct snd_seq_dummy_port { - static int my_client = -1; - - /* -- * unuse callback - send ALL_SOUNDS_OFF and RESET_CONTROLLERS events -- * to subscribers. -- * Note: this callback is called only after all subscribers are removed. -- */ --static int --dummy_unuse(void *private_data, struct snd_seq_port_subscribe *info) --{ -- struct snd_seq_dummy_port *p; -- int i; -- struct snd_seq_event ev; -- -- p = private_data; -- memset(&ev, 0, sizeof(ev)); -- if (p->duplex) -- ev.source.port = p->connect; -- else -- ev.source.port = p->port; -- ev.dest.client = SNDRV_SEQ_ADDRESS_SUBSCRIBERS; -- ev.type = SNDRV_SEQ_EVENT_CONTROLLER; -- for (i = 0; i < 16; i++) { -- ev.data.control.channel = i; -- ev.data.control.param = MIDI_CTL_ALL_SOUNDS_OFF; -- snd_seq_kernel_client_dispatch(p->client, &ev, 0, 0); -- ev.data.control.param = MIDI_CTL_RESET_CONTROLLERS; -- snd_seq_kernel_client_dispatch(p->client, &ev, 0, 0); -- } -- return 0; --} -- --/* - * event input callback - just redirect events to subscribers - */ - static int -@@ -175,7 +145,6 @@ create_port(int idx, int type) - | SNDRV_SEQ_PORT_TYPE_PORT; - memset(&pcb, 0, sizeof(pcb)); - pcb.owner = THIS_MODULE; -- pcb.unuse = dummy_unuse; - pcb.event_input = dummy_input; - pcb.private_free = dummy_free; - pcb.private_data = rec; -diff --git a/sound/soc/codecs/wm8960.c b/sound/soc/codecs/wm8960.c -index f156010..942ef84 100644 ---- a/sound/soc/codecs/wm8960.c -+++ b/sound/soc/codecs/wm8960.c -@@ -555,7 +555,7 @@ static struct { - { 22050, 2 }, - { 24000, 2 }, - { 16000, 3 }, -- { 11250, 4 }, -+ { 11025, 4 }, - { 12000, 4 }, - { 8000, 5 }, - }; -diff --git a/sound/soc/fsl/fsl_esai.h b/sound/soc/fsl/fsl_esai.h -index 75e1403..dfdbaa0 100644 ---- a/sound/soc/fsl/fsl_esai.h -+++ b/sound/soc/fsl/fsl_esai.h -@@ -302,7 +302,7 @@ - #define ESAI_xCCR_xFP_MASK (((1 << ESAI_xCCR_xFP_WIDTH) - 1) << ESAI_xCCR_xFP_SHIFT) - #define ESAI_xCCR_xFP(v) ((((v) - 1) << ESAI_xCCR_xFP_SHIFT) & ESAI_xCCR_xFP_MASK) - #define ESAI_xCCR_xDC_SHIFT 9 --#define ESAI_xCCR_xDC_WIDTH 4 -+#define ESAI_xCCR_xDC_WIDTH 5 - #define ESAI_xCCR_xDC_MASK (((1 << ESAI_xCCR_xDC_WIDTH) - 1) << ESAI_xCCR_xDC_SHIFT) - #define ESAI_xCCR_xDC(v) ((((v) - 1) << ESAI_xCCR_xDC_SHIFT) & ESAI_xCCR_xDC_MASK) - #define ESAI_xCCR_xPSR_SHIFT 8 -diff --git a/sound/soc/omap/omap-mcbsp.c b/sound/soc/omap/omap-mcbsp.c -index 6c19bba..6a339fb 100644 ---- a/sound/soc/omap/omap-mcbsp.c -+++ b/sound/soc/omap/omap-mcbsp.c -@@ -436,7 +436,7 @@ static int omap_mcbsp_dai_set_dai_fmt(struct snd_soc_dai *cpu_dai, - case SND_SOC_DAIFMT_CBM_CFS: - /* McBSP slave. FS clock as output */ - regs->srgr2 |= FSGM; -- regs->pcr0 |= FSXM; -+ regs->pcr0 |= FSXM | FSRM; - break; - case SND_SOC_DAIFMT_CBM_CFM: - /* McBSP slave */ -diff --git a/sound/soc/soc-compress.c b/sound/soc/soc-compress.c -index 5e9690c..4f98ff1 100644 ---- a/sound/soc/soc-compress.c -+++ b/sound/soc/soc-compress.c -@@ -696,7 +696,8 @@ int soc_new_compress(struct snd_soc_pcm_runtime *rtd, int num) - rtd->dai_link->stream_name); - - ret = snd_pcm_new_internal(rtd->card->snd_card, new_name, num, -- 1, 0, &be_pcm); -+ rtd->dai_link->dpcm_playback, -+ rtd->dai_link->dpcm_capture, &be_pcm); - if (ret < 0) { - dev_err(rtd->card->dev, "ASoC: can't create compressed for %s\n", - rtd->dai_link->name); -@@ -705,8 +706,10 @@ int soc_new_compress(struct snd_soc_pcm_runtime *rtd, int num) - - rtd->pcm = be_pcm; - rtd->fe_compr = 1; -- be_pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream->private_data = rtd; -- be_pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream->private_data = rtd; -+ if (rtd->dai_link->dpcm_playback) -+ be_pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream->private_data = rtd; -+ else if (rtd->dai_link->dpcm_capture) -+ be_pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream->private_data = rtd; - memcpy(compr->ops, &soc_compr_dyn_ops, sizeof(soc_compr_dyn_ops)); - } else - memcpy(compr->ops, &soc_compr_ops, sizeof(soc_compr_ops)); diff --git a/projects/imx6/patches/linux/linux-000-patch-3.14.32-33.patch b/projects/imx6/patches/linux/linux-000-patch-3.14.32-33.patch deleted file mode 100644 index 1d89fbe3fc1..00000000000 --- a/projects/imx6/patches/linux/linux-000-patch-3.14.32-33.patch +++ /dev/null @@ -1,942 +0,0 @@ -diff --git a/Makefile b/Makefile -index 00fffa3..b0963ca 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,6 +1,6 @@ - VERSION = 3 - PATCHLEVEL = 14 --SUBLEVEL = 32 -+SUBLEVEL = 33 - EXTRAVERSION = - NAME = Remembering Coco - -diff --git a/arch/arm/mm/context.c b/arch/arm/mm/context.c -index 6eb97b3..4370933 100644 ---- a/arch/arm/mm/context.c -+++ b/arch/arm/mm/context.c -@@ -144,21 +144,17 @@ static void flush_context(unsigned int cpu) - /* Update the list of reserved ASIDs and the ASID bitmap. */ - bitmap_clear(asid_map, 0, NUM_USER_ASIDS); - for_each_possible_cpu(i) { -- if (i == cpu) { -- asid = 0; -- } else { -- asid = atomic64_xchg(&per_cpu(active_asids, i), 0); -- /* -- * If this CPU has already been through a -- * rollover, but hasn't run another task in -- * the meantime, we must preserve its reserved -- * ASID, as this is the only trace we have of -- * the process it is still running. -- */ -- if (asid == 0) -- asid = per_cpu(reserved_asids, i); -- __set_bit(asid & ~ASID_MASK, asid_map); -- } -+ asid = atomic64_xchg(&per_cpu(active_asids, i), 0); -+ /* -+ * If this CPU has already been through a -+ * rollover, but hasn't run another task in -+ * the meantime, we must preserve its reserved -+ * ASID, as this is the only trace we have of -+ * the process it is still running. -+ */ -+ if (asid == 0) -+ asid = per_cpu(reserved_asids, i); -+ __set_bit(asid & ~ASID_MASK, asid_map); - per_cpu(reserved_asids, i) = asid; - } - -diff --git a/arch/arm64/include/asm/cputype.h b/arch/arm64/include/asm/cputype.h -index c404fb0..64bc6c6 100644 ---- a/arch/arm64/include/asm/cputype.h -+++ b/arch/arm64/include/asm/cputype.h -@@ -77,6 +77,8 @@ static inline u32 __attribute_const__ read_cpuid_cachetype(void) - return read_cpuid(CTR_EL0); - } - -+void cpuinfo_store_cpu(void); -+ - #endif /* __ASSEMBLY__ */ - - #endif -diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c -index 071c382..1e01d80 100644 ---- a/arch/arm64/kernel/setup.c -+++ b/arch/arm64/kernel/setup.c -@@ -41,6 +41,7 @@ - #include <linux/memblock.h> - #include <linux/of_fdt.h> - #include <linux/of_platform.h> -+#include <linux/personality.h> - - #include <asm/cputype.h> - #include <asm/elf.h> -@@ -73,7 +74,6 @@ unsigned int compat_elf_hwcap __read_mostly = COMPAT_ELF_HWCAP_DEFAULT; - #endif - - static const char *cpu_name; --static const char *machine_name; - phys_addr_t __fdt_pointer __initdata; - - /* -@@ -193,6 +193,19 @@ static void __init smp_build_mpidr_hash(void) - } - #endif - -+struct cpuinfo_arm64 { -+ struct cpu cpu; -+ u32 reg_midr; -+}; -+ -+static DEFINE_PER_CPU(struct cpuinfo_arm64, cpu_data); -+ -+void cpuinfo_store_cpu(void) -+{ -+ struct cpuinfo_arm64 *info = this_cpu_ptr(&cpu_data); -+ info->reg_midr = read_cpuid_id(); -+} -+ - static void __init setup_processor(void) - { - struct cpu_info *cpu_info; -@@ -213,6 +226,8 @@ static void __init setup_processor(void) - sprintf(init_utsname()->machine, ELF_PLATFORM); - elf_hwcap = 0; - -+ cpuinfo_store_cpu(); -+ - /* - * ID_AA64ISAR0_EL1 contains 4-bit wide signed feature blocks. - * The blocks we test below represent incremental functionality -@@ -257,8 +272,6 @@ static void __init setup_machine_fdt(phys_addr_t dt_phys) - while (true) - cpu_relax(); - } -- -- machine_name = of_flat_dt_get_machine_name(); - } - - /* -@@ -363,14 +376,12 @@ static int __init arm64_device_init(void) - } - arch_initcall(arm64_device_init); - --static DEFINE_PER_CPU(struct cpu, cpu_data); -- - static int __init topology_init(void) - { - int i; - - for_each_possible_cpu(i) { -- struct cpu *cpu = &per_cpu(cpu_data, i); -+ struct cpu *cpu = &per_cpu(cpu_data.cpu, i); - cpu->hotpluggable = 1; - register_cpu(cpu, i); - } -@@ -391,14 +402,41 @@ static const char *hwcap_str[] = { - NULL - }; - -+#ifdef CONFIG_COMPAT -+static const char *compat_hwcap_str[] = { -+ "swp", -+ "half", -+ "thumb", -+ "26bit", -+ "fastmult", -+ "fpa", -+ "vfp", -+ "edsp", -+ "java", -+ "iwmmxt", -+ "crunch", -+ "thumbee", -+ "neon", -+ "vfpv3", -+ "vfpv3d16", -+ "tls", -+ "vfpv4", -+ "idiva", -+ "idivt", -+ "vfpd32", -+ "lpae", -+ "evtstrm" -+}; -+#endif /* CONFIG_COMPAT */ -+ - static int c_show(struct seq_file *m, void *v) - { -- int i; -- -- seq_printf(m, "Processor\t: %s rev %d (%s)\n", -- cpu_name, read_cpuid_id() & 15, ELF_PLATFORM); -+ int i, j; - - for_each_online_cpu(i) { -+ struct cpuinfo_arm64 *cpuinfo = &per_cpu(cpu_data, i); -+ u32 midr = cpuinfo->reg_midr; -+ - /* - * glibc reads /proc/cpuinfo to determine the number of - * online processors, looking for lines beginning with -@@ -407,24 +445,33 @@ static int c_show(struct seq_file *m, void *v) - #ifdef CONFIG_SMP - seq_printf(m, "processor\t: %d\n", i); - #endif -- } -- -- /* dump out the processor features */ -- seq_puts(m, "Features\t: "); -- -- for (i = 0; hwcap_str[i]; i++) -- if (elf_hwcap & (1 << i)) -- seq_printf(m, "%s ", hwcap_str[i]); - -- seq_printf(m, "\nCPU implementer\t: 0x%02x\n", read_cpuid_id() >> 24); -- seq_printf(m, "CPU architecture: AArch64\n"); -- seq_printf(m, "CPU variant\t: 0x%x\n", (read_cpuid_id() >> 20) & 15); -- seq_printf(m, "CPU part\t: 0x%03x\n", (read_cpuid_id() >> 4) & 0xfff); -- seq_printf(m, "CPU revision\t: %d\n", read_cpuid_id() & 15); -- -- seq_puts(m, "\n"); -+ /* -+ * Dump out the common processor features in a single line. -+ * Userspace should read the hwcaps with getauxval(AT_HWCAP) -+ * rather than attempting to parse this, but there's a body of -+ * software which does already (at least for 32-bit). -+ */ -+ seq_puts(m, "Features\t:"); -+ if (personality(current->personality) == PER_LINUX32) { -+#ifdef CONFIG_COMPAT -+ for (j = 0; compat_hwcap_str[j]; j++) -+ if (compat_elf_hwcap & (1 << j)) -+ seq_printf(m, " %s", compat_hwcap_str[j]); -+#endif /* CONFIG_COMPAT */ -+ } else { -+ for (j = 0; hwcap_str[j]; j++) -+ if (elf_hwcap & (1 << j)) -+ seq_printf(m, " %s", hwcap_str[j]); -+ } -+ seq_puts(m, "\n"); - -- seq_printf(m, "Hardware\t: %s\n", machine_name); -+ seq_printf(m, "CPU implementer\t: 0x%02x\n", (midr >> 24)); -+ seq_printf(m, "CPU architecture: 8\n"); -+ seq_printf(m, "CPU variant\t: 0x%x\n", ((midr >> 20) & 0xf)); -+ seq_printf(m, "CPU part\t: 0x%03x\n", ((midr >> 4) & 0xfff)); -+ seq_printf(m, "CPU revision\t: %d\n\n", (midr & 0xf)); -+ } - - return 0; - } -diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c -index 7cfb92a..7b9542b 100644 ---- a/arch/arm64/kernel/smp.c -+++ b/arch/arm64/kernel/smp.c -@@ -148,6 +148,11 @@ asmlinkage void secondary_start_kernel(void) - cpu_ops[cpu]->cpu_postboot(); - - /* -+ * Log the CPU info before it is marked online and might get read. -+ */ -+ cpuinfo_store_cpu(); -+ -+ /* - * Enable GIC and timers. - */ - notify_cpu_starting(cpu); -diff --git a/arch/mips/cavium-octeon/smp.c b/arch/mips/cavium-octeon/smp.c -index 67a078f..34467ac 100644 ---- a/arch/mips/cavium-octeon/smp.c -+++ b/arch/mips/cavium-octeon/smp.c -@@ -263,9 +263,7 @@ static int octeon_cpu_disable(void) - - set_cpu_online(cpu, false); - cpu_clear(cpu, cpu_callin_map); -- local_irq_disable(); - octeon_fixup_irqs(); -- local_irq_enable(); - - flush_cache_all(); - local_flush_tlb_all(); -diff --git a/arch/mips/kernel/irq_cpu.c b/arch/mips/kernel/irq_cpu.c -index e498f2b..f5598e2 100644 ---- a/arch/mips/kernel/irq_cpu.c -+++ b/arch/mips/kernel/irq_cpu.c -@@ -56,6 +56,8 @@ static struct irq_chip mips_cpu_irq_controller = { - .irq_mask_ack = mask_mips_irq, - .irq_unmask = unmask_mips_irq, - .irq_eoi = unmask_mips_irq, -+ .irq_disable = mask_mips_irq, -+ .irq_enable = unmask_mips_irq, - }; - - /* -@@ -92,6 +94,8 @@ static struct irq_chip mips_mt_cpu_irq_controller = { - .irq_mask_ack = mips_mt_cpu_irq_ack, - .irq_unmask = unmask_mips_irq, - .irq_eoi = unmask_mips_irq, -+ .irq_disable = mask_mips_irq, -+ .irq_enable = unmask_mips_irq, - }; - - void __init mips_cpu_irq_init(void) -diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c -index 0a022ee..18ed112 100644 ---- a/arch/mips/kernel/smp.c -+++ b/arch/mips/kernel/smp.c -@@ -109,10 +109,10 @@ asmlinkage void start_secondary(void) - else - #endif /* CONFIG_MIPS_MT_SMTC */ - cpu_probe(); -- cpu_report(); - per_cpu_trap_init(false); - mips_clockevent_init(); - mp_ops->init_secondary(); -+ cpu_report(); - - /* - * XXX parity protection should be folded in here when it's converted -diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c -index de42688..80c22a3 100644 ---- a/arch/x86/kvm/vmx.c -+++ b/arch/x86/kvm/vmx.c -@@ -441,6 +441,7 @@ struct vcpu_vmx { - #endif - int gs_ldt_reload_needed; - int fs_reload_needed; -+ unsigned long vmcs_host_cr4; /* May not match real cr4 */ - } host_state; - struct { - int vm86_active; -@@ -4165,11 +4166,16 @@ static void vmx_set_constant_host_state(struct vcpu_vmx *vmx) - u32 low32, high32; - unsigned long tmpl; - struct desc_ptr dt; -+ unsigned long cr4; - - vmcs_writel(HOST_CR0, read_cr0() & ~X86_CR0_TS); /* 22.2.3 */ -- vmcs_writel(HOST_CR4, read_cr4()); /* 22.2.3, 22.2.5 */ - vmcs_writel(HOST_CR3, read_cr3()); /* 22.2.3 FIXME: shadow tables */ - -+ /* Save the most likely value for this task's CR4 in the VMCS. */ -+ cr4 = read_cr4(); -+ vmcs_writel(HOST_CR4, cr4); /* 22.2.3, 22.2.5 */ -+ vmx->host_state.vmcs_host_cr4 = cr4; -+ - vmcs_write16(HOST_CS_SELECTOR, __KERNEL_CS); /* 22.2.4 */ - #ifdef CONFIG_X86_64 - /* -@@ -7196,7 +7202,7 @@ static void atomic_switch_perf_msrs(struct vcpu_vmx *vmx) - static void __noclone vmx_vcpu_run(struct kvm_vcpu *vcpu) - { - struct vcpu_vmx *vmx = to_vmx(vcpu); -- unsigned long debugctlmsr; -+ unsigned long debugctlmsr, cr4; - - /* Record the guest's net vcpu time for enforced NMI injections. */ - if (unlikely(!cpu_has_virtual_nmis() && vmx->soft_vnmi_blocked)) -@@ -7217,6 +7223,12 @@ static void __noclone vmx_vcpu_run(struct kvm_vcpu *vcpu) - if (test_bit(VCPU_REGS_RIP, (unsigned long *)&vcpu->arch.regs_dirty)) - vmcs_writel(GUEST_RIP, vcpu->arch.regs[VCPU_REGS_RIP]); - -+ cr4 = read_cr4(); -+ if (unlikely(cr4 != vmx->host_state.vmcs_host_cr4)) { -+ vmcs_writel(HOST_CR4, cr4); -+ vmx->host_state.vmcs_host_cr4 = cr4; -+ } -+ - /* When single-stepping over STI and MOV SS, we must clear the - * corresponding interruptibility bits in the guest state. Otherwise - * vmentry fails as it then expects bit 14 (BS) in pending debug -diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c -index 981c2db..88f143d 100644 ---- a/arch/x86/pci/common.c -+++ b/arch/x86/pci/common.c -@@ -448,6 +448,22 @@ static const struct dmi_system_id pciprobe_dmi_table[] = { - DMI_MATCH(DMI_PRODUCT_NAME, "ftServer"), - }, - }, -+ { -+ .callback = set_scan_all, -+ .ident = "Stratus/NEC ftServer", -+ .matches = { -+ DMI_MATCH(DMI_SYS_VENDOR, "NEC"), -+ DMI_MATCH(DMI_PRODUCT_NAME, "Express5800/R32"), -+ }, -+ }, -+ { -+ .callback = set_scan_all, -+ .ident = "Stratus/NEC ftServer", -+ .matches = { -+ DMI_MATCH(DMI_SYS_VENDOR, "NEC"), -+ DMI_MATCH(DMI_PRODUCT_NAME, "Express5800/R31"), -+ }, -+ }, - {} - }; - -diff --git a/crypto/crc32c.c b/crypto/crc32c.c -index 06f7018..238f0e6 100644 ---- a/crypto/crc32c.c -+++ b/crypto/crc32c.c -@@ -170,3 +170,4 @@ module_exit(crc32c_mod_fini); - MODULE_AUTHOR("Clay Haapala <chaapala@cisco.com>"); - MODULE_DESCRIPTION("CRC32c (Castagnoli) calculations wrapper for lib/crc32c"); - MODULE_LICENSE("GPL"); -+MODULE_ALIAS_CRYPTO("crc32c"); -diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c -index ccbffd0..8f42bd7 100644 ---- a/drivers/gpio/gpiolib.c -+++ b/drivers/gpio/gpiolib.c -@@ -911,6 +911,7 @@ int gpiod_export_link(struct device *dev, const char *name, - if (tdev != NULL) { - status = sysfs_create_link(&dev->kobj, &tdev->kobj, - name); -+ put_device(tdev); - } else { - status = -ENODEV; - } -@@ -958,7 +959,7 @@ int gpiod_sysfs_set_active_low(struct gpio_desc *desc, int value) - } - - status = sysfs_set_active_low(desc, dev, value); -- -+ put_device(dev); - unlock: - mutex_unlock(&sysfs_lock); - -diff --git a/fs/cifs/file.c b/fs/cifs/file.c -index d375322..0218a9b 100644 ---- a/fs/cifs/file.c -+++ b/fs/cifs/file.c -@@ -366,6 +366,7 @@ void cifsFileInfo_put(struct cifsFileInfo *cifs_file) - struct cifsLockInfo *li, *tmp; - struct cifs_fid fid; - struct cifs_pending_open open; -+ bool oplock_break_cancelled; - - spin_lock(&cifs_file_list_lock); - if (--cifs_file->count > 0) { -@@ -397,7 +398,7 @@ void cifsFileInfo_put(struct cifsFileInfo *cifs_file) - } - spin_unlock(&cifs_file_list_lock); - -- cancel_work_sync(&cifs_file->oplock_break); -+ oplock_break_cancelled = cancel_work_sync(&cifs_file->oplock_break); - - if (!tcon->need_reconnect && !cifs_file->invalidHandle) { - struct TCP_Server_Info *server = tcon->ses->server; -@@ -409,6 +410,9 @@ void cifsFileInfo_put(struct cifsFileInfo *cifs_file) - _free_xid(xid); - } - -+ if (oplock_break_cancelled) -+ cifs_done_oplock_break(cifsi); -+ - cifs_del_pending_open(&open); - - /* -diff --git a/fs/ext4/file.c b/fs/ext4/file.c -index 2a8b2e1..589117e 100644 ---- a/fs/ext4/file.c -+++ b/fs/ext4/file.c -@@ -100,7 +100,7 @@ ext4_file_dio_write(struct kiocb *iocb, const struct iovec *iov, - struct blk_plug plug; - int unaligned_aio = 0; - ssize_t ret; -- int overwrite = 0; -+ int *overwrite = iocb->private; - size_t length = iov_length(iov, nr_segs); - - if (ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS) && -@@ -118,8 +118,6 @@ ext4_file_dio_write(struct kiocb *iocb, const struct iovec *iov, - mutex_lock(&inode->i_mutex); - blk_start_plug(&plug); - -- iocb->private = &overwrite; -- - /* check whether we do a DIO overwrite or not */ - if (ext4_should_dioread_nolock(inode) && !unaligned_aio && - !file->f_mapping->nrpages && pos + length <= i_size_read(inode)) { -@@ -143,7 +141,7 @@ ext4_file_dio_write(struct kiocb *iocb, const struct iovec *iov, - * So we should check these two conditions. - */ - if (err == len && (map.m_flags & EXT4_MAP_MAPPED)) -- overwrite = 1; -+ *overwrite = 1; - } - - ret = __generic_file_aio_write(iocb, iov, nr_segs, &iocb->ki_pos); -@@ -170,6 +168,7 @@ ext4_file_write(struct kiocb *iocb, const struct iovec *iov, - { - struct inode *inode = file_inode(iocb->ki_filp); - ssize_t ret; -+ int overwrite = 0; - - /* - * If we have encountered a bitmap-format file, the size limit -@@ -190,6 +189,7 @@ ext4_file_write(struct kiocb *iocb, const struct iovec *iov, - } - } - -+ iocb->private = &overwrite; - if (unlikely(iocb->ki_filp->f_flags & O_DIRECT)) - ret = ext4_file_dio_write(iocb, iov, nr_segs, pos); - else -diff --git a/fs/nilfs2/nilfs.h b/fs/nilfs2/nilfs.h -index 9bc72de..b02c202 100644 ---- a/fs/nilfs2/nilfs.h -+++ b/fs/nilfs2/nilfs.h -@@ -141,7 +141,6 @@ enum { - * @ti_save: Backup of journal_info field of task_struct - * @ti_flags: Flags - * @ti_count: Nest level -- * @ti_garbage: List of inode to be put when releasing semaphore - */ - struct nilfs_transaction_info { - u32 ti_magic; -@@ -150,7 +149,6 @@ struct nilfs_transaction_info { - one of other filesystems has a bug. */ - unsigned short ti_flags; - unsigned short ti_count; -- struct list_head ti_garbage; - }; - - /* ti_magic */ -diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c -index a1a1916..5bee816 100644 ---- a/fs/nilfs2/segment.c -+++ b/fs/nilfs2/segment.c -@@ -305,7 +305,6 @@ static void nilfs_transaction_lock(struct super_block *sb, - ti->ti_count = 0; - ti->ti_save = cur_ti; - ti->ti_magic = NILFS_TI_MAGIC; -- INIT_LIST_HEAD(&ti->ti_garbage); - current->journal_info = ti; - - for (;;) { -@@ -332,8 +331,6 @@ static void nilfs_transaction_unlock(struct super_block *sb) - - up_write(&nilfs->ns_segctor_sem); - current->journal_info = ti->ti_save; -- if (!list_empty(&ti->ti_garbage)) -- nilfs_dispose_list(nilfs, &ti->ti_garbage, 0); - } - - static void *nilfs_segctor_map_segsum_entry(struct nilfs_sc_info *sci, -@@ -746,6 +743,15 @@ static void nilfs_dispose_list(struct the_nilfs *nilfs, - } - } - -+static void nilfs_iput_work_func(struct work_struct *work) -+{ -+ struct nilfs_sc_info *sci = container_of(work, struct nilfs_sc_info, -+ sc_iput_work); -+ struct the_nilfs *nilfs = sci->sc_super->s_fs_info; -+ -+ nilfs_dispose_list(nilfs, &sci->sc_iput_queue, 0); -+} -+ - static int nilfs_test_metadata_dirty(struct the_nilfs *nilfs, - struct nilfs_root *root) - { -@@ -1899,8 +1905,8 @@ static int nilfs_segctor_collect_dirty_files(struct nilfs_sc_info *sci, - static void nilfs_segctor_drop_written_files(struct nilfs_sc_info *sci, - struct the_nilfs *nilfs) - { -- struct nilfs_transaction_info *ti = current->journal_info; - struct nilfs_inode_info *ii, *n; -+ int defer_iput = false; - - spin_lock(&nilfs->ns_inode_lock); - list_for_each_entry_safe(ii, n, &sci->sc_dirty_files, i_dirty) { -@@ -1911,9 +1917,24 @@ static void nilfs_segctor_drop_written_files(struct nilfs_sc_info *sci, - clear_bit(NILFS_I_BUSY, &ii->i_state); - brelse(ii->i_bh); - ii->i_bh = NULL; -- list_move_tail(&ii->i_dirty, &ti->ti_garbage); -+ list_del_init(&ii->i_dirty); -+ if (!ii->vfs_inode.i_nlink) { -+ /* -+ * Defer calling iput() to avoid a deadlock -+ * over I_SYNC flag for inodes with i_nlink == 0 -+ */ -+ list_add_tail(&ii->i_dirty, &sci->sc_iput_queue); -+ defer_iput = true; -+ } else { -+ spin_unlock(&nilfs->ns_inode_lock); -+ iput(&ii->vfs_inode); -+ spin_lock(&nilfs->ns_inode_lock); -+ } - } - spin_unlock(&nilfs->ns_inode_lock); -+ -+ if (defer_iput) -+ schedule_work(&sci->sc_iput_work); - } - - /* -@@ -2580,6 +2601,8 @@ static struct nilfs_sc_info *nilfs_segctor_new(struct super_block *sb, - INIT_LIST_HEAD(&sci->sc_segbufs); - INIT_LIST_HEAD(&sci->sc_write_logs); - INIT_LIST_HEAD(&sci->sc_gc_inodes); -+ INIT_LIST_HEAD(&sci->sc_iput_queue); -+ INIT_WORK(&sci->sc_iput_work, nilfs_iput_work_func); - init_timer(&sci->sc_timer); - - sci->sc_interval = HZ * NILFS_SC_DEFAULT_TIMEOUT; -@@ -2606,6 +2629,8 @@ static void nilfs_segctor_write_out(struct nilfs_sc_info *sci) - ret = nilfs_segctor_construct(sci, SC_LSEG_SR); - nilfs_transaction_unlock(sci->sc_super); - -+ flush_work(&sci->sc_iput_work); -+ - } while (ret && retrycount-- > 0); - } - -@@ -2630,6 +2655,9 @@ static void nilfs_segctor_destroy(struct nilfs_sc_info *sci) - || sci->sc_seq_request != sci->sc_seq_done); - spin_unlock(&sci->sc_state_lock); - -+ if (flush_work(&sci->sc_iput_work)) -+ flag = true; -+ - if (flag || !nilfs_segctor_confirm(sci)) - nilfs_segctor_write_out(sci); - -@@ -2639,6 +2667,12 @@ static void nilfs_segctor_destroy(struct nilfs_sc_info *sci) - nilfs_dispose_list(nilfs, &sci->sc_dirty_files, 1); - } - -+ if (!list_empty(&sci->sc_iput_queue)) { -+ nilfs_warning(sci->sc_super, __func__, -+ "iput queue is not empty\n"); -+ nilfs_dispose_list(nilfs, &sci->sc_iput_queue, 1); -+ } -+ - WARN_ON(!list_empty(&sci->sc_segbufs)); - WARN_ON(!list_empty(&sci->sc_write_logs)); - -diff --git a/fs/nilfs2/segment.h b/fs/nilfs2/segment.h -index 38a1d00..a48d6de 100644 ---- a/fs/nilfs2/segment.h -+++ b/fs/nilfs2/segment.h -@@ -26,6 +26,7 @@ - #include <linux/types.h> - #include <linux/fs.h> - #include <linux/buffer_head.h> -+#include <linux/workqueue.h> - #include <linux/nilfs2_fs.h> - #include "nilfs.h" - -@@ -92,6 +93,8 @@ struct nilfs_segsum_pointer { - * @sc_nblk_inc: Block count of current generation - * @sc_dirty_files: List of files to be written - * @sc_gc_inodes: List of GC inodes having blocks to be written -+ * @sc_iput_queue: list of inodes for which iput should be done -+ * @sc_iput_work: work struct to defer iput call - * @sc_freesegs: array of segment numbers to be freed - * @sc_nfreesegs: number of segments on @sc_freesegs - * @sc_dsync_inode: inode whose data pages are written for a sync operation -@@ -135,6 +138,8 @@ struct nilfs_sc_info { - - struct list_head sc_dirty_files; - struct list_head sc_gc_inodes; -+ struct list_head sc_iput_queue; -+ struct work_struct sc_iput_work; - - __u64 *sc_freesegs; - size_t sc_nfreesegs; -diff --git a/include/sound/ak4113.h b/include/sound/ak4113.h -index 2609048..3a34f6e 100644 ---- a/include/sound/ak4113.h -+++ b/include/sound/ak4113.h -@@ -286,7 +286,7 @@ struct ak4113 { - ak4113_write_t *write; - ak4113_read_t *read; - void *private_data; -- unsigned int init:1; -+ atomic_t wq_processing; - spinlock_t lock; - unsigned char regmap[AK4113_WRITABLE_REGS]; - struct snd_kcontrol *kctls[AK4113_CONTROLS]; -diff --git a/include/sound/ak4114.h b/include/sound/ak4114.h -index 52f02a6..069299a 100644 ---- a/include/sound/ak4114.h -+++ b/include/sound/ak4114.h -@@ -168,7 +168,7 @@ struct ak4114 { - ak4114_write_t * write; - ak4114_read_t * read; - void * private_data; -- unsigned int init: 1; -+ atomic_t wq_processing; - spinlock_t lock; - unsigned char regmap[6]; - unsigned char txcsb[5]; -diff --git a/kernel/smpboot.c b/kernel/smpboot.c -index eb89e18..60d35ac5 100644 ---- a/kernel/smpboot.c -+++ b/kernel/smpboot.c -@@ -279,6 +279,7 @@ int smpboot_register_percpu_thread(struct smp_hotplug_thread *plug_thread) - unsigned int cpu; - int ret = 0; - -+ get_online_cpus(); - mutex_lock(&smpboot_threads_lock); - for_each_online_cpu(cpu) { - ret = __smpboot_create_thread(plug_thread, cpu); -@@ -291,6 +292,7 @@ int smpboot_register_percpu_thread(struct smp_hotplug_thread *plug_thread) - list_add(&plug_thread->list, &hotplug_threads); - out: - mutex_unlock(&smpboot_threads_lock); -+ put_online_cpus(); - return ret; - } - EXPORT_SYMBOL_GPL(smpboot_register_percpu_thread); -diff --git a/lib/checksum.c b/lib/checksum.c -index 129775e..8b39e86 100644 ---- a/lib/checksum.c -+++ b/lib/checksum.c -@@ -181,6 +181,15 @@ csum_partial_copy(const void *src, void *dst, int len, __wsum sum) - EXPORT_SYMBOL(csum_partial_copy); - - #ifndef csum_tcpudp_nofold -+static inline u32 from64to32(u64 x) -+{ -+ /* add up 32-bit and 32-bit for 32+c bit */ -+ x = (x & 0xffffffff) + (x >> 32); -+ /* add up carry.. */ -+ x = (x & 0xffffffff) + (x >> 32); -+ return (u32)x; -+} -+ - __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr, - unsigned short len, - unsigned short proto, -@@ -195,8 +204,7 @@ __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr, - #else - s += (proto + len) << 8; - #endif -- s += (s >> 32); -- return (__force __wsum)s; -+ return (__force __wsum)from64to32(s); - } - EXPORT_SYMBOL(csum_tcpudp_nofold); - #endif -diff --git a/mm/pagewalk.c b/mm/pagewalk.c -index 2beeabf..9056d22 100644 ---- a/mm/pagewalk.c -+++ b/mm/pagewalk.c -@@ -199,7 +199,10 @@ int walk_page_range(unsigned long addr, unsigned long end, - */ - if ((vma->vm_start <= addr) && - (vma->vm_flags & VM_PFNMAP)) { -- next = vma->vm_end; -+ if (walk->pte_hole) -+ err = walk->pte_hole(addr, next, walk); -+ if (err) -+ break; - pgd = pgd_offset(walk->mm, next); - continue; - } -diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c -index db1512a..f53542b 100644 ---- a/scripts/kconfig/menu.c -+++ b/scripts/kconfig/menu.c -@@ -545,7 +545,7 @@ static void get_prompt_str(struct gstr *r, struct property *prop, - { - int i, j; - struct menu *submenu[8], *menu, *location = NULL; -- struct jump_key *jump; -+ struct jump_key *jump = NULL; - - str_printf(r, _("Prompt: %s\n"), _(prop->text)); - menu = prop->menu->parent; -@@ -583,7 +583,7 @@ static void get_prompt_str(struct gstr *r, struct property *prop, - str_printf(r, _(" Location:\n")); - for (j = 4; --i >= 0; j += 2) { - menu = submenu[i]; -- if (head && location && menu == location) -+ if (jump && menu == location) - jump->offset = strlen(r->s); - str_printf(r, "%*c-> %s", j, ' ', - _(menu_get_prompt(menu))); -diff --git a/sound/i2c/other/ak4113.c b/sound/i2c/other/ak4113.c -index e04e750..7a9149b 100644 ---- a/sound/i2c/other/ak4113.c -+++ b/sound/i2c/other/ak4113.c -@@ -56,8 +56,7 @@ static inline unsigned char reg_read(struct ak4113 *ak4113, unsigned char reg) - - static void snd_ak4113_free(struct ak4113 *chip) - { -- chip->init = 1; /* don't schedule new work */ -- mb(); -+ atomic_inc(&chip->wq_processing); /* don't schedule new work */ - cancel_delayed_work_sync(&chip->work); - kfree(chip); - } -@@ -89,6 +88,7 @@ int snd_ak4113_create(struct snd_card *card, ak4113_read_t *read, - chip->write = write; - chip->private_data = private_data; - INIT_DELAYED_WORK(&chip->work, ak4113_stats); -+ atomic_set(&chip->wq_processing, 0); - - for (reg = 0; reg < AK4113_WRITABLE_REGS ; reg++) - chip->regmap[reg] = pgm[reg]; -@@ -139,13 +139,11 @@ static void ak4113_init_regs(struct ak4113 *chip) - - void snd_ak4113_reinit(struct ak4113 *chip) - { -- chip->init = 1; -- mb(); -- flush_delayed_work(&chip->work); -+ if (atomic_inc_return(&chip->wq_processing) == 1) -+ cancel_delayed_work_sync(&chip->work); - ak4113_init_regs(chip); - /* bring up statistics / event queing */ -- chip->init = 0; -- if (chip->kctls[0]) -+ if (atomic_dec_and_test(&chip->wq_processing)) - schedule_delayed_work(&chip->work, HZ / 10); - } - EXPORT_SYMBOL_GPL(snd_ak4113_reinit); -@@ -632,8 +630,9 @@ static void ak4113_stats(struct work_struct *work) - { - struct ak4113 *chip = container_of(work, struct ak4113, work.work); - -- if (!chip->init) -+ if (atomic_inc_return(&chip->wq_processing) == 1) - snd_ak4113_check_rate_and_errors(chip, chip->check_flags); - -- schedule_delayed_work(&chip->work, HZ / 10); -+ if (atomic_dec_and_test(&chip->wq_processing)) -+ schedule_delayed_work(&chip->work, HZ / 10); - } -diff --git a/sound/i2c/other/ak4114.c b/sound/i2c/other/ak4114.c -index 15ae025..bf515db 100644 ---- a/sound/i2c/other/ak4114.c -+++ b/sound/i2c/other/ak4114.c -@@ -66,8 +66,7 @@ static void reg_dump(struct ak4114 *ak4114) - - static void snd_ak4114_free(struct ak4114 *chip) - { -- chip->init = 1; /* don't schedule new work */ -- mb(); -+ atomic_inc(&chip->wq_processing); /* don't schedule new work */ - cancel_delayed_work_sync(&chip->work); - kfree(chip); - } -@@ -100,6 +99,7 @@ int snd_ak4114_create(struct snd_card *card, - chip->write = write; - chip->private_data = private_data; - INIT_DELAYED_WORK(&chip->work, ak4114_stats); -+ atomic_set(&chip->wq_processing, 0); - - for (reg = 0; reg < 6; reg++) - chip->regmap[reg] = pgm[reg]; -@@ -152,13 +152,11 @@ static void ak4114_init_regs(struct ak4114 *chip) - - void snd_ak4114_reinit(struct ak4114 *chip) - { -- chip->init = 1; -- mb(); -- flush_delayed_work(&chip->work); -+ if (atomic_inc_return(&chip->wq_processing) == 1) -+ cancel_delayed_work_sync(&chip->work); - ak4114_init_regs(chip); - /* bring up statistics / event queing */ -- chip->init = 0; -- if (chip->kctls[0]) -+ if (atomic_dec_and_test(&chip->wq_processing)) - schedule_delayed_work(&chip->work, HZ / 10); - } - -@@ -612,10 +610,10 @@ static void ak4114_stats(struct work_struct *work) - { - struct ak4114 *chip = container_of(work, struct ak4114, work.work); - -- if (!chip->init) -+ if (atomic_inc_return(&chip->wq_processing) == 1) - snd_ak4114_check_rate_and_errors(chip, chip->check_flags); -- -- schedule_delayed_work(&chip->work, HZ / 10); -+ if (atomic_dec_and_test(&chip->wq_processing)) -+ schedule_delayed_work(&chip->work, HZ / 10); - } - - EXPORT_SYMBOL(snd_ak4114_create); -diff --git a/sound/soc/atmel/atmel_ssc_dai.c b/sound/soc/atmel/atmel_ssc_dai.c -index 1ead3c9..f20e703 100644 ---- a/sound/soc/atmel/atmel_ssc_dai.c -+++ b/sound/soc/atmel/atmel_ssc_dai.c -@@ -344,7 +344,6 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream, - struct atmel_pcm_dma_params *dma_params; - int dir, channels, bits; - u32 tfmr, rfmr, tcmr, rcmr; -- int start_event; - int ret; - - /* -@@ -451,19 +450,10 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream, - * The SSC transmit clock is obtained from the BCLK signal on - * on the TK line, and the SSC receive clock is - * generated from the transmit clock. -- * -- * For single channel data, one sample is transferred -- * on the falling edge of the LRC clock. -- * For two channel data, one sample is -- * transferred on both edges of the LRC clock. - */ -- start_event = ((channels == 1) -- ? SSC_START_FALLING_RF -- : SSC_START_EDGE_RF); -- - rcmr = SSC_BF(RCMR_PERIOD, 0) - | SSC_BF(RCMR_STTDLY, START_DELAY) -- | SSC_BF(RCMR_START, start_event) -+ | SSC_BF(RCMR_START, SSC_START_FALLING_RF) - | SSC_BF(RCMR_CKI, SSC_CKI_RISING) - | SSC_BF(RCMR_CKO, SSC_CKO_NONE) - | SSC_BF(RCMR_CKS, SSC_CKS_CLOCK); -@@ -471,14 +461,14 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream, - rfmr = SSC_BF(RFMR_FSEDGE, SSC_FSEDGE_POSITIVE) - | SSC_BF(RFMR_FSOS, SSC_FSOS_NONE) - | SSC_BF(RFMR_FSLEN, 0) -- | SSC_BF(RFMR_DATNB, 0) -+ | SSC_BF(RFMR_DATNB, (channels - 1)) - | SSC_BIT(RFMR_MSBF) - | SSC_BF(RFMR_LOOP, 0) - | SSC_BF(RFMR_DATLEN, (bits - 1)); - - tcmr = SSC_BF(TCMR_PERIOD, 0) - | SSC_BF(TCMR_STTDLY, START_DELAY) -- | SSC_BF(TCMR_START, start_event) -+ | SSC_BF(TCMR_START, SSC_START_FALLING_RF) - | SSC_BF(TCMR_CKI, SSC_CKI_FALLING) - | SSC_BF(TCMR_CKO, SSC_CKO_NONE) - | SSC_BF(TCMR_CKS, SSC_CKS_PIN); -@@ -487,7 +477,7 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream, - | SSC_BF(TFMR_FSDEN, 0) - | SSC_BF(TFMR_FSOS, SSC_FSOS_NONE) - | SSC_BF(TFMR_FSLEN, 0) -- | SSC_BF(TFMR_DATNB, 0) -+ | SSC_BF(TFMR_DATNB, (channels - 1)) - | SSC_BIT(TFMR_MSBF) - | SSC_BF(TFMR_DATDEF, 0) - | SSC_BF(TFMR_DATLEN, (bits - 1)); -diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c -index 12528e9..715589f 100644 ---- a/sound/soc/codecs/sgtl5000.c -+++ b/sound/soc/codecs/sgtl5000.c -@@ -1521,6 +1521,9 @@ static int sgtl5000_i2c_probe(struct i2c_client *client, - if (ret) - return ret; - -+ /* Need 8 clocks before I2C accesses */ -+ udelay(1); -+ - /* read chip information */ - ret = regmap_read(sgtl5000->regmap, SGTL5000_CHIP_ID, &reg); - if (ret) diff --git a/projects/imx6/patches/linux/linux-000-patch-3.14.33-34.patch b/projects/imx6/patches/linux/linux-000-patch-3.14.33-34.patch deleted file mode 100644 index cb65bdfb30b..00000000000 --- a/projects/imx6/patches/linux/linux-000-patch-3.14.33-34.patch +++ /dev/null @@ -1,584 +0,0 @@ -diff --git a/Makefile b/Makefile -index b0963ca..5443481 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,6 +1,6 @@ - VERSION = 3 - PATCHLEVEL = 14 --SUBLEVEL = 33 -+SUBLEVEL = 34 - EXTRAVERSION = - NAME = Remembering Coco - -diff --git a/drivers/media/rc/ir-lirc-codec.c b/drivers/media/rc/ir-lirc-codec.c -index ed2c8a1..98893a8 100644 ---- a/drivers/media/rc/ir-lirc-codec.c -+++ b/drivers/media/rc/ir-lirc-codec.c -@@ -42,11 +42,17 @@ static int ir_lirc_decode(struct rc_dev *dev, struct ir_raw_event ev) - return -EINVAL; - - /* Packet start */ -- if (ev.reset) -- return 0; -+ if (ev.reset) { -+ /* Userspace expects a long space event before the start of -+ * the signal to use as a sync. This may be done with repeat -+ * packets and normal samples. But if a reset has been sent -+ * then we assume that a long time has passed, so we send a -+ * space with the maximum time value. */ -+ sample = LIRC_SPACE(LIRC_VALUE_MASK); -+ IR_dprintk(2, "delivering reset sync space to lirc_dev\n"); - - /* Carrier reports */ -- if (ev.carrier_report) { -+ } else if (ev.carrier_report) { - sample = LIRC_FREQUENCY(ev.carrier); - IR_dprintk(2, "carrier report (freq: %d)\n", sample); - -diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c -index afa4a1f..a830d42 100644 ---- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c -+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c -@@ -3131,7 +3131,7 @@ static int bnx2x_poll(struct napi_struct *napi, int budget) - } - #endif - if (!bnx2x_fp_lock_napi(fp)) -- return work_done; -+ return budget; - - for_each_cos_in_tx_queue(fp, cos) - if (bnx2x_tx_queue_has_work(fp->txdata_ptr[cos])) -diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c -index 70849de..5fa076f 100644 ---- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c -+++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c -@@ -2390,7 +2390,10 @@ static int netxen_nic_poll(struct napi_struct *napi, int budget) - - work_done = netxen_process_rcv_ring(sds_ring, budget); - -- if ((work_done < budget) && tx_complete) { -+ if (!tx_complete) -+ work_done = budget; -+ -+ if (work_done < budget) { - napi_complete(&sds_ring->napi); - if (test_bit(__NX_DEV_UP, &adapter->state)) - netxen_nic_enable_int(sds_ring); -diff --git a/drivers/net/ppp/ppp_deflate.c b/drivers/net/ppp/ppp_deflate.c -index 602c625..b5edc7f 100644 ---- a/drivers/net/ppp/ppp_deflate.c -+++ b/drivers/net/ppp/ppp_deflate.c -@@ -246,7 +246,7 @@ static int z_compress(void *arg, unsigned char *rptr, unsigned char *obuf, - /* - * See if we managed to reduce the size of the packet. - */ -- if (olen < isize) { -+ if (olen < isize && olen <= osize) { - state->stats.comp_bytes += olen; - state->stats.comp_packets++; - } else { -diff --git a/include/net/ip.h b/include/net/ip.h -index 937f196..3446cdd 100644 ---- a/include/net/ip.h -+++ b/include/net/ip.h -@@ -38,11 +38,12 @@ struct inet_skb_parm { - struct ip_options opt; /* Compiled IP options */ - unsigned char flags; - --#define IPSKB_FORWARDED 1 --#define IPSKB_XFRM_TUNNEL_SIZE 2 --#define IPSKB_XFRM_TRANSFORMED 4 --#define IPSKB_FRAG_COMPLETE 8 --#define IPSKB_REROUTED 16 -+#define IPSKB_FORWARDED BIT(0) -+#define IPSKB_XFRM_TUNNEL_SIZE BIT(1) -+#define IPSKB_XFRM_TRANSFORMED BIT(2) -+#define IPSKB_FRAG_COMPLETE BIT(3) -+#define IPSKB_REROUTED BIT(4) -+#define IPSKB_DOREDIRECT BIT(5) - - u16 frag_max_size; - }; -@@ -174,7 +175,7 @@ static inline __u8 ip_reply_arg_flowi_flags(const struct ip_reply_arg *arg) - return (arg->flags & IP_REPLY_ARG_NOSRCCHECK) ? FLOWI_FLAG_ANYSRC : 0; - } - --void ip_send_unicast_reply(struct net *net, struct sk_buff *skb, __be32 daddr, -+void ip_send_unicast_reply(struct sock *sk, struct sk_buff *skb, __be32 daddr, - __be32 saddr, const struct ip_reply_arg *arg, - unsigned int len); - -diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h -index 80f500a..57c2da9 100644 ---- a/include/net/netns/ipv4.h -+++ b/include/net/netns/ipv4.h -@@ -47,6 +47,7 @@ struct netns_ipv4 { - struct inet_peer_base *peers; - struct tcpm_hash_bucket *tcp_metrics_hash; - unsigned int tcp_metrics_hash_log; -+ struct sock * __percpu *tcp_sk; - struct netns_frags frags; - #ifdef CONFIG_NETFILTER - struct xt_table *iptable_filter; -diff --git a/net/core/dev.c b/net/core/dev.c -index 86bb9cc..4ed77d7 100644 ---- a/net/core/dev.c -+++ b/net/core/dev.c -@@ -6812,10 +6812,20 @@ static int dev_cpu_callback(struct notifier_block *nfb, - oldsd->output_queue = NULL; - oldsd->output_queue_tailp = &oldsd->output_queue; - } -- /* Append NAPI poll list from offline CPU. */ -- if (!list_empty(&oldsd->poll_list)) { -- list_splice_init(&oldsd->poll_list, &sd->poll_list); -- raise_softirq_irqoff(NET_RX_SOFTIRQ); -+ /* Append NAPI poll list from offline CPU, with one exception : -+ * process_backlog() must be called by cpu owning percpu backlog. -+ * We properly handle process_queue & input_pkt_queue later. -+ */ -+ while (!list_empty(&oldsd->poll_list)) { -+ struct napi_struct *napi = list_first_entry(&oldsd->poll_list, -+ struct napi_struct, -+ poll_list); -+ -+ list_del_init(&napi->poll_list); -+ if (napi->poll == process_backlog) -+ napi->state = 0; -+ else -+ ____napi_schedule(sd, napi); - } - - raise_softirq_irqoff(NET_TX_SOFTIRQ); -@@ -6826,7 +6836,7 @@ static int dev_cpu_callback(struct notifier_block *nfb, - netif_rx_internal(skb); - input_queue_head_incr(oldsd); - } -- while ((skb = __skb_dequeue(&oldsd->input_pkt_queue))) { -+ while ((skb = skb_dequeue(&oldsd->input_pkt_queue))) { - netif_rx_internal(skb); - input_queue_head_incr(oldsd); - } -diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c -index 4617586..a6613ff 100644 ---- a/net/core/rtnetlink.c -+++ b/net/core/rtnetlink.c -@@ -2649,12 +2649,16 @@ static int rtnl_bridge_notify(struct net_device *dev, u16 flags) - goto errout; - } - -+ if (!skb->len) -+ goto errout; -+ - rtnl_notify(skb, net, 0, RTNLGRP_LINK, NULL, GFP_ATOMIC); - return 0; - errout: - WARN_ON(err == -EMSGSIZE); - kfree_skb(skb); -- rtnl_set_sk_err(net, RTNLGRP_LINK, err); -+ if (err) -+ rtnl_set_sk_err(net, RTNLGRP_LINK, err); - return err; - } - -diff --git a/net/ipv4/ip_forward.c b/net/ipv4/ip_forward.c -index 1c6bd43..ecb34b5 100644 ---- a/net/ipv4/ip_forward.c -+++ b/net/ipv4/ip_forward.c -@@ -178,7 +178,8 @@ int ip_forward(struct sk_buff *skb) - * We now generate an ICMP HOST REDIRECT giving the route - * we calculated. - */ -- if (rt->rt_flags&RTCF_DOREDIRECT && !opt->srr && !skb_sec_path(skb)) -+ if (IPCB(skb)->flags & IPSKB_DOREDIRECT && !opt->srr && -+ !skb_sec_path(skb)) - ip_rt_send_redirect(skb); - - skb->priority = rt_tos2priority(iph->tos); -diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c -index 844323b..dd637fc 100644 ---- a/net/ipv4/ip_output.c -+++ b/net/ipv4/ip_output.c -@@ -1460,23 +1460,8 @@ static int ip_reply_glue_bits(void *dptr, char *to, int offset, - /* - * Generic function to send a packet as reply to another packet. - * Used to send some TCP resets/acks so far. -- * -- * Use a fake percpu inet socket to avoid false sharing and contention. - */ --static DEFINE_PER_CPU(struct inet_sock, unicast_sock) = { -- .sk = { -- .__sk_common = { -- .skc_refcnt = ATOMIC_INIT(1), -- }, -- .sk_wmem_alloc = ATOMIC_INIT(1), -- .sk_allocation = GFP_ATOMIC, -- .sk_flags = (1UL << SOCK_USE_WRITE_QUEUE), -- }, -- .pmtudisc = IP_PMTUDISC_WANT, -- .uc_ttl = -1, --}; -- --void ip_send_unicast_reply(struct net *net, struct sk_buff *skb, __be32 daddr, -+void ip_send_unicast_reply(struct sock *sk, struct sk_buff *skb, __be32 daddr, - __be32 saddr, const struct ip_reply_arg *arg, - unsigned int len) - { -@@ -1484,9 +1469,8 @@ void ip_send_unicast_reply(struct net *net, struct sk_buff *skb, __be32 daddr, - struct ipcm_cookie ipc; - struct flowi4 fl4; - struct rtable *rt = skb_rtable(skb); -+ struct net *net = sock_net(sk); - struct sk_buff *nskb; -- struct sock *sk; -- struct inet_sock *inet; - int err; - - if (ip_options_echo(&replyopts.opt.opt, skb)) -@@ -1516,15 +1500,11 @@ void ip_send_unicast_reply(struct net *net, struct sk_buff *skb, __be32 daddr, - if (IS_ERR(rt)) - return; - -- inet = &get_cpu_var(unicast_sock); -+ inet_sk(sk)->tos = arg->tos; - -- inet->tos = arg->tos; -- sk = &inet->sk; - sk->sk_priority = skb->priority; - sk->sk_protocol = ip_hdr(skb)->protocol; - sk->sk_bound_dev_if = arg->bound_dev_if; -- sock_net_set(sk, net); -- __skb_queue_head_init(&sk->sk_write_queue); - sk->sk_sndbuf = sysctl_wmem_default; - err = ip_append_data(sk, &fl4, ip_reply_glue_bits, arg->iov->iov_base, - len, 0, &ipc, &rt, MSG_DONTWAIT); -@@ -1540,13 +1520,10 @@ void ip_send_unicast_reply(struct net *net, struct sk_buff *skb, __be32 daddr, - arg->csumoffset) = csum_fold(csum_add(nskb->csum, - arg->csum)); - nskb->ip_summed = CHECKSUM_NONE; -- skb_orphan(nskb); - skb_set_queue_mapping(nskb, skb_get_queue_mapping(skb)); - ip_push_pending_frames(sk, &fl4); - } - out: -- put_cpu_var(unicast_sock); -- - ip_rt_put(rt); - } - -diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c -index 580dd96..135045e 100644 ---- a/net/ipv4/ip_sockglue.c -+++ b/net/ipv4/ip_sockglue.c -@@ -426,15 +426,11 @@ int ip_recv_error(struct sock *sk, struct msghdr *msg, int len, int *addr_len) - - memcpy(&errhdr.ee, &serr->ee, sizeof(struct sock_extended_err)); - sin = &errhdr.offender; -- sin->sin_family = AF_UNSPEC; -+ memset(sin, 0, sizeof(*sin)); - if (serr->ee.ee_origin == SO_EE_ORIGIN_ICMP) { -- struct inet_sock *inet = inet_sk(sk); -- - sin->sin_family = AF_INET; - sin->sin_addr.s_addr = ip_hdr(skb)->saddr; -- sin->sin_port = 0; -- memset(&sin->sin_zero, 0, sizeof(sin->sin_zero)); -- if (inet->cmsg_flags) -+ if (inet_sk(sk)->cmsg_flags) - ip_cmsg_recv(msg, skb); - } - -diff --git a/net/ipv4/ping.c b/net/ipv4/ping.c -index 0d33f94..04ce671 100644 ---- a/net/ipv4/ping.c -+++ b/net/ipv4/ping.c -@@ -973,8 +973,11 @@ void ping_rcv(struct sk_buff *skb) - - sk = ping_lookup(net, skb, ntohs(icmph->un.echo.id)); - if (sk != NULL) { -+ struct sk_buff *skb2 = skb_clone(skb, GFP_ATOMIC); -+ - pr_debug("rcv on socket %p\n", sk); -- ping_queue_rcv_skb(sk, skb_get(skb)); -+ if (skb2) -+ ping_queue_rcv_skb(sk, skb2); - sock_put(sk); - return; - } -diff --git a/net/ipv4/route.c b/net/ipv4/route.c -index 487bb62..b64330f 100644 ---- a/net/ipv4/route.c -+++ b/net/ipv4/route.c -@@ -1554,11 +1554,10 @@ static int __mkroute_input(struct sk_buff *skb, - - do_cache = res->fi && !itag; - if (out_dev == in_dev && err && IN_DEV_TX_REDIRECTS(out_dev) && -+ skb->protocol == htons(ETH_P_IP) && - (IN_DEV_SHARED_MEDIA(out_dev) || -- inet_addr_onlink(out_dev, saddr, FIB_RES_GW(*res)))) { -- flags |= RTCF_DOREDIRECT; -- do_cache = false; -- } -+ inet_addr_onlink(out_dev, saddr, FIB_RES_GW(*res)))) -+ IPCB(skb)->flags |= IPSKB_DOREDIRECT; - - if (skb->protocol != htons(ETH_P_IP)) { - /* Not IP (i.e. ARP). Do not create route, if it is -@@ -2305,6 +2304,8 @@ static int rt_fill_info(struct net *net, __be32 dst, __be32 src, - r->rtm_flags = (rt->rt_flags & ~0xFFFF) | RTM_F_CLONED; - if (rt->rt_flags & RTCF_NOTIFY) - r->rtm_flags |= RTM_F_NOTIFY; -+ if (IPCB(skb)->flags & IPSKB_DOREDIRECT) -+ r->rtm_flags |= RTCF_DOREDIRECT; - - if (nla_put_be32(skb, RTA_DST, dst)) - goto nla_put_failure; -diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c -index a782d5b..b7effad 100644 ---- a/net/ipv4/tcp_ipv4.c -+++ b/net/ipv4/tcp_ipv4.c -@@ -691,7 +691,8 @@ static void tcp_v4_send_reset(struct sock *sk, struct sk_buff *skb) - - net = dev_net(skb_dst(skb)->dev); - arg.tos = ip_hdr(skb)->tos; -- ip_send_unicast_reply(net, skb, ip_hdr(skb)->saddr, -+ ip_send_unicast_reply(*this_cpu_ptr(net->ipv4.tcp_sk), -+ skb, ip_hdr(skb)->saddr, - ip_hdr(skb)->daddr, &arg, arg.iov[0].iov_len); - - TCP_INC_STATS_BH(net, TCP_MIB_OUTSEGS); -@@ -774,7 +775,8 @@ static void tcp_v4_send_ack(struct sk_buff *skb, u32 seq, u32 ack, - if (oif) - arg.bound_dev_if = oif; - arg.tos = tos; -- ip_send_unicast_reply(net, skb, ip_hdr(skb)->saddr, -+ ip_send_unicast_reply(*this_cpu_ptr(net->ipv4.tcp_sk), -+ skb, ip_hdr(skb)->saddr, - ip_hdr(skb)->daddr, &arg, arg.iov[0].iov_len); - - TCP_INC_STATS_BH(net, TCP_MIB_OUTSEGS); -@@ -2769,14 +2771,39 @@ struct proto tcp_prot = { - }; - EXPORT_SYMBOL(tcp_prot); - -+static void __net_exit tcp_sk_exit(struct net *net) -+{ -+ int cpu; -+ -+ for_each_possible_cpu(cpu) -+ inet_ctl_sock_destroy(*per_cpu_ptr(net->ipv4.tcp_sk, cpu)); -+ free_percpu(net->ipv4.tcp_sk); -+} -+ - static int __net_init tcp_sk_init(struct net *net) - { -+ int res, cpu; -+ -+ net->ipv4.tcp_sk = alloc_percpu(struct sock *); -+ if (!net->ipv4.tcp_sk) -+ return -ENOMEM; -+ -+ for_each_possible_cpu(cpu) { -+ struct sock *sk; -+ -+ res = inet_ctl_sock_create(&sk, PF_INET, SOCK_RAW, -+ IPPROTO_TCP, net); -+ if (res) -+ goto fail; -+ *per_cpu_ptr(net->ipv4.tcp_sk, cpu) = sk; -+ } - net->ipv4.sysctl_tcp_ecn = 2; - return 0; --} - --static void __net_exit tcp_sk_exit(struct net *net) --{ -+fail: -+ tcp_sk_exit(net); -+ -+ return res; - } - - static void __net_exit tcp_sk_exit_batch(struct list_head *net_exit_list) -diff --git a/net/ipv4/udp_diag.c b/net/ipv4/udp_diag.c -index 7927db0..4a000f1 100644 ---- a/net/ipv4/udp_diag.c -+++ b/net/ipv4/udp_diag.c -@@ -99,11 +99,13 @@ static void udp_dump(struct udp_table *table, struct sk_buff *skb, struct netlin - s_slot = cb->args[0]; - num = s_num = cb->args[1]; - -- for (slot = s_slot; slot <= table->mask; num = s_num = 0, slot++) { -+ for (slot = s_slot; slot <= table->mask; s_num = 0, slot++) { - struct sock *sk; - struct hlist_nulls_node *node; - struct udp_hslot *hslot = &table->hash[slot]; - -+ num = 0; -+ - if (hlist_nulls_empty(&hslot->head)) - continue; - -diff --git a/net/ipv6/datagram.c b/net/ipv6/datagram.c -index c3bf2d2..841cfa2 100644 ---- a/net/ipv6/datagram.c -+++ b/net/ipv6/datagram.c -@@ -382,11 +382,10 @@ int ipv6_recv_error(struct sock *sk, struct msghdr *msg, int len, int *addr_len) - - memcpy(&errhdr.ee, &serr->ee, sizeof(struct sock_extended_err)); - sin = &errhdr.offender; -- sin->sin6_family = AF_UNSPEC; -+ memset(sin, 0, sizeof(*sin)); -+ - if (serr->ee.ee_origin != SO_EE_ORIGIN_LOCAL) { - sin->sin6_family = AF_INET6; -- sin->sin6_flowinfo = 0; -- sin->sin6_port = 0; - if (np->rxopt.all) - ip6_datagram_recv_common_ctl(sk, msg, skb); - if (skb->protocol == htons(ETH_P_IPV6)) { -@@ -397,12 +396,9 @@ int ipv6_recv_error(struct sock *sk, struct msghdr *msg, int len, int *addr_len) - ipv6_iface_scope_id(&sin->sin6_addr, - IP6CB(skb)->iif); - } else { -- struct inet_sock *inet = inet_sk(sk); -- - ipv6_addr_set_v4mapped(ip_hdr(skb)->saddr, - &sin->sin6_addr); -- sin->sin6_scope_id = 0; -- if (inet->cmsg_flags) -+ if (inet_sk(sk)->cmsg_flags) - ip_cmsg_recv(msg, skb); - } - } -diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c -index 1e55f5e..7daaeaf 100644 ---- a/net/ipv6/ip6_fib.c -+++ b/net/ipv6/ip6_fib.c -@@ -638,6 +638,29 @@ static inline bool rt6_qualify_for_ecmp(struct rt6_info *rt) - RTF_GATEWAY; - } - -+static void fib6_purge_rt(struct rt6_info *rt, struct fib6_node *fn, -+ struct net *net) -+{ -+ if (atomic_read(&rt->rt6i_ref) != 1) { -+ /* This route is used as dummy address holder in some split -+ * nodes. It is not leaked, but it still holds other resources, -+ * which must be released in time. So, scan ascendant nodes -+ * and replace dummy references to this route with references -+ * to still alive ones. -+ */ -+ while (fn) { -+ if (!(fn->fn_flags & RTN_RTINFO) && fn->leaf == rt) { -+ fn->leaf = fib6_find_prefix(net, fn); -+ atomic_inc(&fn->leaf->rt6i_ref); -+ rt6_release(rt); -+ } -+ fn = fn->parent; -+ } -+ /* No more references are possible at this point. */ -+ BUG_ON(atomic_read(&rt->rt6i_ref) != 1); -+ } -+} -+ - /* - * Insert routing information in a node. - */ -@@ -775,11 +798,12 @@ add: - rt->dst.rt6_next = iter->dst.rt6_next; - atomic_inc(&rt->rt6i_ref); - inet6_rt_notify(RTM_NEWROUTE, rt, info); -- rt6_release(iter); - if (!(fn->fn_flags & RTN_RTINFO)) { - info->nl_net->ipv6.rt6_stats->fib_route_nodes++; - fn->fn_flags |= RTN_RTINFO; - } -+ fib6_purge_rt(iter, fn, info->nl_net); -+ rt6_release(iter); - } - - return 0; -@@ -1284,24 +1308,7 @@ static void fib6_del_route(struct fib6_node *fn, struct rt6_info **rtp, - fn = fib6_repair_tree(net, fn); - } - -- if (atomic_read(&rt->rt6i_ref) != 1) { -- /* This route is used as dummy address holder in some split -- * nodes. It is not leaked, but it still holds other resources, -- * which must be released in time. So, scan ascendant nodes -- * and replace dummy references to this route with references -- * to still alive ones. -- */ -- while (fn) { -- if (!(fn->fn_flags & RTN_RTINFO) && fn->leaf == rt) { -- fn->leaf = fib6_find_prefix(net, fn); -- atomic_inc(&fn->leaf->rt6i_ref); -- rt6_release(rt); -- } -- fn = fn->parent; -- } -- /* No more references are possible at this point. */ -- BUG_ON(atomic_read(&rt->rt6i_ref) != 1); -- } -+ fib6_purge_rt(rt, fn, net); - - inet6_rt_notify(RTM_DELROUTE, rt, info); - rt6_release(rt); -diff --git a/net/ipv6/route.c b/net/ipv6/route.c -index 7cc1102..6f1b850 100644 ---- a/net/ipv6/route.c -+++ b/net/ipv6/route.c -@@ -1160,12 +1160,9 @@ static void ip6_rt_update_pmtu(struct dst_entry *dst, struct sock *sk, - struct net *net = dev_net(dst->dev); - - rt6->rt6i_flags |= RTF_MODIFIED; -- if (mtu < IPV6_MIN_MTU) { -- u32 features = dst_metric(dst, RTAX_FEATURES); -+ if (mtu < IPV6_MIN_MTU) - mtu = IPV6_MIN_MTU; -- features |= RTAX_FEATURE_ALLFRAG; -- dst_metric_set(dst, RTAX_FEATURES, features); -- } -+ - dst_metric_set(dst, RTAX_MTU, mtu); - rt6_update_expires(rt6, net->ipv6.sysctl.ip6_rt_mtu_expires); - } -diff --git a/net/sctp/associola.c b/net/sctp/associola.c -index d477d47..abc0922 100644 ---- a/net/sctp/associola.c -+++ b/net/sctp/associola.c -@@ -1235,7 +1235,6 @@ void sctp_assoc_update(struct sctp_association *asoc, - asoc->peer.peer_hmacs = new->peer.peer_hmacs; - new->peer.peer_hmacs = NULL; - -- sctp_auth_key_put(asoc->asoc_shared_key); - sctp_auth_asoc_init_active_key(asoc, GFP_ATOMIC); - } - -diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c -index 43abb64..df06b13 100644 ---- a/net/sctp/sm_make_chunk.c -+++ b/net/sctp/sm_make_chunk.c -@@ -2608,7 +2608,7 @@ do_addr_param: - - addr_param = param.v + sizeof(sctp_addip_param_t); - -- af = sctp_get_af_specific(param_type2af(param.p->type)); -+ af = sctp_get_af_specific(param_type2af(addr_param->p.type)); - if (af == NULL) - break; - -diff --git a/net/socket.c b/net/socket.c -index a19ae19..1b2c2d6 100644 ---- a/net/socket.c -+++ b/net/socket.c -@@ -886,9 +886,6 @@ static ssize_t sock_splice_read(struct file *file, loff_t *ppos, - static struct sock_iocb *alloc_sock_iocb(struct kiocb *iocb, - struct sock_iocb *siocb) - { -- if (!is_sync_kiocb(iocb)) -- BUG(); -- - siocb->kiocb = iocb; - iocb->private = siocb; - return siocb; diff --git a/projects/imx6/patches/linux/linux-000-patch-3.14.34-35.patch b/projects/imx6/patches/linux/linux-000-patch-3.14.34-35.patch deleted file mode 100644 index c90d04e96c9..00000000000 --- a/projects/imx6/patches/linux/linux-000-patch-3.14.34-35.patch +++ /dev/null @@ -1,2036 +0,0 @@ -diff --git a/Makefile b/Makefile -index 5443481..9720e86 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,6 +1,6 @@ - VERSION = 3 - PATCHLEVEL = 14 --SUBLEVEL = 34 -+SUBLEVEL = 35 - EXTRAVERSION = - NAME = Remembering Coco - -diff --git a/arch/arc/include/asm/pgtable.h b/arch/arc/include/asm/pgtable.h -index 6b0b7f7e..7670f33 100644 ---- a/arch/arc/include/asm/pgtable.h -+++ b/arch/arc/include/asm/pgtable.h -@@ -259,7 +259,8 @@ static inline void pmd_set(pmd_t *pmdp, pte_t *ptep) - #define pmd_clear(xp) do { pmd_val(*(xp)) = 0; } while (0) - - #define pte_page(x) (mem_map + \ -- (unsigned long)(((pte_val(x) - PAGE_OFFSET) >> PAGE_SHIFT))) -+ (unsigned long)(((pte_val(x) - CONFIG_LINUX_LINK_BASE) >> \ -+ PAGE_SHIFT))) - - #define mk_pte(page, pgprot) \ - ({ \ -diff --git a/arch/arm/boot/dts/am335x-bone-common.dtsi b/arch/arm/boot/dts/am335x-bone-common.dtsi -index 2e7d932..b3eff40 100644 ---- a/arch/arm/boot/dts/am335x-bone-common.dtsi -+++ b/arch/arm/boot/dts/am335x-bone-common.dtsi -@@ -197,6 +197,7 @@ - - usb@47401000 { - status = "okay"; -+ dr_mode = "peripheral"; - }; - - usb@47401800 { -diff --git a/arch/arm/boot/dts/tegra20.dtsi b/arch/arm/boot/dts/tegra20.dtsi -index 48d2a7f..ce978bc 100644 ---- a/arch/arm/boot/dts/tegra20.dtsi -+++ b/arch/arm/boot/dts/tegra20.dtsi -@@ -76,9 +76,9 @@ - reset-names = "2d"; - }; - -- gr3d@54140000 { -+ gr3d@54180000 { - compatible = "nvidia,tegra20-gr3d"; -- reg = <0x54140000 0x00040000>; -+ reg = <0x54180000 0x00040000>; - clocks = <&tegra_car TEGRA20_CLK_GR3D>; - resets = <&tegra_car 24>; - reset-names = "3d"; -@@ -138,9 +138,9 @@ - status = "disabled"; - }; - -- dsi@542c0000 { -+ dsi@54300000 { - compatible = "nvidia,tegra20-dsi"; -- reg = <0x542c0000 0x00040000>; -+ reg = <0x54300000 0x00040000>; - clocks = <&tegra_car TEGRA20_CLK_DSI>; - resets = <&tegra_car 48>; - reset-names = "dsi"; -diff --git a/arch/arm/mach-omap2/omap_hwmod_7xx_data.c b/arch/arm/mach-omap2/omap_hwmod_7xx_data.c -index 2e35ff9..d3ac4c6 100644 ---- a/arch/arm/mach-omap2/omap_hwmod_7xx_data.c -+++ b/arch/arm/mach-omap2/omap_hwmod_7xx_data.c -@@ -1669,7 +1669,7 @@ static struct omap_hwmod dra7xx_uart3_hwmod = { - .class = &dra7xx_uart_hwmod_class, - .clkdm_name = "l4per_clkdm", - .main_clk = "uart3_gfclk_mux", -- .flags = HWMOD_SWSUP_SIDLE_ACT, -+ .flags = HWMOD_SWSUP_SIDLE_ACT | DEBUG_OMAP4UART3_FLAGS, - .prcm = { - .omap4 = { - .clkctrl_offs = DRA7XX_CM_L4PER_UART3_CLKCTRL_OFFSET, -diff --git a/arch/arm/mach-pxa/corgi.c b/arch/arm/mach-pxa/corgi.c -index f162f1b..82fd9dd 100644 ---- a/arch/arm/mach-pxa/corgi.c -+++ b/arch/arm/mach-pxa/corgi.c -@@ -26,6 +26,7 @@ - #include <linux/i2c.h> - #include <linux/i2c/pxa-i2c.h> - #include <linux/io.h> -+#include <linux/regulator/machine.h> - #include <linux/spi/spi.h> - #include <linux/spi/ads7846.h> - #include <linux/spi/corgi_lcd.h> -@@ -711,6 +712,8 @@ static void __init corgi_init(void) - sharpsl_nand_partitions[1].size = 53 * 1024 * 1024; - - platform_add_devices(devices, ARRAY_SIZE(devices)); -+ -+ regulator_has_full_constraints(); - } - - static void __init fixup_corgi(struct tag *tags, char **cmdline, -diff --git a/arch/arm/mach-pxa/hx4700.c b/arch/arm/mach-pxa/hx4700.c -index a7c30eb..007fd8a 100644 ---- a/arch/arm/mach-pxa/hx4700.c -+++ b/arch/arm/mach-pxa/hx4700.c -@@ -892,6 +892,8 @@ static void __init hx4700_init(void) - mdelay(10); - gpio_set_value(GPIO71_HX4700_ASIC3_nRESET, 1); - mdelay(10); -+ -+ regulator_has_full_constraints(); - } - - MACHINE_START(H4700, "HP iPAQ HX4700") -diff --git a/arch/arm/mach-pxa/poodle.c b/arch/arm/mach-pxa/poodle.c -index aedf053..b4fff29 100644 ---- a/arch/arm/mach-pxa/poodle.c -+++ b/arch/arm/mach-pxa/poodle.c -@@ -25,6 +25,7 @@ - #include <linux/gpio.h> - #include <linux/i2c.h> - #include <linux/i2c/pxa-i2c.h> -+#include <linux/regulator/machine.h> - #include <linux/spi/spi.h> - #include <linux/spi/ads7846.h> - #include <linux/spi/pxa2xx_spi.h> -@@ -454,6 +455,7 @@ static void __init poodle_init(void) - pxa_set_i2c_info(NULL); - i2c_register_board_info(0, ARRAY_AND_SIZE(poodle_i2c_devices)); - poodle_init_spi(); -+ regulator_has_full_constraints(); - } - - static void __init fixup_poodle(struct tag *tags, char **cmdline, -diff --git a/arch/arm/mach-sa1100/pm.c b/arch/arm/mach-sa1100/pm.c -index 6645d1e..34853d5 100644 ---- a/arch/arm/mach-sa1100/pm.c -+++ b/arch/arm/mach-sa1100/pm.c -@@ -81,6 +81,7 @@ static int sa11x0_pm_enter(suspend_state_t state) - /* - * Ensure not to come back here if it wasn't intended - */ -+ RCSR = RCSR_SMR; - PSPR = 0; - - /* -diff --git a/arch/arm64/kernel/signal32.c b/arch/arm64/kernel/signal32.c -index b3fc9f5..7ed72dc 100644 ---- a/arch/arm64/kernel/signal32.c -+++ b/arch/arm64/kernel/signal32.c -@@ -151,8 +151,7 @@ int copy_siginfo_to_user32(compat_siginfo_t __user *to, const siginfo_t *from) - case __SI_TIMER: - err |= __put_user(from->si_tid, &to->si_tid); - err |= __put_user(from->si_overrun, &to->si_overrun); -- err |= __put_user((compat_uptr_t)(unsigned long)from->si_ptr, -- &to->si_ptr); -+ err |= __put_user(from->si_int, &to->si_int); - break; - case __SI_POLL: - err |= __put_user(from->si_band, &to->si_band); -@@ -181,7 +180,7 @@ int copy_siginfo_to_user32(compat_siginfo_t __user *to, const siginfo_t *from) - case __SI_MESGQ: /* But this is */ - err |= __put_user(from->si_pid, &to->si_pid); - err |= __put_user(from->si_uid, &to->si_uid); -- err |= __put_user((compat_uptr_t)(unsigned long)from->si_ptr, &to->si_ptr); -+ err |= __put_user(from->si_int, &to->si_int); - break; - default: /* this is just in case for now ... */ - err |= __put_user(from->si_pid, &to->si_pid); -diff --git a/arch/metag/include/asm/processor.h b/arch/metag/include/asm/processor.h -index a8a3747..eb2005b 100644 ---- a/arch/metag/include/asm/processor.h -+++ b/arch/metag/include/asm/processor.h -@@ -149,8 +149,8 @@ extern void exit_thread(void); - - unsigned long get_wchan(struct task_struct *p); - --#define KSTK_EIP(tsk) ((tsk)->thread.kernel_context->CurrPC) --#define KSTK_ESP(tsk) ((tsk)->thread.kernel_context->AX[0].U0) -+#define KSTK_EIP(tsk) (task_pt_regs(tsk)->ctx.CurrPC) -+#define KSTK_ESP(tsk) (task_pt_regs(tsk)->ctx.AX[0].U0) - - #define user_stack_pointer(regs) ((regs)->ctx.AX[0].U0) - -diff --git a/arch/mips/kernel/mips_ksyms.c b/arch/mips/kernel/mips_ksyms.c -index 6e58e97..cedeb56 100644 ---- a/arch/mips/kernel/mips_ksyms.c -+++ b/arch/mips/kernel/mips_ksyms.c -@@ -14,6 +14,7 @@ - #include <linux/mm.h> - #include <asm/uaccess.h> - #include <asm/ftrace.h> -+#include <asm/fpu.h> - - extern void *__bzero(void *__s, size_t __count); - extern long __strncpy_from_user_nocheck_asm(char *__to, -@@ -26,6 +27,13 @@ extern long __strnlen_user_nocheck_asm(const char *s); - extern long __strnlen_user_asm(const char *s); - - /* -+ * Core architecture code -+ */ -+#ifdef CONFIG_CPU_R4K_FPU -+EXPORT_SYMBOL_GPL(_save_fp); -+#endif -+ -+/* - * String functions - */ - EXPORT_SYMBOL(memset); -diff --git a/arch/mips/kvm/kvm_locore.S b/arch/mips/kvm/kvm_locore.S -index bbace09..03a2db5 100644 ---- a/arch/mips/kvm/kvm_locore.S -+++ b/arch/mips/kvm/kvm_locore.S -@@ -428,7 +428,7 @@ __kvm_mips_return_to_guest: - /* Setup status register for running guest in UM */ - .set at - or v1, v1, (ST0_EXL | KSU_USER | ST0_IE) -- and v1, v1, ~ST0_CU0 -+ and v1, v1, ~(ST0_CU0 | ST0_MX) - .set noat - mtc0 v1, CP0_STATUS - ehb -diff --git a/arch/mips/kvm/kvm_mips.c b/arch/mips/kvm/kvm_mips.c -index 3e0ff8d..897c605 100644 ---- a/arch/mips/kvm/kvm_mips.c -+++ b/arch/mips/kvm/kvm_mips.c -@@ -15,6 +15,7 @@ - #include <linux/vmalloc.h> - #include <linux/fs.h> - #include <linux/bootmem.h> -+#include <asm/fpu.h> - #include <asm/page.h> - #include <asm/cacheflush.h> - #include <asm/mmu_context.h> -@@ -418,11 +419,13 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run) - vcpu->mmio_needed = 0; - } - -+ lose_fpu(1); -+ -+ local_irq_disable(); - /* Check if we have any exceptions/interrupts pending */ - kvm_mips_deliver_interrupts(vcpu, - kvm_read_c0_guest_cause(vcpu->arch.cop0)); - -- local_irq_disable(); - kvm_guest_enter(); - - r = __kvm_mips_vcpu_run(run, vcpu); -@@ -1021,9 +1024,6 @@ void kvm_mips_set_c0_status(void) - { - uint32_t status = read_c0_status(); - -- if (cpu_has_fpu) -- status |= (ST0_CU1); -- - if (cpu_has_dsp) - status |= (ST0_MX); - -diff --git a/arch/powerpc/sysdev/axonram.c b/arch/powerpc/sysdev/axonram.c -index 47b6b9f..830edc8 100644 ---- a/arch/powerpc/sysdev/axonram.c -+++ b/arch/powerpc/sysdev/axonram.c -@@ -156,7 +156,7 @@ axon_ram_direct_access(struct block_device *device, sector_t sector, - } - - *kaddr = (void *)(bank->ph_addr + offset); -- *pfn = virt_to_phys(kaddr) >> PAGE_SHIFT; -+ *pfn = virt_to_phys(*kaddr) >> PAGE_SHIFT; - - return 0; - } -diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c -index fab97ad..1777f89 100644 ---- a/arch/x86/kvm/x86.c -+++ b/arch/x86/kvm/x86.c -@@ -1207,21 +1207,22 @@ void kvm_track_tsc_matching(struct kvm_vcpu *vcpu) - { - #ifdef CONFIG_X86_64 - bool vcpus_matched; -- bool do_request = false; - struct kvm_arch *ka = &vcpu->kvm->arch; - struct pvclock_gtod_data *gtod = &pvclock_gtod_data; - - vcpus_matched = (ka->nr_vcpus_matched_tsc + 1 == - atomic_read(&vcpu->kvm->online_vcpus)); - -- if (vcpus_matched && gtod->clock.vclock_mode == VCLOCK_TSC) -- if (!ka->use_master_clock) -- do_request = 1; -- -- if (!vcpus_matched && ka->use_master_clock) -- do_request = 1; -- -- if (do_request) -+ /* -+ * Once the masterclock is enabled, always perform request in -+ * order to update it. -+ * -+ * In order to enable masterclock, the host clocksource must be TSC -+ * and the vcpus need to have matched TSCs. When that happens, -+ * perform request to enable masterclock. -+ */ -+ if (ka->use_master_clock || -+ (gtod->clock.vclock_mode == VCLOCK_TSC && vcpus_matched)) - kvm_make_request(KVM_REQ_MASTERCLOCK_UPDATE, vcpu); - - trace_kvm_track_tsc(vcpu->vcpu_id, ka->nr_vcpus_matched_tsc, -diff --git a/arch/x86/mm/gup.c b/arch/x86/mm/gup.c -index 207d9aef..448ee89 100644 ---- a/arch/x86/mm/gup.c -+++ b/arch/x86/mm/gup.c -@@ -172,7 +172,7 @@ static int gup_pmd_range(pud_t pud, unsigned long addr, unsigned long end, - */ - if (pmd_none(pmd) || pmd_trans_splitting(pmd)) - return 0; -- if (unlikely(pmd_large(pmd))) { -+ if (unlikely(pmd_large(pmd) || !pmd_present(pmd))) { - /* - * NUMA hinting faults need to be handled in the GUP - * slowpath for accounting purposes and so that they -diff --git a/arch/x86/mm/hugetlbpage.c b/arch/x86/mm/hugetlbpage.c -index 8b977eb..006cc91 100644 ---- a/arch/x86/mm/hugetlbpage.c -+++ b/arch/x86/mm/hugetlbpage.c -@@ -66,9 +66,15 @@ follow_huge_addr(struct mm_struct *mm, unsigned long address, int write) - return ERR_PTR(-EINVAL); - } - -+/* -+ * pmd_huge() returns 1 if @pmd is hugetlb related entry, that is normal -+ * hugetlb entry or non-present (migration or hwpoisoned) hugetlb entry. -+ * Otherwise, returns 0. -+ */ - int pmd_huge(pmd_t pmd) - { -- return !!(pmd_val(pmd) & _PAGE_PSE); -+ return !pmd_none(pmd) && -+ (pmd_val(pmd) & (_PAGE_PRESENT|_PAGE_PSE)) != _PAGE_PRESENT; - } - - int pud_huge(pud_t pud) -diff --git a/arch/x86/mm/mmap.c b/arch/x86/mm/mmap.c -index 25e7e13..3601ff2 100644 ---- a/arch/x86/mm/mmap.c -+++ b/arch/x86/mm/mmap.c -@@ -35,12 +35,12 @@ struct __read_mostly va_alignment va_align = { - .flags = -1, - }; - --static unsigned int stack_maxrandom_size(void) -+static unsigned long stack_maxrandom_size(void) - { -- unsigned int max = 0; -+ unsigned long max = 0; - if ((current->flags & PF_RANDOMIZE) && - !(current->personality & ADDR_NO_RANDOMIZE)) { -- max = ((-1U) & STACK_RND_MASK) << PAGE_SHIFT; -+ max = ((-1UL) & STACK_RND_MASK) << PAGE_SHIFT; - } - - return max; -diff --git a/block/blk-throttle.c b/block/blk-throttle.c -index 1474c3a..1599878 100644 ---- a/block/blk-throttle.c -+++ b/block/blk-throttle.c -@@ -1292,6 +1292,9 @@ static u64 tg_prfill_cpu_rwstat(struct seq_file *sf, - struct blkg_rwstat rwstat = { }, tmp; - int i, cpu; - -+ if (tg->stats_cpu == NULL) -+ return 0; -+ - for_each_possible_cpu(cpu) { - struct tg_stats_cpu *sc = per_cpu_ptr(tg->stats_cpu, cpu); - -diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c -index 91c25f26..d9bba99 100644 ---- a/block/cfq-iosched.c -+++ b/block/cfq-iosched.c -@@ -3585,6 +3585,11 @@ retry: - - blkcg = bio_blkcg(bio); - cfqg = cfq_lookup_create_cfqg(cfqd, blkcg); -+ if (!cfqg) { -+ cfqq = &cfqd->oom_cfqq; -+ goto out; -+ } -+ - cfqq = cic_to_cfqq(cic, is_sync); - - /* -@@ -3621,7 +3626,7 @@ retry: - } else - cfqq = &cfqd->oom_cfqq; - } -- -+out: - if (new_cfqq) - kmem_cache_free(cfq_pool, new_cfqq); - -@@ -3651,12 +3656,17 @@ static struct cfq_queue * - cfq_get_queue(struct cfq_data *cfqd, bool is_sync, struct cfq_io_cq *cic, - struct bio *bio, gfp_t gfp_mask) - { -- const int ioprio_class = IOPRIO_PRIO_CLASS(cic->ioprio); -- const int ioprio = IOPRIO_PRIO_DATA(cic->ioprio); -+ int ioprio_class = IOPRIO_PRIO_CLASS(cic->ioprio); -+ int ioprio = IOPRIO_PRIO_DATA(cic->ioprio); - struct cfq_queue **async_cfqq = NULL; - struct cfq_queue *cfqq = NULL; - - if (!is_sync) { -+ if (!ioprio_valid(cic->ioprio)) { -+ struct task_struct *tsk = current; -+ ioprio = task_nice_ioprio(tsk); -+ ioprio_class = task_nice_ioclass(tsk); -+ } - async_cfqq = cfq_async_queue_prio(cfqd, ioprio_class, ioprio); - cfqq = *async_cfqq; - } -diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c -index b11949c..f667e37 100644 ---- a/drivers/bluetooth/ath3k.c -+++ b/drivers/bluetooth/ath3k.c -@@ -157,6 +157,8 @@ static const struct usb_device_id ath3k_blist_tbl[] = { - #define USB_REQ_DFU_DNLOAD 1 - #define BULK_SIZE 4096 - #define FW_HDR_SIZE 20 -+#define TIMEGAP_USEC_MIN 50 -+#define TIMEGAP_USEC_MAX 100 - - static int ath3k_load_firmware(struct usb_device *udev, - const struct firmware *firmware) -@@ -187,6 +189,9 @@ static int ath3k_load_firmware(struct usb_device *udev, - count -= 20; - - while (count) { -+ /* workaround the compatibility issue with xHCI controller*/ -+ usleep_range(TIMEGAP_USEC_MIN, TIMEGAP_USEC_MAX); -+ - size = min_t(uint, count, BULK_SIZE); - pipe = usb_sndbulkpipe(udev, 0x02); - memcpy(send_buf, firmware->data + sent, size); -@@ -283,6 +288,9 @@ static int ath3k_load_fwfile(struct usb_device *udev, - count -= size; - - while (count) { -+ /* workaround the compatibility issue with xHCI controller*/ -+ usleep_range(TIMEGAP_USEC_MIN, TIMEGAP_USEC_MAX); -+ - size = min_t(uint, count, BULK_SIZE); - pipe = usb_sndbulkpipe(udev, 0x02); - -diff --git a/drivers/char/tpm/tpm-interface.c b/drivers/char/tpm/tpm-interface.c -index 6af1700..cfb9089 100644 ---- a/drivers/char/tpm/tpm-interface.c -+++ b/drivers/char/tpm/tpm-interface.c -@@ -1122,7 +1122,7 @@ struct tpm_chip *tpm_register_hardware(struct device *dev, - - /* Make chip available */ - spin_lock(&driver_lock); -- list_add_rcu(&chip->list, &tpm_chip_list); -+ list_add_tail_rcu(&chip->list, &tpm_chip_list); - spin_unlock(&driver_lock); - - return chip; -diff --git a/drivers/char/tpm/tpm_i2c_atmel.c b/drivers/char/tpm/tpm_i2c_atmel.c -index 7727292..503a85a 100644 ---- a/drivers/char/tpm/tpm_i2c_atmel.c -+++ b/drivers/char/tpm/tpm_i2c_atmel.c -@@ -168,6 +168,10 @@ static int i2c_atmel_probe(struct i2c_client *client, - - chip->vendor.priv = devm_kzalloc(dev, sizeof(struct priv_data), - GFP_KERNEL); -+ if (!chip->vendor.priv) { -+ rc = -ENOMEM; -+ goto out_err; -+ } - - /* Default timeouts */ - chip->vendor.timeout_a = msecs_to_jiffies(TPM_I2C_SHORT_TIMEOUT); -diff --git a/drivers/char/tpm/tpm_i2c_nuvoton.c b/drivers/char/tpm/tpm_i2c_nuvoton.c -index 7b158ef..23c7b13 100644 ---- a/drivers/char/tpm/tpm_i2c_nuvoton.c -+++ b/drivers/char/tpm/tpm_i2c_nuvoton.c -@@ -538,6 +538,11 @@ static int i2c_nuvoton_probe(struct i2c_client *client, - - chip->vendor.priv = devm_kzalloc(dev, sizeof(struct priv_data), - GFP_KERNEL); -+ if (!chip->vendor.priv) { -+ rc = -ENOMEM; -+ goto out_err; -+ } -+ - init_waitqueue_head(&chip->vendor.read_queue); - init_waitqueue_head(&chip->vendor.int_queue); - -diff --git a/drivers/char/tpm/tpm_i2c_stm_st33.c b/drivers/char/tpm/tpm_i2c_stm_st33.c -index be9af2e..576d111 100644 ---- a/drivers/char/tpm/tpm_i2c_stm_st33.c -+++ b/drivers/char/tpm/tpm_i2c_stm_st33.c -@@ -488,7 +488,7 @@ static int tpm_stm_i2c_send(struct tpm_chip *chip, unsigned char *buf, - if (burstcnt < 0) - return burstcnt; - size = min_t(int, len - i - 1, burstcnt); -- ret = I2C_WRITE_DATA(client, TPM_DATA_FIFO, buf, size); -+ ret = I2C_WRITE_DATA(client, TPM_DATA_FIFO, buf + i, size); - if (ret < 0) - goto out_err; - -diff --git a/drivers/char/tpm/tpm_ibmvtpm.c b/drivers/char/tpm/tpm_ibmvtpm.c -index af74c57..eff9d58 100644 ---- a/drivers/char/tpm/tpm_ibmvtpm.c -+++ b/drivers/char/tpm/tpm_ibmvtpm.c -@@ -148,7 +148,8 @@ static int tpm_ibmvtpm_send(struct tpm_chip *chip, u8 *buf, size_t count) - crq.len = (u16)count; - crq.data = ibmvtpm->rtce_dma_handle; - -- rc = ibmvtpm_send_crq(ibmvtpm->vdev, word[0], word[1]); -+ rc = ibmvtpm_send_crq(ibmvtpm->vdev, cpu_to_be64(word[0]), -+ cpu_to_be64(word[1])); - if (rc != H_SUCCESS) { - dev_err(ibmvtpm->dev, "tpm_ibmvtpm_send failed rc=%d\n", rc); - rc = 0; -@@ -186,7 +187,8 @@ static int ibmvtpm_crq_get_rtce_size(struct ibmvtpm_dev *ibmvtpm) - crq.valid = (u8)IBMVTPM_VALID_CMD; - crq.msg = (u8)VTPM_GET_RTCE_BUFFER_SIZE; - -- rc = ibmvtpm_send_crq(ibmvtpm->vdev, buf[0], buf[1]); -+ rc = ibmvtpm_send_crq(ibmvtpm->vdev, cpu_to_be64(buf[0]), -+ cpu_to_be64(buf[1])); - if (rc != H_SUCCESS) - dev_err(ibmvtpm->dev, - "ibmvtpm_crq_get_rtce_size failed rc=%d\n", rc); -@@ -212,7 +214,8 @@ static int ibmvtpm_crq_get_version(struct ibmvtpm_dev *ibmvtpm) - crq.valid = (u8)IBMVTPM_VALID_CMD; - crq.msg = (u8)VTPM_GET_VERSION; - -- rc = ibmvtpm_send_crq(ibmvtpm->vdev, buf[0], buf[1]); -+ rc = ibmvtpm_send_crq(ibmvtpm->vdev, cpu_to_be64(buf[0]), -+ cpu_to_be64(buf[1])); - if (rc != H_SUCCESS) - dev_err(ibmvtpm->dev, - "ibmvtpm_crq_get_version failed rc=%d\n", rc); -@@ -307,6 +310,14 @@ static int tpm_ibmvtpm_remove(struct vio_dev *vdev) - static unsigned long tpm_ibmvtpm_get_desired_dma(struct vio_dev *vdev) - { - struct ibmvtpm_dev *ibmvtpm = ibmvtpm_get_data(&vdev->dev); -+ -+ /* ibmvtpm initializes at probe time, so the data we are -+ * asking for may not be set yet. Estimate that 4K required -+ * for TCE-mapped buffer in addition to CRQ. -+ */ -+ if (!ibmvtpm) -+ return CRQ_RES_BUF_SIZE + PAGE_SIZE; -+ - return CRQ_RES_BUF_SIZE + ibmvtpm->rtce_size; - } - -@@ -327,7 +338,8 @@ static int tpm_ibmvtpm_suspend(struct device *dev) - crq.valid = (u8)IBMVTPM_VALID_CMD; - crq.msg = (u8)VTPM_PREPARE_TO_SUSPEND; - -- rc = ibmvtpm_send_crq(ibmvtpm->vdev, buf[0], buf[1]); -+ rc = ibmvtpm_send_crq(ibmvtpm->vdev, cpu_to_be64(buf[0]), -+ cpu_to_be64(buf[1])); - if (rc != H_SUCCESS) - dev_err(ibmvtpm->dev, - "tpm_ibmvtpm_suspend failed rc=%d\n", rc); -@@ -472,11 +484,11 @@ static void ibmvtpm_crq_process(struct ibmvtpm_crq *crq, - case IBMVTPM_VALID_CMD: - switch (crq->msg) { - case VTPM_GET_RTCE_BUFFER_SIZE_RES: -- if (crq->len <= 0) { -+ if (be16_to_cpu(crq->len) <= 0) { - dev_err(ibmvtpm->dev, "Invalid rtce size\n"); - return; - } -- ibmvtpm->rtce_size = crq->len; -+ ibmvtpm->rtce_size = be16_to_cpu(crq->len); - ibmvtpm->rtce_buf = kmalloc(ibmvtpm->rtce_size, - GFP_KERNEL); - if (!ibmvtpm->rtce_buf) { -@@ -497,11 +509,11 @@ static void ibmvtpm_crq_process(struct ibmvtpm_crq *crq, - - return; - case VTPM_GET_VERSION_RES: -- ibmvtpm->vtpm_version = crq->data; -+ ibmvtpm->vtpm_version = be32_to_cpu(crq->data); - return; - case VTPM_TPM_COMMAND_RES: - /* len of the data in rtce buffer */ -- ibmvtpm->res_len = crq->len; -+ ibmvtpm->res_len = be16_to_cpu(crq->len); - wake_up_interruptible(&ibmvtpm->wq); - return; - default: -diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c -index 2c46734..51350cd 100644 ---- a/drivers/char/tpm/tpm_tis.c -+++ b/drivers/char/tpm/tpm_tis.c -@@ -75,6 +75,10 @@ enum tis_defaults { - #define TPM_DID_VID(l) (0x0F00 | ((l) << 12)) - #define TPM_RID(l) (0x0F04 | ((l) << 12)) - -+struct priv_data { -+ bool irq_tested; -+}; -+ - static LIST_HEAD(tis_chips); - static DEFINE_MUTEX(tis_lock); - -@@ -338,12 +342,27 @@ out_err: - return rc; - } - -+static void disable_interrupts(struct tpm_chip *chip) -+{ -+ u32 intmask; -+ -+ intmask = -+ ioread32(chip->vendor.iobase + -+ TPM_INT_ENABLE(chip->vendor.locality)); -+ intmask &= ~TPM_GLOBAL_INT_ENABLE; -+ iowrite32(intmask, -+ chip->vendor.iobase + -+ TPM_INT_ENABLE(chip->vendor.locality)); -+ free_irq(chip->vendor.irq, chip); -+ chip->vendor.irq = 0; -+} -+ - /* - * If interrupts are used (signaled by an irq set in the vendor structure) - * tpm.c can skip polling for the data to be available as the interrupt is - * waited for here - */ --static int tpm_tis_send(struct tpm_chip *chip, u8 *buf, size_t len) -+static int tpm_tis_send_main(struct tpm_chip *chip, u8 *buf, size_t len) - { - int rc; - u32 ordinal; -@@ -373,6 +392,30 @@ out_err: - return rc; - } - -+static int tpm_tis_send(struct tpm_chip *chip, u8 *buf, size_t len) -+{ -+ int rc, irq; -+ struct priv_data *priv = chip->vendor.priv; -+ -+ if (!chip->vendor.irq || priv->irq_tested) -+ return tpm_tis_send_main(chip, buf, len); -+ -+ /* Verify receipt of the expected IRQ */ -+ irq = chip->vendor.irq; -+ chip->vendor.irq = 0; -+ rc = tpm_tis_send_main(chip, buf, len); -+ chip->vendor.irq = irq; -+ if (!priv->irq_tested) -+ msleep(1); -+ if (!priv->irq_tested) { -+ disable_interrupts(chip); -+ dev_err(chip->dev, -+ FW_BUG "TPM interrupt not working, polling instead\n"); -+ } -+ priv->irq_tested = true; -+ return rc; -+} -+ - struct tis_vendor_timeout_override { - u32 did_vid; - unsigned long timeout_us[4]; -@@ -505,6 +548,7 @@ static irqreturn_t tis_int_handler(int dummy, void *dev_id) - if (interrupt == 0) - return IRQ_NONE; - -+ ((struct priv_data *)chip->vendor.priv)->irq_tested = true; - if (interrupt & TPM_INTF_DATA_AVAIL_INT) - wake_up_interruptible(&chip->vendor.read_queue); - if (interrupt & TPM_INTF_LOCALITY_CHANGE_INT) -@@ -534,9 +578,14 @@ static int tpm_tis_init(struct device *dev, resource_size_t start, - u32 vendor, intfcaps, intmask; - int rc, i, irq_s, irq_e, probe; - struct tpm_chip *chip; -+ struct priv_data *priv; - -+ priv = devm_kzalloc(dev, sizeof(struct priv_data), GFP_KERNEL); -+ if (priv == NULL) -+ return -ENOMEM; - if (!(chip = tpm_register_hardware(dev, &tpm_tis))) - return -ENODEV; -+ chip->vendor.priv = priv; - - chip->vendor.iobase = ioremap(start, len); - if (!chip->vendor.iobase) { -@@ -605,19 +654,6 @@ static int tpm_tis_init(struct device *dev, resource_size_t start, - if (intfcaps & TPM_INTF_DATA_AVAIL_INT) - dev_dbg(dev, "\tData Avail Int Support\n"); - -- /* get the timeouts before testing for irqs */ -- if (tpm_get_timeouts(chip)) { -- dev_err(dev, "Could not get TPM timeouts and durations\n"); -- rc = -ENODEV; -- goto out_err; -- } -- -- if (tpm_do_selftest(chip)) { -- dev_err(dev, "TPM self test failed\n"); -- rc = -ENODEV; -- goto out_err; -- } -- - /* INTERRUPT Setup */ - init_waitqueue_head(&chip->vendor.read_queue); - init_waitqueue_head(&chip->vendor.int_queue); -@@ -719,6 +755,18 @@ static int tpm_tis_init(struct device *dev, resource_size_t start, - } - } - -+ if (tpm_get_timeouts(chip)) { -+ dev_err(dev, "Could not get TPM timeouts and durations\n"); -+ rc = -ENODEV; -+ goto out_err; -+ } -+ -+ if (tpm_do_selftest(chip)) { -+ dev_err(dev, "TPM self test failed\n"); -+ rc = -ENODEV; -+ goto out_err; -+ } -+ - INIT_LIST_HEAD(&chip->vendor.list); - mutex_lock(&tis_lock); - list_add(&chip->vendor.list, &tis_chips); -diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c -index 4854f81..ef3b8ad 100644 ---- a/drivers/cpufreq/cpufreq.c -+++ b/drivers/cpufreq/cpufreq.c -@@ -1365,9 +1365,10 @@ static int __cpufreq_remove_dev_finish(struct device *dev, - unsigned long flags; - struct cpufreq_policy *policy; - -- read_lock_irqsave(&cpufreq_driver_lock, flags); -+ write_lock_irqsave(&cpufreq_driver_lock, flags); - policy = per_cpu(cpufreq_cpu_data, cpu); -- read_unlock_irqrestore(&cpufreq_driver_lock, flags); -+ per_cpu(cpufreq_cpu_data, cpu) = NULL; -+ write_unlock_irqrestore(&cpufreq_driver_lock, flags); - - if (!policy) { - pr_debug("%s: No cpu_data found\n", __func__); -@@ -1422,7 +1423,6 @@ static int __cpufreq_remove_dev_finish(struct device *dev, - } - } - -- per_cpu(cpufreq_cpu_data, cpu) = NULL; - return 0; - } - -diff --git a/drivers/cpufreq/s3c2416-cpufreq.c b/drivers/cpufreq/s3c2416-cpufreq.c -index 826b8be..82cef00 100644 ---- a/drivers/cpufreq/s3c2416-cpufreq.c -+++ b/drivers/cpufreq/s3c2416-cpufreq.c -@@ -263,7 +263,7 @@ out: - } - - #ifdef CONFIG_ARM_S3C2416_CPUFREQ_VCORESCALE --static void __init s3c2416_cpufreq_cfg_regulator(struct s3c2416_data *s3c_freq) -+static void s3c2416_cpufreq_cfg_regulator(struct s3c2416_data *s3c_freq) - { - int count, v, i, found; - struct cpufreq_frequency_table *freq; -@@ -335,7 +335,7 @@ static struct notifier_block s3c2416_cpufreq_reboot_notifier = { - .notifier_call = s3c2416_cpufreq_reboot_notifier_evt, - }; - --static int __init s3c2416_cpufreq_driver_init(struct cpufreq_policy *policy) -+static int s3c2416_cpufreq_driver_init(struct cpufreq_policy *policy) - { - struct s3c2416_data *s3c_freq = &s3c2416_cpufreq; - struct cpufreq_frequency_table *freq; -diff --git a/drivers/cpufreq/s3c24xx-cpufreq.c b/drivers/cpufreq/s3c24xx-cpufreq.c -index 2506974..0eb5b40 100644 ---- a/drivers/cpufreq/s3c24xx-cpufreq.c -+++ b/drivers/cpufreq/s3c24xx-cpufreq.c -@@ -454,7 +454,7 @@ static struct cpufreq_driver s3c24xx_driver = { - }; - - --int __init s3c_cpufreq_register(struct s3c_cpufreq_info *info) -+int s3c_cpufreq_register(struct s3c_cpufreq_info *info) - { - if (!info || !info->name) { - printk(KERN_ERR "%s: failed to pass valid information\n", -diff --git a/drivers/cpufreq/speedstep-lib.c b/drivers/cpufreq/speedstep-lib.c -index 7047821..4ab7a21 100644 ---- a/drivers/cpufreq/speedstep-lib.c -+++ b/drivers/cpufreq/speedstep-lib.c -@@ -400,6 +400,7 @@ unsigned int speedstep_get_freqs(enum speedstep_processor processor, - - pr_debug("previous speed is %u\n", prev_speed); - -+ preempt_disable(); - local_irq_save(flags); - - /* switch to low state */ -@@ -464,6 +465,8 @@ unsigned int speedstep_get_freqs(enum speedstep_processor processor, - - out: - local_irq_restore(flags); -+ preempt_enable(); -+ - return ret; - } - EXPORT_SYMBOL_GPL(speedstep_get_freqs); -diff --git a/drivers/cpufreq/speedstep-smi.c b/drivers/cpufreq/speedstep-smi.c -index 998c17b..b52d8af 100644 ---- a/drivers/cpufreq/speedstep-smi.c -+++ b/drivers/cpufreq/speedstep-smi.c -@@ -156,6 +156,7 @@ static void speedstep_set_state(unsigned int state) - return; - - /* Disable IRQs */ -+ preempt_disable(); - local_irq_save(flags); - - command = (smi_sig & 0xffffff00) | (smi_cmd & 0xff); -@@ -166,9 +167,19 @@ static void speedstep_set_state(unsigned int state) - - do { - if (retry) { -+ /* -+ * We need to enable interrupts, otherwise the blockage -+ * won't resolve. -+ * -+ * We disable preemption so that other processes don't -+ * run. If other processes were running, they could -+ * submit more DMA requests, making the blockage worse. -+ */ - pr_debug("retry %u, previous result %u, waiting...\n", - retry, result); -+ local_irq_enable(); - mdelay(retry * 50); -+ local_irq_disable(); - } - retry++; - __asm__ __volatile__( -@@ -185,6 +196,7 @@ static void speedstep_set_state(unsigned int state) - - /* enable IRQs */ - local_irq_restore(flags); -+ preempt_enable(); - - if (new_state == state) - pr_debug("change to %u MHz succeeded after %u tries " -diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c -index 98e14ee..278603c 100644 ---- a/drivers/edac/amd64_edac.c -+++ b/drivers/edac/amd64_edac.c -@@ -2006,14 +2006,20 @@ static void __log_bus_error(struct mem_ctl_info *mci, struct err_info *err, - - static inline void decode_bus_error(int node_id, struct mce *m) - { -- struct mem_ctl_info *mci = mcis[node_id]; -- struct amd64_pvt *pvt = mci->pvt_info; -+ struct mem_ctl_info *mci; -+ struct amd64_pvt *pvt; - u8 ecc_type = (m->status >> 45) & 0x3; - u8 xec = XEC(m->status, 0x1f); - u16 ec = EC(m->status); - u64 sys_addr; - struct err_info err; - -+ mci = edac_mc_find(node_id); -+ if (!mci) -+ return; -+ -+ pvt = mci->pvt_info; -+ - /* Bail out early if this was an 'observed' error */ - if (PP(ec) == NBSL_PP_OBS) - return; -diff --git a/drivers/gpio/gpio-tps65912.c b/drivers/gpio/gpio-tps65912.c -index 59ee486..6005d26 100644 ---- a/drivers/gpio/gpio-tps65912.c -+++ b/drivers/gpio/gpio-tps65912.c -@@ -26,9 +26,12 @@ struct tps65912_gpio_data { - struct gpio_chip gpio_chip; - }; - -+#define to_tgd(gc) container_of(gc, struct tps65912_gpio_data, gpio_chip) -+ - static int tps65912_gpio_get(struct gpio_chip *gc, unsigned offset) - { -- struct tps65912 *tps65912 = container_of(gc, struct tps65912, gpio); -+ struct tps65912_gpio_data *tps65912_gpio = to_tgd(gc); -+ struct tps65912 *tps65912 = tps65912_gpio->tps65912; - int val; - - val = tps65912_reg_read(tps65912, TPS65912_GPIO1 + offset); -@@ -42,7 +45,8 @@ static int tps65912_gpio_get(struct gpio_chip *gc, unsigned offset) - static void tps65912_gpio_set(struct gpio_chip *gc, unsigned offset, - int value) - { -- struct tps65912 *tps65912 = container_of(gc, struct tps65912, gpio); -+ struct tps65912_gpio_data *tps65912_gpio = to_tgd(gc); -+ struct tps65912 *tps65912 = tps65912_gpio->tps65912; - - if (value) - tps65912_set_bits(tps65912, TPS65912_GPIO1 + offset, -@@ -55,7 +59,8 @@ static void tps65912_gpio_set(struct gpio_chip *gc, unsigned offset, - static int tps65912_gpio_output(struct gpio_chip *gc, unsigned offset, - int value) - { -- struct tps65912 *tps65912 = container_of(gc, struct tps65912, gpio); -+ struct tps65912_gpio_data *tps65912_gpio = to_tgd(gc); -+ struct tps65912 *tps65912 = tps65912_gpio->tps65912; - - /* Set the initial value */ - tps65912_gpio_set(gc, offset, value); -@@ -66,7 +71,8 @@ static int tps65912_gpio_output(struct gpio_chip *gc, unsigned offset, - - static int tps65912_gpio_input(struct gpio_chip *gc, unsigned offset) - { -- struct tps65912 *tps65912 = container_of(gc, struct tps65912, gpio); -+ struct tps65912_gpio_data *tps65912_gpio = to_tgd(gc); -+ struct tps65912 *tps65912 = tps65912_gpio->tps65912; - - return tps65912_clear_bits(tps65912, TPS65912_GPIO1 + offset, - GPIO_CFG_MASK); -diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c -index 74ed17d..d26028c 100644 ---- a/drivers/gpio/gpiolib-of.c -+++ b/drivers/gpio/gpiolib-of.c -@@ -45,12 +45,13 @@ static int of_gpiochip_find_and_xlate(struct gpio_chip *gc, void *data) - - ret = gc->of_xlate(gc, &gg_data->gpiospec, gg_data->flags); - if (ret < 0) { -- /* We've found the gpio chip, but the translation failed. -- * Return true to stop looking and return the translation -- * error via out_gpio -+ /* We've found a gpio chip, but the translation failed. -+ * Store translation error in out_gpio. -+ * Return false to keep looking, as more than one gpio chip -+ * could be registered per of-node. - */ - gg_data->out_gpio = ERR_PTR(ret); -- return true; -+ return false; - } - - gg_data->out_gpio = gpio_to_desc(ret + gc->base); -diff --git a/drivers/hid/i2c-hid/i2c-hid.c b/drivers/hid/i2c-hid/i2c-hid.c -index 6e5d8fe..17be889 100644 ---- a/drivers/hid/i2c-hid/i2c-hid.c -+++ b/drivers/hid/i2c-hid/i2c-hid.c -@@ -356,7 +356,10 @@ static int i2c_hid_hwreset(struct i2c_client *client) - static void i2c_hid_get_input(struct i2c_hid *ihid) - { - int ret, ret_size; -- int size = ihid->bufsize; -+ int size = le16_to_cpu(ihid->hdesc.wMaxInputLength); -+ -+ if (size > ihid->bufsize) -+ size = ihid->bufsize; - - ret = i2c_master_recv(ihid->client, ihid->inbuf, size); - if (ret != size) { -diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c -index 55de4f6..b96ee9d 100644 ---- a/drivers/md/raid1.c -+++ b/drivers/md/raid1.c -@@ -561,7 +561,7 @@ static int read_balance(struct r1conf *conf, struct r1bio *r1_bio, int *max_sect - if (test_bit(WriteMostly, &rdev->flags)) { - /* Don't balance among write-mostly, just - * use the first as a last resort */ -- if (best_disk < 0) { -+ if (best_dist_disk < 0) { - if (is_badblock(rdev, this_sector, sectors, - &first_bad, &bad_sectors)) { - if (first_bad < this_sector) -@@ -570,7 +570,8 @@ static int read_balance(struct r1conf *conf, struct r1bio *r1_bio, int *max_sect - best_good_sectors = first_bad - this_sector; - } else - best_good_sectors = sectors; -- best_disk = disk; -+ best_dist_disk = disk; -+ best_pending_disk = disk; - } - continue; - } -diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c -index 175584a..3545faf 100644 ---- a/drivers/md/raid5.c -+++ b/drivers/md/raid5.c -@@ -3071,7 +3071,8 @@ static void handle_stripe_dirtying(struct r5conf *conf, - * generate correct data from the parity. - */ - if (conf->max_degraded == 2 || -- (recovery_cp < MaxSector && sh->sector >= recovery_cp)) { -+ (recovery_cp < MaxSector && sh->sector >= recovery_cp && -+ s->failed == 0)) { - /* Calculate the real rcw later - for now make it - * look like rcw is cheaper - */ -diff --git a/drivers/media/usb/dvb-usb-v2/lmedm04.c b/drivers/media/usb/dvb-usb-v2/lmedm04.c -index f674dc0..d2a4e6d 100644 ---- a/drivers/media/usb/dvb-usb-v2/lmedm04.c -+++ b/drivers/media/usb/dvb-usb-v2/lmedm04.c -@@ -350,6 +350,7 @@ static int lme2510_int_read(struct dvb_usb_adapter *adap) - { - struct dvb_usb_device *d = adap_to_d(adap); - struct lme2510_state *lme_int = adap_to_priv(adap); -+ struct usb_host_endpoint *ep; - - lme_int->lme_urb = usb_alloc_urb(0, GFP_ATOMIC); - -@@ -371,6 +372,12 @@ static int lme2510_int_read(struct dvb_usb_adapter *adap) - adap, - 8); - -+ /* Quirk of pipe reporting PIPE_BULK but behaves as interrupt */ -+ ep = usb_pipe_endpoint(d->udev, lme_int->lme_urb->pipe); -+ -+ if (usb_endpoint_type(&ep->desc) == USB_ENDPOINT_XFER_BULK) -+ lme_int->lme_urb->pipe = usb_rcvbulkpipe(d->udev, 0xa), -+ - lme_int->lme_urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; - - usb_submit_urb(lme_int->lme_urb, GFP_ATOMIC); -diff --git a/drivers/media/usb/em28xx/em28xx-audio.c b/drivers/media/usb/em28xx/em28xx-audio.c -index dfdfa77..c39f7d3 100644 ---- a/drivers/media/usb/em28xx/em28xx-audio.c -+++ b/drivers/media/usb/em28xx/em28xx-audio.c -@@ -814,7 +814,7 @@ static int em28xx_audio_urb_init(struct em28xx *dev) - if (urb_size > ep_size * npackets) - npackets = DIV_ROUND_UP(urb_size, ep_size); - -- em28xx_info("Number of URBs: %d, with %d packets and %d size", -+ em28xx_info("Number of URBs: %d, with %d packets and %d size\n", - num_urb, npackets, urb_size); - - /* Estimate the bytes per period */ -@@ -974,7 +974,7 @@ static int em28xx_audio_fini(struct em28xx *dev) - return 0; - } - -- em28xx_info("Closing audio extension"); -+ em28xx_info("Closing audio extension\n"); - - if (dev->adev.sndcard) { - snd_card_disconnect(dev->adev.sndcard); -diff --git a/drivers/media/usb/em28xx/em28xx-dvb.c b/drivers/media/usb/em28xx/em28xx-dvb.c -index 1373cfa..ec2ebe9 100644 ---- a/drivers/media/usb/em28xx/em28xx-dvb.c -+++ b/drivers/media/usb/em28xx/em28xx-dvb.c -@@ -1468,7 +1468,7 @@ static int em28xx_dvb_fini(struct em28xx *dev) - return 0; - } - -- em28xx_info("Closing DVB extension"); -+ em28xx_info("Closing DVB extension\n"); - - if (dev->dvb) { - struct em28xx_dvb *dvb = dev->dvb; -diff --git a/drivers/media/usb/em28xx/em28xx-input.c b/drivers/media/usb/em28xx/em28xx-input.c -index 18f65d8..dd59c00 100644 ---- a/drivers/media/usb/em28xx/em28xx-input.c -+++ b/drivers/media/usb/em28xx/em28xx-input.c -@@ -810,7 +810,7 @@ static int em28xx_ir_fini(struct em28xx *dev) - return 0; - } - -- em28xx_info("Closing input extension"); -+ em28xx_info("Closing input extension\n"); - - em28xx_shutdown_buttons(dev); - -diff --git a/drivers/media/usb/em28xx/em28xx-video.c b/drivers/media/usb/em28xx/em28xx-video.c -index e24ee08..0e8d085 100644 ---- a/drivers/media/usb/em28xx/em28xx-video.c -+++ b/drivers/media/usb/em28xx/em28xx-video.c -@@ -1900,7 +1900,7 @@ static int em28xx_v4l2_fini(struct em28xx *dev) - return 0; - } - -- em28xx_info("Closing video extension"); -+ em28xx_info("Closing video extension\n"); - - mutex_lock(&dev->lock); - -diff --git a/drivers/mmc/host/sdhci-pxav3.c b/drivers/mmc/host/sdhci-pxav3.c -index 793dacd..561c6b4 100644 ---- a/drivers/mmc/host/sdhci-pxav3.c -+++ b/drivers/mmc/host/sdhci-pxav3.c -@@ -201,8 +201,8 @@ static struct sdhci_pxa_platdata *pxav3_get_mmc_pdata(struct device *dev) - if (!pdata) - return NULL; - -- of_property_read_u32(np, "mrvl,clk-delay-cycles", &clk_delay_cycles); -- if (clk_delay_cycles > 0) -+ if (!of_property_read_u32(np, "mrvl,clk-delay-cycles", -+ &clk_delay_cycles)) - pdata->clk_delay_cycles = clk_delay_cycles; - - return pdata; -diff --git a/drivers/net/wireless/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/iwlwifi/mvm/mac80211.c -index d06414e..a041746 100644 ---- a/drivers/net/wireless/iwlwifi/mvm/mac80211.c -+++ b/drivers/net/wireless/iwlwifi/mvm/mac80211.c -@@ -410,9 +410,6 @@ static void iwl_mvm_cleanup_iterator(void *data, u8 *mac, - mvmvif->uploaded = false; - mvmvif->ap_sta_id = IWL_MVM_STATION_COUNT; - -- /* does this make sense at all? */ -- mvmvif->color++; -- - spin_lock_bh(&mvm->time_event_lock); - iwl_mvm_te_clear_data(mvm, &mvmvif->time_event_data); - spin_unlock_bh(&mvm->time_event_lock); -@@ -597,7 +594,7 @@ static int iwl_mvm_mac_add_interface(struct ieee80211_hw *hw, - - ret = iwl_mvm_mac_ctxt_add(mvm, vif); - if (ret) -- goto out_release; -+ goto out_remove_mac; - - iwl_mvm_power_disable(mvm, vif); - -diff --git a/drivers/net/wireless/iwlwifi/mvm/tx.c b/drivers/net/wireless/iwlwifi/mvm/tx.c -index 76ee486..4efcb28 100644 ---- a/drivers/net/wireless/iwlwifi/mvm/tx.c -+++ b/drivers/net/wireless/iwlwifi/mvm/tx.c -@@ -835,6 +835,11 @@ int iwl_mvm_rx_ba_notif(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb, - sta_id = ba_notif->sta_id; - tid = ba_notif->tid; - -+ if (WARN_ONCE(sta_id >= IWL_MVM_STATION_COUNT || -+ tid >= IWL_MAX_TID_COUNT, -+ "sta_id %d tid %d", sta_id, tid)) -+ return 0; -+ - rcu_read_lock(); - - sta = rcu_dereference(mvm->fw_id_to_mac_id[sta_id]); -diff --git a/drivers/net/wireless/iwlwifi/pcie/tx.c b/drivers/net/wireless/iwlwifi/pcie/tx.c -index 3d54900..52427fb 100644 ---- a/drivers/net/wireless/iwlwifi/pcie/tx.c -+++ b/drivers/net/wireless/iwlwifi/pcie/tx.c -@@ -729,7 +729,12 @@ void iwl_trans_pcie_tx_reset(struct iwl_trans *trans) - iwl_write_direct32(trans, FH_KW_MEM_ADDR_REG, - trans_pcie->kw.dma >> 4); - -- iwl_pcie_tx_start(trans, trans_pcie->scd_base_addr); -+ /* -+ * Send 0 as the scd_base_addr since the device may have be reset -+ * while we were in WoWLAN in which case SCD_SRAM_BASE_ADDR will -+ * contain garbage. -+ */ -+ iwl_pcie_tx_start(trans, 0); - } - - /* -diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c -index 25f0bc6..7f41551 100644 ---- a/drivers/pci/pci-driver.c -+++ b/drivers/pci/pci-driver.c -@@ -1324,7 +1324,7 @@ static int pci_uevent(struct device *dev, struct kobj_uevent_env *env) - if (add_uevent_var(env, "PCI_SLOT_NAME=%s", pci_name(pdev))) - return -ENOMEM; - -- if (add_uevent_var(env, "MODALIAS=pci:v%08Xd%08Xsv%08Xsd%08Xbc%02Xsc%02Xi%02x", -+ if (add_uevent_var(env, "MODALIAS=pci:v%08Xd%08Xsv%08Xsd%08Xbc%02Xsc%02Xi%02X", - pdev->vendor, pdev->device, - pdev->subsystem_vendor, pdev->subsystem_device, - (u8)(pdev->class >> 16), (u8)(pdev->class >> 8), -diff --git a/drivers/pci/rom.c b/drivers/pci/rom.c -index 5d59572..5510c88 100644 ---- a/drivers/pci/rom.c -+++ b/drivers/pci/rom.c -@@ -69,6 +69,7 @@ size_t pci_get_rom_size(struct pci_dev *pdev, void __iomem *rom, size_t size) - { - void __iomem *image; - int last_image; -+ unsigned length; - - image = rom; - do { -@@ -91,9 +92,9 @@ size_t pci_get_rom_size(struct pci_dev *pdev, void __iomem *rom, size_t size) - if (readb(pds + 3) != 'R') - break; - last_image = readb(pds + 21) & 0x80; -- /* this length is reliable */ -- image += readw(pds + 16) * 512; -- } while (!last_image); -+ length = readw(pds + 16); -+ image += length * 512; -+ } while (length && !last_image); - - /* never return a size larger than the PCI resource window */ - /* there are known ROMs that get the size wrong */ -diff --git a/drivers/power/88pm860x_charger.c b/drivers/power/88pm860x_charger.c -index de029bb..5ccca87 100644 ---- a/drivers/power/88pm860x_charger.c -+++ b/drivers/power/88pm860x_charger.c -@@ -711,6 +711,7 @@ static int pm860x_charger_probe(struct platform_device *pdev) - return 0; - - out_irq: -+ power_supply_unregister(&info->usb); - while (--i >= 0) - free_irq(info->irq[i], info); - out: -diff --git a/drivers/power/bq24190_charger.c b/drivers/power/bq24190_charger.c -index ad3ff8f..e4c95e1 100644 ---- a/drivers/power/bq24190_charger.c -+++ b/drivers/power/bq24190_charger.c -@@ -929,7 +929,7 @@ static void bq24190_charger_init(struct power_supply *charger) - charger->properties = bq24190_charger_properties; - charger->num_properties = ARRAY_SIZE(bq24190_charger_properties); - charger->supplied_to = bq24190_charger_supplied_to; -- charger->num_supplies = ARRAY_SIZE(bq24190_charger_supplied_to); -+ charger->num_supplicants = ARRAY_SIZE(bq24190_charger_supplied_to); - charger->get_property = bq24190_charger_get_property; - charger->set_property = bq24190_charger_set_property; - charger->property_is_writeable = bq24190_charger_property_is_writeable; -diff --git a/drivers/power/gpio-charger.c b/drivers/power/gpio-charger.c -index a0024b2..86e03c6 100644 ---- a/drivers/power/gpio-charger.c -+++ b/drivers/power/gpio-charger.c -@@ -168,7 +168,7 @@ static int gpio_charger_suspend(struct device *dev) - - if (device_may_wakeup(dev)) - gpio_charger->wakeup_enabled = -- enable_irq_wake(gpio_charger->irq); -+ !enable_irq_wake(gpio_charger->irq); - - return 0; - } -@@ -178,7 +178,7 @@ static int gpio_charger_resume(struct device *dev) - struct platform_device *pdev = to_platform_device(dev); - struct gpio_charger *gpio_charger = platform_get_drvdata(pdev); - -- if (gpio_charger->wakeup_enabled) -+ if (device_may_wakeup(dev) && gpio_charger->wakeup_enabled) - disable_irq_wake(gpio_charger->irq); - power_supply_changed(&gpio_charger->charger); - -diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c -index f655592..a1f04e3 100644 ---- a/drivers/scsi/megaraid/megaraid_sas_fusion.c -+++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c -@@ -92,6 +92,8 @@ megasas_enable_intr_fusion(struct megasas_instance *instance) - { - struct megasas_register_set __iomem *regs; - regs = instance->reg_set; -+ -+ instance->mask_interrupts = 0; - /* For Thunderbolt/Invader also clear intr on enable */ - writel(~0, &regs->outbound_intr_status); - readl(&regs->outbound_intr_status); -@@ -100,7 +102,6 @@ megasas_enable_intr_fusion(struct megasas_instance *instance) - - /* Dummy readl to force pci flush */ - readl(&regs->outbound_intr_mask); -- instance->mask_interrupts = 0; - } - - /** -diff --git a/drivers/target/iscsi/iscsi_target_tq.c b/drivers/target/iscsi/iscsi_target_tq.c -index 601e9cc..bb2890e 100644 ---- a/drivers/target/iscsi/iscsi_target_tq.c -+++ b/drivers/target/iscsi/iscsi_target_tq.c -@@ -24,36 +24,22 @@ - #include "iscsi_target_tq.h" - #include "iscsi_target.h" - --static LIST_HEAD(active_ts_list); - static LIST_HEAD(inactive_ts_list); --static DEFINE_SPINLOCK(active_ts_lock); - static DEFINE_SPINLOCK(inactive_ts_lock); - static DEFINE_SPINLOCK(ts_bitmap_lock); - --static void iscsi_add_ts_to_active_list(struct iscsi_thread_set *ts) --{ -- spin_lock(&active_ts_lock); -- list_add_tail(&ts->ts_list, &active_ts_list); -- iscsit_global->active_ts++; -- spin_unlock(&active_ts_lock); --} -- - static void iscsi_add_ts_to_inactive_list(struct iscsi_thread_set *ts) - { -+ if (!list_empty(&ts->ts_list)) { -+ WARN_ON(1); -+ return; -+ } - spin_lock(&inactive_ts_lock); - list_add_tail(&ts->ts_list, &inactive_ts_list); - iscsit_global->inactive_ts++; - spin_unlock(&inactive_ts_lock); - } - --static void iscsi_del_ts_from_active_list(struct iscsi_thread_set *ts) --{ -- spin_lock(&active_ts_lock); -- list_del(&ts->ts_list); -- iscsit_global->active_ts--; -- spin_unlock(&active_ts_lock); --} -- - static struct iscsi_thread_set *iscsi_get_ts_from_inactive_list(void) - { - struct iscsi_thread_set *ts; -@@ -66,7 +52,7 @@ static struct iscsi_thread_set *iscsi_get_ts_from_inactive_list(void) - - ts = list_first_entry(&inactive_ts_list, struct iscsi_thread_set, ts_list); - -- list_del(&ts->ts_list); -+ list_del_init(&ts->ts_list); - iscsit_global->inactive_ts--; - spin_unlock(&inactive_ts_lock); - -@@ -204,8 +190,6 @@ static void iscsi_deallocate_extra_thread_sets(void) - - void iscsi_activate_thread_set(struct iscsi_conn *conn, struct iscsi_thread_set *ts) - { -- iscsi_add_ts_to_active_list(ts); -- - spin_lock_bh(&ts->ts_state_lock); - conn->thread_set = ts; - ts->conn = conn; -@@ -397,7 +381,6 @@ struct iscsi_conn *iscsi_rx_thread_pre_handler(struct iscsi_thread_set *ts) - - if (ts->delay_inactive && (--ts->thread_count == 0)) { - spin_unlock_bh(&ts->ts_state_lock); -- iscsi_del_ts_from_active_list(ts); - - if (!iscsit_global->in_shutdown) - iscsi_deallocate_extra_thread_sets(); -@@ -452,7 +435,6 @@ struct iscsi_conn *iscsi_tx_thread_pre_handler(struct iscsi_thread_set *ts) - - if (ts->delay_inactive && (--ts->thread_count == 0)) { - spin_unlock_bh(&ts->ts_state_lock); -- iscsi_del_ts_from_active_list(ts); - - if (!iscsit_global->in_shutdown) - iscsi_deallocate_extra_thread_sets(); -diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c -index 25c9bc7..e49616e 100644 ---- a/drivers/tty/pty.c -+++ b/drivers/tty/pty.c -@@ -209,6 +209,9 @@ static int pty_signal(struct tty_struct *tty, int sig) - unsigned long flags; - struct pid *pgrp; - -+ if (sig != SIGINT && sig != SIGQUIT && sig != SIGTSTP) -+ return -EINVAL; -+ - if (tty->link) { - spin_lock_irqsave(&tty->link->ctrl_lock, flags); - pgrp = get_pid(tty->link->pgrp); -diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c -index ce352b8..0d3e6cb 100644 ---- a/drivers/tty/serial/atmel_serial.c -+++ b/drivers/tty/serial/atmel_serial.c -@@ -2392,7 +2392,7 @@ static int atmel_serial_probe(struct platform_device *pdev) - - ret = atmel_init_port(port, pdev); - if (ret) -- goto err; -+ goto err_clear_bit; - - if (!atmel_use_pdc_rx(&port->uart)) { - ret = -ENOMEM; -@@ -2441,6 +2441,8 @@ err_alloc_ring: - clk_put(port->clk); - port->clk = NULL; - } -+err_clear_bit: -+ clear_bit(port->uart.line, atmel_ports_in_use); - err: - return ret; - } -diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c -index 23b5d32..693091a 100644 ---- a/drivers/tty/vt/vt.c -+++ b/drivers/tty/vt/vt.c -@@ -498,6 +498,7 @@ void invert_screen(struct vc_data *vc, int offset, int count, int viewed) - #endif - if (DO_UPDATE(vc)) - do_update_region(vc, (unsigned long) p, count); -+ notify_update(vc); - } - - /* used by selection: complement pointer position */ -@@ -514,6 +515,7 @@ void complement_pos(struct vc_data *vc, int offset) - scr_writew(old, screenpos(vc, old_offset, 1)); - if (DO_UPDATE(vc)) - vc->vc_sw->con_putc(vc, old, oldy, oldx); -+ notify_update(vc); - } - - old_offset = offset; -@@ -531,8 +533,8 @@ void complement_pos(struct vc_data *vc, int offset) - oldy = (offset >> 1) / vc->vc_cols; - vc->vc_sw->con_putc(vc, new, oldy, oldx); - } -+ notify_update(vc); - } -- - } - - static void insert_char(struct vc_data *vc, unsigned int nr) -diff --git a/drivers/usb/core/buffer.c b/drivers/usb/core/buffer.c -index 684ef70..506b969 100644 ---- a/drivers/usb/core/buffer.c -+++ b/drivers/usb/core/buffer.c -@@ -22,17 +22,25 @@ - */ - - /* FIXME tune these based on pool statistics ... */ --static const size_t pool_max[HCD_BUFFER_POOLS] = { -- /* platforms without dma-friendly caches might need to -- * prevent cacheline sharing... -- */ -- 32, -- 128, -- 512, -- PAGE_SIZE / 2 -- /* bigger --> allocate pages */ -+static size_t pool_max[HCD_BUFFER_POOLS] = { -+ 32, 128, 512, 2048, - }; - -+void __init usb_init_pool_max(void) -+{ -+ /* -+ * The pool_max values must never be smaller than -+ * ARCH_KMALLOC_MINALIGN. -+ */ -+ if (ARCH_KMALLOC_MINALIGN <= 32) -+ ; /* Original value is okay */ -+ else if (ARCH_KMALLOC_MINALIGN <= 64) -+ pool_max[0] = 64; -+ else if (ARCH_KMALLOC_MINALIGN <= 128) -+ pool_max[0] = 0; /* Don't use this pool */ -+ else -+ BUILD_BUG(); /* We don't allow this */ -+} - - /* SETUP primitives */ - -diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c -index ef6ec13b..ee6c556 100644 ---- a/drivers/usb/core/hcd.c -+++ b/drivers/usb/core/hcd.c -@@ -1617,6 +1617,7 @@ static int unlink1(struct usb_hcd *hcd, struct urb *urb, int status) - int usb_hcd_unlink_urb (struct urb *urb, int status) - { - struct usb_hcd *hcd; -+ struct usb_device *udev = urb->dev; - int retval = -EIDRM; - unsigned long flags; - -@@ -1628,20 +1629,19 @@ int usb_hcd_unlink_urb (struct urb *urb, int status) - spin_lock_irqsave(&hcd_urb_unlink_lock, flags); - if (atomic_read(&urb->use_count) > 0) { - retval = 0; -- usb_get_dev(urb->dev); -+ usb_get_dev(udev); - } - spin_unlock_irqrestore(&hcd_urb_unlink_lock, flags); - if (retval == 0) { - hcd = bus_to_hcd(urb->dev->bus); - retval = unlink1(hcd, urb, status); -- usb_put_dev(urb->dev); -+ if (retval == 0) -+ retval = -EINPROGRESS; -+ else if (retval != -EIDRM && retval != -EBUSY) -+ dev_dbg(&udev->dev, "hcd_unlink_urb %p fail %d\n", -+ urb, retval); -+ usb_put_dev(udev); - } -- -- if (retval == 0) -- retval = -EINPROGRESS; -- else if (retval != -EIDRM && retval != -EBUSY) -- dev_dbg(&urb->dev->dev, "hcd_unlink_urb %p fail %d\n", -- urb, retval); - return retval; - } - -diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c -index 4d11449..a922730 100644 ---- a/drivers/usb/core/usb.c -+++ b/drivers/usb/core/usb.c -@@ -1050,6 +1050,7 @@ static int __init usb_init(void) - pr_info("%s: USB support disabled\n", usbcore_name); - return 0; - } -+ usb_init_pool_max(); - - retval = usb_debugfs_init(); - if (retval) -diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c -index 9e8708c..a2d0409 100644 ---- a/drivers/usb/serial/cp210x.c -+++ b/drivers/usb/serial/cp210x.c -@@ -56,6 +56,7 @@ static const struct usb_device_id id_table[] = { - { USB_DEVICE(0x0846, 0x1100) }, /* NetGear Managed Switch M4100 series, M5300 series, M7100 series */ - { USB_DEVICE(0x08e6, 0x5501) }, /* Gemalto Prox-PU/CU contactless smartcard reader */ - { USB_DEVICE(0x08FD, 0x000A) }, /* Digianswer A/S , ZigBee/802.15.4 MAC Device */ -+ { USB_DEVICE(0x0908, 0x01FF) }, /* Siemens RUGGEDCOM USB Serial Console */ - { USB_DEVICE(0x0BED, 0x1100) }, /* MEI (TM) Cashflow-SC Bill/Voucher Acceptor */ - { USB_DEVICE(0x0BED, 0x1101) }, /* MEI series 2000 Combo Acceptor */ - { USB_DEVICE(0x0FCF, 0x1003) }, /* Dynastream ANT development board */ -diff --git a/drivers/xen/manage.c b/drivers/xen/manage.c -index 602913d..edfd797 100644 ---- a/drivers/xen/manage.c -+++ b/drivers/xen/manage.c -@@ -113,10 +113,16 @@ static void do_suspend(void) - - err = freeze_processes(); - if (err) { -- pr_err("%s: freeze failed %d\n", __func__, err); -+ pr_err("%s: freeze processes failed %d\n", __func__, err); - goto out; - } - -+ err = freeze_kernel_threads(); -+ if (err) { -+ pr_err("%s: freeze kernel threads failed %d\n", __func__, err); -+ goto out_thaw; -+ } -+ - err = dpm_suspend_start(PMSG_FREEZE); - if (err) { - pr_err("%s: dpm_suspend_start %d\n", __func__, err); -diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c -index 67be295..f4d7b2f 100644 ---- a/fs/binfmt_elf.c -+++ b/fs/binfmt_elf.c -@@ -549,11 +549,12 @@ out: - - static unsigned long randomize_stack_top(unsigned long stack_top) - { -- unsigned int random_variable = 0; -+ unsigned long random_variable = 0; - - if ((current->flags & PF_RANDOMIZE) && - !(current->personality & ADDR_NO_RANDOMIZE)) { -- random_variable = get_random_int() & STACK_RND_MASK; -+ random_variable = (unsigned long) get_random_int(); -+ random_variable &= STACK_RND_MASK; - random_variable <<= PAGE_SHIFT; - } - #ifdef CONFIG_STACK_GROWSUP -diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c -index cbd3a7d..93de3ba 100644 ---- a/fs/btrfs/ctree.c -+++ b/fs/btrfs/ctree.c -@@ -2655,32 +2655,23 @@ static int key_search(struct extent_buffer *b, struct btrfs_key *key, - return 0; - } - --int btrfs_find_item(struct btrfs_root *fs_root, struct btrfs_path *found_path, -+int btrfs_find_item(struct btrfs_root *fs_root, struct btrfs_path *path, - u64 iobjectid, u64 ioff, u8 key_type, - struct btrfs_key *found_key) - { - int ret; - struct btrfs_key key; - struct extent_buffer *eb; -- struct btrfs_path *path; -+ -+ ASSERT(path); - - key.type = key_type; - key.objectid = iobjectid; - key.offset = ioff; - -- if (found_path == NULL) { -- path = btrfs_alloc_path(); -- if (!path) -- return -ENOMEM; -- } else -- path = found_path; -- - ret = btrfs_search_slot(NULL, fs_root, &key, path, 0, 0); -- if ((ret < 0) || (found_key == NULL)) { -- if (path != found_path) -- btrfs_free_path(path); -+ if ((ret < 0) || (found_key == NULL)) - return ret; -- } - - eb = path->nodes[0]; - if (ret && path->slots[0] >= btrfs_header_nritems(eb)) { -diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c -index 0db8ded..f48d5fc 100644 ---- a/fs/btrfs/disk-io.c -+++ b/fs/btrfs/disk-io.c -@@ -1560,6 +1560,7 @@ struct btrfs_root *btrfs_get_fs_root(struct btrfs_fs_info *fs_info, - bool check_ref) - { - struct btrfs_root *root; -+ struct btrfs_path *path; - int ret; - - if (location->objectid == BTRFS_ROOT_TREE_OBJECTID) -@@ -1599,8 +1600,14 @@ again: - if (ret) - goto fail; - -- ret = btrfs_find_item(fs_info->tree_root, NULL, BTRFS_ORPHAN_OBJECTID, -+ path = btrfs_alloc_path(); -+ if (!path) { -+ ret = -ENOMEM; -+ goto fail; -+ } -+ ret = btrfs_find_item(fs_info->tree_root, path, BTRFS_ORPHAN_OBJECTID, - location->objectid, BTRFS_ORPHAN_ITEM_KEY, NULL); -+ btrfs_free_path(path); - if (ret < 0) - goto fail; - if (ret == 0) -@@ -2411,7 +2418,7 @@ int open_ctree(struct super_block *sb, - features |= BTRFS_FEATURE_INCOMPAT_COMPRESS_LZO; - - if (features & BTRFS_FEATURE_INCOMPAT_SKINNY_METADATA) -- printk(KERN_ERR "BTRFS: has skinny extents\n"); -+ printk(KERN_INFO "BTRFS: has skinny extents\n"); - - /* - * flag our filesystem as having big metadata blocks if -diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c -index 39d83da..aeb57b98 100644 ---- a/fs/btrfs/tree-log.c -+++ b/fs/btrfs/tree-log.c -@@ -1238,10 +1238,19 @@ static int insert_orphan_item(struct btrfs_trans_handle *trans, - struct btrfs_root *root, u64 offset) - { - int ret; -- ret = btrfs_find_item(root, NULL, BTRFS_ORPHAN_OBJECTID, -+ struct btrfs_path *path; -+ -+ path = btrfs_alloc_path(); -+ if (!path) -+ return -ENOMEM; -+ -+ ret = btrfs_find_item(root, path, BTRFS_ORPHAN_OBJECTID, - offset, BTRFS_ORPHAN_ITEM_KEY, NULL); - if (ret > 0) - ret = btrfs_insert_orphan_item(trans, root, offset); -+ -+ btrfs_free_path(path); -+ - return ret; - } - -diff --git a/fs/jffs2/scan.c b/fs/jffs2/scan.c -index 7654e87..9ad5ba4 100644 ---- a/fs/jffs2/scan.c -+++ b/fs/jffs2/scan.c -@@ -510,6 +510,10 @@ static int jffs2_scan_eraseblock (struct jffs2_sb_info *c, struct jffs2_eraseblo - sumlen = c->sector_size - je32_to_cpu(sm->offset); - sumptr = buf + buf_size - sumlen; - -+ /* sm->offset maybe wrong but MAGIC maybe right */ -+ if (sumlen > c->sector_size) -+ goto full_scan; -+ - /* Now, make sure the summary itself is available */ - if (sumlen > buf_size) { - /* Need to kmalloc for this. */ -@@ -544,6 +548,7 @@ static int jffs2_scan_eraseblock (struct jffs2_sb_info *c, struct jffs2_eraseblo - } - } - -+full_scan: - buf_ofs = jeb->offset; - - if (!buf_size) { -diff --git a/fs/nfs/callback.c b/fs/nfs/callback.c -index 073b4cf..0a2016b 100644 ---- a/fs/nfs/callback.c -+++ b/fs/nfs/callback.c -@@ -128,22 +128,24 @@ nfs41_callback_svc(void *vrqstp) - if (try_to_freeze()) - continue; - -- prepare_to_wait(&serv->sv_cb_waitq, &wq, TASK_INTERRUPTIBLE); -+ prepare_to_wait(&serv->sv_cb_waitq, &wq, TASK_UNINTERRUPTIBLE); - spin_lock_bh(&serv->sv_cb_lock); - if (!list_empty(&serv->sv_cb_list)) { - req = list_first_entry(&serv->sv_cb_list, - struct rpc_rqst, rq_bc_list); - list_del(&req->rq_bc_list); - spin_unlock_bh(&serv->sv_cb_lock); -+ finish_wait(&serv->sv_cb_waitq, &wq); - dprintk("Invoking bc_svc_process()\n"); - error = bc_svc_process(serv, req, rqstp); - dprintk("bc_svc_process() returned w/ error code= %d\n", - error); - } else { - spin_unlock_bh(&serv->sv_cb_lock); -- schedule(); -+ /* schedule_timeout to game the hung task watchdog */ -+ schedule_timeout(60 * HZ); -+ finish_wait(&serv->sv_cb_waitq, &wq); - } -- finish_wait(&serv->sv_cb_waitq, &wq); - } - return 0; - } -diff --git a/fs/nfs/callback_xdr.c b/fs/nfs/callback_xdr.c -index f4ccfe6..02f8d09 100644 ---- a/fs/nfs/callback_xdr.c -+++ b/fs/nfs/callback_xdr.c -@@ -464,8 +464,10 @@ static __be32 decode_cb_sequence_args(struct svc_rqst *rqstp, - - for (i = 0; i < args->csa_nrclists; i++) { - status = decode_rc_list(xdr, &args->csa_rclists[i]); -- if (status) -+ if (status) { -+ args->csa_nrclists = i; - goto out_free; -+ } - } - } - status = 0; -diff --git a/fs/xfs/xfs_buf_item.c b/fs/xfs/xfs_buf_item.c -index 3314911..645f180 100644 ---- a/fs/xfs/xfs_buf_item.c -+++ b/fs/xfs/xfs_buf_item.c -@@ -319,6 +319,10 @@ xfs_buf_item_format( - ASSERT(atomic_read(&bip->bli_refcount) > 0); - ASSERT((bip->bli_flags & XFS_BLI_LOGGED) || - (bip->bli_flags & XFS_BLI_STALE)); -+ ASSERT((bip->bli_flags & XFS_BLI_STALE) || -+ (xfs_blft_from_flags(&bip->__bli_format) > XFS_BLFT_UNKNOWN_BUF -+ && xfs_blft_from_flags(&bip->__bli_format) < XFS_BLFT_MAX_BUF)); -+ - - /* - * If it is an inode buffer, transfer the in-memory state to the -diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c -index 3a137e9..5d90b8d 100644 ---- a/fs/xfs/xfs_inode.c -+++ b/fs/xfs/xfs_inode.c -@@ -1946,6 +1946,7 @@ xfs_iunlink( - agi->agi_unlinked[bucket_index] = cpu_to_be32(agino); - offset = offsetof(xfs_agi_t, agi_unlinked) + - (sizeof(xfs_agino_t) * bucket_index); -+ xfs_trans_buf_set_type(tp, agibp, XFS_BLFT_AGI_BUF); - xfs_trans_log_buf(tp, agibp, offset, - (offset + sizeof(xfs_agino_t) - 1)); - return 0; -@@ -2037,6 +2038,7 @@ xfs_iunlink_remove( - agi->agi_unlinked[bucket_index] = cpu_to_be32(next_agino); - offset = offsetof(xfs_agi_t, agi_unlinked) + - (sizeof(xfs_agino_t) * bucket_index); -+ xfs_trans_buf_set_type(tp, agibp, XFS_BLFT_AGI_BUF); - xfs_trans_log_buf(tp, agibp, offset, - (offset + sizeof(xfs_agino_t) - 1)); - } else { -diff --git a/fs/xfs/xfs_qm.c b/fs/xfs/xfs_qm.c -index 6d7d1de..1b271f5 100644 ---- a/fs/xfs/xfs_qm.c -+++ b/fs/xfs/xfs_qm.c -@@ -1108,6 +1108,11 @@ xfs_qm_reset_dqcounts( - */ - xfs_dqcheck(mp, ddq, id+j, type, XFS_QMOPT_DQREPAIR, - "xfs_quotacheck"); -+ /* -+ * Reset type in case we are reusing group quota file for -+ * project quotas or vice versa -+ */ -+ ddq->d_flags = type; - ddq->d_bcount = 0; - ddq->d_icount = 0; - ddq->d_rtbcount = 0; -diff --git a/fs/xfs/xfs_trans.c b/fs/xfs/xfs_trans.c -index c812c5c..b626f3d 100644 ---- a/fs/xfs/xfs_trans.c -+++ b/fs/xfs/xfs_trans.c -@@ -474,6 +474,7 @@ xfs_trans_apply_sb_deltas( - whole = 1; - } - -+ xfs_trans_buf_set_type(tp, bp, XFS_BLFT_SB_BUF); - if (whole) - /* - * Log the whole thing, the fields are noncontiguous. -diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h -index 1c804b0..7ee1774 100644 ---- a/include/linux/fsnotify.h -+++ b/include/linux/fsnotify.h -@@ -101,8 +101,10 @@ static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir, - new_dir_mask |= FS_ISDIR; - } - -- fsnotify(old_dir, old_dir_mask, old_dir, FSNOTIFY_EVENT_INODE, old_name, fs_cookie); -- fsnotify(new_dir, new_dir_mask, new_dir, FSNOTIFY_EVENT_INODE, new_name, fs_cookie); -+ fsnotify(old_dir, old_dir_mask, source, FSNOTIFY_EVENT_INODE, old_name, -+ fs_cookie); -+ fsnotify(new_dir, new_dir_mask, source, FSNOTIFY_EVENT_INODE, new_name, -+ fs_cookie); - - if (target) - fsnotify_link_count(target); -diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h -index efe8d8a..e34bce37 100644 ---- a/include/linux/usb/hcd.h -+++ b/include/linux/usb/hcd.h -@@ -447,6 +447,7 @@ extern const struct dev_pm_ops usb_hcd_pci_pm_ops; - #endif /* CONFIG_PCI */ - - /* pci-ish (pdev null is ok) buffer alloc/mapping support */ -+void usb_init_pool_max(void); - int hcd_buffer_create(struct usb_hcd *hcd); - void hcd_buffer_destroy(struct usb_hcd *hcd); - -diff --git a/kernel/debug/kdb/kdb_main.c b/kernel/debug/kdb/kdb_main.c -index 0b097c8..449518e 100644 ---- a/kernel/debug/kdb/kdb_main.c -+++ b/kernel/debug/kdb/kdb_main.c -@@ -2535,7 +2535,7 @@ static int kdb_summary(int argc, const char **argv) - #define K(x) ((x) << (PAGE_SHIFT - 10)) - kdb_printf("\nMemTotal: %8lu kB\nMemFree: %8lu kB\n" - "Buffers: %8lu kB\n", -- val.totalram, val.freeram, val.bufferram); -+ K(val.totalram), K(val.freeram), K(val.bufferram)); - return 0; - } - -diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c -index 28db9be..6211d5d 100644 ---- a/kernel/time/ntp.c -+++ b/kernel/time/ntp.c -@@ -631,10 +631,14 @@ int ntp_validate_timex(struct timex *txc) - if ((txc->modes & ADJ_SETOFFSET) && (!capable(CAP_SYS_TIME))) - return -EPERM; - -- if (txc->modes & ADJ_FREQUENCY) { -- if (LONG_MIN / PPM_SCALE > txc->freq) -+ /* -+ * Check for potential multiplication overflows that can -+ * only happen on 64-bit systems: -+ */ -+ if ((txc->modes & ADJ_FREQUENCY) && (BITS_PER_LONG == 64)) { -+ if (LLONG_MIN / PPM_SCALE > txc->freq) - return -EINVAL; -- if (LONG_MAX / PPM_SCALE < txc->freq) -+ if (LLONG_MAX / PPM_SCALE < txc->freq) - return -EINVAL; - } - -diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c -index 7113672..813b021 100644 ---- a/kernel/trace/trace.c -+++ b/kernel/trace/trace.c -@@ -4694,7 +4694,7 @@ tracing_mark_write(struct file *filp, const char __user *ubuf, - *fpos += written; - - out_unlock: -- for (i = 0; i < nr_pages; i++){ -+ for (i = nr_pages - 1; i >= 0; i--) { - kunmap_atomic(map_page[i]); - put_page(pages[i]); - } -diff --git a/mm/hugetlb.c b/mm/hugetlb.c -index 67d0c17..472259b 100644 ---- a/mm/hugetlb.c -+++ b/mm/hugetlb.c -@@ -3456,6 +3456,8 @@ follow_huge_pmd(struct mm_struct *mm, unsigned long address, - { - struct page *page; - -+ if (!pmd_present(*pmd)) -+ return NULL; - page = pte_page(*(pte_t *)pmd); - if (page) - page += ((address & ~PMD_MASK) >> PAGE_SHIFT); -diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c -index 0676f2b..45f077c 100644 ---- a/net/ceph/osd_client.c -+++ b/net/ceph/osd_client.c -@@ -977,12 +977,24 @@ static void put_osd(struct ceph_osd *osd) - */ - static void __remove_osd(struct ceph_osd_client *osdc, struct ceph_osd *osd) - { -- dout("__remove_osd %p\n", osd); -- BUG_ON(!list_empty(&osd->o_requests)); -- rb_erase(&osd->o_node, &osdc->osds); -+ dout("%s %p osd%d\n", __func__, osd, osd->o_osd); -+ WARN_ON(!list_empty(&osd->o_requests)); -+ WARN_ON(!list_empty(&osd->o_linger_requests)); -+ - list_del_init(&osd->o_osd_lru); -- ceph_con_close(&osd->o_con); -- put_osd(osd); -+ rb_erase(&osd->o_node, &osdc->osds); -+ RB_CLEAR_NODE(&osd->o_node); -+} -+ -+static void remove_osd(struct ceph_osd_client *osdc, struct ceph_osd *osd) -+{ -+ dout("%s %p osd%d\n", __func__, osd, osd->o_osd); -+ -+ if (!RB_EMPTY_NODE(&osd->o_node)) { -+ ceph_con_close(&osd->o_con); -+ __remove_osd(osdc, osd); -+ put_osd(osd); -+ } - } - - static void remove_all_osds(struct ceph_osd_client *osdc) -@@ -992,7 +1004,7 @@ static void remove_all_osds(struct ceph_osd_client *osdc) - while (!RB_EMPTY_ROOT(&osdc->osds)) { - struct ceph_osd *osd = rb_entry(rb_first(&osdc->osds), - struct ceph_osd, o_node); -- __remove_osd(osdc, osd); -+ remove_osd(osdc, osd); - } - mutex_unlock(&osdc->request_mutex); - } -@@ -1022,7 +1034,7 @@ static void remove_old_osds(struct ceph_osd_client *osdc) - list_for_each_entry_safe(osd, nosd, &osdc->osd_lru, o_osd_lru) { - if (time_before(jiffies, osd->lru_ttl)) - break; -- __remove_osd(osdc, osd); -+ remove_osd(osdc, osd); - } - mutex_unlock(&osdc->request_mutex); - } -@@ -1037,8 +1049,7 @@ static int __reset_osd(struct ceph_osd_client *osdc, struct ceph_osd *osd) - dout("__reset_osd %p osd%d\n", osd, osd->o_osd); - if (list_empty(&osd->o_requests) && - list_empty(&osd->o_linger_requests)) { -- __remove_osd(osdc, osd); -- -+ remove_osd(osdc, osd); - return -ENODEV; - } - -@@ -1840,6 +1851,7 @@ static void reset_changed_osds(struct ceph_osd_client *osdc) - { - struct rb_node *p, *n; - -+ dout("%s %p\n", __func__, osdc); - for (p = rb_first(&osdc->osds); p; p = n) { - struct ceph_osd *osd = rb_entry(p, struct ceph_osd, o_node); - -diff --git a/sound/pci/riptide/riptide.c b/sound/pci/riptide/riptide.c -index 56cc891..d99c8d3 100644 ---- a/sound/pci/riptide/riptide.c -+++ b/sound/pci/riptide/riptide.c -@@ -2032,32 +2032,43 @@ snd_riptide_joystick_probe(struct pci_dev *pci, const struct pci_device_id *id) - { - static int dev; - struct gameport *gameport; -+ int ret; - - if (dev >= SNDRV_CARDS) - return -ENODEV; -+ - if (!enable[dev]) { -- dev++; -- return -ENOENT; -+ ret = -ENOENT; -+ goto inc_dev; - } - -- if (!joystick_port[dev++]) -- return 0; -+ if (!joystick_port[dev]) { -+ ret = 0; -+ goto inc_dev; -+ } - - gameport = gameport_allocate_port(); -- if (!gameport) -- return -ENOMEM; -+ if (!gameport) { -+ ret = -ENOMEM; -+ goto inc_dev; -+ } - if (!request_region(joystick_port[dev], 8, "Riptide gameport")) { - snd_printk(KERN_WARNING - "Riptide: cannot grab gameport 0x%x\n", - joystick_port[dev]); - gameport_free_port(gameport); -- return -EBUSY; -+ ret = -EBUSY; -+ goto inc_dev; - } - - gameport->io = joystick_port[dev]; - gameport_register_port(gameport); - pci_set_drvdata(pci, gameport); -- return 0; -+ -+ ret = 0; -+inc_dev: -+ dev++; -+ return ret; - } - - static void snd_riptide_joystick_remove(struct pci_dev *pci) -diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c -index e98dc00..2116750 100644 ---- a/sound/pci/rme9652/hdspm.c -+++ b/sound/pci/rme9652/hdspm.c -@@ -6102,6 +6102,9 @@ static int snd_hdspm_playback_open(struct snd_pcm_substream *substream) - snd_pcm_hw_constraint_minmax(runtime, - SNDRV_PCM_HW_PARAM_PERIOD_SIZE, - 64, 8192); -+ snd_pcm_hw_constraint_minmax(runtime, -+ SNDRV_PCM_HW_PARAM_PERIODS, -+ 2, 2); - break; - } - -@@ -6176,6 +6179,9 @@ static int snd_hdspm_capture_open(struct snd_pcm_substream *substream) - snd_pcm_hw_constraint_minmax(runtime, - SNDRV_PCM_HW_PARAM_PERIOD_SIZE, - 64, 8192); -+ snd_pcm_hw_constraint_minmax(runtime, -+ SNDRV_PCM_HW_PARAM_PERIODS, -+ 2, 2); - break; - } - diff --git a/projects/imx6/patches/linux/linux-000-patch-3.14.35-36.patch b/projects/imx6/patches/linux/linux-000-patch-3.14.35-36.patch deleted file mode 100644 index 8e23c259030..00000000000 --- a/projects/imx6/patches/linux/linux-000-patch-3.14.35-36.patch +++ /dev/null @@ -1,3448 +0,0 @@ -diff --git a/Makefile b/Makefile -index 9720e86..4e6537b 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,6 +1,6 @@ - VERSION = 3 - PATCHLEVEL = 14 --SUBLEVEL = 35 -+SUBLEVEL = 36 - EXTRAVERSION = - NAME = Remembering Coco - -diff --git a/arch/arc/include/asm/processor.h b/arch/arc/include/asm/processor.h -index 15334ab..fb95aa8 100644 ---- a/arch/arc/include/asm/processor.h -+++ b/arch/arc/include/asm/processor.h -@@ -69,18 +69,19 @@ unsigned long thread_saved_pc(struct task_struct *t); - #define release_segments(mm) do { } while (0) - - #define KSTK_EIP(tsk) (task_pt_regs(tsk)->ret) -+#define KSTK_ESP(tsk) (task_pt_regs(tsk)->sp) - - /* - * Where abouts of Task's sp, fp, blink when it was last seen in kernel mode. - * Look in process.c for details of kernel stack layout - */ --#define KSTK_ESP(tsk) (tsk->thread.ksp) -+#define TSK_K_ESP(tsk) (tsk->thread.ksp) - --#define KSTK_REG(tsk, off) (*((unsigned int *)(KSTK_ESP(tsk) + \ -+#define TSK_K_REG(tsk, off) (*((unsigned int *)(TSK_K_ESP(tsk) + \ - sizeof(struct callee_regs) + off))) - --#define KSTK_BLINK(tsk) KSTK_REG(tsk, 4) --#define KSTK_FP(tsk) KSTK_REG(tsk, 0) -+#define TSK_K_BLINK(tsk) TSK_K_REG(tsk, 4) -+#define TSK_K_FP(tsk) TSK_K_REG(tsk, 0) - - /* - * Do necessary setup to start up a newly executed thread. -diff --git a/arch/arc/kernel/stacktrace.c b/arch/arc/kernel/stacktrace.c -index 9ce47cf..fb98769 100644 ---- a/arch/arc/kernel/stacktrace.c -+++ b/arch/arc/kernel/stacktrace.c -@@ -64,9 +64,9 @@ static void seed_unwind_frame_info(struct task_struct *tsk, - - frame_info->task = tsk; - -- frame_info->regs.r27 = KSTK_FP(tsk); -- frame_info->regs.r28 = KSTK_ESP(tsk); -- frame_info->regs.r31 = KSTK_BLINK(tsk); -+ frame_info->regs.r27 = TSK_K_FP(tsk); -+ frame_info->regs.r28 = TSK_K_ESP(tsk); -+ frame_info->regs.r31 = TSK_K_BLINK(tsk); - frame_info->regs.r63 = (unsigned int)__switch_to; - - /* In the prologue of __switch_to, first FP is saved on stack -diff --git a/arch/mips/kvm/trace.h b/arch/mips/kvm/trace.h -index bc9e0f4..e51621e 100644 ---- a/arch/mips/kvm/trace.h -+++ b/arch/mips/kvm/trace.h -@@ -26,18 +26,18 @@ TRACE_EVENT(kvm_exit, - TP_PROTO(struct kvm_vcpu *vcpu, unsigned int reason), - TP_ARGS(vcpu, reason), - TP_STRUCT__entry( -- __field(struct kvm_vcpu *, vcpu) -+ __field(unsigned long, pc) - __field(unsigned int, reason) - ), - - TP_fast_assign( -- __entry->vcpu = vcpu; -+ __entry->pc = vcpu->arch.pc; - __entry->reason = reason; - ), - - TP_printk("[%s]PC: 0x%08lx", - kvm_mips_exit_types_str[__entry->reason], -- __entry->vcpu->arch.pc) -+ __entry->pc) - ); - - #endif /* _TRACE_KVM_H */ -diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S -index 02553d6..06469ee 100644 ---- a/arch/x86/kernel/entry_64.S -+++ b/arch/x86/kernel/entry_64.S -@@ -542,11 +542,14 @@ ENTRY(ret_from_fork) - testl $3, CS-ARGOFFSET(%rsp) # from kernel_thread? - jz 1f - -- testl $_TIF_IA32, TI_flags(%rcx) # 32-bit compat task needs IRET -- jnz int_ret_from_sys_call -- -- RESTORE_TOP_OF_STACK %rdi, -ARGOFFSET -- jmp ret_from_sys_call # go to the SYSRET fastpath -+ /* -+ * By the time we get here, we have no idea whether our pt_regs, -+ * ti flags, and ti status came from the 64-bit SYSCALL fast path, -+ * the slow path, or one of the ia32entry paths. -+ * Use int_ret_from_sys_call to return, since it can safely handle -+ * all of the above. -+ */ -+ jmp int_ret_from_sys_call - - 1: - subq $REST_SKIP, %rsp # leave space for volatiles -diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c -index 38d3751..09651d4 100644 ---- a/arch/x86/kvm/emulate.c -+++ b/arch/x86/kvm/emulate.c -@@ -4646,7 +4646,8 @@ int x86_emulate_insn(struct x86_emulate_ctxt *ctxt) - if (rc != X86EMUL_CONTINUE) - goto done; - } -- ctxt->dst.orig_val = ctxt->dst.val; -+ /* Copy full 64-bit value for CMPXCHG8B. */ -+ ctxt->dst.orig_val64 = ctxt->dst.val64; - - special_insn: - -diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c -index bb0b904..997540d 100644 ---- a/drivers/acpi/video.c -+++ b/drivers/acpi/video.c -@@ -2064,6 +2064,17 @@ EXPORT_SYMBOL(acpi_video_unregister); - - static int __init acpi_video_init(void) - { -+ /* -+ * Let the module load even if ACPI is disabled (e.g. due to -+ * a broken BIOS) so that i915.ko can still be loaded on such -+ * old systems without an AcpiOpRegion. -+ * -+ * acpi_video_register() will report -ENODEV later as well due -+ * to acpi_disabled when i915.ko tries to register itself afterwards. -+ */ -+ if (acpi_disabled) -+ return 0; -+ - dmi_check_system(video_dmi_table); - - if (intel_opregion_present()) -diff --git a/drivers/clk/clk-gate.c b/drivers/clk/clk-gate.c -index 4a58c55..797bab9 100644 ---- a/drivers/clk/clk-gate.c -+++ b/drivers/clk/clk-gate.c -@@ -128,7 +128,7 @@ struct clk *clk_register_gate(struct device *dev, const char *name, - struct clk_init_data init; - - if (clk_gate_flags & CLK_GATE_HIWORD_MASK) { -- if (bit_idx > 16) { -+ if (bit_idx > 15) { - pr_err("gate bit exceeds LOWORD field\n"); - return ERR_PTR(-EINVAL); - } -diff --git a/drivers/clk/sunxi/clk-factors.c b/drivers/clk/sunxi/clk-factors.c -index 9e23264..ea4db84 100644 ---- a/drivers/clk/sunxi/clk-factors.c -+++ b/drivers/clk/sunxi/clk-factors.c -@@ -62,7 +62,7 @@ static unsigned long clk_factors_recalc_rate(struct clk_hw *hw, - p = FACTOR_GET(config->pshift, config->pwidth, reg); - - /* Calculate the rate */ -- rate = (parent_rate * n * (k + 1) >> p) / (m + 1); -+ rate = (parent_rate * (n + config->n_start) * (k + 1) >> p) / (m + 1); - - return rate; - } -diff --git a/drivers/clk/sunxi/clk-factors.h b/drivers/clk/sunxi/clk-factors.h -index 02e1a43..d2d0efa 100644 ---- a/drivers/clk/sunxi/clk-factors.h -+++ b/drivers/clk/sunxi/clk-factors.h -@@ -15,6 +15,7 @@ struct clk_factors_config { - u8 mwidth; - u8 pshift; - u8 pwidth; -+ u8 n_start; - }; - - struct clk_factors { -diff --git a/drivers/clk/sunxi/clk-sunxi.c b/drivers/clk/sunxi/clk-sunxi.c -index abb6c5a..06a14b8 100644 ---- a/drivers/clk/sunxi/clk-sunxi.c -+++ b/drivers/clk/sunxi/clk-sunxi.c -@@ -407,6 +407,7 @@ static struct clk_factors_config sun6i_a31_pll1_config = { - .kwidth = 2, - .mshift = 0, - .mwidth = 2, -+ .n_start = 1, - }; - - static struct clk_factors_config sun4i_pll5_config = { -diff --git a/drivers/clk/zynq/clkc.c b/drivers/clk/zynq/clkc.c -index 09dd017..5f52f3f 100644 ---- a/drivers/clk/zynq/clkc.c -+++ b/drivers/clk/zynq/clkc.c -@@ -300,6 +300,7 @@ static void __init zynq_clk_setup(struct device_node *np) - clks[cpu_2x] = clk_register_gate(NULL, clk_output_name[cpu_2x], - "cpu_2x_div", CLK_IGNORE_UNUSED, SLCR_ARM_CLK_CTRL, - 26, 0, &armclk_lock); -+ clk_prepare_enable(clks[cpu_2x]); - - clk = clk_register_fixed_factor(NULL, "cpu_1x_div", "cpu_div", 0, 1, - 4 + 2 * tmp); -diff --git a/drivers/firmware/efi/runtime-map.c b/drivers/firmware/efi/runtime-map.c -index 97cdd16..c98b101 100644 ---- a/drivers/firmware/efi/runtime-map.c -+++ b/drivers/firmware/efi/runtime-map.c -@@ -170,7 +170,7 @@ int __init efi_runtime_map_init(struct kobject *efi_kobj) - - return 0; - out_add_entry: -- for (j = i - 1; j > 0; j--) { -+ for (j = i - 1; j >= 0; j--) { - entry = *(map_entries + j); - kobject_put(&entry->kobj); - } -diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c -index 8ef67cb..f0ed0ba 100644 ---- a/drivers/gpu/drm/radeon/cik.c -+++ b/drivers/gpu/drm/radeon/cik.c -@@ -3558,7 +3558,21 @@ void cik_fence_gfx_ring_emit(struct radeon_device *rdev, - struct radeon_ring *ring = &rdev->ring[fence->ring]; - u64 addr = rdev->fence_drv[fence->ring].gpu_addr; - -- /* EVENT_WRITE_EOP - flush caches, send int */ -+ /* Workaround for cache flush problems. First send a dummy EOP -+ * event down the pipe with seq one below. -+ */ -+ radeon_ring_write(ring, PACKET3(PACKET3_EVENT_WRITE_EOP, 4)); -+ radeon_ring_write(ring, (EOP_TCL1_ACTION_EN | -+ EOP_TC_ACTION_EN | -+ EVENT_TYPE(CACHE_FLUSH_AND_INV_TS_EVENT) | -+ EVENT_INDEX(5))); -+ radeon_ring_write(ring, addr & 0xfffffffc); -+ radeon_ring_write(ring, (upper_32_bits(addr) & 0xffff) | -+ DATA_SEL(1) | INT_SEL(0)); -+ radeon_ring_write(ring, fence->seq - 1); -+ radeon_ring_write(ring, 0); -+ -+ /* Then send the real EOP event down the pipe. */ - radeon_ring_write(ring, PACKET3(PACKET3_EVENT_WRITE_EOP, 4)); - radeon_ring_write(ring, (EOP_TCL1_ACTION_EN | - EOP_TC_ACTION_EN | -@@ -6809,7 +6823,6 @@ int cik_irq_set(struct radeon_device *rdev) - u32 hpd1, hpd2, hpd3, hpd4, hpd5, hpd6; - u32 grbm_int_cntl = 0; - u32 dma_cntl, dma_cntl1; -- u32 thermal_int; - - if (!rdev->irq.installed) { - WARN(1, "Can't enable IRQ/MSI because no handler is installed\n"); -@@ -6846,13 +6859,6 @@ int cik_irq_set(struct radeon_device *rdev) - cp_m2p2 = RREG32(CP_ME2_PIPE2_INT_CNTL) & ~TIME_STAMP_INT_ENABLE; - cp_m2p3 = RREG32(CP_ME2_PIPE3_INT_CNTL) & ~TIME_STAMP_INT_ENABLE; - -- if (rdev->flags & RADEON_IS_IGP) -- thermal_int = RREG32_SMC(CG_THERMAL_INT_CTRL) & -- ~(THERM_INTH_MASK | THERM_INTL_MASK); -- else -- thermal_int = RREG32_SMC(CG_THERMAL_INT) & -- ~(THERM_INT_MASK_HIGH | THERM_INT_MASK_LOW); -- - /* enable CP interrupts on all rings */ - if (atomic_read(&rdev->irq.ring_int[RADEON_RING_TYPE_GFX_INDEX])) { - DRM_DEBUG("cik_irq_set: sw int gfx\n"); -@@ -7010,14 +7016,6 @@ int cik_irq_set(struct radeon_device *rdev) - hpd6 |= DC_HPDx_INT_EN; - } - -- if (rdev->irq.dpm_thermal) { -- DRM_DEBUG("dpm thermal\n"); -- if (rdev->flags & RADEON_IS_IGP) -- thermal_int |= THERM_INTH_MASK | THERM_INTL_MASK; -- else -- thermal_int |= THERM_INT_MASK_HIGH | THERM_INT_MASK_LOW; -- } -- - WREG32(CP_INT_CNTL_RING0, cp_int_cntl); - - WREG32(SDMA0_CNTL + SDMA0_REGISTER_OFFSET, dma_cntl); -@@ -7071,11 +7069,6 @@ int cik_irq_set(struct radeon_device *rdev) - WREG32(DC_HPD5_INT_CONTROL, hpd5); - WREG32(DC_HPD6_INT_CONTROL, hpd6); - -- if (rdev->flags & RADEON_IS_IGP) -- WREG32_SMC(CG_THERMAL_INT_CTRL, thermal_int); -- else -- WREG32_SMC(CG_THERMAL_INT, thermal_int); -- - return 0; - } - -diff --git a/drivers/gpu/drm/radeon/kv_dpm.c b/drivers/gpu/drm/radeon/kv_dpm.c -index 351db36..c7c7bc5 100644 ---- a/drivers/gpu/drm/radeon/kv_dpm.c -+++ b/drivers/gpu/drm/radeon/kv_dpm.c -@@ -1121,6 +1121,19 @@ void kv_dpm_enable_bapm(struct radeon_device *rdev, bool enable) - } - } - -+static void kv_enable_thermal_int(struct radeon_device *rdev, bool enable) -+{ -+ u32 thermal_int; -+ -+ thermal_int = RREG32_SMC(CG_THERMAL_INT_CTRL); -+ if (enable) -+ thermal_int |= THERM_INTH_MASK | THERM_INTL_MASK; -+ else -+ thermal_int &= ~(THERM_INTH_MASK | THERM_INTL_MASK); -+ WREG32_SMC(CG_THERMAL_INT_CTRL, thermal_int); -+ -+} -+ - int kv_dpm_enable(struct radeon_device *rdev) - { - struct kv_power_info *pi = kv_get_pi(rdev); -@@ -1232,8 +1245,7 @@ int kv_dpm_late_enable(struct radeon_device *rdev) - DRM_ERROR("kv_set_thermal_temperature_range failed\n"); - return ret; - } -- rdev->irq.dpm_thermal = true; -- radeon_irq_set(rdev); -+ kv_enable_thermal_int(rdev, true); - } - - /* powerdown unused blocks for now */ -@@ -1261,6 +1273,7 @@ void kv_dpm_disable(struct radeon_device *rdev) - kv_stop_dpm(rdev); - kv_enable_ulv(rdev, false); - kv_reset_am(rdev); -+ kv_enable_thermal_int(rdev, false); - - kv_update_current_ps(rdev, rdev->pm.dpm.boot_ps); - } -diff --git a/drivers/gpu/drm/radeon/ni.c b/drivers/gpu/drm/radeon/ni.c -index bf6300c..f8c01b8 100644 ---- a/drivers/gpu/drm/radeon/ni.c -+++ b/drivers/gpu/drm/radeon/ni.c -@@ -1073,12 +1073,12 @@ static void cayman_gpu_init(struct radeon_device *rdev) - - if ((rdev->config.cayman.max_backends_per_se == 1) && - (rdev->flags & RADEON_IS_IGP)) { -- if ((disabled_rb_mask & 3) == 1) { -- /* RB0 disabled, RB1 enabled */ -- tmp = 0x11111111; -- } else { -+ if ((disabled_rb_mask & 3) == 2) { - /* RB1 disabled, RB0 enabled */ - tmp = 0x00000000; -+ } else { -+ /* RB0 disabled, RB1 enabled */ -+ tmp = 0x11111111; - } - } else { - tmp = gb_addr_config & NUM_PIPES_MASK; -diff --git a/drivers/gpu/drm/radeon/r600_dpm.c b/drivers/gpu/drm/radeon/r600_dpm.c -index 3334f91..e981082 100644 ---- a/drivers/gpu/drm/radeon/r600_dpm.c -+++ b/drivers/gpu/drm/radeon/r600_dpm.c -@@ -187,7 +187,7 @@ u32 r600_dpm_get_vrefresh(struct radeon_device *rdev) - list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { - radeon_crtc = to_radeon_crtc(crtc); - if (crtc->enabled && radeon_crtc->enabled && radeon_crtc->hw_mode.clock) { -- vrefresh = radeon_crtc->hw_mode.vrefresh; -+ vrefresh = drm_mode_vrefresh(&radeon_crtc->hw_mode); - break; - } - } -diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c b/drivers/gpu/drm/radeon/radeon_atombios.c -index e2de749..2fa3cf6 100644 ---- a/drivers/gpu/drm/radeon/radeon_atombios.c -+++ b/drivers/gpu/drm/radeon/radeon_atombios.c -@@ -3272,6 +3272,7 @@ int radeon_atom_get_voltage_evv(struct radeon_device *rdev, - - args.in.ucVoltageType = VOLTAGE_TYPE_VDDC; - args.in.ucVoltageMode = ATOM_GET_VOLTAGE_EVV_VOLTAGE; -+ args.in.usVoltageLevel = cpu_to_le16(virtual_voltage_id); - args.in.ulSCLKFreq = - cpu_to_le32(rdev->pm.dpm.dyn_state.vddc_dependency_on_sclk.entries[entry_id].clk); - -diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c -index 4b87bb1..a413f76 100644 ---- a/drivers/hid/hid-input.c -+++ b/drivers/hid/hid-input.c -@@ -1066,6 +1066,23 @@ void hidinput_hid_event(struct hid_device *hid, struct hid_field *field, struct - return; - } - -+ /* -+ * Ignore reports for absolute data if the data didn't change. This is -+ * not only an optimization but also fixes 'dead' key reports. Some -+ * RollOver implementations for localized keys (like BACKSLASH/PIPE; HID -+ * 0x31 and 0x32) report multiple keys, even though a localized keyboard -+ * can only have one of them physically available. The 'dead' keys -+ * report constant 0. As all map to the same keycode, they'd confuse -+ * the input layer. If we filter the 'dead' keys on the HID level, we -+ * skip the keycode translation and only forward real events. -+ */ -+ if (!(field->flags & (HID_MAIN_ITEM_RELATIVE | -+ HID_MAIN_ITEM_BUFFERED_BYTE)) && -+ (field->flags & HID_MAIN_ITEM_VARIABLE) && -+ usage->usage_index < field->maxusage && -+ value == field->value[usage->usage_index]) -+ return; -+ - /* report the usage code as scancode if the key status has changed */ - if (usage->type == EV_KEY && !!test_bit(usage->code, input->key) != value) - input_event(input, EV_MSC, MSC_SCAN, usage->hid); -diff --git a/drivers/iio/adc/mcp3422.c b/drivers/iio/adc/mcp3422.c -index 47dcb34..3a615f3 100644 ---- a/drivers/iio/adc/mcp3422.c -+++ b/drivers/iio/adc/mcp3422.c -@@ -57,20 +57,11 @@ - .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SAMP_FREQ), \ - } - --/* LSB is in nV to eliminate floating point */ --static const u32 rates_to_lsb[] = {1000000, 250000, 62500, 15625}; -- --/* -- * scales calculated as: -- * rates_to_lsb[sample_rate] / (1 << pga); -- * pga is 1 for 0, 2 -- */ -- - static const int mcp3422_scales[4][4] = { -- { 1000000, 250000, 62500, 15625 }, -- { 500000 , 125000, 31250, 7812 }, -- { 250000 , 62500 , 15625, 3906 }, -- { 125000 , 31250 , 7812 , 1953 } }; -+ { 1000000, 500000, 250000, 125000 }, -+ { 250000 , 125000, 62500 , 31250 }, -+ { 62500 , 31250 , 15625 , 7812 }, -+ { 15625 , 7812 , 3906 , 1953 } }; - - /* Constant msleep times for data acquisitions */ - static const int mcp3422_read_times[4] = { -diff --git a/drivers/iio/dac/ad5686.c b/drivers/iio/dac/ad5686.c -index 17aca4d..861ba3d 100644 ---- a/drivers/iio/dac/ad5686.c -+++ b/drivers/iio/dac/ad5686.c -@@ -322,7 +322,7 @@ static int ad5686_probe(struct spi_device *spi) - st = iio_priv(indio_dev); - spi_set_drvdata(spi, indio_dev); - -- st->reg = devm_regulator_get(&spi->dev, "vcc"); -+ st->reg = devm_regulator_get_optional(&spi->dev, "vcc"); - if (!IS_ERR(st->reg)) { - ret = regulator_enable(st->reg); - if (ret) -diff --git a/drivers/iio/imu/adis16400_core.c b/drivers/iio/imu/adis16400_core.c -index 7c582f7..70753bf 100644 ---- a/drivers/iio/imu/adis16400_core.c -+++ b/drivers/iio/imu/adis16400_core.c -@@ -26,6 +26,7 @@ - #include <linux/list.h> - #include <linux/module.h> - #include <linux/debugfs.h> -+#include <linux/bitops.h> - - #include <linux/iio/iio.h> - #include <linux/iio/sysfs.h> -@@ -447,7 +448,7 @@ static int adis16400_read_raw(struct iio_dev *indio_dev, - mutex_unlock(&indio_dev->mlock); - if (ret) - return ret; -- val16 = ((val16 & 0xFFF) << 4) >> 4; -+ val16 = sign_extend32(val16, 11); - *val = val16; - return IIO_VAL_INT; - case IIO_CHAN_INFO_OFFSET: -diff --git a/drivers/infiniband/core/ucma.c b/drivers/infiniband/core/ucma.c -index 56a4b7c..45d67e9 100644 ---- a/drivers/infiniband/core/ucma.c -+++ b/drivers/infiniband/core/ucma.c -@@ -1124,6 +1124,9 @@ static int ucma_set_ib_path(struct ucma_context *ctx, - if (!optlen) - return -EINVAL; - -+ memset(&sa_path, 0, sizeof(sa_path)); -+ sa_path.vlan_id = 0xffff; -+ - ib_sa_unpack_path(path_data->path_rec, &sa_path); - ret = rdma_set_ib_paths(ctx->cm_id, &sa_path, 1); - if (ret) -diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c -index 23467a2..2adc143 100644 ---- a/drivers/infiniband/core/uverbs_cmd.c -+++ b/drivers/infiniband/core/uverbs_cmd.c -@@ -1964,20 +1964,21 @@ ssize_t ib_uverbs_modify_qp(struct ib_uverbs_file *file, - if (qp->real_qp == qp) { - ret = ib_resolve_eth_l2_attrs(qp, attr, &cmd.attr_mask); - if (ret) -- goto out; -+ goto release_qp; - ret = qp->device->modify_qp(qp, attr, - modify_qp_mask(qp->qp_type, cmd.attr_mask), &udata); - } else { - ret = ib_modify_qp(qp, attr, modify_qp_mask(qp->qp_type, cmd.attr_mask)); - } - -- put_qp_read(qp); -- - if (ret) -- goto out; -+ goto release_qp; - - ret = in_len; - -+release_qp: -+ put_qp_read(qp); -+ - out: - kfree(attr); - -diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c -index 11f0606..1a3d924 100644 ---- a/drivers/infiniband/hw/mlx4/main.c -+++ b/drivers/infiniband/hw/mlx4/main.c -@@ -1161,8 +1161,7 @@ static int mlx4_ib_mcg_attach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid) - struct mlx4_ib_qp *mqp = to_mqp(ibqp); - u64 reg_id; - struct mlx4_ib_steering *ib_steering = NULL; -- enum mlx4_protocol prot = (gid->raw[1] == 0x0e) ? -- MLX4_PROT_IB_IPV4 : MLX4_PROT_IB_IPV6; -+ enum mlx4_protocol prot = MLX4_PROT_IB_IPV6; - - if (mdev->dev->caps.steering_mode == - MLX4_STEERING_MODE_DEVICE_MANAGED) { -@@ -1175,8 +1174,10 @@ static int mlx4_ib_mcg_attach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid) - !!(mqp->flags & - MLX4_IB_QP_BLOCK_MULTICAST_LOOPBACK), - prot, &reg_id); -- if (err) -+ if (err) { -+ pr_err("multicast attach op failed, err %d\n", err); - goto err_malloc; -+ } - - err = add_gid_entry(ibqp, gid); - if (err) -@@ -1224,8 +1225,7 @@ static int mlx4_ib_mcg_detach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid) - struct net_device *ndev; - struct mlx4_ib_gid_entry *ge; - u64 reg_id = 0; -- enum mlx4_protocol prot = (gid->raw[1] == 0x0e) ? -- MLX4_PROT_IB_IPV4 : MLX4_PROT_IB_IPV6; -+ enum mlx4_protocol prot = MLX4_PROT_IB_IPV6; - - if (mdev->dev->caps.steering_mode == - MLX4_STEERING_MODE_DEVICE_MANAGED) { -diff --git a/drivers/infiniband/hw/qib/qib.h b/drivers/infiniband/hw/qib/qib.h -index 1946101..675d3c7 100644 ---- a/drivers/infiniband/hw/qib/qib.h -+++ b/drivers/infiniband/hw/qib/qib.h -@@ -1080,12 +1080,6 @@ struct qib_devdata { - /* control high-level access to EEPROM */ - struct mutex eep_lock; - uint64_t traffic_wds; -- /* active time is kept in seconds, but logged in hours */ -- atomic_t active_time; -- /* Below are nominal shadow of EEPROM, new since last EEPROM update */ -- uint8_t eep_st_errs[QIB_EEP_LOG_CNT]; -- uint8_t eep_st_new_errs[QIB_EEP_LOG_CNT]; -- uint16_t eep_hrs; - /* - * masks for which bits of errs, hwerrs that cause - * each of the counters to increment. -@@ -1307,8 +1301,7 @@ int qib_twsi_blk_rd(struct qib_devdata *dd, int dev, int addr, void *buffer, - int qib_twsi_blk_wr(struct qib_devdata *dd, int dev, int addr, - const void *buffer, int len); - void qib_get_eeprom_info(struct qib_devdata *); --int qib_update_eeprom_log(struct qib_devdata *dd); --void qib_inc_eeprom_err(struct qib_devdata *dd, u32 eidx, u32 incr); -+#define qib_inc_eeprom_err(dd, eidx, incr) - void qib_dump_lookup_output_queue(struct qib_devdata *); - void qib_force_pio_avail_update(struct qib_devdata *); - void qib_clear_symerror_on_linkup(unsigned long opaque); -diff --git a/drivers/infiniband/hw/qib/qib_eeprom.c b/drivers/infiniband/hw/qib/qib_eeprom.c -index 4d5d71a..e2280b0 100644 ---- a/drivers/infiniband/hw/qib/qib_eeprom.c -+++ b/drivers/infiniband/hw/qib/qib_eeprom.c -@@ -267,190 +267,9 @@ void qib_get_eeprom_info(struct qib_devdata *dd) - "Board SN %s did not pass functional test: %s\n", - dd->serial, ifp->if_comment); - -- memcpy(&dd->eep_st_errs, &ifp->if_errcntp, QIB_EEP_LOG_CNT); -- /* -- * Power-on (actually "active") hours are kept as little-endian value -- * in EEPROM, but as seconds in a (possibly as small as 24-bit) -- * atomic_t while running. -- */ -- atomic_set(&dd->active_time, 0); -- dd->eep_hrs = ifp->if_powerhour[0] | (ifp->if_powerhour[1] << 8); -- - done: - vfree(buf); - - bail:; - } - --/** -- * qib_update_eeprom_log - copy active-time and error counters to eeprom -- * @dd: the qlogic_ib device -- * -- * Although the time is kept as seconds in the qib_devdata struct, it is -- * rounded to hours for re-write, as we have only 16 bits in EEPROM. -- * First-cut code reads whole (expected) struct qib_flash, modifies, -- * re-writes. Future direction: read/write only what we need, assuming -- * that the EEPROM had to have been "good enough" for driver init, and -- * if not, we aren't making it worse. -- * -- */ --int qib_update_eeprom_log(struct qib_devdata *dd) --{ -- void *buf; -- struct qib_flash *ifp; -- int len, hi_water; -- uint32_t new_time, new_hrs; -- u8 csum; -- int ret, idx; -- unsigned long flags; -- -- /* first, check if we actually need to do anything. */ -- ret = 0; -- for (idx = 0; idx < QIB_EEP_LOG_CNT; ++idx) { -- if (dd->eep_st_new_errs[idx]) { -- ret = 1; -- break; -- } -- } -- new_time = atomic_read(&dd->active_time); -- -- if (ret == 0 && new_time < 3600) -- goto bail; -- -- /* -- * The quick-check above determined that there is something worthy -- * of logging, so get current contents and do a more detailed idea. -- * read full flash, not just currently used part, since it may have -- * been written with a newer definition -- */ -- len = sizeof(struct qib_flash); -- buf = vmalloc(len); -- ret = 1; -- if (!buf) { -- qib_dev_err(dd, -- "Couldn't allocate memory to read %u bytes from eeprom for logging\n", -- len); -- goto bail; -- } -- -- /* Grab semaphore and read current EEPROM. If we get an -- * error, let go, but if not, keep it until we finish write. -- */ -- ret = mutex_lock_interruptible(&dd->eep_lock); -- if (ret) { -- qib_dev_err(dd, "Unable to acquire EEPROM for logging\n"); -- goto free_bail; -- } -- ret = qib_twsi_blk_rd(dd, dd->twsi_eeprom_dev, 0, buf, len); -- if (ret) { -- mutex_unlock(&dd->eep_lock); -- qib_dev_err(dd, "Unable read EEPROM for logging\n"); -- goto free_bail; -- } -- ifp = (struct qib_flash *)buf; -- -- csum = flash_csum(ifp, 0); -- if (csum != ifp->if_csum) { -- mutex_unlock(&dd->eep_lock); -- qib_dev_err(dd, "EEPROM cks err (0x%02X, S/B 0x%02X)\n", -- csum, ifp->if_csum); -- ret = 1; -- goto free_bail; -- } -- hi_water = 0; -- spin_lock_irqsave(&dd->eep_st_lock, flags); -- for (idx = 0; idx < QIB_EEP_LOG_CNT; ++idx) { -- int new_val = dd->eep_st_new_errs[idx]; -- if (new_val) { -- /* -- * If we have seen any errors, add to EEPROM values -- * We need to saturate at 0xFF (255) and we also -- * would need to adjust the checksum if we were -- * trying to minimize EEPROM traffic -- * Note that we add to actual current count in EEPROM, -- * in case it was altered while we were running. -- */ -- new_val += ifp->if_errcntp[idx]; -- if (new_val > 0xFF) -- new_val = 0xFF; -- if (ifp->if_errcntp[idx] != new_val) { -- ifp->if_errcntp[idx] = new_val; -- hi_water = offsetof(struct qib_flash, -- if_errcntp) + idx; -- } -- /* -- * update our shadow (used to minimize EEPROM -- * traffic), to match what we are about to write. -- */ -- dd->eep_st_errs[idx] = new_val; -- dd->eep_st_new_errs[idx] = 0; -- } -- } -- /* -- * Now update active-time. We would like to round to the nearest hour -- * but unless atomic_t are sure to be proper signed ints we cannot, -- * because we need to account for what we "transfer" to EEPROM and -- * if we log an hour at 31 minutes, then we would need to set -- * active_time to -29 to accurately count the _next_ hour. -- */ -- if (new_time >= 3600) { -- new_hrs = new_time / 3600; -- atomic_sub((new_hrs * 3600), &dd->active_time); -- new_hrs += dd->eep_hrs; -- if (new_hrs > 0xFFFF) -- new_hrs = 0xFFFF; -- dd->eep_hrs = new_hrs; -- if ((new_hrs & 0xFF) != ifp->if_powerhour[0]) { -- ifp->if_powerhour[0] = new_hrs & 0xFF; -- hi_water = offsetof(struct qib_flash, if_powerhour); -- } -- if ((new_hrs >> 8) != ifp->if_powerhour[1]) { -- ifp->if_powerhour[1] = new_hrs >> 8; -- hi_water = offsetof(struct qib_flash, if_powerhour) + 1; -- } -- } -- /* -- * There is a tiny possibility that we could somehow fail to write -- * the EEPROM after updating our shadows, but problems from holding -- * the spinlock too long are a much bigger issue. -- */ -- spin_unlock_irqrestore(&dd->eep_st_lock, flags); -- if (hi_water) { -- /* we made some change to the data, uopdate cksum and write */ -- csum = flash_csum(ifp, 1); -- ret = eeprom_write_with_enable(dd, 0, buf, hi_water + 1); -- } -- mutex_unlock(&dd->eep_lock); -- if (ret) -- qib_dev_err(dd, "Failed updating EEPROM\n"); -- --free_bail: -- vfree(buf); --bail: -- return ret; --} -- --/** -- * qib_inc_eeprom_err - increment one of the four error counters -- * that are logged to EEPROM. -- * @dd: the qlogic_ib device -- * @eidx: 0..3, the counter to increment -- * @incr: how much to add -- * -- * Each counter is 8-bits, and saturates at 255 (0xFF). They -- * are copied to the EEPROM (aka flash) whenever qib_update_eeprom_log() -- * is called, but it can only be called in a context that allows sleep. -- * This function can be called even at interrupt level. -- */ --void qib_inc_eeprom_err(struct qib_devdata *dd, u32 eidx, u32 incr) --{ -- uint new_val; -- unsigned long flags; -- -- spin_lock_irqsave(&dd->eep_st_lock, flags); -- new_val = dd->eep_st_new_errs[eidx] + incr; -- if (new_val > 255) -- new_val = 255; -- dd->eep_st_new_errs[eidx] = new_val; -- spin_unlock_irqrestore(&dd->eep_st_lock, flags); --} -diff --git a/drivers/infiniband/hw/qib/qib_iba6120.c b/drivers/infiniband/hw/qib/qib_iba6120.c -index 84e593d..295f631 100644 ---- a/drivers/infiniband/hw/qib/qib_iba6120.c -+++ b/drivers/infiniband/hw/qib/qib_iba6120.c -@@ -2682,8 +2682,6 @@ static void qib_get_6120_faststats(unsigned long opaque) - spin_lock_irqsave(&dd->eep_st_lock, flags); - traffic_wds -= dd->traffic_wds; - dd->traffic_wds += traffic_wds; -- if (traffic_wds >= QIB_TRAFFIC_ACTIVE_THRESHOLD) -- atomic_add(5, &dd->active_time); /* S/B #define */ - spin_unlock_irqrestore(&dd->eep_st_lock, flags); - - qib_chk_6120_errormask(dd); -diff --git a/drivers/infiniband/hw/qib/qib_iba7220.c b/drivers/infiniband/hw/qib/qib_iba7220.c -index 454c2e7..c86e71b 100644 ---- a/drivers/infiniband/hw/qib/qib_iba7220.c -+++ b/drivers/infiniband/hw/qib/qib_iba7220.c -@@ -3299,8 +3299,6 @@ static void qib_get_7220_faststats(unsigned long opaque) - spin_lock_irqsave(&dd->eep_st_lock, flags); - traffic_wds -= dd->traffic_wds; - dd->traffic_wds += traffic_wds; -- if (traffic_wds >= QIB_TRAFFIC_ACTIVE_THRESHOLD) -- atomic_add(5, &dd->active_time); /* S/B #define */ - spin_unlock_irqrestore(&dd->eep_st_lock, flags); - done: - mod_timer(&dd->stats_timer, jiffies + HZ * ACTIVITY_TIMER); -diff --git a/drivers/infiniband/hw/qib/qib_iba7322.c b/drivers/infiniband/hw/qib/qib_iba7322.c -index d1bd213..0f8d1f0 100644 ---- a/drivers/infiniband/hw/qib/qib_iba7322.c -+++ b/drivers/infiniband/hw/qib/qib_iba7322.c -@@ -5191,8 +5191,6 @@ static void qib_get_7322_faststats(unsigned long opaque) - spin_lock_irqsave(&ppd->dd->eep_st_lock, flags); - traffic_wds -= ppd->dd->traffic_wds; - ppd->dd->traffic_wds += traffic_wds; -- if (traffic_wds >= QIB_TRAFFIC_ACTIVE_THRESHOLD) -- atomic_add(ACTIVITY_TIMER, &ppd->dd->active_time); - spin_unlock_irqrestore(&ppd->dd->eep_st_lock, flags); - if (ppd->cpspec->qdr_dfe_on && (ppd->link_speed_active & - QIB_IB_QDR) && -diff --git a/drivers/infiniband/hw/qib/qib_init.c b/drivers/infiniband/hw/qib/qib_init.c -index 76c3e17..8c9bb6c 100644 ---- a/drivers/infiniband/hw/qib/qib_init.c -+++ b/drivers/infiniband/hw/qib/qib_init.c -@@ -922,7 +922,6 @@ static void qib_shutdown_device(struct qib_devdata *dd) - } - } - -- qib_update_eeprom_log(dd); - } - - /** -diff --git a/drivers/infiniband/hw/qib/qib_sysfs.c b/drivers/infiniband/hw/qib/qib_sysfs.c -index 3c8e4e3..b9ccbda 100644 ---- a/drivers/infiniband/hw/qib/qib_sysfs.c -+++ b/drivers/infiniband/hw/qib/qib_sysfs.c -@@ -611,28 +611,6 @@ bail: - return ret < 0 ? ret : count; - } - --static ssize_t show_logged_errs(struct device *device, -- struct device_attribute *attr, char *buf) --{ -- struct qib_ibdev *dev = -- container_of(device, struct qib_ibdev, ibdev.dev); -- struct qib_devdata *dd = dd_from_dev(dev); -- int idx, count; -- -- /* force consistency with actual EEPROM */ -- if (qib_update_eeprom_log(dd) != 0) -- return -ENXIO; -- -- count = 0; -- for (idx = 0; idx < QIB_EEP_LOG_CNT; ++idx) { -- count += scnprintf(buf + count, PAGE_SIZE - count, "%d%c", -- dd->eep_st_errs[idx], -- idx == (QIB_EEP_LOG_CNT - 1) ? '\n' : ' '); -- } -- -- return count; --} -- - /* - * Dump tempsense regs. in decimal, to ease shell-scripts. - */ -@@ -679,7 +657,6 @@ static DEVICE_ATTR(nctxts, S_IRUGO, show_nctxts, NULL); - static DEVICE_ATTR(nfreectxts, S_IRUGO, show_nfreectxts, NULL); - static DEVICE_ATTR(serial, S_IRUGO, show_serial, NULL); - static DEVICE_ATTR(boardversion, S_IRUGO, show_boardversion, NULL); --static DEVICE_ATTR(logged_errors, S_IRUGO, show_logged_errs, NULL); - static DEVICE_ATTR(tempsense, S_IRUGO, show_tempsense, NULL); - static DEVICE_ATTR(localbus_info, S_IRUGO, show_localbus_info, NULL); - static DEVICE_ATTR(chip_reset, S_IWUSR, NULL, store_chip_reset); -@@ -693,7 +670,6 @@ static struct device_attribute *qib_attributes[] = { - &dev_attr_nfreectxts, - &dev_attr_serial, - &dev_attr_boardversion, -- &dev_attr_logged_errors, - &dev_attr_tempsense, - &dev_attr_localbus_info, - &dev_attr_chip_reset, -diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c -index 05f371d..d4b0a31 100644 ---- a/drivers/input/tablet/wacom_wac.c -+++ b/drivers/input/tablet/wacom_wac.c -@@ -700,6 +700,12 @@ static int wacom_intuos_irq(struct wacom_wac *wacom) - input_report_key(input, BTN_7, (data[4] & 0x40)); /* Left */ - input_report_key(input, BTN_8, (data[4] & 0x80)); /* Down */ - input_report_key(input, BTN_0, (data[3] & 0x01)); /* Center */ -+ -+ if (data[4] | (data[3] & 0x01)) { -+ input_report_abs(input, ABS_MISC, PAD_DEVICE_ID); -+ } else { -+ input_report_abs(input, ABS_MISC, 0); -+ } - } else if (features->type >= INTUOS5S && features->type <= INTUOSPL) { - int i; - -diff --git a/drivers/md/dm-io.c b/drivers/md/dm-io.c -index db404a0..d2a8d64 100644 ---- a/drivers/md/dm-io.c -+++ b/drivers/md/dm-io.c -@@ -292,6 +292,12 @@ static void do_region(int rw, unsigned region, struct dm_io_region *where, - unsigned short logical_block_size = queue_logical_block_size(q); - sector_t num_sectors; - -+ /* Reject unsupported discard requests */ -+ if ((rw & REQ_DISCARD) && !blk_queue_discard(q)) { -+ dec_count(io, region, -EOPNOTSUPP); -+ return; -+ } -+ - /* - * where->count may be zero if rw holds a flush and we need to - * send a zero-sized flush. -diff --git a/drivers/md/dm-raid1.c b/drivers/md/dm-raid1.c -index 7dfdb5c..089d627 100644 ---- a/drivers/md/dm-raid1.c -+++ b/drivers/md/dm-raid1.c -@@ -604,6 +604,15 @@ static void write_callback(unsigned long error, void *context) - return; - } - -+ /* -+ * If the bio is discard, return an error, but do not -+ * degrade the array. -+ */ -+ if (bio->bi_rw & REQ_DISCARD) { -+ bio_endio(bio, -EOPNOTSUPP); -+ return; -+ } -+ - for (i = 0; i < ms->nr_mirrors; i++) - if (test_bit(i, &error)) - fail_mirror(ms->mirror + i, DM_RAID1_WRITE_ERROR); -diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c -index ebddef5..c356a10 100644 ---- a/drivers/md/dm-snap.c -+++ b/drivers/md/dm-snap.c -@@ -1440,8 +1440,6 @@ out: - full_bio->bi_private = pe->full_bio_private; - atomic_inc(&full_bio->bi_remaining); - } -- free_pending_exception(pe); -- - increment_pending_exceptions_done_count(); - - up_write(&s->lock); -@@ -1458,6 +1456,8 @@ out: - } - - retry_origin_bios(s, origin_bios); -+ -+ free_pending_exception(pe); - } - - static void commit_callback(void *context, int success) -diff --git a/drivers/md/dm.c b/drivers/md/dm.c -index 65ee3a0..1582c3da 100644 ---- a/drivers/md/dm.c -+++ b/drivers/md/dm.c -@@ -2288,7 +2288,7 @@ int dm_setup_md_queue(struct mapped_device *md) - return 0; - } - --static struct mapped_device *dm_find_md(dev_t dev) -+struct mapped_device *dm_get_md(dev_t dev) - { - struct mapped_device *md; - unsigned minor = MINOR(dev); -@@ -2299,12 +2299,15 @@ static struct mapped_device *dm_find_md(dev_t dev) - spin_lock(&_minor_lock); - - md = idr_find(&_minor_idr, minor); -- if (md && (md == MINOR_ALLOCED || -- (MINOR(disk_devt(dm_disk(md))) != minor) || -- dm_deleting_md(md) || -- test_bit(DMF_FREEING, &md->flags))) { -- md = NULL; -- goto out; -+ if (md) { -+ if ((md == MINOR_ALLOCED || -+ (MINOR(disk_devt(dm_disk(md))) != minor) || -+ dm_deleting_md(md) || -+ test_bit(DMF_FREEING, &md->flags))) { -+ md = NULL; -+ goto out; -+ } -+ dm_get(md); - } - - out: -@@ -2312,16 +2315,6 @@ out: - - return md; - } -- --struct mapped_device *dm_get_md(dev_t dev) --{ -- struct mapped_device *md = dm_find_md(dev); -- -- if (md) -- dm_get(md); -- -- return md; --} - EXPORT_SYMBOL_GPL(dm_get_md); - - void *dm_get_mdptr(struct mapped_device *md) -diff --git a/drivers/misc/mei/init.c b/drivers/misc/mei/init.c -index cdd31c2..b296538 100644 ---- a/drivers/misc/mei/init.c -+++ b/drivers/misc/mei/init.c -@@ -275,6 +275,8 @@ void mei_stop(struct mei_device *dev) - - dev->dev_state = MEI_DEV_POWER_DOWN; - mei_reset(dev); -+ /* move device to disabled state unconditionally */ -+ dev->dev_state = MEI_DEV_DISABLED; - - mutex_unlock(&dev->device_lock); - -diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c -index 07c942b..e8c21f9 100644 ---- a/drivers/net/macvtap.c -+++ b/drivers/net/macvtap.c -@@ -637,12 +637,15 @@ static void macvtap_skb_to_vnet_hdr(const struct sk_buff *skb, - } /* else everything is zero */ - } - -+/* Neighbour code has some assumptions on HH_DATA_MOD alignment */ -+#define MACVTAP_RESERVE HH_DATA_OFF(ETH_HLEN) -+ - /* Get packet from user space buffer */ - static ssize_t macvtap_get_user(struct macvtap_queue *q, struct msghdr *m, - const struct iovec *iv, unsigned long total_len, - size_t count, int noblock) - { -- int good_linear = SKB_MAX_HEAD(NET_IP_ALIGN); -+ int good_linear = SKB_MAX_HEAD(MACVTAP_RESERVE); - struct sk_buff *skb; - struct macvlan_dev *vlan; - unsigned long len = total_len; -@@ -701,7 +704,7 @@ static ssize_t macvtap_get_user(struct macvtap_queue *q, struct msghdr *m, - linear = vnet_hdr.hdr_len; - } - -- skb = macvtap_alloc_skb(&q->sk, NET_IP_ALIGN, copylen, -+ skb = macvtap_alloc_skb(&q->sk, MACVTAP_RESERVE, copylen, - linear, noblock, &err); - if (!skb) - goto err; -diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c -index 76d96b9..1d56878 100644 ---- a/drivers/net/phy/phy.c -+++ b/drivers/net/phy/phy.c -@@ -194,6 +194,25 @@ static inline unsigned int phy_find_valid(unsigned int idx, u32 features) - } - - /** -+ * phy_check_valid - check if there is a valid PHY setting which matches -+ * speed, duplex, and feature mask -+ * @speed: speed to match -+ * @duplex: duplex to match -+ * @features: A mask of the valid settings -+ * -+ * Description: Returns true if there is a valid setting, false otherwise. -+ */ -+static inline bool phy_check_valid(int speed, int duplex, u32 features) -+{ -+ unsigned int idx; -+ -+ idx = phy_find_valid(phy_find_setting(speed, duplex), features); -+ -+ return settings[idx].speed == speed && settings[idx].duplex == duplex && -+ (settings[idx].setting & features); -+} -+ -+/** - * phy_sanitize_settings - make sure the PHY is set to supported speed and duplex - * @phydev: the target phy_device struct - * -@@ -955,7 +974,6 @@ int phy_init_eee(struct phy_device *phydev, bool clk_stop_enable) - int eee_lp, eee_cap, eee_adv; - u32 lp, cap, adv; - int status; -- unsigned int idx; - - /* Read phy status to properly get the right settings */ - status = phy_read_status(phydev); -@@ -987,8 +1005,7 @@ int phy_init_eee(struct phy_device *phydev, bool clk_stop_enable) - - adv = mmd_eee_adv_to_ethtool_adv_t(eee_adv); - lp = mmd_eee_adv_to_ethtool_adv_t(eee_lp); -- idx = phy_find_setting(phydev->speed, phydev->duplex); -- if (!(lp & adv & settings[idx].setting)) -+ if (!phy_check_valid(phydev->speed, phydev->duplex, lp & adv)) - return -EPROTONOSUPPORT; - - if (clk_stop_enable) { -diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c -index 32efe83..c28e2da 100644 ---- a/drivers/net/team/team.c -+++ b/drivers/net/team/team.c -@@ -42,9 +42,7 @@ - - static struct team_port *team_port_get_rcu(const struct net_device *dev) - { -- struct team_port *port = rcu_dereference(dev->rx_handler_data); -- -- return team_port_exists(dev) ? port : NULL; -+ return rcu_dereference(dev->rx_handler_data); - } - - static struct team_port *team_port_get_rtnl(const struct net_device *dev) -@@ -1725,11 +1723,11 @@ static int team_set_mac_address(struct net_device *dev, void *p) - if (dev->type == ARPHRD_ETHER && !is_valid_ether_addr(addr->sa_data)) - return -EADDRNOTAVAIL; - memcpy(dev->dev_addr, addr->sa_data, dev->addr_len); -- rcu_read_lock(); -- list_for_each_entry_rcu(port, &team->port_list, list) -+ mutex_lock(&team->lock); -+ list_for_each_entry(port, &team->port_list, list) - if (team->ops.port_change_dev_addr) - team->ops.port_change_dev_addr(team, port); -- rcu_read_unlock(); -+ mutex_unlock(&team->lock); - return 0; - } - -diff --git a/drivers/net/usb/plusb.c b/drivers/net/usb/plusb.c -index 3d18bb0..1bfe0fc 100644 ---- a/drivers/net/usb/plusb.c -+++ b/drivers/net/usb/plusb.c -@@ -134,6 +134,11 @@ static const struct usb_device_id products [] = { - }, { - USB_DEVICE(0x050d, 0x258a), /* Belkin F5U258/F5U279 (PL-25A1) */ - .driver_info = (unsigned long) &prolific_info, -+}, { -+ USB_DEVICE(0x3923, 0x7825), /* National Instruments USB -+ * Host-to-Host Cable -+ */ -+ .driver_info = (unsigned long) &prolific_info, - }, - - { }, // END -diff --git a/drivers/net/wireless/ath/ath5k/reset.c b/drivers/net/wireless/ath/ath5k/reset.c -index a3399c4..b9b651e 100644 ---- a/drivers/net/wireless/ath/ath5k/reset.c -+++ b/drivers/net/wireless/ath/ath5k/reset.c -@@ -478,7 +478,7 @@ ath5k_hw_wisoc_reset(struct ath5k_hw *ah, u32 flags) - regval = ioread32(reg); - iowrite32(regval | val, reg); - regval = ioread32(reg); -- usleep_range(100, 150); -+ udelay(100); /* NB: should be atomic */ - - /* Bring BB/MAC out of reset */ - iowrite32(regval & ~val, reg); -diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c -index 5642a9b..953bd0b 100644 ---- a/drivers/scsi/be2iscsi/be_main.c -+++ b/drivers/scsi/be2iscsi/be_main.c -@@ -581,7 +581,6 @@ static struct beiscsi_hba *beiscsi_hba_alloc(struct pci_dev *pcidev) - "beiscsi_hba_alloc - iscsi_host_alloc failed\n"); - return NULL; - } -- shost->dma_boundary = pcidev->dma_mask; - shost->max_id = BE2_MAX_SESSIONS; - shost->max_channel = 0; - shost->max_cmd_len = BEISCSI_MAX_CMD_LEN; -diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c -index df5e961..eb81c98 100644 ---- a/drivers/scsi/sg.c -+++ b/drivers/scsi/sg.c -@@ -522,7 +522,7 @@ static ssize_t - sg_new_read(Sg_fd * sfp, char __user *buf, size_t count, Sg_request * srp) - { - sg_io_hdr_t *hp = &srp->header; -- int err = 0; -+ int err = 0, err2; - int len; - - if (count < SZ_SG_IO_HDR) { -@@ -551,8 +551,8 @@ sg_new_read(Sg_fd * sfp, char __user *buf, size_t count, Sg_request * srp) - goto err_out; - } - err_out: -- err = sg_finish_rem_req(srp); -- return (0 == err) ? count : err; -+ err2 = sg_finish_rem_req(srp); -+ return err ? : err2 ? : count; - } - - static ssize_t -diff --git a/drivers/staging/comedi/comedi_compat32.c b/drivers/staging/comedi/comedi_compat32.c -index 1e9da40..5287810 100644 ---- a/drivers/staging/comedi/comedi_compat32.c -+++ b/drivers/staging/comedi/comedi_compat32.c -@@ -262,7 +262,7 @@ static int compat_cmd(struct file *file, unsigned long arg) - { - struct comedi_cmd __user *cmd; - struct comedi32_cmd_struct __user *cmd32; -- int rc; -+ int rc, err; - - cmd32 = compat_ptr(arg); - cmd = compat_alloc_user_space(sizeof(*cmd)); -@@ -271,7 +271,15 @@ static int compat_cmd(struct file *file, unsigned long arg) - if (rc) - return rc; - -- return translated_ioctl(file, COMEDI_CMD, (unsigned long)cmd); -+ rc = translated_ioctl(file, COMEDI_CMD, (unsigned long)cmd); -+ if (rc == -EAGAIN) { -+ /* Special case: copy cmd back to user. */ -+ err = put_compat_cmd(cmd32, cmd); -+ if (err) -+ rc = err; -+ } -+ -+ return rc; - } - - /* Handle 32-bit COMEDI_CMDTEST ioctl. */ -diff --git a/drivers/staging/comedi/drivers/cb_pcidas64.c b/drivers/staging/comedi/drivers/cb_pcidas64.c -index 4fff173..3d1cb5b 100644 ---- a/drivers/staging/comedi/drivers/cb_pcidas64.c -+++ b/drivers/staging/comedi/drivers/cb_pcidas64.c -@@ -441,6 +441,29 @@ static const struct comedi_lrange ai_ranges_64xx = { - } - }; - -+static const uint8_t ai_range_code_64xx[8] = { -+ 0x0, 0x1, 0x2, 0x3, /* bipolar 10, 5, 2,5, 1.25 */ -+ 0x8, 0x9, 0xa, 0xb /* unipolar 10, 5, 2.5, 1.25 */ -+}; -+ -+/* analog input ranges for 64-Mx boards */ -+static const struct comedi_lrange ai_ranges_64_mx = { -+ 7, { -+ BIP_RANGE(5), -+ BIP_RANGE(2.5), -+ BIP_RANGE(1.25), -+ BIP_RANGE(0.625), -+ UNI_RANGE(5), -+ UNI_RANGE(2.5), -+ UNI_RANGE(1.25) -+ } -+}; -+ -+static const uint8_t ai_range_code_64_mx[7] = { -+ 0x0, 0x1, 0x2, 0x3, /* bipolar 5, 2.5, 1.25, 0.625 */ -+ 0x9, 0xa, 0xb /* unipolar 5, 2.5, 1.25 */ -+}; -+ - /* analog input ranges for 60xx boards */ - static const struct comedi_lrange ai_ranges_60xx = { - 4, { -@@ -451,6 +474,10 @@ static const struct comedi_lrange ai_ranges_60xx = { - } - }; - -+static const uint8_t ai_range_code_60xx[4] = { -+ 0x0, 0x1, 0x4, 0x7 /* bipolar 10, 5, 0.5, 0.05 */ -+}; -+ - /* analog input ranges for 6030, etc boards */ - static const struct comedi_lrange ai_ranges_6030 = { - 14, { -@@ -471,6 +498,11 @@ static const struct comedi_lrange ai_ranges_6030 = { - } - }; - -+static const uint8_t ai_range_code_6030[14] = { -+ 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, /* bip 10, 5, 2, 1, 0.5, 0.2, 0.1 */ -+ 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf /* uni 10, 5, 2, 1, 0.5, 0.2, 0.1 */ -+}; -+ - /* analog input ranges for 6052, etc boards */ - static const struct comedi_lrange ai_ranges_6052 = { - 15, { -@@ -492,6 +524,11 @@ static const struct comedi_lrange ai_ranges_6052 = { - } - }; - -+static const uint8_t ai_range_code_6052[15] = { -+ 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, /* bipolar 10 ... 0.05 */ -+ 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf /* unipolar 10 ... 0.1 */ -+}; -+ - /* analog input ranges for 4020 board */ - static const struct comedi_lrange ai_ranges_4020 = { - 2, { -@@ -595,6 +632,7 @@ struct pcidas64_board { - int ai_bits; /* analog input resolution */ - int ai_speed; /* fastest conversion period in ns */ - const struct comedi_lrange *ai_range_table; -+ const uint8_t *ai_range_code; - int ao_nchan; /* number of analog out channels */ - int ao_bits; /* analog output resolution */ - int ao_scan_speed; /* analog output scan speed */ -@@ -653,6 +691,7 @@ static const struct pcidas64_board pcidas64_boards[] = { - .ao_scan_speed = 10000, - .layout = LAYOUT_64XX, - .ai_range_table = &ai_ranges_64xx, -+ .ai_range_code = ai_range_code_64xx, - .ao_range_table = &ao_ranges_64xx, - .ao_range_code = ao_range_code_64xx, - .ai_fifo = &ai_fifo_64xx, -@@ -668,6 +707,7 @@ static const struct pcidas64_board pcidas64_boards[] = { - .ao_scan_speed = 10000, - .layout = LAYOUT_64XX, - .ai_range_table = &ai_ranges_64xx, -+ .ai_range_code = ai_range_code_64xx, - .ao_range_table = &ao_ranges_64xx, - .ao_range_code = ao_range_code_64xx, - .ai_fifo = &ai_fifo_64xx, -@@ -682,7 +722,8 @@ static const struct pcidas64_board pcidas64_boards[] = { - .ao_bits = 16, - .ao_scan_speed = 10000, - .layout = LAYOUT_64XX, -- .ai_range_table = &ai_ranges_64xx, -+ .ai_range_table = &ai_ranges_64_mx, -+ .ai_range_code = ai_range_code_64_mx, - .ao_range_table = &ao_ranges_64xx, - .ao_range_code = ao_range_code_64xx, - .ai_fifo = &ai_fifo_64xx, -@@ -697,7 +738,8 @@ static const struct pcidas64_board pcidas64_boards[] = { - .ao_bits = 16, - .ao_scan_speed = 10000, - .layout = LAYOUT_64XX, -- .ai_range_table = &ai_ranges_64xx, -+ .ai_range_table = &ai_ranges_64_mx, -+ .ai_range_code = ai_range_code_64_mx, - .ao_range_table = &ao_ranges_64xx, - .ao_range_code = ao_range_code_64xx, - .ai_fifo = &ai_fifo_64xx, -@@ -712,7 +754,8 @@ static const struct pcidas64_board pcidas64_boards[] = { - .ao_bits = 16, - .ao_scan_speed = 10000, - .layout = LAYOUT_64XX, -- .ai_range_table = &ai_ranges_64xx, -+ .ai_range_table = &ai_ranges_64_mx, -+ .ai_range_code = ai_range_code_64_mx, - .ao_range_table = &ao_ranges_64xx, - .ao_range_code = ao_range_code_64xx, - .ai_fifo = &ai_fifo_64xx, -@@ -727,6 +770,7 @@ static const struct pcidas64_board pcidas64_boards[] = { - .ao_bits = 16, - .layout = LAYOUT_60XX, - .ai_range_table = &ai_ranges_60xx, -+ .ai_range_code = ai_range_code_60xx, - .ao_range_table = &range_bipolar10, - .ao_range_code = ao_range_code_60xx, - .ai_fifo = &ai_fifo_60xx, -@@ -742,6 +786,7 @@ static const struct pcidas64_board pcidas64_boards[] = { - .ao_scan_speed = 100000, - .layout = LAYOUT_60XX, - .ai_range_table = &ai_ranges_60xx, -+ .ai_range_code = ai_range_code_60xx, - .ao_range_table = &range_bipolar10, - .ao_range_code = ao_range_code_60xx, - .ai_fifo = &ai_fifo_60xx, -@@ -756,6 +801,7 @@ static const struct pcidas64_board pcidas64_boards[] = { - .ao_scan_speed = 100000, - .layout = LAYOUT_60XX, - .ai_range_table = &ai_ranges_60xx, -+ .ai_range_code = ai_range_code_60xx, - .ao_range_table = &range_bipolar10, - .ao_range_code = ao_range_code_60xx, - .ai_fifo = &ai_fifo_60xx, -@@ -771,6 +817,7 @@ static const struct pcidas64_board pcidas64_boards[] = { - .ao_scan_speed = 100000, - .layout = LAYOUT_60XX, - .ai_range_table = &ai_ranges_60xx, -+ .ai_range_code = ai_range_code_60xx, - .ao_range_table = &range_bipolar10, - .ao_range_code = ao_range_code_60xx, - .ai_fifo = &ai_fifo_60xx, -@@ -786,6 +833,7 @@ static const struct pcidas64_board pcidas64_boards[] = { - .ao_scan_speed = 10000, - .layout = LAYOUT_60XX, - .ai_range_table = &ai_ranges_6030, -+ .ai_range_code = ai_range_code_6030, - .ao_range_table = &ao_ranges_6030, - .ao_range_code = ao_range_code_6030, - .ai_fifo = &ai_fifo_60xx, -@@ -801,6 +849,7 @@ static const struct pcidas64_board pcidas64_boards[] = { - .ao_scan_speed = 10000, - .layout = LAYOUT_60XX, - .ai_range_table = &ai_ranges_6030, -+ .ai_range_code = ai_range_code_6030, - .ao_range_table = &ao_ranges_6030, - .ao_range_code = ao_range_code_6030, - .ai_fifo = &ai_fifo_60xx, -@@ -814,6 +863,7 @@ static const struct pcidas64_board pcidas64_boards[] = { - .ao_nchan = 0, - .layout = LAYOUT_60XX, - .ai_range_table = &ai_ranges_6030, -+ .ai_range_code = ai_range_code_6030, - .ai_fifo = &ai_fifo_60xx, - .has_8255 = 0, - }, -@@ -825,6 +875,7 @@ static const struct pcidas64_board pcidas64_boards[] = { - .ao_nchan = 0, - .layout = LAYOUT_60XX, - .ai_range_table = &ai_ranges_6030, -+ .ai_range_code = ai_range_code_6030, - .ai_fifo = &ai_fifo_60xx, - .has_8255 = 0, - }, -@@ -837,6 +888,7 @@ static const struct pcidas64_board pcidas64_boards[] = { - .ao_scan_speed = 0, - .layout = LAYOUT_60XX, - .ai_range_table = &ai_ranges_60xx, -+ .ai_range_code = ai_range_code_60xx, - .ai_fifo = &ai_fifo_60xx, - .has_8255 = 0, - }, -@@ -850,6 +902,7 @@ static const struct pcidas64_board pcidas64_boards[] = { - .ao_scan_speed = 100000, - .layout = LAYOUT_60XX, - .ai_range_table = &ai_ranges_60xx, -+ .ai_range_code = ai_range_code_60xx, - .ao_range_table = &range_bipolar10, - .ao_range_code = ao_range_code_60xx, - .ai_fifo = &ai_fifo_60xx, -@@ -865,6 +918,7 @@ static const struct pcidas64_board pcidas64_boards[] = { - .ao_scan_speed = 100000, - .layout = LAYOUT_60XX, - .ai_range_table = &ai_ranges_60xx, -+ .ai_range_code = ai_range_code_60xx, - .ao_range_table = &range_bipolar10, - .ao_range_code = ao_range_code_60xx, - .ai_fifo = &ai_fifo_60xx, -@@ -880,6 +934,7 @@ static const struct pcidas64_board pcidas64_boards[] = { - .ao_scan_speed = 1000, - .layout = LAYOUT_60XX, - .ai_range_table = &ai_ranges_6052, -+ .ai_range_code = ai_range_code_6052, - .ao_range_table = &ao_ranges_6030, - .ao_range_code = ao_range_code_6030, - .ai_fifo = &ai_fifo_60xx, -@@ -895,6 +950,7 @@ static const struct pcidas64_board pcidas64_boards[] = { - .ao_scan_speed = 3333, - .layout = LAYOUT_60XX, - .ai_range_table = &ai_ranges_6052, -+ .ai_range_code = ai_range_code_6052, - .ao_range_table = &ao_ranges_6030, - .ao_range_code = ao_range_code_6030, - .ai_fifo = &ai_fifo_60xx, -@@ -910,6 +966,7 @@ static const struct pcidas64_board pcidas64_boards[] = { - .ao_scan_speed = 1000, - .layout = LAYOUT_60XX, - .ai_range_table = &ai_ranges_6052, -+ .ai_range_code = ai_range_code_6052, - .ao_range_table = &ao_ranges_6030, - .ao_range_code = ao_range_code_6030, - .ai_fifo = &ai_fifo_60xx, -@@ -925,6 +982,7 @@ static const struct pcidas64_board pcidas64_boards[] = { - .ao_scan_speed = 1000, - .layout = LAYOUT_60XX, - .ai_range_table = &ai_ranges_6052, -+ .ai_range_code = ai_range_code_6052, - .ao_range_table = &ao_ranges_6030, - .ao_range_code = ao_range_code_6030, - .ai_fifo = &ai_fifo_60xx, -@@ -959,6 +1017,7 @@ static const struct pcidas64_board pcidas64_boards[] = { - .ao_scan_speed = 10000, - .layout = LAYOUT_64XX, - .ai_range_table = &ai_ranges_64xx, -+ .ai_range_code = ai_range_code_64xx, - .ai_fifo = ai_fifo_64xx, - .has_8255 = 1, - }, -@@ -970,7 +1029,8 @@ static const struct pcidas64_board pcidas64_boards[] = { - .ao_nchan = 0, - .ao_scan_speed = 10000, - .layout = LAYOUT_64XX, -- .ai_range_table = &ai_ranges_64xx, -+ .ai_range_table = &ai_ranges_64_mx, -+ .ai_range_code = ai_range_code_64_mx, - .ai_fifo = ai_fifo_64xx, - .has_8255 = 1, - }, -@@ -982,7 +1042,8 @@ static const struct pcidas64_board pcidas64_boards[] = { - .ao_nchan = 0, - .ao_scan_speed = 10000, - .layout = LAYOUT_64XX, -- .ai_range_table = &ai_ranges_64xx, -+ .ai_range_table = &ai_ranges_64_mx, -+ .ai_range_code = ai_range_code_64_mx, - .ai_fifo = ai_fifo_64xx, - .has_8255 = 1, - }, -@@ -994,7 +1055,8 @@ static const struct pcidas64_board pcidas64_boards[] = { - .ao_nchan = 0, - .ao_scan_speed = 10000, - .layout = LAYOUT_64XX, -- .ai_range_table = &ai_ranges_64xx, -+ .ai_range_table = &ai_ranges_64_mx, -+ .ai_range_code = ai_range_code_64_mx, - .ai_fifo = ai_fifo_64xx, - .has_8255 = 1, - }, -@@ -1006,7 +1068,8 @@ static const struct pcidas64_board pcidas64_boards[] = { - .ao_nchan = 2, - .ao_scan_speed = 10000, - .layout = LAYOUT_64XX, -- .ai_range_table = &ai_ranges_64xx, -+ .ai_range_table = &ai_ranges_64_mx, -+ .ai_range_code = ai_range_code_64_mx, - .ai_fifo = ai_fifo_64xx, - .has_8255 = 1, - }, -@@ -1018,7 +1081,8 @@ static const struct pcidas64_board pcidas64_boards[] = { - .ao_nchan = 2, - .ao_scan_speed = 10000, - .layout = LAYOUT_64XX, -- .ai_range_table = &ai_ranges_64xx, -+ .ai_range_table = &ai_ranges_64_mx, -+ .ai_range_code = ai_range_code_64_mx, - .ai_fifo = ai_fifo_64xx, - .has_8255 = 1, - }, -@@ -1030,7 +1094,8 @@ static const struct pcidas64_board pcidas64_boards[] = { - .ao_nchan = 2, - .ao_scan_speed = 10000, - .layout = LAYOUT_64XX, -- .ai_range_table = &ai_ranges_64xx, -+ .ai_range_table = &ai_ranges_64_mx, -+ .ai_range_code = ai_range_code_64_mx, - .ai_fifo = ai_fifo_64xx, - .has_8255 = 1, - }, -@@ -1127,45 +1192,8 @@ static unsigned int ai_range_bits_6xxx(const struct comedi_device *dev, - unsigned int range_index) - { - const struct pcidas64_board *thisboard = comedi_board(dev); -- const struct comedi_krange *range = -- &thisboard->ai_range_table->range[range_index]; -- unsigned int bits = 0; - -- switch (range->max) { -- case 10000000: -- bits = 0x000; -- break; -- case 5000000: -- bits = 0x100; -- break; -- case 2000000: -- case 2500000: -- bits = 0x200; -- break; -- case 1000000: -- case 1250000: -- bits = 0x300; -- break; -- case 500000: -- bits = 0x400; -- break; -- case 200000: -- case 250000: -- bits = 0x500; -- break; -- case 100000: -- bits = 0x600; -- break; -- case 50000: -- bits = 0x700; -- break; -- default: -- comedi_error(dev, "bug! in ai_range_bits_6xxx"); -- break; -- } -- if (range->min == 0) -- bits += 0x900; -- return bits; -+ return thisboard->ai_range_code[range_index] << 8; - } - - static unsigned int hw_revision(const struct comedi_device *dev, -diff --git a/drivers/staging/iio/adc/mxs-lradc.c b/drivers/staging/iio/adc/mxs-lradc.c -index 9ec1df9..be89260 100644 ---- a/drivers/staging/iio/adc/mxs-lradc.c -+++ b/drivers/staging/iio/adc/mxs-lradc.c -@@ -214,11 +214,17 @@ struct mxs_lradc { - unsigned long is_divided; - - /* -- * Touchscreen LRADC channels receives a private slot in the CTRL4 -- * register, the slot #7. Therefore only 7 slots instead of 8 in the -- * CTRL4 register can be mapped to LRADC channels when using the -- * touchscreen. -- * -+ * When the touchscreen is enabled, we give it two private virtual -+ * channels: #6 and #7. This means that only 6 virtual channels (instead -+ * of 8) will be available for buffered capture. -+ */ -+#define TOUCHSCREEN_VCHANNEL1 7 -+#define TOUCHSCREEN_VCHANNEL2 6 -+#define BUFFER_VCHANS_LIMITED 0x3f -+#define BUFFER_VCHANS_ALL 0xff -+ u8 buffer_vchans; -+ -+ /* - * Furthermore, certain LRADC channels are shared between touchscreen - * and/or touch-buttons and generic LRADC block. Therefore when using - * either of these, these channels are not available for the regular -@@ -342,6 +348,9 @@ struct mxs_lradc { - #define LRADC_CTRL4 0x140 - #define LRADC_CTRL4_LRADCSELECT_MASK(n) (0xf << ((n) * 4)) - #define LRADC_CTRL4_LRADCSELECT_OFFSET(n) ((n) * 4) -+#define LRADC_CTRL4_LRADCSELECT(n, x) \ -+ (((x) << LRADC_CTRL4_LRADCSELECT_OFFSET(n)) & \ -+ LRADC_CTRL4_LRADCSELECT_MASK(n)) - - #define LRADC_RESOLUTION 12 - #define LRADC_SINGLE_SAMPLE_MASK ((1 << LRADC_RESOLUTION) - 1) -@@ -423,6 +432,14 @@ static bool mxs_lradc_check_touch_event(struct mxs_lradc *lradc) - LRADC_STATUS_TOUCH_DETECT_RAW); - } - -+static void mxs_lradc_map_channel(struct mxs_lradc *lradc, unsigned vch, -+ unsigned ch) -+{ -+ mxs_lradc_reg_clear(lradc, LRADC_CTRL4_LRADCSELECT_MASK(vch), -+ LRADC_CTRL4); -+ mxs_lradc_reg_set(lradc, LRADC_CTRL4_LRADCSELECT(vch, ch), LRADC_CTRL4); -+} -+ - static void mxs_lradc_setup_ts_channel(struct mxs_lradc *lradc, unsigned ch) - { - /* -@@ -450,12 +467,8 @@ static void mxs_lradc_setup_ts_channel(struct mxs_lradc *lradc, unsigned ch) - LRADC_DELAY_DELAY(lradc->over_sample_delay - 1), - LRADC_DELAY(3)); - -- mxs_lradc_reg_clear(lradc, LRADC_CTRL1_LRADC_IRQ(2) | -- LRADC_CTRL1_LRADC_IRQ(3) | LRADC_CTRL1_LRADC_IRQ(4) | -- LRADC_CTRL1_LRADC_IRQ(5), LRADC_CTRL1); -+ mxs_lradc_reg_clear(lradc, LRADC_CTRL1_LRADC_IRQ(ch), LRADC_CTRL1); - -- /* wake us again, when the complete conversion is done */ -- mxs_lradc_reg_set(lradc, LRADC_CTRL1_LRADC_IRQ_EN(ch), LRADC_CTRL1); - /* - * after changing the touchscreen plates setting - * the signals need some initial time to settle. Start the -@@ -508,12 +521,8 @@ static void mxs_lradc_setup_ts_pressure(struct mxs_lradc *lradc, unsigned ch1, - LRADC_DELAY_DELAY(lradc->over_sample_delay - 1), - LRADC_DELAY(3)); - -- mxs_lradc_reg_clear(lradc, LRADC_CTRL1_LRADC_IRQ(2) | -- LRADC_CTRL1_LRADC_IRQ(3) | LRADC_CTRL1_LRADC_IRQ(4) | -- LRADC_CTRL1_LRADC_IRQ(5), LRADC_CTRL1); -+ mxs_lradc_reg_clear(lradc, LRADC_CTRL1_LRADC_IRQ(ch2), LRADC_CTRL1); - -- /* wake us again, when the conversions are done */ -- mxs_lradc_reg_set(lradc, LRADC_CTRL1_LRADC_IRQ_EN(ch2), LRADC_CTRL1); - /* - * after changing the touchscreen plates setting - * the signals need some initial time to settle. Start the -@@ -578,36 +587,6 @@ static unsigned mxs_lradc_read_ts_pressure(struct mxs_lradc *lradc, - #define TS_CH_XM 4 - #define TS_CH_YM 5 - --static int mxs_lradc_read_ts_channel(struct mxs_lradc *lradc) --{ -- u32 reg; -- int val; -- -- reg = readl(lradc->base + LRADC_CTRL1); -- -- /* only channels 3 to 5 are of interest here */ -- if (reg & LRADC_CTRL1_LRADC_IRQ(TS_CH_YP)) { -- mxs_lradc_reg_clear(lradc, LRADC_CTRL1_LRADC_IRQ_EN(TS_CH_YP) | -- LRADC_CTRL1_LRADC_IRQ(TS_CH_YP), LRADC_CTRL1); -- val = mxs_lradc_read_raw_channel(lradc, TS_CH_YP); -- } else if (reg & LRADC_CTRL1_LRADC_IRQ(TS_CH_XM)) { -- mxs_lradc_reg_clear(lradc, LRADC_CTRL1_LRADC_IRQ_EN(TS_CH_XM) | -- LRADC_CTRL1_LRADC_IRQ(TS_CH_XM), LRADC_CTRL1); -- val = mxs_lradc_read_raw_channel(lradc, TS_CH_XM); -- } else if (reg & LRADC_CTRL1_LRADC_IRQ(TS_CH_YM)) { -- mxs_lradc_reg_clear(lradc, LRADC_CTRL1_LRADC_IRQ_EN(TS_CH_YM) | -- LRADC_CTRL1_LRADC_IRQ(TS_CH_YM), LRADC_CTRL1); -- val = mxs_lradc_read_raw_channel(lradc, TS_CH_YM); -- } else { -- return -EIO; -- } -- -- mxs_lradc_reg_wrt(lradc, 0, LRADC_DELAY(2)); -- mxs_lradc_reg_wrt(lradc, 0, LRADC_DELAY(3)); -- -- return val; --} -- - /* - * YP(open)--+-------------+ - * | |--+ -@@ -651,7 +630,8 @@ static void mxs_lradc_prepare_x_pos(struct mxs_lradc *lradc) - mxs_lradc_reg_set(lradc, mxs_lradc_drive_x_plate(lradc), LRADC_CTRL0); - - lradc->cur_plate = LRADC_SAMPLE_X; -- mxs_lradc_setup_ts_channel(lradc, TS_CH_YP); -+ mxs_lradc_map_channel(lradc, TOUCHSCREEN_VCHANNEL1, TS_CH_YP); -+ mxs_lradc_setup_ts_channel(lradc, TOUCHSCREEN_VCHANNEL1); - } - - /* -@@ -672,7 +652,8 @@ static void mxs_lradc_prepare_y_pos(struct mxs_lradc *lradc) - mxs_lradc_reg_set(lradc, mxs_lradc_drive_y_plate(lradc), LRADC_CTRL0); - - lradc->cur_plate = LRADC_SAMPLE_Y; -- mxs_lradc_setup_ts_channel(lradc, TS_CH_XM); -+ mxs_lradc_map_channel(lradc, TOUCHSCREEN_VCHANNEL1, TS_CH_XM); -+ mxs_lradc_setup_ts_channel(lradc, TOUCHSCREEN_VCHANNEL1); - } - - /* -@@ -693,7 +674,10 @@ static void mxs_lradc_prepare_pressure(struct mxs_lradc *lradc) - mxs_lradc_reg_set(lradc, mxs_lradc_drive_pressure(lradc), LRADC_CTRL0); - - lradc->cur_plate = LRADC_SAMPLE_PRESSURE; -- mxs_lradc_setup_ts_pressure(lradc, TS_CH_XP, TS_CH_YM); -+ mxs_lradc_map_channel(lradc, TOUCHSCREEN_VCHANNEL1, TS_CH_YM); -+ mxs_lradc_map_channel(lradc, TOUCHSCREEN_VCHANNEL2, TS_CH_XP); -+ mxs_lradc_setup_ts_pressure(lradc, TOUCHSCREEN_VCHANNEL2, -+ TOUCHSCREEN_VCHANNEL1); - } - - static void mxs_lradc_enable_touch_detection(struct mxs_lradc *lradc) -@@ -706,6 +690,19 @@ static void mxs_lradc_enable_touch_detection(struct mxs_lradc *lradc) - mxs_lradc_reg_set(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ_EN, LRADC_CTRL1); - } - -+static void mxs_lradc_start_touch_event(struct mxs_lradc *lradc) -+{ -+ mxs_lradc_reg_clear(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ_EN, -+ LRADC_CTRL1); -+ mxs_lradc_reg_set(lradc, -+ LRADC_CTRL1_LRADC_IRQ_EN(TOUCHSCREEN_VCHANNEL1), LRADC_CTRL1); -+ /* -+ * start with the Y-pos, because it uses nearly the same plate -+ * settings like the touch detection -+ */ -+ mxs_lradc_prepare_y_pos(lradc); -+} -+ - static void mxs_lradc_report_ts_event(struct mxs_lradc *lradc) - { - input_report_abs(lradc->ts_input, ABS_X, lradc->ts_x_pos); -@@ -723,10 +720,12 @@ static void mxs_lradc_complete_touch_event(struct mxs_lradc *lradc) - * start a dummy conversion to burn time to settle the signals - * note: we are not interested in the conversion's value - */ -- mxs_lradc_reg_wrt(lradc, 0, LRADC_CH(5)); -- mxs_lradc_reg_clear(lradc, LRADC_CTRL1_LRADC_IRQ(5), LRADC_CTRL1); -- mxs_lradc_reg_set(lradc, LRADC_CTRL1_LRADC_IRQ_EN(5), LRADC_CTRL1); -- mxs_lradc_reg_wrt(lradc, LRADC_DELAY_TRIGGER(1 << 5) | -+ mxs_lradc_reg_wrt(lradc, 0, LRADC_CH(TOUCHSCREEN_VCHANNEL1)); -+ mxs_lradc_reg_clear(lradc, -+ LRADC_CTRL1_LRADC_IRQ(TOUCHSCREEN_VCHANNEL1) | -+ LRADC_CTRL1_LRADC_IRQ(TOUCHSCREEN_VCHANNEL2), LRADC_CTRL1); -+ mxs_lradc_reg_wrt(lradc, -+ LRADC_DELAY_TRIGGER(1 << TOUCHSCREEN_VCHANNEL1) | - LRADC_DELAY_KICK | LRADC_DELAY_DELAY(10), /* waste 5 ms */ - LRADC_DELAY(2)); - } -@@ -758,59 +757,45 @@ static void mxs_lradc_finish_touch_event(struct mxs_lradc *lradc, bool valid) - - /* if it is released, wait for the next touch via IRQ */ - lradc->cur_plate = LRADC_TOUCH; -- mxs_lradc_reg_clear(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ, LRADC_CTRL1); -+ mxs_lradc_reg_wrt(lradc, 0, LRADC_DELAY(2)); -+ mxs_lradc_reg_wrt(lradc, 0, LRADC_DELAY(3)); -+ mxs_lradc_reg_clear(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ | -+ LRADC_CTRL1_LRADC_IRQ_EN(TOUCHSCREEN_VCHANNEL1) | -+ LRADC_CTRL1_LRADC_IRQ(TOUCHSCREEN_VCHANNEL1), LRADC_CTRL1); - mxs_lradc_reg_set(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ_EN, LRADC_CTRL1); - } - - /* touchscreen's state machine */ - static void mxs_lradc_handle_touch(struct mxs_lradc *lradc) - { -- int val; -- - switch (lradc->cur_plate) { - case LRADC_TOUCH: -- /* -- * start with the Y-pos, because it uses nearly the same plate -- * settings like the touch detection -- */ -- if (mxs_lradc_check_touch_event(lradc)) { -- mxs_lradc_reg_clear(lradc, -- LRADC_CTRL1_TOUCH_DETECT_IRQ_EN, -- LRADC_CTRL1); -- mxs_lradc_prepare_y_pos(lradc); -- } -+ if (mxs_lradc_check_touch_event(lradc)) -+ mxs_lradc_start_touch_event(lradc); - mxs_lradc_reg_clear(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ, - LRADC_CTRL1); - return; - - case LRADC_SAMPLE_Y: -- val = mxs_lradc_read_ts_channel(lradc); -- if (val < 0) { -- mxs_lradc_enable_touch_detection(lradc); /* re-start */ -- return; -- } -- lradc->ts_y_pos = val; -+ lradc->ts_y_pos = mxs_lradc_read_raw_channel(lradc, -+ TOUCHSCREEN_VCHANNEL1); - mxs_lradc_prepare_x_pos(lradc); - return; - - case LRADC_SAMPLE_X: -- val = mxs_lradc_read_ts_channel(lradc); -- if (val < 0) { -- mxs_lradc_enable_touch_detection(lradc); /* re-start */ -- return; -- } -- lradc->ts_x_pos = val; -+ lradc->ts_x_pos = mxs_lradc_read_raw_channel(lradc, -+ TOUCHSCREEN_VCHANNEL1); - mxs_lradc_prepare_pressure(lradc); - return; - - case LRADC_SAMPLE_PRESSURE: -- lradc->ts_pressure = -- mxs_lradc_read_ts_pressure(lradc, TS_CH_XP, TS_CH_YM); -+ lradc->ts_pressure = mxs_lradc_read_ts_pressure(lradc, -+ TOUCHSCREEN_VCHANNEL2, -+ TOUCHSCREEN_VCHANNEL1); - mxs_lradc_complete_touch_event(lradc); - return; - - case LRADC_SAMPLE_VALID: -- val = mxs_lradc_read_ts_channel(lradc); /* ignore the value */ - mxs_lradc_finish_touch_event(lradc, 1); - break; - } -@@ -842,9 +827,9 @@ static int mxs_lradc_read_single(struct iio_dev *iio_dev, int chan, int *val) - * used if doing raw sampling. - */ - if (lradc->soc == IMX28_LRADC) -- mxs_lradc_reg_clear(lradc, LRADC_CTRL1_MX28_LRADC_IRQ_EN_MASK, -+ mxs_lradc_reg_clear(lradc, LRADC_CTRL1_LRADC_IRQ_EN(0), - LRADC_CTRL1); -- mxs_lradc_reg_clear(lradc, 0xff, LRADC_CTRL0); -+ mxs_lradc_reg_clear(lradc, 0x1, LRADC_CTRL0); - - /* Enable / disable the divider per requirement */ - if (test_bit(chan, &lradc->is_divided)) -@@ -1091,9 +1076,8 @@ static void mxs_lradc_disable_ts(struct mxs_lradc *lradc) - { - /* stop all interrupts from firing */ - mxs_lradc_reg_clear(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ_EN | -- LRADC_CTRL1_LRADC_IRQ_EN(2) | LRADC_CTRL1_LRADC_IRQ_EN(3) | -- LRADC_CTRL1_LRADC_IRQ_EN(4) | LRADC_CTRL1_LRADC_IRQ_EN(5), -- LRADC_CTRL1); -+ LRADC_CTRL1_LRADC_IRQ_EN(TOUCHSCREEN_VCHANNEL1) | -+ LRADC_CTRL1_LRADC_IRQ_EN(TOUCHSCREEN_VCHANNEL2), LRADC_CTRL1); - - /* Power-down touchscreen touch-detect circuitry. */ - mxs_lradc_reg_clear(lradc, mxs_lradc_plate_mask(lradc), LRADC_CTRL0); -@@ -1159,25 +1143,31 @@ static irqreturn_t mxs_lradc_handle_irq(int irq, void *data) - struct iio_dev *iio = data; - struct mxs_lradc *lradc = iio_priv(iio); - unsigned long reg = readl(lradc->base + LRADC_CTRL1); -+ uint32_t clr_irq = mxs_lradc_irq_mask(lradc); - const uint32_t ts_irq_mask = - LRADC_CTRL1_TOUCH_DETECT_IRQ | -- LRADC_CTRL1_LRADC_IRQ(2) | -- LRADC_CTRL1_LRADC_IRQ(3) | -- LRADC_CTRL1_LRADC_IRQ(4) | -- LRADC_CTRL1_LRADC_IRQ(5); -+ LRADC_CTRL1_LRADC_IRQ(TOUCHSCREEN_VCHANNEL1) | -+ LRADC_CTRL1_LRADC_IRQ(TOUCHSCREEN_VCHANNEL2); - - if (!(reg & mxs_lradc_irq_mask(lradc))) - return IRQ_NONE; - -- if (lradc->use_touchscreen && (reg & ts_irq_mask)) -+ if (lradc->use_touchscreen && (reg & ts_irq_mask)) { - mxs_lradc_handle_touch(lradc); -+ /* Make sure we don't clear the next conversion's interrupt. */ -+ clr_irq &= ~(LRADC_CTRL1_LRADC_IRQ(TOUCHSCREEN_VCHANNEL1) | -+ LRADC_CTRL1_LRADC_IRQ(TOUCHSCREEN_VCHANNEL2)); -+ } - - if (iio_buffer_enabled(iio)) -- iio_trigger_poll(iio->trig, iio_get_time_ns()); -- else if (reg & LRADC_CTRL1_LRADC_IRQ(0)) -+ if (iio_buffer_enabled(iio)) { -+ if (reg & lradc->buffer_vchans) -+ iio_trigger_poll(iio->trig, iio_get_time_ns()); -+ } else if (reg & LRADC_CTRL1_LRADC_IRQ(0)) { - complete(&lradc->completion); -+ } - -- mxs_lradc_reg_clear(lradc, reg & mxs_lradc_irq_mask(lradc), LRADC_CTRL1); -+ mxs_lradc_reg_clear(lradc, reg & clr_irq, LRADC_CTRL1); - - return IRQ_HANDLED; - } -@@ -1288,9 +1278,10 @@ static int mxs_lradc_buffer_preenable(struct iio_dev *iio) - } - - if (lradc->soc == IMX28_LRADC) -- mxs_lradc_reg_clear(lradc, LRADC_CTRL1_MX28_LRADC_IRQ_EN_MASK, -- LRADC_CTRL1); -- mxs_lradc_reg_clear(lradc, 0xff, LRADC_CTRL0); -+ mxs_lradc_reg_clear(lradc, -+ lradc->buffer_vchans << LRADC_CTRL1_LRADC_IRQ_EN_OFFSET, -+ LRADC_CTRL1); -+ mxs_lradc_reg_clear(lradc, lradc->buffer_vchans, LRADC_CTRL0); - - for_each_set_bit(chan, iio->active_scan_mask, LRADC_MAX_TOTAL_CHANS) { - ctrl4_set |= chan << LRADC_CTRL4_LRADCSELECT_OFFSET(ofs); -@@ -1323,10 +1314,11 @@ static int mxs_lradc_buffer_postdisable(struct iio_dev *iio) - mxs_lradc_reg_clear(lradc, LRADC_DELAY_TRIGGER_LRADCS_MASK | - LRADC_DELAY_KICK, LRADC_DELAY(0)); - -- mxs_lradc_reg_clear(lradc, 0xff, LRADC_CTRL0); -+ mxs_lradc_reg_clear(lradc, lradc->buffer_vchans, LRADC_CTRL0); - if (lradc->soc == IMX28_LRADC) -- mxs_lradc_reg_clear(lradc, LRADC_CTRL1_MX28_LRADC_IRQ_EN_MASK, -- LRADC_CTRL1); -+ mxs_lradc_reg_clear(lradc, -+ lradc->buffer_vchans << LRADC_CTRL1_LRADC_IRQ_EN_OFFSET, -+ LRADC_CTRL1); - - kfree(lradc->buffer); - mutex_unlock(&lradc->lock); -@@ -1352,7 +1344,7 @@ static bool mxs_lradc_validate_scan_mask(struct iio_dev *iio, - if (lradc->use_touchbutton) - rsvd_chans++; - if (lradc->use_touchscreen) -- rsvd_chans++; -+ rsvd_chans += 2; - - /* Test for attempts to map channels with special mode of operation. */ - if (bitmap_intersects(mask, &rsvd_mask, LRADC_MAX_TOTAL_CHANS)) -@@ -1412,6 +1404,13 @@ static const struct iio_chan_spec mxs_lradc_chan_spec[] = { - .channel = 8, - .scan_type = {.sign = 'u', .realbits = 18, .storagebits = 32,}, - }, -+ /* Hidden channel to keep indexes */ -+ { -+ .type = IIO_TEMP, -+ .indexed = 1, -+ .scan_index = -1, -+ .channel = 9, -+ }, - MXS_ADC_CHAN(10, IIO_VOLTAGE), /* VDDIO */ - MXS_ADC_CHAN(11, IIO_VOLTAGE), /* VTH */ - MXS_ADC_CHAN(12, IIO_VOLTAGE), /* VDDA */ -@@ -1563,6 +1562,11 @@ static int mxs_lradc_probe(struct platform_device *pdev) - - touch_ret = mxs_lradc_probe_touchscreen(lradc, node); - -+ if (touch_ret == 0) -+ lradc->buffer_vchans = BUFFER_VCHANS_LIMITED; -+ else -+ lradc->buffer_vchans = BUFFER_VCHANS_ALL; -+ - /* Grab all IRQ sources */ - for (i = 0; i < of_cfg->irq_count; i++) { - lradc->irq[i] = platform_get_irq(pdev, i); -diff --git a/drivers/target/target_core_pr.c b/drivers/target/target_core_pr.c -index 1205dbd..0fccdcf 100644 ---- a/drivers/target/target_core_pr.c -+++ b/drivers/target/target_core_pr.c -@@ -1877,8 +1877,8 @@ static int core_scsi3_update_aptpl_buf( - } - - if ((len + strlen(tmp) >= pr_aptpl_buf_len)) { -- pr_err("Unable to update renaming" -- " APTPL metadata\n"); -+ pr_err("Unable to update renaming APTPL metadata," -+ " reallocating larger buffer\n"); - ret = -EMSGSIZE; - goto out; - } -@@ -1895,8 +1895,8 @@ static int core_scsi3_update_aptpl_buf( - lun->lun_sep->sep_rtpi, lun->unpacked_lun, reg_count); - - if ((len + strlen(tmp) >= pr_aptpl_buf_len)) { -- pr_err("Unable to update renaming" -- " APTPL metadata\n"); -+ pr_err("Unable to update renaming APTPL metadata," -+ " reallocating larger buffer\n"); - ret = -EMSGSIZE; - goto out; - } -@@ -1959,7 +1959,7 @@ static int __core_scsi3_write_aptpl_to_file( - static sense_reason_t core_scsi3_update_and_write_aptpl(struct se_device *dev, bool aptpl) - { - unsigned char *buf; -- int rc; -+ int rc, len = PR_APTPL_BUF_LEN; - - if (!aptpl) { - char *null_buf = "No Registrations or Reservations\n"; -@@ -1973,25 +1973,26 @@ static sense_reason_t core_scsi3_update_and_write_aptpl(struct se_device *dev, b - - return 0; - } -- -- buf = kzalloc(PR_APTPL_BUF_LEN, GFP_KERNEL); -+retry: -+ buf = vzalloc(len); - if (!buf) - return TCM_OUT_OF_RESOURCES; - -- rc = core_scsi3_update_aptpl_buf(dev, buf, PR_APTPL_BUF_LEN); -+ rc = core_scsi3_update_aptpl_buf(dev, buf, len); - if (rc < 0) { -- kfree(buf); -- return TCM_OUT_OF_RESOURCES; -+ vfree(buf); -+ len *= 2; -+ goto retry; - } - - rc = __core_scsi3_write_aptpl_to_file(dev, buf); - if (rc != 0) { - pr_err("SPC-3 PR: Could not update APTPL\n"); -- kfree(buf); -+ vfree(buf); - return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; - } - dev->t10_pr.pr_aptpl_active = 1; -- kfree(buf); -+ vfree(buf); - pr_debug("SPC-3 PR: Set APTPL Bit Activated\n"); - return 0; - } -diff --git a/drivers/target/target_core_sbc.c b/drivers/target/target_core_sbc.c -index 5216acd..68511e8 100644 ---- a/drivers/target/target_core_sbc.c -+++ b/drivers/target/target_core_sbc.c -@@ -266,6 +266,8 @@ static inline unsigned long long transport_lba_64_ext(unsigned char *cdb) - static sense_reason_t - sbc_setup_write_same(struct se_cmd *cmd, unsigned char *flags, struct sbc_ops *ops) - { -+ struct se_device *dev = cmd->se_dev; -+ sector_t end_lba = dev->transport->get_blocks(dev) + 1; - unsigned int sectors = sbc_get_write_same_sectors(cmd); - - if ((flags[0] & 0x04) || (flags[0] & 0x02)) { -@@ -279,6 +281,16 @@ sbc_setup_write_same(struct se_cmd *cmd, unsigned char *flags, struct sbc_ops *o - sectors, cmd->se_dev->dev_attrib.max_write_same_len); - return TCM_INVALID_CDB_FIELD; - } -+ /* -+ * Sanity check for LBA wrap and request past end of device. -+ */ -+ if (((cmd->t_task_lba + sectors) < cmd->t_task_lba) || -+ ((cmd->t_task_lba + sectors) > end_lba)) { -+ pr_err("WRITE_SAME exceeds last lba %llu (lba %llu, sectors %u)\n", -+ (unsigned long long)end_lba, cmd->t_task_lba, sectors); -+ return TCM_ADDRESS_OUT_OF_RANGE; -+ } -+ - /* We always have ANC_SUP == 0 so setting ANCHOR is always an error */ - if (flags[0] & 0x10) { - pr_warn("WRITE SAME with ANCHOR not supported\n"); -@@ -911,7 +923,8 @@ sbc_parse_cdb(struct se_cmd *cmd, struct sbc_ops *ops) - unsigned long long end_lba; - - end_lba = dev->transport->get_blocks(dev) + 1; -- if (cmd->t_task_lba + sectors > end_lba) { -+ if (((cmd->t_task_lba + sectors) < cmd->t_task_lba) || -+ ((cmd->t_task_lba + sectors) > end_lba)) { - pr_err("cmd exceeds last lba %llu " - "(lba %llu, sectors %u)\n", - end_lba, cmd->t_task_lba, sectors); -diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c -index 25d0741..39988fa 100644 ---- a/drivers/tty/tty_io.c -+++ b/drivers/tty/tty_io.c -@@ -996,8 +996,8 @@ EXPORT_SYMBOL(start_tty); - /* We limit tty time update visibility to every 8 seconds or so. */ - static void tty_update_time(struct timespec *time) - { -- unsigned long sec = get_seconds() & ~7; -- if ((long)(sec - time->tv_sec) > 0) -+ unsigned long sec = get_seconds(); -+ if (abs(sec - time->tv_sec) & ~7) - time->tv_sec = sec; - } - -diff --git a/drivers/tty/tty_ioctl.c b/drivers/tty/tty_ioctl.c -index 6fd60fe..22da05d 100644 ---- a/drivers/tty/tty_ioctl.c -+++ b/drivers/tty/tty_ioctl.c -@@ -217,11 +217,17 @@ void tty_wait_until_sent(struct tty_struct *tty, long timeout) - #endif - if (!timeout) - timeout = MAX_SCHEDULE_TIMEOUT; -+ - if (wait_event_interruptible_timeout(tty->write_wait, -- !tty_chars_in_buffer(tty), timeout) >= 0) { -- if (tty->ops->wait_until_sent) -- tty->ops->wait_until_sent(tty, timeout); -+ !tty_chars_in_buffer(tty), timeout) < 0) { -+ return; - } -+ -+ if (timeout == MAX_SCHEDULE_TIMEOUT) -+ timeout = 0; -+ -+ if (tty->ops->wait_until_sent) -+ tty->ops->wait_until_sent(tty, timeout); - } - EXPORT_SYMBOL(tty_wait_until_sent); - -diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c -index 9ca7716..45b7b96 100644 ---- a/drivers/usb/core/devio.c -+++ b/drivers/usb/core/devio.c -@@ -501,6 +501,7 @@ static void async_completed(struct urb *urb) - as->status = urb->status; - signr = as->signr; - if (signr) { -+ memset(&sinfo, 0, sizeof(sinfo)); - sinfo.si_signo = as->signr; - sinfo.si_errno = as->status; - sinfo.si_code = SI_ASYNCIO; -@@ -2227,6 +2228,7 @@ static void usbdev_remove(struct usb_device *udev) - wake_up_all(&ps->wait); - list_del_init(&ps->list); - if (ps->discsignr) { -+ memset(&sinfo, 0, sizeof(sinfo)); - sinfo.si_signo = ps->discsignr; - sinfo.si_errno = EPIPE; - sinfo.si_code = SI_ASYNCIO; -diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c -index 2a6841c..cfca302 100644 ---- a/drivers/usb/dwc3/dwc3-omap.c -+++ b/drivers/usb/dwc3/dwc3-omap.c -@@ -211,6 +211,18 @@ static void dwc3_omap_write_irq0_set(struct dwc3_omap *omap, u32 value) - omap->irq0_offset, value); - } - -+static void dwc3_omap_write_irqmisc_clr(struct dwc3_omap *omap, u32 value) -+{ -+ dwc3_omap_writel(omap->base, USBOTGSS_IRQENABLE_CLR_MISC + -+ omap->irqmisc_offset, value); -+} -+ -+static void dwc3_omap_write_irq0_clr(struct dwc3_omap *omap, u32 value) -+{ -+ dwc3_omap_writel(omap->base, USBOTGSS_IRQENABLE_CLR_0 - -+ omap->irq0_offset, value); -+} -+ - static void dwc3_omap_set_mailbox(struct dwc3_omap *omap, - enum omap_dwc3_vbus_id_status status) - { -@@ -351,9 +363,23 @@ static void dwc3_omap_enable_irqs(struct dwc3_omap *omap) - - static void dwc3_omap_disable_irqs(struct dwc3_omap *omap) - { -+ u32 reg; -+ - /* disable all IRQs */ -- dwc3_omap_write_irqmisc_set(omap, 0x00); -- dwc3_omap_write_irq0_set(omap, 0x00); -+ reg = USBOTGSS_IRQO_COREIRQ_ST; -+ dwc3_omap_write_irq0_clr(omap, reg); -+ -+ reg = (USBOTGSS_IRQMISC_OEVT | -+ USBOTGSS_IRQMISC_DRVVBUS_RISE | -+ USBOTGSS_IRQMISC_CHRGVBUS_RISE | -+ USBOTGSS_IRQMISC_DISCHRGVBUS_RISE | -+ USBOTGSS_IRQMISC_IDPULLUP_RISE | -+ USBOTGSS_IRQMISC_DRVVBUS_FALL | -+ USBOTGSS_IRQMISC_CHRGVBUS_FALL | -+ USBOTGSS_IRQMISC_DISCHRGVBUS_FALL | -+ USBOTGSS_IRQMISC_IDPULLUP_FALL); -+ -+ dwc3_omap_write_irqmisc_clr(omap, reg); - } - - static u64 dwc3_omap_dma_mask = DMA_BIT_MASK(32); -diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c -index faa8b98..a95eee8 100644 ---- a/drivers/usb/host/xhci-ring.c -+++ b/drivers/usb/host/xhci-ring.c -@@ -2133,7 +2133,7 @@ static int process_ctrl_td(struct xhci_hcd *xhci, struct xhci_td *td, - if (event_trb != ep_ring->dequeue) { - /* The event was for the status stage */ - if (event_trb == td->last_trb) { -- if (td->urb->actual_length != 0) { -+ if (td->urb_length_set) { - /* Don't overwrite a previously set error code - */ - if ((*status == -EINPROGRESS || *status == 0) && -@@ -2147,7 +2147,13 @@ static int process_ctrl_td(struct xhci_hcd *xhci, struct xhci_td *td, - td->urb->transfer_buffer_length; - } - } else { -- /* Maybe the event was for the data stage? */ -+ /* -+ * Maybe the event was for the data stage? If so, update -+ * already the actual_length of the URB and flag it as -+ * set, so that it is not overwritten in the event for -+ * the last TRB. -+ */ -+ td->urb_length_set = true; - td->urb->actual_length = - td->urb->transfer_buffer_length - - EVENT_TRB_LEN(le32_to_cpu(event->transfer_len)); -diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h -index 96e9e78..7225dd2 100644 ---- a/drivers/usb/host/xhci.h -+++ b/drivers/usb/host/xhci.h -@@ -1,3 +1,4 @@ -+ - /* - * xHCI host controller driver - * -@@ -88,9 +89,10 @@ struct xhci_cap_regs { - #define HCS_IST(p) (((p) >> 0) & 0xf) - /* bits 4:7, max number of Event Ring segments */ - #define HCS_ERST_MAX(p) (((p) >> 4) & 0xf) -+/* bits 21:25 Hi 5 bits of Scratchpad buffers SW must allocate for the HW */ - /* bit 26 Scratchpad restore - for save/restore HW state - not used yet */ --/* bits 27:31 number of Scratchpad buffers SW must allocate for the HW */ --#define HCS_MAX_SCRATCHPAD(p) (((p) >> 27) & 0x1f) -+/* bits 27:31 Lo 5 bits of Scratchpad buffers SW must allocate for the HW */ -+#define HCS_MAX_SCRATCHPAD(p) ((((p) >> 16) & 0x3e0) | (((p) >> 27) & 0x1f)) - - /* HCSPARAMS3 - hcs_params3 - bitmasks */ - /* bits 0:7, Max U1 to U0 latency for the roothub ports */ -@@ -1289,6 +1291,8 @@ struct xhci_td { - struct xhci_segment *start_seg; - union xhci_trb *first_trb; - union xhci_trb *last_trb; -+ /* actual_length of the URB has already been set */ -+ bool urb_length_set; - }; - - /* xHCI command default timeout value */ -diff --git a/drivers/usb/serial/bus.c b/drivers/usb/serial/bus.c -index 9374bd2..6f91eb9 100644 ---- a/drivers/usb/serial/bus.c -+++ b/drivers/usb/serial/bus.c -@@ -51,6 +51,7 @@ static int usb_serial_device_probe(struct device *dev) - { - struct usb_serial_driver *driver; - struct usb_serial_port *port; -+ struct device *tty_dev; - int retval = 0; - int minor; - -@@ -75,12 +76,20 @@ static int usb_serial_device_probe(struct device *dev) - retval = device_create_file(dev, &dev_attr_port_number); - if (retval) { - if (driver->port_remove) -- retval = driver->port_remove(port); -+ driver->port_remove(port); - goto exit_with_autopm; - } - - minor = port->minor; -- tty_register_device(usb_serial_tty_driver, minor, dev); -+ tty_dev = tty_register_device(usb_serial_tty_driver, minor, dev); -+ if (IS_ERR(tty_dev)) { -+ retval = PTR_ERR(tty_dev); -+ device_remove_file(dev, &dev_attr_port_number); -+ if (driver->port_remove) -+ driver->port_remove(port); -+ goto exit_with_autopm; -+ } -+ - dev_info(&port->serial->dev->dev, - "%s converter now attached to ttyUSB%d\n", - driver->description, minor); -diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c -index a2d0409..8d114b9 100644 ---- a/drivers/usb/serial/cp210x.c -+++ b/drivers/usb/serial/cp210x.c -@@ -147,6 +147,8 @@ static const struct usb_device_id id_table[] = { - { USB_DEVICE(0x166A, 0x0305) }, /* Clipsal C-5000CT2 C-Bus Spectrum Colour Touchscreen */ - { USB_DEVICE(0x166A, 0x0401) }, /* Clipsal L51xx C-Bus Architectural Dimmer */ - { USB_DEVICE(0x166A, 0x0101) }, /* Clipsal 5560884 C-Bus Multi-room Audio Matrix Switcher */ -+ { USB_DEVICE(0x16C0, 0x09B0) }, /* Lunatico Seletek */ -+ { USB_DEVICE(0x16C0, 0x09B1) }, /* Lunatico Seletek */ - { USB_DEVICE(0x16D6, 0x0001) }, /* Jablotron serial interface */ - { USB_DEVICE(0x16DC, 0x0010) }, /* W-IE-NE-R Plein & Baus GmbH PL512 Power Supply */ - { USB_DEVICE(0x16DC, 0x0011) }, /* W-IE-NE-R Plein & Baus GmbH RCM Remote Control for MARATON Power Supply */ -diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c -index debcdef..9235005 100644 ---- a/drivers/usb/serial/ftdi_sio.c -+++ b/drivers/usb/serial/ftdi_sio.c -@@ -812,6 +812,8 @@ static const struct usb_device_id id_table_combined[] = { - { USB_DEVICE(FTDI_VID, FTDI_ELSTER_UNICOM_PID) }, - { USB_DEVICE(FTDI_VID, FTDI_PROPOX_JTAGCABLEII_PID) }, - { USB_DEVICE(FTDI_VID, FTDI_PROPOX_ISPCABLEIII_PID) }, -+ { USB_DEVICE(FTDI_VID, CYBER_CORTEX_AV_PID), -+ .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, - { USB_DEVICE(OLIMEX_VID, OLIMEX_ARM_USB_OCD_PID), - .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, - { USB_DEVICE(OLIMEX_VID, OLIMEX_ARM_USB_OCD_H_PID), -@@ -991,6 +993,23 @@ static const struct usb_device_id id_table_combined[] = { - { USB_DEVICE_INTERFACE_NUMBER(INFINEON_VID, INFINEON_TRIBOARD_PID, 1) }, - /* GE Healthcare devices */ - { USB_DEVICE(GE_HEALTHCARE_VID, GE_HEALTHCARE_NEMO_TRACKER_PID) }, -+ /* Active Research (Actisense) devices */ -+ { USB_DEVICE(FTDI_VID, ACTISENSE_NDC_PID) }, -+ { USB_DEVICE(FTDI_VID, ACTISENSE_USG_PID) }, -+ { USB_DEVICE(FTDI_VID, ACTISENSE_NGT_PID) }, -+ { USB_DEVICE(FTDI_VID, ACTISENSE_NGW_PID) }, -+ { USB_DEVICE(FTDI_VID, ACTISENSE_D9AC_PID) }, -+ { USB_DEVICE(FTDI_VID, ACTISENSE_D9AD_PID) }, -+ { USB_DEVICE(FTDI_VID, ACTISENSE_D9AE_PID) }, -+ { USB_DEVICE(FTDI_VID, ACTISENSE_D9AF_PID) }, -+ { USB_DEVICE(FTDI_VID, CHETCO_SEAGAUGE_PID) }, -+ { USB_DEVICE(FTDI_VID, CHETCO_SEASWITCH_PID) }, -+ { USB_DEVICE(FTDI_VID, CHETCO_SEASMART_NMEA2000_PID) }, -+ { USB_DEVICE(FTDI_VID, CHETCO_SEASMART_ETHERNET_PID) }, -+ { USB_DEVICE(FTDI_VID, CHETCO_SEASMART_WIFI_PID) }, -+ { USB_DEVICE(FTDI_VID, CHETCO_SEASMART_DISPLAY_PID) }, -+ { USB_DEVICE(FTDI_VID, CHETCO_SEASMART_LITE_PID) }, -+ { USB_DEVICE(FTDI_VID, CHETCO_SEASMART_ANALOG_PID) }, - { } /* Terminating entry */ - }; - -diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h -index e52409c9..56b1b55 100644 ---- a/drivers/usb/serial/ftdi_sio_ids.h -+++ b/drivers/usb/serial/ftdi_sio_ids.h -@@ -38,6 +38,9 @@ - - #define FTDI_LUMEL_PD12_PID 0x6002 - -+/* Cyber Cortex AV by Fabulous Silicon (http://fabuloussilicon.com) */ -+#define CYBER_CORTEX_AV_PID 0x8698 -+ - /* - * Marvell OpenRD Base, Client - * http://www.open-rd.org -@@ -1438,3 +1441,23 @@ - */ - #define GE_HEALTHCARE_VID 0x1901 - #define GE_HEALTHCARE_NEMO_TRACKER_PID 0x0015 -+ -+/* -+ * Active Research (Actisense) devices -+ */ -+#define ACTISENSE_NDC_PID 0xD9A8 /* NDC USB Serial Adapter */ -+#define ACTISENSE_USG_PID 0xD9A9 /* USG USB Serial Adapter */ -+#define ACTISENSE_NGT_PID 0xD9AA /* NGT NMEA2000 Interface */ -+#define ACTISENSE_NGW_PID 0xD9AB /* NGW NMEA2000 Gateway */ -+#define ACTISENSE_D9AC_PID 0xD9AC /* Actisense Reserved */ -+#define ACTISENSE_D9AD_PID 0xD9AD /* Actisense Reserved */ -+#define ACTISENSE_D9AE_PID 0xD9AE /* Actisense Reserved */ -+#define ACTISENSE_D9AF_PID 0xD9AF /* Actisense Reserved */ -+#define CHETCO_SEAGAUGE_PID 0xA548 /* SeaGauge USB Adapter */ -+#define CHETCO_SEASWITCH_PID 0xA549 /* SeaSwitch USB Adapter */ -+#define CHETCO_SEASMART_NMEA2000_PID 0xA54A /* SeaSmart NMEA2000 Gateway */ -+#define CHETCO_SEASMART_ETHERNET_PID 0xA54B /* SeaSmart Ethernet Gateway */ -+#define CHETCO_SEASMART_WIFI_PID 0xA5AC /* SeaSmart Wifi Gateway */ -+#define CHETCO_SEASMART_DISPLAY_PID 0xA5AD /* SeaSmart NMEA2000 Display */ -+#define CHETCO_SEASMART_LITE_PID 0xA5AE /* SeaSmart Lite USB Adapter */ -+#define CHETCO_SEASMART_ANALOG_PID 0xA5AF /* SeaSmart Analog Adapter */ -diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c -index b63ce02..d6a1979 100644 ---- a/drivers/usb/serial/generic.c -+++ b/drivers/usb/serial/generic.c -@@ -258,7 +258,8 @@ void usb_serial_generic_wait_until_sent(struct tty_struct *tty, long timeout) - * character or at least one jiffy. - */ - period = max_t(unsigned long, (10 * HZ / bps), 1); -- period = min_t(unsigned long, period, timeout); -+ if (timeout) -+ period = min_t(unsigned long, period, timeout); - - dev_dbg(&port->dev, "%s - timeout = %u ms, period = %u ms\n", - __func__, jiffies_to_msecs(timeout), -@@ -268,7 +269,7 @@ void usb_serial_generic_wait_until_sent(struct tty_struct *tty, long timeout) - schedule_timeout_interruptible(period); - if (signal_pending(current)) - break; -- if (time_after(jiffies, expire)) -+ if (timeout && time_after(jiffies, expire)) - break; - } - } -diff --git a/drivers/usb/serial/mxuport.c b/drivers/usb/serial/mxuport.c -index ab1d690..460a406 100644 ---- a/drivers/usb/serial/mxuport.c -+++ b/drivers/usb/serial/mxuport.c -@@ -1284,7 +1284,8 @@ static int mxuport_open(struct tty_struct *tty, struct usb_serial_port *port) - } - - /* Initial port termios */ -- mxuport_set_termios(tty, port, NULL); -+ if (tty) -+ mxuport_set_termios(tty, port, NULL); - - /* - * TODO: use RQ_VENDOR_GET_MSR, once we know what it -diff --git a/fs/autofs4/dev-ioctl.c b/fs/autofs4/dev-ioctl.c -index 3182c0e..e3399dc 100644 ---- a/fs/autofs4/dev-ioctl.c -+++ b/fs/autofs4/dev-ioctl.c -@@ -95,7 +95,7 @@ static int check_dev_ioctl_version(int cmd, struct autofs_dev_ioctl *param) - */ - static struct autofs_dev_ioctl *copy_dev_ioctl(struct autofs_dev_ioctl __user *in) - { -- struct autofs_dev_ioctl tmp; -+ struct autofs_dev_ioctl tmp, *res; - - if (copy_from_user(&tmp, in, sizeof(tmp))) - return ERR_PTR(-EFAULT); -@@ -103,7 +103,11 @@ static struct autofs_dev_ioctl *copy_dev_ioctl(struct autofs_dev_ioctl __user *i - if (tmp.size < sizeof(tmp)) - return ERR_PTR(-EINVAL); - -- return memdup_user(in, tmp.size); -+ res = memdup_user(in, tmp.size); -+ if (!IS_ERR(res)) -+ res->size = tmp.size; -+ -+ return res; - } - - static inline void free_dev_ioctl(struct autofs_dev_ioctl *param) -diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c -index 279b06e..0a841dd 100644 ---- a/fs/btrfs/file.c -+++ b/fs/btrfs/file.c -@@ -1774,22 +1774,10 @@ static ssize_t btrfs_file_aio_write(struct kiocb *iocb, - mutex_unlock(&inode->i_mutex); - - /* -- * we want to make sure fsync finds this change -- * but we haven't joined a transaction running right now. -- * -- * Later on, someone is sure to update the inode and get the -- * real transid recorded. -- * -- * We set last_trans now to the fs_info generation + 1, -- * this will either be one more than the running transaction -- * or the generation used for the next transaction if there isn't -- * one running right now. -- * - * We also have to set last_sub_trans to the current log transid, - * otherwise subsequent syncs to a file that's been synced in this - * transaction will appear to have already occured. - */ -- BTRFS_I(inode)->last_trans = root->fs_info->generation + 1; - BTRFS_I(inode)->last_sub_trans = root->log_transid; - if (num_written > 0) { - err = generic_write_sync(file, pos, num_written); -@@ -1892,25 +1880,37 @@ int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync) - atomic_inc(&root->log_batch); - - /* -- * check the transaction that last modified this inode -- * and see if its already been committed -- */ -- if (!BTRFS_I(inode)->last_trans) { -- mutex_unlock(&inode->i_mutex); -- goto out; -- } -- -- /* -- * if the last transaction that changed this file was before -- * the current transaction, we can bail out now without any -- * syncing -+ * If the last transaction that changed this file was before the current -+ * transaction and we have the full sync flag set in our inode, we can -+ * bail out now without any syncing. -+ * -+ * Note that we can't bail out if the full sync flag isn't set. This is -+ * because when the full sync flag is set we start all ordered extents -+ * and wait for them to fully complete - when they complete they update -+ * the inode's last_trans field through: -+ * -+ * btrfs_finish_ordered_io() -> -+ * btrfs_update_inode_fallback() -> -+ * btrfs_update_inode() -> -+ * btrfs_set_inode_last_trans() -+ * -+ * So we are sure that last_trans is up to date and can do this check to -+ * bail out safely. For the fast path, when the full sync flag is not -+ * set in our inode, we can not do it because we start only our ordered -+ * extents and don't wait for them to complete (that is when -+ * btrfs_finish_ordered_io runs), so here at this point their last_trans -+ * value might be less than or equals to fs_info->last_trans_committed, -+ * and setting a speculative last_trans for an inode when a buffered -+ * write is made (such as fs_info->generation + 1 for example) would not -+ * be reliable since after setting the value and before fsync is called -+ * any number of transactions can start and commit (transaction kthread -+ * commits the current transaction periodically), and a transaction -+ * commit does not start nor waits for ordered extents to complete. - */ - smp_mb(); - if (btrfs_inode_in_log(inode, root->fs_info->generation) || -- BTRFS_I(inode)->last_trans <= -- root->fs_info->last_trans_committed) { -- BTRFS_I(inode)->last_trans = 0; -- -+ (full_sync && BTRFS_I(inode)->last_trans <= -+ root->fs_info->last_trans_committed)) { - /* - * We'v had everything committed since the last time we were - * modified so clear this flag in case it was set for whatever -diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c -index d68a725..653cdd8 100644 ---- a/fs/btrfs/inode.c -+++ b/fs/btrfs/inode.c -@@ -6870,7 +6870,6 @@ static int btrfs_get_blocks_direct(struct inode *inode, sector_t iblock, - ((BTRFS_I(inode)->flags & BTRFS_INODE_NODATACOW) && - em->block_start != EXTENT_MAP_HOLE)) { - int type; -- int ret; - u64 block_start, orig_start, orig_block_len, ram_bytes; - - if (test_bit(EXTENT_FLAG_PREALLOC, &em->flags)) -diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c -index aeb57b98..a7f32bf 100644 ---- a/fs/btrfs/tree-log.c -+++ b/fs/btrfs/tree-log.c -@@ -979,7 +979,7 @@ again: - base = btrfs_item_ptr_offset(leaf, path->slots[0]); - - while (cur_offset < item_size) { -- extref = (struct btrfs_inode_extref *)base + cur_offset; -+ extref = (struct btrfs_inode_extref *)(base + cur_offset); - - victim_name_len = btrfs_inode_extref_name_len(leaf, extref); - -diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c -index 1576195..1ff8fe5 100644 ---- a/fs/debugfs/inode.c -+++ b/fs/debugfs/inode.c -@@ -245,10 +245,19 @@ static int debugfs_show_options(struct seq_file *m, struct dentry *root) - return 0; - } - -+static void debugfs_evict_inode(struct inode *inode) -+{ -+ truncate_inode_pages(&inode->i_data, 0); -+ clear_inode(inode); -+ if (S_ISLNK(inode->i_mode)) -+ kfree(inode->i_private); -+} -+ - static const struct super_operations debugfs_super_operations = { - .statfs = simple_statfs, - .remount_fs = debugfs_remount, - .show_options = debugfs_show_options, -+ .evict_inode = debugfs_evict_inode, - }; - - static int debug_fill_super(struct super_block *sb, void *data, int silent) -@@ -465,23 +474,14 @@ static int __debugfs_remove(struct dentry *dentry, struct dentry *parent) - int ret = 0; - - if (debugfs_positive(dentry)) { -- if (dentry->d_inode) { -- dget(dentry); -- switch (dentry->d_inode->i_mode & S_IFMT) { -- case S_IFDIR: -- ret = simple_rmdir(parent->d_inode, dentry); -- break; -- case S_IFLNK: -- kfree(dentry->d_inode->i_private); -- /* fall through */ -- default: -- simple_unlink(parent->d_inode, dentry); -- break; -- } -- if (!ret) -- d_delete(dentry); -- dput(dentry); -- } -+ dget(dentry); -+ if (S_ISDIR(dentry->d_inode->i_mode)) -+ ret = simple_rmdir(parent->d_inode, dentry); -+ else -+ simple_unlink(parent->d_inode, dentry); -+ if (!ret) -+ d_delete(dentry); -+ dput(dentry); - } - return ret; - } -diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c -index 3ed1be9..2ea3537 100644 ---- a/fs/nfs/delegation.c -+++ b/fs/nfs/delegation.c -@@ -161,8 +161,8 @@ void nfs_inode_reclaim_delegation(struct inode *inode, struct rpc_cred *cred, - &delegation->flags); - NFS_I(inode)->delegation_state = delegation->type; - spin_unlock(&delegation->lock); -- put_rpccred(oldcred); - rcu_read_unlock(); -+ put_rpccred(oldcred); - trace_nfs4_reclaim_delegation(inode, res->delegation_type); - } else { - /* We appear to have raced with a delegation return. */ -diff --git a/fs/nilfs2/btree.c b/fs/nilfs2/btree.c -index b2e3ff3..ecdbae1 100644 ---- a/fs/nilfs2/btree.c -+++ b/fs/nilfs2/btree.c -@@ -31,6 +31,8 @@ - #include "alloc.h" - #include "dat.h" - -+static void __nilfs_btree_init(struct nilfs_bmap *bmap); -+ - static struct nilfs_btree_path *nilfs_btree_alloc_path(void) - { - struct nilfs_btree_path *path; -@@ -368,6 +370,34 @@ static int nilfs_btree_node_broken(const struct nilfs_btree_node *node, - return ret; - } - -+/** -+ * nilfs_btree_root_broken - verify consistency of btree root node -+ * @node: btree root node to be examined -+ * @ino: inode number -+ * -+ * Return Value: If node is broken, 1 is returned. Otherwise, 0 is returned. -+ */ -+static int nilfs_btree_root_broken(const struct nilfs_btree_node *node, -+ unsigned long ino) -+{ -+ int level, flags, nchildren; -+ int ret = 0; -+ -+ level = nilfs_btree_node_get_level(node); -+ flags = nilfs_btree_node_get_flags(node); -+ nchildren = nilfs_btree_node_get_nchildren(node); -+ -+ if (unlikely(level < NILFS_BTREE_LEVEL_NODE_MIN || -+ level > NILFS_BTREE_LEVEL_MAX || -+ nchildren < 0 || -+ nchildren > NILFS_BTREE_ROOT_NCHILDREN_MAX)) { -+ pr_crit("NILFS: bad btree root (inode number=%lu): level = %d, flags = 0x%x, nchildren = %d\n", -+ ino, level, flags, nchildren); -+ ret = 1; -+ } -+ return ret; -+} -+ - int nilfs_btree_broken_node_block(struct buffer_head *bh) - { - int ret; -@@ -1713,7 +1743,7 @@ nilfs_btree_commit_convert_and_insert(struct nilfs_bmap *btree, - - /* convert and insert */ - dat = NILFS_BMAP_USE_VBN(btree) ? nilfs_bmap_get_dat(btree) : NULL; -- nilfs_btree_init(btree); -+ __nilfs_btree_init(btree); - if (nreq != NULL) { - nilfs_bmap_commit_alloc_ptr(btree, dreq, dat); - nilfs_bmap_commit_alloc_ptr(btree, nreq, dat); -@@ -2294,12 +2324,23 @@ static const struct nilfs_bmap_operations nilfs_btree_ops_gc = { - .bop_gather_data = NULL, - }; - --int nilfs_btree_init(struct nilfs_bmap *bmap) -+static void __nilfs_btree_init(struct nilfs_bmap *bmap) - { - bmap->b_ops = &nilfs_btree_ops; - bmap->b_nchildren_per_block = - NILFS_BTREE_NODE_NCHILDREN_MAX(nilfs_btree_node_size(bmap)); -- return 0; -+} -+ -+int nilfs_btree_init(struct nilfs_bmap *bmap) -+{ -+ int ret = 0; -+ -+ __nilfs_btree_init(bmap); -+ -+ if (nilfs_btree_root_broken(nilfs_btree_get_root(bmap), -+ bmap->b_inode->i_ino)) -+ ret = -EIO; -+ return ret; - } - - void nilfs_btree_init_gc(struct nilfs_bmap *bmap) -diff --git a/fs/proc/generic.c b/fs/proc/generic.c -index b7f268e..2e2d9d5 100644 ---- a/fs/proc/generic.c -+++ b/fs/proc/generic.c -@@ -19,7 +19,6 @@ - #include <linux/mount.h> - #include <linux/init.h> - #include <linux/idr.h> --#include <linux/namei.h> - #include <linux/bitops.h> - #include <linux/spinlock.h> - #include <linux/completion.h> -@@ -162,17 +161,6 @@ void proc_free_inum(unsigned int inum) - spin_unlock_irqrestore(&proc_inum_lock, flags); - } - --static void *proc_follow_link(struct dentry *dentry, struct nameidata *nd) --{ -- nd_set_link(nd, __PDE_DATA(dentry->d_inode)); -- return NULL; --} -- --static const struct inode_operations proc_link_inode_operations = { -- .readlink = generic_readlink, -- .follow_link = proc_follow_link, --}; -- - /* - * Don't create negative dentries here, return -ENOENT by hand - * instead. -diff --git a/fs/proc/inode.c b/fs/proc/inode.c -index 124fc43..2f2815f 100644 ---- a/fs/proc/inode.c -+++ b/fs/proc/inode.c -@@ -23,6 +23,7 @@ - #include <linux/slab.h> - #include <linux/mount.h> - #include <linux/magic.h> -+#include <linux/namei.h> - - #include <asm/uaccess.h> - -@@ -401,6 +402,26 @@ static const struct file_operations proc_reg_file_ops_no_compat = { - }; - #endif - -+static void *proc_follow_link(struct dentry *dentry, struct nameidata *nd) -+{ -+ struct proc_dir_entry *pde = PDE(dentry->d_inode); -+ if (unlikely(!use_pde(pde))) -+ return ERR_PTR(-EINVAL); -+ nd_set_link(nd, pde->data); -+ return pde; -+} -+ -+static void proc_put_link(struct dentry *dentry, struct nameidata *nd, void *p) -+{ -+ unuse_pde(p); -+} -+ -+const struct inode_operations proc_link_inode_operations = { -+ .readlink = generic_readlink, -+ .follow_link = proc_follow_link, -+ .put_link = proc_put_link, -+}; -+ - struct inode *proc_get_inode(struct super_block *sb, struct proc_dir_entry *de) - { - struct inode *inode = new_inode_pseudo(sb); -diff --git a/fs/proc/internal.h b/fs/proc/internal.h -index 651d09a..8b8ca1d 100644 ---- a/fs/proc/internal.h -+++ b/fs/proc/internal.h -@@ -202,6 +202,7 @@ struct pde_opener { - int closing; - struct completion *c; - }; -+extern const struct inode_operations proc_link_inode_operations; - - extern const struct inode_operations proc_pid_link_inode_operations; - -diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h -index 1772fad..34932540 100644 ---- a/include/target/target_core_base.h -+++ b/include/target/target_core_base.h -@@ -407,7 +407,7 @@ struct t10_reservation { - /* Activate Persistence across Target Power Loss enabled - * for SCSI device */ - int pr_aptpl_active; --#define PR_APTPL_BUF_LEN 8192 -+#define PR_APTPL_BUF_LEN 262144 - u32 pr_generation; - spinlock_t registration_lock; - spinlock_t aptpl_reg_lock; -diff --git a/include/trace/events/kmem.h b/include/trace/events/kmem.h -index aece134..4ad10ba 100644 ---- a/include/trace/events/kmem.h -+++ b/include/trace/events/kmem.h -@@ -268,11 +268,11 @@ TRACE_EVENT(mm_page_alloc_extfrag, - - TP_PROTO(struct page *page, - int alloc_order, int fallback_order, -- int alloc_migratetype, int fallback_migratetype, int new_migratetype), -+ int alloc_migratetype, int fallback_migratetype), - - TP_ARGS(page, - alloc_order, fallback_order, -- alloc_migratetype, fallback_migratetype, new_migratetype), -+ alloc_migratetype, fallback_migratetype), - - TP_STRUCT__entry( - __field( struct page *, page ) -@@ -289,7 +289,8 @@ TRACE_EVENT(mm_page_alloc_extfrag, - __entry->fallback_order = fallback_order; - __entry->alloc_migratetype = alloc_migratetype; - __entry->fallback_migratetype = fallback_migratetype; -- __entry->change_ownership = (new_migratetype == alloc_migratetype); -+ __entry->change_ownership = (alloc_migratetype == -+ get_pageblock_migratetype(page)); - ), - - TP_printk("page=%p pfn=%lu alloc_order=%d fallback_order=%d pageblock_order=%d alloc_migratetype=%d fallback_migratetype=%d fragmenting=%d change_ownership=%d", -diff --git a/mm/compaction.c b/mm/compaction.c -index 4229fc2..a522208 100644 ---- a/mm/compaction.c -+++ b/mm/compaction.c -@@ -937,7 +937,7 @@ static int compact_finished(struct zone *zone, - return COMPACT_PARTIAL; - - /* Job done if allocation would set block type */ -- if (cc->order >= pageblock_order && area->nr_free) -+ if (order >= pageblock_order && area->nr_free) - return COMPACT_PARTIAL; - } - -diff --git a/mm/hugetlb.c b/mm/hugetlb.c -index 472259b..c3e8660 100644 ---- a/mm/hugetlb.c -+++ b/mm/hugetlb.c -@@ -2488,9 +2488,10 @@ again: - goto unlock; - - /* -- * HWPoisoned hugepage is already unmapped and dropped reference -+ * Migrating hugepage or HWPoisoned hugepage is already -+ * unmapped and its refcount is dropped, so just clear pte here. - */ -- if (unlikely(is_hugetlb_entry_hwpoisoned(pte))) { -+ if (unlikely(!pte_present(pte))) { - huge_pte_clear(mm, address, ptep); - goto unlock; - } -@@ -3163,7 +3164,26 @@ unsigned long hugetlb_change_protection(struct vm_area_struct *vma, - spin_unlock(ptl); - continue; - } -- if (!huge_pte_none(huge_ptep_get(ptep))) { -+ pte = huge_ptep_get(ptep); -+ if (unlikely(is_hugetlb_entry_hwpoisoned(pte))) { -+ spin_unlock(ptl); -+ continue; -+ } -+ if (unlikely(is_hugetlb_entry_migration(pte))) { -+ swp_entry_t entry = pte_to_swp_entry(pte); -+ -+ if (is_write_migration_entry(entry)) { -+ pte_t newpte; -+ -+ make_migration_entry_read(&entry); -+ newpte = swp_entry_to_pte(entry); -+ set_huge_pte_at(mm, address, ptep, newpte); -+ pages++; -+ } -+ spin_unlock(ptl); -+ continue; -+ } -+ if (!huge_pte_none(pte)) { - pte = huge_ptep_get_and_clear(mm, address, ptep); - pte = pte_mkhuge(huge_pte_modify(pte, newprot)); - pte = arch_make_huge_pte(pte, vma, NULL, 0); -diff --git a/mm/memory.c b/mm/memory.c -index 7f30bea..102af09 100644 ---- a/mm/memory.c -+++ b/mm/memory.c -@@ -4024,7 +4024,7 @@ int generic_access_phys(struct vm_area_struct *vma, unsigned long addr, - if (follow_phys(vma, addr, write, &prot, &phys_addr)) - return -EINVAL; - -- maddr = ioremap_prot(phys_addr, PAGE_SIZE, prot); -+ maddr = ioremap_prot(phys_addr, PAGE_ALIGN(len + offset), prot); - if (write) - memcpy_toio(maddr + offset, buf, len); - else -diff --git a/mm/mmap.c b/mm/mmap.c -index 085bcd8..d4c97ba 100644 ---- a/mm/mmap.c -+++ b/mm/mmap.c -@@ -129,7 +129,7 @@ EXPORT_SYMBOL_GPL(vm_memory_committed); - */ - int __vm_enough_memory(struct mm_struct *mm, long pages, int cap_sys_admin) - { -- unsigned long free, allowed, reserve; -+ long free, allowed, reserve; - - vm_acct_memory(pages); - -@@ -193,7 +193,7 @@ int __vm_enough_memory(struct mm_struct *mm, long pages, int cap_sys_admin) - */ - if (mm) { - reserve = sysctl_user_reserve_kbytes >> (PAGE_SHIFT - 10); -- allowed -= min(mm->total_vm / 32, reserve); -+ allowed -= min_t(long, mm->total_vm / 32, reserve); - } - - if (percpu_counter_read_positive(&vm_committed_as) < allowed) -diff --git a/mm/nommu.c b/mm/nommu.c -index 3ee4f74..76b3f90 100644 ---- a/mm/nommu.c -+++ b/mm/nommu.c -@@ -1905,7 +1905,7 @@ EXPORT_SYMBOL(unmap_mapping_range); - */ - int __vm_enough_memory(struct mm_struct *mm, long pages, int cap_sys_admin) - { -- unsigned long free, allowed, reserve; -+ long free, allowed, reserve; - - vm_acct_memory(pages); - -@@ -1969,7 +1969,7 @@ int __vm_enough_memory(struct mm_struct *mm, long pages, int cap_sys_admin) - */ - if (mm) { - reserve = sysctl_user_reserve_kbytes >> (PAGE_SHIFT - 10); -- allowed -= min(mm->total_vm / 32, reserve); -+ allowed -= min_t(long, mm->total_vm / 32, reserve); - } - - if (percpu_counter_read_positive(&vm_committed_as) < allowed) -diff --git a/mm/page_alloc.c b/mm/page_alloc.c -index ea41913..0479732 100644 ---- a/mm/page_alloc.c -+++ b/mm/page_alloc.c -@@ -1081,8 +1081,8 @@ static void change_pageblock_range(struct page *pageblock_page, - * nor move CMA pages to different free lists. We don't want unmovable pages - * to be allocated from MIGRATE_CMA areas. - * -- * Returns the new migratetype of the pageblock (or the same old migratetype -- * if it was unchanged). -+ * Returns the allocation migratetype if free pages were stolen, or the -+ * fallback migratetype if it was decided not to steal. - */ - static int try_to_steal_freepages(struct zone *zone, struct page *page, - int start_type, int fallback_type) -@@ -1113,12 +1113,10 @@ static int try_to_steal_freepages(struct zone *zone, struct page *page, - - /* Claim the whole block if over half of it is free */ - if (pages >= (1 << (pageblock_order-1)) || -- page_group_by_mobility_disabled) { -- -+ page_group_by_mobility_disabled) - set_pageblock_migratetype(page, start_type); -- return start_type; -- } - -+ return start_type; - } - - return fallback_type; -@@ -1170,7 +1168,7 @@ __rmqueue_fallback(struct zone *zone, unsigned int order, int start_migratetype) - set_freepage_migratetype(page, new_type); - - trace_mm_page_alloc_extfrag(page, order, current_order, -- start_migratetype, migratetype, new_type); -+ start_migratetype, migratetype); - - return page; - } -diff --git a/net/compat.c b/net/compat.c -index cbc1a2a..275af79 100644 ---- a/net/compat.c -+++ b/net/compat.c -@@ -738,24 +738,18 @@ static unsigned char nas[21] = { - - asmlinkage long compat_sys_sendmsg(int fd, struct compat_msghdr __user *msg, unsigned int flags) - { -- if (flags & MSG_CMSG_COMPAT) -- return -EINVAL; - return __sys_sendmsg(fd, (struct msghdr __user *)msg, flags | MSG_CMSG_COMPAT); - } - - asmlinkage long compat_sys_sendmmsg(int fd, struct compat_mmsghdr __user *mmsg, - unsigned int vlen, unsigned int flags) - { -- if (flags & MSG_CMSG_COMPAT) -- return -EINVAL; - return __sys_sendmmsg(fd, (struct mmsghdr __user *)mmsg, vlen, - flags | MSG_CMSG_COMPAT); - } - - asmlinkage long compat_sys_recvmsg(int fd, struct compat_msghdr __user *msg, unsigned int flags) - { -- if (flags & MSG_CMSG_COMPAT) -- return -EINVAL; - return __sys_recvmsg(fd, (struct msghdr __user *)msg, flags | MSG_CMSG_COMPAT); - } - -@@ -778,9 +772,6 @@ asmlinkage long compat_sys_recvmmsg(int fd, struct compat_mmsghdr __user *mmsg, - int datagrams; - struct timespec ktspec; - -- if (flags & MSG_CMSG_COMPAT) -- return -EINVAL; -- - if (timeout == NULL) - return __sys_recvmmsg(fd, (struct mmsghdr __user *)mmsg, vlen, - flags | MSG_CMSG_COMPAT, NULL); -diff --git a/net/core/dev.c b/net/core/dev.c -index 4ed77d7..f6d8d7f 100644 ---- a/net/core/dev.c -+++ b/net/core/dev.c -@@ -940,7 +940,7 @@ bool dev_valid_name(const char *name) - return false; - - while (*name) { -- if (*name == '/' || isspace(*name)) -+ if (*name == '/' || *name == ':' || isspace(*name)) - return false; - name++; - } -diff --git a/net/core/gen_stats.c b/net/core/gen_stats.c -index 9d3d9e7..372ac66 100644 ---- a/net/core/gen_stats.c -+++ b/net/core/gen_stats.c -@@ -32,6 +32,9 @@ gnet_stats_copy(struct gnet_dump *d, int type, void *buf, int size) - return 0; - - nla_put_failure: -+ kfree(d->xstats); -+ d->xstats = NULL; -+ d->xstats_len = 0; - spin_unlock_bh(d->lock); - return -1; - } -@@ -217,7 +220,9 @@ int - gnet_stats_copy_app(struct gnet_dump *d, void *st, int len) - { - if (d->compat_xstats) { -- d->xstats = st; -+ d->xstats = kmemdup(st, len, GFP_ATOMIC); -+ if (!d->xstats) -+ goto err_out; - d->xstats_len = len; - } - -@@ -225,6 +230,11 @@ gnet_stats_copy_app(struct gnet_dump *d, void *st, int len) - return gnet_stats_copy(d, TCA_STATS_APP, st, len); - - return 0; -+ -+err_out: -+ d->xstats_len = 0; -+ spin_unlock_bh(d->lock); -+ return -1; - } - EXPORT_SYMBOL(gnet_stats_copy_app); - -@@ -257,6 +267,9 @@ gnet_stats_finish_copy(struct gnet_dump *d) - return -1; - } - -+ kfree(d->xstats); -+ d->xstats = NULL; -+ d->xstats_len = 0; - spin_unlock_bh(d->lock); - return 0; - } -diff --git a/net/core/pktgen.c b/net/core/pktgen.c -index fdac61c..ca68d32 100644 ---- a/net/core/pktgen.c -+++ b/net/core/pktgen.c -@@ -2812,25 +2812,25 @@ static struct sk_buff *fill_packet_ipv4(struct net_device *odev, - skb->dev = odev; - skb->pkt_type = PACKET_HOST; - -+ pktgen_finalize_skb(pkt_dev, skb, datalen); -+ - if (!(pkt_dev->flags & F_UDPCSUM)) { - skb->ip_summed = CHECKSUM_NONE; - } else if (odev->features & NETIF_F_V4_CSUM) { - skb->ip_summed = CHECKSUM_PARTIAL; - skb->csum = 0; -- udp4_hwcsum(skb, udph->source, udph->dest); -+ udp4_hwcsum(skb, iph->saddr, iph->daddr); - } else { -- __wsum csum = udp_csum(skb); -+ __wsum csum = skb_checksum(skb, skb_transport_offset(skb), datalen + 8, 0); - - /* add protocol-dependent pseudo-header */ -- udph->check = csum_tcpudp_magic(udph->source, udph->dest, -+ udph->check = csum_tcpudp_magic(iph->saddr, iph->daddr, - datalen + 8, IPPROTO_UDP, csum); - - if (udph->check == 0) - udph->check = CSUM_MANGLED_0; - } - -- pktgen_finalize_skb(pkt_dev, skb, datalen); -- - #ifdef CONFIG_XFRM - if (!process_ipsec(pkt_dev, skb, protocol)) - return NULL; -@@ -2946,6 +2946,8 @@ static struct sk_buff *fill_packet_ipv6(struct net_device *odev, - skb->dev = odev; - skb->pkt_type = PACKET_HOST; - -+ pktgen_finalize_skb(pkt_dev, skb, datalen); -+ - if (!(pkt_dev->flags & F_UDPCSUM)) { - skb->ip_summed = CHECKSUM_NONE; - } else if (odev->features & NETIF_F_V6_CSUM) { -@@ -2954,7 +2956,7 @@ static struct sk_buff *fill_packet_ipv6(struct net_device *odev, - skb->csum_offset = offsetof(struct udphdr, check); - udph->check = ~csum_ipv6_magic(&iph->saddr, &iph->daddr, udplen, IPPROTO_UDP, 0); - } else { -- __wsum csum = udp_csum(skb); -+ __wsum csum = skb_checksum(skb, skb_transport_offset(skb), udplen, 0); - - /* add protocol-dependent pseudo-header */ - udph->check = csum_ipv6_magic(&iph->saddr, &iph->daddr, udplen, IPPROTO_UDP, csum); -@@ -2963,8 +2965,6 @@ static struct sk_buff *fill_packet_ipv6(struct net_device *odev, - udph->check = CSUM_MANGLED_0; - } - -- pktgen_finalize_skb(pkt_dev, skb, datalen); -- - return skb; - } - -diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c -index a6613ff..8aadd6a 100644 ---- a/net/core/rtnetlink.c -+++ b/net/core/rtnetlink.c -@@ -1264,14 +1264,10 @@ static const struct nla_policy ifla_vfinfo_policy[IFLA_VF_INFO_MAX+1] = { - }; - - static const struct nla_policy ifla_vf_policy[IFLA_VF_MAX+1] = { -- [IFLA_VF_MAC] = { .type = NLA_BINARY, -- .len = sizeof(struct ifla_vf_mac) }, -- [IFLA_VF_VLAN] = { .type = NLA_BINARY, -- .len = sizeof(struct ifla_vf_vlan) }, -- [IFLA_VF_TX_RATE] = { .type = NLA_BINARY, -- .len = sizeof(struct ifla_vf_tx_rate) }, -- [IFLA_VF_SPOOFCHK] = { .type = NLA_BINARY, -- .len = sizeof(struct ifla_vf_spoofchk) }, -+ [IFLA_VF_MAC] = { .len = sizeof(struct ifla_vf_mac) }, -+ [IFLA_VF_VLAN] = { .len = sizeof(struct ifla_vf_vlan) }, -+ [IFLA_VF_TX_RATE] = { .len = sizeof(struct ifla_vf_tx_rate) }, -+ [IFLA_VF_SPOOFCHK] = { .len = sizeof(struct ifla_vf_spoofchk) }, - }; - - static const struct nla_policy ifla_port_policy[IFLA_PORT_MAX+1] = { -@@ -2034,8 +2030,16 @@ replay: - } - } - err = rtnl_configure_link(dev, ifm); -- if (err < 0) -- unregister_netdevice(dev); -+ if (err < 0) { -+ if (ops->newlink) { -+ LIST_HEAD(list_kill); -+ -+ ops->dellink(dev, &list_kill); -+ unregister_netdevice_many(&list_kill); -+ } else { -+ unregister_netdevice(dev); -+ } -+ } - out: - put_net(dest_net); - return err; -diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c -index c10a3ce..9ff497d 100644 ---- a/net/ipv4/ip_fragment.c -+++ b/net/ipv4/ip_fragment.c -@@ -679,27 +679,30 @@ EXPORT_SYMBOL(ip_defrag); - struct sk_buff *ip_check_defrag(struct sk_buff *skb, u32 user) - { - struct iphdr iph; -+ int netoff; - u32 len; - - if (skb->protocol != htons(ETH_P_IP)) - return skb; - -- if (!skb_copy_bits(skb, 0, &iph, sizeof(iph))) -+ netoff = skb_network_offset(skb); -+ -+ if (skb_copy_bits(skb, netoff, &iph, sizeof(iph)) < 0) - return skb; - - if (iph.ihl < 5 || iph.version != 4) - return skb; - - len = ntohs(iph.tot_len); -- if (skb->len < len || len < (iph.ihl * 4)) -+ if (skb->len < netoff + len || len < (iph.ihl * 4)) - return skb; - - if (ip_is_fragment(&iph)) { - skb = skb_share_check(skb, GFP_ATOMIC); - if (skb) { -- if (!pskb_may_pull(skb, iph.ihl*4)) -+ if (!pskb_may_pull(skb, netoff + iph.ihl * 4)) - return skb; -- if (pskb_trim_rcsum(skb, len)) -+ if (pskb_trim_rcsum(skb, netoff + len)) - return skb; - memset(IPCB(skb), 0, sizeof(struct inet_skb_parm)); - if (ip_defrag(skb, user)) -diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c -index dd637fc..05686c4 100644 ---- a/net/ipv4/ip_output.c -+++ b/net/ipv4/ip_output.c -@@ -843,7 +843,8 @@ static int __ip_append_data(struct sock *sk, - cork->length += length; - if (((length > mtu) || (skb && skb_is_gso(skb))) && - (sk->sk_protocol == IPPROTO_UDP) && -- (rt->dst.dev->features & NETIF_F_UFO) && !rt->dst.header_len) { -+ (rt->dst.dev->features & NETIF_F_UFO) && !rt->dst.header_len && -+ (sk->sk_type == SOCK_DGRAM)) { - err = ip_ufo_append_data(sk, queue, getfrag, from, length, - hh_len, fragheaderlen, transhdrlen, - maxfraglen, flags); -diff --git a/net/ipv4/ping.c b/net/ipv4/ping.c -index 04ce671..b94002a 100644 ---- a/net/ipv4/ping.c -+++ b/net/ipv4/ping.c -@@ -259,6 +259,10 @@ int ping_init_sock(struct sock *sk) - kgid_t low, high; - int ret = 0; - -+#if IS_ENABLED(CONFIG_IPV6) -+ if (sk->sk_family == AF_INET6) -+ inet6_sk(sk)->ipv6only = 1; -+#endif - inet_get_ping_group_range_net(net, &low, &high); - if (gid_lte(low, group) && gid_lte(group, high)) - return 0; -@@ -305,6 +309,11 @@ static int ping_check_bind_addr(struct sock *sk, struct inet_sock *isk, - if (addr_len < sizeof(*addr)) - return -EINVAL; - -+ if (addr->sin_family != AF_INET && -+ !(addr->sin_family == AF_UNSPEC && -+ addr->sin_addr.s_addr == htonl(INADDR_ANY))) -+ return -EAFNOSUPPORT; -+ - pr_debug("ping_check_bind_addr(sk=%p,addr=%pI4,port=%d)\n", - sk, &addr->sin_addr.s_addr, ntohs(addr->sin_port)); - -@@ -330,7 +339,7 @@ static int ping_check_bind_addr(struct sock *sk, struct inet_sock *isk, - return -EINVAL; - - if (addr->sin6_family != AF_INET6) -- return -EINVAL; -+ return -EAFNOSUPPORT; - - pr_debug("ping_check_bind_addr(sk=%p,addr=%pI6c,port=%d)\n", - sk, addr->sin6_addr.s6_addr, ntohs(addr->sin6_port)); -@@ -716,7 +725,7 @@ static int ping_v4_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *m - if (msg->msg_namelen < sizeof(*usin)) - return -EINVAL; - if (usin->sin_family != AF_INET) -- return -EINVAL; -+ return -EAFNOSUPPORT; - daddr = usin->sin_addr.s_addr; - /* no remote port */ - } else { -diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c -index 12f7ef0..d7907ec 100644 ---- a/net/ipv6/ip6_output.c -+++ b/net/ipv6/ip6_output.c -@@ -1294,7 +1294,8 @@ emsgsize: - if (((length > mtu) || - (skb && skb_is_gso(skb))) && - (sk->sk_protocol == IPPROTO_UDP) && -- (rt->dst.dev->features & NETIF_F_UFO)) { -+ (rt->dst.dev->features & NETIF_F_UFO) && -+ (sk->sk_type == SOCK_DGRAM)) { - err = ip6_ufo_append_data(sk, getfrag, from, length, - hh_len, fragheaderlen, - transhdrlen, mtu, flags, rt); -diff --git a/net/ipv6/ping.c b/net/ipv6/ping.c -index bda7429..4611995 100644 ---- a/net/ipv6/ping.c -+++ b/net/ipv6/ping.c -@@ -103,9 +103,10 @@ int ping_v6_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, - - if (msg->msg_name) { - DECLARE_SOCKADDR(struct sockaddr_in6 *, u, msg->msg_name); -- if (msg->msg_namelen < sizeof(struct sockaddr_in6) || -- u->sin6_family != AF_INET6) { -+ if (msg->msg_namelen < sizeof(*u)) - return -EINVAL; -+ if (u->sin6_family != AF_INET6) { -+ return -EAFNOSUPPORT; - } - if (sk->sk_bound_dev_if && - sk->sk_bound_dev_if != u->sin6_scope_id) { -diff --git a/net/ipv6/route.c b/net/ipv6/route.c -index 6f1b850..3809ca2 100644 ---- a/net/ipv6/route.c -+++ b/net/ipv6/route.c -@@ -141,7 +141,7 @@ static u32 *ipv6_cow_metrics(struct dst_entry *dst, unsigned long old) - u32 *p = NULL; - - if (!(rt->dst.flags & DST_HOST)) -- return NULL; -+ return dst_cow_metrics_generic(dst, old); - - peer = rt6_get_peer_create(rt); - if (peer) { -diff --git a/net/irda/ircomm/ircomm_tty.c b/net/irda/ircomm/ircomm_tty.c -index 2ba8b97..fdcb968 100644 ---- a/net/irda/ircomm/ircomm_tty.c -+++ b/net/irda/ircomm/ircomm_tty.c -@@ -818,7 +818,9 @@ static void ircomm_tty_wait_until_sent(struct tty_struct *tty, int timeout) - orig_jiffies = jiffies; - - /* Set poll time to 200 ms */ -- poll_time = IRDA_MIN(timeout, msecs_to_jiffies(200)); -+ poll_time = msecs_to_jiffies(200); -+ if (timeout) -+ poll_time = min_t(unsigned long, timeout, poll_time); - - spin_lock_irqsave(&self->spinlock, flags); - while (self->tx_skb && self->tx_skb->len) { -diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c -index e5a7ac2..dca076f 100644 ---- a/net/mac80211/tx.c -+++ b/net/mac80211/tx.c -@@ -562,6 +562,7 @@ ieee80211_tx_h_check_control_port_protocol(struct ieee80211_tx_data *tx) - if (tx->sdata->control_port_no_encrypt) - info->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT; - info->control.flags |= IEEE80211_TX_CTRL_PORT_CTRL_PROTO; -+ info->flags |= IEEE80211_TX_CTL_USE_MINRATE; - } - - return TX_CONTINUE; -diff --git a/net/sched/ematch.c b/net/sched/ematch.c -index 3a633de..a2abc44 100644 ---- a/net/sched/ematch.c -+++ b/net/sched/ematch.c -@@ -227,6 +227,7 @@ static int tcf_em_validate(struct tcf_proto *tp, - * to replay the request. - */ - module_put(em->ops->owner); -+ em->ops = NULL; - err = -EAGAIN; - } - #endif -diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c -index ae333c1..0adc66c 100644 ---- a/net/sunrpc/cache.c -+++ b/net/sunrpc/cache.c -@@ -920,7 +920,7 @@ static unsigned int cache_poll(struct file *filp, poll_table *wait, - poll_wait(filp, &queue_wait, wait); - - /* alway allow write */ -- mask = POLL_OUT | POLLWRNORM; -+ mask = POLLOUT | POLLWRNORM; - - if (!rp) - return mask; -diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c -index 566b0f6..ee24057 100644 ---- a/sound/core/pcm_native.c -+++ b/sound/core/pcm_native.c -@@ -1404,6 +1404,8 @@ static int snd_pcm_do_drain_init(struct snd_pcm_substream *substream, int state) - if (! snd_pcm_playback_empty(substream)) { - snd_pcm_do_start(substream, SNDRV_PCM_STATE_DRAINING); - snd_pcm_post_start(substream, SNDRV_PCM_STATE_DRAINING); -+ } else { -+ runtime->status->state = SNDRV_PCM_STATE_SETUP; - } - break; - case SNDRV_PCM_STATE_RUNNING: -diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c -index 103e85a..2f3059b 100644 ---- a/sound/pci/hda/hda_intel.c -+++ b/sound/pci/hda/hda_intel.c -@@ -3984,7 +3984,7 @@ static DEFINE_PCI_DEVICE_TABLE(azx_ids) = { - .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH_NOPM }, - /* Panther Point */ - { PCI_DEVICE(0x8086, 0x1e20), -- .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH }, -+ .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH_NOPM }, - /* Lynx Point */ - { PCI_DEVICE(0x8086, 0x8c20), - .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH }, -diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c -index 12f28d7..231b264 100644 ---- a/sound/pci/hda/patch_sigmatel.c -+++ b/sound/pci/hda/patch_sigmatel.c -@@ -85,6 +85,7 @@ enum { - STAC_ALIENWARE_M17X, - STAC_92HD89XX_HP_FRONT_JACK, - STAC_92HD89XX_HP_Z1_G2_RIGHT_MIC_JACK, -+ STAC_92HD73XX_ASUS_MOBO, - STAC_92HD73XX_MODELS - }; - -@@ -1935,7 +1936,18 @@ static const struct hda_fixup stac92hd73xx_fixups[] = { - [STAC_92HD89XX_HP_Z1_G2_RIGHT_MIC_JACK] = { - .type = HDA_FIXUP_PINS, - .v.pins = stac92hd89xx_hp_z1_g2_right_mic_jack_pin_configs, -- } -+ }, -+ [STAC_92HD73XX_ASUS_MOBO] = { -+ .type = HDA_FIXUP_PINS, -+ .v.pins = (const struct hda_pintbl[]) { -+ /* enable 5.1 and SPDIF out */ -+ { 0x0c, 0x01014411 }, -+ { 0x0d, 0x01014410 }, -+ { 0x0e, 0x01014412 }, -+ { 0x22, 0x014b1180 }, -+ { } -+ } -+ }, - }; - - static const struct hda_model_fixup stac92hd73xx_models[] = { -@@ -1947,6 +1959,7 @@ static const struct hda_model_fixup stac92hd73xx_models[] = { - { .id = STAC_DELL_M6_BOTH, .name = "dell-m6" }, - { .id = STAC_DELL_EQ, .name = "dell-eq" }, - { .id = STAC_ALIENWARE_M17X, .name = "alienware" }, -+ { .id = STAC_92HD73XX_ASUS_MOBO, .name = "asus-mobo" }, - {} - }; - -@@ -1999,6 +2012,8 @@ static const struct snd_pci_quirk stac92hd73xx_fixup_tbl[] = { - "HP Z1 G2", STAC_92HD89XX_HP_Z1_G2_RIGHT_MIC_JACK), - SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2b17, - "unknown HP", STAC_92HD89XX_HP_FRONT_JACK), -+ SND_PCI_QUIRK(PCI_VENDOR_ID_ASUSTEK, 0x83f8, "ASUS AT4NM10", -+ STAC_92HD73XX_ASUS_MOBO), - {} /* terminator */ - }; - -diff --git a/sound/soc/omap/omap-pcm.c b/sound/soc/omap/omap-pcm.c -index 07b8b7b..81f6a75 100644 ---- a/sound/soc/omap/omap-pcm.c -+++ b/sound/soc/omap/omap-pcm.c -@@ -200,7 +200,7 @@ static int omap_pcm_new(struct snd_soc_pcm_runtime *rtd) - struct snd_pcm *pcm = rtd->pcm; - int ret; - -- ret = dma_coerce_mask_and_coherent(card->dev, DMA_BIT_MASK(64)); -+ ret = dma_coerce_mask_and_coherent(card->dev, DMA_BIT_MASK(32)); - if (ret) - return ret; - diff --git a/projects/imx6/patches/linux/linux-300-tbs2910_device_tree_from_imx6q-sabresd.patch b/projects/imx6/patches/linux/linux-300-tbs2910_device_tree_from_imx6q-sabresd.patch deleted file mode 100644 index d14372f5f15..00000000000 --- a/projects/imx6/patches/linux/linux-300-tbs2910_device_tree_from_imx6q-sabresd.patch +++ /dev/null @@ -1,850 +0,0 @@ -From 260d0a77f9848d2495c3f5031f734dbedac244c6 Mon Sep 17 00:00:00 2001 -From: vpeter4 <peter.vicman@gmail.com> -Date: Sun, 5 Oct 2014 14:22:53 +0200 -Subject: [PATCH] tbs2910_device_tree_from_imx6q-sabresd - -copied from imx6q-sabresd.dts and imx6qdl-sabresd.dtsi ---- - arch/arm/boot/dts/Makefile | 1 + - arch/arm/boot/dts/imx6q-tbs2910.dts | 41 ++ - arch/arm/boot/dts/imx6qdl-tbs2910.dtsi | 768 +++++++++++++++++++++++++++++++++ - 3 files changed, 810 insertions(+) - create mode 100644 arch/arm/boot/dts/imx6q-tbs2910.dts - create mode 100644 arch/arm/boot/dts/imx6qdl-tbs2910.dtsi - -diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile -index f363929..49004c4 100644 ---- a/arch/arm/boot/dts/Makefile -+++ b/arch/arm/boot/dts/Makefile -@@ -185,6 +185,7 @@ dtb-$(CONFIG_ARCH_MXC) += \ - imx6q-sabrelite.dtb \ - imx6q-sabresd.dtb \ - imx6q-sabresd-hdcp.dtb \ -+ imx6q-tbs2910.dtb \ - imx6q-sbc6x.dtb \ - imx6q-udoo.dtb \ - imx6q-wandboard.dtb \ -diff --git a/arch/arm/boot/dts/imx6q-tbs2910.dts b/arch/arm/boot/dts/imx6q-tbs2910.dts -new file mode 100644 -index 0000000..0374484 ---- /dev/null -+++ b/arch/arm/boot/dts/imx6q-tbs2910.dts -@@ -0,0 +1,41 @@ -+/* -+ * Copyright 2012 Freescale Semiconductor, Inc. -+ * Copyright 2011 Linaro Ltd. -+ * -+ * The code contained herein is licensed under the GNU General Public -+ * License. You may obtain a copy of the GNU General Public License -+ * Version 2 or later at the following locations: -+ * -+ * http://www.opensource.org/licenses/gpl-license.html -+ * http://www.gnu.org/copyleft/gpl.html -+ */ -+ -+/dts-v1/; -+ -+#include "imx6q.dtsi" -+#include "imx6qdl-tbs2910.dtsi" -+ -+/ { -+ model = "TBS Matrix"; -+ compatible = "fsl,imx6q-sabresd", "fsl,imx6q"; -+}; -+ -+&sata { -+ status = "okay"; -+}; -+ -+&mxcfb1 { -+ status = "okay"; -+}; -+ -+&mxcfb2 { -+ status = "okay"; -+}; -+ -+&mxcfb3 { -+ status = "okay"; -+}; -+ -+&mxcfb4 { -+ status = "okay"; -+}; -diff --git a/arch/arm/boot/dts/imx6qdl-tbs2910.dtsi b/arch/arm/boot/dts/imx6qdl-tbs2910.dtsi -new file mode 100644 -index 0000000..f351c21 ---- /dev/null -+++ b/arch/arm/boot/dts/imx6qdl-tbs2910.dtsi -@@ -0,0 +1,768 @@ -+/* -+ * Copyright 2012 Freescale Semiconductor, Inc. -+ * Copyright 2011 Linaro Ltd. -+ * -+ * The code contained herein is licensed under the GNU General Public -+ * License. You may obtain a copy of the GNU General Public License -+ * Version 2 or later at the following locations: -+ * -+ * http://www.opensource.org/licenses/gpl-license.html -+ * http://www.gnu.org/copyleft/gpl.html -+ */ -+ -+#include <dt-bindings/gpio/gpio.h> -+#include <dt-bindings/input/input.h> -+ -+/ { -+ aliases { -+ mxcfb0 = &mxcfb1; -+ mxcfb1 = &mxcfb2; -+ mxcfb2 = &mxcfb3; -+ mxcfb3 = &mxcfb4; -+ }; -+ -+ chosen { -+ stdout-path = &uart1; -+ }; -+ -+ memory { -+ reg = <0x10000000 0x40000000>; -+ }; -+ -+ regulators { -+ compatible = "simple-bus"; -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ reg_usb_otg_vbus: regulator@0 { -+ compatible = "regulator-fixed"; -+ reg = <0>; -+ regulator-name = "usb_otg_vbus"; -+ regulator-min-microvolt = <5000000>; -+ regulator-max-microvolt = <5000000>; -+ gpio = <&gpio3 22 0>; -+ enable-active-high; -+ }; -+ -+ reg_usb_h1_vbus: regulator@1 { -+ compatible = "regulator-fixed"; -+ reg = <1>; -+ regulator-name = "usb_h1_vbus"; -+ regulator-min-microvolt = <5000000>; -+ regulator-max-microvolt = <5000000>; -+ gpio = <&gpio1 29 0>; -+ enable-active-high; -+ }; -+ -+ reg_audio: regulator@2 { -+ compatible = "regulator-fixed"; -+ reg = <2>; -+ regulator-name = "wm8962-supply"; -+ gpio = <&gpio4 10 0>; -+ enable-active-high; -+ }; -+ -+ reg_mipi_dsi_pwr_on: mipi_dsi_pwr_on { -+ compatible = "regulator-fixed"; -+ regulator-name = "mipi_dsi_pwr_on"; -+ gpio = <&gpio6 14 0>; -+ enable-active-high; -+ }; -+ }; -+ -+ gpio-keys { -+ compatible = "gpio-keys"; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pinctrl_gpio_keys>; -+ -+ power { -+ label = "Power Button"; -+ gpios = <&gpio3 29 GPIO_ACTIVE_LOW>; -+ gpio-key,wakeup; -+ linux,code = <KEY_POWER>; -+ }; -+ -+ volume-up { -+ label = "Volume Up"; -+ gpios = <&gpio1 4 GPIO_ACTIVE_LOW>; -+ gpio-key,wakeup; -+ linux,code = <KEY_VOLUMEUP>; -+ }; -+ -+ volume-down { -+ label = "Volume Down"; -+ gpios = <&gpio1 5 GPIO_ACTIVE_LOW>; -+ gpio-key,wakeup; -+ linux,code = <KEY_VOLUMEDOWN>; -+ }; -+ }; -+ -+ sound { -+ compatible = "fsl,imx6q-sabresd-wm8962", -+ "fsl,imx-audio-wm8962"; -+ model = "wm8962-audio"; -+ ssi-controller = <&ssi2>; -+ audio-codec = <&codec>; -+ audio-routing = -+ "Headphone Jack", "HPOUTL", -+ "Headphone Jack", "HPOUTR", -+ "Ext Spk", "SPKOUTL", -+ "Ext Spk", "SPKOUTR", -+ "MICBIAS", "AMIC", -+ "IN3R", "MICBIAS", -+ "DMIC", "MICBIAS", -+ "DMICDAT", "DMIC"; -+ mux-int-port = <2>; -+ mux-ext-port = <3>; -+ }; -+ -+ backlight { -+ compatible = "pwm-backlight"; -+ pwms = <&pwm1 0 5000000>; -+ brightness-levels = <0 4 8 16 32 64 128 255>; -+ default-brightness-level = <7>; -+ status = "okay"; -+ }; -+ -+ leds { -+ compatible = "gpio-leds"; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pinctrl_gpio_leds>; -+ -+ red { -+ gpios = <&gpio1 2 0>; -+ default-state = "on"; -+ }; -+ }; -+ -+ sound-hdmi { -+ compatible = "fsl,imx6q-audio-hdmi", -+ "fsl,imx-audio-hdmi"; -+ model = "imx-audio-hdmi"; -+ hdmi-controller = <&hdmi_audio>; -+ }; -+ -+ mxcfb1: fb@0 { -+ compatible = "fsl,mxc_sdc_fb"; -+ disp_dev = "ldb"; -+ interface_pix_fmt = "RGB666"; -+ mode_str ="LDB-XGA"; -+ default_bpp = <16>; -+ int_clk = <0>; -+ late_init = <0>; -+ status = "disabled"; -+ }; -+ -+ mxcfb2: fb@1 { -+ compatible = "fsl,mxc_sdc_fb"; -+ disp_dev = "hdmi"; -+ interface_pix_fmt = "RGB24"; -+ mode_str ="1920x1080M@60"; -+ default_bpp = <24>; -+ int_clk = <0>; -+ late_init = <0>; -+ status = "disabled"; -+ }; -+ -+ mxcfb3: fb@2 { -+ compatible = "fsl,mxc_sdc_fb"; -+ disp_dev = "lcd"; -+ interface_pix_fmt = "RGB565"; -+ mode_str ="CLAA-WVGA"; -+ default_bpp = <16>; -+ int_clk = <0>; -+ late_init = <0>; -+ status = "disabled"; -+ }; -+ -+ mxcfb4: fb@3 { -+ compatible = "fsl,mxc_sdc_fb"; -+ disp_dev = "ldb"; -+ interface_pix_fmt = "RGB666"; -+ mode_str ="LDB-XGA"; -+ default_bpp = <16>; -+ int_clk = <0>; -+ late_init = <0>; -+ status = "disabled"; -+ }; -+ -+ lcd@0 { -+ compatible = "fsl,lcd"; -+ ipu_id = <0>; -+ disp_id = <0>; -+ default_ifmt = "RGB565"; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pinctrl_ipu1>; -+ status = "okay"; -+ }; -+ -+ backlight { -+ compatible = "pwm-backlight"; -+ pwms = <&pwm1 0 5000000>; -+ brightness-levels = <0 4 8 16 32 64 128 255>; -+ default-brightness-level = <7>; -+ }; -+ -+ v4l2_out { -+ compatible = "fsl,mxc_v4l2_output"; -+ status = "okay"; -+ }; -+ -+ lvds_cabc_ctrl { -+ lvds0-gpios = <&gpio6 15 0>; -+ lvds1-gpios = <&gpio6 16 0>; -+ }; -+ -+ mipi_dsi_reset: mipi-dsi-reset { -+ compatible = "gpio-reset"; -+ reset-gpios = <&gpio6 11 GPIO_ACTIVE_LOW>; -+ reset-delay-us = <50>; -+ #reset-cells = <0>; -+ }; -+}; -+ -+&audmux { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pinctrl_audmux>; -+ status = "okay"; -+}; -+ -+&ecspi1 { -+ fsl,spi-num-chipselects = <1>; -+ cs-gpios = <&gpio4 9 0>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pinctrl_ecspi1>; -+ status = "okay"; -+ -+ flash: m25p80@0 { -+ #address-cells = <1>; -+ #size-cells = <1>; -+ compatible = "st,m25p32"; -+ spi-max-frequency = <20000000>; -+ reg = <0>; -+ }; -+}; -+ -+&fec { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pinctrl_enet>; -+ phy-mode = "rgmii"; -+ phy-reset-gpios = <&gpio1 25 0>; -+ status = "okay"; -+}; -+ -+&i2c1 { -+ clock-frequency = <100000>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pinctrl_i2c1>; -+ status = "okay"; -+ -+ codec: wm8962@1a { -+ compatible = "wlf,wm8962"; -+ reg = <0x1a>; -+ clocks = <&clks 201>; -+ DCVDD-supply = <&reg_audio>; -+ DBVDD-supply = <&reg_audio>; -+ AVDD-supply = <&reg_audio>; -+ CPVDD-supply = <&reg_audio>; -+ MICVDD-supply = <&reg_audio>; -+ PLLVDD-supply = <&reg_audio>; -+ SPKVDD1-supply = <&reg_audio>; -+ SPKVDD2-supply = <&reg_audio>; -+ gpio-cfg = < -+ 0x0000 /* 0:Default */ -+ 0x0000 /* 1:Default */ -+ 0x0013 /* 2:FN_DMICCLK */ -+ 0x0000 /* 3:Default */ -+ 0x8014 /* 4:FN_DMICCDAT */ -+ 0x0000 /* 5:Default */ -+ >; -+ }; -+}; -+ -+&i2c2 { -+ clock-frequency = <100000>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pinctrl_i2c2>; -+ status = "okay"; -+ -+ hdmi: edid@50 { -+ compatible = "fsl,imx6-hdmi-i2c"; -+ reg = <0x50>; -+ }; -+ -+ pmic: pfuze100@08 { -+ compatible = "fsl,pfuze100"; -+ reg = <0x08>; -+ -+ regulators { -+ sw1a_reg: sw1ab { -+ regulator-min-microvolt = <300000>; -+ regulator-max-microvolt = <1875000>; -+ regulator-boot-on; -+ regulator-always-on; -+ regulator-ramp-delay = <6250>; -+ }; -+ -+ sw1c_reg: sw1c { -+ regulator-min-microvolt = <300000>; -+ regulator-max-microvolt = <1875000>; -+ regulator-boot-on; -+ regulator-always-on; -+ regulator-ramp-delay = <6250>; -+ }; -+ -+ sw2_reg: sw2 { -+ regulator-min-microvolt = <800000>; -+ regulator-max-microvolt = <3300000>; -+ regulator-boot-on; -+ regulator-always-on; -+ }; -+ -+ sw3a_reg: sw3a { -+ regulator-min-microvolt = <400000>; -+ regulator-max-microvolt = <1975000>; -+ regulator-boot-on; -+ regulator-always-on; -+ }; -+ -+ sw3b_reg: sw3b { -+ regulator-min-microvolt = <400000>; -+ regulator-max-microvolt = <1975000>; -+ regulator-boot-on; -+ regulator-always-on; -+ }; -+ -+ sw4_reg: sw4 { -+ regulator-min-microvolt = <800000>; -+ regulator-max-microvolt = <3300000>; -+ }; -+ -+ swbst_reg: swbst { -+ regulator-min-microvolt = <5000000>; -+ regulator-max-microvolt = <5150000>; -+ }; -+ -+ snvs_reg: vsnvs { -+ regulator-min-microvolt = <1000000>; -+ regulator-max-microvolt = <3000000>; -+ regulator-boot-on; -+ regulator-always-on; -+ }; -+ -+ vref_reg: vrefddr { -+ regulator-boot-on; -+ regulator-always-on; -+ }; -+ -+ vgen1_reg: vgen1 { -+ regulator-min-microvolt = <800000>; -+ regulator-max-microvolt = <1550000>; -+ }; -+ -+ vgen2_reg: vgen2 { -+ regulator-min-microvolt = <800000>; -+ regulator-max-microvolt = <1550000>; -+ }; -+ -+ vgen3_reg: vgen3 { -+ regulator-min-microvolt = <1800000>; -+ regulator-max-microvolt = <3300000>; -+ }; -+ -+ vgen4_reg: vgen4 { -+ regulator-min-microvolt = <1800000>; -+ regulator-max-microvolt = <3300000>; -+ regulator-always-on; -+ }; -+ -+ vgen5_reg: vgen5 { -+ regulator-min-microvolt = <1800000>; -+ regulator-max-microvolt = <3300000>; -+ regulator-always-on; -+ }; -+ -+ vgen6_reg: vgen6 { -+ regulator-min-microvolt = <1800000>; -+ regulator-max-microvolt = <3300000>; -+ regulator-always-on; -+ }; -+ }; -+ }; -+}; -+ -+&i2c3 { -+ clock-frequency = <100000>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pinctrl_i2c3>; -+ status = "okay"; -+ -+ egalax_ts@04 { -+ compatible = "eeti,egalax_ts"; -+ reg = <0x04>; -+ interrupt-parent = <&gpio6>; -+ interrupts = <7 2>; -+ wakeup-gpios = <&gpio6 7 0>; -+ }; -+}; -+ -+&iomuxc { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pinctrl_hog>; -+ -+ imx6qdl-sabresd { -+ pinctrl_hog: hoggrp { -+ fsl,pins = < -+ MX6QDL_PAD_NANDF_D0__GPIO2_IO00 0x80000000 -+ MX6QDL_PAD_NANDF_D1__GPIO2_IO01 0x80000000 -+ MX6QDL_PAD_NANDF_D2__GPIO2_IO02 0x80000000 -+ MX6QDL_PAD_NANDF_D3__GPIO2_IO03 0x80000000 -+ MX6QDL_PAD_GPIO_0__CCM_CLKO1 0x130b0 -+ MX6QDL_PAD_NANDF_CLE__GPIO6_IO07 0x80000000 -+ MX6QDL_PAD_ENET_TXD1__GPIO1_IO29 0x80000000 -+ MX6QDL_PAD_EIM_D22__GPIO3_IO22 0x80000000 -+ MX6QDL_PAD_ENET_CRS_DV__GPIO1_IO25 0x80000000 -+ MX6QDL_PAD_NANDF_CS2__GPIO6_IO15 0x80000000 -+ MX6QDL_PAD_NANDF_CS3__GPIO6_IO16 0x80000000 -+ MX6QDL_PAD_NANDF_CS0__GPIO6_IO11 0x80000000 -+ MX6QDL_PAD_NANDF_CS1__GPIO6_IO14 0x80000000 -+ >; -+ }; -+ -+ pinctrl_audmux: audmuxgrp { -+ fsl,pins = < -+ MX6QDL_PAD_CSI0_DAT7__AUD3_RXD 0x130b0 -+ MX6QDL_PAD_CSI0_DAT4__AUD3_TXC 0x130b0 -+ MX6QDL_PAD_CSI0_DAT5__AUD3_TXD 0x110b0 -+ MX6QDL_PAD_CSI0_DAT6__AUD3_TXFS 0x130b0 -+ >; -+ }; -+ -+ pinctrl_ecspi1: ecspi1grp { -+ fsl,pins = < -+ MX6QDL_PAD_KEY_COL1__ECSPI1_MISO 0x100b1 -+ MX6QDL_PAD_KEY_ROW0__ECSPI1_MOSI 0x100b1 -+ MX6QDL_PAD_KEY_COL0__ECSPI1_SCLK 0x100b1 -+ >; -+ }; -+ -+ pinctrl_enet: enetgrp { -+ fsl,pins = < -+ MX6QDL_PAD_ENET_MDIO__ENET_MDIO 0x1b0b0 -+ MX6QDL_PAD_ENET_MDC__ENET_MDC 0x1b0b0 -+ MX6QDL_PAD_RGMII_TXC__RGMII_TXC 0x1b0b0 -+ MX6QDL_PAD_RGMII_TD0__RGMII_TD0 0x1b0b0 -+ MX6QDL_PAD_RGMII_TD1__RGMII_TD1 0x1b0b0 -+ MX6QDL_PAD_RGMII_TD2__RGMII_TD2 0x1b0b0 -+ MX6QDL_PAD_RGMII_TD3__RGMII_TD3 0x1b0b0 -+ MX6QDL_PAD_RGMII_TX_CTL__RGMII_TX_CTL 0x1b0b0 -+ MX6QDL_PAD_ENET_REF_CLK__ENET_TX_CLK 0x1b0b0 -+ MX6QDL_PAD_RGMII_RXC__RGMII_RXC 0x1b0b0 -+ MX6QDL_PAD_RGMII_RD0__RGMII_RD0 0x1b0b0 -+ MX6QDL_PAD_RGMII_RD1__RGMII_RD1 0x1b0b0 -+ MX6QDL_PAD_RGMII_RD2__RGMII_RD2 0x1b0b0 -+ MX6QDL_PAD_RGMII_RD3__RGMII_RD3 0x1b0b0 -+ MX6QDL_PAD_RGMII_RX_CTL__RGMII_RX_CTL 0x1b0b0 -+ MX6QDL_PAD_GPIO_16__ENET_REF_CLK 0x4001b0a8 -+ >; -+ }; -+ -+ pinctrl_gpio_keys: gpio_keysgrp { -+ fsl,pins = < -+ MX6QDL_PAD_EIM_D29__GPIO3_IO29 0x80000000 -+ MX6QDL_PAD_GPIO_4__GPIO1_IO04 0x80000000 -+ MX6QDL_PAD_GPIO_5__GPIO1_IO05 0x80000000 -+ >; -+ }; -+ -+ pinctrl_hdmi_cec: hdmi_cecgrp { -+ fsl,pins = < -+ MX6QDL_PAD_KEY_ROW2__HDMI_TX_CEC_LINE 0x1f8b0 -+ >; -+ }; -+ -+ pinctrl_hdmi_hdcp: hdmi_hdcpgrp { -+ fsl,pins = < -+ MX6QDL_PAD_KEY_COL3__HDMI_TX_DDC_SCL 0x4001b8b1 -+ MX6QDL_PAD_KEY_ROW3__HDMI_TX_DDC_SDA 0x4001b8b1 -+ >; -+ }; -+ -+ pinctrl_i2c1: i2c1grp { -+ fsl,pins = < -+ MX6QDL_PAD_CSI0_DAT8__I2C1_SDA 0x4001b8b1 -+ MX6QDL_PAD_CSI0_DAT9__I2C1_SCL 0x4001b8b1 -+ >; -+ }; -+ -+ pinctrl_i2c2: i2c2grp { -+ fsl,pins = < -+ MX6QDL_PAD_KEY_COL3__I2C2_SCL 0x4001b8b1 -+ MX6QDL_PAD_KEY_ROW3__I2C2_SDA 0x4001b8b1 -+ >; -+ }; -+ -+ pinctrl_i2c3: i2c3grp { -+ fsl,pins = < -+ MX6QDL_PAD_GPIO_3__I2C3_SCL 0x4001b8b1 -+ MX6QDL_PAD_GPIO_6__I2C3_SDA 0x4001b8b1 -+ >; -+ }; -+ -+ pinctrl_ipu1: ipu1grp { -+ fsl,pins = < -+ MX6QDL_PAD_DI0_DISP_CLK__IPU1_DI0_DISP_CLK 0x10 -+ MX6QDL_PAD_DI0_PIN15__IPU1_DI0_PIN15 0x10 -+ MX6QDL_PAD_DI0_PIN2__IPU1_DI0_PIN02 0x10 -+ MX6QDL_PAD_DI0_PIN3__IPU1_DI0_PIN03 0x10 -+ MX6QDL_PAD_DI0_PIN4__IPU1_DI0_PIN04 0x80000000 -+ MX6QDL_PAD_DISP0_DAT0__IPU1_DISP0_DATA00 0x10 -+ MX6QDL_PAD_DISP0_DAT1__IPU1_DISP0_DATA01 0x10 -+ MX6QDL_PAD_DISP0_DAT2__IPU1_DISP0_DATA02 0x10 -+ MX6QDL_PAD_DISP0_DAT3__IPU1_DISP0_DATA03 0x10 -+ MX6QDL_PAD_DISP0_DAT4__IPU1_DISP0_DATA04 0x10 -+ MX6QDL_PAD_DISP0_DAT5__IPU1_DISP0_DATA05 0x10 -+ MX6QDL_PAD_DISP0_DAT6__IPU1_DISP0_DATA06 0x10 -+ MX6QDL_PAD_DISP0_DAT7__IPU1_DISP0_DATA07 0x10 -+ MX6QDL_PAD_DISP0_DAT8__IPU1_DISP0_DATA08 0x10 -+ MX6QDL_PAD_DISP0_DAT9__IPU1_DISP0_DATA09 0x10 -+ MX6QDL_PAD_DISP0_DAT10__IPU1_DISP0_DATA10 0x10 -+ MX6QDL_PAD_DISP0_DAT11__IPU1_DISP0_DATA11 0x10 -+ MX6QDL_PAD_DISP0_DAT12__IPU1_DISP0_DATA12 0x10 -+ MX6QDL_PAD_DISP0_DAT13__IPU1_DISP0_DATA13 0x10 -+ MX6QDL_PAD_DISP0_DAT14__IPU1_DISP0_DATA14 0x10 -+ MX6QDL_PAD_DISP0_DAT15__IPU1_DISP0_DATA15 0x10 -+ MX6QDL_PAD_DISP0_DAT16__IPU1_DISP0_DATA16 0x10 -+ MX6QDL_PAD_DISP0_DAT17__IPU1_DISP0_DATA17 0x10 -+ MX6QDL_PAD_DISP0_DAT18__IPU1_DISP0_DATA18 0x10 -+ MX6QDL_PAD_DISP0_DAT19__IPU1_DISP0_DATA19 0x10 -+ MX6QDL_PAD_DISP0_DAT20__IPU1_DISP0_DATA20 0x10 -+ MX6QDL_PAD_DISP0_DAT21__IPU1_DISP0_DATA21 0x10 -+ MX6QDL_PAD_DISP0_DAT22__IPU1_DISP0_DATA22 0x10 -+ MX6QDL_PAD_DISP0_DAT23__IPU1_DISP0_DATA23 0x10 -+ >; -+ }; -+ -+ pinctrl_pcie: pciegrp { -+ fsl,pins = < -+ MX6QDL_PAD_GPIO_17__GPIO7_IO12 0x80000000 -+ >; -+ }; -+ -+ pinctrl_pwm1: pwm1grp { -+ fsl,pins = < -+ MX6QDL_PAD_SD1_DAT3__PWM1_OUT 0x1b0b1 -+ >; -+ }; -+ -+ pinctrl_uart1: uart1grp { -+ fsl,pins = < -+ MX6QDL_PAD_CSI0_DAT10__UART1_TX_DATA 0x1b0b1 -+ MX6QDL_PAD_CSI0_DAT11__UART1_RX_DATA 0x1b0b1 -+ >; -+ }; -+ -+ pinctrl_usbotg: usbotggrp { -+ fsl,pins = < -+ MX6QDL_PAD_ENET_RX_ER__USB_OTG_ID 0x17059 -+ >; -+ }; -+ -+ pinctrl_usdhc2: usdhc2grp { -+ fsl,pins = < -+ MX6QDL_PAD_SD2_CMD__SD2_CMD 0x17059 -+ MX6QDL_PAD_SD2_CLK__SD2_CLK 0x10059 -+ MX6QDL_PAD_SD2_DAT0__SD2_DATA0 0x17059 -+ MX6QDL_PAD_SD2_DAT1__SD2_DATA1 0x17059 -+ MX6QDL_PAD_SD2_DAT2__SD2_DATA2 0x17059 -+ MX6QDL_PAD_SD2_DAT3__SD2_DATA3 0x17059 -+ MX6QDL_PAD_NANDF_D4__SD2_DATA4 0x17059 -+ MX6QDL_PAD_NANDF_D5__SD2_DATA5 0x17059 -+ MX6QDL_PAD_NANDF_D6__SD2_DATA6 0x17059 -+ MX6QDL_PAD_NANDF_D7__SD2_DATA7 0x17059 -+ >; -+ }; -+ -+ pinctrl_usdhc3: usdhc3grp { -+ fsl,pins = < -+ MX6QDL_PAD_SD3_CMD__SD3_CMD 0x17059 -+ MX6QDL_PAD_SD3_CLK__SD3_CLK 0x10059 -+ MX6QDL_PAD_SD3_DAT0__SD3_DATA0 0x17059 -+ MX6QDL_PAD_SD3_DAT1__SD3_DATA1 0x17059 -+ MX6QDL_PAD_SD3_DAT2__SD3_DATA2 0x17059 -+ MX6QDL_PAD_SD3_DAT3__SD3_DATA3 0x17059 -+ MX6QDL_PAD_SD3_DAT4__SD3_DATA4 0x17059 -+ MX6QDL_PAD_SD3_DAT5__SD3_DATA5 0x17059 -+ MX6QDL_PAD_SD3_DAT6__SD3_DATA6 0x17059 -+ MX6QDL_PAD_SD3_DAT7__SD3_DATA7 0x17059 -+ >; -+ }; -+ -+ pinctrl_usdhc4: usdhc4grp { -+ fsl,pins = < -+ MX6QDL_PAD_SD4_CMD__SD4_CMD 0x17059 -+ MX6QDL_PAD_SD4_CLK__SD4_CLK 0x10059 -+ MX6QDL_PAD_SD4_DAT0__SD4_DATA0 0x17059 -+ MX6QDL_PAD_SD4_DAT1__SD4_DATA1 0x17059 -+ MX6QDL_PAD_SD4_DAT2__SD4_DATA2 0x17059 -+ MX6QDL_PAD_SD4_DAT3__SD4_DATA3 0x17059 -+ MX6QDL_PAD_SD4_DAT4__SD4_DATA4 0x17059 -+ MX6QDL_PAD_SD4_DAT5__SD4_DATA5 0x17059 -+ MX6QDL_PAD_SD4_DAT6__SD4_DATA6 0x17059 -+ MX6QDL_PAD_SD4_DAT7__SD4_DATA7 0x17059 -+ >; -+ }; -+ }; -+ -+ gpio_leds { -+ pinctrl_gpio_leds: gpioledsgrp { -+ fsl,pins = < -+ MX6QDL_PAD_GPIO_2__GPIO1_IO02 0x80000000 -+ >; -+ }; -+ }; -+}; -+ -+&ldb { -+ status = "okay"; -+ -+ lvds-channel@1 { -+ fsl,data-mapping = "spwg"; -+ fsl,data-width = <18>; -+ status = "okay"; -+ -+ display-timings { -+ native-mode = <&timing0>; -+ timing0: hsd100pxn1 { -+ clock-frequency = <65000000>; -+ hactive = <1024>; -+ vactive = <768>; -+ hback-porch = <220>; -+ hfront-porch = <40>; -+ vback-porch = <21>; -+ vfront-porch = <7>; -+ hsync-len = <60>; -+ vsync-len = <10>; -+ }; -+ }; -+ }; -+}; -+ -+&pcie { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pinctrl_pcie>; -+ reset-gpio = <&gpio7 12 0>; -+ status = "okay"; -+}; -+ -+&pcie { -+ power-on-gpio = <&gpio3 19 0>; -+ reset-gpio = <&gpio7 12 0>; -+ status = "okay"; -+}; -+ -+ -+&pwm1 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pinctrl_pwm1>; -+ status = "okay"; -+}; -+ -+&ldb { -+ ipu_id = <1>; -+ disp_id = <1>; -+ ext_ref = <1>; -+ mode = "sep1"; -+ sec_ipu_id = <1>; -+ sec_disp_id = <0>; -+ status = "okay"; -+}; -+ -+&ssi2 { -+ fsl,mode = "i2s-slave"; -+ status = "okay"; -+}; -+ -+&uart1 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pinctrl_uart1>; -+ status = "okay"; -+}; -+ -+&mipi_dsi { -+ dev_id = <0>; -+ disp_id = <0>; -+ lcd_panel = "TRULY-WVGA"; -+ disp-power-on-supply = <&reg_mipi_dsi_pwr_on>; -+ resets = <&mipi_dsi_reset>; -+ status = "okay"; -+}; -+ -+&usbh1 { -+ vbus-supply = <&reg_usb_h1_vbus>; -+ status = "okay"; -+}; -+ -+&usbotg { -+ vbus-supply = <&reg_usb_otg_vbus>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pinctrl_usbotg>; -+ disable-over-current; -+ status = "okay"; -+}; -+ -+&usdhc2 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pinctrl_usdhc2>; -+ bus-width = <8>; -+ cd-gpios = <&gpio2 2 0>; -+ wp-gpios = <&gpio2 3 0>; -+ status = "okay"; -+}; -+ -+&usdhc3 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pinctrl_usdhc3>; -+ bus-width = <8>; -+ cd-gpios = <&gpio2 0 0>; -+ wp-gpios = <&gpio2 1 0>; -+ status = "okay"; -+}; -+ -+&usdhc4 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pinctrl_usdhc4>; -+ bus-width = <8>; -+ non-removable; -+ no-1-8-v; -+ status = "okay"; -+}; -+ -+&hdmi_core { -+ ipu_id = <0>; -+ disp_id = <0>; -+ status = "okay"; -+}; -+ -+&hdmi_video { -+ fsl,phy_reg_vlev = <0x0294>; -+ fsl,phy_reg_cksymtx = <0x800d>; -+ status = "okay"; -+}; -+ -+&hdmi_audio { -+ status = "okay"; -+}; -+ -+&hdmi_cec { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pinctrl_hdmi_cec>; -+ status = "okay"; -+}; -+ -+&gpc { -+ fsl,cpu_pupscr_sw2iso = <0xf>; -+ fsl,cpu_pupscr_sw = <0xf>; -+ fsl,cpu_pdnscr_iso2sw = <0x1>; -+ fsl,cpu_pdnscr_iso = <0x1>; -+}; --- -1.8.1.2 - diff --git a/projects/imx6/patches/linux/linux-301-tbs2910_device_tree_updates.patch b/projects/imx6/patches/linux/linux-301-tbs2910_device_tree_updates.patch deleted file mode 100644 index 0674016f48c..00000000000 --- a/projects/imx6/patches/linux/linux-301-tbs2910_device_tree_updates.patch +++ /dev/null @@ -1,225 +0,0 @@ -From a2e2a3127261078129a5fc6f29222c7edbc3acea Mon Sep 17 00:00:00 2001 -From: vpeter4 <peter.vicman@gmail.com> -Date: Sun, 5 Oct 2014 14:25:57 +0200 -Subject: [PATCH] tbs2910_device_tree_updates - -gpio ir receiver, red led as heartbeat, fan (as led output), spdif sound, rtc - -sgtl5000 audio codec by @milan on TBS forum - http://www.tbsdtv.com/forum/viewtopic.php?f=154&t=8859&p=32020#p32018 - ---- - arch/arm/boot/dts/imx6qdl.dtsi | 2 +- - arch/arm/boot/dts/imx6q-tbs2910.dts | 4 ++ - arch/arm/boot/dts/imx6qdl-tbs2910.dtsi | 106 ++++++++++++++++++++++----------- - 3 files changed, 76 insertions(+), 36 deletions(-) - -diff --git a/arch/arm/boot/dts/imx6qdl-tbs2910.dtsi b/arch/arm/boot/dts/imx6qdl-tbs2910.dtsi -index f351c21..53803c9 100644 ---- a/arch/arm/boot/dts/imx6qdl-tbs2910.dtsi -+++ b/arch/arm/boot/dts/imx6qdl-tbs2910.dtsi -@@ -21,6 +21,14 @@ - mxcfb3 = &mxcfb4; - }; - -+ ir_recv: ir-receiver { -+ compatible = "gpio-ir-receiver"; -+ gpios = <&gpio3 18 1>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pinctrl_sabresd_ir>; -+ linux,rc-map-name = "rc-rc6-mce"; -+ }; -+ - chosen { - stdout-path = &uart1; - }; -@@ -57,9 +65,10 @@ - reg_audio: regulator@2 { - compatible = "regulator-fixed"; - reg = <2>; -- regulator-name = "wm8962-supply"; -- gpio = <&gpio4 10 0>; -- enable-active-high; -+ regulator-name = "sgtl5000-supply"; -+ regulator-min-microvolt = <3300000>; -+ regulator-max-microvolt = <3300000>; -+ regulator-always-on; - }; - - reg_mipi_dsi_pwr_on: mipi_dsi_pwr_on { -@@ -98,20 +107,14 @@ - }; - - sound { -- compatible = "fsl,imx6q-sabresd-wm8962", -- "fsl,imx-audio-wm8962"; -- model = "wm8962-audio"; -+ compatible = "fsl,imx-audio-sgtl5000"; -+ model = "imx-sgtl5000"; - ssi-controller = <&ssi2>; - audio-codec = <&codec>; - audio-routing = -- "Headphone Jack", "HPOUTL", -- "Headphone Jack", "HPOUTR", -- "Ext Spk", "SPKOUTL", -- "Ext Spk", "SPKOUTR", -- "MICBIAS", "AMIC", -- "IN3R", "MICBIAS", -- "DMIC", "MICBIAS", -- "DMICDAT", "DMIC"; -+ "MIC_IN", "Mic Jack", -+ "Mic Jack", "Mic Bias", -+ "Headphone Jack", "HP_OUT"; - mux-int-port = <2>; - mux-ext-port = <3>; - }; -@@ -132,7 +135,20 @@ - red { - gpios = <&gpio1 2 0>; - default-state = "on"; -+ linux,default-trigger = "heartbeat"; - }; -+ -+ fan { -+ gpios = <&gpio3 28 0>; -+ default-state = "off"; -+ }; -+ }; -+ -+ sound-spdif { -+ compatible = "fsl,imx-audio-spdif"; -+ model = "imx-spdif"; -+ spdif-controller = <&spdif>; -+ spdif-out; - }; - - sound-hdmi { -@@ -257,27 +273,15 @@ - pinctrl-0 = <&pinctrl_i2c1>; - status = "okay"; - -- codec: wm8962@1a { -- compatible = "wlf,wm8962"; -- reg = <0x1a>; -+ codec: sgtl5000@0a { - clocks = <&clks 201>; -- DCVDD-supply = <&reg_audio>; -- DBVDD-supply = <&reg_audio>; -- AVDD-supply = <&reg_audio>; -- CPVDD-supply = <&reg_audio>; -- MICVDD-supply = <&reg_audio>; -- PLLVDD-supply = <&reg_audio>; -- SPKVDD1-supply = <&reg_audio>; -- SPKVDD2-supply = <&reg_audio>; -- gpio-cfg = < -- 0x0000 /* 0:Default */ -- 0x0000 /* 1:Default */ -- 0x0013 /* 2:FN_DMICCLK */ -- 0x0000 /* 3:Default */ -- 0x8014 /* 4:FN_DMICCDAT */ -- 0x0000 /* 5:Default */ -- >; -- }; -+ compatible = "fsl,sgtl5000"; -+ reg = <0x0a>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pinctrl_sgtl5000>; -+ VDDA-supply = <&reg_audio>; -+ VDDIO-supply = <&reg_audio>; -+ }; - }; - - &i2c2 { -@@ -392,17 +396,13 @@ - }; - - &i2c3 { -- clock-frequency = <100000>; - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_i2c3>; - status = "okay"; - -- egalax_ts@04 { -- compatible = "eeti,egalax_ts"; -- reg = <0x04>; -- interrupt-parent = <&gpio6>; -- interrupts = <7 2>; -- wakeup-gpios = <&gpio6 7 0>; -+ rtc: rtc@68 { -+ compatible = "dallas,ds1307"; -+ reg = <0x68>; - }; - }; - -@@ -417,7 +417,6 @@ - MX6QDL_PAD_NANDF_D1__GPIO2_IO01 0x80000000 - MX6QDL_PAD_NANDF_D2__GPIO2_IO02 0x80000000 - MX6QDL_PAD_NANDF_D3__GPIO2_IO03 0x80000000 -- MX6QDL_PAD_GPIO_0__CCM_CLKO1 0x130b0 - MX6QDL_PAD_NANDF_CLE__GPIO6_IO07 0x80000000 - MX6QDL_PAD_ENET_TXD1__GPIO1_IO29 0x80000000 - MX6QDL_PAD_EIM_D22__GPIO3_IO22 0x80000000 -@@ -429,6 +428,12 @@ - >; - }; - -+ pinctrl_sgtl5000: sgtl5000grp { -+ fsl,pins = < -+ MX6QDL_PAD_GPIO_0__CCM_CLKO1 0x130b0 -+ >; -+ }; -+ - pinctrl_audmux: audmuxgrp { - fsl,pins = < - MX6QDL_PAD_CSI0_DAT7__AUD3_RXD 0x130b0 -@@ -475,6 +480,16 @@ - >; - }; - -+ pinctrl_sabresd_ir: sabresd-ir { -+ fsl,pins = < -+ MX6QDL_PAD_EIM_D18__GPIO3_IO18 0x80000000 -+ >; -+ }; -+ -+ pinctrl_sabresd_spdif: sabresd-spdif { -+ fsl,pins = <MX6QDL_PAD_GPIO_19__SPDIF_OUT 0x13091>; -+ }; -+ - pinctrl_hdmi_cec: hdmi_cecgrp { - fsl,pins = < - MX6QDL_PAD_KEY_ROW2__HDMI_TX_CEC_LINE 0x1f8b0 -@@ -618,6 +633,7 @@ - pinctrl_gpio_leds: gpioledsgrp { - fsl,pins = < - MX6QDL_PAD_GPIO_2__GPIO1_IO02 0x80000000 -+ MX6QDL_PAD_EIM_D28__GPIO3_IO28 0x80000000 - >; - }; - }; -@@ -698,6 +714,22 @@ - status = "okay"; - }; - -+&spdif { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pinctrl_sabresd_spdif>; -+ clocks = <&clks 197>, <&clks 0>, -+ <&clks 197>, <&clks 0>, -+ <&clks 0>, <&clks 0>, -+ <&clks 0>, <&clks 0>, -+ <&clks 0>; -+ clock-names = "core", "rxtx0", -+ "rxtx1", "rxtx2", -+ "rxtx3", "rxtx4", -+ "rxtx5", "rxtx6", -+ "rxtx7"; -+ status = "okay"; -+}; -+ - &usbh1 { - vbus-supply = <&reg_usb_h1_vbus>; - status = "okay"; --- -1.8.1.2 - diff --git a/projects/imx6/patches/linux/linux-330-udoo-chipidea-clock-for-an-USB-phy-hub.patch b/projects/imx6/patches/linux/linux-330-udoo-chipidea-clock-for-an-USB-phy-hub.patch deleted file mode 100644 index a94f5d91261..00000000000 --- a/projects/imx6/patches/linux/linux-330-udoo-chipidea-clock-for-an-USB-phy-hub.patch +++ /dev/null @@ -1,161 +0,0 @@ -From 7938bdb186ed300a8de0d78dff514f3c43209bc1 Mon Sep 17 00:00:00 2001 -From: vpeter4 <peter.vicman@gmail.com> -Date: Wed, 10 Dec 2014 11:58:19 +0100 -Subject: [PATCH] chipidea: ci_hdrc_imx: Allow handling the clock for an USB - phy/hub - -for file ci_hdrc_imx.c - 1-2-chipidea-ci_hdrc_imx-Allow-handling-the-clock-for-an-USB-phy-hub.patch -for file usbmisc_imx.c - unknown patch (used from https://github.com/mtx512/linux-imx/commits/imx_3.10.17_1.0.0_beta-udoo) - -Subject: [1/2] chipidea: ci_hdrc_imx: Allow handling the clock for an USB - phy/hub -From: Fabio Estevam <festevam@gmail.com> -Date: Thu, 14 Nov 2013 00:09:46 -0200 - -When using external USB PHY or USB hub, it is common that they require a clock -input. - -Add a 'clk_phy' clock, so that it can be retrieved from the device tree and -enabled in the driver, so that the clock can properly drive the external -USB phy/hub. - -Tested on a imx6q-udoo board, that connects via USBH1 to a USB2514 hub. - -In this board the USB2514 is clocked from a 24MHz clock that comes from the -imx6q CLKO2 pin. - ---- - .../devicetree/bindings/usb/ci-hdrc-imx.txt | 2 ++ - .../drivers/usb/chipidea/ci_hdrc_imx.c | 20 +++++++++++++++++++- - .../drivers/usb/chipidea/usbmisc_imx.c | 18 ++++++++++++++++++ - 3 files changed, 39 insertions(+), 1 deletion(-) - -diff --git a/Documentation/devicetree/bindings/usb/ci-hdrc-imx.txt b/Documentation/devicetree/bindings/usb/ci-hdrc-imx.txt -index b4b5b79..07ba38c 100644 ---- a/Documentation/devicetree/bindings/usb/ci-hdrc-imx.txt -+++ b/Documentation/devicetree/bindings/usb/ci-hdrc-imx.txt -@@ -18,6 +18,8 @@ Optional properties: - - vbus-supply: regulator for vbus - - disable-over-current: disable over current detect - - external-vbus-divider: enables off-chip resistor divider for Vbus -+- clocks: phandle to the clock that drives the USB hub -+- clock-names: must be "phy" - - Examples: - usb@02184000 { /* USB OTG */ -diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c b/drivers/usb/chipidea/ci_hdrc_imx.c -index de6b965..4e621fd 100644 ---- a/drivers/usb/chipidea/ci_hdrc_imx.c -+++ b/drivers/usb/chipidea/ci_hdrc_imx.c -@@ -68,6 +68,7 @@ struct ci_hdrc_imx_data { - struct usb_phy *phy; - struct platform_device *ci_pdev; - struct clk *clk; -+ struct clk *clk_phy; - struct imx_usbmisc_data *usbmisc_data; - bool supports_runtime_pm; - bool in_lpm; -@@ -155,10 +156,22 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev) - return ret; - } - -+ data->clk_phy = devm_clk_get(&pdev->dev, "phy"); -+ if (IS_ERR(data->clk_phy)) { -+ data->clk_phy = NULL; -+ } else { -+ ret = clk_prepare_enable(data->clk_phy); -+ if (ret) { -+ dev_err(&pdev->dev, -+ "Failed to enable clk_phy: %d\n", ret); -+ goto err_clk; -+ } -+ } -+ - data->phy = devm_usb_get_phy_by_phandle(&pdev->dev, "fsl,usbphy", 0); - if (IS_ERR(data->phy)) { - ret = PTR_ERR(data->phy); -- goto err_clk; -+ goto err_clk_phy; - } - - pdata.phy = data->phy; -@@ -234,6 +247,9 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev) - - disable_device: - ci_hdrc_remove_device(data->ci_pdev); -+err_clk_phy: -+ if (data->clk_phy) -+ clk_disable_unprepare(data->clk_phy); - err_clk: - clk_disable_unprepare(data->clk); - release_bus_freq(BUS_FREQ_HIGH); -@@ -246,6 +262,8 @@ static int ci_hdrc_imx_remove(struct platform_device *pdev) - - pm_runtime_disable(&pdev->dev); - ci_hdrc_remove_device(data->ci_pdev); -+ if (data->clk_phy) -+ clk_disable_unprepare(data->clk_phy); - clk_disable_unprepare(data->clk); - release_bus_freq(BUS_FREQ_HIGH); - -diff --git a/drivers/usb/chipidea/usbmisc_imx.c b/drivers/usb/chipidea/usbmisc_imx.c -index 683bcec..86fd7e6 100644 ---- a/drivers/usb/chipidea/usbmisc_imx.c -+++ b/drivers/usb/chipidea/usbmisc_imx.c -@@ -11,6 +11,7 @@ - - #include <linux/module.h> - #include <linux/of_platform.h> -+#include <linux/clk.h> - #include <linux/err.h> - #include <linux/io.h> - #include <linux/delay.h> -@@ -50,6 +51,7 @@ struct usbmisc_ops { - struct imx_usbmisc { - void __iomem *base; - spinlock_t lock; -+ struct clk *clk; - const struct usbmisc_ops *ops; - }; - -@@ -281,6 +283,7 @@ static int usbmisc_imx_probe(struct platform_device *pdev) - { - struct resource *res; - struct imx_usbmisc *data; -+ int ret; - struct of_device_id *tmp_dev; - - if (usbmisc) -@@ -297,6 +300,20 @@ static int usbmisc_imx_probe(struct platform_device *pdev) - if (IS_ERR(data->base)) - return PTR_ERR(data->base); - -+ data->clk = devm_clk_get(&pdev->dev, NULL); -+ if (IS_ERR(data->clk)) { -+ dev_err(&pdev->dev, -+ "failed to get clock, err=%ld\n", PTR_ERR(data->clk)); -+ return PTR_ERR(data->clk); -+ } -+ -+ ret = clk_prepare_enable(data->clk); -+ if (ret) { -+ dev_err(&pdev->dev, -+ "clk_prepare_enable failed, err=%d\n", ret); -+ return ret; -+ } -+ - tmp_dev = (struct of_device_id *) - of_match_device(usbmisc_imx_dt_ids, &pdev->dev); - data->ops = (const struct usbmisc_ops *)tmp_dev->data; -@@ -319,6 +336,7 @@ static int usbmisc_imx_probe(struct platform_device *pdev) - - static int usbmisc_imx_remove(struct platform_device *pdev) - { -+ clk_disable_unprepare(usbmisc->clk); - usbmisc = NULL; - return 0; - } --- -1.8.1.2 diff --git a/projects/imx6/patches/linux/linux-331-udoo-device_tree.patch b/projects/imx6/patches/linux/linux-331-udoo-device_tree.patch deleted file mode 100755 index c29ca66baa7..00000000000 --- a/projects/imx6/patches/linux/linux-331-udoo-device_tree.patch +++ /dev/null @@ -1,596 +0,0 @@ -From 688b8f753a832b63f8933cd65486692f8e9abe76 Mon Sep 17 00:00:00 2001 -From: Peter Vicman <peter.vicman@gmail.com> -Date: Fri, 7 Aug 2015 14:14:37 +0200 -Subject: [PATCH] udoo device tree - ---- - arch/arm/boot/dts/imx6dl-udoo.dts | 23 ++ - arch/arm/boot/dts/imx6q-udoo.dts | 76 +------ - arch/arm/boot/dts/imx6qdl-udoo.dtsi | 443 ++++++++++++++++++++++++++++++++++++ - 3 files changed, 471 insertions(+), 71 deletions(-) - create mode 100644 arch/arm/boot/dts/imx6dl-udoo.dts - create mode 100644 arch/arm/boot/dts/imx6qdl-udoo.dtsi - -diff --git a/arch/arm/boot/dts/imx6dl-udoo.dts b/arch/arm/boot/dts/imx6dl-udoo.dts -new file mode 100644 -index 0000000..45b33fc ---- /dev/null -+++ b/arch/arm/boot/dts/imx6dl-udoo.dts -@@ -0,0 +1,23 @@ -+/* -+ * Copyright 2013 Freescale Semiconductor, Inc. -+ * -+ * Author: Fabio Estevam <fabio.estevam@freescale.com> -+ * -+ * Copyright (C) 2014 Jasbir -+ * Copyright (C) 2014 udoo team -+ * Copyright (C) 2014 vpeter -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 as -+ * published by the Free Software Foundation. -+ * -+ */ -+ -+/dts-v1/; -+#include "imx6dl.dtsi" -+#include "imx6qdl-udoo.dtsi" -+ -+/ { -+ model = "Udoo i.MX6 Dual-lite Board"; -+ compatible = "udoo,imx6dl-udoo", "fsl,imx6dl"; -+}; -diff --git a/arch/arm/boot/dts/imx6q-udoo.dts b/arch/arm/boot/dts/imx6q-udoo.dts -index 7cc0267..b4cd8d6 100644 ---- a/arch/arm/boot/dts/imx6q-udoo.dts -+++ b/arch/arm/boot/dts/imx6q-udoo.dts -@@ -3,6 +3,10 @@ - * - * Author: Fabio Estevam <fabio.estevam@freescale.com> - * -+ * Copyright (C) 2014 Jasbir -+ * Copyright (C) 2014 udoo team -+ * Copyright (C) 2014 vpeter -+ * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. -@@ -11,83 +15,13 @@ - - /dts-v1/; - #include "imx6q.dtsi" -+#include "imx6qdl-udoo.dtsi" - - / { - model = "Udoo i.MX6 Quad Board"; - compatible = "udoo,imx6q-udoo", "fsl,imx6q"; -- -- chosen { -- stdout-path = &uart2; -- }; -- -- memory { -- reg = <0x10000000 0x40000000>; -- }; --}; -- --&fec { -- pinctrl-names = "default"; -- pinctrl-0 = <&pinctrl_enet>; -- phy-mode = "rgmii"; -- status = "okay"; --}; -- --&iomuxc { -- imx6q-udoo { -- pinctrl_enet: enetgrp { -- fsl,pins = < -- MX6QDL_PAD_RGMII_RXC__RGMII_RXC 0x1b0b0 -- MX6QDL_PAD_RGMII_RD0__RGMII_RD0 0x1b0b0 -- MX6QDL_PAD_RGMII_RD1__RGMII_RD1 0x1b0b0 -- MX6QDL_PAD_RGMII_RD2__RGMII_RD2 0x1b0b0 -- MX6QDL_PAD_RGMII_RD3__RGMII_RD3 0x1b0b0 -- MX6QDL_PAD_RGMII_RX_CTL__RGMII_RX_CTL 0x1b0b0 -- MX6QDL_PAD_RGMII_TXC__RGMII_TXC 0x1b0b0 -- MX6QDL_PAD_RGMII_TD0__RGMII_TD0 0x1b0b0 -- MX6QDL_PAD_RGMII_TD1__RGMII_TD1 0x1b0b0 -- MX6QDL_PAD_RGMII_TD2__RGMII_TD2 0x1b0b0 -- MX6QDL_PAD_RGMII_TD3__RGMII_TD3 0x1b0b0 -- MX6QDL_PAD_RGMII_TX_CTL__RGMII_TX_CTL 0x1b0b0 -- MX6QDL_PAD_ENET_REF_CLK__ENET_TX_CLK 0x1b0b0 -- MX6QDL_PAD_ENET_MDIO__ENET_MDIO 0x1b0b0 -- MX6QDL_PAD_ENET_MDC__ENET_MDC 0x1b0b0 -- MX6QDL_PAD_GPIO_16__ENET_REF_CLK 0x4001b0a8 -- >; -- }; -- -- pinctrl_uart2: uart2grp { -- fsl,pins = < -- MX6QDL_PAD_EIM_D26__UART2_TX_DATA 0x1b0b1 -- MX6QDL_PAD_EIM_D27__UART2_RX_DATA 0x1b0b1 -- >; -- }; -- -- pinctrl_usdhc3: usdhc3grp { -- fsl,pins = < -- MX6QDL_PAD_SD3_CMD__SD3_CMD 0x17059 -- MX6QDL_PAD_SD3_CLK__SD3_CLK 0x10059 -- MX6QDL_PAD_SD3_DAT0__SD3_DATA0 0x17059 -- MX6QDL_PAD_SD3_DAT1__SD3_DATA1 0x17059 -- MX6QDL_PAD_SD3_DAT2__SD3_DATA2 0x17059 -- MX6QDL_PAD_SD3_DAT3__SD3_DATA3 0x17059 -- >; -- }; -- }; - }; - - &sata { - status = "okay"; - }; -- --&uart2 { -- pinctrl-names = "default"; -- pinctrl-0 = <&pinctrl_uart2>; -- status = "okay"; --}; -- --&usdhc3 { -- pinctrl-names = "default"; -- pinctrl-0 = <&pinctrl_usdhc3>; -- non-removable; -- status = "okay"; --}; -diff --git a/arch/arm/boot/dts/imx6qdl-udoo.dtsi b/arch/arm/boot/dts/imx6qdl-udoo.dtsi -new file mode 100644 -index 0000000..f9ce5ca ---- /dev/null -+++ b/arch/arm/boot/dts/imx6qdl-udoo.dtsi -@@ -0,0 +1,445 @@ -+/* -+ * Copyright 2013 Freescale Semiconductor, Inc. -+ * -+ * Author: Fabio Estevam <fabio.estevam@freescale.com> -+ * -+ * Copyright (C) 2014 Jasbir -+ * Copyright (C) 2014 udoo team -+ * Copyright (C) 2014 vpeter -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 as -+ * published by the Free Software Foundation. -+ * -+ */ -+ -+/ { -+ chosen { -+ stdout-path = &uart1; -+ }; -+ -+ aliases { -+ mxcfb0 = &mxcfb1; -+ mxcfb1 = &mxcfb2; -+ mxcfb2 = &mxcfb3; -+ mxcfb3 = &mxcfb4; -+ ssi0 = &ssi1; -+ serial0 = &uart2; // console on ttymxc0 -+ serial1 = &uart1; -+ }; -+ -+ memory { -+ reg = <0x10000000 0x40000000>; -+ }; -+ -+ regulators { -+ compatible = "simple-bus"; -+ -+ reg_2p5v: 2p5v { -+ compatible = "regulator-fixed"; -+ regulator-name = "2P5V"; -+ regulator-min-microvolt = <2500000>; -+ regulator-max-microvolt = <2500000>; -+ regulator-always-on; -+ }; -+ -+ reg_3p3v: 3p3v { -+ compatible = "regulator-fixed"; -+ regulator-name = "3P3V"; -+ regulator-min-microvolt = <3300000>; -+ regulator-max-microvolt = <3300000>; -+ regulator-always-on; -+ }; -+ -+ aux_5v: aux5v { -+ compatible = "regulator-fixed"; -+ regulator-name = "AUX_5V"; -+ regulator-min-microvolt = <5000000>; -+ regulator-max-microvolt = <5000000>; -+ gpio = <&gpio6 10 1>; -+ regulator-boot-on; -+ enable-active-high; -+ }; -+ -+ reg_sensor: sensor_supply { -+ compatible = "regulator-fixed"; -+ regulator-name = "sensor-SUPPLY"; -+ enable-active-high; -+ }; -+ -+ reg_usb_otg_vbus: usb_otg_vbus { -+ compatible = "regulator-fixed"; -+ regulator-name = "usb_otg_vbus"; -+ regulator-min-microvolt = <5000000>; -+ regulator-max-microvolt = <5000000>; -+ enable-active-high; -+ }; -+ -+ reg_usb_h1_vbus: usb_h1_vbus { -+ compatible = "regulator-fixed"; -+ regulator-name = "usb_h1_vbus"; -+ regulator-min-microvolt = <5000000>; -+ regulator-max-microvolt = <5000000>; -+ enable-active-high; -+ startup-delay-us = <2>; /* USB2415 requires a POR of 1 us minimum */ -+ gpio = <&gpio7 12 0>; -+ }; -+ }; -+ -+ mxcfb1: fb@0 { -+ compatible = "fsl,mxc_sdc_fb"; -+ disp_dev = "hdmi"; -+ interface_pix_fmt = "RGB24"; -+ mode_str ="1920x1080M@60"; -+ default_bpp = <24>; -+ int_clk = <0>; -+ late_init = <0>; -+ status = "okay"; -+ }; -+ -+ mxcfb2: fb@1 { -+ compatible = "fsl,mxc_sdc_fb"; -+ disp_dev = "ldb"; -+ default_bpp = <24>; -+ interface_pix_fmt = "RGB24"; -+ mode_str =""; -+ int_clk = <0>; -+ late_init = <1>; -+ status = "okay"; -+ }; -+ -+ mxcfb3: fb@2 { -+ compatible = "fsl,mxc_sdc_fb"; -+ disp_dev = "hdmi"; -+ interface_pix_fmt = "RGB24"; -+ mode_str ="1920x1080M@60"; -+ default_bpp = <24>; -+ int_clk = <0>; -+ late_init = <0>; -+ status = "disabled"; -+ }; -+ -+ mxcfb4: fb@3 { -+ compatible = "fsl,mxc_sdc_fb"; -+ disp_dev = "hdmi"; -+ interface_pix_fmt = "RGB24"; -+ mode_str ="1920x1080M@60"; -+ default_bpp = <24>; -+ int_clk = <0>; -+ late_init = <0>; -+ status = "disabled"; -+ }; -+ -+ codec: vt1613 { -+ compatible = "via,vt1613"; -+ }; -+ -+ sound { -+ compatible = "udoo,imx-vt1613-audio"; -+ ssi-controller = <&ssi1>; -+ audio-codec = <&codec>; -+ mux-int-port = <1>; -+ mux-ext-port = <6>; -+ }; -+ -+ sound-hdmi { -+ compatible = "fsl,imx6q-audio-hdmi", -+ "fsl,imx-audio-hdmi"; -+ model = "imx-audio-hdmi"; -+ hdmi-controller = <&hdmi_audio>; -+ }; -+ -+ sound-spdif { -+ compatible = "fsl,imx-audio-spdif", -+ "fsl,imx-sabreauto-spdif"; -+ model = "imx-spdif"; -+ spdif-controller = <&spdif>; -+ spdif-in; -+ status = "disabled"; -+ }; -+ -+ v4l2_out { -+ compatible = "fsl,mxc_v4l2_output"; -+ status = "okay"; -+ }; -+ -+ poweroff { -+ compatible = "udoo,poweroff"; -+ sam3x_rst_gpio = <&gpio1 0 GPIO_ACTIVE_LOW>; -+ pwr_5v_gpio = <&gpio2 4 GPIO_ACTIVE_HIGH>; -+ arduino_mode = <0>; -+ }; -+}; -+ -+&ldb { -+ ipu_id = <1>; -+ disp_id = <0>; -+ ext_ref = <1>; -+ mode = "sep0"; -+ sec_ipu_id = <1>; -+ sec_disp_id = <1>; -+ status = "okay"; -+}; -+ -+&hdmi_audio { -+ status = "okay"; -+}; -+ -+&hdmi_core { -+ ipu_id = <0>; -+ disp_id = <0>; -+ status = "okay"; -+}; -+ -+&hdmi_video { -+ fsl,phy_reg_vlev = <0x0294>; -+ fsl,phy_reg_cksymtx = <0x800d>; -+ status = "okay"; -+}; -+ -+&i2c1 { -+ clock-frequency = <100000>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pinctrl_i2c1_2>; -+ status = "okay"; -+}; -+ -+&i2c2 { -+ clock-frequency = <100000>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pinctrl_i2c2_2>; -+ status = "okay"; -+ -+ hdmi: edid@50 { -+ compatible = "fsl,imx6-hdmi-i2c"; -+ reg = <0x50>; -+ }; -+}; -+ -+&i2c3 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pinctrl_i2c3_5>; -+ status = "okay"; -+ -+ touchscreen: st1232@55 { -+ compatible = "sitronix,st1232"; -+ reg = <0x55>; -+ interrupt-parent = <&gpio1>; -+ interrupts = <13 IRQ_TYPE_LEVEL_LOW>; -+ gpios = <&gpio1 15 GPIO_ACTIVE_LOW>; -+ /* udoo poweroff driver */ -+ lcd_panel_on_gpio = <&gpio1 2 GPIO_ACTIVE_HIGH>; -+ lcd_backlight_gpio = <&gpio1 4 GPIO_ACTIVE_HIGH>; -+ }; -+}; -+ -+&fec { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pinctrl_enet>; -+ phy-mode = "rgmii"; -+ status = "okay"; -+}; -+ -+&iomuxc { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pinctrl_hog>; -+ -+ imx6q-udoo { -+ pinctrl_hog: hoggrp { -+ fsl,pins = < -+ MX6QDL_PAD_NANDF_D4__GPIO2_IO04 0x80000000 /* 5v enable */ -+ MX6QDL_PAD_NANDF_CS0__GPIO6_IO11 0x80000000 /* Vtt suspend */ -+ MX6QDL_PAD_SD2_DAT0__GPIO1_IO15 0x80000000 /* touch reset */ -+ MX6QDL_PAD_EIM_EB3__GPIO2_IO31 0x80000000 /* ethernet power */ -+ -+ MX6QDL_PAD_GPIO_17__GPIO7_IO12 0x80000000 /* usb hub reset */ -+ MX6QDL_PAD_NANDF_CS2__CCM_CLKO2 0x130b0 /* clk usb hub */ -+ MX6QDL_PAD_EIM_WAIT__GPIO5_IO00 0xb0b1 /* usb otg select */ -+ -+ MX6QDL_PAD_NANDF_D5__GPIO2_IO05 0x80000000 /* sdcard power */ -+ MX6QDL_PAD_SD3_DAT5__GPIO7_IO00 0x80000000 /* sd card detect */ -+ MX6QDL_PAD_DISP0_DAT5__GPIO4_IO26 0x80000000 /* select dbg uart*/ -+ MX6QDL_PAD_GPIO_0__GPIO1_IO00 0x80000000 /* SAM3X reset */ -+ MX6QDL_PAD_DISP0_DAT0__GPIO4_IO21 0x30b1 /* SAM3X erase */ -+ MX6QDL_PAD_GPIO_16__GPIO7_IO11 0xb0b1 /* SAM3X vbus_en */ -+ MX6QDL_PAD_SD4_DAT7__GPIO2_IO15 0x80000000 /* SAM3X usb host */ -+ MX6QDL_PAD_GPIO_2__GPIO1_IO02 0x80000000 /* panel on */ -+ MX6QDL_PAD_GPIO_4__GPIO1_IO04 0x80000000 /* backlight on */ -+ MX6QDL_PAD_CSI0_DAT19__GPIO6_IO05 0x80000000 /* camera reset */ -+ MX6QDL_PAD_CSI0_DAT18__GPIO6_IO04 0x80000000 /* camera enable */ -+ MX6QDL_PAD_CSI0_PIXCLK__GPIO5_IO18 0x80000000 /* input mon serial*/ -+ MX6QDL_PAD_CSI0_DAT17__GPIO6_IO03 0x80000000 /* input mon serial*/ -+ MX6QDL_PAD_EIM_A19__GPIO2_IO19 0x80000000 /* writeprotect spi*/ -+ MX6QDL_PAD_GPIO_3__GPIO1_IO03 0x30b1 /* arduino pinout */ -+ >; -+ }; -+ -+ pinctrl_i2c1_2: i2c1grp-2 { -+ fsl,pins = < -+ MX6QDL_PAD_CSI0_DAT8__I2C1_SDA 0x4001b8b1 -+ MX6QDL_PAD_CSI0_DAT9__I2C1_SCL 0x4001b8b1 -+ >; -+ }; -+ -+ pinctrl_i2c2_2: i2c2grp-2 { -+ fsl,pins = < -+ MX6QDL_PAD_KEY_COL3__I2C2_SCL 0x4001b8b1 -+ MX6QDL_PAD_KEY_ROW3__I2C2_SDA 0x4001b8b1 -+ >; -+ }; -+ -+ pinctrl_i2c3_5: i2c3grp-5 { -+ fsl,pins = < -+ MX6QDL_PAD_GPIO_5__I2C3_SCL 0x4001b8b1 -+ MX6QDL_PAD_GPIO_6__I2C3_SDA 0x4001b8b1 -+ >; -+ }; -+ -+ pinctrl_enet: enetgrp { -+ fsl,pins = < -+ MX6QDL_PAD_RGMII_RXC__RGMII_RXC 0x1b0b0 -+ MX6QDL_PAD_RGMII_RD0__RGMII_RD0 0x1b0b0 -+ MX6QDL_PAD_RGMII_RD1__RGMII_RD1 0x1b0b0 -+ MX6QDL_PAD_RGMII_RD2__RGMII_RD2 0x1b0b0 -+ MX6QDL_PAD_RGMII_RD3__RGMII_RD3 0x1b0b0 -+ MX6QDL_PAD_RGMII_RX_CTL__RGMII_RX_CTL 0x1b0b0 -+ MX6QDL_PAD_RGMII_TXC__RGMII_TXC 0x1b0b0 -+ MX6QDL_PAD_RGMII_TD0__RGMII_TD0 0x1b0b0 -+ MX6QDL_PAD_RGMII_TD1__RGMII_TD1 0x1b0b0 -+ MX6QDL_PAD_RGMII_TD2__RGMII_TD2 0x1b0b0 -+ MX6QDL_PAD_RGMII_TD3__RGMII_TD3 0x1b0b0 -+ MX6QDL_PAD_RGMII_TX_CTL__RGMII_TX_CTL 0x1b0b0 -+ MX6QDL_PAD_ENET_REF_CLK__ENET_TX_CLK 0x1b0b0 -+ MX6QDL_PAD_ENET_MDIO__ENET_MDIO 0x1b0b0 -+ MX6QDL_PAD_ENET_MDC__ENET_MDC 0x1b0b0 -+ MX6QDL_PAD_EIM_D23__GPIO3_IO23 0x80000000 /* reset */ -+ >; -+ }; -+ -+ pinctrl_uart2: uart2grp { -+ fsl,pins = < -+ MX6QDL_PAD_EIM_D26__UART2_TX_DATA 0x1b0b1 -+ MX6QDL_PAD_EIM_D27__UART2_RX_DATA 0x1b0b1 -+ >; -+ }; -+ -+ pinctrl_uart4: uart4grp { -+ fsl,pins = < -+ MX6QDL_PAD_KEY_COL0__UART4_TX_DATA 0x1b0b1 -+ MX6QDL_PAD_KEY_ROW0__UART4_RX_DATA 0x1b0b1 -+ >; -+ }; -+ -+ pinctrl_usdhc3: usdhc3grp { -+ fsl,pins = < -+ MX6QDL_PAD_SD3_CMD__SD3_CMD 0x17059 -+ MX6QDL_PAD_SD3_CLK__SD3_CLK 0x10059 -+ MX6QDL_PAD_SD3_DAT0__SD3_DATA0 0x17059 -+ MX6QDL_PAD_SD3_DAT1__SD3_DATA1 0x17059 -+ MX6QDL_PAD_SD3_DAT2__SD3_DATA2 0x17059 -+ MX6QDL_PAD_SD3_DAT3__SD3_DATA3 0x17059 -+ >; -+ }; -+ -+ pinctrl_i2c3_1: i2c3grp-1 { -+ fsl,pins = < -+ MX6QDL_PAD_EIM_D17__I2C3_SCL 0x4001b8b1 -+ MX6QDL_PAD_EIM_D18__I2C3_SDA 0x4001b8b1 -+ >; -+ }; -+ -+ pinctrl_spdif_1: spdifgrp-1 { -+ fsl,pins = < -+ MX6QDL_PAD_KEY_COL3__SPDIF_IN 0x1b0b0 -+ >; -+ }; -+ -+ /*pinctrl_hdmi_cec_1: hdmicecgrp-1 { -+ fsl,pins = < -+ MX6QDL_PAD_EIM_A25__HDMI_TX_CEC_LINE 0x1f8b0 -+ >; -+ };*/ -+ -+ ac97link_running: ac97link_runninggrp { -+ fsl,pins = < -+ MX6QDL_PAD_DI0_PIN2__AUD6_TXD 0x80000000 -+ MX6QDL_PAD_DI0_PIN3__AUD6_TXFS 0x80000000 -+ MX6QDL_PAD_DI0_PIN4__AUD6_RXD 0x80000000 -+ MX6QDL_PAD_DI0_PIN15__AUD6_TXC 0x80000000 -+ >; -+ }; -+ -+ ac97link_reset: ac97link_resetgrp { -+ fsl,pins = < -+ MX6QDL_PAD_EIM_EB2__GPIO2_IO30 0x80000000 -+ MX6QDL_PAD_DI0_PIN3__GPIO4_IO19 0x80000000 -+ MX6QDL_PAD_DI0_PIN2__GPIO4_IO18 0x80000000 -+ >; -+ }; -+ -+ ac97link_warm_reset: ac97link_warm_resetgrp { -+ fsl,pins = < -+ MX6QDL_PAD_DI0_PIN3__GPIO4_IO19 0x80000000 -+ >; -+ }; -+ }; -+}; -+ -+&audmux { -+ status = "okay"; -+}; -+ -+&ssi1 { -+ fsl,mode = "ac97-slave"; -+ pinctrl-names = "default", "ac97-running", "ac97-reset", "ac97-warm-reset"; -+ pinctrl-0 = <&ac97link_running>; -+ pinctrl-1 = <&ac97link_running>; -+ pinctrl-2 = <&ac97link_reset>; -+ pinctrl-3 = <&ac97link_warm_reset>; -+ /* sync, sdata (output), reset */ -+ ac97-gpios = <&gpio4 19 0 &gpio4 18 0 &gpio2 30 0>; -+ status = "okay"; -+}; -+ -+&spdif { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pinctrl_spdif_1>; -+ status = "disabled"; -+}; -+ -+&uart2 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pinctrl_uart2>; -+ status = "okay"; -+}; -+ -+&uart4 { /* sam3x port */ -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pinctrl_uart4>; -+ status = "okay"; -+}; -+ -+&usdhc3 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pinctrl_usdhc3>; -+ non-removable; -+ keep-power-in-suspend; -+ status = "okay"; -+}; -+ -+&usbotg { -+ status = "disabled"; -+}; -+ -+&usbh1 { -+ vbus-supply = <&reg_usb_h1_vbus>; -+ clocks = <&clks 201>; -+ clock-names = "phy"; -+ status = "okay"; -+}; -+ -+&hdmi_cec { -+ /*pinctrl-names = "default"; -+ pinctrl-0 = <&pinctrl_hdmi_cec_1>;*/ -+ status = "disabled"; -+}; --- -1.8.1.2 - diff --git a/projects/imx6/patches/linux/linux-333-udoo-ts-poweroff-driver.patch b/projects/imx6/patches/linux/linux-333-udoo-ts-poweroff-driver.patch deleted file mode 100644 index 3da8d1c13f8..00000000000 --- a/projects/imx6/patches/linux/linux-333-udoo-ts-poweroff-driver.patch +++ /dev/null @@ -1,218 +0,0 @@ -From 2e1bacff999529c9b91995db5d87ad6708e7d49e Mon Sep 17 00:00:00 2001 -From: vpeter4 <peter.vicman@gmail.com> -Date: Wed, 3 Jun 2015 19:09:09 +0200 -Subject: [PATCH] Add poweroff driver, enable touchscreen - -Use original power_off function from rtc-snvs if set. -Arduino operation is controled by device tree parameter. - -From 1bc304cd507fe9eb5673223f0d76ec0aa4ff55f3 Mon Sep 17 00:00:00 2001 -From: mxt512 <mtx512@yahoo.co.uk> -Date: Thu, 13 Feb 2014 20:13:27 +0000 -Subject: [PATCH] Add poweroff driver. - -Existing pm_power_off function was in rtc-snvs. Given we need to reset the SAM3X and turn off -the 5v supply on power down, lets implement a power-off driver to do this for now. - -TODO: Not the cleanest solution but it works, should revisit. - Overwriting power_off function with udoo_power_off in case uddo is used. - ---- - drivers/power/reset/Kconfig | 8 ++ - drivers/power/reset/Makefile | 1 + - drivers/power/reset/udoo-poweroff.c | 159 ++++++++++++++++++++++++++++++++++++ - 3 files changed, 168 insertions(+) - create mode 100644 drivers/power/reset/udoo-poweroff.c - -diff --git a/drivers/power/reset/Kconfig b/drivers/power/reset/Kconfig -index 6d452a7..1a0620f 100644 ---- a/drivers/power/reset/Kconfig -+++ b/drivers/power/reset/Kconfig -@@ -57,3 +57,11 @@ config POWER_RESET_XGENE - depends on POWER_RESET - help - Reboot support for the APM SoC X-Gene Eval boards. -+ -+config POWER_RESET_UDOO -+ bool "UDOO power-off driver" -+ depends on POWER_RESET -+ help -+ This driver supports powering down the UDOO. -+ Say Y if you have a UDOO. -+ -diff --git a/drivers/power/reset/Makefile b/drivers/power/reset/Makefile -index a5b4a77..9b8e1b0 100644 ---- a/drivers/power/reset/Makefile -+++ b/drivers/power/reset/Makefile -@@ -5,3 +5,4 @@ obj-$(CONFIG_POWER_RESET_QNAP) += qnap-poweroff.o - obj-$(CONFIG_POWER_RESET_RESTART) += restart-poweroff.o - obj-$(CONFIG_POWER_RESET_VEXPRESS) += vexpress-poweroff.o - obj-$(CONFIG_POWER_RESET_XGENE) += xgene-reboot.o -+obj-$(CONFIG_POWER_RESET_UDOO) += udoo-poweroff.o -diff --git a/drivers/power/reset/udoo-poweroff.c b/drivers/power/reset/udoo-poweroff.c -new file mode 100644 -index 0000000..b3f8db8 ---- /dev/null -+++ b/drivers/power/reset/udoo-poweroff.c -@@ -0,0 +1,159 @@ -+/* -+ * UDOO board power off -+ * -+ * Copyright (C) 2014 Jasbir Matharu -+ * Copyright (C) 2015 Peter Vicman -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 as -+ * published by the Free Software Foundation. -+ * -+ */ -+ -+#include <linux/platform_device.h> -+#include <linux/module.h> -+#include <linux/io.h> -+#include <linux/gpio.h> -+#include <linux/delay.h> -+#include <linux/of_address.h> -+#include <linux/of_platform.h> -+#include <linux/of_gpio.h> -+ -+#define ARDUINO_MODE_STOPPED 1 /* does arduino starts at boot */ -+#define ARDUINO_MODE_LEAVE_POWER 2 /* leave 5V power on after shutdown (to keep arduino reset) */ -+ -+static void (*pm_power_off_orig)(void) = NULL; -+static int sam3x_rst_gpio = -EINVAL; -+static int pwr_5v_gpio = -EINVAL; -+static u32 arduino_mode = -EINVAL; -+static int lcd_touch_reset_gpio = -EINVAL; -+static int lcd_panel_on_gpio = -EINVAL; -+static int lcd_backlight_gpio = -EINVAL; -+ -+static void udoo_set_gpio(unsigned gpio, int value) { -+ int ret; -+ -+ if (! gpio_is_valid(gpio)) -+ return; -+ -+ ret = gpio_direction_output(gpio, value); -+ if (ret) -+ pr_err("%s: gpio %u/%d failed\n", __func__, gpio, value); -+} -+ -+static void udoo_request_gpio(struct device *dev, unsigned gpio, unsigned long flags, const char *label) { -+ int ret; -+ -+ if (! gpio_is_valid(gpio)) -+ return; -+ -+ ret = devm_gpio_request_one(dev, gpio, flags, label); -+ if (ret) -+ dev_err(dev, "request of gpio %s %u failed with %d\n", label, gpio, ret); -+} -+ -+static void udoo_power_off(void) { -+ pr_emerg("%s: powering off\n", __func__); -+ -+ if (pm_power_off_orig != NULL) -+ pm_power_off_orig(); -+ -+ udoo_set_gpio(lcd_touch_reset_gpio, 1); -+ udoo_set_gpio(lcd_panel_on_gpio, 0); -+ udoo_set_gpio(lcd_backlight_gpio, 0); -+ -+ udoo_set_gpio(sam3x_rst_gpio, 0); -+ msleep(50); /* stop sam3x safely */ -+ -+ if (gpio_is_valid(pwr_5v_gpio) && (arduino_mode & ARDUINO_MODE_LEAVE_POWER) == 0) { -+ pr_emerg("%s: 5V power down\n", __func__); -+ udoo_set_gpio(pwr_5v_gpio, 1); -+ } else -+ pr_emerg("%s: 5V power still on, sam3x reset\n", __func__); -+} -+ -+static int udoo_power_off_probe(struct platform_device *pdev) -+{ -+ struct device_node *pwr_off_np; -+ int ret; -+ -+ dev_err(&pdev->dev, "%s: power-off probe\n", __func__); -+ -+ pwr_off_np = of_find_compatible_node(NULL, NULL, "sitronix,st1232"); -+ if (pwr_off_np) { -+ lcd_touch_reset_gpio = of_get_named_gpio(pwr_off_np, "gpios", 0); -+ lcd_panel_on_gpio = of_get_named_gpio(pwr_off_np, "lcd_panel_on_gpio", 0); -+ lcd_backlight_gpio = of_get_named_gpio(pwr_off_np, "lcd_backlight_gpio", 0); -+ of_node_put(pwr_off_np); -+ -+ udoo_request_gpio(&pdev->dev, lcd_panel_on_gpio, GPIOF_OUT_INIT_HIGH, "lcd_panel_on_gpio"); -+ udoo_request_gpio(&pdev->dev, lcd_backlight_gpio, GPIOF_OUT_INIT_HIGH, "lcd_backlight_gpio"); -+ -+ ret = gpio_export(lcd_backlight_gpio, false); -+ } -+ -+ pwr_off_np = of_find_compatible_node(NULL, NULL, "udoo,poweroff"); -+ if (pwr_off_np) { -+ ret = of_property_read_u32(pwr_off_np, "arduino_mode", &arduino_mode); -+ if (ret != 0) { -+ dev_err(&pdev->dev, "%s: arduino mode not found in dtb\n", __func__); -+ arduino_mode = 0; -+ } -+ -+ sam3x_rst_gpio = of_get_named_gpio(pwr_off_np, "sam3x_rst_gpio", 0); -+ pwr_5v_gpio = of_get_named_gpio(pwr_off_np, "pwr_5v_gpio", 0); -+ of_node_put(pwr_off_np); -+ -+ udoo_request_gpio(&pdev->dev, pwr_5v_gpio, GPIOF_OUT_INIT_LOW, "pwr_5v_gpio"); -+ -+ if (gpio_is_valid(sam3x_rst_gpio)) { -+ ret = gpio_export(sam3x_rst_gpio, false); -+ -+ if (arduino_mode & ARDUINO_MODE_STOPPED) { -+ dev_err(&pdev->dev, "%s: arduino stopped\n", __func__); -+ udoo_set_gpio(sam3x_rst_gpio, 0); -+ } else { -+ dev_err(&pdev->dev, "%s: arduino running\n", __func__); -+ udoo_set_gpio(sam3x_rst_gpio, 1); -+ } -+ } -+ -+ pm_power_off_orig = pm_power_off; -+ pm_power_off = udoo_power_off; -+ return 0; -+ } -+ -+ /* If a pm_power_off function has already been added, leave it alone */ -+ if (pm_power_off != NULL) { -+ dev_err(&pdev->dev, "%s: pm_power_off function already registered\n", __func__); -+ return -EBUSY; -+ } -+ -+ return -ENODEV; -+} -+ -+static int udoo_power_off_remove(struct platform_device *pdev) -+{ -+ return 0; -+} -+ -+static const struct of_device_id power_off_dt_ids[] = { -+ { .compatible = "udoo,poweroff", }, -+ { /* sentinel */ } -+}; -+MODULE_DEVICE_TABLE(of, power_off_dt_ids); -+ -+static struct platform_driver udoo_power_off_driver = { -+ .driver = { -+ .name = "udoo_power_off", -+ .owner = THIS_MODULE, -+ .of_match_table = of_match_ptr(power_off_dt_ids), -+ }, -+ .probe = udoo_power_off_probe, -+ .remove = udoo_power_off_remove, -+}; -+module_platform_driver(udoo_power_off_driver); -+ -+MODULE_AUTHOR("Jasbir Matharu, Peter Vicman"); -+MODULE_DESCRIPTION("UDOO Power off driver v3"); -+MODULE_LICENSE("GPL v2"); --- -1.8.1.2 diff --git a/projects/imx6/patches/linux/linux-334-udoo-lvds-display-resolution.patch b/projects/imx6/patches/linux/linux-334-udoo-lvds-display-resolution.patch deleted file mode 100644 index 0d7c2cafb3f..00000000000 --- a/projects/imx6/patches/linux/linux-334-udoo-lvds-display-resolution.patch +++ /dev/null @@ -1,25 +0,0 @@ ---- a/drivers/video/mxc/ldb.c 2015-05-06 19:05:42.000000000 +0200 -+++ b/drivers/video/mxc/ldb.c 2015-06-18 17:14:52.241638700 +0200 -@@ -159,6 +159,22 @@ - 0, - FB_VMODE_NONINTERLACED, - FB_MODE_IS_DETAILED,}, -+ { -+ "LDB-WVGA-UDOO", 57, 800, 480, 30060, // Rif. 800x480 Panel DATAVISION dtfs070d0shlx -+ 56, 50, -+ 23, 20, -+ 150, 2, -+ 0, -+ FB_VMODE_NONINTERLACED, -+ FB_MODE_IS_DETAILED,}, -+ { -+ "LDB-WXGA-UDOO", 60, 1368, 768, 12960, // Rif. 1366x768 Panel G156XW01V0 -+ 9, 3, -+ 2, 7, -+ 200, 38, -+ 0, -+ FB_VMODE_NONINTERLACED, -+ FB_MODE_IS_DETAILED,}, - }; - static int ldb_modedb_sz = ARRAY_SIZE(ldb_modedb); - diff --git a/projects/imx6/patches/linux/linux-335-udoo-vt1613-audio-driver.patch b/projects/imx6/patches/linux/linux-335-udoo-vt1613-audio-driver.patch deleted file mode 100644 index 1a1976ac71c..00000000000 --- a/projects/imx6/patches/linux/linux-335-udoo-vt1613-audio-driver.patch +++ /dev/null @@ -1,1456 +0,0 @@ -From 236d6a6ace0e9589a99d66cb9f1e50a6c869d52e Mon Sep 17 00:00:00 2001 -From: waynatali <waykovalenko@gmail.com> -Date: Mon, 8 Jun 2015 18:00:46 +0200 -Subject: [PATCH 01/19] Added VT1613 codec select - ---- - sound/soc/codecs/Kconfig | 6 +++++- - 1 file changed, 5 insertions(+), 1 deletion(-) - -diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig -index 86513b0..d813556 100644 ---- a/sound/soc/codecs/Kconfig -+++ b/sound/soc/codecs/Kconfig -@@ -82,6 +82,7 @@ config SND_SOC_ALL_CODECS - select SND_SOC_TWL6040 if TWL6040_CORE - select SND_SOC_UDA134X - select SND_SOC_UDA1380 if I2C -+ select SND_SOC_VT1613 if SND_SOC_AC97_BUS - select SND_SOC_WL1273 if MFD_WL1273_CORE - select SND_SOC_WM0010 if SPI_MASTER - select SND_SOC_WM1250_EV1 if I2C -@@ -386,7 +387,10 @@ config SND_SOC_UDA134X - - config SND_SOC_UDA1380 - tristate -- -+ -+config SND_SOC_VT1613 -+ tristate -+ - config SND_SOC_WL1273 - tristate - --- -1.8.1.2 - - -From c6e8e1fec42464c53b68951bcacbac88fcdaa4cd Mon Sep 17 00:00:00 2001 -From: waynatali <waykovalenko@gmail.com> -Date: Mon, 8 Jun 2015 18:09:18 +0200 -Subject: [PATCH 02/19] Added VT1613 codec object file - ---- - sound/soc/codecs/Makefile | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile -index 2deeb14..6e03b09 100644 ---- a/sound/soc/codecs/Makefile -+++ b/sound/soc/codecs/Makefile -@@ -72,6 +72,7 @@ snd-soc-twl4030-objs := twl4030.o - snd-soc-twl6040-objs := twl6040.o - snd-soc-uda134x-objs := uda134x.o - snd-soc-uda1380-objs := uda1380.o -+snd-soc-vt1613-objs := vt1613.o - snd-soc-wl1273-objs := wl1273.o - snd-soc-wm-adsp-objs := wm_adsp.o - snd-soc-wm0010-objs := wm0010.o -@@ -203,6 +204,7 @@ obj-$(CONFIG_SND_SOC_TWL4030) += snd-soc-twl4030.o - obj-$(CONFIG_SND_SOC_TWL6040) += snd-soc-twl6040.o - obj-$(CONFIG_SND_SOC_UDA134X) += snd-soc-uda134x.o - obj-$(CONFIG_SND_SOC_UDA1380) += snd-soc-uda1380.o -+obj-$(CONFIG_SND_SOC_VT1613) += snd-soc-vt1613.o - obj-$(CONFIG_SND_SOC_WL1273) += snd-soc-wl1273.o - obj-$(CONFIG_SND_SOC_WM0010) += snd-soc-wm0010.o - obj-$(CONFIG_SND_SOC_WM1250_EV1) += snd-soc-wm1250-ev1.o --- -1.8.1.2 - - -From 00249f8bd18b0daabae622666db89cce93804d3d Mon Sep 17 00:00:00 2001 -From: waynatali <waykovalenko@gmail.com> -Date: Mon, 8 Jun 2015 18:41:53 +0200 -Subject: [PATCH 03/19] Added support for sound card with VT1613 AC'97 - ---- - sound/soc/fsl/Kconfig | 12 ++++++++++++ - 1 file changed, 12 insertions(+) - -diff --git a/sound/soc/fsl/Kconfig b/sound/soc/fsl/Kconfig -index 573dabb..e569a6f 100644 ---- a/sound/soc/fsl/Kconfig -+++ b/sound/soc/fsl/Kconfig -@@ -223,6 +223,18 @@ - Say Y if you want to add support for SoC audio on an i.MX board with - a sgtl5000 codec. - -+config SND_SOC_IMX_AC97_VT1613 -+ tristate "SoC Audio support for i.MX boards with VT1613 AC'97" -+ depends on OF -+ select SND_SOC_AC97_BUS -+ select SND_SOC_VT1613 -+ select SND_SOC_IMX_PCM_DMA -+ select SND_SOC_IMX_AUDMUX -+ select SND_SOC_FSL_SSI -+ help -+ Say Y if you want to add support for SoC audio on an i.MX board with -+ a VT1613 codec in AC97 mode. -+ - config SND_SOC_IMX_SPDIF - tristate "SoC Audio support for i.MX boards with S/PDIF" - select SND_SOC_IMX_PCM_DMA --- -1.8.1.2 - - -From fb49447a2eaa99be5e98a515c0f84af2ffcffd6c Mon Sep 17 00:00:00 2001 -From: waynatali <waykovalenko@gmail.com> -Date: Mon, 8 Jun 2015 18:57:41 +0200 -Subject: [PATCH 04/19] Added UDOO audio driver's object file - ---- - sound/soc/fsl/Makefile | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/sound/soc/fsl/Makefile b/sound/soc/fsl/Makefile -index 144cd69..c1d14a9 100644 ---- a/sound/soc/fsl/Makefile -+++ b/sound/soc/fsl/Makefile -@@ -56,6 +56,7 @@ - snd-soc-wm1133-ev1-objs := wm1133-ev1.o - snd-soc-imx-cs42888-objs := imx-cs42888.o - snd-soc-imx-sgtl5000-objs := imx-sgtl5000.o -+snd-soc-imx-ac97-vt1613-objs := imx-ac97-vt1613.o - snd-soc-imx-wm8962-objs := imx-wm8962.o - snd-soc-imx-spdif-objs := imx-spdif.o - snd-soc-imx-hdmi-objs := imx-hdmi.o -@@ -67,6 +68,7 @@ - obj-$(CONFIG_SND_MXC_SOC_WM1133_EV1) += snd-soc-wm1133-ev1.o - obj-$(CONFIG_SND_SOC_IMX_CS42888) += snd-soc-imx-cs42888.o - obj-$(CONFIG_SND_SOC_IMX_SGTL5000) += snd-soc-imx-sgtl5000.o -+obj-$(CONFIG_SND_SOC_IMX_AC97_VT1613) += snd-soc-imx-ac97-vt1613.o - obj-$(CONFIG_SND_SOC_IMX_WM8962) += snd-soc-imx-wm8962.o - obj-$(CONFIG_SND_SOC_IMX_SPDIF) += snd-soc-imx-spdif.o - obj-$(CONFIG_SND_SOC_IMX_HDMI) += snd-soc-imx-hdmi.o --- -1.8.1.2 - - -From 8a2a72cb699fe5d5809d4dcea26344d1f8be468e Mon Sep 17 00:00:00 2001 -From: waynatali <waykovalenko@gmail.com> -Date: Tue, 9 Jun 2015 10:38:11 +0200 -Subject: [PATCH 05/19] AC97 regmap API from linaro patch - ---- - drivers/base/regmap/regmap-ac97.c | 113 ++++++++++++++++++++++++++++++++++++++ - 1 file changed, 113 insertions(+) - create mode 100644 drivers/base/regmap/regmap-ac97.c - -diff --git a/drivers/base/regmap/regmap-ac97.c b/drivers/base/regmap/regmap-ac97.c -new file mode 100644 -index 0000000..ed05da8 ---- /dev/null -+++ b/drivers/base/regmap/regmap-ac97.c -@@ -0,0 +1,113 @@ -+/* -+ * Register map access API - AC'97 support -+ * -+ * Copyright 2013 Linaro Ltd. All rights reserved. -+ * -+ * This program is free software; you can redistribute it and/or modify it -+ * under the terms and conditions of the GNU General Public License, -+ * version 2, as published by the Free Software Foundation. -+ * -+ * This program is distributed in the hope it will be useful, but WITHOUT -+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -+ * more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program. If not, see <http://www.gnu.org/licenses/>. -+ */ -+ -+#include <linux/clk.h> -+#include <linux/err.h> -+#include <linux/init.h> -+#include <linux/io.h> -+#include <linux/module.h> -+#include <linux/regmap.h> -+#include <linux/slab.h> -+ -+#include <sound/ac97_codec.h> -+ -+bool regmap_ac97_default_volatile(struct device *dev, unsigned int reg) -+{ -+ switch (reg) { -+ case AC97_RESET: -+ case AC97_POWERDOWN: -+ case AC97_INT_PAGING: -+ case AC97_EXTENDED_ID: -+ case AC97_EXTENDED_STATUS: -+ case AC97_EXTENDED_MID: -+ case AC97_EXTENDED_MSTATUS: -+ case AC97_GPIO_STATUS: -+ case AC97_MISC_AFE: -+ case AC97_VENDOR_ID1: -+ case AC97_VENDOR_ID2: -+ case AC97_CODEC_CLASS_REV: -+ case AC97_PCI_SVID: -+ case AC97_PCI_SID: -+ case AC97_FUNC_SELECT: -+ case AC97_FUNC_INFO: -+ case AC97_SENSE_INFO: -+ return true; -+ default: -+ return false; -+ } -+} -+EXPORT_SYMBOL_GPL(regmap_ac97_default_volatile); -+ -+static int regmap_ac97_reg_read(void *context, unsigned int reg, -+ unsigned int *val) -+{ -+ struct snd_ac97 *ac97 = context; -+ *val = ac97->bus->ops->read(ac97, reg); -+ -+ return 0; -+} -+ -+static int regmap_ac97_reg_write(void *context, unsigned int reg, -+ unsigned int val) -+{ -+ struct snd_ac97 *ac97 = context; -+ -+ ac97->bus->ops->write(ac97, reg, val); -+ -+ return 0; -+} -+ -+static const struct regmap_bus ac97_regmap_bus = { -+ .reg_write = regmap_ac97_reg_write, -+ .reg_read = regmap_ac97_reg_read, -+}; -+ -+/** -+ * regmap_init_ac97(): Initialise AC'97 register map -+ * -+ * @ac97: Device that will be interacted with -+ * @config: Configuration for register map -+ * -+ * The return value will be an ERR_PTR() on error or a valid pointer to -+ * a struct regmap. -+ */ -+struct regmap *regmap_init_ac97(struct snd_ac97 *ac97, -+ const struct regmap_config *config) -+{ -+ return regmap_init(&ac97->dev, &ac97_regmap_bus, ac97, config); -+} -+EXPORT_SYMBOL_GPL(regmap_init_ac97); -+ -+/** -+ * devm_regmap_init_ac97(): Initialise AC'97 register map -+ * -+ * @ac97: Device that will be interacted with -+ * @config: Configuration for register map -+ * -+ * The return value will be an ERR_PTR() on error or a valid pointer -+ * to a struct regmap. The regmap will be automatically freed by the -+ * device management code. -+ */ -+struct regmap *devm_regmap_init_ac97(struct snd_ac97 *ac97, -+ const struct regmap_config *config) -+{ -+ return devm_regmap_init(&ac97->dev, &ac97_regmap_bus, ac97, config); -+} -+EXPORT_SYMBOL_GPL(devm_regmap_init_ac97); -+ -+MODULE_LICENSE("GPL v2"); --- -1.8.1.2 - - -From 3bcfa4b56ad2bc3f3bbdedf6fa930bc4d761116d Mon Sep 17 00:00:00 2001 -From: waynatali <waykovalenko@gmail.com> -Date: Tue, 9 Jun 2015 10:42:43 +0200 -Subject: [PATCH 06/19] Add REGMAP_AC97 - from linaro patch - ---- - drivers/base/regmap/Kconfig | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - -diff --git a/drivers/base/regmap/Kconfig b/drivers/base/regmap/Kconfig -index 4251570..be1d6f5 100644 ---- a/drivers/base/regmap/Kconfig -+++ b/drivers/base/regmap/Kconfig -@@ -3,11 +3,14 @@ - # subsystems should select the appropriate symbols. - - config REGMAP -- default y if (REGMAP_I2C || REGMAP_SPI || REGMAP_SPMI || REGMAP_MMIO || REGMAP_IRQ) -+ default y if (REGMAP_I2C || REGMAP_SPI || REGMAP_SPMI || REGMAP_AC97 || REGMAP_MMIO || REGMAP_IRQ) - select LZO_COMPRESS - select LZO_DECOMPRESS - select IRQ_DOMAIN if REGMAP_IRQ - bool -+ -+config REGMAP_AC97 -+ tristate - - config REGMAP_I2C - tristate --- -1.8.1.2 - - -From c0b42bf7e32581d820e6a33dc54a81f241147136 Mon Sep 17 00:00:00 2001 -From: waynatali <waykovalenko@gmail.com> -Date: Tue, 9 Jun 2015 10:45:53 +0200 -Subject: [PATCH 07/19] add regmap-ac97 object file (linaro patch) - ---- - drivers/base/regmap/Makefile | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/drivers/base/regmap/Makefile b/drivers/base/regmap/Makefile -index a7c670b..0a53365 100644 ---- a/drivers/base/regmap/Makefile -+++ b/drivers/base/regmap/Makefile -@@ -1,6 +1,7 @@ - obj-$(CONFIG_REGMAP) += regmap.o regcache.o - obj-$(CONFIG_REGMAP) += regcache-rbtree.o regcache-lzo.o regcache-flat.o - obj-$(CONFIG_DEBUG_FS) += regmap-debugfs.o -+obj-$(CONFIG_REGMAP_AC97) += regmap-ac97.o - obj-$(CONFIG_REGMAP_I2C) += regmap-i2c.o - obj-$(CONFIG_REGMAP_SPI) += regmap-spi.o - obj-$(CONFIG_REGMAP_SPMI) += regmap-spmi.o --- -1.8.1.2 - - -From e3376edcf3e3edb2c9ae997aff376bc922f4af55 Mon Sep 17 00:00:00 2001 -From: waynatali <waykovalenko@gmail.com> -Date: Tue, 9 Jun 2015 11:05:20 +0200 -Subject: [PATCH 08/19] AC97 regmap API (from linaro patch) - ---- - include/linux/regmap.h | 7 +++++++ - 1 file changed, 7 insertions(+) - -diff --git a/include/linux/regmap.h b/include/linux/regmap.h -index 4149f1a..46b092b 100644 ---- a/include/linux/regmap.h -+++ b/include/linux/regmap.h -@@ -27,6 +27,7 @@ struct spmi_device; - struct regmap; - struct regmap_range_cfg; - struct regmap_field; -+struct snd_ac97; - - /* An enum of all the supported cache types */ - enum regcache_type { -@@ -326,6 +327,8 @@ struct regmap *regmap_init_spmi(struct spmi_device *dev, - struct regmap *regmap_init_mmio_clk(struct device *dev, const char *clk_id, - void __iomem *regs, - const struct regmap_config *config); -+struct regmap *regmap_init_ac97(struct snd_ac97 *ac97, -+ const struct regmap_config *config); - - struct regmap *devm_regmap_init(struct device *dev, - const struct regmap_bus *bus, -@@ -340,6 +343,10 @@ struct regmap *devm_regmap_init_spmi(struct spmi_device *dev, - struct regmap *devm_regmap_init_mmio_clk(struct device *dev, const char *clk_id, - void __iomem *regs, - const struct regmap_config *config); -+struct regmap *devm_regmap_init_ac97(struct snd_ac97 *ac97, -+ const struct regmap_config *config); -+ -+bool regmap_ac97_default_volatile(struct device *dev, unsigned int reg); - - /** - * regmap_init_mmio(): Initialise register map --- -1.8.1.2 - - -From 9b1514f6562f43438c8d6478bfb83f9372db7550 Mon Sep 17 00:00:00 2001 -From: waynatali <waykovalenko@gmail.com> -Date: Tue, 9 Jun 2015 11:25:20 +0200 -Subject: [PATCH 09/19] regmap: add reg_read/reg_write - -from Boris BREZILLON's patch "regmap: add reg_read/reg_write callbacks to regmap_bus struct" ---- - include/linux/regmap.h | 8 ++++++++ - 1 file changed, 8 insertions(+) - -diff --git a/include/linux/regmap.h b/include/linux/regmap.h -index 46b092b..fab0407 100644 ---- a/include/linux/regmap.h -+++ b/include/linux/regmap.h -@@ -273,6 +273,12 @@ typedef int (*regmap_hw_async_write)(void *context, - typedef int (*regmap_hw_read)(void *context, - const void *reg_buf, size_t reg_size, - void *val_buf, size_t val_size); -+ -+typedef int (*regmap_hw_reg_read)(void *context, unsigned int reg, -+ unsigned int *val); -+typedef int (*regmap_hw_reg_write)(void *context, unsigned int reg, -+ unsigned int val); -+ - typedef struct regmap_async *(*regmap_hw_async_alloc)(void); - typedef void (*regmap_hw_free_context)(void *context); - -@@ -306,7 +312,9 @@ struct regmap_bus { - regmap_hw_write write; - regmap_hw_gather_write gather_write; - regmap_hw_async_write async_write; -+ regmap_hw_reg_write reg_write; - regmap_hw_read read; -+ regmap_hw_reg_read reg_read; - regmap_hw_free_context free_context; - regmap_hw_async_alloc async_alloc; - u8 read_flag_mask; --- -1.8.1.2 - - -From 08effbde69449e1c1b4676466ba91fa95924dd22 Mon Sep 17 00:00:00 2001 -From: waynatali <waykovalenko@gmail.com> -Date: Tue, 9 Jun 2015 11:45:25 +0200 -Subject: [PATCH 10/19] Add _regmap_bus_reg_read/_regmap_bus_reg_write - -from Boris BREZILLON's patch - "regmap: add reg_read/reg_write callbacks to regmap_bus struct" ---- - drivers/base/regmap/regmap.c | 26 ++++++++++++++++++++++++++ - 1 file changed, 26 insertions(+) - -diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c -index 2f9a3d8..b672374 100644 ---- a/drivers/base/regmap/regmap.c -+++ b/drivers/base/regmap/regmap.c -@@ -35,10 +35,14 @@ static int _regmap_update_bits(struct regmap *map, unsigned int reg, - unsigned int mask, unsigned int val, - bool *change); - -+static int _regmap_bus_reg_read(void *context, unsigned int reg, -+ unsigned int *val); - static int _regmap_bus_read(void *context, unsigned int reg, - unsigned int *val); - static int _regmap_bus_formatted_write(void *context, unsigned int reg, - unsigned int val); -+static int _regmap_bus_reg_write(void *context, unsigned int reg, -+ unsigned int val); - static int _regmap_bus_raw_write(void *context, unsigned int reg, - unsigned int val); - -@@ -472,6 +476,12 @@ struct regmap *regmap_init(struct device *dev, - - map->defer_caching = false; - goto skip_format_initialization; -+ } else if (!bus->read || !bus->write) { -+ map->reg_read = _regmap_bus_reg_read; -+ map->reg_write = _regmap_bus_reg_write; -+ -+ map->defer_caching = false; -+ goto skip_format_initialization; - } else { - map->reg_read = _regmap_bus_read; - } -@@ -1267,6 +1277,14 @@ static int _regmap_bus_formatted_write(void *context, unsigned int reg, - return ret; - } - -+static int _regmap_bus_reg_write(void *context, unsigned int reg, -+ unsigned int val) -+{ -+ struct regmap *map = context; -+ -+ return map->bus->reg_write(map->bus_context, reg, val); -+} -+ - static int _regmap_bus_raw_write(void *context, unsigned int reg, - unsigned int val) - { -@@ -1708,6 +1726,14 @@ static int _regmap_raw_read(struct regmap *map, unsigned int reg, void *val, - return ret; - } - -+static int _regmap_bus_reg_read(void *context, unsigned int reg, -+ unsigned int *val) -+{ -+ struct regmap *map = context; -+ -+ return map->bus->reg_read(map->bus_context, reg, val); -+} -+ - static int _regmap_bus_read(void *context, unsigned int reg, - unsigned int *val) - { --- -1.8.1.2 - - -From 3d039a1d2561951e4f2a94e6e6d61f730c35ae5e Mon Sep 17 00:00:00 2001 -From: waynatali <waykovalenko@gmail.com> -Date: Tue, 9 Jun 2015 12:29:12 +0200 -Subject: [PATCH 11/19] some more supports for AC97 mode - ---- - sound/soc/fsl/fsl_ssi.c | 22 ++++++++++++++++------ - 1 file changed, 16 insertions(+), 6 deletions(-) - -diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c -index 00d0e5b..4e2bf1c 100644 ---- a/sound/soc/fsl/fsl_ssi.c -+++ b/sound/soc/fsl/fsl_ssi.c -@@ -936,6 +936,9 @@ - strcr |= CCSR_SSI_STCR_TFSL | CCSR_SSI_STCR_TSCKP | - CCSR_SSI_STCR_TXBIT0; - break; -+ case SND_SOC_DAIFMT_AC97: -+ scr |= CCSR_SSI_SCR_I2S_MODE_NORMAL; -+ break; - default: - return -EINVAL; - } -@@ -971,6 +974,11 @@ - case SND_SOC_DAIFMT_CBM_CFM: - scr &= ~CCSR_SSI_SCR_SYS_CLK_EN; - break; -+ case SND_SOC_DAIFMT_CBM_CFS: -+ strcr &= ~CCSR_SSI_STCR_TXDIR; /* transmit clock is external */ -+ strcr |= CCSR_SSI_STCR_TFDIR; /* frame sync generated internally */ -+ scr &= ~CCSR_SSI_SCR_SYS_CLK_EN; -+ break; - default: - return -EINVAL; - } -@@ -988,6 +996,9 @@ - write_ssi(srcr, &ssi->srcr); - write_ssi(scr, &ssi->scr); - -+ if (fmt & SND_SOC_DAIFMT_AC97) -+ fsl_ssi_setup_ac97(ssi_private); -+ - return 0; - } - -@@ -1232,6 +1243,7 @@ - }; - - static struct snd_soc_dai_driver fsl_ssi_ac97_dai = { -+ .probe = fsl_ssi_dai_probe, - .ac97_control = 1, - .playback = { - .stream_name = "AC97 Playback", -@@ -1497,6 +1509,10 @@ - } - } - -+ if (ac97) { -+ fsl_ssi_clk_ctrl(ssi_private, true); -+ } -+ - /* - * Enable interrupts only for MCP8610 and MX51. The other MXs have - * different writeable interrupt status registers. - --- -1.8.1.2 - - -From 455331b64c045f49713c6f3dcd4d85e3482bf868 Mon Sep 17 00:00:00 2001 -From: waynatali <waykovalenko@gmail.com> -Date: Tue, 9 Jun 2015 14:55:53 +0200 -Subject: [PATCH 12/19] VT1613 AC97 ASoC machine driver - ---- - sound/soc/fsl/imx-ac97-vt1613.c | 202 ++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 202 insertions(+) - create mode 100644 sound/soc/fsl/imx-ac97-vt1613.c - -diff --git a/sound/soc/fsl/imx-ac97-vt1613.c b/sound/soc/fsl/imx-ac97-vt1613.c -new file mode 100644 -index 0000000..3f2c212 ---- /dev/null -+++ b/sound/soc/fsl/imx-ac97-vt1613.c -@@ -0,0 +1,208 @@ -+/* -+ * imx-ac97-vt1613.c -- SoC audio for i.MX Seco UDOO board with -+ * VT1613 AC'97 codec -+ * Copyright: Seco s.r.l. -+ -+ * This program is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License as published by the -+ * Free Software Foundation; either version 2 of the License, or (at your -+ * option) any later version. -+ */ -+ -+ -+#include <linux/module.h> -+#include <linux/of_platform.h> -+#include <sound/soc.h> -+#include <sound/soc-dapm.h> -+ -+#include "../codecs/vt1613.h" -+#include "imx-audmux.h" -+#include "fsl_ssi.h" -+ -+#define DRV_NAME "imx-ac97-vt1613" -+ -+static int imx_vt1613_audio_params(struct snd_pcm_substream *substream, -+ struct snd_pcm_hw_params *params) -+{ -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; -+ int ret; -+ -+ ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_AC97 -+ | SND_SOC_DAIFMT_NB_NF -+ | SND_SOC_DAIFMT_CBM_CFS); -+ if (ret < 0) { -+ dev_err(cpu_dai->dev, -+ "Failed to set cpu dai format: %d\n", ret); -+ return ret; -+ } -+ -+ return 0; -+} -+static struct snd_soc_ops imx_vt1613_audio_ops = { -+ .hw_params = imx_vt1613_audio_params, -+}; -+ -+ -+static struct snd_soc_dai_link imx_vt1613_dai = { -+ .name = "vt1613-AC97", -+ .stream_name = "AC97-analog", -+ .codec_dai_name = "vt1613-hifi-analog", -+}; -+ -+static struct snd_soc_card imx_vt1613_card = { -+ .name = "imx-vt1613-audio", -+ .owner = THIS_MODULE, -+ .dai_link = &imx_vt1613_dai, -+ .num_links = 1, -+}; -+ -+static int imx_audmux_ac97_config(struct platform_device *pdev, int intPort, int extPort) -+{ -+ int ret; -+ unsigned int ptcr, pdcr; -+ -+ intPort = intPort - 1; -+ extPort = extPort - 1; -+ -+ ptcr = IMX_AUDMUX_V2_PTCR_SYN | -+ IMX_AUDMUX_V2_PTCR_TCLKDIR | IMX_AUDMUX_V2_PTCR_TCSEL(extPort); -+ pdcr = IMX_AUDMUX_V2_PDCR_RXDSEL(extPort); -+ -+ ret = imx_audmux_v2_configure_port(intPort, ptcr, pdcr); -+ if (ret) { -+ dev_err(&pdev->dev, "Audmux internal port setup failed\n"); -+ return ret; -+ } -+ -+ ptcr = IMX_AUDMUX_V2_PTCR_SYN | -+ IMX_AUDMUX_V2_PTCR_TFSDIR | IMX_AUDMUX_V2_PTCR_TFSEL(intPort); -+ -+ pdcr = IMX_AUDMUX_V2_PDCR_RXDSEL(intPort); -+ -+ ret = imx_audmux_v2_configure_port(extPort, ptcr, pdcr); -+ if (ret) { -+ dev_err(&pdev->dev, "Audmux external port setup failed\n"); -+ return ret; -+ } -+ -+ return 0; -+} -+ -+static int imx_vt1613_probe(struct platform_device *pdev) -+{ -+ struct device_node *ssi_np, *codec_np, *np = pdev->dev.of_node; -+ -+ struct platform_device *codec_pdev; -+ struct platform_device *ssi_pdev; -+ int int_port, ext_port; -+ int ret; -+ -+ if (!of_machine_is_compatible("udoo,imx6q-udoo") && !of_machine_is_compatible("udoo,imx6dl-udoo")) -+ return -ENODEV; -+ -+ if (vt1613_modules_dep_ok) { -+ dev_dbg(&pdev->dev, "module dependency (codec module) ok\n"); -+ } else { -+ dev_err(&pdev->dev, "module dependency (codec module) not ok\n"); -+ } -+ -+ ret = of_property_read_u32(np, "mux-int-port", &int_port); -+ if (ret) { -+ dev_err(&pdev->dev, "mux-int-port property missing or invalid\n"); -+ return ret; -+ } -+ -+ ret = of_property_read_u32(np, "mux-ext-port", &ext_port); -+ if (ret) { -+ dev_err(&pdev->dev, "mux-ext-port property missing or invalid\n"); -+ return ret; -+ } -+ -+ ret = imx_audmux_ac97_config(pdev, int_port, ext_port); -+ if (ret) { -+ dev_err(&pdev->dev, "Audmux port setup failed\n"); -+ return ret; -+ } -+ -+ ssi_np = of_parse_phandle(np, "ssi-controller", 0); -+ if (!ssi_np) { -+ dev_err(&pdev->dev, "ssi-controller phandle missing or invalid\n"); -+ return -EINVAL; -+ } -+ ssi_pdev = of_find_device_by_node(ssi_np); -+ if (!ssi_pdev) { -+ dev_err(&pdev->dev, "Failed to find SSI platform device\n"); -+ ret = -EINVAL; -+ goto fail; -+ } -+ -+ codec_np = of_parse_phandle(np, "audio-codec", 0); -+ if (!codec_np) { -+ dev_err(&pdev->dev, "audio-codec phandle missing or invalid\n"); -+ ret = -EINVAL; -+ goto fail; -+ } -+ codec_pdev = of_find_device_by_node(codec_np); -+ if (!codec_pdev) { -+ dev_err(&pdev->dev, "Failed to find codec device\n"); -+ ret = -EINVAL; -+ goto fail; -+ } -+ -+ imx_vt1613_dai.codec_name = dev_name(&codec_pdev->dev); -+ imx_vt1613_dai.cpu_of_node = ssi_np; -+ imx_vt1613_dai.cpu_dai_name = dev_name(&ssi_pdev->dev); -+ imx_vt1613_dai.platform_of_node = ssi_np; -+ imx_vt1613_dai.ops = &imx_vt1613_audio_ops; -+ imx_vt1613_dai.dai_fmt = SND_SOC_DAIFMT_AC97 | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFS; -+ -+ imx_vt1613_card.dev = &pdev->dev; -+ -+ platform_set_drvdata(pdev, &imx_vt1613_card); -+ -+ ret = snd_soc_register_card(&imx_vt1613_card); -+ if (ret) -+ dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", ret); -+ -+fail: -+ if (ssi_np) -+ of_node_put(ssi_np); -+ if (codec_np) -+ of_node_put(codec_np); -+ -+ return ret; -+ -+} -+ -+static int imx_vt1613_remove(struct platform_device *pdev) -+{ -+ int ret; -+ struct snd_soc_card *card = platform_get_drvdata(pdev); -+ -+ ret = snd_soc_unregister_card(card); -+ -+ return ret; -+} -+ -+static const struct of_device_id imx_vt1613_audio_match[] = { -+ { .compatible = "udoo,imx-vt1613-audio", }, -+ {} -+}; -+MODULE_DEVICE_TABLE(of, imx_vt1613_audio_match); -+ -+static struct platform_driver imx_vt1613_driver = { -+ .driver = { -+ .name = DRV_NAME, -+ .owner = THIS_MODULE, -+ .of_match_table = imx_vt1613_audio_match, -+ }, -+ .probe = imx_vt1613_probe, -+ .remove = imx_vt1613_remove, -+}; -+module_platform_driver(imx_vt1613_driver); -+ -+MODULE_AUTHOR("Seco <info@seco.it>"); -+MODULE_DESCRIPTION(DRV_NAME ":Freescale i.MX VT1613 AC97 ASoC machine driver"); -+MODULE_LICENSE("GPL v2"); -+MODULE_ALIAS("platform:imx-vt1613"); --- -1.8.1.2 - - -From c750211687be74e17acb8f089767a4d8099e3b6c Mon Sep 17 00:00:00 2001 -From: waynatali <waykovalenko@gmail.com> -Date: Wed, 10 Jun 2015 10:06:17 +0200 -Subject: [PATCH 13/19] VT1613 AC'97 codec driver - ---- - sound/soc/codecs/vt1613.c | 494 ++++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 494 insertions(+) - create mode 100644 sound/soc/codecs/vt1613.c - -diff --git a/sound/soc/codecs/vt1613.c b/sound/soc/codecs/vt1613.c -new file mode 100644 -index 0000000..9eccad7 ---- /dev/null -+++ b/sound/soc/codecs/vt1613.c -@@ -0,0 +1,497 @@ -+/* -+* vt1613.c -- ALSA SoC VT1613 AC'97 codec support -+* -+* Copyright 2010-2015 Seco s.r.l. -+* -+* This program is free software; you can redistribute it and/or -+* modify it under the terms of the GNU General Public License -+* version 2 as published by the Free Software Foundation. -+* -+* This program is distributed in the hope that it will be useful, but -+* WITHOUT ANY WARRANTY; without even the implied warranty of -+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+* General Public License for more details. -+* -+* You should have received a copy of the GNU General Public License -+* along with this program; if not, write to the Free Software -+* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -+* 02110-1301 USA -+* -+*/ -+ -+#include <linux/module.h> -+#include <linux/init.h> -+#include <linux/delay.h> -+#include <linux/regmap.h> -+#include <linux/slab.h> -+#include <linux/of_device.h> -+#include <sound/soc.h> -+#include <sound/soc-dapm.h> -+#include <sound/initval.h> -+#include <sound/tlv.h> -+#include <sound/ac97_codec.h> -+ -+#include "vt1613.h" -+#define DRV_NAME "vt1613-codec" -+ -+/* TODO: S/PDIF implementation. As this driver was developed for UDOO board's needs, -+* we skipped S/PDIF features developing*/ -+ -+bool vt1613_modules_dep_ok = true; -+EXPORT_SYMBOL_GPL(vt1613_modules_dep_ok); -+ -+static const struct reg_default vt1613_reg_defaults[] = { -+ { 0x00, 0x0140 }, /* Reset */ -+ { 0x02, 0x8000 }, /* Stereo Output Volume */ -+ { 0x04, 0x8000 }, /* HP Stereo Output Volume */ -+ { 0x0A, 0x0000 }, /* PC Beep Volume */ -+ { 0x0C, 0x8008 }, /* Phone Volume */ -+ { 0x0E, 0x8008 }, /* MIC Volume */ -+ { 0x10, 0x8808 }, /* Line In Volume */ -+ { 0x12, 0x8808 }, /* CD Volume */ -+ { 0x16, 0x8808 }, /* AUX Volume */ -+ { 0x18, 0x8808 }, /* PCM out Volume */ -+ { 0x1A, 0x0000 }, /* Record Select */ -+ { 0x1C, 0x8000 }, /* Record Gain */ -+ { 0x20, 0x0000 }, /* General Purpose */ -+ { 0x24, 0x0001 }, /* Audio Interrupt & Paging (AC'97 2.3) */ -+ { 0x26, 0x0000 }, /* Powerdown control / status */ -+ { 0x28, 0x097C }, /* Extended Audio ID */ -+ { 0x2A, 0x3830 }, /* Extended Audio Status and Control */ -+ { 0x2C, 0xBB80 }, /* PCM Front DAC Rate */ -+ { 0x32, 0xBB80 }, /* PCM LR ADC Rate */ -+ { 0x3A, 0x2000 }, /* S/PDIF Control */ -+ { 0x5A, 0x0000 }, /* Vendor Reserved Register */ -+ { 0x5C, 0x00A9 }, /* Vendor Reserved Register */ -+ { 0x62, 0xFFFF }, /* PCI SVID Page ID = 01h */ -+ { 0x64, 0xFFFF }, /* PCI SID Page ID = 01h */ -+ { 0x66, 0x0000 }, /* S/PDIF RX Status Page ID = 00h */ -+ { 0x68, 0x0000 }, /* S/PDIF RX Status Page ID = 00h */ -+ { 0x6A, 0x0000 }, /* S/PDIF RX Control Page ID = 00h */ -+ { 0x6C, 0x376A }, /* DAC Slot Mapping Page ID = 01h */ -+ { 0x6E, 0x0000 }, /* ADC Slot Mapping Page ID = 01h */ -+ { 0x70, 0x0000 }, /* ADC / SPDIF RX Left Peak */ -+ { 0x74, 0x0000 }, /* PLL Setting /Debugging */ -+ { 0x76, 0x1182 }, /* Miscellaneous */ -+ { 0x78, 0x0070 }, /* GPIO Control */ -+ { 0x7A, 0x0070 }, /* GPIO Status */ -+ { 0x7C, 0x5649 }, /* Vendor ID1 */ -+ { 0x7E, 0x4120 }, /* Vendor ID2 */ -+}; -+ -+static bool vt1613_readable_reg(struct device *dev, unsigned int reg) -+{ -+ switch (reg) { -+ case AC97_RESET ... AC97_HEADPHONE: -+ case AC97_PC_BEEP ... AC97_CD: -+ case AC97_AUX ... AC97_GENERAL_PURPOSE: -+ case AC97_INT_PAGING ... AC97_PCM_LR_ADC_RATE: -+ case AC97_SPDIF: -+ case AC97_AD_TEST: -+ case AC97_VT1613_STEREO_MIC: -+ case AC97_PCI_SVID ... AC97_SENSE_INFO: -+ case AC97_VT1613_DAC_SLOT_MAP: -+ case AC97_VT1613_ADC_SLOT_MAP: -+ case AC97_AD_CODEC_CFG: -+ case AC97_AD_SERIAL_CFG: -+ case AC97_AD_MISC: -+ case AC97_VT1613_GPIO_CTRL: -+ case AC97_VT1613_GPIO_STATUS: -+ case AC97_VENDOR_ID1: -+ case AC97_VENDOR_ID2: -+ return true; -+ default: -+ return false; -+ } -+} -+ -+static bool vt1613_writeable_reg(struct device *dev, unsigned int reg) -+{ -+ switch (reg) { -+ case AC97_RESET: -+ case AC97_EXTENDED_ID: -+ case AC97_PCM_SURR_DAC_RATE: -+ case AC97_PCM_LFE_DAC_RATE: -+ case AC97_FUNC_SELECT: -+ case AC97_FUNC_INFO: -+ case AC97_VT1613_ADC_SLOT_MAP: -+ case AC97_VENDOR_ID1: -+ case AC97_VENDOR_ID2: -+ return false; -+ default: -+ return vt1613_readable_reg(dev, reg); -+ } -+} -+ -+static const struct regmap_config vt1613_regmap_config = { -+ .name = "vt1613_regmap", -+ .reg_bits = 16, -+ .reg_stride = 2, -+ .val_bits = 16, -+ .max_register = 0x7E, -+ .cache_type = REGCACHE_RBTREE, -+ -+ .volatile_reg = regmap_ac97_default_volatile, -+ .readable_reg = vt1613_readable_reg, -+ .writeable_reg = vt1613_writeable_reg, -+ -+ .reg_defaults = vt1613_reg_defaults, -+ .num_reg_defaults = ARRAY_SIZE(vt1613_reg_defaults), -+}; -+ -+static const char *vt1613_record_mux[] = {"Mic", "CD", "--", "AUX", -+ "Line", "Stereo Mix", "Mono Mix", "Phone"}; -+static SOC_ENUM_DOUBLE_DECL(vt1613_record_enum, -+ AC97_REC_SEL, 8, 0, vt1613_record_mux); -+ -+static const char *vt1613_mic_mux[] = {"Mic1", "Mic2"}; -+static SOC_ENUM_SINGLE_DECL(vt1613_mic_enum, -+ AC97_GENERAL_PURPOSE, 8, vt1613_mic_mux); -+ -+static const char *vt1613_boost[] = {"0dB", "20dB"}; -+static SOC_ENUM_SINGLE_DECL(vt1613_boost_enum, -+ AC97_MIC, 6, vt1613_boost); -+ -+static const char *vt1613_mic_sel[] = {"MonoMic", "StereoMic"}; -+static SOC_ENUM_SINGLE_DECL(vt1613_mic_sel_enum, -+ AC97_VT1613_STEREO_MIC, 2, vt1613_mic_sel); -+ -+static const DECLARE_TLV_DB_LINEAR(master_tlv, -4650, 0); -+static const DECLARE_TLV_DB_LINEAR(record_tlv, 0, 2250); -+static const DECLARE_TLV_DB_LINEAR(beep_tlv, -4500, 0); -+static const DECLARE_TLV_DB_LINEAR(mix_tlv, -3450, 1200); -+ -+static const struct snd_kcontrol_new vt1613_snd_ac97_controls[] = { -+ SOC_DOUBLE_TLV("Speaker Playback Volume", AC97_MASTER, 8, 0, 31, 1, master_tlv), -+ SOC_SINGLE("Speaker Playback Switch", AC97_MASTER, 15, 1, 1), -+ -+ SOC_DOUBLE_TLV("Headphone Playback Volume", AC97_HEADPHONE, 8, 0, 31, 1, master_tlv), -+ SOC_SINGLE("Headphone Playback Switch", AC97_HEADPHONE, 15, 1, 1), -+ -+ SOC_DOUBLE_TLV("PCM Playback Volume", AC97_PCM, 8, 0, 31, 1, mix_tlv), -+ SOC_SINGLE("PCM Playback Switch", AC97_PCM, 15, 1, 1), -+ -+ SOC_DOUBLE_TLV("Record Capture Volume", AC97_REC_GAIN, 8, 0, 15, 0, record_tlv), -+ SOC_SINGLE("Record Capture Switch", AC97_REC_GAIN, 15, 1, 1), -+ -+ SOC_SINGLE_TLV("Beep Volume", AC97_PC_BEEP, 1, 15, 1, beep_tlv), -+ SOC_SINGLE("Beep Switch", AC97_PC_BEEP, 15, 1, 1), -+ SOC_SINGLE_TLV("Phone Volume", AC97_PHONE, 0, 31, 0, mix_tlv), -+ SOC_SINGLE("Phone Switch", AC97_PHONE, 15, 1, 1), -+ -+ /* Mono Mic and Stereo Mic's right channel controls */ -+ SOC_SINGLE_TLV("Mic/StereoMic_R Volume", AC97_MIC, 0, 31, 0, mix_tlv), -+ SOC_SINGLE("Mic/StereoMic_R Switch", AC97_MIC, 15, 1, 1), -+ -+ /* Stereo Mic's left channel controls */ -+ SOC_SINGLE("StereoMic_L Switch", AC97_MIC, 7, 1, 1), -+ SOC_SINGLE_TLV("StereoMic_L Volume", AC97_MIC, 8, 31, 0, mix_tlv), -+ -+ SOC_DOUBLE_TLV("Line Volume", AC97_LINE, 8, 0, 31, 0, mix_tlv), -+ SOC_SINGLE("Line Switch", AC97_LINE, 15, 1, 1), -+ SOC_DOUBLE_TLV("CD Volume", AC97_CD, 8, 0, 31, 0, mix_tlv), -+ SOC_SINGLE("CD Switch", AC97_CD, 15, 1, 1), -+ SOC_DOUBLE_TLV("AUX Volume", AC97_AUX, 8, 0, 31, 0, mix_tlv), -+ SOC_SINGLE("AUX Switch", AC97_AUX, 15, 1, 1), -+ -+ SOC_SINGLE("Analog Loopback", AC97_GENERAL_PURPOSE, 7, 1, 0), -+ -+ SOC_ENUM("Mic Boost", vt1613_boost_enum), -+ SOC_ENUM("Mic1/2 Mux", vt1613_mic_enum), -+ SOC_ENUM("Mic Select", vt1613_mic_sel_enum), -+ SOC_ENUM("Record Mux", vt1613_record_enum), -+}; -+ -+static const unsigned int vt1613_rates[] = { -+ 8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000 -+}; -+ -+static const struct snd_pcm_hw_constraint_list vt1613_rate_constraints = { -+ .count = ARRAY_SIZE(vt1613_rates), -+ .list = vt1613_rates, -+}; -+ -+static int vt1613_startup(struct snd_pcm_substream *substream, -+ struct snd_soc_dai *dai) -+{ -+ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK){ -+ snd_pcm_hw_constraint_list(substream->runtime, 0, -+ SNDRV_PCM_HW_PARAM_RATE, &vt1613_rate_constraints); -+ } else { -+ snd_pcm_hw_constraint_list(substream->runtime, 0, -+ SNDRV_PCM_HW_PARAM_RATE, &vt1613_rate_constraints); -+ } -+ -+ return 0; -+} -+ -+static int ac97_analog_prepare(struct snd_pcm_substream *substream, -+ struct snd_soc_dai *dai) -+{ -+ struct snd_soc_codec *codec = dai->codec; -+ struct snd_pcm_runtime *runtime = substream->runtime; -+ unsigned short reg; -+ -+ /* enable variable rate audio (VRA) and disable S/PDIF output */ -+ snd_soc_write(codec, AC97_EXTENDED_STATUS, -+ (snd_soc_read(codec, AC97_EXTENDED_STATUS) | 0x1) & ~0x4); -+ -+ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK){ -+ reg = AC97_PCM_FRONT_DAC_RATE; -+ } else { -+ reg = AC97_PCM_LR_ADC_RATE; -+ } -+ -+ return snd_soc_write(codec, reg, runtime->rate); -+} -+ -+static int ac97_digital_prepare(struct snd_pcm_substream *substream, -+ struct snd_soc_dai *dai) -+{ -+ struct snd_soc_codec *codec = dai->codec; -+ struct snd_pcm_runtime *runtime = substream->runtime; -+ -+ snd_soc_write(codec, AC97_SPDIF, 0x2002); -+ -+ /* enable VRA and S/PDIF output */ -+ snd_soc_write(codec, AC97_EXTENDED_STATUS, snd_soc_read(codec, AC97_EXTENDED_STATUS) | 0x5); -+ -+ return snd_soc_write(codec, AC97_PCM_FRONT_DAC_RATE, runtime->rate); -+} -+ -+static int vt1613_set_bias_level(struct snd_soc_codec *codec, -+ enum snd_soc_bias_level level) -+{ -+ switch (level) { -+ case SND_SOC_BIAS_ON: /* full On */ -+ case SND_SOC_BIAS_PREPARE: /* partial On */ -+ case SND_SOC_BIAS_STANDBY: /* Off, with power */ -+ snd_soc_write(codec, AC97_POWERDOWN, 0x0000); -+ break; -+ case SND_SOC_BIAS_OFF: /* Off, without power */ -+ /* disable everything including AC link */ -+ snd_soc_write(codec, AC97_POWERDOWN, 0xffff); -+ break; -+ } -+ codec->dapm.bias_level = level; -+ return 0; -+} -+ -+static int vt1613_reset(struct snd_soc_codec *codec, int try_warm) -+{ -+ -+ if (try_warm && soc_ac97_ops->warm_reset) { -+ soc_ac97_ops->warm_reset(codec->ac97); -+ if (snd_soc_read(codec, AC97_RESET) == 0x0140) -+ return 1; -+ } -+ soc_ac97_ops->reset(codec->ac97); -+ if (soc_ac97_ops->warm_reset) -+ soc_ac97_ops->warm_reset(codec->ac97); -+ if (snd_soc_read(codec, AC97_RESET) == 0x0140) -+ return 0; -+ -+ return -EIO; -+} -+ -+static struct snd_soc_dai_ops vt1613_dai_ops_analog = { -+ .startup = vt1613_startup, -+ .prepare = ac97_analog_prepare, -+}; -+ -+static struct snd_soc_dai_ops vt1613_dai_ops_digital = { -+ .prepare = ac97_digital_prepare, -+}; -+ -+struct snd_soc_dai_driver vt1613_dai[] = { -+{ -+ .name = "vt1613-hifi-analog", -+ .ac97_control = 1, -+ -+ .playback = { -+ .stream_name = "Playback", -+ .channels_min = 1, -+ .channels_max = 2, -+ .rates = SNDRV_PCM_RATE_KNOT, -+ .formats = SND_SOC_STD_AC97_FMTS, -+ }, -+ .capture = { -+ .stream_name = "Capture", -+ .channels_min = 1, -+ .channels_max = 2, -+ .rates = SNDRV_PCM_RATE_KNOT, -+ .formats = SND_SOC_STD_AC97_FMTS, -+ }, -+ -+ .ops = &vt1613_dai_ops_analog, -+}, -+{ -+ .name = "vt1613-hifi-IEC958", -+ .ac97_control = 1, -+ -+ .playback = { -+ .stream_name = "vt1613 IEC958", -+ .channels_min = 1, -+ .channels_max = 2, -+ .rates = SNDRV_PCM_RATE_32000 | -+ SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000, -+ .formats = SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE, -+ }, -+ -+ .ops = &vt1613_dai_ops_digital, -+} -+}; -+ -+static int vt1613_codec_suspend(struct snd_soc_codec *codec) -+{ -+ vt1613_set_bias_level(codec, SND_SOC_BIAS_OFF); -+ -+ return 0; -+} -+ -+static int vt1613_codec_resume(struct snd_soc_codec *codec) -+{ -+ u16 id, reset; -+ -+ reset = 0; -+ /* give the codec an AC97 warm reset to start the link */ -+reset: -+ if (reset > 5) { -+ printk(KERN_ERR "vt1613 failed to resume"); -+ return -EIO; -+ } -+ codec->ac97->bus->ops->warm_reset(codec->ac97); -+ id = soc_ac97_ops->read(codec->ac97, AC97_VENDOR_ID2); -+ if (id != 0x4123) { -+ vt1613_reset(codec, 0); -+ reset++; -+ goto reset; -+ } -+ vt1613_set_bias_level(codec, SND_SOC_BIAS_STANDBY); -+ -+ return 0; -+} -+ -+static int vt1613_codec_probe(struct snd_soc_codec *codec) -+{ -+ int ret = 0; -+ struct regmap *regmap; -+ -+ ret = snd_soc_new_ac97_codec(codec, soc_ac97_ops, 0); -+ if (ret){ -+ dev_err(codec->dev, "Failed to register AC97 codec: %d\n", ret); -+ return ret; -+ } -+ -+ soc_ac97_dev_register(codec); -+ if (ret){ -+ dev_err(codec->dev, "Failed to register AC97 codec to bus: %d\n", ret); -+ goto free_ac97; -+ } -+ codec->ac97_registered = 1; -+ -+ regmap = regmap_init_ac97(codec->ac97, &vt1613_regmap_config); -+ if (IS_ERR(regmap)) { -+ ret = PTR_ERR(regmap); -+ dev_err(codec->dev, "Failed to init register map: %d\n", ret); -+ goto free_ac97; -+ } -+ -+ codec->control_data = regmap; -+ ret = snd_soc_codec_set_cache_io(codec, 16, 16, SND_SOC_REGMAP); -+ if (ret < 0) { -+ dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret); -+ goto free_regmap; -+ } -+ snd_soc_codec_set_drvdata(codec, codec->ac97); -+ -+ /* do a cold reset for the controller and then try -+ * a warm reset followed by an optional cold reset for codec */ -+ -+ vt1613_reset(codec, 0); -+ ret = vt1613_reset(codec, 1); -+ if (ret < 0) { -+ printk(KERN_ERR "Failed to reset VT1613: AC97 link error\n"); -+ goto free_regmap; -+ } -+ -+ /* Read out vendor IDs */ -+ printk(KERN_INFO "VT1613 SoC Audio Codec [ID = %04x - %04x]\n", -+ snd_soc_read(codec, AC97_VENDOR_ID1), snd_soc_read(codec, AC97_VENDOR_ID2)); -+ -+ vt1613_set_bias_level(codec, SND_SOC_BIAS_STANDBY); -+ -+ /* unmute captures and playbacks volume */ -+ snd_soc_write(codec, AC97_MASTER, 0x0000); -+ snd_soc_write(codec, AC97_PCM, 0x0000); -+ snd_soc_write(codec, AC97_REC_GAIN, 0x0000); -+ -+ /* At 3.3V analog supply, for the bits 3:2 should be set 10b for the lowest power instead of default 00b */ -+ snd_soc_write(codec, AC97_AD_TEST, snd_soc_read(codec, AC97_AD_TEST) | 0x0008); -+ -+ /* To maximize recording quality by removing white noise */ -+ snd_soc_write(codec, AC97_AD_TEST, snd_soc_read(codec, AC97_AD_TEST) | 0x0400); -+ -+ snd_soc_add_codec_controls(codec, vt1613_snd_ac97_controls, -+ ARRAY_SIZE(vt1613_snd_ac97_controls)); -+ -+ return 0; -+ -+free_regmap: -+ regmap_exit(regmap); -+free_ac97: -+ snd_soc_free_ac97_codec(codec); -+ -+ return ret; -+} -+ -+static int vt1613_codec_remove(struct snd_soc_codec *codec) -+{ -+ regmap_exit(codec->control_data); -+ snd_soc_free_ac97_codec(codec); -+ return 0; -+} -+ -+struct snd_soc_codec_driver vt1613_codec = { -+ .probe = vt1613_codec_probe, -+ .remove = vt1613_codec_remove, -+ .suspend = vt1613_codec_suspend, -+ .resume = vt1613_codec_resume, -+ .set_bias_level = vt1613_set_bias_level, -+}; -+ -+static int vt1613_probe(struct platform_device *pdev) -+{ -+ return snd_soc_register_codec(&pdev->dev, -+ &vt1613_codec, vt1613_dai, ARRAY_SIZE(vt1613_dai)); -+} -+ -+static int vt1613_remove(struct platform_device *pdev) -+{ -+ snd_soc_unregister_codec(&pdev->dev); -+ return 0; -+} -+ -+static const struct of_device_id vt1613_of_match[] = { -+ { .compatible = "via,vt1613", }, -+ { } -+}; -+MODULE_DEVICE_TABLE(of, vt1613_of_match); -+ -+static struct platform_driver vt1613_codec_driver = { -+ .driver = { -+ .name = DRV_NAME, -+ .owner = THIS_MODULE, -+ .of_match_table = vt1613_of_match, -+ }, -+ -+ .probe = vt1613_probe, -+ .remove = vt1613_remove, -+}; -+ -+module_platform_driver(vt1613_codec_driver); -+ -+MODULE_DESCRIPTION("ASoC VT1613 codec driver"); -+MODULE_AUTHOR("Seco s.r.l."); -+MODULE_LICENSE("GPL"); -+MODULE_ALIAS("platform:" DRV_NAME); --- -1.8.1.2 - - -From 4bb3141618cdc0b8e9e05267f5402e29923bec07 Mon Sep 17 00:00:00 2001 -From: waynatali <waykovalenko@gmail.com> -Date: Wed, 10 Jun 2015 11:59:53 +0200 -Subject: [PATCH 16/19] VT1613 AC'97 header file - ---- - sound/soc/codecs/vt1613.h | 28 ++++++++++++++++++++++++++++ - 1 file changed, 28 insertions(+) - create mode 100644 sound/soc/codecs/vt1613.h - -diff --git a/sound/soc/codecs/vt1613.h b/sound/soc/codecs/vt1613.h -new file mode 100644 -index 0000000..482e757 ---- /dev/null -+++ b/sound/soc/codecs/vt1613.h -@@ -0,0 +1,29 @@ -+/* -+ * vt1613.h - VT1613 audio codec interface -+ * -+ * Copyright 2010-2015 Seco s.r.l. -+ * -+ * This program is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License as published by the -+ * Free Software Foundation; either version 2 of the License, or (at your -+ * option) any later version. -+ */ -+ -+#ifndef _VT1613_H -+#define _VT1613_H -+ -+#define AC97_VT1613_DAC_SLOT_MAP 0x6C -+#define AC97_VT1613_ADC_SLOT_MAP 0x6E -+ -+#define AC97_VT1613_GPIO_CTRL 0x78 -+#define AC97_VT1613_GPIO_STATUS 0x7A -+ -+#define AC97_VT1613_STEREO_MIC 0x5C -+ -+/* VT1613 DAI ID's */ -+#define VT1613_DAI_AC97_ANALOG 0 -+#define VT1613_DAI_AC97_DIGITAL 1 -+ -+extern bool vt1613_modules_dep_ok; -+ -+#endif --- -1.8.1.2 - - -From 2a0ebcf045bc22d48856e0a2279307a258b4b5b0 Mon Sep 17 00:00:00 2001 -From: waynatali <waykovalenko@gmail.com> -Date: Wed, 10 Jun 2015 12:37:30 +0200 -Subject: [PATCH 17/19] Add select REGMAP_AC97 for VT1613 codec - ---- - sound/soc/codecs/Kconfig | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig -index d813556..a5996d5 100644 ---- a/sound/soc/codecs/Kconfig -+++ b/sound/soc/codecs/Kconfig -@@ -389,6 +389,7 @@ config SND_SOC_UDA1380 - tristate - - config SND_SOC_VT1613 -+ select REGMAP_AC97 - tristate - - config SND_SOC_WL1273 --- -1.8.1.2 - - -From ca2d5c1f9944150b88d44ee7de1d10d3fb63ce5f Mon Sep 17 00:00:00 2001 -From: waynatali <waykovalenko@gmail.com> -Date: Wed, 10 Jun 2015 12:57:48 +0200 -Subject: [PATCH 18/19] Make soc_ac97_dev_register function non static - ---- - sound/soc/soc-core.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c -index c1d9d85..348754b 100644 ---- a/sound/soc/soc-core.c -+++ b/sound/soc/soc-core.c -@@ -523,7 +523,7 @@ static int soc_ac97_dev_unregister(struct snd_soc_codec *codec) - static void soc_ac97_device_release(struct device *dev){} - - /* register ac97 codec to bus */ --static int soc_ac97_dev_register(struct snd_soc_codec *codec) -+int soc_ac97_dev_register(struct snd_soc_codec *codec) - { - int err; - -@@ -541,6 +541,7 @@ - } - return 0; - } -+EXPORT_SYMBOL_GPL(soc_ac97_dev_register); - #endif - - static void codec2codec_close_delayed_work(struct work_struct *work) -@@ -882,6 +882,8 @@ - dai_link->cpu_dai_name); - return -EPROBE_DEFER; - } -+ -+ dev_err(card->dev, "ASoC: CPU DAI %s registered\n", dai_link->cpu_dai_name); - - /* Find CODEC from registered CODECs */ - list_for_each_entry(codec, &codec_list, list) { -@@ -920,6 +922,8 @@ - dai_link->codec_name); - return -EPROBE_DEFER; - } -+ -+ dev_err(card->dev, "ASoC: CODEC %s registered\n", dai_link->codec_name); - - /* if there's no platform we match on the empty platform */ - platform_name = dai_link->platform_name; --- -1.8.1.2 - - -From 5f679d20733e1998b1e705ceb97abaf37e893f6c Mon Sep 17 00:00:00 2001 -From: waynatali <waykovalenko@gmail.com> -Date: Wed, 10 Jun 2015 13:07:16 +0200 -Subject: [PATCH 19/19] Add soc_ac97_dev_register function - ---- - include/sound/soc.h | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/include/sound/soc.h b/include/sound/soc.h -index 59a4785..ddc359d 100644 ---- a/include/sound/soc.h -+++ b/include/sound/soc.h -@@ -412,6 +412,7 @@ struct snd_pcm_substream *snd_soc_get_dai_substream(struct snd_soc_card *card, - const char *dai_link, int stream); - struct snd_soc_pcm_runtime *snd_soc_get_pcm_runtime(struct snd_soc_card *card, - const char *dai_link); -+int soc_ac97_dev_register(struct snd_soc_codec *codec); - - /* Utility functions to get clock rates from various things */ - int snd_soc_calc_frame_size(int sample_size, int channels, int tdm_slots); --- -1.8.1.2 - diff --git a/projects/imx6/patches/linux/linux-701-linksys_aes2500_brcmfmac.patch b/projects/imx6/patches/linux/linux-701-linksys_aes2500_brcmfmac.patch deleted file mode 100644 index 639a6ab30bc..00000000000 --- a/projects/imx6/patches/linux/linux-701-linksys_aes2500_brcmfmac.patch +++ /dev/null @@ -1,21 +0,0 @@ ---- a/drivers/net/wireless/brcm80211/brcmfmac/usb.c 2013-07-21 16:06:37.443909481 +0200 -+++ b/drivers/net/wireless/brcm80211/brcmfmac/usb.c 2013-07-21 16:11:10.696335476 +0200 -@@ -1470,15 +1470,18 @@ - } - - #define BRCMF_USB_VENDOR_ID_BROADCOM 0x0a5c -+#define BRCMF_USB_VENDOR_ID_LINKSYS 0x13b1 - #define BRCMF_USB_DEVICE_ID_43143 0xbd1e - #define BRCMF_USB_DEVICE_ID_43236 0xbd17 - #define BRCMF_USB_DEVICE_ID_43242 0xbd1f -+#define BRCMF_USB_DEVICE_ID_AE2500 0x003a - #define BRCMF_USB_DEVICE_ID_BCMFW 0x0bdc - - static struct usb_device_id brcmf_usb_devid_table[] = { - { USB_DEVICE(BRCMF_USB_VENDOR_ID_BROADCOM, BRCMF_USB_DEVICE_ID_43143) }, - { USB_DEVICE(BRCMF_USB_VENDOR_ID_BROADCOM, BRCMF_USB_DEVICE_ID_43236) }, - { USB_DEVICE(BRCMF_USB_VENDOR_ID_BROADCOM, BRCMF_USB_DEVICE_ID_43242) }, -+ { USB_DEVICE(BRCMF_USB_VENDOR_ID_LINKSYS, BRCMF_USB_DEVICE_ID_AE2500) }, - /* special entry for device with firmware loaded and running */ - { USB_DEVICE(BRCMF_USB_VENDOR_ID_BROADCOM, BRCMF_USB_DEVICE_ID_BCMFW) }, - { } diff --git a/projects/imx6/patches/linux/linux-706-Sitecom-N300.patch b/projects/imx6/patches/linux/linux-706-Sitecom-N300.patch deleted file mode 100644 index 9f52eeb2d50..00000000000 --- a/projects/imx6/patches/linux/linux-706-Sitecom-N300.patch +++ /dev/null @@ -1,11 +0,0 @@ -diff -Naur linux-3.10.16/drivers/staging/rtl8712/usb_intf.c linux-3.10.16.patch/drivers/staging/rtl8712/usb_intf.c ---- linux-3.10.16/drivers/staging/rtl8712/usb_intf.c 2013-10-14 01:08:56.000000000 +0200 -+++ linux-3.10.16.patch/drivers/staging/rtl8712/usb_intf.c 2013-10-16 13:27:44.032951265 +0200 -@@ -92,6 +92,7 @@ - {USB_DEVICE(0x0DF6, 0x005B)}, - {USB_DEVICE(0x0DF6, 0x005D)}, - {USB_DEVICE(0x0DF6, 0x0063)}, -+ {USB_DEVICE(0x0DF6, 0x006C)}, - /* Sweex */ - {USB_DEVICE(0x177F, 0x0154)}, - /* Thinkware */ diff --git a/projects/imx6/patches/linux/linux-910.03-cec-upstream.patch b/projects/imx6/patches/linux/linux-910.03-cec-upstream.patch deleted file mode 100644 index 363e503b72e..00000000000 --- a/projects/imx6/patches/linux/linux-910.03-cec-upstream.patch +++ /dev/null @@ -1,68 +0,0 @@ -commit 83ee92e168bc5d744f96961254ffac95a6260220 -Author: wolfgar <stephan.rafin@laposte.net> -Date: Sat Sep 13 01:58:08 2014 +0200 - - No longer try to get link status directly in this driver - Only consume the event sent by mxc-hdmi driver - -diff --git a/drivers/mxc/hdmi-cec/mxc_hdmi-cec.c b/drivers/mxc/hdmi-cec/mxc_hdmi-cec.c -index f8b3f7a..c30237e 100644 ---- a/drivers/mxc/hdmi-cec/mxc_hdmi-cec.c -+++ b/drivers/mxc/hdmi-cec/mxc_hdmi-cec.c -@@ -67,7 +67,6 @@ struct hdmi_cec_priv { - u8 msg_len; - int tx_answer; - u16 latest_cec_stat; -- u8 link_status; - spinlock_t irq_lock; - struct delayed_work hdmi_cec_work; - struct mutex lock; -@@ -96,7 +95,6 @@ static irqreturn_t mxc_hdmi_cec_isr(int irq, void *data) - struct hdmi_cec_priv *hdmi_cec = data; - u16 cec_stat = 0; - unsigned long flags; -- u8 phy_stat0; - irqreturn_t ret = IRQ_HANDLED; - - spin_lock_irqsave(&hdmi_cec->irq_lock, flags); -@@ -105,7 +103,6 @@ static irqreturn_t mxc_hdmi_cec_isr(int irq, void *data) - - cec_stat = hdmi_readb(HDMI_IH_CEC_STAT0); - hdmi_writeb(cec_stat, HDMI_IH_CEC_STAT0); -- phy_stat0 = hdmi_readb(HDMI_PHY_STAT0) & 0x02; - - if ((cec_stat & (HDMI_IH_CEC_STAT0_ERROR_INIT | \ - HDMI_IH_CEC_STAT0_NACK | HDMI_IH_CEC_STAT0_EOM | \ -@@ -113,14 +110,7 @@ static irqreturn_t mxc_hdmi_cec_isr(int irq, void *data) - ret = IRQ_NONE; - cec_stat = 0; - } -- if (hdmi_cec->link_status ^ phy_stat0) { -- /* HPD value changed */ -- hdmi_cec->link_status = phy_stat0; -- if (hdmi_cec->link_status) -- cec_stat |= 0x80; /* Connected */ -- else -- cec_stat |= 0x100; /* Disconnected */ -- } -+ - pr_debug("HDMI CEC interrupt received\n"); - hdmi_cec->latest_cec_stat = cec_stat ; - -@@ -357,7 +347,6 @@ static ssize_t hdmi_cec_write(struct file *file, const char __user *buf, - return ret; - } - -- - void hdmi_cec_start_device(void) - { - u8 val; -@@ -373,7 +362,6 @@ void hdmi_cec_start_device(void) - val = HDMI_IH_CEC_STAT0_WAKEUP | HDMI_IH_CEC_STAT0_ERROR_FOLL | HDMI_IH_CEC_STAT0_ARB_LOST; - hdmi_writeb(val, HDMI_CEC_MASK); - hdmi_writeb(val, HDMI_IH_MUTE_CEC_STAT0); -- hdmi_cec_data.link_status = hdmi_readb(HDMI_PHY_STAT0) & 0x02; - hdmi_cec_data.cec_state = true; - } - EXPORT_SYMBOL(hdmi_cec_start_device); - diff --git a/projects/imx6/patches/linux/linux-999-3.14-vpu352.patch b/projects/imx6/patches/linux/linux-999-3.14-vpu352.patch deleted file mode 100644 index dd4fbf995a0..00000000000 --- a/projects/imx6/patches/linux/linux-999-3.14-vpu352.patch +++ /dev/null @@ -1,91 +0,0 @@ -ENGR00313202 ARM: imx: add VPU 352M support for i.MX6Q -When VPU freq is set to 352MHz, it need to source clk -from PLL2_PFD2_396M, and PLL2_PFD2_396M need to change -freq to 352M. - -VDDSOC/PU needs to be at highest setpoint when VPU@352Mhz, -cpufreq will be disabled as it will not save any power if -VDDSOC/PU's voltage stays at highest setpoint. - -Busfreq will be disabled as it needs PLL2_PFD2 to be -as 396MHz to achieve low power audio freq setpoint. - -To enable VPU 352MHz feature, select it in menuconfig, -it is disabled by default. - -Signed-off-by: Anson Huang <b20788@freescale.com> - -diff -ruN linux-cuboxi-3.14-dc5edb8-original/arch/arm/mach-imx/busfreq-imx6.c linux-cuboxi-3.14-dc5edb8/arch/arm/mach-imx/busfreq-imx6.c ---- linux-cuboxi-3.14-dc5edb8-original/arch/arm/mach-imx/busfreq-imx6.c 2015-02-16 21:54:12.298970658 +0100 -+++ linux-cuboxi-3.14-dc5edb8/arch/arm/mach-imx/busfreq-imx6.c 2015-02-16 21:55:33.370972180 +0100 -@@ -925,11 +925,12 @@ - - static int __init busfreq_init(void) - { -+#ifndef CONFIG_MX6_VPU_352M - if (platform_driver_register(&busfreq_driver) != 0) - return -ENODEV; - - printk(KERN_INFO "Bus freq driver module loaded\n"); -- -+#endif - return 0; - } - -diff -ruN linux-cuboxi-3.14-dc5edb8-original/arch/arm/mach-imx/clk-imx6q.c linux-cuboxi-3.14-dc5edb8/arch/arm/mach-imx/clk-imx6q.c ---- linux-cuboxi-3.14-dc5edb8-original/arch/arm/mach-imx/clk-imx6q.c 2015-02-16 21:54:12.306970658 +0100 -+++ linux-cuboxi-3.14-dc5edb8/arch/arm/mach-imx/clk-imx6q.c 2015-02-16 21:54:53.978971440 +0100 -@@ -713,6 +713,22 @@ - /* Set pll4_audio to a value that can derive 5K-88.2KHz and 8K-96KHz */ - clk_set_rate(clk[pll4_audio_div], 541900800); - -+#ifdef CONFIG_MX6_VPU_352M -+ /* -+ * If VPU 352M is enabled, then PLL2_PDF2 need to be -+ * set to 352M, cpufreq will be disabled as VDDSOC/PU -+ * need to be at highest voltage, scaling cpu freq is -+ * not saving any power, and busfreq will be also disabled -+ * as the PLL2_PFD2 is not at default freq, in a word, -+ * all modules that sourceing clk from PLL2_PFD2 will -+ * be impacted. -+ */ -+ clk_set_rate(clk[pll2_pfd2_396m], 352000000); -+ clk_set_parent(clk[vpu_axi_sel], clk[pll2_pfd2_396m]); -+ pr_info("VPU 352M is enabled!\n"); -+#endif -+ -+ - /* Set initial power mode */ - imx6q_set_lpm(WAIT_CLOCKED); - -diff -ruN linux-cuboxi-3.14-dc5edb8-original/arch/arm/mach-imx/mach-imx6q.c linux-cuboxi-3.14-dc5edb8/arch/arm/mach-imx/mach-imx6q.c ---- linux-cuboxi-3.14-dc5edb8-original/arch/arm/mach-imx/mach-imx6q.c 2015-05-22 19:56:02.761641828 +0200 -+++ linux-cuboxi-3.14-dc5edb8/arch/arm/mach-imx/mach-imx6q.c 2015-05-22 19:57:22.608235000 +0200 -@@ -387,6 +387,10 @@ - if (dev_pm_opp_disable(cpu_dev, 852000000)) - pr_warn("failed to disable 850 MHz OPP\n"); - } -+ if (IS_ENABLED(CONFIG_MX6_VPU_352M)) { -+ if (dev_pm_opp_disable(cpu_dev, 396000000)) -+ pr_warn("failed to disable 396MHz OPP\n"); -+ } - } - - static void __init imx6q_opp_init(void) -diff -ruN linux-cuboxi-3.14-dc5edb8-original/drivers/cpufreq/imx6-cpufreq.c linux-cuboxi-3.14-dc5edb8/drivers/cpufreq/imx6-cpufreq.c ---- linux-cuboxi-3.14-dc5edb8-original/drivers/cpufreq/imx6-cpufreq.c 2015-02-16 21:54:09.350970602 +0100 -+++ linux-cuboxi-3.14-dc5edb8/drivers/cpufreq/imx6-cpufreq.c 2015-02-16 21:55:49.778972488 +0100 -@@ -305,6 +305,13 @@ - unsigned long volt = be32_to_cpup(val++); - if (freq_table[j].frequency == freq) { - imx6_soc_volt[soc_opp_count++] = volt; -+#ifdef CONFIG_MX6_VPU_352M -+ if (freq == 792000) { -+ pr_info("increase SOC/PU voltage for VPU352MHz\n"); -+ imx6_soc_volt[soc_opp_count-1] = 1250000; -+ } -+#endif -+ - break; - } - } diff --git a/projects/imx6/patches/u-boot/011-cuboxi-faster-boot.patch b/projects/imx6/patches/u-boot/011-cuboxi-faster-boot.patch new file mode 100644 index 00000000000..b2b92615791 --- /dev/null +++ b/projects/imx6/patches/u-boot/011-cuboxi-faster-boot.patch @@ -0,0 +1,11 @@ +--- a/include/configs/mx6_cubox-i.h 2016-04-04 10:59:46.012325017 +0200 ++++ b/include/configs/mx6_cubox-i.h 2016-04-04 10:59:55.487968181 +0200 +@@ -59,7 +59,7 @@ + #define CONFIG_CMD_SETEXPR + #define CONFIG_CMD_MEMTEST + +-#define CONFIG_BOOTDELAY 3 ++#define CONFIG_BOOTDELAY 1 + + #define CONFIG_SYS_MEMTEST_START 0x10000000 + #define CONFIG_SYS_MEMTEST_END (CONFIG_SYS_MEMTEST_START + 500 * SZ_1M) diff --git a/projects/imx6/patches/u-boot/012-hb1-fb-device.patch b/projects/imx6/patches/u-boot/012-hb1-fb-device.patch new file mode 100644 index 00000000000..b088952a827 --- /dev/null +++ b/projects/imx6/patches/u-boot/012-hb1-fb-device.patch @@ -0,0 +1,24 @@ +commit c3b3b538666cfa2a33f231e8ffb7424761f1a638 +Author: Matus Kral <matuskral@me.com> +Date: Tue Dec 29 15:43:03 2015 +0100 + + fix for HB1 + +the SR's uboot tree after commit 144b1e90d15f3a94f0c8183827d4f1b93f6f2e68 +is keeping IPU started - what is keeping gfx in 4.x+ kernels from starting + +diff --git a/arch/arm/imx-common/cpu.c b/arch/arm/imx-common/cpu.c +index 5c3c080..ca74901 100644 +--- a/arch/arm/imx-common/cpu.c ++++ b/arch/arm/imx-common/cpu.c +@@ -176,5 +176,9 @@ void arch_preboot_os(void) + { + /* disable video before launching O/S */ + ipuv3_fb_shutdown(); ++ ++ struct mxc_ccm_reg *ccm = (struct mxc_ccm_reg *)CCM_BASE_ADDR; ++ setbits_le32(&ccm->analog_pll_video, BM_ANADIG_PLL_VIDEO_POWERDOWN); ++ + } + #endif + diff --git a/projects/imx6/patches/u-boot/100-udoo_board_support.patch b/projects/imx6/patches/u-boot/100-udoo_board_support.patch deleted file mode 100644 index 10ee125b71f..00000000000 --- a/projects/imx6/patches/u-boot/100-udoo_board_support.patch +++ /dev/null @@ -1,2414 +0,0 @@ -From 88ee5ba68c14d16ff8c8dcd96e94539c6b0312d5 Mon Sep 17 00:00:00 2001 -From: Peter Vicman <peter.vicman@gmail.com> -Date: Fri, 7 Aug 2015 21:33:31 +0200 -Subject: [PATCH] udoo board support - ---- - arch/arm/cpu/armv7/cpu.c | 14 + - arch/arm/imx-common/Makefile | 2 + - arch/arm/imx-common/cmd_plotmsg.c | 74 ++++ - arch/arm/imx-common/sata.c | 33 ++ - arch/arm/include/asm/imx-common/sata.h | 17 + - board/udoo/1066mhz_4x256mx16_dl.cfg | 58 ++++ - board/udoo/1066mhz_4x256mx16_q.cfg | 63 ++++ - board/udoo/Makefile | 30 ++ - board/udoo/clocks.cfg | 31 ++ - board/udoo/ddr-setup_dl.cfg | 85 +++++ - board/udoo/ddr-setup_q.cfg | 87 +++++ - board/udoo/udoo.c | 607 +++++++++++++++++++++++++++++++++ - board/udoo/udoo.cfg | 41 +++ - board/udoo/udoo_spl.c | 404 ++++++++++++++++++++++ - boards.cfg | 3 + - common/Makefile | 1 + - common/cmd_multiboot.c | 312 +++++++++++++++++ - drivers/video/cfb_console.c | 12 + - include/configs/udoo.h | 302 ++++++++++++++++ - include/micrel.h | 5 + - include/video.h | 2 + - 21 files changed, 2183 insertions(+) - create mode 100644 arch/arm/imx-common/cmd_plotmsg.c - create mode 100644 arch/arm/imx-common/sata.c - create mode 100644 arch/arm/include/asm/imx-common/sata.h - create mode 100644 board/udoo/1066mhz_4x256mx16_dl.cfg - create mode 100644 board/udoo/1066mhz_4x256mx16_q.cfg - create mode 100644 board/udoo/Makefile - create mode 100644 board/udoo/clocks.cfg - create mode 100644 board/udoo/ddr-setup_dl.cfg - create mode 100644 board/udoo/ddr-setup_q.cfg - create mode 100644 board/udoo/udoo.c - create mode 100644 board/udoo/udoo.cfg - create mode 100644 board/udoo/udoo_spl.c - create mode 100644 common/cmd_multiboot.c - create mode 100644 include/configs/udoo.h - -diff --git a/arch/arm/cpu/armv7/cpu.c b/arch/arm/cpu/armv7/cpu.c -index 01cdb7e..654e526 100644 ---- a/arch/arm/cpu/armv7/cpu.c -+++ b/arch/arm/cpu/armv7/cpu.c -@@ -20,10 +20,20 @@ - #include <asm/system.h> - #include <asm/cache.h> - #include <asm/armv7.h> -+#include <asm/gpio.h> - #include <linux/compiler.h> - - void __weak cpu_cache_initialization(void){} - -+#if (defined(MACH_TYPE_UDOO) || defined(CONFIG_VIDEO_ENABLED)) -+static void do_disable_lvds() -+{ -+ gpio_direction_output(IMX_GPIO_NR(1, 2), 0); /* LVDS power On */ -+ gpio_direction_output(IMX_GPIO_NR(1, 4), 0); /* LVDS backlight On */ -+ return; -+} -+#endif -+ - int cleanup_before_linux(void) - { - /* -@@ -66,5 +76,9 @@ int cleanup_before_linux(void) - */ - cpu_cache_initialization(); - -+#if (defined(MACH_TYPE_UDOO) || defined(CONFIG_VIDEO_ENABLED)) -+ do_disable_lvds(); -+#endif -+ - return 0; - } -diff --git a/arch/arm/imx-common/Makefile b/arch/arm/imx-common/Makefile -index 727a052..f619bbc 100644 ---- a/arch/arm/imx-common/Makefile -+++ b/arch/arm/imx-common/Makefile -@@ -17,12 +17,14 @@ endif - ifeq ($(SOC),$(filter $(SOC),mx5 mx6)) - COBJS-y += timer.o cpu.o speed.o - COBJS-$(CONFIG_I2C_MXC) += i2c-mxv7.o -+COBJS-$(CONFIG_CMD_SATA) += sata.o - endif - ifeq ($(SOC),$(filter $(SOC),mx6 mxs)) - COBJS-y += misc.o - endif - COBJS-$(CONFIG_CMD_BMODE) += cmd_bmode.o - COBJS-$(CONFIG_CMD_HDMIDETECT) += cmd_hdmidet.o -+COBJS-$(CONFIG_CMD_PLOTMSG) += cmd_plotmsg.o - COBJS := $(sort $(COBJS-y)) - - SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) -diff --git a/arch/arm/imx-common/cmd_plotmsg.c b/arch/arm/imx-common/cmd_plotmsg.c -new file mode 100644 -index 0000000..55890d4 ---- /dev/null -+++ b/arch/arm/imx-common/cmd_plotmsg.c -@@ -0,0 +1,74 @@ -+/* -+ * Copyright (C) 2013 Seco USA Inc -+ * -+ * SPDX-License-Identifier: GPL-2.0+ -+ */ -+ -+#include <common.h> -+#include <bmp_logo.h> -+#include <video.h> -+ -+#define MAX_LEN 160 -+#define X_MARGIN 10 -+#define Y_PADDING 20 -+ -+static int do_plotmsg(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) -+{ -+ int i = 1; -+ static int y = 30; -+ int x; -+ char msg[MAX_LEN]; -+ -+ if (argc == 1) -+ return CMD_RET_USAGE; -+ -+ if (y < BMP_LOGO_HEIGHT) -+ x = BMP_LOGO_WIDTH + X_MARGIN; -+ else -+ x = X_MARGIN; -+ -+ msg[0] = 0; -+ -+ if ((strcmp(argv[1], "-r") == 0) && (y > 30)) { -+ int f; -+ i++; -+ y -= Y_PADDING; -+ for (f=0; f < MAX_LEN/10; f++) -+ strcat(msg, " "); -+ udoo_video_drawstring(x, y, msg); -+ strcpy(msg, argv[i]); -+ i++; -+ } -+ -+ if (strcmp(argv[1], "-u") == 0) { -+ i++; -+ x = X_MARGIN; -+ y = ((BMP_LOGO_HEIGHT / Y_PADDING) * Y_PADDING) + Y_PADDING; -+ strcpy(msg, argv[i]); -+ i++; -+ } -+ -+ while(i < argc) { -+ if ((strlen(msg) + strlen(argv[i])) < MAX_LEN) { -+ if (i == 1) { -+ strcpy(msg, argv[i]); -+ } else { -+ strcat(msg, " "); -+ strcat(msg, argv[i]); -+ } -+ } else -+ printf("Warn: Max text length reached (max %d characters permetted).\n", MAX_LEN); -+ i++; -+ } -+ -+ udoo_video_drawstring(x, y, msg); -+ y += Y_PADDING; -+ return 0; -+} -+ -+U_BOOT_CMD(plotmsg, 50, 1, do_plotmsg, -+ "Plot text message on current display (HDMI or LVDS).\n" \ -+ "\t -r Overwrite last message.\n" \ -+ "\t -u Start writing just under Logo.", -+ "[-r|-u] message ..." -+); -diff --git a/arch/arm/imx-common/sata.c b/arch/arm/imx-common/sata.c -new file mode 100644 -index 0000000..00b3d92 ---- /dev/null -+++ b/arch/arm/imx-common/sata.c -@@ -0,0 +1,33 @@ -+/* -+ * Copyright 2011 Freescale Semiconductor, Inc. -+ * -+ * SPDX-License-Identifier: GPL-2.0+ -+ */ -+ -+#include <asm/imx-common/iomux-v3.h> -+#include <asm/arch/iomux.h> -+#include <asm/io.h> -+ -+int sata_setup(void) -+{ -+ struct iomuxc_base_regs *const iomuxc_regs -+ = (struct iomuxc_base_regs *) IOMUXC_BASE_ADDR; -+ -+ int ret = enable_sata_clock(); -+ if (ret) -+ return ret; -+ -+ clrsetbits_le32(&iomuxc_regs->gpr[13], -+ IOMUXC_GPR13_SATA_MASK, -+ IOMUXC_GPR13_SATA_PHY_8_RXEQ_3P0DB -+ |IOMUXC_GPR13_SATA_PHY_7_SATA2M -+ |IOMUXC_GPR13_SATA_SPEED_3G -+ |(3<<IOMUXC_GPR13_SATA_PHY_6_SHIFT) -+ |IOMUXC_GPR13_SATA_SATA_PHY_5_SS_DISABLED -+ |IOMUXC_GPR13_SATA_SATA_PHY_4_ATTEN_9_16 -+ |IOMUXC_GPR13_SATA_PHY_3_TXBOOST_0P00_DB -+ |IOMUXC_GPR13_SATA_PHY_2_TX_1P104V -+ |IOMUXC_GPR13_SATA_PHY_1_SLOW); -+ -+ return 0; -+} -diff --git a/arch/arm/include/asm/imx-common/sata.h b/arch/arm/include/asm/imx-common/sata.h -new file mode 100644 -index 0000000..40fbf77 ---- /dev/null -+++ b/arch/arm/include/asm/imx-common/sata.h -@@ -0,0 +1,17 @@ -+/* -+ * Copyright 2011 Freescale Semiconductor, Inc. -+ * -+ * SPDX-License-Identifier: GPL-2.0+ -+ */ -+ -+#ifndef __IMX_SATA_H_ -+#define __IMX_SATA_H_ -+ -+/* -+ * SATA setup for i.mx6 quad based platform -+ */ -+ -+int sata_setup(void); -+ -+#endif -+ -diff --git a/board/udoo/1066mhz_4x256mx16_dl.cfg b/board/udoo/1066mhz_4x256mx16_dl.cfg -new file mode 100644 -index 0000000..e37c9f9 ---- /dev/null -+++ b/board/udoo/1066mhz_4x256mx16_dl.cfg -@@ -0,0 +1,58 @@ -+/* -+ * Copyright (C) 2013 Seco USA Inc -+ * -+ * SPDX-License-Identifier: GPL-2.0+ -+ */ -+ -+ -+DATA 4, MX6_MMDC_P0_MDPDC, 0x0002002D -+DATA 4, MX6_MMDC_P0_MDOTC, 0x00333040 -+ -+DATA 4, MX6_MMDC_P0_MDCFG0, 0x3F4352F3 -+DATA 4, MX6_MMDC_P0_MDCFG1, 0xB66D8B63 -+DATA 4, MX6_MMDC_P0_MDCFG2, 0x01FF00DB -+ -+DATA 4, MX6_MMDC_P0_MDMISC, 0x00001740 -+DATA 4, MX6_MMDC_P0_MDSCR, 0x00008000 -+DATA 4, MX6_MMDC_P0_MDRWD, 0x000026D2 -+ -+ -+DATA 4, MX6_MMDC_P0_MDOR, 0x00431023 -+DATA 4, MX6_MMDC_P0_MDASP, 0x00000027 -+DATA 4, MX6_MMDC_P0_MDCTL, 0x831A0000 -+ -+DATA 4, MX6_MMDC_P0_MDSCR, 0x02008032 -+DATA 4, MX6_MMDC_P0_MDSCR, 0x00008033 -+DATA 4, MX6_MMDC_P0_MDSCR, 0x00048031 -+DATA 4, MX6_MMDC_P0_MDSCR, 0x05208030 -+DATA 4, MX6_MMDC_P0_MDSCR, 0x04008040 -+ -+DATA 4, MX6_MMDC_P0_MPZQHWCTRL, 0xa1390003 -+DATA 4, MX6_MMDC_P1_MPZQHWCTRL, 0xa1390003 -+ -+DATA 4, MX6_MMDC_P0_MDREF, 0x00007800 -+ -+DATA 4, MX6_MMDC_P0_MPODTCTRL, 0x00022227 -+DATA 4, MX6_MMDC_P1_MPODTCTRL, 0x00022227 -+ -+DATA 4, MX6_MMDC_P0_MPDGCTRL0, 0x425C0251 -+DATA 4, MX6_MMDC_P0_MPDGCTRL1, 0x021B021E -+DATA 4, MX6_MMDC_P1_MPDGCTRL0, 0x021B021E -+DATA 4, MX6_MMDC_P1_MPDGCTRL1, 0x01730200 -+ -+DATA 4, MX6_MMDC_P0_MPRDDLCTL, 0x45474C45 -+DATA 4, MX6_MMDC_P1_MPRDDLCTL, 0x44464744 -+DATA 4, MX6_MMDC_P0_MPWRDLCTL, 0x3F3F3336 -+DATA 4, MX6_MMDC_P1_MPWRDLCTL, 0x32383630 -+ -+DATA 4, MX6_MMDC_P0_MPWLDECTRL0, 0x002F0038 -+DATA 4, MX6_MMDC_P0_MPWLDECTRL1, 0x001F001F -+DATA 4, MX6_MMDC_P1_MPWLDECTRL0, 0x001F001F -+DATA 4, MX6_MMDC_P1_MPWLDECTRL1, 0x001F001F -+ -+DATA 4, MX6_MMDC_P0_MPMUR0, 0x00000000 -+DATA 4, MX6_MMDC_P1_MPMUR0, 0x00000000 -+ -+DATA 4, MX6_MMDC_P0_MDPDC, 0x0002556D -+DATA 4, MX6_MMDC_P0_MAPSR, 0x00011006 -+DATA 4, MX6_MMDC_P0_MDSCR, 0x00000000 -diff --git a/board/udoo/1066mhz_4x256mx16_q.cfg b/board/udoo/1066mhz_4x256mx16_q.cfg -new file mode 100644 -index 0000000..1da61a4 ---- /dev/null -+++ b/board/udoo/1066mhz_4x256mx16_q.cfg -@@ -0,0 +1,63 @@ -+/* -+ * Copyright (C) 2013 Seco USA Inc -+ * -+ * SPDX-License-Identifier: GPL-2.0+ -+ */ -+ -+ -+DATA 4, MX6_MMDC_P0_MDPDC, 0x00020036 -+DATA 4, MX6_MMDC_P0_MDOTC, 0x09444040 -+ -+DATA 4, MX6_MMDC_P0_MDCFG0, 0x54597955 -+DATA 4, MX6_MMDC_P0_MDCFG1, 0xFF328F64 -+DATA 4, MX6_MMDC_P0_MDCFG2, 0x01FF00DB -+ -+DATA 4, MX6_MMDC_P0_MDMISC, 0x00001740 -+DATA 4, MX6_MMDC_P0_MDSCR, 0x00008000 -+DATA 4, MX6_MMDC_P0_MDRWD, 0x000026D2 -+ -+#ifdef ONEGIGA -+DATA 4, MX6_MMDC_P0_MDOR, 0x00591023 -+DATA 4, MX6_MMDC_P0_MDASP, 0x00000027 -+DATA 4, MX6_MMDC_P0_MDCTL, 0x831A0000 -+#else -+DATA 4, MX6_MMDC_P0_MDOR, 0x008E1023 -+DATA 4, MX6_MMDC_P0_MDASP, 0x00000047 -+DATA 4, MX6_MMDC_P0_MDCTL, 0x841A0000 -+#endif -+ -+DATA 4, MX6_MMDC_P0_MDSCR, 0x04088032 -+DATA 4, MX6_MMDC_P0_MDSCR, 0x00008033 -+DATA 4, MX6_MMDC_P0_MDSCR, 0x00048031 -+DATA 4, MX6_MMDC_P0_MDSCR, 0x09408030 -+DATA 4, MX6_MMDC_P0_MDSCR, 0x04008040 -+ -+DATA 4, MX6_MMDC_P0_MPZQHWCTRL, 0xA1380003 -+DATA 4, MX6_MMDC_P1_MPZQHWCTRL, 0xA1380003 -+ -+DATA 4, MX6_MMDC_P0_MDREF, 0x00005800 -+ -+DATA 4, MX6_MMDC_P0_MPODTCTRL, 0x00011117 -+DATA 4, MX6_MMDC_P1_MPODTCTRL, 0x00011117 -+ -+DATA 4, MX6_MMDC_P0_MPDGCTRL0, 0x43510360 -+DATA 4, MX6_MMDC_P0_MPDGCTRL1, 0x0342033F -+DATA 4, MX6_MMDC_P1_MPDGCTRL0, 0x033F033F -+DATA 4, MX6_MMDC_P1_MPDGCTRL1, 0x03290266 -+ -+DATA 4, MX6_MMDC_P0_MPRDDLCTL, 0x4B3E4141 -+DATA 4, MX6_MMDC_P1_MPRDDLCTL, 0x47413B4A -+DATA 4, MX6_MMDC_P0_MPWRDLCTL, 0x42404843 -+DATA 4, MX6_MMDC_P1_MPWRDLCTL, 0x4C3F4C45 -+ -+DATA 4, MX6_MMDC_P0_MPWLDECTRL0, 0x00350035 -+DATA 4, MX6_MMDC_P0_MPWLDECTRL1, 0x001F001F -+DATA 4, MX6_MMDC_P1_MPWLDECTRL0, 0x00010001 -+DATA 4, MX6_MMDC_P1_MPWLDECTRL1, 0x00010001 -+ -+DATA 4, MX6_MMDC_P0_MPMUR0, 0x00000800 -+DATA 4, MX6_MMDC_P1_MPMUR0, 0x00000800 -+ -+DATA 4, MX6_MMDC_P0_MDPDC, 0x00025576 -+DATA 4, MX6_MMDC_P0_MAPSR, 0x00011006 -+DATA 4, MX6_MMDC_P0_MDSCR, 0x00000000 -diff --git a/board/udoo/Makefile b/board/udoo/Makefile -new file mode 100644 -index 0000000..e00a898 ---- /dev/null -+++ b/board/udoo/Makefile -@@ -0,0 +1,30 @@ -+# -+# (C) Copyright 2013 Freescale Semiconductor, Inc. -+# -+# SPDX-License-Identifier: GPL-2.0+ -+# -+ -+include $(TOPDIR)/config.mk -+ -+LIB = $(obj)lib$(BOARD).o -+ -+COBJS := udoo.o -+ -+ifdef CONFIG_SPL_BUILD -+COBJS += udoo_spl.o -+endif -+ -+SRCS := $(COBJS:.o=.c) -+OBJS := $(addprefix $(obj),$(COBJS)) -+ -+$(LIB): $(obj).depend $(OBJS) -+ $(call cmd_link_o_target, $(OBJS)) -+ -+######################################################################### -+ -+# defines $(obj).depend target -+include $(SRCTREE)/rules.mk -+ -+sinclude $(obj).depend -+ -+######################################################################### -diff --git a/board/udoo/clocks.cfg b/board/udoo/clocks.cfg -new file mode 100644 -index 0000000..2acf001 ---- /dev/null -+++ b/board/udoo/clocks.cfg -@@ -0,0 +1,31 @@ -+/* -+ * Copyright (C) 2013 Seco USA Inc -+ * -+ * SPDX-License-Identifier: GPL-2.0+ -+ * -+ * Device Configuration Data (DCD) -+ * -+ * Each entry must have the format: -+ * Addr-type Address Value -+ * -+ * where: -+ * Addr-type register length (1,2 or 4 bytes) -+ * Address absolute address of the register -+ * value value to be stored in the register -+ */ -+ -+/* set the default clock gate to save power */ -+DATA 4, CCM_CCGR0, 0x00C03F3F -+DATA 4, CCM_CCGR1, 0x0030FC03 -+DATA 4, CCM_CCGR2, 0x0FFFC000 -+DATA 4, CCM_CCGR3, 0x3FF00000 -+DATA 4, CCM_CCGR4, 0x00FFF300 -+DATA 4, CCM_CCGR5, 0x0F0000C3 -+DATA 4, CCM_CCGR6, 0x000003FF -+ -+/* enable AXI cache for VDOA/VPU/IPU */ -+DATA 4, MX6_IOMUXC_GPR4, 0xF00000CF -+/* set IPU AXI-id0 Qos=0xf(bypass) AXI-id1 Qos=0x7 */ -+DATA 4, MX6_IOMUXC_GPR6, 0x007F007F -+DATA 4, MX6_IOMUXC_GPR7, 0x007F007F -+ -diff --git a/board/udoo/ddr-setup_dl.cfg b/board/udoo/ddr-setup_dl.cfg -new file mode 100644 -index 0000000..fa82c4d ---- /dev/null -+++ b/board/udoo/ddr-setup_dl.cfg -@@ -0,0 +1,85 @@ -+/* -+ * Copyright (C) 2013 Seco USA Inc -+ * -+ * SPDX-License-Identifier: GPL-2.0+ -+ * -+ * Device Configuration Data (DCD) -+ * -+ * Each entry must have the format: -+ * Addr-type Address Value -+ * -+ * where: -+ * Addr-type register length (1,2 or 4 bytes) -+ * Address absolute address of the register -+ * value value to be stored in the register -+ */ -+ -+/* -+ * DDR3 settings -+ * MX6Q ddr is limited to 1066 Mhz currently 1056 MHz(528 MHz clock), -+ * memory bus width: 64 bits x16/x32/x64 -+ * MX6DL ddr is limited to 800 MHz(400 MHz clock) -+ * memory bus width: 64 bits x16/x32/x64 -+ * MX6SOLO ddr is limited to 800 MHz(400 MHz clock) -+ * memory bus width: 32 bits x16/x32 -+ */ -+DATA 4, MX6_IOM_DRAM_SDQS0, 0x00000028 -+DATA 4, MX6_IOM_DRAM_SDQS1, 0x00000028 -+DATA 4, MX6_IOM_DRAM_SDQS2, 0x00000028 -+DATA 4, MX6_IOM_DRAM_SDQS3, 0x00000028 -+DATA 4, MX6_IOM_DRAM_SDQS4, 0x00000028 -+DATA 4, MX6_IOM_DRAM_SDQS5, 0x00000028 -+DATA 4, MX6_IOM_DRAM_SDQS6, 0x00000028 -+DATA 4, MX6_IOM_DRAM_SDQS7, 0x00000028 -+ -+DATA 4, MX6_IOM_GRP_B0DS, 0x00000028 -+DATA 4, MX6_IOM_GRP_B1DS, 0x00000028 -+DATA 4, MX6_IOM_GRP_B2DS, 0x00000028 -+DATA 4, MX6_IOM_GRP_B3DS, 0x00000028 -+DATA 4, MX6_IOM_GRP_B4DS, 0x00000028 -+DATA 4, MX6_IOM_GRP_B5DS, 0x00000028 -+DATA 4, MX6_IOM_GRP_B6DS, 0x00000028 -+DATA 4, MX6_IOM_GRP_B7DS, 0x00000028 -+DATA 4, MX6_IOM_GRP_ADDDS, 0x00000028 -+ -+DATA 4, MX6_IOM_GRP_CTLDS, 0x00000028 -+ -+DATA 4, MX6_IOM_DRAM_DQM0, 0x00000028 -+DATA 4, MX6_IOM_DRAM_DQM1, 0x00000028 -+DATA 4, MX6_IOM_DRAM_DQM2, 0x00000028 -+DATA 4, MX6_IOM_DRAM_DQM3, 0x00000028 -+DATA 4, MX6_IOM_DRAM_DQM4, 0x00000028 -+DATA 4, MX6_IOM_DRAM_DQM5, 0x00000028 -+DATA 4, MX6_IOM_DRAM_DQM6, 0x00000028 -+DATA 4, MX6_IOM_DRAM_DQM7, 0x00000028 -+ -+DATA 4, MX6_IOM_DRAM_CAS, 0x00000028 -+DATA 4, MX6_IOM_DRAM_RAS, 0x00000028 -+DATA 4, MX6_IOM_DRAM_SDCLK_0, 0x00000028 -+DATA 4, MX6_IOM_DRAM_SDCLK_1, 0x00000028 -+ -+DATA 4, MX6_IOM_DRAM_RESET, 0x00000028 -+ -+DATA 4, MX6_IOM_DRAM_SDODT0, 0x00000028 -+DATA 4, MX6_IOM_DRAM_SDODT1, 0x00000028 -+ -+/* (differential input) */ -+DATA 4, MX6_IOM_DDRMODE_CTL, 0x00020000 -+/* (differential input) */ -+DATA 4, MX6_IOM_GRP_DDRMODE, 0x00020000 -+/* disable ddr pullups */ -+DATA 4, MX6_IOM_GRP_DDRPKE, 0x00000000 -+DATA 4, MX6_IOM_DRAM_SDBA2, 0x00000000 -+/* 40 Ohm drive strength for cs0/1,sdba2,cke0/1,sdwe */ -+DATA 4, MX6_IOM_GRP_DDR_TYPE, 0x000C0000 -+ -+/* Read data DQ Byte0-3 delay */ -+DATA 4, MX6_MMDC_P0_MPRDDQBY0DL, 0x33333333 -+DATA 4, MX6_MMDC_P0_MPRDDQBY1DL, 0x33333333 -+DATA 4, MX6_MMDC_P0_MPRDDQBY2DL, 0x33333333 -+DATA 4, MX6_MMDC_P0_MPRDDQBY3DL, 0x33333333 -+DATA 4, MX6_MMDC_P1_MPRDDQBY0DL, 0x33333333 -+DATA 4, MX6_MMDC_P1_MPRDDQBY1DL, 0x33333333 -+DATA 4, MX6_MMDC_P1_MPRDDQBY2DL, 0x33333333 -+DATA 4, MX6_MMDC_P1_MPRDDQBY3DL, 0x33333333 -+ -diff --git a/board/udoo/ddr-setup_q.cfg b/board/udoo/ddr-setup_q.cfg -new file mode 100644 -index 0000000..12d5627 ---- /dev/null -+++ b/board/udoo/ddr-setup_q.cfg -@@ -0,0 +1,87 @@ -+/* -+ * Copyright (C) 2013 Seco USA Inc -+ * -+ * SPDX-License-Identifier: GPL-2.0+ -+ * -+ * Device Configuration Data (DCD) -+ * -+ * Each entry must have the format: -+ * Addr-type Address Value -+ * -+ * where: -+ * Addr-type register length (1,2 or 4 bytes) -+ * Address absolute address of the register -+ * value value to be stored in the register -+ */ -+ -+/* -+ * DDR3 settings -+ * MX6Q ddr is limited to 1066 Mhz currently 1056 MHz(528 MHz clock), -+ * memory bus width: 64 bits x16/x32/x64 -+ * MX6DL ddr is limited to 800 MHz(400 MHz clock) -+ * memory bus width: 64 bits x16/x32/x64 -+ * MX6SOLO ddr is limited to 800 MHz(400 MHz clock) -+ * memory bus width: 32 bits x16/x32 -+ */ -+DATA 4, MX6_IOM_DRAM_SDQS0, 0x00000030 -+DATA 4, MX6_IOM_DRAM_SDQS1, 0x00000030 -+DATA 4, MX6_IOM_DRAM_SDQS2, 0x00000030 -+DATA 4, MX6_IOM_DRAM_SDQS3, 0x00000030 -+DATA 4, MX6_IOM_DRAM_SDQS4, 0x00000030 -+DATA 4, MX6_IOM_DRAM_SDQS5, 0x00000030 -+DATA 4, MX6_IOM_DRAM_SDQS6, 0x00000030 -+DATA 4, MX6_IOM_DRAM_SDQS7, 0x00000030 -+ -+DATA 4, MX6_IOM_GRP_B0DS, 0x00000030 -+DATA 4, MX6_IOM_GRP_B1DS, 0x00000030 -+DATA 4, MX6_IOM_GRP_B2DS, 0x00000030 -+DATA 4, MX6_IOM_GRP_B3DS, 0x00000030 -+DATA 4, MX6_IOM_GRP_B4DS, 0x00000030 -+DATA 4, MX6_IOM_GRP_B5DS, 0x00000030 -+DATA 4, MX6_IOM_GRP_B6DS, 0x00000030 -+DATA 4, MX6_IOM_GRP_B7DS, 0x00000030 -+DATA 4, MX6_IOM_GRP_ADDDS, 0x00000030 -+/* 40 Ohm drive strength for cs0/1,sdba2,cke0/1,sdwe */ -+DATA 4, MX6_IOM_GRP_CTLDS, 0x00000030 -+ -+DATA 4, MX6_IOM_DRAM_DQM0, 0x00020030 -+DATA 4, MX6_IOM_DRAM_DQM1, 0x00020030 -+DATA 4, MX6_IOM_DRAM_DQM2, 0x00020030 -+DATA 4, MX6_IOM_DRAM_DQM3, 0x00020030 -+DATA 4, MX6_IOM_DRAM_DQM4, 0x00020030 -+DATA 4, MX6_IOM_DRAM_DQM5, 0x00020030 -+DATA 4, MX6_IOM_DRAM_DQM6, 0x00020030 -+DATA 4, MX6_IOM_DRAM_DQM7, 0x00020030 -+ -+DATA 4, MX6_IOM_DRAM_CAS, 0x00020030 -+DATA 4, MX6_IOM_DRAM_RAS, 0x00020030 -+DATA 4, MX6_IOM_DRAM_SDCLK_0, 0x00020030 -+DATA 4, MX6_IOM_DRAM_SDCLK_1, 0x00020030 -+ -+DATA 4, MX6_IOM_DRAM_RESET, 0x00020030 -+DATA 4, MX6_IOM_DRAM_SDCKE0, 0x00003000 -+DATA 4, MX6_IOM_DRAM_SDCKE1, 0x00003000 -+ -+DATA 4, MX6_IOM_DRAM_SDODT0, 0x00003030 -+DATA 4, MX6_IOM_DRAM_SDODT1, 0x00003030 -+ -+/* (differential input) */ -+DATA 4, MX6_IOM_DDRMODE_CTL, 0x00020000 -+/* (differential input) */ -+DATA 4, MX6_IOM_GRP_DDRMODE, 0x00020000 -+/* disable ddr pullups */ -+DATA 4, MX6_IOM_GRP_DDRPKE, 0x00000000 -+DATA 4, MX6_IOM_DRAM_SDBA2, 0x00000000 -+/* 40 Ohm drive strength for cs0/1,sdba2,cke0/1,sdwe */ -+DATA 4, MX6_IOM_GRP_DDR_TYPE, 0x000C0000 -+ -+/* Read data DQ Byte0-3 delay */ -+DATA 4, MX6_MMDC_P0_MPRDDQBY0DL, 0x33333333 -+DATA 4, MX6_MMDC_P0_MPRDDQBY1DL, 0x33333333 -+DATA 4, MX6_MMDC_P0_MPRDDQBY2DL, 0x33333333 -+DATA 4, MX6_MMDC_P0_MPRDDQBY3DL, 0x33333333 -+DATA 4, MX6_MMDC_P1_MPRDDQBY0DL, 0x33333333 -+DATA 4, MX6_MMDC_P1_MPRDDQBY1DL, 0x33333333 -+DATA 4, MX6_MMDC_P1_MPRDDQBY2DL, 0x33333333 -+DATA 4, MX6_MMDC_P1_MPRDDQBY3DL, 0x33333333 -+ -diff --git a/board/udoo/udoo.c b/board/udoo/udoo.c -new file mode 100644 -index 0000000..f5efa86 ---- /dev/null -+++ b/board/udoo/udoo.c -@@ -0,0 +1,607 @@ -+/* -+ * Copyright (C) 2013 Freescale Semiconductor, Inc. -+ * -+ * Author: Fabio Estevam <fabio.estevam@freescale.com> -+ * Adapted for SPL support by Peter Vicman <peter.vicman@gmail.com> -+ * -+ * SPDX-License-Identifier: GPL-2.0+ -+ */ -+ -+#include <asm/arch/clock.h> -+#include <asm/arch/imx-regs.h> -+#include <asm/arch/iomux.h> -+#include <malloc.h> -+#include <asm/arch/mx6-pins.h> -+#include <asm/errno.h> -+#include <asm/gpio.h> -+#include <asm/imx-common/iomux-v3.h> -+#include <asm/imx-common/sata.h> -+#include <mmc.h> -+#include <fsl_esdhc.h> -+#include <asm/arch/crm_regs.h> -+#include <asm/io.h> -+#include <asm/arch/sys_proto.h> -+#include <micrel.h> -+#include <miiphy.h> -+#include <netdev.h> -+#include <linux/fb.h> -+#include <ipu_pixfmt.h> -+#include <asm/arch/crm_regs.h> -+#include <asm/arch/mxc_hdmi.h> -+#include <command.h> -+ -+DECLARE_GLOBAL_DATA_PTR; -+ -+/* copied from u-boot-2015.07/arch/arm/include/asm/imx-common/iomux-v3.h */ -+/* macros for declaring and using pinmux array */ -+#if defined(CONFIG_MX6QDL) -+#define IOMUX_PADS(x) (MX6Q_##x), (MX6DL_##x) -+#define SETUP_IOMUX_PAD(def) \ -+if (is_cpu_type(MXC_CPU_MX6Q)) { \ -+ imx_iomux_v3_setup_multiple_pads(MX6Q_##def); \ -+} else { \ -+ imx_iomux_v3_setup_multiple_pads(MX6DL_##def); \ -+} -+#define SETUP_IOMUX_PADS(x) \ -+ spl_imx_iomux_v3_setup_multiple_pads(x, ARRAY_SIZE(x)/2) -+ -+#elif defined(CONFIG_MX6Q) || defined(CONFIG_MX6D) -+#define IOMUX_PADS(x) MX6_##x -+#define SETUP_IOMUX_PAD(def) \ -+ imx_iomux_v3_setup_pad(MX6Q_##def); -+#define SETUP_IOMUX_PADS(x) \ -+ spl_imx_iomux_v3_setup_multiple_pads(x, ARRAY_SIZE(x)) -+ -+#else -+#define IOMUX_PADS(x) MX6_##x -+#define SETUP_IOMUX_PAD(def) \ -+ imx_iomux_v3_setup_pad(MX6DL_##def); -+#define SETUP_IOMUX_PADS(x) \ -+ spl_imx_iomux_v3_setup_multiple_pads(x, ARRAY_SIZE(x)) -+#endif -+ -+#define UART_PAD_CTRL (PAD_CTL_PUS_100K_UP | \ -+ PAD_CTL_SPEED_MED | PAD_CTL_DSE_40ohm | \ -+ PAD_CTL_SRE_FAST | PAD_CTL_HYS) -+ -+#define ENET_PAD_CTRL (PAD_CTL_PUS_100K_UP | \ -+ PAD_CTL_SPEED_MED | PAD_CTL_DSE_40ohm | PAD_CTL_HYS) -+ -+#define USDHC_PAD_CTRL (PAD_CTL_PUS_47K_UP | \ -+ PAD_CTL_SPEED_LOW | PAD_CTL_DSE_80ohm | \ -+ PAD_CTL_SRE_FAST | PAD_CTL_HYS) -+ -+#define WDT_EN IMX_GPIO_NR(5, 4) -+#define WDT_TRG IMX_GPIO_NR(3, 19) -+ -+/* copied from u-boot-2015.07/arch/arm/imx-common/iomux-v3.c */ -+#define MXC_CPU_MX6D 0x64 -+ -+/* configures a list of pads within declared with IOMUX_PADS macro */ -+static void spl_imx_iomux_v3_setup_multiple_pads(iomux_v3_cfg_t const *pad_list, -+ unsigned count) -+{ -+ iomux_v3_cfg_t const *p = pad_list; -+ int stride; -+ int i; -+ -+#if defined(CONFIG_MX6QDL) -+ stride = 2; -+ if (!is_cpu_type(MXC_CPU_MX6Q) && !is_cpu_type(MXC_CPU_MX6D)) -+ p += 1; -+#else -+ stride = 1; -+#endif -+ for (i = 0; i < count; i++) { -+ imx_iomux_v3_setup_pad(*p); -+ p += stride; -+ } -+} -+ -+int dram_init(void) -+{ -+ gd->ram_size = (phys_size_t)CONFIG_DDR_MB * 1024 * 1024; -+ -+ return 0; -+} -+ -+static iomux_v3_cfg_t const uart2_pads[] = { -+ IOMUX_PADS(PAD_EIM_D26__UART2_TXD | MUX_PAD_CTRL(UART_PAD_CTRL)), -+ IOMUX_PADS(PAD_EIM_D27__UART2_RXD | MUX_PAD_CTRL(UART_PAD_CTRL)), -+}; -+ -+static iomux_v3_cfg_t const usdhc3_pads[] = { -+ IOMUX_PADS(PAD_SD3_CLK__USDHC3_CLK | MUX_PAD_CTRL(USDHC_PAD_CTRL)), -+ IOMUX_PADS(PAD_SD3_CMD__USDHC3_CMD | MUX_PAD_CTRL(USDHC_PAD_CTRL)), -+ IOMUX_PADS(PAD_SD3_DAT0__USDHC3_DAT0 | MUX_PAD_CTRL(USDHC_PAD_CTRL)), -+ IOMUX_PADS(PAD_SD3_DAT1__USDHC3_DAT1 | MUX_PAD_CTRL(USDHC_PAD_CTRL)), -+ IOMUX_PADS(PAD_SD3_DAT2__USDHC3_DAT2 | MUX_PAD_CTRL(USDHC_PAD_CTRL)), -+ IOMUX_PADS(PAD_SD3_DAT3__USDHC3_DAT3 | MUX_PAD_CTRL(USDHC_PAD_CTRL)), -+}; -+ -+static iomux_v3_cfg_t const wdog_pads[] = { -+ IOMUX_PADS(PAD_EIM_A24__GPIO_5_4 | MUX_PAD_CTRL(NO_PAD_CTRL)), -+ IOMUX_PADS(PAD_EIM_D19__GPIO_3_19), -+}; -+ -+static iomux_v3_cfg_t const lvds_pads[] = { -+ IOMUX_PADS(PAD_GPIO_2__GPIO_1_2 | MUX_PAD_CTRL(NO_PAD_CTRL)), -+ IOMUX_PADS(PAD_GPIO_4__GPIO_1_4 | MUX_PAD_CTRL(NO_PAD_CTRL)), -+}; -+ -+int mx6_rgmii_rework(struct phy_device *phydev) -+{ -+ /* -+ * Bug: Apparently uDoo does not works with Gigabit switches... -+ * Limiting speed to 10/100Mbps, and setting master mode, seems to -+ * be the only way to have a successfull PHY auto negotiation. -+ * How to fix: Understand why Linux kernel do not have this issue. -+ */ -+ phy_write(phydev, MDIO_DEVAD_NONE, MII_CTRL1000, 0x1c00); -+ -+ /* control data pad skew - devaddr = 0x02, register = 0x04 */ -+ ksz9031_phy_extended_write(phydev, 0x02, -+ MII_KSZ9031_EXT_RGMII_CTRL_SIG_SKEW, -+ MII_KSZ9031_MOD_DATA_NO_POST_INC, 0x0000); -+ /* rx data pad skew - devaddr = 0x02, register = 0x05 */ -+ ksz9031_phy_extended_write(phydev, 0x02, -+ MII_KSZ9031_EXT_RGMII_RX_DATA_SKEW, -+ MII_KSZ9031_MOD_DATA_NO_POST_INC, 0x0000); -+ /* tx data pad skew - devaddr = 0x02, register = 0x05 */ -+ ksz9031_phy_extended_write(phydev, 0x02, -+ MII_KSZ9031_EXT_RGMII_TX_DATA_SKEW, -+ MII_KSZ9031_MOD_DATA_NO_POST_INC, 0x0000); -+ /* gtx and rx clock pad skew - devaddr = 0x02, register = 0x08 */ -+ -+ ksz9031_phy_extended_write(phydev, 0x02, -+ MII_KSZ9031_EXT_RGMII_CLOCK_SKEW, -+ MII_KSZ9031_MOD_DATA_NO_POST_INC, 0x03FF); -+ return 0; -+} -+ -+static iomux_v3_cfg_t const enet_pads1[] = { -+ IOMUX_PADS(PAD_ENET_MDIO__ENET_MDIO | MUX_PAD_CTRL(ENET_PAD_CTRL)), -+ IOMUX_PADS(PAD_ENET_MDC__ENET_MDC | MUX_PAD_CTRL(ENET_PAD_CTRL)), -+ IOMUX_PADS(PAD_RGMII_TXC__ENET_RGMII_TXC | MUX_PAD_CTRL(ENET_PAD_CTRL)), -+ IOMUX_PADS(PAD_RGMII_TD0__ENET_RGMII_TD0 | MUX_PAD_CTRL(ENET_PAD_CTRL)), -+ IOMUX_PADS(PAD_RGMII_TD1__ENET_RGMII_TD1 | MUX_PAD_CTRL(ENET_PAD_CTRL)), -+ IOMUX_PADS(PAD_RGMII_TD2__ENET_RGMII_TD2 | MUX_PAD_CTRL(ENET_PAD_CTRL)), -+ IOMUX_PADS(PAD_RGMII_TD3__ENET_RGMII_TD3 | MUX_PAD_CTRL(ENET_PAD_CTRL)), -+ IOMUX_PADS(PAD_RGMII_TX_CTL__RGMII_TX_CTL | MUX_PAD_CTRL(ENET_PAD_CTRL)), -+ IOMUX_PADS(PAD_ENET_REF_CLK__ENET_TX_CLK | MUX_PAD_CTRL(ENET_PAD_CTRL)), -+ IOMUX_PADS(PAD_RGMII_RXC__ENET_RGMII_RXC | MUX_PAD_CTRL(ENET_PAD_CTRL)), -+ /* RGMII reset */ -+ IOMUX_PADS(PAD_EIM_D23__GPIO_3_23 | MUX_PAD_CTRL(NO_PAD_CTRL)), -+ /* alimentazione ethernet*/ -+ IOMUX_PADS(PAD_EIM_EB3__GPIO_2_31 | MUX_PAD_CTRL(NO_PAD_CTRL)), -+ /* pin 32 - 1 - (MODE0) all */ -+ IOMUX_PADS(PAD_RGMII_RD0__GPIO_6_25 | MUX_PAD_CTRL(NO_PAD_CTRL)), -+ /* pin 31 - 1 - (MODE1) all */ -+ IOMUX_PADS(PAD_RGMII_RD1__GPIO_6_27 | MUX_PAD_CTRL(NO_PAD_CTRL)), -+ /* pin 28 - 1 - (MODE2) all */ -+ IOMUX_PADS(PAD_RGMII_RD2__GPIO_6_28 | MUX_PAD_CTRL(NO_PAD_CTRL)), -+ /* pin 27 - 1 - (MODE3) all */ -+ IOMUX_PADS(PAD_RGMII_RD3__GPIO_6_29 | MUX_PAD_CTRL(NO_PAD_CTRL)), -+ /* pin 33 - 1 - (CLK125_EN) 125Mhz clockout enabled */ -+ IOMUX_PADS(PAD_RGMII_RX_CTL__GPIO_6_24 | MUX_PAD_CTRL(NO_PAD_CTRL)), -+}; -+ -+static iomux_v3_cfg_t const enet_pads2[] = { -+ IOMUX_PADS(PAD_RGMII_RD0__ENET_RGMII_RD0 | MUX_PAD_CTRL(ENET_PAD_CTRL)), -+ IOMUX_PADS(PAD_RGMII_RD1__ENET_RGMII_RD1 | MUX_PAD_CTRL(ENET_PAD_CTRL)), -+ IOMUX_PADS(PAD_RGMII_RD2__ENET_RGMII_RD2 | MUX_PAD_CTRL(ENET_PAD_CTRL)), -+ IOMUX_PADS(PAD_RGMII_RD3__ENET_RGMII_RD3 | MUX_PAD_CTRL(ENET_PAD_CTRL)), -+ IOMUX_PADS(PAD_RGMII_RX_CTL__RGMII_RX_CTL | MUX_PAD_CTRL(ENET_PAD_CTRL)), -+}; -+ -+static void setup_iomux_enet(void) -+{ -+ SETUP_IOMUX_PADS(enet_pads1); -+ udelay(20); -+ gpio_direction_output(IMX_GPIO_NR(2, 31), 1); /* Power on enet */ -+ -+ gpio_direction_output(IMX_GPIO_NR(3, 23), 0); /* assert PHY rst */ -+ -+ gpio_direction_output(IMX_GPIO_NR(6, 24), 1); -+ gpio_direction_output(IMX_GPIO_NR(6, 25), 1); -+ gpio_direction_output(IMX_GPIO_NR(6, 27), 1); -+ gpio_direction_output(IMX_GPIO_NR(6, 28), 1); -+ gpio_direction_output(IMX_GPIO_NR(6, 29), 1); -+ udelay(1000); -+ -+ gpio_set_value(IMX_GPIO_NR(3, 23), 1); /* deassert PHY rst */ -+ -+ /* Need delay 100ms to exit from reset. */ -+ udelay(1000 * 100); -+ -+ gpio_free(IMX_GPIO_NR(6, 24)); -+ gpio_free(IMX_GPIO_NR(6, 25)); -+ gpio_free(IMX_GPIO_NR(6, 27)); -+ gpio_free(IMX_GPIO_NR(6, 28)); -+ gpio_free(IMX_GPIO_NR(6, 29)); -+ -+ SETUP_IOMUX_PADS(enet_pads2); -+} -+ -+static void setup_iomux_uart(void) -+{ -+ SETUP_IOMUX_PADS(uart2_pads); -+} -+ -+static void setup_iomux_wdog(void) -+{ -+ SETUP_IOMUX_PADS(wdog_pads); -+ gpio_direction_output(WDT_TRG, 0); -+ gpio_direction_output(WDT_EN, 1); -+ gpio_direction_input(WDT_TRG); -+} -+ -+static struct fsl_esdhc_cfg usdhc_cfg = { USDHC3_BASE_ADDR }; -+ -+int board_mmc_getcd(struct mmc *mmc) -+{ -+ return 1; /* Always present */ -+} -+ -+int board_eth_init(bd_t *bis) -+{ -+ uint32_t base = IMX_FEC_BASE; -+ struct mii_dev *bus = NULL; -+ struct phy_device *phydev = NULL; -+ int ret; -+ -+ setup_iomux_enet(); -+ -+#ifdef CONFIG_FEC_MXC -+ bus = fec_get_miibus(base, -1); -+ if (!bus) -+ return 0; -+ /* scan phy 4,5,6,7 */ -+ phydev = phy_find_by_mask(bus, (0xf << 4), PHY_INTERFACE_MODE_RGMII); -+ -+ if (!phydev) { -+ free(bus); -+ return 0; -+ } -+ printf("using phy at %d\n", phydev->addr); -+ ret = fec_probe(bis, -1, base, bus, phydev); -+ if (ret) { -+ printf("FEC MXC: %s:failed\n", __func__); -+ free(phydev); -+ free(bus); -+ } -+#endif -+ return 0; -+} -+ -+int board_mmc_init(bd_t *bis) -+{ -+ SETUP_IOMUX_PADS(usdhc3_pads); -+ usdhc_cfg.sdhc_clk = mxc_get_clock(MXC_ESDHC3_CLK); -+ usdhc_cfg.max_bus_width = 4; -+ -+ return fsl_esdhc_initialize(bis, &usdhc_cfg); -+} -+ -+#if defined(CONFIG_VIDEO_IPUV3) -+ -+struct display_info_t { -+ int bus; -+ int addr; -+ int pixfmt; -+ int (*detect)(struct display_info_t const *dev); -+ void (*enable)(struct display_info_t const *dev); -+ struct fb_videomode mode; -+}; -+ -+static int detect_hdmi(struct display_info_t const *dev) -+{ -+ struct hdmi_regs *hdmi = (struct hdmi_regs *)HDMI_ARB_BASE_ADDR; -+ return readb(&hdmi->phy_stat0) & HDMI_DVI_STAT; -+} -+ -+static void do_enable_hdmi(struct display_info_t const *dev) -+{ -+ imx_enable_hdmi_phy(); -+} -+ -+static int detect_lvds(struct display_info_t const *dev) -+{ -+ return 0; -+} -+ -+static void do_enable_lvds(struct display_info_t const *dev) -+{ -+ SETUP_IOMUX_PADS(lvds_pads); -+ gpio_direction_output(IMX_GPIO_NR(1, 2), 1); /* LVDS power On */ -+ gpio_direction_output(IMX_GPIO_NR(1, 4), 1); /* LVDS backlight On */ -+ return; -+} -+ -+static struct display_info_t const displays[] = {{ -+ .bus = -1, -+ .addr = -1, -+ .pixfmt = IPU_PIX_FMT_RGB666, -+ .detect = detect_lvds, -+ .enable = do_enable_lvds, -+ .mode = { -+ // Rif. 800x480 Panel UMSH-8596MD-20T -+ // To activate write "setenv panel LDB-WVGA" or leave empty. -+ .name = "LDB-WVGA", -+ .refresh = 60, -+ .xres = 800, -+ .yres = 480, -+ .pixclock = 15385, -+ .left_margin = 220, -+ .right_margin = 40, -+ .upper_margin = 21, -+ .lower_margin = 7, -+ .hsync_len = 60, -+ .vsync_len = 10, -+ .sync = 0, -+ .vmode = FB_VMODE_NONINTERLACED -+} }, { -+ .bus = -1, -+ .addr = 0, -+ .pixfmt = IPU_PIX_FMT_RGB24, -+ .detect = detect_hdmi, -+ .enable = do_enable_hdmi, -+ .mode = { -+ .name = "HDMI", -+ .refresh = 60, -+ .xres = 1024, -+ .yres = 768, -+ .pixclock = 15385, -+ .left_margin = 220, -+ .right_margin = 40, -+ .upper_margin = 21, -+ .lower_margin = 7, -+ .hsync_len = 60, -+ .vsync_len = 10, -+ .sync = FB_SYNC_EXT, -+ .vmode = FB_VMODE_NONINTERLACED -+} }, { -+ .bus = -1, -+ .addr = -1, -+ .pixfmt = IPU_PIX_FMT_RGB666, -+ .detect = detect_lvds, -+ .enable = do_enable_lvds, -+ .mode = { -+ // Rif. Panel 1024x768 - UMSH-8596MD-15T - G156XW01V0 -+ // To activate write "setenv panel LDB-XGA". -+ .name = "LDB-XGA", -+ .refresh = 60, -+ .xres = 1024, -+ .yres = 768, -+ .pixclock = 15385, -+ .left_margin = 220, -+ .right_margin = 40, -+ .upper_margin = 21, -+ .lower_margin = 7, -+ .hsync_len = 60, -+ .vsync_len = 10, -+ .sync = 0, -+ .vmode = FB_VMODE_NONINTERLACED -+} }, { -+ .bus = -1, -+ .addr = -1, -+ .pixfmt = IPU_PIX_FMT_RGB24, -+ .detect = detect_lvds, -+ .enable = do_enable_lvds, -+ .mode = { -+ // Rif. 1366x768 Panel CHIMEI M156B3-LA1 -+ // To activate write "setenv panel LDB-WXGA". -+ .name = "LDB-WXGA", -+ .refresh = 59, -+ .xres = 1368, -+ .yres = 768, -+ .pixclock = 13890, -+ .left_margin = 220, -+ .right_margin = 40, -+ .upper_margin = 21, -+ .lower_margin = 7, -+ .hsync_len = 60, -+ .vsync_len = 10, -+ .sync = 0, -+ .vmode = FB_VMODE_NONINTERLACED -+} }, -+}; -+ -+int board_video_skip(void) -+{ -+ int i; -+ int ret; -+ char const *panel = getenv("panel"); -+ -+ if (!panel) { -+ for (i = 0; i < ARRAY_SIZE(displays); i++) { -+ struct display_info_t const *dev = displays+i; -+ if (dev->detect(dev)) { -+ panel = dev->mode.name; -+ printf("auto-detected panel %s\n", panel); -+ break; -+ } -+ } -+ if (!panel) { -+ panel = displays[0].mode.name; -+ printf("No panel detected: default to %s\n", panel); -+ i = 0; -+ } -+ } else { -+ for (i = 0; i < ARRAY_SIZE(displays); i++) { -+ if (!strcmp(panel, displays[i].mode.name)) -+ break; -+ } -+ } -+ if (i < ARRAY_SIZE(displays)) { -+ ret = ipuv3_fb_init(&displays[i].mode, 0, -+ displays[i].pixfmt); -+ if (!ret) { -+ displays[i].enable(displays+i); -+ printf("Display: %s (%ux%u)\n", -+ displays[i].mode.name, -+ displays[i].mode.xres, -+ displays[i].mode.yres); -+ } else { -+ printf("LCD %s cannot be configured: %d\n", -+ displays[i].mode.name, ret); -+ } -+ } else { -+ printf("unsupported panel %s\n", panel); -+ ret = -EINVAL; -+ } -+ return (0 != ret); -+} -+ -+static void setup_display(void) -+{ -+ struct mxc_ccm_reg *mxc_ccm = (struct mxc_ccm_reg *)CCM_BASE_ADDR; -+ struct iomuxc *iomux = (struct iomuxc *)IOMUXC_BASE_ADDR; -+ int reg; -+ -+ enable_ipu_clock(); -+ imx_setup_hdmi(); -+ -+ /* Turn on LDB0,IPU DI0 clocks */ -+ reg = __raw_readl(&mxc_ccm->CCGR3); -+ reg |= MXC_CCM_CCGR3_LDB_DI0_MASK; -+ writel(reg, &mxc_ccm->CCGR3); -+ -+ /* set LDB0, LDB1 clk select to 011/011 */ -+ reg = readl(&mxc_ccm->cs2cdr); -+ reg &= ~(MXC_CCM_CS2CDR_LDB_DI0_CLK_SEL_MASK -+ |MXC_CCM_CS2CDR_LDB_DI1_CLK_SEL_MASK); -+ reg |= (3<<MXC_CCM_CS2CDR_LDB_DI0_CLK_SEL_OFFSET); -+ writel(reg, &mxc_ccm->cs2cdr); -+ -+ reg = readl(&mxc_ccm->cscmr2); -+ reg |= MXC_CCM_CSCMR2_LDB_DI0_IPU_DIV; -+ writel(reg, &mxc_ccm->cscmr2); -+ -+ reg = readl(&mxc_ccm->chsccdr); -+ reg |= (CHSCCDR_CLK_SEL_LDB_DI0 -+ << MXC_CCM_CHSCCDR_IPU1_DI0_CLK_SEL_OFFSET); -+ writel(reg, &mxc_ccm->chsccdr); -+ -+ reg = IOMUXC_GPR2_BGREF_RRMODE_EXTERNAL_RES -+ |IOMUXC_GPR2_DI1_VS_POLARITY_ACTIVE_HIGH -+ |IOMUXC_GPR2_DI0_VS_POLARITY_ACTIVE_LOW -+ |IOMUXC_GPR2_BIT_MAPPING_CH1_SPWG -+ |IOMUXC_GPR2_DATA_WIDTH_CH1_18BIT -+ |IOMUXC_GPR2_BIT_MAPPING_CH0_SPWG -+ |IOMUXC_GPR2_DATA_WIDTH_CH0_18BIT -+ |IOMUXC_GPR2_LVDS_CH1_MODE_DISABLED -+ |IOMUXC_GPR2_LVDS_CH0_MODE_ENABLED_DI0; -+ writel(reg, &iomux->gpr[2]); -+ -+ reg = readl(&iomux->gpr[3]); -+ reg = (reg & ~(IOMUXC_GPR3_LVDS0_MUX_CTL_MASK -+ |IOMUXC_GPR3_HDMI_MUX_CTL_MASK)) -+ | (IOMUXC_GPR3_MUX_SRC_IPU1_DI0 -+ <<IOMUXC_GPR3_LVDS0_MUX_CTL_OFFSET); -+ writel(reg, &iomux->gpr[3]); -+} -+ -+/* -+ * Show device feature strings on current display -+ * around uDOO Logo. -+ */ -+void show_boot_messages(void) -+{ -+ int i; -+ ulong cycles = 0; -+ int repeatable; -+ char *plotmsg_cmd[2]; -+#if defined(CONFIG_MX6DL) -+ char *boot_messages[7] = { -+"UDOO Board 2013", -+"CPU Freescale i.MX6 DualLite 1GHz", -+"dual ARMv7 Cortex-A9 core", -+"1GB RAM DDR3", -+"Vivante GC880 GPU", -+"Atmel SAM3X8E ARM Cortex-M3 CPU", -+"Arduino-compatible R3 1.0 pinout", -+}; -+#else -+ char *boot_messages[7] = { -+"UDOO Board 2013", -+"CPU Freescale i.MX6 Quad/Dual 1GHz", -+"quad/dual ARMv7 Cortex-A9 core", -+"1GB RAM DDR3", -+"Vivante GC2000 / GC880", -+"Atmel SAM3X8E ARM Cortex-M3 CPU", -+"Arduino-compatible R3 1.0 pinout", -+}; -+#endif -+ -+ for (i=0; i<7; i++) { -+ plotmsg_cmd[0] = "plotmsg"; -+ plotmsg_cmd[1] = boot_messages[i]; -+ cmd_process(0, 2, plotmsg_cmd, &repeatable, &cycles); -+ } -+} -+#endif /* CONFIG_VIDEO_IPUV3 */ -+ -+int board_early_init_f(void) -+{ -+#if defined(CONFIG_VIDEO_IPUV3) -+ setup_display(); -+#endif -+ setup_iomux_wdog(); -+ setup_iomux_uart(); -+ -+ return 0; -+} -+ -+int board_late_init(void) -+{ -+ if (is_cpu_type(MXC_CPU_MX6Q)) -+ setenv("board_rev", "MX6Q"); -+ else -+ setenv("board_rev", "MX6DL"); -+ -+ return 0; -+} -+ -+int board_phy_config(struct phy_device *phydev) -+{ -+ mx6_rgmii_rework(phydev); -+ if (phydev->drv->config) -+ phydev->drv->config(phydev); -+ -+ return 0; -+} -+ -+/* -+ * Do not overwrite the console -+ * Use always serial for U-Boot console -+ */ -+int overwrite_console(void) -+{ -+#if defined(CONFIG_VIDEO_IPUV3) -+ show_boot_messages(); -+#endif -+ return 1; -+} -+ -+int board_init(void) -+{ -+ /* address of boot parameters */ -+ gd->bd->bi_boot_params = PHYS_SDRAM + 0x100; -+ -+#ifdef CONFIG_CMD_SATA -+ if (is_cpu_type(MXC_CPU_MX6Q)) -+ sata_setup(); -+#endif -+ return 0; -+} -+ -+int checkboard(void) -+{ -+ if (is_cpu_type(MXC_CPU_MX6Q)) -+ puts("Board: Udoo Quad\n"); -+ else -+ puts("Board: Udoo DualLite\n"); -+ -+ return 0; -+} -diff --git a/board/udoo/udoo.cfg b/board/udoo/udoo.cfg -new file mode 100644 -index 0000000..2519f14 ---- /dev/null -+++ b/board/udoo/udoo.cfg -@@ -0,0 +1,41 @@ -+/* -+ * Copyright (C) 2013 Seco USA Inc -+ * -+ * SPDX-License-Identifier: GPL-2.0+ -+ * -+ * Refer doc/README.imximage for more details about how-to configure -+ * and create imximage boot image -+ * -+ * The syntax is taken as close as possible with the kwbimage -+ */ -+ -+/* image version */ -+IMAGE_VERSION 2 -+ -+/* -+ * Boot Device : one of -+ * spi, sd (the board has no nand neither onenand) -+ */ -+BOOT_FROM sd -+ -+#define __ASSEMBLY__ -+#include <config.h> -+ -+#ifndef CONFIG_SPL -+#include "asm/arch/mx6-ddr.h" -+#endif -+ -+#include "asm/arch/iomux.h" -+#include "asm/arch/crm_regs.h" -+ -+#ifndef CONFIG_SPL -+#if defined(CONFIG_MX6Q) -+#include "ddr-setup_q.cfg" -+#include "1066mhz_4x256mx16_q.cfg" -+#else -+#include "ddr-setup_dl.cfg" -+#include "1066mhz_4x256mx16_dl.cfg" -+#endif -+#endif -+ -+#include "clocks.cfg" -diff --git a/board/udoo/udoo_spl.c b/board/udoo/udoo_spl.c -new file mode 100644 -index 0000000..db5044a ---- /dev/null -+++ b/board/udoo/udoo_spl.c -@@ -0,0 +1,404 @@ -+/* -+ * Author: Tungyi Lin <tungyilin1127@gmail.com> -+ * -+ * Derived from EDM_CF_IMX6 code by TechNexion,Inc -+ * Ported to SolidRun microSOM by Rabeeh Khoury <rabeeh@solid-run.com> -+ * Ported to Udoo from mx6_cubox-i_spl.c by Peter Vicman <peter.vicman@gmail.com> -+ * -+ * SPDX-License-Identifier: GPL-2.0+ -+ */ -+#include <common.h> -+#include <asm/io.h> -+#include <asm/arch/sys_proto.h> -+#ifdef CONFIG_SPL -+#include <spl.h> -+#include <libfdt.h> -+#endif -+#include <asm/arch/iomux.h> -+#include <asm/arch/mx6-pins.h> -+#include <asm/gpio.h> -+#include <asm/arch-mx6/crm_regs.h> -+#include "asm/arch/mx6_ddr_regs.h" -+ -+#define CONFIG_SPL_STACK 0x0091FFB8 -+ -+DECLARE_GLOBAL_DATA_PTR; -+ -+#define UART_PAD_CTRL (PAD_CTL_PUS_100K_UP | \ -+ PAD_CTL_SPEED_MED | PAD_CTL_DSE_40ohm | \ -+ PAD_CTL_SRE_FAST | PAD_CTL_HYS) -+ -+static void spl_mx6dl_dram_setup_iomux(void) -+{ -+ volatile struct mx6sdl_iomux_ddr_regs *mx6dl_ddr_iomux; -+ volatile struct mx6sdl_iomux_grp_regs *mx6dl_grp_iomux; -+ -+ mx6dl_ddr_iomux = (struct mx6sdl_iomux_ddr_regs *) MX6SDL_IOM_DDR_BASE; -+ mx6dl_grp_iomux = (struct mx6sdl_iomux_grp_regs *) MX6SDL_IOM_GRP_BASE; -+ -+ /* ddr-setup_dl.cfg */ -+ mx6dl_ddr_iomux->dram_sdqs0 = 0x00000028; -+ mx6dl_ddr_iomux->dram_sdqs1 = 0x00000028; -+ mx6dl_ddr_iomux->dram_sdqs2 = 0x00000028; -+ mx6dl_ddr_iomux->dram_sdqs3 = 0x00000028; -+ mx6dl_ddr_iomux->dram_sdqs4 = 0x00000028; -+ mx6dl_ddr_iomux->dram_sdqs5 = 0x00000028; -+ mx6dl_ddr_iomux->dram_sdqs6 = 0x00000028; -+ mx6dl_ddr_iomux->dram_sdqs7 = 0x00000028; -+ -+ mx6dl_grp_iomux->grp_b0ds = 0x00000028; -+ mx6dl_grp_iomux->grp_b1ds = 0x00000028; -+ mx6dl_grp_iomux->grp_b2ds = 0x00000028; -+ mx6dl_grp_iomux->grp_b3ds = 0x00000028; -+ mx6dl_grp_iomux->grp_b4ds = 0x00000028; -+ mx6dl_grp_iomux->grp_b5ds = 0x00000028; -+ mx6dl_grp_iomux->grp_b6ds = 0x00000028; -+ mx6dl_grp_iomux->grp_b7ds = 0x00000028; -+ mx6dl_grp_iomux->grp_addds = 0x00000028; -+ -+ mx6dl_grp_iomux->grp_ctlds = 0x00000028; -+ -+ mx6dl_ddr_iomux->dram_dqm0 = 0x00000028; -+ mx6dl_ddr_iomux->dram_dqm1 = 0x00000028; -+ mx6dl_ddr_iomux->dram_dqm2 = 0x00000028; -+ mx6dl_ddr_iomux->dram_dqm3 = 0x00000028; -+ mx6dl_ddr_iomux->dram_dqm4 = 0x00000028; -+ mx6dl_ddr_iomux->dram_dqm5 = 0x00000028; -+ mx6dl_ddr_iomux->dram_dqm6 = 0x00000028; -+ mx6dl_ddr_iomux->dram_dqm7 = 0x00000028; -+ -+ mx6dl_ddr_iomux->dram_cas = 0x00000028; -+ mx6dl_ddr_iomux->dram_ras = 0x00000028; -+ mx6dl_ddr_iomux->dram_sdclk_0 = 0x00000028; -+ mx6dl_ddr_iomux->dram_sdclk_1 = 0x00000028; -+ -+ mx6dl_ddr_iomux->dram_reset = 0x00000028; -+ -+ mx6dl_ddr_iomux->dram_sdodt0 = 0x00000028; -+ mx6dl_ddr_iomux->dram_sdodt1 = 0x00000028; -+ -+ /* (differential input) */ -+ mx6dl_grp_iomux->grp_ddrmode_ctl = 0x00020000; -+ /* (differential input) */ -+ mx6dl_grp_iomux->grp_ddrmode = 0x00020000; -+ /* disable ddr pullups */ -+ mx6dl_grp_iomux->grp_ddrpke = 0x00000000; -+ mx6dl_ddr_iomux->dram_sdba2 = 0x00000000; -+ /* 40 Ohm drive strength for cs0/1,sdba2,cke0/1,sdwe */ -+ mx6dl_grp_iomux->grp_ddr_type = 0x000C0000; -+} -+ -+static void spl_mx6q_dram_setup_iomux(void) -+{ -+ volatile struct mx6qd_iomux_ddr_regs *mx6q_ddr_iomux; -+ volatile struct mx6qd_iomux_grp_regs *mx6q_grp_iomux; -+ -+ mx6q_ddr_iomux = (struct mx6qd_iomux_ddr_regs *) MX6DQ_IOM_DDR_BASE; -+ mx6q_grp_iomux = (struct mx6qd_iomux_grp_regs *) MX6DQ_IOM_GRP_BASE; -+ -+ /* ddr-setup_q.cfg */ -+ mx6q_ddr_iomux->dram_sdqs0 = 0x00000030; -+ mx6q_ddr_iomux->dram_sdqs1 = 0x00000030; -+ mx6q_ddr_iomux->dram_sdqs2 = 0x00000030; -+ mx6q_ddr_iomux->dram_sdqs3 = 0x00000030; -+ mx6q_ddr_iomux->dram_sdqs4 = 0x00000030; -+ mx6q_ddr_iomux->dram_sdqs5 = 0x00000030; -+ mx6q_ddr_iomux->dram_sdqs6 = 0x00000030; -+ mx6q_ddr_iomux->dram_sdqs7 = 0x00000030; -+ -+ mx6q_grp_iomux->grp_b0ds = 0x00000030; -+ mx6q_grp_iomux->grp_b1ds = 0x00000030; -+ mx6q_grp_iomux->grp_b2ds = 0x00000030; -+ mx6q_grp_iomux->grp_b3ds = 0x00000030; -+ mx6q_grp_iomux->grp_b4ds = 0x00000030; -+ mx6q_grp_iomux->grp_b5ds = 0x00000030; -+ mx6q_grp_iomux->grp_b6ds = 0x00000030; -+ mx6q_grp_iomux->grp_b7ds = 0x00000030; -+ mx6q_grp_iomux->grp_addds = 0x00000030; -+ /* 40 Ohm drive strength for cs0/1,sdba2,cke0/1,sdwe */ -+ mx6q_grp_iomux->grp_ctlds = 0x00000030; -+ -+ mx6q_ddr_iomux->dram_dqm0 = 0x00020030; -+ mx6q_ddr_iomux->dram_dqm1 = 0x00020030; -+ mx6q_ddr_iomux->dram_dqm2 = 0x00020030; -+ mx6q_ddr_iomux->dram_dqm3 = 0x00020030; -+ mx6q_ddr_iomux->dram_dqm4 = 0x00020030; -+ mx6q_ddr_iomux->dram_dqm5 = 0x00020030; -+ mx6q_ddr_iomux->dram_dqm6 = 0x00020030; -+ mx6q_ddr_iomux->dram_dqm7 = 0x00020030; -+ -+ mx6q_ddr_iomux->dram_cas = 0x00020030; -+ mx6q_ddr_iomux->dram_ras = 0x00020030; -+ mx6q_ddr_iomux->dram_sdclk_0 = 0x00020030; -+ mx6q_ddr_iomux->dram_sdclk_1 = 0x00020030; -+ -+ mx6q_ddr_iomux->dram_reset = 0x00020030; -+ mx6q_ddr_iomux->dram_sdcke0 = 0x00003000; -+ mx6q_ddr_iomux->dram_sdcke1 = 0x00003000; -+ -+ mx6q_ddr_iomux->dram_sdodt0 = 0x00003030; -+ mx6q_ddr_iomux->dram_sdodt1 = 0x00003030; -+ -+ /* (differential input) */ -+ mx6q_grp_iomux->grp_ddrmode_ctl = 0x00020000; -+ /* (differential input) */ -+ mx6q_grp_iomux->grp_ddrmode = 0x00020000; -+ /* disable ddr pullups */ -+ mx6q_grp_iomux->grp_ddrpke = 0x00000000; -+ mx6q_ddr_iomux->dram_sdba2 = 0x00000000; -+ /* 40 Ohm drive strength for cs0/1,sdba2,cke0/1,sdwe */ -+ mx6q_grp_iomux->grp_ddr_type = 0x000c0000; -+} -+ -+/* Udoo DualLite 1GByte memory -+ Micron MT41K128M16JT-125 */ -+static void spl_dram_init_mx6dl_1g(void) -+{ -+ volatile struct mmdc_p_regs *mmdc_p0; -+ volatile struct mmdc_p_regs *mmdc_p1; -+ mmdc_p0 = (struct mmdc_p_regs *) MMDC_P0_BASE_ADDR; -+ mmdc_p1 = (struct mmdc_p_regs *) MMDC_P1_BASE_ADDR; -+ -+ /* end of ddr-setup_dl.cfg */ -+ /* Read data DQ Byte0-3 delay */ -+ mmdc_p0->mprddqby0dl = 0x33333333; -+ mmdc_p0->mprddqby1dl = 0x33333333; -+ mmdc_p0->mprddqby2dl = 0x33333333; -+ mmdc_p0->mprddqby3dl = 0x33333333; -+ mmdc_p1->mprddqby0dl = 0x33333333; -+ mmdc_p1->mprddqby1dl = 0x33333333; -+ mmdc_p1->mprddqby2dl = 0x33333333; -+ mmdc_p1->mprddqby3dl = 0x33333333; -+ -+ /* 1066mhz_4x256mx16_dl.cfg */ -+ mmdc_p0->mdpdc = 0x0002002D; -+ mmdc_p0->mdotc = 0x00333040; -+ -+ mmdc_p0->mdcfg0 = 0x3F4352F3; -+ mmdc_p0->mdcfg1 = 0xB66D8B63; -+ mmdc_p0->mdcfg2 = 0x01FF00DB; -+ -+ mmdc_p0->mdmisc = 0x00001740; -+ mmdc_p0->mdscr = 0x00008000; -+ mmdc_p0->mdrwd = 0x000026D2; -+ -+ mmdc_p0->mdor = 0x00431023; -+ mmdc_p0->mdasp = 0x00000027; -+ mmdc_p0->mdctl = 0x831A0000; -+ -+ mmdc_p0->mdscr = 0x02008032; -+ mmdc_p0->mdscr = 0x00008033; -+ mmdc_p0->mdscr = 0x00048031; -+ mmdc_p0->mdscr = 0x05208030; -+ mmdc_p0->mdscr = 0x04008040; -+ -+ mmdc_p0->mpzqhwctrl = 0xa1390003; -+ mmdc_p1->mpzqhwctrl = 0xa1390003; -+ -+ mmdc_p0->mdref = 0x00007800; -+ -+ mmdc_p0->mpodtctrl = 0x00022227; -+ mmdc_p1->mpodtctrl = 0x00022227; -+ -+ mmdc_p0->mpdgctrl0 = 0x425C0251; -+ mmdc_p0->mpdgctrl1 = 0x021B021E; -+ mmdc_p1->mpdgctrl0 = 0x021B021E; -+ mmdc_p1->mpdgctrl1 = 0x01730200; -+ -+ mmdc_p0->mprddlctl = 0x45474C45; -+ mmdc_p1->mprddlctl = 0x44464744; -+ mmdc_p0->mpwrdlctl = 0x3F3F3336; -+ mmdc_p1->mpwrdlctl = 0x32383630; -+ -+ mmdc_p0->mpwldectrl0 = 0x002F0038; -+ mmdc_p0->mpwldectrl1 = 0x001F001F; -+ mmdc_p1->mpwldectrl0 = 0x001F001F; -+ mmdc_p1->mpwldectrl1 = 0x001F001F; -+ -+ mmdc_p0->mpmur0 = 0x00000000; -+ mmdc_p1->mpmur0 = 0x00000000; -+ -+ mmdc_p0->mdpdc = 0x0002556D; -+ mmdc_p0->mapsr = 0x00011006; -+ mmdc_p0->mdscr = 0x00000000; -+} -+ -+/* Udoo Quad 1GByte memory -+ Micron MT41K128M16JT-125 */ -+static void spl_dram_init_mx6q_1g(void) -+{ -+ volatile struct mmdc_p_regs *mmdc_p0; -+ volatile struct mmdc_p_regs *mmdc_p1; -+ mmdc_p0 = (struct mmdc_p_regs *) MMDC_P0_BASE_ADDR; -+ mmdc_p1 = (struct mmdc_p_regs *) MMDC_P1_BASE_ADDR; -+ -+ /* end of ddr-setup_q.cfg */ -+ /* Read data DQ Byte0-3 delay */ -+ mmdc_p0->mprddqby0dl = 0x33333333; -+ mmdc_p0->mprddqby1dl = 0x33333333; -+ mmdc_p0->mprddqby2dl = 0x33333333; -+ mmdc_p0->mprddqby3dl = 0x33333333; -+ mmdc_p1->mprddqby0dl = 0x33333333; -+ mmdc_p1->mprddqby1dl = 0x33333333; -+ mmdc_p1->mprddqby2dl = 0x33333333; -+ mmdc_p1->mprddqby3dl = 0x33333333; -+ -+ /* 1066mhz_4x256mx16_q.cfg */ -+ mmdc_p0->mdpdc = 0x00020036; -+ mmdc_p0->mdotc = 0x09444040; -+ -+ mmdc_p0->mdcfg0 = 0x54597955; -+ mmdc_p0->mdcfg1 = 0xFF328F64; -+ mmdc_p0->mdcfg2 = 0x01FF00DB; -+ -+ mmdc_p0->mdmisc = 0x00001740; -+ mmdc_p0->mdscr = 0x00008000; -+ mmdc_p0->mdrwd = 0x000026D2; -+ -+ mmdc_p0->mdor = 0x00591023; -+ mmdc_p0->mdasp = 0x00000027; -+ mmdc_p0->mdctl = 0x831A0000; -+ -+ mmdc_p0->mdscr = 0x04088032; -+ mmdc_p0->mdscr = 0x00008033; -+ mmdc_p0->mdscr = 0x00048031; -+ mmdc_p0->mdscr = 0x09408030; -+ mmdc_p0->mdscr = 0x04008040; -+ -+ mmdc_p0->mpzqhwctrl = 0xA1380003; -+ mmdc_p1->mpzqhwctrl = 0xA1380003; -+ -+ mmdc_p0->mdref = 0x00005800; -+ -+ mmdc_p0->mpodtctrl = 0x00011117; -+ mmdc_p1->mpodtctrl = 0x00011117; -+ -+ mmdc_p0->mpdgctrl0 = 0x43510360; -+ mmdc_p0->mpdgctrl1 = 0x0342033F; -+ mmdc_p1->mpdgctrl0 = 0x033F033F; -+ mmdc_p1->mpdgctrl1 = 0x03290266; -+ -+ mmdc_p0->mprddlctl = 0x4B3E4141; -+ mmdc_p1->mprddlctl = 0x47413B4A; -+ mmdc_p0->mpwrdlctl = 0x42404843; -+ mmdc_p1->mpwrdlctl = 0x4C3F4C45; -+ -+ mmdc_p0->mpwldectrl0 = 0x00350035; -+ mmdc_p0->mpwldectrl1 = 0x001F001F; -+ mmdc_p1->mpwldectrl0 = 0x00010001; -+ mmdc_p1->mpwldectrl1 = 0x00010001; -+ -+ mmdc_p0->mpmur0 = 0x00000800; -+ mmdc_p1->mpmur0 = 0x00000800; -+ -+ mmdc_p0->mdpdc = 0x00025576; -+ mmdc_p0->mapsr = 0x00011006; -+ mmdc_p0->mdscr = 0x00000000; -+} -+ -+static void spl_dram_init(void) -+{ -+ if (is_cpu_type(MXC_CPU_MX6Q)) { -+ spl_mx6q_dram_setup_iomux(); -+ spl_dram_init_mx6q_1g(); -+ } else { -+ spl_mx6dl_dram_setup_iomux(); -+ spl_dram_init_mx6dl_1g(); -+ } -+} -+ -+static void prefetch_enable(void) -+{ -+#ifdef CONFIG_SYS_PL310_BASE -+ u32 reg; -+ -+ writel(0x30000003, CONFIG_SYS_PL310_BASE + 0xf60); -+ -+ reg = readl(CONFIG_SYS_PL310_BASE + 0x104); -+ reg |= (1 << 30); -+ writel(reg, CONFIG_SYS_PL310_BASE + 0x104); -+#endif -+} -+ -+/* copied from u-boot-2015.07 */ -+static void ccgr_init(void) -+{ -+ struct mxc_ccm_reg *ccm = (struct mxc_ccm_reg *)CCM_BASE_ADDR; -+ -+ /* set the default clock gate to save power */ -+ writel(0x00C03F3F, &ccm->CCGR0); -+ writel(0x0030FC03, &ccm->CCGR1); -+ writel(0x0FFFC000, &ccm->CCGR2); -+ writel(0x3FF00000, &ccm->CCGR3); -+ writel(0x00FFF300, &ccm->CCGR4); -+ writel(0x0F0000C3, &ccm->CCGR5); -+ writel(0x000003FF, &ccm->CCGR6); -+} -+ -+/* copied from u-boot-2015.07 */ -+static void gpr_init(void) -+{ -+ struct iomuxc *iomux = (struct iomuxc *)IOMUXC_BASE_ADDR; -+ -+ /* enable AXI cache for VDOA/VPU/IPU */ -+ writel(0xF00000CF, &iomux->gpr[4]); -+ /* set IPU AXI-id0 Qos=0xf(bypass) AXI-id1 Qos=0x7 */ -+ writel(0x007F007F, &iomux->gpr[6]); -+ writel(0x007F007F, &iomux->gpr[7]); -+} -+ -+void board_init_f(ulong dummy) -+{ -+ /* Set the stack pointer. */ -+ asm volatile("mov sp, %0\n" : : "r"(CONFIG_SPL_STACK)); -+ -+ spl_dram_init(); -+ ccgr_init(); -+ gpr_init(); -+ arch_cpu_init(); -+ -+ /* Clear the BSS. */ -+ memset(__bss_start, 0, __bss_end - __bss_start); -+ -+ /* Set global data pointer. */ -+ gd = &gdata; -+ gd->ram_size = CONFIG_DDR_MB * 1024 * 1024; /* both have 1 GB */; -+ -+ board_early_init_f(); -+ -+ timer_init(); -+ preloader_console_init(); -+ prefetch_enable(); -+ -+ board_init_r(NULL, 0); -+} -+ -+void spl_board_init(void) -+{ -+ return; /* nothing for now */ -+} -+ -+#ifdef CONFIG_SPL_OS_BOOT -+ -+int spl_start_uboot(void) -+{ -+ return 1; /* u-boot must be started */ -+} -+ -+#endif -+ -+u32 spl_boot_device(void) -+{ -+ printf("Boot Device: microSD card\n"); -+ return BOOT_DEVICE_MMC2; -+} -+ -+u32 spl_boot_mode(void) -+{ -+ return MMCSD_MODE; /* only microSD card */ -+} -+ -+void reset_cpu(ulong addr) -+{ -+ __REG16(WDOG1_BASE_ADDR) = 4; -+} -diff --git a/boards.cfg b/boards.cfg -index 9480005..64c0cee 100644 ---- a/boards.cfg -+++ b/boards.cfg -@@ -286,6 +286,9 @@ Active arm armv7 mx5 freescale mx53smd - Active arm armv7 mx5 genesi mx51_efikamx mx51_efikamx mx51_efikamx:MACH_TYPE=MACH_TYPE_MX51_EFIKAMX,IMX_CONFIG=board/genesi/mx51_efikamx/imximage_mx.cfg - - Active arm armv7 mx5 genesi mx51_efikamx mx51_efikasb mx51_efikamx:MACH_TYPE=MACH_TYPE_MX51_EFIKASB,IMX_CONFIG=board/genesi/mx51_efikamx/imximage_sb.cfg - - Active arm armv7 mx5 ttcontrol vision2 vision2 vision2:IMX_CONFIG=board/ttcontrol/vision2/imximage_hynix.cfg Stefano Babic <sbabic@denx.de> -+Active arm armv7 mx6 - udoo udoo udoo:IMX_CONFIG=board/udoo/udoo.cfg,MX6QDL,SPL,DDR_MB=1024 Fabio Estevam <fabio.estevam@freescale.com> -+Active arm armv7 mx6 - udoo udoo_dl udoo:IMX_CONFIG=board/udoo/udoo.cfg,MX6DL,DDR_MB=1024 Fabio Estevam <fabio.estevam@freescale.com> -+Active arm armv7 mx6 - udoo udoo_quad udoo:IMX_CONFIG=board/udoo/udoo.cfg,MX6Q,DDR_MB=1024 Fabio Estevam <fabio.estevam@freescale.com> - Active arm armv7 mx6 - wandboard wandboard_dl wandboard:IMX_CONFIG=board/boundary/nitrogen6x/nitrogen6dl.cfg,MX6DL,DDR_MB=1024 Fabio Estevam <fabio.estevam@freescale.com> - Active arm armv7 mx6 - wandboard wandboard_quad wandboard:IMX_CONFIG=board/boundary/nitrogen6x/nitrogen6q2g.cfg,MX6Q,DDR_MB=2048 Fabio Estevam <fabio.estevam@freescale.com> - Active arm armv7 mx6 - wandboard wandboard_solo wandboard:IMX_CONFIG=board/boundary/nitrogen6x/nitrogen6s.cfg,MX6S,DDR_MB=512 Fabio Estevam <fabio.estevam@freescale.com> -diff --git a/common/Makefile b/common/Makefile -index 97dd76e..27a1b36 100644 ---- a/common/Makefile -+++ b/common/Makefile -@@ -54,6 +54,7 @@ COBJS-$(CONFIG_ENV_IS_IN_UBI) += env_ubi.o - COBJS-$(CONFIG_ENV_IS_NOWHERE) += env_nowhere.o - - # command -+COBJS-$(CONFIG_CMD_MULTIBOOT) += cmd_multiboot.o - COBJS-$(CONFIG_CMD_AMBAPP) += cmd_ambapp.o - COBJS-$(CONFIG_SOURCE) += cmd_source.o - COBJS-$(CONFIG_CMD_SOURCE) += cmd_source.o -diff --git a/common/cmd_multiboot.c b/common/cmd_multiboot.c -new file mode 100644 -index 0000000..79df3d8 ---- /dev/null -+++ b/common/cmd_multiboot.c -@@ -0,0 +1,312 @@ -+/* -+ * Copyright 2000-2013 -+ * Giuseppe Pagano, Seco s.r.l., giuseppe.pagano@seco.com. -+ * -+ * SPDX-License-Identifier: GPL-2.0+ -+ */ -+ -+#include <common.h> -+#include <command.h> -+ -+#define DEF_bootargs_defaults "console=ttymxc1,115200 root=/dev/mmcblk0p${sd_part} rootwait rw fixrtc rootflags=barrier=1 fbmem=24M video=mxcfb0:dev=hdmi,1920x1080M@60,if=RGB24" -+#define DEF_bootcmd_defaults "plotmsg -u Booting from mmcblk0p${sd_part}. Please wait...; mmc dev 0; ext2load mmc 0:${sd_part} 0x10800000 /boot/uImage; bootm 0x10800000" -+ -+#define msleep(a) udelay(a * 1000) -+int default_boot = 1; -+ -+void do_show_environment(int ch, char *bootvars) { -+ char tempstr[500]; -+ char settempstr[500]; -+ char env_var_name[300]; -+ -+ sprintf(env_var_name, "%s_run_%d", bootvars, ch); -+ if (getenv(env_var_name) != NULL) { -+ strcpy (tempstr, getenv(env_var_name)); -+ printf(" %s\n", tempstr); -+ } else { -+ sprintf(env_var_name, "%s_%d", bootvars, ch); -+ if (getenv(env_var_name) != NULL) { -+ strcpy (tempstr, getenv(env_var_name)); -+ printf(" setenv %s '%s'\n", bootvars, tempstr); -+ } else { -+ sprintf(env_var_name, "sd_part_%d", ch); -+ if (getenv(env_var_name) != NULL) { -+ strcpy(tempstr, getenv(env_var_name)); -+ printf(" setenv sd_part '%s'\n", tempstr); -+ } else { -+ printf(" setenv sd_part '%d'\n", ch); -+ } -+ if (strcmp(bootvars, "bootargs") == 0) { -+ if (getenv("bootargs_defaults") != NULL) { -+ strcpy(tempstr, strdup(getenv("bootargs_defaults"))); -+ printf(" bootargs_defaults='%s'\n", tempstr); -+ } else { -+ strcpy(tempstr, DEF_bootargs_defaults); -+ } -+ sprintf(settempstr, " setenv bootargs '%s'\n", tempstr); -+ printf(settempstr); -+ } else { -+ if (getenv("bootcmd_defaults") != NULL) { -+ strcpy(tempstr, strdup(getenv("bootcmd_defaults"))); -+ printf(" bootcmd_defaults='%s'\n", tempstr); -+ } else { -+ strcpy(tempstr, DEF_bootcmd_defaults); -+ } -+ sprintf(settempstr, " setenv bootcmd '%s'\n", tempstr); -+ printf(settempstr); -+ } -+ } -+ } -+} -+ -+void do_detailed_environment(void) { -+ int counter = 1; -+ char *boot_descr; -+ char boot_descr_opt[300]; -+ -+ sprintf(boot_descr_opt, "boot_descr_1"); -+ printf ("\nShowing multiboot possible action.\n"); -+ -+ while (getenv(boot_descr_opt) != NULL) { -+ sprintf(boot_descr_opt, "boot_descr_%d", counter); -+ boot_descr = strdup(getenv(boot_descr_opt)); -+ if (getenv(boot_descr_opt) == NULL) { -+ break; -+ } -+ printf("%d) %s.\n", counter, boot_descr); -+ do_show_environment(counter, "bootargs"); -+ do_show_environment(counter, "bootcmd"); -+ printf(" boot\n"); -+ counter++; -+ } -+ return; -+} -+ -+int show_multioption(void) { -+ int counter = 1; -+ char *boot_descr; -+ char boot_descr_opt[300]; -+ char *default_boot_str; -+ -+ sprintf(boot_descr_opt, "boot_descr_1"); -+ printf ("Chose system you want to boot.\n"); -+ -+ if (getenv("default_boot") != NULL) { -+ default_boot_str = strdup(getenv("default_boot")); -+ default_boot = default_boot_str[0] - '0'; -+ } -+ -+ while (getenv(boot_descr_opt) != NULL) { -+ sprintf(boot_descr_opt, "boot_descr_%d", counter); -+ boot_descr = strdup(getenv(boot_descr_opt)); -+ if (getenv(boot_descr_opt) == NULL) { -+ printf(" p) Show what would be done.\n"); -+ printf(" q) Quit.\n"); -+ break; -+ } -+ if (counter == default_boot) -+ printf("> %d) %s.\n", counter, boot_descr); -+ else -+ printf(" %d) %s.\n", counter, boot_descr); -+ counter++; -+ } -+ if ((counter > 1) && (default_boot >= counter)) { -+ printf("Warn ! Invalid default_boot value: ->%c<- (non numeric or not existing entry).\n", default_boot_str[0]); -+ default_boot = 1; -+ } -+ printf (" > "); -+ return --counter; -+} -+ -+int do_detailed_help(void) { -+ -+ printf("\n\tHow to setup u-boot environment for multiboot utility.\n"); -+ -+ printf("\nStep 1) Define as much \"boot_descr_X\" variable as you need assigning to it\n"); -+ printf("\ta title rapresenting bootable system number X. \n"); -+ printf("\t(Eg. \"setenv boot_descr_1 Linux\").\n"); -+ -+ printf("\nStep 2) Define default booting entry via \"default_boot\" variable.\n"); -+ printf("\t(Eg. \"setenv default_boot 2\").\n"); -+ -+ printf("\nStep 3) For each configured bootable system there are 3 levels of variable\n"); -+ printf("\tdefinitions which override each other in the following order:\n"); -+ printf("\t \"bootargs_run_X\" OVERRIDES \"bootargs_X\" OVERRIDES \"sd_part_X\"\n"); -+ printf("\t \"bootcmd_run_X\" OVERRIDES \"bootcmd_X\" OVERRIDES \"sd_part_X\"\n"); -+ printf("\tIf one of the described variable is missing the next one will be used.\n"); -+ -+ printf("\nHere the meaning of multiboot configuration variable:\n"); -+ -+ printf(" - bootargs_run_X (where X can be 1, 2, 3, ...)\n"); -+ printf(" String contained in \"bootargs_run_X\" will be executed inside multiboot\n"); -+ printf(" environment with the following command: \"run bootargs_run_X\".\n"); -+ -+ printf(" - bootargs_X (where X can be 1, 2, 3, ...)\n"); -+ printf(" String contained in \"bootargs_X\" will be adopted as bootargs environment.\n"); -+ -+ printf(" - sd_part_X (where X can be 1, 2, 3, ...)\n"); -+ printf(" uSD partition number \"sd_part_X\" to be used as root device filesystem.\n"); -+ -+ printf(" - bootargs_defaults\n"); -+ printf(" Current value for bootargs_defaults is:\n"); -+ if (getenv("bootargs_defaults") != NULL) -+ printf(" bootargs_defaults='%s'\n", getenv("bootargs_defaults")); -+ else -+ printf(" bootargs_defaults='%s'\n", DEF_bootargs_defaults); -+ printf("\n"); -+ -+ printf(" - bootcmd_run_X (where X can be 1, 2, 3, ...)\n"); -+ printf(" String contained in \"bootcmd_run_X\" will be executed inside multiboot\n"); -+ printf(" environment with the following command: \"run bootcmd_run_X\".\n"); -+ -+ printf(" - bootcmd_X (where X can be 1, 2, 3, ...)\n"); -+ printf(" String contained in \"bootcmd_X\" will be used as bootcmd environment.\n"); -+ -+ printf(" - sd_part_X (where X can be 1, 2, 3, ...)\n"); -+ printf(" uSD partition number \"sd_part_X\" will be used to load uImage from.\n"); -+ -+ printf(" - bootcmd_default\n"); -+ printf(" Current value for bootcmd_default is:\n"); -+ if (getenv("bootcmd_defaults") != NULL) -+ printf(" bootcmd_defaults='%s'\n", getenv("bootcmd_defaults")); -+ else -+ printf(" bootcmd_defaults='%s'\n", DEF_bootcmd_defaults); -+ printf("\n"); -+ -+ -+ printf("If your system need multiboot customized environment it will be necessary to\n"); -+ printf("define some boot*_X variable or change \"bootargs_defaults\" and \"bootcmd_default\".\n"); -+ printf("When no variable is defined, multiboot will use /dev/sda1 for system 1,\n"); -+ printf("use /dev/sda2 for system 2, /dev/sda3 for system 3, and so on.\n"); -+ -+ return 0; -+} -+ -+void do_set_environment(char ch, char *bootvars) { -+ char tempstr[500]; -+ char settempstr[500]; -+ char env_var_name[300]; -+ -+ sprintf(env_var_name, "%s_run_%c", bootvars, ch); -+ if (getenv(env_var_name) != NULL) { -+ strcpy (tempstr, getenv(env_var_name)); -+ run_command(tempstr, 0); -+ } else { -+ sprintf(env_var_name, "%s_%c", bootvars, ch); -+ if (getenv(env_var_name) != NULL) { -+ strcpy (tempstr, getenv(env_var_name)); -+ setenv(bootvars, tempstr); -+ } else { -+ sprintf(env_var_name, "sd_part_%c", ch); -+ if (getenv(env_var_name) != NULL) { -+ strcpy(tempstr, getenv(env_var_name)); -+ setenv("sd_part", tempstr); -+ } else { -+ setenv("sd_part", ch); -+ } -+ if (strcmp(bootvars, "bootargs") == 0) { -+ if (getenv("bootargs_defaults") != NULL) { -+ strcpy(tempstr, strdup(getenv("bootargs_defaults"))); -+ } else { -+ strcpy(tempstr, DEF_bootargs_defaults); -+ } -+ sprintf(settempstr, "setenv bootargs %s", tempstr); -+ run_command(settempstr, 0); -+ } else { -+ if (getenv("bootcmd_defaults") != NULL) { -+ strcpy(tempstr, strdup(getenv("bootcmd_defaults"))); -+ } else { -+ strcpy(tempstr, DEF_bootcmd_defaults); -+ } -+ sprintf(settempstr, "setenv bootcmd %s", tempstr); -+ run_command(settempstr, 0); -+ } -+ } -+ } -+ return; -+} -+ -+void do_chooseboot(int sec) { -+ int timeout; -+ int first_round = 0; -+ int num_of_possibility; -+ char n[1]; -+ char ch; -+ -+ do { -+ if (first_round > 0) -+ printf ("\nInvalid option. Valid choice are from 1 to %d.\n", num_of_possibility); -+ num_of_possibility = show_multioption(); -+ sprintf(n, "%d", num_of_possibility); -+ ch = (char)(((int)'0') + default_boot); -+ -+ if (num_of_possibility == 0) { -+ printf("No bootable system defined: \"boot_descr_1\" is empty! \n Giving up.\n"); -+ return; -+ } -+ -+ if ( sec == 99 ) { -+ ch = getc(); -+ printf("%c\n", ch); -+ } else { -+ timeout = sec * 10; -+ while (timeout > 0) { -+ if (tstc()) { -+ ch = getc(); -+ printf("%c\n", ch); -+ break; -+ } -+ msleep(100); -+ timeout--; -+ } -+ } -+ -+ if (ch == 'q') -+ return; -+ -+ if (ch == 'p') { -+ sec = 99; -+ do_detailed_environment(); -+ } -+ first_round = 1; -+ } while ((ch < '1') || (ch > n[0])); -+ -+ do_set_environment(ch, "bootargs"); -+ do_set_environment(ch, "bootcmd"); -+ -+ run_command("boot", 0); -+} -+ -+static int do_multiboot(cmd_tbl_t *cmd, int flag, int argc, char * const argv[]) -+{ -+ int sec = 5; -+ -+ if (argc > 2) -+ return cmd_usage(cmd); -+ -+ if (argc == 2 && ((strcmp(argv[1], "help") == 0) || strcmp(argv[1], "h") == 0)) { -+ return cmd_usage(cmd); -+ } -+ -+ if (argc == 2 && (strcmp(argv[1], "d") == 0)) { -+ return do_detailed_help(); -+ } -+ -+ if (argc == 2 && ((argv[1] >= '0') || (argv[1] <= '9'))) -+ sec = argv[1][0] - '0'; -+ -+ if (argc == 2 && (strcmp(argv[1], "W") == 0)) -+ sec = 99; -+ -+ printf ("\nUDOO interactive multiboot utility.\n"); -+ -+ do_chooseboot(sec); -+ return 0; -+} -+ -+U_BOOT_CMD( -+ multiboot, CONFIG_SYS_MAXARGS, 1, do_multiboot, -+ "manage a multiboot startup", -+ "[args..]\n" -+ " - d Print detailed help.\n - [0-9, W] Seconds before default entry (if empty 5 sec). W = Wait forever" -+); -diff --git a/drivers/video/cfb_console.c b/drivers/video/cfb_console.c -index c6f58c2..9293e8d 100644 ---- a/drivers/video/cfb_console.c -+++ b/drivers/video/cfb_console.c -@@ -2036,7 +2036,11 @@ static void *video_logo(void) - if (board_cfb_skip()) - return 0; - -+#ifndef MACH_TYPE_UDOO - sprintf(info, " %s", version_string); -+#else -+ sprintf(info, " %s", BOARD_INFO_STRING); -+#endif - - space = (VIDEO_LINE_LEN / 2 - VIDEO_INFO_X) / VIDEO_FONT_WIDTH; - len = strlen(info); -@@ -2219,6 +2223,14 @@ static int video_init(void) - return 0; - } - -+void udoo_video_drawstring(int xx, int yy, unsigned char *s) -+{ -+ video_drawstring(xx, yy, s); -+ if (cfb_do_flush_cache) -+ flush_cache(VIDEO_FB_ADRS, VIDEO_SIZE); -+ return; -+} -+ - /* - * Implement a weak default function for boards that optionally - * need to skip the video initialization. -diff --git a/include/configs/udoo.h b/include/configs/udoo.h -new file mode 100644 -index 0000000..6d2c1b1 ---- /dev/null -+++ b/include/configs/udoo.h -@@ -0,0 +1,302 @@ -+/* -+ * Copyright (C) 2013 Freescale Semiconductor, Inc. -+ * -+ * Configuration settings for UDOO board. -+ * -+ * SPDX-License-Identifier: GPL-2.0+ -+ */ -+ -+#ifndef __CONFIG_H -+#define __CONFIG_H -+ -+#include "mx6_common.h" -+#include <asm/arch/imx-regs.h> -+#include <asm/imx-common/gpio.h> -+#include <asm/sizes.h> -+ -+#ifdef CONFIG_SPL -+#include "imx6_spl.h" -+#define CONFIG_SPL_MMC_SUPPORT -+#define CONFIG_SPL_FAT_SUPPORT -+#endif -+ -+#define CONFIG_MX6 -+#define CONFIG_DISPLAY_CPUINFO -+#define CONFIG_DISPLAY_BOARDINFO -+ -+#define MACH_TYPE_UDOO 4800 -+#define CONFIG_MACH_TYPE MACH_TYPE_UDOO -+ -+#define CONFIG_CMDLINE_TAG -+#define CONFIG_SETUP_MEMORY_TAGS -+#define CONFIG_INITRD_TAG -+#define CONFIG_REVISION_TAG -+ -+/* disable L2 cache support */ -+#define CONFIG_SYS_L2CACHE_OFF -+ -+/* Size of malloc() pool */ -+#define CONFIG_SYS_MALLOC_LEN (10 * SZ_1M) -+ -+#define CONFIG_BOARD_EARLY_INIT_F -+#define CONFIG_BOARD_LATE_INIT -+#define CONFIG_MXC_GPIO -+ -+#define CONFIG_MXC_UART -+#define CONFIG_MXC_UART_BASE UART2_BASE -+ -+/* SATA Configs */ -+ -+#if defined(CONFIG_MX6Q) -+#define CONFIG_CMD_SATA -+#endif -+#ifdef CONFIG_CMD_SATA -+#define CONFIG_DWC_AHSATA -+#define CONFIG_SYS_SATA_MAX_DEVICE 1 -+#define CONFIG_DWC_AHSATA_PORT_ID 0 -+#define CONFIG_DWC_AHSATA_BASE_ADDR SATA_ARB_BASE_ADDR -+#define CONFIG_LBA48 -+#define CONFIG_LIBATA -+#endif -+ -+/* Network support */ -+ -+#define CONFIG_CMD_PING -+#define CONFIG_CMD_DHCP -+#define CONFIG_CMD_MII -+#define CONFIG_CMD_NET -+#define CONFIG_FEC_MXC -+#define CONFIG_MII -+#define IMX_FEC_BASE ENET_BASE_ADDR -+#define CONFIG_FEC_XCV_TYPE RGMII -+#define CONFIG_ETHPRIME "FEC" -+#define CONFIG_FEC_MXC_PHYADDR 6 -+#define CONFIG_PHYLIB -+#define CONFIG_PHY_MICREL -+#define CONFIG_PHY_MICREL_KSZ9031 -+ -+/* allow to overwrite serial and ethaddr */ -+#define CONFIG_ENV_OVERWRITE -+#define CONFIG_CONS_INDEX 1 -+#define CONFIG_BAUDRATE 115200 -+ -+/* HDMI or LVDS Display Configuration */ -+#define CONFIG_VIDEO_ENABLED -+#ifdef CONFIG_VIDEO_ENABLED -+#define CONFIG_VIDEO -+#define CONFIG_VIDEO_IPUV3 -+#define CONFIG_CFB_CONSOLE -+#define CONFIG_VGA_AS_SINGLE_DEVICE -+#define CONFIG_SYS_CONSOLE_IS_IN_ENV -+#define CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE -+#define CONFIG_VIDEO_BMP_RLE8 -+#define CONFIG_SPLASH_SCREEN -+#define CONFIG_SPLASH_SCREEN_ALIGN -+#define CONFIG_BMP_16BPP -+#define CONFIG_VIDEO_LOGO -+#define CONFIG_VIDEO_BMP_LOGO -+#define CONFIG_IPUV3_CLK 260000000 -+#define CONFIG_CONSOLE_MUX -+#define CONFIG_CMD_HDMIDETECT -+#define CONFIG_CMD_PLOTMSG -+#define CONFIG_IMX_HDMI -+#define BOARD_INFO_STRING "u-boot-imx-2013-10 on:" -+#endif -+ -+/* Command definition */ -+#include <config_cmd_default.h> -+ -+#undef CONFIG_CMD_IMLS -+ -+#define CONFIG_CMD_MULTIBOOT -+#define CONFIG_CMD_BMODE -+#define CONFIG_CMD_SETEXPR -+ -+#define CONFIG_BOOTDELAY 1 -+ -+#define CONFIG_SYS_MEMTEST_START 0x10000000 -+#define CONFIG_SYS_MEMTEST_END (CONFIG_SYS_MEMTEST_START + 500 * SZ_1M) -+#define CONFIG_LOADADDR 0x12000000 -+#define CONFIG_SYS_TEXT_BASE 0x17800000 -+ -+/* MMC Configuration */ -+#define CONFIG_FSL_ESDHC -+#define CONFIG_FSL_USDHC -+#define CONFIG_SYS_FSL_ESDHC_ADDR 0 -+ -+#define CONFIG_MMC -+#define CONFIG_CMD_MMC -+#define CONFIG_GENERIC_MMC -+#define CONFIG_BOUNCE_BUFFER -+#define CONFIG_CMD_EXT2 -+#define CONFIG_CMD_FAT -+#define CONFIG_CMD_EXT4 -+#define CONFIG_CMD_FS_GENERIC -+#define CONFIG_DOS_PARTITION -+ -+#define CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG -+ -+#define CONFIG_EXTRA_ENV_SETTINGS \ -+ "zImage=KERNEL\0" \ -+ "script=boot.scr\0" \ -+ "image=${zImage}\0" \ -+ "console=ttymxc1\0" \ -+ "splashpos=m,m\0" \ -+ "fdt_high=0xffffffff\0" \ -+ "initrd_high=0xffffffff\0" \ -+ "fdt_file=undefined\0" \ -+ "fdt_addr=0x18000000\0" \ -+ "boot_fdt=try\0" \ -+ "ip_dyn=yes\0" \ -+ "optargs=\0" \ -+ "video=\0" \ -+ "mmcdev=0\0" \ -+ "mmcpart=1\0" \ -+ "mmcroot=/dev/mmcblk0p2 ro\0" \ -+ "mmcrootfstype=ext4 rootwait\0" \ -+ "update_sd_firmware_filename=u-boot.imx\0" \ -+ "update_sd_firmware=" \ -+ "if test ${ip_dyn} = yes; then " \ -+ "setenv get_cmd dhcp; " \ -+ "else " \ -+ "setenv get_cmd tftp; " \ -+ "fi; " \ -+ "if mmc dev ${mmcdev}; then " \ -+ "if ${get_cmd} ${update_sd_firmware_filename}; then " \ -+ "setexpr fw_sz ${filesize} / 0x200; " \ -+ "setexpr fw_sz ${fw_sz} + 1; " \ -+ "mmc write ${loadaddr} 0x2 ${fw_sz}; " \ -+ "fi; " \ -+ "fi\0" \ -+ "mmcargs=setenv bootargs console=${console},${baudrate} " \ -+ "${optargs} " \ -+ "root=${mmcroot} " \ -+ "rootfstype=${mmcrootfstype} " \ -+ "video=${video}\0" \ -+ "loadbootenv=load mmc ${mmcdev}:${mmcpart} ${loadaddr} uEnv.txt\0" \ -+ "importbootenv=echo Importing environment from mmc (uEnv.txt)...; " \ -+ "env import -t $loadaddr $filesize\0" \ -+ "loadbootscript=" \ -+ "fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \ -+ "bootscript=echo Running bootscript from mmc ...; " \ -+ "source\0" \ -+ "loadimage=load mmc ${mmcdev}:${mmcpart} ${loadaddr} ${zImage}\0" \ -+ "loadzimage=load mmc ${mmcdev}:${mmcpart} ${loadaddr} ${zImage}\0" \ -+ "loadfdt=load mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \ -+ "mmcboot=echo Booting from mmc ...; " \ -+ "run mmcargs; " \ -+ "bootz ${loadaddr} - ${fdt_addr};\0" \ -+ "mmcbootdefault=echo Booting from mmc ...; " \ -+ "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \ -+ "if run loadfdt; then " \ -+ "bootz ${loadaddr} - ${fdt_addr}; " \ -+ "else " \ -+ "if test ${boot_fdt} = try; then " \ -+ "bootz ${loadaddr}; " \ -+ "else " \ -+ "echo WARN: Cannot load the DT; " \ -+ "fi; " \ -+ "fi; " \ -+ "else " \ -+ "bootz ${loadaddr}; " \ -+ "fi;\0" \ -+ "netargs=setenv bootargs console=${console},${baudrate} " \ -+ "root=/dev/nfs " \ -+ "ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0" \ -+ "netboot=echo Booting from net ...; " \ -+ "run netargs; " \ -+ "if test ${ip_dyn} = yes; then " \ -+ "setenv get_cmd dhcp; " \ -+ "else " \ -+ "setenv get_cmd tftp; " \ -+ "fi; " \ -+ "${get_cmd} ${image}; " \ -+ "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \ -+ "if ${get_cmd} ${fdt_addr} ${fdt_file}; then " \ -+ "bootz ${loadaddr} - ${fdt_addr}; " \ -+ "else " \ -+ "if test ${boot_fdt} = try; then " \ -+ "bootz; " \ -+ "else " \ -+ "echo WARN: Cannot load the DT; " \ -+ "fi; " \ -+ "fi; " \ -+ "else " \ -+ "bootz; " \ -+ "fi;\0" \ -+ "findfdt=" \ -+ "if test $board_rev = MX6Q ; then " \ -+ "setenv fdt_file imx6q-udoo.dtb; fi; " \ -+ "if test $board_rev = MX6DL ; then " \ -+ "setenv fdt_file imx6dl-udoo.dtb; fi; " \ -+ "if test $fdt_file = undefined; then " \ -+ "echo WARNING: Could not determine dtb to use; fi; \0" -+ -+#define CONFIG_BOOTCOMMAND \ -+ "run findfdt; " \ -+ "mmc dev ${mmcdev};" \ -+ "if mmc rescan; then " \ -+ "echo SD/MMC found on device ${mmcdev};" \ -+ "if run loadbootenv; then " \ -+ "run importbootenv;" \ -+ "fi;" \ -+ "echo Checking if uenvcmd is set ...;" \ -+ "if test -n $uenvcmd; then " \ -+ "echo Running uenvcmd ...;" \ -+ "run uenvcmd;" \ -+ "fi;" \ -+ "echo Running default loadimage ...;" \ -+ "if run loadimage; then " \ -+ "run loadfdt;" \ -+ "run mmcboot;" \ -+ "fi;" \ -+ "fi;" -+ -+/* Miscellaneous configurable options */ -+#define CONFIG_SYS_LONGHELP -+#define CONFIG_SYS_HUSH_PARSER -+#define CONFIG_SYS_PROMPT "UDOO board => " -+#define CONFIG_AUTO_COMPLETE -+#define CONFIG_SYS_CBSIZE 256 -+ -+/* Print Buffer Size */ -+#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16) -+#define CONFIG_SYS_MAXARGS 16 -+#define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE -+ -+#define CONFIG_SYS_LOAD_ADDR CONFIG_LOADADDR -+#define CONFIG_SYS_HZ 1000 -+ -+#define CONFIG_CMDLINE_EDITING -+ -+/* Physical Memory Map */ -+#define ONEGIGA 1 -+#define CONFIG_NR_DRAM_BANKS 1 -+#define PHYS_SDRAM MMDC0_ARB_BASE_ADDR -+ -+#define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM -+#define CONFIG_SYS_INIT_RAM_ADDR IRAM_BASE_ADDR -+#define CONFIG_SYS_INIT_RAM_SIZE IRAM_SIZE -+ -+#define CONFIG_SYS_INIT_SP_OFFSET \ -+ (CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE) -+#define CONFIG_SYS_INIT_SP_ADDR \ -+ (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET) -+ -+/* FLASH and environment organization */ -+#define CONFIG_SYS_NO_FLASH -+ -+#define CONFIG_ENV_SIZE (8 * 1024) -+ -+#define CONFIG_ENV_IS_IN_MMC -+#define CONFIG_ENV_OFFSET (6 * 128 * 1024) // 0x000C0000 -+#define CONFIG_SYS_MMC_ENV_DEV 0 -+ -+#define CONFIG_OF_LIBFDT -+#define CONFIG_CMD_BOOTZ -+ -+#ifndef CONFIG_SYS_DCACHE_OFF -+#define CONFIG_CMD_CACHE -+#endif -+ -+#endif /* __CONFIG_H * */ -diff --git a/include/micrel.h b/include/micrel.h -index e1c62d8..1d72b50 100644 ---- a/include/micrel.h -+++ b/include/micrel.h -@@ -15,6 +15,11 @@ - #define MII_KSZ9031_MOD_DATA_POST_INC_RW 0x8000 - #define MII_KSZ9031_MOD_DATA_POST_INC_W 0xC000 - -+#define MII_KSZ9031_EXT_RGMII_CTRL_SIG_SKEW 0x4 -+#define MII_KSZ9031_EXT_RGMII_RX_DATA_SKEW 0x5 -+#define MII_KSZ9031_EXT_RGMII_TX_DATA_SKEW 0x6 -+#define MII_KSZ9031_EXT_RGMII_CLOCK_SKEW 0x8 -+ - struct phy_device; - int ksz9021_phy_extended_write(struct phy_device *phydev, int regnum, u16 val); - int ksz9021_phy_extended_read(struct phy_device *phydev, int regnum); -diff --git a/include/video.h b/include/video.h -index 0ff857b..0f9a56f 100644 ---- a/include/video.h -+++ b/include/video.h -@@ -14,6 +14,8 @@ - int video_init (void *videobase); - void video_putc (const char c); - void video_puts (const char *s); -+void udoo_video_drawstring(int xx, int yy, unsigned char *s); -+ - - /** - * Display a BMP format bitmap on the screen --- -1.8.1.2 - diff --git a/projects/imx6/patches/u-boot/103-udoo_disable_lvds.patch b/projects/imx6/patches/u-boot/103-udoo_disable_lvds.patch deleted file mode 100644 index efdc0fd6307..00000000000 --- a/projects/imx6/patches/u-boot/103-udoo_disable_lvds.patch +++ /dev/null @@ -1,26 +0,0 @@ -diff -aurN a/arch/arm/cpu/armv7/cpu.c b/arch/arm/cpu/armv7/cpu.c ---- a/arch/arm/cpu/armv7/cpu.c 2015-05-31 21:32:52.821314218 +0200 -+++ b/arch/arm/cpu/armv7/cpu.c 2015-05-31 21:27:12.292623257 +0200 -@@ -77,7 +77,7 @@ - cpu_cache_initialization(); - - #if (defined(MACH_TYPE_UDOO) || defined(CONFIG_VIDEO_ENABLED)) -- do_disable_lvds(); -+ /*do_disable_lvds();*/ - #endif - - return 0; -diff -aurN u-boot-imx6-144b1e9/board/udoo/udoo.c a-u/board/udoo/udoo.c ---- u-boot-imx6-144b1e9/board/udoo/udoo.c 2015-05-31 21:32:52.821314218 +0200 -+++ a-u/board/udoo/udoo.c 2015-05-31 21:36:41.524566717 +0200 -@@ -260,8 +260,8 @@ - static void do_enable_lvds(struct display_info_t const *dev) - { - SETUP_IOMUX_PADS(lvds_pads); -- gpio_direction_output(IMX_GPIO_NR(1, 2), 1); /* LVDS power On */ -- gpio_direction_output(IMX_GPIO_NR(1, 4), 1); /* LVDS backlight On */ -+ /*gpio_direction_output(IMX_GPIO_NR(1, 2), 1);*/ /* LVDS power On */ -+ /*gpio_direction_output(IMX_GPIO_NR(1, 4), 1);*/ /* LVDS backlight On */ - return; - } - \ No newline at end of file diff --git a/scripts/build b/scripts/build index bbbdc0847a4..78579c48563 100755 --- a/scripts/build +++ b/scripts/build @@ -352,8 +352,18 @@ if [ ! -f $STAMP ]; then find $INSTALL -type d -exec rmdir -p "{}" ";" 2>/dev/null || true if [ ! "$DEBUG" = yes ]; then - $STRIP `find $INSTALL -name "*.so" 2>/dev/null` 2>/dev/null || : - $STRIP `find $INSTALL -name "*.so.[0-9]*" 2>/dev/null` 2>/dev/null || : + $STRIP `find $INSTALL \ + -type f -name "*.so*" \ + ! -name "ld-*.so" \ + ! -name "libc-*.so" \ + ! -name "libpthread-*.so" \ + ! -name "libthread_db-*so" \ + 2>/dev/null` 2>/dev/null || : + if [ "$TARGET" = "init" ]; then + $STRIP `find $INSTALL -type f -name "*.so*" 2>/dev/null` 2>/dev/null || : + fi + $STRIP `find $INSTALL/bin $INSTALL/usr/bin $INSTALL/sbin $INSTALL/usr/sbin \ + -type f -executable 2>/dev/null` 2>/dev/null || : fi fi fi diff --git a/scripts/checkdeps b/scripts/checkdeps index b8dbf964fbd..b3374020e90 100755 --- a/scripts/checkdeps +++ b/scripts/checkdeps @@ -51,6 +51,11 @@ case "$DISTRO" in deps="$deps g++ mkfontscale mkfontdir bdftopcf xsltproc java" deps_pkg="$deps_pkg g++ xorg-mkfontscale xorg-mkfontdir xorg-bdftopcf libxslt java-runtime-common" ;; + opensuse) + deps="$deps g++ mkfontscale mkfontdir bdftopcf xsltproc java" + deps_pkg="$deps_pkg gcc-c++ mkfontscale mkfontdir bdftopcf libxslt-tools java-1_8_0-openjdk" + [[ ! `rpm -qa glibc-devel-static` ]] && deps="$deps glibc-devel-static" && deps_pkg="$deps_pkg glibc-devel-static" + ;; *) deps="$deps g++ mkfontscale mkfontdir bdftopcf xsltproc java" deps_pkg="$deps_pkg g++ xfonts-utils xfonts-utils xfonts-utils xsltproc default-jre" @@ -108,6 +113,10 @@ if [ -n "$need" ]; then read -p "would you like to install the needed tools ? (y/n) " ans [ "$ans" = "y" ] && sudo pacman -Sy $need_pkg ;; + opensuse) + read -p "would you like to install the needed tools ? (y/n) " ans + [ "$ans" = "y" ] && sudo zypper install -y --no-recommends $need_pkg + ;; *) echo "**** unsupported distro $DISTRO ****" exit 1 diff --git a/scripts/clean b/scripts/clean index 954a7003254..e8170d30251 100755 --- a/scripts/clean +++ b/scripts/clean @@ -20,7 +20,7 @@ . config/options $1 -if [ ! -z "$1" ]; then +clean_package() { printf "%${BUILD_INDENT}c ${boldred}CLEAN${endcolor} $1\n" ' '>&$SILENT_OUT export BUILD_INDENT=$((${BUILD_INDENT:-1}+$BUILD_INDENT_SIZE)) @@ -43,4 +43,23 @@ if [ ! -z "$1" ]; then fi done rm -f $STAMPS/$1/build_* +} + +if [ "$1" = "--all" ]; then + if [ ! -z "$2" ]; then + for PROJECT in $(ls -1 projects); do + for archfile in projects/$PROJECT/linux/linux.*.conf; do + if [ ! -f "$archfile" ]; then + archfile="$(ls -1 projects/$PROJECT/linux/*/linux.*.conf | head -1)" + fi + ARCH=`echo $archfile | sed -n '$s/\.conf//;$s/.*\.//p'` + PROJECT=$PROJECT ARCH=$ARCH ./scripts/clean $2 + done + done + fi +else + if [ ! -z "$1" ]; then + clean_package $1 + fi fi + diff --git a/scripts/configtools/README b/scripts/configtools/README deleted file mode 100644 index 6ab86fe60d9..00000000000 --- a/scripts/configtools/README +++ /dev/null @@ -1,2 +0,0 @@ -URL: http://git.savannah.gnu.org/cgit/config.git - diff --git a/scripts/configtools/config.guess b/scripts/configtools/config.guess deleted file mode 100755 index 9afd6762064..00000000000 --- a/scripts/configtools/config.guess +++ /dev/null @@ -1,1568 +0,0 @@ -#! /bin/sh -# Attempt to guess a canonical system name. -# Copyright 1992-2013 Free Software Foundation, Inc. - -timestamp='2013-11-29' - -# This file is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, see <http://www.gnu.org/licenses/>. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that -# program. This Exception is an additional permission under section 7 -# of the GNU General Public License, version 3 ("GPLv3"). -# -# Originally written by Per Bothner. -# -# You can get the latest version of this script from: -# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD -# -# Please send patches with a ChangeLog entry to config-patches@gnu.org. - - -me=`echo "$0" | sed -e 's,.*/,,'` - -usage="\ -Usage: $0 [OPTION] - -Output the configuration name of the system \`$me' is run on. - -Operation modes: - -h, --help print this help, then exit - -t, --time-stamp print date of last modification, then exit - -v, --version print version number, then exit - -Report bugs and patches to <config-patches@gnu.org>." - -version="\ -GNU config.guess ($timestamp) - -Originally written by Per Bothner. -Copyright 1992-2013 Free Software Foundation, Inc. - -This is free software; see the source for copying conditions. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - -help=" -Try \`$me --help' for more information." - -# Parse command line -while test $# -gt 0 ; do - case $1 in - --time-stamp | --time* | -t ) - echo "$timestamp" ; exit ;; - --version | -v ) - echo "$version" ; exit ;; - --help | --h* | -h ) - echo "$usage"; exit ;; - -- ) # Stop option processing - shift; break ;; - - ) # Use stdin as input. - break ;; - -* ) - echo "$me: invalid option $1$help" >&2 - exit 1 ;; - * ) - break ;; - esac -done - -if test $# != 0; then - echo "$me: too many arguments$help" >&2 - exit 1 -fi - -trap 'exit 1' 1 2 15 - -# CC_FOR_BUILD -- compiler used by this script. Note that the use of a -# compiler to aid in system detection is discouraged as it requires -# temporary files to be created and, as you can see below, it is a -# headache to deal with in a portable fashion. - -# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still -# use `HOST_CC' if defined, but it is deprecated. - -# Portable tmp directory creation inspired by the Autoconf team. - -set_cc_for_build=' -trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; -trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; -: ${TMPDIR=/tmp} ; - { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || - { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || - { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || - { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; -dummy=$tmp/dummy ; -tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; -case $CC_FOR_BUILD,$HOST_CC,$CC in - ,,) echo "int x;" > $dummy.c ; - for c in cc gcc c89 c99 ; do - if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then - CC_FOR_BUILD="$c"; break ; - fi ; - done ; - if test x"$CC_FOR_BUILD" = x ; then - CC_FOR_BUILD=no_compiler_found ; - fi - ;; - ,,*) CC_FOR_BUILD=$CC ;; - ,*,*) CC_FOR_BUILD=$HOST_CC ;; -esac ; set_cc_for_build= ;' - -# This is needed to find uname on a Pyramid OSx when run in the BSD universe. -# (ghazi@noc.rutgers.edu 1994-08-24) -if (test -f /.attbin/uname) >/dev/null 2>&1 ; then - PATH=$PATH:/.attbin ; export PATH -fi - -UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown -UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown -UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown -UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown - -case "${UNAME_SYSTEM}" in -Linux|GNU|GNU/*) - # If the system lacks a compiler, then just pick glibc. - # We could probably try harder. - LIBC=gnu - - eval $set_cc_for_build - cat <<-EOF > $dummy.c - #include <features.h> - #if defined(__UCLIBC__) - LIBC=uclibc - #elif defined(__dietlibc__) - LIBC=dietlibc - #else - LIBC=gnu - #endif - EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` - ;; -esac - -# Note: order is significant - the case branches are not exclusive. - -case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in - *:NetBSD:*:*) - # NetBSD (nbsd) targets should (where applicable) match one or - # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, - # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently - # switched to ELF, *-*-netbsd* would select the old - # object file format. This provides both forward - # compatibility and a consistent mechanism for selecting the - # object file format. - # - # Note: NetBSD doesn't particularly care about the vendor - # portion of the name. We always set it to "unknown". - sysctl="sysctl -n hw.machine_arch" - UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ - /usr/sbin/$sysctl 2>/dev/null || echo unknown)` - case "${UNAME_MACHINE_ARCH}" in - armeb) machine=armeb-unknown ;; - arm*) machine=arm-unknown ;; - sh3el) machine=shl-unknown ;; - sh3eb) machine=sh-unknown ;; - sh5el) machine=sh5le-unknown ;; - *) machine=${UNAME_MACHINE_ARCH}-unknown ;; - esac - # The Operating System including object format, if it has switched - # to ELF recently, or will in the future. - case "${UNAME_MACHINE_ARCH}" in - arm*|i386|m68k|ns32k|sh3*|sparc|vax) - eval $set_cc_for_build - if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep -q __ELF__ - then - # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). - # Return netbsd for either. FIX? - os=netbsd - else - os=netbsdelf - fi - ;; - *) - os=netbsd - ;; - esac - # The OS release - # Debian GNU/NetBSD machines have a different userland, and - # thus, need a distinct triplet. However, they do not need - # kernel version information, so it can be replaced with a - # suitable tag, in the style of linux-gnu. - case "${UNAME_VERSION}" in - Debian*) - release='-gnu' - ;; - *) - release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` - ;; - esac - # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: - # contains redundant information, the shorter form: - # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. - echo "${machine}-${os}${release}" - exit ;; - *:Bitrig:*:*) - UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` - echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE} - exit ;; - *:OpenBSD:*:*) - UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` - echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} - exit ;; - *:ekkoBSD:*:*) - echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} - exit ;; - *:SolidBSD:*:*) - echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} - exit ;; - macppc:MirBSD:*:*) - echo powerpc-unknown-mirbsd${UNAME_RELEASE} - exit ;; - *:MirBSD:*:*) - echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} - exit ;; - alpha:OSF1:*:*) - case $UNAME_RELEASE in - *4.0) - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` - ;; - *5.*) - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` - ;; - esac - # According to Compaq, /usr/sbin/psrinfo has been available on - # OSF/1 and Tru64 systems produced since 1995. I hope that - # covers most systems running today. This code pipes the CPU - # types through head -n 1, so we only detect the type of CPU 0. - ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` - case "$ALPHA_CPU_TYPE" in - "EV4 (21064)") - UNAME_MACHINE="alpha" ;; - "EV4.5 (21064)") - UNAME_MACHINE="alpha" ;; - "LCA4 (21066/21068)") - UNAME_MACHINE="alpha" ;; - "EV5 (21164)") - UNAME_MACHINE="alphaev5" ;; - "EV5.6 (21164A)") - UNAME_MACHINE="alphaev56" ;; - "EV5.6 (21164PC)") - UNAME_MACHINE="alphapca56" ;; - "EV5.7 (21164PC)") - UNAME_MACHINE="alphapca57" ;; - "EV6 (21264)") - UNAME_MACHINE="alphaev6" ;; - "EV6.7 (21264A)") - UNAME_MACHINE="alphaev67" ;; - "EV6.8CB (21264C)") - UNAME_MACHINE="alphaev68" ;; - "EV6.8AL (21264B)") - UNAME_MACHINE="alphaev68" ;; - "EV6.8CX (21264D)") - UNAME_MACHINE="alphaev68" ;; - "EV6.9A (21264/EV69A)") - UNAME_MACHINE="alphaev69" ;; - "EV7 (21364)") - UNAME_MACHINE="alphaev7" ;; - "EV7.9 (21364A)") - UNAME_MACHINE="alphaev79" ;; - esac - # A Pn.n version is a patched version. - # A Vn.n version is a released version. - # A Tn.n version is a released field test version. - # A Xn.n version is an unreleased experimental baselevel. - # 1.2 uses "1.2" for uname -r. - echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Reset EXIT trap before exiting to avoid spurious non-zero exit code. - exitcode=$? - trap '' 0 - exit $exitcode ;; - Alpha\ *:Windows_NT*:*) - # How do we know it's Interix rather than the generic POSIX subsystem? - # Should we change UNAME_MACHINE based on the output of uname instead - # of the specific Alpha model? - echo alpha-pc-interix - exit ;; - 21064:Windows_NT:50:3) - echo alpha-dec-winnt3.5 - exit ;; - Amiga*:UNIX_System_V:4.0:*) - echo m68k-unknown-sysv4 - exit ;; - *:[Aa]miga[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-amigaos - exit ;; - *:[Mm]orph[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-morphos - exit ;; - *:OS/390:*:*) - echo i370-ibm-openedition - exit ;; - *:z/VM:*:*) - echo s390-ibm-zvmoe - exit ;; - *:OS400:*:*) - echo powerpc-ibm-os400 - exit ;; - arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) - echo arm-acorn-riscix${UNAME_RELEASE} - exit ;; - arm*:riscos:*:*|arm*:RISCOS:*:*) - echo arm-unknown-riscos - exit ;; - SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) - echo hppa1.1-hitachi-hiuxmpp - exit ;; - Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) - # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. - if test "`(/bin/universe) 2>/dev/null`" = att ; then - echo pyramid-pyramid-sysv3 - else - echo pyramid-pyramid-bsd - fi - exit ;; - NILE*:*:*:dcosx) - echo pyramid-pyramid-svr4 - exit ;; - DRS?6000:unix:4.0:6*) - echo sparc-icl-nx6 - exit ;; - DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) - case `/usr/bin/uname -p` in - sparc) echo sparc-icl-nx7; exit ;; - esac ;; - s390x:SunOS:*:*) - echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - sun4H:SunOS:5.*:*) - echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) - echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) - echo i386-pc-auroraux${UNAME_RELEASE} - exit ;; - i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) - eval $set_cc_for_build - SUN_ARCH="i386" - # If there is a compiler, see if it is configured for 64-bit objects. - # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. - # This test works for both compilers. - if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then - if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ - grep IS_64BIT_ARCH >/dev/null - then - SUN_ARCH="x86_64" - fi - fi - echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - sun4*:SunOS:6*:*) - # According to config.sub, this is the proper way to canonicalize - # SunOS6. Hard to guess exactly what SunOS6 will be like, but - # it's likely to be more like Solaris than SunOS4. - echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - sun4*:SunOS:*:*) - case "`/usr/bin/arch -k`" in - Series*|S4*) - UNAME_RELEASE=`uname -v` - ;; - esac - # Japanese Language versions have a version number like `4.1.3-JL'. - echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` - exit ;; - sun3*:SunOS:*:*) - echo m68k-sun-sunos${UNAME_RELEASE} - exit ;; - sun*:*:4.2BSD:*) - UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` - test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 - case "`/bin/arch`" in - sun3) - echo m68k-sun-sunos${UNAME_RELEASE} - ;; - sun4) - echo sparc-sun-sunos${UNAME_RELEASE} - ;; - esac - exit ;; - aushp:SunOS:*:*) - echo sparc-auspex-sunos${UNAME_RELEASE} - exit ;; - # The situation for MiNT is a little confusing. The machine name - # can be virtually everything (everything which is not - # "atarist" or "atariste" at least should have a processor - # > m68000). The system name ranges from "MiNT" over "FreeMiNT" - # to the lowercase version "mint" (or "freemint"). Finally - # the system name "TOS" denotes a system which is actually not - # MiNT. But MiNT is downward compatible to TOS, so this should - # be no problem. - atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit ;; - atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit ;; - *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit ;; - milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) - echo m68k-milan-mint${UNAME_RELEASE} - exit ;; - hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) - echo m68k-hades-mint${UNAME_RELEASE} - exit ;; - *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) - echo m68k-unknown-mint${UNAME_RELEASE} - exit ;; - m68k:machten:*:*) - echo m68k-apple-machten${UNAME_RELEASE} - exit ;; - powerpc:machten:*:*) - echo powerpc-apple-machten${UNAME_RELEASE} - exit ;; - RISC*:Mach:*:*) - echo mips-dec-mach_bsd4.3 - exit ;; - RISC*:ULTRIX:*:*) - echo mips-dec-ultrix${UNAME_RELEASE} - exit ;; - VAX*:ULTRIX*:*:*) - echo vax-dec-ultrix${UNAME_RELEASE} - exit ;; - 2020:CLIX:*:* | 2430:CLIX:*:*) - echo clipper-intergraph-clix${UNAME_RELEASE} - exit ;; - mips:*:*:UMIPS | mips:*:*:RISCos) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c -#ifdef __cplusplus -#include <stdio.h> /* for printf() prototype */ - int main (int argc, char *argv[]) { -#else - int main (argc, argv) int argc; char *argv[]; { -#endif - #if defined (host_mips) && defined (MIPSEB) - #if defined (SYSTYPE_SYSV) - printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_SVR4) - printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) - printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); - #endif - #endif - exit (-1); - } -EOF - $CC_FOR_BUILD -o $dummy $dummy.c && - dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && - SYSTEM_NAME=`$dummy $dummyarg` && - { echo "$SYSTEM_NAME"; exit; } - echo mips-mips-riscos${UNAME_RELEASE} - exit ;; - Motorola:PowerMAX_OS:*:*) - echo powerpc-motorola-powermax - exit ;; - Motorola:*:4.3:PL8-*) - echo powerpc-harris-powermax - exit ;; - Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) - echo powerpc-harris-powermax - exit ;; - Night_Hawk:Power_UNIX:*:*) - echo powerpc-harris-powerunix - exit ;; - m88k:CX/UX:7*:*) - echo m88k-harris-cxux7 - exit ;; - m88k:*:4*:R4*) - echo m88k-motorola-sysv4 - exit ;; - m88k:*:3*:R3*) - echo m88k-motorola-sysv3 - exit ;; - AViiON:dgux:*:*) - # DG/UX returns AViiON for all architectures - UNAME_PROCESSOR=`/usr/bin/uname -p` - if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] - then - if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ - [ ${TARGET_BINARY_INTERFACE}x = x ] - then - echo m88k-dg-dgux${UNAME_RELEASE} - else - echo m88k-dg-dguxbcs${UNAME_RELEASE} - fi - else - echo i586-dg-dgux${UNAME_RELEASE} - fi - exit ;; - M88*:DolphinOS:*:*) # DolphinOS (SVR3) - echo m88k-dolphin-sysv3 - exit ;; - M88*:*:R3*:*) - # Delta 88k system running SVR3 - echo m88k-motorola-sysv3 - exit ;; - XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) - echo m88k-tektronix-sysv3 - exit ;; - Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) - echo m68k-tektronix-bsd - exit ;; - *:IRIX*:*:*) - echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` - exit ;; - ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. - echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id - exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' - i*86:AIX:*:*) - echo i386-ibm-aix - exit ;; - ia64:AIX:*:*) - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` - else - IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} - fi - echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} - exit ;; - *:AIX:2:3) - if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include <sys/systemcfg.h> - - main() - { - if (!__power_pc()) - exit(1); - puts("powerpc-ibm-aix3.2.5"); - exit(0); - } -EOF - if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` - then - echo "$SYSTEM_NAME" - else - echo rs6000-ibm-aix3.2.5 - fi - elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then - echo rs6000-ibm-aix3.2.4 - else - echo rs6000-ibm-aix3.2 - fi - exit ;; - *:AIX:*:[4567]) - IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` - if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then - IBM_ARCH=rs6000 - else - IBM_ARCH=powerpc - fi - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` - else - IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} - fi - echo ${IBM_ARCH}-ibm-aix${IBM_REV} - exit ;; - *:AIX:*:*) - echo rs6000-ibm-aix - exit ;; - ibmrt:4.4BSD:*|romp-ibm:BSD:*) - echo romp-ibm-bsd4.4 - exit ;; - ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and - echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to - exit ;; # report: romp-ibm BSD 4.3 - *:BOSX:*:*) - echo rs6000-bull-bosx - exit ;; - DPX/2?00:B.O.S.:*:*) - echo m68k-bull-sysv3 - exit ;; - 9000/[34]??:4.3bsd:1.*:*) - echo m68k-hp-bsd - exit ;; - hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) - echo m68k-hp-bsd4.4 - exit ;; - 9000/[34678]??:HP-UX:*:*) - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` - case "${UNAME_MACHINE}" in - 9000/31? ) HP_ARCH=m68000 ;; - 9000/[34]?? ) HP_ARCH=m68k ;; - 9000/[678][0-9][0-9]) - if [ -x /usr/bin/getconf ]; then - sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` - sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` - case "${sc_cpu_version}" in - 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 - 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 - 532) # CPU_PA_RISC2_0 - case "${sc_kernel_bits}" in - 32) HP_ARCH="hppa2.0n" ;; - 64) HP_ARCH="hppa2.0w" ;; - '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 - esac ;; - esac - fi - if [ "${HP_ARCH}" = "" ]; then - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - - #define _HPUX_SOURCE - #include <stdlib.h> - #include <unistd.h> - - int main () - { - #if defined(_SC_KERNEL_BITS) - long bits = sysconf(_SC_KERNEL_BITS); - #endif - long cpu = sysconf (_SC_CPU_VERSION); - - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1"); break; - case CPU_PA_RISC2_0: - #if defined(_SC_KERNEL_BITS) - switch (bits) - { - case 64: puts ("hppa2.0w"); break; - case 32: puts ("hppa2.0n"); break; - default: puts ("hppa2.0"); break; - } break; - #else /* !defined(_SC_KERNEL_BITS) */ - puts ("hppa2.0"); break; - #endif - default: puts ("hppa1.0"); break; - } - exit (0); - } -EOF - (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` - test -z "$HP_ARCH" && HP_ARCH=hppa - fi ;; - esac - if [ ${HP_ARCH} = "hppa2.0w" ] - then - eval $set_cc_for_build - - # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating - # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler - # generating 64-bit code. GNU and HP use different nomenclature: - # - # $ CC_FOR_BUILD=cc ./config.guess - # => hppa2.0w-hp-hpux11.23 - # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess - # => hppa64-hp-hpux11.23 - - if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | - grep -q __LP64__ - then - HP_ARCH="hppa2.0w" - else - HP_ARCH="hppa64" - fi - fi - echo ${HP_ARCH}-hp-hpux${HPUX_REV} - exit ;; - ia64:HP-UX:*:*) - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` - echo ia64-hp-hpux${HPUX_REV} - exit ;; - 3050*:HI-UX:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include <unistd.h> - int - main () - { - long cpu = sysconf (_SC_CPU_VERSION); - /* The order matters, because CPU_IS_HP_MC68K erroneously returns - true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct - results, however. */ - if (CPU_IS_PA_RISC (cpu)) - { - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; - case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; - default: puts ("hppa-hitachi-hiuxwe2"); break; - } - } - else if (CPU_IS_HP_MC68K (cpu)) - puts ("m68k-hitachi-hiuxwe2"); - else puts ("unknown-hitachi-hiuxwe2"); - exit (0); - } -EOF - $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && - { echo "$SYSTEM_NAME"; exit; } - echo unknown-hitachi-hiuxwe2 - exit ;; - 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) - echo hppa1.1-hp-bsd - exit ;; - 9000/8??:4.3bsd:*:*) - echo hppa1.0-hp-bsd - exit ;; - *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) - echo hppa1.0-hp-mpeix - exit ;; - hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) - echo hppa1.1-hp-osf - exit ;; - hp8??:OSF1:*:*) - echo hppa1.0-hp-osf - exit ;; - i*86:OSF1:*:*) - if [ -x /usr/sbin/sysversion ] ; then - echo ${UNAME_MACHINE}-unknown-osf1mk - else - echo ${UNAME_MACHINE}-unknown-osf1 - fi - exit ;; - parisc*:Lites*:*:*) - echo hppa1.1-hp-lites - exit ;; - C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) - echo c1-convex-bsd - exit ;; - C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit ;; - C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) - echo c34-convex-bsd - exit ;; - C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) - echo c38-convex-bsd - exit ;; - C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) - echo c4-convex-bsd - exit ;; - CRAY*Y-MP:*:*:*) - echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*[A-Z]90:*:*:*) - echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ - | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ - -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ - -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*TS:*:*:*) - echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*T3E:*:*:*) - echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*SV1:*:*:*) - echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - *:UNICOS/mp:*:*) - echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) - FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` - echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit ;; - 5000:UNIX_System_V:4.*:*) - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` - echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit ;; - i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) - echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} - exit ;; - sparc*:BSD/OS:*:*) - echo sparc-unknown-bsdi${UNAME_RELEASE} - exit ;; - *:BSD/OS:*:*) - echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} - exit ;; - *:FreeBSD:*:*) - UNAME_PROCESSOR=`/usr/bin/uname -p` - case ${UNAME_PROCESSOR} in - amd64) - echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; - *) - echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; - esac - exit ;; - i*:CYGWIN*:*) - echo ${UNAME_MACHINE}-pc-cygwin - exit ;; - *:MINGW64*:*) - echo ${UNAME_MACHINE}-pc-mingw64 - exit ;; - *:MINGW*:*) - echo ${UNAME_MACHINE}-pc-mingw32 - exit ;; - i*:MSYS*:*) - echo ${UNAME_MACHINE}-pc-msys - exit ;; - i*:windows32*:*) - # uname -m includes "-pc" on this system. - echo ${UNAME_MACHINE}-mingw32 - exit ;; - i*:PW*:*) - echo ${UNAME_MACHINE}-pc-pw32 - exit ;; - *:Interix*:*) - case ${UNAME_MACHINE} in - x86) - echo i586-pc-interix${UNAME_RELEASE} - exit ;; - authenticamd | genuineintel | EM64T) - echo x86_64-unknown-interix${UNAME_RELEASE} - exit ;; - IA64) - echo ia64-unknown-interix${UNAME_RELEASE} - exit ;; - esac ;; - [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) - echo i${UNAME_MACHINE}-pc-mks - exit ;; - 8664:Windows_NT:*) - echo x86_64-pc-mks - exit ;; - i*:Windows_NT*:* | Pentium*:Windows_NT*:*) - # How do we know it's Interix rather than the generic POSIX subsystem? - # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we - # UNAME_MACHINE based on the output of uname instead of i386? - echo i586-pc-interix - exit ;; - i*:UWIN*:*) - echo ${UNAME_MACHINE}-pc-uwin - exit ;; - amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) - echo x86_64-unknown-cygwin - exit ;; - p*:CYGWIN*:*) - echo powerpcle-unknown-cygwin - exit ;; - prep*:SunOS:5.*:*) - echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - *:GNU:*:*) - # the GNU system - echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` - exit ;; - *:GNU/*:*:*) - # other systems with GNU libc and userland - echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} - exit ;; - i*86:Minix:*:*) - echo ${UNAME_MACHINE}-pc-minix - exit ;; - aarch64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - aarch64_be:Linux:*:*) - UNAME_MACHINE=aarch64_be - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - alpha:Linux:*:*) - case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in - EV5) UNAME_MACHINE=alphaev5 ;; - EV56) UNAME_MACHINE=alphaev56 ;; - PCA56) UNAME_MACHINE=alphapca56 ;; - PCA57) UNAME_MACHINE=alphapca56 ;; - EV6) UNAME_MACHINE=alphaev6 ;; - EV67) UNAME_MACHINE=alphaev67 ;; - EV68*) UNAME_MACHINE=alphaev68 ;; - esac - objdump --private-headers /bin/sh | grep -q ld.so.1 - if test "$?" = 0 ; then LIBC="gnulibc1" ; fi - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - arc:Linux:*:* | arceb:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - arm*:Linux:*:*) - eval $set_cc_for_build - if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep -q __ARM_EABI__ - then - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - else - if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep -q __ARM_PCS_VFP - then - echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi - else - echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf - fi - fi - exit ;; - avr32*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - cris:Linux:*:*) - echo ${UNAME_MACHINE}-axis-linux-${LIBC} - exit ;; - crisv32:Linux:*:*) - echo ${UNAME_MACHINE}-axis-linux-${LIBC} - exit ;; - frv:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - hexagon:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - i*86:Linux:*:*) - echo ${UNAME_MACHINE}-pc-linux-${LIBC} - exit ;; - ia64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - m32r*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - m68*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - mips:Linux:*:* | mips64:Linux:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #undef CPU - #undef ${UNAME_MACHINE} - #undef ${UNAME_MACHINE}el - #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) - CPU=${UNAME_MACHINE}el - #else - #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) - CPU=${UNAME_MACHINE} - #else - CPU= - #endif - #endif -EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` - test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } - ;; - or1k:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - or32:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - padre:Linux:*:*) - echo sparc-unknown-linux-${LIBC} - exit ;; - parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-unknown-linux-${LIBC} - exit ;; - parisc:Linux:*:* | hppa:Linux:*:*) - # Look for CPU level - case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) echo hppa1.1-unknown-linux-${LIBC} ;; - PA8*) echo hppa2.0-unknown-linux-${LIBC} ;; - *) echo hppa-unknown-linux-${LIBC} ;; - esac - exit ;; - ppc64:Linux:*:*) - echo powerpc64-unknown-linux-${LIBC} - exit ;; - ppc:Linux:*:*) - echo powerpc-unknown-linux-${LIBC} - exit ;; - ppc64le:Linux:*:*) - echo powerpc64le-unknown-linux-${LIBC} - exit ;; - ppcle:Linux:*:*) - echo powerpcle-unknown-linux-${LIBC} - exit ;; - s390:Linux:*:* | s390x:Linux:*:*) - echo ${UNAME_MACHINE}-ibm-linux-${LIBC} - exit ;; - sh64*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - sh*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - sparc:Linux:*:* | sparc64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - tile*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - vax:Linux:*:*) - echo ${UNAME_MACHINE}-dec-linux-${LIBC} - exit ;; - x86_64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - xtensa*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - i*86:DYNIX/ptx:4*:*) - # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. - # earlier versions are messed up and put the nodename in both - # sysname and nodename. - echo i386-sequent-sysv4 - exit ;; - i*86:UNIX_SV:4.2MP:2.*) - # Unixware is an offshoot of SVR4, but it has its own version - # number series starting with 2... - # I am not positive that other SVR4 systems won't match this, - # I just have to hope. -- rms. - # Use sysv4.2uw... so that sysv4* matches it. - echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} - exit ;; - i*86:OS/2:*:*) - # If we were able to find `uname', then EMX Unix compatibility - # is probably installed. - echo ${UNAME_MACHINE}-pc-os2-emx - exit ;; - i*86:XTS-300:*:STOP) - echo ${UNAME_MACHINE}-unknown-stop - exit ;; - i*86:atheos:*:*) - echo ${UNAME_MACHINE}-unknown-atheos - exit ;; - i*86:syllable:*:*) - echo ${UNAME_MACHINE}-pc-syllable - exit ;; - i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) - echo i386-unknown-lynxos${UNAME_RELEASE} - exit ;; - i*86:*DOS:*:*) - echo ${UNAME_MACHINE}-pc-msdosdjgpp - exit ;; - i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) - UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` - if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then - echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} - else - echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} - fi - exit ;; - i*86:*:5:[678]*) - # UnixWare 7.x, OpenUNIX and OpenServer 6. - case `/bin/uname -X | grep "^Machine"` in - *486*) UNAME_MACHINE=i486 ;; - *Pentium) UNAME_MACHINE=i586 ;; - *Pent*|*Celeron) UNAME_MACHINE=i686 ;; - esac - echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} - exit ;; - i*86:*:3.2:*) - if test -f /usr/options/cb.name; then - UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name` - echo ${UNAME_MACHINE}-pc-isc$UNAME_REL - elif /bin/uname -X 2>/dev/null >/dev/null ; then - UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` - (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 - (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ - && UNAME_MACHINE=i586 - (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ - && UNAME_MACHINE=i686 - (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ - && UNAME_MACHINE=i686 - echo ${UNAME_MACHINE}-pc-sco$UNAME_REL - else - echo ${UNAME_MACHINE}-pc-sysv32 - fi - exit ;; - pc:*:*:*) - # Left here for compatibility: - # uname -m prints for DJGPP always 'pc', but it prints nothing about - # the processor, so we play safe by assuming i586. - # Note: whatever this is, it MUST be the same as what config.sub - # prints for the "djgpp" host, or else GDB configury will decide that - # this is a cross-build. - echo i586-pc-msdosdjgpp - exit ;; - Intel:Mach:3*:*) - echo i386-pc-mach3 - exit ;; - paragon:*:*:*) - echo i860-intel-osf1 - exit ;; - i860:*:4.*:*) # i860-SVR4 - if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then - echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 - else # Add other i860-SVR4 vendors below as they are discovered. - echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 - fi - exit ;; - mini*:CTIX:SYS*5:*) - # "miniframe" - echo m68010-convergent-sysv - exit ;; - mc68k:UNIX:SYSTEM5:3.51m) - echo m68k-convergent-sysv - exit ;; - M680?0:D-NIX:5.3:*) - echo m68k-diab-dnix - exit ;; - M68*:*:R3V[5678]*:*) - test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; - 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) - OS_REL='' - test -r /etc/.relid \ - && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4.3${OS_REL}; exit; } - /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ - && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; - 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4; exit; } ;; - NCR*:*:4.2:* | MPRAS*:*:4.2:*) - OS_REL='.3' - test -r /etc/.relid \ - && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4.3${OS_REL}; exit; } - /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ - && { echo i586-ncr-sysv4.3${OS_REL}; exit; } - /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ - && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; - m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) - echo m68k-unknown-lynxos${UNAME_RELEASE} - exit ;; - mc68030:UNIX_System_V:4.*:*) - echo m68k-atari-sysv4 - exit ;; - TSUNAMI:LynxOS:2.*:*) - echo sparc-unknown-lynxos${UNAME_RELEASE} - exit ;; - rs6000:LynxOS:2.*:*) - echo rs6000-unknown-lynxos${UNAME_RELEASE} - exit ;; - PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) - echo powerpc-unknown-lynxos${UNAME_RELEASE} - exit ;; - SM[BE]S:UNIX_SV:*:*) - echo mips-dde-sysv${UNAME_RELEASE} - exit ;; - RM*:ReliantUNIX-*:*:*) - echo mips-sni-sysv4 - exit ;; - RM*:SINIX-*:*:*) - echo mips-sni-sysv4 - exit ;; - *:SINIX-*:*:*) - if uname -p 2>/dev/null >/dev/null ; then - UNAME_MACHINE=`(uname -p) 2>/dev/null` - echo ${UNAME_MACHINE}-sni-sysv4 - else - echo ns32k-sni-sysv - fi - exit ;; - PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort - # says <Richard.M.Bartel@ccMail.Census.GOV> - echo i586-unisys-sysv4 - exit ;; - *:UNIX_System_V:4*:FTX*) - # From Gerald Hewes <hewes@openmarket.com>. - # How about differentiating between stratus architectures? -djm - echo hppa1.1-stratus-sysv4 - exit ;; - *:*:*:FTX*) - # From seanf@swdc.stratus.com. - echo i860-stratus-sysv4 - exit ;; - i*86:VOS:*:*) - # From Paul.Green@stratus.com. - echo ${UNAME_MACHINE}-stratus-vos - exit ;; - *:VOS:*:*) - # From Paul.Green@stratus.com. - echo hppa1.1-stratus-vos - exit ;; - mc68*:A/UX:*:*) - echo m68k-apple-aux${UNAME_RELEASE} - exit ;; - news*:NEWS-OS:6*:*) - echo mips-sony-newsos6 - exit ;; - R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) - if [ -d /usr/nec ]; then - echo mips-nec-sysv${UNAME_RELEASE} - else - echo mips-unknown-sysv${UNAME_RELEASE} - fi - exit ;; - BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. - echo powerpc-be-beos - exit ;; - BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. - echo powerpc-apple-beos - exit ;; - BePC:BeOS:*:*) # BeOS running on Intel PC compatible. - echo i586-pc-beos - exit ;; - BePC:Haiku:*:*) # Haiku running on Intel PC compatible. - echo i586-pc-haiku - exit ;; - x86_64:Haiku:*:*) - echo x86_64-unknown-haiku - exit ;; - SX-4:SUPER-UX:*:*) - echo sx4-nec-superux${UNAME_RELEASE} - exit ;; - SX-5:SUPER-UX:*:*) - echo sx5-nec-superux${UNAME_RELEASE} - exit ;; - SX-6:SUPER-UX:*:*) - echo sx6-nec-superux${UNAME_RELEASE} - exit ;; - SX-7:SUPER-UX:*:*) - echo sx7-nec-superux${UNAME_RELEASE} - exit ;; - SX-8:SUPER-UX:*:*) - echo sx8-nec-superux${UNAME_RELEASE} - exit ;; - SX-8R:SUPER-UX:*:*) - echo sx8r-nec-superux${UNAME_RELEASE} - exit ;; - Power*:Rhapsody:*:*) - echo powerpc-apple-rhapsody${UNAME_RELEASE} - exit ;; - *:Rhapsody:*:*) - echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} - exit ;; - *:Darwin:*:*) - UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown - eval $set_cc_for_build - if test "$UNAME_PROCESSOR" = unknown ; then - UNAME_PROCESSOR=powerpc - fi - if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then - if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then - if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ - grep IS_64BIT_ARCH >/dev/null - then - case $UNAME_PROCESSOR in - i386) UNAME_PROCESSOR=x86_64 ;; - powerpc) UNAME_PROCESSOR=powerpc64 ;; - esac - fi - fi - elif test "$UNAME_PROCESSOR" = i386 ; then - # Avoid executing cc on OS X 10.9, as it ships with a stub - # that puts up a graphical alert prompting to install - # developer tools. Any system running Mac OS X 10.7 or - # later (Darwin 11 and later) is required to have a 64-bit - # processor. This is not true of the ARM version of Darwin - # that Apple uses in portable devices. - UNAME_PROCESSOR=x86_64 - fi - echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} - exit ;; - *:procnto*:*:* | *:QNX:[0123456789]*:*) - UNAME_PROCESSOR=`uname -p` - if test "$UNAME_PROCESSOR" = "x86"; then - UNAME_PROCESSOR=i386 - UNAME_MACHINE=pc - fi - echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} - exit ;; - *:QNX:*:4*) - echo i386-pc-qnx - exit ;; - NEO-?:NONSTOP_KERNEL:*:*) - echo neo-tandem-nsk${UNAME_RELEASE} - exit ;; - NSE-*:NONSTOP_KERNEL:*:*) - echo nse-tandem-nsk${UNAME_RELEASE} - exit ;; - NSR-?:NONSTOP_KERNEL:*:*) - echo nsr-tandem-nsk${UNAME_RELEASE} - exit ;; - *:NonStop-UX:*:*) - echo mips-compaq-nonstopux - exit ;; - BS2000:POSIX*:*:*) - echo bs2000-siemens-sysv - exit ;; - DS/*:UNIX_System_V:*:*) - echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} - exit ;; - *:Plan9:*:*) - # "uname -m" is not consistent, so use $cputype instead. 386 - # is converted to i386 for consistency with other x86 - # operating systems. - if test "$cputype" = "386"; then - UNAME_MACHINE=i386 - else - UNAME_MACHINE="$cputype" - fi - echo ${UNAME_MACHINE}-unknown-plan9 - exit ;; - *:TOPS-10:*:*) - echo pdp10-unknown-tops10 - exit ;; - *:TENEX:*:*) - echo pdp10-unknown-tenex - exit ;; - KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) - echo pdp10-dec-tops20 - exit ;; - XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) - echo pdp10-xkl-tops20 - exit ;; - *:TOPS-20:*:*) - echo pdp10-unknown-tops20 - exit ;; - *:ITS:*:*) - echo pdp10-unknown-its - exit ;; - SEI:*:*:SEIUX) - echo mips-sei-seiux${UNAME_RELEASE} - exit ;; - *:DragonFly:*:*) - echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` - exit ;; - *:*VMS:*:*) - UNAME_MACHINE=`(uname -p) 2>/dev/null` - case "${UNAME_MACHINE}" in - A*) echo alpha-dec-vms ; exit ;; - I*) echo ia64-dec-vms ; exit ;; - V*) echo vax-dec-vms ; exit ;; - esac ;; - *:XENIX:*:SysV) - echo i386-pc-xenix - exit ;; - i*86:skyos:*:*) - echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' - exit ;; - i*86:rdos:*:*) - echo ${UNAME_MACHINE}-pc-rdos - exit ;; - i*86:AROS:*:*) - echo ${UNAME_MACHINE}-pc-aros - exit ;; - x86_64:VMkernel:*:*) - echo ${UNAME_MACHINE}-unknown-esx - exit ;; -esac - -eval $set_cc_for_build -cat >$dummy.c <<EOF -#ifdef _SEQUENT_ -# include <sys/types.h> -# include <sys/utsname.h> -#endif -main () -{ -#if defined (sony) -#if defined (MIPSEB) - /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, - I don't know.... */ - printf ("mips-sony-bsd\n"); exit (0); -#else -#include <sys/param.h> - printf ("m68k-sony-newsos%s\n", -#ifdef NEWSOS4 - "4" -#else - "" -#endif - ); exit (0); -#endif -#endif - -#if defined (__arm) && defined (__acorn) && defined (__unix) - printf ("arm-acorn-riscix\n"); exit (0); -#endif - -#if defined (hp300) && !defined (hpux) - printf ("m68k-hp-bsd\n"); exit (0); -#endif - -#if defined (NeXT) -#if !defined (__ARCHITECTURE__) -#define __ARCHITECTURE__ "m68k" -#endif - int version; - version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; - if (version < 4) - printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); - else - printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); - exit (0); -#endif - -#if defined (MULTIMAX) || defined (n16) -#if defined (UMAXV) - printf ("ns32k-encore-sysv\n"); exit (0); -#else -#if defined (CMU) - printf ("ns32k-encore-mach\n"); exit (0); -#else - printf ("ns32k-encore-bsd\n"); exit (0); -#endif -#endif -#endif - -#if defined (__386BSD__) - printf ("i386-pc-bsd\n"); exit (0); -#endif - -#if defined (sequent) -#if defined (i386) - printf ("i386-sequent-dynix\n"); exit (0); -#endif -#if defined (ns32000) - printf ("ns32k-sequent-dynix\n"); exit (0); -#endif -#endif - -#if defined (_SEQUENT_) - struct utsname un; - - uname(&un); - - if (strncmp(un.version, "V2", 2) == 0) { - printf ("i386-sequent-ptx2\n"); exit (0); - } - if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ - printf ("i386-sequent-ptx1\n"); exit (0); - } - printf ("i386-sequent-ptx\n"); exit (0); - -#endif - -#if defined (vax) -# if !defined (ultrix) -# include <sys/param.h> -# if defined (BSD) -# if BSD == 43 - printf ("vax-dec-bsd4.3\n"); exit (0); -# else -# if BSD == 199006 - printf ("vax-dec-bsd4.3reno\n"); exit (0); -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# endif -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# else - printf ("vax-dec-ultrix\n"); exit (0); -# endif -#endif - -#if defined (alliant) && defined (i860) - printf ("i860-alliant-bsd\n"); exit (0); -#endif - - exit (1); -} -EOF - -$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && - { echo "$SYSTEM_NAME"; exit; } - -# Apollos put the system type in the environment. - -test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } - -# Convex versions that predate uname can use getsysinfo(1) - -if [ -x /usr/convex/getsysinfo ] -then - case `getsysinfo -f cpu_type` in - c1*) - echo c1-convex-bsd - exit ;; - c2*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit ;; - c34*) - echo c34-convex-bsd - exit ;; - c38*) - echo c38-convex-bsd - exit ;; - c4*) - echo c4-convex-bsd - exit ;; - esac -fi - -cat >&2 <<EOF -$0: unable to guess system type - -This script, last modified $timestamp, has failed to recognize -the operating system you are using. It is advised that you -download the most up to date version of the config scripts from - - http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD -and - http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD - -If the version you run ($0) is already up to date, please -send the following data and any information you think might be -pertinent to <config-patches@gnu.org> in order to provide the needed -information to handle your system. - -config.guess timestamp = $timestamp - -uname -m = `(uname -m) 2>/dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` - -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null` - -hostinfo = `(hostinfo) 2>/dev/null` -/bin/universe = `(/bin/universe) 2>/dev/null` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` -/bin/arch = `(/bin/arch) 2>/dev/null` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` - -UNAME_MACHINE = ${UNAME_MACHINE} -UNAME_RELEASE = ${UNAME_RELEASE} -UNAME_SYSTEM = ${UNAME_SYSTEM} -UNAME_VERSION = ${UNAME_VERSION} -EOF - -exit 1 - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "timestamp='" -# time-stamp-format: "%:y-%02m-%02d" -# time-stamp-end: "'" -# End: diff --git a/scripts/configtools/config.sub b/scripts/configtools/config.sub deleted file mode 100755 index 61cb4bc22db..00000000000 --- a/scripts/configtools/config.sub +++ /dev/null @@ -1,1793 +0,0 @@ -#! /bin/sh -# Configuration validation subroutine script. -# Copyright 1992-2013 Free Software Foundation, Inc. - -timestamp='2013-10-01' - -# This file is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, see <http://www.gnu.org/licenses/>. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that -# program. This Exception is an additional permission under section 7 -# of the GNU General Public License, version 3 ("GPLv3"). - - -# Please send patches with a ChangeLog entry to config-patches@gnu.org. -# -# Configuration subroutine to validate and canonicalize a configuration type. -# Supply the specified configuration type as an argument. -# If it is invalid, we print an error message on stderr and exit with code 1. -# Otherwise, we print the canonical config type on stdout and succeed. - -# You can get the latest version of this script from: -# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD - -# This file is supposed to be the same for all GNU packages -# and recognize all the CPU types, system types and aliases -# that are meaningful with *any* GNU software. -# Each package is responsible for reporting which valid configurations -# it does not support. The user should be able to distinguish -# a failure to support a valid configuration from a meaningless -# configuration. - -# The goal of this file is to map all the various variations of a given -# machine specification into a single specification in the form: -# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM -# or in some cases, the newer four-part form: -# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM -# It is wrong to echo any other type of specification. - -me=`echo "$0" | sed -e 's,.*/,,'` - -usage="\ -Usage: $0 [OPTION] CPU-MFR-OPSYS - $0 [OPTION] ALIAS - -Canonicalize a configuration name. - -Operation modes: - -h, --help print this help, then exit - -t, --time-stamp print date of last modification, then exit - -v, --version print version number, then exit - -Report bugs and patches to <config-patches@gnu.org>." - -version="\ -GNU config.sub ($timestamp) - -Copyright 1992-2013 Free Software Foundation, Inc. - -This is free software; see the source for copying conditions. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - -help=" -Try \`$me --help' for more information." - -# Parse command line -while test $# -gt 0 ; do - case $1 in - --time-stamp | --time* | -t ) - echo "$timestamp" ; exit ;; - --version | -v ) - echo "$version" ; exit ;; - --help | --h* | -h ) - echo "$usage"; exit ;; - -- ) # Stop option processing - shift; break ;; - - ) # Use stdin as input. - break ;; - -* ) - echo "$me: invalid option $1$help" - exit 1 ;; - - *local*) - # First pass through any local machine types. - echo $1 - exit ;; - - * ) - break ;; - esac -done - -case $# in - 0) echo "$me: missing argument$help" >&2 - exit 1;; - 1) ;; - *) echo "$me: too many arguments$help" >&2 - exit 1;; -esac - -# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). -# Here we must recognize all the valid KERNEL-OS combinations. -maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` -case $maybe_os in - nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ - linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ - knetbsd*-gnu* | netbsd*-gnu* | \ - kopensolaris*-gnu* | \ - storm-chaos* | os2-emx* | rtmk-nova*) - os=-$maybe_os - basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` - ;; - android-linux) - os=-linux-android - basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown - ;; - *) - basic_machine=`echo $1 | sed 's/-[^-]*$//'` - if [ $basic_machine != $1 ] - then os=`echo $1 | sed 's/.*-/-/'` - else os=; fi - ;; -esac - -### Let's recognize common machines as not being operating systems so -### that things like config.sub decstation-3100 work. We also -### recognize some manufacturers as not being operating systems, so we -### can provide default operating systems below. -case $os in - -sun*os*) - # Prevent following clause from handling this invalid input. - ;; - -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ - -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ - -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ - -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ - -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ - -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ - -apple | -axis | -knuth | -cray | -microblaze*) - os= - basic_machine=$1 - ;; - -bluegene*) - os=-cnk - ;; - -sim | -cisco | -oki | -wec | -winbond) - os= - basic_machine=$1 - ;; - -scout) - ;; - -wrs) - os=-vxworks - basic_machine=$1 - ;; - -chorusos*) - os=-chorusos - basic_machine=$1 - ;; - -chorusrdb) - os=-chorusrdb - basic_machine=$1 - ;; - -hiux*) - os=-hiuxwe2 - ;; - -sco6) - os=-sco5v6 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco5) - os=-sco3.2v5 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco4) - os=-sco3.2v4 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2.[4-9]*) - os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2v[4-9]*) - # Don't forget version if it is 3.2v4 or newer. - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco5v6*) - # Don't forget version if it is 3.2v4 or newer. - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco*) - os=-sco3.2v2 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -udk*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -isc) - os=-isc2.2 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -clix*) - basic_machine=clipper-intergraph - ;; - -isc*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -lynx*178) - os=-lynxos178 - ;; - -lynx*5) - os=-lynxos5 - ;; - -lynx*) - os=-lynxos - ;; - -ptx*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` - ;; - -windowsnt*) - os=`echo $os | sed -e 's/windowsnt/winnt/'` - ;; - -psos*) - os=-psos - ;; - -mint | -mint[0-9]*) - basic_machine=m68k-atari - os=-mint - ;; -esac - -# Decode aliases for certain CPU-COMPANY combinations. -case $basic_machine in - # Recognize the basic CPU types without company name. - # Some are omitted here because they have special meanings below. - 1750a | 580 \ - | a29k \ - | aarch64 | aarch64_be \ - | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ - | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ - | am33_2.0 \ - | arc | arceb \ - | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ - | avr | avr32 \ - | be32 | be64 \ - | bfin \ - | c4x | c8051 | clipper \ - | d10v | d30v | dlx | dsp16xx \ - | epiphany \ - | fido | fr30 | frv \ - | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ - | hexagon \ - | i370 | i860 | i960 | ia64 \ - | ip2k | iq2000 \ - | k1om \ - | le32 | le64 \ - | lm32 \ - | m32c | m32r | m32rle | m68000 | m68k | m88k \ - | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ - | mips | mipsbe | mipseb | mipsel | mipsle \ - | mips16 \ - | mips64 | mips64el \ - | mips64octeon | mips64octeonel \ - | mips64orion | mips64orionel \ - | mips64r5900 | mips64r5900el \ - | mips64vr | mips64vrel \ - | mips64vr4100 | mips64vr4100el \ - | mips64vr4300 | mips64vr4300el \ - | mips64vr5000 | mips64vr5000el \ - | mips64vr5900 | mips64vr5900el \ - | mipsisa32 | mipsisa32el \ - | mipsisa32r2 | mipsisa32r2el \ - | mipsisa64 | mipsisa64el \ - | mipsisa64r2 | mipsisa64r2el \ - | mipsisa64sb1 | mipsisa64sb1el \ - | mipsisa64sr71k | mipsisa64sr71kel \ - | mipsr5900 | mipsr5900el \ - | mipstx39 | mipstx39el \ - | mn10200 | mn10300 \ - | moxie \ - | mt \ - | msp430 \ - | nds32 | nds32le | nds32be \ - | nios | nios2 | nios2eb | nios2el \ - | ns16k | ns32k \ - | open8 \ - | or1k | or32 \ - | pdp10 | pdp11 | pj | pjl \ - | powerpc | powerpc64 | powerpc64le | powerpcle \ - | pyramid \ - | rl78 | rx \ - | score \ - | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ - | sh64 | sh64le \ - | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ - | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ - | spu \ - | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ - | ubicom32 \ - | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ - | we32k \ - | x86 | xc16x | xstormy16 | xtensa \ - | z8k | z80) - basic_machine=$basic_machine-unknown - ;; - c54x) - basic_machine=tic54x-unknown - ;; - c55x) - basic_machine=tic55x-unknown - ;; - c6x) - basic_machine=tic6x-unknown - ;; - m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip) - basic_machine=$basic_machine-unknown - os=-none - ;; - m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) - ;; - ms1) - basic_machine=mt-unknown - ;; - - strongarm | thumb | xscale) - basic_machine=arm-unknown - ;; - xgate) - basic_machine=$basic_machine-unknown - os=-none - ;; - xscaleeb) - basic_machine=armeb-unknown - ;; - - xscaleel) - basic_machine=armel-unknown - ;; - - # We use `pc' rather than `unknown' - # because (1) that's what they normally are, and - # (2) the word "unknown" tends to confuse beginning users. - i*86 | x86_64) - basic_machine=$basic_machine-pc - ;; - # Object if more than one company name word. - *-*-*) - echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 - exit 1 - ;; - # Recognize the basic CPU types with company name. - 580-* \ - | a29k-* \ - | aarch64-* | aarch64_be-* \ - | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ - | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ - | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ - | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ - | avr-* | avr32-* \ - | be32-* | be64-* \ - | bfin-* | bs2000-* \ - | c[123]* | c30-* | [cjt]90-* | c4x-* \ - | c8051-* | clipper-* | craynv-* | cydra-* \ - | d10v-* | d30v-* | dlx-* \ - | elxsi-* \ - | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ - | h8300-* | h8500-* \ - | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ - | hexagon-* \ - | i*86-* | i860-* | i960-* | ia64-* \ - | ip2k-* | iq2000-* \ - | k1om-* \ - | le32-* | le64-* \ - | lm32-* \ - | m32c-* | m32r-* | m32rle-* \ - | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ - | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ - | microblaze-* | microblazeel-* \ - | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ - | mips16-* \ - | mips64-* | mips64el-* \ - | mips64octeon-* | mips64octeonel-* \ - | mips64orion-* | mips64orionel-* \ - | mips64r5900-* | mips64r5900el-* \ - | mips64vr-* | mips64vrel-* \ - | mips64vr4100-* | mips64vr4100el-* \ - | mips64vr4300-* | mips64vr4300el-* \ - | mips64vr5000-* | mips64vr5000el-* \ - | mips64vr5900-* | mips64vr5900el-* \ - | mipsisa32-* | mipsisa32el-* \ - | mipsisa32r2-* | mipsisa32r2el-* \ - | mipsisa64-* | mipsisa64el-* \ - | mipsisa64r2-* | mipsisa64r2el-* \ - | mipsisa64sb1-* | mipsisa64sb1el-* \ - | mipsisa64sr71k-* | mipsisa64sr71kel-* \ - | mipsr5900-* | mipsr5900el-* \ - | mipstx39-* | mipstx39el-* \ - | mmix-* \ - | mt-* \ - | msp430-* \ - | nds32-* | nds32le-* | nds32be-* \ - | nios-* | nios2-* | nios2eb-* | nios2el-* \ - | none-* | np1-* | ns16k-* | ns32k-* \ - | open8-* \ - | orion-* \ - | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ - | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ - | pyramid-* \ - | rl78-* | romp-* | rs6000-* | rx-* \ - | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ - | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ - | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ - | sparclite-* \ - | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ - | tahoe-* \ - | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ - | tile*-* \ - | tron-* \ - | ubicom32-* \ - | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ - | vax-* \ - | we32k-* \ - | x86-* | x86_64-* | xc16x-* | xps100-* \ - | xstormy16-* | xtensa*-* \ - | ymp-* \ - | z8k-* | z80-*) - ;; - # Recognize the basic CPU types without company name, with glob match. - xtensa*) - basic_machine=$basic_machine-unknown - ;; - # Recognize the various machine names and aliases which stand - # for a CPU type and a company and sometimes even an OS. - 386bsd) - basic_machine=i386-unknown - os=-bsd - ;; - 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) - basic_machine=m68000-att - ;; - 3b*) - basic_machine=we32k-att - ;; - a29khif) - basic_machine=a29k-amd - os=-udi - ;; - abacus) - basic_machine=abacus-unknown - ;; - adobe68k) - basic_machine=m68010-adobe - os=-scout - ;; - alliant | fx80) - basic_machine=fx80-alliant - ;; - altos | altos3068) - basic_machine=m68k-altos - ;; - am29k) - basic_machine=a29k-none - os=-bsd - ;; - amd64) - basic_machine=x86_64-pc - ;; - amd64-*) - basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - amdahl) - basic_machine=580-amdahl - os=-sysv - ;; - amiga | amiga-*) - basic_machine=m68k-unknown - ;; - amigaos | amigados) - basic_machine=m68k-unknown - os=-amigaos - ;; - amigaunix | amix) - basic_machine=m68k-unknown - os=-sysv4 - ;; - apollo68) - basic_machine=m68k-apollo - os=-sysv - ;; - apollo68bsd) - basic_machine=m68k-apollo - os=-bsd - ;; - aros) - basic_machine=i386-pc - os=-aros - ;; - aux) - basic_machine=m68k-apple - os=-aux - ;; - balance) - basic_machine=ns32k-sequent - os=-dynix - ;; - blackfin) - basic_machine=bfin-unknown - os=-linux - ;; - blackfin-*) - basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` - os=-linux - ;; - bluegene*) - basic_machine=powerpc-ibm - os=-cnk - ;; - c54x-*) - basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - c55x-*) - basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - c6x-*) - basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - c90) - basic_machine=c90-cray - os=-unicos - ;; - cegcc) - basic_machine=arm-unknown - os=-cegcc - ;; - convex-c1) - basic_machine=c1-convex - os=-bsd - ;; - convex-c2) - basic_machine=c2-convex - os=-bsd - ;; - convex-c32) - basic_machine=c32-convex - os=-bsd - ;; - convex-c34) - basic_machine=c34-convex - os=-bsd - ;; - convex-c38) - basic_machine=c38-convex - os=-bsd - ;; - cray | j90) - basic_machine=j90-cray - os=-unicos - ;; - craynv) - basic_machine=craynv-cray - os=-unicosmp - ;; - cr16 | cr16-*) - basic_machine=cr16-unknown - os=-elf - ;; - crds | unos) - basic_machine=m68k-crds - ;; - crisv32 | crisv32-* | etraxfs*) - basic_machine=crisv32-axis - ;; - cris | cris-* | etrax*) - basic_machine=cris-axis - ;; - crx) - basic_machine=crx-unknown - os=-elf - ;; - da30 | da30-*) - basic_machine=m68k-da30 - ;; - decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) - basic_machine=mips-dec - ;; - decsystem10* | dec10*) - basic_machine=pdp10-dec - os=-tops10 - ;; - decsystem20* | dec20*) - basic_machine=pdp10-dec - os=-tops20 - ;; - delta | 3300 | motorola-3300 | motorola-delta \ - | 3300-motorola | delta-motorola) - basic_machine=m68k-motorola - ;; - delta88) - basic_machine=m88k-motorola - os=-sysv3 - ;; - dicos) - basic_machine=i686-pc - os=-dicos - ;; - djgpp) - basic_machine=i586-pc - os=-msdosdjgpp - ;; - dpx20 | dpx20-*) - basic_machine=rs6000-bull - os=-bosx - ;; - dpx2* | dpx2*-bull) - basic_machine=m68k-bull - os=-sysv3 - ;; - ebmon29k) - basic_machine=a29k-amd - os=-ebmon - ;; - elxsi) - basic_machine=elxsi-elxsi - os=-bsd - ;; - encore | umax | mmax) - basic_machine=ns32k-encore - ;; - es1800 | OSE68k | ose68k | ose | OSE) - basic_machine=m68k-ericsson - os=-ose - ;; - fx2800) - basic_machine=i860-alliant - ;; - genix) - basic_machine=ns32k-ns - ;; - gmicro) - basic_machine=tron-gmicro - os=-sysv - ;; - go32) - basic_machine=i386-pc - os=-go32 - ;; - h3050r* | hiux*) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - h8300hms) - basic_machine=h8300-hitachi - os=-hms - ;; - h8300xray) - basic_machine=h8300-hitachi - os=-xray - ;; - h8500hms) - basic_machine=h8500-hitachi - os=-hms - ;; - harris) - basic_machine=m88k-harris - os=-sysv3 - ;; - hp300-*) - basic_machine=m68k-hp - ;; - hp300bsd) - basic_machine=m68k-hp - os=-bsd - ;; - hp300hpux) - basic_machine=m68k-hp - os=-hpux - ;; - hp3k9[0-9][0-9] | hp9[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hp9k2[0-9][0-9] | hp9k31[0-9]) - basic_machine=m68000-hp - ;; - hp9k3[2-9][0-9]) - basic_machine=m68k-hp - ;; - hp9k6[0-9][0-9] | hp6[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hp9k7[0-79][0-9] | hp7[0-79][0-9]) - basic_machine=hppa1.1-hp - ;; - hp9k78[0-9] | hp78[0-9]) - # FIXME: really hppa2.0-hp - basic_machine=hppa1.1-hp - ;; - hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) - # FIXME: really hppa2.0-hp - basic_machine=hppa1.1-hp - ;; - hp9k8[0-9][13679] | hp8[0-9][13679]) - basic_machine=hppa1.1-hp - ;; - hp9k8[0-9][0-9] | hp8[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hppa-next) - os=-nextstep3 - ;; - hppaosf) - basic_machine=hppa1.1-hp - os=-osf - ;; - hppro) - basic_machine=hppa1.1-hp - os=-proelf - ;; - i370-ibm* | ibm*) - basic_machine=i370-ibm - ;; - i*86v32) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv32 - ;; - i*86v4*) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv4 - ;; - i*86v) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv - ;; - i*86sol2) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-solaris2 - ;; - i386mach) - basic_machine=i386-mach - os=-mach - ;; - i386-vsta | vsta) - basic_machine=i386-unknown - os=-vsta - ;; - iris | iris4d) - basic_machine=mips-sgi - case $os in - -irix*) - ;; - *) - os=-irix4 - ;; - esac - ;; - isi68 | isi) - basic_machine=m68k-isi - os=-sysv - ;; - m68knommu) - basic_machine=m68k-unknown - os=-linux - ;; - m68knommu-*) - basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` - os=-linux - ;; - m88k-omron*) - basic_machine=m88k-omron - ;; - magnum | m3230) - basic_machine=mips-mips - os=-sysv - ;; - merlin) - basic_machine=ns32k-utek - os=-sysv - ;; - microblaze*) - basic_machine=microblaze-xilinx - ;; - mingw64) - basic_machine=x86_64-pc - os=-mingw64 - ;; - mingw32) - basic_machine=i686-pc - os=-mingw32 - ;; - mingw32ce) - basic_machine=arm-unknown - os=-mingw32ce - ;; - miniframe) - basic_machine=m68000-convergent - ;; - *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) - basic_machine=m68k-atari - os=-mint - ;; - mips3*-*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` - ;; - mips3*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown - ;; - monitor) - basic_machine=m68k-rom68k - os=-coff - ;; - morphos) - basic_machine=powerpc-unknown - os=-morphos - ;; - msdos) - basic_machine=i386-pc - os=-msdos - ;; - ms1-*) - basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` - ;; - msys) - basic_machine=i686-pc - os=-msys - ;; - mvs) - basic_machine=i370-ibm - os=-mvs - ;; - nacl) - basic_machine=le32-unknown - os=-nacl - ;; - ncr3000) - basic_machine=i486-ncr - os=-sysv4 - ;; - netbsd386) - basic_machine=i386-unknown - os=-netbsd - ;; - netwinder) - basic_machine=armv4l-rebel - os=-linux - ;; - news | news700 | news800 | news900) - basic_machine=m68k-sony - os=-newsos - ;; - news1000) - basic_machine=m68030-sony - os=-newsos - ;; - news-3600 | risc-news) - basic_machine=mips-sony - os=-newsos - ;; - necv70) - basic_machine=v70-nec - os=-sysv - ;; - next | m*-next ) - basic_machine=m68k-next - case $os in - -nextstep* ) - ;; - -ns2*) - os=-nextstep2 - ;; - *) - os=-nextstep3 - ;; - esac - ;; - nh3000) - basic_machine=m68k-harris - os=-cxux - ;; - nh[45]000) - basic_machine=m88k-harris - os=-cxux - ;; - nindy960) - basic_machine=i960-intel - os=-nindy - ;; - mon960) - basic_machine=i960-intel - os=-mon960 - ;; - nonstopux) - basic_machine=mips-compaq - os=-nonstopux - ;; - np1) - basic_machine=np1-gould - ;; - neo-tandem) - basic_machine=neo-tandem - ;; - nse-tandem) - basic_machine=nse-tandem - ;; - nsr-tandem) - basic_machine=nsr-tandem - ;; - op50n-* | op60c-*) - basic_machine=hppa1.1-oki - os=-proelf - ;; - openrisc | openrisc-*) - basic_machine=or32-unknown - ;; - os400) - basic_machine=powerpc-ibm - os=-os400 - ;; - OSE68000 | ose68000) - basic_machine=m68000-ericsson - os=-ose - ;; - os68k) - basic_machine=m68k-none - os=-os68k - ;; - pa-hitachi) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - paragon) - basic_machine=i860-intel - os=-osf - ;; - parisc) - basic_machine=hppa-unknown - os=-linux - ;; - parisc-*) - basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` - os=-linux - ;; - pbd) - basic_machine=sparc-tti - ;; - pbb) - basic_machine=m68k-tti - ;; - pc532 | pc532-*) - basic_machine=ns32k-pc532 - ;; - pc98) - basic_machine=i386-pc - ;; - pc98-*) - basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentium | p5 | k5 | k6 | nexgen | viac3) - basic_machine=i586-pc - ;; - pentiumpro | p6 | 6x86 | athlon | athlon_*) - basic_machine=i686-pc - ;; - pentiumii | pentium2 | pentiumiii | pentium3) - basic_machine=i686-pc - ;; - pentium4) - basic_machine=i786-pc - ;; - pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) - basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentiumpro-* | p6-* | 6x86-* | athlon-*) - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentium4-*) - basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pn) - basic_machine=pn-gould - ;; - power) basic_machine=power-ibm - ;; - ppc | ppcbe) basic_machine=powerpc-unknown - ;; - ppc-* | ppcbe-*) - basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppcle | powerpclittle | ppc-le | powerpc-little) - basic_machine=powerpcle-unknown - ;; - ppcle-* | powerpclittle-*) - basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppc64) basic_machine=powerpc64-unknown - ;; - ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppc64le | powerpc64little | ppc64-le | powerpc64-little) - basic_machine=powerpc64le-unknown - ;; - ppc64le-* | powerpc64little-*) - basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ps2) - basic_machine=i386-ibm - ;; - pw32) - basic_machine=i586-unknown - os=-pw32 - ;; - rdos | rdos64) - basic_machine=x86_64-pc - os=-rdos - ;; - rdos32) - basic_machine=i386-pc - os=-rdos - ;; - rom68k) - basic_machine=m68k-rom68k - os=-coff - ;; - rm[46]00) - basic_machine=mips-siemens - ;; - rtpc | rtpc-*) - basic_machine=romp-ibm - ;; - s390 | s390-*) - basic_machine=s390-ibm - ;; - s390x | s390x-*) - basic_machine=s390x-ibm - ;; - sa29200) - basic_machine=a29k-amd - os=-udi - ;; - sb1) - basic_machine=mipsisa64sb1-unknown - ;; - sb1el) - basic_machine=mipsisa64sb1el-unknown - ;; - sde) - basic_machine=mipsisa32-sde - os=-elf - ;; - sei) - basic_machine=mips-sei - os=-seiux - ;; - sequent) - basic_machine=i386-sequent - ;; - sh) - basic_machine=sh-hitachi - os=-hms - ;; - sh5el) - basic_machine=sh5le-unknown - ;; - sh64) - basic_machine=sh64-unknown - ;; - sparclite-wrs | simso-wrs) - basic_machine=sparclite-wrs - os=-vxworks - ;; - sps7) - basic_machine=m68k-bull - os=-sysv2 - ;; - spur) - basic_machine=spur-unknown - ;; - st2000) - basic_machine=m68k-tandem - ;; - stratus) - basic_machine=i860-stratus - os=-sysv4 - ;; - strongarm-* | thumb-*) - basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - sun2) - basic_machine=m68000-sun - ;; - sun2os3) - basic_machine=m68000-sun - os=-sunos3 - ;; - sun2os4) - basic_machine=m68000-sun - os=-sunos4 - ;; - sun3os3) - basic_machine=m68k-sun - os=-sunos3 - ;; - sun3os4) - basic_machine=m68k-sun - os=-sunos4 - ;; - sun4os3) - basic_machine=sparc-sun - os=-sunos3 - ;; - sun4os4) - basic_machine=sparc-sun - os=-sunos4 - ;; - sun4sol2) - basic_machine=sparc-sun - os=-solaris2 - ;; - sun3 | sun3-*) - basic_machine=m68k-sun - ;; - sun4) - basic_machine=sparc-sun - ;; - sun386 | sun386i | roadrunner) - basic_machine=i386-sun - ;; - sv1) - basic_machine=sv1-cray - os=-unicos - ;; - symmetry) - basic_machine=i386-sequent - os=-dynix - ;; - t3e) - basic_machine=alphaev5-cray - os=-unicos - ;; - t90) - basic_machine=t90-cray - os=-unicos - ;; - tile*) - basic_machine=$basic_machine-unknown - os=-linux-gnu - ;; - tx39) - basic_machine=mipstx39-unknown - ;; - tx39el) - basic_machine=mipstx39el-unknown - ;; - toad1) - basic_machine=pdp10-xkl - os=-tops20 - ;; - tower | tower-32) - basic_machine=m68k-ncr - ;; - tpf) - basic_machine=s390x-ibm - os=-tpf - ;; - udi29k) - basic_machine=a29k-amd - os=-udi - ;; - ultra3) - basic_machine=a29k-nyu - os=-sym1 - ;; - v810 | necv810) - basic_machine=v810-nec - os=-none - ;; - vaxv) - basic_machine=vax-dec - os=-sysv - ;; - vms) - basic_machine=vax-dec - os=-vms - ;; - vpp*|vx|vx-*) - basic_machine=f301-fujitsu - ;; - vxworks960) - basic_machine=i960-wrs - os=-vxworks - ;; - vxworks68) - basic_machine=m68k-wrs - os=-vxworks - ;; - vxworks29k) - basic_machine=a29k-wrs - os=-vxworks - ;; - w65*) - basic_machine=w65-wdc - os=-none - ;; - w89k-*) - basic_machine=hppa1.1-winbond - os=-proelf - ;; - xbox) - basic_machine=i686-pc - os=-mingw32 - ;; - xps | xps100) - basic_machine=xps100-honeywell - ;; - xscale-* | xscalee[bl]-*) - basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` - ;; - ymp) - basic_machine=ymp-cray - os=-unicos - ;; - z8k-*-coff) - basic_machine=z8k-unknown - os=-sim - ;; - z80-*-coff) - basic_machine=z80-unknown - os=-sim - ;; - none) - basic_machine=none-none - os=-none - ;; - -# Here we handle the default manufacturer of certain CPU types. It is in -# some cases the only manufacturer, in others, it is the most popular. - w89k) - basic_machine=hppa1.1-winbond - ;; - op50n) - basic_machine=hppa1.1-oki - ;; - op60c) - basic_machine=hppa1.1-oki - ;; - romp) - basic_machine=romp-ibm - ;; - mmix) - basic_machine=mmix-knuth - ;; - rs6000) - basic_machine=rs6000-ibm - ;; - vax) - basic_machine=vax-dec - ;; - pdp10) - # there are many clones, so DEC is not a safe bet - basic_machine=pdp10-unknown - ;; - pdp11) - basic_machine=pdp11-dec - ;; - we32k) - basic_machine=we32k-att - ;; - sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) - basic_machine=sh-unknown - ;; - sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) - basic_machine=sparc-sun - ;; - cydra) - basic_machine=cydra-cydrome - ;; - orion) - basic_machine=orion-highlevel - ;; - orion105) - basic_machine=clipper-highlevel - ;; - mac | mpw | mac-mpw) - basic_machine=m68k-apple - ;; - pmac | pmac-mpw) - basic_machine=powerpc-apple - ;; - *-unknown) - # Make sure to match an already-canonicalized machine name. - ;; - *) - echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 - exit 1 - ;; -esac - -# Here we canonicalize certain aliases for manufacturers. -case $basic_machine in - *-digital*) - basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` - ;; - *-commodore*) - basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` - ;; - *) - ;; -esac - -# Decode manufacturer-specific aliases for certain operating systems. - -if [ x"$os" != x"" ] -then -case $os in - # First match some system type aliases - # that might get confused with valid system types. - # -solaris* is a basic system type, with this one exception. - -auroraux) - os=-auroraux - ;; - -solaris1 | -solaris1.*) - os=`echo $os | sed -e 's|solaris1|sunos4|'` - ;; - -solaris) - os=-solaris2 - ;; - -svr4*) - os=-sysv4 - ;; - -unixware*) - os=-sysv4.2uw - ;; - -gnu/linux*) - os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` - ;; - # First accept the basic system types. - # The portable systems comes first. - # Each alternative MUST END IN A *, to match a version number. - # -sysv* is not here because it comes later, after sysvr4. - -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ - | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ - | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ - | -sym* | -kopensolaris* | -plan9* \ - | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ - | -aos* | -aros* \ - | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ - | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ - | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ - | -bitrig* | -openbsd* | -solidbsd* \ - | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ - | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ - | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ - | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ - | -chorusos* | -chorusrdb* | -cegcc* \ - | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ - | -linux-newlib* | -linux-musl* | -linux-uclibc* \ - | -uxpv* | -beos* | -mpeix* | -udk* \ - | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ - | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ - | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ - | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ - | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ - | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ - | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) - # Remember, each alternative MUST END IN *, to match a version number. - ;; - -qnx*) - case $basic_machine in - x86-* | i*86-*) - ;; - *) - os=-nto$os - ;; - esac - ;; - -nto-qnx*) - ;; - -nto*) - os=`echo $os | sed -e 's|nto|nto-qnx|'` - ;; - -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ - | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ - | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) - ;; - -mac*) - os=`echo $os | sed -e 's|mac|macos|'` - ;; - -linux-dietlibc) - os=-linux-dietlibc - ;; - -linux*) - os=`echo $os | sed -e 's|linux|linux-gnu|'` - ;; - -sunos5*) - os=`echo $os | sed -e 's|sunos5|solaris2|'` - ;; - -sunos6*) - os=`echo $os | sed -e 's|sunos6|solaris3|'` - ;; - -opened*) - os=-openedition - ;; - -os400*) - os=-os400 - ;; - -wince*) - os=-wince - ;; - -osfrose*) - os=-osfrose - ;; - -osf*) - os=-osf - ;; - -utek*) - os=-bsd - ;; - -dynix*) - os=-bsd - ;; - -acis*) - os=-aos - ;; - -atheos*) - os=-atheos - ;; - -syllable*) - os=-syllable - ;; - -386bsd) - os=-bsd - ;; - -ctix* | -uts*) - os=-sysv - ;; - -nova*) - os=-rtmk-nova - ;; - -ns2 ) - os=-nextstep2 - ;; - -nsk*) - os=-nsk - ;; - # Preserve the version number of sinix5. - -sinix5.*) - os=`echo $os | sed -e 's|sinix|sysv|'` - ;; - -sinix*) - os=-sysv4 - ;; - -tpf*) - os=-tpf - ;; - -triton*) - os=-sysv3 - ;; - -oss*) - os=-sysv3 - ;; - -svr4) - os=-sysv4 - ;; - -svr3) - os=-sysv3 - ;; - -sysvr4) - os=-sysv4 - ;; - # This must come after -sysvr4. - -sysv*) - ;; - -ose*) - os=-ose - ;; - -es1800*) - os=-ose - ;; - -xenix) - os=-xenix - ;; - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) - os=-mint - ;; - -aros*) - os=-aros - ;; - -zvmoe) - os=-zvmoe - ;; - -dicos*) - os=-dicos - ;; - -nacl*) - ;; - -none) - ;; - *) - # Get rid of the `-' at the beginning of $os. - os=`echo $os | sed 's/[^-]*-//'` - echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 - exit 1 - ;; -esac -else - -# Here we handle the default operating systems that come with various machines. -# The value should be what the vendor currently ships out the door with their -# machine or put another way, the most popular os provided with the machine. - -# Note that if you're going to try to match "-MANUFACTURER" here (say, -# "-sun"), then you have to tell the case statement up towards the top -# that MANUFACTURER isn't an operating system. Otherwise, code above -# will signal an error saying that MANUFACTURER isn't an operating -# system, and we'll never get to this point. - -case $basic_machine in - score-*) - os=-elf - ;; - spu-*) - os=-elf - ;; - *-acorn) - os=-riscix1.2 - ;; - arm*-rebel) - os=-linux - ;; - arm*-semi) - os=-aout - ;; - c4x-* | tic4x-*) - os=-coff - ;; - c8051-*) - os=-elf - ;; - hexagon-*) - os=-elf - ;; - tic54x-*) - os=-coff - ;; - tic55x-*) - os=-coff - ;; - tic6x-*) - os=-coff - ;; - # This must come before the *-dec entry. - pdp10-*) - os=-tops20 - ;; - pdp11-*) - os=-none - ;; - *-dec | vax-*) - os=-ultrix4.2 - ;; - m68*-apollo) - os=-domain - ;; - i386-sun) - os=-sunos4.0.2 - ;; - m68000-sun) - os=-sunos3 - ;; - m68*-cisco) - os=-aout - ;; - mep-*) - os=-elf - ;; - mips*-cisco) - os=-elf - ;; - mips*-*) - os=-elf - ;; - or1k-*) - os=-elf - ;; - or32-*) - os=-coff - ;; - *-tti) # must be before sparc entry or we get the wrong os. - os=-sysv3 - ;; - sparc-* | *-sun) - os=-sunos4.1.1 - ;; - *-be) - os=-beos - ;; - *-haiku) - os=-haiku - ;; - *-ibm) - os=-aix - ;; - *-knuth) - os=-mmixware - ;; - *-wec) - os=-proelf - ;; - *-winbond) - os=-proelf - ;; - *-oki) - os=-proelf - ;; - *-hp) - os=-hpux - ;; - *-hitachi) - os=-hiux - ;; - i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) - os=-sysv - ;; - *-cbm) - os=-amigaos - ;; - *-dg) - os=-dgux - ;; - *-dolphin) - os=-sysv3 - ;; - m68k-ccur) - os=-rtu - ;; - m88k-omron*) - os=-luna - ;; - *-next ) - os=-nextstep - ;; - *-sequent) - os=-ptx - ;; - *-crds) - os=-unos - ;; - *-ns) - os=-genix - ;; - i370-*) - os=-mvs - ;; - *-next) - os=-nextstep3 - ;; - *-gould) - os=-sysv - ;; - *-highlevel) - os=-bsd - ;; - *-encore) - os=-bsd - ;; - *-sgi) - os=-irix - ;; - *-siemens) - os=-sysv4 - ;; - *-masscomp) - os=-rtu - ;; - f30[01]-fujitsu | f700-fujitsu) - os=-uxpv - ;; - *-rom68k) - os=-coff - ;; - *-*bug) - os=-coff - ;; - *-apple) - os=-macos - ;; - *-atari*) - os=-mint - ;; - *) - os=-none - ;; -esac -fi - -# Here we handle the case where we know the os, and the CPU type, but not the -# manufacturer. We pick the logical manufacturer. -vendor=unknown -case $basic_machine in - *-unknown) - case $os in - -riscix*) - vendor=acorn - ;; - -sunos*) - vendor=sun - ;; - -cnk*|-aix*) - vendor=ibm - ;; - -beos*) - vendor=be - ;; - -hpux*) - vendor=hp - ;; - -mpeix*) - vendor=hp - ;; - -hiux*) - vendor=hitachi - ;; - -unos*) - vendor=crds - ;; - -dgux*) - vendor=dg - ;; - -luna*) - vendor=omron - ;; - -genix*) - vendor=ns - ;; - -mvs* | -opened*) - vendor=ibm - ;; - -os400*) - vendor=ibm - ;; - -ptx*) - vendor=sequent - ;; - -tpf*) - vendor=ibm - ;; - -vxsim* | -vxworks* | -windiss*) - vendor=wrs - ;; - -aux*) - vendor=apple - ;; - -hms*) - vendor=hitachi - ;; - -mpw* | -macos*) - vendor=apple - ;; - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) - vendor=atari - ;; - -vos*) - vendor=stratus - ;; - esac - basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` - ;; -esac - -echo $basic_machine$os -exit - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "timestamp='" -# time-stamp-format: "%:y-%02m-%02d" -# time-stamp-end: "'" -# End: diff --git a/scripts/create_addon b/scripts/create_addon index afae5f87da0..0c491da7997 100755 --- a/scripts/create_addon +++ b/scripts/create_addon @@ -83,7 +83,7 @@ pack_addon() { cp $PKG_DIR/changelog.txt $ADDON_BUILD/$PKG_ADDON_ID fi - PROVIDER_NAME="openelec.tv" + PROVIDER_NAME="libreelec.tv" if [ ! -z "$PKG_MAINTAINER" ] ; then PROVIDER_NAME="$PKG_MAINTAINER" fi diff --git a/scripts/extract b/scripts/extract index 44cfef8375b..c6712862dd4 100755 --- a/scripts/extract +++ b/scripts/extract @@ -25,21 +25,18 @@ if [ -z "$3" ]; then exit 1 fi -[ -z "$PKG_URL" ] && exit 1 +[ -z "$PKG_URL" -o -z "$PKG_SOURCE_NAME" ] && exit 1 [ ! -d "$SOURCES/$1" -o ! -d "$3" ] && exit 1 -for i in $PKG_URL; do - FILE="`basename $i`" - - case $FILE in +case $PKG_SOURCE_NAME in $2) - f="$SOURCES/$1/$FILE" + f="$SOURCES/$1/$PKG_SOURCE_NAME" if [ ! -f $f ]; then - echo "error: File $FILE doesn't exists in package $1 sources directory" + echo "error: File $PKG_SOURCE_NAME doesn't exists in package $1 sources directory" echo "have you called scripts/extract before scripts/get ?" exit 1 fi - case $FILE in + case $PKG_SOURCE_NAME in *.tar) tar xf $f -C $3 ;; @@ -73,5 +70,4 @@ for i in $PKG_URL; do ;; esac ;; - esac -done +esac diff --git a/scripts/get b/scripts/get index 3a2c4d45864..de2e0123d09 100755 --- a/scripts/get +++ b/scripts/get @@ -27,7 +27,7 @@ if [ -z "$1" ]; then done fi -if [ -n "$PKG_URL" ]; then +if [ -n "$PKG_URL" -a -n "$PKG_SOURCE_NAME" ]; then mkdir -p $SOURCES/$1 # Avoid concurrent downloads of the same package @@ -38,40 +38,41 @@ if [ -n "$PKG_URL" ]; then sleep 1 done - for i in $PKG_URL; do - SOURCE_NAME="`basename $i`" - PACKAGE="$SOURCES/$1/$SOURCE_NAME" - PACKAGE_MIRROR="$DISTRO_MIRROR/$PKG_NAME/$SOURCE_NAME" - [ "$VERBOSE" != "yes" ] && WGET_OPT=-q - WGET_CMD="wget --timeout=30 --passive-ftp --no-check-certificate -c $WGET_OPT -P $SOURCES/$1" + PACKAGE="$SOURCES/$1/$PKG_SOURCE_NAME" + PACKAGE_MIRROR="$DISTRO_MIRROR/$PKG_NAME/$PKG_SOURCE_NAME" + [ "$VERBOSE" != "yes" ] && WGET_OPT=-q + WGET_CMD="wget --timeout=30 --tries=3 --passive-ftp --no-check-certificate -c $WGET_OPT -O $SOURCES/$1/$PKG_SOURCE_NAME" - NBWGET="1" + NBWGET="1" - STAMP="$PACKAGE.url" - MD5SUM="$PACKAGE.md5" + STAMP="$PACKAGE.url" + MD5SUM="$PACKAGE.md5" - if [ -f "$STAMP" ]; then - [ "`cat $STAMP`" = "$i" ] && continue - fi - DL="yes" + DL="yes" + if [ -f "$STAMP" ]; then + [ "`cat $STAMP`" == "$PKG_URL" ] && DL="no" + fi + if [ "$DL" == "yes" ]; then rm -f $STAMP printf "%${BUILD_INDENT}c ${boldcyan}GET${endcolor} $1\n" ' '>&$SILENT_OUT export BUILD_INDENT=$((${BUILD_INDENT:-1}+$BUILD_INDENT_SIZE)) - until [ -f "$STAMP" ] || $WGET_CMD $i || $WGET_CMD $PACKAGE_MIRROR; do + until [ -f "$STAMP" ] || $WGET_CMD $PKG_URL || $WGET_CMD $PACKAGE_MIRROR; do NBWGET=$(($NBWGET+1)) if [ "$NBWGET" -gt "10" ]; then - echo -e "\nCant't get $1 sources : $i\n Try later !!" + echo -e "\nCant't get $1 sources : $PKG_URL\n Try later !!" exit 1 fi done - echo $i > $STAMP + echo $PKG_URL > $STAMP md5sum -t $PACKAGE > $MD5SUM rm -f $BUILD_BASE*/$STAMPS_NOARCH/$1/unpack rm -f $BUILD_BASE*/$STAMPS_NOARCH/$1/build - done + fi fi + +exit 0 diff --git a/scripts/image b/scripts/image index a8d5eff183f..02ee4776e6c 100755 --- a/scripts/image +++ b/scripts/image @@ -33,27 +33,51 @@ $SCRIPTS/build populatefs:host BUILD_DATE=`date +%Y%m%d%H%M%S` -if [ "$OPENELEC_VERSION" = devel ]; then +GIT_HASH=$(git rev-parse HEAD) + +if [ "$LIBREELEC_VERSION" = "devel" ]; then if ! GIT_BUILD=$(git rev-list --count HEAD 2>/dev/null) then GIT_BUILD=$(git rev-list HEAD | wc -l) fi - GIT_HASH=$(git rev-parse HEAD) GIT_ABBREV=$(git log -1 --pretty=format:%h) - DEVEL_VERSION=$OPENELEC_VERSION - OPENELEC_VERSION=$OPENELEC_VERSION-$BUILD_DATE-r$GIT_BUILD-g$GIT_ABBREV + DEVEL_VERSION=$LIBREELEC_VERSION + LIBREELEC_VERSION=$LIBREELEC_VERSION-$BUILD_DATE-r$GIT_BUILD-g$GIT_ABBREV +fi + +LIBREELEC_VERSION=$LIBREELEC_VERSION-devel-$BUILD_DATE + +# Get origin url, fix git:// and git@github.com: urls if necessary +ORIGIN_URL="$(git remote -v | awk '$1 == "origin" { print $2 }' | head -1 | sed 's#\.git$##;s#^git:#https:#;s#^git@github\.com:#https://github.com/#')" + +if [ "$OFFICIAL" = "yes" ]; then + LIBREELEC_BUILD="official" +else + LIBREELEC_BUILD="community" +fi + +if [ -n "$CUSTOM_VERSION" ]; then + LIBREELEC_VERSION="$CUSTOM_VERSION" +fi + +if [ -n "$CUSTOM_GIT_HASH" ]; then + GIT_HASH="$CUSTOM_GIT_HASH" fi -TARGET_VERSION="$PROJECT.$TARGET_ARCH-$OPENELEC_VERSION" +TARGET_VERSION="$PROJECT.$TARGET_ARCH-$LIBREELEC_VERSION" IMAGE_NAME="$DISTRONAME-$TARGET_VERSION" if [ "$DEVEL_VERSION" = "devel" ] ; then - IMAGE_NAME="$DISTRONAME-$PROJECT.$TARGET_ARCH-$OS_VERSION-$OPENELEC_VERSION" + IMAGE_NAME="$DISTRONAME-$PROJECT.$TARGET_ARCH-$OS_VERSION-$LIBREELEC_VERSION" fi if [ "$PROJECT" == "imx6" -a -n "$SYSTEM" ]; then IMAGE_NAME="$IMAGE_NAME-$SYSTEM" fi +if [ -n "$CUSTOM_IMAGE_NAME" ]; then + IMAGE_NAME="$CUSTOM_IMAGE_NAME" +fi + if [ -n "$IMAGE_SUFFIX" ]; then IMAGE_NAME="$IMAGE_NAME-$IMAGE_SUFFIX" fi @@ -94,21 +118,16 @@ fi # create /etc/os-release echo -e "NAME=\"$DISTRONAME\"" > $INSTALL/etc/os-release - echo -e "VERSION=\"$OPENELEC_VERSION\"" >> $INSTALL/etc/os-release - echo -e "ID=\"openelec\"" >> $INSTALL/etc/os-release + echo -e "VERSION=\"$LIBREELEC_VERSION\"" >> $INSTALL/etc/os-release + echo -e "ID=\"libreelec\"" >> $INSTALL/etc/os-release echo -e "VERSION_ID=\"$OS_VERSION\"" >> $INSTALL/etc/os-release - echo -e "PRETTY_NAME=\"$DISTRONAME ($([ "$OFFICIAL" = "yes" ] && echo "official" || echo "community")) - Version: $OPENELEC_VERSION\"" >> $INSTALL/etc/os-release - echo -e "HOME_URL=\"http://www.openelec.tv\"" >> $INSTALL/etc/os-release - echo -e "BUG_REPORT_URL=\"https://github.com/OpenELEC/OpenELEC.tv\"" >> $INSTALL/etc/os-release - if [ -n "$GIT_HASH" ]; then - echo -e "BUILD_ID=\"$GIT_HASH\"" >> $INSTALL/etc/os-release - fi + echo -e "PRETTY_NAME=\"$DISTRONAME ($LIBREELEC_BUILD) - Version: $LIBREELEC_VERSION\"" >> $INSTALL/etc/os-release + echo -e "HOME_URL=\"https://libreelec.tv\"" >> $INSTALL/etc/os-release + echo -e "BUG_REPORT_URL=\"$ORIGIN_URL\"" >> $INSTALL/etc/os-release + echo -e "BUILD_ID=\"$GIT_HASH\"" >> $INSTALL/etc/os-release echo -e "OPENELEC_ARCH=\"$PROJECT.$TARGET_ARCH\"" >> $INSTALL/etc/os-release - if [ "$OFFICIAL" = "yes" ]; then - echo -e "OPENELEC_BUILD=\"official\"" >> $INSTALL/etc/os-release - else - echo -e "OPENELEC_BUILD=\"community\"" >> $INSTALL/etc/os-release - fi + echo -e "LIBREELEC_ARCH=\"$PROJECT.$TARGET_ARCH\"" >> $INSTALL/etc/os-release + echo -e "LIBREELEC_BUILD=\"$LIBREELEC_BUILD\"" >> $INSTALL/etc/os-release # create /etc/issue echo "$GREETING0" > $INSTALL/etc/issue @@ -116,8 +135,8 @@ fi echo "$GREETING2" >> $INSTALL/etc/issue echo "$GREETING3" >> $INSTALL/etc/issue echo "$GREETING4" >> $INSTALL/etc/issue - echo "$DISTRONAME ($([ "$OFFICIAL" = "yes" ] && echo "official" || echo "community")) Version: $OPENELEC_VERSION" >> $INSTALL/etc/issue - if [ -n "$GIT_HASH" ]; then + echo "$DISTRONAME ($LIBREELEC_BUILD) Version: $LIBREELEC_VERSION" >> $INSTALL/etc/issue + if [ "$DEVEL_VERSION" = "devel" ] ; then echo "$DISTRONAME git: $GIT_HASH" >> $INSTALL/etc/issue fi @@ -164,7 +183,9 @@ fi # Devtools... (not for Release) [ "$TESTING" = "yes" ] && $SCRIPTS/install testing - [ "$DEVTOOLS" = "yes" ] && $SCRIPTS/install debug + +# Install gdb in all builds, including releases + $SCRIPTS/install debug # OEM packages [ "$OEM_SUPPORT" = "yes" ] && $SCRIPTS/install oem @@ -181,10 +202,10 @@ fi fi # copy vendor related files to filesystem - if [ -d "$HOME/.openelec/filesystem" ]; then - cp -PR $HOME/.openelec/filesystem/* $INSTALL + if [ -d "$HOME/.libreelec/filesystem" ]; then + cp -PR $HOME/.libreelec/filesystem/* $INSTALL # install project specific systemd services - for service in $HOME/.openelec/filesystem/usr/lib/systemd/system/*.service ; do + for service in $HOME/.libreelec/filesystem/usr/lib/systemd/system/*.service ; do if [ -f "$service" ] ; then enable_service $(basename $service) fi @@ -192,10 +213,10 @@ fi fi # copy vendor project related files to filesystem - if [ -d "$HOME/.openelec/projects/$PROJECT/filesystem" ]; then - cp -PR $HOME/.openelec/projects/$PROJECT/filesystem/* $INSTALL + if [ -d "$HOME/.libreelec/projects/$PROJECT/filesystem" ]; then + cp -PR $HOME/.libreelec/projects/$PROJECT/filesystem/* $INSTALL # install project specific systemd services - for service in $HOME/.openelec/projects/$PROJECT/filesystem/usr/lib/systemd/system/*.service ; do + for service in $HOME/.libreelec/projects/$PROJECT/filesystem/usr/lib/systemd/system/*.service ; do if [ -f "$service" ] ; then enable_service $(basename $service) fi @@ -242,7 +263,7 @@ fi # set permissions chmod 0644 $TARGET_IMG/$IMAGE_NAME.system - if [ "$1" = "release" -o "$1" = "mkimage" -o "$1" = "amlpkg" ]; then + if [ "$1" = "release" -o "$1" = "mkimage" -o "$1" = "amlpkg" -o "$1" = "noobs" ]; then RELEASE_DIR="target/$IMAGE_NAME" @@ -327,7 +348,7 @@ fi tar cf $TARGET_IMG/$IMAGE_NAME.tar -C target $IMAGE_NAME # create image files if requested - if [ "$1" = "mkimage" -a -n "$BOOTLOADER" ]; then + if [[ ( "$1" = "amlpkg" || "$1" = "noobs" || "$1" = "mkimage" ) && -n "$BOOTLOADER" ]]; then # projects can set KERNEL_NAME (kernel.img) if [ -z "$KERNEL_NAME" ] ; then KERNEL_NAME="KERNEL" @@ -356,6 +377,8 @@ fi UUID_STORAGE="$(uuidgen)" \ UBOOT_SYSTEM="$UBOOT_SYSTEM" \ EXTRA_CMDLINE="$EXTRA_CMDLINE" \ + SYSTEM_SIZE="$SYSTEM_SIZE" \ + SYSTEM_PART_START="$SYSTEM_PART_START" \ $SCRIPTS/mkimage fi @@ -400,6 +423,8 @@ fi echo "Creating Amlogic ZIP auto-install package" pushd sign > /dev/null echo --update_package=/sdcard/$IMAGE_NAME-update.zip > factory_update_param.aml + echo --wipe_data >> factory_update_param.aml + echo --wipe_cache >> factory_update_param.aml cp $INSTALL_SRC_DIR/files/recovery.img . if [ -f $INSTALL_SRC_DIR/files/aml_autoscript ]; then cp $INSTALL_SRC_DIR/files/aml_autoscript . @@ -411,111 +436,125 @@ fi # copy update package to target directory cp sign/$IMAGE_NAME-update.zip $TARGET_IMG popd > /dev/null - fi - # cleanup release dir - rm -rf $RELEASE_DIR + elif [ "$1" = "noobs" ]; then - elif [ "$1" = "noobs" ]; then + RELEASE_DIR="$TARGET_IMG/${IMAGE_NAME}-$1" - RELEASE_DIR="$TARGET_IMG/${IMAGE_NAME}-$1" + # cleanup + rm -rf $RELEASE_DIR - # cleanup - rm -rf $RELEASE_DIR + # create release dir + mkdir -p $RELEASE_DIR/${DISTRONAME}_${PROJECT} - # create release dir - mkdir -p $RELEASE_DIR/${DISTRONAME}_${PROJECT} - - cp -PR $DISTRO_DIR/$DISTRO/${DISTRONAME}.png $RELEASE_DIR/${DISTRONAME}_${PROJECT}/${DISTRONAME}_${PROJECT}.png - cp -PR $ROOT/config/noobs/os.json $RELEASE_DIR/${DISTRONAME}_${PROJECT} - cp -PR $ROOT/config/noobs/partition_setup.sh $RELEASE_DIR/${DISTRONAME}_${PROJECT} - cp -PR $ROOT/config/noobs/partitions.json $RELEASE_DIR/${DISTRONAME}_${PROJECT} - if [ -d $DISTRO_DIR/$DISTRO/noobs/marketing ]; then - tar cf $RELEASE_DIR/${DISTRONAME}_${PROJECT}/marketing.tar -C $DISTRO_DIR/$DISTRO/noobs/marketing . - else - tar cf $RELEASE_DIR/${DISTRONAME}_${PROJECT}/marketing.tar -C $ROOT/config/noobs/marketing . - fi - cp $ROOT/README* $RELEASE_DIR/${DISTRONAME}_${PROJECT} - cp $ROOT/CHANGELOG $RELEASE_DIR/${DISTRONAME}_${PROJECT}/release_notes.txt - - - sed -e "s%@DISTRONAME@%$DISTRONAME%g" \ - -e "s%@PROJECT@%$PROJECT%g" \ - -e "s%@OPENELEC_VERSION@%$OPENELEC_VERSION%g" \ - -e "s%@RELEASE_DATE@%$(date +%F)%g" \ - -e "s%@KERNEL_VERSION@%$(kernel_version)%g" \ - -e "s%@DESCRIPTION@%$DESCRIPTION%g" \ - -e "s%@ROOT_PASSWORD@%$ROOT_PASSWORD%g" \ - -e "s%@NOOBS_SUPPORTED_MODELS@%$NOOBS_SUPPORTED_MODELS%g" \ - -e "s%@NOOBS_HEX@%$NOOBS_HEX%g" \ - -i $RELEASE_DIR/${DISTRONAME}_${PROJECT}/os.json - - sed -e "s%@DISTRONAME@%$DISTRONAME%g" \ - -e "s%@PROJECT@%$PROJECT%g" \ - -i $RELEASE_DIR/${DISTRONAME}_${PROJECT}/partitions.json - - # create System dir - mkdir -p $RELEASE_DIR/${DISTRONAME}_${PROJECT}/System - - BOOTLOADER_DIR=`find $PACKAGES -type d -name $BOOTLOADER 2>/dev/null` - if [ -d "$BOOTLOADER_DIR"/files/3rdparty/bootloader/ ]; then - cp -PR $BOOTLOADER_DIR/files/3rdparty/bootloader/* $RELEASE_DIR/${DISTRONAME}_${PROJECT}/System - fi - - # copy Bootloader - cp -PR $BUILD/bcm2835-bootloader-*/LICENCE* $RELEASE_DIR/${DISTRONAME}_${PROJECT}/System/ - cp -PR $BUILD/bcm2835-bootloader-*/bootcode.bin $RELEASE_DIR/${DISTRONAME}_${PROJECT}/System/ - cp -PR $BUILD/bcm2835-bootloader-*/fixup_x.dat $RELEASE_DIR/${DISTRONAME}_${PROJECT}/System/fixup.dat - cp -PR $BUILD/bcm2835-bootloader-*/start_x.elf $RELEASE_DIR/${DISTRONAME}_${PROJECT}/System/start.elf - - # copy system files - cp $TARGET_IMG/$IMAGE_NAME.system $RELEASE_DIR/${DISTRONAME}_${PROJECT}/System/SYSTEM - cp $TARGET_IMG/$IMAGE_NAME.kernel $RELEASE_DIR/${DISTRONAME}_${PROJECT}/System/kernel.img - - for dtb in $INSTALL/usr/share/bootloader/*.dtb ; do - if [ -f $dtb ]; then - cp -PR $dtb $RELEASE_DIR/${DISTRONAME}_${PROJECT}/System + if [ -f $DISTRO_DIR/$DISTRO/${DISTRONAME}_40x40.png ]; then + cp -PR $DISTRO_DIR/$DISTRO/${DISTRONAME}_40x40.png $RELEASE_DIR/${DISTRONAME}_${PROJECT}/${DISTRONAME}_${PROJECT}.png + else + cp -PR $DISTRO_DIR/$DISTRO/${DISTRONAME}.png $RELEASE_DIR/${DISTRONAME}_${PROJECT}/${DISTRONAME}_${PROJECT}.png fi - done - - for overlay in $INSTALL/usr/share/bootloader/overlays/* ; do - if [ -f $overlay ]; then - mkdir -p $RELEASE_DIR/${DISTRONAME}_${PROJECT}/System/overlays - cp -PR $overlay $RELEASE_DIR/${DISTRONAME}_${PROJECT}/System/overlays + cp -PR $ROOT/config/noobs/os.json $RELEASE_DIR/${DISTRONAME}_${PROJECT} + cp -PR $ROOT/config/noobs/partition_setup.sh $RELEASE_DIR/${DISTRONAME}_${PROJECT} + cp -PR $ROOT/config/noobs/partitions.json $RELEASE_DIR/${DISTRONAME}_${PROJECT} + if [ -d $DISTRO_DIR/$DISTRO/noobs/marketing ]; then + tar cf $RELEASE_DIR/${DISTRONAME}_${PROJECT}/marketing.tar -C $DISTRO_DIR/$DISTRO/noobs/marketing . + else + tar cf $RELEASE_DIR/${DISTRONAME}_${PROJECT}/marketing.tar -C $ROOT/config/noobs/marketing . fi - done + cp $ROOT/README* $RELEASE_DIR/${DISTRONAME}_${PROJECT} + cp $ROOT/CHANGELOG $RELEASE_DIR/${DISTRONAME}_${PROJECT}/release_notes.txt - # create md5sum's - ( cd $RELEASE_DIR/${DISTRONAME}_${PROJECT}/System; - md5sum -t SYSTEM > SYSTEM.md5; - md5sum -t kernel.img > kernel.img.md5; - ) - # copy additional files - mkdir -p $RELEASE_DIR/${DISTRONAME}_${PROJECT}/System/licenses - cp $ROOT/licenses/* $RELEASE_DIR/${DISTRONAME}_${PROJECT}/System/licenses + sed -e "s%@DISTRONAME@%$DISTRONAME%g" \ + -e "s%@PROJECT@%$PROJECT%g" \ + -e "s%@LIBREELEC_VERSION@%$LIBREELEC_VERSION%g" \ + -e "s%@RELEASE_DATE@%$(date +%F)%g" \ + -e "s%@KERNEL_VERSION@%$(kernel_version)%g" \ + -e "s%@DESCRIPTION@%$DESCRIPTION%g" \ + -e "s%@ROOT_PASSWORD@%$ROOT_PASSWORD%g" \ + -e "s%@NOOBS_SUPPORTED_MODELS@%$NOOBS_SUPPORTED_MODELS%g" \ + -e "s%@NOOBS_HEX@%$NOOBS_HEX%g" \ + -i $RELEASE_DIR/${DISTRONAME}_${PROJECT}/os.json - # create Storage dir - mkdir -p $RELEASE_DIR/${DISTRONAME}_${PROJECT}/Storage - - # remove an previous created release tarball - rm -rf $RELEASE_DIR/${DISTRONAME}_${PROJECT}/${DISTRONAME}_${PROJECT}_System.tar.xz - rm -rf $RELEASE_DIR/${DISTRONAME}_${PROJECT}/${DISTRONAME}_${PROJECT}_Storage.tar.xz + sed -e "s%@DISTRONAME@%$DISTRONAME%g" \ + -e "s%@PROJECT@%$PROJECT%g" \ + -e "s%@SYSTEM_SIZE@%$SYSTEM_SIZE%g" \ + -i $RELEASE_DIR/${DISTRONAME}_${PROJECT}/partitions.json - # create filesystem tarballs - tar cJf $RELEASE_DIR/${DISTRONAME}_${PROJECT}/${DISTRONAME}_${PROJECT}_System.tar.xz -C $RELEASE_DIR/${DISTRONAME}_${PROJECT}/System/ . - tar cJf $RELEASE_DIR/${DISTRONAME}_${PROJECT}/${DISTRONAME}_${PROJECT}_Storage.tar.xz -C $RELEASE_DIR/${DISTRONAME}_${PROJECT}/Storage/ . + # create System dir + mkdir -p $RELEASE_DIR/${DISTRONAME}_${PROJECT}/System - # remove an filesystem dirs - rm -rf $RELEASE_DIR/${DISTRONAME}_${PROJECT}/System - rm -rf $RELEASE_DIR/${DISTRONAME}_${PROJECT}/Storage + # Get total size for partition spec + sz=`du -s $RELEASE_DIR/${DISTRONAME}_${PROJECT}/ | cut -f1` + sz=$((sz/1000)) + sed -e "s/@TARBALL_SIZE@/$sz/g" \ + -i $RELEASE_DIR/${DISTRONAME}_${PROJECT}/partitions.json - # remove an previous created release tarball - rm -rf $TARGET_IMG/${IMAGE_NAME}-$1.tar + # remove an previous created release tarball + rm -rf $TARGET_IMG/${IMAGE_NAME}-$1.tar - # create release tarball - tar cf $TARGET_IMG/${IMAGE_NAME}-$1.tar -C $TARGET ${IMAGE_NAME}-$1 + # create release tarball + tar cf $TARGET_IMG/${IMAGE_NAME}-$1.tar -C $TARGET ${IMAGE_NAME}-$1 + BOOTLOADER_DIR=`find $PACKAGES -type d -name $BOOTLOADER 2>/dev/null` + if [ -d "$BOOTLOADER_DIR"/files/3rdparty/bootloader/ ]; then + cp -PR $BOOTLOADER_DIR/files/3rdparty/bootloader/* $RELEASE_DIR/${DISTRONAME}_${PROJECT}/System + fi + + # copy Bootloader + cp -PR $BUILD/bcm2835-bootloader-*/LICENCE* $RELEASE_DIR/${DISTRONAME}_${PROJECT}/System/ + cp -PR $BUILD/bcm2835-bootloader-*/bootcode.bin $RELEASE_DIR/${DISTRONAME}_${PROJECT}/System/ + cp -PR $BUILD/bcm2835-bootloader-*/fixup_x.dat $RELEASE_DIR/${DISTRONAME}_${PROJECT}/System/fixup.dat + cp -PR $BUILD/bcm2835-bootloader-*/start_x.elf $RELEASE_DIR/${DISTRONAME}_${PROJECT}/System/start.elf + [ -f $BUILD/bcm2835-bootloader-*/dt-blob.bin ] && cp -PR $BUILD/bcm2835-bootloader-*/dt-blob.bin $RELEASE_DIR/${DISTRONAME}_${PROJECT}/System/dt-blob.bin + + # copy system files + cp $TARGET_IMG/$IMAGE_NAME.system $RELEASE_DIR/${DISTRONAME}_${PROJECT}/System/SYSTEM + cp $TARGET_IMG/$IMAGE_NAME.kernel $RELEASE_DIR/${DISTRONAME}_${PROJECT}/System/kernel.img + + for dtb in $INSTALL/usr/share/bootloader/*.dtb ; do + if [ -f $dtb ]; then + cp -PR $dtb $RELEASE_DIR/${DISTRONAME}_${PROJECT}/System + fi + done + + for overlay in $INSTALL/usr/share/bootloader/overlays/* ; do + if [ -f $overlay ]; then + mkdir -p $RELEASE_DIR/${DISTRONAME}_${PROJECT}/System/overlays + cp -PR $overlay $RELEASE_DIR/${DISTRONAME}_${PROJECT}/System/overlays + fi + done + + # create md5sum's + ( cd $RELEASE_DIR/${DISTRONAME}_${PROJECT}/System; + md5sum -t SYSTEM > SYSTEM.md5; + md5sum -t kernel.img > kernel.img.md5; + ) + + # copy additional files + mkdir -p $RELEASE_DIR/${DISTRONAME}_${PROJECT}/System/licenses + cp $ROOT/licenses/* $RELEASE_DIR/${DISTRONAME}_${PROJECT}/System/licenses + + # create Storage dir + mkdir -p $RELEASE_DIR/${DISTRONAME}_${PROJECT}/Storage + + # remove an previous created release tarball + rm -rf $RELEASE_DIR/${DISTRONAME}_${PROJECT}/${DISTRONAME}_${PROJECT}_System.tar.xz + rm -rf $RELEASE_DIR/${DISTRONAME}_${PROJECT}/${DISTRONAME}_${PROJECT}_Storage.tar.xz + + # create filesystem tarballs + tar cJf $RELEASE_DIR/${DISTRONAME}_${PROJECT}/${DISTRONAME}_${PROJECT}_System.tar.xz -C $RELEASE_DIR/${DISTRONAME}_${PROJECT}/System/ . + tar cJf $RELEASE_DIR/${DISTRONAME}_${PROJECT}/${DISTRONAME}_${PROJECT}_Storage.tar.xz -C $RELEASE_DIR/${DISTRONAME}_${PROJECT}/Storage/ . + + # remove an filesystem dirs + rm -rf $RELEASE_DIR/${DISTRONAME}_${PROJECT}/System + rm -rf $RELEASE_DIR/${DISTRONAME}_${PROJECT}/Storage + + # remove an previous created release tarball + rm -rf $TARGET_IMG/${IMAGE_NAME}-$1.tar + + # create release tarball + tar cf $TARGET_IMG/${IMAGE_NAME}-$1.tar -C $TARGET ${IMAGE_NAME}-$1 + fi # cleanup release dir rm -rf $RELEASE_DIR fi diff --git a/scripts/mkimage b/scripts/mkimage index 2d7f3105624..0453fcb77fd 100755 --- a/scripts/mkimage +++ b/scripts/mkimage @@ -27,7 +27,11 @@ OE_TMP=$(mktemp -d) SAVE_ERROR="$OE_TMP/save_error" - SYSTEM_SIZE=512 + if [ -z "$SYSTEM_SIZE" -o -z "$SYSTEM_PART_START" ]; then + echo "mkimage: SYSTEM_SIZE and SYSTEM_PART_START must be configured!" + exit 1 + fi + STORAGE_SIZE=32 # STORAGE_SIZE must be >= 32 ! DISK_SIZE=$(( $SYSTEM_SIZE + $STORAGE_SIZE + 4 )) @@ -74,8 +78,8 @@ trap cleanup SIGINT # create part1 echo "image: creating part1..." - SYSTEM_PART_END=$(( $SYSTEM_SIZE * 1024 * 1024 / 512 + 2048 )) - parted -s "$DISK" -a min unit s mkpart primary fat32 2048 $SYSTEM_PART_END + SYSTEM_PART_END=$(( ($SYSTEM_SIZE * 1024 * 1024 / 512) + $SYSTEM_PART_START )) + parted -s "$DISK" -a min unit s mkpart primary fat32 $SYSTEM_PART_START $SYSTEM_PART_END if [ "$BOOTLOADER" = "syslinux" ]; then parted -s "$DISK" set 1 legacy_boot on else @@ -100,7 +104,7 @@ fi # create filesystem on part1 echo "image: creating filesystem on part1..." - OFFSET=$(( 2048 * 512 )) + OFFSET=$(( $SYSTEM_PART_START * 512 )) HEADS=4 TRACKS=32 SECTORS=$(( $SYSTEM_SIZE * 1024 * 1024 / 512 / $HEADS / $TRACKS )) @@ -145,6 +149,9 @@ EOF echo "image: copying files to part1..." mcopy $TARGET_IMG/$IMAGE_NAME.kernel "::/$KERNEL_NAME" mcopy $TARGET_IMG/$IMAGE_NAME.system ::/SYSTEM + mcopy $RELEASE_DIR/target/KERNEL.md5 "::/$KERNEL_NAME.md5" + mcopy $RELEASE_DIR/target/SYSTEM.md5 ::/SYSTEM.md5 + mmd EFI EFI/BOOT mcopy $ROOT/$TOOLCHAIN/share/syslinux/bootx64.efi ::/EFI/BOOT mcopy $ROOT/$TOOLCHAIN/share/syslinux/ldlinux.e64 ::/EFI/BOOT @@ -162,10 +169,17 @@ EOF echo "image: copying files to part1..." mcopy $TARGET_IMG/$IMAGE_NAME.kernel "::/$KERNEL_NAME" mcopy $TARGET_IMG/$IMAGE_NAME.system ::/SYSTEM + mcopy $RELEASE_DIR/target/KERNEL.md5 "::/$KERNEL_NAME.md5" + mcopy $RELEASE_DIR/target/SYSTEM.md5 ::/SYSTEM.md5 + mcopy $RELEASE_DIR/3rdparty/bootloader/bootcode.bin :: mcopy $RELEASE_DIR/3rdparty/bootloader/fixup.dat :: mcopy $RELEASE_DIR/3rdparty/bootloader/start.elf :: mcopy $RELEASE_DIR/3rdparty/bootloader/config.txt :: + + if [ -f $RELEASE_DIR/3rdparty/bootloader/dt-blob.bin ]; then + mcopy $RELEASE_DIR/3rdparty/bootloader/dt-blob.bin :: + fi for dtb in $RELEASE_DIR/3rdparty/bootloader/*.dtb ; do if [ -f $dtb ] ; then @@ -202,11 +216,17 @@ elif [ "$BOOTLOADER" = "u-boot" ]; then elif [ -f "$RELEASE_DIR/3rdparty/bootloader/u-boot-fuse" ]; then # allow custom dd script for vendor specific fusing . $RELEASE_DIR/3rdparty/bootloader/u-boot-fuse + elif [ -f "$RELEASE_DIR/3rdparty/bootloader/u-boot" ]; then + dd if="$RELEASE_DIR/3rdparty/bootloader/bl1" of="$DISK" conv=fsync,notrunc bs=1 count=442 >"$SAVE_ERROR" 2>&1 || show_error + dd if="$RELEASE_DIR/3rdparty/bootloader/bl1" of="$DISK" conv=fsync,notrunc bs=512 skip=1 seek=1 >"$SAVE_ERROR" 2>&1 || show_error + dd if="$RELEASE_DIR/3rdparty/bootloader/u-boot" of="$DISK" conv=fsync,notrunc bs=512 seek=97 >"$SAVE_ERROR" 2>&1 || show_error fi echo "image: copying files to part1..." mcopy $TARGET_IMG/$IMAGE_NAME.kernel "::/$KERNEL_NAME" mcopy $TARGET_IMG/$IMAGE_NAME.system ::/SYSTEM + mcopy $RELEASE_DIR/target/KERNEL.md5 "::/$KERNEL_NAME.md5" + mcopy $RELEASE_DIR/target/SYSTEM.md5 ::/SYSTEM.md5 if [ -n "$UBOOT_SYSTEM" -a -f "$RELEASE_DIR/3rdparty/bootloader/u-boot-$UBOOT_SYSTEM.img" ]; then mcopy "$RELEASE_DIR/3rdparty/bootloader/u-boot-$UBOOT_SYSTEM.img" ::/u-boot.img diff --git a/scripts/unpack b/scripts/unpack index df92052d123..897da566ff9 100755 --- a/scripts/unpack +++ b/scripts/unpack @@ -85,8 +85,12 @@ else fi fi -if [ -n "$PKG_SOURCE_DIR" ]; then - mv $BUILD/$PKG_SOURCE_DIR $BUILD/$PKG_NAME-$PKG_VERSION +if [ ! -d $BUILD/$PKG_NAME-$PKG_VERSION ]; then + if [ -n "$PKG_SOURCE_DIR" ]; then + mv $BUILD/$PKG_SOURCE_DIR $BUILD/$PKG_NAME-$PKG_VERSION + elif [ -d $BUILD/$PKG_NAME-$PKG_VERSION* ]; then + mv $BUILD/$PKG_NAME-$PKG_VERSION* $BUILD/$PKG_NAME-$PKG_VERSION + fi fi if [ -d "$PKG_DIR/sources" ]; then @@ -117,6 +121,7 @@ for i in $PKG_DIR/patches/$PKG_NAME-*.patch \ $PKG_DIR/patches/$PKG_VERSION/*.patch \ $PKG_DIR/patches/$PKG_VERSION/$PATCH_ARCH/*.patch \ $PROJECT_DIR/$PROJECT/patches/$PKG_NAME/*.patch \ + $PROJECT_DIR/$PROJECT/patches/$PKG_NAME/$PKG_VERSION/*.patch \ $HOME/.openelec/patches/$PKG_NAME/*.patch \ $HOME/.openelec/projects/$PROJECT/patches/$PKG_NAME/*.patch; do @@ -128,6 +133,8 @@ for i in $PKG_DIR/patches/$PKG_NAME-*.patch \ PATCH_DESC="($PKG_VERSION - $PATCH_ARCH)" elif [ $(dirname $i) = "$PROJECT_DIR/$PROJECT/patches/$PKG_NAME" ]; then PATCH_DESC="(project)" + elif [ $(dirname $i) = "$PROJECT_DIR/$PROJECT/patches/$PKG_NAME/$PKG_VERSION" ]; then + PATCH_DESC="(project - $PKG_VERSION)" elif [ $(dirname $i) = "$HOME/.openelec/patches/$PKG_NAME" ]; then PATCH_DESC="(vendor)" elif [ $(dirname $i) = "$HOME/.openelec/projects/$PROJECT/patches/$PKG_NAME" ]; then @@ -149,12 +156,14 @@ if [ "$(type -t post_patch)" = "function" ]; then fi for config in `find $BUILD/$1* -name config.guess | sed 's/config.guess//'`; do - printf "%${BUILD_INDENT}c ${boldyellow}FIXCONFIG${endcolor} $config\n" ' '>&$SILENT_OUT + if [ ! "$PKG_NAME" == "configtools" ] ; then + printf "%${BUILD_INDENT}c ${boldyellow}FIXCONFIG${endcolor} $config\n" ' ' - [ -f "$config/config.guess" ] && cp -f $SCRIPTS/configtools/config.guess $config - [ -f "$config/config.sub" ] && cp -f $SCRIPTS/configtools/config.sub $config - [ -f "$config/configure.guess" ] && cp -f $SCRIPTS/configtools/config.guess $config/configure.guess - [ -f "$config/configure.sub" ] && cp -f $SCRIPTS/configtools/config.sub $config/configure.sub + [ -f "$config/config.guess" -a -f $ROOT/$TOOLCHAIN/configtools/config.guess ] && \ + cp -f $ROOT/$TOOLCHAIN/configtools/config.guess $config + [ -f "$config/config.sub" -a -f $ROOT/$TOOLCHAIN/configtools/config.sub ] && \ + cp -f $ROOT/$TOOLCHAIN/configtools/config.sub $config + fi done rm -f $STAMPS/$1/build_* diff --git a/tools/RPi/README.md b/tools/RPi/README.md new file mode 100644 index 00000000000..ebc4a5fc5e4 --- /dev/null +++ b/tools/RPi/README.md @@ -0,0 +1,63 @@ +## Raspberry Pi Linux Kernel Patch Instructions + +This is needed because we drop a few commits from the upstream Raspberry Pi linux repo + +The commit id's will change anytime the Raspberry Pi linux kernel is rebase against upstream + +#### Clone the repo +``` +git clone https://github.com/raspberrypi/linux.git +cd linux +``` + +#### Checkout the branch +``` +git checkout rpi-4.4.y +``` + +#### Find the rebase commit, for example +``` +git log --grep 'Linux 4.4.6' +``` +#### This will show a commit +``` +commit 0d1912303e54ed1b2a371be0bba51c384dd57326 +Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +Date: Wed Mar 16 08:43:17 2016 -0700 + + Linux 4.4.6 +``` + +#### We need to rebase against this commit sha1 +``` +git rebase -i 0d1912303e54ed1b2a371be0bba51c384dd57326 +``` + +#### Then we need to remove some commits. These lines need to be removed +``` +pick 9ee3100 Add non-mainline source for rtl8192cu wireless driver version v4.0.2_9000 as this is widely used. Disabled older rtlwifi driver +pick 143ad45 rtl8192c_rf6052: PHY_RFShadowRefresh(): fix off-by-one +pick 95641b7 rtl8192cu: Add PID for D-Link DWA 131 +pick fbd8454 Added Device IDs for August DVB-T 205 +``` + +#### Then we can create the patch using the same commit sha1 +``` +git format-patch 0d1912303e54ed1b2a371be0bba51c384dd57326 --cover-letter --stdout > linux-01-RPi_support.patch +``` + +---- +#### Rebase conflict + +``` +git reset --hard HEAD +git checkout master +git branch -D rpi-4.4.y +git pull +git checkout rpi-4.4.y +``` + +---- +#### Further Discussion + +https://github.com/LibreELEC/LibreELEC.tv/pull/31 diff --git a/tools/RPi/gen-rpi-kodi-patch.sh b/tools/RPi/gen-rpi-kodi-patch.sh new file mode 100755 index 00000000000..444a45bb594 --- /dev/null +++ b/tools/RPi/gen-rpi-kodi-patch.sh @@ -0,0 +1,101 @@ +#!/bin/bash +set -e + +BIN=$(readlink -f $(dirname $0)) + +if git rev-parse --is-inside-work-tree &>/dev/null; then + echo "Don't run this script inside a git reppository!" + exit 1 +fi + +DEPTH=1000 + +usage() +{ + local me="$(basename $0)" + + echo "Usage: ${me} <popcornmix-branch> <sha>|<xbmc branch>" + echo + echo "Example: ${me} jarvis_rbp_backports d11fabefb909e75e7186bd9ecd0cbff9e8b24577" + echo "Example: ${me} jarvis_rbp_backports Jarvis" + echo + echo "For sha, see https://github.com/xbmc/xbmc/compare/Jarvis...popcornmix:jarvis_rbp_backports (replace branches as appropriate)" + exit 1 +} + +if [ -z "${1}" ]; then + echo "ERROR: popcornmix branch must be specified!" + echo + usage +fi + +if [ -z "${2}" ]; then + echo "ERROR: First popcornmix revision (sha) or name of xbmc branch must be specified!" + echo + usage +fi + +BRANCH="$1" +BASEREV="$2" + +rm -fr raspberrypi-kodi + +# If we have a persisted version of the repo, quickly copy it +if [ -d raspberrypi-kodi.stash ]; then + echo "Copying raspberrypi-kodi.stash raspberrypi-kodii..." + cp -r raspberrypi-kodi.stash raspberrypi-kodi + cd raspberrypi-kodi + git checkout ${BRANCH} +else + git clone -b ${BRANCH} --depth=${DEPTH} --single-branch https://github.com/popcornmix/xbmc.git raspberrypi-kodi + cd raspberrypi-kodi +fi + +if [[ ${BASEREV} =~ [0-9a-f]{40} ]]; then + BASEREV="${BASEREV}~1" +else + git remote add -t ${BASEREV} xbmc https://github.com/xbmc/xbmc.git + BASEREV="xbmc/${BASEREV}" +fi + +git fetch --all --depth=${DEPTH} +git reset --hard origin/${BRANCH} + +if [ -d addons/skin.confluence ]; then + SKIN1=skin.confluence + SKIN2=kodi-theme-Confluence +else + SKIN1=skin.estuary + SKIN2=kodi-theme-Estuary +fi + +git format-patch --no-signature --stdout ${BASEREV} -- addons/${SKIN1} | sed -E 's#addons/skin\.[^/]*/##g' >/tmp/skin.patch +git format-patch --no-signature --stdout ${BASEREV} -- . ":!addons/${SKIN1}" >/tmp/kodi.patch + +cd .. && rm -fr raspberrypi-kodi + +echo +echo "New skin patch: /tmp/skin.patch" +echo "New kodi patch: /tmp/kodi.patch" + +echo +echo "## LibreELEC Update Notes ##" +echo +echo "cd LibreELEC.tv" +echo "git checkout master" +echo "git pull upstream master" +echo "git checkout -b somebranch" + +BRANCH="${BRANCH//_/-}" + +echo +echo "cp /tmp/skin.patch projects/RPi/patches/${SKIN2}/${SKIN2}-001-${BRANCH}.patch" +echo "cp /tmp/skin.patch projects/RPi2/patches/${SKIN2}/${SKIN2}-001-${BRANCH}.patch" +echo "git commit -am \"RPi/RPi2: Update kodi-theme-${SKIN} support patches\"" + +echo +echo "cp /tmp/kodi.patch projects/RPi/patches/kodi/kodi-001-${BRANCH}.patch" +echo "cp /tmp/kodi.patch projects/RPi2/patches/kodi/kodi-001-${BRANCH}.patch" +echo "git commit -am \"RPi/RPi2: Update kodi support patches\"" + +echo diff --git a/tools/RPi/gen-rpi-linux-patch.sh b/tools/RPi/gen-rpi-linux-patch.sh new file mode 100755 index 00000000000..94b095455b9 --- /dev/null +++ b/tools/RPi/gen-rpi-linux-patch.sh @@ -0,0 +1,102 @@ +#!/bin/bash +set -e + +BIN=$(readlink -f $(dirname $0)) + +if git rev-parse --is-inside-work-tree &>/dev/null; then + echo "Don't run this script inside a git reppository!" + exit 1 +fi + +DEPTH=1000 +BRANCH="$1" +[ -n "${2}" ] && REBASE="_rebase" + +usage() +{ + local me="$(basename $0)" + + echo "Usage: ${me} <major.minor>|<major.minor.patch> [rebase]" + echo + echo "Example: 4.4 (for rpi-4.4.y) or 4.4.6 - specifying an exact kernel version avoids fetching the upstream repo" + echo " 4.4 rebase - use rpi-4.4.y_rebase branch" + echo " 4.6-rc6" + exit 1 +} + +if [ -z "${BRANCH}" ]; then + echo "ERROR: Branch must be specified!" + echo + usage +fi + +if [[ ${BRANCH} =~ [0-9]*\.[0-9]*\.[0-9]* ]]; then + KERNEL="${BRANCH}" + BRANCH="${BRANCH%.*}" +elif [[ ${BRANCH} =~ [0-9]*\.[0-9]*-rc[0-9] ]]; then + KERNEL="${BRANCH}" + BRANCH="${BRANCH%-*}" +fi + +rm -fr raspberrypi-linux + +# If we have a persisted version of the repo, quickly copy it +if [ -d raspberrypi-linux.stash ]; then + echo "Copying raspberrypi-linux.stash to raspberrypi-linux..." + cp -r raspberrypi-linux.stash raspberrypi-linux + cd raspberrypi-linux + git checkout rpi-${BRANCH}.y${REBASE} +else + git clone -b rpi-${BRANCH}.y${REBASE} --depth=${DEPTH} --single-branch https://github.com/raspberrypi/linux.git raspberrypi-linux + cd raspberrypi-linux +fi + +if [ -z "${KERNEL}" ]; then + git remote add -t linux-${BRANCH}.y linux-stable https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git +fi + +git fetch --all --depth=${DEPTH} +git reset --hard origin/rpi-${BRANCH}.y${REBASE} + +if [ -z "${KERNEL}" ]; then + BASEREV="linux-stable/linux-${BRANCH}.y" +else + BASEREV="$(git log --grep "Linux ${KERNEL}" --pretty=oneline | head -1)" + [ -z "${BASEREV}" ] && { echo "Unable to determine base revision for BRANCH=${BRANCH}, KERNEL=${KERNEL}"; exit 1; } + + echo + echo "FOUND BASE REV: ${BASEREV}" + echo + + BASEREV="${BASEREV%% *}" +fi + +GIT_SEQUENCE_EDITOR=${BIN}/rpi-linux-rebase.sh git rebase -i ${BASEREV} +git format-patch --no-signature --stdout ${BASEREV} > /tmp/linux-01-RPi_support.patch + +cd .. && rm -fr raspberrypi-linux + +echo +cat /tmp/dropped + +echo +echo "Dropped patches: /tmp/dropped" +echo "New patch file : /tmp/linux-01-RPi_support.patch" + +echo +echo "## LibreELEC Update Notes ##" +echo +echo "cd LibreELEC.tv" +echo "git checkout master" +echo "git pull upstream master" +echo "git checkout -b somebranch" + +echo +echo "cp /tmp/linux-01-RPi_support.patch projects/RPi/patches/linux/linux-01-RPi_support.patch" +echo +echo "cp /tmp/linux-01-RPi_support.patch projects/RPi2/patches/linux/linux-01-RPi_support.patch" + +echo +echo "git commit -am \"RPi/RPi2: update linux support patches for linux ${KERNEL:-${BRANCH}}\"" + +echo diff --git a/tools/RPi/rpi-linux-rebase.sh b/tools/RPi/rpi-linux-rebase.sh new file mode 100755 index 00000000000..51ace901983 --- /dev/null +++ b/tools/RPi/rpi-linux-rebase.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +# Setup: +# git clone -b rpi-4.4.y --depth=1000 --single-branch git@github.com:raspberrypi/linux.git raspberrypi-linux +# git remote add -t linux-4.4.y linux-stable git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git +# Update: +# git fetch --all --depth=1000 +# git reset --hard origin/rpi-4.4.y +# GIT_SEQUENCE_EDITOR=../rpi-linux-rebase.sh git rebase -i linux-stable/linux-4.4.y +# git format-patch --no-signature --stdout linux-stable/linux-4.4.y > ../linux-01-RPi_support.patch + +TODO=$1 + +# Drop commits not used +DROP_COMMITS=" +Add non-mainline source for rtl8192cu wireless driver version +rtl8192c_rf6052\: PHY_RFShadowRefresh\(\)\: fix off-by-one +rtl8192cu\: Add PID for D-Link DWA 131 +Added Device IDs for August DVB-T 205 +net\: Add non-mainline source for rtl8192cu wlan +net\: Fix rtl8192cu build errors on other platforms +" + +IFS=$'\n' +for COMMIT in $DROP_COMMITS; do + sed -i -E "s/^pick ([0-9a-f]+) (${COMMIT}.*)/drop \1 \2/g" $TODO +done + +grep -E "^drop " $TODO > /tmp/dropped +sed -i -E "/^drop /d" $TODO diff --git a/tools/distro-tool b/tools/distro-tool new file mode 100755 index 00000000000..2155823e1aa --- /dev/null +++ b/tools/distro-tool @@ -0,0 +1,916 @@ +#!/bin/bash +################################################################################ +# This file is part of LibreELEC - https://libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see <http://www.gnu.org/licenses/>. +################################################################################ +set -e + +[ -z "${DEBUG_LOG}" ] && DEBUG_LOG=/tmp/distro-tool.log + +LIBREELEC_DIR=$HOME/LibreELEC.tv +TARGET_DIR=/var/www/sources +DOWNLOAD_DIR=$HOME/download +REVISION= +PACKAGE= +DRY_RUN=no +IGNORE_ERRORS=no +DOGIT=no +CHECK_NEWER=yes +PROGRESS=yes +IS_MIRROR=yes +VERBOSE=0 +WORKER_THREADS=32 + +# Source in GIT_USERNAME and GIT_PASSWORD to avoid API limitations +[ -f ~/.git.conf ] && source ~/.git.conf + +PYTHON_PROG=' +from __future__ import print_function +import sys, os, json, codecs, re, threading, subprocess, glob, datetime, shutil + +if sys.version_info >= (3, 0): + import queue as Queue + basestring = (str, bytes) +else: + import Queue + +class MyUtility(object): + isPython3 = (sys.version_info >= (3, 0)) + + if sys.version_info >= (3, 1): + sys.stdout = codecs.getwriter("utf-8")(sys.stdout.detach()) + sys.stderr = codecs.getwriter("utf-8")(sys.stderr.detach()) + else: + sys.stdout = codecs.getwriter("utf-8")(sys.stdout) + sys.stderr = codecs.getwriter("utf-8")(sys.stderr) + + search_major_minor_patch = re.compile("[0-9]+\.[0-9]+\.[0-9]+") + extract_major_minor_patch = re.compile(".*([0-9]+\.[0-9]+\.[0-9]+).*") + + search_major_minor = re.compile("[0-9]+\.[0-9]+") + extract_major_minor = re.compile(".*([0-9]+\.[0-9]+).*") + + leading_zeros = re.compile("^0[0-9]") + + search_HTTP_OK = re.compile("HTTP\/[1-9]\.[0-9] 200 OK", flags=re.IGNORECASE) + search_HTTP_NOT_FOUND = re.compile("404 not found", flags=re.IGNORECASE) + search_HTTP_NOT_ALLOWED = re.compile("405 method not allowed", flags=re.IGNORECASE) + search_HTTP_CODE = re.compile("__HTTP_CODE__@([0-9]*)@") + search_CONTENT_TYPE = re.compile("__CONTENT_TYPE__@(.*)@") + + colours = {} + colours["red"] = "\x1b[31m" + colours["green"] = "\x1b[32m" + colours["yellow"] = "\x1b[33m" + colours["blue"] = "\x1b[34m" + colours["magenta"]= "\x1b[35m" + colours["cyan"] = "\x1b[36m" + colours["reset"] = "\x1b(B\x1b[m" + + @staticmethod + def colour(colour, text): + return "%s%s%s" % (MyUtility.colours[colour], text, MyUtility.colours["reset"]) + + @staticmethod + def logmsg(msgs, level, text): + msgs.append({"level": level, "text": text}) + + @staticmethod + def show(msgs, level, colour, prefix, text): + if colour: + tc = MyUtility.colours[colour] + tr = MyUtility.colours["reset"] + else: + tc = tr = "" + MyUtility.logmsg(msgs, level, "%s%-21s%s: %s" % (tc, prefix, tr, text)) + + @staticmethod + def runcommand(msgs, command, logfile=None, redacted=None): + MyUtility.logmsg(msgs, 3, "Running command: [%s]" % (redacted if redacted else command)) + _logfile = open(logfile, "w") if logfile else subprocess.STDOUT + try: + if MyUtility.isPython3: + return (0, subprocess.check_output(command.split(" "), stderr=_logfile).decode("utf-8")) + else: + return (0, subprocess.check_output(command.split(" "), stderr=_logfile)) + except subprocess.CalledProcessError as cpe: + if MyUtility.isPython3: + return (cpe.returncode, cpe.output.decode("utf-8")) + else: + return (cpe.returncode, cpe.output) + finally: + if logfile and _logfile: + _logfile.close() + + @staticmethod + def readfile(filename): + inputfile = codecs.open(filename, "rb", encoding="utf-8") + data= inputfile.read() + inputfile.close() + return data + + @staticmethod + def get_alternate_versions(package_version): + if not package_version: + return + + if MyUtility.search_major_minor_patch.search(package_version): + mmp = True + ver = MyUtility.extract_major_minor_patch.search(package_version).group(1) + elif MyUtility.search_major_minor.search(package_version): + mmp = False + ver = MyUtility.extract_major_minor.search(package_version).group(1) + else: + return + + # Split parts + parts_p0 = ver.split(".") + parts_p0_lz = ["", "", ""] + parts_p1 = [0, 0, 0] + parts_p1_lz = ["", "", ""] + c = 0 + for p in parts_p0: + if c > 2: break + parts_p1[c] = int(p) + 1 + # Add leading zeros if originally present + if MyUtility.leading_zeros.search(parts_p0[c]): + parts_p0_lz[c] = "0" + if parts_p0_lz[c] == "0" and parts_p1[c] < 10: + parts_p1_lz[c] = "0" + c += 1 + + if mmp: + tmp1 = "%s%d.%s%d.%s%d" % (parts_p1_lz[0], parts_p1[0], parts_p0_lz[1], 0, parts_p0_lz[2], 0) + yield package_version.replace(ver, tmp1) + + # If minor or patch >= 10, then we are not sure if leading zeros are + # required, so try them anyway + if int(parts_p0[1]) >= 10 or int(parts_p0[2]) >= 10: + tmp2 = "%s%d.00.00" % (parts_p1_lz[0], parts_p1[0]) + if tmp1 != tmp2: + yield package_version.replace(ver, tmp2) + + tmp1 = "%s.%s%d.%s%d" % (parts_p0[0], parts_p1_lz[1], parts_p1[1], parts_p0_lz[2], 0) + yield package_version.replace(ver, tmp1) + + if int(parts_p0[2]) >= 10: + tmp2 = "%s.%s%d.00" % (parts_p0[0], parts_p1_lz[1], parts_p1[1]) + if tmp1 != tmp2: + yield package_version.replace(ver, tmp2) + + tmp1 = "%s.%s.%s%d" % (parts_p0[0], parts_p0[1], parts_p1_lz[2], parts_p1[2]) + yield package_version.replace(ver, tmp1) + else: + tmp1 = "%s%d.%s%d" % (parts_p1_lz[0], parts_p1[0], parts_p0_lz[1], 0) + yield package_version.replace(ver, tmp1) + + # If minor or patch >= 10, then we are not sure if leading zeros are + # required, so try them anyway + if int(parts_p0[1]) >= 10: + tmp2 = "%s%d.00" % (parts_p1_lz[0], parts_p1[0]) + if tmp1 != tmp2: + yield package_version.replace(ver, tmp2) + + tmp1 = "%s.%s%d" % (parts_p0[0], parts_p1_lz[1], parts_p1[1]) + yield package_version.replace(ver, tmp1) + + @staticmethod + def get_latest_commit(msgs, package_url): + urlfields = package_url.split("/") + urlapi = "https://api.github.com/repos/%s/%s/commits" % (urlfields[3], urlfields[4]) + tmpfile_data = "%s/%s" % (SCRATCH_DIR, threading.current_thread().name) + curl_args = "curl --verbose --silent --fail --location --connect-timeout 15 --max-time 60 --retry 3 --write-out __HTTP_CODE__@%{http_code}@\\n__CONTENT_TYPE__@%{content_type}@" + + if GIT_USERNAME and GIT_PASSWORD: + curl_args += " -u %s:%s" % (GIT_USERNAME, GIT_PASSWORD) + + if os.path.exists(tmpfile_data): + os.remove(tmpfile_data) + + (result, headers) = MyUtility.runcommand(msgs, "%s --output %s --url %s" % (curl_args, tmpfile_data, urlapi), redacted=curl_args) + + search_obj = MyUtility.search_HTTP_CODE.search(headers) + http_code = search_obj.group(1) if search_obj else "" + search_obj = MyUtility.search_CONTENT_TYPE.search(headers) + content_type = search_obj.group(1) if search_obj else "" + + MyUtility.logmsg(msgs, 3, "CURL exit code: %d, http_code: %s, content type: [%s]" % (result, http_code, content_type)) + MyUtility.logmsg(msgs, 3, "[\n%s]" % headers) + + if os.path.exists(tmpfile_data): + data = MyUtility.readfile(tmpfile_data) + os.remove(tmpfile_data) + MyUtility.logmsg(msgs, 3, "GITHUB RESPONSE (first 1024 bytes): [\n%s\n]" % data[0:1024]) + if http_code == "200" and data and content_type.startswith("application/json"): + jdata = json.loads(data) + if "message" not in jdata: + return jdata[0]["sha"] + + return "" + + @staticmethod + def have_package(package_name, package_source): + if IS_MIRROR: + return os.path.exists("%s/%s/%s" % (TARGET_DIR, package_name, package_source)) or \ + os.path.exists("%s/%s/%s" % (DOWNLOAD_DIR, package_name, package_source)) + else: + return os.path.exists("%s/%s" % (TARGET_DIR, package_source)) or \ + os.path.exists("%s/%s" % (DOWNLOAD_DIR, package_source)) + + return False + + @staticmethod + def remote_file_exists(msgs, url): + retry = 5 + maxattempts = retry * 3 + headers = "" + result = 0 + HEAD_supported = True + ts = datetime.datetime.now() + curl_args = "curl --verbose --silent --fail --location --connect-timeout 15 --max-time 60 --retry 0 --write-out __HTTP_CODE__@%{http_code}@\\n__CONTENT_TYPE__@%{content_type}@" + http_code = "" + content_type = "" + + MyUtility.logmsg(msgs, 3, "Remote headers for %s..." % url) + + # Retry up to $retry times in case of transient errors. Do not count + # 35/56 as retries, could have several of these before a successful + # request - limit total number of retries as ${retry} * 3. + while retry > 0 and maxattempts > 0: + if stopped.is_set(): break + ts_cmd = datetime.datetime.now() + if HEAD_supported: + (result, headers) = MyUtility.runcommand(msgs, "%s --head --output - --url %s" % (curl_args, url)) + else: + (result, headers) = MyUtility.runcommand(msgs, "%s --range 0-1024 --output /dev/null --url %s" % (curl_args, url)) + + search_obj = MyUtility.search_HTTP_CODE.search(headers) + http_code = search_obj.group(1) if search_obj else "" + search_obj = MyUtility.search_CONTENT_TYPE.search(headers) + content_type = search_obj.group(1) if search_obj else "" + + tDelta = (datetime.datetime.now() - ts_cmd) + MyUtility.logmsg(msgs, 3, \ + "CURL exit code: %d, http_code: %s, content type: [%s], remaining retries %d, time taken %f seconds" % \ + (result, http_code, content_type, retry, tDelta.total_seconds())) + + if result == 22: + # 404 Not Found + if http_code == "404" or MyUtility.search_HTTP_NOT_FOUND.search(headers): + break + # 403/405 Server does not support HEAD + elif HEAD_supported and (http_code in ["403", "405"] or MyUtility.search_HTTP_NOT_ALLOWED.search(headers)): + MyUtility.logmsg(msgs, 3, "HEAD not supported - retrying with range-limited GET") + HEAD_supported = False + continue + + # Success or fatal error - no point continuing + # 0: CURLE_OK + # 6: CURLE_COULDNT_RESOLVE_HOST + # 7: CURLE_COULDNT_CONNECT + # 9: CURLE_REMOTE_ACCESS_DENIED + # 10: CURLE_FTP_ACCEPT_FAILED + # 19: CURLE_FTP_COULDNT_RETR_FILE + # 28: CURLE_OPERATION_TIMEDOUT + if result in [0, 6, 7, 9, 10, 19, 28]: + break + + # Keep retrying following errors until success or failure. + # 35: CURLE_SSL_CONNECT_ERROR + # 56: CURLE_RECV_ERROR + if result not in [35, 56]: + retry -= 1 + + MyUtility.logmsg(msgs, 3, "[\n%s]" % headers) + + # Success if HTTP 200 or 206 (partial content when using ranged request) + # A content_type of "text/html" indicates we were served an error page of + # some kind (eg. iperf) and not the requested file, which would be "application/<something>". + # "text/plain" indicates a misconfigured server (eg. libgcrypt, libgpg-error) so accept this. + if http_code in ["200", "206"] or MyUtility.search_HTTP_OK.search(headers): + result = True if (content_type.startswith("application/") or content_type.startswith("text/plain")) else False + elif http_code == "350" and url.startswith("ftp:"): + result = True + else: + result = False + + tDelta = (datetime.datetime.now() - ts) + + MyUtility.show(msgs, 2 if VERBOSE == 2 else 3, None, "Remote File Exists", "%s (%s) %f seconds" % (result, url, tDelta.total_seconds())) + + return result + + # Use wget with same parameters as scripts/get is using + @staticmethod + def download_file(msgs, filename_data, filename_log, url): + retries=10 + attempts=0 + + while attempts < retries: + if stopped.is_set(): break + attempts += 1 + (result, output) = MyUtility.runcommand(msgs, "wget --timeout=30 --tries=3 --passive-ftp --no-check-certificate -O %s %s" % (filename_data, url), logfile=filename_log) + if result == 0: + return True + + return False + + @staticmethod + def get_package(msgs, package_name, package_source, package_url): + onsource = False + onmirror = False + + onsource = MyUtility.remote_file_exists(msgs, package_url) + if not onsource: + onmirror = MyUtility.remote_file_exists(msgs, "%s/%s/%s" % (DISTRO_MIRROR, package_name, package_source)) + + # If the only PKG_URL source is the DISTRO_SRC server... + if package_url.startswith(DISTRO_SOURCE): + # Warn the user if package is not found on either source or mirror + if not onsource and not onmirror: + MyUtility.show(msgs, 0, "magenta", "MKPKG REQUIRED?", "%s (%s) unable to download from DISTRO_SRC %s - we have no source!" % \ + (package_name, package_url, MyUtility.colour("red", "and not on mirror"))) + return False + + if DRY_RUN: + text = "Package status: %s (%s)" % (package_name, package_source) + if not onsource and onmirror: + text = "%s %s" % (text, MyUtility.colour("yellow", "(found on mirror)")) + if onsource or onmirror: + MyUtility.show(msgs, 0, "green", "PACKAGE AVAILABLE", text) + return True + else: + MyUtility.show(msgs, 0, "red", "PACKAGE NOT AVAILABLE", text) + return False + + tmpfile_data = "%s/%s" % (SCRATCH_DIR, threading.current_thread().name) + tmpfile_log = "%s.log" % tmpfile_data + + if os.path.exists(tmpfile_data): + os.remove(tmpfile_data) + if os.path.exists(tmpfile_log): + os.remove(tmpfile_log) + + if onsource: + result = MyUtility.download_file(msgs, tmpfile_data, tmpfile_log, package_url) + elif onmirror: + result = MyUtility.download_file(msgs, tmpfile_data, tmpfile_log, "%s/%s/%s" % (DISTRO_MIRROR, package_name, package_source)) + else: + result=False + + if result == False or not os.path.exists(tmpfile_data): + result = False + MyUtility.show(msgs, 0, "red", "DOWNLOAD FAILED!!", "%s (%s)" % (package_name, package_url)) + if os.path.exists(tmpfile_log): + MyUtility.logmsg(msgs, 0, MyUtility.readfile(tmpfile_log)) + else: + MyUtility.show(msgs, 0, "green", "Successful Download", "%s (%s)" % (package_name, package_source)) + if IS_MIRROR: + if not os.path.exists("%s/%s" % (DOWNLOAD_DIR, package_name)): + os.makedirs("%s/%s" % (DOWNLOAD_DIR, package_name)) + shutil.move(tmpfile_data, "%s/%s/%s" % (DOWNLOAD_DIR, package_name, package_source)) + else: + shutil.move(tmpfile_data, "%s/%s" % (DOWNLOAD_DIR, package_source)) + + if os.path.exists(tmpfile_data): + os.remove(tmpfile_data) + if os.path.exists(tmpfile_log): + os.remove(tmpfile_log) + + return result + + # Check for newer versions: "X+1.[0]0[.[0]0]" "X.[0]Y+1[.[0]0]" "X.[0]Y.[0]Z+1" + @staticmethod + def check_newer(msgs, package_name, package_url, package_ver): + alt_versions = [] + is_git_rev = False + + for v in MyUtility.get_alternate_versions(package_ver): + if v: alt_versions.append(v) + + if alt_versions == []: + if not package_url.startswith("https://github.com/"): + return + + is_git_rev = True + + latestrev = MyUtility.get_latest_commit(msgs, package_url) + + MyUtility.logmsg(msgs, 3, "Github latest commit [%s]" % latestrev) + + if latestrev == "" or latestrev.startswith(package_ver): + return + + alt_versions.append(latestrev[0:len(package_ver)]) + + MyUtility.show(msgs, 2 if VERBOSE == 2 else 3, None, "Checking for newer", "%s, current version %s - checking %s" % (package_name, package_ver, ", ".join(alt_versions))) + + newurl = package_url.replace(package_ver, "@@VER@@") + + for newver in alt_versions: + url = newurl.replace("@@VER@@", newver) + if MyUtility.remote_file_exists(msgs, url): + MyUtility.show(msgs, 0, "yellow" if is_git_rev else "magenta", "New package available", "%s (%s => %s) %s" % (package_name, package_ver, newver, url)) + break + + @staticmethod + def toUnicode(data): + if MyUtility.isPython3: return data + + if isinstance(data, basestring): + if not isinstance(data, unicode): + try: + data = unicode(data, encoding="utf-8", errors="ignore") + except UnicodeDecodeError: + pass + + return data + + @staticmethod + def printout(data, end="\n"): + sys.stdout.write("%s%s" % (MyUtility.toUnicode(data), end)) + sys.stdout.flush() + + @staticmethod + def printerr(data, end="\n"): + sys.stderr.write("%s%s" % (MyUtility.toUnicode(data), end)) + sys.stderr.flush() + +# +# Thread +# +class MyThread(threading.Thread): + def __init__(self, input_queue, output_queue): + threading.Thread.__init__(self) + self.input_queue = input_queue + self.output_queue = output_queue + + def run(self): + while not stopped.is_set(): + try: + qItem = self.input_queue.get(block=False) + self.input_queue.task_done() + + pkg_name = qItem["PKG_NAME"] + pkg_version = qItem["PKG_VERSION"] + pkg_url = qItem["PKG_URL"] + pkg_section = qItem["PKG_SECTION"] + pkg_source_name = qItem["PKG_SOURCE_NAME"] + + msgs = [] + + if pkg_version == "" or pkg_version == "0.0invalid" or pkg_url == "": + if pkg_section != "virtual": + MyUtility.show(msgs, 0, "cyan", "UNKNOWN VER OR URL", "%s (ver [%s], url [%s])" % (pkg_name, pkg_version, pkg_url)) + self.output_queue.put(msgs) + continue + + tDelta_get_package = datetime.timedelta(0) + tDelta_check_newer = datetime.timedelta(0) + + self.output_queue.put([{"start": True, "name": threading.current_thread().name, "data": {"url": pkg_url, "tstamp": datetime.datetime.now()}}]) + + MyUtility.logmsg(msgs, 3, ">>>>>>>>>>>>>>>>> %s, %s, %s" % (pkg_name, pkg_version, pkg_url)) + + if MyUtility.have_package(pkg_name, pkg_source_name): + MyUtility.show(msgs, 1, "green", "Already downloaded", "%s (%s)" % (pkg_name, pkg_source_name)) + else: + tStart = datetime.datetime.now() + if not IGNORE_ERRORS and \ + not stopped.is_set() and \ + not MyUtility.get_package(msgs, pkg_name, pkg_source_name, pkg_url): + stopped.set() + tDelta_get_package = datetime.datetime.now() - tStart + + if CHECK_NEWER and not stopped.is_set(): + tStart = datetime.datetime.now() + MyUtility.check_newer(msgs, pkg_name, pkg_url, pkg_version) + tDelta_check_newer = datetime.datetime.now() - tStart + + self.output_queue.put([{"stop": True, "name": threading.current_thread().name, "url": pkg_url}]) + + MyUtility.logmsg(msgs, 3, "<<<<<<<<<<<<<<<<< %s %s %s get_package %f check_newer %f" % \ + (pkg_name, pkg_version, pkg_url, tDelta_get_package.total_seconds(), tDelta_check_newer.total_seconds())) + + self.output_queue.put(msgs) + + except Queue.Empty: + break + + # This thread is going down... + self.output_queue.put(None) + +def main(): + if not os.path.exists(SCRATCH_DIR): + os.makedirs(SCRATCH_DIR) + else: + for file in glob.glob("%s/*" % SCRATCH_DIR): + os.remove(file) + + data = [] + for line in sys.stdin: data.append(line) + if data == []: + sys.exit(1) + + input_queue = Queue.Queue() + output_queue = Queue.Queue() + + for item in json.loads("".join(data)): + input_queue.put(item) + + pcount = 0 + pmax = input_queue.qsize() + + # Create threads to process input queue + threadcount = input_queue.qsize() if input_queue.qsize() <= WORKER_THREADS else WORKER_THREADS + threads = [] + for i in range(threadcount): + t = MyThread(input_queue, output_queue) + threads.append(t) + t.setDaemon(False) + + # Start the threads... + for t in threads: t.start() + + qtimeout = 10 + running = {} + stopping = False + + while threadcount > 0: + try: + qItem = output_queue.get(block=True, timeout=qtimeout) + output_queue.task_done() + + if qItem is None: + threadcount -= 1 + continue + + finished = False + + for msg in qItem: + if msg.get("start", False): + running[msg["name"]] = msg["data"] + elif msg.get("stop", False): + del running[msg["name"]] + elif "level" in msg: + finished = True + if VERBOSE >= msg["level"]: + if msg["level"] <= 2: + MyUtility.printout(msg["text"]) + else: + MyUtility.printerr(msg["text"]) + + if not stopping and stopped.is_set(): + stopping = True + MyUtility.printout(MyUtility.colour("red", "** STOPPING DUE TO FAILURE - WAITING FOR %d THREADS TO FINISH **" % threadcount)) + + # Do not enable progress when detailed debug logging is enabled as + # this will most likely be redirected to a file + if finished and PROGRESS and VERBOSE <= 2: + pcount += 1 + MyUtility.printerr("Processing... %3d%% (%d threads active)\x1b[K\r" % ((pcount * 100 / pmax), threadcount), end="") + + except Queue.Empty: + if VERBOSE >= 3 and len(running) != 0: + MyUtility.printerr("============ WAITING ON FOLLOWING %d THREADS ============" % len(running)) + for t in running: + data = running[t] + MyUtility.printerr("SLOW RUNNING THREAD %s for %f secs: %s" % (t, (datetime.datetime.now() - data["tstamp"]).total_seconds(), data["url"])) + + if PROGRESS and VERBOSE <= 2: + MyUtility.printerr("\r\x1b[K", end="") + + sys.exit(1 if stopped.is_set() else 0) + +if __name__ == "__main__": + try: + args = sys.argv[1:] + DOWNLOAD_DIR = args[0] + TARGET_DIR = args[1] + DISTRO_SOURCE = args[2] + DISTRO_MIRROR = args[3] + IS_MIRROR = True if args[4] == "yes" else False + IGNORE_ERRORS = True if args[5] == "yes" else False + DRY_RUN = True if args[6] == "yes" else False + CHECK_NEWER = True if args[7] == "yes" else False + PROGRESS=True if args[8] == "yes" else False + WORKER_THREADS=int(args[9]) + GIT_USERNAME = args[10] + GIT_PASSWORD = args[11] + VERBOSE = int(args[12]) + SCRATCH_DIR="%s/.tmp" % DOWNLOAD_DIR + + stopped = threading.Event() + + main() + except (KeyboardInterrupt, SystemExit) as e: + if type(e) == SystemExit: sys.exit(int(str(e))) + except Exception: + raise +' + +[ -z "${PROJECT}" ] && PROJECT=Generic +[ -z "${ARCH}" ] && ARCH=x86_64 + +help() { + [ -n "$1" ] && echo -e "ERROR: Unknown argument [$1]\n" + cat <<EOF +Usage: $(basename $0) -d|--download <path> [-t|--target <path>] [-l|--libreelec <path>] + [-m|--mirror] [-s|--source] [-a|-all] [-p|--package <package_name> [-r|--revision <revision>]] + [--git] [-n|--notnewer] [--dry-run] [--noprogress] [-T #|--threads #] [-U|--gituser] [-P|--gitpass] + [-v|--verbose] [-h|--help] + +Options: + -d, --download: Directory path into which new package files will be downloaded - default is $HOME/download[1] + -t, --target: Directory path for existing packages that are to be refreshed, default is /var/www/sources[2] + -l, --libreelec: LibreELEC.tv repo, default is ${HOME}/LibreELEC.tv + -m, --mirror: Target is mirror not source - mirror uses a hierarchical per-package folder structure + -s, --source: Target is source not mirror - source uses a flattened file structure. Default is mirror + -a, --all: Ignore download failures, continue processing all packages + -p, --package: Package to process, otherwise process all packages + -r, --revision: Version to use in place of PKG_VERSION, only applicable in conjunction with -p + --git: Clone (if not available) or pull the LibreELEC.tv repository + -n, --notnewer Don't check for newer packages ('X.Y.Z+1' 'X.Y+1.0' 'X+1.0.0') + --dry-run: Don't actually download anything (will still git clone/pull if configured) + --noprogress: Do not show progress indicator + -T, --threads: Number of worker threads, default is 32 + -U, --gituser: Git username (or source from ~/.git.conf) - avoids API limits + -P, --gitpass: Git password (or source from ~/.git.conf) - avoids API limits + -v, --verbose: Output more verbose sync information. Repeat for more detail + -h, --help: This message + + Note#1. The download directory will have the LibreELEC version appended (eg. /devel) unless it is a mirror, in which case "/mirror" will be appended. + Note#2. The target directory will have the LibreELEC version appended (eg. /devel) unless it is a mirror, in which case "/mirror" will be appended. +EOF +} + +get_libreelec_branch() { + cd $LIBREELEC_DIR + git rev-parse --abbrev-ref HEAD +} + +# 1: LibreELEC variable, eg. LIBREELEC_VERSION +get_libreelec_option() { + local variable="$1" + cd $LIBREELEC_DIR + . config/options + echo "${!variable}" +} + +generate_work() { + local package_name="$1" revision="$2" + local wanted_vars="PKG_NAME PKG_VERSION PKG_URL PKG_SECTION PKG_SOURCE_NAME" + local packages pcount c=0 + + [ ${PROGRESS} == yes ] && echo -en "Acquiring packages...\r" >&2 + + packages="$(get_packages ${package_name})" + pcount="$(echo "${packages}" | wc -l)" + + if [ -n "${package_name}" -a -z "${packages}" ]; then + echo "ERROR: ${package_name} is not a valid package - package.mk does not exist" >&2 + exit 1 + fi + + ( + # Override exit function so that packages calling exit don't terminate this sub-shell + exit() { + : + } + + init_progress + + cd $LIBREELEC_DIR + + echo "[" + for package_name in ${packages}; do + [ ${PROGRESS} == yes ] && progress ${pcount} + + source config/options ${package_name} 2>/dev/null || true + + if [ -n "${revision}" ]; then + PKG_URL="${PKG_URL/${PKG_VERSION}/${revision}}" + PKG_SOURCE_NAME="${PKG_SOURCE_NAME/${PKG_VERSION}/${revision}}" + PKG_VERSION="${revision}" + fi + + echo " {" + for var in ${wanted_vars}; do + [ "${var}" != "PKG_SOURCE_NAME" ] && echo " \"${var}\": \"${!var}\"," || echo " \"${var}\": \"${!var}\"" + done + c=$((c+1)) + [ ${c} -lt ${pcount} ] && echo " }," || echo " }" + done + echo "]" + + end_progress + ) +} + +check_exists() { + if [ -z "${!1}" ]; then + echo "ERROR: ${1} must not be undefined" + return 1 + fi + + [ -d ${!1} ] && return 0 + + echo "ERROR: ${1} ${!1} does not exist" + return 1 +} + +get_abs_path() { + echo "$(readlink -f $1)" +} + +get_package_path() { + echo "$(basename "$(dirname "$0")") $0" +} + +get_packages() { + local package_name="$1" + + export -f get_package_path + + cd $LIBREELEC_DIR + + if [ -n "${package_name}" ]; then + basename $(dirname $(find packages -path "*/${package_name}/*" -name package.mk) 2>/dev/null) 2>/dev/null + else + find packages -name package.mk -exec bash -c get_package_path "{}" \; | sort -k1 | cut -d' ' -f1 + fi + return 0 +} + +init_progress() { + PCOUNT=0 +} + +progress() { + PCOUNT=$((PCOUNT + 1)) + printf "Generating workload... %3d%%\r" $((PCOUNT * 100 / $1)) >&2 +} + +end_progress() { + printf "\033[K\r" >&2 +} + +exec_worker_prog() { + echo "${PYTHON_PROG}" >/tmp/distro-tool.py + python /tmp/distro-tool.py "${DOWNLOAD_DIR}" "${TARGET_DIR}" "${DISTRO_SOURCE}" "${DISTRO_MIRROR}" \ + "${IS_MIRROR}" "${IGNORE_ERRORS}" "${DRY_RUN}" "${CHECK_NEWER}" \ + "${PROGRESS}" "${WORKER_THREADS}" "${GIT_USERNAME}" "${GIT_PASSWORD}" \ + "${VERBOSE}" + rm -f /tmp/distro-tool.py +} + +while [ : ]; do + [ -z "$1" ] && break + case $1 in + -d|--download) + shift + DOWNLOAD_DIR=$1 + ;; + -l|--libreelec) + shift + LIBREELEC_DIR=$1 + ;; + -t|--target) + shift + TARGET_DIR=$1 + ;; + -a|--all) + IGNORE_ERRORS=yes + ;; + -p|--package) + shift + PACKAGE=$1 + ;; + -r|--revision) + shift + REVISION=$1 + ;; + -m|--mirror) + IS_MIRROR=yes + ;; + -s|--source) + IS_MIRROR=no + ;; + --dry-run|--dryrun) + DRY_RUN=yes + LINE_PREFIX="**DRY-RUN** " + ;; + --git) + DOGIT=yes + ;; + -n|--notnewer) + CHECK_NEWER=no + ;; + -T|--threads) + shift + [ $1 -gt 0 ] && WORKER_THREADS=$1 + ;; + -U|--gituser) + shift + GIT_USERNAME=$1 + ;; + -P|--gitpass) + shift + GIT_PASSWORD=$1 + ;; + -v|--verbose) + VERBOSE=$((VERBOSE + 1)) + ;; + --noprogress) + PROGRESS=no + ;; + -h|--help) + help + exit 0 + ;; + *) + help "$1" + exit 0 + ;; + esac + shift +done + +[ -n "${PACKAGE}" -a ${VERBOSE} -eq 0 ] && VERBOSE=1 + +if [ ${DOGIT} == yes ]; then + ( + if [ -d ${LIBREELEC_DIR}/.git ]; then + cd ${LIBREELEC_DIR} + git pull + else + mkdir -p $(dirname "${LIBREELEC_DIR}") 2>/dev/null + cd $(dirname "${LIBREELEC_DIR}") + git clone https://github.com/LibreELEC/LibreELEC.tv.git $(basename "${LIBREELEC_DIR}") + fi + ) +fi + +check_exists LIBREELEC_DIR || exit +LIBREELEC_DIR="$(get_abs_path "${LIBREELEC_DIR}")" + +DISTRO_SOURCE="$(get_libreelec_option DISTRO_SRC)" +DISTRO_MIRROR="$(get_libreelec_option DISTRO_MIRROR)" +LIBREELEC_VER="$(get_libreelec_option LIBREELEC_VERSION)" + +if [ ${IS_MIRROR} == no ]; then + TARGET_DIR="$(get_abs_path "${TARGET_DIR}/${LIBREELEC_VER}")" +else + TARGET_DIR="$(get_abs_path "${TARGET_DIR}/mirror")" +fi +check_exists TARGET_DIR || exit + +if [ ${IS_MIRROR} == no ]; then + DOWNLOAD_DIR="$(get_abs_path "${DOWNLOAD_DIR}/${LIBREELEC_VER}")" +else + DOWNLOAD_DIR="$(get_abs_path "${DOWNLOAD_DIR}/mirror")" +fi +check_exists DOWNLOAD_DIR || exit + +if [ -n "${REVISION}" -a -z "${PACKAGE}" ]; then + echo "ERROR: A single package must be specified with custom revision" + exit 1 +fi + +echo +if [ ${IS_MIRROR} == yes ]; then + echo "Synchronising LibreELEC.tv (branch: $(get_libreelec_branch), version: ${LIBREELEC_VER}) with MIRROR server ${TARGET_DIR}" +else + echo "Synchronising LibreELEC.tv (branch: $(get_libreelec_branch), version: ${LIBREELEC_VER}) with SOURCE server ${TARGET_DIR}" +fi +echo +echo "Distro Source is: ${DISTRO_SOURCE}" +echo "Distro Mirror is: ${DISTRO_MIRROR}" +echo " Syncing against: ${TARGET_DIR}" +echo " Downloading to: ${DOWNLOAD_DIR}" +echo " Check Newer: ${CHECK_NEWER^}" +echo " Dry run: ${DRY_RUN^}" +if [ ${VERBOSE} -gt 2 ]; then + echo " Debugging level: ${VERBOSE} (${DEBUG_LOG})" + echo " Worker Threads: ${WORKER_THREADS}" +fi +echo + +if [ ${VERBOSE} -gt 2 -a -n "${DEBUG_LOG}" ]; then + generate_work "${PACKAGE}" "${REVISION}" | exec_worker_prog 2>${DEBUG_LOG} +else + generate_work "${PACKAGE}" "${REVISION}" | exec_worker_prog +fi diff --git a/tools/download-tool b/tools/download-tool new file mode 100755 index 00000000000..ac61953bab8 --- /dev/null +++ b/tools/download-tool @@ -0,0 +1,46 @@ +#!/bin/bash + +################################################################################ +# This file is part of LibreELEC - https://libreelec.tv +# Copyright (C) 2009-2016 Lukas Rusak (lrusak@libreelec.tv) +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see <http://www.gnu.org/licenses/>. +################################################################################ + +if [ -z "$PROJECT" -a -z "$ARCH" ]; then + echo "Usage: PROJECT=<project> ARCH=<arch> $0" + exit 0 +fi + +help() { + echo "Usage: PROJECT=<project> ARCH=<arch> $0 [-a|--all]" + echo "Options:" + echo " -a, --all: download all packages including addons" +} + +case $1 in + -a|--all) + ALL_PACKAGES="true" + ;; + -h|--help) + help + exit 0 +esac + +for package in $(find packages/ -name package.mk); do + if [ -n "$(echo $package | grep addons)" -a -z "$ALL_PACKAGES" ]; then + continue + fi + ./scripts/get $(basename `dirname $package`) +done diff --git a/tools/mkpkg/mkpkg_RTL8192EU b/tools/mkpkg/mkpkg_RTL8192EU deleted file mode 100755 index db86e845426..00000000000 --- a/tools/mkpkg/mkpkg_RTL8192EU +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/sh -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 2 of the License, or -# (at your option) any later version. -# -# OpenELEC is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see <http://www.gnu.org/licenses/>. -################################################################################ - -echo "getting sources..." - if [ ! -d RTL8192EU.git ]; then - git clone https://github.com/Mange/rtl8192eu-linux-driver.git --depth=1 -b master RTL8192EU.git - fi - - cd RTL8192EU.git - git pull - GIT_REV=`git log -n1 --format=%h` - cd .. - -echo "copying sources..." - rm -rf RTL8192EU-$GIT_REV - cp -R RTL8192EU.git RTL8192EU-$GIT_REV - -echo "cleaning sources..." - rm -rf RTL8192EU-$GIT_REV/.git - -echo "packing sources..." - tar cvJf RTL8192EU-$GIT_REV.tar.xz RTL8192EU-$GIT_REV - -echo "remove temporary sourcedir..." - rm -rf RTL8192EU-$GIT_REV diff --git a/tools/mkpkg/mkpkg_adsp.freesurround b/tools/mkpkg/mkpkg_adsp.freesurround deleted file mode 100755 index 497d799f129..00000000000 --- a/tools/mkpkg/mkpkg_adsp.freesurround +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/sh -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 2 of the License, or -# (at your option) any later version. -# -# OpenELEC is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see <http://www.gnu.org/licenses/>. -################################################################################ - -echo "getting sources..." - if [ ! -d adsp.freesurround.git ]; then - git clone https://github.com/kodi-adsp/adsp.freesurround.git adsp.freesurround.git - fi - - cd adsp.freesurround.git - git pull - GIT_REV=`git log -n1 --format=%h` - cd .. - -echo "copying sources..." - rm -rf adsp.freesurround-$GIT_REV - cp -R adsp.freesurround.git adsp.freesurround-$GIT_REV - -echo "cleaning sources..." - rm -rf adsp.freesurround-$GIT_REV/.git - -echo "packing sources..." - tar cvJf adsp.freesurround-$GIT_REV.tar.xz adsp.freesurround-$GIT_REV - -echo "remove temporary sourcedir..." - rm -rf adsp.freesurround-$GIT_REV diff --git a/tools/mkpkg/mkpkg_audiodecoder.2sf b/tools/mkpkg/mkpkg_audiodecoder.2sf deleted file mode 100755 index b663b55853c..00000000000 --- a/tools/mkpkg/mkpkg_audiodecoder.2sf +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/sh -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 2 of the License, or -# (at your option) any later version. -# -# OpenELEC is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see <http://www.gnu.org/licenses/>. -################################################################################ - -echo "getting sources..." - if [ ! -d audiodecoder.2sf.git ]; then - git clone https://github.com/notspiff/audiodecoder.2sf.git audiodecoder.2sf.git - fi - - cd audiodecoder.2sf.git - git pull - GIT_REV=`git log -n1 --format=%h` - cd .. - -echo "copying sources..." - rm -rf audiodecoder.2sf-$GIT_REV - cp -R audiodecoder.2sf.git audiodecoder.2sf-$GIT_REV - -echo "cleaning sources..." - rm -rf audiodecoder.2sf-$GIT_REV/.git - -echo "packing sources..." - tar cvJf audiodecoder.2sf-$GIT_REV.tar.xz audiodecoder.2sf-$GIT_REV - -echo "remove temporary sourcedir..." - rm -rf audiodecoder.2sf-$GIT_REV diff --git a/tools/mkpkg/mkpkg_audiodecoder.asap b/tools/mkpkg/mkpkg_audiodecoder.asap deleted file mode 100755 index 914dedfd0f7..00000000000 --- a/tools/mkpkg/mkpkg_audiodecoder.asap +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/sh -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 2 of the License, or -# (at your option) any later version. -# -# OpenELEC is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see <http://www.gnu.org/licenses/>. -################################################################################ - -echo "getting sources..." - if [ ! -d audiodecoder.asap.git ]; then - git clone https://github.com/notspiff/audiodecoder.asap.git audiodecoder.asap.git - fi - - cd audiodecoder.asap.git - git pull - GIT_REV=`git log -n1 --format=%h` - cd .. - -echo "copying sources..." - rm -rf audiodecoder.asap-$GIT_REV - cp -R audiodecoder.asap.git audiodecoder.asap-$GIT_REV - -echo "cleaning sources..." - rm -rf audiodecoder.asap-$GIT_REV/.git - -echo "packing sources..." - tar cvJf audiodecoder.asap-$GIT_REV.tar.xz audiodecoder.asap-$GIT_REV - -echo "remove temporary sourcedir..." - rm -rf audiodecoder.asap-$GIT_REV diff --git a/tools/mkpkg/mkpkg_audiodecoder.dumb b/tools/mkpkg/mkpkg_audiodecoder.dumb deleted file mode 100755 index a452df7d25d..00000000000 --- a/tools/mkpkg/mkpkg_audiodecoder.dumb +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/sh -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 2 of the License, or -# (at your option) any later version. -# -# OpenELEC is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see <http://www.gnu.org/licenses/>. -################################################################################ - -echo "getting sources..." - if [ ! -d audiodecoder.dumb.git ]; then - git clone https://github.com/notspiff/audiodecoder.dumb.git audiodecoder.dumb.git - fi - - cd audiodecoder.dumb.git - git pull - GIT_REV=`git log -n1 --format=%h` - cd .. - -echo "copying sources..." - rm -rf audiodecoder.dumb-$GIT_REV - cp -R audiodecoder.dumb.git audiodecoder.dumb-$GIT_REV - -echo "cleaning sources..." - rm -rf audiodecoder.dumb-$GIT_REV/.git - -echo "packing sources..." - tar cvJf audiodecoder.dumb-$GIT_REV.tar.xz audiodecoder.dumb-$GIT_REV - -echo "remove temporary sourcedir..." - rm -rf audiodecoder.dumb-$GIT_REV diff --git a/tools/mkpkg/mkpkg_audiodecoder.fluidsynth b/tools/mkpkg/mkpkg_audiodecoder.fluidsynth deleted file mode 100755 index 65b39aae6dc..00000000000 --- a/tools/mkpkg/mkpkg_audiodecoder.fluidsynth +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/sh -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 2 of the License, or -# (at your option) any later version. -# -# OpenELEC is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see <http://www.gnu.org/licenses/>. -################################################################################ - -echo "getting sources..." - if [ ! -d audiodecoder.fluidsynth.git ]; then - git clone https://github.com/notspiff/audiodecoder.fluidsynth.git audiodecoder.fluidsynth.git - fi - - cd audiodecoder.fluidsynth.git - git pull - GIT_REV=`git log -n1 --format=%h` - cd .. - -echo "copying sources..." - rm -rf audiodecoder.fluidsynth-$GIT_REV - cp -R audiodecoder.fluidsynth.git audiodecoder.fluidsynth-$GIT_REV - -echo "cleaning sources..." - rm -rf audiodecoder.fluidsynth-$GIT_REV/.git - -echo "packing sources..." - tar cvJf audiodecoder.fluidsynth-$GIT_REV.tar.xz audiodecoder.fluidsynth-$GIT_REV - -echo "remove temporary sourcedir..." - rm -rf audiodecoder.fluidsynth-$GIT_REV diff --git a/tools/mkpkg/mkpkg_audiodecoder.gme b/tools/mkpkg/mkpkg_audiodecoder.gme deleted file mode 100755 index fc20a75d62d..00000000000 --- a/tools/mkpkg/mkpkg_audiodecoder.gme +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/sh -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 2 of the License, or -# (at your option) any later version. -# -# OpenELEC is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see <http://www.gnu.org/licenses/>. -################################################################################ - -echo "getting sources..." - if [ ! -d audiodecoder.gme.git ]; then - git clone https://github.com/notspiff/audiodecoder.gme.git audiodecoder.gme.git - fi - - cd audiodecoder.gme.git - git pull - GIT_REV=`git log -n1 --format=%h` - cd .. - -echo "copying sources..." - rm -rf audiodecoder.gme-$GIT_REV - cp -R audiodecoder.gme.git audiodecoder.gme-$GIT_REV - -echo "cleaning sources..." - rm -rf audiodecoder.gme-$GIT_REV/.git - -echo "packing sources..." - tar cvJf audiodecoder.gme-$GIT_REV.tar.xz audiodecoder.gme-$GIT_REV - -echo "remove temporary sourcedir..." - rm -rf audiodecoder.gme-$GIT_REV diff --git a/tools/mkpkg/mkpkg_audiodecoder.gsf b/tools/mkpkg/mkpkg_audiodecoder.gsf deleted file mode 100755 index be36c95c7a9..00000000000 --- a/tools/mkpkg/mkpkg_audiodecoder.gsf +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/sh -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 2 of the License, or -# (at your option) any later version. -# -# OpenELEC is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see <http://www.gnu.org/licenses/>. -################################################################################ - -echo "getting sources..." - if [ ! -d audiodecoder.gsf.git ]; then - git clone https://github.com/notspiff/audiodecoder.gsf.git audiodecoder.gsf.git - fi - - cd audiodecoder.gsf.git - git pull - GIT_REV=`git log -n1 --format=%h` - cd .. - -echo "copying sources..." - rm -rf audiodecoder.gsf-$GIT_REV - cp -R audiodecoder.gsf.git audiodecoder.gsf-$GIT_REV - -echo "cleaning sources..." - rm -rf audiodecoder.gsf-$GIT_REV/.git - -echo "packing sources..." - tar cvJf audiodecoder.gsf-$GIT_REV.tar.xz audiodecoder.gsf-$GIT_REV - -echo "remove temporary sourcedir..." - rm -rf audiodecoder.gsf-$GIT_REV diff --git a/tools/mkpkg/mkpkg_audiodecoder.ncsf b/tools/mkpkg/mkpkg_audiodecoder.ncsf deleted file mode 100755 index 4a9561f7132..00000000000 --- a/tools/mkpkg/mkpkg_audiodecoder.ncsf +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/sh -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 2 of the License, or -# (at your option) any later version. -# -# OpenELEC is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see <http://www.gnu.org/licenses/>. -################################################################################ - -echo "getting sources..." - if [ ! -d audiodecoder.ncsf.git ]; then - git clone https://github.com/notspiff/audiodecoder.ncsf.git audiodecoder.ncsf.git - fi - - cd audiodecoder.ncsf.git - git pull - GIT_REV=`git log -n1 --format=%h` - cd .. - -echo "copying sources..." - rm -rf audiodecoder.ncsf-$GIT_REV - cp -R audiodecoder.ncsf.git audiodecoder.ncsf-$GIT_REV - -echo "cleaning sources..." - rm -rf audiodecoder.ncsf-$GIT_REV/.git - -echo "packing sources..." - tar cvJf audiodecoder.ncsf-$GIT_REV.tar.xz audiodecoder.ncsf-$GIT_REV - -echo "remove temporary sourcedir..." - rm -rf audiodecoder.ncsf-$GIT_REV diff --git a/tools/mkpkg/mkpkg_audiodecoder.openmpt b/tools/mkpkg/mkpkg_audiodecoder.openmpt deleted file mode 100755 index a643071a221..00000000000 --- a/tools/mkpkg/mkpkg_audiodecoder.openmpt +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/sh -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 2 of the License, or -# (at your option) any later version. -# -# OpenELEC is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see <http://www.gnu.org/licenses/>. -################################################################################ - -echo "getting sources..." - if [ ! -d audiodecoder.openmpt.git ]; then - git clone https://github.com/notspiff/audiodecoder.openmpt.git audiodecoder.openmpt.git - fi - - cd audiodecoder.openmpt.git - git pull - GIT_REV=`git log -n1 --format=%h` - cd .. - -echo "copying sources..." - rm -rf audiodecoder.openmpt-$GIT_REV - cp -R audiodecoder.openmpt.git audiodecoder.openmpt-$GIT_REV - -echo "cleaning sources..." - rm -rf audiodecoder.openmpt-$GIT_REV/.git - -echo "packing sources..." - tar cvJf audiodecoder.openmpt-$GIT_REV.tar.xz audiodecoder.openmpt-$GIT_REV - -echo "remove temporary sourcedir..." - rm -rf audiodecoder.openmpt-$GIT_REV diff --git a/tools/mkpkg/mkpkg_audiodecoder.organya b/tools/mkpkg/mkpkg_audiodecoder.organya deleted file mode 100755 index 401dcf48476..00000000000 --- a/tools/mkpkg/mkpkg_audiodecoder.organya +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/sh -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 2 of the License, or -# (at your option) any later version. -# -# OpenELEC is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see <http://www.gnu.org/licenses/>. -################################################################################ - -echo "getting sources..." - if [ ! -d audiodecoder.organya.git ]; then - git clone https://github.com/notspiff/audiodecoder.organya.git audiodecoder.organya.git - fi - - cd audiodecoder.organya.git - git pull - GIT_REV=`git log -n1 --format=%h` - cd .. - -echo "copying sources..." - rm -rf audiodecoder.organya-$GIT_REV - cp -R audiodecoder.organya.git audiodecoder.organya-$GIT_REV - -echo "cleaning sources..." - rm -rf audiodecoder.organya-$GIT_REV/.git - -echo "packing sources..." - tar cvJf audiodecoder.organya-$GIT_REV.tar.xz audiodecoder.organya-$GIT_REV - -echo "remove temporary sourcedir..." - rm -rf audiodecoder.organya-$GIT_REV diff --git a/tools/mkpkg/mkpkg_audiodecoder.qsf b/tools/mkpkg/mkpkg_audiodecoder.qsf deleted file mode 100755 index 4acd53a6e35..00000000000 --- a/tools/mkpkg/mkpkg_audiodecoder.qsf +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/sh -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 2 of the License, or -# (at your option) any later version. -# -# OpenELEC is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see <http://www.gnu.org/licenses/>. -################################################################################ - -echo "getting sources..." - if [ ! -d audiodecoder.qsf.git ]; then - git clone https://github.com/notspiff/audiodecoder.qsf.git audiodecoder.qsf.git - fi - - cd audiodecoder.qsf.git - git pull - GIT_REV=`git log -n1 --format=%h` - cd .. - -echo "copying sources..." - rm -rf audiodecoder.qsf-$GIT_REV - cp -R audiodecoder.qsf.git audiodecoder.qsf-$GIT_REV - -echo "cleaning sources..." - rm -rf audiodecoder.qsf-$GIT_REV/.git - -echo "packing sources..." - tar cvJf audiodecoder.qsf-$GIT_REV.tar.xz audiodecoder.qsf-$GIT_REV - -echo "remove temporary sourcedir..." - rm -rf audiodecoder.qsf-$GIT_REV diff --git a/tools/mkpkg/mkpkg_audiodecoder.ssf b/tools/mkpkg/mkpkg_audiodecoder.ssf deleted file mode 100755 index ab26e73caec..00000000000 --- a/tools/mkpkg/mkpkg_audiodecoder.ssf +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/sh -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 2 of the License, or -# (at your option) any later version. -# -# OpenELEC is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see <http://www.gnu.org/licenses/>. -################################################################################ - -echo "getting sources..." - if [ ! -d audiodecoder.ssf.git ]; then - git clone https://github.com/notspiff/audiodecoder.ssf.git audiodecoder.ssf.git - fi - - cd audiodecoder.ssf.git - git pull - GIT_REV=`git log -n1 --format=%h` - cd .. - -echo "copying sources..." - rm -rf audiodecoder.ssf-$GIT_REV - cp -R audiodecoder.ssf.git audiodecoder.ssf-$GIT_REV - -echo "cleaning sources..." - rm -rf audiodecoder.ssf-$GIT_REV/.git - -echo "packing sources..." - tar cvJf audiodecoder.ssf-$GIT_REV.tar.xz audiodecoder.ssf-$GIT_REV - -echo "remove temporary sourcedir..." - rm -rf audiodecoder.ssf-$GIT_REV diff --git a/tools/mkpkg/mkpkg_audiodecoder.upse b/tools/mkpkg/mkpkg_audiodecoder.upse deleted file mode 100755 index 984556f0497..00000000000 --- a/tools/mkpkg/mkpkg_audiodecoder.upse +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/sh -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 2 of the License, or -# (at your option) any later version. -# -# OpenELEC is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see <http://www.gnu.org/licenses/>. -################################################################################ - -echo "getting sources..." - if [ ! -d audiodecoder.upse.git ]; then - git clone https://github.com/notspiff/audiodecoder.upse.git audiodecoder.upse.git - fi - - cd audiodecoder.upse.git - git pull - GIT_REV=`git log -n1 --format=%h` - cd .. - -echo "copying sources..." - rm -rf audiodecoder.upse-$GIT_REV - cp -R audiodecoder.upse.git audiodecoder.upse-$GIT_REV - -echo "cleaning sources..." - rm -rf audiodecoder.upse-$GIT_REV/.git - -echo "packing sources..." - tar cvJf audiodecoder.upse-$GIT_REV.tar.xz audiodecoder.upse-$GIT_REV - -echo "remove temporary sourcedir..." - rm -rf audiodecoder.upse-$GIT_REV diff --git a/tools/mkpkg/mkpkg_audiodecoder.usf b/tools/mkpkg/mkpkg_audiodecoder.usf deleted file mode 100755 index eece0f43448..00000000000 --- a/tools/mkpkg/mkpkg_audiodecoder.usf +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/sh -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 2 of the License, or -# (at your option) any later version. -# -# OpenELEC is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see <http://www.gnu.org/licenses/>. -################################################################################ - -echo "getting sources..." - if [ ! -d audiodecoder.usf.git ]; then - git clone https://github.com/notspiff/audiodecoder.usf.git audiodecoder.usf.git - fi - - cd audiodecoder.usf.git - git pull - GIT_REV=`git log -n1 --format=%h` - cd .. - -echo "copying sources..." - rm -rf audiodecoder.usf-$GIT_REV - cp -R audiodecoder.usf.git audiodecoder.usf-$GIT_REV - -echo "cleaning sources..." - rm -rf audiodecoder.usf-$GIT_REV/.git - -echo "packing sources..." - tar cvJf audiodecoder.usf-$GIT_REV.tar.xz audiodecoder.usf-$GIT_REV - -echo "remove temporary sourcedir..." - rm -rf audiodecoder.usf-$GIT_REV diff --git a/tools/mkpkg/mkpkg_audiodecoder.wsr b/tools/mkpkg/mkpkg_audiodecoder.wsr deleted file mode 100755 index ac386467796..00000000000 --- a/tools/mkpkg/mkpkg_audiodecoder.wsr +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/sh -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 2 of the License, or -# (at your option) any later version. -# -# OpenELEC is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see <http://www.gnu.org/licenses/>. -################################################################################ - -echo "getting sources..." - if [ ! -d audiodecoder.wsr.git ]; then - git clone https://github.com/notspiff/audiodecoder.wsr.git audiodecoder.wsr.git - fi - - cd audiodecoder.wsr.git - git pull - GIT_REV=`git log -n1 --format=%h` - cd .. - -echo "copying sources..." - rm -rf audiodecoder.wsr-$GIT_REV - cp -R audiodecoder.wsr.git audiodecoder.wsr-$GIT_REV - -echo "cleaning sources..." - rm -rf audiodecoder.wsr-$GIT_REV/.git - -echo "packing sources..." - tar cvJf audiodecoder.wsr-$GIT_REV.tar.xz audiodecoder.wsr-$GIT_REV - -echo "remove temporary sourcedir..." - rm -rf audiodecoder.wsr-$GIT_REV diff --git a/tools/mkpkg/mkpkg_crossguid b/tools/mkpkg/mkpkg_crossguid deleted file mode 100755 index bba30184fe4..00000000000 --- a/tools/mkpkg/mkpkg_crossguid +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/sh -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 2 of the License, or -# (at your option) any later version. -# -# OpenELEC is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see <http://www.gnu.org/licenses/>. -################################################################################ - -echo "getting sources..." - if [ ! -d crossguid.git ]; then - git clone https://github.com/graeme-hill/crossguid.git -b master crossguid.git - fi - - cd crossguid.git - git pull - GIT_REV=`git log -n1 --format=%h` - cd .. - -echo "copying sources..." - rm -rf crossguid-$GIT_REV - cp -R crossguid.git crossguid-$GIT_REV - -echo "cleaning sources..." - rm -rf crossguid-$GIT_REV/.git - -echo "packing sources..." - tar cvJf crossguid-$GIT_REV.tar.xz crossguid-$GIT_REV - -echo "remove temporary sourcedir..." - rm -rf crossguid-$GIT_REV diff --git a/tools/mkpkg/mkpkg_hyperion b/tools/mkpkg/mkpkg_hyperion new file mode 100755 index 00000000000..39e4f318336 --- /dev/null +++ b/tools/mkpkg/mkpkg_hyperion @@ -0,0 +1,41 @@ +#!/bin/sh +################################################################################ +# This file is part of LibreELEC - https://libreelec.tv +# Copyright (C) 2009-2016 Lukas Rusak (lrusak@libreelec.tv) +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see <http://www.gnu.org/licenses/>. +################################################################################ + +echo "getting sources..." + if [ ! -d hyperion.git ]; then + git clone --depth 1 --recursive https://github.com/tvdzwan/hyperion hyperion.git + fi + + cd hyperion.git + git pull + GIT_REV=`git log -n1 --format=%h` + cd .. + +echo "copying sources..." + rm -rf hyperion-$GIT_REV + cp -R hyperion.git hyperion-$GIT_REV + +echo "cleaning sources..." + rm -rf hyperion-$GIT_REV/.git + +echo "packing sources..." + tar cvJf hyperion-$GIT_REV.tar.xz hyperion-$GIT_REV + +echo "remove temporary sourcedir..." + rm -rf hyperion-$GIT_REV diff --git a/tools/mkpkg/mkpkg_kodi b/tools/mkpkg/mkpkg_kodi index 6ffdf8fcf20..ac03dc95db0 100755 --- a/tools/mkpkg/mkpkg_kodi +++ b/tools/mkpkg/mkpkg_kodi @@ -58,13 +58,13 @@ echo "cleaning sources..." rm -rf $PKG_NAME-$PKG_VERSION/.git echo "seperating theme..." - rm -rf $PKG_NAME-theme-Confluence-$PKG_VERSION - mv $PKG_NAME-$PKG_VERSION/addons/skin.confluence $PKG_NAME-theme-Confluence-$PKG_VERSION + rm -rf $PKG_NAME-theme-Estuary-$PKG_VERSION + mv $PKG_NAME-$PKG_VERSION/addons/skin.estuary $PKG_NAME-theme-Estuary-$PKG_VERSION echo "packing sources..." tar cvJf $PKG_NAME-$PKG_VERSION.tar.xz $PKG_NAME-$PKG_VERSION - tar cvJf $PKG_NAME-theme-Confluence-$PKG_VERSION.tar.xz $PKG_NAME-theme-Confluence-$PKG_VERSION + tar cvJf $PKG_NAME-theme-Estuary-$PKG_VERSION.tar.xz $PKG_NAME-theme-Estuary-$PKG_VERSION echo "remove temporary sourcedir..." rm -rf $PKG_NAME-$PKG_VERSION - rm -rf $PKG_NAME-theme-Confluence-$PKG_VERSION + rm -rf $PKG_NAME-theme-Estuary-$PKG_VERSION diff --git a/tools/mkpkg/mkpkg_kodi-language-addons b/tools/mkpkg/mkpkg_kodi-language-addons deleted file mode 100755 index 0fb08875fc1..00000000000 --- a/tools/mkpkg/mkpkg_kodi-language-addons +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/sh -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 2 of the License, or -# (at your option) any later version. -# -# OpenELEC is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see <http://www.gnu.org/licenses/>. -################################################################################ - -if [ -z "$1" ]; then - echo "Usage: $0 <branch-name>" - exit 0 -fi - -echo "getting sources..." - if [ ! -d kodi-language-addons.git ]; then - git clone --depth=1 -b $1 https://github.com/xbmc/repo-resources.git kodi-language-addons.git - fi - - cd kodi-language-addons.git - git pull - GIT_REV=`git log -n1 --format=%h` - cd .. - -echo "copying sources..." - rm -rf kodi-language-addons-$GIT_REV - cp -R kodi-language-addons.git kodi-language-addons-$GIT_REV - -echo "cleaning sources..." - cd kodi-language-addons-$GIT_REV - rm -rf .git - ls | grep -v resource.language | xargs rm -r - cd .. - -echo "packing sources..." - tar cvJf kodi-language-addons-$GIT_REV.tar.xz kodi-language-addons-$GIT_REV - -echo "remove temporary sourcedir..." - rm -rf kodi-language-addons-$GIT_REV diff --git a/tools/mkpkg/mkpkg_libamcodec b/tools/mkpkg/mkpkg_libamcodec deleted file mode 100755 index dba7b1e6871..00000000000 --- a/tools/mkpkg/mkpkg_libamcodec +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/sh -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 2 of the License, or -# (at your option) any later version. -# -# OpenELEC is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see <http://www.gnu.org/licenses/>. -################################################################################ - -echo "getting sources..." - if [ ! -d libamcodec.git ]; then - git clone https://github.com/codesnake/libamcodec.git libamcodec.git - fi - - cd libamcodec.git - git pull - GIT_REV=`git log -n1 --format=%h` - cd .. - -echo "copying sources..." - rm -rf libamcodec-$GIT_REV - cp -R libamcodec.git libamcodec-$GIT_REV - -echo "cleaning sources..." - rm -rf libamcodec-$GIT_REV/.git - -echo "packing sources..." - tar cvJf libamcodec-$GIT_REV.tar.xz libamcodec-$GIT_REV - -echo "remove temporary sourcedir..." - rm -rf libamcodec-$GIT_REV diff --git a/tools/mkpkg/mkpkg_dcadec b/tools/mkpkg/mkpkg_libcec similarity index 79% rename from tools/mkpkg/mkpkg_dcadec rename to tools/mkpkg/mkpkg_libcec index 053ade62355..e951af8d27a 100755 --- a/tools/mkpkg/mkpkg_dcadec +++ b/tools/mkpkg/mkpkg_libcec @@ -18,24 +18,24 @@ ################################################################################ echo "getting sources..." - if [ ! -d dcadec.git ]; then - git clone git@github.com:foo86/dcadec.git -b master dcadec.git + if [ ! -d libcec.git ]; then + git clone --depth=1 https://github.com/Pulse-Eight/libcec.git libcec.git fi - cd dcadec.git + cd libcec.git git pull GIT_REV=`git log -n1 --format=%h` cd .. echo "copying sources..." - rm -rf dcadec-$GIT_REV - cp -R dcadec.git dcadec-$GIT_REV + rm -rf libcec-$GIT_REV + cp -R libcec.git libcec-$GIT_REV echo "cleaning sources..." - rm -rf dcadec-$GIT_REV/.git + rm -rf libcec-$GIT_REV/.git echo "packing sources..." - tar cvJf dcadec-$GIT_REV.tar.xz dcadec-$GIT_REV + tar cvJf libcec-$GIT_REV.tar.xz libcec-$GIT_REV echo "remove temporary sourcedir..." - rm -rf dcadec-$GIT_REV + rm -rf libcec-$GIT_REV diff --git a/tools/mkpkg/mkpkg_libshairplay b/tools/mkpkg/mkpkg_libshairplay deleted file mode 100755 index 77d42699e71..00000000000 --- a/tools/mkpkg/mkpkg_libshairplay +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/sh -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 2 of the License, or -# (at your option) any later version. -# -# OpenELEC is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see <http://www.gnu.org/licenses/>. -################################################################################ - -PKG_NAME="libshairplay" -PKG_VERSION="" -GIT_REPO="https://github.com/juhovh/shairplay.git" -DEST_DIR="$PKG_NAME" - -echo "getting sources..." - if [ ! -d $DEST_DIR.git ]; then - git clone $GIT_REPO $DEST_DIR.git - fi - - cd $DEST_DIR.git - git pull - - echo "getting version..." - PKG_VERSION=`git log -n1 --format=%h` - echo $GIT_REV - cd .. - -echo "copying sources..." - rm -rf $PKG_NAME-$PKG_VERSION - cp -R $DEST_DIR.git $PKG_NAME-$PKG_VERSION - -echo "cleaning sources..." - rm -rf $PKG_NAME-$PKG_VERSION/.git - -echo "packing sources..." - tar cvJf $PKG_NAME-$PKG_VERSION.tar.xz $PKG_NAME-$PKG_VERSION - -echo "remove temporary sourcedir..." - rm -rf $PKG_NAME-$PKG_VERSION diff --git a/tools/mkpkg/mkpkg_mkbootimg b/tools/mkpkg/mkpkg_mkbootimg deleted file mode 100755 index d47206233b9..00000000000 --- a/tools/mkpkg/mkpkg_mkbootimg +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/sh -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 2 of the License, or -# (at your option) any later version. -# -# OpenELEC is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see <http://www.gnu.org/licenses/>. -################################################################################ - -echo "getting sources..." - if [ ! -d mkbootimg.git ]; then - git clone https://github.com/codesnake/mkbootimg.git mkbootimg.git - fi - - cd mkbootimg.git - git pull - GIT_REV=`git log -n1 --format=%h` - cd .. - -echo "copying sources..." - rm -rf mkbootimg-$GIT_REV - cp -R mkbootimg.git mkbootimg-$GIT_REV - -echo "cleaning sources..." - rm -rf mkbootimg-$GIT_REV/.git - -echo "packing sources..." - tar cvJf mkbootimg-$GIT_REV.tar.xz mkbootimg-$GIT_REV - -echo "remove temporary sourcedir..." - rm -rf mkbootimg-$GIT_REV diff --git a/tools/mkpkg/mkpkg_open-iscsi b/tools/mkpkg/mkpkg_open-iscsi deleted file mode 100755 index a6ed351671d..00000000000 --- a/tools/mkpkg/mkpkg_open-iscsi +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/sh -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 2 of the License, or -# (at your option) any later version. -# -# OpenELEC is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see <http://www.gnu.org/licenses/>. -################################################################################ - -echo "getting sources..." - if [ ! -d open-iscsi.git ]; then - git clone https://github.com/mikechristie/open-iscsi -b release open-iscsi.git - fi - - cd open-iscsi.git - git pull - GIT_REV=`git log -n1 --format=%h` - cd .. - -echo "copying sources..." - rm -rf open-iscsi-$GIT_REV - cp -R open-iscsi.git open-iscsi-$GIT_REV - -echo "cleaning sources..." - rm -rf open-iscsi-$GIT_REV/.git - -echo "packing sources..." - tar cvJf open-iscsi-$GIT_REV.tar.xz open-iscsi-$GIT_REV - -echo "remove temporary sourcedir..." - rm -rf open-iscsi-$GIT_REV diff --git a/tools/mkpkg/mkpkg_populatefs b/tools/mkpkg/mkpkg_populatefs deleted file mode 100644 index 4dd92437991..00000000000 --- a/tools/mkpkg/mkpkg_populatefs +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/sh -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 2 of the License, or -# (at your option) any later version. -# -# OpenELEC is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see <http://www.gnu.org/licenses/>. -################################################################################ - -echo "getting sources..." - if [ ! -d populatefs.git ]; then - git clone https://github.com/oskarirauta/populatefs.git populatefs.git - fi - - cd populatefs.git - git pull - GIT_REV=$(git log -n1 --format=%h) - cd .. - -echo "copying sources..." - rm -rf populatefs-$GIT_REV - cp -R populatefs.git populatefs-$GIT_REV - -echo "cleaning sources..." - rm -rf populatefs-$GIT_REV/.git - -echo "packing sources..." - tar cvJf populatefs-$GIT_REV.tar.xz populatefs-$GIT_REV - -echo "remove temporary sourcedir..." - rm -rf populatefs-$GIT_REV diff --git a/tools/mkpkg/mkpkg_screensaver.asteroids b/tools/mkpkg/mkpkg_screensaver.asteroids deleted file mode 100755 index 45fa4f254f8..00000000000 --- a/tools/mkpkg/mkpkg_screensaver.asteroids +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/sh -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 2 of the License, or -# (at your option) any later version. -# -# OpenELEC is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see <http://www.gnu.org/licenses/>. -################################################################################ - -echo "getting sources..." - if [ ! -d screensaver.asteroids.git ]; then - git clone https://github.com/notspiff/screensaver.asteroids.git screensaver.asteroids.git - fi - - cd screensaver.asteroids.git - git pull - GIT_REV=`git log -n1 --format=%h` - cd .. - -echo "copying sources..." - rm -rf screensaver.asteroids-$GIT_REV - cp -R screensaver.asteroids.git screensaver.asteroids-$GIT_REV - -echo "cleaning sources..." - rm -rf screensaver.asteroids-$GIT_REV/.git - -echo "packing sources..." - tar cvJf screensaver.asteroids-$GIT_REV.tar.xz screensaver.asteroids-$GIT_REV - -echo "remove temporary sourcedir..." - rm -rf screensaver.asteroids-$GIT_REV diff --git a/tools/mkpkg/mkpkg_screensaver.biogenesis b/tools/mkpkg/mkpkg_screensaver.biogenesis deleted file mode 100755 index b22230560bb..00000000000 --- a/tools/mkpkg/mkpkg_screensaver.biogenesis +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/sh -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 2 of the License, or -# (at your option) any later version. -# -# OpenELEC is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see <http://www.gnu.org/licenses/>. -################################################################################ - -echo "getting sources..." - if [ ! -d screensaver.biogenesis.git ]; then - git clone https://github.com/notspiff/screensaver.biogenesis.git screensaver.biogenesis.git - fi - - cd screensaver.biogenesis.git - git pull - GIT_REV=`git log -n1 --format=%h` - cd .. - -echo "copying sources..." - rm -rf screensaver.biogenesis-$GIT_REV - cp -R screensaver.biogenesis.git screensaver.biogenesis-$GIT_REV - -echo "cleaning sources..." - rm -rf screensaver.biogenesis-$GIT_REV/.git - -echo "packing sources..." - tar cvJf screensaver.biogenesis-$GIT_REV.tar.xz screensaver.biogenesis-$GIT_REV - -echo "remove temporary sourcedir..." - rm -rf screensaver.biogenesis-$GIT_REV diff --git a/tools/mkpkg/mkpkg_screensaver.greynetic b/tools/mkpkg/mkpkg_screensaver.greynetic deleted file mode 100755 index 15052aac38e..00000000000 --- a/tools/mkpkg/mkpkg_screensaver.greynetic +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/sh -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 2 of the License, or -# (at your option) any later version. -# -# OpenELEC is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see <http://www.gnu.org/licenses/>. -################################################################################ - -echo "getting sources..." - if [ ! -d screensaver.greynetic.git ]; then - git clone https://github.com/notspiff/screensaver.greynetic.git screensaver.greynetic.git - fi - - cd screensaver.greynetic.git - git pull - GIT_REV=`git log -n1 --format=%h` - cd .. - -echo "copying sources..." - rm -rf screensaver.greynetic-$GIT_REV - cp -R screensaver.greynetic.git screensaver.greynetic-$GIT_REV - -echo "cleaning sources..." - rm -rf screensaver.greynetic-$GIT_REV/.git - -echo "packing sources..." - tar cvJf screensaver.greynetic-$GIT_REV.tar.xz screensaver.greynetic-$GIT_REV - -echo "remove temporary sourcedir..." - rm -rf screensaver.greynetic-$GIT_REV diff --git a/tools/mkpkg/mkpkg_screensaver.matrixtrails b/tools/mkpkg/mkpkg_screensaver.matrixtrails deleted file mode 100755 index b48a1e4ee63..00000000000 --- a/tools/mkpkg/mkpkg_screensaver.matrixtrails +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/sh -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 2 of the License, or -# (at your option) any later version. -# -# OpenELEC is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see <http://www.gnu.org/licenses/>. -################################################################################ - -echo "getting sources..." - if [ ! -d screensaver.matrixtrails.git ]; then - git clone https://github.com/notspiff/screensaver.matrixtrails.git screensaver.matrixtrails.git - fi - - cd screensaver.matrixtrails.git - git pull - GIT_REV=`git log -n1 --format=%h` - cd .. - -echo "copying sources..." - rm -rf screensaver.matrixtrails-$GIT_REV - cp -R screensaver.matrixtrails.git screensaver.matrixtrails-$GIT_REV - -echo "cleaning sources..." - rm -rf screensaver.matrixtrails-$GIT_REV/.git - -echo "packing sources..." - tar cvJf screensaver.matrixtrails-$GIT_REV.tar.xz screensaver.matrixtrails-$GIT_REV - -echo "remove temporary sourcedir..." - rm -rf screensaver.matrixtrails-$GIT_REV diff --git a/tools/mkpkg/mkpkg_screensaver.pingpong b/tools/mkpkg/mkpkg_screensaver.pingpong deleted file mode 100755 index c3846d336f4..00000000000 --- a/tools/mkpkg/mkpkg_screensaver.pingpong +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/sh -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 2 of the License, or -# (at your option) any later version. -# -# OpenELEC is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see <http://www.gnu.org/licenses/>. -################################################################################ - -echo "getting sources..." - if [ ! -d screensaver.pingpong.git ]; then - git clone https://github.com/notspiff/screensaver.pingpong.git screensaver.pingpong.git - fi - - cd screensaver.pingpong.git - git pull - GIT_REV=`git log -n1 --format=%h` - cd .. - -echo "copying sources..." - rm -rf screensaver.pingpong-$GIT_REV - cp -R screensaver.pingpong.git screensaver.pingpong-$GIT_REV - -echo "cleaning sources..." - rm -rf screensaver.pingpong-$GIT_REV/.git - -echo "packing sources..." - tar cvJf screensaver.pingpong-$GIT_REV.tar.xz screensaver.pingpong-$GIT_REV - -echo "remove temporary sourcedir..." - rm -rf screensaver.pingpong-$GIT_REV diff --git a/tools/mkpkg/mkpkg_screensaver.pyro b/tools/mkpkg/mkpkg_screensaver.pyro deleted file mode 100755 index 8f832120752..00000000000 --- a/tools/mkpkg/mkpkg_screensaver.pyro +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/sh -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 2 of the License, or -# (at your option) any later version. -# -# OpenELEC is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see <http://www.gnu.org/licenses/>. -################################################################################ - -echo "getting sources..." - if [ ! -d screensaver.pyro.git ]; then - git clone https://github.com/notspiff/screensaver.pyro.git screensaver.pyro.git - fi - - cd screensaver.pyro.git - git pull - GIT_REV=`git log -n1 --format=%h` - cd .. - -echo "copying sources..." - rm -rf screensaver.pyro-$GIT_REV - cp -R screensaver.pyro.git screensaver.pyro-$GIT_REV - -echo "cleaning sources..." - rm -rf screensaver.pyro-$GIT_REV/.git - -echo "packing sources..." - tar cvJf screensaver.pyro-$GIT_REV.tar.xz screensaver.pyro-$GIT_REV - -echo "remove temporary sourcedir..." - rm -rf screensaver.pyro-$GIT_REV diff --git a/tools/mkpkg/mkpkg_screensaver.stars b/tools/mkpkg/mkpkg_screensaver.stars deleted file mode 100755 index d517341278c..00000000000 --- a/tools/mkpkg/mkpkg_screensaver.stars +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/sh -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 2 of the License, or -# (at your option) any later version. -# -# OpenELEC is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see <http://www.gnu.org/licenses/>. -################################################################################ - -echo "getting sources..." - if [ ! -d screensaver.stars.git ]; then - git clone https://github.com/notspiff/screensaver.stars.git screensaver.stars.git - fi - - cd screensaver.stars.git - git pull - GIT_REV=`git log -n1 --format=%h` - cd .. - -echo "copying sources..." - rm -rf screensaver.stars-$GIT_REV - cp -R screensaver.stars.git screensaver.stars-$GIT_REV - -echo "cleaning sources..." - rm -rf screensaver.stars-$GIT_REV/.git - -echo "packing sources..." - tar cvJf screensaver.stars-$GIT_REV.tar.xz screensaver.stars-$GIT_REV - -echo "remove temporary sourcedir..." - rm -rf screensaver.stars-$GIT_REV diff --git a/tools/mkpkg/mkpkg_json-c b/tools/mkpkg/mkpkg_soil similarity index 72% rename from tools/mkpkg/mkpkg_json-c rename to tools/mkpkg/mkpkg_soil index 8b525f2a8a6..4e83b9b7353 100755 --- a/tools/mkpkg/mkpkg_json-c +++ b/tools/mkpkg/mkpkg_soil @@ -18,24 +18,13 @@ ################################################################################ echo "getting sources..." - if [ ! -d json-c.git ]; then - git clone https://github.com/json-c/json-c.git json-c.git - fi - - cd json-c.git - git pull - GIT_REV=`git log -n1 --format=%h` - cd .. - -echo "copying sources..." - rm -rf json-c-$GIT_REV - cp -R json-c.git json-c-$GIT_REV - -echo "cleaning sources..." - rm -rf json-c-$GIT_REV/.git + wget http://www.lonesock.net/files/soil.zip + unzip soil.zip + mv "Simple OpenGL Image Library" soil-1.16 echo "packing sources..." - tar cvJf json-c-$GIT_REV.tar.xz json-c-$GIT_REV + tar cvJf soil-1.16.tar.xz soil-1.16 echo "remove temporary sourcedir..." - rm -rf json-c-$GIT_REV + rm -rf soil-1.16 + rm -rf soil.zip diff --git a/tools/mkpkg/mkpkg_vboxguest b/tools/mkpkg/mkpkg_vboxguest new file mode 100755 index 00000000000..4c12def12ca --- /dev/null +++ b/tools/mkpkg/mkpkg_vboxguest @@ -0,0 +1,52 @@ +#!/bin/sh +################################################################################ +# This file is part of LibreELEC - https://LibreELEC.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see <http://www.gnu.org/licenses/>. +################################################################################ + +# the script uses 7z to extract the iso to avoid root +# sudo apt-get install p7zip-full + +# set version you want to use +if [ -z "$1" ]; then + echo "Usage: $0 5.0.123" + exit 0 +fi + +VBOX_VERSION="$1" + +echo "getting sources..." + mkdir vbox && cd vbox/ + wget http://download.virtualbox.org/virtualbox/${VBOX_VERSION}/VBoxGuestAdditions_${VBOX_VERSION}.iso + +echo "extracting iso..." + 7z e VBoxGuestAdditions_${VBOX_VERSION}.iso VBoxLinuxAdditions.run -r + chmod 0755 VBoxLinuxAdditions.run + +echo "extract VBoxLinuxAdditions.run..." + ./VBoxLinuxAdditions.run --tar xf + +echo "extract VBoxGuestAdditions-amd64..." + mkdir xf86-video-virtualbox-${VBOX_VERSION} + tar -jxvf VBoxGuestAdditions-amd64.tar.bz2 -C xf86-video-virtualbox-${VBOX_VERSION}/ + +echo "packing sources..." + tar cvJf xf86-video-virtualbox-${VBOX_VERSION}.tar.xz xf86-video-virtualbox-${VBOX_VERSION} + mv xf86-video-virtualbox-${VBOX_VERSION}.tar.xz ../xf86-video-virtualbox-${VBOX_VERSION}.tar.xz + +echo "remove temporary sourcedir..." + cd .. + rm -rf vbox/ diff --git a/tools/mkpkg/mkpkg_vdr-epgsearch b/tools/mkpkg/mkpkg_vdr-epgsearch deleted file mode 100755 index fa116ed64d2..00000000000 --- a/tools/mkpkg/mkpkg_vdr-epgsearch +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/sh -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 2 of the License, or -# (at your option) any later version. -# -# OpenELEC is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see <http://www.gnu.org/licenses/>. -################################################################################ - -echo "getting sources..." - if [ ! -d vdr-epgsearch.git ]; then - git clone git://projects.vdr-developer.org/vdr-plugin-epgsearch.git vdr-epgsearch.git - fi - - cd vdr-epgsearch.git - git pull - GIT_REV=`git log -n1 --format=%h` - cd .. - -echo "copying sources..." - rm -rf vdr-epgsearch-$GIT_REV - cp -R vdr-epgsearch.git vdr-epgsearch-$GIT_REV - -echo "cleaning sources..." - rm -rf vdr-epgsearch-$GIT_REV/.git - -echo "packing sources..." - tar cvJf vdr-epgsearch-$GIT_REV.tar.xz vdr-epgsearch-$GIT_REV - -echo "remove temporary sourcedir..." - rm -rf vdr-epgsearch-$GIT_REV diff --git a/tools/mkpkg/mkpkg_vdr-plugin-dvbapi b/tools/mkpkg/mkpkg_vdr-plugin-dvbapi deleted file mode 100755 index ea5b0edfc45..00000000000 --- a/tools/mkpkg/mkpkg_vdr-plugin-dvbapi +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/sh -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 2 of the License, or -# (at your option) any later version. -# -# OpenELEC is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see <http://www.gnu.org/licenses/>. -################################################################################ - -PKG_NAME="vdr-plugin-dvbapi" -PKG_REPO="git://github.com/manio/vdr-plugin-dvbapi.git" - -echo "getting sources..." - if [ ! -d $PKG_NAME.git ]; then - git clone $PKG_REPO $PKG_NAME.git - fi - - cd $PKG_NAME.git - git pull - GIT_REV=`git log -n1 --format=%h` - cd .. - -echo "copying sources..." - rm -rf $PKG_NAME-$GIT_REV - cp -R $PKG_NAME.git $PKG_NAME-$GIT_REV - -echo "cleaning sources..." - rm -rf $PKG_NAME-$GIT_REV/.git - -echo "packing sources..." - tar cvJf $PKG_NAME-$GIT_REV.tar.xz $PKG_NAME-$GIT_REV - -echo "remove temporary sourcedir..." - rm -rf $PKG_NAME-$GIT_REV diff --git a/tools/mkpkg/mkpkg_vdr-plugin-eepg b/tools/mkpkg/mkpkg_vdr-plugin-eepg deleted file mode 100755 index f7f9af5e9d2..00000000000 --- a/tools/mkpkg/mkpkg_vdr-plugin-eepg +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/sh -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 2 of the License, or -# (at your option) any later version. -# -# OpenELEC is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see <http://www.gnu.org/licenses/>. -################################################################################ - -echo "getting sources..." - if [ ! -d vdr-plugin-eepg.git ]; then - git clone git://projects.vdr-developer.org/vdr-plugin-eepg.git vdr-plugin-eepg.git - fi - - cd vdr-plugin-eepg.git - git pull - GIT_REV=`git log -n1 --format=%h` - cd .. - -echo "copying sources..." - rm -rf vdr-plugin-eepg-$GIT_REV - cp -R vdr-plugin-eepg.git vdr-plugin-eepg-$GIT_REV - -echo "cleaning sources..." - rm -rf vdr-plugin-eepg-$GIT_REV/.git - -echo "packing sources..." - tar cvJf vdr-plugin-eepg-$GIT_REV.tar.xz vdr-plugin-eepg-$GIT_REV - -echo "remove temporary sourcedir..." - rm -rf vdr-plugin-eepg-$GIT_REV diff --git a/tools/mkpkg/mkpkg_vdr-plugin-epgfixer b/tools/mkpkg/mkpkg_vdr-plugin-epgfixer deleted file mode 100755 index 2735c66e25e..00000000000 --- a/tools/mkpkg/mkpkg_vdr-plugin-epgfixer +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/sh -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 2 of the License, or -# (at your option) any later version. -# -# OpenELEC is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see <http://www.gnu.org/licenses/>. -################################################################################ - -echo "getting sources..." - if [ ! -d vdr-plugin-epgfixer.git ]; then - git clone git://projects.vdr-developer.org/vdr-plugin-epgfixer.git vdr-plugin-epgfixer.git - fi - - cd vdr-plugin-epgfixer.git - git pull - GIT_REV=`git log -n1 --format=%h` - cd .. - -echo "copying sources..." - rm -rf vdr-plugin-epgfixer-$GIT_REV - cp -R vdr-plugin-epgfixer.git vdr-plugin-epgfixer-$GIT_REV - -echo "cleaning sources..." - rm -rf vdr-plugin-epgfixer-$GIT_REV/.git - -echo "packing sources..." - tar cvJf vdr-plugin-epgfixer-$GIT_REV.tar.xz vdr-plugin-epgfixer-$GIT_REV - -echo "remove temporary sourcedir..." - rm -rf vdr-plugin-epgfixer-$GIT_REV diff --git a/tools/mkpkg/mkpkg_vdr-plugin-streamdev b/tools/mkpkg/mkpkg_vdr-plugin-streamdev deleted file mode 100755 index 64049255e2b..00000000000 --- a/tools/mkpkg/mkpkg_vdr-plugin-streamdev +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/sh -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 2 of the License, or -# (at your option) any later version. -# -# OpenELEC is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see <http://www.gnu.org/licenses/>. -################################################################################ - -PKG_NAME="vdr-plugin-streamdev" -PKG_REPO="git://projects.vdr-developer.org/vdr-plugin-streamdev.git" - -echo "getting sources..." - if [ ! -d $PKG_NAME.git ]; then - git clone $PKG_REPO $PKG_NAME.git - fi - - cd $PKG_NAME.git - git pull - GIT_REV=`git log -n1 --format=%h` - cd .. - -echo "copying sources..." - rm -rf $PKG_NAME-$GIT_REV - cp -R $PKG_NAME.git $PKG_NAME-$GIT_REV - -echo "cleaning sources..." - rm -rf $PKG_NAME-$GIT_REV/.git - -echo "packing sources..." - tar cvJf $PKG_NAME-$GIT_REV.tar.xz $PKG_NAME-$GIT_REV - -echo "remove temporary sourcedir..." - rm -rf $PKG_NAME-$GIT_REV diff --git a/tools/mkpkg/mkpkg_vdr-plugin-vnsiserver b/tools/mkpkg/mkpkg_vdr-plugin-vnsiserver deleted file mode 100755 index 93d8da0558f..00000000000 --- a/tools/mkpkg/mkpkg_vdr-plugin-vnsiserver +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/sh -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 2 of the License, or -# (at your option) any later version. -# -# OpenELEC is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see <http://www.gnu.org/licenses/>. -################################################################################ - -echo "getting sources..." - if [ ! -d vdr-plugin-vnsiserver.git ]; then - git clone git://github.com/FernetMenta/vdr-plugin-vnsiserver vdr-plugin-vnsiserver.git - fi - - cd vdr-plugin-vnsiserver.git - git pull - GIT_REV=`git log -n1 --format=%h` - cd .. - -echo "copying sources..." - rm -rf vdr-plugin-vnsiserver-$GIT_REV - cp -R vdr-plugin-vnsiserver.git vdr-plugin-vnsiserver-$GIT_REV - -echo "cleaning sources..." - rm -rf vdr-plugin-vnsiserver-$GIT_REV/.git - -echo "packing sources..." - tar cvJf vdr-plugin-vnsiserver-$GIT_REV.tar.xz vdr-plugin-vnsiserver-$GIT_REV - -echo "remove temporary sourcedir..." - rm -rf vdr-plugin-vnsiserver-$GIT_REV diff --git a/tools/mkpkg/mkpkg_visualization.vsxu b/tools/mkpkg/mkpkg_visualization.vsxu deleted file mode 100755 index 80ac751498b..00000000000 --- a/tools/mkpkg/mkpkg_visualization.vsxu +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/sh -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 2 of the License, or -# (at your option) any later version. -# -# OpenELEC is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see <http://www.gnu.org/licenses/>. -################################################################################ - -echo "getting sources..." - if [ ! -d visualization.vsxu.git ]; then - git clone https://github.com/notspiff/visualization.vsxu.git visualization.vsxu.git - fi - - cd visualization.vsxu.git - git pull - GIT_REV=`git log -n1 --format=%h` - cd .. - -echo "copying sources..." - rm -rf visualization.vsxu-$GIT_REV - cp -R visualization.vsxu.git visualization.vsxu-$GIT_REV - -echo "cleaning sources..." - rm -rf visualization.vsxu-$GIT_REV/.git - -echo "packing sources..." - tar cvJf visualization.vsxu-$GIT_REV.tar.xz visualization.vsxu-$GIT_REV - -echo "remove temporary sourcedir..." - rm -rf visualization.vsxu-$GIT_REV diff --git a/tools/mkpkg/mkpkg_xf86-video-amdgpu b/tools/mkpkg/mkpkg_xf86-video-amdgpu deleted file mode 100755 index 0bd65c54ccb..00000000000 --- a/tools/mkpkg/mkpkg_xf86-video-amdgpu +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/sh -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 2 of the License, or -# (at your option) any later version. -# -# OpenELEC is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see <http://www.gnu.org/licenses/>. -################################################################################ - -echo "getting sources..." - if [ ! -d xf86-video-amdgpu.git ]; then - git clone git://anongit.freedesktop.org/xorg/driver/xf86-video-amdgpu xf86-video-amdgpu.git - fi - - cd xf86-video-amdgpu.git - git pull - GIT_REV=`git log -n1 --format=%h` - cd .. - -echo "copying sources..." - rm -rf xf86-video-amdgpu-$GIT_REV - cp -R xf86-video-amdgpu.git xf86-video-amdgpu-$GIT_REV - -echo "cleaning sources..." - rm -rf xf86-video-amdgpu-$GIT_REV/.git - -echo "packing sources..." - tar cvJf xf86-video-amdgpu-$GIT_REV.tar.xz xf86-video-amdgpu-$GIT_REV - -echo "remove temporary sourcedir..." - rm -rf xf86-video-amdgpu-$GIT_REV diff --git a/tools/mkpkg/mkpkg_binary-addons b/tools/mkpkg/update_binary-addons similarity index 65% rename from tools/mkpkg/mkpkg_binary-addons rename to tools/mkpkg/update_binary-addons index fabb8c2d32d..f6b7434efce 100755 --- a/tools/mkpkg/mkpkg_binary-addons +++ b/tools/mkpkg/update_binary-addons @@ -47,30 +47,6 @@ git_clone() { fi } -copy_sources() { - # copy_sources source_dir package_name package_version - if [ -d "$1" ] ; then - echo "[mkpkg] Copying sources: $2-$3" ... - rm -rf "$2-$3" - cp -R "$1" "$2-$3" - echo "$GIT_HASH" > "$2-$3/VERSION" - - echo "[mkpkg] Cleaning $2-$3 ..." - rm -rf "$2-$3/.git" - fi -} - -package_sources() { - # package_sources source_dir - if [ -d "$1" ] ; then - echo "[mkpkg] Packing $1.tar.xz ..." - if [ ! -f "$1.tar.xz" ] ; then - tar cvJf "$1.tar.xz" "$1" - fi - rm -rf "$1" - fi -} - resolve_hash() { if [ -d "$1" ] ; then cd "$1" @@ -78,48 +54,38 @@ resolve_hash() { fi } -copy_and_package() { - REPO="$1" - PKG_NAME="$2" - GIT_HASH="$3" - git_clone $REPO master $PKG_NAME.git $GIT_HASH - RESOLVED_HASH=$(resolve_hash $PKG_NAME.git $GIT_HASH) - if [ ! -e $PKG_NAME-$RESOLVED_HASH.tar.xz ] ; then - copy_sources $PKG_NAME.git $PKG_NAME $RESOLVED_HASH - package_sources $PKG_NAME-$RESOLVED_HASH - else - echo "[mkpkg] $PKG_NAME-$RESOLVED_HASH.tar.xz already exists ..." - fi -} - if [ ! -d $KODI_DIR ] ; then echo "meh.. $KODI_DIR does not exist" exit 127 fi -# platform -REPO=$(cat $KODI_DIR/project/cmake/addons/depends/common/platform/platform.txt | awk '{print $2}') -GIT_HASH=$(cat $KODI_DIR/project/cmake/addons/depends/common/platform/platform.txt | awk '{print $3}') +# p8-platform +REPO=$(cat $KODI_DIR/project/cmake/addons/depends/common/p8-platform/p8-platform.txt | awk '{print $2}') +GIT_HASH=$(cat $KODI_DIR/project/cmake/addons/depends/common/p8-platform/p8-platform.txt | awk '{print $3}') +PKG_NAME="p8-platform" -copy_and_package $REPO platform $GIT_HASH - -if [ -f ../../packages/mediacenter/platform/package.mk ] ; then +git_clone $REPO master $PKG_NAME.git $GIT_HASH +if [ -f ../../packages/mediacenter/p8-platform/package.mk ] ; then # update package.mk RESOLVED_HASH=$(resolve_hash $PKG_NAME.git $GIT_HASH) - sed -i "s|PKG_VERSION=.*|PKG_VERSION=\"$RESOLVED_HASH\"|g" ../../packages/mediacenter/platform/package.mk + sed -i "s|PKG_VERSION=.*|PKG_VERSION=\"$RESOLVED_HASH\"|g" ../../packages/mediacenter/p8-platform/package.mk fi +rm -rf $PKG_NAME.git # kodi-platform REPO=$(cat $KODI_DIR/project/cmake/addons/depends/common/kodi-platform/kodi-platform.txt | awk '{print $2}') GIT_HASH=$(cat $KODI_DIR/project/cmake/addons/depends/common/kodi-platform/kodi-platform.txt | awk '{print $3}') +PKG_NAME="kodi-platform" -copy_and_package $REPO kodi-platform $GIT_HASH - +git_clone $REPO master $PKG_NAME.git $GIT_HASH if [ -f ../../packages/mediacenter/kodi-platform/package.mk ] ; then # update package.mk RESOLVED_HASH=$(resolve_hash $PKG_NAME.git $GIT_HASH) - sed -i "s|PKG_VERSION=.*|PKG_VERSION=\"$RESOLVED_HASH\"|g" ../../packages/mediacenter/kodi-platform/package.mk + sed -e "s|PKG_VERSION=.*|PKG_VERSION=\"$RESOLVED_HASH\"|g" \ + -e "s|PKG_GIT_URL=.*|PKG_GIT_URL=\"$REPO\"|g" \ + -i ../../packages/mediacenter/kodi-platform/package.mk fi +rm -rf $PKG_NAME.git # addons for addontxt in $KODI_DIR/project/cmake/addons/bootstrap/repositories/*-addons.txt ; do @@ -131,19 +97,28 @@ for addontxt in $KODI_DIR/project/cmake/addons/bootstrap/repositories/*-addons.t ADDON=$(basename $addon) REPO=$(cat $addon/$ADDON.txt | awk '{print $2}') GIT_HASH=$(cat $addon/$ADDON.txt | awk '{print $3}') + PKG_NAME="$ADDON" if ! grep -q all $addon/platforms.txt && ! grep -q linux $addon/platforms.txt && ! grep -q ! $addon/platforms.txt; then continue fi if [ -f ../../packages/mediacenter/kodi-binary-addons/$ADDON/package.mk ] ; then - copy_and_package $REPO $ADDON $GIT_HASH + git_clone $REPO master $PKG_NAME.git $GIT_HASH # update package.mk RESOLVED_HASH=$(resolve_hash $PKG_NAME.git $GIT_HASH) - sed -i "s|PKG_VERSION=.*|PKG_VERSION=\"$RESOLVED_HASH\"|g" ../../packages/mediacenter/kodi-binary-addons/$ADDON/package.mk + sed -e "s|PKG_VERSION=.*|PKG_VERSION=\"$RESOLVED_HASH\"|g" \ + -e "s|PKG_GIT_URL=.*|PKG_GIT_URL=\"$REPO\"|g" \ + -i ../../packages/mediacenter/kodi-binary-addons/$ADDON/package.mk + + rm -rf $PKG_NAME.git + else echo "[mkpkg] Skipped $ADDON" + SKIPPED_ADDONS="$SKIPPED_ADDONS $ADDON" fi done + echo "followed addons was skipped, please add packages for this:" + echo "$SKIPPED_ADDONS" done diff --git a/tools/repo-tool b/tools/repo-tool new file mode 100755 index 00000000000..2c81f8b568a --- /dev/null +++ b/tools/repo-tool @@ -0,0 +1,196 @@ +#!/bin/bash + +################################################################################ +# This file is part of LibreELEC - https://libreelec.tv +# Copyright (C) 2009-2016 Lukas Rusak (lrusak@libreelec.tv) +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see <http://www.gnu.org/licenses/>. +################################################################################ + +. config/options + +update_addons_xml() { + echo "[*] cleanup addons ..." + olddir="" + find target/addons/$ADDON_VERSION -iname 'changelog*.txt' | sort -rV | while read line ; do + dir=$(dirname $line) + if [ "$olddir" = "$dir" ] ; then + rm -f $line + fi + olddir=$dir + done + + olddir="" + find target/addons/$ADDON_VERSION -iname '*.zip' | sort -rV | while read line ; do + dir=$(dirname $line) + if [ "$olddir" = "$dir" ] ; then + rm -f $line + fi + olddir=$dir + done + + echo "[*] updating addons.xml* ..." + rm -rf .addons + pwd=`pwd` + find target/addons/$ADDON_VERSION -iname addons.xml | while read line ; do + localdir=`echo $line | sed s/addons.xml//g` + echo " [*] updating $line..." + echo '<?xml version="1.0" encoding="UTF-8"?> +<addons> +' > $line.tmp + for zip in $localdir/*/*.zip ; do + mkdir -p ".addons/$localdir" + unzip $zip "*/addon.xml" -d ".addons/$localdir" &>/dev/null + done + find .addons/$localdir -iname addon.xml | grep -v resources/ | while read xml ; do + cat $xml | grep -v "<?" >> $line.tmp + done + echo ' +</addons>' >> $line.tmp + mv $line.tmp $line + cd $localdir + + md5sum addons.xml > addons.xml.md5 + cd $pwd + done + rm -rf .addons +} + +touch_addons_xml() { + for PROJECT in $(ls -1 projects); do + for archfile in projects/$PROJECT/linux/linux.*.conf ; do + ARCH=`echo $archfile | sed -n '$s/\.conf//;$s/.*\.//p'` + if [ ! -d target/addons/$ADDON_VERSION/$PROJECT/$ARCH ]; then + break + fi + if [ ! -f target/addons/$ADDON_VERSION/$PROJECT/$ARCH/addons.xml ]; then + touch target/addons/$ADDON_VERSION/$PROJECT/$ARCH/addons.xml + fi + done + done +} + +upload() { + if [ -f .work/repoconfig ] ; then + . .work/repoconfig + fi + if [ -z "$RSYNC_REPO" ] ; then + echo "*** ERROR: \$RSYNC_REPO not set. see .work/repoconfig ***" + exit 0 + fi + touch_addons_xml + update_addons_xml + rsync -av --progress --delete target/addons/$ADDON_VERSION $RSYNC_REPO +} + +build() { + for PROJECT in $2; do + for archfile in projects/$PROJECT/linux/linux.*.conf ; do + ARCH=`echo $archfile | sed -n '$s/\.conf//;$s/.*\.//p'` + for package in $(find $1 -iname package.mk) ; do + ( + . $package + if [ "$PKG_IS_ADDON" = "yes" ] ; then + ADDON=$PKG_NAME + PROJECT=$PROJECT ARCH=$ARCH ./scripts/create_addon $ADDON + fi + ) + done + done + done +} + +update_revision() { + for package in $(find packages/addons -iname package.mk) ; do + ( + . $package + if [ "$PKG_IS_ADDON" = "yes" ] ; then + sed -i -e "s|PKG_REV=.*|PKG_REV=\"$((PKG_REV+1))\"|" $package + fi + ) + done +} + +update_repo_version() { + for package in $(find packages/addons -iname package.mk) ; do + ( + . $package + if [ "$PKG_IS_ADDON" = "yes" ] ; then + sed -i -e "s|PKG_ADDON_REPOVERSION=.*|PKG_ADDON_REPOVERSION=\"$ADDON_VERSION\"|" $package + sed -i -e "s|PKG_REV=.*|PKG_REV=\"100\"|" $package + changelog="$(echo $package | sed 's/package.mk/changelog.txt/')" + sed -i "1i${ADDON_VERSION}.100\n- Update for LibreELEC ${ADDON_VERSION}\n" $changelog + fi + ) + done +} + +usage() { + echo " usage: $0 -u to upload" + echo " $0 -b binary|official|all [project-name] to build [for a single project]" + echo " $0 -ru to update PKG_REV" + echo " $0 -rv to update PKG_ADDON_REPOVERSION" + echo " $0 -xml to update the addons.xml" +} + +if [ "$1" = "-b" -a -z "$2" ]; then + usage + exit 0 +elif [ "$1" = "-b" -a -n "$2" ]; then + case $2 in + binary) + repo="packages/mediacenter/kodi-binary-addons" + ;; + official) + repo="packages/addons" + ;; + all) + repo="packages/addons packages/mediacenter/kodi-binary-addons" + ;; + *) + usage + exit 0 + ;; + esac + + project="$(ls -1 projects)" + if [ -n "$3" ]; then + project="$3" + fi + +fi + +case $1 in + -b) + build "$repo" "$project" + ;; + -u) + upload + ;; + -ru) + update_revision + ;; + -rv) + update_repo_version + ;; + -xml) + touch_addons_xml + update_addons_xml + ;; + *) + usage + exit 0 + ;; +esac +